def generate_gmsh(receiver, source, dimensions, order=None, other_options=[], extension="geo", gmsh_executable="gmsh", force_dimension=None): from meshpy.gmsh import GmshRunner runner = GmshRunner(source, dimensions, order=order, other_options=other_options, extension=extension, gmsh_executable=gmsh_executable) runner.__enter__() try: result = parse_gmsh(receiver, runner.output_file) finally: runner.__exit__(None, None, None) return result
def generate_gmsh(receiver, source, dimensions, order=None, other_options=[], extension="geo", gmsh_executable="gmsh", force_dimension=None): """Run gmsh and feed the output to *receiver*. :arg source: an instance of :class:`LiteralSource` or :class:`FileSource` :param receiver: Implements the :class:`GmshMeshReceiverBase` interface. """ from meshpy.gmsh import GmshRunner runner = GmshRunner(source, dimensions, order=order, other_options=other_options, extension=extension, gmsh_executable=gmsh_executable) runner.__enter__() try: result = parse_gmsh(receiver, runner.output_file, force_dimension=force_dimension) finally: runner.__exit__(None, None, None) return result
def generate_gmsh(source, dimensions, order=None, other_options=[], extension="geo", gmsh_executable="gmsh", force_dimension=None, periodicity=None, allow_internal_boundaries=False, tag_mapper=lambda tag: tag): from meshpy.gmsh import GmshRunner runner = GmshRunner(source, dimensions, order=order, other_options=other_options, extension=extension, gmsh_executable=gmsh_executable) runner.__enter__() try: result = parse_gmsh(runner.output_file, force_dimension=force_dimension, periodicity=periodicity, allow_internal_boundaries=allow_internal_boundaries, tag_mapper=tag_mapper) finally: runner.__exit__(None, None, None) return result
def generate_gmsh(receiver, source, dimensions, order=None, other_options=[], extension="geo", gmsh_executable="gmsh", force_dimension=None): from meshpy.gmsh import GmshRunner runner = GmshRunner(source, dimensions, order=order, other_options=other_options, extension=extension, gmsh_executable=gmsh_executable) runner.__enter__() try: result = parse_gmsh(receiver, runner.output_file, force_dimension=force_dimension) finally: runner.__exit__(None, None, None) return result
def generate_gmsh(source, dimensions=None, order=None, other_options=[], extension="geo", gmsh_executable="gmsh", force_ambient_dim=None, output_file_name="output.msh"): """Run :command:`gmsh` on the input given by *source*, and return a :class:`meshmode.mesh.Mesh` based on the result. :arg source: an instance of either :class:`FileSource` or :class:`LiteralSource` :arg force_ambient_dim: if not None, truncate point coordinates to this many dimensions. """ recv = GmshMeshReceiver() from meshpy.gmsh import GmshRunner from meshpy.gmsh_reader import parse_gmsh with GmshRunner(source, dimensions, order=order, other_options=other_options, extension=extension, gmsh_executable=gmsh_executable) as runner: parse_gmsh(recv, runner.output_file, force_dimension=force_ambient_dim) mesh = recv.get_mesh() if force_ambient_dim is None: AXIS_NAMES = "xyz" # noqa dim = mesh.vertices.shape[0] for idim in range(dim): if (mesh.vertices[idim] == 0).all(): from warnings import warn warn( "all vertices' %s coordinate is zero--perhaps you want to pass " "force_ambient_dim=%d (pass any fixed value to " "force_ambient_dim to silence this warning)" % (AXIS_NAMES[idim], idim)) break return mesh