Alsvinn  0.5.3
The fast FVM simulator with UQ support
CoarseGrainingIntervalWriter.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 
38 public:
46  CoarseGrainingIntervalWriter(alsfvm::shared_ptr<Writer>& writer,
47  real timeInterval,
48  int numberOfCoarseSaves,
49  real endTime,
50  int numberOfSkips);
51 
59  virtual void write(const volume::Volume& conservedVariables,
60  const grid::Grid& grid,
61  const simulator::TimestepInformation& timestepInformation);
62 
63  virtual real adjustTimestep(real dt,
64  const simulator::TimestepInformation& timestepInformation) const;
65 
66  virtual void finalize(const grid::Grid& grid,
67  const simulator::TimestepInformation& timestepInformation) override;
68 private:
69  alsfvm::shared_ptr<Writer> writer;
70  const real timeInterval;
71  const int numberOfCoarseSaves;
72  const int numberOfSkips;
73 
74  int numberSaved{0};
75  int numberSmallSaved{0};
76  bool first{true};
77  real dx;
78 };
79 } // namespace alsfvm
80 } // namespace io
virtual real adjustTimestep(real dt, const simulator::TimestepInformation &timestepInformation) const
adjustTimestep returns the new timestep that the simulator should use
Definition: CoarseGrainingIntervalWriter.cpp:77
The CoarseGrainingIntervalWriter class is a decorator for another writer. Its purpose is to only call...
Definition: CoarseGrainingIntervalWriter.hpp:36
Definition: Grid.hpp:27
CoarseGrainingIntervalWriter(alsfvm::shared_ptr< Writer > &writer, real timeInterval, int numberOfCoarseSaves, real endTime, int numberOfSkips)
Definition: CoarseGrainingIntervalWriter.cpp:24
The Volume class represents a volume (a collection of cells with values for each cell (eg...
Definition: Volume.hpp:30
virtual void write(const volume::Volume &conservedVariables, const grid::Grid &grid, const simulator::TimestepInformation &timestepInformation)
write writes the data to disk
Definition: CoarseGrainingIntervalWriter.cpp:36
virtual void finalize(const grid::Grid &grid, const simulator::TimestepInformation &timestepInformation) override
This method should be called at the end of the simulation.
Definition: CoarseGrainingIntervalWriter.cpp:90
double real
Definition: types.hpp:65
const grid::Grid & grid
Definition: NumericalFluxFactory.cpp:104
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
virtual ~CoarseGrainingIntervalWriter()
Definition: CoarseGrainingIntervalWriter.hpp:52
Definition: TimestepInformation.hpp:22