Alsvinn  0.5.3
The fast FVM simulator with UQ support
FixedIntervalWriter.hpp
Go to the documentation of this file.
1 /* Copyright (c) 2018 ETH Zurich, Kjetil Olsen Lye
2  * This program is free software: you can redistribute it and/or modify
3  * it under the terms of the GNU General Public License as published by
4  * the Free Software Foundation, either version 3 of the License, or
5  * (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program. If not, see <http://www.gnu.org/licenses/>.
14  */
15 
16 #pragma once
17 #include "alsfvm/io/Writer.hpp"
19 
20 #include <memory>
21 
22 namespace alsfvm {
23 namespace io {
24 
32 public:
41  FixedIntervalWriter(alsfvm::shared_ptr<Writer>& writer, real timeInterval,
42  real endTime, bool writeInitialTimestep = true,
43  real startTime = 0);
44 
45  virtual ~FixedIntervalWriter() {}
52  virtual void write(const volume::Volume& conservedVariables,
53  const grid::Grid& grid,
54  const simulator::TimestepInformation& timestepInformation) override;
55 
56  virtual real adjustTimestep(real dt,
57  const simulator::TimestepInformation& timestepInformation) const override;
58 
59  virtual void finalize(const grid::Grid& grid,
60  const simulator::TimestepInformation& timestepInformation) override;
61 private:
62  alsfvm::shared_ptr<Writer> writer;
63  const real timeInterval;
64  size_t numberSaved;
65  const bool writeInitialTimestep;
66 
67  const real startTime = 0;
68 
69 };
70 } // namespace alsfvm
71 } // namespace io
virtual void finalize(const grid::Grid &grid, const simulator::TimestepInformation &timestepInformation) override
This method should be called at the end of the simulation.
Definition: FixedIntervalWriter.cpp:55
virtual void write(const volume::Volume &conservedVariables, const grid::Grid &grid, const simulator::TimestepInformation &timestepInformation) override
write writes the data to disk
Definition: FixedIntervalWriter.cpp:33
virtual real adjustTimestep(real dt, const simulator::TimestepInformation &timestepInformation) const override
adjustTimestep returns the new timestep that the simulator should use
Definition: FixedIntervalWriter.cpp:45
Definition: Grid.hpp:27
The Volume class represents a volume (a collection of cells with values for each cell (eg...
Definition: Volume.hpp:30
double real
Definition: types.hpp:65
const grid::Grid & grid
Definition: NumericalFluxFactory.cpp:104
The FixedIntervalWriter class is a decorator for another writer. Its purpose is to only call the unde...
Definition: FixedIntervalWriter.hpp:31
The Writer class is an abstract interface to represent output writers.
Definition: Writer.hpp:28
The TimestepAdjuster class is an abstract interface for adjusting timesteps.
Definition: TimestepAdjuster.hpp:31
Various utility functions to implement the tecno flux.
Definition: types.hpp:30
FixedIntervalWriter(alsfvm::shared_ptr< Writer > &writer, real timeInterval, real endTime, bool writeInitialTimestep=true, real startTime=0)
Definition: FixedIntervalWriter.cpp:23
virtual ~FixedIntervalWriter()
Definition: FixedIntervalWriter.hpp:45
Definition: TimestepInformation.hpp:22