OpenLB 1.7
Loading...
Searching...
No Matches
indicatorF2D.h
Go to the documentation of this file.
1/* This file is part of the OpenLB library
2 *
3 * Copyright (C) 2016 Thomas Henn, Cyril Masquelier, Jan Marquardt, Mathias J. Krause,
4 * Davide Dapelo
5 * E-mail contact: info@openlb.net
6 * The most recent release of OpenLB can be downloaded at
7 * <http://www.openlb.net/>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public
20 * License along with this program; if not, write to the Free
21 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22 * Boston, MA 02110-1301, USA.
23*/
24
25#ifndef INDICATOR_F_2D_H
26#define INDICATOR_F_2D_H
27
28#include<vector>
29#include "indicatorBaseF2D.h"
30#include "io/xmlReader.h"
31
32#include "core/blockData.h"
33#include "core/unitConverter.h"
34#include "indicatorBaseF3D.h"
35
52namespace olb {
53
56template <typename S>
58private:
59 IndicatorF3D<S>& _indicator3D;
60public:
62
63 bool operator() (bool output[], const S input[]) override;
64};
65
68template <typename S>
70private:
71 const Vector<S,2> _center;
72 const S _xLength;
73 const S _yLength;
74 const S _theta;
75public:
77 IndicatorCuboid2D(Vector<S,2> extend, Vector<S,2> origin, S theta=0);
79 IndicatorCuboid2D(S xlength, S ylength, Vector<S,2> center= {S(), S()}, S theta=0);
81 bool operator() (bool output[], const S input[]) override;
82 Vector<S,2> const& getCenter() const;
83 S const getxLength() const;
84 S const getyLength() const;
85 S signedDistance(const Vector<S,2>& input) override;
86};
87
88
90template <typename S>
92private:
93 const Vector<S,2> _center;
94 const S _radius;
95 const S _radius2;
96public:
97 IndicatorCircle2D(Vector<S,2> center, S radius);
98 Vector<S,2> const& getCenter() const;
99 S const getRadius() const;
100 bool operator() (bool output[], const S input[]) override;
101 bool distance(S& distance, const Vector<S,2>& origin, const Vector<S,2>& direction, int iC=-1) override;
102 bool normal(Vector<S,2>& normal, const Vector<S,2>& origin, const Vector<S,2>& direction, int iC=-1) override;
103 S signedDistance(const Vector<S,2>& input) override;
104 using IndicatorF2D<S>::distance;
105};
106
107
109template <typename S>
111private:
112 const Vector<S,2> _a;
113 const Vector<S,2> _b;
114 const Vector<S,2> _c;
115public:
117 Vector<S,2> const& getVertexA() const;
118 Vector<S,2> const& getVertexB() const;
119 Vector<S,2> const& getVertexC() const;
120 bool operator() (bool output[], const S input[]) override;
121 S signedDistance(const Vector<S,2>& input) override;
122};
123
125template <typename S>
127private:
128 const Vector<S,2> _center;
129 const S _radius;
130 const Vector<S,2> _a;
131 const Vector<S,2> _b;
132 const Vector<S,2> _c;
133
134public:
135 IndicatorEquiTriangle2D(Vector<S,2> center, S radius);
136 Vector<S,2> const& getVertexA() const;
137 Vector<S,2> const& getVertexB() const;
138 Vector<S,2> const& getVertexC() const;
139 Vector<S,2> const& getCenter() const;
140 S const getRadius() const;
141 bool operator() (bool output[], const S input[]) override;
142 S signedDistance(const Vector<S,2>& input) override;
143};
144
146template <typename S>
148private:
149 BlockData<3,S,S>& _blockData;
150 S const _deltaR;
151 bool const _invert;
152
153public:
155 Vector<S,3> extend, Vector<S,3> origin, S deltaR, bool invert);
156 S signedDistance(const Vector<S,2>& input) override;
157};
158
159
160
165template <typename S>
167private:
168 IndicatorF2D<S>& _indicatorF;
169 S _layerSize;
170 bool _isPositive;
171public:
172 IndicatorLayer2D(IndicatorF2D<S>& indicatorF, S layerSize);
173 bool operator() (bool output[], const S input[]) override;
174};
175
176
177template <typename T>
178class IndicatorSDF2D : public IndicatorF2D<T> {
179private:
180 std::function<T(Vector<T, 2>)> _f;
181
182public:
183 IndicatorSDF2D(std::function<T(Vector<T, 2>)> f);
184
185 bool operator()(bool output[], const T input[]) override;
186};
187
189template <typename S>
190IndicatorCuboid2D<S>* createIndicatorCuboid2D(XMLreader const& params, bool verbose=false);
191
192template <typename S>
193IndicatorCircle2D<S>* createIndicatorCircle2D(XMLreader const& params, bool verbose=false);
194
195
196}
197
198#endif
indicator from VTIreader
IndicatorBlockData2D(BlockData< 3, S, S > &blockData, Vector< S, 3 > extend, Vector< S, 3 > origin, S deltaR, bool invert)
S signedDistance(const Vector< S, 2 > &input) override
Returns signed distance to the nearest point on the indicator surface.
indicator function for a 2D circle
bool normal(Vector< S, 2 > &normal, const Vector< S, 2 > &origin, const Vector< S, 2 > &direction, int iC=-1) override
returns true and the normal if there was one found for an given origin and direction
IndicatorCircle2D(Vector< S, 2 > center, S radius)
S signedDistance(const Vector< S, 2 > &input) override
Returns signed distance to the nearest point on the indicator surface.
S const getRadius() const
bool distance(S &distance, const Vector< S, 2 > &origin, const Vector< S, 2 > &direction, int iC=-1) override
bool operator()(bool output[], const S input[]) override
has to be implemented for 'every' derived class
Vector< S, 2 > const & getCenter() const
indicator function for a 2D-cuboid, parallel to the planes x=0, y=0; theta rotates cuboid around its ...
bool operator()(bool output[], const S input[]) override
returns true if input is inside, otherwise false
S const getxLength() const
S const getyLength() const
Vector< S, 2 > const & getCenter() const
IndicatorCuboid2D(Vector< S, 2 > extend, Vector< S, 2 > origin, S theta=0)
constructs an cuboid with x axis dimension 0 to extend[0], ...
S signedDistance(const Vector< S, 2 > &input) override
Returns signed distance to the nearest point on the indicator surface.
indicator function for a 2D equilateral triangle
Vector< S, 2 > const & getCenter() const
S signedDistance(const Vector< S, 2 > &input) override
Returns signed distance to the nearest point on the indicator surface.
bool operator()(bool output[], const S input[]) override
has to be implemented for 'every' derived class
Vector< S, 2 > const & getVertexA() const
IndicatorEquiTriangle2D(Vector< S, 2 > center, S radius)
Vector< S, 2 > const & getVertexB() const
Vector< S, 2 > const & getVertexC() const
IndicatorF2D is an application from .
indicator function for a 2D-cuboid, parallel to the planes x=0, y=0; theta rotates cuboid around its ...
bool operator()(bool output[], const S input[]) override
has to be implemented for 'every' derived class
IndicatorF2DfromIndicatorF3D(IndicatorF3D< S > &indicator3D)
IndicatorF3D is an application from .
Indicator function creating an layer around an input indicator (for positive layerSize) or reducing t...
bool operator()(bool output[], const S input[]) override
has to be implemented for 'every' derived class
IndicatorLayer2D(IndicatorF2D< S > &indicatorF, S layerSize)
IndicatorSDF2D(std::function< T(Vector< T, 2 >)> f)
bool operator()(bool output[], const T input[]) override
indicator function for a 2D triangle
bool operator()(bool output[], const S input[]) override
has to be implemented for 'every' derived class
Vector< S, 2 > const & getVertexC() const
IndicatorTriangle2D(Vector< S, 2 > a, Vector< S, 2 > b, Vector< S, 2 > c)
Vector< S, 2 > const & getVertexA() const
Vector< S, 2 > const & getVertexB() const
S signedDistance(const Vector< S, 2 > &input) override
Returns signed distance to the nearest point on the indicator surface.
Plain old scalar vector.
Definition vector.h:47
Top level namespace for all of OpenLB.
IndicatorCuboid2D< S > * createIndicatorCuboid2D(XMLreader const &params, bool verbose=false)
IndicatorCircle2D< S > * createIndicatorCircle2D(XMLreader const &params, bool verbose=false)
Unit conversion handling – header file.
Input/Output in XML format – header file.