From fd7ed5af6728a219a3dba840aece1648c1a7e11a Mon Sep 17 00:00:00 2001
From: Robert Kloefkorn <robertk@ucar.edu>
Date: Thu, 23 Jan 2014 14:29:37 -0700
Subject: [PATCH] moved dgmasspass.hh

---
 dune/fem-dg/operator/fluxes/dgprimalfluxes.hh | 22 +++++++++++++++++++
 .../{operator/dg => pass}/dgmasspass.hh       |  1 +
 2 files changed, 23 insertions(+)
 rename dune/fem-dg/{operator/dg => pass}/dgmasspass.hh (99%)

diff --git a/dune/fem-dg/operator/fluxes/dgprimalfluxes.hh b/dune/fem-dg/operator/fluxes/dgprimalfluxes.hh
index 2026ec98..461fd2c6 100644
--- a/dune/fem-dg/operator/fluxes/dgprimalfluxes.hh
+++ b/dune/fem-dg/operator/fluxes/dgprimalfluxes.hh
@@ -10,6 +10,7 @@
 #include <dune/fem/space/common/arrays.hh>
 
 #include <dune/fem-dg/operator/fluxes/diffusionflux.hh>
+#include <dune/fem-dg/pass/dgmasspass.hh>
 
 namespace Dune {
 
@@ -60,9 +61,21 @@ namespace Dune {
 
     class Lifting 
     {
+    protected:  
       const DiscreteGradientSpaceType& gradSpc_;
       LiftingFunctionType r_e_;
+
+#ifdef USE_CACHED_INVERSE_MASSMATRIX
+#warning "Using cached inverse local mass matrix"
+      // type of communication manager object which does communication
+      typedef typename DiscreteGradientSpaceType::template ToNewDimRange< 1 >::Type ScalarDiscreteFunctionSpaceType;
+      typedef Fem::DGMassInverseMassImplementation< ScalarDiscreteFunctionSpaceType, true > MassInverseMassType ;
+      typedef typename MassInverseMassType :: KeyType KeyType;
+      typedef Fem::SingletonList< KeyType, MassInverseMassType >  InverseMassProviderType;
+      MassInverseMassType& inverseMass_;
+#else
       LocalMassMatrixType localMassMatrix_;
+#endif
       unsigned char isInitialized_;
 
       // prohibit copying
@@ -71,9 +84,14 @@ namespace Dune {
       explicit Lifting( const DiscreteGradientSpaceType& grdSpace ) 
         : gradSpc_( grdSpace )
         , r_e_( gradSpc_ )
+#ifdef USE_CACHED_INVERSE_MASSMATRIX
+        , inverseMass_( InverseMassProviderType :: getObject( KeyType( gradSpc_.gridPart() ) ) ) 
+#else
         , localMassMatrix_( gradSpc_, 2*gradSpc_.order() )
+#endif
         , isInitialized_( 0 )
       {
+        assert( Fem::ThreadManager::singleThreadMode() );
       }
 
       bool isInitialized() const { return isInitialized_ == 2 ; }
@@ -94,7 +112,11 @@ namespace Dune {
       void finalize()
       {
         assert( isInitialized_ == 1 );
+#ifdef USE_CACHED_INVERSE_MASSMATRIX
+        inverseMass_.applyInverse( r_e_ );
+#else
         localMassMatrix_.applyInverse( r_e_ );
+#endif
         isInitialized_ = 2;
       }
     };
diff --git a/dune/fem-dg/operator/dg/dgmasspass.hh b/dune/fem-dg/pass/dgmasspass.hh
similarity index 99%
rename from dune/fem-dg/operator/dg/dgmasspass.hh
rename to dune/fem-dg/pass/dgmasspass.hh
index db881ef8..489a9442 100644
--- a/dune/fem-dg/operator/dg/dgmasspass.hh
+++ b/dune/fem-dg/pass/dgmasspass.hh
@@ -7,6 +7,7 @@
 
 #include <dune/common/typetraits.hh>
 
+#include <dune/fem/storage/singletonlist.hh>
 #include <dune/fem/common/tupleutility.hh>
 #include <dune/fem/pass/common/local.hh>
 #include <dune/fem/quadrature/cachingquadrature.hh>
-- 
GitLab