VirtualFluids 0.2.0
Parallel CFD LBM Solver
Loading...
Searching...
No Matches
GbObjectGroup3D.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 GBOBJECTGROUP3D_H
35#define GBOBJECTGROUP3D_H
36
37#ifdef CAB_CTL
38#include <ctl.h>
39#endif // CAB_CTL
40
41#include <cmath>
42#include <vector>
43
47
48#include <PointerDefinitions.h>
49
50class GbLine3D;
51class GbTriangle3D;
53
55{
56public:
58
60 // Konstruktoren
63 ~GbObjectGroup3D() override;
64
65 GbObjectGroup3D *clone() override { return new GbObjectGroup3D(this); }
66 void finalize() override;
67
68 void addGbObject(GbObject3D *object) { this->geoobjects.push_back(object); }
69
70 double getRadius() const { return this->radius; }
71
72 double getX1Centroid() override { return midPoint->getX1Coordinate(); }
73 double getX1Minimum() override { return midPoint->getX1Coordinate() - radius; }
74 double getX1Maximum() override { return midPoint->getX1Coordinate() + radius; }
75 double getX2Centroid() override { return midPoint->getX2Coordinate(); }
76 double getX2Minimum() override { return midPoint->getX2Coordinate() - radius; }
77 double getX2Maximum() override { return midPoint->getX2Coordinate() + radius; }
78 double getX3Centroid() override { return midPoint->getX3Coordinate(); }
79 double getX3Minimum() override { return midPoint->getX3Coordinate() - radius; }
80 double getX3Maximum() override { return midPoint->getX3Coordinate() + radius; }
81
82 void setCenterX1Coordinate(const double &value) override;
83 void setCenterX2Coordinate(const double &value) override;
84 void setCenterX3Coordinate(const double &value) override;
85 void setCenterCoordinates(const double &x1, const double &x2, const double &x3) override;
86 void setRadius(const double &radius);
87
89 double getDistance(GbPoint3D *p);
90 double getDistance(const double &x1p, const double &x2p, const double &x3p);
91
92 bool isPointInGbObject3D(const double &x1, const double &x2, const double &x3) override;
93 bool isPointInGbObject3D(const double &x1p, const double &x2p, const double &x3p, bool &pointIsOnBoundary) override;
94
95 bool isCellCuttingGbObject3D(const double &x1a, const double &x2a, const double &x3a, const double &x1b,
96 const double &x2b, const double &x3b) override;
97 bool isCellInsideOrCuttingGbObject3D(const double &x1a, const double &x2a, const double &x3a, const double &x1b,
98 const double &x2b, const double &x3b) override;
99 double getCellVolumeInsideGbObject3D(const double &x1a, const double &x2a, const double &x3a, const double &x1b,
100 const double &x2b, const double &x3b) override;
101
102 std::vector<GbTriangle3D *> getSurfaceTriangleSet() override;
103 void addSurfaceTriangleSet(std::vector<UbTupleFloat3> &nodes, std::vector<UbTupleInt3> &triangles) override;
104
105 bool hasRaytracing() override { return true; }
106 /*|r| must be 1! einheitsvector!!*/
107 double getIntersectionRaytraceFactor(const double &x1, const double &x2, const double &x3, const double &rx1,
108 const double &rx2, const double &rx3) override;
109
111
112 std::string toString() override;
113
114 void translate(const double &x1, const double &x2, const double &x3) override
115 {
116 this->midPoint->translate(x1, x2, x3);
118 }
119 void rotate(const double &/*rx1*/, const double &/*rx2*/, const double &/*rx3*/) override
120 { /* rotation makes no sense*/
121 }
122 void scale(const double &sx1, const double & /*sx2*/, const double & /*sx3*/) override { this->radius *= sx1; }
123
124 TRIANGULATIONMODE getTriangulationMode() { return triangulationMode; }
125 void setTriangulationMode(TRIANGULATIONMODE mode) { this->triangulationMode = mode; }
126
127 // virtuelle Methoden von UbObserver
128 void objectChanged(UbObservable * /*changedObject*/) override
129 {
131 // std::cout<<"GbSphere:objectChanged() - toDo-);";
132 }
133 void objectWillBeDeleted(UbObservable * /*objectForDeletion*/) override
134 {
135 std::cout << "throw UbException(-GbObjectGroup3D::finalize() - toDo-);";
136 }
137
138 using GbObject3D::isPointInGbObject3D; // Grund: dadurch muss man hier isPointInGbObject3D(GbPoint3D*) nicht
139 // ausprogrammieren, welche sonst hier "ueberdeckt" waere, weil man eine
140
141 std::list<GbObject3D *> getGbObject3DList() { return this->geoobjects; }
142
143#ifdef CAB_CTL
144 ctl::oStream &write(ctl::oStream &os) const
145 {
146 midPoint->write(os);
147 return os << radius;
148 }
149 ctl::iStream &read(ctl::iStream &is)
150 {
151 midPoint->read(is);
152 return is >> radius;
153 }
154#endif // CAB_CTL
155
156private:
157 GbPoint3D *midPoint;
158 double radius; // Radius des Kreises
159 TRIANGULATIONMODE triangulationMode;
160
161 std::list<GbObject3D *> geoobjects;
162};
163
164#endif // GbObjectGroup3D_H
165
This Class provides basic 3D line objects.
Definition GbLine3D.h:59
This Interface provides basic 3D geometry objects methods.
Definition GbObject3D.h:64
void rotate(const double &, const double &, const double &) override
std::list< GbObject3D * > getGbObject3DList()
double getX1Centroid() override
double getX2Centroid() override
void objectChanged(UbObservable *) override
double getX2Minimum() override
bool hasRaytracing() override
void setTriangulationMode(TRIANGULATIONMODE mode)
double getX3Minimum() override
double getRadius() const
void translate(const double &x1, const double &x2, const double &x3) override
void scale(const double &sx1, const double &, const double &) override
void addGbObject(GbObject3D *object)
double getX2Maximum() override
void objectWillBeDeleted(UbObservable *) override
GbObjectGroup3D(GbObjectGroup3D *)
GbObjectGroup3D * clone() override
TRIANGULATIONMODE getTriangulationMode()
double getX3Maximum() override
double getX1Maximum() override
double getX3Centroid() override
double getX1Minimum() override
This Class provides basic 3D point objects.
Definition GbPoint3D.h:49
double getX3Coordinate() const
Definition GbPoint3D.h:84
double getX1Coordinate() const
Definition GbPoint3D.h:82
double getX2Coordinate() const
Definition GbPoint3D.h:83
This Class provides basic 3D triangle objects.
Observable object.
virtual void notifyObserversObjectChanged()
Observer.
Definition UbObserver.h:51
std::shared_ptr< T > SPtr
bool isCellInsideOrCuttingGbObject3D(const double &x1a, const double &x2a, const double &x3a, const double &x1b, const double &x2b, const double &x3b) override
double getCellVolumeInsideGbObject3D(const double &x1a, const double &x2a, const double &x3a, const double &x1b, const double &x2b, const double &x3b) override
void translate(const double &x1, const double &x2, const double &x3) override
void setCenterCoordinates(const double &x1, const double &x2, const double &x3) override
bool hasIntersectionWithDirectedLine(GbPoint3D origin, GbPoint3D direction)
virtual bool isPointInGbObject3D(GbPoint3D *p)
bool isCellCuttingGbObject3D(const double &x1a, const double &x2a, const double &x3a, const double &x1b, const double &x2b, const double &x3b) override
~GbObjectGroup3D() override
void finalize() override
void setRadius(const double &radius)
double getDistance(GbPoint3D *p)
void setCenterX1Coordinate(const double &value) override
GbLine3D * createClippedLine3D(GbPoint3D &point1, GbPoint3D &point2) override
void addSurfaceTriangleSet(std::vector< UbTupleFloat3 > &nodes, std::vector< UbTupleInt3 > &triangles) override
double getIntersectionRaytraceFactor(const double &x1, const double &x2, const double &x3, const double &rx1, const double &rx2, const double &rx3) override
std::string toString() override
void setCenterX3Coordinate(const double &value) override
std::vector< GbTriangle3D * > getSurfaceTriangleSet() override
bool isPointInGbObject3D(const double &x1, const double &x2, const double &x3) override
void setCenterX2Coordinate(const double &value) override