VirtualFluids 0.2.0
Parallel CFD LBM Solver
Loading...
Searching...
No Matches
GridProvider.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//
32//=======================================================================================
33#ifndef GridReader_H
34#define GridReader_H
35
36#include <memory>
37#include <string>
38#include <vector>
39
42
44
45namespace vf::parallel
46{
47class Communicator;
48}
49
50
51namespace vf::gpu {
52
53class Parameter;
54class GridBuilder;
55class CudaMemoryManager;
56class BoundaryConditionFactory;
57
59{
60public:
61 static std::shared_ptr<GridProvider> makeGridGenerator(std::shared_ptr<GridBuilder> builder, std::shared_ptr<Parameter> para, std::shared_ptr<CudaMemoryManager> cudaMemoryManager, vf::parallel::Communicator& communicator);
62 static std::shared_ptr<GridProvider> makeGridReader(FILEFORMAT format, std::shared_ptr<Parameter> para, std::shared_ptr<CudaMemoryManager> cudaMemoryManager);
63
64 virtual void allocArrays_CoordNeighborGeo() = 0;
65 virtual void allocArrays_BoundaryValues(const BoundaryConditionFactory* bcFactory) = 0;
66 virtual void allocArrays_BoundaryQs() = 0;
67 virtual void allocArrays_OffsetScale() = 0;
68 virtual void allocArrays_taggedFluidNodes() = 0;
69
70 virtual void tagFluidNodeIndices(const std::vector<uint>& taggedFluidNodeIndices, CollisionTemplate tag, uint level) = 0;
71 virtual void sortFluidNodeTags() = 0;
72
73 virtual void setDimensions() = 0;
74 virtual void setBoundingBox() = 0;
75 virtual void initPeriodicNeigh(std::vector<std::vector<std::vector<unsigned int> > > periodV, std::vector<std::vector<unsigned int> > periodIndex, std::string way) = 0;
76
77 virtual void allocAndCopyForcing();
78 virtual void allocAndCopyQuadricLimiters();
79 virtual void freeMemoryOnHost();
80 virtual void cudaCopyDataToHost(int level);
81
82 virtual ~GridProvider() = default;
83 virtual void initalGridInformations() = 0;
84
85protected:
86 void setNumberOfNodes(uint numberOfNodes, int level) const;
87 void setNumberOfTaggedFluidNodes(uint numberOfNodes, CollisionTemplate tag, int level) const;
88 virtual void setInitialNodeValues(uint numberOfNodes, int level) const; // needs to be virtual for tests
89 void setInitialNodeValuesAD(uint numberOfNodes, int level) const;
90
91 void setPressSizePerLevel(int level, int sizePerLevel) const;
92 void setVelocitySizePerLevel(int level, int sizePerLevel) const;
93 void setOutflowSizePerLevel(int level, int sizePerLevel) const;
94
95 std::shared_ptr<Parameter> para;
96 std::shared_ptr<CudaMemoryManager> cudaMemoryManager;
97};
98
99}
100
101#endif
102
std::shared_ptr< Parameter > para
void setOutflowSizePerLevel(int level, int sizePerLevel) const
virtual void allocAndCopyForcing()
virtual void sortFluidNodeTags()=0
void setInitialNodeValuesAD(uint numberOfNodes, int level) const
virtual ~GridProvider()=default
void setNumberOfTaggedFluidNodes(uint numberOfNodes, CollisionTemplate tag, int level) const
void setVelocitySizePerLevel(int level, int sizePerLevel) const
static std::shared_ptr< GridProvider > makeGridGenerator(std::shared_ptr< GridBuilder > builder, std::shared_ptr< Parameter > para, std::shared_ptr< CudaMemoryManager > cudaMemoryManager, vf::parallel::Communicator &communicator)
void setPressSizePerLevel(int level, int sizePerLevel) const
virtual void setInitialNodeValues(uint numberOfNodes, int level) const
static std::shared_ptr< GridProvider > makeGridReader(FILEFORMAT format, std::shared_ptr< Parameter > para, std::shared_ptr< CudaMemoryManager > cudaMemoryManager)
virtual void initPeriodicNeigh(std::vector< std::vector< std::vector< unsigned int > > > periodV, std::vector< std::vector< unsigned int > > periodIndex, std::string way)=0
virtual void allocArrays_BoundaryQs()=0
virtual void setBoundingBox()=0
virtual void tagFluidNodeIndices(const std::vector< uint > &taggedFluidNodeIndices, CollisionTemplate tag, uint level)=0
std::shared_ptr< CudaMemoryManager > cudaMemoryManager
virtual void allocArrays_BoundaryValues(const BoundaryConditionFactory *bcFactory)=0
virtual void cudaCopyDataToHost(int level)
void setNumberOfNodes(uint numberOfNodes, int level) const
virtual void allocArrays_CoordNeighborGeo()=0
virtual void freeMemoryOnHost()
virtual void setDimensions()=0
virtual void allocAndCopyQuadricLimiters()
virtual void initalGridInformations()=0
virtual void allocArrays_taggedFluidNodes()=0
virtual void allocArrays_OffsetScale()=0
An abstract class for communication between processes in parallel computation.
std::shared_ptr< T > SPtr
unsigned int uint
Definition DataTypes.h:47
CollisionTemplate
An enumeration for selecting a template of the collision kernel (CumulantK17)
Definition Calculation.h:57