cee::ug::DataPartVector Class Reference

Vector result values for a part. More...

Public Member Functions

 DataPartVector ()
 Constructs an empty object. More...
 
size_t count () const
 Returns the number of result values. More...
 
Vec3d value (size_t index) const
 Returns the result value for 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 values in the object. More...
 
void setValue (size_t index, const Vec3d &value)
 Sets the value at the given index. More...
 
void setValueUndefined (size_t index)
 Sets an undefined value at the given index. More...
 
void setValues (const std::vector< Vec3d > &values)
 Sets the vector values from a std::vector of Vec3ds. More...
 
void setValues (const double values[], size_t vectorCount)
 Sets the vector values from an array of doubles. More...
 
void setValuesFloat (const float values[], size_t vectorCount)
 Sets the vector values from an array of floats. More...
 
bool magnitudeRange (double *min, double *max) const
 Gets minimum and maximum vector magnitude. More...
 
- Public Member Functions inherited from cee::RefCountedObject
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...
 
Inheritance diagram for cee::ug::DataPartVector:
cee::RefCountedObject

Detailed Description

Vector result values for a part.

A vector result is a three dimensional value specifying direction and magnitude. DataPartVector contains an array of Vec3d's which can be set with single precision (float) or double precision (double). Internal storage is in double precision.

DataPartVector object contains the vector result values corresponding to a DataPart. This means that the number of result values in each vector 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 vector part as there are nodes in the part.

A DataPartVector is a child of a DataResultVector in the same way as a DataPart is a child of a DataGeometry. The DataResultVector 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.

Note
The class is reference counted and can be shared between multiple results. Remember that since this object is reference counted it should never be created on the stack.
Example

Example of how to add a node based vector result to a geometry consisting of only one triangle.

Create the DataResultVector object with a unique id and node based result mapping.

int vectorResultId = 1;

The result array must have one value for each node in the triangle. Resize the array before inserting the results.

vectorPart->resize(3);
vectorPart->setValue(0, cee::Vec3d(1.0, 0.0, 0.0));
vectorPart->setValue(1, cee::Vec3d(1.0, 1.0, 0.0));
vectorPart->setValue(2, cee::Vec3d(0.0, 2.0, 0.0));

Add the vector part to the result vector.

The number of result values in each vector part 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 contain three vector result values.

vectorResult->addPart(vectorPart.get());

Add the result vector to the state (DataState) for the corresponding geometry (DataGeometry) geo.

state->results(geo.get())->addVector(vectorResult.get());

See the complete source code at: UnstructGrid: A simple model with results

See also
DataPart
DataResultVector
Tutorials
UnstructGrid: A simple model with results

Constructor & Destructor Documentation

cee::ug::DataPartVector::DataPartVector ( )

Constructs an empty object.

Member Function Documentation

size_t cee::ug::DataPartVector::count ( ) const

Returns the number of result values.

bool cee::ug::DataPartVector::magnitudeRange ( double *  min,
double *  max 
) const

Gets minimum and maximum vector magnitude.

const double * cee::ug::DataPartVector::rawValuePointer ( ) const

Returns a raw pointer to the value array.

double * cee::ug::DataPartVector::rawValuePointer ( )

Returns a modifiable raw pointer to the value array.

void cee::ug::DataPartVector::resize ( size_t  valueCount)

Sets the number of values in the object.

The current values in the object will be kept up to the given count (if shrinking).

void cee::ug::DataPartVector::setValue ( size_t  index,
const Vec3d value 
)

Sets the value at the given index.

Warning
The specified index must be a valid index. Either call one of the setValues() methods or call resize() prior to calling this method.
See also
resize()
void cee::ug::DataPartVector::setValues ( const std::vector< Vec3d > &  values)

Sets the vector values from a std::vector of Vec3ds.

void cee::ug::DataPartVector::setValues ( const double  values[],
size_t  vectorCount 
)

Sets the vector values from an array of doubles.

The array must be at least vectorCount*3 items long, as vectorCount is the number of result values, not the number of floats in the array.

void cee::ug::DataPartVector::setValuesFloat ( const float  values[],
size_t  vectorCount 
)

Sets the vector values from an array of floats.

The array must be at least vectorCount*3 items long, as vectorCount is the number of result values, not the number of floats in the array.

Note that this is only provided for convenience, and that the nodes will internally be stored as doubles

void cee::ug::DataPartVector::setValueUndefined ( size_t  index)

Sets an undefined value at the given index.

Warning
The specified index must be a valid index. Either call one of the setValues() methods or call resize() prior to calling this method.
See also
resize()
Vec3d cee::ug::DataPartVector::value ( size_t  index) const

Returns the result value for the given index.