3#include <AMReX_Config.H>
53 const int* lo,
const int* hi,
54 const int* domain_lo,
const int* domain_hi,
58 const int* level,
const int* grid_no) ;
84 const amrex::Real* compdat,
const int* clo,
const int* chi,
const int* ncomp,
85 const int* lo,
const int* hi,
86 const int* domain_lo,
const int* domain_hi,
90 const int* level,
const int* grid_no) ;
156 [[nodiscard]]
const std::string&
name () const noexcept;
161 [[nodiscard]] const std::
string&
variableName (
int comp) const noexcept;
192 [[nodiscard]]
int numDerive () const noexcept;
197 [[nodiscard]]
int numRange () const noexcept;
202 [[nodiscard]]
int numState () const noexcept;
207 [[nodiscard]] const
int*
getBC () const noexcept;
209 [[nodiscard]] const
int*
getBC3D () const noexcept;
222 int& num_comp) const;
305 Vector<std::
string> const& var_names,
314 Vector<std::
string> const& var_names,
323 Vector<std::
string> const& var_names,
332 Vector<std::
string> const& var_names,
367 std::string derive_name;
401 int* bcr3D =
nullptr;
435 [[nodiscard]]
bool canDerive (
const std::string& name)
const;
442 [[nodiscard]]
const DeriveRec*
get (
const std::string& name)
const;
454 void add (
const std::string& name,
462 void add (
const std::string& name,
470 void add (
const std::string& name,
478 void add (
const std::string& name,
493 void add (
const std::string& name,
509 void add (
const std::string& name,
518 void add (
const std::string& name,
527 void add (
const std::string& name,
536 void add (
const std::string& name,
560 [[nodiscard]] std::list<DeriveRec>&
dlist ();
567 std::list<DeriveRec> lst;
#define AMREX_ARLIM_P(x)
Definition AMReX_ArrayLim.H:30
Collection of spatial interpolaters used by FillPatch and flux-register logic.
A list of DeriveRecs.
Definition AMReX_Derive.H:411
DeriveList(DeriveList &&)=delete
Non-movable because the registry’s entries self-register with static globals.
DeriveList()=default
The default constructor.
~DeriveList()=default
Destructor (defaulted to keep header-only implementation trivial).
void add(const std::string &name, IndexType result_type, int nvar_derive, DeriveFunc der_func, const DeriveRec::DeriveBoxMap &bx_map, Interpolater *interp=&pc_interp)
Register a new derived quantity backed by a DeriveFunc.
Definition AMReX_Derive.cpp:378
std::list< DeriveRec > & dlist()
Mutable access to the underlying list of records.
Definition AMReX_Derive.cpp:480
const DeriveRec * get(const std::string &name) const
Access the particular record in registry.
Definition AMReX_Derive.cpp:505
DeriveList & operator=(const DeriveList &)=delete
Copy assignment disabled for the same reason as the copy constructor.
void clear()
Remove all registered derived records.
Definition AMReX_Derive.H:563
bool canDerive(const std::string &name) const
Determines whether quantity identified by name is registered.
Definition AMReX_Derive.cpp:486
DeriveList(const DeriveList &)=delete
Non-copyable registry; it owns pointers to callback records.
void addComponent(const std::string &name, const DescriptorList &d_list, int state_indx, int s_comp, int n_comp)
Adds another StateRange to the DeriveRec identified by name.
Definition AMReX_Derive.cpp:524
Derived Type Record.
Definition AMReX_Derive.H:114
IndexType deriveType() const noexcept
The IndexType of the derived type.
Definition AMReX_Derive.cpp:187
int numState() const noexcept
Total number of state variables needed for derived type.
Definition AMReX_Derive.cpp:241
DeriveFunc3D derFunc3D() const noexcept
Dimension-agnostic version of derFunc() that always takes 3-component bounds.
Definition AMReX_Derive.cpp:199
const std::string & name() const noexcept
The name of the derived type.
Definition AMReX_Derive.cpp:181
int numDerive() const noexcept
Number of components in the derived type.
Definition AMReX_Derive.cpp:229
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.
Definition AMReX_Derive.cpp:295
const std::string & variableName(int comp) const noexcept
Return the name of derived component comp.
Definition AMReX_Derive.cpp:368
void buildBC(const DescriptorList &d_list)
Build the 1D/2D BC arrays from the registered state descriptors d_list.
Definition AMReX_Derive.cpp:314
~DeriveRec()
The destructor.
Definition AMReX_Derive.cpp:162
DeriveFuncMF derFuncMF() const noexcept
MultiFab variant that fills directly without per-box callbacks.
Definition AMReX_Derive.cpp:211
const int * getBC3D() const noexcept
Boundary-condition array padded/truncated to three entries.
Definition AMReX_Derive.cpp:254
DeriveFunc derFunc() const noexcept
The DeriveFunc used to calculate the derived type.
Definition AMReX_Derive.cpp:193
static Box GrowBoxByOne(const Box &box) noexcept
Convenience mapper that grows the supplied box by one cell in every direction.
Definition AMReX_Derive.cpp:16
DeriveRec & operator=(DeriveRec const &)=delete
Copy assignment disabled for the same reason as the copy constructor.
void addRange(const DescriptorList &d_list, int state_indx, int src_comp, int num_comp)
Append another chunk of state data requirements.
Definition AMReX_Derive.cpp:261
std::function< Box(const Box &)> DeriveBoxMap
A pointer to function taking and returning a Box.
Definition AMReX_Derive.H:123
static Box TheSameBox(const Box &box) noexcept
Identity mapping from destination to source boxes.
Definition AMReX_Derive.cpp:10
DeriveBoxMap boxMap() const noexcept
Maps state data box to derived data box.
Definition AMReX_Derive.cpp:217
DeriveRec(DeriveRec &&)=delete
Non-movable to keep internal pointers/registrations stable.
DeriveRec(DeriveRec const &)=delete
Non-copyable; derived metadata owns non-trivial resources.
const int * getBC() const noexcept
The boundary conditions.
Definition AMReX_Derive.cpp:247
int numRange() const noexcept
Number of different chunks of state data needed for derived type.
Definition AMReX_Derive.cpp:235
Interpolater * interp() const noexcept
Type of interpolater to use in computing derived type.
Definition AMReX_Derive.cpp:223
void buildBC3D(const DescriptorList &d_list)
Build the 3D BC arrays from the registered state descriptors d_list.
Definition AMReX_Derive.cpp:338
DeriveFuncFab derFuncFab() const noexcept
Callable that operates on a FAB-sized box instead of raw pointers.
Definition AMReX_Derive.cpp:205
Definition AMReX_StateDescriptor.H:423
A Fortran Array of REALs.
Definition AMReX_FArrayBox.H:231
Rectangular problem domain geometry.
Definition AMReX_Geometry.H:74
Virtual base class for interpolaters.
Definition AMReX_Interpolater.H:27
A collection (stored as an array) of FArrayBox objects.
Definition AMReX_MultiFab.H:40
This class is a thin wrapper around std::vector. Unlike vector, Vector::operator[] provides bound che...
Definition AMReX_Vector.H:28
amrex_real Real
Floating Point Type for Fields.
Definition AMReX_REAL.H:79
Definition AMReX_Amr.cpp:49
void(*)(amrex::Real *data, const int *dlo, const int *dhi, const int *nvar, const amrex::Real *compdat, const int *clo, const int *chi, const int *ncomp, const int *lo, const int *hi, const int *domain_lo, const int *domain_hi, const amrex::Real *delta, const amrex::Real *xlo, const amrex::Real *time, const amrex::Real *dt, const int *bcrec, const int *level, const int *grid_no) DeriveFunc3D
This is dimension agnostic. For example, dlo always has three elements.
Definition AMReX_Derive.H:90
std::function< void(amrex::MultiFab &der_mf, int dcomp, int ncomp, const amrex::MultiFab &data_mf, const amrex::Geometry &geomdata, amrex::Real time, const int *bcrec, int level)> DeriveFuncMF
Definition AMReX_Derive.H:99
BoxND< 3 > Box
Box is an alias for amrex::BoxND instantiated with AMREX_SPACEDIM.
Definition AMReX_BaseFwd.H:30
void(*)(amrex::Real *data, const int &, const int &, const int &, const int &, const int &, const int &, const int *nvar, const amrex::Real *compdat, const int &, const int &, const int &, const int &, const int &, const int &, const int *ncomp, const int *lo, const int *hi, const int *domain_lo, const int *domain_hi, const amrex::Real *delta, const amrex::Real *xlo, const amrex::Real *time, const amrex::Real *dt, const int *bcrec, const int *level, const int *grid_no) DeriveFunc
Type of extern "C" function called by DeriveRec to compute derived quantity.
Definition AMReX_Derive.H:58
std::function< void(const amrex::Box &bx, amrex::FArrayBox &derfab, int dcomp, int ncomp, const amrex::FArrayBox &datafab, const amrex::Geometry &geomdata, amrex::Real time, const int *bcrec, int level)> DeriveFuncFab
Definition AMReX_Derive.H:95
PCInterp pc_interp
CONSTRUCT A GLOBAL OBJECT OF EACH VERSION.
Definition AMReX_Interpolater.cpp:35
An element of a linked list to point to state quantities in AmrLevels.
Definition AMReX_Derive.H:357
int typ
Definition AMReX_Derive.H:358
int nc
Definition AMReX_Derive.H:360
StateRange * next
Definition AMReX_Derive.H:361
int sc
Definition AMReX_Derive.H:359