pyfebiopt.xplt.mesh_parser
==========================

.. py:module:: pyfebiopt.xplt.mesh_parser

.. autoapi-nested-parse::

   Mesh parsing helpers for XPLT reader.



Classes
-------

.. autoapisummary::

   pyfebiopt.xplt.mesh_parser.MeshParseResult
   pyfebiopt.xplt.mesh_parser.DomainInfo


Functions
---------

.. autoapisummary::

   pyfebiopt.xplt.mesh_parser.build_domain_registry
   pyfebiopt.xplt.mesh_parser.parse_mesh


Module Contents
---------------

.. py:class:: MeshParseResult

   Container for parsed mesh pieces and lookup maps.


   .. py:attribute:: mesh
      :type:  pyfebiopt.mesh.mesh.Mesh


   .. py:attribute:: domain_nodes
      :type:  dict[str, numpy.ndarray]


   .. py:attribute:: parts_map
      :type:  dict[str, list[int]]


   .. py:attribute:: surfaces_map
      :type:  dict[str, list[numpy.ndarray]]


   .. py:attribute:: nodesets_map
      :type:  dict[str, numpy.ndarray]


   .. py:attribute:: part_id2name
      :type:  dict[int, str]


   .. py:attribute:: surf_id2name
      :type:  dict[int, str]


   .. py:attribute:: dom_idx2name
      :type:  dict[int, str]


   .. py:attribute:: surf_idx2name
      :type:  dict[int, str]


   .. py:attribute:: domain_registry
      :type:  dict[str, DomainInfo]


.. py:class:: DomainInfo

   Canonical domain metadata.


   .. py:attribute:: canonical_key
      :type:  str


   .. py:attribute:: dom_idx
      :type:  int


   .. py:attribute:: part_id
      :type:  int


   .. py:attribute:: elem_type
      :type:  str


   .. py:attribute:: declared_count
      :type:  int


   .. py:attribute:: raw_dom_name
      :type:  str | None
      :value: None



   .. py:attribute:: part_name
      :type:  str | None
      :value: None



.. py:function:: build_domain_registry(drafts: list[_DomainDraft], part_id2name: dict[int, str]) -> tuple[list[DomainInfo], dict[int, str], dict[str, DomainInfo]]

   Build canonical domain names and metadata.

   Policy:

   - Keep explicit, non-empty ``PLT_DOM_NAME`` when available and unique.
   - Fall back to canonical ``<type>_d<dom_idx>`` when name is missing/empty
     or collides.

   :returns: Tuple of (ordered entries, dom_idx -> key map, key -> entry map).


.. py:function:: parse_mesh(reader: pyfebiopt.xplt.binary_reader.BinaryReader) -> MeshParseResult

   Parse mesh blocks and build Mesh plus lookup maps.

   :returns: Parsed mesh and helper maps.
   :rtype: MeshParseResult


