OpenLB 1.7
Loading...
Searching...
No Matches
postProcessing.h
Go to the documentation of this file.
1/* This file is part of the OpenLB library
2 *
3 * Copyright (C) 2006, 2007 Jonas Latt
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
27#ifndef POST_PROCESSING_H
28#define POST_PROCESSING_H
29
30#include <vector>
31
32#include "operator.h"
33#include "blockStructure.h"
34#include "blockLattice.h"
35#include "io/ostreamManager.h"
36
37namespace olb {
38
40
42template<typename T, typename DESCRIPTOR>
44public:
47 virtual ~PostProcessor2D() { }
49 virtual void process(BlockLattice<T,DESCRIPTOR>& blockLattice) =0;
51 virtual void processSubDomain(BlockLattice<T,DESCRIPTOR>& blockLattice,
52 int x0_, int x1_, int y0_, int y1_) =0;
54 virtual int extent() const =0;
56 virtual int extent(int direction) const =0;
58 std::string& getName();
60 std::string const& getName() const;
62 int getPriority() const;
63protected:
65private:
66 std::string _name;
67};
68
69template<typename T, typename DESCRIPTOR>
71public:
72 PostProcessorGenerator2D(int x0_, int x1_, int y0_, int y1_);
74 void shift(int deltaX, int deltaY);
75 void shift(LatticeR<2> delta);
76 bool extract(int x0_, int x1_, int y0_, int y1_);
77 bool extract(LatticeR<2> lower, LatticeR<2> upper);
78 void reset(int x0_, int x1_, int y0_, int y1_);
79 void reset(LatticeR<2> lower, LatticeR<2> upper);
82protected:
83 int x0, x1, y0, y1;
84};
85
86template<typename T, typename DESCRIPTOR>
88public:
89 LatticeCouplingGenerator2D(int x0_, int x1_, int y0_, int y1_);
91 void shift(LatticeR<2> delta);
92 void shift(int deltaX, int deltaY);
93 bool extract(int x0_, int x1_, int y0_, int y1_);
94 bool extract(LatticeR<2> lower, LatticeR<2> upper);
95 void reset(int x0_, int x1_, int y0_, int y1_);
96 void reset(LatticeR<2> lower, LatticeR<2> upper);
97 virtual PostProcessor2D<T,DESCRIPTOR>* generate(std::vector<BlockStructureD<2>*> partners) const =0;
99protected:
100 int x0, x1, y0, y1;
101};
102
103
104template<typename T, typename DESCRIPTOR>
105struct LocalPostProcessor2D : public PostProcessor2D<T,DESCRIPTOR> {
106};
107
108template<typename T, typename DESCRIPTOR>
109struct GlobalPostProcessor2D : public PostProcessor2D<T,DESCRIPTOR> {
110 void process(BlockLattice<T,DESCRIPTOR>& blockLattice) override =0;
112 int x0_, int x1_, int y0_, int y1_ ) override
113 {
114 this -> process(blockLattice);
115 }
116 int extent() const override
117 {
118 return 0;
119 }
120 int extent(int direction) const override
121 {
122 return 0;
123 }
124};
125
126
128
129template<typename T, typename DESCRIPTOR>
131public:
134 virtual ~PostProcessor3D() { }
136 virtual void process(BlockLattice<T,DESCRIPTOR>& blockLattice) =0;
139 int x0_, int x1_, int y0_, int y1_,
140 int z0_, int z1_ ) =0;
142 virtual int extent() const =0;
144 virtual int extent(int direction) const =0;
146 std::string& getName();
148 std::string const& getName() const;
150 int getPriority() const;
151protected:
153private:
154 std::string _name;
155};
156
157template<typename T, typename DESCRIPTOR>
159public:
160 PostProcessorGenerator3D( int x0_, int x1_, int y0_, int y1_,
161 int z0_, int z1_ );
163 void shift(int deltaX, int deltaY, int deltaZ, int iC_=-1);
164 void shift(LatticeR<3> delta, int iC_=-1);
165 bool extract(int x0_, int x1_, int y0_, int y1_, int z0_, int z1_);
166 bool extract(LatticeR<3> lower, LatticeR<3> upper);
167 void reset(int x0_, int x1_, int y0_, int y1_, int z0_, int z1_);
168 void reset(LatticeR<3> lower, LatticeR<3> upper);
171protected:
172 int x0, x1, y0, y1, z0, z1, iC;
173};
174
175
176template<typename T, typename DESCRIPTOR>
178public:
180 LatticeCouplingGenerator3D( int x0_, int x1_, int y0_, int y1_,
181 int z0_, int z1_ );
183 void shift(LatticeR<3> delta, int iC_=-1);
184 void shift(int deltaX, int deltaY, int deltaZ, int iC_=-1);
185 bool extract(int x0_, int x1_, int y0_, int y1_, int z0_, int z1_);
186 bool extract(LatticeR<3> lower, LatticeR<3> upper);
187 void reset(LatticeR<3> lower, LatticeR<3> upper);
188 void reset(int x0_, int x1_, int y0_, int y1_, int z0_, int z1_);
189 virtual PostProcessor3D<T,DESCRIPTOR>* generate(std::vector<BlockStructureD<3>*> partners) const =0;
191protected:
192 int x0, x1, y0, y1, z0, z1, iC;
193};
194
195
196template<typename T, typename DESCRIPTOR>
197struct LocalPostProcessor3D : public PostProcessor3D<T,DESCRIPTOR> {
198};
199
200template<typename T, typename DESCRIPTOR>
201struct GlobalPostProcessor3D : public PostProcessor3D<T,DESCRIPTOR> {
202 void process(BlockLattice<T,DESCRIPTOR>& blockLattice) override =0;
204 int x0_, int x1_, int y0_, int y1_,
205 int z0_, int z1_ ) override
206 {
207 this -> process(blockLattice);
208 }
209 int extent() const override
210 {
211 return 0;
212 }
213 int extent(int direction) const override
214 {
215 return 0;
216 }
217};
218
219
222
223 int getPriority() const {
224 return std::numeric_limits<int>::min();
225 }
226
227 template <typename BLOCK>
228 struct type {
229 void setup(BLOCK& blockLattice);
230 void apply(BLOCK& blockLattice);
231 };
232
233 template <typename BLOCK>
234 void setup(BLOCK& blockLattice) {
235 type<BLOCK>{}.setup(blockLattice);
236 }
237
238 template <typename BLOCK>
239 void apply(BLOCK& blockLattice) {
240 type<BLOCK>{}.apply(blockLattice);
241 }
242
243};
244
245
246} // namespace olb
247
248#endif
Platform-abstracted block lattice for external access and inter-block interaction.
Base of a regular block.
virtual PostProcessor2D< T, DESCRIPTOR > * generate(std::vector< BlockStructureD< 2 > * > partners) const =0
bool extract(int x0_, int x1_, int y0_, int y1_)
void shift(LatticeR< 2 > delta)
virtual LatticeCouplingGenerator2D< T, DESCRIPTOR > * clone() const =0
void reset(int x0_, int x1_, int y0_, int y1_)
LatticeCouplingGenerator2D(int x0_, int x1_, int y0_, int y1_)
virtual LatticeCouplingGenerator3D< T, DESCRIPTOR > * clone() const =0
void reset(LatticeR< 3 > lower, LatticeR< 3 > upper)
void shift(LatticeR< 3 > delta, int iC_=-1)
bool extract(int x0_, int x1_, int y0_, int y1_, int z0_, int z1_)
virtual PostProcessor3D< T, DESCRIPTOR > * generate(std::vector< BlockStructureD< 3 > * > partners) const =0
Interface of 2D post-processing steps.
virtual void processSubDomain(BlockLattice< T, DESCRIPTOR > &blockLattice, int x0_, int x1_, int y0_, int y1_)=0
Execute post-processing step on a sublattice.
std::string & getName()
read and write access to name
virtual int extent() const =0
Extent of application area (0 for purely local operations)
int getPriority() const
read only access to priority
virtual int extent(int direction) const =0
Extent of application area along a direction (0 or 1)
virtual void process(BlockLattice< T, DESCRIPTOR > &blockLattice)=0
Execute post-processing step.
virtual int extent(int direction) const =0
Extent of application area along a direction (0 or 1)
std::string & getName()
read and write access to name
virtual int extent() const =0
Extent of application area (0 for purely local operations)
virtual void processSubDomain(BlockLattice< T, DESCRIPTOR > &blockLattice, int x0_, int x1_, int y0_, int y1_, int z0_, int z1_)=0
Execute post-processing step on a sublattice.
int getPriority() const
read only access to priority
virtual void process(BlockLattice< T, DESCRIPTOR > &blockLattice)=0
Execute post-processing step.
bool extract(int x0_, int x1_, int y0_, int y1_)
void shift(int deltaX, int deltaY)
virtual PostProcessorGenerator2D< T, DESCRIPTOR > * clone() const =0
PostProcessorGenerator2D(int x0_, int x1_, int y0_, int y1_)
void reset(int x0_, int x1_, int y0_, int y1_)
virtual PostProcessor2D< T, DESCRIPTOR > * generate() const =0
bool extract(int x0_, int x1_, int y0_, int y1_, int z0_, int z1_)
PostProcessorGenerator3D(int x0_, int x1_, int y0_, int y1_, int z0_, int z1_)
void shift(int deltaX, int deltaY, int deltaZ, int iC_=-1)
virtual PostProcessorGenerator3D< T, DESCRIPTOR > * clone() const =0
virtual PostProcessor3D< T, DESCRIPTOR > * generate() const =0
void reset(int x0_, int x1_, int y0_, int y1_, int z0_, int z1_)
Plain old scalar vector.
Definition vector.h:47
Top level namespace for all of OpenLB.
OperatorScope
Block-wide operator application scopes.
Definition operator.h:54
@ PerBlock
Per-block application, i.e. OPERATOR::apply is passed a ConcreteBlockLattice.
int extent(int direction) const override
Extent of application area along a direction (0 or 1)
void processSubDomain(BlockLattice< T, DESCRIPTOR > &blockLattice, int x0_, int x1_, int y0_, int y1_) override
Execute post-processing step on a sublattice.
void process(BlockLattice< T, DESCRIPTOR > &blockLattice) override=0
Execute post-processing step.
int extent() const override
Extent of application area (0 for purely local operations)
void process(BlockLattice< T, DESCRIPTOR > &blockLattice) override=0
Execute post-processing step.
void processSubDomain(BlockLattice< T, DESCRIPTOR > &blockLattice, int x0_, int x1_, int y0_, int y1_, int z0_, int z1_) override
Execute post-processing step on a sublattice.
int extent(int direction) const override
Extent of application area along a direction (0 or 1)
int extent() const override
Extent of application area (0 for purely local operations)
void apply(BLOCK &blockLattice)
void setup(BLOCK &blockLattice)
static constexpr OperatorScope scope
void setup(BLOCK &blockLattice)
void apply(BLOCK &blockLattice)