Skip to content

Commit

Permalink
fname then mesh for io
Browse files Browse the repository at this point in the history
  • Loading branch information
j042 committed May 3, 2024
1 parent b41c1e4 commit 7de9677
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
9 changes: 5 additions & 4 deletions gustaf/io/meshio.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def load(fname):
return meshes[0] if len(meshes) == 1 else meshes


def export(mesh, fname, submeshes=None, **kwargs):
def export(fname, mesh, submeshes=None, **kwargs):
"""Export mesh elements and vertex data into meshio and use its write
function. The definition of submeshes with identical vertex coordinates
is possible. In that case vertex numbering and data from the main mesh
Expand Down Expand Up @@ -132,10 +132,10 @@ def export(mesh, fname, submeshes=None, **kwargs):
Parameters
------------
mesh: Edges, Faces or Volumes
Input mesh
fname: Union[str, pathlib.Path]
File to save the mesh in.
mesh: Edges, Faces or Volumes
Input mesh
submeshes: Iterable
Submeshes where the vertices are identical to the main mesh. The element
type can be identical to mesh.elements or lower-dimensional (e.g.
Expand Down Expand Up @@ -164,7 +164,8 @@ def export(mesh, fname, submeshes=None, **kwargs):

cells = []
# Merge main mesh and submeshes in one list
meshes = [mesh]
meshes = mesh if isinstance(mesh, list) else [mesh]

if submeshes is not None:
meshes.extend(submeshes)

Expand Down
4 changes: 2 additions & 2 deletions gustaf/io/mfem.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,15 +107,15 @@ def extract_values(fname, start_index, n_lines, total_lines, dtype):
return mesh


def export(mesh, fname):
def export(fname, mesh):
"""Export mesh in MFEM format. Supports 2D triangle and quadrilateral
meshes. Does not support different element attributes or difference in
vertex dimension and mesh dimension.
Parameters
------------
mesh: Faces
fname: str
mesh: Faces
Returns
------------
Expand Down
2 changes: 1 addition & 1 deletion gustaf/io/mixd.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ def load(


def export(
mesh,
fname,
mesh,
space_time=False,
dual=False,
):
Expand Down
4 changes: 2 additions & 2 deletions gustaf/io/nutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,14 @@ def load(fname):
return mesh


def export(mesh, fname):
def export(fname, mesh):
"""Export in Nutils format. Files are saved as np.savez().
Supports triangle,and tetrahedron Meshes.
Parameters
-----------
mesh: Faces or Volumes
fname: str
mesh: Faces or Volumes
Returns
--------
Expand Down

0 comments on commit 7de9677

Please sign in to comment.