summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2017-01-20 12:42:27 +0000
committervrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2017-01-20 12:42:27 +0000
commita823bfcb70ed76e8858604050570ff8fe33f6667 (patch)
treef21f8be40f8aeb7b71e2b1aeb60c03254651f5d4
parentfb0c2d4d50b1fcb8ba6758883d27df0aad5de356 (diff)
cpplint fixes
doxygen warning fixes git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/bottleneck_misc_fixes@1972 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 5b2328016edb6b5b30de668a0488c576d3d92c40
-rw-r--r--data/points/generator/hypergenerator.cpp16
-rw-r--r--src/Bottleneck_distance/example/bottleneck_basic_example.cpp6
-rw-r--r--src/Bottleneck_distance/example/bottleneck_read_file_example.cpp2
-rw-r--r--src/Bottleneck_distance/include/gudhi/Bottleneck.h9
-rw-r--r--src/Bottleneck_distance/include/gudhi/Graph_matching.h3
-rw-r--r--src/Bottleneck_distance/include/gudhi/Neighbors_finder.h1
-rw-r--r--src/Bottleneck_distance/include/gudhi/Persistence_graph.h10
-rw-r--r--src/Doxyfile3
-rw-r--r--src/common/doc/main_page.h17
-rw-r--r--src/common/example/example_CGAL_3D_points_off_reader.cpp2
-rw-r--r--src/common/example/example_CGAL_points_off_reader.cpp2
11 files changed, 46 insertions, 25 deletions
diff --git a/data/points/generator/hypergenerator.cpp b/data/points/generator/hypergenerator.cpp
index 60890b44..5831de18 100644
--- a/data/points/generator/hypergenerator.cpp
+++ b/data/points/generator/hypergenerator.cpp
@@ -29,7 +29,7 @@
#include <iterator>
#include <vector>
#include <fstream> // for std::ofstream
-
+#include <cstdlib>
typedef CGAL::Epick_d< CGAL::Dynamic_dimension_tag > K;
typedef K::Point_d Point;
@@ -47,24 +47,22 @@ int main(int argc, char **argv) {
usage(argv[0]);
}
- int points_number = 0;
- int returnedScanValue = sscanf(argv[4], "%d", &points_number);
- if ((returnedScanValue == EOF) || (points_number <= 0)) {
+ int points_number = atoi(argv[4]);
+ if (points_number <= 0) {
std::cerr << "Error: " << argv[4] << " is not correct" << std::endl;
usage(argv[0]);
}
- int dimension = 0;
- returnedScanValue = sscanf(argv[5], "%d", &dimension);
- if ((returnedScanValue == EOF) || (dimension <= 0)) {
+ int dimension = atoi(argv[5]);
+ if (dimension <= 0) {
std::cerr << "Error: " << argv[5] << " is not correct" << std::endl;
usage(argv[0]);
}
double radius = 1.0;
if (argc == 7) {
- returnedScanValue = sscanf(argv[6], "%lf", &radius);
- if ((returnedScanValue == EOF) || (radius <= 0.0)) {
+ radius = atof(argv[6]);
+ if (radius <= 0.0) {
std::cerr << "Error: " << argv[6] << " is not correct" << std::endl;
usage(argv[0]);
}
diff --git a/src/Bottleneck_distance/example/bottleneck_basic_example.cpp b/src/Bottleneck_distance/example/bottleneck_basic_example.cpp
index 91a7302f..d0ca4e20 100644
--- a/src/Bottleneck_distance/example/bottleneck_basic_example.cpp
+++ b/src/Bottleneck_distance/example/bottleneck_basic_example.cpp
@@ -21,10 +21,13 @@
*/
#include <gudhi/Bottleneck.h>
+
#include <iostream>
+#include <vector>
+#include <utility> // for pair
+#include <limits> // for numeric_limits
int main() {
-
std::vector< std::pair<double, double> > v1, v2;
v1.emplace_back(2.7, 3.7);
@@ -44,5 +47,4 @@ int main() {
b = Gudhi::persistence_diagram::bottleneck_distance(v1, v2, 0.1);
std::cout << "Approx bottleneck distance = " << b << std::endl;
-
}
diff --git a/src/Bottleneck_distance/example/bottleneck_read_file_example.cpp b/src/Bottleneck_distance/example/bottleneck_read_file_example.cpp
index 4c74b66e..bde05825 100644
--- a/src/Bottleneck_distance/example/bottleneck_read_file_example.cpp
+++ b/src/Bottleneck_distance/example/bottleneck_read_file_example.cpp
@@ -24,6 +24,8 @@
#include <gudhi/Bottleneck.h>
#include <iostream>
+#include <vector>
+#include <utility> // for pair
#include <fstream>
#include <sstream>
#include <string>
diff --git a/src/Bottleneck_distance/include/gudhi/Bottleneck.h b/src/Bottleneck_distance/include/gudhi/Bottleneck.h
index 2b7e4767..b5641e29 100644
--- a/src/Bottleneck_distance/include/gudhi/Bottleneck.h
+++ b/src/Bottleneck_distance/include/gudhi/Bottleneck.h
@@ -24,6 +24,11 @@
#define BOTTLENECK_H_
#include <gudhi/Graph_matching.h>
+
+#include <vector>
+#include <algorithm> // for max
+#include <limits> // for numeric_limits
+
#include <cmath>
namespace Gudhi {
@@ -41,7 +46,7 @@ double bottleneck_distance_approx(Persistence_graph& g, double e) {
if (step <= b_lower_bound || step >= b_upper_bound) // Avoid precision problem
break;
m.set_r(step);
- while (m.multi_augment()); // compute a maximum matching (in the graph corresponding to the current r)
+ while (m.multi_augment()) {}; // compute a maximum matching (in the graph corresponding to the current r)
if (m.perfect()) {
m = biggest_unperfect;
b_upper_bound = step;
@@ -63,7 +68,7 @@ double bottleneck_distance_exact(Persistence_graph& g) {
while (lower_bound_i != upper_bound_i) {
long step = lower_bound_i + static_cast<long> ((upper_bound_i - lower_bound_i - 1) / alpha);
m.set_r(sd.at(step));
- while (m.multi_augment()); // compute a maximum matching (in the graph corresponding to the current r)
+ while (m.multi_augment()) {}; // compute a maximum matching (in the graph corresponding to the current r)
if (m.perfect()) {
m = biggest_unperfect;
upper_bound_i = step;
diff --git a/src/Bottleneck_distance/include/gudhi/Graph_matching.h b/src/Bottleneck_distance/include/gudhi/Graph_matching.h
index 253c89b4..e1708c5b 100644
--- a/src/Bottleneck_distance/include/gudhi/Graph_matching.h
+++ b/src/Bottleneck_distance/include/gudhi/Graph_matching.h
@@ -25,6 +25,9 @@
#include <gudhi/Neighbors_finder.h>
+#include <vector>
+#include <list>
+
namespace Gudhi {
namespace persistence_diagram {
diff --git a/src/Bottleneck_distance/include/gudhi/Neighbors_finder.h b/src/Bottleneck_distance/include/gudhi/Neighbors_finder.h
index 96ece360..cd5486f8 100644
--- a/src/Bottleneck_distance/include/gudhi/Neighbors_finder.h
+++ b/src/Bottleneck_distance/include/gudhi/Neighbors_finder.h
@@ -34,6 +34,7 @@
#include <gudhi/Internal_point.h>
#include <unordered_set>
+#include <vector>
namespace Gudhi {
diff --git a/src/Bottleneck_distance/include/gudhi/Persistence_graph.h b/src/Bottleneck_distance/include/gudhi/Persistence_graph.h
index 3a4a5fec..39efc082 100644
--- a/src/Bottleneck_distance/include/gudhi/Persistence_graph.h
+++ b/src/Bottleneck_distance/include/gudhi/Persistence_graph.h
@@ -23,9 +23,11 @@
#ifndef PERSISTENCE_GRAPH_H_
#define PERSISTENCE_GRAPH_H_
+#include <gudhi/Internal_point.h>
+
#include <vector>
#include <algorithm>
-#include <gudhi/Internal_point.h>
+#include <limits> // for numeric_limits
namespace Gudhi {
@@ -92,10 +94,12 @@ Persistence_graph::Persistence_graph(const Persistence_diagram1 &diag1,
swap(u, v);
std::sort(u_alive.begin(), u_alive.end());
std::sort(v_alive.begin(), v_alive.end());
- if (u_alive.size() != v_alive.size())
+ if (u_alive.size() != v_alive.size()) {
b_alive = std::numeric_limits<double>::infinity();
- else for (auto it_u = u_alive.cbegin(), it_v = v_alive.cbegin(); it_u != u_alive.cend(); ++it_u, ++it_v)
+ } else {
+ for (auto it_u = u_alive.cbegin(), it_v = v_alive.cbegin(); it_u != u_alive.cend(); ++it_u, ++it_v)
b_alive = std::max(b_alive, std::fabs(*it_u - *it_v));
+ }
}
inline bool Persistence_graph::on_the_u_diagonal(int u_point_index) const {
diff --git a/src/Doxyfile b/src/Doxyfile
index 71aa038d..bf7deb57 100644
--- a/src/Doxyfile
+++ b/src/Doxyfile
@@ -784,7 +784,8 @@ EXCLUDE = data/ \
example/ \
GudhUI/ \
cmake/ \
- debian/
+ debian/ \
+ include/gudhi_patches/
# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
# directories that are symbolic links (a Unix file system feature) are excluded
diff --git a/src/common/doc/main_page.h b/src/common/doc/main_page.h
index cf67b558..660327d9 100644
--- a/src/common/doc/main_page.h
+++ b/src/common/doc/main_page.h
@@ -261,9 +261,11 @@ make \endverbatim
* Persistent_cohomology/custom_persistence_sort.cpp</a>
*
* The following example requires CGAL version &ge; 4.8.0:
- * \li <a href="_bottleneck_distance_2_bottleneck_example_8cpp-example.html">
- *
- * Bottleneck_distance/bottleneck_example.cpp</a>
+ * \li <a href="_bottleneck_distance_2_bottleneck_basic_example_8cpp-example.html">
+ * Bottleneck_distance/bottleneck_basic_example.cpp</a>
+ * \li <a href="_bottleneck_distance_2_bottleneck_read_file_example_8cpp-example.html">
+ * Bottleneck_distance/bottleneck_read_file_example.cpp</a>
+ *
* \subsection eigen3 Eigen3
* The \ref alpha_complex data structure and few examples requires
* <a target="_blank" href="http://eigen.tuxfamily.org/">Eigen3</a> is a C++ template library for linear algebra:
@@ -275,8 +277,10 @@ make \endverbatim
* Alpha_complex/Alpha_complex_from_off.cpp</a>
* \li <a href="_alpha_complex_2_alpha_complex_from_points_8cpp-example.html">
* Alpha_complex/Alpha_complex_from_points.cpp</a>
- * \li <a href="_bottleneck_distance_2_bottleneck_example_8cpp-example.html">
- * Bottleneck_distance/bottleneck_example.cpp</a>
+ * \li <a href="_bottleneck_distance_2_bottleneck_basic_example_8cpp-example.html">
+ * Bottleneck_distance/bottleneck_basic_example.cpp</a>
+ * \li <a href="_bottleneck_distance_2_bottleneck_read_file_example_8cpp-example.html">
+ * Bottleneck_distance/bottleneck_read_file_example.cpp</a>
* \li <a href="_persistent_cohomology_2alpha_complex_persistence_8cpp-example.html">
* Persistent_cohomology/alpha_complex_persistence.cpp</a>
* \li <a href="_persistent_cohomology_2periodic_alpha_complex_3d_persistence_8cpp-example.html">
@@ -358,7 +362,8 @@ make \endverbatim
/*! @file Examples
* @example Alpha_complex/Alpha_complex_from_off.cpp
* @example Alpha_complex/Alpha_complex_from_points.cpp
- * @example Bottleneck_distance/bottleneck_example.cpp
+ * @example Bottleneck_distance/bottleneck_basic_example.cpp
+ * @example Bottleneck_distance/bottleneck_read_file_example.cpp
* @example Bitmap_cubical_complex/Bitmap_cubical_complex.cpp
* @example Bitmap_cubical_complex/Bitmap_cubical_complex_periodic_boundary_conditions.cpp
* @example Bitmap_cubical_complex/Random_bitmap_cubical_complex.cpp
diff --git a/src/common/example/example_CGAL_3D_points_off_reader.cpp b/src/common/example/example_CGAL_3D_points_off_reader.cpp
index d48bb17d..665b7a29 100644
--- a/src/common/example/example_CGAL_3D_points_off_reader.cpp
+++ b/src/common/example/example_CGAL_3D_points_off_reader.cpp
@@ -32,7 +32,7 @@ int main(int argc, char **argv) {
// Retrieve the triangulation
std::vector<Point_3> point_cloud = off_reader.get_point_cloud();
- int n {0};
+ int n {};
for (auto point : point_cloud) {
++n;
std::cout << "Point[" << n << "] = (" << point[0] << ", " << point[1] << ", " << point[2] << ")\n";
diff --git a/src/common/example/example_CGAL_points_off_reader.cpp b/src/common/example/example_CGAL_points_off_reader.cpp
index 4522174a..8c6a6b54 100644
--- a/src/common/example/example_CGAL_points_off_reader.cpp
+++ b/src/common/example/example_CGAL_points_off_reader.cpp
@@ -34,7 +34,7 @@ int main(int argc, char **argv) {
// Retrieve the triangulation
std::vector<Point_d> point_cloud = off_reader.get_point_cloud();
- int n {0};
+ int n {};
for (auto point : point_cloud) {
std::cout << "Point[" << n << "] = ";
for (std::size_t i {0}; i < point.size(); i++)