Scalar2D Derived Type

type, public, extends(Scalar2D_t) :: Scalar2D


Inherits

type~~scalar2d~~InheritsGraph type~scalar2d Scalar2D c_ptr c_ptr type~scalar2d->c_ptr interior_gpu, boundary_gpu, boundarynormal_gpu, extBoundary_gpu, avgBoundary_gpu type~scalar2d_t Scalar2D_t type~scalar2d->type~scalar2d_t type~self_dataobj SELF_DataObj type~scalar2d_t->type~self_dataobj type~lagrange Lagrange type~self_dataobj->type~lagrange interp type~metadata Metadata type~self_dataobj->type~metadata meta EquationParser EquationParser type~self_dataobj->EquationParser eqn type~lagrange_t Lagrange_t type~lagrange->type~lagrange_t

Contents

Source Code


Components

TypeVisibilityAttributesNameInitial
integer, public :: M
integer, public :: N
integer(kind=c_size_t), public :: alloc_avgBoundary =0
integer(kind=c_size_t), public :: alloc_boundary =0
integer(kind=c_size_t), public :: alloc_boundarynormal =0
integer(kind=c_size_t), public :: alloc_extBoundary =0
integer(kind=c_size_t), public :: alloc_interior =0
real(kind=prec), public, pointer, contiguous, dimension(:,:,:,:):: avgBoundary
type(c_ptr), public :: avgBoundary_gpu

Bytes currently allocated for each device buffer, so Resize can reuse them (Stage 6b).

character(len=3), public :: backend ="gpu"
real(kind=prec), public, pointer, contiguous, dimension(:,:,:,:):: boundary
type(c_ptr), public :: boundary_gpu
real(kind=prec), public, pointer, contiguous, dimension(:,:,:,:):: boundarynormal

High-water-mark backing store for the arrays above (AMR Stage 6b; see SELF_DataPool). The public members are pointers remapped onto the leading part of these pools at the exact logical shape, so every extent, stride and shape() stays exactly as before while Resize can reuse the storage across an adaptation epoch. Nothing should index the pools.

type(c_ptr), public :: boundarynormal_gpu
type(EquationParser), public, allocatable:: eqn(:)
real(kind=prec), public, pointer, contiguous, dimension(:,:,:,:):: extBoundary
type(c_ptr), public :: extBoundary_gpu
real(kind=prec), public, pointer, contiguous, dimension(:,:,:,:):: interior
type(c_ptr), public :: interior_gpu
type(Lagrange), public, pointer:: interp
type(Metadata), public, allocatable:: meta(:)
integer, public :: nElem
integer, public :: nVar
real(kind=prec), public, pointer, contiguous:: pool_avgBoundary(:)=> null()
real(kind=prec), public, pointer, contiguous:: pool_boundary(:)=> null()
real(kind=prec), public, pointer, contiguous:: pool_boundarynormal(:)=> null()
real(kind=prec), public, pointer, contiguous:: pool_extBoundary(:)=> null()
real(kind=prec), public, pointer, contiguous:: pool_interior(:)=> null()

Type-Bound Procedures

procedure, public :: AverageSides => AverageSides_Scalar2D

procedure, public :: BoundaryInterp => BoundaryInterp_Scalar2D

procedure, public :: Free => Free_Scalar2D

  • public subroutine Free_Scalar2D(this)

    Arguments

    TypeIntentOptionalAttributesName
    class(Scalar2D), intent(inout) :: this

generic, public :: Gradient => Gradient_Scalar2D_t, Gradient_Scalar2D

  • public subroutine Gradient_Scalar2D_t(this, df)

    Arguments

    TypeIntentOptionalAttributesName
    class(Scalar2D_t), intent(in) :: this
    real(kind=prec), intent(inout) :: df(1:this%N+1,1:this%N+1,1:this%nelem,1:this%nvar,1:2)
  • public subroutine Gradient_Scalar2D(this, df)

    Arguments

    TypeIntentOptionalAttributesName
    class(Scalar2D), intent(in) :: this
    type(c_ptr), intent(inout) :: df

procedure, private :: Gradient_Scalar2D

  • public subroutine Gradient_Scalar2D(this, df)

    Arguments

    TypeIntentOptionalAttributesName
    class(Scalar2D), intent(in) :: this
    type(c_ptr), intent(inout) :: df

generic, public :: GridInterp => GridInterp_Scalar2D_t, GridInterp_Scalar2D

  • public subroutine GridInterp_Scalar2D_t(this, f)

    Arguments

    TypeIntentOptionalAttributesName
    class(Scalar2D_t), intent(in) :: this
    real(kind=prec), intent(inout) :: f(1:this%M+1,1:this%M+1,1:this%nelem,1:this%nvar)
  • public subroutine GridInterp_Scalar2D(this, f)

    Arguments

    TypeIntentOptionalAttributesName
    class(Scalar2D), intent(inout) :: this
    type(c_ptr), intent(inout) :: f

procedure, private :: GridInterp_Scalar2D

  • public subroutine GridInterp_Scalar2D(this, f)

    Arguments

    TypeIntentOptionalAttributesName
    class(Scalar2D), intent(inout) :: this
    type(c_ptr), intent(inout) :: f

