summaryrefslogtreecommitdiff
path: root/src/Contraction
diff options
context:
space:
mode:
authorvrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2015-11-16 10:50:57 +0000
committervrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2015-11-16 10:50:57 +0000
commitda50b2dc9acbd67df5c1faf8fd5d8938574b08cb (patch)
tree8643273c5106cf998dff4318b71df64cdab44134 /src/Contraction
parentb15b9c7f6f5dd232dee897c96d65f5f77e215314 (diff)
parentc6c91153dde643af2c5b9c78a1b1b9b65349c292 (diff)
backmerge of skb_simplex_insertion_mergedevelopment
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/trunk@925 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 923de101fab769e597e39975a89f8e59d00e2cce
Diffstat (limited to 'src/Contraction')
-rw-r--r--src/Contraction/example/Garland_heckbert.cpp17
-rw-r--r--src/Contraction/example/Rips_contraction.cpp4
-rw-r--r--src/Contraction/include/gudhi/Edge_contraction.h4
-rw-r--r--src/Contraction/include/gudhi/Skeleton_blocker_contractor.h11
4 files changed, 19 insertions, 17 deletions
diff --git a/src/Contraction/example/Garland_heckbert.cpp b/src/Contraction/example/Garland_heckbert.cpp
index 70f29b6a..3ba9501b 100644
--- a/src/Contraction/example/Garland_heckbert.cpp
+++ b/src/Contraction/example/Garland_heckbert.cpp
@@ -145,12 +145,13 @@ class GH_visitor : public Gudhi::contraction::Contraction_visitor<EdgeProfile> {
int main(int argc, char *argv[]) {
if (argc != 4) {
- std::cerr << "Usage " << argv[0] << " input.off output.off N to load the file input.off, contract N edges and save "
- << "the result to output.off.\n";
+ std::cerr << "Usage " << argv[0] <<
+ " input.off output.off N to load the file input.off, contract N edges and save the result to output.off.\n";
return EXIT_FAILURE;
}
Complex complex;
+ typedef typename Complex::Vertex_handle Vertex_handle;
// load the points
Skeleton_blocker_off_reader<Complex> off_reader(argv[1], complex);
@@ -159,8 +160,12 @@ int main(int argc, char *argv[]) {
return EXIT_FAILURE;
}
- std::cout << "Load complex with " << complex.num_vertices() << " vertices" << std::endl;
+ if (!complex.empty() && !(complex.point(Vertex_handle(0)).dimension() == 3)) {
+ std::cerr << "Only points of dimension 3 are supported." << std::endl;
+ return EXIT_FAILURE;
+ }
+ std::cout << "Load complex with " << complex.num_vertices() << " vertices" << std::endl;
int num_contractions = atoi(argv[3]);
@@ -178,7 +183,7 @@ int main(int argc, char *argv[]) {
std::cout << "Final complex has " <<
complex.num_vertices() << " vertices, " <<
- complex.num_edges() << " edges and" <<
+ complex.num_edges() << " edges and " <<
complex.num_triangles() << " triangles." << std::endl;
// write simplified complex
@@ -187,6 +192,8 @@ int main(int argc, char *argv[]) {
return EXIT_SUCCESS;
}
+#endif // GARLAND_HECKBERT_H_
+
+
-#endif // GARLAND_HECKBERT_H_
diff --git a/src/Contraction/example/Rips_contraction.cpp b/src/Contraction/example/Rips_contraction.cpp
index d21246ed..f80cc2dc 100644
--- a/src/Contraction/example/Rips_contraction.cpp
+++ b/src/Contraction/example/Rips_contraction.cpp
@@ -49,7 +49,7 @@ void build_rips(ComplexType& complex, double offset) {
for (auto p = vertices.begin(); p != vertices.end(); ++p)
for (auto q = p; ++q != vertices.end(); /**/) {
if (squared_dist(complex.point(*p), complex.point(*q)) < 4 * offset * offset)
- complex.add_edge(*p, *q);
+ complex.add_edge_without_blockers(*p, *q);
}
}
@@ -87,7 +87,7 @@ int main(int argc, char *argv[]) {
contractor.contract_edges();
std::cout << "Counting final number of simplices \n";
- unsigned num_simplices = std::distance(complex.simplex_range().begin(), complex.simplex_range().end());
+ unsigned num_simplices = std::distance(complex.complex_simplex_range().begin(), complex.complex_simplex_range().end());
std::cout << "Final complex has " <<
complex.num_vertices() << " vertices, " <<
diff --git a/src/Contraction/include/gudhi/Edge_contraction.h b/src/Contraction/include/gudhi/Edge_contraction.h
index 349bb7d8..ee3e3de1 100644
--- a/src/Contraction/include/gudhi/Edge_contraction.h
+++ b/src/Contraction/include/gudhi/Edge_contraction.h
@@ -158,7 +158,7 @@ void build_rips(ComplexType& complex, double offset){
for (auto p = vertices.begin(); p != vertices.end(); ++p)
for (auto q = p; ++q != vertices.end(); )
if (eucl_distance(complex.point(*p), complex.point(*q)) < 2 * offset)
- complex.add_edge(*p,*q);
+ complex.add_edge_without_blockers(*p,*q);
}
int main (int argc, char *argv[])
@@ -194,7 +194,7 @@ int main (int argc, char *argv[])
contractor.contract_edges();
std::cout << "Counting final number of simplices \n";
- unsigned num_simplices = std::distance(complex.simplex_range().begin(),complex.simplex_range().end());
+ unsigned num_simplices = std::distance(complex.star_simplex_range().begin(),complex.star_simplex_range().end());
std::cout << "Final complex has "<<
complex.num_vertices()<<" vertices, "<<
diff --git a/src/Contraction/include/gudhi/Skeleton_blocker_contractor.h b/src/Contraction/include/gudhi/Skeleton_blocker_contractor.h
index 2759b540..d6350a2c 100644
--- a/src/Contraction/include/gudhi/Skeleton_blocker_contractor.h
+++ b/src/Contraction/include/gudhi/Skeleton_blocker_contractor.h
@@ -107,13 +107,8 @@ typename GeometricSimplifiableComplex::Vertex_handle> {
public:
typedef typename GeometricSimplifiableComplex::Graph_vertex Graph_vertex;
typedef typename GeometricSimplifiableComplex::Vertex_handle Vertex_handle;
- typedef typename GeometricSimplifiableComplex::Simplex_handle Simplex_handle;
- typedef typename GeometricSimplifiableComplex::Simplex_handle_iterator Simplex_handle_iterator;
-
-
-
+ typedef typename GeometricSimplifiableComplex::Simplex Simplex;
typedef typename GeometricSimplifiableComplex::Root_vertex_handle Root_vertex_handle;
-
typedef typename GeometricSimplifiableComplex::Graph_edge Graph_edge;
typedef typename GeometricSimplifiableComplex::Edge_handle Edge_handle;
typedef typename GeometricSimplifiableComplex::Point Point;
@@ -535,14 +530,14 @@ typename GeometricSimplifiableComplex::Vertex_handle> {
* All the edges that passes through the blocker may be edge-contractible
* again and are thus reinserted in the heap.
*/
- void on_delete_blocker(const Simplex_handle * blocker) override {
+ void on_delete_blocker(const Simplex * blocker) override {
// we go for all pairs xy that belongs to the blocker
// note that such pairs xy are necessarily edges of the complex
// by definition of a blocker
// todo uniqument utile pour la link condition
// laisser a l'utilisateur ? booleen update_heap_on_removed_blocker?
- Simplex_handle blocker_copy(*blocker);
+ Simplex blocker_copy(*blocker);
for (auto x = blocker_copy.begin(); x != blocker_copy.end(); ++x) {
for (auto y = x; ++y != blocker_copy.end();) {
auto edge_descr(complex_[std::make_pair(*x, *y)]);