summaryrefslogtreecommitdiff
path: root/src/Cech_complex
diff options
context:
space:
mode:
authorvrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2018-05-29 19:49:30 +0000
committervrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2018-05-29 19:49:30 +0000
commitcfe5c6b05435cb7d8cbd1d615e0c402f4a5e1674 (patch)
tree7e931f775abe016ec61cc9d2847328bbc51609ee /src/Cech_complex
parentaa12266a274c835adef5950a54ebdaa9fb68b89e (diff)
Clang format files
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/cechcomplex_vincent@3488 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 7d1da847f4c39a191afd5d8e56fe34ee79ade495
Diffstat (limited to 'src/Cech_complex')
-rw-r--r--src/Cech_complex/benchmark/cech_complex_benchmark.cpp58
-rw-r--r--src/Cech_complex/example/cech_complex_example_from_points.cpp33
-rw-r--r--src/Cech_complex/example/cech_complex_step_by_step.cpp51
-rw-r--r--src/Cech_complex/include/gudhi/Cech_complex.h30
-rw-r--r--src/Cech_complex/include/gudhi/Cech_complex_blocker.h9
-rw-r--r--src/Cech_complex/test/test_cech_complex.cpp63
6 files changed, 104 insertions, 140 deletions
diff --git a/src/Cech_complex/benchmark/cech_complex_benchmark.cpp b/src/Cech_complex/benchmark/cech_complex_benchmark.cpp
index 2fa255ed..86314930 100644
--- a/src/Cech_complex/benchmark/cech_complex_benchmark.cpp
+++ b/src/Cech_complex/benchmark/cech_complex_benchmark.cpp
@@ -29,12 +29,11 @@
#include <gudhi/Simplex_tree.h>
#include <gudhi/Miniball.hpp>
-#include "boost/filesystem.hpp" // includes all needed Boost.Filesystem declarations
+#include "boost/filesystem.hpp" // includes all needed Boost.Filesystem declarations
#include <string>
#include <vector>
-
// Types definition
using Simplex_tree = Gudhi::Simplex_tree<>;
using Filtration_value = Simplex_tree::Filtration_value;
@@ -45,32 +44,31 @@ using Proximity_graph = Gudhi::Proximity_graph<Simplex_tree>;
using Rips_complex = Gudhi::rips_complex::Rips_complex<Filtration_value>;
using Cech_complex = Gudhi::cech_complex::Cech_complex<Simplex_tree, Point_cloud>;
-
class Minimal_enclosing_ball_radius {
public:
// boost::range_value is not SFINAE-friendly so we cannot use it in the return type
- template< typename Point >
- typename std::iterator_traits<typename boost::range_iterator<Point>::type>::value_type
- operator()(const Point& p1, const Point& p2) const {
+ template <typename Point>
+ typename std::iterator_traits<typename boost::range_iterator<Point>::type>::value_type operator()(
+ const Point& p1, const Point& p2) const {
// Type def
using Point_cloud = std::vector<Point>;
using Point_iterator = typename Point_cloud::const_iterator;
using Coordinate_iterator = typename Point::const_iterator;
- using Min_sphere = typename Gudhi::Miniball::Miniball<Gudhi::Miniball::CoordAccessor<Point_iterator, Coordinate_iterator>>;
+ using Min_sphere =
+ typename Gudhi::Miniball::Miniball<Gudhi::Miniball::CoordAccessor<Point_iterator, Coordinate_iterator>>;
Point_cloud point_cloud;
point_cloud.push_back(p1);
point_cloud.push_back(p2);
- GUDHI_CHECK((p1.end()-p1.begin()) != (p2.end()-p2.begin()), "inconsistent point dimensions");
- Min_sphere min_sphere(p1.end()-p1.begin(), point_cloud.begin(),point_cloud.end());
+ GUDHI_CHECK((p1.end() - p1.begin()) != (p2.end() - p2.begin()), "inconsistent point dimensions");
+ Min_sphere min_sphere(p1.end() - p1.begin(), point_cloud.begin(), point_cloud.end());
return std::sqrt(min_sphere.squared_radius());
}
};
-
-int main(int argc, char * argv[]) {
+int main(int argc, char* argv[]) {
std::string off_file_points = "tore3D_1307.off";
Filtration_value threshold = 1e20;
@@ -79,42 +77,32 @@ int main(int argc, char * argv[]) {
Gudhi::Clock euclidean_clock("Gudhi::Euclidean_distance");
// Compute the proximity graph of the points
- Proximity_graph euclidean_prox_graph = Gudhi::compute_proximity_graph<Simplex_tree>(off_reader.get_point_cloud(),
- threshold,
- Gudhi::Euclidean_distance());
+ Proximity_graph euclidean_prox_graph = Gudhi::compute_proximity_graph<Simplex_tree>(
+ off_reader.get_point_cloud(), threshold, Gudhi::Euclidean_distance());
std::cout << euclidean_clock << std::endl;
Gudhi::Clock miniball_clock("Minimal_enclosing_ball_radius");
// Compute the proximity graph of the points
- Proximity_graph miniball_prox_graph =
- Gudhi::compute_proximity_graph<Simplex_tree>(off_reader.get_point_cloud(),
- threshold,
- Minimal_enclosing_ball_radius());
+ Proximity_graph miniball_prox_graph = Gudhi::compute_proximity_graph<Simplex_tree>(
+ off_reader.get_point_cloud(), threshold, Minimal_enclosing_ball_radius());
std::cout << miniball_clock << std::endl;
Gudhi::Clock common_miniball_clock("Gudhi::Minimal_enclosing_ball_radius()");
// Compute the proximity graph of the points
- Proximity_graph common_miniball_prox_graph =
- Gudhi::compute_proximity_graph<Simplex_tree>(off_reader.get_point_cloud(),
- threshold,
- Gudhi::Minimal_enclosing_ball_radius());
+ Proximity_graph common_miniball_prox_graph = Gudhi::compute_proximity_graph<Simplex_tree>(
+ off_reader.get_point_cloud(), threshold, Gudhi::Minimal_enclosing_ball_radius());
std::cout << common_miniball_clock << std::endl;
-
boost::filesystem::path full_path(boost::filesystem::current_path());
std::cout << "Current path is : " << full_path << std::endl;
-
- std::cout << "File name;Radius;Rips time;Cech time; Ratio Rips/Cech time;Rips nb simplices;Cech nb simplices;" << std::endl;
- boost::filesystem::directory_iterator end_itr; // default construction yields past-the-end
- for ( boost::filesystem::directory_iterator itr( boost::filesystem::current_path() );
- itr != end_itr;
- ++itr )
- {
- if ( ! boost::filesystem::is_directory(itr->status()) )
- {
- if ( itr->path().extension() == ".off" ) // see below
+ std::cout << "File name;Radius;Rips time;Cech time; Ratio Rips/Cech time;Rips nb simplices;Cech nb simplices;"
+ << std::endl;
+ boost::filesystem::directory_iterator end_itr; // default construction yields past-the-end
+ for (boost::filesystem::directory_iterator itr(boost::filesystem::current_path()); itr != end_itr; ++itr) {
+ if (!boost::filesystem::is_directory(itr->status())) {
+ if (itr->path().extension() == ".off") // see below
{
Points_off_reader off_reader(itr->path().string());
Point p0 = off_reader.get_point_cloud()[0];
@@ -123,8 +111,7 @@ int main(int argc, char * argv[]) {
std::cout << itr->path().stem() << ";";
std::cout << radius << ";";
Gudhi::Clock rips_clock("Rips computation");
- Rips_complex rips_complex_from_points(off_reader.get_point_cloud(),
- radius,
+ Rips_complex rips_complex_from_points(off_reader.get_point_cloud(), radius,
Gudhi::Minimal_enclosing_ball_radius());
Simplex_tree rips_stree;
rips_complex_from_points.create_complex(rips_stree, p0.size() - 1);
@@ -153,6 +140,5 @@ int main(int argc, char * argv[]) {
}
}
-
return 0;
}
diff --git a/src/Cech_complex/example/cech_complex_example_from_points.cpp b/src/Cech_complex/example/cech_complex_example_from_points.cpp
index 2b36e33c..3cc5a4df 100644
--- a/src/Cech_complex/example/cech_complex_example_from_points.cpp
+++ b/src/Cech_complex/example/cech_complex_example_from_points.cpp
@@ -14,17 +14,17 @@ int main() {
using Cech_complex = Gudhi::cech_complex::Cech_complex<Simplex_tree, Point_cloud>;
Point_cloud points;
- points.push_back({1., 0.}); // 0
- points.push_back({0., 1.}); // 1
- points.push_back({2., 1.}); // 2
- points.push_back({3., 2.}); // 3
- points.push_back({0., 3.}); // 4
- points.push_back({3. + std::sqrt(3.), 3.}); // 5
- points.push_back({1., 4.}); // 6
- points.push_back({3., 4.}); // 7
- points.push_back({2., 4. + std::sqrt(3.)}); // 8
- points.push_back({0., 4.}); // 9
- points.push_back({-0.5, 2.}); // 10
+ points.push_back({1., 0.}); // 0
+ points.push_back({0., 1.}); // 1
+ points.push_back({2., 1.}); // 2
+ points.push_back({3., 2.}); // 3
+ points.push_back({0., 3.}); // 4
+ points.push_back({3. + std::sqrt(3.), 3.}); // 5
+ points.push_back({1., 4.}); // 6
+ points.push_back({3., 4.}); // 7
+ points.push_back({2., 4. + std::sqrt(3.)}); // 8
+ points.push_back({0., 4.}); // 9
+ points.push_back({-0.5, 2.}); // 10
// ----------------------------------------------------------------------------
// Init of a Cech complex from points
@@ -37,18 +37,17 @@ int main() {
// ----------------------------------------------------------------------------
// Display information about the one skeleton Cech complex
// ----------------------------------------------------------------------------
- std::cout << "Cech complex is of dimension " << stree.dimension() <<
- " - " << stree.num_simplices() << " simplices - " <<
- stree.num_vertices() << " vertices." << std::endl;
+ std::cout << "Cech complex is of dimension " << stree.dimension() << " - " << stree.num_simplices() << " simplices - "
+ << stree.num_vertices() << " vertices." << std::endl;
- std::cout << "Iterator on Cech complex simplices in the filtration order, with [filtration value]:" <<
- std::endl;
+ std::cout << "Iterator on Cech complex simplices in the filtration order, with [filtration value]:" << std::endl;
for (auto f_simplex : stree.filtration_simplex_range()) {
std::cout << " ( ";
for (auto vertex : stree.simplex_vertex_range(f_simplex)) {
std::cout << vertex << " ";
}
- std::cout << ") -> " << "[" << stree.filtration(f_simplex) << "] ";
+ std::cout << ") -> "
+ << "[" << stree.filtration(f_simplex) << "] ";
std::cout << std::endl;
}
return 0;
diff --git a/src/Cech_complex/example/cech_complex_step_by_step.cpp b/src/Cech_complex/example/cech_complex_step_by_step.cpp
index 760b53dc..d2dc8b65 100644
--- a/src/Cech_complex/example/cech_complex_step_by_step.cpp
+++ b/src/Cech_complex/example/cech_complex_step_by_step.cpp
@@ -31,7 +31,7 @@
#include <string>
#include <vector>
-#include <limits> // infinity
+#include <limits> // infinity
#include <utility> // for pair
#include <map>
@@ -55,7 +55,8 @@ class Cech_blocker {
using Point_cloud = std::vector<Point>;
using Point_iterator = Point_cloud::const_iterator;
using Coordinate_iterator = Point::const_iterator;
- using Min_sphere = Gudhi::Miniball::Miniball <Gudhi::Miniball::CoordAccessor<Point_iterator, Coordinate_iterator>>;
+ using Min_sphere = Gudhi::Miniball::Miniball<Gudhi::Miniball::CoordAccessor<Point_iterator, Coordinate_iterator>>;
+
public:
bool operator()(Simplex_handle sh) {
std::vector<Point> points;
@@ -73,11 +74,10 @@ class Cech_blocker {
return (radius > max_radius_);
}
Cech_blocker(Simplex_tree& simplex_tree, Filtration_value max_radius, const std::vector<Point>& point_cloud)
- : simplex_tree_(simplex_tree),
- max_radius_(max_radius),
- point_cloud_(point_cloud) {
+ : simplex_tree_(simplex_tree), max_radius_(max_radius), point_cloud_(point_cloud) {
dimension_ = point_cloud_[0].size();
}
+
private:
Simplex_tree simplex_tree_;
Filtration_value max_radius_;
@@ -85,14 +85,9 @@ class Cech_blocker {
int dimension_;
};
+void program_options(int argc, char* argv[], std::string& off_file_points, Filtration_value& max_radius, int& dim_max);
-void program_options(int argc, char * argv[]
- , std::string & off_file_points
- , Filtration_value & max_radius
- , int & dim_max);
-
-
-int main(int argc, char * argv[]) {
+int main(int argc, char* argv[]) {
std::string off_file_points;
Filtration_value max_radius;
int dim_max;
@@ -103,8 +98,7 @@ int main(int argc, char * argv[]) {
Points_off_reader off_reader(off_file_points);
// Compute the proximity graph of the points
- Proximity_graph prox_graph = Gudhi::compute_proximity_graph<Simplex_tree>(off_reader.get_point_cloud(),
- max_radius,
+ Proximity_graph prox_graph = Gudhi::compute_proximity_graph<Simplex_tree>(off_reader.get_point_cloud(), max_radius,
Gudhi::Minimal_enclosing_ball_radius());
// Construct the Rips complex in a Simplex Tree
@@ -125,7 +119,8 @@ int main(int argc, char * argv[]) {
std::cout << "* The complex contains " << st.num_simplices() << " simplices - dimension=" << st.dimension() << "\n";
std::cout << "* Iterator on Simplices in the filtration, with [filtration value]:\n";
for (auto f_simplex : st.filtration_simplex_range()) {
- std::cout << " " << "[" << st.filtration(f_simplex) << "] ";
+ std::cout << " "
+ << "[" << st.filtration(f_simplex) << "] ";
for (auto vertex : st.simplex_vertex_range(f_simplex)) {
std::cout << static_cast<int>(vertex) << " ";
}
@@ -136,24 +131,19 @@ int main(int argc, char * argv[]) {
return 0;
}
-void program_options(int argc, char * argv[]
- , std::string & off_file_points
- , Filtration_value & max_radius
- , int & dim_max) {
+void program_options(int argc, char* argv[], std::string& off_file_points, Filtration_value& max_radius, int& dim_max) {
namespace po = boost::program_options;
po::options_description hidden("Hidden options");
- hidden.add_options()
- ("input-file", po::value<std::string>(&off_file_points),
- "Name of an OFF file containing a point set.\n");
+ hidden.add_options()("input-file", po::value<std::string>(&off_file_points),
+ "Name of an OFF file containing a point set.\n");
po::options_description visible("Allowed options", 100);
- visible.add_options()
- ("help,h", "produce help message")
- ("max-radius,r",
- po::value<Filtration_value>(&max_radius)->default_value(std::numeric_limits<Filtration_value>::infinity()),
- "Maximal length of an edge for the Rips complex construction.")
- ("cpx-dimension,d", po::value<int>(&dim_max)->default_value(1),
- "Maximal dimension of the Rips complex we want to compute.");
+ visible.add_options()("help,h", "produce help message")(
+ "max-radius,r",
+ po::value<Filtration_value>(&max_radius)->default_value(std::numeric_limits<Filtration_value>::infinity()),
+ "Maximal length of an edge for the Rips complex construction.")(
+ "cpx-dimension,d", po::value<int>(&dim_max)->default_value(1),
+ "Maximal dimension of the Rips complex we want to compute.");
po::positional_options_description pos;
pos.add("input-file", 1);
@@ -162,8 +152,7 @@ void program_options(int argc, char * argv[]
all.add(visible).add(hidden);
po::variables_map vm;
- po::store(po::command_line_parser(argc, argv).
- options(all).positional(pos).run(), vm);
+ po::store(po::command_line_parser(argc, argv).options(all).positional(pos).run(), vm);
po::notify(vm);
if (vm.count("help") || !vm.count("input-file")) {
diff --git a/src/Cech_complex/include/gudhi/Cech_complex.h b/src/Cech_complex/include/gudhi/Cech_complex.h
index def46c79..f4fb4288 100644
--- a/src/Cech_complex/include/gudhi/Cech_complex.h
+++ b/src/Cech_complex/include/gudhi/Cech_complex.h
@@ -38,9 +38,9 @@ namespace cech_complex {
/**
* \class Cech_complex
* \brief Cech complex data structure.
- *
+ *
* \ingroup cech_complex
- *
+ *
* \details
* The data structure is a proximity graph, containing edges when the edge length is less or equal
* to a given max_radius. Edge length is computed from `Gudhi::Minimal_enclosing_ball_radius` distance function.
@@ -51,7 +51,7 @@ namespace cech_complex {
* \tparam ForwardPointRange must be a range for which `std::begin()` and `std::end()` methods return input
* iterators on a point. `std::begin()` and `std::end()` methods are also required for a point.
*/
-template<typename SimplicialComplexForProximityGraph, typename ForwardPointRange>
+template <typename SimplicialComplexForProximityGraph, typename ForwardPointRange>
class Cech_complex {
private:
// Required by compute_proximity_graph
@@ -63,7 +63,7 @@ class Cech_complex {
using Point_from_range_iterator = typename boost::range_const_iterator<ForwardPointRange>::type;
using Point_from_range = typename std::iterator_traits<Point_from_range_iterator>::value_type;
using Coordinate_iterator = typename boost::range_const_iterator<Point_from_range>::type;
- using Coordinate= typename std::iterator_traits<Coordinate_iterator>::value_type;
+ using Coordinate = typename std::iterator_traits<Coordinate_iterator>::value_type;
public:
// Point and Point_cloud type definition
@@ -79,17 +79,13 @@ class Cech_complex {
* \tparam ForwardPointRange must be a range of Point. Point must be a range of <b>copyable</b> Cartesian coordinates.
*
*/
- Cech_complex(const ForwardPointRange& points, Filtration_value max_radius)
- : max_radius_(max_radius) {
+ Cech_complex(const ForwardPointRange& points, Filtration_value max_radius) : max_radius_(max_radius) {
// Point cloud deep copy
point_cloud_.reserve(boost::size(points));
- for (auto&& point : points)
- point_cloud_.emplace_back(std::begin(point), std::end(point));
+ for (auto&& point : points) point_cloud_.emplace_back(std::begin(point), std::end(point));
- cech_skeleton_graph_ =
- Gudhi::compute_proximity_graph<SimplicialComplexForProximityGraph>(point_cloud_,
- max_radius_,
- Gudhi::Minimal_enclosing_ball_radius());
+ cech_skeleton_graph_ = Gudhi::compute_proximity_graph<SimplicialComplexForProximityGraph>(
+ point_cloud_, max_radius_, Gudhi::Minimal_enclosing_ball_radius());
}
/** \brief Initializes the simplicial complex from the proximity graph and expands it until a given maximal
@@ -100,7 +96,7 @@ class Cech_complex {
* @exception std::invalid_argument In debug mode, if `complex.num_vertices()` does not return 0.
*
*/
- template<typename SimplicialComplexForCechComplex >
+ template <typename SimplicialComplexForCechComplex>
void create_complex(SimplicialComplexForCechComplex& complex, int dim_max) {
GUDHI_CHECK(complex.num_vertices() == 0,
std::invalid_argument("Cech_complex::create_complex - simplicial complex is not empty"));
@@ -113,16 +109,12 @@ class Cech_complex {
}
/** @return max_radius value given at construction. */
- Filtration_value max_radius() const {
- return max_radius_;
- }
+ Filtration_value max_radius() const { return max_radius_; }
/** @param[in] vertex Point position in the range.
* @return The point.
*/
- const Point& get_point(Vertex_handle vertex) const{
- return point_cloud_[vertex];
- }
+ const Point& get_point(Vertex_handle vertex) const { return point_cloud_[vertex]; }
private:
Proximity_graph cech_skeleton_graph_;
diff --git a/src/Cech_complex/include/gudhi/Cech_complex_blocker.h b/src/Cech_complex/include/gudhi/Cech_complex_blocker.h
index 697d2246..b0d347b1 100644
--- a/src/Cech_complex/include/gudhi/Cech_complex_blocker.h
+++ b/src/Cech_complex/include/gudhi/Cech_complex_blocker.h
@@ -70,18 +70,15 @@ class Cech_blocker {
}
Filtration_value radius = Gudhi::Minimal_enclosing_ball_radius()(points);
#ifdef DEBUG_TRACES
- if (radius > cc_ptr_->max_radius())
- std::cout << "radius > max_radius => expansion is blocked\n";
+ if (radius > cc_ptr_->max_radius()) std::cout << "radius > max_radius => expansion is blocked\n";
#endif // DEBUG_TRACES
sc_ptr_->assign_filtration(sh, radius);
return (radius > cc_ptr_->max_radius());
}
/** \internal \brief Čech complex blocker constructor. */
- Cech_blocker(SimplicialComplexForCech* sc_ptr, Cech_complex* cc_ptr)
- : sc_ptr_(sc_ptr),
- cc_ptr_(cc_ptr) {
- }
+ Cech_blocker(SimplicialComplexForCech* sc_ptr, Cech_complex* cc_ptr) : sc_ptr_(sc_ptr), cc_ptr_(cc_ptr) {}
+
private:
SimplicialComplexForCech* sc_ptr_;
Cech_complex* cc_ptr_;
diff --git a/src/Cech_complex/test/test_cech_complex.cpp b/src/Cech_complex/test/test_cech_complex.cpp
index 5b35735b..9039169c 100644
--- a/src/Cech_complex/test/test_cech_complex.cpp
+++ b/src/Cech_complex/test/test_cech_complex.cpp
@@ -28,7 +28,7 @@
#include <limits>
#include <string>
#include <vector>
-#include <algorithm> // std::max
+#include <algorithm> // std::max
#include <gudhi/Cech_complex.h>
// to construct Cech_complex from a OFF file of points
@@ -57,21 +57,21 @@ BOOST_AUTO_TEST_CASE(Cech_complex_for_documentation) {
//
// ----------------------------------------------------------------------------
Point_cloud points;
- points.push_back({1., 0.}); // 0
- points.push_back({0., 1.}); // 1
- points.push_back({2., 1.}); // 2
- points.push_back({3., 2.}); // 3
- points.push_back({0., 3.}); // 4
- points.push_back({3. + std::sqrt(3.), 3.}); // 5
- points.push_back({1., 4.}); // 6
- points.push_back({3., 4.}); // 7
- points.push_back({2., 4. + std::sqrt(3.)}); // 8
- points.push_back({0., 4.}); // 9
- points.push_back({-0.5, 2.}); // 10
+ points.push_back({1., 0.}); // 0
+ points.push_back({0., 1.}); // 1
+ points.push_back({2., 1.}); // 2
+ points.push_back({3., 2.}); // 3
+ points.push_back({0., 3.}); // 4
+ points.push_back({3. + std::sqrt(3.), 3.}); // 5
+ points.push_back({1., 4.}); // 6
+ points.push_back({3., 4.}); // 7
+ points.push_back({2., 4. + std::sqrt(3.)}); // 8
+ points.push_back({0., 4.}); // 9
+ points.push_back({-0.5, 2.}); // 10
Filtration_value max_radius = 1.0;
- std::cout << "========== NUMBER OF POINTS = " << points.size() << " - Cech max_radius = " <<
- max_radius << "==========" << std::endl;
+ std::cout << "========== NUMBER OF POINTS = " << points.size() << " - Cech max_radius = " << max_radius
+ << "==========" << std::endl;
Cech_complex cech_complex_for_doc(points, max_radius);
@@ -108,24 +108,25 @@ BOOST_AUTO_TEST_CASE(Cech_complex_for_documentation) {
std::cout << vertex << ",";
vp.push_back(points.at(vertex));
}
- std::cout << ") - distance =" << Gudhi::Minimal_enclosing_ball_radius()(vp.at(0), vp.at(1)) <<
- " - filtration =" << st.filtration(f_simplex) << std::endl;
+ std::cout << ") - distance =" << Gudhi::Minimal_enclosing_ball_radius()(vp.at(0), vp.at(1))
+ << " - filtration =" << st.filtration(f_simplex) << std::endl;
BOOST_CHECK(vp.size() == 2);
- GUDHI_TEST_FLOAT_EQUALITY_CHECK(st.filtration(f_simplex), Gudhi::Minimal_enclosing_ball_radius()(vp.at(0), vp.at(1)));
+ GUDHI_TEST_FLOAT_EQUALITY_CHECK(st.filtration(f_simplex),
+ Gudhi::Minimal_enclosing_ball_radius()(vp.at(0), vp.at(1)));
}
}
const int DIMENSION_2 = 2;
#ifdef GUDHI_DEBUG
- BOOST_CHECK_THROW (cech_complex_for_doc.create_complex(st, DIMENSION_2), std::invalid_argument);
+ BOOST_CHECK_THROW(cech_complex_for_doc.create_complex(st, DIMENSION_2), std::invalid_argument);
#endif
Simplex_tree st2;
cech_complex_for_doc.create_complex(st2, DIMENSION_2);
std::cout << "st2.dimension()=" << st2.dimension() << std::endl;
BOOST_CHECK(st2.dimension() == DIMENSION_2);
-
+
std::cout << "st2.num_vertices()=" << st2.num_vertices() << std::endl;
BOOST_CHECK(st2.num_vertices() == NUMBER_OF_VERTICES);
@@ -137,7 +138,7 @@ BOOST_AUTO_TEST_CASE(Cech_complex_for_documentation) {
points012.push_back(cech_complex_for_doc.get_point(vertex));
}
std::size_t dimension = points[0].end() - points[0].begin();
- Min_sphere ms012(dimension, points012.begin(),points012.end());
+ Min_sphere ms012(dimension, points012.begin(), points012.end());
Simplex_tree::Filtration_value f012 = st2.filtration(st2.find({0, 1, 2}));
std::cout << "f012= " << f012 << " | ms012_radius= " << std::sqrt(ms012.squared_radius()) << std::endl;
@@ -148,7 +149,7 @@ BOOST_AUTO_TEST_CASE(Cech_complex_for_documentation) {
points1410.push_back(cech_complex_for_doc.get_point(1));
points1410.push_back(cech_complex_for_doc.get_point(4));
points1410.push_back(cech_complex_for_doc.get_point(10));
- Min_sphere ms1410(dimension, points1410.begin(),points1410.end());
+ Min_sphere ms1410(dimension, points1410.begin(), points1410.end());
Simplex_tree::Filtration_value f1410 = st2.filtration(st2.find({1, 4, 10}));
std::cout << "f1410= " << f1410 << " | ms1410_radius= " << std::sqrt(ms1410.squared_radius()) << std::endl;
@@ -159,7 +160,7 @@ BOOST_AUTO_TEST_CASE(Cech_complex_for_documentation) {
points469.push_back(cech_complex_for_doc.get_point(4));
points469.push_back(cech_complex_for_doc.get_point(6));
points469.push_back(cech_complex_for_doc.get_point(9));
- Min_sphere ms469(dimension, points469.begin(),points469.end());
+ Min_sphere ms469(dimension, points469.begin(), points469.end());
Simplex_tree::Filtration_value f469 = st2.filtration(st2.find({4, 6, 9}));
std::cout << "f469= " << f469 << " | ms469_radius= " << std::sqrt(ms469.squared_radius()) << std::endl;
@@ -168,7 +169,6 @@ BOOST_AUTO_TEST_CASE(Cech_complex_for_documentation) {
BOOST_CHECK((st2.find({6, 7, 8}) == st2.null_simplex()));
BOOST_CHECK((st2.find({3, 5, 7}) == st2.null_simplex()));
-
}
BOOST_AUTO_TEST_CASE(Cech_complex_from_points) {
@@ -176,13 +176,13 @@ BOOST_AUTO_TEST_CASE(Cech_complex_from_points) {
// Init of a list of points
// ----------------------------------------------------------------------------
Point_cloud points;
- std::vector<double> coords = { 0.0, 0.0, 0.0, 1.0 };
+ std::vector<double> coords = {0.0, 0.0, 0.0, 1.0};
points.push_back(Point(coords.begin(), coords.end()));
- coords = { 0.0, 0.0, 1.0, 0.0 };
+ coords = {0.0, 0.0, 1.0, 0.0};
points.push_back(Point(coords.begin(), coords.end()));
- coords = { 0.0, 1.0, 0.0, 0.0 };
+ coords = {0.0, 1.0, 0.0, 0.0};
points.push_back(Point(coords.begin(), coords.end()));
- coords = { 1.0, 0.0, 0.0, 0.0 };
+ coords = {1.0, 0.0, 0.0, 0.0};
points.push_back(Point(coords.begin(), coords.end()));
// ----------------------------------------------------------------------------
@@ -204,7 +204,8 @@ BOOST_AUTO_TEST_CASE(Cech_complex_from_points) {
for (auto vertex : st.simplex_vertex_range(f_simplex)) {
std::cout << vertex << " ";
}
- std::cout << ") -> " << "[" << st.filtration(f_simplex) << "] ";
+ std::cout << ") -> "
+ << "[" << st.filtration(f_simplex) << "] ";
std::cout << std::endl;
}
BOOST_CHECK(num_simplices == 15);
@@ -247,8 +248,8 @@ BOOST_AUTO_TEST_CASE(Cech_create_complex_throw) {
// ----------------------------------------------------------------------------
std::string off_file_name("alphacomplexdoc.off");
double max_radius = 12.0;
- std::cout << "========== OFF FILE NAME = " << off_file_name << " - Cech max_radius=" <<
- max_radius << "==========" << std::endl;
+ std::cout << "========== OFF FILE NAME = " << off_file_name << " - Cech max_radius=" << max_radius
+ << "==========" << std::endl;
Gudhi::Points_off_reader<Point> off_reader(off_file_name);
Cech_complex cech_complex_from_file(off_reader.get_point_cloud(), max_radius);
@@ -258,6 +259,6 @@ BOOST_AUTO_TEST_CASE(Cech_create_complex_throw) {
stree.insert_simplex_and_subfaces(simplex);
std::cout << "Check exception throw in debug mode" << std::endl;
// throw excpt because stree is not empty
- BOOST_CHECK_THROW (cech_complex_from_file.create_complex(stree, 1), std::invalid_argument);
+ BOOST_CHECK_THROW(cech_complex_from_file.create_complex(stree, 1), std::invalid_argument);
}
#endif