From 1e25ed31cd532e5df7ef73cb8921d277189c7d4c Mon Sep 17 00:00:00 2001
From: Soeren Peters <peters@irmb.tu-bs.de>
Date: Thu, 11 Jan 2018 13:19:16 +0100
Subject: [PATCH] - fix cuda macro - little bug fixes to integrate gridgen to
 vf

---
 CMakeLists.txt                                |   5 +-
 CMakeMacros/Cuda/Link.cmake                   |   4 +-
 .../GridWrapperGPU/GridWrapperGPU.cpp         |   3 +-
 .../DataStructureInitializer/GridProvider.cpp |  78 +++++----
 src/VirtualFluids_GPU/Parameter/Parameter.cpp |  10 +-
 targets/apps/HULC/main.cpp                    | 157 ++++++++++++++++--
 6 files changed, 199 insertions(+), 58 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1d14ce501..296cbd135 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -69,15 +69,16 @@ ENDIF(MSVC)
 ###                         OPTIONS                       ###
 #############################################################
 option(BUILD_SHARED_LIBS "Build shared libraries" ON)
-option(HULC.BUILD_VirtualFluids "Builds virtual Fluids" ON)
+option(HULC.BUILD_VirtualFluids "Builds virtual Fluids" OFF)
 option(HULC.BUILD_dem_coupling "Builds dem coupling " ON)
 option(HULC.BUILD_GPU_CODE "Build gpu VirtualFluids" ON)
 option(HULC.BUILD_JSONCPP "Builds json cpp " ON)
-option(HULC.BUILD_TESTS "Build shared libraries" ON)
+option(HULC.BUILD_TESTS "Build shared libraries" OFF)
 
 option(VF_DOUBLE_ACCURACY "Build shared libraries" ON)
 
 if(HULC.BUILD_GPU_CODE)
+  #SET(CMAKE_CUDA_COMPILER $ENV{CUDA_PATH_V9_0}/bin/nvcc.exe)
   enable_language(CUDA)
 endif()
 sharedLibs()
diff --git a/CMakeMacros/Cuda/Link.cmake b/CMakeMacros/Cuda/Link.cmake
index 02e38c7b7..db34e95d8 100644
--- a/CMakeMacros/Cuda/Link.cmake
+++ b/CMakeMacros/Cuda/Link.cmake
@@ -3,8 +3,8 @@ macro(linkCuda)
 
     find_path(CUDA_CUT_INCLUDE_DIR
       helper_cuda.h
-      PATHS "$ENV{NVCUDASAMPLES8_0_ROOT}"
-      PATH_SUFFIXES "common/inc" "v8.0/common/inc"
+      PATHS "$ENV{NVCUDASAMPLES_ROOT}"
+      PATH_SUFFIXES "common/inc"
       DOC "Location of helper_cuda.h"
       NO_DEFAULT_PATH
     )
diff --git a/src/GridGenerator/grid/GridWrapper/GridWrapperGPU/GridWrapperGPU.cpp b/src/GridGenerator/grid/GridWrapper/GridWrapperGPU/GridWrapperGPU.cpp
index d658bc34e..dbf8faf1e 100644
--- a/src/GridGenerator/grid/GridWrapper/GridWrapperGPU/GridWrapperGPU.cpp
+++ b/src/GridGenerator/grid/GridWrapper/GridWrapperGPU/GridWrapperGPU.cpp
@@ -13,6 +13,7 @@
 
 
 #include <utilities/logger/Logger.h>
+#include <helper_cuda.h>
 
 
 GridWrapperGPU::GridWrapperGPU(BoundingBox<int> &channel, std::string d3Qxx)
@@ -149,7 +150,7 @@ void GridWrapperGPU::allocDistribution()
     real sizeInMB = size_in_bytes / (1024.f*1024.f);
     *logging::out << logging::Logger::INTERMEDIATE << "Allocating " + SSTR(sizeInMB) + " [MB] device memory for distributions.\n\n";
 
-    CudaSafeCall(cudaMalloc(&grid.d.f, size_in_bytes));
+    checkCudaErrors(cudaMalloc(&grid.d.f, size_in_bytes));
     CudaCheckError();
 }
 
