anchor.diff:                  end do
   
   !               # if point is in region, make sure that region is refined as specified
  -!               # if no problems, use specified tolerance and stress
  +!               # if nothing needs to be changed, use specified tolerance and stress
                   if (min_level > 0 .and. level < min_level) then
                       amrflags(i,j,k) = DOFLAG
                   else if (min_level > 0 .and. max_level < level) then
  
positive.code: ! for all arguments.  Copy that routine to the application directory and
  ! modify it if needed to restrict the region where refinement is allowed.
  !
  ! The trace of the stress is computed at points where refinement is
  ! allowed.  If this value is over tolsp, the point is flagged for
  ! refinement.  This function assumes the following stress tensor (sigma)
  ! structure for q:
  !
  !  q(1) - sigma_xx
  !  q(2) - sigma_yy
  !  q(3) - sigma_zz
  ! ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  !
      use regions_module, only: regions, num_regions
  
negative.code:             do i = 1,mx
                  xcell = xlower + (i-0.5d0)*dx
  
  !               # obtain the overall min and max levels from any regions containing the point
                  min_level = 0
                  max_level = infinity
                  do m =1,num_regions
  