CGAL 5.6.2 - 3D Simplicial Mesh Data Structures

The free functions that can be used to read and write meshes.

Functions

template<class C3T3 >
bool CGAL::IO::save_binary_file (std::ostream &os, const C3T3 &c3t3)
 outputs a mesh complex to the CGAL binary file format (.binary.cgal). More...
 
template<class C3T3 >
bool CGAL::IO::load_binary_file (std::istream &is, C3T3 &c3t3)
 loads a mesh complex from a file written in CGAL binary file format (.binary.cgal). More...
 
template<class C3T3 >
void CGAL::IO::output_to_medit (std::ostream &os, const C3T3 &c3t3, bool rebind, bool show_patches)
 outputs a mesh complex to the medit (.mesh) file format. See [1] for a comprehensive description of this file format. More...
 
template<typename T3 , typename NamedParameters = parameters::Default_named_parameters>
void CGAL::IO::write_MEDIT (std::ostream &os, const T3 &t3, const NamedParameters &np=parameters::default_values())
 outputs a mesh complex to the medit (.mesh) file format. More...
 
template<typename T3 , typename CornerIndex , typename CurveIndex , typename NamedParameters = parameters::Default_named_parameters>
void CGAL::IO::write_MEDIT (std::ostream &os, const CGAL::Mesh_complex_3_in_triangulation_3< T3, CornerIndex, CurveIndex > &c3t3, const NamedParameters &np=parameters::default_values())
 outputs a mesh complex to the medit (.mesh) file format. More...
 
template<typename T3 , typename NamedParameters = CGAL::parameters::Default_named_parameters>
bool CGAL::IO::read_MEDIT (std::istream &in, T3 &t3, const NamedParameters &np=parameters::default_values())
 reads a mesh complex written in the medit (.mesh) file format. More...
 

Function Documentation

◆ load_binary_file()

template<class C3T3 >
bool CGAL::IO::load_binary_file ( std::istream &  is,
C3T3 &  c3t3 
)

#include <CGAL/IO/File_binary_mesh_3.h>

loads a mesh complex from a file written in CGAL binary file format (.binary.cgal).

Template Parameters
C3T3Type of mesh complex, model of MeshComplex_3InTriangulation_3
Parameters
isthe input stream, opened in binary mode
c3t3the mesh complex
See also
CGAL::IO::save_binary_file()

◆ output_to_medit()

template<class C3T3 >
void CGAL::IO::output_to_medit ( std::ostream &  os,
const C3T3 &  c3t3,
bool  rebind,
bool  show_patches 
)

#include <CGAL/IO/File_medit.h>

outputs a mesh complex to the medit (.mesh) file format. See [1] for a comprehensive description of this file format.

Deprecated:
This function is deprecated.

Users should instead use CGAL::IO::write_MEDIT()

Parameters
osthe output stream
c3t3the mesh complex
rebindif true, labels of cells are rebinded into [1..nb_of_labels]
show_patchesif true, patches are labeled with different labels than cells. If false, each surface facet is written twice, using the label of each adjacent cell.
See also
Medit File Format

◆ read_MEDIT()

template<typename T3 , typename NamedParameters = CGAL::parameters::Default_named_parameters>
bool CGAL::IO::read_MEDIT ( std::istream &  in,
T3 &  t3,
const NamedParameters &  np = parameters::default_values() 
)

#include <CGAL/IO/File_medit.h>

reads a mesh complex written in the medit (.mesh) file format.

See [1] for a comprehensive description of this file format.

Template Parameters
T3can be instantiated with any 3D triangulation of CGAL provided that its vertex and cell base class are models of the concepts MeshVertexBase_3 and MeshCellBase_3, respectively.
NamedParametersa sequence of Named Parameters
Parameters
inthe input stream
t3the triangulation
npoptional Named Parameters described below
Optional Named Parameters
  • indicates whether output warnings and error messages should be printed or not.
  • Type: Boolean
  • Default: false
  • allows the construction of a triangulation with non-manifold edges and non manifold vertices. The triangulation is invalid if this situation is met, so it should be used only in advanced cases, and the triangulation will be hardly usable.
  • Type: bool
  • Default: false
Returns
true if the connectivity of the triangulation could be built consistently from in, and false if the triangulation is empty, or if the connectivity of t3 could not be built. If false is returned, t3 is empty when the function returns.

This function reads the data about vertices, surface facets, and triangulation cells from in, and builds a valid T3 from it.

Note that a valid 3D triangulation of CGAL must have a valid data structure (see TriangulationDataStructure_3), positively oriented cells, and cover the geometric convex hull of all points in t3.

