/* This file is part of the Gudhi Library. The Gudhi library
* (Geometric Understanding in Higher Dimensions) is a generic C++
* library for computational topology.
*
* Author(s): David Salinas
*
* Copyright (C) 2014 INRIA Sophia Antipolis-Mediterranee (France)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
#include
#include
#include
#include
#include
#include "gudhi/Test.h"
//#include "Skeleton_blocker/Simplex.h"
#include "gudhi/Skeleton_blocker_complex.h"
#include "gudhi/Skeleton_blocker/iterators/Skeleton_blockers_iterators.h"
#include "gudhi/Skeleton_blocker_simplifiable_complex.h"
#include "gudhi/Skeleton_blocker/Skeleton_blocker_simple_traits.h"
using namespace std;
using namespace Gudhi;
using namespace skbl;
template class Skeleton_blocker_sub_complex;
typedef Skeleton_blocker_simplifiable_complex Complex;
typedef Complex::Vertex_handle Vertex_handle;
typedef Complex::Root_vertex_handle Root_vertex_handle;
typedef Skeleton_blocker_simplex Simplex_handle;
// true iff v \in complex
bool assert_vertex(Complex &complex,Vertex_handle v){
Simplex_handle simplex(v);
bool test = complex.contains(simplex);
assert(test);
return test;
}
// true iff the blocker (a,b,c) is in complex
bool assert_blocker(Complex &complex,Root_vertex_handle a,Root_vertex_handle b,Root_vertex_handle c){
return complex.contains_blocker(Simplex_handle(*complex.get_address(a),*complex.get_address(b),*complex.get_address(c)));
//return complex.contains_blocker((a),(b),(c));
}
void build_complete(int n,Complex& complex){
complex.clear();
for(int i=0;i Ocomplex \n";
return blocker123_here;
}
bool test_collapse1(){
Complex complex(5);
build_complete(4,complex);
complex.add_blocker(Simplex_handle(Vertex_handle(0),Vertex_handle(1),Vertex_handle(2),Vertex_handle(3)));
// Print result
cerr << "initial complex :\n"<< complex.to_string();
cerr < Ocomplex \n";
return res;
}
bool test_collapse2(){
Complex complex(5);
build_complete(4,complex);
complex.add_vertex();
complex.add_edge(Vertex_handle(1),Vertex_handle(4));
complex.add_edge(Vertex_handle(2),Vertex_handle(4));
complex.add_edge(Vertex_handle(3),Vertex_handle(4));
complex.add_blocker(Simplex_handle(Vertex_handle(1),Vertex_handle(2),Vertex_handle(3),Vertex_handle(4)));
// Print result
cerr << "initial complex :\n"<< complex.to_string();
cerr < simplices(complex.simplex_range().begin(),complex.simplex_range().end());
sort(simplices.begin(),simplices.end(),[&](const Simplex_handle& s1,const Simplex_handle& s2){
return s1.dimension()1)
copy.add_simplex(simplex);
}
cerr << "complex after add_simplex:\n"<< copy.to_string();
return complex.num_blockers()==copy.num_blockers() &&
complex.num_edges()==copy.num_edges() &&
complex.num_vertices()==copy.num_vertices();
}
bool test_remove_popable_blockers(){
Complex complex;
build_complete(4,complex);
complex.add_vertex();
complex.add_edge(Vertex_handle(3),Vertex_handle(4));
complex.add_edge(Vertex_handle(2),Vertex_handle(4));
Simplex_handle sigma1=Simplex_handle(Vertex_handle(1),Vertex_handle(2),Vertex_handle(3));
Simplex_handle sigma2=Simplex_handle(Vertex_handle(2),Vertex_handle(3),Vertex_handle(4));
complex.add_blocker(sigma1);
complex.add_blocker(sigma2);
cerr << "complex complex"<< complex.to_string();
cerr <