CGAL 6.3-dev - Homological Discrete Vector Fields
Loading...
Searching...
No Matches
CGAL::Homological_discrete_vector_field::Surface_mesh_io< TriangleMesh, Traits > Class Template Reference

#include <CGAL/HDVF/Surface_mesh_io.h>

Inherits from

CGAL::Homological_discrete_vector_field::Mesh_object_io< Traits >.

Definition

template<typename TriangleMesh, typename Traits>
class CGAL::Homological_discrete_vector_field::Surface_mesh_io< TriangleMesh, Traits >

The class Surface_mesh_io is an intermediate IO class, used to load the collection of simplices of a triangle mesh.

These collections are then used as input to produce Abstract_simplicial_chain_complex.

Template Parameters
TriangleMesha model of FaceGraph and HalfedgeGraph concepts, e.g., a CGAL::Surface_mesh.
Traitsa geometric traits class model of the HDVFTraits concept.

Classes

struct  Hole_information
 Hole information returned by the iterator. More...
struct  iterator
 Iterator over homology/cohomology generators of an Hdvf computed over a complex built from the initial surface mesh. More...

Public Types

typedef TriangleMesh Surface_mesh
 Type of the surface mesh.
typedef boost::graph_traits< Surface_mesh >::halfedge_descriptor halfedge_descriptor
 Type of halfedges of the surface mesh.
template<typename CoefficientRing>
using Simplex_chain = std::map<halfedge_descriptor, CoefficientRing>
 Type encoding chains on a surface mesh.
Public Types inherited from CGAL::Homological_discrete_vector_field::Mesh_object_io< Traits >
typedef Traits::Point Point
 Underlying point type.
typedef Traits::Bbox Bbox
 Bounding box type.

Public Member Functions

 Surface_mesh_io (const TriangleMesh &mesh)
 Constructor from a triangular mesh.
template<typename _CT>
size_t halfedge_handle_to_cell_index (halfedge_descriptor he, int q, const _CT &K) const
 Returns the index of the cell of dimension q (in an AbstractSimplicialChainComplex K built from the Surface_mesh_io) associated to a given halfedge handle of the underlying surface mesh (in the underlying triangle mesh).
template<typename _CT>
halfedge_descriptor cell_index_to_halfedge_handle (size_t i, int q, const _CT &K) const
 Returns the halfedge handle of the underlying surface mesh (in the underlying triangle mesh) associated to the cell of index i and dimension q (in an AbstractSimplicialChainComplex K built from the Surface_mesh_io).
template<typename _SCT, typename _CT>
Simplex_chain< typename _CT::Coefficient_ring > chain_to_simplex_chain (const _SCT &chain, int q, const _CT &K) const
 Returns the Simplex_chain associated to a given Sparse_chain.
template<typename HDVFType>
iterator< HDVFType > begin (const HDVFType &hdvf, int q=-1, Iterator_mode mode=Iterator_mode(0)) const
 Iterator to the beginning of homology/cohomology generators.
template<typename HDVFType>
iterator< HDVFType > end (const HDVFType &hdvf) const
 Iterator past-the-end of homology/cohomology generators.
Public Member Functions inherited from CGAL::Homological_discrete_vector_field::Mesh_object_io< Traits >
int dimension () const
 Returns the dimension of the Mesh_object_io.
 Mesh_object_io (int d=0)
 Default constructor.
 Mesh_object_io (int d, const std::vector< Point > &vnodes, const std::vector< Io_cell_type > &vcells, bool sort_data=false)
 Constructor from a vector of points (vertex coordinates) and a vector of simplices.
 Mesh_object_io (const Point &BBmin, const Point &BBmax)
 Build a Mesh_object_io representing the bounding box of diagonal BB_min - BBmax.
const std::vector< Point > & nodes () const
 Returns the vector of nodes (ie vertices coordinates).
int number_of_nodes () const
 Returns the number of nodes (ie vertices).
const std::vector< Io_cell_type > & cells () const
 Returns the vector of cells.
void set_node (size_t i, const Point &P)
 Updates the coordinates of the ith node (ie vertex).
void push_back (const Mesh_object_io &mesh)
 Adds a Mesh_object_io to the current Mesh_object_io.
size_t add_node (const Point &v)
 Adds a node (vertex).
void clear_cells ()
 Removes all cells (simplices).
void clear_nodes ()
 Removes all nodes (vertices).
void clear ()
 Removes all nodes and cells.
void add_cell (Io_cell_type &c, bool sort_indices=false)
 Adds a cells (simplex).
size_t cells_of_dim (int q) const
 Number of cells (simplices) of dimension q.
bool read_off (const std::string &filename)
 Imports a mesh stored in an OFF file.
bool write_off (const std::string &filename) const
 Exports triangles (simplices of dimension 2) of the current object to an OFF file.
void write_vtk (const std::string &filename)
 Exports cells of the current object to an VTK file.
bool write_simp (const std::string &filename)
 Exports cells to a SIMP file.
bool read_simp (const std::string &filename)
 Imports cells from a SIMP file.
bool read_nodes_file (const std::string &filename)
 Reads nodes from a file in tetgen NODES format.
std::ostream & print_infos (std::ostream &out_stream=std::cout) const
 Prints compact informations on the object into a stream.
