# ngsPETSc.plex

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

## Attributes

`FACE_SETS_LABEL` |
`CELL_SETS_LABEL` |
`EDGE_SETS_LABEL` |

## Classes

`ngs` | dummy class
`MeshMapping` | A mapping between a Netgen/NGSolve mesh and a PETSc DMPlex

## Functions

`buildSimplices`(plex[, points]) | Return a numpy.array with the vertices of each simplex in the plex
`addSimplices`(ngMesh, dim, index, data, ...) | Add simplices to a Netgen mesh
`createNetgenMesh`(plex, geo) | Create a Netgen mesh from the local part of a PETSc DMPlex
`createPETScDMPlex`(ngMesh, comm, name) | Create a PETSc DMPlex from a Netgen/NGSolve mesh object

## Module Contents

class ngsPETSc.plex.ngs

  dummy class

  class comp

    dummy class

    Mesh

ngsPETSc.plex.FACE_SETS_LABEL = 'Face Sets'

ngsPETSc.plex.CELL_SETS_LABEL = 'Cell Sets'

ngsPETSc.plex.EDGE_SETS_LABEL = 'Edge Sets'

class ngsPETSc.plex.MeshMapping(mesh, comm=None, geo=None, name='Default')

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

  Parameters:

    - mesh – the source mesh, either a Netgen/NGSolve mesh or a PETSc DMPlex

    - comm – an optional MPI.Comm

    - geo – the underlying Netgen geometry, ignored if mesh is a Netgen mesh

    - name – the name of to be assigned to the PETSc DMPlex, by default this is set to “Default”

  petscPlex
  ngMesh
  comm = None
  geo
  geoInfo

ngsPETSc.plex.buildSimplices(plex, points=None)

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

  Parameters:

    - plex – PETSc DMPlex

    - points – iterable of DMPlex points (must be of the same dimension)

ngsPETSc.plex.addSimplices(ngMesh, dim, index, data, project_geometry, isoccgeom, edgenr_mapping)

  Add simplices to a Netgen mesh

  Parameters:

    - ngMesh – the Netgen Mesh

    - dim – the simplex dimension

    - index – the region index

    - 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

ngsPETSc.plex.createNetgenMesh(plex, geo)

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

  Parameters:

    - plex – the PETSc DMPlex to be converted in NGSolve mesh object

    - geo – Netgen geometry or Netgen mesh to extract geometry from

ngsPETSc.plex.createPETScDMPlex(ngMesh, comm, name)

  Create a PETSc DMPlex from a Netgen/NGSolve mesh object

  Parameters:

    - ngMesh – the serial Netgen mesh object to be converted

    - comm – the MPI.Comm object

  Returns:

    a tuple of Netgen mesh and DMPlex