From 8b758e266e8518b10b83d6354c76adfd129aae69 Mon Sep 17 00:00:00 2001
From: Andreas Lauser <and@poware.org>
Date: Fri, 14 Jan 2011 14:43:20 +0000
Subject: [PATCH] vtk multi writer: set very small values to zero to  avoid
 problems with paraview

git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/trunk@5008 2fb0f335-1f38-0410-981e-8018bf24f1b0
---
 dumux/io/vtkmultiwriter.hh | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/dumux/io/vtkmultiwriter.hh b/dumux/io/vtkmultiwriter.hh
index af9f1d5bc6..97ee6a8cac 100644
--- a/dumux/io/vtkmultiwriter.hh
+++ b/dumux/io/vtkmultiwriter.hh
@@ -122,11 +122,16 @@ public:
     template <class VectorField>
     void addVertexData(VectorField *field, const char *name)
     {
-#ifndef NDEBUG
         // make sure the field is well defined
-        for (int i = 0; i < field->size(); ++i)
+        for (int i = 0; i < field->size(); ++i) {
             Valgrind::CheckDefined((*field)[i]);
-#endif
+
+            // set values which are too small to 0 to avoid problems
+            // with paraview
+            if (std::abs((*field)[i]) < FLT_MIN)
+                (*field)[i] = 0.0;
+        }
+
         curWriter_->addVertexData(*field, name);
     }
     
-- 
GitLab