diff --git a/dune/gdt/local/dof-vector.hh b/dune/gdt/local/dof-vector.hh index 59658e842eb23e080c601c10e6d139d5a099b265..e3ad2e292c99f53af7c033dba0fd1b19cf629eb0 100644 --- a/dune/gdt/local/dof-vector.hh +++ b/dune/gdt/local/dof-vector.hh @@ -214,27 +214,21 @@ public: void add_to_entry(const size_t ii, const ScalarType& value) { -#ifndef NDEBUG - DUNE_THROW_IF(!this->is_bound_, Exceptions::not_bound_to_an_element_yet, ""); -#endif + DEBUG_THROW_IF(!this->is_bound_, Exceptions::not_bound_to_an_element_yet, ""); assert(ii < size_); global_vector_.add_to_entry(global_DoF_indices_[ii], value); } void set_entry(const size_t ii, const ScalarType& value) { -#ifndef NDEBUG - DUNE_THROW_IF(!this->is_bound_, Exceptions::not_bound_to_an_element_yet, ""); -#endif + DEBUG_THROW_IF(!this->is_bound_, Exceptions::not_bound_to_an_element_yet, ""); assert(ii < size_); global_vector_.set_entry(global_DoF_indices_[ii], value); } ScalarType get_entry(const size_t ii) const { -#ifndef NDEBUG - DUNE_THROW_IF(!this->is_bound_, Exceptions::not_bound_to_an_element_yet, ""); -#endif + DEBUG_THROW_IF(!this->is_bound_, Exceptions::not_bound_to_an_element_yet, ""); assert(ii < size_); return global_vector_.get_entry(global_DoF_indices_[ii]); } diff --git a/dune/gdt/local/operators/advection-fv.hh b/dune/gdt/local/operators/advection-fv.hh index d8ef9798e00b9e2ef1145706dd61d02e65028024..45448a63a4d063ea64ad1182cc4747ba70d8062f 100644 --- a/dune/gdt/local/operators/advection-fv.hh +++ b/dune/gdt/local/operators/advection-fv.hh @@ -128,12 +128,10 @@ public: LocalOutsideRangeType& local_range_outside, const XT::Common::Parameter& param = {}) const override final { -#ifndef NDEBUG - DUNE_THROW_IF((local_range_inside.space().type() != SpaceType::finite_volume) - || (local_range_outside.space().type() != SpaceType::finite_volume), - Exceptions::operator_error, - "Use LocalAdvectionDgCouplingOperator instead!"); -#endif + DEBUG_THROW_IF((local_range_inside.space().type() != SpaceType::finite_volume) + || (local_range_outside.space().type() != SpaceType::finite_volume), + Exceptions::operator_error, + "Use LocalAdvectionDgCouplingOperator instead!"); local_sources_[0]->evaluate( source_is_elementwise_constant_ ? static_x : intersection().geometryInInside().center(), u_, param); local_sources_[1]->evaluate( diff --git a/dune/gdt/spaces/mapper/continuous.hh b/dune/gdt/spaces/mapper/continuous.hh index c265f4a80c00ae713e628f0f7983b794a909664c..28b750ef0c626da5702ac09b288c375f0c7d876b 100644 --- a/dune/gdt/spaces/mapper/continuous.hh +++ b/dune/gdt/spaces/mapper/continuous.hh @@ -128,10 +128,9 @@ public: // one element and index 1 in the other element. Fixing this could be done by assigning an orientation to the edge // by looking at the (indices of the) vertices of the edge and reordering the local indices if the orientation is // not the same in all elements sharing the subentity. -#ifndef NDEBUG - if (d >= 2 && fe_order_ >= 3) - assert(element.type() == Dune::GeometryTypes::cube(d) && "Not implemented for this element, see comment above!"); -#endif + DEBUG_THROW_IF(d >= 2 && fe_order_ >= 3 && element.type() != Dune::GeometryTypes::cube(d), + Dune::NotImplemented, + "Not implemented for this element, see comment above!"); return mapper_.subIndex(element, local_key.subEntity(), local_key.codim()) + local_key.index(); } // ... mapToGlobal(...) diff --git a/dune/gdt/tools/timestepper/adaptive-rungekutta-kinetic.hh b/dune/gdt/tools/timestepper/adaptive-rungekutta-kinetic.hh index 2c2f33794c069c53c1996cd5a0694d266b054a66..44214ceb14b82adf2c406af00b0ae6a484bd6646 100644 --- a/dune/gdt/tools/timestepper/adaptive-rungekutta-kinetic.hh +++ b/dune/gdt/tools/timestepper/adaptive-rungekutta-kinetic.hh @@ -150,14 +150,13 @@ public: assert(b_1_.size() == A_.rows()); assert(b_2_.size() == A_.rows()); assert(c_.size() == A_.rows()); -#ifndef NDEBUG for (size_t ii = 0; ii < A_.rows(); ++ii) { for (size_t jj = ii; jj < A_.cols(); ++jj) { - assert(Dune::XT::Common::FloatCmp::eq(A_[ii][jj], 0.0) - && "A has to be a lower triangular matrix with 0 on the main diagonal"); + DUNE_THROW_IF(XT::Common::FloatCmp::ne(A_[ii][jj], 0.0), + XT::Common::Exceptions::wrong_input_given, + "A has to be a lower triangular matrix with 0 on the main diagonal"); } } -#endif // NDEBUG // store as many discrete functions as needed for intermediate stages for (size_t ii = 0; ii < num_stages_; ++ii) { stages_k_.emplace_back(current_solution()); diff --git a/dune/gdt/tools/timestepper/adaptive-rungekutta.hh b/dune/gdt/tools/timestepper/adaptive-rungekutta.hh index d35b5cc1439eab9593519239ee6381790760106a..34ee924988e590606ef214baa74f8d5413d050a8 100644 --- a/dune/gdt/tools/timestepper/adaptive-rungekutta.hh +++ b/dune/gdt/tools/timestepper/adaptive-rungekutta.hh @@ -275,14 +275,13 @@ public: assert(b_1_.size() == A_.rows()); assert(b_2_.size() == A_.rows()); assert(c_.size() == A_.rows()); -#ifndef NDEBUG for (size_t ii = 0; ii < A_.rows(); ++ii) { for (size_t jj = ii; jj < A_.cols(); ++jj) { - assert(Dune::XT::Common::FloatCmp::eq(A_[ii][jj], 0.0) - && "A has to be a lower triangular matrix with 0 on the main diagonal"); + DUNE_THROW_IF(XT::Common::FloatCmp::ne(A_[ii][jj], 0.0), + XT::Common::Exceptions::wrong_input_given, + "A has to be a lower triangular matrix with 0 on the main diagonal"); } } -#endif // NDEBUG // store as many discrete functions as needed for intermediate stages for (size_t ii = 0; ii < num_stages_; ++ii) { stages_k_.emplace_back(current_solution()); diff --git a/dune/gdt/tools/timestepper/explicit-rungekutta.hh b/dune/gdt/tools/timestepper/explicit-rungekutta.hh index 04199eeef60a4b68f4dc503f1fb15205f18e1b9d..8b416257cd87001b2a34c47045f08433af7fb4c6 100644 --- a/dune/gdt/tools/timestepper/explicit-rungekutta.hh +++ b/dune/gdt/tools/timestepper/explicit-rungekutta.hh @@ -215,14 +215,13 @@ public: assert(A_.rows() == A_.cols() && "A has to be a square matrix"); assert(b_.size() == A_.rows()); assert(c_.size() == A_.rows()); -#ifndef NDEBUG for (size_t ii = 0; ii < A_.rows(); ++ii) { for (size_t jj = ii; jj < A_.cols(); ++jj) { - assert(Dune::XT::Common::FloatCmp::eq(A_[ii][jj], 0.0) - && "A has to be a lower triangular matrix with 0 on the main diagonal"); + DUNE_THROW_IF(XT::Common::FloatCmp::ne(A_[ii][jj], 0.0), + XT::Common::Exceptions::wrong_input_given, + "A has to be a lower triangular matrix with 0 on the main diagonal"); } } -#endif // NDEBUG // store as many discrete functions as needed for the stages k for (size_t ii = 0; ii < num_stages_; ++ii) { stages_k_.emplace_back(current_solution());