VirtualFluids 0.2.0
Parallel CFD LBM Solver
Loading...
Searching...
No Matches
GbCylinder3D.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 GBCYLINDER3D_H
35#define GBCYLINDER3D_H
36
37#include <cmath>
38#include <vector>
39
41#include <geometry3d/GbLine3D.h>
43
44class GbPoint3D;
45class GbLine3D;
46class GbTriangle3D;
47
49
50#include <PointerDefinitions.h>
51class GbCylinder3D;
53
54class GbCylinder3D : public GbObject3D, public UbObserver
55{
56public:
58 GbCylinder3D(const double &x1a, const double &x2a, const double &x3a, const double &x1b, const double &x2b,
59 const double &x3b, const double &radius);
60 GbCylinder3D(GbPoint3D *p1, GbPoint3D *p2, const double &radius);
61 GbCylinder3D(GbLine3D *line, const double &rad);
62 GbCylinder3D(GbCylinder3D *cylinder);
63 ~GbCylinder3D() override;
64
65 GbCylinder3D *clone() override { return new GbCylinder3D(this); }
66 void finalize() override;
67
68 double getRadius() { return this->mRad; };
69 GbLine3D *getLine() { return mLine; }
72
73 void setRadius(const double &radius);
74 void setLine(GbLine3D *line);
75 void setPoint1(const double &x1, const double &x2, const double &x3);
76 void setPoint2(const double &x1, const double &x2, const double &x3);
77
78 bool isParallelToX1Axis() { return ((this->cylinderType & X1PARALLEL) == X1PARALLEL); }
79 bool isParallelToX2Axis() { return ((this->cylinderType & X2PARALLEL) == X2PARALLEL); }
80 bool isParallelToX3Axis() { return ((this->cylinderType & X3PARALLEL) == X3PARALLEL); }
81 bool isNotParallelToAxis() { return ((this->cylinderType & NOTPARALLELTOAXIS) == NOTPARALLELTOAXIS); }
82
83 double getHeight();
84
85 void scale(const double &sx1, const double &sx2, const double &sx3) override;
86
87 void translate(const double &x1, const double &x2, const double &x3) override
88 {
89 this->mLine->translate(x1, x2, x3);
90 this->calculateValues();
91 // this->notifyObserversObjectChanged();
92 }
93
94 double getX1Centroid() override { return centerX1; }
95 double getX1Minimum() override { return minX1; }
96 double getX1Maximum() override { return maxX1; }
97 double getX2Centroid() override { return centerX2; }
98 double getX2Minimum() override { return minX2; }
99 double getX2Maximum() override { return maxX2; }
100 double getX3Centroid() override { return centerX3; }
101 double getX3Minimum() override { return minX3; }
102 double getX3Maximum() override { return maxX3; }
103
104 bool isPointInGbObject3D(const double &x1p, const double &x2p, const double &x3p) override;
105 bool isPointInGbObject3D(const double &x1p, const double &x2p, const double &x3p, bool &pointIsOnBoundary) override;
106 bool isCellInsideGbObject3D(const double &x1a, const double &x2a, const double &x3a, const double &x1b,
107 const double &x2b, const double &x3b) override;
108 bool isCellCuttingGbObject3D(const double &x1a, const double &x2a, const double &x3a, const double &x1b,
109 const double &x2b, const double &x3b) override;
110 bool isCellInsideOrCuttingGbObject3D(const double &x1a, const double &x2a, const double &x3a, const double &x1b,
111 const double &x2b, const double &x3b) override;
112
114
115 // SG ausdokumentieren, da der nur unendlcihe Zylinder macht ...
116 // bool hasRaytracing() { return true; }
117 bool hasRaytracing() override { return false; }
118 bool raytracingSupportsPointsInside() override { return true; }
119
120 /*|r| must be 1! einheitsvector!!*/
121 double getIntersectionRaytraceFactor(const double &x1, const double &x2, const double &x3, const double &rx1,
122 const double &rx2, const double &rx3) override;
123
124 std::vector<GbTriangle3D *> getSurfaceTriangleSet() override;
125 void addSurfaceTriangleSet(std::vector<UbTupleFloat3> &nodes, std::vector<UbTupleInt3> &triangles) override;
126 void addSurfaceTriangleSetSegments(std::vector<UbTupleFloat3> &nodes, std::vector<UbTupleInt3> &triangles,
128
129 std::string toString() override;
130
131 // virtuelle Methoden von UbObserver
134
135 using GbObject3D::isPointInGbObject3D; // Grund: dadurch muss man hier isPointInGbObject3D(GbPoint3D*) nicht
136 // ausprogrammieren, welche sonst hier "ueberdeckt" waere
137
138protected:
139 void calculateValues();
140
142 double mRad;
143
144 double minX1{ 0.0 }, minX2{ 0.0 }, minX3{ 0.0 };
145 double maxX1{ 0.0 }, maxX2{ 0.0 }, maxX3{ 0.0 };
146 double centerX1{ 0.0 }, centerX2{ 0.0 }, centerX3{ 0.0 };
147
149
150 // void berechneQuerschnittsWerte();
151 static const int NOTPARALLELTOAXIS = (1 << 0); // 1
152 static const int X1PARALLEL = (1 << 1); // 2
153 static const int X2PARALLEL = (1 << 2); // 4
154 static const int X3PARALLEL = (1 << 3); // 8
155};
156
157#endif
158
GbLine3D * getLine()
void translate(const double &x1, const double &x2, const double &x3) override
double getX3Maximum() override
static const int X1PARALLEL
bool isNotParallelToAxis()
bool isParallelToX3Axis()
double getX1Centroid() override
static const int X3PARALLEL
bool isParallelToX2Axis()
bool raytracingSupportsPointsInside() override
GbCylinder3D * clone() override
double getX2Minimum() override
bool hasRaytracing() override
double getX1Maximum() override
double getX2Centroid() override
static const int X2PARALLEL
static const int NOTPARALLELTOAXIS
GbLine3D * mLine
double getX3Minimum() override
bool isParallelToX1Axis()
double getX2Maximum() override
double getRadius()
double getX3Centroid() override
double getX1Minimum() override
This Class provides basic 3D line objects.
Definition GbLine3D.h:59
This Interface provides basic 3D geometry objects methods.
Definition GbObject3D.h:64
This Class provides basic 3D point objects.
Definition GbPoint3D.h:49
This Class provides basic 3D triangle objects.
Observable object.
Observer.
Definition UbObserver.h:51
std::shared_ptr< T > SPtr
~GbCylinder3D() override
void finalize() override
double getHeight()
void setPoint2(const double &x1, const double &x2, const double &x3)
void addSurfaceTriangleSetSegments(std::vector< UbTupleFloat3 > &nodes, std::vector< UbTupleInt3 > &triangles, int segmentsRound, int segmentsHeight)
void translate(const double &tx1, const double &tx2, const double &tx3) override
Definition GbLine3D.cpp:267
bool isCellInsideGbObject3D(const double &x1a, const double &x2a, const double &x3a, const double &x1b, const double &x2b, const double &x3b) override
void objectChanged(UbObservable *changedObject) override
void addSurfaceTriangleSet(std::vector< UbTupleFloat3 > &nodes, std::vector< UbTupleInt3 > &triangles) override
virtual bool isPointInGbObject3D(GbPoint3D *p)
void objectWillBeDeleted(UbObservable *objectForDeletion) override
GbPoint3D * getPoint2()
std::vector< GbTriangle3D * > getSurfaceTriangleSet() override
bool isCellInsideOrCuttingGbObject3D(const double &x1a, const double &x2a, const double &x3a, const double &x1b, const double &x2b, const double &x3b) override
void setRadius(const double &radius)
void calculateValues()
bool isCellCuttingGbObject3D(const double &x1a, const double &x2a, const double &x3a, const double &x1b, const double &x2b, const double &x3b) override
SPtr< GbCylinder3D > GbCylinder3DPtr
GbLine3D * createClippedLine3D(GbPoint3D &point1, GbPoint3D &point2) override
GbPoint3D * getPoint1()
bool isPointInGbObject3D(const double &x1p, const double &x2p, const double &x3p) override
void setPoint1(const double &x1, const double &x2, const double &x3)
std::string toString() override
double getIntersectionRaytraceFactor(const double &x1, const double &x2, const double &x3, const double &rx1, const double &rx2, const double &rx3) override
void setLine(GbLine3D *line)
void scale(const double &sx1, const double &sx2, const double &sx3) override