OpenLB 1.7
Loading...
Searching...
No Matches
indicCalc2D.h
Go to the documentation of this file.
1/* This file is part of the OpenLB library
2 *
3 * Copyright (C) 2014-2016 Mathias J. Krause, Cyril Masquelier,
4 * Benjamin Förster, Albert Mink
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 INDIC_CALC_2D_H
26#define INDIC_CALC_2D_H
27
28#include "indicatorBaseF2D.h"
30
31namespace olb {
32
33
34/*
35 * arithmetic helper classes for IndicatorF1D, IndicatorF2D, smoothIndicator2D
36 * UNION +
37 * WITHOUT -
38 * INTERSECTION *
39*/
40
43template <typename S>
44class IndicCalc1D : public IndicatorF1D<S> {
45protected:
48public:
49 // set image/target dimensions of IndicCalc1D as well
51};
52
54template <typename S>
55class IndicPlus1D : public IndicCalc1D<S> {
56public:
58 bool operator() (bool output[], const S input[]) override;
59};
60
62template <typename S>
63class IndicMinus1D : public IndicCalc1D<S> {
64public:
66 bool operator() (bool output[], const S input[]) override;
67};
68
70template <typename S>
72public:
74 bool operator() (bool output[], const S input[]) override;
75};
76
77
78
81template <typename S, template<typename> class F>
82class IndicCalc2D : public IndicatorF2D<S> {
83protected:
84 IndicCalc2D( std::shared_ptr<IndicatorF2D<S>> f, std::shared_ptr<IndicatorF2D<S>> g );
85 std::shared_ptr<IndicatorF2D<S>> _f;
86 std::shared_ptr<IndicatorF2D<S>> _g;
87public:
88 virtual S signedDistance( const Vector<S,2>& input )=0;
89 bool operator() (bool output[], const S input[3]);
90};
91
93template <typename S>
94class IndicPlus2D : public IndicCalc2D<S,util::plus> {
95public:
96 IndicPlus2D( std::shared_ptr<IndicatorF2D<S>> f, std::shared_ptr<IndicatorF2D<S>> g );
97 S signedDistance( const Vector<S,2>& input ) override;
98};
99
101template <typename S>
102class IndicMinus2D : public IndicCalc2D<S,util::minus> {
103public:
104 IndicMinus2D( std::shared_ptr<IndicatorF2D<S>> f, std::shared_ptr<IndicatorF2D<S>> g );
105 S signedDistance( const Vector<S,2>& input ) override;
106};
107
109template <typename S>
110class IndicMultiplication2D : public IndicCalc2D<S,util::multiplies> {
111public:
112 IndicMultiplication2D( std::shared_ptr<IndicatorF2D<S>> f, std::shared_ptr<IndicatorF2D<S>> g );
113 S signedDistance( const Vector<S,2>& input ) override;
114};
115
116template<typename S, template <typename U> class F1, template <typename V> class F2,
117 typename=typename std::enable_if<std::is_base_of<IndicatorF2D<S>, F1<S>>::value>::type>
118std::shared_ptr<IndicatorF2D<S>> operator+(std::shared_ptr<F1<S>> lhs, std::shared_ptr<F2<S>> rhs);
119
120template<typename S, template <typename U> class F1, template <typename V> class F2,
121 typename=typename std::enable_if<std::is_base_of<IndicatorF2D<S>, F1<S>>::value>::type>
122std::shared_ptr<IndicatorF2D<S>> operator-(std::shared_ptr<F1<S>> lhs, std::shared_ptr<F2<S>> rhs);
123
124template<typename S, template <typename U> class F1, template <typename V> class F2,
125 typename=typename std::enable_if<std::is_base_of<IndicatorF2D<S>, F1<S>>::value>::type>
126std::shared_ptr<IndicatorF2D<S>> operator*(std::shared_ptr<F1<S>> lhs, std::shared_ptr<F2<S>> rhs);
127
128template<typename S, template <typename U> class F1, template <typename V> class F2,
129 typename=typename std::enable_if<std::is_base_of<IndicatorIdentity2D<S>, F1<S>>::value>::type>
130std::shared_ptr<IndicatorF2D<S>> operator+(F1<S> & lhs, std::shared_ptr<F2<S>> rhs);
131
132template<typename S, template <typename U> class F1, template <typename V> class F2,
133 typename=typename std::enable_if<std::is_base_of<IndicatorIdentity2D<S>, F1<S>>::value>::type>
134std::shared_ptr<IndicatorF2D<S>> operator-(F1<S> & lhs, std::shared_ptr<F2<S>> rhs);
135
136template<typename S, template <typename U> class F1, template <typename V> class F2,
137 typename=typename std::enable_if<std::is_base_of<IndicatorIdentity2D<S>, F1<S>>::value>::type>
138std::shared_ptr<IndicatorF2D<S>> operator*(F1<S> & lhs, std::shared_ptr<F2<S>> rhs);
139
140
141} // end namespace olb
142
143#endif
IndicCalc1D //////////////////////////////// arithmetic helper class for Indicator 1d functors.
Definition indicCalc2D.h:44
IndicCalc1D(IndicatorF1D< S > &f, IndicatorF1D< S > &g)
IndicatorF1D< S > & _f
Definition indicCalc2D.h:46
IndicatorF1D< S > & _g
Definition indicCalc2D.h:47
indicCalc2D //////////////////////////////// arithmetic helper class for Indicator 2D functors
Definition indicCalc2D.h:82
virtual S signedDistance(const Vector< S, 2 > &input)=0
Returns signed distance to the nearest point on the indicator surface.
std::shared_ptr< IndicatorF2D< S > > _f
Definition indicCalc2D.h:85
std::shared_ptr< IndicatorF2D< S > > _g
Definition indicCalc2D.h:86
bool operator()(bool output[], const S input[3])
IndicCalc2D(std::shared_ptr< IndicatorF2D< S > > f, std::shared_ptr< IndicatorF2D< S > > g)
subtraction functor acts as without
Definition indicCalc2D.h:63
IndicMinus1D(IndicatorF1D< S > &f, IndicatorF1D< S > &g)
bool operator()(bool output[], const S input[]) override
has to be implemented for 'every' derived class
Subtraction.
S signedDistance(const Vector< S, 2 > &input) override
Returns signed distance to the nearest point on the indicator surface.
IndicMinus2D(std::shared_ptr< IndicatorF2D< S > > f, std::shared_ptr< IndicatorF2D< S > > g)
multiplication functor acts as intersection
Definition indicCalc2D.h:71
bool operator()(bool output[], const S input[]) override
has to be implemented for 'every' derived class
IndicMultiplication1D(IndicatorF1D< S > &f, IndicatorF1D< S > &g)
IndicMultiplication2D(std::shared_ptr< IndicatorF2D< S > > f, std::shared_ptr< IndicatorF2D< S > > g)
S signedDistance(const Vector< S, 2 > &input) override
Returns signed distance to the nearest point on the indicator surface.
addition functor acts as union
Definition indicCalc2D.h:55
IndicPlus1D(IndicatorF1D< S > &f, IndicatorF1D< S > &g)
bool operator()(bool output[], const S input[]) override
has to be implemented for 'every' derived class
IndicPlus2D(std::shared_ptr< IndicatorF2D< S > > f, std::shared_ptr< IndicatorF2D< S > > g)
S signedDistance(const Vector< S, 2 > &input) override
Returns signed distance to the nearest point on the indicator surface.
IndicatorF1D is an application from .
IndicatorF2D is an application from .
Plain old scalar vector.
Definition vector.h:47
Top level namespace for all of OpenLB.
constexpr meta::enable_if_arithmetic_t< U, Vector< T, D > > operator-(U a, const ScalarVector< T, D, IMPL > &b) any_platform
Definition vector.h:297
constexpr meta::enable_if_arithmetic_t< U, Vector< T, D > > operator+(U a, const ScalarVector< T, D, IMPL > &b) any_platform
Definition vector.h:265
constexpr meta::enable_if_arithmetic_t< U, Vector< decltype(T{} *U{}), D > > operator*(U a, const ScalarVector< T, D, IMPL > &b) any_platform
Definition vector.h:329