24 #ifndef _GEMA_RESULT_TRACKED_DATA_H_ 25 #define _GEMA_RESULT_TRACKED_DATA_H_ 41 GmResultTrackedData(
double val1,
double val2) { _numValue.append(val1); _numValue.append(val2);}
42 GmResultTrackedData(
double val1,
double val2,
double val3) { _numValue.append(val1); _numValue.append(val2); _numValue.append(val3); }
51 #define GM_RESULTTRACK_TYPE_BITS 3 54 #define GM_RESULTTRACK_TYPE_MASK (~0u >> GM_RESULTTRACK_TYPE_BITS) 90 static_assert((1 << GM_RESULTTRACK_TYPE_BITS) >= NUM_DATA_TYPES,
"Invalid size for GM_RESULTTRACK_TYPE_BITS");
100 _firstIpLine = _firstCoordLine = -1;
106 assert(type == NODE_DATA || type == GHOST_DATA || type == CELL_CENTROID_DATA);
108 assert(_firstIpLine == -1 && _firstCoordLine == -1);
110 _index.append(encode(type, index));
116 assert(type == CELL_IP_DATA);
117 assert(_firstCoordLine == -1);
119 if(_firstIpLine == -1)
120 _firstIpLine = _index.size();
121 _index.append(encode(type, index));
128 assert(type == CELL_POINT_DATA || type == POINT_DATA);
129 assert(coord.size() == _coordDim);
131 if(_firstCoordLine == -1)
132 _firstCoordLine = _index.size();
133 _index.append(encode(type, index));
134 for(
int i = 0; i < _coordDim; i++)
135 _coordinates.append(coord[i]);
148 int lineIndex(
int line)
const { assert(line >= 0 && line < numLines());
return decodeIndex(_index[line]); }
153 assert(_firstIpLine >= 0);
154 line -= _firstIpLine;
155 assert(line >= 0 && line < _ip.size());
162 assert(_firstCoordLine >= 0);
163 line -= _firstCoordLine;
164 assert(line >= 0 && line*_coordDim < _coordinates.size());
165 return &_coordinates[line*_coordDim];
172 int index = lineIndex(line) + 1;
175 else if(t == GHOST_DATA)
177 else if(t == CELL_IP_DATA)
178 return QString(
"Cell %1 @ ip %2").
arg(index).
arg(lineIp(line)+1);
179 else if(t == CELL_CENTROID_DATA)
180 return QString(
"Cell %1 @ centroid").
arg(index);
181 else if(t == CELL_POINT_DATA)
183 else if(t == POINT_DATA)
201 assert((index & GM_RESULTTRACK_TYPE_MASK) == index);
202 return ((
int)type << (32 - GM_RESULTTRACK_TYPE_BITS)) | index;
209 int decodeIndex(
int v)
const {
return v & GM_RESULTTRACK_TYPE_MASK; }
Data is a ghost node index (without the high bit set)
Definition: gmResultTrackedData.h:78
Data is a cell index.
Definition: gmResultTrackedData.h:79
QVector< double > _coordinates
A vector with size equal to the number of lines of type CELL_POINT_DATA or POINT_DATA multiplied by t...
Definition: gmResultTrackedData.h:193
IndexDataType lineType(int line) const
Returns the type of the given index line.
Definition: gmResultTrackedData.h:145
GmResultTrackedIndexData()
Default constructor (needed by QVector)
Definition: gmResultTrackedData.h:93
QVector< int > _index
A vector with entries for each result set line, with its type in the 3 most significant bits + the no...
Definition: gmResultTrackedData.h:191
QString lineStr(int line) const
Returns a string representation of the line data (with 1 based indices)
Definition: gmResultTrackedData.h:169
int numLines() const
Returns the number of lines in the index.
Definition: gmResultTrackedData.h:142
QVector< double > _numValue
A vector with numeric data. Remember that QVector is implicitly shared.
Definition: gmResultTrackedData.h:47
void addLine(IndexDataType type, int index, int ip)
Adds a data line for types requiring a cell index + ip index.
Definition: gmResultTrackedData.h:114
int coordDim() const
Returns the coordinate dimension.
Definition: gmResultTrackedData.h:139
Declaration of usefull configuration definitions for the Core library.
Data is a cell index + an ip index.
Definition: gmResultTrackedData.h:80
Data is a node index.
Definition: gmResultTrackedData.h:77
const double * lineCoord(int line) const
Returns the coordinates of the given index line.
Definition: gmResultTrackedData.h:160
The index data for a result rule, storing "evaluation point" data for node, cell or gauss based indic...
Definition: gmResultTrackedData.h:64
int _firstCoordLine
The line index of the first line of type CELL_POINT_DATA or POINT_DATA (-1 if no such line exists)
Definition: gmResultTrackedData.h:195
int _firstIpLine
The line index of the first line of type CELL_IP_DATA (-1 if no such line exists)
Definition: gmResultTrackedData.h:194
QVector< short > _ip
A vector with size equal to the number of lines of type CELL_IP_DATA.
Definition: gmResultTrackedData.h:192
void addLine(IndexDataType type, int index, const GmVector &coord)
Adds a data line for types requiring a coordinate (for point only data, index can be set to 0)
Definition: gmResultTrackedData.h:126
IndexDataType
Defines the type of an index line.
Definition: gmResultTrackedData.h:75
A tracked data value. Can be either a double vector or a string. Thanks to the implicitly shared natu...
Definition: gmResultTrackedData.h:37
IndexType
Defines over which kind of data this index refers to.
Definition: gmResultTrackedData.h:67
Gauss data (gauss attributes)
Definition: gmResultTrackedData.h:71
QString toString(const GmVector &v, int fieldWidth, char format, int precision, bool noBraces)
Serializes the vector to a string using the specified precision fields. Coordinates are surrounded by...
Definition: gmVectorUtils.cpp:48
void addLine(IndexDataType type, int index)
Adds a data line for types requiring only a node or cell index.
Definition: gmResultTrackedData.h:104
int _coordDim
The dimension coordinate (defining the size of a coordinate data)
Definition: gmResultTrackedData.h:190
Node data (state vars / node attributes)
Definition: gmResultTrackedData.h:69
IndexDataType decodeType(int v) const
Decodes the type info from a combined type+index value.
Definition: gmResultTrackedData.h:206
Declaration of the GmVector class.
int lineIp(int line) const
Returns the ip index of the given index line.
Definition: gmResultTrackedData.h:151
#define GMC_API_EXPORT
Macro for controling if the class is being exported (GEMA_CORE_LIB defined) or imported (GEMA_CORE_LI...
Definition: gmCoreConfig.h:35
An auxiliary vector WRAPPER that binds the vector to a CONST memory area with data already initialize...
Definition: gmVector.h:69
IndexType _indexType
The index type;.
Definition: gmResultTrackedData.h:189
Data is just a point coordinate.
Definition: gmResultTrackedData.h:82
QString _strValue
A string value. Filled only if _numValue.isEmpty()
Definition: gmResultTrackedData.h:46
int encode(IndexDataType type, int index) const
Encodes the type info in the high bits of an integre with the index on the lower ones.
Definition: gmResultTrackedData.h:199
GmResultTrackedIndexData(IndexType type, int coordDim)
Constructor. Line data should be filled by calls to addData.
Definition: gmResultTrackedData.h:96
int lineIndex(int line) const
Returns the node/cell index of the given index line.
Definition: gmResultTrackedData.h:148
arma::vec GmVector
The basic type for a GeMA vector object. Currently based on an Armadillo vector.
Definition: gmVector.h:34
QString arg(qlonglong a, int fieldWidth, int base, QChar fillChar) const const
int decodeIndex(int v) const
Decodes the index info from a combined type+index value.
Definition: gmResultTrackedData.h:209
Data is a cell index + a point coordinate.
Definition: gmResultTrackedData.h:81
Cell data (cell attributes / properties)
Definition: gmResultTrackedData.h:70