24 #ifndef SELDON_FILE_ARRAY4D_HXX
26 #include "../share/Common.hxx"
27 #include "../share/Errors.hxx"
28 #include "../share/Allocator.hxx"
38 template <
class T,
class Allocator>
43 typedef typename Allocator::value_type value_type;
44 typedef typename Allocator::pointer pointer;
45 typedef typename Allocator::const_pointer const_pointer;
46 typedef typename Allocator::reference reference;
47 typedef typename Allocator::const_reference const_reference;
72 explicit Array4D(
int i,
int j,
int k,
int l);
93 reference
operator() (
int i,
int j,
int k,
int l);
95 const_reference
operator() (
int i,
int j,
int k,
int l)
const;
105 void Fill(
const T0& x);
110 void Write(
string FileName,
bool with_size =
true)
const;
111 void Write(ofstream& FileStream,
bool with_size =
true)
const;
112 void Read(
string FileName,
bool with_size =
true);
113 void Read(ifstream& FileStream,
bool with_size =
true);
119 template <
class T,
class Allocator>
127 #define SELDON_FILE_ARRAY4D_HXX
void Zero()
Sets all elements to zero.
Array4D()
Default constructor.
void Copy(const Array4D< T, Allocator > &A)
Duplicates a 4D array.
reference operator()(int i, int j, int k, int l)
Access operator.
int GetLength3() const
Returns the length in dimension #3.
int GetLength1() const
Returns the length in dimension #1.
pointer GetDataPointer(int i, int j, int k, int l) const
Returns a pointer to an element of data array.
void Print() const
Displays the array on the standard output.
void Reallocate(int i, int j, int k, int l)
Reallocates memory to resize the 4D array.
void Fill()
Fills the array.
Array4D< T, Allocator > & operator=(const Array4D< T, Allocator > &A)
Duplicates a 4D array (assignment operator).
size_t GetMemorySize() const
Returns the memory used by the object in bytes.
int GetLength4() const
Returns the length in dimension #4.
pointer GetData() const
Returns a pointer to the data array.
int GetLength2() const
Returns the length in dimension #2.
void Write(string FileName, bool with_size=true) const
Writes the 4D array in a file.
void Read(string FileName, bool with_size=true)
Reads the 4D array from a file.
ostream & operator<<(ostream &out, const Array< T, N, Allocator > &A)
operator<< overloaded for a 3D array.
void Clear()
Clears the array.
void FillRand()
Fills the 4D array randomly.
long GetDataSize() const
Returns the number of elements stored in memory.
long GetSize() const
Returns the number of elements in the 4D array.