GemaCoreLib
The GeMA Core library
Loading...
Searching...
No Matches
GmResultsDataSet Class Reference

A set storing what should be exported (saved / printed / monitored) by the result rule classes. More...

#include <gmResultsDataSet.h>

Inheritance diagram for GmResultsDataSet:
Collaboration diagram for GmResultsDataSet:

Public Member Functions

virtual ~GmResultsDataSet ()
 Destructor.
 
QString id () const
 Returns the data set name.
 
int monitorTrackId () const
 Returns the data set monitor track id if this data set is associated with a monitor rule, -1 otherwise.
 
void setMonitorTrackId (int id)
 Updates the data set's monitor track id.
 
QString description () const
 Returns the data set description.
 
GmMeshmesh () const
 Returns the mesh that contains the associated data. Can be NULL.
 
GmValueAccessormeshCoordAc () const
 Returns the node coordinate accessor associated with the data mesh or NULL for attribute only data sets.
 
int numDataSrcs (int type=-1) const
 Returns the number of datasrcs in this data set if type is -1 or the number of data srcs of a specific type if type is a GmResultsDataSrcType enum value.
 
int dataSrcIndex (GmResultsDataSrcType type, int i) const
 Returns the data src index of the ith data src of the given type.
 
const GmResultsDataSrcInfodataSrcInfo (int index) const
 Returns the data src metadata given its index (between 0 and numDataSrcs())
 
int dataSrcSize (int index) const
 Returns the number of result lines that exist for a data src, given its index.
 
const double * dataSrcValue (int index, int line, QString &err) const
 Returns the line'th result associated with the data src identified by its index. As with any GeMA accessor, the returned buffer is valid only until the next call to dataSrcValue().
 
QString strDataSrcValue (int index, int line, QString &err) const
 Returns the line'th string result associated with the data src identified by its index.
 
QString explain (int index, int line) const
 Explains the evaluation point associated with the line'th result associated with the data src identified by its index. Results are a string like "node 5" or "cell 4 @ ip 2")
 
void setDataSrcMonitorTrackId (int index, int id)
 Updates the data src monitor track id given its index (between 0 and numDataSrcs()) and new id.
 
GmResultsEvalSetevalSet (GmResultsDataSrcType type) const
 Returns the eval set associated with the given type.
 
void print (const GmLogCategory &logger, GmLogLevel level) const
 Prints the data set description to the appointed logger / level.
 
- Public Member Functions inherited from QObject
virtual const QMetaObjectmetaObject () const const
 
 QObject (QObject *parent)
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
QString objectName () const const
 
void setObjectName (const QString &name)
 
bool isWidgetType () const const
 
bool isWindowType () const const
 
bool signalsBlocked () const const
 
bool blockSignals (bool block)
 
QThreadthread () const const
 
void moveToThread (QThread *targetThread)
 
int startTimer (int interval, Qt::TimerType timerType)
 
int startTimer (std::chrono::milliseconds time, Qt::TimerType timerType)
 
void killTimer (int id)
 
