OpenLB 1.7
Loading...
Searching...
No Matches
Public Member Functions | List of all members
olb::BlockLatticeVolumeFractionPolygonApproximation2D< T, DESCRIPTOR > Class Template Referencefinal

functor returns pointwise an approximation for the volume fraction More...

#include <latticeVolumeFractionPolygonApproximation2D.h>

+ Inheritance diagram for olb::BlockLatticeVolumeFractionPolygonApproximation2D< T, DESCRIPTOR >:
+ Collaboration diagram for olb::BlockLatticeVolumeFractionPolygonApproximation2D< T, DESCRIPTOR >:

Public Member Functions

 BlockLatticeVolumeFractionPolygonApproximation2D (BlockLattice< T, DESCRIPTOR > &blockLattice, BlockGeometry< T, 2 > &blockGeometry, IndicatorF2D< T > &indicator, const UnitConverter< T, DESCRIPTOR > &converter, bool insideOut)
 
bool operator() (T output[], const int input[])
 has to be implemented for 'every' derived class
 
- Public Member Functions inherited from olb::BlockLatticeF2D< T, DESCRIPTOR >
BlockLattice< T, DESCRIPTOR > & getBlock ()
 Copy Constructor.
 
- Public Member Functions inherited from olb::BlockF2D< T >
virtual BlockStructureD< 2 > & getBlockStructure ()
 virtual destructor for defined behaviour
 
void setBlockStructure (BlockStructureD< 2 > *blockStructure)
 
BlockF2D< T > & operator- (BlockF2D< T > &rhs)
 
BlockF2D< T > & operator+ (BlockF2D< T > &rhs)
 
BlockF2D< T > & operator* (BlockF2D< T > &rhs)
 
BlockF2D< T > & operator/ (BlockF2D< T > &rhs)
 
- Public Member Functions inherited from olb::GenericF< T, int >
virtual ~GenericF ()=default
 
int getSourceDim () const
 read only access to member variable _m
 
int getTargetDim () const
 read only access to member variable _n
 
std::string & getName ()
 read and write access to name
 
std::string const & getName () const
 read only access to name
 
bool operator() (T output[])
 wrapper that call the pure virtual operator() (T output[], const S input[]) from above
 
bool operator() (T output[], int input0)
 
bool operator() (T output[], int input0, int input1)
 
bool operator() (T output[], int input0, int input1, int input2)
 
bool operator() (T output[], int input0, int input1, int input2, int input3)
 

Additional Inherited Members

- Public Types inherited from olb::GenericF< T, int >
using targetType
 
using sourceType
 
- Public Attributes inherited from olb::GenericF< T, int >
std::shared_ptr< GenericF< T, int > > _ptrCalcC
 memory management, frees resouces (calcClass)
 
- Protected Member Functions inherited from olb::BlockLatticeF2D< T, DESCRIPTOR >
 BlockLatticeF2D (BlockLattice< T, DESCRIPTOR > &blockLattice, int targetDim)
 
- Protected Member Functions inherited from olb::BlockF2D< T >
 BlockF2D (BlockStructureD< 2 > &blockStructure, int targetDim)
 
 BlockF2D (int targetDim)
 
- Protected Member Functions inherited from olb::GenericF< T, int >
 GenericF (int targetDim, int sourceDim)
 
- Protected Attributes inherited from olb::BlockLatticeF2D< T, DESCRIPTOR >
BlockLattice< T, DESCRIPTOR > & _blockLattice
 
- Protected Attributes inherited from olb::BlockF2D< T >
BlockStructureD< 2 > * _blockStructure
 

Detailed Description

template<typename T, typename DESCRIPTOR>
class olb::BlockLatticeVolumeFractionPolygonApproximation2D< T, DESCRIPTOR >

functor returns pointwise an approximation for the volume fraction

Definition at line 51 of file latticeVolumeFractionPolygonApproximation2D.h.

Constructor & Destructor Documentation

◆ BlockLatticeVolumeFractionPolygonApproximation2D()

template<typename T , typename DESCRIPTOR >
olb::BlockLatticeVolumeFractionPolygonApproximation2D< T, DESCRIPTOR >::BlockLatticeVolumeFractionPolygonApproximation2D ( BlockLattice< T, DESCRIPTOR > & blockLattice,
BlockGeometry< T, 2 > & blockGeometry,
IndicatorF2D< T > & indicator,
const UnitConverter< T, DESCRIPTOR > & converter,
bool insideOut )