procedure, public :: Init => Init_Scalar2D

  • public subroutine Init_Scalar2D(this, interp, nVar, nElem)

    Arguments

    TypeIntentOptionalAttributesName
    class(Scalar2D), intent(out) :: this
    type(Lagrange), intent(in), target:: interp
    integer, intent(in) :: nVar
    integer, intent(in) :: nElem

procedure, public :: MapArrays => MapArrays_Scalar2D_t

  • public subroutine MapArrays_Scalar2D_t(this, Np, nVar, nElem)

    Size the backing pools for (Np,nVar,nElem) and remap the public arrays onto them at the exact logical shape. Bounds-remapping a rank-1 contiguous target to a rank-4 pointer is what keeps every extent and stride identical to a plain allocate while allowing the pool underneath to be larger and reused. See SELF_DataPool.

    Arguments

    TypeIntentOptionalAttributesName
    class(Scalar2D_t), intent(inout) :: this
    integer, intent(in) :: Np
    integer, intent(in) :: nVar
    integer, intent(in) :: nElem

procedure, public :: Resize => Resize_Scalar2D

  • public subroutine Resize_Scalar2D(this, interp, nVar, nElem)

    Rebind to a new element count, reusing host pools and device buffers where they fit. Deliberately does NOT call UpdateDevice: Init uploads freshly zeroed arrays, which in the adaptive loop is pure waste because the solution transfer overwrites them immediately.

    Arguments

    TypeIntentOptionalAttributesName
    class(Scalar2D), intent(inout) :: this
    type(Lagrange), intent(in), target:: interp
    integer, intent(in) :: nVar
    integer, intent(in) :: nElem

procedure, public :: SetDescription => SetDescription_DataObj

  • public subroutine SetDescription_DataObj(this, ivar, description)

    Set the description of the ivar-th variable

    Arguments

    TypeIntentOptionalAttributesName
    class(SELF_DataObj), intent(inout) :: this
    integer, intent(in) :: ivar
    character, intent(in) :: description

generic, public :: SetEquation => SetEquation_DataObj

  • public subroutine SetEquation_DataObj(this, ivar, eqnChar)

    Sets the equation parser for the ivar-th variable

    Arguments

    TypeIntentOptionalAttributesName
    class(SELF_DataObj), intent(inout) :: this
    integer, intent(in) :: ivar
    character, intent(in) :: eqnChar

procedure, public :: SetName => SetName_DataObj

  • public subroutine SetName_DataObj(this, ivar, name)

    Set the name of the ivar-th variable

    Arguments

    TypeIntentOptionalAttributesName
    class(SELF_DataObj), intent(inout) :: this
    integer, intent(in) :: ivar
    character, intent(in) :: name

procedure, public :: SetUnits => SetUnits_DataObj

  • public subroutine SetUnits_DataObj(this, ivar, units)

    Set the units of the ivar-th variable

    Arguments

    TypeIntentOptionalAttributesName
    class(SELF_DataObj), intent(inout) :: this
    integer, intent(in) :: ivar
    character, intent(in) :: units

procedure, public :: UpdateDevice => UpdateDevice_Scalar2D

procedure, public :: UpdateHost => UpdateHost_Scalar2D

generic, public :: WriteHDF5 => WriteHDF5_MPI_Scalar2D_t, WriteHDF5_Scalar2D_t

  • public subroutine WriteHDF5_MPI_Scalar2D_t(this, fileId, group, elemoffset, nglobalelem)

    Arguments

    TypeIntentOptionalAttributesName
    class(Scalar2D_t), intent(in) :: this
    integer(kind=HID_T), intent(in) :: fileId
    character, intent(in) :: group
    integer, intent(in) :: elemoffset
    integer, intent(in) :: nglobalelem
  • public subroutine WriteHDF5_Scalar2D_t(this, fileId, group)

    Arguments

    TypeIntentOptionalAttributesName
    class(Scalar2D_t), intent(in) :: this
    integer(kind=HID_T), intent(in) :: fileId
    character, intent(in) :: group

Source Code

  type,extends(Scalar2D_t),public :: Scalar2D
    character(3) :: backend = "gpu"
    type(c_ptr) :: interior_gpu
    type(c_ptr) :: boundary_gpu
    type(c_ptr) :: boundarynormal_gpu
    type(c_ptr) :: extBoundary_gpu
    type(c_ptr) :: avgBoundary_gpu
    !! Bytes currently allocated for each device buffer, so Resize can reuse them (Stage 6b).
    integer(c_size_t) :: alloc_interior = 0
    integer(c_size_t) :: alloc_boundary = 0
    integer(c_size_t) :: alloc_extBoundary = 0
    integer(c_size_t) :: alloc_avgBoundary = 0
    integer(c_size_t) :: alloc_boundarynormal = 0

  contains

    procedure,public :: Init => Init_Scalar2D
    procedure,public :: Resize => Resize_Scalar2D
    procedure,public :: Free => Free_Scalar2D

    procedure,public :: UpdateHost => UpdateHost_Scalar2D
    procedure,public :: UpdateDevice => UpdateDevice_Scalar2D

    procedure,public :: BoundaryInterp => BoundaryInterp_Scalar2D
    procedure,public :: AverageSides => AverageSides_Scalar2D
    generic,public :: GridInterp => GridInterp_Scalar2D
    procedure,private :: GridInterp_Scalar2D
    generic,public :: Gradient => Gradient_Scalar2D
    procedure,private :: Gradient_Scalar2D

  endtype Scalar2D