findChild (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegExp &regExp, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const
 
const QObjectListchildren () const const
 
void setParent (QObject *parent)
 
void installEventFilter (QObject *filterObj)
 
void removeEventFilter (QObject *obj)
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const
 
bool disconnect (const char *signal, const QObject *receiver, const char *method) const const
 
bool disconnect (const QObject *receiver, const char *method) const const
 
void dumpObjectTree ()
 
void dumpObjectInfo ()
 
void dumpObjectTree () const const
 
void dumpObjectInfo () const const
 
bool setProperty (const char *name, const QVariant &value)
 
QVariant property (const char *name) const const
 
QList< QByteArraydynamicPropertyNames () const const
 
void destroyed (QObject *obj)
 
void objectNameChanged (const QString &objectName)
 
QObjectparent () const const
 
bool inherits (const char *className) const const
 
void deleteLater ()
 
 Q_DISABLE_COPY (Class)
 
 Q_DISABLE_MOVE (Class)
 
 Q_DISABLE_COPY_MOVE (Class)
 
qobject_cast (QObject *object)
 
qobject_cast (const QObject *object)
 
qFindChild (const QObject *obj, const QString &name)
 
QList< T > qFindChildren (const QObject *obj, const QString &name)
 
QList< T > qFindChildren (const QObject *obj, const QRegExp &regExp)
 
 Q_CLASSINFO (Name, Value)
 
 Q_INTERFACES (...)
 
 Q_PROPERTY (...)
 
 Q_ENUMS (...)
 
 Q_FLAGS (...)
 
 Q_ENUM (...)
 
 Q_FLAG (...)
 
 Q_ENUM_NS (...)
 
 Q_FLAG_NS (...)
 
 Q_OBJECT Q_OBJECT
 
 Q_GADGET Q_GADGET
 
 Q_NAMESPACE Q_NAMESPACE
 
 Q_NAMESPACE_EXPORT (EXPORT_MACRO)
 
 Q_SIGNALS Q_SIGNALS
 
 Q_SIGNAL Q_SIGNAL
 
 Q_SLOTS Q_SLOTS
 
 Q_SLOT Q_SLOT
 
 Q_EMIT Q_EMIT
 
 Q_INVOKABLE Q_INVOKABLE
 
 Q_REVISION Q_REVISION
 
 Q_SET_OBJECT_NAME (Object)
 
 QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT
 

Static Public Member Functions

static GmResultsDataSetloadFromTable (LuaTable &tab, GmSimulationData *data, const GmLogCategory &parseLogger, const GmLogCategory &dataLogger)
 Parses a result data set definition from the given Lua table, returning a results data set object.
 
static GmNodeAcResultsDataSrccreateNodeDataSrc (const GmMesh *mesh, const QVariant &v, bool interp, const GmLogCategory &dataLogger, bool *unknown, QString &srcId, QString &err)
 Aux function to create a new node data src from a "nodeData" entry, which can be a string or a Lua table. On error, returns false and fills err.
 
static GmCellAcResultsDataSrccreateCellDataSrc (const GmCellMesh *mesh, const QVariant &v, bool interp, const GmLogCategory &dataLogger, bool *unknown, QString &srcId, QString &err)
 Aux function to create a new cell data src from a "cellData" entry. See comments on GmResultsDataSet::createNodeDataSrc().
 
static GmGaussAcResultsDataSrccreateGaussDataSrc (const GmElementMesh *mesh, const QVariant &v, bool interp, const GmLogCategory &dataLogger, bool *unknown, QString &srcId, QString &err)
 Aux function to create a new cell data src from a "gaussData" entry. See comments on GmResultsDataSet::createNodeDataSrc().
 
- Static Public Member Functions inherited from QObject
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, Functor functor)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
bool disconnect (const QMetaObject::Connection &connection)
 
bool disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method)
 

Protected Member Functions

 GmResultsDataSet (QString id, QString description, GmAttributeResultsManager *attrManager)
 Constructor.
 
- Protected Member Functions inherited from QObject
QObjectsender () const const
 
int senderSignalIndex () const const
 
int receivers (const char *signal) const const
 
bool isSignalConnected (const QMetaMethod &signal) const const
 
virtual void timerEvent (QTimerEvent *event)
 
virtual void childEvent (QChildEvent *event)
 
virtual void customEvent (QEvent *event)
 
virtual void connectNotify (const QMetaMethod &signal)
 
virtual void disconnectNotify (const QMetaMethod &signal)
 

Private Slots

void dataSrcInfoChanged (int size)
 A slot attached to the infoChanged() signal emited by a GmAttributeResultsDataSrc object when its info metadata field was changed due to an attribute being finally registered / unregistered at the orchestration.
 

Private Member Functions

 Q_DISABLE_COPY (GmResultsDataSet)
 
bool addNodeDataSrc (const GmMesh *mesh, const QVariant &v, const GmLogCategory &dataLogger, QString &err)
 Aux function to add a new node data src to the set from its "nodeData" entry, which can be a string or a Lua table. On error, returns false and fills err.
 
