00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef SELDON_FILE_ARRAY3D_HXX
00024
00025 #include "../share/Common.hxx"
00026 #include "../share/Errors.hxx"
00027 #include "../share/Allocator.hxx"
00028
00029 namespace Seldon
00030 {
00031
00032
00034
00037 template <class T, class Allocator = SELDON_DEFAULT_ALLOCATOR<T> >
00038 class Array3D
00039 {
00040
00041 public:
00042 typedef typename Allocator::value_type value_type;
00043 typedef typename Allocator::pointer pointer;
00044 typedef typename Allocator::const_pointer const_pointer;
00045 typedef typename Allocator::reference reference;
00046 typedef typename Allocator::const_reference const_reference;
00047
00048
00049 protected:
00050 static Allocator array3D_allocator_;
00051
00052
00053 protected:
00054
00055 int length1_;
00056
00057 int length2_;
00058
00059 int length3_;
00060
00061
00062 int length23_;
00063
00064
00065 pointer data_;
00066
00067
00068 public:
00069
00070 Array3D();
00071 Array3D(int i, int j, int k);
00072 Array3D(const Array3D<T, Allocator>& A);
00073
00074
00075 ~Array3D();
00076
00077
00078 int GetLength1() const;
00079 int GetLength2() const;
00080 int GetLength3() const;
00081 int GetSize() const;
00082 int GetDataSize() const;
00083 pointer GetData() const;
00084
00085
00086 void Reallocate(int i, int j, int k);
00087 void Clear();
00088
00089
00090 reference operator() (int i, int j, int k);
00091 const_reference operator() (int i, int j, int k) const;
00092 Array3D<T, Allocator>& operator= (const Array3D<T, Allocator>& A);
00093 void Copy(const Array3D<T, Allocator>& A);
00094
00095
00096 void Zero();
00097 void Fill();
00098 template <class T0>
00099 void Fill(const T0& x);
00100 void FillRand();
00101 void Print() const;
00102
00103
00104 void Write(string FileName) const;
00105 void Write(ofstream& FileStream) const;
00106 void Read(string FileName);
00107 void Read(ifstream& FileStream);
00108 };
00109
00110
00111
00112 template <class T, class Allocator>
00113 Allocator Array3D<T, Allocator>::array3D_allocator_;
00114
00115
00116 template <class T, class Allocator>
00117 ostream& operator << (ostream& out,
00118 const Array3D<T, Allocator>& A);
00119
00120 template <class T0, class T, class Allocator>
00121 void Mlt(const T0& alpha, Array3D<T, Allocator>& A);
00122
00123 }
00124
00125
00126 #define SELDON_FILE_ARRAY3D_HXX
00127 #endif