Scalar result values for a part. More...
Public Member Functions | |
DataPartScalar () | |
Constructs an empty object. More... | |
size_t | count () const |
Returns the number of result values for this data part scalar. More... | |
double | value (size_t index) const |
Returns the result value at the given index. More... | |
const double * | rawValuePointer () const |
Returns a raw pointer to the value array. More... | |
double * | rawValuePointer () |
Returns a modifiable raw pointer to the value array. More... | |
void | resize (size_t count) |
Sets the number of scalar values in the data part. More... | |
void | setValue (size_t index, double value) |
Sets the scalar value for the given index. More... | |
void | setValues (const std::vector< double > &values) |
Sets the scalar values from a std::vector of doubles. More... | |
void | setValues (const double values[], size_t count) |
Sets the scalar values from an array of doubles. More... | |
void | setValuesFloat (const float values[], size_t count) |
Sets the scalar values from an array of floats. More... | |
bool | valueRange (double *min, double *max) const |
Gets minimum and maximum scalar values. More... | |
bool | hasNodeAverageValues () const |
Returns true if the part has node averaged results. More... | |
double | nodeAverageValue (size_t nodeIndex) const |
Returns the node averaged result value at the given node index. More... | |
void | updateMinMax () |
Recomputes the minimum and maximum values. More... | |
![]() | |
void | addRef () const |
Increments the reference count for this object. More... | |
void | release () const |
Decrements the reference count for this object. More... | |
int | refCount () const |
Returns the reference count for this object. More... | |
void | setRefCountZero () const |
Sets the ref count to zero, but DOES NOT delete the object. More... | |
Scalar result values for a part.
A scalar result value is a numerical value. DataPartScalar contains an array of scalar values which can be set with single precision (float) or double precision (double). Internal storage is in double precision.
A DataPartScalar object contains the scalar result values corresponding to a DataPart. This means that the number of result values in each scalar part must match the number of nodes/elements in the corresponding part (depending on mapping type). For Instance, a node mapped result will need the same number of result values in the scalar part as there are nodes in the part.
DataPartScalar is a child of a DataResultScalar in the same way as a DataPart is a child of a DataGeometry. The DataResultScalar must have the same number of child parts as the DataGeometry.
Values are inserted using setValue(), setValues() or setValuesFloat(). Get the number of values with count() and query a specific value using value() with an index.
Example of how to add a node based scalar result to a geometry consisting of only one triangle.
Create the DataResultScalar object with a unique id and node based result mapping.
The result array must have one value for each node in the triangle. Resize the array before inserting the results.
Add the scalar part to the result scalar.
The number of result values in each part scalar must match the number of nodes/elements in the part (depending on mapping type). Here the result is a single triangle with node based mapping, so the scalar part must contains three values.
Add the result scalar to the state (DataState) for the corresponding geometry (DataGeometry) geo
See the complete source code at: UnstructGrid: A simple model with results
cee::ug::DataPartScalar::DataPartScalar | ( | ) |
Constructs an empty object.
size_t cee::ug::DataPartScalar::count | ( | ) | const |
Returns the number of result values for this data part scalar.
bool cee::ug::DataPartScalar::hasNodeAverageValues | ( | ) | const |
Returns true if the part has node averaged results.
double cee::ug::DataPartScalar::nodeAverageValue | ( | size_t | nodeIndex | ) | const |
Returns the node averaged result value at the given node index.
Returns cee::UNDEFINED_DOUBLE if no node averaged values exists
const double * cee::ug::DataPartScalar::rawValuePointer | ( | ) | const |
Returns a raw pointer to the value array.
double * cee::ug::DataPartScalar::rawValuePointer | ( | ) |
Returns a modifiable raw pointer to the value array.
void cee::ug::DataPartScalar::resize | ( | size_t | count | ) |
Sets the number of scalar values in the data part.
The current values in the object will be kept up to the given count (if shrinking).
void cee::ug::DataPartScalar::setValue | ( | size_t | index, |
double | value | ||
) |
Sets the scalar value for the given index.
void cee::ug::DataPartScalar::setValues | ( | const std::vector< double > & | values | ) |
Sets the scalar values from a std::vector of doubles.
void cee::ug::DataPartScalar::setValues | ( | const double | values[], |
size_t | count | ||
) |
Sets the scalar values from an array of doubles.
void cee::ug::DataPartScalar::setValuesFloat | ( | const float | values[], |
size_t | count | ||
) |
Sets the scalar values from an array of floats.
Note that this function is only provided for convenience, and that the values will be stored as double internally
void cee::ug::DataPartScalar::updateMinMax | ( | ) |
Recomputes the minimum and maximum values.
double cee::ug::DataPartScalar::value | ( | size_t | index | ) | const |
Returns the result value at the given index.
The interpretation of the index depends on the result mapping in the parent DataResultScalar
bool cee::ug::DataPartScalar::valueRange | ( | double * | min, |
double * | max | ||
) | const |
Gets minimum and maximum scalar values.