OpenLB 1.7
Loading...
Searching...
No Matches
indicComb3D.h
Go to the documentation of this file.
1/* This file is part of the OpenLB library
2 *
3 * Copyright (C) 2020 Albert Mink, Jan E. Marquardt, Anna Husfeldt
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
24#ifndef INDIC_COMB_3D_H
25#define INDIC_COMB_3D_H
26
27#include "indicatorBaseF3D.h"
29
30namespace olb {
31
32
33/*
34 * arithmetic helper classes for IndicatorF3D, smoothIndicator3D
35 * UNION +
36 * WITHOUT -
37 * INTERSECTION *
38*/
39
42template <typename S, template<typename U> class F>
43class IndicComb3D : public IndicatorF3D<S> {
44protected:
45 IndicComb3D( std::shared_ptr<IndicatorF3D<S>> f, std::shared_ptr<IndicatorF3D<S>> g );
46 std::shared_ptr<IndicatorF3D<S>> _f;
47 std::shared_ptr<IndicatorF3D<S>> _g;
48public:
49 virtual S signedDistance( const Vector<S,3>& input )=0;
50 bool operator() (bool output[], const S input[3]);
51};
52
54template <typename S>
55class IndicPlus3D : public IndicComb3D<S,util::plus> {
56public:
57 IndicPlus3D( std::shared_ptr<IndicatorF3D<S>> f, std::shared_ptr<IndicatorF3D<S>> g );
58 S signedDistance( const Vector<S,3>& input ) override;
59};
60
62template <typename S>
63class IndicMinus3D : public IndicComb3D<S,util::minus> {
64public:
65 IndicMinus3D( std::shared_ptr<IndicatorF3D<S>> f, std::shared_ptr<IndicatorF3D<S>> g );
66 S signedDistance( const Vector<S,3>& input ) override;
67};
68
70template <typename S>
71class IndicMultiplication3D : public IndicComb3D<S,util::multiplies> {
72public:
73 IndicMultiplication3D( std::shared_ptr<IndicatorF3D<S>> f, std::shared_ptr<IndicatorF3D<S>> g );
74 S signedDistance( const Vector<S,3>& input ) override;
75};
76
83template<typename S, template <typename U> class F1, template <typename V> class F2,
84 typename=typename std::enable_if<std::is_base_of<IndicatorF3D<S>, F1<S>>::value>::type>
85std::shared_ptr<IndicatorF3D<S>> operator+(std::shared_ptr<F1<S>> lhs, std::shared_ptr<F2<S>> rhs);
86
87template<typename S, template <typename U> class F1, template <typename V> class F2,
88 typename=typename std::enable_if<std::is_base_of<IndicatorF3D<S>, F1<S>>::value>::type>
89std::shared_ptr<IndicatorF3D<S>> operator-(std::shared_ptr<F1<S>> lhs, std::shared_ptr<F2<S>> rhs);
90
91template<typename S, template <typename U> class F1, template <typename V> class F2,
92 typename=typename std::enable_if<std::is_base_of<IndicatorF3D<S>, F1<S>>::value>::type>
93std::shared_ptr<IndicatorF3D<S>> operator*(std::shared_ptr<F1<S>> lhs, std::shared_ptr<F2<S>> rhs);
94
95template<typename S, template <typename U> class F1, template <typename V> class F2,
96 typename=typename std::enable_if<std::is_base_of<IndicatorIdentity3D<S>, F1<S>>::value>::type>
97std::shared_ptr<IndicatorF3D<S>> operator+(F1<S> & lhs, std::shared_ptr<F2<S>> rhs);
98
99template<typename S, template <typename U> class F1, template <typename V> class F2,
100 typename=typename std::enable_if<std::is_base_of<IndicatorIdentity3D<S>, F1<S>>::value>::type>
101std::shared_ptr<IndicatorF3D<S>> operator-(F1<S> & lhs, std::shared_ptr<F2<S>> rhs);
102
103template<typename S, template <typename U> class F1, template <typename V> class F2,
104 typename=typename std::enable_if<std::is_base_of<IndicatorIdentity3D<S>, F1<S>>::value>::type>
105std::shared_ptr<IndicatorF3D<S>> operator*(F1<S> & lhs, std::shared_ptr<F2<S>> rhs);
106} // end namespace olb
107
108#endif
IndicComb3D //////////////////////////////// arithmetic helper class for Indicator 3d functors.
Definition indicComb3D.h:43
std::shared_ptr< IndicatorF3D< S > > _f
Definition indicComb3D.h:46
std::shared_ptr< IndicatorF3D< S > > _g
Definition indicComb3D.h:47
IndicComb3D(std::shared_ptr< IndicatorF3D< S > > f, std::shared_ptr< IndicatorF3D< S > > g)
virtual S signedDistance(const Vector< S, 3 > &input)=0
Returns signed distance to the nearest point on the indicator surface.
bool operator()(bool output[], const S input[3])
Subtraction.
Definition indicComb3D.h:63
S signedDistance(const Vector< S, 3 > &input) override
Returns signed distance to the nearest point on the indicator surface.
IndicMinus3D(std::shared_ptr< IndicatorF3D< S > > f, std::shared_ptr< IndicatorF3D< S > > g)
IndicMultiplication3D(std::shared_ptr< IndicatorF3D< S > > f, std::shared_ptr< IndicatorF3D< S > > g)
S signedDistance(const Vector< S, 3 > &input) override
Returns signed distance to the nearest point on the indicator surface.
S signedDistance(const Vector< S, 3 > &input) override
Returns signed distance to the nearest point on the indicator surface.
IndicPlus3D(std::shared_ptr< IndicatorF3D< S > > f, std::shared_ptr< IndicatorF3D< S > > g)
IndicatorF3D 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