From 20e775951a0c8c06478b493eec01d4d853623c41 Mon Sep 17 00:00:00 2001 From: podlesny <podlesny@zedat.fu-berlin.de> Date: Sun, 14 Mar 2021 17:12:04 +0100 Subject: [PATCH] print regularity truncation info --- dune/tectonic/utils/debugutils.hh | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/dune/tectonic/utils/debugutils.hh b/dune/tectonic/utils/debugutils.hh index a9be1ad2..3f159fc2 100644 --- a/dune/tectonic/utils/debugutils.hh +++ b/dune/tectonic/utils/debugutils.hh @@ -14,6 +14,34 @@ //using namespace std; + template <class Friction, typename VectorType> + void printRegularityTruncation(const Friction& friction, const VectorType& x, double truncationTolerance = 1e8) { + using BitVector = Dune::BitSetVector<MY_DIM>; + + BitVector truncationFlags(x.size()); + truncationFlags.unsetAll(); + + size_t count = 0; + size_t vsmall = 0; + + + for (size_t i = 0; i < x.size(); ++i) { + //std::cout << f_.phi().regularity(i, x[i]) << " xnorm: " << x[i].two_norm() << std::endl; + auto tangential_x = x[i]; + tangential_x[0] = 0.0; + + if (tangential_x.two_norm()<1e-14) { + vsmall++; + } + + if (friction.regularity(i, x[i]) > truncationTolerance) { + count++; + } + } + + std::cout << "V<1e-14: " << vsmall << " regularityTruncation: " << count << std::endl; + } + template <typename VectorType> auto average(const VectorType& vec) { using BlockType = typename VectorType::block_type; -- GitLab