Reading Gmsh Meshes#

exception gmsh_interop.reader.GmshFileFormatError[source]#

Element types#

class gmsh_interop.reader.GmshElementBase(order)[source]#
vertex_count()[source]#
node_count()[source]#
lexicographic_node_tuples()[source]#

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()[source]#

(Implemented by subclasses)

Simplex Elements#

class gmsh_interop.reader.GmshSimplexElementBase(order)[source]#
class gmsh_interop.reader.GmshPoint(order)[source]#
class gmsh_interop.reader.GmshIntervalElement(order)[source]#
class gmsh_interop.reader.GmshTriangularElement(order)[source]#
class gmsh_interop.reader.GmshIncompleteTriangularElement(order)[source]#
class gmsh_interop.reader.GmshTetrahedralElement(order)[source]#

Tensor Product Elements#

class gmsh_interop.reader.GmshTensorProductElementBase(order)[source]#
class gmsh_interop.reader.GmshQuadrilateralElement(order)[source]#
class gmsh_interop.reader.GmshHexahedralElement(order)[source]#

Receiver interface#

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

Receiver example implementation#

class gmsh_interop.reader.GmshMeshReceiverNumPy[source]#

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)[source]#

New in version 2016.1.

class gmsh_interop.reader.FileSource(filename)[source]#

New in version 2014.1.

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

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)[source]#

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, target_unit=None, output_file_name=None, save_tmp_files_in=None)[source]#

Run gmsh and feed the output to receiver.

Parameters: