ngsPETSc.utils.firedrake.meshes
===============================

.. py:module:: ngsPETSc.utils.firedrake.meshes

.. autoapi-nested-parse::

   This module contains all the functions related to wrapping NGSolve meshes to Firedrake
   We adopt the same docstring conventions as the Firedrake project, since this part of
   the package will only be used in combination with Firedrake.



Attributes
----------

.. autoapisummary::

   ngsPETSc.utils.firedrake.meshes.fd
   ngsPETSc.utils.firedrake.meshes.splitTypes


Classes
-------

.. autoapisummary::

   ngsPETSc.utils.firedrake.meshes.ngs
   ngsPETSc.utils.firedrake.meshes.FiredrakeMesh


Functions
---------

.. autoapisummary::

   ngsPETSc.utils.firedrake.meshes.flagsUtils
   ngsPETSc.utils.firedrake.meshes.refineMarkedElements
   ngsPETSc.utils.firedrake.meshes.curveField
   ngsPETSc.utils.firedrake.meshes.splitToQuads


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

.. py:data:: fd
   :value: None


.. py:class:: ngs

   dummy class


   .. py:class:: comp

      dummy class


      .. py:attribute:: Mesh



.. py:function:: flagsUtils(flags, option, default)

   utility fuction used to parse Netgen flag options


.. py:function:: refineMarkedElements(self, mark, netgen_flags={})

   This method is used to refine a mesh based on a marking function
   which is a Firedrake DG0 function.

   :arg mark: the marking function which is a Firedrake DG0 function.
   :arg netgen_flags: the dictionary of flags to be passed to ngsPETSc.
   It includes the option:
       - refine_faces, which is a boolean specifyiong if you want to refine faces.



.. py:function:: curveField(self, order, permutation_tol=1e-08, location_tol=0.1, cg_field=False)

   This method returns a curved mesh as a Firedrake function.

   :arg order: the order of the curved mesh.
   :arg permutation_tol: tolerance used to construct the permutation of the reference element.
   :arg location_tol: tolerance used to locate the cell a point belongs to.
   :arg cg_field: return a CG function field representing the mesh, rather than the
                  default DG field.



.. py:function:: splitToQuads(plex, dim, comm)

   This method splits a Netgen mesh to quads, using a PETSc transform.
   TODO: Improve support quad meshing.
       @pef  Get netgen to make a quad-dominant mesh, and then only split the triangles.
             Current implementation will make for poor-quality meshes.


.. py:data:: splitTypes

.. py:class:: FiredrakeMesh(mesh, netgen_flags, user_comm=fd.COMM_WORLD)

   This class creates a Firedrake mesh from Netgen/NGSolve meshes.

   :arg mesh: the mesh object, it can be either a Netgen/NGSolve mesh or a PETSc DMPlex
   :param netgen_flags: The dictionary of flags to be passed to ngsPETSc.
   :arg comm: the MPI communicator.


   .. py:attribute:: comm


   .. py:method:: createFromTopology(topology, name, comm)

      Internal method to construct a mesh from a mesh topology, copied from Firedrake.

      :arg topology: the mesh topology

      :arg name: the mesh name




