CGAL 6.2 - Homological Discrete Vector Fields
Loading...
Searching...
No Matches
CGAL::Homological_discrete_vector_field::Mesh_object_io< Traits > Class Template Reference

#include <CGAL/HDVF/Mesh_object_io.h>

Inherited by CGAL::Homological_discrete_vector_field::Icosphere_object_io< Traits >, CGAL::Homological_discrete_vector_field::Surface_mesh_io< TriangleMesh, Traits >, CGAL::Homological_discrete_vector_field::Tet_object_io< Traits >, and CGAL::Homological_discrete_vector_field::Triangulation_3_io< Triangulation3, Traits >.

Definition

template<typename Traits>
class CGAL::Homological_discrete_vector_field::Mesh_object_io< Traits >

The class Mesh_object_io is an intermediate IO class, used to load triangular/tetraedral meshes and produce simplicial complexes.

Template Parameters
Traitsa geometric traits class model of the HDVFTraits concept.

Public Types

typedef Traits::Point Point
 
typedef Traits::Bbox Bbox
 

Public Member Functions

int dimension () const
 Returns the dimension of the Mesh_object_io.
 
 Mesh_object_io (int d=0)
 
 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 Point (vertex coordinates) and a vector of simplices.
 
 Mesh_object_io (const Point &BBmin, const Point &BBmax)
 Build a Mesh_object_io for the bounding box of diagonal BB_min - BBmax.
 
const std::vector< Point > & nodes () const
 Returns the vector of nodes (ie.
 
int number_of_nodes () const
 Returns the number of nodes (ie.
 
const std::vector< Io_cell_type > & cells () const
 Returns the vector of cells.
 
void set_node (size_t i, const Point &P)
 Update the coordinates of a node (ie.
 
void push_back (const Mesh_object_io &mesh)
 Add a Mesh_object_io to the current Mesh_object_io.
 
void add_node (const Point &v)
 
void clear_cells ()
 
void clear_nodes ()
 
void clear ()
 
void add_cell (Io_cell_type &c, bool sort_indices=false)
 
size_t cells_of_dim (int q) const
 
bool read_off (const std::string &filename)
 
bool write_off (const std::string &filename) const
 
void write_to_vtk (const std::string &filename)
 
bool write_simp (const std::string &filename)
 
bool read_simp (const std::string &filename)
 
bool read_nodes_file (const std::string &filename)
 
std::ostream & print_infos (std::ostream &out_stream=std::cout) const
 
Point centroid () const
 
double radius (const Point &bary) const
 
Bbox bbox (double ratio=1.) const
 

Protected Member Functions

template<typename CoefficientRing >
void write_vtk (const std::string &filename, const std::vector< Point > &nodes, const std::vector< Io_chain_type > &chains, const std::vector< CoefficientRing > *labels=NULL, const std::string scalar_type="none")
 

Protected Attributes

int _dim = 0
 
size_t _nvertices
 
size_t _ncells
 
size_t _nedges
 
std::vector< Point_nodes
 
std::vector< Io_cell_type_cells
 

Friends

std::ostream & operator<< (std::ostream &out_stream, const Mesh_object_io &mesh_io)
 

Constructor & Destructor Documentation

◆ Mesh_object_io()

template<typename Traits >
CGAL::Homological_discrete_vector_field::Mesh_object_io< Traits >::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 Point (vertex coordinates) and a vector of simplices.

Simplices are described by the list of vertex indices.

Parameters
dThe dimension d can be positive or negative:
  • if positive: the set of simplicial cells loaded is a "mesh" and all cells have the same dimension
  • if negative: the set of simplicial cells loaded have various dimensions and d must be the maximum of these dimensions.

Vertices are described by their index; this index must be unique (vertices with similar underlying points and different vertex indices will be considered as different).

Parameters
vnodesVector of vertex coordinates.
vcellsVector of cells (described by a sorted vector of indices)
sort_dataIf true the vectors of vertex indices are sorted, if false they are assumed to be sorted (faster).
Exceptions
Traits_dimension_mismatchIf the dimension `d` provided does not match the dimension of the Traits, raises a `std::runtime_error`.
Inconsistent_dimensionIf the dimension of one of the cell does not match the dimension of the Traits, raises a `std::runtime_error`.

Member Function Documentation

◆ dimension()

template<typename Traits >
int CGAL::Homological_discrete_vector_field::Mesh_object_io< Traits >::dimension ( ) const

Returns the dimension of the Mesh_object_io.

The dimension can be positive or negative:

  • if positive: the set of simplicial cells loaded is a "mesh" and all cells have the same dimension which is the dimension of the Mesh_object_io
  • if negative: the set of simplicial cells loaded have various dimensions and the dimension of the Mesh_object_io is the maximum of these dimensions.

◆ nodes()

template<typename Traits >
const std::vector< Point > & CGAL::Homological_discrete_vector_field::Mesh_object_io< Traits >::nodes ( ) const

Returns the vector of nodes (ie.

vertices coordinates).

◆ number_of_nodes()

template<typename Traits >
int CGAL::Homological_discrete_vector_field::Mesh_object_io< Traits >::number_of_nodes ( ) const

Returns the number of nodes (ie.

vertices).

◆ push_back()

template<typename Traits >
void CGAL::Homological_discrete_vector_field::Mesh_object_io< Traits >::push_back ( const Mesh_object_io< Traits > &  mesh)

Add a Mesh_object_io to the current Mesh_object_io.

In order to concatenate objects, the function

◆ set_node()

template<typename Traits >
void CGAL::Homological_discrete_vector_field::Mesh_object_io< Traits >::set_node ( size_t  i,
const Point P 
)

Update the coordinates of a node (ie.

vertex).