VirtualFluids 0.2.0
Parallel CFD LBM Solver
Loading...
Searching...
No Matches
GridFactory.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 GRID_FACTORY_H
35#define GRID_FACTORY_H
36
37#include "global.h"
38
41
42#include "grid/GridImp.h"
43
44namespace vf::gpu {
45
47{
49#if defined(VF_HAS_FAST_WINDING)
51#endif
52};
53
55{
56public:
58 {
59 return std::make_shared<GridFactory>();
60 }
61
62 SPtr<Grid> makeGrid(SPtr<Object> gridShape, real startX, real startY, real startZ, real endX, real endY, real endZ, real delta, uint level, const std::string& d3Qxx = "D3Q27")
63 {
64 SPtr<GridImp> grid;
65
66 grid = GridImp::makeShared(gridShape, startX, startY, startZ, endX, endY, endZ, delta, d3Qxx, level);
67
68 if (triangularMeshDiscretizationStrategy)
69 grid->setTriangularMeshDiscretizationStrategy(triangularMeshDiscretizationStrategy);
70 else
71 grid->setTriangularMeshDiscretizationStrategy(std::make_shared<PointInObjectDiscretizationStrategy>());
72
73 return grid;
74 }
75
77 {
79 {
81 triangularMeshDiscretizationStrategy = std::make_shared<PointUnderTriangleStrategy>();
82 break;
84 triangularMeshDiscretizationStrategy = std::make_shared<RayCastingDiscretizationStrategy>();
85 break;
87 triangularMeshDiscretizationStrategy = std::make_shared<PointInObjectDiscretizationStrategy>();
88 break;
89#if defined(VF_HAS_FAST_WINDING)
90 case TriangularMeshDiscretizationMethod::FAST_WINDING:
91 triangularMeshDiscretizationStrategy = std::make_shared<FastWindingDiscretizationStrategy>();
92 break;
93#endif
94 }
95 }
96
99 {
100 triangularMeshDiscretizationStrategy = strategy;
101 }
102
103private:
104 SPtr<TriangularMeshDiscretizationStrategy> triangularMeshDiscretizationStrategy;
105};
106
107}
108
109#endif
110
void setTriangularMeshDiscretizationMethod(TriangularMeshDiscretizationMethod triangularMeshDiscretizationMethod)
Definition GridFactory.h:76
SPtr< Grid > makeGrid(SPtr< Object > gridShape, real startX, real startY, real startZ, real endX, real endY, real endZ, real delta, uint level, const std::string &d3Qxx="D3Q27")
Definition GridFactory.h:62
void setTriangularMeshDiscretizationStrategy(SPtr< TriangularMeshDiscretizationStrategy > strategy)
Definition GridFactory.h:97
static SPtr< GridFactory > make()
Definition GridFactory.h:57
static SPtr< GridImp > makeShared(SPtr< Object > object, real startX, real startY, real startZ, real endX, real endY, real endZ, real delta, std::string d3Qxx, uint level)
Definition GridImp.cpp:107
std::shared_ptr< T > SPtr
float real
Definition DataTypes.h:42
unsigned int uint
Definition DataTypes.h:47
TriangularMeshDiscretizationMethod
Definition GridFactory.h:47