summaryrefslogtreecommitdiff
path: root/src/Alpha_complex/include/gudhi
diff options
context:
space:
mode:
authorvrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2015-11-09 11:58:11 +0000
committervrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2015-11-09 11:58:11 +0000
commit97364487c2d4b687865b57a90169d78d803d9710 (patch)
tree6661ca38aa7e5d4f382d44bcc11dd7be0f8614bf /src/Alpha_complex/include/gudhi
parent03b68a5206201bf5bbffb7e4f6a6718907f23b2a (diff)
parent72f647ad4b802d08072925a374324e7ace4b2c4d (diff)
Backmerge from trunk.
Alpha complex code review. git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/alphashapes@894 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 702c4d667de4e7191d1050e6d855d2f79117f954
Diffstat (limited to 'src/Alpha_complex/include/gudhi')
-rw-r--r--src/Alpha_complex/include/gudhi/Alpha_complex.h33
1 files changed, 19 insertions, 14 deletions
diff --git a/src/Alpha_complex/include/gudhi/Alpha_complex.h b/src/Alpha_complex/include/gudhi/Alpha_complex.h
index d8568be0..6b47ace7 100644
--- a/src/Alpha_complex/include/gudhi/Alpha_complex.h
+++ b/src/Alpha_complex/include/gudhi/Alpha_complex.h
@@ -27,7 +27,6 @@
#include <gudhi/graph_simplicial_complex.h>
#include <gudhi/Simplex_tree.h>
-#include <stdio.h>
#include <stdlib.h>
#include <math.h> // isnan, fmax
@@ -107,7 +106,8 @@ class Alpha_complex : public Simplex_tree<> {
*
* @param[in] off_file_name OFF file [path and] name.
*/
- Alpha_complex(const std::string& off_file_name, Filtration_value max_alpha_square)
+ Alpha_complex(const std::string& off_file_name,
+ Filtration_value max_alpha_square = std::numeric_limits<Filtration_value>::infinity())
: triangulation_(nullptr) {
Gudhi::Delaunay_triangulation_off_reader<Delaunay_triangulation> off_reader(off_file_name);
if (!off_reader.is_valid()) {
@@ -123,7 +123,8 @@ class Alpha_complex : public Simplex_tree<> {
*
* @param[in] triangulation_ptr Pointer on a Delaunay triangulation.
*/
- Alpha_complex(Delaunay_triangulation* triangulation_ptr, Filtration_value max_alpha_square)
+ Alpha_complex(Delaunay_triangulation* triangulation_ptr,
+ Filtration_value max_alpha_square = std::numeric_limits<Filtration_value>::infinity())
: triangulation_(triangulation_ptr) {
set_filtration(max_alpha_square);
init();
@@ -134,18 +135,22 @@ class Alpha_complex : public Simplex_tree<> {
* the Alpha_complex.
*
* @param[in] dimension Dimension of points to be inserted.
- * @param[in] size Number of points to be inserted.
- * @param[in] firstPoint Iterator on the first point to be inserted.
- * @param[in] last Point Iterator on the last point to be inserted.
+ * @param[in] points Range of points to triangulate. Points must be in Kernel::Point_d
+ *
+ * The type InputPointRange must be a range for which std::begin and
+ * std::end return input iterators on a Kernel::Point_d.
*/
- template<typename ForwardIterator >
- Alpha_complex(int dimension, size_type size, ForwardIterator firstPoint, ForwardIterator lastPoint,
- Filtration_value max_alpha_square)
+ template<typename InputPointRange >
+ Alpha_complex(int dimension, const InputPointRange& points,
+ Filtration_value max_alpha_square = std::numeric_limits<Filtration_value>::infinity())
: triangulation_(nullptr) {
triangulation_ = new Delaunay_triangulation(dimension);
- size_type inserted = triangulation_->insert(firstPoint, lastPoint);
- if (inserted != size) {
- std::cerr << "Alpha_complex - insertion failed " << inserted << " != " << size << std::endl;
+ auto first = std::begin(points);
+ auto last = std::end(points);
+
+ size_type inserted = triangulation_->insert(first, last);
+ if (inserted != (last -first)) {
+ std::cerr << "Alpha_complex - insertion failed " << inserted << " != " << (last -first) << std::endl;
exit(-1); // ----- >>
}
set_filtration(max_alpha_square);
@@ -292,12 +297,12 @@ class Alpha_complex : public Simplex_tree<> {
// ### Foreach Tau face of Sigma
for (auto f_boundary : boundary_simplex_range(f_simplex)) {
#ifdef DEBUG_TRACES
- std::cout << " | --------------------------------------------------" << std::endl;
+ std::cout << " | --------------------------------------------------\n";
std::cout << " | Tau ";
for (auto vertex : simplex_vertex_range(f_boundary)) {
std::cout << vertex << " ";
}
- std::cout << "is a face of Sigma" << std::endl;
+ std::cout << "is a face of Sigma\n";
std::cout << " | isnan(filtration(Tau)=" << isnan(filtration(f_boundary)) << std::endl;
#endif // DEBUG_TRACES
// ### If filt(Tau) is not NaN