Chombo + EB + MF  3.2
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | List of all members
DataFileIF Class Reference

#include <DataFileIF.H>

Inheritance diagram for DataFileIF:
Inheritance graph
[legend]

Public Types

enum  DataType { InvalidType = -1, ASCII = 0, Binary, NUMDATATYPES }
 
enum  DataSize { InvalidSize = -1, CharSize = 0, RealSize, NUMDATASIZES }
 

Public Member Functions

 DataFileIF (const DataFileIF::DataType &a_dataType, const Real &a_value, const bool &a_inside, const bool &a_useCubicInterp=false, const DataFileIF::DataSize &a_dataSize=DataFileIF::InvalidSize)
 
 DataFileIF (const char *const a_filename, const DataFileIF::DataType &a_dataType, const Real &a_value, const bool &a_inside, const bool &a_useCubicInterp=false, const DataFileIF::DataSize &a_dataSize=DataFileIF::InvalidSize)
 
 DataFileIF (const DataFileIF::DataType &a_dataType, const RealVect &a_spacing, const RealVect &a_origin, const Real &a_value, const bool &a_inside, const bool &a_useCubicInterp=false, const DataFileIF::DataSize &a_dataSize=DataFileIF::InvalidSize)
 
 DataFileIF (const char *const a_filename, const DataFileIF::DataType &a_dataType, const RealVect &a_spacing, const RealVect &a_origin, const Real &a_value, const bool &a_inside, const bool &a_useCubicInterp=false, const DataFileIF::DataSize &a_dataSize=DataFileIF::InvalidSize)
 
 DataFileIF (const DataFileIF::DataType &a_dataType, const IntVect &a_num, const RealVect &a_spacing, const RealVect &a_origin, const Real &a_value, const bool &a_inside, const bool &a_useCubicInterp=false, const DataFileIF::DataSize &a_dataSize=DataFileIF::InvalidSize)
 
 DataFileIF (const char *const a_filename, const DataFileIF::DataType &a_dataType, const IntVect &a_num, const RealVect &a_spacing, const RealVect &a_origin, const Real &a_value, const bool &a_inside, const bool &a_useCubicInterp=false, const DataFileIF::DataSize &a_dataSize=DataFileIF::InvalidSize)
 
 DataFileIF (const DataFileIF &a_inputIF)
 Copy constructor. More...
 
 DataFileIF (const RefCountedPtr< FArrayBox > a_real_data, const RefCountedPtr< BaseFab< unsigned char > > a_char_data, const Real &a_noDataValue, const IntVect &a_num, const RealVect &a_spacing, const RealVect &a_origin, const Real &a_value, const bool &a_inside, const bool &a_useCubicInterp=false)
 
virtual ~DataFileIF ()
 Destructor. More...
 
virtual void GetHeader (IntVect &a_num, RealVect &a_spacing, RealVect &a_origin) const
 
virtual void GetParams (Real &a_value, bool &a_inside, bool &a_useCubicInterp) const
 
virtual void SetParams (const Real &a_value, const bool &a_inside, const bool &a_useCubicInterp=false)
 
virtual void SetNoDataValue (const Real &a_value)
 
virtual Real value (const RealVect &a_point) const
 
virtual Real value (const IndexTM< Real, GLOBALDIM > &a_point) const
 
virtual Real value (const IndexTM< int, GLOBALDIM > &a_partialDerivative, const IndexTM< Real, GLOBALDIM > &a_point) const
 
virtual BaseIFnewImplicitFunction () const
 
void GetFullHeader (IntVect &a_num, RealVect &a_spacing, RealVect &a_origin)
 
RefCountedPtr< FArrayBoxGetRealData (void)
 
RefCountedPtr< BaseFab< unsigned char > > GetCharData (void)
 
- Public Member Functions inherited from BaseIF
 BaseIF ()
 Default constructor. More...
 
virtual ~BaseIF ()
 Default destructor. More...
 
virtual IndMomSpaceDim getExactVolumeMoments (const VolIndex &a_vof, const Real &a_dx) const
 return int x^p dV for the vof More...
 
virtual IndMomSpaceDim getExactEBMoments (const VolIndex &a_vof, const Real &a_dx) const
 return int_eb x^p dA for the eb More...
 
virtual IndMomSpaceDim getExactEBNormalMoments (const VolIndex &a_vof, const Real &a_dx, const int &a_ni) const
 return int_eb x^p n_i dA for the eb More...
 
