From 2fe47e38a18a4dfa3ff70de8fda87fe1c79427ea Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jakub=20Klinkovsk=C3=BD?= <klinkovsky@mmg.fjfi.cvut.cz>
Date: Fri, 14 Feb 2020 21:50:40 +0100
Subject: [PATCH] tnl-diff: re-implemented getDifferenceLpNorm using expression
 templates

---
 src/Tools/tnl-diff.h | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/Tools/tnl-diff.h b/src/Tools/tnl-diff.h
index e17ca7940b..81a0620de9 100644
--- a/src/Tools/tnl-diff.h
+++ b/src/Tools/tnl-diff.h
@@ -394,8 +394,11 @@ bool computeDifferenceOfVectors( const MeshPointer& meshPointer, const Config::P
          //if( snapshotPeriod != 0.0 )
          outputFile << std::setw( 6 ) << ( i - half ) * snapshotPeriod << " ";
       }
-      Real l1Diff = meshPointer->getDifferenceLpNorm( v1, v2, 1.0 );
-      Real l2Diff = meshPointer->getDifferenceLpNorm( v1, v2, 2.0 );
+      Real cellVolume = meshPointer->getCellMeasure();
+//      Real l1Diff = meshPointer->getDifferenceLpNorm( v1, v2, 1.0 );
+      Real l1Diff = cellVolume * sum( abs( v1 - v2 ) );
+//      Real l2Diff = meshPointer->getDifferenceLpNorm( v1, v2, 2.0 );
+      Real l2Diff = cellVolume * std::sqrt( dot(v1 - v2, v1 - v2) );
       Real maxDiff = max( abs( v1 - v2 ) );
       if( snapshotPeriod != 0.0 )
       {
-- 
GitLab