#ifndef AMDIS_SOLUTION_DATA_STORAGE_H #define AMDIS_SOLUTION_DATA_STORAGE_H #include #include #include "DOFVector.h" #include "SystemVector.h" #include "Parameters.h" namespace AMDiS { template struct SolutionHelper { typedef FiniteElemSpace* type; }; template <> struct SolutionHelper { typedef std::vector type; }; template class SolutionDataStorage { public: SolutionDataStorage(std::string name); ~SolutionDataStorage(); /** \brief * Set one fix FE Space. All solutions are defined only on the given FE Space. */ void setFixFESpace(typename SolutionHelper::type feSpace, bool cleanupFeSpace = false); void push(T *solution, double timestamp, FiniteElemSpace *feSpace = NULL, bool cleanupSolution = true, bool cleanupFeSpace = true); bool pop(T *solution, double *timestep, FiniteElemSpace *feSpace = NULL); protected: void cleanup(); /** \brief * Number of MBytes of memory that can be used for solution storage. */ int maxMemoryUsage; /** \brief * If true, it is allowed to write solutions also to disk. */ bool useDisk; /** \brief * Directory, where solutions can be written temporarly. */ std::string writeDirectory; /** \brief * If true, all solutions are defined only on one FE Space. */ bool fixedFESpace; /** \brief * Here, all the solutions (i.e. either DOFVectors or SystemVectors) * are stored. */ std::vector solutions; /** \brief * Stores to every solution its FE Space. If \ref fixedFESpace is set * to true, only one entry exists. This is than the FE Space for all * solutions. */ std::vector< typename SolutionHelper::type > feSpaces; /** \brief * Stores to every solutions the timestamp at which the solution was * created in the adaption loop. */ std::vector timestamps; /** \brief * Stores to each solution, if the data storage is allowed to delete * the solution by itself. */ std::vector cleanupSolutions; /** \brief * Stores to each fe space, if the data storage is allowed to delete * the fe space by itself. */ std::vector cleanupFeSpaces; /** \brief * Position of the latest valid solution. */ int lastPos; /** \brief * If true, the last operation on the data storage was pop. */ bool poped; }; } #include "SolutionDataStorage.hh" #endif // AMDIS_SOLUTION_DATA_STORAGE_H