From 546fe9d67ef0498e882878d01bd09c1515fb50ad Mon Sep 17 00:00:00 2001 From: Matt Wala Date: Sat, 15 Jun 2019 15:02:57 -0500 Subject: [PATCH 1/2] generate_gmsh(): Set target_unit in GmshRunner to avoid deprecation warning --- meshmode/mesh/io.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/meshmode/mesh/io.py b/meshmode/mesh/io.py index 49e816f8..c801dd5f 100644 --- a/meshmode/mesh/io.py +++ b/meshmode/mesh/io.py @@ -308,7 +308,8 @@ def generate_gmsh(source, dimensions=None, order=None, other_options=[], from gmsh_interop.reader import parse_gmsh with GmshRunner(source, dimensions, order=order, other_options=other_options, extension=extension, - gmsh_executable=gmsh_executable) as runner: + gmsh_executable=gmsh_executable, + target_unit="mm") as runner: parse_gmsh(recv, runner.output_file, force_dimension=force_ambient_dim) -- GitLab From 477ac61adcdbe863a7711f552d825a1767b6cc2e Mon Sep 17 00:00:00 2001 From: Matt Wala Date: Sun, 16 Jun 2019 00:02:11 -0500 Subject: [PATCH 2/2] Add target_unit as an argument to generate_gmsh() --- meshmode/mesh/io.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/meshmode/mesh/io.py b/meshmode/mesh/io.py index c801dd5f..de21ddfb 100644 --- a/meshmode/mesh/io.py +++ b/meshmode/mesh/io.py @@ -291,7 +291,8 @@ def read_gmsh(filename, force_ambient_dim=None, mesh_construction_kwargs=None): def generate_gmsh(source, dimensions=None, order=None, other_options=[], extension="geo", gmsh_executable="gmsh", force_ambient_dim=None, - output_file_name="output.msh", mesh_construction_kwargs=None): + output_file_name="output.msh", mesh_construction_kwargs=None, + target_unit=None): """Run :command:`gmsh` on the input given by *source*, and return a :class:`meshmode.mesh.Mesh` based on the result. @@ -301,15 +302,25 @@ def generate_gmsh(source, dimensions=None, order=None, other_options=[], this many dimensions. :arg mesh_construction_kwargs: *None* or a dictionary of keyword arguments passed to the :class:`meshmode.mesh.Mesh` constructor. + :arg target_unit: Value of the option *Geometry.OCCTargetUnit*. + Supported values are the strings `'M'` or `'MM'`. """ recv = GmshMeshReceiver(mesh_construction_kwargs=mesh_construction_kwargs) from gmsh_interop.runner import GmshRunner from gmsh_interop.reader import parse_gmsh + + if target_unit is None: + target_unit = "MM" + from warnings import warn + warn( + "Not specifying target_unit is deprecated. Set target_unit='MM' " + "to retain prior behavior.", DeprecationWarning, stacklevel=2) + with GmshRunner(source, dimensions, order=order, other_options=other_options, extension=extension, gmsh_executable=gmsh_executable, - target_unit="mm") as runner: + target_unit=target_unit) as runner: parse_gmsh(recv, runner.output_file, force_dimension=force_ambient_dim) -- GitLab