Block-Structured AMR Software Framework
Loading...
Searching...
No Matches
amrex::DeriveRec Class Reference

Derived Type Record. More...

#include <AMReX_Derive.H>

Classes

struct  StateRange
 An element of a linked list to point to state quantities in AmrLevels. More...
 

Public Types

using DeriveBoxMap = std::function< Box(const Box &)>
 A pointer to function taking and returning a Box.
 

Public Member Functions

 ~DeriveRec ()
 The destructor.
 
 DeriveRec (DeriveRec const &)=delete
 Non-copyable; derived metadata owns non-trivial resources.
 
 DeriveRec (DeriveRec &&)=delete
 Non-movable to keep internal pointers/registrations stable.
 
DeriveRecoperator= (DeriveRec const &)=delete
 Copy assignment disabled for the same reason as the copy constructor.
 
DeriveRecoperator= (DeriveRec &&)=delete
 Move assignment disabled to avoid dangling references inside registries.
 
const std::string & name () const noexcept
 The name of the derived type.
 
const std::string & variableName (int comp) const noexcept
 Return the name of derived component comp.
 
IndexType deriveType () const noexcept
 The IndexType of the derived type.
 
DeriveFunc derFunc () const noexcept
 The DeriveFunc used to calculate the derived type.
 
DeriveFunc3D derFunc3D () const noexcept
 Dimension-agnostic version of derFunc() that always takes 3-component bounds.
 
DeriveFuncFab derFuncFab () const noexcept
 Callable that operates on a FAB-sized box instead of raw pointers.
 
DeriveFuncMF derFuncMF () const noexcept
 MultiFab variant that fills directly without per-box callbacks.
 
DeriveBoxMap boxMap () const noexcept
 Maps state data box to derived data box.
 
Interpolaterinterp () const noexcept
 Type of interpolater to use in computing derived type.
 
int numDerive () const noexcept
 Number of components in the derived type.
 
int numRange () const noexcept
 Number of different chunks of state data needed for derived type.
 
int numState () const noexcept
 Total number of state variables needed for derived type.
 
const intgetBC () const noexcept
 The boundary conditions.
 
const intgetBC3D () const noexcept
 Boundary-condition array padded/truncated to three entries.
 
void getRange (int k, int &state_indx, int &src_comp, int &num_comp) const
 Describe which chunk of state data is needed for derived component range k.
 
 DeriveRec (std::string name, IndexType result_type, int nvar_derive, DeriveFunc der_func, DeriveBoxMap box_map, Interpolater *interp=&pc_interp)
 Construct a record driven by a Fortran-style DeriveFunc.
 
 DeriveRec (std::string name, IndexType result_type, int nvar_derive, DeriveFunc3D der_func_3d, DeriveBoxMap box_map, Interpolater *interp=&pc_interp)
 Construct a record using a dimension-agnostic DeriveFunc3D callback.
 
 DeriveRec (std::string name, IndexType result_type, int nvar_derive, DeriveFuncFab der_func_fab, DeriveBoxMap box_map, Interpolater *interp=&pc_interp)
 Construct a record whose implementation operates directly on FABs.
 
 DeriveRec (std::string name, IndexType result_type, int nvar_derive, DeriveFuncMF der_func_mf, DeriveBoxMap box_map, Interpolater *interp=&pc_interp)
 Construct a record whose implementation operates on MultiFabs.
 
 DeriveRec (std::string name, IndexType result_type, int nvar_derive, DeriveRec::DeriveBoxMap box_map)
 Construct a placeholder record without attaching a callable yet.
 
 DeriveRec (std::string name, IndexType result_type, int nvar_derive, Vector< std::string > const &var_names, DeriveFunc der_func, DeriveBoxMap box_map, Interpolater *interp=&pc_interp)
 Same as the basic constructor but labels each derived component.
 
 DeriveRec (std::string name, IndexType result_type, int nvar_derive, Vector< std::string > const &var_names, DeriveFunc3D der_func_3d, DeriveBoxMap box_map, Interpolater *interp=&pc_interp)
 3-D callback variant (parameters mirror the previous constructor).
 
 DeriveRec (std::string name, IndexType result_type, int nvar_derive, Vector< std::string > const &var_names, DeriveFuncFab der_func_fab, DeriveBoxMap box_map, Interpolater *interp=&pc_interp)
 FAB callback variant (parameters mirror the previous constructor).
 
 DeriveRec (std::string name, IndexType result_type, int nvar_derive, Vector< std::string > const &var_names, DeriveFuncMF der_func_mf, DeriveBoxMap box_map, Interpolater *interp=&pc_interp)
 MultiFab callback variant (parameters mirror the previous constructor).
 
void addRange (const DescriptorList &d_list, int state_indx, int src_comp, int num_comp)
 Append another chunk of state data requirements.
 
