Block-Structured AMR Software Framework
amrex::StateData Class Reference

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
 
StateDataoperator= (StateData const &rhs)
 
 StateData (StateData const &rhs)=delete
 
StateDataoperator= (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 StateDescriptordescriptor () const noexcept
 Returns the StateDescriptor. More...
 
const BoxgetDomain () const noexcept
 Returns the valid domain. More...
 
const BoxArrayboxArray () const noexcept
 Returns the BoxArray. More...
 
const DistributionMappingDistributionMap () 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...
 
MultiFabnewData () noexcept
 Returns the new data. More...
 
const MultiFabnewData () const noexcept
 Returns the new data. More...
 
MultiFaboldData () noexcept
 Returns the old data. More...
 
const MultiFaboldData () const noexcept
 Returns the old data. More...
 
FArrayBoxnewGrid (int i) noexcept
 Returns the FAB of new data at grid index ‘i’. More...
 
FArrayBoxoldGrid (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
 
ArenagetArena () 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 StateDescriptordesc {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< MultiFabnew_data
 Pointer to new-time data. More...
 
std::unique_ptr< MultiFabold_data
 Pointer to previous time data. More...
 
Arenaarena {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
 

Detailed Description

Current and previous level-time data.

StateData holds state data on a level for the current and previous time step.

Constructor & Destructor Documentation

◆ StateData() [1/4]

amrex::StateData::StateData ( )

The default constructor.

◆ StateData() [2/4]

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.

Parameters
p_domain
grds
dm
d
cur_time
dt
factory

◆ ~StateData()

amrex::StateData::~StateData ( )

The destructor.

◆ StateData() [3/4]

amrex::StateData::StateData ( StateData &&  rhs)
noexcept

◆ StateData() [4/4]

amrex::StateData::StateData ( StateData const &  rhs)
delete

Member Function Documentation

◆ allocOldData()

void amrex::StateData::allocOldData ( )

Allocates space for old timestep data.

◆ boxArray()

const BoxArray& amrex::StateData::boxArray ( ) const
inlinenoexcept

Returns the BoxArray.

◆ checkPoint()

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.

Parameters
name
fullpathname
os
how
dump_old

◆ ClearFabArrayHeaderNames()

static void amrex::StateData::ClearFabArrayHeaderNames ( )
inlinestatic

◆ copyNew()

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.

Parameters
state

◆ copyOld()

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.

Parameters
state

◆ curTime()

Real amrex::StateData::curTime ( ) const
inlinenoexcept

Returns the current time.

◆ define()

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.

Parameters
p_domain
grds
dm
d
cur_time
dt
factory

◆ descriptor()

const StateDescriptor* amrex::StateData::descriptor ( ) const
inlinenoexcept

Returns the StateDescriptor.

◆ DistributionMap()

const DistributionMapping& amrex::StateData::DistributionMap ( ) const
inlinenoexcept

◆ FabArrayHeaderNames()

static const Vector<std::string>& amrex::StateData::FabArrayHeaderNames ( )
inlinestatic

These facilitate prereading FabArray headers to avoid synchronization when reading multiple FabArrays.

◆ Factory()

const FabFactory<FArrayBox>& amrex::StateData::Factory ( ) const
inlinenoexcept

◆ FillBoundary() [1/2]

void amrex::StateData::FillBoundary ( Box const &  bx,
FArrayBox dest,
Real  time,
Geometry const &  geom,
int  dest_comp,
int  src_comp,
int  num_comp 
)

◆ FillBoundary() [2/2]

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.

Parameters
dest
time
dx
prob_domain
dest_comp
src_comp
num_comp

◆ getArena()

Arena* amrex::StateData::getArena ( ) const
inlinenoexcept

Get the Arena used.

◆ getBC()

BCRec amrex::StateData::getBC ( int  comp,
int  i 
) const
noexcept

Returns boundary conditions of specified component on the specified grid.

Parameters
comp
i

◆ getData()

void amrex::StateData::getData ( Vector< MultiFab * > &  data,
Vector< Real > &  datatime,
Real  time 
) const

◆ getDomain()

const Box& amrex::StateData::getDomain ( ) const
inlinenoexcept

Returns the valid domain.

◆ hasNewData()

bool amrex::StateData::hasNewData ( ) const
inlinenoexcept

True if there is any new data available.

◆ hasOldData()

bool amrex::StateData::hasOldData ( ) const
inlinenoexcept

True if there is any old data available.

◆ InterpAddBox()

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 
)

◆ InterpFillFab()

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 
)

◆ newData() [1/2]

const MultiFab& amrex::StateData::newData ( ) const
inlinenoexcept

Returns the new data.

◆ newData() [2/2]

MultiFab& amrex::StateData::newData ( )
inlinenoexcept

Returns the new data.

◆ newGrid()

FArrayBox& amrex::StateData::newGrid ( int  i)
inlinenoexcept

Returns the FAB of new data at grid index ‘i’.

Parameters
i

◆ oldData() [1/2]

const MultiFab& amrex::StateData::oldData ( ) const
inlinenoexcept

Returns the old data.

◆ oldData() [2/2]

MultiFab& amrex::StateData::oldData ( )
inlinenoexcept

Returns the old data.

◆ oldGrid()

FArrayBox& amrex::StateData::oldGrid ( int  i)
inlinenoexcept

Returns the FAB of old data at grid index ‘i’.

Parameters
i

◆ operator=() [1/2]

StateData& amrex::StateData::operator= ( StateData &&  rhs)
delete

◆ operator=() [2/2]

StateData & amrex::StateData::operator= ( StateData const &  rhs)

◆ prevTime()

Real amrex::StateData::prevTime ( ) const
inlinenoexcept

Returns the previous time.

◆ printTimeInterval()

void amrex::StateData::printTimeInterval ( std::ostream &  os) const

Prints out the time interval.

Parameters
os

◆ RegisterData()

void amrex::StateData::RegisterData ( MultiFabCopyDescriptor multiFabCopyDesc,
Vector< MultiFabId > &  mfid 
)

◆ removeOldData()

void amrex::StateData::removeOldData ( )
inline

Deletes the space used by the old timestep data.

◆ replaceNewData() [1/2]

void amrex::StateData::replaceNewData ( MultiFab &&  mf)

Swaps new data with a new MultiFab. Deletes the previous new data.

Parameters
mf

◆ replaceNewData() [2/2]

void amrex::StateData::replaceNewData ( StateData s)

Swaps new data with another StateData. Does not delete the previous new data.

Parameters
s

◆ replaceOldData() [1/2]

void amrex::StateData::replaceOldData ( MultiFab &&  mf)

Swaps old data with a new MultiFab. Deletes the previous old data.

Parameters
mf

◆ replaceOldData() [2/2]

void amrex::StateData::replaceOldData ( StateData s)

Swaps old data with another StateData. Does not delete the previous old data.

Parameters
s

◆ reset()

void amrex::StateData::reset ( )

Reverts back to initial state.

◆ restart() [1/2]

void amrex::StateData::restart ( const StateDescriptor d,
const StateData rhs 
)

or from another similar state

Parameters
d
rhs

◆ restart() [2/2]

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.

Parameters
is
p_domain
grds
dm
factroy
d
restart_file

◆ restartDoit()

void amrex::StateData::restartDoit ( std::istream &  is,
const std::string &  chkfile 
)
private

◆ setArena()

void amrex::StateData::setArena ( Arena ar)
inlinenoexcept

Set the Arena used.

◆ setDistributionMap()

void amrex::StateData::setDistributionMap ( DistributionMapping new_dmap)
inlinenoexcept
Parameters
new_dmap

◆ SetFAHeaderMapPtr()

static void amrex::StateData::SetFAHeaderMapPtr ( std::map< std::string, Vector< char > > *  fahmp)
inlinestatic

◆ setNewTimeLevel()

void amrex::StateData::setNewTimeLevel ( Real  time)

Sets time of new data.

Parameters
t_new

◆ setOldTimeLevel()

void amrex::StateData::setOldTimeLevel ( Real  time)

Sets time of old data.

Parameters
t_old

◆ setTimeLevel()

void amrex::StateData::setTimeLevel ( Real  time,
Real  dt_old,
Real  dt_new 
)

Sets time of old and new data.

Parameters
t_new
dt_old
dt_new

◆ swapTimeLevels()

void amrex::StateData::swapTimeLevels ( Real  dt)

Old data becomes new data and new time is incremented by dt.

Parameters
dt

◆ syncNewTimeLevel()

void amrex::StateData::syncNewTimeLevel ( Real  time)

Friends And Related Function Documentation

◆ StateDataPhysBCFunct

friend class StateDataPhysBCFunct
friend

Member Data Documentation

◆ arena

Arena* amrex::StateData::arena {nullptr}
private

Arena we should use for allocating the data.

◆ desc

const StateDescriptor* amrex::StateData::desc {nullptr}
private

Pointer to data descriptor.

◆ dmap

DistributionMapping amrex::StateData::dmap
private

◆ domain

Box amrex::StateData::domain
private

Problem domain.

◆ fabArrayHeaderNames

Vector< std::string > amrex::StateData::fabArrayHeaderNames
staticprivate

This is used as a temporary collection of FabArray header names written during a checkpoint.

◆ faHeaderMap

std::map< std::string, Vector< char > > * amrex::StateData::faHeaderMap
staticprivate

This is used to store preread FabArray headers.

◆ grids

BoxArray amrex::StateData::grids
private

Grids defined at this level.

◆ m_factory

std::unique_ptr<FabFactory<FArrayBox> > amrex::StateData::m_factory
private

◆ new_data

std::unique_ptr<MultiFab> amrex::StateData::new_data
private

Pointer to new-time data.

◆ new_time

TimeInterval amrex::StateData::new_time
private

Time variable assoc with new data.

◆ old_data

std::unique_ptr<MultiFab> amrex::StateData::old_data
private

Pointer to previous time data.

◆ old_time

TimeInterval amrex::StateData::old_time
private

Time variable assoc with old data.


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