Alsvinn  0.5.3
The fast FVM simulator with UQ support
Writer.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 #include "alsfvm/volume/Volume.hpp"
19 #include "alsfvm/grid/Grid.hpp"
20 #include <boost/property_tree/ptree.hpp>
21 
22 namespace alsfvm {
23 namespace io {
24 
28 class Writer {
29 public:
30  static std::string getClassName() {
31  return "Writer";
32  }
33  // We will inherit from this, hence virtual destructor.
34  virtual ~Writer() {}
35 
36 
43  virtual void write(const volume::Volume& conservedVariables,
44  const grid::Grid& grid,
45  const simulator::TimestepInformation& timestepInformation) = 0;
46 
47 
49  virtual void finalize(const grid::Grid& grid,
50  const simulator::TimestepInformation& timestepInformation) {}
51 
56  void addAttributes(const std::string& nameOfAttributes,
57  const boost::property_tree::ptree& attributes);
58 
59 protected:
60  std::map<std::string, boost::property_tree::ptree> attributesMap;
61 
62 };
63 
64 typedef alsfvm::shared_ptr<Writer> WriterPointer;
65 
66 } // namespace io
67 } // namespace alsfvm
Definition: Grid.hpp:27
The Volume class represents a volume (a collection of cells with values for each cell (eg...
Definition: Volume.hpp:30
std::map< std::string, boost::property_tree::ptree > attributesMap
Definition: Writer.hpp:60
virtual void finalize(const grid::Grid &grid, const simulator::TimestepInformation &timestepInformation)
This method should be called at the end of the simulation.
Definition: Writer.hpp:49
virtual void write(const volume::Volume &conservedVariables, const grid::Grid &grid, const simulator::TimestepInformation &timestepInformation)=0
write writes the data to disk
const grid::Grid & grid
Definition: NumericalFluxFactory.cpp:104
The Writer class is an abstract interface to represent output writers.
Definition: Writer.hpp:28
static std::string getClassName()
Definition: Writer.hpp:30
Various utility functions to implement the tecno flux.
Definition: types.hpp:30
virtual ~Writer()
Definition: Writer.hpp:34
alsfvm::shared_ptr< Writer > WriterPointer
Definition: Writer.hpp:64
Definition: TimestepInformation.hpp:22
void addAttributes(const std::string &nameOfAttributes, const boost::property_tree::ptree &attributes)
Definition: Writer.cpp:22