A query object for extracting data and information from data elements. More...
Public Member Functions | |
ElementsQuery (const DataElements *elements, const DataNodes *nodes) | |
Creates a query object from data elements and data nodes. More... | |
ElementsQuery (const DataElements *elements, const DataPartDisplacement *displacements) | |
Creates a query object from data elements and displaced data nodes. More... | |
ElementsQuery (const UnstructGridModel *model, size_t frameIndex, size_t geometryIndex, int partId) | |
Creates a query object from model, frame index and part. More... | |
void | setDisplacements (const DataPartDisplacement *displacements) |
Sets the displacements to use (replacing the nodes if any) More... | |
Vec3d | nodeCoordinate (size_t nodeIndex) |
Returns the coordinate of the given node, taking any displacement and mode shape animation into account. More... | |
Vec3d | elementCentroid (size_t elementIndex) const |
Returns the coordinates of the element centroid for the specified element index. More... | |
std::vector< Vec3d > | elementCoordinates (size_t elementIndex) const |
Returns an array of coordinates for all nodes in the element. More... | |
std::vector< unsigned int > | elementVertices (size_t elementIndex) const |
Returns an array of vertices for a given element index. More... | |
bool | elementContainingCoordinate (const Vec3d &coordinate, size_t *elementIndex) |
Returns true if the given coordinate is within one of the elements. More... | |
bool | elementsContainingEdge (size_t nodeIndex1, size_t nodeIndex2, std::vector< size_t > *elementIndices) |
Returns true if at least one of the elements contains the given edge. More... | |
bool | elementsContainingNode (size_t nodeIndex1, std::vector< size_t > *elementIndices) |
Returns true if at least one of the elements contains the given node. More... | |
std::vector< unsigned int > | elementEdges (size_t elementIndex) |
Returns the edges of the specified element. More... | |
double | elementVolume (size_t elementIndex) const |
Returns the volume of an element. More... | |
std::vector< double > | elementVolumes () const |
Returns an array containing the volumes of all elements. More... | |
void | allElementCentroids (std::vector< double > *values) const |
Builds an array of coordinates of element centroids for all elements. More... | |
Vec3d | elementSurfaceCentroid (size_t elementIndex, size_t localSurfaceIndex) const |
Returns the coordinates of the element surface centroid for the specified element index and element surface index. More... | |
std::vector< Vec3d > | elementSurfaceCoordinates (size_t elementIndex, size_t localSurfaceIndex) const |
Returns an array of coordinates for an element surface specified by a element index and a local surface index. More... | |
std::vector< unsigned int > | elementSurfaceVertices (size_t elementIndex, size_t localSurfaceIndex) const |
Returns an array of vertices for an element surface specified by a element index and a local surface index. More... | |
std::vector< Vec3d > | elementSurfaceTriangles (size_t elementIndex, size_t localSurfaceIndex) const |
Returns an array with 3 Vec3d's for each triangle of the given element surface. More... | |
size_t | nodeIndexFromElementNodeIndex (size_t elementNodeIdx) const |
Returns the node index for the given element node index. More... | |
size_t | elementNodeFromElementAndNodeIndex (size_t elementIndex, size_t nodeIndex) const |
Returns the element node index of the given element index and (global for the part) node index. More... | |
size_t | elementLocalNodeIndexFromElementAndNodeIndex (size_t elementIndex, size_t nodeIndex) const |
Returns the local element index (0..NumElementNodes - 1) of the node with the given (global) node index. More... | |
size_t | elementStartIndex (size_t elementIndex) const |
Returns the index in the element nodes array for the start of this element. More... | |
void | elementAndSurfaceIndexFromElementSurfaceIndex (size_t elementSurfaceIndex, size_t *elementIndex, size_t *localSurfaceIndex) const |
Gets the element index and local surface index from a given element surface index. More... | |
size_t | elementSurfaceIndex (size_t elementIndex, size_t localSurfaceIndex) const |
Returns the element surface index for the element surface specified by elementIndex and localsurfaceIndex. More... | |
bool | elementNeighbor (size_t elementIndex, size_t localSurfaceIndex, size_t *neighborElementIndex=NULL, size_t *neighborLocalSurfaceIndex=NULL) const |
Finds neighbor element to given element and local element surface. More... | |
double | mapScalarResult (size_t elementIndex, const Vec3d &coordinate, const DataPartScalar *scalarPart, ResultMapping scalarResultMappingType) const |
Gets a mapped scalar result value for the given coordinates in an element. More... | |
void | mapScalarResults (const std::vector< Vec3d > &coords, const DataPartScalar *scalarPart, ResultMapping scalarResultMappingType, std::vector< double > *mappedResultValues) |
Gets mapped scalar result values for coordinates specified in coords. More... | |
A query object for extracting data and information from data elements.
Create the query object by passing along the elements and nodes as parameters. Then query for, for instance, element centroid coordinates, element surface indices, neighbors and such.
cee::ug::ElementsQuery::ElementsQuery | ( | const DataElements * | elements, |
const DataNodes * | nodes | ||
) |
Creates a query object from data elements and data nodes.
cee::ug::ElementsQuery::ElementsQuery | ( | const DataElements * | elements, |
const DataPartDisplacement * | displacements | ||
) |
Creates a query object from data elements and displaced data nodes.
cee::ug::ElementsQuery::ElementsQuery | ( | const UnstructGridModel * | model, |
size_t | frameIndex, | ||
size_t | geometryIndex, | ||
int | partId | ||
) |
Creates a query object from model, frame index and part.
void cee::ug::ElementsQuery::allElementCentroids | ( | std::vector< double > * | values | ) | const |
Builds an array of coordinates of element centroids for all elements.
void cee::ug::ElementsQuery::elementAndSurfaceIndexFromElementSurfaceIndex | ( | size_t | elementSurfaceIndex, |
size_t * | elementIndex, | ||
size_t * | localSurfaceIndex | ||
) | const |
Gets the element index and local surface index from a given element surface index.
cee::Vec3d cee::ug::ElementsQuery::elementCentroid | ( | size_t | elementIndex | ) | const |
Returns the coordinates of the element centroid for the specified element index.
bool cee::ug::ElementsQuery::elementContainingCoordinate | ( | const Vec3d & | coordinate, |
size_t * | elementIndex | ||
) |
Returns true if the given coordinate is within one of the elements.
The optional parameter elementIndex will contain the index of the element in which the coordinate is contain within. It is set to cee::UNDEFINED_SIZE_T if there was no hit.
std::vector< Vec3d > cee::ug::ElementsQuery::elementCoordinates | ( | size_t | elementIndex | ) | const |
Returns an array of coordinates for all nodes in the element.
std::vector< unsigned int > cee::ug::ElementsQuery::elementEdges | ( | size_t | elementIndex | ) |
Returns the edges of the specified element.
The returned array will contain from and to node index of the edges of the element. The length of the returned array will be 2 times the number of edges in the specified element.
size_t cee::ug::ElementsQuery::elementLocalNodeIndexFromElementAndNodeIndex | ( | size_t | elementIndex, |
size_t | nodeIndex | ||
) | const |
Returns the local element index (0..NumElementNodes - 1) of the node with the given (global) node index.
Returns cee::UNDEFINED_SIZE_T if the given node is not used by the given element.
bool cee::ug::ElementsQuery::elementNeighbor | ( | size_t | elementIndex, |
size_t | localSurfaceIndex, | ||
size_t * | neighborElementIndex = NULL , |
||
size_t * | neighborLocalSurfaceIndex = NULL |
||
) | const |
Finds neighbor element to given element and local element surface.
Returns false if no neighbor element was found.
Parameters neighborElementIndex and neighborLocalSurfaceIndex are optional. If exists and neighbor was found, the index and local surface index of the found neighbor element are set.
size_t cee::ug::ElementsQuery::elementNodeFromElementAndNodeIndex | ( | size_t | elementIndex, |
size_t | nodeIndex | ||
) | const |
Returns the element node index of the given element index and (global for the part) node index.
bool cee::ug::ElementsQuery::elementsContainingEdge | ( | size_t | nodeIndex1, |
size_t | nodeIndex2, | ||
std::vector< size_t > * | elementIndices | ||
) |
Returns true if at least one of the elements contains the given edge.
The parameter elementIndices will contain the indices of the elements that have [node1, node2] as an edge, regardless of the order of the nodes. The vector is empty if there are no elements and the method returns false.
bool cee::ug::ElementsQuery::elementsContainingNode | ( | size_t | nodeIndex, |
std::vector< size_t > * | elementIndices | ||
) |
Returns true if at least one of the elements contains the given node.
The parameter elementIndices will contain the indices of the elements that have the nodeIndex in their connectivity, regardless of the order of the nodes. The vector is empty if there are no elements and the method returns false.
size_t cee::ug::ElementsQuery::elementStartIndex | ( | size_t | elementIndex | ) | const |
Returns the index in the element nodes array for the start of this element.
cee::Vec3d cee::ug::ElementsQuery::elementSurfaceCentroid | ( | size_t | elementIndex, |
size_t | localSurfaceIndex | ||
) | const |
Returns the coordinates of the element surface centroid for the specified element index and element surface index.
std::vector< Vec3d > cee::ug::ElementsQuery::elementSurfaceCoordinates | ( | size_t | elementIndex, |
size_t | localSurfaceIndex | ||
) | const |
Returns an array of coordinates for an element surface specified by a element index and a local surface index.
size_t cee::ug::ElementsQuery::elementSurfaceIndex | ( | size_t | elementIndex, |
size_t | localSurfaceIndex | ||
) | const |
Returns the element surface index for the element surface specified by elementIndex and localsurfaceIndex.
std::vector< Vec3d > cee::ug::ElementsQuery::elementSurfaceTriangles | ( | size_t | elementIndex, |
size_t | localSurfaceIndex | ||
) | const |
Returns an array with 3 Vec3d's for each triangle of the given element surface.
std::vector< unsigned int > cee::ug::ElementsQuery::elementSurfaceVertices | ( | size_t | elementIndex, |
size_t | localSurfaceIndex | ||
) | const |
Returns an array of vertices for an element surface specified by a element index and a local surface index.
std::vector< unsigned int > cee::ug::ElementsQuery::elementVertices | ( | size_t | elementIndex | ) | const |
Returns an array of vertices for a given element index.
double cee::ug::ElementsQuery::elementVolume | ( | size_t | elementIndex | ) | const |
Returns the volume of an element.
For non-linear elements, this value will be a linear approximation based on the polygons used to display the element
std::vector< double > cee::ug::ElementsQuery::elementVolumes | ( | ) | const |
Returns an array containing the volumes of all elements.
double cee::ug::ElementsQuery::mapScalarResult | ( | size_t | elementIndex, |
const Vec3d & | coordinate, | ||
const DataPartScalar * | scalarPart, | ||
ResultMapping | scalarResultMappingType | ||
) | const |
Gets a mapped scalar result value for the given coordinates in an element.
void cee::ug::ElementsQuery::mapScalarResults | ( | const std::vector< Vec3d > & | coords, |
const DataPartScalar * | scalarPart, | ||
ResultMapping | scalarResultMappingType, | ||
std::vector< double > * | mappedResultValues | ||
) |
Gets mapped scalar result values for coordinates specified in coords.
Given an array of coordinates coords, a scalar part scalarPart, and a mapping type scalarResultMappingType, an array of mapped result values will be created and set into mappedResultValues.
cee::Vec3d cee::ug::ElementsQuery::nodeCoordinate | ( | size_t | nodeIndex | ) |
Returns the coordinate of the given node, taking any displacement and mode shape animation into account.
size_t cee::ug::ElementsQuery::nodeIndexFromElementNodeIndex | ( | size_t | elementNodeIdx | ) | const |
Returns the node index for the given element node index.
void cee::ug::ElementsQuery::setDisplacements | ( | const DataPartDisplacement * | displacements | ) |
Sets the displacements to use (replacing the nodes if any)