void buildBC (const DescriptorList &d_list)
 Build the 1D/2D BC arrays from the registered state descriptors d_list.
 
void buildBC3D (const DescriptorList &d_list)
 Build the 3D BC arrays from the registered state descriptors d_list.
 

Static Public Member Functions

static Box TheSameBox (const Box &box) noexcept
 Identity mapping from destination to source boxes.
 
static Box GrowBoxByOne (const Box &box) noexcept
 Convenience mapper that grows the supplied box by one cell in every direction.
 

Friends

class DeriveList
 

Detailed Description

Derived Type Record.

Computes quantities derived from state data.

DeriveRec is designed to compute quantities which can be derived from the state data contained in AmrLevel and its derivatives. Some examples might be kinetic energy, vorticity, concentration gradients ...

Member Typedef Documentation

◆ DeriveBoxMap

using amrex::DeriveRec::DeriveBoxMap = std::function<Box(const Box&)>

A pointer to function taking and returning a Box.

Constructor & Destructor Documentation

◆ ~DeriveRec()

amrex::DeriveRec::~DeriveRec ( )

The destructor.

◆ DeriveRec() [1/11]

amrex::DeriveRec::DeriveRec ( DeriveRec const &  )
delete

Non-copyable; derived metadata owns non-trivial resources.

◆ DeriveRec() [2/11]

amrex::DeriveRec::DeriveRec ( DeriveRec &&  )
delete

Non-movable to keep internal pointers/registrations stable.

◆ DeriveRec() [3/11]

amrex::DeriveRec::DeriveRec ( std::string  name,
IndexType  result_type,
int  nvar_derive,
DeriveFunc  der_func,
DeriveBoxMap  box_map,
Interpolater interp = &pc_interp 
)

Construct a record driven by a Fortran-style DeriveFunc.

Parameters
nameDerived quantity name (unique registry key).
result_typeIndex type describing the derived FAB layout.
nvar_deriveNumber of components produced by the derive function.
der_funcFunction pointer invoked to compute the quantity.
box_mapMapping from destination boxes back to source boxes.
interpInterpolater used when populating finer levels (defaults to piecewise-constant).

◆ DeriveRec() [4/11]

amrex::DeriveRec::DeriveRec ( std::string  name,
IndexType  result_type,
int  nvar_derive,
DeriveFunc3D  der_func_3d,
DeriveBoxMap  box_map,
Interpolater interp = &pc_interp 
)

Construct a record using a dimension-agnostic DeriveFunc3D callback.

Parameters mirror the DeriveFunc constructor but der_func_3d follows the 3-D argument shape.

◆ DeriveRec() [5/11]

amrex::DeriveRec::DeriveRec ( std::string  name,
IndexType  result_type,
int  nvar_derive,
DeriveFuncFab  der_func_fab,
DeriveBoxMap  box_map,
Interpolater interp = &pc_interp 
)

Construct a record whose implementation operates directly on FABs.

Parameters match the scalar constructor but der_func_fab is a callable accepting FABs.

◆ DeriveRec() [6/11]

amrex::DeriveRec::DeriveRec ( std::string  name,
IndexType  result_type,
int  nvar_derive,
DeriveFuncMF  der_func_mf,
DeriveBoxMap  box_map,
Interpolater interp = &pc_interp 
)

Construct a record whose implementation operates on MultiFabs.

Parameters match the scalar constructor but der_func_mf takes MultiFabs.

◆ DeriveRec() [7/11]

amrex::DeriveRec::DeriveRec ( std::string  name,
IndexType  result_type,
int  nvar_derive,
DeriveRec::DeriveBoxMap  box_map 
)

Construct a placeholder record without attaching a callable yet.

Parameters
nameDerived quantity name.
result_typeIndex type describing the derived FAB layout.
nvar_deriveNumber of components produced.
box_mapMapping from destination boxes back to source boxes.

◆ DeriveRec() [8/11]

amrex::DeriveRec::DeriveRec ( std::string  name,
IndexType  result_type,
int  nvar_derive,
Vector< std::string > const &  var_names,
DeriveFunc  der_func,
DeriveBoxMap  box_map,
Interpolater interp = &pc_interp 
)

Same as the basic constructor but labels each derived component.

Parameters
nameDerived quantity name.
result_typeIndex type describing the derived FAB layout.
nvar_deriveNumber of components produced.
var_namesHuman-readable names for each component.
der_funcFortran-style callback.
box_mapMapping from destination to source boxes.
interpInterpolater override (defaults to piecewise-constant).

◆ DeriveRec() [9/11]

amrex::DeriveRec::DeriveRec ( std::string  name,
IndexType  result_type,
int  nvar_derive,
Vector< std::string > const &  var_names,
DeriveFunc3D  der_func_3d,
DeriveBoxMap  box_map,
Interpolater interp = &pc_interp 
)

3-D callback variant (parameters mirror the previous constructor).

