Skip to content
Snippets Groups Projects
Commit 4bc6074f authored by Soeren Peters's avatar Soeren Peters
Browse files

- refactor gridprovider

parent 083579b5
No related branches found
No related tags found
No related merge requests found
......@@ -9,15 +9,6 @@
#include <GPU/CudaMemoryManager.h>
std::shared_ptr<GridProvider> GridProvider::makeGridGenerator(std::shared_ptr<GridBuilder> builder, std::shared_ptr<Parameter> para)
{
return std::shared_ptr<GridProvider>(new GridGenerator(builder, para));
}
std::shared_ptr<GridProvider> GridProvider::makeGridReader(bool readBinaryFiles, std::shared_ptr<Parameter> para)
{
return std::shared_ptr<GridProvider>(new GridReader(readBinaryFiles, para));
}
void GridProvider::setNumberOfNodes(const int numberOfNodes, const int level) const
{
......
......@@ -14,9 +14,6 @@ class CudaMemoryManager;
class VF_PUBLIC GridProvider
{
public:
static std::shared_ptr<GridProvider> makeGridGenerator(std::shared_ptr<GridBuilder> builder, std::shared_ptr<Parameter> para);
static std::shared_ptr<GridProvider> makeGridReader(bool readBinaryFiles, std::shared_ptr<Parameter> para);
virtual void allocArrays_CoordNeighborGeo() = 0;
virtual void allocArrays_BoundaryValues() = 0;
virtual void allocArrays_BoundaryQs() = 0;
......
......@@ -11,6 +11,11 @@
#include <GPU/CudaMemoryManager.h>
#include "OffsetScale.h"
std::shared_ptr<GridProvider> GridReader::make(FileFormat format, std::shared_ptr<Parameter> para)
{
return std::make_shared<GridReader>(format, para);
}
GridReader::GridReader(bool binaer, std::shared_ptr<Parameter> para)
{
this->para = para;
......@@ -29,16 +34,38 @@ GridReader::GridReader(bool binaer, std::shared_ptr<Parameter> para)
channelDirections[5] = "bottom";
}
GridReader::~GridReader()
GridReader::GridReader(FileFormat format, std::shared_ptr<Parameter> para)
{
this->para = para;
this->cudaMemoryManager = CudaMemoryManager::make(para);
this->format = format;
switch(format)
{
case FileFormat::ASCII:
binaer = false; break;
case FileFormat::BINARY:
binaer = true; break;
}
channelDirections.resize(6);
channelBoundaryConditions.resize(6);
BC_Values.resize(6);
channelDirections[0] = "inlet";
channelDirections[1] = "outlet";
channelDirections[2] = "front";
channelDirections[3] = "back";
channelDirections[4] = "top";
channelDirections[5] = "bottom";
}
bool GridReader::getBinaer()
GridReader::~GridReader()
{
return binaer;
}
void rearrangeGeometry(Parameter* para, int lev)
{
for (uint index = 0; index < para->getParH(lev)->size_Mat_SP; index++)
......
......@@ -16,19 +16,28 @@ class BoundaryValues;
class BoundaryQs;
class CoordNeighborGeoV;
enum class FileFormat
{
BINARY, ASCII
};
class VF_PUBLIC GridReader
: public GridProvider
{
private:
bool binaer;
FileFormat format;
std::vector<std::string> channelDirections;
std::vector<std::string> channelBoundaryConditions;
std::shared_ptr<CoordNeighborGeoV> neighX, neighY, neighZ, neighWSB;
std::vector<std::shared_ptr<BoundaryValues> > BC_Values;
public:
GridReader(bool binaer, std::shared_ptr<Parameter> para);
static std::shared_ptr<GridProvider> make(FileFormat format, std::shared_ptr<Parameter> para);
GridReader(bool binaer, std::shared_ptr<Parameter> para);
GridReader(FileFormat format, std::shared_ptr<Parameter> para);
~GridReader();
void allocArrays_CoordNeighborGeo()override;
void allocArrays_BoundaryValues()override;
......@@ -39,7 +48,6 @@ public:
void setChannelBoundaryCondition();
void allocArrays_BoundaryQs()override;
bool getBinaer();
void setDimensions();
void setBoundingBox();
void initPeriodicNeigh(std::vector<std::vector<std::vector<unsigned int> > > periodV, std::vector<std::vector<unsigned int> > periodIndex, std::string way);
......
......@@ -8,6 +8,12 @@
#include <iostream>
#include "utilities/math/Math.h"
std::shared_ptr<GridProvider> GridGenerator::make(std::shared_ptr<GridBuilder> builder, std::shared_ptr<Parameter> para)
{
return std::shared_ptr<GridProvider>(new GridGenerator(builder, para));
}
GridGenerator::GridGenerator(std::shared_ptr<GridBuilder> builder, std::shared_ptr<Parameter> para)
{
this->builder = builder;
......
......@@ -22,6 +22,9 @@ private:
std::shared_ptr<GridBuilder> builder;
public:
VF_PUBLIC static std::shared_ptr<GridProvider> make(std::shared_ptr<GridBuilder> builder, std::shared_ptr<Parameter> para);
VF_PUBLIC GridGenerator(std::shared_ptr<GridBuilder> builder, std::shared_ptr<Parameter> para);
VF_PUBLIC virtual ~GridGenerator();
......
......@@ -34,6 +34,8 @@
#include "io/STLReaderWriter/STLWriter.h"
#include "geometries/TriangularMesh/TriangularMeshStrategy.h"
#include "Output/FileWriter.h"
#include "DataStructureInitializer/GridReaderFiles/GridReader.h"
#include "DataStructureInitializer/GridReaderGenerator/GridGenerator.h"
std::string getGridPath(std::shared_ptr<Parameter> para, std::string Gridpath)
......@@ -267,9 +269,9 @@ void multipleLevel(const std::string& configPath)
//TriangularMesh* triangularMesh = TriangularMesh::make("D:/GRIDGENERATION/STL/quadarBinaer.stl", DiscretizationMethod::POINT_IN_OBJECT);
gridBuilder->addCoarseGrid(-12, -10, -10, 55, 24, 25, 0.5);
gridBuilder->addCoarseGrid(-12, -10, -10, 55, 24, 25, 1.0);
gridBuilder->addGrid(new Cuboid(-10, -8, -8, 50, 22, 22));
TriangularMesh* triangularMesh = TriangularMesh::make("D:/GRIDGENERATION/STL/input/local_input/bruecke.stl");
//gridBuilder->addGrid(triangularMesh, 2);
gridBuilder->addGeometry(triangularMesh);
......@@ -300,8 +302,8 @@ void multipleLevel(const std::string& configPath)
SPtr<Parameter> para = Parameter::make();
SPtr<GridProvider> gridGenerator = GridProvider::makeGridGenerator(gridBuilder, para);
//SPtr<GridProvider> gridGenerator = GridProvider::makeGridReader(false, para);
SPtr<GridProvider> gridGenerator = GridGenerator::make(gridBuilder, para);
//SPtr<GridProvider> gridGenerator = GridReader::make(FileFormat::BINARY, para);
std::ifstream stream;
stream.open(configPath.c_str(), std::ios::in);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment