From 382e1ffb11ef0f4478ab880edf87767d8676bb18 Mon Sep 17 00:00:00 2001
From: markus holzer <markus.holzer@fau.de>
Date: Wed, 16 Sep 2020 17:19:10 +0200
Subject: [PATCH] Idea VTK writer

---
 .../codegen/03_AdvancedLBMCodegen.cpp         | 25 ++++++++++++++-----
 .../codegen/03_AdvancedLBMCodegen.prm         |  2 +-
 2 files changed, 20 insertions(+), 7 deletions(-)

diff --git a/apps/tutorials/codegen/03_AdvancedLBMCodegen.cpp b/apps/tutorials/codegen/03_AdvancedLBMCodegen.cpp
index 2f07ed670..011c68fae 100644
--- a/apps/tutorials/codegen/03_AdvancedLBMCodegen.cpp
+++ b/apps/tutorials/codegen/03_AdvancedLBMCodegen.cpp
@@ -29,10 +29,7 @@
 #include "geometry/all.h"
 
 #include "lbm/boundary/factories/DefaultBoundaryHandling.h"
-#include "lbm/communication/PdfFieldPackInfo.h"
-#include "lbm/field/AddToStorage.h"
-#include "lbm/field/PdfField.h"
-#include "lbm/field/initializer/all.h"
+#include "field/vtk/VTKWriter.h"
 #include "lbm/vtk/VTKOutput.h"
 
 #include "stencil/D2Q9.h"
@@ -227,9 +224,25 @@ int main(int argc, char** argv)
    timeloop.addFuncAfterTimeStep(timing::RemainingTimeLogger(timeloop.getNrOfTimeSteps(), remainingTimeLoggerFrequency),
                                  "remaining time logger");
 
+   int vtkWriteFrequency = 100;
+   if (vtkWriteFrequency > 0)
+   {
+      const std::string path = "vtk_out";
+      auto vtkOutput = vtk::createVTKOutput_BlockData(*blocks, "vtk", vtkWriteFrequency, 0, false, path,
+                                                      "simulation_step", false, true, true, false, 0);
+
+
+      auto velWriter = make_shared<field::VTKWriter<VectorField_T>>(velocityFieldId, "Velocity");
+      vtkOutput->addCellDataWriter(velWriter);
+
+      timeloop.addFuncBeforeTimeStep(vtk::writeFiles(vtkOutput), "VTK Output");
+
+
+   }
+
    // VTK Output
-   VTKOutputSetup vtkOutput(velocityFieldId, flagFieldId, fluidFlagUID);
-   vtkOutput.initializeAndAdd(timeloop, blocks, walberlaEnv.config());
+   // VTKOutputSetup vtkOutput(velocityFieldId, flagFieldId, fluidFlagUID);
+   // vtkOutput.initializeAndAdd(timeloop, blocks, walberlaEnv.config());
 
    timeloop.run();
 
diff --git a/apps/tutorials/codegen/03_AdvancedLBMCodegen.prm b/apps/tutorials/codegen/03_AdvancedLBMCodegen.prm
index 95220134a..3b78cc083 100644
--- a/apps/tutorials/codegen/03_AdvancedLBMCodegen.prm
+++ b/apps/tutorials/codegen/03_AdvancedLBMCodegen.prm
@@ -2,7 +2,7 @@
 Parameters 
 {
 	omega           1.8;
-	timesteps       100;
+	timesteps       1000;
 
 	remainingTimeLoggerFrequency 3; // in seconds
 }
-- 
GitLab