bool addCellDataSrc (const GmCellMesh *mesh, const QVariant &v, const GmLogCategory &dataLogger, QString &err)
 Aux function to add a new cell data src to the set from its "cellData" entry, which can be a string or a Lua table. On error, returns false and fills err.
 
bool addGaussDataSrc (const GmElementMesh *mesh, const QVariant &v, const GmLogCategory &dataLogger, QString &err)
 Aux function to add a new Gauss data src to the set from its "gaussData" entry, which can be a string or a Lua table. On error, returns false and fills err.
 
bool checkForMultipleAffectedNodes (GmAffectedNodes *affNodes) const
 Checks that the configured node data srcs have the same affected nodes property. Returns true if the set is multiple, false if not. Either way, fills affNodes with the "union" of the data sources affected nodes.
 
bool checkForMultipleGaussRuleSets (int *ruleSet) const
 Checks that the configured gauss data srcs have the same integration rule set. Returns true if the set is multiple, false if not. When the set is not multiple, fills ruleSet with the common rule number.
 
bool createNodeInterpolators (bool *needNatural, const GmLogCategory &logger, QString &err)
 Creates interpolators for transfering data from node attributes to cell points (for cell meshes) or to arbitrary points (for node meshes). Fills needNatural with true if any of the node data interpolators needs natural coordinates. Returns true on success or false on error (filling errr with a message).
 
bool createGaussInterpolators (bool *needNatural, const GmLogCategory &logger, QString &err)
 Creates interpolators for transfering data from Gauss attributes to cell points (centroid or user given). Fills needNatural with true if any of the Gauss data interpolators needs natural coordinates. Returns true on success or false on error (filling errr with a message).
 
bool allocResultBuffers ()
 Allocate space for the result buffers used to store interpolated results and/or returned results from translation functions.
 
const double * nodeDataSrcValue (GmNodeAcResultsDataSrc *ds, int line, QString &err) const
 Returns the line'th result associated with the given node data src.
 
const double * cellDataSrcValue (GmCellAcResultsDataSrc *ds, int line, QString &err) const
 Returns the line'th result associated with the given cell data src.
 
const double * gaussDataSrcValue (GmGaussAcResultsDataSrc *ds, int line, QString &err) const
 Returns the line'th result associated with the given Gauss data src.
 

Static Private Member Functions

template<class T , class AcF >
static T * createDataSrc (const QVariant &v, const AcF &acGet, bool interp, bool *unknown, QString &srcId, QString &err)
 Generic implementation for createXxxDataSrc functions. T is the data src type and AcF is the function used to return an accessor for the parsed id. It receives as parameters the id name, the requested history and unit. Keep in mind that the needed mesh and logger should already be known to acGet.
 
static bool parseAndCheckDataSrcFields (GmAcResultsDataSrcBase *ds, const GmValueInfo *info, const QVariant &v, QString &err)
 Parse additional common DataSrc values: format, resultDim and transform. Also checks the basic information stored in the data src against the src metadata.
 

Private Attributes

QString _id
 The data set id (name)
 
int _monitorTrackId
 The monitor track id if this data set is associated with a monitor rule, -1 otherwise.
 
QString _description
 A description of the data set.
 
GmAttributeResultsManager_attrm
 The attribute manager object used to provide values for result attributes.
 
GmMesh_mesh
 The mesh that this data set is tied to (can be NULL for attribute rules)
 
GmDiscontinuitySet_discSet
 The discontinuitySet that this data set uses for interpolation.
 
GmValueAccessor_coordAc
 The accessor used for accessing node coordinates.
 
QVector< GmResultsDataSrcInfo * > _dataSrcs
 
int _dataSrcPos [GM_RR_DS_NUMTYPES+1]
 A vector storing the position in _dataSrcs of the first entry of each type, with the last entry storing the number of data srcs. That means that the first entry is always 0 and for each type t, _dataSrcPos[t] gives the index while _dataSrcPos[t+1] - _dataSrcPos[t] gives the number of entries of type t in _dataSrcs.
 
