From 28be2db96dd5ba98c1d34bd3d70cbbf944b9e29a Mon Sep 17 00:00:00 2001
From: Soeren Peters <peters@irmb.tu-bs.de>
Date: Thu, 1 Oct 2020 16:09:41 +0200
Subject: [PATCH] Update Interactors.

---
 .../Data/D3Q27EsoTwist3DSplittedVector.cpp    |  33 ++++
 .../Data/D3Q27EsoTwist3DSplittedVector.h      |  39 ++++
 .../Interactors/D3Q27Interactor.cpp           | 172 +++++++-----------
 .../Interactors/D3Q27Interactor.h             |  48 +++--
 .../Interactors/Interactor3D.cpp              |  36 +++-
 .../Interactors/Interactor3D.h                |  39 +++-
 .../Interactors/InteractorsHelper.cpp         |  33 ++++
 .../Interactors/InteractorsHelper.h           |  38 +++-
 8 files changed, 309 insertions(+), 129 deletions(-)

diff --git a/src/cpu/VirtualFluidsCore/Data/D3Q27EsoTwist3DSplittedVector.cpp b/src/cpu/VirtualFluidsCore/Data/D3Q27EsoTwist3DSplittedVector.cpp
index d048f9c58..975749bd4 100644
--- a/src/cpu/VirtualFluidsCore/Data/D3Q27EsoTwist3DSplittedVector.cpp
+++ b/src/cpu/VirtualFluidsCore/Data/D3Q27EsoTwist3DSplittedVector.cpp
@@ -1,3 +1,36 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  This file is part of VirtualFluids. VirtualFluids is free software: you can 
+//  redistribute it and/or modify it under the terms of the GNU General Public
+//  License as published by the Free Software Foundation, either version 3 of 
+//  the License, or (at your option) any later version.
+//  
+//  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT 
+//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
+//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License 
+//  for more details.
+//  
+//  You should have received a copy of the GNU General Public License along
+//  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+//
+//! \file D3Q27EsoTwist3DSplittedVector.cpp
+//! \ingroup Data
+//! \author Konstantin Kutscher
+//=======================================================================================
+
 #include "D3Q27EsoTwist3DSplittedVector.h"
 #include "EsoTwistD3Q27System.h"
 
diff --git a/src/cpu/VirtualFluidsCore/Data/D3Q27EsoTwist3DSplittedVector.h b/src/cpu/VirtualFluidsCore/Data/D3Q27EsoTwist3DSplittedVector.h
index d6ea365f8..f555aabad 100644
--- a/src/cpu/VirtualFluidsCore/Data/D3Q27EsoTwist3DSplittedVector.h
+++ b/src/cpu/VirtualFluidsCore/Data/D3Q27EsoTwist3DSplittedVector.h
@@ -1,3 +1,36 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  This file is part of VirtualFluids. VirtualFluids is free software: you can 
+//  redistribute it and/or modify it under the terms of the GNU General Public
+//  License as published by the Free Software Foundation, either version 3 of 
+//  the License, or (at your option) any later version.
+//  
+//  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT 
+//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
+//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License 
+//  for more details.
+//  
+//  You should have received a copy of the GNU General Public License along
+//  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+//
+//! \file D3Q27EsoTwist3DSplittedVector.h
+//! \ingroup Data
+//! \author Konstantin Kutscher
+//=======================================================================================
+
 #ifndef D3Q27EsoTwist3DSplittedVector_h
 #define D3Q27EsoTwist3DSplittedVector_h
 
@@ -6,10 +39,16 @@
 #include "basics/container/CbArray4D.h"
 #include "basics/container/CbArray3D.h"
 