◆ DeriveRec() [10/11]

amrex::DeriveRec::DeriveRec ( std::string  name,
IndexType  result_type,
int  nvar_derive,
Vector< std::string > const &  var_names,
DeriveFuncFab  der_func_fab,
DeriveBoxMap  box_map,
Interpolater interp = &pc_interp 
)

FAB callback variant (parameters mirror the previous constructor).

◆ DeriveRec() [11/11]

amrex::DeriveRec::DeriveRec ( std::string  name,
IndexType  result_type,
int  nvar_derive,
Vector< std::string > const &  var_names,
DeriveFuncMF  der_func_mf,
DeriveBoxMap  box_map,
Interpolater interp = &pc_interp 
)

MultiFab callback variant (parameters mirror the previous constructor).

Member Function Documentation

◆ addRange()

void amrex::DeriveRec::addRange ( const DescriptorList d_list,
int  state_indx,
int  src_comp,
int  num_comp 
)

Append another chunk of state data requirements.

Parameters
d_listDescriptor registry providing metadata.
state_indxIndex into the descriptor list.
src_compStarting component inside the chosen state descriptor.
num_compNumber of components to sample for this range.

◆ boxMap()

DeriveRec::DeriveBoxMap amrex::DeriveRec::boxMap ( ) const
noexcept

Maps state data box to derived data box.

◆ buildBC()

void amrex::DeriveRec::buildBC ( const DescriptorList d_list)

Build the 1D/2D BC arrays from the registered state descriptors d_list.

◆ buildBC3D()

void amrex::DeriveRec::buildBC3D ( const DescriptorList d_list)

Build the 3D BC arrays from the registered state descriptors d_list.

◆ derFunc()

DeriveFunc amrex::DeriveRec::derFunc ( ) const
noexcept

The DeriveFunc used to calculate the derived type.

◆ derFunc3D()

DeriveFunc3D amrex::DeriveRec::derFunc3D ( ) const
noexcept

Dimension-agnostic version of derFunc() that always takes 3-component bounds.

◆ derFuncFab()

DeriveFuncFab amrex::DeriveRec::derFuncFab ( ) const
noexcept

Callable that operates on a FAB-sized box instead of raw pointers.

◆ derFuncMF()

DeriveFuncMF amrex::DeriveRec::derFuncMF ( ) const
noexcept

MultiFab variant that fills directly without per-box callbacks.

◆ deriveType()

IndexType amrex::DeriveRec::deriveType ( ) const
noexcept

The IndexType of the derived type.

◆ getBC()

const int * amrex::DeriveRec::getBC ( ) const
noexcept

The boundary conditions.

◆ getBC3D()

const int * amrex::DeriveRec::getBC3D ( ) const
noexcept

Boundary-condition array padded/truncated to three entries.

◆ getRange()

void amrex::DeriveRec::getRange ( int  k,
int state_indx,
int src_comp,
int num_comp 
) const

Describe which chunk of state data is needed for derived component range k.

Parameters
kRange index in [0,numRange()).
state_indxOutput: index into the state descriptor array.
src_compOutput: starting component in the chosen state.
num_compOutput: number of components to read.

◆ GrowBoxByOne()

Box amrex::DeriveRec::GrowBoxByOne ( const Box box)
staticnoexcept

Convenience mapper that grows the supplied box by one cell in every direction.

Parameters
boxDestination box; the return value is grow(box,1).

◆ interp()

Interpolater * amrex::DeriveRec::interp ( ) const
noexcept

Type of interpolater to use in computing derived type.

◆ name()

const std::string & amrex::DeriveRec::name ( ) const
noexcept

The name of the derived type.

◆ numDerive()

int amrex::DeriveRec::numDerive ( ) const
noexcept

Number of components in the derived type.

◆ numRange()

int amrex::DeriveRec::numRange ( ) const
noexcept

Number of different chunks of state data needed for derived type.

◆ numState()

int amrex::DeriveRec::numState ( ) const
noexcept

Total number of state variables needed for derived type.

◆ operator=() [1/2]

DeriveRec & amrex::DeriveRec::operator= ( DeriveRec &&  )
delete

Move assignment disabled to avoid dangling references inside registries.

◆ operator=() [2/2]

DeriveRec & amrex::DeriveRec::operator= ( DeriveRec const &  )
delete

Copy assignment disabled for the same reason as the copy constructor.

◆ TheSameBox()

Box amrex::DeriveRec::TheSameBox ( const Box box)
staticnoexcept

Identity mapping from destination to source boxes.

Parameters
boxDestination box passed to the callback.

◆ variableName()

const std::string & amrex::DeriveRec::variableName ( int  comp) const
noexcept

Return the name of derived component comp.

Friends And Related Symbol Documentation

◆ DeriveList

friend class DeriveList
friend

The documentation for this class was generated from the following files: