From 8b56be46f646e79d5906ae406a65bfb651e8fa2c Mon Sep 17 00:00:00 2001
From: Hkorb <henry.korb@geo.uu.se>
Date: Mon, 20 Sep 2021 22:42:51 +0200
Subject: [PATCH] split probe into point and plane probe

---
 apps/gpu/LBM/ActuatorLine/ActuatorLine.cpp    | 23 +++--
 .../GPU/CudaMemoryManager.cpp                 |  2 +-
 .../Visitor/Probes/PlaneProbe.cu              | 47 +++++++++++
 .../Visitor/Probes/PlaneProbe.h               | 38 +++++++++
 .../Visitor/Probes/PointProbe.cu              | 81 ++++++++++++++++++
 .../Visitor/Probes/PointProbe.h               | 33 ++++++++
 .../Visitor/{ => Probes}/Probe.cu             | 84 ++++---------------
 .../Visitor/{ => Probes}/Probe.h              | 30 +++++--
 8 files changed, 251 insertions(+), 87 deletions(-)
 create mode 100644 src/gpu/VirtualFluids_GPU/Visitor/Probes/PlaneProbe.cu
 create mode 100644 src/gpu/VirtualFluids_GPU/Visitor/Probes/PlaneProbe.h
 create mode 100644 src/gpu/VirtualFluids_GPU/Visitor/Probes/PointProbe.cu
 create mode 100644 src/gpu/VirtualFluids_GPU/Visitor/Probes/PointProbe.h
 rename src/gpu/VirtualFluids_GPU/Visitor/{ => Probes}/Probe.cu (79%)
 rename src/gpu/VirtualFluids_GPU/Visitor/{ => Probes}/Probe.h (61%)

diff --git a/apps/gpu/LBM/ActuatorLine/ActuatorLine.cpp b/apps/gpu/LBM/ActuatorLine/ActuatorLine.cpp
index 7dff8a88d..1f74934cf 100644
--- a/apps/gpu/LBM/ActuatorLine/ActuatorLine.cpp
+++ b/apps/gpu/LBM/ActuatorLine/ActuatorLine.cpp
@@ -49,7 +49,8 @@
 #include "VirtualFluids_GPU/Parameter/Parameter.h"
 #include "VirtualFluids_GPU/Output/FileWriter.h"
 #include "VirtualFluids_GPU/Visitor/ActuatorLine.h"
-#include "VirtualFluids_GPU/Visitor/Probe.h"
+#include "VirtualFluids_GPU/Visitor/Probes/PointProbe.h"
+#include "VirtualFluids_GPU/Visitor/Probes/PlaneProbe.h"
 
 #include "VirtualFluids_GPU/Kernel/Utilities/KernelFactory/KernelFactoryImp.h"
 #include "VirtualFluids_GPU/PreProcessor/PreProcessorFactory/PreProcessorFactoryImp.h"
@@ -199,15 +200,23 @@ void multipleLevel(const std::string& configPath)
         ActuatorLine* actuator_line = new ActuatorLine((unsigned int) 3, density, (unsigned int)32, epsilon, turbPos[0], turbPos[1], turbPos[2], D, level, dt, dx);
         para->addActuator( actuator_line );
 
-        Probe* probe = new Probe("probe", 100, 500, 100);
+        PointProbe* pointProbe = new PointProbe("pointProbe", 100, 500, 100);
         std::vector<real> probeCoordsX = {D,2*D,5*D};
         std::vector<real> probeCoordsY = {3*D,3*D,3*D};
         std::vector<real> probeCoordsZ = {3*D,3*D,3*D};
-        probe->setProbePointsFromList(probeCoordsX,probeCoordsY,probeCoordsZ);
-        // probe->setProbePointsFromXNormalPlane(2*D, 0.0, 0.0, L_y, L_z, dx, dx);
-        probe->addPostProcessingVariable(PostProcessingVariable::Means);
-        probe->addPostProcessingVariable(PostProcessingVariable::Variances);
-        para->addProbe( probe );
+        pointProbe->setProbePointsFromList(probeCoordsX,probeCoordsY,probeCoordsZ);
+        // pointProbe->setProbePointsFromXNormalPlane(2*D, 0.0, 0.0, L_y, L_z, dx, dx);
+        pointProbe->addPostProcessingVariable(PostProcessingVariable::Means);
+        pointProbe->addPostProcessingVariable(PostProcessingVariable::Variances);
+        para->addProbe( pointProbe );
+
+        PlaneProbe* planeProbe = new PlaneProbe("planeProbe", 100, 500, 100);
+        planeProbe->setProbePlane(5*D, 0, 0, dx, L_y, L_z);
+        planeProbe->addPostProcessingVariable(PostProcessingVariable::Means);
+        para->addProbe( planeProbe );
+
+
+
 
         Simulation sim;
         SPtr<FileWriter> fileWriter = SPtr<FileWriter>(new FileWriter());
