# cee::ug::ElementsQuery

class `ElementsQuery`

  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.

  Public Functions

  `ElementsQuery`(const DataElements *elements, const DataNodes *nodes)

    Creates a query object from data elements and data nodes.

  `ElementsQuery`(const DataElements *elements, const DataPartDisplacement *displacements)

    Creates a query object from data elements and displaced data nodes.

  `ElementsQuery`(const UnstructGridModel *model, size_t frameIndex, size_t geometryIndex, int partId)

    Creates a query object from model, frame index and part.

  void `setDisplacements`(const DataPartDisplacement *displacements)

    Sets the displacements to use (replacing the nodes if any)

  Vec3d `nodeCoordinate`(size_t nodeIndex)

    Returns the coordinate of the given node, taking any displacement and mode shape animation into account.

  Vec3d `elementCentroid`(size_t elementIndex) const

    Returns the coordinates of the element centroid for the specified element index.

  std::vector<Vec3d> `elementCoordinates`(size_t elementIndex) const

    Returns an array of coordinates for all nodes in the element.

  std::vector<unsigned int> `elementVertices`(size_t elementIndex) const

    Returns an array of vertices for a given element index.

  bool `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.

  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.

    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 `elementsContainingNode`(size_t nodeIndex1, 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.

  std::vector<unsigned int> `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.

  double `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> `elementVolumes`() const

    Returns an array containing the volumes of all elements.

  void `allElementCentroids`(std::vector<double> *values) const

    Builds an array of coordinates of element centroids for all elements.

  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.

  std::vector<Vec3d> `elementSurfaceCoordinates`(size_t elementIndex, size_t localSurfaceIndex) const

    Returns an array of coordinates for an element surface specified by an element index and a local surface index.

  std::vector<unsigned int> `elementSurfaceVertices`(size_t elementIndex, size_t localSurfaceIndex) const

    Returns an array of vertices for an element surface specified by an element index and a local surface index.

  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.

  size_t `nodeIndexFromElementNodeIndex`(size_t elementNodeIdx) const

    Returns the node index for the given element node index.

  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.

  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.

    Returns cee::UNDEFINED_SIZE_T if the given node is not used by the given element.

  size_t `elementStartIndex`(size_t elementIndex) const

    Returns the index in the element nodes array for the start of this element.

  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.

  size_t `elementSurfaceIndex`(size_t elementIndex, size_t localSurfaceIndex) const

    Returns the element surface index for the element surface specified by elementIndex and localSurfaceIndex.

  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.

    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.

  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.

  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.

    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.

Conversation saved
HOOPSY BETA

### Hello! I'm HOOPSY

Your multilingual generative AI assistant for documentation. Ask me anything about HOOPS Envision for Desktop in your own language, or choose a sample question below to start a conversation:

What is HOOPS Envision for Desktop?
What are the latest release notes for HOOPS Envision for Desktop?
How do I start evaluating HOOPS Envision for Desktop?
How do I write my first sample application?
How can I get assistance?

HOOPSY may store conversations according to OpenAI's policy. Responses may not always be accurate.

HOOPSY is thinking...