OpenCMISS-Zinc C++ API Documentation
Public Types | Public Member Functions | List of all members
OpenCMISS::Zinc::Element Class Reference

A single finite element from a mesh. More...

#include <element.hpp>

Public Types

enum  ChangeFlag {
  CHANGE_FLAG_NONE = CMZN_ELEMENT_CHANGE_FLAG_NONE, CHANGE_FLAG_ADD = CMZN_ELEMENT_CHANGE_FLAG_ADD, CHANGE_FLAG_REMOVE = CMZN_ELEMENT_CHANGE_FLAG_REMOVE, CHANGE_FLAG_IDENTIFIER = CMZN_ELEMENT_CHANGE_FLAG_IDENTIFIER,
  CHANGE_FLAG_DEFINITION = CMZN_ELEMENT_CHANGE_FLAG_DEFINITION, CHANGE_FLAG_FIELD = CMZN_ELEMENT_CHANGE_FLAG_FIELD
}
 
enum  FaceType {
  FACE_TYPE_INVALID = CMZN_ELEMENT_FACE_TYPE_INVALID, FACE_TYPE_ALL = CMZN_ELEMENT_FACE_TYPE_ALL, FACE_TYPE_ANY_FACE = CMZN_ELEMENT_FACE_TYPE_ANY_FACE, FACE_TYPE_NO_FACE = CMZN_ELEMENT_FACE_TYPE_NO_FACE,
  FACE_TYPE_XI1_0 = CMZN_ELEMENT_FACE_TYPE_XI1_0, FACE_TYPE_XI1_1 = CMZN_ELEMENT_FACE_TYPE_XI1_1, FACE_TYPE_XI2_0 = CMZN_ELEMENT_FACE_TYPE_XI2_0, FACE_TYPE_XI2_1 = CMZN_ELEMENT_FACE_TYPE_XI2_1,
  FACE_TYPE_XI3_0 = CMZN_ELEMENT_FACE_TYPE_XI3_0, FACE_TYPE_XI3_1 = CMZN_ELEMENT_FACE_TYPE_XI3_1
}
 
enum  ShapeType {
  SHAPE_TYPE_INVALID = CMZN_ELEMENT_SHAPE_TYPE_INVALID, SHAPE_TYPE_LINE = CMZN_ELEMENT_SHAPE_TYPE_LINE, SHAPE_TYPE_SQUARE = CMZN_ELEMENT_SHAPE_TYPE_SQUARE, SHAPE_TYPE_TRIANGLE = CMZN_ELEMENT_SHAPE_TYPE_TRIANGLE,
  SHAPE_TYPE_CUBE = CMZN_ELEMENT_SHAPE_TYPE_CUBE, SHAPE_TYPE_TETRAHEDRON = CMZN_ELEMENT_SHAPE_TYPE_TETRAHEDRON, SHAPE_TYPE_WEDGE12 = CMZN_ELEMENT_SHAPE_TYPE_WEDGE12, SHAPE_TYPE_WEDGE13 = CMZN_ELEMENT_SHAPE_TYPE_WEDGE13,
  SHAPE_TYPE_WEDGE23 = CMZN_ELEMENT_SHAPE_TYPE_WEDGE23
}
 
enum  PointSamplingMode {
  POINT_SAMPLING_MODE_INVALID = CMZN_ELEMENT_POINT_SAMPLING_MODE_INVALID, POINT_SAMPLING_MODE_CELL_CENTRES = CMZN_ELEMENT_POINT_SAMPLING_MODE_CELL_CENTRES, POINT_SAMPLING_MODE_CELL_CORNERS = CMZN_ELEMENT_POINT_SAMPLING_MODE_CELL_CORNERS, POINT_SAMPLING_MODE_CELL_POISSON = CMZN_ELEMENT_POINT_SAMPLING_MODE_CELL_POISSON,
  POINT_SAMPLING_MODE_SET_LOCATION = CMZN_ELEMENT_POINT_SAMPLING_MODE_SET_LOCATION, POINT_SAMPLING_MODE_GAUSSIAN_QUADRATURE = CMZN_ELEMENT_POINT_SAMPLING_MODE_GAUSSIAN_QUADRATURE
}
 
