Current RAJA-Captured Object Families
Purpose
This document is the concrete family reference for Spheral’s current RAJA-captured 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 family section answers four practical RAJA setup questions:
What stays alive on the host? This is the object that owns storage or configuration and enforces the rules for keeping that data valid.
What does the RAJA lambda capture? This is the view object or managed pointer captured by the lambda. The family section also names the indexed accessors or
SPHERAL_HOST_DEVICEmethods used inside the RAJA loop.How is that captured object made current? This is the constructor,
view(),initView(),assignDataSpan(), or accessor that binds the captured object to the current host-side data before launch.When should an old view not be reused? These are the host-object changes that can leave a previously captured object pointing at out-of-date storage, out-of-date membership, or the wrong pair ordering.
Family Overview
The current RAJA-facing object model is organized around long-lived host objects and small RAJA-captured objects:
field and field-list views expose node-indexed simulation state;
pair-list and pairwise-field views expose flattened pair schedules and data aligned to those schedules;
SPH kernel and interpolator views expose tabulated lookup data for SPH evaluations;
artificial-viscosity managed views preserve behavior that must be selected at runtime inside the RAJA loop.
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.
Host object:
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.
RAJA-captured object:
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 inside RAJA loops are marked
SPHERAL_HOST_DEVICE.
How RAJA setup gets a current view:
FieldBase is intentionally not the inner-loop interface. RAJA loops use typed
FieldView objects or field-list views built from them.
When old views should not be reused:
resizing, deletion, reordering, copying, or deserialization can rebind the field storage or change the node counts recorded in the view;
take a fresh
Field::view()after those host-object changes, afterField::assignDataSpan()has updated the storage binding.
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.
Host object:
FieldListmanages field membership and reference-vs-copy storage mode;buildDependentArrayssorts fields inNodeListRegistrarorder;the host object maintains typed field pointers,
FieldBasepointers, node-list pointers, and node-list index maps.
RAJA-captured object:
FieldListViewstores an array ofFieldViewobjects;RAJA loops 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.
How RAJA setup gets a current view:
This lets a RAJA loop use syntax such as mass(nodeListi, i) while the
host object preserves node-list ordering, type-erased compatibility, and field
membership semantics.
When old views should not be reused:
changing field membership, reference-vs-copy ownership, cached fields, or node-list ordering requires rebuilding the dependent arrays;
a
FieldListViewcontains shallowFieldViewcopies, so it does not automatically track later changes to theFieldListor its member fields.
NodePairList and NodePairListView
NodePairList is the host-object/view family for an already-built flat pair
schedule. NodePairListView is the RAJA-captured object used by pair loops.
Host object:
NodePairListownsstd::vector<NodePairIdxType>;the host object has lookup support for mapping a pair value to an index;
connectivity construction replaces or updates the
NodePairListwhen pair topology changes.
RAJA-captured object:
NodePairListViewholds a span orchai::ManagedArrayover the pair vector;RAJA pair loops index it by integer pair position with
pairs[kk];the view exposes pair-array size, data pointer, movement, and touch.
How RAJA setup gets a current view:
ConnectivityMap is important context for this family because it builds and
provides the current NodePairList. The RAJA-captured family member remains
NodePairListView.
When old views should not be reused:
connectivity updates can replace the
NodePairListand change pair order;mutating the pair vector with
fill,insert, orclearchanges the storage exposed by the view;take a fresh
NodePairList::view()after pair-list construction or mutation.
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.
Host object:
PairwiseFieldstores a weak pointer to the activeNodePairList;the host object sizes
mArraytonumElements * pairs.size();host code can access values by
NodePairIdxTypethrough the pair-list lookup.
RAJA-captured object:
PairwiseFieldViewexposes strided indexed access over the value array;RAJA pair loops use integer pair-index access aligned with
NodePairListViewtraversal;movement and touch operate on the pairwise-value storage.
How RAJA setup gets a current view:
The view does not know how pair ids map to indices. Rebuilding or patching connectivity can orphan the host-side pair association and invalidate existing views.
When old views should not be reused:
the field is tied to the
NodePairListused at construction time;rebuilding connectivity can replace that pair list, changing both lifetime and pair-index ordering;
use a
PairwiseFieldViewonly with the matchingNodePairListViewtraversal from the same connectivity state.
TableKernel and TableKernelView
TableKernel<Dimension> owns tabulated interpolation data for SPH kernel
evaluation. TableKernelView<Dimension> is the RAJA-captured object used by
RAJA hydro loops.
Host object:
TableKernelowns interpolation tables such asmInterpVal,mGradInterpVal, andmGrad2InterpVal;the host object initializes lookup tables from the selected SPH kernel;
construction binds the inherited view members to those owned lookup tables.
RAJA-captured object:
TableKernelViewcontains interpolator views and primitive lookup metadata;RAJA loops 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.
How RAJA setup gets a current view:
When old views should not be reused:
a
TableKernelViewis tied to the lookup tables of theTableKernelit came from;construct or select the final
TableKernelbefore taking the view for a launch;when running with explicit CHAI movement, move the
TableKernelViewso its nested interpolator views move with it.
ArtificialViscosity and ArtificialViscosityView
Artificial viscosity follows the host-object/RAJA-captured split but uses a
managed pointer for behavior selected at runtime rather than a plain value view.
The RAJA-captured object is a chai::managed_ptr to an
ArtificialViscosityView<Dimension, QPiType> base object.
Host object:
ArtificialViscositydescendants own host parameters, package-facing APIs, restart identity, and configuration setters;concrete classes choose which concrete view class represents them;
setters update host values and update existing managed views.
RAJA-captured object:
ArtificialViscosityViewdefines the virtualSPHERAL_HOST_DEVICEQPiijinterface;concrete view descendants contain only the data and methods needed by RAJA loops;
RAJA pair loops capture a
chai::managed_ptrto the base view and callQ->QPiij(...).
How RAJA setup gets a current managed pointer:
Host code first selects the scalar or tensor templated path. The only behavior still chosen at runtime inside that path is the concrete artificial-viscosity calculation. This keeps most type selection on the host while preserving the runtime behavior that the pair loop needs.
When old managed pointers should not be reused:
changing artificial-viscosity coefficients or options updates the host object and can require the concrete managed view to be recreated;
use the host-object accessor, such as
getScalarView()orgetTensorView(), during RAJA setup instead of caching a pointer across host-object configuration changes.
Source Map by Family
Use this map as an implementation reference after the host and RAJA-captured roles above are clear.
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
SPH 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-pointer family with behavior selected at runtime:
src/ArtificialViscosity/ArtificialViscosity.hhsrc/ArtificialViscosity/ArtificialViscosityView.hhconcrete artificial-viscosity classes and view implementations