C++ main module for emicrom Package  1.0
EMM_2Tensors.h
Go to the documentation of this file.
1 #ifndef EMM_2Tensors_H
2 #define EMM_2Tensors_H
3 
4 #include "EMM_Tensors.h"
5 
17 class EMM_2Tensors : public EMM_Tensors {
18 
19 
21 
22  // ATTRIBUTES
23 
24 
25 public:
26 
27 
28 private:
29 
30 
31 
32 protected:
33  // METHODS
34 
35  // CONSTRUCTORS
36 
39  EMM_2Tensors();
40 
41 
42 
43 
44 
45 
46  // DESTRUCTORS
47 
48 
51  virtual ~EMM_2Tensors(void);
52 
53 public:
54 
55  // CONSTRUCTORS
56 
57 
58 
59 
60 public:
61 
62 
63  // CONSTRUCTORS
67  inline static SP::EMM_2Tensors New() {
68  SP::EMM_2Tensors ret(new EMM_2Tensors(),
70  ret->setThis(ret);
71  return ret;
72  };
73 
77  virtual SP::EMM_Tensors NewInstance() const {
78  return New();
79  }
80 
81 public:
82  //OPERATORS
90  virtual const tReal& operator()(const tUIndex& index,const tUSInt& i,const tUSInt& j) const {
91  const tUSInt &dim=getDimension();
92  return (*this)[index][j+dim*i];
93  }
94 
102  virtual tReal& operator()(const tUIndex& index,const tUSInt& i,const tUSInt& j) {
103  const tUSInt &dim=getDimension();
104  return (*this)[index][j+dim*i];
105  }
106 
107  //SET methods
108 
109 protected:
110 
111 
112 public:
113 
120  inline void setValue(const tUIndex& index,
121  const tUSInt& i,
122  const tUSInt& j,
123  const tReal& v) {
124  (*this)(index,i,j)=v;
125  }
126 
127 
128  // GET methods
129 public:
135  inline const tReal& getValue(const tUIndex& index,
136  const tUSInt& i,
137  const tUSInt& j) const {
138  return (*this)(index,i,j);
139  }
140 
141 
142 
146  virtual tUSInt getTensorSize() const {
147  tUSInt n=1;
148  const tUSInt& dim=getDimension();
149  for (tUSInt k=0;k<2;k++) n*=dim;
150  return n;
151  }
152 
153 
154 
155 
156 
157 };
158 
159 #endif
virtual tUSInt getTensorSize() const
get thememory size of the storage of each tensor
Definition: EMM_2Tensors.h:146
const tReal & getValue(const tUIndex &index, const tUSInt &i, const tUSInt &j) const
get the value of the tensor at index and at coordinates i,j
Definition: EMM_2Tensors.h:135
virtual ~EMM_2Tensors(void)
destroy
Definition: EMM_2Tensors.cpp:10
#define tUSInt
Definition: types.h:28
EMM_2Tensors()
create a 2 order tensor
Definition: EMM_2Tensors.cpp:4
static SP::EMM_2Tensors New()
builds a full tensor
Definition: EMM_2Tensors.h:67
const tUSInt & getDimension() const
get the dimension of the tensor
Definition: EMM_Tensors.h:252
SP_OBJECT(EMM_2Tensors)
DEFINE_SPTR(EMM_2Tensors)
void setValue(const tUIndex &index, const tUSInt &i, const tUSInt &j, const tReal &v)
set the value of the tensor at index and at coordinates i,j to v
Definition: EMM_2Tensors.h:120
virtual const tReal & operator()(const tUIndex &index, const tUSInt &i, const tUSInt &j) const
get the values at index i,j of the tensor at index
Definition: EMM_2Tensors.h:90
#define tUIndex
Definition: types.h:126
This class describes a morse array of tensors of 2 order.
Definition: EMM_2Tensors.h:17
virtual tReal & operator()(const tUIndex &index, const tUSInt &i, const tUSInt &j)
get the values at index i,j of the tensor at index
Definition: EMM_2Tensors.h:102
virtual SP::EMM_Tensors NewInstance() const
create a new instance
Definition: EMM_2Tensors.h:77
#define tReal
Definition: types.h:118
This class describes a morse array of tensors.
Definition: EMM_Tensors.h:20
class Free introduced for deleting a smart pointer
Definition: CORE_Object.h:141