dune-fem  2.8-git
adaptationmanager.hh
Go to the documentation of this file.
1 #ifndef DUNE_FEM_ADAPTATIONMANAGER_HH
2 #define DUNE_FEM_ADAPTATIONMANAGER_HH
3 
4 //- system includes
5 #include <string>
6 
7 //- local includes
8 #include <dune/common/timer.hh>
11 
17 
19 #include <dune/fem/io/parameter.hh>
22 
24 
25 namespace Dune
26 {
27 
28  namespace Fem
29  {
30 
60  {
61  public:
64 
67 
71  virtual void adapt ()
72  {
73  //std::cout << "called AdaptationManagerInterface::adapt()" << std::endl;
74  if(am_) am_->adapt();
75  else
76  {
77  std::cerr << "WARNING: AdaptationManagerInterface::adapt: no adaptation manager assigned! \n";
78  }
79  }
80 
84  virtual bool adaptive () const
85  {
86  return (am_) ? (am_->adaptive()) : false;
87  }
88 
92  virtual const char * methodName() const
93  {
94  return (am_) ? (am_->methodName()) : "unknown method";
95  }
96 
101  {
103  am_ = const_cast<AdaptationManagerInterface *> (&am);
104  return (*this);
105  }
106 
108  virtual bool loadBalance ()
109  {
110  return (am_) ? (am_->loadBalance()) : false;
111  }
112 
114  virtual int balanceCounter () const
115  {
116  return (am_) ? (am_->balanceCounter()) : 0;
117  }
118 
120  virtual double adaptationTime () const
121  {
122  return 0.0;
123  }
124 
125  private:
128  };
129 
131  template <class GridType>
133  {
134  public:
137  generic = 1,
138  callback = 2
139  };
140 
141  public:
149  AdaptationMethod ( const GridType &grid, const ParameterReader &parameter = Parameter::container() )
151  {
152  const bool output = ( Parameter :: verbose() && ThreadManager::isMaster() );
153  int am = 1;
154  const std::string methodNames [] = { "none", "generic", "callback" };
155  am = parameter.getEnum("fem.adaptation.method", methodNames, am);
156  init(am,output);
157  }
158  private:
159  void init(int am,const bool output)
160  {
161 
162  // chose adaptation method
163  if(am == 2) adaptationMethod_ = callback;
164  else if(am == 1) adaptationMethod_ = generic;
165  else adaptationMethod_ = none;
166 
167  // for structred grid adaptation is disabled
169  {
171  if( output )
172  {
173  std::cerr << "WARNING: AdaptationMethod: adaptation disabled for structured grid! \n";
174  }
175  }
176 
177  if( output )
178  {
179  std::cout << "Created AdaptationMethod: adaptation method = " << methodName() << std::endl;
180  }
181  }
182  public:
184  virtual ~AdaptationMethod () {}
185 
187  virtual const char * methodName() const
188  {
189  switch (adaptationMethod_) {
190  case generic: return "generic";
191  case callback: return "callback";
192  case none: return "no adaptation";
193  default: return "unknown method";
194  }
195  }
196 
198  virtual bool adaptive () const { return adaptationMethod_ != none; }
199 
200  protected:
203  };
204 
210  template <class GridType, class RestProlOperatorImp >
213  public ObjPointerStorage
214  {
216  typedef typename BaseType :: AdaptationMethodType AdaptationMethodType;
217 
218  template <class AdaptManager, class GridImp, bool isGoodGrid>
219  struct CallAdaptationMethod
220  {
221  template <class DofManagerImp, class RPOpImp>
222  static void adapt(const AdaptManager& am, GridImp & grid,
223  DofManagerImp& dm , RPOpImp& rpop,
224  AdaptationMethodType adaptMethod)
225  {
226  // use generic adapt method
227  if( adaptMethod == BaseType :: generic )
228  {
229  am.template genericAdapt<All_Partition> ();
230  return ;
231  }
232 
233  // use grid call back adapt method
234  if( adaptMethod == BaseType :: callback )
235  {
236  // combine dof manager and restrict prolong operator
238 
239  // create new handle
240  RPType restrictProlongHandle ( dm , rpop );
241 
242  // reserve memory
243  restrictProlongHandle.initialize();
244 
245  // call grid adaptation
246  grid.adapt( restrictProlongHandle );
247 
248  // do compress (if not already called)
249  restrictProlongHandle.finalize();
250  return ;
251  }
252  }
253  };
254 
255  template <class AdaptManager, class GridImp>
256  struct CallAdaptationMethod<AdaptManager,GridImp,false>
257  {
258  template <class DofManagerImp, class RPOpImp>
259  static void adapt(const AdaptManager& am, GridImp & grid,
260  DofManagerImp& dm , RPOpImp& rpop,
261  AdaptationMethodType adaptMethod)
262  {
263  // use generic adapt method
264  if(adaptMethod != BaseType :: none )
265  {
266  // use partition type All_Partition,
267  // since we also need to iterate on ghosts
268  // for wasChanged information gathering
269  am.template genericAdapt<All_Partition> ();
270  return ;
271  }
272  }
273  };
274 
277 
280 
281  public:
282  typedef typename GridType :: Traits :: LocalIdSet LocalIdSet;
283 
293  AdaptationManagerBase ( GridType &grid, RestProlOperatorImp &rpOp, const ParameterReader &parameter = Parameter::container() )
294  : BaseType( grid, parameter ),
295  grid_( grid ),
296  dm_( DofManagerType::instance( grid_ ) ),
297  rpOp_( rpOp ),
298  adaptTime_( 0.0 ),
299  wasChanged_( false )
300  {}
301 
304 
308  RestProlOperatorImp & getRestProlOp ()
309  {
310  return rpOp_;
311  }
312 
320  virtual void adapt ()
321  {
322  // make sure this is only called in single thread mode
323  assert( Fem :: ThreadManager :: singleThreadMode() );
324 
325  // get stopwatch
326  Dune::Timer timer;
327 
328  const bool supportsCallback = Capabilities :: supportsCallbackAdaptation< GridType > :: v;
329  CallAdaptationMethod< ThisType, GridType, supportsCallback >
330  :: adapt(*this,grid_,dm_,rpOp_,this->adaptationMethod_);
331 
332  // take time
333  adaptTime_ = timer.elapsed();
334  }
335 
337  virtual bool loadBalance ()
338  {
339  return false;
340  }
341 
343  virtual int balanceCounter () const
344  {
345  return 0;
346  }
347 
349  virtual double adaptationTime() const
350  {
351  return adaptTime_;
352  }
353 
354  protected:
355  static DofManagerType& getDofManager(const GridType& grid)
356  {
357  return DofManagerType :: instance( grid );
358  }
359 
360  private:
366  template <PartitionIteratorType pitype>
367  void genericAdapt () const
368  {
369  // initialize restrict prolong operator (e.g. PetscRestrictProlong... )
370  rpOp_.initialize();
371 
372  // call pre-adapt, returns true if at least
373  // one element is marked for coarsening
374  bool restr = grid_.preAdapt();
375 
376  // get macro grid view
377  typedef typename GridType::LevelGridView MacroGridView;
378  typedef typename MacroGridView :: template Codim<0>::
379  template Partition<pitype> :: Iterator MacroIterator;
380 
381  // reset flag
382  wasChanged_ = false ;
383 
384  if(restr)
385  {
386 
387  // get macro grid view
388  MacroGridView macroView = grid_.levelGridView( 0 );
389 
390  // make a hierarchical to insert all elements
391  // that are father of elements that might be coarsened
392 
393  {
394  // get macro iterator
395  MacroIterator endit = macroView.template end<0,pitype> ();
396  for(MacroIterator it = macroView.template begin<0,pitype>();
397  it != endit; ++it )
398  {
399  hierarchicRestrict( *it , dm_.indexSetRestrictProlongNoResize() );
400  }
401  }
402 
403  // if at least one element was found for restriction
404  if( wasChanged_ )
405  {
406  // now resize memory
407  dm_.resizeForRestrict();
408 
409  // now project all data to fathers
410  {
411  // get macro iterator
412  MacroIterator endit = macroView.template end<0,pitype> ();
413  for(MacroIterator it = macroView.template begin<0,pitype>();
414  it != endit; ++it )
415  {
416  hierarchicRestrict( *it , rpOp_ );
417  }
418  }
419  }
420  }
421 
422  // adapt grid due to preset markers
423  // returns true if at least one element was refined
424  const bool refined = grid_.adapt();
425 
426  // if coarsening or refinement was done
427  // adjust sizes
428  if( refined || restr )
429  {
430  // resizes the index sets (insert all new indices)
431  // and resizes the memory
432  dm_.resize();
433  }
434 
435  // in case elements were created do prolongation
436  if( refined )
437  {
438  // get macro grid view
439  MacroGridView macroView = grid_.levelGridView( 0 );
440 
441  // make run through grid to project data
442  MacroIterator endit = macroView.template end<0,pitype> ();
443  for(MacroIterator it = macroView.template begin<0,pitype>();
444  it != endit; ++it )
445  {
446  hierarchicProlong( *it , rpOp_ );
447  }
448  }
449 
450  // notifyGlobalChange make wasChanged equal on all cores
451  if( dm_.notifyGlobalChange( wasChanged_ ) )
452  {
453  // compress index sets and data
454  // this will increase the sequence counter
455  dm_.compress();
456  }
457 
458  // do cleanup
459  grid_.postAdapt();
460 
461  // finalize restrict prolong operator (e.g. PetscRestrictProlong... )
462  rpOp_.finalize();
463  }
464 
465  private:
467  template <class EntityType, class RestrictOperatorType >
468  bool hierarchicRestrict ( const EntityType& entity, RestrictOperatorType & restop ) const
469  {
470  if( ! entity.isLeaf() )
471  {
472  // true means we are going to restrict data
473  bool doRestrict = true;
474 
475  // check partition type
476  const bool isGhost = entity.partitionType() == GhostEntity ;
477 
478  // if the children have children then we have to go deeper
479  const int childLevel = entity.level() + 1;
480  typedef typename EntityType::HierarchicIterator HierarchicIterator;
481 
482  // check all children first
483  {
484  const HierarchicIterator endit = entity.hend( childLevel );
485  for(HierarchicIterator it = entity.hbegin( childLevel ); it != endit; ++it)
486  {
487  doRestrict &= hierarchicRestrict( *it , restop );
488  }
489  }
490 
491  // if doRestrict is still true, restrict data
492  if(doRestrict)
493  {
494  // we did at least one restriction
495  wasChanged_ = true;
496 
497  // do not restrict the solution on ghosts, this will
498  // fail, but we still need the wasChanged info, so simply
499  // calling hierarchicRestrict on interior won't work either
500  if( ! isGhost )
501  {
502  // true for first child, otherwise false
503  bool initialize = true;
504  const HierarchicIterator endit = entity.hend( childLevel );
505  for(HierarchicIterator it = entity.hbegin( childLevel ); it != endit; ++it)
506  {
507  // restrict solution
508  restop.restrictLocal( entity, *it , initialize);
509  // reset initialize flag
510  initialize = false;
511  }
512  restop.restrictFinalize(entity);
513  }
514  }
515  }
516 
517  // if all children return mightBeCoarsened,
518  // then doRestrict on father remains true
519  return entity.mightVanish();
520  }
521 
522  template <class EntityType, class ProlongOperatorType >
523  void hierarchicProlong ( const EntityType &entity, ProlongOperatorType & prolop ) const
524  {
525  typedef typename EntityType::HierarchicIterator HierarchicIterator;
526 
527  // NOTE: initialize not working here
528  // because we call hierarchically
529 
530  // first call on this element
531  bool initialize = true;
532 
533  // check partition type
534  const bool isGhost = entity.partitionType() == GhostEntity ;
535 
536  const int maxLevel = grid_.maxLevel();
537  const HierarchicIterator endit = entity.hend( maxLevel );
538  for( HierarchicIterator it = entity.hbegin( maxLevel ); it != endit; ++it )
539  {
540  // should only get here on non-leaf entities
541  assert( !entity.isLeaf() );
542 
543  const EntityType & son = *it;
544  if( son.isNew() )
545  {
546  // the grid was obviously changed if we get here
547  wasChanged_ = true ;
548 
549  // do not prolong the solution on ghosts, this will
550  // fail, but we still need the wasChanged info, so simply
551  // calling hierarchicRestrict on interior won't work either
552  if( ! isGhost )
553  {
554  EntityType vati = son.father();
555  prolop.prolongLocal( vati , son , initialize );
556  initialize = false;
557  }
558  }
559  }
560  }
561 
562  protected:
564  GridType &grid_;
565 
568 
570  RestProlOperatorImp &rpOp_;
571 
573  double adaptTime_;
574 
576  mutable bool wasChanged_;
577  };
578 
580  template <class KeyType, class ObjectType>
582  {
583  static ObjectType* createObject(const KeyType& key)
584  {
585  return new ObjectType(0);
586  }
587  static void deleteObject(ObjectType* obj)
588  {
589  delete obj;
590  }
591  };
592 
598  template <class GridType, class RestProlOperatorImp>
601  public LoadBalancer<GridType>,
602  public AutoPersistentObject
603  {
604  // type of key
605  typedef const GridType* KeyType;
606  // object type
607  typedef size_t ObjectType;
608  // type of factory
610 
611  // type of singleton list
613 
616 
617  using BaseType :: rpOp_;
618 
619  // reference counter to ensure only one instance per grid exists
620  ObjectType& referenceCounter_;
621 
622  // do not copy
624 
625  public:
644  AdaptationManager ( GridType &grid, RestProlOperatorImp &rpOp, int balanceCounter, const ParameterReader &parameter = Parameter::container() )
645  : BaseType(grid,rpOp, parameter)
646  , Base2Type( grid, rpOp )
647  , referenceCounter_( ProviderType :: getObject( &grid ) )
648  , balanceStep_( parameter.getValue< int >( "fem.loadbalancing.step", 1 ) )
649  , balanceCounter_( balanceCounter )
650  {
651  if( ++referenceCounter_ > 1 )
652  DUNE_THROW(InvalidStateException,"Only one instance of AdaptationManager allowed per grid instance");
653  if( Parameter::verbose() )
654  std::cout << "Created LoadBalancer: balanceStep = " << balanceStep_ << std::endl;
655  }
656 
674  AdaptationManager ( GridType &grid, RestProlOperatorImp &rpOp, const ParameterReader &parameter = Parameter::container() )
675  : AdaptationManager( grid, rpOp, 0, parameter )
676  {
677  }
678 
681  {
682  -- referenceCounter_;
683  ProviderType :: removeObject( referenceCounter_ );
684  }
685 
687  virtual bool loadBalance ()
688  {
689  // same as for the adapt method
690  rpOp_.initialize () ;
691 
692  // call load balance
693  const bool result = Base2Type :: loadBalance( );
694 
695  // finalize rp object (mostly RestrictProlongDefault for PetscDF)
696  rpOp_.finalize () ;
697  return result ;
698  }
699 
701  virtual double loadBalanceTime() const
702  {
703  return Base2Type::loadBalanceTime();
704  }
705 
707  virtual void adapt ()
708  {
709  // adapt grid
710  BaseType :: adapt ();
711 
712  // if adaptation is enabled
713  if( this->adaptive() && (balanceStep_ > 0) )
714  {
715  // if balance counter has readed balanceStep do load balance
716  const bool callBalance = (++balanceCounter_ >= balanceStep_);
717 
718 #ifndef NDEBUG
719  // make sure load balance is called on every process
720  int willCall = (callBalance) ? 1 : 0;
721  const int iCall = willCall;
722 
723  // send info from rank 0 to all other
724  Base2Type::grid_.comm().broadcast(&willCall, 1 , 0);
725 
726  assert( willCall == iCall );
727 #endif
728 
729  if( callBalance )
730  {
731  // balance work load and restore consistency in the data
732  loadBalance();
733  balanceCounter_ = 0;
734  }
735  else
736  {
737  // only restore consistency in the data
738  Base2Type::communicate();
739  }
740  }
741  }
742 
744  int balanceCounter () const { return balanceCounter_; }
745 
747  void backup() const
748  {
749  std::tuple<const int& > value( balanceCounter_ );
750  PersistenceManager::backupValue("loadbalancer",value);
751  }
752 
754  void restore()
755  {
756  std::tuple< int& > value( balanceCounter_ );
757  PersistenceManager::restoreValue("loadbalancer",value);
758  }
759 
760  private:
761  // call loadBalance ervery balanceStep_ step
762  const int balanceStep_ ;
763  // count actual balance call
764  int balanceCounter_;
765  };
766 
767  namespace hpDG
768  {
769 
770  // AdaptationManager
771  // -----------------
772 
780  template< class DiscreteFunctionSpace, class DataProjection >
783  {
785 
786  public:
791 
792  private:
793  using GridType = typename DiscreteFunctionSpaceType::GridType;
795 
796  class DataProjectionWrapper;
797 
798  public:
803  explicit AdaptationManager ( DiscreteFunctionSpaceType &space, DataProjectionType &&dataProjection )
804  : space_( space ),
805  dataProjection_( std::forward< DataProjectionType >( dataProjection ) ),
806  dofManager_( DofManagerType::instance( space.gridPart().grid() ) ),
807  commList_( dataProjection_ ),
808  time_( 0. )
809  {}
810 
818  AdaptationManager ( const ThisType & ) = delete;
819 
821  ThisType &operator= ( const ThisType & ) = delete;
822 
830  bool adaptive () const { return true; }
831 
833  void adapt ()
834  {
836 
837  Dune::Timer timer;
838 
839  DataProjectionWrapper wrapper( dataProjection_, dofManager() );
840  space().adapt( wrapper );
841 
842  if( dofManager().notifyGlobalChange( static_cast< bool >( wrapper ) ) )
843  dofManager().compress();
844 
845  commList_.exchange();
846 
847  time_ = timer.elapsed();
848  }
849 
851  const char *methodName () const { return "discrete function space adaptation"; }
852 
854  double adaptationTime () const { return time_; }
855 
863  bool loadBalance () { return false; }
864 
866  int balanceCounter () const { return 0; }
867 
869  double loadBalanceTime () const { return 0.; }
870 
873  DataProjection& dataProjection() { return dataProjection_; }
874  private:
875  DiscreteFunctionSpaceType &space () { return space_.get(); }
876 
877  const DiscreteFunctionSpaceType &space () const { return space_.get(); }
878 
879  DofManagerType &dofManager () { return dofManager_.get(); }
880 
881  const DofManagerType &dofManager () const { return dofManager_.get(); }
882 
883  std::reference_wrapper< DiscreteFunctionSpaceType > space_;
884  DataProjectionType dataProjection_;
885  std::reference_wrapper< DofManagerType > dofManager_;
886  mutable CommunicationManagerList commList_;
887  double time_;
888  };
889 
890  // AdaptationManager::DataProjectionWrapper
891  // ----------------------------------------
892 
893  template< class DiscreteFunctionSpace, class DataProjection >
896  {
898 
899  public:
902 
903  DataProjectionWrapper ( DataProjectionType &dataProjection, DofManagerType &dofManager )
904  : dataProjection_( dataProjection ),
905  dofManager_( dofManager ),
906  modified_( false )
907  {}
908 
909  void operator() ( const EntityType &entity,
910  const BasisFunctionSetType &prior,
911  const BasisFunctionSetType &present,
912  const std::vector< std::size_t > &origin,
913  const std::vector< std::size_t > &destination )
914  {
915  dofManager_.get().resizeMemory();
916  dataProjection_.get()( entity, prior, present, origin, destination );
917  modified_ = true;
918  }
919 
920  template <class TemporaryStorage>
921  void operator() ( TemporaryStorage& tmp )
922  {
923  dataProjection_.get()( tmp );
924  modified_ = true;
925  }
926 
927  explicit operator bool () const
928  {
929  return modified_;
930  }
931 
932  private:
933  std::reference_wrapper< DataProjectionType > dataProjection_;
934  std::reference_wrapper< DofManagerType > dofManager_;
935  bool modified_;
936  };
937 
938  } // namespace hpDG
939 
940 
941 
948  {
954  template <class GridType>
955  static void apply(GridType& grid, const int step)
956  {
957  typedef DofManager< GridType > DofManagerType;
958  DofManagerType& dm = DofManagerType :: instance(grid);
959  grid.globalRefine(step);
960  grid.loadBalance();
961  dm.resize();
962  dm.compress();
963  }
964  };
971  struct LocalRefine
972  {
977  template <class GridType>
978  static void apply(GridType& grid)
979  {
980  typedef DofManager< GridType > DofManagerType;
981  DofManagerType& dm = DofManagerType :: instance(grid);
982  grid.preAdapt();
983  grid.adapt();
984  grid.postAdapt();
985  grid.loadBalance();
986  dm.resize();
987  dm.compress();
988  }
989  };
990 
993  } // namespace Fem
994 
995 } // namespace Dune
996 
997 #endif // #ifndef DUNE_FEM_ADAPTMANAGER_HH
interfaces and wrappers needed for the callback adaptation provided by AlbertaGrid and ALUGrid
Definition: bindguard.hh:11
base class for persistent objects
Definition: persistencemanager.hh:101
static void backupValue(const std::string &token, const T &value)
Definition: persistencemanager.hh:395
static void restoreValue(const std::string &token, T &value)
Definition: persistencemanager.hh:401
base class for auto persistent objects
Definition: persistencemanager.hh:580
static bool verbose()
obtain the cached value for fem.verbose
Definition: io/parameter.hh:445
static ParameterContainer & container()
Definition: io/parameter.hh:193
Definition: misc/capabilities.hh:151
static bool isMaster()
return true if the current thread is the master thread (i.e. thread 0)
Definition: threadmanager.hh:68
static bool singleThreadMode()
returns true if program is operating on one thread currently
Definition: threadmanager.hh:74
Definition: objpointer.hh:42
AdaptationManagerInterface class.
Definition: adaptationmanager.hh:60
virtual double adaptationTime() const
time that last adaptation cycle took
Definition: adaptationmanager.hh:120
virtual void adapt()
on call of this method the internal adaptation operator is called.
Definition: adaptationmanager.hh:71
virtual bool adaptive() const
returns true if adaptation manager as adaptation method different to NONE
Definition: adaptationmanager.hh:84
virtual ~AdaptationManagerInterface()
destructor
Definition: adaptationmanager.hh:66
virtual const char * methodName() const
returns name of adaptation method
Definition: adaptationmanager.hh:92
virtual bool loadBalance()
call load balance, returns true if grid was changed
Definition: adaptationmanager.hh:108
AdaptationManagerInterface()
default constructor
Definition: adaptationmanager.hh:63
AdaptationManagerInterface & operator=(const AdaptationManagerInterface &am)
Assignment operator, pointer to adaptation manager is stored.
Definition: adaptationmanager.hh:100
virtual int balanceCounter() const
Definition: adaptationmanager.hh:114
AdaptationMethod is a simple adaptation method reader class.
Definition: adaptationmanager.hh:133
virtual const char * methodName() const
returns name of adaptation method
Definition: adaptationmanager.hh:187
AdaptationMethod(const GridType &grid, const ParameterReader &parameter=Parameter::container())
constructor of AdaptationMethod The following optional parameters are used
Definition: adaptationmanager.hh:149
virtual ~AdaptationMethod()
virtual destructor
Definition: adaptationmanager.hh:184
AdaptationMethodType adaptationMethod_
method identifier
Definition: adaptationmanager.hh:202
virtual bool adaptive() const
returns true if adaptation manager as adaptation method different to NONE
Definition: adaptationmanager.hh:198
AdaptationMethodType
type of adaptation method
Definition: adaptationmanager.hh:136
@ none
no adaptation is performed
Definition: adaptationmanager.hh:136
@ generic
a generic restriction and prolongation algorithm is used
Definition: adaptationmanager.hh:137
@ callback
the callback mechanism from AlbertaGrid and ALUGrid is used
Definition: adaptationmanager.hh:138
This class manages the adaptation process. If the method adapt is called, then the grid is adapted an...
Definition: adaptationmanager.hh:214
virtual int balanceCounter() const
default load balancing counter is zero
Definition: adaptationmanager.hh:343
virtual ~AdaptationManagerBase()
destructor
Definition: adaptationmanager.hh:303
GridType ::Traits ::LocalIdSet LocalIdSet
Definition: adaptationmanager.hh:282
static DofManagerType & getDofManager(const GridType &grid)
Definition: adaptationmanager.hh:355
AdaptationManagerBase(GridType &grid, RestProlOperatorImp &rpOp, const ParameterReader &parameter=Parameter::container())
constructor of AdaptationManagerBase The following optional parameter can be used
Definition: adaptationmanager.hh:293
double adaptTime_
time that adaptation took
Definition: adaptationmanager.hh:573
GridType & grid_
corresponding grid
Definition: adaptationmanager.hh:564
bool wasChanged_
flag for restriction
Definition: adaptationmanager.hh:576
RestProlOperatorImp & rpOp_
Restriction and Prolongation Operator.
Definition: adaptationmanager.hh:570
virtual bool loadBalance()
default load balancing method which does nothing
Definition: adaptationmanager.hh:337
virtual double adaptationTime() const
time that last adaptation cycle took
Definition: adaptationmanager.hh:349
RestProlOperatorImp & getRestProlOp()
Definition: adaptationmanager.hh:308
virtual void adapt()
according to adaption method parameter the adaption procedure is done, 0 == no adaptation 1 == generi...
Definition: adaptationmanager.hh:320
DofManagerType & dm_
DofManager corresponding to grid.
Definition: adaptationmanager.hh:567
factory class to create adaptation manager reference counter
Definition: adaptationmanager.hh:582
static ObjectType * createObject(const KeyType &key)
Definition: adaptationmanager.hh:583
static void deleteObject(ObjectType *obj)
Definition: adaptationmanager.hh:587
This class manages the adaptation process including a load balancing after the adaptation step....
Definition: adaptationmanager.hh:603
int balanceCounter() const
returns actual balanceCounter for checkpointing
Definition: adaptationmanager.hh:744
void restore()
retore internal data
Definition: adaptationmanager.hh:754
AdaptationManager(GridType &grid, RestProlOperatorImp &rpOp, int balanceCounter, const ParameterReader &parameter=Parameter::container())
constructor of AdaptationManager
Definition: adaptationmanager.hh:644
virtual double loadBalanceTime() const
time that last load balance cycle took
Definition: adaptationmanager.hh:701
void backup() const
backup internal data
Definition: adaptationmanager.hh:747
virtual bool loadBalance()
call load balance, returns true if grid was changed
Definition: adaptationmanager.hh:687
virtual void adapt()
on call of this method the internal adaptation operator is called.
Definition: adaptationmanager.hh:707
AdaptationManager(GridType &grid, RestProlOperatorImp &rpOp, const ParameterReader &parameter=Parameter::container())
constructor of AdaptationManager
Definition: adaptationmanager.hh:674
~AdaptationManager()
destructor decreasing reference counter
Definition: adaptationmanager.hh:680
Manages the testriction and prolongation of discrete functions in -adaptive computations.
Definition: adaptationmanager.hh:783
void adapt()
perform adaptation
Definition: adaptationmanager.hh:833
AdaptationManager(DiscreteFunctionSpaceType &space, DataProjectionType &&dataProjection)
Definition: adaptationmanager.hh:803
const char * methodName() const
return name of adaptation method
Definition: adaptationmanager.hh:851
int balanceCounter() const
please doc me
Definition: adaptationmanager.hh:866
DataProjection & dataProjection()
Definition: adaptationmanager.hh:873
bool adaptive() const
returns true
Definition: adaptationmanager.hh:830
AdaptationManager(const ThisType &)=delete
Deleted methods.
double adaptationTime() const
return time spent on adaptation
Definition: adaptationmanager.hh:854
bool loadBalance()
please doc me
Definition: adaptationmanager.hh:863
double loadBalanceTime() const
please doc me
Definition: adaptationmanager.hh:869
typename BaseType::EntityType EntityType
Definition: adaptationmanager.hh:901
DataProjectionWrapper(DataProjectionType &dataProjection, DofManagerType &dofManager)
Definition: adaptationmanager.hh:903
typename BaseType::BasisFunctionSetType BasisFunctionSetType
Definition: adaptationmanager.hh:900
A class with one static method apply to globally refine a grid. All index sets are adapted to the new...
Definition: adaptationmanager.hh:948
static void apply(GridType &grid, const int step)
apply global refinement and also adjust index sets and managed dof storage. However,...
Definition: adaptationmanager.hh:955
A class with one static method apply for invoking the local adaptation procedure on a given grid inst...
Definition: adaptationmanager.hh:972
static void apply(GridType &grid)
apply local refinement and also adjust index sets and managed dof storage. However,...
Definition: adaptationmanager.hh:978
Definition: adaptcallbackhandle.hh:26
Definition: dofmanager.hh:762
Abstract definition of the local restriction and prolongation of discrete functions.
Definition: dataprojection/dataprojection.hh:29
typename BasisFunctionSetType::EntityType EntityType
entity type
Definition: dataprojection/dataprojection.hh:38
typename DiscreteFunctionSpaceType::BasisFunctionSetType BasisFunctionSetType
basis function set type
Definition: dataprojection/dataprojection.hh:36
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
Singleton list for key/object pairs.
Definition: singletonlist.hh:53
discrete function space