GmResultsEvalSet_nodeEvalSet
 The evaluation set for node data sources.
 
GmResultsEvalSet_cellEvalSet
 The evaluation set for cell data sources.
 
GmResultsEvalSet_gaussEvalSet
 The evaluation set for gauss data sources.
 
double * _resultBuffer
 The buffer used by xxxDataSrcValue() functions for returning interpolated data. Its size is the biggest data src accessor dimension size.
 
double * _transformBuffer
 The buffer used to store the result from a "non ac" data src or user transformation function. Its size is the biggest data src size.
 
int _transformBufferSize
 The size of _transformBuffer.
 

Additional Inherited Members

- Public Types inherited from QObject
typedef  QObjectList
 
- Properties inherited from QObject
 objectName
 

Detailed Description

A set storing what should be exported (saved / printed / monitored) by the result rule classes.

Data at Eval at Interpolation Natural coord

Nodes Node No - Cell centroid Yes Interpolator Cell Gauss point Yes Interpolator

User point Yes Interpolator

Cells Cell centroid No Mesh type Cell Gauss point No Mesh type

User point No Mesh type

Gauss points Cell centroid Yes Interpolator Cell Gauss point No Yes

User point Yes Interpolator

TODO: If, for a data src class, all the source interpolators are the same, we could use a single interpolator and do all line calculations in a single operation, which is much faster than multiple single interpolations (weights are the same for every data src)

TODO: Use NC2P interpolators (needs some extra configuration parameters)

Member Function Documentation

◆ addCellDataSrc()

bool GmResultsDataSet::addCellDataSrc ( const GmCellMesh * mesh,
const QVariant & v,
const GmLogCategory & dataLogger,
QString & err )
private

Aux function to add a new cell data src to the set from its "cellData" entry, which can be a string or a Lua table. On error, returns false and fills err.

If there exists both a cell attribute and a porperty with the same name, preference is given to cell attributes.

The given logger is used for accessor creation only. It should not be used for error messages.

◆ addGaussDataSrc()

bool GmResultsDataSet::addGaussDataSrc ( const GmElementMesh * mesh,
const QVariant & v,
const GmLogCategory & dataLogger,
QString & err )
private

Aux function to add a new Gauss data src to the set from its "gaussData" entry, which can be a string or a Lua table. On error, returns false and fills err.

The given logger is used for accessor creation only. It should not be used for error messages.

◆ addNodeDataSrc()

bool GmResultsDataSet::addNodeDataSrc ( const GmMesh * mesh,
const QVariant & v,
const GmLogCategory & dataLogger,
QString & err )
private

Aux function to add a new node data src to the set from its "nodeData" entry, which can be a string or a Lua table. On error, returns false and fills err.

The given logger is used for accessor creation only. It should not be used for error messages.

◆ allocResultBuffers()

bool GmResultsDataSet::allocResultBuffers ( )
private

Allocate space for the result buffers used to store interpolated results and/or returned results from translation functions.

The buffer is alocated with a size big enough for the result value of any of the data sources.

◆ cellDataSrcValue()

const double * GmResultsDataSet::cellDataSrcValue ( GmCellAcResultsDataSrc * ds,
int line,
QString & err ) const
private

Returns the line'th result associated with the given cell data src.

As with any GeMA accessor, the returned buffer is valid only until the next call to any xxxDataSrcValue() method. The dimension filter, if any, IS applied by this call. Returns NULL on errors. Should fill err for an anexpected error, such as an interpolation error, keeping it empty if the value can not be evaluated (is not defined) at the given line.

◆ createCellDataSrc()

GmCellAcResultsDataSrc * GmResultsDataSet::createCellDataSrc ( const GmCellMesh * mesh,
const QVariant & v,
bool interp,
const GmLogCategory & dataLogger,
bool * unknown,
QString & srcId,
QString & err )
static

Aux function to create a new cell data src from a "cellData" entry. See comments on GmResultsDataSet::createNodeDataSrc().

If there exists both a cell attribute and a porperty with the same name, preference is given to cell attributes.