Point centroid () const
 Returns the centroid of the object's nodes.
double radius (const Point &bary) const
 Returns maximum distance from a point bary to the object's nodes.
Bbox bbox (double ratio=1.) const
 Returns the bounding box of the object's nodes.

Additional Inherited Members

Member Typedef Documentation

◆ Simplex_chain

template<typename TriangleMesh, typename Traits>
template<typename CoefficientRing>
using CGAL::Homological_discrete_vector_field::Surface_mesh_io< TriangleMesh, Traits >::Simplex_chain = std::map<halfedge_descriptor, CoefficientRing>

Type encoding chains on a surface mesh.

A chain over a surface mesh is a formal linear combination \(\lambda_1\sigma_1+\cdots+\lambda_k\sigma_k\) of cells \(\sigma_i\) of the surface mesh (all of the same dimension), with coefficients \(\lambda_i\) in CoefficientRing (a model of EuclideanRingWithoutDivision).

A Simplex_chain encodes such a chain as a map between halfedges (each cell \(\sigma_i\) is identified by its associated halfedge) and coefficients ( \(\lambda_i\))

Constructor & Destructor Documentation

◆ Surface_mesh_io()

template<typename TriangleMesh, typename Traits>
CGAL::Homological_discrete_vector_field::Surface_mesh_io< TriangleMesh, Traits >::Surface_mesh_io ( const TriangleMesh & mesh)

Constructor from a triangular mesh.

Loads vertices, edges and triangles of a surface mesh mesh (called the underlying triangle mesh). Vertices and simplices are identified by their index together with their dimension. In a given a dimension, indices coincide with the enumeration order of corresponding surface mesh iterators.

As vertices are identified by their index, vertices with similar underlying points and different vertex indices will be considered as different.

Member Function Documentation

◆ begin()

template<typename TriangleMesh, typename Traits>
template<typename HDVFType>
iterator< HDVFType > CGAL::Homological_discrete_vector_field::Surface_mesh_io< TriangleMesh, Traits >::begin ( const HDVFType & hdvf,
int q = -1,
Iterator_mode mode = Iterator_mode(0) ) const

Iterator to the beginning of homology/cohomology generators.

Parameters
hdvfConstant reference over the HDVF iterated (computed over a complex built from the Surface_mesh_io).
qIf positive, the iterator visits only holes of dimension q, if negative (default), visits holes in any dimension computed (depending on dimension restriction)
modeDefines which information is returned by the iterator (HOMOLOGY, COHOMOLOGY or BOTH). This argument must be coherent with the HDVF option chosen for computation. By default, copies the current HDVF options.
Returns
The iterator to the first hole visited.

◆ cell_index_to_halfedge_handle()

template<typename TriangleMesh, typename Traits>
template<typename _CT>
halfedge_descriptor CGAL::Homological_discrete_vector_field::Surface_mesh_io< TriangleMesh, Traits >::cell_index_to_halfedge_handle ( size_t i,
int q,
const _CT & K ) const

Returns the halfedge handle of the underlying surface mesh (in the underlying triangle mesh) associated to the cell of index i and dimension q (in an AbstractSimplicialChainComplex K built from the Surface_mesh_io).

Template Parameters
_CTtype of the complex K (a model of AbstractSimplicialChainComplex).
Parameters
iIndex of the cell of K
qDimension of the cell of K
KAbstract simplicial chain complex built from the Surface_mesh_io

◆ chain_to_simplex_chain()

template<typename TriangleMesh, typename Traits>
template<typename _SCT, typename _CT>
Simplex_chain< typename _CT::Coefficient_ring > CGAL::Homological_discrete_vector_field::Surface_mesh_io< TriangleMesh, Traits >::chain_to_simplex_chain ( const _SCT & chain,
int q,
const _CT & K ) const

Returns the Simplex_chain associated to a given Sparse_chain.

Template Parameters
_SCTType of the the sparse chain chain (a model of SparseChain).
_CTType of the complex K (a model of AbstractSimplicialChainComplex).
Parameters
chainChain of K.
qDimension of the chain
KAbstract simplicial chain complex built from the Surface_mesh_io

◆ end()

template<typename TriangleMesh, typename Traits>
template<typename HDVFType>
iterator< HDVFType > CGAL::Homological_discrete_vector_field::Surface_mesh_io< TriangleMesh, Traits >::end ( const HDVFType & hdvf) const

Iterator past-the-end of homology/cohomology generators.

Parameters
hdvfConstant reference over the HDVF iterated (computed over a complex built from the Surface_mesh_io).

◆ halfedge_handle_to_cell_index()

template<typename TriangleMesh, typename Traits>
template<typename _CT>
size_t CGAL::Homological_discrete_vector_field::Surface_mesh_io< TriangleMesh, Traits >::halfedge_handle_to_cell_index ( halfedge_descriptor he,
int q,
const _CT & K ) const

Returns the index of the cell of dimension q (in an AbstractSimplicialChainComplex K built from the Surface_mesh_io) associated to a given halfedge handle of the underlying surface mesh (in the underlying triangle mesh).

Template Parameters
_CTtype of the complex K (a model of AbstractSimplicialChainComplex).
Parameters
heHalfedge handle considered.
qDimension of the cell associated to the halfedge
KAbstract simplicial chain complex built from the Surface_mesh_io