Current Device-Facing Object Families
Purpose
This document is the concrete family reference for Spheral’s current device-facing object model. It complements Value/View and Device Execution Model, which defines the value/view and managed view pointer shapes, and RAJA/CHAI Execution Patterns, which describes how those objects are used around RAJA launches.
Each section identifies:
the durable owner-side role;
the device-facing member that kernels capture, index, or call through;
the owner method or refresh point that makes the device-facing object current;
lifetime or invalidation constraints that matter to kernel setup.
Source Map
Field and field-list families:
src/Field/FieldBase.hhsrc/Field/Field.hhandsrc/Field/FieldInline.hhsrc/Field/FieldView.hhandsrc/Field/FieldViewInline.hhsrc/Field/FieldList.hhandsrc/Field/FieldListInline.hhsrc/Field/FieldListView.hhandsrc/Field/FieldListViewInline.hh
Pair and pairwise-value families:
src/Neighbor/NodePairList.hhandsrc/Neighbor/NodePairList.ccsrc/Neighbor/NodePairListView.hhsrc/Neighbor/PairwiseField.hhandsrc/Neighbor/PairwiseFieldInline.hhsrc/Neighbor/PairwiseFieldView.hhsrc/Neighbor/PairwiseFieldElementAccessor.hh
Kernel and interpolation families:
src/Kernel/TableKernel.hhandsrc/Kernel/TableKernel.ccsrc/Kernel/TableKernelInline.hhsrc/Kernel/TableKernelView.hhandsrc/Kernel/TableKernelViewInline.hhsrc/Utilities/QuadraticInterpolatorView.hhsrc/Utilities/CubicHermiteInterpolatorView.hh
Managed-dispatch family:
src/ArtificialViscosity/ArtificialViscosity.hhsrc/ArtificialViscosity/ArtificialViscosityView.hhconcrete artificial-viscosity owners and view implementations
FieldBase, Field, and FieldView
Field<Dimension, DataType> is the primary value/view example. It owns one
value of DataType per node on one NodeList. It inherits the typed view
interface from FieldView<Dimension, DataType> while FieldBase<Dimension>
provides the host-side type-erased interface.
Owner-side role:
Fieldownsstd::vector<DataType, DataAllocator<DataType>> mDataArray;FieldBasesupports boundary dispatch, restart registration, serialization, packing, cloning, and generic state registration;Fieldresponds to node-list resizing, deletion, reordering, copying, and deserialization.
Device-facing role:
FieldViewstoresmDataSpanplus primitive metadata such as internal and ghost counts;operator(),operator[], andatprovide typed indexed access;move,touch, anddatamanage CHAI-backed storage where needed;element accessors used by kernels are marked
SPHERAL_HOST_DEVICE.
Refresh point:
Field storage or node layout changes
|
v
Field::assignDataSpan()
updates span/ManagedArray binding
refreshes internal and ghost metadata
records CPU touch and callback where needed
|
v
Field::view()
returns shallow FieldView copy
FieldBase is intentionally not the inner-loop interface. Kernels use typed
FieldView objects or field-list views built from them.
FieldList and FieldListView
FieldList<Dimension, DataType> aggregates same-typed fields across node
lists. It may reference fields owned elsewhere or own copied fields in
mFieldCache.
Owner-side role:
FieldListmanages field membership and reference-vs-copy storage mode;buildDependentArrayssorts fields inNodeListRegistrarorder;the owner maintains typed field pointers,
FieldBasepointers, node-list pointers, and node-list index maps.
Device-facing role:
FieldListViewstores an array ofFieldViewobjects;kernels use
operator()(fieldIndex, nodeIndex)for direct value access;arithmetic, local reductions, and size/count queries operate over the view;
move(space, recursive=true)can move both the outer array and each nested field view’s data.
Refresh point:
FieldList membership or ownership changes
|
v
buildDependentArrays()
sort field pointers
rebuild node-list index map
assign mFieldViews[i] = field->view()
|
v
FieldList::view()
returns FieldListView over current field views
This lets a RAJA kernel use syntax such as mass(nodeListi, i) while the
host owner preserves node-list ordering, type-erased compatibility, and field
membership semantics.
NodePairList and NodePairListView
NodePairList is the owner/view family for an already-built flat pair
schedule. NodePairListView is the device-facing member captured by RAJA pair
kernels.
Owner-side role:
NodePairListownsstd::vector<NodePairIdxType>;the owner has host-side lookup support for mapping a pair value to an index;
connectivity construction replaces or refreshes the owner when pair topology changes.
Device-facing role:
NodePairListViewholds a span orchai::ManagedArrayover the pair vector;kernels index it by integer pair position with
pairs[kk];the view exposes pair-array size, data pointer, movement, and touch.
Refresh path:
pair schedule is built or replaced
|
v
NodePairList::initView()
wraps vector storage for CHAI/span access
|
v
NodePairList::view()
returns NodePairListView
|
v
RAJA pair loop reads pairs[kk]
ConnectivityMap is important context for this family because it builds and
provides the current NodePairList. The device-facing family member remains
NodePairListView.
PairwiseField and PairwiseFieldView
PairwiseField<Dimension, Value, numElements> stores values indexed by the
active pair-list position rather than by node. It is intentionally ephemeral
because connectivity can change step to step.
Owner-side role:
PairwiseFieldstores a weak pointer to the activeNodePairList;the owner sizes
mArraytonumElements * pairs.size();host code can access values by
NodePairIdxTypethrough the pair-list lookup.
Device-facing role:
PairwiseFieldViewexposes strided indexed access over the value array;kernels use integer pair-index access aligned with
NodePairListViewtraversal;movement and touch operate on the pairwise-value storage.
The view does not know how pair ids map to indices. Rebuilding or patching connectivity can orphan the owner-side pair association and invalidate existing views.
TableKernel and TableKernelView
TableKernel<Dimension> owns tabulated interpolation data for SPH kernel
evaluation. TableKernelView<Dimension> is the device-facing member used by
RAJA hydro kernels.
Owner-side role:
TableKernelowns interpolation tables such asmInterpVal,mGradInterpVal, andmGrad2InterpVal;the owner initializes lookup tables from the selected kernel;
construction and assignment refresh the embedded view members.
Device-facing role:
TableKernelViewcontains interpolator views and primitive lookup metadata;kernels call host/device methods such as
kernelValue,gradValue,grad2Value, andkernelAndGradValue;TableKernelView::moverecursively moves nested interpolator views.
The nested movement is the same general issue as FieldListView movement:
moving only the outer object is not sufficient when it contains managed data in
its child views.
ArtificialViscosity and ArtificialViscosityView
Artificial viscosity follows the owner/device-facing split but uses managed
runtime dispatch rather than a plain value view. The device-facing member is a
chai::managed_ptr to an ArtificialViscosityView<Dimension, QPiType> base
object.
Owner-side role:
ArtificialViscositydescendants own host parameters, package-facing APIs, restart identity, and configuration setters;concrete owners choose which concrete view class represents them;
setters update owner-side values and refresh existing managed views.
Device-facing role:
ArtificialViscosityViewdefines the virtualSPHERAL_HOST_DEVICEQPiijinterface;concrete view descendants contain only the data and methods needed by kernels;
RAJA pair kernels capture a
chai::managed_ptrto the base view and callQ->QPiij(...).
Dispatch path:
host ArtificialViscosity owner
reports QPiTypeIndex()
lazily owns chai::managed_ptr<ConcreteView>
|
| getScalarView() or getTensorView()
v
chai::managed_ptr<ArtificialViscosityView<Dimension, QPiType>>
base pointer with device-valid concrete view object
|
| captured by RAJA lambda
v
virtual QPiij dispatch on device
Host code first selects the scalar or tensor templated path. Dynamic polymorphism remains only for the concrete artificial-viscosity behavior inside that path. This keeps most type selection on the host while preserving the runtime behavior that the pair kernel needs.