dune-fem  2.4.1-rc
petscslavedofprovider.hh
Go to the documentation of this file.
1 // vim: set expandtab ts=2 sw=2 sts=2:
2 #ifndef DUNE_FEM_PETSCSLAVEDOFPROVIDER_HH
3 #define DUNE_FEM_PETSCSLAVEDOFPROVIDER_HH
4 
6 
7 
8 #if HAVE_PETSC
9 
12 
13 
14 namespace Dune
15 {
16 
17  namespace Fem
18  {
19 
20  /* =================================================
21  * class PetscSlaveDofProvider
22  * =================================================
23  */
24  template< typename DFSpace >
25  class PetscSlaveDofProvider : public SlaveDofsProvider< DFSpace >
26  {
27  public:
28  typedef DFSpace DiscreteFunctionSpaceType;
29 
30  typedef PetscSlaveDofProvider< DiscreteFunctionSpaceType > ThisType;
31  typedef SlaveDofsProvider< DiscreteFunctionSpaceType > BaseType;
32  protected:
33  using BaseType :: space_;
34  using BaseType :: slaveDofs_;
35 
36  public:
37  typedef typename DiscreteFunctionSpaceType :: BlockMapperType BlockMapperType;
38  typedef SlaveDofs< DiscreteFunctionSpaceType, BlockMapperType > SlaveDofsType;
39 
40 
41  // type of communication manager object which does communication
42  typedef PetscDofMappings< SlaveDofsType > PetscDofMappingType;
43  typedef SingletonList< SlaveDofsType*, PetscDofMappingType > PetscDofMappingProviderType;
44 
45  explicit PetscSlaveDofProvider ( const DiscreteFunctionSpaceType &space )
46  : BaseType( space ),
47  dofMapping_( PetscDofMappingProviderType::getObject( slaveDofs_ ) )
48  {
49  }
50 
52  ~PetscSlaveDofProvider()
53  {
54  // free mapping
55  PetscDofMappingProviderType::removeObject( dofMapping_ );
56  }
57 
58  const PetscDofMappingType& dofMapping() const { return dofMapping_; }
59  PetscDofMappingType& dofMapping() { return dofMapping_; }
60 
61  protected:
62  // the globally unique dof mapping
63  PetscDofMappingType& dofMapping_;
64  };
65 
66 
67  } // namespace Fem
68 
69 } // namespace Dune
70 
71 #endif // #if HAVE_PETSC
72 
73 #endif // DUNE_FEM_PETSCSLAVEDOFPROVIDER_HH
Definition: coordinate.hh:4