DUNE-FEM (unstable)

adaptationmanager.hh
1#ifndef DUNE_FEM_ADAPTATIONMANAGER_HH
2#define DUNE_FEM_ADAPTATIONMANAGER_HH
3
4//- system includes
5#include <type_traits>
6#include <string>
7
8//- local includes
10#include <dune/fem/space/common/dofmanager.hh>
11#include <dune/fem/operator/common/objpointer.hh>
12
13#include <dune/fem/misc/capabilities.hh>
14#include <dune/fem/space/common/communicationmanager.hh>
15#include <dune/fem/space/common/loadbalancer.hh>
16#include <dune/fem/space/common/restrictprolonginterface.hh>
17#include <dune/fem/storage/singletonlist.hh>
18
20#include <dune/fem/io/parameter.hh>
21#include <dune/fem/io/file/persistencemanager.hh>
22#include <dune/fem/misc/mpimanager.hh>
23
24#include <dune/fem/space/common/dataprojection/dataprojection.hh>
25
26namespace Dune
27{
28
29 namespace Fem
30 {
31
61 {
62 public:
65
68
72 virtual void adapt ()
73 {
74 //std::cout << "called AdaptationManagerInterface::adapt()" << std::endl;
75 if(am_) am_->adapt();
76 else
77 {
78 std::cerr << "WARNING: AdaptationManagerInterface::adapt: no adaptation manager assigned! \n";
79 }
80 }
81
85 virtual bool adaptive () const
86 {
87 return (am_) ? (am_->adaptive()) : false;
88 }
89
91 virtual bool isCallBackAdaptation() const { return (am_) ? (am_->isCallBackAdaptation()) : false; }
92
96 virtual const char * methodName() const
97 {
98 return (am_) ? (am_->methodName()) : "unknown method";
99 }
100
105 {
107 am_ = const_cast<AdaptationManagerInterface *> (&am);
108 return (*this);
109 }
110
112 virtual bool loadBalance ()
113 {
114 return (am_) ? (am_->loadBalance()) : false;
115 }
116
118 virtual int balanceCounter () const
119 {
120 return (am_) ? (am_->balanceCounter()) : 0;
121 }
122
124 virtual double adaptationTime () const
125 {
126 return 0.0;
127 }
128
129 private:
132 };
133
135 template <class GridType>
137 {
138 public:
141 generic = 1,
142 callback = 2
143 };
144
146 static const int defaultMethod = 1;
147
148 public:
155 AdaptationMethod ( const GridType &grid,
156 const ParameterReader &parameter = Parameter::container(),
157 const bool noOutput = false )
159 {
160 const bool output = ( ! noOutput && Parameter :: verbose( Parameter ::parameterOutput ) && MPIManager::isMainThread() );
161 int am = defaultMethod;
162 const std::string methodNames [] = { "none", "generic", "callback" };
163 am = parameter.getEnum("fem.adaptation.method", methodNames, am);
164 init(am, output);
165 }
166 private:
167 void init(int am,const bool output)
168 {
169 // chose adaptation method
170 if(am == 2) adaptationMethod_ = callback;
171 else if(am == 1) adaptationMethod_ = generic;
172 else adaptationMethod_ = none;
173
174 // for structured grid adaptation is disabled
175 if( ! Capabilities::isLocallyAdaptive<GridType>::v )
176 {
178 if( output )
179 {
180 std::cerr << "WARNING: AdaptationMethod: adaptation disabled for structured grid!"<< std::endl;
181 }
182 }
183
184 static const bool noHierarchy = std::is_same< typename GridType::LevelGridView,
185 typename GridType::LeafGridView > :: value;
186 // for grids without hierarchy generic adaptation is disabled
187 // this is for example the case for P4estGrid. In this case we
188 // assume that Leaf and Level iterators (views) are the same
189 if( noHierarchy && (adaptationMethod_ == generic) )
190 {
192 if( output )
193 {
194 std::cerr << "WARNING: AdaptationMethod: hierarchy not implemented, switching from 'generic' to 'callback'!" << std::endl;
195 }
196 }
197
198 if( output )
199 {
200 std::cout << "Created AdaptationMethod: adaptation method = " << methodName() << std::endl;
201 }
202 }
203 public:
205 virtual ~AdaptationMethod () {}
206
208 virtual const char * methodName() const
209 {
210 switch (adaptationMethod_) {
211 case generic: return "generic";
212 case callback: return "callback";
213 case none: return "no adaptation";
214 default: return "unknown method";
215 }
216 }
217
219 virtual bool adaptive () const { return adaptationMethod_ != none; }
220
222 virtual bool isCallBackAdaptation() const { return adaptationMethod_ == callback; }
223
224 protected:
227 };
228
234 template <class GridType, class RestProlOperatorImp >
237 public ObjPointerStorage
238 {
240 typedef typename BaseType :: AdaptationMethodType AdaptationMethodType;
241
242 template <class AdaptManager, class GridImp, bool isGoodGrid>
243 struct CallAdaptationMethod
244 {
245 template <class DofManagerImp, class RPOpImp>
246 static void adapt(const AdaptManager& am, GridImp & grid,
247 DofManagerImp& dm , RPOpImp& rpop,
248 AdaptationMethodType adaptMethod)
249 {
250 // use generic adapt method
251 if( adaptMethod == BaseType :: generic )
252 {
253 am.template genericAdapt<All_Partition> ();
254 return ;
255 }
256
257 // use grid call back adapt method
258 if( adaptMethod == BaseType :: callback )
259 {
260 // combine dof manager and restrict prolong operator
261 typedef RestrictProlongWrapper< GridImp, DofManagerType, RPOpImp > RPType;
262
263 // create new handle
264 RPType restrictProlongHandle ( dm , rpop );
265
266 // reserve memory
267 restrictProlongHandle.initialize();
268
269 // call grid adaptation
270 grid.adapt( restrictProlongHandle );
271
272 // do compress (if not already called)
273 restrictProlongHandle.finalize();
274 return ;
275 }
276 }
277 };
278
279 template <class AdaptManager, class GridImp>
280 struct CallAdaptationMethod<AdaptManager,GridImp,false>
281 {
282 template <class DofManagerImp, class RPOpImp>
283 static void adapt(const AdaptManager& am, GridImp & grid,
284 DofManagerImp& dm , RPOpImp& rpop,
285 AdaptationMethodType adaptMethod)
286 {
287 // use generic adapt method
288 if(adaptMethod != BaseType :: none )
289 {
290 // use partition type All_Partition,
291 // since we also need to iterate on ghosts
292 // for wasChanged information gathering
293 am.template genericAdapt<All_Partition> ();
294 return ;
295 }
296 }
297 };
298
301
304
305 public:
306 typedef typename GridType :: Traits :: LocalIdSet LocalIdSet;
307
317 AdaptationManagerBase ( GridType &grid, RestProlOperatorImp &rpOp, const ParameterReader &parameter = Parameter::container() )
318 : BaseType( grid, parameter ),
319 grid_( grid ),
320 dm_( DofManagerType::instance( grid_ ) ),
321 rpOp_( rpOp ),
322 adaptTime_( 0.0 ),
323 wasChanged_( false )
324 {}
325
328
332 RestProlOperatorImp & getRestProlOp ()
333 {
334 return rpOp_;
335 }
336
344 virtual void adapt ()
345 {
346 // only call in single thread mode
347 if( ! Fem :: MPIManager :: singleThreadMode() )
348 {
349 assert( Fem :: MPIManager :: singleThreadMode() );
350 DUNE_THROW(InvalidStateException,"AdaptationManagerBase::adapt: only call in single thread mode!");
351 }
352
353 // get stopwatch
354 Dune::Timer timer;
355
356 const bool supportsCallback = Capabilities :: supportsCallbackAdaptation< GridType > :: v;
357 CallAdaptationMethod< ThisType, GridType, supportsCallback >
358 :: adapt(*this,grid_,dm_,rpOp_,this->adaptationMethod_);
359
360 // take time
361 adaptTime_ = timer.elapsed();
362 }
363
365 virtual bool loadBalance ()
366 {
367 return false;
368 }
369
371 virtual int balanceCounter () const
372 {
373 return 0;
374 }
375
377 virtual double adaptationTime() const
378 {
379 return adaptTime_;
380 }
381
382 protected:
383 static DofManagerType& getDofManager(const GridType& grid)
384 {
385 return DofManagerType :: instance( grid );
386 }
387
388 private:
394 template <PartitionIteratorType pitype>
395 void genericAdapt () const
396 {
397 // initialize restrict prolong operator (e.g. PetscRestrictProlong... )
398 rpOp_.initialize();
399
400 // call pre-adapt, returns true if at least
401 // one element is marked for coarsening
402 bool restr = grid_.preAdapt();
403
404 // get macro grid view
405 typedef typename GridType::LevelGridView MacroGridView;
406 typedef typename MacroGridView :: template Codim<0>::
407 template Partition<pitype> :: Iterator MacroIterator;
408
409 // reset flag
410 wasChanged_ = false ;
411
412 if(restr)
413 {
414
415 // get macro grid view
416 MacroGridView macroView = grid_.levelGridView( 0 );
417
418 // make a hierarchical to insert all elements
419 // that are father of elements that might be coarsened
420
421 {
422 // get macro iterator
423 MacroIterator endit = macroView.template end<0,pitype> ();
424 for(MacroIterator it = macroView.template begin<0,pitype>();
425 it != endit; ++it )
426 {
427 hierarchicRestrict( *it , dm_.indexSetRestrictProlongNoResize() );
428 }
429 }
430
431 // if at least one element was found for restriction
432 if( wasChanged_ )
433 {
434 // now resize memory
435 dm_.resizeForRestrict();
436
437 // now project all data to fathers
438 {
439 // get macro iterator
440 MacroIterator endit = macroView.template end<0,pitype> ();
441 for(MacroIterator it = macroView.template begin<0,pitype>();
442 it != endit; ++it )
443 {
444 hierarchicRestrict( *it , rpOp_ );
445 }
446 }
447 }
448 }
449
450 // adapt grid due to preset markers
451 // returns true if at least one element was refined
452 const bool refined = grid_.adapt();
453
454 // if coarsening or refinement was done
455 // adjust sizes
456 if( refined || restr )
457 {
458 // resizes the index sets (insert all new indices)
459 // and resizes the memory
460 dm_.resize();
461 }
462
463 // in case elements were created do prolongation
464 if( refined )
465 {
466 // get macro grid view
467 MacroGridView macroView = grid_.levelGridView( 0 );
468
469 // make run through grid to project data
470 MacroIterator endit = macroView.template end<0,pitype> ();
471 for(MacroIterator it = macroView.template begin<0,pitype>();
472 it != endit; ++it )
473 {
474 hierarchicProlong( *it , rpOp_ );
475 }
476 }
477
478 // notifyGlobalChange make wasChanged equal on all cores
479 if( dm_.notifyGlobalChange( wasChanged_ ) )
480 {
481 // compress index sets and data
482 // this will increase the sequence counter
483 dm_.compress();
484 }
485
486 // do cleanup
487 grid_.postAdapt();
488
489 // finalize restrict prolong operator (e.g. PetscRestrictProlong... )
490 rpOp_.finalize();
491 }
492
493 private:
495 template <class EntityType, class RestrictOperatorType >
496 bool hierarchicRestrict ( const EntityType& entity, RestrictOperatorType & restop ) const
497 {
498 if( ! entity.isLeaf() )
499 {
500 // true means we are going to restrict data
501 bool doRestrict = true;
502
503 // check partition type
504 const bool isGhost = entity.partitionType() == GhostEntity ;
505
506 // if the children have children then we have to go deeper
507 const int childLevel = entity.level() + 1;
508 typedef typename EntityType::HierarchicIterator HierarchicIterator;
509
510 // check all children first
511 {
512 const HierarchicIterator endit = entity.hend( childLevel );
513 for(HierarchicIterator it = entity.hbegin( childLevel ); it != endit; ++it)
514 {
515 doRestrict &= hierarchicRestrict( *it , restop );
516 }
517 }
518
519 // if doRestrict is still true, restrict data
520 if(doRestrict)
521 {
522 // we did at least one restriction
523 wasChanged_ = true;
524
525 // do not restrict the solution on ghosts, this will
526 // fail, but we still need the wasChanged info, so simply
527 // calling hierarchicRestrict on interior won't work either
528 if( ! isGhost )
529 {
530 // true for first child, otherwise false
531 bool initialize = true;
532 const HierarchicIterator endit = entity.hend( childLevel );
533 for(HierarchicIterator it = entity.hbegin( childLevel ); it != endit; ++it)
534 {
535 // restrict solution
536 restop.restrictLocal( entity, *it , initialize);
537 // reset initialize flag
538 initialize = false;
539 }
540 restop.restrictFinalize(entity);
541 }
542 }
543 }
544
545 // if all children return mightBeCoarsened,
546 // then doRestrict on father remains true
547 return entity.mightVanish();
548 }
549
550 template <class EntityType, class ProlongOperatorType >
551 void hierarchicProlong ( const EntityType &entity, ProlongOperatorType & prolop ) const
552 {
553 typedef typename EntityType::HierarchicIterator HierarchicIterator;
554
555 // NOTE: initialize not working here
556 // because we call hierarchically
557
558 // first call on this element
559 bool initialize = true;
560
561 // check partition type
562 const bool isGhost = entity.partitionType() == GhostEntity ;
563
564 const int maxLevel = grid_.maxLevel();
565 const HierarchicIterator endit = entity.hend( maxLevel );
566 for( HierarchicIterator it = entity.hbegin( maxLevel ); it != endit; ++it )
567 {
568 // should only get here on non-leaf entities
569 assert( !entity.isLeaf() );
570
571 const EntityType & son = *it;
572 if( son.isNew() )
573 {
574 // the grid was obviously changed if we get here
575 wasChanged_ = true ;
576
577 // do not prolong the solution on ghosts, this will
578 // fail, but we still need the wasChanged info, so simply
579 // calling hierarchicRestrict on interior won't work either
580 if( ! isGhost )
581 {
582 EntityType vati = son.father();
583 prolop.prolongLocal( vati , son , initialize );
584 initialize = false;
585 }
586 }
587 }
588 }
589
590 protected:
592 GridType &grid_;
593
596
598 RestProlOperatorImp &rpOp_;
599
602
604 mutable bool wasChanged_;
605 };
606
608 template <class KeyType, class ObjectType>
610 {
611 static ObjectType* createObject(const KeyType& key)
612 {
613 return new ObjectType(0);
614 }
615 static void deleteObject(ObjectType* obj)
616 {
617 delete obj;
618 }
619 };
620
626 template <class GridType, class RestProlOperatorImp>
631 {
632 // type of key
633 typedef const GridType* KeyType;
634 // object type
635 typedef size_t ObjectType;
636 // type of factory
638
639 // type of singleton list
641
644
645 using BaseType :: rpOp_;
646
647 // reference counter to ensure only one instance per grid exists
648 ObjectType& referenceCounter_;
649
650 // do not copy
652
653 public:
672 AdaptationManager ( GridType &grid, RestProlOperatorImp &rpOp, int balanceCounter, const ParameterReader &parameter = Parameter::container() )
673 : BaseType(grid,rpOp, parameter)
674 , Base2Type( grid, rpOp )
675 , referenceCounter_( ProviderType :: getObject( &grid ) )
676 , balanceStep_( parameter.getValue< int >( "fem.loadbalancing.step", 1 ) )
677 , balanceCounter_( balanceCounter )
678 {
679 if( ++referenceCounter_ > 1 )
680 DUNE_THROW(InvalidStateException,"Only one instance of AdaptationManager allowed per grid instance");
681 if( Parameter::verbose( Parameter::parameterOutput ) )
682 std::cout << "Created LoadBalancer: balanceStep = " << balanceStep_ << std::endl;
683 }
684
702 AdaptationManager ( GridType &grid, RestProlOperatorImp &rpOp, const ParameterReader &parameter = Parameter::container() )
703 : AdaptationManager( grid, rpOp, 0, parameter )
704 {
705 }
706
709 {
710 -- referenceCounter_;
711 ProviderType :: removeObject( referenceCounter_ );
712 }
713
715 virtual bool loadBalance ()
716 {
717 // same as for the adapt method
718 rpOp_.initialize () ;
719
720 // call load balance
721 const bool result = Base2Type :: loadBalance( );
722
723 // finalize rp object (mostly RestrictProlongDefault for PetscDF)
724 rpOp_.finalize () ;
725 return result ;
726 }
727
729 virtual double loadBalanceTime() const
730 {
731 return Base2Type::loadBalanceTime();
732 }
733
735 virtual void adapt ()
736 {
737 // adapt grid
738 BaseType :: adapt ();
739
740 // if adaptation is enabled
741 if( this->adaptive() && (balanceStep_ > 0) )
742 {
743 // if balance counter has readed balanceStep do load balance
744 const bool callBalance = (++balanceCounter_ >= balanceStep_);
745
746#ifndef NDEBUG
747 // make sure load balance is called on every process
748 int willCall = (callBalance) ? 1 : 0;
749 const int iCall = willCall;
750
751 // send info from rank 0 to all other
752 Base2Type::grid_.comm().broadcast(&willCall, 1 , 0);
753
754 assert( willCall == iCall );
755#endif
756
757 if( callBalance )
758 {
759 // balance work load and restore consistency in the data
760 loadBalance();
761 balanceCounter_ = 0;
762 }
763 else
764 {
765 // only restore consistency in the data
766 Base2Type::communicate();
767 }
768 }
769 }
770
772 int balanceCounter () const { return balanceCounter_; }
773
775 void backup() const
776 {
777 std::tuple<const int& > value( balanceCounter_ );
778 PersistenceManager::backupValue("loadbalancer",value);
779 }
780
782 void restore()
783 {
784 std::tuple< int& > value( balanceCounter_ );
785 PersistenceManager::restoreValue("loadbalancer",value);
786 }
787
788 private:
789 // call loadBalance ervery balanceStep_ step
790 const int balanceStep_ ;
791 // count actual balance call
792 int balanceCounter_;
793 };
794
795 namespace hpDG
796 {
797
798 // AdaptationManager
799 // -----------------
800
808 template< class DiscreteFunctionSpace, class DataProjection >
811 {
813
814 public:
819
820 private:
821 using GridType = typename DiscreteFunctionSpaceType::GridType;
823
824 class DataProjectionWrapper;
825
826 public:
831 explicit AdaptationManager ( DiscreteFunctionSpaceType &space, DataProjectionType &&dataProjection )
832 : space_( space ),
833 dataProjection_( std::forward< DataProjectionType >( dataProjection ) ),
834 dofManager_( DofManagerType::instance( space.gridPart().grid() ) ),
835 commList_( dataProjection_ ),
836 time_( 0. )
837 {}
838
846 AdaptationManager ( const ThisType & ) = delete;
847
849 ThisType &operator= ( const ThisType & ) = delete;
850
858 bool adaptive () const { return true; }
859
861 void adapt ()
862 {
863 // only call in single thread mode
864 if( ! Fem :: MPIManager :: singleThreadMode() )
865 {
866 assert( Fem :: MPIManager :: singleThreadMode() );
867 DUNE_THROW(InvalidStateException,"AdaptationManager::adapt: only call in single thread mode!");
868 }
869
870 Dune::Timer timer;
871
872 DataProjectionWrapper wrapper( dataProjection_, dofManager() );
873 space().adapt( wrapper );
874
875 if( dofManager().notifyGlobalChange( static_cast< bool >( wrapper ) ) )
876 dofManager().compress();
877
878 commList_.exchange();
879
880 time_ = timer.elapsed();
881 }
882
884 const char *methodName () const { return "discrete function space adaptation"; }
885
887 double adaptationTime () const { return time_; }
888
896 bool loadBalance () { return false; }
897
899 int balanceCounter () const { return 0; }
900
902 double loadBalanceTime () const { return 0.; }
903
906 DataProjection& dataProjection() { return dataProjection_; }
907 private:
908 DiscreteFunctionSpaceType &space () { return space_.get(); }
909
910 const DiscreteFunctionSpaceType &space () const { return space_.get(); }
911
912 DofManagerType &dofManager () { return dofManager_.get(); }
913
914 const DofManagerType &dofManager () const { return dofManager_.get(); }
915
916 std::reference_wrapper< DiscreteFunctionSpaceType > space_;
917 DataProjectionType dataProjection_;
918 std::reference_wrapper< DofManagerType > dofManager_;
919 mutable CommunicationManagerList commList_;
920 double time_;
921 };
922
923 // AdaptationManager::DataProjectionWrapper
924 // ----------------------------------------
925
926 template< class DiscreteFunctionSpace, class DataProjection >
927 class AdaptationManager< DiscreteFunctionSpace, DataProjection >::DataProjectionWrapper
929 {
931
932 public:
933 using BasisFunctionSetType = typename BaseType::BasisFunctionSetType;
934 using EntityType = typename BaseType::EntityType;
935
936 DataProjectionWrapper ( DataProjectionType &dataProjection, DofManagerType &dofManager )
937 : dataProjection_( dataProjection ),
938 dofManager_( dofManager ),
939 modified_( false )
940 {}
941
942 void operator() ( const EntityType &entity,
943 const BasisFunctionSetType &prior,
944 const BasisFunctionSetType &present,
945 const std::vector< std::size_t > &origin,
946 const std::vector< std::size_t > &destination )
947 {
948 dofManager_.get().resizeMemory();
949 dataProjection_.get()( entity, prior, present, origin, destination );
950 modified_ = true;
951 }
952
953 template <class TemporaryStorage>
954 void operator() ( TemporaryStorage& tmp )
955 {
956 dataProjection_.get()( tmp );
957 modified_ = true;
958 }
959
960 explicit operator bool () const
961 {
962 return modified_;
963 }
964
965 private:
966 std::reference_wrapper< DataProjectionType > dataProjection_;
967 std::reference_wrapper< DofManagerType > dofManager_;
968 bool modified_;
969 };
970
971 } // namespace hpDG
972
973
974
981 {
987 template <class GridType>
988 static void apply(GridType& grid, const int step)
989 {
990 typedef DofManager< GridType > DofManagerType;
991 DofManagerType& dm = DofManagerType :: instance(grid);
992 grid.globalRefine(step);
993 grid.loadBalance();
994 dm.resize();
995 dm.compress();
996 }
997 };
1005 {
1010 template <class GridType>
1011 static void apply(GridType& grid)
1012 {
1013 typedef DofManager< GridType > DofManagerType;
1014 DofManagerType& dm = DofManagerType :: instance(grid);
1015 grid.preAdapt();
1016 grid.adapt();
1017 grid.postAdapt();
1018 grid.loadBalance();
1019 dm.resize();
1020 dm.compress();
1021 }
1022 };
1023
1026 } // namespace Fem
1027
1028} // namespace Dune
1029
1030#endif // #ifndef DUNE_FEM_ADAPTMANAGER_HH
interfaces and wrappers needed for the callback adaptation provided by AlbertaGrid and ALUGrid
discrete function space
This class manages the adaptation process. If the method adapt is called, then the grid is adapted an...
Definition: adaptationmanager.hh:238
virtual int balanceCounter() const
default load balancing counter is zero
Definition: adaptationmanager.hh:371
virtual ~AdaptationManagerBase()
destructor
Definition: adaptationmanager.hh:327
AdaptationManagerBase(GridType &grid, RestProlOperatorImp &rpOp, const ParameterReader &parameter=Parameter::container())
constructor of AdaptationManagerBase The following optional parameter can be used
Definition: adaptationmanager.hh:317
double adaptTime_
time that adaptation took
Definition: adaptationmanager.hh:601
GridType & grid_
corresponding grid
Definition: adaptationmanager.hh:592
bool wasChanged_
flag for restriction
Definition: adaptationmanager.hh:604
RestProlOperatorImp & rpOp_
Restriction and Prolongation Operator.
Definition: adaptationmanager.hh:598
virtual bool loadBalance()
default load balancing method which does nothing
Definition: adaptationmanager.hh:365
virtual double adaptationTime() const
time that last adaptation cycle took
Definition: adaptationmanager.hh:377
virtual void adapt()
according to adaption method parameter the adaption procedure is done, 0 == no adaptation 1 == generi...
Definition: adaptationmanager.hh:344
RestProlOperatorImp & getRestProlOp()
Definition: adaptationmanager.hh:332
DofManagerType & dm_
DofManager corresponding to grid.
Definition: adaptationmanager.hh:595
AdaptationManagerInterface class.
Definition: adaptationmanager.hh:61
virtual double adaptationTime() const
time that last adaptation cycle took
Definition: adaptationmanager.hh:124
virtual const char * methodName() const
returns name of adaptation method
Definition: adaptationmanager.hh:96
virtual void adapt()
on call of this method the internal adaptation operator is called.
Definition: adaptationmanager.hh:72
virtual bool adaptive() const
returns true if adaptation manager as adaptation method different to NONE
Definition: adaptationmanager.hh:85
virtual ~AdaptationManagerInterface()
destructor
Definition: adaptationmanager.hh:67
virtual bool loadBalance()
call load balance, returns true if grid was changed
Definition: adaptationmanager.hh:112
AdaptationManagerInterface()
default constructor
Definition: adaptationmanager.hh:64
AdaptationManagerInterface & operator=(const AdaptationManagerInterface &am)
Assignment operator, pointer to adaptation manager is stored.
Definition: adaptationmanager.hh:104
virtual int balanceCounter() const
Definition: adaptationmanager.hh:118
virtual bool isCallBackAdaptation() const
return true if callback adaptation is used.
Definition: adaptationmanager.hh:91
This class manages the adaptation process including a load balancing after the adaptation step....
Definition: adaptationmanager.hh:631
int balanceCounter() const
returns actual balanceCounter for checkpointing
Definition: adaptationmanager.hh:772
void restore()
retore internal data
Definition: adaptationmanager.hh:782
AdaptationManager(GridType &grid, RestProlOperatorImp &rpOp, int balanceCounter, const ParameterReader &parameter=Parameter::container())
constructor of AdaptationManager
Definition: adaptationmanager.hh:672
virtual double loadBalanceTime() const
time that last load balance cycle took
Definition: adaptationmanager.hh:729
void backup() const
backup internal data
Definition: adaptationmanager.hh:775
virtual bool loadBalance()
call load balance, returns true if grid was changed
Definition: adaptationmanager.hh:715
virtual void adapt()
on call of this method the internal adaptation operator is called.
Definition: adaptationmanager.hh:735
AdaptationManager(GridType &grid, RestProlOperatorImp &rpOp, const ParameterReader &parameter=Parameter::container())
constructor of AdaptationManager
Definition: adaptationmanager.hh:702
~AdaptationManager()
destructor decreasing reference counter
Definition: adaptationmanager.hh:708
AdaptationMethod is a simple adaptation method reader class.
Definition: adaptationmanager.hh:137
virtual ~AdaptationMethod()
virtual destructor
Definition: adaptationmanager.hh:205
AdaptationMethodType adaptationMethod_
method identifier
Definition: adaptationmanager.hh:226
virtual const char * methodName() const
returns name of adaptation method
Definition: adaptationmanager.hh:208
virtual bool adaptive() const
returns true if adaptation manager as adaptation method different to NONE
Definition: adaptationmanager.hh:219
AdaptationMethod(const GridType &grid, const ParameterReader &parameter=Parameter::container(), const bool noOutput=false)
constructor of AdaptationMethod The following optional parameters are used
Definition: adaptationmanager.hh:155
AdaptationMethodType
type of adaptation method
Definition: adaptationmanager.hh:140
@ none
no adaptation is performed
Definition: adaptationmanager.hh:140
@ generic
a generic restriction and prolongation algorithm is used
Definition: adaptationmanager.hh:141
@ callback
the callback mechanism from AlbertaGrid and ALUGrid is used
Definition: adaptationmanager.hh:142
static const int defaultMethod
default method is generic
Definition: adaptationmanager.hh:146
virtual bool isCallBackAdaptation() const
return true if callback adaptation is used.
Definition: adaptationmanager.hh:222
base class for auto persistent objects
Definition: persistencemanager.hh:580
GridPartType::GridType GridType
type of underlying dune grid
Definition: discretefunctionspace.hh:214
Definition: dofmanager.hh:786
Interface class for load balancing.
Definition: loadbalancer.hh:37
This class manages the adaptation process. If the method adapt is called, then the grid is adapted an...
Definition: loadbalancer.hh:66
Definition: objpointer.hh:42
static bool verbose()
obtain the cached value for fem.verbose with default verbosity level 2
Definition: parameter.hh:466
base class for persistent objects
Definition: persistencemanager.hh:101
Singleton list for key/object pairs.
Definition: singletonlist.hh:53
Manages the testriction and prolongation of discrete functions in -adaptive computations.
Definition: adaptationmanager.hh:811
void adapt()
perform adaptation
Definition: adaptationmanager.hh:861
int balanceCounter() const
please doc me
Definition: adaptationmanager.hh:899
bool adaptive() const
returns true
Definition: adaptationmanager.hh:858
AdaptationManager(const ThisType &)=delete
Deleted methods.
double adaptationTime() const
return time spent on adaptation
Definition: adaptationmanager.hh:887
bool loadBalance()
please doc me
Definition: adaptationmanager.hh:896
const char * methodName() const
return name of adaptation method
Definition: adaptationmanager.hh:884
double loadBalanceTime() const
please doc me
Definition: adaptationmanager.hh:902
Abstract definition of the local restriction and prolongation of discrete functions.
Definition: dataprojection.hh:29
Default exception if a function was called while the object is not in a valid state for that function...
Definition: exceptions.hh:281
A simple stop watch.
Definition: timer.hh:43
double elapsed() const noexcept
Get elapsed user-time from last reset until now/last stop in seconds.
Definition: timer.hh:77
#define DUNE_THROW(E, m)
Definition: exceptions.hh:218
@ GhostEntity
ghost entities
Definition: gridenums.hh:35
constexpr GeometryType none(unsigned int dim)
Returns a GeometryType representing a singular of dimension dim.
Definition: type.hh:471
Dune namespace.
Definition: alignedallocator.hh:13
STL namespace.
factory class to create adaptation manager reference counter
Definition: adaptationmanager.hh:610
A class with one static method apply to globally refine a grid. All index sets are adapted to the new...
Definition: adaptationmanager.hh:981
static void apply(GridType &grid, const int step)
apply global refinement and also adjust index sets and managed dof storage. However,...
Definition: adaptationmanager.hh:988
A class with one static method apply for invoking the local adaptation procedure on a given grid inst...
Definition: adaptationmanager.hh:1005
static void apply(GridType &grid)
apply local refinement and also adjust index sets and managed dof storage. However,...
Definition: adaptationmanager.hh:1011
A simple timing class.
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Jul 24, 22:29, 2024)