From 2352dce3eef8e4f0ad3db33e3b7226c1a562a5fa Mon Sep 17 00:00:00 2001
From: Robert K <robertk@posteo.org>
Date: Tue, 23 Feb 2016 21:25:21 +0100
Subject: [PATCH] Shared memory: make shared memory parallelization work again.
 Still to fix is the DomainDecomposed thread iterator.

---
 dune/fem-dg/examples/advdiff/test/CMakeLists.txt      | 1 +
 dune/fem-dg/examples/euler/test/CMakeLists.txt        | 1 +
 dune/fem-dg/examples/navierstokes/test/CMakeLists.txt | 1 +
 dune/fem-dg/examples/parameter/paramBase              | 2 +-
 dune/fem-dg/misc/algorithmcreatorselector.hh          | 2 ++
 dune/fem-dg/operator/dg/operatorbase.hh               | 4 ++--
 dune/fem-dg/operator/dg/primaloperator.hh             | 5 ++++-
 dune/fem-dg/operator/limiter/limitpass.hh             | 3 +--
 8 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/dune/fem-dg/examples/advdiff/test/CMakeLists.txt b/dune/fem-dg/examples/advdiff/test/CMakeLists.txt
index 406534ca..1958980b 100644
--- a/dune/fem-dg/examples/advdiff/test/CMakeLists.txt
+++ b/dune/fem-dg/examples/advdiff/test/CMakeLists.txt
@@ -6,6 +6,7 @@ configure_parameter_file()
 add_definitions( "-DYASPGRID" )
 add_definitions( "-DGRIDDIM=2" )
 add_definitions( "-DDIMRANGE=1" )
+#add_definitions( "-DUSE_PTHREADS" )
 
 if( NOT FEMDG_FAST_TESTBUILD )
   if( DUNE_FEM_DG_VERSION VERSION_LESS "2.4.1" )
diff --git a/dune/fem-dg/examples/euler/test/CMakeLists.txt b/dune/fem-dg/examples/euler/test/CMakeLists.txt
index e1a391f3..0dc17c31 100644
--- a/dune/fem-dg/examples/euler/test/CMakeLists.txt
+++ b/dune/fem-dg/examples/euler/test/CMakeLists.txt
@@ -5,6 +5,7 @@ configure_parameter_file()
 
 add_definitions( "-DYASPGRID" )
 add_definitions( "-DGRIDDIM=2" )
+#add_definitions( "-DUSE_PTHREADS" )
 
 if( NOT FEMDG_FAST_TESTBUILD )
   if( DUNE_FEM_DG_VERSION VERSION_LESS "2.4.1" )
diff --git a/dune/fem-dg/examples/navierstokes/test/CMakeLists.txt b/dune/fem-dg/examples/navierstokes/test/CMakeLists.txt
index 3fa9129c..bf9707bf 100644
--- a/dune/fem-dg/examples/navierstokes/test/CMakeLists.txt
+++ b/dune/fem-dg/examples/navierstokes/test/CMakeLists.txt
@@ -5,6 +5,7 @@ configure_parameter_file()
 # default settings for the test case
 add_definitions( "-DALUGRID_CUBE" )
 add_definitions( "-DGRIDDIM=2" )
+#add_definitions( "-DUSE_PTHREADS" )
 
 if( NOT FEMDG_FAST_TESTBUILD )
   if( DUNE_FEM_DG_VERSION VERSION_LESS "2.4.1" )
diff --git a/dune/fem-dg/examples/parameter/paramBase b/dune/fem-dg/examples/parameter/paramBase
index fe1da3b3..f523536a 100644
--- a/dune/fem-dg/examples/parameter/paramBase
+++ b/dune/fem-dg/examples/parameter/paramBase
@@ -5,7 +5,7 @@ fem.verboserank: 0
 # OMP THREADS 
 #------------
 # number of threads used in OMP program
-fem.parallel.numberofthreads: 8
+fem.parallel.numberofthreads: 4
 # write diagnostics file (
 # 0 don't, 1 only speedup file, 2 write all runfiles 
 # 3 only write 0, others at end, 4 all files at end for scaling) 
diff --git a/dune/fem-dg/misc/algorithmcreatorselector.hh b/dune/fem-dg/misc/algorithmcreatorselector.hh
index 5090fa56..0d91cc42 100644
--- a/dune/fem-dg/misc/algorithmcreatorselector.hh
+++ b/dune/fem-dg/misc/algorithmcreatorselector.hh
@@ -103,6 +103,8 @@ namespace Fem
       hierarchic_legendre = 2,
       //! Discrete function space with hierarchic orthonormal monomial basis functions
       orthonormal = 3
+      //! p-adaptive space from dune-fem, implementing dg and lagrange
+      // padaptive = 4
     };
   }
 
diff --git a/dune/fem-dg/operator/dg/operatorbase.hh b/dune/fem-dg/operator/dg/operatorbase.hh
index 46e8de91..ddbceea3 100644
--- a/dune/fem-dg/operator/dg/operatorbase.hh
+++ b/dune/fem-dg/operator/dg/operatorbase.hh
@@ -110,8 +110,8 @@ namespace Fem
 #endif
       LocalCDGPass< DiscreteModelType, InsertFunctionPassType, cdgpass >
 #ifdef USE_SMP_PARALLEL
-      , Fem::DomainDecomposedIteratorStorage< GridPartType >
-    //, Fem::ThreadIterator< GridPartType >
+      //, Fem::DomainDecomposedIteratorStorage< GridPartType >
+      , Fem::ThreadIterator< GridPartType >
       , true // non-blocking communication
         >
 #endif
diff --git a/dune/fem-dg/operator/dg/primaloperator.hh b/dune/fem-dg/operator/dg/primaloperator.hh
index 29f03b40..57741082 100644
--- a/dune/fem-dg/operator/dg/primaloperator.hh
+++ b/dune/fem-dg/operator/dg/primaloperator.hh
@@ -304,7 +304,10 @@ namespace Fem
     typedef LimitDGPass    < LimiterDiscreteModelType, Pass0Type, limitPassId >             InnerPass1Type;
     typedef ThreadPass     < InnerPass1Type, Fem::ThreadIterator< GridPartType >, true >    Pass1Type;
     typedef LocalCDGPass   < DiscreteModel1Type, Pass1Type, advectPassId >                  InnerPass2Type;
-    typedef ThreadPass     < InnerPass2Type, Fem::DomainDecomposedIteratorStorage<GridPartType >, true > Pass2Type;
+    typedef ThreadPass     < InnerPass2Type,
+              //Fem::DomainDecomposedIteratorStorage<GridPartType >,
+              Fem::ThreadIterator< GridPartType >,
+              true > Pass2Type;
 #else
     typedef Fem::StartPass < DestinationType, u >                                 Pass0Type;
     typedef LimitDGPass    < LimiterDiscreteModelType, Pass0Type, limitPassId >   Pass1Type;
diff --git a/dune/fem-dg/operator/limiter/limitpass.hh b/dune/fem-dg/operator/limiter/limitpass.hh
index 69536af5..efa0ed16 100644
--- a/dune/fem-dg/operator/limiter/limitpass.hh
+++ b/dune/fem-dg/operator/limiter/limitpass.hh
@@ -1259,8 +1259,7 @@ namespace Fem
           if( intersection.neighbor() )
           {
             // get neighbor
-            typename EntityType::EntityPointer outside = intersection.outside();
-            const EntityType & nb = * outside;
+            const EntityType& nb = intersection.outside();
 
             // check whether we have to skip this intersection
             if( nbChecker.skipIntersection( nb ) )
-- 
GitLab