From 0bff0985c75999aa441773cf2c3c218304622180 Mon Sep 17 00:00:00 2001
From: Dominik Thoennes <dominik.thoennes@fau.de>
Date: Fri, 16 Aug 2019 12:28:57 +0200
Subject: [PATCH] [API] move SQLite into its own module

To break unneeded dependencies in postprocessing the SQLite part is
moved to its own module and namespace.
Therefore in the include and the function calls
"postprocessing" hast to be removed or replaced by "sqlite" e.g.:
#include "postprocessing/sqlite/SQLite.h" ->
#include "sqlite/SQLite.h"

postprocessing::store... -> sqlite::store...
---
 apps/benchmarks/CouetteFlow/CMakeLists.txt           |  2 +-
 apps/benchmarks/CouetteFlow/CouetteFlow.cpp          | 10 +++++-----
 apps/benchmarks/FieldCommunication/CMakeLists.txt    |  2 +-
 .../FieldCommunication/FieldCommunication.cpp        |  8 ++++----
 apps/benchmarks/GranularGas/CMakeLists.txt           |  6 +++---
 apps/benchmarks/GranularGas/MESA_PD_GranularGas.cpp  |  6 +++---
 .../GranularGas/MESA_PD_KernelBenchmark.cpp          |  6 +++---
 apps/benchmarks/GranularGas/NodeTimings.cpp          |  2 +-
 apps/benchmarks/GranularGas/NodeTimings.h            |  2 +-
 apps/benchmarks/GranularGas/PE_GranularGas.cpp       |  6 +++---
 apps/benchmarks/NonUniformGrid/CMakeLists.txt        |  2 +-
 apps/benchmarks/NonUniformGrid/NonUniformGrid.cpp    | 12 ++++++------
 apps/benchmarks/PoiseuilleChannel/CMakeLists.txt     |  2 +-
 .../PoiseuilleChannel/PoiseuilleChannel.cpp          | 10 +++++-----
 apps/benchmarks/ProbeVsExtraMessage/CMakeLists.txt   |  2 +-
 .../ProbeVsExtraMessage/ProbeVsExtraMessage.cpp      |  8 ++++----
 apps/benchmarks/SchaeferTurek/CMakeLists.txt         |  2 +-
 apps/benchmarks/SchaeferTurek/SchaeferTurek.cpp      | 12 ++++++------
 apps/benchmarks/UniformGrid/CMakeLists.txt           |  2 +-
 apps/benchmarks/UniformGrid/UniformGrid.cpp          |  6 +++---
 apps/tutorials/pe/02_ConfinedGasExtended.cpp         |  8 ++++----
 apps/tutorials/pe/CMakeLists.txt                     |  2 +-
 src/postprocessing/all.h                             |  4 +---
 src/sqlite/CMakeLists.txt                            |  9 +++++++++
 src/{postprocessing => }/sqlite/SQLite.cpp           |  4 ++--
 src/{postprocessing => }/sqlite/SQLite.h             |  4 ++--
 src/{postprocessing => }/sqlite/extern/sqlite3.c     |  0
 src/{postprocessing => }/sqlite/extern/sqlite3.h     |  0
 tests/mesh/PeVTKMeshWriterTest.cpp                   |  1 -
 tests/postprocessing/CMakeLists.txt                  |  5 +----
 tests/sqlite/CMakeLists.txt                          |  8 ++++++++
 tests/{postprocessing => sqlite}/SQLiteTest.cpp      |  6 +++---
 32 files changed, 85 insertions(+), 74 deletions(-)
 create mode 100644 src/sqlite/CMakeLists.txt
 rename src/{postprocessing => }/sqlite/SQLite.cpp (99%)
 rename src/{postprocessing => }/sqlite/SQLite.h (99%)
 rename src/{postprocessing => }/sqlite/extern/sqlite3.c (100%)
 rename src/{postprocessing => }/sqlite/extern/sqlite3.h (100%)
 create mode 100644 tests/sqlite/CMakeLists.txt
 rename tests/{postprocessing => sqlite}/SQLiteTest.cpp (88%)

diff --git a/apps/benchmarks/CouetteFlow/CMakeLists.txt b/apps/benchmarks/CouetteFlow/CMakeLists.txt
index 90057e86e..c4cb893e0 100644
--- a/apps/benchmarks/CouetteFlow/CMakeLists.txt
+++ b/apps/benchmarks/CouetteFlow/CMakeLists.txt
@@ -1,7 +1,7 @@
 
 waLBerla_link_files_to_builddir( "*.dat" )                 
                                   
-waLBerla_add_executable( NAME CouetteFlow DEPENDS blockforest boundary core field lbm postprocessing stencil timeloop vtk )
+waLBerla_add_executable( NAME CouetteFlow DEPENDS blockforest boundary core field lbm postprocessing stencil timeloop vtk sqlite )
 
 ##############
 # Some tests #
diff --git a/apps/benchmarks/CouetteFlow/CouetteFlow.cpp b/apps/benchmarks/CouetteFlow/CouetteFlow.cpp
index 9ce1da4a3..4bedb5742 100644
--- a/apps/benchmarks/CouetteFlow/CouetteFlow.cpp
+++ b/apps/benchmarks/CouetteFlow/CouetteFlow.cpp
@@ -79,7 +79,7 @@
 #include "lbm/vtk/NonEquilibrium.h"
 #include "lbm/vtk/Velocity.h"
 
