capytaine.io.mesh_loaders module

Functions to load meshes from different file formats. Based on meshmagick <https://github.com/LHEEA/meshmagick> by François Rongère.

capytaine.io.mesh_loaders.load_DAT(filename, name=None)[source]

Not implemented. Intended to load .DAT files used in DIODORE (PRINCIPIA (c))

capytaine.io.mesh_loaders.load_GDF(filename, name=None)[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 mesh file on disk

Returns:

the loaded mesh

Return type:

Mesh or ReflectionSymmetricMesh

Note

GDF files have a 1-indexing

capytaine.io.mesh_loaders.load_HST(filename, name=None)[source]

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

Parameters:

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

Returns:

the loaded mesh

Return type:

Mesh

Note

HST files have a 1-indexing

capytaine.io.mesh_loaders.load_INP(filename, name=None)[source]

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

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

Parameters:

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

Returns:

the loaded mesh

Return type:

Mesh

Note

INP/DAT files use a 1-indexing

capytaine.io.mesh_loaders.load_MAR(filename, name=None)[source]

Loads Nemoh (Ecole Centrale de Nantes) mesh files.

Parameters:

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

Returns:

the loaded mesh

Return type:

Mesh or ReflectionSymmetry

Note

MAR files have a 1-indexing

capytaine.io.mesh_loaders.load_MED(filename, name=None)[source]

Loads MED mesh files generated by SALOME MECA.

Parameters:

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

Returns:

the loaded mesh

Return type:

Mesh

Note

MED files have a 1-indexing

capytaine.io.mesh_loaders.load_MSH(filename, name=None)[source]

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

Parameters:

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

Returns:

the loaded mesh

Return type:

Mesh

Note

MSH files have a 1-indexing

capytaine.io.mesh_loaders.load_NAT(filename, name=None)[source]

This function loads natural file format for meshes.

Parameters:

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

Returns:

the loaded mesh

Return type:

Mesh

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

capytaine.io.mesh_loaders.load_NEM(filename, name=None)[source]

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

Parameters:

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

Returns:

the loaded mesh

Return type:

Mesh

Note

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

capytaine.io.mesh_loaders.load_PNL(filename, name=None)[source]

Load mesh using HAMS file format.

Parameters:

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

Returns:

the loaded mesh

Return type:

Mesh or ReflectionSymmetricMesh

capytaine.io.mesh_loaders.load_RAD(filename, name=None)[source]

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

Parameters:

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

Returns:

the loaded mesh

Return type:

Mesh

Note

RAD files have a 1-indexing

capytaine.io.mesh_loaders.load_STL(filename, name=None)[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 mesh file on disk

Returns:

the loaded mesh

Return type:

Mesh

Note

STL files have a 0-indexing

capytaine.io.mesh_loaders.load_TEC(filename, name=None)[source]

Loads TECPLOT (Tecplot (c)) mesh files.

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

Parameters:

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

Returns:

the loaded mesh

Return type:

Mesh

Note

TEC files have a 1-indexing

capytaine.io.mesh_loaders.load_VTK(filename, name=None)[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:

the loaded mesh

Return type:

Mesh

Note

VTU files have a 0-indexing

capytaine.io.mesh_loaders.load_VTP(filename, name=None)[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 mesh file on disk

Returns:

the loaded mesh

Return type:

Mesh

Note

VTP files have a 0-indexing

capytaine.io.mesh_loaders.load_VTU(filename, name=None)[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 mesh file on disk

Returns:

the loaded mesh

Return type:

Mesh

Note

VTU files have a 0-indexing

capytaine.io.mesh_loaders.load_WRL(filename, name=None)[source]

Loads VRML 2.0 mesh files.

Parameters:

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

Returns:

the loaded mesh

Return type:

Mesh

capytaine.io.mesh_loaders.load_mesh(mesh, file_format=None, name=None)[source]

Driver function that loads every mesh file format known by meshmagick. Dispatch to one of the other function depending on file_format.

Parameters:
  • mesh (str or meshio object) – Either the path to the mesh on disk or a meshio object to be loaded with the dedicated method

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

  • name (str, optional) – name for the created mesh object

Returns:

the loaded mesh

Return type:

Mesh or SymmetricMesh