.. role:: ts-api-decorator

#########
MeshQuery
#########

.. js:module:: cee.usg
   :noindex:

.. container:: ts-api-section

   .. js:class:: MeshQuery

      Class for querying the FEA mesh in an UnstructGridModel.

      You can use this class to both interrogate a mesh in its local coordinates and to query 
      a state in the model. If a state is specified the returned data will be in global coordinates,
      taking any displacement and transformation result into account.



.. container:: api-index-section

   .. rubric:: Constructors

   .. rst-class:: api-index-list-item api-kind-constructor api-parent-kind-class

   * :js:meth:`~cee.usg.MeshQuery.constructor`



.. container:: api-index-section

   .. rubric:: Methods

   .. rst-class:: api-index-list-item api-kind-method api-parent-kind-class

   * :js:meth:`~cee.usg.MeshQuery.getElementCentroid`
   * :js:meth:`~cee.usg.MeshQuery.getElementNodeIndices`
   * :js:meth:`~cee.usg.MeshQuery.getElementSurfaceNormal`
   * :js:meth:`~cee.usg.MeshQuery.getNodePosition`





------------

Constructors
============

.. container:: ts-api-section

   .. js:function:: MeshQuery.constructor( mesh)

      :param mesh: None
      :type mesh: Mesh


      Create the query object. 

      If a mesh is specified, the query will be based on the mesh elements and nodes. The coordinate system
      of the returned data will be in mesh local coordinates.

      If a state and part index is specified, the results (displacement and transformations) will be applied 
      if in use. So, in this case the coordinate system of the returned data will be in global coordinates.


      :rtype: MeshQuery

   .. js:function:: MeshQuery.constructor( state, partIndex)
      :noindex:

      :param state: None
      :type state: State
      :param partIndex: None
      :type partIndex: number


      :rtype: MeshQuery



Methods
=======

.. rst-class:: ts-api-section

getElementCentroid
------------------

.. js:method:: MeshQuery.getElementCentroid( elementIndex)

   :param elementIndex: None
   :type elementIndex: number


   Returns the centroid of the given element

   If a mesh is specified in the constructor, the coordinate system of the returned data will be in mesh local coordinates.
   If a state and part index is specified in the constructor, the coordinate system of the returned data will be in global coordinates.


   :rtype: Vec3

.. rst-class:: ts-api-section

getElementNodeIndices
---------------------

.. js:method:: MeshQuery.getElementNodeIndices( elementIndex)

   :param elementIndex: None
   :type elementIndex: number


   Returns an array containing the node indices for each element node in the given element


   :rtype: ArrayLike <number>

.. rst-class:: ts-api-section

getElementSurfaceNormal
-----------------------

.. js:method:: MeshQuery.getElementSurfaceNormal( elementIndex)

   :param elementIndex: None
   :type elementIndex: number


   Returns the surface normal of the given element 

   If a mesh is specified in the constructor, the coordinate system of the returned data will be in mesh local coordinates.
   If a state and part index is specified in the constructor, the coordinate system of the returned data will be in global coordinates.


   :rtype: Vec3

.. rst-class:: ts-api-section

getNodePosition
---------------

.. js:method:: MeshQuery.getNodePosition( nodeIndex)

   :param nodeIndex: None
   :type nodeIndex: number


   Returns the position of the given node in the given part in this state.

   If a mesh is specified in the constructor, the coordinate system of the returned data will be in mesh local coordinates.
   If a state and part index is specified in the constructor, the coordinate system of the returned data will be in global coordinates.


   :rtype: Vec3