-#include "postprocessing/sqlite/SQLite.h"
+#include "sqlite/SQLite.h"
 
 #include "stencil/D3Q15.h"
 #include "stencil/D3Q19.h"
@@ -871,10 +871,10 @@ void run( const shared_ptr< Config > & config, const LatticeModel_T & latticeMod
             
             realProperties[ "simulationProgress" ] = double_c( ( outerRun + uint_t(1) ) * innerTimeSteps ) / double_c( outerTimeSteps * innerTimeSteps );
 
-            auto runId = postprocessing::storeRunInSqliteDB( sqlFile, integerProperties, stringProperties, realProperties );
-            postprocessing::storeTimingPoolInSqliteDB( sqlFile, runId, *reducedTimeloopTiming, "Timeloop" );
-            postprocessing::storeTimingPoolInSqliteDB( sqlFile, runId, *reducedRTSTiming, "RefinementTimeStep" );
-            postprocessing::storeTimingPoolInSqliteDB( sqlFile, runId, *reducedRTSLTiming, "RefinementTimeStepLevelwise" );
+            auto runId = sqlite::storeRunInSqliteDB( sqlFile, integerProperties, stringProperties, realProperties );
+            sqlite::storeTimingPoolInSqliteDB( sqlFile, runId, *reducedTimeloopTiming, "Timeloop" );
+            sqlite::storeTimingPoolInSqliteDB( sqlFile, runId, *reducedRTSTiming, "RefinementTimeStep" );
+            sqlite::storeTimingPoolInSqliteDB( sqlFile, runId, *reducedRTSLTiming, "RefinementTimeStepLevelwise" );
          }
       }
    }
diff --git a/apps/benchmarks/FieldCommunication/CMakeLists.txt b/apps/benchmarks/FieldCommunication/CMakeLists.txt
index beec451f9..35a2f698a 100644
--- a/apps/benchmarks/FieldCommunication/CMakeLists.txt
+++ b/apps/benchmarks/FieldCommunication/CMakeLists.txt
@@ -4,4 +4,4 @@ waLBerla_link_files_to_builddir( "*.py" )
 
 
 waLBerla_add_executable ( NAME FieldCommunication
-                          DEPENDS blockforest core domain_decomposition field postprocessing )
+                          DEPENDS blockforest core domain_decomposition field postprocessing sqlite )
diff --git a/apps/benchmarks/FieldCommunication/FieldCommunication.cpp b/apps/benchmarks/FieldCommunication/FieldCommunication.cpp
index 2273126b3..fabde23e0 100644
--- a/apps/benchmarks/FieldCommunication/FieldCommunication.cpp
+++ b/apps/benchmarks/FieldCommunication/FieldCommunication.cpp
@@ -14,7 +14,7 @@
 #include "field/communication/PackInfo.h"
 #include "field/communication/StencilRestrictedPackInfo.h"
 #include "field/communication/UniformMPIDatatypeInfo.h"
-#include "postprocessing/sqlite/SQLite.h"
+#include "sqlite/SQLite.h"
 #include "python_coupling/CreateConfig.h"
 #include "stencil/D3Q7.h"
 #include "stencil/D3Q19.h"
@@ -414,9 +414,9 @@ int main( int argc, char **argv )
             stringProperties["buildType"] = std::string( WALBERLA_BUILD_TYPE );
             stringProperties["compilerFlags"] = std::string( WALBERLA_COMPILER_FLAGS );
 
-            auto runId = postprocessing::storeRunInSqliteDB( databaseFile, integerProperties, stringProperties, realProperties );
-            postprocessing::storeTimingPoolInSqliteDB( databaseFile, runId, timingPool, "TimingRoot" );
-            postprocessing::storeTimingPoolInSqliteDB( databaseFile, runId, *reducedTimingPool, "TimingReduced" );
+            auto runId = sqlite::storeRunInSqliteDB( databaseFile, integerProperties, stringProperties, realProperties );
+            sqlite::storeTimingPoolInSqliteDB( databaseFile, runId, timingPool, "TimingRoot" );
+            sqlite::storeTimingPoolInSqliteDB( databaseFile, runId, *reducedTimingPool, "TimingReduced" );
         }
 
     }