+//! \brief Class implements EsoTwist3D
+//! \details D3Q27EsoTwist3DSplittedVector uses three vectors to implement Esoteric Twist method
 class D3Q27EsoTwist3DSplittedVector : public EsoTwist3D
 {
 public:
    D3Q27EsoTwist3DSplittedVector();
+   //! \param nx1 number of nodes in x1 direction
+   //! \param nx2 number of nodes in x2 direction
+   //! \param nx3 number of nodes in x3 direction
+   //! \param value initialisation value
    D3Q27EsoTwist3DSplittedVector(size_t nx1, size_t nx2, size_t nx3, LBMReal value);
    //////////////////////////////////////////////////////////////////////////
    ~D3Q27EsoTwist3DSplittedVector();
diff --git a/src/cpu/VirtualFluidsCore/Interactors/D3Q27Interactor.cpp b/src/cpu/VirtualFluidsCore/Interactors/D3Q27Interactor.cpp
index 437524cf5..ed3f9e932 100644
--- a/src/cpu/VirtualFluidsCore/Interactors/D3Q27Interactor.cpp
+++ b/src/cpu/VirtualFluidsCore/Interactors/D3Q27Interactor.cpp
@@ -1,11 +1,46 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  This file is part of VirtualFluids. VirtualFluids is free software: you can 
+//  redistribute it and/or modify it under the terms of the GNU General Public
+//  License as published by the Free Software Foundation, either version 3 of 
+//  the License, or (at your option) any later version.
+//  
+//  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT 
+//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
+//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License 
+//  for more details.
+//  
+//  You should have received a copy of the GNU General Public License along
+//  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+//
+//! \file D3Q27Interactor.cpp
+//! \ingroup Interactor
+//! \author Sören Freudiger
+//! \author Sebastian Geller
+//! \author Konstantin Kutscher
+//=======================================================================================
+
 #include "D3Q27Interactor.h"
 #include <basics/utilities/UbMath.h>
 #include <basics/utilities/UbLogger.h>
 
 #include <basics/writer/WbWriterVtkXmlBinary.h>
 
-#include <geometry3d/GbCuboid3D.h>
-#include <geometry3d/GbLine3D.h>
+#include <GbCuboid3D.h>
+#include <GbLine3D.h>
 #include "Block3D.h"
 #include "Grid3D.h"
 #include "BCArray3D.h"
@@ -14,10 +49,6 @@
 #include "BCProcessor.h"
 #include "BCAdapter.h"
 
-//#include <3rdParty/MarchingCubes/MarchingCubes.h>
-
-
-
 
 using namespace std;
 
@@ -109,41 +140,10 @@ void D3Q27Interactor::initInteractor(const double& timeStep)
    else                   this->unsetTimeDependent();
 
    Interactor3D::initInteractor(timeStep);
-
-  ////calcForces arbeitet nicht korrekt, wenn Geo mit Bloecken 
-  // //unterschiedlicher Leveltiefe diskretisiert -> exception
-  // //abfrage steht hier, weil es theoretisch sein kann, dass bei parallelen rechnungen
-  // //genau der block mit dem anderen level auf einem anderen prozess liegt...
-  // //Update: es kann u.U. passieren, dass Bl�cke in der Liste nicht aktiv sin
-  // //(falls diese z.B. duch andere Interactoren solid gesetzt wurden)
-  // //diese werden nicht ber�cksichtigt (auch nicht beid er kraftauswertung sp�ter)
-  // if(this->isRelevantForForces() )
-  // {
-  //    int level = -1;     
-  //    for( vector<Block3D*>::const_iterator pos = transBlockSet->begin(); pos!=transBlockSet->end(); ++pos)
-  //       if( (*pos)->isActive() )
-  //       {
-  //          level = (*pos)->getLevel();
-  //          break;
-  //       }
-  //    
-  //    bool check = false;
-  //    for( vector<Block3D*>::const_iterator pos = transBlockSet->begin(); pos!=transBlockSet->end(); ++pos)
-  //       if( (*pos)->isActive() && (*pos)->getLevel()!=level)
-  //       {
-  //          throw UbException(UB_EXARGS,"interactor is relevant for forces,"
-  //                                  +(string)" but has transblocks with different levels"
-  //                                  +(string)" -> not supportet by D3Q27Interactor::getForces()"
-  //                                  +(string)" -> increase refineWidth");
-  //       }
-  // }
 }
 //////////////////////////////////////////////////////////////////////////
 void D3Q27Interactor::updateInteractor(const double& timestep)
 {
-   //UB_THROW( UbException(UB_EXARGS,"toDo") );
-   //if(this->isFluid()) return;
-
    UBLOG(logDEBUG5,"D3Q27Interactor::updateInteractor - for timestep = "<<timestep);
 
    //////////////////////////////////////////////////////////////////////////
@@ -161,15 +161,11 @@ void D3Q27Interactor::updateInteractor(const double& timestep)
    if(needTimeDependence) this->setTimeDependent();
    else                   this->unsetTimeDependent();
    
-   //UBLOG(logINFO, "transNodeIndicesMap = "<<transNodeIndicesMap.size());
-   
    for(BcNodeIndicesMap::value_type t : bcNodeIndicesMap)
    {
       SPtr<Block3D> block = t.first;
       std::set< std::vector<int> >& transNodeIndicesSet = t.second;
 
-      //UBLOG(logINFO, "transNodeIndicesSet = "<<transNodeIndicesSet.size());
-
       if(block->isNotActive() || !block) continue;
 
       SPtr<ILBMKernel> kernel = block->getKernel();
@@ -188,24 +184,20 @@ void D3Q27Interactor::updateInteractor(const double& timestep)
          double worldX3 = coords[2];
 
          SPtr<BoundaryConditions> bc = bcArray->getBC(x1,x2,x3);
-         if(bc) //kann sein, dass die BC durch das solid setzen eines andern interactors geloescht wurde
+         if(bc) //may be that the BC has been deleted by the solid setting of another interactor
          {
             for(size_t i=0; i<bcAdapters.size(); i++)
                bcAdapters[i]->adaptBC(*this,bc,worldX1,worldX2,worldX3,timestep);
          }
-         //else 
-         //{
-         //   UBLOG(logERROR,"D3Q27Interactor.updateInteractor (Z."<<__LINE__<<"): da ist kein BC dran ... kann aber korrekt sein s.h. code");
-         //}
       }
    }
 }
 //////////////////////////////////////////////////////////////////////////
