UQTk: Uncertainty Quantification Toolkit 3.1.5
|
Stores data of any type T in a 3D array. More...
#include <Array3D.h>
Public Member Functions | |
Array3D () | |
Default constructor, which does not allocate any memory. | |
Array3D (const size_t &nx, const size_t &ny, const size_t &nz) | |
Constructor that allocates the memory. | |
Array3D (const size_t &nx, const size_t &ny, const size_t &nz, const T &t) | |
Constructor that allocates and initializes the data. | |
~Array3D () | |
Destructor that frees up the memory. | |
void | Clear () |
Function to clear the memory. | |
size_t | XSize () const |
Returns size in the x-direction. | |
size_t | YSize () const |
Returns size in the y-direction. | |
size_t | ZSize () const |
Returns size in the z-direction. | |
void | Resize (const size_t &nx, const size_t &ny, const size_t &nz) |
Resizes the array. | |
void | Resize (const size_t &nx, const size_t &ny, const size_t &nz, const T &t) |
Resizes the array and sets ALL entries to the specified value. | |
void | SetValue (const T &t) |
Set all values in the array to the given value. | |
T * | GetArrayPointer () |
Return a pointer to the first element of the data in the vector so we can use it access the data in array format (e.g. for passing it to a Fortran program). | |
const T * | GetConstArrayPointer () const |
Return a const pointer to the first element of the data in the vector so we can use it access the data in array format (e.g. for passing it to a Fortran program). | |
T & | operator() (size_t ix, size_t iy, size_t iz) |
Fortran-like () operator to access values in the 3D data array. | |
const T & | operator() (size_t ix, size_t iy, size_t iz) const |
Fortran-like () const operator to access values in the 3D data array. | |
void | DumpBinary (FILE *f_out) const |
Dump contents of the array to a file in binary format. | |
void | DumpText (std::ofstream &f_out) const |
Dump contents of the array to a file in text format Added by Maher Salloum When post-processing (in matlab for example), one has to transpose each 2-D sub-matrix imported from the text file. | |
void | ReadText (FILE *f_in) |
Read contents of the array from a file in binary format. | |
void | ReadBinary (std::ifstream &f_in) |
Read contents of the array from a file in text format Added by Maher Salloum. | |
Private Member Functions | |
Array3D (const Array3D &obj) | |
Copy constructor, which is made private so it would not be used inadvertently (until we define a proper copy constructor) | |
Private Attributes | |
size_t | xsize_ |
Number of elements in the x-dimension. | |
size_t | ysize_ |
Number of elements in the y-dimension. | |
size_t | zsize_ |
Number of elements in the z-dimension. | |
vector< T > | data_ |
Data in the array with size = xsize_ * ysize_ * zsize_. | |
Stores data of any type T in a 3D array.
This class also provides a Fortran-like access operator () as well as a function to access the data in the array through a pointer that can be passed to F77 or C routines.
Default constructor, which does not allocate any memory.
|
inline |
Constructor that allocates the memory.
|
inline |
Constructor that allocates and initializes the data.
Copy constructor, which is made private so it would not be used inadvertently (until we define a proper copy constructor)
|
inline |
Function to clear the memory.
|
inline |
Dump contents of the array to a file in binary format.
|
inline |
Dump contents of the array to a file in text format Added by Maher Salloum When post-processing (in matlab for example), one has to transpose each 2-D sub-matrix imported from the text file.
|
inline |
Return a pointer to the first element of the data in the vector so we can use it access the data in array format (e.g. for passing it to a Fortran program).
|
inline |
Return a const pointer to the first element of the data in the vector so we can use it access the data in array format (e.g. for passing it to a Fortran program).
|
inline |
Fortran-like () operator to access values in the 3D data array.
If "my_data" is an object of type Array3D, then its array values can be accessed as my_data(ix,iy,iz), where ix, iy, iz are the indices in the x, y, and z dimensions respectively.
|
inline |
Fortran-like () const operator to access values in the 3D data array.
If "my_data" is an object of type Array3D, then its array values can be accessed as my_data(ix,iy,iz), where ix, iy, iz are the indices in the x, y, and z dimensions respectively.
|
inline |
Read contents of the array from a file in text format Added by Maher Salloum.
|
inline |
Read contents of the array from a file in binary format.
|
inline |
Resizes the array.
|
inline |
Resizes the array and sets ALL entries to the specified value.
|
inline |
Set all values in the array to the given value.
|
inline |
Returns size in the x-direction.
|
inline |
Returns size in the y-direction.
|
inline |
Returns size in the z-direction.
|
private |
Data in the array with size = xsize_ * ysize_ * zsize_.
The data is stored with the fastest running index in the x-dimension then the y-dimension and the slowest one in the z-dimension. The indices in every dimension run from 0 to their respective "size-1"
|
private |
Number of elements in the x-dimension.
|
private |
Number of elements in the y-dimension.
|
private |
Number of elements in the z-dimension.