diff --git a/apps/benchmarks/GranularGas/CMakeLists.txt b/apps/benchmarks/GranularGas/CMakeLists.txt
index 0a0f9b462..0e214cc4d 100644
--- a/apps/benchmarks/GranularGas/CMakeLists.txt
+++ b/apps/benchmarks/GranularGas/CMakeLists.txt
@@ -3,12 +3,12 @@ waLBerla_link_files_to_builddir( *.py )
 
 waLBerla_add_executable ( NAME PE_GranularGas
    FILES PE_GranularGas.cpp SQLProperties.cpp Parameters.cpp NodeTimings.cpp
-                          DEPENDS blockforest core pe postprocessing )
+                          DEPENDS blockforest core pe postprocessing sqlite )
 
 waLBerla_add_executable ( NAME MESA_PD_GranularGas
    FILES MESA_PD_GranularGas.cpp SQLProperties.cpp Parameters.cpp NodeTimings.cpp sortParticleStorage.cpp CreateParticles.cpp
-                          DEPENDS blockforest core pe mesa_pd postprocessing vtk )
+                          DEPENDS blockforest core pe mesa_pd postprocessing vtk sqlite )
 
 waLBerla_add_executable ( NAME MESA_PD_KernelBenchmark
    FILES MESA_PD_KernelBenchmark.cpp SQLProperties.cpp Parameters.cpp NodeTimings.cpp sortParticleStorage.cpp CreateParticles.cpp
-                          DEPENDS blockforest core pe mesa_pd postprocessing vtk )
+                          DEPENDS blockforest core pe mesa_pd postprocessing vtk sqlite )
diff --git a/apps/benchmarks/GranularGas/MESA_PD_GranularGas.cpp b/apps/benchmarks/GranularGas/MESA_PD_GranularGas.cpp
index d6b241e02..7881196fd 100644
--- a/apps/benchmarks/GranularGas/MESA_PD_GranularGas.cpp
+++ b/apps/benchmarks/GranularGas/MESA_PD_GranularGas.cpp
@@ -58,7 +58,7 @@
 #include <core/OpenMP.h>
 #include <core/timing/Timer.h>
 #include <core/waLBerlaBuildInfo.h>
-#include <postprocessing/sqlite/SQLite.h>
+#include <sqlite/SQLite.h>
 #include <vtk/VTKOutput.h>
 
 #include <functional>
@@ -372,8 +372,8 @@ int main( int argc, char ** argv )
          addDomainPropertiesToSQL(*forest, integerProperties, realProperties, stringProperties);
          addSlurmPropertiesToSQL(integerProperties, realProperties, stringProperties);
 
-         runId = postprocessing::storeRunInSqliteDB( params.sqlFile, integerProperties, stringProperties, realProperties );
-         postprocessing::storeTimingPoolInSqliteDB( params.sqlFile, runId, *tp_reduced, "Timeloop" );
+         runId = sqlite::storeRunInSqliteDB( params.sqlFile, integerProperties, stringProperties, realProperties );
+         sqlite::storeTimingPoolInSqliteDB( params.sqlFile, runId, *tp_reduced, "Timeloop" );
       }
 
       if (params.storeNodeTimings)
diff --git a/apps/benchmarks/GranularGas/MESA_PD_KernelBenchmark.cpp b/apps/benchmarks/GranularGas/MESA_PD_KernelBenchmark.cpp
index 5469a6a2f..34ad97912 100644
--- a/apps/benchmarks/GranularGas/MESA_PD_KernelBenchmark.cpp
+++ b/apps/benchmarks/GranularGas/MESA_PD_KernelBenchmark.cpp
@@ -64,7 +64,7 @@
 #include <core/timing/Timer.h>
 #include <core/timing/TimingPool.h>
 #include <core/waLBerlaBuildInfo.h>
-#include <postprocessing/sqlite/SQLite.h>
+#include <sqlite/SQLite.h>
 #include <vtk/VTKOutput.h>
 
 #include <functional>
@@ -378,8 +378,8 @@ int main( int argc, char ** argv )
          addDomainPropertiesToSQL(*forest, integerProperties, realProperties, stringProperties);
          addSlurmPropertiesToSQL(integerProperties, realProperties, stringProperties);
 
