CGAL 6.1 - Homological Discrete Vector Fields
Loading...
Searching...
No Matches
HDVF/example_hdvf_cubical.cpp
#include <iostream>
#include <fstream>
#include <CGAL/HDVF/Cub_object_io.h>
#include <CGAL/HDVF/Cubical_chain_complex.h>
#include <CGAL/HDVF/Geometric_chain_complex_tools.h>
#include <CGAL/HDVF/Z2.h>
#include <CGAL/HDVF/Hdvf.h>
#include <CGAL/OSM/OSM.h>
typedef int CoefficientType;
//typedef Z2 CoefficientType;
int main(int argc, char **argv)
{
if (argc != 2)
{
std::cout << "usage: example_hdvf_cubical pgm_file" << std::endl;
}
else
{
// Choose between PRIMAL and DUAL construction
const ComplexType::typeComplexCube primal_dual = ComplexType::PRIMAL;
// Adapt pgm loading into Cub_complex accordingly
const bool khalimsky_coords = (primal_dual == ComplexType::PRIMAL) ? true : false ;
// Load pgm into cub object
mesh.read_pgm(argv[1], khalimsky_coords);
mesh.print_infos();
// Build simplicial chain complex
ComplexType complex(mesh, primal_dual);
complex.print_complex();
// Build empty HDVF
HDVFType hdvf(complex, CGAL::HDVF::OPT_FULL) ;
// Compute a perfect HDVF
hdvf.compute_perfect_hdvf();
// hdvf.compute_rand_perfect_hdvf();
// Output HDVF to console
hdvf.print_matrices();
hdvf.print_reduction();
// Output HDVF to vtk
hdvf_geometric_chain_complex_output_vtk(hdvf, complex, "res", true) ;
}
return 0;
}
The class Cub_object_io is an intermediate IO class, used to load binary volumes and produce cubical ...
Definition: Cub_object_io.h:44
bool read_pgm(const std::string &filename, bool khal=false)
Definition: Cub_object_io.h:97
void print_infos(size_t level=0) const
Definition: Cub_object_io.h:235
The class Cubical_chain_complex represents (topological) chain complexes associated to cubical comple...
Definition: Cubical_chain_complex.h:93
The class Hdvf implements homology and cohomology computation via homological discrete vector fields ...
Definition: Hdvf.h:86
const int OPT_FULL
HDVF option (compute full reduction).
Definition: Hdvf_core.h:42