meshmagick.mmio module

meshmagick.mmio.know_extension(ext)[source]
meshmagick.mmio.load_DAT(filename)[source]

Loads .DAT files used in DIODORE (PRINCIPIA (c))

meshmagick.mmio.load_GDF(filename)[source]

Loads WAMIT (Wamit INC. (c)) GDF mesh files.

As GDF file format maintains a redundant set of vertices for each faces of the mesh, it returns a merged list of nodes and connectivity array by using the merge_duplicates function.

Parameters

filename (str) – name of the meh file on disk

Returns

  • vertices (ndarray) – numpy array of the coordinates of the mesh’s nodes

  • faces (ndarray) – numpy array of the faces’ nodes connectivities

Note

GDF files have a 1-indexing

meshmagick.mmio.load_HST(filename)[source]

Loads HYDROSTAR (Bureau Veritas (c)) mesh files.

Parameters

filename (str) – name of the meh file on disk

Returns

  • vertices (ndarray) – numpy array of the coordinates of the mesh’s nodes

  • faces (ndarray) – numpy array of the faces’ nodes connectivities

Note

HST files have a 1-indexing

meshmagick.mmio.load_INP(filename)[source]

Loads DIODORE (PRINCIPIA (c)) configuration file format.

It parses the .INP file and extract meshes defined in subsequent .DAT files using the different informations contained in the .INP file.

Parameters

filename (str) – name of the meh file on disk

Returns

  • vertices (ndarray) – numpy array of the coordinates of the mesh’s nodes

  • faces (ndarray) – numpy array of the faces’ nodes connectivities

Note

INP/DAT files use a 1-indexing

meshmagick.mmio.load_MAR(filename)[source]

Loads Nemoh (Ecole Centrale de Nantes) mesh files.

Parameters

filename (str) – name of the meh file on disk

Returns

  • vertices (ndarray) – numpy array of the coordinates of the mesh’s nodes

  • faces (ndarray) – numpy array of the faces’ nodes connectivities

Note

MAR files have a 1-indexing

meshmagick.mmio.load_MED(filename)[source]

Loads MED mesh files generated by SALOME MECA.

Parameters

filename (str) – name of the meh file on disk

Returns

  • vertices (ndarray) – numpy array of the coordinates of the mesh’s nodes

  • faces (ndarray) – numpy array of the faces’ nodes connectivities

Note

MED files have a 1-indexing

meshmagick.mmio.load_MSH(filename)[source]

Loads .MSH mesh files generated by GMSH by C. Geuzaine and J.F. Remacle.

Parameters

filename (str) – name of the meh file on disk

Returns

  • vertices (ndarray) – numpy array of the coordinates of the mesh’s nodes

  • faces (ndarray) – numpy array of the faces’ nodes connectivities

Note

MSH files have a 1-indexing

meshmagick.mmio.load_NAT(filename)[source]

This function loads natural file format for meshes.

Parameters

filename (str) – name of the meh file on disk

Returns

  • vertices (ndarray) – array of the coordinates of the mesh’s nodes

  • faces (ndarray) – array of the faces nodes connectivity

Notes

The file format is as follow:

xsym    ysym
n    m
x1    y1    z1
.
.
.
xn    yn    zn
i1    j1    k1    l1
.
.
.
im    jm    km    lm

where : n : number of nodes m : number of cells x1 y1 z1 : cartesian coordinates of node 1 i1 j1 k1 l1 : counterclock wise Ids of nodes for cell 1 if cell 1 is a triangle, i1==l1

Note

NAT files have a 1-indexing

meshmagick.mmio.load_NEM(filename)[source]

Loads mesh files that are used by the Mesh tool included in Nemoh.

Parameters

filename (str) – name of the meh file on disk

Returns

  • vertices (ndarray) – numpy array of the coordinates of the mesh’s nodes

  • faces (ndarray) – numpy array of the faces’ nodes connectivities

Note

This format is different from that is used directly by Nemoh software. It is only dedicated to the Mesh tool.

meshmagick.mmio.load_OBJ(filename)[source]

Loads Wavefront OBJ file format.

It relies on the reader from the VTK library.

Parameters

filename (str) – name of the mesh file on disk

Returns

  • vertices (ndarray) – numpy array of the coordinates of the mesh’s nodes

  • faces (ndarray) – numpy array of the faces’ nodes connectivities

Note

VTU files have a 0-indexing

meshmagick.mmio.load_RAD(filename)[source]

