CGAL 6.1.1 - 3D Triangulations

Loading...
Searching...
No Matches
I/O for a Triangulation 3
Reference Manual

##

## I/O
The information in the `iostream` is: the dimension, the number of finite vertices, the non-combinatorial information about vertices (point, etc; note that the infinite vertex is numbered 0), the number of cells, the indices of the vertices of each cell, plus the non-combinatorial information about each cell, then the indices of the neighbors of each cell, where the index corresponds to the preceding list of cells. When dimension \( <\) 3, the same information is stored for faces of maximal dimension instead of cells.
istream & | CGAL::Triangulation_3< Traits, TDS, SLDS >::operator>> (istream &is, Triangulation_3 &t)
| Reads the underlying combinatorial triangulation from `is` by calling the corresponding input operator of the triangulation data structure class (note that the infinite vertex is numbered 0), and the non-combinatorial information by calling the corresponding input operators of the vertex and the cell classes (such as point coordinates), which are provided by overloading the stream operators of the vertex and cell types.
ostream & | CGAL::Triangulation_3< Traits, TDS, SLDS >::operator<< (ostream &os, const Triangulation_3 &t)
| Writes the triangulation `t` into `os`.
template<typename Tr_src , typename ConvertVertex , typename ConvertCell >
std::istream & | CGAL::Triangulation_3< Traits, TDS, SLDS >::file_input (std::istream &is, ConvertVertex convert_vertex=ConvertVertex(), ConvertCell convert_cell=ConvertCell())
| The triangulation streamed in `is`, of original type `Tr_src`, is written into the triangulation.

## Function Documentation

## ◆ file_input()

template<typename Traits , typename TDS , typename SLDS >
template<typename Tr_src , typename ConvertVertex , typename ConvertCell >

std::istream & CGAL::Triangulation_3< Traits, TDS, SLDS >::file_input | ( | std::istream & | is,
|  | ConvertVertex | convert_vertex = `ConvertVertex()`,
|  | ConvertCell | convert_cell = `ConvertCell()`
| ) |  |

`#include <CGAL/Triangulation_3.h>`

The triangulation streamed in `is`, of original type `Tr_src`, is written into the triangulation.

As the vertex and cell types might be different and incompatible, the creation of new cells and vertices is made thanks to the functors `convert_vertex` and `convert_cell`, that convert vertex and cell types. For each vertex `v_src` in `is`, the corresponding vertex `v_tgt` in the triangulation is a copy of the vertex returned by `convert_vertex(v_src)`. The same operations are done for cells with the functor convert_cell, except cells in the triangulation are created using the default constructor, and then filled with the data contained in the stream.

- A model of `ConvertVertex` must provide two `operator()`s that are responsible for converting the source vertex `v_src` into the target vertex:
  - `Vertex operator()(const Tr_src::Vertex& v_src) const;` This operator is used to create the vertex from `v_src`.
  - `void operator()(const Tr_src::Vertex& v_src, Vertex& v_tgt) const;` This operator is meant to be used in case heavy data should be transferred to `v_tgt`.
- A model of ConvertCell must provide an operator() that is responsible for converting the source cell `c_src` into the target cell:
  - `void operator()(const Tr_src::Cell& c_src, Cell& c_tgt) const;` This operator is meant to be used in case data should be transferred to `c_tgt`.

Note
  The triangulation contained in `is` can be obtained with the `operator>>` of a `Triangulation_3`.

## ◆ operator>>()

template<typename Traits , typename TDS , typename SLDS >

istream & CGAL::Triangulation_3< Traits, TDS, SLDS >::operator>> | ( | istream & | is,
|  | Triangulation_3< Traits, TDS, SLDS > & | t
| ) |  |

`#include <CGAL/Triangulation_3.h>`

Reads the underlying combinatorial triangulation from `is` by calling the corresponding input operator of the triangulation data structure class (note that the infinite vertex is numbered 0), and the non-combinatorial information by calling the corresponding input operators of the vertex and the cell classes (such as point coordinates), which are provided by overloading the stream operators of the vertex and cell types.

Assigns the resulting triangulation to `t`.