Skip to content

Commit

Permalink
Create mesh even if there is an issue with labels for 1D boundary.
Browse files Browse the repository at this point in the history
Throw a warning !

Signed-off-by: Umberto Zerbinati <zerbinati@maths.ox.ac.uk>
  • Loading branch information
Umberto Zerbinati committed Feb 5, 2024
1 parent 0c8a05b commit d05fd01
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions ngsPETSc/plex.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
PETSc DMPlex using the petsc4py interface.
'''
import itertools
import numpy as np
import warnings

import numpy as np
from petsc4py import PETSc

import netgen.meshing as ngm
Expand Down Expand Up @@ -200,7 +201,10 @@ def createPETScDMPlex(self, mesh):
vStart, _ = plex.getDepthStratum(0) # vertices
for e in self.ngMesh.Elements1D():
join = plex.getJoin([vStart+v.nr-1 for v in e.vertices])
plex.setLabelValue(FACE_SETS_LABEL, join[0], int(e.index))
if len(join) > 0:
plex.setLabelValue(EDGE_SETS_LABEL, join[0], int(e.index))
else:
warnings.warn("Labled Netgen mesh not found in the plex.")
if not (1 == self.ngMesh.Elements2D().NumPy()["index"]).all():
for e in self.ngMesh.Elements2D():
join = plex.getFullJoin([vStart+v.nr-1 for v in e.vertices])
Expand Down

0 comments on commit d05fd01

Please sign in to comment.