cee::ug::DataPart Class Reference

A part in the geometry. Consists of a collection of node coordinates and a collection element connectivities. More...

Public Member Functions

 DataPart (int id)
 Constructs an empty part with the given id. More...
 
int partId () const
 Returns the id of the part. More...
 
const DataNodesnodes () const
 Returns a pointer to the nodes objects of this part. More...
 
DataNodesnodes ()
 Returns a pointer to the nodes objects of this part. More...
 
void setNodes (DataNodes *nodes)
 Specifies the nodes for this part. More...
 
const DataElementselements () const
 Returns a pointer to the elements object of this part. More...
 
DataElementselements ()
 Returns a pointer to the elements objects of this part. More...
 
void setElements (DataElements *elements)
 Specifies the elements of this part. 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::DataPart:
cee::RefCountedObject

Detailed Description

A part in the geometry. Consists of a collection of node coordinates and a collection element connectivities.

A DataPart has an element object and a nodes object.

A DataGeometry contains a collection of DataPart objects.

Each part will have it's own part settings (visibility/color/result visibility/highlighting/...). Part settings are available through UnstructGridModel::partSettings() specifying the geometry index and id of the requested part.

Each part needs a unique id. This id is set in the constructor. Get the id of an existing part using id().

Example

Example of a simple part containing two triangles:

Create the DataNodes object and set the node coordinates for this part.

nodes->resize(5);
nodes->setNode(0, cee::Vec3d(0,1,0));
nodes->setNode(1, cee::Vec3d(0,0,0));
nodes->setNode(2, cee::Vec3d(1,0,0));
nodes->setNode(3, cee::Vec3d(2,0,0));
nodes->setNode(4, cee::Vec3d(2,1,0));

Create the DataElements object and specify the connectivities for this part. This part contains two triangles.

int c[] = {0, 1, 2, 2, 3, 4};
std::vector<unsigned int> eltNodes1(c, c+3); // First triangle
std::vector<unsigned int> eltNodes2(c+3, c+6); // Second triangle
elements->addElement(cee::ug::Element::TRIANGLES, eltNodes1);
elements->addElement(cee::ug::Element::TRIANGLES, eltNodes2);

Create the part object and set newly created nodes and elements objects to this part. Specify a unique id when creating the DataPart.

int partId = 1;
part->setNodes(nodes.get());
part->setElements(elements.get());

Add the part to the geometry. (geo is the DataGeometry object this part belongs to.)

geo->addPart(part.get());

See the complete source code at: UnstructGrid: Simple model with two triangles

See also
DataGeometry
DataElements
DataNodes
PartSettings
Tutorials
UnstructGrid: Simple model with two triangles
UnstructGrid: A simple model with results

Constructor & Destructor Documentation

cee::ug::DataPart::DataPart ( int  id)

Constructs an empty part with the given id.

Member Function Documentation

const DataElements * cee::ug::DataPart::elements ( ) const

Returns a pointer to the elements object of this part.

DataElements * cee::ug::DataPart::elements ( )

Returns a pointer to the elements objects of this part.

const DataNodes * cee::ug::DataPart::nodes ( ) const

Returns a pointer to the nodes objects of this part.

DataNodes * cee::ug::DataPart::nodes ( )

Returns a pointer to the nodes objects of this part.

int cee::ug::DataPart::partId ( ) const

Returns the id of the part.

void cee::ug::DataPart::setElements ( DataElements elements)

Specifies the elements of this part.

See DataElements for more information on supported element types.

Warning
The added object is reference counted and should never be created on the stack or deleted!
void cee::ug::DataPart::setNodes ( DataNodes nodes)

Specifies the nodes for this part.

Warning
The added object is reference counted and should never be created on the stack or deleted!