24#ifndef _GEMA_RESULTS_TRACKED_DATA_H_
25#define _GEMA_RESULTS_TRACKED_DATA_H_
42 GmResultsTrackedData(
const double* val,
int n) { _numValue.resize(n); memcpy(_numValue.data(), val, n*
sizeof(
double)); }
51#define GM_RESULTTRACK_TYPE_BITS 3
54#define GM_RESULTTRACK_TYPE_MASK (~0u >> GM_RESULTTRACK_TYPE_BITS)
100 _coordDim = coordDim;
101 _firstIpLine = _firstCoordLine = -1;
107 assert(type == NODE_DATA || type == GHOST_DATA || type == CELL_CENTROID_DATA);
109 assert(_firstIpLine == -1 && _firstCoordLine == -1);
111 _index.append(encode(type, index));
117 assert(type == CELL_IP_DATA || type == CELL_IP_AGGR_DATA);
118 assert(_firstCoordLine == -1);
120 if(_firstIpLine == -1)
121 _firstIpLine = _index.size();
122 _index.append(encode(type, index));
129 assert(type == CELL_POINT_DATA || type == POINT_DATA);
130 assert(coord.size() == _coordDim);
132 if(_firstCoordLine == -1)
133 _firstCoordLine = _index.size();
134 _index.append(encode(type, index));
135 for(
int i = 0; i < _coordDim; i++)
136 _coordinates.append(coord[i]);
149 int lineIndex(
int line)
const { assert(line >= 0 && line < numLines());
return decodeIndex(_index[line]); }
154 assert(_firstIpLine >= 0);
155 line -= _firstIpLine;
156 assert(line >= 0 && line < _ip.size());
163 assert(_firstCoordLine >= 0);
164 line -= _firstCoordLine;
165 assert(line >= 0 && line*_coordDim < _coordinates.size());
166 return &_coordinates[line*_coordDim];
173 int index = lineIndex(line) + 1;
176 else if(t == GHOST_DATA)
178 else if(t == CELL_IP_DATA)
179 return QString(
"Cell %1 @ ip %2").
arg(index).
arg(lineIp(line)+1);
180 else if(t == CELL_IP_AGGR_DATA)
182 else if(t == CELL_CENTROID_DATA)
183 return QString(
"Cell %1 @ centroid").
arg(index);
184 else if(t == CELL_POINT_DATA)
186 else if(t == POINT_DATA)
An auxiliary vector WRAPPER that binds the vector to a CONST memory area with data already initialize...
Definition gmVector.h:72
const char * aggregationRuleStr() const
Returns a string version for the configured aggregation rule.
Definition gmResultsEvalSet.h:133
GmEvalSetAggregationRule
Definition gmResultsEvalSet.h:52
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
Declaration of the GmResultsEvalSet class.
#define GM_RESULTTRACK_TYPE_MASK
Mask used for extracting/setting the type of an index entry in GmResultsTrackedIndexData.
Definition gmResultsTrackedData.h:54
#define GM_RESULTTRACK_TYPE_BITS
The number of bits needed to identify an index entry in GmResultsTrackedIndexData.
Definition gmResultsTrackedData.h:51
Declaration of the GmVector class.
arma::vec GmVector
The basic type for a GeMA vector object. Currently based on an Armadillo vector.
Definition gmVector.h:34
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
QString arg(qlonglong a, int fieldWidth, int base, QChar fillChar) const const
A tracked data value. Can be either a double vector or a string. Thanks to the implicitly shared natu...
Definition gmResultsTrackedData.h:39
QVector< double > _numValue
A vector with numeric data. Remember that QVector is implicitly shared.
Definition gmResultsTrackedData.h:47
QString _strValue
A string value. Filled only if _numValue.isEmpty()
Definition gmResultsTrackedData.h:46
The index data for a result rule, storing "evaluation point" data for node, cell or gauss based indic...
Definition gmResultsTrackedData.h:65
int lineIndex(int line) const
Returns the node/cell index of the given index line.
Definition gmResultsTrackedData.h:149
int _firstIpLine
The line index of the first line of type CELL_IP_DATA (-1 if no such line exists)
Definition gmResultsTrackedData.h:197
int numLines() const
Returns the number of lines in the index.
Definition gmResultsTrackedData.h:143
IndexDataType lineType(int line) const
Returns the type of the given index line.
Definition gmResultsTrackedData.h:146
IndexType
Defines over which kind of data this index refers to.
Definition gmResultsTrackedData.h:68
@ NODE_INDEX
Node data (state vars / node attributes)
Definition gmResultsTrackedData.h:69
@ CELL_INDEX
Cell data (cell attributes / properties)
Definition gmResultsTrackedData.h:70
@ GAUSS_INDEX
Gauss data (gauss attributes)
Definition gmResultsTrackedData.h:71
void addLine(IndexDataType type, int index)
Adds a data line for types requiring only a node or cell index.
Definition gmResultsTrackedData.h:105
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 gmResultsTrackedData.h:127
GmResultsTrackedIndexData()
Default constructor (needed by QVector)
Definition gmResultsTrackedData.h:94
const double * lineCoord(int line) const
Returns the coordinates of the given index line.
Definition gmResultsTrackedData.h:161
int _firstCoordLine
The line index of the first line of type CELL_POINT_DATA or POINT_DATA (-1 if no such line exists)
Definition gmResultsTrackedData.h:198
int coordDim() const
Returns the coordinate dimension.
Definition gmResultsTrackedData.h:140
IndexDataType decodeType(int v) const
Decodes the type info from a combined type+index value.
Definition gmResultsTrackedData.h:209
GmResultsTrackedIndexData(IndexType type, int coordDim)
Constructor. Line data should be filled by calls to addData.
Definition gmResultsTrackedData.h:97
IndexType _indexType
The index type;.
Definition gmResultsTrackedData.h:192
void addLine(IndexDataType type, int index, int ip)
Adds a data line for types requiring a cell index + ip index.
Definition gmResultsTrackedData.h:115
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 gmResultsTrackedData.h:196
QVector< short > _ip
A vector with size equal to the number of lines of type CELL_IP_DATA.
Definition gmResultsTrackedData.h:195
int decodeIndex(int v) const
Decodes the index info from a combined type+index value.
Definition gmResultsTrackedData.h:212
IndexDataType
Defines the type of an index line.
Definition gmResultsTrackedData.h:76
@ CELL_IP_DATA
Data is a cell index + an ip index.
Definition gmResultsTrackedData.h:80
@ POINT_DATA
Data is just a point coordinate.
Definition gmResultsTrackedData.h:83
@ GHOST_DATA
Data is a ghost node index (without the high bit set)
Definition gmResultsTrackedData.h:78
@ CELL_POINT_DATA
Data is a cell index + a point coordinate.
Definition gmResultsTrackedData.h:82
@ NODE_DATA
Data is a node index.
Definition gmResultsTrackedData.h:77
@ CELL_CENTROID_DATA
Data is a cell index.
Definition gmResultsTrackedData.h:79
@ CELL_IP_AGGR_DATA
Data is a cell index + the aggregation rule (stred as an ip)
Definition gmResultsTrackedData.h:81
int lineIp(int line) const
Returns the ip index of the given index line.
Definition gmResultsTrackedData.h:152
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 gmResultsTrackedData.h:202
QVector< int > _index
A vector with entries for each result set line, with its type in the 3 most significant bits + the no...
Definition gmResultsTrackedData.h:194
int _coordDim
The dimension coordinate (defining the size of a coordinate data)
Definition gmResultsTrackedData.h:193
QString lineStr(int line) const
Returns a string representation of the line data (with 1 based indices - stored data has already been...
Definition gmResultsTrackedData.h:170