Definition at line 61 of file latticeVolumeFractionPolygonApproximation2D.hh.

66 : BlockLatticeF2D<T, DESCRIPTOR>(blockLattice, 1),
67 _blockGeometry(blockGeometry), _indicator(indicator), _converter(converter), _insideOut(insideOut)
68{
69 this->getName() = "volumeFractionPolygonApproximation";
70}
std::string & getName()
read and write access to name
Definition genericF.hh:51

References olb::GenericF< T, int >::getName().

+ Here is the call graph for this function:

Member Function Documentation

◆ operator()()

template<typename T , typename DESCRIPTOR >
bool olb::BlockLatticeVolumeFractionPolygonApproximation2D< T, DESCRIPTOR >::operator() ( T output[],
const int input[] )
virtual

has to be implemented for 'every' derived class

Implements olb::GenericF< T, int >.

Definition at line 73 of file latticeVolumeFractionPolygonApproximation2D.hh.

74{
75 output[0] = 0.;
76 T physR[2];
77
78 bool cornerXMYM_inside[1];
79 bool cornerXMYP_inside[1];
80 bool cornerXPYM_inside[1];
81 bool cornerXPYP_inside[1];
82 _blockGeometry.getPhysR(physR, {input[0], input[1]});
83
84 T cornerXMYM[2];
85 T cornerXMYP[2];
86 T cornerXPYM[2];
87 T cornerXPYP[2];
88
89 cornerXMYM[0] = physR[0] - 0.5*_converter.getPhysDeltaX();
90 cornerXMYM[1] = physR[1] - 0.5*_converter.getPhysDeltaX();
91
92 cornerXMYP[0] = physR[0] - 0.5*_converter.getPhysDeltaX();
93 cornerXMYP[1] = physR[1] + 0.5*_converter.getPhysDeltaX();
94
95 cornerXPYM[0] = physR[0] + 0.5*_converter.getPhysDeltaX();
96 cornerXPYM[1] = physR[1] - 0.5*_converter.getPhysDeltaX();
97
98 cornerXPYP[0] = physR[0] + 0.5*_converter.getPhysDeltaX();
99 cornerXPYP[1] = physR[1] + 0.5*_converter.getPhysDeltaX();
100
101 _indicator(cornerXMYM_inside, cornerXMYM);
102 _indicator(cornerXMYP_inside, cornerXMYP);
103 _indicator(cornerXPYM_inside, cornerXPYM);
104 _indicator(cornerXPYP_inside, cornerXPYP);
105
106 if ((cornerXMYM_inside[0] && cornerXMYP_inside[0] && cornerXPYM_inside[0] && cornerXPYP_inside[0]) ||
107 (!cornerXMYM_inside[0] && !cornerXMYP_inside[0] && !cornerXPYM_inside[0] && !cornerXPYP_inside[0]) ) {
108 if (!_insideOut) {
109 if (cornerXMYM_inside[0]) {
110 output[0] = 1.0;
111 }
112 }
113 else {
114 if (!cornerXMYM_inside[0]) {
115 output[0] = 1.0;
116 }
117 }
118 }
119 else {
120 Vector<T,2> cornerXMYM_vec(physR[0] - 0.5*_converter.getPhysDeltaX(), physR[1] - 0.5*_converter.getPhysDeltaX());
121 Vector<T,2> cornerXPYP_vec(physR[0] + 0.5*_converter.getPhysDeltaX(), physR[1] + 0.5*_converter.getPhysDeltaX());
122
123 Vector<T,2> directionXP(_converter.getPhysDeltaX(), 0);
124 Vector<T,2> directionXM(-_converter.getPhysDeltaX(), 0);
125 Vector<T,2> directionYP(0, _converter.getPhysDeltaX());
126 Vector<T,2> directionYM(0, -_converter.getPhysDeltaX());
127
128 T distanceXP = 1.01 * _converter.getPhysDeltaX();
129 T distanceXM = 1.01 * _converter.getPhysDeltaX();
130 T distanceYP = 1.01 * _converter.getPhysDeltaX();
131 T distanceYM = 1.01 * _converter.getPhysDeltaX();
132
133 if ((cornerXMYM_inside[0] && !cornerXMYP_inside[0]) ||
134 (!cornerXMYM_inside[0] && cornerXMYP_inside[0]) ) {
135 _indicator.distance(distanceYP, cornerXMYM, directionYP);
136 }
137
138 if ((cornerXMYM_inside[0] && !cornerXPYM_inside[0]) ||
139 (!cornerXMYM_inside[0] && cornerXPYM_inside[0]) ) {
140 _indicator.distance(distanceXP, cornerXMYM, directionXP);
141 }
142
143 if ((cornerXPYP_inside[0] && !cornerXMYP_inside[0]) ||
144 (!cornerXPYP_inside[0] && cornerXMYP_inside[0]) ) {
145 _indicator.distance(distanceXM, cornerXPYP, directionXM);
146 }
147
148 if ((cornerXPYP_inside[0] && !cornerXPYM_inside[0]) ||
149 (!cornerXPYP_inside[0] && cornerXPYM_inside[0]) ) {
150 _indicator.distance(distanceYM, cornerXPYP, directionYM);
151 }
152
153 T volumeFraction = 0.0;
154
155 if (distanceXP < _converter.getPhysDeltaX() && distanceXM < _converter.getPhysDeltaX()) {
156 volumeFraction = distanceXP * _converter.getPhysDeltaX();
157 volumeFraction += 0.5 * (_converter.getPhysDeltaX() - distanceXM - distanceXP) * _converter.getPhysDeltaX();
158 volumeFraction /= _converter.getPhysDeltaX() * _converter.getPhysDeltaX();
159 if (!cornerXMYM_inside[0]) {
160 volumeFraction = 1.0 - volumeFraction;
161 }
162 }
163
164 if (distanceYP < _converter.getPhysDeltaX() && distanceYM < _converter.getPhysDeltaX()) {
165 volumeFraction = distanceYP * _converter.getPhysDeltaX();
166 volumeFraction += 0.5 * (_converter.getPhysDeltaX() - distanceYM - distanceYP) * _converter.getPhysDeltaX();
167 volumeFraction /= _converter.getPhysDeltaX() * _converter.getPhysDeltaX();
168 if (!cornerXMYM_inside[0]) {
169 volumeFraction = 1.0 - volumeFraction;
170 }
171 }
172
173 if (distanceXP < _converter.getPhysDeltaX() && distanceYP < _converter.getPhysDeltaX()) {
174 volumeFraction = 0.5 * distanceXP * distanceYP;
175 volumeFraction /= _converter.getPhysDeltaX() * _converter.getPhysDeltaX();
176 if (!cornerXMYM_inside[0]) {
177 volumeFraction = 1.0 - volumeFraction;
178 }
179 }
180
181 if (distanceXM < _converter.getPhysDeltaX() && distanceYM < _converter.getPhysDeltaX()) {
182 volumeFraction = 0.5 * distanceXM * distanceYM;
183 volumeFraction /= _converter.getPhysDeltaX() * _converter.getPhysDeltaX();
184 if (!cornerXPYP_inside[0]) {
185 volumeFraction = 1.0 - volumeFraction;
186 }
187 }
188
189 if (distanceXM < _converter.getPhysDeltaX() && distanceYP < _converter.getPhysDeltaX()) {
190 volumeFraction = 0.5 * (_converter.getPhysDeltaX() - distanceXM) * (_converter.getPhysDeltaX() - distanceYP);
191 volumeFraction /= _converter.getPhysDeltaX() * _converter.getPhysDeltaX();
192 if (!cornerXMYP_inside[0]) {
193 volumeFraction = 1.0 - volumeFraction;
194 }
195 }
196
197 if (distanceYM < _converter.getPhysDeltaX() && distanceXP < _converter.getPhysDeltaX()) {
198 volumeFraction = 0.5 * (_converter.getPhysDeltaX() - distanceXP) * (_converter.getPhysDeltaX() - distanceYM);
199 volumeFraction /= _converter.getPhysDeltaX() * _converter.getPhysDeltaX();
200 if (!cornerXPYM_inside[0]) {
201 volumeFraction = 1.0 - volumeFraction;
202 }
203 }
204
205 if (!_insideOut) {
206 output[0] = volumeFraction;
207 }
208 else {
209 output[0] = 1.0 - volumeFraction;
210 }
211
212 }
213 return true;
214}
Vector< T, D > getPhysR(LatticeR< D > latticeR)
virtual bool distance(S &distance, const Vector< S, 2 > &origin, S precision, const Vector< S, 2 > &direction)
returns false or true and pos. distance if there was one found for an given origin and direction

The documentation for this class was generated from the following files: