VirtualFluids 0.2.0
Parallel CFD LBM Solver
Loading...
Searching...
No Matches
GbQuadFaceMesh3D.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 GBQUADFACEMESH3D_H
35#define GBQUADFACEMESH3D_H
36
37#include <iostream>
38#include <sstream>
39
42
43#include <PointerDefinitions.h>
44
45class UbFileOutput;
46class UbFileInput;
47/*=========================================================================*/
48/* GbQuadFaceMesh3D */
49/* */
56{
57public:
58 // nested class start
59 class Vertex
60 {
61 public:
62 Vertex() = default;
63 Vertex(float x, float y, float z)
64 {
65 this->x = x;
66 this->y = y;
67 this->z = z;
68 }
69 float x, y, z;
70 };
71
73 {
74 public:
75 QuadFace() = default;
76 QuadFace(int v1, int v2, int v3, int v4)
77 {
78 this->vertex1 = v1;
79 this->vertex2 = v2;
80 this->vertex3 = v3;
81 this->vertex4 = v4;
82 }
83
85 };
86 // nested class end
87
88public:
90 GbQuadFaceMesh3D(std::string name, std::vector<Vertex> *nodes, std::vector<QuadFace> *quads);
91 ~GbQuadFaceMesh3D() override;
92 GbQuadFaceMesh3D *clone() override { throw UbException(UB_EXARGS, "clone() - not implemented"); }
93 void finalize() override { throw UbException(UB_EXARGS, "finalize() - not implemented"); }
94
95 std::string toString() override;
96 std::string getName() override;
97 std::vector<Vertex> *getNodes();
98 std::vector<QuadFace> *getQuads();
99 double getX1Centroid() override;
100 double getX2Centroid() override;
101 double getX3Centroid() override;
102 double getX1Minimum() override;
103 double getX1Maximum() override;
104 double getX2Minimum() override;
105 double getX2Maximum() override;
106 double getX3Minimum() override;
107 double getX3Maximum() override;
108 void calculateValues();
109
110 bool isPointInGbObject3D(const double &x1, const double &x2, const double &x3) override;
111 bool isPointInGbObject3D(const double &x1, const double &x2, const double &x3, bool &pointIsOnBoundary) override;
112
113 bool isPointInObject3DHalfSpace(const double &xp, const double &yp,
114 const double &zp); // based on Halfspace algorithm
115 // bool isPointInObject3DSpherical(const double& xp, const double& yp, const double& zp, int numQuads); //based
116 // on Spherical polygon area method bool isPointInObject3DRayCrossing(const double& xp, const double& yp, const
117 // double& zp, int radius, int numVertices, int numQuads); //based on Ray tracing algorithm
118
119 // char SegPlaneInt(GbQuad3D *quad, GbVector3D &PointQ, GbVector3D &PointR, GbVector3D &Point, int *m);
120 // char SegQuadCross(GbQuad3D *quad, GbVector3D &PointQ, GbVector3D &PointR);
121 // till here !!!
122
124 // virtual std::vector<GbQuad3D*> getSurfaceQuadSet();
125 std::vector<GbTriangle3D *> getSurfaceTriangleSet() override;
126
127 virtual void write(UbFileOutput * /*out*/) { std::cout << "GbQuadFaceMesh3D::write - sorry not implemented\n"; }
128 virtual void read(UbFileInput * /*in*/) { std::cout << "GbQuadFaceMesh3D::read - sorry not implemented\n"; }
129
130 void writeAVSMesh(UbFileOutput *out, bool normals = false);
131
132 /*======================================================================*/
133 using GbObject3D::isPointInGbObject3D; // Grund: dadurch muss man hier isPointInGbObject3D(GbPoint3D*) nicht
134 // ausprogrammieren, welche sonst hier "ueberdeckt" waere
135private:
136 void init();
137 /*======================================================================*/
138 std::string name;
139 std::vector<Vertex> *nodes;
140 std::vector<QuadFace> *quads;
141 double x1min;
142 double x1max;
143 double x2min;
144 double x2max;
145 double x3min;
146 double x3max;
147 bool consistent;
148};
149/*=========================================================================*/
150
151#endif
152
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
QuadFace(int v1, int v2, int v3, int v4)
Vertex(float x, float y, float z)
void writeAVSMesh(UbFileOutput *out, bool normals=false)
GbQuadFaceMesh3D(std::string name, std::vector< Vertex > *nodes, std::vector< QuadFace > *quads)
virtual void read(UbFileInput *)
virtual void write(UbFileOutput *)
void finalize() override
GbQuadFaceMesh3D * clone() override
std::shared_ptr< T > SPtr
double getX2Maximum() override
double getX1Centroid() override
double getX3Centroid() override
double getX2Minimum() override
bool isPointInGbObject3D(const double &x1, const double &x2, const double &x3) override
double getX3Minimum() override
std::vector< Vertex > * getNodes()
virtual bool isPointInGbObject3D(GbPoint3D *p)
GbLine3D * createClippedLine3D(GbPoint3D &point1, GbPoint3D &point2) override
std::vector< GbTriangle3D * > getSurfaceTriangleSet() override
double getX1Maximum() override
double getX2Centroid() override
bool isPointInObject3DHalfSpace(const double &xp, const double &yp, const double &zp)
double getX1Minimum() override
~GbQuadFaceMesh3D() override
double getX3Maximum() override
std::string getName() override
std::string toString() override
std::vector< QuadFace > * getQuads()
#define UB_EXARGS
Definition UbException.h:73