![]() |
Block-Structured AMR Software Framework
|
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. | |
| 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. | |
| const Long * | format () const & |
| Returns the format array as a const Long*. | |
| const Long * | format () &&=delete |
| const Vector< Long > & | formatarray () const & |
| Returns const Vector<Long> reference to the format array. | |
| const Vector< Long > & | formatarray () &&=delete |
| const int * | order () const & |
| Returns the order array as a const int*. | |
| const int * | order () &&=delete |
| const Vector< int > & | orderarray () const & |
| Returns const Vector<int> reference to the order array. | |
| const Vector< int > & | orderarray () &&=delete |
| int | numBytes () const |
| Returns the number of bytes in the Real. | |
| bool | operator== (const RealDescriptor &rd) const |
| The equality operator. | |
| bool | operator!= (const RealDescriptor &rd) const |
| The inequality operator. | |
| RealDescriptor * | clone () const |
| Returns a copy of this RealDescriptor on the heap. The user is responsible for deletion. | |
Static Public Member Functions | |
| static void | SetFixDenormals () |
| Set to always fix denormals when converting to native format. | |
| static void | SetReadBufferSize (int rbs) |
| Set read and write buffer sizes. | |
| 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. | |
| static void | convertToNativeFormat (Real *out, Long nitems, void *in, const RealDescriptor &id) |
| Convert serialized bytes in descriptor format to native Real values. | |
| static void | convertToNativeFormat (Real *out, Long nitems, std::istream &is, const RealDescriptor &id) |
| Read descriptor-formatted bytes from a stream and convert them to native Reals. | |
| static void | convertFromNativeFormat (std::ostream &os, Long nitems, const Real *in, const RealDescriptor &od) |
| Serialize native Reals to descriptor format and write them to an ostream. | |
| static void | convertFromNativeFormat (void *out, Long nitems, const void *in, const RealDescriptor &od) |
| Serialize native Reals to descriptor format into a caller-provided buffer. | |
| static void | convertFromNativeFloatFormat (std::ostream &os, Long nitems, const float *in, const RealDescriptor &od) |
Serialize single-precision values to descriptor format and write them to os. | |
| static void | convertFromNativeDoubleFormat (std::ostream &os, Long nitems, const double *in, const RealDescriptor &od) |
Serialize double-precision values to descriptor format and write them to os. | |
| static void | convertToNativeFloatFormat (float *out, Long nitems, std::istream &is, const RealDescriptor &id) |
| Read descriptor-formatted bytes and convert them to native floats. | |
| static void | convertToNativeDoubleFormat (double *out, Long nitems, std::istream &is, const RealDescriptor &id) |
| Read descriptor-formatted bytes and convert them to native doubles. | |
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 |
Serialize double-precision values to descriptor format and write them to os.
| os | Output stream receiving the serialized bytes. |
| nitems | Number of entries to convert. |
| in | Pointer to nitems native double values. |
| od | Descriptor describing the target layout. |
|
static |
Serialize single-precision values to descriptor format and write them to os.
| os | Output stream receiving the serialized bytes. |
| nitems | Number of entries to convert. |
| in | Pointer to nitems native float values. |
| od | Descriptor describing the target layout. |
|
static |
Serialize native Reals to descriptor format and write them to an ostream.
| os | Output stream receiving the serialized bytes. |
| nitems | Number of entries to convert. |
| in | Pointer to native Real data. |
| od | Descriptor describing the target layout. |
|
static |
Serialize native Reals to descriptor format into a caller-provided buffer.
| out | Destination buffer sized for the descriptor-formatted bytes. |
| nitems | Number of entries to convert. |
| in | Pointer to native Real data. |
| od | Descriptor describing the target layout. |
|
static |
Read descriptor-formatted bytes and convert them to native doubles.
| out | Destination array sized for nitems double values. |
| nitems | Number of entries to convert. |
| is | Input stream containing descriptor-formatted bytes. |
| id | Descriptor of the serialized input. |
|
static |
Read descriptor-formatted bytes and convert them to native floats.
| out | Destination array sized for nitems float values. |
| nitems | Number of entries to convert. |
| is | Input stream containing descriptor-formatted bytes. |
| id | Descriptor of the serialized input. |
|
static |
Read descriptor-formatted bytes from a stream and convert them to native Reals.
| out | Destination array sized for nitems native values. |
| nitems | Number of entries to translate. |
| is | Input stream containing descriptor-formatted bytes. |
| id | Descriptor describing the serialized byte order/format. |
|
static |
Convert serialized bytes in descriptor format to native Real values.
| out | Destination array sized for nitems native values. |
| nitems | Number of entries to translate. |
| in | Pointer to the serialized payload laid out per id. |
| id | Descriptor describing the serialized byte order/format. |
|
delete |
| const Long * amrex::RealDescriptor::format | ( | ) | const & |
Returns the format array as a const Long*.
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 |