virtual IndMomSpaceDim getExactEBNormalPartialDerivs (const VolIndex &a_vof, const Real &a_dx, const int &a_ni) const
 
virtual IndMomSDMinOne getExactFaceMoments (const FaceIndex &a_face, const Real &a_dx) const
 return int x^p dA for the face More...
 
virtual Real derivative (const IntVect &a_deriv, const RealVect &a_point) const
 return the partial derivative at the point More...
 
virtual Real value (const IntVect &a_deriv, const RealVect &a_point) const
 
virtual bool fastIntersection (const Box &a_region, const ProblemDomain &a_domain, const RealVect &a_origin, const Real &a_dx) const
 
virtual bool fastIntersection (const RealVect &a_low, const RealVect &a_high) const
 
virtual GeometryService::InOut InsideOutside (const Box &a_region, const ProblemDomain &a_domain, const RealVect &a_origin, const Real &a_dx) const
 
virtual GeometryService::InOut InsideOutside (const RealVect &a_low, const RealVect &a_high) const
 
virtual Real derivative (const IndexTM< int, GLOBALDIM > &a_deriv, const IndexTM< Real, GLOBALDIM > &a_point) const
 
virtual void print (ostream &out) const
 
virtual void makeGrids (const ProblemDomain &a_domain, DisjointBoxLayout &a_grids, const int &a_maxGridSize, const int &a_maxIrregGridSize)
 
virtual void boxLayoutChanged (const DisjointBoxLayout &a_newBoxLayout, const RealVect &a_dx)
 

Protected Member Functions

void OpenFile (ifstream &a_file, const char *const a_filename)
 
void CloseFile (ifstream &a_file)
 
void ReadMinHeader (IntVect &a_num, istream &a_file)
 
void ReadFullHeader (IntVect &a_num, RealVect &a_spacing, RealVect &a_origin, istream &a_file)
 
void ReadData (Real &a_maxValue, istream &a_file, const DataFileIF::DataType &a_dataType, DataFileIF::DataSize a_dataSize, const IntVect &a_num)
 
void MakeCorners (void)
 

Protected Attributes

IntVect m_num
 
RealVect m_spacing
 
RealVect m_origin
 
Real m_value
 
bool m_inside
 
RefCountedPtr< FArrayBoxm_real_data
 
RefCountedPtr< BaseFab< unsigned char > > m_char_data
 
Real m_noDataValue
 
IntVectSet m_cornersLinear
 
IntVectSet m_cornersCubic
 
bool m_useCubicInterp
 

Private Member Functions

 DataFileIF ()
 
void operator= (const DataFileIF &a_inputIF)
 

Additional Inherited Members

- Static Public Member Functions inherited from BaseIF
static void corners (const Box &a_region, const RealVect &a_origin, const Real &a_dx, RealVect &a_lo, RealVect &a_hi)
 

Detailed Description

This implicit function reads data from a file and produces function values from the data read. The data lies on a rectilinear grid where the number of grid points in each direction, the spacing, and the origin are specified (by the user or in the file). Function values within the data region are obtained using trilinear interpolation. Function values outside the data region are the maximum value of the data read.

The data can be read from standard input or a named file. The data can have no header, an ASCII header containing the number of grid points in each direction:

     numX numY [numZ]

or an ASCII header containing the above information followed by the data spacing in each direction and the origin of the data - both in physical coordinates:

     deltaX  deltaY  [deltaZ]
     originX originY [originZ]

Following any header is the data either in ASCII or binary. The data is assumed to vary most rapidly in the x coordinate, then the y coordinate, and, finally, in the z coordinate (for 3D data).

Member Enumeration Documentation

◆ DataType

Type of data being read

Enumerator
InvalidType 
ASCII 
Binary 
NUMDATATYPES 

◆ DataSize

Size of data being read

Enumerator
InvalidSize 
CharSize 
RealSize 
NUMDATASIZES 

Constructor & Destructor Documentation

◆ DataFileIF() [1/9]

DataFileIF::DataFileIF ( const DataFileIF::DataType a_dataType,
const Real a_value,
const bool &  a_inside,
const bool &  a_useCubicInterp = false,
const DataFileIF::DataSize a_dataSize = DataFileIF::InvalidSize 
)

Constructor specifying the form of the data (a_dataType - ASCII or Binary), a level set value (a_value), and whether inside the domain is where data is less than the level set value (a_inside). Data is read from standard input and a complete ASCII header (see above) is excepted.

◆ DataFileIF() [2/9]

