VirtualFluids 0.2.0
Parallel CFD LBM Solver
Loading...
Searching...
No Matches
TriangularMesh.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 TriangularMesh_h
35#define TriangularMesh_h
36
37#include <vector>
38#include <string>
39#include <memory>
40#include "global.h"
41
44
45#include "geometries/Object.h"
46
47class GbTriFaceMesh3D;
48
49namespace vf::gpu {
50
51class GeometryMemento;
52
54
55
56class TriangularMesh : public Object
57{
58public:
59
60 static TriangularMesh* make(const std::string& fileName, const std::vector<uint> ignorePatches = std::vector<uint>());
62 TriangularMesh(const std::string& inputPath, const std::vector<uint> ignorePatches = std::vector<uint>());
63 TriangularMesh(const std::string& inputPath, const BoundingBox &box);
64 ~TriangularMesh() override = default;
65
67
68 void setTriangles(std::vector<Triangle> triangles);
70
71 std::vector<Triangle> triangleVec;
72 Triangle *triangles = nullptr;
73 long size = 0;
75
77
78 bool operator==(const TriangularMesh &geometry) const;
79
80 void findNeighbors();
81
83
85
86private:
87
88 void initalizeDataFromTriangles();
89
90 static std::vector<Vertex> getAverrageNormalsPerVertex(std::vector<std::vector<Triangle> > trianglesPerVertex);
91 static void eliminateTriangleswithIdenticialNormal(std::vector<Triangle> &triangles);
92
93public:
94 SPtr<Object> clone() const override;
95 double getX1Centroid() const override { throw "Not implemented in TriangularMesh"; }
96 double getX1Minimum() const override { return minmax.minX; }
97 double getX1Maximum() const override { return minmax.maxX; }
98 double getX2Centroid() const override { throw "Not implemented in TriangularMesh"; }
99 double getX2Minimum() const override { return minmax.minY; }
100 double getX2Maximum() const override { return minmax.maxY; }
101 double getX3Centroid() const override { throw "Not implemented in TriangularMesh"; }
102 double getX3Minimum() const override { return minmax.minZ; }
103 double getX3Maximum() const override { return minmax.maxZ; }
104 void changeSizeByDelta(double delta) override;
105 bool isPointInObject(const double& x1, const double& x2, const double& x3, const double& minOffset,
106 const double& maxOffset) override
107 {
108 (void)x1;
109 (void)x2;
110 (void)x3;
113 return false;
114 }
115
116 void findInnerNodes(SPtr<GridImp> grid) override;
117};
118
119}
120
121#endif
122
void setMinMax(BoundingBox minmax)
static TriangularMesh * make(const std::string &fileName, const std::vector< uint > ignorePatches=std::vector< uint >())
double getX3Maximum() const override
void findInnerNodes(SPtr< GridImp > grid) override
SPtr< GbTriFaceMesh3D > VF_GbTriFaceMesh3D
double getX3Minimum() const override
double getX2Centroid() const override
double getX1Maximum() const override
double getX1Minimum() const override
SPtr< Object > clone() const override
double getX2Maximum() const override
GbTriFaceMesh3D * getGbTriFaceMesh3D() const
std::vector< Triangle > triangleVec
double getX3Centroid() const override
uint getNumberOfTriangles() const
void setTriangles(std::vector< Triangle > triangles)
void changeSizeByDelta(double delta) override
bool isPointInObject(const double &x1, const double &x2, const double &x3, const double &minOffset, const double &maxOffset) override
~TriangularMesh() override=default
double getX1Centroid() const override
double getX2Minimum() const override
bool operator==(const TriangularMesh &geometry) const
std::shared_ptr< T > SPtr
unsigned int uint
Definition DataTypes.h:47