DUNE-FEM (unstable)

discretefunctionspace.hh
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
14 #include <dune/common/dynvector.hh>
15 
16 // dune-fem includes
17 #include <dune/fem/common/hybrid.hh>
18 #include <dune/fem/common/stackallocator.hh>
19 #include <dune/fem/function/blockvectors/defaultblockvectors.hh>
20 #include <dune/fem/function/localfunction/temporary.hh>
21 #include <dune/fem/misc/threads/threadsafevalue.hh>
22 #include <dune/fem/space/common/commoperations.hh>
23 #include <dune/fem/space/common/communicationmanager.hh>
24 #include <dune/fem/space/common/dofmanager.hh>
25 #include <dune/fem/space/common/functionspace.hh>
26 #include <dune/fem/space/common/auxiliarydofs.hh>
27 #include <dune/fem/storage/singletonlist.hh>
28 #include <dune/fem/version.hh>
29 
30 // local includes
31 #include "allgeomtypes.hh"
32 #include "dofstorage.hh"
33 
34 
35 namespace Dune
36 {
37 
38  namespace Fem
39  {
40 
54  // ExportsDiscreteFunctionSpaceType
55  // --------------------------------
56 
57  template< class T >
58  class ExportsDiscreteFunctionSpaceType
59  {
60  typedef char Small;
61  struct Big { char dummy[ 2 ]; };
62 
63  template< class U >
64  static Small test ( const U &, typename U::DiscreteFunctionSpaceType * = nullptr );
65  static Big test ( ... );
66 
67  static const T &makeT ();
68 
69  template< class U, bool >
70  struct GetDiscreteFunctionSpaceType;
71 
72  template< class U >
73  struct GetDiscreteFunctionSpaceType< U, true >
74  {
75  typedef typename U::DiscreteFunctionSpaceType Type;
76  };
77 
78  template< class U >
79  struct GetDiscreteFunctionSpaceType< U, false >
80  {
81  typedef void Type;
82  };
83 
84  public:
85  static const bool v = (sizeof( test( makeT() ) ) == sizeof( Small ));
86  typedef typename GetDiscreteFunctionSpaceType< T, v >::Type Type;
87  };
88 
89 
90 
91  // DFSpaceIdentifier
92  // -----------------
93 
108  };
109 
110  inline std::string spaceName( const DFSpaceIdentifier id )
111  {
112  switch( id )
113  {
114  case CombinedSpace_id : return "CombinedSpace";
115  case DFAdapter_id : return "DFAdapter";
116  case DGSpace_id : return "DiscontinuousGalerkinSpace";
117  case FiniteVolumeSpace_id : return "FiniteVolumeSpace";
118  case FourierSpace_id : return "FourierSpace";
119  case GenericSpace_id : return "GenericSpace";
120  case LagrangeSpace_id : return "LagrangeSpace";
121  case RannacherTurekSpace_id : return "RannacherTurekSpace";
122  case LegendreDGSpace_id : return "LegendreDGSpace";
123  case HierarchicLegendreDGSpace_id : return "HierarchicLegendreDGSpace";
124  case LagrangeDGSpace_id : return "LagrangeDGSpace";
125  default : return "unknown space";
126  }
127  }
128 
129  struct isGenericDiscreteFunctionSpace
130  {};
131 
132  template< class DiscreteFunctionSpaceImp,
133  class NewFunctionSpace>
134  struct DifferentDiscreteFunctionSpace;
135 
136  template <class FunctionSpaceImp,
137  class GridPartImp,
138  int polOrd,
139  class StorageImp,
140  template <class,class,int,class> class DiscreteFunctionSpaceImp,
141  class NewFunctionSpace>
142  struct DifferentDiscreteFunctionSpace<
143  DiscreteFunctionSpaceImp<FunctionSpaceImp,GridPartImp,polOrd,StorageImp>,
144  NewFunctionSpace>
145  {
146  typedef DiscreteFunctionSpaceImp< NewFunctionSpace, GridPartImp, polOrd, StorageImp > Type;
147  };
148 
149  template <class FunctionSpaceImp,
150  class GridPartImp,
151  int polOrd,
152  bool caching,
153  template <class,class,int,bool> class DiscreteFunctionSpaceImp,
154  class NewFunctionSpace>
155  struct DifferentDiscreteFunctionSpace<
156  DiscreteFunctionSpaceImp<FunctionSpaceImp,GridPartImp,polOrd,caching>,
157  NewFunctionSpace>
158  {
159  typedef DiscreteFunctionSpaceImp< NewFunctionSpace, GridPartImp, polOrd, caching > Type;
160  };
161 
162 
163  //**************************************************************************
164  //
165  // --DiscreteFunctionSpaceInterface
166  //
182  template< class FunctionSpaceTraits >
184  : public FunctionSpaceTraits :: FunctionSpaceType
185  {
186  public:
188  typedef FunctionSpaceTraits Traits;
189 
191  typedef typename Traits :: DiscreteFunctionSpaceType
194  typedef typename Traits :: FunctionSpaceType FunctionSpaceType;
195 
196  private:
197  typedef FunctionSpaceType BaseType;
198 
199  public:
201  typedef typename Traits :: BasisFunctionSetType BasisFunctionSetType;
203  typedef typename Traits :: BlockMapperType BlockMapperType;
204 
205  typedef typename Traits::LocalBlockIndices LocalBlockIndices;
206 
208  static constexpr std::size_t localBlockSize = Hybrid::size( LocalBlockIndices() );
209 
211  typedef typename Traits :: GridPartType GridPartType;
212 
214  typedef typename GridPartType :: GridType GridType;
216  typedef typename GridPartType :: IndexSetType IndexSetType;
221  typedef typename GridPartType :: template Codim< Traits::codimension > :: IteratorType
224  typedef typename GridPartType :: template Codim< Traits::codimension > :: EntityType EntityType;
226  typedef typename GridPartType :: IntersectionType IntersectionType;
229 
231  [[deprecated("Use AuxiliaryDofsType instead!")]]
233 
240  template< class DiscreteFunction,
241  class Operation = // get default type from traits
242  typename Traits :: template CommDataHandle< DiscreteFunction > :: OperationType
243  >
245  {
247  typedef typename Traits
250 
252  typedef typename Traits
255  };
256 
259 
261  template< class NewFunctionSpace >
263  {
265  typedef typename DifferentDiscreteFunctionSpace< DiscreteFunctionSpaceType, NewFunctionSpace> :: Type Type;
266  };
267 
269  template< int newDimRange >
271  {
272  typedef typename ToNewDimRangeFunctionSpace< FunctionSpaceType, newDimRange > :: Type NewFunctionSpaceType;
273 
276  };
277 
278  private:
279  static_assert( std::is_same<typename BaseType::DomainFieldType, typename GridType::ctype>::value,
280  "Domain field type of function space must equal field type of grid." );
281 
282  protected:
284  {}
285 
286  public:
287 
288  // Methods Provided by the Implementation
289  // --------------------------------------
290 
295  {
296  CHECK_INTERFACE_IMPLEMENTATION(asImp().type());
297  return asImp().type();
298  }
299 
307  inline const BasisFunctionSetType basisFunctionSet ( const EntityType &entity ) const
308  {
309  CHECK_INTERFACE_IMPLEMENTATION( asImp().basisFunctionSet( entity ) );
310  return asImp().basisFunctionSet( entity );
311  }
312 
325  inline bool continuous () const
326  {
327  CHECK_INTERFACE_IMPLEMENTATION( asImp().continuous() );
328  return asImp().continuous();
329  }
330 
335  inline int sequence () const
336  {
337  CHECK_INTERFACE_IMPLEMENTATION( asImp().sequence() );
338  return asImp().sequence();
339  }
340 
346  inline int order () const
347  {
348  CHECK_INTERFACE_IMPLEMENTATION( asImp().order() );
349  return asImp().order();
350  }
351 
365  inline bool continuous (const IntersectionType &intersection) const
366  {
367  CHECK_INTERFACE_IMPLEMENTATION( asImp().continuous(intersection) );
368  return asImp().continuous(intersection);
369  }
370 
375  inline BlockMapperType &blockMapper () const
376  {
377  CHECK_INTERFACE_IMPLEMENTATION( asImp().blockMapper() );
378  return asImp().blockMapper();
379  }
380 
385  inline const GridType &grid () const
386  {
387  CHECK_INTERFACE_IMPLEMENTATION( asImp().grid() );
388  return asImp().grid();
389  }
390 
395  inline GridType &grid ()
396  {
397  CHECK_INTERFACE_IMPLEMENTATION( asImp().grid() );
398  return asImp().grid();
399  }
400 
406  {
407  CHECK_INTERFACE_IMPLEMENTATION(asImp().gridPart());
408  return asImp().gridPart();
409  }
410 
415  inline const IndexSetType &indexSet () const
416  {
417  CHECK_INTERFACE_IMPLEMENTATION( asImp().indexSet() );
418  return asImp().indexSet();
419  }
420 
425  inline int size () const
426  {
427  CHECK_INTERFACE_IMPLEMENTATION( asImp().size() );
428  return asImp().size();
429  }
430 
435  inline int primarySize () const
436  {
437  CHECK_INTERFACE_IMPLEMENTATION( asImp().primarySize() );
438  return asImp().primarySize();
439  }
440 
445  inline int auxiliarySize () const
446  {
447  CHECK_INTERFACE_IMPLEMENTATION( asImp().auxiliarySize() );
448  return asImp().auxiliarySize();
449  }
450 
456  inline IteratorType begin () const
457  {
458  CHECK_INTERFACE_IMPLEMENTATION( asImp().begin() );
459  return asImp().begin();
460  }
461 
467  inline IteratorType end () const
468  {
469  CHECK_INTERFACE_IMPLEMENTATION( asImp().end() );
470  return asImp().end();
471  }
472 
483  template< class FunctorType >
484  inline void forEach ( FunctorType &f ) const
485  {
487  }
488 
494  inline bool multipleGeometryTypes () const
495  {
496  CHECK_INTERFACE_IMPLEMENTATION( asImp().multipleGeometryTypes() );
497  return asImp().multipleGeometryTypes();
498  }
499 
500 
506  inline bool multipleBasisFunctionSets () const
507  {
508  CHECK_INTERFACE_IMPLEMENTATION( asImp().multipleBasisFunctionSets() );
509  return asImp().multipleBasisFunctionSets();
510  }
511 
516  {
517  CHECK_INTERFACE_IMPLEMENTATION( asImp().communicationInterface() );
518  return asImp().communicationInterface();
519  }
520 
525  {
526  CHECK_INTERFACE_IMPLEMENTATION( asImp().communicationDirection() );
527  return asImp().communicationDirection();
528  }
529 
534  {
535  CHECK_INTERFACE_IMPLEMENTATION( asImp().communicator() );
536  return asImp().communicator();
537  }
538 
544  template <class DiscreteFunction>
545  void communicate(DiscreteFunction& discreteFunction) const
546  {
548  asImp().communicate( discreteFunction ) );
549  }
550 
557  template <class DiscreteFunction, class Operation>
558  void communicate(DiscreteFunction& discreteFunction, const Operation& op) const
559  {
561  asImp().communicate( discreteFunction , op ) );
562  }
563 
571  template< class DiscreteFunction, class Operation >
572  inline typename CommDataHandle< DiscreteFunction, Operation > :: Type
573  createDataHandle ( DiscreteFunction& discreteFunction,
574  const Operation &operation ) const
575  {
576  CHECK_INTERFACE_IMPLEMENTATION
577  ( asImp().createDataHandle( discreteFunction, operation ) );
578  return asImp().createDataHandle( discreteFunction, operation );
579  }
580 
583  {
584  CHECK_INTERFACE_IMPLEMENTATION( asImp().auxiliaryDofs() );
585  return asImp().auxiliaryDofs();
586  }
587 
589  [[deprecated("Use auxiliaryDofs instead!")]]
591  {
592  return auxiliaryDofs();
593  }
594 
595  protected:
596  // Barton-Nackman trick
597  inline const DiscreteFunctionSpaceType &asImp () const
598  {
599  return static_cast< const DiscreteFunctionSpaceType & >( *this );
600  }
601 
602  // Barton-Nackman trick
603  inline DiscreteFunctionSpaceType &asImp()
604  {
605  return static_cast< DiscreteFunctionSpaceType & >( *this );
606  }
607  }; // end class DiscreteFunctionSpaceInterface
608 
609 
610 
621  template< class Traits >
624  {
625  return &(X.blockMapper()) == &(Y.blockMapper());
626  }
627 
628 
629 
630  //---------------------------------------------------------------------------
631  //-
632  //- --DiscreteFunctionSpaceDefault
633  //-
634  //-
635  //---------------------------------------------------------------------------
645  template< class FunctionSpaceTraits >
647  : public DiscreteFunctionSpaceInterface< FunctionSpaceTraits >,
648  public std::enable_shared_from_this< typename FunctionSpaceTraits::DiscreteFunctionSpaceType >
649  {
650  public:
651  typedef FunctionSpaceTraits Traits;
652 
653  private:
656 
657  public:
658  typedef typename Traits :: DiscreteFunctionSpaceType
660 
661  typedef typename BaseType :: GridPartType GridPartType;
662  typedef typename BaseType :: GridType GridType;
663  typedef typename BaseType :: IndexSetType IndexSetType;
664  typedef typename BaseType :: IteratorType IteratorType;
665  typedef typename BaseType :: EntityType EntityType;
666 
667  protected:
668  using BaseType :: asImp;
669 
670  public:
673  using BaseType :: order ;
674 
677 
680 
683 
684  protected:
685  struct AuxiliaryDofsFactory
686  {
687  typedef std::pair< AuxiliaryDofsType, int > ObjectType;
688 
689  static ObjectType *createObject ( std::pair< GridPartType *, BlockMapperType * > key )
690  {
691  return new ObjectType( std::piecewise_construct, std::tie( *key.first, *key.second ), std::make_tuple( -1 ) );
692  }
693 
694  static void deleteObject ( ObjectType *object ) { delete object; }
695  };
696 
697  typedef SingletonList< std::pair< GridPartType *, BlockMapperType * >, std::pair< AuxiliaryDofsType, int >, AuxiliaryDofsFactory > AuxiliaryDofsProviderType;
698 
699  protected:
700  GridPartType &gridPart_;
701 
702  typedef ThreadSafeValue< UninitializedObjectStack > LocalDofVectorStackType;
703  typedef StackAllocator< typename BaseType::RangeFieldType, LocalDofVectorStackType* > LocalDofVectorAllocatorType;
705 
706  mutable LocalDofVectorStackType ldvStack_;
707  mutable LocalDofVectorAllocatorType ldvAllocator_;
708 
710 
711  // set of all geometry types possible
712  typedef AllGeomTypes< IndexSetType, GridType > AllGeometryTypes;
713  const AllGeometryTypes allGeomTypes_;
714 
715  // reference to dof manager
716  DofManagerType& dofManager_;
717 
718  // communication manager
719  const InterfaceType commInterface_;
720  const CommunicationDirection commDirection_;
721  mutable std::unique_ptr< CommunicationManagerType > communicator_;
722 
723  public:
725  explicit DiscreteFunctionSpaceDefault( GridPartType &gridPart,
726  const InterfaceType commInterface = InteriorBorder_All_Interface,
727  const CommunicationDirection commDirection = ForwardCommunication )
728  : BaseType(),
729  gridPart_( gridPart ),
730  ldvStack_( 0 ),
731  ldvAllocator_( &ldvStack_ ),
732  allGeomTypes_( gridPart.indexSet() ),
733  dofManager_( DofManagerType :: instance( gridPart.grid() ) ),
734  commInterface_( commInterface ),
735  commDirection_( commDirection )
736  {}
737 
739  inline int sequence () const
740  {
741  return dofManager_.sequence();
742  }
743 
748  inline int order ( const EntityType& entity ) const
749  {
750  return asImp().basisFunctionSet( entity ).order();
751  }
752 
754  inline const GridType &grid () const
755  {
756  return asImp().gridPart().grid();
757  }
758 
760  inline GridType &grid ()
761  {
762  return asImp().gridPart().grid();
763  }
764 
766  inline GridPartType &gridPart () const
767  {
768  return gridPart_;
769  }
770 
772  inline const IndexSetType &indexSet () const
773  {
774  return asImp().gridPart().indexSet();
775  }
776 
778  inline int size () const
779  {
780  return blockMapper().size() * localBlockSize ;
781  }
782 
784  inline int primarySize () const
785  {
787  }
788 
790  inline int auxiliarySize () const
791  {
792  // total size minus primary dofs
793  return size() - primarySize();
794  }
795 
797  inline int maxNumDofs () const
798  {
799  return blockMapper().maxNumDofs() * localBlockSize;
800  }
801 
807  inline IteratorType begin () const
808  {
809  return asImp().gridPart().template begin< 0 >();
810  }
811 
817  inline IteratorType end () const
818  {
819  return asImp().gridPart().template end< 0 >();
820  }
821 
831  template< class FunctorType >
832  inline void forEach ( FunctorType &f ) const
833  {
834  const IteratorType end = asImp().end();
835  for( IteratorType it = asImp().begin(); it != end; ++it )
836  f( *it );
837  }
838 
840  inline bool multipleGeometryTypes () const
841  {
842  return allGeomTypes_.multipleGeomTypes();
843  }
844 
849  inline bool multipleBasisFunctionSets () const
850  {
851  return false;
852  }
853 
856  {
857  return commInterface_;
858  }
859 
862  {
863  return commDirection_;
864  }
865 
868  {
869  if( !communicator_ )
870  communicator_.reset( new CommunicationManagerType( asImp(), commInterface_, commDirection_ ) );
871  assert( communicator_ != 0 );
872  return *communicator_;
873  }
874 
876  template <class DiscreteFunction>
877  void communicate(DiscreteFunction& discreteFunction) const
878  {
879  // get type of default operation
880  typedef typename DiscreteFunction :: DiscreteFunctionSpaceType :: template
881  CommDataHandle< DiscreteFunction > :: OperationType DefaultOperationType;
882 
883  // default communication operation
884  DefaultOperationType operation;
885 
886  // exchange data
887  communicate( discreteFunction, operation );
888  }
889 
891  template <class DiscreteFunction, class Operation>
892  void communicate(DiscreteFunction& discreteFunction, const Operation& op ) const
893  {
894  if constexpr ( std::is_base_of< IsDiscreteFunction, DiscreteFunction >::value )
895  {
896  static_assert( std::is_same< typename DiscreteFunctionSpaceType::BlockMapperType,
897  typename DiscreteFunction::DiscreteFunctionSpaceType::BlockMapperType >::value &&
898  localBlockSize == static_cast< std::size_t >(DiscreteFunction::DiscreteFunctionSpaceType::localBlockSize),
899  "DiscreteFunctionSpaceDefault::communicate cannot be called with discrete functions defined over a different space" );
900  communicator().exchange( discreteFunction, op );
901  }
902  else
903  {
904  static_assert( std::is_base_of< IsBlockVector, DiscreteFunction> :: value, "DiscreteFunctionSpaceDefault::communicate needs at least a BlockVectorInterface and derived");
905  communicator().exchange( asImp(), discreteFunction, op );
906  }
907  }
908 
916  template< class DiscreteFunction, class Operation >
917  inline typename BaseType
918  :: template CommDataHandle< DiscreteFunction, Operation > :: Type
919  createDataHandle( DiscreteFunction &discreteFunction,
920  const Operation& operation ) const
921  {
922  static_assert( std::is_same< typename DiscreteFunctionSpaceType::BlockMapperType,
923  typename DiscreteFunction::DiscreteFunctionSpaceType::BlockMapperType >::value &&
924  localBlockSize == static_cast< std::size_t >(DiscreteFunction::DiscreteFunctionSpaceType::localBlockSize),
925  "DiscreteFunctionSpaceDefault::createDataHandle cannot be called with discrete functions defined over a different space" );
926  return typename BaseType
928  :: Type( discreteFunction, operation );
929  }
930 
933  {
934  if ( !auxiliaryDofs_ )
935  auxiliaryDofs_.reset( &(AuxiliaryDofsProviderType::getObject( std::make_pair( &this->gridPart(), &this->blockMapper() ) )) );
936  const int sequence = asImp().sequence();
937  if( auxiliaryDofs_->second != sequence )
938  {
939  auxiliaryDofs_->first.rebuild();
940  auxiliaryDofs_->second = sequence;
941  }
942  return auxiliaryDofs_->first;
943  }
944 
946  template <class DiscreteFunction>
947  void addFunction( DiscreteFunction& df ) const
948  {
949  }
950 
952  template <class DiscreteFunction>
953  void removeFunction( DiscreteFunction& df ) const
954  {
955  }
956 
959  template <class Vector>
960  void adapt( const Vector& polynomialOrders, const int polOrderShift = 0 ) const
961  {
962  }
963 
969  inline const std::vector<GeometryType>& geomTypes(int codim) const
970  {
971  return allGeomTypes_.geomTypes(codim);
972  }
973  protected:
974 
975  // only combined space should use geomTypes
976  template <class , int , DofStoragePolicy> friend class CombinedSpace;
977  mutable std::unique_ptr< std::pair< AuxiliaryDofsType, int >, typename AuxiliaryDofsProviderType::Deleter > auxiliaryDofs_;
978  };
979 
980 
981 
983  //
984  // DiscreteFunctionSpaceAdapter
985  //
987 
996  template< class FunctionSpaceImp, class GridPartImp >
998  : public FunctionSpaceImp
999  , public std::enable_shared_from_this< DiscreteFunctionSpaceAdapter<FunctionSpaceImp,GridPartImp> >
1000  {
1001  public:
1002  // type of the underlying function space
1003  typedef FunctionSpaceImp FunctionSpaceType;
1005  typedef GridPartImp GridPartType;
1006 
1007  private:
1009  ThisType;
1010  typedef FunctionSpaceType BaseType;
1011 
1012  public:
1013  enum { polynomialOrder = 6 }; // default polynomial order basically for determination of quadrature orders
1014 
1016  typedef typename GridPartType :: GridType GridType;
1018  typedef typename GridPartType :: IndexSetType IndexSetType;
1020  typedef typename GridPartType :: template Codim< 0 > :: IteratorType
1022  //- type of used entity
1023  typedef typename GridType :: template Codim< 0 > :: Entity EntityType;
1024  //- type of intersections
1025  typedef typename GridPartType :: IntersectionType IntersectionType;
1026 
1029 
1030  protected:
1031  const GridPartType &gridPart_;
1032  const unsigned int order_;
1033 
1034  public:
1037  ( const GridPartType &gridPart,
1038  unsigned int order = polynomialOrder )
1039  : BaseType(),
1040  gridPart_( gridPart ),
1041  order_( order )
1042  {
1043  }
1044 
1047  : BaseType( other ),
1048  gridPart_( other.gridPart_ ),
1049  order_( other.order_ )
1050  {
1051  }
1052 
1054  inline IteratorType begin () const
1055  {
1056  return gridPart_.template begin< 0 >();
1057  }
1058 
1060  inline IteratorType end () const
1061  {
1062  return gridPart_.template end< 0 >();
1063  }
1064 
1066  template< class FunctorType >
1067  inline void forEach ( FunctorType &f ) const
1068  {
1069  const IteratorType endit = end();
1070  for( IteratorType it = begin(); it != endit; ++it )
1071  f( *it );
1072  }
1073 
1075  inline const GridPartType &gridPart () const
1076  {
1077  return gridPart_;
1078  }
1079 
1081  inline const IndexSetType &indexSet () const
1082  {
1083  return gridPart_.indexSet();
1084  }
1085 
1087  inline const GridType& grid () const
1088  {
1089  return gridPart_.grid();
1090  }
1091 
1093  inline bool continuous () const
1094  {
1095  return true;
1096  }
1098  inline bool continuous (const IntersectionType &intersection) const
1099  {
1100  return true;
1101  }
1102 
1104  inline int order () const
1105  {
1106  return order_;
1107  }
1108 
1110  inline int order ( const EntityType& ) const
1111  {
1112  return order();
1113  }
1114 
1116  inline DFSpaceIdentifier type () const
1117  {
1118  return DFAdapter_id;
1119  }
1120  };
1121 
1123 
1129  template <class KeyImp, class ObjectImp, class ObjectFactoryImp>
1131  {
1132  public:
1134  static ObjectImp * createObject( const KeyImp & key )
1135  {
1136  ObjectFactoryImp fac(key);
1137  return new ObjectImp(fac);
1138  }
1139 
1141  static void deleteObject( ObjectImp * obj )
1142  {
1143  delete obj;
1144  }
1145  };
1146 
1147  } // namespace Fem
1148 
1149 } // namespace Dune
1150 #endif // #ifndef DUNE_FEM_DISCRETEFUNCTIONSPACE_HH
Provides check for implementation of interface methods when using static polymorphism,...
#define CHECK_AND_CALL_INTERFACE_IMPLEMENTATION(__interface_method_to_call__)
Definition: bartonnackmanifcheck.hh:61
Construct a vector with a dynamic size.
Definition: dynvector.hh:59
Wrapper class for entities.
Definition: entity.hh:66
default implementation uses method geomTypes of given index set. Used in DiscreteFunctionSpaces.
Definition: allgeomtypes.hh:99
In parallel computations the dofs of a discrete function are made up by all primary dofs....
Definition: auxiliarydofs.hh:46
BasisFunctionSetSingletonFactory provides method createObject and deleteObject for the SingletonList.
Definition: discretefunctionspace.hh:1131
static ObjectImp * createObject(const KeyImp &key)
create new BaseFunctionSet
Definition: discretefunctionspace.hh:1134
static void deleteObject(ObjectImp *obj)
delete BaseFunctionSet
Definition: discretefunctionspace.hh:1141
A temporary function carrying values for one entity.
Definition: temporary.hh:24
default communication manager using just the grids communicate method
Definition: communicationmanager.hh:78
Create Obejct that behaves like a discrete function space without to provide functions with the itera...
Definition: discretefunctionspace.hh:1000
IteratorType begin() const
get iterator pointing to the first entity of the associated grid partition
Definition: discretefunctionspace.hh:1054
GridPartType ::GridType GridType
type of the grid
Definition: discretefunctionspace.hh:1016
bool continuous(const IntersectionType &intersection) const
returns true if the space contains only globally continuous functions
Definition: discretefunctionspace.hh:1098
DiscreteFunctionSpaceAdapter(const GridPartType &gridPart, unsigned int order=polynomialOrder)
constructor taking grid Part
Definition: discretefunctionspace.hh:1037
const GridPartType & gridPart() const
get a reference to the associated grid partition
Definition: discretefunctionspace.hh:1075
DiscreteFunctionSpaceAdapter(const ThisType &other)
copy constructor
Definition: discretefunctionspace.hh:1046
bool continuous() const
returns true if the space contains only globally continuous functions
Definition: discretefunctionspace.hh:1093
DefaultCommunicationManager< ThisType > CommunicationManagerType
type of communication manager (only the default communication is valid here)
Definition: discretefunctionspace.hh:1028
int order() const
get global order of space
Definition: discretefunctionspace.hh:1104
IteratorType end() const
get iterator pointing behind the last entity of the associated grid partition
Definition: discretefunctionspace.hh:1060
GridPartType ::template Codim< 0 >::IteratorType IteratorType
type of the grid iterator
Definition: discretefunctionspace.hh:1021
const GridType & grid() const
get reference to grid this discrete function space belongs to
Definition: discretefunctionspace.hh:1087
GridPartType ::IndexSetType IndexSetType
type of the index set
Definition: discretefunctionspace.hh:1018
const IndexSetType & indexSet() const
Get a reference to the associated index set.
Definition: discretefunctionspace.hh:1081
GridPartImp GridPartType
type of the grid partition
Definition: discretefunctionspace.hh:1005
DFSpaceIdentifier type() const
return type identifier of discrete function space
Definition: discretefunctionspace.hh:1116
void forEach(FunctorType &f) const
apply a functor to each entity in the associated grid partition
Definition: discretefunctionspace.hh:1067
int order(const EntityType &) const
get global order of space
Definition: discretefunctionspace.hh:1110
This is the class with default implementations for discrete function. The methods not marked with hav...
Definition: discretefunctionspace.hh:649
BaseType ::template CommDataHandle< DiscreteFunction, Operation >::Type createDataHandle(DiscreteFunction &discreteFunction, const Operation &operation) const
Definition: discretefunctionspace.hh:919
const IndexSetType & indexSet() const
Get a reference to the associated index set.
Definition: discretefunctionspace.hh:772
GridType & grid()
get reference to grid this discrete function space belongs to
Definition: discretefunctionspace.hh:760
bool multipleBasisFunctionSets() const
returns true if base function sets depend on the entity
Definition: discretefunctionspace.hh:849
int order(const EntityType &entity) const
default implementation of the method order
Definition: discretefunctionspace.hh:748
void addFunction(DiscreteFunction &df) const
default implementation of addFunction does nothing at the moment
Definition: discretefunctionspace.hh:947
void removeFunction(DiscreteFunction &df) const
default implementation of removeFunction does nothing at the moment
Definition: discretefunctionspace.hh:953
void communicate(DiscreteFunction &discreteFunction) const
communicate data for given discrete function using the space's default communication operation
Definition: discretefunctionspace.hh:877
InterfaceType communicationInterface() const
return the communication interface appropriate for this space
Definition: discretefunctionspace.hh:855
void forEach(FunctorType &f) const
apply a functor to each entity in the associated grid partition
Definition: discretefunctionspace.hh:832
int maxNumDofs() const
return the maximal number of dofs on entities
Definition: discretefunctionspace.hh:797
int primarySize() const
get number of primary DoFs for this space
Definition: discretefunctionspace.hh:784
const GridType & grid() const
get reference to grid this discrete function space belongs to
Definition: discretefunctionspace.hh:754
const std::vector< GeometryType > & geomTypes(int codim) const
returns true if the grid has more than one geometry type
Definition: discretefunctionspace.hh:969
int sequence() const
get index of the sequence in grid sequences
Definition: discretefunctionspace.hh:739
const CommunicationManagerType & communicator() const
return reference to communicator (see CommunicationManager)
Definition: discretefunctionspace.hh:867
void communicate(DiscreteFunction &discreteFunction, const Operation &op) const
communicate data for given discrete function
Definition: discretefunctionspace.hh:892
int size() const
get number of DoFs for this space
Definition: discretefunctionspace.hh:778
void adapt(const Vector &polynomialOrders, const int polOrderShift=0) const
default implementation of adapt does nothing, its only used in PAdaptiveLagrangeSpace
Definition: discretefunctionspace.hh:960
const AuxiliaryDofsType & auxiliaryDofs() const
get auxiliary dofs
Definition: discretefunctionspace.hh:932
CommunicationManager< DiscreteFunctionSpaceType > CommunicationManagerType
type of communication manager
Definition: discretefunctionspace.hh:679
CommunicationDirection communicationDirection() const
return the communication interface appropriate for this space
Definition: discretefunctionspace.hh:861
IteratorType end() const
get iterator pointing behind the last entity of the associated grid partition
Definition: discretefunctionspace.hh:817
DiscreteFunctionSpaceDefault(GridPartType &gridPart, const InterfaceType commInterface=InteriorBorder_All_Interface, const CommunicationDirection commDirection=ForwardCommunication)
constructor
Definition: discretefunctionspace.hh:725
IteratorType begin() const
get iterator pointing to the first entity of the associated grid partition
Definition: discretefunctionspace.hh:807
bool multipleGeometryTypes() const
returns true if the grid has more than one geometry type
Definition: discretefunctionspace.hh:840
GridPartType & gridPart() const
Definition: discretefunctionspace.hh:766
DofManager< GridType > DofManagerType
type of DoF manager
Definition: discretefunctionspace.hh:676
int auxiliarySize() const
get number of auxiliary DoFs for this space
Definition: discretefunctionspace.hh:790
This is the interface for discrete function spaces. All methods declared here have to be implemented ...
Definition: discretefunctionspace.hh:185
static constexpr std::size_t localBlockSize
size of local blocks
Definition: discretefunctionspace.hh:208
AuxiliaryDofs< GridPartType, BlockMapperType > AuxiliaryDofsType
type of auxiliary dofs
Definition: discretefunctionspace.hh:228
bool continuous() const
returns true if the space contains only globally continuous functions
Definition: discretefunctionspace.hh:325
Traits ::FunctionSpaceType FunctionSpaceType
type of function space
Definition: discretefunctionspace.hh:194
const AuxiliaryDofsType & auxiliaryDofs() const
get auxiliary dofs
Definition: discretefunctionspace.hh:582
Traits ::GridPartType GridPartType
type of underlying grid part
Definition: discretefunctionspace.hh:211
CommDataHandle< DiscreteFunction, Operation >::Type createDataHandle(DiscreteFunction &discreteFunction, const Operation &operation) const
Creates DataHandle for given discrete function.
Definition: discretefunctionspace.hh:573
GridPartType ::template Codim< Traits::codimension >::EntityType EntityType
type of entity of codimension 0
Definition: discretefunctionspace.hh:224
GridPartType & gridPart()
get a reference to the associated grid partition
Definition: discretefunctionspace.hh:405
const IndexSetType & indexSet() const
Get a reference to the associated index set.
Definition: discretefunctionspace.hh:415
const GridType & grid() const
get reference to grid this discrete function space belongs to
Definition: discretefunctionspace.hh:385
int primarySize() const
get number of primary DoFs for this space
Definition: discretefunctionspace.hh:435
bool multipleBasisFunctionSets() const
returns true if base function sets depend on the entity
Definition: discretefunctionspace.hh:506
InterfaceType communicationInterface() const
return the communication interface appropriate for this space
Definition: discretefunctionspace.hh:515
CommunicationManager< DiscreteFunctionSpaceType > CommunicationManagerType
type of communication manager
Definition: discretefunctionspace.hh:258
int auxiliarySize() const
get number of auxiliary DoFs for this space
Definition: discretefunctionspace.hh:445
FunctionSpaceTraits Traits
type of traits class
Definition: discretefunctionspace.hh:188
GridPartType ::GridType GridType
type of underlying dune grid
Definition: discretefunctionspace.hh:214
const AuxiliaryDofsType & slaveDofs() const
deprecated method, use auxiliaryDofs
Definition: discretefunctionspace.hh:590
const BasisFunctionSetType basisFunctionSet(const EntityType &entity) const
get basis function set for given entity
Definition: discretefunctionspace.hh:307
BlockMapperType & blockMapper() const
get a reference to the block mapper
Definition: discretefunctionspace.hh:375
int order() const
get global order of space
Definition: discretefunctionspace.hh:346
DFSpaceIdentifier type() const
return type identifier of discrete function space
Definition: discretefunctionspace.hh:294
bool continuous(const IntersectionType &intersection) const
returns true if discrete functions over this space have zero jump over the given intersection.
Definition: discretefunctionspace.hh:365
const CommunicationManagerType & communicator() const
return reference to communicator (see CommunicationManager)
Definition: discretefunctionspace.hh:533
Traits ::BlockMapperType BlockMapperType
type of block mapper of this space
Definition: discretefunctionspace.hh:203
GridPartType ::IndexSetType IndexSetType
type of used dune index set
Definition: discretefunctionspace.hh:216
GridPartType ::template Codim< Traits::codimension >::IteratorType IteratorType
type of iterator for grid traversal
Definition: discretefunctionspace.hh:222
int sequence() const
get index of the sequence in grid sequences
Definition: discretefunctionspace.hh:335
void forEach(FunctorType &f) const
apply a functor to each entity in the associated grid partition
Definition: discretefunctionspace.hh:484
void communicate(DiscreteFunction &discreteFunction) const
communicate data for given discrete function using the space's default communication operation
Definition: discretefunctionspace.hh:545
IteratorType end() const
get iterator pointing behind the last entity of the associated grid partition
Definition: discretefunctionspace.hh:467
bool multipleGeometryTypes() const
returns true if the grid has more than one geometry type
Definition: discretefunctionspace.hh:494
int size() const
get number of DoFs for this space
Definition: discretefunctionspace.hh:425
IteratorType begin() const
get iterator pointing to the first entity of the associated grid partition
Definition: discretefunctionspace.hh:456
AuxiliaryDofsType SlaveDofsType
deprecated type
Definition: discretefunctionspace.hh:232
CommunicationDirection communicationDirection() const
return the communication direction appropriate for this space
Definition: discretefunctionspace.hh:524
Traits ::DiscreteFunctionSpaceType DiscreteFunctionSpaceType
type of DiscretefunctionSapce implementation (Barton-Nackman)
Definition: discretefunctionspace.hh:192
GridPartType ::IntersectionType IntersectionType
type of the intersections
Definition: discretefunctionspace.hh:226
void communicate(DiscreteFunction &discreteFunction, const Operation &op) const
communicate data for given discrete function
Definition: discretefunctionspace.hh:558
GridType & grid()
get reference to grid this discrete function space belongs to
Definition: discretefunctionspace.hh:395
Traits ::BasisFunctionSetType BasisFunctionSetType
type of basis function set of this space
Definition: discretefunctionspace.hh:201
Definition: dofmanager.hh:786
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
This file implements a dense vector with a dynamic size.
void exchange(DiscreteFunction &discreteFunction) const
exchange data for a discrete function using the copy operation
Definition: communicationmanager.hh:226
IndexType primarySize() const
return number of primaryDofs
Definition: auxiliarydofs.hh:134
DFSpaceIdentifier
enumerator for identification of spaces
Definition: discretefunctionspace.hh:95
@ CombinedSpace_id
id for Combined Space
Definition: discretefunctionspace.hh:96
@ LagrangeSpace_id
id for Lagrange Space
Definition: discretefunctionspace.hh:102
@ LegendreDGSpace_id
id for Legendre Discontinuous Galerkin Space
Definition: discretefunctionspace.hh:104
@ GenericSpace_id
id for Generic Space
Definition: discretefunctionspace.hh:101
@ LocalFiniteElementSpace_id
id for local finite element space
Definition: discretefunctionspace.hh:107
@ DFAdapter_id
id for DiscreteFunctionSpace Adapter
Definition: discretefunctionspace.hh:97
@ FourierSpace_id
id for Fourier space
Definition: discretefunctionspace.hh:100
@ DGSpace_id
id for Discontinuous Galerkin Space
Definition: discretefunctionspace.hh:98
@ LagrangeDGSpace_id
id for Lagrange Discontinuous Galerkin Space
Definition: discretefunctionspace.hh:106
@ FiniteVolumeSpace_id
id for Finite Volume Space
Definition: discretefunctionspace.hh:99
@ HierarchicLegendreDGSpace_id
id for Hierarchic Legendre Discontinuous Galerkin Space
Definition: discretefunctionspace.hh:105
@ RannacherTurekSpace_id
id for Rannacher-Turek space
Definition: discretefunctionspace.hh:103
CommunicationDirection
Define a type for communication direction parameter.
Definition: gridenums.hh:170
InterfaceType
Parameter to be used for the communication functions.
Definition: gridenums.hh:86
@ ForwardCommunication
communicate as given in InterfaceType
Definition: gridenums.hh:171
@ InteriorBorder_All_Interface
send interior and border, receive all entities
Definition: gridenums.hh:88
EnableIfInterOperable< T1, T2, bool >::type operator==(const ForwardIteratorFacade< T1, V1, R1, D > &lhs, const ForwardIteratorFacade< T2, V2, R2, D > &rhs)
Checks for equality.
Definition: iteratorfacades.hh:237
Dune namespace.
Definition: alignedallocator.hh:13
Static tag representing a codimension.
Definition: dimension.hh:24
defines type of data handle for communication
Definition: discretefunctionspace.hh:245
Traits ::template CommDataHandle< DiscreteFunction, Operation >::OperationType OperationType
type of operation to perform on scatter
Definition: discretefunctionspace.hh:254
Traits ::template CommDataHandle< DiscreteFunction, Operation >::Type Type
type of communication data handle
Definition: discretefunctionspace.hh:249
typedef struct for defining the same discrete function space with a different dimRange
Definition: discretefunctionspace.hh:271
ToNewFunctionSpace< NewFunctionSpaceType >::Type Type
type of my discrete function space with new dim range
Definition: discretefunctionspace.hh:275
typedef struct for defining the same discrete function space with a different function space
Definition: discretefunctionspace.hh:263
DifferentDiscreteFunctionSpace< DiscreteFunctionSpaceType, NewFunctionSpace >::Type Type
type of my discrete function space with new function space
Definition: discretefunctionspace.hh:265
convert functions space to space with new dim range
Definition: functionspace.hh:250
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.80.0 (May 10, 22:30, 2024)