dune-fem 2.12-git
Loading...
Searching...
No Matches
dofmanager.hh
Go to the documentation of this file.
1#ifndef DUNE_FEM_DOFMANAGER_HH
2#define DUNE_FEM_DOFMANAGER_HH
3
4#include <cassert>
5#include <string>
6#include <list>
7#include <any>
8
12
13#if HAVE_DUNE_ALUGRID
14#include <dune/alugrid/common/interfaces.hh>
15#endif
16
27
29#if HAVE_DUNE_ALUGRID
30#include <dune/alugrid/common/ldbhandleif.hh>
31#endif
32
33namespace Dune
34{
35
36 namespace Fem
37 {
38
44 // forward declaration
45 template <class GridType> class DofManager;
46 template <class DofManagerImp> class DofManagerFactory;
47
48
50 //
51 // ManagedIndexSetInterface
52 //
54
60 {
62 protected:
63 // use address of object as id
64 typedef const void * IdentifierType;
65 // pointer to compare index sets
67 // reference counter
69
70 template< class IndexSet >
71 explicit ManagedIndexSetInterface ( const IndexSet &iset )
72 : setPtr_( getIdentifier( iset ) ),
74 {
75 }
76
77 public:
78 virtual ~ManagedIndexSetInterface () = default;
79
81 virtual void resize () = 0;
83 virtual bool compress () = 0;
84
86 virtual void backup() const = 0;
88 virtual void restore() = 0;
89
91 virtual void write( StandardOutStream& out ) const = 0;
92 virtual void read( StandardInStream& out ) = 0;
93
96
99 {
100 return (--referenceCounter_ == 0);
101 }
102
103 template< class IndexSet >
104 bool equals ( const IndexSet &iset ) const
105 {
106 return (getIdentifier( iset ) == setPtr_);
107 }
108
109 private:
110 template< class IndexSet >
111 IdentifierType getIdentifier ( const IndexSet &iset ) const
112 {
113 return static_cast< IdentifierType >( &iset );
114 }
115 };
116
117 template <class IndexSetType, class EntityType> class RemoveIndicesFromSet;
118 template <class IndexSetType, class EntityType> class InsertIndicesToSet;
119
120 template <class IndexSetType, class EntityType>
123 public LocalInlinePlus < ManagedIndexSet<IndexSetType,EntityType> , EntityType >
124 {
126
127 static const bool isConsecutive =
129
130 protected:
131 // the dof set stores number of dofs on entity for each codim
132 IndexSetType & indexSet_;
133
134 // insertion and removal of indices
135 InsertIndicesToSet <IndexSetType, EntityType> insertIdxObj_;
136 RemoveIndicesFromSet <IndexSetType, EntityType> removeIdxObj_;
137
140
141 public:
144
146 ManagedIndexSet ( const IndexSetType & iset,
147 LocalIndexSetObjectsType & insertList,
148 LocalIndexSetObjectsType & removeList )
149 : BaseType( iset )
150 , indexSet_ (const_cast<IndexSetType &> (iset))
152 , insertList_(insertList)
153 , removeList_(removeList)
154 {
155 this->setPtr_ = (void *) &indexSet_;
156
157 if constexpr ( isConsecutive )
158 {
161 }
162 }
163
166 {
167 if constexpr ( isConsecutive )
168 {
171 }
172 }
173
175 void resize ()
176 {
177 indexSet_.resize();
178 }
179
181 bool compress ()
182 {
183 return indexSet_.compress();
184 }
185
186 // forward backup call to indexSet
187 virtual void backup () const
188 {
189 indexSet_.backup();
190 }
191
192 // forward restore call to indexSet
193 virtual void restore ()
194 {
195 indexSet_.restore();
196 }
197
199 virtual void read( StandardInStream& in ) { indexSet_.read( in ); }
200
202 virtual void write( StandardOutStream& out ) const { indexSet_.write( out ); }
203 };
204
206 //
207 // DofStorageInterface
208 //
210
213 {
214 protected:
217
218 public:
220
222 virtual ~DofStorageInterface() = default;
223
225 virtual void enableDofCompression() { }
226
228 virtual SizeType size () const = 0;
229 };
230
231
236 {
237 protected:
240
241 public:
243 // interface for MemObject lists
245
247 virtual ~ManagedDofStorageInterface() = default;
248
250 virtual void resize ( const bool enlargeOnly ) = 0;
252 virtual void reserve (const SizeType newSize) = 0;
255 virtual void dofCompress ( const bool clearResizedArrays ) = 0;
257 virtual size_t usedMemorySize() const = 0;
258 };
259
260
261 template <class MemObjectType> class ResizeMemoryObjects;
262 template <class MemObjectType> class ReserveMemoryObjects;
263
275 template <class GridImp, class MapperType , class DofArrayType>
277 {
278 public:
280 protected:
282
283 // type of this class
284 typedef ManagedDofStorageImplementation <GridImp, MapperType , DofArrayType> ThisType;
285
287
288 // reference to dof manager
290
291 // the dof set stores number of dofs on entity for each codim
292 MapperType &mapper_;
293
294 // Array which the dofs are stored in
295 DofArrayType& array_;
296
297 typedef ResizeMemoryObjects < ThisType > ResizeMemoryObjectType;
298 typedef ReserveMemoryObjects < ThisType > ReserveMemoryObjectType;
301
302 // true if data need to be compressed
304
305 public:
307
308 protected:
310 ManagedDofStorageImplementation ( const GridImp& grid,
311 const MapperType& mapper,
312 DofArrayType& array )
313 : dm_( DofManagerType :: instance( grid ) ),
314 mapper_ ( const_cast<MapperType& >(mapper)),
315 array_( array ),
316 resizeMemObj_(*this),
317 reserveMemObj_(*this),
319 {
320 // add to dof manager
321 dm_.addDofStorage( *this );
322
323 // set memory over estimate factor, only for DofArray
324 array_.setMemoryFactor( dm_.memoryFactor() );
325 }
326
329 {
330 // remove from dof manager
331 dm_.removeDofStorage( *this );
332 }
333
334 public:
337
340
342 SizeType size () const override { return array_.size(); }
343
345 void resize ( const bool enlargeOnly ) override
346 {
348 }
349
351 inline void reserve ( const SizeType needed ) override
352 {
353 // if index set is compressible, then add requested size
354 if( mapper().consecutive() )
355 {
356 const SizeType nSize = size() + (needed * SizeType(mapper().maxNumDofs()));
357 array_.reserve( nSize );
358 }
359 else
360 {
361 // if compress is not needed just resize with given size
362 // therefore use newSize to enlarge array
363 assert( ! mapper().consecutive() );
364 // resize array
365 resize ( false );
366 }
367 }
368
370 void dofCompress ( const bool clearResizedArrays ) override
371 {
372 // get current size
373 const SizeType nSize = mapper().size();
374
375 // if data is non-temporary do data compression
377 {
378 // get consecutive information about mapper
379 const bool consecutive = mapper().consecutive ();
380
381 // get old size (which we still have in array)
382 const SizeType oldSize = array_.size();
383
384 // NOTE: new size can also be larger than old size
385 // e.g. during loadBalancing when ghosts where
386 // introduced before compressing the index set
387
388 // begin with block zero since closing of holes
389 // has to be done anyway if the mapper is consecutive
390 const int numBlocks = mapper().numBlocks();
391 for( int block = 0; block < numBlocks; ++block )
392 {
393 // move memory
394 moveToFront( oldSize, block );
395
396 // only close holes for consecutive mappers
397 if( consecutive )
398 {
399 // run over all holes and copy array values to new place
400 const SizeType holes = mapper().numberOfHoles( block );
401 for( SizeType i = 0; i < holes; ++i )
402 {
403 const SizeType oldIndex = mapper().oldIndex( i, block );
404 const SizeType newIndex = mapper().newIndex( i, block );
405
406 assert( newIndex < nSize );
407 // implements array_[ newIndex ] = array_[ oldIndex ] ;
408 array_.copyContent( newIndex, oldIndex );
409 }
410 }
411 }
412 }
413
414 // store new size, which should be smaller then actual size
415 array_.resize( nSize );
416
417 if( clearResizedArrays && ! dataCompressionEnabled_ )
418 {
419 // if enabled clear temporary data to avoid occasionally NaN values
420 array_.clear();
421 }
422 }
423
425 size_t usedMemorySize() const override
426 {
427 return ((size_t) sizeof(ThisType) + array_.usedMemorySize());
428 }
429
431 void enableDofCompression() override
432 {
434 }
435
437 DofArrayType & getArray() { return array_; }
438
439 protected:
440 inline MapperType &mapper () const
441 {
442 return mapper_;
443 }
444
445 // resize for non-adaptive mappers
446 void resize ( std::false_type, const bool enlargeOnly )
447 {
448 // note: The mapper might already have been updated, so do not use
449 // it to obtain old array size.
450 mapper().update(); // make sure the mapper is up2date
451
452 const SizeType newSize = mapper().size();
453 const SizeType oldSize = array_.size();
454
455 if( enlargeOnly && newSize < oldSize ) return ;
456
457 if( newSize != oldSize )
458 array_.resize( newSize );
459 }
460
461 // resize for adaptive mappers
462 void resize ( std::true_type, const bool enlargeOnly )
463 {
464 // note: The mapper is adaptive and has been updated automatically, so
465 // do not use it to obtain old array size.
466 const SizeType oldSize = array_.size();
467
468 // get current size
469 const SizeType nSize = mapper().size();
470
471 // if enlarge only option is given only resize
472 // if new size if larger than old size
473 if( enlargeOnly && nSize <= oldSize ) return ;
474
475 // if nothing changed do nothing
476 if( nSize == oldSize ) return ;
477
478 // resize memory to current value
479 array_.resize( nSize );
480
481 // if data is only temporary data, don't adjust memory
482 if( ! dataCompressionEnabled_ || enlargeOnly ) return ;
483
484 // now check all blocks beginning with the largest
485 const int numBlocks = mapper().numBlocks();
486
487 // initialize upperBound
488 SizeType upperBound = oldSize ;
489
490 // make sure offset of block 0 is zero
491 assert( mapper().offSet( 0 ) == 0 );
492 assert( mapper().oldOffSet( 0 ) == 0 );
493
494 // skip block 0 (since offset == 0)
495 for( int block = numBlocks-1; block >= 1; --block )
496 {
497 // get offsets
498 const SizeType newOffSet = mapper().offSet( block );
499 const SizeType oldOffSet = mapper().oldOffSet( block );
500
501 // make sure new offset is larger
502 assert( newOffSet >= oldOffSet );
503
504 // if off set is not zero
505 if( newOffSet > oldOffSet )
506 {
507 // calculate block size
508 const SizeType blockSize = upperBound - oldOffSet;
509 // move block backward
510 array_.memMoveBackward( blockSize, oldOffSet, newOffSet );
511
512 // update upper bound
513 upperBound = oldOffSet;
514 }
515 }
516 }
517
518 // move array to rear insertion points
520 {
521 }
522
524 void moveToFront ( const SizeType oldSize, const int block )
525 {
526 // make sure offset of block 0 is zero
527 assert( mapper().offSet( 0 ) == 0 );
528 assert( mapper().oldOffSet( 0 ) == 0 );
529
530 // block 0 has always offset 0
531 if( block == 0 ) return;
532
533 // get insertion point from block
534 const SizeType oldOffSet = mapper().oldOffSet( block );
535
536 // get new off set
537 const SizeType newOffSet = mapper().offSet( block );
538
539 // here we should have at least the same offsets
540 assert( newOffSet <= oldOffSet );
541
542 // only if block is not starting from zero
543 if( newOffSet < oldOffSet )
544 {
545 // get number of blocks
546 const int numBlocks = mapper().numBlocks();
547
548 // for last section upperBound is size
549 const SizeType upperBound
550 = (block == numBlocks - 1) ? oldSize : mapper().oldOffSet( block + 1 );
551 const SizeType blockSize = upperBound - oldOffSet;
552
553 // move block forward
554 array_.memMoveForward( blockSize, oldOffSet, newOffSet );
555 }
556 }
557 };
558
560 template <class GridImp, class MapperType , class DofArrayType>
561 class ManagedDofStorage : public ManagedDofStorageImplementation< GridImp, MapperType, DofArrayType >
562 {
564 protected:
565 DofArrayType myArray_;
566 public:
568 ManagedDofStorage( const GridImp& grid,
569 const MapperType& mapper )
570 : BaseType( grid, mapper, myArray_ ),
571 myArray_( mapper.size() )
572 {
573 }
574 };
575
577 template< class DofStorageType, class GridType, class MapperType >
579 allocateManagedDofStorage( const GridType& grid,
580 const MapperType& mapper,
581 const DofStorageType * = 0 )
582 {
583 // create managed dof storage
584 typedef ManagedDofStorage< GridType, MapperType,
585 DofStorageType > ManagedDofStorageType;
586
587 ManagedDofStorageType* mds = new ManagedDofStorageType( grid, mapper );
588 assert( mds );
589
590 // return pair with dof storage pointer and array pointer
592 ( mds , & mds->getArray () );
593 }
594
595
596
598 //
599 // RestrictPorlong for Index Sets
600 //
602
603 template <class IndexSetType, class EntityType>
605 : public LocalInlinePlus < RemoveIndicesFromSet<IndexSetType,EntityType> , EntityType >
606 {
607 private:
608 // the dof set stores number of dofs on entity for each codim
609 IndexSetType & indexSet_;
610
611 public:
612 // Constructor of MemObject, only to call from DofManager
613 explicit RemoveIndicesFromSet ( IndexSetType & iset ) : indexSet_ (iset) {}
614
616 inline void apply ( EntityType & entity )
617 {
618 indexSet_.removeEntity( entity );
619 }
620 };
621
622 template <class IndexSetType, class EntityType>
624 : public LocalInlinePlus < InsertIndicesToSet< IndexSetType, EntityType > , EntityType >
625 {
626 private:
627 // the dof set stores number of dofs on entity for each codim
628 IndexSetType & indexSet_;
629
630 public:
631 // Constructor of MemObject, only to call from DofManager
632 explicit InsertIndicesToSet ( IndexSetType & iset ) : indexSet_ (iset) {}
633
635 inline void apply ( EntityType & entity )
636 {
637 indexSet_.insertEntity( entity );
638 }
639 };
640
641 template <class MemObjectType>
643 : public LocalInlinePlus < ResizeMemoryObjects < MemObjectType > , typename MemObjectType::SizeType >
644 {
645 private:
646 // the dof set stores number of dofs on entity for each codim
647 MemObjectType& memobj_;
648
649 public:
650 typedef typename MemObjectType::SizeType SizeType;
651
652 // Constructor of MemObject, only to call from DofManager
653 ResizeMemoryObjects ( MemObjectType & mo ) : memobj_ (mo) {}
655 : memobj_(org.memobj_)
656 {}
657
658 // resize mem object, parameter not needed
659 inline void apply ( SizeType& enlargeOnly )
660 {
661 memobj_.resize( bool(enlargeOnly) );
662 }
663 };
664
665 // this class is the object for a single MemObject to
666 template <class MemObjectType>
668 : public LocalInlinePlus < ReserveMemoryObjects < MemObjectType > , typename MemObjectType::SizeType >
669 {
670 private:
671 // the dof set stores number of dofs on entity for each codim
672 MemObjectType& memobj_;
673
674 public:
675 typedef typename MemObjectType::SizeType SizeType;
676
677 // Constructor of MemObject, only to call from DofManager
678 ReserveMemoryObjects ( MemObjectType & mo ) : memobj_ (mo) {}
679
680 // reserve for at least chunkSize new values
681 inline void apply ( SizeType& chunkSize )
682 {
683 memobj_.reserve( chunkSize );
684 }
685 };
686
687
688 // this is the dofmanagers object which is being used during restriction
689 // and prolongation process for adding and removing indices to and from
690 // index sets which belong to functions that belong to that dofmanager
691 template <class DofManagerType , class RestrictProlongIndexSetType, bool doResize >
694 RestrictProlongTraits<
695 IndexSetRestrictProlong<DofManagerType,RestrictProlongIndexSetType,doResize>, double > >
696 {
697 DofManagerType & dm_;
698
699 RestrictProlongIndexSetType & insert_;
700 RestrictProlongIndexSetType & remove_;
701 public:
702
703 IndexSetRestrictProlong ( DofManagerType & dm , RestrictProlongIndexSetType & is, RestrictProlongIndexSetType & rm )
704 : dm_(dm) , insert_( is ), remove_( rm ) {}
705
707 template <class EntityType>
708 inline void restrictLocal ( const EntityType & father, const EntityType & son , bool initialize ) const
709 {
710 // insert index of father
711 insert_.apply( father );
712 // mark index of son for removal
713 remove_.apply( son );
714
715 // resize memory if doResize is true
716 if ( doResize )
717 {
718 dm_.resizeMemory();
719 }
720 }
721
722 template <class EntityType>
723 inline void restrictFinalize( const EntityType &father ) const
724 {}
725
727 template <class EntityType>
728 inline void prolongLocal ( const EntityType & father, const EntityType & son , bool initialize ) const
729 {
730 // mark index of father for removal
731 remove_.apply( father );
732 // insert index of son
733 insert_.apply( son );
734
735 // resize memory if doResize is true
736 if ( doResize )
737 {
738 dm_.resizeMemory();
739 }
740 }
741 };
742
743 // empty restrict prolong operator
745 public RestrictProlongInterface< RestrictProlongTraits< EmptyIndexSetRestrictProlong, double > >
746 {
747 public:
750 template <class EntityType>
751 inline void restrictLocal ( EntityType & father, EntityType & son , bool initialize ) const {}
753 template <class EntityType>
754 inline void prolongLocal ( EntityType & father, EntityType & son , bool initialize ) const {}
755 };
756
757
758 class DofManError : public Exception {};
759
775 // --DofManager
776 template< class Grid >
778#if HAVE_DUNE_ALUGRID
779 public IsDofManager,
780 public LoadBalanceHandleWithReserveAndCompress,
781#endif
782#if HAVE_DUNE_P4ESTGRID
783 public P4estGridLoadBalanceHandleWithReserveAndCompress,
784#endif
785 // DofManager behaves like a communication data handle for load balancing
786 public CommDataHandleIF< DofManager< Grid >, char >
787 {
789
790 friend struct DefaultSingletonFactory< const Grid*, ThisType >;
791 friend class DofManagerFactory< ThisType >;
792
793 public:
795 typedef Grid GridType;
796
799 public:
800 // types of inlining and xtraction stream types
803
804 // types of data collectors
807
808 typedef typename GridType :: template Codim< 0 > :: Entity ElementType ;
809
810 private:
813 typedef typename MemObjectCheckType::Traits::ParamType MemObjSizeType;
815
816 // list with MemObjects, for each DiscreteFunction we have one MemObject
817 ListType memList_;
818
819 // list of all different indexsets
820 IndexListType indexList_;
821
822 // the dofmanager belong to one grid only
823 const GridType &grid_;
824
825 // index set for mapping
826 mutable DataInlinerType dataInliner_;
827 mutable DataXtractorType dataXtractor_;
828
831 typedef const ElementType ConstElementType;
833
834 mutable LocalIndexSetObjectsType insertIndices_;
835 mutable LocalIndexSetObjectsType removeIndices_;
836
837 // lists containing all MemObjects
838 // to have fast access during resize and reserve
839 mutable MemObjectCheckType resizeMemObjs_;
840 mutable MemObjectCheckType reserveMemObjs_;
841
843 const MemObjSizeType defaultChunkSize_;
844
846 int sequence_;
847
848 public:
853
854 // old type
856
857 // this class needs to call resizeMemory
860
861 private:
862 // combine object holding all index set for restrict and prolong
863 NewIndexSetRestrictProlongType indexSetRestrictProlong_;
864 IndexSetRestrictProlongNoResizeType indexSetRestrictProlongNoResize_;
865
866 // old type
868
870 double memoryFactor_;
871
873 const bool clearResizedArrays_;
874
875 //**********************************************************
876 //**********************************************************
878 inline explicit DofManager ( const GridType *grid )
879 : grid_( *grid ),
880 defaultChunkSize_( 128 ),
881 sequence_( 0 ),
882 indexSetRestrictProlong_( *this, insertIndices_ , removeIndices_ ),
883 indexSetRestrictProlongNoResize_( *this, insertIndices_ , removeIndices_ ),
884 indexRPop_(),
885 memoryFactor_( Parameter :: getValidValue( "fem.dofmanager.memoryfactor", double( 1.1 ),
886 [] ( double value ) { return value >= 1.0; } ) ),
887 clearResizedArrays_( Parameter :: getValue("fem.dofmanager.clearresizedarrays", bool( true ) ) )
888 {
889 // only print memory factor if it deviates from the default value
890 if( std::abs( memoryFactor_ - 1.1 ) > 1e-12 )
891 {
892 if( Parameter::verbose( Parameter::parameterOutput ) && (grid_.comm().rank() == 0) )
893 std::cout << "Created DofManager with memory factor " << memoryFactor_ << "." << std::endl;
894 }
895 }
896
897 public:
899 ~DofManager ();
900
901 DofManager( const ThisType& ) = delete;
902
904 double memoryFactor() const { return memoryFactor_; }
905
924 template <class IndexSetType>
925 inline void addIndexSet (const IndexSetType &iset );
926
934 template <class IndexSetType>
935 inline void removeIndexSet (const IndexSetType &iset );
936
941 template <class ManagedDofStorageImp>
942 void addDofStorage(ManagedDofStorageImp& dofStorage);
943
948 template <class ManagedDofStorageImp>
949 void removeDofStorage(ManagedDofStorageImp& dofStorage);
950
953 {
954 // hier muss statt dessen ein Combiniertes Object erzeugt werden.
955 // dafuer sollte bei einhaengen der IndexSets ein Methoden Pointer
956 // erzeugt werden, welcher die den IndexSet mit einem anderen Object
957 // kombiniert
958 return indexSetRestrictProlong_;
959 }
960
963 {
964 // return index set restrict/prolong operator that is only inserting
965 // and mark for removal indices but not doing resize
966 return indexSetRestrictProlongNoResize_;
967 }
968
970 bool hasIndexSets() const
971 {
972 return ! insertIndices_.empty();
973 }
974
976 size_t usedMemorySize () const
977 {
978 size_t used = 0;
979 for(auto memObjectPtr : memList_)
980 used += memObjectPtr->usedMemorySize();
981 return used;
982 }
983
988 {
989 resizeMemory();
990 }
991
994 void reserveMemory ( std::size_t nsize, bool dummy = false )
995 {
996 MemObjSizeType localChunkSize =
997 std::max( MemObjSizeType(nsize), defaultChunkSize_ );
998 assert( localChunkSize > 0 );
999
1000 // reserves (size + chunkSize * elementMemory), see above
1001 reserveMemObjs_.apply ( localChunkSize );
1002 }
1003
1008 int sequence () const { return sequence_; }
1009
1013 void resize()
1014 {
1015 for(auto indexSetPtr : indexList_)
1016 indexSetPtr->resize();
1017 resizeMemory();
1018 }
1019
1021 inline void insertEntity( ConstElementType & element )
1022 {
1023 // insert new index
1024 insertIndices_.apply( element );
1025
1026 // resize memory
1027 resizeMemory();
1028 }
1029
1031 inline void removeEntity( ConstElementType & element ) const
1032 {
1033 // remove entity from index sets in removeIndices list
1034 removeIndices_.apply( element );
1035 }
1036
1039 {
1040 MemObjSizeType enlargeOnly( 0 );
1041 // pass dummy parameter
1042 resizeMemObjs_.apply ( enlargeOnly );
1043 }
1044
1047 {
1048 MemObjSizeType enlargeOnly( 1 );
1049 // pass dummy parameter
1050 resizeMemObjs_.apply ( enlargeOnly );
1051 }
1052
1057 {
1058 // mark next sequence
1059 ++sequence_;
1060
1061 // check that sequence number is the same for all processes
1062 assert( sequence_ == grid_.comm().max( sequence_ ) );
1063 }
1064
1065 //- --compress
1070 {
1071 // mark next sequence
1073
1074 // compress indexsets first
1075 for(auto indexSetPtr : indexList_)
1076 {
1077 // reset compressed so the next time compress of index set is called
1078 indexSetPtr->compress();
1079 }
1080
1081 // compress all data now
1082 for(auto memObjectPtr : memList_)
1083 {
1084 // if correponding index was not compressed yet, this is called in
1085 // the MemObject dofCompress, if index has not changes, nothing happens
1086 // if IndexSet actual needs no compress, nothing happens to the
1087 // data either
1088 // also data is resized, which means the vector is getting shorter
1089 memObjectPtr->dofCompress ( clearResizedArrays_ );
1090 }
1091 }
1092
1094 bool notifyGlobalChange( const bool wasChanged ) const
1095 {
1096 // make sure that wasChanged is the same on all cores
1097 int wasChangedCounter = int( wasChanged );
1098 return bool( grid_.comm().max( wasChangedCounter ) );
1099 }
1100
1102 template <class DataCollType>
1103 void addDataInliner ( DataCollType & d)
1104 {
1105 dataInliner_ += d;
1106 }
1107
1110 {
1111 dataInliner_.clear();
1112 }
1113
1115 template <class DataCollType>
1116 void addDataXtractor ( DataCollType & d)
1117 {
1118 dataXtractor_ += d;
1119 }
1120
1123 {
1124 dataXtractor_.clear();
1125 }
1126
1128 // CommDataHandleIF methods
1130
1132 bool contains( const int dim, const int codim ) const
1133 {
1134 return ( codim == 0 );
1135 }
1136
1138 bool fixedSize( const int dim, const int codim ) const
1139 {
1140 return false;
1141 }
1142
1144 template <class Entity>
1145 size_t size( const Entity& ) const
1146 {
1147 DUNE_THROW(NotImplemented,"DofManager::size should not be called!");
1148 return -1;
1149 }
1150
1152 void gather( InlineStreamType& str, ConstElementType& element ) const
1153 {
1154 // pack all data to stream
1155 dataInliner_.apply(str, element);
1156
1157 // remove entity from index sets
1158 //const_cast< ThisType & >( *this ).removeEntity( element );
1159 removeEntity( element );
1160 }
1161
1162 template <class MessageBuffer, class Entity>
1163 void gather( MessageBuffer& str, const Entity& entity ) const
1164 {
1165 // if this method is called then either the message buffer is
1166 // not of the correct type or an entity of higher codimension
1167 // was passed along
1168 DUNE_THROW(NotImplemented,"DofManager::gather( entity ) with codim > 0 not implemented");
1169 }
1170
1172 void scatter ( XtractStreamType& str, ConstElementType& element, size_t )
1173 {
1174 // insert entity into index sets
1175 insertEntity( element );
1176
1177 // here the elements already have been created
1178 // that means we can xtract data
1179 dataXtractor_.apply(str, element);
1180 }
1181
1183 template <class MessageBuffer, class Entity>
1184 void scatter ( MessageBuffer & str, const Entity& entity, size_t )
1185 {
1186 // if this method is called then either the message buffer is
1187 // not of the correct type or an entity of higher codimension
1188 // was passed along
1189 DUNE_THROW(NotImplemented,"DofManager::scatter( entity ) with codim > 0 not implemented");
1190 }
1191
1192 //********************************************************
1193 // Interface for PersistentObjects
1194 //********************************************************
1195
1197 void backup () const
1198 {
1199 for(auto indexSetPtr : indexList_)
1200 indexSetPtr->backup();
1201 }
1202
1204 void restore ()
1205 {
1206 for(auto indexSetPtr : indexList_)
1207 indexSetPtr->restore();
1208
1209 // make all index sets consistent
1210 // before any data is read this can be
1211 // assured since DofManager is an
1212 // AutoPersistentObject and thus in the
1213 // beginning of the list, fater the grid of course
1214 resize();
1215 }
1216
1217 //********************************************************
1218 // read/write using fem streams
1219 //********************************************************
1224 template < class OutStream >
1225 void write( OutStream& out ) const
1226 {
1227 for(auto indexSetPtr : indexList_)
1228 indexSetPtr->write( out );
1229 }
1230
1235 template < class InStream >
1236 void read( InStream& in )
1237 {
1238 for(auto indexSetPtr : indexList_)
1239 indexSetPtr->read( in );
1240 }
1241
1242 //********************************************************
1243 // Interface for DofManager access
1244 //********************************************************
1245 protected:
1246 static const std::string& dmKey()
1247 {
1248 static const std::string key("fem::DM");
1249 return key;
1250 }
1251
1252 public:
1259 static inline ThisType& instance( const GridType& grid )
1260 {
1261 // if grid supports user data storage
1262 if constexpr ( requires{ grid.userData(); })
1263 {
1264 typedef std::shared_ptr< ThisType > DMPtrType;
1265 auto& userData = grid.userData();
1266 auto it = userData.find( dmKey() );
1267 if( it == userData.end() )
1268 {
1269 DMPtrType dmPtr( new ThisType( &grid ) );
1270 std::any dmAny = dmPtr;
1271 userData.emplace( std::make_pair( dmKey(), dmAny ) );
1272 return *dmPtr;
1273 }
1274 else
1275 {
1276 auto dmPtr = std::any_cast< DMPtrType > ( it->second );
1277 return *dmPtr;
1278 }
1279 }
1280 else
1281 {
1282 // old singleton implementation
1283 typedef DofManagerFactory< ThisType > DofManagerFactoryType;
1284 return DofManagerFactoryType :: instance( grid );
1285 }
1286 }
1287 };
1288
1289 //***************************************************************************
1290 //
1291 // inline implemenations
1292 //
1293 //***************************************************************************
1294
1295 template <class GridType>
1297 {
1298 // enable output if verbosity level is debugOutput
1299 const bool verbose = Parameter::verbose( Parameter::debugOutput );
1300 if(memList_.size() > 0)
1301 {
1302 while( memList_.rbegin() != memList_.rend())
1303 {
1304 DofStorageInterface * mobj = (* memList_.rbegin() );
1305 if( verbose )
1306 std::cout << "Removing '" << mobj << "' from DofManager!\n";
1307 memList_.pop_back();
1308 }
1309 }
1310
1311 if(indexList_.size() > 0)
1312 {
1313 if( verbose )
1314 std::cerr << "ERROR: Not all index sets have been removed from DofManager yet!" << std::endl;
1315 while ( indexList_.rbegin() != indexList_.rend())
1316 {
1317 ManagedIndexSetInterface* iobj = (* indexList_.rbegin() );
1318 indexList_.pop_back();
1319 if(iobj) delete iobj;
1320 }
1321 }
1322 }
1323
1324 template <class GridType>
1325 template <class IndexSetType>
1327 addIndexSet (const IndexSetType &iset )
1328 {
1329 // only call in single thread mode
1330 if( ! Fem :: MPIManager :: singleThreadMode() )
1331 {
1332 assert( Fem :: MPIManager :: singleThreadMode() );
1333 DUNE_THROW(InvalidStateException,"DofManager::addIndexSet: only call in single thread mode!");
1334 }
1335
1336 typedef ManagedIndexSet< IndexSetType, ConstElementType > ManagedIndexSetType;
1337 ManagedIndexSetType * indexSet = 0;
1338
1339 // search index set list in reverse order to find latest index sets faster
1340 auto endit = indexList_.rend();
1341 for(auto it = indexList_.rbegin(); it != endit; ++it )
1342 {
1343 ManagedIndexSetInterface *set = *it;
1344 if( set->equals( iset ) )
1345 {
1346 set->addReference();
1347
1348 indexSet = static_cast< ManagedIndexSetType * >( set );
1349 break;
1350 }
1351 }
1352
1353 if( !indexSet )
1354 {
1355 indexSet = new ManagedIndexSetType ( iset, insertIndices_ , removeIndices_ );
1356 indexList_.push_back( static_cast< ManagedIndexSetInterface * >( indexSet ) );
1357 }
1358 }
1359
1360 template <class GridType>
1361 template <class IndexSetType>
1362 inline void DofManager<GridType>::removeIndexSet ( const IndexSetType &iset )
1363 {
1364 // only call in single thread mode
1365 if( ! Fem :: MPIManager :: singleThreadMode() )
1366 {
1367 assert( Fem :: MPIManager :: singleThreadMode() );
1368 DUNE_THROW(InvalidStateException,"DofManager::removeIndexSet: only call in single thread mode!");
1369 }
1370
1371 // search index set list in reverse order to find latest index sets faster
1372 auto endit = indexList_.rend();
1373 for( auto it = indexList_.rbegin(); it != endit; ++it )
1374 {
1375 ManagedIndexSetInterface *set = *it;
1376 if( set->equals( iset ) )
1377 {
1378 if( set->removeReference() )
1379 {
1380 // reverse iterators cannot be erased directly, so erase the base
1381 // (forward) iterator
1382 // Note: see, e.g., Stroustrup, section 16.3.2 about the decrement
1383 auto fit = it.base();
1384 indexList_.erase( --fit );
1385 // delete proxy
1386 delete set;
1387 }
1388 return;
1389 }
1390 }
1391
1392 // we should never get here
1393 DUNE_THROW(InvalidStateException,"Could not remove index from DofManager set!");
1394 }
1395
1396 template <class GridType>
1397 template <class ManagedDofStorageImp>
1398 void DofManager<GridType>::addDofStorage(ManagedDofStorageImp& dofStorage)
1399 {
1400 // make sure we got an ManagedDofStorage
1401 ManagedDofStorageInterface* obj = &dofStorage;
1402
1403 // push_front, makes search faster
1404 memList_.push_front( obj );
1405
1406 // add the special object to the memResize list object
1407 resizeMemObjs_ += dofStorage.resizeMemoryObject();
1408
1409 // the same for the reserve call
1410 reserveMemObjs_ += dofStorage.reserveMemoryObject();
1411 }
1412
1413
1414 template <class GridType>
1415 template <class ManagedDofStorageImp>
1416 void DofManager<GridType>::removeDofStorage(ManagedDofStorageImp& dofStorage)
1417 {
1418 // make sure we got an ManagedDofStorage
1419 auto obj = &dofStorage;
1420
1421 // search list starting from tail
1422 auto endit = memList_.end();
1423 for( auto it = memList_.begin();it != endit ; ++it)
1424 {
1425 if(*it == obj)
1426 {
1427 // alloc new mem and copy old mem
1428 memList_.erase( it );
1429
1430 // remove from list
1431 resizeMemObjs_.remove( dofStorage.resizeMemoryObject() );
1432 reserveMemObjs_.remove( dofStorage.reserveMemoryObject() );
1433
1434 return ;
1435 }
1436 }
1437 }
1438
1440
1441
1449 template< class DofManagerImp >
1451 {
1453
1454 public:
1455 typedef DofManagerImp DofManagerType;
1456 typedef typename DofManagerType :: GridType GridType;
1457
1458 private:
1459 typedef const GridType *KeyType;
1460
1462
1463 // declare friendship becase of methods instance
1464 friend class DofManager< GridType >;
1465
1466 protected:
1473 inline static DofManagerType &instance ( const GridType &grid )
1474 {
1475 DofManagerType *dm = getDmFromList( grid );
1476 if( !dm )
1477 return DMProviderType :: getObject( &grid );
1478 return *dm;
1479 }
1480
1482 inline static bool
1484 const std :: string &filename,
1485 int timestep )
1486 {
1487 DofManagerType *dm = getDmFromList( grid );
1488 /*
1489 if( dm )
1490 return dm->writeIndexSets( filename, timestep );
1491 */
1492 return false;
1493 }
1494
1496 inline static bool
1498 const std :: string &filename,
1499 int timestep )
1500 {
1501 DofManagerType *dm = getDmFromList( grid );
1502 /*
1503 if( dm )
1504 return dm->readIndexSets( filename, timestep );
1505 */
1506 return false;
1507 }
1508
1509 public:
1511 inline static void deleteDofManager ( DofManagerType &dm )
1512 {
1513 DMProviderType :: removeObject( &dm );
1514 }
1515
1516 private:
1517 // return pointer to dof manager for given grid
1518 inline static DofManagerType *getDmFromList( const GridType &grid )
1519 {
1520 return (DMProviderType :: getObjFromList( &grid )).first;
1521 }
1522 };
1523
1524 } // namespace Fem
1525
1526} // namespace Dune
1527
1528#endif // #ifndef DUNE_FEM_DOFMANAGER_HH
size_type dim() const
#define DUNE_THROW(E,...)
virtual void backup() const =0
:: backup
IdentifierType setPtr_
Definition dofmanager.hh:66
std::size_t SizeType
Definition dofmanager.hh:219
DofManagerType & dm_
Definition dofmanager.hh:289
RemoveIndicesFromSet(IndexSetType &iset)
Definition dofmanager.hh:613
bool removeReference()
decrease reference counter and return true if zero reached
Definition dofmanager.hh:98
void resizeAndMoveToRear()
Definition dofmanager.hh:519
virtual bool compress()=0
compress of index set
void restrictLocal(const EntityType &father, const EntityType &son, bool initialize) const
restrict data to father and resize memory if doResize is true
Definition dofmanager.hh:708
DofManager(const ThisType &)=delete
void scatter(MessageBuffer &str, const Entity &entity, size_t)
unpacks all data of this entity from message buffer
Definition dofmanager.hh:1184
void enlargeMemory()
resize the MemObject if necessary
Definition dofmanager.hh:1046
ManagedDofStorageImplementation< GridImp, MapperType, DofArrayType > ThisType
Definition dofmanager.hh:284
void resize()
wrap resize of index set
Definition dofmanager.hh:175
DataCollectorInterface< GridType, InlineStreamType > DataInlinerType
Definition dofmanager.hh:806
size_t usedMemorySize() const
return used memory size of all MemObjects in bytes.
Definition dofmanager.hh:976
IndexSetRestrictProlongNoResizeType & indexSetRestrictProlongNoResize()
returns the index set restriction and prolongation operator
Definition dofmanager.hh:962
static DofManagerType & instance(const GridType &grid)
obtain a reference to the DofManager for a given grid
Definition dofmanager.hh:1473
ResizeMemoryObjects< ThisType > ResizeMemoryObjectType
Definition dofmanager.hh:297
ResizeMemoryObjectType resizeMemObj_
Definition dofmanager.hh:299
void addDataXtractor(DataCollType &d)
add data handler for data xtracting to dof manager
Definition dofmanager.hh:1116
DofManager< GridImp > DofManagerType
Definition dofmanager.hh:286
virtual void write(StandardOutStream &out) const
new write method
Definition dofmanager.hh:202
void resize()
Resize index sets and memory due to what the mapper has as new size.
Definition dofmanager.hh:1013
LocalIndexSetObjectsType & removeList_
Definition dofmanager.hh:139
virtual void backup() const
:: backup
Definition dofmanager.hh:187
void restore()
:: restore
Definition dofmanager.hh:1204
void enableDofCompression() override
enable dof compression for this MemObject
Definition dofmanager.hh:431
GridObjectStreamTraits< GridType >::OutStreamType InlineStreamImplType
Definition dofmanager.hh:798
bool compress()
wrap compress of index set
Definition dofmanager.hh:181
ManagedDofStorageImplementation(const ManagedDofStorageImplementation &)=delete
ResizeMemoryObjects(MemObjectType &mo)
Definition dofmanager.hh:653
void resize(std::false_type, const bool enlargeOnly)
Definition dofmanager.hh:446
virtual void read(StandardInStream &out)=0
void removeIndexSet(const IndexSetType &iset)
removed index set from dof manager's list of index sets
Definition dofmanager.hh:1362
void dofCompress(const bool clearResizedArrays) override
copy the dof from the rear section of the vector to the holes
Definition dofmanager.hh:370
virtual void restore()=0
:: restore
void prolongLocal(const EntityType &father, const EntityType &son, bool initialize) const
prolong data to children and resize memory if doResize is true
Definition dofmanager.hh:728
void resizeMemory()
resize the MemObject if necessary
Definition dofmanager.hh:1038
void insertEntity(ConstElementType &element)
Inserts entity to all index sets added to dof manager.
Definition dofmanager.hh:1021
IndexSetType & indexSet_
Definition dofmanager.hh:132
static void deleteDofManager(DofManagerType &dm)
delete the dof manager that belong to the given grid
Definition dofmanager.hh:1511
IndexSetRestrictProlong< ThisType, LocalIndexSetObjectsType, true > NewIndexSetRestrictProlongType
Definition dofmanager.hh:850
SizeType size() const override
return size of underlying array
Definition dofmanager.hh:342
ReserveMemoryObjects(MemObjectType &mo)
Definition dofmanager.hh:678
DofManagerType::GridType GridType
Definition dofmanager.hh:1456
size_t size(const Entity &) const
for convenience
Definition dofmanager.hh:1145
void apply(SizeType &chunkSize)
Definition dofmanager.hh:681
DataCollectorInterface< GridType, XtractStreamType > DataXtractorType
Definition dofmanager.hh:805
MemObjectType::SizeType SizeType
Definition dofmanager.hh:675
const void * IdentifierType
Definition dofmanager.hh:64
void resize(const bool enlargeOnly) override
resize the memory with the new size
Definition dofmanager.hh:345
ReserveMemoryObjects< ThisType > ReserveMemoryObjectType
Definition dofmanager.hh:298
LocalInterface< SizeType > MemObjectCheckType
Definition dofmanager.hh:244
double memoryFactor() const
return factor to over estimate new memory allocation
Definition dofmanager.hh:904
void prolongLocal(EntityType &father, EntityType &son, bool initialize) const
prolong data to children and resize memory if doResize is true
Definition dofmanager.hh:754
ResizeMemoryObjectType & resizeMemoryObject()
return object that calls resize of this memory object
Definition dofmanager.hh:336
static bool writeDofManagerNew(const GridType &grid, const std ::string &filename, int timestep)
writes DofManager of corresponding grid, when DofManager exists
Definition dofmanager.hh:1483
ManagedDofStorageImplementation(const GridImp &grid, const MapperType &mapper, DofArrayType &array)
Constructor of ManagedDofStorageImplementation, only to call from derived classes.
Definition dofmanager.hh:310
NewIndexSetRestrictProlongType & indexSetRestrictProlong()
returns the index set restriction and prolongation operator
Definition dofmanager.hh:952
virtual void resize(const bool enlargeOnly)=0
resize memory
virtual ~ManagedDofStorageInterface()=default
destructor
Grid GridType
type of Grid this DofManager belongs to
Definition dofmanager.hh:795
void resize(std::true_type, const bool enlargeOnly)
Definition dofmanager.hh:462
ManagedIndexSetInterface BaseType
type of base class
Definition dofmanager.hh:143
DofArrayType & array_
Definition dofmanager.hh:295
void moveToFront(const SizeType oldSize, const int block)
move block to front again
Definition dofmanager.hh:524
void apply(SizeType &enlargeOnly)
Definition dofmanager.hh:659
DofStorageInterface::SizeType SizeType
Definition dofmanager.hh:242
virtual void dofCompress(const bool clearResizedArrays)=0
DofStorageInterface()=default
do not allow to create explicit instances
ReserveMemoryObjectType & reserveMemoryObject()
return object that calls reserve of this memory object
Definition dofmanager.hh:339
void gather(InlineStreamType &str, ConstElementType &element) const
packs all data attached to this entity
Definition dofmanager.hh:1152
~ManagedIndexSet()
destructor
Definition dofmanager.hh:165
MapperType & mapper() const
Definition dofmanager.hh:440
ManagedDofStorageInterface()=default
do not allow to create explicit instances
DofArrayType & getArray()
return reference to array for DiscreteFunction
Definition dofmanager.hh:437
virtual void read(StandardInStream &in)
new write method
Definition dofmanager.hh:199
void read(InStream &in)
read all index sets from a given stream
Definition dofmanager.hh:1236
void apply(EntityType &entity)
apply wraps the insertEntity method of the index set
Definition dofmanager.hh:635
static ThisType & instance(const GridType &grid)
obtain a reference to the DofManager for a given grid
Definition dofmanager.hh:1259
MessageBufferIF< InlineStreamImplType > InlineStreamType
Definition dofmanager.hh:802
~DofManager()
Desctructor, removes all MemObjects and IndexSetObjects.
Definition dofmanager.hh:1296
RemoveIndicesFromSet< IndexSetType, EntityType > removeIdxObj_
Definition dofmanager.hh:136
ManagedDofStorageInterface::SizeType SizeType
Definition dofmanager.hh:279
void addDofStorage(ManagedDofStorageImp &dofStorage)
add a managed dof storage to the dof manager.
Definition dofmanager.hh:1398
void compress()
Compress all data that is hold by this dofmanager.
Definition dofmanager.hh:1069
virtual ~ManagedIndexSetInterface()=default
void incrementSequenceNumber()
increase the DofManagers internal sequence number
Definition dofmanager.hh:1056
size_t usedMemorySize() const override
return used memory size
Definition dofmanager.hh:425
void restrictLocal(EntityType &father, EntityType &son, bool initialize) const
restrict data to father and resize memory if doResize is true
Definition dofmanager.hh:751
void removeEntity(ConstElementType &element) const
Removes entity from all index sets added to dof manager.
Definition dofmanager.hh:1031
void reserveMemory(std::size_t nsize, bool dummy=false)
reserve memory for at least nsize elements, dummy is needed for dune-grid ALUGrid version
Definition dofmanager.hh:994
static bool readDofManagerNew(const GridType &grid, const std ::string &filename, int timestep)
reads DofManager of corresponding grid, when DofManager exists
Definition dofmanager.hh:1497
void reserve(const SizeType needed) override
reserve memory for what is coming
Definition dofmanager.hh:351
static std::pair< DofStorageInterface *, DofStorageType * > allocateManagedDofStorage(const GridType &grid, const MapperType &mapper, const DofStorageType *=0)
default implementation for creating a managed dof storage
Definition dofmanager.hh:579
void addReference()
increase reference counter
Definition dofmanager.hh:95
virtual SizeType size() const =0
size of space, i.e. mapper.size()
MessageBufferIF< XtractStreamImplType > XtractStreamType
Definition dofmanager.hh:801
MemObjectType::SizeType SizeType
Definition dofmanager.hh:650
ResizeMemoryObjects(const ResizeMemoryObjects &org)
Definition dofmanager.hh:654
GridObjectStreamTraits< GridType >::InStreamType XtractStreamImplType
Definition dofmanager.hh:797
ManagedIndexSet(const IndexSetType &iset, LocalIndexSetObjectsType &insertList, LocalIndexSetObjectsType &removeList)
Constructor of MemObject, only to call from DofManager.
Definition dofmanager.hh:146
virtual void write(StandardOutStream &out) const =0
new read/write methods using binary streams
void apply(EntityType &entity)
apply wraps the removeEntity Method of the index set
Definition dofmanager.hh:616
EmptyIndexSetRestrictProlong IndexSetRestrictProlongType
Definition dofmanager.hh:855
void write(OutStream &out) const
write all index sets to a given stream
Definition dofmanager.hh:1225
void removeDofStorage(ManagedDofStorageImp &dofStorage)
remove a managed dof storage from the dof manager.
Definition dofmanager.hh:1416
void gather(MessageBuffer &str, const Entity &entity) const
Definition dofmanager.hh:1163
EmptyIndexSetRestrictProlong()
Definition dofmanager.hh:748
GridType::template Codim< 0 >::Entity ElementType
Definition dofmanager.hh:808
DofManagerImp DofManagerType
Definition dofmanager.hh:1455
void restrictFinalize(const EntityType &father) const
Definition dofmanager.hh:723
void clearDataXtractors()
clear data xtractor list
Definition dofmanager.hh:1122
bool contains(const int dim, const int codim) const
the dof manager only transfers element data during load balancing
Definition dofmanager.hh:1132
virtual void restore()
:: restore
Definition dofmanager.hh:193
void resizeForRestrict()
resize memory before data restriction during grid adaptation is done.
Definition dofmanager.hh:987
bool equals(const IndexSet &iset) const
Definition dofmanager.hh:104
virtual void enableDofCompression()
enable dof compression for dof storage (default is empty)
Definition dofmanager.hh:225
DofArrayType myArray_
Definition dofmanager.hh:565
ReserveMemoryObjectType reserveMemObj_
Definition dofmanager.hh:300
void clearDataInliners()
clear data inliner list
Definition dofmanager.hh:1109
MapperType & mapper_
Definition dofmanager.hh:292
bool notifyGlobalChange(const bool wasChanged) const
communicate new sequence number
Definition dofmanager.hh:1094
IndexSetRestrictProlong(DofManagerType &dm, RestrictProlongIndexSetType &is, RestrictProlongIndexSetType &rm)
Definition dofmanager.hh:703
bool fixedSize(const int dim, const int codim) const
fixed size is false
Definition dofmanager.hh:1138
virtual void reserve(const SizeType newSize)=0
resize memory
void backup() const
:: backup
Definition dofmanager.hh:1197
void addDataInliner(DataCollType &d)
add data handler for data inlining to dof manager
Definition dofmanager.hh:1103
void scatter(XtractStreamType &str, ConstElementType &element, size_t)
unpacks all data attached of this entity from message buffer
Definition dofmanager.hh:1172
ManagedDofStorage(const GridImp &grid, const MapperType &mapper)
Constructor of ManagedDofStorage.
Definition dofmanager.hh:568
LocalIndexSetObjectsType & insertList_
Definition dofmanager.hh:138
ManagedIndexSetInterface(const IndexSet &iset)
Definition dofmanager.hh:71
size_t referenceCounter_
Definition dofmanager.hh:68
bool dataCompressionEnabled_
Definition dofmanager.hh:303
bool hasIndexSets() const
if dofmanagers list is not empty return true
Definition dofmanager.hh:970
virtual size_t usedMemorySize() const =0
return size of mem used by MemObject
virtual void resize()=0
resize of index set
InsertIndicesToSet< IndexSetType, EntityType > insertIdxObj_
Definition dofmanager.hh:135
InsertIndicesToSet(IndexSetType &iset)
Definition dofmanager.hh:632
ManagedDofStorageInterface::MemObjectCheckType MemObjectCheckType
Definition dofmanager.hh:281
~ManagedDofStorageImplementation()
destructor deleting MemObject from resize and reserve List
Definition dofmanager.hh:328
void addIndexSet(const IndexSetType &iset)
add index set to dof manager's list of index sets
Definition dofmanager.hh:1327
IndexSetRestrictProlong< ThisType, LocalIndexSetObjectsType, false > IndexSetRestrictProlongNoResizeType
Definition dofmanager.hh:852
virtual ~DofStorageInterface()=default
destructor
int sequence() const
return number of sequence, if dofmanagers memory was changed by calling some method like resize,...
Definition dofmanager.hh:1008
static const std::string & dmKey()
Definition dofmanager.hh:1246
Dune::Fem::Double abs(const Dune::Fem::Double &a)
Definition double.hh:942
const Communication & comm() const
interface documentation for (grid part) index sets
Definition common/indexset.hh:123
specialize with true if index set implements the interface for consecutive index sets
Definition common/indexset.hh:61
Container for User Specified Parameters.
Definition io/parameter.hh:191
static bool verbose()
obtain the cached value for fem.verbose with default verbosity level 2
Definition io/parameter.hh:466
static const int parameterOutput
Definition io/parameter.hh:195
static const int debugOutput
Definition io/parameter.hh:197
output stream writing into a given std::ostream
Definition standardstreams.hh:61
input stream reading from a given std::istream
Definition standardstreams.hh:202
ObjectStreamType InStreamType
Definition gridobjectstreams.hh:70
ObjectStreamType OutStreamType
Definition gridobjectstreams.hh:71
Definition dofmanager.hh:787
Definition datacollector.hh:232
Definition datacollector.hh:83
void apply(ParamType &p) const
for all pointer to local operators call the func pointer
Definition datacollector.hh:163
bool empty() const
Definition datacollector.hh:224
void remove(const OpType &op)
Definition datacollector.hh:203
ParamT ParamType
Definition datacollector.hh:106
Definition datacollector.hh:262
virtual void clear()
clear object list
Definition datacollector.hh:378
virtual void apply(ObjectStreamType &str, const EntityType &entity) const
Definition datacollector.hh:289
Singleton provider for the DofManager.
Definition dofmanager.hh:1451
Definition dofmanager.hh:60
Definition dofmanager.hh:606
Definition dofmanager.hh:625
Definition dofmanager.hh:124
Interface class for a dof storage object to be stored in discrete functions.
Definition dofmanager.hh:213
Interface class for a dof storage object that can be managed (resized and compressed) by the DofManag...
Definition dofmanager.hh:236
Definition dofmanager.hh:644
Definition dofmanager.hh:669
Definition dofmanager.hh:277
Definition dofmanager.hh:562
Definition dofmanager.hh:696
Definition dofmanager.hh:746
Definition dofmanager.hh:758
Interface class defining the local behaviour of the restrict/prolong operation (using BN)
Definition restrictprolonginterface.hh:40
void initialize()
initialize restrict prolong object (if necessary) before adaptation takes place
Definition restrictprolonginterface.hh:52
Definition space/mapper/capabilities.hh:22
Definition singletonlist.hh:25
Singleton list for key/object pairs.
Definition singletonlist.hh:53
T emplace(T... args)
T endl(T... args)
T forward(T... args)
T make_pair(T... args)
T max(T... args)