Reading Gmsh Meshes

exception gmsh_interop.reader.GmshFileFormatError

Element types

class gmsh_interop.reader.GmshElementBase(order)
vertex_count()
node_count()
lexicographic_node_tuples()

Generate tuples enumerating the node indices present in this element. Each tuple has a length equal to the dimension of the element. The tuples constituents are non-negative integers whose sum is less than or equal to the order of the element.

get_lexicographic_gmsh_node_indices()

(Implemented by subclasses)

Simplex Elements

class gmsh_interop.reader.GmshSimplexElementBase(order)
class gmsh_interop.reader.GmshPoint(order)
class gmsh_interop.reader.GmshIntervalElement(order)
class gmsh_interop.reader.GmshTriangularElement(order)
class gmsh_interop.reader.GmshIncompleteTriangularElement(order)
class gmsh_interop.reader.GmshTetrahedralElement(order)

Tensor Product Elements

class gmsh_interop.reader.GmshTensorProductElementBase(order)
class gmsh_interop.reader.GmshQuadrilateralElement(order)
class gmsh_interop.reader.GmshHexahedralElement(order)

Receiver interface

class gmsh_interop.reader.GmshMeshReceiverBase
gmsh_element_type_to_info_map
set_up_nodes(count)
add_node(node_nr, point)
finalize_nodes()
set_up_elements(count)
add_element(element_nr, element_type, vertex_nrs, lexicographic_nodes, tag_numbers)
finalize_elements()
add_tag(name, index, dimension)
finalize_tags()

Receiver example implementation

class gmsh_interop.reader.GmshMeshReceiverNumPy

GmshReceiver that emulates the semantics of meshpy.triangle.MeshInfo and meshpy.tet.MeshInfo by using similar fields, but instead of loading data into ForeignArrays, load into NumPy arrays. Since this class is not wrapping any libraries in other languages – the Gmsh data is obtained via parsing text – use numpy arrays as the base array data structure for convenience.

New in version 2014.1.

Reader

class gmsh_interop.reader.ScriptSource(source, extension)

New in version 2016.1.

class gmsh_interop.reader.FileSource(filename)

New in version 2014.1.

class gmsh_interop.reader.ScriptWithFilesSource(source, filenames, source_name='temp.geo')

New in version 2016.1.

source

The script code to be fed to gmsh.

filenames

The names of files to be copied to the temporary directory where gmsh is run.

gmsh_interop.reader.read_gmsh(receiver, filename, force_dimension=None)

Read a gmsh mesh file from filename and feed it to receiver.

Parameters
  • receiver – Implements the GmshMeshReceiverBase interface.

  • force_dimension – if not None, truncate point coordinates to this many dimensions.

gmsh_interop.reader.generate_gmsh(receiver, source, dimensions=None, order=None, other_options=[], extension='geo', gmsh_executable='gmsh', force_dimension=None, output_file_name=None, save_tmp_files_in=None)

Run gmsh and feed the output to receiver.

Parameters