-         runId = postprocessing::storeRunInSqliteDB( params.sqlFile, integerProperties, stringProperties, realProperties );
-         postprocessing::storeTimingPoolInSqliteDB( params.sqlFile, runId, *tp_reduced, "Timeloop" );
+         runId = sqlite::storeRunInSqliteDB( params.sqlFile, integerProperties, stringProperties, realProperties );
+         sqlite::storeTimingPoolInSqliteDB( params.sqlFile, runId, *tp_reduced, "Timeloop" );
       }
       if (params.storeNodeTimings)
       {
diff --git a/apps/benchmarks/GranularGas/NodeTimings.cpp b/apps/benchmarks/GranularGas/NodeTimings.cpp
index 01b1a354b..8336d7981 100644
--- a/apps/benchmarks/GranularGas/NodeTimings.cpp
+++ b/apps/benchmarks/GranularGas/NodeTimings.cpp
@@ -63,7 +63,7 @@ void storeNodeTimings( const uint_t                 runId,
             realProperties[v.first] = v.second.average();
          }
 
-         postprocessing::storeAdditionalRunInfoInSqliteDB( runId,
+         sqlite::storeAdditionalRunInfoInSqliteDB( runId,
                                                            dbFile,
                                                            tableName,
                                                            integerProperties,
diff --git a/apps/benchmarks/GranularGas/NodeTimings.h b/apps/benchmarks/GranularGas/NodeTimings.h
index cbe074b1b..cc59fd547 100644
--- a/apps/benchmarks/GranularGas/NodeTimings.h
+++ b/apps/benchmarks/GranularGas/NodeTimings.h
@@ -23,7 +23,7 @@
 #include <core/mpi/Gatherv.h>
 #include <core/logging/Logging.h>
 #include <core/timing/TimingPool.h>
-#include <postprocessing/sqlite/SQLite.h>
+#include <sqlite/SQLite.h>
 
 namespace walberla {
 namespace mesa_pd {
diff --git a/apps/benchmarks/GranularGas/PE_GranularGas.cpp b/apps/benchmarks/GranularGas/PE_GranularGas.cpp
index e235f348f..ea95b79cd 100644
--- a/apps/benchmarks/GranularGas/PE_GranularGas.cpp
+++ b/apps/benchmarks/GranularGas/PE_GranularGas.cpp
@@ -34,7 +34,7 @@
 #include <core/OpenMP.h>
 #include <core/timing/TimingTree.h>
 #include <core/waLBerlaBuildInfo.h>
-#include <postprocessing/sqlite/SQLite.h>
+#include <sqlite/SQLite.h>
 #include <vtk/VTKOutput.h>
 
 #include <functional>
@@ -325,8 +325,8 @@ int main( int argc, char ** argv )
          mesa_pd::addDomainPropertiesToSQL(*forest, integerProperties, realProperties, stringProperties);
          mesa_pd::addSlurmPropertiesToSQL(integerProperties, realProperties, stringProperties);
 
-         runId = postprocessing::storeRunInSqliteDB( params.sqlFile, integerProperties, stringProperties, realProperties );
-         postprocessing::storeTimingPoolInSqliteDB( params.sqlFile, runId, *tp_reduced, "Timeloop" );
+         runId = sqlite::storeRunInSqliteDB( params.sqlFile, integerProperties, stringProperties, realProperties );
+         sqlite::storeTimingPoolInSqliteDB( params.sqlFile, runId, *tp_reduced, "Timeloop" );
       }
       if (params.storeNodeTimings)
       {
diff --git a/apps/benchmarks/NonUniformGrid/CMakeLists.txt b/apps/benchmarks/NonUniformGrid/CMakeLists.txt
index 61e9e321e..4e118017b 100644
--- a/apps/benchmarks/NonUniformGrid/CMakeLists.txt
+++ b/apps/benchmarks/NonUniformGrid/CMakeLists.txt
@@ -3,4 +3,4 @@ waLBerla_link_files_to_builddir( "*.dat" )
 
 
 waLBerla_add_executable ( NAME NonUniformGridBenchmark 
-                          DEPENDS blockforest boundary core domain_decomposition field lbm postprocessing timeloop vtk )
\ No newline at end of file
+                          DEPENDS blockforest boundary core domain_decomposition field lbm postprocessing timeloop vtk sqlite)
\ No newline at end of file
diff --git a/apps/benchmarks/NonUniformGrid/NonUniformGrid.cpp b/apps/benchmarks/NonUniformGrid/NonUniformGrid.cpp
index f4528cbf6..618f29af9 100644
--- a/apps/benchmarks/NonUniformGrid/NonUniformGrid.cpp
+++ b/apps/benchmarks/NonUniformGrid/NonUniformGrid.cpp
@@ -64,7 +64,7 @@
 #include "lbm/vtk/Density.h"
 #include "lbm/vtk/Velocity.h"
 
-#include "postprocessing/sqlite/SQLite.h"
+#include "sqlite/SQLite.h"
 
 #include "stencil/D3Q19.h"
 #include "stencil/D3Q27.h"
@@ -1034,12 +1034,12 @@ void run( const shared_ptr< Config > & config, const LatticeModel_T & latticeMod
                }
             }
 
-            auto runId = postprocessing::storeRunInSqliteDB( sqlFile, integerProperties, stringProperties, realProperties );
-            postprocessing::storeTimingPoolInSqliteDB( sqlFile, runId, *reducedTimeloopTiming, "Timeloop" );
-            postprocessing::storeTimingPoolInSqliteDB( sqlFile, runId, *reducedRTSTiming, "RefinementTimeStep" );
-            postprocessing::storeTimingPoolInSqliteDB( sqlFile, runId, *reducedRTSLTiming, "RefinementTimeStepLevelwise" );
+            auto runId = sqlite::storeRunInSqliteDB( sqlFile, integerProperties, stringProperties, realProperties );
+            sqlite::storeTimingPoolInSqliteDB( sqlFile, runId, *reducedTimeloopTiming, "Timeloop" );
+            sqlite::storeTimingPoolInSqliteDB( sqlFile, runId, *reducedRTSTiming, "RefinementTimeStep" );
+            sqlite::storeTimingPoolInSqliteDB( sqlFile, runId, *reducedRTSLTiming, "RefinementTimeStepLevelwise" );
             if( blockStructureRefreshDuringMeasurement )
-               postprocessing::storeTimingPoolInSqliteDB( sqlFile, runId, *reducedRefreshTiming, "BlockForestRefresh" );
+               sqlite::storeTimingPoolInSqliteDB( sqlFile, runId, *reducedRefreshTiming, "BlockForestRefresh" );
          }
       }
    }
diff --git a/apps/benchmarks/PoiseuilleChannel/CMakeLists.txt b/apps/benchmarks/PoiseuilleChannel/CMakeLists.txt
index 29c47a036..b5d3d42a7 100644
--- a/apps/benchmarks/PoiseuilleChannel/CMakeLists.txt
+++ b/apps/benchmarks/PoiseuilleChannel/CMakeLists.txt
@@ -1,7 +1,7 @@
 
 waLBerla_link_files_to_builddir( "*.dat" )                 
                                   