enum  QuadratureRule { QUADRATURE_RULE_INVALID = CMZN_ELEMENT_QUADRATURE_RULE_INVALID, QUADRATURE_RULE_GAUSSIAN = CMZN_ELEMENT_QUADRATURE_RULE_GAUSSIAN, QUADRATURE_RULE_MIDPOINT = CMZN_ELEMENT_QUADRATURE_RULE_MIDPOINT }
 
typedef int ChangeFlags
 

Public Member Functions

 Element (cmzn_element_id element_id)
 
 Element (const Element &element)
 
Elementoperator= (const Element &element)
 
bool isValid () const
 
cmzn_element_id getId () const
 
int getDimension ()
 
Elementfieldtemplate getElementfieldtemplate (const Field &field, int componentNumber) const
 
int getIdentifier ()
 
int setIdentifier (int identifier)
 
Mesh getMesh () const
 
Node getNode (const Elementfieldtemplate &eft, int localNodeIndex)
 
int setNode (const Elementfieldtemplate &eft, int localNodeIndex, const Node &node)
 
int setNodesByIdentifier (const Elementfieldtemplate &eft, int identifiersCount, const int *identifiersIn)
 
int getScaleFactor (const Elementfieldtemplate &eft, int scaleFactorIndex, double *valueOut)
 
int setScaleFactor (const Elementfieldtemplate &eft, int scaleFactorIndex, double value)
 
int getScaleFactors (const Elementfieldtemplate &eft, int valuesCount, double *valuesOut)
 
int setScaleFactors (const Elementfieldtemplate &eft, int valuesCount, const double *valuesIn)
 
enum ShapeType getShapeType ()
 
int merge (const Elementtemplate &elementTemplate)
 

Detailed Description

A single finite element from a mesh.

A single finite element from a mesh. Represents a local coordinate chart of prescribed shape/bounds, over which fields can be defined.

Member Typedef Documentation

Type for passing logical OR of ChangeFlag

Member Enumeration Documentation

Bit flags summarising changes to an element or elements in a mesh.

Enumerator
CHANGE_FLAG_NONE 

element(s) not changed

CHANGE_FLAG_ADD 

element(s) added

CHANGE_FLAG_REMOVE 

element(s) removed

CHANGE_FLAG_IDENTIFIER 

