dune-fem  2.6-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() );
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  // call pre-adapt, returns true if at least
370  // one element is marked for coarsening
371  bool restr = grid_.preAdapt();
372 
373  // get macro grid view
374  typedef typename GridType::LevelGridView MacroGridView;
375  typedef typename MacroGridView :: template Codim<0>::
376  template Partition<pitype> :: Iterator MacroIterator;
377 
378  // reset flag
379  wasChanged_ = false ;
380 
381  if(restr)
382  {
383  // get macro grid view
384  MacroGridView macroView = grid_.levelGridView( 0 );
385 
386  // make a hierarchical to insert all elements
387  // that are father of elements that might be coarsened
388 
389  {
390  // get macro iterator
391  MacroIterator endit = macroView.template end<0,pitype> ();
392  for(MacroIterator it = macroView.template begin<0,pitype>();
393  it != endit; ++it )
394  {
395  hierarchicRestrict( *it , dm_.indexSetRestrictProlongNoResize() );
396  }
397  }
398 
399  // if at least one element was found for restriction
400  if( wasChanged_ )
401  {
402  // now resize memory
403  dm_.resizeForRestrict();
404 
405  // now project all data to fathers
406  {
407  // get macro iterator
408  MacroIterator endit = macroView.template end<0,pitype> ();
409  for(MacroIterator it = macroView.template begin<0,pitype>();
410  it != endit; ++it )
411  {
412  hierarchicRestrict( *it , rpOp_ );
413  }
414  }
415  }
416  }
417 
418  // adapt grid due to preset markers
419  // returns true if at least one element was refined
420  const bool refined = grid_.adapt();
421 
422  // if coarsening or refinement was done
423  // adjust sizes
424  if( refined || restr )
425  {
426  // resizes the index sets (insert all new indices)
427  // and resizes the memory
428  dm_.resize();
429  }
430 
431  // in case elements were created do prolongation
432  if( refined )
433  {
434  // get macro grid view
435  MacroGridView macroView = grid_.levelGridView( 0 );
436 
437  // make run through grid to project data
438  MacroIterator endit = macroView.template end<0,pitype> ();
439  for(MacroIterator it = macroView.template begin<0,pitype>();
440  it != endit; ++it )
441  {
442  hierarchicProlong( *it , rpOp_ );
443  }
444  }
445 
446  // notifyGlobalChange make wasChanged equal on all cores
447  if( dm_.notifyGlobalChange( wasChanged_ ) )
448  {
449  // compress index sets and data
450  // this will increase the sequence counter
451  dm_.compress();
452  }
453 
454  // do cleanup
455  grid_.postAdapt();
456  }
457 
458  private:
460  template <class EntityType, class RestrictOperatorType >
461  bool hierarchicRestrict ( const EntityType& entity, RestrictOperatorType & restop ) const
462  {
463  if( ! entity.isLeaf() )
464  {
465  // true means we are going to restrict data
466  bool doRestrict = true;
467 
468  // check partition type
469  const bool isGhost = entity.partitionType() == GhostEntity ;
470 
471  // if the children have children then we have to go deeper
472  const int childLevel = entity.level() + 1;
473  typedef typename EntityType::HierarchicIterator HierarchicIterator;
474 
475  // check all children first
476  {
477  const HierarchicIterator endit = entity.hend( childLevel );
478  for(HierarchicIterator it = entity.hbegin( childLevel ); it != endit; ++it)
479  {
480  doRestrict &= hierarchicRestrict( *it , restop );
481  }
482  }
483 
484  // if doRestrict is still true, restrict data
485  if(doRestrict)
486  {
487  // we did at least one restriction
488  wasChanged_ = true;
489 
490  // do not restrict the solution on ghosts, this will
491  // fail, but we still need the wasChanged info, so simply
492  // calling hierarchicRestrict on interior won't work either
493  if( ! isGhost )
494  {
495  // true for first child, otherwise false
496  bool initialize = true;
497  const HierarchicIterator endit = entity.hend( childLevel );
498  for(HierarchicIterator it = entity.hbegin( childLevel ); it != endit; ++it)
499  {
500  // restrict solution
501  restop.restrictLocal( entity, *it , initialize);
502  // reset initialize flag
503  initialize = false;
504  }
505  }
506  }
507  }
508 
509  // if all children return mightBeCoarsened,
510  // then doRestrict on father remains true
511  return entity.mightVanish();
512  }
513 
514  template <class EntityType, class ProlongOperatorType >
515  void hierarchicProlong ( const EntityType &entity, ProlongOperatorType & prolop ) const
516  {
517  typedef typename EntityType::HierarchicIterator HierarchicIterator;
518 
519  // NOTE: initialize not working here
520  // because we call hierarchically
521 
522  // first call on this element
523  bool initialize = true;
524 
525  // check partition type
526  const bool isGhost = entity.partitionType() == GhostEntity ;
527 
528  const int maxLevel = grid_.maxLevel();
529  const HierarchicIterator endit = entity.hend( maxLevel );
530  for( HierarchicIterator it = entity.hbegin( maxLevel ); it != endit; ++it )
531  {
532  // should only get here on non-leaf entities
533  assert( !entity.isLeaf() );
534 
535  const EntityType & son = *it;
536  if( son.isNew() )
537  {
538  // the grid was obviously changed if we get here
539  wasChanged_ = true ;
540 
541  // do not prolong the solution on ghosts, this will
542  // fail, but we still need the wasChanged info, so simply
543  // calling hierarchicRestrict on interior won't work either
544  if( ! isGhost )
545  {
546  EntityType vati = son.father();
547  prolop.prolongLocal( vati , son , initialize );
548  initialize = false;
549  }
550  }
551  }
552  }
553 
554  protected:
556  GridType &grid_;
557 
560 
562  RestProlOperatorImp &rpOp_;
563 
565  double adaptTime_;
566 
568  mutable bool wasChanged_;
569  };
570 
572  template <class KeyType, class ObjectType>
574  {
575  static ObjectType* createObject(const KeyType& key)
576  {
577  return new ObjectType(0);
578  }
579  static void deleteObject(ObjectType* obj)
580  {
581  delete obj;
582  }
583  };
584 
590  template <class GridType, class RestProlOperatorImp>
593  public LoadBalancer<GridType>,
594  public AutoPersistentObject
595  {
596  // type of key
597  typedef const GridType* KeyType;
598  // object type
599  typedef size_t ObjectType;
600  // type of factory
602 
603  // type of singleton list
605 
608 
609  // reference counter to ensure only one instance per grid exists
610  ObjectType& referenceCounter_;
611 
612  // do not copy
614 
615  public:
634  AdaptationManager ( GridType &grid, RestProlOperatorImp &rpOp, int balanceCounter, const ParameterReader &parameter = Parameter::container() )
635  : BaseType(grid,rpOp, parameter)
636  , Base2Type( grid, rpOp )
637  , referenceCounter_( ProviderType :: getObject( &grid ) )
638  , balanceStep_( parameter.getValue< int >( "fem.loadbalancing.step", 1 ) )
639  , balanceCounter_( balanceCounter )
640  {
641  if( ++referenceCounter_ > 1 )
642  DUNE_THROW(InvalidStateException,"Only one instance of AdaptationManager allowed per grid instance");
643  if( Parameter::verbose() )
644  std::cout << "Created LoadBalancer: balanceStep = " << balanceStep_ << std::endl;
645  }
646 
664  AdaptationManager ( GridType &grid, RestProlOperatorImp &rpOp, const ParameterReader &parameter = Parameter::container() )
665  : BaseType(grid,rpOp, parameter)
666  , Base2Type( grid, rpOp )
667  , referenceCounter_( ProviderType :: getObject( &grid ) )
668  , balanceStep_( parameter.getValue< int >( "fem.loadbalancing.step", 1 ) )
669  , balanceCounter_( 0 )
670  {
671  if( ++referenceCounter_ > 1 )
672  DUNE_THROW(InvalidStateException,"Only one instance of AdaptationManager allowed per grid instance");
673  }
674 
677  {
678  -- referenceCounter_;
679  ProviderType :: removeObject( referenceCounter_ );
680  }
681 
683  virtual bool loadBalance ()
684  {
685  // call load balance
686  return Base2Type :: loadBalance();
687  }
688 
690  virtual double loadBalanceTime() const
691  {
692  return Base2Type::loadBalanceTime();
693  }
694 
696  virtual void adapt ()
697  {
698  // adapt grid
699  BaseType :: adapt ();
700 
701  // if adaptation is enabled
702  if( this->adaptive() && (balanceStep_ > 0) )
703  {
704  // if balance counter has readed balanceStep do load balance
705  const bool callBalance = (++balanceCounter_ >= balanceStep_);
706 
707 #ifndef NDEBUG
708  // make sure load balance is called on every process
709  int willCall = (callBalance) ? 1 : 0;
710  const int iCall = willCall;
711 
712  // send info from rank 0 to all other
713  Base2Type::grid_.comm().broadcast(&willCall, 1 , 0);
714 
715  assert( willCall == iCall );
716 #endif
717 
718  if( callBalance )
719  {
720  // balance work load and restore consistency in the data
721  loadBalance();
722  balanceCounter_ = 0;
723  }
724  else
725  {
726  // only restore consistency in the data
727  Base2Type::communicate();
728  }
729  }
730  }
731 
733  int balanceCounter () const { return balanceCounter_; }
734 
736  void backup() const
737  {
738  std::tuple<const int& > value( balanceCounter_ );
739  PersistenceManager::backupValue("loadbalancer",value);
740  }
741 
743  void restore()
744  {
745  std::tuple< int& > value( balanceCounter_ );
746  PersistenceManager::restoreValue("loadbalancer",value);
747  }
748 
749  private:
750  // call loadBalance ervery balanceStep_ step
751  const int balanceStep_ ;
752  // count actual balance call
753  int balanceCounter_;
754  };
755 
756  namespace hpDG
757  {
758 
759  // AdaptationManager
760  // -----------------
761 
769  template< class DiscreteFunctionSpace, class DataProjection >
772  {
774 
775  public:
780 
781  private:
782  using GridType = typename DiscreteFunctionSpaceType::GridType;
784 
785  class DataProjectionWrapper;
786 
787  public:
792  explicit AdaptationManager ( DiscreteFunctionSpaceType &space, DataProjectionType &&dataProjection )
793  : space_( space ),
794  dataProjection_( std::forward< DataProjectionType >( dataProjection ) ),
795  dofManager_( DofManagerType::instance( space.gridPart().grid() ) ),
796  commList_( dataProjection_ ),
797  time_( 0. )
798  {}
799 
807  AdaptationManager ( const ThisType & ) = delete;
808 
810  ThisType &operator= ( const ThisType & ) = delete;
811 
819  bool adaptive () const { return true; }
820 
822  void adapt ()
823  {
825 
826  Dune::Timer timer;
827 
828  DataProjectionWrapper wrapper( dataProjection_, dofManager() );
829  space().adapt( wrapper );
830 
831  if( dofManager().notifyGlobalChange( static_cast< bool >( wrapper ) ) )
832  dofManager().compress();
833 
834  commList_.exchange();
835 
836  time_ = timer.elapsed();
837  }
838 
840  const char *methodName () const { return "discrete function space adaptation"; }
841 
843  double adaptationTime () const { return time_; }
844 
852  bool loadBalance () { return false; }
853 
855  int balanceCounter () const { return 0; }
856 
858  double loadBalanceTime () const { return 0.; }
859 
862  DataProjection& dataProjection() { return dataProjection_; }
863  private:
864  DiscreteFunctionSpaceType &space () { return space_.get(); }
865 
866  const DiscreteFunctionSpaceType &space () const { return space_.get(); }
867 
868  DofManagerType &dofManager () { return dofManager_.get(); }
869 
870  const DofManagerType &dofManager () const { return dofManager_.get(); }
871 
872  std::reference_wrapper< DiscreteFunctionSpaceType > space_;
873  DataProjectionType dataProjection_;
874  std::reference_wrapper< DofManagerType > dofManager_;
875  mutable CommunicationManagerList commList_;
876  double time_;
877  };
878 
879  // AdaptationManager::DataProjectionWrapper
880  // ----------------------------------------
881 
882  template< class DiscreteFunctionSpace, class DataProjection >
885  {
887 
888  public:
891 
892  DataProjectionWrapper ( DataProjectionType &dataProjection, DofManagerType &dofManager )
893  : dataProjection_( dataProjection ),
894  dofManager_( dofManager ),
895  modified_( false )
896  {}
897 
898  void operator() ( const EntityType &entity,
899  const BasisFunctionSetType &prior,
900  const BasisFunctionSetType &present,
901  const std::vector< std::size_t > &origin,
902  const std::vector< std::size_t > &destination )
903  {
904  dofManager_.get().resizeMemory();
905  dataProjection_.get()( entity, prior, present, origin, destination );
906  modified_ = true;
907  }
908 
909  template <class TemporaryStorage>
910  void operator() ( TemporaryStorage& tmp )
911  {
912  dataProjection_.get()( tmp );
913  modified_ = true;
914  }
915 
916  explicit operator bool () const
917  {
918  return modified_;
919  }
920 
921  private:
922  std::reference_wrapper< DataProjectionType > dataProjection_;
923  std::reference_wrapper< DofManagerType > dofManager_;
924  bool modified_;
925  };
926 
927  } // namespace hpDG
928 
929 
930 
937  {
943  template <class GridType>
944  static void apply(GridType& grid, const int step)
945  {
946  typedef DofManager< GridType > DofManagerType;
947  DofManagerType& dm = DofManagerType :: instance(grid);
948  grid.globalRefine(step);
949  grid.loadBalance();
950  dm.resize();
951  dm.compress();
952  }
953  };
960  struct LocalRefine
961  {
966  template <class GridType>
967  static void apply(GridType& grid)
968  {
969  typedef DofManager< GridType > DofManagerType;
970  DofManagerType& dm = DofManagerType :: instance(grid);
971  grid.preAdapt();
972  grid.adapt();
973  grid.postAdapt();
974  grid.loadBalance();
975  dm.resize();
976  dm.compress();
977  }
978  };
979 
982  } // namespace Fem
983 
984 } // namespace Dune
985 
986 #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:102
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:437
static DUNE_EXPORT ParameterContainer & container()
Definition: io/parameter.hh:192
Definition: misc/capabilities.hh:151
static bool singleThreadMode()
returns true if program is operating on one thread currently
Definition: threadmanager.hh:218
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:565
GridType & grid_
corresponding grid
Definition: adaptationmanager.hh:556
bool wasChanged_
flag for restriction
Definition: adaptationmanager.hh:568
RestProlOperatorImp & rpOp_
Restriction and Prolongation Operator.
Definition: adaptationmanager.hh:562
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:559
factory class to create adaptation manager reference counter
Definition: adaptationmanager.hh:574
static ObjectType * createObject(const KeyType &key)
Definition: adaptationmanager.hh:575
static void deleteObject(ObjectType *obj)
Definition: adaptationmanager.hh:579
This class manages the adaptation process including a load balancing after the adaptation step....
Definition: adaptationmanager.hh:595
int balanceCounter() const
returns actual balanceCounter for checkpointing
Definition: adaptationmanager.hh:733
void restore()
retore internal data
Definition: adaptationmanager.hh:743
AdaptationManager(GridType &grid, RestProlOperatorImp &rpOp, int balanceCounter, const ParameterReader &parameter=Parameter::container())
constructor of AdaptationManager
Definition: adaptationmanager.hh:634
virtual double loadBalanceTime() const
time that last load balance cycle took
Definition: adaptationmanager.hh:690
void backup() const
backup internal data
Definition: adaptationmanager.hh:736
virtual bool loadBalance()
call load balance, returns true if grid was changed
Definition: adaptationmanager.hh:683
virtual void adapt()
on call of this method the internal adaptation operator is called.
Definition: adaptationmanager.hh:696
AdaptationManager(GridType &grid, RestProlOperatorImp &rpOp, const ParameterReader &parameter=Parameter::container())
constructor of AdaptationManager
Definition: adaptationmanager.hh:664
~AdaptationManager()
destructor decreasing reference counter
Definition: adaptationmanager.hh:676
Manages the testriction and prolongation of discrete functions in -adaptive computations.
Definition: adaptationmanager.hh:772
void adapt()
perform adaptation
Definition: adaptationmanager.hh:822
AdaptationManager(DiscreteFunctionSpaceType &space, DataProjectionType &&dataProjection)
Definition: adaptationmanager.hh:792
const char * methodName() const
return name of adaptation method
Definition: adaptationmanager.hh:840
int balanceCounter() const
please doc me
Definition: adaptationmanager.hh:855
DataProjection & dataProjection()
Definition: adaptationmanager.hh:862
bool adaptive() const
returns true
Definition: adaptationmanager.hh:819
AdaptationManager(const ThisType &)=delete
Deleted methods.
double adaptationTime() const
return time spent on adaptation
Definition: adaptationmanager.hh:843
bool loadBalance()
please doc me
Definition: adaptationmanager.hh:852
double loadBalanceTime() const
please doc me
Definition: adaptationmanager.hh:858
typename BaseType::EntityType EntityType
Definition: adaptationmanager.hh:890
DataProjectionWrapper(DataProjectionType &dataProjection, DofManagerType &dofManager)
Definition: adaptationmanager.hh:892
typename BaseType::BasisFunctionSetType BasisFunctionSetType
Definition: adaptationmanager.hh:889
A class with one static method apply to globally refine a grid. All index sets are adapted to the new...
Definition: adaptationmanager.hh:937
static void apply(GridType &grid, const int step)
apply global refinement and also adjust index sets and managed dof storage. However,...
Definition: adaptationmanager.hh:944
A class with one static method apply for invoking the local adaptation procedure on a given grid inst...
Definition: adaptationmanager.hh:961
static void apply(GridType &grid)
apply local refinement and also adjust index sets and managed dof storage. However,...
Definition: adaptationmanager.hh:967
Definition: adaptcallbackhandle.hh:26
Definition: dofmanager.hh:825
Abstract definition of the local restriction and prolongation of discrete functions.
Definition: common/dataprojection/dataprojection.hh:29
typename BasisFunctionSetType::EntityType EntityType
entity type
Definition: common/dataprojection/dataprojection.hh:38
typename DiscreteFunctionSpaceType::BasisFunctionSetType BasisFunctionSetType
basis function set type
Definition: common/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:54
discrete function space