From: Jean-Paul Pelteret Date: Sun, 3 May 2020 07:36:37 +0000 (+0200) Subject: Remove some debug output in DictionarySubstitutionVisitor X-Git-Tag: v9.2.0-rc1~112^2~4 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=811faece60622376ddf7402c6e622cd7d88e00e2;p=dealii.git Remove some debug output in DictionarySubstitutionVisitor --- diff --git a/include/deal.II/differentiation/sd/symengine_number_visitor_internal.h b/include/deal.II/differentiation/sd/symengine_number_visitor_internal.h index 498477c195..bd9bf5a935 100644 --- a/include/deal.II/differentiation/sd/symengine_number_visitor_internal.h +++ b/include/deal.II/differentiation/sd/symengine_number_visitor_internal.h @@ -793,11 +793,6 @@ namespace Differentiation /* ------------------ DictionarySubstitutionVisitor ------------------ */ - // Perform some extra checks in debug mode. This will give some verbose - // output if something goes wrong. - // #define DEBUG_EXTRA_CSE - - template void DictionarySubstitutionVisitor::init( @@ -860,12 +855,6 @@ namespace Differentiation else { cse.init(outputs); - -# if defined(DEBUG) && defined(DEBUG_EXTRA_CSE) - // Check the result of CSE by directly evaluating - // the dependent variables on an individual basis - dependent_variables = outputs; -# endif } } @@ -902,51 +891,6 @@ namespace Differentiation if (cse.executed()) { cse.call(output_values, independent_symbols, substitution_values); - -# if defined(DEBUG) && defined(DEBUG_EXTRA_CSE) - // Directly check the result of the CSE calculations - Assert(dependent_variables.size() > 0, ExcInternalError()); - SymEngine::map_basic_basic substitution_value_map; - for (unsigned i = 0; i < independent_variables.size(); ++i) - substitution_value_map[independent_variables[i]] = - static_cast &>( - ExpressionType(substitution_values[i])); - const ReturnType tol = - dealii::internal::NumberType::value(1e-9); - - for (unsigned i = 0; i < dependent_variables.size(); ++i) - { - const ReturnType result = - ExpressionType(dependent_variables[i]) - .template substitute_and_evaluate( - substitution_value_map); - - // Note: Need to do an abs() on the tolerance to cater for - // the complex value case. - const bool value_correct = - (std::abs(output_values[i] - result) / std::abs(result) < - std::abs(tol)); - if (value_correct == false) - { - std::ostringstream stream; - stream - << "A CSE based evaluation is incorrect. The result should have been " - << result << " but was rather calculated to be " - << output_values[i] << ".\n Substitution map: \n"; - for (typename SymEngine::map_basic_basic::const_iterator - it = substitution_value_map.begin(); - it != substitution_value_map.end(); - ++it) - { - stream << *(it->first) << " = " << *(it->second) - << "\n"; - } - stream << std::endl; - const std::string msg = stream.str(); - Assert(value_correct, ExcMessage(msg)); - } - } -# endif } else { @@ -1002,9 +946,6 @@ namespace Differentiation Archive & ar, const unsigned int version) { -# if !(defined(DEBUG) && defined(DEBUG_EXTRA_CSE)) - Assert(dependent_variables.empty(), ExcInternalError()); -# endif Assert(cse.executed() == false, ExcInternalError()); Assert(cse.n_intermediate_expressions() == 0, ExcInternalError()); Assert(cse.n_reduced_expressions() == 0, ExcInternalError());