capytaine.io.mesh_writers module¶
Functions to write mesh to different file formats. Based on meshmagick <https://github.com/LHEEA/meshmagick> by François Rongère.
- capytaine.io.mesh_writers.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
- capytaine.io.mesh_writers.write_GDF(filename, vertices, faces, ulen=100.0, gravity=9.81, isx=0, isy=0)[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
ulen (float, optional) – length scale. The default is 100.0
gravity (float, optional) – acceleration of gravity. The default is 9.81
isx ({0, 1}, optional) – symmetry in x-axis. The default is 0
isy ({0, 1}, optional) – symmetry in y-axis. The default is 0
- capytaine.io.mesh_writers.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
- capytaine.io.mesh_writers.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
- capytaine.io.mesh_writers.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
- capytaine.io.mesh_writers.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.
- capytaine.io.mesh_writers.write_PNL(filename, vertices, faces)[source]¶
Write a mesh to a file using HAMS file format.
Took some inspiration from “nemohmesh_to_pnl” by Garett Barter https://github.com/WISDEM/pyHAMS/blob/d10b51122e92849c63640b34e4fa9d413eb306fd/pyhams/pyhams.py#L11
This writer does not support symmetries.
- 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
- capytaine.io.mesh_writers.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
- capytaine.io.mesh_writers.write_TEC(filename, vertices, faces)[source]¶
Writes .TEC file format for the TECPLOT (Tecplot (c)) visualisation 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
- capytaine.io.mesh_writers.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
- capytaine.io.mesh_writers.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
- capytaine.io.mesh_writers.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
- capytaine.io.mesh_writers.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