Block-Structured AMR Software Framework
amrex::FABio Class Referenceabstract

A Class Facilitating I/O for Fabs. More...

#include <AMReX_FArrayBox.H>

Inheritance diagram for amrex::FABio:
amrex::FABio_8bit amrex::FABio_ascii amrex::FABio_binary

Public Types

enum  Precision { FAB_FLOAT = 0 , FAB_DOUBLE }
 An enum which controls precision of FAB output. Valid values are FAB_FLOAT and FAB_DOUBLE. This is deprecated; i.e. please don't use it except for reading old FABs as it will probably be going away in a later release. More...
 
enum  Format {
  FAB_ASCII , FAB_IEEE , FAB_NATIVE , FAB_8BIT = 4 ,
  FAB_IEEE_32 , FAB_NATIVE_32
}
 An enum which controls format of FAB output. More...
 
enum  Ordering { FAB_NORMAL_ORDER , FAB_REVERSE_ORDER , FAB_REVERSE_ORDER_2 }
 An enum which controls byte ordering of FAB output. Valid values are FAB_NORMAL_ORDER, FAB_REVERSE_ORDER, and FAB_REVERSE_ORDER_2. This is deprecated; i.e. please don't use it except for reading old FABs as it will probably be going away in a later release. These exist solely to describe the ordering of "old" FABs that you want to read. More...
 

Public Member Functions

virtual ~FABio ()=default
 The virtual destructor. More...
 
virtual void read (std::istream &is, FArrayBox &fb) const =0
 Pure virtual function. Derived classes MUST override this function to read an FArrayBox from the istream, under the assumption that the header has already been read. More...
 
virtual void write (std::ostream &os, const FArrayBox &fb, int comp, int num_comp) const =0
 Pure virtual function. Derived classes MUST override this function to write the FArrayBox to the ostream, under the assumption that the header for the FAB has already been written. Write it out as if it only had num_comp components with component comp being the first one. More...
 
virtual void skip (std::istream &is, FArrayBox &f) const =0
 Pure virtual function. Derived classes MUST override this function to skip over the next FAB f in the istream, under the assumption that the header for the FAB f has already been skipped over. More...
 
virtual void skip (std::istream &is, FArrayBox &f, int nCompToSkip) const =0
 
virtual void write_header (std::ostream &os, const FArrayBox &f, int nvar) const
 Write out a header describing FArrayBox f that contains nvar components. It must be the case that nvar <= f.nComp(). More...
 

Static Public Member Functions

static FABioread_header (std::istream &is, FArrayBox &f)
 Read in the header from the istream. Returns a new'd FABio of the written-out type. Complements write_header. The user is responsible for delete'ing the returned FABio*. The FArrayBox f is resized to be on the Box and number of components read in from the header file. This is in preparation for next doing a read. This is split up so that we can make the read functions virtual, while having all the code for detailing the type of FArrayBox that was written out in one place. More...
 
static FABioread_header (std::istream &is, FArrayBox &f, int compIndex, int &nCompAvailable)
 Same as above except create a single component fab with data from the compIndex component of the istream fab. Return the number of available components in the istream fab. More...
 

Detailed Description

A Class Facilitating I/O for Fabs.

This data-less class aids I/O for FABs and encapsulates information about the floating point format being used in output. Note that the "new" format for writing out FABs is self-describing; i.e. we can always read in a FAB written in the "new" format. For this reason, it is usually preferable to write FABs out in the native format on the machine, unless you're doing computations in 64 bit and only want to write out 32 bit FABs.

With the exception of the enumeration constants, this class is primarily for FArrayBox implementers; i.e. user's shouldn't call any of the member functions in this class directly.

Member Enumeration Documentation

◆ Format

An enum which controls format of FAB output.

FAB_ASCII: write the FAB out in ASCII format.

FAB_8BIT: write the FAB out with all floating-point values scaled to range 0 - 255.

FAB_NATIVE: write out floating-point values in the native format. This is usually the "best" choice of formats.

