ngsPETSc.plex
=============

.. py:module:: ngsPETSc.plex

.. autoapi-nested-parse::

   This module contains all the functions related to wrapping NGSolve meshes to
   PETSc DMPlex using the petsc4py interface.



Attributes
----------

.. autoapisummary::

   ngsPETSc.plex.FACE_SETS_LABEL
   ngsPETSc.plex.CELL_SETS_LABEL
   ngsPETSc.plex.EDGE_SETS_LABEL


Classes
-------

.. autoapisummary::

   ngsPETSc.plex.ngs
   ngsPETSc.plex.MeshMapping


Functions
---------

.. autoapisummary::

   ngsPETSc.plex.buildSimplices
   ngsPETSc.plex.addSimplices
   ngsPETSc.plex.createNetgenMesh
   ngsPETSc.plex.createPETScDMPlex


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

.. py:class:: ngs

   dummy class


   .. py:class:: comp

      dummy class


      .. py:attribute:: Mesh



.. py:data:: FACE_SETS_LABEL
   :value: 'Face Sets'


.. py:data:: CELL_SETS_LABEL
   :value: 'Cell Sets'


.. py:data:: EDGE_SETS_LABEL
   :value: 'Edge Sets'


.. py:class:: MeshMapping(mesh, comm=None, geo=None, name='Default')

   A mapping between a Netgen/NGSolve mesh and a PETSc DMPlex

   :arg mesh: the source mesh, either a Netgen/NGSolve mesh or a PETSc DMPlex
   :kwarg comm: an optional MPI.Comm
   :kwarg geo: the underlying Netgen geometry, ignored if mesh is a Netgen mesh
   :kwarg name: the name of to be assigned to the PETSc DMPlex, by default this is set to "Default"


   .. py:attribute:: petscPlex


   .. py:attribute:: ngMesh


   .. py:attribute:: comm
      :value: None



   .. py:attribute:: geo


   .. py:attribute:: geoInfo


.. py:function:: buildSimplices(plex, points=None)

   Return a numpy.array with the vertices of each simplex in the plex

   :arg plex: PETSc DMPlex
   :arg points: iterable of DMPlex points (must be of the same dimension)



.. py:function:: addSimplices(ngMesh, dim, index, data, project_geometry, isoccgeom, edgenr_mapping)

   Add simplices to a Netgen mesh

   :arg ngMesh: the Netgen Mesh
   :arg dim: the simplex dimension
   :arg index: the region index
   :arg data: a numpy.array with the vertices of each simplex
   :project_geometry: whether to project points to the geometry
   :isoccgeom: whether we have an OCCGeometry, required to decide index conventions
   :edgenr_mapping: a dict mapping from region index to edgenr



.. py:function:: createNetgenMesh(plex, geo)

   Create a Netgen mesh from the local part of a PETSc DMPlex

   :arg plex: the PETSc DMPlex to be converted in NGSolve mesh object
   :arg geo: Netgen geometry or Netgen mesh to extract geometry from



.. py:function:: createPETScDMPlex(ngMesh, comm, name)

   Create a PETSc DMPlex from a Netgen/NGSolve mesh object

   :arg ngMesh: the serial Netgen mesh object to be converted
   :arg comm: the MPI.Comm object

   :returns: a tuple of Netgen mesh and DMPlex


