| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| character(len=3), | public | :: | backend | = | "gpu" | ||
| real(kind=prec), | public, | pointer | :: | coordinates(:,:) | => | null() | Reference coordinates (s,t[,u]) in [-1,1]^nDim, shape (1:nPoints, 1:nDim). Defined only where elements(p) > 0. |
| type(c_ptr), | public | :: | coordinates_gpu | = | c_null_ptr | ||
| integer, | public, | pointer | :: | elements(:) | => | null() | Element id (rank-local) containing each point; 0 = not found. |
| type(c_ptr), | public | :: | elements_gpu | = | c_null_ptr | ||
| real(kind=prec), | public, | pointer | :: | lS_cache(:,:) | => | null() | Lagrange basis at coordinates(p,1), shape (0:nCached, 1:nPoints). Filled by LocatePoints for points with elements(p) > 0. |
| type(c_ptr), | public | :: | lS_cache_gpu | = | c_null_ptr | ||
| real(kind=prec), | public, | pointer | :: | lT_cache(:,:) | => | null() | Lagrange basis at coordinates(p,2), shape (0:nCached, 1:nPoints). |
| type(c_ptr), | public | :: | lT_cache_gpu | = | c_null_ptr | ||
| real(kind=prec), | public, | pointer | :: | lU_cache(:,:) | => | null() | Lagrange basis at coordinates(p,3), shape (0:nCached, 1:nPoints). Allocated only for nDim = 3. |
| type(c_ptr), | public | :: | lU_cache_gpu | = | c_null_ptr | ||
| integer, | public | :: | nCached | = | 0 | Polynomial degree at which the per-point Lagrange basis cache is valid. Zero means no cache. The cache is filled by LocatePoints and consumed by EvaluateScalar when the field's interpolant degree matches. |
|
| integer, | public | :: | nCachedAlloc | = | 0 | Capacity (polynomial degree) of l*_cache_gpu; 0 = unallocated. |
|
| integer, | public | :: | nDim | = | 0 | ||
| integer, | public | :: | nPoints | = | 0 | ||
| integer, | public | :: | nPointsAlloc | = | 0 | Capacity of elements_gpu / coordinates_gpu (set in Init). |
|
| real(kind=prec), | public, | allocatable | :: | x(:,:) | Physical coordinates, shape (1:nPoints, 1:nDim). User input. |
Evaluate a 2D MappedScalar at all located points by tensor-product Lagrange interpolation at the stored reference coordinates. Points with elements(p) == 0 receive a value of zero. When LocatePoints has cached the per-point basis at the matching polynomial degree, this routine reuses it and skips Lagrange-polynomial evaluation altogether.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(Points_t), | intent(in) | :: | this | |||
| class(MappedScalar2D_t), | intent(in) | :: | scalar | |||
| real(kind=prec), | intent(out) | :: | values(1:this%nPoints,1:scalar%nVar) |
Evaluate a 2D MappedScalar at the cached points on the device. The caller is responsible for hipMalloc-ing values_dev with capacity nPointsnVarprec bytes. Layout is column-major (nPoints, nVar).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(Points), | intent(in) | :: | this | |||
| class(MappedScalar2D), | intent(in) | :: | scalar | |||
| type(c_ptr), | intent(inout) | :: | values_dev |
Evaluate a 3D MappedScalar at all located points by tensor-product Lagrange interpolation. Points with elements(p) == 0 receive zero. When LocatePoints has cached the basis at the matching degree, this routine reuses it.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(Points_t), | intent(in) | :: | this | |||
| class(MappedScalar3D_t), | intent(in) | :: | scalar | |||
| real(kind=prec), | intent(out) | :: | values(1:this%nPoints,1:scalar%nVar) |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(Points), | intent(in) | :: | this | |||
| class(MappedScalar3D), | intent(in) | :: | scalar | |||
| type(c_ptr), | intent(inout) | :: | values_dev |
Evaluate a 2D MappedScalar at all located points by tensor-product Lagrange interpolation at the stored reference coordinates. Points with elements(p) == 0 receive a value of zero. When LocatePoints has cached the per-point basis at the matching polynomial degree, this routine reuses it and skips Lagrange-polynomial evaluation altogether.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(Points_t), | intent(in) | :: | this | |||
| class(MappedScalar2D_t), | intent(in) | :: | scalar | |||
| real(kind=prec), | intent(out) | :: | values(1:this%nPoints,1:scalar%nVar) |
Evaluate a 3D MappedScalar at all located points by tensor-product Lagrange interpolation. Points with elements(p) == 0 receive zero. When LocatePoints has cached the basis at the matching degree, this routine reuses it.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(Points_t), | intent(in) | :: | this | |||
| class(MappedScalar3D_t), | intent(in) | :: | scalar | |||
| real(kind=prec), | intent(out) | :: | values(1:this%nPoints,1:scalar%nVar) |
Evaluate a 2D MappedScalar at the cached points on the device. The caller is responsible for hipMalloc-ing values_dev with capacity nPointsnVarprec bytes. Layout is column-major (nPoints, nVar).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(Points), | intent(in) | :: | this | |||
| class(MappedScalar2D), | intent(in) | :: | scalar | |||
| type(c_ptr), | intent(inout) | :: | values_dev |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(Points), | intent(in) | :: | this | |||
| class(MappedScalar3D), | intent(in) | :: | scalar | |||
| type(c_ptr), | intent(inout) | :: | values_dev |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(Points), | intent(inout) | :: | this |
Allocate host + device storage for nPoints in nDim dimensions. The basis-cache device buffers are allocated lazily in UpdateDevice once the polynomial degree N is known (it is set by LocatePoints).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(Points), | intent(out) | :: | this | |||
| integer, | intent(in) | :: | nPoints | |||
| integer, | intent(in) | :: | nDim |
Locate each stored physical point inside the 2D SEMQuad geometry. On exit, elements(p) holds the (rank-local) element id and coordinates(p,:) holds the (s,t) reference coordinates, both for points that resolve. Points that resolve to no element are marked with elements(p) = 0.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(Points_t), | intent(inout) | :: | this | |||
| type(SEMQuad), | intent(in) | :: | geometry |
Locate each stored physical point inside the 3D SEMHex geometry. On exit, elements(p) and coordinates(p,1:3) hold the located element id and reference (s,t,u) for points that resolve; elements(p) = 0 otherwise.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(Points_t), | intent(inout) | :: | this | |||
| type(SEMHex), | intent(in) | :: | geometry |
Run the host spatial-hash + Newton search (inherited from Points_t), then mirror per-point state to the device.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(Points), | intent(inout) | :: | this | |||
| type(SEMQuad), | intent(in) | :: | geometry |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(Points), | intent(inout) | :: | this | |||
| type(SEMHex), | intent(in) | :: | geometry |
Copy user-supplied physical coordinates into the cloud. xIn must be shape (nPoints, nDim) matching the init dimensions.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(Points_t), | intent(inout) | :: | this | |||
| real(kind=prec), | intent(in) | :: | xIn(:,:) |
Copy elements, coordinates, and the per-point Lagrange basis cache from host to device. Lazily (re)allocates the cache buffers if their degree changed since the previous call.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(Points), | intent(inout) | :: | this |
type,extends(Points_t),public :: Points
character(3) :: backend = "gpu"
integer :: nPointsAlloc = 0
!! Capacity of elements_gpu / coordinates_gpu (set in Init).
integer :: nCachedAlloc = 0
!! Capacity (polynomial degree) of l*_cache_gpu; 0 = unallocated.
type(c_ptr) :: elements_gpu = c_null_ptr
type(c_ptr) :: coordinates_gpu = c_null_ptr
type(c_ptr) :: lS_cache_gpu = c_null_ptr
type(c_ptr) :: lT_cache_gpu = c_null_ptr
type(c_ptr) :: lU_cache_gpu = c_null_ptr
contains
procedure,public :: Init => Init_Points
procedure,public :: Free => Free_Points
procedure,public :: UpdateDevice => UpdateDevice_Points
! Override the inherited specifics so LocatePoints automatically syncs
! device state after the host search.
procedure,public :: LocatePoints_2D_Points_t => LocatePoints_2D_Points
procedure,public :: LocatePoints_3D_Points_t => LocatePoints_3D_Points
! Add device-output specifics under the same EvaluateScalar generic. The
! inherited (host-output) specifics remain available for callers that
! want results in a Fortran array.
procedure,private :: EvalScalar_2D_dev_Points
procedure,private :: EvalScalar_3D_dev_Points
generic,public :: EvaluateScalar => EvalScalar_2D_dev_Points,EvalScalar_3D_dev_Points
endtype Points