GemaCoreLib
The GeMA Core library
gmInterpolatorOutputBindings.h
Go to the documentation of this file.
1 /************************************************************************
2 **
3 ** Copyright (C) 2014 by Carlos Augusto Teixera Mendes
4 ** All rights reserved.
5 **
6 ** This file is part of the "GeMA" software. It's use should respect
7 ** the terms in the license agreement that can be found together
8 ** with this source code.
9 ** It is provided AS IS, with NO WARRANTY OF ANY KIND,
10 ** INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR
11 ** A PARTICULAR PURPOSE.
12 **
13 ************************************************************************/
14 
24 #ifndef _GEMA_INTERPOLATOR_OUTPUT_BINDINGS_H_
25 #define _GEMA_INTERPOLATOR_OUTPUT_BINDINGS_H_
26 
27 #include "gmCoreConfig.h"
28 
29 #include "gmGaussAccessor.h"
30 
31 
32 //-------------------------------------------------------------------------------------------
33 //
34 // Bindings for storing calculated data
35 //
36 //-------------------------------------------------------------------------------------------
37 
43 {
44 public:
45 
47  virtual int numSrcs() = 0;
48 
50  virtual int dim(int srcIndex) const = 0;
51 
53  virtual void setValue(int srcIndex, const GmVector& data) = 0;
54 };
55 
58 {
59 public:
60 
65  : _outData(outData), _dim(dim) {}
66 
67  // See comments on the base class
68  virtual int numSrcs() { return 1; }
69 
70  // See comments on the base class
71  virtual int dim(int srcIndex) const { Q_UNUSED(srcIndex); assert(srcIndex == 0); return _dim; }
72 
73  // See comments on the base class
74  virtual void setValue(int srcIndex, const GmVector& data) { Q_UNUSED(srcIndex); assert(srcIndex == 0); _outData = data; }
75 
76 private:
78  int _dim;
79 };
80 
83 {
84 public:
85 
90  : _outList(outList), _dim(dim)
91  {
92  _outList.clear();
93  for(int i = 0; i< nresults; i++)
95  }
96 
97  // See comments on the base class
98  virtual int numSrcs() { return _outList.size(); }
99 
100  // See comments on the base class
101  virtual int dim(int srcIndex) const { Q_UNUSED(srcIndex); assert(srcIndex >= 0 && srcIndex < _outList.size()); return _dim; }
102 
103  // See comments on the base class
104  virtual void setValue(int srcIndex, const GmVector& data) { assert(srcIndex >= 0 && srcIndex < _outList.size()); _outList[srcIndex] = data; }
105 
106 private:
108  int _dim;
109 };
110 
115 {
116 public:
117 
123  : _ac(ac), _elem(elem), _ip(ip), _dim(dim) {}
124 
125  // See comments on the base class
126  virtual int numSrcs() { return 1; }
127 
128  // See comments on the base class
129  virtual int dim(int srcIndex) const { Q_UNUSED(srcIndex); assert(srcIndex == 0); return _dim; }
130 
131  // See comments on the base class
132  virtual void setValue(int srcIndex, const GmVector& data)
133  {
134  Q_UNUSED(srcIndex);
135  assert(srcIndex == 0);
136  assert(_ac->valueSize() == data.n_elem);
137  _ac->setVectorValue(_elem, _ip, data);
138  }
139 
140 private:
142  const GmElement* _elem;
143  int _ip;
144  int _dim;
145 };
146 
151 {
152 public:
153 
158  GmInterpolatorMGaussOutputDataBinding(const QList<GmGaussAccessor*>& acList, const GmElement* elem, int ip, int dim = -1)
159  : _acList(acList), _elem(elem), _ip(ip), _dim(dim) {}
160 
161  // See comments on the base class
162  virtual int numSrcs() { return _acList.size(); }
163 
164  // See comments on the base class
165  virtual int dim(int srcIndex) const { Q_UNUSED(srcIndex); assert(srcIndex >= 0 && srcIndex < _acList.size()); return _dim; }
166 
167  // See comments on the base class
168  virtual void setValue(int srcIndex, const GmVector& data)
169  {
170  assert(srcIndex >= 0 && srcIndex < _acList.size());
171  assert(_acList.at(srcIndex)->valueSize() == data.n_elem);
172  _acList.at(srcIndex)->setVectorValue(_elem, _ip, data);
173  }
174 
175 private:
177  const GmElement* _elem;
178  int _ip;
179  int _dim;
180 };
181 
186 {
187 public:
188 
194  : _ac(ac), _nodeIndex(nodeIndex), _dim(dim) {}
195 
196  // See comments on the base class
197  virtual int numSrcs() { return 1; }
198 
199  // See comments on the base class
200  virtual int dim(int srcIndex) const { Q_UNUSED(srcIndex); assert(srcIndex == 0); return _dim; }
201 
202  // See comments on the base class
203  virtual void setValue(int srcIndex, const GmVector& data)
204  {
205  Q_UNUSED(srcIndex);
206  assert(srcIndex == 0);
207  assert(_ac->valueSize() == data.n_elem);
208  _ac->setVectorValue(_nodeIndex, data);
209  }
210 
211 private:
214  int _dim;
215 };
216 
221 {
222 public:
223 
228  GmInterpolatorMNodeOutputDataBinding(const QList<GmValueAccessor*>& acList, int nodeIndex, int dim = -1)
229  : _acList(acList), _nodeIndex(nodeIndex), _dim(dim) {}
230 
231  // See comments on the base class
232  virtual int numSrcs() { return _acList.size(); }
233 
234  // See comments on the base class
235  virtual int dim(int srcIndex) const { Q_UNUSED(srcIndex); assert(srcIndex >= 0 && srcIndex < _acList.size()); return _dim; }
236 
237  // See comments on the base class
238  virtual void setValue(int srcIndex, const GmVector& data)
239  {
240  assert(srcIndex >= 0 && srcIndex < _acList.size());
241  assert(_acList.at(srcIndex)->valueSize() == data.n_elem);
242  _acList.at(srcIndex)->setVectorValue(_nodeIndex, data);
243  }
244 
245 private:
248  int _dim;
249 };
250 
251 //-------------------------------------------------------------------------------------------
252 //
253 // Bindings for storing calculated data for multiple interpolated points
254 //
255 //-------------------------------------------------------------------------------------------
256 
263 {
264 public:
265 
267  virtual int numSrcs() = 0;
268 
270  virtual int dim(int srcIndex) const = 0;
271 
276  virtual void setValue(int srcIndex, const GmMatrix& data) = 0;
277 };
278 
281 {
282 public:
283 
288  : _outData(outData), _dim(dim) {}
289 
290  // See comments on the base class
291  virtual int numSrcs() { return 1; }
292 
293  // See comments on the base class
294  virtual int dim(int srcIndex) const { Q_UNUSED(srcIndex); assert(srcIndex == 0); return _dim; }
295 
296  // See comments on the base class
297  virtual void setValue(int srcIndex, const GmMatrix& data) { Q_UNUSED(srcIndex); assert(srcIndex == 0); _outData = data; }
298 
299 private:
301  int _dim;
302 };
303 
306 {
307 public:
308 
313  : _outList(outList), _dim(dim)
314  {
315  _outList.clear();
316  for(int i = 0; i< nresults; i++)
318  }
319 
320  // See comments on the base class
321  virtual int numSrcs() { return _outList.size(); }
322 
323  // See comments on the base class
324  virtual int dim(int srcIndex) const { Q_UNUSED(srcIndex); assert(srcIndex >= 0 && srcIndex < _outList.size()); return _dim; }
325 
326  // See comments on the base class
327  virtual void setValue(int srcIndex, const GmMatrix& data) { assert(srcIndex >= 0 && srcIndex < _outList.size()); _outList[srcIndex] = data; }
328 
329 private:
331  int _dim;
332 };
333 
334 
335 #endif
Base interface for FEM (finite element) mesh elements.
Definition: gmElement.h:37
int _ip
The element Gauss point index where the result will be stored.
Definition: gmInterpolatorOutputBindings.h:143
void clear()
GmInterpolatorOutputMultiDataBinding implementation storing a single value in a matrix.
Definition: gmInterpolatorOutputBindings.h:280
GmInterpolatorOutputDataBinding implementation storing a single value in a node attribute through an ...
Definition: gmInterpolatorOutputBindings.h:185
const QList< GmGaussAccessor * > & _acList
The list with accessors for storing results.
Definition: gmInterpolatorOutputBindings.h:176
GmGaussAccessor * _ac
The accessor for storing results.
Definition: gmInterpolatorOutputBindings.h:141
virtual void setValue(int srcIndex, const GmMatrix &data)
Saves the given matrix as the result for the given data src. The data matrix stores results per colum...
Definition: gmInterpolatorOutputBindings.h:327
int _dim
The selected dimension when converting vector data to scalars or -1 if not needed.
Definition: gmInterpolatorOutputBindings.h:108
virtual int dim(int srcIndex) const =0
Returns the access index for retrieving scalar values from vector data or -1 if unused.
int valueSize() const
Returns the size of the array returned by value(), i.e. 1 for scalar values and nlin * ncol for vecto...
Definition: gmValueAccessor.h:102
Binding class used to host the data structure where calculated interpolated values will be stored for...
Definition: gmInterpolatorOutputBindings.h:262
GmInterpolatorOutputDataBinding implementation storing multiple values in a vector list.
Definition: gmInterpolatorOutputBindings.h:82
virtual int numSrcs()
Returns the number o data srcs (accessors) stored by this object.
Definition: gmInterpolatorOutputBindings.h:98
virtual void setValue(int srcIndex, const GmVector &data)
Saves the given vector as the result for the given data src.
Definition: gmInterpolatorOutputBindings.h:74
The GmGaussAccessor class is a proxy object to a value accesor implementing a more convenient interfa...
Definition: gmGaussAccessor.h:38
Declaration of usefull configuration definitions for the Core library.
const T & at(int i) const const
virtual int dim(int srcIndex) const =0
Returns the access index for retrieving scalar values from vector data or -1 if unused.
int _dim
The selected dimension when converting vector data to scalars or -1 if not needed.
Definition: gmInterpolatorOutputBindings.h:179
virtual int dim(int srcIndex) const
Returns the access index for retrieving scalar values from vector data or -1 if unused.
Definition: gmInterpolatorOutputBindings.h:129
int _dim
The selected dimension when converting vector data to scalars or -1 if not needed.
Definition: gmInterpolatorOutputBindings.h:331
GmInterpolatorNodeOutputDataBinding(GmValueAccessor *ac, int nodeIndex, int dim=-1)
Constructor, receiving the node accessor along with the node identification plus the dimension inform...
Definition: gmInterpolatorOutputBindings.h:193
virtual int dim(int srcIndex) const
Returns the access index for retrieving scalar values from vector data or -1 if unused.
Definition: gmInterpolatorOutputBindings.h:235
const QList< GmValueAccessor * > & _acList
The list with accessors for storing results.
Definition: gmInterpolatorOutputBindings.h:246
virtual int numSrcs()=0
Returns the number o data srcs (accessors) stored by this object.
int size() const const
Interface class for accessing and setting values from an "indexable" collection of values.
Definition: gmValueAccessor.h:59
virtual int dim(int srcIndex) const
Returns the access index for retrieving scalar values from vector data or -1 if unused.
Definition: gmInterpolatorOutputBindings.h:200
const GmElement * _elem
The element where the result will be stored.
Definition: gmInterpolatorOutputBindings.h:142
GmVector & _outData
A reference to the vector where the interpolation result will be stored.
Definition: gmInterpolatorOutputBindings.h:77
virtual void setValue(int srcIndex, const GmMatrix &data)
Saves the given matrix as the result for the given data src. The data matrix stores results per colum...
Definition: gmInterpolatorOutputBindings.h:297
virtual int numSrcs()
Returns the number o data srcs (accessors) stored by this object.
Definition: gmInterpolatorOutputBindings.h:321
int _dim
The selected dimension when converting vector data to scalars or -1 if not needed.
Definition: gmInterpolatorOutputBindings.h:144
int _dim
The selected dimension when converting vector data to scalars or -1 if not needed.
Definition: gmInterpolatorOutputBindings.h:248
void append(const T &value)
virtual int dim(int srcIndex) const
Returns the access index for retrieving scalar values from vector data or -1 if unused.
Definition: gmInterpolatorOutputBindings.h:324
int _nodeIndex
The node index where the result will be stored.
Definition: gmInterpolatorOutputBindings.h:213
virtual int numSrcs()=0
Returns the number o data srcs (accessors) stored by this object.
GmInterpolatorVectorOutputDataBinding(GmVector &outData, int dim=-1)
Constructor, receiving a reference to the vector that will be filled plus the dimension information u...
Definition: gmInterpolatorOutputBindings.h:64
GmInterpolatorMMatrixOutputMultiDataBinding(QList< GmMatrix > &outList, int nresults, int dim=-1)
Constructor, receiving a reference to the matrix list that will be filled plus the dimension informat...
Definition: gmInterpolatorOutputBindings.h:312
const GmElement * _elem
The element where the result will be stored.
Definition: gmInterpolatorOutputBindings.h:177
int _ip
The element Gauss point index where the result will be stored.
Definition: gmInterpolatorOutputBindings.h:178
virtual void setValue(int srcIndex, const GmMatrix &data)=0
Saves the given matrix as the result for the given data src. The data matrix stores results per colum...
GmInterpolatorMGaussOutputDataBinding(const QList< GmGaussAccessor * > &acList, const GmElement *elem, int ip, int dim=-1)
Constructor, receiving the Gauss accessor list along with the Gauss point identification (element + p...
Definition: gmInterpolatorOutputBindings.h:158
GmInterpolatorOutputDataBinding implementation storing a single value in a Gauss point through an acc...
Definition: gmInterpolatorOutputBindings.h:114
Implementation of the GmGaussAccessor proxy class.
Binding class used to host the data structure where calculated interpolated values will be stored....
Definition: gmInterpolatorOutputBindings.h:42
virtual void setValue(int srcIndex, const GmVector &data)=0
Saves the given vector as the result for the given data src.
GmInterpolatorOutputDataBinding implementation storing a single value in a vector.
Definition: gmInterpolatorOutputBindings.h:57
virtual void setValue(int srcIndex, const GmVector &data)
Saves the given vector as the result for the given data src.
Definition: gmInterpolatorOutputBindings.h:203
GmInterpolatorOutputDataBinding implementation storing multiple values in a node through an accessor ...
Definition: gmInterpolatorOutputBindings.h:220
virtual int numSrcs()
Returns the number o data srcs (accessors) stored by this object.
Definition: gmInterpolatorOutputBindings.h:126
virtual int dim(int srcIndex) const
Returns the access index for retrieving scalar values from vector data or -1 if unused.
Definition: gmInterpolatorOutputBindings.h:294
QList< GmVector > & _outList
A reference to the vector list where the interpolation results will be stored.
Definition: gmInterpolatorOutputBindings.h:107
GmInterpolatorMatrixOutputMultiDataBinding(GmMatrix &outData, int dim=-1)
Constructor, receiving a reference to the vector that will be filled plus the dimension information u...
Definition: gmInterpolatorOutputBindings.h:287
virtual int numSrcs()
Returns the number o data srcs (accessors) stored by this object.
Definition: gmInterpolatorOutputBindings.h:68
virtual int dim(int srcIndex) const
Returns the access index for retrieving scalar values from vector data or -1 if unused.
Definition: gmInterpolatorOutputBindings.h:165
GmInterpolatorOutputMultiDataBinding implementation storing multiple values in a matrix list.
Definition: gmInterpolatorOutputBindings.h:305
virtual void setValue(int srcIndex, const GmVector &data)
Saves the given vector as the result for the given data src.
Definition: gmInterpolatorOutputBindings.h:132
GmInterpolatorMNodeOutputDataBinding(const QList< GmValueAccessor * > &acList, int nodeIndex, int dim=-1)
Constructor, receiving the node accessor list along with the node identification plus the dimension i...
Definition: gmInterpolatorOutputBindings.h:228
int _nodeIndex
The node index where the results will be stored.
Definition: gmInterpolatorOutputBindings.h:247
virtual int numSrcs()
Returns the number o data srcs (accessors) stored by this object.
Definition: gmInterpolatorOutputBindings.h:291
QList< GmMatrix > & _outList
A reference to the matrix list where the interpolation results will be stored.
Definition: gmInterpolatorOutputBindings.h:330
GmMatrix & _outData
A reference to the matrix where the interpolation result will be stored.
Definition: gmInterpolatorOutputBindings.h:300
bool setVectorValue(int index, const GmVector &vec)
Similar to setValue() but receiving the data as a vector.
Definition: gmValueAccessor.h:231
GmInterpolatorOutputDataBinding implementation storing multiple values in a Gauss point through an ac...
Definition: gmInterpolatorOutputBindings.h:150
virtual int numSrcs()
Returns the number o data srcs (accessors) stored by this object.
Definition: gmInterpolatorOutputBindings.h:197
virtual int dim(int srcIndex) const
Returns the access index for retrieving scalar values from vector data or -1 if unused.
Definition: gmInterpolatorOutputBindings.h:71
GmInterpolatorGaussOutputDataBinding(GmGaussAccessor *ac, const GmElement *elem, int ip, int dim=-1)
Constructor, receiving the Gauss accessor along with the Gauss point identification (element + point ...
Definition: gmInterpolatorOutputBindings.h:122
GmInterpolatorMVectorOutputDataBinding(QList< GmVector > &outList, int nresults, int dim=-1)
Constructor, receiving a reference to the vector list that will be filled plus the dimension informat...
Definition: gmInterpolatorOutputBindings.h:89
arma::vec GmVector
The basic type for a GeMA vector object. Currently based on an Armadillo vector.
Definition: gmVector.h:34
int _dim
The selected dimension when converting vector data to scalars or -1 if not needed.
Definition: gmInterpolatorOutputBindings.h:301
GmValueAccessor * _ac
The accessor for storing results.
Definition: gmInterpolatorOutputBindings.h:212
virtual void setValue(int srcIndex, const GmVector &data)
Saves the given vector as the result for the given data src.
Definition: gmInterpolatorOutputBindings.h:104
virtual int numSrcs()
Returns the number o data srcs (accessors) stored by this object.
Definition: gmInterpolatorOutputBindings.h:232
arma::mat GmMatrix
The basic type for a GeMA matrix object. Currently based on an Armadillo matrix.
Definition: gmMatrix.h:38
int _dim
The selected dimension when converting vector data to scalars or -1 if not needed.
Definition: gmInterpolatorOutputBindings.h:78
virtual void setValue(int srcIndex, const GmVector &data)
Saves the given vector as the result for the given data src.
Definition: gmInterpolatorOutputBindings.h:238
virtual int dim(int srcIndex) const
Returns the access index for retrieving scalar values from vector data or -1 if unused.
Definition: gmInterpolatorOutputBindings.h:101
int _dim
The selected dimension when converting vector data to scalars or -1 if not needed.
Definition: gmInterpolatorOutputBindings.h:214
virtual int numSrcs()
Returns the number o data srcs (accessors) stored by this object.
Definition: gmInterpolatorOutputBindings.h:162
virtual void setValue(int srcIndex, const GmVector &data)
Saves the given vector as the result for the given data src.
Definition: gmInterpolatorOutputBindings.h:168