Loads RADIOSS mesh files. This export file format may be chosen in ICEM meshing program.

Parameters

filename (str) – name of the meh file on disk

Returns

  • vertices (ndarray) – numpy array of the coordinates of the mesh’s nodes

  • faces (ndarray) – numpy array of the faces’ nodes connectivities

Note

RAD files have a 1-indexing

meshmagick.mmio.load_STL(filename)[source]

Loads STL file format.

It relies on the reader from the VTK library. As STL file format maintains a redundant set of vertices for each faces of the mesh, it returns a merged list of nodes and connectivity array by using the merge_duplicates function.

Parameters

filename (str) – name of the meh file on disk

Returns

  • vertices (ndarray) – numpy array of the coordinates of the mesh’s nodes

  • faces (ndarray) – numpy array of the faces’ nodes connectivities

Note

STL files have a 0-indexing

meshmagick.mmio.load_TEC(filename)[source]

Loads TECPLOT (Tecplot (c)) mesh files.

It relies on the tecplot file reader from the VTK library.

Parameters

filename (str) – name of the meh file on disk

Returns

  • vertices (ndarray) – numpy array of the coordinates of the mesh’s nodes

  • faces (ndarray) – numpy array of the faces’ nodes connectivities

Note

TEC files have a 1-indexing

meshmagick.mmio.load_VTK(filename)[source]

Loads VTK file format in the legacy format (vtk file extension).

It relies on the reader from the VTK library.

Parameters

filename (str) – name of the mesh file on disk

Returns

  • vertices (ndarray) – numpy array of the coordinates of the mesh’s nodes

  • faces (ndarray) – numpy array of the faces’ nodes connectivities

Note

VTU files have a 0-indexing

meshmagick.mmio.load_VTP(filename)[source]

Loads VTK file format in the new XML format (vtp file extension for polydata meshes).

It relies on the reader from the VTK library.

Parameters

filename (str) – name of the meh file on disk

Returns

  • vertices (ndarray) – numpy array of the coordinates of the mesh’s nodes

  • faces (ndarray) – numpy array of the faces’ nodes connectivities

Note

VTP files have a 0-indexing

meshmagick.mmio.load_VTU(filename)[source]

Loads VTK file format in the new XML format (vtu file extension for unstructured meshes).

It relies on the reader from the VTK library.

Parameters

filename (str) – name of the meh file on disk

Returns

  • vertices (ndarray) – numpy array of the coordinates of the mesh’s nodes

  • faces (ndarray) – numpy array of the faces’ nodes connectivities

Note

VTU files have a 0-indexing

meshmagick.mmio.load_WRL(filename)[source]

Loads VRML 2.0 mesh files.

Parameters

filename (str) – name of the meh file on disk

Returns

  • vertices (ndarray) – numpy array of the coordinates of the mesh’s nodes

  • faces (ndarray) – numpy array of the faces’ nodes connectivities

meshmagick.mmio.load_mesh(filename, file_format)[source]

Driver function that loads every mesh file format known by meshmagick and returns the node list and the connectivity array

Parameters
  • filename (str) – name of the meh file on disk

  • file_format (str) – format of the mesh defined in the extension_dict dictionary

Returns

  • vertices (ndarray) – numpy array of the coordinates of the mesh’s nodes

  • faces (ndarray) – numpy array of the faces’ nodes connectivities

meshmagick.mmio.write_DAT(filename, vertices, faces)[source]

Writes .DAT file format for the DIODORE (PRINCIPA (c)) software.

It also displays suggestions for inclusion into the .INP configuration file.

Parameters
  • filename (str) – name of the mesh file to be written on disk

  • vertices (ndarray) – numpy array of the coordinates of the mesh’s nodes

  • faces (ndarray) – numpy array of the faces’ nodes connectivities

meshmagick.mmio.write_GDF(filename, vertices, faces)[source]

Writes .gdf file format for the WAMIT (Wamit INC. (c)) BEM software.

Parameters
  • filename (str) – name of the mesh file to be written on disk

  • vertices (ndarray) – numpy array of the coordinates of the mesh’s nodes

  • faces (ndarray) – numpy array of the faces’ nodes connectivities

meshmagick.mmio.write_HST(filename, vertices, faces)[source]

Writes .HST file format for the HYDROSTAR (Bureau Veritas (c)) software.

