C++ main module for emicrom Package  1.0
CORE_Array3D.hpp
Go to the documentation of this file.
1 #ifndef CORE_Array3D_CPP
2 #define CORE_Array3D_CPP
3 
4 #include "CORE_Array3D.h"
5 #include "CORE_Integer.h"
6 #include "CORE_String.h"
7 
8 template<class T>
10  for (tUSInt k=0;k<3;k++) mSize[k]=0;
11 }
12 
13 template<class T>
15 }
16 
17 template<class T>
18 void CORE_Array3D<T>::setSize(const tUIndex& n,const tUIndex& p,const tUIndex& q) {
20  mSize[0]=n;
21  mSize[1]=p;
22  mSize[2]=q;
23 }
24 
25 template<class T>
27  src.getSize(mSize[0],mSize[1],mSize[2]);
29 }
30 
31 template<class T>
33  tString str("");
35  tUIndex i,j,k;
36  const T* vs=&(*this)[0];
37  const tUIndex &Nx=mSize[0];
38  const tUIndex &Ny=mSize[1];
39  const tUIndex &Nz=mSize[2];
40  for (k=0;k<Nz;k++) {
41  for (j=0;j<Ny;j++) {
42  for (i=0;i<Nx;i++) {
43  str+=CORE_String::toString(*vs);
44  str+="\t";
45  vs++;
46  }
47  str+="\n";
48  }
49  }
50 
51  return str;
52 }
53 
54 #endif
this class describes an array of arrays stored as follow:
Definition: CORE_Array3D.h:14
void copy(const CORE_Array3D< T > &src)
void copy
Definition: CORE_Array3D.hpp:26
#define tUSInt
Definition: types.h:28
void setSize(const tUIndex &n)
set the size
Definition: CORE_Array.h:292
virtual tString toString() const
return the string associated to the string
Definition: CORE_String.h:223
tString toString() const
return the string associated to the integer
Definition: CORE_Integer.h:106
tString toString() const
turn the array into string
Definition: CORE_Array3D.hpp:32
CORE_Array3D()
build an array of T*
Definition: CORE_Array3D.hpp:9
void setValues(const tUIndex &n, const Q *v)
set the values of the array by copying the n first values of pointer v
Definition: CORE_Array.h:445
#define tUIndex
Definition: types.h:126
#define tString
Definition: types.h:135
void setSize(const tUIndex &n, const tUIndex &p, const tUIndex &q)
set the size of the array
Definition: CORE_Array3D.hpp:18
tUIndex mSize[3]
Definition: CORE_Array3D.h:19
Definition: CORE_ArrayList.h:12
void getSize(tUIndex &n, tUIndex &p, tUIndex &q) const
return the size of the array in each direction
Definition: CORE_Array3D.h:115
virtual ~CORE_Array3D()
destroy an array of T*
Definition: CORE_Array3D.hpp:14