Examples:
SMDS_3/c3t3_example.cpp.

◆ save_binary_file()

template<class C3T3 >
bool CGAL::IO::save_binary_file ( std::ostream &  os,
const C3T3 &  c3t3 
)

#include <CGAL/IO/File_binary_mesh_3.h>

outputs a mesh complex to the CGAL binary file format (.binary.cgal).

Template Parameters
C3T3Type of mesh complex, model of MeshComplex_3InTriangulation_3
Parameters
osthe output stream, opened in binary mode
c3t3the mesh complex
See also
CGAL::IO::load_binary_file()

◆ write_MEDIT() [1/2]

template<typename T3 , typename NamedParameters = parameters::Default_named_parameters>
void CGAL::IO::write_MEDIT ( std::ostream &  os,
const T3 &  t3,
const NamedParameters &  np = parameters::default_values() 
)

#include <CGAL/IO/File_medit.h>

outputs a mesh complex to the medit (.mesh) file format.

See [1] for a comprehensive description of this file format.

Template Parameters
T3can be instantiated with any 3D triangulation of CGAL provided that its vertex and cell base class are models of the concepts SimplicialMeshVertexBase_3 and SimplicialMeshCellBase_3, respectively.
NamedParametersa sequence of Named Parameters
Parameters
osthe output stream
t3the triangulation
npan optional sequence of Named Parameters among the ones listed below
Optional Named Parameters
  • If true, all the cells in t3 are written in os, whether they belong to the complex or not. Otherwise, only the cells c for which c->subdomain_index() != Subdomain_index() are written.
  • Type: Boolean
  • Default: true
  • Extra: This parameter must be set to true for the file to be readable by read_MEDIT().

  • If true, all the finite vertices in t3 are written in os. Otherwise, only the vertices that belong to a cell c for which c->subdomain_index() != Subdomain_index() are written
  • Type: Boolean
  • Default: true
  • Extra: If all_cells is true, the value of this parameter is ignored and all vertices are written in os. It must be set to true for the file to be readable by read_MEDIT().

  • If true, labels of cells are rebinded into [1..nb_of_labels]
  • Type: Boolean
  • Default: false

  • If true, patches are labeled with different labels than cells. If false, each surface facet is written twice, using the label of each adjacent cell.
  • Type: Boolean
  • Default: true
See also
Medit File Format
Examples:
SMDS_3/c3t3_example.cpp, and SMDS_3/tetrahedron_soup_to_c3t3_example.cpp.

◆ write_MEDIT() [2/2]

template<typename T3 , typename CornerIndex , typename CurveIndex , typename NamedParameters = parameters::Default_named_parameters>
void CGAL::IO::write_MEDIT ( std::ostream &  os,
const CGAL::Mesh_complex_3_in_triangulation_3< T3, CornerIndex, CurveIndex > &  c3t3,
const NamedParameters &  np = parameters::default_values() 
)

#include <CGAL/IO/File_medit.h>

outputs a mesh complex to the medit (.mesh) file format.

See [1] for a comprehensive description of this file format.

Template Parameters
T3can be instantiated with any 3D triangulation of CGAL provided that its vertex and cell base class are models of the concepts MeshVertexBase_3 and MeshCellBase_3, respectively.
CornerIndexis the type of the indices for corners
CurveIndexis the type of the indices for curves
NamedParametersa sequence of Named Parameters
Parameters
osthe output stream
c3t3the mesh complex
npan optional sequence of Named Parameters among the ones listed below
Optional Named Parameters
  • If true, all the cells in t3 are written in os, whether they belong to the complex or not. Otherwise, only the cells c for which c->subdomain_index() != Subdomain_index() are written.
  • Type: Boolean
  • Default: true
  • Extra: If the complex does not form a topological sphere, this parameter must be set to true for the file to be readable by read_MEDIT(). Otherwise the underlying triangulation data structure will not be valid.

  • If true, all the vertices in t3 are written in os. Otherwise, only the vertices that belong to a cell c for which c->subdomain_index() != Subdomain_index() are written
  • Type: Boolean
  • Default: true
  • Extra: If all_cells is true, the value of this parameter is ignored and all vertices are written in os. If the complex does not form a topological sphere, it must be set to true for the file to be readable by read_MEDIT(). Otherwise the underlying triangulation data structure will not be valid.

  • If true, labels of cells are rebinded into [1..nb_of_labels]
  • Type: Boolean
  • Default: false

  • If true, patches are labeled with different labels than cells. If false, each surface facet is written twice, using the label of each adjacent cell.
  • Type: Boolean
  • Default: true
See also
Medit File Format