#include <VisMF.H>
Public Types | |
enum | How { OneFilePerCPU } |
How we write out MultiFabs. More... | |
enum | { IO_Buffer_Size = 40960 * 32 } |
We try to do I/O with buffers of this size. More... | |
typedef char | Setbuf_Char_Type |
typedef Array< Setbuf_Char_Type > | IO_Buffer |
A simple character buffer for setbuf() usage. | |
Public Member Functions | |
VisMF (const std::string &mf_name) | |
Construct by reading in the on-disk VisMF of the specified name. | |
int | nComp () const |
The number of components in the on-disk MultiFab. | |
int | nGrow () const |
The grow factor of the on-disk MultiFab. | |
int | size () const |
# of FABs in the VisMF. Equal to # of Boxes in the BoxArray. | |
const BoxArray & | boxArray () const |
The BoxArray of the on-disk MultiFab. | |
Real | min (int fabIndex, int nComp) const |
The min of the FAB (in valid region) at specified index and component. | |
Real | max (int fabIndex, int nComp) const |
The max of the FAB (in valid region) at specified index and component. | |
const FArrayBox & | GetFab (int fabIndex, int compIndex) const |
The FAB at the specified index and component. | |
void | clear (int fabIndex, int compIndex) |
Delete()s the FAB at the specified index and component. | |
void | clear (int fabIndex) |
Delete()s the FAB at the specified index (all components). | |
void | clear () |
Delete()s all the FABs. | |
FArrayBox * | readFAB (int fabIndex, const std::string &mfName) |
Read the entire fab (all components). | |
FArrayBox * | readFAB (int fabIndex, int ncomp) |
Read the specified fab component. | |
Static Public Member Functions | |
static long | Write (const MultiFab &mf, const std::string &name, VisMF::How how=OneFilePerCPU, bool set_ghost=false) |
Write a MultiFab to disk in a "smart" way. | |
static void | Read (MultiFab &mf, const std::string &name) |
Read a MultiFab from disk written using VisMF::Write(). | |
static long | FileOffset (std::ostream &os) |
The file offset of the passed ostream. | |
Classes | |
struct | FabOnDisk |
A structure containing info regarding an on-disk FAB. More... | |
struct | Header |
An on-disk MultiFab contains this info in a header file. More... |
Wrapper class for reading/writing MultiFabs to disk in various "smart" ways.
typedef char VisMF::Setbuf_Char_Type |
typedef Array<Setbuf_Char_Type> VisMF::IO_Buffer |
A simple character buffer for setbuf() usage.
enum VisMF::How |
VisMF::VisMF | ( | const std::string & | mf_name | ) | [explicit] |
Construct by reading in the on-disk VisMF of the specified name.
The MF on-disk is read lazily. The name here is the name of the MF not the name of the on-disk file.
References Array< T >::dataPtr(), BoxLib::FileOpenFailed(), IO_Buffer_Size, nComp(), and Array< T >::size().
int VisMF::nComp | ( | ) | const |
The number of components in the on-disk MultiFab.
References VisMF::Header::m_ncomp.
Referenced by VisMF().
int VisMF::nGrow | ( | ) | const |
int VisMF::size | ( | ) | const |
# of FABs in the VisMF. Equal to # of Boxes in the BoxArray.
References VisMF::Header::m_ba, and BoxArray::size().
const BoxArray & VisMF::boxArray | ( | ) | const |
Real VisMF::min | ( | int | fabIndex, | |
int | nComp | |||
) | const |
The min of the FAB (in valid region) at specified index and component.
References BL_ASSERT, VisMF::Header::m_ba, VisMF::Header::m_min, VisMF::Header::m_ncomp, and BoxArray::size().
Real VisMF::max | ( | int | fabIndex, | |
int | nComp | |||
) | const |
The max of the FAB (in valid region) at specified index and component.
References BL_ASSERT, VisMF::Header::m_ba, VisMF::Header::m_max, VisMF::Header::m_ncomp, and BoxArray::size().
const FArrayBox & VisMF::GetFab | ( | int | fabIndex, | |
int | compIndex | |||
) | const |
The FAB at the specified index and component.
Reads it from disk if necessary. This reads only the specified component.
References readFAB().
void VisMF::clear | ( | int | fabIndex, | |
int | compIndex | |||
) |
Delete()s the FAB at the specified index and component.
void VisMF::clear | ( | int | fabIndex | ) |
Delete()s the FAB at the specified index (all components).
References clear(), and Array< T >::size().
void VisMF::clear | ( | ) |
long VisMF::Write | ( | const MultiFab & | mf, | |
const std::string & | name, | |||
VisMF::How | how = OneFilePerCPU , |
|||
bool | set_ghost = false | |||
) | [static] |
Write a MultiFab to disk in a "smart" way.
Returns the total number of bytes written on this processor. If set is true, sets the ghost cells in the MultiFab to one-half the average of the min and max over the valid region of each contained FAB.
References BL_ASSERT, BL_MPI_REQUIRE, FabArrayBase::boxArray(), ParallelDescriptor::Communicator(), Array< T >::dataPtr(), FabArrayBase::DistributionMap(), FileOffset(), BoxLib::FileOpenFailed(), FabArray< FAB >::get(), IO_Buffer_Size, ParallelDescriptor::IOProcessor(), ParallelDescriptor::IOProcessorNumber(), VisMF::Header::m_ba, VisMF::Header::m_fod, VisMF::Header::m_max, VisMF::Header::m_min, VisMF::Header::m_ncomp, MPI_Irecv(), MPI_REQUEST_NULL, MPI_Send(), MPI_Waitsome(), ParallelDescriptor::MyProc(), FabArrayBase::nComp(), ParallelDescriptor::NProcs(), DistributionMapping::ProcessorMap(), ParallelDescriptor::SeqNum(), BaseFab< T >::setComplement(), Array< T >::size(), and BoxLib::UnlinkFile().
void VisMF::Read | ( | MultiFab & | mf, | |
const std::string & | name | |||
) | [static] |
Read a MultiFab from disk written using VisMF::Write().
The MultiFab `mf' must have been defined using the default constructor.
References BL_ASSERT, Array< T >::dataPtr(), FabArray< FAB >::define(), Fab_noallocate, BoxLib::FileOpenFailed(), IO_Buffer_Size, VisMF::Header::m_ba, VisMF::Header::m_ncomp, VisMF::Header::m_ngrow, FabArray< FAB >::ok(), readFAB(), FabArray< FAB >::setFab(), and Array< T >::size().
long VisMF::FileOffset | ( | std::ostream & | os | ) | [static] |
FArrayBox * VisMF::readFAB | ( | int | fabIndex, | |
const std::string & | mfName | |||
) |
FArrayBox * VisMF::readFAB | ( | int | fabIndex, | |
int | ncomp | |||
) |