From c13ca14e3db60ad01b9b968d9175654622e5a354 Mon Sep 17 00:00:00 2001
From: "TESLA03\\Master" <a.wellmann@tu-bs.de>
Date: Wed, 9 Jun 2021 12:33:53 +0200
Subject: [PATCH] use gridReader in MusselOyster

---
 apps/gpu/LBM/MusselOyster/MusselOyster.cpp    | 44 +++++++++++++------
 .../LBM/MusselOyster/configMusselOyster.txt   |  4 +-
 2 files changed, 32 insertions(+), 16 deletions(-)

diff --git a/apps/gpu/LBM/MusselOyster/MusselOyster.cpp b/apps/gpu/LBM/MusselOyster/MusselOyster.cpp
index 7398baeaf..0953c799c 100644
--- a/apps/gpu/LBM/MusselOyster/MusselOyster.cpp
+++ b/apps/gpu/LBM/MusselOyster/MusselOyster.cpp
@@ -70,7 +70,7 @@
 
 
 std::string path("E:/temp/MusselOyster");
-
+std::string gridPath("E:/temp/GridMussel/");
 std::string simulationName("MusselOyster");
 
 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -110,11 +110,15 @@ void multipleLevel(const std::string& configPath)
     ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
     SPtr<Parameter>    para         = Parameter::make(configData, comm);
+    bool useGridGenerator = false;
 
     ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
         std::string bivalveType = "OYSTER"; // "MUSSEL" "OYSTER"    
 
+    
+      if (useGridGenerator) {
+
         real dx = 0.5;
         real vx = (real) 0.005;
         real Re = 50.0;
@@ -178,10 +182,24 @@ void multipleLevel(const std::string& configPath)
         SPtr<Grid> grid = gridBuilder->getGrid(gridBuilder->getNumberOfLevels() - 1);
         //////////////////////////////////////////////////////////////////////////
 
+        para->setDevices(std::vector<uint>{ (uint)0 });
+
+        para->setOutputPath(path);
+        para->setOutputPrefix(simulationName);
+
+        para->setFName(para->getOutputPath() + "/" + para->getOutputPrefix());
+
+        para->setPrintFiles(true);
+
+        para->setMaxLevel(1);
+
+        //////////////////////////////////////////////////////////////////////////
+
+
         // gridBuilder->writeGridsToVtk("E:/temp/MusselOyster/grid/");
         // gridBuilder->writeArrows    ("E:/temp/MusselOyster/grid/arrow");
 
-        SimulationFileWriter::write("E:/temp/MusselOyster/grid/", gridBuilder, FILEFORMAT::BINARY);
+        SimulationFileWriter::write(gridPath, gridBuilder, FILEFORMAT::BINARY);
 
         ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
         ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -198,16 +216,7 @@ void multipleLevel(const std::string& configPath)
 
         ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
-		para->setDevices(std::vector<uint>{(uint)0});
-
-        para->setOutputPath( path );
-        para->setOutputPrefix( simulationName );
-
-        para->setFName(para->getOutputPath() + "/" + para->getOutputPrefix());
-
-        para->setPrintFiles(true);
 
-        para->setMaxLevel(1);
         // para->setVelocity(velocityLB);
         // para->setViscosity(viscosityLB);
 
@@ -224,14 +233,21 @@ void multipleLevel(const std::string& configPath)
         //      });
 
 
-  
+
+       return;
+    }
 
         ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
         SPtr<CudaMemoryManager> cudaMemoryManager = CudaMemoryManager::make(para);
 
-        SPtr<GridProvider> gridGenerator = GridProvider::makeGridGenerator(gridBuilder, para, cudaMemoryManager);
-
+        SPtr<GridProvider> gridGenerator;
+        if (useGridGenerator)
+            gridGenerator = GridProvider::makeGridGenerator(gridBuilder, para, cudaMemoryManager);
+        else {
+            gridGenerator = GridProvider::makeGridReader(FILEFORMAT::BINARY, para, cudaMemoryManager);
+        }
+           
         Simulation sim;
         SPtr<FileWriter> fileWriter = SPtr<FileWriter>(new FileWriter());
         SPtr<KernelFactoryImp> kernelFactory = KernelFactoryImp::getInstance();
diff --git a/apps/gpu/LBM/MusselOyster/configMusselOyster.txt b/apps/gpu/LBM/MusselOyster/configMusselOyster.txt
index 30c408365..52ee1fe70 100644
--- a/apps/gpu/LBM/MusselOyster/configMusselOyster.txt
+++ b/apps/gpu/LBM/MusselOyster/configMusselOyster.txt
@@ -14,8 +14,8 @@
 ##################################################
 #informations for reading
 ##################################################
-#GridPath="E:/MusselOyster/dummy"
-GridPath="C:"
+GridPath="E:/temp/GridMussel"
+#GridPath="C:"
 
 ##################################################
 #number of grid levels
-- 
GitLab