Methods to read and write graphs.
◆ read_polygon_mesh()
template<class Graph , typename NamedParameters = parameters::Default_named_parameters>
bool CGAL::IO::read_polygon_mesh |
( |
const std::string & |
fname, |
|
|
Graph & |
g, |
|
|
const NamedParameters & |
np = parameters::default_values() |
|
) |
| |
#include <CGAL/boost/graph/IO/polygon_mesh_io.h>
reads a polygon mesh from a file.
Supported file formats are the following:
The format is detected from the filename extension (letter case is not important).
The data is expected to represent a 2-manifold (possibly with borders).
- Template Parameters
-
- Parameters
-
- 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 .
|
|
-
whether extra information is printed when an incident occurs during reading
-
Type: Boolean
-
Default:
false
| |
Other named parameters may be used according to the file extension, see I/O Functions for an exhaustive list.
- Returns
true
if reading was successful, false
otherwise.
- See also
CGAL::Polygon_mesh_processing::IO::read_polygon_mesh()
if the data is not 2-manifold
◆ write_polygon_mesh()
template<class Graph , typename NamedParameters = parameters::Default_named_parameters>
bool CGAL::IO::write_polygon_mesh |
( |
const std::string & |
fname, |
|
|
Graph & |
g, |
|
|
const NamedParameters & |
np = parameters::default_values() |
|
) |
| |
#include <CGAL/boost/graph/IO/polygon_mesh_io.h>
writes a polygon mesh in a file.
Supported file formats are the following:
The format is detected from the filename extension (letter case is not important).
- Template Parameters
-
- Parameters
-
fname | the name of the file |
g | the mesh to be output |
np | optional Named Parameters described below |
- Optional Named Parameters
-
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 parameter used to set the precision (i.e. how many digits are generated) of the output stream
-
Type: int
-
Default:
6
-
Extra: This parameter is only meaningful while using ASCII encoding.
|
|
-
indicates whether data should be written in binary (
true ) or in ASCII (false )
-
Type: Boolean
-
Default:
true
-
Extra: This parameter is only meaningful for formats that support binary encoding.
|
|
-
whether extra information is printed when an incident occurs during reading
-
Type: Boolean
-
Default:
false
| |
Other named parameters may be used according to the file extension, see I/O Functions for an exhaustive list.
- Returns
true
if writing was successful, false
otherwise.
- Examples:
- BGL_surface_mesh/surface_mesh_partition.cpp.