-waLBerla_add_executable( NAME PoiseuilleChannel DEPENDS blockforest boundary core field lbm postprocessing stencil timeloop vtk )
+waLBerla_add_executable( NAME PoiseuilleChannel DEPENDS blockforest boundary core field lbm postprocessing stencil timeloop vtk sqlite)
 
 ##############
 # Some tests #
diff --git a/apps/benchmarks/PoiseuilleChannel/PoiseuilleChannel.cpp b/apps/benchmarks/PoiseuilleChannel/PoiseuilleChannel.cpp
index 1a0482f57..ae5352c0a 100644
--- a/apps/benchmarks/PoiseuilleChannel/PoiseuilleChannel.cpp
+++ b/apps/benchmarks/PoiseuilleChannel/PoiseuilleChannel.cpp
@@ -78,7 +78,7 @@
 #include "lbm/vtk/NonEquilibrium.h"
 #include "lbm/vtk/Velocity.h"
 
-#include "postprocessing/sqlite/SQLite.h"
+#include "sqlite/SQLite.h"
 
 #include "stencil/D3Q19.h"
 #include "stencil/D3Q27.h"
@@ -995,10 +995,10 @@ void run( const shared_ptr< Config > & config, const LatticeModel_T & latticeMod
             
             realProperties[ "simulationProgress" ] = double_c( ( outerRun + uint_t(1) ) * innerTimeSteps ) / double_c( outerTimeSteps * innerTimeSteps );
 
-            auto runId = postprocessing::storeRunInSqliteDB( sqlFile, integerProperties, stringProperties, realProperties );
-            postprocessing::storeTimingPoolInSqliteDB( sqlFile, runId, *reducedTimeloopTiming, "Timeloop" );
-            postprocessing::storeTimingPoolInSqliteDB( sqlFile, runId, *reducedRTSTiming, "RefinementTimeStep" );
-            postprocessing::storeTimingPoolInSqliteDB( sqlFile, runId, *reducedRTSLTiming, "RefinementTimeStepLevelwise" );
+            auto runId = sqlite::storeRunInSqliteDB( sqlFile, integerProperties, stringProperties, realProperties );
+            sqlite::storeTimingPoolInSqliteDB( sqlFile, runId, *reducedTimeloopTiming, "Timeloop" );
+            sqlite::storeTimingPoolInSqliteDB( sqlFile, runId, *reducedRTSTiming, "RefinementTimeStep" );
+            sqlite::storeTimingPoolInSqliteDB( sqlFile, runId, *reducedRTSLTiming, "RefinementTimeStepLevelwise" );
          }
       }
    }
diff --git a/apps/benchmarks/ProbeVsExtraMessage/CMakeLists.txt b/apps/benchmarks/ProbeVsExtraMessage/CMakeLists.txt
index a5cd53649..70ff75bc6 100644
--- a/apps/benchmarks/ProbeVsExtraMessage/CMakeLists.txt
+++ b/apps/benchmarks/ProbeVsExtraMessage/CMakeLists.txt
@@ -4,4 +4,4 @@ waLBerla_add_executable ( NAME PackPerformance
 
 waLBerla_add_executable ( NAME ProbeVsExtraMessage 
                           FILES ProbeVsExtraMessage.cpp
-                          DEPENDS core postprocessing stencil )
+                          DEPENDS core postprocessing stencil sqlite)
diff --git a/apps/benchmarks/ProbeVsExtraMessage/ProbeVsExtraMessage.cpp b/apps/benchmarks/ProbeVsExtraMessage/ProbeVsExtraMessage.cpp
index 960bf1e9e..bb9adfd17 100644
--- a/apps/benchmarks/ProbeVsExtraMessage/ProbeVsExtraMessage.cpp
+++ b/apps/benchmarks/ProbeVsExtraMessage/ProbeVsExtraMessage.cpp
@@ -26,7 +26,7 @@
 #include "core/mpi/BufferSystem.h"
 #include "core/mpi/MPIManager.h"
 #include "core/timing/TimingPool.h"
-#include "postprocessing/sqlite/SQLite.h"
+#include "sqlite/SQLite.h"
 #include "stencil/D3Q27.h"
 #include "stencil/D3Q19.h"
 #include "stencil/D3Q7.h"
@@ -250,9 +250,9 @@ int main( int argc, char ** argv )
       stringProperties["SLURM_NTASKS_PER_SOCKET"]  = envToString(std::getenv( "SLURM_NTASKS_PER_SOCKET" ));
       stringProperties["SLURM_TASKS_PER_NODE"]     = envToString(std::getenv( "SLURM_TASKS_PER_NODE" ));
 
