OpenLB 1.8.1
Loading...
Searching...
No Matches
vtuPointWriter.h
Go to the documentation of this file.
1/* This file is part of the OpenLB library
2 *
3 * Copyright (C) 2024 Christoph Gaul
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
24#ifndef VTU_POINT_WRITER_H
25#define VTU_POINT_WRITER_H
26
31#include "io/base64.hh"
32#include "core/vector.h"
33namespace olb {
34
35template <typename T, typename W, int dim>
37
38template<typename T, typename W>
39class VTUpointWriter<T,W,2>{
40protected:
41 std::string _name;
42 std::vector<SuperF2D<T,W>*> functors;
43 std::vector<AnalyticalF2D<T,W>*> functorsA;
44 std::vector<Vector<T,2>> pos;
45 bool _binary;
47
48 // performes <VTKFile ...> and <Collection>
49 void preamblePVD(const std::string& fullNamePVD);
50 // performes </Collection> and </VTKFile>
51 void closePVD(const std::string& fullNamePVD);
53 void preambleVTU(const std::string& fullName, int num);
55 void closeVTU(const std::string& fullNamePiece);
57 void dataPVD(int iT, int i, const std::string& fullNamePVD,
58 const std::string& namePiece);
60 void dataPVDmaster(int iT, int i, const std::string& fullNamePVDMaster,
61 const std::string& namePiece);
62 void dataArray( const std::string& fullName );
64 void writeFunctor( const std::string& fullName, std::ofstream& fout , SuperF2D<T,W>& f );
65 void writeAnalyticalFunctor( const std::string& fullName, std::ofstream& fout , AnalyticalF2D<T,W>& f );
67 void writePosition( std::ofstream& fout );
68
69public:
70 VTUpointWriter( std::string const name,
71 bool binary = false);
72
73 void createMasterFile();
75 void write( std::size_t iT, std::vector<Vector<T,2>>& new_positions );
76 void write(std::size_t iT );
78 void addFunctor( AnalyticalF2D<T,W>& f, const std::string& name );
79 void addFunctor( AnalyticalF2D<T,W>& f );
80 void addFunctor( SuperF2D<T,W>& f, const std::string& name );
81 void addFunctor( SuperF2D<T,W>& f );
83 void addPoint( Vector<T,2>& new_position );
84 void addPoints( std::vector<olb::Vector<T,2>>& new_positions );
85};
86
87template<typename T, typename W>
88class VTUpointWriter<T,W,3>{
89protected:
90 std::string _name;
91 std::vector<SuperF3D<T,W>*> functors;
92 std::vector<AnalyticalF3D<T,W>*> functorsA;
93 std::vector<Vector<T,3>> pos;
94 bool _binary;
96
97 // performes <VTKFile ...> and <Collection>
98 void preamblePVD(const std::string& fullNamePVD);
99 // performes </Collection> and </VTKFile>
100 void closePVD(const std::string& fullNamePVD);
102 void preambleVTU(const std::string& fullName, int num);
104 void closeVTU(const std::string& fullNamePiece);
106 void dataPVD(int iT, int i, const std::string& fullNamePVD,
107 const std::string& namePiece);
109 void dataPVDmaster(int iT, int i, const std::string& fullNamePVDMaster,
110 const std::string& namePiece);
111 void dataArray( const std::string& fullName );
113 void writeFunctor( const std::string& fullName, std::ofstream& fout , SuperF3D<T,W>& f );
114 void writeAnalyticalFunctor( const std::string& fullName, std::ofstream& fout , AnalyticalF3D<T,W>& f );
116 void writePosition( std::ofstream& fout );
117
118public:
119 VTUpointWriter( std::string const name,
120 bool binary = false);
121
122 void createMasterFile();
124 void write(std::size_t iT, std::vector<Vector<T,3>>& new_positions );
125 void write(std::size_t iT );
127 void addFunctor( AnalyticalF3D<T,W>& f, const std::string& name );
128 void addFunctor( AnalyticalF3D<T,W>& f );
129 void addFunctor( SuperF3D<T,W>& f, const std::string& name );
130 void addFunctor( SuperF3D<T,W>& f );
132 void addPoint( Vector<T,3>& new_position );
133 void addPoints( std::vector<Vector<T,3>>& new_positions );
134};
135
136
137}
138
139#endif
AnalyticalF are applications from DD to XD, where X is set by the constructor.
class for marking output with some text
represents all functors that operate on a SuperStructure<T,2> in general
Definition aliases.h:183
represents all functors that operate on a SuperStructure<T,3> in general
Definition aliases.h:184
void write(std::size_t iT, std::vector< Vector< T, 2 > > &new_positions)
write function to call during runtime, also accepts additional points during call
std::vector< SuperF2D< T, W > * > functors
void write(std::size_t iT)
std::vector< AnalyticalF2D< T, W > * > functorsA
std::vector< Vector< T, 2 > > pos
std::vector< AnalyticalF3D< T, W > * > functorsA
std::vector< Vector< T, 3 > > pos
void write(std::size_t iT, std::vector< Vector< T, 3 > > &new_positions)
write function to call during runtime, also accepts additional points during call
void write(std::size_t iT)
std::vector< SuperF3D< T, W > * > functors
Plain old scalar vector.
Top level namespace for all of OpenLB.
efficient implementation of a vector class