◆ createGaussInterpolators()

bool GmResultsDataSet::createGaussInterpolators ( bool * needNatural,
const GmLogCategory & logger,
QString & err )
private

Creates interpolators for transfering data from Gauss attributes to cell points (centroid or user given). Fills needNatural with true if any of the Gauss data interpolators needs natural coordinates. Returns true on success or false on error (filling errr with a message).

Interpolators created by this function are stored in the data src objects.

◆ createNodeDataSrc()

GmNodeAcResultsDataSrc * GmResultsDataSet::createNodeDataSrc ( const GmMesh * mesh,
const QVariant & v,
bool interp,
const GmLogCategory & dataLogger,
bool * unknown,
QString & srcId,
QString & err )
static

Aux function to create a new node data src from a "nodeData" entry, which can be a string or a Lua table. On error, returns false and fills err.

In case of errors, fills err and returns NULL. The given logger is used for accessor creation only. It is not used for error messages. The srcId parameter will be filled with the requested id, as much as possible, even on errors. If different from NULL, unknown will be filled with true if there was an error getting an accessor for the requested id. Otherwise it will be filled with false.

The interp parameter controls wheter interpolation definition information will be read from v or not (this is used by GmFileIO routines that do not need interpolation methods).

◆ createNodeInterpolators()

bool GmResultsDataSet::createNodeInterpolators ( bool * needNatural,
const GmLogCategory & logger,
QString & err )
private

Creates interpolators for transfering data from node attributes to cell points (for cell meshes) or to arbitrary points (for node meshes). Fills needNatural with true if any of the node data interpolators needs natural coordinates. Returns true on success or false on error (filling errr with a message).

Interpolators created by this function are stored in the data src objects.

◆ dataSrcValue()

const double * GmResultsDataSet::dataSrcValue ( int index,
int line,
QString & err ) const

Returns the line'th result associated with the data src identified by its index. As with any GeMA accessor, the returned buffer is valid only until the next call to dataSrcValue().

Returns NULL, filling err on errors (an error on a user transformation function, for example). Returns NULL, keeping err empty if the value can not be evaluated at the given line.

◆ gaussDataSrcValue()

const double * GmResultsDataSet::gaussDataSrcValue ( GmGaussAcResultsDataSrc * ds,
int line,
QString & err ) const
private

Returns the line'th result associated with the given Gauss data src.

As with any GeMA accessor, the returned buffer is valid only until the next call to any xxxDataSrcValue() method. The dimension filter, if any, IS applied by this call. Returns NULL on errors. Should fill err for an anexpected error, such as an interpolation error, keeping it empty if the value can not be evaluated (is not defined) at the given line.

◆ loadFromTable()

GmResultsDataSet * GmResultsDataSet::loadFromTable ( LuaTable & tab,
GmSimulationData * data,
const GmLogCategory & parseLogger,
const GmLogCategory & dataLogger )
static

Parses a result data set definition from the given Lua table, returning a results data set object.

The first logger, parseLogger, is used to emmit messages during data set parsing. The second logger, dataLogger, is used by the data set to print data messages and so is also used to create the data accessors.

◆ nodeDataSrcValue()

const double * GmResultsDataSet::nodeDataSrcValue ( GmNodeAcResultsDataSrc * ds,
int line,
QString & err ) const
private

Returns the line'th result associated with the given node data src.

As with any GeMA accessor, the returned buffer is valid only until the next call to any xxxDataSrcValue() method. The dimension filter, if any, IS applied by this call. Returns NULL on errors. Should fill err for an anexpected error, such as an interpolation error, keeping it empty if the value can not be evaluated (is not defined) at the given line.

◆ strDataSrcValue()

QString GmResultsDataSet::strDataSrcValue ( int index,
int line,
QString & err ) const

Returns the line'th string result associated with the data src identified by its index.

Returns a NULL string (isNull() is true), filling err on errors. Returns a NULL string, keeping err empty, if the value can not be evaluated at the given line.


The documentation for this class was generated from the following files: