Skip to content

Commit

Permalink
removed BC parameter and improved doc string
Browse files Browse the repository at this point in the history
  • Loading branch information
mkofler96 authored and j042 committed Aug 22, 2024
1 parent 5592666 commit 20e6c53
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions gustaf/io/mfem.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,11 @@ def extract_values(fname, start_index, n_lines, total_lines, dtype):
return mesh


def export(fname, mesh, BC=None):
"""Export mesh in MFEM format. Supports 2D triangle and quadrilateral
meshes as well as 3D tetrahedral meshes. Does not support different
element attributes or difference in vertex dimension and mesh dimension.
def export(fname, mesh):
"""Export mesh in MFEM format. Supports 2D triangle and quadrilateral
meshes as well as 3D tetrahedral meshes. Handles boundary conditions for
3D tetrahedral meshes. Does not support different element attributes or
difference in vertex dimension and mesh dimension.
Parameters
------------
Expand Down Expand Up @@ -223,16 +224,14 @@ def format_array(array):

# Boundary
faces = mesh.faces()
if BC is None:
BC = {1: mesh.to_faces(False).single_faces()}

nboundary_faces = sum(map(len, BC.values()))
nboundary_faces = sum(map(len, mesh.BC.values()))
boundary_array = np.empty(
(nboundary_faces, 5), dtype=settings.INT_DTYPE
)
startrow = 0
# Add boundary one by one as TRIANGLEs
for bid, faceids in BC.items():
for bid, faceids in mesh.BC.items():
nfaces = len(faceids)
e = np.ones(nfaces).reshape(-1, 1)
vertex_list = faces[faceids, :]
Expand Down

0 comments on commit 20e6c53

Please sign in to comment.