GemaCoreLib
The GeMA Core library
Loading...
Searching...
No Matches
gmResultsDataSet.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
25#ifndef _GEMA_RESULTS_DATASET_H_
26#define _GEMA_RESULTS_DATASET_H_
27
28#include "gmCoreConfig.h"
29
31#include "gmValueInfo.h"
32
33#include <QObject>
34#include <QString>
35#include <QVariant>
36#include <QVector>
37
38class GmMesh;
39class GmCellMesh;
40class GmElementMesh;
42class GmValueInfo;
45class GmLogCategory;
47class LuaTable;
48
54
55
58{
59 Q_OBJECT
60
61public:
62
63 virtual ~GmResultsDataSet();
64
66 QString id() const { return _id; }
67
69 int monitorTrackId() const { return _monitorTrackId; }
70
72 void setMonitorTrackId(int id) { _monitorTrackId = id; }
73
75 QString description() const { return _description; }
76
78 GmMesh* mesh() const { return _mesh; }
79
81 GmValueAccessor* meshCoordAc() const { return _coordAc; }
82
83 int numDataSrcs(int type = -1) const;
84
85 int dataSrcIndex(GmResultsDataSrcType type, int i) const;
86
87 const GmResultsDataSrcInfo* dataSrcInfo(int index) const;
88
89 int dataSrcSize (int index) const;
90 const double* dataSrcValue (int index, int line, QString& err) const;
91 QString strDataSrcValue(int index, int line, QString& err) const;
92 QString explain (int index, int line) const;
93
94 void setDataSrcMonitorTrackId(int index, int id);
95
96 GmResultsEvalSet* evalSet(GmResultsDataSrcType type) const;
97
98 void print(const GmLogCategory& logger, GmLogLevel level) const;
99
100 static GmResultsDataSet* loadFromTable(LuaTable& tab, GmSimulationData* data, const GmLogCategory& parseLogger,
101 const GmLogCategory& dataLogger);
102
103 static GmNodeAcResultsDataSrc* createNodeDataSrc (const GmMesh* mesh, const QVariant& v, bool interp,
104 const GmLogCategory& dataLogger, bool* unknown, QString& srcId, QString& err);
105
106 static GmCellAcResultsDataSrc* createCellDataSrc (const GmCellMesh* mesh, const QVariant& v, bool interp,
107 const GmLogCategory& dataLogger, bool* unknown, QString& srcId, QString& err);
108
109 static GmGaussAcResultsDataSrc* createGaussDataSrc(const GmElementMesh* mesh, const QVariant& v, bool interp,
110 const GmLogCategory& dataLogger, bool* unknown, QString& srcId, QString& err);
111
112protected:
113 GmResultsDataSet(QString id, QString description, GmAttributeResultsManager* attrManager);
114
115private slots:
116 void dataSrcInfoChanged(int size);
117
118private:
120
121 template <class T, class AcF>
122 static T* createDataSrc(const QVariant& v, const AcF& acGet, bool interp, bool* unknown, QString& srcId, QString& err);
123
124 bool addNodeDataSrc (const GmMesh* mesh, const QVariant& v, const GmLogCategory& dataLogger, QString& err);
125 bool addCellDataSrc (const GmCellMesh* mesh, const QVariant& v, const GmLogCategory& dataLogger, QString& err);
126 bool addGaussDataSrc(const GmElementMesh* mesh, const QVariant& v, const GmLogCategory& dataLogger, QString& err);
127
128 static bool parseAndCheckDataSrcFields(GmAcResultsDataSrcBase* ds, const GmValueInfo* info, const QVariant& v, QString& err);
129
130 bool checkForMultipleAffectedNodes(GmAffectedNodes* affNodes) const;
131 bool checkForMultipleGaussRuleSets(int* ruleSet) const;
132
133 bool createNodeInterpolators (bool* needNatural, const GmLogCategory& logger, QString& err);
134 bool createGaussInterpolators(bool* needNatural, const GmLogCategory& logger, QString& err);
135
136 bool allocResultBuffers();
137
138 const double* nodeDataSrcValue (GmNodeAcResultsDataSrc* ds, int line, QString& err) const;
139 const double* cellDataSrcValue (GmCellAcResultsDataSrc* ds, int line, QString& err) const;
140 const double* gaussDataSrcValue(GmGaussAcResultsDataSrc* ds, int line, QString& err) const;
141
149
150 QVector<GmResultsDataSrcInfo*> _dataSrcs; // The set of data srcs. Entries are ordered by type following GmResultDataSrcType
151
157 int _dataSrcPos[GM_RR_DS_NUMTYPES+1];
158
162
164 mutable double* _transformBuffer;
166};
167
168
169
170#endif
171
A class storing basic information about a result data to be exported (monitored / saved),...
Definition gmAcResultsDataSrc.h:42
A class implementing the GmResultsDataSrcInfo interface, storing the metadata and id for a result dat...
Definition gmAttributeResultsDataSrc.h:41
A class used to host the metadata and the values for all attributes added to the results data....
Definition gmAttributeResultsManager.h:60
A GmAcResultsDataSrc class holding a cell value accessor.
Definition gmAcResultsDataSrc.h:295
Base interface class for CellMesh type plugins.
Definition gmCellMesh.h:40
Base interface for providing discontinuity geometry information for spatial indices.
Definition gmDiscontinuitySet.h:59
Base interface for FEM (finite element) meshes.
Definition gmElementMesh.h:42
A GmAcResultsDataSrc class holding a Gauss value accessor.
Definition gmAcResultsDataSrc.h:318
Class representing a category with multiple logging levels.
Definition gmLog.h:58
Base interface class for Mesh type plugins.
Definition gmMesh.h:48
A GmAcResultsDataSrc class holding a node value accessor.
Definition gmAcResultsDataSrc.h:272
A set storing what should be exported (saved / printed / monitored) by the result rule classes.
Definition gmResultsDataSet.h:58
int _transformBufferSize
The size of _transformBuffer.
Definition gmResultsDataSet.h:165
int _monitorTrackId
The monitor track id if this data set is associated with a monitor rule, -1 otherwise.
Definition gmResultsDataSet.h:143
GmResultsEvalSet * _gaussEvalSet
The evaluation set for gauss data sources.
Definition gmResultsDataSet.h:161
GmDiscontinuitySet * _discSet
The discontinuitySet that this data set uses for interpolation.
Definition gmResultsDataSet.h:147
double * _transformBuffer
The buffer used to store the result from a "non ac" data src or user transformation function....
Definition gmResultsDataSet.h:164
GmValueAccessor * _coordAc
The accessor used for accessing node coordinates.
Definition gmResultsDataSet.h:148
GmMesh * _mesh
The mesh that this data set is tied to (can be NULL for attribute rules)
Definition gmResultsDataSet.h:146
QString id() const
Returns the data set name.
Definition gmResultsDataSet.h:66
GmResultsEvalSet * _cellEvalSet
The evaluation set for cell data sources.
Definition gmResultsDataSet.h:160
QString _id
The data set id (name)
Definition gmResultsDataSet.h:142
QString description() const
Returns the data set description.
Definition gmResultsDataSet.h:75
GmAttributeResultsManager * _attrm
The attribute manager object used to provide values for result attributes.
Definition gmResultsDataSet.h:145
int monitorTrackId() const
Returns the data set monitor track id if this data set is associated with a monitor rule,...
Definition gmResultsDataSet.h:69
void setMonitorTrackId(int id)
Updates the data set's monitor track id.
Definition gmResultsDataSet.h:72
QString _description
A description of the data set.
Definition gmResultsDataSet.h:144
GmResultsEvalSet * _nodeEvalSet
The evaluation set for node data sources.
Definition gmResultsDataSet.h:159
GmMesh * mesh() const
Returns the mesh that contains the associated data. Can be NULL.
Definition gmResultsDataSet.h:78
double * _resultBuffer
The buffer used by xxxDataSrcValue() functions for returning interpolated data. Its size is the bigge...
Definition gmResultsDataSet.h:163
GmValueAccessor * meshCoordAc() const
Returns the node coordinate accessor associated with the data mesh or NULL for attribute only data se...
Definition gmResultsDataSet.h:81
A basic interface with the metadata common to all results data src types. This is the information tha...
Definition gmResultsDataSrcInfo.h:50
A class storing the evaluation points for a set of rules.
Definition gmResultsEvalSet.h:47
Auxiliar class used to store the complete set of simulation data.
Definition gmSimulationData.h:55
Interface class for accessing and setting values from an "indexable" collection of values.
Definition gmValueAccessor.h:60
Auxiliar class used to store the definition of a value. It can be used to store informations about st...
Definition gmValueInfo.h:132
Declaration of useful configuration definitions for the Core library.
#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
GmLogLevel
Available log levels list.
Definition gmLog.h:36
Declaration of the GmResultsDataSrcInfo interface.
GmResultsDataSrcType
The types of data sources stored by a rule.
Definition gmResultsDataSrcInfo.h:33
@ GM_RR_DS_NUMTYPES
The number of data src types above.
Definition gmResultsDataSrcInfo.h:42
Declaration of the GmValueInfo class.
GmAffectedNodes
Affected node types for node based values (GM_NODE_COORDINATES, GM_NODE_ATTRIBUTE or GM_NODE_STATEVAR...
Definition gmValueInfo.h:97
Q_DISABLE_COPY(Class)