diff --git a/src/VirtualFluids_GPU/DataStructureInitializer/GridProvider.cpp b/src/VirtualFluids_GPU/DataStructureInitializer/GridProvider.cpp
index 01b29f5cb..f20251dcf 100644
--- a/src/VirtualFluids_GPU/DataStructureInitializer/GridProvider.cpp
+++ b/src/VirtualFluids_GPU/DataStructureInitializer/GridProvider.cpp
@@ -21,52 +21,74 @@ std::shared_ptr<GridProvider> GridProvider::makeGridReader(bool readBinaryFiles,
 
 void GridProvider::setNumberOfNodes(const int numberOfNodes, const int level) const
 {
-	para->getParH(level)->size_Mat_SP = numberOfNodes;
-	para->getParD(level)->size_Mat_SP = numberOfNodes;
-	para->getParH(level)->mem_size_real_SP = sizeof(real) * para->getParH(level)->size_Mat_SP;
-	para->getParH(level)->mem_size_int_SP = sizeof(unsigned int) * para->getParH(level)->size_Mat_SP;
-	para->getParD(level)->mem_size_real_SP = sizeof(real) * para->getParD(level)->size_Mat_SP;
-	para->getParD(level)->mem_size_int_SP = sizeof(unsigned int) * para->getParD(level)->size_Mat_SP;
+    para->getParH(level)->size_Mat_SP = numberOfNodes;
+    para->getParD(level)->size_Mat_SP = numberOfNodes;
+    para->getParH(level)->mem_size_real_SP = sizeof(real) * para->getParH(level)->size_Mat_SP;
+    para->getParH(level)->mem_size_int_SP = sizeof(unsigned int) * para->getParH(level)->size_Mat_SP;
+    para->getParD(level)->mem_size_real_SP = sizeof(real) * para->getParD(level)->size_Mat_SP;
+    para->getParD(level)->mem_size_int_SP = sizeof(unsigned int) * para->getParD(level)->size_Mat_SP;
 }
 
 void GridProvider::setInitalNodeValues(const int numberOfNodes, const int level) const
 {
-	for (int j = 0; j <= numberOfNodes; j++)
-	{
-		para->getParH(level)->vx_SP[j] = para->getVelocity();//0.0f;//0.035f;
-		para->getParH(level)->vy_SP[j] = 0.0f;//para->getVelocity();//0.0f;
-		para->getParH(level)->vz_SP[j] = 0.0f;
-		para->getParH(level)->rho_SP[j] = 0.0f;
-		para->getParH(level)->press_SP[j] = 0.0f;
-	}
+    //Taylor Green Vortex uniform
+    real PI = 3.141592653589793238462643383279f;
+    real gridX = para->getParH(level)->gridNX - 1;
+    real gridY = para->getParH(level)->gridNY - 1;
+    real gridZ = para->getParH(level)->gridNZ - 1;
+    //like MG
+    //real uAdvect = real (1. / 250.); //32 nodes -> 250; 40 nodes -> 200; 64 nodes -> 500; 128 nodes -> 1000; 256 nodes -> 2000; 512 nodes -> 4000
+    real uAdvect = real(0.0016); //32 nodes -> 0.032; 64 nodes -> 0.016; 128 nodes -> 0.008; 256 nodes -> 0.004; 512 nodes -> 0.002
+
+    for (int j = 0; j <= numberOfNodes; j++)
+    {
+        para->getParH(level)->rho_SP[j] =
+            (real)((para->getVelocity()*para->getVelocity())*3.0 / 4.0*(cos(para->getParH(level)->coordX_SP[j] * 4.0*PI /
+            (real)gridX) + cos(para->getParH(level)->coordZ_SP[j] * 4.0*PI /
+                (real)gridZ)))*(real)(gridZ) / (real)(gridX);
+
+        para->getParH(level)->vy_SP[j] = (real)0.0;
+        para->getParH(level)->vx_SP[j] =
+            (real)(para->getVelocity()*sin((para->getParH(level)->coordX_SP[j] * 2.0*PI / (real)gridX))*cos(para->getParH(level)->coordZ_SP[j] * 2.0*PI / (real)gridZ)) + uAdvect * (1.0 + para->getParH(level)->rho_SP[j]);
+        para->getParH(level)->vz_SP[j] =
+            (real)(-para->getVelocity()*cos((para->getParH(level)->coordX_SP[j] * 2.0*PI / (real)gridX))*sin(para->getParH(level)->coordZ_SP[j] * 2.0*PI / (real)gridZ));// *(real)(gridZ) / (real)(gridX);
+
+       //para->getParH(level)->vx_SP[j] = para->getVelocity();//0.0f;//0.035f;
+       //para->getParH(level)->vy_SP[j] = 0.0f;//para->getVelocity();//0.0f;
+       //para->getParH(level)->vz_SP[j] = 0.0f;
+       //para->getParH(level)->rho_SP[j] = 0.0f;
+       //para->getParH(level)->press_SP[j] = 0.0f;
+    }
+
+
 }
 
 
 void GridProvider::setPressSizePerLevel(int level, int sizePerLevel) const
 {
-	para->getParH(level)->QPress.kQ = sizePerLevel;
-	para->getParD(level)->QPress.kQ = sizePerLevel;
-	para->getParH(level)->kPressQread = sizePerLevel * para->getD3Qxx();
-	para->getParD(level)->kPressQread = sizePerLevel * para->getD3Qxx();
+    para->getParH(level)->QPress.kQ = sizePerLevel;
+    para->getParD(level)->QPress.kQ = sizePerLevel;
+    para->getParH(level)->kPressQread = sizePerLevel * para->getD3Qxx();
+    para->getParD(level)->kPressQread = sizePerLevel * para->getD3Qxx();
 }
 
 
 void GridProvider::setVelocitySizePerLevel(int level, int sizePerLevel) const
 {
-	para->getParH(level)->Qinflow.kQ = sizePerLevel;
-	para->getParD(level)->Qinflow.kQ = sizePerLevel;
-	para->getParH(level)->kInflowQ = sizePerLevel;
-	para->getParD(level)->kInflowQ = sizePerLevel;
-	para->getParH(level)->kInflowQread = sizePerLevel * para->getD3Qxx();
-	para->getParD(level)->kInflowQread = sizePerLevel * para->getD3Qxx();
+    para->getParH(level)->Qinflow.kQ = sizePerLevel;
+    para->getParD(level)->Qinflow.kQ = sizePerLevel;
+    para->getParH(level)->kInflowQ = sizePerLevel;
+    para->getParD(level)->kInflowQ = sizePerLevel;
+    para->getParH(level)->kInflowQread = sizePerLevel * para->getD3Qxx();
+    para->getParD(level)->kInflowQread = sizePerLevel * para->getD3Qxx();
 }
 
 void GridProvider::setOutflowSizePerLevel(int level, int sizePerLevel) const
 {
-	para->getParH(level)->Qoutflow.kQ = sizePerLevel;
-	para->getParD(level)->Qoutflow.kQ = sizePerLevel;
-	para->getParH(level)->kOutflowQread = sizePerLevel * para->getD3Qxx();
-	para->getParD(level)->kOutflowQread = sizePerLevel * para->getD3Qxx();
+    para->getParH(level)->Qoutflow.kQ = sizePerLevel;
+    para->getParD(level)->Qoutflow.kQ = sizePerLevel;
+    para->getParH(level)->kOutflowQread = sizePerLevel * para->getD3Qxx();
+    para->getParD(level)->kOutflowQread = sizePerLevel * para->getD3Qxx();
 }
 
 void GridProvider::allocAndCopyForcing()
diff --git a/src/VirtualFluids_GPU/Parameter/Parameter.cpp b/src/VirtualFluids_GPU/Parameter/Parameter.cpp
index fbebf5f35..e270d12a9 100644
--- a/src/VirtualFluids_GPU/Parameter/Parameter.cpp
+++ b/src/VirtualFluids_GPU/Parameter/Parameter.cpp
@@ -2623,13 +2623,9 @@ void Parameter::cudaFreeProcessNeighborADZ(int lev, unsigned int processNeighbor
 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 void Parameter::setForcing(real forcingX, real forcingY, real forcingZ)
 {
-	cudaAllocForcing();
-	//copy forces
-	this->forcingH[0] = forcingX;
-	this->forcingH[1] = forcingY;
-	this->forcingH[2] = forcingZ;
-	//copy data to device
-	cudaCopyForcingToDevice();
+	this->hostForcing[0] = forcingX;
+	this->hostForcing[1] = forcingY;
+	this->hostForcing[2] = forcingZ;
 }
 void Parameter::setPhi(real inPhi)
 {
diff --git a/targets/apps/HULC/main.cpp b/targets/apps/HULC/main.cpp
index 8612f653f..5f78cea41 100644
--- a/targets/apps/HULC/main.cpp
+++ b/targets/apps/HULC/main.cpp
@@ -15,6 +15,8 @@
 #include "DataStructureInitializer/GridProvider.h"
 #include "VirtualFluidsBasics/utilities/input/Input.h"
 #include "VirtualFluidsBasics/utilities/StringUtil/StringUtil.h"
+#include "grid/GridBuilder/GridBuilderImp.h"
+#include "utilities/transformator/TransformatorImp.h"
 
 
 std::string getGridPath(std::shared_ptr<Parameter> para, std::string Gridpath)
@@ -27,28 +29,58 @@ std::string getGridPath(std::shared_ptr<Parameter> para, std::string Gridpath)
 
 void setParameters(std::shared_ptr<Parameter> para, std::unique_ptr<input::Input> &input)
 {
-    para->setMaxDev(StringUtil::toInt(input->getValue("NumberOfDevices")));
-    para->setDevices(StringUtil::toVector/*<int>*/(input->getValue("Devices")));
-
     std::string _path = input->getValue("Path");
     std::string _prefix = input->getValue("Prefix");
     std::string _gridpath = input->getValue("GridPath");
     std::string gridPath = getGridPath(para, _gridpath);
+    para->setMaxDev(StringUtil::toInt(input->getValue("NumberOfDevices")));
+    para->setDevices(StringUtil::toVector(input->getValue("Devices")));
+    para->setOutputPath(_path);
+    para->setOutputPrefix(_prefix);
     para->setFName(_path + "/" + _prefix);
     para->setPrintFiles(false);
     para->setPrintFiles(StringUtil::toBool(input->getValue("WriteGrid")));
+    para->setGeometryValues(StringUtil::toBool(input->getValue("GeometryValues")));
+    para->setCalc2ndOrderMoments(StringUtil::toBool(input->getValue("calc2ndOrderMoments")));
+    para->setCalc3rdOrderMoments(StringUtil::toBool(input->getValue("calc3rdOrderMoments")));
+    para->setCalcHighOrderMoments(StringUtil::toBool(input->getValue("calcHigherOrderMoments")));
+    para->setReadGeo(StringUtil::toBool(input->getValue("ReadGeometry")));
+    para->setCalcMedian(StringUtil::toBool(input->getValue("calcMedian")));
+    para->setConcFile(StringUtil::toBool(input->getValue("UseConcFile")));
+    para->setUseMeasurePoints(StringUtil::toBool(input->getValue("UseMeasurePoints")));
+    para->setUseWale(StringUtil::toBool(input->getValue("UseWale")));
+    para->setSimulatePorousMedia(StringUtil::toBool(input->getValue("SimulatePorousMedia")));
     para->setD3Qxx(StringUtil::toInt(input->getValue("D3Qxx")));
     para->setMaxLevel(StringUtil::toInt(input->getValue("NOGL")));
     para->setTEnd(StringUtil::toInt(input->getValue("TimeEnd")));
     para->setTOut(StringUtil::toInt(input->getValue("TimeOut")));
-
+    para->setTStartOut(StringUtil::toInt(input->getValue("TimeStartOut")));
+    para->setTimeCalcMedStart(StringUtil::toInt(input->getValue("TimeStartCalcMedian")));
+    para->setTimeCalcMedEnd(StringUtil::toInt(input->getValue("TimeEndCalcMedian")));
+    para->setPressInID(StringUtil::toInt(input->getValue("PressInID")));
+    para->setPressOutID(StringUtil::toInt(input->getValue("PressOutID")));
+    para->setPressInZ(StringUtil::toInt(input->getValue("PressInZ")));
+    para->setPressOutZ(StringUtil::toInt(input->getValue("PressOutZ")));
+    //////////////////////////////////////////////////////////////////////////
+    para->setDiffOn(StringUtil::toBool(input->getValue("DiffOn")));
+    para->setDiffMod(StringUtil::toInt(input->getValue("DiffMod")));
+    para->setDiffusivity(StringUtil::toFloat(input->getValue("Diffusivity")));
+    para->setTemperatureInit(StringUtil::toFloat(input->getValue("Temp")));
+    para->setTemperatureBC(StringUtil::toFloat(input->getValue("TempBC")));
+    //////////////////////////////////////////////////////////////////////////
     para->setViscosity(StringUtil::toFloat(input->getValue("Viscosity_LB")));
     para->setVelocity(StringUtil::toFloat(input->getValue("Velocity_LB")));
     para->setViscosityRatio(StringUtil::toFloat(input->getValue("Viscosity_Ratio_World_to_LB")));
     para->setVelocityRatio(StringUtil::toFloat(input->getValue("Velocity_Ratio_World_to_LB")));
     para->setDensityRatio(StringUtil::toFloat(input->getValue("Density_Ratio_World_to_LB")));
+    para->setPressRatio(StringUtil::toFloat(input->getValue("Delta_Press")));
+    para->setRealX(StringUtil::toFloat(input->getValue("SliceRealX")));
+    para->setRealY(StringUtil::toFloat(input->getValue("SliceRealY")));
     para->setFactorPressBC(StringUtil::toFloat(input->getValue("dfpbc")));
-
+    para->setGeometryFileC(input->getValue("GeometryC"));
+    para->setGeometryFileM(input->getValue("GeometryM"));
+    para->setGeometryFileF(input->getValue("GeometryF"));
+    //////////////////////////////////////////////////////////////////////////
     para->setgeoVec(gridPath + input->getValue("geoVec"));
     para->setcoordX(gridPath + input->getValue("coordX"));
     para->setcoordY(gridPath + input->getValue("coordY"));
@@ -56,6 +88,12 @@ void setParameters(std::shared_ptr<Parameter> para, std::unique_ptr<input::Input
     para->setneighborX(gridPath + input->getValue("neighborX"));
     para->setneighborY(gridPath + input->getValue("neighborY"));
     para->setneighborZ(gridPath + input->getValue("neighborZ"));
+    para->setscaleCFC(gridPath + input->getValue("scaleCFC"));
+    para->setscaleCFF(gridPath + input->getValue("scaleCFF"));
+    para->setscaleFCC(gridPath + input->getValue("scaleFCC"));
+    para->setscaleFCF(gridPath + input->getValue("scaleFCF"));
+    para->setscaleOffsetCF(gridPath + input->getValue("scaleOffsetCF"));
+    para->setscaleOffsetFC(gridPath + input->getValue("scaleOffsetFC"));
     para->setgeomBoundaryBcQs(gridPath + input->getValue("geomBoundaryBcQs"));
     para->setgeomBoundaryBcValues(gridPath + input->getValue("geomBoundaryBcValues"));
     para->setinletBcQs(gridPath + input->getValue("inletBcQs"));
@@ -72,23 +110,60 @@ void setParameters(std::shared_ptr<Parameter> para, std::unique_ptr<input::Input
     para->setbackBcValues(gridPath + input->getValue("backBcValues"));
     para->setnumberNodes(gridPath + input->getValue("numberNodes"));
     para->setLBMvsSI(gridPath + input->getValue("LBMvsSI"));
-
-
+    //////////////////////////////gridPath + ////////////////////////////////////////////
+    para->setmeasurePoints(gridPath + input->getValue("measurePoints"));
+    para->setpropellerValues(gridPath + input->getValue("propellerValues"));
+    para->setclockCycleForMP(StringUtil::toFloat(input->getValue("measureClockCycle")));
+    para->settimestepForMP(StringUtil::toInt(input->getValue("measureTimestep")));
+    para->setcpTop(gridPath + input->getValue("cpTop"));
+    para->setcpBottom(gridPath + input->getValue("cpBottom"));
+    para->setcpBottom2(gridPath + input->getValue("cpBottom2"));
+    para->setConcentration(gridPath + input->getValue("Concentration"));
+    //////////////////////////////////////////////////////////////////////////
+    //Normals - Geometry
+    para->setgeomBoundaryNormalX(gridPath + input->getValue("geomBoundaryNormalX"));
+    para->setgeomBoundaryNormalY(gridPath + input->getValue("geomBoundaryNormalY"));
+    para->setgeomBoundaryNormalZ(gridPath + input->getValue("geomBoundaryNormalZ"));
+    //Normals - Inlet
+    para->setInflowBoundaryNormalX(gridPath + input->getValue("inletBoundaryNormalX"));
+    para->setInflowBoundaryNormalY(gridPath + input->getValue("inletBoundaryNormalY"));
+    para->setInflowBoundaryNormalZ(gridPath + input->getValue("inletBoundaryNormalZ"));
+    //Normals - Outlet
+    para->setOutflowBoundaryNormalX(gridPath + input->getValue("outletBoundaryNormalX"));
+    para->setOutflowBoundaryNormalY(gridPath + input->getValue("outletBoundaryNormalY"));
+    para->setOutflowBoundaryNormalZ(gridPath + input->getValue("outletBoundaryNormalZ"));
+    //////////////////////////////////////////////////////////////////////////
+    //Forcing
     para->setForcing(StringUtil::toFloat(input->getValue("ForcingX")), StringUtil::toFloat(input->getValue("ForcingY")), StringUtil::toFloat(input->getValue("ForcingZ")));
-
-    para->setDistX(StringUtil::toVector/*<int>*/(input->getValue("DistX")));
-    para->setDistY(StringUtil::toVector/*<int>*/(input->getValue("DistY")));
-    para->setDistZ(StringUtil::toVector/*<int>*/(input->getValue("DistZ")));
-
+    //////////////////////////////////////////////////////////////////////////
+    //Particles
+    para->setCalcParticles(StringUtil::toBool(input->getValue("calcParticles")));
+    para->setParticleBasicLevel(StringUtil::toInt(input->getValue("baseLevel")));
+    para->setParticleInitLevel(StringUtil::toInt(input->getValue("initLevel")));
+    para->setNumberOfParticles(StringUtil::toInt(input->getValue("numberOfParticles")));
+    para->setneighborWSB(gridPath + input->getValue("neighborWSB"));
+    para->setStartXHotWall(StringUtil::toDouble(input->getValue("startXHotWall")));
+    para->setEndXHotWall(StringUtil::toDouble(input->getValue("endXHotWall")));
     //////////////////////////////////////////////////////////////////////////
     //for Multi GPU
-    if (para->getNumprocs() > 1)
+    if (para->getNumprocs()>1)
     {
+        ////////////////////////////////////////////////////////////////////////////
+        ////1D domain decomposition
+        //std::vector<std::string> sendProcNeighbors;
+        //std::vector<std::string> recvProcNeighbors;
+        //for (int i = 0; i<para->getNumprocs();i++)
+        //{
+        // sendProcNeighbors.push_back(gridPath + StringUtil::toString(i) + "s.dat");
+        // recvProcNeighbors.push_back(gridPath + StringUtil::toString(i) + "r.dat");
+        //}
+        //para->setPossNeighborFiles(sendProcNeighbors, "send");
+        //para->setPossNeighborFiles(recvProcNeighbors, "recv");
         //////////////////////////////////////////////////////////////////////////
         //3D domain decomposition
         std::vector<std::string> sendProcNeighborsX, sendProcNeighborsY, sendProcNeighborsZ;
         std::vector<std::string> recvProcNeighborsX, recvProcNeighborsY, recvProcNeighborsZ;
-        for (int i = 0; i < para->getNumprocs(); i++)
+        for (int i = 0; i<para->getNumprocs(); i++)
         {
             sendProcNeighborsX.push_back(gridPath + StringUtil::toString(i) + "Xs.dat");
             sendProcNeighborsY.push_back(gridPath + StringUtil::toString(i) + "Ys.dat");
@@ -104,24 +179,70 @@ void setParameters(std::shared_ptr<Parameter> para, std::unique_ptr<input::Input
         para->setPossNeighborFilesY(recvProcNeighborsY, "recv");
         para->setPossNeighborFilesZ(recvProcNeighborsZ, "recv");
     }
+    //////////////////////////////////////////////////////////////////////////
+    //para->setkFull(             input->getValue( "kFull" ));
+    //para->setgeoFull(           input->getValue( "geoFull" ));
+    //para->setnoSlipBcPos(       input->getValue( "noSlipBcPos" ));
+    //para->setnoSlipBcQs(          input->getValue( "noSlipBcQs" ));
+    //para->setnoSlipBcValues(      input->getValue( "noSlipBcValues" ));
+    //para->setnoSlipBcValue(     input->getValue( "noSlipBcValue" ));
+    //para->setslipBcPos(         input->getValue( "slipBcPos" ));
+    //para->setslipBcQs(          input->getValue( "slipBcQs" ));
+    //para->setslipBcValue(       input->getValue( "slipBcValue" ));
+    //para->setpressBcPos(        input->getValue( "pressBcPos" ));
+    //para->setpressBcQs(           input->getValue( "pressBcQs" ));
+    //para->setpressBcValues(       input->getValue( "pressBcValues" ));
+    //para->setpressBcValue(      input->getValue( "pressBcValue" ));
+    //para->setvelBcQs(             input->getValue( "velBcQs" ));
+    //para->setvelBcValues(         input->getValue( "velBcValues" ));
+    //para->setpropellerCylinder( input->getValue( "propellerCylinder" ));
+    //para->setpropellerQs(		 input->getValue( "propellerQs"      ));
+    //para->setwallBcQs(            input->getValue( "wallBcQs"         ));
+    //para->setwallBcValues(        input->getValue( "wallBcValues"     ));
+    //para->setperiodicBcQs(        input->getValue( "periodicBcQs"     ));
+    //para->setperiodicBcValues(    input->getValue( "periodicBcValues" ));
+    //cout << "Try this: " << para->getgeomBoundaryBcValues() << endl;
+
+    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+    //Restart
+    para->setTimeDoCheckPoint(StringUtil::toInt(input->getValue("TimeDoCheckPoint")));
+    para->setTimeDoRestart(StringUtil::toInt(input->getValue("TimeDoRestart")));
+    para->setDoCheckPoint(StringUtil::toBool(input->getValue("DoCheckPoint")));
+    para->setDoRestart(StringUtil::toBool(input->getValue("DoRestart")));
+    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+    para->setGridX(StringUtil::toVector(input->getValue("GridX")));                      //GridX = StringUtil::toVector<int>(input->getValue( "GridX" ));          
+    para->setGridY(StringUtil::toVector(input->getValue("GridY")));                      //GridY = StringUtil::toVector<int>(input->getValue( "GridY" ));          
+    para->setGridZ(StringUtil::toVector(input->getValue("GridZ")));                      //GridZ = StringUtil::toVector<int>(input->getValue( "GridZ" ));
+    para->setDistX(StringUtil::toVector(input->getValue("DistX")));                      //DistX = StringUtil::toVector<int>(input->getValue( "DistX" ));
+    para->setDistY(StringUtil::toVector(input->getValue("DistY")));                      //DistY = StringUtil::toVector<int>(input->getValue( "DistY" ));
+    para->setDistZ(StringUtil::toVector(input->getValue("DistZ")));                      //DistZ = StringUtil::toVector<int>(input->getValue( "DistZ" )); 
+                                                                                          ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+    //para->setNeedInterface(StringUtil::toVector<bool>(input->getValue("NeedInterface")));
 }
 
 void simulate(const std::string& configPath)
 {
-    std::shared_ptr<Parameter> para = Parameter::make();
-    std::shared_ptr<GridProvider> reader = GridProvider::makeGridReader(true, para);
+    SPtr<GridBuilder> builder = GridBuilderImp::make("gpu");
+
+
+    SPtr<Parameter> para = Parameter::make();
+    SPtr<GridProvider> gridGenerator = GridProvider::makeGridGenerator(builder, para);
+    //std::shared_ptr<GridProvider> reader = GridProvider::makeGridReader(true, para);
 
     std::ifstream stream;
     stream.open(configPath.c_str(), std::ios::in);
     if (stream.fail())
         throw "can not open config file!\n";
 
-    std::unique_ptr<input::Input> input = input::Input::makeInput(stream, "config");
+    UPtr<input::Input> input = input::Input::makeInput(stream, "config");
 
     setParameters(para, input);
 
+    SPtr<Transformator> trans(new TransformatorImp());
+    builder->addGrid(para->getGridX()[0], para->getGridY()[0], para->getGridZ()[0], 1.0, "D3Q27", trans);
+
     Simulation sim;
-    sim.init(para, reader);
+    sim.init(para, gridGenerator);
     sim.run();
 }
 
-- 
GitLab