1 // -*- tab-width: 4; indent-tabs-mode: nil -*-
2 #ifndef DUNE_PDELAB_CONSTRAINTS_P0GHOST_HH
3 #define DUNE_PDELAB_CONSTRAINTS_P0GHOST_HH
4 
5 #include "../common/geometrywrapper.hh"
6 #include<dune/grid/common/gridenums.hh>
7 
8 #include <dune/typetree/typetree.hh>
9 
10 namespace Dune {
11   namespace PDELab {
12 
13     //! \addtogroup Constraints
14     //! \ingroup FiniteElementMap
15     //! \{
16 
17     //! Parallel P0 constraints for nonoverlapping grids with ghosts
18     class P0ParallelGhostConstraints
19       : public TypeTree::LeafNode
20     {
21     public:
22       enum{doBoundary=false};
23       enum{doProcessor=false};
24       enum{doSkeleton=false};
25       enum{doVolume=true};
26 
27       //! volume constraints
28       /**
29        * \tparam EG  element geometry
30        * \tparam LFS local function space
31        * \tparam T   TransformationType
32        */
33 
34       template<typename P, typename EG, typename LFS, typename T>
volume(const P & param,const EG & eg,const LFS & lfs,T & trafo) const35       void volume (const P& param, const EG& eg, const LFS& lfs, T& trafo) const
36       {
37         // nothing to do for interior entities
38         if (eg.entity().partitionType()==Dune::InteriorEntity)
39           return;
40 
41         // constrain ghost entities
42         else if  (eg.entity().partitionType()==Dune::GhostEntity){
43           typename T::RowType empty;
44           typedef typename LFS::Traits::SizeType size_type;
45           for (size_type i=0; i<lfs.size(); i++){
46             trafo[lfs.dofIndex(i)] = empty;
47           }
48         }
49 
50       }
51     };
52     //! \}
53 
54   }
55 }
56 
57 #endif // DUNE_PDELAB_CONSTRAINTS_P0GHOST_HH
58