-// Berechnung findet im realen Koordinatensystem statt !!!
-// nicht im normierten !
-//x1,x2,x3 sind die Koordinaten unten links vom "System"
-//extendedBoundingGeoOfGeoObject MUSS bereits um delta_x_level in jede richtung vergroesert worden sein fuer SOLID
-bool D3Q27Interactor::setDifferencesToGbObject3D(const SPtr<Block3D> block/*,const double& orgX1,const double& orgX2,const double& orgX3,const double& blockLengthX1,const double& blockLengthX2,const double& blockLengthX3, const double& timestep*/)
+// calculation takes place in the real coordinate system !!!
+// not normalized!
+// x1, x2, x3 are the coordinates at the bottom left of the "system"
+// extendedBoundingGeoOfGeoObject MUST already have been magnified by delta_x_level in each direction for SOLID
+bool D3Q27Interactor::setDifferencesToGbObject3D(const SPtr<Block3D> block)
 {
    if(!block) return false;
 
@@ -218,8 +210,8 @@ bool D3Q27Interactor::setDifferencesToGbObject3D(const SPtr<Block3D> block/*,con
 
 
    double timestep = 0;
-   bool oneEntryGotBC = false; //ob ueberhaupt ein eintrag ein BC zugewiesen wurde
-   bool gotQs         = false; //true, wenn "difference" gesetzt wurde
+   bool oneEntryGotBC = false; 
+   bool gotQs         = false; 
    SPtr<BoundaryConditions> bc;
 
    SPtr<ILBMKernel> kernel = block->getKernel();
@@ -241,7 +233,7 @@ bool D3Q27Interactor::setDifferencesToGbObject3D(const SPtr<Block3D> block/*,con
    double         dx       = grid.lock()->getDeltaX(block);
    UbTupleDouble3 orgDelta = grid.lock()->getNodeOffset(block);
 
-   //anderes boundingRect als in init, da hier das boundrect um ein dx vergroessert werden muss
+   //other boundingRect than in init, because here the boundrect has to be increased by one dx
    GbCuboid3D extendedBoundingGeoOfGeoObject(  geoObject3D->getX1Minimum()-1.02*dx 
                                              , geoObject3D->getX2Minimum()-1.02*dx 
                                              , geoObject3D->getX3Minimum()-1.02*dx 
@@ -254,7 +246,7 @@ bool D3Q27Interactor::setDifferencesToGbObject3D(const SPtr<Block3D> block/*,con
    if(   geoObject3D->hasRaytracing() 
         || (this->isInverseSolid() && geoObject3D->raytracingSupportsPointsInside() ) )
    {
-      //wenn deltaX1==deltaX2==deltaX3 (muss fuer LB!!)
+      //if deltaX1==deltaX2==deltaX3 (must for LB!!)
       if(!UbMath::zero( deltaX1-deltaX2 + deltaX1-deltaX3 + deltaX2-deltaX3 ) )
          throw UbException(UB_EXARGS,"fuer den bei LB nicht vorkommenden Fall deltaX1!=deltaX2!=deltaX3  nicht implementiert ");
 
@@ -278,7 +270,7 @@ bool D3Q27Interactor::setDifferencesToGbObject3D(const SPtr<Block3D> block/*,con
          {
             for(int ix1=startIX1; ix1<stopIX1; ix1++)
             {
-               //TODO weiter untersuchen, ob das nicht ein Fehler ist
+               //TODO: further, investigate if this is not a mistake
                if(bcArray->isUndefined(ix1, ix2, ix3)) continue;
 
                Vector3D coords = grid.lock()->getNodeCoordinates(block, ix1, ix2, ix3);
@@ -286,17 +278,14 @@ bool D3Q27Interactor::setDifferencesToGbObject3D(const SPtr<Block3D> block/*,con
                internX2 = coords[1];
                internX3 = coords[2];
 
-               //point in object test ist ueberfluessig, weil die start und stop indices bereits zuvor 
-               //ermittelt werden -> es werden nur point-IN-cube indizes betrachtet
+               // Point in the object test is superfluous, since the start and stop indices already exist
+               // are determined -> only point-in-cube indexes are considered
                if(extendedBoundingGeoOfGeoObject.isPointInGbObject3D(internX1,internX2,internX3))
                {
                   if(this->isSolid() )
                   {
                      if(this->geoObject3D->isPointInGbObject3D(internX1, internX2, internX3))
                      {
-//#ifdef _OPENMP
-//                        #pragma omp critical (SOLIDNODE_SET_CHANGE)
-//#endif
                         {
                            solidNodeIndices.insert(UbTupleInt3(ix1, ix2, ix3));
                            bcArray->setSolid(ix1,ix2,ix3); 
@@ -306,13 +295,11 @@ bool D3Q27Interactor::setDifferencesToGbObject3D(const SPtr<Block3D> block/*,con
                   }
                   else if( this->isInverseSolid()  )
                   {
-                     //bei inverse solid sind alle Knoten AUSSERHALB und auf der boundary SOLID
+                     //in inverse solid all nodes are OUTSIDE and on the boundary SOLID
                      if( !this->geoObject3D->isPointInGbObject3D(internX1, internX2, internX3, pointOnBoundary) 
                         || pointOnBoundary == true )
                      {
-//#ifdef _OPENMP
-//                        #pragma omp critical (SOLID_SET_CHANGE)
-//#endif
+
                         {
                            solidNodeIndices.insert(UbTupleInt3(ix1, ix2, ix3));
                            bcArray->setSolid(ix1,ix2,ix3); 
@@ -321,18 +308,11 @@ bool D3Q27Interactor::setDifferencesToGbObject3D(const SPtr<Block3D> block/*,con
                      }
                   }
 
-                  //evtl wurde node von anderen interactoren solid gesetzt (muss hie rein->sonst evtl bei
-                  //ueberschneidender geo -> solidNodeIndicesMap unvollstaendig)
                   if(bcArray->isSolid(ix1,ix2,ix3)) 
                      continue;
 
                   gotQs = false;
 
-                  //TODO: prüfen was passiert wenn ein Geoobjekt zwischen zwei knoten rausguckt
-                  //  * /
-                  //<
-                  //  * \  //
-                  //sollen dann keine qs gesetzt werden
                   for(int fdir=D3Q27System::FSTARTDIR; fdir<=D3Q27System::FENDDIR; fdir++)
                   {
                      q = geoObject3D->getIntersectionRaytraceFactor(internX1,internX2,internX3,rayX1[fdir],rayX2[fdir],rayX3[fdir]);
@@ -348,22 +328,17 @@ bool D3Q27Interactor::setDifferencesToGbObject3D(const SPtr<Block3D> block/*,con
                            bc = bcArray->getBC(ix1,ix2,ix3);
                            if(!bc)
                            {
-                              //bc = bvd->createD3Q27BoundaryCondition(); //= new D3Q27BoundaryCondition();
                               bc = SPtr<BoundaryConditions>(new BoundaryConditions);
                               bcArray->setBC(ix1,ix2,ix3,bc);
                            }
-                     //TODO: man muss ueberlegen, wie kann man, dass die Geschwindigkeit auf 0.0 gesetzt werden, vermeiden
-                     //das folgt zu unguenstigen "design rules"
-                      //SG 31.08.2010 das Problem - bewegter Interactor angrenzend an stehenden noslip interactor
-                      // hier sollte die Geschwindigkeit auf 0.0 gesetzt werden
+
                            if(bc->hasNoSlipBoundary())
                            {
                               bc->setBoundaryVelocityX1(0.0);
                               bc->setBoundaryVelocityX2(0.0);
                               bc->setBoundaryVelocityX3(0.0);
                            }
-                       //SG 31.08.2010
-                        
+                       
                            for(int index=(int)bcAdapters.size()-1; index>=0; --index)
                               bcAdapters[index]->adaptBCForDirection(*this,bc,internX1,internX2,internX3,q,fdir, timestep);
                         }
@@ -374,9 +349,6 @@ bool D3Q27Interactor::setDifferencesToGbObject3D(const SPtr<Block3D> block/*,con
 
                   if(gotQs)
                   {
-//#ifdef _OPENMP
-//                     #pragma omp critical (TRANSNODE_SET_CHANGE)
-//#endif
                      {
                         oneEntryGotBC = true;
 
@@ -395,9 +367,6 @@ bool D3Q27Interactor::setDifferencesToGbObject3D(const SPtr<Block3D> block/*,con
                   if( !this->geoObject3D->isPointInGbObject3D(internX1, internX2, internX3, pointOnBoundary) 
                      || pointOnBoundary == true )
                  {
-//#ifdef _OPENMP 
-//   #pragma omp critical (SOLID_SET_CHANGE)
-//#endif
                      {
                         solidNodeIndices.insert(UbTupleInt3(ix1, ix2, ix3));
                         bcArray->setSolid(ix1,ix2,ix3); 
@@ -409,10 +378,9 @@ bool D3Q27Interactor::setDifferencesToGbObject3D(const SPtr<Block3D> block/*,con
          }
       }
    }
-   else  //clipping -> langsamer (wird derzeit auch fuer alle inverseSolid objekte verwendet deren raytracing nicht fuer nodes INNERHALB der geo funzt)
+   else  //clipping -> slower (currently also used for all inverse Solid objects whose raytracing does not work for nodes INSIDE the geo)
    {
       bool pointOnBoundary = false;
-      //#pragma omp parallel for private(internX1,internX2,internX3,gotQs,bc,pointOnBoundary )
       for(int ix1=startIX1; ix1<stopIX1; ix1++)
       {
          for(int ix2=startIX2; ix2<stopIX2; ix2++)
@@ -430,7 +398,6 @@ bool D3Q27Interactor::setDifferencesToGbObject3D(const SPtr<Block3D> block/*,con
                {
                   if( this->isSolid() && this->geoObject3D->isPointInGbObject3D(internX1, internX2, internX3) )
                   {
-                     //#pragma omp critical (SOLID_SET_CHANGE)
                      {
                         solidNodeIndices.insert(UbTupleInt3(ix1, ix2, ix3));
                         bcArray->setSolid(ix1,ix2,ix3); 
@@ -443,7 +410,6 @@ bool D3Q27Interactor::setDifferencesToGbObject3D(const SPtr<Block3D> block/*,con
                      if( !this->geoObject3D->isPointInGbObject3D(internX1, internX2, internX3, pointOnBoundary) 
                          || pointOnBoundary == true )
                      {
-                        //#pragma omp critical (SOLID_SET_CHANGE)
                         {
                            solidNodeIndices.insert(UbTupleInt3(ix1, ix2, ix3));
                            bcArray->setSolid(ix1,ix2,ix3); 
@@ -467,7 +433,7 @@ bool D3Q27Interactor::setDifferencesToGbObject3D(const SPtr<Block3D> block/*,con
                      if(clippedLine)
                      {
                         double q=0.0;
-                        if( !this->isInverseSolid() )  //A liegt auf jeden Fall aussen
+                        if( !this->isInverseSolid() )  //A is outside
                         {
                            double distanceAB = pointA.getDistance(&pointB); //pointA to B
                            double distanceAP = UbMath::min(pointA.getDistance(clippedLine->getPoint1()),
@@ -480,7 +446,7 @@ bool D3Q27Interactor::setDifferencesToGbObject3D(const SPtr<Block3D> block/*,con
                            if(   !clippedLine->getPoint1()->equals(&pointB)
                               && !clippedLine->getPoint2()->equals(&pointB) )
                            {
-                              //A liegt auf jeden Fall drinnen, clipped line darf B nicht enthalten
+                              //A is inside, a clipped line must not contain B
                               double distanceAB = pointA.getDistance(&pointB); //pointA to B
                               double distanceAP = clippedLine->getLength();
                               q = distanceAP/distanceAB;
@@ -491,7 +457,7 @@ bool D3Q27Interactor::setDifferencesToGbObject3D(const SPtr<Block3D> block/*,con
                                                                             ,pointIsOnBoundary )
                                    && pointIsOnBoundary )
                            {
-                              //A liegt auf jeden Fall drinnen, B liegt genau auf ObjektBoundary => q=1.0
+                              //A is definitely inside, B is exactly on ObjectBoundary => q = 1.0
                               q=1.0;
                            }
                            else
@@ -503,12 +469,10 @@ bool D3Q27Interactor::setDifferencesToGbObject3D(const SPtr<Block3D> block/*,con
                         if(UbMath::inClosedInterval(q, 1.0, 1.0)) q = 1.0;
                         if(UbMath::lessEqual(q, 1.0) && UbMath::greater(q, 0.0))
                         {
-                           //#pragma omp critical (BC_CHANGE)
                            {
                               bc = bcArray->getBC(ix1,ix2,ix3);
                               if(!bc)
                               {
-                                 //bc = bvd->createD3Q27BoundaryCondition(); //= new D3Q27BoundaryCondition();
                                  bc = SPtr<BoundaryConditions>(new BoundaryConditions);
                                  bcArray->setBC(ix1,ix2,ix3,bc);
                               }
@@ -527,7 +491,6 @@ bool D3Q27Interactor::setDifferencesToGbObject3D(const SPtr<Block3D> block/*,con
 
                   if(gotQs)
                   {
-                     //#pragma omp critical (TRANSNODE_SET_CHANGE)
                      {
                         oneEntryGotBC = true;
 
@@ -578,7 +541,7 @@ void D3Q27Interactor::addQsLineSet(std::vector<UbTupleFloat3 >& nodes, std::vect
             int ix2 = (*setPos)[1];
             int ix3 = (*setPos)[2];
 
-            if(bcArray->isFluid(ix1,ix2,ix3)) //es kann sein, dass der node von einem anderen interactor z.B. als solid gemarkt wurde!!!
+            if(bcArray->isFluid(ix1,ix2,ix3)) //it may be that the node is replaced by another interactor e.g. was marked as solid !!!
             {
                if( !bcArray->hasBC(ix1,ix2,ix3) ) continue;
                SPtr<BoundaryConditions> bc = bcArray->getBC(ix1,ix2,ix3);
@@ -646,16 +609,14 @@ vector< pair<GbPoint3D,GbPoint3D> >  D3Q27Interactor::getQsLineSet()
    int blocknx1 = val<1>(blocknx);
    int blocknx2 = val<2>(blocknx);
    int blocknx3 = val<3>(blocknx);
-   //   vector<double> deltaT = grid->getD3Q27Calculator()->getDeltaT();
 
    for(SPtr<Block3D> block : bcBlocks)
    {
-       SPtr<ILBMKernel> kernel = block->getKernel();
+      SPtr<ILBMKernel> kernel = block->getKernel();
       SPtr<BCArray3D> bcMatrix = kernel->getBCProcessor()->getBCArray();
       UbTupleDouble3 nodeOffset   = grid.lock()->getNodeOffset(block);
 
-      //double collFactor = ((LbD3Q27Calculator*)grid->getCalculator())->getCollisionsFactors()[block->getLevel()];
-      //checken ob obere reihe doppelt im system vorhanden oder nicht
+      //Check whether top row is double in the system or not
       bool include_N_Face  = false; //x1=[0..blocknx1[ && x3=[0..blocknx3[
       bool include_E_Face  = false; //x2=[0..blocknx2[ && x3=[0..blocknx3[
       bool include_T_Face  = false; //x1=[0..blocknx1[ && x2=[0..blocknx2[
@@ -672,8 +633,6 @@ vector< pair<GbPoint3D,GbPoint3D> >  D3Q27Interactor::getQsLineSet()
          if( !block->getConnector(D3Q27System::TE) && include_T_Face && include_E_Face ) include_TE_Edge = true;
       }
 
-      //      double dT = deltaT[block->getLevel()];
-
       map<SPtr<Block3D>, set< std::vector<int> > >::iterator pos = bcNodeIndicesMap.find(block);
       if(pos==bcNodeIndicesMap.end()) throw UbException(UB_EXARGS,"block nicht in indizes map!!!"+block->toString());
       set< std::vector<int> >& transNodeIndicesSet = pos->second;
@@ -682,23 +641,21 @@ vector< pair<GbPoint3D,GbPoint3D> >  D3Q27Interactor::getQsLineSet()
       double x1,x2,x3,dx;
       grid.lock()->calcStartCoordinatesAndDelta(block,x1,x2,x3,dx);
 
-      //cout<<"getQs: "<<transBlockSet->size()<<" "<<transNodeIndicesVec.size()<<endl;
-
       for(setPos=transNodeIndicesSet.begin(); setPos!=transNodeIndicesSet.end();  ++setPos)
       {
          int ix1 = (*setPos)[0];
          int ix2 = (*setPos)[1];
          int ix3 = (*setPos)[2];
 
-         if(   ( ix1<blocknx1 && ix2<blocknx2 && ix3<blocknx3 ) //std fall
+         if(   ( ix1<blocknx1 && ix2<blocknx2 && ix3<blocknx3 ) 
             || ( include_E_Face  && ix1==blocknx1 && ix2<blocknx2  && ix3<blocknx3  )
             || ( include_N_Face  && ix2==blocknx2 && ix1<blocknx1  && ix3<blocknx3  )
             || ( include_T_Face  && ix3==blocknx3 && ix1<blocknx1  && ix2<blocknx2  )
             || ( include_NE_Edge && ix1==blocknx1 && ix2==blocknx2 )
             || ( include_TN_Edge && ix2==blocknx2 && ix3==blocknx3 )
-            || ( include_TE_Edge && ix1==blocknx1 && ix3==blocknx3 ) ) //ansonsten doppelt im kraftwert
+            || ( include_TE_Edge && ix1==blocknx1 && ix3==blocknx3 ) )
          {
-            if(bcMatrix->isFluid(ix1,ix2,ix3)) //es kann sein, dass der node von einem anderen interactor z.B. als solid gemarkt wurde!!!
+            if(bcMatrix->isFluid(ix1,ix2,ix3)) //it may be that the node is replaced by another interactor e.g. was marked as solid !!!
             {
                if( !bcMatrix->hasBC(ix1,ix2,ix3) ) continue;
                SPtr<BoundaryConditions> bc = bcMatrix->getBC(ix1,ix2,ix3);
@@ -754,7 +711,6 @@ vector< pair<GbPoint3D,GbPoint3D> >  D3Q27Interactor::getQsLineSet()
          }
       }
    }
-   //cout<<"getQs: "<<QsLineSet.size()<<endl;
    return QsLineSet;
 }
 
diff --git a/src/cpu/VirtualFluidsCore/Interactors/D3Q27Interactor.h b/src/cpu/VirtualFluidsCore/Interactors/D3Q27Interactor.h
index 8262dd1df..0ea9aef35 100644
--- a/src/cpu/VirtualFluidsCore/Interactors/D3Q27Interactor.h
+++ b/src/cpu/VirtualFluidsCore/Interactors/D3Q27Interactor.h
@@ -1,9 +1,38 @@
-//  _    ___      __              __________      _     __
-// | |  / (_)____/ /___  ______ _/ / ____/ /_  __(_)___/ /____
-// | | / / / ___/ __/ / / / __ `/ / /_  / / / / / / __  / ___/
-// | |/ / / /  / /_/ /_/ / /_/ / / __/ / / /_/ / / /_/ (__  )
-// |___/_/_/   \__/\__,_/\__,_/_/_/   /_/\__,_/_/\__,_/____/
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
 //
+//  This file is part of VirtualFluids. VirtualFluids is free software: you can 
+//  redistribute it and/or modify it under the terms of the GNU General Public
+//  License as published by the Free Software Foundation, either version 3 of 
+//  the License, or (at your option) any later version.
+//  
+//  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT 
+//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
+//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License 
+//  for more details.
+//  
+//  You should have received a copy of the GNU General Public License along
+//  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+//
+//! \file D3Q27Interactor.h
+//! \ingroup Interactor
+//! \author Soeren Freudiger
+//! \author Sebastian Geller
+//! \author Konstantin Kutscher
+//=======================================================================================
+
 #ifndef D3Q27INTERACTOR_H
 #define D3Q27INTERACTOR_H
 
@@ -27,6 +56,8 @@ class GbObject3D;
 typedef std::map<SPtr<Block3D>, std::set< std::vector<int> > > BcNodeIndicesMap;
 typedef std::map<SPtr<Block3D>, std::set< UbTupleInt3 > > SolidNodeIndicesMap;
 
+//! \brief A specialized class for grid generation.
+//! \details Support standard geometric primitives.
 class D3Q27Interactor : public Interactor3D 
 {
 public:
@@ -52,7 +83,7 @@ public:
    void removeSolidBlocks() { Interactor3D::removeSolidBlocks(); solidNodeIndicesMap.clear(); }
    void removeBcBlocks() { Interactor3D::removeBcBlocks(); bcNodeIndicesMap.clear(); }
 
-   bool setDifferencesToGbObject3D(const SPtr<Block3D> block/*, const double& x1, const double& x2, const double& x3, const double& blockLengthX1, const double& blockLengthX2, const double& blockLengthX3, const double& timestep=0*/);
+   bool setDifferencesToGbObject3D(const SPtr<Block3D> block);
 
    ObObject* clone() { throw UbException(UB_EXARGS,"not implemented");	}
 
@@ -68,14 +99,9 @@ protected:
    bool reinitWithStoredQsFlag;
 
    std::vector<SPtr<BCAdapter> > bcAdapters;
-   
 
    SolidNodeIndicesMap solidNodeIndicesMap;
    BcNodeIndicesMap bcNodeIndicesMap;
-                                                                         //!!! es kann sein, dass in diesem interactor
-                                                                         //an eine rpos eine BC gesetzt wurde, aber derselbe node in
-                                                                         //in einem anderen in einen anderen Typ (z.B. Solid) geaendert
-                                                                         //wurde --> es ist keine BC mehr an der stelle!
    
    void   initRayVectors();
    double rayX1[D3Q27System::FENDDIR+1];
diff --git a/src/cpu/VirtualFluidsCore/Interactors/Interactor3D.cpp b/src/cpu/VirtualFluidsCore/Interactors/Interactor3D.cpp
index 1b39e29a4..9c1d16b18 100644
--- a/src/cpu/VirtualFluidsCore/Interactors/Interactor3D.cpp
+++ b/src/cpu/VirtualFluidsCore/Interactors/Interactor3D.cpp
@@ -1,11 +1,41 @@
-#include "Interactor3D.h"
-
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  This file is part of VirtualFluids. VirtualFluids is free software: you can 
+//  redistribute it and/or modify it under the terms of the GNU General Public
+//  License as published by the Free Software Foundation, either version 3 of 
+//  the License, or (at your option) any later version.
+//  
+//  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT 
+//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
+//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License 
+//  for more details.
+//  
+//  You should have received a copy of the GNU General Public License along
+//  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+//
+//! \file Interactor3D.cpp
+//! \ingroup Interactor
+//! \author Konstantin Kutscher
+//=======================================================================================
 
+#include "Interactor3D.h"
 
 #include <fstream>
 #include <geometry3d/GbCuboid3D.h>
 #include <basics/utilities/UbMath.h>
-#include <basics/utilities/UbFileOutput.h>
 #include "UbException.h"
 
 #include "Grid3D.h"
diff --git a/src/cpu/VirtualFluidsCore/Interactors/Interactor3D.h b/src/cpu/VirtualFluidsCore/Interactors/Interactor3D.h
index e5c7c5d72..452e62d8c 100644
--- a/src/cpu/VirtualFluidsCore/Interactors/Interactor3D.h
+++ b/src/cpu/VirtualFluidsCore/Interactors/Interactor3D.h
@@ -1,3 +1,36 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  This file is part of VirtualFluids. VirtualFluids is free software: you can 
+//  redistribute it and/or modify it under the terms of the GNU General Public
+//  License as published by the Free Software Foundation, either version 3 of 
+//  the License, or (at your option) any later version.
+//  
+//  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT 
+//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
+//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License 
+//  for more details.
+//  
+//  You should have received a copy of the GNU General Public License along
+//  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+//
+//! \file Interactor3D.h
+//! \ingroup Interactor
+//! \author Konstantin Kutscher
+//=======================================================================================
+
 #ifndef INTERACTOR3D_H
 #define INTERACTOR3D_H
 
@@ -9,13 +42,9 @@
 
 class Block3D;
 class Grid3D;
-class UbFileInput;
-class UbFileOutput;
 class GbObject3D;
-class Block3D;
-
-
 
+//! A base class for grid generation.
 class Interactor3D : public enableSharedFromThis<Interactor3D>
 {
 public:
diff --git a/src/cpu/VirtualFluidsCore/Interactors/InteractorsHelper.cpp b/src/cpu/VirtualFluidsCore/Interactors/InteractorsHelper.cpp
index 2d11b43f9..62340a47e 100644
--- a/src/cpu/VirtualFluidsCore/Interactors/InteractorsHelper.cpp
+++ b/src/cpu/VirtualFluidsCore/Interactors/InteractorsHelper.cpp
@@ -1,3 +1,36 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  This file is part of VirtualFluids. VirtualFluids is free software: you can 
+//  redistribute it and/or modify it under the terms of the GNU General Public
+//  License as published by the Free Software Foundation, either version 3 of 
+//  the License, or (at your option) any later version.
+//  
+//  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT 
+//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
+//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License 
+//  for more details.
+//  
+//  You should have received a copy of the GNU General Public License along
+//  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+//
+//! \file InteractorsHelper.cpp
+//! \ingroup Interactor
+//! \author Konstantin Kutscher
+//=======================================================================================
+
 #include "InteractorsHelper.h"
 
 #include <Grid3DVisitor.h>
diff --git a/src/cpu/VirtualFluidsCore/Interactors/InteractorsHelper.h b/src/cpu/VirtualFluidsCore/Interactors/InteractorsHelper.h
index 6380ba132..87aad2574 100644
--- a/src/cpu/VirtualFluidsCore/Interactors/InteractorsHelper.h
+++ b/src/cpu/VirtualFluidsCore/Interactors/InteractorsHelper.h
@@ -1,5 +1,38 @@
-#ifndef SolidBlocksHelper_h 
-#define SolidBlocksHelper_h
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  This file is part of VirtualFluids. VirtualFluids is free software: you can 
+//  redistribute it and/or modify it under the terms of the GNU General Public
+//  License as published by the Free Software Foundation, either version 3 of 
+//  the License, or (at your option) any later version.
+//  
+//  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT 
+//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
+//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License 
+//  for more details.
+//  
+//  You should have received a copy of the GNU General Public License along
+//  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+//
+//! \file InteractorsHelper.h
+//! \ingroup Interactor
+//! \author Konstantin Kutscher
+//=======================================================================================
+
+#ifndef InteractorsHelper_h 
+#define InteractorsHelper_h
 
 #include <vector>
 #include <PointerDefinitions.h>
@@ -10,6 +43,7 @@ class Block3D;
 class Grid3D;
 class Grid3DVisitor;
 
+//! A helper class for grid generation.
 class InteractorsHelper
 {
 public:
-- 
GitLab