OpenLB 1.7
Loading...
Searching...
No Matches
blockGeometryStatistics2D.h
Go to the documentation of this file.
1/* This file is part of the OpenLB library
2 *
3 * Copyright (C) 2011, 2014 Mathias J. Krause, Simon Zimny
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
28#ifndef BLOCK_GEOMETRY_STATISTICS_2D_H
29#define BLOCK_GEOMETRY_STATISTICS_2D_H
30
31#include <vector>
32#include <map>
33#include <string>
34
35#include "io/ostreamManager.h"
36
37// All OpenLB code is contained in this namespace.
38namespace olb {
39
41
49template<typename T, unsigned D>
50class BlockGeometry;
51
52template<typename T>
54private:
56 BlockGeometry<T,2>* _blockGeometry{};
58 bool _statisticsUpdateNeeded{};
60 int _nX{}, _nY{};
62 T _h{};
63
65 int _nMaterials;
67 std::map<int, int> _material2n;
69 std::map<int, std::vector<int> > _material2min;
71 std::map<int, std::vector<int> > _material2max;
72
74 mutable OstreamManager clout;
75
76 const BlockGeometryStatistics2D<T>* const_this;
77
78public:
80
82 bool& getStatisticsStatus();
84 bool const & getStatisticsStatus() const;
86 std::map<int, int> getMaterial2n();
87 std::map<int, int> getMaterial2n() const;
88
90 void update(bool verbose=true);
91
93 int getNmaterials();
94 int getNmaterials() const;
96 int getNvoxel(int material);
97 int getNvoxel(int material) const ;
99 int getNvoxel();
100 int getNvoxel() const;
102 std::vector<int> getMinLatticeR(int material);
103 std::vector<int> getMinLatticeR(int material) const;
105 std::vector<int> getMaxLatticeR(int material);
106 std::vector<int> getMaxLatticeR(int material) const;
108 std::vector<T> getMinPhysR(int material) const;
110 std::vector<T> getMaxPhysR(int material) const;
112 std::vector<T> getLatticeExtend(int material);
113 std::vector<T> getLatticeExtend(int material) const;
115 std::vector<T> getPhysExtend(int material);
116 std::vector<T> getPhysExtend(int material) const;
118 std::vector<T> getPhysRadius(int material);
119 std::vector<T> getPhysRadius(int material) const;
121 std::vector<T> getCenterPhysR(int material);
122 std::vector<T> getCenterPhysR(int material) const;
124 std::vector<int> getType(const int* input) const;
125 std::vector<int> getType(int iX, int iY) const;
126
128 std::vector<int> computeNormal(int iX, int iY);
129 std::vector<int> computeNormal(int iX, int iY) const;
131 std::vector<T> computeNormal (int material);
132 std::vector<T> computeNormal (int material) const;
135 std::vector<int> computeDiscreteNormal (int material, T maxNorm = 1.1);
136 std::vector<int> computeDiscreteNormal (int material, T maxNorm = 1.1) const;
137
138 // Returns true if at position (iX,iY,iZ) and in a neighbourhood of size (offsetX,offsetY,offsetZ) only voxels of the given material are found
139 bool check(int material, int iX, int iY, unsigned offsetX, unsigned offsetY);
140 bool check(int material, int iX, int iY, unsigned offsetX, unsigned offsetY) const;
141
142 // Returns true and a position (iX,iY,iZ) if there is a neighbourhood of size (offsetX,offsetY,offsetZ) around (iX,iY,iZ) with only voxels of the given material
143 bool find(int material, unsigned offsetX, unsigned offsetY, int& iX, int& iY);
144 bool find(int material, unsigned offsetX, unsigned offsetY, int& iX, int& iY) const;
145
147 void print();
148 void print() const;
149
150private:
151
153 void takeStatistics(int iX, int iY);
154};
155
156} // namespace olb
157
158#endif
std::vector< int > computeNormal(int iX, int iY)
Returns normal that points into the fluid for paraxial surfaces.
std::vector< int > getMaxLatticeR(int material)
Returns the max. lattice position in each direction.
std::map< int, int > getMaterial2n()
Returns the map with the numbers of voxels for each material.
std::vector< int > getMinLatticeR(int material)
Returns the min. lattice position in each direction.
std::vector< T > getLatticeExtend(int material)
Returns the lattice extend as length in each direction.
bool & getStatisticsStatus()
Read and write access to a flag, which indicates if an uptate is needed (=true)
void print()
Prints some statistic information, i.e. the number of voxels and min. max. physical position for each...
std::vector< T > getCenterPhysR(int material)
Returns the center position.
bool check(int material, int iX, int iY, unsigned offsetX, unsigned offsetY)
int getNvoxel()
Returns the number of voxels with material!=0.
std::vector< T > getPhysRadius(int material)
Returns the phys radius as length in each direction.
std::vector< T > getPhysExtend(int material)
Returns the phys extend as length in each direction.
std::vector< T > getMaxPhysR(int material) const
Returns the max. phys position in each direction.
std::vector< T > getMinPhysR(int material) const
Returns the min. phys position in each direction.
void update(bool verbose=true)
Updates the statistics if it is really needed.
BlockGeometryStatistics2D(BlockGeometry< T, 2 > *blockGeometry)
int getNmaterials()
Returns the number of different materials.
std::vector< int > getType(const int *input) const
Returns the boundary type which is characterized by a discrete normal (c.f. Zimny)
std::vector< int > computeDiscreteNormal(int material, T maxNorm=1.1)
Returns discrete normal with norm maxNorm that points into the fluid for paraxial surfaces maxNorm=1....
bool find(int material, unsigned offsetX, unsigned offsetY, int &iX, int &iY)
Representation of a block geometry.
class for marking output with some text
Top level namespace for all of OpenLB.