OpenLB 1.7
Loading...
Searching...
No Matches
vtiReader.h
Go to the documentation of this file.
1/* This file is part of the OpenLB library
2 *
3 * Copyright (C) 2015 Mathias J. Krause, Benjamin Förster
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
54#ifndef VTI_READER_H
55#define VTI_READER_H
56
57#include <string>
58#include <vector>
59
60#include "io/xmlReader.h"
61#include "geometry/cuboid3D.h"
63#include "core/superData.h"
64#include "core/blockData.h"
65#include "io/ostreamManager.h"
67
68//typedef double T;
69namespace olb {
70
71template<typename T> class CuboidGeometry3D;
72//template<typename T> class Cuboid2D;
73template<typename T> class Cuboid3D;
74template<typename T> class LoadBalancer;
75template<typename T, typename BaseType> class SuperData3D;
76template<typename T, typename BaseType> class BlockData3D;
77
78template<typename T>
80public:
81 BaseVTIreader(const std::string& fName, int dim, std::string dName,
82 const std::string class_name="BaseVTIreader");
83 virtual ~BaseVTIreader() {};
84 void printInfo();
85protected:
87 /* Dimension (2D or 3D) */
88 int _dim;
90 int _size;
91 /* Origin */
92 std::vector<T> _origin;
93 /* #Nodes */
94 std::vector<int> _extent;
97 // Number of Cuboids
100 std::vector<int> readExtent(const XMLreader* reader, std::string extAttrName);
102 std::vector<int> getNbNodes(std::vector<int>& extents);
104 int getSize(const XMLreader& tag);
105};
106
107
108template<typename T, typename BaseType>
110public:
111 BaseVTIreader3D(const std::string& fName, std::string dName,
112 const std::string class_name="BaseVTIreader3D");
113 ~BaseVTIreader3D() override {};
114protected:
116 void readCuboid(Cuboid3D<T>& cuboid, XMLreader* piece);
118 bool readBlockData(BlockData<3,T,BaseType>& blockData, const XMLreader& pointDataTag,
119 const std::string dName);
120};
121
122
123
124template<typename T, typename BaseType>
125class BlockVTIreader3D : public BaseVTIreader3D<T,BaseType> {
126public:
127 BlockVTIreader3D(const std::string& fName, const std::string& dName);
128 ~BlockVTIreader3D() override {};
131protected:
134};
135
136
137template<typename T, typename BaseType>
138class SuperVTIreader3D : public BaseVTIreader3D<T,BaseType> {
139private:
140 CuboidGeometry3D<T>* _cGeometry;
141 LoadBalancer<T>* _loadBalancer;
142 SuperData<3,T,BaseType>* _superData;
143public:
144 SuperVTIreader3D(const std::string& fName, const std::string dName);
145 ~SuperVTIreader3D() override;
149private:
151 void readCuboidGeometry();
153 void readSuperData(const std::string dName);
154};
155
156
157
158
159
160
161
162
163
164
166/*
167template<typename T>
168class VTIreader2D : public XMLreader {
169public:
170 VTIreader2D();
171 VTIreader2D(const std::string& fName);
172 ~VTIreader2D();
173
174 void getCuboid(Cuboid2D<T>& cuboid);
175 void getCuboids(std::vector<Cuboid2D<T>* >& cuboids);
176 //bool getScalarData(ScalarField2D<T>* base, const std::string dName);
177 //bool getVectorData(TensorField2D<T, 2>* base, const std::string dName);
178 //void getScalarMultiPieceData(std::vector<const ScalarFieldBase2D<T>* >& bases, const std::string dName);
179 //void getVectorMultiPieceData(std::vector<const TensorFieldBase2D<T, 2>* >& bases, const std::string dName);
180 void printInfo();
181private:
182 int _x0, _y0, _z0;
183 int _x, _y, _z;
184 T _delta;
185};
186*/
187} // namespace olb
188
189#endif
~BaseVTIreader3D() override
Definition vtiReader.h:113
BaseVTIreader3D(const std::string &fName, std::string dName, const std::string class_name="BaseVTIreader3D")
Definition vtiReader.hh:145
bool readBlockData(BlockData< 3, T, BaseType > &blockData, const XMLreader &pointDataTag, const std::string dName)
Reads from pointDataTag and fills blockData.
Definition vtiReader.hh:169
void readCuboid(Cuboid3D< T > &cuboid, XMLreader *piece)
Reads cuboid from piece node.
Definition vtiReader.hh:152
std::vector< int > getNbNodes(std::vector< int > &extents)
Converts 4D (or 6D) extents vector into 2D (3D) nb_nodes vector.
Definition vtiReader.hh:118
int _size
Size of Data Field.
Definition vtiReader.h:90
std::vector< T > _origin
Definition vtiReader.h:92
OstreamManager clout
Definition vtiReader.h:86
virtual ~BaseVTIreader()
Definition vtiReader.h:83
std::vector< int > readExtent(const XMLreader *reader, std::string extAttrName)
Reads Extent from extAttrName from XML Tag and returns as vector.
Definition vtiReader.hh:103
std::vector< int > _extent
Definition vtiReader.h:94
XMLreader _xmlReader
Definition vtiReader.h:96
BaseVTIreader(const std::string &fName, int dim, std::string dName, const std::string class_name="BaseVTIreader")
Definition vtiReader.hh:47
int getSize(const XMLreader &tag)
Reads size from XML tag (attribute "NumberOfComponents")
Definition vtiReader.hh:129
Cuboid3D< T > & getCuboid()
Definition vtiReader.hh:230
BlockVTIreader3D(const std::string &fName, const std::string &dName)
Definition vtiReader.hh:213
BlockData< 3, T, BaseType > _blockData
Definition vtiReader.h:133
~BlockVTIreader3D() override
Definition vtiReader.h:128
BlockData< 3, T, BaseType > & getBlockData()
Definition vtiReader.hh:224
Cuboid3D< T > _cuboid
Definition vtiReader.h:132
A regular single 3D cuboid is the basic component of a 3D cuboid structure which defines the grid.
Definition cuboid3D.h:58
A cuboid geometry represents a voxel mesh.
Base class for all LoadBalancer.
class for marking output with some text
~SuperVTIreader3D() override
Definition vtiReader.hh:239
LoadBalancer< T > & getLoadBalancer()
Definition vtiReader.hh:324
SuperData< 3, T, BaseType > & getSuperData()
Definition vtiReader.hh:312
SuperVTIreader3D(const std::string &fName, const std::string dName)
Definition vtiReader.hh:247
CuboidGeometry3D< T > & getCuboidGeometry()
Definition vtiReader.hh:318
The description of a single 3D cuboid – header file.
The description of a vector of 3D cuboid – header file.
Top level namespace for all of OpenLB.
Dynamics for a generic 2D super data – header file.
Input/Output in XML format – header file.