|
| 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.
|
|
template<typename T>
class Array3D< T >
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.
- Author
- Bert Debusschere bjdeb.nosp@m.us@s.nosp@m.andia.nosp@m..gov
- Date
- Jan 2005
- Note
- Inspired by Helgi Adalsteinsson's Array class implementation
- Todo
Define copy constructor
Several functions, e.g. insert/erase columns/rows, available in Array1D and Array2D, are missing.
template<typename T >
T & Array3D< T >::operator() |
( |
size_t | ix, |
|
|
size_t | iy, |
|
|
size_t | iz ) |
|
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.
template<typename T >
const T & Array3D< T >::operator() |
( |
size_t | ix, |
|
|
size_t | iy, |
|
|
size_t | iz ) const |
|
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.