diff --git a/src/gpu/VirtualFluids_GPU/GPU/CudaMemoryManager.cpp b/src/gpu/VirtualFluids_GPU/GPU/CudaMemoryManager.cpp
index e4a39b47c..21baa2f40 100644
--- a/src/gpu/VirtualFluids_GPU/GPU/CudaMemoryManager.cpp
+++ b/src/gpu/VirtualFluids_GPU/GPU/CudaMemoryManager.cpp
@@ -6,7 +6,7 @@
 
 #include <Parameter/Parameter.h>
 #include <Visitor/ActuatorLine.h>
-#include <Visitor/Probe.h>
+#include <Visitor/Probes/Probe.h>
 
 #include "Calculation/PorousMedia.h"
 
diff --git a/src/gpu/VirtualFluids_GPU/Visitor/Probes/PlaneProbe.cu b/src/gpu/VirtualFluids_GPU/Visitor/Probes/PlaneProbe.cu
new file mode 100644
index 000000000..e7967691d
--- /dev/null
+++ b/src/gpu/VirtualFluids_GPU/Visitor/Probes/PlaneProbe.cu
@@ -0,0 +1,47 @@
+#include "PlaneProbe.h"
+
+#include "Kernel/Utilities/CudaGrid.h"
+
+#include "Parameter/Parameter.h"
+#include "DataStructureInitializer/GridProvider.h"
+#include "GPU/CudaMemoryManager.h"
+
+void PlaneProbe::findPoints(Parameter* para, GridProvider* gridProvider, std::vector<int>& probeIndices_level,
+                       std::vector<real>& distX_level, std::vector<real>& distY_level, std::vector<real>& distZ_level,      
+                       std::vector<real>& pointCoordsX_level, std::vector<real>& pointCoordsY_level, std::vector<real>& pointCoordsZ_level,
+                       int level)
+{
+    real dx = abs(para->getParH(level)->coordX_SP[1]-para->getParH(level)->coordX_SP[para->getParH(level)->neighborX_SP[1]]);
+    for(uint j=1; j<para->getParH(level)->size_Mat_SP; j++ )
+    {
+        real pointCoordX = para->getParH(level)->coordX_SP[j];
+        real pointCoordY = para->getParH(level)->coordY_SP[j];
+        real pointCoordZ = para->getParH(level)->coordZ_SP[j];
+        real distX = pointCoordX - this->posX;
+        real distY = pointCoordY - this->posY;
+        real distZ = pointCoordZ - this->posZ;
+
+        if( distX <= this->deltaX && distY <= this->deltaY && distZ <= this->deltaZ &&
+            distX >0.f && distY >0.f && distZ >0.f)
+        {
+            probeIndices_level.push_back(j);
+            distX_level.push_back( distX/dx );
+            distY_level.push_back( distY/dx );
+            distZ_level.push_back( distZ/dx );
+            pointCoordsX_level.push_back( pointCoordX );
+            pointCoordsY_level.push_back( pointCoordY );
+            pointCoordsZ_level.push_back( pointCoordZ );
+            // printf("x %f y %f z %f", pointCoordX, pointCoordY, pointCoordZ);
+        }
+    }
+}
+void PlaneProbe::calculateQuantities(ProbeStruct* probeStruct, Parameter* para, int level)
+{
+    vf::gpu::CudaGrid grid = vf::gpu::CudaGrid(128, probeStruct->nPoints);
+    interpQuantities<<<grid.grid, grid.threads>>>(  probeStruct->pointIndicesD, probeStruct->nPoints, probeStruct->vals,
+                                                    probeStruct->distXD, probeStruct->distYD, probeStruct->distZD,
+                                                    para->getParD(level)->vx_SP, para->getParD(level)->vy_SP, para->getParD(level)->vz_SP, para->getParD(level)->rho_SP, 
+                                                    para->getParD(level)->neighborX_SP, para->getParD(level)->neighborY_SP, para->getParD(level)->neighborZ_SP, 
+                                                    probeStruct->quantitiesD, probeStruct->arrayOffsetsD, probeStruct->quantitiesArrayD, false);
+
+}
\ No newline at end of file
diff --git a/src/gpu/VirtualFluids_GPU/Visitor/Probes/PlaneProbe.h b/src/gpu/VirtualFluids_GPU/Visitor/Probes/PlaneProbe.h
new file mode 100644
index 000000000..cf042e662
--- /dev/null
+++ b/src/gpu/VirtualFluids_GPU/Visitor/Probes/PlaneProbe.h
@@ -0,0 +1,38 @@
+#ifndef PlaneProbe_H
+#define PlaneProbe_H
+
+#include "Probe.h"
+
+class PlaneProbe : public Probe
+{
+public: 
+    PlaneProbe(
+        const std::string _probeName,
+        uint _tStartAvg,
+        uint _tStartOut,
+        uint _tOut
+    ): Probe(_probeName, _tStartAvg, _tStartOut, _tOut){}
+
+    void setProbePlane(real _posX, real _posY, real _posZ, real _deltaX, real _deltaY, real _deltaZ)
+    {
+        this->posX = _posX; 
+        this->posY = _posY; 
+        this->posZ = _posZ;         
+        this->deltaX = _deltaX; 
+        this->deltaY = _deltaY; 
+        this->deltaZ = _deltaZ; 
+    }
+
+private:
+    void findPoints(Parameter* para, GridProvider* gridProvider, std::vector<int>& probeIndices_level,
+                       std::vector<real>& distX_level, std::vector<real>& distY_level, std::vector<real>& distZ_level,      
+                       std::vector<real>& pointCoordsX_level, std::vector<real>& pointCoordsY_level, std::vector<real>& pointCoordsZ_level,
+                       int level) override;
+    void calculateQuantities(ProbeStruct* probeStruct, Parameter* para, int level) override;
+
+private:
+    real posX, posY, posZ;
+    real deltaX, deltaY, deltaZ;
+};
+
+#endif
\ No newline at end of file
diff --git a/src/gpu/VirtualFluids_GPU/Visitor/Probes/PointProbe.cu b/src/gpu/VirtualFluids_GPU/Visitor/Probes/PointProbe.cu
new file mode 100644
index 000000000..93503cc41
--- /dev/null
+++ b/src/gpu/VirtualFluids_GPU/Visitor/Probes/PointProbe.cu
@@ -0,0 +1,81 @@
+#include "PointProbe.h"
+
+#include "Kernel/Utilities/CudaGrid.h"
+
+#include "Parameter/Parameter.h"
+#include "DataStructureInitializer/GridProvider.h"
+#include "GPU/CudaMemoryManager.h"
+
+void PointProbe::findPoints(Parameter* para, GridProvider* gridProvider, std::vector<int>& probeIndices_level,
+                       std::vector<real>& distX_level, std::vector<real>& distY_level, std::vector<real>& distZ_level,      
+                       std::vector<real>& pointCoordsX_level, std::vector<real>& pointCoordsY_level, std::vector<real>& pointCoordsZ_level,
+                       int level)
+{
+
+    real dx = abs(para->getParH(level)->coordX_SP[1]-para->getParH(level)->coordX_SP[para->getParH(level)->neighborX_SP[1]]);
+    for(uint j=1; j<para->getParH(level)->size_Mat_SP; j++ )
+    {    
+        for(uint point=0; point<this->nProbePoints; point++)
+        {
+            real pointCoordX = this->pointCoordsX[point];
+            real pointCoordY = this->pointCoordsY[point];
+            real pointCoordZ = this->pointCoordsZ[point];
+            real distX = pointCoordX-para->getParH(level)->coordX_SP[j];
+            real distY = pointCoordY-para->getParH(level)->coordY_SP[j];
+            real distZ = pointCoordZ-para->getParH(level)->coordZ_SP[j];
+            if( distX <=dx && distY <=dx && distZ <=dx &&
+                distX >0.f && distY >0.f && distZ >0.f)
+            {
+                probeIndices_level.push_back(j);
+                distX_level.push_back( distX/dx );
+                distY_level.push_back( distY/dx );
+                distZ_level.push_back( distZ/dx );
+                pointCoordsX_level.push_back( pointCoordX );
+                pointCoordsY_level.push_back( pointCoordY );
+                pointCoordsZ_level.push_back( pointCoordZ );
+                // printf("x %f y %f z %f", pointCoordX, pointCoordY, pointCoordZ);
+            }
+        }
+    }
+}
+
+void PointProbe::calculateQuantities(ProbeStruct* probeStruct, Parameter* para, int level)
+{
+    vf::gpu::CudaGrid grid = vf::gpu::CudaGrid(128, probeStruct->nPoints);
+
+    interpQuantities<<<grid.grid, grid.threads>>>(  probeStruct->pointIndicesD, probeStruct->nPoints, probeStruct->vals,
+                                                    probeStruct->distXD, probeStruct->distYD, probeStruct->distZD,
+                                                    para->getParD(level)->vx_SP, para->getParD(level)->vy_SP, para->getParD(level)->vz_SP, para->getParD(level)->rho_SP, 
+                                                    para->getParD(level)->neighborX_SP, para->getParD(level)->neighborY_SP, para->getParD(level)->neighborZ_SP, 
+                                                    probeStruct->quantitiesD, probeStruct->arrayOffsetsD, probeStruct->quantitiesArrayD, true);
+}
+
+void PointProbe::setProbePointsFromList(std::vector<real>& _pointCoordsX, std::vector<real>& _pointCoordsY, std::vector<real>& _pointCoordsZ)
+{
+    bool isSameLength = ( (_pointCoordsX.size()==_pointCoordsY.size()) && (_pointCoordsY.size()==_pointCoordsZ.size()));
+    assert("Probe: point lists have different lengths" && isSameLength);
+    this->pointCoordsX = _pointCoordsX;
+    this->pointCoordsY = _pointCoordsY;
+    this->pointCoordsZ = _pointCoordsZ;
+    this->nProbePoints = uint(_pointCoordsX.size());
+    printf("Added list of %u  points \n", this->nProbePoints );
+}
+
+void PointProbe::setProbePointsFromXNormalPlane(real pos_x, real pos0_y, real pos0_z, real pos1_y, real pos1_z, real delta_y, real delta_z)
+{
+    int n_points_y = int((pos1_y-pos0_y)/delta_y);
+    int n_points_z = int((pos1_z-pos0_z)/delta_z);
+
+    std::vector<real> pointCoordsXtmp, pointCoordsYtmp, pointCoordsZtmp;
+
+    for(int n_y=0; n_y<n_points_y; n_y++)
+    {
+        for(int n_z=0; n_z<n_points_z; n_z++)
+        {
+            pointCoordsXtmp.push_back(pos_x);
+            pointCoordsYtmp.push_back(pos0_y+delta_y*n_y);
+            pointCoordsZtmp.push_back(pos0_z+delta_z*n_z);
+        }
+    }
+    this->setProbePointsFromList(pointCoordsXtmp, pointCoordsYtmp, pointCoordsZtmp);
+}
\ No newline at end of file
diff --git a/src/gpu/VirtualFluids_GPU/Visitor/Probes/PointProbe.h b/src/gpu/VirtualFluids_GPU/Visitor/Probes/PointProbe.h
new file mode 100644
index 000000000..f7f6d91e7
--- /dev/null
+++ b/src/gpu/VirtualFluids_GPU/Visitor/Probes/PointProbe.h
@@ -0,0 +1,33 @@
+#ifndef PointProbe_H
+#define PointProbe_H
+
+#include "Probe.h"
+
+class PointProbe: public Probe
+{
+public:
+    PointProbe(
+        const std::string _probeName,
+        uint _tStartAvg,
+        uint _tStartOut,
+        uint _tOut
+    ): Probe(_probeName, _tStartAvg, _tStartOut, _tOut){}
+
+    void setProbePointsFromList(std::vector<real>& _pointCoordsX, std::vector<real>& _pointCoordsY, std::vector<real>& _pointCoordsZ);
+    void setProbePointsFromXNormalPlane(real pos_x, real pos0_y, real pos0_z, real pos1_y, real pos1_z, real delta_y, real delta_z);
+    
+private:
+    void findPoints(Parameter* para, GridProvider* gridProvider, std::vector<int>& probeIndices_level,
+                       std::vector<real>& distX_level, std::vector<real>& distY_level, std::vector<real>& distZ_level,      
+                       std::vector<real>& pointCoordsX_level, std::vector<real>& pointCoordsY_level, std::vector<real>& pointCoordsZ_level,
+                       int level) override;
+
+    void calculateQuantities(ProbeStruct* probeStruct, Parameter* para, int level) override;
+
+private:
+    uint nProbePoints;
+    std::vector<real> pointCoordsX, pointCoordsY, pointCoordsZ; 
+
+};
+
+#endif
\ No newline at end of file
diff --git a/src/gpu/VirtualFluids_GPU/Visitor/Probe.cu b/src/gpu/VirtualFluids_GPU/Visitor/Probes/Probe.cu
similarity index 79%
rename from src/gpu/VirtualFluids_GPU/Visitor/Probe.cu
rename to src/gpu/VirtualFluids_GPU/Visitor/Probes/Probe.cu
index 22bc5c3c5..f9ffc5e82 100644
--- a/src/gpu/VirtualFluids_GPU/Visitor/Probe.cu
+++ b/src/gpu/VirtualFluids_GPU/Visitor/Probes/Probe.cu
@@ -3,10 +3,8 @@
 #include <cuda.h>
 #include <cuda_runtime.h>
 #include <helper_cuda.h>