DataFileIF::DataFileIF ( const char *const  a_filename,
const DataFileIF::DataType a_dataType,
const Real a_value,
const bool &  a_inside,
const bool &  a_useCubicInterp = false,
const DataFileIF::DataSize a_dataSize = DataFileIF::InvalidSize 
)

Constructor specifying filename (a_filename), the form of the data (a_dataType - ASCII or Binary), level set value (a_value), and whether inside the domain is where data is less than the level set value (a_inside). Data is read from the file named and a complete ASCII header (see above) is expected.

◆ DataFileIF() [3/9]

DataFileIF::DataFileIF ( const DataFileIF::DataType a_dataType,
const RealVect a_spacing,
const RealVect a_origin,
const Real a_value,
const bool &  a_inside,
const bool &  a_useCubicInterp = false,
const DataFileIF::DataSize a_dataSize = DataFileIF::InvalidSize 
)

Constructor specifying the form of the data (a_dataType - ASCII or Binary), the spacing (a_spacing), the physical origin (a_origin), a level set value (a_value), and whether inside the domain is where data is less than the level set value (a_inside). Data is read from standard input and an ASCII header (see above) containing the number of grid points in each direction is excepted.

◆ DataFileIF() [4/9]

DataFileIF::DataFileIF ( const char *const  a_filename,
const DataFileIF::DataType a_dataType,
const RealVect a_spacing,
const RealVect a_origin,
const Real a_value,
const bool &  a_inside,
const bool &  a_useCubicInterp = false,
const DataFileIF::DataSize a_dataSize = DataFileIF::InvalidSize 
)

Constructor specifying filename (a_filename), the form of the data (a_dataType - ASCII or Binary), the spacing (a_spacing), the physical origin (a_origin), a level set value (a_value), and whether inside the domain is where data is less than the level set value (a_inside). Data is read from the file named and an ASCII header (see above) containing the number of grid points in each direction is excepted.

◆ DataFileIF() [5/9]

DataFileIF::DataFileIF ( const DataFileIF::DataType a_dataType,
const IntVect a_num,
const RealVect a_spacing,
const RealVect a_origin,
const Real a_value,
const bool &  a_inside,
const bool &  a_useCubicInterp = false,
const DataFileIF::DataSize a_dataSize = DataFileIF::InvalidSize 
)

Constructor specifying the form of the data (a_dataType - ASCII or Binary), the spacing (a_spacing), the physical origin (a_origin), the number of grid points in each direction (a_num), a level set value (a_value), and whether inside the domain is where data is less than the level set value (a_inside). Data is read from standard input and no ASCII header (see above) is excepted.

◆ DataFileIF() [6/9]

DataFileIF::DataFileIF ( const char *const  a_filename,
const DataFileIF::DataType a_dataType,
const IntVect a_num,
const RealVect a_spacing,
const RealVect a_origin,
const Real a_value,
const bool &  a_inside,
const bool &  a_useCubicInterp = false,
const DataFileIF::DataSize a_dataSize = DataFileIF::InvalidSize 
)

Constructor specifying filename (a_filename), the form of the data (a_dataType - ASCII or Binary), the spacing (a_spacing), the physical origin (a_origin), the number of grid points in each direction (a_num), a level set value (a_value), and whether inside the domain is where data is less than the level set value (a_inside). Data is read from the file named and no ASCII header (see above) is excepted.

◆ DataFileIF() [7/9]

DataFileIF::DataFileIF ( const DataFileIF a_inputIF)

Copy constructor.

◆ DataFileIF() [8/9]

DataFileIF::DataFileIF ( const RefCountedPtr< FArrayBox a_real_data,
const RefCountedPtr< BaseFab< unsigned char > >  a_char_data,
const Real a_noDataValue,
const IntVect a_num,
const RealVect a_spacing,
const RealVect a_origin,
const Real a_value,
const bool &  a_inside,
const bool &  a_useCubicInterp = false 
)

This is used by the factory (see below) to create a new object. All objects created in this way share a refcounted pointer to their data.

Constructor specifying a refcounted pointer to the data (a_real_data or a_char_data), the no data value (a_noDataValue), the spacing (a_spacing), the physical origin (a_origin), the number of grid points in each direction (a_num), a level set value (a_value), and whether inside the domain is where data is less than the level set value (a_inside).

◆ ~DataFileIF()

virtual DataFileIF::~DataFileIF ( )
virtual

Destructor.

◆ DataFileIF() [9/9]

DataFileIF::DataFileIF ( )
inlineprivate

