CGAL 6.0 - CGAL and the Boost Graph Library
Loading...
Searching...
No Matches

I/O Functions for the VTK (VTU / VTP / legacy) File Formats.

Functions

template<typename Graph , typename NamedParameters = CGAL::parameters::Default_named_parameters>
bool CGAL::IO::read_VTP (const std::string &fname, Graph &g, const NamedParameters &np=parameters::default_values())
 reads a PolyData in the VTK (VTU / VTP / legacy) File Formats into a triangulated surface mesh.
 
template<typename Graph , typename NamedParameters = CGAL::parameters::Default_named_parameters>
bool CGAL::IO::write_VTP (std::ostream &os, const Graph &g, const NamedParameters &np=parameters::default_values())
 writes a triangulated surface mesh in the PolyData XML format (VTK (VTU / VTP / legacy) File Formats).
 
template<typename Graph , typename NamedParameters = CGAL::parameters::Default_named_parameters>
bool CGAL::IO::write_VTP (const std::string &fname, const Graph &g, const NamedParameters &np=parameters::default_values())
 writes a triangulated surface mesh the file fname, in the PolyData XML format (VTK (VTU / VTP / legacy) File Formats).
 

Function Documentation

◆ read_VTP()

template<typename Graph , typename NamedParameters = CGAL::parameters::Default_named_parameters>
bool CGAL::IO::read_VTP ( const std::string &  fname,
Graph &  g,
const NamedParameters &  np = parameters::default_values() 
)

#include <CGAL/boost/graph/IO/VTK.h>

reads a PolyData in the VTK (VTU / VTP / legacy) File Formats into a triangulated surface mesh.

The data is expected to represent a 2-manifold (possibly with borders).

Attention
The graph g is not cleared, and the data from the file are appended.
Template Parameters
Grapha model of MutableFaceGraph
NamedParametersa sequence of Named Parameters
Parameters
fnamethe path to the file that will be read
gthe output mesh
npoptional Named Parameters described below
Optional Named Parameters
  • a property map associating points to the vertices of g
  • Type: a class model of WritablePropertyMap with boost::graph_traits<Graph>::vertex_descriptor as key type and Point_3 as value type
  • Default: boost::get(CGAL::vertex_point, g)
  • Extra: If this parameter is omitted, an internal property map for CGAL::vertex_point_t must be available in Graph.

Returns
true if reading was successful, false otherwise.

◆ write_VTP() [1/2]

template<typename Graph , typename NamedParameters = CGAL::parameters::Default_named_parameters>
bool CGAL::IO::write_VTP ( const std::string &  fname,
const Graph &  g,
const NamedParameters &  np = parameters::default_values() 
)

#include <CGAL/boost/graph/IO/VTK.h>

writes a triangulated surface mesh the file fname, in the PolyData XML format (VTK (VTU / VTP / legacy) File Formats).

Template Parameters
Grapha model of FaceListGraph
NamedParametersa sequence of Named Parameters
Parameters
fnamethe name of the output file
gthe triangle mesh to be output
npoptional sequence of Named Parameters among the ones listed below
Optional Named Parameters
  • indicates whether data should be written in binary (true) or in ASCII (false)
  • Type: Boolean
  • Default: true

  • a property map associating points to the vertices of g
  • Type: a class model of ReadablePropertyMap with boost::graph_traits<Graph>::vertex_descriptor as key type and Point_3 as value type
  • Default: boost::get(CGAL::vertex_point, g)
  • Extra: If this parameter is omitted, an internal property map for CGAL::vertex_point_t must be available in Graph.

  • a property map associating to each vertex of graph a unique index between 0 and num_vertices(graph) - 1
  • Type: a class model of ReadablePropertyMap with boost::graph_traits<Graph>::vertex_descriptor as key type and std::size_t as value type
  • Default: no vertex indices in the output

  • a parameter used to set the precision (i.e. how many digits are generated) of the output stream
  • Type: int
  • Default: 6
Precondition
g contains only triangular faces
Returns
true if writing was successful, false otherwise.

◆ write_VTP() [2/2]

template<typename Graph , typename NamedParameters = CGAL::parameters::Default_named_parameters>
bool CGAL::IO::write_VTP ( std::ostream &  os,
const Graph &  g,
const NamedParameters &  np = parameters::default_values() 
)

#include <CGAL/boost/graph/IO/VTK.h>

writes a triangulated surface mesh in the PolyData XML format (VTK (VTU / VTP / legacy) File Formats).

Template Parameters
Grapha model of FaceListGraph
NamedParametersa sequence of Named Parameters
Parameters
osthe output stream
gthe triangle mesh to be output
npoptional sequence of Named Parameters among the ones listed below
Optional Named Parameters
  • indicates whether data should be written in binary (true) or in ASCII (false)
  • Type: Boolean
  • Default: true

  • a property map associating points to the vertices of g
  • Type: a class model of ReadablePropertyMap with boost::graph_traits<Graph>::vertex_descriptor as key type and Point_3 as value type
  • Default: boost::get(CGAL::vertex_point, g)
  • Extra: If this parameter is omitted, an internal property map for CGAL::vertex_point_t must be available in Graph.

  • a property map associating to each vertex of graph a unique index between 0 and num_vertices(graph) - 1
  • Type: a class model of ReadablePropertyMap with boost::graph_traits<Graph>::vertex_descriptor as key type and std::size_t as value type
  • Default: no vertex indices in the output

  • a parameter used to set the precision (i.e. how many digits are generated) of the output stream
  • Type: int
  • Default: the precision of the stream os
Precondition
g contains only triangular faces
Returns
true if writing was successful, false otherwise.