GemaCoreLib
The GeMA Core library
Loading...
Searching...
No Matches
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{
44public:
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{
59public:
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
76private:
78 int _dim;
79};
80
83{
84public:
85
90 : _outList(outList), _dim(dim)
91 {
92 _outList.resize(nresults);
93 }
94
95 // See comments on the base class
96 virtual int numSrcs() { return _outList.size(); }
97
98 // See comments on the base class
99 virtual int dim(int srcIndex) const { Q_UNUSED(srcIndex); assert(srcIndex >= 0 && srcIndex < _outList.size()); return _dim; }
100
101 // See comments on the base class
102 virtual void setValue(int srcIndex, const GmVector& data) { assert(srcIndex >= 0 && srcIndex < _outList.size()); _outList[srcIndex] = data; }
103
104private:
106 int _dim;
107};
108
113{
114public:
115
121 : _ac(ac), _elem(elem), _ip(ip), _dim(dim) {}
122
123 // See comments on the base class
124 virtual int numSrcs() { return 1; }
125
126 // See comments on the base class
127 virtual int dim(int srcIndex) const { Q_UNUSED(srcIndex); assert(srcIndex == 0); return _dim; }
128
129 // See comments on the base class
130 virtual void setValue(int srcIndex, const GmVector& data)
131 {
132 Q_UNUSED(srcIndex);
133 assert(srcIndex == 0);
134 assert(_ac->valueSize() == data.n_elem);
135 _ac->setVectorValue(_elem, _ip, data);
136 }
137
138private:
141 int _ip;
142 int _dim;
143};
144
149{
150public:
151
157 : _acList(acList), _elem(elem), _ip(ip), _dim(dim) {}
158
159 // See comments on the base class
160 virtual int numSrcs() { return _acList.size(); }
161
162 // See comments on the base class
163 virtual int dim(int srcIndex) const { Q_UNUSED(srcIndex); assert(srcIndex >= 0 && srcIndex < _acList.size()); return _dim; }
164
165 // See comments on the base class
166 virtual void setValue(int srcIndex, const GmVector& data)
167 {
168 assert(srcIndex >= 0 && srcIndex < _acList.size());
169 assert(_acList.at(srcIndex)->valueSize() == data.n_elem);
170 _acList.at(srcIndex)->setVectorValue(_elem, _ip, data);
171 }
172
173private:
176 int _ip;
177 int _dim;
178};
179
184{
185public:
186
192 : _ac(ac), _nodeIndex(nodeIndex), _dim(dim) {}
193
194 // See comments on the base class
195 virtual int numSrcs() { return 1; }
196
197 // See comments on the base class
198 virtual int dim(int srcIndex) const { Q_UNUSED(srcIndex); assert(srcIndex == 0); return _dim; }
199
200 // See comments on the base class
201 virtual void setValue(int srcIndex, const GmVector& data)
202 {
203 Q_UNUSED(srcIndex);
204 assert(srcIndex == 0);
205 assert(_ac->valueSize() == data.n_elem);
207 }
208
209private:
212 int _dim;
213};
214
219{
220public:
221
227 : _acList(acList), _nodeIndex(nodeIndex), _dim(dim) {}
228
229 // See comments on the base class
230 virtual int numSrcs() { return _acList.size(); }
231
232 // See comments on the base class
233 virtual int dim(int srcIndex) const { Q_UNUSED(srcIndex); assert(srcIndex >= 0 && srcIndex < _acList.size()); return _dim; }
234
235 // See comments on the base class
236 virtual void setValue(int srcIndex, const GmVector& data)
237 {
238 assert(srcIndex >= 0 && srcIndex < _acList.size());
239 assert(_acList.at(srcIndex)->valueSize() == data.n_elem);
240 _acList.at(srcIndex)->setVectorValue(_nodeIndex, data);
241 }
242
243private:
246 int _dim;
247};
248
249//-------------------------------------------------------------------------------------------
250//
251// Bindings for storing calculated data for multiple interpolated points
252//
253//-------------------------------------------------------------------------------------------
254
261{
262public:
263
265 virtual int numSrcs() = 0;
266
268 virtual int dim(int srcIndex) const = 0;
269
274 virtual void setValue(int srcIndex, const GmMatrix& data) = 0;
275};
276
279{
280public:
281
287
288 // See comments on the base class
289 virtual int numSrcs() { return 1; }
290
291 // See comments on the base class
292 virtual int dim(int srcIndex) const { Q_UNUSED(srcIndex); assert(srcIndex == 0); return _dim; }
293
294 // See comments on the base class
295 virtual void setValue(int srcIndex, const GmMatrix& data) { Q_UNUSED(srcIndex); assert(srcIndex == 0); _outData = data; }
296
297private:
299 int _dim;
300};
301
304{
305public:
306
311 : _outList(outList), _dim(dim)
312 {
313 _outList.resize(nresults);
314 }
315
316 // See comments on the base class
317 virtual int numSrcs() { return _outList.size(); }
318
319 // See comments on the base class
320 virtual int dim(int srcIndex) const { Q_UNUSED(srcIndex); assert(srcIndex >= 0 && srcIndex < _outList.size()); return _dim; }
321
322 // See comments on the base class
323 virtual void setValue(int srcIndex, const GmMatrix& data) { assert(srcIndex >= 0 && srcIndex < _outList.size()); _outList[srcIndex] = data; }
324
325private:
327 int _dim;
328};
329
330
331#endif
Base interface for FEM (finite element) mesh elements.
Definition gmElement.h:38
The GmGaussAccessor class is a proxy object to a value accessor implementing a more convenient interf...
Definition gmGaussAccessor.h:39
GmInterpolatorOutputDataBinding implementation storing a single value in a Gauss point through an acc...
Definition gmInterpolatorOutputBindings.h:113
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:120
virtual int dim(int srcIndex) const
Returns the access index for retrieving scalar values from vector data or -1 if unused.
Definition gmInterpolatorOutputBindings.h:127
int _dim
The selected dimension when converting vector data to scalars or -1 if not needed.
Definition gmInterpolatorOutputBindings.h:142
virtual void setValue(int srcIndex, const GmVector &data)
Saves the given vector as the result for the given data src.
Definition gmInterpolatorOutputBindings.h:130
const GmElement * _elem
The element where the result will be stored.
Definition gmInterpolatorOutputBindings.h:140
int _ip
The element Gauss point index where the result will be stored.
Definition gmInterpolatorOutputBindings.h:141
GmGaussAccessor * _ac
The accessor for storing results.
Definition gmInterpolatorOutputBindings.h:139
virtual int numSrcs()
Returns the number o data srcs (accessors) stored by this object.
Definition gmInterpolatorOutputBindings.h:124
GmInterpolatorOutputDataBinding implementation storing multiple values in a Gauss point through an ac...
Definition gmInterpolatorOutputBindings.h:149
virtual void setValue(int srcIndex, const GmVector &data)
Saves the given vector as the result for the given data src.
Definition gmInterpolatorOutputBindings.h:166
const QVector< GmGaussAccessor * > & _acList
The list with accessors for storing results.
Definition gmInterpolatorOutputBindings.h:174
virtual int dim(int srcIndex) const
Returns the access index for retrieving scalar values from vector data or -1 if unused.
Definition gmInterpolatorOutputBindings.h:163
int _ip
The element Gauss point index where the result will be stored.
Definition gmInterpolatorOutputBindings.h:176
GmInterpolatorMGaussOutputDataBinding(const QVector< 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:156
int _dim
The selected dimension when converting vector data to scalars or -1 if not needed.
Definition gmInterpolatorOutputBindings.h:177
virtual int numSrcs()
Returns the number o data srcs (accessors) stored by this object.
Definition gmInterpolatorOutputBindings.h:160
const GmElement * _elem
The element where the result will be stored.
Definition gmInterpolatorOutputBindings.h:175
GmInterpolatorOutputMultiDataBinding implementation storing multiple values in a matrix list.
Definition gmInterpolatorOutputBindings.h:304
virtual int dim(int srcIndex) const
Returns the access index for retrieving scalar values from vector data or -1 if unused.
Definition gmInterpolatorOutputBindings.h:320
GmInterpolatorMMatrixOutputMultiDataBinding(QVector< 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:310
virtual int numSrcs()
Returns the number o data srcs (accessors) stored by this object.
Definition gmInterpolatorOutputBindings.h:317
QVector< GmMatrix > & _outList
A reference to the matrix list where the interpolation results will be stored.
Definition gmInterpolatorOutputBindings.h:326
int _dim
The selected dimension when converting vector data to scalars or -1 if not needed.
Definition gmInterpolatorOutputBindings.h:327
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:323
GmInterpolatorOutputDataBinding implementation storing multiple values in a node through an accessor ...
Definition gmInterpolatorOutputBindings.h:219
virtual int numSrcs()
Returns the number o data srcs (accessors) stored by this object.
Definition gmInterpolatorOutputBindings.h:230
virtual void setValue(int srcIndex, const GmVector &data)
Saves the given vector as the result for the given data src.
Definition gmInterpolatorOutputBindings.h:236
int _dim
The selected dimension when converting vector data to scalars or -1 if not needed.
Definition gmInterpolatorOutputBindings.h:246
virtual int dim(int srcIndex) const
Returns the access index for retrieving scalar values from vector data or -1 if unused.
Definition gmInterpolatorOutputBindings.h:233
GmInterpolatorMNodeOutputDataBinding(const QVector< 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:226
const QVector< GmValueAccessor * > & _acList
The list with accessors for storing results.
Definition gmInterpolatorOutputBindings.h:244
int _nodeIndex
The node index where the results will be stored.
Definition gmInterpolatorOutputBindings.h:245
GmInterpolatorOutputDataBinding implementation storing multiple values in a vector list.
Definition gmInterpolatorOutputBindings.h:83
QVector< GmVector > & _outList
A reference to the vector list where the interpolation results will be stored.
Definition gmInterpolatorOutputBindings.h:105
virtual int dim(int srcIndex) const
Returns the access index for retrieving scalar values from vector data or -1 if unused.
Definition gmInterpolatorOutputBindings.h:99
GmInterpolatorMVectorOutputDataBinding(QVector< 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
virtual int numSrcs()
Returns the number o data srcs (accessors) stored by this object.
Definition gmInterpolatorOutputBindings.h:96
virtual void setValue(int srcIndex, const GmVector &data)
Saves the given vector as the result for the given data src.
Definition gmInterpolatorOutputBindings.h:102
int _dim
The selected dimension when converting vector data to scalars or -1 if not needed.
Definition gmInterpolatorOutputBindings.h:106
GmInterpolatorOutputMultiDataBinding implementation storing a single value in a matrix.
Definition gmInterpolatorOutputBindings.h:279
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:285
GmMatrix & _outData
A reference to the matrix where the interpolation result will be stored.
Definition gmInterpolatorOutputBindings.h:298
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:295
virtual int dim(int srcIndex) const
Returns the access index for retrieving scalar values from vector data or -1 if unused.
Definition gmInterpolatorOutputBindings.h:292
virtual int numSrcs()
Returns the number o data srcs (accessors) stored by this object.
Definition gmInterpolatorOutputBindings.h:289
int _dim
The selected dimension when converting vector data to scalars or -1 if not needed.
Definition gmInterpolatorOutputBindings.h:299
GmInterpolatorOutputDataBinding implementation storing a single value in a node attribute through an ...
Definition gmInterpolatorOutputBindings.h:184
int _dim
The selected dimension when converting vector data to scalars or -1 if not needed.
Definition gmInterpolatorOutputBindings.h:212
GmValueAccessor * _ac
The accessor for storing results.
Definition gmInterpolatorOutputBindings.h:210
virtual int numSrcs()
Returns the number o data srcs (accessors) stored by this object.
Definition gmInterpolatorOutputBindings.h:195
int _nodeIndex
The node index where the result will be stored.
Definition gmInterpolatorOutputBindings.h:211
virtual int dim(int srcIndex) const
Returns the access index for retrieving scalar values from vector data or -1 if unused.
Definition gmInterpolatorOutputBindings.h:198
virtual void setValue(int srcIndex, const GmVector &data)
Saves the given vector as the result for the given data src.
Definition gmInterpolatorOutputBindings.h:201
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:191
Binding class used to host the data structure where calculated interpolated values will be stored....
Definition gmInterpolatorOutputBindings.h:43
virtual int dim(int srcIndex) const =0
Returns the access index for retrieving scalar values from vector data or -1 if unused.
virtual void setValue(int srcIndex, const GmVector &data)=0
Saves the given vector as the result for the given data src.
virtual int numSrcs()=0
Returns the number o data srcs (accessors) stored by this object.
Binding class used to host the data structure where calculated interpolated values will be stored for...
Definition gmInterpolatorOutputBindings.h:261
virtual int dim(int srcIndex) const =0
Returns the access index for retrieving scalar values from vector data or -1 if unused.
virtual int numSrcs()=0
Returns the number o data srcs (accessors) stored by this object.
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...
GmInterpolatorOutputDataBinding implementation storing a single value in a vector.
Definition gmInterpolatorOutputBindings.h:58
GmVector & _outData
A reference to the vector where the interpolation result will be stored.
Definition gmInterpolatorOutputBindings.h:77
virtual void setValue(int srcIndex, const GmVector &data)
Saves the given vector as the result for the given data src.
Definition gmInterpolatorOutputBindings.h:74
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
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
int _dim
The selected dimension when converting vector data to scalars or -1 if not needed.
Definition gmInterpolatorOutputBindings.h:78
virtual int numSrcs()
Returns the number o data srcs (accessors) stored by this object.
Definition gmInterpolatorOutputBindings.h:68
Interface class for accessing and setting values from an "indexable" collection of values.
Definition gmValueAccessor.h:60
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
bool setVectorValue(int index, const GmVector &vec)
Similar to setValue() but receiving the data as a vector.
Definition gmValueAccessor.h:233
Declaration of useful configuration definitions for the Core library.
Implementation of the GmGaussAccessor proxy class.
arma::mat GmMatrix
The basic type for a GeMA matrix object. Currently based on an Armadillo matrix.
Definition gmMatrix.h:38
arma::vec GmVector
The basic type for a GeMA vector object. Currently based on an Armadillo vector.
Definition gmVector.h:34
const T & at(int i) const const
void resize(int size)
int size() const const