element(s') identifier changed

CHANGE_FLAG_DEFINITION 

element(s') definition other than identifier changed e.g. shape

CHANGE_FLAG_FIELD 

change to field values mapped to element(s)

An enumeration for selecting the faces of elements.

Enumerator
FACE_TYPE_INVALID 

invalid element face type

FACE_TYPE_ALL 

match all elements whether faces of parent elements or not

FACE_TYPE_ANY_FACE 

element on any face of a higher dimension element

FACE_TYPE_NO_FACE 

not a face of a higher dimension element; top-level elements only

FACE_TYPE_XI1_0 

element on face where top-level xi1 = 0

FACE_TYPE_XI1_1 

element on face where top-level xi1 = 1

FACE_TYPE_XI2_0 

element on face where top-level xi2 = 0

FACE_TYPE_XI2_1 

element on face where top-level xi2 = 1

FACE_TYPE_XI3_0 

element on face where top-level xi3 = 0

FACE_TYPE_XI3_1 

element on face where top-level xi3 = 1

Mode controlling how points are sampled from elements.

Enumerator
POINT_SAMPLING_MODE_INVALID 

Unspecified point sampling mode

POINT_SAMPLING_MODE_CELL_CENTRES 

Sample points at centres of element or tessellation cells

POINT_SAMPLING_MODE_CELL_CORNERS 

Sample points at corners of element or tessellation cells

POINT_SAMPLING_MODE_CELL_POISSON 

Sample points randomly within each tessellation cell according to a Poisson distribution with expected number given by: sample density field * cell volume, area or length, depending on dimension. The sample density field should be evaluated at the cell centre.

POINT_SAMPLING_MODE_SET_LOCATION 

One point at a specified location in the element chart.

POINT_SAMPLING_MODE_GAUSSIAN_QUADRATURE 

Sample at Gaussian quadrature points for the element. Currently limited to a maximum of 4 points in each element direction. Triangles and tetrahedra have symmetric point arrangements for an equal polynomial degree in each axis.

Quadrature rule for numerically integrating over elements.

Enumerator
QUADRATURE_RULE_INVALID 

Unspecified or invalid quarature rule

QUADRATURE_RULE_GAUSSIAN 

Gaussian quadrature. Gives optimal/exact integration of polynomials of degree up to 2n - 1, when n is the number of Gauss points chosen. Currently limited to a maximum of 4 points in each element direction. Triangles and tetrahedra have symmetric point arrangements for an equal polynomial degree in each axis.

QUADRATURE_RULE_MIDPOINT 

Sample at mid-points of equal-sized cells in element local xi chart, with equal weights. Also called the rectangle rule.

Common element shape enumeration.

Enumerator
SHAPE_TYPE_INVALID 

unspecified shape of known dimension

SHAPE_TYPE_LINE 

1-D: 0 <= xi1 <= 1

SHAPE_TYPE_SQUARE 

2-D: 0 <= xi1,xi2 <= 1

SHAPE_TYPE_TRIANGLE 

3-D: 0 <= xi1,xi2; xi1+xi2 <= 1

SHAPE_TYPE_CUBE 

3-D: 0 <= xi1,xi2,xi3 <= 1

SHAPE_TYPE_TETRAHEDRON 

3-D: 0 <= xi1,xi2,xi3; xi1+xi2+xi3 <= 1

SHAPE_TYPE_WEDGE12 

3-D: 0 <= xi1,xi2; xi1+xi2 <= 1; 0 <= xi3 <= 1

SHAPE_TYPE_WEDGE13 

3-D: 0 <= xi1,xi3; xi1+xi3 <= 1; 0 <= xi2 <= 1

SHAPE_TYPE_WEDGE23 

3-D: 0 <= xi2,xi3; xi2+xi3 <= 1; 0 <= xi1 <= 1

Member Function Documentation

int OpenCMISS::Zinc::Element::getDimension ( )
inline

Returns the number of dimensions of the element's chart.

Returns
The dimension.
Elementfieldtemplate OpenCMISS::Zinc::Element::getElementfieldtemplate ( const Field field,
int  componentNumber 
) const
inline

Gets the element field template defining field component on element, or all field components for special homogeneous case with component -1.

Parameters
fieldThe field to query. May be finite element type only.
componentNumberThe component to query from 1 to number of components, or -1 to request element field template used by all components which fails if not homogeous i.e. if components have different templates.
Returns
Handle to element field template, or NULL/invalid handle if field not defined or on failure including special component -1 is used and field is not homogeneous over components in element.
cmzn_element_id OpenCMISS::Zinc::Element::getId ( ) const
inline

Return the C handle of the Element object.

Returns
C handle of Element if this objects is valid, 0 otherwise.
int OpenCMISS::Zinc::Element::getIdentifier ( )
inline

Returns the non-negative integer uniquely identifying the element in its mesh.

Returns
The non-negative integer identifier of the element, or a negative value if element is invalid.
Mesh OpenCMISS::Zinc::Element::getMesh ( ) const
inline

Get the mesh which owns this element.

Returns
Handle to the owning mesh, or NULL/invalid handle on failure.
Node OpenCMISS::Zinc::Element::getNode ( const Elementfieldtemplate eft,
int  localNodeIndex 
)
inline

Gets a local node used by element field template in element.

Parameters
&eftThe element field template to get the node for.
localNodeIndexThe local index of the node to get, starting at 1.
Returns
Handle to valid node, or NULL/invalid handle on failure.
int OpenCMISS::Zinc::Element::getScaleFactor ( const Elementfieldtemplate eft,
int  scaleFactorIndex,
double *  valueOut 
)
inline

Get a scale factor for the element field template in element.

Parameters
&eftThe element field template to get the scale factor for.
scaleFactorIndexThe local index of the scale factor to get, starting at 1.
valueOutAddress of variable/memory which on success is set to the scale factor value.
Returns
Result OK on success, any other value on failure.
int OpenCMISS::Zinc::Element::getScaleFactors ( const Elementfieldtemplate eft,
int  valuesCount,
double *  valuesOut 
)
inline

Gets all scale factors used by the given element field template in this element.

Parameters
&eftThe element field template to get scale factors for.
valuesCountThe size of the values array. Must equal the number of scale factors in the element field template.
valuesOutArray to fill with the scale factors.
Returns
Result OK on success, any other value on failure.
enum ShapeType OpenCMISS::Zinc::Element::getShapeType ( )
inline

Gets the shape type of the element. Note that legacy meshes may return an unknown shape type for certain custom element shapes e.g. polygon shapes. It is intended that future revisions of the API will offer more detailed shape query and modification functions.

Returns
The element's shape type.
bool OpenCMISS::Zinc::Element::isValid ( ) const
inline

Check if this is a valid Element object.

Returns
Status True if object is valid, false otherwise.
int OpenCMISS::Zinc::Element::merge ( const Elementtemplate elementTemplate)
inline

Modifies the element to define or undefine fields as described in the element template, and possibly change its shape.

Must be created for this mesh and valid. If the element template has a valid shape, it will be set for the element; if it has an invalid shape, the element will keep its current shape.

Returns
Result OK on success, any other value on failure.
int OpenCMISS::Zinc::Element::setIdentifier ( int  identifier)
inline

Set an integer uniquely identifying the element in its mesh.

Parameters
identifierunique identifier to be set for the element
Returns
OpenCMISS::Zinc::OK if set the identifier successfully, any other value on fail.
int OpenCMISS::Zinc::Element::setNode ( const Elementfieldtemplate eft,
int  localNodeIndex,
const Node node 
)
inline

Sets a local node used by element field template in element. Note if any node-type scale factors are indexed by a node being set or changed, new scale factors will be discovered or created for it, and any old scale factors will be released. Note that any existing scale factors discovered for a node keep their current values, and newly created scale factors values are assigned the current value for the scale factor on the former node.

Parameters
&eftThe element field template to set the node for.
localNodeIndexThe local index of the node to set, starting at 1.
&nodeThe global node to set. Note once a local node index has a valid node, it is not permitted to remove it.
Returns
Result OK on success, any other value on failure.
int OpenCMISS::Zinc::Element::setNodesByIdentifier ( const Elementfieldtemplate eft,
int  identifiersCount,
const int *  identifiersIn 
)
inline

Sets all the local nodes used by the given element field template in this element by their identifiers. The nodes are found by identifier in the nodeset for the elements' owning mesh. It is an error if any node with a valid identifier is not found. Note it is illegal to clear a node that has already been set. Also, if any node-type scale factors are indexed by a node being set or changed, new scale factors will be discovered or created for it, and any old scale factors will be released. Note that any existing scale factors discovered for a node keep their current values, and newly created scale factors values are assigned the current value for the scale factor on the former node.

Parameters
&eftThe element field template to set nodes for.
identifiersCountThe size of the identifiers array. Must equal the number of nodes in the element field template.
identifiersInThe array of node identifiers to set.
Returns
Result OK on success, any other value on failure.
int OpenCMISS::Zinc::Element::setScaleFactor ( const Elementfieldtemplate eft,
int  scaleFactorIndex,
double  value 
)
inline

Set a scale factor for the element field template in element.

Parameters
&eftThe element field template to set the scale factor for.
scaleFactorIndexThe local index of the scale factor to set, starting at 1.
valueThe scale factor value to set.
Returns
Result OK on success, any other value on failure.
int OpenCMISS::Zinc::Element::setScaleFactors ( const Elementfieldtemplate eft,
int  valuesCount,
const double *  valuesIn 
)
inline

Sets all scale factors used by the given element field template in this element.

Parameters
&eftThe element field template to set scale factors for.
valuesCountThe size of the values array. Must equal the number of scale factors in the element field template.
valuesInThe array of scale factors to set.
Returns
Result OK on success, any other value on failure.

The documentation for this class was generated from the following files: