Current and previous level-time data. More...
#include <AMReX_StateData.H>
Classes | |
struct | TimeInterval |
Public Member Functions | |
StateData () | |
The default constructor. More... | |
StateData (const Box &p_domain, const BoxArray &grds, const DistributionMapping &dm, const StateDescriptor *d, Real cur_time, Real dt, const FabFactory< FArrayBox > &factory) | |
Constructor that properly initializes data members. More... | |
~StateData () | |
The destructor. More... | |
StateData (StateData &&rhs) noexcept | |
StateData & | operator= (StateData const &rhs) |
StateData (StateData const &rhs)=delete | |
StateData & | operator= (StateData &&rhs)=delete |
void | define (const Box &p_domain, const BoxArray &grds, const DistributionMapping &dm, const StateDescriptor &d, Real cur_time, Real dt, const FabFactory< FArrayBox > &factory) |
Initializes data members if you used default constructor. More... | |
void | copyOld (const StateData &state) |
Copies old data from another StateData object and sets the same time level. If old data is uninitialized, allocates it with same properties as the input data. More... | |
void | copyNew (const StateData &state) |
Copies new data from another StateData object and sets the same time level. If new data is uninitialized, allocates it with the same properties as the input data. More... | |
void | allocOldData () |
Allocates space for old timestep data. More... | |
void | removeOldData () |
Deletes the space used by the old timestep data. More... | |
void | reset () |
Reverts back to initial state. More... | |
void | swapTimeLevels (Real dt) |
Old data becomes new data and new time is incremented by dt. More... | |
void | replaceOldData (MultiFab &&mf) |
Swaps old data with a new MultiFab. Deletes the previous old data. More... | |
void | replaceOldData (StateData &s) |
Swaps old data with another StateData. Does not delete the previous old data. More... | |
void | replaceNewData (MultiFab &&mf) |
Swaps new data with a new MultiFab. Deletes the previous new data. More... | |
void | replaceNewData (StateData &s) |
Swaps new data with another StateData. Does not delete the previous new data. More... | |
void | setTimeLevel (Real time, Real dt_old, Real dt_new) |
Sets time of old and new data. More... | |
void | setOldTimeLevel (Real time) |
Sets time of old data. More... | |
void | setNewTimeLevel (Real time) |
Sets time of new data. More... | |
void | syncNewTimeLevel (Real time) |
void | RegisterData (MultiFabCopyDescriptor &multiFabCopyDesc, Vector< MultiFabId > &mfid) |
void | InterpAddBox (MultiFabCopyDescriptor &multiFabCopyDesc, Vector< MultiFabId > &mfid, BoxList *returnedUnfillableBoxes, Vector< FillBoxId > &returnedFillBoxIds, const Box &subbox, Real time, int src_comp, int dest_comp, int num_comp, bool extrap=false) |
void | InterpFillFab (MultiFabCopyDescriptor &fabCopyDesc, const Vector< MultiFabId > &mfid, const Vector< FillBoxId > &fillBoxIds, FArrayBox &dest, Real time, int src_comp, int dest_comp, int num_comp, bool extrap=false) |
void | FillBoundary (FArrayBox &dest, Real time, const Real *dx, const RealBox &prob_domain, int dest_comp, int src_comp, int num_comp=1) |
Set physical bndry values. More... | |
void | FillBoundary (Box const &bx, FArrayBox &dest, Real time, Geometry const &geom, int dest_comp, int src_comp, int num_comp) |
void | checkPoint (const std::string &name, const std::string &fullpathname, std::ostream &os, VisMF::How how, bool dump_old=true) |
Write the state data to a checkpoint file. More... | |
void | restart (std::istream &is, const Box &p_domain, const BoxArray &grds, const DistributionMapping &dm, const FabFactory< FArrayBox > &factory, const StateDescriptor &d, const std::string &chkfile) |
Restart with domain box, grids, and dmap provided. More... | |
void | restart (const StateDescriptor &d, const StateData &rhs) |
or from another similar state More... | |
const StateDescriptor * | descriptor () const noexcept |
Returns the StateDescriptor. More... | |
const Box & | getDomain () const noexcept |
Returns the valid domain. More... | |
const BoxArray & | boxArray () const noexcept |
Returns the BoxArray. More... | |
const DistributionMapping & | DistributionMap () const noexcept |
void | setDistributionMap (DistributionMapping &new_dmap) noexcept |
const FabFactory< FArrayBox > & | Factory () const noexcept |
Real | curTime () const noexcept |
Returns the current time. More... | |
Real | prevTime () const noexcept |
Returns the previous time. More... | |
MultiFab & | newData () noexcept |
Returns the new data. More... | |
const MultiFab & | newData () const noexcept |
Returns the new data. More... | |
MultiFab & | oldData () noexcept |
Returns the old data. More... | |
const MultiFab & | oldData () const noexcept |
Returns the old data. More... | |
FArrayBox & | newGrid (int i) noexcept |
Returns the FAB of new data at grid index ‘i’. More... | |
FArrayBox & | oldGrid (int i) noexcept |
Returns the FAB of old data at grid index ‘i’. More... | |
BCRec | getBC (int comp, int i) const noexcept |
Returns boundary conditions of specified component on the specified grid. More... | |
void | printTimeInterval (std::ostream &os) const |
Prints out the time interval. More... | |
bool | hasOldData () const noexcept |
True if there is any old data available. More... | |
bool | hasNewData () const noexcept |
True if there is any new data available. More... | |
void | getData (Vector< MultiFab * > &data, Vector< Real > &datatime, Real time) const |
Arena * | getArena () const noexcept |
Get the Arena used. More... | |
void | setArena (Arena *ar) noexcept |
Set the Arena used. More... | |
Static Public Member Functions | |
static const Vector< std::string > & | FabArrayHeaderNames () |
These facilitate prereading FabArray headers to avoid synchronization when reading multiple FabArrays. More... | |
static void | ClearFabArrayHeaderNames () |
static void | SetFAHeaderMapPtr (std::map< std::string, Vector< char > > *fahmp) |
Private Member Functions | |
void | restartDoit (std::istream &is, const std::string &chkfile) |
Private Attributes | |
std::unique_ptr< FabFactory< FArrayBox > > | m_factory |
const StateDescriptor * | desc {nullptr} |
Pointer to data descriptor. More... | |
Box | domain |
Problem domain. More... | |
BoxArray | grids |
Grids defined at this level. More... | |
DistributionMapping | dmap |
TimeInterval | new_time |
Time variable assoc with new data. More... | |
TimeInterval | old_time |
Time variable assoc with old data. More... | |
std::unique_ptr< MultiFab > | new_data |
Pointer to new-time data. More... | |
std::unique_ptr< MultiFab > | old_data |
Pointer to previous time data. More... | |
Arena * | arena {nullptr} |
Arena we should use for allocating the data. More... | |
Static Private Attributes | |
static Vector< std::string > | fabArrayHeaderNames |
This is used as a temporary collection of FabArray header names written during a checkpoint. More... | |
static std::map< std::string, Vector< char > > * | faHeaderMap |
This is used to store preread FabArray headers. More... | |
Friends | |
class | StateDataPhysBCFunct |
Current and previous level-time data.
StateData holds state data on a level for the current and previous time step.
amrex::StateData::StateData | ( | ) |
The default constructor.
amrex::StateData::StateData | ( | const Box & | p_domain, |
const BoxArray & | grds, | ||
const DistributionMapping & | dm, | ||
const StateDescriptor * | d, | ||
Real | cur_time, | ||
Real | dt, | ||
const FabFactory< FArrayBox > & | factory | ||
) |
Constructor that properly initializes data members.
p_domain | |
grds | |
dm | |
d | |
cur_time | |
dt | |
factory |
amrex::StateData::~StateData | ( | ) |
The destructor.
|
noexcept |
|
delete |
void amrex::StateData::allocOldData | ( | ) |
Allocates space for old timestep data.
void amrex::StateData::checkPoint | ( | const std::string & | name, |
const std::string & | fullpathname, | ||
std::ostream & | os, | ||
VisMF::How | how, | ||
bool | dump_old = true |
||
) |
Write the state data to a checkpoint file.
name | |
fullpathname | |
os | |
how | |
dump_old |
|
inlinestatic |
void amrex::StateData::copyNew | ( | const StateData & | state | ) |
Copies new data from another StateData object and sets the same time level. If new data is uninitialized, allocates it with the same properties as the input data.
state |
void amrex::StateData::copyOld | ( | const StateData & | state | ) |
Copies old data from another StateData object and sets the same time level. If old data is uninitialized, allocates it with same properties as the input data.
state |
|
inlinenoexcept |
Returns the current time.
void amrex::StateData::define | ( | const Box & | p_domain, |
const BoxArray & | grds, | ||
const DistributionMapping & | dm, | ||
const StateDescriptor & | d, | ||
Real | cur_time, | ||
Real | dt, | ||
const FabFactory< FArrayBox > & | factory | ||
) |
Initializes data members if you used default constructor.
p_domain | |
grds | |
dm | |
d | |
cur_time | |
dt | |
factory |
|
inlinenoexcept |
Returns the StateDescriptor.
|
inlinenoexcept |
|
inlinestatic |
These facilitate prereading FabArray headers to avoid synchronization when reading multiple FabArrays.
|
inlinenoexcept |
void amrex::StateData::FillBoundary | ( | Box const & | bx, |
FArrayBox & | dest, | ||
Real | time, | ||
Geometry const & | geom, | ||
int | dest_comp, | ||
int | src_comp, | ||
int | num_comp | ||
) |
void amrex::StateData::FillBoundary | ( | FArrayBox & | dest, |
Real | time, | ||
const Real * | dx, | ||
const RealBox & | prob_domain, | ||
int | dest_comp, | ||
int | src_comp, | ||
int | num_comp = 1 |
||
) |
Set physical bndry values.
dest | |
time | |
dx | |
prob_domain | |
dest_comp | |
src_comp | |
num_comp |
Returns boundary conditions of specified component on the specified grid.
comp | |
i |
void amrex::StateData::getData | ( | Vector< MultiFab * > & | data, |
Vector< Real > & | datatime, | ||
Real | time | ||
) | const |
|
inlinenoexcept |
Returns the valid domain.
|
inlinenoexcept |
True if there is any new data available.
|
inlinenoexcept |
True if there is any old data available.
void amrex::StateData::InterpAddBox | ( | MultiFabCopyDescriptor & | multiFabCopyDesc, |
Vector< MultiFabId > & | mfid, | ||
BoxList * | returnedUnfillableBoxes, | ||
Vector< FillBoxId > & | returnedFillBoxIds, | ||
const Box & | subbox, | ||
Real | time, | ||
int | src_comp, | ||
int | dest_comp, | ||
int | num_comp, | ||
bool | extrap = false |
||
) |
void amrex::StateData::InterpFillFab | ( | MultiFabCopyDescriptor & | fabCopyDesc, |
const Vector< MultiFabId > & | mfid, | ||
const Vector< FillBoxId > & | fillBoxIds, | ||
FArrayBox & | dest, | ||
Real | time, | ||
int | src_comp, | ||
int | dest_comp, | ||
int | num_comp, | ||
bool | extrap = false |
||
) |
|
inlinenoexcept |
Returns the new data.
|
inlinenoexcept |
Returns the new data.
Returns the FAB of new data at grid index ‘i’.
i |
|
inlinenoexcept |
Returns the old data.
|
inlinenoexcept |
Returns the old data.
Returns the FAB of old data at grid index ‘i’.
i |
|
inlinenoexcept |
Returns the previous time.
void amrex::StateData::printTimeInterval | ( | std::ostream & | os | ) | const |
Prints out the time interval.
os |
void amrex::StateData::RegisterData | ( | MultiFabCopyDescriptor & | multiFabCopyDesc, |
Vector< MultiFabId > & | mfid | ||
) |
|
inline |
Deletes the space used by the old timestep data.
void amrex::StateData::replaceNewData | ( | MultiFab && | mf | ) |
Swaps new data with a new MultiFab. Deletes the previous new data.
mf |
void amrex::StateData::replaceNewData | ( | StateData & | s | ) |
Swaps new data with another StateData. Does not delete the previous new data.
s |
void amrex::StateData::replaceOldData | ( | MultiFab && | mf | ) |
Swaps old data with a new MultiFab. Deletes the previous old data.
mf |
void amrex::StateData::replaceOldData | ( | StateData & | s | ) |
Swaps old data with another StateData. Does not delete the previous old data.
s |
void amrex::StateData::reset | ( | ) |
Reverts back to initial state.
void amrex::StateData::restart | ( | const StateDescriptor & | d, |
const StateData & | rhs | ||
) |
or from another similar state
d | |
rhs |
void amrex::StateData::restart | ( | std::istream & | is, |
const Box & | p_domain, | ||
const BoxArray & | grds, | ||
const DistributionMapping & | dm, | ||
const FabFactory< FArrayBox > & | factory, | ||
const StateDescriptor & | d, | ||
const std::string & | chkfile | ||
) |
Restart with domain box, grids, and dmap provided.
is | |
p_domain | |
grds | |
dm | |
factroy | |
d | |
restart_file |
|
private |
|
inlinenoexcept |
new_dmap |
|
inlinestatic |
void amrex::StateData::setNewTimeLevel | ( | Real | time | ) |
Sets time of new data.
t_new |
void amrex::StateData::setOldTimeLevel | ( | Real | time | ) |
Sets time of old data.
t_old |
void amrex::StateData::setTimeLevel | ( | Real | time, |
Real | dt_old, | ||
Real | dt_new | ||
) |
Sets time of old and new data.
t_new | |
dt_old | |
dt_new |
void amrex::StateData::swapTimeLevels | ( | Real | dt | ) |
Old data becomes new data and new time is incremented by dt.
dt |
void amrex::StateData::syncNewTimeLevel | ( | Real | time | ) |
|
friend |
|
private |
Pointer to data descriptor.
|
private |
|
private |
Problem domain.
|
staticprivate |
This is used as a temporary collection of FabArray header names written during a checkpoint.
|
staticprivate |
This is used to store preread FabArray headers.
|
private |
Grids defined at this level.
|
private |
|
private |
Pointer to new-time data.
|
private |
Time variable assoc with new data.
|
private |
Pointer to previous time data.
|
private |
Time variable assoc with old data.