VirtualFluids 0.2.0
Parallel CFD LBM Solver
Loading...
Searching...
No Matches
CoordinateTransformation3D.h
Go to the documentation of this file.
1//=======================================================================================
2// ____ ____ __ ______ __________ __ __ __ __
3// \ \ | | | | | _ \ |___ ___| | | | | / \ | |
4// \ \ | | | | | |_) | | | | | | | / \ | |
5// \ \ | | | | | _ / | | | | | | / /\ \ | |
6// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____
7// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______|
8// \ \ | | ________________________________________________________________
9// \ \ | | | ______________________________________________________________|
10// \ \| | | | __ __ __ __ ______ _______
11// \ | | |_____ | | | | | | | | | _ \ / _____)
12// \ | | _____| | | | | | | | | | | \ \ \_______
13// \ | | | | |_____ | \_/ | | | | |_/ / _____ |
14// \ _____| |__| |________| \_______/ |__| |______/ (_______/
15//
16// This file is part of VirtualFluids. VirtualFluids is free software: you can
17// redistribute it and/or modify it under the terms of the GNU General Public
18// License as published by the Free Software Foundation, either version 3 of
19// the License, or (at your option) any later version.
20//
21// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
22// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
23// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
24// for more details.
25//
26// SPDX-License-Identifier: GPL-3.0-or-later
27// SPDX-FileCopyrightText: Copyright © VirtualFluids Project contributors, see AUTHORS.md in root folder
28//
33//=======================================================================================
34#ifndef COORDINATETRANSFORMATION3D_H
35#define COORDINATETRANSFORMATION3D_H
36
37#include <cmath>
38#include <sstream>
39#include <string>
40
42
43#include <PointerDefinitions.h>
44
67
69{
70public:
72 CoordinateTransformation3D(const double &originX1, const double &originX2, const double &originX3,
73 const double &dx1, const double &dx2, const double &dx3, const double &alpha,
74 const double &beta, const double &gamma);
75 CoordinateTransformation3D(const double &originX1, const double &originX2, const double &originX3,
76 const double &dx1, const double &dx2, const double &dx3);
78
79 void setTransformationValues(const double &originX1, const double &originX2, const double &originX3,
80 const double &dx1, const double &dx2, const double &dx3, const double &alpha,
81 const double &beta, const double &gamma);
82 double getX1CoordinateOffset() const { return this->Tx1; } // Translation
83 double getX2CoordinateOffset() const { return this->Tx2; }
84 double getX3CoordinateOffset() const { return this->Tx3; }
85 double getX1CoordinateScaling() const { return this->Sx1; } // Scaling
86 double getX2CoordinateScaling() const { return this->Sx2; }
87 double getX3CoordinateScaling() const { return this->Sx3; }
88 double getRotationX1Angle() const { return this->alpha; }
89 double getRotationX2Angle() const { return this->beta; }
90 double getRotationX3Angle() const { return this->gamma; } // Rotation
91
92 // Achtung die Winkel passen nicht ueberein -siehe setTransformationValues
93 void setRotationX1Angle(double alpha)
94 {
95 this->setTransformationValues(this->Tx1, this->Tx2, this->Tx3, this->Sx1, this->Sx2, this->Sx3, alpha,
96 this->beta, this->gamma);
97 }
98 void setRotationX2Angle(double beta)
99 {
100 this->setTransformationValues(this->Tx1, this->Tx2, this->Tx3, this->Sx1, this->Sx2, this->Sx3, this->alpha,
101 beta, this->gamma);
102 }
103 void setRotationX3Angle(double gamma)
104 {
105 this->setTransformationValues(this->Tx1, this->Tx2, this->Tx3, this->Sx1, this->Sx2, this->Sx3, this->alpha,
106 this->beta, gamma);
107 }
108
109 void setActive(const bool &active);
110 bool isActive() const { return this->active; }
111 bool isTransformation() const { return this->transformation; }
112
113 double transformForwardToX1Coordinate(const double &x1, const double &x2, const double &x3) const;
114 double transformForwardToX2Coordinate(const double &x1, const double &x2, const double &x3) const;
115 double transformForwardToX3Coordinate(const double &x1, const double &x2, const double &x3) const;
116 double transformForwardToX1CoordinateIgnoringRotation(const double &x1) const;
117 double transformForwardToX2CoordinateIgnoringRotation(const double &x2) const;
118 double transformForwardToX3CoordinateIgnoringRotation(const double &x3) const;
119 double transformBackwardToX1Coordinate(const double &x1, const double &x2, const double &x3) const;
120 double transformBackwardToX2Coordinate(const double &x1, const double &x2, const double &x3) const;
121 double transformBackwardToX3Coordinate(const double &x1, const double &x2, const double &x3) const;
122 double transformBackwardToX1CoordinateIgnoringRotation(const double &x1) const;
123 double transformBackwardToX2CoordinateIgnoringRotation(const double &x2) const;
124 double transformBackwardToX3CoordinateIgnoringRotation(const double &x3) const;
125 std::string toString() const;
126
127private:
128 double Tx1, Tx2, Tx3, Sx1, Sx2, Sx3, alpha, beta, gamma;
129
130 double toX1factorX1, toX1factorX2, toX1factorX3, toX1delta;
131 double toX2factorX1, toX2factorX2, toX2factorX3, toX2delta;
132 double toX3factorX1, toX3factorX2, toX3factorX3, toX3delta;
133
134 double fromX1factorX1, fromX1factorX2, fromX1factorX3, fromX1delta;
135 double fromX2factorX1, fromX2factorX2, fromX2factorX3, fromX2delta;
136 double fromX3factorX1, fromX3factorX2, fromX3factorX3, fromX3delta;
137
138 bool active;
139 bool transformation;
140
146};
147
148#endif // COORDINATETRANSFORMATION3D_H
149
A class provides 3d coordinate transformation.
Writes the grid each timestep into the files and reads the grip from the files before regenerating.
std::shared_ptr< T > SPtr
double transformForwardToX3Coordinate(const double &x1, const double &x2, const double &x3) const
double transformBackwardToX2CoordinateIgnoringRotation(const double &x2) const
double transformForwardToX2CoordinateIgnoringRotation(const double &x2) const
double transformBackwardToX2Coordinate(const double &x1, const double &x2, const double &x3) const
double transformBackwardToX3Coordinate(const double &x1, const double &x2, const double &x3) const
double transformBackwardToX1Coordinate(const double &x1, const double &x2, const double &x3) const
double transformForwardToX3CoordinateIgnoringRotation(const double &x3) const
double transformBackwardToX1CoordinateIgnoringRotation(const double &x1) const
double transformBackwardToX3CoordinateIgnoringRotation(const double &x3) const
double transformForwardToX1Coordinate(const double &x1, const double &x2, const double &x3) const
double transformForwardToX2Coordinate(const double &x1, const double &x2, const double &x3) const
void setTransformationValues(const double &originX1, const double &originX2, const double &originX3, const double &dx1, const double &dx2, const double &dx3, const double &alpha, const double &beta, const double &gamma)
Set transformation values.
double transformForwardToX1CoordinateIgnoringRotation(const double &x1) const