-      auto runId = postprocessing::storeRunInSqliteDB( "ProbeVsTwoMessages.sqlite", integerProperties, stringProperties, realProperties );
-      postprocessing::storeTimingPoolInSqliteDB( "ProbeVsTwoMessages.sqlite", runId, tp_twoMessages, "twoMessages" );
-      postprocessing::storeTimingPoolInSqliteDB( "ProbeVsTwoMessages.sqlite", runId, tp_probe, "probe" );
+      auto runId = sqlite::storeRunInSqliteDB( "ProbeVsTwoMessages.sqlite", integerProperties, stringProperties, realProperties );
+      sqlite::storeTimingPoolInSqliteDB( "ProbeVsTwoMessages.sqlite", runId, tp_twoMessages, "twoMessages" );
+      sqlite::storeTimingPoolInSqliteDB( "ProbeVsTwoMessages.sqlite", runId, tp_probe, "probe" );
    }
 
    return 0;
diff --git a/apps/benchmarks/SchaeferTurek/CMakeLists.txt b/apps/benchmarks/SchaeferTurek/CMakeLists.txt
index 67fe8d84c..88463aaf3 100644
--- a/apps/benchmarks/SchaeferTurek/CMakeLists.txt
+++ b/apps/benchmarks/SchaeferTurek/CMakeLists.txt
@@ -1,6 +1,6 @@
 
 waLBerla_link_files_to_builddir( "*.dat" )   
                                   
-waLBerla_add_executable( NAME SchaeferTurek DEPENDS blockforest boundary core field lbm postprocessing stencil timeloop vtk )
+waLBerla_add_executable( NAME SchaeferTurek DEPENDS blockforest boundary core field lbm postprocessing stencil timeloop vtk sqlite )
 
 waLBerla_execute_test( NO_MODULE_LABEL NAME SchaeferTurekTest COMMAND $<TARGET_FILE:SchaeferTurek> Test2D.dat PROCESSES 4 CONFIGURATIONS Release RelWithDbgInfo )
\ No newline at end of file
diff --git a/apps/benchmarks/SchaeferTurek/SchaeferTurek.cpp b/apps/benchmarks/SchaeferTurek/SchaeferTurek.cpp
index fcd8ba669..876a60942 100644
--- a/apps/benchmarks/SchaeferTurek/SchaeferTurek.cpp
+++ b/apps/benchmarks/SchaeferTurek/SchaeferTurek.cpp
@@ -93,7 +93,7 @@
 #include "lbm/vtk/NonEquilibrium.h"
 #include "lbm/vtk/Velocity.h"
 
-#include "postprocessing/sqlite/SQLite.h"
+#include "sqlite/SQLite.h"
 
 #include "stencil/D3Q15.h"
 #include "stencil/D3Q19.h"
@@ -2787,12 +2787,12 @@ void run( const shared_ptr< Config > & config, const LatticeModel_T & latticeMod
             if( evaluationCheckFrequency != uint_t(0) )
                evaluation->getResultsForSQLOnRoot( realProperties, integerProperties );
 
-            auto runId = postprocessing::storeRunInSqliteDB( sqlFile, integerProperties, stringProperties, realProperties );
-            postprocessing::storeTimingPoolInSqliteDB( sqlFile, runId, *reducedTimeloopTiming, "Timeloop" );
-            postprocessing::storeTimingPoolInSqliteDB( sqlFile, runId, *reducedRTSTiming, "RefinementTimeStep" );
-            postprocessing::storeTimingPoolInSqliteDB( sqlFile, runId, *reducedRTSLTiming, "RefinementTimeStepLevelwise" );
+            auto runId = sqlite::storeRunInSqliteDB( sqlFile, integerProperties, stringProperties, realProperties );
+            sqlite::storeTimingPoolInSqliteDB( sqlFile, runId, *reducedTimeloopTiming, "Timeloop" );
+            sqlite::storeTimingPoolInSqliteDB( sqlFile, runId, *reducedRTSTiming, "RefinementTimeStep" );
+            sqlite::storeTimingPoolInSqliteDB( sqlFile, runId, *reducedRTSLTiming, "RefinementTimeStepLevelwise" );
             if( dynamicBlockStructure )
-               postprocessing::storeTimingPoolInSqliteDB( sqlFile, runId, *reducedRefreshTiming, "BlockForestRefresh" );
+               sqlite::storeTimingPoolInSqliteDB( sqlFile, runId, *reducedRefreshTiming, "BlockForestRefresh" );
          }
       }
    }
diff --git a/apps/benchmarks/UniformGrid/CMakeLists.txt b/apps/benchmarks/UniformGrid/CMakeLists.txt
index 512aa80fc..2f75f12b5 100644
--- a/apps/benchmarks/UniformGrid/CMakeLists.txt
+++ b/apps/benchmarks/UniformGrid/CMakeLists.txt
@@ -3,4 +3,4 @@ waLBerla_link_files_to_builddir( "*.dat" )
 
 
 waLBerla_add_executable ( NAME UniformGridBenchmark 
-                          DEPENDS blockforest boundary core domain_decomposition field lbm postprocessing timeloop vtk )
\ No newline at end of file
+                          DEPENDS blockforest boundary core domain_decomposition field lbm postprocessing timeloop vtk sqlite )
\ No newline at end of file
diff --git a/apps/benchmarks/UniformGrid/UniformGrid.cpp b/apps/benchmarks/UniformGrid/UniformGrid.cpp
index 96e50eb12..bd9efc7d4 100644
--- a/apps/benchmarks/UniformGrid/UniformGrid.cpp
+++ b/apps/benchmarks/UniformGrid/UniformGrid.cpp
@@ -70,7 +70,7 @@
 #include "lbm/vtk/Density.h"
 #include "lbm/vtk/Velocity.h"
 
