VirtualFluids 0.2.0
Parallel CFD LBM Solver
Loading...
Searching...
No Matches
GbObject3D.cpp
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#include <GbObject3D.h>
35#include <GbPoint3D.h>
37
38using namespace std;
39
40/*======================================================================*/
42{
43 return this->isPointInGbObject3D(p->getX1Centroid(), p->getX2Coordinate(), p->getX3Coordinate());
44}
45/*======================================================================*/
46bool GbObject3D::isCellInsideGbObject3D(const double &x1a, const double &x2a, const double &x3a, const double &x1b,
47 const double &x2b, const double &x3b)
48{
49
50 if (this->isPointInGbObject3D(x1a, x2a, x3a) && this->isPointInGbObject3D(x1b, x2a, x3a) &&
51 this->isPointInGbObject3D(x1b, x2b, x3a) && this->isPointInGbObject3D(x1a, x2b, x3a) &&
52 this->isPointInGbObject3D(x1a, x2a, x3b) && this->isPointInGbObject3D(x1b, x2a, x3b) &&
53 this->isPointInGbObject3D(x1b, x2b, x3b) && this->isPointInGbObject3D(x1a, x2b, x3b)) {
54 return true;
55 }
56
57 return false;
58}
59/*======================================================================*/
60bool GbObject3D::isCellCuttingGbObject3D(const double &x1a, const double &x2a, const double &x3a, const double &x1b,
61 const double &x2b, const double &x3b)
62{
63 if (this->isPointInGbObject3D(x1a, x2a, x3a) || this->isPointInGbObject3D(x1b, x2a, x3a) ||
64 this->isPointInGbObject3D(x1b, x2b, x3a) || this->isPointInGbObject3D(x1a, x2b, x3a) ||
65 this->isPointInGbObject3D(x1a, x2a, x3b) || this->isPointInGbObject3D(x1b, x2a, x3b) ||
66 this->isPointInGbObject3D(x1b, x2b, x3b) || this->isPointInGbObject3D(x1a, x2b, x3b)) {
67 if (!this->isPointInGbObject3D(x1a, x2a, x3a) || !this->isPointInGbObject3D(x1b, x2a, x3a) ||
68 !this->isPointInGbObject3D(x1b, x2b, x3a) || !this->isPointInGbObject3D(x1a, x2b, x3a) ||
69 !this->isPointInGbObject3D(x1a, x2a, x3b) || !this->isPointInGbObject3D(x1b, x2a, x3b) ||
70 !this->isPointInGbObject3D(x1b, x2b, x3b) || !this->isPointInGbObject3D(x1a, x2b, x3b))
71 return true;
72 }
73 return false;
74}
75/*======================================================================*/
76bool GbObject3D::isCellInsideOrCuttingGbObject3D(const double &x1a, const double &x2a, const double &x3a,
77 const double &x1b, const double &x2b, const double &x3b)
78{
79 if (this->isPointInGbObject3D(x1a, x2a, x3a) || this->isPointInGbObject3D(x1b, x2a, x3a) ||
80 this->isPointInGbObject3D(x1b, x2b, x3a) || this->isPointInGbObject3D(x1a, x2b, x3a) ||
81 this->isPointInGbObject3D(x1a, x2a, x3b) || this->isPointInGbObject3D(x1b, x2a, x3b) ||
82 this->isPointInGbObject3D(x1b, x2b, x3b) || this->isPointInGbObject3D(x1a, x2b, x3b)) {
83 return true;
84 }
85
86 return false;
87}
88/*=======================================================*/
89bool GbObject3D::isInsideCell(const double &minX1, const double &minX2, const double &minX3, const double &maxX1,
90 const double &maxX2, const double &maxX3)
91{
92 if (ub_math::greaterEqual(this->getX1Minimum(), minX1) && ub_math::greaterEqual(this->getX2Minimum(), minX2) &&
93 ub_math::greaterEqual(this->getX3Minimum(), minX3) && ub_math::lessEqual(this->getX1Maximum(), maxX1) &&
94 ub_math::lessEqual(this->getX2Maximum(), maxX2) && ub_math::lessEqual(this->getX3Maximum(), maxX3))
95 return true;
96
97 return false;
98}
99
virtual double getX1Maximum()=0
virtual double getX3Minimum()=0
virtual double getX2Minimum()=0
virtual double getX2Maximum()=0
virtual double getX1Minimum()=0
virtual double getX3Maximum()=0
This Class provides basic 3D point objects.
Definition GbPoint3D.h:49
double getX1Centroid() override
Definition GbPoint3D.h:88
std::shared_ptr< T > SPtr
virtual bool isCellInsideGbObject3D(const double &x1a, const double &x2a, const double &x3a, const double &x1b, const double &x2b, const double &x3b)
virtual bool isPointInGbObject3D(GbPoint3D *p)
virtual bool isCellCuttingGbObject3D(const double &x1a, const double &x2a, const double &x3a, const double &x1b, const double &x2b, const double &x3b)
virtual bool isInsideCell(const double &minX1, const double &minX2, const double &minX3, const double &maxX1, const double &maxX2, const double &maxX3)
virtual bool isCellInsideOrCuttingGbObject3D(const double &x1a, const double &x2a, const double &x3a, const double &x1b, const double &x2b, const double &x3b)
bool greaterEqual(const T1 &value, const T2 &reference)
Definition UbMath.h:223
bool lessEqual(const T1 &value, const T2 &reference)
Definition UbMath.h:209