Skip to content

Commit 09d3270

Browse files
majosminducer
authored andcommitted
restore output_file_name/output_file_path
1 parent 59711cf commit 09d3270

File tree

1 file changed

+27
-2
lines changed

1 file changed

+27
-2
lines changed

meshmode/mesh/io.py

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -393,9 +393,11 @@ def generate_gmsh(
393393
extension: str = "geo",
394394
gmsh_executable: str = "gmsh",
395395
force_ambient_dim: int | None = None,
396+
output_file_path: str | None = None,
396397
mesh_construction_kwargs: Mapping[str, Any] | None = None,
397398
target_unit: Literal["M", "MM"] | None = None,
398399
return_tag_to_elements_map: Literal[False] = False,
400+
output_file_name: str | None = None,
399401
) -> Mesh: ...
400402

401403

@@ -408,9 +410,11 @@ def generate_gmsh(
408410
extension: str = "geo",
409411
gmsh_executable: str = "gmsh",
410412
force_ambient_dim: int | None = None,
413+
output_file_path: str | None = None,
411414
mesh_construction_kwargs: Mapping[str, Any] | None = None,
412415
target_unit: Literal["M", "MM"] | None = None,
413416
return_tag_to_elements_map: Literal[True],
417+
output_file_name: str | None = None,
414418
) -> tuple[Mesh, dict[str, IndexArray]]: ...
415419

416420

@@ -422,9 +426,11 @@ def generate_gmsh(
422426
extension: str = "geo",
423427
gmsh_executable: str = "gmsh",
424428
force_ambient_dim: int | None = None,
429+
output_file_path: str | None = None,
425430
mesh_construction_kwargs: Mapping[str, Any] | None = None,
426431
target_unit: Literal["M", "MM"] | None = None,
427-
return_tag_to_elements_map: bool = False
432+
return_tag_to_elements_map: bool = False,
433+
output_file_name: str | None = None,
428434
) -> tuple[Mesh, dict[str, IndexArray]] | Mesh:
429435
"""Run :command:`gmsh` on the input given by *source*, and return a
430436
:class:`meshmode.mesh.Mesh` based on the result.
@@ -453,10 +459,29 @@ def generate_gmsh(
453459
"Not specifying target_unit is deprecated. Set target_unit='MM' "
454460
"to retain prior behavior.", DeprecationWarning, stacklevel=2)
455461

462+
if output_file_name is not None:
463+
from warnings import warn
464+
warn(
465+
"output_file_name is deprecated and will be removed in Q1 2026. "
466+
"Use output_file_path instead.", DeprecationWarning, stacklevel=2)
467+
output_file_path = output_file_name
468+
469+
if output_file_path is not None:
470+
import os
471+
output_file_name = os.path.basename(output_file_path)
472+
save_output_file_in = os.path.dirname(output_file_path)
473+
if not save_output_file_in:
474+
save_output_file_in = os.getcwd()
475+
else:
476+
output_file_name = None
477+
save_output_file_in = None
478+
456479
with GmshRunner(source, dimensions, order=order,
457480
other_options=other_options, extension=extension,
458481
gmsh_executable=gmsh_executable,
459-
target_unit=target_unit) as runner:
482+
output_file_name=output_file_name,
483+
target_unit=target_unit,
484+
save_output_file_in=save_output_file_in) as runner:
460485
assert runner.output_file
461486
parse_gmsh(recv, runner.output_file,
462487
force_dimension=force_ambient_dim)

0 commit comments

Comments
 (0)