VirtualFluids 0.2.0
Parallel CFD LBM Solver
Loading...
Searching...
No Matches
VerticalCylinder.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 "VerticalCylinder.h"
35
36namespace vf::gpu {
37
38VerticalCylinder::VerticalCylinder(const double& centerX, const double& centerY, const double& centerZ, const double& radius, const double& height)
39 : centerX(centerX), centerY(centerY), centerZ(centerZ), radius(radius), height(height)
40{
41
42}
43
44SPtr<VerticalCylinder> VerticalCylinder::makeShared(double centerX, double centerY, double centerZ, double radius, double height)
45{
46 return std::make_shared<VerticalCylinder>(centerX, centerY, centerZ, radius, height);
47}
48
50{
51 return std::make_shared<VerticalCylinder>(centerX, centerY, centerZ, radius, height);
52}
53
55{
56 return centerX;
57}
58
60{
61 return centerX - radius;
62}
63
65{
66 return centerX + radius;
67}
68
70{
71 return centerY;
72}
73
75{
76 return centerY - radius;
77}
78
80{
81 return centerY + radius;
82}
83
85{
86 return centerZ;
87}
88
90{
91 return centerZ - 0.5 * height;
92}
93
95{
96 return centerZ + 0.5 * height;
97}
98
99bool VerticalCylinder::isPointInObject(const double& x1, const double& x2, const double& x3, const double& minOffset, const double& maxOffset)
100{
101 double offset = maxOffset;
102 if (x1 < centerX || x2 < centerY || x3 < centerZ)
103 offset = minOffset;
104
105
106 const double deltaX1 = x1 - centerX;
107 const double deltaX2 = x2 - centerY;
108 const double deltaX3 = x3 - centerZ;
109
110 if( deltaX3 > 0.5 * height || deltaX3 < - 0.5 * height )
111 return false;
112
113 return (deltaX1*deltaX1 + deltaX2*deltaX2) < ((this->radius - offset) * (this->radius - offset));
114}
115
116
118{
119 this->radius += delta;
120 this->height += 2 * delta;
121}
122
124{
125 return radius;
126}
127
129{
130 return height;
131}
132
133}
134
double getX1Minimum() const override
double getX3Maximum() const override
double getX1Maximum() const override
void changeSizeByDelta(double delta) override
double getX2Minimum() const override
double getX3Centroid() const override
static SPtr< VerticalCylinder > makeShared(double centerX, double centerY, double centerZ, double radius, double height)
double getX1Centroid() const override
double getX2Maximum() const override
double getX2Centroid() const override
VerticalCylinder(const double &centerX, const double &centerY, const double &centerZ, const double &radius, const double &height)
SPtr< Object > clone() const override
bool isPointInObject(const double &x1, const double &x2, const double &x3, const double &minOffset, const double &maxOffset) override
double getX3Minimum() const override
std::shared_ptr< T > SPtr