diff options
author | cjamin <cjamin@636b058d-ea47-450e-bf9e-a15bfbe3eedb> | 2016-09-21 09:23:34 +0000 |
---|---|---|
committer | cjamin <cjamin@636b058d-ea47-450e-bf9e-a15bfbe3eedb> | 2016-09-21 09:23:34 +0000 |
commit | 35444924982074475df87b126a51cf4b16949a8a (patch) | |
tree | fa53714d321965d72b5252e31e3f466e7e0a2721 /src/Persistent_cohomology/include | |
parent | 227f58f39835ea33381ddb28f05ce43fcfa058b2 (diff) | |
parent | d04f3f02858044180471fc7e38948ff73e330162 (diff) |
Merge from trunk
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/subsampling_and_spatialsearching@1520 636b058d-ea47-450e-bf9e-a15bfbe3eedb
Former-commit-id: 477d84d9b29057de29afbb77d830d9d46a8f54be
Diffstat (limited to 'src/Persistent_cohomology/include')
-rw-r--r-- | src/Persistent_cohomology/include/gudhi/Persistent_cohomology.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/Persistent_cohomology/include/gudhi/Persistent_cohomology.h b/src/Persistent_cohomology/include/gudhi/Persistent_cohomology.h index a7d1e463..b31df6a4 100644 --- a/src/Persistent_cohomology/include/gudhi/Persistent_cohomology.h +++ b/src/Persistent_cohomology/include/gudhi/Persistent_cohomology.h @@ -41,6 +41,7 @@ #include <tuple> #include <algorithm> #include <string> +#include <stdexcept> // for std::out_of_range namespace Gudhi { @@ -89,6 +90,7 @@ class Persistent_cohomology { * * @param[in] cpx Complex for which the persistent homology is computed. * cpx is a model of FilteredComplex + * @exception std::out_of_range In case the number of simplices is more than Simplex_key type numeric limit. */ explicit Persistent_cohomology(Complex_ds& cpx) : cpx_(&cpx), @@ -106,6 +108,10 @@ class Persistent_cohomology { interval_length_policy(&cpx, 0), column_pool_(), // memory pools for the CAM cell_pool_() { + if (cpx_->num_simplices() > std::numeric_limits<Simplex_key>::max()) { + // num_simplices must be strictly lower than the limit, because a value is reserved for null_key. + throw std::out_of_range ("The number of simplices is more than Simplex_key type numeric limit."); + } Simplex_key idx_fil = 0; for (auto sh : cpx_->filtration_simplex_range()) { cpx_->assign_key(sh, idx_fil); |