OpenLB 1.8.1
Loading...
Searching...
No Matches
superVtmWriter2D.h
Go to the documentation of this file.
1/* This file is part of the OpenLB library
2 *
3 * Copyright (C) 2016 Albert Mink, Mathias J. Krause
4 * E-mail contact: info@openlb.net
5 * The most recent release of OpenLB can be downloaded at
6 * <http://www.openlb.net/>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public
19 * License along with this program; if not, write to the Free
20 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 * Boston, MA 02110-1301, USA.
22*/
23
29#ifndef SUPER_VTM_WRITER_2D_H
30#define SUPER_VTM_WRITER_2D_H
31
32#include <sstream>
33#include <vector>
34#include "io/ostreamManager.h"
36
37namespace olb {
38
50template<typename T, typename OUT_T=float, typename W=T>
51class SuperVTMwriter2D {
52public:
53 SuperVTMwriter2D( std::string name, int overlap = 1, bool binary = true );
57 void write(int iT=0);
58 void write(std::vector<T> rMin, std::vector<T> rMax, int iT=0);
60 void write(SuperF2D<T,W>& f, int iT=0);
61 void write(SuperF2D<T,W>& f, std::vector<T> rMin, std::vector<T> rMax, int iT=0);
62 void write(std::shared_ptr<SuperF2D<T,W>> ptr_f, int iT=0);
63 void write(std::shared_ptr<SuperF2D<T,W>> ptr_f, std::vector<T> rMin, std::vector<T> rMax, int iT=0);
65 // the master pvd file, where all vti are linked!
66 void createMasterFile();
69 void addFunctor(SuperF2D<T,W>& f);
72 void addFunctor(SuperF2D<T,W>& f, const std::string& functorName);
74 void clearAddedFunctors();
76 std::string getName() const;
77private:
79 void extremes(int nMinOut[], int nMaxOut[], CuboidDecomposition2D<T> const& cGeometry, LoadBalancer<T>& load, std::vector<T> rMin, std::vector<T> rMax, int iCloc);
81 void preambleVTI(const std::string& fullName, int x0, int y0, int x1, int y1,
82 T originX, T originY, T delta);
84 void closeVTI(const std::string& fullNamePiece);
86 void preamblePVD(const std::string& fullNamePVD);
88 void closePVD(const std::string& fullNamePVD);
90 void preambleVTM(const std::string& fullNamePVD);
92 void closeVTM(const std::string& fullNamePVD);
95 void dataVTM(int iC, const std::string& fullNamePVD, const std::string& namePiece);
98 void dataPVDmaster(int iT, const std::string& fullNamePVDMaster,
99 const std::string& namePiece);
101 void dataArray(const std::string& fullName, SuperF2D<T,W>& f,
102 int iC, int nxMin, int nxMax, int nyMin, int nyMax);
104 void dataArrayBinary(const std::string& fullName, SuperF2D<T,W>& f,
105 int iC, int nxMin, int nxMax, int nyMin, int nyMax);
107 void closePiece(const std::string& fullNamePiece);
108private:
109 mutable OstreamManager clout;
111 bool _createFile;
113 std::string _name;
115 std::vector< SuperF2D<T,W>* > _pointerVec;
116 int _overlap;
117 bool _binary =true;
118};
119
121template <typename T, typename W>
122void writeVTK(SuperF2D<T,W>& f, int iT=0) {
123 SuperVTMwriter2D<T> writer("");
124 writer.write(f, iT);
125}
126
127} // namespace olb
128
129
130#endif
represents all functors that operate on a SuperStructure<T,2> in general
Definition aliases.h:183
SuperVTMwriter2D writes any SuperF2D to vtk-based output files.
Definition aliases.h:74
void createMasterFile()
have to be called before calling write(int iT=0), since it creates
void write(int iT=0)
writes functors stored in pointerVec every thread writes a vti file with data from his cuboids the vt...
SuperVTMwriter2D(std::string name, int overlap=1, bool binary=true)
void clearAddedFunctors()
to clear stored functors, not yet used due to lack of necessity
std::string getName() const
getter for _name
void addFunctor(SuperF2D< T, W > &f)
put functor to _pointerVec to simplify writing process of several functors
Top level namespace for all of OpenLB.
CuboidDecomposition< T, 2 > CuboidDecomposition2D
void writeVTK(SuperF2D< T, W > &f, int iT=0)
Write out functor F to VTK file (helper)