.. role:: ts-api-decorator

##############
ModelDirectory
##############

.. js:module:: cee.ug
   :noindex:

.. container:: ts-api-section

   .. js:class:: ModelDirectory

      The model directory contains a table of contents of what is available in the current CAE 
      analysis. It has a list of all states/time steps, results and part infos in the model.

      The model directory can be used to populate a UI with the available states and results. It is
      used by property accessors when specifying results and states (e.g. in the ``ModelSpec``) to verify that 
      the input is correct.

      You can access the model directory using ``RemoteModel.modelDirectory``.



.. container:: api-index-section

   .. rubric:: Properties

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

   * :js:attr:`~cee.ug.ModelDirectory.displacementResultArray`
   * :js:attr:`~cee.ug.ModelDirectory.hasTransformationResult`
   * :js:attr:`~cee.ug.ModelDirectory.partInfoArray`
   * :js:attr:`~cee.ug.ModelDirectory.scalarResultArray`
   * :js:attr:`~cee.ug.ModelDirectory.setInfoArray`
   * :js:attr:`~cee.ug.ModelDirectory.simulationInfo`
   * :js:attr:`~cee.ug.ModelDirectory.stateGroupInfoArray`
   * :js:attr:`~cee.ug.ModelDirectory.stateInfoArray`
   * :js:attr:`~cee.ug.ModelDirectory.vectorResultArray`
   * :js:attr:`~cee.ug.ModelDirectory.vtfxCaseInfoArray`



.. container:: api-index-section

   .. rubric:: Methods

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

   * :js:meth:`~cee.ug.ModelDirectory.getAllStateIds`
   * :js:meth:`~cee.ug.ModelDirectory.getDisplacementNameById`
   * :js:meth:`~cee.ug.ModelDirectory.getPartNameById`
   * :js:meth:`~cee.ug.ModelDirectory.getResultIdByIdString`
   * :js:meth:`~cee.ug.ModelDirectory.getResultIdStringById`
   * :js:meth:`~cee.ug.ModelDirectory.getResultInfoByIdString`
   * :js:meth:`~cee.ug.ModelDirectory.getScalarNameById`
   * :js:meth:`~cee.ug.ModelDirectory.getSetNameById`
   * :js:meth:`~cee.ug.ModelDirectory.getStateNameById`
   * :js:meth:`~cee.ug.ModelDirectory.getStateReferenceValueById`
   * :js:meth:`~cee.ug.ModelDirectory.getVectorNameById`
   * :js:meth:`~cee.ug.ModelDirectory.hasDisplacementResult`
   * :js:meth:`~cee.ug.ModelDirectory.hasScalarResult`
   * :js:meth:`~cee.ug.ModelDirectory.hasVectorResult`





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

Properties
==========

.. container:: ts-api-section

   .. js:attribute:: ModelDirectory.displacementResultArray

      :type: unknown

      An array of the available displacement results in the model. The id's are unique and >= 0. The names describe the results.
      Use the Ids when specifying the displacement result id in the ``ModelSpec``.



.. container:: ts-api-section

   .. js:attribute:: ModelDirectory.hasTransformationResult

      :type: boolean

      Whether the model has a rigid body transformation result.



.. container:: ts-api-section

   .. js:attribute:: ModelDirectory.partInfoArray

      :type: unknown

      An array of the parts in the model. See ``PartInfo`` for more information about parts.



.. container:: ts-api-section

   .. js:attribute:: ModelDirectory.scalarResultArray

      :type: unknown

      An array of the available scalar results in the model. The id's are unique and >= 0. The names describe the results.
      Use the Ids when specifying scalar result ids in the ``ModelSpec``, ``CuttingPlanes``, ``Isosurfaces``, ``Isovolumes`` or
      ``ParticleTraceGroups``.



.. container:: ts-api-section

   .. js:attribute:: ModelDirectory.setInfoArray

      :type: unknown

      An array of the available element sets  in the model. The id's are unique and >= 0. The names describe the set.
      Use the Ids when specifying the visible sets in the ``ModelSpec``.



.. container:: ts-api-section

   .. js:attribute:: ModelDirectory.simulationInfo

      :type: SimulationInfo

      Meta data info for the current simulation



.. container:: ts-api-section

   .. js:attribute:: ModelDirectory.stateGroupInfoArray

      :type: unknown

      An array of the available state groups in the model. The id's are unique and >= 0. The names describe the group.
      Use the property ``StateGroupInfo.stateIdArr`` when specifying state ids in the ``ModelSpec.stateIdArray``.



.. container:: ts-api-section

   .. js:attribute:: ModelDirectory.stateInfoArray

      :type: unknown

      An array of the available states in the model. The id's are unique and >= 0. The names describe the states/time steps.
      Use the Ids when specifying state ids in the ``ModelSpec``.



.. container:: ts-api-section

   .. js:attribute:: ModelDirectory.vectorResultArray

      :type: unknown

      An array of the available vector results in the model. The id's are unique and >= 0. The names describe the results.
      Use the Ids when specifying vector result ids in the ``ModelSpec``, ``CuttingPlanes``, ``Isosurfaces``, ``Isovolumes`` or
      ``ParticleTraceGroups``.



.. container:: ts-api-section

   .. js:attribute:: ModelDirectory.vtfxCaseInfoArray

      :type: unknown

      An array of cases present in the VTFx file. Use the format modelKey|caseId to open a specific case from a VTFx file.



Methods
=======

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

getAllStateIds
--------------

.. js:method:: ModelDirectory.getAllStateIds()



   Returns an array of all state ids in the model.

   Useful for setting up an animation over all states.


   :rtype: [number]

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

getDisplacementNameById
-----------------------

.. js:method:: ModelDirectory.getDisplacementNameById( id)

   :param id: None
   :type id: number


   Returns the name of the displacement result with the given id, or null if the id is invalid.


   :rtype: string

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

getPartNameById
---------------

.. js:method:: ModelDirectory.getPartNameById( geometryIndex, id)

   :param geometryIndex: None
   :type geometryIndex: number
   :param id: None
   :type id: number


   Returns the name of the part with the given geometryIndex/partId, or null if the geometryIndex/id
   pair is invalid.


   :rtype: string

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

getResultIdByIdString
---------------------

.. js:method:: ModelDirectory.getResultIdByIdString( resultType, idString)

   :param resultType: None
   :type resultType: ResultType
   :param idString: None
   :type idString: string


   Find the result id of the result with the given type and ``idString``.

   Returns -1 if the result ``idString`` was not found.


   :rtype: number

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

getResultIdStringById
---------------------

.. js:method:: ModelDirectory.getResultIdStringById( resultType, id)

   :param resultType: None
   :type resultType: ResultType
   :param id: None
   :type id: number


   Find the idString of the result with the given type and result id.

   Returns null if ``id`` was not found.


   :rtype: string

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

getResultInfoByIdString
-----------------------

.. js:method:: ModelDirectory.getResultInfoByIdString( resultType, idString)

   :param resultType: None
   :type resultType: ResultType
   :param idString: None
   :type idString: string


   Find the result info of the result with the given type and idString. 
   Returns null when no match is found.


   :rtype: ResultInfo

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

getScalarNameById
-----------------

.. js:method:: ModelDirectory.getScalarNameById( id)

   :param id: None
   :type id: number


   Returns the name of the scalar result with the given id, or null if the id is invalid.


   :rtype: string

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

getSetNameById
--------------

.. js:method:: ModelDirectory.getSetNameById( id)

   :param id: None
   :type id: number


   Returns the name of the element set with the given id, or null if the id is invalid.


   :rtype: string

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

getStateNameById
----------------

.. js:method:: ModelDirectory.getStateNameById( id)

   :param id: None
   :type id: number


   Returns the name of the state with the given id, or null if the id is invalid.


   :rtype: string

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

getStateReferenceValueById
--------------------------

.. js:method:: ModelDirectory.getStateReferenceValueById( id)

   :param id: None
   :type id: number


   Returns the reference value of the state with the given id, or undefined if the id is invalid.


   :rtype: number

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

getVectorNameById
-----------------

.. js:method:: ModelDirectory.getVectorNameById( id)

   :param id: None
   :type id: number


   Returns the name of the vector result with the given id, or null if the id is invalid.


   :rtype: string

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

hasDisplacementResult
---------------------

.. js:method:: ModelDirectory.hasDisplacementResult( stateId, resultId)

   :param stateId: None
   :type stateId: number
   :param resultId: None
   :type resultId: number


   Returns true if the given state contains the given scalar result id


   :rtype: boolean

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

hasScalarResult
---------------

.. js:method:: ModelDirectory.hasScalarResult( stateId, resultId)

   :param stateId: None
   :type stateId: number
   :param resultId: None
   :type resultId: number


   Returns true if the given state contains the given scalar result id


   :rtype: boolean

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

hasVectorResult
---------------

.. js:method:: ModelDirectory.hasVectorResult( stateId, resultId)

   :param stateId: None
   :type stateId: number
   :param resultId: None
   :type resultId: number


   Returns true if the given state contains the given vector result id


   :rtype: boolean