FAB_IEEE_32: write out floating-point values in IEEE 32 bit normal format. This is recommended for use when your internal computations are done in 64 bits and you want to save space when writing out the FABs.

FAB_IEEE: this is deprecated. It is identical to FAB_IEEE_32.

FAB_NATIVE_32: write out values in the native 32 bit format.

Enumerator
FAB_ASCII 
FAB_IEEE 
FAB_NATIVE 
FAB_8BIT 
FAB_IEEE_32 
FAB_NATIVE_32 

◆ Ordering

An enum which controls byte ordering of FAB output. Valid values are FAB_NORMAL_ORDER, FAB_REVERSE_ORDER, and FAB_REVERSE_ORDER_2. This is deprecated; i.e. please don't use it except for reading old FABs as it will probably be going away in a later release. These exist solely to describe the ordering of "old" FABs that you want to read.

Enumerator
FAB_NORMAL_ORDER 
FAB_REVERSE_ORDER 
FAB_REVERSE_ORDER_2 

◆ Precision

An enum which controls precision of FAB output. Valid values are FAB_FLOAT and FAB_DOUBLE. This is deprecated; i.e. please don't use it except for reading old FABs as it will probably be going away in a later release.

Enumerator
FAB_FLOAT 
FAB_DOUBLE 

Constructor & Destructor Documentation

◆ ~FABio()

virtual amrex::FABio::~FABio ( )
virtualdefault

The virtual destructor.

Member Function Documentation

◆ read()

virtual void amrex::FABio::read ( std::istream &  is,
FArrayBox fb 
) const
pure virtual

Pure virtual function. Derived classes MUST override this function to read an FArrayBox from the istream, under the assumption that the header has already been read.

Implemented in amrex::FABio_binary, amrex::FABio_ascii, and amrex::FABio_8bit.

◆ read_header() [1/2]

FABio * amrex::FABio::read_header ( std::istream &  is,
FArrayBox f 
)
static

Read in the header from the istream. Returns a new'd FABio of the written-out type. Complements write_header. The user is responsible for delete'ing the returned FABio*. The FArrayBox f is resized to be on the Box and number of components read in from the header file. This is in preparation for next doing a read. This is split up so that we can make the read functions virtual, while having all the code for detailing the type of FArrayBox that was written out in one place.

◆ read_header() [2/2]

FABio * amrex::FABio::read_header ( std::istream &  is,
FArrayBox f,
int  compIndex,
int nCompAvailable 
)
static

Same as above except create a single component fab with data from the compIndex component of the istream fab. Return the number of available components in the istream fab.

◆ skip() [1/2]

virtual void amrex::FABio::skip ( std::istream &  is,
FArrayBox f 
) const
pure virtual

Pure virtual function. Derived classes MUST override this function to skip over the next FAB f in the istream, under the assumption that the header for the FAB f has already been skipped over.

Implemented in amrex::FABio_binary, amrex::FABio_ascii, and amrex::FABio_8bit.

◆ skip() [2/2]

virtual void amrex::FABio::skip ( std::istream &  is,
FArrayBox f,
int  nCompToSkip 
) const
pure virtual

◆ write()

virtual void amrex::FABio::write ( std::ostream &  os,
const FArrayBox fb,
int  comp,
int  num_comp 
) const
pure virtual

Pure virtual function. Derived classes MUST override this function to write the FArrayBox to the ostream, under the assumption that the header for the FAB has already been written. Write it out as if it only had num_comp components with component comp being the first one.

Implemented in amrex::FABio_binary, amrex::FABio_ascii, and amrex::FABio_8bit.

◆ write_header()

void amrex::FABio::write_header ( std::ostream &  os,
const FArrayBox f,
int  nvar 
) const
virtual

Write out a header describing FArrayBox f that contains nvar components. It must be the case that nvar <= f.nComp().

Reimplemented in amrex::FABio_binary, amrex::FABio_ascii, and amrex::FABio_8bit.


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