23 #ifndef SELDON_FILE_ARRAY3D_HXX
25 #include "../share/Common.hxx"
26 #include "../share/Errors.hxx"
27 #include "../share/Allocator.hxx"
37 template <
class T,
class Allocator>
42 typedef typename Allocator::value_type value_type;
43 typedef typename Allocator::pointer pointer;
44 typedef typename Allocator::const_pointer const_pointer;
45 typedef typename Allocator::reference reference;
46 typedef typename Allocator::const_reference const_reference;
84 void SetData(
int i,
int j,
int k, pointer data);
91 const_reference
operator() (
int i,
int j,
int k)
const;
101 void Fill(
const T0& x);
106 void Write(
string FileName,
bool with_size =
true)
const;
107 void Write(ofstream& FileStream,
bool with_size =
true)
const;
108 void Read(
string FileName,
bool with_size =
true);
109 void Read(ifstream& FileStream,
bool with_size =
true);
114 template <
class T,
class Allocator>
119 template <
class T0,
class T,
class Allocator>
125 #define SELDON_FILE_ARRAY3D_HXX
void Clear()
Clears the array.
Array3D()
Default constructor.
int GetLength2() const
Returns the length in dimension #2.
void MltScalar(const T0 &alpha, Array3D< T, Allocator > &A)
Multiplication of all elements of a 3D array by a scalar.
void SetData(int i, int j, int k, pointer data)
Changes the size of the array and sets its data array (low level method).
void Write(string FileName, bool with_size=true) const
Writes the 3D array in a file.
void Copy(const Array3D< T, Allocator > &A)
Duplicates a 3D array.
int GetLength1() const
Returns the length in dimension #1.
pointer GetDataPointer(int i, int j, int k) const
Returns a pointer to an element of data array.
long GetSize() const
Returns the number of elements in the 3D array.
reference operator()(int i, int j, int k)
Access operator.
int GetLength3() const
Returns the length in dimension #3.
void Print() const
Displays the array on the standard output.
void Reallocate(int i, int j, int k)
Reallocates memory to resize the 3D array.
long GetDataSize() const
Returns the number of elements stored in memory.
void Nullify()
Clears the 3D array without releasing memory.
void Zero()
Sets all elements to zero.
pointer GetData() const
Returns a pointer to the data array.
Array3D< T, Allocator > & operator=(const Array3D< T, Allocator > &A)
Duplicates a 3D array (assignment operator).
void Fill()
Fills the array.
ostream & operator<<(ostream &out, const Array< T, N, Allocator > &A)
operator<< overloaded for a 3D array.
size_t GetMemorySize() const
Returns the memory used by the object in bytes.
void FillRand()
Fills the 3D array randomly.
void Read(string FileName, bool with_size=true)
Reads the 3D array from a file.