62 Array3D(
const size_t& nx,
const size_t& ny,
const size_t& nz):
68 Array3D(
const size_t& nx,
const size_t& ny,
const size_t& nz,
const T& t):
98 void Resize(
const size_t& nx,
const size_t& ny,
const size_t& nz) {
110 void Resize(
const size_t& nx,
const size_t& ny,
const size_t& nz,
const T& t) {
120 for(
size_t i=0; i <
data_.size(); i++){
166 vector<double>::const_iterator it1;
167 vector<double>::const_iterator it2;
170 for (
int iz=0;iz<
zsize_;iz++) {
171 for (
int iy=0;iy<
ysize_;iy++) {
174 std::copy(it1,it2,std::ostream_iterator<T>(f_out,
" "));
194 typedef std::istream_iterator<T> istream_iterator;
195 std::copy(istream_iterator(f_in),istream_iterator(),
data_.begin());
Stores data of any type T in a 3D array.
Definition Array3D.h:56
void SetValue(const T &t)
Set all values in the array to the given value.
Definition Array3D.h:119
size_t XSize() const
Returns size in the x-direction.
Definition Array3D.h:85
void DumpBinary(FILE *f_out) const
Dump contents of the array to a file in binary format.
Definition Array3D.h:154
vector< T > data_
Data in the array with size = xsize_ * ysize_ * zsize_.
Definition Array3D.h:217
T & operator()(size_t ix, size_t iy, size_t iz)
Fortran-like () operator to access values in the 3D data array.
Definition Array3D.h:144
Array3D()
Default constructor, which does not allocate any memory.
Definition Array3D.h:59
void ReadBinary(std::ifstream &f_in)
Read contents of the array from a file in text format Added by Maher Salloum.
Definition Array3D.h:192
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 dat...
Definition Array3D.h:135
~Array3D()
Destructor that frees up the memory.
Definition Array3D.h:74
T * GetArrayPointer()
Return a pointer to the first element of the data in the vector so we can use it access the data in a...
Definition Array3D.h:128
Array3D(const size_t &nx, const size_t &ny, const size_t &nz, const T &t)
Constructor that allocates and initializes the data.
Definition Array3D.h:68
void Clear()
Function to clear the memory.
Definition Array3D.h:77
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 m...
Definition Array3D.h:165
size_t ysize_
Number of elements in the y-dimension.
Definition Array3D.h:208
size_t zsize_
Number of elements in the z-dimension.
Definition Array3D.h:210
Array3D(const size_t &nx, const size_t &ny, const size_t &nz)
Constructor that allocates the memory.
Definition Array3D.h:62
void ReadText(FILE *f_in)
Read contents of the array from a file in binary format.
Definition Array3D.h:182
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.
Definition Array3D.h:110
size_t ZSize() const
Returns size in the z-direction.
Definition Array3D.h:89
void Resize(const size_t &nx, const size_t &ny, const size_t &nz)
Resizes the array.
Definition Array3D.h:98
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.
Definition Array3D.h:151
size_t YSize() const
Returns size in the y-direction.
Definition Array3D.h:87
Array3D(const Array3D &obj)
Copy constructor, which is made private so it would not be used inadvertently (until we define a prop...
Definition Array3D.h:203
size_t xsize_
Number of elements in the x-dimension.
Definition Array3D.h:206