summaryrefslogtreecommitdiff
path: root/src/functors/analytical/indicator/smoothIndicatorBaseF2D.h
blob: 5f6576c9e782ed9cd3f34d71b2110cbce9d02d65 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
/*  This file is part of the OpenLB library
 *
 *  Copyright (C) 2014-2016 Cyril Masquelier, Mathias J. Krause, Benjamin Förster
 *  E-mail contact: info@openlb.net
 *  The most recent release of OpenLB can be downloaded at
 *  <http://www.openlb.net/>
 *
 *  This program is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU General Public License
 *  as published by the Free Software Foundation; either version 2
 *  of the License, or (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public
 *  License along with this program; if not, write to the Free
 *  Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 *  Boston, MA  02110-1301, USA.
*/

#ifndef SMOOTH_INDICATOR_BASE_F_2D_H
#define SMOOTH_INDICATOR_BASE_F_2D_H

#include <vector>

#include "core/vector.h"
#include "functors/genericF.h"
#include "functors/analytical/analyticalBaseF.h"

namespace olb {

template <typename T, typename S, bool HLBM=false>
class SmoothIndicatorF2D;

/** SmoothIndicatorF2D is an application from \f$ \Omega \subset R^3 \to [0,1] \f$.
  * \param _myMin   holds minimal(component wise) vector of the domain \f$ \Omega \f$.
  * \param _myMax   holds maximal(component wise) vector of the domain \f$ \Omega \f$.
  * \param _center
  * \param _diam
  */
template <typename T, typename S>
class SmoothIndicatorF2D<T,S,false> : public AnalyticalF2D<T,S> {
protected:
  SmoothIndicatorF2D();
  Vector<S,2> _myMin;
  Vector<S,2> _myMax;
  Vector<S,2> _pos;
  Vector<S,4> _rotMat;  //saved values of rotation matrix
  S _circumRadius;
  S _theta;
  S _epsilon;
  std::string _name = "smoothIndicator2D";
public:
  void init(T theta, Vector<S,2> vel, T mass, T mofi);
  const Vector<S,2>& getMin() const;
  const Vector<S,2>& getMax() const;
  const Vector<S,2>& getPos() const;
  const Vector<S,4>& getRotationMatrix() const;
  const S& getCircumRadius() const;
  const S& getTheta() const;
  const S& getEpsilon() const;
  std::string name();
  void setRotationMatrix(Vector<S,4> rotMat);
  void setTheta(S theta);
  void setEpsilon(S epsilon);

  SmoothIndicatorF2D<T,S,false>& operator+(SmoothIndicatorF2D<T,S,false>& rhs);
};


template <typename T, typename S>
class SmoothIndicatorIdentity2D : public SmoothIndicatorF2D<T,S,false> {
protected:
  SmoothIndicatorF2D<T,S,false>& _f;
public:
  SmoothIndicatorIdentity2D(SmoothIndicatorF2D<T,S,false>& f);
  bool operator() (T output[], const S input[]) override;
};

/** SmoothIndicatorF2D is an application from \f$ \Omega \subset R^3 \to [0,1] \f$.
  * Base class for specific SmoothIndicator implementation providing common data.
  */
template <typename T, typename S>
class SmoothIndicatorF2D<T,S,true> : public AnalyticalF2D<T,S> {
protected:
  SmoothIndicatorF2D();
  Vector<S,2> _myMin;
  Vector<S,2> _myMax;
  Vector<S,2> _pos;
  Vector<S,2> _vel;
  Vector<S,2> _acc;
  Vector<S,2> _acc2;
  Vector<S,2> _force;
  Vector<S,4> _rotMat;  //saved values of rotation matrix
  S _circumRadius;
  S _theta;
  S _omega;
  S _alpha;
  S _alpha2;
  S _mass;
  S _mofi; //Moment of Inertia
  S _epsilon;
  std::string _name = "HLBMobject2D";

public:
  void init(T theta, Vector<S,2> vel, T mass, T mofi);
  const Vector<S,2>& getMin() const;
  const Vector<S,2>& getMax() const;
  const Vector<S,2>& getPos() const;
  const Vector<S,2>& getVel() const;
  const Vector<S,2>& getAcc() const;
  const Vector<S,2>& getAcc2() const;
  const Vector<S,2>& getForce() const;
  const Vector<S,4>& getRotationMatrix() const;
  const S& getCircumRadius() const;
  const S& getTheta() const;
  const S& getOmega() const;
  const S& getAlpha() const;
  const S& getAlpha2() const;
  const S& getMass() const;
  const S& getMofi() const;
  const S& getEpsilon() const;
  std::string name();
  void setPos(Vector<S,2> pos);
  void setVel(Vector<S,2> vel);
  void setAcc(Vector<S,2> acc);
  void setAcc2(Vector<S,2> acc2);
  void setForce(Vector<S,2> force);
  void setRotationMatrix(Vector<S,4> rotMat);
  void setTheta(S theta);
  void setOmega(S omega);
  void setAlpha(S alpha);
  void setAlpha2(S alpha2);
  void setMass(S mass);
  void setMofi(S mofi);
  void setEpsilon(S epsilon);
};

}

#endif