24#ifndef _GEMA_AC_RESULTS_DATASRC_H_
25#define _GEMA_AC_RESULTS_DATASRC_H_
48 _nResLin(0), _nResCol(0), _interp(NULL), _subset(GmInterpolatorSubset::GM_SUBSET_ALL), _acceptDiscontinuitySet(false) {}
86 GmInterpolatorSubset subsetType()
const {
return _subset; }
95 _interpType = interpType;
96 _interpParam = interpParam;
115 delete _interp; _acceptDiscontinuitySet =
false;
119 int itype = _interp->interpolatorObject()->type();
125 bool interpAcceptDiscSet()
const {
return _acceptDiscontinuitySet; }
144 _acceptDiscontinuitySet =
false;
188 virtual QString id()
const {
return _ac->info()->id(); }
197 virtual bool isScalar()
const {
return _dim >= 0 || _ac->isScalar(); }
200 virtual int dimSize()
const {
return _dim == -1 ? _ac->valueSize() : 1; }
203 virtual int size()
const {
return _tFunc.isValid() ? _nResLin * _nResCol : dimSize(); }
206 virtual int nlin()
const {
return _tFunc.isValid() ? _nResLin : (_dim == -1 ? _ac->info()->
nlin() : 1); }
209 virtual int ncol()
const {
return _tFunc.isValid() ? _nResCol : (_dim == -1 ? _ac->info()->
ncol() : 1); }
212 T*
ac()
const {
return _ac; }
217 void setAc(T* newAc) {
if(_ownership)
delete _ac; _ac = newAc; _ownership =
true; }
230 template <
class Result>
234 assert(
dynamic_cast<Result*
>(
this));
237 list.
append(
dynamic_cast<Result*
>(
this));
241 for(
int i = 1, ndim = _ac->valueSize(); i < ndim; i++)
243 Result* r =
new Result(
this);
245 r->_alias = r->_alias +
QString(
"_%1").
arg(i+1);
A class storing basic information about a result data to be exported (monitored / saved),...
Definition gmAcResultsDataSrc.h:42
int history() const
Returns the state accessed by this data src.
Definition gmAcResultsDataSrc.h:75
virtual QString formatStr() const
How should dataSrc values be formatted?
Definition gmAcResultsDataSrc.h:66
int _history
The state accessed by this data src (0 = current state, 1 = previous, etc..)
Definition gmAcResultsDataSrc.h:161
virtual int monitorTrackId() const
Returns a numeric id for this data src (a value between 0 and the number of monitored data sources in...
Definition gmAcResultsDataSrc.h:54
int dimFilter() const
Returns the dimension filter value (-1 if there is no filter)
Definition gmAcResultsDataSrc.h:78
virtual int dimSize() const =0
Returns the accessor valueSize() adjusted by an optional dimension filter.
GmInterpolator * interp() const
Returns the associated interpolator, if any.
Definition gmAcResultsDataSrc.h:81
void setInterpolator(GmInterpolator *interp)
Sets the configured interpolator for this data source. Takes ownership of the object.
Definition gmAcResultsDataSrc.h:113
GmInterpolator * _interp
The configured interpolator object. Can be NULL. !!Should not be set directly, use setInterpolator() ...
Definition gmAcResultsDataSrc.h:169
bool hasTransformationFunction() const
Returns true if this data src is associated with a transfromation function.
Definition gmAcResultsDataSrc.h:84
virtual ~GmAcResultsDataSrcBase()
Destructor.
Definition gmAcResultsDataSrc.h:51
QString _formatStr
The format string for the data. Usually equal to the accessor format.
Definition gmAcResultsDataSrc.h:160
void setBasicData(int dim, const QString &alias, int history, GmInterpolatorType interpType, const QVariant &interpParam, GmInterpolatorSubset subset)
Sets the values of the given basic object attributes.
Definition gmAcResultsDataSrc.h:89
int _nResCol
The number of columns of the result returned by _tFunc.
Definition gmAcResultsDataSrc.h:166
void setFormatStr(const QString &formatStr)
Sets the format string.
Definition gmAcResultsDataSrc.h:101
GmInterpolatorType _interpType
How do we interpolate data?
Definition gmAcResultsDataSrc.h:162
QVariant _interpParam
Optional interpolation parameters.
Definition gmAcResultsDataSrc.h:163
GmInterpolatorSubset _subset
The subset of data to be considered when interpolating discontinuous elements.
Definition gmAcResultsDataSrc.h:167
virtual bool isScalar() const =0
Returns true if the accessor value is a scalar value or there is a dimensional filter.
LuaFunction _tFunc
An optional transformation function applied over the data (filtered by _dim) before exporting.
Definition gmAcResultsDataSrc.h:164
virtual void setMonitorTrackId(int id)
Updates the data src's monitor track id.
Definition gmAcResultsDataSrc.h:57
void setTransformationFunction(LuaFunction &tfunc, int nresLin, int nresCol)
Sets the transformation function along with its result dimensions.
Definition gmAcResultsDataSrc.h:104
int _dim
A "bound" dimension for returning a scalar when the data is multidimensional (-1 for returning all va...
Definition gmAcResultsDataSrc.h:159
virtual QString alias() const
Returns the data src "exported" id.
Definition gmAcResultsDataSrc.h:63
QString _alias
The name given to the "exported" data. Always filled (might be equal to id())
Definition gmAcResultsDataSrc.h:158
bool _acceptDiscontinuitySet
True if the _interp type accepts discontinuitySet aware interpolation.
Definition gmAcResultsDataSrc.h:170
int _nResLin
The number of lines of the result returned by _tFunc.
Definition gmAcResultsDataSrc.h:165
int _trackId
The numeric id for this data src (a value between 0 and the number of monitored data srcs in the mode...
Definition gmAcResultsDataSrc.h:157
GmAcResultsDataSrcBase()
Default constructor.
Definition gmAcResultsDataSrc.h:46
GmAcResultsDataSrcBase(const GmAcResultsDataSrcBase *ptr)
A kind of "copy" constructor geting a pointer instead of a reference that copies the contents of the ...
Definition gmAcResultsDataSrc.h:139
Aux class adding an accessor to a basic result data source.
Definition gmAcResultsDataSrc.h:176
virtual ~GmAcResultsDataSrc()
Destructor.
Definition gmAcResultsDataSrc.h:185
virtual QString description() const
Returns the data src description, when available.
Definition gmAcResultsDataSrc.h:191
void setAc(T *newAc)
Updates the stored accessor, taking ownership of it. Used by GmFileIO for replacing an accessor by an...
Definition gmAcResultsDataSrc.h:217
T * _ac
The node data accessor.
Definition gmAcResultsDataSrc.h:266
virtual int dimSize() const
Returns the accessor valueSize() adjusted by an optional dimension filter.
Definition gmAcResultsDataSrc.h:200
virtual Unit unit() const
Returns the unit in which the data is expressed.
Definition gmAcResultsDataSrc.h:194
bool _ownership
Are we the owner of _ac? This can be false as a result of the dimSplit() operation.
Definition gmAcResultsDataSrc.h:267
virtual int ncol() const
The number of columns in the returned result, taking into account any applied transformations or dim ...
Definition gmAcResultsDataSrc.h:209
virtual bool isScalar() const
Returns true if the accessor value is a scalar value or there is a dimensional filter.
Definition gmAcResultsDataSrc.h:197
GmAcResultsDataSrc(const GmAcResultsDataSrc< T > *ptr)
A private "copy" constructor geting a pointer instead of a reference that copies the contents of the ...
Definition gmAcResultsDataSrc.h:259
virtual int size() const
Returns the dimension of the data src values, taking into account any applied transformations or dim ...
Definition gmAcResultsDataSrc.h:203
QVector< Result * > dimSplit()
Returns a vector with as many data srcs as dimensions. The first one will be the original data src wi...
Definition gmAcResultsDataSrc.h:231
GmAcResultsDataSrc(T *ac)
Constructor.
Definition gmAcResultsDataSrc.h:182
T * ac() const
Returns the associated accessor.
Definition gmAcResultsDataSrc.h:212
virtual int nlin() const
The number of lines in the returned result, taking into account any applied transformations or dim fi...
Definition gmAcResultsDataSrc.h:206
A GmAcResultsDataSrc class holding a cell value accessor.
Definition gmAcResultsDataSrc.h:295
GmCellAcResultsDataSrc * cloneSameAcNoInterp() const
Duplicates the current data src object, sharing the same accessor. The copy will NOT include any inte...
Definition gmAcResultsDataSrc.h:307
GmCellAcResultsDataSrc(const GmAcResultsDataSrc< GmCellAccessor > *base)
Special "copy" (gets a pointer and not a reference) constructor accessible by dimSplit() to duplicate...
Definition gmAcResultsDataSrc.h:313
virtual GmResultsDataSrcType type() const
See dimSplit() documentation on the base calss.
Definition gmAcResultsDataSrc.h:301
GmCellAcResultsDataSrc(GmCellAccessor *ac)
Constructor.
Definition gmAcResultsDataSrc.h:298
The GmCellAccessor class is a proxy object to a value accesor implementing a more convenient interfac...
Definition gmCellAccessor.h:67
A GmAcResultsDataSrc class holding a Gauss value accessor.
Definition gmAcResultsDataSrc.h:318
GmGaussAcResultsDataSrc(GmGaussAccessor *ac)
Constructor.
Definition gmAcResultsDataSrc.h:321
GmGaussAcResultsDataSrc * cloneSameAcNoInterp() const
Duplicates the current data src object, sharing the same accessor. The copy will NOT include any inte...
Definition gmAcResultsDataSrc.h:330
GmGaussAcResultsDataSrc(const GmAcResultsDataSrc< GmGaussAccessor > *base)
Special "copy" (gets a pointer and not a reference) constructor accessible by dimSplit() to duplicate...
Definition gmAcResultsDataSrc.h:336
QVector< GmGaussAcResultsDataSrc * > dimensionSplit()
See dimSplit() documentation on the base calss.
Definition gmAcResultsDataSrc.h:327
virtual GmResultsDataSrcType type() const
Returns the data src type.
Definition gmAcResultsDataSrc.h:324
The GmGaussAccessor class is a proxy object to a value accessor implementing a more convenient interf...
Definition gmGaussAccessor.h:39
Interpolator class used for managing available interpolator algorithms and providing basic support fu...
Definition gmInterpolator.h:245
A GmAcResultsDataSrc class holding a node value accessor.
Definition gmAcResultsDataSrc.h:272
GmNodeAcResultsDataSrc * cloneSameAcNoInterp() const
Duplicates the current data src object, sharing the same accessor. The copy will NOT include any inte...
Definition gmAcResultsDataSrc.h:284
virtual GmResultsDataSrcType type() const
Returns the data src type.
Definition gmAcResultsDataSrc.h:278
QVector< GmNodeAcResultsDataSrc * > dimensionSplit()
See dimSplit() documentation on the base calss.
Definition gmAcResultsDataSrc.h:281
GmNodeAcResultsDataSrc(GmValueAccessor *ac)
Constructor.
Definition gmAcResultsDataSrc.h:275
GmNodeAcResultsDataSrc(const GmAcResultsDataSrc< GmValueAccessor > *base)
Special "copy" (gets a pointer and not a reference) constructor accessible by dimSplit() to duplicate...
Definition gmAcResultsDataSrc.h:290
A set storing what should be exported (saved / printed / monitored) by the result rule classes.
Definition gmResultsDataSet.h:58
A basic interface with the metadata common to all results data src types. This is the information tha...
Definition gmResultsDataSrcInfo.h:50
virtual QString alias() const =0
Returns the data src "exported" id.
virtual QString formatStr() const =0
How should dataSrc values be formatted?
Interface class for accessing and setting values from an "indexable" collection of values.
Definition gmValueAccessor.h:60
Implementation of the GmCellAccessor proxy class.
#define GMC_API_EXPORT
Macro for controlling if the class is being exported (GEMA_CORE_LIB defined) or imported (GEMA_CORE_L...
Definition gmCoreConfig.h:35
Implementation of the GmGaussAccessor proxy class.
Declaration of the GmInterpolator and GmInterpolatorObject classes.
GmInterpolatorType
Available interpolation methods. Not every method is suitable for every kind of interpolator class....
Definition gmInterpolator.h:64
@ GM_DEFAULT_INTERPOLATOR
Interpolation should be done using the default method for the interpolator object.
Definition gmInterpolator.h:134
@ GM_SHAPE_INTERPOLATOR
Interpolated value is found by using the elements shape function.
Definition gmInterpolator.h:113
@ GM_LSHAPE_INTERPOLATOR
Interpolated value is found by using the elements equivalent linear shape function....
Definition gmInterpolator.h:124
Declaration of the GmResultsDataSrcInfo interface.
GmResultsDataSrcType
The types of data sources stored by a rule.
Definition gmResultsDataSrcInfo.h:33
@ GM_RR_DS_GAUSSDATA
Gauss attributes.
Definition gmResultsDataSrcInfo.h:37
@ GM_RR_DS_NODEDATA
Node attributes + State vars.
Definition gmResultsDataSrcInfo.h:35
@ GM_RR_DS_CELLDATA
Cell attributes + properties.
Definition gmResultsDataSrcInfo.h:36
Declaration of the GmValueAccessor interface and GmValueAccessorBase class.
QString arg(qlonglong a, int fieldWidth, int base, QChar fillChar) const const
void append(const T &value)