Skip to content

Commit

Permalink
add more mesh inconsistency exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
alexfikl authored and inducer committed Apr 28, 2024
1 parent 694775f commit ca888f4
Showing 1 changed file with 37 additions and 11 deletions.
48 changes: 37 additions & 11 deletions meshmode/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,13 @@


__doc__ = """
.. exception:: Error
.. exception:: DataUnavailable
.. exception:: FileExistsError
.. exception:: InconsistentVerticesError
.. autoexception:: Error
.. autoexception:: DataUnavailableError
.. autoexception:: InconsistentMeshError
.. autoexception:: InconsistentArrayDTypeError
.. autoexception:: InconsistentVerticesError
.. autoexception:: InconsistentAdjacencyError
"""

from builtins import FileExistsError # noqa: F401
Expand All @@ -34,19 +37,42 @@


class Error(RuntimeError):
pass
"""Exception base for :mod:`meshmode` errors."""


class DataUnavailableError(Error):
"""Raised when some data on the mesh or the discretization is not available.
This error should not be raised when the specific data simply fails to be
computed for other reasons.
"""

class DataUnavailable(Error):
pass

DataUnavailable = DataUnavailableError

class InconsistentVerticesError(Error):

class InconsistentMeshError(Error):
"""Raised when the mesh is inconsistent in some fashion.
Prefer the more specific exceptions, e.g. :exc:`InconsistentVerticesError`
when possible.
"""
Raised when an element's local-to-global mapping does not map the unit vertices
to the corresponding values in the mesh's *vertices* array.


class InconsistentArrayDTypeError(InconsistentMeshError):
"""Raised when a mesh (or group) array does not match the provided
:class:`~numpy.dtype`.
"""


class InconsistentVerticesError(InconsistentMeshError):
"""Raised when an element's local-to-global mapping does not map the unit
vertices to the corresponding values in the mesh's *vertices* array.
"""
pass


class InconsistentAdjacencyError(InconsistentMeshError):
"""Raised when the nodal or the facial adjacency is inconsistent."""


def _acf():
Expand Down

0 comments on commit ca888f4

Please sign in to comment.