A Descriptor of the Real Type. More...
#include <AMReX_FabConv.H>
Public Member Functions | |
RealDescriptor ()=default | |
The default constructor. Does not build a proper RealDescriptor. This should only be used when you need to build a generic RealDescriptor in order to be able to read in a specific one from an istream. More... | |
RealDescriptor (const Long *fr_, const int *ord_, int ordl_) | |
Construct a specific RealDescriptor, passing in the format of the Real, the order of the Real, and the length of the array detailing the ordering. More... | |
const Long * | format () const & |
Returns the format array as a const Long*. More... | |
const Long * | format () &&=delete |
const Vector< Long > & | formatarray () const & |
Returns const Vector<Long> reference to the format array. More... | |
const Vector< Long > & | formatarray () &&=delete |
const int * | order () const & |
Returns the order array as a const int*. More... | |
const int * | order () &&=delete |
const Vector< int > & | orderarray () const & |
Returns const Vector<int> reference to the order array. More... | |
const Vector< int > & | orderarray () &&=delete |
int | numBytes () const |
Returns the number of bytes in the Real. More... | |
bool | operator== (const RealDescriptor &rd) const |
The equality operator. More... | |
bool | operator!= (const RealDescriptor &rd) const |
The inequality operator. More... | |
RealDescriptor * | clone () const |
Returns a copy of this RealDescriptor on the heap. The user is responsible for deletion. More... | |
Static Public Member Functions | |
static void | SetFixDenormals () |
Set to always fix denormals when converting to native format. More... | |
static void | SetReadBufferSize (int rbs) |
Set read and write buffer sizes. More... | |
static void | SetWriteBufferSize (int wbs) |
static RealDescriptor * | newRealDescriptor (int fmt, int prec, const char *systype, int ordering) |
Returns a RealDescriptor on the heap detailing requested floating-point type. Here format, precision, and ordering correspond to the enumerations in FABio. This is here to support reading "old" FABs. Do NOT use it in new code. More... | |
static void | convertToNativeFormat (Real *out, Long nitems, void *in, const RealDescriptor &id) |
Convert nitems in RealDescriptor format to native Real format. The out array is assumed to be large enough to hold the resulting output. More... | |
static void | convertToNativeFormat (Real *out, Long nitems, std::istream &is, const RealDescriptor &id) |
Read nitems from istream in RealDescriptor format and convert them to the native Real format. The out array is assumed to be large enough to hold the resulting output. More... | |
static void | convertFromNativeFormat (std::ostream &os, Long nitems, const Real *in, const RealDescriptor &od) |
Convert nitems Reals in native format to RealDescriptor format and write them to the ostream. More... | |
static void | convertFromNativeFormat (void *out, Long nitems, const void *in, const RealDescriptor &od) |
Convert nitems Reals in native format to RealDescriptor format. The out array is assumed to be large enough to hold the resulting output. More... | |
static void | convertFromNativeFloatFormat (std::ostream &os, Long nitems, const float *in, const RealDescriptor &od) |
Convert nitems floats in native format to RealDescriptor format and write them to the ostream. More... | |
static void | convertFromNativeDoubleFormat (std::ostream &os, Long nitems, const double *in, const RealDescriptor &od) |
Convert nitems doubles in native format to RealDescriptor format and write them to the ostream. More... | |
static void | convertToNativeFloatFormat (float *out, Long nitems, std::istream &is, const RealDescriptor &id) |
Read nitems from istream in RealDescriptor format and convert them to the native float format. The out array is assumed to be large enough to hold the resulting output. More... | |
static void | convertToNativeDoubleFormat (double *out, Long nitems, std::istream &is, const RealDescriptor &id) |
Read nitems from istream in RealDescriptor format and convert them to the native double format. The out array is assumed to be large enough to hold the resulting output. More... | |
Private Attributes | |
Vector< Long > | fr |
Vector< int > | ord |
Static Private Attributes | |
static bool | bAlwaysFixDenormals |
static int | writeBufferSize |
static int | readBufferSize |
A Descriptor of the Real Type.
This class is meant to hold all information needed to completely describe the "Real" floating-point type on a machine. By "Real" here we mean either the "float" or "double" type that this version of AMReX was built with, which corresponds to whether BL_USE_FLOAT or BL_USE_DOUBLE was used to build the version of the library.
To describe a "Real" type two arrays are needed: one detailing the ordering of the bytes in the Real, relative to the canonical ordering 1 .. sizeof(Real) and the other detailing the format of the floating-point number.
The array detailing the format of a floating-point number is an eight-element array of longs containing the following information:
format[0] = number of bits per number format[1] = number of bits in exponent format[2] = number of bits in mantissa format[3] = start bit of sign format[4] = start bit of exponent format[5] = start bit of mantissa format[6] = high order mantissa bit (CRAY needs this) format[7] = bias of exponent
This allows us to write out "Real"s in the native format on a machine, and then by also saving the IntDescriptor, we can read them back in on another machine and have enough information to construct the exact same "Real" values, provided the Reals have the same size on the two machines.
|
default |
The default constructor. Does not build a proper RealDescriptor. This should only be used when you need to build a generic RealDescriptor in order to be able to read in a specific one from an istream.
Construct a specific RealDescriptor, passing in the format of the Real, the order of the Real, and the length of the array detailing the ordering.
RealDescriptor * amrex::RealDescriptor::clone | ( | ) | const |
Returns a copy of this RealDescriptor on the heap. The user is responsible for deletion.
|
static |
Convert nitems doubles in native format to RealDescriptor format and write them to the ostream.
|
static |
Convert nitems floats in native format to RealDescriptor format and write them to the ostream.
|
static |
Convert nitems Reals in native format to RealDescriptor format and write them to the ostream.
|
static |
Convert nitems Reals in native format to RealDescriptor format. The out array is assumed to be large enough to hold the resulting output.
|
static |
Read nitems from istream in RealDescriptor format and convert them to the native double format. The out array is assumed to be large enough to hold the resulting output.
|
static |
Read nitems from istream in RealDescriptor format and convert them to the native float format. The out array is assumed to be large enough to hold the resulting output.
|
static |
Read nitems from istream in RealDescriptor format and convert them to the native Real format. The out array is assumed to be large enough to hold the resulting output.
|
static |
Convert nitems in RealDescriptor format to native Real format. The out array is assumed to be large enough to hold the resulting output.
|
delete |
const Long * amrex::RealDescriptor::format | ( | ) | const & |
Returns the format array as a const Long*.
|
delete |
const Vector< Long > & amrex::RealDescriptor::formatarray | ( | ) | const & |
Returns const Vector<Long> reference to the format array.
|
static |
Returns a RealDescriptor on the heap detailing requested floating-point type. Here format, precision, and ordering correspond to the enumerations in FABio. This is here to support reading "old" FABs. Do NOT use it in new code.
int amrex::RealDescriptor::numBytes | ( | ) | const |
Returns the number of bytes in the Real.
bool amrex::RealDescriptor::operator!= | ( | const RealDescriptor & | rd | ) | const |
The inequality operator.
bool amrex::RealDescriptor::operator== | ( | const RealDescriptor & | rd | ) | const |
The equality operator.
|
delete |
const int * amrex::RealDescriptor::order | ( | ) | const & |
Returns the order array as a const int*.
Returns const Vector<int> reference to the order array.
|
static |
Set to always fix denormals when converting to native format.
|
static |
Set read and write buffer sizes.
|
static |
|
staticprivate |
|
private |
|
staticprivate |
|
staticprivate |