Parameters
  • filename (str) – name of the mesh file to be written on disk

  • vertices (ndarray) – numpy array of the coordinates of the mesh’s nodes

  • faces (ndarray) – numpy array of the faces’ nodes connectivities

meshmagick.mmio.write_INP(filename, vertices, faces)[source]
meshmagick.mmio.write_MAR(filename, vertices, faces)[source]

Writes mesh files to be used with Nemoh BEM software (Ecole Centrale de Nantes)

Parameters
  • filename (str) – name of the mesh file to be written on disk

  • vertices (ndarray) – numpy array of the coordinates of the mesh’s nodes

  • faces (ndarray) – numpy array of the faces’ nodes connectivities

meshmagick.mmio.write_MED(filename, vertices, faces)[source]
meshmagick.mmio.write_MSH(filename, vertices, faces)[source]
meshmagick.mmio.write_NAT(filename, vertices, faces)[source]

Writes .nat file format as defined into the load_NAT function.

Parameters
  • filename (str) – name of the mesh file to be written on disk

  • vertices (ndarray) – numpy array of the coordinates of the mesh’s nodes

  • faces (ndarray) – numpy array of the faces’ nodes connectivities

See also

load_NAT

meshmagick.mmio.write_NEM(filename, vertices, faces)[source]

Writes mesh files used by the Mesh tool included in Nemoh

Parameters
  • filename (str) – name of the mesh file to be written on disk

  • vertices (ndarray) – numpy array of the coordinates of the mesh’s nodes

  • faces (ndarray) – numpy array of the faces’ nodes connectivities

Note

This file format is different from that used by Nemoh itself. It is only used by the Mesh tool.

meshmagick.mmio.write_OBJ(filename, vertices, faces)[source]
meshmagick.mmio.write_RAD(filename, vertices, faces)[source]
meshmagick.mmio.write_STL(filename, vertices, faces)[source]

Writes .stl file format. It relies on the VTK library for its writer.

Parameters
  • filename (str) – name of the mesh file to be written on disk

  • vertices (ndarray) – numpy array of the coordinates of the mesh’s nodes

  • faces (ndarray) – numpy array of the faces’ nodes connectivities

meshmagick.mmio.write_TEC(filename, vertices, faces)[source]

Writes .TEC file format for the TECPLOT (Tecplot (c)) visualisation software.

It relies on the VTK library for its writer.

Parameters
  • filename (str) – name of the mesh file to be written on disk

  • vertices (ndarray) – numpy array of the coordinates of the mesh’s nodes

  • faces (ndarray) – numpy array of the faces’ nodes connectivities

meshmagick.mmio.write_VTK(filename, vertices, faces)[source]

Writes .vtk file format for the Paraview (Kitware (c)) visualisation software.

It relies on the VTK library for its writer. VTK files use the legagy ASCII file format of the VTK library.

Parameters
  • filename (str) – name of the mesh file to be written on disk

  • vertices (ndarray) – numpy array of the coordinates of the mesh’s nodes

  • faces (ndarray) – numpy array of the faces’ nodes connectivities

meshmagick.mmio.write_VTP(filename, vertices, faces)[source]

Writes .vtp file format for the Paraview (Kitware (c)) visualisation software.

It relies on the VTK library for its writer. VTP files use the last XML file format of the VTK library and correspond to polydata.

Parameters
  • filename (str) – name of the mesh file to be written on disk

  • vertices (ndarray) – numpy array of the coordinates of the mesh’s nodes

  • faces (ndarray) – numpy array of the faces’ nodes connectivities

meshmagick.mmio.write_VTU(filename, vertices, faces)[source]

Writes .vtu file format for the paraview (Kitware (c)) visualisation software.

It relies on the VTK library for its writer. VTU files use the last XML file format of the VTK library.

Parameters
  • filename (str) – name of the mesh file to be written on disk

  • vertices (ndarray) – numpy array of the coordinates of the mesh’s nodes

  • faces (ndarray) – numpy array of the faces’ nodes connectivities

meshmagick.mmio.write_WRL(filename, vertices, faces)[source]
meshmagick.mmio.write_mesh(filename, vertices, faces, file_format)[source]

Driver function that writes every mesh file file_format known by meshmagick

Parameters
  • filename (str) – name of the mesh file to be written on disk

  • vertices (ndarray) – numpy array of the coordinates of the mesh’s nodes

  • faces (ndarray) – numpy array of the faces’ nodes connectivities

  • file_format (str) – file_format of the mesh defined in the extension_dict dictionary