References MayDay::Abort().

Member Function Documentation

◆ GetHeader()

virtual void DataFileIF::GetHeader ( IntVect a_num,
RealVect a_spacing,
RealVect a_origin 
) const
virtual

Return the header information

◆ GetParams()

virtual void DataFileIF::GetParams ( Real a_value,
bool &  a_inside,
bool &  a_useCubicInterp 
) const
virtual

Return the parameter information

◆ SetParams()

virtual void DataFileIF::SetParams ( const Real a_value,
const bool &  a_inside,
const bool &  a_useCubicInterp = false 
)
virtual

Set the parameter information

◆ SetNoDataValue()

virtual void DataFileIF::SetNoDataValue ( const Real a_value)
virtual

value to use when we are outside

◆ value() [1/3]

virtual Real DataFileIF::value ( const RealVect a_point) const
virtual

Return the value of the function at a_point using trilinear interpolation of the data. If a_point is outside the data then return the maximum data value.

Implements BaseIF.

◆ value() [2/3]

virtual Real DataFileIF::value ( const IndexTM< Real, GLOBALDIM > &  a_point) const
virtual

Return the value of the function at a_point (of type INdexTM).

Reimplemented from BaseIF.

◆ value() [3/3]

virtual Real DataFileIF::value ( const IndexTM< int, GLOBALDIM > &  a_partialDerivative,
const IndexTM< Real, GLOBALDIM > &  a_point 
) const
virtual

Reimplemented from BaseIF.

◆ newImplicitFunction()

virtual BaseIF* DataFileIF::newImplicitFunction ( ) const
virtual

Return a newly allocated derived class. The responsibility for deleting the memory is left to the calling function.

Implements BaseIF.

◆ GetFullHeader()

void DataFileIF::GetFullHeader ( IntVect a_num,
RealVect a_spacing,
RealVect a_origin 
)
inline

References m_num, m_origin, and m_spacing.

◆ GetRealData()

RefCountedPtr<FArrayBox> DataFileIF::GetRealData ( void  )
inline

References m_real_data.

◆ GetCharData()

RefCountedPtr<BaseFab<unsigned char> > DataFileIF::GetCharData ( void  )
inline

◆ OpenFile()

void DataFileIF::OpenFile ( ifstream &  a_file,
const char *const  a_filename 
)
protected

Referenced by GetCharData().

◆ CloseFile()

void DataFileIF::CloseFile ( ifstream &  a_file)
protected

Referenced by GetCharData().

◆ ReadMinHeader()

void DataFileIF::ReadMinHeader ( IntVect a_num,
istream &  a_file 
)
protected

Referenced by GetCharData().

◆ ReadFullHeader()

void DataFileIF::ReadFullHeader ( IntVect a_num,
RealVect a_spacing,
RealVect a_origin,
istream &  a_file 
)
protected

Referenced by GetCharData().

◆ ReadData()

void DataFileIF::ReadData ( Real a_maxValue,
istream &  a_file,
const DataFileIF::DataType a_dataType,
DataFileIF::DataSize  a_dataSize,
const IntVect a_num 
)
protected

Referenced by GetCharData().

◆ MakeCorners()

void DataFileIF::MakeCorners ( void  )
protected

Referenced by GetCharData().

◆ operator=()

void DataFileIF::operator= ( const DataFileIF a_inputIF)
inlineprivate

References MayDay::Abort().

Member Data Documentation

◆ m_num

IntVect DataFileIF::m_num
protected

Referenced by GetFullHeader().

◆ m_spacing

RealVect DataFileIF::m_spacing
protected

Referenced by GetFullHeader().

◆ m_origin

RealVect DataFileIF::m_origin
protected

Referenced by GetFullHeader().

◆ m_value

Real DataFileIF::m_value
protected

◆ m_inside

bool DataFileIF::m_inside
protected

◆ m_real_data

RefCountedPtr<FArrayBox> DataFileIF::m_real_data
protected

Referenced by GetRealData().

◆ m_char_data

RefCountedPtr<BaseFab<unsigned char> > DataFileIF::m_char_data
protected

Referenced by GetCharData().

◆ m_noDataValue

Real DataFileIF::m_noDataValue
protected

◆ m_cornersLinear

IntVectSet DataFileIF::m_cornersLinear
protected

◆ m_cornersCubic

IntVectSet DataFileIF::m_cornersCubic
protected

◆ m_useCubicInterp

bool DataFileIF::m_useCubicInterp
protected

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