Skip to content
Snippets Groups Projects
AdaptBase.h 3.48 KiB
Newer Older
  • Learn to ignore specific revisions
  • // ============================================================================
    // ==                                                                        ==
    // == AMDiS - Adaptive multidimensional simulations                          ==
    // ==                                                                        ==
    // ============================================================================
    // ==                                                                        ==
    
    // ==  TU Dresden                                                            ==
    
    // ==  Institut fr Wissenschaftliches Rechnen                               ==
    // ==  Zellescher Weg 12-14                                                  ==
    // ==  01069 Dresden                                                         ==
    
    // ==  germany                                                               ==
    // ==                                                                        ==
    // ============================================================================
    // ==                                                                        ==
    
    // ==  https://gforge.zih.tu-dresden.de/projects/amdis/                      ==
    
    // ==                                                                        ==
    // ============================================================================
    
    /** \file AdaptBase.h */
    
    #ifndef AMDIS_ADAPTBASE_H
    #define AMDIS_ADAPTBASE_H
    
    #include <string>
    
    Thomas Witkowski's avatar
    Thomas Witkowski committed
      /// Interface for adaption loops.
    
      class AdaptBase
      {
      public:
    
    Thomas Witkowski's avatar
    Thomas Witkowski committed
        /// Constructor
    
    Thomas Witkowski's avatar
    Thomas Witkowski committed
        AdaptBase(std::string sname,
    
    	      ProblemIterationInterface *problemIteration,
    
    Thomas Witkowski's avatar
    Thomas Witkowski committed
    	      AdaptInfo *adapt,
    
    	      ProblemTimeInterface *problemTime = NULL,
    	      AdaptInfo *initialAdaptInfo = NULL)
    
    Thomas Witkowski's avatar
    Thomas Witkowski committed
          : name(sname),
    
    	problemIteration_(problemIteration),
    
    Thomas Witkowski's avatar
    Thomas Witkowski committed
    	adaptInfo(adapt),
    
    	problemTime_(problemTime),
    	initialAdaptInfo_(initialAdaptInfo)
    
    Thomas Witkowski's avatar
    Thomas Witkowski committed
        {}
    
    Thomas Witkowski's avatar
    Thomas Witkowski committed
        /// Destructor
    
    Thomas Witkowski's avatar
    Thomas Witkowski committed
        virtual ~AdaptBase() {}
    
    
        /** \brief
         * Pure virtual method. Must be overloaded by sub classes to perform
         * a concrete adaption loop. 
         */
        virtual int adapt() = 0;
    
    
    Thomas Witkowski's avatar
    Thomas Witkowski committed
        /// Returns \ref name
    
    Thomas Witkowski's avatar
    Thomas Witkowski committed
        inline std::string getName() const 
    
    Thomas Witkowski's avatar
    Thomas Witkowski committed
          return name; 
    
    Thomas Witkowski's avatar
    Thomas Witkowski committed
        }
    
    Thomas Witkowski's avatar
    Thomas Witkowski committed
        /// Returns \ref problemIteration_
    
        inline ProblemIterationInterface *getProblemIteration() 
        {
    
          return problemIteration_;
    
    Thomas Witkowski's avatar
    Thomas Witkowski committed
        }
    
    Thomas Witkowski's avatar
    Thomas Witkowski committed
        ///
    
        inline void setProblemIteration(ProblemIterationInterface *pii) 
        {
    
          problemIteration_ = pii;
    
    Thomas Witkowski's avatar
    Thomas Witkowski committed
        }
    
    Thomas Witkowski's avatar
    Thomas Witkowski committed
        /// Returns \ref adaptInfo
    
        inline AdaptInfo *getAdaptInfo() 
        { 
    
    Thomas Witkowski's avatar
    Thomas Witkowski committed
          return adaptInfo; 
        }
    
    Thomas Witkowski's avatar
    Thomas Witkowski committed
        /// Returns \ref problemTime_
    
        inline ProblemTimeInterface *getProblemTime() 
        {
    
          return problemTime_;
    
    Thomas Witkowski's avatar
    Thomas Witkowski committed
        }
    
    Thomas Witkowski's avatar
    Thomas Witkowski committed
        ///
    
        inline void setProblemTime(ProblemTimeInterface *pti) 
        {
    
    Thomas Witkowski's avatar
    Thomas Witkowski committed
        /// Returns \ref initialAdaptInfo_
    
        inline AdaptInfo *getInitialAdaptInfo() 
        { 
    
    Thomas Witkowski's avatar
    Thomas Witkowski committed
        }
    
    Thomas Witkowski's avatar
    Thomas Witkowski committed
        /// Name of the adaption loop
        std::string name;
    
    Thomas Witkowski's avatar
    Thomas Witkowski committed
        /// Problem iteration interface
    
        ProblemIterationInterface *problemIteration_;
    
    
    Thomas Witkowski's avatar
    Thomas Witkowski committed
        /// Main adapt info
    
    Thomas Witkowski's avatar
    Thomas Witkowski committed
        AdaptInfo *adaptInfo;
    
    Thomas Witkowski's avatar
    Thomas Witkowski committed
        /// problem time interface
    
        ProblemTimeInterface *problemTime_;
    
        /** \brief
         * Adapt info for initial adapt. Will be given to 
         * problemTime_->solveInitialProblem().
         */
        AdaptInfo *initialAdaptInfo_;
    
    
    Thomas Witkowski's avatar
    Thomas Witkowski committed
        /// Info level