dune-fem  2.8-git
discretefunctionspace.hh
Go to the documentation of this file.
1 #ifndef DUNE_FEM_DISCRETEFUNCTIONSPACE_HH
2 #define DUNE_FEM_DISCRETEFUNCTIONSPACE_HH
3 
4 // C++ includes
5 #include <cassert>
6 
7 #include <memory>
8 #include <tuple>
9 #include <type_traits>
10 #include <utility>
11 
12 // dune-common includes
13 #include <dune/common/bartonnackmanifcheck.hh>
14 #include <dune/common/dynvector.hh>
15 
16 // dune-fem includes
27 #include <dune/fem/version.hh>
28 
29 // local includes
30 #include "allgeomtypes.hh"
31 #include "dofstorage.hh"
32 
33 
34 namespace Dune
35 {
36 
37  namespace Fem
38  {
39 
53  // ExportsDiscreteFunctionSpaceType
54  // --------------------------------
55 
56  template< class T >
58  {
59  typedef char Small;
60  struct Big { char dummy[ 2 ]; };
61 
62  template< class U >
63  static Small test ( const U &, typename U::DiscreteFunctionSpaceType * = nullptr );
64  static Big test ( ... );
65 
66  static const T &makeT ();
67 
68  template< class U, bool >
69  struct GetDiscreteFunctionSpaceType;
70 
71  template< class U >
72  struct GetDiscreteFunctionSpaceType< U, true >
73  {
74  typedef typename U::DiscreteFunctionSpaceType Type;
75  };
76 
77  template< class U >
78  struct GetDiscreteFunctionSpaceType< U, false >
79  {
80  typedef void Type;
81  };
82 
83  public:
84  static const bool v = (sizeof( test( makeT() ) ) == sizeof( Small ));
85  typedef typename GetDiscreteFunctionSpaceType< T, v >::Type Type;
86  };
87 
88 
89 
90  // DFSpaceIdentifier
91  // -----------------
92 
107  };
108 
109  inline std::string spaceName( const DFSpaceIdentifier id )
110  {
111  switch( id )
112  {
113  case CombinedSpace_id : return "CombinedSpace";
114  case DFAdapter_id : return "DFAdapter";
115  case DGSpace_id : return "DiscontinuousGalerkinSpace";
116  case FiniteVolumeSpace_id : return "FiniteVolumeSpace";
117  case FourierSpace_id : return "FourierSpace";
118  case GenericSpace_id : return "GenericSpace";
119  case LagrangeSpace_id : return "LagrangeSpace";
120  case RannacherTurekSpace_id : return "RannacherTurekSpace";
121  case LegendreDGSpace_id : return "LegendreDGSpace";
122  case HierarchicLegendreDGSpace_id : return "HierarchicLegendreDGSpace";
123  case LagrangeDGSpace_id : return "LagrangeDGSpace";
124  default : return "unknown space";
125  }
126  }
127 
129  {};
130 
131  template< class DiscreteFunctionSpaceImp,
132  class NewFunctionSpace>
134 
135  template <class FunctionSpaceImp,
136  class GridPartImp,
137  int polOrd,
138  class StorageImp,
139  template <class,class,int,class> class DiscreteFunctionSpaceImp,
140  class NewFunctionSpace>
142  DiscreteFunctionSpaceImp<FunctionSpaceImp,GridPartImp,polOrd,StorageImp>,
143  NewFunctionSpace>
144  {
145  typedef DiscreteFunctionSpaceImp< NewFunctionSpace, GridPartImp, polOrd, StorageImp > Type;
146  };
147 
148  template <class FunctionSpaceImp,
149  class GridPartImp,
150  int polOrd,
151  bool caching,
152  template <class,class,int,bool> class DiscreteFunctionSpaceImp,
153  class NewFunctionSpace>
155  DiscreteFunctionSpaceImp<FunctionSpaceImp,GridPartImp,polOrd,caching>,
156  NewFunctionSpace>
157  {
158  typedef DiscreteFunctionSpaceImp< NewFunctionSpace, GridPartImp, polOrd, caching > Type;
159  };
160 
161 
162  //**************************************************************************
163  //
164  // --DiscreteFunctionSpaceInterface
165  //
181  template< class FunctionSpaceTraits >
183  : public FunctionSpaceTraits :: FunctionSpaceType
184  {
185  public:
187  typedef FunctionSpaceTraits Traits;
188 
190  typedef typename Traits :: DiscreteFunctionSpaceType
193  typedef typename Traits :: FunctionSpaceType FunctionSpaceType;
194 
195  private:
196  typedef FunctionSpaceType BaseType;
197 
198  public:
200  typedef typename Traits :: BasisFunctionSetType BasisFunctionSetType;
202  typedef typename Traits :: BlockMapperType BlockMapperType;
203 
204  typedef typename Traits::LocalBlockIndices LocalBlockIndices;
205 
207  static constexpr std::size_t localBlockSize = Hybrid::size( LocalBlockIndices() );
208 
210  typedef typename Traits :: GridPartType GridPartType;
211 
213  typedef typename GridPartType :: GridType GridType;
215  typedef typename GridPartType :: IndexSetType IndexSetType;
220  typedef typename GridPartType :: template Codim< Traits::codimension > :: IteratorType
223  typedef typename GridPartType :: template Codim< Traits::codimension > :: EntityType EntityType;
225  typedef typename GridPartType :: IntersectionType IntersectionType;
228 
230  [[deprecated("Use AuxiliaryDofsType instead!")]]
232 
239  template< class DiscreteFunction,
240  class Operation = // get default type from traits
241  typename Traits :: template CommDataHandle< DiscreteFunction > :: OperationType
242  >
244  {
246  typedef typename Traits
249 
251  typedef typename Traits
254  };
255 
258 
260  template< class NewFunctionSpace >
262  {
265  };
266 
268  template< int newDimRange >
270  {
272 
275  };
276 
277  private:
278  static_assert( std::is_same<typename BaseType::DomainFieldType, typename GridType::ctype>::value,
279  "Domain field type of function space must equal field type of grid." );
280 
281  protected:
283  {}
284 
285  public:
286 
287  // Methods Provided by the Implementation
288  // --------------------------------------
289 
294  {
295  CHECK_INTERFACE_IMPLEMENTATION(asImp().type());
296  return asImp().type();
297  }
298 
306  inline const BasisFunctionSetType basisFunctionSet ( const EntityType &entity ) const
307  {
308  CHECK_INTERFACE_IMPLEMENTATION( asImp().basisFunctionSet( entity ) );
309  return asImp().basisFunctionSet( entity );
310  }
311 
324  inline bool continuous () const
325  {
326  CHECK_INTERFACE_IMPLEMENTATION( asImp().continuous() );
327  return asImp().continuous();
328  }
329 
334  inline int sequence () const
335  {
336  CHECK_INTERFACE_IMPLEMENTATION( asImp().sequence() );
337  return asImp().sequence();
338  }
339 
345  inline int order () const
346  {
347  CHECK_INTERFACE_IMPLEMENTATION( asImp().order() );
348  return asImp().order();
349  }
350 
364  inline bool continuous (const IntersectionType &intersection) const
365  {
366  CHECK_INTERFACE_IMPLEMENTATION( asImp().continuous(intersection) );
367  return asImp().continuous(intersection);
368  }
369 
374  inline BlockMapperType &blockMapper () const
375  {
376  CHECK_INTERFACE_IMPLEMENTATION( asImp().blockMapper() );
377  return asImp().blockMapper();
378  }
379 
384  inline const GridType &grid () const
385  {
386  CHECK_INTERFACE_IMPLEMENTATION( asImp().grid() );
387  return asImp().grid();
388  }
389 
394  inline GridType &grid ()
395  {
396  CHECK_INTERFACE_IMPLEMENTATION( asImp().grid() );
397  return asImp().grid();
398  }
399 
405  {
406  CHECK_INTERFACE_IMPLEMENTATION(asImp().gridPart());
407  return asImp().gridPart();
408  }
409 
414  inline const IndexSetType &indexSet () const
415  {
416  CHECK_INTERFACE_IMPLEMENTATION( asImp().indexSet() );
417  return asImp().indexSet();
418  }
419 
424  inline int size () const
425  {
426  CHECK_INTERFACE_IMPLEMENTATION( asImp().size() );
427  return asImp().size();
428  }
429 
435  inline IteratorType begin () const
436  {
437  CHECK_INTERFACE_IMPLEMENTATION( asImp().begin() );
438  return asImp().begin();
439  }
440 
446  inline IteratorType end () const
447  {
448  CHECK_INTERFACE_IMPLEMENTATION( asImp().end() );
449  return asImp().end();
450  }
451 
462  template< class FunctorType >
463  inline void forEach ( FunctorType &f ) const
464  {
465  CHECK_AND_CALL_INTERFACE_IMPLEMENTATION( asImp().forEach( f ) );
466  }
467 
473  inline bool multipleGeometryTypes () const
474  {
475  CHECK_INTERFACE_IMPLEMENTATION( asImp().multipleGeometryTypes() );
476  return asImp().multipleGeometryTypes();
477  }
478 
479 
485  inline bool multipleBasisFunctionSets () const
486  {
487  CHECK_INTERFACE_IMPLEMENTATION( asImp().multipleBasisFunctionSets() );
488  return asImp().multipleBasisFunctionSets();
489  }
490 
494  InterfaceType communicationInterface() const
495  {
496  CHECK_INTERFACE_IMPLEMENTATION( asImp().communicationInterface() );
497  return asImp().communicationInterface();
498  }
499 
503  CommunicationDirection communicationDirection() const
504  {
505  CHECK_INTERFACE_IMPLEMENTATION( asImp().communicationDirection() );
506  return asImp().communicationDirection();
507  }
508 
513  {
514  CHECK_INTERFACE_IMPLEMENTATION( asImp().communicator() );
515  return asImp().communicator();
516  }
517 
523  template <class DiscreteFunction>
524  void communicate(DiscreteFunction& discreteFunction) const
525  {
526  CHECK_AND_CALL_INTERFACE_IMPLEMENTATION(
527  asImp().communicate( discreteFunction ) );
528  }
529 
536  template <class DiscreteFunction, class Operation>
537  void communicate(DiscreteFunction& discreteFunction, const Operation& op) const
538  {
539  CHECK_AND_CALL_INTERFACE_IMPLEMENTATION(
540  asImp().communicate( discreteFunction , op ) );
541  }
542 
550  template< class DiscreteFunction, class Operation >
551  inline typename CommDataHandle< DiscreteFunction, Operation > :: Type
552  createDataHandle ( DiscreteFunction& discreteFunction,
553  const Operation &operation ) const
554  {
555  CHECK_INTERFACE_IMPLEMENTATION
556  ( asImp().createDataHandle( discreteFunction, operation ) );
557  return asImp().createDataHandle( discreteFunction, operation );
558  }
559 
562  {
563  CHECK_INTERFACE_IMPLEMENTATION( asImp().auxiliaryDofs() );
564  return asImp().auxiliaryDofs();
565  }
566 
568  [[deprecated("Use auxiliaryDofs instead!")]]
570  {
571  return auxiliaryDofs();
572  }
573 
574  protected:
575  // Barton-Nackman trick
576  inline const DiscreteFunctionSpaceType &asImp () const
577  {
578  return static_cast< const DiscreteFunctionSpaceType & >( *this );
579  }
580 
581  // Barton-Nackman trick
583  {
584  return static_cast< DiscreteFunctionSpaceType & >( *this );
585  }
586  }; // end class DiscreteFunctionSpaceInterface
587 
588 
589 
600  template< class Traits >
603  {
604  return &(X.blockMapper()) == &(Y.blockMapper());
605  }
606 
607 
608 
609  //---------------------------------------------------------------------------
610  //-
611  //- --DiscreteFunctionSpaceDefault
612  //-
613  //-
614  //---------------------------------------------------------------------------
624  template< class FunctionSpaceTraits >
626  : public DiscreteFunctionSpaceInterface< FunctionSpaceTraits >,
627  public std::enable_shared_from_this< typename FunctionSpaceTraits::DiscreteFunctionSpaceType >
628  {
629  public:
630  typedef FunctionSpaceTraits Traits;
631 
632  private:
635 
636  public:
637  typedef typename Traits :: DiscreteFunctionSpaceType
639 
641  typedef typename BaseType :: GridType GridType;
645 
646  protected:
647  using BaseType :: asImp;
648 
649  public:
652  using BaseType :: order ;
653 
656 
659 
662 
663  protected:
665  {
666  typedef std::pair< AuxiliaryDofsType, int > ObjectType;
667 
668  static ObjectType *createObject ( std::pair< GridPartType *, BlockMapperType * > key )
669  {
670  return new ObjectType( std::piecewise_construct, std::tie( *key.first, *key.second ), std::make_tuple( -1 ) );
671  }
672 
673  static void deleteObject ( ObjectType *object ) { delete object; }
674  };
675 
677 
678  protected:
680 
683  typedef Dune::DynamicVector< typename BaseType::RangeFieldType, LocalDofVectorAllocatorType > LocalDofVectorType;
684 
687 
689 
690  // set of all geometry types possible
693 
694  // reference to dof manager
696 
697  // communication manager
698  const InterfaceType commInterface_;
699  const CommunicationDirection commDirection_;
700  mutable std::unique_ptr< CommunicationManagerType > communicator_;
701 
702  public:
705  const InterfaceType commInterface = InteriorBorder_All_Interface,
706  const CommunicationDirection commDirection = ForwardCommunication )
707  : BaseType(),
708  gridPart_( gridPart ),
709  ldvStack_( 0 ),
712  dofManager_( DofManagerType :: instance( gridPart.grid() ) ),
713  commInterface_( commInterface ),
714  commDirection_( commDirection )
715  {}
716 
718  inline int sequence () const
719  {
720  return dofManager_.sequence();
721  }
722 
727  inline int order ( const EntityType& entity ) const
728  {
729  return asImp().basisFunctionSet( entity ).order();
730  }
731 
733  inline const GridType &grid () const
734  {
735  return asImp().gridPart().grid();
736  }
737 
739  inline GridType &grid ()
740  {
741  return asImp().gridPart().grid();
742  }
743 
745  inline GridPartType &gridPart () const
746  {
747  return gridPart_;
748  }
749 
751  inline const IndexSetType &indexSet () const
752  {
753  return asImp().gridPart().indexSet();
754  }
755 
757  inline int size () const
758  {
759  return blockMapper().size() * localBlockSize ;
760  }
761 
763  inline int maxNumDofs () const
764  {
765  return blockMapper().maxNumDofs() * localBlockSize;
766  }
767 
773  inline IteratorType begin () const
774  {
775  return asImp().gridPart().template begin< 0 >();
776  }
777 
783  inline IteratorType end () const
784  {
785  return asImp().gridPart().template end< 0 >();
786  }
787 
797  template< class FunctorType >
798  inline void forEach ( FunctorType &f ) const
799  {
800  const IteratorType end = asImp().end();
801  for( IteratorType it = asImp().begin(); it != end; ++it )
802  f( *it );
803  }
804 
806  inline bool multipleGeometryTypes () const
807  {
809  }
810 
815  inline bool multipleBasisFunctionSets () const
816  {
817  return false;
818  }
819 
821  InterfaceType communicationInterface () const
822  {
823  return commInterface_;
824  }
825 
827  CommunicationDirection communicationDirection () const
828  {
829  return commDirection_;
830  }
831 
834  {
835  if( !communicator_ )
837  assert( communicator_ != 0 );
838  return *communicator_;
839  }
840 
842  template <class DiscreteFunction>
843  void communicate(DiscreteFunction& discreteFunction) const
844  {
845  // get type of default operation
846  typedef typename DiscreteFunction :: DiscreteFunctionSpaceType :: template
847  CommDataHandle< DiscreteFunction > :: OperationType DefaultOperationType;
848 
849  // default communication operation
850  DefaultOperationType operation;
851 
852  // exchange data
853  communicate( discreteFunction, operation );
854  }
855 
857  template <class DiscreteFunction, class Operation>
858  void communicate(DiscreteFunction& discreteFunction, const Operation& op ) const
859  {
860  static_assert( std::is_same< typename DiscreteFunctionSpaceType::BlockMapperType,
861  typename DiscreteFunction::DiscreteFunctionSpaceType::BlockMapperType >::value &&
862  localBlockSize == static_cast< std::size_t >(DiscreteFunction::DiscreteFunctionSpaceType::localBlockSize),
863  "DiscreteFunctionSpaceDefault::communicate cannot be called with discrete functions defined over a different space" );
864 
865  communicator().exchange( discreteFunction, op );
866  }
867 
875  template< class DiscreteFunction, class Operation >
876  inline typename BaseType
877  :: template CommDataHandle< DiscreteFunction, Operation > :: Type
878  createDataHandle( DiscreteFunction &discreteFunction,
879  const Operation& operation ) const
880  {
881  static_assert( std::is_same< typename DiscreteFunctionSpaceType::BlockMapperType,
882  typename DiscreteFunction::DiscreteFunctionSpaceType::BlockMapperType >::value &&
883  localBlockSize == static_cast< std::size_t >(DiscreteFunction::DiscreteFunctionSpaceType::localBlockSize),
884  "DiscreteFunctionSpaceDefault::createDataHandle cannot be called with discrete functions defined over a different space" );
885  return typename BaseType
887  :: Type( discreteFunction, operation );
888  }
889 
892  {
893  if ( !auxiliaryDofs_ )
894  auxiliaryDofs_.reset( &(AuxiliaryDofsProviderType::getObject( std::make_pair( &this->gridPart(), &this->blockMapper() ) )) );
895  const int sequence = asImp().sequence();
896  if( auxiliaryDofs_->second != sequence )
897  {
898  auxiliaryDofs_->first.rebuild();
899  auxiliaryDofs_->second = sequence;
900  }
901  return auxiliaryDofs_->first;
902  }
903 
905  template <class DiscreteFunction>
906  void addFunction( DiscreteFunction& df ) const
907  {
908  }
909 
911  template <class DiscreteFunction>
912  void removeFunction( DiscreteFunction& df ) const
913  {
914  }
915 
918  template <class Vector>
919  void adapt( const Vector& polynomialOrders, const int polOrderShift = 0 ) const
920  {
921  }
922 
923  protected:
929  inline const std::vector<GeometryType>& geomTypes(int codim) const
930  {
931  return allGeomTypes_.geomTypes(codim);
932  }
933 
934  // only combined space should use geomTypes
935  template <class , int , DofStoragePolicy> friend class CombinedSpace;
936  mutable std::unique_ptr< std::pair< AuxiliaryDofsType, int >, typename AuxiliaryDofsProviderType::Deleter > auxiliaryDofs_;
937  };
938 
939 
940 
942  //
943  // DiscreteFunctionSpaceAdapter
944  //
946 
955  template< class FunctionSpaceImp, class GridPartImp >
957  : public FunctionSpaceImp
958  , public std::enable_shared_from_this< DiscreteFunctionSpaceAdapter<FunctionSpaceImp,GridPartImp> >
959  {
960  public:
961  // type of the underlying function space
962  typedef FunctionSpaceImp FunctionSpaceType;
964  typedef GridPartImp GridPartType;
965 
966  private:
968  ThisType;
969  typedef FunctionSpaceType BaseType;
970 
971  public:
972  enum { polynomialOrder = 111 };
973 
975  typedef typename GridPartType :: GridType GridType;
977  typedef typename GridPartType :: IndexSetType IndexSetType;
979  typedef typename GridPartType :: template Codim< 0 > :: IteratorType
981  //- type of used entity
982  typedef typename GridType :: template Codim< 0 > :: Entity EntityType;
983  //- type of intersections
984  typedef typename GridPartType :: IntersectionType IntersectionType;
985 
988 
989  protected:
991  const unsigned int order_;
992 
993  public:
996  ( const GridPartType &gridPart,
997  unsigned int order = polynomialOrder )
998  : BaseType(),
999  gridPart_( gridPart ),
1000  order_( order )
1001  {
1002  }
1003 
1006  : BaseType( other ),
1007  gridPart_( other.gridPart_ ),
1008  order_( other.order_ )
1009  {
1010  }
1011 
1013  inline IteratorType begin () const
1014  {
1015  return gridPart_.template begin< 0 >();
1016  }
1017 
1019  inline IteratorType end () const
1020  {
1021  return gridPart_.template end< 0 >();
1022  }
1023 
1025  template< class FunctorType >
1026  inline void forEach ( FunctorType &f ) const
1027  {
1028  const IteratorType endit = end();
1029  for( IteratorType it = begin(); it != endit; ++it )
1030  f( *it );
1031  }
1032 
1034  inline const GridPartType &gridPart () const
1035  {
1036  return gridPart_;
1037  }
1038 
1040  inline const IndexSetType &indexSet () const
1041  {
1042  return gridPart_.indexSet();
1043  }
1044 
1046  inline const GridType& grid () const
1047  {
1048  return gridPart_.grid();
1049  }
1050 
1052  inline bool continuous () const
1053  {
1054  return true;
1055  }
1057  inline bool continuous (const IntersectionType &intersection) const
1058  {
1059  return true;
1060  }
1061 
1063  inline int order () const
1064  {
1065  return order_;
1066  }
1067 
1069  inline int order ( const EntityType& ) const
1070  {
1071  return order();
1072  }
1073 
1075  inline DFSpaceIdentifier type () const
1076  {
1077  return DFAdapter_id;
1078  }
1079  };
1080 
1082 
1088  template <class KeyImp, class ObjectImp, class ObjectFactoryImp>
1090  {
1091  public:
1093  static ObjectImp * createObject( const KeyImp & key )
1094  {
1095  ObjectFactoryImp fac(key);
1096  return new ObjectImp(fac);
1097  }
1098 
1100  static void deleteObject( ObjectImp * obj )
1101  {
1102  delete obj;
1103  }
1104  };
1105 
1106  } // namespace Fem
1107 
1108 } // namespace Dune
1109 #endif // #ifndef DUNE_FEM_DISCRETEFUNCTIONSPACE_HH
void exchange(DiscreteFunction &discreteFunction) const
exchange data for a discrete function using the copy operation
Definition: communicationmanager.hh:225
DFSpaceIdentifier
enumerator for identification of spaces
Definition: discretefunctionspace.hh:94
std::string spaceName(const DFSpaceIdentifier id)
Definition: discretefunctionspace.hh:109
@ CombinedSpace_id
id for Combined Space
Definition: discretefunctionspace.hh:95
@ LagrangeSpace_id
id for Lagrange Space
Definition: discretefunctionspace.hh:101
@ LegendreDGSpace_id
id for Legendre Discontinuous Galerkin Space
Definition: discretefunctionspace.hh:103
@ GenericSpace_id
id for Generic Space
Definition: discretefunctionspace.hh:100
@ LocalFiniteElementSpace_id
id for local finite element space
Definition: discretefunctionspace.hh:106
@ DFAdapter_id
id for DiscreteFunctionSpace Adapter
Definition: discretefunctionspace.hh:96
@ FourierSpace_id
id for Fourier space
Definition: discretefunctionspace.hh:99
@ DGSpace_id
id for Discontinuous Galerkin Space
Definition: discretefunctionspace.hh:97
@ LagrangeDGSpace_id
id for Lagrange Discontinuous Galerkin Space
Definition: discretefunctionspace.hh:105
@ FiniteVolumeSpace_id
id for Finite Volume Space
Definition: discretefunctionspace.hh:98
@ HierarchicLegendreDGSpace_id
id for Hierarchic Legendre Discontinuous Galerkin Space
Definition: discretefunctionspace.hh:104
@ RannacherTurekSpace_id
id for Rannacher-Turek space
Definition: discretefunctionspace.hh:102
int sequence() const
return number of sequence, if dofmanagers memory was changed by calling some method like resize,...
Definition: dofmanager.hh:981
Definition: bindguard.hh:11
bool operator==(const Double &a, const Double &b)
Definition: double.hh:600
A temporary function carrying values for one entity.
Definition: temporary.hh:24
Definition: combinedspace/combinedspace.hh:32
default implementation uses method geomTypes of given index set. Used in DiscreteFunctionSpaces.
Definition: allgeomtypes.hh:99
static bool multipleGeomTypes()
UGGrid might have different geom types.
Definition: allgeomtypes.hh:178
const std ::vector< GeometryType > & geomTypes(unsigned int codim) const
returns vector with geometry tpyes this index set has indices for
Definition: allgeomtypes.hh:171
In parallel computations the dofs of a discrete function are made up by all primary dofs....
Definition: auxiliarydofs.hh:47
default communication manager using just the grids communicate method
Definition: communicationmanager.hh:77
Definition: dofmanager.hh:762
Definition: discretefunctionspace.hh:58
static const bool v
Definition: discretefunctionspace.hh:84
GetDiscreteFunctionSpaceType< T, v >::Type Type
Definition: discretefunctionspace.hh:85
Definition: discretefunctionspace.hh:129
Definition: discretefunctionspace.hh:133
DiscreteFunctionSpaceImp< NewFunctionSpace, GridPartImp, polOrd, StorageImp > Type
Definition: discretefunctionspace.hh:145
DiscreteFunctionSpaceImp< NewFunctionSpace, GridPartImp, polOrd, caching > Type
Definition: discretefunctionspace.hh:158
This is the interface for discrete function spaces. All methods declared here have to be implemented ...
Definition: discretefunctionspace.hh:184
static constexpr std::size_t localBlockSize
size of local blocks
Definition: discretefunctionspace.hh:207
AuxiliaryDofs< GridPartType, BlockMapperType > AuxiliaryDofsType
type of auxiliary dofs
Definition: discretefunctionspace.hh:227
bool continuous() const
returns true if the space contains only globally continuous functions
Definition: discretefunctionspace.hh:324
Traits::LocalBlockIndices LocalBlockIndices
Definition: discretefunctionspace.hh:204
Traits ::FunctionSpaceType FunctionSpaceType
type of function space
Definition: discretefunctionspace.hh:193
const AuxiliaryDofsType & auxiliaryDofs() const
get auxiliary dofs
Definition: discretefunctionspace.hh:561
Traits ::GridPartType GridPartType
type of underlying grid part
Definition: discretefunctionspace.hh:210
CommDataHandle< DiscreteFunction, Operation >::Type createDataHandle(DiscreteFunction &discreteFunction, const Operation &operation) const
Creates DataHandle for given discrete function.
Definition: discretefunctionspace.hh:552
GridPartType ::template Codim< Traits::codimension >::EntityType EntityType
type of entity of codimension 0
Definition: discretefunctionspace.hh:223
GridPartType & gridPart()
get a reference to the associated grid partition
Definition: discretefunctionspace.hh:404
const IndexSetType & indexSet() const
Get a reference to the associated index set.
Definition: discretefunctionspace.hh:414
const GridType & grid() const
get reference to grid this discrete function space belongs to
Definition: discretefunctionspace.hh:384
bool multipleBasisFunctionSets() const
returns true if base function sets depend on the entity
Definition: discretefunctionspace.hh:485
InterfaceType communicationInterface() const
return the communication interface appropriate for this space
Definition: discretefunctionspace.hh:494
CommunicationManager< DiscreteFunctionSpaceType > CommunicationManagerType
type of communication manager
Definition: discretefunctionspace.hh:257
FunctionSpaceTraits Traits
type of traits class
Definition: discretefunctionspace.hh:187
GridPartType ::GridType GridType
type of underlying dune grid
Definition: discretefunctionspace.hh:213
const AuxiliaryDofsType & slaveDofs() const
deprecated method, use auxiliaryDofs
Definition: discretefunctionspace.hh:569
const BasisFunctionSetType basisFunctionSet(const EntityType &entity) const
get basis function set for given entity
Definition: discretefunctionspace.hh:306
BlockMapperType & blockMapper() const
get a reference to the block mapper
Definition: discretefunctionspace.hh:374
int order() const
get global order of space
Definition: discretefunctionspace.hh:345
DFSpaceIdentifier type() const
return type identifier of discrete function space
Definition: discretefunctionspace.hh:293
bool continuous(const IntersectionType &intersection) const
returns true if discrete functions over this space have zero jump over the given intersection.
Definition: discretefunctionspace.hh:364
const CommunicationManagerType & communicator() const
return reference to communicator (see CommunicationManager)
Definition: discretefunctionspace.hh:512
Traits ::BlockMapperType BlockMapperType
type of block mapper of this space
Definition: discretefunctionspace.hh:202
GridPartType ::IndexSetType IndexSetType
type of used dune index set
Definition: discretefunctionspace.hh:215
DiscreteFunctionSpaceInterface()
Definition: discretefunctionspace.hh:282
GridPartType ::template Codim< Traits::codimension >::IteratorType IteratorType
type of iterator for grid traversal
Definition: discretefunctionspace.hh:221
int sequence() const
get index of the sequence in grid sequences
Definition: discretefunctionspace.hh:334
void forEach(FunctorType &f) const
apply a functor to each entity in the associated grid partition
Definition: discretefunctionspace.hh:463
void communicate(DiscreteFunction &discreteFunction) const
communicate data for given discrete function using the space's default communication operation
Definition: discretefunctionspace.hh:524
DiscreteFunctionSpaceType & asImp()
Definition: discretefunctionspace.hh:582
IteratorType end() const
get iterator pointing behind the last entity of the associated grid partition
Definition: discretefunctionspace.hh:446
bool multipleGeometryTypes() const
returns true if the grid has more than one geometry type
Definition: discretefunctionspace.hh:473
int size() const
get number of DoFs for this space
Definition: discretefunctionspace.hh:424
IteratorType begin() const
get iterator pointing to the first entity of the associated grid partition
Definition: discretefunctionspace.hh:435
AuxiliaryDofsType SlaveDofsType
deprecated type
Definition: discretefunctionspace.hh:231
CommunicationDirection communicationDirection() const
return the communication direction appropriate for this space
Definition: discretefunctionspace.hh:503
Traits ::DiscreteFunctionSpaceType DiscreteFunctionSpaceType
type of DiscretefunctionSapce implementation (Barton-Nackman)
Definition: discretefunctionspace.hh:191
const DiscreteFunctionSpaceType & asImp() const
Definition: discretefunctionspace.hh:576
GridPartType ::IntersectionType IntersectionType
type of the intersections
Definition: discretefunctionspace.hh:225
void communicate(DiscreteFunction &discreteFunction, const Operation &op) const
communicate data for given discrete function
Definition: discretefunctionspace.hh:537
GridType & grid()
get reference to grid this discrete function space belongs to
Definition: discretefunctionspace.hh:394
Traits ::BasisFunctionSetType BasisFunctionSetType
type of basis function set of this space
Definition: discretefunctionspace.hh:200
defines type of data handle for communication
Definition: discretefunctionspace.hh:244
Traits ::template CommDataHandle< DiscreteFunction, Operation >::OperationType OperationType
type of operation to perform on scatter
Definition: discretefunctionspace.hh:253
Traits ::template CommDataHandle< DiscreteFunction, Operation >::Type Type
type of communication data handle
Definition: discretefunctionspace.hh:248
typedef struct for defining the same discrete function space with a different function space
Definition: discretefunctionspace.hh:262
DifferentDiscreteFunctionSpace< DiscreteFunctionSpaceType, NewFunctionSpace >::Type Type
type of my discrete function space with new function space
Definition: discretefunctionspace.hh:264
typedef struct for defining the same discrete function space with a different dimRange
Definition: discretefunctionspace.hh:270
ToNewFunctionSpace< NewFunctionSpaceType >::Type Type
type of my discrete function space with new dim range
Definition: discretefunctionspace.hh:274
ToNewDimRangeFunctionSpace< FunctionSpaceType, newDimRange >::Type NewFunctionSpaceType
Definition: discretefunctionspace.hh:271
This is the class with default implementations for discrete function. The methods not marked with hav...
Definition: discretefunctionspace.hh:628
BaseType ::template CommDataHandle< DiscreteFunction, Operation >::Type createDataHandle(DiscreteFunction &discreteFunction, const Operation &operation) const
Definition: discretefunctionspace.hh:878
std::unique_ptr< std::pair< AuxiliaryDofsType, int >, typename AuxiliaryDofsProviderType::Deleter > auxiliaryDofs_
Definition: discretefunctionspace.hh:936
const IndexSetType & indexSet() const
Get a reference to the associated index set.
Definition: discretefunctionspace.hh:751
const InterfaceType commInterface_
Definition: discretefunctionspace.hh:698
GridType & grid()
get reference to grid this discrete function space belongs to
Definition: discretefunctionspace.hh:739
LocalDofVectorAllocatorType ldvAllocator_
Definition: discretefunctionspace.hh:686
std::unique_ptr< CommunicationManagerType > communicator_
Definition: discretefunctionspace.hh:700
BaseType::BlockMapperType BlockMapperType
Definition: discretefunctionspace.hh:660
bool multipleBasisFunctionSets() const
returns true if base function sets depend on the entity
Definition: discretefunctionspace.hh:815
int order(const EntityType &entity) const
default implementation of the method order
Definition: discretefunctionspace.hh:727
LocalDofVectorStackType ldvStack_
Definition: discretefunctionspace.hh:685
BaseType ::IteratorType IteratorType
Definition: discretefunctionspace.hh:643
void addFunction(DiscreteFunction &df) const
default implementation of addFunction does nothing at the moment
Definition: discretefunctionspace.hh:906
void removeFunction(DiscreteFunction &df) const
default implementation of removeFunction does nothing at the moment
Definition: discretefunctionspace.hh:912
void communicate(DiscreteFunction &discreteFunction) const
communicate data for given discrete function using the space's default communication operation
Definition: discretefunctionspace.hh:843
GridPartType & gridPart_
Definition: discretefunctionspace.hh:679
InterfaceType communicationInterface() const
return the communication interface appropriate for this space
Definition: discretefunctionspace.hh:821
SingletonList< std::pair< GridPartType *, BlockMapperType * >, std::pair< AuxiliaryDofsType, int >, AuxiliaryDofsFactory > AuxiliaryDofsProviderType
Definition: discretefunctionspace.hh:676
void forEach(FunctorType &f) const
apply a functor to each entity in the associated grid partition
Definition: discretefunctionspace.hh:798
const AllGeometryTypes allGeomTypes_
Definition: discretefunctionspace.hh:692
BaseType ::EntityType EntityType
Definition: discretefunctionspace.hh:644
int maxNumDofs() const
return the maximal number of dofs on entities
Definition: discretefunctionspace.hh:763
const GridType & grid() const
get reference to grid this discrete function space belongs to
Definition: discretefunctionspace.hh:733
const std::vector< GeometryType > & geomTypes(int codim) const
returns true if the grid has more than one geometry type
Definition: discretefunctionspace.hh:929
int sequence() const
get index of the sequence in grid sequences
Definition: discretefunctionspace.hh:718
AllGeomTypes< IndexSetType, GridType > AllGeometryTypes
Definition: discretefunctionspace.hh:691
BaseType::AuxiliaryDofsType AuxiliaryDofsType
Definition: discretefunctionspace.hh:661
BaseType ::GridPartType GridPartType
Definition: discretefunctionspace.hh:640
const CommunicationManagerType & communicator() const
return reference to communicator (see CommunicationManager)
Definition: discretefunctionspace.hh:833
void communicate(DiscreteFunction &discreteFunction, const Operation &op) const
communicate data for given discrete function
Definition: discretefunctionspace.hh:858
int size() const
get number of DoFs for this space
Definition: discretefunctionspace.hh:757
void adapt(const Vector &polynomialOrders, const int polOrderShift=0) const
default implementation of adapt does nothing, its only used in PAdaptiveLagrangeSpace
Definition: discretefunctionspace.hh:919
DofManagerType & dofManager_
Definition: discretefunctionspace.hh:695
BaseType ::IndexSetType IndexSetType
Definition: discretefunctionspace.hh:642
BaseType ::GridType GridType
Definition: discretefunctionspace.hh:641
const AuxiliaryDofsType & auxiliaryDofs() const
get auxiliary dofs
Definition: discretefunctionspace.hh:891
BasicTemporaryLocalFunction< ThisType, LocalDofVectorType > LocalFunctionType
Definition: discretefunctionspace.hh:688
CommunicationManager< DiscreteFunctionSpaceType > CommunicationManagerType
type of communication manager
Definition: discretefunctionspace.hh:658
const CommunicationDirection commDirection_
Definition: discretefunctionspace.hh:699
CommunicationDirection communicationDirection() const
return the communication interface appropriate for this space
Definition: discretefunctionspace.hh:827
IteratorType end() const
get iterator pointing behind the last entity of the associated grid partition
Definition: discretefunctionspace.hh:783
DiscreteFunctionSpaceDefault(GridPartType &gridPart, const InterfaceType commInterface=InteriorBorder_All_Interface, const CommunicationDirection commDirection=ForwardCommunication)
constructor
Definition: discretefunctionspace.hh:704
ThreadSafeValue< UninitializedObjectStack > LocalDofVectorStackType
Definition: discretefunctionspace.hh:681
IteratorType begin() const
get iterator pointing to the first entity of the associated grid partition
Definition: discretefunctionspace.hh:773
bool multipleGeometryTypes() const
returns true if the grid has more than one geometry type
Definition: discretefunctionspace.hh:806
Traits ::DiscreteFunctionSpaceType DiscreteFunctionSpaceType
Definition: discretefunctionspace.hh:638
GridPartType & gridPart() const
Definition: discretefunctionspace.hh:745
Dune::DynamicVector< typename BaseType::RangeFieldType, LocalDofVectorAllocatorType > LocalDofVectorType
Definition: discretefunctionspace.hh:683
FunctionSpaceTraits Traits
Definition: discretefunctionspace.hh:630
StackAllocator< typename BaseType::RangeFieldType, LocalDofVectorStackType * > LocalDofVectorAllocatorType
Definition: discretefunctionspace.hh:682
DofManager< GridType > DofManagerType
type of DoF manager
Definition: discretefunctionspace.hh:655
static void deleteObject(ObjectType *object)
Definition: discretefunctionspace.hh:673
std::pair< AuxiliaryDofsType, int > ObjectType
Definition: discretefunctionspace.hh:666
static ObjectType * createObject(std::pair< GridPartType *, BlockMapperType * > key)
Definition: discretefunctionspace.hh:668
Create Obejct that behaves like a discrete function space without to provide functions with the itera...
Definition: discretefunctionspace.hh:959
IteratorType begin() const
get iterator pointing to the first entity of the associated grid partition
Definition: discretefunctionspace.hh:1013
@ polynomialOrder
Definition: discretefunctionspace.hh:972
GridPartType ::GridType GridType
type of the grid
Definition: discretefunctionspace.hh:975
GridPartType ::IntersectionType IntersectionType
Definition: discretefunctionspace.hh:984
bool continuous(const IntersectionType &intersection) const
returns true if the space contains only globally continuous functions
Definition: discretefunctionspace.hh:1057
DiscreteFunctionSpaceAdapter(const GridPartType &gridPart, unsigned int order=polynomialOrder)
constructor taking grid Part
Definition: discretefunctionspace.hh:996
const GridPartType & gridPart() const
get a reference to the associated grid partition
Definition: discretefunctionspace.hh:1034
DiscreteFunctionSpaceAdapter(const ThisType &other)
copy constructor
Definition: discretefunctionspace.hh:1005
bool continuous() const
returns true if the space contains only globally continuous functions
Definition: discretefunctionspace.hh:1052
DefaultCommunicationManager< ThisType > CommunicationManagerType
type of communication manager (only the default communication is valid here)
Definition: discretefunctionspace.hh:987
int order() const
get global order of space
Definition: discretefunctionspace.hh:1063
GridType ::template Codim< 0 >::Entity EntityType
Definition: discretefunctionspace.hh:982
IteratorType end() const
get iterator pointing behind the last entity of the associated grid partition
Definition: discretefunctionspace.hh:1019
GridPartType ::template Codim< 0 >::IteratorType IteratorType
type of the grid iterator
Definition: discretefunctionspace.hh:980
const GridType & grid() const
get reference to grid this discrete function space belongs to
Definition: discretefunctionspace.hh:1046
GridPartType ::IndexSetType IndexSetType
type of the index set
Definition: discretefunctionspace.hh:977
const IndexSetType & indexSet() const
Get a reference to the associated index set.
Definition: discretefunctionspace.hh:1040
const GridPartType & gridPart_
Definition: discretefunctionspace.hh:990
GridPartImp GridPartType
type of the grid partition
Definition: discretefunctionspace.hh:964
DFSpaceIdentifier type() const
return type identifier of discrete function space
Definition: discretefunctionspace.hh:1075
void forEach(FunctorType &f) const
apply a functor to each entity in the associated grid partition
Definition: discretefunctionspace.hh:1026
int order(const EntityType &) const
get global order of space
Definition: discretefunctionspace.hh:1069
FunctionSpaceImp FunctionSpaceType
Definition: discretefunctionspace.hh:962
const unsigned int order_
Definition: discretefunctionspace.hh:991
BasisFunctionSetSingletonFactory provides method createObject and deleteObject for the SingletonList.
Definition: discretefunctionspace.hh:1090
static ObjectImp * createObject(const KeyImp &key)
create new BaseFunctionSet
Definition: discretefunctionspace.hh:1093
static void deleteObject(ObjectImp *obj)
delete BaseFunctionSet
Definition: discretefunctionspace.hh:1100
convert functions space to space with new dim range
Definition: functionspace.hh:250
Singleton list for key/object pairs.
Definition: singletonlist.hh:53
static auto getObject(const KeyType &key, Args &&... args) -> std::enable_if_t< std::is_same< decltype(FactoryType::createObject(key, std::forward< Args >(args)...)), ObjectType * >::value, ObjectType & >
Definition: singletonlist.hh:94
Definition: singletonlist.hh:65