-#include <unordered_set>
 
 #include "VirtualFluids_GPU/GPU/GeometryUtils.h"
-#include "Kernel/Utilities/CudaGrid.h"
 #include "basics/writer/WbWriterVtkXmlBinary.h"
 #include <Core/StringUtilities/StringUtil.h>
 
@@ -123,7 +121,8 @@ __global__ void interpQuantities(   uint* pointIndices,
         u_interpY  = trilinearInterpolation( dW, dE, dN, dS, dT, dB, k, ke, kn, kt, kne, kte, ktn, ktne, vy );
         u_interpZ  = trilinearInterpolation( dW, dE, dN, dS, dT, dB, k, ke, kn, kt, kne, kte, ktn, ktne, vz );
         rho_interp = trilinearInterpolation( dW, dE, dN, dS, dT, dB, k, ke, kn, kt, kne, kte, ktn, ktne, rho );
-    } else 
+    }
+    else
     {
         u_interpX = vx[k];
         u_interpY = vy[k];
@@ -150,32 +149,10 @@ void Probe::init(Parameter* para, GridProvider* gridProvider, CudaMemoryManager*
         std::vector<real> pointCoordsX_level;
         std::vector<real> pointCoordsY_level;
         std::vector<real> pointCoordsZ_level;
-        real dx = abs(para->getParH(level)->coordX_SP[1]-para->getParH(level)->coordX_SP[para->getParH(level)->neighborX_SP[1]]);
-        for(uint j=1; j<para->getParH(level)->size_Mat_SP; j++ )
-        {    
-            for(uint point=0; point<this->nProbePoints; point++)
-            {
-                real pointCoordX = this->pointCoordsX[point];
-                real pointCoordY = this->pointCoordsY[point];
-                real pointCoordZ = this->pointCoordsZ[point];
-                real distX = pointCoordX-para->getParH(level)->coordX_SP[j];
-                real distY = pointCoordY-para->getParH(level)->coordY_SP[j];
-                real distZ = pointCoordZ-para->getParH(level)->coordZ_SP[j];
-                if( distX <=dx && distY <=dx && distZ <=dx &&
-                    distX >0.f && distY >0.f && distZ >0.f)
-                {
-                    probeIndices_level.push_back(j);
-                    distX_level.push_back( distX/dx );
-                    distY_level.push_back( distY/dx );
-                    distZ_level.push_back( distZ/dx );
-                    pointCoordsX_level.push_back( pointCoordX );
-                    pointCoordsY_level.push_back( pointCoordY );
-                    pointCoordsZ_level.push_back( pointCoordZ );
-                    break;
-                    // printf("x %f y %f z %f", pointCoordX, pointCoordY, pointCoordZ);
-                }
-            }
-        }
+
+        this->findPoints(para, gridProvider, probeIndices_level, distX_level, distY_level, distZ_level,      
+                       pointCoordsX_level, pointCoordsY_level, pointCoordsZ_level,
+                       level);
         
         this->addProbeStruct(cudaManager, probeIndices_level, 
                             distX_level, distY_level, distZ_level, 
@@ -184,9 +161,11 @@ void Probe::init(Parameter* para, GridProvider* gridProvider, CudaMemoryManager*
     }
 }
 
-void Probe::addProbeStruct(CudaMemoryManager* cudaManager, std::vector<int> probeIndices,
-                                      std::vector<real> distX, std::vector<real> distY, std::vector<real> distZ,   
-                                      std::vector<real> pointCoordsX, std::vector<real> pointCoordsY, std::vector<real> pointCoordsZ,
+
+
+void Probe::addProbeStruct(CudaMemoryManager* cudaManager, std::vector<int>& probeIndices,
+                                      std::vector<real>& distX, std::vector<real>& distY, std::vector<real>& distZ,   
+                                      std::vector<real>& pointCoordsX, std::vector<real>& pointCoordsY, std::vector<real>& pointCoordsZ,
                                       int level)
 {
     probeParams[level] = new ProbeStruct;
@@ -246,18 +225,11 @@ void Probe::addProbeStruct(CudaMemoryManager* cudaManager, std::vector<int> prob
 void Probe::visit(Parameter* para, CudaMemoryManager* cudaManager, int level, uint t)
 {
 
-    ProbeStruct* probeStruct = this->getProbeStruct(level);
-
-    vf::gpu::CudaGrid grid = vf::gpu::CudaGrid(128, probeStruct->nPoints);
-
     if(t>this->tStartAvg)
     {
-        
-        interpQuantities<<<grid.grid, grid.threads>>>(  probeStruct->pointIndicesD, probeStruct->nPoints, probeStruct->vals,
-                                                        probeStruct->distXD, probeStruct->distYD, probeStruct->distZD,
-                                                        para->getParD(level)->vx_SP, para->getParD(level)->vy_SP, para->getParD(level)->vz_SP, para->getParD(level)->rho_SP, 
-                                                        para->getParD(level)->neighborX_SP, para->getParD(level)->neighborY_SP, para->getParD(level)->neighborZ_SP, 
-                                                        probeStruct->quantitiesD, probeStruct->arrayOffsetsD, probeStruct->quantitiesArrayD, true);
+        ProbeStruct* probeStruct = this->getProbeStruct(level);
+
+        this->calculateQuantities(probeStruct, para, level);
         probeStruct->vals++;
 
         if(max(int(t) - int(this->tStartOut), -1) % this->tOut == 0)
@@ -281,35 +253,7 @@ void Probe::free(Parameter* para, CudaMemoryManager* cudaManager)
     }
 }
 
-void Probe::setProbePointsFromList(std::vector<real> &_pointCoordsX, std::vector<real> &_pointCoordsY, std::vector<real> &_pointCoordsZ)
-{
-    bool isSameLength = ( (_pointCoordsX.size()==_pointCoordsY.size()) && (_pointCoordsY.size()==_pointCoordsZ.size()));
-    assert("Probe: point lists have different lengths" && isSameLength);
-    this->pointCoordsX = _pointCoordsX;
-    this->pointCoordsY = _pointCoordsY;
-    this->pointCoordsZ = _pointCoordsZ;
-    this->nProbePoints = uint(_pointCoordsX.size());
-    printf("Added list of %u  points \n", this->nProbePoints );
-}
-
-void Probe::setProbePointsFromXNormalPlane(real pos_x, real pos0_y, real pos0_z, real pos1_y, real pos1_z, real delta_y, real delta_z)
-{
-    int n_points_y = int((pos1_y-pos0_y)/delta_y);
-    int n_points_z = int((pos1_z-pos0_z)/delta_z);
-
-    std::vector<real> pointCoordsXtmp, pointCoordsYtmp, pointCoordsZtmp;
 
-    for(int n_y=0; n_y<n_points_y; n_y++)
-    {
-        for(int n_z=0; n_z<n_points_z; n_z++)
-        {
-            pointCoordsXtmp.push_back(pos_x);
-            pointCoordsYtmp.push_back(pos0_y+delta_y*n_y);
-            pointCoordsZtmp.push_back(pos0_z+delta_z*n_z);
-        }
-    }
-    this->setProbePointsFromList(pointCoordsXtmp, pointCoordsYtmp, pointCoordsZtmp);
-}
 
 void Probe::addPostProcessingVariable(PostProcessingVariable variable)
 {
diff --git a/src/gpu/VirtualFluids_GPU/Visitor/Probe.h b/src/gpu/VirtualFluids_GPU/Visitor/Probes/Probe.h
similarity index 61%
rename from src/gpu/VirtualFluids_GPU/Visitor/Probe.h
rename to src/gpu/VirtualFluids_GPU/Visitor/Probes/Probe.h
index 61ba927a1..6e438dafc 100644
--- a/src/gpu/VirtualFluids_GPU/Visitor/Probe.h
+++ b/src/gpu/VirtualFluids_GPU/Visitor/Probes/Probe.h
@@ -1,7 +1,7 @@
 #ifndef Probe_H
 #define Probe_H
 
-#include "Visitor.h"
+#include "Visitor/Visitor.h"
 #include "PointerDefinitions.h"
 
 
@@ -27,6 +27,15 @@ struct ProbeStruct{
     uint *arrayOffsetsH, *arrayOffsetsD;
 };
 
+__global__ void interpQuantities(   uint* pointIndices,
+                                    uint nPoints, uint n,
+                                    real* distX, real* distY, real* distZ,
+                                    real* vx, real* vy, real* vz, real* rho,            
+                                    uint* neighborX, uint* neighborY, uint* neighborZ,
+                                    bool* quantities,
+                                    uint* quantityArrayOffsets, real* quantityArray,
+                                    bool interpolate
+                                );
 
 class Probe : public Visitor 
 {
@@ -50,9 +59,8 @@ public:
     void free(Parameter* para, CudaMemoryManager* cudaManager);
 
     ProbeStruct* getProbeStruct(int level){ return this->probeParams[level]; }
+    
 
-    void setProbePointsFromList(std::vector<real> &_pointCoordsX, std::vector<real> &_pointCoordsY, std::vector<real> &_pointCoordsZ);
-    void setProbePointsFromXNormalPlane(real pos_x, real pos0_y, real pos0_z, real pos1_y, real pos1_z, real delta_y, real delta_z);
     void addPostProcessingVariable(PostProcessingVariable _variable);
 
     void write(Parameter* para, int level, int t);
@@ -61,16 +69,20 @@ public:
     std::vector<std::string> getVarNames();
 
 private:
-    void addProbeStruct(CudaMemoryManager* cudaManager, std::vector<int> probeIndices,
-                                   std::vector<real> distX, std::vector<real> distY, std::vector<real> distZ,   
-                                   std::vector<real> pointCoordsX, std::vector<real> pointCoordsY, std::vector<real> pointCoordsZ,
-                                   int level);
+    virtual void findPoints(Parameter* para, GridProvider* gridProvider, std::vector<int>& probeIndices_level,
+                       std::vector<real>& distX_level, std::vector<real>& distY_level, std::vector<real>& distZ_level,      
+                       std::vector<real>& pointCoordsX_level, std::vector<real>& pointCoordsY_level, std::vector<real>& pointCoordsZ_level,
+                       int level) = 0;
+    void addProbeStruct(CudaMemoryManager* cudaManager, std::vector<int>& probeIndices,
+                        std::vector<real>& distX, std::vector<real>& distY, std::vector<real>& distZ,   
+                        std::vector<real>& pointCoordsX, std::vector<real>& pointCoordsY, std::vector<real>& pointCoordsZ,
+                        int level);
+    virtual void calculateQuantities(ProbeStruct* probeStruct, Parameter* para, int level) = 0;
+
 
     
 private:
     const std::string probeName;
-    std::vector<real> pointCoordsX, pointCoordsY, pointCoordsZ; 
-    uint nProbePoints;
 
     std::vector<ProbeStruct*> probeParams;
     bool quantities[int(PostProcessingVariable::LAST)];
-- 
GitLab