Alsvinn  0.5.3
The fast FVM simulator with UQ support
HDF5MPIWriter.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 "alsfvm/io/HDF5Writer.hpp"
21 #include <mpi.h>
22 
23 namespace alsfvm {
24 namespace io {
25 
29 class HDF5MPIWriter : public HDF5Writer {
30 public:
52  HDF5MPIWriter(const std::string& basefileName,
53  const std::vector<std::string>& groupNames,
54  size_t groupIndex,
55  bool newFile,
56  MPI_Comm mpiCommunicator,
57  MPI_Info mpiInfo);
58 
59  // We will inherit from this, hence virtual destructor.
60  virtual ~HDF5MPIWriter() {}
61 
62 
69  virtual void write(const volume::Volume& conservedVariables,
70  const grid::Grid& grid,
71  const simulator::TimestepInformation& timestepInformation) override;
72 
73 protected:
81  virtual std::unique_ptr<HDF5Resource> createDatasetForMemory(
82  const volume::Volume& volume, size_t index, const std::string& name,
83  hid_t file);
84 private:
85 
86  const std::vector<std::string> groupNames;
87  const size_t groupIndex;
88  const bool newFile;
89  MPI_Comm mpiCommunicator;
90  MPI_Info mpiInfo;
91 
92 };
93 
94 } // namespace io
95 } // namespace alsfvm
The HDF5Writer class writes output to HDF5 format.
Definition: HDF5Writer.hpp:31
Definition: Grid.hpp:27
The Volume class represents a volume (a collection of cells with values for each cell (eg...
Definition: Volume.hpp:30
The HDF5MPIWriter write to the HDF5 format with MPI support.
Definition: HDF5MPIWriter.hpp:29
virtual ~HDF5MPIWriter()
Definition: HDF5MPIWriter.hpp:60
virtual void write(const volume::Volume &conservedVariables, const grid::Grid &grid, const simulator::TimestepInformation &timestepInformation) override
write writes the data to disk
Definition: HDF5MPIWriter.cpp:46
std::string name
Definition: EquationParameterFactory.cpp:39
const std::string basefileName
Definition: HDF5Writer.hpp:145
const grid::Grid & grid
Definition: NumericalFluxFactory.cpp:104
virtual std::unique_ptr< HDF5Resource > createDatasetForMemory(const volume::Volume &volume, size_t index, const std::string &name, hid_t file)
createDatasetForMemroy creates a dataset for the given memory
Definition: HDF5MPIWriter.cpp:92
Various utility functions to implement the tecno flux.
Definition: types.hpp:30
HDF5MPIWriter(const std::string &basefileName, const std::vector< std::string > &groupNames, size_t groupIndex, bool newFile, MPI_Comm mpiCommunicator, MPI_Info mpiInfo)
HDF5MPIWriter constructs a new HDF5Writer.
Definition: HDF5MPIWriter.cpp:31
Definition: TimestepInformation.hpp:22