VirtualFluids 0.2.0
Parallel CFD LBM Solver
Loading...
Searching...
No Matches
GbLine3D.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 GBLINE3D_H
35#define GBLINE3D_H
36
37#include <cmath>
38#include <sstream>
39
41
42#include <GbObject3D.h>
43#include <GbPoint3D.h>
44
45class GbCuboid3D;
46
47#include <PointerDefinitions.h>
48
57
58class GbLine3D : public GbObject3D, public UbObserver
59{
60public:
61 GbLine3D();
63 GbLine3D(GbLine3D *line);
64 ~GbLine3D() override;
65
66 GbLine3D *clone() override { return new GbLine3D(this); }
67 void finalize() override;
68
72
74 {
75 if (this->p1) {
76 this->p1->removeObserver(this);
77 delete this->p1;
78 this->p1 = NULL;
79 }
80 }
82 {
83 if (this->p2) {
84 this->p2->removeObserver(this);
85 delete this->p2;
86 this->p2 = NULL;
87 }
88 }
90 {
91 this->deletePoint1();
92 this->deletePoint2();
93 }
94
95 GbPoint3D *getPoint1() { return this->p1; }
96 GbPoint3D *getPoint2() { return this->p2; }
97
98 double getLength() { return (this->length); }
99
100 double getX1Centroid() override { return ((this->p1->x1 + this->p2->x1) * 0.5); }
101 double getX2Centroid() override { return ((this->p1->x2 + this->p2->x2) * 0.5); };
102 double getX3Centroid() override { return ((this->p1->x3 + this->p2->x3) * 0.5); }
103
104 double getX1Minimum() override { return (this->p1->x1 < this->p2->x1 ? this->p1->x1 : this->p2->x1); }
105 double getX2Minimum() override { return (this->p1->x2 < this->p2->x2 ? this->p1->x2 : this->p2->x2); }
106 double getX3Minimum() override { return (this->p1->x3 < this->p2->x3 ? this->p1->x3 : this->p2->x3); }
107
108 double getX1Maximum() override { return (this->p1->x1 > this->p2->x1 ? this->p1->x1 : this->p2->x1); }
109 double getX2Maximum() override { return (this->p1->x2 > this->p2->x2 ? this->p1->x2 : this->p2->x2); }
110 double getX3Maximum() override { return (this->p1->x3 > this->p2->x3 ? this->p1->x3 : this->p2->x3); }
111
112 void scale(const double &sx1, const double &sx2, const double &sx3) override;
113 void translate(const double &tx1, const double &tx2, const double &tx3) override;
114
118
119 double getDistance(const GbPoint3D &point);
120 double getDistance(const double &x1, const double &x2, const double &x3);
121
122 std::vector<GbTriangle3D *> getSurfaceTriangleSet() override;
123 bool isPointInGbObject3D(const double & /*x1*/, const double & /*x2*/, const double & /*x3*/) override
124 {
125 throw UbException(UB_EXARGS, "not implemented");
126 }
127 bool isPointInGbObject3D(const double & /*x1*/, const double & /*x2*/, const double & /*x3*/,
128 bool & /*pointIsOnBoundary*/) override
129 {
130 throw UbException(UB_EXARGS, "not implemented");
131 }
132 bool isCellInsideGbObject3D(const double & /*x11*/, const double & /*x21*/, const double & /*x31*/,
133 const double & /*x12*/, const double & /*x22*/, const double & /*x32*/) override
134 {
135 return false;
136 }
137
138 GbLine3D *createClippedLine3D(GbPoint3D & /*point1*/, GbPoint3D & /*point2*/) override
139 {
140 throw UbException(UB_EXARGS, "not implemented");
141 }
142
143 // virtuelle Methoden von UbObserver
146
147 std::string toString() override;
148
149 using GbObject3D::isPointInGbObject3D; // Grund: dadurch muss man hier isPointInGbObject3D(GbPoint3D*) nicht
150 // ausprogrammieren, welche sonst hier "ueberdeckt" waere
151protected:
154 double length;
155
156private:
157 void calculateValues();
158};
159
160#endif
161
This Class provides basic 3D box objects.
Definition GbCuboid3D.h:53
This Class provides basic 3D line objects.
Definition GbLine3D.h:59
double length
Definition GbLine3D.h:154
double getX3Centroid() override
Definition GbLine3D.h:102
GbLine3D * createClippedLine3D(GbPoint3D &, GbPoint3D &) override
Definition GbLine3D.h:138
void deletePoint2()
Definition GbLine3D.h:81
double getX1Maximum() override
Definition GbLine3D.h:108
void deletePoints()
Definition GbLine3D.h:89
double getX3Maximum() override
Definition GbLine3D.h:110
double getX2Maximum() override
Definition GbLine3D.h:109
double getLength()
Definition GbLine3D.h:98
GbPoint3D * p1
Definition GbLine3D.h:152
GbPoint3D * getPoint1()
Definition GbLine3D.h:95
double getX1Minimum() override
Definition GbLine3D.h:104
double getX3Minimum() override
Definition GbLine3D.h:106
bool isCellInsideGbObject3D(const double &, const double &, const double &, const double &, const double &, const double &) override
Definition GbLine3D.h:132
bool isPointInGbObject3D(const double &, const double &, const double &) override
Definition GbLine3D.h:123
GbLine3D * clone() override
Definition GbLine3D.h:66
GbPoint3D * getPoint2()
Definition GbLine3D.h:96
double getX1Centroid() override
Definition GbLine3D.h:100
bool isPointInGbObject3D(const double &, const double &, const double &, bool &) override
Definition GbLine3D.h:127
void deletePoint1()
Definition GbLine3D.h:73
GbPoint3D * p2
Definition GbLine3D.h:153
double getX2Minimum() override
Definition GbLine3D.h:105
double getX2Centroid() override
Definition GbLine3D.h:101
This Interface provides basic 3D geometry objects methods.
Definition GbObject3D.h:64
This Class provides basic 3D point objects.
Definition GbPoint3D.h:49
double x1
Definition GbPoint3D.h:121
double x3
Definition GbPoint3D.h:123
double x2
Definition GbPoint3D.h:122
Observable object.
virtual void removeObserver(UbObserver *observer)
Observer.
Definition UbObserver.h:51
std::shared_ptr< T > SPtr
GbPoint3D * calculateIntersectionPoint3D(GbLine3D *line)
Definition GbLine3D.cpp:149
double getDistance(const GbPoint3D &point)
Definition GbLine3D.cpp:167
void objectChanged(UbObservable *changedObject) override
Definition GbLine3D.cpp:195
void setPoint1(GbPoint3D *point1)
Definition GbLine3D.cpp:103
~GbLine3D() override
Definition GbLine3D.cpp:67
void translate(const double &tx1, const double &tx2, const double &tx3) override
Definition GbLine3D.cpp:267
void finalize() override
Definition GbLine3D.cpp:75
virtual bool isPointInGbObject3D(GbPoint3D *p)
void setPoints(GbPoint3D *point1, GbPoint3D *point2)
Definition GbLine3D.cpp:125
GbLine3D * createClippedLine3D(GbCuboid3D *cuboid)
Definition GbLine3D.cpp:155
std::string toString() override
Definition GbLine3D.cpp:141
void objectWillBeDeleted(UbObservable *objectForDeletion) override
Definition GbLine3D.cpp:204
void setPoint2(GbPoint3D *point2)
Definition GbLine3D.cpp:114
std::vector< GbTriangle3D * > getSurfaceTriangleSet() override
Definition GbLine3D.cpp:91
void scale(const double &sx1, const double &sx2, const double &sx3) override
Definition GbLine3D.cpp:223
#define UB_EXARGS
Definition UbException.h:73