Alsvinn  0.5.3
The fast FVM simulator with UQ support
StatisticsTimer.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
18 
19 namespace alsuq {
20 namespace stats {
21 
23 class StatisticsTimer : public Statistics {
24 public:
25  StatisticsTimer(const std::string& name,
26  std::shared_ptr<Statistics> statistics);
27 
29 
31  virtual void combineStatistics() override;
32 
37  virtual void addWriter(const std::string& name,
38  std::shared_ptr<alsfvm::io::Writer>& writer) override;
39 
42  virtual std::vector<std::string> getStatisticsNames() const override;
43 
44 
45  virtual void computeStatistics(const alsfvm::volume::Volume& conservedVariables,
46  const alsfvm::grid::Grid& grid,
47  const alsfvm::simulator::TimestepInformation& timestepInformation) override;
48 
51  virtual void finalizeStatistics() override;
52 
53  virtual void writeStatistics(const alsfvm::grid::Grid& grids) override;
54 
55 private:
56  std::string name;
57  const std::shared_ptr<Statistics> statistics;
58 
59  double statisticsTime = 0;
60  double combineTime = 0;
61  double finalizeTime = 0;
62 };
63 } // namespace stats
64 } // namespace alsuq
virtual void combineStatistics() override
To be called when the statistics should be combined.
Definition: StatisticsTimer.cpp:37
Definition: Grid.hpp:27
virtual void computeStatistics(const alsfvm::volume::Volume &conservedVariables, const alsfvm::grid::Grid &grid, const alsfvm::simulator::TimestepInformation &timestepInformation) override
Definition: StatisticsTimer.cpp:58
The Volume class represents a volume (a collection of cells with values for each cell (eg...
Definition: Volume.hpp:30
virtual void writeStatistics(const alsfvm::grid::Grid &grids) override
Definition: StatisticsTimer.cpp:84
~StatisticsTimer()
Definition: StatisticsTimer.cpp:30
const grid::Grid & grid
Definition: NumericalFluxFactory.cpp:104
StatisticsTimer(const std::string &name, std::shared_ptr< Statistics > statistics)
Definition: StatisticsTimer.cpp:24
virtual std::vector< std::string > getStatisticsNames() const override
Definition: StatisticsTimer.cpp:54
virtual void addWriter(const std::string &name, std::shared_ptr< alsfvm::io::Writer > &writer) override
Definition: StatisticsTimer.cpp:48
Simple timer class.
Definition: StatisticsTimer.hpp:23
Definition: Statistics.hpp:25
virtual void finalizeStatistics() override
Definition: StatisticsTimer.cpp:74
Definition: Setup.hpp:22
Definition: TimestepInformation.hpp:22