CopyElements_SEMQuad Subroutine

public subroutine CopyElements_SEMQuad(myGeom, src, srcIdx, dstIdx, n)

Copy whole-element geometry blocks from src into myGeom: element srcIdx(k) of src becomes element dstIdx(k) of myGeom, for k = 1..n (AMR Stage 6c).

This is exact, not an interpolation, and it is what lets an adaptation epoch skip regenerating the elements it did not change. Every geometry quantity for an element depends only on that element's own mesh node coordinates - GenerateFromMesh, CalculateMetricTerms and CalculateContravariantBasis contain no neighbour coupling, no side pairing and no reduction, and the ±sign convention for normals is element-local - so moving an element's block between two geometries preserves it exactly.

Element is dimension 3 of every array, so each element's data is contiguous within a given set of trailing indices; the whole-slice assignments below are the natural expression of that and let the compiler emit block copies.

Arguments

TypeIntentOptionalAttributesName
class(SEMQuad), intent(inout) :: myGeom
type(SEMQuad), intent(in) :: src
integer, intent(in) :: srcIdx(:)
integer, intent(in) :: dstIdx(:)
integer, intent(in) :: n

Contents

Source Code


Source Code

  subroutine CopyElements_SEMQuad(myGeom,src,srcIdx,dstIdx,n)
    !! Copy whole-element geometry blocks from src into myGeom: element srcIdx(k) of src becomes
    !! element dstIdx(k) of myGeom, for k = 1..n (AMR Stage 6c).
    !!
    !! This is exact, not an interpolation, and it is what lets an adaptation epoch skip
    !! regenerating the elements it did not change. Every geometry quantity for an element depends
    !! only on that element's own mesh node coordinates - GenerateFromMesh, CalculateMetricTerms
    !! and CalculateContravariantBasis contain no neighbour coupling, no side pairing and no
    !! reduction, and the ±sign convention for normals is element-local - so moving an element's
    !! block between two geometries preserves it exactly.
    !!
    !! Element is dimension 3 of every array, so each element's data is contiguous within a given
    !! set of trailing indices; the whole-slice assignments below are the natural expression of
    !! that and let the compiler emit block copies.
    implicit none
    class(SEMQuad),intent(inout) :: myGeom
    type(SEMQuad),intent(in) :: src
    integer,intent(in) :: srcIdx(:)
    integer,intent(in) :: dstIdx(:)
    integer,intent(in) :: n
    ! Local
    integer :: k,s,d

    do k = 1,n
      s = srcIdx(k)
      d = dstIdx(k)

      myGeom%x%interior(:,:,d,:,:) = src%x%interior(:,:,s,:,:)
      myGeom%x%boundary(:,:,d,:,:) = src%x%boundary(:,:,s,:,:)

      myGeom%dxds%interior(:,:,d,:,:,:) = src%dxds%interior(:,:,s,:,:,:)

      myGeom%dsdx%interior(:,:,d,:,:,:) = src%dsdx%interior(:,:,s,:,:,:)
      myGeom%dsdx%boundary(:,:,d,:,:,:) = src%dsdx%boundary(:,:,s,:,:,:)

      myGeom%nHat%interior(:,:,d,:,:) = src%nHat%interior(:,:,s,:,:)
      myGeom%nHat%boundary(:,:,d,:,:) = src%nHat%boundary(:,:,s,:,:)

      myGeom%nScale%interior(:,:,d,:) = src%nScale%interior(:,:,s,:)
      myGeom%nScale%boundary(:,:,d,:) = src%nScale%boundary(:,:,s,:)

      myGeom%J%interior(:,:,d,:) = src%J%interior(:,:,s,:)
      myGeom%J%boundary(:,:,d,:) = src%J%boundary(:,:,s,:)
    enddo

  endsubroutine CopyElements_SEMQuad