summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2016-03-22 16:07:08 +0000
committervrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2016-03-22 16:07:08 +0000
commit5276b0a9e344ed0bb4fdb8b079f2ce86649d12a4 (patch)
treea48b71b30df671906508fdf489b242850e5f47a7
parentce097f4fd26faf1b52d7a50769f809feeab60c3d (diff)
GUDHI_CHECK was not intuitive.
Reverse GUDHI_CHECK calls. No exception when no point is given in contrction. git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/alphashapes@1070 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: bf6a08d48b5b29a5b24bf5107116e399dfc0a6bc
-rw-r--r--src/Alpha_complex/include/gudhi/Alpha_complex.h4
-rw-r--r--src/Simplex_tree/include/gudhi/Simplex_tree.h4
-rw-r--r--src/common/include/gudhi/Debug_utils.h6
3 files changed, 5 insertions, 9 deletions
diff --git a/src/Alpha_complex/include/gudhi/Alpha_complex.h b/src/Alpha_complex/include/gudhi/Alpha_complex.h
index 7c64b53e..330b3b34 100644
--- a/src/Alpha_complex/include/gudhi/Alpha_complex.h
+++ b/src/Alpha_complex/include/gudhi/Alpha_complex.h
@@ -159,7 +159,6 @@ class Alpha_complex : public Simplex_tree<> {
*
* The type InputPointRange must be a range for which std::begin and
* std::end return input iterators on a Kernel::Point_d.
- * \exception std::invalid_argument In debug mode, if an empty input point range is passed as argument.
*/
template<typename InputPointRange >
Alpha_complex(const InputPointRange& points,
@@ -168,9 +167,6 @@ class Alpha_complex : public Simplex_tree<> {
auto first = std::begin(points);
auto last = std::end(points);
- GUDHI_CHECK((first == last),
- std::invalid_argument("Alpha_complex::Alpha_complex(InputPointRange) - Empty input point range"));
-
if (first != last) {
// point_dimension function initialization
Point_Dimension point_dimension = kernel_.point_dimension_d_object();
diff --git a/src/Simplex_tree/include/gudhi/Simplex_tree.h b/src/Simplex_tree/include/gudhi/Simplex_tree.h
index 7b55df11..aa8f059e 100644
--- a/src/Simplex_tree/include/gudhi/Simplex_tree.h
+++ b/src/Simplex_tree/include/gudhi/Simplex_tree.h
@@ -454,7 +454,7 @@ class Simplex_tree {
* \exception std::invalid_argument In debug mode, if sh is a null_simplex.
*/
void assign_filtration(Simplex_handle sh, Filtration_value fv) {
- GUDHI_CHECK(sh == null_simplex(),
+ GUDHI_CHECK(sh != null_simplex(),
std::invalid_argument("Simplex_tree::assign_filtration - cannot assign filtration on null_simplex"));
sh->second.assign_filtration(fv);
}
@@ -1256,7 +1256,7 @@ class Simplex_tree {
*/
void remove_maximal_simplex(Simplex_handle sh) {
// Guarantee the simplex has no children
- GUDHI_CHECK(has_children(sh),
+ GUDHI_CHECK(!has_children(sh),
std::invalid_argument("Simplex_tree::remove_maximal_simplex - argument has children"));
// Simplex is a leaf, it means the child is the Siblings owning the leaf
diff --git a/src/common/include/gudhi/Debug_utils.h b/src/common/include/gudhi/Debug_utils.h
index 48d61fef..7573a9db 100644
--- a/src/common/include/gudhi/Debug_utils.h
+++ b/src/common/include/gudhi/Debug_utils.h
@@ -29,12 +29,12 @@
#define GUDHI_DEBUG
#endif
-// GUDHI_CHECK throw an exception on condition in debug mode, but does nothing in release mode
+// GUDHI_CHECK throw an exception if expression is false in debug mode, but does nothing in release mode
// Could assert in release mode, but cmake sets NDEBUG (for "NO DEBUG") in this mode, means assert does nothing.
#ifdef GUDHI_DEBUG
- #define GUDHI_CHECK(cond, excpt) if (cond) throw excpt
+ #define GUDHI_CHECK(expression, excpt) if ((expression) == 0) throw excpt
#else
- #define GUDHI_CHECK(cond, excpt) (void) 0
+ #define GUDHI_CHECK(expression, excpt) (void) 0
#endif
#define PRINT(a) std::cerr << #a << ": " << (a) << " (DISP)" << std::endl