-#include "postprocessing/sqlite/SQLite.h"
+#include "sqlite/SQLite.h"
 
 #include "stencil/D3Q19.h"
 #include "stencil/D3Q27.h"
@@ -783,8 +783,8 @@ void run( const shared_ptr< Config > & config, const LatticeModel_T & latticeMod
             stringProperties[ "fullCommunication" ] = ( fullComm ? "yes" : "no" );
             stringProperties[ "directComm"]         = ( directComm ? "yes" : "no" );
 
-            auto runId = postprocessing::storeRunInSqliteDB( sqlFile, integerProperties, stringProperties, realProperties );
-            postprocessing::storeTimingPoolInSqliteDB( sqlFile, runId, *reducedTimeloopTiming, "Timeloop" );
+            auto runId = sqlite::storeRunInSqliteDB( sqlFile, integerProperties, stringProperties, realProperties );
+            sqlite::storeTimingPoolInSqliteDB( sqlFile, runId, *reducedTimeloopTiming, "Timeloop" );
          }
       }
    }
diff --git a/apps/tutorials/pe/02_ConfinedGasExtended.cpp b/apps/tutorials/pe/02_ConfinedGasExtended.cpp
index b39cf5f3e..69629eba1 100644
--- a/apps/tutorials/pe/02_ConfinedGasExtended.cpp
+++ b/apps/tutorials/pe/02_ConfinedGasExtended.cpp
@@ -32,7 +32,7 @@
 #include <core/math/Random.h>
 #include <core/timing/TimingTree.h>
 #include <core/waLBerlaBuildInfo.h>
-#include <postprocessing/sqlite/SQLite.h>
+#include <sqlite/SQLite.h>
 #include <vtk/VTKOutput.h>
 
 #include <functional>
@@ -289,9 +289,9 @@ int main( int argc, char ** argv )
    //! [SQL Save]
    WALBERLA_ROOT_SECTION()
    {
-      auto runId = postprocessing::storeRunInSqliteDB( sqlFile, integerProperties, stringProperties, realProperties );
-      postprocessing::storeTimingPoolInSqliteDB( sqlFile, runId, *tpReduced, "Timeloop" );
-      postprocessing::storeTimingTreeInSqliteDB( sqlFile, runId, tt, "TimingTree" );
+      auto runId = sqlite::storeRunInSqliteDB( sqlFile, integerProperties, stringProperties, realProperties );
+      sqlite::storeTimingPoolInSqliteDB( sqlFile, runId, *tpReduced, "Timeloop" );
+      sqlite::storeTimingTreeInSqliteDB( sqlFile, runId, tt, "TimingTree" );
    }
    //! [SQL Save]
 
diff --git a/apps/tutorials/pe/CMakeLists.txt b/apps/tutorials/pe/CMakeLists.txt
index a41407ecc..4fda84113 100644
--- a/apps/tutorials/pe/CMakeLists.txt
+++ b/apps/tutorials/pe/CMakeLists.txt
@@ -6,7 +6,7 @@ waLBerla_add_executable ( NAME 01_Tutorial_ConfinedGas
 
 waLBerla_add_executable ( NAME 02_Tutorial_ConfinedGasExtended
                           FILES 02_ConfinedGasExtended.cpp
-                          DEPENDS blockforest core pe postprocessing vtk )
+                          DEPENDS blockforest core pe postprocessing vtk sqlite )
 
 waLBerla_execute_test( NO_MODULE_LABEL NAME 01_Tutorial_ConfinedGas PROCESSES 8 )
 waLBerla_execute_test( NO_MODULE_LABEL NAME 02_Tutorial_ConfinedGasExtended
diff --git a/src/postprocessing/all.h b/src/postprocessing/all.h
index 90a82d17a..1783d5a29 100644
--- a/src/postprocessing/all.h
+++ b/src/postprocessing/all.h
@@ -22,6 +22,4 @@
 
 #pragma once
 
-#include "MarchingCubes.h"
-
-#include "sqlite/SQLite.h"
\ No newline at end of file
+#include "MarchingCubes.h"
\ No newline at end of file
diff --git a/src/sqlite/CMakeLists.txt b/src/sqlite/CMakeLists.txt
new file mode 100644
index 000000000..621760105
--- /dev/null
+++ b/src/sqlite/CMakeLists.txt
@@ -0,0 +1,9 @@
+###################################################################################################
+#
+# Module sqlite
+#
+###################################################################################################
+
+waLBerla_add_module( DEPENDS core )
+
+###################################################################################################
diff --git a/src/postprocessing/sqlite/SQLite.cpp b/src/sqlite/SQLite.cpp
similarity index 99%
rename from src/postprocessing/sqlite/SQLite.cpp
rename to src/sqlite/SQLite.cpp
index e6efa739f..e4729238e 100644
--- a/src/postprocessing/sqlite/SQLite.cpp
+++ b/src/sqlite/SQLite.cpp
@@ -30,7 +30,7 @@
 
 
 namespace walberla {
-namespace postprocessing {
+namespace sqlite {
 
 
 SQLiteDB::SQLiteDB( const string & dbFile, const int busyTimeout )
@@ -513,5 +513,5 @@ void storeTimingTreeInSqliteDB ( const string & dbFile, uint_t runId,
    db.storeTimingTree( runId, tt, timingTreeName );
 }
 
-} // namespace postprocessing
+} // namespace sqlite
 } // namespace walberla
diff --git a/src/postprocessing/sqlite/SQLite.h b/src/sqlite/SQLite.h
similarity index 99%
rename from src/postprocessing/sqlite/SQLite.h
rename to src/sqlite/SQLite.h
index 22e66daf8..84ba27466 100644
--- a/src/postprocessing/sqlite/SQLite.h
+++ b/src/sqlite/SQLite.h
@@ -35,7 +35,7 @@
 struct sqlite3;
 
 namespace walberla {
-namespace postprocessing {
+namespace sqlite {
 
 using std::string;
 using std::map;
@@ -126,7 +126,7 @@ void storeTimingTreeInSqliteDB( const string & dbFile, uint_t runId, const WcTim
 
 
 
-} // namespace postprocessing
+} // namespace sqlite
 } // namespace walberla
 
 
diff --git a/src/postprocessing/sqlite/extern/sqlite3.c b/src/sqlite/extern/sqlite3.c
similarity index 100%
rename from src/postprocessing/sqlite/extern/sqlite3.c
rename to src/sqlite/extern/sqlite3.c
diff --git a/src/postprocessing/sqlite/extern/sqlite3.h b/src/sqlite/extern/sqlite3.h
similarity index 100%
rename from src/postprocessing/sqlite/extern/sqlite3.h
rename to src/sqlite/extern/sqlite3.h
diff --git a/tests/mesh/PeVTKMeshWriterTest.cpp b/tests/mesh/PeVTKMeshWriterTest.cpp
index 589f46642..7e7b26e13 100644
--- a/tests/mesh/PeVTKMeshWriterTest.cpp
+++ b/tests/mesh/PeVTKMeshWriterTest.cpp
@@ -41,7 +41,6 @@
 #include <core/waLBerlaBuildInfo.h>
 #include <core/math/Random.h>
 #include <core/math/Utility.h>
-#include <postprocessing/sqlite/SQLite.h>
 #include <vtk/VTKOutput.h>
 
 #include <functional>
diff --git a/tests/postprocessing/CMakeLists.txt b/tests/postprocessing/CMakeLists.txt
index 549bea2f0..ffe99cd52 100644
--- a/tests/postprocessing/CMakeLists.txt
+++ b/tests/postprocessing/CMakeLists.txt
@@ -6,7 +6,4 @@
 
 
 waLBerla_compile_test( FILES SphereTriangulate.cpp )
-waLBerla_execute_test( NAME SphereTriangulate )
-
-waLBerla_compile_test( FILES SQLiteTest.cpp )
-waLBerla_execute_test( NAME SQLiteTest )
+waLBerla_execute_test( NAME SphereTriangulate )
\ No newline at end of file
diff --git a/tests/sqlite/CMakeLists.txt b/tests/sqlite/CMakeLists.txt
new file mode 100644
index 000000000..21513d96b
--- /dev/null
+++ b/tests/sqlite/CMakeLists.txt
@@ -0,0 +1,8 @@
+###################################################################################################
+#
+# Tests for sqlite module
+#
+###################################################################################################
+
+waLBerla_compile_test( FILES SQLiteTest.cpp )
+waLBerla_execute_test( NAME SQLiteTest )
\ No newline at end of file
diff --git a/tests/postprocessing/SQLiteTest.cpp b/tests/sqlite/SQLiteTest.cpp
similarity index 88%
rename from tests/postprocessing/SQLiteTest.cpp
rename to tests/sqlite/SQLiteTest.cpp
index 547bd12e9..b65ad0603 100644
--- a/tests/postprocessing/SQLiteTest.cpp
+++ b/tests/sqlite/SQLiteTest.cpp
@@ -22,7 +22,7 @@
 #include "core/debug/TestSubsystem.h"
 #include "core/mpi/Environment.h"
 
-#include "postprocessing/sqlite/SQLite.h"
+#include "sqlite/SQLite.h"
 
 
 int main( int argc, char ** argv )
@@ -40,7 +40,7 @@ int main( int argc, char ** argv )
       strColumns["property2"] = "value2";
       strColumns["property3"] = "value3";
       intColumns["i"] = int(i);
-      walberla::postprocessing::storeRunInSqliteDB( "dbFile.sqlite", intColumns, strColumns );
+      walberla::sqlite::storeRunInSqliteDB( "dbFile.sqlite", intColumns, strColumns );
    }
 
    for( int i=0; i< 100; ++i )
@@ -49,7 +49,7 @@ int main( int argc, char ** argv )
       strColumns["property2"] = "value2";
       strColumns["property3"] = "value3";
       largeColumns["i"] = 4294967297 + i;
-      walberla::postprocessing::storeRunInSqliteDB( "dbFile.sqlite", largeColumns, strColumns );
+      walberla::sqlite::storeRunInSqliteDB( "dbFile.sqlite", largeColumns, strColumns );
    }
 
    return 0;
-- 
GitLab