diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000000000000000000000000000000000000..8a4ad7f2e84e410e3515a9f2530717956177daa1
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,11 @@
+# Set the default behavior, in case people don't have core.autocrlf set.
+* text=auto
+
+# Explicitly declare text files you want to always be normalized and converted
+# to native line endings on checkout.
+*.c text
+*.h text
+*.cpp text
+*.hpp text
+*.cuh text
+*.cu text
diff --git a/3rdParty/MarchingCubes/CMakePackage.txt b/3rdParty/MarchingCubes/CMakePackage.txt
index 64f5dcd2028cfd7904187d7bac7131554e02b20c..b4e619a03839520bde16837d806f9dc5269be71a 100644
--- a/3rdParty/MarchingCubes/CMakePackage.txt
+++ b/3rdParty/MarchingCubes/CMakePackage.txt
@@ -1,6 +1,6 @@
-GET_FILENAME_COMPONENT( CURRENT_DIR  ${CMAKE_CURRENT_LIST_FILE} PATH) 
-COLLECT_PACKAGE_DATA_WITH_OPTION(${CURRENT_DIR} ALL_SOURCES outOption outSourceGroupName)
-
-IF(${outOption})
-   list(APPEND VF_COMPILER_DEFINITION MC_CUBES)
-ENDIF()
+GET_FILENAME_COMPONENT( CURRENT_DIR  ${CMAKE_CURRENT_LIST_FILE} PATH) 
+COLLECT_PACKAGE_DATA_WITH_OPTION(${CURRENT_DIR} ALL_SOURCES outOption outSourceGroupName)
+
+IF(${outOption})
+   list(APPEND VF_COMPILER_DEFINITION MC_CUBES)
+ENDIF()
diff --git a/3rdParty/MarchingCubes/Matrix3DWrapper.h b/3rdParty/MarchingCubes/Matrix3DWrapper.h
index a0ff84a2504990a0a72deb82e4b584dfb2c9efee..6824ae966719e4316e503fc25da76d325cf34bc0 100644
--- a/3rdParty/MarchingCubes/Matrix3DWrapper.h
+++ b/3rdParty/MarchingCubes/Matrix3DWrapper.h
@@ -1,126 +1,126 @@
-//  _    ___      __              __________      _     __
-// | |  / (_)____/ /___  ______ _/ / ____/ /_  __(_)___/ /____
-// | | / / / ___/ __/ / / / __ `/ / /_  / / / / / / __  / ___/
-// | |/ / / /  / /_/ /_/ / /_/ / / __/ / / /_/ / / /_/ (__  )
-// |___/_/_/   \__/\__,_/\__,_/_/_/   /_/\__,_/_/\__,_/____/
-//
-#ifndef MATRIX3DWRAPPER_H
-#define MATRIX3DWRAPPER_H
-
-//extension by CAB
-#include <vector>
-#include <string>
-#include <fstream>
-
-#include <basics/utilities/UbException.h>
-#include <MarchingCubes/McTypes.h>
-
-//neu: matrix muss lediglich double operator()(int x1, int x2, int x3) überladen, dann kann man sie verwenden!!
-
-//////////////////////////////////////////////////////////////////////////
-//Matrix3DWrapper-Wrapper
-//   CbUniformMatrix3D<double> data(10,8,5);
-//   for(int x3=0; x3<data.getNX3(); x3++)
-//    for(int x2=0; x2<data.getNX2(); x2++)
-//      for(int x1=0; x1<data.getNX1(); x1++)
-//        data(x1,x2,x3) = x1;
-//
-//   Matrix3DWrapper< CbUniformMatrix3D<double> > wrapper(&data);
-//   MarchingCubes< Matrix3DWrapper< CbUniformMatrix3D<double> > > mc( wrapper );
-//
-//   mc.init_all();
-//   mc.run(3.5);
-//   mc.writeUCD("c:/temp/triangles.inp");
-//   mc.clean_all();
-
-namespace McCubes{
-
-template< typename Matrix3D >
-class Matrix3DWrapper
-{
-public:
-   Matrix3DWrapper()
-      :  matrix(NULL)
-       , minX1(-1), minX2(-1), minX3(-1)
-       , maxX1(-1), maxX2(-1), maxX3(-1)
-       , nx1(-1)  , nx2(-1)  , nx3(-1)
-   {
-      //wird benötigt, damit MarchingCubes generell eine membervariabel erstellen kann
-   }
-   /*==========================================================*/
-   Matrix3DWrapper( Matrix3D* matrix)
-      : matrix(matrix)
-   {
-      nx1 = (int)matrix->getNX1();
-      nx2 = (int)matrix->getNX2();
-      nx3 = (int)matrix->getNX3();
-
-      minX1 = minX2 = minX3 = 0;
-      maxX1 = nx1-1;
-      maxX2 = nx2-1;
-      maxX3 = nx3-1;
-   }
-   /*==========================================================*/
-   Matrix3DWrapper( Matrix3D* matrix, const int& n1, const int& nx2, const int& nx3)
-      : matrix(matrix)
-      , nx1(nx1), nx2(nx2), nx3(nx3)
-   {
-      minX1 = minX2 = minX3 = 0;
-      maxX1 = nx1-1;
-      maxX2 = nx2-1;
-      maxX3 = nx3-1;
-   }
-   /*==========================================================*/
-   Matrix3DWrapper( Matrix3D* matrix, const int& minX1, const int& minX2, const int& minX3
-                                    , const int& maxX1, const int& maxX2, const int& maxX3 )
-      :  matrix(matrix)
-       , minX1(minX1), minX2(minX2), minX3(minX3)
-       , maxX1(maxX1), maxX2(maxX2), maxX3(maxX3)
-   {
-      nx1 = matrix->getNX1();
-      nx2 = matrix->getNX2();
-      nx3 = matrix->getNX3();
-
-      if(minX1<0 || minX2<0 || minX3<0 || maxX1>=nx1 || maxX2>=nx2 || maxX3>=nx3)
-         throw UbException(UB_EXARGS,"range error");
-   }
-   /*==========================================================*/
-   //wenn man z.B. matrixX1 von[0..10] geht und man nur den bereich 1..9 fuer MC
-   //verwenden möchte -> minX1=1 und maxX2=2
-   Matrix3DWrapper( Matrix3D* matrix, const int& minX1, const int& minX2, const int& minX3
-                                    , const int& maxX1, const int& maxX2, const int& maxX3
-                                    , const int& n1   , const int& nx2  , const int& nx3   )
-      :   matrix(matrix)
-        , minX1(minX1), minX2(minX2), minX3(minX3)
-        , maxX1(maxX1), maxX2(maxX2), maxX3(maxX3)
-        , nx1(n1)     , nx2(nx2)    , nx3(nx3)
-   {
-      if(minX1<0 || minX2<0 || minX3<0 || maxX1>=nx1 || maxX2>=nx2 || maxX3>=nx3)
-         throw UbException(UB_EXARGS,"range error");
-   }
-   /*==========================================================*/
-   inline real getData(const int& x1, const int& x2, const int& x3 ) const
-   {
-      return static_cast<real>( (*matrix)(x1, x2, x3) );
-   }
-   /*==========================================================*/
-   inline int getMinX1() const { return minX1; }  
-   inline int getMinX2() const { return minX2; }  
-   inline int getMinX3() const { return minX3; }  
-
-   inline int getMaxX1() const { return maxX1; }  
-   inline int getMaxX2() const { return maxX2; }  
-   inline int getMaxX3() const { return maxX3; }  
-
-   inline int getNX1()   const { return nx1;   }  
-   inline int getNX2()   const { return nx2;   }  
-   inline int getNX3()   const { return nx3;   }  
-
-protected:
-   Matrix3D* matrix;
-   int minX1, minX2, minX3, maxX1, maxX2, maxX3, nx1, nx2, nx3;
-};
-
-} //namespace McCubes
-
-#endif //MATRIX3DWRAPPER_H
+//  _    ___      __              __________      _     __
+// | |  / (_)____/ /___  ______ _/ / ____/ /_  __(_)___/ /____
+// | | / / / ___/ __/ / / / __ `/ / /_  / / / / / / __  / ___/
+// | |/ / / /  / /_/ /_/ / /_/ / / __/ / / /_/ / / /_/ (__  )
+// |___/_/_/   \__/\__,_/\__,_/_/_/   /_/\__,_/_/\__,_/____/
+//
+#ifndef MATRIX3DWRAPPER_H
+#define MATRIX3DWRAPPER_H
+
+//extension by CAB
+#include <vector>
+#include <string>
+#include <fstream>
+
+#include <basics/utilities/UbException.h>
+#include <MarchingCubes/McTypes.h>
+
+//neu: matrix muss lediglich double operator()(int x1, int x2, int x3) überladen, dann kann man sie verwenden!!
+
+//////////////////////////////////////////////////////////////////////////
+//Matrix3DWrapper-Wrapper
+//   CbUniformMatrix3D<double> data(10,8,5);
+//   for(int x3=0; x3<data.getNX3(); x3++)
+//    for(int x2=0; x2<data.getNX2(); x2++)
+//      for(int x1=0; x1<data.getNX1(); x1++)
+//        data(x1,x2,x3) = x1;
+//
+//   Matrix3DWrapper< CbUniformMatrix3D<double> > wrapper(&data);
+//   MarchingCubes< Matrix3DWrapper< CbUniformMatrix3D<double> > > mc( wrapper );
+//
+//   mc.init_all();
+//   mc.run(3.5);
+//   mc.writeUCD("c:/temp/triangles.inp");
+//   mc.clean_all();
+
+namespace McCubes{
+
+template< typename Matrix3D >
+class Matrix3DWrapper
+{
+public:
+   Matrix3DWrapper()
+      :  matrix(NULL)
+       , minX1(-1), minX2(-1), minX3(-1)
+       , maxX1(-1), maxX2(-1), maxX3(-1)
+       , nx1(-1)  , nx2(-1)  , nx3(-1)
+   {
+      //wird benötigt, damit MarchingCubes generell eine membervariabel erstellen kann
+   }
+   /*==========================================================*/
+   Matrix3DWrapper( Matrix3D* matrix)
+      : matrix(matrix)
+   {
+      nx1 = (int)matrix->getNX1();
+      nx2 = (int)matrix->getNX2();
+      nx3 = (int)matrix->getNX3();
+
+      minX1 = minX2 = minX3 = 0;
+      maxX1 = nx1-1;
+      maxX2 = nx2-1;
+      maxX3 = nx3-1;
+   }
+   /*==========================================================*/
+   Matrix3DWrapper( Matrix3D* matrix, const int& n1, const int& nx2, const int& nx3)
+      : matrix(matrix)
+      , nx1(nx1), nx2(nx2), nx3(nx3)
+   {
+      minX1 = minX2 = minX3 = 0;
+      maxX1 = nx1-1;
+      maxX2 = nx2-1;
+      maxX3 = nx3-1;
+   }
+   /*==========================================================*/
+   Matrix3DWrapper( Matrix3D* matrix, const int& minX1, const int& minX2, const int& minX3
+                                    , const int& maxX1, const int& maxX2, const int& maxX3 )
+      :  matrix(matrix)
+       , minX1(minX1), minX2(minX2), minX3(minX3)
+       , maxX1(maxX1), maxX2(maxX2), maxX3(maxX3)
+   {
+      nx1 = matrix->getNX1();
+      nx2 = matrix->getNX2();
+      nx3 = matrix->getNX3();
+
+      if(minX1<0 || minX2<0 || minX3<0 || maxX1>=nx1 || maxX2>=nx2 || maxX3>=nx3)
+         throw UbException(UB_EXARGS,"range error");
+   }
+   /*==========================================================*/
+   //wenn man z.B. matrixX1 von[0..10] geht und man nur den bereich 1..9 fuer MC
+   //verwenden möchte -> minX1=1 und maxX2=2
+   Matrix3DWrapper( Matrix3D* matrix, const int& minX1, const int& minX2, const int& minX3
+                                    , const int& maxX1, const int& maxX2, const int& maxX3
+                                    , const int& n1   , const int& nx2  , const int& nx3   )
+      :   matrix(matrix)
+        , minX1(minX1), minX2(minX2), minX3(minX3)
+        , maxX1(maxX1), maxX2(maxX2), maxX3(maxX3)
+        , nx1(n1)     , nx2(nx2)    , nx3(nx3)
+   {
+      if(minX1<0 || minX2<0 || minX3<0 || maxX1>=nx1 || maxX2>=nx2 || maxX3>=nx3)
+         throw UbException(UB_EXARGS,"range error");
+   }
+   /*==========================================================*/
+   inline real getData(const int& x1, const int& x2, const int& x3 ) const
+   {
+      return static_cast<real>( (*matrix)(x1, x2, x3) );
+   }
+   /*==========================================================*/
+   inline int getMinX1() const { return minX1; }  
+   inline int getMinX2() const { return minX2; }  
+   inline int getMinX3() const { return minX3; }  
+
+   inline int getMaxX1() const { return maxX1; }  
+   inline int getMaxX2() const { return maxX2; }  
+   inline int getMaxX3() const { return maxX3; }  
+
+   inline int getNX1()   const { return nx1;   }  
+   inline int getNX2()   const { return nx2;   }  
+   inline int getNX3()   const { return nx3;   }  
+
+protected:
+   Matrix3D* matrix;
+   int minX1, minX2, minX3, maxX1, maxX2, maxX3, nx1, nx2, nx3;
+};
+
+} //namespace McCubes
+
+#endif //MATRIX3DWRAPPER_H
diff --git a/3rdParty/MarchingCubes/Matrix4DWrapper.h b/3rdParty/MarchingCubes/Matrix4DWrapper.h
index 3aa5f20286cf73511ff4f93da025b3796585ca70..9137a68ef849686205e2a5a24483aabdc877c4b2 100644
--- a/3rdParty/MarchingCubes/Matrix4DWrapper.h
+++ b/3rdParty/MarchingCubes/Matrix4DWrapper.h
@@ -1,131 +1,131 @@
-//  _    ___      __              __________      _     __
-// | |  / (_)____/ /___  ______ _/ / ____/ /_  __(_)___/ /____
-// | | / / / ___/ __/ / / / __ `/ / /_  / / / / / / __  / ___/
-// | |/ / / /  / /_/ /_/ / /_/ / / __/ / / /_/ / / /_/ (__  )
-// |___/_/_/   \__/\__,_/\__,_/_/_/   /_/\__,_/_/\__,_/____/
-//
-#ifndef MATRIX4DWRAPPER_H
-#define MATRIX4DWRAPPER_H
-
-//extension by CAB
-#include <vector>
-#include <string>
-#include <fstream>
-
-#include <basics/utilities/UbException.h>
-#include <MarchingCubes/McTypes.h>
-
-//neu: matrix muss lediglich double operator()(int x1, int x2, int x3, int x4) überladen, dann kann man sie verwenden!!
-
-//////////////////////////////////////////////////////////////////////////
-//Matrix4DWrapper-Wrapper
-//example:
-//   int indexForDataValue = 1;
-//   CbUniformMatrix4D<double> data(10,8,5,2);
-//   for(int x3=0; x3<data.getNX3(); x3++)
-//    for(int x2=0; x2<data.getNX2(); x2++)
-//      for(int x1=0; x1<data.getNX1(); x1++)
-//        data(x1,x2,x3,indexForDataValue) = x1;
-//
-//   Matrix4DWrapper< CbUniformMatrix4D<double> > wrapper(&data,indexForDataValue);
-//   MarchingCubes< Matrix4DWrapper< CbUniformMatrix4D<double> > > mc( wrapper );
-//
-//   mc.init_all();
-//   mc.run(3.5);
-//   mc.writeUCD("c:/temp/triangles.inp");
-//   mc.clean_all();
-
-namespace McCubes{
-
-template< typename Matrix4D >
-class Matrix4DWrapper
-{
-public:
-   Matrix4DWrapper() 
-      :  valIndex(-1), matrix(NULL)
-       , minX1(-1), minX2(-1), minX3(-1)
-       , maxX1(-1), maxX2(-1), maxX3(-1)
-       , nx1(-1)  , nx2(-1)  , nx3(-1)
-   {
-      //wird benötigt, damit MarchingCubes generell eine membervariabel erstellen kann
-   }
-   /*==========================================================*/
-   Matrix4DWrapper( Matrix4D* matrix, const int& valIndex,const int& n1, const int& nx2, const int& nx3)
-      :  valIndex(valIndex), matrix(matrix)
-       , nx1(nx1), nx2(nx2), nx3(nx3)
-   {
-      minX1 = minX2 = minX3 = 0;
-      maxX1 = nx1-1;
-      maxX2 = nx2-1;
-      maxX3 = nx3-1;
-   }
-   /*==========================================================*/
-   Matrix4DWrapper( Matrix4D* matrix, const int& valIndex)
-      : valIndex(valIndex), matrix(matrix)
-   {
-      nx1 = matrix->getNX1();
-      nx2 = matrix->getNX2();
-      nx3 = matrix->getNX3();
-
-      minX1 = minX2 = minX3 = 0;
-      maxX1 = nx1-1;
-      maxX2 = nx2-1;
-      maxX3 = nx3-1;
-   }
-   /*==========================================================*/
-   //wenn man z.B. matrixX1 von[0..10] geht und man nur den bereich 1..9 fuer MC
-   //verwenden möchte -> minX1=1 und maxX2=2
-   Matrix4DWrapper( Matrix4D* matrix, const int& valIndex, const int& minX1, const int& minX2, const int& minX3,
-                                                           const int& maxX1, const int& maxX2, const int& maxX3)
-       :  valIndex(valIndex), matrix(matrix)
-        , minX1(minX1), minX2(minX2), minX3(minX3)
-        , maxX1(maxX1), maxX2(maxX2), maxX3(maxX3)
-   {
-      nx1 = matrix->getNX1();
-      nx2 = matrix->getNX2();
-      nx3 = matrix->getNX3();
-
-      if(minX1<0 || minX2<0 || minX3<0 || maxX1>=nx1 || maxX2>=nx2 || maxX3>=nx3)
-         throw UbException(UB_EXARGS,"range error");
-   }
-   /*==========================================================*/
-   //wenn man z.B. matrixX1 von[0..10] geht und man nur den bereich 1..9 fuer MC
-   //verwenden möchte -> minX1=1 und maxX2=2
-   Matrix4DWrapper( Matrix4D* matrix, const int& valIndex, const int& minX1, const int& minX2, const int& minX3
-                                                         , const int& maxX1, const int& maxX2, const int& maxX3
-                                                         , const int& n1   , const int& nx2  , const int& nx3   )
-      :  valIndex(valIndex), matrix(matrix)
-       , minX1(minX1), minX2(minX2), minX3(minX3)
-       , maxX1(maxX1), maxX2(maxX2), maxX3(maxX3)
-       , nx1(nx1)    , nx2(nx2)    , nx3(nx3)
-   {
-      if(minX1<0 || minX2<0 || minX3<0 || maxX1>=nx1 || maxX2>=nx2 || maxX3>=nx3)
-         throw UbException(UB_EXARGS,"range error");
-   }
-   /*==========================================================*/
-   inline real getData(const int& x1, const int& x2, const int& x3 ) const
-   {
-      return static_cast<real>( (*matrix)(x1, x2, x3, valIndex) );
-   }
-   /*==========================================================*/
-   inline int getMinX1() const { return minX1; }  
-   inline int getMinX2() const { return minX2; }  
-   inline int getMinX3() const { return minX3; }  
-
-   inline int getMaxX1() const { return maxX1; }  
-   inline int getMaxX2() const { return maxX2; }  
-   inline int getMaxX3() const { return maxX3; }  
-
-   inline int getNX1()   const { return nx1;   }  
-   inline int getNX2()   const { return nx2;   }  
-   inline int getNX3()   const { return nx3;   }  
-
-protected:
-   int valIndex;
-   Matrix4D* matrix;
-   int minX1, minX2, minX3, maxX1, maxX2, maxX3, nx1, nx2, nx3;
-};
-
-} //namespace McCubes
-
-#endif //MATRIX4DWRAPPER_H
+//  _    ___      __              __________      _     __
+// | |  / (_)____/ /___  ______ _/ / ____/ /_  __(_)___/ /____
+// | | / / / ___/ __/ / / / __ `/ / /_  / / / / / / __  / ___/
+// | |/ / / /  / /_/ /_/ / /_/ / / __/ / / /_/ / / /_/ (__  )
+// |___/_/_/   \__/\__,_/\__,_/_/_/   /_/\__,_/_/\__,_/____/
+//
+#ifndef MATRIX4DWRAPPER_H
+#define MATRIX4DWRAPPER_H
+
+//extension by CAB
+#include <vector>
+#include <string>
+#include <fstream>
+
+#include <basics/utilities/UbException.h>
+#include <MarchingCubes/McTypes.h>
+
+//neu: matrix muss lediglich double operator()(int x1, int x2, int x3, int x4) überladen, dann kann man sie verwenden!!
+
+//////////////////////////////////////////////////////////////////////////
+//Matrix4DWrapper-Wrapper
+//example:
+//   int indexForDataValue = 1;
+//   CbUniformMatrix4D<double> data(10,8,5,2);
+//   for(int x3=0; x3<data.getNX3(); x3++)
+//    for(int x2=0; x2<data.getNX2(); x2++)
+//      for(int x1=0; x1<data.getNX1(); x1++)
+//        data(x1,x2,x3,indexForDataValue) = x1;
+//
+//   Matrix4DWrapper< CbUniformMatrix4D<double> > wrapper(&data,indexForDataValue);
+//   MarchingCubes< Matrix4DWrapper< CbUniformMatrix4D<double> > > mc( wrapper );
+//
+//   mc.init_all();
+//   mc.run(3.5);
+//   mc.writeUCD("c:/temp/triangles.inp");
+//   mc.clean_all();
+
+namespace McCubes{
+
+template< typename Matrix4D >
+class Matrix4DWrapper
+{
+public:
+   Matrix4DWrapper() 
+      :  valIndex(-1), matrix(NULL)
+       , minX1(-1), minX2(-1), minX3(-1)
+       , maxX1(-1), maxX2(-1), maxX3(-1)
+       , nx1(-1)  , nx2(-1)  , nx3(-1)
+   {
+      //wird benötigt, damit MarchingCubes generell eine membervariabel erstellen kann
+   }
+   /*==========================================================*/
+   Matrix4DWrapper( Matrix4D* matrix, const int& valIndex,const int& n1, const int& nx2, const int& nx3)
+      :  valIndex(valIndex), matrix(matrix)
+       , nx1(nx1), nx2(nx2), nx3(nx3)
+   {
+      minX1 = minX2 = minX3 = 0;
+      maxX1 = nx1-1;
+      maxX2 = nx2-1;
+      maxX3 = nx3-1;
+   }
+   /*==========================================================*/
+   Matrix4DWrapper( Matrix4D* matrix, const int& valIndex)
+      : valIndex(valIndex), matrix(matrix)
+   {
+      nx1 = matrix->getNX1();
+      nx2 = matrix->getNX2();
+      nx3 = matrix->getNX3();
+
+      minX1 = minX2 = minX3 = 0;
+      maxX1 = nx1-1;
+      maxX2 = nx2-1;
+      maxX3 = nx3-1;
+   }
+   /*==========================================================*/
+   //wenn man z.B. matrixX1 von[0..10] geht und man nur den bereich 1..9 fuer MC
+   //verwenden möchte -> minX1=1 und maxX2=2
+   Matrix4DWrapper( Matrix4D* matrix, const int& valIndex, const int& minX1, const int& minX2, const int& minX3,
+                                                           const int& maxX1, const int& maxX2, const int& maxX3)
+       :  valIndex(valIndex), matrix(matrix)
+        , minX1(minX1), minX2(minX2), minX3(minX3)
+        , maxX1(maxX1), maxX2(maxX2), maxX3(maxX3)
+   {
+      nx1 = matrix->getNX1();
+      nx2 = matrix->getNX2();
+      nx3 = matrix->getNX3();
+
+      if(minX1<0 || minX2<0 || minX3<0 || maxX1>=nx1 || maxX2>=nx2 || maxX3>=nx3)
+         throw UbException(UB_EXARGS,"range error");
+   }
+   /*==========================================================*/
+   //wenn man z.B. matrixX1 von[0..10] geht und man nur den bereich 1..9 fuer MC
+   //verwenden möchte -> minX1=1 und maxX2=2
+   Matrix4DWrapper( Matrix4D* matrix, const int& valIndex, const int& minX1, const int& minX2, const int& minX3
+                                                         , const int& maxX1, const int& maxX2, const int& maxX3
+                                                         , const int& n1   , const int& nx2  , const int& nx3   )
+      :  valIndex(valIndex), matrix(matrix)
+       , minX1(minX1), minX2(minX2), minX3(minX3)
+       , maxX1(maxX1), maxX2(maxX2), maxX3(maxX3)
+       , nx1(nx1)    , nx2(nx2)    , nx3(nx3)
+   {
+      if(minX1<0 || minX2<0 || minX3<0 || maxX1>=nx1 || maxX2>=nx2 || maxX3>=nx3)
+         throw UbException(UB_EXARGS,"range error");
+   }
+   /*==========================================================*/
+   inline real getData(const int& x1, const int& x2, const int& x3 ) const
+   {
+      return static_cast<real>( (*matrix)(x1, x2, x3, valIndex) );
+   }
+   /*==========================================================*/
+   inline int getMinX1() const { return minX1; }  
+   inline int getMinX2() const { return minX2; }  
+   inline int getMinX3() const { return minX3; }  
+
+   inline int getMaxX1() const { return maxX1; }  
+   inline int getMaxX2() const { return maxX2; }  
+   inline int getMaxX3() const { return maxX3; }  
+
+   inline int getNX1()   const { return nx1;   }  
+   inline int getNX2()   const { return nx2;   }  
+   inline int getNX3()   const { return nx3;   }  
+
+protected:
+   int valIndex;
+   Matrix4D* matrix;
+   int minX1, minX2, minX3, maxX1, maxX2, maxX3, nx1, nx2, nx3;
+};
+
+} //namespace McCubes
+
+#endif //MATRIX4DWRAPPER_H
diff --git a/3rdParty/MarchingCubes/MatrixWrapper.h b/3rdParty/MarchingCubes/MatrixWrapper.h
index 3cbec76d7cee169a8377beec39e9b9ef395fee9c..c787fa77ffd59014f6a542a66916c9784aa6c7d0 100644
--- a/3rdParty/MarchingCubes/MatrixWrapper.h
+++ b/3rdParty/MarchingCubes/MatrixWrapper.h
@@ -1,131 +1,131 @@
-//  _    ___      __              __________      _     __
-// | |  / (_)____/ /___  ______ _/ / ____/ /_  __(_)___/ /____
-// | | / / / ___/ __/ / / / __ `/ / /_  / / / / / / __  / ___/
-// | |/ / / /  / /_/ /_/ / /_/ / / __/ / / /_/ / / /_/ (__  )
-// |___/_/_/   \__/\__,_/\__,_/_/_/   /_/\__,_/_/\__,_/____/
-//
-#ifndef MATRIXWRAPPER_H
-#define MATRIXWRAPPER_H
-
-//extension by CAB
-#include <vector>
-#include <string>
-#include <fstream>
-
-#include <basics/utilities/UbException.h>
-
-#include <MarchingCubes/McTypes.h>
-
-//////////////////////////////////////////////////////////////////////////
-//Standard-Wrapper
-//   MarchingCubes<DataWrapper> mc( 10,8,5 );
-//   for(int z=0; z<mc.size_z(); z++)
-//    for(int y=0; y<mc.size_y(); y++)
-//      for(int x=0; x<mc.size_x(); x++)
-//        mc.set_data(x,x,y,z);
-//
-//   mc.init_all();
-//   mc.run(3.5);
-//   mc.writeUCD("c:/temp/triangles.inp");
-//   mc.clean_all();
-
-namespace McCubes{
-
-template< typename T=real >
-class MatrixWrapper
-{
-public:
-   typedef T                                                   value_type;
-   typedef typename std::vector< value_type >::reference       reference;
-   typedef typename std::vector< value_type >::const_reference const_reference;
-   typedef typename std::vector< value_type >::pointer         pointer;
-   typedef typename std::vector< value_type >::const_pointer   const_pointer;
-
-public:
-   MatrixWrapper() : nx1(-1), nx2(-1), nx3(-1)
-   {
-   }
-   /*==========================================================*/
-   MatrixWrapper(const int& nx1, const int& nx2, const int& nx3, const T& initVal=T())
-   {
-      this->resize(nx1,nx2,nx3,initVal);
-   }
-   /*=======================================================================*/
-   reference operator() (const int& x1, const int& x2, const int& x3)
-   {
-      #ifdef _DEBUG
-         return this->data.at(x1 + x2*nx1 + x3*nx1*nx2);
-      #else
-         return this->data[x1 + x2*nx1 + x3*nx1*nx2];
-      #endif
-   }
-   /*=======================================================================*/
-   const_reference operator() (const int& x1, const int& x2, const int& x3)	const
-   {
-      #ifdef _DEBUG
-         return this->data.at(x1 + x2*nx1 + x3*nx1*nx2);
-      #else
-         return this->data[x1 + x2*nx1 + x3*nx1*nx2];
-      #endif
-   }
-   /*==========================================================*/
-   inline void setData( const T& val, const int& x1, const int& x2, const int& x3 )
-   {
-      #ifdef _DEBUG
-         this->data.at(x1 + x2*nx1 + x3*nx1*nx2) = val;
-      #else
-         this->data[x1 + x2*nx1 + x3*nx1*nx2] = val;
-      #endif
-   }
-   /*==========================================================*/
-   inline value_type getData(const int& x1, const int& x2, const int& x3 ) const
-   {
-      #ifdef _DEBUG
-         return this->data.at(x1 + x2*nx1 + x3*nx1*nx2);
-      #else
-         return this->data[x1 + x2*nx1 + x3*nx1*nx2];
-      #endif
-   }
-   /*==========================================================*/
-   inline void resize(const int& nx1, const int& nx2, const int& nx3)
-   {
-      if(nx1>0 && nx2>0 && nx3>0)
-      {
-         this->nx1 = nx1;
-         this->nx2 = nx2;
-         this->nx3 = nx3;
-         this->data.resize(nx1*nx2*nx3);
-      }
-   }
-   /*==========================================================*/
-   inline void resize(const int& nx1, const int& nx2, const int& nx3, const T& initVal)
-   {
-      if(nx1>0 && nx2>0 && nx3>0)
-      {
-         this->nx1 = nx1;
-         this->nx2 = nx2;
-         this->nx3 = nx3;
-         this->data.resize(nx1*nx2*nx3,initVal);
-      }
-   }
-   /*==========================================================*/
-   inline int getMinX1() const { return 0;     }  
-   inline int getMinX2() const { return 0;     }  
-   inline int getMinX3() const { return 0;     }  
-
-   inline int getMaxX1() const { return nx1-1; }  
-   inline int getMaxX2() const { return nx2-1; }  
-   inline int getMaxX3() const { return nx3-1; }  
-
-   inline int getNX1()   const { return nx1;   }  
-   inline int getNX2()   const { return nx2;   }  
-   inline int getNX3()   const { return nx3;   }  
-
-protected:
-   std::vector<T> data;
-   int nx1, nx2, nx3;
-};
-
-} //namespace McCubes
-
-#endif //MATRIXWRAPPER_H
+//  _    ___      __              __________      _     __
+// | |  / (_)____/ /___  ______ _/ / ____/ /_  __(_)___/ /____
+// | | / / / ___/ __/ / / / __ `/ / /_  / / / / / / __  / ___/
+// | |/ / / /  / /_/ /_/ / /_/ / / __/ / / /_/ / / /_/ (__  )
+// |___/_/_/   \__/\__,_/\__,_/_/_/   /_/\__,_/_/\__,_/____/
+//
+#ifndef MATRIXWRAPPER_H
+#define MATRIXWRAPPER_H
+
+//extension by CAB
+#include <vector>
+#include <string>
+#include <fstream>
+
+#include <basics/utilities/UbException.h>
+
+#include <MarchingCubes/McTypes.h>
+
+//////////////////////////////////////////////////////////////////////////
+//Standard-Wrapper
+//   MarchingCubes<DataWrapper> mc( 10,8,5 );
+//   for(int z=0; z<mc.size_z(); z++)
+//    for(int y=0; y<mc.size_y(); y++)
+//      for(int x=0; x<mc.size_x(); x++)
+//        mc.set_data(x,x,y,z);
+//
+//   mc.init_all();
+//   mc.run(3.5);
+//   mc.writeUCD("c:/temp/triangles.inp");
+//   mc.clean_all();
+
+namespace McCubes{
+
+template< typename T=real >
+class MatrixWrapper
+{
+public:
+   typedef T                                                   value_type;
+   typedef typename std::vector< value_type >::reference       reference;
+   typedef typename std::vector< value_type >::const_reference const_reference;
+   typedef typename std::vector< value_type >::pointer         pointer;
+   typedef typename std::vector< value_type >::const_pointer   const_pointer;
+
+public:
+   MatrixWrapper() : nx1(-1), nx2(-1), nx3(-1)
+   {
+   }
+   /*==========================================================*/
+   MatrixWrapper(const int& nx1, const int& nx2, const int& nx3, const T& initVal=T())
+   {
+      this->resize(nx1,nx2,nx3,initVal);
+   }
+   /*=======================================================================*/
+   reference operator() (const int& x1, const int& x2, const int& x3)
+   {
+      #ifdef _DEBUG
+         return this->data.at(x1 + x2*nx1 + x3*nx1*nx2);
+      #else
+         return this->data[x1 + x2*nx1 + x3*nx1*nx2];
+      #endif
+   }
+   /*=======================================================================*/
+   const_reference operator() (const int& x1, const int& x2, const int& x3)	const
+   {
+      #ifdef _DEBUG
+         return this->data.at(x1 + x2*nx1 + x3*nx1*nx2);
+      #else
+         return this->data[x1 + x2*nx1 + x3*nx1*nx2];
+      #endif
+   }
+   /*==========================================================*/
+   inline void setData( const T& val, const int& x1, const int& x2, const int& x3 )
+   {
+      #ifdef _DEBUG
+         this->data.at(x1 + x2*nx1 + x3*nx1*nx2) = val;
+      #else
+         this->data[x1 + x2*nx1 + x3*nx1*nx2] = val;
+      #endif
+   }
+   /*==========================================================*/
+   inline value_type getData(const int& x1, const int& x2, const int& x3 ) const
+   {
+      #ifdef _DEBUG
+         return this->data.at(x1 + x2*nx1 + x3*nx1*nx2);
+      #else
+         return this->data[x1 + x2*nx1 + x3*nx1*nx2];
+      #endif
+   }
+   /*==========================================================*/
+   inline void resize(const int& nx1, const int& nx2, const int& nx3)
+   {
+      if(nx1>0 && nx2>0 && nx3>0)
+      {
+         this->nx1 = nx1;
+         this->nx2 = nx2;
+         this->nx3 = nx3;
+         this->data.resize(nx1*nx2*nx3);
+      }
+   }
+   /*==========================================================*/
+   inline void resize(const int& nx1, const int& nx2, const int& nx3, const T& initVal)
+   {
+      if(nx1>0 && nx2>0 && nx3>0)
+      {
+         this->nx1 = nx1;
+         this->nx2 = nx2;
+         this->nx3 = nx3;
+         this->data.resize(nx1*nx2*nx3,initVal);
+      }
+   }
+   /*==========================================================*/
+   inline int getMinX1() const { return 0;     }  
+   inline int getMinX2() const { return 0;     }  
+   inline int getMinX3() const { return 0;     }  
+
+   inline int getMaxX1() const { return nx1-1; }  
+   inline int getMaxX2() const { return nx2-1; }  
+   inline int getMaxX3() const { return nx3-1; }  
+
+   inline int getNX1()   const { return nx1;   }  
+   inline int getNX2()   const { return nx2;   }  
+   inline int getNX3()   const { return nx3;   }  
+
+protected:
+   std::vector<T> data;
+   int nx1, nx2, nx3;
+};
+
+} //namespace McCubes
+
+#endif //MATRIXWRAPPER_H
diff --git a/3rdParty/MarchingCubes/McLookUpTable.h b/3rdParty/MarchingCubes/McLookUpTable.h
index 9fed1e50175da325347559c5f137a2f5c66e1985..00983bb1b1147f56d3565201fab6a7909530219b 100644
--- a/3rdParty/MarchingCubes/McLookUpTable.h
+++ b/3rdParty/MarchingCubes/McLookUpTable.h
@@ -1,2320 +1,2320 @@
-/**
- * @file    LookUpTable.h
- * @author  Thomas Lewiner <thomas.lewiner@polytechnique.org>
- * @author  Math Dept, PUC-Rio
- * @version 0.2
- * @date    12/08/2002
- *
- * @brief   LookUpTable for the MarchingCubes 33 Algorithm
- */
-//________________________________________________
-
-
-
-#ifndef MCLOOKUPTABLE_H
-#define MCLOOKUPTABLE_H
-
-namespace McCubes{ 
-
-//_____________________________________________________________________________
-/**
- * \brief case mapping
- * For each of the possible vertex states listed in this table there is a
- * specific triangulation of the edge intersection points.  The table lists
- * all of them in the form of 0-5 edge triples with the list terminated by
- * the invalid value -1.  For example: case[3] list the 2 triangles
- * formed when cube[0] and cube[1] are inside of the surface, but the rest of
- * the cube is not.
- *
- * Cube description:
- *         7 ________ 6           _____6__             ________
- *         /|       /|         7/|       /|          /|       /|
- *       /  |     /  |        /  |     /5 |        /  6     /  |
- *   4 /_______ /    |      /__4____ /    10     /_______3/    |
- *    |     |  |5    |     |    11  |     |     |     |  |   2 |
- *    |    3|__|_____|2    |     |__|__2__|     | 4   |__|_____|
- *    |    /   |    /      8   3/   9    /      |    /   |    /
- *    |  /     |  /        |  /     |  /1       |  /     5  /
- *    |/_______|/          |/___0___|/          |/_1_____|/
- *   0          1        0          1
- */
-//-----------------------------------------------------------------------------
-static const char cases[256][2] = {
-/*   0:                          */  {  0, -1 },
-/*   1: 0,                       */  {  1,  0 },
-/*   2:    1,                    */  {  1,  1 },
-/*   3: 0, 1,                    */  {  2,  0 },
-/*   4:       2,                 */  {  1,  2 },
-/*   5: 0,    2,                 */  {  3,  0 },
-/*   6:    1, 2,                 */  {  2,  3 },
-/*   7: 0, 1, 2,                 */  {  5,  0 },
-/*   8:          3,              */  {  1,  3 },
-/*   9: 0,       3,              */  {  2,  1 },
-/*  10:    1,    3,              */  {  3,  3 },
-/*  11: 0, 1,    3,              */  {  5,  1 },
-/*  12:       2, 3,              */  {  2,  5 },
-/*  13: 0,    2, 3,              */  {  5,  4 },
-/*  14:    1, 2, 3,              */  {  5,  9 },
-/*  15: 0, 1, 2, 3,              */  {  8,  0 },
-/*  16:             4,           */  {  1,  4 },
-/*  17: 0,          4,           */  {  2,  2 },
-/*  18:    1,       4,           */  {  3,  4 },
-/*  19: 0, 1,       4,           */  {  5,  2 },
-/*  20:       2,    4,           */  {  4,  2 },
-/*  21: 0,    2,    4,           */  {  6,  2 },
-/*  22:    1, 2,    4,           */  {  6,  9 },
-/*  23: 0, 1, 2,    4,           */  { 11,  0 },
-/*  24:          3, 4,           */  {  3,  8 },
-/*  25: 0,       3, 4,           */  {  5,  5 },
-/*  26:    1,    3, 4,           */  {  7,  3 },
-/*  27: 0, 1,    3, 4,           */  {  9,  1 },
-/*  28:       2, 3, 4,           */  {  6, 16 },
-/*  29: 0,    2, 3, 4,           */  { 14,  3 },
-/*  30:    1, 2, 3, 4,           */  { 12, 12 },
-/*  31: 0, 1, 2, 3, 4,           */  {  5, 24 },
-/*  32:                5,        */  {  1,  5 },
-/*  33: 0,             5,        */  {  3,  1 },
-/*  34:    1,          5,        */  {  2,  4 },
-/*  35: 0, 1,          5,        */  {  5,  3 },
-/*  36:       2,       5,        */  {  3,  6 },
-/*  37: 0,    2,       5,        */  {  7,  0 },
-/*  38:    1, 2,       5,        */  {  5, 10 },
-/*  39: 0, 1, 2,       5,        */  {  9,  0 },
-/*  40:          3,    5,        */  {  4,  3 },
-/*  41: 0,       3,    5,        */  {  6,  4 },
-/*  42:    1,    3,    5,        */  {  6, 11 },
-/*  43: 0, 1,    3,    5,        */  { 14,  1 },
-/*  44:       2, 3,    5,        */  {  6, 17 },
-/*  45: 0,    2, 3,    5,        */  { 12,  4 },
-/*  46:    1, 2, 3,    5,        */  { 11,  6 },
-/*  47: 0, 1, 2, 3,    5,        */  {  5, 25 },
-/*  48:             4, 5,        */  {  2,  8 },
-/*  49: 0,          4, 5,        */  {  5,  7 },
-/*  50:    1,       4, 5,        */  {  5, 12 },
-/*  51: 0, 1,       4, 5,        */  {  8,  1 },
-/*  52:       2,    4, 5,        */  {  6, 18 },
-/*  53: 0,    2,    4, 5,        */  { 12,  5 },
-/*  54:    1, 2,    4, 5,        */  { 14,  7 },
-/*  55: 0, 1, 2,    4, 5,        */  {  5, 28 },
-/*  56:          3, 4, 5,        */  {  6, 21 },
-/*  57: 0,       3, 4, 5,        */  { 11,  4 },
-/*  58:    1,    3, 4, 5,        */  { 12, 15 },
-/*  59: 0, 1,    3, 4, 5,        */  {  5, 30 },
-/*  60:       2, 3, 4, 5,        */  { 10,  5 },
-/*  61: 0,    2, 3, 4, 5,        */  {  6, 32 },
-/*  62:    1, 2, 3, 4, 5,        */  {  6, 39 },
-/*  63: 0, 1, 2, 3, 4, 5,        */  {  2, 12 },
-/*  64:                   6,     */  {  1,  6 },
-/*  65: 0,                6,     */  {  4,  0 },
-/*  66:    1,             6,     */  {  3,  5 },
-/*  67: 0, 1,             6,     */  {  6,  0 },
-/*  68:       2,          6,     */  {  2,  6 },
-/*  69: 0,    2,          6,     */  {  6,  3 },
-/*  70:    1, 2,          6,     */  {  5, 11 },
-/*  71: 0, 1, 2,          6,     */  { 14,  0 },
-/*  72:          3,       6,     */  {  3,  9 },
-/*  73: 0,       3,       6,     */  {  6,  5 },
-/*  74:    1,    3,       6,     */  {  7,  4 },
-/*  75: 0, 1,    3,       6,     */  { 12,  1 },
-/*  76:       2, 3,       6,     */  {  5, 14 },
-/*  77: 0,    2, 3,       6,     */  { 11,  3 },
-/*  78:    1, 2, 3,       6,     */  {  9,  4 },
-/*  79: 0, 1, 2, 3,       6,     */  {  5, 26 },
-/*  80:             4,    6,     */  {  3, 10 },
-/*  81: 0,          4,    6,     */  {  6,  6 },
-/*  82:    1,       4,    6,     */  {  7,  5 },
-/*  83: 0, 1,       4,    6,     */  { 12,  2 },
-/*  84:       2,    4,    6,     */  {  6, 19 },
-/*  85: 0,    2,    4,    6,     */  { 10,  1 },
-/*  86:    1, 2,    4,    6,     */  { 12, 13 },
-/*  87: 0, 1, 2,    4,    6,     */  {  6, 24 },
-/*  88:          3, 4,    6,     */  {  7,  7 },
-/*  89: 0,       3, 4,    6,     */  { 12,  9 },
-/*  90:    1,    3, 4,    6,     */  { 13,  1 },
-/*  91: 0, 1,    3, 4,    6,     */  {  7,  9 },
-/*  92:       2, 3, 4,    6,     */  { 12, 20 },
-/*  93: 0,    2, 3, 4,    6,     */  {  6, 33 },
-/*  94:    1, 2, 3, 4,    6,     */  {  7, 13 },
-/*  95: 0, 1, 2, 3, 4,    6,     */  {  3, 12 },
-/*  96:                5, 6,     */  {  2, 10 },
-/*  97: 0,             5, 6,     */  {  6,  7 },
-/*  98:    1,          5, 6,     */  {  5, 13 },
-/*  99: 0, 1,          5, 6,     */  { 11,  2 },
-/* 100:       2,       5, 6,     */  {  5, 16 },
-/* 101: 0,    2,       5, 6,     */  { 12,  7 },
-/* 102:    1, 2,       5, 6,     */  {  8,  3 },
-/* 103: 0, 1, 2,       5, 6,     */  {  5, 29 },
-/* 104:          3,    5, 6,     */  {  6, 22 },
-/* 105: 0,       3,    5, 6,     */  { 10,  2 },
-/* 106:    1,    3,    5, 6,     */  { 12, 17 },
-/* 107: 0, 1,    3,    5, 6,     */  {  6, 27 },
-/* 108:       2, 3,    5, 6,     */  { 14,  9 },
-/* 109: 0,    2, 3,    5, 6,     */  {  6, 34 },
-/* 110:    1, 2, 3,    5, 6,     */  {  5, 39 },
-/* 111: 0, 1, 2, 3,    5, 6,     */  {  2, 14 },
-/* 112:             4, 5, 6,     */  {  5, 20 },
-/* 113: 0,          4, 5, 6,     */  { 14,  5 },
-/* 114:    1,       4, 5, 6,     */  {  9,  5 },
-/* 115: 0, 1,       4, 5, 6,     */  {  5, 32 },
-/* 116:       2,    4, 5, 6,     */  { 11, 10 },
-/* 117: 0,    2,    4, 5, 6,     */  {  6, 35 },
-/* 118:    1, 2,    4, 5, 6,     */  {  5, 41 },
-/* 119: 0, 1, 2,    4, 5, 6,     */  {  2, 16 },
-/* 120:          3, 4, 5, 6,     */  { 12, 23 },
-/* 121: 0,       3, 4, 5, 6,     */  {  6, 37 },
-/* 122:    1,    3, 4, 5, 6,     */  {  7, 14 },
-/* 123: 0, 1,    3, 4, 5, 6,     */  {  3, 16 },
-/* 124:       2, 3, 4, 5, 6,     */  {  6, 46 },
-/* 125: 0,    2, 3, 4, 5, 6,     */  {  4,  6 },
-/* 126:    1, 2, 3, 4, 5, 6,     */  {  3, 21 },
-/* 127: 0, 1, 2, 3, 4, 5, 6,     */  {  1,  8 },
-/* 128:                      7,  */  {  1,  7 },
-/* 129: 0,                   7,  */  {  3,  2 },
-/* 130:    1,                7,  */  {  4,  1 },
-/* 131: 0, 1,                7,  */  {  6,  1 },
-/* 132:       2,             7,  */  {  3,  7 },
-/* 133: 0,    2,             7,  */  {  7,  1 },
-/* 134:    1, 2,             7,  */  {  6, 10 },
-/* 135: 0, 1, 2,             7,  */  { 12,  0 },
-/* 136:          3,          7,  */  {  2,  7 },
-/* 137: 0,       3,          7,  */  {  5,  6 },
-/* 138:    1,    3,          7,  */  {  6, 12 },
-/* 139: 0, 1,    3,          7,  */  { 11,  1 },
-/* 140:       2, 3,          7,  */  {  5, 15 },
-/* 141: 0,    2, 3,          7,  */  {  9,  2 },
-/* 142:    1, 2, 3,          7,  */  { 14,  6 },
-/* 143: 0, 1, 2, 3,          7,  */  {  5, 27 },
-/* 144:             4,       7,  */  {  2,  9 },
-/* 145: 0,          4,       7,  */  {  5,  8 },
-/* 146:    1,       4,       7,  */  {  6, 13 },
-/* 147: 0, 1,       4,       7,  */  { 14,  2 },
-/* 148:       2,    4,       7,  */  {  6, 20 },
-/* 149: 0,    2,    4,       7,  */  { 12,  6 },
-/* 150:    1, 2,    4,       7,  */  { 10,  3 },
-/* 151: 0, 1, 2,    4,       7,  */  {  6, 25 },
-/* 152:          3, 4,       7,  */  {  5, 18 },
-/* 153: 0,       3, 4,       7,  */  {  8,  2 },
-/* 154:    1,    3, 4,       7,  */  { 12, 16 },
-/* 155: 0, 1,    3, 4,       7,  */  {  5, 31 },
-/* 156:       2, 3, 4,       7,  */  { 11,  9 },
-/* 157: 0,    2, 3, 4,       7,  */  {  5, 34 },
-/* 158:    1, 2, 3, 4,       7,  */  {  6, 40 },
-/* 159: 0, 1, 2, 3, 4,       7,  */  {  2, 13 },
-/* 160:                5,    7,  */  {  3, 11 },
-/* 161: 0,             5,    7,  */  {  7,  2 },
-/* 162:    1,          5,    7,  */  {  6, 14 },
-/* 163: 0, 1,          5,    7,  */  { 12,  3 },
-/* 164:       2,       5,    7,  */  {  7,  6 },
-/* 165: 0,    2,       5,    7,  */  { 13,  0 },
-/* 166:    1, 2,       5,    7,  */  { 12, 14 },
-/* 167: 0, 1, 2,       5,    7,  */  {  7,  8 },
-/* 168:          3,    5,    7,  */  {  6, 23 },
-/* 169: 0,       3,    5,    7,  */  { 12, 10 },
-/* 170:    1,    3,    5,    7,  */  { 10,  4 },
-/* 171: 0, 1,    3,    5,    7,  */  {  6, 28 },
-/* 172:       2, 3,    5,    7,  */  { 12, 21 },
-/* 173: 0,    2, 3,    5,    7,  */  {  7, 10 },
-/* 174:    1, 2, 3,    5,    7,  */  {  6, 41 },
-/* 175: 0, 1, 2, 3,    5,    7,  */  {  3, 13 },
-/* 176:             4, 5,    7,  */  {  5, 21 },
-/* 177: 0,          4, 5,    7,  */  {  9,  3 },
-/* 178:    1,       4, 5,    7,  */  { 11,  8 },
-/* 179: 0, 1,       4, 5,    7,  */  {  5, 33 },
-/* 180:       2,    4, 5,    7,  */  { 12, 22 },
-/* 181: 0,    2,    4, 5,    7,  */  {  7, 11 },
-/* 182:    1, 2,    4, 5,    7,  */  {  6, 42 },
-/* 183: 0, 1, 2,    4, 5,    7,  */  {  3, 14 },
-/* 184:          3, 4, 5,    7,  */  { 14, 11 },
-/* 185: 0,       3, 4, 5,    7,  */  {  5, 36 },
-/* 186:    1,    3, 4, 5,    7,  */  {  6, 44 },
-/* 187: 0, 1,    3, 4, 5,    7,  */  {  2, 17 },
-/* 188:       2, 3, 4, 5,    7,  */  {  6, 47 },
-/* 189: 0,    2, 3, 4, 5,    7,  */  {  3, 18 },
-/* 190:    1, 2, 3, 4, 5,    7,  */  {  4,  7 },
-/* 191: 0, 1, 2, 3, 4, 5,    7,  */  {  1,  9 },
-/* 192:                   6, 7,  */  {  2, 11 },
-/* 193: 0,                6, 7,  */  {  6,  8 },
-/* 194:    1,             6, 7,  */  {  6, 15 },
-/* 195: 0, 1,             6, 7,  */  { 10,  0 },
-/* 196:       2,          6, 7,  */  {  5, 17 },
-/* 197: 0,    2,          6, 7,  */  { 12,  8 },
-/* 198:    1, 2,          6, 7,  */  { 11,  7 },
-/* 199: 0, 1, 2,          6, 7,  */  {  6, 26 },
-/* 200:          3,       6, 7,  */  {  5, 19 },
-/* 201: 0,       3,       6, 7,  */  { 14,  4 },
-/* 202:    1,    3,       6, 7,  */  { 12, 18 },
-/* 203: 0, 1,    3,       6, 7,  */  {  6, 29 },
-/* 204:       2, 3,       6, 7,  */  {  8,  4 },
-/* 205: 0,    2, 3,       6, 7,  */  {  5, 35 },
-/* 206:    1, 2, 3,       6, 7,  */  {  5, 40 },
-/* 207: 0, 1, 2, 3,       6, 7,  */  {  2, 15 },
-/* 208:             4,    6, 7,  */  {  5, 22 },
-/* 209: 0,          4,    6, 7,  */  { 11,  5 },
-/* 210:    1,       4,    6, 7,  */  { 12, 19 },
-/* 211: 0, 1,       4,    6, 7,  */  {  6, 30 },
-/* 212:       2,    4,    6, 7,  */  { 14, 10 },
-/* 213: 0,    2,    4,    6, 7,  */  {  6, 36 },
-/* 214:    1, 2,    4,    6, 7,  */  {  6, 43 },
-/* 215: 0, 1, 2,    4,    6, 7,  */  {  4,  4 },
-/* 216:          3, 4,    6, 7,  */  {  9,  7 },
-/* 217: 0,       3, 4,    6, 7,  */  {  5, 37 },
-/* 218:    1,    3, 4,    6, 7,  */  {  7, 15 },
-/* 219: 0, 1,    3, 4,    6, 7,  */  {  3, 17 },
-/* 220:       2, 3, 4,    6, 7,  */  {  5, 44 },
-/* 221: 0,    2, 3, 4,    6, 7,  */  {  2, 19 },
-/* 222:    1, 2, 3, 4,    6, 7,  */  {  3, 22 },
-/* 223: 0, 1, 2, 3, 4,    6, 7,  */  {  1, 10 },
-/* 224:                5, 6, 7,  */  {  5, 23 },
-/* 225: 0,             5, 6, 7,  */  { 12, 11 },
-/* 226:    1,          5, 6, 7,  */  { 14,  8 },
-/* 227: 0, 1,          5, 6, 7,  */  {  6, 31 },
-/* 228:       2,       5, 6, 7,  */  {  9,  6 },
-/* 229: 0,    2,       5, 6, 7,  */  {  7, 12 },
-/* 230:    1, 2,       5, 6, 7,  */  {  5, 42 },
-/* 231: 0, 1, 2,       5, 6, 7,  */  {  3, 15 },
-/* 232:          3,    5, 6, 7,  */  { 11, 11 },
-/* 233: 0,       3,    5, 6, 7,  */  {  6, 38 },
-/* 234:    1,    3,    5, 6, 7,  */  {  6, 45 },
-/* 235: 0, 1,    3,    5, 6, 7,  */  {  4,  5 },
-/* 236:       2, 3,    5, 6, 7,  */  {  5, 45 },
-/* 237: 0,    2, 3,    5, 6, 7,  */  {  3, 19 },
-/* 238:    1, 2, 3,    5, 6, 7,  */  {  2, 21 },
-/* 239: 0, 1, 2, 3,    5, 6, 7,  */  {  1, 11 },
-/* 240:             4, 5, 6, 7,  */  {  8,  5 },
-/* 241: 0,          4, 5, 6, 7,  */  {  5, 38 },
-/* 242:    1,       4, 5, 6, 7,  */  {  5, 43 },
-/* 243: 0, 1,       4, 5, 6, 7,  */  {  2, 18 },
-/* 244:       2,    4, 5, 6, 7,  */  {  5, 46 },
-/* 245: 0,    2,    4, 5, 6, 7,  */  {  3, 20 },
-/* 246:    1, 2,    4, 5, 6, 7,  */  {  2, 22 },
-/* 247: 0, 1, 2,    4, 5, 6, 7,  */  {  1, 12 },
-/* 248:          3, 4, 5, 6, 7,  */  {  5, 47 },
-/* 249: 0,       3, 4, 5, 6, 7,  */  {  2, 20 },
-/* 250:    1,    3, 4, 5, 6, 7,  */  {  3, 23 },
-/* 251: 0, 1,    3, 4, 5, 6, 7,  */  {  1, 13 },
-/* 252:       2, 3, 4, 5, 6, 7,  */  {  2, 23 },
-/* 253: 0,    2, 3, 4, 5, 6, 7,  */  {  1, 14 },
-/* 254:    1, 2, 3, 4, 5, 6, 7,  */  {  1, 15 },
-/* 255: 0, 1, 2, 3, 4, 5, 6, 7,  */  {  0, -1 }
-};
-//_____________________________________________________________________________
-
-
-//_____________________________________________________________________________
-/**
- * \brief tiling table for case 1
- * For each of the case above, the specific triangulation of the edge
- * intersection points is given.
- * When a case is ambiguous, there is an auxiliary table that contains
- * the face number to test and the tiling table contains the specific
- * triangulations depending on the results
- * A minus sign means to invert the result of the test.
- */
-//-----------------------------------------------------------------------------
-static const char tiling1[16][3] = {
-/*   1: 0,                       */  {  0,  8,  3 },
-/*   2:    1,                    */  {  0,  1,  9 },
-/*   4:       2,                 */  {  1,  2, 10 },
-/*   8:          3,              */  {  3, 11,  2 },
-/*  16:             4,           */  {  4,  7,  8 },
-/*  32:                5,        */  {  9,  5,  4 },
-/*  64:                   6,     */  { 10,  6,  5 },
-/* 128:                      7,  */  {  7,  6, 11 },
-/* 127: 0, 1, 2, 3, 4, 5, 6,     */  {  7, 11,  6 },
-/* 191: 0, 1, 2, 3, 4, 5,    7,  */  { 10,  5,  6 },
-/* 223: 0, 1, 2, 3, 4,    6, 7,  */  {  9,  4,  5 },
-/* 239: 0, 1, 2, 3,    5, 6, 7,  */  {  4,  8,  7 },
-/* 247: 0, 1, 2,    4, 5, 6, 7,  */  {  3,  2, 11 },
-/* 251: 0, 1,    3, 4, 5, 6, 7,  */  {  1, 10,  2 },
-/* 253: 0,    2, 3, 4, 5, 6, 7,  */  {  0,  9,  1 },
-/* 254:    1, 2, 3, 4, 5, 6, 7,  */  {  0,  3,  8 }
-};
-//_____________________________________________________________________________
-
-
-//_____________________________________________________________________________
-/**
- * \brief tiling table for case 2
- * For each of the case above, the specific triangulation of the edge
- * intersection points is given.
- * When a case is ambiguous, there is an auxiliary table that contains
- * the face number to test and the tiling table contains the specific
- * triangulations depending on the results
- * A minus sign means to invert the result of the test.
- */
-//-----------------------------------------------------------------------------
-static const char tiling2[24][6] = {
-/*   3: 0, 1,                    */  {  1,  8,  3,  9,  8,  1 },
-/*   9: 0,       3,              */  {  0, 11,  2,  8, 11,  0 },
-/*  17: 0,          4,           */  {  4,  3,  0,  7,  3,  4 },
-/*   6:    1, 2,                 */  {  9,  2, 10,  0,  2,  9 },
-/*  34:    1,          5,        */  {  0,  5,  4,  1,  5,  0 },
-/*  12:       2, 3,              */  {  3, 10,  1, 11, 10,  3 },
-/*  68:       2,          6,     */  {  1,  6,  5,  2,  6,  1 },
-/* 136:          3,          7,  */  {  7,  2,  3,  6,  2,  7 },
-/*  48:             4, 5,        */  {  9,  7,  8,  5,  7,  9 },
-/* 144:             4,       7,  */  {  6,  8,  4, 11,  8,  6 },
-/*  96:                5, 6,     */  { 10,  4,  9,  6,  4, 10 },
-/* 192:                   6, 7,  */  { 11,  5, 10,  7,  5, 11 },
-/*  63: 0, 1, 2, 3, 4, 5,        */  { 11, 10,  5,  7, 11,  5 },
-/* 159: 0, 1, 2, 3, 4,       7,  */  { 10,  9,  4,  6, 10,  4 },
-/* 111: 0, 1, 2, 3,    5, 6,     */  {  6,  4,  8, 11,  6,  8 },
-/* 207: 0, 1, 2, 3,       6, 7,  */  {  9,  8,  7,  5,  9,  7 },
-/* 119: 0, 1, 2,    4, 5, 6,     */  {  7,  3,  2,  6,  7,  2 },
-/* 187: 0, 1,    3, 4, 5,    7,  */  {  1,  5,  6,  2,  1,  6 },
-/* 243: 0, 1,       4, 5, 6, 7,  */  {  3,  1, 10, 11,  3, 10 },
-/* 221: 0,    2, 3, 4,    6, 7,  */  {  0,  4,  5,  1,  0,  5 },
-/* 249: 0,       3, 4, 5, 6, 7,  */  {  9, 10,  2,  0,  9,  2 },
-/* 238:    1, 2, 3,    5, 6, 7,  */  {  4,  0,  3,  7,  4,  3 },
-/* 246:    1, 2,    4, 5, 6, 7,  */  {  0,  2, 11,  8,  0, 11 },
-/* 252:       2, 3, 4, 5, 6, 7,  */  {  1,  3,  8,  9,  1,  8 }
-};
-//_____________________________________________________________________________
-
-//_____________________________________________________________________________
-/**
- * \brief test table for case 3
- * One face to test
- * When the test on the specified face is positive : 4 first triangles
- * When the test on the specified face is negative : 2 last triangles
- *
- * For each of the case above, the specific triangulation of the edge
- * intersection points is given.
- * When a case is ambiguous, there is an auxiliary table that contains
- * the face number to test and the tiling table contains the specific
- * triangulations depending on the results
- * A minus sign means to invert the result of the test.
- */
-//-----------------------------------------------------------------------------
-static const char test3[24] = {
-/*   5: 0,    2,                 */    5,
-/*  33: 0,             5,        */    1,
-/* 129: 0,                   7,  */    4,
-/*  10:    1,    3,              */    5,
-/*  18:    1,       4,           */    1,
-/*  66:    1,             6,     */    2,
-/*  36:       2,       5,        */    2,
-/* 132:       2,             7,  */    3,
-/*  24:          3, 4,           */    4,
-/*  72:          3,       6,     */    3,
-/*  80:             4,    6,     */    6,
-/* 160:                5,    7,  */    6,
-/*  95: 0, 1, 2, 3, 4,    6,     */   -6,
-/* 175: 0, 1, 2, 3,    5,    7,  */   -6,
-/* 183: 0, 1, 2,    4, 5,    7,  */   -3,
-/* 231: 0, 1, 2,       5, 6, 7,  */   -4,
-/* 123: 0, 1,    3, 4, 5, 6,     */   -3,
-/* 219: 0, 1,    3, 4,    6, 7,  */   -2,
-/* 189: 0,    2, 3, 4, 5,    7,  */   -2,
-/* 237: 0,    2, 3,    5, 6, 7,  */   -1,
-/* 245: 0,    2,    4, 5, 6, 7,  */   -5,
-/* 126:    1, 2, 3, 4, 5, 6,     */   -4,
-/* 222:    1, 2, 3, 4,    6, 7,  */   -1,
-/* 250:    1,    3, 4, 5, 6, 7,  */   -5
-};
-
-//_____________________________________________________________________________
-/**
- * \brief tiling table for case 3.1
- * For each of the case above, the specific triangulation of the edge
- * intersection points is given.
- * When a case is ambiguous, there is an auxiliary table that contains
- * the face number to test and the tiling table contains the specific
- * triangulations depending on the results
- * A minus sign means to invert the result of the test.
- */
-//-----------------------------------------------------------------------------
-static const char tiling3_1[24][6] = {
-/*   5: 0,    2,                 */  {  0,  8,  3,  1,  2, 10 },
-/*  33: 0,             5,        */  {  9,  5,  4,  0,  8,  3 },
-/* 129: 0,                   7,  */  {  3,  0,  8, 11,  7,  6 },
-/*  10:    1,    3,              */  {  1,  9,  0,  2,  3, 11 },
-/*  18:    1,       4,           */  {  0,  1,  9,  8,  4,  7 },
-/*  66:    1,             6,     */  {  9,  0,  1,  5, 10,  6 },
-/*  36:       2,       5,        */  {  1,  2, 10,  9,  5,  4 },
-/* 132:       2,             7,  */  { 10,  1,  2,  6, 11,  7 },
-/*  24:          3, 4,           */  {  8,  4,  7,  3, 11,  2 },
-/*  72:          3,       6,     */  {  2,  3, 11, 10,  6,  5 },
-/*  80:             4,    6,     */  {  5, 10,  6,  4,  7,  8 },
-/* 160:                5,    7,  */  {  4,  9,  5,  7,  6, 11 },
-/*  95: 0, 1, 2, 3, 4,    6,     */  {  5,  9,  4, 11,  6,  7 },
-/* 175: 0, 1, 2, 3,    5,    7,  */  {  6, 10,  5,  8,  7,  4 },
-/* 183: 0, 1, 2,    4, 5,    7,  */  { 11,  3,  2,  5,  6, 10 },
-/* 231: 0, 1, 2,       5, 6, 7,  */  {  7,  4,  8,  2, 11,  3 },
-/* 123: 0, 1,    3, 4, 5, 6,     */  {  2,  1, 10,  7, 11,  6 },
-/* 219: 0, 1,    3, 4,    6, 7,  */  { 10,  2,  1,  4,  5,  9 },
-/* 189: 0,    2, 3, 4, 5,    7,  */  {  1,  0,  9,  6, 10,  5 },
-/* 237: 0,    2, 3,    5, 6, 7,  */  {  9,  1,  0,  7,  4,  8 },
-/* 245: 0,    2,    4, 5, 6, 7,  */  {  0,  9,  1, 11,  3,  2 },
-/* 126:    1, 2, 3, 4, 5, 6,     */  {  8,  0,  3,  6,  7, 11 },
-/* 222:    1, 2, 3, 4,    6, 7,  */  {  4,  5,  9,  3,  8,  0 },
-/* 250:    1,    3, 4, 5, 6, 7,  */  {  3,  8,  0, 10,  2,  1 }
-};
-
-//_____________________________________________________________________________
-/**
- * \brief tiling table for case 3.2
- * For each of the case above, the specific triangulation of the edge
- * intersection points is given.
- * When a case is ambiguous, there is an auxiliary table that contains
- * the face number to test and the tiling table contains the specific
- * triangulations depending on the results
- * A minus sign means to invert the result of the test.
- */
-//-----------------------------------------------------------------------------
-static const char tiling3_2[24][12] = {
-/*   5: 0,    2,                 */  { 10,  3,  2, 10,  8,  3, 10,  1,  0,  8, 10,  0 },
-/*  33: 0,             5,        */  {  3,  4,  8,  3,  5,  4,  3,  0,  9,  5,  3,  9 },
-/* 129: 0,                   7,  */  {  6,  8,  7,  6,  0,  8,  6, 11,  3,  0,  6,  3 },
-/*  10:    1,    3,              */  { 11,  0,  3, 11,  9,  0, 11,  2,  1,  9, 11,  1 },
-/*  18:    1,       4,           */  {  7,  9,  4,  7,  1,  9,  7,  8,  0,  1,  7,  0 },
-/*  66:    1,             6,     */  {  6,  1, 10,  6,  0,  1,  9,  0,  6,  9,  6,  5 },
-/*  36:       2,       5,        */  {  4, 10,  5,  4,  2, 10,  4,  9,  1,  2,  4,  1 },
-/* 132:       2,             7,  */  {  7,  2, 11,  7,  1,  2,  7,  6, 10,  1,  7, 10 },
-/*  24:          3, 4,           */  {  2,  7, 11,  2,  4,  7,  2,  3,  8,  4,  2,  8 },
-/*  72:          3,       6,     */  {  5, 11,  6,  5,  3, 11,  5, 10,  2,  3,  5,  2 },
-/*  80:             4,    6,     */  {  8,  6,  7,  8, 10,  6,  8,  4,  5, 10,  8,  5 },
-/* 160:                5,    7,  */  { 11,  5,  6, 11,  9,  5, 11,  7,  4,  9, 11,  4 },
-/*  95: 0, 1, 2, 3, 4,    6,     */  {  6,  5, 11,  5,  9, 11,  4,  7, 11,  4, 11,  9 },
-/* 175: 0, 1, 2, 3,    5,    7,  */  {  7,  6,  8,  6, 10,  8,  5,  4,  8,  5,  8, 10 },
-/* 183: 0, 1, 2,    4, 5,    7,  */  {  6, 11,  5, 11,  3,  5,  2, 10,  5,  2,  5,  3 },
-/* 231: 0, 1, 2,       5, 6, 7,  */  { 11,  7,  2,  7,  4,  2,  8,  3,  2,  8,  2,  4 },
-/* 123: 0, 1,    3, 4, 5, 6,     */  { 11,  2,  7,  2,  1,  7, 10,  6,  7, 10,  7,  1 },
-/* 219: 0, 1,    3, 4,    6, 7,  */  {  5, 10,  4, 10,  2,  4,  1,  9,  4,  1,  4,  2 },
-/* 189: 0,    2, 3, 4, 5,    7,  */  { 10,  1,  6,  1,  0,  6,  6,  0,  9,  5,  6,  9 },
-/* 237: 0,    2, 3,    5, 6, 7,  */  {  4,  9,  7,  9,  1,  7,  0,  8,  7,  0,  7,  1 },
-/* 245: 0,    2,    4, 5, 6, 7,  */  {  3,  0, 11,  0,  9, 11,  1,  2, 11,  1, 11,  9 },
-/* 126:    1, 2, 3, 4, 5, 6,     */  {  7,  8,  6,  8,  0,  6,  3, 11,  6,  3,  6,  0 },
-/* 222:    1, 2, 3, 4,    6, 7,  */  {  8,  4,  3,  4,  5,  3,  9,  0,  3,  9,  3,  5 },
-/* 250:    1,    3, 4, 5, 6, 7,  */  {  2,  3, 10,  3,  8, 10,  0,  1, 10,  0, 10,  8 }
-};
-//_____________________________________________________________________________
-
-
-
-//_____________________________________________________________________________
-/**
- * \brief test table for case 4
- * Interior to test
- * When the test on the interior is negative : 2 first triangles
- * When the test on the interior is positive : 6 last triangles
- *
- * For each of the case above, the specific triangulation of the edge
- * intersection points is given.
- * When a case is ambiguous, there is an auxiliary table that contains
- * the face number to test and the tiling table contains the specific
- * triangulations depending on the results
- * A minus sign means to invert the result of the test.
- */
-//-----------------------------------------------------------------------------
-static const char test4[8] = {
-/*  65: 0,                6,     */   7,
-/* 130:    1,                7,  */   7,
-/*  20:       2,    4,           */   7,
-/*  40:          3,    5,        */   7,
-/* 215: 0, 1, 2,    4,    6, 7,  */  -7,
-/* 235: 0, 1,    3,    5, 6, 7,  */  -7,
-/* 125: 0,    2, 3, 4, 5, 6,     */  -7,
-/* 190:    1, 2, 3, 4, 5,    7,  */  -7
-};
-
-//_____________________________________________________________________________
-/**
- * \brief tiling table for case 4.1
- * For each of the case above, the specific triangulation of the edge
- * intersection points is given.
- * When a case is ambiguous, there is an auxiliary table that contains
- * the face number to test and the tiling table contains the specific
- * triangulations depending on the results
- * A minus sign means to invert the result of the test.
- */
-//-----------------------------------------------------------------------------
-static const char tiling4_1[8][6] = {
-/*  65: 0,                6,     */  {  0,  8,  3,  5, 10,  6 },
-/* 130:    1,                7,  */  {  0,  1,  9, 11,  7,  6 },
-/*  20:       2,    4,           */  {  1,  2, 10,  8,  4,  7 },
-/*  40:          3,    5,        */  {  9,  5,  4,  2,  3, 11 },
-/* 215: 0, 1, 2,    4,    6, 7,  */  {  4,  5,  9, 11,  3,  2 },
-/* 235: 0, 1,    3,    5, 6, 7,  */  { 10,  2,  1,  7,  4,  8 },
-/* 125: 0,    2, 3, 4, 5, 6,     */  {  9,  1,  0,  6,  7, 11 },
-/* 190:    1, 2, 3, 4, 5,    7,  */  {  3,  8,  0,  6, 10,  5 }
-};
-
-//_____________________________________________________________________________
-/**
- * \brief tiling table for case 4.2
- * For each of the case above, the specific triangulation of the edge
- * intersection points is given.
- * When a case is ambiguous, there is an auxiliary table that contains
- * the face number to test and the tiling table contains the specific
- * triangulations depending on the results
- * A minus sign means to invert the result of the test.
- */
-//-----------------------------------------------------------------------------
-static const char tiling4_2[8][18] = {
-/*  65: 0,                6,     */  {  8,  5,  0,  5,  8,  6,  3,  6,  8,  6,  3, 10,  0, 10,  3, 10,  0,  5 },
-/* 130:    1,                7,  */  {  9,  6,  1,  6,  9,  7,  0,  7,  9,  7,  0, 11,  1, 11,  0, 11,  1,  6 },
-/*  20:       2,    4,           */  { 10,  7,  2,  7, 10,  4,  1,  4, 10,  4,  1,  8,  2,  8,  1,  8,  2,  7 },
-/*  40:          3,    5,        */  { 11,  4,  3,  4, 11,  5,  2,  5, 11,  5,  2,  9,  3,  9,  2,  9,  3,  4 },
-/* 215: 0, 1, 2,    4,    6, 7,  */  {  3,  4, 11,  5, 11,  4, 11,  5,  2,  9,  2,  5,  2,  9,  3,  4,  3,  9 },
-/* 235: 0, 1,    3,    5, 6, 7,  */  {  2,  7, 10,  4, 10,  7, 10,  4,  1,  8,  1,  4,  1,  8,  2,  7,  2,  8 },
-/* 125: 0,    2, 3, 4, 5, 6,     */  {  1,  6,  9,  7,  9,  6,  9,  7,  0, 11,  0,  7,  0, 11,  1,  6,  1, 11 },
-/* 190:    1, 2, 3, 4, 5,    7,  */  {  0,  5,  8,  6,  8,  5,  8,  6,  3, 10,  3,  6,  3, 10,  0,  5,  0, 10 }
-};
-//_____________________________________________________________________________
-
-
-//_____________________________________________________________________________
-/**
- * \brief tiling table for case 5
- * For each of the case above, the specific triangulation of the edge
- * intersection points is given.
- * When a case is ambiguous, there is an auxiliary table that contains
- * the face number to test and the tiling table contains the specific
- * triangulations depending on the results
- * A minus sign means to invert the result of the test.
- */
-//-----------------------------------------------------------------------------
-static const char tiling5[48][9] = {
-/*   7: 0, 1, 2,                 */  {  2,  8,  3,  2, 10,  8, 10,  9,  8 },
-/*  11: 0, 1,    3,              */  {  1, 11,  2,  1,  9, 11,  9,  8, 11 },
-/*  19: 0, 1,       4,           */  {  4,  1,  9,  4,  7,  1,  7,  3,  1 },
-/*  35: 0, 1,          5,        */  {  8,  5,  4,  8,  3,  5,  3,  1,  5 },
-/*  13: 0,    2, 3,              */  {  0, 10,  1,  0,  8, 10,  8, 11, 10 },
-/*  25: 0,       3, 4,           */  { 11,  4,  7, 11,  2,  4,  2,  0,  4 },
-/* 137: 0,       3,          7,  */  {  7,  0,  8,  7,  6,  0,  6,  2,  0 },
-/*  49: 0,          4, 5,        */  {  9,  3,  0,  9,  5,  3,  5,  7,  3 },
-/* 145: 0,          4,       7,  */  {  3,  6, 11,  3,  0,  6,  0,  4,  6 },
-/*  14:    1, 2, 3,              */  {  3,  9,  0,  3, 11,  9, 11, 10,  9 },
-/*  38:    1, 2,       5,        */  {  5,  2, 10,  5,  4,  2,  4,  0,  2 },
-/*  70:    1, 2,          6,     */  {  9,  6,  5,  9,  0,  6,  0,  2,  6 },
-/*  50:    1,       4, 5,        */  {  0,  7,  8,  0,  1,  7,  1,  5,  7 },
-/*  98:    1,          5, 6,     */  { 10,  0,  1, 10,  6,  0,  6,  4,  0 },
-/*  76:       2, 3,       6,     */  {  6,  3, 11,  6,  5,  3,  5,  1,  3 },
-/* 140:       2, 3,          7,  */  { 10,  7,  6, 10,  1,  7,  1,  3,  7 },
-/* 100:       2,       5, 6,     */  {  1,  4,  9,  1,  2,  4,  2,  6,  4 },
-/* 196:       2,          6, 7,  */  { 11,  1,  2, 11,  7,  1,  7,  5,  1 },
-/* 152:          3, 4,       7,  */  {  8,  2,  3,  8,  4,  2,  4,  6,  2 },
-/* 200:          3,       6, 7,  */  {  2,  5, 10,  2,  3,  5,  3,  7,  5 },
-/* 112:             4, 5, 6,     */  {  7, 10,  6,  7,  8, 10,  8,  9, 10 },
-/* 176:             4, 5,    7,  */  {  6,  9,  5,  6, 11,  9, 11,  8,  9 },
-/* 208:             4,    6, 7,  */  {  5,  8,  4,  5, 10,  8, 10, 11,  8 },
-/* 224:                5, 6, 7,  */  {  4, 11,  7,  4,  9, 11,  9, 10, 11 },
-/*  31: 0, 1, 2, 3, 4,           */  {  4,  7, 11,  4, 11,  9,  9, 11, 10 },
-/*  47: 0, 1, 2, 3,    5,        */  {  5,  4,  8,  5,  8, 10, 10,  8, 11 },
-/*  79: 0, 1, 2, 3,       6,     */  {  6,  5,  9,  6,  9, 11, 11,  9,  8 },
-/* 143: 0, 1, 2, 3,          7,  */  {  7,  6, 10,  7, 10,  8,  8, 10,  9 },
-/*  55: 0, 1, 2,    4, 5,        */  {  2, 10,  5,  2,  5,  3,  3,  5,  7 },
-/* 103: 0, 1, 2,       5, 6,     */  {  8,  3,  2,  8,  2,  4,  4,  2,  6 },
-/*  59: 0, 1,    3, 4, 5,        */  { 11,  2,  1, 11,  1,  7,  7,  1,  5 },
-/* 155: 0, 1,    3, 4,       7,  */  {  1,  9,  4,  1,  4,  2,  2,  4,  6 },
-/* 115: 0, 1,       4, 5, 6,     */  { 10,  6,  7, 10,  7,  1,  1,  7,  3 },
-/* 179: 0, 1,       4, 5,    7,  */  {  6, 11,  3,  6,  3,  5,  5,  3,  1 },
-/* 157: 0,    2, 3, 4,       7,  */  { 10,  1,  0, 10,  0,  6,  6,  0,  4 },
-/* 205: 0,    2, 3,       6, 7,  */  {  0,  8,  7,  0,  7,  1,  1,  7,  5 },
-/* 185: 0,       3, 4, 5,    7,  */  {  9,  5,  6,  9,  6,  0,  0,  6,  2 },
-/* 217: 0,       3, 4,    6, 7,  */  {  5, 10,  2,  5,  2,  4,  4,  2,  0 },
-/* 241: 0,          4, 5, 6, 7,  */  {  3,  0,  9,  3,  9, 11, 11,  9, 10 },
-/* 110:    1, 2, 3,    5, 6,     */  {  3, 11,  6,  3,  6,  0,  0,  6,  4 },
-/* 206:    1, 2, 3,       6, 7,  */  {  9,  0,  3,  9,  3,  5,  5,  3,  7 },
-/* 118:    1, 2,    4, 5, 6,     */  {  7,  8,  0,  7,  0,  6,  6,  0,  2 },
-/* 230:    1, 2,       5, 6, 7,  */  { 11,  7,  4, 11,  4,  2,  2,  4,  0 },
-/* 242:    1,       4, 5, 6, 7,  */  {  0,  1, 10,  0, 10,  8,  8, 10, 11 },
-/* 220:       2, 3, 4,    6, 7,  */  {  8,  4,  5,  8,  5,  3,  3,  5,  1 },
-/* 236:       2, 3,    5, 6, 7,  */  {  4,  9,  1,  4,  1,  7,  7,  1,  3 },
-/* 244:       2,    4, 5, 6, 7,  */  {  1,  2, 11,  1, 11,  9,  9, 11,  8 },
-/* 248:          3, 4, 5, 6, 7,  */  {  2,  3,  8,  2,  8, 10, 10,  8,  9 }
-};
-//_____________________________________________________________________________
-
-
-//_____________________________________________________________________________
-/**
- * \brief test table for case 6
- * 1 face to test + eventually the interior
- * When the test on the specified face is positive : 5 first triangles
- * When the test on the specified face is negative :
- * - if the test on the interior is negative : 3 middle triangles
- * - if the test on the interior is positive : 8 last triangles
- * The support edge for the interior test is marked as the 3rd column.
- *
- * For each of the case above, the specific triangulation of the edge
- * intersection points is given.
- * When a case is ambiguous, there is an auxiliary table that contains
- * the face number to test and the tiling table contains the specific
- * triangulations depending on the results
- * A minus sign means to invert the result of the test.
- */
-//-----------------------------------------------------------------------------
-static const char test6[48][3] = {
-/*  67: 0, 1,             6,     */  {  2,  7,  10  },
-/* 131: 0, 1,                7,  */  {  4,  7,  11  },
-/*  21: 0,    2,    4,           */  {  5,  7,   1  },
-/*  69: 0,    2,          6,     */  {  5,  7,   3  },
-/*  41: 0,       3,    5,        */  {  1,  7,   9  },
-/*  73: 0,       3,       6,     */  {  3,  7,  10  },
-/*  81: 0,          4,    6,     */  {  6,  7,   5  },
-/*  97: 0,             5, 6,     */  {  1,  7,   8  },
-/* 193: 0,                6, 7,  */  {  4,  7,   8  },
-/*  22:    1, 2,    4,           */  {  1,  7,   8  },
-/* 134:    1, 2,             7,  */  {  3,  7,  11  },
-/*  42:    1,    3,    5,        */  {  5,  7,   2  },
-/* 138:    1,    3,          7,  */  {  5,  7,   0  },
-/* 146:    1,       4,       7,  */  {  1,  7,   9  },
-/* 162:    1,          5,    7,  */  {  6,  7,   6  },
-/* 194:    1,             6, 7,  */  {  2,  7,   9  },
-/*  28:       2, 3, 4,           */  {  4,  7,   8  },
-/*  44:       2, 3,    5,        */  {  2,  7,   9  },
-/*  52:       2,    4, 5,        */  {  2,  7,  10  },
-/*  84:       2,    4,    6,     */  {  6,  7,   7  },
-/* 148:       2,    4,       7,  */  {  3,  7,  10  },
-/*  56:          3, 4, 5,        */  {  4,  7,  11  },
-/* 104:          3,    5, 6,     */  {  3,  7,  11  },
-/* 168:          3,    5,    7,  */  {  6,  7,   4  },
-/*  87: 0, 1, 2,    4,    6,     */  { -6, -7,   4  },
-/* 151: 0, 1, 2,    4,       7,  */  { -3, -7,  11  },
-/* 199: 0, 1, 2,          6, 7,  */  { -4, -7,  11  },
-/* 107: 0, 1,    3,    5, 6,     */  { -3, -7,  10  },
-/* 171: 0, 1,    3,    5,    7,  */  { -6, -7,   7  },
-/* 203: 0, 1,    3,       6, 7,  */  { -2, -7,  10  },
-/* 211: 0, 1,       4,    6, 7,  */  { -2, -7,   9  },
-/* 227: 0, 1,          5, 6, 7,  */  { -4, -7,   8  },
-/*  61: 0,    2, 3, 4, 5,        */  { -2, -7,   9  },
-/*  93: 0,    2, 3, 4,    6,     */  { -6, -7,   6  },
-/* 109: 0,    2, 3,    5, 6,     */  { -1, -7,   9  },
-/* 117: 0,    2,    4, 5, 6,     */  { -5, -7,   0  },
-/* 213: 0,    2,    4,    6, 7,  */  { -5, -7,   2  },
-/* 121: 0,       3, 4, 5, 6,     */  { -3, -7,  11  },
-/* 233: 0,       3,    5, 6, 7,  */  { -1, -7,   8  },
-/*  62:    1, 2, 3, 4, 5,        */  { -4, -7,   8  },
-/* 158:    1, 2, 3, 4,       7,  */  { -1, -7,   8  },
-/* 174:    1, 2, 3,    5,    7,  */  { -6, -7,   5  },
-/* 182:    1, 2,    4, 5,    7,  */  { -3, -7,  10  },
-/* 214:    1, 2,    4,    6, 7,  */  { -1, -7,   9  },
-/* 186:    1,    3, 4, 5,    7,  */  { -5, -7,   3  },
-/* 234:    1,    3,    5, 6, 7,  */  { -5, -7,   1  },
-/* 124:       2, 3, 4, 5, 6,     */  { -4, -7,  11  },
-/* 188:       2, 3, 4, 5,    7,  */  { -2, -7,  10  }
-};
-
-//_____________________________________________________________________________
-/**
- * \brief tiling table for case 6.1.1
- * For each of the case above, the specific triangulation of the edge
- * intersection points is given.
- * When a case is ambiguous, there is an auxiliary table that contains
- * the face number to test and the tiling table contains the specific
- * triangulations depending on the results
- * A minus sign means to invert the result of the test.
- */
-//-----------------------------------------------------------------------------
-static const char tiling6_1_1[48][9] = {
-/*  67: 0, 1,             6,     */  {  6,  5, 10,  3,  1,  8,  9,  8,  1 },
-/* 131: 0, 1,                7,  */  { 11,  7,  6,  9,  3,  1,  3,  9,  8 },
-/*  21: 0,    2,    4,           */  {  1,  2, 10,  7,  0,  4,  0,  7,  3 },
-/*  69: 0,    2,          6,     */  {  3,  0,  8,  5,  2,  6,  2,  5,  1 },
-/*  41: 0,       3,    5,        */  {  5,  4,  9,  2,  0, 11,  8, 11,  0 },
-/*  73: 0,       3,       6,     */  { 10,  6,  5,  8,  2,  0,  2,  8, 11 },
-/*  81: 0,          4,    6,     */  { 10,  6,  5,  0,  4,  3,  7,  3,  4 },
-/*  97: 0,             5, 6,     */  {  3,  0,  8,  6,  4, 10,  9, 10,  4 },
-/* 193: 0,                6, 7,  */  {  8,  3,  0, 10,  7,  5,  7, 10, 11 },
-/*  22:    1, 2,    4,           */  {  8,  4,  7, 10,  0,  2,  0, 10,  9 },
-/* 134:    1, 2,             7,  */  {  7,  6, 11,  0,  2,  9, 10,  9,  2 },
-/*  42:    1,    3,    5,        */  {  2,  3, 11,  4,  1,  5,  1,  4,  0 },
-/* 138:    1,    3,          7,  */  {  0,  1,  9,  6,  3,  7,  3,  6,  2 },
-/* 146:    1,       4,       7,  */  {  9,  0,  1, 11,  4,  6,  4, 11,  8 },
-/* 162:    1,          5,    7,  */  { 11,  7,  6,  1,  5,  0,  4,  0,  5 },
-/* 194:    1,             6, 7,  */  {  0,  1,  9,  7,  5, 11, 10, 11,  5 },
-/*  28:       2, 3, 4,           */  {  4,  7,  8,  1,  3, 10, 11, 10,  3 },
-/*  44:       2, 3,    5,        */  {  9,  5,  4, 11,  1,  3,  1, 11, 10 },
-/*  52:       2,    4, 5,        */  { 10,  1,  2,  8,  5,  7,  5,  8,  9 },
-/*  84:       2,    4,    6,     */  {  8,  4,  7,  2,  6,  1,  5,  1,  6 },
-/* 148:       2,    4,       7,  */  {  1,  2, 10,  4,  6,  8, 11,  8,  6 },
-/*  56:          3, 4, 5,        */  {  2,  3, 11,  5,  7,  9,  8,  9,  7 },
-/* 104:          3,    5, 6,     */  { 11,  2,  3,  9,  6,  4,  6,  9, 10 },
-/* 168:          3,    5,    7,  */  {  9,  5,  4,  3,  7,  2,  6,  2,  7 },
-/*  87: 0, 1, 2,    4,    6,     */  {  4,  5,  9,  2,  7,  3,  7,  2,  6 },
-/* 151: 0, 1, 2,    4,       7,  */  {  3,  2, 11,  4,  6,  9, 10,  9,  6 },
-/* 199: 0, 1, 2,          6, 7,  */  { 11,  3,  2,  9,  7,  5,  7,  9,  8 },
-/* 107: 0, 1,    3,    5, 6,     */  { 10,  2,  1,  8,  6,  4,  6,  8, 11 },
-/* 171: 0, 1,    3,    5,    7,  */  {  7,  4,  8,  1,  6,  2,  6,  1,  5 },
-/* 203: 0, 1,    3,       6, 7,  */  {  2,  1, 10,  7,  5,  8,  9,  8,  5 },
-/* 211: 0, 1,       4,    6, 7,  */  {  4,  5,  9,  3,  1, 11, 10, 11,  1 },
-/* 227: 0, 1,          5, 6, 7,  */  {  8,  7,  4, 10,  3,  1,  3, 10, 11 },
-/*  61: 0,    2, 3, 4, 5,        */  {  9,  1,  0, 11,  5,  7,  5, 11, 10 },
-/*  93: 0,    2, 3, 4,    6,     */  {  6,  7, 11,  0,  5,  1,  5,  0,  4 },
-/* 109: 0,    2, 3,    5, 6,     */  {  1,  0,  9,  6,  4, 11,  8, 11,  4 },
-/* 117: 0,    2,    4, 5, 6,     */  {  9,  1,  0,  7,  3,  6,  2,  6,  3 },
-/* 213: 0,    2,    4,    6, 7,  */  { 11,  3,  2,  5,  1,  4,  0,  4,  1 },
-/* 121: 0,       3, 4, 5, 6,     */  { 11,  6,  7,  9,  2,  0,  2,  9, 10 },
-/* 233: 0,       3,    5, 6, 7,  */  {  7,  4,  8,  2,  0, 10,  9, 10,  0 },
-/*  62:    1, 2, 3, 4, 5,        */  {  0,  3,  8,  5,  7, 10, 11, 10,  7 },
-/* 158:    1, 2, 3, 4,       7,  */  {  8,  0,  3, 10,  4,  6,  4, 10,  9 },
-/* 174:    1, 2, 3,    5,    7,  */  {  5,  6, 10,  3,  4,  0,  4,  3,  7 },
-/* 182:    1, 2,    4, 5,    7,  */  {  5,  6, 10,  0,  2,  8, 11,  8,  2 },
-/* 214:    1, 2,    4,    6, 7,  */  {  9,  4,  5, 11,  0,  2,  0, 11,  8 },
-/* 186:    1,    3, 4, 5,    7,  */  {  8,  0,  3,  6,  2,  5,  1,  5,  2 },
-/* 234:    1,    3,    5, 6, 7,  */  { 10,  2,  1,  4,  0,  7,  3,  7,  0 },
-/* 124:       2, 3, 4, 5, 6,     */  {  6,  7, 11,  1,  3,  9,  8,  9,  3 },
-/* 188:       2, 3, 4, 5,    7,  */  { 10,  5,  6,  8,  1,  3,  1,  8,  9 }
-};
-
-//_____________________________________________________________________________
-/**
- * \brief tiling table for case 6.1.2
- * For each of the case above, the specific triangulation of the edge
- * intersection points is given.
- * When a case is ambiguous, there is an auxiliary table that contains
- * the face number to test and the tiling table contains the specific
- * triangulations depending on the results
- * A minus sign means to invert the result of the test.
- */
-//-----------------------------------------------------------------------------
-static const char tiling6_1_2[48][21] = {
-/*  67: 0, 1,             6,     */  {  1, 10,  3,  6,  3, 10,  3,  6,  8,  5,  8,  6,  8,  5,  9,  1,  9,  5, 10,  1,  5 },
-/* 131: 0, 1,                7,  */  {  1, 11,  3, 11,  1,  6,  9,  6,  1,  6,  9,  7,  8,  7,  9,  7,  8,  3,  7,  3, 11 },
-/*  21: 0,    2,    4,           */  {  4,  1,  0,  1,  4, 10,  7, 10,  4, 10,  7,  2,  3,  2,  7,  2,  3,  0,  2,  0,  1 },
-/*  69: 0,    2,          6,     */  {  6,  3,  2,  3,  6,  8,  5,  8,  6,  8,  5,  0,  1,  0,  5,  0,  1,  2,  0,  2,  3 },
-/*  41: 0,       3,    5,        */  {  0,  9,  2,  5,  2,  9,  2,  5, 11,  4, 11,  5, 11,  4,  8,  0,  8,  4,  9,  0,  4 },
-/*  73: 0,       3,       6,     */  {  0, 10,  2, 10,  0,  5,  8,  5,  0,  5,  8,  6, 11,  6,  8,  6, 11,  2,  6,  2, 10 },
-/*  81: 0,          4,    6,     */  {  4,  5,  0, 10,  0,  5,  0, 10,  3,  6,  3, 10,  3,  6,  7,  4,  7,  6,  5,  4,  6 },
-/*  97: 0,             5, 6,     */  {  4,  8,  6,  3,  6,  8,  6,  3, 10,  0, 10,  3, 10,  0,  9,  4,  9,  0,  8,  4,  0 },
-/* 193: 0,                6, 7,  */  {  5,  8,  7,  8,  5,  0, 10,  0,  5,  0, 10,  3, 11,  3, 10,  3, 11,  7,  3,  7,  8 },
-/*  22:    1, 2,    4,           */  {  2,  8,  0,  8,  2,  7, 10,  7,  2,  7, 10,  4,  9,  4, 10,  4,  9,  0,  4,  0,  8 },
-/* 134:    1, 2,             7,  */  {  2, 11,  0,  7,  0, 11,  0,  7,  9,  6,  9,  7,  9,  6, 10,  2, 10,  6, 11,  2,  6 },
-/*  42:    1,    3,    5,        */  {  5,  2,  1,  2,  5, 11,  4, 11,  5, 11,  4,  3,  0,  3,  4,  3,  0,  1,  3,  1,  2 },
-/* 138:    1,    3,          7,  */  {  7,  0,  3,  0,  7,  9,  6,  9,  7,  9,  6,  1,  2,  1,  6,  1,  2,  3,  1,  3,  0 },
-/* 146:    1,       4,       7,  */  {  6,  9,  4,  9,  6,  1, 11,  1,  6,  1, 11,  0,  8,  0, 11,  0,  8,  4,  0,  4,  9 },
-/* 162:    1,          5,    7,  */  {  5,  6,  1, 11,  1,  6,  1, 11,  0,  7,  0, 11,  0,  7,  4,  5,  4,  7,  6,  5,  7 },
-/* 194:    1,             6, 7,  */  {  5,  9,  7,  0,  7,  9,  7,  0, 11,  1, 11,  0, 11,  1, 10,  5, 10,  1,  9,  5,  1 },
-/*  28:       2, 3, 4,           */  {  3,  8,  1,  4,  1,  8,  1,  4, 10,  7, 10,  4, 10,  7, 11,  3, 11,  7,  8,  3,  7 },
-/*  44:       2, 3,    5,        */  {  3,  9,  1,  9,  3,  4, 11,  4,  3,  4, 11,  5, 10,  5, 11,  5, 10,  1,  5,  1,  9 },
-/*  52:       2,    4, 5,        */  {  7, 10,  5, 10,  7,  2,  8,  2,  7,  2,  8,  1,  9,  1,  8,  1,  9,  5,  1,  5, 10 },
-/*  84:       2,    4,    6,     */  {  6,  7,  2,  8,  2,  7,  2,  8,  1,  4,  1,  8,  1,  4,  5,  6,  5,  4,  7,  6,  4 },
-/* 148:       2,    4,       7,  */  {  6, 10,  4,  1,  4, 10,  4,  1,  8,  2,  8,  1,  8,  2, 11,  6, 11,  2, 10,  6,  2 },
-/*  56:          3, 4, 5,        */  {  7, 11,  5,  2,  5, 11,  5,  2,  9,  3,  9,  2,  9,  3,  8,  7,  8,  3, 11,  7,  3 },
-/* 104:          3,    5, 6,     */  {  4, 11,  6, 11,  4,  3,  9,  3,  4,  3,  9,  2, 10,  2,  9,  2, 10,  6,  2,  6, 11 },
-/* 168:          3,    5,    7,  */  {  7,  4,  3,  9,  3,  4,  3,  9,  2,  5,  2,  9,  2,  5,  6,  7,  6,  5,  4,  7,  5 },
-/*  87: 0, 1, 2,    4,    6,     */  {  3,  4,  7,  4,  3,  9,  2,  9,  3,  9,  2,  5,  6,  5,  2,  5,  6,  7,  5,  7,  4 },
-/* 151: 0, 1, 2,    4,       7,  */  {  6, 11,  4,  3,  4, 11,  4,  3,  9,  2,  9,  3,  9,  2, 10,  6, 10,  2, 11,  6,  2 },
-/* 199: 0, 1, 2,          6, 7,  */  {  5, 11,  7, 11,  5,  2,  9,  2,  5,  2,  9,  3,  8,  3,  9,  3,  8,  7,  3,  7, 11 },
-/* 107: 0, 1,    3,    5, 6,     */  {  4, 10,  6, 10,  4,  1,  8,  1,  4,  1,  8,  2, 11,  2,  8,  2, 11,  6,  2,  6, 10 },
-/* 171: 0, 1,    3,    5,    7,  */  {  2,  7,  6,  7,  2,  8,  1,  8,  2,  8,  1,  4,  5,  4,  1,  4,  5,  6,  4,  6,  7 },
-/* 203: 0, 1,    3,       6, 7,  */  {  5, 10,  7,  2,  7, 10,  7,  2,  8,  1,  8,  2,  8,  1,  9,  5,  9,  1, 10,  5,  1 },
-/* 211: 0, 1,       4,    6, 7,  */  {  1,  9,  3,  4,  3,  9,  3,  4, 11,  5, 11,  4, 11,  5, 10,  1, 10,  5,  9,  1,  5 },
-/* 227: 0, 1,          5, 6, 7,  */  {  1,  8,  3,  8,  1,  4, 10,  4,  1,  4, 10,  7, 11,  7, 10,  7, 11,  3,  7,  3,  8 },
-/*  61: 0,    2, 3, 4, 5,        */  {  7,  9,  5,  9,  7,  0, 11,  0,  7,  0, 11,  1, 10,  1, 11,  1, 10,  5,  1,  5,  9 },
-/*  93: 0,    2, 3, 4,    6,     */  {  1,  6,  5,  6,  1, 11,  0, 11,  1, 11,  0,  7,  4,  7,  0,  7,  4,  5,  7,  5,  6 },
-/* 109: 0,    2, 3,    5, 6,     */  {  4,  9,  6,  1,  6,  9,  6,  1, 11,  0, 11,  1, 11,  0,  8,  4,  8,  0,  9,  4,  0 },
-/* 117: 0,    2,    4, 5, 6,     */  {  3,  0,  7,  9,  7,  0,  7,  9,  6,  1,  6,  9,  6,  1,  2,  3,  2,  1,  0,  3,  1 },
-/* 213: 0,    2,    4,    6, 7,  */  {  1,  2,  5, 11,  5,  2,  5, 11,  4,  3,  4, 11,  4,  3,  0,  1,  0,  3,  2,  1,  3 },
-/* 121: 0,       3, 4, 5, 6,     */  {  0, 11,  2, 11,  0,  7,  9,  7,  0,  7,  9,  6, 10,  6,  9,  6, 10,  2,  6,  2, 11 },
-/* 233: 0,       3,    5, 6, 7,  */  {  0,  8,  2,  7,  2,  8,  2,  7, 10,  4, 10,  7, 10,  4,  9,  0,  9,  4,  8,  0,  4 },
-/*  62:    1, 2, 3, 4, 5,        */  {  7,  8,  5,  0,  5,  8,  5,  0, 10,  3, 10,  0, 10,  3, 11,  7, 11,  3,  8,  7,  3 },
-/* 158:    1, 2, 3, 4,       7,  */  {  6,  8,  4,  8,  6,  3, 10,  3,  6,  3, 10,  0,  9,  0, 10,  0,  9,  4,  0,  4,  8 },
-/* 174:    1, 2, 3,    5,    7,  */  {  0,  5,  4,  5,  0, 10,  3, 10,  0, 10,  3,  6,  7,  6,  3,  6,  7,  4,  6,  4,  5 },
-/* 182:    1, 2,    4, 5,    7,  */  {  2, 10,  0,  5,  0, 10,  0,  5,  8,  6,  8,  5,  8,  6, 11,  2, 11,  6, 10,  2,  6 },
-/* 214:    1, 2,    4,    6, 7,  */  {  2,  9,  0,  9,  2,  5, 11,  5,  2,  5, 11,  4,  8,  4, 11,  4,  8,  0,  4,  0,  9 },
-/* 186:    1,    3, 4, 5,    7,  */  {  2,  3,  6,  8,  6,  3,  6,  8,  5,  0,  5,  8,  5,  0,  1,  2,  1,  0,  3,  2,  0 },
-/* 234:    1,    3,    5, 6, 7,  */  {  0,  1,  4, 10,  4,  1,  4, 10,  7,  2,  7, 10,  7,  2,  3,  0,  3,  2,  1,  0,  2 },
-/* 124:       2, 3, 4, 5, 6,     */  {  3, 11,  1,  6,  1, 11,  1,  6,  9,  7,  9,  6,  9,  7,  8,  3,  8,  7, 11,  3,  7 },
-/* 188:       2, 3, 4, 5,    7,  */  {  3, 10,  1, 10,  3,  6,  8,  6,  3,  6,  8,  5,  9,  5,  8,  5,  9,  1,  5,  1, 10 }
-};
-
-//_____________________________________________________________________________
-/**
- * \brief tiling table for case 6.2
- * For each of the case above, the specific triangulation of the edge
- * intersection points is given.
- * When a case is ambiguous, there is an auxiliary table that contains
- * the face number to test and the tiling table contains the specific
- * triangulations depending on the results
- * A minus sign means to invert the result of the test.
- */
-//-----------------------------------------------------------------------------
-static const char tiling6_2[48][15] = {
-/*  67: 0, 1,             6,     */  {  1, 10,  3,  6,  3, 10,  3,  6,  8,  5,  8,  6,  8,  5,  9 },
-/* 131: 0, 1,                7,  */  {  1, 11,  3, 11,  1,  6,  9,  6,  1,  6,  9,  7,  8,  7,  9 },
-/*  21: 0,    2,    4,           */  {  4,  1,  0,  1,  4, 10,  7, 10,  4, 10,  7,  2,  3,  2,  7 },
-/*  69: 0,    2,          6,     */  {  6,  3,  2,  3,  6,  8,  5,  8,  6,  8,  5,  0,  1,  0,  5 },
-/*  41: 0,       3,    5,        */  {  0,  9,  2,  5,  2,  9,  2,  5, 11,  4, 11,  5, 11,  4,  8 },
-/*  73: 0,       3,       6,     */  {  0, 10,  2, 10,  0,  5,  8,  5,  0,  5,  8,  6, 11,  6,  8 },
-/*  81: 0,          4,    6,     */  {  4,  5,  0, 10,  0,  5,  0, 10,  3,  6,  3, 10,  3,  6,  7 },
-/*  97: 0,             5, 6,     */  {  4,  8,  6,  3,  6,  8,  6,  3, 10,  0, 10,  3, 10,  0,  9 },
-/* 193: 0,                6, 7,  */  {  5,  8,  7,  8,  5,  0, 10,  0,  5,  0, 10,  3, 11,  3, 10 },
-/*  22:    1, 2,    4,           */  {  2,  8,  0,  8,  2,  7, 10,  7,  2,  7, 10,  4,  9,  4, 10 },
-/* 134:    1, 2,             7,  */  {  2, 11,  0,  7,  0, 11,  0,  7,  9,  6,  9,  7,  9,  6, 10 },
-/*  42:    1,    3,    5,        */  {  5,  2,  1,  2,  5, 11,  4, 11,  5, 11,  4,  3,  0,  3,  4 },
-/* 138:    1,    3,          7,  */  {  7,  0,  3,  0,  7,  9,  6,  9,  7,  9,  6,  1,  2,  1,  6 },
-/* 146:    1,       4,       7,  */  {  6,  9,  4,  9,  6,  1, 11,  1,  6,  1, 11,  0,  8,  0, 11 },
-/* 162:    1,          5,    7,  */  {  5,  6,  1, 11,  1,  6,  1, 11,  0,  7,  0, 11,  0,  7,  4 },
-/* 194:    1,             6, 7,  */  {  5,  9,  7,  0,  7,  9,  7,  0, 11,  1, 11,  0, 11,  1, 10 },
-/*  28:       2, 3, 4,           */  {  3,  8,  1,  4,  1,  8,  1,  4, 10,  7, 10,  4, 10,  7, 11 },
-/*  44:       2, 3,    5,        */  {  3,  9,  1,  9,  3,  4, 11,  4,  3,  4, 11,  5, 10,  5, 11 },
-/*  52:       2,    4, 5,        */  {  7, 10,  5, 10,  7,  2,  8,  2,  7,  2,  8,  1,  9,  1,  8 },
-/*  84:       2,    4,    6,     */  {  6,  7,  2,  8,  2,  7,  2,  8,  1,  4,  1,  8,  1,  4,  5 },
-/* 148:       2,    4,       7,  */  {  6, 10,  4,  1,  4, 10,  4,  1,  8,  2,  8,  1,  8,  2, 11 },
-/*  56:          3, 4, 5,        */  {  7, 11,  5,  2,  5, 11,  5,  2,  9,  3,  9,  2,  9,  3,  8 },
-/* 104:          3,    5, 6,     */  {  4, 11,  6, 11,  4,  3,  9,  3,  4,  3,  9,  2, 10,  2,  9 },
-/* 168:          3,    5,    7,  */  {  7,  4,  3,  9,  3,  4,  3,  9,  2,  5,  2,  9,  2,  5,  6 },
-/*  87: 0, 1, 2,    4,    6,     */  {  3,  4,  7,  4,  3,  9,  2,  9,  3,  9,  2,  5,  6,  5,  2 },
-/* 151: 0, 1, 2,    4,       7,  */  {  6, 11,  4,  3,  4, 11,  4,  3,  9,  2,  9,  3,  9,  2, 10 },
-/* 199: 0, 1, 2,          6, 7,  */  {  5, 11,  7, 11,  5,  2,  9,  2,  5,  2,  9,  3,  8,  3,  9 },
-/* 107: 0, 1,    3,    5, 6,     */  {  4, 10,  6, 10,  4,  1,  8,  1,  4,  1,  8,  2, 11,  2,  8 },
-/* 171: 0, 1,    3,    5,    7,  */  {  2,  7,  6,  7,  2,  8,  1,  8,  2,  8,  1,  4,  5,  4,  1 },
-/* 203: 0, 1,    3,       6, 7,  */  {  5, 10,  7,  2,  7, 10,  7,  2,  8,  1,  8,  2,  8,  1,  9 },
-/* 211: 0, 1,       4,    6, 7,  */  {  1,  9,  3,  4,  3,  9,  3,  4, 11,  5, 11,  4, 11,  5, 10 },
-/* 227: 0, 1,          5, 6, 7,  */  {  1,  8,  3,  8,  1,  4, 10,  4,  1,  4, 10,  7, 11,  7, 10 },
-/*  61: 0,    2, 3, 4, 5,        */  {  7,  9,  5,  9,  7,  0, 11,  0,  7,  0, 11,  1, 10,  1, 11 },
-/*  93: 0,    2, 3, 4,    6,     */  {  1,  6,  5,  6,  1, 11,  0, 11,  1, 11,  0,  7,  4,  7,  0 },
-/* 109: 0,    2, 3,    5, 6,     */  {  4,  9,  6,  1,  6,  9,  6,  1, 11,  0, 11,  1, 11,  0,  8 },
-/* 117: 0,    2,    4, 5, 6,     */  {  3,  0,  7,  9,  7,  0,  7,  9,  6,  1,  6,  9,  6,  1,  2 },
-/* 213: 0,    2,    4,    6, 7,  */  {  1,  2,  5, 11,  5,  2,  5, 11,  4,  3,  4, 11,  4,  3,  0 },
-/* 121: 0,       3, 4, 5, 6,     */  {  0, 11,  2, 11,  0,  7,  9,  7,  0,  7,  9,  6, 10,  6,  9 },
-/* 233: 0,       3,    5, 6, 7,  */  {  0,  8,  2,  7,  2,  8,  2,  7, 10,  4, 10,  7, 10,  4,  9 },
-/*  62:    1, 2, 3, 4, 5,        */  {  7,  8,  5,  0,  5,  8,  5,  0, 10,  3, 10,  0, 10,  3, 11 },
-/* 158:    1, 2, 3, 4,       7,  */  {  6,  8,  4,  8,  6,  3, 10,  3,  6,  3, 10,  0,  9,  0, 10 },
-/* 174:    1, 2, 3,    5,    7,  */  {  0,  5,  4,  5,  0, 10,  3, 10,  0, 10,  3,  6,  7,  6,  3 },
-/* 182:    1, 2,    4, 5,    7,  */  {  2, 10,  0,  5,  0, 10,  0,  5,  8,  6,  8,  5,  8,  6, 11 },
-/* 214:    1, 2,    4,    6, 7,  */  {  2,  9,  0,  9,  2,  5, 11,  5,  2,  5, 11,  4,  8,  4, 11 },
-/* 186:    1,    3, 4, 5,    7,  */  {  2,  3,  6,  8,  6,  3,  6,  8,  5,  0,  5,  8,  5,  0,  1 },
-/* 234:    1,    3,    5, 6, 7,  */  {  0,  1,  4, 10,  4,  1,  4, 10,  7,  2,  7, 10,  7,  2,  3 },
-/* 124:       2, 3, 4, 5, 6,     */  {  3, 11,  1,  6,  1, 11,  1,  6,  9,  7,  9,  6,  9,  7,  8 },
-/* 188:       2, 3, 4, 5,    7,  */  {  3, 10,  1, 10,  3,  6,  8,  6,  3,  6,  8,  5,  9,  5,  8 }
-};
-//_____________________________________________________________________________
-
-
-
-//_____________________________________________________________________________
-/**
- * \brief test table for case 7
- * 3 faces to test + eventually the interior
- * When the tests on the 3 specified faces are positive :
- * - if the test on the interior is positive : 5 first triangles
- * - if the test on the interior is negative : 9 next triangles
- * When the tests on the first  and the second specified faces are positive : 9 next triangles
- * When the tests on the first  and the third  specified faces are positive : 9 next triangles
- * When the tests on the second and the third  specified faces are positive : 9 next triangles
- * When the test on the first  specified face is positive : 5 next triangles
- * When the test on the second specified face is positive : 5 next triangles
- * When the test on the third  specified face is positive : 5 next triangles
- * When the tests on the 3 specified faces are negative : 3 last triangles
- * The support edge for the interior test is marked as the 5th column.
- *
- * For each of the case above, the specific triangulation of the edge
- * intersection points is given.
- * When a case is ambiguous, there is an auxiliary table that contains
- * the face number to test and the tiling table contains the specific
- * triangulations depending on the results
- * A minus sign means to invert the result of the test.
- */
-//-----------------------------------------------------------------------------
-static const char test7[16][5] = {
-/*  37: 0,    2,       5,        */  {  1,  2,  5,  7,   1 },
-/* 133: 0,    2,             7,  */  {  3,  4,  5,  7,   3 },
-/* 161: 0,             5,    7,  */  {  4,  1,  6,  7,   4 },
-/*  26:    1,    3, 4,           */  {  4,  1,  5,  7,   0 },
-/*  74:    1,    3,       6,     */  {  2,  3,  5,  7,   2 },
-/*  82:    1,       4,    6,     */  {  1,  2,  6,  7,   5 },
-/* 164:       2,       5,    7,  */  {  2,  3,  6,  7,   6 },
-/*  88:          3, 4,    6,     */  {  3,  4,  6,  7,   7 },
-/* 167: 0, 1, 2,       5,    7,  */  { -3, -4, -6, -7,   7 },
-/*  91: 0, 1,    3, 4,    6,     */  { -2, -3, -6, -7,   6 },
-/* 173: 0,    2, 3,    5,    7,  */  { -1, -2, -6, -7,   5 },
-/* 181: 0,    2,    4, 5,    7,  */  { -2, -3, -5, -7,   2 },
-/* 229: 0,    2,       5, 6, 7,  */  { -4, -1, -5, -7,   0 },
-/*  94:    1, 2, 3, 4,    6,     */  { -4, -1, -6, -7,   4 },
-/* 122:    1,    3, 4, 5, 6,     */  { -3, -4, -5, -7,   3 },
-/* 218:    1,    3, 4,    6, 7,  */  { -1, -2, -5, -7,   1 }
-};
-
-//_____________________________________________________________________________
-/**
- * \brief tiling table for case 7.1
- * For each of the case above, the specific triangulation of the edge
- * intersection points is given.
- * When a case is ambiguous, there is an auxiliary table that contains
- * the face number to test and the tiling table contains the specific
- * triangulations depending on the results
- * A minus sign means to invert the result of the test.
- */
-//-----------------------------------------------------------------------------
-static const char tiling7_1[16][9] = {
-/*  37: 0,    2,       5,        */  {  9,  5,  4, 10,  1,  2,  8,  3,  0 },
-/* 133: 0,    2,             7,  */  { 11,  7,  6,  8,  3,  0, 10,  1,  2 },
-/* 161: 0,             5,    7,  */  {  3,  0,  8,  5,  4,  9,  7,  6, 11 },
-/*  26:    1,    3, 4,           */  {  8,  4,  7,  9,  0,  1, 11,  2,  3 },
-/*  74:    1,    3,       6,     */  { 10,  6,  5, 11,  2,  3,  9,  0,  1 },
-/*  82:    1,       4,    6,     */  {  0,  1,  9,  6,  5, 10,  4,  7,  8 },
-/* 164:       2,       5,    7,  */  {  1,  2, 10,  7,  6, 11,  5,  4,  9 },
-/*  88:          3, 4,    6,     */  {  2,  3, 11,  4,  7,  8,  6,  5, 10 },
-/* 167: 0, 1, 2,       5,    7,  */  { 11,  3,  2,  8,  7,  4, 10,  5,  6 },
-/*  91: 0, 1,    3, 4,    6,     */  { 10,  2,  1, 11,  6,  7,  9,  4,  5 },
-/* 173: 0,    2, 3,    5,    7,  */  {  9,  1,  0, 10,  5,  6,  8,  7,  4 },
-/* 181: 0,    2,    4, 5,    7,  */  {  5,  6, 10,  3,  2, 11,  1,  0,  9 },
-/* 229: 0,    2,       5, 6, 7,  */  {  7,  4,  8,  1,  0,  9,  3,  2, 11 },
-/*  94:    1, 2, 3, 4,    6,     */  {  8,  0,  3,  9,  4,  5, 11,  6,  7 },
-/* 122:    1,    3, 4, 5, 6,     */  {  6,  7, 11,  0,  3,  8,  2,  1, 10 },
-/* 218:    1,    3, 4,    6, 7,  */  {  4,  5,  9,  2,  1, 10,  0,  3,  8 }
-};
-
-//_____________________________________________________________________________
-/**
- * \brief tiling table for case 7.2
- * For each of the case above, the specific triangulation of the edge
- * intersection points is given.
- * When a case is ambiguous, there is an auxiliary table that contains
- * the face number to test and the tiling table contains the specific
- * triangulations depending on the results
- * A minus sign means to invert the result of the test.
- */
-//-----------------------------------------------------------------------------
-static const char tiling7_2[16][3][15] = {
-/*  37: 0,    2,       5,        */  {
- /* 1,0 */ {  1,  2, 10,  3,  4,  8,  4,  3,  5,  0,  5,  3,  5,  0,  9 },
- /* 0,1 */ {  3,  0,  8,  9,  1,  4,  2,  4,  1,  4,  2,  5, 10,  5,  2 },
- /* 1,1 */ {  9,  5,  4,  0, 10,  1, 10,  0,  8, 10,  8,  2,  3,  2,  8 }
-},
-/* 133: 0,    2,             7,  */  {
- /* 1,0 */ {  3,  0,  8,  1,  6, 10,  6,  1,  7,  2,  7,  1,  7,  2, 11 },
- /* 0,1 */ {  1,  2, 10, 11,  3,  6,  0,  6,  3,  6,  0,  7,  8,  7,  0 },
- /* 1,1 */ { 11,  7,  6,  2,  8,  3,  8,  2, 10,  8, 10,  0,  1,  0, 10 }
-},
-/* 161: 0,             5,    7,  */  {
- /* 1,0 */ {  9,  5,  4, 11,  3,  6,  0,  6,  3,  6,  0,  7,  8,  7,  0 },
- /* 0,1 */ { 11,  7,  6,  3,  4,  8,  4,  3,  5,  0,  5,  3,  5,  0,  9 },
- /* 1,1 */ {  3,  0,  8,  4,  9,  7, 11,  7,  9,  5, 11,  9, 11,  5,  6 }
-},
-/*  26:    1,    3, 4,           */  {
- /* 1,0 */ {  0,  1,  9,  2,  7, 11,  7,  2,  4,  3,  4,  2,  4,  3,  8 },
- /* 0,1 */ {  2,  3, 11,  8,  0,  7,  1,  7,  0,  7,  1,  4,  9,  4,  1 },
- /* 1,1 */ {  8,  4,  7,  3,  9,  0,  9,  3, 11,  9, 11,  1,  2,  1, 11 }
-},
-/*  74:    1,    3,       6,     */  {
- /* 1,0 */ {  2,  3, 11,  0,  5,  9,  5,  0,  6,  1,  6,  0,  6,  1, 10 },
- /* 0,1 */ {  0,  1,  9, 10,  2,  5,  3,  5,  2,  5,  3,  6, 11,  6,  3 },
- /* 1,1 */ {  6,  5, 10,  1, 11,  2, 11,  1,  9, 11,  9,  3,  0,  3,  9 }
-},
-/*  82:    1,       4,    6,     */  {
- /* 1,0 */ {  6,  5, 10,  8,  0,  7,  1,  7,  0,  7,  1,  4,  9,  4,  1 },
- /* 0,1 */ {  8,  4,  7,  0,  5,  9,  5,  0,  6,  1,  6,  0,  6,  1, 10 },
- /* 1,1 */ {  0,  1,  9,  5, 10,  4,  8,  4, 10,  6,  8, 10,  8,  6,  7 }
-},
-/* 164:       2,       5,    7,  */  {
- /* 1,0 */ { 11,  7,  6,  9,  1,  4,  2,  4,  1,  4,  2,  5, 10,  5,  2 },
- /* 0,1 */ {  9,  5,  4,  1,  6, 10,  6,  1,  7,  2,  7,  1,  7,  2, 11 },
- /* 1,1 */ {  1,  2, 10,  6, 11,  5,  9,  5, 11,  7,  9, 11,  9,  7,  4 }
-},
-/*  88:          3, 4,    6,     */  {
- /* 1,0 */ {  8,  4,  7, 10,  2,  5,  3,  5,  2,  5,  3,  6, 11,  6,  3 },
- /* 0,1 */ {  6,  5, 10,  2,  7, 11,  7,  2,  4,  3,  4,  2,  4,  3,  8 },
- /* 1,1 */ {  2,  3, 11,  7,  8,  6, 10,  6,  8,  4, 10,  8, 10,  4,  5 }
-},
-/* 167: 0, 1, 2,       5,    7,  */  {
- /* 1,0 */ {  7,  4,  8,  5,  2, 10,  2,  5,  3,  6,  3,  5,  3,  6, 11 },
- /* 0,1 */ { 10,  5,  6, 11,  7,  2,  4,  2,  7,  2,  4,  3,  8,  3,  4 },
- /* 1,1 */ { 11,  3,  2,  6,  8,  7,  8,  6, 10,  8, 10,  4,  5,  4, 10 }
-},
-/*  91: 0, 1,    3, 4,    6,     */  {
- /* 1,0 */ {  6,  7, 11,  4,  1,  9,  1,  4,  2,  5,  2,  4,  2,  5, 10 },
- /* 0,1 */ {  4,  5,  9, 10,  6,  1,  7,  1,  6,  1,  7,  2, 11,  2,  7 },
- /* 1,1 */ { 10,  2,  1,  5, 11,  6, 11,  5,  9, 11,  9,  7,  4,  7,  9 }
-},
-/* 173: 0,    2, 3,    5,    7,  */  {
- /* 1,0 */ { 10,  5,  6,  7,  0,  8,  0,  7,  1,  4,  1,  7,  1,  4,  9 },
- /* 0,1 */ {  7,  4,  8,  9,  5,  0,  6,  0,  5,  0,  6,  1, 10,  1,  6 },
- /* 1,1 */ {  9,  1,  0,  4, 10,  5, 10,  4,  8, 10,  8,  6,  7,  6,  8 }
-},
-/* 181: 0,    2,    4, 5,    7,  */  {
- /* 1,0 */ { 11,  3,  2,  9,  5,  0,  6,  0,  5,  0,  6,  1, 10,  1,  6 },
- /* 0,1 */ {  9,  1,  0,  5,  2, 10,  2,  5,  3,  6,  3,  5,  3,  6, 11 },
- /* 1,1 */ { 10,  5,  6,  2, 11,  1,  9,  1, 11,  3,  9, 11,  9,  3,  0 }
-},
-/* 229: 0,    2,       5, 6, 7,  */  {
- /* 1,0 */ {  9,  1,  0, 11,  7,  2,  4,  2,  7,  2,  4,  3,  8,  3,  4 },
- /* 0,1 */ { 11,  3,  2,  7,  0,  8,  0,  7,  1,  4,  1,  7,  1,  4,  9 },
- /* 1,1 */ {  7,  4,  8,  0,  9,  3, 11,  3,  9,  1, 11,  9, 11,  1,  2 }
-},
-/*  94:    1, 2, 3, 4,    6,     */  {
- /* 1,0 */ {  4,  5,  9,  6,  3, 11,  3,  6,  0,  7,  0,  6,  0,  7,  8 },
- /* 0,1 */ {  6,  7, 11,  8,  4,  3,  5,  3,  4,  3,  5,  0,  9,  0,  5 },
- /* 1,1 */ {  8,  0,  3,  7,  9,  4,  9,  7, 11,  9, 11,  5,  6,  5, 11 }
-},
-/* 122:    1,    3, 4, 5, 6,     */  {
- /* 1,0 */ {  8,  0,  3, 10,  6,  1,  7,  1,  6,  1,  7,  2, 11,  2,  7 },
- /* 0,1 */ { 10,  2,  1,  6,  3, 11,  3,  6,  0,  7,  0,  6,  0,  7,  8 },
- /* 1,1 */ {  6,  7, 11,  3,  8,  2, 10,  2,  8,  0, 10,  8, 10,  0,  1 }
-},
-/* 218:    1,    3, 4,    6, 7,  */  {
- /* 1,0 */ { 10,  2,  1,  8,  4,  3,  5,  3,  4,  3,  5,  0,  9,  0,  5 },
- /* 0,1 */ {  8,  0,  3,  4,  1,  9,  1,  4,  2,  5,  2,  4,  2,  5, 10 },
- /* 1,1 */ {  4,  5,  9,  1, 10,  0,  8,  0, 10,  2,  8, 10,  8,  2,  3 } }
-};
-
-//_____________________________________________________________________________
-/**
- * \brief tiling table for case 7.3
- * For each of the case above, the specific triangulation of the edge
- * intersection points is given.
- * When a case is ambiguous, there is an auxiliary table that contains
- * the face number to test and the tiling table contains the specific
- * triangulations depending on the results
- * A minus sign means to invert the result of the test.
- */
-//-----------------------------------------------------------------------------
-static const char tiling7_3[16][3][27] = {
-/*  37: 0,    2,       5,        */  {
- /* 1,0 */ { 12,  2, 10, 12, 10,  5, 12,  5,  4, 12,  4,  8, 12,  8,  3, 12,  3,  0, 12,  0,  9, 12,  9,  1, 12,  1,  2 },
- /* 0,1 */ { 12,  5,  4, 12,  4,  8, 12,  8,  3, 12,  3,  2, 12,  2, 10, 12, 10,  1, 12,  1,  0, 12,  0,  9, 12,  9,  5 },
- /* 1,1 */ {  5,  4, 12, 10,  5, 12,  2, 10, 12,  3,  2, 12,  8,  3, 12,  0,  8, 12,  1,  0, 12,  9,  1, 12,  4,  9, 12 }
-},
-/* 133: 0,    2,             7,  */  {
- /* 1,0 */ { 12,  0,  8, 12,  8,  7, 12,  7,  6, 12,  6, 10, 12, 10,  1, 12,  1,  2, 12,  2, 11, 12, 11,  3, 12,  3,  0 },
- /* 0,1 */ { 12,  7,  6, 12,  6, 10, 12, 10,  1, 12,  1,  0, 12,  0,  8, 12,  8,  3, 12,  3,  2, 12,  2, 11, 12, 11,  7 },
- /* 1,1 */ {  7,  6, 12,  8,  7, 12,  0,  8, 12,  1,  0, 12, 10,  1, 12,  2, 10, 12,  3,  2, 12, 11,  3, 12,  6, 11, 12 }
-},
-/* 161: 0,             5,    7,  */  {
- /* 1,0 */ {  9,  5, 12,  0,  9, 12,  3,  0, 12, 11,  3, 12,  6, 11, 12,  7,  6, 12,  8,  7, 12,  4,  8, 12,  5,  4, 12 },
- /* 0,1 */ {  3,  0, 12, 11,  3, 12,  6, 11, 12,  5,  6, 12,  9,  5, 12,  4,  9, 12,  7,  4, 12,  8,  7, 12,  0,  8, 12 },
- /* 1,1 */ { 12,  3,  0, 12,  0,  9, 12,  9,  5, 12,  5,  6, 12,  6, 11, 12, 11,  7, 12,  7,  4, 12,  4,  8, 12,  8,  3 }
-},
-/*  26:    1,    3, 4,           */  {
- /* 1,0 */ { 12,  1,  9, 12,  9,  4, 12,  4,  7, 12,  7, 11, 12, 11,  2, 12,  2,  3, 12,  3,  8, 12,  8,  0, 12,  0,  1 },
- /* 0,1 */ { 12,  4,  7, 12,  7, 11, 12, 11,  2, 12,  2,  1, 12,  1,  9, 12,  9,  0, 12,  0,  3, 12,  3,  8, 12,  8,  4 },
- /* 1,1 */ {  4,  7, 12,  9,  4, 12,  1,  9, 12,  2,  1, 12, 11,  2, 12,  3, 11, 12,  0,  3, 12,  8,  0, 12,  7,  8, 12 }
-},
-/*  74:    1,    3,       6,     */  {
- /* 1,0 */ { 12,  3, 11, 12, 11,  6, 12,  6,  5, 12,  5,  9, 12,  9,  0, 12,  0,  1, 12,  1, 10, 12, 10,  2, 12,  2,  3 },
- /* 0,1 */ { 12,  6,  5, 12,  5,  9, 12,  9,  0, 12,  0,  3, 12,  3, 11, 12, 11,  2, 12,  2,  1, 12,  1, 10, 12, 10,  6 },
- /* 1,1 */ {  6,  5, 12, 11,  6, 12,  3, 11, 12,  0,  3, 12,  9,  0, 12,  1,  9, 12,  2,  1, 12, 10,  2, 12,  5, 10, 12 }
-},
-/*  82:    1,       4,    6,     */  {
- /* 1,0 */ { 10,  6, 12,  1, 10, 12,  0,  1, 12,  8,  0, 12,  7,  8, 12,  4,  7, 12,  9,  4, 12,  5,  9, 12,  6,  5, 12 },
- /* 0,1 */ {  0,  1, 12,  8,  0, 12,  7,  8, 12,  6,  7, 12, 10,  6, 12,  5, 10, 12,  4,  5, 12,  9,  4, 12,  1,  9, 12 },
- /* 1,1 */ { 12,  0,  1, 12,  1, 10, 12, 10,  6, 12,  6,  7, 12,  7,  8, 12,  8,  4, 12,  4,  5, 12,  5,  9, 12,  9,  0 }
-},
-/* 164:       2,       5,    7,  */  {
- /* 1,0 */ { 11,  7, 12,  2, 11, 12,  1,  2, 12,  9,  1, 12,  4,  9, 12,  5,  4, 12, 10,  5, 12,  6, 10, 12,  7,  6, 12 },
- /* 0,1 */ {  1,  2, 12,  9,  1, 12,  4,  9, 12,  7,  4, 12, 11,  7, 12,  6, 11, 12,  5,  6, 12, 10,  5, 12,  2, 10, 12 },
- /* 1,1 */ { 12,  1,  2, 12,  2, 11, 12, 11,  7, 12,  7,  4, 12,  4,  9, 12,  9,  5, 12,  5,  6, 12,  6, 10, 12, 10,  1 }
-},
-/*  88:          3, 4,    6,     */  {
- /* 1,0 */ {  8,  4, 12,  3,  8, 12,  2,  3, 12, 10,  2, 12,  5, 10, 12,  6,  5, 12, 11,  6, 12,  7, 11, 12,  4,  7, 12 },
- /* 0,1 */ {  2,  3, 12, 10,  2, 12,  5, 10, 12,  4,  5, 12,  8,  4, 12,  7,  8, 12,  6,  7, 12, 11,  6, 12,  3, 11, 12 },
- /* 1,1 */ { 12,  2,  3, 12,  3,  8, 12,  8,  4, 12,  4,  5, 12,  5, 10, 12, 10,  6, 12,  6,  7, 12,  7, 11, 12, 11,  2 }
-},
-/* 167: 0, 1, 2,       5,    7,  */  {
- /* 1,0 */ { 12,  4,  8, 12,  8,  3, 12,  3,  2, 12,  2, 10, 12, 10,  5, 12,  5,  6, 12,  6, 11, 12, 11,  7, 12,  7,  4 },
- /* 0,1 */ { 12,  3,  2, 12,  2, 10, 12, 10,  5, 12,  5,  4, 12,  4,  8, 12,  8,  7, 12,  7,  6, 12,  6, 11, 12, 11,  3 },
- /* 1,1 */ {  3,  2, 12,  8,  3, 12,  4,  8, 12,  5,  4, 12, 10,  5, 12,  6, 10, 12,  7,  6, 12, 11,  7, 12,  2, 11, 12 }
-},
-/*  91: 0, 1,    3, 4,    6,     */  {
- /* 1,0 */ { 12,  7, 11, 12, 11,  2, 12,  2,  1, 12,  1,  9, 12,  9,  4, 12,  4,  5, 12,  5, 10, 12, 10,  6, 12,  6,  7 },
- /* 0,1 */ { 12,  2,  1, 12,  1,  9, 12,  9,  4, 12,  4,  7, 12,  7, 11, 12, 11,  6, 12,  6,  5, 12,  5, 10, 12, 10,  2 },
- /* 1,1 */ {  2,  1, 12, 11,  2, 12,  7, 11, 12,  4,  7, 12,  9,  4, 12,  5,  9, 12,  6,  5, 12, 10,  6, 12,  1, 10, 12 }
-},
-/* 173: 0,    2, 3,    5,    7,  */  {
- /* 1,0 */ { 12,  6, 10, 12, 10,  1, 12,  1,  0, 12,  0,  8, 12,  8,  7, 12,  7,  4, 12,  4,  9, 12,  9,  5, 12,  5,  6 },
- /* 0,1 */ { 12,  1,  0, 12,  0,  8, 12,  8,  7, 12,  7,  6, 12,  6, 10, 12, 10,  5, 12,  5,  4, 12,  4,  9, 12,  9,  1 },
- /* 1,1 */ {  1,  0, 12, 10,  1, 12,  6, 10, 12,  7,  6, 12,  8,  7, 12,  4,  8, 12,  5,  4, 12,  9,  5, 12,  0,  9, 12 }
-},
-/* 181: 0,    2,    4, 5,    7,  */  {
- /* 1,0 */ { 11,  3, 12,  6, 11, 12,  5,  6, 12,  9,  5, 12,  0,  9, 12,  1,  0, 12, 10,  1, 12,  2, 10, 12,  3,  2, 12 },
- /* 0,1 */ {  5,  6, 12,  9,  5, 12,  0,  9, 12,  3,  0, 12, 11,  3, 12,  2, 11, 12,  1,  2, 12, 10,  1, 12,  6, 10, 12 },
- /* 1,1 */ { 12,  5,  6, 12,  6, 11, 12, 11,  3, 12,  3,  0, 12,  0,  9, 12,  9,  1, 12,  1,  2, 12,  2, 10, 12, 10,  5 }
-},
-/* 229: 0,    2,       5, 6, 7,  */  {
- /* 1,0 */ {  9,  1, 12,  4,  9, 12,  7,  4, 12, 11,  7, 12,  2, 11, 12,  3,  2, 12,  8,  3, 12,  0,  8, 12,  1,  0, 12 },
- /* 0,1 */ {  7,  4, 12, 11,  7, 12,  2, 11, 12,  1,  2, 12,  9,  1, 12,  0,  9, 12,  3,  0, 12,  8,  3, 12,  4,  8, 12 },
- /* 1,1 */ { 12,  7,  4, 12,  4,  9, 12,  9,  1, 12,  1,  2, 12,  2, 11, 12, 11,  3, 12,  3,  0, 12,  0,  8, 12,  8,  7 }
-},
-/*  94:    1, 2, 3, 4,    6,     */  {
- /* 1,0 */ { 12,  5,  9, 12,  9,  0, 12,  0,  3, 12,  3, 11, 12, 11,  6, 12,  6,  7, 12,  7,  8, 12,  8,  4, 12,  4,  5 },
- /* 0,1 */ { 12,  0,  3, 12,  3, 11, 12, 11,  6, 12,  6,  5, 12,  5,  9, 12,  9,  4, 12,  4,  7, 12,  7,  8, 12,  8,  0 },
- /* 1,1 */ {  0,  3, 12,  9,  0, 12,  5,  9, 12,  6,  5, 12, 11,  6, 12,  7, 11, 12,  4,  7, 12,  8,  4, 12,  3,  8, 12 }
-},
-/* 122:    1,    3, 4, 5, 6,     */  {
- /* 1,0 */ {  8,  0, 12,  7,  8, 12,  6,  7, 12, 10,  6, 12,  1, 10, 12,  2,  1, 12, 11,  2, 12,  3, 11, 12,  0,  3, 12 },
- /* 0,1 */ {  6,  7, 12, 10,  6, 12,  1, 10, 12,  0,  1, 12,  8,  0, 12,  3,  8, 12,  2,  3, 12, 11,  2, 12,  7, 11, 12 },
- /* 1,1 */ { 12,  6,  7, 12,  7,  8, 12,  8,  0, 12,  0,  1, 12,  1, 10, 12, 10,  2, 12,  2,  3, 12,  3, 11, 12, 11,  6 }
-},
-/* 218:    1,    3, 4,    6, 7,  */  {
- /* 1,0 */ { 10,  2, 12,  5, 10, 12,  4,  5, 12,  8,  4, 12,  3,  8, 12,  0,  3, 12,  9,  0, 12,  1,  9, 12,  2,  1, 12 },
- /* 0,1 */ {  4,  5, 12,  8,  4, 12,  3,  8, 12,  2,  3, 12, 10,  2, 12,  1, 10, 12,  0,  1, 12,  9,  0, 12,  5,  9, 12 },
- /* 1,1 */ { 12,  4,  5, 12,  5, 10, 12, 10,  2, 12,  2,  3, 12,  3,  8, 12,  8,  0, 12,  0,  1, 12,  1,  9, 12,  9,  4 } }
-};
-
-//_____________________________________________________________________________
-/**
- * \brief tiling table for case 7.4.1
- * For each of the case above, the specific triangulation of the edge
- * intersection points is given.
- * When a case is ambiguous, there is an auxiliary table that contains
- * the face number to test and the tiling table contains the specific
- * triangulations depending on the results
- * A minus sign means to invert the result of the test.
- */
-//-----------------------------------------------------------------------------
-static const char tiling7_4_1[16][15] = {
-/*  37: 0,    2,       5,        */  {  3,  4,  8,  4,  3, 10,  2, 10,  3,  4, 10,  5,  9,  1,  0 },
-/* 133: 0,    2,             7,  */  {  1,  6, 10,  6,  1,  8,  0,  8,  1,  6,  8,  7, 11,  3,  2 },
-/* 161: 0,             5,    7,  */  { 11,  3,  6,  9,  6,  3,  6,  9,  5,  0,  9,  3,  7,  4,  8 },
-/*  26:    1,    3, 4,           */  {  2,  7, 11,  7,  2,  9,  1,  9,  2,  7,  9,  4,  8,  0,  3 },
-/*  74:    1,    3,       6,     */  {  0,  5,  9,  5,  0, 11,  3, 11,  0,  5, 11,  6, 10,  2,  1 },
-/*  82:    1,       4,    6,     */  {  8,  0,  7, 10,  7,  0,  7, 10,  6,  1, 10,  0,  4,  5,  9 },
-/* 164:       2,       5,    7,  */  {  9,  1,  4, 11,  4,  1,  4, 11,  7,  2, 11,  1,  5,  6, 10 },
-/*  88:          3, 4,    6,     */  { 10,  2,  5,  8,  5,  2,  5,  8,  4,  3,  8,  2,  6,  7, 11 },
-/* 167: 0, 1, 2,       5,    7,  */  {  5,  2, 10,  2,  5,  8,  4,  8,  5,  2,  8,  3, 11,  7,  6 },
-/*  91: 0, 1,    3, 4,    6,     */  {  4,  1,  9,  1,  4, 11,  7, 11,  4,  1, 11,  2, 10,  6,  5 },
-/* 173: 0,    2, 3,    5,    7,  */  {  7,  0,  8,  0,  7, 10,  6, 10,  7,  0, 10,  1,  9,  5,  4 },
-/* 181: 0,    2,    4, 5,    7,  */  {  9,  5,  0, 11,  0,  5,  0, 11,  3,  6, 11,  5,  1,  2, 10 },
-/* 229: 0,    2,       5, 6, 7,  */  { 11,  7,  2,  9,  2,  7,  2,  9,  1,  4,  9,  7,  3,  0,  8 },
-/*  94:    1, 2, 3, 4,    6,     */  {  6,  3, 11,  3,  6,  9,  5,  9,  6,  3,  9,  0,  8,  4,  7 },
-/* 122:    1,    3, 4, 5, 6,     */  { 10,  6,  1,  8,  1,  6,  1,  8,  0,  7,  8,  6,  2,  3, 11 },
-/* 218:    1,    3, 4,    6, 7,  */  {  8,  4,  3, 10,  3,  4,  3, 10,  2,  5, 10,  4,  0,  1,  9 }
-};
-
-//_____________________________________________________________________________
-/**
- * \brief tiling table for case 7.4.2
- * For each of the case above, the specific triangulation of the edge
- * intersection points is given.
- * When a case is ambiguous, there is an auxiliary table that contains
- * the face number to test and the tiling table contains the specific
- * triangulations depending on the results
- * A minus sign means to invert the result of the test.
- */
-//-----------------------------------------------------------------------------
-static const char tiling7_4_2[16][27] = {
-/*  37: 0,    2,       5,        */  {   9,  4,  8,  4,  9,  5, 10,  5,  9,  1, 10,  9, 10,  1,  2,  0,  2,  1,  2,  0,  3,  8,  3,  0,  9,  8,  0 },
-/* 133: 0,    2,             7,  */  {  11,  6, 10,  6, 11,  7,  8,  7, 11,  3,  8, 11,  8,  3,  0,  2,  0,  3,  0,  2,  1, 10,  1,  2, 11, 10,  2 },
-/* 161: 0,             5,    7,  */  {  11,  3,  8,  0,  8,  3,  8,  0,  9,  8,  9,  4,  5,  4,  9,  4,  5,  7,  6,  7,  5,  7,  6, 11,  7, 11,  8 },
-/*  26:    1,    3, 4,           */  {   8,  7, 11,  7,  8,  4,  9,  4,  8,  0,  9,  8,  9,  0,  1,  3,  1,  0,  1,  3,  2, 11,  2,  3,  8, 11,  3 },
-/*  74:    1,    3,       6,     */  {  10,  5,  9,  5, 10,  6, 11,  6, 10,  2, 11, 10, 11,  2,  3,  1,  3,  2,  3,  1,  0,  9,  0,  1, 10,  9,  1 },
-/*  82:    1,       4,    6,     */  {   8,  0,  9,  1,  9,  0,  9,  1, 10,  9, 10,  5,  6,  5, 10,  5,  6,  4,  7,  4,  6,  4,  7,  8,  4,  8,  9 },
-/* 164:       2,       5,    7,  */  {   9,  1, 10,  2, 10,  1, 10,  2, 11, 10, 11,  6,  7,  6, 11,  6,  7,  5,  4,  5,  7,  5,  4,  9,  5,  9, 10 },
-/*  88:          3, 4,    6,     */  {  10,  2, 11,  3, 11,  2, 11,  3,  8, 11,  8,  7,  4,  7,  8,  7,  4,  6,  5,  6,  4,  6,  5, 10,  6, 10, 11 },
-/* 167: 0, 1, 2,       5,    7,  */  {  11,  2, 10,  2, 11,  3,  8,  3, 11,  7,  8, 11,  8,  7,  4,  6,  4,  7,  4,  6,  5, 10,  5,  6, 11, 10,  6 },
-/*  91: 0, 1,    3, 4,    6,     */  {  10,  1,  9,  1, 10,  2, 11,  2, 10,  6, 11, 10, 11,  6,  7,  5,  7,  6,  7,  5,  4,  9,  4,  5, 10,  9,  5 },
-/* 173: 0,    2, 3,    5,    7,  */  {   9,  0,  8,  0,  9,  1, 10,  1,  9,  5, 10,  9, 10,  5,  6,  4,  6,  5,  6,  4,  7,  8,  7,  4,  9,  8,  4 },
-/* 181: 0,    2,    4, 5,    7,  */  {   9,  5, 10,  6, 10,  5, 10,  6, 11, 10, 11,  2,  3,  2, 11,  2,  3,  1,  0,  1,  3,  1,  0,  9,  1,  9, 10 },
-/* 229: 0,    2,       5, 6, 7,  */  {  11,  7,  8,  4,  8,  7,  8,  4,  9,  8,  9,  0,  1,  0,  9,  0,  1,  3,  2,  3,  1,  3,  2, 11,  3, 11,  8 },
-/*  94:    1, 2, 3, 4,    6,     */  {   8,  3, 11,  3,  8,  0,  9,  0,  8,  4,  9,  8,  9,  4,  5,  7,  5,  4,  5,  7,  6, 11,  6,  7,  8, 11,  7 },
-/* 122:    1,    3, 4, 5, 6,     */  {  10,  6, 11,  7, 11,  6, 11,  7,  8, 11,  8,  3,  0,  3,  8,  3,  0,  2,  1,  2,  0,  2,  1, 10,  2, 10, 11 },
-/* 218:    1,    3, 4,    6, 7,  */  {   8,  4,  9,  5,  9,  4,  9,  5, 10,  9, 10,  1,  2,  1, 10,  1,  2,  0,  3,  0,  2,  0,  3,  8,  0,  8,  9 }
-};
-//_____________________________________________________________________________
-
-
-//_____________________________________________________________________________
-/**
- * \brief tiling table for case 8
- * For each of the case above, the specific triangulation of the edge
- * intersection points is given.
- * When a case is ambiguous, there is an auxiliary table that contains
- * the face number to test and the tiling table contains the specific
- * triangulations depending on the results
- * A minus sign means to invert the result of the test.
- */
-//-----------------------------------------------------------------------------
-static const char tiling8[6][6] = {
-/*  15: 0, 1, 2, 3,              */  { 9,  8, 10, 10,  8, 11 },
-/*  51: 0, 1,       4, 5,        */  { 1,  5,  3,  3,  5,  7 },
-/* 153: 0,       3, 4,       7,  */  { 0,  4,  2,  4,  6,  2 },
-/* 102:    1, 2,       5, 6,     */  { 0,  2,  4,  4,  2,  6 },
-/* 204:       2, 3,       6, 7,  */  { 1,  3,  5,  3,  7,  5 },
-/* 240:             4, 5, 6, 7,  */  { 9, 10,  8, 10, 11,  8 }
-};
-//_____________________________________________________________________________
-
-
-//_____________________________________________________________________________
-/**
- * \brief tiling table for case 9
- * For each of the case above, the specific triangulation of the edge
- * intersection points is given.
- * When a case is ambiguous, there is an auxiliary table that contains
- * the face number to test and the tiling table contains the specific
- * triangulations depending on the results
- * A minus sign means to invert the result of the test.
- */
-//-----------------------------------------------------------------------------
-static const char tiling9[8][12] = {
-/*  39: 0, 1, 2,       5,        */  {  2, 10,  5,  3,  2,  5,  3,  5,  4,  3,  4,  8 },
-/*  27: 0, 1,    3, 4,           */  {  4,  7, 11,  9,  4, 11,  9, 11,  2,  9,  2,  1 },
-/* 141: 0,    2, 3,          7,  */  { 10,  7,  6,  1,  7, 10,  1,  8,  7,  1,  0,  8 },
-/* 177: 0,          4, 5,    7,  */  {  3,  6, 11,  0,  6,  3,  0,  5,  6,  0,  9,  5 },
-/*  78:    1, 2, 3,       6,     */  {  3, 11,  6,  0,  3,  6,  0,  6,  5,  0,  5,  9 },
-/* 114:    1,       4, 5, 6,     */  { 10,  6,  7,  1, 10,  7,  1,  7,  8,  1,  8,  0 },
-/* 228:       2,       5, 6, 7,  */  {  4, 11,  7,  9, 11,  4,  9,  2, 11,  9,  1,  2 },
-/* 216:          3, 4,    6, 7,  */  {  2,  5, 10,  3,  5,  2,  3,  4,  5,  3,  8,  4 }
-};
-//_____________________________________________________________________________
-
-
-
-//_____________________________________________________________________________
-/**
- * \brief test table for case 10
- * 2 faces to test + eventually the interior
- * When the tests on both specified faces are positive : 4 middle triangles (1)
- * When the test on the first  specified face is positive : 8 first triangles
- * When the test on the second specified face is positive : 8 next triangles
- * When the tests on both specified faces are negative :
- * - if the test on the interior is negative : 4 middle triangles
- * - if the test on the interior is positive : 8 last triangles
- *
- * For each of the case above, the specific triangulation of the edge
- * intersection points is given.
- * When a case is ambiguous, there is an auxiliary table that contains
- * the face number to test and the tiling table contains the specific
- * triangulations depending on the results
- * A minus sign means to invert the result of the test.
- */
-//-----------------------------------------------------------------------------
-static const char test10[6][3] = {
-/* 195: 0, 1,             6, 7,  */  {  2,  4,  7 },
-/*  85: 0,    2,    4,    6,     */  {  5,  6,  7 },
-/* 105: 0,       3,    5, 6,     */  {  1,  3,  7 },
-/* 150:    1, 2,    4,       7,  */  {  1,  3,  7 },
-/* 170:    1,    3,    5,    7,  */  {  5,  6,  7 },
-/*  60:       2, 3, 4, 5,        */  {  2,  4,  7 }
-};
-
-//_____________________________________________________________________________
-/**
- * \brief tiling table for case 10.1.1
- * For each of the case above, the specific triangulation of the edge
- * intersection points is given.
- * When a case is ambiguous, there is an auxiliary table that contains
- * the face number to test and the tiling table contains the specific
- * triangulations depending on the results
- * A minus sign means to invert the result of the test.
- */
-//-----------------------------------------------------------------------------
-static const char tiling10_1_1[6][12] = {
-/* 195: 0, 1,             6, 7,  */  {  5, 10,  7, 11,  7, 10,  8,  1,  9,  1,  8,  3 },
-/*  85: 0,    2,    4,    6,     */  {  1,  2,  5,  6,  5,  2,  4,  3,  0,  3,  4,  7 },
-/* 105: 0,       3,    5, 6,     */  { 11,  0,  8,  0, 11,  2,  4,  9,  6, 10,  6,  9 },
-/* 150:    1, 2,    4,       7,  */  {  9,  0, 10,  2, 10,  0,  6,  8,  4,  8,  6, 11 },
-/* 170:    1,    3,    5,    7,  */  {  7,  2,  3,  2,  7,  6,  0,  1,  4,  5,  4,  1 },
-/*  60:       2, 3, 4, 5,        */  {  7,  9,  5,  9,  7,  8, 10,  1, 11,  3, 11,  1 }
-};
-
-//_____________________________________________________________________________
-/**
- * \brief tiling table for case 10.1.1 inverted
- * For each of the case above, the specific triangulation of the edge
- * intersection points is given.
- * When a case is ambiguous, there is an auxiliary table that contains
- * the face number to test and the tiling table contains the specific
- * triangulations depending on the results
- * A minus sign means to invert the result of the test.
- */
-//-----------------------------------------------------------------------------
-static const char tiling10_1_1_[6][12] = {
-/* 195: 0, 1,             6, 7,  */  {  5,  9,  7,  8,  7,  9, 11,  1, 10,  1, 11,  3 },
-/*  85: 0,    2,    4,    6,     */  {  3,  2,  7,  6,  7,  2,  4,  1,  0,  1,  4,  5 },
-/* 105: 0,       3,    5, 6,     */  { 10,  0,  9,  0, 10,  2,  4,  8,  6, 11,  6,  8 },
-/* 150:    1, 2,    4,       7,  */  {  8,  0, 11,  2, 11,  0,  6,  9,  4,  9,  6, 10 },
-/* 170:    1,    3,    5,    7,  */  {  5,  2,  1,  2,  5,  6,  0,  3,  4,  7,  4,  3 },
-/*  60:       2, 3, 4, 5,        */  {  7, 10,  5, 10,  7, 11,  9,  1,  8,  3,  8,  1 }
-};
-
-//_____________________________________________________________________________
-/**
- * \brief tiling table for case 10.1.2
- * For each of the case above, the specific triangulation of the edge
- * intersection points is given.
- * When a case is ambiguous, there is an auxiliary table that contains
- * the face number to test and the tiling table contains the specific
- * triangulations depending on the results
- * A minus sign means to invert the result of the test.
- */
-//-----------------------------------------------------------------------------
-static const char tiling10_1_2[6][24] = {
-/* 195: 0, 1,             6, 7,  */  {  3, 11,  7,  3,  7,  8,  9,  8,  7,  5,  9,  7,  9,  5, 10,  9, 10,  1,  3,  1, 10, 11,  3, 10 },
-/*  85: 0,    2,    4,    6,     */  {  7,  6,  5,  7,  5,  4,  0,  4,  5,  1,  0,  5,  0,  1,  2,  0,  2,  3,  7,  3,  2,  6,  7,  2 },
-/* 105: 0,       3,    5, 6,     */  { 11,  2, 10,  6, 11, 10, 11,  6,  4, 11,  4,  8,  0,  8,  4,  9,  0,  4,  0,  9, 10,  0, 10,  2 },
-/* 150:    1, 2,    4,       7,  */  { 11,  2, 10, 11, 10,  6,  4,  6, 10,  9,  4, 10,  4,  9,  0,  4,  0,  8, 11,  8,  0,  2, 11,  0 },
-/* 170:    1,    3,    5,    7,  */  {  7,  6,  5,  4,  7,  5,  7,  4,  0,  7,  0,  3,  2,  3,  0,  1,  2,  0,  2,  1,  5,  2,  5,  6 },
-/*  60:       2, 3, 4, 5,        */  {  7,  8,  3, 11,  7,  3,  7, 11, 10,  7, 10,  5,  9,  5, 10,  1,  9, 10,  9,  1,  3,  9,  3,  8 }
-};
-
-//_____________________________________________________________________________
-/**
- * \brief tiling table for case 10.2
- * For each of the case above, the specific triangulation of the edge
- * intersection points is given.
- * When a case is ambiguous, there is an auxiliary table that contains
- * the face number to test and the tiling table contains the specific
- * triangulations depending on the results
- * A minus sign means to invert the result of the test.
- */
-//-----------------------------------------------------------------------------
-static const char tiling10_2[6][24] = {
-/* 195: 0, 1,             6, 7,  */  { 12,  5,  9, 12,  9,  8, 12,  8,  3, 12,  3,  1, 12,  1, 10, 12, 10, 11, 12, 11,  7, 12,  7,  5 },
-/*  85: 0,    2,    4,    6,     */  { 12,  1,  0, 12,  0,  4, 12,  4,  7, 12,  7,  3, 12,  3,  2, 12,  2,  6, 12,  6,  5, 12,  5,  1 },
-/* 105: 0,       3,    5, 6,     */  {  4,  8, 12,  6,  4, 12, 10,  6, 12,  9, 10, 12,  0,  9, 12,  2,  0, 12, 11,  2, 12,  8, 11, 12 },
-/* 150:    1, 2,    4,       7,  */  { 12,  9,  4, 12,  4,  6, 12,  6, 11, 12, 11,  8, 12,  8,  0, 12,  0,  2, 12,  2, 10, 12, 10,  9 },
-/* 170:    1,    3,    5,    7,  */  {  0,  3, 12,  4,  0, 12,  5,  4, 12,  1,  5, 12,  2,  1, 12,  6,  2, 12,  7,  6, 12,  3,  7, 12 },
-/*  60:       2, 3, 4, 5,        */  { 10,  5, 12, 11, 10, 12,  3, 11, 12,  1,  3, 12,  9,  1, 12,  8,  9, 12,  7,  8, 12,  5,  7, 12 }
-};
-
-//_____________________________________________________________________________
-/**
- * \brief tiling table for case 10.2 inverted
- * For each of the case above, the specific triangulation of the edge
- * intersection points is given.
- * When a case is ambiguous, there is an auxiliary table that contains
- * the face number to test and the tiling table contains the specific
- * triangulations depending on the results
- * A minus sign means to invert the result of the test.
- */
-//-----------------------------------------------------------------------------
-static const char tiling10_2_[6][24] = {
-/* 195: 0, 1,             6, 7,  */  {  8,  7, 12,  9,  8, 12,  1,  9, 12,  3,  1, 12, 11,  3, 12, 10, 11, 12,  5, 10, 12,  7,  5, 12 },
-/*  85: 0,    2,    4,    6,     */  {  4,  5, 12,  0,  4, 12,  3,  0, 12,  7,  3, 12,  6,  7, 12,  2,  6, 12,  1,  2, 12,  5,  1, 12 },
-/* 105: 0,       3,    5, 6,     */  { 12, 11,  6, 12,  6,  4, 12,  4,  9, 12,  9, 10, 12, 10,  2, 12,  2,  0, 12,  0,  8, 12,  8, 11 },
-/* 150:    1, 2,    4,       7,  */  {  6, 10, 12,  4,  6, 12,  8,  4, 12, 11,  8, 12,  2, 11, 12,  0,  2, 12,  9,  0, 12, 10,  9, 12 },
-/* 170:    1,    3,    5,    7,  */  { 12,  7,  4, 12,  4,  0, 12,  0,  1, 12,  1,  5, 12,  5,  6, 12,  6,  2, 12,  2,  3, 12,  3,  7 },
-/*  60:       2, 3, 4, 5,        */  { 12,  7, 11, 12, 11, 10, 12, 10,  1, 12,  1,  3, 12,  3,  8, 12,  8,  9, 12,  9,  5, 12,  5,  7 }
-};
-//_____________________________________________________________________________
-
-
-//_____________________________________________________________________________
-/**
- * \brief tiling table for case 11
- * For each of the case above, the specific triangulation of the edge
- * intersection points is given.
- * When a case is ambiguous, there is an auxiliary table that contains
- * the face number to test and the tiling table contains the specific
- * triangulations depending on the results
- * A minus sign means to invert the result of the test.
- */
-//-----------------------------------------------------------------------------
-static const char tiling11[12][12] = {
-/*  23: 0, 1, 2,    4,           */  { 2, 10,  9,  2,  9,  7,  2,  7,  3,  7,  9,  4 },
-/* 139: 0, 1,    3,          7,  */  { 1,  6,  2,  1,  8,  6,  1,  9,  8,  8,  7,  6 },
-/*  99: 0, 1,          5, 6,     */  { 8,  3,  1,  8,  1,  6,  8,  6,  4,  6,  1, 10 },
-/*  77: 0,    2, 3,       6,     */  { 0,  8, 11,  0, 11,  5,  0,  5,  1,  5, 11,  6 },
-/*  57: 0,       3, 4, 5,        */  { 9,  5,  7,  9,  7,  2,  9,  2,  0,  2,  7, 11 },
-/* 209: 0,          4,    6, 7,  */  { 5,  0,  4,  5, 11,  0,  5, 10, 11, 11,  3,  0 },
-/*  46:    1, 2, 3,    5,        */  { 5,  4,  0,  5,  0, 11,  5, 11, 10, 11,  0,  3 },
-/* 198:    1, 2,          6, 7,  */  { 9,  7,  5,  9,  2,  7,  9,  0,  2,  2, 11,  7 },
-/* 178:    1,       4, 5,    7,  */  { 0, 11,  8,  0,  5, 11,  0,  1,  5,  5,  6, 11 },
-/* 156:       2, 3, 4,       7,  */  { 8,  1,  3,  8,  6,  1,  8,  4,  6,  6, 10,  1 },
-/* 116:       2,    4, 5, 6,     */  { 1,  2,  6,  1,  6,  8,  1,  8,  9,  8,  6,  7 },
-/* 232:          3,    5, 6, 7,  */  { 2,  9, 10,  2,  7,  9,  2,  3,  7,  7,  4,  9 }
-};
-//_____________________________________________________________________________
-
-
-//_____________________________________________________________________________
-/**
- * \brief test table for case 12
- * 2 faces to test + eventually the interior
- * When the tests on both specified faces are positive : 4 middle triangles (1)
- * When the test on the first  specified face is positive : 8 first triangles
- * When the test on the second specified face is positive : 8 next triangles
- * When the tests on both specified faces are negative :
- * - if the test on the interior is negative : 4 middle triangles
- * - if the test on the interior is positive : 8 last triangles
- * The support edge for the interior test is marked as the 4th column.
- *
- * For each of the case above, the specific triangulation of the edge
- * intersection points is given.
- * When a case is ambiguous, there is an auxiliary table that contains
- * the face number to test and the tiling table contains the specific
- * triangulations depending on the results
- * A minus sign means to invert the result of the test.
- */
-//-----------------------------------------------------------------------------
-static const char test12[24][4] = {
-/* 135: 0, 1, 2,             7,  */  {  4,  3,  7,  11 },
-/*  75: 0, 1,    3,       6,     */  {  3,  2,  7,  10 },
-/*  83: 0, 1,       4,    6,     */  {  2,  6,  7,   5 },
-/* 163: 0, 1,          5,    7,  */  {  6,  4,  7,   7 },
-/*  45: 0,    2, 3,    5,        */  {  2,  1,  7,   9 },
-/*  53: 0,    2,    4, 5,        */  {  5,  2,  7,   1 },
-/* 149: 0,    2,    4,       7,  */  {  5,  3,  7,   2 },
-/* 101: 0,    2,       5, 6,     */  {  5,  1,  7,   0 },
-/* 197: 0,    2,          6, 7,  */  {  5,  4,  7,   3 },
-/*  89: 0,       3, 4,    6,     */  {  6,  3,  7,   6 },
-/* 169: 0,       3,    5,    7,  */  {  1,  6,  7,   4 },
-/* 225: 0,             5, 6, 7,  */  {  1,  4,  7,   8 },
-/*  30:    1, 2, 3, 4,           */  {  4,  1,  7,   8 },
-/*  86:    1, 2,    4,    6,     */  {  6,  1,  7,   4 },
-/* 166:    1, 2,       5,    7,  */  {  3,  6,  7,   6 },
-/*  58:    1,    3, 4, 5,        */  {  4,  5,  7,   3 },
-/* 154:    1,    3, 4,       7,  */  {  1,  5,  7,   0 },
-/* 106:    1,    3,    5, 6,     */  {  3,  5,  7,   2 },
-/* 202:    1,    3,       6, 7,  */  {  2,  5,  7,   1 },
-/* 210:    1,       4,    6, 7,  */  {  1,  2,  7,   9 },
-/*  92:       2, 3, 4,    6,     */  {  4,  6,  7,   7 },
-/* 172:       2, 3,    5,    7,  */  {  6,  2,  7,   5 },
-/* 180:       2,    4, 5,    7,  */  {  2,  3,  7,  10 },
-/* 120:          3, 4, 5, 6,     */  {  3,  4,  7,  11 }
-};
-
-//_____________________________________________________________________________
-/**
- * \brief tiling table for case 12.1.1
- * For each of the case above, the specific triangulation of the edge
- * intersection points is given.
- * When a case is ambiguous, there is an auxiliary table that contains
- * the face number to test and the tiling table contains the specific
- * triangulations depending on the results
- * A minus sign means to invert the result of the test.
- */
-//-----------------------------------------------------------------------------
-static const char tiling12_1_1[24][12] = {
-/* 135: 0, 1, 2,             7,  */  {  7,  6, 11, 10,  3,  2,  3, 10,  8,  9,  8, 10 },
-/*  75: 0, 1,    3,       6,     */  {  6,  5, 10,  9,  2,  1,  2,  9, 11,  8, 11,  9 },
-/*  83: 0, 1,       4,    6,     */  { 10,  6,  5,  7,  9,  4,  9,  7,  1,  3,  1,  7 },
-/* 163: 0, 1,          5,    7,  */  {  7,  6, 11,  4,  8,  5,  3,  5,  8,  5,  3,  1 },
-/*  45: 0,    2, 3,    5,        */  {  5,  4,  9,  8,  1,  0,  1,  8, 10, 11, 10,  8 },
-/*  53: 0,    2,    4, 5,        */  {  1,  2, 10,  0,  9,  3,  5,  3,  9,  3,  5,  7 },
-/* 149: 0,    2,    4,       7,  */  { 10,  1,  2,  0, 11,  3, 11,  0,  6,  4,  6,  0 },
-/* 101: 0,    2,       5, 6,     */  {  8,  3,  0,  2,  9,  1,  9,  2,  4,  6,  4,  2 },
-/* 197: 0,    2,          6, 7,  */  {  3,  0,  8,  2, 11,  1,  7,  1, 11,  1,  7,  5 },
-/*  89: 0,       3, 4,    6,     */  {  6,  5, 10,  7, 11,  4,  2,  4, 11,  4,  2,  0 },
-/* 169: 0,       3,    5,    7,  */  {  9,  5,  4,  6,  8,  7,  8,  6,  0,  2,  0,  6 },
-/* 225: 0,             5, 6, 7,  */  {  8,  3,  0,  7,  4, 11,  9, 11,  4, 11,  9, 10 },
-/*  30:    1, 2, 3, 4,           */  {  4,  7,  8, 11,  0,  3,  0, 11,  9, 10,  9, 11 },
-/*  86:    1, 2,    4,    6,     */  {  4,  7,  8,  5,  9,  6,  0,  6,  9,  6,  0,  2 },
-/* 166:    1, 2,       5,    7,  */  { 11,  7,  6,  4, 10,  5, 10,  4,  2,  0,  2,  4 },
-/*  58:    1,    3, 4, 5,        */  { 11,  2,  3,  1,  8,  0,  8,  1,  7,  5,  7,  1 },
-/* 154:    1,    3, 4,       7,  */  {  0,  1,  9,  3,  8,  2,  4,  2,  8,  2,  4,  6 },
-/* 106:    1,    3,    5, 6,     */  {  2,  3, 11,  1, 10,  0,  6,  0, 10,  0,  6,  4 },
-/* 202:    1,    3,       6, 7,  */  {  9,  0,  1,  3, 10,  2, 10,  3,  5,  7,  5,  3 },
-/* 210:    1,       4,    6, 7,  */  {  9,  0,  1,  4,  5,  8, 10,  8,  5,  8, 10, 11 },
-/*  92:       2, 3, 4,    6,     */  {  8,  4,  7,  5, 11,  6, 11,  5,  3,  1,  3,  5 },
-/* 172:       2, 3,    5,    7,  */  {  5,  4,  9,  6, 10,  7,  1,  7, 10,  7,  1,  3 },
-/* 180:       2,    4, 5,    7,  */  { 10,  1,  2,  5,  6,  9, 11,  9,  6,  9, 11,  8 },
-/* 120:          3, 4, 5, 6,     */  { 11,  2,  3,  6,  7, 10,  8, 10,  7, 10,  8,  9 }
-};
-
-//_____________________________________________________________________________
-/**
- * \brief tiling table for case 12.1.1 inverted
- * For each of the case above, the specific triangulation of the edge
- * intersection points is given.
- * When a case is ambiguous, there is an auxiliary table that contains
- * the face number to test and the tiling table contains the specific
- * triangulations depending on the results
- * A minus sign means to invert the result of the test.
- */
-//-----------------------------------------------------------------------------
-static const char tiling12_1_1_[24][12] = {
-/* 135: 0, 1, 2,             7,  */  {  3,  2, 11, 10,  7,  6,  7, 10,  8,  9,  8, 10 },
-/*  75: 0, 1,    3,       6,     */  {  2,  1, 10,  9,  6,  5,  6,  9, 11,  8, 11,  9 },
-/*  83: 0, 1,       4,    6,     */  {  9,  4,  5,  7, 10,  6, 10,  7,  1,  3,  1,  7 },
-/* 163: 0, 1,          5,    7,  */  {  7,  4,  8,  6, 11,  5,  3,  5, 11,  5,  3,  1 },
-/*  45: 0,    2, 3,    5,        */  {  1,  0,  9,  8,  5,  4,  5,  8, 10, 11, 10,  8 },
-/*  53: 0,    2,    4, 5,        */  {  1,  0,  9,  2, 10,  3,  5,  3, 10,  3,  5,  7 },
-/* 149: 0,    2,    4,       7,  */  { 11,  3,  2,  0, 10,  1, 10,  0,  6,  4,  6,  0 },
-/* 101: 0,    2,       5, 6,     */  {  9,  1,  0,  2,  8,  3,  8,  2,  4,  6,  4,  2 },
-/* 197: 0,    2,          6, 7,  */  {  3,  2, 11,  0,  8,  1,  7,  1,  8,  1,  7,  5 },
-/*  89: 0,       3, 4,    6,     */  {  6,  7, 11,  5, 10,  4,  2,  4, 10,  4,  2,  0 },
-/* 169: 0,       3,    5,    7,  */  {  8,  7,  4,  6,  9,  5,  9,  6,  0,  2,  0,  6 },
-/* 225: 0,             5, 6, 7,  */  {  8,  7,  4,  3,  0, 11,  9, 11,  0, 11,  9, 10 },
-/*  30:    1, 2, 3, 4,           */  {  0,  3,  8, 11,  4,  7,  4, 11,  9, 10,  9, 11 },
-/*  86:    1, 2,    4,    6,     */  {  4,  5,  9,  7,  8,  6,  0,  6,  8,  6,  0,  2 },
-/* 166:    1, 2,       5,    7,  */  { 10,  5,  6,  4, 11,  7, 11,  4,  2,  0,  2,  4 },
-/*  58:    1,    3, 4, 5,        */  {  8,  0,  3,  1, 11,  2, 11,  1,  7,  5,  7,  1 },
-/* 154:    1,    3, 4,       7,  */  {  0,  3,  8,  1,  9,  2,  4,  2,  9,  2,  4,  6 },
-/* 106:    1,    3,    5, 6,     */  {  2,  1, 10,  3, 11,  0,  6,  0, 11,  0,  6,  4 },
-/* 202:    1,    3,       6, 7,  */  { 10,  2,  1,  3,  9,  0,  9,  3,  5,  7,  5,  3 },
-/* 210:    1,       4,    6, 7,  */  {  9,  4,  5,  0,  1,  8, 10,  8,  1,  8, 10, 11 },
-/*  92:       2, 3, 4,    6,     */  { 11,  6,  7,  5,  8,  4,  8,  5,  3,  1,  3,  5 },
-/* 172:       2, 3,    5,    7,  */  {  5,  6, 10,  4,  9,  7,  1,  7,  9,  7,  1,  3 },
-/* 180:       2,    4, 5,    7,  */  { 10,  5,  6,  1,  2,  9, 11,  9,  2,  9, 11,  8 },
-/* 120:          3, 4, 5, 6,     */  { 11,  6,  7,  2,  3, 10,  8, 10,  3, 10,  8,  9 }
-};
-
-//_____________________________________________________________________________
-/**
- * \brief tiling table for case 12.1.2
- * For each of the case above, the specific triangulation of the edge
- * intersection points is given.
- * When a case is ambiguous, there is an auxiliary table that contains
- * the face number to test and the tiling table contains the specific
- * triangulations depending on the results
- * A minus sign means to invert the result of the test.
- */
-//-----------------------------------------------------------------------------
-static const char tiling12_1_2[24][24] = {
-/* 135: 0, 1, 2,             7,  */  {  7,  3, 11,  3,  7,  8,  9,  8,  7,  6,  9,  7,  9,  6, 10,  2, 10,  6, 11,  2,  6,  2, 11,  3 },
-/*  75: 0, 1,    3,       6,     */  {  6,  2, 10,  2,  6, 11,  8, 11,  6,  5,  8,  6,  8,  5,  9,  1,  9,  5, 10,  1,  5,  1, 10,  2 },
-/*  83: 0, 1,       4,    6,     */  { 10,  9,  5,  9, 10,  1,  3,  1, 10,  6,  3, 10,  3,  6,  7,  4,  7,  6,  5,  4,  6,  4,  5,  9 },
-/* 163: 0, 1,          5,    7,  */  {  7,  8, 11,  3, 11,  8, 11,  3,  1, 11,  1,  6,  5,  6,  1,  6,  5,  4,  6,  4,  7,  8,  7,  4 },
-/*  45: 0,    2, 3,    5,        */  {  5,  1,  9,  1,  5, 10, 11, 10,  5,  4, 11,  5, 11,  4,  8,  0,  8,  4,  9,  0,  4,  0,  9,  1 },
-/*  53: 0,    2,    4, 5,        */  {  1,  9, 10,  5, 10,  9, 10,  5,  7, 10,  7,  2,  3,  2,  7,  2,  3,  0,  2,  0,  1,  9,  1,  0 },
-/* 149: 0,    2,    4,       7,  */  { 10, 11,  2, 11, 10,  6,  4,  6, 10,  1,  4, 10,  4,  1,  0,  3,  0,  1,  2,  3,  1,  3,  2, 11 },
-/* 101: 0,    2,       5, 6,     */  {  8,  9,  0,  9,  8,  4,  6,  4,  8,  3,  6,  8,  6,  3,  2,  1,  2,  3,  0,  1,  3,  1,  0,  9 },
-/* 197: 0,    2,          6, 7,  */  {  3, 11,  8,  7,  8, 11,  8,  7,  5,  8,  5,  0,  1,  0,  5,  0,  1,  2,  0,  2,  3, 11,  3,  2 },
-/*  89: 0,       3, 4,    6,     */  {  6, 11, 10,  2, 10, 11, 10,  2,  0, 10,  0,  5,  4,  5,  0,  5,  4,  7,  5,  7,  6, 11,  6,  7 },
-/* 169: 0,       3,    5,    7,  */  {  9,  8,  4,  8,  9,  0,  2,  0,  9,  5,  2,  9,  2,  5,  6,  7,  6,  5,  4,  7,  5,  7,  4,  8 },
-/* 225: 0,             5, 6, 7,  */  {  8,  4,  0,  9,  0,  4,  0,  9, 10,  0, 10,  3, 11,  3, 10,  3, 11,  7,  3,  7,  8,  4,  8,  7 },
-/*  30:    1, 2, 3, 4,           */  {  4,  0,  8,  0,  4,  9, 10,  9,  4,  7, 10,  4, 10,  7, 11,  3, 11,  7,  8,  3,  7,  3,  8,  0 },
-/*  86:    1, 2,    4,    6,     */  {  4,  9,  8,  0,  8,  9,  8,  0,  2,  8,  2,  7,  6,  7,  2,  7,  6,  5,  7,  5,  4,  9,  4,  5 },
-/* 166:    1, 2,       5,    7,  */  { 11, 10,  6, 10, 11,  2,  0,  2, 11,  7,  0, 11,  0,  7,  4,  5,  4,  7,  6,  5,  7,  5,  6, 10 },
-/*  58:    1,    3, 4, 5,        */  { 11,  8,  3,  8, 11,  7,  5,  7, 11,  2,  5, 11,  5,  2,  1,  0,  1,  2,  3,  0,  2,  0,  3,  8 },
-/* 154:    1,    3, 4,       7,  */  {  0,  8,  9,  4,  9,  8,  9,  4,  6,  9,  6,  1,  2,  1,  6,  1,  2,  3,  1,  3,  0,  8,  0,  3 },
-/* 106:    1,    3,    5, 6,     */  {  2, 10, 11,  6, 11, 10, 11,  6,  4, 11,  4,  3,  0,  3,  4,  3,  0,  1,  3,  1,  2, 10,  2,  1 },
-/* 202:    1,    3,       6, 7,  */  {  9, 10,  1, 10,  9,  5,  7,  5,  9,  0,  7,  9,  7,  0,  3,  2,  3,  0,  1,  2,  0,  2,  1, 10 },
-/* 210:    1,       4,    6, 7,  */  {  9,  5,  1, 10,  1,  5,  1, 10, 11,  1, 11,  0,  8,  0, 11,  0,  8,  4,  0,  4,  9,  5,  9,  4 },
-/*  92:       2, 3, 4,    6,     */  {  8, 11,  7, 11,  8,  3,  1,  3,  8,  4,  1,  8,  1,  4,  5,  6,  5,  4,  7,  6,  4,  6,  7, 11 },
-/* 172:       2, 3,    5,    7,  */  {  5, 10,  9,  1,  9, 10,  9,  1,  3,  9,  3,  4,  7,  4,  3,  4,  7,  6,  4,  6,  5, 10,  5,  6 },
-/* 180:       2,    4, 5,    7,  */  { 10,  6,  2, 11,  2,  6,  2, 11,  8,  2,  8,  1,  9,  1,  8,  1,  9,  5,  1,  5, 10,  6, 10,  5 },
-/* 120:          3, 4, 5, 6,     */  { 11,  7,  3,  8,  3,  7,  3,  8,  9,  3,  9,  2, 10,  2,  9,  2, 10,  6,  2,  6, 11,  7, 11,  6 }
-};
-
-//_____________________________________________________________________________
-/**
- * \brief tiling table for case 12.2
- * For each of the case above, the specific triangulation of the edge
- * intersection points is given.
- * When a case is ambiguous, there is an auxiliary table that contains
- * the face number to test and the tiling table contains the specific
- * triangulations depending on the results
- * A minus sign means to invert the result of the test.
- */
-//-----------------------------------------------------------------------------
-static const char tiling12_2[24][24] = {
-/* 135: 0, 1, 2,             7,  */  {   9,  8, 12, 10,  9, 12,  2, 10, 12,  3,  2, 12, 11,  3, 12,  6, 11, 12,  7,  6, 12,  8,  7, 12 },
-/*  75: 0, 1,    3,       6,     */  {   8, 11, 12,  9,  8, 12,  1,  9, 12,  2,  1, 12, 10,  2, 12,  5, 10, 12,  6,  5, 12, 11,  6, 12 },
-/*  83: 0, 1,       4,    6,     */  {   3,  1, 12,  7,  3, 12,  4,  7, 12,  9,  4, 12,  5,  9, 12,  6,  5, 12, 10,  6, 12,  1, 10, 12 },
-/* 163: 0, 1,          5,    7,  */  {  12,  3,  1, 12,  1,  5, 12,  5,  6, 12,  6, 11, 12, 11,  7, 12,  7,  4, 12,  4,  8, 12,  8,  3 },
-/*  45: 0,    2, 3,    5,        */  {  11, 10, 12,  8, 11, 12,  0,  8, 12,  1,  0, 12,  9,  1, 12,  4,  9, 12,  5,  4, 12, 10,  5, 12 },
-/*  53: 0,    2,    4, 5,        */  {  12,  5,  7, 12,  7,  3, 12,  3,  2, 12,  2, 10, 12, 10,  1, 12,  1,  0, 12,  0,  9, 12,  9,  5 },
-/* 149: 0,    2,    4,       7,  */  {   4,  6, 12,  0,  4, 12,  1,  0, 12, 10,  1, 12,  2, 10, 12,  3,  2, 12, 11,  3, 12,  6, 11, 12 },
-/* 101: 0,    2,       5, 6,     */  {   6,  4, 12,  2,  6, 12,  3,  2, 12,  8,  3, 12,  0,  8, 12,  1,  0, 12,  9,  1, 12,  4,  9, 12 },
-/* 197: 0,    2,          6, 7,  */  {  12,  7,  5, 12,  5,  1, 12,  1,  0, 12,  0,  8, 12,  8,  3, 12,  3,  2, 12,  2, 11, 12, 11,  7 },
-/*  89: 0,       3, 4,    6,     */  {  12,  2,  0, 12,  0,  4, 12,  4,  5, 12,  5, 10, 12, 10,  6, 12,  6,  7, 12,  7, 11, 12, 11,  2 },
-/* 169: 0,       3,    5,    7,  */  {   2,  0, 12,  6,  2, 12,  7,  6, 12,  8,  7, 12,  4,  8, 12,  5,  4, 12,  9,  5, 12,  0,  9, 12 },
-/* 225: 0,             5, 6, 7,  */  {  12,  9, 10, 12, 10, 11, 12, 11,  7, 12,  7,  4, 12,  4,  8, 12,  8,  3, 12,  3,  0, 12,  0,  9 },
-/*  30:    1, 2, 3, 4,           */  {  10,  9, 12, 11, 10, 12,  7, 11, 12,  4,  7, 12,  8,  4, 12,  3,  8, 12,  0,  3, 12,  9,  0, 12 },
-/*  86:    1, 2,    4,    6,     */  {  12,  0,  2, 12,  2,  6, 12,  6,  7, 12,  7,  8, 12,  8,  4, 12,  4,  5, 12,  5,  9, 12,  9,  0 },
-/* 166:    1, 2,       5,    7,  */  {   0,  2, 12,  4,  0, 12,  5,  4, 12, 10,  5, 12,  6, 10, 12,  7,  6, 12, 11,  7, 12,  2, 11, 12 },
-/*  58:    1,    3, 4, 5,        */  {   5,  7, 12,  1,  5, 12,  0,  1, 12,  8,  0, 12,  3,  8, 12,  2,  3, 12, 11,  2, 12,  7, 11, 12 },
-/* 154:    1,    3, 4,       7,  */  {  12,  4,  6, 12,  6,  2, 12,  2,  3, 12,  3,  8, 12,  8,  0, 12,  0,  1, 12,  1,  9, 12,  9,  4 },
-/* 106:    1,    3,    5, 6,     */  {  12,  6,  4, 12,  4,  0, 12,  0,  1, 12,  1, 10, 12, 10,  2, 12,  2,  3, 12,  3, 11, 12, 11,  6 },
-/* 202:    1,    3,       6, 7,  */  {   7,  5, 12,  3,  7, 12,  2,  3, 12, 10,  2, 12,  1, 10, 12,  0,  1, 12,  9,  0, 12,  5,  9, 12 },
-/* 210:    1,       4,    6, 7,  */  {  12, 10, 11, 12, 11,  8, 12,  8,  0, 12,  0,  1, 12,  1,  9, 12,  9,  4, 12,  4,  5, 12,  5, 10 },
-/*  92:       2, 3, 4,    6,     */  {   1,  3, 12,  5,  1, 12,  6,  5, 12, 11,  6, 12,  7, 11, 12,  4,  7, 12,  8,  4, 12,  3,  8, 12 },
-/* 172:       2, 3,    5,    7,  */  {  12,  1,  3, 12,  3,  7, 12,  7,  4, 12,  4,  9, 12,  9,  5, 12,  5,  6, 12,  6, 10, 12, 10,  1 },
-/* 180:       2,    4, 5,    7,  */  {  12, 11,  8, 12,  8,  9, 12,  9,  1, 12,  1,  2, 12,  2, 10, 12, 10,  5, 12,  5,  6, 12,  6, 11 },
-/* 120:          3, 4, 5, 6,     */  {  12,  8,  9, 12,  9, 10, 12, 10,  2, 12,  2,  3, 12,  3, 11, 12, 11,  6, 12,  6,  7, 12,  7,  8 }
-};
-
-//_____________________________________________________________________________
-/**
- * \brief tiling table for case 12.2 inverted
- * For each of the case above, the specific triangulation of the edge
- * intersection points is given.
- * When a case is ambiguous, there is an auxiliary table that contains
- * the face number to test and the tiling table contains the specific
- * triangulations depending on the results
- * A minus sign means to invert the result of the test.
- */
-//-----------------------------------------------------------------------------
-static const char tiling12_2_[24][24] = {
-/* 135: 0, 1, 2,             7,  */  { 12,  2, 11, 12, 11,  7, 12,  7,  6, 12,  6, 10, 12, 10,  9, 12,  9,  8, 12,  8,  3, 12,  3,  2 },
-/*  75: 0, 1,    3,       6,     */  { 12,  1, 10, 12, 10,  6, 12,  6,  5, 12,  5,  9, 12,  9,  8, 12,  8, 11, 12, 11,  2, 12,  2,  1 },
-/*  83: 0, 1,       4,    6,     */  { 12,  4,  5, 12,  5, 10, 12, 10,  6, 12,  6,  7, 12,  7,  3, 12,  3,  1, 12,  1,  9, 12,  9,  4 },
-/* 163: 0, 1,          5,    7,  */  {  7,  6, 12,  8,  7, 12,  4,  8, 12,  5,  4, 12,  1,  5, 12,  3,  1, 12, 11,  3, 12,  6, 11, 12 },
-/*  45: 0,    2, 3,    5,        */  { 12,  0,  9, 12,  9,  5, 12,  5,  4, 12,  4,  8, 12,  8, 11, 12, 11, 10, 12, 10,  1, 12,  1,  0 },
-/*  53: 0,    2,    4, 5,        */  {  1,  2, 12,  9,  1, 12,  0,  9, 12,  3,  0, 12,  7,  3, 12,  5,  7, 12, 10,  5, 12,  2, 10, 12 },
-/* 149: 0,    2,    4,       7,  */  { 12,  1,  2, 12,  2, 11, 12, 11,  3, 12,  3,  0, 12,  0,  4, 12,  4,  6, 12,  6, 10, 12, 10,  1 },
-/* 101: 0,    2,       5, 6,     */  { 12,  3,  0, 12,  0,  9, 12,  9,  1, 12,  1,  2, 12,  2,  6, 12,  6,  4, 12,  4,  8, 12,  8,  3 },
-/* 197: 0,    2,          6, 7,  */  {  3,  0, 12, 11,  3, 12,  2, 11, 12,  1,  2, 12,  5,  1, 12,  7,  5, 12,  8,  7, 12,  0,  8, 12 },
-/*  89: 0,       3, 4,    6,     */  {  6,  5, 12, 11,  6, 12,  7, 11, 12,  4,  7, 12,  0,  4, 12,  2,  0, 12, 10,  2, 12,  5, 10, 12 },
-/* 169: 0,       3,    5,    7,  */  { 12,  7,  4, 12,  4,  9, 12,  9,  5, 12,  5,  6, 12,  6,  2, 12,  2,  0, 12,  0,  8, 12,  8,  7 },
-/* 225: 0,             5, 6, 7,  */  {  8,  7, 12,  0,  8, 12,  3,  0, 12, 11,  3, 12, 10, 11, 12,  9, 10, 12,  4,  9, 12,  7,  4, 12 },
-/*  30:    1, 2, 3, 4,           */  { 12,  7,  8, 12,  8,  0, 12,  0,  3, 12,  3, 11, 12, 11, 10, 12, 10,  9, 12,  9,  4, 12,  4,  7 },
-/*  86:    1, 2,    4,    6,     */  {  4,  7, 12,  9,  4, 12,  5,  9, 12,  6,  5, 12,  2,  6, 12,  0,  2, 12,  8,  0, 12,  7,  8, 12 },
-/* 166:    1, 2,       5,    7,  */  { 12,  5,  6, 12,  6, 11, 12, 11,  7, 12,  7,  4, 12,  4,  0, 12,  0,  2, 12,  2, 10, 12, 10,  5 },
-/*  58:    1,    3, 4, 5,        */  { 12,  0,  3, 12,  3, 11, 12, 11,  2, 12,  2,  1, 12,  1,  5, 12,  5,  7, 12,  7,  8, 12,  8,  0 },
-/* 154:    1,    3, 4,       7,  */  {  0,  3, 12,  9,  0, 12,  1,  9, 12,  2,  1, 12,  6,  2, 12,  4,  6, 12,  8,  4, 12,  3,  8, 12 },
-/* 106:    1,    3,    5, 6,     */  {  2,  1, 12, 11,  2, 12,  3, 11, 12,  0,  3, 12,  4,  0, 12,  6,  4, 12, 10,  6, 12,  1, 10, 12 },
-/* 202:    1,    3,       6, 7,  */  { 12,  2,  1, 12,  1,  9, 12,  9,  0, 12,  0,  3, 12,  3,  7, 12,  7,  5, 12,  5, 10, 12, 10,  2 },
-/* 210:    1,       4,    6, 7,  */  {  9,  0, 12,  5,  9, 12,  4,  5, 12,  8,  4, 12, 11,  8, 12, 10, 11, 12,  1, 10, 12,  0,  1, 12 },
-/*  92:       2, 3, 4,    6,     */  { 12,  6,  7, 12,  7,  8, 12,  8,  4, 12,  4,  5, 12,  5,  1, 12,  1,  3, 12,  3, 11, 12, 11,  6 },
-/* 172:       2, 3,    5,    7,  */  {  5,  4, 12, 10,  5, 12,  6, 10, 12,  7,  6, 12,  3,  7, 12,  1,  3, 12,  9,  1, 12,  4,  9, 12 },
-/* 180:       2,    4, 5,    7,  */  { 10,  1, 12,  6, 10, 12,  5,  6, 12,  9,  5, 12,  8,  9, 12, 11,  8, 12,  2, 11, 12,  1,  2, 12 },
-/* 120:          3, 4, 5, 6,     */  { 11,  2, 12,  7, 11, 12,  6,  7, 12, 10,  6, 12,  9, 10, 12,  8,  9, 12,  3,  8, 12,  2,  3, 12 }
-};
-//_____________________________________________________________________________
-
-
-
-//_____________________________________________________________________________
-/**
- * \brief test table for case 13
- * All faces are to be tested
- *
- * For each of the case above, the specific triangulation of the edge
- * intersection points is given.
- * When a case is ambiguous, there is an auxiliary table that contains
- * the face number to test and the tiling table contains the specific
- * triangulations depending on the results
- * A minus sign means to invert the result of the test.
- */
-//-----------------------------------------------------------------------------
-/* 13: face test */
-static const char test13[2][7] = {
-/* 165: 0,    2,       5,    7,  */  { 1,2,3,4,5,6,7 },
-/*  90:    1,    3, 4,    6,     */  { 2,3,4,1,5,6,7 },
-};
-
-
-
-//_____________________________________________________________________________
-/**
- * \brief subconfiguration table for case 13
- * Hard-coded tests for the subconfiguration determination
- *
- * For each of the case above, the specific triangulation of the edge
- * intersection points is given.
- * When a case is ambiguous, there is an auxiliary table that contains
- * the face number to test and the tiling table contains the specific
- * triangulations depending on the results
- * A minus sign means to invert the result of the test.
- */
-//-----------------------------------------------------------------------------
-/* 13: sub configs */
-static const char subconfig13[64] = {
-/*  0: 0,0,0,0,0,0 */   0,
-/*  1: 1,0,0,0,0,0 */   1,
-/*  2: 0,1,0,0,0,0 */   2,
-/*  3: 1,1,0,0,0,0 */   7,
-/*  4: 0,0,1,0,0,0 */   3,
-/*  5: 1,0,1,0,0,0 */  -1,
-/*  6: 0,1,1,0,0,0 */  11,
-/*  7: 1,1,1,0,0,0 */  -1,
-/*  8: 0,0,0,1,0,0 */   4,
-/*  9: 1,0,0,1,0,0 */   8,
-/* 10: 0,1,0,1,0,0 */  -1,
-/* 11: 1,1,0,1,0,0 */  -1,
-/* 12: 0,0,1,1,0,0 */  14,
-/* 13: 1,0,1,1,0,0 */  -1,
-/* 14: 0,1,1,1,0,0 */  -1,
-/* 15: 1,1,1,1,0,0 */  -1,
-/* 16: 0,0,0,0,1,0 */   5,
-/* 17: 1,0,0,0,1,0 */   9,
-/* 18: 0,1,0,0,1,0 */  12,
-/* 19: 1,1,0,0,1,0 */  23,
-/* 20: 0,0,1,0,1,0 */  15,
-/* 21: 1,0,1,0,1,0 */  -1,
-/* 22: 0,1,1,0,1,0 */  21,
-/* 23: 1,1,1,0,1,0 */  38,
-/* 24: 0,0,0,1,1,0 */  17,
-/* 25: 1,0,0,1,1,0 */  20,
-/* 26: 0,1,0,1,1,0 */  -1,
-/* 27: 1,1,0,1,1,0 */  36,
-/* 28: 0,0,1,1,1,0 */  26,
-/* 29: 1,0,1,1,1,0 */  33,
-/* 30: 0,1,1,1,1,0 */  30,
-/* 31: 1,1,1,1,1,0 */  44,
-/* 32: 0,0,0,0,0,1 */   6,
-/* 33: 1,0,0,0,0,1 */  10,
-/* 34: 0,1,0,0,0,1 */  13,
-/* 35: 1,1,0,0,0,1 */  19,
-/* 36: 0,0,1,0,0,1 */  16,
-/* 37: 1,0,1,0,0,1 */  -1,
-/* 38: 0,1,1,0,0,1 */  25,
-/* 39: 1,1,1,0,0,1 */  37,
-/* 40: 0,0,0,1,0,1 */  18,
-/* 41: 1,0,0,1,0,1 */  24,
-/* 42: 0,1,0,1,0,1 */  -1,
-/* 43: 1,1,0,1,0,1 */  35,
-/* 44: 0,0,1,1,0,1 */  22,
-/* 45: 1,0,1,1,0,1 */  32,
-/* 46: 0,1,1,1,0,1 */  29,
-/* 47: 1,1,1,1,0,1 */  43,
-/* 48: 0,0,0,0,1,1 */  -1,
-/* 49: 1,0,0,0,1,1 */  -1,
-/* 50: 0,1,0,0,1,1 */  -1,
-/* 51: 1,1,0,0,1,1 */  34,
-/* 52: 0,0,1,0,1,1 */  -1,
-/* 53: 1,0,1,0,1,1 */  -1,
-/* 54: 0,1,1,0,1,1 */  28,
-/* 55: 1,1,1,0,1,1 */  42,
-/* 56: 0,0,0,1,1,1 */  -1,
-/* 57: 1,0,0,1,1,1 */  31,
-/* 58: 0,1,0,1,1,1 */  -1,
-/* 59: 1,1,0,1,1,1 */  41,
-/* 60: 0,0,1,1,1,1 */  27,
-/* 61: 1,0,1,1,1,1 */  40,
-/* 62: 0,1,1,1,1,1 */  39,
-/* 63: 1,1,1,1,1,1 */  45,
-};
-
-
-//_____________________________________________________________________________
-/**
- * \brief tiling table for case 13.1
- * For each of the case above, the specific triangulation of the edge
- * intersection points is given.
- * When a case is ambiguous, there is an auxiliary table that contains
- * the face number to test and the tiling table contains the specific
- * triangulations depending on the results
- * A minus sign means to invert the result of the test.
- */
-//-----------------------------------------------------------------------------
-/* 13.1 */
-static const char tiling13_1[2][12] = {
-/* 165: 0,    2,       5,    7,  */  { 11,  7,  6,  1,  2, 10,  8,  3,  0,  9,  5, 4 },
-/*  90:    1,    3, 4,    6,     */  {  8,  4,  7,  2,  3, 11,  9,  0,  1, 10,  6, 5 }
-};
-
-//_____________________________________________________________________________
-/**
- * \brief tiling table for case 13.1 inverted
- * For each of the case above, the specific triangulation of the edge
- * intersection points is given.
- * When a case is ambiguous, there is an auxiliary table that contains
- * the face number to test and the tiling table contains the specific
- * triangulations depending on the results
- * A minus sign means to invert the result of the test.
- */
-//-----------------------------------------------------------------------------
-/* 13.1 */
-static const char tiling13_1_[2][12] = {
-/* 165: 0,    2,       5,    7,  */  { 7,  4,  8, 11,  3,  2,  1,  0,  9,  5,  6, 10 },
-/*  90:    1,    3, 4,    6,     */  { 6,  7, 11, 10,  2,  1,  0,  3,  8,  4,  5,  9 }
-};
-
-//_____________________________________________________________________________
-/**
- * \brief tiling table for case 13.2
- * For each of the case above, the specific triangulation of the edge
- * intersection points is given.
- * When a case is ambiguous, there is an auxiliary table that contains
- * the face number to test and the tiling table contains the specific
- * triangulations depending on the results
- * A minus sign means to invert the result of the test.
- */
-//-----------------------------------------------------------------------------
-/* 13.2 */
-static const char tiling13_2[2][6][18] = {
-/* 165: 0,    2,       5,    7,  */  {
- /* 1 */ { 1,  2, 10, 11,  7,  6,  3,  4,  8,  4,  3,  5,  0,  5,  3,  5,  0,  9 },
- /* 2 */ { 8,  3,  0, 11,  7,  6,  9,  1,  4,  2,  4,  1,  4,  2,  5, 10,  5,  2 },
- /* 3 */ { 9,  5,  4,  8,  3,  0,  1,  6, 10,  6,  1,  7,  2,  7,  1,  7,  2, 11 },
- /* 4 */ { 9,  5,  4,  1,  2, 10, 11,  3,  6,  0,  6,  3,  6,  0,  7,  8,  7,  0 },
- /* 5 */ { 9,  5,  4, 11,  7,  6,  0, 10,  1, 10,  0,  8, 10,  8,  2,  3,  2,  8 },
- /* 6 */ { 1,  2, 10,  3,  0,  8,  4,  9,  7, 11,  7,  9,  5, 11,  9, 11,  5,  6 }
-},
-/*  90:    1,    3, 4,    6,     */  {
- /* 1 */ { 2,  3, 11,  8,  4,  7,  0,  5,  9,  5,  0,  6,  1,  6,  0,  6,  1, 10 },
- /* 2 */ { 9,  0,  1,  8,  4,  7, 10,  2,  5,  3,  5,  2,  5,  3,  6, 11,  6,  3 },
- /* 3 */ { 6,  5, 10,  9,  0,  1,  2,  7, 11,  7,  2,  4,  3,  4,  2,  4,  3,  8 },
- /* 4 */ { 6,  5, 10,  2,  3, 11,  8,  0,  7,  1,  7,  0,  7,  1,  4,  9,  4,  1 },
- /* 5 */ { 6,  5, 10,  8,  4,  7,  1, 11,  2, 11,  1,  9, 11,  9,  3,  0,  3,  9 },
- /* 6 */ { 2,  3, 11,  0,  1,  9,  5, 10,  4,  8,  4, 10,  6,  8, 10,  8,  6,  7 }
-} };
-
-//_____________________________________________________________________________
-/**
- * \brief tiling table for case 13.2 inverted
- * For each of the case above, the specific triangulation of the edge
- * intersection points is given.
- * When a case is ambiguous, there is an auxiliary table that contains
- * the face number to test and the tiling table contains the specific
- * triangulations depending on the results
- * A minus sign means to invert the result of the test.
- */
-//-----------------------------------------------------------------------------
-/* 13.2 */
-static const char tiling13_2_[2][6][18] = {
-/* 165: 0,    2,       5,    7,  */  {
- /* 1 */ { 10,  5,  6, 11,  3,  2,  7,  0,  8,  0,  7,  1,  4,  1,  7,  1,  4,  9 },
- /* 2 */ { 11,  3,  2,  7,  4,  8,  9,  5,  0,  6,  0,  5,  0,  6,  1, 10,  1,  6 },
- /* 3 */ {  1,  0,  9,  7,  4,  8,  5,  2, 10,  2,  5,  3,  6,  3,  5,  3,  6, 11 },
- /* 4 */ { 10,  5,  6,  1,  0,  9, 11,  7,  2,  4,  2,  7,  2,  4,  3,  8,  3,  4 },
- /* 5 */ { 10,  5,  6,  7,  4,  8,  2, 11,  1,  9,  1, 11,  3,  9, 11,  9,  3,  0 },
- /* 6 */ { 11,  3,  2,  9,  1,  0,  4, 10,  5, 10,  4,  8, 10,  8,  6,  7,  6,  8 }
-},
-/*  90:    1,    3, 4,    6,     */  {
- /* 1 */ {  6,  7, 11,  8,  0,  3,  4,  1,  9,  1,  4,  2,  5,  2,  4,  2,  5, 10 },
- /* 2 */ {  8,  0,  3,  4,  5,  9, 10,  6,  1,  7,  1,  6,  1,  7,  2, 11,  2,  7 },
- /* 3 */ {  2,  1, 10,  4,  5,  9,  6,  3, 11,  3,  6,  0,  7,  0,  6,  0,  7,  8 },
- /* 4 */ {  6,  7, 11,  2,  1, 10,  8,  4,  3,  5,  3,  4,  3,  5,  0,  9,  0,  5 },
- /* 5 */ {  6,  7, 11,  4,  5,  9,  3,  8,  2, 10,  2,  8,  0, 10,  8, 10,  0,  1 },
- /* 6 */ {  8,  0,  3, 10,  2,  1,  5, 11,  6, 11,  5,  9, 11,  9,  7,  4,  7,  9 }
-} };
-
-//_____________________________________________________________________________
-/**
- * \brief tiling table for case 13.3
- * For each of the case above, the specific triangulation of the edge
- * intersection points is given.
- * When a case is ambiguous, there is an auxiliary table that contains
- * the face number to test and the tiling table contains the specific
- * triangulations depending on the results
- * A minus sign means to invert the result of the test.
- */
-//-----------------------------------------------------------------------------
-/* 13.3 */
-static const char tiling13_3[2][12][30] = {
-/* 165: 0,    2,       5,    7,  */  {
- /* 1,2 */ { 11,  7,  6, 12,  2, 10, 12, 10,  5, 12,  5,  4, 12,  4,  8, 12,  8,  3, 12,  3,  0, 12,  0,  9, 12,  9,  1, 12,  1,  2 },
- /* 1,4 */ {  1,  2, 10,  9,  5, 12,  0,  9, 12,  3,  0, 12, 11,  3, 12,  6, 11, 12,  7,  6, 12,  8,  7, 12,  4,  8, 12,  5,  4, 12 },
- /* 1,5 */ { 11,  7,  6, 12,  5,  4, 12,  4,  8, 12,  8,  3, 12,  3,  2, 12,  2, 10, 12, 10,  1, 12,  1,  0, 12,  0,  9, 12,  9,  5 },
- /* 1,6 */ {  1,  2, 10, 12,  3,  0, 12,  0,  9, 12,  9,  5, 12,  5,  6, 12,  6, 11, 12, 11,  7, 12,  7,  4, 12,  4,  8, 12,  8,  3 },
- /* 2,3 */ {  8,  3,  0, 11,  7, 12,  2, 11, 12,  1,  2, 12,  9,  1, 12,  4,  9, 12,  5,  4, 12, 10,  5, 12,  6, 10, 12,  7,  6, 12 },
- /* 2,5 */ { 11,  7,  6,  5,  4, 12, 10,  5, 12,  2, 10, 12,  3,  2, 12,  8,  3, 12,  0,  8, 12,  1,  0, 12,  9,  1, 12,  4,  9, 12 },
- /* 2,6 */ {  8,  3,  0,  1,  2, 12,  9,  1, 12,  4,  9, 12,  7,  4, 12, 11,  7, 12,  6, 11, 12,  5,  6, 12, 10,  5, 12,  2, 10, 12 },
- /* 3,4 */ {  9,  5,  4, 12,  0,  8, 12,  8,  7, 12,  7,  6, 12,  6, 10, 12, 10,  1, 12,  1,  2, 12,  2, 11, 12, 11,  3, 12,  3,  0 },
- /* 3,5 */ {  9,  5,  4, 12,  7,  6, 12,  6, 10, 12, 10,  1, 12,  1,  0, 12,  0,  8, 12,  8,  3, 12,  3,  2, 12,  2, 11, 12, 11,  7 },
- /* 3,6 */ {  8,  3,  0, 12,  1,  2, 12,  2, 11, 12, 11,  7, 12,  7,  4, 12,  4,  9, 12,  9,  5, 12,  5,  6, 12,  6, 10, 12, 10,  1 },
- /* 4,5 */ {  9,  5,  4,  7,  6, 12,  8,  7, 12,  0,  8, 12,  1,  0, 12, 10,  1, 12,  2, 10, 12,  3,  2, 12, 11,  3, 12,  6, 11, 12 },
- /* 4,6 */ {  1,  2, 10,  3,  0, 12, 11,  3, 12,  6, 11, 12,  5,  6, 12,  9,  5, 12,  4,  9, 12,  7,  4, 12,  8,  7, 12,  0,  8, 12 }
-},
-/*  90:    1,    3, 4,    6,     */  {
- /* 1,2 */ {  8,  4,  7, 12,  3, 11, 12, 11,  6, 12,  6,  5, 12,  5,  9, 12,  9,  0, 12,  0,  1, 12,  1, 10, 12, 10,  2, 12,  2,  3 },
- /* 1,4 */ {  2,  3, 11, 10,  6, 12,  1, 10, 12,  0,  1, 12,  8,  0, 12,  7,  8, 12,  4,  7, 12,  9,  4, 12,  5,  9, 12,  6,  5, 12 },
- /* 1,5 */ {  8,  4,  7, 12,  6,  5, 12,  5,  9, 12,  9,  0, 12,  0,  3, 12,  3, 11, 12, 11,  2, 12,  2,  1, 12,  1, 10, 12, 10,  6 },
- /* 1,6 */ {  2,  3, 11, 12,  0,  1, 12,  1, 10, 12, 10,  6, 12,  6,  7, 12,  7,  8, 12,  8,  4, 12,  4,  5, 12,  5,  9, 12,  9,  0 },
- /* 2,3 */ {  0,  1,  9,  8,  4, 12,  3,  8, 12,  2,  3, 12, 10,  2, 12,  5, 10, 12,  6,  5, 12, 11,  6, 12,  7, 11, 12,  4,  7, 12 },
- /* 2,5 */ {  8,  4,  7,  6,  5, 12, 11,  6, 12,  3, 11, 12,  0,  3, 12,  9,  0, 12,  1,  9, 12,  2,  1, 12, 10,  2, 12,  5, 10, 12 },
- /* 2,6 */ {  9,  0,  1,  2,  3, 12, 10,  2, 12,  5, 10, 12,  4,  5, 12,  8,  4, 12,  7,  8, 12,  6,  7, 12, 11,  6, 12,  3, 11, 12 },
- /* 3,4 */ {  6,  5, 10, 12,  1,  9, 12,  9,  4, 12,  4,  7, 12,  7, 11, 12, 11,  2, 12,  2,  3, 12,  3,  8, 12,  8,  0, 12,  0,  1 },
- /* 3,5 */ {  6,  5, 10, 12,  4,  7, 12,  7, 11, 12, 11,  2, 12,  2,  1, 12,  1,  9, 12,  9,  0, 12,  0,  3, 12,  3,  8, 12,  8,  4 },
- /* 3,6 */ {  9,  0,  1, 12,  2,  3, 12,  3,  8, 12,  8,  4, 12,  4,  5, 12,  5, 10, 12, 10,  6, 12,  6,  7, 12,  7, 11, 12, 11,  2 },
- /* 4,5 */ {  6,  5, 10,  4,  7, 12,  9,  4, 12,  1,  9, 12,  2,  1, 12, 11,  2, 12,  3, 11, 12,  0,  3, 12,  8,  0, 12,  7,  8, 12 },
- /* 4,6 */ {  2,  3, 11,  0,  1, 12,  8,  0, 12,  7,  8, 12,  6,  7, 12, 10,  6, 12,  5, 10, 12,  4,  5, 12,  9,  4, 12,  1,  9, 12 }
-} };
-
-//_____________________________________________________________________________
-/**
- * \brief tiling table for case 13.3, inverted
- * For each of the case above, the specific triangulation of the edge
- * intersection points is given.
- * When a case is ambiguous, there is an auxiliary table that contains
- * the face number to test and the tiling table contains the specific
- * triangulations depending on the results
- * A minus sign means to invert the result of the test.
- */
-//-----------------------------------------------------------------------------
-/* 13.3 */
-static const char tiling13_3_[2][12][30] = {
-/* 165: 0,    2,       5,    7,  */  {
- /* 1,2 */ {  3,  2, 11,  8,  7, 12,  0,  8, 12,  1,  0, 12, 10,  1, 12,  6, 10, 12,  5,  6, 12,  9,  5, 12,  4,  9, 12,  7,  4, 12 },
- /* 1,4 */ {  5,  6, 10, 12,  2, 11, 12, 11,  7, 12,  7,  4, 12,  4,  9, 12,  9,  1, 12,  1,  0, 12,  0,  8, 12,  8,  3, 12,  3,  2 },
- /* 1,5 */ { 10,  5,  6, 12,  7,  4, 12,  4,  9, 12,  9,  1, 12,  1,  2, 12,  2, 11, 12, 11,  3, 12,  3,  0, 12,  0,  8, 12,  8,  7 },
- /* 1,6 */ { 11,  3,  2, 12,  1,  0, 12,  0,  8, 12,  8,  7, 12,  7,  6, 12,  6, 10, 12, 10,  5, 12,  5,  4, 12,  4,  9, 12,  9,  1 },
- /* 2,3 */ {  7,  4,  8, 11,  3, 12,  6, 11, 12,  5,  6, 12,  9,  5, 12,  0,  9, 12,  1,  0, 12, 10,  1, 12,  2, 10, 12,  3,  2, 12 },
- /* 2,5 */ {  7,  4,  8,  5,  6, 12,  9,  5, 12,  0,  9, 12,  3,  0, 12, 11,  3, 12,  2, 11, 12,  1,  2, 12, 10,  1, 12,  6, 10, 12 },
- /* 2,6 */ { 11,  3,  2,  1,  0, 12, 10,  1, 12,  6, 10, 12,  7,  6, 12,  8,  7, 12,  4,  8, 12,  5,  4, 12,  9,  5, 12,  0,  9, 12 },
- /* 3,4 */ {  1,  0,  9, 12,  4,  8, 12,  8,  3, 12,  3,  2, 12,  2, 10, 12, 10,  5, 12,  5,  6, 12,  6, 11, 12, 11,  7, 12,  7,  4 },
- /* 3,5 */ {  7,  4,  8, 12,  5,  6, 12,  6, 11, 12, 11,  3, 12,  3,  0, 12,  0,  9, 12,  9,  1, 12,  1,  2, 12,  2, 10, 12, 10,  5 },
- /* 3,6 */ {  1,  0,  9, 12,  3,  2, 12,  2, 10, 12, 10,  5, 12,  5,  4, 12,  4,  8, 12,  8,  7, 12,  7,  6, 12,  6, 11, 12, 11,  3 },
- /* 4,5 */ { 10,  5,  6,  7,  4, 12, 11,  7, 12,  2, 11, 12,  1,  2, 12,  9,  1, 12,  0,  9, 12,  3,  0, 12,  8,  3, 12,  4,  8, 12 },
- /* 4,6 */ {  9,  1,  0,  3,  2, 12,  8,  3, 12,  4,  8, 12,  5,  4, 12, 10,  5, 12,  6, 10, 12,  7,  6, 12, 11,  7, 12,  2, 11, 12 }
-},
-/*  90:    1,    3, 4,    6,     */  {
- /* 1,2 */ {  0,  3,  8,  9,  4, 12,  1,  9, 12,  2,  1, 12, 11,  2, 12,  7, 11, 12,  6,  7, 12, 10,  6, 12,  5, 10, 12,  4,  5, 12 },
- /* 1,4 */ { 11,  6,  7, 12,  3,  8, 12,  8,  4, 12,  4,  5, 12,  5, 10, 12, 10,  2, 12,  2,  1, 12,  1,  9, 12,  9,  0, 12,  0,  3 },
- /* 1,5 */ {  6,  7, 11, 12,  4,  5, 12,  5, 10, 12, 10,  2, 12,  2,  3, 12,  3,  8, 12,  8,  0, 12,  0,  1, 12,  1,  9, 12,  9,  4 },
- /* 1,6 */ {  8,  0,  3, 12,  2,  1, 12,  1,  9, 12,  9,  4, 12,  4,  7, 12,  7, 11, 12, 11,  6, 12,  6,  5, 12,  5, 10, 12, 10,  2 },
- /* 2,3 */ {  4,  5,  9,  8,  0, 12,  7,  8, 12,  6,  7, 12, 10,  6, 12,  1, 10, 12,  2,  1, 12, 11,  2, 12,  3, 11, 12,  0,  3, 12 },
- /* 2,5 */ {  4,  5,  9,  6,  7, 12, 10,  6, 12,  1, 10, 12,  0,  1, 12,  8,  0, 12,  3,  8, 12,  2,  3, 12, 11,  2, 12,  7, 11, 12 },
- /* 2,6 */ {  8,  0,  3,  2,  1, 12, 11,  2, 12,  7, 11, 12,  4,  7, 12,  9,  4, 12,  5,  9, 12,  6,  5, 12, 10,  6, 12,  1, 10, 12 },
- /* 3,4 */ {  2,  1, 10, 12,  5,  9, 12,  9,  0, 12,  0,  3, 12,  3, 11, 12, 11,  6, 12,  6,  7, 12,  7,  8, 12,  8,  4, 12,  4,  5 },
- /* 3,5 */ {  4,  5,  9, 12,  6,  7, 12,  7,  8, 12,  8,  0, 12,  0,  1, 12,  1, 10, 12, 10,  2, 12,  2,  3, 12,  3, 11, 12, 11,  6 },
- /* 3,6 */ {  2,  1, 10, 12,  0,  3, 12,  3, 11, 12, 11,  6, 12,  6,  5, 12,  5,  9, 12,  9,  4, 12,  4,  7, 12,  7,  8, 12,  8,  0 },
- /* 4,5 */ {  6,  7, 11,  4,  5, 12,  8,  4, 12,  3,  8, 12,  2,  3, 12, 10,  2, 12,  1, 10, 12,  0,  1, 12,  9,  0, 12,  5,  9, 12 },
- /* 4,6 */ { 10,  2,  1,  0,  3, 12,  9,  0, 12,  5,  9, 12,  6,  5, 12, 11,  6, 12,  7, 11, 12,  4,  7, 12,  8,  4, 12,  3,  8, 12 }
-} };
-
-//_____________________________________________________________________________
-/**
- * \brief tiling table for case 13.4
- * For each of the case above, the specific triangulation of the edge
- * intersection points is given.
- * When a case is ambiguous, there is an auxiliary table that contains
- * the face number to test and the tiling table contains the specific
- * triangulations depending on the results
- * A minus sign means to invert the result of the test.
- */
-//-----------------------------------------------------------------------------
-/* 13.4 */
-static const char tiling13_4[2][4][36] = {
-/* 165: 0,    2,       5,    7,  */  {
-/* 1,2,6 */  { 12,  2, 10, 12, 10,  5, 12,  5,  6, 12,  6, 11, 12, 11,  7, 12,  7,  4, 12,  4,  8, 12,  8,  3, 12,  3,  0, 12,  0,  9, 12,  9,  1, 12,  1,  2 },
-/* 1,4,5 */  { 11,  3, 12,  6, 11, 12,  7,  6, 12,  8,  7, 12,  4,  8, 12,  5,  4, 12,  9,  5, 12,  0,  9, 12,  1,  0, 12, 10,  1, 12,  2, 10, 12,  3,  2, 12 },
-/* 2,3,5 */  {  9,  1, 12,  4,  9, 12,  5,  4, 12, 10,  5, 12,  6, 10, 12,  7,  6, 12, 11,  7, 12,  2, 11, 12,  3,  2, 12,  8,  3, 12,  0,  8, 12,  1,  0, 12 },
-/* 3,4,6 */  { 12,  0,  8, 12,  8,  7, 12,  7,  4, 12,  4,  9, 12,  9,  5, 12,  5,  6, 12,  6, 10, 12, 10,  1, 12,  1,  2, 12,  2, 11, 12, 11,  3, 12,  3,  0 }
-},
-/*  90:    1,    3, 4,    6,     */  {
-/* 1,2,6 */  { 12,  3, 11, 12, 11,  6, 12,  6,  7, 12,  7,  8, 12,  8,  4, 12,  4,  5, 12,  5,  9, 12,  9,  0, 12,  0,  1, 12,  1, 10, 12, 10,  2, 12,  2,  3 },
-/* 1,4,5 */  {  8,  0, 12,  7,  8, 12,  4,  7, 12,  9,  4, 12,  5,  9, 12,  6,  5, 12, 10,  6, 12,  1, 10, 12,  2,  1, 12, 11,  2, 12,  3, 11, 12,  0,  3, 12 },
-/* 2,3,5 */  { 10,  2, 12,  5, 10, 12,  6,  5, 12, 11,  6, 12,  7, 11, 12,  4,  7, 12,  8,  4, 12,  3,  8, 12,  0,  3, 12,  9,  0, 12,  1,  9, 12,  2,  1, 12 },
-/* 3,4,6 */  { 12,  1,  9, 12,  9,  4, 12,  4,  5, 12,  5, 10, 12, 10,  6, 12,  6,  7, 12,  7, 11, 12, 11,  2, 12,  2,  3, 12,  3,  8, 12,  8,  0, 12,  0,  1 }
-} };
-
-//_____________________________________________________________________________
-/**
- * \brief tiling table for case 13.5.1
- * The support edge for the interior test is marked as the 1st column.
- * For each of the case above, the specific triangulation of the edge
- * intersection points is given.
- * When a case is ambiguous, there is an auxiliary table that contains
- * the face number to test and the tiling table contains the specific
- * triangulations depending on the results
- * A minus sign means to invert the result of the test.
- */
-//-----------------------------------------------------------------------------
-/* 13.5.1 */
-static const char tiling13_5_1[2][4][18] = {
-/* 165: 0,    2,       5,    7,  */  {
-/* 1,2,5 */  {  7,  6, 11,  1,  0,  9, 10,  3,  2,  3, 10,  5,  3,  5,  8,  4,  8, 5 },
-/* 1,4,6 */  {  1,  2, 10,  7,  4,  8,  3,  0, 11,  6, 11,  0,  9,  6,  0,  6,  9, 5 },
-/* 2,3,6 */  {  3,  0,  8,  5,  6, 10,  1,  2,  9,  4,  9,  2, 11,  4,  2,  4, 11, 7 },
-/* 3,4,5 */  {  5,  4,  9,  3,  2, 11,  8,  1,  0,  1,  8,  7,  1,  7, 10,  6, 10, 7 }
-},
-/*  90:    1,    3, 4,    6,     */  {
-/* 1,2,5 */  {  4,  7,  8,  2,  1, 10, 11,  0,  3,  0, 11,  6,  0,  6,  9,  5,  9, 6 },
-/* 1,4,6 */  {  2,  3, 11,  4,  5,  9,  0,  1,  8,  7,  8,  1, 10,  7,  1,  7, 10, 6 },
-/* 2,3,6 */  {  0,  1,  9,  6,  7, 11,  2,  3, 10,  5, 10,  3,  8,  5,  3,  5,  8, 4 },
-/* 3,4,5 */  {  6,  5, 10,  0,  3,  8,  9,  2,  1,  2,  9,  4,  2,  4, 11,  7, 11, 4 }
-} };
-
-//_____________________________________________________________________________
-/**
- * \brief tiling table for case 13.5.2
- * For each of the case above, the specific triangulation of the edge
- * intersection points is given.
- * When a case is ambiguous, there is an auxiliary table that contains
- * the face number to test and the tiling table contains the specific
- * triangulations depending on the results
- * A minus sign means to invert the result of the test.
- */
-//-----------------------------------------------------------------------------
-/* 13.5.2 */
-static const char tiling13_5_2[2][4][30] = {
-/* 165: 0,    2,       5,    7,  */  {
-/* 1,2,5 */  { 1,  0,  9,  7,  4,  8,  7,  8,  3,  7,  3, 11,  2, 11,  3, 11,  2, 10, 11, 10,  6,  5,  6, 10,  6,  5,  7,  4,  7, 5 },
-/* 1,4,6 */  { 7,  4,  8, 11,  3,  2,  6, 11,  2, 10,  6,  2,  6, 10,  5,  9,  5, 10,  1,  9, 10,  9,  1,  0,  2,  0,  1,  0,  2, 3 },
-/* 2,3,6 */  { 5,  6, 10,  9,  1,  0,  4,  9,  0,  8,  4,  0,  4,  8,  7, 11,  7,  8,  3, 11,  8, 11,  3,  2,  0,  2,  3,  2,  0, 1 },
-/* 3,4,5 */  { 3,  2, 11,  5,  6, 10,  5, 10,  1,  5,  1,  9,  0,  9,  1,  9,  0,  8,  9,  8,  4,  4,  8,  7,  4,  7,  5,  6,  5, 7 }
-},
-/*  90:    1,    3, 4,    6,     */  {
-/* 1,2,5 */  { 2,  1, 10,  4,  5,  9,  4,  9,  0,  4,  0,  8,  3,  8,  0,  8,  3, 11,  8, 11,  7,  6,  7, 11,  7,  6,  4,  5,  4, 6 },
-/* 1,4,6 */  { 4,  5,  9,  8,  0,  3,  7,  8,  3, 11,  7,  3,  7, 11,  6, 10,  6, 11,  2, 10, 11, 10,  2,  1,  3,  1,  2,  1,  3, 0 },
-/* 2,3,6 */  { 6,  7, 11, 10,  2,  1,  5, 10,  1,  9,  5,  1,  5,  9,  4,  8,  4,  9,  0,  8,  9,  8,  0,  3,  1,  3,  0,  3,  1, 2 },
-/* 3,4,5 */  { 0,  3,  8,  6,  7, 11,  6, 11,  2,  6,  2, 10,  1, 10,  2, 10,  1,  9, 10,  9,  5,  5,  9,  4,  5,  4,  6,  7,  6, 4 }
-} };
-//_____________________________________________________________________________
-
-
-
-//_____________________________________________________________________________
-/**
- * \brief tiling table for case 14
- * For each of the case above, the specific triangulation of the edge
- * intersection points is given.
- * When a case is ambiguous, there is an auxiliary table that contains
- * the face number to test and the tiling table contains the specific
- * triangulations depending on the results
- * A minus sign means to invert the result of the test.
- */
-//-----------------------------------------------------------------------------
-static const char tiling14[12][12] = {
-/*  71: 0, 1, 2,          6,     */  {  5,  9,  8,  5,  8,  2,  5,  2,  6,  3,  2,  8 },
-/*  43: 0, 1,    3,    5,        */  {  2,  1,  5,  2,  5,  8,  2,  8, 11,  4,  8,  5 },
-/* 147: 0, 1,       4,       7,  */  {  9,  4,  6,  9,  6,  3,  9,  3,  1, 11,  3,  6 },
-/*  29: 0,    2, 3, 4,           */  {  1, 11, 10,  1,  4, 11,  1,  0,  4,  7, 11,  4 },
-/* 201: 0,       3,       6, 7,  */  {  8,  2,  0,  8,  5,  2,  8,  7,  5, 10,  2,  5 },
-/* 113: 0,          4, 5, 6,     */  {  0,  7,  3,  0, 10,  7,  0,  9, 10,  6,  7, 10 },
-/* 142:    1, 2, 3,          7,  */  {  0,  3,  7,  0,  7, 10,  0, 10,  9,  6, 10,  7 },
-/*  54:    1, 2,    4, 5,        */  {  8,  0,  2,  8,  2,  5,  8,  5,  7, 10,  5,  2 },
-/* 226:    1,          5, 6, 7,  */  {  1, 10, 11,  1, 11,  4,  1,  4,  0,  7,  4, 11 },
-/* 108:       2, 3,    5, 6,     */  {  9,  6,  4,  9,  3,  6,  9,  1,  3, 11,  6,  3 },
-/* 212:       2,    4,    6, 7,  */  {  2,  5,  1,  2,  8,  5,  2, 11,  8,  4,  5,  8 },
-/* 184:          3, 4, 5,    7,  */  {  5,  8,  9,  5,  2,  8,  5,  6,  2,  3,  8,  2 }
-};
-//_____________________________________________________________________________
-
-
-
-//_____________________________________________________________________________
-/**
- * \brief original Marching Cubes implementation
- * For each of the possible vertex states listed in this table there is a
- * specific triangulation of the edge intersection points.  The table lists
- * all of them in the form of 0-5 edge triples with the list terminated by
- * the invalid value -1.  For example: casesClassic[3] list the 2 triangles
- * formed when cube[0] and cube[1] are inside of the surface, but the rest of
- * the cube is not.
- */
-//-----------------------------------------------------------------------------
-static const char casesClassic[256][16] = {
-/*   0:                          */  { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
-/*   1: 0,                       */  {  0,  8,  3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
-/*   2:    1,                    */  {  0,  1,  9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
-/*   3: 0, 1,                    */  {  1,  8,  3,  9,  8,  1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
-/*   4:       2,                 */  {  1,  2, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
-/*   5: 0,    2,                 */  {  0,  8,  3,  1,  2, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
-/*   6:    1, 2,                 */  {  9,  2, 10,  0,  2,  9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
-/*   7: 0, 1, 2,                 */  {  2,  8,  3,  2, 10,  8, 10,  9,  8, -1, -1, -1, -1, -1, -1, -1 },
-/*   8:          3,              */  {  3, 11,  2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
-/*   9: 0,       3,              */  {  0, 11,  2,  8, 11,  0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
-/*  10:    1,    3,              */  {  1,  9,  0,  2,  3, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
-/*  11: 0, 1,    3,              */  {  1, 11,  2,  1,  9, 11,  9,  8, 11, -1, -1, -1, -1, -1, -1, -1 },
-/*  12:       2, 3,              */  {  3, 10,  1, 11, 10,  3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
-/*  13: 0,    2, 3,              */  {  0, 10,  1,  0,  8, 10,  8, 11, 10, -1, -1, -1, -1, -1, -1, -1 },
-/*  14:    1, 2, 3,              */  {  3,  9,  0,  3, 11,  9, 11, 10,  9, -1, -1, -1, -1, -1, -1, -1 },
-/*  15: 0, 1, 2, 3,              */  {  9,  8, 10, 10,  8, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
-/*  16:             4,           */  {  4,  7,  8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
-/*  17: 0,          4,           */  {  4,  3,  0,  7,  3,  4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
-/*  18:    1,       4,           */  {  0,  1,  9,  8,  4,  7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
-/*  19: 0, 1,       4,           */  {  4,  1,  9,  4,  7,  1,  7,  3,  1, -1, -1, -1, -1, -1, -1, -1 },
-/*  20:       2,    4,           */  {  1,  2, 10,  8,  4,  7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
-/*  21: 0,    2,    4,           */  {  3,  4,  7,  3,  0,  4,  1,  2, 10, -1, -1, -1, -1, -1, -1, -1 },
-/*  22:    1, 2,    4,           */  {  9,  2, 10,  9,  0,  2,  8,  4,  7, -1, -1, -1, -1, -1, -1, -1 },
-/*  23: 0, 1, 2,    4,           */  {  2, 10,  9,  2,  9,  7,  2,  7,  3,  7,  9,  4, -1, -1, -1, -1 },
-/*  24:          3, 4,           */  {  8,  4,  7,  3, 11,  2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
-/*  25: 0,       3, 4,           */  { 11,  4,  7, 11,  2,  4,  2,  0,  4, -1, -1, -1, -1, -1, -1, -1 },
-/*  26:    1,    3, 4,           */  {  9,  0,  1,  8,  4,  7,  2,  3, 11, -1, -1, -1, -1, -1, -1, -1 },
-/*  27: 0, 1,    3, 4,           */  {  4,  7, 11,  9,  4, 11,  9, 11,  2,  9,  2,  1, -1, -1, -1, -1 },
-/*  28:       2, 3, 4,           */  {  3, 10,  1,  3, 11, 10,  7,  8,  4, -1, -1, -1, -1, -1, -1, -1 },
-/*  29: 0,    2, 3, 4,           */  {  1, 11, 10,  1,  4, 11,  1,  0,  4,  7, 11,  4, -1, -1, -1, -1 },
-/*  30:    1, 2, 3, 4,           */  {  4,  7,  8,  9,  0, 11,  9, 11, 10, 11,  0,  3, -1, -1, -1, -1 },
-/*  31: 0, 1, 2, 3, 4,           */  {  4,  7, 11,  4, 11,  9,  9, 11, 10, -1, -1, -1, -1, -1, -1, -1 },
-/*  32:                5,        */  {  9,  5,  4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
-/*  33: 0,             5,        */  {  9,  5,  4,  0,  8,  3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
-/*  34:    1,          5,        */  {  0,  5,  4,  1,  5,  0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
-/*  35: 0, 1,          5,        */  {  8,  5,  4,  8,  3,  5,  3,  1,  5, -1, -1, -1, -1, -1, -1, -1 },
-/*  36:       2,       5,        */  {  1,  2, 10,  9,  5,  4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
-/*  37: 0,    2,       5,        */  {  3,  0,  8,  1,  2, 10,  4,  9,  5, -1, -1, -1, -1, -1, -1, -1 },
-/*  38:    1, 2,       5,        */  {  5,  2, 10,  5,  4,  2,  4,  0,  2, -1, -1, -1, -1, -1, -1, -1 },
-/*  39: 0, 1, 2,       5,        */  {  2, 10,  5,  3,  2,  5,  3,  5,  4,  3,  4,  8, -1, -1, -1, -1 },
-/*  40:          3,    5,        */  {  9,  5,  4,  2,  3, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
-/*  41: 0,       3,    5,        */  {  0, 11,  2,  0,  8, 11,  4,  9,  5, -1, -1, -1, -1, -1, -1, -1 },
-/*  42:    1,    3,    5,        */  {  0,  5,  4,  0,  1,  5,  2,  3, 11, -1, -1, -1, -1, -1, -1, -1 },
-/*  43: 0, 1,    3,    5,        */  {  2,  1,  5,  2,  5,  8,  2,  8, 11,  4,  8,  5, -1, -1, -1, -1 },
-/*  44:       2, 3,    5,        */  { 10,  3, 11, 10,  1,  3,  9,  5,  4, -1, -1, -1, -1, -1, -1, -1 },
-/*  45: 0,    2, 3,    5,        */  {  4,  9,  5,  0,  8,  1,  8, 10,  1,  8, 11, 10, -1, -1, -1, -1 },
-/*  46:    1, 2, 3,    5,        */  {  5,  4,  0,  5,  0, 11,  5, 11, 10, 11,  0,  3, -1, -1, -1, -1 },
-/*  47: 0, 1, 2, 3,    5,        */  {  5,  4,  8,  5,  8, 10, 10,  8, 11, -1, -1, -1, -1, -1, -1, -1 },
-/*  48:             4, 5,        */  {  9,  7,  8,  5,  7,  9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
-/*  49: 0,          4, 5,        */  {  9,  3,  0,  9,  5,  3,  5,  7,  3, -1, -1, -1, -1, -1, -1, -1 },
-/*  50:    1,       4, 5,        */  {  0,  7,  8,  0,  1,  7,  1,  5,  7, -1, -1, -1, -1, -1, -1, -1 },
-/*  51: 0, 1,       4, 5,        */  {  1,  5,  3,  3,  5,  7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
-/*  52:       2,    4, 5,        */  {  9,  7,  8,  9,  5,  7, 10,  1,  2, -1, -1, -1, -1, -1, -1, -1 },
-/*  53: 0,    2,    4, 5,        */  { 10,  1,  2,  9,  5,  0,  5,  3,  0,  5,  7,  3, -1, -1, -1, -1 },
-/*  54:    1, 2,    4, 5,        */  {  8,  0,  2,  8,  2,  5,  8,  5,  7, 10,  5,  2, -1, -1, -1, -1 },
-/*  55: 0, 1, 2,    4, 5,        */  {  2, 10,  5,  2,  5,  3,  3,  5,  7, -1, -1, -1, -1, -1, -1, -1 },
-/*  56:          3, 4, 5,        */  {  7,  9,  5,  7,  8,  9,  3, 11,  2, -1, -1, -1, -1, -1, -1, -1 },
-/*  57: 0,       3, 4, 5,        */  {  9,  5,  7,  9,  7,  2,  9,  2,  0,  2,  7, 11, -1, -1, -1, -1 },
-/*  58:    1,    3, 4, 5,        */  {  2,  3, 11,  0,  1,  8,  1,  7,  8,  1,  5,  7, -1, -1, -1, -1 },
-/*  59: 0, 1,    3, 4, 5,        */  { 11,  2,  1, 11,  1,  7,  7,  1,  5, -1, -1, -1, -1, -1, -1, -1 },
-/*  60:       2, 3, 4, 5,        */  {  9,  5,  8,  8,  5,  7, 10,  1,  3, 10,  3, 11, -1, -1, -1, -1 },
-/*  61: 0,    2, 3, 4, 5,        */  {  5,  7,  0,  5,  0,  9,  7, 11,  0,  1,  0, 10, 11, 10,  0, -1 },
-/*  62:    1, 2, 3, 4, 5,        */  { 11, 10,  0, 11,  0,  3, 10,  5,  0,  8,  0,  7,  5,  7,  0, -1 },
-/*  63: 0, 1, 2, 3, 4, 5,        */  { 11, 10,  5,  7, 11,  5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
-/*  64:                   6,     */  { 10,  6,  5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
-/*  65: 0,                6,     */  {  0,  8,  3,  5, 10,  6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
-/*  66:    1,             6,     */  {  9,  0,  1,  5, 10,  6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
-/*  67: 0, 1,             6,     */  {  1,  8,  3,  1,  9,  8,  5, 10,  6, -1, -1, -1, -1, -1, -1, -1 },
-/*  68:       2,          6,     */  {  1,  6,  5,  2,  6,  1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
-/*  69: 0,    2,          6,     */  {  1,  6,  5,  1,  2,  6,  3,  0,  8, -1, -1, -1, -1, -1, -1, -1 },
-/*  70:    1, 2,          6,     */  {  9,  6,  5,  9,  0,  6,  0,  2,  6, -1, -1, -1, -1, -1, -1, -1 },
-/*  71: 0, 1, 2,          6,     */  {  5,  9,  8,  5,  8,  2,  5,  2,  6,  3,  2,  8, -1, -1, -1, -1 },
-/*  72:          3,       6,     */  {  2,  3, 11, 10,  6,  5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
-/*  73: 0,       3,       6,     */  { 11,  0,  8, 11,  2,  0, 10,  6,  5, -1, -1, -1, -1, -1, -1, -1 },
-/*  74:    1,    3,       6,     */  {  0,  1,  9,  2,  3, 11,  5, 10,  6, -1, -1, -1, -1, -1, -1, -1 },
-/*  75: 0, 1,    3,       6,     */  {  5, 10,  6,  1,  9,  2,  9, 11,  2,  9,  8, 11, -1, -1, -1, -1 },
-/*  76:       2, 3,       6,     */  {  6,  3, 11,  6,  5,  3,  5,  1,  3, -1, -1, -1, -1, -1, -1, -1 },
-/*  77: 0,    2, 3,       6,     */  {  0,  8, 11,  0, 11,  5,  0,  5,  1,  5, 11,  6, -1, -1, -1, -1 },
-/*  78:    1, 2, 3,       6,     */  {  3, 11,  6,  0,  3,  6,  0,  6,  5,  0,  5,  9, -1, -1, -1, -1 },
-/*  79: 0, 1, 2, 3,       6,     */  {  6,  5,  9,  6,  9, 11, 11,  9,  8, -1, -1, -1, -1, -1, -1, -1 },
-/*  80:             4,    6,     */  {  5, 10,  6,  4,  7,  8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
-/*  81: 0,          4,    6,     */  {  4,  3,  0,  4,  7,  3,  6,  5, 10, -1, -1, -1, -1, -1, -1, -1 },
-/*  82:    1,       4,    6,     */  {  1,  9,  0,  5, 10,  6,  8,  4,  7, -1, -1, -1, -1, -1, -1, -1 },
-/*  83: 0, 1,       4,    6,     */  { 10,  6,  5,  1,  9,  7,  1,  7,  3,  7,  9,  4, -1, -1, -1, -1 },
-/*  84:       2,    4,    6,     */  {  6,  1,  2,  6,  5,  1,  4,  7,  8, -1, -1, -1, -1, -1, -1, -1 },
-/*  85: 0,    2,    4,    6,     */  {  1,  2,  5,  5,  2,  6,  3,  0,  4,  3,  4,  7, -1, -1, -1, -1 },
-/*  86:    1, 2,    4,    6,     */  {  8,  4,  7,  9,  0,  5,  0,  6,  5,  0,  2,  6, -1, -1, -1, -1 },
-/*  87: 0, 1, 2,    4,    6,     */  {  7,  3,  9,  7,  9,  4,  3,  2,  9,  5,  9,  6,  2,  6,  9, -1 },
-/*  88:          3, 4,    6,     */  {  3, 11,  2,  7,  8,  4, 10,  6,  5, -1, -1, -1, -1, -1, -1, -1 },
-/*  89: 0,       3, 4,    6,     */  {  5, 10,  6,  4,  7,  2,  4,  2,  0,  2,  7, 11, -1, -1, -1, -1 },
-/*  90:    1,    3, 4,    6,     */  {  0,  1,  9,  4,  7,  8,  2,  3, 11,  5, 10,  6, -1, -1, -1, -1 },
-/*  91: 0, 1,    3, 4,    6,     */  {  9,  2,  1,  9, 11,  2,  9,  4, 11,  7, 11,  4,  5, 10,  6, -1 },
-/*  92:       2, 3, 4,    6,     */  {  8,  4,  7,  3, 11,  5,  3,  5,  1,  5, 11,  6, -1, -1, -1, -1 },
-/*  93: 0,    2, 3, 4,    6,     */  {  5,  1, 11,  5, 11,  6,  1,  0, 11,  7, 11,  4,  0,  4, 11, -1 },
-/*  94:    1, 2, 3, 4,    6,     */  {  0,  5,  9,  0,  6,  5,  0,  3,  6, 11,  6,  3,  8,  4,  7, -1 },
-/*  95: 0, 1, 2, 3, 4,    6,     */  {  6,  5,  9,  6,  9, 11,  4,  7,  9,  7, 11,  9, -1, -1, -1, -1 },
-/*  96:                5, 6,     */  { 10,  4,  9,  6,  4, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
-/*  97: 0,             5, 6,     */  {  4, 10,  6,  4,  9, 10,  0,  8,  3, -1, -1, -1, -1, -1, -1, -1 },
-/*  98:    1,          5, 6,     */  { 10,  0,  1, 10,  6,  0,  6,  4,  0, -1, -1, -1, -1, -1, -1, -1 },
-/*  99: 0, 1,          5, 6,     */  {  8,  3,  1,  8,  1,  6,  8,  6,  4,  6,  1, 10, -1, -1, -1, -1 },
-/* 100:       2,       5, 6,     */  {  1,  4,  9,  1,  2,  4,  2,  6,  4, -1, -1, -1, -1, -1, -1, -1 },
-/* 101: 0,    2,       5, 6,     */  {  3,  0,  8,  1,  2,  9,  2,  4,  9,  2,  6,  4, -1, -1, -1, -1 },
-/* 102:    1, 2,       5, 6,     */  {  0,  2,  4,  4,  2,  6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
-/* 103: 0, 1, 2,       5, 6,     */  {  8,  3,  2,  8,  2,  4,  4,  2,  6, -1, -1, -1, -1, -1, -1, -1 },
-/* 104:          3,    5, 6,     */  { 10,  4,  9, 10,  6,  4, 11,  2,  3, -1, -1, -1, -1, -1, -1, -1 },
-/* 105: 0,       3,    5, 6,     */  {  0,  8,  2,  2,  8, 11,  4,  9, 10,  4, 10,  6, -1, -1, -1, -1 },
-/* 106:    1,    3,    5, 6,     */  {  3, 11,  2,  0,  1,  6,  0,  6,  4,  6,  1, 10, -1, -1, -1, -1 },
-/* 107: 0, 1,    3,    5, 6,     */  {  6,  4,  1,  6,  1, 10,  4,  8,  1,  2,  1, 11,  8, 11,  1, -1 },
-/* 108:       2, 3,    5, 6,     */  {  9,  6,  4,  9,  3,  6,  9,  1,  3, 11,  6,  3, -1, -1, -1, -1 },
-/* 109: 0,    2, 3,    5, 6,     */  {  8, 11,  1,  8,  1,  0, 11,  6,  1,  9,  1,  4,  6,  4,  1, -1 },
-/* 110:    1, 2, 3,    5, 6,     */  {  3, 11,  6,  3,  6,  0,  0,  6,  4, -1, -1, -1, -1, -1, -1, -1 },
-/* 111: 0, 1, 2, 3,    5, 6,     */  {  6,  4,  8, 11,  6,  8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
-/* 112:             4, 5, 6,     */  {  7, 10,  6,  7,  8, 10,  8,  9, 10, -1, -1, -1, -1, -1, -1, -1 },
-/* 113: 0,          4, 5, 6,     */  {  0,  7,  3,  0, 10,  7,  0,  9, 10,  6,  7, 10, -1, -1, -1, -1 },
-/* 114:    1,       4, 5, 6,     */  { 10,  6,  7,  1, 10,  7,  1,  7,  8,  1,  8,  0, -1, -1, -1, -1 },
-/* 115: 0, 1,       4, 5, 6,     */  { 10,  6,  7, 10,  7,  1,  1,  7,  3, -1, -1, -1, -1, -1, -1, -1 },
-/* 116:       2,    4, 5, 6,     */  {  1,  2,  6,  1,  6,  8,  1,  8,  9,  8,  6,  7, -1, -1, -1, -1 },
-/* 117: 0,    2,    4, 5, 6,     */  {  2,  6,  9,  2,  9,  1,  6,  7,  9,  0,  9,  3,  7,  3,  9, -1 },
-/* 118:    1, 2,    4, 5, 6,     */  {  7,  8,  0,  7,  0,  6,  6,  0,  2, -1, -1, -1, -1, -1, -1, -1 },
-/* 119: 0, 1, 2,    4, 5, 6,     */  {  7,  3,  2,  6,  7,  2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
-/* 120:          3, 4, 5, 6,     */  {  2,  3, 11, 10,  6,  8, 10,  8,  9,  8,  6,  7, -1, -1, -1, -1 },
-/* 121: 0,       3, 4, 5, 6,     */  {  2,  0,  7,  2,  7, 11,  0,  9,  7,  6,  7, 10,  9, 10,  7, -1 },
-/* 122:    1,    3, 4, 5, 6,     */  {  1,  8,  0,  1,  7,  8,  1, 10,  7,  6,  7, 10,  2,  3, 11, -1 },
-/* 123: 0, 1,    3, 4, 5, 6,     */  { 11,  2,  1, 11,  1,  7, 10,  6,  1,  6,  7,  1, -1, -1, -1, -1 },
-/* 124:       2, 3, 4, 5, 6,     */  {  8,  9,  6,  8,  6,  7,  9,  1,  6, 11,  6,  3,  1,  3,  6, -1 },
-/* 125: 0,    2, 3, 4, 5, 6,     */  {  0,  9,  1, 11,  6,  7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
-/* 126:    1, 2, 3, 4, 5, 6,     */  {  7,  8,  0,  7,  0,  6,  3, 11,  0, 11,  6,  0, -1, -1, -1, -1 },
-/* 127: 0, 1, 2, 3, 4, 5, 6,     */  {  7, 11,  6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
-/* 128:                      7,  */  {  7,  6, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
-/* 129: 0,                   7,  */  {  3,  0,  8, 11,  7,  6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
-/* 130:    1,                7,  */  {  0,  1,  9, 11,  7,  6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
-/* 131: 0, 1,                7,  */  {  8,  1,  9,  8,  3,  1, 11,  7,  6, -1, -1, -1, -1, -1, -1, -1 },
-/* 132:       2,             7,  */  { 10,  1,  2,  6, 11,  7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
-/* 133: 0,    2,             7,  */  {  1,  2, 10,  3,  0,  8,  6, 11,  7, -1, -1, -1, -1, -1, -1, -1 },
-/* 134:    1, 2,             7,  */  {  2,  9,  0,  2, 10,  9,  6, 11,  7, -1, -1, -1, -1, -1, -1, -1 },
-/* 135: 0, 1, 2,             7,  */  {  6, 11,  7,  2, 10,  3, 10,  8,  3, 10,  9,  8, -1, -1, -1, -1 },
-/* 136:          3,          7,  */  {  7,  2,  3,  6,  2,  7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
-/* 137: 0,       3,          7,  */  {  7,  0,  8,  7,  6,  0,  6,  2,  0, -1, -1, -1, -1, -1, -1, -1 },
-/* 138:    1,    3,          7,  */  {  2,  7,  6,  2,  3,  7,  0,  1,  9, -1, -1, -1, -1, -1, -1, -1 },
-/* 139: 0, 1,    3,          7,  */  {  1,  6,  2,  1,  8,  6,  1,  9,  8,  8,  7,  6, -1, -1, -1, -1 },
-/* 140:       2, 3,          7,  */  { 10,  7,  6, 10,  1,  7,  1,  3,  7, -1, -1, -1, -1, -1, -1, -1 },
-/* 141: 0,    2, 3,          7,  */  { 10,  7,  6,  1,  7, 10,  1,  8,  7,  1,  0,  8, -1, -1, -1, -1 },
-/* 142:    1, 2, 3,          7,  */  {  0,  3,  7,  0,  7, 10,  0, 10,  9,  6, 10,  7, -1, -1, -1, -1 },
-/* 143: 0, 1, 2, 3,          7,  */  {  7,  6, 10,  7, 10,  8,  8, 10,  9, -1, -1, -1, -1, -1, -1, -1 },
-/* 144:             4,       7,  */  {  6,  8,  4, 11,  8,  6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
-/* 145: 0,          4,       7,  */  {  3,  6, 11,  3,  0,  6,  0,  4,  6, -1, -1, -1, -1, -1, -1, -1 },
-/* 146:    1,       4,       7,  */  {  8,  6, 11,  8,  4,  6,  9,  0,  1, -1, -1, -1, -1, -1, -1, -1 },
-/* 147: 0, 1,       4,       7,  */  {  9,  4,  6,  9,  6,  3,  9,  3,  1, 11,  3,  6, -1, -1, -1, -1 },
-/* 148:       2,    4,       7,  */  {  6,  8,  4,  6, 11,  8,  2, 10,  1, -1, -1, -1, -1, -1, -1, -1 },
-/* 149: 0,    2,    4,       7,  */  {  1,  2, 10,  3,  0, 11,  0,  6, 11,  0,  4,  6, -1, -1, -1, -1 },
-/* 150:    1, 2,    4,       7,  */  {  4, 11,  8,  4,  6, 11,  0,  2,  9,  2, 10,  9, -1, -1, -1, -1 },
-/* 151: 0, 1, 2,    4,       7,  */  { 10,  9,  3, 10,  3,  2,  9,  4,  3, 11,  3,  6,  4,  6,  3, -1 },
-/* 152:          3, 4,       7,  */  {  8,  2,  3,  8,  4,  2,  4,  6,  2, -1, -1, -1, -1, -1, -1, -1 },
-/* 153: 0,       3, 4,       7,  */  {  0,  4,  2,  4,  6,  2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
-/* 154:    1,    3, 4,       7,  */  {  1,  9,  0,  2,  3,  4,  2,  4,  6,  4,  3,  8, -1, -1, -1, -1 },
-/* 155: 0, 1,    3, 4,       7,  */  {  1,  9,  4,  1,  4,  2,  2,  4,  6, -1, -1, -1, -1, -1, -1, -1 },
-/* 156:       2, 3, 4,       7,  */  {  8,  1,  3,  8,  6,  1,  8,  4,  6,  6, 10,  1, -1, -1, -1, -1 },
-/* 157: 0,    2, 3, 4,       7,  */  { 10,  1,  0, 10,  0,  6,  6,  0,  4, -1, -1, -1, -1, -1, -1, -1 },
-/* 158:    1, 2, 3, 4,       7,  */  {  4,  6,  3,  4,  3,  8,  6, 10,  3,  0,  3,  9, 10,  9,  3, -1 },
-/* 159: 0, 1, 2, 3, 4,       7,  */  { 10,  9,  4,  6, 10,  4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
-/* 160:                5,    7,  */  {  4,  9,  5,  7,  6, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
-/* 161: 0,             5,    7,  */  {  0,  8,  3,  4,  9,  5, 11,  7,  6, -1, -1, -1, -1, -1, -1, -1 },
-/* 162:    1,          5,    7,  */  {  5,  0,  1,  5,  4,  0,  7,  6, 11, -1, -1, -1, -1, -1, -1, -1 },
-/* 163: 0, 1,          5,    7,  */  { 11,  7,  6,  8,  3,  4,  3,  5,  4,  3,  1,  5, -1, -1, -1, -1 },
-/* 164:       2,       5,    7,  */  {  9,  5,  4, 10,  1,  2,  7,  6, 11, -1, -1, -1, -1, -1, -1, -1 },
-/* 165: 0,    2,       5,    7,  */  {  6, 11,  7,  1,  2, 10,  0,  8,  3,  4,  9,  5, -1, -1, -1, -1 },
-/* 166:    1, 2,       5,    7,  */  {  7,  6, 11,  5,  4, 10,  4,  2, 10,  4,  0,  2, -1, -1, -1, -1 },
-/* 167: 0, 1, 2,       5,    7,  */  {  3,  4,  8,  3,  5,  4,  3,  2,  5, 10,  5,  2, 11,  7,  6, -1 },
-/* 168:          3,    5,    7,  */  {  7,  2,  3,  7,  6,  2,  5,  4,  9, -1, -1, -1, -1, -1, -1, -1 },
-/* 169: 0,       3,    5,    7,  */  {  9,  5,  4,  0,  8,  6,  0,  6,  2,  6,  8,  7, -1, -1, -1, -1 },
-/* 170:    1,    3,    5,    7,  */  {  3,  6,  2,  3,  7,  6,  1,  5,  0,  5,  4,  0, -1, -1, -1, -1 },
-/* 171: 0, 1,    3,    5,    7,  */  {  6,  2,  8,  6,  8,  7,  2,  1,  8,  4,  8,  5,  1,  5,  8, -1 },
-/* 172:       2, 3,    5,    7,  */  {  9,  5,  4, 10,  1,  6,  1,  7,  6,  1,  3,  7, -1, -1, -1, -1 },
-/* 173: 0,    2, 3,    5,    7,  */  {  1,  6, 10,  1,  7,  6,  1,  0,  7,  8,  7,  0,  9,  5,  4, -1 },
-/* 174:    1, 2, 3,    5,    7,  */  {  4,  0, 10,  4, 10,  5,  0,  3, 10,  6, 10,  7,  3,  7, 10, -1 },
-/* 175: 0, 1, 2, 3,    5,    7,  */  {  7,  6, 10,  7, 10,  8,  5,  4, 10,  4,  8, 10, -1, -1, -1, -1 },
-/* 176:             4, 5,    7,  */  {  6,  9,  5,  6, 11,  9, 11,  8,  9, -1, -1, -1, -1, -1, -1, -1 },
-/* 177: 0,          4, 5,    7,  */  {  3,  6, 11,  0,  6,  3,  0,  5,  6,  0,  9,  5, -1, -1, -1, -1 },
-/* 178:    1,       4, 5,    7,  */  {  0, 11,  8,  0,  5, 11,  0,  1,  5,  5,  6, 11, -1, -1, -1, -1 },
-/* 179: 0, 1,       4, 5,    7,  */  {  6, 11,  3,  6,  3,  5,  5,  3,  1, -1, -1, -1, -1, -1, -1, -1 },
-/* 180:       2,    4, 5,    7,  */  {  1,  2, 10,  9,  5, 11,  9, 11,  8, 11,  5,  6, -1, -1, -1, -1 },
-/* 181: 0,    2,    4, 5,    7,  */  {  0, 11,  3,  0,  6, 11,  0,  9,  6,  5,  6,  9,  1,  2, 10, -1 },
-/* 182:    1, 2,    4, 5,    7,  */  { 11,  8,  5, 11,  5,  6,  8,  0,  5, 10,  5,  2,  0,  2,  5, -1 },
-/* 183: 0, 1, 2,    4, 5,    7,  */  {  6, 11,  3,  6,  3,  5,  2, 10,  3, 10,  5,  3, -1, -1, -1, -1 },
-/* 184:          3, 4, 5,    7,  */  {  5,  8,  9,  5,  2,  8,  5,  6,  2,  3,  8,  2, -1, -1, -1, -1 },
-/* 185: 0,       3, 4, 5,    7,  */  {  9,  5,  6,  9,  6,  0,  0,  6,  2, -1, -1, -1, -1, -1, -1, -1 },
-/* 186:    1,    3, 4, 5,    7,  */  {  1,  5,  8,  1,  8,  0,  5,  6,  8,  3,  8,  2,  6,  2,  8, -1 },
-/* 187: 0, 1,    3, 4, 5,    7,  */  {  1,  5,  6,  2,  1,  6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
-/* 188:       2, 3, 4, 5,    7,  */  {  1,  3,  6,  1,  6, 10,  3,  8,  6,  5,  6,  9,  8,  9,  6, -1 },
-/* 189: 0,    2, 3, 4, 5,    7,  */  { 10,  1,  0, 10,  0,  6,  9,  5,  0,  5,  6,  0, -1, -1, -1, -1 },
-/* 190:    1, 2, 3, 4, 5,    7,  */  {  0,  3,  8,  5,  6, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
-/* 191: 0, 1, 2, 3, 4, 5,    7,  */  { 10,  5,  6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
-/* 192:                   6, 7,  */  { 11,  5, 10,  7,  5, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
-/* 193: 0,                6, 7,  */  { 11,  5, 10, 11,  7,  5,  8,  3,  0, -1, -1, -1, -1, -1, -1, -1 },
-/* 194:    1,             6, 7,  */  {  5, 11,  7,  5, 10, 11,  1,  9,  0, -1, -1, -1, -1, -1, -1, -1 },
-/* 195: 0, 1,             6, 7,  */  { 10,  7,  5, 10, 11,  7,  9,  8,  1,  8,  3,  1, -1, -1, -1, -1 },
-/* 196:       2,          6, 7,  */  { 11,  1,  2, 11,  7,  1,  7,  5,  1, -1, -1, -1, -1, -1, -1, -1 },
-/* 197: 0,    2,          6, 7,  */  {  0,  8,  3,  1,  2,  7,  1,  7,  5,  7,  2, 11, -1, -1, -1, -1 },
-/* 198:    1, 2,          6, 7,  */  {  9,  7,  5,  9,  2,  7,  9,  0,  2,  2, 11,  7, -1, -1, -1, -1 },
-/* 199: 0, 1, 2,          6, 7,  */  {  7,  5,  2,  7,  2, 11,  5,  9,  2,  3,  2,  8,  9,  8,  2, -1 },
-/* 200:          3,       6, 7,  */  {  2,  5, 10,  2,  3,  5,  3,  7,  5, -1, -1, -1, -1, -1, -1, -1 },
-/* 201: 0,       3,       6, 7,  */  {  8,  2,  0,  8,  5,  2,  8,  7,  5, 10,  2,  5, -1, -1, -1, -1 },
-/* 202:    1,    3,       6, 7,  */  {  9,  0,  1,  5, 10,  3,  5,  3,  7,  3, 10,  2, -1, -1, -1, -1 },
-/* 203: 0, 1,    3,       6, 7,  */  {  9,  8,  2,  9,  2,  1,  8,  7,  2, 10,  2,  5,  7,  5,  2, -1 },
-/* 204:       2, 3,       6, 7,  */  {  1,  3,  5,  3,  7,  5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
-/* 205: 0,    2, 3,       6, 7,  */  {  0,  8,  7,  0,  7,  1,  1,  7,  5, -1, -1, -1, -1, -1, -1, -1 },
-/* 206:    1, 2, 3,       6, 7,  */  {  9,  0,  3,  9,  3,  5,  5,  3,  7, -1, -1, -1, -1, -1, -1, -1 },
-/* 207: 0, 1, 2, 3,       6, 7,  */  {  9,  8,  7,  5,  9,  7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
-/* 208:             4,    6, 7,  */  {  5,  8,  4,  5, 10,  8, 10, 11,  8, -1, -1, -1, -1, -1, -1, -1 },
-/* 209: 0,          4,    6, 7,  */  {  5,  0,  4,  5, 11,  0,  5, 10, 11, 11,  3,  0, -1, -1, -1, -1 },
-/* 210:    1,       4,    6, 7,  */  {  0,  1,  9,  8,  4, 10,  8, 10, 11, 10,  4,  5, -1, -1, -1, -1 },
-/* 211: 0, 1,       4,    6, 7,  */  { 10, 11,  4, 10,  4,  5, 11,  3,  4,  9,  4,  1,  3,  1,  4, -1 },
-/* 212:       2,    4,    6, 7,  */  {  2,  5,  1,  2,  8,  5,  2, 11,  8,  4,  5,  8, -1, -1, -1, -1 },
-/* 213: 0,    2,    4,    6, 7,  */  {  0,  4, 11,  0, 11,  3,  4,  5, 11,  2, 11,  1,  5,  1, 11, -1 },
-/* 214:    1, 2,    4,    6, 7,  */  {  0,  2,  5,  0,  5,  9,  2, 11,  5,  4,  5,  8, 11,  8,  5, -1 },
-/* 215: 0, 1, 2,    4,    6, 7,  */  {  9,  4,  5,  2, 11,  3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
-/* 216:          3, 4,    6, 7,  */  {  2,  5, 10,  3,  5,  2,  3,  4,  5,  3,  8,  4, -1, -1, -1, -1 },
-/* 217: 0,       3, 4,    6, 7,  */  {  5, 10,  2,  5,  2,  4,  4,  2,  0, -1, -1, -1, -1, -1, -1, -1 },
-/* 218:    1,    3, 4,    6, 7,  */  {  3, 10,  2,  3,  5, 10,  3,  8,  5,  4,  5,  8,  0,  1,  9, -1 },
-/* 219: 0, 1,    3, 4,    6, 7,  */  {  5, 10,  2,  5,  2,  4,  1,  9,  2,  9,  4,  2, -1, -1, -1, -1 },
-/* 220:       2, 3, 4,    6, 7,  */  {  8,  4,  5,  8,  5,  3,  3,  5,  1, -1, -1, -1, -1, -1, -1, -1 },
-/* 221: 0,    2, 3, 4,    6, 7,  */  {  0,  4,  5,  1,  0,  5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
-/* 222:    1, 2, 3, 4,    6, 7,  */  {  8,  4,  5,  8,  5,  3,  9,  0,  5,  0,  3,  5, -1, -1, -1, -1 },
-/* 223: 0, 1, 2, 3, 4,    6, 7,  */  {  9,  4,  5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
-/* 224:                5, 6, 7,  */  {  4, 11,  7,  4,  9, 11,  9, 10, 11, -1, -1, -1, -1, -1, -1, -1 },
-/* 225: 0,             5, 6, 7,  */  {  0,  8,  3,  4,  9,  7,  9, 11,  7,  9, 10, 11, -1, -1, -1, -1 },
-/* 226:    1,          5, 6, 7,  */  {  1, 10, 11,  1, 11,  4,  1,  4,  0,  7,  4, 11, -1, -1, -1, -1 },
-/* 227: 0, 1,          5, 6, 7,  */  {  3,  1,  4,  3,  4,  8,  1, 10,  4,  7,  4, 11, 10, 11,  4, -1 },
-/* 228:       2,       5, 6, 7,  */  {  4, 11,  7,  9, 11,  4,  9,  2, 11,  9,  1,  2, -1, -1, -1, -1 },
-/* 229: 0,    2,       5, 6, 7,  */  {  9,  7,  4,  9, 11,  7,  9,  1, 11,  2, 11,  1,  0,  8,  3, -1 },
-/* 230:    1, 2,       5, 6, 7,  */  { 11,  7,  4, 11,  4,  2,  2,  4,  0, -1, -1, -1, -1, -1, -1, -1 },
-/* 231: 0, 1, 2,       5, 6, 7,  */  { 11,  7,  4, 11,  4,  2,  8,  3,  4,  3,  2,  4, -1, -1, -1, -1 },
-/* 232:          3,    5, 6, 7,  */  {  2,  9, 10,  2,  7,  9,  2,  3,  7,  7,  4,  9, -1, -1, -1, -1 },
-/* 233: 0,       3,    5, 6, 7,  */  {  9, 10,  7,  9,  7,  4, 10,  2,  7,  8,  7,  0,  2,  0,  7, -1 },
-/* 234:    1,    3,    5, 6, 7,  */  {  3,  7, 10,  3, 10,  2,  7,  4, 10,  1, 10,  0,  4,  0, 10, -1 },
-/* 235: 0, 1,    3,    5, 6, 7,  */  {  1, 10,  2,  8,  7,  4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
-/* 236:       2, 3,    5, 6, 7,  */  {  4,  9,  1,  4,  1,  7,  7,  1,  3, -1, -1, -1, -1, -1, -1, -1 },
-/* 237: 0,    2, 3,    5, 6, 7,  */  {  4,  9,  1,  4,  1,  7,  0,  8,  1,  8,  7,  1, -1, -1, -1, -1 },
-/* 238:    1, 2, 3,    5, 6, 7,  */  {  4,  0,  3,  7,  4,  3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
-/* 239: 0, 1, 2, 3,    5, 6, 7,  */  {  4,  8,  7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
-/* 240:             4, 5, 6, 7,  */  {  9, 10,  8, 10, 11,  8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
-/* 241: 0,          4, 5, 6, 7,  */  {  3,  0,  9,  3,  9, 11, 11,  9, 10, -1, -1, -1, -1, -1, -1, -1 },
-/* 242:    1,       4, 5, 6, 7,  */  {  0,  1, 10,  0, 10,  8,  8, 10, 11, -1, -1, -1, -1, -1, -1, -1 },
-/* 243: 0, 1,       4, 5, 6, 7,  */  {  3,  1, 10, 11,  3, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
-/* 244:       2,    4, 5, 6, 7,  */  {  1,  2, 11,  1, 11,  9,  9, 11,  8, -1, -1, -1, -1, -1, -1, -1 },
-/* 245: 0,    2,    4, 5, 6, 7,  */  {  3,  0,  9,  3,  9, 11,  1,  2,  9,  2, 11,  9, -1, -1, -1, -1 },
-/* 246:    1, 2,    4, 5, 6, 7,  */  {  0,  2, 11,  8,  0, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
-/* 247: 0, 1, 2,    4, 5, 6, 7,  */  {  3,  2, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
-/* 248:          3, 4, 5, 6, 7,  */  {  2,  3,  8,  2,  8, 10, 10,  8,  9, -1, -1, -1, -1, -1, -1, -1 },
-/* 249: 0,       3, 4, 5, 6, 7,  */  {  9, 10,  2,  0,  9,  2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
-/* 250:    1,    3, 4, 5, 6, 7,  */  {  2,  3,  8,  2,  8, 10,  0,  1,  8,  1, 10,  8, -1, -1, -1, -1 },
-/* 251: 0, 1,    3, 4, 5, 6, 7,  */  {  1, 10,  2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
-/* 252:       2, 3, 4, 5, 6, 7,  */  {  1,  3,  8,  9,  1,  8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
-/* 253: 0,    2, 3, 4, 5, 6, 7,  */  {  0,  9,  1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
-/* 254:    1, 2, 3, 4, 5, 6, 7,  */  {  0,  3,  8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
-/* 255: 0, 1, 2, 3, 4, 5, 6, 7,  */  { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
-};
-//_____________________________________________________________________________
-
-} //namespace McCubes
-
-#endif // _LOOKUPTABLE_H_
+/**
+ * @file    LookUpTable.h
+ * @author  Thomas Lewiner <thomas.lewiner@polytechnique.org>
+ * @author  Math Dept, PUC-Rio
+ * @version 0.2
+ * @date    12/08/2002
+ *
+ * @brief   LookUpTable for the MarchingCubes 33 Algorithm
+ */
+//________________________________________________
+
+
+
+#ifndef MCLOOKUPTABLE_H
+#define MCLOOKUPTABLE_H
+
+namespace McCubes{ 
+
+//_____________________________________________________________________________
+/**
+ * \brief case mapping
+ * For each of the possible vertex states listed in this table there is a
+ * specific triangulation of the edge intersection points.  The table lists
+ * all of them in the form of 0-5 edge triples with the list terminated by
+ * the invalid value -1.  For example: case[3] list the 2 triangles
+ * formed when cube[0] and cube[1] are inside of the surface, but the rest of
+ * the cube is not.
+ *
+ * Cube description:
+ *         7 ________ 6           _____6__             ________
+ *         /|       /|         7/|       /|          /|       /|
+ *       /  |     /  |        /  |     /5 |        /  6     /  |
+ *   4 /_______ /    |      /__4____ /    10     /_______3/    |
+ *    |     |  |5    |     |    11  |     |     |     |  |   2 |
+ *    |    3|__|_____|2    |     |__|__2__|     | 4   |__|_____|
+ *    |    /   |    /      8   3/   9    /      |    /   |    /
+ *    |  /     |  /        |  /     |  /1       |  /     5  /
+ *    |/_______|/          |/___0___|/          |/_1_____|/
+ *   0          1        0          1
+ */
+//-----------------------------------------------------------------------------
+static const char cases[256][2] = {
+/*   0:                          */  {  0, -1 },
+/*   1: 0,                       */  {  1,  0 },
+/*   2:    1,                    */  {  1,  1 },
+/*   3: 0, 1,                    */  {  2,  0 },
+/*   4:       2,                 */  {  1,  2 },
+/*   5: 0,    2,                 */  {  3,  0 },
+/*   6:    1, 2,                 */  {  2,  3 },
+/*   7: 0, 1, 2,                 */  {  5,  0 },
+/*   8:          3,              */  {  1,  3 },
+/*   9: 0,       3,              */  {  2,  1 },
+/*  10:    1,    3,              */  {  3,  3 },
+/*  11: 0, 1,    3,              */  {  5,  1 },
+/*  12:       2, 3,              */  {  2,  5 },
+/*  13: 0,    2, 3,              */  {  5,  4 },
+/*  14:    1, 2, 3,              */  {  5,  9 },
+/*  15: 0, 1, 2, 3,              */  {  8,  0 },
+/*  16:             4,           */  {  1,  4 },
+/*  17: 0,          4,           */  {  2,  2 },
+/*  18:    1,       4,           */  {  3,  4 },
+/*  19: 0, 1,       4,           */  {  5,  2 },
+/*  20:       2,    4,           */  {  4,  2 },
+/*  21: 0,    2,    4,           */  {  6,  2 },
+/*  22:    1, 2,    4,           */  {  6,  9 },
+/*  23: 0, 1, 2,    4,           */  { 11,  0 },
+/*  24:          3, 4,           */  {  3,  8 },
+/*  25: 0,       3, 4,           */  {  5,  5 },
+/*  26:    1,    3, 4,           */  {  7,  3 },
+/*  27: 0, 1,    3, 4,           */  {  9,  1 },
+/*  28:       2, 3, 4,           */  {  6, 16 },
+/*  29: 0,    2, 3, 4,           */  { 14,  3 },
+/*  30:    1, 2, 3, 4,           */  { 12, 12 },
+/*  31: 0, 1, 2, 3, 4,           */  {  5, 24 },
+/*  32:                5,        */  {  1,  5 },
+/*  33: 0,             5,        */  {  3,  1 },
+/*  34:    1,          5,        */  {  2,  4 },
+/*  35: 0, 1,          5,        */  {  5,  3 },
+/*  36:       2,       5,        */  {  3,  6 },
+/*  37: 0,    2,       5,        */  {  7,  0 },
+/*  38:    1, 2,       5,        */  {  5, 10 },
+/*  39: 0, 1, 2,       5,        */  {  9,  0 },
+/*  40:          3,    5,        */  {  4,  3 },
+/*  41: 0,       3,    5,        */  {  6,  4 },
+/*  42:    1,    3,    5,        */  {  6, 11 },
+/*  43: 0, 1,    3,    5,        */  { 14,  1 },
+/*  44:       2, 3,    5,        */  {  6, 17 },
+/*  45: 0,    2, 3,    5,        */  { 12,  4 },
+/*  46:    1, 2, 3,    5,        */  { 11,  6 },
+/*  47: 0, 1, 2, 3,    5,        */  {  5, 25 },
+/*  48:             4, 5,        */  {  2,  8 },
+/*  49: 0,          4, 5,        */  {  5,  7 },
+/*  50:    1,       4, 5,        */  {  5, 12 },
+/*  51: 0, 1,       4, 5,        */  {  8,  1 },
+/*  52:       2,    4, 5,        */  {  6, 18 },
+/*  53: 0,    2,    4, 5,        */  { 12,  5 },
+/*  54:    1, 2,    4, 5,        */  { 14,  7 },
+/*  55: 0, 1, 2,    4, 5,        */  {  5, 28 },
+/*  56:          3, 4, 5,        */  {  6, 21 },
+/*  57: 0,       3, 4, 5,        */  { 11,  4 },
+/*  58:    1,    3, 4, 5,        */  { 12, 15 },
+/*  59: 0, 1,    3, 4, 5,        */  {  5, 30 },
+/*  60:       2, 3, 4, 5,        */  { 10,  5 },
+/*  61: 0,    2, 3, 4, 5,        */  {  6, 32 },
+/*  62:    1, 2, 3, 4, 5,        */  {  6, 39 },
+/*  63: 0, 1, 2, 3, 4, 5,        */  {  2, 12 },
+/*  64:                   6,     */  {  1,  6 },
+/*  65: 0,                6,     */  {  4,  0 },
+/*  66:    1,             6,     */  {  3,  5 },
+/*  67: 0, 1,             6,     */  {  6,  0 },
+/*  68:       2,          6,     */  {  2,  6 },
+/*  69: 0,    2,          6,     */  {  6,  3 },
+/*  70:    1, 2,          6,     */  {  5, 11 },
+/*  71: 0, 1, 2,          6,     */  { 14,  0 },
+/*  72:          3,       6,     */  {  3,  9 },
+/*  73: 0,       3,       6,     */  {  6,  5 },
+/*  74:    1,    3,       6,     */  {  7,  4 },
+/*  75: 0, 1,    3,       6,     */  { 12,  1 },
+/*  76:       2, 3,       6,     */  {  5, 14 },
+/*  77: 0,    2, 3,       6,     */  { 11,  3 },
+/*  78:    1, 2, 3,       6,     */  {  9,  4 },
+/*  79: 0, 1, 2, 3,       6,     */  {  5, 26 },
+/*  80:             4,    6,     */  {  3, 10 },
+/*  81: 0,          4,    6,     */  {  6,  6 },
+/*  82:    1,       4,    6,     */  {  7,  5 },
+/*  83: 0, 1,       4,    6,     */  { 12,  2 },
+/*  84:       2,    4,    6,     */  {  6, 19 },
+/*  85: 0,    2,    4,    6,     */  { 10,  1 },
+/*  86:    1, 2,    4,    6,     */  { 12, 13 },
+/*  87: 0, 1, 2,    4,    6,     */  {  6, 24 },
+/*  88:          3, 4,    6,     */  {  7,  7 },
+/*  89: 0,       3, 4,    6,     */  { 12,  9 },
+/*  90:    1,    3, 4,    6,     */  { 13,  1 },
+/*  91: 0, 1,    3, 4,    6,     */  {  7,  9 },
+/*  92:       2, 3, 4,    6,     */  { 12, 20 },
+/*  93: 0,    2, 3, 4,    6,     */  {  6, 33 },
+/*  94:    1, 2, 3, 4,    6,     */  {  7, 13 },
+/*  95: 0, 1, 2, 3, 4,    6,     */  {  3, 12 },
+/*  96:                5, 6,     */  {  2, 10 },
+/*  97: 0,             5, 6,     */  {  6,  7 },
+/*  98:    1,          5, 6,     */  {  5, 13 },
+/*  99: 0, 1,          5, 6,     */  { 11,  2 },
+/* 100:       2,       5, 6,     */  {  5, 16 },
+/* 101: 0,    2,       5, 6,     */  { 12,  7 },
+/* 102:    1, 2,       5, 6,     */  {  8,  3 },
+/* 103: 0, 1, 2,       5, 6,     */  {  5, 29 },
+/* 104:          3,    5, 6,     */  {  6, 22 },
+/* 105: 0,       3,    5, 6,     */  { 10,  2 },
+/* 106:    1,    3,    5, 6,     */  { 12, 17 },
+/* 107: 0, 1,    3,    5, 6,     */  {  6, 27 },
+/* 108:       2, 3,    5, 6,     */  { 14,  9 },
+/* 109: 0,    2, 3,    5, 6,     */  {  6, 34 },
+/* 110:    1, 2, 3,    5, 6,     */  {  5, 39 },
+/* 111: 0, 1, 2, 3,    5, 6,     */  {  2, 14 },
+/* 112:             4, 5, 6,     */  {  5, 20 },
+/* 113: 0,          4, 5, 6,     */  { 14,  5 },
+/* 114:    1,       4, 5, 6,     */  {  9,  5 },
+/* 115: 0, 1,       4, 5, 6,     */  {  5, 32 },
+/* 116:       2,    4, 5, 6,     */  { 11, 10 },
+/* 117: 0,    2,    4, 5, 6,     */  {  6, 35 },
+/* 118:    1, 2,    4, 5, 6,     */  {  5, 41 },
+/* 119: 0, 1, 2,    4, 5, 6,     */  {  2, 16 },
+/* 120:          3, 4, 5, 6,     */  { 12, 23 },
+/* 121: 0,       3, 4, 5, 6,     */  {  6, 37 },
+/* 122:    1,    3, 4, 5, 6,     */  {  7, 14 },
+/* 123: 0, 1,    3, 4, 5, 6,     */  {  3, 16 },
+/* 124:       2, 3, 4, 5, 6,     */  {  6, 46 },
+/* 125: 0,    2, 3, 4, 5, 6,     */  {  4,  6 },
+/* 126:    1, 2, 3, 4, 5, 6,     */  {  3, 21 },
+/* 127: 0, 1, 2, 3, 4, 5, 6,     */  {  1,  8 },
+/* 128:                      7,  */  {  1,  7 },
+/* 129: 0,                   7,  */  {  3,  2 },
+/* 130:    1,                7,  */  {  4,  1 },
+/* 131: 0, 1,                7,  */  {  6,  1 },
+/* 132:       2,             7,  */  {  3,  7 },
+/* 133: 0,    2,             7,  */  {  7,  1 },
+/* 134:    1, 2,             7,  */  {  6, 10 },
+/* 135: 0, 1, 2,             7,  */  { 12,  0 },
+/* 136:          3,          7,  */  {  2,  7 },
+/* 137: 0,       3,          7,  */  {  5,  6 },
+/* 138:    1,    3,          7,  */  {  6, 12 },
+/* 139: 0, 1,    3,          7,  */  { 11,  1 },
+/* 140:       2, 3,          7,  */  {  5, 15 },
+/* 141: 0,    2, 3,          7,  */  {  9,  2 },
+/* 142:    1, 2, 3,          7,  */  { 14,  6 },
+/* 143: 0, 1, 2, 3,          7,  */  {  5, 27 },
+/* 144:             4,       7,  */  {  2,  9 },
+/* 145: 0,          4,       7,  */  {  5,  8 },
+/* 146:    1,       4,       7,  */  {  6, 13 },
+/* 147: 0, 1,       4,       7,  */  { 14,  2 },
+/* 148:       2,    4,       7,  */  {  6, 20 },
+/* 149: 0,    2,    4,       7,  */  { 12,  6 },
+/* 150:    1, 2,    4,       7,  */  { 10,  3 },
+/* 151: 0, 1, 2,    4,       7,  */  {  6, 25 },
+/* 152:          3, 4,       7,  */  {  5, 18 },
+/* 153: 0,       3, 4,       7,  */  {  8,  2 },
+/* 154:    1,    3, 4,       7,  */  { 12, 16 },
+/* 155: 0, 1,    3, 4,       7,  */  {  5, 31 },
+/* 156:       2, 3, 4,       7,  */  { 11,  9 },
+/* 157: 0,    2, 3, 4,       7,  */  {  5, 34 },
+/* 158:    1, 2, 3, 4,       7,  */  {  6, 40 },
+/* 159: 0, 1, 2, 3, 4,       7,  */  {  2, 13 },
+/* 160:                5,    7,  */  {  3, 11 },
+/* 161: 0,             5,    7,  */  {  7,  2 },
+/* 162:    1,          5,    7,  */  {  6, 14 },
+/* 163: 0, 1,          5,    7,  */  { 12,  3 },
+/* 164:       2,       5,    7,  */  {  7,  6 },
+/* 165: 0,    2,       5,    7,  */  { 13,  0 },
+/* 166:    1, 2,       5,    7,  */  { 12, 14 },
+/* 167: 0, 1, 2,       5,    7,  */  {  7,  8 },
+/* 168:          3,    5,    7,  */  {  6, 23 },
+/* 169: 0,       3,    5,    7,  */  { 12, 10 },
+/* 170:    1,    3,    5,    7,  */  { 10,  4 },
+/* 171: 0, 1,    3,    5,    7,  */  {  6, 28 },
+/* 172:       2, 3,    5,    7,  */  { 12, 21 },
+/* 173: 0,    2, 3,    5,    7,  */  {  7, 10 },
+/* 174:    1, 2, 3,    5,    7,  */  {  6, 41 },
+/* 175: 0, 1, 2, 3,    5,    7,  */  {  3, 13 },
+/* 176:             4, 5,    7,  */  {  5, 21 },
+/* 177: 0,          4, 5,    7,  */  {  9,  3 },
+/* 178:    1,       4, 5,    7,  */  { 11,  8 },
+/* 179: 0, 1,       4, 5,    7,  */  {  5, 33 },
+/* 180:       2,    4, 5,    7,  */  { 12, 22 },
+/* 181: 0,    2,    4, 5,    7,  */  {  7, 11 },
+/* 182:    1, 2,    4, 5,    7,  */  {  6, 42 },
+/* 183: 0, 1, 2,    4, 5,    7,  */  {  3, 14 },
+/* 184:          3, 4, 5,    7,  */  { 14, 11 },
+/* 185: 0,       3, 4, 5,    7,  */  {  5, 36 },
+/* 186:    1,    3, 4, 5,    7,  */  {  6, 44 },
+/* 187: 0, 1,    3, 4, 5,    7,  */  {  2, 17 },
+/* 188:       2, 3, 4, 5,    7,  */  {  6, 47 },
+/* 189: 0,    2, 3, 4, 5,    7,  */  {  3, 18 },
+/* 190:    1, 2, 3, 4, 5,    7,  */  {  4,  7 },
+/* 191: 0, 1, 2, 3, 4, 5,    7,  */  {  1,  9 },
+/* 192:                   6, 7,  */  {  2, 11 },
+/* 193: 0,                6, 7,  */  {  6,  8 },
+/* 194:    1,             6, 7,  */  {  6, 15 },
+/* 195: 0, 1,             6, 7,  */  { 10,  0 },
+/* 196:       2,          6, 7,  */  {  5, 17 },
+/* 197: 0,    2,          6, 7,  */  { 12,  8 },
+/* 198:    1, 2,          6, 7,  */  { 11,  7 },
+/* 199: 0, 1, 2,          6, 7,  */  {  6, 26 },
+/* 200:          3,       6, 7,  */  {  5, 19 },
+/* 201: 0,       3,       6, 7,  */  { 14,  4 },
+/* 202:    1,    3,       6, 7,  */  { 12, 18 },
+/* 203: 0, 1,    3,       6, 7,  */  {  6, 29 },
+/* 204:       2, 3,       6, 7,  */  {  8,  4 },
+/* 205: 0,    2, 3,       6, 7,  */  {  5, 35 },
+/* 206:    1, 2, 3,       6, 7,  */  {  5, 40 },
+/* 207: 0, 1, 2, 3,       6, 7,  */  {  2, 15 },
+/* 208:             4,    6, 7,  */  {  5, 22 },
+/* 209: 0,          4,    6, 7,  */  { 11,  5 },
+/* 210:    1,       4,    6, 7,  */  { 12, 19 },
+/* 211: 0, 1,       4,    6, 7,  */  {  6, 30 },
+/* 212:       2,    4,    6, 7,  */  { 14, 10 },
+/* 213: 0,    2,    4,    6, 7,  */  {  6, 36 },
+/* 214:    1, 2,    4,    6, 7,  */  {  6, 43 },
+/* 215: 0, 1, 2,    4,    6, 7,  */  {  4,  4 },
+/* 216:          3, 4,    6, 7,  */  {  9,  7 },
+/* 217: 0,       3, 4,    6, 7,  */  {  5, 37 },
+/* 218:    1,    3, 4,    6, 7,  */  {  7, 15 },
+/* 219: 0, 1,    3, 4,    6, 7,  */  {  3, 17 },
+/* 220:       2, 3, 4,    6, 7,  */  {  5, 44 },
+/* 221: 0,    2, 3, 4,    6, 7,  */  {  2, 19 },
+/* 222:    1, 2, 3, 4,    6, 7,  */  {  3, 22 },
+/* 223: 0, 1, 2, 3, 4,    6, 7,  */  {  1, 10 },
+/* 224:                5, 6, 7,  */  {  5, 23 },
+/* 225: 0,             5, 6, 7,  */  { 12, 11 },
+/* 226:    1,          5, 6, 7,  */  { 14,  8 },
+/* 227: 0, 1,          5, 6, 7,  */  {  6, 31 },
+/* 228:       2,       5, 6, 7,  */  {  9,  6 },
+/* 229: 0,    2,       5, 6, 7,  */  {  7, 12 },
+/* 230:    1, 2,       5, 6, 7,  */  {  5, 42 },
+/* 231: 0, 1, 2,       5, 6, 7,  */  {  3, 15 },
+/* 232:          3,    5, 6, 7,  */  { 11, 11 },
+/* 233: 0,       3,    5, 6, 7,  */  {  6, 38 },
+/* 234:    1,    3,    5, 6, 7,  */  {  6, 45 },
+/* 235: 0, 1,    3,    5, 6, 7,  */  {  4,  5 },
+/* 236:       2, 3,    5, 6, 7,  */  {  5, 45 },
+/* 237: 0,    2, 3,    5, 6, 7,  */  {  3, 19 },
+/* 238:    1, 2, 3,    5, 6, 7,  */  {  2, 21 },
+/* 239: 0, 1, 2, 3,    5, 6, 7,  */  {  1, 11 },
+/* 240:             4, 5, 6, 7,  */  {  8,  5 },
+/* 241: 0,          4, 5, 6, 7,  */  {  5, 38 },
+/* 242:    1,       4, 5, 6, 7,  */  {  5, 43 },
+/* 243: 0, 1,       4, 5, 6, 7,  */  {  2, 18 },
+/* 244:       2,    4, 5, 6, 7,  */  {  5, 46 },
+/* 245: 0,    2,    4, 5, 6, 7,  */  {  3, 20 },
+/* 246:    1, 2,    4, 5, 6, 7,  */  {  2, 22 },
+/* 247: 0, 1, 2,    4, 5, 6, 7,  */  {  1, 12 },
+/* 248:          3, 4, 5, 6, 7,  */  {  5, 47 },
+/* 249: 0,       3, 4, 5, 6, 7,  */  {  2, 20 },
+/* 250:    1,    3, 4, 5, 6, 7,  */  {  3, 23 },
+/* 251: 0, 1,    3, 4, 5, 6, 7,  */  {  1, 13 },
+/* 252:       2, 3, 4, 5, 6, 7,  */  {  2, 23 },
+/* 253: 0,    2, 3, 4, 5, 6, 7,  */  {  1, 14 },
+/* 254:    1, 2, 3, 4, 5, 6, 7,  */  {  1, 15 },
+/* 255: 0, 1, 2, 3, 4, 5, 6, 7,  */  {  0, -1 }
+};
+//_____________________________________________________________________________
+
+
+//_____________________________________________________________________________
+/**
+ * \brief tiling table for case 1
+ * For each of the case above, the specific triangulation of the edge
+ * intersection points is given.
+ * When a case is ambiguous, there is an auxiliary table that contains
+ * the face number to test and the tiling table contains the specific
+ * triangulations depending on the results
+ * A minus sign means to invert the result of the test.
+ */
+//-----------------------------------------------------------------------------
+static const char tiling1[16][3] = {
+/*   1: 0,                       */  {  0,  8,  3 },
+/*   2:    1,                    */  {  0,  1,  9 },
+/*   4:       2,                 */  {  1,  2, 10 },
+/*   8:          3,              */  {  3, 11,  2 },
+/*  16:             4,           */  {  4,  7,  8 },
+/*  32:                5,        */  {  9,  5,  4 },
+/*  64:                   6,     */  { 10,  6,  5 },
+/* 128:                      7,  */  {  7,  6, 11 },
+/* 127: 0, 1, 2, 3, 4, 5, 6,     */  {  7, 11,  6 },
+/* 191: 0, 1, 2, 3, 4, 5,    7,  */  { 10,  5,  6 },
+/* 223: 0, 1, 2, 3, 4,    6, 7,  */  {  9,  4,  5 },
+/* 239: 0, 1, 2, 3,    5, 6, 7,  */  {  4,  8,  7 },
+/* 247: 0, 1, 2,    4, 5, 6, 7,  */  {  3,  2, 11 },
+/* 251: 0, 1,    3, 4, 5, 6, 7,  */  {  1, 10,  2 },
+/* 253: 0,    2, 3, 4, 5, 6, 7,  */  {  0,  9,  1 },
+/* 254:    1, 2, 3, 4, 5, 6, 7,  */  {  0,  3,  8 }
+};
+//_____________________________________________________________________________
+
+
+//_____________________________________________________________________________
+/**
+ * \brief tiling table for case 2
+ * For each of the case above, the specific triangulation of the edge
+ * intersection points is given.
+ * When a case is ambiguous, there is an auxiliary table that contains
+ * the face number to test and the tiling table contains the specific
+ * triangulations depending on the results
+ * A minus sign means to invert the result of the test.
+ */
+//-----------------------------------------------------------------------------
+static const char tiling2[24][6] = {
+/*   3: 0, 1,                    */  {  1,  8,  3,  9,  8,  1 },
+/*   9: 0,       3,              */  {  0, 11,  2,  8, 11,  0 },
+/*  17: 0,          4,           */  {  4,  3,  0,  7,  3,  4 },
+/*   6:    1, 2,                 */  {  9,  2, 10,  0,  2,  9 },
+/*  34:    1,          5,        */  {  0,  5,  4,  1,  5,  0 },
+/*  12:       2, 3,              */  {  3, 10,  1, 11, 10,  3 },
+/*  68:       2,          6,     */  {  1,  6,  5,  2,  6,  1 },
+/* 136:          3,          7,  */  {  7,  2,  3,  6,  2,  7 },
+/*  48:             4, 5,        */  {  9,  7,  8,  5,  7,  9 },
+/* 144:             4,       7,  */  {  6,  8,  4, 11,  8,  6 },
+/*  96:                5, 6,     */  { 10,  4,  9,  6,  4, 10 },
+/* 192:                   6, 7,  */  { 11,  5, 10,  7,  5, 11 },
+/*  63: 0, 1, 2, 3, 4, 5,        */  { 11, 10,  5,  7, 11,  5 },
+/* 159: 0, 1, 2, 3, 4,       7,  */  { 10,  9,  4,  6, 10,  4 },
+/* 111: 0, 1, 2, 3,    5, 6,     */  {  6,  4,  8, 11,  6,  8 },
+/* 207: 0, 1, 2, 3,       6, 7,  */  {  9,  8,  7,  5,  9,  7 },
+/* 119: 0, 1, 2,    4, 5, 6,     */  {  7,  3,  2,  6,  7,  2 },
+/* 187: 0, 1,    3, 4, 5,    7,  */  {  1,  5,  6,  2,  1,  6 },
+/* 243: 0, 1,       4, 5, 6, 7,  */  {  3,  1, 10, 11,  3, 10 },
+/* 221: 0,    2, 3, 4,    6, 7,  */  {  0,  4,  5,  1,  0,  5 },
+/* 249: 0,       3, 4, 5, 6, 7,  */  {  9, 10,  2,  0,  9,  2 },
+/* 238:    1, 2, 3,    5, 6, 7,  */  {  4,  0,  3,  7,  4,  3 },
+/* 246:    1, 2,    4, 5, 6, 7,  */  {  0,  2, 11,  8,  0, 11 },
+/* 252:       2, 3, 4, 5, 6, 7,  */  {  1,  3,  8,  9,  1,  8 }
+};
+//_____________________________________________________________________________
+
+//_____________________________________________________________________________
+/**
+ * \brief test table for case 3
+ * One face to test
+ * When the test on the specified face is positive : 4 first triangles
+ * When the test on the specified face is negative : 2 last triangles
+ *
+ * For each of the case above, the specific triangulation of the edge
+ * intersection points is given.
+ * When a case is ambiguous, there is an auxiliary table that contains
+ * the face number to test and the tiling table contains the specific
+ * triangulations depending on the results
+ * A minus sign means to invert the result of the test.
+ */
+//-----------------------------------------------------------------------------
+static const char test3[24] = {
+/*   5: 0,    2,                 */    5,
+/*  33: 0,             5,        */    1,
+/* 129: 0,                   7,  */    4,
+/*  10:    1,    3,              */    5,
+/*  18:    1,       4,           */    1,
+/*  66:    1,             6,     */    2,
+/*  36:       2,       5,        */    2,
+/* 132:       2,             7,  */    3,
+/*  24:          3, 4,           */    4,
+/*  72:          3,       6,     */    3,
+/*  80:             4,    6,     */    6,
+/* 160:                5,    7,  */    6,
+/*  95: 0, 1, 2, 3, 4,    6,     */   -6,
+/* 175: 0, 1, 2, 3,    5,    7,  */   -6,
+/* 183: 0, 1, 2,    4, 5,    7,  */   -3,
+/* 231: 0, 1, 2,       5, 6, 7,  */   -4,
+/* 123: 0, 1,    3, 4, 5, 6,     */   -3,
+/* 219: 0, 1,    3, 4,    6, 7,  */   -2,
+/* 189: 0,    2, 3, 4, 5,    7,  */   -2,
+/* 237: 0,    2, 3,    5, 6, 7,  */   -1,
+/* 245: 0,    2,    4, 5, 6, 7,  */   -5,
+/* 126:    1, 2, 3, 4, 5, 6,     */   -4,
+/* 222:    1, 2, 3, 4,    6, 7,  */   -1,
+/* 250:    1,    3, 4, 5, 6, 7,  */   -5
+};
+
+//_____________________________________________________________________________
+/**
+ * \brief tiling table for case 3.1
+ * For each of the case above, the specific triangulation of the edge
+ * intersection points is given.
+ * When a case is ambiguous, there is an auxiliary table that contains
+ * the face number to test and the tiling table contains the specific
+ * triangulations depending on the results
+ * A minus sign means to invert the result of the test.
+ */
+//-----------------------------------------------------------------------------
+static const char tiling3_1[24][6] = {
+/*   5: 0,    2,                 */  {  0,  8,  3,  1,  2, 10 },
+/*  33: 0,             5,        */  {  9,  5,  4,  0,  8,  3 },
+/* 129: 0,                   7,  */  {  3,  0,  8, 11,  7,  6 },
+/*  10:    1,    3,              */  {  1,  9,  0,  2,  3, 11 },
+/*  18:    1,       4,           */  {  0,  1,  9,  8,  4,  7 },
+/*  66:    1,             6,     */  {  9,  0,  1,  5, 10,  6 },
+/*  36:       2,       5,        */  {  1,  2, 10,  9,  5,  4 },
+/* 132:       2,             7,  */  { 10,  1,  2,  6, 11,  7 },
+/*  24:          3, 4,           */  {  8,  4,  7,  3, 11,  2 },
+/*  72:          3,       6,     */  {  2,  3, 11, 10,  6,  5 },
+/*  80:             4,    6,     */  {  5, 10,  6,  4,  7,  8 },
+/* 160:                5,    7,  */  {  4,  9,  5,  7,  6, 11 },
+/*  95: 0, 1, 2, 3, 4,    6,     */  {  5,  9,  4, 11,  6,  7 },
+/* 175: 0, 1, 2, 3,    5,    7,  */  {  6, 10,  5,  8,  7,  4 },
+/* 183: 0, 1, 2,    4, 5,    7,  */  { 11,  3,  2,  5,  6, 10 },
+/* 231: 0, 1, 2,       5, 6, 7,  */  {  7,  4,  8,  2, 11,  3 },
+/* 123: 0, 1,    3, 4, 5, 6,     */  {  2,  1, 10,  7, 11,  6 },
+/* 219: 0, 1,    3, 4,    6, 7,  */  { 10,  2,  1,  4,  5,  9 },
+/* 189: 0,    2, 3, 4, 5,    7,  */  {  1,  0,  9,  6, 10,  5 },
+/* 237: 0,    2, 3,    5, 6, 7,  */  {  9,  1,  0,  7,  4,  8 },
+/* 245: 0,    2,    4, 5, 6, 7,  */  {  0,  9,  1, 11,  3,  2 },
+/* 126:    1, 2, 3, 4, 5, 6,     */  {  8,  0,  3,  6,  7, 11 },
+/* 222:    1, 2, 3, 4,    6, 7,  */  {  4,  5,  9,  3,  8,  0 },
+/* 250:    1,    3, 4, 5, 6, 7,  */  {  3,  8,  0, 10,  2,  1 }
+};
+
+//_____________________________________________________________________________
+/**
+ * \brief tiling table for case 3.2
+ * For each of the case above, the specific triangulation of the edge
+ * intersection points is given.
+ * When a case is ambiguous, there is an auxiliary table that contains
+ * the face number to test and the tiling table contains the specific
+ * triangulations depending on the results
+ * A minus sign means to invert the result of the test.
+ */
+//-----------------------------------------------------------------------------
+static const char tiling3_2[24][12] = {
+/*   5: 0,    2,                 */  { 10,  3,  2, 10,  8,  3, 10,  1,  0,  8, 10,  0 },
+/*  33: 0,             5,        */  {  3,  4,  8,  3,  5,  4,  3,  0,  9,  5,  3,  9 },
+/* 129: 0,                   7,  */  {  6,  8,  7,  6,  0,  8,  6, 11,  3,  0,  6,  3 },
+/*  10:    1,    3,              */  { 11,  0,  3, 11,  9,  0, 11,  2,  1,  9, 11,  1 },
+/*  18:    1,       4,           */  {  7,  9,  4,  7,  1,  9,  7,  8,  0,  1,  7,  0 },
+/*  66:    1,             6,     */  {  6,  1, 10,  6,  0,  1,  9,  0,  6,  9,  6,  5 },
+/*  36:       2,       5,        */  {  4, 10,  5,  4,  2, 10,  4,  9,  1,  2,  4,  1 },
+/* 132:       2,             7,  */  {  7,  2, 11,  7,  1,  2,  7,  6, 10,  1,  7, 10 },
+/*  24:          3, 4,           */  {  2,  7, 11,  2,  4,  7,  2,  3,  8,  4,  2,  8 },
+/*  72:          3,       6,     */  {  5, 11,  6,  5,  3, 11,  5, 10,  2,  3,  5,  2 },
+/*  80:             4,    6,     */  {  8,  6,  7,  8, 10,  6,  8,  4,  5, 10,  8,  5 },
+/* 160:                5,    7,  */  { 11,  5,  6, 11,  9,  5, 11,  7,  4,  9, 11,  4 },
+/*  95: 0, 1, 2, 3, 4,    6,     */  {  6,  5, 11,  5,  9, 11,  4,  7, 11,  4, 11,  9 },
+/* 175: 0, 1, 2, 3,    5,    7,  */  {  7,  6,  8,  6, 10,  8,  5,  4,  8,  5,  8, 10 },
+/* 183: 0, 1, 2,    4, 5,    7,  */  {  6, 11,  5, 11,  3,  5,  2, 10,  5,  2,  5,  3 },
+/* 231: 0, 1, 2,       5, 6, 7,  */  { 11,  7,  2,  7,  4,  2,  8,  3,  2,  8,  2,  4 },
+/* 123: 0, 1,    3, 4, 5, 6,     */  { 11,  2,  7,  2,  1,  7, 10,  6,  7, 10,  7,  1 },
+/* 219: 0, 1,    3, 4,    6, 7,  */  {  5, 10,  4, 10,  2,  4,  1,  9,  4,  1,  4,  2 },
+/* 189: 0,    2, 3, 4, 5,    7,  */  { 10,  1,  6,  1,  0,  6,  6,  0,  9,  5,  6,  9 },
+/* 237: 0,    2, 3,    5, 6, 7,  */  {  4,  9,  7,  9,  1,  7,  0,  8,  7,  0,  7,  1 },
+/* 245: 0,    2,    4, 5, 6, 7,  */  {  3,  0, 11,  0,  9, 11,  1,  2, 11,  1, 11,  9 },
+/* 126:    1, 2, 3, 4, 5, 6,     */  {  7,  8,  6,  8,  0,  6,  3, 11,  6,  3,  6,  0 },
+/* 222:    1, 2, 3, 4,    6, 7,  */  {  8,  4,  3,  4,  5,  3,  9,  0,  3,  9,  3,  5 },
+/* 250:    1,    3, 4, 5, 6, 7,  */  {  2,  3, 10,  3,  8, 10,  0,  1, 10,  0, 10,  8 }
+};
+//_____________________________________________________________________________
+
+
+
+//_____________________________________________________________________________
+/**
+ * \brief test table for case 4
+ * Interior to test
+ * When the test on the interior is negative : 2 first triangles
+ * When the test on the interior is positive : 6 last triangles
+ *
+ * For each of the case above, the specific triangulation of the edge
+ * intersection points is given.
+ * When a case is ambiguous, there is an auxiliary table that contains
+ * the face number to test and the tiling table contains the specific
+ * triangulations depending on the results
+ * A minus sign means to invert the result of the test.
+ */
+//-----------------------------------------------------------------------------
+static const char test4[8] = {
+/*  65: 0,                6,     */   7,
+/* 130:    1,                7,  */   7,
+/*  20:       2,    4,           */   7,
+/*  40:          3,    5,        */   7,
+/* 215: 0, 1, 2,    4,    6, 7,  */  -7,
+/* 235: 0, 1,    3,    5, 6, 7,  */  -7,
+/* 125: 0,    2, 3, 4, 5, 6,     */  -7,
+/* 190:    1, 2, 3, 4, 5,    7,  */  -7
+};
+
+//_____________________________________________________________________________
+/**
+ * \brief tiling table for case 4.1
+ * For each of the case above, the specific triangulation of the edge
+ * intersection points is given.
+ * When a case is ambiguous, there is an auxiliary table that contains
+ * the face number to test and the tiling table contains the specific
+ * triangulations depending on the results
+ * A minus sign means to invert the result of the test.
+ */
+//-----------------------------------------------------------------------------
+static const char tiling4_1[8][6] = {
+/*  65: 0,                6,     */  {  0,  8,  3,  5, 10,  6 },
+/* 130:    1,                7,  */  {  0,  1,  9, 11,  7,  6 },
+/*  20:       2,    4,           */  {  1,  2, 10,  8,  4,  7 },
+/*  40:          3,    5,        */  {  9,  5,  4,  2,  3, 11 },
+/* 215: 0, 1, 2,    4,    6, 7,  */  {  4,  5,  9, 11,  3,  2 },
+/* 235: 0, 1,    3,    5, 6, 7,  */  { 10,  2,  1,  7,  4,  8 },
+/* 125: 0,    2, 3, 4, 5, 6,     */  {  9,  1,  0,  6,  7, 11 },
+/* 190:    1, 2, 3, 4, 5,    7,  */  {  3,  8,  0,  6, 10,  5 }
+};
+
+//_____________________________________________________________________________
+/**
+ * \brief tiling table for case 4.2
+ * For each of the case above, the specific triangulation of the edge
+ * intersection points is given.
+ * When a case is ambiguous, there is an auxiliary table that contains
+ * the face number to test and the tiling table contains the specific
+ * triangulations depending on the results
+ * A minus sign means to invert the result of the test.
+ */
+//-----------------------------------------------------------------------------
+static const char tiling4_2[8][18] = {
+/*  65: 0,                6,     */  {  8,  5,  0,  5,  8,  6,  3,  6,  8,  6,  3, 10,  0, 10,  3, 10,  0,  5 },
+/* 130:    1,                7,  */  {  9,  6,  1,  6,  9,  7,  0,  7,  9,  7,  0, 11,  1, 11,  0, 11,  1,  6 },
+/*  20:       2,    4,           */  { 10,  7,  2,  7, 10,  4,  1,  4, 10,  4,  1,  8,  2,  8,  1,  8,  2,  7 },
+/*  40:          3,    5,        */  { 11,  4,  3,  4, 11,  5,  2,  5, 11,  5,  2,  9,  3,  9,  2,  9,  3,  4 },
+/* 215: 0, 1, 2,    4,    6, 7,  */  {  3,  4, 11,  5, 11,  4, 11,  5,  2,  9,  2,  5,  2,  9,  3,  4,  3,  9 },
+/* 235: 0, 1,    3,    5, 6, 7,  */  {  2,  7, 10,  4, 10,  7, 10,  4,  1,  8,  1,  4,  1,  8,  2,  7,  2,  8 },
+/* 125: 0,    2, 3, 4, 5, 6,     */  {  1,  6,  9,  7,  9,  6,  9,  7,  0, 11,  0,  7,  0, 11,  1,  6,  1, 11 },
+/* 190:    1, 2, 3, 4, 5,    7,  */  {  0,  5,  8,  6,  8,  5,  8,  6,  3, 10,  3,  6,  3, 10,  0,  5,  0, 10 }
+};
+//_____________________________________________________________________________
+
+
+//_____________________________________________________________________________
+/**
+ * \brief tiling table for case 5
+ * For each of the case above, the specific triangulation of the edge
+ * intersection points is given.
+ * When a case is ambiguous, there is an auxiliary table that contains
+ * the face number to test and the tiling table contains the specific
+ * triangulations depending on the results
+ * A minus sign means to invert the result of the test.
+ */
+//-----------------------------------------------------------------------------
+static const char tiling5[48][9] = {
+/*   7: 0, 1, 2,                 */  {  2,  8,  3,  2, 10,  8, 10,  9,  8 },
+/*  11: 0, 1,    3,              */  {  1, 11,  2,  1,  9, 11,  9,  8, 11 },
+/*  19: 0, 1,       4,           */  {  4,  1,  9,  4,  7,  1,  7,  3,  1 },
+/*  35: 0, 1,          5,        */  {  8,  5,  4,  8,  3,  5,  3,  1,  5 },
+/*  13: 0,    2, 3,              */  {  0, 10,  1,  0,  8, 10,  8, 11, 10 },
+/*  25: 0,       3, 4,           */  { 11,  4,  7, 11,  2,  4,  2,  0,  4 },
+/* 137: 0,       3,          7,  */  {  7,  0,  8,  7,  6,  0,  6,  2,  0 },
+/*  49: 0,          4, 5,        */  {  9,  3,  0,  9,  5,  3,  5,  7,  3 },
+/* 145: 0,          4,       7,  */  {  3,  6, 11,  3,  0,  6,  0,  4,  6 },
+/*  14:    1, 2, 3,              */  {  3,  9,  0,  3, 11,  9, 11, 10,  9 },
+/*  38:    1, 2,       5,        */  {  5,  2, 10,  5,  4,  2,  4,  0,  2 },
+/*  70:    1, 2,          6,     */  {  9,  6,  5,  9,  0,  6,  0,  2,  6 },
+/*  50:    1,       4, 5,        */  {  0,  7,  8,  0,  1,  7,  1,  5,  7 },
+/*  98:    1,          5, 6,     */  { 10,  0,  1, 10,  6,  0,  6,  4,  0 },
+/*  76:       2, 3,       6,     */  {  6,  3, 11,  6,  5,  3,  5,  1,  3 },
+/* 140:       2, 3,          7,  */  { 10,  7,  6, 10,  1,  7,  1,  3,  7 },
+/* 100:       2,       5, 6,     */  {  1,  4,  9,  1,  2,  4,  2,  6,  4 },
+/* 196:       2,          6, 7,  */  { 11,  1,  2, 11,  7,  1,  7,  5,  1 },
+/* 152:          3, 4,       7,  */  {  8,  2,  3,  8,  4,  2,  4,  6,  2 },
+/* 200:          3,       6, 7,  */  {  2,  5, 10,  2,  3,  5,  3,  7,  5 },
+/* 112:             4, 5, 6,     */  {  7, 10,  6,  7,  8, 10,  8,  9, 10 },
+/* 176:             4, 5,    7,  */  {  6,  9,  5,  6, 11,  9, 11,  8,  9 },
+/* 208:             4,    6, 7,  */  {  5,  8,  4,  5, 10,  8, 10, 11,  8 },
+/* 224:                5, 6, 7,  */  {  4, 11,  7,  4,  9, 11,  9, 10, 11 },
+/*  31: 0, 1, 2, 3, 4,           */  {  4,  7, 11,  4, 11,  9,  9, 11, 10 },
+/*  47: 0, 1, 2, 3,    5,        */  {  5,  4,  8,  5,  8, 10, 10,  8, 11 },
+/*  79: 0, 1, 2, 3,       6,     */  {  6,  5,  9,  6,  9, 11, 11,  9,  8 },
+/* 143: 0, 1, 2, 3,          7,  */  {  7,  6, 10,  7, 10,  8,  8, 10,  9 },
+/*  55: 0, 1, 2,    4, 5,        */  {  2, 10,  5,  2,  5,  3,  3,  5,  7 },
+/* 103: 0, 1, 2,       5, 6,     */  {  8,  3,  2,  8,  2,  4,  4,  2,  6 },
+/*  59: 0, 1,    3, 4, 5,        */  { 11,  2,  1, 11,  1,  7,  7,  1,  5 },
+/* 155: 0, 1,    3, 4,       7,  */  {  1,  9,  4,  1,  4,  2,  2,  4,  6 },
+/* 115: 0, 1,       4, 5, 6,     */  { 10,  6,  7, 10,  7,  1,  1,  7,  3 },
+/* 179: 0, 1,       4, 5,    7,  */  {  6, 11,  3,  6,  3,  5,  5,  3,  1 },
+/* 157: 0,    2, 3, 4,       7,  */  { 10,  1,  0, 10,  0,  6,  6,  0,  4 },
+/* 205: 0,    2, 3,       6, 7,  */  {  0,  8,  7,  0,  7,  1,  1,  7,  5 },
+/* 185: 0,       3, 4, 5,    7,  */  {  9,  5,  6,  9,  6,  0,  0,  6,  2 },
+/* 217: 0,       3, 4,    6, 7,  */  {  5, 10,  2,  5,  2,  4,  4,  2,  0 },
+/* 241: 0,          4, 5, 6, 7,  */  {  3,  0,  9,  3,  9, 11, 11,  9, 10 },
+/* 110:    1, 2, 3,    5, 6,     */  {  3, 11,  6,  3,  6,  0,  0,  6,  4 },
+/* 206:    1, 2, 3,       6, 7,  */  {  9,  0,  3,  9,  3,  5,  5,  3,  7 },
+/* 118:    1, 2,    4, 5, 6,     */  {  7,  8,  0,  7,  0,  6,  6,  0,  2 },
+/* 230:    1, 2,       5, 6, 7,  */  { 11,  7,  4, 11,  4,  2,  2,  4,  0 },
+/* 242:    1,       4, 5, 6, 7,  */  {  0,  1, 10,  0, 10,  8,  8, 10, 11 },
+/* 220:       2, 3, 4,    6, 7,  */  {  8,  4,  5,  8,  5,  3,  3,  5,  1 },
+/* 236:       2, 3,    5, 6, 7,  */  {  4,  9,  1,  4,  1,  7,  7,  1,  3 },
+/* 244:       2,    4, 5, 6, 7,  */  {  1,  2, 11,  1, 11,  9,  9, 11,  8 },
+/* 248:          3, 4, 5, 6, 7,  */  {  2,  3,  8,  2,  8, 10, 10,  8,  9 }
+};
+//_____________________________________________________________________________
+
+
+//_____________________________________________________________________________
+/**
+ * \brief test table for case 6
+ * 1 face to test + eventually the interior
+ * When the test on the specified face is positive : 5 first triangles
+ * When the test on the specified face is negative :
+ * - if the test on the interior is negative : 3 middle triangles
+ * - if the test on the interior is positive : 8 last triangles
+ * The support edge for the interior test is marked as the 3rd column.
+ *
+ * For each of the case above, the specific triangulation of the edge
+ * intersection points is given.
+ * When a case is ambiguous, there is an auxiliary table that contains
+ * the face number to test and the tiling table contains the specific
+ * triangulations depending on the results
+ * A minus sign means to invert the result of the test.
+ */
+//-----------------------------------------------------------------------------
+static const char test6[48][3] = {
+/*  67: 0, 1,             6,     */  {  2,  7,  10  },
+/* 131: 0, 1,                7,  */  {  4,  7,  11  },
+/*  21: 0,    2,    4,           */  {  5,  7,   1  },
+/*  69: 0,    2,          6,     */  {  5,  7,   3  },
+/*  41: 0,       3,    5,        */  {  1,  7,   9  },
+/*  73: 0,       3,       6,     */  {  3,  7,  10  },
+/*  81: 0,          4,    6,     */  {  6,  7,   5  },
+/*  97: 0,             5, 6,     */  {  1,  7,   8  },
+/* 193: 0,                6, 7,  */  {  4,  7,   8  },
+/*  22:    1, 2,    4,           */  {  1,  7,   8  },
+/* 134:    1, 2,             7,  */  {  3,  7,  11  },
+/*  42:    1,    3,    5,        */  {  5,  7,   2  },
+/* 138:    1,    3,          7,  */  {  5,  7,   0  },
+/* 146:    1,       4,       7,  */  {  1,  7,   9  },
+/* 162:    1,          5,    7,  */  {  6,  7,   6  },
+/* 194:    1,             6, 7,  */  {  2,  7,   9  },
+/*  28:       2, 3, 4,           */  {  4,  7,   8  },
+/*  44:       2, 3,    5,        */  {  2,  7,   9  },
+/*  52:       2,    4, 5,        */  {  2,  7,  10  },
+/*  84:       2,    4,    6,     */  {  6,  7,   7  },
+/* 148:       2,    4,       7,  */  {  3,  7,  10  },
+/*  56:          3, 4, 5,        */  {  4,  7,  11  },
+/* 104:          3,    5, 6,     */  {  3,  7,  11  },
+/* 168:          3,    5,    7,  */  {  6,  7,   4  },
+/*  87: 0, 1, 2,    4,    6,     */  { -6, -7,   4  },
+/* 151: 0, 1, 2,    4,       7,  */  { -3, -7,  11  },
+/* 199: 0, 1, 2,          6, 7,  */  { -4, -7,  11  },
+/* 107: 0, 1,    3,    5, 6,     */  { -3, -7,  10  },
+/* 171: 0, 1,    3,    5,    7,  */  { -6, -7,   7  },
+/* 203: 0, 1,    3,       6, 7,  */  { -2, -7,  10  },
+/* 211: 0, 1,       4,    6, 7,  */  { -2, -7,   9  },
+/* 227: 0, 1,          5, 6, 7,  */  { -4, -7,   8  },
+/*  61: 0,    2, 3, 4, 5,        */  { -2, -7,   9  },
+/*  93: 0,    2, 3, 4,    6,     */  { -6, -7,   6  },
+/* 109: 0,    2, 3,    5, 6,     */  { -1, -7,   9  },
+/* 117: 0,    2,    4, 5, 6,     */  { -5, -7,   0  },
+/* 213: 0,    2,    4,    6, 7,  */  { -5, -7,   2  },
+/* 121: 0,       3, 4, 5, 6,     */  { -3, -7,  11  },
+/* 233: 0,       3,    5, 6, 7,  */  { -1, -7,   8  },
+/*  62:    1, 2, 3, 4, 5,        */  { -4, -7,   8  },
+/* 158:    1, 2, 3, 4,       7,  */  { -1, -7,   8  },
+/* 174:    1, 2, 3,    5,    7,  */  { -6, -7,   5  },
+/* 182:    1, 2,    4, 5,    7,  */  { -3, -7,  10  },
+/* 214:    1, 2,    4,    6, 7,  */  { -1, -7,   9  },
+/* 186:    1,    3, 4, 5,    7,  */  { -5, -7,   3  },
+/* 234:    1,    3,    5, 6, 7,  */  { -5, -7,   1  },
+/* 124:       2, 3, 4, 5, 6,     */  { -4, -7,  11  },
+/* 188:       2, 3, 4, 5,    7,  */  { -2, -7,  10  }
+};
+
+//_____________________________________________________________________________
+/**
+ * \brief tiling table for case 6.1.1
+ * For each of the case above, the specific triangulation of the edge
+ * intersection points is given.
+ * When a case is ambiguous, there is an auxiliary table that contains
+ * the face number to test and the tiling table contains the specific
+ * triangulations depending on the results
+ * A minus sign means to invert the result of the test.
+ */
+//-----------------------------------------------------------------------------
+static const char tiling6_1_1[48][9] = {
+/*  67: 0, 1,             6,     */  {  6,  5, 10,  3,  1,  8,  9,  8,  1 },
+/* 131: 0, 1,                7,  */  { 11,  7,  6,  9,  3,  1,  3,  9,  8 },
+/*  21: 0,    2,    4,           */  {  1,  2, 10,  7,  0,  4,  0,  7,  3 },
+/*  69: 0,    2,          6,     */  {  3,  0,  8,  5,  2,  6,  2,  5,  1 },
+/*  41: 0,       3,    5,        */  {  5,  4,  9,  2,  0, 11,  8, 11,  0 },
+/*  73: 0,       3,       6,     */  { 10,  6,  5,  8,  2,  0,  2,  8, 11 },
+/*  81: 0,          4,    6,     */  { 10,  6,  5,  0,  4,  3,  7,  3,  4 },
+/*  97: 0,             5, 6,     */  {  3,  0,  8,  6,  4, 10,  9, 10,  4 },
+/* 193: 0,                6, 7,  */  {  8,  3,  0, 10,  7,  5,  7, 10, 11 },
+/*  22:    1, 2,    4,           */  {  8,  4,  7, 10,  0,  2,  0, 10,  9 },
+/* 134:    1, 2,             7,  */  {  7,  6, 11,  0,  2,  9, 10,  9,  2 },
+/*  42:    1,    3,    5,        */  {  2,  3, 11,  4,  1,  5,  1,  4,  0 },
+/* 138:    1,    3,          7,  */  {  0,  1,  9,  6,  3,  7,  3,  6,  2 },
+/* 146:    1,       4,       7,  */  {  9,  0,  1, 11,  4,  6,  4, 11,  8 },
+/* 162:    1,          5,    7,  */  { 11,  7,  6,  1,  5,  0,  4,  0,  5 },
+/* 194:    1,             6, 7,  */  {  0,  1,  9,  7,  5, 11, 10, 11,  5 },
+/*  28:       2, 3, 4,           */  {  4,  7,  8,  1,  3, 10, 11, 10,  3 },
+/*  44:       2, 3,    5,        */  {  9,  5,  4, 11,  1,  3,  1, 11, 10 },
+/*  52:       2,    4, 5,        */  { 10,  1,  2,  8,  5,  7,  5,  8,  9 },
+/*  84:       2,    4,    6,     */  {  8,  4,  7,  2,  6,  1,  5,  1,  6 },
+/* 148:       2,    4,       7,  */  {  1,  2, 10,  4,  6,  8, 11,  8,  6 },
+/*  56:          3, 4, 5,        */  {  2,  3, 11,  5,  7,  9,  8,  9,  7 },
+/* 104:          3,    5, 6,     */  { 11,  2,  3,  9,  6,  4,  6,  9, 10 },
+/* 168:          3,    5,    7,  */  {  9,  5,  4,  3,  7,  2,  6,  2,  7 },
+/*  87: 0, 1, 2,    4,    6,     */  {  4,  5,  9,  2,  7,  3,  7,  2,  6 },
+/* 151: 0, 1, 2,    4,       7,  */  {  3,  2, 11,  4,  6,  9, 10,  9,  6 },
+/* 199: 0, 1, 2,          6, 7,  */  { 11,  3,  2,  9,  7,  5,  7,  9,  8 },
+/* 107: 0, 1,    3,    5, 6,     */  { 10,  2,  1,  8,  6,  4,  6,  8, 11 },
+/* 171: 0, 1,    3,    5,    7,  */  {  7,  4,  8,  1,  6,  2,  6,  1,  5 },
+/* 203: 0, 1,    3,       6, 7,  */  {  2,  1, 10,  7,  5,  8,  9,  8,  5 },
+/* 211: 0, 1,       4,    6, 7,  */  {  4,  5,  9,  3,  1, 11, 10, 11,  1 },
+/* 227: 0, 1,          5, 6, 7,  */  {  8,  7,  4, 10,  3,  1,  3, 10, 11 },
+/*  61: 0,    2, 3, 4, 5,        */  {  9,  1,  0, 11,  5,  7,  5, 11, 10 },
+/*  93: 0,    2, 3, 4,    6,     */  {  6,  7, 11,  0,  5,  1,  5,  0,  4 },
+/* 109: 0,    2, 3,    5, 6,     */  {  1,  0,  9,  6,  4, 11,  8, 11,  4 },
+/* 117: 0,    2,    4, 5, 6,     */  {  9,  1,  0,  7,  3,  6,  2,  6,  3 },
+/* 213: 0,    2,    4,    6, 7,  */  { 11,  3,  2,  5,  1,  4,  0,  4,  1 },
+/* 121: 0,       3, 4, 5, 6,     */  { 11,  6,  7,  9,  2,  0,  2,  9, 10 },
+/* 233: 0,       3,    5, 6, 7,  */  {  7,  4,  8,  2,  0, 10,  9, 10,  0 },
+/*  62:    1, 2, 3, 4, 5,        */  {  0,  3,  8,  5,  7, 10, 11, 10,  7 },
+/* 158:    1, 2, 3, 4,       7,  */  {  8,  0,  3, 10,  4,  6,  4, 10,  9 },
+/* 174:    1, 2, 3,    5,    7,  */  {  5,  6, 10,  3,  4,  0,  4,  3,  7 },
+/* 182:    1, 2,    4, 5,    7,  */  {  5,  6, 10,  0,  2,  8, 11,  8,  2 },
+/* 214:    1, 2,    4,    6, 7,  */  {  9,  4,  5, 11,  0,  2,  0, 11,  8 },
+/* 186:    1,    3, 4, 5,    7,  */  {  8,  0,  3,  6,  2,  5,  1,  5,  2 },
+/* 234:    1,    3,    5, 6, 7,  */  { 10,  2,  1,  4,  0,  7,  3,  7,  0 },
+/* 124:       2, 3, 4, 5, 6,     */  {  6,  7, 11,  1,  3,  9,  8,  9,  3 },
+/* 188:       2, 3, 4, 5,    7,  */  { 10,  5,  6,  8,  1,  3,  1,  8,  9 }
+};
+
+//_____________________________________________________________________________
+/**
+ * \brief tiling table for case 6.1.2
+ * For each of the case above, the specific triangulation of the edge
+ * intersection points is given.
+ * When a case is ambiguous, there is an auxiliary table that contains
+ * the face number to test and the tiling table contains the specific
+ * triangulations depending on the results
+ * A minus sign means to invert the result of the test.
+ */
+//-----------------------------------------------------------------------------
+static const char tiling6_1_2[48][21] = {
+/*  67: 0, 1,             6,     */  {  1, 10,  3,  6,  3, 10,  3,  6,  8,  5,  8,  6,  8,  5,  9,  1,  9,  5, 10,  1,  5 },
+/* 131: 0, 1,                7,  */  {  1, 11,  3, 11,  1,  6,  9,  6,  1,  6,  9,  7,  8,  7,  9,  7,  8,  3,  7,  3, 11 },
+/*  21: 0,    2,    4,           */  {  4,  1,  0,  1,  4, 10,  7, 10,  4, 10,  7,  2,  3,  2,  7,  2,  3,  0,  2,  0,  1 },
+/*  69: 0,    2,          6,     */  {  6,  3,  2,  3,  6,  8,  5,  8,  6,  8,  5,  0,  1,  0,  5,  0,  1,  2,  0,  2,  3 },
+/*  41: 0,       3,    5,        */  {  0,  9,  2,  5,  2,  9,  2,  5, 11,  4, 11,  5, 11,  4,  8,  0,  8,  4,  9,  0,  4 },
+/*  73: 0,       3,       6,     */  {  0, 10,  2, 10,  0,  5,  8,  5,  0,  5,  8,  6, 11,  6,  8,  6, 11,  2,  6,  2, 10 },
+/*  81: 0,          4,    6,     */  {  4,  5,  0, 10,  0,  5,  0, 10,  3,  6,  3, 10,  3,  6,  7,  4,  7,  6,  5,  4,  6 },
+/*  97: 0,             5, 6,     */  {  4,  8,  6,  3,  6,  8,  6,  3, 10,  0, 10,  3, 10,  0,  9,  4,  9,  0,  8,  4,  0 },
+/* 193: 0,                6, 7,  */  {  5,  8,  7,  8,  5,  0, 10,  0,  5,  0, 10,  3, 11,  3, 10,  3, 11,  7,  3,  7,  8 },
+/*  22:    1, 2,    4,           */  {  2,  8,  0,  8,  2,  7, 10,  7,  2,  7, 10,  4,  9,  4, 10,  4,  9,  0,  4,  0,  8 },
+/* 134:    1, 2,             7,  */  {  2, 11,  0,  7,  0, 11,  0,  7,  9,  6,  9,  7,  9,  6, 10,  2, 10,  6, 11,  2,  6 },
+/*  42:    1,    3,    5,        */  {  5,  2,  1,  2,  5, 11,  4, 11,  5, 11,  4,  3,  0,  3,  4,  3,  0,  1,  3,  1,  2 },
+/* 138:    1,    3,          7,  */  {  7,  0,  3,  0,  7,  9,  6,  9,  7,  9,  6,  1,  2,  1,  6,  1,  2,  3,  1,  3,  0 },
+/* 146:    1,       4,       7,  */  {  6,  9,  4,  9,  6,  1, 11,  1,  6,  1, 11,  0,  8,  0, 11,  0,  8,  4,  0,  4,  9 },
+/* 162:    1,          5,    7,  */  {  5,  6,  1, 11,  1,  6,  1, 11,  0,  7,  0, 11,  0,  7,  4,  5,  4,  7,  6,  5,  7 },
+/* 194:    1,             6, 7,  */  {  5,  9,  7,  0,  7,  9,  7,  0, 11,  1, 11,  0, 11,  1, 10,  5, 10,  1,  9,  5,  1 },
+/*  28:       2, 3, 4,           */  {  3,  8,  1,  4,  1,  8,  1,  4, 10,  7, 10,  4, 10,  7, 11,  3, 11,  7,  8,  3,  7 },
+/*  44:       2, 3,    5,        */  {  3,  9,  1,  9,  3,  4, 11,  4,  3,  4, 11,  5, 10,  5, 11,  5, 10,  1,  5,  1,  9 },
+/*  52:       2,    4, 5,        */  {  7, 10,  5, 10,  7,  2,  8,  2,  7,  2,  8,  1,  9,  1,  8,  1,  9,  5,  1,  5, 10 },
+/*  84:       2,    4,    6,     */  {  6,  7,  2,  8,  2,  7,  2,  8,  1,  4,  1,  8,  1,  4,  5,  6,  5,  4,  7,  6,  4 },
+/* 148:       2,    4,       7,  */  {  6, 10,  4,  1,  4, 10,  4,  1,  8,  2,  8,  1,  8,  2, 11,  6, 11,  2, 10,  6,  2 },
+/*  56:          3, 4, 5,        */  {  7, 11,  5,  2,  5, 11,  5,  2,  9,  3,  9,  2,  9,  3,  8,  7,  8,  3, 11,  7,  3 },
+/* 104:          3,    5, 6,     */  {  4, 11,  6, 11,  4,  3,  9,  3,  4,  3,  9,  2, 10,  2,  9,  2, 10,  6,  2,  6, 11 },
+/* 168:          3,    5,    7,  */  {  7,  4,  3,  9,  3,  4,  3,  9,  2,  5,  2,  9,  2,  5,  6,  7,  6,  5,  4,  7,  5 },
+/*  87: 0, 1, 2,    4,    6,     */  {  3,  4,  7,  4,  3,  9,  2,  9,  3,  9,  2,  5,  6,  5,  2,  5,  6,  7,  5,  7,  4 },
+/* 151: 0, 1, 2,    4,       7,  */  {  6, 11,  4,  3,  4, 11,  4,  3,  9,  2,  9,  3,  9,  2, 10,  6, 10,  2, 11,  6,  2 },
+/* 199: 0, 1, 2,          6, 7,  */  {  5, 11,  7, 11,  5,  2,  9,  2,  5,  2,  9,  3,  8,  3,  9,  3,  8,  7,  3,  7, 11 },
+/* 107: 0, 1,    3,    5, 6,     */  {  4, 10,  6, 10,  4,  1,  8,  1,  4,  1,  8,  2, 11,  2,  8,  2, 11,  6,  2,  6, 10 },
+/* 171: 0, 1,    3,    5,    7,  */  {  2,  7,  6,  7,  2,  8,  1,  8,  2,  8,  1,  4,  5,  4,  1,  4,  5,  6,  4,  6,  7 },
+/* 203: 0, 1,    3,       6, 7,  */  {  5, 10,  7,  2,  7, 10,  7,  2,  8,  1,  8,  2,  8,  1,  9,  5,  9,  1, 10,  5,  1 },
+/* 211: 0, 1,       4,    6, 7,  */  {  1,  9,  3,  4,  3,  9,  3,  4, 11,  5, 11,  4, 11,  5, 10,  1, 10,  5,  9,  1,  5 },
+/* 227: 0, 1,          5, 6, 7,  */  {  1,  8,  3,  8,  1,  4, 10,  4,  1,  4, 10,  7, 11,  7, 10,  7, 11,  3,  7,  3,  8 },
+/*  61: 0,    2, 3, 4, 5,        */  {  7,  9,  5,  9,  7,  0, 11,  0,  7,  0, 11,  1, 10,  1, 11,  1, 10,  5,  1,  5,  9 },
+/*  93: 0,    2, 3, 4,    6,     */  {  1,  6,  5,  6,  1, 11,  0, 11,  1, 11,  0,  7,  4,  7,  0,  7,  4,  5,  7,  5,  6 },
+/* 109: 0,    2, 3,    5, 6,     */  {  4,  9,  6,  1,  6,  9,  6,  1, 11,  0, 11,  1, 11,  0,  8,  4,  8,  0,  9,  4,  0 },
+/* 117: 0,    2,    4, 5, 6,     */  {  3,  0,  7,  9,  7,  0,  7,  9,  6,  1,  6,  9,  6,  1,  2,  3,  2,  1,  0,  3,  1 },
+/* 213: 0,    2,    4,    6, 7,  */  {  1,  2,  5, 11,  5,  2,  5, 11,  4,  3,  4, 11,  4,  3,  0,  1,  0,  3,  2,  1,  3 },
+/* 121: 0,       3, 4, 5, 6,     */  {  0, 11,  2, 11,  0,  7,  9,  7,  0,  7,  9,  6, 10,  6,  9,  6, 10,  2,  6,  2, 11 },
+/* 233: 0,       3,    5, 6, 7,  */  {  0,  8,  2,  7,  2,  8,  2,  7, 10,  4, 10,  7, 10,  4,  9,  0,  9,  4,  8,  0,  4 },
+/*  62:    1, 2, 3, 4, 5,        */  {  7,  8,  5,  0,  5,  8,  5,  0, 10,  3, 10,  0, 10,  3, 11,  7, 11,  3,  8,  7,  3 },
+/* 158:    1, 2, 3, 4,       7,  */  {  6,  8,  4,  8,  6,  3, 10,  3,  6,  3, 10,  0,  9,  0, 10,  0,  9,  4,  0,  4,  8 },
+/* 174:    1, 2, 3,    5,    7,  */  {  0,  5,  4,  5,  0, 10,  3, 10,  0, 10,  3,  6,  7,  6,  3,  6,  7,  4,  6,  4,  5 },
+/* 182:    1, 2,    4, 5,    7,  */  {  2, 10,  0,  5,  0, 10,  0,  5,  8,  6,  8,  5,  8,  6, 11,  2, 11,  6, 10,  2,  6 },
+/* 214:    1, 2,    4,    6, 7,  */  {  2,  9,  0,  9,  2,  5, 11,  5,  2,  5, 11,  4,  8,  4, 11,  4,  8,  0,  4,  0,  9 },
+/* 186:    1,    3, 4, 5,    7,  */  {  2,  3,  6,  8,  6,  3,  6,  8,  5,  0,  5,  8,  5,  0,  1,  2,  1,  0,  3,  2,  0 },
+/* 234:    1,    3,    5, 6, 7,  */  {  0,  1,  4, 10,  4,  1,  4, 10,  7,  2,  7, 10,  7,  2,  3,  0,  3,  2,  1,  0,  2 },
+/* 124:       2, 3, 4, 5, 6,     */  {  3, 11,  1,  6,  1, 11,  1,  6,  9,  7,  9,  6,  9,  7,  8,  3,  8,  7, 11,  3,  7 },
+/* 188:       2, 3, 4, 5,    7,  */  {  3, 10,  1, 10,  3,  6,  8,  6,  3,  6,  8,  5,  9,  5,  8,  5,  9,  1,  5,  1, 10 }
+};
+
+//_____________________________________________________________________________
+/**
+ * \brief tiling table for case 6.2
+ * For each of the case above, the specific triangulation of the edge
+ * intersection points is given.
+ * When a case is ambiguous, there is an auxiliary table that contains
+ * the face number to test and the tiling table contains the specific
+ * triangulations depending on the results
+ * A minus sign means to invert the result of the test.
+ */
+//-----------------------------------------------------------------------------
+static const char tiling6_2[48][15] = {
+/*  67: 0, 1,             6,     */  {  1, 10,  3,  6,  3, 10,  3,  6,  8,  5,  8,  6,  8,  5,  9 },
+/* 131: 0, 1,                7,  */  {  1, 11,  3, 11,  1,  6,  9,  6,  1,  6,  9,  7,  8,  7,  9 },
+/*  21: 0,    2,    4,           */  {  4,  1,  0,  1,  4, 10,  7, 10,  4, 10,  7,  2,  3,  2,  7 },
+/*  69: 0,    2,          6,     */  {  6,  3,  2,  3,  6,  8,  5,  8,  6,  8,  5,  0,  1,  0,  5 },
+/*  41: 0,       3,    5,        */  {  0,  9,  2,  5,  2,  9,  2,  5, 11,  4, 11,  5, 11,  4,  8 },
+/*  73: 0,       3,       6,     */  {  0, 10,  2, 10,  0,  5,  8,  5,  0,  5,  8,  6, 11,  6,  8 },
+/*  81: 0,          4,    6,     */  {  4,  5,  0, 10,  0,  5,  0, 10,  3,  6,  3, 10,  3,  6,  7 },
+/*  97: 0,             5, 6,     */  {  4,  8,  6,  3,  6,  8,  6,  3, 10,  0, 10,  3, 10,  0,  9 },
+/* 193: 0,                6, 7,  */  {  5,  8,  7,  8,  5,  0, 10,  0,  5,  0, 10,  3, 11,  3, 10 },
+/*  22:    1, 2,    4,           */  {  2,  8,  0,  8,  2,  7, 10,  7,  2,  7, 10,  4,  9,  4, 10 },
+/* 134:    1, 2,             7,  */  {  2, 11,  0,  7,  0, 11,  0,  7,  9,  6,  9,  7,  9,  6, 10 },
+/*  42:    1,    3,    5,        */  {  5,  2,  1,  2,  5, 11,  4, 11,  5, 11,  4,  3,  0,  3,  4 },
+/* 138:    1,    3,          7,  */  {  7,  0,  3,  0,  7,  9,  6,  9,  7,  9,  6,  1,  2,  1,  6 },
+/* 146:    1,       4,       7,  */  {  6,  9,  4,  9,  6,  1, 11,  1,  6,  1, 11,  0,  8,  0, 11 },
+/* 162:    1,          5,    7,  */  {  5,  6,  1, 11,  1,  6,  1, 11,  0,  7,  0, 11,  0,  7,  4 },
+/* 194:    1,             6, 7,  */  {  5,  9,  7,  0,  7,  9,  7,  0, 11,  1, 11,  0, 11,  1, 10 },
+/*  28:       2, 3, 4,           */  {  3,  8,  1,  4,  1,  8,  1,  4, 10,  7, 10,  4, 10,  7, 11 },
+/*  44:       2, 3,    5,        */  {  3,  9,  1,  9,  3,  4, 11,  4,  3,  4, 11,  5, 10,  5, 11 },
+/*  52:       2,    4, 5,        */  {  7, 10,  5, 10,  7,  2,  8,  2,  7,  2,  8,  1,  9,  1,  8 },
+/*  84:       2,    4,    6,     */  {  6,  7,  2,  8,  2,  7,  2,  8,  1,  4,  1,  8,  1,  4,  5 },
+/* 148:       2,    4,       7,  */  {  6, 10,  4,  1,  4, 10,  4,  1,  8,  2,  8,  1,  8,  2, 11 },
+/*  56:          3, 4, 5,        */  {  7, 11,  5,  2,  5, 11,  5,  2,  9,  3,  9,  2,  9,  3,  8 },
+/* 104:          3,    5, 6,     */  {  4, 11,  6, 11,  4,  3,  9,  3,  4,  3,  9,  2, 10,  2,  9 },
+/* 168:          3,    5,    7,  */  {  7,  4,  3,  9,  3,  4,  3,  9,  2,  5,  2,  9,  2,  5,  6 },
+/*  87: 0, 1, 2,    4,    6,     */  {  3,  4,  7,  4,  3,  9,  2,  9,  3,  9,  2,  5,  6,  5,  2 },
+/* 151: 0, 1, 2,    4,       7,  */  {  6, 11,  4,  3,  4, 11,  4,  3,  9,  2,  9,  3,  9,  2, 10 },
+/* 199: 0, 1, 2,          6, 7,  */  {  5, 11,  7, 11,  5,  2,  9,  2,  5,  2,  9,  3,  8,  3,  9 },
+/* 107: 0, 1,    3,    5, 6,     */  {  4, 10,  6, 10,  4,  1,  8,  1,  4,  1,  8,  2, 11,  2,  8 },
+/* 171: 0, 1,    3,    5,    7,  */  {  2,  7,  6,  7,  2,  8,  1,  8,  2,  8,  1,  4,  5,  4,  1 },
+/* 203: 0, 1,    3,       6, 7,  */  {  5, 10,  7,  2,  7, 10,  7,  2,  8,  1,  8,  2,  8,  1,  9 },
+/* 211: 0, 1,       4,    6, 7,  */  {  1,  9,  3,  4,  3,  9,  3,  4, 11,  5, 11,  4, 11,  5, 10 },
+/* 227: 0, 1,          5, 6, 7,  */  {  1,  8,  3,  8,  1,  4, 10,  4,  1,  4, 10,  7, 11,  7, 10 },
+/*  61: 0,    2, 3, 4, 5,        */  {  7,  9,  5,  9,  7,  0, 11,  0,  7,  0, 11,  1, 10,  1, 11 },
+/*  93: 0,    2, 3, 4,    6,     */  {  1,  6,  5,  6,  1, 11,  0, 11,  1, 11,  0,  7,  4,  7,  0 },
+/* 109: 0,    2, 3,    5, 6,     */  {  4,  9,  6,  1,  6,  9,  6,  1, 11,  0, 11,  1, 11,  0,  8 },
+/* 117: 0,    2,    4, 5, 6,     */  {  3,  0,  7,  9,  7,  0,  7,  9,  6,  1,  6,  9,  6,  1,  2 },
+/* 213: 0,    2,    4,    6, 7,  */  {  1,  2,  5, 11,  5,  2,  5, 11,  4,  3,  4, 11,  4,  3,  0 },
+/* 121: 0,       3, 4, 5, 6,     */  {  0, 11,  2, 11,  0,  7,  9,  7,  0,  7,  9,  6, 10,  6,  9 },
+/* 233: 0,       3,    5, 6, 7,  */  {  0,  8,  2,  7,  2,  8,  2,  7, 10,  4, 10,  7, 10,  4,  9 },
+/*  62:    1, 2, 3, 4, 5,        */  {  7,  8,  5,  0,  5,  8,  5,  0, 10,  3, 10,  0, 10,  3, 11 },
+/* 158:    1, 2, 3, 4,       7,  */  {  6,  8,  4,  8,  6,  3, 10,  3,  6,  3, 10,  0,  9,  0, 10 },
+/* 174:    1, 2, 3,    5,    7,  */  {  0,  5,  4,  5,  0, 10,  3, 10,  0, 10,  3,  6,  7,  6,  3 },
+/* 182:    1, 2,    4, 5,    7,  */  {  2, 10,  0,  5,  0, 10,  0,  5,  8,  6,  8,  5,  8,  6, 11 },
+/* 214:    1, 2,    4,    6, 7,  */  {  2,  9,  0,  9,  2,  5, 11,  5,  2,  5, 11,  4,  8,  4, 11 },
+/* 186:    1,    3, 4, 5,    7,  */  {  2,  3,  6,  8,  6,  3,  6,  8,  5,  0,  5,  8,  5,  0,  1 },
+/* 234:    1,    3,    5, 6, 7,  */  {  0,  1,  4, 10,  4,  1,  4, 10,  7,  2,  7, 10,  7,  2,  3 },
+/* 124:       2, 3, 4, 5, 6,     */  {  3, 11,  1,  6,  1, 11,  1,  6,  9,  7,  9,  6,  9,  7,  8 },
+/* 188:       2, 3, 4, 5,    7,  */  {  3, 10,  1, 10,  3,  6,  8,  6,  3,  6,  8,  5,  9,  5,  8 }
+};
+//_____________________________________________________________________________
+
+
+
+//_____________________________________________________________________________
+/**
+ * \brief test table for case 7
+ * 3 faces to test + eventually the interior
+ * When the tests on the 3 specified faces are positive :
+ * - if the test on the interior is positive : 5 first triangles
+ * - if the test on the interior is negative : 9 next triangles
+ * When the tests on the first  and the second specified faces are positive : 9 next triangles
+ * When the tests on the first  and the third  specified faces are positive : 9 next triangles
+ * When the tests on the second and the third  specified faces are positive : 9 next triangles
+ * When the test on the first  specified face is positive : 5 next triangles
+ * When the test on the second specified face is positive : 5 next triangles
+ * When the test on the third  specified face is positive : 5 next triangles
+ * When the tests on the 3 specified faces are negative : 3 last triangles
+ * The support edge for the interior test is marked as the 5th column.
+ *
+ * For each of the case above, the specific triangulation of the edge
+ * intersection points is given.
+ * When a case is ambiguous, there is an auxiliary table that contains
+ * the face number to test and the tiling table contains the specific
+ * triangulations depending on the results
+ * A minus sign means to invert the result of the test.
+ */
+//-----------------------------------------------------------------------------
+static const char test7[16][5] = {
+/*  37: 0,    2,       5,        */  {  1,  2,  5,  7,   1 },
+/* 133: 0,    2,             7,  */  {  3,  4,  5,  7,   3 },
+/* 161: 0,             5,    7,  */  {  4,  1,  6,  7,   4 },
+/*  26:    1,    3, 4,           */  {  4,  1,  5,  7,   0 },
+/*  74:    1,    3,       6,     */  {  2,  3,  5,  7,   2 },
+/*  82:    1,       4,    6,     */  {  1,  2,  6,  7,   5 },
+/* 164:       2,       5,    7,  */  {  2,  3,  6,  7,   6 },
+/*  88:          3, 4,    6,     */  {  3,  4,  6,  7,   7 },
+/* 167: 0, 1, 2,       5,    7,  */  { -3, -4, -6, -7,   7 },
+/*  91: 0, 1,    3, 4,    6,     */  { -2, -3, -6, -7,   6 },
+/* 173: 0,    2, 3,    5,    7,  */  { -1, -2, -6, -7,   5 },
+/* 181: 0,    2,    4, 5,    7,  */  { -2, -3, -5, -7,   2 },
+/* 229: 0,    2,       5, 6, 7,  */  { -4, -1, -5, -7,   0 },
+/*  94:    1, 2, 3, 4,    6,     */  { -4, -1, -6, -7,   4 },
+/* 122:    1,    3, 4, 5, 6,     */  { -3, -4, -5, -7,   3 },
+/* 218:    1,    3, 4,    6, 7,  */  { -1, -2, -5, -7,   1 }
+};
+
+//_____________________________________________________________________________
+/**
+ * \brief tiling table for case 7.1
+ * For each of the case above, the specific triangulation of the edge
+ * intersection points is given.
+ * When a case is ambiguous, there is an auxiliary table that contains
+ * the face number to test and the tiling table contains the specific
+ * triangulations depending on the results
+ * A minus sign means to invert the result of the test.
+ */
+//-----------------------------------------------------------------------------
+static const char tiling7_1[16][9] = {
+/*  37: 0,    2,       5,        */  {  9,  5,  4, 10,  1,  2,  8,  3,  0 },
+/* 133: 0,    2,             7,  */  { 11,  7,  6,  8,  3,  0, 10,  1,  2 },
+/* 161: 0,             5,    7,  */  {  3,  0,  8,  5,  4,  9,  7,  6, 11 },
+/*  26:    1,    3, 4,           */  {  8,  4,  7,  9,  0,  1, 11,  2,  3 },
+/*  74:    1,    3,       6,     */  { 10,  6,  5, 11,  2,  3,  9,  0,  1 },
+/*  82:    1,       4,    6,     */  {  0,  1,  9,  6,  5, 10,  4,  7,  8 },
+/* 164:       2,       5,    7,  */  {  1,  2, 10,  7,  6, 11,  5,  4,  9 },
+/*  88:          3, 4,    6,     */  {  2,  3, 11,  4,  7,  8,  6,  5, 10 },
+/* 167: 0, 1, 2,       5,    7,  */  { 11,  3,  2,  8,  7,  4, 10,  5,  6 },
+/*  91: 0, 1,    3, 4,    6,     */  { 10,  2,  1, 11,  6,  7,  9,  4,  5 },
+/* 173: 0,    2, 3,    5,    7,  */  {  9,  1,  0, 10,  5,  6,  8,  7,  4 },
+/* 181: 0,    2,    4, 5,    7,  */  {  5,  6, 10,  3,  2, 11,  1,  0,  9 },
+/* 229: 0,    2,       5, 6, 7,  */  {  7,  4,  8,  1,  0,  9,  3,  2, 11 },
+/*  94:    1, 2, 3, 4,    6,     */  {  8,  0,  3,  9,  4,  5, 11,  6,  7 },
+/* 122:    1,    3, 4, 5, 6,     */  {  6,  7, 11,  0,  3,  8,  2,  1, 10 },
+/* 218:    1,    3, 4,    6, 7,  */  {  4,  5,  9,  2,  1, 10,  0,  3,  8 }
+};
+
+//_____________________________________________________________________________
+/**
+ * \brief tiling table for case 7.2
+ * For each of the case above, the specific triangulation of the edge
+ * intersection points is given.
+ * When a case is ambiguous, there is an auxiliary table that contains
+ * the face number to test and the tiling table contains the specific
+ * triangulations depending on the results
+ * A minus sign means to invert the result of the test.
+ */
+//-----------------------------------------------------------------------------
+static const char tiling7_2[16][3][15] = {
+/*  37: 0,    2,       5,        */  {
+ /* 1,0 */ {  1,  2, 10,  3,  4,  8,  4,  3,  5,  0,  5,  3,  5,  0,  9 },
+ /* 0,1 */ {  3,  0,  8,  9,  1,  4,  2,  4,  1,  4,  2,  5, 10,  5,  2 },
+ /* 1,1 */ {  9,  5,  4,  0, 10,  1, 10,  0,  8, 10,  8,  2,  3,  2,  8 }
+},
+/* 133: 0,    2,             7,  */  {
+ /* 1,0 */ {  3,  0,  8,  1,  6, 10,  6,  1,  7,  2,  7,  1,  7,  2, 11 },
+ /* 0,1 */ {  1,  2, 10, 11,  3,  6,  0,  6,  3,  6,  0,  7,  8,  7,  0 },
+ /* 1,1 */ { 11,  7,  6,  2,  8,  3,  8,  2, 10,  8, 10,  0,  1,  0, 10 }
+},
+/* 161: 0,             5,    7,  */  {
+ /* 1,0 */ {  9,  5,  4, 11,  3,  6,  0,  6,  3,  6,  0,  7,  8,  7,  0 },
+ /* 0,1 */ { 11,  7,  6,  3,  4,  8,  4,  3,  5,  0,  5,  3,  5,  0,  9 },
+ /* 1,1 */ {  3,  0,  8,  4,  9,  7, 11,  7,  9,  5, 11,  9, 11,  5,  6 }
+},
+/*  26:    1,    3, 4,           */  {
+ /* 1,0 */ {  0,  1,  9,  2,  7, 11,  7,  2,  4,  3,  4,  2,  4,  3,  8 },
+ /* 0,1 */ {  2,  3, 11,  8,  0,  7,  1,  7,  0,  7,  1,  4,  9,  4,  1 },
+ /* 1,1 */ {  8,  4,  7,  3,  9,  0,  9,  3, 11,  9, 11,  1,  2,  1, 11 }
+},
+/*  74:    1,    3,       6,     */  {
+ /* 1,0 */ {  2,  3, 11,  0,  5,  9,  5,  0,  6,  1,  6,  0,  6,  1, 10 },
+ /* 0,1 */ {  0,  1,  9, 10,  2,  5,  3,  5,  2,  5,  3,  6, 11,  6,  3 },
+ /* 1,1 */ {  6,  5, 10,  1, 11,  2, 11,  1,  9, 11,  9,  3,  0,  3,  9 }
+},
+/*  82:    1,       4,    6,     */  {
+ /* 1,0 */ {  6,  5, 10,  8,  0,  7,  1,  7,  0,  7,  1,  4,  9,  4,  1 },
+ /* 0,1 */ {  8,  4,  7,  0,  5,  9,  5,  0,  6,  1,  6,  0,  6,  1, 10 },
+ /* 1,1 */ {  0,  1,  9,  5, 10,  4,  8,  4, 10,  6,  8, 10,  8,  6,  7 }
+},
+/* 164:       2,       5,    7,  */  {
+ /* 1,0 */ { 11,  7,  6,  9,  1,  4,  2,  4,  1,  4,  2,  5, 10,  5,  2 },
+ /* 0,1 */ {  9,  5,  4,  1,  6, 10,  6,  1,  7,  2,  7,  1,  7,  2, 11 },
+ /* 1,1 */ {  1,  2, 10,  6, 11,  5,  9,  5, 11,  7,  9, 11,  9,  7,  4 }
+},
+/*  88:          3, 4,    6,     */  {
+ /* 1,0 */ {  8,  4,  7, 10,  2,  5,  3,  5,  2,  5,  3,  6, 11,  6,  3 },
+ /* 0,1 */ {  6,  5, 10,  2,  7, 11,  7,  2,  4,  3,  4,  2,  4,  3,  8 },
+ /* 1,1 */ {  2,  3, 11,  7,  8,  6, 10,  6,  8,  4, 10,  8, 10,  4,  5 }
+},
+/* 167: 0, 1, 2,       5,    7,  */  {
+ /* 1,0 */ {  7,  4,  8,  5,  2, 10,  2,  5,  3,  6,  3,  5,  3,  6, 11 },
+ /* 0,1 */ { 10,  5,  6, 11,  7,  2,  4,  2,  7,  2,  4,  3,  8,  3,  4 },
+ /* 1,1 */ { 11,  3,  2,  6,  8,  7,  8,  6, 10,  8, 10,  4,  5,  4, 10 }
+},
+/*  91: 0, 1,    3, 4,    6,     */  {
+ /* 1,0 */ {  6,  7, 11,  4,  1,  9,  1,  4,  2,  5,  2,  4,  2,  5, 10 },
+ /* 0,1 */ {  4,  5,  9, 10,  6,  1,  7,  1,  6,  1,  7,  2, 11,  2,  7 },
+ /* 1,1 */ { 10,  2,  1,  5, 11,  6, 11,  5,  9, 11,  9,  7,  4,  7,  9 }
+},
+/* 173: 0,    2, 3,    5,    7,  */  {
+ /* 1,0 */ { 10,  5,  6,  7,  0,  8,  0,  7,  1,  4,  1,  7,  1,  4,  9 },
+ /* 0,1 */ {  7,  4,  8,  9,  5,  0,  6,  0,  5,  0,  6,  1, 10,  1,  6 },
+ /* 1,1 */ {  9,  1,  0,  4, 10,  5, 10,  4,  8, 10,  8,  6,  7,  6,  8 }
+},
+/* 181: 0,    2,    4, 5,    7,  */  {
+ /* 1,0 */ { 11,  3,  2,  9,  5,  0,  6,  0,  5,  0,  6,  1, 10,  1,  6 },
+ /* 0,1 */ {  9,  1,  0,  5,  2, 10,  2,  5,  3,  6,  3,  5,  3,  6, 11 },
+ /* 1,1 */ { 10,  5,  6,  2, 11,  1,  9,  1, 11,  3,  9, 11,  9,  3,  0 }
+},
+/* 229: 0,    2,       5, 6, 7,  */  {
+ /* 1,0 */ {  9,  1,  0, 11,  7,  2,  4,  2,  7,  2,  4,  3,  8,  3,  4 },
+ /* 0,1 */ { 11,  3,  2,  7,  0,  8,  0,  7,  1,  4,  1,  7,  1,  4,  9 },
+ /* 1,1 */ {  7,  4,  8,  0,  9,  3, 11,  3,  9,  1, 11,  9, 11,  1,  2 }
+},
+/*  94:    1, 2, 3, 4,    6,     */  {
+ /* 1,0 */ {  4,  5,  9,  6,  3, 11,  3,  6,  0,  7,  0,  6,  0,  7,  8 },
+ /* 0,1 */ {  6,  7, 11,  8,  4,  3,  5,  3,  4,  3,  5,  0,  9,  0,  5 },
+ /* 1,1 */ {  8,  0,  3,  7,  9,  4,  9,  7, 11,  9, 11,  5,  6,  5, 11 }
+},
+/* 122:    1,    3, 4, 5, 6,     */  {
+ /* 1,0 */ {  8,  0,  3, 10,  6,  1,  7,  1,  6,  1,  7,  2, 11,  2,  7 },
+ /* 0,1 */ { 10,  2,  1,  6,  3, 11,  3,  6,  0,  7,  0,  6,  0,  7,  8 },
+ /* 1,1 */ {  6,  7, 11,  3,  8,  2, 10,  2,  8,  0, 10,  8, 10,  0,  1 }
+},
+/* 218:    1,    3, 4,    6, 7,  */  {
+ /* 1,0 */ { 10,  2,  1,  8,  4,  3,  5,  3,  4,  3,  5,  0,  9,  0,  5 },
+ /* 0,1 */ {  8,  0,  3,  4,  1,  9,  1,  4,  2,  5,  2,  4,  2,  5, 10 },
+ /* 1,1 */ {  4,  5,  9,  1, 10,  0,  8,  0, 10,  2,  8, 10,  8,  2,  3 } }
+};
+
+//_____________________________________________________________________________
+/**
+ * \brief tiling table for case 7.3
+ * For each of the case above, the specific triangulation of the edge
+ * intersection points is given.
+ * When a case is ambiguous, there is an auxiliary table that contains
+ * the face number to test and the tiling table contains the specific
+ * triangulations depending on the results
+ * A minus sign means to invert the result of the test.
+ */
+//-----------------------------------------------------------------------------
+static const char tiling7_3[16][3][27] = {
+/*  37: 0,    2,       5,        */  {
+ /* 1,0 */ { 12,  2, 10, 12, 10,  5, 12,  5,  4, 12,  4,  8, 12,  8,  3, 12,  3,  0, 12,  0,  9, 12,  9,  1, 12,  1,  2 },
+ /* 0,1 */ { 12,  5,  4, 12,  4,  8, 12,  8,  3, 12,  3,  2, 12,  2, 10, 12, 10,  1, 12,  1,  0, 12,  0,  9, 12,  9,  5 },
+ /* 1,1 */ {  5,  4, 12, 10,  5, 12,  2, 10, 12,  3,  2, 12,  8,  3, 12,  0,  8, 12,  1,  0, 12,  9,  1, 12,  4,  9, 12 }
+},
+/* 133: 0,    2,             7,  */  {
+ /* 1,0 */ { 12,  0,  8, 12,  8,  7, 12,  7,  6, 12,  6, 10, 12, 10,  1, 12,  1,  2, 12,  2, 11, 12, 11,  3, 12,  3,  0 },
+ /* 0,1 */ { 12,  7,  6, 12,  6, 10, 12, 10,  1, 12,  1,  0, 12,  0,  8, 12,  8,  3, 12,  3,  2, 12,  2, 11, 12, 11,  7 },
+ /* 1,1 */ {  7,  6, 12,  8,  7, 12,  0,  8, 12,  1,  0, 12, 10,  1, 12,  2, 10, 12,  3,  2, 12, 11,  3, 12,  6, 11, 12 }
+},
+/* 161: 0,             5,    7,  */  {
+ /* 1,0 */ {  9,  5, 12,  0,  9, 12,  3,  0, 12, 11,  3, 12,  6, 11, 12,  7,  6, 12,  8,  7, 12,  4,  8, 12,  5,  4, 12 },
+ /* 0,1 */ {  3,  0, 12, 11,  3, 12,  6, 11, 12,  5,  6, 12,  9,  5, 12,  4,  9, 12,  7,  4, 12,  8,  7, 12,  0,  8, 12 },
+ /* 1,1 */ { 12,  3,  0, 12,  0,  9, 12,  9,  5, 12,  5,  6, 12,  6, 11, 12, 11,  7, 12,  7,  4, 12,  4,  8, 12,  8,  3 }
+},
+/*  26:    1,    3, 4,           */  {
+ /* 1,0 */ { 12,  1,  9, 12,  9,  4, 12,  4,  7, 12,  7, 11, 12, 11,  2, 12,  2,  3, 12,  3,  8, 12,  8,  0, 12,  0,  1 },
+ /* 0,1 */ { 12,  4,  7, 12,  7, 11, 12, 11,  2, 12,  2,  1, 12,  1,  9, 12,  9,  0, 12,  0,  3, 12,  3,  8, 12,  8,  4 },
+ /* 1,1 */ {  4,  7, 12,  9,  4, 12,  1,  9, 12,  2,  1, 12, 11,  2, 12,  3, 11, 12,  0,  3, 12,  8,  0, 12,  7,  8, 12 }
+},
+/*  74:    1,    3,       6,     */  {
+ /* 1,0 */ { 12,  3, 11, 12, 11,  6, 12,  6,  5, 12,  5,  9, 12,  9,  0, 12,  0,  1, 12,  1, 10, 12, 10,  2, 12,  2,  3 },
+ /* 0,1 */ { 12,  6,  5, 12,  5,  9, 12,  9,  0, 12,  0,  3, 12,  3, 11, 12, 11,  2, 12,  2,  1, 12,  1, 10, 12, 10,  6 },
+ /* 1,1 */ {  6,  5, 12, 11,  6, 12,  3, 11, 12,  0,  3, 12,  9,  0, 12,  1,  9, 12,  2,  1, 12, 10,  2, 12,  5, 10, 12 }
+},
+/*  82:    1,       4,    6,     */  {
+ /* 1,0 */ { 10,  6, 12,  1, 10, 12,  0,  1, 12,  8,  0, 12,  7,  8, 12,  4,  7, 12,  9,  4, 12,  5,  9, 12,  6,  5, 12 },
+ /* 0,1 */ {  0,  1, 12,  8,  0, 12,  7,  8, 12,  6,  7, 12, 10,  6, 12,  5, 10, 12,  4,  5, 12,  9,  4, 12,  1,  9, 12 },
+ /* 1,1 */ { 12,  0,  1, 12,  1, 10, 12, 10,  6, 12,  6,  7, 12,  7,  8, 12,  8,  4, 12,  4,  5, 12,  5,  9, 12,  9,  0 }
+},
+/* 164:       2,       5,    7,  */  {
+ /* 1,0 */ { 11,  7, 12,  2, 11, 12,  1,  2, 12,  9,  1, 12,  4,  9, 12,  5,  4, 12, 10,  5, 12,  6, 10, 12,  7,  6, 12 },
+ /* 0,1 */ {  1,  2, 12,  9,  1, 12,  4,  9, 12,  7,  4, 12, 11,  7, 12,  6, 11, 12,  5,  6, 12, 10,  5, 12,  2, 10, 12 },
+ /* 1,1 */ { 12,  1,  2, 12,  2, 11, 12, 11,  7, 12,  7,  4, 12,  4,  9, 12,  9,  5, 12,  5,  6, 12,  6, 10, 12, 10,  1 }
+},
+/*  88:          3, 4,    6,     */  {
+ /* 1,0 */ {  8,  4, 12,  3,  8, 12,  2,  3, 12, 10,  2, 12,  5, 10, 12,  6,  5, 12, 11,  6, 12,  7, 11, 12,  4,  7, 12 },
+ /* 0,1 */ {  2,  3, 12, 10,  2, 12,  5, 10, 12,  4,  5, 12,  8,  4, 12,  7,  8, 12,  6,  7, 12, 11,  6, 12,  3, 11, 12 },
+ /* 1,1 */ { 12,  2,  3, 12,  3,  8, 12,  8,  4, 12,  4,  5, 12,  5, 10, 12, 10,  6, 12,  6,  7, 12,  7, 11, 12, 11,  2 }
+},
+/* 167: 0, 1, 2,       5,    7,  */  {
+ /* 1,0 */ { 12,  4,  8, 12,  8,  3, 12,  3,  2, 12,  2, 10, 12, 10,  5, 12,  5,  6, 12,  6, 11, 12, 11,  7, 12,  7,  4 },
+ /* 0,1 */ { 12,  3,  2, 12,  2, 10, 12, 10,  5, 12,  5,  4, 12,  4,  8, 12,  8,  7, 12,  7,  6, 12,  6, 11, 12, 11,  3 },
+ /* 1,1 */ {  3,  2, 12,  8,  3, 12,  4,  8, 12,  5,  4, 12, 10,  5, 12,  6, 10, 12,  7,  6, 12, 11,  7, 12,  2, 11, 12 }
+},
+/*  91: 0, 1,    3, 4,    6,     */  {
+ /* 1,0 */ { 12,  7, 11, 12, 11,  2, 12,  2,  1, 12,  1,  9, 12,  9,  4, 12,  4,  5, 12,  5, 10, 12, 10,  6, 12,  6,  7 },
+ /* 0,1 */ { 12,  2,  1, 12,  1,  9, 12,  9,  4, 12,  4,  7, 12,  7, 11, 12, 11,  6, 12,  6,  5, 12,  5, 10, 12, 10,  2 },
+ /* 1,1 */ {  2,  1, 12, 11,  2, 12,  7, 11, 12,  4,  7, 12,  9,  4, 12,  5,  9, 12,  6,  5, 12, 10,  6, 12,  1, 10, 12 }
+},
+/* 173: 0,    2, 3,    5,    7,  */  {
+ /* 1,0 */ { 12,  6, 10, 12, 10,  1, 12,  1,  0, 12,  0,  8, 12,  8,  7, 12,  7,  4, 12,  4,  9, 12,  9,  5, 12,  5,  6 },
+ /* 0,1 */ { 12,  1,  0, 12,  0,  8, 12,  8,  7, 12,  7,  6, 12,  6, 10, 12, 10,  5, 12,  5,  4, 12,  4,  9, 12,  9,  1 },
+ /* 1,1 */ {  1,  0, 12, 10,  1, 12,  6, 10, 12,  7,  6, 12,  8,  7, 12,  4,  8, 12,  5,  4, 12,  9,  5, 12,  0,  9, 12 }
+},
+/* 181: 0,    2,    4, 5,    7,  */  {
+ /* 1,0 */ { 11,  3, 12,  6, 11, 12,  5,  6, 12,  9,  5, 12,  0,  9, 12,  1,  0, 12, 10,  1, 12,  2, 10, 12,  3,  2, 12 },
+ /* 0,1 */ {  5,  6, 12,  9,  5, 12,  0,  9, 12,  3,  0, 12, 11,  3, 12,  2, 11, 12,  1,  2, 12, 10,  1, 12,  6, 10, 12 },
+ /* 1,1 */ { 12,  5,  6, 12,  6, 11, 12, 11,  3, 12,  3,  0, 12,  0,  9, 12,  9,  1, 12,  1,  2, 12,  2, 10, 12, 10,  5 }
+},
+/* 229: 0,    2,       5, 6, 7,  */  {
+ /* 1,0 */ {  9,  1, 12,  4,  9, 12,  7,  4, 12, 11,  7, 12,  2, 11, 12,  3,  2, 12,  8,  3, 12,  0,  8, 12,  1,  0, 12 },
+ /* 0,1 */ {  7,  4, 12, 11,  7, 12,  2, 11, 12,  1,  2, 12,  9,  1, 12,  0,  9, 12,  3,  0, 12,  8,  3, 12,  4,  8, 12 },
+ /* 1,1 */ { 12,  7,  4, 12,  4,  9, 12,  9,  1, 12,  1,  2, 12,  2, 11, 12, 11,  3, 12,  3,  0, 12,  0,  8, 12,  8,  7 }
+},
+/*  94:    1, 2, 3, 4,    6,     */  {
+ /* 1,0 */ { 12,  5,  9, 12,  9,  0, 12,  0,  3, 12,  3, 11, 12, 11,  6, 12,  6,  7, 12,  7,  8, 12,  8,  4, 12,  4,  5 },
+ /* 0,1 */ { 12,  0,  3, 12,  3, 11, 12, 11,  6, 12,  6,  5, 12,  5,  9, 12,  9,  4, 12,  4,  7, 12,  7,  8, 12,  8,  0 },
+ /* 1,1 */ {  0,  3, 12,  9,  0, 12,  5,  9, 12,  6,  5, 12, 11,  6, 12,  7, 11, 12,  4,  7, 12,  8,  4, 12,  3,  8, 12 }
+},
+/* 122:    1,    3, 4, 5, 6,     */  {
+ /* 1,0 */ {  8,  0, 12,  7,  8, 12,  6,  7, 12, 10,  6, 12,  1, 10, 12,  2,  1, 12, 11,  2, 12,  3, 11, 12,  0,  3, 12 },
+ /* 0,1 */ {  6,  7, 12, 10,  6, 12,  1, 10, 12,  0,  1, 12,  8,  0, 12,  3,  8, 12,  2,  3, 12, 11,  2, 12,  7, 11, 12 },
+ /* 1,1 */ { 12,  6,  7, 12,  7,  8, 12,  8,  0, 12,  0,  1, 12,  1, 10, 12, 10,  2, 12,  2,  3, 12,  3, 11, 12, 11,  6 }
+},
+/* 218:    1,    3, 4,    6, 7,  */  {
+ /* 1,0 */ { 10,  2, 12,  5, 10, 12,  4,  5, 12,  8,  4, 12,  3,  8, 12,  0,  3, 12,  9,  0, 12,  1,  9, 12,  2,  1, 12 },
+ /* 0,1 */ {  4,  5, 12,  8,  4, 12,  3,  8, 12,  2,  3, 12, 10,  2, 12,  1, 10, 12,  0,  1, 12,  9,  0, 12,  5,  9, 12 },
+ /* 1,1 */ { 12,  4,  5, 12,  5, 10, 12, 10,  2, 12,  2,  3, 12,  3,  8, 12,  8,  0, 12,  0,  1, 12,  1,  9, 12,  9,  4 } }
+};
+
+//_____________________________________________________________________________
+/**
+ * \brief tiling table for case 7.4.1
+ * For each of the case above, the specific triangulation of the edge
+ * intersection points is given.
+ * When a case is ambiguous, there is an auxiliary table that contains
+ * the face number to test and the tiling table contains the specific
+ * triangulations depending on the results
+ * A minus sign means to invert the result of the test.
+ */
+//-----------------------------------------------------------------------------
+static const char tiling7_4_1[16][15] = {
+/*  37: 0,    2,       5,        */  {  3,  4,  8,  4,  3, 10,  2, 10,  3,  4, 10,  5,  9,  1,  0 },
+/* 133: 0,    2,             7,  */  {  1,  6, 10,  6,  1,  8,  0,  8,  1,  6,  8,  7, 11,  3,  2 },
+/* 161: 0,             5,    7,  */  { 11,  3,  6,  9,  6,  3,  6,  9,  5,  0,  9,  3,  7,  4,  8 },
+/*  26:    1,    3, 4,           */  {  2,  7, 11,  7,  2,  9,  1,  9,  2,  7,  9,  4,  8,  0,  3 },
+/*  74:    1,    3,       6,     */  {  0,  5,  9,  5,  0, 11,  3, 11,  0,  5, 11,  6, 10,  2,  1 },
+/*  82:    1,       4,    6,     */  {  8,  0,  7, 10,  7,  0,  7, 10,  6,  1, 10,  0,  4,  5,  9 },
+/* 164:       2,       5,    7,  */  {  9,  1,  4, 11,  4,  1,  4, 11,  7,  2, 11,  1,  5,  6, 10 },
+/*  88:          3, 4,    6,     */  { 10,  2,  5,  8,  5,  2,  5,  8,  4,  3,  8,  2,  6,  7, 11 },
+/* 167: 0, 1, 2,       5,    7,  */  {  5,  2, 10,  2,  5,  8,  4,  8,  5,  2,  8,  3, 11,  7,  6 },
+/*  91: 0, 1,    3, 4,    6,     */  {  4,  1,  9,  1,  4, 11,  7, 11,  4,  1, 11,  2, 10,  6,  5 },
+/* 173: 0,    2, 3,    5,    7,  */  {  7,  0,  8,  0,  7, 10,  6, 10,  7,  0, 10,  1,  9,  5,  4 },
+/* 181: 0,    2,    4, 5,    7,  */  {  9,  5,  0, 11,  0,  5,  0, 11,  3,  6, 11,  5,  1,  2, 10 },
+/* 229: 0,    2,       5, 6, 7,  */  { 11,  7,  2,  9,  2,  7,  2,  9,  1,  4,  9,  7,  3,  0,  8 },
+/*  94:    1, 2, 3, 4,    6,     */  {  6,  3, 11,  3,  6,  9,  5,  9,  6,  3,  9,  0,  8,  4,  7 },
+/* 122:    1,    3, 4, 5, 6,     */  { 10,  6,  1,  8,  1,  6,  1,  8,  0,  7,  8,  6,  2,  3, 11 },
+/* 218:    1,    3, 4,    6, 7,  */  {  8,  4,  3, 10,  3,  4,  3, 10,  2,  5, 10,  4,  0,  1,  9 }
+};
+
+//_____________________________________________________________________________
+/**
+ * \brief tiling table for case 7.4.2
+ * For each of the case above, the specific triangulation of the edge
+ * intersection points is given.
+ * When a case is ambiguous, there is an auxiliary table that contains
+ * the face number to test and the tiling table contains the specific
+ * triangulations depending on the results
+ * A minus sign means to invert the result of the test.
+ */
+//-----------------------------------------------------------------------------
+static const char tiling7_4_2[16][27] = {
+/*  37: 0,    2,       5,        */  {   9,  4,  8,  4,  9,  5, 10,  5,  9,  1, 10,  9, 10,  1,  2,  0,  2,  1,  2,  0,  3,  8,  3,  0,  9,  8,  0 },
+/* 133: 0,    2,             7,  */  {  11,  6, 10,  6, 11,  7,  8,  7, 11,  3,  8, 11,  8,  3,  0,  2,  0,  3,  0,  2,  1, 10,  1,  2, 11, 10,  2 },
+/* 161: 0,             5,    7,  */  {  11,  3,  8,  0,  8,  3,  8,  0,  9,  8,  9,  4,  5,  4,  9,  4,  5,  7,  6,  7,  5,  7,  6, 11,  7, 11,  8 },
+/*  26:    1,    3, 4,           */  {   8,  7, 11,  7,  8,  4,  9,  4,  8,  0,  9,  8,  9,  0,  1,  3,  1,  0,  1,  3,  2, 11,  2,  3,  8, 11,  3 },
+/*  74:    1,    3,       6,     */  {  10,  5,  9,  5, 10,  6, 11,  6, 10,  2, 11, 10, 11,  2,  3,  1,  3,  2,  3,  1,  0,  9,  0,  1, 10,  9,  1 },
+/*  82:    1,       4,    6,     */  {   8,  0,  9,  1,  9,  0,  9,  1, 10,  9, 10,  5,  6,  5, 10,  5,  6,  4,  7,  4,  6,  4,  7,  8,  4,  8,  9 },
+/* 164:       2,       5,    7,  */  {   9,  1, 10,  2, 10,  1, 10,  2, 11, 10, 11,  6,  7,  6, 11,  6,  7,  5,  4,  5,  7,  5,  4,  9,  5,  9, 10 },
+/*  88:          3, 4,    6,     */  {  10,  2, 11,  3, 11,  2, 11,  3,  8, 11,  8,  7,  4,  7,  8,  7,  4,  6,  5,  6,  4,  6,  5, 10,  6, 10, 11 },
+/* 167: 0, 1, 2,       5,    7,  */  {  11,  2, 10,  2, 11,  3,  8,  3, 11,  7,  8, 11,  8,  7,  4,  6,  4,  7,  4,  6,  5, 10,  5,  6, 11, 10,  6 },
+/*  91: 0, 1,    3, 4,    6,     */  {  10,  1,  9,  1, 10,  2, 11,  2, 10,  6, 11, 10, 11,  6,  7,  5,  7,  6,  7,  5,  4,  9,  4,  5, 10,  9,  5 },
+/* 173: 0,    2, 3,    5,    7,  */  {   9,  0,  8,  0,  9,  1, 10,  1,  9,  5, 10,  9, 10,  5,  6,  4,  6,  5,  6,  4,  7,  8,  7,  4,  9,  8,  4 },
+/* 181: 0,    2,    4, 5,    7,  */  {   9,  5, 10,  6, 10,  5, 10,  6, 11, 10, 11,  2,  3,  2, 11,  2,  3,  1,  0,  1,  3,  1,  0,  9,  1,  9, 10 },
+/* 229: 0,    2,       5, 6, 7,  */  {  11,  7,  8,  4,  8,  7,  8,  4,  9,  8,  9,  0,  1,  0,  9,  0,  1,  3,  2,  3,  1,  3,  2, 11,  3, 11,  8 },
+/*  94:    1, 2, 3, 4,    6,     */  {   8,  3, 11,  3,  8,  0,  9,  0,  8,  4,  9,  8,  9,  4,  5,  7,  5,  4,  5,  7,  6, 11,  6,  7,  8, 11,  7 },
+/* 122:    1,    3, 4, 5, 6,     */  {  10,  6, 11,  7, 11,  6, 11,  7,  8, 11,  8,  3,  0,  3,  8,  3,  0,  2,  1,  2,  0,  2,  1, 10,  2, 10, 11 },
+/* 218:    1,    3, 4,    6, 7,  */  {   8,  4,  9,  5,  9,  4,  9,  5, 10,  9, 10,  1,  2,  1, 10,  1,  2,  0,  3,  0,  2,  0,  3,  8,  0,  8,  9 }
+};
+//_____________________________________________________________________________
+
+
+//_____________________________________________________________________________
+/**
+ * \brief tiling table for case 8
+ * For each of the case above, the specific triangulation of the edge
+ * intersection points is given.
+ * When a case is ambiguous, there is an auxiliary table that contains
+ * the face number to test and the tiling table contains the specific
+ * triangulations depending on the results
+ * A minus sign means to invert the result of the test.
+ */
+//-----------------------------------------------------------------------------
+static const char tiling8[6][6] = {
+/*  15: 0, 1, 2, 3,              */  { 9,  8, 10, 10,  8, 11 },
+/*  51: 0, 1,       4, 5,        */  { 1,  5,  3,  3,  5,  7 },
+/* 153: 0,       3, 4,       7,  */  { 0,  4,  2,  4,  6,  2 },
+/* 102:    1, 2,       5, 6,     */  { 0,  2,  4,  4,  2,  6 },
+/* 204:       2, 3,       6, 7,  */  { 1,  3,  5,  3,  7,  5 },
+/* 240:             4, 5, 6, 7,  */  { 9, 10,  8, 10, 11,  8 }
+};
+//_____________________________________________________________________________
+
+
+//_____________________________________________________________________________
+/**
+ * \brief tiling table for case 9
+ * For each of the case above, the specific triangulation of the edge
+ * intersection points is given.
+ * When a case is ambiguous, there is an auxiliary table that contains
+ * the face number to test and the tiling table contains the specific
+ * triangulations depending on the results
+ * A minus sign means to invert the result of the test.
+ */
+//-----------------------------------------------------------------------------
+static const char tiling9[8][12] = {
+/*  39: 0, 1, 2,       5,        */  {  2, 10,  5,  3,  2,  5,  3,  5,  4,  3,  4,  8 },
+/*  27: 0, 1,    3, 4,           */  {  4,  7, 11,  9,  4, 11,  9, 11,  2,  9,  2,  1 },
+/* 141: 0,    2, 3,          7,  */  { 10,  7,  6,  1,  7, 10,  1,  8,  7,  1,  0,  8 },
+/* 177: 0,          4, 5,    7,  */  {  3,  6, 11,  0,  6,  3,  0,  5,  6,  0,  9,  5 },
+/*  78:    1, 2, 3,       6,     */  {  3, 11,  6,  0,  3,  6,  0,  6,  5,  0,  5,  9 },
+/* 114:    1,       4, 5, 6,     */  { 10,  6,  7,  1, 10,  7,  1,  7,  8,  1,  8,  0 },
+/* 228:       2,       5, 6, 7,  */  {  4, 11,  7,  9, 11,  4,  9,  2, 11,  9,  1,  2 },
+/* 216:          3, 4,    6, 7,  */  {  2,  5, 10,  3,  5,  2,  3,  4,  5,  3,  8,  4 }
+};
+//_____________________________________________________________________________
+
+
+
+//_____________________________________________________________________________
+/**
+ * \brief test table for case 10
+ * 2 faces to test + eventually the interior
+ * When the tests on both specified faces are positive : 4 middle triangles (1)
+ * When the test on the first  specified face is positive : 8 first triangles
+ * When the test on the second specified face is positive : 8 next triangles
+ * When the tests on both specified faces are negative :
+ * - if the test on the interior is negative : 4 middle triangles
+ * - if the test on the interior is positive : 8 last triangles
+ *
+ * For each of the case above, the specific triangulation of the edge
+ * intersection points is given.
+ * When a case is ambiguous, there is an auxiliary table that contains
+ * the face number to test and the tiling table contains the specific
+ * triangulations depending on the results
+ * A minus sign means to invert the result of the test.
+ */
+//-----------------------------------------------------------------------------
+static const char test10[6][3] = {
+/* 195: 0, 1,             6, 7,  */  {  2,  4,  7 },
+/*  85: 0,    2,    4,    6,     */  {  5,  6,  7 },
+/* 105: 0,       3,    5, 6,     */  {  1,  3,  7 },
+/* 150:    1, 2,    4,       7,  */  {  1,  3,  7 },
+/* 170:    1,    3,    5,    7,  */  {  5,  6,  7 },
+/*  60:       2, 3, 4, 5,        */  {  2,  4,  7 }
+};
+
+//_____________________________________________________________________________
+/**
+ * \brief tiling table for case 10.1.1
+ * For each of the case above, the specific triangulation of the edge
+ * intersection points is given.
+ * When a case is ambiguous, there is an auxiliary table that contains
+ * the face number to test and the tiling table contains the specific
+ * triangulations depending on the results
+ * A minus sign means to invert the result of the test.
+ */
+//-----------------------------------------------------------------------------
+static const char tiling10_1_1[6][12] = {
+/* 195: 0, 1,             6, 7,  */  {  5, 10,  7, 11,  7, 10,  8,  1,  9,  1,  8,  3 },
+/*  85: 0,    2,    4,    6,     */  {  1,  2,  5,  6,  5,  2,  4,  3,  0,  3,  4,  7 },
+/* 105: 0,       3,    5, 6,     */  { 11,  0,  8,  0, 11,  2,  4,  9,  6, 10,  6,  9 },
+/* 150:    1, 2,    4,       7,  */  {  9,  0, 10,  2, 10,  0,  6,  8,  4,  8,  6, 11 },
+/* 170:    1,    3,    5,    7,  */  {  7,  2,  3,  2,  7,  6,  0,  1,  4,  5,  4,  1 },
+/*  60:       2, 3, 4, 5,        */  {  7,  9,  5,  9,  7,  8, 10,  1, 11,  3, 11,  1 }
+};
+
+//_____________________________________________________________________________
+/**
+ * \brief tiling table for case 10.1.1 inverted
+ * For each of the case above, the specific triangulation of the edge
+ * intersection points is given.
+ * When a case is ambiguous, there is an auxiliary table that contains
+ * the face number to test and the tiling table contains the specific
+ * triangulations depending on the results
+ * A minus sign means to invert the result of the test.
+ */
+//-----------------------------------------------------------------------------
+static const char tiling10_1_1_[6][12] = {
+/* 195: 0, 1,             6, 7,  */  {  5,  9,  7,  8,  7,  9, 11,  1, 10,  1, 11,  3 },
+/*  85: 0,    2,    4,    6,     */  {  3,  2,  7,  6,  7,  2,  4,  1,  0,  1,  4,  5 },
+/* 105: 0,       3,    5, 6,     */  { 10,  0,  9,  0, 10,  2,  4,  8,  6, 11,  6,  8 },
+/* 150:    1, 2,    4,       7,  */  {  8,  0, 11,  2, 11,  0,  6,  9,  4,  9,  6, 10 },
+/* 170:    1,    3,    5,    7,  */  {  5,  2,  1,  2,  5,  6,  0,  3,  4,  7,  4,  3 },
+/*  60:       2, 3, 4, 5,        */  {  7, 10,  5, 10,  7, 11,  9,  1,  8,  3,  8,  1 }
+};
+
+//_____________________________________________________________________________
+/**
+ * \brief tiling table for case 10.1.2
+ * For each of the case above, the specific triangulation of the edge
+ * intersection points is given.
+ * When a case is ambiguous, there is an auxiliary table that contains
+ * the face number to test and the tiling table contains the specific
+ * triangulations depending on the results
+ * A minus sign means to invert the result of the test.
+ */
+//-----------------------------------------------------------------------------
+static const char tiling10_1_2[6][24] = {
+/* 195: 0, 1,             6, 7,  */  {  3, 11,  7,  3,  7,  8,  9,  8,  7,  5,  9,  7,  9,  5, 10,  9, 10,  1,  3,  1, 10, 11,  3, 10 },
+/*  85: 0,    2,    4,    6,     */  {  7,  6,  5,  7,  5,  4,  0,  4,  5,  1,  0,  5,  0,  1,  2,  0,  2,  3,  7,  3,  2,  6,  7,  2 },
+/* 105: 0,       3,    5, 6,     */  { 11,  2, 10,  6, 11, 10, 11,  6,  4, 11,  4,  8,  0,  8,  4,  9,  0,  4,  0,  9, 10,  0, 10,  2 },
+/* 150:    1, 2,    4,       7,  */  { 11,  2, 10, 11, 10,  6,  4,  6, 10,  9,  4, 10,  4,  9,  0,  4,  0,  8, 11,  8,  0,  2, 11,  0 },
+/* 170:    1,    3,    5,    7,  */  {  7,  6,  5,  4,  7,  5,  7,  4,  0,  7,  0,  3,  2,  3,  0,  1,  2,  0,  2,  1,  5,  2,  5,  6 },
+/*  60:       2, 3, 4, 5,        */  {  7,  8,  3, 11,  7,  3,  7, 11, 10,  7, 10,  5,  9,  5, 10,  1,  9, 10,  9,  1,  3,  9,  3,  8 }
+};
+
+//_____________________________________________________________________________
+/**
+ * \brief tiling table for case 10.2
+ * For each of the case above, the specific triangulation of the edge
+ * intersection points is given.
+ * When a case is ambiguous, there is an auxiliary table that contains
+ * the face number to test and the tiling table contains the specific
+ * triangulations depending on the results
+ * A minus sign means to invert the result of the test.
+ */
+//-----------------------------------------------------------------------------
+static const char tiling10_2[6][24] = {
+/* 195: 0, 1,             6, 7,  */  { 12,  5,  9, 12,  9,  8, 12,  8,  3, 12,  3,  1, 12,  1, 10, 12, 10, 11, 12, 11,  7, 12,  7,  5 },
+/*  85: 0,    2,    4,    6,     */  { 12,  1,  0, 12,  0,  4, 12,  4,  7, 12,  7,  3, 12,  3,  2, 12,  2,  6, 12,  6,  5, 12,  5,  1 },
+/* 105: 0,       3,    5, 6,     */  {  4,  8, 12,  6,  4, 12, 10,  6, 12,  9, 10, 12,  0,  9, 12,  2,  0, 12, 11,  2, 12,  8, 11, 12 },
+/* 150:    1, 2,    4,       7,  */  { 12,  9,  4, 12,  4,  6, 12,  6, 11, 12, 11,  8, 12,  8,  0, 12,  0,  2, 12,  2, 10, 12, 10,  9 },
+/* 170:    1,    3,    5,    7,  */  {  0,  3, 12,  4,  0, 12,  5,  4, 12,  1,  5, 12,  2,  1, 12,  6,  2, 12,  7,  6, 12,  3,  7, 12 },
+/*  60:       2, 3, 4, 5,        */  { 10,  5, 12, 11, 10, 12,  3, 11, 12,  1,  3, 12,  9,  1, 12,  8,  9, 12,  7,  8, 12,  5,  7, 12 }
+};
+
+//_____________________________________________________________________________
+/**
+ * \brief tiling table for case 10.2 inverted
+ * For each of the case above, the specific triangulation of the edge
+ * intersection points is given.
+ * When a case is ambiguous, there is an auxiliary table that contains
+ * the face number to test and the tiling table contains the specific
+ * triangulations depending on the results
+ * A minus sign means to invert the result of the test.
+ */
+//-----------------------------------------------------------------------------
+static const char tiling10_2_[6][24] = {
+/* 195: 0, 1,             6, 7,  */  {  8,  7, 12,  9,  8, 12,  1,  9, 12,  3,  1, 12, 11,  3, 12, 10, 11, 12,  5, 10, 12,  7,  5, 12 },
+/*  85: 0,    2,    4,    6,     */  {  4,  5, 12,  0,  4, 12,  3,  0, 12,  7,  3, 12,  6,  7, 12,  2,  6, 12,  1,  2, 12,  5,  1, 12 },
+/* 105: 0,       3,    5, 6,     */  { 12, 11,  6, 12,  6,  4, 12,  4,  9, 12,  9, 10, 12, 10,  2, 12,  2,  0, 12,  0,  8, 12,  8, 11 },
+/* 150:    1, 2,    4,       7,  */  {  6, 10, 12,  4,  6, 12,  8,  4, 12, 11,  8, 12,  2, 11, 12,  0,  2, 12,  9,  0, 12, 10,  9, 12 },
+/* 170:    1,    3,    5,    7,  */  { 12,  7,  4, 12,  4,  0, 12,  0,  1, 12,  1,  5, 12,  5,  6, 12,  6,  2, 12,  2,  3, 12,  3,  7 },
+/*  60:       2, 3, 4, 5,        */  { 12,  7, 11, 12, 11, 10, 12, 10,  1, 12,  1,  3, 12,  3,  8, 12,  8,  9, 12,  9,  5, 12,  5,  7 }
+};
+//_____________________________________________________________________________
+
+
+//_____________________________________________________________________________
+/**
+ * \brief tiling table for case 11
+ * For each of the case above, the specific triangulation of the edge
+ * intersection points is given.
+ * When a case is ambiguous, there is an auxiliary table that contains
+ * the face number to test and the tiling table contains the specific
+ * triangulations depending on the results
+ * A minus sign means to invert the result of the test.
+ */
+//-----------------------------------------------------------------------------
+static const char tiling11[12][12] = {
+/*  23: 0, 1, 2,    4,           */  { 2, 10,  9,  2,  9,  7,  2,  7,  3,  7,  9,  4 },
+/* 139: 0, 1,    3,          7,  */  { 1,  6,  2,  1,  8,  6,  1,  9,  8,  8,  7,  6 },
+/*  99: 0, 1,          5, 6,     */  { 8,  3,  1,  8,  1,  6,  8,  6,  4,  6,  1, 10 },
+/*  77: 0,    2, 3,       6,     */  { 0,  8, 11,  0, 11,  5,  0,  5,  1,  5, 11,  6 },
+/*  57: 0,       3, 4, 5,        */  { 9,  5,  7,  9,  7,  2,  9,  2,  0,  2,  7, 11 },
+/* 209: 0,          4,    6, 7,  */  { 5,  0,  4,  5, 11,  0,  5, 10, 11, 11,  3,  0 },
+/*  46:    1, 2, 3,    5,        */  { 5,  4,  0,  5,  0, 11,  5, 11, 10, 11,  0,  3 },
+/* 198:    1, 2,          6, 7,  */  { 9,  7,  5,  9,  2,  7,  9,  0,  2,  2, 11,  7 },
+/* 178:    1,       4, 5,    7,  */  { 0, 11,  8,  0,  5, 11,  0,  1,  5,  5,  6, 11 },
+/* 156:       2, 3, 4,       7,  */  { 8,  1,  3,  8,  6,  1,  8,  4,  6,  6, 10,  1 },
+/* 116:       2,    4, 5, 6,     */  { 1,  2,  6,  1,  6,  8,  1,  8,  9,  8,  6,  7 },
+/* 232:          3,    5, 6, 7,  */  { 2,  9, 10,  2,  7,  9,  2,  3,  7,  7,  4,  9 }
+};
+//_____________________________________________________________________________
+
+
+//_____________________________________________________________________________
+/**
+ * \brief test table for case 12
+ * 2 faces to test + eventually the interior
+ * When the tests on both specified faces are positive : 4 middle triangles (1)
+ * When the test on the first  specified face is positive : 8 first triangles
+ * When the test on the second specified face is positive : 8 next triangles
+ * When the tests on both specified faces are negative :
+ * - if the test on the interior is negative : 4 middle triangles
+ * - if the test on the interior is positive : 8 last triangles
+ * The support edge for the interior test is marked as the 4th column.
+ *
+ * For each of the case above, the specific triangulation of the edge
+ * intersection points is given.
+ * When a case is ambiguous, there is an auxiliary table that contains
+ * the face number to test and the tiling table contains the specific
+ * triangulations depending on the results
+ * A minus sign means to invert the result of the test.
+ */
+//-----------------------------------------------------------------------------
+static const char test12[24][4] = {
+/* 135: 0, 1, 2,             7,  */  {  4,  3,  7,  11 },
+/*  75: 0, 1,    3,       6,     */  {  3,  2,  7,  10 },
+/*  83: 0, 1,       4,    6,     */  {  2,  6,  7,   5 },
+/* 163: 0, 1,          5,    7,  */  {  6,  4,  7,   7 },
+/*  45: 0,    2, 3,    5,        */  {  2,  1,  7,   9 },
+/*  53: 0,    2,    4, 5,        */  {  5,  2,  7,   1 },
+/* 149: 0,    2,    4,       7,  */  {  5,  3,  7,   2 },
+/* 101: 0,    2,       5, 6,     */  {  5,  1,  7,   0 },
+/* 197: 0,    2,          6, 7,  */  {  5,  4,  7,   3 },
+/*  89: 0,       3, 4,    6,     */  {  6,  3,  7,   6 },
+/* 169: 0,       3,    5,    7,  */  {  1,  6,  7,   4 },
+/* 225: 0,             5, 6, 7,  */  {  1,  4,  7,   8 },
+/*  30:    1, 2, 3, 4,           */  {  4,  1,  7,   8 },
+/*  86:    1, 2,    4,    6,     */  {  6,  1,  7,   4 },
+/* 166:    1, 2,       5,    7,  */  {  3,  6,  7,   6 },
+/*  58:    1,    3, 4, 5,        */  {  4,  5,  7,   3 },
+/* 154:    1,    3, 4,       7,  */  {  1,  5,  7,   0 },
+/* 106:    1,    3,    5, 6,     */  {  3,  5,  7,   2 },
+/* 202:    1,    3,       6, 7,  */  {  2,  5,  7,   1 },
+/* 210:    1,       4,    6, 7,  */  {  1,  2,  7,   9 },
+/*  92:       2, 3, 4,    6,     */  {  4,  6,  7,   7 },
+/* 172:       2, 3,    5,    7,  */  {  6,  2,  7,   5 },
+/* 180:       2,    4, 5,    7,  */  {  2,  3,  7,  10 },
+/* 120:          3, 4, 5, 6,     */  {  3,  4,  7,  11 }
+};
+
+//_____________________________________________________________________________
+/**
+ * \brief tiling table for case 12.1.1
+ * For each of the case above, the specific triangulation of the edge
+ * intersection points is given.
+ * When a case is ambiguous, there is an auxiliary table that contains
+ * the face number to test and the tiling table contains the specific
+ * triangulations depending on the results
+ * A minus sign means to invert the result of the test.
+ */
+//-----------------------------------------------------------------------------
+static const char tiling12_1_1[24][12] = {
+/* 135: 0, 1, 2,             7,  */  {  7,  6, 11, 10,  3,  2,  3, 10,  8,  9,  8, 10 },
+/*  75: 0, 1,    3,       6,     */  {  6,  5, 10,  9,  2,  1,  2,  9, 11,  8, 11,  9 },
+/*  83: 0, 1,       4,    6,     */  { 10,  6,  5,  7,  9,  4,  9,  7,  1,  3,  1,  7 },
+/* 163: 0, 1,          5,    7,  */  {  7,  6, 11,  4,  8,  5,  3,  5,  8,  5,  3,  1 },
+/*  45: 0,    2, 3,    5,        */  {  5,  4,  9,  8,  1,  0,  1,  8, 10, 11, 10,  8 },
+/*  53: 0,    2,    4, 5,        */  {  1,  2, 10,  0,  9,  3,  5,  3,  9,  3,  5,  7 },
+/* 149: 0,    2,    4,       7,  */  { 10,  1,  2,  0, 11,  3, 11,  0,  6,  4,  6,  0 },
+/* 101: 0,    2,       5, 6,     */  {  8,  3,  0,  2,  9,  1,  9,  2,  4,  6,  4,  2 },
+/* 197: 0,    2,          6, 7,  */  {  3,  0,  8,  2, 11,  1,  7,  1, 11,  1,  7,  5 },
+/*  89: 0,       3, 4,    6,     */  {  6,  5, 10,  7, 11,  4,  2,  4, 11,  4,  2,  0 },
+/* 169: 0,       3,    5,    7,  */  {  9,  5,  4,  6,  8,  7,  8,  6,  0,  2,  0,  6 },
+/* 225: 0,             5, 6, 7,  */  {  8,  3,  0,  7,  4, 11,  9, 11,  4, 11,  9, 10 },
+/*  30:    1, 2, 3, 4,           */  {  4,  7,  8, 11,  0,  3,  0, 11,  9, 10,  9, 11 },
+/*  86:    1, 2,    4,    6,     */  {  4,  7,  8,  5,  9,  6,  0,  6,  9,  6,  0,  2 },
+/* 166:    1, 2,       5,    7,  */  { 11,  7,  6,  4, 10,  5, 10,  4,  2,  0,  2,  4 },
+/*  58:    1,    3, 4, 5,        */  { 11,  2,  3,  1,  8,  0,  8,  1,  7,  5,  7,  1 },
+/* 154:    1,    3, 4,       7,  */  {  0,  1,  9,  3,  8,  2,  4,  2,  8,  2,  4,  6 },
+/* 106:    1,    3,    5, 6,     */  {  2,  3, 11,  1, 10,  0,  6,  0, 10,  0,  6,  4 },
+/* 202:    1,    3,       6, 7,  */  {  9,  0,  1,  3, 10,  2, 10,  3,  5,  7,  5,  3 },
+/* 210:    1,       4,    6, 7,  */  {  9,  0,  1,  4,  5,  8, 10,  8,  5,  8, 10, 11 },
+/*  92:       2, 3, 4,    6,     */  {  8,  4,  7,  5, 11,  6, 11,  5,  3,  1,  3,  5 },
+/* 172:       2, 3,    5,    7,  */  {  5,  4,  9,  6, 10,  7,  1,  7, 10,  7,  1,  3 },
+/* 180:       2,    4, 5,    7,  */  { 10,  1,  2,  5,  6,  9, 11,  9,  6,  9, 11,  8 },
+/* 120:          3, 4, 5, 6,     */  { 11,  2,  3,  6,  7, 10,  8, 10,  7, 10,  8,  9 }
+};
+
+//_____________________________________________________________________________
+/**
+ * \brief tiling table for case 12.1.1 inverted
+ * For each of the case above, the specific triangulation of the edge
+ * intersection points is given.
+ * When a case is ambiguous, there is an auxiliary table that contains
+ * the face number to test and the tiling table contains the specific
+ * triangulations depending on the results
+ * A minus sign means to invert the result of the test.
+ */
+//-----------------------------------------------------------------------------
+static const char tiling12_1_1_[24][12] = {
+/* 135: 0, 1, 2,             7,  */  {  3,  2, 11, 10,  7,  6,  7, 10,  8,  9,  8, 10 },
+/*  75: 0, 1,    3,       6,     */  {  2,  1, 10,  9,  6,  5,  6,  9, 11,  8, 11,  9 },
+/*  83: 0, 1,       4,    6,     */  {  9,  4,  5,  7, 10,  6, 10,  7,  1,  3,  1,  7 },
+/* 163: 0, 1,          5,    7,  */  {  7,  4,  8,  6, 11,  5,  3,  5, 11,  5,  3,  1 },
+/*  45: 0,    2, 3,    5,        */  {  1,  0,  9,  8,  5,  4,  5,  8, 10, 11, 10,  8 },
+/*  53: 0,    2,    4, 5,        */  {  1,  0,  9,  2, 10,  3,  5,  3, 10,  3,  5,  7 },
+/* 149: 0,    2,    4,       7,  */  { 11,  3,  2,  0, 10,  1, 10,  0,  6,  4,  6,  0 },
+/* 101: 0,    2,       5, 6,     */  {  9,  1,  0,  2,  8,  3,  8,  2,  4,  6,  4,  2 },
+/* 197: 0,    2,          6, 7,  */  {  3,  2, 11,  0,  8,  1,  7,  1,  8,  1,  7,  5 },
+/*  89: 0,       3, 4,    6,     */  {  6,  7, 11,  5, 10,  4,  2,  4, 10,  4,  2,  0 },
+/* 169: 0,       3,    5,    7,  */  {  8,  7,  4,  6,  9,  5,  9,  6,  0,  2,  0,  6 },
+/* 225: 0,             5, 6, 7,  */  {  8,  7,  4,  3,  0, 11,  9, 11,  0, 11,  9, 10 },
+/*  30:    1, 2, 3, 4,           */  {  0,  3,  8, 11,  4,  7,  4, 11,  9, 10,  9, 11 },
+/*  86:    1, 2,    4,    6,     */  {  4,  5,  9,  7,  8,  6,  0,  6,  8,  6,  0,  2 },
+/* 166:    1, 2,       5,    7,  */  { 10,  5,  6,  4, 11,  7, 11,  4,  2,  0,  2,  4 },
+/*  58:    1,    3, 4, 5,        */  {  8,  0,  3,  1, 11,  2, 11,  1,  7,  5,  7,  1 },
+/* 154:    1,    3, 4,       7,  */  {  0,  3,  8,  1,  9,  2,  4,  2,  9,  2,  4,  6 },
+/* 106:    1,    3,    5, 6,     */  {  2,  1, 10,  3, 11,  0,  6,  0, 11,  0,  6,  4 },
+/* 202:    1,    3,       6, 7,  */  { 10,  2,  1,  3,  9,  0,  9,  3,  5,  7,  5,  3 },
+/* 210:    1,       4,    6, 7,  */  {  9,  4,  5,  0,  1,  8, 10,  8,  1,  8, 10, 11 },
+/*  92:       2, 3, 4,    6,     */  { 11,  6,  7,  5,  8,  4,  8,  5,  3,  1,  3,  5 },
+/* 172:       2, 3,    5,    7,  */  {  5,  6, 10,  4,  9,  7,  1,  7,  9,  7,  1,  3 },
+/* 180:       2,    4, 5,    7,  */  { 10,  5,  6,  1,  2,  9, 11,  9,  2,  9, 11,  8 },
+/* 120:          3, 4, 5, 6,     */  { 11,  6,  7,  2,  3, 10,  8, 10,  3, 10,  8,  9 }
+};
+
+//_____________________________________________________________________________
+/**
+ * \brief tiling table for case 12.1.2
+ * For each of the case above, the specific triangulation of the edge
+ * intersection points is given.
+ * When a case is ambiguous, there is an auxiliary table that contains
+ * the face number to test and the tiling table contains the specific
+ * triangulations depending on the results
+ * A minus sign means to invert the result of the test.
+ */
+//-----------------------------------------------------------------------------
+static const char tiling12_1_2[24][24] = {
+/* 135: 0, 1, 2,             7,  */  {  7,  3, 11,  3,  7,  8,  9,  8,  7,  6,  9,  7,  9,  6, 10,  2, 10,  6, 11,  2,  6,  2, 11,  3 },
+/*  75: 0, 1,    3,       6,     */  {  6,  2, 10,  2,  6, 11,  8, 11,  6,  5,  8,  6,  8,  5,  9,  1,  9,  5, 10,  1,  5,  1, 10,  2 },
+/*  83: 0, 1,       4,    6,     */  { 10,  9,  5,  9, 10,  1,  3,  1, 10,  6,  3, 10,  3,  6,  7,  4,  7,  6,  5,  4,  6,  4,  5,  9 },
+/* 163: 0, 1,          5,    7,  */  {  7,  8, 11,  3, 11,  8, 11,  3,  1, 11,  1,  6,  5,  6,  1,  6,  5,  4,  6,  4,  7,  8,  7,  4 },
+/*  45: 0,    2, 3,    5,        */  {  5,  1,  9,  1,  5, 10, 11, 10,  5,  4, 11,  5, 11,  4,  8,  0,  8,  4,  9,  0,  4,  0,  9,  1 },
+/*  53: 0,    2,    4, 5,        */  {  1,  9, 10,  5, 10,  9, 10,  5,  7, 10,  7,  2,  3,  2,  7,  2,  3,  0,  2,  0,  1,  9,  1,  0 },
+/* 149: 0,    2,    4,       7,  */  { 10, 11,  2, 11, 10,  6,  4,  6, 10,  1,  4, 10,  4,  1,  0,  3,  0,  1,  2,  3,  1,  3,  2, 11 },
+/* 101: 0,    2,       5, 6,     */  {  8,  9,  0,  9,  8,  4,  6,  4,  8,  3,  6,  8,  6,  3,  2,  1,  2,  3,  0,  1,  3,  1,  0,  9 },
+/* 197: 0,    2,          6, 7,  */  {  3, 11,  8,  7,  8, 11,  8,  7,  5,  8,  5,  0,  1,  0,  5,  0,  1,  2,  0,  2,  3, 11,  3,  2 },
+/*  89: 0,       3, 4,    6,     */  {  6, 11, 10,  2, 10, 11, 10,  2,  0, 10,  0,  5,  4,  5,  0,  5,  4,  7,  5,  7,  6, 11,  6,  7 },
+/* 169: 0,       3,    5,    7,  */  {  9,  8,  4,  8,  9,  0,  2,  0,  9,  5,  2,  9,  2,  5,  6,  7,  6,  5,  4,  7,  5,  7,  4,  8 },
+/* 225: 0,             5, 6, 7,  */  {  8,  4,  0,  9,  0,  4,  0,  9, 10,  0, 10,  3, 11,  3, 10,  3, 11,  7,  3,  7,  8,  4,  8,  7 },
+/*  30:    1, 2, 3, 4,           */  {  4,  0,  8,  0,  4,  9, 10,  9,  4,  7, 10,  4, 10,  7, 11,  3, 11,  7,  8,  3,  7,  3,  8,  0 },
+/*  86:    1, 2,    4,    6,     */  {  4,  9,  8,  0,  8,  9,  8,  0,  2,  8,  2,  7,  6,  7,  2,  7,  6,  5,  7,  5,  4,  9,  4,  5 },
+/* 166:    1, 2,       5,    7,  */  { 11, 10,  6, 10, 11,  2,  0,  2, 11,  7,  0, 11,  0,  7,  4,  5,  4,  7,  6,  5,  7,  5,  6, 10 },
+/*  58:    1,    3, 4, 5,        */  { 11,  8,  3,  8, 11,  7,  5,  7, 11,  2,  5, 11,  5,  2,  1,  0,  1,  2,  3,  0,  2,  0,  3,  8 },
+/* 154:    1,    3, 4,       7,  */  {  0,  8,  9,  4,  9,  8,  9,  4,  6,  9,  6,  1,  2,  1,  6,  1,  2,  3,  1,  3,  0,  8,  0,  3 },
+/* 106:    1,    3,    5, 6,     */  {  2, 10, 11,  6, 11, 10, 11,  6,  4, 11,  4,  3,  0,  3,  4,  3,  0,  1,  3,  1,  2, 10,  2,  1 },
+/* 202:    1,    3,       6, 7,  */  {  9, 10,  1, 10,  9,  5,  7,  5,  9,  0,  7,  9,  7,  0,  3,  2,  3,  0,  1,  2,  0,  2,  1, 10 },
+/* 210:    1,       4,    6, 7,  */  {  9,  5,  1, 10,  1,  5,  1, 10, 11,  1, 11,  0,  8,  0, 11,  0,  8,  4,  0,  4,  9,  5,  9,  4 },
+/*  92:       2, 3, 4,    6,     */  {  8, 11,  7, 11,  8,  3,  1,  3,  8,  4,  1,  8,  1,  4,  5,  6,  5,  4,  7,  6,  4,  6,  7, 11 },
+/* 172:       2, 3,    5,    7,  */  {  5, 10,  9,  1,  9, 10,  9,  1,  3,  9,  3,  4,  7,  4,  3,  4,  7,  6,  4,  6,  5, 10,  5,  6 },
+/* 180:       2,    4, 5,    7,  */  { 10,  6,  2, 11,  2,  6,  2, 11,  8,  2,  8,  1,  9,  1,  8,  1,  9,  5,  1,  5, 10,  6, 10,  5 },
+/* 120:          3, 4, 5, 6,     */  { 11,  7,  3,  8,  3,  7,  3,  8,  9,  3,  9,  2, 10,  2,  9,  2, 10,  6,  2,  6, 11,  7, 11,  6 }
+};
+
+//_____________________________________________________________________________
+/**
+ * \brief tiling table for case 12.2
+ * For each of the case above, the specific triangulation of the edge
+ * intersection points is given.
+ * When a case is ambiguous, there is an auxiliary table that contains
+ * the face number to test and the tiling table contains the specific
+ * triangulations depending on the results
+ * A minus sign means to invert the result of the test.
+ */
+//-----------------------------------------------------------------------------
+static const char tiling12_2[24][24] = {
+/* 135: 0, 1, 2,             7,  */  {   9,  8, 12, 10,  9, 12,  2, 10, 12,  3,  2, 12, 11,  3, 12,  6, 11, 12,  7,  6, 12,  8,  7, 12 },
+/*  75: 0, 1,    3,       6,     */  {   8, 11, 12,  9,  8, 12,  1,  9, 12,  2,  1, 12, 10,  2, 12,  5, 10, 12,  6,  5, 12, 11,  6, 12 },
+/*  83: 0, 1,       4,    6,     */  {   3,  1, 12,  7,  3, 12,  4,  7, 12,  9,  4, 12,  5,  9, 12,  6,  5, 12, 10,  6, 12,  1, 10, 12 },
+/* 163: 0, 1,          5,    7,  */  {  12,  3,  1, 12,  1,  5, 12,  5,  6, 12,  6, 11, 12, 11,  7, 12,  7,  4, 12,  4,  8, 12,  8,  3 },
+/*  45: 0,    2, 3,    5,        */  {  11, 10, 12,  8, 11, 12,  0,  8, 12,  1,  0, 12,  9,  1, 12,  4,  9, 12,  5,  4, 12, 10,  5, 12 },
+/*  53: 0,    2,    4, 5,        */  {  12,  5,  7, 12,  7,  3, 12,  3,  2, 12,  2, 10, 12, 10,  1, 12,  1,  0, 12,  0,  9, 12,  9,  5 },
+/* 149: 0,    2,    4,       7,  */  {   4,  6, 12,  0,  4, 12,  1,  0, 12, 10,  1, 12,  2, 10, 12,  3,  2, 12, 11,  3, 12,  6, 11, 12 },
+/* 101: 0,    2,       5, 6,     */  {   6,  4, 12,  2,  6, 12,  3,  2, 12,  8,  3, 12,  0,  8, 12,  1,  0, 12,  9,  1, 12,  4,  9, 12 },
+/* 197: 0,    2,          6, 7,  */  {  12,  7,  5, 12,  5,  1, 12,  1,  0, 12,  0,  8, 12,  8,  3, 12,  3,  2, 12,  2, 11, 12, 11,  7 },
+/*  89: 0,       3, 4,    6,     */  {  12,  2,  0, 12,  0,  4, 12,  4,  5, 12,  5, 10, 12, 10,  6, 12,  6,  7, 12,  7, 11, 12, 11,  2 },
+/* 169: 0,       3,    5,    7,  */  {   2,  0, 12,  6,  2, 12,  7,  6, 12,  8,  7, 12,  4,  8, 12,  5,  4, 12,  9,  5, 12,  0,  9, 12 },
+/* 225: 0,             5, 6, 7,  */  {  12,  9, 10, 12, 10, 11, 12, 11,  7, 12,  7,  4, 12,  4,  8, 12,  8,  3, 12,  3,  0, 12,  0,  9 },
+/*  30:    1, 2, 3, 4,           */  {  10,  9, 12, 11, 10, 12,  7, 11, 12,  4,  7, 12,  8,  4, 12,  3,  8, 12,  0,  3, 12,  9,  0, 12 },
+/*  86:    1, 2,    4,    6,     */  {  12,  0,  2, 12,  2,  6, 12,  6,  7, 12,  7,  8, 12,  8,  4, 12,  4,  5, 12,  5,  9, 12,  9,  0 },
+/* 166:    1, 2,       5,    7,  */  {   0,  2, 12,  4,  0, 12,  5,  4, 12, 10,  5, 12,  6, 10, 12,  7,  6, 12, 11,  7, 12,  2, 11, 12 },
+/*  58:    1,    3, 4, 5,        */  {   5,  7, 12,  1,  5, 12,  0,  1, 12,  8,  0, 12,  3,  8, 12,  2,  3, 12, 11,  2, 12,  7, 11, 12 },
+/* 154:    1,    3, 4,       7,  */  {  12,  4,  6, 12,  6,  2, 12,  2,  3, 12,  3,  8, 12,  8,  0, 12,  0,  1, 12,  1,  9, 12,  9,  4 },
+/* 106:    1,    3,    5, 6,     */  {  12,  6,  4, 12,  4,  0, 12,  0,  1, 12,  1, 10, 12, 10,  2, 12,  2,  3, 12,  3, 11, 12, 11,  6 },
+/* 202:    1,    3,       6, 7,  */  {   7,  5, 12,  3,  7, 12,  2,  3, 12, 10,  2, 12,  1, 10, 12,  0,  1, 12,  9,  0, 12,  5,  9, 12 },
+/* 210:    1,       4,    6, 7,  */  {  12, 10, 11, 12, 11,  8, 12,  8,  0, 12,  0,  1, 12,  1,  9, 12,  9,  4, 12,  4,  5, 12,  5, 10 },
+/*  92:       2, 3, 4,    6,     */  {   1,  3, 12,  5,  1, 12,  6,  5, 12, 11,  6, 12,  7, 11, 12,  4,  7, 12,  8,  4, 12,  3,  8, 12 },
+/* 172:       2, 3,    5,    7,  */  {  12,  1,  3, 12,  3,  7, 12,  7,  4, 12,  4,  9, 12,  9,  5, 12,  5,  6, 12,  6, 10, 12, 10,  1 },
+/* 180:       2,    4, 5,    7,  */  {  12, 11,  8, 12,  8,  9, 12,  9,  1, 12,  1,  2, 12,  2, 10, 12, 10,  5, 12,  5,  6, 12,  6, 11 },
+/* 120:          3, 4, 5, 6,     */  {  12,  8,  9, 12,  9, 10, 12, 10,  2, 12,  2,  3, 12,  3, 11, 12, 11,  6, 12,  6,  7, 12,  7,  8 }
+};
+
+//_____________________________________________________________________________
+/**
+ * \brief tiling table for case 12.2 inverted
+ * For each of the case above, the specific triangulation of the edge
+ * intersection points is given.
+ * When a case is ambiguous, there is an auxiliary table that contains
+ * the face number to test and the tiling table contains the specific
+ * triangulations depending on the results
+ * A minus sign means to invert the result of the test.
+ */
+//-----------------------------------------------------------------------------
+static const char tiling12_2_[24][24] = {
+/* 135: 0, 1, 2,             7,  */  { 12,  2, 11, 12, 11,  7, 12,  7,  6, 12,  6, 10, 12, 10,  9, 12,  9,  8, 12,  8,  3, 12,  3,  2 },
+/*  75: 0, 1,    3,       6,     */  { 12,  1, 10, 12, 10,  6, 12,  6,  5, 12,  5,  9, 12,  9,  8, 12,  8, 11, 12, 11,  2, 12,  2,  1 },
+/*  83: 0, 1,       4,    6,     */  { 12,  4,  5, 12,  5, 10, 12, 10,  6, 12,  6,  7, 12,  7,  3, 12,  3,  1, 12,  1,  9, 12,  9,  4 },
+/* 163: 0, 1,          5,    7,  */  {  7,  6, 12,  8,  7, 12,  4,  8, 12,  5,  4, 12,  1,  5, 12,  3,  1, 12, 11,  3, 12,  6, 11, 12 },
+/*  45: 0,    2, 3,    5,        */  { 12,  0,  9, 12,  9,  5, 12,  5,  4, 12,  4,  8, 12,  8, 11, 12, 11, 10, 12, 10,  1, 12,  1,  0 },
+/*  53: 0,    2,    4, 5,        */  {  1,  2, 12,  9,  1, 12,  0,  9, 12,  3,  0, 12,  7,  3, 12,  5,  7, 12, 10,  5, 12,  2, 10, 12 },
+/* 149: 0,    2,    4,       7,  */  { 12,  1,  2, 12,  2, 11, 12, 11,  3, 12,  3,  0, 12,  0,  4, 12,  4,  6, 12,  6, 10, 12, 10,  1 },
+/* 101: 0,    2,       5, 6,     */  { 12,  3,  0, 12,  0,  9, 12,  9,  1, 12,  1,  2, 12,  2,  6, 12,  6,  4, 12,  4,  8, 12,  8,  3 },
+/* 197: 0,    2,          6, 7,  */  {  3,  0, 12, 11,  3, 12,  2, 11, 12,  1,  2, 12,  5,  1, 12,  7,  5, 12,  8,  7, 12,  0,  8, 12 },
+/*  89: 0,       3, 4,    6,     */  {  6,  5, 12, 11,  6, 12,  7, 11, 12,  4,  7, 12,  0,  4, 12,  2,  0, 12, 10,  2, 12,  5, 10, 12 },
+/* 169: 0,       3,    5,    7,  */  { 12,  7,  4, 12,  4,  9, 12,  9,  5, 12,  5,  6, 12,  6,  2, 12,  2,  0, 12,  0,  8, 12,  8,  7 },
+/* 225: 0,             5, 6, 7,  */  {  8,  7, 12,  0,  8, 12,  3,  0, 12, 11,  3, 12, 10, 11, 12,  9, 10, 12,  4,  9, 12,  7,  4, 12 },
+/*  30:    1, 2, 3, 4,           */  { 12,  7,  8, 12,  8,  0, 12,  0,  3, 12,  3, 11, 12, 11, 10, 12, 10,  9, 12,  9,  4, 12,  4,  7 },
+/*  86:    1, 2,    4,    6,     */  {  4,  7, 12,  9,  4, 12,  5,  9, 12,  6,  5, 12,  2,  6, 12,  0,  2, 12,  8,  0, 12,  7,  8, 12 },
+/* 166:    1, 2,       5,    7,  */  { 12,  5,  6, 12,  6, 11, 12, 11,  7, 12,  7,  4, 12,  4,  0, 12,  0,  2, 12,  2, 10, 12, 10,  5 },
+/*  58:    1,    3, 4, 5,        */  { 12,  0,  3, 12,  3, 11, 12, 11,  2, 12,  2,  1, 12,  1,  5, 12,  5,  7, 12,  7,  8, 12,  8,  0 },
+/* 154:    1,    3, 4,       7,  */  {  0,  3, 12,  9,  0, 12,  1,  9, 12,  2,  1, 12,  6,  2, 12,  4,  6, 12,  8,  4, 12,  3,  8, 12 },
+/* 106:    1,    3,    5, 6,     */  {  2,  1, 12, 11,  2, 12,  3, 11, 12,  0,  3, 12,  4,  0, 12,  6,  4, 12, 10,  6, 12,  1, 10, 12 },
+/* 202:    1,    3,       6, 7,  */  { 12,  2,  1, 12,  1,  9, 12,  9,  0, 12,  0,  3, 12,  3,  7, 12,  7,  5, 12,  5, 10, 12, 10,  2 },
+/* 210:    1,       4,    6, 7,  */  {  9,  0, 12,  5,  9, 12,  4,  5, 12,  8,  4, 12, 11,  8, 12, 10, 11, 12,  1, 10, 12,  0,  1, 12 },
+/*  92:       2, 3, 4,    6,     */  { 12,  6,  7, 12,  7,  8, 12,  8,  4, 12,  4,  5, 12,  5,  1, 12,  1,  3, 12,  3, 11, 12, 11,  6 },
+/* 172:       2, 3,    5,    7,  */  {  5,  4, 12, 10,  5, 12,  6, 10, 12,  7,  6, 12,  3,  7, 12,  1,  3, 12,  9,  1, 12,  4,  9, 12 },
+/* 180:       2,    4, 5,    7,  */  { 10,  1, 12,  6, 10, 12,  5,  6, 12,  9,  5, 12,  8,  9, 12, 11,  8, 12,  2, 11, 12,  1,  2, 12 },
+/* 120:          3, 4, 5, 6,     */  { 11,  2, 12,  7, 11, 12,  6,  7, 12, 10,  6, 12,  9, 10, 12,  8,  9, 12,  3,  8, 12,  2,  3, 12 }
+};
+//_____________________________________________________________________________
+
+
+
+//_____________________________________________________________________________
+/**
+ * \brief test table for case 13
+ * All faces are to be tested
+ *
+ * For each of the case above, the specific triangulation of the edge
+ * intersection points is given.
+ * When a case is ambiguous, there is an auxiliary table that contains
+ * the face number to test and the tiling table contains the specific
+ * triangulations depending on the results
+ * A minus sign means to invert the result of the test.
+ */
+//-----------------------------------------------------------------------------
+/* 13: face test */
+static const char test13[2][7] = {
+/* 165: 0,    2,       5,    7,  */  { 1,2,3,4,5,6,7 },
+/*  90:    1,    3, 4,    6,     */  { 2,3,4,1,5,6,7 },
+};
+
+
+
+//_____________________________________________________________________________
+/**
+ * \brief subconfiguration table for case 13
+ * Hard-coded tests for the subconfiguration determination
+ *
+ * For each of the case above, the specific triangulation of the edge
+ * intersection points is given.
+ * When a case is ambiguous, there is an auxiliary table that contains
+ * the face number to test and the tiling table contains the specific
+ * triangulations depending on the results
+ * A minus sign means to invert the result of the test.
+ */
+//-----------------------------------------------------------------------------
+/* 13: sub configs */
+static const char subconfig13[64] = {
+/*  0: 0,0,0,0,0,0 */   0,
+/*  1: 1,0,0,0,0,0 */   1,
+/*  2: 0,1,0,0,0,0 */   2,
+/*  3: 1,1,0,0,0,0 */   7,
+/*  4: 0,0,1,0,0,0 */   3,
+/*  5: 1,0,1,0,0,0 */  -1,
+/*  6: 0,1,1,0,0,0 */  11,
+/*  7: 1,1,1,0,0,0 */  -1,
+/*  8: 0,0,0,1,0,0 */   4,
+/*  9: 1,0,0,1,0,0 */   8,
+/* 10: 0,1,0,1,0,0 */  -1,
+/* 11: 1,1,0,1,0,0 */  -1,
+/* 12: 0,0,1,1,0,0 */  14,
+/* 13: 1,0,1,1,0,0 */  -1,
+/* 14: 0,1,1,1,0,0 */  -1,
+/* 15: 1,1,1,1,0,0 */  -1,
+/* 16: 0,0,0,0,1,0 */   5,
+/* 17: 1,0,0,0,1,0 */   9,
+/* 18: 0,1,0,0,1,0 */  12,
+/* 19: 1,1,0,0,1,0 */  23,
+/* 20: 0,0,1,0,1,0 */  15,
+/* 21: 1,0,1,0,1,0 */  -1,
+/* 22: 0,1,1,0,1,0 */  21,
+/* 23: 1,1,1,0,1,0 */  38,
+/* 24: 0,0,0,1,1,0 */  17,
+/* 25: 1,0,0,1,1,0 */  20,
+/* 26: 0,1,0,1,1,0 */  -1,
+/* 27: 1,1,0,1,1,0 */  36,
+/* 28: 0,0,1,1,1,0 */  26,
+/* 29: 1,0,1,1,1,0 */  33,
+/* 30: 0,1,1,1,1,0 */  30,
+/* 31: 1,1,1,1,1,0 */  44,
+/* 32: 0,0,0,0,0,1 */   6,
+/* 33: 1,0,0,0,0,1 */  10,
+/* 34: 0,1,0,0,0,1 */  13,
+/* 35: 1,1,0,0,0,1 */  19,
+/* 36: 0,0,1,0,0,1 */  16,
+/* 37: 1,0,1,0,0,1 */  -1,
+/* 38: 0,1,1,0,0,1 */  25,
+/* 39: 1,1,1,0,0,1 */  37,
+/* 40: 0,0,0,1,0,1 */  18,
+/* 41: 1,0,0,1,0,1 */  24,
+/* 42: 0,1,0,1,0,1 */  -1,
+/* 43: 1,1,0,1,0,1 */  35,
+/* 44: 0,0,1,1,0,1 */  22,
+/* 45: 1,0,1,1,0,1 */  32,
+/* 46: 0,1,1,1,0,1 */  29,
+/* 47: 1,1,1,1,0,1 */  43,
+/* 48: 0,0,0,0,1,1 */  -1,
+/* 49: 1,0,0,0,1,1 */  -1,
+/* 50: 0,1,0,0,1,1 */  -1,
+/* 51: 1,1,0,0,1,1 */  34,
+/* 52: 0,0,1,0,1,1 */  -1,
+/* 53: 1,0,1,0,1,1 */  -1,
+/* 54: 0,1,1,0,1,1 */  28,
+/* 55: 1,1,1,0,1,1 */  42,
+/* 56: 0,0,0,1,1,1 */  -1,
+/* 57: 1,0,0,1,1,1 */  31,
+/* 58: 0,1,0,1,1,1 */  -1,
+/* 59: 1,1,0,1,1,1 */  41,
+/* 60: 0,0,1,1,1,1 */  27,
+/* 61: 1,0,1,1,1,1 */  40,
+/* 62: 0,1,1,1,1,1 */  39,
+/* 63: 1,1,1,1,1,1 */  45,
+};
+
+
+//_____________________________________________________________________________
+/**
+ * \brief tiling table for case 13.1
+ * For each of the case above, the specific triangulation of the edge
+ * intersection points is given.
+ * When a case is ambiguous, there is an auxiliary table that contains
+ * the face number to test and the tiling table contains the specific
+ * triangulations depending on the results
+ * A minus sign means to invert the result of the test.
+ */
+//-----------------------------------------------------------------------------
+/* 13.1 */
+static const char tiling13_1[2][12] = {
+/* 165: 0,    2,       5,    7,  */  { 11,  7,  6,  1,  2, 10,  8,  3,  0,  9,  5, 4 },
+/*  90:    1,    3, 4,    6,     */  {  8,  4,  7,  2,  3, 11,  9,  0,  1, 10,  6, 5 }
+};
+
+//_____________________________________________________________________________
+/**
+ * \brief tiling table for case 13.1 inverted
+ * For each of the case above, the specific triangulation of the edge
+ * intersection points is given.
+ * When a case is ambiguous, there is an auxiliary table that contains
+ * the face number to test and the tiling table contains the specific
+ * triangulations depending on the results
+ * A minus sign means to invert the result of the test.
+ */
+//-----------------------------------------------------------------------------
+/* 13.1 */
+static const char tiling13_1_[2][12] = {
+/* 165: 0,    2,       5,    7,  */  { 7,  4,  8, 11,  3,  2,  1,  0,  9,  5,  6, 10 },
+/*  90:    1,    3, 4,    6,     */  { 6,  7, 11, 10,  2,  1,  0,  3,  8,  4,  5,  9 }
+};
+
+//_____________________________________________________________________________
+/**
+ * \brief tiling table for case 13.2
+ * For each of the case above, the specific triangulation of the edge
+ * intersection points is given.
+ * When a case is ambiguous, there is an auxiliary table that contains
+ * the face number to test and the tiling table contains the specific
+ * triangulations depending on the results
+ * A minus sign means to invert the result of the test.
+ */
+//-----------------------------------------------------------------------------
+/* 13.2 */
+static const char tiling13_2[2][6][18] = {
+/* 165: 0,    2,       5,    7,  */  {
+ /* 1 */ { 1,  2, 10, 11,  7,  6,  3,  4,  8,  4,  3,  5,  0,  5,  3,  5,  0,  9 },
+ /* 2 */ { 8,  3,  0, 11,  7,  6,  9,  1,  4,  2,  4,  1,  4,  2,  5, 10,  5,  2 },
+ /* 3 */ { 9,  5,  4,  8,  3,  0,  1,  6, 10,  6,  1,  7,  2,  7,  1,  7,  2, 11 },
+ /* 4 */ { 9,  5,  4,  1,  2, 10, 11,  3,  6,  0,  6,  3,  6,  0,  7,  8,  7,  0 },
+ /* 5 */ { 9,  5,  4, 11,  7,  6,  0, 10,  1, 10,  0,  8, 10,  8,  2,  3,  2,  8 },
+ /* 6 */ { 1,  2, 10,  3,  0,  8,  4,  9,  7, 11,  7,  9,  5, 11,  9, 11,  5,  6 }
+},
+/*  90:    1,    3, 4,    6,     */  {
+ /* 1 */ { 2,  3, 11,  8,  4,  7,  0,  5,  9,  5,  0,  6,  1,  6,  0,  6,  1, 10 },
+ /* 2 */ { 9,  0,  1,  8,  4,  7, 10,  2,  5,  3,  5,  2,  5,  3,  6, 11,  6,  3 },
+ /* 3 */ { 6,  5, 10,  9,  0,  1,  2,  7, 11,  7,  2,  4,  3,  4,  2,  4,  3,  8 },
+ /* 4 */ { 6,  5, 10,  2,  3, 11,  8,  0,  7,  1,  7,  0,  7,  1,  4,  9,  4,  1 },
+ /* 5 */ { 6,  5, 10,  8,  4,  7,  1, 11,  2, 11,  1,  9, 11,  9,  3,  0,  3,  9 },
+ /* 6 */ { 2,  3, 11,  0,  1,  9,  5, 10,  4,  8,  4, 10,  6,  8, 10,  8,  6,  7 }
+} };
+
+//_____________________________________________________________________________
+/**
+ * \brief tiling table for case 13.2 inverted
+ * For each of the case above, the specific triangulation of the edge
+ * intersection points is given.
+ * When a case is ambiguous, there is an auxiliary table that contains
+ * the face number to test and the tiling table contains the specific
+ * triangulations depending on the results
+ * A minus sign means to invert the result of the test.
+ */
+//-----------------------------------------------------------------------------
+/* 13.2 */
+static const char tiling13_2_[2][6][18] = {
+/* 165: 0,    2,       5,    7,  */  {
+ /* 1 */ { 10,  5,  6, 11,  3,  2,  7,  0,  8,  0,  7,  1,  4,  1,  7,  1,  4,  9 },
+ /* 2 */ { 11,  3,  2,  7,  4,  8,  9,  5,  0,  6,  0,  5,  0,  6,  1, 10,  1,  6 },
+ /* 3 */ {  1,  0,  9,  7,  4,  8,  5,  2, 10,  2,  5,  3,  6,  3,  5,  3,  6, 11 },
+ /* 4 */ { 10,  5,  6,  1,  0,  9, 11,  7,  2,  4,  2,  7,  2,  4,  3,  8,  3,  4 },
+ /* 5 */ { 10,  5,  6,  7,  4,  8,  2, 11,  1,  9,  1, 11,  3,  9, 11,  9,  3,  0 },
+ /* 6 */ { 11,  3,  2,  9,  1,  0,  4, 10,  5, 10,  4,  8, 10,  8,  6,  7,  6,  8 }
+},
+/*  90:    1,    3, 4,    6,     */  {
+ /* 1 */ {  6,  7, 11,  8,  0,  3,  4,  1,  9,  1,  4,  2,  5,  2,  4,  2,  5, 10 },
+ /* 2 */ {  8,  0,  3,  4,  5,  9, 10,  6,  1,  7,  1,  6,  1,  7,  2, 11,  2,  7 },
+ /* 3 */ {  2,  1, 10,  4,  5,  9,  6,  3, 11,  3,  6,  0,  7,  0,  6,  0,  7,  8 },
+ /* 4 */ {  6,  7, 11,  2,  1, 10,  8,  4,  3,  5,  3,  4,  3,  5,  0,  9,  0,  5 },
+ /* 5 */ {  6,  7, 11,  4,  5,  9,  3,  8,  2, 10,  2,  8,  0, 10,  8, 10,  0,  1 },
+ /* 6 */ {  8,  0,  3, 10,  2,  1,  5, 11,  6, 11,  5,  9, 11,  9,  7,  4,  7,  9 }
+} };
+
+//_____________________________________________________________________________
+/**
+ * \brief tiling table for case 13.3
+ * For each of the case above, the specific triangulation of the edge
+ * intersection points is given.
+ * When a case is ambiguous, there is an auxiliary table that contains
+ * the face number to test and the tiling table contains the specific
+ * triangulations depending on the results
+ * A minus sign means to invert the result of the test.
+ */
+//-----------------------------------------------------------------------------
+/* 13.3 */
+static const char tiling13_3[2][12][30] = {
+/* 165: 0,    2,       5,    7,  */  {
+ /* 1,2 */ { 11,  7,  6, 12,  2, 10, 12, 10,  5, 12,  5,  4, 12,  4,  8, 12,  8,  3, 12,  3,  0, 12,  0,  9, 12,  9,  1, 12,  1,  2 },
+ /* 1,4 */ {  1,  2, 10,  9,  5, 12,  0,  9, 12,  3,  0, 12, 11,  3, 12,  6, 11, 12,  7,  6, 12,  8,  7, 12,  4,  8, 12,  5,  4, 12 },
+ /* 1,5 */ { 11,  7,  6, 12,  5,  4, 12,  4,  8, 12,  8,  3, 12,  3,  2, 12,  2, 10, 12, 10,  1, 12,  1,  0, 12,  0,  9, 12,  9,  5 },
+ /* 1,6 */ {  1,  2, 10, 12,  3,  0, 12,  0,  9, 12,  9,  5, 12,  5,  6, 12,  6, 11, 12, 11,  7, 12,  7,  4, 12,  4,  8, 12,  8,  3 },
+ /* 2,3 */ {  8,  3,  0, 11,  7, 12,  2, 11, 12,  1,  2, 12,  9,  1, 12,  4,  9, 12,  5,  4, 12, 10,  5, 12,  6, 10, 12,  7,  6, 12 },
+ /* 2,5 */ { 11,  7,  6,  5,  4, 12, 10,  5, 12,  2, 10, 12,  3,  2, 12,  8,  3, 12,  0,  8, 12,  1,  0, 12,  9,  1, 12,  4,  9, 12 },
+ /* 2,6 */ {  8,  3,  0,  1,  2, 12,  9,  1, 12,  4,  9, 12,  7,  4, 12, 11,  7, 12,  6, 11, 12,  5,  6, 12, 10,  5, 12,  2, 10, 12 },
+ /* 3,4 */ {  9,  5,  4, 12,  0,  8, 12,  8,  7, 12,  7,  6, 12,  6, 10, 12, 10,  1, 12,  1,  2, 12,  2, 11, 12, 11,  3, 12,  3,  0 },
+ /* 3,5 */ {  9,  5,  4, 12,  7,  6, 12,  6, 10, 12, 10,  1, 12,  1,  0, 12,  0,  8, 12,  8,  3, 12,  3,  2, 12,  2, 11, 12, 11,  7 },
+ /* 3,6 */ {  8,  3,  0, 12,  1,  2, 12,  2, 11, 12, 11,  7, 12,  7,  4, 12,  4,  9, 12,  9,  5, 12,  5,  6, 12,  6, 10, 12, 10,  1 },
+ /* 4,5 */ {  9,  5,  4,  7,  6, 12,  8,  7, 12,  0,  8, 12,  1,  0, 12, 10,  1, 12,  2, 10, 12,  3,  2, 12, 11,  3, 12,  6, 11, 12 },
+ /* 4,6 */ {  1,  2, 10,  3,  0, 12, 11,  3, 12,  6, 11, 12,  5,  6, 12,  9,  5, 12,  4,  9, 12,  7,  4, 12,  8,  7, 12,  0,  8, 12 }
+},
+/*  90:    1,    3, 4,    6,     */  {
+ /* 1,2 */ {  8,  4,  7, 12,  3, 11, 12, 11,  6, 12,  6,  5, 12,  5,  9, 12,  9,  0, 12,  0,  1, 12,  1, 10, 12, 10,  2, 12,  2,  3 },
+ /* 1,4 */ {  2,  3, 11, 10,  6, 12,  1, 10, 12,  0,  1, 12,  8,  0, 12,  7,  8, 12,  4,  7, 12,  9,  4, 12,  5,  9, 12,  6,  5, 12 },
+ /* 1,5 */ {  8,  4,  7, 12,  6,  5, 12,  5,  9, 12,  9,  0, 12,  0,  3, 12,  3, 11, 12, 11,  2, 12,  2,  1, 12,  1, 10, 12, 10,  6 },
+ /* 1,6 */ {  2,  3, 11, 12,  0,  1, 12,  1, 10, 12, 10,  6, 12,  6,  7, 12,  7,  8, 12,  8,  4, 12,  4,  5, 12,  5,  9, 12,  9,  0 },
+ /* 2,3 */ {  0,  1,  9,  8,  4, 12,  3,  8, 12,  2,  3, 12, 10,  2, 12,  5, 10, 12,  6,  5, 12, 11,  6, 12,  7, 11, 12,  4,  7, 12 },
+ /* 2,5 */ {  8,  4,  7,  6,  5, 12, 11,  6, 12,  3, 11, 12,  0,  3, 12,  9,  0, 12,  1,  9, 12,  2,  1, 12, 10,  2, 12,  5, 10, 12 },
+ /* 2,6 */ {  9,  0,  1,  2,  3, 12, 10,  2, 12,  5, 10, 12,  4,  5, 12,  8,  4, 12,  7,  8, 12,  6,  7, 12, 11,  6, 12,  3, 11, 12 },
+ /* 3,4 */ {  6,  5, 10, 12,  1,  9, 12,  9,  4, 12,  4,  7, 12,  7, 11, 12, 11,  2, 12,  2,  3, 12,  3,  8, 12,  8,  0, 12,  0,  1 },
+ /* 3,5 */ {  6,  5, 10, 12,  4,  7, 12,  7, 11, 12, 11,  2, 12,  2,  1, 12,  1,  9, 12,  9,  0, 12,  0,  3, 12,  3,  8, 12,  8,  4 },
+ /* 3,6 */ {  9,  0,  1, 12,  2,  3, 12,  3,  8, 12,  8,  4, 12,  4,  5, 12,  5, 10, 12, 10,  6, 12,  6,  7, 12,  7, 11, 12, 11,  2 },
+ /* 4,5 */ {  6,  5, 10,  4,  7, 12,  9,  4, 12,  1,  9, 12,  2,  1, 12, 11,  2, 12,  3, 11, 12,  0,  3, 12,  8,  0, 12,  7,  8, 12 },
+ /* 4,6 */ {  2,  3, 11,  0,  1, 12,  8,  0, 12,  7,  8, 12,  6,  7, 12, 10,  6, 12,  5, 10, 12,  4,  5, 12,  9,  4, 12,  1,  9, 12 }
+} };
+
+//_____________________________________________________________________________
+/**
+ * \brief tiling table for case 13.3, inverted
+ * For each of the case above, the specific triangulation of the edge
+ * intersection points is given.
+ * When a case is ambiguous, there is an auxiliary table that contains
+ * the face number to test and the tiling table contains the specific
+ * triangulations depending on the results
+ * A minus sign means to invert the result of the test.
+ */
+//-----------------------------------------------------------------------------
+/* 13.3 */
+static const char tiling13_3_[2][12][30] = {
+/* 165: 0,    2,       5,    7,  */  {
+ /* 1,2 */ {  3,  2, 11,  8,  7, 12,  0,  8, 12,  1,  0, 12, 10,  1, 12,  6, 10, 12,  5,  6, 12,  9,  5, 12,  4,  9, 12,  7,  4, 12 },
+ /* 1,4 */ {  5,  6, 10, 12,  2, 11, 12, 11,  7, 12,  7,  4, 12,  4,  9, 12,  9,  1, 12,  1,  0, 12,  0,  8, 12,  8,  3, 12,  3,  2 },
+ /* 1,5 */ { 10,  5,  6, 12,  7,  4, 12,  4,  9, 12,  9,  1, 12,  1,  2, 12,  2, 11, 12, 11,  3, 12,  3,  0, 12,  0,  8, 12,  8,  7 },
+ /* 1,6 */ { 11,  3,  2, 12,  1,  0, 12,  0,  8, 12,  8,  7, 12,  7,  6, 12,  6, 10, 12, 10,  5, 12,  5,  4, 12,  4,  9, 12,  9,  1 },
+ /* 2,3 */ {  7,  4,  8, 11,  3, 12,  6, 11, 12,  5,  6, 12,  9,  5, 12,  0,  9, 12,  1,  0, 12, 10,  1, 12,  2, 10, 12,  3,  2, 12 },
+ /* 2,5 */ {  7,  4,  8,  5,  6, 12,  9,  5, 12,  0,  9, 12,  3,  0, 12, 11,  3, 12,  2, 11, 12,  1,  2, 12, 10,  1, 12,  6, 10, 12 },
+ /* 2,6 */ { 11,  3,  2,  1,  0, 12, 10,  1, 12,  6, 10, 12,  7,  6, 12,  8,  7, 12,  4,  8, 12,  5,  4, 12,  9,  5, 12,  0,  9, 12 },
+ /* 3,4 */ {  1,  0,  9, 12,  4,  8, 12,  8,  3, 12,  3,  2, 12,  2, 10, 12, 10,  5, 12,  5,  6, 12,  6, 11, 12, 11,  7, 12,  7,  4 },
+ /* 3,5 */ {  7,  4,  8, 12,  5,  6, 12,  6, 11, 12, 11,  3, 12,  3,  0, 12,  0,  9, 12,  9,  1, 12,  1,  2, 12,  2, 10, 12, 10,  5 },
+ /* 3,6 */ {  1,  0,  9, 12,  3,  2, 12,  2, 10, 12, 10,  5, 12,  5,  4, 12,  4,  8, 12,  8,  7, 12,  7,  6, 12,  6, 11, 12, 11,  3 },
+ /* 4,5 */ { 10,  5,  6,  7,  4, 12, 11,  7, 12,  2, 11, 12,  1,  2, 12,  9,  1, 12,  0,  9, 12,  3,  0, 12,  8,  3, 12,  4,  8, 12 },
+ /* 4,6 */ {  9,  1,  0,  3,  2, 12,  8,  3, 12,  4,  8, 12,  5,  4, 12, 10,  5, 12,  6, 10, 12,  7,  6, 12, 11,  7, 12,  2, 11, 12 }
+},
+/*  90:    1,    3, 4,    6,     */  {
+ /* 1,2 */ {  0,  3,  8,  9,  4, 12,  1,  9, 12,  2,  1, 12, 11,  2, 12,  7, 11, 12,  6,  7, 12, 10,  6, 12,  5, 10, 12,  4,  5, 12 },
+ /* 1,4 */ { 11,  6,  7, 12,  3,  8, 12,  8,  4, 12,  4,  5, 12,  5, 10, 12, 10,  2, 12,  2,  1, 12,  1,  9, 12,  9,  0, 12,  0,  3 },
+ /* 1,5 */ {  6,  7, 11, 12,  4,  5, 12,  5, 10, 12, 10,  2, 12,  2,  3, 12,  3,  8, 12,  8,  0, 12,  0,  1, 12,  1,  9, 12,  9,  4 },
+ /* 1,6 */ {  8,  0,  3, 12,  2,  1, 12,  1,  9, 12,  9,  4, 12,  4,  7, 12,  7, 11, 12, 11,  6, 12,  6,  5, 12,  5, 10, 12, 10,  2 },
+ /* 2,3 */ {  4,  5,  9,  8,  0, 12,  7,  8, 12,  6,  7, 12, 10,  6, 12,  1, 10, 12,  2,  1, 12, 11,  2, 12,  3, 11, 12,  0,  3, 12 },
+ /* 2,5 */ {  4,  5,  9,  6,  7, 12, 10,  6, 12,  1, 10, 12,  0,  1, 12,  8,  0, 12,  3,  8, 12,  2,  3, 12, 11,  2, 12,  7, 11, 12 },
+ /* 2,6 */ {  8,  0,  3,  2,  1, 12, 11,  2, 12,  7, 11, 12,  4,  7, 12,  9,  4, 12,  5,  9, 12,  6,  5, 12, 10,  6, 12,  1, 10, 12 },
+ /* 3,4 */ {  2,  1, 10, 12,  5,  9, 12,  9,  0, 12,  0,  3, 12,  3, 11, 12, 11,  6, 12,  6,  7, 12,  7,  8, 12,  8,  4, 12,  4,  5 },
+ /* 3,5 */ {  4,  5,  9, 12,  6,  7, 12,  7,  8, 12,  8,  0, 12,  0,  1, 12,  1, 10, 12, 10,  2, 12,  2,  3, 12,  3, 11, 12, 11,  6 },
+ /* 3,6 */ {  2,  1, 10, 12,  0,  3, 12,  3, 11, 12, 11,  6, 12,  6,  5, 12,  5,  9, 12,  9,  4, 12,  4,  7, 12,  7,  8, 12,  8,  0 },
+ /* 4,5 */ {  6,  7, 11,  4,  5, 12,  8,  4, 12,  3,  8, 12,  2,  3, 12, 10,  2, 12,  1, 10, 12,  0,  1, 12,  9,  0, 12,  5,  9, 12 },
+ /* 4,6 */ { 10,  2,  1,  0,  3, 12,  9,  0, 12,  5,  9, 12,  6,  5, 12, 11,  6, 12,  7, 11, 12,  4,  7, 12,  8,  4, 12,  3,  8, 12 }
+} };
+
+//_____________________________________________________________________________
+/**
+ * \brief tiling table for case 13.4
+ * For each of the case above, the specific triangulation of the edge
+ * intersection points is given.
+ * When a case is ambiguous, there is an auxiliary table that contains
+ * the face number to test and the tiling table contains the specific
+ * triangulations depending on the results
+ * A minus sign means to invert the result of the test.
+ */
+//-----------------------------------------------------------------------------
+/* 13.4 */
+static const char tiling13_4[2][4][36] = {
+/* 165: 0,    2,       5,    7,  */  {
+/* 1,2,6 */  { 12,  2, 10, 12, 10,  5, 12,  5,  6, 12,  6, 11, 12, 11,  7, 12,  7,  4, 12,  4,  8, 12,  8,  3, 12,  3,  0, 12,  0,  9, 12,  9,  1, 12,  1,  2 },
+/* 1,4,5 */  { 11,  3, 12,  6, 11, 12,  7,  6, 12,  8,  7, 12,  4,  8, 12,  5,  4, 12,  9,  5, 12,  0,  9, 12,  1,  0, 12, 10,  1, 12,  2, 10, 12,  3,  2, 12 },
+/* 2,3,5 */  {  9,  1, 12,  4,  9, 12,  5,  4, 12, 10,  5, 12,  6, 10, 12,  7,  6, 12, 11,  7, 12,  2, 11, 12,  3,  2, 12,  8,  3, 12,  0,  8, 12,  1,  0, 12 },
+/* 3,4,6 */  { 12,  0,  8, 12,  8,  7, 12,  7,  4, 12,  4,  9, 12,  9,  5, 12,  5,  6, 12,  6, 10, 12, 10,  1, 12,  1,  2, 12,  2, 11, 12, 11,  3, 12,  3,  0 }
+},
+/*  90:    1,    3, 4,    6,     */  {
+/* 1,2,6 */  { 12,  3, 11, 12, 11,  6, 12,  6,  7, 12,  7,  8, 12,  8,  4, 12,  4,  5, 12,  5,  9, 12,  9,  0, 12,  0,  1, 12,  1, 10, 12, 10,  2, 12,  2,  3 },
+/* 1,4,5 */  {  8,  0, 12,  7,  8, 12,  4,  7, 12,  9,  4, 12,  5,  9, 12,  6,  5, 12, 10,  6, 12,  1, 10, 12,  2,  1, 12, 11,  2, 12,  3, 11, 12,  0,  3, 12 },
+/* 2,3,5 */  { 10,  2, 12,  5, 10, 12,  6,  5, 12, 11,  6, 12,  7, 11, 12,  4,  7, 12,  8,  4, 12,  3,  8, 12,  0,  3, 12,  9,  0, 12,  1,  9, 12,  2,  1, 12 },
+/* 3,4,6 */  { 12,  1,  9, 12,  9,  4, 12,  4,  5, 12,  5, 10, 12, 10,  6, 12,  6,  7, 12,  7, 11, 12, 11,  2, 12,  2,  3, 12,  3,  8, 12,  8,  0, 12,  0,  1 }
+} };
+
+//_____________________________________________________________________________
+/**
+ * \brief tiling table for case 13.5.1
+ * The support edge for the interior test is marked as the 1st column.
+ * For each of the case above, the specific triangulation of the edge
+ * intersection points is given.
+ * When a case is ambiguous, there is an auxiliary table that contains
+ * the face number to test and the tiling table contains the specific
+ * triangulations depending on the results
+ * A minus sign means to invert the result of the test.
+ */
+//-----------------------------------------------------------------------------
+/* 13.5.1 */
+static const char tiling13_5_1[2][4][18] = {
+/* 165: 0,    2,       5,    7,  */  {
+/* 1,2,5 */  {  7,  6, 11,  1,  0,  9, 10,  3,  2,  3, 10,  5,  3,  5,  8,  4,  8, 5 },
+/* 1,4,6 */  {  1,  2, 10,  7,  4,  8,  3,  0, 11,  6, 11,  0,  9,  6,  0,  6,  9, 5 },
+/* 2,3,6 */  {  3,  0,  8,  5,  6, 10,  1,  2,  9,  4,  9,  2, 11,  4,  2,  4, 11, 7 },
+/* 3,4,5 */  {  5,  4,  9,  3,  2, 11,  8,  1,  0,  1,  8,  7,  1,  7, 10,  6, 10, 7 }
+},
+/*  90:    1,    3, 4,    6,     */  {
+/* 1,2,5 */  {  4,  7,  8,  2,  1, 10, 11,  0,  3,  0, 11,  6,  0,  6,  9,  5,  9, 6 },
+/* 1,4,6 */  {  2,  3, 11,  4,  5,  9,  0,  1,  8,  7,  8,  1, 10,  7,  1,  7, 10, 6 },
+/* 2,3,6 */  {  0,  1,  9,  6,  7, 11,  2,  3, 10,  5, 10,  3,  8,  5,  3,  5,  8, 4 },
+/* 3,4,5 */  {  6,  5, 10,  0,  3,  8,  9,  2,  1,  2,  9,  4,  2,  4, 11,  7, 11, 4 }
+} };
+
+//_____________________________________________________________________________
+/**
+ * \brief tiling table for case 13.5.2
+ * For each of the case above, the specific triangulation of the edge
+ * intersection points is given.
+ * When a case is ambiguous, there is an auxiliary table that contains
+ * the face number to test and the tiling table contains the specific
+ * triangulations depending on the results
+ * A minus sign means to invert the result of the test.
+ */
+//-----------------------------------------------------------------------------
+/* 13.5.2 */
+static const char tiling13_5_2[2][4][30] = {
+/* 165: 0,    2,       5,    7,  */  {
+/* 1,2,5 */  { 1,  0,  9,  7,  4,  8,  7,  8,  3,  7,  3, 11,  2, 11,  3, 11,  2, 10, 11, 10,  6,  5,  6, 10,  6,  5,  7,  4,  7, 5 },
+/* 1,4,6 */  { 7,  4,  8, 11,  3,  2,  6, 11,  2, 10,  6,  2,  6, 10,  5,  9,  5, 10,  1,  9, 10,  9,  1,  0,  2,  0,  1,  0,  2, 3 },
+/* 2,3,6 */  { 5,  6, 10,  9,  1,  0,  4,  9,  0,  8,  4,  0,  4,  8,  7, 11,  7,  8,  3, 11,  8, 11,  3,  2,  0,  2,  3,  2,  0, 1 },
+/* 3,4,5 */  { 3,  2, 11,  5,  6, 10,  5, 10,  1,  5,  1,  9,  0,  9,  1,  9,  0,  8,  9,  8,  4,  4,  8,  7,  4,  7,  5,  6,  5, 7 }
+},
+/*  90:    1,    3, 4,    6,     */  {
+/* 1,2,5 */  { 2,  1, 10,  4,  5,  9,  4,  9,  0,  4,  0,  8,  3,  8,  0,  8,  3, 11,  8, 11,  7,  6,  7, 11,  7,  6,  4,  5,  4, 6 },
+/* 1,4,6 */  { 4,  5,  9,  8,  0,  3,  7,  8,  3, 11,  7,  3,  7, 11,  6, 10,  6, 11,  2, 10, 11, 10,  2,  1,  3,  1,  2,  1,  3, 0 },
+/* 2,3,6 */  { 6,  7, 11, 10,  2,  1,  5, 10,  1,  9,  5,  1,  5,  9,  4,  8,  4,  9,  0,  8,  9,  8,  0,  3,  1,  3,  0,  3,  1, 2 },
+/* 3,4,5 */  { 0,  3,  8,  6,  7, 11,  6, 11,  2,  6,  2, 10,  1, 10,  2, 10,  1,  9, 10,  9,  5,  5,  9,  4,  5,  4,  6,  7,  6, 4 }
+} };
+//_____________________________________________________________________________
+
+
+
+//_____________________________________________________________________________
+/**
+ * \brief tiling table for case 14
+ * For each of the case above, the specific triangulation of the edge
+ * intersection points is given.
+ * When a case is ambiguous, there is an auxiliary table that contains
+ * the face number to test and the tiling table contains the specific
+ * triangulations depending on the results
+ * A minus sign means to invert the result of the test.
+ */
+//-----------------------------------------------------------------------------
+static const char tiling14[12][12] = {
+/*  71: 0, 1, 2,          6,     */  {  5,  9,  8,  5,  8,  2,  5,  2,  6,  3,  2,  8 },
+/*  43: 0, 1,    3,    5,        */  {  2,  1,  5,  2,  5,  8,  2,  8, 11,  4,  8,  5 },
+/* 147: 0, 1,       4,       7,  */  {  9,  4,  6,  9,  6,  3,  9,  3,  1, 11,  3,  6 },
+/*  29: 0,    2, 3, 4,           */  {  1, 11, 10,  1,  4, 11,  1,  0,  4,  7, 11,  4 },
+/* 201: 0,       3,       6, 7,  */  {  8,  2,  0,  8,  5,  2,  8,  7,  5, 10,  2,  5 },
+/* 113: 0,          4, 5, 6,     */  {  0,  7,  3,  0, 10,  7,  0,  9, 10,  6,  7, 10 },
+/* 142:    1, 2, 3,          7,  */  {  0,  3,  7,  0,  7, 10,  0, 10,  9,  6, 10,  7 },
+/*  54:    1, 2,    4, 5,        */  {  8,  0,  2,  8,  2,  5,  8,  5,  7, 10,  5,  2 },
+/* 226:    1,          5, 6, 7,  */  {  1, 10, 11,  1, 11,  4,  1,  4,  0,  7,  4, 11 },
+/* 108:       2, 3,    5, 6,     */  {  9,  6,  4,  9,  3,  6,  9,  1,  3, 11,  6,  3 },
+/* 212:       2,    4,    6, 7,  */  {  2,  5,  1,  2,  8,  5,  2, 11,  8,  4,  5,  8 },
+/* 184:          3, 4, 5,    7,  */  {  5,  8,  9,  5,  2,  8,  5,  6,  2,  3,  8,  2 }
+};
+//_____________________________________________________________________________
+
+
+
+//_____________________________________________________________________________
+/**
+ * \brief original Marching Cubes implementation
+ * For each of the possible vertex states listed in this table there is a
+ * specific triangulation of the edge intersection points.  The table lists
+ * all of them in the form of 0-5 edge triples with the list terminated by
+ * the invalid value -1.  For example: casesClassic[3] list the 2 triangles
+ * formed when cube[0] and cube[1] are inside of the surface, but the rest of
+ * the cube is not.
+ */
+//-----------------------------------------------------------------------------
+static const char casesClassic[256][16] = {
+/*   0:                          */  { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+/*   1: 0,                       */  {  0,  8,  3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+/*   2:    1,                    */  {  0,  1,  9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+/*   3: 0, 1,                    */  {  1,  8,  3,  9,  8,  1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+/*   4:       2,                 */  {  1,  2, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+/*   5: 0,    2,                 */  {  0,  8,  3,  1,  2, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+/*   6:    1, 2,                 */  {  9,  2, 10,  0,  2,  9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+/*   7: 0, 1, 2,                 */  {  2,  8,  3,  2, 10,  8, 10,  9,  8, -1, -1, -1, -1, -1, -1, -1 },
+/*   8:          3,              */  {  3, 11,  2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+/*   9: 0,       3,              */  {  0, 11,  2,  8, 11,  0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+/*  10:    1,    3,              */  {  1,  9,  0,  2,  3, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+/*  11: 0, 1,    3,              */  {  1, 11,  2,  1,  9, 11,  9,  8, 11, -1, -1, -1, -1, -1, -1, -1 },
+/*  12:       2, 3,              */  {  3, 10,  1, 11, 10,  3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+/*  13: 0,    2, 3,              */  {  0, 10,  1,  0,  8, 10,  8, 11, 10, -1, -1, -1, -1, -1, -1, -1 },
+/*  14:    1, 2, 3,              */  {  3,  9,  0,  3, 11,  9, 11, 10,  9, -1, -1, -1, -1, -1, -1, -1 },
+/*  15: 0, 1, 2, 3,              */  {  9,  8, 10, 10,  8, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+/*  16:             4,           */  {  4,  7,  8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+/*  17: 0,          4,           */  {  4,  3,  0,  7,  3,  4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+/*  18:    1,       4,           */  {  0,  1,  9,  8,  4,  7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+/*  19: 0, 1,       4,           */  {  4,  1,  9,  4,  7,  1,  7,  3,  1, -1, -1, -1, -1, -1, -1, -1 },
+/*  20:       2,    4,           */  {  1,  2, 10,  8,  4,  7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+/*  21: 0,    2,    4,           */  {  3,  4,  7,  3,  0,  4,  1,  2, 10, -1, -1, -1, -1, -1, -1, -1 },
+/*  22:    1, 2,    4,           */  {  9,  2, 10,  9,  0,  2,  8,  4,  7, -1, -1, -1, -1, -1, -1, -1 },
+/*  23: 0, 1, 2,    4,           */  {  2, 10,  9,  2,  9,  7,  2,  7,  3,  7,  9,  4, -1, -1, -1, -1 },
+/*  24:          3, 4,           */  {  8,  4,  7,  3, 11,  2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+/*  25: 0,       3, 4,           */  { 11,  4,  7, 11,  2,  4,  2,  0,  4, -1, -1, -1, -1, -1, -1, -1 },
+/*  26:    1,    3, 4,           */  {  9,  0,  1,  8,  4,  7,  2,  3, 11, -1, -1, -1, -1, -1, -1, -1 },
+/*  27: 0, 1,    3, 4,           */  {  4,  7, 11,  9,  4, 11,  9, 11,  2,  9,  2,  1, -1, -1, -1, -1 },
+/*  28:       2, 3, 4,           */  {  3, 10,  1,  3, 11, 10,  7,  8,  4, -1, -1, -1, -1, -1, -1, -1 },
+/*  29: 0,    2, 3, 4,           */  {  1, 11, 10,  1,  4, 11,  1,  0,  4,  7, 11,  4, -1, -1, -1, -1 },
+/*  30:    1, 2, 3, 4,           */  {  4,  7,  8,  9,  0, 11,  9, 11, 10, 11,  0,  3, -1, -1, -1, -1 },
+/*  31: 0, 1, 2, 3, 4,           */  {  4,  7, 11,  4, 11,  9,  9, 11, 10, -1, -1, -1, -1, -1, -1, -1 },
+/*  32:                5,        */  {  9,  5,  4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+/*  33: 0,             5,        */  {  9,  5,  4,  0,  8,  3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+/*  34:    1,          5,        */  {  0,  5,  4,  1,  5,  0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+/*  35: 0, 1,          5,        */  {  8,  5,  4,  8,  3,  5,  3,  1,  5, -1, -1, -1, -1, -1, -1, -1 },
+/*  36:       2,       5,        */  {  1,  2, 10,  9,  5,  4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+/*  37: 0,    2,       5,        */  {  3,  0,  8,  1,  2, 10,  4,  9,  5, -1, -1, -1, -1, -1, -1, -1 },
+/*  38:    1, 2,       5,        */  {  5,  2, 10,  5,  4,  2,  4,  0,  2, -1, -1, -1, -1, -1, -1, -1 },
+/*  39: 0, 1, 2,       5,        */  {  2, 10,  5,  3,  2,  5,  3,  5,  4,  3,  4,  8, -1, -1, -1, -1 },
+/*  40:          3,    5,        */  {  9,  5,  4,  2,  3, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+/*  41: 0,       3,    5,        */  {  0, 11,  2,  0,  8, 11,  4,  9,  5, -1, -1, -1, -1, -1, -1, -1 },
+/*  42:    1,    3,    5,        */  {  0,  5,  4,  0,  1,  5,  2,  3, 11, -1, -1, -1, -1, -1, -1, -1 },
+/*  43: 0, 1,    3,    5,        */  {  2,  1,  5,  2,  5,  8,  2,  8, 11,  4,  8,  5, -1, -1, -1, -1 },
+/*  44:       2, 3,    5,        */  { 10,  3, 11, 10,  1,  3,  9,  5,  4, -1, -1, -1, -1, -1, -1, -1 },
+/*  45: 0,    2, 3,    5,        */  {  4,  9,  5,  0,  8,  1,  8, 10,  1,  8, 11, 10, -1, -1, -1, -1 },
+/*  46:    1, 2, 3,    5,        */  {  5,  4,  0,  5,  0, 11,  5, 11, 10, 11,  0,  3, -1, -1, -1, -1 },
+/*  47: 0, 1, 2, 3,    5,        */  {  5,  4,  8,  5,  8, 10, 10,  8, 11, -1, -1, -1, -1, -1, -1, -1 },
+/*  48:             4, 5,        */  {  9,  7,  8,  5,  7,  9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+/*  49: 0,          4, 5,        */  {  9,  3,  0,  9,  5,  3,  5,  7,  3, -1, -1, -1, -1, -1, -1, -1 },
+/*  50:    1,       4, 5,        */  {  0,  7,  8,  0,  1,  7,  1,  5,  7, -1, -1, -1, -1, -1, -1, -1 },
+/*  51: 0, 1,       4, 5,        */  {  1,  5,  3,  3,  5,  7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+/*  52:       2,    4, 5,        */  {  9,  7,  8,  9,  5,  7, 10,  1,  2, -1, -1, -1, -1, -1, -1, -1 },
+/*  53: 0,    2,    4, 5,        */  { 10,  1,  2,  9,  5,  0,  5,  3,  0,  5,  7,  3, -1, -1, -1, -1 },
+/*  54:    1, 2,    4, 5,        */  {  8,  0,  2,  8,  2,  5,  8,  5,  7, 10,  5,  2, -1, -1, -1, -1 },
+/*  55: 0, 1, 2,    4, 5,        */  {  2, 10,  5,  2,  5,  3,  3,  5,  7, -1, -1, -1, -1, -1, -1, -1 },
+/*  56:          3, 4, 5,        */  {  7,  9,  5,  7,  8,  9,  3, 11,  2, -1, -1, -1, -1, -1, -1, -1 },
+/*  57: 0,       3, 4, 5,        */  {  9,  5,  7,  9,  7,  2,  9,  2,  0,  2,  7, 11, -1, -1, -1, -1 },
+/*  58:    1,    3, 4, 5,        */  {  2,  3, 11,  0,  1,  8,  1,  7,  8,  1,  5,  7, -1, -1, -1, -1 },
+/*  59: 0, 1,    3, 4, 5,        */  { 11,  2,  1, 11,  1,  7,  7,  1,  5, -1, -1, -1, -1, -1, -1, -1 },
+/*  60:       2, 3, 4, 5,        */  {  9,  5,  8,  8,  5,  7, 10,  1,  3, 10,  3, 11, -1, -1, -1, -1 },
+/*  61: 0,    2, 3, 4, 5,        */  {  5,  7,  0,  5,  0,  9,  7, 11,  0,  1,  0, 10, 11, 10,  0, -1 },
+/*  62:    1, 2, 3, 4, 5,        */  { 11, 10,  0, 11,  0,  3, 10,  5,  0,  8,  0,  7,  5,  7,  0, -1 },
+/*  63: 0, 1, 2, 3, 4, 5,        */  { 11, 10,  5,  7, 11,  5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+/*  64:                   6,     */  { 10,  6,  5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+/*  65: 0,                6,     */  {  0,  8,  3,  5, 10,  6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+/*  66:    1,             6,     */  {  9,  0,  1,  5, 10,  6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+/*  67: 0, 1,             6,     */  {  1,  8,  3,  1,  9,  8,  5, 10,  6, -1, -1, -1, -1, -1, -1, -1 },
+/*  68:       2,          6,     */  {  1,  6,  5,  2,  6,  1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+/*  69: 0,    2,          6,     */  {  1,  6,  5,  1,  2,  6,  3,  0,  8, -1, -1, -1, -1, -1, -1, -1 },
+/*  70:    1, 2,          6,     */  {  9,  6,  5,  9,  0,  6,  0,  2,  6, -1, -1, -1, -1, -1, -1, -1 },
+/*  71: 0, 1, 2,          6,     */  {  5,  9,  8,  5,  8,  2,  5,  2,  6,  3,  2,  8, -1, -1, -1, -1 },
+/*  72:          3,       6,     */  {  2,  3, 11, 10,  6,  5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+/*  73: 0,       3,       6,     */  { 11,  0,  8, 11,  2,  0, 10,  6,  5, -1, -1, -1, -1, -1, -1, -1 },
+/*  74:    1,    3,       6,     */  {  0,  1,  9,  2,  3, 11,  5, 10,  6, -1, -1, -1, -1, -1, -1, -1 },
+/*  75: 0, 1,    3,       6,     */  {  5, 10,  6,  1,  9,  2,  9, 11,  2,  9,  8, 11, -1, -1, -1, -1 },
+/*  76:       2, 3,       6,     */  {  6,  3, 11,  6,  5,  3,  5,  1,  3, -1, -1, -1, -1, -1, -1, -1 },
+/*  77: 0,    2, 3,       6,     */  {  0,  8, 11,  0, 11,  5,  0,  5,  1,  5, 11,  6, -1, -1, -1, -1 },
+/*  78:    1, 2, 3,       6,     */  {  3, 11,  6,  0,  3,  6,  0,  6,  5,  0,  5,  9, -1, -1, -1, -1 },
+/*  79: 0, 1, 2, 3,       6,     */  {  6,  5,  9,  6,  9, 11, 11,  9,  8, -1, -1, -1, -1, -1, -1, -1 },
+/*  80:             4,    6,     */  {  5, 10,  6,  4,  7,  8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+/*  81: 0,          4,    6,     */  {  4,  3,  0,  4,  7,  3,  6,  5, 10, -1, -1, -1, -1, -1, -1, -1 },
+/*  82:    1,       4,    6,     */  {  1,  9,  0,  5, 10,  6,  8,  4,  7, -1, -1, -1, -1, -1, -1, -1 },
+/*  83: 0, 1,       4,    6,     */  { 10,  6,  5,  1,  9,  7,  1,  7,  3,  7,  9,  4, -1, -1, -1, -1 },
+/*  84:       2,    4,    6,     */  {  6,  1,  2,  6,  5,  1,  4,  7,  8, -1, -1, -1, -1, -1, -1, -1 },
+/*  85: 0,    2,    4,    6,     */  {  1,  2,  5,  5,  2,  6,  3,  0,  4,  3,  4,  7, -1, -1, -1, -1 },
+/*  86:    1, 2,    4,    6,     */  {  8,  4,  7,  9,  0,  5,  0,  6,  5,  0,  2,  6, -1, -1, -1, -1 },
+/*  87: 0, 1, 2,    4,    6,     */  {  7,  3,  9,  7,  9,  4,  3,  2,  9,  5,  9,  6,  2,  6,  9, -1 },
+/*  88:          3, 4,    6,     */  {  3, 11,  2,  7,  8,  4, 10,  6,  5, -1, -1, -1, -1, -1, -1, -1 },
+/*  89: 0,       3, 4,    6,     */  {  5, 10,  6,  4,  7,  2,  4,  2,  0,  2,  7, 11, -1, -1, -1, -1 },
+/*  90:    1,    3, 4,    6,     */  {  0,  1,  9,  4,  7,  8,  2,  3, 11,  5, 10,  6, -1, -1, -1, -1 },
+/*  91: 0, 1,    3, 4,    6,     */  {  9,  2,  1,  9, 11,  2,  9,  4, 11,  7, 11,  4,  5, 10,  6, -1 },
+/*  92:       2, 3, 4,    6,     */  {  8,  4,  7,  3, 11,  5,  3,  5,  1,  5, 11,  6, -1, -1, -1, -1 },
+/*  93: 0,    2, 3, 4,    6,     */  {  5,  1, 11,  5, 11,  6,  1,  0, 11,  7, 11,  4,  0,  4, 11, -1 },
+/*  94:    1, 2, 3, 4,    6,     */  {  0,  5,  9,  0,  6,  5,  0,  3,  6, 11,  6,  3,  8,  4,  7, -1 },
+/*  95: 0, 1, 2, 3, 4,    6,     */  {  6,  5,  9,  6,  9, 11,  4,  7,  9,  7, 11,  9, -1, -1, -1, -1 },
+/*  96:                5, 6,     */  { 10,  4,  9,  6,  4, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+/*  97: 0,             5, 6,     */  {  4, 10,  6,  4,  9, 10,  0,  8,  3, -1, -1, -1, -1, -1, -1, -1 },
+/*  98:    1,          5, 6,     */  { 10,  0,  1, 10,  6,  0,  6,  4,  0, -1, -1, -1, -1, -1, -1, -1 },
+/*  99: 0, 1,          5, 6,     */  {  8,  3,  1,  8,  1,  6,  8,  6,  4,  6,  1, 10, -1, -1, -1, -1 },
+/* 100:       2,       5, 6,     */  {  1,  4,  9,  1,  2,  4,  2,  6,  4, -1, -1, -1, -1, -1, -1, -1 },
+/* 101: 0,    2,       5, 6,     */  {  3,  0,  8,  1,  2,  9,  2,  4,  9,  2,  6,  4, -1, -1, -1, -1 },
+/* 102:    1, 2,       5, 6,     */  {  0,  2,  4,  4,  2,  6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+/* 103: 0, 1, 2,       5, 6,     */  {  8,  3,  2,  8,  2,  4,  4,  2,  6, -1, -1, -1, -1, -1, -1, -1 },
+/* 104:          3,    5, 6,     */  { 10,  4,  9, 10,  6,  4, 11,  2,  3, -1, -1, -1, -1, -1, -1, -1 },
+/* 105: 0,       3,    5, 6,     */  {  0,  8,  2,  2,  8, 11,  4,  9, 10,  4, 10,  6, -1, -1, -1, -1 },
+/* 106:    1,    3,    5, 6,     */  {  3, 11,  2,  0,  1,  6,  0,  6,  4,  6,  1, 10, -1, -1, -1, -1 },
+/* 107: 0, 1,    3,    5, 6,     */  {  6,  4,  1,  6,  1, 10,  4,  8,  1,  2,  1, 11,  8, 11,  1, -1 },
+/* 108:       2, 3,    5, 6,     */  {  9,  6,  4,  9,  3,  6,  9,  1,  3, 11,  6,  3, -1, -1, -1, -1 },
+/* 109: 0,    2, 3,    5, 6,     */  {  8, 11,  1,  8,  1,  0, 11,  6,  1,  9,  1,  4,  6,  4,  1, -1 },
+/* 110:    1, 2, 3,    5, 6,     */  {  3, 11,  6,  3,  6,  0,  0,  6,  4, -1, -1, -1, -1, -1, -1, -1 },
+/* 111: 0, 1, 2, 3,    5, 6,     */  {  6,  4,  8, 11,  6,  8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+/* 112:             4, 5, 6,     */  {  7, 10,  6,  7,  8, 10,  8,  9, 10, -1, -1, -1, -1, -1, -1, -1 },
+/* 113: 0,          4, 5, 6,     */  {  0,  7,  3,  0, 10,  7,  0,  9, 10,  6,  7, 10, -1, -1, -1, -1 },
+/* 114:    1,       4, 5, 6,     */  { 10,  6,  7,  1, 10,  7,  1,  7,  8,  1,  8,  0, -1, -1, -1, -1 },
+/* 115: 0, 1,       4, 5, 6,     */  { 10,  6,  7, 10,  7,  1,  1,  7,  3, -1, -1, -1, -1, -1, -1, -1 },
+/* 116:       2,    4, 5, 6,     */  {  1,  2,  6,  1,  6,  8,  1,  8,  9,  8,  6,  7, -1, -1, -1, -1 },
+/* 117: 0,    2,    4, 5, 6,     */  {  2,  6,  9,  2,  9,  1,  6,  7,  9,  0,  9,  3,  7,  3,  9, -1 },
+/* 118:    1, 2,    4, 5, 6,     */  {  7,  8,  0,  7,  0,  6,  6,  0,  2, -1, -1, -1, -1, -1, -1, -1 },
+/* 119: 0, 1, 2,    4, 5, 6,     */  {  7,  3,  2,  6,  7,  2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+/* 120:          3, 4, 5, 6,     */  {  2,  3, 11, 10,  6,  8, 10,  8,  9,  8,  6,  7, -1, -1, -1, -1 },
+/* 121: 0,       3, 4, 5, 6,     */  {  2,  0,  7,  2,  7, 11,  0,  9,  7,  6,  7, 10,  9, 10,  7, -1 },
+/* 122:    1,    3, 4, 5, 6,     */  {  1,  8,  0,  1,  7,  8,  1, 10,  7,  6,  7, 10,  2,  3, 11, -1 },
+/* 123: 0, 1,    3, 4, 5, 6,     */  { 11,  2,  1, 11,  1,  7, 10,  6,  1,  6,  7,  1, -1, -1, -1, -1 },
+/* 124:       2, 3, 4, 5, 6,     */  {  8,  9,  6,  8,  6,  7,  9,  1,  6, 11,  6,  3,  1,  3,  6, -1 },
+/* 125: 0,    2, 3, 4, 5, 6,     */  {  0,  9,  1, 11,  6,  7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+/* 126:    1, 2, 3, 4, 5, 6,     */  {  7,  8,  0,  7,  0,  6,  3, 11,  0, 11,  6,  0, -1, -1, -1, -1 },
+/* 127: 0, 1, 2, 3, 4, 5, 6,     */  {  7, 11,  6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+/* 128:                      7,  */  {  7,  6, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+/* 129: 0,                   7,  */  {  3,  0,  8, 11,  7,  6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+/* 130:    1,                7,  */  {  0,  1,  9, 11,  7,  6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+/* 131: 0, 1,                7,  */  {  8,  1,  9,  8,  3,  1, 11,  7,  6, -1, -1, -1, -1, -1, -1, -1 },
+/* 132:       2,             7,  */  { 10,  1,  2,  6, 11,  7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+/* 133: 0,    2,             7,  */  {  1,  2, 10,  3,  0,  8,  6, 11,  7, -1, -1, -1, -1, -1, -1, -1 },
+/* 134:    1, 2,             7,  */  {  2,  9,  0,  2, 10,  9,  6, 11,  7, -1, -1, -1, -1, -1, -1, -1 },
+/* 135: 0, 1, 2,             7,  */  {  6, 11,  7,  2, 10,  3, 10,  8,  3, 10,  9,  8, -1, -1, -1, -1 },
+/* 136:          3,          7,  */  {  7,  2,  3,  6,  2,  7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+/* 137: 0,       3,          7,  */  {  7,  0,  8,  7,  6,  0,  6,  2,  0, -1, -1, -1, -1, -1, -1, -1 },
+/* 138:    1,    3,          7,  */  {  2,  7,  6,  2,  3,  7,  0,  1,  9, -1, -1, -1, -1, -1, -1, -1 },
+/* 139: 0, 1,    3,          7,  */  {  1,  6,  2,  1,  8,  6,  1,  9,  8,  8,  7,  6, -1, -1, -1, -1 },
+/* 140:       2, 3,          7,  */  { 10,  7,  6, 10,  1,  7,  1,  3,  7, -1, -1, -1, -1, -1, -1, -1 },
+/* 141: 0,    2, 3,          7,  */  { 10,  7,  6,  1,  7, 10,  1,  8,  7,  1,  0,  8, -1, -1, -1, -1 },
+/* 142:    1, 2, 3,          7,  */  {  0,  3,  7,  0,  7, 10,  0, 10,  9,  6, 10,  7, -1, -1, -1, -1 },
+/* 143: 0, 1, 2, 3,          7,  */  {  7,  6, 10,  7, 10,  8,  8, 10,  9, -1, -1, -1, -1, -1, -1, -1 },
+/* 144:             4,       7,  */  {  6,  8,  4, 11,  8,  6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+/* 145: 0,          4,       7,  */  {  3,  6, 11,  3,  0,  6,  0,  4,  6, -1, -1, -1, -1, -1, -1, -1 },
+/* 146:    1,       4,       7,  */  {  8,  6, 11,  8,  4,  6,  9,  0,  1, -1, -1, -1, -1, -1, -1, -1 },
+/* 147: 0, 1,       4,       7,  */  {  9,  4,  6,  9,  6,  3,  9,  3,  1, 11,  3,  6, -1, -1, -1, -1 },
+/* 148:       2,    4,       7,  */  {  6,  8,  4,  6, 11,  8,  2, 10,  1, -1, -1, -1, -1, -1, -1, -1 },
+/* 149: 0,    2,    4,       7,  */  {  1,  2, 10,  3,  0, 11,  0,  6, 11,  0,  4,  6, -1, -1, -1, -1 },
+/* 150:    1, 2,    4,       7,  */  {  4, 11,  8,  4,  6, 11,  0,  2,  9,  2, 10,  9, -1, -1, -1, -1 },
+/* 151: 0, 1, 2,    4,       7,  */  { 10,  9,  3, 10,  3,  2,  9,  4,  3, 11,  3,  6,  4,  6,  3, -1 },
+/* 152:          3, 4,       7,  */  {  8,  2,  3,  8,  4,  2,  4,  6,  2, -1, -1, -1, -1, -1, -1, -1 },
+/* 153: 0,       3, 4,       7,  */  {  0,  4,  2,  4,  6,  2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+/* 154:    1,    3, 4,       7,  */  {  1,  9,  0,  2,  3,  4,  2,  4,  6,  4,  3,  8, -1, -1, -1, -1 },
+/* 155: 0, 1,    3, 4,       7,  */  {  1,  9,  4,  1,  4,  2,  2,  4,  6, -1, -1, -1, -1, -1, -1, -1 },
+/* 156:       2, 3, 4,       7,  */  {  8,  1,  3,  8,  6,  1,  8,  4,  6,  6, 10,  1, -1, -1, -1, -1 },
+/* 157: 0,    2, 3, 4,       7,  */  { 10,  1,  0, 10,  0,  6,  6,  0,  4, -1, -1, -1, -1, -1, -1, -1 },
+/* 158:    1, 2, 3, 4,       7,  */  {  4,  6,  3,  4,  3,  8,  6, 10,  3,  0,  3,  9, 10,  9,  3, -1 },
+/* 159: 0, 1, 2, 3, 4,       7,  */  { 10,  9,  4,  6, 10,  4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+/* 160:                5,    7,  */  {  4,  9,  5,  7,  6, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+/* 161: 0,             5,    7,  */  {  0,  8,  3,  4,  9,  5, 11,  7,  6, -1, -1, -1, -1, -1, -1, -1 },
+/* 162:    1,          5,    7,  */  {  5,  0,  1,  5,  4,  0,  7,  6, 11, -1, -1, -1, -1, -1, -1, -1 },
+/* 163: 0, 1,          5,    7,  */  { 11,  7,  6,  8,  3,  4,  3,  5,  4,  3,  1,  5, -1, -1, -1, -1 },
+/* 164:       2,       5,    7,  */  {  9,  5,  4, 10,  1,  2,  7,  6, 11, -1, -1, -1, -1, -1, -1, -1 },
+/* 165: 0,    2,       5,    7,  */  {  6, 11,  7,  1,  2, 10,  0,  8,  3,  4,  9,  5, -1, -1, -1, -1 },
+/* 166:    1, 2,       5,    7,  */  {  7,  6, 11,  5,  4, 10,  4,  2, 10,  4,  0,  2, -1, -1, -1, -1 },
+/* 167: 0, 1, 2,       5,    7,  */  {  3,  4,  8,  3,  5,  4,  3,  2,  5, 10,  5,  2, 11,  7,  6, -1 },
+/* 168:          3,    5,    7,  */  {  7,  2,  3,  7,  6,  2,  5,  4,  9, -1, -1, -1, -1, -1, -1, -1 },
+/* 169: 0,       3,    5,    7,  */  {  9,  5,  4,  0,  8,  6,  0,  6,  2,  6,  8,  7, -1, -1, -1, -1 },
+/* 170:    1,    3,    5,    7,  */  {  3,  6,  2,  3,  7,  6,  1,  5,  0,  5,  4,  0, -1, -1, -1, -1 },
+/* 171: 0, 1,    3,    5,    7,  */  {  6,  2,  8,  6,  8,  7,  2,  1,  8,  4,  8,  5,  1,  5,  8, -1 },
+/* 172:       2, 3,    5,    7,  */  {  9,  5,  4, 10,  1,  6,  1,  7,  6,  1,  3,  7, -1, -1, -1, -1 },
+/* 173: 0,    2, 3,    5,    7,  */  {  1,  6, 10,  1,  7,  6,  1,  0,  7,  8,  7,  0,  9,  5,  4, -1 },
+/* 174:    1, 2, 3,    5,    7,  */  {  4,  0, 10,  4, 10,  5,  0,  3, 10,  6, 10,  7,  3,  7, 10, -1 },
+/* 175: 0, 1, 2, 3,    5,    7,  */  {  7,  6, 10,  7, 10,  8,  5,  4, 10,  4,  8, 10, -1, -1, -1, -1 },
+/* 176:             4, 5,    7,  */  {  6,  9,  5,  6, 11,  9, 11,  8,  9, -1, -1, -1, -1, -1, -1, -1 },
+/* 177: 0,          4, 5,    7,  */  {  3,  6, 11,  0,  6,  3,  0,  5,  6,  0,  9,  5, -1, -1, -1, -1 },
+/* 178:    1,       4, 5,    7,  */  {  0, 11,  8,  0,  5, 11,  0,  1,  5,  5,  6, 11, -1, -1, -1, -1 },
+/* 179: 0, 1,       4, 5,    7,  */  {  6, 11,  3,  6,  3,  5,  5,  3,  1, -1, -1, -1, -1, -1, -1, -1 },
+/* 180:       2,    4, 5,    7,  */  {  1,  2, 10,  9,  5, 11,  9, 11,  8, 11,  5,  6, -1, -1, -1, -1 },
+/* 181: 0,    2,    4, 5,    7,  */  {  0, 11,  3,  0,  6, 11,  0,  9,  6,  5,  6,  9,  1,  2, 10, -1 },
+/* 182:    1, 2,    4, 5,    7,  */  { 11,  8,  5, 11,  5,  6,  8,  0,  5, 10,  5,  2,  0,  2,  5, -1 },
+/* 183: 0, 1, 2,    4, 5,    7,  */  {  6, 11,  3,  6,  3,  5,  2, 10,  3, 10,  5,  3, -1, -1, -1, -1 },
+/* 184:          3, 4, 5,    7,  */  {  5,  8,  9,  5,  2,  8,  5,  6,  2,  3,  8,  2, -1, -1, -1, -1 },
+/* 185: 0,       3, 4, 5,    7,  */  {  9,  5,  6,  9,  6,  0,  0,  6,  2, -1, -1, -1, -1, -1, -1, -1 },
+/* 186:    1,    3, 4, 5,    7,  */  {  1,  5,  8,  1,  8,  0,  5,  6,  8,  3,  8,  2,  6,  2,  8, -1 },
+/* 187: 0, 1,    3, 4, 5,    7,  */  {  1,  5,  6,  2,  1,  6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+/* 188:       2, 3, 4, 5,    7,  */  {  1,  3,  6,  1,  6, 10,  3,  8,  6,  5,  6,  9,  8,  9,  6, -1 },
+/* 189: 0,    2, 3, 4, 5,    7,  */  { 10,  1,  0, 10,  0,  6,  9,  5,  0,  5,  6,  0, -1, -1, -1, -1 },
+/* 190:    1, 2, 3, 4, 5,    7,  */  {  0,  3,  8,  5,  6, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+/* 191: 0, 1, 2, 3, 4, 5,    7,  */  { 10,  5,  6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+/* 192:                   6, 7,  */  { 11,  5, 10,  7,  5, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+/* 193: 0,                6, 7,  */  { 11,  5, 10, 11,  7,  5,  8,  3,  0, -1, -1, -1, -1, -1, -1, -1 },
+/* 194:    1,             6, 7,  */  {  5, 11,  7,  5, 10, 11,  1,  9,  0, -1, -1, -1, -1, -1, -1, -1 },
+/* 195: 0, 1,             6, 7,  */  { 10,  7,  5, 10, 11,  7,  9,  8,  1,  8,  3,  1, -1, -1, -1, -1 },
+/* 196:       2,          6, 7,  */  { 11,  1,  2, 11,  7,  1,  7,  5,  1, -1, -1, -1, -1, -1, -1, -1 },
+/* 197: 0,    2,          6, 7,  */  {  0,  8,  3,  1,  2,  7,  1,  7,  5,  7,  2, 11, -1, -1, -1, -1 },
+/* 198:    1, 2,          6, 7,  */  {  9,  7,  5,  9,  2,  7,  9,  0,  2,  2, 11,  7, -1, -1, -1, -1 },
+/* 199: 0, 1, 2,          6, 7,  */  {  7,  5,  2,  7,  2, 11,  5,  9,  2,  3,  2,  8,  9,  8,  2, -1 },
+/* 200:          3,       6, 7,  */  {  2,  5, 10,  2,  3,  5,  3,  7,  5, -1, -1, -1, -1, -1, -1, -1 },
+/* 201: 0,       3,       6, 7,  */  {  8,  2,  0,  8,  5,  2,  8,  7,  5, 10,  2,  5, -1, -1, -1, -1 },
+/* 202:    1,    3,       6, 7,  */  {  9,  0,  1,  5, 10,  3,  5,  3,  7,  3, 10,  2, -1, -1, -1, -1 },
+/* 203: 0, 1,    3,       6, 7,  */  {  9,  8,  2,  9,  2,  1,  8,  7,  2, 10,  2,  5,  7,  5,  2, -1 },
+/* 204:       2, 3,       6, 7,  */  {  1,  3,  5,  3,  7,  5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+/* 205: 0,    2, 3,       6, 7,  */  {  0,  8,  7,  0,  7,  1,  1,  7,  5, -1, -1, -1, -1, -1, -1, -1 },
+/* 206:    1, 2, 3,       6, 7,  */  {  9,  0,  3,  9,  3,  5,  5,  3,  7, -1, -1, -1, -1, -1, -1, -1 },
+/* 207: 0, 1, 2, 3,       6, 7,  */  {  9,  8,  7,  5,  9,  7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+/* 208:             4,    6, 7,  */  {  5,  8,  4,  5, 10,  8, 10, 11,  8, -1, -1, -1, -1, -1, -1, -1 },
+/* 209: 0,          4,    6, 7,  */  {  5,  0,  4,  5, 11,  0,  5, 10, 11, 11,  3,  0, -1, -1, -1, -1 },
+/* 210:    1,       4,    6, 7,  */  {  0,  1,  9,  8,  4, 10,  8, 10, 11, 10,  4,  5, -1, -1, -1, -1 },
+/* 211: 0, 1,       4,    6, 7,  */  { 10, 11,  4, 10,  4,  5, 11,  3,  4,  9,  4,  1,  3,  1,  4, -1 },
+/* 212:       2,    4,    6, 7,  */  {  2,  5,  1,  2,  8,  5,  2, 11,  8,  4,  5,  8, -1, -1, -1, -1 },
+/* 213: 0,    2,    4,    6, 7,  */  {  0,  4, 11,  0, 11,  3,  4,  5, 11,  2, 11,  1,  5,  1, 11, -1 },
+/* 214:    1, 2,    4,    6, 7,  */  {  0,  2,  5,  0,  5,  9,  2, 11,  5,  4,  5,  8, 11,  8,  5, -1 },
+/* 215: 0, 1, 2,    4,    6, 7,  */  {  9,  4,  5,  2, 11,  3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+/* 216:          3, 4,    6, 7,  */  {  2,  5, 10,  3,  5,  2,  3,  4,  5,  3,  8,  4, -1, -1, -1, -1 },
+/* 217: 0,       3, 4,    6, 7,  */  {  5, 10,  2,  5,  2,  4,  4,  2,  0, -1, -1, -1, -1, -1, -1, -1 },
+/* 218:    1,    3, 4,    6, 7,  */  {  3, 10,  2,  3,  5, 10,  3,  8,  5,  4,  5,  8,  0,  1,  9, -1 },
+/* 219: 0, 1,    3, 4,    6, 7,  */  {  5, 10,  2,  5,  2,  4,  1,  9,  2,  9,  4,  2, -1, -1, -1, -1 },
+/* 220:       2, 3, 4,    6, 7,  */  {  8,  4,  5,  8,  5,  3,  3,  5,  1, -1, -1, -1, -1, -1, -1, -1 },
+/* 221: 0,    2, 3, 4,    6, 7,  */  {  0,  4,  5,  1,  0,  5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+/* 222:    1, 2, 3, 4,    6, 7,  */  {  8,  4,  5,  8,  5,  3,  9,  0,  5,  0,  3,  5, -1, -1, -1, -1 },
+/* 223: 0, 1, 2, 3, 4,    6, 7,  */  {  9,  4,  5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+/* 224:                5, 6, 7,  */  {  4, 11,  7,  4,  9, 11,  9, 10, 11, -1, -1, -1, -1, -1, -1, -1 },
+/* 225: 0,             5, 6, 7,  */  {  0,  8,  3,  4,  9,  7,  9, 11,  7,  9, 10, 11, -1, -1, -1, -1 },
+/* 226:    1,          5, 6, 7,  */  {  1, 10, 11,  1, 11,  4,  1,  4,  0,  7,  4, 11, -1, -1, -1, -1 },
+/* 227: 0, 1,          5, 6, 7,  */  {  3,  1,  4,  3,  4,  8,  1, 10,  4,  7,  4, 11, 10, 11,  4, -1 },
+/* 228:       2,       5, 6, 7,  */  {  4, 11,  7,  9, 11,  4,  9,  2, 11,  9,  1,  2, -1, -1, -1, -1 },
+/* 229: 0,    2,       5, 6, 7,  */  {  9,  7,  4,  9, 11,  7,  9,  1, 11,  2, 11,  1,  0,  8,  3, -1 },
+/* 230:    1, 2,       5, 6, 7,  */  { 11,  7,  4, 11,  4,  2,  2,  4,  0, -1, -1, -1, -1, -1, -1, -1 },
+/* 231: 0, 1, 2,       5, 6, 7,  */  { 11,  7,  4, 11,  4,  2,  8,  3,  4,  3,  2,  4, -1, -1, -1, -1 },
+/* 232:          3,    5, 6, 7,  */  {  2,  9, 10,  2,  7,  9,  2,  3,  7,  7,  4,  9, -1, -1, -1, -1 },
+/* 233: 0,       3,    5, 6, 7,  */  {  9, 10,  7,  9,  7,  4, 10,  2,  7,  8,  7,  0,  2,  0,  7, -1 },
+/* 234:    1,    3,    5, 6, 7,  */  {  3,  7, 10,  3, 10,  2,  7,  4, 10,  1, 10,  0,  4,  0, 10, -1 },
+/* 235: 0, 1,    3,    5, 6, 7,  */  {  1, 10,  2,  8,  7,  4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+/* 236:       2, 3,    5, 6, 7,  */  {  4,  9,  1,  4,  1,  7,  7,  1,  3, -1, -1, -1, -1, -1, -1, -1 },
+/* 237: 0,    2, 3,    5, 6, 7,  */  {  4,  9,  1,  4,  1,  7,  0,  8,  1,  8,  7,  1, -1, -1, -1, -1 },
+/* 238:    1, 2, 3,    5, 6, 7,  */  {  4,  0,  3,  7,  4,  3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+/* 239: 0, 1, 2, 3,    5, 6, 7,  */  {  4,  8,  7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+/* 240:             4, 5, 6, 7,  */  {  9, 10,  8, 10, 11,  8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+/* 241: 0,          4, 5, 6, 7,  */  {  3,  0,  9,  3,  9, 11, 11,  9, 10, -1, -1, -1, -1, -1, -1, -1 },
+/* 242:    1,       4, 5, 6, 7,  */  {  0,  1, 10,  0, 10,  8,  8, 10, 11, -1, -1, -1, -1, -1, -1, -1 },
+/* 243: 0, 1,       4, 5, 6, 7,  */  {  3,  1, 10, 11,  3, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+/* 244:       2,    4, 5, 6, 7,  */  {  1,  2, 11,  1, 11,  9,  9, 11,  8, -1, -1, -1, -1, -1, -1, -1 },
+/* 245: 0,    2,    4, 5, 6, 7,  */  {  3,  0,  9,  3,  9, 11,  1,  2,  9,  2, 11,  9, -1, -1, -1, -1 },
+/* 246:    1, 2,    4, 5, 6, 7,  */  {  0,  2, 11,  8,  0, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+/* 247: 0, 1, 2,    4, 5, 6, 7,  */  {  3,  2, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+/* 248:          3, 4, 5, 6, 7,  */  {  2,  3,  8,  2,  8, 10, 10,  8,  9, -1, -1, -1, -1, -1, -1, -1 },
+/* 249: 0,       3, 4, 5, 6, 7,  */  {  9, 10,  2,  0,  9,  2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+/* 250:    1,    3, 4, 5, 6, 7,  */  {  2,  3,  8,  2,  8, 10,  0,  1,  8,  1, 10,  8, -1, -1, -1, -1 },
+/* 251: 0, 1,    3, 4, 5, 6, 7,  */  {  1, 10,  2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+/* 252:       2, 3, 4, 5, 6, 7,  */  {  1,  3,  8,  9,  1,  8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+/* 253: 0,    2, 3, 4, 5, 6, 7,  */  {  0,  9,  1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+/* 254:    1, 2, 3, 4, 5, 6, 7,  */  {  0,  3,  8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
+/* 255: 0, 1, 2, 3, 4, 5, 6, 7,  */  { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
+};
+//_____________________________________________________________________________
+
+} //namespace McCubes
+
+#endif // _LOOKUPTABLE_H_
diff --git a/3rdParty/MarchingCubes/McPly.cpp b/3rdParty/MarchingCubes/McPly.cpp
index 35b9b718eb60b259ca221135dbc4109582e1a057..e56d01d7db4fda45646ff3ca7ad2138d322fece2 100644
--- a/3rdParty/MarchingCubes/McPly.cpp
+++ b/3rdParty/MarchingCubes/McPly.cpp
@@ -1,3320 +1,3320 @@
-/*
-
-The interface routines for reading and writing PLY polygon files.
-
-Greg Turk
-
----------------------------------------------------------------
-
-A PLY file contains a single polygonal _object_.
-
-An object is composed of lists of _elements_.  Typical elements are
-vertices, faces, edges and materials.
-
-Each type of element for a given object has one or more _properties_
-associated with the element type.  For instance, a vertex element may
-have as properties the floating-point values x,y,z and the three unsigned
-chars representing red, green and blue.
-
------------------------------------------------------------------------
-
-Copyright (c) 1998 Georgia Institute of Technology.  All rights reserved.
-
-Permission to use, copy, modify and distribute this software and its
-documentation for any purpose is hereby granted without fee, provided
-that the above copyright notice and this permission notice appear in
-all copies of this software and that you do not sell the software.
-
-THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTY OF ANY KIND,
-EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
-WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
-
-*/
-
-#include "./McPly.h"
-#include <iostream>
-#include <cstdio>
-
-namespace McCubes{
-
-const char *type_names[]      = {  /* names of scalar types */
-"invalid",
-"int8", "int16", "int32", "uint8", "uint16", "uint32", "float32", "float64"
-};
-
-const char *old_type_names[]  = {  /* old names of types for backward compatability */
-"invalid",
-"char", "short", "int", "uchar", "ushort", "uint", "float", "double"
-};
-
-int   ply_type_size[]   = {
-0, 1, 2, 4, 1, 2, 4, 4, 8
-};
-
-#define NO_OTHER_PROPS  -1
-
-#define DONT_STORE_PROP  0
-#define STORE_PROP       1
-
-#define OTHER_PROP       0
-#define NAMED_PROP       1
-
-/* returns 1 if strings are equal, 0 if not */
-int           equal_strings( const char * , const char * );
-
-/* find an element in a plyfile's list */
-PlyElement   *find_element( PlyFile * , const char * );
-
-/* find a property in an element's list */
-PlyProperty  *find_property( PlyElement * , const char * , int * );
-
-/* write to a file the word describing a PLY file data type */
-void          write_scalar_type( FILE * , int );
-
-/* read a line from a file and break it up into separate words */
-char*        *get_words( FILE * , int * , char ** );
-
-/* write an item to a file */
-void          write_binary_item( FILE * , int, unsigned int, double, int );
-void          write_ascii_item( FILE * , int, unsigned int, double, int );
-
-/* add information to a PLY file descriptor */
-void          add_element( PlyFile * , char ** , int );
-void          add_property( PlyFile * , char ** , int );
-void          add_comment( PlyFile * , const char * );
-void          add_obj_info( PlyFile * , const char * );
-
-/* copy a property */
-void          copy_property( PlyProperty * , PlyProperty * );
-
-/* store a value into where a pointer and a type specify */
-void          store_item( char * , int, int, unsigned int, double );
-
-/* return the value of a stored item */
-void          get_stored_item( void * , int, int * , unsigned int * , double * );
-
-/* return the value stored in an item, given ptr to it and its type */
-double        get_item_value( const char * , int );
-
-/* get binary or ascii item and store it according to ptr and type */
-void          get_ascii_item( const char * , int, int * , unsigned int * , double * );
-void          get_binary_item( FILE * , int, int * , unsigned int * , double * );
-
-/* get a bunch of elements from a file */
-void          ascii_get_element( PlyFile * , char * );
-void          binary_get_element( PlyFile * , char * );
-
-/* memory allocation */
-static char  *my_alloc( int, int, const char * );
-
-
-/*************/
-/*  Writing  */
-/*************/
-
-
-/******************************************************************************
-Given a file pointer, get ready to write PLY data to the file.
-
-Entry:
-fp         - the given file pointer
-nelems     - number of elements in object
-elem_names - list of element names
-file_type  - file type, either ascii or binary
-
-Exit:
-returns a pointer to a PlyFile, used to refer to this file, or NULL if error
-******************************************************************************/
-
-PlyFile *ply_write( FILE *fp, int nelems, char **elem_names, int file_type )
-{
-  int         i;
-  PlyFile    *plyfile;
-  PlyElement *elem;
-
-  /* check for NULL file pointer */
-  if ( fp == NULL )
-    return ( NULL );
-
-  /* create a record for this object */
-
-  plyfile = ( PlyFile *  ) myalloc ( sizeof ( PlyFile ) );
-  plyfile->file_type = file_type;
-  plyfile->num_comments = 0;
-  plyfile->num_obj_info = 0;
-  plyfile->num_elem_types = nelems;
-  plyfile->version = 1.0;
-  plyfile->fp = fp;
-  plyfile->other_elems = NULL;
-
-  /* tuck aside the names of the elements */
-
-  plyfile->elems = ( PlyElement *  *  ) myalloc ( sizeof ( PlyElement *  ) * nelems );
-  for ( i = 0; i < nelems; i++ )
-  {
-    elem = ( PlyElement *  ) myalloc ( sizeof ( PlyElement ) );
-    plyfile->elems[i] = elem;
-    elem->name = strdup ( elem_names[i] );
-    elem->num = 0;
-    elem->nprops = 0;
-  }
-
-  /* return pointer to the file descriptor */
-  return ( plyfile );
-}
-
-
-/******************************************************************************
-Open a polygon file for writing.
-
-Entry:
-filename   - name of file to read from
-nelems     - number of elements in object
-elem_names - list of element names
-file_type  - file type, either ascii or binary
-
-Exit:
-returns a file identifier, used to refer to this file, or NULL if error
-******************************************************************************/
-
-PlyFile *open_for_writing_ply( const char *filename, int nelems, char **elem_names, int file_type )
-{
-  PlyFile  *plyfile;
-  char     *name;
-  FILE     *fp;
-
-  /* tack on the extension .ply, if necessary */
-
-  name = ( char * ) myalloc ( sizeof ( char ) * ( (int)strlen ( filename ) + 5 ) );
-  strcpy ( name, filename );
-  if ( strlen ( name ) < 4 || strcmp ( name + strlen ( name ) - 4, ".ply" ) != 0 )
-    strcat ( name, ".ply" );
-
-  /* open the file for writing */
-
-  fp = fopen ( name, "w" );
-  if ( fp == NULL )
-  {
-    return ( NULL );
-  }
-
-  /* create the actual PlyFile structure */
-
-  plyfile = ply_write ( fp, nelems, elem_names, file_type );
-  if ( plyfile == NULL )
-    return ( NULL );
-
-  /* return pointer to the file descriptor */
-  return ( plyfile );
-}
-
-
-/******************************************************************************
-Describe an element, including its properties and how many will be written
-to the file.
-
-Entry:
-plyfile   - file identifier
-elem_name - name of element that information is being specified about
-nelems    - number of elements of this type to be written
-nprops    - number of properties contained in the element
-prop_list - list of properties
-******************************************************************************/
-
-void element_layout_ply( PlyFile *plyfile, const char *elem_name, int nelems, int nprops, PlyProperty *prop_list )
-{
-  int           i;
-  PlyElement   *elem;
-  PlyProperty  *prop;
-
-  /* look for appropriate element */
-  elem = find_element ( plyfile, elem_name );
-  if ( elem == NULL )
-  {
-    fprintf( stderr,"element_layout_ply: can't find element '%s'\n",elem_name );
-    exit ( -1 );
-  }
-
-  elem->num = nelems;
-
-  /* copy the list of properties */
-
-  elem->nprops = nprops;
-  elem->props = ( PlyProperty *  *  ) myalloc ( sizeof ( PlyProperty *  ) * nprops );
-  elem->store_prop = ( char * ) myalloc ( sizeof ( char ) * nprops );
-
-  for ( i = 0; i < nprops; i++ )
-  {
-    prop = ( PlyProperty *  ) myalloc ( sizeof ( PlyProperty ) );
-    elem->props[i] = prop;
-    elem->store_prop[i] = NAMED_PROP;
-    copy_property ( prop, &prop_list[i] );
-  }
-}
-
-
-/******************************************************************************
-Describe a property of an element.
-
-Entry:
-plyfile   - file identifier
-elem_name - name of element that information is being specified about
-prop      - the new property
-******************************************************************************/
-
-void ply_describe_property( PlyFile *plyfile, const char *elem_name, PlyProperty *prop )
-{
-  PlyElement   *elem;
-  PlyProperty  *elem_prop;
-
-  /* look for appropriate element */
-  elem = find_element ( plyfile, elem_name );
-  if ( elem == NULL )
-  {
-    fprintf( stderr, "ply_describe_property: can't find element '%s'\n",
-    elem_name );
-    return;
-  }
-
-  /* create room for new property */
-
-  if ( elem->nprops == 0 )
-  {
-    elem->props = ( PlyProperty *  *  ) myalloc ( sizeof ( PlyProperty *  ) );
-    elem->store_prop = ( char * ) myalloc ( sizeof ( char ) );
-    elem->nprops = 1;
-  }
-  else
-  {
-    elem->nprops++;
-    elem->props = ( PlyProperty *  *  )
-    realloc ( elem->props, sizeof ( PlyProperty *  ) * elem->nprops );
-    elem->store_prop = ( char * )
-    realloc ( elem->store_prop, sizeof ( char ) * elem->nprops );
-  }
-
-  /* copy the new property */
-
-  elem_prop = ( PlyProperty *  ) myalloc ( sizeof ( PlyProperty ) );
-  elem->props[elem->nprops - 1] = elem_prop;
-  elem->store_prop[elem->nprops - 1] = NAMED_PROP;
-  copy_property ( elem_prop, prop );
-}
-
-
-/******************************************************************************
-State how many of a given element will be written.
-
-Entry:
-plyfile   - file identifier
-elem_name - name of element that information is being specified about
-nelems    - number of elements of this type to be written
-******************************************************************************/
-
-void element_count_ply( PlyFile *plyfile, const char *elem_name, int nelems )
-{
-  PlyElement *elem;
-
-  /* look for appropriate element */
-  elem = find_element ( plyfile, elem_name );
-  if ( elem == NULL )
-  {
-    fprintf( stderr,"element_count_ply: can't find element '%s'\n",elem_name );
-    exit ( -1 );
-  }
-
-  elem->num = nelems;
-}
-
-
-/******************************************************************************
-Signal that we've described everything a PLY file's header and that the
-header should be written to the file.
-
-Entry:
-plyfile - file identifier
-******************************************************************************/
-
-void header_complete_ply( PlyFile *plyfile )
-{
-  int           i,j;
-  FILE         *fp  = plyfile->fp;
-  PlyElement   *elem;
-  PlyProperty  *prop;
-
-  fprintf ( fp, "ply\n" );
-
-  switch ( plyfile->file_type )
-  {
-    case PLY_ASCII:
-      fprintf ( fp, "format ascii 1.0\n" );
-      break;
-    case PLY_BINARY_BE:
-      fprintf ( fp, "format binary_big_endian 1.0\n" );
-      break;
-    case PLY_BINARY_LE:
-      fprintf ( fp, "format binary_little_endian 1.0\n" );
-      break;
-    default:
-      fprintf ( stderr, "ply_header_complete: bad file type = %d\n",
-      plyfile->file_type );
-      exit ( -1 );
-  }
-
-  /* write out the comments */
-
-  for ( i = 0; i < plyfile->num_comments; i++ )
-    fprintf ( fp, "comment %s\n", plyfile->comments[i] );
-
-  /* write out object information */
-
-  for ( i = 0; i < plyfile->num_obj_info; i++ )
-    fprintf ( fp, "obj_info %s\n", plyfile->obj_info[i] );
-
-  /* write out information about each element */
-
-  for ( i = 0; i < plyfile->num_elem_types; i++ )
-  {
-    elem = plyfile->elems[i];
-    fprintf ( fp, "element %s %d\n", elem->name, elem->num );
-
-    /* write out each property */
-    for ( j = 0; j < elem->nprops; j++ )
-    {
-      prop = elem->props[j];
-      if ( prop->is_list == PLY_LIST )
-      {
-        fprintf ( fp, "property list " );
-        write_scalar_type ( fp, prop->count_external );
-        fprintf ( fp, " " );
-        write_scalar_type ( fp, prop->external_type );
-        fprintf ( fp, " %s\n", prop->name );
-      }
-      else if ( prop->is_list == PLY_STRING )
-      {
-        fprintf ( fp, "property string" );
-        fprintf ( fp, " %s\n", prop->name );
-      }
-      else
-      {
-        fprintf ( fp, "property " );
-        write_scalar_type ( fp, prop->external_type );
-        fprintf ( fp, " %s\n", prop->name );
-      }
-    }
-  }
-
-  fprintf ( fp, "end_header\n" );
-}
-
-
-/******************************************************************************
-Specify which elements are going to be written.  This should be called
-before a call to the routine ply_put_element().
-
-Entry:
-plyfile   - file identifier
-elem_name - name of element we're talking about
-******************************************************************************/
-
-void put_element_setup_ply( PlyFile *plyfile, const char *elem_name )
-{
-  PlyElement *elem;
-
-  elem = find_element ( plyfile, elem_name );
-  if ( elem == NULL )
-  {
-    fprintf( stderr, "put_element_setup_ply: can't find element '%s'\n", elem_name );
-    exit ( -1 );
-  }
-
-  plyfile->which_elem = elem;
-}
-
-
-/******************************************************************************
-Write an element to the file.  This routine assumes that we're
-writing the type of element specified in the last call to the routine
-put_element_setup_ply().
-
-Entry:
-plyfile  - file identifier
-elem_ptr - pointer to the element
-******************************************************************************/
-
-void put_element_ply( PlyFile *plyfile, void *elem_ptr )
-{
-  int           j,k;
-  FILE         *fp  = plyfile->fp;
-  PlyElement   *elem;
-  PlyProperty  *prop;
-  char         *item;
-  char         *elem_data;
-  char*        *item_ptr;
-  int           list_count;
-  int           item_size;
-  int           int_val;
-  unsigned int uint_val;
-  double  double_val;
-  char*  *other_ptr;
-
-  elem = plyfile->which_elem;
-  elem_data = ( char * ) elem_ptr;
-  other_ptr = ( char * *  ) ( ( ( char * ) elem_ptr ) + elem->other_offset );
-
-  /* write out either to an ascii or binary file */
-
-  if ( plyfile->file_type == PLY_ASCII )
-  {
-    /* write an ascii file */
-
-    /* write out each property of the element */
-    for ( j = 0; j < elem->nprops; j++ )
-    {
-      prop = elem->props[j];
-
-      if ( elem->store_prop[j] == OTHER_PROP )
-        elem_data = *other_ptr;
-      else
-        elem_data = ( char * ) elem_ptr;
-
-      if ( prop->is_list == PLY_LIST )
-      {
-        /* list */
-        item = elem_data + prop->count_offset;
-        get_stored_item ( ( void * ) item, prop->count_internal,
-        &int_val, &uint_val, &double_val );
-        write_ascii_item ( fp, int_val, uint_val, double_val,
-        prop->count_external );
-        list_count = uint_val;
-        item_ptr = ( char * *  ) ( elem_data + prop->offset );
-        item = item_ptr[0];
-        item_size = ply_type_size[prop->internal_type];
-        for ( k = 0; k < list_count; k++ )
-        {
-          get_stored_item ( ( void * ) item, prop->internal_type,
-          &int_val, &uint_val, &double_val );
-          write_ascii_item ( fp, int_val, uint_val, double_val,
-          prop->external_type );
-          item += item_size;
-        }
-      }
-      else if ( prop->is_list == PLY_STRING )
-      {
-        /* string */
-        char*  *str;
-        item = elem_data + prop->offset;
-        str = ( char * *  ) item;
-        fprintf ( fp, "\"%s\"", *str );
-      }
-      else
-      {
-        /* scalar */
-        item = elem_data + prop->offset;
-        get_stored_item ( ( void * ) item, prop->internal_type,
-        &int_val, &uint_val, &double_val );
-        write_ascii_item ( fp, int_val, uint_val, double_val,
-        prop->external_type );
-      }
-    }
-
-    fprintf ( fp, "\n" );
-  }
-  else
-  {
-    /* write a binary file */
-
-    /* write out each property of the element */
-    for ( j = 0; j < elem->nprops; j++ )
-    {
-      prop = elem->props[j];
-      if ( elem->store_prop[j] == OTHER_PROP )
-        elem_data = *other_ptr;
-      else
-        elem_data = ( char * ) elem_ptr;
-      if ( prop->is_list == PLY_LIST )
-      {
-        /* list */
-        item = elem_data + prop->count_offset;
-        item_size = ply_type_size[prop->count_internal];
-        get_stored_item ( ( void * ) item, prop->count_internal,
-        &int_val, &uint_val, &double_val );
-        write_binary_item ( fp, int_val, uint_val, double_val,
-        prop->count_external );
-        list_count = uint_val;
-        item_ptr = ( char * *  ) ( elem_data + prop->offset );
-        item = item_ptr[0];
-        item_size = ply_type_size[prop->internal_type];
-        for ( k = 0; k < list_count; k++ )
-        {
-          get_stored_item ( ( void * ) item, prop->internal_type,
-          &int_val, &uint_val, &double_val );
-          write_binary_item ( fp, int_val, uint_val, double_val,
-          prop->external_type );
-          item += item_size;
-        }
-      }
-      else if ( prop->is_list == PLY_STRING )
-      {
-        /* string */
-        int     len;
-        char*  *str;
-        item = elem_data + prop->offset;
-        str = ( char * *  ) item;
-
-        /* write the length */
-        len = (int)strlen( *str ) + 1;
-        fwrite ( &len, sizeof( int ), 1, fp );
-
-        /* write the string, including the null character */
-        fwrite ( *str, len, 1, fp );
-      }
-      else
-      {
-        /* scalar */
-        item = elem_data + prop->offset;
-        item_size = ply_type_size[prop->internal_type];
-        get_stored_item ( ( void * ) item, prop->internal_type,
-        &int_val, &uint_val, &double_val );
-        write_binary_item ( fp, int_val, uint_val, double_val,
-        prop->external_type );
-      }
-    }
-  }
-}
-
-
-
-
-
-
-/*************/
-/*  Reading  */
-/*************/
-
-
-
-/******************************************************************************
-Given a file pointer, get ready to read PLY data from the file.
-
-Entry:
-fp - the given file pointer
-
-Exit:
-nelems     - number of elements in object
-elem_names - list of element names
-returns a pointer to a PlyFile, used to refer to this file, or NULL if error
-******************************************************************************/
-
-PlyFile *ply_read( FILE *fp, int *nelems, char ***elem_names )
-{
-  int         i,j;
-  PlyFile    *plyfile;
-  int         nwords;
-  char*      *words;
-  int         found_format  = 0;
-  char*      *elist;
-  PlyElement *elem;
-  char       *orig_line;
-
-  /* check for NULL file pointer */
-  if ( fp == NULL )
-    return ( NULL );
-
-  /* create record for this object */
-
-  plyfile = ( PlyFile *  ) myalloc ( sizeof ( PlyFile ) );
-  plyfile->num_elem_types = 0;
-  plyfile->comments = NULL;
-  plyfile->num_comments = 0;
-  plyfile->obj_info = NULL;
-  plyfile->num_obj_info = 0;
-  plyfile->fp = fp;
-  plyfile->other_elems = NULL;
-  plyfile->rule_list = NULL;
-
-  /* read and parse the file's header */
-
-  words = get_words ( plyfile->fp, &nwords, &orig_line );
-  if ( !words || !equal_strings ( words[0], "ply" ) )
-    return ( NULL );
-
-  while ( words )
-  {
-    /* parse words */
-
-    if ( equal_strings ( words[0], "format" ) )
-    {
-      if ( nwords != 3 )
-        return ( NULL );
-      if ( equal_strings ( words[1], "ascii" ) )
-        plyfile->file_type = PLY_ASCII;
-      else if ( equal_strings ( words[1], "binary_big_endian" ) )
-        plyfile->file_type = PLY_BINARY_BE;
-      else if ( equal_strings ( words[1], "binary_little_endian" ) )
-        plyfile->file_type = PLY_BINARY_LE;
-      else
-        return ( NULL );
-      plyfile->version = ( float ) atof ( words[2] );
-      found_format = 1;
-    }
-    else if ( equal_strings ( words[0], "element" ) )
-      add_element ( plyfile, words, nwords );
-    else if ( equal_strings ( words[0], "property" ) )
-      add_property ( plyfile, words, nwords );
-    else if ( equal_strings ( words[0], "comment" ) )
-      add_comment ( plyfile, orig_line );
-    else if ( equal_strings ( words[0], "obj_info" ) )
-      add_obj_info ( plyfile, orig_line );
-    else if ( equal_strings ( words[0], "end_header" ) )
-      break;
-
-    /* free up words space */
-    free ( words );
-
-    words = get_words ( plyfile->fp, &nwords, &orig_line );
-  }
-
-  /* create tags for each property of each element, to be used */
-  /* later to say whether or not to store each property for the user */
-
-  for ( i = 0; i < plyfile->num_elem_types; i++ )
-  {
-    elem = plyfile->elems[i];
-    elem->store_prop = ( char * ) myalloc ( sizeof ( char ) * elem->nprops );
-    for ( j = 0; j < elem->nprops; j++ )
-      elem->store_prop[j] = DONT_STORE_PROP;
-    elem->other_offset = NO_OTHER_PROPS; /* no "other" props by default */
-  }
-
-  /* set return values about the elements */
-
-  elist = ( char * *  ) myalloc ( sizeof ( char * ) * plyfile->num_elem_types );
-  for ( i = 0; i < plyfile->num_elem_types; i++ )
-    elist[i] = strdup ( plyfile->elems[i]->name );
-
-  *elem_names = elist;
-  *nelems = plyfile->num_elem_types;
-
-  /* return a pointer to the file's information */
-
-  return ( plyfile );
-}
-
-
-/******************************************************************************
-Open a polygon file for reading.
-
-Entry:
-filename - name of file to read from
-
-Exit:
-nelems     - number of elements in object
-elem_names - list of element names
-file_type  - file type, either ascii or binary
-version    - version number of PLY file
-returns a file identifier, used to refer to this file, or NULL if error
-******************************************************************************/
-
-PlyFile *ply_open_for_reading( const char *filename, int *nelems, char ***elem_names, int *file_type, float *version )
-{
-  FILE     *fp;
-  PlyFile  *plyfile;
-  char     *name;
-
-  /* tack on the extension .ply, if necessary */
-
-  name = ( char * ) myalloc ( sizeof ( char ) * ( (int)strlen ( filename ) + 5 ) );
-  strcpy ( name, filename );
-  if ( strlen ( name ) < 4 || strcmp ( name + strlen ( name ) - 4, ".ply" ) != 0 )
-    strcat ( name, ".ply" );
-
-  /* open the file for reading */
-
-  fp = fopen ( name, "r" );
-  if ( fp == NULL )
-    return ( NULL );
-
-  /* create the PlyFile data structure */
-
-  plyfile = ply_read ( fp, nelems, elem_names );
-
-  /* determine the file type and version */
-
-  *file_type = plyfile->file_type;
-  *version = plyfile->version;
-
-  /* return a pointer to the file's information */
-
-  return ( plyfile );
-}
-
-
-/******************************************************************************
-Get information about a particular element.
-
-Entry:
-plyfile   - file identifier
-elem_name - name of element to get information about
-
-Exit:
-nelems   - number of elements of this type in the file
-nprops   - number of properties
-returns a list of properties, or NULL if the file doesn't contain that elem
-******************************************************************************/
-
-PlyProperty **get_element_description_ply( PlyFile *plyfile, const char *elem_name, int *nelems, int *nprops )
-{
-  int             i;
-  PlyElement     *elem;
-  PlyProperty    *prop;
-  PlyProperty*   *prop_list;
-
-  /* find information about the element */
-  elem = find_element ( plyfile, elem_name );
-  if ( elem == NULL )
-    return ( NULL );
-
-  *nelems = elem->num;
-  *nprops = elem->nprops;
-
-  /* make a copy of the element's property list */
-  prop_list = ( PlyProperty *  *  ) myalloc ( sizeof ( PlyProperty *  ) * elem->nprops );
-  for ( i = 0; i < elem->nprops; i++ )
-  {
-    prop = ( PlyProperty *  ) myalloc ( sizeof ( PlyProperty ) );
-    copy_property ( prop, elem->props[i] );
-    prop_list[i] = prop;
-  }
-
-  /* return this duplicate property list */
-  return ( prop_list );
-}
-
-
-/******************************************************************************
-Specify which properties of an element are to be returned.  This should be
-called before a call to the routine get_element_ply().
-
-Entry:
-plyfile   - file identifier
-elem_name - which element we're talking about
-nprops    - number of properties
-prop_list - list of properties
-******************************************************************************/
-
-void get_element_setup_ply( PlyFile *plyfile, const char *elem_name, int nprops, PlyProperty *prop_list )
-{
-  int           i;
-  PlyElement   *elem;
-  PlyProperty  *prop;
-  int           index;
-
-  /* find information about the element */
-  elem = find_element ( plyfile, elem_name );
-  plyfile->which_elem = elem;
-
-  /* deposit the property information into the element's description */
-  for ( i = 0; i < nprops; i++ )
-  {
-    /* look for actual property */
-    prop = find_property ( elem, prop_list[i].name, &index );
-    if ( prop == NULL )
-    {
-      fprintf ( stderr, "Warning:  Can't find property '%s' in element '%s'\n",
-      prop_list[i].name, elem_name );
-      continue;
-    }
-
-    /* store its description */
-    prop->internal_type = prop_list[i].internal_type;
-    prop->offset = prop_list[i].offset;
-    prop->count_internal = prop_list[i].count_internal;
-    prop->count_offset = prop_list[i].count_offset;
-
-    /* specify that the user wants this property */
-    elem->store_prop[index] = STORE_PROP;
-  }
-}
-
-
-/******************************************************************************
-Specify a property of an element that is to be returned.  This should be
-called (usually multiple times) before a call to the routine ply_get_element().
-This routine should be used in preference to the less flexible old routine
-called ply_get_element_setup().
-
-Entry:
-plyfile   - file identifier
-elem_name - which element we're talking about
-prop      - property to add to those that will be returned
-******************************************************************************/
-
-void ply_get_property( PlyFile *plyfile, const char *elem_name, PlyProperty *prop )
-{
-  PlyElement   *elem;
-  PlyProperty  *prop_ptr;
-  int           index;
-
-  /* find information about the element */
-  elem = find_element ( plyfile, elem_name );
-  plyfile->which_elem = elem;
-
-  /* deposit the property information into the element's description */
-
-  prop_ptr = find_property ( elem, prop->name, &index );
-  if ( prop_ptr == NULL )
-  {
-    fprintf ( stderr, "Warning:  Can't find property '%s' in element '%s'\n",
-    prop->name, elem_name );
-    return;
-  }
-  prop_ptr->internal_type = prop->internal_type;
-  prop_ptr->offset = prop->offset;
-  prop_ptr->count_internal = prop->count_internal;
-  prop_ptr->count_offset = prop->count_offset;
-
-  /* specify that the user wants this property */
-  elem->store_prop[index] = STORE_PROP;
-}
-
-
-/******************************************************************************
-Read one element from the file.  This routine assumes that we're reading
-the type of element specified in the last call to the routine
-ply_get_element_setup().
-
-Entry:
-plyfile  - file identifier
-elem_ptr - pointer to location where the element information should be put
-******************************************************************************/
-
-void ply_get_element( PlyFile *plyfile, void *elem_ptr )
-{
-  if ( plyfile->file_type == PLY_ASCII )
-    ascii_get_element ( plyfile, ( char * ) elem_ptr );
-  else
-    binary_get_element ( plyfile, ( char * ) elem_ptr );
-}
-
-
-/******************************************************************************
-Extract the comments from the header information of a PLY file.
-
-Entry:
-plyfile - file identifier
-
-Exit:
-num_comments - number of comments returned
-returns a pointer to a list of comments
-******************************************************************************/
-
-char **get_comments_ply( PlyFile *plyfile, int *num_comments )
-{
-  *num_comments = plyfile->num_comments;
-  return ( plyfile->comments );
-}
-
-
-/******************************************************************************
-Extract the object information (arbitrary text) from the header information
-of a PLY file.
-
-Entry:
-plyfile - file identifier
-
-Exit:
-num_obj_info - number of lines of text information returned
-returns a pointer to a list of object info lines
-******************************************************************************/
-
-char **get_obj_info_ply( PlyFile *plyfile, int *num_obj_info )
-{
-  *num_obj_info = plyfile->num_obj_info;
-  return ( plyfile->obj_info );
-}
-
-
-/******************************************************************************
-ake ready for "other" properties of an element-- those properties that
-the user has not explicitly asked for, but that are to be stashed away
-in a special structure to be carried along with the element's other
-information.
-
-Entry:
-plyfile - file identifier
-elem    - element for which we want to save away other properties
-******************************************************************************/
-
-void setup_other_props( PlyFile *plyfile, PlyElement *elem )
-{
-  int           i;
-  PlyProperty  *prop;
-  int           size  = 0;
-  int           type_size;
-
-  /* Examine each property in decreasing order of size. */
-  /* We do this so that all data types will be aligned by */
-  /* word, half-word, or whatever within the structure. */
-
-  for ( type_size = 8; type_size > 0; type_size /= 2 )
-  {
-    /* add up the space taken by each property, and save this information */
-    /* away in the property descriptor */
-
-    for ( i = 0; i < elem->nprops; i++ )
-    {
-      /* don't bother with properties we've been asked to store explicitly */
-      if ( elem->store_prop[i] )
-        continue;
-
-      prop = elem->props[i];
-
-      /* internal types will be same as external */
-      prop->internal_type = prop->external_type;
-      prop->count_internal = prop->count_external;
-
-      /* list case */
-      if ( prop->is_list == PLY_LIST )
-      {
-        /* pointer to list */
-        if ( type_size == sizeof ( void * ) )
-        {
-          prop->offset = size;
-          size += sizeof ( void * );    /* always use size of a pointer here */
-        }
-
-        /* count of number of list elements */
-        if ( type_size == ply_type_size[prop->count_external] )
-        {
-          prop->count_offset = size;
-          size += ply_type_size[prop->count_external];
-        }
-      }
-      /* string */
-      else if ( prop->is_list == PLY_STRING )
-      {
-        /* pointer to string */
-        if ( type_size == sizeof ( char * ) )
-        {
-          prop->offset = size;
-          size += sizeof ( char * );
-        }
-      }
-      /* scalar */
-      else if ( type_size == ply_type_size[prop->external_type] )
-      {
-        prop->offset = size;
-        size += ply_type_size[prop->external_type];
-      }
-    }
-  }
-
-  /* save the size for the other_props structure */
-  elem->other_size = size;
-}
-
-
-/******************************************************************************
-Specify that we want the "other" properties of an element to be tucked
-away within the user's structure.
-
-Entry:
-plyfile - file identifier
-elem    - the element that we want to store other_props in
-offset  - offset to where other_props will be stored inside user's structure
-
-Exit:
-returns pointer to structure containing description of other_props
-******************************************************************************/
-
-static PlyOtherProp *get_other_properties( PlyFile *plyfile, PlyElement *elem, int offset )
-{
-  int           i;
-  PlyOtherProp *other;
-  PlyProperty  *prop;
-  int           nprops;
-
-  /* remember that this is the "current" element */
-  plyfile->which_elem = elem;
-
-  /* save the offset to where to store the other_props */
-  elem->other_offset = offset;
-
-  /* place the appropriate pointers, etc. in the element's property list */
-  setup_other_props ( plyfile, elem );
-
-  /* create structure for describing other_props */
-  other = ( PlyOtherProp *  ) myalloc ( sizeof ( PlyOtherProp ) );
-  other->name = strdup ( elem->name );
-#if 0
-if (elem->other_offset == NO_OTHER_PROPS) {
-other->size = 0;
-other->props = NULL;
-other->nprops = 0;
-return (other);
-}
-#endif
-  other->size = elem->other_size;
-  other->props = ( PlyProperty *  *  ) myalloc ( sizeof( PlyProperty ) * elem->nprops );
-
-  /* save descriptions of each "other" property */
-  nprops = 0;
-  for ( i = 0; i < elem->nprops; i++ )
-  {
-    if ( elem->store_prop[i] )
-      continue;
-    prop = ( PlyProperty *  ) myalloc ( sizeof ( PlyProperty ) );
-    copy_property ( prop, elem->props[i] );
-    other->props[nprops] = prop;
-    nprops++;
-  }
-  other->nprops = nprops;
-
-  /* set other_offset pointer appropriately if there are NO other properties */
-  if ( other->nprops == 0 )
-  {
-    elem->other_offset = NO_OTHER_PROPS;
-  }
-
-  /* return structure */
-  return ( other );
-}
-
-
-/******************************************************************************
-Specify that we want the "other" properties of an element to be tucked
-away within the user's structure.  The user needn't be concerned for how
-these properties are stored.
-
-Entry:
-plyfile   - file identifier
-elem_name - name of element that we want to store other_props in
-offset    - offset to where other_props will be stored inside user's structure
-
-Exit:
-returns pointer to structure containing description of other_props
-******************************************************************************/
-
-PlyOtherProp *ply_get_other_properties( PlyFile *plyfile, const char *elem_name, int offset )
-{
-  PlyElement   *elem;
-  PlyOtherProp *other;
-
-  /* find information about the element */
-  elem = find_element ( plyfile, elem_name );
-  if ( elem == NULL )
-  {
-    fprintf ( stderr, "ply_get_other_properties: Can't find element '%s'\n",
-    elem_name );
-    return ( NULL );
-  }
-
-  other = get_other_properties ( plyfile, elem, offset );
-  return ( other );
-}
-
-
-
-
-/*************************/
-/*  Other Element Stuff  */
-/*************************/
-
-
-
-
-
-/******************************************************************************
-Grab all the data for the current element that a user does not want to
-explicitly read in.  Stores this in the PLY object's data structure.
-
-Entry:
-plyfile - pointer to file
-
-Exit:
-returns pointer to ALL the "other" element data for this PLY file
-******************************************************************************/
-
-PlyOtherElems *get_other_element_ply( PlyFile *plyfile )
-{
-  int             i;
-  PlyElement     *elem;
-  char           *elem_name;
-  int             elem_count;
-  PlyOtherElems  *other_elems;
-  OtherElem      *other;
-
-  elem = plyfile->which_elem;
-  elem_name = elem->name;
-  elem_count = elem->num;
-
-  /* create room for the new "other" element, initializing the */
-  /* other data structure if necessary */
-
-  if ( plyfile->other_elems == NULL )
-  {
-    plyfile->other_elems = ( PlyOtherElems *  ) myalloc ( sizeof ( PlyOtherElems ) );
-    other_elems = plyfile->other_elems;
-    other_elems->other_list = ( OtherElem *  ) myalloc ( sizeof ( OtherElem ) );
-    other = &( other_elems->other_list[0] );
-    other_elems->num_elems = 1;
-  }
-  else
-  {
-    other_elems = plyfile->other_elems;
-    other_elems->other_list = ( OtherElem *  ) realloc ( other_elems->other_list,
-    sizeof ( OtherElem ) * other_elems->num_elems + 1 );
-    other = &( other_elems->other_list[other_elems->num_elems] );
-    other_elems->num_elems++;
-  }
-
-  /* count of element instances in file */
-  other->elem_count = elem_count;
-
-  /* save name of element */
-  other->elem_name = strdup ( elem_name );
-
-  /* create a list to hold all the current elements */
-  other->other_data = ( OtherData *  *  )
-  malloc ( sizeof ( OtherData *  ) * other->elem_count );
-
-  /* set up for getting elements */
-  other->other_props = ply_get_other_properties ( plyfile, elem_name,
-  offsetof( OtherData,other_props ) );
-
-  /* grab all these elements */
-  for ( i = 0; i < other->elem_count; i++ )
-  {
-    /* grab and element from the file */
-    other->other_data[i] = ( OtherData *  ) malloc ( sizeof ( OtherData ) );
-    ply_get_element ( plyfile, ( void * ) other->other_data[i] );
-  }
-
-  /* return pointer to the other elements data */
-  return ( other_elems );
-}
-
-
-/******************************************************************************
-Write out the "other" elements specified for this PLY file.
-
-Entry:
-plyfile - pointer to PLY file to write out other elements for
-******************************************************************************/
-
-void put_other_elements_ply( PlyFile *plyfile )
-{
-  int         i,j;
-  OtherElem  *other;
-
-  /* make sure we have other elements to write */
-  if ( plyfile->other_elems == NULL )
-    return;
-
-  /* write out the data for each "other" element */
-
-  for ( i = 0; i < plyfile->other_elems->num_elems; i++ )
-  {
-    other = &( plyfile->other_elems->other_list[i] );
-    put_element_setup_ply ( plyfile, other->elem_name );
-
-    /* write out each instance of the current element */
-    for ( j = 0; j < other->elem_count; j++ )
-      put_element_ply ( plyfile, ( void * ) other->other_data[j] );
-  }
-}
-
-
-/******************************************************************************
-Free up storage used by an "other" elements data structure.
-
-Entry:
-other_elems - data structure to free up
-******************************************************************************/
-
-void free_other_elements_ply( PlyOtherElems *other_elems )
-{
-}
-
-
-
-/*******************/
-/*  Miscellaneous  */
-/*******************/
-
-
-
-/******************************************************************************
-Close a PLY file.
-
-Entry:
-plyfile - identifier of file to close
-******************************************************************************/
-
-void ply_close( PlyFile *plyfile )
-{
-  fclose ( plyfile->fp );
-
-  /* free up memory associated with the PLY file */
-  free ( plyfile );
-}
-
-
-/******************************************************************************
-Get version number and file type of a PlyFile.
-
-Entry:
-ply - pointer to PLY file
-
-Exit:
-version - version of the file
-file_type - PLY_ASCII, PLY_BINARY_BE, or PLY_BINARY_LE
-******************************************************************************/
-
-void get_info_ply( PlyFile *ply, float *version, int *file_type )
-{
-  if ( ply == NULL )
-    return;
-
-  *version = ply->version;
-  *file_type = ply->file_type;
-}
-
-
-/******************************************************************************
-Compare two strings.  Returns 1 if they are the same, 0 if not.
-******************************************************************************/
-
-int equal_strings( const char *s1, const char *s2 )
-{
-  while ( *s1 && *s2 )
-    if ( *s1++ != *s2++ )
-      return ( 0 );
-
-  if ( *s1 != *s2 )
-    return ( 0 );
-  else
-    return ( 1 );
-}
-
-
-/******************************************************************************
-Re-create the command line that was used to invoke this program.
-
-Entry:
-argc - number of words in argv
-argv - array of words in command line
-******************************************************************************/
-
-char *recreate_command_line( int argc, char *argv[] )
-{
-  int   i;
-  char *line;
-  int   len = 0;
-
-  /* count total number of characters needed, including separating spaces */
-  for ( i = 0; i < argc; i++ )
-    len += (int)strlen( argv[i] ) + 1;
-
-  /* create empty line */
-  line = ( char * ) malloc ( sizeof( char ) * len );
-  line[0] = '\0';
-
-  /* repeatedly append argv */
-  for ( i = 0; i < argc; i++ )
-  {
-    strcat ( line, argv[i] );
-    if ( i != argc - 1 )
-      strcat ( line, " " );
-  }
-
-  return ( line );
-}
-
-
-/******************************************************************************
-Find an element from the element list of a given PLY object.
-
-Entry:
-plyfile - file id for PLY file
-element - name of element we're looking for
-
-Exit:
-returns the element, or NULL if not found
-******************************************************************************/
-
-PlyElement *find_element( PlyFile *plyfile, const char *element )
-{
-  int i;
-
-  for ( i = 0; i < plyfile->num_elem_types; i++ )
-    if ( equal_strings ( element, plyfile->elems[i]->name ) )
-      return ( plyfile->elems[i] );
-
-  return ( NULL );
-}
-
-
-/******************************************************************************
-Find a property in the list of properties of a given element.
-
-Entry:
-elem      - pointer to element in which we want to find the property
-prop_name - name of property to find
-
-Exit:
-index - index to position in list
-returns a pointer to the property, or NULL if not found
-******************************************************************************/
-
-PlyProperty *find_property( PlyElement *elem, const char *prop_name, int *index )
-{
-  int i;
-
-  for ( i = 0; i < elem->nprops; i++ )
-    if ( equal_strings ( prop_name, elem->props[i]->name ) )
-    {
-      *index = i;
-      return ( elem->props[i] );
-    }
-
-  *index = -1;
-  return ( NULL );
-}
-
-
-/******************************************************************************
-Read an element from an ascii file.
-
-Entry:
-plyfile  - file identifier
-elem_ptr - pointer to element
-******************************************************************************/
-
-void ascii_get_element( PlyFile *plyfile, char *elem_ptr )
-{
-  int           j,k;
-  PlyElement   *elem=NULL;
-  PlyProperty  *prop=NULL;
-  char*        *words=NULL;
-  int           nwords;
-  int           which_word;
-  char         *elem_data=NULL,*item=NULL;
-  char         *item_ptr=NULL;
-  int           item_size;
-  int           int_val;
-  unsigned int uint_val;
-  double  double_val;
-  int     list_count;
-  int     store_it;
-  char*  *store_array=NULL;
-  char   *orig_line=NULL;
-  char   *other_data=NULL;
-  int     other_flag;
-
-  /* the kind of element we're reading currently */
-  elem = plyfile->which_elem;
-
-  /* do we need to setup for other_props? */
-
-  if ( elem->other_offset != NO_OTHER_PROPS )
-  {
-    char*  *ptr;
-    other_flag = 1;
-    /* make room for other_props */
-    other_data = ( char * ) myalloc ( elem->other_size );
-    /* store pointer in user's structure to the other_props */
-    ptr = ( char * *  ) ( elem_ptr + elem->other_offset );
-    *ptr = other_data;
-  }
-  else
-    other_flag = 0;
-
-  /* read in the element */
-
-  words = get_words ( plyfile->fp, &nwords, &orig_line );
-  if ( words == NULL )
-  {
-    fprintf ( stderr, "ply_get_element: unexpected end of file\n" );
-    exit ( -1 );
-  }
-
-  which_word = 0;
-
-  for ( j = 0; j < elem->nprops; j++ )
-  {
-    prop = elem->props[j];
-    store_it = ( elem->store_prop[j] | other_flag );
-
-    /* store either in the user's structure or in other_props */
-    if ( elem->store_prop[j] )
-      elem_data = elem_ptr;
-    else
-      elem_data = other_data;
-
-    if ( prop->is_list == PLY_LIST )
-    {
-      /* a list */
-
-      /* get and store the number of items in the list */
-      get_ascii_item ( words[which_word++], prop->count_external,
-      &int_val, &uint_val, &double_val );
-      if ( store_it )
-      {
-        item = elem_data + prop->count_offset;
-        store_item( item, prop->count_internal, int_val, uint_val, double_val );
-      }
-
-      /* allocate space for an array of items and store a ptr to the array */
-      list_count = int_val;
-      item_size = ply_type_size[prop->internal_type];
-      store_array = ( char * *  ) ( elem_data + prop->offset );
-
-      if ( list_count == 0 )
-      {
-        if ( store_it )
-          *store_array = NULL;
-      }
-      else
-      {
-        if ( store_it )
-        {
-          item_ptr = ( char * ) myalloc ( sizeof ( char ) * item_size * list_count );
-          item = item_ptr;
-          *store_array = item_ptr;
-        }
-
-        /* read items and store them into the array */
-        for ( k = 0; k < list_count; k++ )
-        {
-          get_ascii_item ( words[which_word++], prop->external_type,
-          &int_val, &uint_val, &double_val );
-          if ( store_it )
-          {
-            store_item ( item, prop->internal_type,
-            int_val, uint_val, double_val );
-            item += item_size;
-          }
-        }
-      }
-    }
-    else if ( prop->is_list == PLY_STRING )
-    {
-      /* a string */
-      if ( store_it )
-      {
-        char   *str;
-        char*  *str_ptr;
-        str = strdup ( words[which_word++] );
-        item = elem_data + prop->offset;
-        str_ptr = ( char * *  ) item;
-        *str_ptr = str;
-      }
-      else
-      {
-        which_word++;
-      }
-    }
-    else
-    {
-      /* a scalar */
-      get_ascii_item ( words[which_word++], prop->external_type,
-      &int_val, &uint_val, &double_val );
-      if ( store_it )
-      {
-        item = elem_data + prop->offset;
-        store_item ( item, prop->internal_type, int_val, uint_val, double_val );
-      }
-    }
-  }
-
-  free ( words );
-}
-
-
-/******************************************************************************
-Read an element from a binary file.
-
-Entry:
-plyfile  - file identifier
-elem_ptr - pointer to an element
-******************************************************************************/
-
-void binary_get_element( PlyFile *plyfile, char *elem_ptr )
-{
-  int           j,k;
-  PlyElement   *elem= NULL;
-  PlyProperty  *prop= NULL;
-  FILE         *fp  = plyfile->fp;
-  char         *elem_data;
-  char         *item = NULL;
-  char         *item_ptr= NULL;
-  int           item_size;
-  int           int_val;
-  unsigned int uint_val;
-  double  double_val;
-  int     list_count;
-  int     store_it;
-  char*  *store_array= NULL;
-  char   *other_data= NULL;
-  int     other_flag;
-
-  /* the kind of element we're reading currently */
-  elem = plyfile->which_elem;
-
-  /* do we need to setup for other_props? */
-
-  if ( elem->other_offset != NO_OTHER_PROPS )
-  {
-    char*  *ptr;
-    other_flag = 1;
-    /* make room for other_props */
-    other_data = ( char * ) myalloc ( elem->other_size );
-    /* store pointer in user's structure to the other_props */
-    ptr = ( char * *  ) ( elem_ptr + elem->other_offset );
-    *ptr = other_data;
-  }
-  else
-    other_flag = 0;
-
-  /* read in a number of elements */
-
-  for ( j = 0; j < elem->nprops; j++ )
-  {
-    prop = elem->props[j];
-    store_it = ( elem->store_prop[j] | other_flag );
-
-    /* store either in the user's structure or in other_props */
-    if ( elem->store_prop[j] )
-      elem_data = elem_ptr;
-    else
-      elem_data = other_data;
-
-    if ( prop->is_list == PLY_LIST )
-    {
-      /* list */
-
-      /* get and store the number of items in the list */
-      get_binary_item ( fp, prop->count_external,
-      &int_val, &uint_val, &double_val );
-      if ( store_it )
-      {
-        item = elem_data + prop->count_offset;
-        store_item( item, prop->count_internal, int_val, uint_val, double_val );
-      }
-
-      /* allocate space for an array of items and store a ptr to the array */
-      list_count = int_val;
-      item_size = ply_type_size[prop->internal_type];
-      store_array = ( char * *  ) ( elem_data + prop->offset );
-      if ( list_count == 0 )
-      {
-        if ( store_it )
-          *store_array = NULL;
-      }
-      else
-      {
-        if ( store_it )
-        {
-          item_ptr = ( char * ) myalloc ( sizeof ( char ) * item_size * list_count );
-          item = item_ptr;
-          *store_array = item_ptr;
-        }
-
-        /* read items and store them into the array */
-        for ( k = 0; k < list_count; k++ )
-        {
-          get_binary_item ( fp, prop->external_type,
-          &int_val, &uint_val, &double_val );
-          if ( store_it )
-          {
-            store_item ( item, prop->internal_type,
-            int_val, uint_val, double_val );
-            item += item_size;
-          }
-        }
-      }
-    }
-    else if ( prop->is_list == PLY_STRING )
-    {
-      /* string */
-      int   len;
-      char *str;
-      fread ( &len, sizeof( int ), 1, fp );
-      str = ( char * ) myalloc ( len );
-      fread ( str, len, 1, fp );
-      if ( store_it )
-      {
-        char*  *str_ptr;
-        item = elem_data + prop->offset;
-        str_ptr = ( char * *  ) item;
-        *str_ptr = str;
-      }
-    }
-    else
-    {
-      /* scalar */
-      get_binary_item ( fp, prop->external_type,
-      &int_val, &uint_val, &double_val );
-      if ( store_it )
-      {
-        item = elem_data + prop->offset;
-        store_item ( item, prop->internal_type, int_val, uint_val, double_val );
-      }
-    }
-  }
-}
-
-
-/******************************************************************************
-Write to a file the word that represents a PLY data type.
-
-Entry:
-fp   - file pointer
-code - code for type
-******************************************************************************/
-
-void write_scalar_type( FILE *fp, int code )
-{
-  /* make sure this is a valid code */
-
-  if ( code <= StartType || code >= EndType )
-  {
-    fprintf ( stderr, "write_scalar_type: bad data code = %d\n", code );
-    exit ( -1 );
-  }
-
-  /* write the code to a file */
-
-  fprintf ( fp, "%s", type_names[code] );
-}
-
-
-/******************************************************************************
-Get a text line from a file and break it up into words.
-
-IMPORTANT: The calling routine should call "free" on the returned pointer once
-finished with it.
-
-Entry:
-fp - file to read from
-
-Exit:
-nwords    - number of words returned
-orig_line - the original line of characters
-returns a list of words from the line, or NULL if end-of-file
-******************************************************************************/
-
-char **get_words( FILE *fp, int *nwords, char **orig_line )
-{
-#define BIG_STRING 4096
-  static char str[BIG_STRING];
-  static char str_copy[BIG_STRING];
-  char*      *words;
-  int         max_words = 10;
-  int         num_words = 0;
-  char       *ptr,*ptr2;
-  char       *result;
-
-  words = ( char * *  ) myalloc ( sizeof ( char * ) * max_words );
-
-  /* read in a line */
-  result = fgets ( str, BIG_STRING, fp );
-  if ( result == NULL )
-  {
-    *nwords = 0;
-    *orig_line = NULL;
-    return ( NULL );
-  }
-
-  /* convert line-feed and tabs into spaces */
-  /* (this guarentees that there will be a space before the */
-  /*  null character at the end of the string) */
-
-  str[BIG_STRING - 2] = ' ';
-  str[BIG_STRING - 1] = '\0';
-
-  for ( ptr = str, ptr2 = str_copy; *ptr != '\0'; ptr++, ptr2++ )
-  {
-    *ptr2 = *ptr;
-    if ( *ptr == '\t' )
-    {
-      *ptr = ' ';
-      *ptr2 = ' ';
-    }
-    else if ( *ptr == '\n' )
-    {
-      *ptr = ' ';
-      *ptr2 = ' ';
-      break;
-    }
-    else if ( *ptr == '\r' )
-    {
-      *ptr = ' ';
-      *ptr2 = '\0';
-    }
-  }
-
-  /* find the words in the line */
-
-  ptr = str;
-  while ( *ptr != '\0' )
-  {
-    /* jump over leading spaces */
-    while ( *ptr == ' ' )
-      ptr++;
-
-    /* break if we reach the end */
-    if ( *ptr == '\0' )
-      break;
-
-    /* allocate more room for words if necessary */
-    if ( num_words >= max_words )
-    {
-      max_words += 10;
-      words = ( char * *  ) realloc ( words, sizeof ( char * ) * max_words );
-    }
-
-    if ( *ptr == '\"' )
-    {
-      /* a quote indidicates that we have a string */
-
-      /* skip over leading quote */
-      ptr++;
-
-      /* save pointer to beginning of word */
-      words[num_words++] = ptr;
-
-      /* find trailing quote or end of line */
-      while ( *ptr != '\"' && *ptr != '\0' )
-        ptr++;
-
-      /* replace quote with a null character to mark the end of the word */
-      /* if we are not already at the end of the line */
-      if ( *ptr != '\0' )
-        *ptr++ = '\0';
-    }
-    else
-    {
-      /* non-string */
-
-      /* save pointer to beginning of word */
-      words[num_words++] = ptr;
-
-      /* jump over non-spaces */
-      while ( *ptr != ' ' )
-        ptr++;
-
-      /* place a null character here to mark the end of the word */
-      *ptr++ = '\0';
-    }
-  }
-
-  /* return the list of words */
-  *nwords = num_words;
-  *orig_line = str_copy;
-  return ( words );
-}
-
-
-/******************************************************************************
-Return the value of an item, given a pointer to it and its type.
-
-Entry:
-item - pointer to item
-type - data type that "item" points to
-
-Exit:
-returns a double-precision float that contains the value of the item
-******************************************************************************/
-
-double get_item_value( const char *item, int type )
-{
-  unsigned char *puchar;
-  char       *pchar;
-  short int  *pshort;
-  unsigned short int *pushort;
-  int  *pint;
-  unsigned int *puint;
-  float  *pfloat;
-  double *pdouble;
-  int     int_value;
-  unsigned int uint_value;
-  double  double_value;
-
-  switch ( type )
-  {
-    case Int8:
-      pchar = ( char * ) item;
-      int_value = *pchar;
-      return ( ( double ) int_value );
-    case Uint8:
-      puchar = ( unsigned char * ) item;
-      int_value = *puchar;
-      return ( ( double ) int_value );
-    case Int16:
-      pshort = ( short int * ) item;
-      int_value = *pshort;
-      return ( ( double ) int_value );
-    case Uint16:
-      pushort = ( unsigned short int * ) item;
-      int_value = *pushort;
-      return ( ( double ) int_value );
-    case Int32:
-      pint = ( int * ) item;
-      int_value = *pint;
-      return ( ( double ) int_value );
-    case Uint32:
-      puint = ( unsigned int * ) item;
-      uint_value = *puint;
-      return ( ( double ) uint_value );
-    case Float32:
-      pfloat = ( float * ) item;
-      double_value = *pfloat;
-      return ( double_value );
-    case Float64:
-      pdouble = ( double * ) item;
-      double_value = *pdouble;
-      return ( double_value );
-    default:
-      fprintf ( stderr, "get_item_value: bad type = %d\n", type );
-      exit ( -1 );
-  }
-
-  return ( 0.0 );  /* never actually gets here */
-}
-
-
-/******************************************************************************
-Write out an item to a file as raw binary bytes.
-
-Entry:
-fp         - file to write to
-int_val    - integer version of item
-uint_val   - unsigned integer version of item
-double_val - double-precision float version of item
-type       - data type to write out
-******************************************************************************/
-
-void write_binary_item( FILE *fp, int int_val, unsigned int uint_val, double double_val, int type )
-{
-  unsigned char uchar_val;
-  char  char_val;
-  unsigned short ushort_val;
-  short short_val;
-  float float_val;
-
-  switch ( type )
-  {
-    case Int8:
-      char_val = int_val;
-      fwrite ( &char_val, 1, 1, fp );
-      break;
-    case Int16:
-      short_val = int_val;
-      fwrite ( &short_val, 2, 1, fp );
-      break;
-    case Int32:
-      fwrite ( &int_val, 4, 1, fp );
-      break;
-    case Uint8:
-      uchar_val = uint_val;
-      fwrite ( &uchar_val, 1, 1, fp );
-      break;
-    case Uint16:
-      ushort_val = uint_val;
-      fwrite ( &ushort_val, 2, 1, fp );
-      break;
-    case Uint32:
-      fwrite ( &uint_val, 4, 1, fp );
-      break;
-    case Float32:
-      float_val = ( float ) double_val;
-      fwrite ( &float_val, 4, 1, fp );
-      break;
-    case Float64:
-      fwrite ( &double_val, 8, 1, fp );
-      break;
-    default:
-      fprintf ( stderr, "write_binary_item: bad type = %d\n", type );
-      exit ( -1 );
-  }
-}
-
-
-/******************************************************************************
-Write out an item to a file as ascii characters.
-
-Entry:
-fp         - file to write to
-int_val    - integer version of item
-uint_val   - unsigned integer version of item
-double_val - double-precision float version of item
-type       - data type to write out
-******************************************************************************/
-
-void write_ascii_item( FILE *fp, int int_val, unsigned int uint_val, double double_val, int type )
-{
-  switch ( type )
-  {
-    case Int8:
-    case Int16:
-    case Int32:
-      fprintf ( fp, "%d ", int_val );
-      break;
-    case Uint8:
-    case Uint16:
-    case Uint32:
-      fprintf ( fp, "%u ", uint_val );
-      break;
-    case Float32:
-    case Float64:
-      fprintf ( fp, "%12f ", double_val );
-      break;
-    default:
-      fprintf ( stderr, "write_ascii_item: bad type = %d\n", type );
-      exit ( -1 );
-  }
-}
-
-
-/******************************************************************************
-Get the value of an item that is in memory, and place the result
-into an integer, an unsigned integer and a double.
-
-Entry:
-ptr  - pointer to the item
-type - data type supposedly in the item
-
-Exit:
-int_val    - integer value
-uint_val   - unsigned integer value
-double_val - double-precision floating point value
-******************************************************************************/
-
-void get_stored_item( void *ptr, int type, int *int_val, unsigned int *uint_val, double *double_val )
-{
-  switch ( type )
-  {
-    case Int8:
-      *int_val = *( ( char * ) ptr );
-      *uint_val = *int_val;
-      *double_val = *int_val;
-      break;
-    case Uint8:
-      *uint_val = *( ( unsigned char * ) ptr );
-      *int_val = *uint_val;
-      *double_val = *uint_val;
-      break;
-    case Int16:
-      *int_val = *( ( short int * ) ptr );
-      *uint_val = *int_val;
-      *double_val = *int_val;
-      break;
-    case Uint16:
-      *uint_val = *( ( unsigned short int * ) ptr );
-      *int_val = *uint_val;
-      *double_val = *uint_val;
-      break;
-    case Int32:
-      *int_val = *( ( int * ) ptr );
-      *uint_val = *int_val;
-      *double_val = *int_val;
-      break;
-    case Uint32:
-      *uint_val = *( ( unsigned int * ) ptr );
-      *int_val = *uint_val;
-      *double_val = *uint_val;
-      break;
-    case Float32:
-      *double_val = *( ( float * ) ptr );
-      *int_val = ( int ) *double_val;
-      *uint_val = ( unsigned int ) *double_val;
-      break;
-    case Float64:
-      *double_val = *( ( double * ) ptr );
-      *int_val = ( int ) *double_val;
-      *uint_val = ( unsigned int ) *double_val;
-      break;
-    default:
-      fprintf ( stderr, "get_stored_item: bad type = %d\n", type );
-      exit ( -1 );
-  }
-}
-
-
-/******************************************************************************
-Get the value of an item from a binary file, and place the result
-into an integer, an unsigned integer and a double.
-
-Entry:
-fp   - file to get item from
-type - data type supposedly in the word
-
-Exit:
-int_val    - integer value
-uint_val   - unsigned integer value
-double_val - double-precision floating point value
-******************************************************************************/
-
-void get_binary_item( FILE *fp, int type, int *int_val, unsigned int *uint_val, double *double_val )
-{
-  char  c[8];
-  void *ptr;
-
-  ptr = ( void * ) c;
-
-  switch ( type )
-  {
-    case Int8:
-      fread ( ptr, 1, 1, fp );
-      *int_val = *( ( char * ) ptr );
-      *uint_val = *int_val;
-      *double_val = *int_val;
-      break;
-    case Uint8:
-      fread ( ptr, 1, 1, fp );
-      *uint_val = *( ( unsigned char * ) ptr );
-      *int_val = *uint_val;
-      *double_val = *uint_val;
-      break;
-    case Int16:
-      fread ( ptr, 2, 1, fp );
-      *int_val = *( ( short int * ) ptr );
-      *uint_val = *int_val;
-      *double_val = *int_val;
-      break;
-    case Uint16:
-      fread ( ptr, 2, 1, fp );
-      *uint_val = *( ( unsigned short int * ) ptr );
-      *int_val = *uint_val;
-      *double_val = *uint_val;
-      break;
-    case Int32:
-      fread ( ptr, 4, 1, fp );
-      *int_val = *( ( int * ) ptr );
-      *uint_val = *int_val;
-      *double_val = *int_val;
-      break;
-    case Uint32:
-      fread ( ptr, 4, 1, fp );
-      *uint_val = *( ( unsigned int * ) ptr );
-      *int_val = *uint_val;
-      *double_val = *uint_val;
-      break;
-    case Float32:
-      fread ( ptr, 4, 1, fp );
-      *double_val = *( ( float * ) ptr );
-      *int_val = ( int ) *double_val;
-      *uint_val = ( unsigned int ) *double_val;
-      break;
-    case Float64:
-      fread ( ptr, 8, 1, fp );
-      *double_val = *( ( double * ) ptr );
-      *int_val = ( int ) *double_val;
-      *uint_val = ( unsigned int ) *double_val;
-      break;
-    default:
-      fprintf ( stderr, "get_binary_item: bad type = %d\n", type );
-      exit ( -1 );
-  }
-}
-
-
-/******************************************************************************
-Extract the value of an item from an ascii word, and place the result
-into an integer, an unsigned integer and a double.
-
-Entry:
-word - word to extract value from
-type - data type supposedly in the word
-
-Exit:
-int_val    - integer value
-uint_val   - unsigned integer value
-double_val - double-precision floating point value
-******************************************************************************/
-
-void get_ascii_item( const char *word, int type, int *int_val, unsigned int *uint_val, double *double_val )
-{
-  switch ( type )
-  {
-    case Int8:
-    case Uint8:
-    case Int16:
-    case Uint16:
-    case Int32:
-      *int_val = atoi ( word );
-      *uint_val = *int_val;
-      *double_val = *int_val;
-      break;
-
-    case Uint32:
-      *uint_val = strtoul ( word, ( char * *  ) NULL, 10 );
-      *int_val = *uint_val;
-      *double_val = *uint_val;
-      break;
-
-    case Float32:
-    case Float64:
-      *double_val = atof ( word );
-      *int_val = ( int ) *double_val;
-      *uint_val = ( unsigned int ) *double_val;
-      break;
-
-    default:
-      fprintf ( stderr, "get_ascii_item: bad type = %d\n", type );
-      exit ( -1 );
-  }
-}
-
-
-/******************************************************************************
-Store a value into a place being pointed to, guided by a data type.
-
-Entry:
-item       - place to store value
-type       - data type
-int_val    - integer version of value
-uint_val   - unsigned integer version of value
-double_val - double version of value
-
-Exit:
-item - pointer to stored value
-******************************************************************************/
-
-void store_item( char *item, int type, int int_val, unsigned int uint_val, double double_val )
-{
-  unsigned char *puchar;
-  short int  *pshort;
-  unsigned short int *pushort;
-  int  *pint;
-  unsigned int *puint;
-  float  *pfloat;
-  double *pdouble;
-
-  switch ( type )
-  {
-    case Int8:
-      *item = int_val;
-      break;
-    case Uint8:
-      puchar = ( unsigned char * ) item;
-      *puchar = uint_val;
-      break;
-    case Int16:
-      pshort = ( short * ) item;
-      *pshort = int_val;
-      break;
-    case Uint16:
-      pushort = ( unsigned short * ) item;
-      *pushort = uint_val;
-      break;
-    case Int32:
-      pint = ( int * ) item;
-      *pint = int_val;
-      break;
-    case Uint32:
-      puint = ( unsigned int * ) item;
-      *puint = uint_val;
-      break;
-    case Float32:
-      pfloat = ( float * ) item;
-      *pfloat = ( float ) double_val;
-      break;
-    case Float64:
-      pdouble = ( double * ) item;
-      *pdouble = double_val;
-      break;
-    default:
-      fprintf ( stderr, "store_item: bad type = %d\n", type );
-      exit ( -1 );
-  }
-}
-
-
-/******************************************************************************
-Add an element to a PLY file descriptor.
-
-Entry:
-plyfile - PLY file descriptor
-words   - list of words describing the element
-nwords  - number of words in the list
-******************************************************************************/
-
-void add_element( PlyFile *plyfile, char **words, int nwords )
-{
-  PlyElement *elem;
-
-  /* create the new element */
-  elem = ( PlyElement *  ) myalloc ( sizeof ( PlyElement ) );
-  elem->name = strdup ( words[1] );
-  elem->num = atoi ( words[2] );
-  elem->nprops = 0;
-
-  /* make room for new element in the object's list of elements */
-  if ( plyfile->num_elem_types == 0 )
-    plyfile->elems = ( PlyElement *  *  ) myalloc ( sizeof ( PlyElement *  ) );
-  else
-    plyfile->elems = ( PlyElement *  *  ) realloc ( plyfile->elems,
-    sizeof ( PlyElement *  ) * ( plyfile->num_elem_types + 1 ) );
-
-  /* add the new element to the object's list */
-  plyfile->elems[plyfile->num_elem_types] = elem;
-  plyfile->num_elem_types++;
-}
-
-
-/******************************************************************************
-Return the type of a property, given the name of the property.
-
-Entry:
-name - name of property type
-
-Exit:
-returns integer code for property, or 0 if not found
-******************************************************************************/
-
-int get_prop_type( const char *type_name )
-{
-  int i;
-
-  /* try to match the type name */
-  for ( i = StartType + 1; i < EndType; i++ )
-    if ( equal_strings ( type_name, type_names[i] ) )
-      return ( i );
-
-  /* see if we can match an old type name */
-  for ( i = StartType + 1; i < EndType; i++ )
-    if ( equal_strings ( type_name, old_type_names[i] ) )
-      return ( i );
-
-  /* if we get here, we didn't find the type */
-  return ( 0 );
-}
-
-
-/******************************************************************************
-Add a property to a PLY file descriptor.
-
-Entry:
-plyfile - PLY file descriptor
-words   - list of words describing the property
-nwords  - number of words in the list
-******************************************************************************/
-
-void add_property( PlyFile *plyfile, char **words, int nwords )
-{
-  PlyProperty  *prop;
-  PlyElement   *elem;
-
-  /* create the new property */
-
-  prop = ( PlyProperty *  ) myalloc ( sizeof ( PlyProperty ) );
-
-  if ( equal_strings ( words[1], "list" ) )
-  {
-    /* list */
-    prop->count_external = get_prop_type ( words[2] );
-    prop->external_type = get_prop_type ( words[3] );
-    prop->name = strdup ( words[4] );
-    prop->is_list = PLY_LIST;
-  }
-  else if ( equal_strings ( words[1], "string" ) )
-  {
-    /* string */
-    prop->count_external = Int8;
-    prop->external_type = Int8;
-    prop->name = strdup ( words[2] );
-    prop->is_list = PLY_STRING;
-  }
-  else
-  {
-    /* scalar */
-    prop->external_type = get_prop_type ( words[1] );
-    prop->name = strdup ( words[2] );
-    prop->is_list = PLY_SCALAR;
-  }
-
-  /* add this property to the list of properties of the current element */
-
-  elem = plyfile->elems[plyfile->num_elem_types - 1];
-
-  if ( elem->nprops == 0 )
-    elem->props = ( PlyProperty *  *  ) myalloc ( sizeof ( PlyProperty *  ) );
-  else
-    elem->props = ( PlyProperty *  *  ) realloc ( elem->props,
-    sizeof ( PlyProperty *  ) * ( elem->nprops + 1 ) );
-
-  elem->props[elem->nprops] = prop;
-  elem->nprops++;
-}
-
-
-/******************************************************************************
-Add a comment to a PLY file descriptor.
-
-Entry:
-plyfile - PLY file descriptor
-line    - line containing comment
-******************************************************************************/
-
-void add_comment( PlyFile *plyfile, const char *line )
-{
-  int i;
-
-  /* skip over "comment" and leading spaces and tabs */
-  i = 7;
-  while ( line[i] == ' ' || line[i] == '\t' )
-    i++;
-
-  append_comment_ply ( plyfile, &line[i] );
-}
-
-
-/******************************************************************************
-Add a some object information to a PLY file descriptor.
-
-Entry:
-plyfile - PLY file descriptor
-line    - line containing text info
-******************************************************************************/
-
-void add_obj_info( PlyFile *plyfile, const char *line )
-{
-  int i;
-
-  /* skip over "obj_info" and leading spaces and tabs */
-  i = 8;
-  while ( line[i] == ' ' || line[i] == '\t' )
-    i++;
-
-  append_obj_info_ply ( plyfile, &line[i] );
-}
-
-
-/******************************************************************************
-Copy a property.
-******************************************************************************/
-
-void copy_property( PlyProperty *dest, PlyProperty *src )
-{
-  dest->name = strdup ( src->name );
-  dest->external_type = src->external_type;
-  dest->internal_type = src->internal_type;
-  dest->offset = src->offset;
-
-  dest->is_list = src->is_list;
-  dest->count_external = src->count_external;
-  dest->count_internal = src->count_internal;
-  dest->count_offset = src->count_offset;
-}
-
-
-/******************************************************************************
-Allocate some memory.
-
-Entry:
-size  - amount of memory requested (in bytes)
-lnum  - line number from which memory was requested
-fname - file name from which memory was requested
-******************************************************************************/
-
-static char *my_alloc( int size, int lnum, const char *fname )
-{
-  char *ptr;
-
-  ptr = ( char * ) malloc ( size );
-
-  if ( ptr == 0 )
-  {
-    fprintf( stderr, "Memory allocation bombed on line %d in %s\n", lnum, fname );
-  }
-
-  return ( ptr );
-}
-
-
-/**** NEW STUFF ****/
-/**** NEW STUFF ****/
-/**** NEW STUFF ****/
-/**** NEW STUFF ****/
-
-
-
-/******************************************************************************
-Given a file pointer, get ready to read PLY data from the file.
-
-Entry:
-fp - the given file pointer
-
-Exit:
-nelems     - number of elements in object
-elem_names - list of element names
-returns a pointer to a PlyFile, used to refer to this file, or NULL if error
-******************************************************************************/
-
-PlyFile *read_ply( FILE *fp )
-{
-  PlyFile  *ply;
-  int       num_elems;
-  char*    *elem_names;
-
-  ply = ply_read ( fp, &num_elems, &elem_names );
-
-  return ( ply );
-}
-
-
-/******************************************************************************
-Given a file pointer, get ready to write PLY data to the file.
-
-Entry:
-fp         - the given file pointer
-nelems     - number of elements in object
-elem_names - list of element names
-file_type  - file type, either ascii or binary
-
-Exit:
-returns a pointer to a PlyFile, used to refer to this file, or NULL if error
-******************************************************************************/
-
-PlyFile *write_ply( FILE *fp, int nelems, char **elem_names, int file_type )
-{
-  PlyFile  *ply;
-
-  ply = ply_write ( fp, nelems, elem_names, file_type );
-
-  return ( ply );
-}
-
-
-/******************************************************************************
-Return a list of the names of the elements in a particular PLY file.
-
-Entry:
-ply - PLY file whose element name list we want
-
-Exit:
-num_elems  - the number of element names in the list
-returns the list of names
-******************************************************************************/
-
-char **get_element_list_ply( PlyFile *ply, int *num_elems )
-{
-  int     i;
-  char*  *elist;
-
-  /* create the list of element names */
-
-  elist = ( char * *  ) myalloc ( sizeof ( char * ) * ply->num_elem_types );
-  for ( i = 0; i < ply->num_elem_types; i++ )
-    elist[i] = strdup ( ply->elems[i]->name );
-
-  /* return the number of elements and the list of element names */
-  *num_elems = ply->num_elem_types;
-  return ( elist );
-}
-
-
-/******************************************************************************
-Append a comment to a PLY file.
-
-Entry:
-ply     - file to append comment to
-comment - the comment to append
-******************************************************************************/
-
-void append_comment_ply( PlyFile *ply, const char *comment )
-{
-  /* (re)allocate space for new comment */
-  if ( ply->num_comments == 0 )
-    ply->comments = ( char * *  ) myalloc ( sizeof ( char * ) );
-  else
-    ply->comments = ( char * *  ) realloc ( ply->comments,
-    sizeof ( char * ) * ( ply->num_comments + 1 ) );
-
-  /* add comment to list */
-  ply->comments[ply->num_comments] = strdup ( comment );
-  ply->num_comments++;
-}
-
-
-/******************************************************************************
-Copy the comments from one PLY file to another.
-
-Entry:
-out_ply - destination file to copy comments to
-in_ply  - the source of the comments
-******************************************************************************/
-
-void copy_comments_ply( PlyFile *out_ply, PlyFile *in_ply )
-{
-  int i;
-
-  for ( i = 0; i < in_ply->num_comments; i++ )
-    append_comment_ply ( out_ply, in_ply->comments[i] );
-}
-
-
-/******************************************************************************
-Append object information (arbitrary text) to a PLY file.
-
-Entry:
-ply      - file to append object info to
-obj_info - the object info to append
-******************************************************************************/
-
-void append_obj_info_ply( PlyFile *ply, const char *obj_info )
-{
-  /* (re)allocate space for new info */
-  if ( ply->num_obj_info == 0 )
-    ply->obj_info = ( char * *  ) myalloc ( sizeof ( char * ) );
-  else
-    ply->obj_info = ( char * *  ) realloc ( ply->obj_info,
-    sizeof ( char * ) * ( ply->num_obj_info + 1 ) );
-
-  /* add info to list */
-  ply->obj_info[ply->num_obj_info] = strdup ( obj_info );
-  ply->num_obj_info++;
-}
-
-
-/******************************************************************************
-Copy the object information from one PLY file to another.
-
-Entry:
-out_ply - destination file to copy object information to
-in_ply  - the source of the object information
-******************************************************************************/
-
-void copy_obj_info_ply( PlyFile *out_ply, PlyFile *in_ply )
-{
-  int i;
-
-  for ( i = 0; i < in_ply->num_obj_info; i++ )
-    append_obj_info_ply ( out_ply, in_ply->obj_info[i] );
-}
-
-
-/******************************************************************************
-Close a PLY file.
-
-Entry:
-plyfile - identifier of file to close
-******************************************************************************/
-
-void close_ply( PlyFile *plyfile )
-{
-  fclose ( plyfile->fp );
-}
-
-
-/******************************************************************************
-Free the memory used by a PLY file.
-
-Entry:
-plyfile - identifier of file
-******************************************************************************/
-
-void free_ply( PlyFile *plyfile )
-{
-  /* free up memory associated with the PLY file */
-  free ( plyfile );
-}
-
-
-/******************************************************************************
-Specify the index of the next element to be read in from a PLY file.
-
-Entry:
-ply - file to read from
-index - index of the element to be read
-
-Exit:
-elem_count - the number of elements in the file
-returns pointer to the name of this next element
-******************************************************************************/
-
-char *setup_element_read_ply( PlyFile *ply, int index, int *elem_count )
-{
-  PlyElement *elem;
-
-  if ( index < 0 || index > ply->num_elem_types )
-  {
-    fprintf ( stderr, "Warning:  No element with index %d\n", index );
-    return ( 0 );
-  }
-
-  elem = ply->elems[index];
-
-  /* set this to be the current element */
-  ply->which_elem = elem;
-
-  /* return the number of such elements in the file and the element's name */
-  *elem_count = elem->num;
-  return ( elem->name );
-}
-
-
-/******************************************************************************
-Read one element from the file.  This routine assumes that we're reading
-the type of element specified in the last call to the routine
-setup_element_read_ply().
-
-Entry:
-plyfile  - file identifier
-elem_ptr - pointer to location where the element information should be put
-******************************************************************************/
-
-void get_element_ply( PlyFile *plyfile, void *elem_ptr )
-{
-  if ( plyfile->file_type == PLY_ASCII )
-    ascii_get_element ( plyfile, ( char * ) elem_ptr );
-  else
-    binary_get_element ( plyfile, ( char * ) elem_ptr );
-}
-
-
-/******************************************************************************
-Specify one of several properties of the current element that is to be
-read from a file.  This should be called (usually multiple times) before a
-call to the routine get_element_ply().
-
-Entry:
-plyfile - file identifier
-prop    - property to add to those that will be returned
-
-Exit:
-0 if the property has not been found
-1 if the property has been found
-******************************************************************************/
-
-int setup_property_ply( PlyFile *plyfile, PlyProperty *prop )
-{
-  PlyElement   *elem;
-  PlyProperty  *prop_ptr;
-  int           index;
-
-  elem = plyfile->which_elem;
-
-  /* deposit the property information into the element's description */
-
-  prop_ptr = find_property ( elem, prop->name, &index );
-  if ( prop_ptr == NULL )
-  {
-    fprintf ( stderr, "Warning:  Can't find property '%s' in element '%s'\n",
-    prop->name, elem->name );
-    return 0;
-  }
-  prop_ptr->internal_type = prop->internal_type;
-  prop_ptr->offset = prop->offset;
-  prop_ptr->count_internal = prop->count_internal;
-  prop_ptr->count_offset = prop->count_offset;
-
-  /* specify that the user wants this property */
-  elem->store_prop[index] = STORE_PROP;
-  return 1 ;
-}
-
-
-/******************************************************************************
-Specify that we want the "other" properties of the current element to be tucked
-away within the user's structure.
-
-Entry:
-plyfile - file identifier
-offset  - offset to where other_props will be stored inside user's structure
-
-Exit:
-returns pointer to structure containing description of other_props
-******************************************************************************/
-
-PlyOtherProp *get_other_properties_ply( PlyFile *plyfile, int offset )
-{
-  PlyOtherProp *other;
-
-  other = get_other_properties ( plyfile, plyfile->which_elem, offset );
-  return ( other );
-}
-
-
-/******************************************************************************
-Describe which element is to be written next and state how many of them will
-be written.
-
-Entry:
-plyfile   - file identifier
-elem_name - name of element that information is being described
-nelems    - number of elements of this type to be written
-******************************************************************************/
-
-void describe_element_ply( PlyFile *plyfile, char *elem_name, int nelems )
-{
-  PlyElement *elem;
-
-  /* look for appropriate element */
-  elem = find_element ( plyfile, elem_name );
-  if ( elem == NULL )
-  {
-    fprintf( stderr,"describe_element_ply: can't find element '%s'\n",elem_name );
-    exit ( -1 );
-  }
-
-  elem->num = nelems;
-
-  /* now this element is the current element */
-  plyfile->which_elem = elem;
-}
-
-
-/******************************************************************************
-Describe a property of an element.
-
-Entry:
-plyfile   - file identifier
-prop      - the new property
-******************************************************************************/
-
-void describe_property_ply( PlyFile *plyfile, PlyProperty *prop )
-{
-  PlyElement   *elem;
-  PlyProperty  *elem_prop;
-
-  elem = plyfile->which_elem;
-
-  /* create room for new property */
-
-  if ( elem->nprops == 0 )
-  {
-    elem->props = ( PlyProperty *  *  ) myalloc ( sizeof ( PlyProperty *  ) );
-    elem->store_prop = ( char * ) myalloc ( sizeof ( char ) );
-    elem->nprops = 1;
-  }
-  else
-  {
-    elem->nprops++;
-    elem->props = ( PlyProperty *  *  )
-    realloc ( elem->props, sizeof ( PlyProperty *  ) * elem->nprops );
-    elem->store_prop = ( char * )
-    realloc ( elem->store_prop, sizeof ( char ) * elem->nprops );
-  }
-
-  /* copy the new property */
-
-  elem_prop = ( PlyProperty *  ) myalloc ( sizeof ( PlyProperty ) );
-  elem->props[elem->nprops - 1] = elem_prop;
-  elem->store_prop[elem->nprops - 1] = NAMED_PROP;
-  copy_property ( elem_prop, prop );
-}
-
-
-/******************************************************************************
-Describe what the "other" properties are that are to be stored, and where
-they are in an element.
-******************************************************************************/
-
-void describe_other_properties_ply( PlyFile *plyfile, PlyOtherProp *other, int offset )
-{
-  int           i;
-  PlyElement   *elem;
-  PlyProperty  *prop;
-
-  /* look for appropriate element */
-  elem = find_element ( plyfile, other->name );
-  if ( elem == NULL )
-  {
-    fprintf( stderr, "describe_other_properties_ply: can't find element '%s'\n",
-    other->name );
-    return;
-  }
-
-  /* create room for other properties */
-
-  if ( elem->nprops == 0 )
-  {
-    elem->props = ( PlyProperty *  *  )
-    myalloc ( sizeof ( PlyProperty *  ) * other->nprops );
-    elem->store_prop = ( char * ) myalloc ( sizeof ( char ) * other->nprops );
-    elem->nprops = 0;
-  }
-  else
-  {
-    int newsize;
-    newsize = elem->nprops + other->nprops;
-    elem->props = ( PlyProperty *  *  )
-    realloc ( elem->props, sizeof ( PlyProperty *  ) * newsize );
-    elem->store_prop = ( char * )
-    realloc ( elem->store_prop, sizeof ( char ) * newsize );
-  }
-
-  /* copy the other properties */
-
-  for ( i = 0; i < other->nprops; i++ )
-  {
-    prop = ( PlyProperty *  ) myalloc ( sizeof ( PlyProperty ) );
-    copy_property ( prop, other->props[i] );
-    elem->props[elem->nprops] = prop;
-    elem->store_prop[elem->nprops] = OTHER_PROP;
-    elem->nprops++;
-  }
-
-  /* save other info about other properties */
-  elem->other_size = other->size;
-  elem->other_offset = offset;
-}
-
-
-/******************************************************************************
-Pass along a pointer to "other" elements that we want to save in a given
-PLY file.  These other elements were presumably read from another PLY file.
-
-Entry:
-plyfile     - file pointer in which to store this other element info
-other_elems - info about other elements that we want to store
-******************************************************************************/
-
-void describe_other_elements_ply( PlyFile *plyfile, PlyOtherElems *other_elems )
-{
-  int         i;
-  OtherElem  *other;
-
-  /* ignore this call if there is no other element */
-  if ( other_elems == NULL )
-    return;
-
-  /* save pointer to this information */
-  plyfile->other_elems = other_elems;
-
-  /* describe the other properties of this element */
-
-  for ( i = 0; i < other_elems->num_elems; i++ )
-  {
-    other = &( other_elems->other_list[i] );
-    element_count_ply ( plyfile, other->elem_name, other->elem_count );
-    describe_other_properties_ply ( plyfile, other->other_props,
-    offsetof( OtherData,other_props ) );
-  }
-}
-
-
-
-/**** Property Propagation Rules ****/
-
-
-typedef struct RuleName {
-int code;
-const char *name;
-} RuleName;
-
-const RuleName  rule_name_list[]  = {
-{AVERAGE_RULE, "avg"},
-{RANDOM_RULE, "rnd"},
-{MINIMUM_RULE, "max"},
-{MAXIMUM_RULE, "min"},
-{MAJORITY_RULE, "major"},
-{SAME_RULE, "same"},
-{-1, "end_marker"},
-};
-
-
-
-/******************************************************************************
-Initialize the property propagation rules for an element.  Default is to
-use averaging (AVERAGE_RULE) for creating all new properties.
-
-Entry:
-ply       - PLY object that this is for
-elem_name - name of the element that we're making the rules for
-
-Exit:
-returns pointer to the default rules
-******************************************************************************/
-
-PlyPropRules *init_rule_ply( PlyFile *ply, char *elem_name )
-{
-  int           i,j;
-  PlyElement   *elem;
-  PlyPropRules *rules;
-  PlyRuleList  *list;
-  int           found_prop;
-
-  elem = find_element ( ply, elem_name );
-  if ( elem == NULL )
-  {
-    fprintf ( stderr, "init_rule_ply: Can't find element '%s'\n", elem_name );
-    exit ( -1 );
-  }
-
-  rules = ( PlyPropRules *  ) myalloc ( sizeof ( PlyPropRules ) );
-  rules->elem = elem;
-  rules->rule_list = ( int * ) myalloc ( sizeof( int ) * elem->nprops );
-  rules->max_props = 0;
-  rules->nprops = 0;
-
-  /* default is to use averaging rule */
-  for ( i = 0; i < elem->nprops; i++ )
-    rules->rule_list[i] = AVERAGE_RULE;
-
-  /* see if there are other rules we should use */
-
-  if ( ply->rule_list == NULL )
-    return ( rules );
-
-  /* try to match the element, property and rule name */
-
-  for ( list = ply->rule_list; list != NULL; list = list->next )
-  {
-    if ( !equal_strings ( list->element, elem->name ) )
-      continue;
-
-    found_prop = 0;
-
-    for ( i = 0; i < elem->nprops; i++ )
-      if ( equal_strings ( list->property, elem->props[i]->name ) )
-      {
-        found_prop = 1;
-
-        /* look for matching rule name */
-        for ( j = 0; rule_name_list[j].code != -1; j++ )
-          if ( equal_strings ( list->name, rule_name_list[j].name ) )
-          {
-            rules->rule_list[i] = rule_name_list[j].code;
-            break;
-          }
-      }
-
-    if ( !found_prop )
-    {
-      fprintf ( stderr, "Can't find property '%s' for rule '%s'\n",
-      list->property, list->name );
-      continue;
-    }
-  }
-
-  return ( rules );
-}
-
-
-/******************************************************************************
-odify a property propagation rule.
-
-Entry:
-rules - rules for the element
-prop_name - name of the property whose rule we're modifying
-rule_type - type of rule (MAXIMUM_RULE, MINIMUM_RULE, MAJORITY_RULE, etc.)
-******************************************************************************/
-
-void modify_rule_ply( PlyPropRules *rules, char *prop_name, int rule_type )
-{
-  int         i;
-  PlyElement *elem  = rules->elem;
-
-  /* find the property and modify its rule type */
-
-  for ( i = 0; i < elem->nprops; i++ )
-    if ( equal_strings ( elem->props[i]->name, prop_name ) )
-    {
-      rules->rule_list[i] = rule_type;
-      return;
-    }
-
-  /* we didn't find the property if we get here */
-  fprintf ( stderr, "modify_rule_ply: Can't find property '%s'\n", prop_name );
-  exit ( -1 );
-}
-
-
-/******************************************************************************
-Begin to create a set of properties from a set of propagation rules.
-
-Entry:
-ply   - PLY object whose rules we're preparing to use
-rules - rules for the element
-******************************************************************************/
-
-void start_props_ply( PlyFile *ply, PlyPropRules *rules )
-{
-  /*  PlyElement *elem  = rules->elem; */
-
-  /* save pointer to the rules in the PLY object */
-  ply->current_rules = rules;
-
-  /* get ready for new sets of properties to combine */
-  rules->nprops = 0;
-}
-
-
-/******************************************************************************
-Remember a set of properties and their weights for creating a new set of
-properties.
-
-Entry:
-weight      - weights for this set of properties
-other_props - the properties to use
-******************************************************************************/
-
-void weight_props_ply( PlyFile *ply, float weight, void *other_props )
-{
-  PlyPropRules *rules = ply->current_rules;
-
-  /* allocate space for properties and weights, if necessary */
-  if ( rules->max_props == 0 )
-  {
-    rules->max_props = 6;
-    rules->props = ( void * *  ) myalloc ( sizeof ( void * ) * rules->max_props );
-    rules->weights = ( float * ) myalloc ( sizeof ( float ) * rules->max_props );
-  }
-  if ( rules->nprops == rules->max_props )
-  {
-    rules->max_props *= 2;
-    rules->props = ( void * *  ) realloc ( rules->props,
-    sizeof ( void * ) * rules->max_props );
-    rules->weights = ( float * ) realloc ( rules->weights,
-    sizeof ( float ) * rules->max_props );
-  }
-
-  /* remember these new properties and their weights */
-
-  rules->props[rules->nprops] = other_props;
-  rules->weights[rules->nprops] = weight;
-  rules->nprops++;
-}
-
-
-/******************************************************************************
-Return a pointer to a new set of properties that have been created using
-a specified set of property combination rules and a given collection of
-"other" properties.
-
-Exit:
-returns a pointer to the new properties
-******************************************************************************/
-
-void *get_new_props_ply( PlyFile *ply )
-{
-  int             i,j;
-  static double  *vals;
-  static int      max_vals  = 0;
-  PlyPropRules   *rules     = ply->current_rules;
-  PlyElement     *elem      = rules->elem;
-  PlyProperty    *prop;
-  char           *data;
-  char           *new_data;
-  void           *ptr;
-  int             offset;
-  int             type;
-  double          double_val;
-  int             int_val;
-  unsigned int uint_val;
-  int random_pick;
-
-  /* return NULL if we've got no "other" properties */
-  if ( elem->other_size == 0 )
-  {
-    return ( NULL );
-  }
-
-  /* create room for combined other properties */
-  new_data = ( char * ) myalloc ( sizeof ( char ) * elem->other_size );
-
-  /* make sure there is enough room to store values we're to combine */
-
-  if ( max_vals == 0 )
-  {
-    max_vals = rules->nprops;
-    vals = ( double * ) myalloc ( sizeof ( double ) * rules->nprops );
-  }
-  if ( rules->nprops >= max_vals )
-  {
-    max_vals = rules->nprops;
-    vals = ( double * ) realloc ( vals, sizeof ( double ) * rules->nprops );
-  }
-
-  /* in case we need a random choice */
-  random_pick = ( int ) floor ( (double)rules->nprops ); //* drand48());
-
-  /* calculate the combination for each "other" property of the element */
-
-  for ( i = 0; i < elem->nprops; i++ )
-  {
-    /* don't bother with properties we've been asked to store explicitly */
-    if ( elem->store_prop[i] )
-      continue;
-
-    prop = elem->props[i];
-    offset = prop->offset;
-    type = prop->external_type;
-
-    /* collect together all the values we're to combine */
-
-    for ( j = 0; j < rules->nprops; j++ )
-    {
-      data = ( char * ) rules->props[j];
-      ptr = ( void * ) ( data + offset );
-      get_stored_item ( ( void * ) ptr, type, &int_val, &uint_val, &double_val );
-      vals[j] = double_val;
-    }
-
-    /* calculate the combined value */
-
-    switch ( rules->rule_list[i] )
-    {
-      case AVERAGE_RULE:
-        {
-        double  sum         = 0;
-        double  weight_sum  = 0;
-        for ( j = 0; j < rules->nprops; j++ )
-        {
-          sum += vals[j] * rules->weights[j];
-          weight_sum += rules->weights[j];
-        }
-        double_val = sum / weight_sum;
-        break;
-      }
-      case MINIMUM_RULE:
-        {
-        double_val = vals[0];
-        for ( j = 1; j < rules->nprops; j++ )
-          if ( double_val > vals[j] )
-            double_val = vals[j];
-        break;
-      }
-      case MAXIMUM_RULE:
-        {
-        double_val = vals[0];
-        for ( j = 1; j < rules->nprops; j++ )
-          if ( double_val < vals[j] )
-            double_val = vals[j];
-        break;
-      }
-      case RANDOM_RULE:
-        {
-        double_val = vals[random_pick];
-        break;
-      }
-      case SAME_RULE:
-        {
-        double_val = vals[0];
-        for ( j = 1; j < rules->nprops; j++ )
-          if ( double_val != vals[j] )
-          {
-            fprintf ( stderr,
-            "get_new_props_ply: Error combining properties that should be the same.\n" );
-            exit ( -1 );
-          }
-        break;
-      }
-      default:
-        fprintf ( stderr, "get_new_props_ply: Bad rule = %d\n",
-        rules->rule_list[i] );
-        exit ( -1 );
-    }
-
-    /* store the combined value */
-
-    int_val = ( int ) double_val;
-    uint_val = ( unsigned int ) double_val;
-    ptr = ( void * ) ( new_data + offset );
-    store_item ( ( char * ) ptr, type, int_val, uint_val, double_val );
-  }
-
-  return ( ( void * ) new_data );
-}
-
-
-/******************************************************************************
-Set the list of user-specified property combination rules.
-******************************************************************************/
-
-void set_prop_rules_ply( PlyFile *ply, PlyRuleList *prop_rules )
-{
-  ply->rule_list = prop_rules;
-}
-
-
-/******************************************************************************
-Append a property rule to a growing list of user-specified rules.
-
-Entry:
-rule_list - current rule list
-name      - name of property combination rule
-property  - "element.property" says which property the rule affects
-
-Exit:
-returns pointer to the new rule list
-******************************************************************************/
-
-PlyRuleList* append_prop_rule( PlyRuleList *rule_list, char *name, char *property )
-{
-  PlyRuleList  *rule;
-  PlyRuleList  *rule_ptr;
-  char         *str,*str2;
-  char         *ptr;
-
-  /* find . */
-  str = strdup ( property );
-  for ( ptr = str; *ptr != '\0' && *ptr != '.'; ptr++ )
-    ;
-
-  /* split string at . */
-  if ( *ptr == '.' )
-  {
-    *ptr = '\0';
-    str2 = ptr + 1;
-  }
-  else
-  {
-    fprintf ( stderr, "Can't find property '%s' for rule '%s'\n",
-    property, name );
-    return ( rule_list );
-  }
-
-  rule = ( PlyRuleList *  ) malloc ( sizeof ( PlyRuleList ) );
-  rule->name = name;
-  rule->element = str;
-  rule->property = str2;
-  rule->next = NULL;
-
-  /* either start rule list or append to it */
-
-  if ( rule_list == NULL )
-    rule_list = rule;
-  else
-  {
-    /* append new rule to current list */
-    rule_ptr = rule_list;
-    while ( rule_ptr->next != NULL )
-      rule_ptr = rule_ptr->next;
-    rule_ptr->next = rule;
-  }
-
-  /* return pointer to list */
-
-  return ( rule_list );
-}
-
-
-/******************************************************************************
-See if a name matches the name of any property combination rules.
-
-Entry:
-name - name of rule we're trying to match
-
-Exit:
-returns 1 if we find a match, 0 if not
-******************************************************************************/
-
-int matches_rule_name( char* name )
-{
-  int i;
-
-  for ( i = 0; rule_name_list[i].code != -1; i++ )
-    if ( equal_strings ( rule_name_list[i].name, name ) )
-      return ( 1 );
-
-  return ( 0 );
-}
-
-} //namespace
+/*
+
+The interface routines for reading and writing PLY polygon files.
+
+Greg Turk
+
+---------------------------------------------------------------
+
+A PLY file contains a single polygonal _object_.
+
+An object is composed of lists of _elements_.  Typical elements are
+vertices, faces, edges and materials.
+
+Each type of element for a given object has one or more _properties_
+associated with the element type.  For instance, a vertex element may
+have as properties the floating-point values x,y,z and the three unsigned
+chars representing red, green and blue.
+
+-----------------------------------------------------------------------
+
+Copyright (c) 1998 Georgia Institute of Technology.  All rights reserved.
+
+Permission to use, copy, modify and distribute this software and its
+documentation for any purpose is hereby granted without fee, provided
+that the above copyright notice and this permission notice appear in
+all copies of this software and that you do not sell the software.
+
+THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTY OF ANY KIND,
+EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
+WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
+
+*/
+
+#include "./McPly.h"
+#include <iostream>
+#include <cstdio>
+
+namespace McCubes{
+
+const char *type_names[]      = {  /* names of scalar types */
+"invalid",
+"int8", "int16", "int32", "uint8", "uint16", "uint32", "float32", "float64"
+};
+
+const char *old_type_names[]  = {  /* old names of types for backward compatability */
+"invalid",
+"char", "short", "int", "uchar", "ushort", "uint", "float", "double"
+};
+
+int   ply_type_size[]   = {
+0, 1, 2, 4, 1, 2, 4, 4, 8
+};
+
+#define NO_OTHER_PROPS  -1
+
+#define DONT_STORE_PROP  0
+#define STORE_PROP       1
+
+#define OTHER_PROP       0
+#define NAMED_PROP       1
+
+/* returns 1 if strings are equal, 0 if not */
+int           equal_strings( const char * , const char * );
+
+/* find an element in a plyfile's list */
+PlyElement   *find_element( PlyFile * , const char * );
+
+/* find a property in an element's list */
+PlyProperty  *find_property( PlyElement * , const char * , int * );
+
+/* write to a file the word describing a PLY file data type */
+void          write_scalar_type( FILE * , int );
+
+/* read a line from a file and break it up into separate words */
+char*        *get_words( FILE * , int * , char ** );
+
+/* write an item to a file */
+void          write_binary_item( FILE * , int, unsigned int, double, int );
+void          write_ascii_item( FILE * , int, unsigned int, double, int );
+
+/* add information to a PLY file descriptor */
+void          add_element( PlyFile * , char ** , int );
+void          add_property( PlyFile * , char ** , int );
+void          add_comment( PlyFile * , const char * );
+void          add_obj_info( PlyFile * , const char * );
+
+/* copy a property */
+void          copy_property( PlyProperty * , PlyProperty * );
+
+/* store a value into where a pointer and a type specify */
+void          store_item( char * , int, int, unsigned int, double );
+
+/* return the value of a stored item */
+void          get_stored_item( void * , int, int * , unsigned int * , double * );
+
+/* return the value stored in an item, given ptr to it and its type */
+double        get_item_value( const char * , int );
+
+/* get binary or ascii item and store it according to ptr and type */
+void          get_ascii_item( const char * , int, int * , unsigned int * , double * );
+void          get_binary_item( FILE * , int, int * , unsigned int * , double * );
+
+/* get a bunch of elements from a file */
+void          ascii_get_element( PlyFile * , char * );
+void          binary_get_element( PlyFile * , char * );
+
+/* memory allocation */
+static char  *my_alloc( int, int, const char * );
+
+
+/*************/
+/*  Writing  */
+/*************/
+
+
+/******************************************************************************
+Given a file pointer, get ready to write PLY data to the file.
+
+Entry:
+fp         - the given file pointer
+nelems     - number of elements in object
+elem_names - list of element names
+file_type  - file type, either ascii or binary
+
+Exit:
+returns a pointer to a PlyFile, used to refer to this file, or NULL if error
+******************************************************************************/
+
+PlyFile *ply_write( FILE *fp, int nelems, char **elem_names, int file_type )
+{
+  int         i;
+  PlyFile    *plyfile;
+  PlyElement *elem;
+
+  /* check for NULL file pointer */
+  if ( fp == NULL )
+    return ( NULL );
+
+  /* create a record for this object */
+
+  plyfile = ( PlyFile *  ) myalloc ( sizeof ( PlyFile ) );
+  plyfile->file_type = file_type;
+  plyfile->num_comments = 0;
+  plyfile->num_obj_info = 0;
+  plyfile->num_elem_types = nelems;
+  plyfile->version = 1.0;
+  plyfile->fp = fp;
+  plyfile->other_elems = NULL;
+
+  /* tuck aside the names of the elements */
+
+  plyfile->elems = ( PlyElement *  *  ) myalloc ( sizeof ( PlyElement *  ) * nelems );
+  for ( i = 0; i < nelems; i++ )
+  {
+    elem = ( PlyElement *  ) myalloc ( sizeof ( PlyElement ) );
+    plyfile->elems[i] = elem;
+    elem->name = strdup ( elem_names[i] );
+    elem->num = 0;
+    elem->nprops = 0;
+  }
+
+  /* return pointer to the file descriptor */
+  return ( plyfile );
+}
+
+
+/******************************************************************************
+Open a polygon file for writing.
+
+Entry:
+filename   - name of file to read from
+nelems     - number of elements in object
+elem_names - list of element names
+file_type  - file type, either ascii or binary
+
+Exit:
+returns a file identifier, used to refer to this file, or NULL if error
+******************************************************************************/
+
+PlyFile *open_for_writing_ply( const char *filename, int nelems, char **elem_names, int file_type )
+{
+  PlyFile  *plyfile;
+  char     *name;
+  FILE     *fp;
+
+  /* tack on the extension .ply, if necessary */
+
+  name = ( char * ) myalloc ( sizeof ( char ) * ( (int)strlen ( filename ) + 5 ) );
+  strcpy ( name, filename );
+  if ( strlen ( name ) < 4 || strcmp ( name + strlen ( name ) - 4, ".ply" ) != 0 )
+    strcat ( name, ".ply" );
+
+  /* open the file for writing */
+
+  fp = fopen ( name, "w" );
+  if ( fp == NULL )
+  {
+    return ( NULL );
+  }
+
+  /* create the actual PlyFile structure */
+
+  plyfile = ply_write ( fp, nelems, elem_names, file_type );
+  if ( plyfile == NULL )
+    return ( NULL );
+
+  /* return pointer to the file descriptor */
+  return ( plyfile );
+}
+
+
+/******************************************************************************
+Describe an element, including its properties and how many will be written
+to the file.
+
+Entry:
+plyfile   - file identifier
+elem_name - name of element that information is being specified about
+nelems    - number of elements of this type to be written
+nprops    - number of properties contained in the element
+prop_list - list of properties
+******************************************************************************/
+
+void element_layout_ply( PlyFile *plyfile, const char *elem_name, int nelems, int nprops, PlyProperty *prop_list )
+{
+  int           i;
+  PlyElement   *elem;
+  PlyProperty  *prop;
+
+  /* look for appropriate element */
+  elem = find_element ( plyfile, elem_name );
+  if ( elem == NULL )
+  {
+    fprintf( stderr,"element_layout_ply: can't find element '%s'\n",elem_name );
+    exit ( -1 );
+  }
+
+  elem->num = nelems;
+
+  /* copy the list of properties */
+
+  elem->nprops = nprops;
+  elem->props = ( PlyProperty *  *  ) myalloc ( sizeof ( PlyProperty *  ) * nprops );
+  elem->store_prop = ( char * ) myalloc ( sizeof ( char ) * nprops );
+
+  for ( i = 0; i < nprops; i++ )
+  {
+    prop = ( PlyProperty *  ) myalloc ( sizeof ( PlyProperty ) );
+    elem->props[i] = prop;
+    elem->store_prop[i] = NAMED_PROP;
+    copy_property ( prop, &prop_list[i] );
+  }
+}
+
+
+/******************************************************************************
+Describe a property of an element.
+
+Entry:
+plyfile   - file identifier
+elem_name - name of element that information is being specified about
+prop      - the new property
+******************************************************************************/
+
+void ply_describe_property( PlyFile *plyfile, const char *elem_name, PlyProperty *prop )
+{
+  PlyElement   *elem;
+  PlyProperty  *elem_prop;
+
+  /* look for appropriate element */
+  elem = find_element ( plyfile, elem_name );
+  if ( elem == NULL )
+  {
+    fprintf( stderr, "ply_describe_property: can't find element '%s'\n",
+    elem_name );
+    return;
+  }
+
+  /* create room for new property */
+
+  if ( elem->nprops == 0 )
+  {
+    elem->props = ( PlyProperty *  *  ) myalloc ( sizeof ( PlyProperty *  ) );
+    elem->store_prop = ( char * ) myalloc ( sizeof ( char ) );
+    elem->nprops = 1;
+  }
+  else
+  {
+    elem->nprops++;
+    elem->props = ( PlyProperty *  *  )
+    realloc ( elem->props, sizeof ( PlyProperty *  ) * elem->nprops );
+    elem->store_prop = ( char * )
+    realloc ( elem->store_prop, sizeof ( char ) * elem->nprops );
+  }
+
+  /* copy the new property */
+
+  elem_prop = ( PlyProperty *  ) myalloc ( sizeof ( PlyProperty ) );
+  elem->props[elem->nprops - 1] = elem_prop;
+  elem->store_prop[elem->nprops - 1] = NAMED_PROP;
+  copy_property ( elem_prop, prop );
+}
+
+
+/******************************************************************************
+State how many of a given element will be written.
+
+Entry:
+plyfile   - file identifier
+elem_name - name of element that information is being specified about
+nelems    - number of elements of this type to be written
+******************************************************************************/
+
+void element_count_ply( PlyFile *plyfile, const char *elem_name, int nelems )
+{
+  PlyElement *elem;
+
+  /* look for appropriate element */
+  elem = find_element ( plyfile, elem_name );
+  if ( elem == NULL )
+  {
+    fprintf( stderr,"element_count_ply: can't find element '%s'\n",elem_name );
+    exit ( -1 );
+  }
+
+  elem->num = nelems;
+}
+
+
+/******************************************************************************
+Signal that we've described everything a PLY file's header and that the
+header should be written to the file.
+
+Entry:
+plyfile - file identifier
+******************************************************************************/
+
+void header_complete_ply( PlyFile *plyfile )
+{
+  int           i,j;
+  FILE         *fp  = plyfile->fp;
+  PlyElement   *elem;
+  PlyProperty  *prop;
+
+  fprintf ( fp, "ply\n" );
+
+  switch ( plyfile->file_type )
+  {
+    case PLY_ASCII:
+      fprintf ( fp, "format ascii 1.0\n" );
+      break;
+    case PLY_BINARY_BE:
+      fprintf ( fp, "format binary_big_endian 1.0\n" );
+      break;
+    case PLY_BINARY_LE:
+      fprintf ( fp, "format binary_little_endian 1.0\n" );
+      break;
+    default:
+      fprintf ( stderr, "ply_header_complete: bad file type = %d\n",
+      plyfile->file_type );
+      exit ( -1 );
+  }
+
+  /* write out the comments */
+
+  for ( i = 0; i < plyfile->num_comments; i++ )
+    fprintf ( fp, "comment %s\n", plyfile->comments[i] );
+
+  /* write out object information */
+
+  for ( i = 0; i < plyfile->num_obj_info; i++ )
+    fprintf ( fp, "obj_info %s\n", plyfile->obj_info[i] );
+
+  /* write out information about each element */
+
+  for ( i = 0; i < plyfile->num_elem_types; i++ )
+  {
+    elem = plyfile->elems[i];
+    fprintf ( fp, "element %s %d\n", elem->name, elem->num );
+
+    /* write out each property */
+    for ( j = 0; j < elem->nprops; j++ )
+    {
+      prop = elem->props[j];
+      if ( prop->is_list == PLY_LIST )
+      {
+        fprintf ( fp, "property list " );
+        write_scalar_type ( fp, prop->count_external );
+        fprintf ( fp, " " );
+        write_scalar_type ( fp, prop->external_type );
+        fprintf ( fp, " %s\n", prop->name );
+      }
+      else if ( prop->is_list == PLY_STRING )
+      {
+        fprintf ( fp, "property string" );
+        fprintf ( fp, " %s\n", prop->name );
+      }
+      else
+      {
+        fprintf ( fp, "property " );
+        write_scalar_type ( fp, prop->external_type );
+        fprintf ( fp, " %s\n", prop->name );
+      }
+    }
+  }
+
+  fprintf ( fp, "end_header\n" );
+}
+
+
+/******************************************************************************
+Specify which elements are going to be written.  This should be called
+before a call to the routine ply_put_element().
+
+Entry:
+plyfile   - file identifier
+elem_name - name of element we're talking about
+******************************************************************************/
+
+void put_element_setup_ply( PlyFile *plyfile, const char *elem_name )
+{
+  PlyElement *elem;
+
+  elem = find_element ( plyfile, elem_name );
+  if ( elem == NULL )
+  {
+    fprintf( stderr, "put_element_setup_ply: can't find element '%s'\n", elem_name );
+    exit ( -1 );
+  }
+
+  plyfile->which_elem = elem;
+}
+
+
+/******************************************************************************
+Write an element to the file.  This routine assumes that we're
+writing the type of element specified in the last call to the routine
+put_element_setup_ply().
+
+Entry:
+plyfile  - file identifier
+elem_ptr - pointer to the element
+******************************************************************************/
+
+void put_element_ply( PlyFile *plyfile, void *elem_ptr )
+{
+  int           j,k;
+  FILE         *fp  = plyfile->fp;
+  PlyElement   *elem;
+  PlyProperty  *prop;
+  char         *item;
+  char         *elem_data;
+  char*        *item_ptr;
+  int           list_count;
+  int           item_size;
+  int           int_val;
+  unsigned int uint_val;
+  double  double_val;
+  char*  *other_ptr;
+
+  elem = plyfile->which_elem;
+  elem_data = ( char * ) elem_ptr;
+  other_ptr = ( char * *  ) ( ( ( char * ) elem_ptr ) + elem->other_offset );
+
+  /* write out either to an ascii or binary file */
+
+  if ( plyfile->file_type == PLY_ASCII )
+  {
+    /* write an ascii file */
+
+    /* write out each property of the element */
+    for ( j = 0; j < elem->nprops; j++ )
+    {
+      prop = elem->props[j];
+
+      if ( elem->store_prop[j] == OTHER_PROP )
+        elem_data = *other_ptr;
+      else
+        elem_data = ( char * ) elem_ptr;
+
+      if ( prop->is_list == PLY_LIST )
+      {
+        /* list */
+        item = elem_data + prop->count_offset;
+        get_stored_item ( ( void * ) item, prop->count_internal,
+        &int_val, &uint_val, &double_val );
+        write_ascii_item ( fp, int_val, uint_val, double_val,
+        prop->count_external );
+        list_count = uint_val;
+        item_ptr = ( char * *  ) ( elem_data + prop->offset );
+        item = item_ptr[0];
+        item_size = ply_type_size[prop->internal_type];
+        for ( k = 0; k < list_count; k++ )
+        {
+          get_stored_item ( ( void * ) item, prop->internal_type,
+          &int_val, &uint_val, &double_val );
+          write_ascii_item ( fp, int_val, uint_val, double_val,
+          prop->external_type );
+          item += item_size;
+        }
+      }
+      else if ( prop->is_list == PLY_STRING )
+      {
+        /* string */
+        char*  *str;
+        item = elem_data + prop->offset;
+        str = ( char * *  ) item;
+        fprintf ( fp, "\"%s\"", *str );
+      }
+      else
+      {
+        /* scalar */
+        item = elem_data + prop->offset;
+        get_stored_item ( ( void * ) item, prop->internal_type,
+        &int_val, &uint_val, &double_val );
+        write_ascii_item ( fp, int_val, uint_val, double_val,
+        prop->external_type );
+      }
+    }
+
+    fprintf ( fp, "\n" );
+  }
+  else
+  {
+    /* write a binary file */
+
+    /* write out each property of the element */
+    for ( j = 0; j < elem->nprops; j++ )
+    {
+      prop = elem->props[j];
+      if ( elem->store_prop[j] == OTHER_PROP )
+        elem_data = *other_ptr;
+      else
+        elem_data = ( char * ) elem_ptr;
+      if ( prop->is_list == PLY_LIST )
+      {
+        /* list */
+        item = elem_data + prop->count_offset;
+        item_size = ply_type_size[prop->count_internal];
+        get_stored_item ( ( void * ) item, prop->count_internal,
+        &int_val, &uint_val, &double_val );
+        write_binary_item ( fp, int_val, uint_val, double_val,
+        prop->count_external );
+        list_count = uint_val;
+        item_ptr = ( char * *  ) ( elem_data + prop->offset );
+        item = item_ptr[0];
+        item_size = ply_type_size[prop->internal_type];
+        for ( k = 0; k < list_count; k++ )
+        {
+          get_stored_item ( ( void * ) item, prop->internal_type,
+          &int_val, &uint_val, &double_val );
+          write_binary_item ( fp, int_val, uint_val, double_val,
+          prop->external_type );
+          item += item_size;
+        }
+      }
+      else if ( prop->is_list == PLY_STRING )
+      {
+        /* string */
+        int     len;
+        char*  *str;
+        item = elem_data + prop->offset;
+        str = ( char * *  ) item;
+
+        /* write the length */
+        len = (int)strlen( *str ) + 1;
+        fwrite ( &len, sizeof( int ), 1, fp );
+
+        /* write the string, including the null character */
+        fwrite ( *str, len, 1, fp );
+      }
+      else
+      {
+        /* scalar */
+        item = elem_data + prop->offset;
+        item_size = ply_type_size[prop->internal_type];
+        get_stored_item ( ( void * ) item, prop->internal_type,
+        &int_val, &uint_val, &double_val );
+        write_binary_item ( fp, int_val, uint_val, double_val,
+        prop->external_type );
+      }
+    }
+  }
+}
+
+
+
+
+
+
+/*************/
+/*  Reading  */
+/*************/
+
+
+
+/******************************************************************************
+Given a file pointer, get ready to read PLY data from the file.
+
+Entry:
+fp - the given file pointer
+
+Exit:
+nelems     - number of elements in object
+elem_names - list of element names
+returns a pointer to a PlyFile, used to refer to this file, or NULL if error
+******************************************************************************/
+
+PlyFile *ply_read( FILE *fp, int *nelems, char ***elem_names )
+{
+  int         i,j;
+  PlyFile    *plyfile;
+  int         nwords;
+  char*      *words;
+  int         found_format  = 0;
+  char*      *elist;
+  PlyElement *elem;
+  char       *orig_line;
+
+  /* check for NULL file pointer */
+  if ( fp == NULL )
+    return ( NULL );
+
+  /* create record for this object */
+
+  plyfile = ( PlyFile *  ) myalloc ( sizeof ( PlyFile ) );
+  plyfile->num_elem_types = 0;
+  plyfile->comments = NULL;
+  plyfile->num_comments = 0;
+  plyfile->obj_info = NULL;
+  plyfile->num_obj_info = 0;
+  plyfile->fp = fp;
+  plyfile->other_elems = NULL;
+  plyfile->rule_list = NULL;
+
+  /* read and parse the file's header */
+
+  words = get_words ( plyfile->fp, &nwords, &orig_line );
+  if ( !words || !equal_strings ( words[0], "ply" ) )
+    return ( NULL );
+
+  while ( words )
+  {
+    /* parse words */
+
+    if ( equal_strings ( words[0], "format" ) )
+    {
+      if ( nwords != 3 )
+        return ( NULL );
+      if ( equal_strings ( words[1], "ascii" ) )
+        plyfile->file_type = PLY_ASCII;
+      else if ( equal_strings ( words[1], "binary_big_endian" ) )
+        plyfile->file_type = PLY_BINARY_BE;
+      else if ( equal_strings ( words[1], "binary_little_endian" ) )
+        plyfile->file_type = PLY_BINARY_LE;
+      else
+        return ( NULL );
+      plyfile->version = ( float ) atof ( words[2] );
+      found_format = 1;
+    }
+    else if ( equal_strings ( words[0], "element" ) )
+      add_element ( plyfile, words, nwords );
+    else if ( equal_strings ( words[0], "property" ) )
+      add_property ( plyfile, words, nwords );
+    else if ( equal_strings ( words[0], "comment" ) )
+      add_comment ( plyfile, orig_line );
+    else if ( equal_strings ( words[0], "obj_info" ) )
+      add_obj_info ( plyfile, orig_line );
+    else if ( equal_strings ( words[0], "end_header" ) )
+      break;
+
+    /* free up words space */
+    free ( words );
+
+    words = get_words ( plyfile->fp, &nwords, &orig_line );
+  }
+
+  /* create tags for each property of each element, to be used */
+  /* later to say whether or not to store each property for the user */
+
+  for ( i = 0; i < plyfile->num_elem_types; i++ )
+  {
+    elem = plyfile->elems[i];
+    elem->store_prop = ( char * ) myalloc ( sizeof ( char ) * elem->nprops );
+    for ( j = 0; j < elem->nprops; j++ )
+      elem->store_prop[j] = DONT_STORE_PROP;
+    elem->other_offset = NO_OTHER_PROPS; /* no "other" props by default */
+  }
+
+  /* set return values about the elements */
+
+  elist = ( char * *  ) myalloc ( sizeof ( char * ) * plyfile->num_elem_types );
+  for ( i = 0; i < plyfile->num_elem_types; i++ )
+    elist[i] = strdup ( plyfile->elems[i]->name );
+
+  *elem_names = elist;
+  *nelems = plyfile->num_elem_types;
+
+  /* return a pointer to the file's information */
+
+  return ( plyfile );
+}
+
+
+/******************************************************************************
+Open a polygon file for reading.
+
+Entry:
+filename - name of file to read from
+
+Exit:
+nelems     - number of elements in object
+elem_names - list of element names
+file_type  - file type, either ascii or binary
+version    - version number of PLY file
+returns a file identifier, used to refer to this file, or NULL if error
+******************************************************************************/
+
+PlyFile *ply_open_for_reading( const char *filename, int *nelems, char ***elem_names, int *file_type, float *version )
+{
+  FILE     *fp;
+  PlyFile  *plyfile;
+  char     *name;
+
+  /* tack on the extension .ply, if necessary */
+
+  name = ( char * ) myalloc ( sizeof ( char ) * ( (int)strlen ( filename ) + 5 ) );
+  strcpy ( name, filename );
+  if ( strlen ( name ) < 4 || strcmp ( name + strlen ( name ) - 4, ".ply" ) != 0 )
+    strcat ( name, ".ply" );
+
+  /* open the file for reading */
+
+  fp = fopen ( name, "r" );
+  if ( fp == NULL )
+    return ( NULL );
+
+  /* create the PlyFile data structure */
+
+  plyfile = ply_read ( fp, nelems, elem_names );
+
+  /* determine the file type and version */
+
+  *file_type = plyfile->file_type;
+  *version = plyfile->version;
+
+  /* return a pointer to the file's information */
+
+  return ( plyfile );
+}
+
+
+/******************************************************************************
+Get information about a particular element.
+
+Entry:
+plyfile   - file identifier
+elem_name - name of element to get information about
+
+Exit:
+nelems   - number of elements of this type in the file
+nprops   - number of properties
+returns a list of properties, or NULL if the file doesn't contain that elem
+******************************************************************************/
+
+PlyProperty **get_element_description_ply( PlyFile *plyfile, const char *elem_name, int *nelems, int *nprops )
+{
+  int             i;
+  PlyElement     *elem;
+  PlyProperty    *prop;
+  PlyProperty*   *prop_list;
+
+  /* find information about the element */
+  elem = find_element ( plyfile, elem_name );
+  if ( elem == NULL )
+    return ( NULL );
+
+  *nelems = elem->num;
+  *nprops = elem->nprops;
+
+  /* make a copy of the element's property list */
+  prop_list = ( PlyProperty *  *  ) myalloc ( sizeof ( PlyProperty *  ) * elem->nprops );
+  for ( i = 0; i < elem->nprops; i++ )
+  {
+    prop = ( PlyProperty *  ) myalloc ( sizeof ( PlyProperty ) );
+    copy_property ( prop, elem->props[i] );
+    prop_list[i] = prop;
+  }
+
+  /* return this duplicate property list */
+  return ( prop_list );
+}
+
+
+/******************************************************************************
+Specify which properties of an element are to be returned.  This should be
+called before a call to the routine get_element_ply().
+
+Entry:
+plyfile   - file identifier
+elem_name - which element we're talking about
+nprops    - number of properties
+prop_list - list of properties
+******************************************************************************/
+
+void get_element_setup_ply( PlyFile *plyfile, const char *elem_name, int nprops, PlyProperty *prop_list )
+{
+  int           i;
+  PlyElement   *elem;
+  PlyProperty  *prop;
+  int           index;
+
+  /* find information about the element */
+  elem = find_element ( plyfile, elem_name );
+  plyfile->which_elem = elem;
+
+  /* deposit the property information into the element's description */
+  for ( i = 0; i < nprops; i++ )
+  {
+    /* look for actual property */
+    prop = find_property ( elem, prop_list[i].name, &index );
+    if ( prop == NULL )
+    {
+      fprintf ( stderr, "Warning:  Can't find property '%s' in element '%s'\n",
+      prop_list[i].name, elem_name );
+      continue;
+    }
+
+    /* store its description */
+    prop->internal_type = prop_list[i].internal_type;
+    prop->offset = prop_list[i].offset;
+    prop->count_internal = prop_list[i].count_internal;
+    prop->count_offset = prop_list[i].count_offset;
+
+    /* specify that the user wants this property */
+    elem->store_prop[index] = STORE_PROP;
+  }
+}
+
+
+/******************************************************************************
+Specify a property of an element that is to be returned.  This should be
+called (usually multiple times) before a call to the routine ply_get_element().
+This routine should be used in preference to the less flexible old routine
+called ply_get_element_setup().
+
+Entry:
+plyfile   - file identifier
+elem_name - which element we're talking about
+prop      - property to add to those that will be returned
+******************************************************************************/
+
+void ply_get_property( PlyFile *plyfile, const char *elem_name, PlyProperty *prop )
+{
+  PlyElement   *elem;
+  PlyProperty  *prop_ptr;
+  int           index;
+
+  /* find information about the element */
+  elem = find_element ( plyfile, elem_name );
+  plyfile->which_elem = elem;
+
+  /* deposit the property information into the element's description */
+
+  prop_ptr = find_property ( elem, prop->name, &index );
+  if ( prop_ptr == NULL )
+  {
+    fprintf ( stderr, "Warning:  Can't find property '%s' in element '%s'\n",
+    prop->name, elem_name );
+    return;
+  }
+  prop_ptr->internal_type = prop->internal_type;
+  prop_ptr->offset = prop->offset;
+  prop_ptr->count_internal = prop->count_internal;
+  prop_ptr->count_offset = prop->count_offset;
+
+  /* specify that the user wants this property */
+  elem->store_prop[index] = STORE_PROP;
+}
+
+
+/******************************************************************************
+Read one element from the file.  This routine assumes that we're reading
+the type of element specified in the last call to the routine
+ply_get_element_setup().
+
+Entry:
+plyfile  - file identifier
+elem_ptr - pointer to location where the element information should be put
+******************************************************************************/
+
+void ply_get_element( PlyFile *plyfile, void *elem_ptr )
+{
+  if ( plyfile->file_type == PLY_ASCII )
+    ascii_get_element ( plyfile, ( char * ) elem_ptr );
+  else
+    binary_get_element ( plyfile, ( char * ) elem_ptr );
+}
+
+
+/******************************************************************************
+Extract the comments from the header information of a PLY file.
+
+Entry:
+plyfile - file identifier
+
+Exit:
+num_comments - number of comments returned
+returns a pointer to a list of comments
+******************************************************************************/
+
+char **get_comments_ply( PlyFile *plyfile, int *num_comments )
+{
+  *num_comments = plyfile->num_comments;
+  return ( plyfile->comments );
+}
+
+
+/******************************************************************************
+Extract the object information (arbitrary text) from the header information
+of a PLY file.
+
+Entry:
+plyfile - file identifier
+
+Exit:
+num_obj_info - number of lines of text information returned
+returns a pointer to a list of object info lines
+******************************************************************************/
+
+char **get_obj_info_ply( PlyFile *plyfile, int *num_obj_info )
+{
+  *num_obj_info = plyfile->num_obj_info;
+  return ( plyfile->obj_info );
+}
+
+
+/******************************************************************************
+ake ready for "other" properties of an element-- those properties that
+the user has not explicitly asked for, but that are to be stashed away
+in a special structure to be carried along with the element's other
+information.
+
+Entry:
+plyfile - file identifier
+elem    - element for which we want to save away other properties
+******************************************************************************/
+
+void setup_other_props( PlyFile *plyfile, PlyElement *elem )
+{
+  int           i;
+  PlyProperty  *prop;
+  int           size  = 0;
+  int           type_size;
+
+  /* Examine each property in decreasing order of size. */
+  /* We do this so that all data types will be aligned by */
+  /* word, half-word, or whatever within the structure. */
+
+  for ( type_size = 8; type_size > 0; type_size /= 2 )
+  {
+    /* add up the space taken by each property, and save this information */
+    /* away in the property descriptor */
+
+    for ( i = 0; i < elem->nprops; i++ )
+    {
+      /* don't bother with properties we've been asked to store explicitly */
+      if ( elem->store_prop[i] )
+        continue;
+
+      prop = elem->props[i];
+
+      /* internal types will be same as external */
+      prop->internal_type = prop->external_type;
+      prop->count_internal = prop->count_external;
+
+      /* list case */
+      if ( prop->is_list == PLY_LIST )
+      {
+        /* pointer to list */
+        if ( type_size == sizeof ( void * ) )
+        {
+          prop->offset = size;
+          size += sizeof ( void * );    /* always use size of a pointer here */
+        }
+
+        /* count of number of list elements */
+        if ( type_size == ply_type_size[prop->count_external] )
+        {
+          prop->count_offset = size;
+          size += ply_type_size[prop->count_external];
+        }
+      }
+      /* string */
+      else if ( prop->is_list == PLY_STRING )
+      {
+        /* pointer to string */
+        if ( type_size == sizeof ( char * ) )
+        {
+          prop->offset = size;
+          size += sizeof ( char * );
+        }
+      }
+      /* scalar */
+      else if ( type_size == ply_type_size[prop->external_type] )
+      {
+        prop->offset = size;
+        size += ply_type_size[prop->external_type];
+      }
+    }
+  }
+
+  /* save the size for the other_props structure */
+  elem->other_size = size;
+}
+
+
+/******************************************************************************
+Specify that we want the "other" properties of an element to be tucked
+away within the user's structure.
+
+Entry:
+plyfile - file identifier
+elem    - the element that we want to store other_props in
+offset  - offset to where other_props will be stored inside user's structure
+
+Exit:
+returns pointer to structure containing description of other_props
+******************************************************************************/
+
+static PlyOtherProp *get_other_properties( PlyFile *plyfile, PlyElement *elem, int offset )
+{
+  int           i;
+  PlyOtherProp *other;
+  PlyProperty  *prop;
+  int           nprops;
+
+  /* remember that this is the "current" element */
+  plyfile->which_elem = elem;
+
+  /* save the offset to where to store the other_props */
+  elem->other_offset = offset;
+
+  /* place the appropriate pointers, etc. in the element's property list */
+  setup_other_props ( plyfile, elem );
+
+  /* create structure for describing other_props */
+  other = ( PlyOtherProp *  ) myalloc ( sizeof ( PlyOtherProp ) );
+  other->name = strdup ( elem->name );
+#if 0
+if (elem->other_offset == NO_OTHER_PROPS) {
+other->size = 0;
+other->props = NULL;
+other->nprops = 0;
+return (other);
+}
+#endif
+  other->size = elem->other_size;
+  other->props = ( PlyProperty *  *  ) myalloc ( sizeof( PlyProperty ) * elem->nprops );
+
+  /* save descriptions of each "other" property */
+  nprops = 0;
+  for ( i = 0; i < elem->nprops; i++ )
+  {
+    if ( elem->store_prop[i] )
+      continue;
+    prop = ( PlyProperty *  ) myalloc ( sizeof ( PlyProperty ) );
+    copy_property ( prop, elem->props[i] );
+    other->props[nprops] = prop;
+    nprops++;
+  }
+  other->nprops = nprops;
+
+  /* set other_offset pointer appropriately if there are NO other properties */
+  if ( other->nprops == 0 )
+  {
+    elem->other_offset = NO_OTHER_PROPS;
+  }
+
+  /* return structure */
+  return ( other );
+}
+
+
+/******************************************************************************
+Specify that we want the "other" properties of an element to be tucked
+away within the user's structure.  The user needn't be concerned for how
+these properties are stored.
+
+Entry:
+plyfile   - file identifier
+elem_name - name of element that we want to store other_props in
+offset    - offset to where other_props will be stored inside user's structure
+
+Exit:
+returns pointer to structure containing description of other_props
+******************************************************************************/
+
+PlyOtherProp *ply_get_other_properties( PlyFile *plyfile, const char *elem_name, int offset )
+{
+  PlyElement   *elem;
+  PlyOtherProp *other;
+
+  /* find information about the element */
+  elem = find_element ( plyfile, elem_name );
+  if ( elem == NULL )
+  {
+    fprintf ( stderr, "ply_get_other_properties: Can't find element '%s'\n",
+    elem_name );
+    return ( NULL );
+  }
+
+  other = get_other_properties ( plyfile, elem, offset );
+  return ( other );
+}
+
+
+
+
+/*************************/
+/*  Other Element Stuff  */
+/*************************/
+
+
+
+
+
+/******************************************************************************
+Grab all the data for the current element that a user does not want to
+explicitly read in.  Stores this in the PLY object's data structure.
+
+Entry:
+plyfile - pointer to file
+
+Exit:
+returns pointer to ALL the "other" element data for this PLY file
+******************************************************************************/
+
+PlyOtherElems *get_other_element_ply( PlyFile *plyfile )
+{
+  int             i;
+  PlyElement     *elem;
+  char           *elem_name;
+  int             elem_count;
+  PlyOtherElems  *other_elems;
+  OtherElem      *other;
+
+  elem = plyfile->which_elem;
+  elem_name = elem->name;
+  elem_count = elem->num;
+
+  /* create room for the new "other" element, initializing the */
+  /* other data structure if necessary */
+
+  if ( plyfile->other_elems == NULL )
+  {
+    plyfile->other_elems = ( PlyOtherElems *  ) myalloc ( sizeof ( PlyOtherElems ) );
+    other_elems = plyfile->other_elems;
+    other_elems->other_list = ( OtherElem *  ) myalloc ( sizeof ( OtherElem ) );
+    other = &( other_elems->other_list[0] );
+    other_elems->num_elems = 1;
+  }
+  else
+  {
+    other_elems = plyfile->other_elems;
+    other_elems->other_list = ( OtherElem *  ) realloc ( other_elems->other_list,
+    sizeof ( OtherElem ) * other_elems->num_elems + 1 );
+    other = &( other_elems->other_list[other_elems->num_elems] );
+    other_elems->num_elems++;
+  }
+
+  /* count of element instances in file */
+  other->elem_count = elem_count;
+
+  /* save name of element */
+  other->elem_name = strdup ( elem_name );
+
+  /* create a list to hold all the current elements */
+  other->other_data = ( OtherData *  *  )
+  malloc ( sizeof ( OtherData *  ) * other->elem_count );
+
+  /* set up for getting elements */
+  other->other_props = ply_get_other_properties ( plyfile, elem_name,
+  offsetof( OtherData,other_props ) );
+
+  /* grab all these elements */
+  for ( i = 0; i < other->elem_count; i++ )
+  {
+    /* grab and element from the file */
+    other->other_data[i] = ( OtherData *  ) malloc ( sizeof ( OtherData ) );
+    ply_get_element ( plyfile, ( void * ) other->other_data[i] );
+  }
+
+  /* return pointer to the other elements data */
+  return ( other_elems );
+}
+
+
+/******************************************************************************
+Write out the "other" elements specified for this PLY file.
+
+Entry:
+plyfile - pointer to PLY file to write out other elements for
+******************************************************************************/
+
+void put_other_elements_ply( PlyFile *plyfile )
+{
+  int         i,j;
+  OtherElem  *other;
+
+  /* make sure we have other elements to write */
+  if ( plyfile->other_elems == NULL )
+    return;
+
+  /* write out the data for each "other" element */
+
+  for ( i = 0; i < plyfile->other_elems->num_elems; i++ )
+  {
+    other = &( plyfile->other_elems->other_list[i] );
+    put_element_setup_ply ( plyfile, other->elem_name );
+
+    /* write out each instance of the current element */
+    for ( j = 0; j < other->elem_count; j++ )
+      put_element_ply ( plyfile, ( void * ) other->other_data[j] );
+  }
+}
+
+
+/******************************************************************************
+Free up storage used by an "other" elements data structure.
+
+Entry:
+other_elems - data structure to free up
+******************************************************************************/
+
+void free_other_elements_ply( PlyOtherElems *other_elems )
+{
+}
+
+
+
+/*******************/
+/*  Miscellaneous  */
+/*******************/
+
+
+
+/******************************************************************************
+Close a PLY file.
+
+Entry:
+plyfile - identifier of file to close
+******************************************************************************/
+
+void ply_close( PlyFile *plyfile )
+{
+  fclose ( plyfile->fp );
+
+  /* free up memory associated with the PLY file */
+  free ( plyfile );
+}
+
+
+/******************************************************************************
+Get version number and file type of a PlyFile.
+
+Entry:
+ply - pointer to PLY file
+
+Exit:
+version - version of the file
+file_type - PLY_ASCII, PLY_BINARY_BE, or PLY_BINARY_LE
+******************************************************************************/
+
+void get_info_ply( PlyFile *ply, float *version, int *file_type )
+{
+  if ( ply == NULL )
+    return;
+
+  *version = ply->version;
+  *file_type = ply->file_type;
+}
+
+
+/******************************************************************************
+Compare two strings.  Returns 1 if they are the same, 0 if not.
+******************************************************************************/
+
+int equal_strings( const char *s1, const char *s2 )
+{
+  while ( *s1 && *s2 )
+    if ( *s1++ != *s2++ )
+      return ( 0 );
+
+  if ( *s1 != *s2 )
+    return ( 0 );
+  else
+    return ( 1 );
+}
+
+
+/******************************************************************************
+Re-create the command line that was used to invoke this program.
+
+Entry:
+argc - number of words in argv
+argv - array of words in command line
+******************************************************************************/
+
+char *recreate_command_line( int argc, char *argv[] )
+{
+  int   i;
+  char *line;
+  int   len = 0;
+
+  /* count total number of characters needed, including separating spaces */
+  for ( i = 0; i < argc; i++ )
+    len += (int)strlen( argv[i] ) + 1;
+
+  /* create empty line */
+  line = ( char * ) malloc ( sizeof( char ) * len );
+  line[0] = '\0';
+
+  /* repeatedly append argv */
+  for ( i = 0; i < argc; i++ )
+  {
+    strcat ( line, argv[i] );
+    if ( i != argc - 1 )
+      strcat ( line, " " );
+  }
+
+  return ( line );
+}
+
+
+/******************************************************************************
+Find an element from the element list of a given PLY object.
+
+Entry:
+plyfile - file id for PLY file
+element - name of element we're looking for
+
+Exit:
+returns the element, or NULL if not found
+******************************************************************************/
+
+PlyElement *find_element( PlyFile *plyfile, const char *element )
+{
+  int i;
+
+  for ( i = 0; i < plyfile->num_elem_types; i++ )
+    if ( equal_strings ( element, plyfile->elems[i]->name ) )
+      return ( plyfile->elems[i] );
+
+  return ( NULL );
+}
+
+
+/******************************************************************************
+Find a property in the list of properties of a given element.
+
+Entry:
+elem      - pointer to element in which we want to find the property
+prop_name - name of property to find
+
+Exit:
+index - index to position in list
+returns a pointer to the property, or NULL if not found
+******************************************************************************/
+
+PlyProperty *find_property( PlyElement *elem, const char *prop_name, int *index )
+{
+  int i;
+
+  for ( i = 0; i < elem->nprops; i++ )
+    if ( equal_strings ( prop_name, elem->props[i]->name ) )
+    {
+      *index = i;
+      return ( elem->props[i] );
+    }
+
+  *index = -1;
+  return ( NULL );
+}
+
+
+/******************************************************************************
+Read an element from an ascii file.
+
+Entry:
+plyfile  - file identifier
+elem_ptr - pointer to element
+******************************************************************************/
+
+void ascii_get_element( PlyFile *plyfile, char *elem_ptr )
+{
+  int           j,k;
+  PlyElement   *elem=NULL;
+  PlyProperty  *prop=NULL;
+  char*        *words=NULL;
+  int           nwords;
+  int           which_word;
+  char         *elem_data=NULL,*item=NULL;
+  char         *item_ptr=NULL;
+  int           item_size;
+  int           int_val;
+  unsigned int uint_val;
+  double  double_val;
+  int     list_count;
+  int     store_it;
+  char*  *store_array=NULL;
+  char   *orig_line=NULL;
+  char   *other_data=NULL;
+  int     other_flag;
+
+  /* the kind of element we're reading currently */
+  elem = plyfile->which_elem;
+
+  /* do we need to setup for other_props? */
+
+  if ( elem->other_offset != NO_OTHER_PROPS )
+  {
+    char*  *ptr;
+    other_flag = 1;
+    /* make room for other_props */
+    other_data = ( char * ) myalloc ( elem->other_size );
+    /* store pointer in user's structure to the other_props */
+    ptr = ( char * *  ) ( elem_ptr + elem->other_offset );
+    *ptr = other_data;
+  }
+  else
+    other_flag = 0;
+
+  /* read in the element */
+
+  words = get_words ( plyfile->fp, &nwords, &orig_line );
+  if ( words == NULL )
+  {
+    fprintf ( stderr, "ply_get_element: unexpected end of file\n" );
+    exit ( -1 );
+  }
+
+  which_word = 0;
+
+  for ( j = 0; j < elem->nprops; j++ )
+  {
+    prop = elem->props[j];
+    store_it = ( elem->store_prop[j] | other_flag );
+
+    /* store either in the user's structure or in other_props */
+    if ( elem->store_prop[j] )
+      elem_data = elem_ptr;
+    else
+      elem_data = other_data;
+
+    if ( prop->is_list == PLY_LIST )
+    {
+      /* a list */
+
+      /* get and store the number of items in the list */
+      get_ascii_item ( words[which_word++], prop->count_external,
+      &int_val, &uint_val, &double_val );
+      if ( store_it )
+      {
+        item = elem_data + prop->count_offset;
+        store_item( item, prop->count_internal, int_val, uint_val, double_val );
+      }
+
+      /* allocate space for an array of items and store a ptr to the array */
+      list_count = int_val;
+      item_size = ply_type_size[prop->internal_type];
+      store_array = ( char * *  ) ( elem_data + prop->offset );
+
+      if ( list_count == 0 )
+      {
+        if ( store_it )
+          *store_array = NULL;
+      }
+      else
+      {
+        if ( store_it )
+        {
+          item_ptr = ( char * ) myalloc ( sizeof ( char ) * item_size * list_count );
+          item = item_ptr;
+          *store_array = item_ptr;
+        }
+
+        /* read items and store them into the array */
+        for ( k = 0; k < list_count; k++ )
+        {
+          get_ascii_item ( words[which_word++], prop->external_type,
+          &int_val, &uint_val, &double_val );
+          if ( store_it )
+          {
+            store_item ( item, prop->internal_type,
+            int_val, uint_val, double_val );
+            item += item_size;
+          }
+        }
+      }
+    }
+    else if ( prop->is_list == PLY_STRING )
+    {
+      /* a string */
+      if ( store_it )
+      {
+        char   *str;
+        char*  *str_ptr;
+        str = strdup ( words[which_word++] );
+        item = elem_data + prop->offset;
+        str_ptr = ( char * *  ) item;
+        *str_ptr = str;
+      }
+      else
+      {
+        which_word++;
+      }
+    }
+    else
+    {
+      /* a scalar */
+      get_ascii_item ( words[which_word++], prop->external_type,
+      &int_val, &uint_val, &double_val );
+      if ( store_it )
+      {
+        item = elem_data + prop->offset;
+        store_item ( item, prop->internal_type, int_val, uint_val, double_val );
+      }
+    }
+  }
+
+  free ( words );
+}
+
+
+/******************************************************************************
+Read an element from a binary file.
+
+Entry:
+plyfile  - file identifier
+elem_ptr - pointer to an element
+******************************************************************************/
+
+void binary_get_element( PlyFile *plyfile, char *elem_ptr )
+{
+  int           j,k;
+  PlyElement   *elem= NULL;
+  PlyProperty  *prop= NULL;
+  FILE         *fp  = plyfile->fp;
+  char         *elem_data;
+  char         *item = NULL;
+  char         *item_ptr= NULL;
+  int           item_size;
+  int           int_val;
+  unsigned int uint_val;
+  double  double_val;
+  int     list_count;
+  int     store_it;
+  char*  *store_array= NULL;
+  char   *other_data= NULL;
+  int     other_flag;
+
+  /* the kind of element we're reading currently */
+  elem = plyfile->which_elem;
+
+  /* do we need to setup for other_props? */
+
+  if ( elem->other_offset != NO_OTHER_PROPS )
+  {
+    char*  *ptr;
+    other_flag = 1;
+    /* make room for other_props */
+    other_data = ( char * ) myalloc ( elem->other_size );
+    /* store pointer in user's structure to the other_props */
+    ptr = ( char * *  ) ( elem_ptr + elem->other_offset );
+    *ptr = other_data;
+  }
+  else
+    other_flag = 0;
+
+  /* read in a number of elements */
+
+  for ( j = 0; j < elem->nprops; j++ )
+  {
+    prop = elem->props[j];
+    store_it = ( elem->store_prop[j] | other_flag );
+
+    /* store either in the user's structure or in other_props */
+    if ( elem->store_prop[j] )
+      elem_data = elem_ptr;
+    else
+      elem_data = other_data;
+
+    if ( prop->is_list == PLY_LIST )
+    {
+      /* list */
+
+      /* get and store the number of items in the list */
+      get_binary_item ( fp, prop->count_external,
+      &int_val, &uint_val, &double_val );
+      if ( store_it )
+      {
+        item = elem_data + prop->count_offset;
+        store_item( item, prop->count_internal, int_val, uint_val, double_val );
+      }
+
+      /* allocate space for an array of items and store a ptr to the array */
+      list_count = int_val;
+      item_size = ply_type_size[prop->internal_type];
+      store_array = ( char * *  ) ( elem_data + prop->offset );
+      if ( list_count == 0 )
+      {
+        if ( store_it )
+          *store_array = NULL;
+      }
+      else
+      {
+        if ( store_it )
+        {
+          item_ptr = ( char * ) myalloc ( sizeof ( char ) * item_size * list_count );
+          item = item_ptr;
+          *store_array = item_ptr;
+        }
+
+        /* read items and store them into the array */
+        for ( k = 0; k < list_count; k++ )
+        {
+          get_binary_item ( fp, prop->external_type,
+          &int_val, &uint_val, &double_val );
+          if ( store_it )
+          {
+            store_item ( item, prop->internal_type,
+            int_val, uint_val, double_val );
+            item += item_size;
+          }
+        }
+      }
+    }
+    else if ( prop->is_list == PLY_STRING )
+    {
+      /* string */
+      int   len;
+      char *str;
+      fread ( &len, sizeof( int ), 1, fp );
+      str = ( char * ) myalloc ( len );
+      fread ( str, len, 1, fp );
+      if ( store_it )
+      {
+        char*  *str_ptr;
+        item = elem_data + prop->offset;
+        str_ptr = ( char * *  ) item;
+        *str_ptr = str;
+      }
+    }
+    else
+    {
+      /* scalar */
+      get_binary_item ( fp, prop->external_type,
+      &int_val, &uint_val, &double_val );
+      if ( store_it )
+      {
+        item = elem_data + prop->offset;
+        store_item ( item, prop->internal_type, int_val, uint_val, double_val );
+      }
+    }
+  }
+}
+
+
+/******************************************************************************
+Write to a file the word that represents a PLY data type.
+
+Entry:
+fp   - file pointer
+code - code for type
+******************************************************************************/
+
+void write_scalar_type( FILE *fp, int code )
+{
+  /* make sure this is a valid code */
+
+  if ( code <= StartType || code >= EndType )
+  {
+    fprintf ( stderr, "write_scalar_type: bad data code = %d\n", code );
+    exit ( -1 );
+  }
+
+  /* write the code to a file */
+
+  fprintf ( fp, "%s", type_names[code] );
+}
+
+
+/******************************************************************************
+Get a text line from a file and break it up into words.
+
+IMPORTANT: The calling routine should call "free" on the returned pointer once
+finished with it.
+
+Entry:
+fp - file to read from
+
+Exit:
+nwords    - number of words returned
+orig_line - the original line of characters
+returns a list of words from the line, or NULL if end-of-file
+******************************************************************************/
+
+char **get_words( FILE *fp, int *nwords, char **orig_line )
+{
+#define BIG_STRING 4096
+  static char str[BIG_STRING];
+  static char str_copy[BIG_STRING];
+  char*      *words;
+  int         max_words = 10;
+  int         num_words = 0;
+  char       *ptr,*ptr2;
+  char       *result;
+
+  words = ( char * *  ) myalloc ( sizeof ( char * ) * max_words );
+
+  /* read in a line */
+  result = fgets ( str, BIG_STRING, fp );
+  if ( result == NULL )
+  {
+    *nwords = 0;
+    *orig_line = NULL;
+    return ( NULL );
+  }
+
+  /* convert line-feed and tabs into spaces */
+  /* (this guarentees that there will be a space before the */
+  /*  null character at the end of the string) */
+
+  str[BIG_STRING - 2] = ' ';
+  str[BIG_STRING - 1] = '\0';
+
+  for ( ptr = str, ptr2 = str_copy; *ptr != '\0'; ptr++, ptr2++ )
+  {
+    *ptr2 = *ptr;
+    if ( *ptr == '\t' )
+    {
+      *ptr = ' ';
+      *ptr2 = ' ';
+    }
+    else if ( *ptr == '\n' )
+    {
+      *ptr = ' ';
+      *ptr2 = ' ';
+      break;
+    }
+    else if ( *ptr == '\r' )
+    {
+      *ptr = ' ';
+      *ptr2 = '\0';
+    }
+  }
+
+  /* find the words in the line */
+
+  ptr = str;
+  while ( *ptr != '\0' )
+  {
+    /* jump over leading spaces */
+    while ( *ptr == ' ' )
+      ptr++;
+
+    /* break if we reach the end */
+    if ( *ptr == '\0' )
+      break;
+
+    /* allocate more room for words if necessary */
+    if ( num_words >= max_words )
+    {
+      max_words += 10;
+      words = ( char * *  ) realloc ( words, sizeof ( char * ) * max_words );
+    }
+
+    if ( *ptr == '\"' )
+    {
+      /* a quote indidicates that we have a string */
+
+      /* skip over leading quote */
+      ptr++;
+
+      /* save pointer to beginning of word */
+      words[num_words++] = ptr;
+
+      /* find trailing quote or end of line */
+      while ( *ptr != '\"' && *ptr != '\0' )
+        ptr++;
+
+      /* replace quote with a null character to mark the end of the word */
+      /* if we are not already at the end of the line */
+      if ( *ptr != '\0' )
+        *ptr++ = '\0';
+    }
+    else
+    {
+      /* non-string */
+
+      /* save pointer to beginning of word */
+      words[num_words++] = ptr;
+
+      /* jump over non-spaces */
+      while ( *ptr != ' ' )
+        ptr++;
+
+      /* place a null character here to mark the end of the word */
+      *ptr++ = '\0';
+    }
+  }
+
+  /* return the list of words */
+  *nwords = num_words;
+  *orig_line = str_copy;
+  return ( words );
+}
+
+
+/******************************************************************************
+Return the value of an item, given a pointer to it and its type.
+
+Entry:
+item - pointer to item
+type - data type that "item" points to
+
+Exit:
+returns a double-precision float that contains the value of the item
+******************************************************************************/
+
+double get_item_value( const char *item, int type )
+{
+  unsigned char *puchar;
+  char       *pchar;
+  short int  *pshort;
+  unsigned short int *pushort;
+  int  *pint;
+  unsigned int *puint;
+  float  *pfloat;
+  double *pdouble;
+  int     int_value;
+  unsigned int uint_value;
+  double  double_value;
+
+  switch ( type )
+  {
+    case Int8:
+      pchar = ( char * ) item;
+      int_value = *pchar;
+      return ( ( double ) int_value );
+    case Uint8:
+      puchar = ( unsigned char * ) item;
+      int_value = *puchar;
+      return ( ( double ) int_value );
+    case Int16:
+      pshort = ( short int * ) item;
+      int_value = *pshort;
+      return ( ( double ) int_value );
+    case Uint16:
+      pushort = ( unsigned short int * ) item;
+      int_value = *pushort;
+      return ( ( double ) int_value );
+    case Int32:
+      pint = ( int * ) item;
+      int_value = *pint;
+      return ( ( double ) int_value );
+    case Uint32:
+      puint = ( unsigned int * ) item;
+      uint_value = *puint;
+      return ( ( double ) uint_value );
+    case Float32:
+      pfloat = ( float * ) item;
+      double_value = *pfloat;
+      return ( double_value );
+    case Float64:
+      pdouble = ( double * ) item;
+      double_value = *pdouble;
+      return ( double_value );
+    default:
+      fprintf ( stderr, "get_item_value: bad type = %d\n", type );
+      exit ( -1 );
+  }
+
+  return ( 0.0 );  /* never actually gets here */
+}
+
+
+/******************************************************************************
+Write out an item to a file as raw binary bytes.
+
+Entry:
+fp         - file to write to
+int_val    - integer version of item
+uint_val   - unsigned integer version of item
+double_val - double-precision float version of item
+type       - data type to write out
+******************************************************************************/
+
+void write_binary_item( FILE *fp, int int_val, unsigned int uint_val, double double_val, int type )
+{
+  unsigned char uchar_val;
+  char  char_val;
+  unsigned short ushort_val;
+  short short_val;
+  float float_val;
+
+  switch ( type )
+  {
+    case Int8:
+      char_val = int_val;
+      fwrite ( &char_val, 1, 1, fp );
+      break;
+    case Int16:
+      short_val = int_val;
+      fwrite ( &short_val, 2, 1, fp );
+      break;
+    case Int32:
+      fwrite ( &int_val, 4, 1, fp );
+      break;
+    case Uint8:
+      uchar_val = uint_val;
+      fwrite ( &uchar_val, 1, 1, fp );
+      break;
+    case Uint16:
+      ushort_val = uint_val;
+      fwrite ( &ushort_val, 2, 1, fp );
+      break;
+    case Uint32:
+      fwrite ( &uint_val, 4, 1, fp );
+      break;
+    case Float32:
+      float_val = ( float ) double_val;
+      fwrite ( &float_val, 4, 1, fp );
+      break;
+    case Float64:
+      fwrite ( &double_val, 8, 1, fp );
+      break;
+    default:
+      fprintf ( stderr, "write_binary_item: bad type = %d\n", type );
+      exit ( -1 );
+  }
+}
+
+
+/******************************************************************************
+Write out an item to a file as ascii characters.
+
+Entry:
+fp         - file to write to
+int_val    - integer version of item
+uint_val   - unsigned integer version of item
+double_val - double-precision float version of item
+type       - data type to write out
+******************************************************************************/
+
+void write_ascii_item( FILE *fp, int int_val, unsigned int uint_val, double double_val, int type )
+{
+  switch ( type )
+  {
+    case Int8:
+    case Int16:
+    case Int32:
+      fprintf ( fp, "%d ", int_val );
+      break;
+    case Uint8:
+    case Uint16:
+    case Uint32:
+      fprintf ( fp, "%u ", uint_val );
+      break;
+    case Float32:
+    case Float64:
+      fprintf ( fp, "%12f ", double_val );
+      break;
+    default:
+      fprintf ( stderr, "write_ascii_item: bad type = %d\n", type );
+      exit ( -1 );
+  }
+}
+
+
+/******************************************************************************
+Get the value of an item that is in memory, and place the result
+into an integer, an unsigned integer and a double.
+
+Entry:
+ptr  - pointer to the item
+type - data type supposedly in the item
+
+Exit:
+int_val    - integer value
+uint_val   - unsigned integer value
+double_val - double-precision floating point value
+******************************************************************************/
+
+void get_stored_item( void *ptr, int type, int *int_val, unsigned int *uint_val, double *double_val )
+{
+  switch ( type )
+  {
+    case Int8:
+      *int_val = *( ( char * ) ptr );
+      *uint_val = *int_val;
+      *double_val = *int_val;
+      break;
+    case Uint8:
+      *uint_val = *( ( unsigned char * ) ptr );
+      *int_val = *uint_val;
+      *double_val = *uint_val;
+      break;
+    case Int16:
+      *int_val = *( ( short int * ) ptr );
+      *uint_val = *int_val;
+      *double_val = *int_val;
+      break;
+    case Uint16:
+      *uint_val = *( ( unsigned short int * ) ptr );
+      *int_val = *uint_val;
+      *double_val = *uint_val;
+      break;
+    case Int32:
+      *int_val = *( ( int * ) ptr );
+      *uint_val = *int_val;
+      *double_val = *int_val;
+      break;
+    case Uint32:
+      *uint_val = *( ( unsigned int * ) ptr );
+      *int_val = *uint_val;
+      *double_val = *uint_val;
+      break;
+    case Float32:
+      *double_val = *( ( float * ) ptr );
+      *int_val = ( int ) *double_val;
+      *uint_val = ( unsigned int ) *double_val;
+      break;
+    case Float64:
+      *double_val = *( ( double * ) ptr );
+      *int_val = ( int ) *double_val;
+      *uint_val = ( unsigned int ) *double_val;
+      break;
+    default:
+      fprintf ( stderr, "get_stored_item: bad type = %d\n", type );
+      exit ( -1 );
+  }
+}
+
+
+/******************************************************************************
+Get the value of an item from a binary file, and place the result
+into an integer, an unsigned integer and a double.
+
+Entry:
+fp   - file to get item from
+type - data type supposedly in the word
+
+Exit:
+int_val    - integer value
+uint_val   - unsigned integer value
+double_val - double-precision floating point value
+******************************************************************************/
+
+void get_binary_item( FILE *fp, int type, int *int_val, unsigned int *uint_val, double *double_val )
+{
+  char  c[8];
+  void *ptr;
+
+  ptr = ( void * ) c;
+
+  switch ( type )
+  {
+    case Int8:
+      fread ( ptr, 1, 1, fp );
+      *int_val = *( ( char * ) ptr );
+      *uint_val = *int_val;
+      *double_val = *int_val;
+      break;
+    case Uint8:
+      fread ( ptr, 1, 1, fp );
+      *uint_val = *( ( unsigned char * ) ptr );
+      *int_val = *uint_val;
+      *double_val = *uint_val;
+      break;
+    case Int16:
+      fread ( ptr, 2, 1, fp );
+      *int_val = *( ( short int * ) ptr );
+      *uint_val = *int_val;
+      *double_val = *int_val;
+      break;
+    case Uint16:
+      fread ( ptr, 2, 1, fp );
+      *uint_val = *( ( unsigned short int * ) ptr );
+      *int_val = *uint_val;
+      *double_val = *uint_val;
+      break;
+    case Int32:
+      fread ( ptr, 4, 1, fp );
+      *int_val = *( ( int * ) ptr );
+      *uint_val = *int_val;
+      *double_val = *int_val;
+      break;
+    case Uint32:
+      fread ( ptr, 4, 1, fp );
+      *uint_val = *( ( unsigned int * ) ptr );
+      *int_val = *uint_val;
+      *double_val = *uint_val;
+      break;
+    case Float32:
+      fread ( ptr, 4, 1, fp );
+      *double_val = *( ( float * ) ptr );
+      *int_val = ( int ) *double_val;
+      *uint_val = ( unsigned int ) *double_val;
+      break;
+    case Float64:
+      fread ( ptr, 8, 1, fp );
+      *double_val = *( ( double * ) ptr );
+      *int_val = ( int ) *double_val;
+      *uint_val = ( unsigned int ) *double_val;
+      break;
+    default:
+      fprintf ( stderr, "get_binary_item: bad type = %d\n", type );
+      exit ( -1 );
+  }
+}
+
+
+/******************************************************************************
+Extract the value of an item from an ascii word, and place the result
+into an integer, an unsigned integer and a double.
+
+Entry:
+word - word to extract value from
+type - data type supposedly in the word
+
+Exit:
+int_val    - integer value
+uint_val   - unsigned integer value
+double_val - double-precision floating point value
+******************************************************************************/
+
+void get_ascii_item( const char *word, int type, int *int_val, unsigned int *uint_val, double *double_val )
+{
+  switch ( type )
+  {
+    case Int8:
+    case Uint8:
+    case Int16:
+    case Uint16:
+    case Int32:
+      *int_val = atoi ( word );
+      *uint_val = *int_val;
+      *double_val = *int_val;
+      break;
+
+    case Uint32:
+      *uint_val = strtoul ( word, ( char * *  ) NULL, 10 );
+      *int_val = *uint_val;
+      *double_val = *uint_val;
+      break;
+
+    case Float32:
+    case Float64:
+      *double_val = atof ( word );
+      *int_val = ( int ) *double_val;
+      *uint_val = ( unsigned int ) *double_val;
+      break;
+
+    default:
+      fprintf ( stderr, "get_ascii_item: bad type = %d\n", type );
+      exit ( -1 );
+  }
+}
+
+
+/******************************************************************************
+Store a value into a place being pointed to, guided by a data type.
+
+Entry:
+item       - place to store value
+type       - data type
+int_val    - integer version of value
+uint_val   - unsigned integer version of value
+double_val - double version of value
+
+Exit:
+item - pointer to stored value
+******************************************************************************/
+
+void store_item( char *item, int type, int int_val, unsigned int uint_val, double double_val )
+{
+  unsigned char *puchar;
+  short int  *pshort;
+  unsigned short int *pushort;
+  int  *pint;
+  unsigned int *puint;
+  float  *pfloat;
+  double *pdouble;
+
+  switch ( type )
+  {
+    case Int8:
+      *item = int_val;
+      break;
+    case Uint8:
+      puchar = ( unsigned char * ) item;
+      *puchar = uint_val;
+      break;
+    case Int16:
+      pshort = ( short * ) item;
+      *pshort = int_val;
+      break;
+    case Uint16:
+      pushort = ( unsigned short * ) item;
+      *pushort = uint_val;
+      break;
+    case Int32:
+      pint = ( int * ) item;
+      *pint = int_val;
+      break;
+    case Uint32:
+      puint = ( unsigned int * ) item;
+      *puint = uint_val;
+      break;
+    case Float32:
+      pfloat = ( float * ) item;
+      *pfloat = ( float ) double_val;
+      break;
+    case Float64:
+      pdouble = ( double * ) item;
+      *pdouble = double_val;
+      break;
+    default:
+      fprintf ( stderr, "store_item: bad type = %d\n", type );
+      exit ( -1 );
+  }
+}
+
+
+/******************************************************************************
+Add an element to a PLY file descriptor.
+
+Entry:
+plyfile - PLY file descriptor
+words   - list of words describing the element
+nwords  - number of words in the list
+******************************************************************************/
+
+void add_element( PlyFile *plyfile, char **words, int nwords )
+{
+  PlyElement *elem;
+
+  /* create the new element */
+  elem = ( PlyElement *  ) myalloc ( sizeof ( PlyElement ) );
+  elem->name = strdup ( words[1] );
+  elem->num = atoi ( words[2] );
+  elem->nprops = 0;
+
+  /* make room for new element in the object's list of elements */
+  if ( plyfile->num_elem_types == 0 )
+    plyfile->elems = ( PlyElement *  *  ) myalloc ( sizeof ( PlyElement *  ) );
+  else
+    plyfile->elems = ( PlyElement *  *  ) realloc ( plyfile->elems,
+    sizeof ( PlyElement *  ) * ( plyfile->num_elem_types + 1 ) );
+
+  /* add the new element to the object's list */
+  plyfile->elems[plyfile->num_elem_types] = elem;
+  plyfile->num_elem_types++;
+}
+
+
+/******************************************************************************
+Return the type of a property, given the name of the property.
+
+Entry:
+name - name of property type
+
+Exit:
+returns integer code for property, or 0 if not found
+******************************************************************************/
+
+int get_prop_type( const char *type_name )
+{
+  int i;
+
+  /* try to match the type name */
+  for ( i = StartType + 1; i < EndType; i++ )
+    if ( equal_strings ( type_name, type_names[i] ) )
+      return ( i );
+
+  /* see if we can match an old type name */
+  for ( i = StartType + 1; i < EndType; i++ )
+    if ( equal_strings ( type_name, old_type_names[i] ) )
+      return ( i );
+
+  /* if we get here, we didn't find the type */
+  return ( 0 );
+}
+
+
+/******************************************************************************
+Add a property to a PLY file descriptor.
+
+Entry:
+plyfile - PLY file descriptor
+words   - list of words describing the property
+nwords  - number of words in the list
+******************************************************************************/
+
+void add_property( PlyFile *plyfile, char **words, int nwords )
+{
+  PlyProperty  *prop;
+  PlyElement   *elem;
+
+  /* create the new property */
+
+  prop = ( PlyProperty *  ) myalloc ( sizeof ( PlyProperty ) );
+
+  if ( equal_strings ( words[1], "list" ) )
+  {
+    /* list */
+    prop->count_external = get_prop_type ( words[2] );
+    prop->external_type = get_prop_type ( words[3] );
+    prop->name = strdup ( words[4] );
+    prop->is_list = PLY_LIST;
+  }
+  else if ( equal_strings ( words[1], "string" ) )
+  {
+    /* string */
+    prop->count_external = Int8;
+    prop->external_type = Int8;
+    prop->name = strdup ( words[2] );
+    prop->is_list = PLY_STRING;
+  }
+  else
+  {
+    /* scalar */
+    prop->external_type = get_prop_type ( words[1] );
+    prop->name = strdup ( words[2] );
+    prop->is_list = PLY_SCALAR;
+  }
+
+  /* add this property to the list of properties of the current element */
+
+  elem = plyfile->elems[plyfile->num_elem_types - 1];
+
+  if ( elem->nprops == 0 )
+    elem->props = ( PlyProperty *  *  ) myalloc ( sizeof ( PlyProperty *  ) );
+  else
+    elem->props = ( PlyProperty *  *  ) realloc ( elem->props,
+    sizeof ( PlyProperty *  ) * ( elem->nprops + 1 ) );
+
+  elem->props[elem->nprops] = prop;
+  elem->nprops++;
+}
+
+
+/******************************************************************************
+Add a comment to a PLY file descriptor.
+
+Entry:
+plyfile - PLY file descriptor
+line    - line containing comment
+******************************************************************************/
+
+void add_comment( PlyFile *plyfile, const char *line )
+{
+  int i;
+
+  /* skip over "comment" and leading spaces and tabs */
+  i = 7;
+  while ( line[i] == ' ' || line[i] == '\t' )
+    i++;
+
+  append_comment_ply ( plyfile, &line[i] );
+}
+
+
+/******************************************************************************
+Add a some object information to a PLY file descriptor.
+
+Entry:
+plyfile - PLY file descriptor
+line    - line containing text info
+******************************************************************************/
+
+void add_obj_info( PlyFile *plyfile, const char *line )
+{
+  int i;
+
+  /* skip over "obj_info" and leading spaces and tabs */
+  i = 8;
+  while ( line[i] == ' ' || line[i] == '\t' )
+    i++;
+
+  append_obj_info_ply ( plyfile, &line[i] );
+}
+
+
+/******************************************************************************
+Copy a property.
+******************************************************************************/
+
+void copy_property( PlyProperty *dest, PlyProperty *src )
+{
+  dest->name = strdup ( src->name );
+  dest->external_type = src->external_type;
+  dest->internal_type = src->internal_type;
+  dest->offset = src->offset;
+
+  dest->is_list = src->is_list;
+  dest->count_external = src->count_external;
+  dest->count_internal = src->count_internal;
+  dest->count_offset = src->count_offset;
+}
+
+
+/******************************************************************************
+Allocate some memory.
+
+Entry:
+size  - amount of memory requested (in bytes)
+lnum  - line number from which memory was requested
+fname - file name from which memory was requested
+******************************************************************************/
+
+static char *my_alloc( int size, int lnum, const char *fname )
+{
+  char *ptr;
+
+  ptr = ( char * ) malloc ( size );
+
+  if ( ptr == 0 )
+  {
+    fprintf( stderr, "Memory allocation bombed on line %d in %s\n", lnum, fname );
+  }
+
+  return ( ptr );
+}
+
+
+/**** NEW STUFF ****/
+/**** NEW STUFF ****/
+/**** NEW STUFF ****/
+/**** NEW STUFF ****/
+
+
+
+/******************************************************************************
+Given a file pointer, get ready to read PLY data from the file.
+
+Entry:
+fp - the given file pointer
+
+Exit:
+nelems     - number of elements in object
+elem_names - list of element names
+returns a pointer to a PlyFile, used to refer to this file, or NULL if error
+******************************************************************************/
+
+PlyFile *read_ply( FILE *fp )
+{
+  PlyFile  *ply;
+  int       num_elems;
+  char*    *elem_names;
+
+  ply = ply_read ( fp, &num_elems, &elem_names );
+
+  return ( ply );
+}
+
+
+/******************************************************************************
+Given a file pointer, get ready to write PLY data to the file.
+
+Entry:
+fp         - the given file pointer
+nelems     - number of elements in object
+elem_names - list of element names
+file_type  - file type, either ascii or binary
+
+Exit:
+returns a pointer to a PlyFile, used to refer to this file, or NULL if error
+******************************************************************************/
+
+PlyFile *write_ply( FILE *fp, int nelems, char **elem_names, int file_type )
+{
+  PlyFile  *ply;
+
+  ply = ply_write ( fp, nelems, elem_names, file_type );
+
+  return ( ply );
+}
+
+
+/******************************************************************************
+Return a list of the names of the elements in a particular PLY file.
+
+Entry:
+ply - PLY file whose element name list we want
+
+Exit:
+num_elems  - the number of element names in the list
+returns the list of names
+******************************************************************************/
+
+char **get_element_list_ply( PlyFile *ply, int *num_elems )
+{
+  int     i;
+  char*  *elist;
+
+  /* create the list of element names */
+
+  elist = ( char * *  ) myalloc ( sizeof ( char * ) * ply->num_elem_types );
+  for ( i = 0; i < ply->num_elem_types; i++ )
+    elist[i] = strdup ( ply->elems[i]->name );
+
+  /* return the number of elements and the list of element names */
+  *num_elems = ply->num_elem_types;
+  return ( elist );
+}
+
+
+/******************************************************************************
+Append a comment to a PLY file.
+
+Entry:
+ply     - file to append comment to
+comment - the comment to append
+******************************************************************************/
+
+void append_comment_ply( PlyFile *ply, const char *comment )
+{
+  /* (re)allocate space for new comment */
+  if ( ply->num_comments == 0 )
+    ply->comments = ( char * *  ) myalloc ( sizeof ( char * ) );
+  else
+    ply->comments = ( char * *  ) realloc ( ply->comments,
+    sizeof ( char * ) * ( ply->num_comments + 1 ) );
+
+  /* add comment to list */
+  ply->comments[ply->num_comments] = strdup ( comment );
+  ply->num_comments++;
+}
+
+
+/******************************************************************************
+Copy the comments from one PLY file to another.
+
+Entry:
+out_ply - destination file to copy comments to
+in_ply  - the source of the comments
+******************************************************************************/
+
+void copy_comments_ply( PlyFile *out_ply, PlyFile *in_ply )
+{
+  int i;
+
+  for ( i = 0; i < in_ply->num_comments; i++ )
+    append_comment_ply ( out_ply, in_ply->comments[i] );
+}
+
+
+/******************************************************************************
+Append object information (arbitrary text) to a PLY file.
+
+Entry:
+ply      - file to append object info to
+obj_info - the object info to append
+******************************************************************************/
+
+void append_obj_info_ply( PlyFile *ply, const char *obj_info )
+{
+  /* (re)allocate space for new info */
+  if ( ply->num_obj_info == 0 )
+    ply->obj_info = ( char * *  ) myalloc ( sizeof ( char * ) );
+  else
+    ply->obj_info = ( char * *  ) realloc ( ply->obj_info,
+    sizeof ( char * ) * ( ply->num_obj_info + 1 ) );
+
+  /* add info to list */
+  ply->obj_info[ply->num_obj_info] = strdup ( obj_info );
+  ply->num_obj_info++;
+}
+
+
+/******************************************************************************
+Copy the object information from one PLY file to another.
+
+Entry:
+out_ply - destination file to copy object information to
+in_ply  - the source of the object information
+******************************************************************************/
+
+void copy_obj_info_ply( PlyFile *out_ply, PlyFile *in_ply )
+{
+  int i;
+
+  for ( i = 0; i < in_ply->num_obj_info; i++ )
+    append_obj_info_ply ( out_ply, in_ply->obj_info[i] );
+}
+
+
+/******************************************************************************
+Close a PLY file.
+
+Entry:
+plyfile - identifier of file to close
+******************************************************************************/
+
+void close_ply( PlyFile *plyfile )
+{
+  fclose ( plyfile->fp );
+}
+
+
+/******************************************************************************
+Free the memory used by a PLY file.
+
+Entry:
+plyfile - identifier of file
+******************************************************************************/
+
+void free_ply( PlyFile *plyfile )
+{
+  /* free up memory associated with the PLY file */
+  free ( plyfile );
+}
+
+
+/******************************************************************************
+Specify the index of the next element to be read in from a PLY file.
+
+Entry:
+ply - file to read from
+index - index of the element to be read
+
+Exit:
+elem_count - the number of elements in the file
+returns pointer to the name of this next element
+******************************************************************************/
+
+char *setup_element_read_ply( PlyFile *ply, int index, int *elem_count )
+{
+  PlyElement *elem;
+
+  if ( index < 0 || index > ply->num_elem_types )
+  {
+    fprintf ( stderr, "Warning:  No element with index %d\n", index );
+    return ( 0 );
+  }
+
+  elem = ply->elems[index];
+
+  /* set this to be the current element */
+  ply->which_elem = elem;
+
+  /* return the number of such elements in the file and the element's name */
+  *elem_count = elem->num;
+  return ( elem->name );
+}
+
+
+/******************************************************************************
+Read one element from the file.  This routine assumes that we're reading
+the type of element specified in the last call to the routine
+setup_element_read_ply().
+
+Entry:
+plyfile  - file identifier
+elem_ptr - pointer to location where the element information should be put
+******************************************************************************/
+
+void get_element_ply( PlyFile *plyfile, void *elem_ptr )
+{
+  if ( plyfile->file_type == PLY_ASCII )
+    ascii_get_element ( plyfile, ( char * ) elem_ptr );
+  else
+    binary_get_element ( plyfile, ( char * ) elem_ptr );
+}
+
+
+/******************************************************************************
+Specify one of several properties of the current element that is to be
+read from a file.  This should be called (usually multiple times) before a
+call to the routine get_element_ply().
+
+Entry:
+plyfile - file identifier
+prop    - property to add to those that will be returned
+
+Exit:
+0 if the property has not been found
+1 if the property has been found
+******************************************************************************/
+
+int setup_property_ply( PlyFile *plyfile, PlyProperty *prop )
+{
+  PlyElement   *elem;
+  PlyProperty  *prop_ptr;
+  int           index;
+
+  elem = plyfile->which_elem;
+
+  /* deposit the property information into the element's description */
+
+  prop_ptr = find_property ( elem, prop->name, &index );
+  if ( prop_ptr == NULL )
+  {
+    fprintf ( stderr, "Warning:  Can't find property '%s' in element '%s'\n",
+    prop->name, elem->name );
+    return 0;
+  }
+  prop_ptr->internal_type = prop->internal_type;
+  prop_ptr->offset = prop->offset;
+  prop_ptr->count_internal = prop->count_internal;
+  prop_ptr->count_offset = prop->count_offset;
+
+  /* specify that the user wants this property */
+  elem->store_prop[index] = STORE_PROP;
+  return 1 ;
+}
+
+
+/******************************************************************************
+Specify that we want the "other" properties of the current element to be tucked
+away within the user's structure.
+
+Entry:
+plyfile - file identifier
+offset  - offset to where other_props will be stored inside user's structure
+
+Exit:
+returns pointer to structure containing description of other_props
+******************************************************************************/
+
+PlyOtherProp *get_other_properties_ply( PlyFile *plyfile, int offset )
+{
+  PlyOtherProp *other;
+
+  other = get_other_properties ( plyfile, plyfile->which_elem, offset );
+  return ( other );
+}
+
+
+/******************************************************************************
+Describe which element is to be written next and state how many of them will
+be written.
+
+Entry:
+plyfile   - file identifier
+elem_name - name of element that information is being described
+nelems    - number of elements of this type to be written
+******************************************************************************/
+
+void describe_element_ply( PlyFile *plyfile, char *elem_name, int nelems )
+{
+  PlyElement *elem;
+
+  /* look for appropriate element */
+  elem = find_element ( plyfile, elem_name );
+  if ( elem == NULL )
+  {
+    fprintf( stderr,"describe_element_ply: can't find element '%s'\n",elem_name );
+    exit ( -1 );
+  }
+
+  elem->num = nelems;
+
+  /* now this element is the current element */
+  plyfile->which_elem = elem;
+}
+
+
+/******************************************************************************
+Describe a property of an element.
+
+Entry:
+plyfile   - file identifier
+prop      - the new property
+******************************************************************************/
+
+void describe_property_ply( PlyFile *plyfile, PlyProperty *prop )
+{
+  PlyElement   *elem;
+  PlyProperty  *elem_prop;
+
+  elem = plyfile->which_elem;
+
+  /* create room for new property */
+
+  if ( elem->nprops == 0 )
+  {
+    elem->props = ( PlyProperty *  *  ) myalloc ( sizeof ( PlyProperty *  ) );
+    elem->store_prop = ( char * ) myalloc ( sizeof ( char ) );
+    elem->nprops = 1;
+  }
+  else
+  {
+    elem->nprops++;
+    elem->props = ( PlyProperty *  *  )
+    realloc ( elem->props, sizeof ( PlyProperty *  ) * elem->nprops );
+    elem->store_prop = ( char * )
+    realloc ( elem->store_prop, sizeof ( char ) * elem->nprops );
+  }
+
+  /* copy the new property */
+
+  elem_prop = ( PlyProperty *  ) myalloc ( sizeof ( PlyProperty ) );
+  elem->props[elem->nprops - 1] = elem_prop;
+  elem->store_prop[elem->nprops - 1] = NAMED_PROP;
+  copy_property ( elem_prop, prop );
+}
+
+
+/******************************************************************************
+Describe what the "other" properties are that are to be stored, and where
+they are in an element.
+******************************************************************************/
+
+void describe_other_properties_ply( PlyFile *plyfile, PlyOtherProp *other, int offset )
+{
+  int           i;
+  PlyElement   *elem;
+  PlyProperty  *prop;
+
+  /* look for appropriate element */
+  elem = find_element ( plyfile, other->name );
+  if ( elem == NULL )
+  {
+    fprintf( stderr, "describe_other_properties_ply: can't find element '%s'\n",
+    other->name );
+    return;
+  }
+
+  /* create room for other properties */
+
+  if ( elem->nprops == 0 )
+  {
+    elem->props = ( PlyProperty *  *  )
+    myalloc ( sizeof ( PlyProperty *  ) * other->nprops );
+    elem->store_prop = ( char * ) myalloc ( sizeof ( char ) * other->nprops );
+    elem->nprops = 0;
+  }
+  else
+  {
+    int newsize;
+    newsize = elem->nprops + other->nprops;
+    elem->props = ( PlyProperty *  *  )
+    realloc ( elem->props, sizeof ( PlyProperty *  ) * newsize );
+    elem->store_prop = ( char * )
+    realloc ( elem->store_prop, sizeof ( char ) * newsize );
+  }
+
+  /* copy the other properties */
+
+  for ( i = 0; i < other->nprops; i++ )
+  {
+    prop = ( PlyProperty *  ) myalloc ( sizeof ( PlyProperty ) );
+    copy_property ( prop, other->props[i] );
+    elem->props[elem->nprops] = prop;
+    elem->store_prop[elem->nprops] = OTHER_PROP;
+    elem->nprops++;
+  }
+
+  /* save other info about other properties */
+  elem->other_size = other->size;
+  elem->other_offset = offset;
+}
+
+
+/******************************************************************************
+Pass along a pointer to "other" elements that we want to save in a given
+PLY file.  These other elements were presumably read from another PLY file.
+
+Entry:
+plyfile     - file pointer in which to store this other element info
+other_elems - info about other elements that we want to store
+******************************************************************************/
+
+void describe_other_elements_ply( PlyFile *plyfile, PlyOtherElems *other_elems )
+{
+  int         i;
+  OtherElem  *other;
+
+  /* ignore this call if there is no other element */
+  if ( other_elems == NULL )
+    return;
+
+  /* save pointer to this information */
+  plyfile->other_elems = other_elems;
+
+  /* describe the other properties of this element */
+
+  for ( i = 0; i < other_elems->num_elems; i++ )
+  {
+    other = &( other_elems->other_list[i] );
+    element_count_ply ( plyfile, other->elem_name, other->elem_count );
+    describe_other_properties_ply ( plyfile, other->other_props,
+    offsetof( OtherData,other_props ) );
+  }
+}
+
+
+
+/**** Property Propagation Rules ****/
+
+
+typedef struct RuleName {
+int code;
+const char *name;
+} RuleName;
+
+const RuleName  rule_name_list[]  = {
+{AVERAGE_RULE, "avg"},
+{RANDOM_RULE, "rnd"},
+{MINIMUM_RULE, "max"},
+{MAXIMUM_RULE, "min"},
+{MAJORITY_RULE, "major"},
+{SAME_RULE, "same"},
+{-1, "end_marker"},
+};
+
+
+
+/******************************************************************************
+Initialize the property propagation rules for an element.  Default is to
+use averaging (AVERAGE_RULE) for creating all new properties.
+
+Entry:
+ply       - PLY object that this is for
+elem_name - name of the element that we're making the rules for
+
+Exit:
+returns pointer to the default rules
+******************************************************************************/
+
+PlyPropRules *init_rule_ply( PlyFile *ply, char *elem_name )
+{
+  int           i,j;
+  PlyElement   *elem;
+  PlyPropRules *rules;
+  PlyRuleList  *list;
+  int           found_prop;
+
+  elem = find_element ( ply, elem_name );
+  if ( elem == NULL )
+  {
+    fprintf ( stderr, "init_rule_ply: Can't find element '%s'\n", elem_name );
+    exit ( -1 );
+  }
+
+  rules = ( PlyPropRules *  ) myalloc ( sizeof ( PlyPropRules ) );
+  rules->elem = elem;
+  rules->rule_list = ( int * ) myalloc ( sizeof( int ) * elem->nprops );
+  rules->max_props = 0;
+  rules->nprops = 0;
+
+  /* default is to use averaging rule */
+  for ( i = 0; i < elem->nprops; i++ )
+    rules->rule_list[i] = AVERAGE_RULE;
+
+  /* see if there are other rules we should use */
+
+  if ( ply->rule_list == NULL )
+    return ( rules );
+
+  /* try to match the element, property and rule name */
+
+  for ( list = ply->rule_list; list != NULL; list = list->next )
+  {
+    if ( !equal_strings ( list->element, elem->name ) )
+      continue;
+
+    found_prop = 0;
+
+    for ( i = 0; i < elem->nprops; i++ )
+      if ( equal_strings ( list->property, elem->props[i]->name ) )
+      {
+        found_prop = 1;
+
+        /* look for matching rule name */
+        for ( j = 0; rule_name_list[j].code != -1; j++ )
+          if ( equal_strings ( list->name, rule_name_list[j].name ) )
+          {
+            rules->rule_list[i] = rule_name_list[j].code;
+            break;
+          }
+      }
+
+    if ( !found_prop )
+    {
+      fprintf ( stderr, "Can't find property '%s' for rule '%s'\n",
+      list->property, list->name );
+      continue;
+    }
+  }
+
+  return ( rules );
+}
+
+
+/******************************************************************************
+odify a property propagation rule.
+
+Entry:
+rules - rules for the element
+prop_name - name of the property whose rule we're modifying
+rule_type - type of rule (MAXIMUM_RULE, MINIMUM_RULE, MAJORITY_RULE, etc.)
+******************************************************************************/
+
+void modify_rule_ply( PlyPropRules *rules, char *prop_name, int rule_type )
+{
+  int         i;
+  PlyElement *elem  = rules->elem;
+
+  /* find the property and modify its rule type */
+
+  for ( i = 0; i < elem->nprops; i++ )
+    if ( equal_strings ( elem->props[i]->name, prop_name ) )
+    {
+      rules->rule_list[i] = rule_type;
+      return;
+    }
+
+  /* we didn't find the property if we get here */
+  fprintf ( stderr, "modify_rule_ply: Can't find property '%s'\n", prop_name );
+  exit ( -1 );
+}
+
+
+/******************************************************************************
+Begin to create a set of properties from a set of propagation rules.
+
+Entry:
+ply   - PLY object whose rules we're preparing to use
+rules - rules for the element
+******************************************************************************/
+
+void start_props_ply( PlyFile *ply, PlyPropRules *rules )
+{
+  /*  PlyElement *elem  = rules->elem; */
+
+  /* save pointer to the rules in the PLY object */
+  ply->current_rules = rules;
+
+  /* get ready for new sets of properties to combine */
+  rules->nprops = 0;
+}
+
+
+/******************************************************************************
+Remember a set of properties and their weights for creating a new set of
+properties.
+
+Entry:
+weight      - weights for this set of properties
+other_props - the properties to use
+******************************************************************************/
+
+void weight_props_ply( PlyFile *ply, float weight, void *other_props )
+{
+  PlyPropRules *rules = ply->current_rules;
+
+  /* allocate space for properties and weights, if necessary */
+  if ( rules->max_props == 0 )
+  {
+    rules->max_props = 6;
+    rules->props = ( void * *  ) myalloc ( sizeof ( void * ) * rules->max_props );
+    rules->weights = ( float * ) myalloc ( sizeof ( float ) * rules->max_props );
+  }
+  if ( rules->nprops == rules->max_props )
+  {
+    rules->max_props *= 2;
+    rules->props = ( void * *  ) realloc ( rules->props,
+    sizeof ( void * ) * rules->max_props );
+    rules->weights = ( float * ) realloc ( rules->weights,
+    sizeof ( float ) * rules->max_props );
+  }
+
+  /* remember these new properties and their weights */
+
+  rules->props[rules->nprops] = other_props;
+  rules->weights[rules->nprops] = weight;
+  rules->nprops++;
+}
+
+
+/******************************************************************************
+Return a pointer to a new set of properties that have been created using
+a specified set of property combination rules and a given collection of
+"other" properties.
+
+Exit:
+returns a pointer to the new properties
+******************************************************************************/
+
+void *get_new_props_ply( PlyFile *ply )
+{
+  int             i,j;
+  static double  *vals;
+  static int      max_vals  = 0;
+  PlyPropRules   *rules     = ply->current_rules;
+  PlyElement     *elem      = rules->elem;
+  PlyProperty    *prop;
+  char           *data;
+  char           *new_data;
+  void           *ptr;
+  int             offset;
+  int             type;
+  double          double_val;
+  int             int_val;
+  unsigned int uint_val;
+  int random_pick;
+
+  /* return NULL if we've got no "other" properties */
+  if ( elem->other_size == 0 )
+  {
+    return ( NULL );
+  }
+
+  /* create room for combined other properties */
+  new_data = ( char * ) myalloc ( sizeof ( char ) * elem->other_size );
+
+  /* make sure there is enough room to store values we're to combine */
+
+  if ( max_vals == 0 )
+  {
+    max_vals = rules->nprops;
+    vals = ( double * ) myalloc ( sizeof ( double ) * rules->nprops );
+  }
+  if ( rules->nprops >= max_vals )
+  {
+    max_vals = rules->nprops;
+    vals = ( double * ) realloc ( vals, sizeof ( double ) * rules->nprops );
+  }
+
+  /* in case we need a random choice */
+  random_pick = ( int ) floor ( (double)rules->nprops ); //* drand48());
+
+  /* calculate the combination for each "other" property of the element */
+
+  for ( i = 0; i < elem->nprops; i++ )
+  {
+    /* don't bother with properties we've been asked to store explicitly */
+    if ( elem->store_prop[i] )
+      continue;
+
+    prop = elem->props[i];
+    offset = prop->offset;
+    type = prop->external_type;
+
+    /* collect together all the values we're to combine */
+
+    for ( j = 0; j < rules->nprops; j++ )
+    {
+      data = ( char * ) rules->props[j];
+      ptr = ( void * ) ( data + offset );
+      get_stored_item ( ( void * ) ptr, type, &int_val, &uint_val, &double_val );
+      vals[j] = double_val;
+    }
+
+    /* calculate the combined value */
+
+    switch ( rules->rule_list[i] )
+    {
+      case AVERAGE_RULE:
+        {
+        double  sum         = 0;
+        double  weight_sum  = 0;
+        for ( j = 0; j < rules->nprops; j++ )
+        {
+          sum += vals[j] * rules->weights[j];
+          weight_sum += rules->weights[j];
+        }
+        double_val = sum / weight_sum;
+        break;
+      }
+      case MINIMUM_RULE:
+        {
+        double_val = vals[0];
+        for ( j = 1; j < rules->nprops; j++ )
+          if ( double_val > vals[j] )
+            double_val = vals[j];
+        break;
+      }
+      case MAXIMUM_RULE:
+        {
+        double_val = vals[0];
+        for ( j = 1; j < rules->nprops; j++ )
+          if ( double_val < vals[j] )
+            double_val = vals[j];
+        break;
+      }
+      case RANDOM_RULE:
+        {
+        double_val = vals[random_pick];
+        break;
+      }
+      case SAME_RULE:
+        {
+        double_val = vals[0];
+        for ( j = 1; j < rules->nprops; j++ )
+          if ( double_val != vals[j] )
+          {
+            fprintf ( stderr,
+            "get_new_props_ply: Error combining properties that should be the same.\n" );
+            exit ( -1 );
+          }
+        break;
+      }
+      default:
+        fprintf ( stderr, "get_new_props_ply: Bad rule = %d\n",
+        rules->rule_list[i] );
+        exit ( -1 );
+    }
+
+    /* store the combined value */
+
+    int_val = ( int ) double_val;
+    uint_val = ( unsigned int ) double_val;
+    ptr = ( void * ) ( new_data + offset );
+    store_item ( ( char * ) ptr, type, int_val, uint_val, double_val );
+  }
+
+  return ( ( void * ) new_data );
+}
+
+
+/******************************************************************************
+Set the list of user-specified property combination rules.
+******************************************************************************/
+
+void set_prop_rules_ply( PlyFile *ply, PlyRuleList *prop_rules )
+{
+  ply->rule_list = prop_rules;
+}
+
+
+/******************************************************************************
+Append a property rule to a growing list of user-specified rules.
+
+Entry:
+rule_list - current rule list
+name      - name of property combination rule
+property  - "element.property" says which property the rule affects
+
+Exit:
+returns pointer to the new rule list
+******************************************************************************/
+
+PlyRuleList* append_prop_rule( PlyRuleList *rule_list, char *name, char *property )
+{
+  PlyRuleList  *rule;
+  PlyRuleList  *rule_ptr;
+  char         *str,*str2;
+  char         *ptr;
+
+  /* find . */
+  str = strdup ( property );
+  for ( ptr = str; *ptr != '\0' && *ptr != '.'; ptr++ )
+    ;
+
+  /* split string at . */
+  if ( *ptr == '.' )
+  {
+    *ptr = '\0';
+    str2 = ptr + 1;
+  }
+  else
+  {
+    fprintf ( stderr, "Can't find property '%s' for rule '%s'\n",
+    property, name );
+    return ( rule_list );
+  }
+
+  rule = ( PlyRuleList *  ) malloc ( sizeof ( PlyRuleList ) );
+  rule->name = name;
+  rule->element = str;
+  rule->property = str2;
+  rule->next = NULL;
+
+  /* either start rule list or append to it */
+
+  if ( rule_list == NULL )
+    rule_list = rule;
+  else
+  {
+    /* append new rule to current list */
+    rule_ptr = rule_list;
+    while ( rule_ptr->next != NULL )
+      rule_ptr = rule_ptr->next;
+    rule_ptr->next = rule;
+  }
+
+  /* return pointer to list */
+
+  return ( rule_list );
+}
+
+
+/******************************************************************************
+See if a name matches the name of any property combination rules.
+
+Entry:
+name - name of rule we're trying to match
+
+Exit:
+returns 1 if we find a match, 0 if not
+******************************************************************************/
+
+int matches_rule_name( char* name )
+{
+  int i;
+
+  for ( i = 0; rule_name_list[i].code != -1; i++ )
+    if ( equal_strings ( rule_name_list[i].name, name ) )
+      return ( 1 );
+
+  return ( 0 );
+}
+
+} //namespace
diff --git a/3rdParty/MarchingCubes/McPly.h b/3rdParty/MarchingCubes/McPly.h
index b1cca17280f0d0bff88969a097b03ca891b39fcb..1005323892b76c19c590b86f96ed6c81aacf4ae8 100644
--- a/3rdParty/MarchingCubes/McPly.h
+++ b/3rdParty/MarchingCubes/McPly.h
@@ -1,229 +1,229 @@
-/*
-
-Header for PLY polygon files.
-
-- Greg Turk
-
-A PLY file contains a single polygonal _object_.
-
-An object is composed of lists of _elements_.  Typical elements are
-vertices, faces, edges and materials.
-
-Each type of element for a given object has one or more _properties_
-associated with the element type.  For instance, a vertex element may
-have as properties three floating-point values x,y,z and three unsigned
-chars for red, green and blue.
-
------------------------------------------------------------------------
-
-Copyright (c) 1998 Georgia Institute of Technology.  All rights reserved.
-
-Permission to use, copy, modify and distribute this software and its
-documentation for any purpose is hereby granted without fee, provided
-that the above copyright notice and this permission notice appear in
-all copies of this software and that you do not sell the software.
-
-THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTY OF ANY KIND,
-EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
-WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
-
-*/
-#ifndef MCPLY_H
-#define MCPLY_H
-
-#include <cmath>
-#include <string>
-#include <cstring>
-#include <cstring>
-#include <cstdlib>
-
-namespace McCubes{ 
-
-static const int PLY_ASCII     =  1;  // ascii PLY file 
-static const int PLY_BINARY_BE =  2;  // binary PLY file, big endian 
-static const int PLY_BINARY_LE =  3;  // binary PLY file, little endian 
-
-static const int PLY_OKAY      =  0;  // ply routine worked okay 
-static const int PLY_ERROR     = -1;  // error in ply routine 
-
-/* scalar data types supported by PLY format */
-
-static const int StartType  = 0;
-static const int Int8       = 1;
-static const int Int16      = 2;
-static const int Int32      = 3;
-static const int Uint8      = 4;
-static const int Uint16     = 5;
-static const int Uint32     = 6;
-static const int Float32    = 7;
-static const int Float64    = 8;
-static const int EndType    = 9;
-
-static const int PLY_SCALAR =  0;
-static const int PLY_LIST   =  1;
-static const int PLY_STRING =  2;
-
-
-typedef struct PlyProperty {    /* description of a property */
-
-char *name;                   /* property name */
-int external_type;            /* file's data type */
-int internal_type;            /* program's data type */
-int offset;                   /* offset bytes of prop in a struct */
-
-int is_list;                  /* 0 = scalar, 1 = list, 2 = char string */
-int count_external;           /* file's count type */
-int count_internal;           /* program's count type */
-int count_offset;             /* offset byte for list count */
-
-} PlyProperty;
-
-typedef struct PlyElement {     /* description of an element */
-char *name;                   /* element name */
-int num;                      /* number of elements in this object */
-int size;                     /* size of element (bytes) or -1 if variable */
-int nprops;                   /* number of properties for this element */
-PlyProperty **props;          /* list of properties in the file */
-char *store_prop;             /* flags: property wanted by user? */
-int other_offset;             /* offset to un-asked-for props, or -1 if none*/
-int other_size;               /* size of other_props structure */
-} PlyElement;
-
-typedef struct PlyOtherProp {   /* describes other properties in an element */
-char *name;                   /* element name */
-int size;                     /* size of other_props */
-int nprops;                   /* number of properties in other_props */
-PlyProperty **props;          /* list of properties in other_props */
-} PlyOtherProp;
-
-typedef struct OtherData { /* for storing other_props for an other element */
-void *other_props;
-} OtherData;
-
-typedef struct OtherElem {     /* data for one "other" element */
-char *elem_name;             /* names of other elements */
-int elem_count;              /* count of instances of each element */
-OtherData **other_data;      /* actual property data for the elements */
-PlyOtherProp *other_props;   /* description of the property data */
-} OtherElem;
-
-typedef struct PlyOtherElems {  /* "other" elements, not interpreted by user */
-int num_elems;                /* number of other elements */
-OtherElem *other_list;        /* list of data for other elements */
-} PlyOtherElems;
-
-static const int AVERAGE_RULE  = 1;
-static const int MAJORITY_RULE = 2;
-static const int MINIMUM_RULE  = 3;
-static const int MAXIMUM_RULE  = 4;
-static const int SAME_RULE     = 5;
-static const int RANDOM_RULE   = 6;
-
-typedef struct PlyPropRules {   /* rules for combining "other" properties */
-PlyElement *elem;      /* element whose rules we are making */
-int *rule_list;        /* types of rules (AVERAGE_PLY, MAJORITY_PLY, etc.) */
-int nprops;            /* number of properties we're combining so far */
-int max_props;         /* maximum number of properties we have room for now */
-void **props;          /* list of properties we're combining */
-float *weights;        /* list of weights of the properties */
-} PlyPropRules;
-
-typedef struct PlyRuleList {
-char *name;                  /* name of the rule */
-char *element;               /* name of element that rule applies to */
-char *property;              /* name of property that rule applies to */
-struct PlyRuleList *next;    /* pointer for linked list of rules */
-} PlyRuleList;
-
-typedef struct PlyFile {        /* description of PLY file */
-FILE *fp;                     /* file pointer */
-int file_type;                /* ascii or binary */
-float version;                /* version number of file */
-int num_elem_types;           /* number of element types of object */
-PlyElement **elems;           /* list of elements */
-int num_comments;             /* number of comments */
-char **comments;              /* list of comments */
-int num_obj_info;             /* number of items of object information */
-char **obj_info;              /* list of object info items */
-PlyElement *which_elem;       /* element we're currently reading or writing */
-PlyOtherElems *other_elems;   /* "other" elements from a PLY file */
-PlyPropRules *current_rules;  /* current propagation rules */
-PlyRuleList *rule_list;       /* rule list from user */
-} PlyFile;
-
-// memory allocation 
-//extern char *my_alloc();
-#define myalloc(mem_size) my_alloc((mem_size), __LINE__, __FILE__)
-
-
-// old routines 
-
-#if 0
-extern PlyFile *ply_write(FILE *, int, char **, int);
-extern PlyFile *ply_read(FILE *, int *, char ***);
-extern PlyFile *ply_open_for_reading( const char *, int *, char ***, int *, float *);
-extern void ply_close(PlyFile *);
-extern PlyOtherProp *ply_get_other_properties(PlyFile *, const char *, int);
-#endif
-
-extern void     ply_describe_property( PlyFile * , const char * , PlyProperty * );
-extern void     ply_get_property( PlyFile * , const char * , PlyProperty * );
-extern void     ply_get_element( PlyFile * , void * );
-
-
-//--- delcaration of routines ---
-
-PlyOtherElems  *get_other_element_ply( PlyFile * );
-
-PlyFile        *read_ply( FILE * );
-PlyFile        *write_ply( FILE * , int, char ** , int );
-extern PlyFile *open_for_writing_ply( const char * , int, char ** , int );
-void            close_ply( PlyFile * );
-void            free_ply( PlyFile * );
-
-void            get_info_ply( PlyFile * , float * , int * );
-void            free_other_elements_ply( PlyOtherElems * );
-
-void            append_comment_ply( PlyFile *, const char * );
-void            append_obj_info_ply( PlyFile * , const char * );
-void            copy_comments_ply( PlyFile * , PlyFile * );
-void            copy_obj_info_ply( PlyFile * , PlyFile * );
-char*          *get_comments_ply( PlyFile * , int * );
-char*          *get_obj_info_ply( PlyFile * , int * );
-
-char*          *get_element_list_ply( PlyFile * , int * );
-int             setup_property_ply( PlyFile * , PlyProperty * );
-void            get_element_ply( PlyFile * , void * );
-char           *setup_element_read_ply( PlyFile * , int, int * );
-PlyOtherProp   *get_other_properties_ply( PlyFile * , int );
-
-void            element_count_ply( PlyFile * , const char * , int );
-void            describe_element_ply( PlyFile * , const char * , int );
-void            describe_property_ply( PlyFile * , PlyProperty * );
-void            describe_other_properties_ply( PlyFile * , PlyOtherProp * , int );
-void            describe_other_elements_ply( PlyFile * , PlyOtherElems * );
-void            get_element_setup_ply( PlyFile * , const char * , int, PlyProperty * );
-PlyProperty*   *get_element_description_ply( PlyFile * , const char * , int * , int * );
-void            element_layout_ply( PlyFile * , const char * , int, int, PlyProperty * );
-
-void            header_complete_ply( PlyFile * );
-void            put_element_setup_ply( PlyFile * ,const  char * );
-void            put_element_ply( PlyFile * , void * );
-void            put_other_elements_ply( PlyFile * );
-
-PlyPropRules   *init_rule_ply( PlyFile * , const char * );
-void            modify_rule_ply( PlyPropRules * , const char * , int );
-void            start_props_ply( PlyFile * , PlyPropRules * );
-void            weight_props_ply( PlyFile * , float, void * );
-void           *get_new_props_ply( PlyFile * );
-void            set_prop_rules_ply( PlyFile * , PlyRuleList * );
-PlyRuleList    *append_prop_rule( PlyRuleList * , const char * , const char * );
-int             matches_rule_name( const char * );
-
-int             equal_strings( const char * , const char * );
-char           *recreate_command_line( int, char *argv[] );
-
-} //namespace McCubes
-
-#endif // PLY_H__ 
-
+/*
+
+Header for PLY polygon files.
+
+- Greg Turk
+
+A PLY file contains a single polygonal _object_.
+
+An object is composed of lists of _elements_.  Typical elements are
+vertices, faces, edges and materials.
+
+Each type of element for a given object has one or more _properties_
+associated with the element type.  For instance, a vertex element may
+have as properties three floating-point values x,y,z and three unsigned
+chars for red, green and blue.
+
+-----------------------------------------------------------------------
+
+Copyright (c) 1998 Georgia Institute of Technology.  All rights reserved.
+
+Permission to use, copy, modify and distribute this software and its
+documentation for any purpose is hereby granted without fee, provided
+that the above copyright notice and this permission notice appear in
+all copies of this software and that you do not sell the software.
+
+THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTY OF ANY KIND,
+EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
+WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
+
+*/
+#ifndef MCPLY_H
+#define MCPLY_H
+
+#include <cmath>
+#include <string>
+#include <cstring>
+#include <cstring>
+#include <cstdlib>
+
+namespace McCubes{ 
+
+static const int PLY_ASCII     =  1;  // ascii PLY file 
+static const int PLY_BINARY_BE =  2;  // binary PLY file, big endian 
+static const int PLY_BINARY_LE =  3;  // binary PLY file, little endian 
+
+static const int PLY_OKAY      =  0;  // ply routine worked okay 
+static const int PLY_ERROR     = -1;  // error in ply routine 
+
+/* scalar data types supported by PLY format */
+
+static const int StartType  = 0;
+static const int Int8       = 1;
+static const int Int16      = 2;
+static const int Int32      = 3;
+static const int Uint8      = 4;
+static const int Uint16     = 5;
+static const int Uint32     = 6;
+static const int Float32    = 7;
+static const int Float64    = 8;
+static const int EndType    = 9;
+
+static const int PLY_SCALAR =  0;
+static const int PLY_LIST   =  1;
+static const int PLY_STRING =  2;
+
+
+typedef struct PlyProperty {    /* description of a property */
+
+char *name;                   /* property name */
+int external_type;            /* file's data type */
+int internal_type;            /* program's data type */
+int offset;                   /* offset bytes of prop in a struct */
+
+int is_list;                  /* 0 = scalar, 1 = list, 2 = char string */
+int count_external;           /* file's count type */
+int count_internal;           /* program's count type */
+int count_offset;             /* offset byte for list count */
+
+} PlyProperty;
+
+typedef struct PlyElement {     /* description of an element */
+char *name;                   /* element name */
+int num;                      /* number of elements in this object */
+int size;                     /* size of element (bytes) or -1 if variable */
+int nprops;                   /* number of properties for this element */
+PlyProperty **props;          /* list of properties in the file */
+char *store_prop;             /* flags: property wanted by user? */
+int other_offset;             /* offset to un-asked-for props, or -1 if none*/
+int other_size;               /* size of other_props structure */
+} PlyElement;
+
+typedef struct PlyOtherProp {   /* describes other properties in an element */
+char *name;                   /* element name */
+int size;                     /* size of other_props */
+int nprops;                   /* number of properties in other_props */
+PlyProperty **props;          /* list of properties in other_props */
+} PlyOtherProp;
+
+typedef struct OtherData { /* for storing other_props for an other element */
+void *other_props;
+} OtherData;
+
+typedef struct OtherElem {     /* data for one "other" element */
+char *elem_name;             /* names of other elements */
+int elem_count;              /* count of instances of each element */
+OtherData **other_data;      /* actual property data for the elements */
+PlyOtherProp *other_props;   /* description of the property data */
+} OtherElem;
+
+typedef struct PlyOtherElems {  /* "other" elements, not interpreted by user */
+int num_elems;                /* number of other elements */
+OtherElem *other_list;        /* list of data for other elements */
+} PlyOtherElems;
+
+static const int AVERAGE_RULE  = 1;
+static const int MAJORITY_RULE = 2;
+static const int MINIMUM_RULE  = 3;
+static const int MAXIMUM_RULE  = 4;
+static const int SAME_RULE     = 5;
+static const int RANDOM_RULE   = 6;
+
+typedef struct PlyPropRules {   /* rules for combining "other" properties */
+PlyElement *elem;      /* element whose rules we are making */
+int *rule_list;        /* types of rules (AVERAGE_PLY, MAJORITY_PLY, etc.) */
+int nprops;            /* number of properties we're combining so far */
+int max_props;         /* maximum number of properties we have room for now */
+void **props;          /* list of properties we're combining */
+float *weights;        /* list of weights of the properties */
+} PlyPropRules;
+
+typedef struct PlyRuleList {
+char *name;                  /* name of the rule */
+char *element;               /* name of element that rule applies to */
+char *property;              /* name of property that rule applies to */
+struct PlyRuleList *next;    /* pointer for linked list of rules */
+} PlyRuleList;
+
+typedef struct PlyFile {        /* description of PLY file */
+FILE *fp;                     /* file pointer */
+int file_type;                /* ascii or binary */
+float version;                /* version number of file */
+int num_elem_types;           /* number of element types of object */
+PlyElement **elems;           /* list of elements */
+int num_comments;             /* number of comments */
+char **comments;              /* list of comments */
+int num_obj_info;             /* number of items of object information */
+char **obj_info;              /* list of object info items */
+PlyElement *which_elem;       /* element we're currently reading or writing */
+PlyOtherElems *other_elems;   /* "other" elements from a PLY file */
+PlyPropRules *current_rules;  /* current propagation rules */
+PlyRuleList *rule_list;       /* rule list from user */
+} PlyFile;
+
+// memory allocation 
+//extern char *my_alloc();
+#define myalloc(mem_size) my_alloc((mem_size), __LINE__, __FILE__)
+
+
+// old routines 
+
+#if 0
+extern PlyFile *ply_write(FILE *, int, char **, int);
+extern PlyFile *ply_read(FILE *, int *, char ***);
+extern PlyFile *ply_open_for_reading( const char *, int *, char ***, int *, float *);
+extern void ply_close(PlyFile *);
+extern PlyOtherProp *ply_get_other_properties(PlyFile *, const char *, int);
+#endif
+
+extern void     ply_describe_property( PlyFile * , const char * , PlyProperty * );
+extern void     ply_get_property( PlyFile * , const char * , PlyProperty * );
+extern void     ply_get_element( PlyFile * , void * );
+
+
+//--- delcaration of routines ---
+
+PlyOtherElems  *get_other_element_ply( PlyFile * );
+
+PlyFile        *read_ply( FILE * );
+PlyFile        *write_ply( FILE * , int, char ** , int );
+extern PlyFile *open_for_writing_ply( const char * , int, char ** , int );
+void            close_ply( PlyFile * );
+void            free_ply( PlyFile * );
+
+void            get_info_ply( PlyFile * , float * , int * );
+void            free_other_elements_ply( PlyOtherElems * );
+
+void            append_comment_ply( PlyFile *, const char * );
+void            append_obj_info_ply( PlyFile * , const char * );
+void            copy_comments_ply( PlyFile * , PlyFile * );
+void            copy_obj_info_ply( PlyFile * , PlyFile * );
+char*          *get_comments_ply( PlyFile * , int * );
+char*          *get_obj_info_ply( PlyFile * , int * );
+
+char*          *get_element_list_ply( PlyFile * , int * );
+int             setup_property_ply( PlyFile * , PlyProperty * );
+void            get_element_ply( PlyFile * , void * );
+char           *setup_element_read_ply( PlyFile * , int, int * );
+PlyOtherProp   *get_other_properties_ply( PlyFile * , int );
+
+void            element_count_ply( PlyFile * , const char * , int );
+void            describe_element_ply( PlyFile * , const char * , int );
+void            describe_property_ply( PlyFile * , PlyProperty * );
+void            describe_other_properties_ply( PlyFile * , PlyOtherProp * , int );
+void            describe_other_elements_ply( PlyFile * , PlyOtherElems * );
+void            get_element_setup_ply( PlyFile * , const char * , int, PlyProperty * );
+PlyProperty*   *get_element_description_ply( PlyFile * , const char * , int * , int * );
+void            element_layout_ply( PlyFile * , const char * , int, int, PlyProperty * );
+
+void            header_complete_ply( PlyFile * );
+void            put_element_setup_ply( PlyFile * ,const  char * );
+void            put_element_ply( PlyFile * , void * );
+void            put_other_elements_ply( PlyFile * );
+
+PlyPropRules   *init_rule_ply( PlyFile * , const char * );
+void            modify_rule_ply( PlyPropRules * , const char * , int );
+void            start_props_ply( PlyFile * , PlyPropRules * );
+void            weight_props_ply( PlyFile * , float, void * );
+void           *get_new_props_ply( PlyFile * );
+void            set_prop_rules_ply( PlyFile * , PlyRuleList * );
+PlyRuleList    *append_prop_rule( PlyRuleList * , const char * , const char * );
+int             matches_rule_name( const char * );
+
+int             equal_strings( const char * , const char * );
+char           *recreate_command_line( int, char *argv[] );
+
+} //namespace McCubes
+
+#endif // PLY_H__ 
+
diff --git a/3rdParty/MarchingCubes/McTypes.h b/3rdParty/MarchingCubes/McTypes.h
index 9ff91d5a0b4f8457a6843ce0e957d383c04a2d9e..f2303476e6fcb62f22e5ae82f30c090db1871a88 100644
--- a/3rdParty/MarchingCubes/McTypes.h
+++ b/3rdParty/MarchingCubes/McTypes.h
@@ -1,37 +1,37 @@
-//  _    ___      __              __________      _     __
-// | |  / (_)____/ /___  ______ _/ / ____/ /_  __(_)___/ /____
-// | | / / / ___/ __/ / / / __ `/ / /_  / / / / / / __  / ___/
-// | |/ / / /  / /_/ /_/ / /_/ / / __/ / / /_/ / / /_/ (__  )
-// |___/_/_/   \__/\__,_/\__,_/_/_/   /_/\__,_/_/\__,_/____/
-//
-#ifndef MCTYPES_H
-#define MCTYPES_H
-
-//extension by CAB
-#include <vector>
-#include <string>
-#include <fstream>
-
-#include <basics/utilities/UbException.h>
-#include <basics/container/CbArray3D.h>
-#include <basics/container/CbArray4D.h>
-
-namespace McCubes
-{ 
-
-   #if !defined(WIN32) || defined(__CYGWIN__)
-   #pragma interface
-   #endif // WIN32
-
-   //_____________________________________________________________________________
-   // types
-   /** unsigned char alias */
-   typedef unsigned char   uchar;
-   /** signed char alias */
-   typedef   signed char   schar;
-   /** isovalue alias */
-   typedef          double real;
-
-} //namespace McCubes
-
-#endif //MCTYPES_H
+//  _    ___      __              __________      _     __
+// | |  / (_)____/ /___  ______ _/ / ____/ /_  __(_)___/ /____
+// | | / / / ___/ __/ / / / __ `/ / /_  / / / / / / __  / ___/
+// | |/ / / /  / /_/ /_/ / /_/ / / __/ / / /_/ / / /_/ (__  )
+// |___/_/_/   \__/\__,_/\__,_/_/_/   /_/\__,_/_/\__,_/____/
+//
+#ifndef MCTYPES_H
+#define MCTYPES_H
+
+//extension by CAB
+#include <vector>
+#include <string>
+#include <fstream>
+
+#include <basics/utilities/UbException.h>
+#include <basics/container/CbArray3D.h>
+#include <basics/container/CbArray4D.h>
+
+namespace McCubes
+{ 
+
+   #if !defined(WIN32) || defined(__CYGWIN__)
+   #pragma interface
+   #endif // WIN32
+
+   //_____________________________________________________________________________
+   // types
+   /** unsigned char alias */
+   typedef unsigned char   uchar;
+   /** signed char alias */
+   typedef   signed char   schar;
+   /** isovalue alias */
+   typedef          double real;
+
+} //namespace McCubes
+
+#endif //MCTYPES_H
diff --git a/3rdParty/MarchingCubes/McWrapper.h b/3rdParty/MarchingCubes/McWrapper.h
index a60f18b6bc11cb867fe7d32352dfa221765f9f10..7642cd1d104edab85aee57e13511bfe52b43fc87 100644
--- a/3rdParty/MarchingCubes/McWrapper.h
+++ b/3rdParty/MarchingCubes/McWrapper.h
@@ -1,305 +1,305 @@
-// _    ___      __              __________      _     __
-//| |  / (_)____/ /___  ______ _/ / ____/ /_  __(_)___/ /____
-//| | / / / ___/ __/ / / / __ `/ / /_  / / / / / / __  / ___/
-//| |/ / / /  / /_/ /_/ / /_/ / / __/ / / /_/ / / /_/ (__  )
-//|___/_/_/   \__/\__,_/\__,_/_/_/   /_/\__,_/_/\__,_/____/
-//
-//#ifndef MCWRAPPER_H
-//#define MCWRAPPER_H
-//
-//extension by CAB
-//#include <vector>
-//#include <string>
-//#include <fstream>
-//
-//#include <basics/utilities/UbException.h>
-//#include <basics/container/CbUniformMatrix3D.h>
-//#include <basics/container/CbUniformMatrix4D.h>
-//
-//#include <3rdParty/MarchingCubes/McTypes.h>
-//
-//namespace McCubes{
-//
-//////////////////////////////////////////////////////////////////////////
-//Standard-Wrapper
-//  MarchingCubes<DataWrapper> mc( 10,8,5 );
-//  for(int z=0; z<mc.size_z(); z++)
-//   for(int y=0; y<mc.size_y(); y++)
-//     for(int x=0; x<mc.size_x(); x++)
-//       mc.set_data(x,x,y,z);
-//
-//  //mc.set_method(false) //<-MC methode, STD=false
-//  mc.init_all();
-//
-//  mc.run(3.5);
-//  mc.writeUCD("c:/temp/triangles.inp");
-//  mc.clean_all();
-
-//template< typename T=real >
-//class McDataWrapper
-//{
-//public:
-//   typedef T                                                   value_type;
-//   typedef typename std::vector< value_type >::reference       reference;
-//   typedef typename std::vector< value_type >::const_reference const_reference;
-//   typedef typename std::vector< value_type >::pointer         pointer;
-//   typedef typename std::vector< value_type >::const_pointer   const_pointer;
-//
-//public:
-//   McDataWrapper() : size_x1(-1), size_x2(-1), size_x3(-1)
-//   {
-//   }
-//   /*==========================================================*/
-//   McDataWrapper(const int& size_x1, const int& size_x2, const int& size_x3, const T& initVal=T())
-//   {
-//      this->resize(size_x1,size_x2,size_x3,initVal);
-//   }
-//   /*=======================================================================*/
-//   reference operator() (const int& x1, const int& x2, const int& x3)
-//   {
-//      #ifdef _DEBUG
-//         return this->data.at(x1 + x2*size_x1 + x3*size_x1*size_x2);
-//      #else
-//         return this->data[x1 + x2*size_x1 + x3*size_x1*size_x2];
-//      #endif
-//   }
-//   /*=======================================================================*/
-//   const_reference operator() (const int& x1, const int& x2, const int& x3)	const
-//   {
-//      #ifdef _DEBUG
-//         return this->data.at(x1 + x2*size_x1 + x3*size_x1*size_x2);
-//      #else
-//         return this->data[x1 + x2*size_x1 + x3*size_x1*size_x2];
-//      #endif
-//   }
-//   /*==========================================================*/
-//   inline void setData( const T& val, const int& x1, const int& x2, const int& x3 )
-//   {
-//      #ifdef _DEBUG
-//         this->data.at(x1 + x2*size_x1 + x3*size_x1*size_x2) = val;
-//      #else
-//         this->data[x1 + x2*size_x1 + x3*size_x1*size_x2] = val;
-//      #endif
-//   }
-//   /*==========================================================*/
-//   inline value_type getData(const int& x1, const int& x2, const int& x3 ) const
-//   {
-//      #ifdef _DEBUG
-//         return this->data.at(x1 + x2*size_x1 + x3*size_x1*size_x2);
-//      #else
-//         return this->data[x1 + x2*size_x1 + x3*size_x1*size_x2];
-//      #endif
-//   }
-//   /*==========================================================*/
-//   inline void resize(const int& size_x1, const int& size_x2, const int& size_x3)
-//   {
-//      if(size_x1>0 && size_x2>0 && size_x3>0)
-//      {
-//         this->size_x1 = size_x1;
-//         this->size_x2 = size_x2;
-//         this->size_x3 = size_x3;
-//         this->data.resize(size_x1*size_x2*size_x3);
-//      }
-//   }
-//   /*==========================================================*/
-//   inline void resize(const int& size_x1, const int& size_x2, const int& size_x3, const T& initVal)
-//   {
-//      if(size_x1>0 && size_x2>0 && size_x3>0)
-//      {
-//         this->size_x1 = size_x1;
-//         this->size_x2 = size_x2;
-//         this->size_x3 = size_x3;
-//         this->data.resize(size_x1*size_x2*size_x3,initVal);
-//      }
-//   }
-//   /*==========================================================*/
-//   int getNX1() const { return size_x1; }
-//   int getNX2() const { return size_x2; }
-//   int getNX3() const { return size_x3; }
-//
-//protected:
-//   std::vector<T> data;
-//   int size_x1, size_x2, size_x3;
-//};
-//
-//////////////////////////////////////////////////////////////////////////
-//Matrix4DWrapper-Wrapper
-//example:
-//  int indexForDataValue = 1;
-//  CbUniformMatrix4D<double> data(10,8,5,2);
-//  for(int x3=0; x3<data.getNX3(); x3++)
-//   for(int x2=0; x2<data.getNX2(); x2++)
-//     for(int x1=0; x1<data.getNX1(); x1++)
-//       data(x1,x2,x3,indexForDataValue) = x1;
-//
-//  Matrix4DWrapper< CbUniformMatrix4D<double> > wrapper(&data,indexForDataValue);
-//  MarchingCubes< Matrix4DWrapper< CbUniformMatrix4D<double> > > mc( wrapper );
-//
-//  mc.init_all();
-//  mc.run(3.5);
-//  mc.writeUCD("c:/temp/triangles.inp");
-//  mc.clean_all();
-//template< typename Matrix4D >
-//class Matrix4DWrapper
-//{
-//public:
-//   typedef typename Matrix4D::value_type value_type;
-//
-//public:
-//   Matrix4DWrapper() : valIndex(-1), matrix(NULL), minX1(-1), minX2(-1), minX3(-1), maxX1(-1), maxX2(-1), maxX3(-1)
-//   {
-//      //wird benötigt, damit MarchingCubes generell eine membervariabel erstellen kann
-//   }
-//   /*==========================================================*/
-//   //fuer beliebige matrizen
-//   Matrix4DWrapper( Matrix4D* matrix, const int& valIndex)
-//      : valIndex(valIndex), matrix(matrix)
-//   {
-//
-//   }
-//   /*==========================================================*/
-//   Matrix4DWrapper( Matrix4D* matrix, const int& valIndex,const int& n1, const int& nx2, const int& nx3)
-//      : valIndex(valIndex), matrix(matrix), nx1(nx1), nx2(nx2), nx3(nx3)
-//   {
-//      minX1 = minX2 = minX3 = 0;
-//      maxX1 = nx1-1;
-//      maxX2 = nx2-1;
-//      maxX3 = nx3-1;
-//   }
-//   /*==========================================================*/
-//   //wenn man z.B. matrixX1 von[0..10] geht und man nur den bereich 1..9 fuer MC
-//   //verwenden möchte -> minX1=1 und maxX2=2
-//   Matrix4DWrapper( Matrix4D* matrix, const int& valIndex, const int& minX1, const int& minX2, const int& minX3,
-//                                                           const int& maxX1, const int& maxX2, const int& maxX3)
-//       : valIndex(valIndex), matrix(matrix), minX1(minX1), minX2(minX2), minX3(minX3), maxX1(maxX1), maxX2(maxX2), maxX3(maxX3)
-//   {
-//      nx1 = matrix->getNX1()-1;
-//      nx2 = matrix->getNX2()-1;
-//      nx3 = matrix->getNX3()-1;
-//
-//      if(minX1<0 || minX2<0 || minX3<0 || maxX1>=nx1 || maxX2>=nx2 || maxX3>=nx3)
-//         throw UbException(UB_EXARGS,"range error");
-//   }
-//   /*==========================================================*/
-//   inline void setData( const real& val, const int& x1, const int& x2, const int& x3 )
-//   {
-//      (*matrix)(minX1+x1, minX2+x2, minX3+x3, valIndex) = static_cast<value_type>(val);
-//   }
-//   /*==========================================================*/
-//   inline value_type getData(const int& x1, const int& x2, const int& x3 ) const
-//   {
-//      return (*matrix)(minX1+x1, minX2+x2, minX3+x3, valIndex);
-//   }
-//   /*==========================================================*/
-//   inline void resize(const int& size_x1, const int& size_x2, const int& size_x3)
-//   {
-//      throw UbException("Matrix4DWrapper::resize(int,int,int) - mit diesem wrapper nicht erlaubt");
-//   }
-//   /*==========================================================*/
-//   inline int getMinX1() const { return minX1; }  
-//   inline int getMinX2() const { return minX2; }  
-//   inline int getMinX3() const { return minX3; }  
-//
-//   inline int getMaxX1() const { return maxX1; }  
-//   inline int getMaxX2() const { return maxX2; }  
-//   inline int getMaxX3() const { return maxX3; }  
-//
-//   inline int getNX1()   const { nx1; }  
-//   inline int getNX2()   const { nx2; }  
-//   inline int getNX3()   const { nx3; }  
-//
-//protected:
-//   int valIndex;
-//   Matrix4D* matrix;
-//   int minX1, minX2, minX3, maxX1, maxX2, maxX3, nx1, nx2, nx3;
-//};
-//
-//////////////////////////////////////////////////////////////////////////
-//Matrix3DWrapper-Wrapper
-//  CbUniformMatrix3D<double> data(10,8,5);
-//  for(int x3=0; x3<data.getNX3(); x3++)
-//   for(int x2=0; x2<data.getNX2(); x2++)
-//     for(int x1=0; x1<data.getNX1(); x1++)
-//       data(x1,x2,x3) = x1;
-//
-//  Matrix3DWrapper< CbUniformMatrix3D<double> > wrapper(&data);
-//  MarchingCubes< Matrix3DWrapper< CbUniformMatrix3D<double> > > mc( wrapper );
-//
-//  mc.init_all();
-//  mc.run(3.5);
-//  mc.writeUCD("c:/temp/triangles.inp");
-//  mc.clean_all();
-//template< typename Matrix3D >
-//class Matrix3DWrapper
-//{
-//public:
-//   typedef typename Matrix3D::value_type value_type;
-//
-//public:
-//   Matrix3DWrapper() : matrix(NULL), minX1(-1), minX2(-1), minX3(-1), maxX1(-1), maxX2(-1), maxX3(-1)
-//   {
-//      //wird benötigt, damit MarchingCubes generell eine membervariabel erstellen kann
-//   }
-//   /*==========================================================*/
-//   Matrix3DWrapper( Matrix3D* matrix)
-//      : matrix(matrix)
-//   {
-//      minX1 = minX2 = minX3 = 0;
-//      maxX1 = matrix->getNX1();
-//      maxX2 = matrix->getNX2();
-//      maxX3 = matrix->getNX3();
-//
-//      minX1 = minX2 = minX3 = 0;
-//      maxX1 = nx1-1;
-//      maxX2 = nx2-1;
-//      maxX3 = nx3-1;
-//
-//   }
-//   /*==========================================================*/
-//   Matrix3DWrapper( Matrix3D* matrix, const int& minX1, const int& minX2, const int& minX3
-//                                    , const int& maxX1, const int& maxX2, const int& maxX3 )
-//      : matrix(matrix), minX1(minX1), minX2(minX2), minX3(minX3), maxX1(maxX1), maxX2(maxX2), maxX3(maxX3)
-//   {
-//
-//   }
-//   /*==========================================================*/
-//   Matrix3DWrapper(const int& size_x1, const int& size_x2, const int& size_x3)
-//   {
-//      throw UbException("Matrix3DWrapper(int,int,int) - mit diesem wrapper nicht erlaubt");
-//   }
-//   /*==========================================================*/
-//   inline void setData( const real& val, const int& x1, const int& x2, const int& x3 )
-//   {
-//      (*matrix)(minX1+x1, minX2+x2, minX3+x3) = static_cast<value_type>(val);
-//   }
-//   /*==========================================================*/
-//   inline value_type getData(const int& x1, const int& x2, const int& x3 ) const
-//   {
-//      return (*matrix)(minX1+x1, minX2+x2, minX3+x3);
-//   }
-//   /*==========================================================*/
-//   inline void resize(const int& size_x1, const int& size_x2, const int& size_x3)
-//   {
-//      throw UbException("Matrix3DWrapper::resize(int,int,int) - mit diesem wrapper nicht erlaubt");
-//   }
-//   /*==========================================================*/
-//   inline int getMinX1() const { return minX1; }  
-//   inline int getMinX2() const { return minX2; }  
-//   inline int getMinX3() const { return minX3; }  
-//
-//   inline int getMaxX1() const { return maxX1; }  
-//   inline int getMaxX2() const { return maxX2; }  
-//   inline int getMaxX3() const { return maxX3; }  
-//
-//   inline int getNX1()   const { nx1; }  
-//   inline int getNX2()   const { nx2; }  
-//   inline int getNX3()   const { nx3; }  
-//
-//protected:
-//   Matrix3D* matrix;
-//   int minX1, minX2, minX3, maxX1, maxX2, maxX3, nx1, nx2, nx3;
-//};
-//
-//} //namespace McCubes
-//
-//#endif //MCWRAPPER_H
+// _    ___      __              __________      _     __
+//| |  / (_)____/ /___  ______ _/ / ____/ /_  __(_)___/ /____
+//| | / / / ___/ __/ / / / __ `/ / /_  / / / / / / __  / ___/
+//| |/ / / /  / /_/ /_/ / /_/ / / __/ / / /_/ / / /_/ (__  )
+//|___/_/_/   \__/\__,_/\__,_/_/_/   /_/\__,_/_/\__,_/____/
+//
+//#ifndef MCWRAPPER_H
+//#define MCWRAPPER_H
+//
+//extension by CAB
+//#include <vector>
+//#include <string>
+//#include <fstream>
+//
+//#include <basics/utilities/UbException.h>
+//#include <basics/container/CbUniformMatrix3D.h>
+//#include <basics/container/CbUniformMatrix4D.h>
+//
+//#include <3rdParty/MarchingCubes/McTypes.h>
+//
+//namespace McCubes{
+//
+//////////////////////////////////////////////////////////////////////////
+//Standard-Wrapper
+//  MarchingCubes<DataWrapper> mc( 10,8,5 );
+//  for(int z=0; z<mc.size_z(); z++)
+//   for(int y=0; y<mc.size_y(); y++)
+//     for(int x=0; x<mc.size_x(); x++)
+//       mc.set_data(x,x,y,z);
+//
+//  //mc.set_method(false) //<-MC methode, STD=false
+//  mc.init_all();
+//
+//  mc.run(3.5);
+//  mc.writeUCD("c:/temp/triangles.inp");
+//  mc.clean_all();
+
+//template< typename T=real >
+//class McDataWrapper
+//{
+//public:
+//   typedef T                                                   value_type;
+//   typedef typename std::vector< value_type >::reference       reference;
+//   typedef typename std::vector< value_type >::const_reference const_reference;
+//   typedef typename std::vector< value_type >::pointer         pointer;
+//   typedef typename std::vector< value_type >::const_pointer   const_pointer;
+//
+//public:
+//   McDataWrapper() : size_x1(-1), size_x2(-1), size_x3(-1)
+//   {
+//   }
+//   /*==========================================================*/
+//   McDataWrapper(const int& size_x1, const int& size_x2, const int& size_x3, const T& initVal=T())
+//   {
+//      this->resize(size_x1,size_x2,size_x3,initVal);
+//   }
+//   /*=======================================================================*/
+//   reference operator() (const int& x1, const int& x2, const int& x3)
+//   {
+//      #ifdef _DEBUG
+//         return this->data.at(x1 + x2*size_x1 + x3*size_x1*size_x2);
+//      #else
+//         return this->data[x1 + x2*size_x1 + x3*size_x1*size_x2];
+//      #endif
+//   }
+//   /*=======================================================================*/
+//   const_reference operator() (const int& x1, const int& x2, const int& x3)	const
+//   {
+//      #ifdef _DEBUG
+//         return this->data.at(x1 + x2*size_x1 + x3*size_x1*size_x2);
+//      #else
+//         return this->data[x1 + x2*size_x1 + x3*size_x1*size_x2];
+//      #endif
+//   }
+//   /*==========================================================*/
+//   inline void setData( const T& val, const int& x1, const int& x2, const int& x3 )
+//   {
+//      #ifdef _DEBUG
+//         this->data.at(x1 + x2*size_x1 + x3*size_x1*size_x2) = val;
+//      #else
+//         this->data[x1 + x2*size_x1 + x3*size_x1*size_x2] = val;
+//      #endif
+//   }
+//   /*==========================================================*/
+//   inline value_type getData(const int& x1, const int& x2, const int& x3 ) const
+//   {
+//      #ifdef _DEBUG
+//         return this->data.at(x1 + x2*size_x1 + x3*size_x1*size_x2);
+//      #else
+//         return this->data[x1 + x2*size_x1 + x3*size_x1*size_x2];
+//      #endif
+//   }
+//   /*==========================================================*/
+//   inline void resize(const int& size_x1, const int& size_x2, const int& size_x3)
+//   {
+//      if(size_x1>0 && size_x2>0 && size_x3>0)
+//      {
+//         this->size_x1 = size_x1;
+//         this->size_x2 = size_x2;
+//         this->size_x3 = size_x3;
+//         this->data.resize(size_x1*size_x2*size_x3);
+//      }
+//   }
+//   /*==========================================================*/
+//   inline void resize(const int& size_x1, const int& size_x2, const int& size_x3, const T& initVal)
+//   {
+//      if(size_x1>0 && size_x2>0 && size_x3>0)
+//      {
+//         this->size_x1 = size_x1;
+//         this->size_x2 = size_x2;
+//         this->size_x3 = size_x3;
+//         this->data.resize(size_x1*size_x2*size_x3,initVal);
+//      }
+//   }
+//   /*==========================================================*/
+//   int getNX1() const { return size_x1; }
+//   int getNX2() const { return size_x2; }
+//   int getNX3() const { return size_x3; }
+//
+//protected:
+//   std::vector<T> data;
+//   int size_x1, size_x2, size_x3;
+//};
+//
+//////////////////////////////////////////////////////////////////////////
+//Matrix4DWrapper-Wrapper
+//example:
+//  int indexForDataValue = 1;
+//  CbUniformMatrix4D<double> data(10,8,5,2);
+//  for(int x3=0; x3<data.getNX3(); x3++)
+//   for(int x2=0; x2<data.getNX2(); x2++)
+//     for(int x1=0; x1<data.getNX1(); x1++)
+//       data(x1,x2,x3,indexForDataValue) = x1;
+//
+//  Matrix4DWrapper< CbUniformMatrix4D<double> > wrapper(&data,indexForDataValue);
+//  MarchingCubes< Matrix4DWrapper< CbUniformMatrix4D<double> > > mc( wrapper );
+//
+//  mc.init_all();
+//  mc.run(3.5);
+//  mc.writeUCD("c:/temp/triangles.inp");
+//  mc.clean_all();
+//template< typename Matrix4D >
+//class Matrix4DWrapper
+//{
+//public:
+//   typedef typename Matrix4D::value_type value_type;
+//
+//public:
+//   Matrix4DWrapper() : valIndex(-1), matrix(NULL), minX1(-1), minX2(-1), minX3(-1), maxX1(-1), maxX2(-1), maxX3(-1)
+//   {
+//      //wird benötigt, damit MarchingCubes generell eine membervariabel erstellen kann
+//   }
+//   /*==========================================================*/
+//   //fuer beliebige matrizen
+//   Matrix4DWrapper( Matrix4D* matrix, const int& valIndex)
+//      : valIndex(valIndex), matrix(matrix)
+//   {
+//
+//   }
+//   /*==========================================================*/
+//   Matrix4DWrapper( Matrix4D* matrix, const int& valIndex,const int& n1, const int& nx2, const int& nx3)
+//      : valIndex(valIndex), matrix(matrix), nx1(nx1), nx2(nx2), nx3(nx3)
+//   {
+//      minX1 = minX2 = minX3 = 0;
+//      maxX1 = nx1-1;
+//      maxX2 = nx2-1;
+//      maxX3 = nx3-1;
+//   }
+//   /*==========================================================*/
+//   //wenn man z.B. matrixX1 von[0..10] geht und man nur den bereich 1..9 fuer MC
+//   //verwenden möchte -> minX1=1 und maxX2=2
+//   Matrix4DWrapper( Matrix4D* matrix, const int& valIndex, const int& minX1, const int& minX2, const int& minX3,
+//                                                           const int& maxX1, const int& maxX2, const int& maxX3)
+//       : valIndex(valIndex), matrix(matrix), minX1(minX1), minX2(minX2), minX3(minX3), maxX1(maxX1), maxX2(maxX2), maxX3(maxX3)
+//   {
+//      nx1 = matrix->getNX1()-1;
+//      nx2 = matrix->getNX2()-1;
+//      nx3 = matrix->getNX3()-1;
+//
+//      if(minX1<0 || minX2<0 || minX3<0 || maxX1>=nx1 || maxX2>=nx2 || maxX3>=nx3)
+//         throw UbException(UB_EXARGS,"range error");
+//   }
+//   /*==========================================================*/
+//   inline void setData( const real& val, const int& x1, const int& x2, const int& x3 )
+//   {
+//      (*matrix)(minX1+x1, minX2+x2, minX3+x3, valIndex) = static_cast<value_type>(val);
+//   }
+//   /*==========================================================*/
+//   inline value_type getData(const int& x1, const int& x2, const int& x3 ) const
+//   {
+//      return (*matrix)(minX1+x1, minX2+x2, minX3+x3, valIndex);
+//   }
+//   /*==========================================================*/
+//   inline void resize(const int& size_x1, const int& size_x2, const int& size_x3)
+//   {
+//      throw UbException("Matrix4DWrapper::resize(int,int,int) - mit diesem wrapper nicht erlaubt");
+//   }
+//   /*==========================================================*/
+//   inline int getMinX1() const { return minX1; }  
+//   inline int getMinX2() const { return minX2; }  
+//   inline int getMinX3() const { return minX3; }  
+//
+//   inline int getMaxX1() const { return maxX1; }  
+//   inline int getMaxX2() const { return maxX2; }  
+//   inline int getMaxX3() const { return maxX3; }  
+//
+//   inline int getNX1()   const { nx1; }  
+//   inline int getNX2()   const { nx2; }  
+//   inline int getNX3()   const { nx3; }  
+//
+//protected:
+//   int valIndex;
+//   Matrix4D* matrix;
+//   int minX1, minX2, minX3, maxX1, maxX2, maxX3, nx1, nx2, nx3;
+//};
+//
+//////////////////////////////////////////////////////////////////////////
+//Matrix3DWrapper-Wrapper
+//  CbUniformMatrix3D<double> data(10,8,5);
+//  for(int x3=0; x3<data.getNX3(); x3++)
+//   for(int x2=0; x2<data.getNX2(); x2++)
+//     for(int x1=0; x1<data.getNX1(); x1++)
+//       data(x1,x2,x3) = x1;
+//
+//  Matrix3DWrapper< CbUniformMatrix3D<double> > wrapper(&data);
+//  MarchingCubes< Matrix3DWrapper< CbUniformMatrix3D<double> > > mc( wrapper );
+//
+//  mc.init_all();
+//  mc.run(3.5);
+//  mc.writeUCD("c:/temp/triangles.inp");
+//  mc.clean_all();
+//template< typename Matrix3D >
+//class Matrix3DWrapper
+//{
+//public:
+//   typedef typename Matrix3D::value_type value_type;
+//
+//public:
+//   Matrix3DWrapper() : matrix(NULL), minX1(-1), minX2(-1), minX3(-1), maxX1(-1), maxX2(-1), maxX3(-1)
+//   {
+//      //wird benötigt, damit MarchingCubes generell eine membervariabel erstellen kann
+//   }
+//   /*==========================================================*/
+//   Matrix3DWrapper( Matrix3D* matrix)
+//      : matrix(matrix)
+//   {
+//      minX1 = minX2 = minX3 = 0;
+//      maxX1 = matrix->getNX1();
+//      maxX2 = matrix->getNX2();
+//      maxX3 = matrix->getNX3();
+//
+//      minX1 = minX2 = minX3 = 0;
+//      maxX1 = nx1-1;
+//      maxX2 = nx2-1;
+//      maxX3 = nx3-1;
+//
+//   }
+//   /*==========================================================*/
+//   Matrix3DWrapper( Matrix3D* matrix, const int& minX1, const int& minX2, const int& minX3
+//                                    , const int& maxX1, const int& maxX2, const int& maxX3 )
+//      : matrix(matrix), minX1(minX1), minX2(minX2), minX3(minX3), maxX1(maxX1), maxX2(maxX2), maxX3(maxX3)
+//   {
+//
+//   }
+//   /*==========================================================*/
+//   Matrix3DWrapper(const int& size_x1, const int& size_x2, const int& size_x3)
+//   {
+//      throw UbException("Matrix3DWrapper(int,int,int) - mit diesem wrapper nicht erlaubt");
+//   }
+//   /*==========================================================*/
+//   inline void setData( const real& val, const int& x1, const int& x2, const int& x3 )
+//   {
+//      (*matrix)(minX1+x1, minX2+x2, minX3+x3) = static_cast<value_type>(val);
+//   }
+//   /*==========================================================*/
+//   inline value_type getData(const int& x1, const int& x2, const int& x3 ) const
+//   {
+//      return (*matrix)(minX1+x1, minX2+x2, minX3+x3);
+//   }
+//   /*==========================================================*/
+//   inline void resize(const int& size_x1, const int& size_x2, const int& size_x3)
+//   {
+//      throw UbException("Matrix3DWrapper::resize(int,int,int) - mit diesem wrapper nicht erlaubt");
+//   }
+//   /*==========================================================*/
+//   inline int getMinX1() const { return minX1; }  
+//   inline int getMinX2() const { return minX2; }  
+//   inline int getMinX3() const { return minX3; }  
+//
+//   inline int getMaxX1() const { return maxX1; }  
+//   inline int getMaxX2() const { return maxX2; }  
+//   inline int getMaxX3() const { return maxX3; }  
+//
+//   inline int getNX1()   const { nx1; }  
+//   inline int getNX2()   const { nx2; }  
+//   inline int getNX3()   const { nx3; }  
+//
+//protected:
+//   Matrix3D* matrix;
+//   int minX1, minX2, minX3, maxX1, maxX2, maxX3, nx1, nx2, nx3;
+//};
+//
+//} //namespace McCubes
+//
+//#endif //MCWRAPPER_H
diff --git a/3rdParty/WebDemo/LBMDemoCopy.htm b/3rdParty/WebDemo/LBMDemoCopy.htm
index b80dddf5889f8b39431e72a9b0fc66e4ec88ccf9..c0a2834eaf2ad463f301bd3593972337219fb813 100644
--- a/3rdParty/WebDemo/LBMDemoCopy.htm
+++ b/3rdParty/WebDemo/LBMDemoCopy.htm
@@ -1,1364 +1,1364 @@
-
-<!DOCTYPE HTML>
-<!--
-	A lattice-Boltzmann fluid simulation in JavaScript, using HTML5 canvas for graphics
-	
-	Copyright 2013, Daniel V. Schroeder
-
-	Permission is hereby granted, free of charge, to any person obtaining a copy of 
-	this software and associated data and documentation (the "Software"), to deal in 
-	the Software without restriction, including without limitation the rights to 
-	use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 
-	of the Software, and to permit persons to whom the Software is furnished to do 
-	so, subject to the following conditions:
-
-	The above copyright notice and this permission notice shall be included in all 
-	copies or substantial portions of the Software.
-
-	THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 
-	INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 
-	PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 
-	ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 
-	OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 
-	OTHER DEALINGS IN THE SOFTWARE.
-
-	Except as contained in this notice, the name of the author shall not be used in 
-	advertising or otherwise to promote the sale, use or other dealings in this 
-	Software without prior written authorization.
-
-	Credits:
-	The "wind tunnel" entry/exit conditions are inspired by Graham Pullan's code
-	(http://www.many-core.group.cam.ac.uk/projects/LBdemo.shtml).  Additional inspiration from 
-	Thomas Pohl's applet (http://thomas-pohl.info/work/lba.html).  Other portions of code are based 
-	on Wagner (http://www.ndsu.edu/physics/people/faculty/wagner/lattice_boltzmann_codes/) and
-	Gonsalves (http://www.physics.buffalo.edu/phy411-506-2004/index.html; code adapted from Succi,
-	http://global.oup.com/academic/product/the-lattice-boltzmann-equation-9780199679249).
-
-	Revision history:
-	First version, with only start/stop, speed, and viscosity controls, February 2013
-	Added resolution control, mouse interaction, plot options, etc., March 2013
-	Added sensor, contrast slider, improved tracer placement, Fy period readout, May 2013
-	Added option to animate using setTimeout instead of requestAnimationFrame, July 2013
-	Added "Flowline" plotting (actually just line segments), August 2013
-	
-	Still to do:
-	* Fix the apparent bug in the force calculation that gives inconsistent results depending
-		on initial conditions.  Perhaps bounce-backs between adjacent barrier sites don't cancel?
-	* Grabbing the sensor while "drag fluid" selected causes a momentary drag at previous mouse location.
-	* Try to pass two-fingered touch events on to the browser, so it's still possible to zoom in and out.
-	* Work on GUI control layout, especially for smaller screens.
-	* Treat ends symmetrically when flow speed is zero.
-	* Try some other visualization techniques.
--->
-<html>
-
-<head>
-<title>Fluid Dynamics Simulation</title>
-<meta charset="utf-8">
-<meta name="viewport" content="width=620">
-<style>
-	body {background-color:#ffffff; font-family:Arial, sans-serif; font-size:14px;
-					text-align:center;}						/* gray background, center everything */
-	p {margin-left:auto; margin-right:auto; width:600px;}	/* keep paragraphs narrow and centered */
-	input {font-size:115%;}									/* make buttons bigger */
-	input[type="range"] {width:90px;}						/* make sliders shorter */
-	select {font-size:115%;}								/* make selectors bigger too */
-	li {text-align:left;}
-</style>
-</head>
-
-<body>
-
-<h2>Fluid Dynamics Simulation</h2>
-
-<p>By <a href="http://physics.weber.edu/schroeder/">Dan Schroeder</a>, 
-<a href="http://physics.weber.edu">Physics Department</a>, 
-<a href="http://weber.edu">Weber State University</a></p>
-
-<canvas id="theCanvas" width="600" height="240">This application runs only in modern
-browsers. For best results, use Google Chrome.</canvas>
-
-<div>
-	<select id="sizeSelect" onchange="resize()">
-		<option value="10">60 x 24</option>
-		<option value="8">75 x 30</option>
-		<option value="6">100 x 40</option>
-		<option value="5">120 x 48</option>
-		<option value="4">150 x 60</option>
-		<option value="3">200 x 80</option>
-		<option value="2">300 x 120</option>
-		<option value="1">600 x 240</option>
-	</select>
-	<input id="resetFluidButton" type="button" onclick="initFluid()" value="Reset fluid">
-	<input id="stepButton" type="button" onclick="simulate()" value="Step">
-	<input id="startButton" type="button" onclick="startStop()" value="Start">
-</div>
-<div>
-	Flow speed = <span id="speedValue">0.100</span> 
-	<input id="speedSlider" type="range" min="0" max="0.12" step="0.005" value="0.1" onchange="adjustSpeed()">
-	&nbsp;&nbsp;Viscosity = <span id="viscValue">0.020</span>
-	<input id="viscSlider" type="range" min="0.000000001" max="0.02" step="0.000005" value="0.02" onchange="adjustViscosity()">
-</div>
-<div style="margin-top:3px">
-	<select id="mouseSelect">
-		<option value="draw">Draw barriers</option>
-		<option value="erase">Erase barriers</option>
-		<option value="push">Drag fluid</option>
-	</select>
-	<select id="barrierSelect" onchange="placePresetBarrier()">
-		<option>Barrier shapes</option>
-	</select>
-	<input id="clearButton" type="button" onclick="clearBarriers()" value="Clear barriers">
-</div>
-<div>
-	<select id="plotSelect" onchange="paintCanvas()">
-		<option>Plot density</option>
-		<option>Plot x velocity</option>
-		<option>Plot y velocity</option>
-		<option>Plot speed</option>
-		<option selected>Plot curl</option>
-	</select>
-	&nbsp;&nbsp;Contrast:
-	<input id="contrastSlider" type="range" min="-10" max="10" step="1" value="0" onchange="paintCanvas()">
-</div>
-<div>
-	Animation speed:
-	<input id="stepsSlider" type="range" min="1" max="40" step="1" value="20" onchange="resetTimer()">
-	&nbsp;&nbsp;Steps per second: <span id="speedReadout">0</span>
-	&nbsp;&nbsp;<input id="rafCheck" type="checkbox" checked onchange="resetTimer()">Faster?
-</div>
-<div style="margin-top:4px">
-	<!--<input id="pixelCheck" type="checkbox" checked onchange="resetTimer()">Use pixel graphics-->
-	Show:
-	<input id="tracerCheck" type="checkbox" onchange="initTracers()">Tracers
-	<input id="flowlineCheck" type="checkbox" onchange="paintCanvas()">Flowlines
-	<input id="forceCheck" type="checkbox" onchange="paintCanvas()">Force on barriers
-	<input id="sensorCheck" type="checkbox" onchange="paintCanvas()">Sensor
-	<input id="dataCheck" type="checkbox" onchange="showData()">Data
-</div>
-<div id="dataSection" style="display:none">
-	<textarea id="dataArea" rows="8" cols="50" disabled readonly></textarea>
-	<div>
-		<input id="dataButton" type="button" value="Start data collection" onclick="startOrStopData()">
-		<input id="periodButton" type="button" value="Show F_y period" onclick="showPeriod()">
-		<input id="barrierDataButton" type="button" value="Show barrier locations" onclick="showBarrierLocations()">
-		<input id="debugButton" type="button" value="Debug" onclick="debug()" style="display:none">
-	</div>
-</div>
-<p style="text-align:left">This is a simulation of a two-dimensional fluid. Initially the fluid
-is flowing from left to right, and a linear barrier (shown in black) diverts the fluid and creates 
-vortices. The colors indicate the curl, or local rotational motion, of the fluid.  
-Use the controls to adjust the flow speed and viscosity, draw different barriers, drag the
-fluid around, plot other quantities besides the curl, show the force exerted by the fluid
-on the barriers, and measure the fluid's density and velocity at any point. Enjoy!</p>
-
-<p style="text-align:left">The simulation uses a fairly simple
-<a href="http://en.wikipedia.org/wiki/Lattice_Boltzmann_methods">lattice-Boltzmann algorithm</a>, 
-which you can see by viewing the JavaScript source code. As of mid-2013, the simulation
-runs fastest under Chrome on either MacOS or Windows.  Firefox is somewhat slower and Safari slower still,
-while Opera and Internet Explorer are much slower. You can adjust the resolution to increase or
-decrease the simulation speed.</p>
-
-<p style="text-align:left">If you don't see the slider controls above, try updating your browser.
-As of August 2013, the most recent versions of all major browsers should show the sliders.</p>
-
-<p style="text-align:left">This HTML5-canvas-JavaScript web app is a work in progress. It still
-has a few bugs and awkward features, which I hope to address some day.</p>
-
-<p style="text-align:left">
-	Related materials:
-</p>
-<div style="margin-left:auto; margin-right:auto; width:600px;">
-	<ul>
-	<li><a href="LatticeBoltzmannDemo.java.txt">A similar simulation in Java</a></li>
-	<li><a href="LatticeBoltzmannDemo.py.txt">A similar simulation in Python</a></li>
-	<li><a href="FluidSimulationsForUndergrads.pdf">Poster presentation</a> 
-	given at the AAPT summer meeting, 2013 (pdf, 2.6 MB)</li>
-	<li><a href="http://physics.weber.edu/schroeder/javacourse/LatticeBoltzmann.pdf">Instructions</a> 
-	for a lattice-Boltzmann project in a computational physics course</li>
-	<li>A more detailed explanation of the lattice-Boltzmann algorithm (coming soon)</li>
-	</ul>
-</div>
-
-<script src="barrierdata.js"></script>
-<script>
-	// Global variables:	
-	var mobile = navigator.userAgent.match(/iPhone|iPad|iPod|Android|BlackBerry|Opera Mini|IEMobile/i)
-	var canvas = document.getElementById('theCanvas');
-	var context = canvas.getContext('2d');
-	var image = context.createImageData(canvas.width, canvas.height);		// for direct pixel manipulation (faster than fillRect)
-	for (var i=3; i<image.data.length; i+=4) image.data[i] = 255;			// set all alpha values to opaque
-	var sizeSelect = document.getElementById('sizeSelect');
-	sizeSelect.selectedIndex = 5;
-	if (mobile) sizeSelect.selectedIndex = 1;		// smaller works better on mobile platforms
-	var pxPerSquare = Number(sizeSelect.options[sizeSelect.selectedIndex].value);
-													// width of plotted grid site in pixels
-	var xdim = canvas.width / pxPerSquare;			// grid dimensions for simulation
-	var ydim = canvas.height / pxPerSquare;
-	var stepsSlider = document.getElementById('stepsSlider');
-	var startButton = document.getElementById('startButton');
-	var speedSlider = document.getElementById('speedSlider');
-	var speedValue = document.getElementById('speedValue');
-	var viscSlider = document.getElementById('viscSlider');
-	var viscValue = document.getElementById('viscValue');
-	var mouseSelect = document.getElementById('mouseSelect');
-	var barrierSelect = document.getElementById('barrierSelect');
-	for (var barrierIndex=0; barrierIndex<barrierList.length; barrierIndex++) {
-		var shape = document.createElement("option");
-		shape.text = barrierList[barrierIndex].name;
-		barrierSelect.add(shape, null);
-	}
-	var plotSelect = document.getElementById('plotSelect');
-	var contrastSlider = document.getElementById('contrastSlider');
-	//var pixelCheck = document.getElementById('pixelCheck');
-	var tracerCheck = document.getElementById('tracerCheck');
-	var flowlineCheck = document.getElementById('flowlineCheck');
-	var forceCheck = document.getElementById('forceCheck');
-	var sensorCheck = document.getElementById('sensorCheck');
-	var dataCheck = document.getElementById('dataCheck');
-	var rafCheck = document.getElementById('rafCheck');
-	var speedReadout = document.getElementById('speedReadout');
-	var dataSection = document.getElementById('dataSection');
-	var dataArea = document.getElementById('dataArea');
-	var dataButton = document.getElementById('dataButton');
-	var running = false;						// will be true when running
-	var stepCount = 0;
-	var startTime = 0;
-	var four9ths = 4.0 / 9.0;					// abbreviations
-	var one9th = 1.0 / 9.0;
-	var one36th = 1.0 / 36.0;
-	var barrierCount = 0;
-	var barrierxSum = 0;
-	var barrierySum = 0;
-	var barrierFx = 0.0;						// total force on all barrier sites
-	var barrierFy = 0.0;
-	var sensorX = xdim / 2;						// coordinates of "sensor" to measure local fluid properties	
-	var sensorY = ydim / 2;
-	var draggingSensor = false;
-	var mouseIsDown = false;
-	var mouseX, mouseY;							// mouse location in canvas coordinates
-	var oldMouseX = -1, oldMouseY = -1;			// mouse coordinates from previous simulation frame
-	var collectingData = false;
-	var time = 0;								// time (in simulation step units) since data collection started
-	var showingPeriod = false;
-	var lastBarrierFy = 1;						// for determining when F_y oscillation begins
-	var lastFyOscTime = 0;						// for calculating F_y oscillation period
-
-	canvas.addEventListener('mousedown', mouseDown, false);
-	canvas.addEventListener('mousemove', mouseMove, false);
-	document.body.addEventListener('mouseup', mouseUp, false);	// button release could occur outside canvas
-	canvas.addEventListener('touchstart', mouseDown, false);
-	canvas.addEventListener('touchmove', mouseMove, false);
-	document.body.addEventListener('touchend', mouseUp, false);
-
-	// Create the arrays of fluid particle densities, etc. (using 1D arrays for speed):
-	// To index into these arrays, use x + y*xdim, traversing rows first and then columns.
-	var n0 = new Array(xdim*ydim);			// microscopic densities along each lattice direction
-	var nN = new Array(xdim*ydim);
-	var nS = new Array(xdim*ydim);
-	var nE = new Array(xdim*ydim);
-	var nW = new Array(xdim*ydim);
-	var nNE = new Array(xdim*ydim);
-	var nSE = new Array(xdim*ydim);
-	var nNW = new Array(xdim*ydim);
-	var nSW = new Array(xdim*ydim);
-	var rho = new Array(xdim*ydim);			// macroscopic density
-	var ux = new Array(xdim*ydim);			// macroscopic velocity
-	var uy = new Array(xdim*ydim);
-	var curl = new Array(xdim*ydim);
-	var barrier = new Array(xdim * ydim); 	// boolean array of barrier locations
-	var odd = 1;
-
-	// Initialize to a steady rightward flow with no barriers:
-	for (var y=0; y<ydim; y++) {
-		for (var x=0; x<xdim; x++) {
-			barrier[x+y*xdim] = false;
-		}
-	}
-
-	// Create a simple linear "wall" barrier (intentionally a little offset from center):
-	var barrierSize = 8;
-	if (mobile) barrierSize = 4;
-	for (var y=(ydim/2)-barrierSize; y<=(ydim/2)+barrierSize; y++) {
-		var x = Math.round(ydim/3);
-		barrier[x+y*xdim] = true;
-	}
-
-	// Set up the array of colors for plotting (mimicks matplotlib "jet" colormap):
-	// (Kludge: Index nColors+1 labels the color used for drawing barriers.)
-	var nColors = 400;							// there are actually nColors+2 colors
-	var hexColorList = new Array(nColors+2);
-	var redList = new Array(nColors+2);
-	var greenList = new Array(nColors+2);
-	var blueList = new Array(nColors+2);
-	for (var c=0; c<=nColors; c++) {
-		var r, g, b;
-		if (c < nColors/8) {
-			r = 0; g = 0; b = Math.round(255 * (c + nColors/8) / (nColors/4));
-		} else if (c < 3*nColors/8) {
-			r = 0; g = Math.round(255 * (c - nColors/8) / (nColors/4)); b = 255;
-		} else if (c < 5*nColors/8) {
-			r = Math.round(255 * (c - 3*nColors/8) / (nColors/4)); g = 255; b = 255 - r;
-		} else if (c < 7*nColors/8) {
-			r = 255; g = Math.round(255 * (7*nColors/8 - c) / (nColors/4)); b = 0;
-		} else {
-			r = Math.round(255 * (9*nColors/8 - c) / (nColors/4)); g = 0; b = 0;
-		}
-		redList[c] = r; greenList[c] = g; blueList[c] = b;
-		hexColorList[c] = rgbToHex(r, g, b);
-	}
-	redList[nColors+1] = 0; greenList[nColors+1] = 0; blueList[nColors+1] = 0;	// barriers are black
-	hexColorList[nColors+1] = rgbToHex(0, 0, 0);
-
-	// Functions to convert rgb to hex color string (from stackoverflow):
-	function componentToHex(c) {
-		var hex = c.toString(16);
-		return hex.length == 1 ? "0" + hex : hex;
-	}
-	function rgbToHex(r, g, b) {
-		return "#" + componentToHex(r) + componentToHex(g) + componentToHex(b);
-	}
-
-	// Initialize array of partially transparant blacks, for drawing flow lines:
-	var transBlackArraySize = 50;
-	var transBlackArray = new Array(transBlackArraySize);
-	for (var i=0; i<transBlackArraySize; i++) {
-		transBlackArray[i] = "rgba(0,0,0," + Number(i/transBlackArraySize).toFixed(2) + ")";
-	}
-
-	// Initialize tracers (but don't place them yet):
-	var nTracers = 144;
-	var tracerX = new Array(nTracers);
-	var tracerY = new Array(nTracers);
-	for (var t=0; t<nTracers; t++) {
-		tracerX[t] = 0.0; tracerY[t] = 0.0;
-	}
-
-	initFluid();		// initialize to steady rightward flow
-
-	// Mysterious gymnastics that are apparently useful for better cross-browser animation timing:
-	window.requestAnimFrame = (function(callback) {
-		return 	window.requestAnimationFrame || 
-			window.webkitRequestAnimationFrame || 
-			window.mozRequestAnimationFrame || 
-			window.oRequestAnimationFrame || 
-			window.msRequestAnimationFrame ||
-			function(callback) {
-				window.setTimeout(callback, 1);		// second parameter is time in ms
-			};
-	})();
-
-	// Simulate function executes a bunch of steps and then schedules another call to itself:
-	function simulate() {
-		var stepsPerFrame = Number(stepsSlider.value);			// number of simulation steps per animation frame
-		setBoundaries();
-		// Test to see if we're dragging the fluid:
-		var pushing = false;
-		var pushX, pushY, pushUX, pushUY;
-		if (mouseIsDown && mouseSelect.selectedIndex==2) {
-			if (oldMouseX >= 0) {
-				var gridLoc = canvasToGrid(mouseX, mouseY);
-				pushX = gridLoc.x;
-				pushY = gridLoc.y;
-				pushUX = (mouseX - oldMouseX) / pxPerSquare / stepsPerFrame;
-				pushUY = -(mouseY - oldMouseY) / pxPerSquare / stepsPerFrame;	// y axis is flipped
-				if (Math.abs(pushUX) > 0.1) pushUX = 0.1 * Math.abs(pushUX) / pushUX;
-				if (Math.abs(pushUY) > 0.1) pushUY = 0.1 * Math.abs(pushUY) / pushUY;
-				pushing = true;
-			}
-			oldMouseX = mouseX; oldMouseY = mouseY;
-		} else {
-			oldMouseX = -1; oldMouseY = -1;
-		}
-		// Execute a bunch of time steps:
-		for (var step = 0; step < stepsPerFrame; step++) {
-		    setBoundaries();
-			collide();
-			//stream();
-			if (odd == 1) { odd = 0; }
-			else { odd = 1; }
-			if (tracerCheck.checked) moveTracers();
-			if (pushing) push(pushX, pushY, pushUX, pushUY);
-			time++;
-			if (showingPeriod && (barrierFy > 0) && (lastBarrierFy <=0)) {
-				var thisFyOscTime = time - barrierFy/(barrierFy-lastBarrierFy);	// interpolate when Fy changed sign
-				if (lastFyOscTime > 0) {
-					var period = thisFyOscTime - lastFyOscTime;
-					dataArea.innerHTML += Number(period).toFixed(2) + "\n";
-					dataArea.scrollTop = dataArea.scrollHeight;
-				}
-				lastFyOscTime = thisFyOscTime;
-			}
-			lastBarrierFy = barrierFy;
-		}
-		paintCanvas();
-		if (collectingData) {
-			writeData();
-			if (time >= 10000) startOrStopData();
-		}
-		if (running) {
-			stepCount += stepsPerFrame;
-			var elapsedTime = ((new Date()).getTime() - startTime) / 1000;	// time in seconds
-			speedReadout.innerHTML = Number(stepCount/elapsedTime).toFixed(0);
-		}
-		var stable = true;
-		for (var x=0; x<xdim; x++) {
-			var index = x + (ydim/2)*xdim;	// look at middle row only
-			if (rho[index] <= 0) stable = false;
-		}
-		if (!stable) {
-			window.alert("The simulation has become unstable due to excessive fluid speeds.");
-			startStop();
-			initFluid();
-		}
-		if (running) {
-			if (rafCheck.checked) {
-				requestAnimFrame(function() { simulate(); });	// let browser schedule next frame
-			} else {
-				window.setTimeout(simulate, 1);	// schedule next frame asap (nominally 1 ms but always more)
-			}
-		}
-	}
-
-	// Set the fluid variables at the boundaries, according to the current slider value:
-	function setBoundaries() {
-		var u0 = Number(speedSlider.value);
-		for (var x=0; x<xdim; x++) {
-			setEquil(x, 0, u0, 0, 1);
-			setEquil(x, ydim-1, u0, 0, 1);
-		}
-		for (var y=1; y<ydim-1; y++) {
-			setEquil(0, y, u0, 0, 1);
-			setEquil(xdim-1, y, u0, 0, 1);
-		}
-	}
-
-	// Collide particles within each cell (here's the physics!):
-	function collideOLD() {
-		var viscosity = Number(viscSlider.value);	// kinematic viscosity coefficient in natural units
-		var omega = 1 / (3*viscosity + 0.5);		// reciprocal of relaxation time
-		for (var y=1; y<ydim-1; y++) {
-			for (var x=1; x<xdim-1; x++) {
-				var i = x + y*xdim;		// array index for this lattice site
-				var thisrho = n0[i] + nN[i] + nS[i] + nE[i] + nW[i] + nNW[i] + nNE[i] + nSW[i] + nSE[i];
-				rho[i] = thisrho;
-				var thisux = (nE[i] + nNE[i] + nSE[i] - nW[i] - nNW[i] - nSW[i]) / thisrho;
-				ux[i] = thisux;
-				var thisuy = (nN[i] + nNE[i] + nNW[i] - nS[i] - nSE[i] - nSW[i]) / thisrho;
-				uy[i] = thisuy
-				var one9thrho = one9th * thisrho;		// pre-compute a bunch of stuff for optimization
-				var one36thrho = one36th * thisrho;
-				var ux3 = 3 * thisux;
-				var uy3 = 3 * thisuy;
-				var ux2 = thisux * thisux;
-				var uy2 = thisuy * thisuy;
-				var uxuy2 = 2 * thisux * thisuy;
-				var u2 = ux2 + uy2;
-				var u215 = 1.5 * u2;
-				n0[i]  += omega * (four9ths*thisrho * (1                        - u215) - n0[i]);
-				nE[i]  += omega * (   one9thrho * (1 + ux3       + 4.5*ux2        - u215) - nE[i]);
-				nW[i]  += omega * (   one9thrho * (1 - ux3       + 4.5*ux2        - u215) - nW[i]);
-				nN[i]  += omega * (   one9thrho * (1 + uy3       + 4.5*uy2        - u215) - nN[i]);
-				nS[i]  += omega * (   one9thrho * (1 - uy3       + 4.5*uy2        - u215) - nS[i]);
-				nNE[i] += omega * (  one36thrho * (1 + ux3 + uy3 + 4.5*(u2+uxuy2) - u215) - nNE[i]);
-				nSE[i] += omega * (  one36thrho * (1 + ux3 - uy3 + 4.5*(u2-uxuy2) - u215) - nSE[i]);
-				nNW[i] += omega * (  one36thrho * (1 - ux3 + uy3 + 4.5*(u2-uxuy2) - u215) - nNW[i]);
-				nSW[i] += omega * (  one36thrho * (1 - ux3 - uy3 + 4.5*(u2+uxuy2) - u215) - nSW[i]);
-			}
-		}
-		for (var y=1; y<ydim-2; y++) {
-			nW[xdim-1+y*xdim] = nW[xdim-2+y*xdim];		// at right end, copy left-flowing densities from next row to the left
-			nNW[xdim-1+y*xdim] = nNW[xdim-2+y*xdim];
-			nSW[xdim-1+y*xdim] = nSW[xdim-2+y*xdim];
-		}
-	}
-
-	///----------------------------Cumulants
-	function collide() {
-	    var viscosity = Number(viscSlider.value); // kinematic viscosity coefficient in natural units
-	    var omega = 1 / (3 * viscosity + 0.5); 	// reciprocal of relaxation time
-	    //var om3 = 9.0 * (8.0 - 6.0 * omega + omega * omega) / (36.0 - 18 * omega + 2 * omega * omega); //
-	    var om3 = 3.0 * (omega - 2.0) / (omega - 3.0);
-	    for (var y = 1; y < ydim - 1; y++) {
-	        for (var x = 1; x < xdim - 1; x++) {
-	            if (x > xdim - 5) { omega = 1; }
-	            //if (true)
-	          //  {//(!barrier[x+y*xdim]){
-	            else { omega = 1 / (3 * viscosity + 0.5); }
-	            if (!barrier[x+y*xdim]){
-	            var i = x + y * xdim; 	// array index for this lattice site
-	            var ix=(x+1)+ y*xdim;
-	            var iy=x+(y+1)*xdim;
-	            var ixy=(x+1)+(y+1)*xdim;
-var maa; 
-var mab; 
-var mac; 
-var mba; 
-var mbb; 
-var mbc; 
-var mca; 
-var mcb; 
-var mcc; 
-	            
-	            if(odd==1){
-	             maa = nSW[ixy];
-	             mab = nW[ix];
-	             mac = nNW[ix];
-	             mba = nS[iy];
-	             mbb = n0[i];
-	             mbc = nN[i];
-	             mca = nSE[iy];
-	             mcb = nE[i];
-	             mcc = nNE[i];
-	            }
-	            else
-	            {
-	             maa = nNE[ixy];
-	             mab = nE[ix];
-	             mac = nSE[ix];
-	             mba = nN[iy];
-	             mbb = n0[i];
-	             mbc = nS[i];
-	             mca = nNW[iy];
-	             mcb = nW[i];
-	             mcc = nSW[i];
-                }
-	            
-	            var thisrho = maa + mab + mac + mba + mbb + mbc + mca + mcb + mcc;
-	            rho[i] = thisrho;
-	            var thisux = (mca+mcb+mcc-maa-mab-mac) / thisrho;
-	            ux[i] = thisux;
-	            var thisuy = (mac+mbc+mcc-maa-mba-mca) / thisrho;
-	            uy[i] = thisuy;
-
-
-	            
-	            var n1=maa+mab+mac;
-                var n2=(-1-thisuy)*maa-thisuy*mab+(1-thisuy)*mac;
-                     mac=(-1-thisuy)*(-1-thisuy)*maa+thisuy*thisuy*mab+(1-thisuy)*(1-thisuy)*mac;
-                     maa=n1;
-                     mab=n2;
-
-
-                     n1=mba+mbb+mbc;
-                     n2=(-1-thisuy)*mba-thisuy*mbb+(1-thisuy)*mbc;
-                     mbc=(-1-thisuy)*(-1-thisuy)*mba+thisuy*thisuy*mbb+(1-thisuy)*(1-thisuy)*mbc;
-                     mba=n1;
-                     mbb=n2;
-
-
-                     n1=mca+mcb+mcc;
-                     n2=(-1-thisuy)*mca-thisuy*mcb+(1-thisuy)*mcc;
-                     mcc=(-1-thisuy)*(-1-thisuy)*mca+thisuy*thisuy*mcb+(1-thisuy)*(1-thisuy)*mcc;
-                     mca=n1;
-                     mcb=n2;
-///// y
-                     n1=maa+mba+mca;
-                     n2=(-1-thisux)*maa-thisux*mba+(1-thisux)*mca;
-                     mca=(-1-thisux)*(-1-thisux)*maa+thisux*thisux*mba+(1-thisux)*(1-thisux)*mca;
-                     maa=n1;
-                     mba=n2;
-
-                     n1=mab+mbb+mcb;
-                     n2=(-1-thisux)*mab-thisux*mbb+(1-thisux)*mcb;
-                     mcb=(-1-thisux)*(-1-thisux)*mab+thisux*thisux*mbb+(1-thisux)*(1-thisux)*mcb;
-                     mab=n1;
-                     mbb=n2;
-
-                     n1=mac+mbc+mcc;
-                     n2=(-1-thisux)*mac-thisux*mbc+(1-thisux)*mcc;
-                     mcc=(-1-thisux)*(-1-thisux)*mac+thisux*thisux*mbc+(1-thisux)*(1-thisux)*mcc;
-                     mac=n1;
-                     mbc=n2;
-	            //
-
-	            //----fast transform
-	            
-//	            var n1 = mcc + maa - mac - mca - thisux * thisuy / thisrho;
-//	            var n2;
-//	            //var pp = 2 * (mca + mac + maa + mcc) + mba + mbc + mab + mcb - (thisux * thisux + thisuy * thisuy) / thisrho;
-//	            var pxx = -mba - mbc + mab + mcb - (thisux * thisux - thisuy * thisuy) / thisrho;
-//	            maa = thisrho;
-//	            mba = 0;
-//	            mab = 0;
-//	            mbb = n1;
-
-	            //-----!FastTransform
-
-                     //now the collision:
-                     
-                     var pp=mac+mca;
-                     var pxx = mca - mac;
-                     var CUMcc = mcc - (mca * mac + 2 * mbb * mbb) / thisrho;
-
-                     //----
-                     var dxUx = (-0.5 * omega * (2 * mca - mac) - 0.5 * (mca + mac - maa)) / thisrho;
-                     var dyUy = (-0.5 * omega * (2 * mac - mca) - 0.5 * (mca + mac - maa)) / thisrho;
-                     //----
-
-                    // pp = thisrho/3.0*(dxUx*dxUx+dyUy*dyUy)+ 2.0 / 3.0 * thisrho; 
-                    // CUMcc = 0.0;
-                    // pxx =thisrho/3.0*(dxUx*dxUx-dyUy*dyUy)*omega-3*thisrho*(1.0-omega*0.5)*(thisux*thisux*dxUx-thisuy*thisuy*dyUy)+ pxx * (1.0 - omega);
-                    var om2=omega;//1.99;
-var quadLim = 0.01; //0.001/(0.01+uu+1.0e-9);			
-var limit1 = om2 + (1.0 - om2) * Math.abs(pp) / (Math.abs(pp) + 0.5); //4 Konstantin
-			pp=2.0/3.0*thisrho*limit1+(1.0-limit1)*pp;
-		     //pp =  2.0 / 3.0 * thisrho;
-                     pxx = -3*thisrho*(1.0-omega*0.5)*(thisux*thisux*dxUx-thisuy*thisuy*dyUy)+ pxx * (1.0 - omega);
-                     mbb = mbb * (1.0 - omega);
-                     mca = 0.5 * (pp + pxx);
-                     mac = 0.5 * (pp - pxx);
-                    //-----without limiter
-                    // mcb = 0.0; //mcb * (1.0 - om3);
-
-                    // mbc = 0.0; //mbc * (1.0 - om3);
-                     //---with limiter
-                     var uu = Math.sqrt(thisux * thisux + thisuy * thisuy);
-                     
-                     var limIT = om3 + (1.0 - om3) * Math.abs(mcb) / (Math.abs(mcb) + quadLim);
-                     mcb = mcb * (1.0 - limIT);
-                     limIT = om3 + (1.0 - om3) * Math.abs(mbc) / (Math.abs(mbc) + quadLim);
-                     mbc = mbc * (1.0 - limIT);
-                     //---!limiter
-                     
-                     mcc = /*CUMcc+ */  (mca * mac + 2 * mbb * mbb) / thisrho;
-
-
-                     ////x-Richtung
-
-                     n1 = (mcc + mac * (-1 + thisux) * thisux + mbc * (-1 + 2 * thisux)) * 0.5;
-                     n2 = mac - mcc - 2 * mbc * thisux - mac * thisux * thisux;
-                     mcc = (mbc + mcc + 2 * mbc * thisux + mac * thisux * (1 + thisux)) * 0.5;
-                     mac = n1;
-                     mbc = n2;
-
-                     n1 = (mcb + mab * (-1 + thisux) * thisux + mbb * (-1 + 2 * thisux)) * 0.5;
-                     n2 = mab - mcb - 2 * mbb * thisux - mab * thisux * thisux;
-                     mcb = (mbb + mcb + 2 * mbb * thisux + mab * thisux * (1 + thisux)) * 0.5;
-                     mab = n1;
-                     mbb = n2;
-
-                     n1 = (mca + maa * (-1 + thisux) * thisux + mba * (-1 + 2 * thisux)) * 0.5;
-                     n2 = maa - mca - 2 * mba * thisux - maa * thisux * thisux;
-                     mca = (mba + mca + 2 * mba * thisux + maa * thisux * (1 + thisux)) * 0.5;
-                     maa = n1;
-                     mba = n2;
-
-                     ////y-Richtung
-                     n1 = (mcc + mca * (-1 + thisuy) * thisuy + mcb * (-1 + 2 * thisuy)) * 0.5;
-                     n2 = mca - mcc - 2 * mcb * thisuy - mca * thisuy * thisuy;
-                     mcc = (mcb + mcc + 2 * mcb * thisuy + mca * thisuy * (1 + thisuy)) * 0.5;
-                     mca = n1;
-                     mcb = n2;
-
-                     n1 = (mbc + mba * (-1 + thisuy) * thisuy + mbb * (-1 + 2 * thisuy)) * 0.5;
-                     n2 = mba - mbc - 2 * mbb * thisuy - mba * thisuy * thisuy;
-                     mbc = (mbb + mbc + 2 * mbb * thisuy + mba * thisuy * (1 + thisuy)) * 0.5;
-                     mba = n1;
-                     mbb = n2;
-
-                     n1 = (mac + maa * (-1 + thisuy) * thisuy + mab * (-1 + 2 * thisuy)) * 0.5;
-                     n2 = maa - mac - 2 * mab * thisuy - maa * thisuy * thisuy;
-                     mac = (mab + mac + 2 * mab * thisuy + maa * thisuy * (1 + thisuy)) * 0.5;
-                     maa = n1;
-                     mab = n2;
-     
-	            
-	            if (odd==1){
-	            n0[i] =mbb;
-	            nW[ix] =mcb;
-	            nE[i] =mab;
-	            nS[iy] =mbc;
-	            nN[i] =mba;
-	            nSW[ixy]=mcc;
-	            nNW[ix]=mca;
-	            nSE[iy]=mac;
-	            nNE[i] = maa;
-	            
-	            }
-	            else{
-	            n0[i] =mbb;
-	            nE[ix] =mcb;
-	            nW[i] =mab;
-	            nN[iy] =mbc;
-	            nS[i] =mba;
-	            nNE[ixy]=mcc;
-	            nSE[ix]=mca;
-	            nNW[iy]=mac;
-	            nSW[i] = maa;
-	            
-	            }	            
-	        }
-	    }
-	    }
-	   // if (odd == 0) {
-	   //     for (var y = 1; y < ydim - 2; y++) {
-	          //     nE[xdim - 1 + y * xdim] = nE[xdim - 2 + y * xdim]; 	// at right end, copy left-flowing densities from next row to the left
-	          //     nNE[xdim - 1 + y * xdim] = nNE[xdim - 2 + y * xdim];
-	          //     nSE[xdim - 1 + y * xdim] = nSE[xdim - 2 + y * xdim];
-
-	             //  nW[1+y * xdim] += 0.0001 * 3;
-	             //  nWE[1+y * xdim] += 0.0001;
-	             //  nWS[1+y * xdim] += 0.0001; 
-	     //   }
-	    //}
-	    //else {
-	      //  for (var y = 1; y < ydim - 2; y++) {
-	            //   nW[xdim - 1 + y * xdim] = nW[xdim - 2 + y * xdim]; 	// at right end, copy left-flowing densities from next row to the left
-	            //   nNW[xdim - 1 + y * xdim] = nNW[xdim - 2 + y * xdim];
-	            //   nSW[xdim - 1 + y * xdim] = nSW[xdim - 2 + y * xdim];
-	        //}
-	    //}
-	    
-	}
-
-////------------------------------!Cumulants
-
-
-
-	// Move particles along their directions of motion:
-	function stream() {
-		barrierCount = 0; barrierxSum = 0; barrierySum = 0;
-		barrierFx = 0.0; barrierFy = 0.0;
-		for (var y=ydim-2; y>0; y--) {			// first start in NW corner...
-			for (var x=1; x<xdim-1; x++) {
-				nN[x+y*xdim] = nN[x+(y-1)*xdim];			// move the north-moving particles
-				nNW[x+y*xdim] = nNW[x+1+(y-1)*xdim];		// and the northwest-moving particles
-			}
-		}
-		for (var y=ydim-2; y>0; y--) {			// now start in NE corner...
-			for (var x=xdim-2; x>0; x--) {
-				nE[x+y*xdim] = nE[x-1+y*xdim];			// move the east-moving particles
-				nNE[x+y*xdim] = nNE[x-1+(y-1)*xdim];		// and the northeast-moving particles
-			}
-		}
-		for (var y=1; y<ydim-1; y++) {			// now start in SE corner...
-			for (var x=xdim-2; x>0; x--) {
-				nS[x+y*xdim] = nS[x+(y+1)*xdim];			// move the south-moving particles
-				nSE[x+y*xdim] = nSE[x-1+(y+1)*xdim];		// and the southeast-moving particles
-			}
-		}
-		for (var y=1; y<ydim-1; y++) {				// now start in the SW corner...
-			for (var x=1; x<xdim-1; x++) {
-				nW[x+y*xdim] = nW[x+1+y*xdim];			// move the west-moving particles
-				nSW[x+y*xdim] = nSW[x+1+(y+1)*xdim];		// and the southwest-moving particles
-			}
-		}
-		for (var y=1; y<ydim-1; y++) {				// Now handle bounce-back from barriers
-			for (var x=1; x<xdim-1; x++) {
-				if (barrier[x+y*xdim]) {
-					var index = x + y*xdim;
-					nE[x+1+y*xdim] = nW[index];
-					nW[x-1+y*xdim] = nE[index];
-					nN[x+(y+1)*xdim] = nS[index];
-					nS[x+(y-1)*xdim] = nN[index];
-					nNE[x+1+(y+1)*xdim] = nSW[index];
-					nNW[x-1+(y+1)*xdim] = nSE[index];
-					nSE[x+1+(y-1)*xdim] = nNW[index];
-					nSW[x-1+(y-1)*xdim] = nNE[index];
-					// Keep track of stuff needed to plot force vector:
-					barrierCount++;
-					barrierxSum += x;
-					barrierySum += y;
-					barrierFx += nE[index] + nNE[index] + nSE[index] - nW[index] - nNW[index] - nSW[index];
-					barrierFy += nN[index] + nNE[index] + nNW[index] - nS[index] - nSE[index] - nSW[index];
-				}
-			}
-		}
-	}
-
-	// Move the tracer particles:
-	function moveTracers() {
-		for (var t=0; t<nTracers; t++) {
-			var roundedX = Math.round(tracerX[t]);
-			var roundedY = Math.round(tracerY[t]);
-			var index = roundedX + roundedY*xdim;
-			tracerX[t] += ux[index];
-			tracerY[t] += uy[index];
-			if (tracerX[t] > xdim-1) {
-				tracerX[t] = 0;
-				tracerY[t] = Math.random() * ydim;
-			}
-		}
-	}
-
-	// "Drag" the fluid in a direction determined by the mouse (or touch) motion:
-	// (The drag affects a "circle", 5 px in diameter, centered on the given coordinates.)
-	function push(pushX, pushY, pushUX, pushUY) {
-		// First make sure we're not too close to edge:
-		var margin = 3;
-		if ((pushX > margin) && (pushX < xdim-1-margin) && (pushY > margin) && (pushY < ydim-1-margin)) {
-			for (var dx=-1; dx<=1; dx++) {
-				setEquil(pushX+dx, pushY+2, pushUX, pushUY);
-				setEquil(pushX+dx, pushY-2, pushUX, pushUY);
-			}
-			for (var dx=-2; dx<=2; dx++) {
-				for (var dy=-1; dy<=1; dy++) {
-					setEquil(pushX+dx, pushY+dy, pushUX, pushUY);
-				}
-			}
-		}
-	}
-
-	// Set all densities in a cell to their equilibrium values for a given velocity and density:
-	// (If density is omitted, it's left unchanged.)
-	function setEquil(x, y, newux, newuy, newrho) {
-	    var i = x + y * xdim;
-	    var ix = (x + 1) + y * xdim;
-	    var iy = x + (y + 1) * xdim;
-	    var ixy = (x + 1) + (y + 1) * xdim;
-
-		if (typeof newrho == 'undefined') {
-			newrho = rho[i];
-		}
-		var ux3 = 3 * newux;
-		var uy3 = 3 * newuy;
-		var ux2 = newux * newux;
-		var uy2 = newuy * newuy;
-		var uxuy2 = 2 * newux * newuy;
-		var u2 = ux2 + uy2;
-		var u215 = 1.5 * u2;
-		if (odd == 0) {
-		    n0[i] = four9ths * newrho * (1 - u215);
-		    nW[ix] = one9th * newrho * (1 + ux3 + 4.5 * ux2 - u215);
-		    nE[i] = one9th * newrho * (1 - ux3 + 4.5 * ux2 - u215);
-		    nS[iy] = one9th * newrho * (1 + uy3 + 4.5 * uy2 - u215);
-		    nN[i] = one9th * newrho * (1 - uy3 + 4.5 * uy2 - u215);
-		    nSW[ixy] = one36th * newrho * (1 + ux3 + uy3 + 4.5 * (u2 + uxuy2) - u215);
-		    nNW[ix] = one36th * newrho * (1 + ux3 - uy3 + 4.5 * (u2 - uxuy2) - u215);
-		    nSE[iy] = one36th * newrho * (1 - ux3 + uy3 + 4.5 * (u2 - uxuy2) - u215);
-		    nNE[i] = one36th * newrho * (1 - ux3 - uy3 + 4.5 * (u2 + uxuy2) - u215);
-		    rho[i] = newrho;
-		    ux[i] = newux;
-		    uy[i] = newuy;
-		}
-		else {
-		    n0[i] = four9ths * newrho * (1 - u215);
-		    nE[ix] = one9th * newrho * (1 + ux3 + 4.5 * ux2 - u215);
-		    nW[i] = one9th * newrho * (1 - ux3 + 4.5 * ux2 - u215);
-		    nN[iy] = one9th * newrho * (1 + uy3 + 4.5 * uy2 - u215);
-		    nS[i] = one9th * newrho * (1 - uy3 + 4.5 * uy2 - u215);
-		    nNE[ixy] = one36th * newrho * (1 + ux3 + uy3 + 4.5 * (u2 + uxuy2) - u215);
-		    nSE[ix] = one36th * newrho * (1 + ux3 - uy3 + 4.5 * (u2 - uxuy2) - u215);
-		    nNW[iy] = one36th * newrho * (1 - ux3 + uy3 + 4.5 * (u2 - uxuy2) - u215);
-		    nSW[i] = one36th * newrho * (1 - ux3 - uy3 + 4.5 * (u2 + uxuy2) - u215);
-		    rho[i] = newrho;
-		    ux[i] = newux;
-		    uy[i] = newuy;
-		
-		}
-	}
-
-	// Initialize the tracer particles:
-	function initTracers() {
-		if (tracerCheck.checked) {
-			var nRows = Math.ceil(Math.sqrt(nTracers));
-			var dx = xdim / nRows;
-			var dy = ydim / nRows;
-			var nextX = dx / 2;
-			var nextY = dy / 2;
-			for (var t=0; t<nTracers; t++) {
-				tracerX[t] = nextX;
-				tracerY[t] = nextY;
-				nextX += dx;
-				if (nextX > xdim) {
-					nextX = dx / 2;
-					nextY += dy;
-				}
-			}
-		}
-		paintCanvas();
-	}
-
-	// Paint the canvas:
-	function paintCanvas() {
-		var cIndex=0;
-		var contrast = Math.pow(1.2,Number(contrastSlider.value));
-		var plotType = plotSelect.selectedIndex;
-		//var pixelGraphics = pixelCheck.checked;
-		if (plotType == 4) computeCurl();
-		for (var y=0; y<ydim; y++) {
-			for (var x=0; x<xdim; x++) {
-				if (barrier[x+y*xdim]) {
-					cIndex = nColors + 1;	// kludge for barrier color which isn't really part of color map
-				} else {
-					if (plotType == 0) {
-						cIndex = Math.round(nColors * ((rho[x+y*xdim]-1)*6*contrast + 0.5));
-					} else if (plotType == 1) {
-						cIndex = Math.round(nColors * (ux[x+y*xdim]*2*contrast + 0.5));
-					} else if (plotType == 2) {
-						cIndex = Math.round(nColors * (uy[x+y*xdim]*2*contrast + 0.5));
-					} else if (plotType == 3) {
-						var speed = Math.sqrt(ux[x+y*xdim]*ux[x+y*xdim] + uy[x+y*xdim]*uy[x+y*xdim]);
-						cIndex = Math.round(nColors * (speed*4*contrast));
-					} else {
-						cIndex = Math.round(nColors * (curl[x+y*xdim]*5*contrast + 0.5));
-					}
-					if (cIndex < 0) cIndex = 0;
-					if (cIndex > nColors) cIndex = nColors;
-				}
-				//if (pixelGraphics) {
-					//colorSquare(x, y, cIndex);
-				colorSquare(x, y, redList[cIndex], greenList[cIndex], blueList[cIndex]);
-				//} else {
-				//	context.fillStyle = hexColorList[cIndex];
-				//	context.fillRect(x*pxPerSquare, (ydim-y-1)*pxPerSquare, pxPerSquare, pxPerSquare);
-				//}
-			}
-		}
-		//if (pixelGraphics) 
-		context.putImageData(image, 0, 0);		// blast image to the screen
-		// Draw tracers, force vector, and/or sensor if appropriate:
-		if (tracerCheck.checked) drawTracers();
-		if (flowlineCheck.checked) drawFlowlines();
-		if (forceCheck.checked) drawForceArrow(barrierxSum/barrierCount, barrierySum/barrierCount, barrierFx, barrierFy);
-		if (sensorCheck.checked) drawSensor();
-	}
-
-	// Color a grid square in the image data array, one pixel at a time (rgb each in range 0 to 255):
-	function colorSquare(x, y, r, g, b) {
-	//function colorSquare(x, y, cIndex) {		// for some strange reason, this version is quite a bit slower on Chrome
-		//var r = redList[cIndex];
-		//var g = greenList[cIndex];
-		//var b = blueList[cIndex];
-		var flippedy = ydim - y - 1;			// put y=0 at the bottom
-		for (var py=flippedy*pxPerSquare; py<(flippedy+1)*pxPerSquare; py++) {
-			for (var px=x*pxPerSquare; px<(x+1)*pxPerSquare; px++) {
-				var index = (px + py*image.width) * 4;
-				image.data[index+0] = r;
-				image.data[index+1] = g;
-				image.data[index+2] = b;
-			}
-		}
-	}
-
-	// Compute the curl (actually times 2) of the macroscopic velocity field, for plotting:
-	function computeCurl() {
-		for (var y=1; y<ydim-1; y++) {			// interior sites only; leave edges set to zero
-			for (var x=1; x<xdim-1; x++) {
-				curl[x+y*xdim] = uy[x+1+y*xdim] - uy[x-1+y*xdim] - ux[x+(y+1)*xdim] + ux[x+(y-1)*xdim];
-			}
-		}
-	}
-
-	// Draw the tracer particles:
-	function drawTracers() {
-		context.fillStyle = "rgb(150,150,150)";
-		for (var t=0; t<nTracers; t++) {
-			var canvasX = (tracerX[t]+0.5) * pxPerSquare;
-			var canvasY = canvas.height - (tracerY[t]+0.5) * pxPerSquare;
-			context.fillRect(canvasX-1, canvasY-1, 2, 2);
-		}
-	}
-
-	// Draw a grid of short line segments along flow directions:
-	function drawFlowlines() {
-		var pxPerFlowline = 10;
-		if (pxPerSquare == 1) pxPerFlowline = 6;
-		if (pxPerSquare == 2) pxPerFlowline = 8;
-		if (pxPerSquare == 5) pxPerFlowline = 12;
-		if ((pxPerSquare == 6) || (pxPerSquare == 8)) pxPerFlowline = 15;
-		if (pxPerSquare == 10) pxPerFlowline = 20;
-		var sitesPerFlowline = pxPerFlowline / pxPerSquare;
-		var xLines = canvas.width / pxPerFlowline;
-		var yLines = canvas.height / pxPerFlowline;
-		for (var yCount=0; yCount<yLines; yCount++) {
-			for (var xCount=0; xCount<xLines; xCount++) {
-				var x = Math.round((xCount+0.5) * sitesPerFlowline);
-				var y = Math.round((yCount+0.5) * sitesPerFlowline);
-				var thisUx = ux[x+y*xdim];
-				var thisUy = uy[x+y*xdim];
-				var speed = Math.sqrt(thisUx*thisUx + thisUy*thisUy);
-				if (speed > 0.0001) {
-					var px = (xCount+0.5) * pxPerFlowline;
-					var py = canvas.height - ((yCount+0.5) * pxPerFlowline);
-					var scale = 0.5 * pxPerFlowline / speed;
-					context.beginPath();
-					context.moveTo(px-thisUx*scale, py+thisUy*scale);
-					context.lineTo(px+thisUx*scale, py-thisUy*scale);
-					//context.lineWidth = speed * 5;
-					var cIndex = Math.round(speed * transBlackArraySize / 0.3);
-					if (cIndex >= transBlackArraySize) cIndex = transBlackArraySize - 1;
-					context.strokeStyle = transBlackArray[cIndex];
-					//context.strokeStyle = "rgba(0,0,0,0.1)";
-					context.stroke();
-				}
-			}
-		}
-	}
-
-	// Draw an arrow to represent the total force on the barrier(s):
-	function drawForceArrow(x, y, Fx, Fy) {
-		context.fillStyle = "rgba(100,100,100,0.7)";
-		context.translate((x + 0.5) * pxPerSquare, canvas.height - (y + 0.5) * pxPerSquare);
-		var magF = Math.sqrt(Fx*Fx + Fy*Fy);
-		context.scale(4*magF, 4*magF);
-		context.rotate(Math.atan2(-Fy, Fx));
-		context.beginPath();
-		context.moveTo(0, 3);
-		context.lineTo(100, 3);
-		context.lineTo(100, 12);
-		context.lineTo(130, 0);
-		context.lineTo(100, -12);
-		context.lineTo(100, -3);
-		context.lineTo(0, -3);
-		context.lineTo(0, 3);
-		context.fill();
-		context.setTransform(1, 0, 0, 1, 0, 0);
-	}
-
-	// Draw the sensor and its associated data display:
-	function drawSensor() {
-		var canvasX = (sensorX+0.5) * pxPerSquare;
-		var canvasY = canvas.height - (sensorY+0.5) * pxPerSquare;
-		context.fillStyle = "rgba(180,180,180,0.7)";	// first draw gray filled circle
-		context.beginPath();
-		context.arc(canvasX, canvasY, 7, 0, 2*Math.PI);
-		context.fill();
-		context.strokeStyle = "#404040";				// next draw cross-hairs
-		context.linewidth = 1;
-		context.beginPath();
-		context.moveTo(canvasX, canvasY-10);
-		context.lineTo(canvasX, canvasY+10);
-		context.moveTo(canvasX-10, canvasY);
-		context.lineTo(canvasX+10, canvasY);
-		context.stroke();
-		context.fillStyle = "rgba(255,255,255,0.5)";	// draw rectangle behind text
-		canvasX += 10;
-		context.font = "12px Monospace";
-		var rectWidth = context.measureText("00000000000").width+6;
-		var rectHeight = 58;
-		if (canvasX+rectWidth > canvas.width) canvasX -= (rectWidth+20);
-		if (canvasY+rectHeight > canvas.height) canvasY = canvas.height - rectHeight;
-		context.fillRect(canvasX, canvasY, rectWidth, rectHeight);
-		context.fillStyle = "#000000";					// finally draw the text
-		canvasX += 3;
-		canvasY += 12;
-		var coordinates = "  (" + sensorX + "," + sensorY + ")";
-		context.fillText(coordinates, canvasX, canvasY);
-		canvasY += 14;
-		var rhoSymbol = String.fromCharCode(parseInt('03C1',16));
-		var index = sensorX + sensorY * xdim;
-		context.fillText(" " + rhoSymbol + " =  " + Number(rho[index]).toFixed(3), canvasX, canvasY);
-		canvasY += 14;
-		var digitString = Number(ux[index]).toFixed(3);
-		if (ux[index] >= 0) digitString = " " + digitString;
-		context.fillText("ux = " + digitString, canvasX, canvasY);
-		canvasY += 14;
-		digitString = Number(uy[index]).toFixed(3);
-		if (uy[index] >= 0) digitString = " " + digitString;
-		context.fillText("uy = " + digitString, canvasX, canvasY);
-	}
-
-	// Functions to handle mouse/touch interaction:
-	function mouseDown(e) {
-		if (sensorCheck.checked) {
-			var canvasLoc = pageToCanvas(e.pageX, e.pageY);
-			var gridLoc = canvasToGrid(canvasLoc.x, canvasLoc.y);
-			var dx = (gridLoc.x - sensorX) * pxPerSquare;
-			var dy = (gridLoc.y - sensorY) * pxPerSquare;
-			if (Math.sqrt(dx*dx + dy*dy) <= 8) {
-				draggingSensor = true;
-			}
-		}
-		mousePressDrag(e);
-	};
-	function mouseMove(e) {
-		if (mouseIsDown) {
-			mousePressDrag(e);
-		}
-	};
-	function mouseUp(e) {
-		mouseIsDown = false;
-		draggingSensor = false;
-	};
-
-	// Handle mouse press or drag:
-	function mousePressDrag(e) {
-		e.preventDefault();
-		mouseIsDown = true;
-		var canvasLoc = pageToCanvas(e.pageX, e.pageY);
-		if (draggingSensor) {
-			var gridLoc = canvasToGrid(canvasLoc.x, canvasLoc.y);
-			sensorX = gridLoc.x;
-			sensorY = gridLoc.y;
-			paintCanvas();
-			return;
-		}
-		if (mouseSelect.selectedIndex == 2) {
-			mouseX = canvasLoc.x;
-			mouseY = canvasLoc.y;
-			return;
-		}
-		var gridLoc = canvasToGrid(canvasLoc.x, canvasLoc.y);
-		if (mouseSelect.selectedIndex == 0) {
-			addBarrier(gridLoc.x, gridLoc.y);
-			paintCanvas();
-		} else {
-			removeBarrier(gridLoc.x, gridLoc.y);
-		}
-	}
-
-	// Convert page coordinates to canvas coordinates:
-	function pageToCanvas(pageX, pageY) {
-		var canvasX = pageX - canvas.offsetLeft;
-		var canvasY = pageY - canvas.offsetTop;
-		// this simple subtraction may not work when the canvas is nested in other elements
-		return { x:canvasX, y:canvasY };
-	}
-
-	// Convert canvas coordinates to grid coordinates:
-	function canvasToGrid(canvasX, canvasY) {
-		var gridX = Math.floor(canvasX / pxPerSquare);
-		var gridY = Math.floor((canvas.height - 1 - canvasY) / pxPerSquare); 	// off by 1?
-		return { x:gridX, y:gridY };
-	}
-
-	// Add a barrier at a given grid coordinate location:
-	function addBarrier(x, y) {
-		if ((x > 1) && (x < xdim-2) && (y > 1) && (y < ydim-2)) {
-			barrier[x+y*xdim] = true;
-		}
-	}
-
-	// Remove a barrier at a given grid coordinate location:
-	function removeBarrier(x, y) {
-		if (barrier[x+y*xdim]) {
-			barrier[x+y*xdim] = false;
-			paintCanvas();
-		}
-	}
-
-	// Clear all barriers:
-	function clearBarriers() {
-		for (var x=0; x<xdim; x++) {
-			for (var y=0; y<ydim; y++) {
-				barrier[x+y*xdim] = false;
-			}
-		}
-		paintCanvas();
-	}
-
-	// Resize the grid:
-	function resize() {
-		// First up-sample the macroscopic variables into temporary arrays at max resolution:
-		var tempRho = new Array(canvas.width*canvas.height);
-		var tempUx = new Array(canvas.width*canvas.height);
-		var tempUy = new Array(canvas.width*canvas.height);
-		var tempBarrier = new Array(canvas.width*canvas.height);
-		for (var y=0; y<canvas.height; y++) {
-			for (var x=0; x<canvas.width; x++) {
-				var tempIndex = x + y*canvas.width;
-				var xOld = Math.floor(x / pxPerSquare);
-				var yOld = Math.floor(y / pxPerSquare);
-				var oldIndex = xOld + yOld*xdim;
-				tempRho[tempIndex] = rho[oldIndex];
-				tempUx[tempIndex] = ux[oldIndex];
-				tempUy[tempIndex] = uy[oldIndex];
-				tempBarrier[tempIndex] = barrier[oldIndex];
-			}
-		}
-		// Get new size from GUI selector:
-		var oldPxPerSquare = pxPerSquare;
-		pxPerSquare = Number(sizeSelect.options[sizeSelect.selectedIndex].value);
-		var growRatio = oldPxPerSquare / pxPerSquare;
-		xdim = canvas.width / pxPerSquare;
-		ydim = canvas.height / pxPerSquare;
-		// Create new arrays at the desired resolution:
-		n0 = new Array(xdim*ydim);
-		nN = new Array(xdim*ydim);
-		nS = new Array(xdim*ydim);
-		nE = new Array(xdim*ydim);
-		nW = new Array(xdim*ydim);
-		nNE = new Array(xdim*ydim);
-		nSE = new Array(xdim*ydim);
-		nNW = new Array(xdim*ydim);
-		nSW = new Array(xdim*ydim);
-		rho = new Array(xdim*ydim);
-		ux = new Array(xdim*ydim);
-		uy = new Array(xdim*ydim);
-		curl = new Array(xdim*ydim);
-		barrier = new Array(xdim*ydim);
-		// Down-sample the temporary arrays into the new arrays:
-		for (var yNew=0; yNew<ydim; yNew++) {
-			for (var xNew=0; xNew<xdim; xNew++) {
-				var rhoTotal = 0;
-				var uxTotal = 0;
-				var uyTotal = 0;
-				var barrierTotal = 0;
-				for (var y=yNew*pxPerSquare; y<(yNew+1)*pxPerSquare; y++) {
-					for (var x=xNew*pxPerSquare; x<(xNew+1)*pxPerSquare; x++) {
-						var index = x + y*canvas.width;
-						rhoTotal += tempRho[index];
-						uxTotal += tempUx[index];
-						uyTotal += tempUy[index];
-						if (tempBarrier[index]) barrierTotal++;
-					}
-				}
-				setEquil(xNew, yNew, uxTotal/(pxPerSquare*pxPerSquare), uyTotal/(pxPerSquare*pxPerSquare), rhoTotal/(pxPerSquare*pxPerSquare))
-				curl[xNew+yNew*xdim] = 0.0;
-				barrier[xNew+yNew*xdim] = (barrierTotal >= pxPerSquare*pxPerSquare/2);
-			}
-		}
-		setBoundaries();
-		if (tracerCheck.checked) {
-			for (var t=0; t<nTracers; t++) {
-				tracerX[t] *= growRatio;
-				tracerY[t] *= growRatio;
-			}
-		}
-		sensorX = Math.round(sensorX * growRatio);
-		sensorY = Math.round(sensorY * growRatio);
-		//computeCurl();
-		paintCanvas();
-		resetTimer();
-	}
-
-	// Function to initialize or re-initialize the fluid, based on speed slider setting:
-	function initFluid() {
-		// Amazingly, if I nest the y loop inside the x loop, Firefox slows down by a factor of 20
-		var u0 = Number(speedSlider.value);
-		for (var y=0; y<ydim; y++) {
-			for (var x=0; x<xdim; x++) {
-				setEquil(x, y, u0, 0, 1);
-				curl[x+y*xdim] = 0.0;
-			}
-		}
-	paintCanvas();
-	}
-
-	// Function to start or pause the simulation:
-	function startStop() {
-		running = !running;
-		if (running) {
-			startButton.value = "Pause";
-			resetTimer();
-			simulate();
-		} else {
-			startButton.value = " Run ";
-		}
-	}
-
-	// Reset the timer that handles performance evaluation:
-	function resetTimer() {
-		stepCount = 0;
-		startTime = (new Date()).getTime();
-	}
-
-	// Show value of flow speed setting:
-	function adjustSpeed() {
-		speedValue.innerHTML = Number(speedSlider.value).toFixed(3);
-	}
-
-	// Show value of viscosity:
-	function adjustViscosity() {
-		viscValue.innerHTML = Number(viscSlider.value);//.toFixed(6);
-	}
-
-	// Show or hide the data area:
-	function showData() {
-		if (dataCheck.checked) {
-			dataSection.style.display="block";
-		} else {
-			dataSection.style.display="none";
-		}
-	}
-
-	// Start or stop collecting data:
-	function startOrStopData() {
-		collectingData = !collectingData;
-		if (collectingData) {
-			time = 0;
-			dataArea.innerHTML = "Time \tDensity\tVel_x \tVel_y \tForce_x\tForce_y\n";
-			writeData();
-			dataButton.value = "Stop data collection";
-			showingPeriod = false;
-			periodButton.value = "Show F_y period";
-		} else {
-			dataButton.value = "Start data collection";
-		}
-	}
-
-	// Write one line of data to the data area:
-	function writeData() {
-		var timeString = String(time);
-		while (timeString.length < 5) timeString = "0" + timeString;
-		sIndex = sensorX + sensorY*xdim;
-		dataArea.innerHTML += timeString + "\t" + Number(rho[sIndex]).toFixed(4) + "\t"
-			+ Number(ux[sIndex]).toFixed(4) + "\t" + Number(uy[sIndex]).toFixed(4) + "\t"
-			+ Number(barrierFx).toFixed(4) + "\t" + Number(barrierFy).toFixed(4) + "\n";
-		dataArea.scrollTop = dataArea.scrollHeight;
-	}
-
-	// Handle click to "show period" button
-	function showPeriod() {
-		showingPeriod = !showingPeriod;
-		if (showingPeriod) {
-			time = 0;
-			lastBarrierFy = 1.0;	// arbitrary positive value
-			lastFyOscTime = -1.0;	// arbitrary negative value
-			dataArea.innerHTML = "Period of F_y oscillation\n";
-			periodButton.value = "Stop data";
-			collectingData = false;
-			dataButton.value = "Start data collection";
-		} else {
-			periodButton.value = "Show F_y period";
-		}
-	}
-
-	// Write all the barrier locations to the data area:
-	function showBarrierLocations() {
-		dataArea.innerHTML = '{name:"Barrier locations",\n';
-		dataArea.innerHTML += 'locations:[\n';
-		for (var y=1; y<ydim-1; y++) {
-			for (var x=1; x<xdim-1; x++) {
-				if (barrier[x+y*xdim]) dataArea.innerHTML += x + ',' + y + ',\n';
-			}
-		}
-		dataArea.innerHTML = dataArea.innerHTML.substr(0, dataArea.innerHTML.length-2); // remove final comma
-		dataArea.innerHTML += '\n]},\n';
-	}
-
-	// Place a preset barrier:
-	function placePresetBarrier() {
-		var index = barrierSelect.selectedIndex;
-		if (index == 0) return;
-		clearBarriers();
-		var bCount = barrierList[index-1].locations.length/2;	// number of barrier sites
-		// To decide where to place it, find minimum x and min/max y:
-		var xMin = barrierList[index-1].locations[0];
-		var yMin = barrierList[index-1].locations[1];
-		var yMax = yMin;
-		for (var siteIndex=2; siteIndex<2*bCount; siteIndex+=2) {
-			if (barrierList[index-1].locations[siteIndex] < xMin) {
-				xMin = barrierList[index-1].locations[siteIndex];
-			}
-			if (barrierList[index-1].locations[siteIndex+1] < yMin) {
-				yMin = barrierList[index-1].locations[siteIndex+1];
-			}
-			if (barrierList[index-1].locations[siteIndex+1] > yMax) {
-				yMax = barrierList[index-1].locations[siteIndex+1];
-			}
-		}
-		var yAverage = Math.round((yMin+yMax)/2);
-		// Now place the barriers:
-		for (var siteIndex=0; siteIndex<2*bCount; siteIndex+=2) {
-			var x = barrierList[index-1].locations[siteIndex] - xMin + Math.round(ydim/3);
-			var y = barrierList[index-1].locations[siteIndex+1] - yAverage + Math.round(ydim/2);
-			addBarrier(x, y);
-		}
-		paintCanvas();
-		barrierSelect.selectedIndex = 0;	// A choice on this menu is a one-time action, not an ongoing setting
-	}
-
-	// Print debugging data:
-	function debug() {
-		dataArea.innerHTML = "Tracer locations:\n";
-		for (var t=0; t<nTracers; t++) {
-			dataArea.innerHTML += tracerX[t] + ", " + tracerY[t] + "\n";
-		}
-	}
-</script>
-    
-</body>
+
+<!DOCTYPE HTML>
+<!--
+	A lattice-Boltzmann fluid simulation in JavaScript, using HTML5 canvas for graphics
+	
+	Copyright 2013, Daniel V. Schroeder
+
+	Permission is hereby granted, free of charge, to any person obtaining a copy of 
+	this software and associated data and documentation (the "Software"), to deal in 
+	the Software without restriction, including without limitation the rights to 
+	use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 
+	of the Software, and to permit persons to whom the Software is furnished to do 
+	so, subject to the following conditions:
+
+	The above copyright notice and this permission notice shall be included in all 
+	copies or substantial portions of the Software.
+
+	THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 
+	INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 
+	PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 
+	ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 
+	OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 
+	OTHER DEALINGS IN THE SOFTWARE.
+
+	Except as contained in this notice, the name of the author shall not be used in 
+	advertising or otherwise to promote the sale, use or other dealings in this 
+	Software without prior written authorization.
+
+	Credits:
+	The "wind tunnel" entry/exit conditions are inspired by Graham Pullan's code
+	(http://www.many-core.group.cam.ac.uk/projects/LBdemo.shtml).  Additional inspiration from 
+	Thomas Pohl's applet (http://thomas-pohl.info/work/lba.html).  Other portions of code are based 
+	on Wagner (http://www.ndsu.edu/physics/people/faculty/wagner/lattice_boltzmann_codes/) and
+	Gonsalves (http://www.physics.buffalo.edu/phy411-506-2004/index.html; code adapted from Succi,
+	http://global.oup.com/academic/product/the-lattice-boltzmann-equation-9780199679249).
+
+	Revision history:
+	First version, with only start/stop, speed, and viscosity controls, February 2013
+	Added resolution control, mouse interaction, plot options, etc., March 2013
+	Added sensor, contrast slider, improved tracer placement, Fy period readout, May 2013
+	Added option to animate using setTimeout instead of requestAnimationFrame, July 2013
+	Added "Flowline" plotting (actually just line segments), August 2013
+	
+	Still to do:
+	* Fix the apparent bug in the force calculation that gives inconsistent results depending
+		on initial conditions.  Perhaps bounce-backs between adjacent barrier sites don't cancel?
+	* Grabbing the sensor while "drag fluid" selected causes a momentary drag at previous mouse location.
+	* Try to pass two-fingered touch events on to the browser, so it's still possible to zoom in and out.
+	* Work on GUI control layout, especially for smaller screens.
+	* Treat ends symmetrically when flow speed is zero.
+	* Try some other visualization techniques.
+-->
+<html>
+
+<head>
+<title>Fluid Dynamics Simulation</title>
+<meta charset="utf-8">
+<meta name="viewport" content="width=620">
+<style>
+	body {background-color:#ffffff; font-family:Arial, sans-serif; font-size:14px;
+					text-align:center;}						/* gray background, center everything */
+	p {margin-left:auto; margin-right:auto; width:600px;}	/* keep paragraphs narrow and centered */
+	input {font-size:115%;}									/* make buttons bigger */
+	input[type="range"] {width:90px;}						/* make sliders shorter */
+	select {font-size:115%;}								/* make selectors bigger too */
+	li {text-align:left;}
+</style>
+</head>
+
+<body>
+
+<h2>Fluid Dynamics Simulation</h2>
+
+<p>By <a href="http://physics.weber.edu/schroeder/">Dan Schroeder</a>, 
+<a href="http://physics.weber.edu">Physics Department</a>, 
+<a href="http://weber.edu">Weber State University</a></p>
+
+<canvas id="theCanvas" width="600" height="240">This application runs only in modern
+browsers. For best results, use Google Chrome.</canvas>
+
+<div>
+	<select id="sizeSelect" onchange="resize()">
+		<option value="10">60 x 24</option>
+		<option value="8">75 x 30</option>
+		<option value="6">100 x 40</option>
+		<option value="5">120 x 48</option>
+		<option value="4">150 x 60</option>
+		<option value="3">200 x 80</option>
+		<option value="2">300 x 120</option>
+		<option value="1">600 x 240</option>
+	</select>
+	<input id="resetFluidButton" type="button" onclick="initFluid()" value="Reset fluid">
+	<input id="stepButton" type="button" onclick="simulate()" value="Step">
+	<input id="startButton" type="button" onclick="startStop()" value="Start">
+</div>
+<div>
+	Flow speed = <span id="speedValue">0.100</span> 
+	<input id="speedSlider" type="range" min="0" max="0.12" step="0.005" value="0.1" onchange="adjustSpeed()">
+	&nbsp;&nbsp;Viscosity = <span id="viscValue">0.020</span>
+	<input id="viscSlider" type="range" min="0.000000001" max="0.02" step="0.000005" value="0.02" onchange="adjustViscosity()">
+</div>
+<div style="margin-top:3px">
+	<select id="mouseSelect">
+		<option value="draw">Draw barriers</option>
+		<option value="erase">Erase barriers</option>
+		<option value="push">Drag fluid</option>
+	</select>
+	<select id="barrierSelect" onchange="placePresetBarrier()">
+		<option>Barrier shapes</option>
+	</select>
+	<input id="clearButton" type="button" onclick="clearBarriers()" value="Clear barriers">
+</div>
+<div>
+	<select id="plotSelect" onchange="paintCanvas()">
+		<option>Plot density</option>
+		<option>Plot x velocity</option>
+		<option>Plot y velocity</option>
+		<option>Plot speed</option>
+		<option selected>Plot curl</option>
+	</select>
+	&nbsp;&nbsp;Contrast:
+	<input id="contrastSlider" type="range" min="-10" max="10" step="1" value="0" onchange="paintCanvas()">
+</div>
+<div>
+	Animation speed:
+	<input id="stepsSlider" type="range" min="1" max="40" step="1" value="20" onchange="resetTimer()">
+	&nbsp;&nbsp;Steps per second: <span id="speedReadout">0</span>
+	&nbsp;&nbsp;<input id="rafCheck" type="checkbox" checked onchange="resetTimer()">Faster?
+</div>
+<div style="margin-top:4px">
+	<!--<input id="pixelCheck" type="checkbox" checked onchange="resetTimer()">Use pixel graphics-->
+	Show:
+	<input id="tracerCheck" type="checkbox" onchange="initTracers()">Tracers
+	<input id="flowlineCheck" type="checkbox" onchange="paintCanvas()">Flowlines
+	<input id="forceCheck" type="checkbox" onchange="paintCanvas()">Force on barriers
+	<input id="sensorCheck" type="checkbox" onchange="paintCanvas()">Sensor
+	<input id="dataCheck" type="checkbox" onchange="showData()">Data
+</div>
+<div id="dataSection" style="display:none">
+	<textarea id="dataArea" rows="8" cols="50" disabled readonly></textarea>
+	<div>
+		<input id="dataButton" type="button" value="Start data collection" onclick="startOrStopData()">
+		<input id="periodButton" type="button" value="Show F_y period" onclick="showPeriod()">
+		<input id="barrierDataButton" type="button" value="Show barrier locations" onclick="showBarrierLocations()">
+		<input id="debugButton" type="button" value="Debug" onclick="debug()" style="display:none">
+	</div>
+</div>
+<p style="text-align:left">This is a simulation of a two-dimensional fluid. Initially the fluid
+is flowing from left to right, and a linear barrier (shown in black) diverts the fluid and creates 
+vortices. The colors indicate the curl, or local rotational motion, of the fluid.  
+Use the controls to adjust the flow speed and viscosity, draw different barriers, drag the
+fluid around, plot other quantities besides the curl, show the force exerted by the fluid
+on the barriers, and measure the fluid's density and velocity at any point. Enjoy!</p>
+
+<p style="text-align:left">The simulation uses a fairly simple
+<a href="http://en.wikipedia.org/wiki/Lattice_Boltzmann_methods">lattice-Boltzmann algorithm</a>, 
+which you can see by viewing the JavaScript source code. As of mid-2013, the simulation
+runs fastest under Chrome on either MacOS or Windows.  Firefox is somewhat slower and Safari slower still,
+while Opera and Internet Explorer are much slower. You can adjust the resolution to increase or
+decrease the simulation speed.</p>
+
+<p style="text-align:left">If you don't see the slider controls above, try updating your browser.
+As of August 2013, the most recent versions of all major browsers should show the sliders.</p>
+
+<p style="text-align:left">This HTML5-canvas-JavaScript web app is a work in progress. It still
+has a few bugs and awkward features, which I hope to address some day.</p>
+
+<p style="text-align:left">
+	Related materials:
+</p>
+<div style="margin-left:auto; margin-right:auto; width:600px;">
+	<ul>
+	<li><a href="LatticeBoltzmannDemo.java.txt">A similar simulation in Java</a></li>
+	<li><a href="LatticeBoltzmannDemo.py.txt">A similar simulation in Python</a></li>
+	<li><a href="FluidSimulationsForUndergrads.pdf">Poster presentation</a> 
+	given at the AAPT summer meeting, 2013 (pdf, 2.6 MB)</li>
+	<li><a href="http://physics.weber.edu/schroeder/javacourse/LatticeBoltzmann.pdf">Instructions</a> 
+	for a lattice-Boltzmann project in a computational physics course</li>
+	<li>A more detailed explanation of the lattice-Boltzmann algorithm (coming soon)</li>
+	</ul>
+</div>
+
+<script src="barrierdata.js"></script>
+<script>
+	// Global variables:	
+	var mobile = navigator.userAgent.match(/iPhone|iPad|iPod|Android|BlackBerry|Opera Mini|IEMobile/i)
+	var canvas = document.getElementById('theCanvas');
+	var context = canvas.getContext('2d');
+	var image = context.createImageData(canvas.width, canvas.height);		// for direct pixel manipulation (faster than fillRect)
+	for (var i=3; i<image.data.length; i+=4) image.data[i] = 255;			// set all alpha values to opaque
+	var sizeSelect = document.getElementById('sizeSelect');
+	sizeSelect.selectedIndex = 5;
+	if (mobile) sizeSelect.selectedIndex = 1;		// smaller works better on mobile platforms
+	var pxPerSquare = Number(sizeSelect.options[sizeSelect.selectedIndex].value);
+													// width of plotted grid site in pixels
+	var xdim = canvas.width / pxPerSquare;			// grid dimensions for simulation
+	var ydim = canvas.height / pxPerSquare;
+	var stepsSlider = document.getElementById('stepsSlider');
+	var startButton = document.getElementById('startButton');
+	var speedSlider = document.getElementById('speedSlider');
+	var speedValue = document.getElementById('speedValue');
+	var viscSlider = document.getElementById('viscSlider');
+	var viscValue = document.getElementById('viscValue');
+	var mouseSelect = document.getElementById('mouseSelect');
+	var barrierSelect = document.getElementById('barrierSelect');
+	for (var barrierIndex=0; barrierIndex<barrierList.length; barrierIndex++) {
+		var shape = document.createElement("option");
+		shape.text = barrierList[barrierIndex].name;
+		barrierSelect.add(shape, null);
+	}
+	var plotSelect = document.getElementById('plotSelect');
+	var contrastSlider = document.getElementById('contrastSlider');
+	//var pixelCheck = document.getElementById('pixelCheck');
+	var tracerCheck = document.getElementById('tracerCheck');
+	var flowlineCheck = document.getElementById('flowlineCheck');
+	var forceCheck = document.getElementById('forceCheck');
+	var sensorCheck = document.getElementById('sensorCheck');
+	var dataCheck = document.getElementById('dataCheck');
+	var rafCheck = document.getElementById('rafCheck');
+	var speedReadout = document.getElementById('speedReadout');
+	var dataSection = document.getElementById('dataSection');
+	var dataArea = document.getElementById('dataArea');
+	var dataButton = document.getElementById('dataButton');
+	var running = false;						// will be true when running
+	var stepCount = 0;
+	var startTime = 0;
+	var four9ths = 4.0 / 9.0;					// abbreviations
+	var one9th = 1.0 / 9.0;
+	var one36th = 1.0 / 36.0;
+	var barrierCount = 0;
+	var barrierxSum = 0;
+	var barrierySum = 0;
+	var barrierFx = 0.0;						// total force on all barrier sites
+	var barrierFy = 0.0;
+	var sensorX = xdim / 2;						// coordinates of "sensor" to measure local fluid properties	
+	var sensorY = ydim / 2;
+	var draggingSensor = false;
+	var mouseIsDown = false;
+	var mouseX, mouseY;							// mouse location in canvas coordinates
+	var oldMouseX = -1, oldMouseY = -1;			// mouse coordinates from previous simulation frame
+	var collectingData = false;
+	var time = 0;								// time (in simulation step units) since data collection started
+	var showingPeriod = false;
+	var lastBarrierFy = 1;						// for determining when F_y oscillation begins
+	var lastFyOscTime = 0;						// for calculating F_y oscillation period
+
+	canvas.addEventListener('mousedown', mouseDown, false);
+	canvas.addEventListener('mousemove', mouseMove, false);
+	document.body.addEventListener('mouseup', mouseUp, false);	// button release could occur outside canvas
+	canvas.addEventListener('touchstart', mouseDown, false);
+	canvas.addEventListener('touchmove', mouseMove, false);
+	document.body.addEventListener('touchend', mouseUp, false);
+
+	// Create the arrays of fluid particle densities, etc. (using 1D arrays for speed):
+	// To index into these arrays, use x + y*xdim, traversing rows first and then columns.
+	var n0 = new Array(xdim*ydim);			// microscopic densities along each lattice direction
+	var nN = new Array(xdim*ydim);
+	var nS = new Array(xdim*ydim);
+	var nE = new Array(xdim*ydim);
+	var nW = new Array(xdim*ydim);
+	var nNE = new Array(xdim*ydim);
+	var nSE = new Array(xdim*ydim);
+	var nNW = new Array(xdim*ydim);
+	var nSW = new Array(xdim*ydim);
+	var rho = new Array(xdim*ydim);			// macroscopic density
+	var ux = new Array(xdim*ydim);			// macroscopic velocity
+	var uy = new Array(xdim*ydim);
+	var curl = new Array(xdim*ydim);
+	var barrier = new Array(xdim * ydim); 	// boolean array of barrier locations
+	var odd = 1;
+
+	// Initialize to a steady rightward flow with no barriers:
+	for (var y=0; y<ydim; y++) {
+		for (var x=0; x<xdim; x++) {
+			barrier[x+y*xdim] = false;
+		}
+	}
+
+	// Create a simple linear "wall" barrier (intentionally a little offset from center):
+	var barrierSize = 8;
+	if (mobile) barrierSize = 4;
+	for (var y=(ydim/2)-barrierSize; y<=(ydim/2)+barrierSize; y++) {
+		var x = Math.round(ydim/3);
+		barrier[x+y*xdim] = true;
+	}
+
+	// Set up the array of colors for plotting (mimicks matplotlib "jet" colormap):
+	// (Kludge: Index nColors+1 labels the color used for drawing barriers.)
+	var nColors = 400;							// there are actually nColors+2 colors
+	var hexColorList = new Array(nColors+2);
+	var redList = new Array(nColors+2);
+	var greenList = new Array(nColors+2);
+	var blueList = new Array(nColors+2);
+	for (var c=0; c<=nColors; c++) {
+		var r, g, b;
+		if (c < nColors/8) {
+			r = 0; g = 0; b = Math.round(255 * (c + nColors/8) / (nColors/4));
+		} else if (c < 3*nColors/8) {
+			r = 0; g = Math.round(255 * (c - nColors/8) / (nColors/4)); b = 255;
+		} else if (c < 5*nColors/8) {
+			r = Math.round(255 * (c - 3*nColors/8) / (nColors/4)); g = 255; b = 255 - r;
+		} else if (c < 7*nColors/8) {
+			r = 255; g = Math.round(255 * (7*nColors/8 - c) / (nColors/4)); b = 0;
+		} else {
+			r = Math.round(255 * (9*nColors/8 - c) / (nColors/4)); g = 0; b = 0;
+		}
+		redList[c] = r; greenList[c] = g; blueList[c] = b;
+		hexColorList[c] = rgbToHex(r, g, b);
+	}
+	redList[nColors+1] = 0; greenList[nColors+1] = 0; blueList[nColors+1] = 0;	// barriers are black
+	hexColorList[nColors+1] = rgbToHex(0, 0, 0);
+
+	// Functions to convert rgb to hex color string (from stackoverflow):
+	function componentToHex(c) {
+		var hex = c.toString(16);
+		return hex.length == 1 ? "0" + hex : hex;
+	}
+	function rgbToHex(r, g, b) {
+		return "#" + componentToHex(r) + componentToHex(g) + componentToHex(b);
+	}
+
+	// Initialize array of partially transparant blacks, for drawing flow lines:
+	var transBlackArraySize = 50;
+	var transBlackArray = new Array(transBlackArraySize);
+	for (var i=0; i<transBlackArraySize; i++) {
+		transBlackArray[i] = "rgba(0,0,0," + Number(i/transBlackArraySize).toFixed(2) + ")";
+	}
+
+	// Initialize tracers (but don't place them yet):
+	var nTracers = 144;
+	var tracerX = new Array(nTracers);
+	var tracerY = new Array(nTracers);
+	for (var t=0; t<nTracers; t++) {
+		tracerX[t] = 0.0; tracerY[t] = 0.0;
+	}
+
+	initFluid();		// initialize to steady rightward flow
+
+	// Mysterious gymnastics that are apparently useful for better cross-browser animation timing:
+	window.requestAnimFrame = (function(callback) {
+		return 	window.requestAnimationFrame || 
+			window.webkitRequestAnimationFrame || 
+			window.mozRequestAnimationFrame || 
+			window.oRequestAnimationFrame || 
+			window.msRequestAnimationFrame ||
+			function(callback) {
+				window.setTimeout(callback, 1);		// second parameter is time in ms
+			};
+	})();
+
+	// Simulate function executes a bunch of steps and then schedules another call to itself:
+	function simulate() {
+		var stepsPerFrame = Number(stepsSlider.value);			// number of simulation steps per animation frame
+		setBoundaries();
+		// Test to see if we're dragging the fluid:
+		var pushing = false;
+		var pushX, pushY, pushUX, pushUY;
+		if (mouseIsDown && mouseSelect.selectedIndex==2) {
+			if (oldMouseX >= 0) {
+				var gridLoc = canvasToGrid(mouseX, mouseY);
+				pushX = gridLoc.x;
+				pushY = gridLoc.y;
+				pushUX = (mouseX - oldMouseX) / pxPerSquare / stepsPerFrame;
+				pushUY = -(mouseY - oldMouseY) / pxPerSquare / stepsPerFrame;	// y axis is flipped
+				if (Math.abs(pushUX) > 0.1) pushUX = 0.1 * Math.abs(pushUX) / pushUX;
+				if (Math.abs(pushUY) > 0.1) pushUY = 0.1 * Math.abs(pushUY) / pushUY;
+				pushing = true;
+			}
+			oldMouseX = mouseX; oldMouseY = mouseY;
+		} else {
+			oldMouseX = -1; oldMouseY = -1;
+		}
+		// Execute a bunch of time steps:
+		for (var step = 0; step < stepsPerFrame; step++) {
+		    setBoundaries();
+			collide();
+			//stream();
+			if (odd == 1) { odd = 0; }
+			else { odd = 1; }
+			if (tracerCheck.checked) moveTracers();
+			if (pushing) push(pushX, pushY, pushUX, pushUY);
+			time++;
+			if (showingPeriod && (barrierFy > 0) && (lastBarrierFy <=0)) {
+				var thisFyOscTime = time - barrierFy/(barrierFy-lastBarrierFy);	// interpolate when Fy changed sign
+				if (lastFyOscTime > 0) {
+					var period = thisFyOscTime - lastFyOscTime;
+					dataArea.innerHTML += Number(period).toFixed(2) + "\n";
+					dataArea.scrollTop = dataArea.scrollHeight;
+				}
+				lastFyOscTime = thisFyOscTime;
+			}
+			lastBarrierFy = barrierFy;
+		}
+		paintCanvas();
+		if (collectingData) {
+			writeData();
+			if (time >= 10000) startOrStopData();
+		}
+		if (running) {
+			stepCount += stepsPerFrame;
+			var elapsedTime = ((new Date()).getTime() - startTime) / 1000;	// time in seconds
+			speedReadout.innerHTML = Number(stepCount/elapsedTime).toFixed(0);
+		}
+		var stable = true;
+		for (var x=0; x<xdim; x++) {
+			var index = x + (ydim/2)*xdim;	// look at middle row only
+			if (rho[index] <= 0) stable = false;
+		}
+		if (!stable) {
+			window.alert("The simulation has become unstable due to excessive fluid speeds.");
+			startStop();
+			initFluid();
+		}
+		if (running) {
+			if (rafCheck.checked) {
+				requestAnimFrame(function() { simulate(); });	// let browser schedule next frame
+			} else {
+				window.setTimeout(simulate, 1);	// schedule next frame asap (nominally 1 ms but always more)
+			}
+		}
+	}
+
+	// Set the fluid variables at the boundaries, according to the current slider value:
+	function setBoundaries() {
+		var u0 = Number(speedSlider.value);
+		for (var x=0; x<xdim; x++) {
+			setEquil(x, 0, u0, 0, 1);
+			setEquil(x, ydim-1, u0, 0, 1);
+		}
+		for (var y=1; y<ydim-1; y++) {
+			setEquil(0, y, u0, 0, 1);
+			setEquil(xdim-1, y, u0, 0, 1);
+		}
+	}
+
+	// Collide particles within each cell (here's the physics!):
+	function collideOLD() {
+		var viscosity = Number(viscSlider.value);	// kinematic viscosity coefficient in natural units
+		var omega = 1 / (3*viscosity + 0.5);		// reciprocal of relaxation time
+		for (var y=1; y<ydim-1; y++) {
+			for (var x=1; x<xdim-1; x++) {
+				var i = x + y*xdim;		// array index for this lattice site
+				var thisrho = n0[i] + nN[i] + nS[i] + nE[i] + nW[i] + nNW[i] + nNE[i] + nSW[i] + nSE[i];
+				rho[i] = thisrho;
+				var thisux = (nE[i] + nNE[i] + nSE[i] - nW[i] - nNW[i] - nSW[i]) / thisrho;
+				ux[i] = thisux;
+				var thisuy = (nN[i] + nNE[i] + nNW[i] - nS[i] - nSE[i] - nSW[i]) / thisrho;
+				uy[i] = thisuy
+				var one9thrho = one9th * thisrho;		// pre-compute a bunch of stuff for optimization
+				var one36thrho = one36th * thisrho;
+				var ux3 = 3 * thisux;
+				var uy3 = 3 * thisuy;
+				var ux2 = thisux * thisux;
+				var uy2 = thisuy * thisuy;
+				var uxuy2 = 2 * thisux * thisuy;
+				var u2 = ux2 + uy2;
+				var u215 = 1.5 * u2;
+				n0[i]  += omega * (four9ths*thisrho * (1                        - u215) - n0[i]);
+				nE[i]  += omega * (   one9thrho * (1 + ux3       + 4.5*ux2        - u215) - nE[i]);
+				nW[i]  += omega * (   one9thrho * (1 - ux3       + 4.5*ux2        - u215) - nW[i]);
+				nN[i]  += omega * (   one9thrho * (1 + uy3       + 4.5*uy2        - u215) - nN[i]);
+				nS[i]  += omega * (   one9thrho * (1 - uy3       + 4.5*uy2        - u215) - nS[i]);
+				nNE[i] += omega * (  one36thrho * (1 + ux3 + uy3 + 4.5*(u2+uxuy2) - u215) - nNE[i]);
+				nSE[i] += omega * (  one36thrho * (1 + ux3 - uy3 + 4.5*(u2-uxuy2) - u215) - nSE[i]);
+				nNW[i] += omega * (  one36thrho * (1 - ux3 + uy3 + 4.5*(u2-uxuy2) - u215) - nNW[i]);
+				nSW[i] += omega * (  one36thrho * (1 - ux3 - uy3 + 4.5*(u2+uxuy2) - u215) - nSW[i]);
+			}
+		}
+		for (var y=1; y<ydim-2; y++) {
+			nW[xdim-1+y*xdim] = nW[xdim-2+y*xdim];		// at right end, copy left-flowing densities from next row to the left
+			nNW[xdim-1+y*xdim] = nNW[xdim-2+y*xdim];
+			nSW[xdim-1+y*xdim] = nSW[xdim-2+y*xdim];
+		}
+	}
+
+	///----------------------------Cumulants
+	function collide() {
+	    var viscosity = Number(viscSlider.value); // kinematic viscosity coefficient in natural units
+	    var omega = 1 / (3 * viscosity + 0.5); 	// reciprocal of relaxation time
+	    //var om3 = 9.0 * (8.0 - 6.0 * omega + omega * omega) / (36.0 - 18 * omega + 2 * omega * omega); //
+	    var om3 = 3.0 * (omega - 2.0) / (omega - 3.0);
+	    for (var y = 1; y < ydim - 1; y++) {
+	        for (var x = 1; x < xdim - 1; x++) {
+	            if (x > xdim - 5) { omega = 1; }
+	            //if (true)
+	          //  {//(!barrier[x+y*xdim]){
+	            else { omega = 1 / (3 * viscosity + 0.5); }
+	            if (!barrier[x+y*xdim]){
+	            var i = x + y * xdim; 	// array index for this lattice site
+	            var ix=(x+1)+ y*xdim;
+	            var iy=x+(y+1)*xdim;
+	            var ixy=(x+1)+(y+1)*xdim;
+var maa; 
+var mab; 
+var mac; 
+var mba; 
+var mbb; 
+var mbc; 
+var mca; 
+var mcb; 
+var mcc; 
+	            
+	            if(odd==1){
+	             maa = nSW[ixy];
+	             mab = nW[ix];
+	             mac = nNW[ix];
+	             mba = nS[iy];
+	             mbb = n0[i];
+	             mbc = nN[i];
+	             mca = nSE[iy];
+	             mcb = nE[i];
+	             mcc = nNE[i];
+	            }
+	            else
+	            {
+	             maa = nNE[ixy];
+	             mab = nE[ix];
+	             mac = nSE[ix];
+	             mba = nN[iy];
+	             mbb = n0[i];
+	             mbc = nS[i];
+	             mca = nNW[iy];
+	             mcb = nW[i];
+	             mcc = nSW[i];
+                }
+	            
+	            var thisrho = maa + mab + mac + mba + mbb + mbc + mca + mcb + mcc;
+	            rho[i] = thisrho;
+	            var thisux = (mca+mcb+mcc-maa-mab-mac) / thisrho;
+	            ux[i] = thisux;
+	            var thisuy = (mac+mbc+mcc-maa-mba-mca) / thisrho;
+	            uy[i] = thisuy;
+
+
+	            
+	            var n1=maa+mab+mac;
+                var n2=(-1-thisuy)*maa-thisuy*mab+(1-thisuy)*mac;
+                     mac=(-1-thisuy)*(-1-thisuy)*maa+thisuy*thisuy*mab+(1-thisuy)*(1-thisuy)*mac;
+                     maa=n1;
+                     mab=n2;
+
+
+                     n1=mba+mbb+mbc;
+                     n2=(-1-thisuy)*mba-thisuy*mbb+(1-thisuy)*mbc;
+                     mbc=(-1-thisuy)*(-1-thisuy)*mba+thisuy*thisuy*mbb+(1-thisuy)*(1-thisuy)*mbc;
+                     mba=n1;
+                     mbb=n2;
+
+
+                     n1=mca+mcb+mcc;
+                     n2=(-1-thisuy)*mca-thisuy*mcb+(1-thisuy)*mcc;
+                     mcc=(-1-thisuy)*(-1-thisuy)*mca+thisuy*thisuy*mcb+(1-thisuy)*(1-thisuy)*mcc;
+                     mca=n1;
+                     mcb=n2;
+///// y
+                     n1=maa+mba+mca;
+                     n2=(-1-thisux)*maa-thisux*mba+(1-thisux)*mca;
+                     mca=(-1-thisux)*(-1-thisux)*maa+thisux*thisux*mba+(1-thisux)*(1-thisux)*mca;
+                     maa=n1;
+                     mba=n2;
+
+                     n1=mab+mbb+mcb;
+                     n2=(-1-thisux)*mab-thisux*mbb+(1-thisux)*mcb;
+                     mcb=(-1-thisux)*(-1-thisux)*mab+thisux*thisux*mbb+(1-thisux)*(1-thisux)*mcb;
+                     mab=n1;
+                     mbb=n2;
+
+                     n1=mac+mbc+mcc;
+                     n2=(-1-thisux)*mac-thisux*mbc+(1-thisux)*mcc;
+                     mcc=(-1-thisux)*(-1-thisux)*mac+thisux*thisux*mbc+(1-thisux)*(1-thisux)*mcc;
+                     mac=n1;
+                     mbc=n2;
+	            //
+
+	            //----fast transform
+	            
+//	            var n1 = mcc + maa - mac - mca - thisux * thisuy / thisrho;
+//	            var n2;
+//	            //var pp = 2 * (mca + mac + maa + mcc) + mba + mbc + mab + mcb - (thisux * thisux + thisuy * thisuy) / thisrho;
+//	            var pxx = -mba - mbc + mab + mcb - (thisux * thisux - thisuy * thisuy) / thisrho;
+//	            maa = thisrho;
+//	            mba = 0;
+//	            mab = 0;
+//	            mbb = n1;
+
+	            //-----!FastTransform
+
+                     //now the collision:
+                     
+                     var pp=mac+mca;
+                     var pxx = mca - mac;
+                     var CUMcc = mcc - (mca * mac + 2 * mbb * mbb) / thisrho;
+
+                     //----
+                     var dxUx = (-0.5 * omega * (2 * mca - mac) - 0.5 * (mca + mac - maa)) / thisrho;
+                     var dyUy = (-0.5 * omega * (2 * mac - mca) - 0.5 * (mca + mac - maa)) / thisrho;
+                     //----
+
+                    // pp = thisrho/3.0*(dxUx*dxUx+dyUy*dyUy)+ 2.0 / 3.0 * thisrho; 
+                    // CUMcc = 0.0;
+                    // pxx =thisrho/3.0*(dxUx*dxUx-dyUy*dyUy)*omega-3*thisrho*(1.0-omega*0.5)*(thisux*thisux*dxUx-thisuy*thisuy*dyUy)+ pxx * (1.0 - omega);
+                    var om2=omega;//1.99;
+var quadLim = 0.01; //0.001/(0.01+uu+1.0e-9);			
+var limit1 = om2 + (1.0 - om2) * Math.abs(pp) / (Math.abs(pp) + 0.5); //4 Konstantin
+			pp=2.0/3.0*thisrho*limit1+(1.0-limit1)*pp;
+		     //pp =  2.0 / 3.0 * thisrho;
+                     pxx = -3*thisrho*(1.0-omega*0.5)*(thisux*thisux*dxUx-thisuy*thisuy*dyUy)+ pxx * (1.0 - omega);
+                     mbb = mbb * (1.0 - omega);
+                     mca = 0.5 * (pp + pxx);
+                     mac = 0.5 * (pp - pxx);
+                    //-----without limiter
+                    // mcb = 0.0; //mcb * (1.0 - om3);
+
+                    // mbc = 0.0; //mbc * (1.0 - om3);
+                     //---with limiter
+                     var uu = Math.sqrt(thisux * thisux + thisuy * thisuy);
+                     
+                     var limIT = om3 + (1.0 - om3) * Math.abs(mcb) / (Math.abs(mcb) + quadLim);
+                     mcb = mcb * (1.0 - limIT);
+                     limIT = om3 + (1.0 - om3) * Math.abs(mbc) / (Math.abs(mbc) + quadLim);
+                     mbc = mbc * (1.0 - limIT);
+                     //---!limiter
+                     
+                     mcc = /*CUMcc+ */  (mca * mac + 2 * mbb * mbb) / thisrho;
+
+
+                     ////x-Richtung
+
+                     n1 = (mcc + mac * (-1 + thisux) * thisux + mbc * (-1 + 2 * thisux)) * 0.5;
+                     n2 = mac - mcc - 2 * mbc * thisux - mac * thisux * thisux;
+                     mcc = (mbc + mcc + 2 * mbc * thisux + mac * thisux * (1 + thisux)) * 0.5;
+                     mac = n1;
+                     mbc = n2;
+
+                     n1 = (mcb + mab * (-1 + thisux) * thisux + mbb * (-1 + 2 * thisux)) * 0.5;
+                     n2 = mab - mcb - 2 * mbb * thisux - mab * thisux * thisux;
+                     mcb = (mbb + mcb + 2 * mbb * thisux + mab * thisux * (1 + thisux)) * 0.5;
+                     mab = n1;
+                     mbb = n2;
+
+                     n1 = (mca + maa * (-1 + thisux) * thisux + mba * (-1 + 2 * thisux)) * 0.5;
+                     n2 = maa - mca - 2 * mba * thisux - maa * thisux * thisux;
+                     mca = (mba + mca + 2 * mba * thisux + maa * thisux * (1 + thisux)) * 0.5;
+                     maa = n1;
+                     mba = n2;
+
+                     ////y-Richtung
+                     n1 = (mcc + mca * (-1 + thisuy) * thisuy + mcb * (-1 + 2 * thisuy)) * 0.5;
+                     n2 = mca - mcc - 2 * mcb * thisuy - mca * thisuy * thisuy;
+                     mcc = (mcb + mcc + 2 * mcb * thisuy + mca * thisuy * (1 + thisuy)) * 0.5;
+                     mca = n1;
+                     mcb = n2;
+
+                     n1 = (mbc + mba * (-1 + thisuy) * thisuy + mbb * (-1 + 2 * thisuy)) * 0.5;
+                     n2 = mba - mbc - 2 * mbb * thisuy - mba * thisuy * thisuy;
+                     mbc = (mbb + mbc + 2 * mbb * thisuy + mba * thisuy * (1 + thisuy)) * 0.5;
+                     mba = n1;
+                     mbb = n2;
+
+                     n1 = (mac + maa * (-1 + thisuy) * thisuy + mab * (-1 + 2 * thisuy)) * 0.5;
+                     n2 = maa - mac - 2 * mab * thisuy - maa * thisuy * thisuy;
+                     mac = (mab + mac + 2 * mab * thisuy + maa * thisuy * (1 + thisuy)) * 0.5;
+                     maa = n1;
+                     mab = n2;
+     
+	            
+	            if (odd==1){
+	            n0[i] =mbb;
+	            nW[ix] =mcb;
+	            nE[i] =mab;
+	            nS[iy] =mbc;
+	            nN[i] =mba;
+	            nSW[ixy]=mcc;
+	            nNW[ix]=mca;
+	            nSE[iy]=mac;
+	            nNE[i] = maa;
+	            
+	            }
+	            else{
+	            n0[i] =mbb;
+	            nE[ix] =mcb;
+	            nW[i] =mab;
+	            nN[iy] =mbc;
+	            nS[i] =mba;
+	            nNE[ixy]=mcc;
+	            nSE[ix]=mca;
+	            nNW[iy]=mac;
+	            nSW[i] = maa;
+	            
+	            }	            
+	        }
+	    }
+	    }
+	   // if (odd == 0) {
+	   //     for (var y = 1; y < ydim - 2; y++) {
+	          //     nE[xdim - 1 + y * xdim] = nE[xdim - 2 + y * xdim]; 	// at right end, copy left-flowing densities from next row to the left
+	          //     nNE[xdim - 1 + y * xdim] = nNE[xdim - 2 + y * xdim];
+	          //     nSE[xdim - 1 + y * xdim] = nSE[xdim - 2 + y * xdim];
+
+	             //  nW[1+y * xdim] += 0.0001 * 3;
+	             //  nWE[1+y * xdim] += 0.0001;
+	             //  nWS[1+y * xdim] += 0.0001; 
+	     //   }
+	    //}
+	    //else {
+	      //  for (var y = 1; y < ydim - 2; y++) {
+	            //   nW[xdim - 1 + y * xdim] = nW[xdim - 2 + y * xdim]; 	// at right end, copy left-flowing densities from next row to the left
+	            //   nNW[xdim - 1 + y * xdim] = nNW[xdim - 2 + y * xdim];
+	            //   nSW[xdim - 1 + y * xdim] = nSW[xdim - 2 + y * xdim];
+	        //}
+	    //}
+	    
+	}
+
+////------------------------------!Cumulants
+
+
+
+	// Move particles along their directions of motion:
+	function stream() {
+		barrierCount = 0; barrierxSum = 0; barrierySum = 0;
+		barrierFx = 0.0; barrierFy = 0.0;
+		for (var y=ydim-2; y>0; y--) {			// first start in NW corner...
+			for (var x=1; x<xdim-1; x++) {
+				nN[x+y*xdim] = nN[x+(y-1)*xdim];			// move the north-moving particles
+				nNW[x+y*xdim] = nNW[x+1+(y-1)*xdim];		// and the northwest-moving particles
+			}
+		}
+		for (var y=ydim-2; y>0; y--) {			// now start in NE corner...
+			for (var x=xdim-2; x>0; x--) {
+				nE[x+y*xdim] = nE[x-1+y*xdim];			// move the east-moving particles
+				nNE[x+y*xdim] = nNE[x-1+(y-1)*xdim];		// and the northeast-moving particles
+			}
+		}
+		for (var y=1; y<ydim-1; y++) {			// now start in SE corner...
+			for (var x=xdim-2; x>0; x--) {
+				nS[x+y*xdim] = nS[x+(y+1)*xdim];			// move the south-moving particles
+				nSE[x+y*xdim] = nSE[x-1+(y+1)*xdim];		// and the southeast-moving particles
+			}
+		}
+		for (var y=1; y<ydim-1; y++) {				// now start in the SW corner...
+			for (var x=1; x<xdim-1; x++) {
+				nW[x+y*xdim] = nW[x+1+y*xdim];			// move the west-moving particles
+				nSW[x+y*xdim] = nSW[x+1+(y+1)*xdim];		// and the southwest-moving particles
+			}
+		}
+		for (var y=1; y<ydim-1; y++) {				// Now handle bounce-back from barriers
+			for (var x=1; x<xdim-1; x++) {
+				if (barrier[x+y*xdim]) {
+					var index = x + y*xdim;
+					nE[x+1+y*xdim] = nW[index];
+					nW[x-1+y*xdim] = nE[index];
+					nN[x+(y+1)*xdim] = nS[index];
+					nS[x+(y-1)*xdim] = nN[index];
+					nNE[x+1+(y+1)*xdim] = nSW[index];
+					nNW[x-1+(y+1)*xdim] = nSE[index];
+					nSE[x+1+(y-1)*xdim] = nNW[index];
+					nSW[x-1+(y-1)*xdim] = nNE[index];
+					// Keep track of stuff needed to plot force vector:
+					barrierCount++;
+					barrierxSum += x;
+					barrierySum += y;
+					barrierFx += nE[index] + nNE[index] + nSE[index] - nW[index] - nNW[index] - nSW[index];
+					barrierFy += nN[index] + nNE[index] + nNW[index] - nS[index] - nSE[index] - nSW[index];
+				}
+			}
+		}
+	}
+
+	// Move the tracer particles:
+	function moveTracers() {
+		for (var t=0; t<nTracers; t++) {
+			var roundedX = Math.round(tracerX[t]);
+			var roundedY = Math.round(tracerY[t]);
+			var index = roundedX + roundedY*xdim;
+			tracerX[t] += ux[index];
+			tracerY[t] += uy[index];
+			if (tracerX[t] > xdim-1) {
+				tracerX[t] = 0;
+				tracerY[t] = Math.random() * ydim;
+			}
+		}
+	}
+
+	// "Drag" the fluid in a direction determined by the mouse (or touch) motion:
+	// (The drag affects a "circle", 5 px in diameter, centered on the given coordinates.)
+	function push(pushX, pushY, pushUX, pushUY) {
+		// First make sure we're not too close to edge:
+		var margin = 3;
+		if ((pushX > margin) && (pushX < xdim-1-margin) && (pushY > margin) && (pushY < ydim-1-margin)) {
+			for (var dx=-1; dx<=1; dx++) {
+				setEquil(pushX+dx, pushY+2, pushUX, pushUY);
+				setEquil(pushX+dx, pushY-2, pushUX, pushUY);
+			}
+			for (var dx=-2; dx<=2; dx++) {
+				for (var dy=-1; dy<=1; dy++) {
+					setEquil(pushX+dx, pushY+dy, pushUX, pushUY);
+				}
+			}
+		}
+	}
+
+	// Set all densities in a cell to their equilibrium values for a given velocity and density:
+	// (If density is omitted, it's left unchanged.)
+	function setEquil(x, y, newux, newuy, newrho) {
+	    var i = x + y * xdim;
+	    var ix = (x + 1) + y * xdim;
+	    var iy = x + (y + 1) * xdim;
+	    var ixy = (x + 1) + (y + 1) * xdim;
+
+		if (typeof newrho == 'undefined') {
+			newrho = rho[i];
+		}
+		var ux3 = 3 * newux;
+		var uy3 = 3 * newuy;
+		var ux2 = newux * newux;
+		var uy2 = newuy * newuy;
+		var uxuy2 = 2 * newux * newuy;
+		var u2 = ux2 + uy2;
+		var u215 = 1.5 * u2;
+		if (odd == 0) {
+		    n0[i] = four9ths * newrho * (1 - u215);
+		    nW[ix] = one9th * newrho * (1 + ux3 + 4.5 * ux2 - u215);
+		    nE[i] = one9th * newrho * (1 - ux3 + 4.5 * ux2 - u215);
+		    nS[iy] = one9th * newrho * (1 + uy3 + 4.5 * uy2 - u215);
+		    nN[i] = one9th * newrho * (1 - uy3 + 4.5 * uy2 - u215);
+		    nSW[ixy] = one36th * newrho * (1 + ux3 + uy3 + 4.5 * (u2 + uxuy2) - u215);
+		    nNW[ix] = one36th * newrho * (1 + ux3 - uy3 + 4.5 * (u2 - uxuy2) - u215);
+		    nSE[iy] = one36th * newrho * (1 - ux3 + uy3 + 4.5 * (u2 - uxuy2) - u215);
+		    nNE[i] = one36th * newrho * (1 - ux3 - uy3 + 4.5 * (u2 + uxuy2) - u215);
+		    rho[i] = newrho;
+		    ux[i] = newux;
+		    uy[i] = newuy;
+		}
+		else {
+		    n0[i] = four9ths * newrho * (1 - u215);
+		    nE[ix] = one9th * newrho * (1 + ux3 + 4.5 * ux2 - u215);
+		    nW[i] = one9th * newrho * (1 - ux3 + 4.5 * ux2 - u215);
+		    nN[iy] = one9th * newrho * (1 + uy3 + 4.5 * uy2 - u215);
+		    nS[i] = one9th * newrho * (1 - uy3 + 4.5 * uy2 - u215);
+		    nNE[ixy] = one36th * newrho * (1 + ux3 + uy3 + 4.5 * (u2 + uxuy2) - u215);
+		    nSE[ix] = one36th * newrho * (1 + ux3 - uy3 + 4.5 * (u2 - uxuy2) - u215);
+		    nNW[iy] = one36th * newrho * (1 - ux3 + uy3 + 4.5 * (u2 - uxuy2) - u215);
+		    nSW[i] = one36th * newrho * (1 - ux3 - uy3 + 4.5 * (u2 + uxuy2) - u215);
+		    rho[i] = newrho;
+		    ux[i] = newux;
+		    uy[i] = newuy;
+		
+		}
+	}
+
+	// Initialize the tracer particles:
+	function initTracers() {
+		if (tracerCheck.checked) {
+			var nRows = Math.ceil(Math.sqrt(nTracers));
+			var dx = xdim / nRows;
+			var dy = ydim / nRows;
+			var nextX = dx / 2;
+			var nextY = dy / 2;
+			for (var t=0; t<nTracers; t++) {
+				tracerX[t] = nextX;
+				tracerY[t] = nextY;
+				nextX += dx;
+				if (nextX > xdim) {
+					nextX = dx / 2;
+					nextY += dy;
+				}
+			}
+		}
+		paintCanvas();
+	}
+
+	// Paint the canvas:
+	function paintCanvas() {
+		var cIndex=0;
+		var contrast = Math.pow(1.2,Number(contrastSlider.value));
+		var plotType = plotSelect.selectedIndex;
+		//var pixelGraphics = pixelCheck.checked;
+		if (plotType == 4) computeCurl();
+		for (var y=0; y<ydim; y++) {
+			for (var x=0; x<xdim; x++) {
+				if (barrier[x+y*xdim]) {
+					cIndex = nColors + 1;	// kludge for barrier color which isn't really part of color map
+				} else {
+					if (plotType == 0) {
+						cIndex = Math.round(nColors * ((rho[x+y*xdim]-1)*6*contrast + 0.5));
+					} else if (plotType == 1) {
+						cIndex = Math.round(nColors * (ux[x+y*xdim]*2*contrast + 0.5));
+					} else if (plotType == 2) {
+						cIndex = Math.round(nColors * (uy[x+y*xdim]*2*contrast + 0.5));
+					} else if (plotType == 3) {
+						var speed = Math.sqrt(ux[x+y*xdim]*ux[x+y*xdim] + uy[x+y*xdim]*uy[x+y*xdim]);
+						cIndex = Math.round(nColors * (speed*4*contrast));
+					} else {
+						cIndex = Math.round(nColors * (curl[x+y*xdim]*5*contrast + 0.5));
+					}
+					if (cIndex < 0) cIndex = 0;
+					if (cIndex > nColors) cIndex = nColors;
+				}
+				//if (pixelGraphics) {
+					//colorSquare(x, y, cIndex);
+				colorSquare(x, y, redList[cIndex], greenList[cIndex], blueList[cIndex]);
+				//} else {
+				//	context.fillStyle = hexColorList[cIndex];
+				//	context.fillRect(x*pxPerSquare, (ydim-y-1)*pxPerSquare, pxPerSquare, pxPerSquare);
+				//}
+			}
+		}
+		//if (pixelGraphics) 
+		context.putImageData(image, 0, 0);		// blast image to the screen
+		// Draw tracers, force vector, and/or sensor if appropriate:
+		if (tracerCheck.checked) drawTracers();
+		if (flowlineCheck.checked) drawFlowlines();
+		if (forceCheck.checked) drawForceArrow(barrierxSum/barrierCount, barrierySum/barrierCount, barrierFx, barrierFy);
+		if (sensorCheck.checked) drawSensor();
+	}
+
+	// Color a grid square in the image data array, one pixel at a time (rgb each in range 0 to 255):
+	function colorSquare(x, y, r, g, b) {
+	//function colorSquare(x, y, cIndex) {		// for some strange reason, this version is quite a bit slower on Chrome
+		//var r = redList[cIndex];
+		//var g = greenList[cIndex];
+		//var b = blueList[cIndex];
+		var flippedy = ydim - y - 1;			// put y=0 at the bottom
+		for (var py=flippedy*pxPerSquare; py<(flippedy+1)*pxPerSquare; py++) {
+			for (var px=x*pxPerSquare; px<(x+1)*pxPerSquare; px++) {
+				var index = (px + py*image.width) * 4;
+				image.data[index+0] = r;
+				image.data[index+1] = g;
+				image.data[index+2] = b;
+			}
+		}
+	}
+
+	// Compute the curl (actually times 2) of the macroscopic velocity field, for plotting:
+	function computeCurl() {
+		for (var y=1; y<ydim-1; y++) {			// interior sites only; leave edges set to zero
+			for (var x=1; x<xdim-1; x++) {
+				curl[x+y*xdim] = uy[x+1+y*xdim] - uy[x-1+y*xdim] - ux[x+(y+1)*xdim] + ux[x+(y-1)*xdim];
+			}
+		}
+	}
+
+	// Draw the tracer particles:
+	function drawTracers() {
+		context.fillStyle = "rgb(150,150,150)";
+		for (var t=0; t<nTracers; t++) {
+			var canvasX = (tracerX[t]+0.5) * pxPerSquare;
+			var canvasY = canvas.height - (tracerY[t]+0.5) * pxPerSquare;
+			context.fillRect(canvasX-1, canvasY-1, 2, 2);
+		}
+	}
+
+	// Draw a grid of short line segments along flow directions:
+	function drawFlowlines() {
+		var pxPerFlowline = 10;
+		if (pxPerSquare == 1) pxPerFlowline = 6;
+		if (pxPerSquare == 2) pxPerFlowline = 8;
+		if (pxPerSquare == 5) pxPerFlowline = 12;
+		if ((pxPerSquare == 6) || (pxPerSquare == 8)) pxPerFlowline = 15;
+		if (pxPerSquare == 10) pxPerFlowline = 20;
+		var sitesPerFlowline = pxPerFlowline / pxPerSquare;
+		var xLines = canvas.width / pxPerFlowline;
+		var yLines = canvas.height / pxPerFlowline;
+		for (var yCount=0; yCount<yLines; yCount++) {
+			for (var xCount=0; xCount<xLines; xCount++) {
+				var x = Math.round((xCount+0.5) * sitesPerFlowline);
+				var y = Math.round((yCount+0.5) * sitesPerFlowline);
+				var thisUx = ux[x+y*xdim];
+				var thisUy = uy[x+y*xdim];
+				var speed = Math.sqrt(thisUx*thisUx + thisUy*thisUy);
+				if (speed > 0.0001) {
+					var px = (xCount+0.5) * pxPerFlowline;
+					var py = canvas.height - ((yCount+0.5) * pxPerFlowline);
+					var scale = 0.5 * pxPerFlowline / speed;
+					context.beginPath();
+					context.moveTo(px-thisUx*scale, py+thisUy*scale);
+					context.lineTo(px+thisUx*scale, py-thisUy*scale);
+					//context.lineWidth = speed * 5;
+					var cIndex = Math.round(speed * transBlackArraySize / 0.3);
+					if (cIndex >= transBlackArraySize) cIndex = transBlackArraySize - 1;
+					context.strokeStyle = transBlackArray[cIndex];
+					//context.strokeStyle = "rgba(0,0,0,0.1)";
+					context.stroke();
+				}
+			}
+		}
+	}
+
+	// Draw an arrow to represent the total force on the barrier(s):
+	function drawForceArrow(x, y, Fx, Fy) {
+		context.fillStyle = "rgba(100,100,100,0.7)";
+		context.translate((x + 0.5) * pxPerSquare, canvas.height - (y + 0.5) * pxPerSquare);
+		var magF = Math.sqrt(Fx*Fx + Fy*Fy);
+		context.scale(4*magF, 4*magF);
+		context.rotate(Math.atan2(-Fy, Fx));
+		context.beginPath();
+		context.moveTo(0, 3);
+		context.lineTo(100, 3);
+		context.lineTo(100, 12);
+		context.lineTo(130, 0);
+		context.lineTo(100, -12);
+		context.lineTo(100, -3);
+		context.lineTo(0, -3);
+		context.lineTo(0, 3);
+		context.fill();
+		context.setTransform(1, 0, 0, 1, 0, 0);
+	}
+
+	// Draw the sensor and its associated data display:
+	function drawSensor() {
+		var canvasX = (sensorX+0.5) * pxPerSquare;
+		var canvasY = canvas.height - (sensorY+0.5) * pxPerSquare;
+		context.fillStyle = "rgba(180,180,180,0.7)";	// first draw gray filled circle
+		context.beginPath();
+		context.arc(canvasX, canvasY, 7, 0, 2*Math.PI);
+		context.fill();
+		context.strokeStyle = "#404040";				// next draw cross-hairs
+		context.linewidth = 1;
+		context.beginPath();
+		context.moveTo(canvasX, canvasY-10);
+		context.lineTo(canvasX, canvasY+10);
+		context.moveTo(canvasX-10, canvasY);
+		context.lineTo(canvasX+10, canvasY);
+		context.stroke();
+		context.fillStyle = "rgba(255,255,255,0.5)";	// draw rectangle behind text
+		canvasX += 10;
+		context.font = "12px Monospace";
+		var rectWidth = context.measureText("00000000000").width+6;
+		var rectHeight = 58;
+		if (canvasX+rectWidth > canvas.width) canvasX -= (rectWidth+20);
+		if (canvasY+rectHeight > canvas.height) canvasY = canvas.height - rectHeight;
+		context.fillRect(canvasX, canvasY, rectWidth, rectHeight);
+		context.fillStyle = "#000000";					// finally draw the text
+		canvasX += 3;
+		canvasY += 12;
+		var coordinates = "  (" + sensorX + "," + sensorY + ")";
+		context.fillText(coordinates, canvasX, canvasY);
+		canvasY += 14;
+		var rhoSymbol = String.fromCharCode(parseInt('03C1',16));
+		var index = sensorX + sensorY * xdim;
+		context.fillText(" " + rhoSymbol + " =  " + Number(rho[index]).toFixed(3), canvasX, canvasY);
+		canvasY += 14;
+		var digitString = Number(ux[index]).toFixed(3);
+		if (ux[index] >= 0) digitString = " " + digitString;
+		context.fillText("ux = " + digitString, canvasX, canvasY);
+		canvasY += 14;
+		digitString = Number(uy[index]).toFixed(3);
+		if (uy[index] >= 0) digitString = " " + digitString;
+		context.fillText("uy = " + digitString, canvasX, canvasY);
+	}
+
+	// Functions to handle mouse/touch interaction:
+	function mouseDown(e) {
+		if (sensorCheck.checked) {
+			var canvasLoc = pageToCanvas(e.pageX, e.pageY);
+			var gridLoc = canvasToGrid(canvasLoc.x, canvasLoc.y);
+			var dx = (gridLoc.x - sensorX) * pxPerSquare;
+			var dy = (gridLoc.y - sensorY) * pxPerSquare;
+			if (Math.sqrt(dx*dx + dy*dy) <= 8) {
+				draggingSensor = true;
+			}
+		}
+		mousePressDrag(e);
+	};
+	function mouseMove(e) {
+		if (mouseIsDown) {
+			mousePressDrag(e);
+		}
+	};
+	function mouseUp(e) {
+		mouseIsDown = false;
+		draggingSensor = false;
+	};
+
+	// Handle mouse press or drag:
+	function mousePressDrag(e) {
+		e.preventDefault();
+		mouseIsDown = true;
+		var canvasLoc = pageToCanvas(e.pageX, e.pageY);
+		if (draggingSensor) {
+			var gridLoc = canvasToGrid(canvasLoc.x, canvasLoc.y);
+			sensorX = gridLoc.x;
+			sensorY = gridLoc.y;
+			paintCanvas();
+			return;
+		}
+		if (mouseSelect.selectedIndex == 2) {
+			mouseX = canvasLoc.x;
+			mouseY = canvasLoc.y;
+			return;
+		}
+		var gridLoc = canvasToGrid(canvasLoc.x, canvasLoc.y);
+		if (mouseSelect.selectedIndex == 0) {
+			addBarrier(gridLoc.x, gridLoc.y);
+			paintCanvas();
+		} else {
+			removeBarrier(gridLoc.x, gridLoc.y);
+		}
+	}
+
+	// Convert page coordinates to canvas coordinates:
+	function pageToCanvas(pageX, pageY) {
+		var canvasX = pageX - canvas.offsetLeft;
+		var canvasY = pageY - canvas.offsetTop;
+		// this simple subtraction may not work when the canvas is nested in other elements
+		return { x:canvasX, y:canvasY };
+	}
+
+	// Convert canvas coordinates to grid coordinates:
+	function canvasToGrid(canvasX, canvasY) {
+		var gridX = Math.floor(canvasX / pxPerSquare);
+		var gridY = Math.floor((canvas.height - 1 - canvasY) / pxPerSquare); 	// off by 1?
+		return { x:gridX, y:gridY };
+	}
+
+	// Add a barrier at a given grid coordinate location:
+	function addBarrier(x, y) {
+		if ((x > 1) && (x < xdim-2) && (y > 1) && (y < ydim-2)) {
+			barrier[x+y*xdim] = true;
+		}
+	}
+
+	// Remove a barrier at a given grid coordinate location:
+	function removeBarrier(x, y) {
+		if (barrier[x+y*xdim]) {
+			barrier[x+y*xdim] = false;
+			paintCanvas();
+		}
+	}
+
+	// Clear all barriers:
+	function clearBarriers() {
+		for (var x=0; x<xdim; x++) {
+			for (var y=0; y<ydim; y++) {
+				barrier[x+y*xdim] = false;
+			}
+		}
+		paintCanvas();
+	}
+
+	// Resize the grid:
+	function resize() {
+		// First up-sample the macroscopic variables into temporary arrays at max resolution:
+		var tempRho = new Array(canvas.width*canvas.height);
+		var tempUx = new Array(canvas.width*canvas.height);
+		var tempUy = new Array(canvas.width*canvas.height);
+		var tempBarrier = new Array(canvas.width*canvas.height);
+		for (var y=0; y<canvas.height; y++) {
+			for (var x=0; x<canvas.width; x++) {
+				var tempIndex = x + y*canvas.width;
+				var xOld = Math.floor(x / pxPerSquare);
+				var yOld = Math.floor(y / pxPerSquare);
+				var oldIndex = xOld + yOld*xdim;
+				tempRho[tempIndex] = rho[oldIndex];
+				tempUx[tempIndex] = ux[oldIndex];
+				tempUy[tempIndex] = uy[oldIndex];
+				tempBarrier[tempIndex] = barrier[oldIndex];
+			}
+		}
+		// Get new size from GUI selector:
+		var oldPxPerSquare = pxPerSquare;
+		pxPerSquare = Number(sizeSelect.options[sizeSelect.selectedIndex].value);
+		var growRatio = oldPxPerSquare / pxPerSquare;
+		xdim = canvas.width / pxPerSquare;
+		ydim = canvas.height / pxPerSquare;
+		// Create new arrays at the desired resolution:
+		n0 = new Array(xdim*ydim);
+		nN = new Array(xdim*ydim);
+		nS = new Array(xdim*ydim);
+		nE = new Array(xdim*ydim);
+		nW = new Array(xdim*ydim);
+		nNE = new Array(xdim*ydim);
+		nSE = new Array(xdim*ydim);
+		nNW = new Array(xdim*ydim);
+		nSW = new Array(xdim*ydim);
+		rho = new Array(xdim*ydim);
+		ux = new Array(xdim*ydim);
+		uy = new Array(xdim*ydim);
+		curl = new Array(xdim*ydim);
+		barrier = new Array(xdim*ydim);
+		// Down-sample the temporary arrays into the new arrays:
+		for (var yNew=0; yNew<ydim; yNew++) {
+			for (var xNew=0; xNew<xdim; xNew++) {
+				var rhoTotal = 0;
+				var uxTotal = 0;
+				var uyTotal = 0;
+				var barrierTotal = 0;
+				for (var y=yNew*pxPerSquare; y<(yNew+1)*pxPerSquare; y++) {
+					for (var x=xNew*pxPerSquare; x<(xNew+1)*pxPerSquare; x++) {
+						var index = x + y*canvas.width;
+						rhoTotal += tempRho[index];
+						uxTotal += tempUx[index];
+						uyTotal += tempUy[index];
+						if (tempBarrier[index]) barrierTotal++;
+					}
+				}
+				setEquil(xNew, yNew, uxTotal/(pxPerSquare*pxPerSquare), uyTotal/(pxPerSquare*pxPerSquare), rhoTotal/(pxPerSquare*pxPerSquare))
+				curl[xNew+yNew*xdim] = 0.0;
+				barrier[xNew+yNew*xdim] = (barrierTotal >= pxPerSquare*pxPerSquare/2);
+			}
+		}
+		setBoundaries();
+		if (tracerCheck.checked) {
+			for (var t=0; t<nTracers; t++) {
+				tracerX[t] *= growRatio;
+				tracerY[t] *= growRatio;
+			}
+		}
+		sensorX = Math.round(sensorX * growRatio);
+		sensorY = Math.round(sensorY * growRatio);
+		//computeCurl();
+		paintCanvas();
+		resetTimer();
+	}
+
+	// Function to initialize or re-initialize the fluid, based on speed slider setting:
+	function initFluid() {
+		// Amazingly, if I nest the y loop inside the x loop, Firefox slows down by a factor of 20
+		var u0 = Number(speedSlider.value);
+		for (var y=0; y<ydim; y++) {
+			for (var x=0; x<xdim; x++) {
+				setEquil(x, y, u0, 0, 1);
+				curl[x+y*xdim] = 0.0;
+			}
+		}
+	paintCanvas();
+	}
+
+	// Function to start or pause the simulation:
+	function startStop() {
+		running = !running;
+		if (running) {
+			startButton.value = "Pause";
+			resetTimer();
+			simulate();
+		} else {
+			startButton.value = " Run ";
+		}
+	}
+
+	// Reset the timer that handles performance evaluation:
+	function resetTimer() {
+		stepCount = 0;
+		startTime = (new Date()).getTime();
+	}
+
+	// Show value of flow speed setting:
+	function adjustSpeed() {
+		speedValue.innerHTML = Number(speedSlider.value).toFixed(3);
+	}
+
+	// Show value of viscosity:
+	function adjustViscosity() {
+		viscValue.innerHTML = Number(viscSlider.value);//.toFixed(6);
+	}
+
+	// Show or hide the data area:
+	function showData() {
+		if (dataCheck.checked) {
+			dataSection.style.display="block";
+		} else {
+			dataSection.style.display="none";
+		}
+	}
+
+	// Start or stop collecting data:
+	function startOrStopData() {
+		collectingData = !collectingData;
+		if (collectingData) {
+			time = 0;
+			dataArea.innerHTML = "Time \tDensity\tVel_x \tVel_y \tForce_x\tForce_y\n";
+			writeData();
+			dataButton.value = "Stop data collection";
+			showingPeriod = false;
+			periodButton.value = "Show F_y period";
+		} else {
+			dataButton.value = "Start data collection";
+		}
+	}
+
+	// Write one line of data to the data area:
+	function writeData() {
+		var timeString = String(time);
+		while (timeString.length < 5) timeString = "0" + timeString;
+		sIndex = sensorX + sensorY*xdim;
+		dataArea.innerHTML += timeString + "\t" + Number(rho[sIndex]).toFixed(4) + "\t"
+			+ Number(ux[sIndex]).toFixed(4) + "\t" + Number(uy[sIndex]).toFixed(4) + "\t"
+			+ Number(barrierFx).toFixed(4) + "\t" + Number(barrierFy).toFixed(4) + "\n";
+		dataArea.scrollTop = dataArea.scrollHeight;
+	}
+
+	// Handle click to "show period" button
+	function showPeriod() {
+		showingPeriod = !showingPeriod;
+		if (showingPeriod) {
+			time = 0;
+			lastBarrierFy = 1.0;	// arbitrary positive value
+			lastFyOscTime = -1.0;	// arbitrary negative value
+			dataArea.innerHTML = "Period of F_y oscillation\n";
+			periodButton.value = "Stop data";
+			collectingData = false;
+			dataButton.value = "Start data collection";
+		} else {
+			periodButton.value = "Show F_y period";
+		}
+	}
+
+	// Write all the barrier locations to the data area:
+	function showBarrierLocations() {
+		dataArea.innerHTML = '{name:"Barrier locations",\n';
+		dataArea.innerHTML += 'locations:[\n';
+		for (var y=1; y<ydim-1; y++) {
+			for (var x=1; x<xdim-1; x++) {
+				if (barrier[x+y*xdim]) dataArea.innerHTML += x + ',' + y + ',\n';
+			}
+		}
+		dataArea.innerHTML = dataArea.innerHTML.substr(0, dataArea.innerHTML.length-2); // remove final comma
+		dataArea.innerHTML += '\n]},\n';
+	}
+
+	// Place a preset barrier:
+	function placePresetBarrier() {
+		var index = barrierSelect.selectedIndex;
+		if (index == 0) return;
+		clearBarriers();
+		var bCount = barrierList[index-1].locations.length/2;	// number of barrier sites
+		// To decide where to place it, find minimum x and min/max y:
+		var xMin = barrierList[index-1].locations[0];
+		var yMin = barrierList[index-1].locations[1];
+		var yMax = yMin;
+		for (var siteIndex=2; siteIndex<2*bCount; siteIndex+=2) {
+			if (barrierList[index-1].locations[siteIndex] < xMin) {
+				xMin = barrierList[index-1].locations[siteIndex];
+			}
+			if (barrierList[index-1].locations[siteIndex+1] < yMin) {
+				yMin = barrierList[index-1].locations[siteIndex+1];
+			}
+			if (barrierList[index-1].locations[siteIndex+1] > yMax) {
+				yMax = barrierList[index-1].locations[siteIndex+1];
+			}
+		}
+		var yAverage = Math.round((yMin+yMax)/2);
+		// Now place the barriers:
+		for (var siteIndex=0; siteIndex<2*bCount; siteIndex+=2) {
+			var x = barrierList[index-1].locations[siteIndex] - xMin + Math.round(ydim/3);
+			var y = barrierList[index-1].locations[siteIndex+1] - yAverage + Math.round(ydim/2);
+			addBarrier(x, y);
+		}
+		paintCanvas();
+		barrierSelect.selectedIndex = 0;	// A choice on this menu is a one-time action, not an ongoing setting
+	}
+
+	// Print debugging data:
+	function debug() {
+		dataArea.innerHTML = "Tracer locations:\n";
+		for (var t=0; t<nTracers; t++) {
+			dataArea.innerHTML += tracerX[t] + ", " + tracerY[t] + "\n";
+		}
+	}
+</script>
+    
+</body>
 </html>
\ No newline at end of file
diff --git a/3rdParty/WebDemo/barrierdata.js b/3rdParty/WebDemo/barrierdata.js
index 40c153ee80243fcef14d3c7efd0e66e79a9da42d..c165530d7dbc4b7b07d3e7a3f6703b180c38cbce 100644
--- a/3rdParty/WebDemo/barrierdata.js
+++ b/3rdParty/WebDemo/barrierdata.js
@@ -1,655 +1,655 @@
-var barrierList = [
-{ name: "Short line",
-    locations: [
-12, 15,
-12, 16,
-12, 17,
-12, 18,
-12, 19,
-12, 20,
-12, 21,
-12, 22,
-12, 23]
-},
-{ name: "Long line",
-    locations: [
-13, 11,
-13, 12,
-13, 13,
-13, 14,
-13, 15,
-13, 16,
-13, 17,
-13, 18,
-13, 19,
-13, 20,
-13, 21,
-13, 22,
-13, 23,
-13, 24,
-13, 25,
-13, 26,
-13, 27,
-13, 28
-]
-},
-{ name: "Diagonal",
-    locations: [
-30, 14,
-29, 15,
-30, 15,
-28, 16,
-29, 16,
-27, 17,
-28, 17,
-26, 18,
-27, 18,
-25, 19,
-26, 19,
-24, 20,
-25, 20,
-23, 21,
-24, 21,
-22, 22,
-23, 22,
-21, 23,
-22, 23,
-20, 24,
-21, 24,
-19, 25,
-20, 25,
-18, 26,
-19, 26,
-17, 27,
-18, 27,
-16, 28,
-17, 28,
-15, 29,
-16, 29,
-14, 30,
-15, 30,
-13, 31,
-14, 31
-]
-},
-{ name: "Shallow diagonal",
-    locations: [
-47, 18,
-48, 18,
-49, 18,
-50, 18,
-44, 19,
-45, 19,
-46, 19,
-47, 19,
-41, 20,
-42, 20,
-43, 20,
-44, 20,
-38, 21,
-39, 21,
-40, 21,
-41, 21,
-35, 22,
-36, 22,
-37, 22,
-38, 22,
-32, 23,
-33, 23,
-34, 23,
-35, 23,
-29, 24,
-30, 24,
-31, 24,
-32, 24,
-26, 25,
-27, 25,
-28, 25,
-29, 25,
-23, 26,
-24, 26,
-25, 26,
-26, 26,
-20, 27,
-21, 27,
-22, 27,
-23, 27,
-17, 28,
-18, 28,
-19, 28,
-20, 28
-]
-},
-{ name: "Small circle",
-    locations: [
-14, 11,
-15, 11,
-16, 11,
-17, 11,
-18, 11,
-13, 12,
-14, 12,
-18, 12,
-19, 12,
-12, 13,
-13, 13,
-19, 13,
-20, 13,
-12, 14,
-20, 14,
-12, 15,
-20, 15,
-12, 16,
-20, 16,
-12, 17,
-13, 17,
-19, 17,
-20, 17,
-13, 18,
-14, 18,
-18, 18,
-19, 18,
-14, 19,
-15, 19,
-16, 19,
-17, 19,
-18, 19
-]
-},
-{ name: "Large circle",
-    locations: [
-19, 11,
-20, 11,
-21, 11,
-22, 11,
-23, 11,
-24, 11,
-17, 12,
-18, 12,
-19, 12,
-24, 12,
-25, 12,
-26, 12,
-16, 13,
-17, 13,
-26, 13,
-27, 13,
-15, 14,
-16, 14,
-27, 14,
-28, 14,
-14, 15,
-15, 15,
-28, 15,
-29, 15,
-14, 16,
-29, 16,
-13, 17,
-14, 17,
-29, 17,
-30, 17,
-13, 18,
-30, 18,
-13, 19,
-30, 19,
-13, 20,
-30, 20,
-13, 21,
-30, 21,
-13, 22,
-14, 22,
-29, 22,
-30, 22,
-14, 23,
-29, 23,
-14, 24,
-15, 24,
-28, 24,
-29, 24,
-15, 25,
-16, 25,
-27, 25,
-28, 25,
-16, 26,
-17, 26,
-26, 26,
-27, 26,
-17, 27,
-18, 27,
-19, 27,
-24, 27,
-25, 27,
-26, 27,
-19, 28,
-20, 28,
-21, 28,
-22, 28,
-23, 28,
-24, 28
-]
-},
-{ name: "Line with spoiler",
-    locations: [
-16, 20,
-16, 21,
-16, 22,
-16, 23,
-16, 24,
-17, 24,
-18, 24,
-19, 24,
-20, 24,
-21, 24,
-22, 24,
-23, 24,
-24, 24,
-25, 24,
-26, 24,
-27, 24,
-28, 24,
-29, 24,
-30, 24,
-31, 24,
-32, 24,
-33, 24,
-34, 24,
-35, 24,
-36, 24,
-37, 24,
-38, 24,
-39, 24,
-40, 24,
-41, 24,
-42, 24,
-43, 24,
-44, 24,
-45, 24,
-46, 24,
-47, 24,
-48, 24,
-49, 24,
-50, 24,
-16, 25,
-16, 26,
-16, 27,
-16, 28
-]
-},
-{ name: "Circle with spoiler",
-    locations: [
-29, 36,
-30, 36,
-31, 36,
-32, 36,
-33, 36,
-28, 37,
-29, 37,
-33, 37,
-34, 37,
-27, 38,
-28, 38,
-34, 38,
-35, 38,
-27, 39,
-35, 39,
-27, 40,
-35, 40,
-36, 40,
-37, 40,
-38, 40,
-39, 40,
-40, 40,
-41, 40,
-42, 40,
-43, 40,
-44, 40,
-45, 40,
-46, 40,
-47, 40,
-48, 40,
-49, 40,
-50, 40,
-51, 40,
-52, 40,
-53, 40,
-54, 40,
-55, 40,
-56, 40,
-57, 40,
-58, 40,
-59, 40,
-60, 40,
-61, 40,
-62, 40,
-63, 40,
-64, 40,
-65, 40,
-66, 40,
-67, 40,
-68, 40,
-69, 40,
-27, 41,
-35, 41,
-27, 42,
-28, 42,
-34, 42,
-35, 42,
-28, 43,
-29, 43,
-33, 43,
-34, 43,
-29, 44,
-30, 44,
-31, 44,
-32, 44,
-33, 44
-]
-},
-{ name: "Right angle",
-    locations: [
-27, 36,
-28, 36,
-29, 36,
-30, 36,
-31, 36,
-32, 36,
-33, 36,
-34, 36,
-35, 36,
-36, 36,
-37, 36,
-38, 36,
-39, 36,
-40, 36,
-41, 36,
-42, 36,
-43, 36,
-44, 36,
-45, 36,
-46, 36,
-47, 36,
-48, 36,
-49, 36,
-50, 36,
-51, 36,
-52, 36,
-53, 36,
-54, 36,
-55, 36,
-56, 36,
-57, 36,
-58, 36,
-59, 36,
-60, 36,
-61, 36,
-62, 36,
-63, 36,
-64, 36,
-65, 36,
-66, 36,
-67, 36,
-68, 36,
-69, 36,
-70, 36,
-71, 36,
-72, 36,
-73, 36,
-74, 36,
-75, 36,
-76, 36,
-77, 36,
-78, 36,
-79, 36,
-27, 37,
-27, 38,
-27, 39,
-27, 40,
-27, 41,
-27, 42,
-27, 43,
-27, 44
-]
-},
-{ name: "Wedge",
-    locations: [
-27, 36,
-28, 36,
-29, 36,
-30, 36,
-31, 36,
-32, 36,
-33, 36,
-34, 36,
-35, 36,
-36, 36,
-37, 36,
-38, 36,
-39, 36,
-40, 36,
-41, 36,
-42, 36,
-43, 36,
-44, 36,
-45, 36,
-46, 36,
-47, 36,
-48, 36,
-49, 36,
-50, 36,
-51, 36,
-52, 36,
-53, 36,
-54, 36,
-55, 36,
-56, 36,
-57, 36,
-58, 36,
-59, 36,
-60, 36,
-61, 36,
-62, 36,
-63, 36,
-64, 36,
-65, 36,
-66, 36,
-67, 36,
-68, 36,
-69, 36,
-70, 36,
-71, 36,
-72, 36,
-73, 36,
-74, 36,
-75, 36,
-76, 36,
-77, 36,
-78, 36,
-79, 36,
-27, 37,
-67, 37,
-68, 37,
-69, 37,
-70, 37,
-71, 37,
-72, 37,
-73, 37,
-27, 38,
-61, 38,
-62, 38,
-63, 38,
-64, 38,
-65, 38,
-66, 38,
-67, 38,
-27, 39,
-55, 39,
-56, 39,
-57, 39,
-58, 39,
-59, 39,
-60, 39,
-61, 39,
-27, 40,
-49, 40,
-50, 40,
-51, 40,
-52, 40,
-53, 40,
-54, 40,
-55, 40,
-27, 41,
-43, 41,
-44, 41,
-45, 41,
-46, 41,
-47, 41,
-48, 41,
-49, 41,
-27, 42,
-37, 42,
-38, 42,
-39, 42,
-40, 42,
-41, 42,
-42, 42,
-43, 42,
-27, 43,
-31, 43,
-32, 43,
-33, 43,
-34, 43,
-35, 43,
-36, 43,
-37, 43,
-27, 44,
-28, 44,
-29, 44,
-30, 44,
-31, 44
-]
-},
-{ name: "Airfoil",
-    locations: [
-17, 16,
-18, 16,
-19, 16,
-20, 16,
-21, 16,
-22, 16,
-23, 16,
-24, 16,
-25, 16,
-26, 16,
-27, 16,
-28, 16,
-29, 16,
-30, 16,
-31, 16,
-32, 16,
-33, 16,
-34, 16,
-35, 16,
-36, 16,
-37, 16,
-38, 16,
-39, 16,
-40, 16,
-41, 16,
-42, 16,
-43, 16,
-44, 16,
-45, 16,
-46, 16,
-47, 16,
-48, 16,
-49, 16,
-50, 16,
-51, 16,
-52, 16,
-53, 16,
-54, 16,
-55, 16,
-56, 16,
-57, 16,
-58, 16,
-59, 16,
-60, 16,
-61, 16,
-62, 16,
-63, 16,
-64, 16,
-65, 16,
-66, 16,
-67, 16,
-68, 16,
-14, 17,
-15, 17,
-16, 17,
-17, 17,
-56, 17,
-57, 17,
-58, 17,
-59, 17,
-60, 17,
-61, 17,
-62, 17,
-13, 18,
-14, 18,
-50, 18,
-51, 18,
-52, 18,
-53, 18,
-54, 18,
-55, 18,
-56, 18,
-13, 19,
-44, 19,
-45, 19,
-46, 19,
-47, 19,
-48, 19,
-49, 19,
-50, 19,
-13, 20,
-38, 20,
-39, 20,
-40, 20,
-41, 20,
-42, 20,
-43, 20,
-44, 20,
-13, 21,
-14, 21,
-32, 21,
-33, 21,
-34, 21,
-35, 21,
-36, 21,
-37, 21,
-38, 21,
-14, 22,
-15, 22,
-26, 22,
-27, 22,
-28, 22,
-29, 22,
-30, 22,
-31, 22,
-32, 22,
-15, 23,
-16, 23,
-17, 23,
-18, 23,
-21, 23,
-22, 23,
-23, 23,
-24, 23,
-25, 23,
-26, 23,
-18, 24,
-19, 24,
-20, 24,
-21, 24
-]
-}
+var barrierList = [
+{ name: "Short line",
+    locations: [
+12, 15,
+12, 16,
+12, 17,
+12, 18,
+12, 19,
+12, 20,
+12, 21,
+12, 22,
+12, 23]
+},
+{ name: "Long line",
+    locations: [
+13, 11,
+13, 12,
+13, 13,
+13, 14,
+13, 15,
+13, 16,
+13, 17,
+13, 18,
+13, 19,
+13, 20,
+13, 21,
+13, 22,
+13, 23,
+13, 24,
+13, 25,
+13, 26,
+13, 27,
+13, 28
+]
+},
+{ name: "Diagonal",
+    locations: [
+30, 14,
+29, 15,
+30, 15,
+28, 16,
+29, 16,
+27, 17,
+28, 17,
+26, 18,
+27, 18,
+25, 19,
+26, 19,
+24, 20,
+25, 20,
+23, 21,
+24, 21,
+22, 22,
+23, 22,
+21, 23,
+22, 23,
+20, 24,
+21, 24,
+19, 25,
+20, 25,
+18, 26,
+19, 26,
+17, 27,
+18, 27,
+16, 28,
+17, 28,
+15, 29,
+16, 29,
+14, 30,
+15, 30,
+13, 31,
+14, 31
+]
+},
+{ name: "Shallow diagonal",
+    locations: [
+47, 18,
+48, 18,
+49, 18,
+50, 18,
+44, 19,
+45, 19,
+46, 19,
+47, 19,
+41, 20,
+42, 20,
+43, 20,
+44, 20,
+38, 21,
+39, 21,
+40, 21,
+41, 21,
+35, 22,
+36, 22,
+37, 22,
+38, 22,
+32, 23,
+33, 23,
+34, 23,
+35, 23,
+29, 24,
+30, 24,
+31, 24,
+32, 24,
+26, 25,
+27, 25,
+28, 25,
+29, 25,
+23, 26,
+24, 26,
+25, 26,
+26, 26,
+20, 27,
+21, 27,
+22, 27,
+23, 27,
+17, 28,
+18, 28,
+19, 28,
+20, 28
+]
+},
+{ name: "Small circle",
+    locations: [
+14, 11,
+15, 11,
+16, 11,
+17, 11,
+18, 11,
+13, 12,
+14, 12,
+18, 12,
+19, 12,
+12, 13,
+13, 13,
+19, 13,
+20, 13,
+12, 14,
+20, 14,
+12, 15,
+20, 15,
+12, 16,
+20, 16,
+12, 17,
+13, 17,
+19, 17,
+20, 17,
+13, 18,
+14, 18,
+18, 18,
+19, 18,
+14, 19,
+15, 19,
+16, 19,
+17, 19,
+18, 19
+]
+},
+{ name: "Large circle",
+    locations: [
+19, 11,
+20, 11,
+21, 11,
+22, 11,
+23, 11,
+24, 11,
+17, 12,
+18, 12,
+19, 12,
+24, 12,
+25, 12,
+26, 12,
+16, 13,
+17, 13,
+26, 13,
+27, 13,
+15, 14,
+16, 14,
+27, 14,
+28, 14,
+14, 15,
+15, 15,
+28, 15,
+29, 15,
+14, 16,
+29, 16,
+13, 17,
+14, 17,
+29, 17,
+30, 17,
+13, 18,
+30, 18,
+13, 19,
+30, 19,
+13, 20,
+30, 20,
+13, 21,
+30, 21,
+13, 22,
+14, 22,
+29, 22,
+30, 22,
+14, 23,
+29, 23,
+14, 24,
+15, 24,
+28, 24,
+29, 24,
+15, 25,
+16, 25,
+27, 25,
+28, 25,
+16, 26,
+17, 26,
+26, 26,
+27, 26,
+17, 27,
+18, 27,
+19, 27,
+24, 27,
+25, 27,
+26, 27,
+19, 28,
+20, 28,
+21, 28,
+22, 28,
+23, 28,
+24, 28
+]
+},
+{ name: "Line with spoiler",
+    locations: [
+16, 20,
+16, 21,
+16, 22,
+16, 23,
+16, 24,
+17, 24,
+18, 24,
+19, 24,
+20, 24,
+21, 24,
+22, 24,
+23, 24,
+24, 24,
+25, 24,
+26, 24,
+27, 24,
+28, 24,
+29, 24,
+30, 24,
+31, 24,
+32, 24,
+33, 24,
+34, 24,
+35, 24,
+36, 24,
+37, 24,
+38, 24,
+39, 24,
+40, 24,
+41, 24,
+42, 24,
+43, 24,
+44, 24,
+45, 24,
+46, 24,
+47, 24,
+48, 24,
+49, 24,
+50, 24,
+16, 25,
+16, 26,
+16, 27,
+16, 28
+]
+},
+{ name: "Circle with spoiler",
+    locations: [
+29, 36,
+30, 36,
+31, 36,
+32, 36,
+33, 36,
+28, 37,
+29, 37,
+33, 37,
+34, 37,
+27, 38,
+28, 38,
+34, 38,
+35, 38,
+27, 39,
+35, 39,
+27, 40,
+35, 40,
+36, 40,
+37, 40,
+38, 40,
+39, 40,
+40, 40,
+41, 40,
+42, 40,
+43, 40,
+44, 40,
+45, 40,
+46, 40,
+47, 40,
+48, 40,
+49, 40,
+50, 40,
+51, 40,
+52, 40,
+53, 40,
+54, 40,
+55, 40,
+56, 40,
+57, 40,
+58, 40,
+59, 40,
+60, 40,
+61, 40,
+62, 40,
+63, 40,
+64, 40,
+65, 40,
+66, 40,
+67, 40,
+68, 40,
+69, 40,
+27, 41,
+35, 41,
+27, 42,
+28, 42,
+34, 42,
+35, 42,
+28, 43,
+29, 43,
+33, 43,
+34, 43,
+29, 44,
+30, 44,
+31, 44,
+32, 44,
+33, 44
+]
+},
+{ name: "Right angle",
+    locations: [
+27, 36,
+28, 36,
+29, 36,
+30, 36,
+31, 36,
+32, 36,
+33, 36,
+34, 36,
+35, 36,
+36, 36,
+37, 36,
+38, 36,
+39, 36,
+40, 36,
+41, 36,
+42, 36,
+43, 36,
+44, 36,
+45, 36,
+46, 36,
+47, 36,
+48, 36,
+49, 36,
+50, 36,
+51, 36,
+52, 36,
+53, 36,
+54, 36,
+55, 36,
+56, 36,
+57, 36,
+58, 36,
+59, 36,
+60, 36,
+61, 36,
+62, 36,
+63, 36,
+64, 36,
+65, 36,
+66, 36,
+67, 36,
+68, 36,
+69, 36,
+70, 36,
+71, 36,
+72, 36,
+73, 36,
+74, 36,
+75, 36,
+76, 36,
+77, 36,
+78, 36,
+79, 36,
+27, 37,
+27, 38,
+27, 39,
+27, 40,
+27, 41,
+27, 42,
+27, 43,
+27, 44
+]
+},
+{ name: "Wedge",
+    locations: [
+27, 36,
+28, 36,
+29, 36,
+30, 36,
+31, 36,
+32, 36,
+33, 36,
+34, 36,
+35, 36,
+36, 36,
+37, 36,
+38, 36,
+39, 36,
+40, 36,
+41, 36,
+42, 36,
+43, 36,
+44, 36,
+45, 36,
+46, 36,
+47, 36,
+48, 36,
+49, 36,
+50, 36,
+51, 36,
+52, 36,
+53, 36,
+54, 36,
+55, 36,
+56, 36,
+57, 36,
+58, 36,
+59, 36,
+60, 36,
+61, 36,
+62, 36,
+63, 36,
+64, 36,
+65, 36,
+66, 36,
+67, 36,
+68, 36,
+69, 36,
+70, 36,
+71, 36,
+72, 36,
+73, 36,
+74, 36,
+75, 36,
+76, 36,
+77, 36,
+78, 36,
+79, 36,
+27, 37,
+67, 37,
+68, 37,
+69, 37,
+70, 37,
+71, 37,
+72, 37,
+73, 37,
+27, 38,
+61, 38,
+62, 38,
+63, 38,
+64, 38,
+65, 38,
+66, 38,
+67, 38,
+27, 39,
+55, 39,
+56, 39,
+57, 39,
+58, 39,
+59, 39,
+60, 39,
+61, 39,
+27, 40,
+49, 40,
+50, 40,
+51, 40,
+52, 40,
+53, 40,
+54, 40,
+55, 40,
+27, 41,
+43, 41,
+44, 41,
+45, 41,
+46, 41,
+47, 41,
+48, 41,
+49, 41,
+27, 42,
+37, 42,
+38, 42,
+39, 42,
+40, 42,
+41, 42,
+42, 42,
+43, 42,
+27, 43,
+31, 43,
+32, 43,
+33, 43,
+34, 43,
+35, 43,
+36, 43,
+37, 43,
+27, 44,
+28, 44,
+29, 44,
+30, 44,
+31, 44
+]
+},
+{ name: "Airfoil",
+    locations: [
+17, 16,
+18, 16,
+19, 16,
+20, 16,
+21, 16,
+22, 16,
+23, 16,
+24, 16,
+25, 16,
+26, 16,
+27, 16,
+28, 16,
+29, 16,
+30, 16,
+31, 16,
+32, 16,
+33, 16,
+34, 16,
+35, 16,
+36, 16,
+37, 16,
+38, 16,
+39, 16,
+40, 16,
+41, 16,
+42, 16,
+43, 16,
+44, 16,
+45, 16,
+46, 16,
+47, 16,
+48, 16,
+49, 16,
+50, 16,
+51, 16,
+52, 16,
+53, 16,
+54, 16,
+55, 16,
+56, 16,
+57, 16,
+58, 16,
+59, 16,
+60, 16,
+61, 16,
+62, 16,
+63, 16,
+64, 16,
+65, 16,
+66, 16,
+67, 16,
+68, 16,
+14, 17,
+15, 17,
+16, 17,
+17, 17,
+56, 17,
+57, 17,
+58, 17,
+59, 17,
+60, 17,
+61, 17,
+62, 17,
+13, 18,
+14, 18,
+50, 18,
+51, 18,
+52, 18,
+53, 18,
+54, 18,
+55, 18,
+56, 18,
+13, 19,
+44, 19,
+45, 19,
+46, 19,
+47, 19,
+48, 19,
+49, 19,
+50, 19,
+13, 20,
+38, 20,
+39, 20,
+40, 20,
+41, 20,
+42, 20,
+43, 20,
+44, 20,
+13, 21,
+14, 21,
+32, 21,
+33, 21,
+34, 21,
+35, 21,
+36, 21,
+37, 21,
+38, 21,
+14, 22,
+15, 22,
+26, 22,
+27, 22,
+28, 22,
+29, 22,
+30, 22,
+31, 22,
+32, 22,
+15, 23,
+16, 23,
+17, 23,
+18, 23,
+21, 23,
+22, 23,
+23, 23,
+24, 23,
+25, 23,
+26, 23,
+18, 24,
+19, 24,
+20, 24,
+21, 24
+]
+}
 ];
\ No newline at end of file
diff --git a/CMake/CMakeSetCompilerFlags.cmake b/CMake/CMakeSetCompilerFlags.cmake
index 9ecf187011e5ddd2564ee8ffb25ef77c53ded423..b00a17fdb216f60bebca87b8f408ddf6e894c629 100644
--- a/CMake/CMakeSetCompilerFlags.cmake
+++ b/CMake/CMakeSetCompilerFlags.cmake
@@ -1,89 +1,89 @@
-
-###############################################################
-# set hostname -> CAB_MACHINE and load an optional config file
-###############################################################
-macro(loadMachineFile)
-
-    IF(NOT CAB_MACHINE)
-        SET(CAB_MACHINE $ENV{CAB_MACHINE})
-
-        IF( CAB_MACHINE )
-            STRING(TOUPPER  "${CAB_MACHINE}" CAB_MACHINE)
-        ELSE()
-            EXECUTE_PROCESS( COMMAND hostname OUTPUT_VARIABLE CAB_MACHINE)
-            STRING(REGEX REPLACE "[ ]*([A-Za-z0-9]+).*[\\\\n]*" "\\1" CAB_MACHINE "${CAB_MACHINE}" )
-            STRING(TOUPPER  "${CAB_MACHINE}" CAB_MACHINE)
-        ENDIF()
-    ENDIF()
-
-    LIST(APPEND VF_COMPILER_DEFINITION CAB_MACHINE=${CAB_MACHINE})
-    SET(CMAKE_CONFIG_FILE "${VF_CMAKE_DIR}/cmake_config_files/${CAB_MACHINE}.config.cmake")
-
-    IF(NOT EXISTS ${CMAKE_CONFIG_FILE})
-        status("No configuration file found.")
-    ELSE()
-        status("Load configuration file ${CAB_MACHINE}.config.cmake")
-        include(${CMAKE_CONFIG_FILE})
-    ENDIF()
-
-endmacro()
-
-
-################################################################
-###               SET_COMPILER_SPECIFIC_FLAGS                ###
-###  determines compiler flags variables                     ###
-################################################################
-macro(loadCompilerFlags)
-
-  SET(CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "")
-  SET(CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS_DEBUG "")
-  SET(CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS_RELEASE "")
-
-   # https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_COMPILER_ID.html#variable:CMAKE_<LANG>_COMPILER_ID
-
-   IF( SPECIFIC_COMPILER_FLAG_FILE )
-       include( ${SPECIFIC_COMPILER_FLAG_FILE})
-   ELSEIF( EXISTS "${VF_CMAKE_DIR}/compilerflags/${CMAKE_CXX_COMPILER_ID}.cmake" )
-       status("Load compiler file: ${CMAKE_CXX_COMPILER_ID}.cmake")
-	   include(${VF_CMAKE_DIR}/compilerflags/${CMAKE_CXX_COMPILER_ID}.cmake)
-	ELSE()
-	   MESSAGE(FATAL_ERROR "compiler=${CMAKE_CXX_COMPILER_ID} seems to be a not supported compiler")
-	ENDIF()
-
-endmacro()
-
-################################################################
-###             ADD_COMPILER_FLAGS_TO_PROJECT                ###
-################################################################
-function(addAdditionalFlags project_name)
-
-    status_lib("additional compiler flags CXX: ${CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS}")
-    status_lib("additional compiler flags CXX debug: ${CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS_DEBUG}")
-    status_lib("additional compiler flags CXX release: ${CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS_RELEASE}")
-    status_lib("additional compiler definitions: ${VF_COMPILER_DEFINITION}")
-    status_lib("additional linker flags: ${VF_LINK_OPTIONS}")
-
-    # compile definitions
-    foreach(flag IN LISTS VF_COMPILER_DEFINITION)
-        target_compile_definitions(${library_name} PRIVATE ${flag})
-    endforeach()
-
-    # link options
-    foreach(flag IN LISTS VF_LINK_OPTIONS) #TODO: check what happens when lib is static
-        target_link_options(${library_name} PRIVATE ${flag})
-    endforeach()
-
-    # compile options
-    foreach(flag IN LISTS CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS)
-        target_compile_options(${project_name} PRIVATE "$<$<COMPILE_LANGUAGE:CXX>:${flag}>")
-    endforeach()
-
-    foreach(flag IN LISTS CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS_DEBUG)
-        target_compile_options(${project_name} PRIVATE "$<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CONFIG:DEBUG>>:${flag}>")
-    endforeach()
-
-    foreach(flag IN LISTS CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS_RELEASE)
-        target_compile_options(${project_name} PRIVATE "$<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CONFIG:RELEASE>>:${flag}>")
-    endforeach()
-
+
+###############################################################
+# set hostname -> CAB_MACHINE and load an optional config file
+###############################################################
+macro(loadMachineFile)
+
+    IF(NOT CAB_MACHINE)
+        SET(CAB_MACHINE $ENV{CAB_MACHINE})
+
+        IF( CAB_MACHINE )
+            STRING(TOUPPER  "${CAB_MACHINE}" CAB_MACHINE)
+        ELSE()
+            EXECUTE_PROCESS( COMMAND hostname OUTPUT_VARIABLE CAB_MACHINE)
+            STRING(REGEX REPLACE "[ ]*([A-Za-z0-9]+).*[\\\\n]*" "\\1" CAB_MACHINE "${CAB_MACHINE}" )
+            STRING(TOUPPER  "${CAB_MACHINE}" CAB_MACHINE)
+        ENDIF()
+    ENDIF()
+
+    LIST(APPEND VF_COMPILER_DEFINITION CAB_MACHINE=${CAB_MACHINE})
+    SET(CMAKE_CONFIG_FILE "${VF_CMAKE_DIR}/cmake_config_files/${CAB_MACHINE}.config.cmake")
+
+    IF(NOT EXISTS ${CMAKE_CONFIG_FILE})
+        status("No configuration file found.")
+    ELSE()
+        status("Load configuration file ${CAB_MACHINE}.config.cmake")
+        include(${CMAKE_CONFIG_FILE})
+    ENDIF()
+
+endmacro()
+
+
+################################################################
+###               SET_COMPILER_SPECIFIC_FLAGS                ###
+###  determines compiler flags variables                     ###
+################################################################
+macro(loadCompilerFlags)
+
+  SET(CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "")
+  SET(CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS_DEBUG "")
+  SET(CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS_RELEASE "")
+
+   # https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_COMPILER_ID.html#variable:CMAKE_<LANG>_COMPILER_ID
+
+   IF( SPECIFIC_COMPILER_FLAG_FILE )
+       include( ${SPECIFIC_COMPILER_FLAG_FILE})
+   ELSEIF( EXISTS "${VF_CMAKE_DIR}/compilerflags/${CMAKE_CXX_COMPILER_ID}.cmake" )
+       status("Load compiler file: ${CMAKE_CXX_COMPILER_ID}.cmake")
+	   include(${VF_CMAKE_DIR}/compilerflags/${CMAKE_CXX_COMPILER_ID}.cmake)
+	ELSE()
+	   MESSAGE(FATAL_ERROR "compiler=${CMAKE_CXX_COMPILER_ID} seems to be a not supported compiler")
+	ENDIF()
+
+endmacro()
+
+################################################################
+###             ADD_COMPILER_FLAGS_TO_PROJECT                ###
+################################################################
+function(addAdditionalFlags project_name)
+
+    status_lib("additional compiler flags CXX: ${CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS}")
+    status_lib("additional compiler flags CXX debug: ${CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS_DEBUG}")
+    status_lib("additional compiler flags CXX release: ${CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS_RELEASE}")
+    status_lib("additional compiler definitions: ${VF_COMPILER_DEFINITION}")
+    status_lib("additional linker flags: ${VF_LINK_OPTIONS}")
+
+    # compile definitions
+    foreach(flag IN LISTS VF_COMPILER_DEFINITION)
+        target_compile_definitions(${library_name} PRIVATE ${flag})
+    endforeach()
+
+    # link options
+    foreach(flag IN LISTS VF_LINK_OPTIONS) #TODO: check what happens when lib is static
+        target_link_options(${library_name} PRIVATE ${flag})
+    endforeach()
+
+    # compile options
+    foreach(flag IN LISTS CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS)
+        target_compile_options(${project_name} PRIVATE "$<$<COMPILE_LANGUAGE:CXX>:${flag}>")
+    endforeach()
+
+    foreach(flag IN LISTS CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS_DEBUG)
+        target_compile_options(${project_name} PRIVATE "$<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CONFIG:DEBUG>>:${flag}>")
+    endforeach()
+
+    foreach(flag IN LISTS CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS_RELEASE)
+        target_compile_options(${project_name} PRIVATE "$<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CONFIG:RELEASE>>:${flag}>")
+    endforeach()
+
 endfunction()
\ No newline at end of file
diff --git a/CMake/cmake_config_files/BOMBADIL.config.cmake b/CMake/cmake_config_files/BOMBADIL.config.cmake
index 7838e2f52b35deae8c114c57968f4b71e0b5b2e4..9a205596d22cfac18baef3131871b9f73e1b4f9c 100644
--- a/CMake/cmake_config_files/BOMBADIL.config.cmake
+++ b/CMake/cmake_config_files/BOMBADIL.config.cmake
@@ -1,86 +1,86 @@
-#################################################################################
-# VirtualFluids MACHINE FILE
-# Responsible: Konstantin Kutscher
-# OS:          Windows 10
-#################################################################################
-
-#################################################################################
-# MPI
-#################################################################################
-#SET(MPI_DIR  "C:/Program Files (x86)/mpich2")
-#SET(MPI_DIR  "C:/Program Files/mpich2")
-#SET(USE_MPI_CXX_SYNTAX OFF)
-#SET(MPI_COMPILER "C:/Program Files/mpich2/bin/mpicxx")
-#SET(MPI_INCLUDE_PATH "C:/Program Files (x86)/mpich2/include")
-#SET(MPI_LIBRARY "C:/Program Files/mpich2/lib/libmpi.a")
-#SET(MPI_CXX_LIBRARY "C:/Program Files/MPICH2/lib/cxx.lib")
-#################################################################################
-#  BOOST  
-#################################################################################
-SET(BOOST_VERSION "1.60.0")
-SET(BOOST_ROOT "d:/Tools/boost/boost_1_60_0")
-SET(BOOST_DIR ${BOOST_ROOT})
-SET(BOOST_LIBRARYDIR ${BOOST_ROOT}"/stageMSVC64/lib")  
-#################################################################################
-#  VTK  
-#################################################################################
-set(VTK_DIR "d:/Tools/VTK/build/VTK-8.0.0")
-
-#################################################################################
-#  METIS  
-#################################################################################
-IF(${USE_METIS})
-  SET(METIS_INCLUDEDIR "d:/Tools/metis-5.1.0/include")
-  SET(METIS_DEBUG_LIBRARY "d:/Tools/metis-5.1.0/build/libmetis/Debug/metis.lib") 
-  SET(METIS_RELEASE_LIBRARY "d:/Tools/metis-5.1.0/build/libmetis/Release/metis.lib") 
-  
-  # SET(METIS_INCLUDEDIR "/mnt/d/Tools/metis-5.1.0/include")
-  # SET(METIS_DEBUG_LIBRARY "/mnt/d/Tools/metis-5.1.0/build/Linux-x86_64/libmetis/libmetis.a") 
-  # SET(METIS_RELEASE_LIBRARY "/mnt/d/Tools/metis-5.1.0/build/Linux-x86_64/libmetis/libmetis.a") 
-ENDIF()
-
-#################################################################################
-#  PE  
-#################################################################################
-IF(${USE_DEM_COUPLING})
-  SET(PE_BINARY_DIR "d:/Tools/waLBerla/walberlaGit/build" CACHE PATH "pe binary dir")
-  SET(PE_ROOT "d:/Tools/waLBerla/walberlaGit" CACHE PATH "pe root")
- 
-  SET(PE_DEBUG_LIBRARY ${PE_BINARY_DIR}/src/pe/Debug/pe.lib) 
-  SET(PE_RELEASE_LIBRARY ${PE_BINARY_DIR}/src/pe/Release/pe.lib)
-  SET(BLOCKFOREST_DEBUG_LIBRARY ${PE_BINARY_DIR}/src/blockforest/Debug/blockforest.lib) 
-  SET(BLOCKFOREST_RELEASE_LIBRARY ${PE_BINARY_DIR}/src/blockforest/Release/blockforest.lib)
-  SET(DOMAIN_DECOMPOSITION_DEBUG_LIBRARY ${PE_BINARY_DIR}/src/domain_decomposition/Debug/domain_decomposition.lib) 
-  SET(DOMAIN_DECOMPOSITION_RELEASE_LIBRARY ${PE_BINARY_DIR}/src/domain_decomposition/Release/domain_decomposition.lib)
-  SET(GEOMETRY_DEBUG_LIBRARY ${PE_BINARY_DIR}/src/geometry/Debug/geometry.lib) 
-  SET(GEOMETRY_RELEASE_LIBRARY ${PE_BINARY_DIR}/src/geometry/Release/geometry.lib)
-  SET(CORE_DEBUG_LIBRARY ${PE_BINARY_DIR}/src/core/Debug/core.lib) 
-  SET(CORE_RELEASE_LIBRARY ${PE_BINARY_DIR}/src/core/Release/core.lib)
-
- ENDIF()
-
-##################################################################################
-#  FETOL
-##################################################################################
-IF(${USE_FETOL})
-  SET(FETOL_INCLUDEDIR "d:/Projects/FETOL/dev/CppFETOLlib")
-  SET(FETOL_DEBUG_LIBRARY "d:/Projects/FETOL/dev/CppFETOLlib/build/Debug/fetol.lib") 
-  SET(FETOL_RELEASE_LIBRARY "d:/Projects/FETOL/dev/CppFETOLlib/build/Release/fetol.lib") 
-  
-  SET(YAML_INCLUDEDIR "d:/Tools/yaml-cpp/include")
-  SET(YAML_DEBUG_LIBRARY "d:/Tools/yaml-cpp/buildVS11/Debug/libyaml-cppmdd.lib") 
-  SET(YAML_RELEASE_LIBRARY "d:/Tools/yaml-cpp/buildVS11/Release/libyaml-cppmd.lib") 
-  
-  SET(BOND_INCLUDEDIR "d:/Projects/FETOL/dev/bond_src/cpp/bond/fetol")
-  SET(BOND_DEBUG_LIBRARY "d:/Projects/FETOL/dev/bond_lib/Debug/bond.lib") 
-  SET(BOND_RELEASE_LIBRARY "d:/Projects/FETOL/dev/bond_lib/Release/bond.lib")   
-ENDIF()
-
-##################################################################################
-#  Java
-##############################################################################
-### FindJNI.cmake
-#find_package(JNI REQUIRED) 
-#SET(JNI_INCLUDE_DIRS ${JAVA_INCLUDE_PATH} ${JAVA_INCLUDE_PATH2} ${JAVA_AWT_INCLUDE_PATH})
-#SET(JNI_LIBRARIES ${JAVA_AWT_LIBRARY} ${JAVA_JVM_LIBRARY})
+#################################################################################
+# VirtualFluids MACHINE FILE
+# Responsible: Konstantin Kutscher
+# OS:          Windows 10
+#################################################################################
+
+#################################################################################
+# MPI
+#################################################################################
+#SET(MPI_DIR  "C:/Program Files (x86)/mpich2")
+#SET(MPI_DIR  "C:/Program Files/mpich2")
+#SET(USE_MPI_CXX_SYNTAX OFF)
+#SET(MPI_COMPILER "C:/Program Files/mpich2/bin/mpicxx")
+#SET(MPI_INCLUDE_PATH "C:/Program Files (x86)/mpich2/include")
+#SET(MPI_LIBRARY "C:/Program Files/mpich2/lib/libmpi.a")
+#SET(MPI_CXX_LIBRARY "C:/Program Files/MPICH2/lib/cxx.lib")
+#################################################################################
+#  BOOST  
+#################################################################################
+SET(BOOST_VERSION "1.60.0")
+SET(BOOST_ROOT "d:/Tools/boost/boost_1_60_0")
+SET(BOOST_DIR ${BOOST_ROOT})
+SET(BOOST_LIBRARYDIR ${BOOST_ROOT}"/stageMSVC64/lib")  
+#################################################################################
+#  VTK  
+#################################################################################
+set(VTK_DIR "d:/Tools/VTK/build/VTK-8.0.0")
+
+#################################################################################
+#  METIS  
+#################################################################################
+IF(${USE_METIS})
+  SET(METIS_INCLUDEDIR "d:/Tools/metis-5.1.0/include")
+  SET(METIS_DEBUG_LIBRARY "d:/Tools/metis-5.1.0/build/libmetis/Debug/metis.lib") 
+  SET(METIS_RELEASE_LIBRARY "d:/Tools/metis-5.1.0/build/libmetis/Release/metis.lib") 
+  
+  # SET(METIS_INCLUDEDIR "/mnt/d/Tools/metis-5.1.0/include")
+  # SET(METIS_DEBUG_LIBRARY "/mnt/d/Tools/metis-5.1.0/build/Linux-x86_64/libmetis/libmetis.a") 
+  # SET(METIS_RELEASE_LIBRARY "/mnt/d/Tools/metis-5.1.0/build/Linux-x86_64/libmetis/libmetis.a") 
+ENDIF()
+
+#################################################################################
+#  PE  
+#################################################################################
+IF(${USE_DEM_COUPLING})
+  SET(PE_BINARY_DIR "d:/Tools/waLBerla/walberlaGit/build" CACHE PATH "pe binary dir")
+  SET(PE_ROOT "d:/Tools/waLBerla/walberlaGit" CACHE PATH "pe root")
+ 
+  SET(PE_DEBUG_LIBRARY ${PE_BINARY_DIR}/src/pe/Debug/pe.lib) 
+  SET(PE_RELEASE_LIBRARY ${PE_BINARY_DIR}/src/pe/Release/pe.lib)
+  SET(BLOCKFOREST_DEBUG_LIBRARY ${PE_BINARY_DIR}/src/blockforest/Debug/blockforest.lib) 
+  SET(BLOCKFOREST_RELEASE_LIBRARY ${PE_BINARY_DIR}/src/blockforest/Release/blockforest.lib)
+  SET(DOMAIN_DECOMPOSITION_DEBUG_LIBRARY ${PE_BINARY_DIR}/src/domain_decomposition/Debug/domain_decomposition.lib) 
+  SET(DOMAIN_DECOMPOSITION_RELEASE_LIBRARY ${PE_BINARY_DIR}/src/domain_decomposition/Release/domain_decomposition.lib)
+  SET(GEOMETRY_DEBUG_LIBRARY ${PE_BINARY_DIR}/src/geometry/Debug/geometry.lib) 
+  SET(GEOMETRY_RELEASE_LIBRARY ${PE_BINARY_DIR}/src/geometry/Release/geometry.lib)
+  SET(CORE_DEBUG_LIBRARY ${PE_BINARY_DIR}/src/core/Debug/core.lib) 
+  SET(CORE_RELEASE_LIBRARY ${PE_BINARY_DIR}/src/core/Release/core.lib)
+
+ ENDIF()
+
+##################################################################################
+#  FETOL
+##################################################################################
+IF(${USE_FETOL})
+  SET(FETOL_INCLUDEDIR "d:/Projects/FETOL/dev/CppFETOLlib")
+  SET(FETOL_DEBUG_LIBRARY "d:/Projects/FETOL/dev/CppFETOLlib/build/Debug/fetol.lib") 
+  SET(FETOL_RELEASE_LIBRARY "d:/Projects/FETOL/dev/CppFETOLlib/build/Release/fetol.lib") 
+  
+  SET(YAML_INCLUDEDIR "d:/Tools/yaml-cpp/include")
+  SET(YAML_DEBUG_LIBRARY "d:/Tools/yaml-cpp/buildVS11/Debug/libyaml-cppmdd.lib") 
+  SET(YAML_RELEASE_LIBRARY "d:/Tools/yaml-cpp/buildVS11/Release/libyaml-cppmd.lib") 
+  
+  SET(BOND_INCLUDEDIR "d:/Projects/FETOL/dev/bond_src/cpp/bond/fetol")
+  SET(BOND_DEBUG_LIBRARY "d:/Projects/FETOL/dev/bond_lib/Debug/bond.lib") 
+  SET(BOND_RELEASE_LIBRARY "d:/Projects/FETOL/dev/bond_lib/Release/bond.lib")   
+ENDIF()
+
+##################################################################################
+#  Java
+##############################################################################
+### FindJNI.cmake
+#find_package(JNI REQUIRED) 
+#SET(JNI_INCLUDE_DIRS ${JAVA_INCLUDE_PATH} ${JAVA_INCLUDE_PATH2} ${JAVA_AWT_INCLUDE_PATH})
+#SET(JNI_LIBRARIES ${JAVA_AWT_LIBRARY} ${JAVA_JVM_LIBRARY})
 #SET(JNI_FOUND 1) 
\ No newline at end of file
diff --git a/CMake/cmake_config_files/HOST2.config.cmake b/CMake/cmake_config_files/HOST2.config.cmake
index caba4aed96df0145ca919a760ed38a401193b8fe..3bfbaf2ddead8a6cc0eafa5c2c033fc54da6cb7f 100644
--- a/CMake/cmake_config_files/HOST2.config.cmake
+++ b/CMake/cmake_config_files/HOST2.config.cmake
@@ -1,22 +1,22 @@
-#################################################################################
-# VirtualFluids MACHINE FILE
-# Responsible: Konstantin Kutscher
-# OS:          ???
-#################################################################################
-
-#################################################################################
-#  BOOST  
-#################################################################################
-SET(BOOST_VERSION "1.47")
-SET(BOOST_USE_MULTITHREAD ON)
-SET(BOOST_USE_STATIC_LIBS ON)
-
-SET(BOOST_ROOT "/host/tools/boost/boost_1_47_0")
-SET(BOOST_LIBRARYDIR "/host/tools/boost/boost_1_47_0/stageLinux/lib")
-
-#################################################################################
-#  METIS  
-#################################################################################
-SET(METIS_INCLUDEDIR "c:/Tools/metis-5.0.1/include")
-SET(METIS_DEBUG_LIBRARY "c:/Tools/metis-5.0.1/build/libmetis/Debug/metis.lib")
-SET(METIS_RELEASE_LIBRARY "c:/Tools/metis-5.0.1/build/libmetis/Release/metis.lib")
+#################################################################################
+# VirtualFluids MACHINE FILE
+# Responsible: Konstantin Kutscher
+# OS:          ???
+#################################################################################
+
+#################################################################################
+#  BOOST  
+#################################################################################
+SET(BOOST_VERSION "1.47")
+SET(BOOST_USE_MULTITHREAD ON)
+SET(BOOST_USE_STATIC_LIBS ON)
+
+SET(BOOST_ROOT "/host/tools/boost/boost_1_47_0")
+SET(BOOST_LIBRARYDIR "/host/tools/boost/boost_1_47_0/stageLinux/lib")
+
+#################################################################################
+#  METIS  
+#################################################################################
+SET(METIS_INCLUDEDIR "c:/Tools/metis-5.0.1/include")
+SET(METIS_DEBUG_LIBRARY "c:/Tools/metis-5.0.1/build/libmetis/Debug/metis.lib")
+SET(METIS_RELEASE_LIBRARY "c:/Tools/metis-5.0.1/build/libmetis/Release/metis.lib")
diff --git a/CMake/cmake_config_files/TESLA01.config.cmake b/CMake/cmake_config_files/TESLA01.config.cmake
index c92603b3508a2cac51019cc80d99083e2a400a58..97771db2a6058e26504d510fc2d796c2c02e4994 100644
--- a/CMake/cmake_config_files/TESLA01.config.cmake
+++ b/CMake/cmake_config_files/TESLA01.config.cmake
@@ -1,17 +1,17 @@
-#################################################################################
-# VirtualFluids MACHINE FILE
-# Responsible: Soeren Peters
-# OS:          Windows 10
-#################################################################################
-
-SET(BOOST_ROOT  "C:\\Libraries\\boost_1_65_1"  CACHE PATH "BOOST_ROOT")
-SET(BOOST_LIBRARYDIR  "C:\\Libraries\\boost_1_65_1\\lib" CACHE PATH "BOOST_LIBRARYDIR")
-
-SET(VTK_DIR "C:/Libraries/VTK-8.0.1/build")
-
-#################################################################################
-#  METIS
-#################################################################################
-SET(METIS_INCLUDEDIR "C:/Libraries/metis-5.1.0//include")
-SET(METIS_DEBUG_LIBRARY "C:/Libraries/metis-5.1.0/build/libmetis/Debug/metis.lib")
-SET(METIS_RELEASE_LIBRARY "C:/Libraries/metis-5.1.0/build/libmetis/Release/metis.lib")
+#################################################################################
+# VirtualFluids MACHINE FILE
+# Responsible: Soeren Peters
+# OS:          Windows 10
+#################################################################################
+
+SET(BOOST_ROOT  "C:\\Libraries\\boost_1_65_1"  CACHE PATH "BOOST_ROOT")
+SET(BOOST_LIBRARYDIR  "C:\\Libraries\\boost_1_65_1\\lib" CACHE PATH "BOOST_LIBRARYDIR")
+
+SET(VTK_DIR "C:/Libraries/VTK-8.0.1/build")
+
+#################################################################################
+#  METIS
+#################################################################################
+SET(METIS_INCLUDEDIR "C:/Libraries/metis-5.1.0//include")
+SET(METIS_DEBUG_LIBRARY "C:/Libraries/metis-5.1.0/build/libmetis/Debug/metis.lib")
+SET(METIS_RELEASE_LIBRARY "C:/Libraries/metis-5.1.0/build/libmetis/Release/metis.lib")
diff --git a/apps/cpu/AcousticPulse/CMakeLists.txt b/apps/cpu/AcousticPulse/CMakeLists.txt
index abafdc458023fa7b144f71465330bdfd646e5922..891fafd8a8312d854b7b471490ba0042be3fc90d 100644
--- a/apps/cpu/AcousticPulse/CMakeLists.txt
+++ b/apps/cpu/AcousticPulse/CMakeLists.txt
@@ -1,25 +1,25 @@
-CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
-
-########################################################
-## C++ PROJECT                                       ###
-########################################################
-PROJECT(AcousticPulse)
-
-INCLUDE(${APPS_ROOT}/IncludsList.cmake) 
-
-#################################################################
-###   LOCAL FILES                                             ###
-#################################################################
-FILE(GLOB SPECIFIC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.h
-                         ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
-                         ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp  )
- 
-SET(ALL_SOURCES ${ALL_SOURCES} ${SPECIFIC_FILES})
-SOURCE_GROUP(src FILES ${SPECIFIC_FILES})
-  
-SET(CAB_ADDITIONAL_LINK_LIBRARIES VirtualFluids)
-
-#################################################################
-###   CREATE PROJECT                                          ###
-#################################################################
-CREATE_CAB_PROJECT(ap BINARY)
+CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
+
+########################################################
+## C++ PROJECT                                       ###
+########################################################
+PROJECT(AcousticPulse)
+
+INCLUDE(${APPS_ROOT}/IncludsList.cmake) 
+
+#################################################################
+###   LOCAL FILES                                             ###
+#################################################################
+FILE(GLOB SPECIFIC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.h
+                         ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
+                         ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp  )
+ 
+SET(ALL_SOURCES ${ALL_SOURCES} ${SPECIFIC_FILES})
+SOURCE_GROUP(src FILES ${SPECIFIC_FILES})
+  
+SET(CAB_ADDITIONAL_LINK_LIBRARIES VirtualFluids)
+
+#################################################################
+###   CREATE PROJECT                                          ###
+#################################################################
+CREATE_CAB_PROJECT(ap BINARY)
diff --git a/apps/cpu/AcousticPulse/ap.cpp b/apps/cpu/AcousticPulse/ap.cpp
index ce4b07e7c6d487f44427e4a7579e873b94f1b3cf..3ce1b39e558f3dadc0cd024e05180103d87b2f21 100644
--- a/apps/cpu/AcousticPulse/ap.cpp
+++ b/apps/cpu/AcousticPulse/ap.cpp
@@ -1,261 +1,261 @@
-#include <iostream>
-#include <string>
-
-#include "VirtualFluids.h"
-
-using namespace std;
-
-
-void run()
-{
-   try
-   {
-      SPtr<Communicator> comm = MPICommunicator::getInstance();
-      int myid = comm->getProcessID();
-
-      int    numOfThreads = 4;
-      double availMem = 5e9;
-
-      //40
-      //string  pathname = "d:/temp/AcousticPulse40Cube2y_test";
-      //double  endTime = 20;
-      //double  outTime = 20;
-      //LBMReal dx =  0.05;
-
-      //80
-      //string  pathname = "d:/temp/AcousticPulse80Cube2y";
-      //double  endTime = 40;
-      //double  outTime = 40;
-      //LBMReal dx = 0.025;
-
-      //160
-      //string  pathname = "d:/temp/AcousticPulse160Cube2y";
-      //double  endTime = 80;
-      //double  outTime = 80;
-      //LBMReal dx = 0.0125;
-
-      //LBMReal dx = 0.1; 
-      //LBMReal dx = 1.66666666667e-2; //120
-      
-      //LBMReal rhoLB = 0.0;
-      //LBMReal nuLB = 3.97e-7;
-
-      //////////////////////////////////////////////////////////////////////////
-      //DLR-F16 test
-      ////dx_coarse = 0.003 mm
-      string  pathname = "d:/temp/AcousticPulseXZ-4th-0.003";
-      int     endTime = 20;
-      double  outTime = 20;
-      LBMReal dx =  0.003;
-      LBMReal rhoLB = 0.0;
-      LBMReal nuLB = 8.66025e-6;
-      //////////////////////////////////////////////////////////////////////////
-      ////dx_coarse = 0.0015 mm
-      //string  pathname = "d:/temp/AcousticPulseXZ-4th-0.0015";
-      //double  endTime = 40;
-      //double  outTime = 40;
-      //LBMReal dx =  0.0015;
-      //LBMReal rhoLB = 0.0;
-      //LBMReal nuLB = 8.66025e-6*2.0;
-      ////////////////////////////////////////////////////////////////////////////
-      ////dx_coarse = 0.00075 mm
-      //string  pathname = "d:/temp/AcousticPulseXZ-4th-0.00075";
-      //double  endTime = 80;
-      //double  outTime = 80;
-      //LBMReal dx =  0.00075;
-      //LBMReal rhoLB = 0.0;
-      //LBMReal nuLB = 8.66025e-6*4.0;
-      //////////////////////////////////////////////////////////////////////////
-
-      SPtr<LBMUnitConverter> conv = SPtr<LBMUnitConverter>(new LBMUnitConverter());
-
-      int baseLevel = 0;
-      int refineLevel = 1;
-
-      //bounding box
-      double g_minX1 = -0.06;
-      double g_minX2 = -0.06;
-      double g_minX3 = -0.06;
-
-      double g_maxX1 = 0.06;
-      double g_maxX2 = 0.06;
-      double g_maxX3 = 0.06;
-
-      //double g_minX1 = -1;
-      //double g_minX2 = -1;
-      //double g_minX3 = -1;
-
-      //double g_maxX1 = 1;
-      //double g_maxX2 = 1;
-      //double g_maxX3 = 1;
-
-      vector<int>  blocknx(3);
-      blocknx[0] = 10;
-      blocknx[1] = 10;
-      blocknx[2] = 10;
-
-      //geometry
-      SPtr<GbObject3D> gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
-      if (myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), pathname + "/geo/gridCube", WbWriterVtkXmlBinary::getInstance());
-
-
-      double blockLength = blocknx[0] * dx;
-
-      SPtr<Grid3D> grid(new Grid3D(comm));
-      grid->setDeltaX(dx);
-      grid->setBlockNX(blocknx[0], blocknx[1], blocknx[2]);
-      grid->setPeriodicX1(true);
-      grid->setPeriodicX2(true);
-      grid->setPeriodicX3(true);
-
-
-      GenBlocksGridVisitor genBlocks(gridCube);
-      grid->accept(genBlocks);
-
-      SPtr<GbObject3D> refCube(new GbCuboid3D(-0.02,-0.02,-0.02,0.02,0.02,0.02));
-      if (myid==0) GbSystem3D::writeGeoObject(refCube.get(), pathname+"/geo/refCube", WbWriterVtkXmlBinary::getInstance());
-
-      if (refineLevel>0)
-      {
-         if (myid==0) UBLOG(logINFO, "Refinement - start");
-         RefineCrossAndInsideGbObjectHelper refineHelper(grid, refineLevel, comm);
-         refineHelper.addGbObject(refCube, refineLevel);
-         refineHelper.refine();
-         if (myid==0) UBLOG(logINFO, "Refinement - end");
-      }
-
-      SPtr<CoProcessor> ppblocks(new WriteBlocksCoProcessor(grid, SPtr<UbScheduler>(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm));
-
-      SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B));
-      InteractorsHelper intHelper(grid, metisVisitor);
-      intHelper.selectBlocks();
-
-      ppblocks->process(0);
-      ppblocks.reset();
-
-
-      unsigned long long numberOfBlocks = (unsigned long long)grid->getNumberOfBlocks();
-      int ghostLayer = 3;
-      unsigned long long numberOfNodesPerBlock = (unsigned long long)(blocknx[0])* (unsigned long long)(blocknx[1])* (unsigned long long)(blocknx[2]);
-      unsigned long long numberOfNodes = numberOfBlocks * numberOfNodesPerBlock;
-      unsigned long long numberOfNodesPerBlockWithGhostLayer = numberOfBlocks * (blocknx[0] + ghostLayer) * (blocknx[1] + ghostLayer) * (blocknx[2] + ghostLayer);
-      double needMemAll = double(numberOfNodesPerBlockWithGhostLayer*(27 * sizeof(double) + sizeof(int) + sizeof(float) * 4));
-      double needMem = needMemAll / double(comm->getNumberOfProcesses());
-
-      if (myid == 0)
-      {
-         UBLOG(logINFO, "Number of blocks = " << numberOfBlocks);
-         UBLOG(logINFO, "Number of nodes  = " << numberOfNodes);
-         int minInitLevel = grid->getCoarsestInitializedLevel();
-         int maxInitLevel = grid->getFinestInitializedLevel();
-         for (int level = minInitLevel; level <= maxInitLevel; level++)
-         {
-            int nobl = grid->getNumberOfBlocks(level);
-            UBLOG(logINFO, "Number of blocks for level " << level << " = " << nobl);
-            UBLOG(logINFO, "Number of nodes for level " << level << " = " << nobl*numberOfNodesPerBlock);
-         }
-         UBLOG(logINFO, "Necessary memory  = " << needMemAll << " bytes");
-         UBLOG(logINFO, "Necessary memory per process = " << needMem << " bytes");
-         UBLOG(logINFO, "Available memory per process = " << availMem << " bytes");
-      }
-
-      double bulckViscosity = 10.0*nuLB;
-      SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new CompressibleCumulant4thOrderViscosityLBMKernel());
-      //dynamicPointerCast<CompressibleCumulant4thOrderViscosityLBMKernel>(kernel)->setBulkViscosity(bulckViscosity);
-      //SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new CompressibleCumulantLBMKernel());
-      //dynamicPointerCast<CompressibleCumulantLBMKernel>(kernel)->setBulkOmegaToOmega(true);
-      //
-      SPtr<BCProcessor> bcProcessor(new BCProcessor());
-
-      kernel->setBCProcessor(bcProcessor);
-
-      SetKernelBlockVisitor kernelVisitor(kernel, nuLB, availMem, needMem);
-      grid->accept(kernelVisitor);
-
-      if (refineLevel>0)
-      {
-         SetUndefinedNodesBlockVisitor undefNodesVisitor;
-         grid->accept(undefNodesVisitor);
-      }
-
-      //set connectors  
-     //SPtr<InterpolationProcessor> iProcessor(new CompressibleOffsetInterpolationProcessor());
-      SPtr<InterpolationProcessor> iProcessor(new CompressibleOffsetMomentsInterpolationProcessor());
-      //dynamicPointerCast<CompressibleOffsetMomentsInterpolationProcessor>(iProcessor)->setBulkViscosity(nuLB, bulckViscosity);
-      SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
-
-      UBLOG(logINFO, "SetConnectorsBlockVisitor:start");
-      grid->accept(setConnsVisitor);
-      UBLOG(logINFO, "SetConnectorsBlockVisitor:end");
-
-      mu::Parser fctRoh;
-      //z
-      //fctRoh.SetExpr("epsilon*exp(-alpha*(x1*x1+x2*x2))");
-      //x
-      //fctRoh.SetExpr("epsilon*exp(-alpha*(x3*x3+x2*x2))");
-      //y
-      fctRoh.SetExpr("epsilon*exp(-alpha*scaleFactor*(x3*x3+x1*x1))");
-      //fctRoh.SetExpr("epsilon*exp(-alpha*(x3*x3+x1*x1))");
-
-      fctRoh.DefineConst("epsilon", 1e-3);
-      fctRoh.DefineConst("alpha", log(2.0)/(0.01));
-      fctRoh.DefineConst("scaleFactor", 277.777777779);
-      //fctRoh.SetExpr("x1*0.001");
-
-      //initialization of distributions
-      InitDistributionsBlockVisitor initVisitor;
-      initVisitor.setRho(fctRoh);
-      grid->accept(initVisitor);
-
-      //Postrozess
-      SPtr<UbScheduler> geoSch(new UbScheduler(1));
-      SPtr<CoProcessor> ppgeo(new WriteBoundaryConditionsCoProcessor(grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), comm));
-      ppgeo->process(0);
-      ppgeo.reset();
-
-      if (myid==0) UBLOG(logINFO, "Preprozess - end");
-
-      if (myid == 0)
-      {
-         UBLOG(logINFO, "PID = " << myid << " Total Physical Memory (RAM): " << Utilities::getTotalPhysMem());
-         UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used: " << Utilities::getPhysMemUsed());
-         UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe());
-      }
-
-      SPtr<UbScheduler> visSch(new UbScheduler(outTime));
-      SPtr<WriteMacroscopicQuantitiesCoProcessor> writeMQCoProcessor(new WriteMacroscopicQuantitiesCoProcessor(grid, visSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, comm));
-      writeMQCoProcessor->process(0);
-
-      SPtr<UbScheduler> nupsSch(new UbScheduler(10, 30, 100));
-      std::shared_ptr<NUPSCounterCoProcessor> nupsCoProcessor(new NUPSCounterCoProcessor(grid, nupsSch, numOfThreads, comm));
-
-      SPtr<UbScheduler> stepGhostLayer(new UbScheduler(1));
-      SPtr<Calculator> calculator(new BasicCalculator(grid, stepGhostLayer, endTime));
-      calculator->addCoProcessor(nupsCoProcessor);
-      calculator->addCoProcessor(writeMQCoProcessor);
-
-      //omp_set_num_threads(1);
-
-      if (myid==0) UBLOG(logINFO, "Simulation-start");
-      calculator->calculate();
-      if (myid==0) UBLOG(logINFO, "Simulation-end");
-   }
-   catch (std::exception& e)
-   {
-      cerr << e.what() << endl << flush;
-   }
-   catch (std::string& s)
-   {
-      cerr << s << endl;
-   }
-   catch (...)
-   {
-      cerr << "unknown exception" << endl;
-   }
-
-}
-int main(int argc, char* argv[])
-{
-   run();
-}
-
+#include <iostream>
+#include <string>
+
+#include "VirtualFluids.h"
+
+using namespace std;
+
+
+void run()
+{
+   try
+   {
+      SPtr<Communicator> comm = MPICommunicator::getInstance();
+      int myid = comm->getProcessID();
+
+      int    numOfThreads = 4;
+      double availMem = 5e9;
+
+      //40
+      //string  pathname = "d:/temp/AcousticPulse40Cube2y_test";
+      //double  endTime = 20;
+      //double  outTime = 20;
+      //LBMReal dx =  0.05;
+
+      //80
+      //string  pathname = "d:/temp/AcousticPulse80Cube2y";
+      //double  endTime = 40;
+      //double  outTime = 40;
+      //LBMReal dx = 0.025;
+
+      //160
+      //string  pathname = "d:/temp/AcousticPulse160Cube2y";
+      //double  endTime = 80;
+      //double  outTime = 80;
+      //LBMReal dx = 0.0125;
+
+      //LBMReal dx = 0.1; 
+      //LBMReal dx = 1.66666666667e-2; //120
+      
+      //LBMReal rhoLB = 0.0;
+      //LBMReal nuLB = 3.97e-7;
+
+      //////////////////////////////////////////////////////////////////////////
+      //DLR-F16 test
+      ////dx_coarse = 0.003 mm
+      string  pathname = "d:/temp/AcousticPulseXZ-4th-0.003";
+      int     endTime = 20;
+      double  outTime = 20;
+      LBMReal dx =  0.003;
+      LBMReal rhoLB = 0.0;
+      LBMReal nuLB = 8.66025e-6;
+      //////////////////////////////////////////////////////////////////////////
+      ////dx_coarse = 0.0015 mm
+      //string  pathname = "d:/temp/AcousticPulseXZ-4th-0.0015";
+      //double  endTime = 40;
+      //double  outTime = 40;
+      //LBMReal dx =  0.0015;
+      //LBMReal rhoLB = 0.0;
+      //LBMReal nuLB = 8.66025e-6*2.0;
+      ////////////////////////////////////////////////////////////////////////////
+      ////dx_coarse = 0.00075 mm
+      //string  pathname = "d:/temp/AcousticPulseXZ-4th-0.00075";
+      //double  endTime = 80;
+      //double  outTime = 80;
+      //LBMReal dx =  0.00075;
+      //LBMReal rhoLB = 0.0;
+      //LBMReal nuLB = 8.66025e-6*4.0;
+      //////////////////////////////////////////////////////////////////////////
+
+      SPtr<LBMUnitConverter> conv = SPtr<LBMUnitConverter>(new LBMUnitConverter());
+
+      int baseLevel = 0;
+      int refineLevel = 1;
+
+      //bounding box
+      double g_minX1 = -0.06;
+      double g_minX2 = -0.06;
+      double g_minX3 = -0.06;
+
+      double g_maxX1 = 0.06;
+      double g_maxX2 = 0.06;
+      double g_maxX3 = 0.06;
+
+      //double g_minX1 = -1;
+      //double g_minX2 = -1;
+      //double g_minX3 = -1;
+
+      //double g_maxX1 = 1;
+      //double g_maxX2 = 1;
+      //double g_maxX3 = 1;
+
+      vector<int>  blocknx(3);
+      blocknx[0] = 10;
+      blocknx[1] = 10;
+      blocknx[2] = 10;
+
+      //geometry
+      SPtr<GbObject3D> gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
+      if (myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), pathname + "/geo/gridCube", WbWriterVtkXmlBinary::getInstance());
+
+
+      double blockLength = blocknx[0] * dx;
+
+      SPtr<Grid3D> grid(new Grid3D(comm));
+      grid->setDeltaX(dx);
+      grid->setBlockNX(blocknx[0], blocknx[1], blocknx[2]);
+      grid->setPeriodicX1(true);
+      grid->setPeriodicX2(true);
+      grid->setPeriodicX3(true);
+
+
+      GenBlocksGridVisitor genBlocks(gridCube);
+      grid->accept(genBlocks);
+
+      SPtr<GbObject3D> refCube(new GbCuboid3D(-0.02,-0.02,-0.02,0.02,0.02,0.02));
+      if (myid==0) GbSystem3D::writeGeoObject(refCube.get(), pathname+"/geo/refCube", WbWriterVtkXmlBinary::getInstance());
+
+      if (refineLevel>0)
+      {
+         if (myid==0) UBLOG(logINFO, "Refinement - start");
+         RefineCrossAndInsideGbObjectHelper refineHelper(grid, refineLevel, comm);
+         refineHelper.addGbObject(refCube, refineLevel);
+         refineHelper.refine();
+         if (myid==0) UBLOG(logINFO, "Refinement - end");
+      }
+
+      SPtr<CoProcessor> ppblocks(new WriteBlocksCoProcessor(grid, SPtr<UbScheduler>(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm));
+
+      SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B));
+      InteractorsHelper intHelper(grid, metisVisitor);
+      intHelper.selectBlocks();
+
+      ppblocks->process(0);
+      ppblocks.reset();
+
+
+      unsigned long long numberOfBlocks = (unsigned long long)grid->getNumberOfBlocks();
+      int ghostLayer = 3;
+      unsigned long long numberOfNodesPerBlock = (unsigned long long)(blocknx[0])* (unsigned long long)(blocknx[1])* (unsigned long long)(blocknx[2]);
+      unsigned long long numberOfNodes = numberOfBlocks * numberOfNodesPerBlock;
+      unsigned long long numberOfNodesPerBlockWithGhostLayer = numberOfBlocks * (blocknx[0] + ghostLayer) * (blocknx[1] + ghostLayer) * (blocknx[2] + ghostLayer);
+      double needMemAll = double(numberOfNodesPerBlockWithGhostLayer*(27 * sizeof(double) + sizeof(int) + sizeof(float) * 4));
+      double needMem = needMemAll / double(comm->getNumberOfProcesses());
+
+      if (myid == 0)
+      {
+         UBLOG(logINFO, "Number of blocks = " << numberOfBlocks);
+         UBLOG(logINFO, "Number of nodes  = " << numberOfNodes);
+         int minInitLevel = grid->getCoarsestInitializedLevel();
+         int maxInitLevel = grid->getFinestInitializedLevel();
+         for (int level = minInitLevel; level <= maxInitLevel; level++)
+         {
+            int nobl = grid->getNumberOfBlocks(level);
+            UBLOG(logINFO, "Number of blocks for level " << level << " = " << nobl);
+            UBLOG(logINFO, "Number of nodes for level " << level << " = " << nobl*numberOfNodesPerBlock);
+         }
+         UBLOG(logINFO, "Necessary memory  = " << needMemAll << " bytes");
+         UBLOG(logINFO, "Necessary memory per process = " << needMem << " bytes");
+         UBLOG(logINFO, "Available memory per process = " << availMem << " bytes");
+      }
+
+      double bulckViscosity = 10.0*nuLB;
+      SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new CompressibleCumulant4thOrderViscosityLBMKernel());
+      //dynamicPointerCast<CompressibleCumulant4thOrderViscosityLBMKernel>(kernel)->setBulkViscosity(bulckViscosity);
+      //SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new CompressibleCumulantLBMKernel());
+      //dynamicPointerCast<CompressibleCumulantLBMKernel>(kernel)->setBulkOmegaToOmega(true);
+      //
+      SPtr<BCProcessor> bcProcessor(new BCProcessor());
+
+      kernel->setBCProcessor(bcProcessor);
+
+      SetKernelBlockVisitor kernelVisitor(kernel, nuLB, availMem, needMem);
+      grid->accept(kernelVisitor);
+
+      if (refineLevel>0)
+      {
+         SetUndefinedNodesBlockVisitor undefNodesVisitor;
+         grid->accept(undefNodesVisitor);
+      }
+
+      //set connectors  
+     //SPtr<InterpolationProcessor> iProcessor(new CompressibleOffsetInterpolationProcessor());
+      SPtr<InterpolationProcessor> iProcessor(new CompressibleOffsetMomentsInterpolationProcessor());
+      //dynamicPointerCast<CompressibleOffsetMomentsInterpolationProcessor>(iProcessor)->setBulkViscosity(nuLB, bulckViscosity);
+      SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
+
+      UBLOG(logINFO, "SetConnectorsBlockVisitor:start");
+      grid->accept(setConnsVisitor);
+      UBLOG(logINFO, "SetConnectorsBlockVisitor:end");
+
+      mu::Parser fctRoh;
+      //z
+      //fctRoh.SetExpr("epsilon*exp(-alpha*(x1*x1+x2*x2))");
+      //x
+      //fctRoh.SetExpr("epsilon*exp(-alpha*(x3*x3+x2*x2))");
+      //y
+      fctRoh.SetExpr("epsilon*exp(-alpha*scaleFactor*(x3*x3+x1*x1))");
+      //fctRoh.SetExpr("epsilon*exp(-alpha*(x3*x3+x1*x1))");
+
+      fctRoh.DefineConst("epsilon", 1e-3);
+      fctRoh.DefineConst("alpha", log(2.0)/(0.01));
+      fctRoh.DefineConst("scaleFactor", 277.777777779);
+      //fctRoh.SetExpr("x1*0.001");
+
+      //initialization of distributions
+      InitDistributionsBlockVisitor initVisitor;
+      initVisitor.setRho(fctRoh);
+      grid->accept(initVisitor);
+
+      //Postrozess
+      SPtr<UbScheduler> geoSch(new UbScheduler(1));
+      SPtr<CoProcessor> ppgeo(new WriteBoundaryConditionsCoProcessor(grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), comm));
+      ppgeo->process(0);
+      ppgeo.reset();
+
+      if (myid==0) UBLOG(logINFO, "Preprozess - end");
+
+      if (myid == 0)
+      {
+         UBLOG(logINFO, "PID = " << myid << " Total Physical Memory (RAM): " << Utilities::getTotalPhysMem());
+         UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used: " << Utilities::getPhysMemUsed());
+         UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe());
+      }
+
+      SPtr<UbScheduler> visSch(new UbScheduler(outTime));
+      SPtr<WriteMacroscopicQuantitiesCoProcessor> writeMQCoProcessor(new WriteMacroscopicQuantitiesCoProcessor(grid, visSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, comm));
+      writeMQCoProcessor->process(0);
+
+      SPtr<UbScheduler> nupsSch(new UbScheduler(10, 30, 100));
+      std::shared_ptr<NUPSCounterCoProcessor> nupsCoProcessor(new NUPSCounterCoProcessor(grid, nupsSch, numOfThreads, comm));
+
+      SPtr<UbScheduler> stepGhostLayer(new UbScheduler(1));
+      SPtr<Calculator> calculator(new BasicCalculator(grid, stepGhostLayer, endTime));
+      calculator->addCoProcessor(nupsCoProcessor);
+      calculator->addCoProcessor(writeMQCoProcessor);
+
+      //omp_set_num_threads(1);
+
+      if (myid==0) UBLOG(logINFO, "Simulation-start");
+      calculator->calculate();
+      if (myid==0) UBLOG(logINFO, "Simulation-end");
+   }
+   catch (std::exception& e)
+   {
+      cerr << e.what() << endl << flush;
+   }
+   catch (std::string& s)
+   {
+      cerr << s << endl;
+   }
+   catch (...)
+   {
+      cerr << "unknown exception" << endl;
+   }
+
+}
+int main(int argc, char* argv[])
+{
+   run();
+}
+
diff --git a/apps/cpu/BeadPack/CMakeLists.txt b/apps/cpu/BeadPack/CMakeLists.txt
index 4a12b93fe4e384840145d2ae1d96c85bd12ef9c0..a0df3f7a5f9960c99e42f10f7e96adf0e54c24f2 100644
--- a/apps/cpu/BeadPack/CMakeLists.txt
+++ b/apps/cpu/BeadPack/CMakeLists.txt
@@ -1,25 +1,25 @@
-CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
-
-########################################################
-## C++ PROJECT                                       ###
-########################################################
-PROJECT(beadpack)
-
-INCLUDE(${SOURCE_ROOT}/lib/IncludsList.txt) 
-
-#################################################################
-###   LOCAL FILES                                             ###
-#################################################################
-FILE(GLOB SPECIFIC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.h
-                         ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
-                         ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp  )
- 
-SET(ALL_SOURCES ${ALL_SOURCES} ${SPECIFIC_FILES})
-SOURCE_GROUP(src FILES ${SPECIFIC_FILES})
-  
-SET(CAB_ADDITIONAL_LINK_LIBRARIES vfluids)
-
-#################################################################
-###   CREATE PROJECT                                          ###
-#################################################################
-CREATE_CAB_PROJECT(beadpack BINARY)
+CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
+
+########################################################
+## C++ PROJECT                                       ###
+########################################################
+PROJECT(beadpack)
+
+INCLUDE(${SOURCE_ROOT}/lib/IncludsList.txt) 
+
+#################################################################
+###   LOCAL FILES                                             ###
+#################################################################
+FILE(GLOB SPECIFIC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.h
+                         ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
+                         ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp  )
+ 
+SET(ALL_SOURCES ${ALL_SOURCES} ${SPECIFIC_FILES})
+SOURCE_GROUP(src FILES ${SPECIFIC_FILES})
+  
+SET(CAB_ADDITIONAL_LINK_LIBRARIES vfluids)
+
+#################################################################
+###   CREATE PROJECT                                          ###
+#################################################################
+CREATE_CAB_PROJECT(beadpack BINARY)
diff --git a/apps/cpu/BeadPack/beadpack.cpp b/apps/cpu/BeadPack/beadpack.cpp
index e4c95117a9597a30becaa1a1e63c83bb10d9674e..09980876882a1ceb2b555256ddf891cd00f08384 100644
--- a/apps/cpu/BeadPack/beadpack.cpp
+++ b/apps/cpu/BeadPack/beadpack.cpp
@@ -1,438 +1,438 @@
-#include <iostream>
-#include <string>
-
-#include <vfluids.h>
-
-using namespace std;
-
-
-void sbonepd(const char *configname)
-{
-   try
-   {
-
-      string machine = QUOTEME(CAB_MACHINE);
-      string pathname, pathGeo;
-      int numOfThreads;
-      double availMem;
-
-      ConfigFileReader cf(configname);
-      if (!cf.read())
-      {
-         std::string exceptionText = "Unable to read configuration file\n";
-         throw exceptionText;
-      }
-
-      CommunicatorPtr comm = MPICommunicator::getInstance();
-      int myid = comm->getProcessID();
-
-      if (machine == "BOMBADIL")
-      {
-         numOfThreads = 4;
-         pathname = "d:/temp/bbone";
-         pathGeo = "d:/Data/Bone/BigBone";
-         availMem = 15.0e9;
-      }
-      else if (machine == "M01" || machine == "M02")
-      {
-         numOfThreads = 8;
-         pathname = cf.getValue("pathname");
-         pathGeo = cf.getValue("pathGeo");
-         availMem = 12.0e9;
-
-#if defined(__unix__)
-         if (myid == 0)
-         {
-            const char* str = pathname.c_str();
-            int status = mkdir(str, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
-         }
-#endif 
-
-         if (myid == 0)
-         {
-            stringstream logFilename;
-            logFilename << pathname + "/logfile" + UbSystem::toString(UbSystem::getTimeStamp()) + ".txt";
-            UbLog::output_policy::setStream(logFilename.str());
-         }
-      }
-      else throw UbException(UB_EXARGS, "unknown CAB_MACHINE");
-
-
-
-      if (myid == 0) UBLOG(logINFO, "Testcase big bone");
-
-      Grid3DPtr grid(new Grid3D(comm));
-      double deltaVoxel = 11.658e-6;
-
-      double dx = deltaVoxel;
-
-      const int blocknx1 = 64;
-      const int blocknx2 = 64;
-      const int blocknx3 = 64;
-
-      LBMReal rho_LB = 0.0;
-      //nueWasser = 1e-6 m^2/s
-      double nu_real = 1e-6;
-      LBMReal dt = 5e-8; // s (frei gewählt)
-      //dx - frei gewählt
-      //
-      LBMReal nu_LB = nu_real / (dx*dx / dt);
-
-
-      //dp = 50000 Pa - 0 Pa = 50000 Pa
-      double dp_real = UbSystem::stringTo<double>(cf.getValue("pressure")); //5000;
-      //rho wasser = 1000 kg*m^-3
-      double rho_real = 1000;
-      //dp/rho = 50000/1000 = 50 m^2/s^2
-      double dp_div_rho_real = dp_real / rho_real;
-
-      double dp_LB = dp_div_rho_real / ((dx / dt)*(dx / dt));
-
-      bool with_forcing = true;
-
-      double rhoLBinflow;
-      if (with_forcing)
-      {
-         rhoLBinflow = 0.0;
-      }
-      else
-      {
-         rhoLBinflow = dp_LB*3.0;
-      }
-      double deltax = dx;
-
-      LBMUnitConverterPtr conv = LBMUnitConverterPtr(new LBMUnitConverter());
-
-      const int baseLevel = 0;
-      const int refineLevel = 0;
-
-      double coord[6];
-
-      //////////////////////////////////////////////////////////////////////////
-      //restart
-      UbSchedulerPtr rSch(new UbScheduler(50000, 50000, 10000000));
-      RestartPostprocessor rp(grid, rSch, comm, pathname, RestartPostprocessor::BINARY);
-      //////////////////////////////////////////////////////////////////////////
-
-      if (grid->getTimeStep() == 0)
-      {
-         if (myid == 0) UBLOG(logINFO, "Neustart..");
-
-         string boneFilename = pathGeo + "/cyl_bone2.raw";
-
-         int pmNX1 = 1164;  //abmessung einzelbild in x-richtung
-         int pmNX2 = 972; //abmessung einzelbild in y richtung
-         int pmNX3 = 900; //anzahl der bilder
-         //int pmNX3 = 10; //anzahl der bilder
-         float lthreshold = 109.0;
-         float uthreshold = 255.0;
-
-         GbVoxelMatrix3DPtr bone(new GbVoxelMatrix3D(pmNX1, pmNX2, pmNX3, 0, lthreshold, uthreshold));
-         bone->readMatrixFromRawFile<unsigned char>(boneFilename, GbVoxelMatrix3D::BigEndian);
-
-         
-         bone->setVoxelMatrixDelta(deltaVoxel, deltaVoxel, deltaVoxel);
-
-         bone->setVoxelMatrixMininum(0.0, 0.0, 0.0);
-
-         if (myid == 0) bone->writeToVTKImageDataASCII(pathname + "/geo/bone");
-
-         ///////////////////////////////////////////////////////
-
-         ////////////////////////////////////////////////////////////////////////
-
-         double offset = 0.5e-3;
-         //bounding box
-         double g_minX1 = bone->getX1Minimum();
-         double g_minX2 = bone->getX2Minimum();
-         double g_minX3 = bone->getX3Minimum() - offset;
-
-         double g_maxX1 = bone->getX1Maximum();
-         double g_maxX2 = bone->getX2Maximum();
-         double g_maxX3 = bone->getX3Maximum() + offset;
-
-         double blockLength = (double)blocknx1*deltax;
-
-         grid->setPeriodicX1(false);
-         grid->setPeriodicX2(false);
-         grid->setPeriodicX3(true);
-         grid->setDeltaX(deltax);
-         grid->setBlockNX(blocknx1, blocknx2, blocknx3);
-
-         GbObject3DPtr gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
-         if (myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), pathname + "/geo/gridCube", WbWriterVtkXmlBinary::getInstance());
-
-
-         GenBlocksGridVisitor genBlocks(gridCube);
-         grid->accept(genBlocks);
-
-         double forcing = 0;
-         if (with_forcing)
-         {
-            forcing = dp_LB / (blocknx3*grid->getNX3());
-         }
-
-         if (myid == 0)
-         {
-            UBLOG(logINFO, "Parameters:");
-            UBLOG(logINFO, "with forcing = " << with_forcing);
-            UBLOG(logINFO, "rho_LB = " << rho_LB);
-            UBLOG(logINFO, "nu_LB = " << nu_LB);
-            UBLOG(logINFO, "dp_LB = " << dp_LB);
-            UBLOG(logINFO, "forcing = " << forcing);
-            UBLOG(logINFO, "dx = " << dx << " m");
-            UBLOG(logINFO, "dt = " << dt << " s");
-            UBLOG(logINFO, "rho_real = " << rho_real << " kg*m^-3");
-            UBLOG(logINFO, "nu_real = " << nu_real << " m^2/s");
-            UBLOG(logINFO, "dp_real = " << dp_real << " Pa");
-
-            UBLOG(logINFO, "number of levels = " << refineLevel + 1);
-            UBLOG(logINFO, "numOfThreads = " << numOfThreads);
-            UBLOG(logINFO, "path = " << pathname);
-            UBLOG(logINFO, "Preprozess - start");
-         }
-
-         //cylinder
-         double radius = 0.0036;
-         double cx1 = 0.007;
-         double cx2 = 0.0046;
-
-         GbObject3DPtr cylinder(new GbCylinder3D(cx1, cx2, g_minX3 - offset, cx1, cx2, g_maxX3 + offset, radius));
-         GbSystem3D::writeGeoObject(cylinder.get(), pathname + "/geo/cylinder", WbWriterVtkXmlBinary::getInstance());
-
-         //inflow
-         GbCuboid3DPtr geoInflow(new GbCuboid3D(g_minX1 - blockLength, g_minX2 - blockLength, g_minX3 - blockLength, g_maxX1 + blockLength, g_maxX2 + blockLength, g_minX3));
-         if (myid == 0) GbSystem3D::writeGeoObject(geoInflow.get(), pathname + "/geo/geoInflow", WbWriterVtkXmlASCII::getInstance());
-
-         //outflow
-         GbCuboid3DPtr geoOutflow(new GbCuboid3D(g_minX1 - blockLength, g_minX2 - blockLength, g_maxX3, g_maxX1 + blockLength, g_maxX2 + blockLength, g_maxX3 + blockLength));
-         if (myid == 0) GbSystem3D::writeGeoObject(geoOutflow.get(), pathname + "/geo/geoOutflow", WbWriterVtkXmlASCII::getInstance());
-
-         BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm));
-
-         //bone interactor
-         int bcOptionBone = 0; //0=simple Bounce Back, 1=quadr. BB, 2=thin wall
-         D3Q27BoundaryConditionAdapterPtr bcBone(new D3Q27NoSlipBCAdapter(bcOptionBone));
-         D3Q27InteractorPtr boneInt(new D3Q27Interactor(bone, grid, bcBone, Interactor3D::SOLID));
-
-         //wall interactors
-         int bcOptionWall = 0; //0=simple Bounce Back, 1=quadr. BB, 2=thin wall
-         D3Q27BoundaryConditionAdapterPtr bcWall(new D3Q27NoSlipBCAdapter(bcOptionWall));
-         D3Q27InteractorPtr cylInt(new D3Q27Interactor(cylinder, grid, bcWall, Interactor3D::INVERSESOLID));
-
-         D3Q27BoundaryConditionAdapterPtr denBCAdapterInflow(new D3Q27DensityBCAdapter(rhoLBinflow));
-         denBCAdapterInflow->setSecondaryBcOption(0);
-         D3Q27InteractorPtr inflowInt = D3Q27InteractorPtr(new D3Q27Interactor(geoInflow, grid, denBCAdapterInflow, Interactor3D::SOLID));
-
-         //outflow
-         D3Q27BoundaryConditionAdapterPtr denBCAdapterOutflow(new D3Q27DensityBCAdapter(rho_LB));
-         denBCAdapterOutflow->setSecondaryBcOption(0);
-         D3Q27InteractorPtr outflowInt = D3Q27InteractorPtr(new D3Q27Interactor(geoOutflow, grid, denBCAdapterOutflow, Interactor3D::SOLID));
-
-         ////////////////////////////////////////////
-         //METIS
-         Grid3DVisitorPtr metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::BSW));
-         ////////////////////////////////////////////
-         /////delete solid blocks
-         if (myid == 0) UBLOG(logINFO, "deleteSolidBlocks - start");
-         InteractorsHelper intHelper(grid, metisVisitor);
-         intHelper.addInteractor(boneInt);
-         intHelper.addInteractor(cylInt);
-         intHelper.addInteractor(inflowInt);
-         intHelper.addInteractor(outflowInt);
-         intHelper.selectBlocks();
-         if (myid == 0) UBLOG(logINFO, "deleteSolidBlocks - end");
-         //////////////////////////////////////
-
-         //set connectors
-         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
-         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nu_LB, iProcessor);
-         grid->accept(setConnsVisitor);
-
-         //domain decomposition for threads
-         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
-         grid->accept(pqPartVisitor);
-
-         ppblocks->update(0);
-         ppblocks.reset();
-
-         unsigned long nob = grid->getNumberOfBlocks();
-         int gl = 3;
-         unsigned long nodb = (blocknx1)* (blocknx2)* (blocknx3);
-         unsigned long nod = nob * (blocknx1)* (blocknx2)* (blocknx3);
-         unsigned long nodg = nob * (blocknx1 + gl) * (blocknx2 + gl) * (blocknx3 + gl);
-         double needMemAll = double(nodg*(27 * sizeof(double) + sizeof(int) + sizeof(float) * 4));
-         double needMem = needMemAll / double(comm->getNumberOfProcesses());
-
-         if (myid == 0)
-         {
-            UBLOG(logINFO, "Number of blocks = " << nob);
-            UBLOG(logINFO, "Number of nodes  = " << nod);
-            int minInitLevel = grid->getCoarsestInitializedLevel();
-            int maxInitLevel = grid->getFinestInitializedLevel();
-            for (int level = minInitLevel; level <= maxInitLevel; level++)
-            {
-               int nobl = grid->getNumberOfBlocks(level);
-               UBLOG(logINFO, "Number of blocks for level " << level << " = " << nobl);
-               UBLOG(logINFO, "Number of nodes for level " << level << " = " << nobl*nodb);
-            }
-            UBLOG(logINFO, "Necessary memory  = " << needMemAll << " bytes");
-            UBLOG(logINFO, "Necessary memory per process = " << needMem << " bytes");
-            UBLOG(logINFO, "Available memory per process = " << availMem << " bytes");
-         }
-
-         LBMKernel3DPtr kernel = LBMKernel3DPtr(new LBMKernelETD3Q27CCLB(blocknx1, blocknx2, blocknx3, LBMKernelETD3Q27CCLB::NORMAL));
-
-         mu::Parser fctForcingX3;
-         fctForcingX3.SetExpr("Fx3");
-         fctForcingX3.DefineConst("Fx3", forcing);
-
-         kernel->setForcingX3(fctForcingX3);
-         kernel->setWithForcing(true);
-
-         //BCProcessorPtr bcProc(new D3Q27ETForThinWallBCProcessor());
-         BCProcessorPtr bcProc(new D3Q27ETBCProcessor());
-         kernel->setBCProcessor(bcProc);
-
-         SetKernelBlockVisitor kernelVisitor(kernel, nu_LB, availMem, needMem);
-         grid->accept(kernelVisitor);
-
-
-         //BC
-         intHelper.setBC();
-
-         //Press*1.6e8+(14.76-coordsX)/3.5*5000
-         //initialization of distributions
-         //mu::Parser fct;
-         //fct.SetExpr("(x1max-x1)/l*dp*3.0");
-         //fct.DefineConst("dp", dp_LB);
-         //fct.DefineConst("x3max", g_maxX3);
-         //fct.DefineConst("l", g_maxX3-g_minX3);
-
-         D3Q27ETInitDistributionsBlockVisitor initVisitor(nu_LB, rho_LB);
-         //initVisitor.setRho(fct);
-         //initVisitor.setVx1(fct);
-         initVisitor.setVx1(0.0);
-         grid->accept(initVisitor);
-
-         //Postrozess
-         UbSchedulerPtr geoSch(new UbScheduler(1));
-         D3Q27MacroscopicQuantitiesPostprocessorPtr ppgeo(
-            new D3Q27MacroscopicQuantitiesPostprocessor(grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, true));
-         ppgeo->update(0);
-         ppgeo.reset();
-
-
-         coord[0] = bone->getX1Minimum();
-         coord[1] = bone->getX2Minimum();
-         coord[2] = cylinder->getX3Centroid();
-         coord[3] = bone->getX1Maximum();
-         coord[4] = bone->getX2Maximum();
-         coord[5] = cylinder->getX3Centroid();
-
-         ////////////////////////////////////////////////////////
-         FILE * pFile;
-         string str = pathname + "/checkpoints/coord.txt";
-         pFile = fopen(str.c_str(), "w");
-         fprintf(pFile, "%f\n", coord[0]);
-         fprintf(pFile, "%f\n", coord[1]);
-         fprintf(pFile, "%f\n", coord[2]);
-         fprintf(pFile, "%f\n", coord[3]);
-         fprintf(pFile, "%f\n", coord[4]);
-         fprintf(pFile, "%f\n", coord[5]);
-         fclose(pFile);
-         ////////////////////////////////////////////////////////
-
-         if (myid == 0) UBLOG(logINFO, "Preprozess - end");
-      }
-      else
-      {
-         //set connectors
-         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
-         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nu_LB, iProcessor);
-         grid->accept(setConnsVisitor);
-
-         ////////////////////////////////////////////////////////
-         FILE * pFile;
-         string str = pathname + "/checkpoints/coord.txt";
-         pFile = fopen(str.c_str(), "r");
-         fscanf(pFile, "%f\n", &coord[0]);
-         fscanf(pFile, "%f\n", &coord[1]);
-         fscanf(pFile, "%f\n", &coord[2]);
-         fscanf(pFile, "%f\n", &coord[3]);
-         fscanf(pFile, "%f\n", &coord[4]);
-         fscanf(pFile, "%f\n", &coord[5]);
-         fclose(pFile);
-         ////////////////////////////////////////////////////////
-
-         if (myid == 0) UBLOG(logINFO, "Restart - end");
-      }
-      UbSchedulerPtr nupsSch(new UbScheduler(10, 30, 100));
-      NUPSCounterPostprocessor npr(grid, nupsSch, numOfThreads, comm);
-
-      double outTime = 30000;
-      UbSchedulerPtr stepSch(new UbScheduler(outTime));
-      stepSch->addSchedule(10, 10, 10);
-      stepSch->addSchedule(100, 100, 100);
-      stepSch->addSchedule(1000, 1000, 1000);
-      stepSch->addSchedule(100, 1500, 2000);
-      stepSch->addSchedule(10000, 10000, 10000);
-
-      D3Q27MacroscopicQuantitiesPostprocessor pp(grid, stepSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv);
-
-      double dxd2 = deltax / 2.0;
-      D3Q27IntegrateValuesHelperPtr ih1(new D3Q27IntegrateValuesHelper(grid, comm, coord[0] - dxd2, coord[1] - dxd2, coord[2] - dxd2,
-         coord[3] + dxd2, coord[4] + dxd2, coord[5] + dxd2));
-      if (myid == 0) GbSystem3D::writeGeoObject(ih1->getBoundingBox().get(), pathname + "/geo/ih1", WbWriterVtkXmlBinary::getInstance());
-
-      double factorp = dp_real / dp_LB;
-      double factorv = dx / dt;
-      UbSchedulerPtr stepMV(new UbScheduler(100));
-      D3Q27MeanValuesPostprocessor mvp1(grid, stepMV, pathname + "/mv/mv1.txt", comm, ih1, factorp, factorv);
-
-
-      //D3Q27IntegrateValuesHelperPtr ih2(new D3Q27IntegrateValuesHelper(grid, comm, g_maxX1-2.0*deltax, g_minX2, g_minX3,
-      //   g_maxX1 - deltax, g_maxX2, g_maxX3));
-      //if (myid == 0) GbSystem3D::writeGeoObject(ih2->getBoundingBox().get(), pathname + "/geo/ih2", WbWriterVtkXmlBinary::getInstance());
-
-      //D3Q27MeanValuesPostprocessor mvp2(grid, stepSch, pathname + "/mv/mv2.txt", comm, ih2, factorp, factorv);
-
-      if (myid == 0)
-      {
-         UBLOG(logINFO, "PID = " << myid << " Total Physical Memory (RAM): " << Utilities::getTotalPhysMem());
-         UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used: " << Utilities::getPhysMemUsed());
-         UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe());
-      }
-
-      double endTime = UbSystem::stringTo<double>(cf.getValue("endTime")); //100001;//10001.0;
-
-      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, stepMV));
-      if (myid == 0) UBLOG(logINFO, "Simulation-start");
-      calculation->calculate();
-      if (myid == 0) UBLOG(logINFO, "Simulation-end");
-   }
-   catch (exception& e)
-   {
-      cerr << e.what() << endl << flush;
-   }
-   catch (string& s)
-   {
-      cerr << s << endl;
-   }
-   catch (...)
-   {
-      cerr << "unknown exception" << endl;
-   }
-
-}
-//////////////////////////////////////////////////////////////////////////
-int main(int argc, char* argv[])
-{
-
-   if (argv != NULL)
-   {
-      sbonepd(argv[1]);
-   }
-
-   return 0;
-}
+#include <iostream>
+#include <string>
+
+#include <vfluids.h>
+
+using namespace std;
+
+
+void sbonepd(const char *configname)
+{
+   try
+   {
+
+      string machine = QUOTEME(CAB_MACHINE);
+      string pathname, pathGeo;
+      int numOfThreads;
+      double availMem;
+
+      ConfigFileReader cf(configname);
+      if (!cf.read())
+      {
+         std::string exceptionText = "Unable to read configuration file\n";
+         throw exceptionText;
+      }
+
+      CommunicatorPtr comm = MPICommunicator::getInstance();
+      int myid = comm->getProcessID();
+
+      if (machine == "BOMBADIL")
+      {
+         numOfThreads = 4;
+         pathname = "d:/temp/bbone";
+         pathGeo = "d:/Data/Bone/BigBone";
+         availMem = 15.0e9;
+      }
+      else if (machine == "M01" || machine == "M02")
+      {
+         numOfThreads = 8;
+         pathname = cf.getValue("pathname");
+         pathGeo = cf.getValue("pathGeo");
+         availMem = 12.0e9;
+
+#if defined(__unix__)
+         if (myid == 0)
+         {
+            const char* str = pathname.c_str();
+            int status = mkdir(str, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
+         }
+#endif 
+
+         if (myid == 0)
+         {
+            stringstream logFilename;
+            logFilename << pathname + "/logfile" + UbSystem::toString(UbSystem::getTimeStamp()) + ".txt";
+            UbLog::output_policy::setStream(logFilename.str());
+         }
+      }
+      else throw UbException(UB_EXARGS, "unknown CAB_MACHINE");
+
+
+
+      if (myid == 0) UBLOG(logINFO, "Testcase big bone");
+
+      Grid3DPtr grid(new Grid3D(comm));
+      double deltaVoxel = 11.658e-6;
+
+      double dx = deltaVoxel;
+
+      const int blocknx1 = 64;
+      const int blocknx2 = 64;
+      const int blocknx3 = 64;
+
+      LBMReal rho_LB = 0.0;
+      //nueWasser = 1e-6 m^2/s
+      double nu_real = 1e-6;
+      LBMReal dt = 5e-8; // s (frei gewählt)
+      //dx - frei gewählt
+      //
+      LBMReal nu_LB = nu_real / (dx*dx / dt);
+
+
+      //dp = 50000 Pa - 0 Pa = 50000 Pa
+      double dp_real = UbSystem::stringTo<double>(cf.getValue("pressure")); //5000;
+      //rho wasser = 1000 kg*m^-3
+      double rho_real = 1000;
+      //dp/rho = 50000/1000 = 50 m^2/s^2
+      double dp_div_rho_real = dp_real / rho_real;
+
+      double dp_LB = dp_div_rho_real / ((dx / dt)*(dx / dt));
+
+      bool with_forcing = true;
+
+      double rhoLBinflow;
+      if (with_forcing)
+      {
+         rhoLBinflow = 0.0;
+      }
+      else
+      {
+         rhoLBinflow = dp_LB*3.0;
+      }
+      double deltax = dx;
+
+      LBMUnitConverterPtr conv = LBMUnitConverterPtr(new LBMUnitConverter());
+
+      const int baseLevel = 0;
+      const int refineLevel = 0;
+
+      double coord[6];
+
+      //////////////////////////////////////////////////////////////////////////
+      //restart
+      UbSchedulerPtr rSch(new UbScheduler(50000, 50000, 10000000));
+      RestartPostprocessor rp(grid, rSch, comm, pathname, RestartPostprocessor::BINARY);
+      //////////////////////////////////////////////////////////////////////////
+
+      if (grid->getTimeStep() == 0)
+      {
+         if (myid == 0) UBLOG(logINFO, "Neustart..");
+
+         string boneFilename = pathGeo + "/cyl_bone2.raw";
+
+         int pmNX1 = 1164;  //abmessung einzelbild in x-richtung
+         int pmNX2 = 972; //abmessung einzelbild in y richtung
+         int pmNX3 = 900; //anzahl der bilder
+         //int pmNX3 = 10; //anzahl der bilder
+         float lthreshold = 109.0;
+         float uthreshold = 255.0;
+
+         GbVoxelMatrix3DPtr bone(new GbVoxelMatrix3D(pmNX1, pmNX2, pmNX3, 0, lthreshold, uthreshold));
+         bone->readMatrixFromRawFile<unsigned char>(boneFilename, GbVoxelMatrix3D::BigEndian);
+
+         
+         bone->setVoxelMatrixDelta(deltaVoxel, deltaVoxel, deltaVoxel);
+
+         bone->setVoxelMatrixMininum(0.0, 0.0, 0.0);
+
+         if (myid == 0) bone->writeToVTKImageDataASCII(pathname + "/geo/bone");
+
+         ///////////////////////////////////////////////////////
+
+         ////////////////////////////////////////////////////////////////////////
+
+         double offset = 0.5e-3;
+         //bounding box
+         double g_minX1 = bone->getX1Minimum();
+         double g_minX2 = bone->getX2Minimum();
+         double g_minX3 = bone->getX3Minimum() - offset;
+
+         double g_maxX1 = bone->getX1Maximum();
+         double g_maxX2 = bone->getX2Maximum();
+         double g_maxX3 = bone->getX3Maximum() + offset;
+
+         double blockLength = (double)blocknx1*deltax;
+
+         grid->setPeriodicX1(false);
+         grid->setPeriodicX2(false);
+         grid->setPeriodicX3(true);
+         grid->setDeltaX(deltax);
+         grid->setBlockNX(blocknx1, blocknx2, blocknx3);
+
+         GbObject3DPtr gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
+         if (myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), pathname + "/geo/gridCube", WbWriterVtkXmlBinary::getInstance());
+
+
+         GenBlocksGridVisitor genBlocks(gridCube);
+         grid->accept(genBlocks);
+
+         double forcing = 0;
+         if (with_forcing)
+         {
+            forcing = dp_LB / (blocknx3*grid->getNX3());
+         }
+
+         if (myid == 0)
+         {
+            UBLOG(logINFO, "Parameters:");
+            UBLOG(logINFO, "with forcing = " << with_forcing);
+            UBLOG(logINFO, "rho_LB = " << rho_LB);
+            UBLOG(logINFO, "nu_LB = " << nu_LB);
+            UBLOG(logINFO, "dp_LB = " << dp_LB);
+            UBLOG(logINFO, "forcing = " << forcing);
+            UBLOG(logINFO, "dx = " << dx << " m");
+            UBLOG(logINFO, "dt = " << dt << " s");
+            UBLOG(logINFO, "rho_real = " << rho_real << " kg*m^-3");
+            UBLOG(logINFO, "nu_real = " << nu_real << " m^2/s");
+            UBLOG(logINFO, "dp_real = " << dp_real << " Pa");
+
+            UBLOG(logINFO, "number of levels = " << refineLevel + 1);
+            UBLOG(logINFO, "numOfThreads = " << numOfThreads);
+            UBLOG(logINFO, "path = " << pathname);
+            UBLOG(logINFO, "Preprozess - start");
+         }
+
+         //cylinder
+         double radius = 0.0036;
+         double cx1 = 0.007;
+         double cx2 = 0.0046;
+
+         GbObject3DPtr cylinder(new GbCylinder3D(cx1, cx2, g_minX3 - offset, cx1, cx2, g_maxX3 + offset, radius));
+         GbSystem3D::writeGeoObject(cylinder.get(), pathname + "/geo/cylinder", WbWriterVtkXmlBinary::getInstance());
+
+         //inflow
+         GbCuboid3DPtr geoInflow(new GbCuboid3D(g_minX1 - blockLength, g_minX2 - blockLength, g_minX3 - blockLength, g_maxX1 + blockLength, g_maxX2 + blockLength, g_minX3));
+         if (myid == 0) GbSystem3D::writeGeoObject(geoInflow.get(), pathname + "/geo/geoInflow", WbWriterVtkXmlASCII::getInstance());
+
+         //outflow
+         GbCuboid3DPtr geoOutflow(new GbCuboid3D(g_minX1 - blockLength, g_minX2 - blockLength, g_maxX3, g_maxX1 + blockLength, g_maxX2 + blockLength, g_maxX3 + blockLength));
+         if (myid == 0) GbSystem3D::writeGeoObject(geoOutflow.get(), pathname + "/geo/geoOutflow", WbWriterVtkXmlASCII::getInstance());
+
+         BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm));
+
+         //bone interactor
+         int bcOptionBone = 0; //0=simple Bounce Back, 1=quadr. BB, 2=thin wall
+         D3Q27BoundaryConditionAdapterPtr bcBone(new D3Q27NoSlipBCAdapter(bcOptionBone));
+         D3Q27InteractorPtr boneInt(new D3Q27Interactor(bone, grid, bcBone, Interactor3D::SOLID));
+
+         //wall interactors
+         int bcOptionWall = 0; //0=simple Bounce Back, 1=quadr. BB, 2=thin wall
+         D3Q27BoundaryConditionAdapterPtr bcWall(new D3Q27NoSlipBCAdapter(bcOptionWall));
+         D3Q27InteractorPtr cylInt(new D3Q27Interactor(cylinder, grid, bcWall, Interactor3D::INVERSESOLID));
+
+         D3Q27BoundaryConditionAdapterPtr denBCAdapterInflow(new D3Q27DensityBCAdapter(rhoLBinflow));
+         denBCAdapterInflow->setSecondaryBcOption(0);
+         D3Q27InteractorPtr inflowInt = D3Q27InteractorPtr(new D3Q27Interactor(geoInflow, grid, denBCAdapterInflow, Interactor3D::SOLID));
+
+         //outflow
+         D3Q27BoundaryConditionAdapterPtr denBCAdapterOutflow(new D3Q27DensityBCAdapter(rho_LB));
+         denBCAdapterOutflow->setSecondaryBcOption(0);
+         D3Q27InteractorPtr outflowInt = D3Q27InteractorPtr(new D3Q27Interactor(geoOutflow, grid, denBCAdapterOutflow, Interactor3D::SOLID));
+
+         ////////////////////////////////////////////
+         //METIS
+         Grid3DVisitorPtr metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::BSW));
+         ////////////////////////////////////////////
+         /////delete solid blocks
+         if (myid == 0) UBLOG(logINFO, "deleteSolidBlocks - start");
+         InteractorsHelper intHelper(grid, metisVisitor);
+         intHelper.addInteractor(boneInt);
+         intHelper.addInteractor(cylInt);
+         intHelper.addInteractor(inflowInt);
+         intHelper.addInteractor(outflowInt);
+         intHelper.selectBlocks();
+         if (myid == 0) UBLOG(logINFO, "deleteSolidBlocks - end");
+         //////////////////////////////////////
+
+         //set connectors
+         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
+         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nu_LB, iProcessor);
+         grid->accept(setConnsVisitor);
+
+         //domain decomposition for threads
+         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
+         grid->accept(pqPartVisitor);
+
+         ppblocks->update(0);
+         ppblocks.reset();
+
+         unsigned long nob = grid->getNumberOfBlocks();
+         int gl = 3;
+         unsigned long nodb = (blocknx1)* (blocknx2)* (blocknx3);
+         unsigned long nod = nob * (blocknx1)* (blocknx2)* (blocknx3);
+         unsigned long nodg = nob * (blocknx1 + gl) * (blocknx2 + gl) * (blocknx3 + gl);
+         double needMemAll = double(nodg*(27 * sizeof(double) + sizeof(int) + sizeof(float) * 4));
+         double needMem = needMemAll / double(comm->getNumberOfProcesses());
+
+         if (myid == 0)
+         {
+            UBLOG(logINFO, "Number of blocks = " << nob);
+            UBLOG(logINFO, "Number of nodes  = " << nod);
+            int minInitLevel = grid->getCoarsestInitializedLevel();
+            int maxInitLevel = grid->getFinestInitializedLevel();
+            for (int level = minInitLevel; level <= maxInitLevel; level++)
+            {
+               int nobl = grid->getNumberOfBlocks(level);
+               UBLOG(logINFO, "Number of blocks for level " << level << " = " << nobl);
+               UBLOG(logINFO, "Number of nodes for level " << level << " = " << nobl*nodb);
+            }
+            UBLOG(logINFO, "Necessary memory  = " << needMemAll << " bytes");
+            UBLOG(logINFO, "Necessary memory per process = " << needMem << " bytes");
+            UBLOG(logINFO, "Available memory per process = " << availMem << " bytes");
+         }
+
+         LBMKernel3DPtr kernel = LBMKernel3DPtr(new LBMKernelETD3Q27CCLB(blocknx1, blocknx2, blocknx3, LBMKernelETD3Q27CCLB::NORMAL));
+
+         mu::Parser fctForcingX3;
+         fctForcingX3.SetExpr("Fx3");
+         fctForcingX3.DefineConst("Fx3", forcing);
+
+         kernel->setForcingX3(fctForcingX3);
+         kernel->setWithForcing(true);
+
+         //BCProcessorPtr bcProc(new D3Q27ETForThinWallBCProcessor());
+         BCProcessorPtr bcProc(new D3Q27ETBCProcessor());
+         kernel->setBCProcessor(bcProc);
+
+         SetKernelBlockVisitor kernelVisitor(kernel, nu_LB, availMem, needMem);
+         grid->accept(kernelVisitor);
+
+
+         //BC
+         intHelper.setBC();
+
+         //Press*1.6e8+(14.76-coordsX)/3.5*5000
+         //initialization of distributions
+         //mu::Parser fct;
+         //fct.SetExpr("(x1max-x1)/l*dp*3.0");
+         //fct.DefineConst("dp", dp_LB);
+         //fct.DefineConst("x3max", g_maxX3);
+         //fct.DefineConst("l", g_maxX3-g_minX3);
+
+         D3Q27ETInitDistributionsBlockVisitor initVisitor(nu_LB, rho_LB);
+         //initVisitor.setRho(fct);
+         //initVisitor.setVx1(fct);
+         initVisitor.setVx1(0.0);
+         grid->accept(initVisitor);
+
+         //Postrozess
+         UbSchedulerPtr geoSch(new UbScheduler(1));
+         D3Q27MacroscopicQuantitiesPostprocessorPtr ppgeo(
+            new D3Q27MacroscopicQuantitiesPostprocessor(grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, true));
+         ppgeo->update(0);
+         ppgeo.reset();
+
+
+         coord[0] = bone->getX1Minimum();
+         coord[1] = bone->getX2Minimum();
+         coord[2] = cylinder->getX3Centroid();
+         coord[3] = bone->getX1Maximum();
+         coord[4] = bone->getX2Maximum();
+         coord[5] = cylinder->getX3Centroid();
+
+         ////////////////////////////////////////////////////////
+         FILE * pFile;
+         string str = pathname + "/checkpoints/coord.txt";
+         pFile = fopen(str.c_str(), "w");
+         fprintf(pFile, "%f\n", coord[0]);
+         fprintf(pFile, "%f\n", coord[1]);
+         fprintf(pFile, "%f\n", coord[2]);
+         fprintf(pFile, "%f\n", coord[3]);
+         fprintf(pFile, "%f\n", coord[4]);
+         fprintf(pFile, "%f\n", coord[5]);
+         fclose(pFile);
+         ////////////////////////////////////////////////////////
+
+         if (myid == 0) UBLOG(logINFO, "Preprozess - end");
+      }
+      else
+      {
+         //set connectors
+         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
+         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nu_LB, iProcessor);
+         grid->accept(setConnsVisitor);
+
+         ////////////////////////////////////////////////////////
+         FILE * pFile;
+         string str = pathname + "/checkpoints/coord.txt";
+         pFile = fopen(str.c_str(), "r");
+         fscanf(pFile, "%f\n", &coord[0]);
+         fscanf(pFile, "%f\n", &coord[1]);
+         fscanf(pFile, "%f\n", &coord[2]);
+         fscanf(pFile, "%f\n", &coord[3]);
+         fscanf(pFile, "%f\n", &coord[4]);
+         fscanf(pFile, "%f\n", &coord[5]);
+         fclose(pFile);
+         ////////////////////////////////////////////////////////
+
+         if (myid == 0) UBLOG(logINFO, "Restart - end");
+      }
+      UbSchedulerPtr nupsSch(new UbScheduler(10, 30, 100));
+      NUPSCounterPostprocessor npr(grid, nupsSch, numOfThreads, comm);
+
+      double outTime = 30000;
+      UbSchedulerPtr stepSch(new UbScheduler(outTime));
+      stepSch->addSchedule(10, 10, 10);
+      stepSch->addSchedule(100, 100, 100);
+      stepSch->addSchedule(1000, 1000, 1000);
+      stepSch->addSchedule(100, 1500, 2000);
+      stepSch->addSchedule(10000, 10000, 10000);
+
+      D3Q27MacroscopicQuantitiesPostprocessor pp(grid, stepSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv);
+
+      double dxd2 = deltax / 2.0;
+      D3Q27IntegrateValuesHelperPtr ih1(new D3Q27IntegrateValuesHelper(grid, comm, coord[0] - dxd2, coord[1] - dxd2, coord[2] - dxd2,
+         coord[3] + dxd2, coord[4] + dxd2, coord[5] + dxd2));
+      if (myid == 0) GbSystem3D::writeGeoObject(ih1->getBoundingBox().get(), pathname + "/geo/ih1", WbWriterVtkXmlBinary::getInstance());
+
+      double factorp = dp_real / dp_LB;
+      double factorv = dx / dt;
+      UbSchedulerPtr stepMV(new UbScheduler(100));
+      D3Q27MeanValuesPostprocessor mvp1(grid, stepMV, pathname + "/mv/mv1.txt", comm, ih1, factorp, factorv);
+
+
+      //D3Q27IntegrateValuesHelperPtr ih2(new D3Q27IntegrateValuesHelper(grid, comm, g_maxX1-2.0*deltax, g_minX2, g_minX3,
+      //   g_maxX1 - deltax, g_maxX2, g_maxX3));
+      //if (myid == 0) GbSystem3D::writeGeoObject(ih2->getBoundingBox().get(), pathname + "/geo/ih2", WbWriterVtkXmlBinary::getInstance());
+
+      //D3Q27MeanValuesPostprocessor mvp2(grid, stepSch, pathname + "/mv/mv2.txt", comm, ih2, factorp, factorv);
+
+      if (myid == 0)
+      {
+         UBLOG(logINFO, "PID = " << myid << " Total Physical Memory (RAM): " << Utilities::getTotalPhysMem());
+         UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used: " << Utilities::getPhysMemUsed());
+         UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe());
+      }
+
+      double endTime = UbSystem::stringTo<double>(cf.getValue("endTime")); //100001;//10001.0;
+
+      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, stepMV));
+      if (myid == 0) UBLOG(logINFO, "Simulation-start");
+      calculation->calculate();
+      if (myid == 0) UBLOG(logINFO, "Simulation-end");
+   }
+   catch (exception& e)
+   {
+      cerr << e.what() << endl << flush;
+   }
+   catch (string& s)
+   {
+      cerr << s << endl;
+   }
+   catch (...)
+   {
+      cerr << "unknown exception" << endl;
+   }
+
+}
+//////////////////////////////////////////////////////////////////////////
+int main(int argc, char* argv[])
+{
+
+   if (argv != NULL)
+   {
+      sbonepd(argv[1]);
+   }
+
+   return 0;
+}
diff --git a/apps/cpu/BeadPack/data/NewCentroids.txt b/apps/cpu/BeadPack/data/NewCentroids.txt
index ba415e9a87146cfac5004a4a3c1fd2fb6ad75d6f..b2461e9adf0b21fb2370362d7609c60a53f9ada4 100644
--- a/apps/cpu/BeadPack/data/NewCentroids.txt
+++ b/apps/cpu/BeadPack/data/NewCentroids.txt
@@ -1,6864 +1,6864 @@
-2.397382	1.487592	0.417539
-2.368312	0.792199	0.414552
-2.404938	2.334875	0.417688
-2.408864	2.601136	0.404545
-2.452162	1.733784	0.398378
-2.472830	1.032642	0.402264
-2.468872	3.203534	0.411805
-2.490606	0.355152	0.398030
-2.500741	2.847513	0.410899
-2.501491	3.461930	0.407456
-2.500772	4.533719	0.422211
-2.531121	0.099776	0.408834
-2.558878	2.130816	0.400204
-2.620484	3.703871	0.402419
-2.614297	4.973498	0.416388
-2.644836	0.817089	0.406291
-2.635581	1.892093	0.398605
-2.677556	1.652444	0.397556
-2.669632	3.966691	0.414338
-2.683929	4.230982	0.409732
-2.728095	3.262286	0.423016
-2.753871	2.333710	0.405806
-2.750204	2.847755	0.402449
-2.777037	1.429630	0.408025
-2.798280	1.170376	0.417204
-2.312500	1.244167	0.411111
-2.366619	3.733986	0.428577
-2.363713	4.770099	0.427030
-2.408919	3.997405	0.428757
-2.491375	6.236543	0.430558
-2.589587	5.468347	0.425744
-2.608462	6.005923	0.420077
-2.637723	5.740660	0.427030
-2.664545	2.572893	0.415289
-2.690426	4.716170	0.410213
-2.780526	0.172632	0.401579
-2.783232	3.521717	0.414343
-2.810497	2.085580	0.424530
-2.819956	0.425200	0.421333
-2.819569	4.457682	0.438086
-2.875584	0.925455	0.419610
-2.877581	1.836613	0.423629
-2.265437	0.469612	0.424563
-2.259412	3.500980	0.424902
-2.288827	0.202793	0.432346
-2.302544	3.008402	0.430059
-2.356620	5.347183	0.421549
-2.368495	5.600430	0.424516
-2.375093	5.864472	0.428385
-2.432959	4.265867	0.430612
-2.563371	1.290400	0.426457
-2.602632	0.558421	0.415789
-2.740566	6.211321	0.420189
-2.829774	5.125338	0.431955
-2.838870	5.382435	0.429739
-2.865577	3.788462	0.439872
-2.847897	5.915187	0.440374
-2.898192	3.055346	0.439769
-2.216304	1.783152	0.435652
-2.221633	2.760476	0.439932
-2.223838	3.253838	0.437576
-2.250484	4.436290	0.429677
-2.258552	6.356552	0.438069
-2.916866	4.065791	0.447194
-2.928049	2.513049	0.436402
-2.940404	4.720594	0.456318
-2.975446	0.030792	0.433267
-2.969467	1.592311	0.446756
-2.144865	1.535811	0.449392
-2.156744	2.021163	0.442558
-2.156667	2.267901	0.445185
-2.171579	1.063509	0.437193
-2.166571	4.189810	0.458810
-2.274286	6.090571	0.440714
-2.369961	5.077266	0.455352
-2.385510	1.964898	0.432857
-2.858182	0.678939	0.442879
-2.971250	3.340000	0.438750
-3.004615	1.326731	0.444615
-3.000741	2.265926	0.441296
-3.042338	0.280260	0.452403
-2.094858	0.035330	0.467264
-2.132318	4.651060	0.462185
-2.142250	5.478550	0.466050
-2.161797	3.918125	0.455859
-2.145514	4.923730	0.474622
-2.148750	5.214632	0.460147
-2.195714	2.506786	0.443214
-2.941860	6.391395	0.446977
-2.974000	6.154833	0.451167
-3.055106	0.528723	0.445106
-3.058617	2.027766	0.457766
-3.081667	1.067250	0.460333
-2.063247	0.837273	0.473961
-2.092911	3.675443	0.462532
-3.048129	4.291367	0.465396
-3.094164	0.790214	0.473523
-3.061724	5.223448	0.463448
-3.056184	5.756579	0.467895
-2.057681	0.324525	0.483042
-2.045430	1.293333	0.479194
-2.045737	2.946526	0.479158
-3.079532	5.489169	0.491065
-3.134628	2.888512	0.480992
-3.128677	3.869613	0.492581
-3.152727	1.765818	0.473273
-2.025338	3.420912	0.495304
-2.006329	4.409306	0.504913
-2.036471	6.218431	0.481765
-2.057520	5.966545	0.494797
-2.167024	5.732976	0.489167
-3.130435	4.535217	0.484493
-3.143043	2.634348	0.473478
-3.159627	3.167801	0.492116
-1.969557	1.845897	0.512681
-1.978909	0.585527	0.508655
-1.986923	2.689615	0.482308
-3.154933	6.001600	0.499933
-3.226455	0.106636	0.502455
-1.936972	1.054404	0.508532
-1.932615	2.168769	0.506000
-1.962500	2.444196	0.512768
-2.852981	5.625481	0.504904
-3.215521	2.400097	0.521671
-3.209871	4.781484	0.511806
-3.218000	3.433500	0.505750
-3.216122	4.110204	0.500204
-1.918834	3.856632	0.534275
-1.918261	1.586087	0.504348
-1.929562	5.083577	0.526350
-1.934507	5.338169	0.511831
-3.030447	4.983610	0.530000
-2.612966	5.216525	0.531949
-3.242780	1.275415	0.540361
-3.314545	1.517576	0.523939
-1.873882	0.138118	0.530235
-1.905200	4.762945	0.545200
-1.923365	5.594952	0.546346
-2.643443	3.031721	0.542787
-3.010687	3.587694	0.553548
-3.297042	3.669437	0.530282
-3.293654	4.351346	0.529038
-3.295675	5.044810	0.548927
-3.291660	5.332648	0.545929
-3.289350	5.657870	0.552599
-3.337926	0.339407	0.535407
-1.850217	3.090290	0.545290
-1.844217	5.836627	0.546988
-2.929859	2.756268	0.541761
-2.944545	3.086364	0.571364
-3.348621	0.782759	0.532414
-3.345065	2.166623	0.540909
-3.371015	1.038609	0.557594
-1.814949	0.388788	0.556465
-1.812745	1.256863	0.548039
-1.816522	2.840435	0.547391
-1.818585	3.604906	0.553491
-1.825911	4.121921	0.567340
-1.828148	0.835556	0.546481
-1.831011	6.089787	0.562926
-3.382353	1.753382	0.547941
-3.368929	4.582321	0.556071
-1.778737	4.525051	0.577929
-1.796909	6.365164	0.573091
-3.363967	6.160516	0.584321
-3.379647	3.914706	0.564000
-1.767957	2.000215	0.570860
-1.753034	2.605655	0.586414
-1.769918	3.343607	0.589536
-2.227092	0.668723	0.587943
-2.603869	1.503065	0.580352
-2.651250	1.001705	0.577614
-3.131751	6.325036	0.591823
-3.367500	5.897833	0.567167
-1.737204	1.734194	0.585806
-1.728414	2.337252	0.609207
-2.333005	2.151913	0.587432
-2.593492	2.401270	0.574921
-3.454105	2.508158	0.592842
-3.444286	4.162381	0.593401
-1.720179	1.479107	0.599524
-1.723238	4.936238	0.603238
-1.724337	5.434217	0.596747
-1.732581	0.618065	0.579032
-2.322714	0.020714	0.597714
-2.545033	3.848301	0.600458
-2.598500	0.265500	0.598375
-3.245395	1.952500	0.594211
-3.340714	2.715000	0.579286
-3.369130	6.396087	0.583913
-3.460809	3.489223	0.615469
-3.477054	0.140536	0.591339
-3.486379	0.603966	0.590000
-3.484865	1.971757	0.596892
-3.490536	1.330357	0.596964
-1.704972	1.040608	0.610442
-2.438477	0.507531	0.615103
-2.538158	4.723947	0.610197
-2.589894	4.377447	0.608511
-3.237879	0.587677	0.603838
-2.265368	1.378896	0.628067
-2.326066	1.646256	0.622701
-2.519722	1.812917	0.617639
-2.744512	1.927439	0.623963
-2.758642	0.061204	0.626296
-2.791951	1.679024	0.607073
-3.489624	5.489286	0.629023
-1.651161	4.308968	0.633935
-1.670833	5.676019	0.623889
-2.076077	3.182488	0.631675
-2.324197	4.569663	0.641580
-2.448690	1.151508	0.636111
-2.462908	6.001454	0.641684
-2.576327	3.291927	0.642218
-2.818669	6.096730	0.638403
-2.861266	2.353418	0.621899
-3.103488	1.480233	0.623605
-3.498596	5.195000	0.624561
-3.535577	1.580769	0.622115
-1.643774	0.225849	0.635094
-1.632230	2.987311	0.648918
-1.633757	5.196618	0.654538
-1.673731	3.804231	0.641154
-2.306959	2.417872	0.650372
-2.321044	3.387071	0.650135
-2.348478	4.144042	0.655643
-2.480896	5.739254	0.629701
-2.488994	0.820828	0.637515
-2.526848	3.567994	0.648854
-2.658209	6.280000	0.635970
-2.679266	2.178807	0.637982
-2.701818	2.794034	0.645966
-2.798589	4.234896	0.640290
-2.812050	3.416584	0.643043
-2.890765	1.048412	0.644824
-2.950000	3.040000	0.610000
-3.439524	4.813061	0.635374
-3.537865	3.738989	0.638315
-3.550663	0.866188	0.646906
-1.634384	5.934155	0.654292
-1.621625	6.201875	0.647625
-2.259130	3.634565	0.638696
-2.279091	1.907172	0.646768
-2.483165	2.612615	0.651927
-2.701071	1.248049	0.660769
-2.689926	5.880370	0.650815
-2.705106	0.497690	0.661489
-2.743851	0.777905	0.649730
-2.762778	4.604747	0.657424
-3.002613	1.862484	0.655871
-3.590247	0.387407	0.653765
-1.602545	1.265636	0.650364
-1.596048	3.544948	0.670447
-1.614746	4.711695	0.648983
-2.158065	2.643706	0.671853
-2.292331	5.574942	0.675315
-2.304000	3.869143	0.651143
-2.337895	3.117953	0.663450
-2.348532	4.893257	0.658807
-2.441409	5.354228	0.656644
-2.457704	2.882185	0.665333
-2.738983	5.419322	0.649831
-2.833563	4.860063	0.657250
-2.956210	2.968629	0.684435
-2.967804	4.436682	0.663318
-2.984370	5.906296	0.655037
-3.559372	2.208010	0.660471
-3.562955	5.792386	0.655568
-3.604661	1.123898	0.657542
-1.576404	4.068090	0.667978
-2.065062	2.033765	0.675741
-2.071416	4.043382	0.679075
-2.176311	6.350299	0.676013
-2.762201	3.713491	0.680252
-2.968413	0.645329	0.676617
-3.012778	0.133611	0.653889
-3.033940	2.537616	0.682848
-3.572809	6.316340	0.672723
-3.592857	4.620893	0.660893
-1.559213	0.475354	0.682677
-1.555547	0.748984	0.683672
-1.563000	1.879714	0.677571
-1.569689	2.137358	0.676684
-1.557460	2.729206	0.682222
-2.197280	2.908640	0.676000
-2.207910	6.061721	0.693238
-2.269611	0.946833	0.678389
-2.357645	0.259504	0.684545
-2.420127	6.254051	0.673291
-2.633662	5.012817	0.682629
-2.861502	5.178115	0.690990
-2.918478	2.112536	0.677681
-3.020902	3.278443	0.685984
-3.608667	3.989714	0.674476
-2.074688	2.294531	0.676563
-2.112326	1.160066	0.697841
-3.035946	5.656284	0.699527
-3.071687	0.387055	0.701963
-3.126940	5.192672	0.700043
-3.615870	4.983804	0.682391
-3.615655	6.046773	0.702843
-2.020390	3.669894	0.710496
-2.090877	1.557544	0.683860
-2.098194	0.179226	0.711387
-2.131899	4.748354	0.702658
-2.168091	0.433727	0.696273
-2.729212	3.980242	0.704545
-2.910952	6.396190	0.685238
-3.149504	4.244771	0.710458
-3.669000	2.437100	0.696400
-1.515508	2.456017	0.708559
-1.512258	5.511505	0.705699
-2.166268	5.266197	0.709014
-2.795035	3.161678	0.712448
-2.974080	4.058000	0.703120
-3.001826	1.270609	0.702435
-3.161604	1.084528	0.703396
-3.160127	2.172278	0.700000
-3.196029	3.030588	0.695735
-3.455374	4.407357	0.714361
-3.662241	4.262586	0.704741
-3.678974	1.781496	0.707863
-3.663786	3.310214	0.714643
-3.697296	0.664025	0.715597
-1.499756	3.242033	0.724350
-1.506481	4.499568	0.716358
-1.493799	4.973436	0.735307
-2.005123	0.905215	0.727362
-3.007302	3.800476	0.711111
-3.148400	2.783300	0.722600
-1.478393	1.002917	0.735417
-1.496667	1.485145	0.724565
-1.501742	6.389318	0.731136
-1.933623	1.371739	0.724493
-1.962326	4.279457	0.727442
-2.127321	5.007143	0.725089
-2.504146	2.023902	0.720732
-2.734013	2.545405	0.737864
-3.234436	1.664812	0.721278
-3.690556	3.560000	0.713611
-3.728997	0.185350	0.745380
-2.085038	4.496241	0.741729
-2.782862	5.656325	0.749399
-2.835618	0.285843	0.732697
-2.997536	4.684058	0.727246
-3.140611	6.086889	0.740611
-3.147182	0.826364	0.735273
-3.209386	4.514910	0.749675
-3.219636	3.986545	0.746727
-3.225019	5.491407	0.749011
-3.703736	5.610220	0.739011
-3.738947	1.494842	0.738632
-1.905000	0.011429	0.742143
-1.904796	5.291403	0.758100
-2.081667	3.412667	0.750667
-2.795053	1.484526	0.744000
-3.232353	0.188067	0.747059
-3.322683	1.427642	0.751951
-3.350551	2.319291	0.748425
-3.711596	5.226702	0.740000
-1.442583	3.743432	0.763100
-1.426824	4.257882	0.759294
-1.430851	5.808617	0.763298
-1.444762	6.077302	0.748571
-1.840419	2.143263	0.770210
-1.955492	5.879590	0.762705
-1.986272	6.176805	0.759882
-2.368182	5.130545	0.745455
-3.177489	3.459910	0.762960
-3.752035	3.803451	0.760619
-1.432299	0.271839	0.758851
-1.851186	0.237119	0.757627
-1.932055	0.469589	0.760137
-2.486620	1.367512	0.779390
-2.956429	5.419571	0.774429
-3.223431	4.790962	0.775816
-3.234353	3.723882	0.768588
-3.285859	2.574978	0.780661
-3.391176	1.184118	0.762941
-3.408194	3.053965	0.795507
-3.777143	0.920000	0.770286
-1.404593	2.972185	0.789444
-1.406768	4.725253	0.773434
-1.412171	5.260465	0.774961
-1.822931	4.681034	0.765690
-1.836053	1.868947	0.766579
-1.849159	0.705421	0.777290
-1.860621	1.616158	0.789209
-1.921852	2.600926	0.770185
-1.953125	6.397500	0.764375
-2.076073	1.796164	0.781826
-2.203869	5.809311	0.792066
-2.989551	1.631910	0.777865
-3.758429	4.754031	0.781047
-3.784390	2.231220	0.765122
-1.389431	1.249701	0.804251
-1.389762	1.734762	0.780476
-1.852257	2.850817	0.793035
-1.849811	5.538679	0.778868
-2.476749	0.052792	0.797138
-2.506463	2.266463	0.785122
-2.535452	5.552776	0.798194
-2.585108	4.191477	0.794554
-3.028158	4.963474	0.794263
-3.316235	0.435608	0.800314
-3.368723	0.699734	0.789681
-3.362439	2.064024	0.790610
-3.377851	5.004050	0.791240
-3.786757	2.847568	0.786216
-3.809590	0.439147	0.800341
-3.811440	1.186070	0.799728
-1.380195	2.258878	0.803366
-1.375563	3.466406	0.813000
-1.375208	1.987292	0.801875
-1.734930	3.178944	0.795634
-1.866233	1.137860	0.801349
-2.077397	5.481233	0.790000
-2.555560	1.630474	0.803319
-2.629226	5.252440	0.808542
-2.907613	2.741757	0.803964
-3.173286	5.840143	0.795143
-3.377489	5.698018	0.799780
-3.374660	5.999796	0.809048
-3.777983	5.866481	0.799313
-3.803864	4.073977	0.808750
-1.371229	4.010000	0.817973
-1.871671	3.861671	0.825633
-2.091046	0.659346	0.813007
-2.388529	4.367157	0.808922
-2.544516	0.647097	0.802419
-3.323380	6.306852	0.809630
-3.350526	5.261316	0.803684
-3.435177	1.800851	0.822979
-3.770916	6.232977	0.811527
-3.816222	3.103889	0.797222
-1.794958	5.065714	0.816387
-1.839585	3.474473	0.824984
-2.329545	0.741970	0.813485
-2.403438	3.724063	0.813750
-2.536557	3.081639	0.809344
-2.561082	4.564131	0.822754
-2.908693	0.863660	0.825229
-2.943148	3.586296	0.808889
-3.010943	2.320000	0.819057
-3.348889	0.951556	0.810889
-3.471038	0.236415	0.817642
-3.601707	2.000610	0.813171
-1.611400	1.677600	0.823800
-1.774286	4.110000	0.828869
-2.650233	4.804884	0.814884
-2.710141	1.034930	0.819014
-3.193696	1.892174	0.825761
-3.396579	3.332105	0.824737
-3.593151	1.313836	0.823973
-3.857794	1.988578	0.837990
-1.340148	0.490815	0.833852
-1.674087	5.383652	0.834087
-1.680149	0.067139	0.856219
-1.709560	1.397170	0.842327
-1.727326	6.336028	0.852009
-1.721634	0.921206	0.850428
-1.952759	4.875241	0.839103
-2.040645	3.022258	0.828925
-2.299583	2.060625	0.837708
-2.563333	0.351026	0.835449
-2.573607	6.145689	0.849208
-2.779414	4.403555	0.845391
-3.715385	2.627179	0.827436
-3.835978	5.421285	0.837933
-3.871071	2.445893	0.830536
-1.312034	5.530339	0.846356
-1.330120	0.053593	0.843952
-1.309809	2.524306	0.868565
-1.683378	2.599392	0.848986
-1.745817	5.753983	0.866361
-1.777284	6.041802	0.862741
-2.160153	3.857691	0.865294
-2.176571	4.218476	0.853714
-2.433579	3.974632	0.848211
-2.525333	6.392889	0.842222
-2.654748	3.441978	0.854676
-2.744180	2.941719	0.859688
-2.753918	2.295448	0.861493
-2.803908	6.258621	0.842759
-3.069479	6.320274	0.856192
-3.383600	2.793600	0.836000
-3.435035	4.647588	0.862084
-3.447405	3.606997	0.862624
-3.490390	4.128485	0.853030
-3.801609	5.013166	0.863958
-3.861077	4.320615	0.836308
-1.296452	4.491290	0.850484
-1.299860	6.307378	0.869755
-1.739548	4.398404	0.866506
-1.820364	2.390727	0.846545
-2.143789	1.369158	0.869158
-2.203188	3.227536	0.864855
-2.316842	1.180351	0.848421
-2.379250	1.824600	0.870000
-2.445319	3.295319	0.853404
-2.460857	0.950429	0.858429
-2.533789	5.812484	0.860248
-2.847848	1.960000	0.855696
-2.920777	0.050971	0.855243
-3.476173	3.863086	0.858272
-3.562095	5.394775	0.870133
-3.662546	4.487056	0.868488
-3.895920	1.723731	0.864925
-3.885516	3.349008	0.869405
-3.906026	0.689423	0.873429
-1.293172	1.526621	0.866276
-1.281688	3.230130	0.863636
-1.285058	5.057965	0.873256
-1.610789	3.921842	0.861579
-1.662078	0.334416	0.867662
-2.208000	3.591231	0.867385
-2.320694	1.550417	0.862083
-2.352879	0.491629	0.876402
-2.563237	2.743734	0.873817
-2.623462	1.873077	0.860577
-3.510606	1.536364	0.861818
-1.621017	1.161864	0.868305
-1.656279	1.985581	0.875349
-1.685665	3.674162	0.886069
-2.064332	2.429170	0.887148
-2.302759	5.397085	0.888621
-2.427705	2.495738	0.867049
-2.700635	0.150000	0.877460
-2.937527	5.810430	0.879247
-3.138703	0.616444	0.885649
-3.177879	3.224545	0.874444
-3.507094	2.474926	0.882118
-1.264448	0.979178	0.905042
-1.641003	0.599027	0.903186
-1.958750	3.250500	0.875500
-2.284030	2.305970	0.879104
-2.737640	5.954944	0.884719
-2.828667	4.147000	0.882000
-3.547773	0.535547	0.896761
-3.887363	3.622239	0.891294
-3.909011	4.569780	0.884066
-3.940263	1.468684	0.890526
-1.253410	6.032605	0.907241
-1.625374	2.241905	0.911871
-1.622440	4.635833	0.903333
-2.078704	2.168889	0.891481
-2.320027	2.874521	0.902986
-2.358804	5.992919	0.904976
-2.417100	4.796283	0.907063
-2.774314	5.044216	0.895196
-2.901889	3.355056	0.898611
-3.000382	1.095038	0.890916
-3.532148	6.196242	0.901611
-3.568757	1.035444	0.898757
-3.915479	5.668537	0.911755
-3.916205	6.058554	0.902590
-3.943674	0.168295	0.906023
-1.245827	0.711575	0.906299
-1.633989	2.975426	0.913936
-1.998702	5.681985	0.906489
-2.249545	4.605227	0.899886
-2.344211	6.250752	0.905338
-2.520085	5.037627	0.909576
-2.629735	3.707743	0.917168
-2.796157	0.483843	0.911065
-2.852662	3.842230	0.909281
-2.965039	3.091836	0.920664
-2.975780	1.418688	0.917589
-3.199946	1.266965	0.922195
-3.569256	4.878837	0.912140
-3.558571	5.131224	0.902653
-3.942876	3.881046	0.912222
-3.955171	2.686844	0.921217
-1.235251	3.672040	0.926488
-1.223385	4.813231	0.913692
-1.222681	5.767101	0.924275
-1.467032	2.747385	0.926042
-1.484718	0.822077	0.926232
-1.579177	5.140823	0.925127
-2.101038	6.019937	0.930692
-2.746882	5.460000	0.921118
-2.790596	1.666358	0.924503
-2.960647	6.077314	0.937627
-3.058412	2.082575	0.926223
-3.139735	5.320596	0.923576
-3.194096	2.945000	0.927711
-3.599104	2.952939	0.932616
-3.926241	6.387092	0.921135
-3.969286	1.005000	0.906429
-3.968000	2.232333	0.916500
-1.223284	0.286418	0.920448
-1.216129	2.753226	0.915806
-1.219004	5.307229	0.933939
-1.517917	5.647188	0.926979
-1.604080	3.430800	0.932800
-2.000000	4.640552	0.935521
-2.062077	0.040831	0.932971
-2.120691	6.368351	0.923298
-2.669925	0.813284	0.930672
-2.859073	4.746537	0.928683
-3.009104	4.522127	0.931642
-3.522596	2.210894	0.936255
-3.952545	5.216545	0.919636
-2.102935	0.413478	0.947754
-2.160833	2.668854	0.933646
-2.197617	0.917584	0.945336
-2.295225	0.241892	0.935225
-2.340513	5.653718	0.933974
-2.898299	2.515910	0.949433
-3.136286	5.645143	0.939657
-3.248462	4.161026	0.937179
-3.633443	0.782350	0.941366
-3.665512	3.475354	0.943780
-3.966357	4.817214	0.933786
-1.203127	1.761273	0.950873
-1.197041	2.108136	0.959675
-1.198472	3.008908	0.953450
-1.554718	4.157534	0.965147
-1.561045	5.920000	0.938955
-2.081849	5.252798	0.958491
-2.709218	3.189609	0.956034
-2.794648	1.230000	0.958592
-3.029576	4.016186	0.944576
-3.073704	3.737593	0.947963
-3.347132	4.410441	0.951838
-3.582606	5.926649	0.948670
-3.591888	3.224847	0.951480
-3.587091	5.654390	0.965896
-1.177792	3.923766	0.953117
-1.496143	4.414714	0.949429
-1.525031	6.176180	0.968354
-1.729424	4.870373	0.968339
-2.665758	1.448182	0.948333
-3.006909	1.800182	0.963333
-3.154424	0.305707	0.968822
-3.156456	1.603291	0.953038
-3.198233	5.064224	0.970517
-3.263884	0.052416	0.968807
-3.645668	1.718704	0.964615
-3.732841	0.033125	0.960227
-3.949706	2.943971	0.949265
-4.015778	0.408444	0.943778
-4.014265	1.241176	0.949412
-1.181769	1.238435	0.965034
-1.166528	3.423194	0.964028
-1.295723	4.267803	0.971272
-1.488462	3.171209	0.967582
-1.962958	3.657324	0.957042
-2.423423	3.518255	0.964094
-2.522401	2.076095	0.975515
-2.660000	3.986567	0.958209
-3.228920	2.395634	0.968263
-3.664131	0.306239	0.982165
-1.523655	1.506948	0.985542
-1.891134	1.993763	0.981546
-1.934558	4.250726	0.992177
-1.963838	0.807374	0.973636
-2.166076	4.845204	0.991090
-2.542938	1.162147	0.980395
-2.641094	2.519688	0.975469
-2.901918	0.263425	0.972466
-3.029474	4.261228	0.975263
-3.092979	2.718723	0.969787
-3.228386	6.131713	0.999114
-3.254305	3.897219	0.988874
-3.345795	5.506705	0.980000
-3.992872	4.125213	0.972660
-1.468807	4.911684	0.995579
-1.476220	5.396457	0.994685
-1.860000	3.054098	0.984918
-1.913974	1.345364	0.990066
-1.932464	5.454493	0.985217
-2.141969	1.937480	0.991260
-2.320667	5.153333	0.977333
-2.911980	5.226040	0.985248
-3.114300	0.859900	0.983100
-3.656426	3.739279	0.999459
-3.682578	4.245781	0.985781
-4.031020	3.180612	0.976327
-1.134942	4.599826	1.005581
-1.807582	5.242008	1.002664
-1.868811	0.223216	1.010617
-2.032481	1.117786	1.010840
-2.315714	0.014405	1.008452
-2.394439	4.184439	0.999112
-2.730625	5.731625	0.988375
-3.102121	4.755606	0.990455
-3.550635	2.701111	1.002910
-3.705417	1.460000	1.006250
-3.751892	2.308919	0.985676
-4.031121	5.446379	0.997500
-4.054758	2.454516	0.999355
-1.128452	2.395000	1.001786
-1.125000	5.531724	1.002069
-1.147391	0.504239	1.004891
-1.388894	4.652304	1.017235
-1.424488	3.841417	1.007953
-1.452677	0.323780	1.008504
-1.527427	2.468299	1.015975
-1.535000	6.400000	0.990000
-1.923284	6.215654	1.020765
-1.965618	1.738146	1.011124
-2.000923	2.847923	1.014077
-2.073362	3.433491	1.013879
-2.373387	1.347661	1.011935
-2.386604	3.112830	1.000377
-3.084390	3.495122	0.997073
-3.334043	4.847518	1.006667
-3.354638	5.844493	1.004493
-4.040190	4.383641	1.020788
-4.054638	2.013957	1.011489
-1.463051	1.779153	1.010000
-1.753936	2.778617	1.013830
-1.863553	0.508711	1.024654
-2.569657	0.531486	1.021943
-2.574615	0.010000	1.018462
-2.614414	4.313862	1.025448
-2.880625	0.700063	1.019688
-3.291429	2.147500	1.006786
-3.451975	1.978642	1.013457
-4.078571	1.640238	1.015238
-1.105259	6.259397	1.030690
-1.467759	2.075862	1.021638
-1.778759	1.550483	1.033862
-2.002813	3.987188	1.015313
-2.184810	4.398228	1.026835
-2.425111	4.488278	1.033000
-2.444648	0.769859	1.025211
-2.512006	5.314904	1.042866
-2.657029	6.349086	1.028114
-2.776438	2.730959	1.016986
-2.821739	0.984203	1.030145
-2.895489	6.382030	1.033759
-2.964153	4.958602	1.041695
-3.121290	5.891720	1.023333
-3.344231	1.454167	1.031731
-3.449132	1.219589	1.032100
-3.506912	0.107353	1.021029
-3.697500	1.198906	1.025469
-3.707475	4.697273	1.030657
-4.044763	5.872145	1.037326
-4.081846	0.825385	1.018923
-1.106707	1.485122	1.028537
-1.097320	5.033608	1.035464
-1.711202	1.809457	1.042907
-1.705263	5.525724	1.038750
-1.711566	3.235301	1.037349
-1.784030	1.093433	1.035224
-1.911446	5.877107	1.045537
-1.923237	2.593816	1.046184
-1.961901	5.028521	1.038873
-2.148022	1.571758	1.031209
-2.150877	5.535263	1.037544
-2.215120	0.650756	1.043643
-2.786273	2.106182	1.039909
-2.868906	3.616875	1.040391
-2.971798	5.471629	1.039438
-3.273469	1.036531	1.023673
-3.401111	0.328254	1.028571
-3.700880	1.968160	1.035520
-3.721598	6.119315	1.048311
-3.731921	3.991854	1.046291
-3.774390	0.974146	1.028537
-4.076887	3.438344	1.039205
-1.458144	3.591237	1.053608
-2.468173	2.330288	1.042019
-2.481825	1.580079	1.059802
-2.562054	2.936811	1.048595
-2.727699	4.552773	1.061475
-3.335229	3.130065	1.044837
-3.355696	3.438386	1.059272
-3.353281	5.256979	1.056719
-3.402579	0.717557	1.049321
-3.387769	6.350808	1.054115
-3.807518	3.127021	1.045745
-4.086526	3.701579	1.042737
-1.075000	4.112500	1.055385
-1.078333	4.355000	1.048889
-1.343299	2.302577	1.052577
-2.146349	3.063983	1.067967
-2.168985	5.794708	1.067600
-2.646436	4.833317	1.060149
-2.684048	0.310357	1.051905
-3.003115	0.489508	1.055246
-3.000920	2.299920	1.073040
-3.306829	2.634512	1.054878
-3.359425	1.720345	1.055402
-3.762390	2.549044	1.070000
-4.086694	6.129008	1.061983
-1.409247	0.574603	1.071423
-1.415899	1.281079	1.066978
-1.542207	1.036207	1.063793
-1.759046	3.960871	1.070913
-2.254000	2.151273	1.057818
-2.311180	3.944438	1.079551
-2.757742	1.863871	1.059677
-3.741739	5.469217	1.065130
-4.123350	0.045583	1.069369
-4.102563	4.650094	1.081313
-1.069763	0.777515	1.088876
-1.383464	5.171508	1.086927
-1.816339	4.535268	1.076339
-2.310297	1.106441	1.090424
-2.696045	6.091921	1.086384
-2.812427	0.058074	1.090923
-3.219877	1.920370	1.072222
-3.776679	2.824723	1.090000
-3.947168	5.034740	1.083353
-1.062269	1.039244	1.085462
-1.055388	1.927397	1.096895
-1.312022	0.120815	1.100730
-1.368933	3.352135	1.094663
-1.410439	5.798596	1.091140
-1.438595	2.953388	1.083306
-1.673463	1.318382	1.101974
-1.770277	2.383391	1.092907
-1.821115	3.462446	1.092086
-2.190444	3.713556	1.091444
-2.334571	2.555276	1.093436
-2.434861	5.820025	1.104810
-2.524808	1.835385	1.076923
-2.586500	5.563400	1.080500
-3.137896	6.375648	1.105043
-3.260388	0.512816	1.083981
-3.409390	2.889512	1.085488
-3.451176	4.225000	1.083971
-4.016903	0.600265	1.089912
-4.136770	1.069503	1.095590
-4.127400	3.944200	1.078000
-4.142364	2.240909	1.082182
-1.050250	0.294500	1.097500
-1.046941	2.731647	1.093176
-1.049630	3.244321	1.098580
-1.047273	3.737727	1.089394
-1.076241	6.011879	1.110709
-1.602805	0.115732	1.099512
-1.754380	0.851570	1.102562
-2.216496	6.175474	1.099416
-2.287222	1.767460	1.100952
-2.453077	6.129744	1.092308
-2.454624	3.727688	1.107052
-2.509065	3.315234	1.094393
-2.750714	3.404643	1.096786
-3.413152	3.729565	1.096304
-3.482273	3.973364	1.100909
-3.543064	4.469306	1.103179
-3.689076	5.017395	1.112227
-3.783444	0.500927	1.102252
-4.113622	6.383214	1.108724
-4.122259	5.229778	1.105630
-4.134774	2.855827	1.103835
-1.035225	5.739075	1.128575
-1.315020	2.638327	1.114286
-1.327222	4.052698	1.105476
-1.975623	2.200038	1.118717
-2.160670	4.157113	1.111495
-2.257073	3.291463	1.096341
-2.660528	5.097520	1.116341
-2.837485	2.954417	1.109141
-2.960945	5.724800	1.122109
-3.229266	4.574321	1.122283
-3.601795	5.271197	1.103590
-3.916301	1.817534	1.110342
-4.153655	1.369379	1.108759
-4.160659	0.300879	1.102967
-1.027251	4.803555	1.124882
-1.318231	6.387846	1.116846
-1.316667	1.568000	1.113111
-1.669193	5.776278	1.132377
-1.712500	4.312917	1.108542
-1.731586	6.035655	1.123103
-1.954286	3.233214	1.111071
-2.116400	0.215326	1.132189
-2.305795	0.414318	1.127008
-2.420592	4.949079	1.119934
-2.462093	0.193811	1.130154
-2.576349	0.949365	1.110635
-2.749035	2.349649	1.111228
-2.835813	1.504581	1.125567
-3.147434	3.286903	1.115752
-3.474736	6.086504	1.134085
-3.824179	0.754478	1.105821
-1.042597	0.036806	1.141403
-1.015289	2.982975	1.133967
-1.304578	1.923494	1.120843
-1.676667	0.349706	1.126373
-1.698793	6.281379	1.117759
-1.922314	4.791616	1.137118
-2.160328	1.308689	1.117541
-2.160164	2.373115	1.116885
-2.373435	6.371174	1.128217
-2.732892	3.820482	1.123735
-2.809591	4.094737	1.126374
-3.057020	1.052879	1.138990
-3.085870	2.533478	1.116087
-3.787529	5.723435	1.144635
-3.808516	4.475137	1.143104
-3.842378	3.523066	1.140372
-3.856058	2.141923	1.135769
-3.909710	1.369275	1.122899
-4.181786	1.825357	1.123214
-1.008873	3.494225	1.134789
-1.329345	0.814940	1.143155
-1.369534	6.052007	1.144731
-1.682694	3.687917	1.154250
-1.720263	2.089868	1.142303
-2.274423	5.321538	1.134423
-2.557638	2.690236	1.137165
-2.987347	3.866854	1.156502
-3.074758	0.084573	1.151293
-3.220732	4.301707	1.135366
-3.498224	0.966044	1.147383
-3.840977	6.325263	1.139699
-3.881721	0.268605	1.144605
-3.872857	3.791286	1.143714
-4.174059	4.190792	1.139109
-1.276575	4.855205	1.142329
-1.300854	1.073293	1.146951
-1.930897	0.029013	1.159193
-1.957391	5.642120	1.152446
-2.750941	5.347569	1.157020
-2.903973	3.208447	1.154612
-2.958254	1.973175	1.137143
-3.085391	3.020348	1.145130
-3.096380	1.454389	1.158643
-3.495410	2.499836	1.134918
-3.529241	0.514388	1.162110
-4.171959	4.923574	1.158179
-1.005208	1.289396	1.163509
-0.992558	5.205814	1.150233
-1.241750	3.552500	1.153750
-1.572026	2.685294	1.157908
-1.577356	4.517788	1.159808
-1.691725	2.970176	1.172817
-1.718028	5.053216	1.172653
-2.100571	4.595842	1.173451
-2.106222	6.383056	1.168333
-2.582894	1.360547	1.173473
-3.106418	0.685672	1.152239
-3.119667	5.242000	1.157778
-3.174783	4.066957	1.153043
-3.525658	4.810000	1.155000
-3.553691	3.085168	1.158523
-3.847615	5.258231	1.153692
-4.177056	3.117850	1.160467
-0.981475	2.277213	1.166393
-1.670117	0.614869	1.179155
-2.359342	2.836447	1.156974
-2.353275	5.568908	1.180387
-2.544195	3.976839	1.175000
-2.675947	0.722392	1.175482
-2.893846	5.970962	1.162212
-3.204839	3.617258	1.156129
-3.219476	5.713886	1.175764
-3.412326	2.273488	1.161395
-3.542567	1.587647	1.173422
-3.537478	5.818457	1.186647
-3.599783	6.319058	1.163188
-3.994650	2.637899	1.187395
-4.187927	5.699634	1.167439
-1.258122	3.126396	1.180305
-1.281478	4.483024	1.187354
-1.989054	0.661892	1.182568
-2.123402	2.691392	1.185155
-2.200373	5.079814	1.187578
-2.460388	4.695874	1.183350
-2.923806	1.266269	1.183731
-2.969677	2.753548	1.169032
-3.143390	1.710847	1.170678
-3.239277	1.234980	1.189518
-3.407509	5.036194	1.192076
-3.573355	3.546513	1.184770
-3.897380	4.793464	1.191054
-3.898947	0.019649	1.193860
-0.976316	0.520263	1.172632
-0.966866	2.522687	1.184627
-0.972500	4.528889	1.185208
-0.973534	5.461802	1.196007
-1.216288	5.338595	1.197391
-1.268571	0.365824	1.186044
-1.463746	4.275549	1.199634
-1.554854	2.274369	1.177767
-1.973971	1.490294	1.183529
-1.989829	0.932457	1.199010
-2.047612	5.378209	1.181194
-2.281799	0.866296	1.193228
-2.677113	5.860928	1.186495
-2.711143	1.138429	1.178429
-2.794024	0.486402	1.187805
-3.041176	6.157529	1.179412
-3.134706	2.116765	1.178529
-3.483315	5.547983	1.200580
-3.553636	1.841091	1.180364
-4.195686	5.460196	1.178627
-4.219247	2.444384	1.191096
-4.232700	0.526000	1.188200
-1.233130	2.864783	1.200522
-1.255333	3.823367	1.211367
-1.561583	1.646834	1.209151
-1.948912	3.704765	1.207206
-2.022527	6.050989	1.189341
-2.322781	3.513841	1.206424
-2.655697	3.126855	1.206439
-2.908750	1.737000	1.185000
-2.987224	4.492571	1.207510
-3.203176	2.811176	1.196118
-3.260543	0.871628	1.198450
-3.605191	2.126565	1.200916
-3.645474	0.021368	1.196421
-3.699377	3.300649	1.216831
-3.863871	1.131290	1.211548
-3.932133	4.033867	1.191600
-0.961502	1.554725	1.220733
-1.538750	1.920240	1.207596
-1.547023	3.915907	1.218605
-1.670119	4.777774	1.219139
-2.389449	2.001356	1.208771
-2.674101	1.688561	1.208273
-2.937399	4.765507	1.219696
-3.242438	0.294492	1.228600
-3.362075	0.053942	1.216307
-3.873204	5.962039	1.206311
-3.934674	2.375761	1.206522
-3.942133	2.992267	1.210267
-4.238052	1.592792	1.209481
-4.214545	4.453896	1.207532
-4.242757	0.852991	1.217804
-1.161917	1.727083	1.216667
-1.175139	2.138333	1.213472
-1.512676	3.168559	1.226324
-1.587367	3.440253	1.232937
-1.921019	1.237321	1.231434
-1.922661	4.099495	1.227431
-2.328993	4.337114	1.215973
-2.435750	0.619625	1.223625
-2.579707	2.188787	1.223138
-2.584300	3.537000	1.208200
-2.790947	2.585758	1.221061
-2.780000	4.336932	1.211364
-2.901224	5.137343	1.228706
-2.928966	0.850517	1.216983
-2.986050	3.460784	1.223697
-3.005648	4.230741	1.220741
-3.151056	4.996056	1.218732
-3.235876	5.454948	1.225000
-3.223860	5.985175	1.219298
-3.542931	0.252291	1.235739
-3.757184	4.219223	1.229320
-3.944364	5.518682	1.218864
-3.963382	3.260676	1.219710
-4.220690	5.938966	1.207069
-4.243544	3.621772	1.213165
-4.251184	2.054342	1.221513
-0.935085	4.010000	1.225085
-1.221944	2.420833	1.223889
-1.244286	1.366310	1.223810
-1.796533	5.373443	1.239552
-1.872292	2.773125	1.232431
-1.914118	1.924118	1.222000
-1.952243	4.373946	1.238135
-2.106504	3.917154	1.225772
-3.197087	2.348058	1.230388
-3.608202	0.748652	1.229213
-3.817568	1.611171	1.223694
-4.241705	3.362171	1.224961
-1.200744	0.608558	1.244233
-1.195580	4.232536	1.251812
-1.441181	5.463386	1.239055
-1.968723	0.401773	1.243546
-2.081929	1.713655	1.240508
-2.133590	2.031410	1.229103
-2.245104	5.972917	1.236771
-2.289583	1.547946	1.247470
-2.561310	0.409524	1.236786
-2.977692	0.320070	1.232937
-3.987723	0.897991	1.245134
-0.926601	4.273861	1.262673
-0.918961	5.001558	1.246234
-0.928209	6.184142	1.254627
-1.209368	5.074349	1.261152
-1.464815	4.984228	1.258981
-1.822110	1.688165	1.254862
-1.957462	5.157868	1.258528
-1.968053	2.441947	1.244956
-2.235692	4.817826	1.254901
-2.388850	3.144985	1.255811
-2.441931	5.168571	1.256757
-2.529577	2.463169	1.250000
-2.562342	4.457627	1.262975
-2.594444	6.251032	1.252222
-2.784205	5.587273	1.239545
-2.842091	6.269682	1.254136
-3.239173	3.850000	1.246241
-3.300349	4.800233	1.248023
-3.362906	2.042075	1.255434
-3.408627	3.270196	1.246078
-3.682017	2.371335	1.266307
-4.239324	6.192324	1.260206
-0.915054	2.063441	1.258495
-1.562464	0.838261	1.253478
-2.334837	2.272561	1.266748
-3.288995	6.235582	1.270767
-3.458150	1.357500	1.269150
-3.706593	1.391209	1.252747
-4.272817	2.683803	1.249859
-1.234016	5.852582	1.278484
-1.417994	4.694922	1.282821
-1.556632	5.239895	1.270895
-1.671720	4.127204	1.261183
-2.016038	3.446462	1.277962
-2.348333	1.292333	1.257333
-2.633853	1.935229	1.273211
-2.698684	4.696842	1.263421
-3.307324	1.561127	1.261549
-4.014045	1.988427	1.261461
-4.273681	4.710833	1.275417
-0.900545	2.820182	1.271818
-0.902540	3.668889	1.266667
-0.904518	1.805361	1.286807
-0.910569	5.917967	1.285285
-1.131903	6.365000	1.288419
-1.489452	0.247945	1.287705
-1.486585	1.401220	1.284146
-1.558714	6.388857	1.277286
-1.775616	3.240616	1.275205
-1.771563	1.037969	1.274688
-1.897778	6.275641	1.284217
-2.661915	2.869574	1.268298
-2.729163	0.224412	1.293643
-2.810000	3.649752	1.288515
-3.420698	2.733721	1.267209
-3.776604	1.938679	1.265660
-3.984275	6.180290	1.279638
-4.277500	4.006394	1.285433
-0.905478	0.722783	1.286261
-0.897876	3.334115	1.293584
-0.910754	0.214563	1.296310
-1.192807	3.352544	1.283333
-1.222201	5.583082	1.290629
-1.458500	2.481231	1.297269
-1.553254	1.148402	1.293669
-1.698462	0.010000	1.280000
-1.812785	0.211646	1.289367
-1.922767	3.028735	1.294269
-2.053412	5.829529	1.288118
-2.129537	3.200556	1.299722
-2.169713	2.926338	1.301083
-2.486207	1.098103	1.291853
-2.533433	5.411045	1.287687
-2.916073	2.165215	1.295446
-2.971407	5.406422	1.298593
-3.404677	4.357419	1.282419
-3.433929	4.603750	1.277321
-3.613864	1.152273	1.288333
-3.653990	2.641347	1.294301
-3.678217	4.659720	1.293881
-3.707610	3.925975	1.287547
-4.035810	0.413429	1.282286
-4.097035	3.814292	1.285531
-4.305370	1.105278	1.294537
-0.921429	0.985979	1.306455
-1.746818	2.555955	1.303545
-2.151045	1.115771	1.298259
-2.344308	4.087231	1.289077
-2.447355	1.759669	1.298347
-2.488227	5.997608	1.312928
-3.434656	5.299246	1.305180
-3.690606	5.418636	1.301818
-3.729651	6.156483	1.308779
-4.085942	0.156957	1.311957
-4.302000	2.935000	1.303063
-0.874149	4.724149	1.310957
-1.140308	2.654954	1.322923
-1.158462	4.679670	1.307308
-1.363647	6.250294	1.314588
-1.479080	0.507701	1.307356
-2.175613	0.547301	1.319724
-2.563146	5.666067	1.301798
-2.599423	4.185577	1.317356
-2.975263	2.433474	1.301895
-3.529494	4.139747	1.301013
-3.999146	4.245244	1.299390
-4.021944	1.482847	1.312083
-4.049314	1.735490	1.310098
-4.312768	0.318839	1.322202
-4.317212	1.372035	1.321327
-0.900000	6.400000	1.290000
-1.450000	0.010000	1.301818
-1.448333	5.699333	1.312833
-1.615981	6.151646	1.328196
-1.787560	3.892337	1.327629
-1.834861	4.601181	1.316389
-2.498667	0.841778	1.308667
-2.710398	4.952898	1.336748
-3.132793	1.916170	1.335559
-3.219355	2.592396	1.323041
-3.231739	3.429435	1.328696
-3.358132	2.968901	1.317143
-3.658475	5.166949	1.324322
-4.039680	3.500581	1.331512
-4.086304	1.233986	1.319130
-4.324355	1.803710	1.317742
-0.867500	3.070938	1.316250
-0.869730	5.667622	1.331351
-1.158635	1.151683	1.343714
-1.179364	0.173410	1.328439
-1.409143	2.746571	1.319714
-1.656441	5.576356	1.323390
-1.825833	0.775000	1.324333
-1.826612	2.229752	1.329174
-2.137075	5.594318	1.341281
-2.324439	3.834081	1.333184
-2.389058	2.658768	1.331522
-2.581344	3.763226	1.330538
-2.739205	6.052159	1.325568
-2.992016	0.555806	1.322177
-3.192179	3.159615	1.341325
-3.249042	0.546518	1.337029
-3.381086	3.644434	1.339095
-3.740415	0.936062	1.337306
-3.865490	5.021863	1.322451
-3.966364	6.395455	1.319091
-4.036400	4.614044	1.336978
-4.078589	0.665394	1.331992
-4.111341	2.253171	1.323537
-4.270000	6.400000	1.300000
-4.308716	5.305405	1.331757
-1.149106	0.854503	1.346126
-1.357895	2.238421	1.338421
-1.396420	3.588210	1.338827
-2.164020	6.189122	1.355898
-2.200957	2.485826	1.345391
-2.279438	0.237871	1.343373
-2.307586	4.560575	1.339483
-2.727000	0.913500	1.330000
-2.768797	3.956015	1.360301
-3.605538	2.901474	1.340518
-3.644286	4.914945	1.339451
-3.824559	0.695441	1.336912
-3.845833	2.806042	1.336667
-4.315200	4.261920	1.333520
-4.313750	5.044728	1.345707
-1.156528	6.096424	1.360000
-1.377477	4.066495	1.353925
-1.384706	0.975588	1.348088
-1.704571	4.378619	1.349333
-1.839889	6.030667	1.346667
-1.875227	4.927879	1.359318
-2.084819	2.243261	1.363080
-2.126173	1.371296	1.352531
-2.157342	3.651266	1.348987
-2.344268	5.771715	1.358410
-2.730000	3.340859	1.358591
-3.060522	3.692450	1.351044
-3.376984	1.788492	1.352738
-3.457834	3.898344	1.351529
-3.738717	0.450831	1.363302
-4.078687	5.148485	1.344545
-1.084583	0.408542	1.355729
-1.135497	3.637016	1.362356
-1.244487	1.955513	1.356282
-1.335696	1.603882	1.357637
-1.457939	5.945420	1.357939
-1.729015	1.359091	1.355985
-2.135015	4.216481	1.369120
-2.758523	1.415485	1.362700
-2.837645	5.802258	1.369613
-2.848545	3.035818	1.347636
-3.036848	5.651630	1.350652
-3.181591	4.399091	1.350227
-3.281456	4.145890	1.374919
-3.404486	2.420841	1.353551
-3.630000	4.404839	1.357419
-3.655556	5.664222	1.364000
-3.775558	0.175012	1.373753
-4.091207	2.804310	1.351552
-4.326549	5.560070	1.359155
-4.344778	0.665167	1.365167
-4.351406	2.237656	1.355156
-0.847818	1.228242	1.374000
-1.377763	2.996484	1.374338
-1.582590	2.116595	1.384269
-1.657879	2.796364	1.372828
-1.713889	0.433278	1.368389
-1.790446	3.553705	1.371473
-2.046124	0.109018	1.380233
-2.233437	5.276000	1.382000
-2.444154	4.926410	1.377436
-2.470517	3.368793	1.369598
-2.526916	1.529626	1.364579
-2.719306	2.353889	1.357500
-2.864492	1.898984	1.373743
-3.023582	4.027575	1.376157
-3.129722	4.659361	1.374972
-3.221282	1.051795	1.365641
-3.384872	5.723077	1.368718
-3.420748	5.985596	1.384709
-3.673100	1.740900	1.373100
-4.360917	0.051835	1.370000
-4.350606	3.778182	1.360606
-0.841000	2.608438	1.384438
-1.089630	2.986173	1.381687
-1.382932	0.724060	1.384286
-1.729583	1.895000	1.371111
-2.225150	1.873593	1.404012
-2.793818	4.511818	1.376182
-2.949115	0.122478	1.378496
-2.984740	6.023149	1.389513
-3.059641	6.287541	1.392238
-3.078446	2.930052	1.390104
-3.112981	0.775321	1.388226
-3.717143	6.391905	1.369048
-3.883071	3.700357	1.380857
-4.346309	3.184497	1.387349
-0.844133	0.483265	1.391173
-0.826000	3.870621	1.392828
-0.829286	4.488714	1.385857
-0.963611	2.389583	1.383472
-1.056606	5.241946	1.400317
-1.082564	3.890000	1.391731
-1.098129	4.437419	1.386516
-1.689801	5.830618	1.404967
-1.883774	5.639057	1.388962
-2.108968	0.797460	1.391706
-2.400566	6.292925	1.387453
-2.430973	2.912324	1.389189
-2.505862	0.143218	1.382874
-2.859053	2.783158	1.394105
-3.071224	5.173017	1.446753
-3.783445	2.159328	1.382773
-3.870891	4.432772	1.390000
-3.878529	5.775735	1.380588
-4.089015	5.650099	1.388670
-4.084909	5.392000	1.384182
-2.000500	2.634500	1.398500
-2.046866	4.727604	1.420346
-2.671796	0.564012	1.394910
-2.970301	4.954060	1.406466
-3.005614	1.461754	1.395614
-3.035809	1.207794	1.404118
-3.376698	0.763396	1.396604
-3.576977	1.961860	1.387442
-3.569504	3.149917	1.404628
-3.673413	5.915449	1.399940
-3.870000	5.277450	1.405839
-4.095899	4.862158	1.396619
-4.097667	3.068128	1.415026
-4.357117	4.510541	1.399369
-4.366977	2.510930	1.392326
-1.050526	1.380526	1.401447
-1.415051	3.335354	1.412475
-1.606606	3.723761	1.403303
-2.205000	6.400000	1.385000
-2.629545	2.674697	1.398333
-2.860000	1.641778	1.399333
-2.962241	3.241207	1.400000
-3.167941	5.842059	1.399265
-3.519714	3.419643	1.407786
-3.533788	0.053515	1.418703
-3.630476	3.667937	1.396032
-3.819254	3.074319	1.424859
-4.123897	2.549632	1.410221
-4.292117	5.823396	1.424528
-0.807556	2.212000	1.411778
-0.807763	5.174474	1.414079
-0.806409	5.432873	1.429282
-1.053097	4.886940	1.424291
-1.752398	5.149240	1.418363
-1.986961	5.359510	1.421029
-2.396250	0.447955	1.410795
-2.723195	5.304436	1.427594
-2.775779	1.144805	1.427955
-3.137885	1.655962	1.408269
-3.198026	2.169828	1.417854
-3.242581	1.373024	1.420282
-3.498679	0.534528	1.409811
-3.507470	0.969398	1.416506
-3.512042	6.241300	1.429443
-3.774858	3.461862	1.427085
-4.392708	0.914792	1.413333
-0.812923	1.482974	1.434308
-1.375444	4.365000	1.424889
-1.700197	3.048816	1.430724
-1.931885	0.573977	1.443977
-1.926968	1.515968	1.439258
-2.224978	3.416211	1.438326
-2.307626	0.958131	1.435455
-2.523114	4.662216	1.430120
-2.663684	6.390921	1.426053
-2.855479	0.735205	1.425548
-2.959091	0.970000	1.428030
-3.498934	1.561726	1.427005
-3.524577	2.209055	1.433532
-3.918663	3.961089	1.446386
-4.373262	3.455638	1.436099
-4.393878	2.010408	1.422857
-1.062055	2.156043	1.455368
-1.307524	5.321768	1.452958
-1.386154	3.824038	1.432500
-1.624685	0.671958	1.432448
-1.634444	4.911111	1.439753
-1.668833	1.595667	1.442722
-2.214474	5.017456	1.442018
-2.365397	5.518254	1.429524
-2.396709	3.608354	1.435570
-2.709792	2.116458	1.431250
-2.854478	0.395970	1.436567
-2.959224	4.347328	1.434310
-3.850247	1.293333	1.440988
-3.896721	6.014262	1.439672
-4.135205	6.029452	1.426164
-0.794451	4.920751	1.450751
-0.789545	1.963636	1.440000
-1.046000	5.488667	1.436000
-1.315153	0.374133	1.448316
-1.612015	4.608408	1.459204
-1.920444	0.949111	1.444667
-2.020000	3.986737	1.446316
-2.355709	0.699459	1.461047
-3.291993	0.155559	1.453706
-3.448842	4.791053	1.451526
-3.453307	5.074213	1.457387
-3.844691	4.802438	1.462346
-3.934620	1.057468	1.457911
-4.132540	4.398254	1.443810
-4.141161	0.895488	1.462665
-4.158165	1.917982	1.447431
-4.375161	6.080000	1.456129
-1.034009	1.632026	1.470881
-1.083352	5.739066	1.458791
-1.664194	2.363963	1.464885
-2.076054	4.456667	1.459660
-2.276301	2.104384	1.455068
-2.521081	3.985135	1.461351
-2.546716	1.290235	1.474604
-2.565544	3.128601	1.457358
-2.647702	1.761925	1.454783
-3.105244	0.339553	1.459268
-3.228527	4.922558	1.463721
-3.413919	1.191757	1.454865
-3.483619	5.517143	1.458571
-3.712296	4.118667	1.458741
-3.758879	1.526034	1.457845
-3.860100	5.536567	1.466667
-4.220435	1.632609	1.455109
-4.403351	2.752577	1.467268
-1.041712	4.145582	1.475479
-1.184957	2.443043	1.467478
-1.361250	4.864231	1.471731
-1.560867	4.207052	1.472543
-1.602414	0.100172	1.457586
-1.686452	0.903226	1.455484
-1.931212	3.245051	1.467172
-1.963409	3.736439	1.477652
-2.078350	0.353786	1.463786
-2.173713	1.621435	1.477848
-2.182375	5.938294	1.482074
-2.421783	4.377984	1.470698
-2.500455	2.231250	1.460795
-2.630492	3.550492	1.456393
-2.714774	5.567806	1.473613
-2.817516	4.755294	1.474444
-3.167261	5.474331	1.479904
-3.209437	6.098451	1.470423
-3.900410	1.866803	1.477336
-0.772708	2.837708	1.470208
-0.780220	4.257665	1.493901
-0.772667	6.136833	1.470833
-0.865840	3.540720	1.475040
-1.062985	0.631306	1.481903
-1.492881	1.762203	1.472373
-1.652105	5.376374	1.478187
-1.904151	4.266038	1.464717
-1.925045	1.778198	1.473784
-1.985544	1.196361	1.489592
-2.034770	2.011925	1.486109
-2.497372	1.972244	1.495160
-2.593307	6.172996	1.489416
-2.822593	2.544815	1.478272
-2.914925	3.488910	1.487744
-3.481295	2.622302	1.481295
-3.623568	0.749296	1.491044
-3.604557	1.332911	1.476456
-3.963407	3.290296	1.473704
-4.119423	4.120962	1.472692
-4.135503	6.272011	1.482328
-4.182327	0.486449	1.495163
-4.392415	4.811220	1.490707
-0.767037	5.896852	1.480370
-0.975932	0.052091	1.497338
-1.040000	1.890213	1.481915
-1.237054	3.171550	1.490388
-1.371509	0.128679	1.479623
-1.456471	5.527206	1.477941
-1.493114	5.120830	1.493806
-1.831138	0.017886	1.494797
-1.922759	2.860172	1.494741
-1.937105	2.412105	1.487105
-2.207647	2.737843	1.476078
-2.294492	1.213136	1.483390
-2.598608	0.341772	1.482025
-2.603097	5.828344	1.500903
-3.143769	2.414154	1.492846
-3.226022	3.914624	1.488065
-3.285193	2.796941	1.497969
-3.961523	2.361695	1.501351
-4.001818	2.099697	1.479848
-4.184000	3.654000	1.476286
-0.770244	0.706707	1.495976
-0.990336	3.218403	1.499412
-0.993832	6.247665	1.503293
-1.415000	1.205313	1.499375
-1.515524	6.316643	1.498112
-1.674980	3.305451	1.502941
-1.717576	1.147172	1.490202
-1.757295	6.291475	1.497705
-1.935255	5.856861	1.493212
-1.987935	6.378261	1.505109
-2.296000	4.758370	1.498667
-2.488413	2.489087	1.501827
-2.530078	5.140625	1.505000
-2.675082	4.338525	1.497541
-2.830833	6.246083	1.504083
-3.579063	0.300625	1.499844
-3.731556	2.497111	1.496667
-3.978500	0.305000	1.493625
-4.426387	1.191355	1.500129
-0.769730	1.730721	1.503784
-0.759173	3.309774	1.512105
-0.758119	6.386139	1.507723
-0.991527	4.633969	1.512824
-1.001000	2.774800	1.495400
-1.582949	3.949615	1.505128
-1.989300	5.113457	1.518889
-2.313013	3.179289	1.513598
-2.661130	2.895391	1.521609
-2.910377	2.314528	1.511887
-3.284897	6.349259	1.506296
-3.366479	2.000845	1.508662
-3.474921	4.530632	1.522079
-3.470196	4.262941	1.501373
-3.883431	6.274891	1.514453
-4.144576	1.386949	1.506610
-4.198478	3.895435	1.498043
-4.390608	6.356225	1.516852
-0.768269	0.270577	1.505769
-0.763622	1.015748	1.516378
-1.139143	3.428143	1.524821
-1.220058	5.075706	1.532680
-1.347322	4.607596	1.536393
-2.274233	4.040476	1.520106
-2.569324	1.014865	1.517838
-2.603963	0.764756	1.527500
-2.841714	4.150143	1.520000
-2.869740	3.757584	1.525651
-3.051639	2.662941	1.521050
-3.640380	5.323919	1.534133
-3.691373	1.102892	1.532647
-3.928506	0.569545	1.535227
-0.748310	4.680000	1.524648
-0.987244	5.990787	1.532441
-1.248358	1.777015	1.526567
-1.550845	0.325070	1.529789
-1.802545	4.053636	1.523091
-1.980920	6.115690	1.547070
-3.099281	0.020327	1.538497
-3.361878	3.238619	1.531271
-3.649297	3.878486	1.533514
-3.695610	2.750854	1.524878
-3.984727	1.617030	1.533030
-4.438533	1.461400	1.540900
-4.442609	1.734783	1.529891
-4.444211	0.239240	1.549357
-0.756059	2.420402	1.549812
-1.260738	6.266510	1.540940
-1.798763	0.263746	1.544089
-1.797333	2.091444	1.530333
-1.984824	3.488176	1.538765
-2.253588	0.060463	1.546250
-2.421066	1.682377	1.533607
-2.985594	2.067548	1.545441
-3.737570	4.579065	1.535140
-3.869872	0.828590	1.540128
-4.180617	1.144074	1.535926
-4.451597	0.504167	1.543403
-0.737656	5.659844	1.543594
-1.224308	5.936308	1.544154
-1.241796	1.002994	1.546347
-1.403705	1.987771	1.554940
-1.431962	5.774522	1.561411
-1.531302	3.529438	1.560947
-1.564082	1.387347	1.535918
-1.631932	2.610386	1.552850
-1.707153	6.052847	1.548681
-1.820317	4.755926	1.553175
-2.288794	2.338227	1.551844
-2.355030	6.114970	1.548698
-2.738489	0.159568	1.545827
-3.347873	0.396284	1.563863
-3.918151	0.035210	1.549874
-4.044706	5.844444	1.553007
-4.192803	0.188662	1.543949
-4.197474	5.242784	1.554794
-4.203944	4.642394	1.537887
-4.235577	2.139038	1.544423
-4.434722	3.936875	1.551806
-4.442787	4.327213	1.538197
-4.448652	3.676067	1.554607
-4.456964	2.344643	1.543750
-0.800000	3.062791	1.545116
-1.004716	1.106114	1.558777
-1.242222	2.874444	1.548889
-1.400196	2.692745	1.550196
-1.424984	2.437210	1.568464
-1.838259	4.488905	1.562587
-2.161698	2.972013	1.563585
-2.174203	5.455362	1.550435
-2.341538	1.445192	1.546154
-2.783852	6.011475	1.558934
-2.923148	5.443148	1.560926
-3.123909	3.354682	1.560045
-3.330597	3.504080	1.560995
-3.367290	5.315576	1.562679
-3.473529	2.971123	1.564278
-3.696269	5.047388	1.557985
-3.700952	6.109841	1.555238
-3.955831	5.078563	1.565887
-4.439916	5.322185	1.551597
-1.234712	5.573077	1.561731
-1.286710	3.651042	1.580684
-1.440571	6.075285	1.583052
-1.447722	0.553544	1.575612
-1.475618	3.141011	1.561124
-1.525000	2.897000	1.553667
-2.601826	4.864348	1.564261
-2.767320	5.070261	1.569216
-2.933440	4.550960	1.574240
-2.993046	0.540152	1.576701
-3.010172	1.798190	1.572543
-3.113846	4.181538	1.563462
-3.271791	0.905075	1.559851
-3.416989	3.758817	1.576559
-3.514000	5.818105	1.567316
-3.519744	1.801744	1.570564
-3.936667	2.870000	1.559216
-3.945766	2.617297	1.574595
-4.224419	2.381628	1.556512
-4.403148	2.995185	1.554630
-4.447183	5.065211	1.560282
-4.475577	0.759423	1.565000
-0.962102	5.076752	1.577261
-1.281275	2.216765	1.574314
-1.308767	4.160308	1.588062
-1.654043	5.636330	1.585213
-2.160443	0.566650	1.584926
-2.451379	2.732759	1.562586
-2.655973	1.533122	1.585204
-3.243027	0.650412	1.593995
-3.297971	1.596087	1.575072
-3.438551	4.027056	1.582991
-4.187818	2.875591	1.580273
-4.190299	5.512989	1.591413
-4.203366	4.981188	1.575347
-4.430524	5.647640	1.583708
-0.728545	3.729552	1.599179
-0.721798	3.993933	1.583596
-0.986327	2.538878	1.587143
-1.165962	0.215625	1.601851
-1.192875	1.284292	1.594875
-1.493164	0.978418	1.590791
-1.850159	5.494762	1.576190
-2.130696	2.535886	1.589747
-2.197714	3.627238	1.583905
-2.269738	5.681937	1.589372
-2.371268	3.810352	1.590211
-2.617372	3.772993	1.592190
-2.892852	3.012814	1.602281
-3.041767	4.790964	1.592450
-3.071364	5.695682	1.590000
-3.155168	3.080638	1.599195
-3.160909	3.696364	1.589636
-3.207455	1.157182	1.588091
-3.345200	2.304480	1.585920
-3.748878	5.743061	1.580510
-3.981260	4.541732	1.585984
-0.726214	1.294612	1.599854
-0.736584	0.035018	1.605089
-1.253784	1.530270	1.590405
-2.025625	5.647344	1.587031
-2.273548	4.529785	1.599140
-2.423152	5.356957	1.605109
-2.584795	3.358493	1.593973
-2.752480	1.945984	1.607402
-2.791207	0.925000	1.586034
-2.815650	3.271073	1.601243
-2.821694	1.340000	1.600242
-3.181145	4.427786	1.596794
-3.261724	4.668736	1.594368
-3.322450	5.647050	1.601750
-3.694539	4.328628	1.617157
-4.021296	3.506605	1.597284
-4.197219	3.269821	1.608724
-0.974479	0.400888	1.611853
-0.983810	4.371905	1.600000
-1.012857	0.844082	1.601224
-1.646993	1.907692	1.604336
-1.846406	0.763488	1.616335
-2.102105	1.405789	1.608852
-2.200965	6.301667	1.609693
-2.506053	5.606263	1.616474
-2.681911	4.584311	1.612222
-3.024609	6.152344	1.610000
-3.276097	5.907000	1.619774
-3.713101	2.263178	1.601705
-3.775961	3.660471	1.618667
-3.918159	4.169683	1.622857
-4.010230	3.770000	1.598851
-4.358293	0.015000	1.620488
-4.472182	4.581455	1.608545
-0.696613	5.090968	1.615000
-0.719866	0.493795	1.627679
-1.017292	3.683538	1.631046
-1.215000	4.397639	1.608194
-1.709596	0.518051	1.627243
-1.778246	4.996579	1.622982
-2.071391	2.232522	1.617913
-2.090305	4.899329	1.623049
-2.449971	6.348657	1.625714
-2.472749	0.193743	1.620877
-2.505934	4.187552	1.627676
-2.691379	2.382512	1.625714
-2.941346	1.552308	1.608846
-3.069811	1.354717	1.606981
-3.583735	2.046867	1.616145
-3.689470	0.110227	1.616364
-3.710000	6.398889	1.607778
-3.973333	5.365859	1.624293
-1.105986	5.352552	1.646334
-1.166204	4.774745	1.632263
-1.339167	0.780648	1.626944
-1.537314	2.208400	1.636057
-1.595452	4.405452	1.640268
-1.887895	2.622836	1.637778
-2.038412	0.179588	1.636765
-2.121786	1.820595	1.627024
-2.192567	0.834358	1.645012
-2.221387	5.193090	1.644307
-2.376127	4.966861	1.642658
-2.503281	0.501797	1.632188
-2.829292	5.775487	1.635708
-2.944620	1.120163	1.629837
-2.986806	3.976806	1.639660
-3.641019	4.799962	1.634264
-3.780306	0.376735	1.636871
-4.248761	2.619381	1.628230
-4.250000	0.701935	1.619032
-4.462857	5.905357	1.628316
-4.477893	3.232587	1.642053
-4.493467	2.113733	1.627467
-0.706134	2.170672	1.636050
-0.702661	2.665000	1.633952
-0.838036	5.289286	1.639643
-0.915652	5.523913	1.634348
-1.034953	2.982978	1.645235
-1.537404	4.792979	1.640128
-2.252240	4.274536	1.639508
-2.256756	0.331073	1.657415
-2.433750	2.984295	1.644103
-2.739123	0.456316	1.632281
-2.927964	0.287725	1.653593
-3.030484	0.797419	1.628226
-3.288969	2.568041	1.631753
-3.481951	6.053537	1.631707
-3.580914	3.487665	1.646802
-3.761316	1.715833	1.640746
-3.770975	3.306441	1.640254
-4.039739	4.786903	1.655970
-4.233115	5.989180	1.634590
-4.297778	4.160741	1.625185
-4.322048	1.933810	1.649143
-4.492160	2.572960	1.637360
-0.695914	4.468657	1.664029
-0.915476	2.030714	1.643452
-1.113953	3.943446	1.653176
-1.774355	1.486129	1.641129
-1.943632	3.071667	1.657265
-2.059400	4.116000	1.642800
-2.113106	3.290429	1.658359
-2.121168	3.866332	1.660326
-2.831393	2.737214	1.657183
-3.252421	1.824105	1.649368
-3.460317	1.049683	1.653571
-3.564028	0.542678	1.664431
-3.727297	2.967946	1.649243
-4.330256	0.937821	1.642179
-0.691250	1.912813	1.653594
-0.910055	4.826565	1.673740
-0.922410	5.780103	1.658821
-0.964932	2.293741	1.671837
-1.358267	3.349318	1.671136
-1.368904	3.922466	1.659041
-1.524912	1.588772	1.650000
-1.778817	5.249785	1.651398
-2.692378	4.008841	1.664634
-2.998027	5.035646	1.663061
-3.251611	5.099667	1.660556
-3.834559	2.046863	1.660882
-4.024505	6.116264	1.656209
-4.263784	3.521622	1.654865
-1.813393	2.298036	1.657500
-1.853136	3.861124	1.669586
-1.955000	0.435336	1.675268
-2.044195	4.621268	1.681512
-2.464138	3.579496	1.686021
-2.598293	2.139634	1.666829
-2.807923	0.693865	1.678406
-3.087521	5.287355	1.665785
-3.308256	1.367326	1.669186
-3.442282	0.176913	1.666107
-3.545322	2.446271	1.680271
-3.845761	5.948152	1.664457
-3.973889	3.106190	1.676270
-4.239911	4.419710	1.681071
-0.672903	6.231613	1.673226
-0.952544	1.772403	1.690318
-1.508011	5.303441	1.680054
-1.589954	0.752857	1.678433
-1.737854	2.847098	1.692122
-1.797099	4.243704	1.685185
-2.019873	4.352785	1.684051
-2.375893	1.028997	1.690502
-2.468286	4.693143	1.673714
-2.662185	5.278403	1.690868
-2.739500	3.557639	1.687333
-3.182638	0.219049	1.688466
-3.496163	6.324070	1.694462
-3.515096	1.504327	1.672788
-3.631197	5.548547	1.672564
-3.954221	5.647662	1.681688
-3.970862	1.375862	1.665690
-4.235410	1.535246	1.676885
-4.485430	6.163620	1.680995
-0.686071	0.840119	1.682024
-0.682757	3.481243	1.694919
-0.934254	3.414420	1.689779
-1.194069	2.670414	1.685724
-1.207066	0.548430	1.691322
-1.576944	1.200000	1.680833
-1.593934	3.782960	1.704357
-1.689830	3.113182	1.684773
-1.727073	0.987805	1.676341
-1.757381	3.561190	1.697619
-1.892667	1.915048	1.695302
-1.978451	0.984965	1.698204
-2.353333	1.861481	1.679074
-2.574662	6.012180	1.701429
-2.659870	3.091948	1.689351
-2.702273	1.141591	1.672727
-2.928421	2.488900	1.698708
-4.125302	1.761581	1.697953
-4.520167	2.826833	1.682333
-0.675414	5.480446	1.700382
-0.674226	5.847484	1.712452
-0.677565	2.916477	1.702953
-0.818763	1.516598	1.691031
-1.140895	6.109579	1.700105
-1.163425	1.948370	1.708204
-1.583333	0.147241	1.689655
-1.830334	1.239554	1.709136
-1.819859	5.782535	1.691690
-1.851429	3.317792	1.696818
-2.007812	5.350443	1.715568
-2.170545	1.175818	1.694000
-2.589126	1.769417	1.695825
-2.971289	4.333822	1.705600
-3.072556	2.850224	1.705426
-3.236045	2.099364	1.704273
-3.266602	6.162492	1.703625
-3.321994	4.233826	1.708296
-3.458267	4.963600	1.691733
-3.548182	3.184318	1.701023
-3.669038	0.913269	1.686346
-3.665476	4.069762	1.710179
-3.750217	1.464130	1.695217
-4.248958	6.224792	1.695521
-4.516889	4.130444	1.693333
-0.928231	0.640615	1.705308
-0.962101	1.308986	1.710000
-1.127143	3.246032	1.702222
-1.284556	3.054497	1.714911
-1.372308	0.345144	1.713365
-1.969246	1.634295	1.716328
-2.064439	5.896257	1.706791
-2.326026	5.913675	1.708377
-2.354870	2.114348	1.702957
-2.430735	0.725588	1.701471
-2.481136	4.439205	1.710852
-2.603632	2.607164	1.717313
-2.683644	6.264810	1.719096
-2.808866	4.839446	1.724106
-3.531286	2.711857	1.709571
-3.599438	1.265542	1.721888
-3.873981	1.131165	1.707864
-4.017748	0.193576	1.718742
-4.027791	0.735465	1.706279
-4.085203	0.993446	1.706014
-4.087789	2.026131	1.709196
-4.090513	3.984359	1.707487
-4.219310	5.750739	1.712660
-4.282021	3.802766	1.700851
-4.295229	0.383119	1.705688
-4.306798	1.292895	1.714868
-4.515061	3.494268	1.712195
-0.658387	4.793548	1.715968
-1.198252	2.410699	1.717063
-1.341818	4.926364	1.705682
-1.431375	5.558768	1.730516
-1.553537	4.138830	1.736056
-2.265521	2.793542	1.708958
-2.351506	2.552108	1.719699
-2.369351	3.326703	1.721081
-2.437557	1.286989	1.717443
-2.755130	5.537642	1.733782
-3.033690	5.921310	1.724310
-3.039137	2.261223	1.719640
-3.447565	0.784555	1.730628
-3.774957	0.692051	1.719829
-4.512482	4.854184	1.720426
-4.536667	1.127576	1.710606
-0.667147	4.199679	1.741410
-0.939191	0.163003	1.745796
-1.056800	6.360750	1.730650
-1.407143	1.382786	1.732464
-1.535682	6.386477	1.724318
-1.597251	5.920584	1.736495
-1.627419	2.428226	1.721774
-1.766871	6.371224	1.726327
-2.026434	2.835035	1.733916
-2.227391	1.614720	1.733851
-3.249157	3.885542	1.725060
-3.792339	5.215088	1.724737
-3.845244	3.899756	1.722317
-4.051800	0.444600	1.722400
-0.670085	0.260085	1.735043
-0.929215	4.564660	1.751675
-0.957786	2.745496	1.734962
-1.097273	4.206676	1.752159
-1.350000	1.127250	1.726250
-1.357246	0.086087	1.731304
-1.460235	1.806235	1.735176
-1.558051	5.050636	1.745466
-1.707887	4.624227	1.744072
-1.723529	1.708382	1.730735
-1.989700	6.284500	1.741100
-2.469211	2.334211	1.729868
-2.730625	4.255208	1.731563
-2.904379	0.040339	1.751977
-3.810997	2.460587	1.748915
-3.947943	6.373698	1.756901
-3.957391	2.250725	1.733768
-4.538054	1.628725	1.744430
-0.661928	1.088373	1.748855
-0.876766	6.063027	1.756439
-1.293458	6.385981	1.751121
-1.605000	3.362813	1.743750
-1.848566	6.026846	1.760108
-1.999664	3.640839	1.760101
-2.251781	4.764658	1.742740
-2.459710	1.542319	1.744203
-2.607610	0.900467	1.760852
-2.638116	0.046014	1.764638
-2.832222	1.732857	1.735079
-2.973258	3.665955	1.740449
-3.130698	0.989369	1.760897
-3.164359	5.508462	1.737821
-3.244433	4.859691	1.748969
-3.523662	5.214085	1.762934
-3.612949	4.550897	1.739872
-3.832077	4.666385	1.756000
-4.077617	2.472228	1.752124
-4.291404	5.109298	1.744211
-4.525140	5.471215	1.744953
-4.542299	0.387126	1.746207
-4.545935	0.108130	1.757317
-4.545273	0.889273	1.743091
-0.883966	4.066724	1.749310
-1.108300	4.985200	1.763650
-1.291156	5.175306	1.756735
-1.694590	5.451475	1.746393
-1.823007	0.114755	1.763881
-1.993542	2.418125	1.754792
-2.122870	2.035093	1.756111
-2.609321	5.021196	1.776984
-2.826739	2.138261	1.745217
-3.126612	1.634973	1.759180
-3.165041	3.513577	1.754797
-3.437705	4.712623	1.752787
-3.815400	4.952560	1.767680
-4.313649	5.354459	1.752973
-4.533721	3.800093	1.764605
-4.550495	1.371287	1.762673
-0.897813	3.169688	1.757344
-1.167071	3.509607	1.782250
-1.380000	4.332763	1.767763
-1.430849	2.850425	1.777028
-1.481852	2.600370	1.755926
-1.712796	2.086452	1.765054
-1.957789	5.092632	1.772526
-2.334559	3.987000	1.782971
-3.354138	4.487069	1.758276
-3.413290	5.467915	1.776059
-3.784074	2.734120	1.769259
-4.049540	2.760460	1.767816
-4.204961	2.250472	1.767638
-4.218242	3.051923	1.769121
-4.435158	0.632127	1.772262
-4.533979	4.380052	1.767958
-4.546462	1.912718	1.775436
-4.544689	2.331340	1.777703
-1.056332	1.543317	1.781005
-1.127021	1.042766	1.774043
-1.223600	4.580400	1.765800
-1.461413	4.586848	1.768370
-2.234722	3.087500	1.791493
-2.253333	5.431354	1.791736
-2.619775	2.859775	1.779213
-2.626923	5.758889	1.778291
-2.860619	6.095773	1.770619
-3.028152	1.967725	1.786540
-3.066245	4.607844	1.786989
-3.430299	1.945373	1.777164
-3.482381	2.203690	1.770476
-3.635591	5.935118	1.776772
-3.786878	6.164049	1.781073
-3.918333	4.389444	1.765741
-3.946087	1.591304	1.777304
-0.646410	3.164038	1.801987
-1.623657	6.173433	1.788955
-1.900724	4.831743	1.800080
-2.178360	6.118818	1.805326
-2.344363	0.047170	1.797170
-2.670833	1.362667	1.790333
-3.096691	0.440216	1.789065
-3.400719	3.615683	1.788417
-3.497626	3.887671	1.804589
-4.265859	4.850391	1.791406
-4.539952	5.109904	1.791483
-0.638440	5.242200	1.808360
-0.851122	5.053163	1.799082
-1.152404	0.784421	1.812552
-1.191529	5.631294	1.791882
-1.429020	3.581520	1.802804
-2.222167	2.328208	1.805042
-2.625152	0.310649	1.802900
-2.768042	3.802917	1.804833
-3.124835	3.264286	1.801648
-3.374620	3.348511	1.810274
-3.671913	1.902696	1.793304
-4.044250	5.909125	1.790625
-4.069301	5.005175	1.800699
-4.100303	3.656162	1.802929
-4.259716	0.151344	1.817261
-4.306178	2.806497	1.804140
-0.639834	3.909006	1.808785
-0.685412	2.476118	1.799412
-1.233151	3.767740	1.807055
-1.705125	0.334750	1.797125
-1.900301	5.572711	1.807470
-2.136870	5.669696	1.809261
-2.275625	3.716250	1.799167
-2.933679	3.426038	1.807453
-3.099167	4.140833	1.803472
-3.315025	2.807635	1.813645
-3.306162	3.085051	1.816061
-3.499698	5.719430	1.814262
-3.511980	1.708416	1.811188
-3.865299	3.494321	1.814891
-3.908630	1.850822	1.804247
-4.098278	4.229569	1.811292
-4.330000	2.471558	1.811558
-4.545000	5.724189	1.796622
-4.563585	3.034340	1.795849
-0.897862	0.868690	1.819448
-1.104310	5.875324	1.829014
-1.221237	2.179175	1.816082
-1.309111	1.621143	1.827810
-1.366310	5.795833	1.811190
-1.411324	2.334412	1.812794
-1.447577	2.053148	1.833983
-1.478288	3.172432	1.823063
-2.020404	0.727879	1.817980
-2.810392	4.498758	1.815163
-3.119536	2.618543	1.843422
-3.163333	0.010000	1.805000
-3.253840	2.342640	1.818480
-3.342589	0.512816	1.827443
-3.531172	2.949448	1.814690
-3.573375	0.329625	1.820438
-4.081818	1.223766	1.809221
-4.077013	4.582554	1.825455
-4.342857	4.618214	1.803214
-0.641742	1.628949	1.840150
-0.646178	0.634522	1.844650
-0.835368	6.311789	1.820947
-0.857317	3.614390	1.819268
-1.360428	6.050272	1.836654
-1.642979	1.385319	1.815319
-1.906335	4.059050	1.831131
-1.934486	2.175081	1.838541
-2.123121	2.621676	1.829422
-2.153662	0.499415	1.844923
-2.227568	1.370811	1.828378
-2.229691	4.450617	1.830062
-2.386491	5.698333	1.826140
-2.525803	1.968705	1.835181
-2.645839	0.572416	1.829396
-2.894848	1.262121	1.826212
-2.982651	5.654419	1.842302
-3.230519	5.752078	1.829913
-3.309177	1.176450	1.830823
-3.533577	4.335122	1.829756
-3.755714	5.721250	1.829464
-3.876006	0.906433	1.839878
-4.080000	5.257462	1.828231
-4.106087	3.393623	1.821449
-4.324221	4.021388	1.836856
-0.846293	0.417857	1.848333
-0.880267	4.326310	1.848930
-0.946172	3.842813	1.842266
-1.314286	4.097619	1.831905
-1.551087	0.957464	1.836159
-1.563429	0.522762	1.834857
-1.646162	5.680669	1.846655
-1.711392	2.629304	1.842278
-1.985111	1.404667	1.826889
-2.188706	3.472824	1.839118
-2.437050	6.187969	1.848621
-2.513032	3.800323	1.835226
-2.517931	5.473687	1.846393
-2.613920	3.374198	1.849599
-2.834133	1.018700	1.852867
-3.061975	6.222654	1.845247
-3.205280	0.748960	1.838800
-3.586787	0.061155	1.844260
-3.768364	3.136614	1.857000
-3.846652	5.437602	1.845701
-0.618938	6.064779	1.842212
-1.110329	0.356548	1.862027
-1.189344	2.862459	1.840000
-1.193067	1.269067	1.848533
-1.841073	4.431512	1.853902
-2.484199	3.140331	1.859282
-2.637258	4.679274	1.844677
-2.817318	3.199080	1.853870
-2.853511	0.439008	1.850916
-2.851061	5.124182	1.860242
-2.900266	1.521293	1.854905
-2.980833	0.643571	1.844762
-3.130679	1.375299	1.858451
-3.340513	1.535385	1.846154
-3.402414	5.960000	1.845862
-3.652201	3.660647	1.861748
-3.734896	2.221111	1.859028
-3.800183	0.221005	1.850000
-4.089070	5.514651	1.846667
-4.286825	1.075556	1.839206
-4.283770	0.810656	1.846066
-4.340451	1.776285	1.861701
-0.619115	2.105929	1.858584
-0.625698	0.043605	1.853953
-0.714203	1.317536	1.854638
-0.836517	1.934944	1.854382
-0.954328	5.622313	1.858358
-1.411066	0.735279	1.865736
-1.762482	0.817445	1.857518
-1.823356	0.569726	1.860137
-2.388480	4.245673	1.855731
-2.377813	5.109875	1.864250
-2.404938	0.550000	1.853951
-2.662500	1.605882	1.853382
-3.027500	3.047813	1.859479
-3.026415	4.876792	1.850189
-3.386989	2.559659	1.866080
-3.849830	0.500284	1.859205
-4.199762	0.585595	1.851905
-4.321822	3.276215	1.859766
-4.558580	5.997870	1.858580
-4.572113	4.615493	1.854789
-0.614651	3.656047	1.855581
-0.603939	5.650606	1.865758
-0.612682	4.608492	1.876592
-0.616131	4.981055	1.878593
-0.871656	2.946146	1.882325
-1.237967	5.396429	1.874341
-1.646351	4.842342	1.875360
-2.118047	4.210078	1.875742
-2.133211	0.220183	1.865229
-2.141865	4.942538	1.880734
-2.188727	0.971273	1.861455
-2.771845	2.339821	1.867976
-2.779231	1.933654	1.854231
-2.828517	5.869952	1.876890
-2.874884	4.040388	1.873760
-2.995111	5.387222	1.867556
-3.164277	4.378072	1.870783
-3.630617	3.372901	1.873765
-3.766393	4.243279	1.865246
-3.841224	1.319184	1.855306
-4.228097	6.053545	1.877239
-4.337525	5.581287	1.880248
-4.344611	2.064278	1.869222
-4.350441	3.622687	1.874053
-0.817277	2.277574	1.885248
-0.842570	5.390782	1.879441
-0.883333	1.131959	1.888866
-1.002857	2.442208	1.877143
-1.160650	0.080224	1.902623
-1.681488	5.243962	1.895744
-1.678667	3.957333	1.871778
-1.994531	3.218672	1.881328
-2.013190	1.164724	1.886748
-2.136034	1.811552	1.869828
-2.276061	0.746364	1.879596
-2.445789	4.826526	1.877474
-2.572905	1.143953	1.891588
-2.848247	2.879935	1.880455
-3.056256	3.854566	1.885753
-3.102500	5.107381	1.878690
-3.229880	5.312048	1.867470
-3.349754	0.109344	1.880656
-4.561316	6.395789	1.872895
-4.583798	2.565039	1.879845
-0.754257	2.706824	1.883649
-1.040356	5.210156	1.898022
-1.795131	3.740785	1.891257
-1.872618	2.973168	1.902147
-2.375671	0.298758	1.901443
-2.392806	1.739774	1.900935
-2.397760	2.894792	1.896250
-2.602667	4.106513	1.891231
-3.011782	0.226238	1.882772
-3.348776	5.062092	1.895663
-3.565660	6.147689	1.896085
-4.356725	1.485352	1.897852
-4.368551	5.845072	1.886957
-4.582350	3.265683	1.892186
-0.598883	6.326214	1.901165
-0.853804	5.845435	1.894891
-1.072824	4.722118	1.898529
-1.108393	1.770268	1.894286
-1.335000	4.760367	1.905932
-1.441757	3.893694	1.903559
-1.489929	0.221560	1.902128
-1.563444	1.616325	1.912715
-1.613636	2.980390	1.892857
-1.631085	0.023101	1.901008
-1.646772	1.879494	1.906519
-1.782105	1.064605	1.896316
-1.799063	2.379063	1.885938
-1.805405	1.545541	1.893919
-2.143532	5.217621	1.904498
-2.805277	2.613388	1.906710
-3.279637	1.791613	1.902661
-3.308992	4.049758	1.907702
-3.595976	4.998415	1.891707
-3.635037	4.739526	1.917606
-3.648061	0.801531	1.900000
-3.712469	1.111967	1.902259
-3.742698	1.692540	1.892857
-4.005149	6.171045	1.896493
-4.336339	4.292679	1.894196
-4.581236	4.015674	1.904213
-0.818778	4.757333	1.916000
-1.003008	2.109593	1.909756
-1.033366	3.333366	1.908020
-1.494497	1.212910	1.912593
-1.598904	4.431233	1.896986
-1.736772	3.234055	1.921299
-1.895109	3.456304	1.901630
-1.934252	5.808766	1.920945
-2.037414	3.860948	1.907069
-2.319167	1.164500	1.900667
-3.475545	0.986455	1.916636
-3.627189	1.466959	1.910829
-3.737796	6.373578	1.925687
-3.838714	5.958143	1.900429
-3.906202	2.913876	1.910620
-3.930261	4.063913	1.910957
-0.619701	0.894132	1.922934
-1.102599	3.081864	1.918136
-1.094952	4.445810	1.922000
-1.191317	6.231779	1.924164
-1.305691	2.536334	1.927203
-1.328830	0.494947	1.925426
-1.313681	0.971656	1.919264
-1.444816	6.284041	1.924122
-1.822197	6.223712	1.916136
-1.931591	0.352091	1.925909
-2.264385	6.365246	1.918689
-2.487353	5.909225	1.938102
-2.580691	6.379724	1.924608
-2.608087	4.368634	1.919235
-2.776284	0.769128	1.928349
-2.835910	6.328648	1.930295
-3.170375	6.014250	1.919000
-3.622787	5.517541	1.911967
-4.148733	6.375067	1.909667
-0.607845	3.400276	1.941188
-1.143065	3.965645	1.924032
-1.650435	3.521818	1.936522
-1.894806	1.801395	1.928915
-2.114975	4.675990	1.935939
-2.221935	5.882608	1.943817
-2.434364	4.559364	1.934636
-2.444000	2.197294	1.925882
-2.671799	6.103422	1.937670
-2.982667	1.759667	1.926250
-3.277480	4.658880	1.939240
-3.631765	2.522549	1.918431
-3.761321	4.496011	1.943558
-4.363033	6.259180	1.926393
-4.491238	5.317143	1.932667
-4.593481	2.118191	1.938840
-4.592968	2.821677	1.924645
-0.587750	4.353750	1.932500
-0.875672	1.701940	1.929701
-1.017064	0.594771	1.942615
-1.078911	2.672376	1.940099
-1.717011	4.207346	1.950754
-2.289366	1.996828	1.946082
-2.419091	0.940455	1.937879
-2.418067	3.526267	1.941733
-2.555841	2.470354	1.940442
-2.584231	5.235962	1.935577
-2.881471	4.706569	1.934706
-3.018433	2.388571	1.947465
-3.731520	3.908922	1.940931
-3.948571	2.596000	1.930571
-4.029376	0.329792	1.953222
-4.029186	0.052558	1.939186
-4.064748	3.169928	1.941871
-4.129091	1.916733	1.952614
-4.356326	0.370447	1.952236
-4.442838	1.236824	1.946284
-4.609423	1.064615	1.926346
-0.588276	2.952931	1.940000
-0.909754	0.021921	1.962660
-1.423832	5.248598	1.947944
-1.544714	5.465500	1.945357
-1.807324	5.023239	1.943662
-2.653214	3.619732	1.942411
-3.011233	0.856575	1.947671
-3.283732	6.235455	1.951148
-3.297656	3.778205	1.962784
-3.316973	2.139027	1.955081
-3.482636	6.385182	1.943727
-3.563961	4.107488	1.950097
-3.612580	0.546953	1.968010
-3.901389	3.722500	1.942593
-3.992083	0.694435	1.963512
-4.014368	2.152414	1.947586
-4.109179	3.876188	1.955660
-4.132675	1.633640	1.957807
-4.144792	5.756771	1.944375
-4.184151	2.634717	1.936981
-4.588851	3.529109	1.960517
-4.608621	0.565000	1.952069
-0.599724	1.865690	1.969414
-1.276845	5.027798	1.970516
-1.347785	3.016203	1.957278
-1.569012	2.454691	1.954691
-1.631862	2.211034	1.960897
-2.047892	1.602973	1.967784
-2.160577	2.835192	1.943846
-2.340818	2.647636	1.958364
-2.676269	2.130746	1.951642
-2.845319	4.286596	1.950638
-3.054428	1.125161	1.978270
-3.235781	0.310625	1.957656
-3.516241	3.162766	1.959291
-3.558919	2.064414	1.956937
-3.697763	5.255263	1.950526
-4.106194	0.952090	1.965858
-4.365345	5.015309	1.965855
-4.383235	3.015647	1.965000
-4.591244	4.877358	1.959171
-4.608263	0.274324	1.969846
-0.582742	2.327097	1.966452
-0.586609	4.106781	1.982103
-0.605129	0.398635	1.978007
-1.062565	3.661299	1.982305
-1.221848	1.986250	1.971033
-1.343731	4.488846	1.976962
-1.816048	1.309435	1.974355
-1.920575	5.339342	1.985068
-1.975764	0.926650	1.977931
-1.984815	6.057901	1.966914
-2.453108	1.362973	1.957973
-2.714261	4.879478	1.964522
-2.922346	2.111006	1.972291
-3.515600	1.251000	1.962400
-3.532716	2.745000	1.967840
-3.910978	5.125378	1.969956
-4.594306	5.538056	1.958056
-4.618571	0.818413	1.967778
-0.976269	4.129254	1.965970
-1.000636	1.354162	1.978902
-1.350761	5.618122	1.982284
-1.511677	2.706129	1.978581
-1.529780	5.866154	1.973626
-1.796995	4.662759	1.982906
-1.948786	0.096837	1.990863
-2.303762	3.282257	1.987053
-2.745242	5.613855	1.999758
-2.989757	3.602014	1.991319
-3.247722	5.540116	1.984015
-3.465618	2.341798	1.969663
-3.816589	2.000047	1.982757
-4.129800	1.379200	1.975600
-4.148162	2.900515	1.983971
-4.156206	2.382286	1.997186
-4.399610	2.281818	1.975325
-4.593484	1.729895	1.977317
-0.584767	5.428178	1.993566
-0.589474	1.141789	1.984316
-0.832141	3.188498	2.002268
-0.980847	4.947619	1.988783
-1.262727	3.278977	1.986364
-1.344229	1.410647	1.991592
-1.452771	4.245582	1.999880
-1.747565	5.989026	2.000617
-2.515016	0.101286	1.996945
-2.584270	2.741601	2.002633
-3.248976	3.507831	2.002048
-3.407965	0.733473	2.003650
-3.492736	4.529623	1.980472
-4.252364	5.348909	1.993273
-4.584740	0.019769	1.995376
-4.618125	1.462411	1.993929
-0.577636	2.573273	1.988727
-0.627368	5.862693	2.007926
-1.196559	4.228925	1.998387
-1.394943	0.021364	2.006648
-1.410984	1.815902	1.995164
-2.053976	2.439277	1.987229
-2.361309	5.326806	2.004764
-2.522373	0.713458	2.006305
-2.632372	1.802051	1.998654
-2.657153	3.004555	2.006619
-2.925741	6.073651	2.013307
-2.978488	4.488023	1.998023
-3.057667	2.820444	1.996778
-3.155298	0.566905	2.000774
-3.238784	0.939189	1.990676
-3.897073	2.363780	1.998171
-3.918272	5.634319	2.010930
-4.123545	4.842075	2.007032
-4.593560	6.203400	2.006480
-1.174200	2.322600	2.009200
-1.546163	4.647558	2.001047
-1.555833	5.043222	2.011778
-1.610522	0.687130	2.011043
-1.961404	2.693509	1.997544
-2.041250	6.298672	2.011797
-2.046462	4.439923	2.009000
-2.130658	2.191118	2.007829
-2.268945	5.579592	2.022926
-2.285214	1.526923	2.010342
-3.361429	4.290592	2.014321
-3.431004	5.352450	2.013414
-3.857138	4.864862	2.020069
-3.945433	1.157647	2.022768
-3.984836	4.348770	2.013852
-0.793333	3.738519	2.027619
-0.799692	5.170359	2.018462
-0.802037	4.507506	2.041304
-0.800884	6.062376	2.021768
-0.791084	0.227711	2.015060
-0.815826	0.741826	2.023957
-0.864505	3.472192	2.031892
-1.116316	1.101283	2.027566
-1.278189	5.882189	2.027887
-1.713185	0.223926	2.027506
-2.077531	3.628364	2.030370
-2.255063	3.823797	2.009747
-3.021623	3.330026	2.031597
-3.127602	1.958480	2.023743
-3.166277	1.588701	2.024762
-3.606283	5.935664	2.019292
-3.906634	1.498414	2.026926
-4.254737	4.538195	2.014286
-4.357500	3.831250	2.016750
-4.375567	0.657730	2.033156
-4.492848	4.443671	2.017722
-0.794806	1.491473	2.028062
-0.779167	5.640417	2.028229
-0.818386	2.508133	2.043544
-1.142615	1.556308	2.017231
-1.511642	3.304627	2.029403
-1.814223	2.045340	2.028592
-2.140963	3.076741	2.037370
-2.324270	2.406180	2.028989
-2.436410	3.972308	2.018462
-2.546941	0.455434	2.038950
-2.671716	3.900539	2.032647
-2.741711	0.308684	2.023947
-2.811584	5.326739	2.035870
-2.790000	3.440319	2.031170
-3.379000	2.953600	2.037486
-3.419017	4.856532	2.034682
-3.682273	2.950909	2.037098
-3.874332	3.313529	2.028877
-4.028720	3.519040	2.025440
-4.046115	5.967962	2.031975
-4.398168	0.943194	2.040209
-4.574088	5.787409	2.032336
-4.630323	2.358710	2.016774
-0.561169	4.797922	2.037922
-1.030769	0.855000	2.033077
-1.040110	5.438453	2.040110
-1.116615	5.681385	2.030154
-1.292611	0.273744	2.047734
-1.323064	3.551272	2.042717
-1.390851	2.210213	2.033511
-2.101905	1.350595	2.031548
-2.255849	0.083606	2.049371
-2.709200	1.416267	2.031067
-3.066550	6.373755	2.042751
-3.178140	4.930698	2.031473
-3.324522	1.379478	2.034000
-3.377322	5.756995	2.039945
-3.467260	1.626575	2.042466
-3.493317	0.236277	2.054033
-3.755904	0.051165	2.054940
-3.770923	2.707385	2.035077
-3.773524	6.145619	2.035048
-3.924381	1.772286	2.034000
-4.147148	4.135387	2.052218
-4.264583	3.445000	2.035000
-0.570000	1.378525	2.046721
-1.231121	0.703049	2.050269
-2.262292	4.332708	2.042917
-2.314286	6.101203	2.048647
-2.524220	1.575780	2.050000
-2.643492	0.955794	2.055992
-2.726216	4.554775	2.044234
-2.770989	1.175714	2.046044
-2.951274	1.362972	2.056085
-3.010172	5.816978	2.063440
-3.133100	4.169100	2.057500
-3.241429	2.459206	2.055952
-3.280400	2.703200	2.040200
-3.513308	3.523308	2.048462
-4.246790	0.026914	2.039136
-4.400794	2.517143	2.045714
-4.612660	3.795638	2.056277
-4.611813	5.123212	2.047772
-4.625170	3.061818	2.049318
-4.625298	4.221192	2.052318
-0.556833	5.155833	2.058333
-0.787362	6.321411	2.061166
-0.795714	3.984000	2.049429
-1.279182	2.768931	2.057547
-1.595463	1.401806	2.062685
-1.958232	4.855016	2.064695
-2.005167	5.580958	2.059417
-2.055240	1.947644	2.063750
-2.495191	4.980710	2.064426
-2.930285	4.971585	2.068943
-2.990435	0.390580	2.056812
-3.303876	3.247697	2.062416
-3.536868	3.790495	2.065275
-3.621657	1.837426	2.072130
-3.731875	0.341250	2.059271
-3.971595	4.621396	2.069202
-3.982186	5.365628	2.060283
-4.371243	2.770113	2.060339
-4.377596	4.761672	2.072648
-4.406168	6.012243	2.061589
-0.784043	2.049574	2.055532
-0.985799	1.905465	2.076171
-1.019766	5.918361	2.083396
-1.715368	2.839789	2.060421
-1.778278	2.541483	2.074163
-1.852908	0.718652	2.070142
-1.949181	4.135198	2.081299
-2.288604	0.483063	2.070225
-2.285183	4.821829	2.069939
-2.796049	0.555640	2.083515
-2.814655	1.637471	2.075000
-2.930000	3.290000	2.040000
-3.051017	5.253559	2.058136
-3.412813	6.068854	2.068333
-3.952549	6.355724	2.075054
-4.218827	1.171349	2.082639
-0.573353	3.168699	2.086705
-0.788315	4.237865	2.074270
-0.905652	2.771848	2.076630
-1.027333	0.233200	2.078200
-1.257079	3.807423	2.090550
-1.449377	6.077574	2.083082
-1.570000	4.035109	2.079891
-1.640215	6.242903	2.077204
-1.735085	5.735495	2.090717
-1.794983	3.912594	2.093481
-2.030605	0.536178	2.084936
-2.220339	4.084373	2.094271
-2.479274	3.731129	2.083468
-2.558621	4.723621	2.068793
-2.555447	3.237977	2.089027
-2.992606	5.526704	2.092205
-3.341887	1.132830	2.074906
-3.623694	5.688949	2.096667
-3.740606	1.300152	2.075606
-3.769837	3.553455	2.078659
-4.153537	5.126234	2.094453
-4.164444	6.188593	2.089407
-4.394919	1.922298	2.081815
-0.556320	6.102320	2.083200
-0.561314	3.617371	2.095771
-0.752105	4.927368	2.082281
-0.999333	6.202800	2.079467
-1.501767	0.915700	2.094333
-1.748140	1.677791	2.085465
-1.776667	0.468014	2.087660
-1.827143	6.388667	2.090476
-2.035360	3.362882	2.103343
-2.145714	0.775764	2.091527
-2.162061	1.120611	2.091221
-2.211169	1.748831	2.084286
-2.264348	5.085466	2.091801
-2.478853	4.217202	2.091743
-2.505514	2.022243	2.086075
-2.696595	5.867500	2.091897
-2.711333	5.095333	2.077333
-2.847944	1.895234	2.084673
-2.887076	3.120292	2.098421
-2.916125	0.151500	2.095500
-3.135962	3.048732	2.089624
-3.383502	0.480135	2.099697
-3.540936	5.127362	2.100681
-3.613944	4.327746	2.097218
-3.782905	0.942997	2.095719
-4.155364	0.519136	2.092091
-4.150759	5.555063	2.080253
-4.226458	2.131956	2.094207
-4.409004	4.077925	2.093402
-0.567415	1.635122	2.103415
-0.786949	1.247797	2.095085
-1.540741	2.017325	2.107695
-1.562960	3.770072	2.107509
-1.665532	1.155957	2.092234
-1.879114	2.294629	2.116057
-2.014615	5.112821	2.103590
-2.579267	5.425267	2.098800
-3.075113	4.702105	2.103985
-3.121088	2.208435	2.102109
-3.675556	2.364444	2.086296
-3.816040	4.178020	2.096634
-4.357733	1.653600	2.094400
-4.405106	3.237943	2.099078
-4.621818	4.653826	2.102273
-4.645965	1.235263	2.093158
-0.556133	2.102533	2.099867
-0.568761	0.176018	2.104867
-0.576637	0.655045	2.115646
-0.833603	0.994377	2.121448
-0.846966	0.461241	2.114483
-1.237619	5.288762	2.108048
-1.812065	4.431336	2.119717
-1.898190	3.142381	2.104952
-2.388089	3.035689	2.120578
-2.507339	5.682817	2.118941
-2.922638	3.840624	2.117554
-3.010101	2.598480	2.116453
-3.473810	2.545714	2.097381
-3.901585	0.499390	2.104146
-3.910709	3.065787	2.122756
-0.560725	2.787874	2.119130
-0.760946	2.965946	2.122905
-1.322464	4.056957	2.111739
-1.361250	1.139145	2.118224
-1.703944	5.388239	2.122324
-1.710353	4.871529	2.114235
-1.820206	3.626186	2.117629
-1.900886	1.126835	2.108228
-2.261901	4.569091	2.117769
-2.583000	2.281000	2.102750
-2.825153	2.377761	2.128098
-2.809674	4.093370	2.118804
-3.273712	5.156564	2.127178
-3.635755	3.316763	2.120144
-4.324330	5.761134	2.124089
-4.411787	5.503992	2.131103
-4.649231	1.927885	2.111346
-0.551966	3.885674	2.129719
-0.555569	4.557294	2.138275
-0.546667	5.645580	2.133986
-0.810897	5.401410	2.122949
-0.955714	4.711579	2.124962
-0.997411	3.872946	2.129955
-1.108868	3.441698	2.113019
-1.145826	0.467982	2.131101
-1.152000	4.565286	2.130571
-1.202430	4.822077	2.138063
-1.203784	1.767432	2.120000
-1.456165	4.840226	2.125789
-1.490000	2.903231	2.124000
-1.647093	3.108789	2.138443
-1.776316	3.384211	2.115263
-2.163846	2.611905	2.136190
-2.405021	1.196008	2.134856
-2.684924	6.281667	2.138485
-2.839808	2.870577	2.125577
-3.139823	6.151947	2.129558
-3.196327	4.462836	2.135200
-3.573822	6.255096	2.125987
-3.656811	5.418993	2.147458
-3.825586	5.871650	2.142485
-3.989574	2.774255	2.128617
-4.610000	6.400000	2.115000
-4.651935	2.584839	2.114839
-0.750847	2.276780	2.130339
-1.007343	4.362841	2.146679
-1.054857	3.197048	2.143905
-1.093226	2.130645	2.136290
-1.148511	2.539198	2.146870
-1.397500	1.610972	2.134028
-1.478368	0.429540	2.142887
-1.956739	2.887826	2.131522
-2.071818	5.810341	2.136591
-2.118529	0.291912	2.147831
-2.135816	5.366667	2.136099
-3.140367	0.771193	2.137706
-3.162515	0.126140	2.140058
-3.230968	5.925242	2.142339
-4.174286	3.687143	2.124762
-4.206526	3.093368	2.134211
-4.210357	0.256339	2.136250
-4.407500	3.617000	2.134500
-4.395308	5.213077	2.141615
-4.415162	1.400767	2.152507
-4.631796	5.370299	2.138623
-4.638768	3.329668	2.144739
-0.725769	0.011538	2.143077
-1.189904	2.992596	2.145673
-1.205313	6.091875	2.146250
-1.552146	4.443765	2.151619
-1.863077	6.165275	2.147363
-1.881498	1.473921	2.161145
-2.058674	3.878934	2.163343
-2.267667	3.493250	2.141083
-2.409433	0.275709	2.160324
-2.538093	6.067034	2.156907
-2.706038	4.323585	2.157673
-3.175084	3.926034	2.150838
-3.402000	1.999533	2.150733
-3.403823	4.059932	2.162765
-3.543250	1.409500	2.137750
-3.603115	1.115246	2.137213
-3.640714	4.899524	2.137857
-3.728028	4.658451	2.148451
-3.949091	3.960663	2.165430
-4.095529	3.311294	2.147882
-4.170077	0.777846	2.144538
-0.547103	4.291121	2.163364
-0.763068	1.798125	2.163693
-0.964842	1.645579	2.158947
-0.982316	2.344737	2.153789
-1.188416	6.354505	2.152871
-1.390000	2.435596	2.156943
-1.757308	0.930000	2.168974
-1.762865	5.124568	2.176432
-2.336484	2.193077	2.157637
-2.364068	5.890085	2.159237
-2.873426	0.814143	2.165857
-3.288095	1.775000	2.155833
-3.701152	1.596848	2.158121
-3.820602	2.187349	2.154096
-3.974979	0.170083	2.162075
-3.999014	2.018310	2.161690
-4.458750	0.176977	2.166570
-4.635104	6.004583	2.155313
-0.539452	6.359726	2.162123
-1.111912	5.080735	2.161618
-1.173802	1.315950	2.159421
-1.426538	6.361394	2.163221
-1.493750	0.172880	2.178315
-1.499512	5.719878	2.158780
-1.540522	3.511381	2.185075
-2.233846	6.302010	2.184293
-2.325909	0.944848	2.178636
-2.443762	1.780396	2.166733
-2.510236	4.498850	2.179027
-2.555161	3.489677	2.168581
-2.761429	2.632976	2.161905
-2.953587	4.298804	2.169239
-3.041961	1.763007	2.169346
-3.616667	0.750698	2.163643
-3.654478	4.002836	2.166119
-3.936098	2.528699	2.176748
-4.193073	2.576094	2.179792
-4.403199	6.264412	2.172831
-4.649162	0.438534	2.174712
-4.646818	0.970455	2.173364
-0.562948	0.922500	2.182724
-1.232563	0.929625	2.183000
-1.395391	3.129565	2.177478
-1.455862	5.471724	2.172414
-1.513275	5.228838	2.191690
-1.630000	2.352642	2.173962
-1.975432	1.729388	2.185252
-2.095792	6.066264	2.200000
-2.706423	3.697664	2.179927
-3.352500	2.274000	2.168000
-3.420766	5.547033	2.182392
-3.445309	0.933454	2.184021
-3.774430	5.188228	2.171646
-4.598396	0.698160	2.191132
-1.290494	4.352889	2.207901
-2.199503	2.872762	2.191989
-2.405682	2.716909	2.196227
-2.480121	5.201660	2.198826
-2.684660	0.133223	2.206816
-2.749524	2.126786	2.182857
-2.786192	4.785771	2.201519
-3.142051	1.252692	2.186026
-3.581613	2.164032	2.180161
-3.946216	3.693514	2.183784
-4.071129	5.770040	2.191976
-4.167484	1.799097	2.199161
-4.618390	2.832634	2.196000
-4.660879	2.176374	2.189231
-0.967097	6.395484	2.192581
-1.094411	4.113042	2.204753
-1.440233	0.680543	2.195581
-1.559245	1.776415	2.194717
-2.146484	2.354176	2.199011
-2.554470	2.510000	2.195606
-3.163171	3.668902	2.193171
-3.193924	5.676181	2.206354
-3.329944	4.684551	2.197022
-3.341556	6.256778	2.193222
-3.536947	3.093009	2.209469
-3.739000	6.399000	2.183000
-4.026341	1.337268	2.198976
-4.166885	1.538361	2.191639
-4.198421	6.395000	2.191579
-4.382673	0.435220	2.210094
-4.450755	1.142453	2.191887
-1.297129	2.004484	2.218258
-2.061166	0.045276	2.210491
-2.271905	1.949524	2.199206
-2.357535	0.685634	2.205986
-2.935097	1.081039	2.219662
-3.455878	2.766486	2.208446
-3.908841	0.734663	2.220647
-3.944050	6.113524	2.224622
-3.944964	5.021241	2.210438
-4.167455	4.397818	2.205545
-4.217346	3.927668	2.216756
-4.320909	2.352576	2.199848
-4.644932	4.014527	2.222162
-0.546171	4.967229	2.230286
-0.794988	5.873963	2.237063
-0.938995	1.398141	2.227839
-1.378696	4.616377	2.210145
-1.576901	2.599624	2.226761
-1.709559	0.040662	2.210882
-1.711315	4.204877	2.230247
-1.867353	5.915686	2.214804
-2.139429	1.523048	2.216619
-2.437897	0.026172	2.235483
-2.552532	1.393427	2.237519
-2.779231	6.067527	2.227143
-3.197966	5.394972	2.227712
-3.182977	0.370194	2.229968
-3.527436	4.536026	2.215641
-3.823897	4.436197	2.220939
-4.033324	0.981633	2.229799
-4.051071	2.296952	2.239571
-4.178615	4.682872	2.222103
-4.335427	4.975366	2.224390
-4.437099	3.013969	2.220611
-4.589375	4.924010	2.217031
-4.655200	4.425600	2.218800
-0.539691	1.890619	2.224845
-0.536207	5.345402	2.240000
-0.637690	2.540854	2.240316
-1.261603	0.078092	2.228550
-1.265203	5.713514	2.224459
-1.347788	5.039135	2.224712
-1.779434	1.883208	2.229434
-1.862513	4.668901	2.228534
-1.884957	0.220261	2.224174
-2.224472	3.230081	2.227724
-2.341617	3.891320	2.240231
-2.359027	5.445324	2.240405
-2.907598	4.545196	2.229497
-2.924014	6.293116	2.247746
-2.978594	2.048906	2.220156
-3.152688	2.795336	2.236759
-3.198987	1.003671	2.239968
-3.322577	1.536810	2.232086
-3.683622	2.563465	2.232441
-3.690233	0.518915	2.229690
-4.184185	5.364630	2.240148
-4.646733	3.587833	2.232867
-4.651234	1.701591	2.241396
-0.554754	1.190352	2.241937
-0.550313	3.396677	2.245549
-0.562153	0.419059	2.256757
-0.669000	4.084143	2.231143
-0.727874	4.739275	2.238986
-0.967442	5.256860	2.230000
-1.024021	5.601678	2.250420
-1.320794	3.363730	2.238254
-1.416844	1.364867	2.252625
-1.656827	6.053896	2.240482
-2.027823	0.954962	2.246937
-2.102826	4.716522	2.226304
-2.651552	1.898103	2.232414
-2.844092	5.705036	2.247482
-2.931220	3.522857	2.244821
-3.012581	0.574919	2.247581
-3.070412	1.488765	2.244882
-3.172584	3.419101	2.234045
-3.475926	5.874321	2.231728
-3.649030	6.042313	2.235597
-4.225163	5.981276	2.246142
-4.389205	4.512045	2.230568
-4.463333	4.275789	2.237544
-0.768354	3.583171	2.257866
-0.933128	4.935922	2.248324
-0.950558	0.055020	2.250000
-1.029200	3.636831	2.260369
-1.099021	2.776154	2.248112
-1.679623	0.639434	2.242264
-1.815424	2.718644	2.250678
-1.956966	2.517528	2.247753
-2.034303	2.129084	2.259801
-2.593182	0.785682	2.236364
-2.741245	3.332101	2.256926
-3.815500	1.862333	2.241750
-3.814070	5.604186	2.240349
-3.948471	1.642851	2.255950
-4.208840	2.830552	2.248619
-4.560779	2.402532	2.248312
-0.533282	5.879590	2.266667
-0.540897	2.290493	2.269507
-0.757041	0.234794	2.266067
-0.770000	3.199115	2.255929
-1.187203	1.557106	2.271286
-1.236566	2.272929	2.268283
-1.670353	0.328471	2.261294
-1.718793	2.133448	2.255000
-1.994806	6.348101	2.255853
-2.031186	1.280339	2.270169
-2.036255	4.475404	2.265660
-2.161015	5.617481	2.268722
-2.640056	1.646348	2.268090
-2.629091	2.807500	2.256364
-2.668134	0.403085	2.271294
-2.815392	1.458387	2.260046
-3.056139	5.089430	2.262975
-3.390847	0.081230	2.265628
-3.375505	1.288165	2.264037
-3.417197	4.973131	2.275025
-3.436842	3.339684	2.260526
-3.446073	5.304977	2.272283
-3.704887	3.764561	2.274712
-3.717385	2.820769	2.248462
-3.838925	1.156262	2.263271
-4.656000	1.426333	2.259556
-0.755857	1.567143	2.262571
-0.756000	5.123838	2.268432
-0.757068	5.601142	2.280710
-0.795469	0.665429	2.275184
-0.928729	3.390847	2.272966
-0.973253	2.993373	2.258434
-1.594634	1.550366	2.268415
-1.612051	4.697436	2.268718
-2.101905	4.227619	2.262381
-2.131690	4.963451	2.265423
-2.421176	4.736642	2.286225
-2.561353	4.041014	2.270531
-2.688176	3.060486	2.274863
-2.939231	5.329402	2.273704
-3.019390	5.986098	2.276402
-3.115728	2.407616	2.276594
-3.411257	4.315286	2.279829
-3.853151	3.402059	2.277773
-3.984400	4.248933	2.259600
-4.437121	2.633485	2.268737
-4.436556	2.091000	2.262778
-4.458667	3.832917	2.262000
-4.640505	6.229343	2.266263
-0.760000	2.768070	2.268070
-0.923722	2.574233	2.287670
-0.990000	0.844112	2.271776
-1.468626	2.192748	2.278931
-1.704625	1.330875	2.287125
-1.903922	5.670915	2.287353
-2.006818	3.565808	2.278737
-2.054896	3.059167	2.275000
-2.478623	6.318000	2.294522
-2.552931	1.037915	2.291118
-2.919823	0.318009	2.291416
-2.988000	3.267000	2.273750
-3.001543	4.072394	2.280798
-3.168137	6.387081	2.286087
-3.175388	4.865437	2.286602
-3.513617	1.714468	2.268723
-3.612803	3.508333	2.283182
-3.644044	0.138603	2.278971
-3.911114	4.771969	2.293057
-4.083684	3.521729	2.282857
-4.219635	0.055401	2.279489
-4.430462	3.414740	2.283237
-0.534896	2.981354	2.280208
-0.539762	1.450952	2.285794
-0.738805	6.380377	2.290377
-0.862632	2.106813	2.296199
-1.003663	6.083762	2.282673
-1.064242	1.127980	2.287475
-1.160792	0.667624	2.286931
-1.331145	2.665771	2.295066
-1.322007	3.622847	2.301204
-1.442529	5.917529	2.287241
-1.473026	4.126842	2.287500
-2.294722	4.386333	2.285833
-2.375283	1.582170	2.285566
-2.597759	4.935862	2.284310
-2.993675	2.984701	2.290000
-3.402462	3.823231	2.301169
-3.502902	0.346814	2.300757
-3.815366	0.317154	2.285285
-3.809111	1.414667	2.278889
-3.835000	0.012353	2.288529
-4.049452	0.381918	2.279589
-4.635596	5.791927	2.280917
-0.737525	3.838416	2.291881
-0.766949	6.126949	2.295678
-0.889888	4.544906	2.309288
-0.995919	0.343860	2.305699
-1.243481	5.465414	2.299834
-1.301474	0.317053	2.289158
-1.400891	3.880545	2.307475
-1.549434	3.282453	2.292830
-1.733622	6.297135	2.300270
-1.870260	4.919545	2.303247
-1.878746	5.385559	2.312508
-2.326752	2.496838	2.303419
-2.335321	6.088899	2.294312
-2.372500	4.996176	2.295882
-2.537000	2.147000	2.293667
-2.688077	5.312051	2.294103
-2.806579	5.069123	2.304211
-3.211910	3.179775	2.297865
-3.339164	2.554695	2.312154
-3.331596	2.967766	2.290638
-3.895765	5.356588	2.294235
-4.244308	4.182923	2.289385
-4.662733	3.115291	2.298895
-0.751993	4.313838	2.320000
-1.538627	1.126415	2.318319
-1.645977	3.957931	2.304368
-1.913262	0.464946	2.313692
-1.899444	0.730185	2.318843
-2.133571	0.638333	2.302540
-2.236220	5.210697	2.320590
-2.397732	3.636320	2.316729
-2.633071	5.551929	2.310857
-2.730455	1.218030	2.300909
-3.160326	4.271739	2.299239
-3.530949	2.369854	2.305182
-4.398750	1.773571	2.310357
-4.431007	0.927987	2.306577
-4.654881	5.546071	2.308571
-1.034404	1.827294	2.325275
-1.667129	5.537129	2.315248
-1.808305	2.995254	2.321017
-1.821579	3.259323	2.322406
-1.863754	3.780853	2.326109
-2.280738	0.423839	2.335423
-2.453527	3.169130	2.333961
-2.610513	5.814103	2.330000
-2.789000	3.943400	2.311400
-2.992827	0.062560	2.330107
-3.591910	1.952022	2.310337
-3.616842	1.272406	2.323985
-3.658873	0.963237	2.334393
-4.035135	5.552973	2.315811
-4.373533	0.673952	2.322575
-4.456545	6.058364	2.304727
-4.658056	1.937611	2.342333
-4.635922	5.171714	2.328494
-0.523802	6.131818	2.330661
-0.808188	1.174161	2.334396
-0.886316	4.028246	2.317368
-1.350959	2.928082	2.326233
-1.349774	1.762594	2.337030
-1.436729	6.169159	2.324206
-1.607204	2.830645	2.325161
-1.672965	5.804024	2.345271
-1.764571	3.503905	2.325333
-2.195371	1.752522	2.343501
-2.247810	0.165143	2.324095
-2.769763	0.646126	2.337510
-2.852417	1.800083	2.325917
-2.905813	2.750813	2.332063
-3.351348	3.562809	2.323371
-3.580379	4.759300	2.341137
-3.807800	2.359800	2.333200
-3.993939	2.932727	2.319091
-4.124643	4.903750	2.324107
-4.667572	1.175723	2.336879
-1.100163	4.688455	2.339756
-1.150417	3.856111	2.331944
-1.427724	0.885854	2.339919
-1.627273	4.941818	2.332078
-1.832841	1.112564	2.357460
-2.200502	5.866164	2.344110
-2.211111	1.108889	2.325333
-2.316545	1.326364	2.336000
-2.528876	4.289438	2.332247
-2.919189	2.246892	2.334730
-3.125647	4.609964	2.353345
-3.287625	0.785000	2.335750
-3.481770	0.617472	2.350787
-3.670000	5.776667	2.330575
-3.698936	5.015390	2.349858
-3.800565	4.102177	2.340565
-3.991479	3.188343	2.343728
-4.119919	0.619514	2.344332
-4.165064	2.080833	2.345513
-4.246782	1.087356	2.334253
-4.407130	4.747523	2.345257
-0.522449	3.678571	2.342653
-1.201657	3.132857	2.351943
-1.207157	5.206559	2.364190
-1.202581	5.947903	2.354839
-1.791458	1.662917	2.343542
-1.981179	5.146103	2.355487
-2.331716	4.132781	2.353018
-2.385802	5.702099	2.339753
-2.387885	2.918077	2.356474
-2.680199	2.343625	2.358645
-3.430882	6.086029	2.346912
-3.523671	6.341529	2.362071
-3.776242	3.045839	2.346107
-4.163250	6.223114	2.364565
-4.240382	1.359013	2.355669
-4.447692	5.365128	2.351923
-0.552811	0.081281	2.372792
-0.781872	2.355882	2.364439
-1.157708	4.938819	2.363125
-1.541076	1.959861	2.372396
-1.600880	3.706053	2.370240
-1.730484	4.482881	2.369007
-2.778479	4.192350	2.362166
-2.888904	2.496849	2.354247
-3.046339	0.828142	2.363989
-3.149677	2.155806	2.359113
-3.199487	6.139231	2.358846
-3.768482	6.249805	2.365058
-3.913173	2.709904	2.355865
-4.016631	4.533690	2.366043
-4.303571	3.656964	2.355060
-4.666606	4.712294	2.352936
-4.673146	2.648652	2.353146
-0.528169	1.691831	2.361127
-0.568462	0.743956	2.366374
-0.744884	5.351163	2.362558
-0.764211	0.908129	2.369532
-1.191875	6.205313	2.360000
-1.396070	4.816422	2.376716
-1.811374	2.345906	2.379883
-2.001034	2.834828	2.365402
-2.496292	0.564607	2.365618
-2.776173	0.940864	2.366543
-3.123448	1.909655	2.359655
-3.170500	1.678000	2.359250
-3.240385	4.043846	2.368385
-3.417037	2.139185	2.378543
-3.528723	1.494681	2.360426
-3.653333	3.264651	2.370310
-3.678462	5.280000	2.370513
-4.202590	5.138012	2.372048
-4.401149	5.817241	2.362644
-4.661789	4.229368	2.369368
-0.526343	3.932090	2.382164
-0.532703	2.741689	2.379932
-0.553072	4.472440	2.395361
-0.617107	2.071322	2.378512
-1.112892	2.081010	2.393275
-1.350500	0.543083	2.376167
-1.442102	5.627159	2.380625
-1.863023	4.047674	2.376163
-1.861135	6.098298	2.381418
-1.875315	0.031748	2.380909
-1.987439	1.903049	2.374756
-2.054444	3.331778	2.364444
-2.146615	3.755795	2.387231
-2.271176	3.423971	2.373382
-2.715613	4.459368	2.387589
-2.948476	3.759529	2.385374
-3.267766	5.893040	2.390220
-3.361522	1.868478	2.381449
-3.553596	4.093933	2.371236
-3.623432	5.535680	2.386509
-3.911919	2.113023	2.382965
-4.013902	1.888780	2.376585
-4.205610	0.850732	2.372439
-4.218571	3.042619	2.374524
-4.278618	5.563309	2.391564
-4.592744	0.291353	2.388496
-0.520000	5.649462	2.389785
-1.002201	4.273684	2.394593
-1.240000	6.400000	2.370000
-1.485970	4.360224	2.382761
-1.906618	4.296176	2.381471
-2.107473	4.021648	2.382527
-2.220497	0.852236	2.393230
-2.485274	0.227221	2.411444
-2.591718	3.800264	2.392643
-2.689545	3.561212	2.384091
-2.943923	4.881077	2.390538
-2.958750	1.291389	2.403090
-3.258333	5.177937	2.385397
-3.425702	5.694737	2.387632
-3.430955	1.081180	2.394270
-3.882935	0.534457	2.379239
-3.911004	5.781632	2.390962
-4.280144	0.282383	2.397220
-4.443231	4.063593	2.398078
-4.447670	1.530000	2.393252
-4.438884	0.046884	2.396000
-4.676522	3.811522	2.378261
-0.526633	4.197437	2.406080
-0.524194	4.753978	2.398118
-0.768686	2.989705	2.411528
-0.774160	1.879920	2.403680
-0.961270	1.587540	2.403413
-1.049200	2.371000	2.390900
-1.258919	4.073243	2.403784
-1.479800	5.374200	2.400300
-1.533780	2.407835	2.406850
-2.670702	2.614503	2.396784
-3.052407	5.762685	2.397407
-3.227742	0.552742	2.408656
-3.546164	2.914795	2.389452
-3.721389	0.711944	2.398796
-4.053102	4.046241	2.403431
-4.088291	3.777778	2.397949
-4.210945	3.325879	2.407585
-0.524737	6.376165	2.419286
-0.964446	6.305997	2.426780
-0.995426	5.806628	2.413915
-1.293852	1.102295	2.412623
-1.552945	3.063630	2.408356
-1.601226	0.139811	2.407925
-1.671055	0.901350	2.415654
-2.058261	0.291196	2.409348
-2.223901	4.603369	2.418050
-2.344700	2.260950	2.409650
-2.507903	3.405161	2.401935
-2.609849	6.076679	2.413132
-2.962419	4.376250	2.417782
-3.206049	0.185556	2.398395
-3.667917	2.167917	2.398750
-3.742670	1.610631	2.415777
-3.885373	3.625672	2.408731
-4.044776	0.174627	2.408284
-4.415576	2.850643	2.425630
-4.637895	3.344737	2.398684
-4.669538	0.828615	2.415538
-4.664654	0.551567	2.420276
-0.529371	5.153457	2.427486
-0.532954	3.193077	2.426615
-0.726667	4.917246	2.412174
-0.769685	0.437244	2.420000
-0.974314	5.413268	2.423072
-1.139507	3.376761	2.417042
-1.701048	5.193100	2.422926
-2.111667	5.416250	2.407361
-2.195323	2.681255	2.420875
-2.647500	4.711333	2.411750
-3.201273	1.192061	2.425152
-3.768780	4.591585	2.429065
-4.006111	2.488333	2.417333
-4.038687	1.197879	2.417475
-4.434212	3.170322	2.431768
-4.659278	5.996495	2.413918
-0.736604	3.380377	2.427830
-0.955324	3.192676	2.440971
-0.980706	0.568941	2.418353
-1.113259	0.146593	2.434593
-1.192778	0.869630	2.430494
-1.223846	1.350769	2.417231
-1.453488	5.126628	2.426279
-2.168200	6.331188	2.445840
-2.203514	2.020324	2.428865
-2.572568	5.132568	2.441694
-2.709655	2.036724	2.417759
-2.840769	5.887038	2.442462
-2.945842	5.540368	2.430737
-3.109725	2.625902	2.438043
-3.124560	3.568160	2.429280
-3.553667	2.674000	2.416333
-3.956907	5.141546	2.426186
-4.003960	1.452819	2.425772
-4.173000	5.794667	2.420222
-4.208846	1.605577	2.417885
-4.227353	2.645294	2.424902
-4.233978	2.374199	2.437735
-4.418089	6.271178	2.435796
-4.681974	0.041053	2.433816
-0.532662	0.991295	2.441439
-0.934702	3.803841	2.445232
-0.978132	5.097253	2.432857
-1.279815	2.451296	2.438519
-1.304795	4.578356	2.435479
-1.497143	3.474000	2.433810
-1.694211	0.489158	2.430526
-1.870414	1.449172	2.437724
-2.087391	2.310580	2.427681
-2.102679	0.022321	2.442768
-2.231278	3.102180	2.440000
-2.470667	4.530000	2.436778
-3.207205	5.564083	2.451157
-3.424000	3.157739	2.450261
-3.773910	5.998077	2.453910
-4.036400	6.002450	2.445400
-4.247708	4.530104	2.438438
-4.438636	1.217121	2.427879
-4.460175	2.267544	2.429825
-4.674262	2.174098	2.430000
-0.931732	2.787087	2.442756
-1.360714	0.140833	2.442262
-1.387950	1.532733	2.455776
-1.541882	0.677294	2.440000
-1.864177	2.096203	2.447595
-1.900375	5.866375	2.452000
-2.505056	5.386517	2.438202
-2.544512	1.241674	2.458326
-2.739244	0.213025	2.451092
-2.948033	1.586230	2.437705
-3.191961	3.806078	2.444314
-3.213438	1.448542	2.444271
-3.271757	3.367027	2.448243
-3.330976	2.777886	2.446423
-3.349200	4.725467	2.441867
-4.673119	2.899174	2.447798
-0.527925	2.463145	2.464403
-0.764074	1.397870	2.469398
-0.992407	1.305741	2.453704
-1.137805	2.642195	2.451707
-1.194176	5.656484	2.453407
-1.576593	1.711239	2.464469
-1.754321	2.596605	2.459259
-1.769928	4.751151	2.463237
-1.816641	0.271390	2.461583
-2.029636	4.781844	2.465818
-2.093708	6.063596	2.464326
-2.413761	5.927064	2.451468
-2.444262	2.696230	2.450000
-2.459151	1.971550	2.465203
-2.501385	0.793723	2.470130
-2.851624	6.145635	2.457411
-2.887732	3.142784	2.452268
-3.497612	4.538209	2.455821
-3.846137	4.328164	2.472575
-3.858701	3.877597	2.460390
-4.114797	4.309926	2.470406
-0.730899	2.618820	2.474944
-1.245085	4.331898	2.480305
-1.486869	0.354720	2.469159
-2.189720	1.503808	2.478855
-2.890415	4.640829	2.473594
-2.945641	2.038333	2.460641
-3.271798	4.427472	2.473146
-3.493004	5.144635	2.469528
-3.540185	3.680556	2.457778
-3.592857	4.317619	2.460238
-3.804805	0.151289	2.476484
-4.236471	1.874853	2.461324
-4.396745	4.993632	2.472406
-4.465682	1.961667	2.471515
-4.670575	4.465747	2.465287
-0.933158	3.531228	2.474737
-1.145639	2.908797	2.475338
-1.515775	2.658169	2.472113
-1.568427	6.023387	2.480081
-1.766207	1.875862	2.475172
-1.901289	6.338328	2.482822
-1.988036	1.663571	2.469107
-2.129740	4.346364	2.479675
-2.351016	0.023594	2.497383
-2.633609	2.912782	2.481880
-2.657107	1.786038	2.497201
-2.661127	3.225352	2.474225
-2.657482	6.317482	2.480144
-2.707760	1.517656	2.485885
-3.158406	3.019275	2.468261
-3.277958	2.355870	2.489211
-3.377258	1.637742	2.474839
-3.878877	1.007935	2.485833
-4.058884	5.371373	2.483734
-4.409646	4.324513	2.488820
-4.673761	2.426923	2.478632
-0.640640	5.968160	2.501520
-0.753574	4.669398	2.494779
-0.956716	4.842799	2.499179
-1.348095	2.084603	2.485238
-1.448934	6.362738	2.490490
-1.631931	2.180621	2.486207
-1.687725	4.246825	2.495782
-1.996804	2.534536	2.487732
-2.071593	5.711062	2.488230
-2.300244	0.639593	2.490569
-2.313069	5.522277	2.484950
-2.380992	1.030413	2.500468
-2.462889	1.472000	2.482444
-2.492000	2.458182	2.481818
-2.816371	0.448871	2.484677
-2.967627	6.379831	2.488192
-3.075969	0.361323	2.504923
-3.297514	6.326851	2.499475
-3.425634	5.433239	2.485070
-3.474143	0.843429	2.487286
-3.527765	5.896332	2.504756
-3.684506	0.379691	2.487160
-3.795339	1.908898	2.481441
-3.818738	1.297767	2.485243
-3.860741	5.542525	2.496094
-3.954249	0.750363	2.491036
-4.298636	6.023750	2.486023
-4.659563	5.382313	2.495313
-0.532365	1.252230	2.500541
-0.549219	0.313125	2.494375
-0.709912	3.647478	2.504735
-0.740294	1.650294	2.486176
-1.150186	3.666097	2.500149
-1.367320	3.266000	2.505000
-1.622667	1.452889	2.490444
-1.910952	0.906786	2.503810
-1.981351	3.143649	2.490811
-2.233077	4.952203	2.505455
-2.306966	3.930112	2.495506
-2.484721	4.887462	2.501726
-2.728125	4.936250	2.489750
-2.999009	1.045129	2.503664
-3.086794	5.321435	2.500191
-3.232444	0.956889	2.490667
-3.507929	0.170165	2.507882
-3.491364	3.446136	2.488864
-3.574029	1.792662	2.497122
-4.672532	3.579241	2.492405
-0.529976	5.423501	2.523693
-0.761914	5.723301	2.518182
-0.779319	0.168637	2.532525
-0.925556	6.035291	2.516032
-1.171667	1.700000	2.500000
-1.446493	1.286716	2.507015
-1.543000	4.630150	2.520650
-1.890326	5.551630	2.510326
-1.960270	4.528378	2.497297
-2.399532	1.712222	2.512982
-2.389907	6.181757	2.526505
-2.667162	4.017297	2.501892
-2.739337	5.420422	2.508795
-2.856462	5.192736	2.516792
-3.001469	0.618898	2.510653
-3.033982	3.333009	2.507965
-3.071686	5.054767	2.516105
-3.418487	1.332237	2.508355
-3.703611	2.503889	2.507917
-3.734762	3.456786	2.507262
-3.983616	3.414915	2.512881
-4.046133	4.738267	2.503867
-4.131753	2.861169	2.512403
-4.438609	2.532180	2.513045
-4.652937	5.701599	2.517807
-4.678400	1.504800	2.493600
-0.772952	4.139692	2.521322
-0.766190	5.172619	2.510476
-0.963484	0.806129	2.525806
-1.023050	4.038450	2.519650
-1.389290	5.833470	2.531995
-1.543613	3.912941	2.521345
-1.650732	3.281288	2.527197
-1.948992	3.622868	2.521395
-2.372375	4.324125	2.514500
-2.897143	3.536327	2.502653
-3.310068	4.967055	2.514384
-3.380378	4.194244	2.526176
-3.618125	3.902813	2.511094
-3.743623	2.785217	2.511014
-3.876915	4.923682	2.520448
-3.967176	1.694824	2.514824
-4.307410	3.860392	2.527199
-4.429173	0.455276	2.525157
-4.655197	6.227566	2.518026
-4.665923	1.753462	2.519385
-0.531216	0.555000	2.518243
-0.744429	6.208286	2.526143
-0.934222	2.206111	2.529000
-0.983832	1.066287	2.527904
-1.238395	0.347778	2.525123
-1.672331	6.245276	2.530920
-1.769512	0.699512	2.529512
-2.041377	1.281138	2.541737
-2.053938	0.690702	2.552982
-2.394000	6.400000	2.508000
-2.756695	1.128898	2.522797
-2.853870	0.023448	2.549349
-3.112986	4.190569	2.530711
-3.130260	4.796104	2.526623
-3.303274	0.018053	2.534690
-3.985702	6.348764	2.532837
-4.537069	1.017759	2.516724
-4.673833	4.027667	2.516833
-0.536860	1.515041	2.538140
-0.537128	2.949773	2.560101
-0.755041	0.661488	2.531157
-0.847281	4.425392	2.545530
-1.187961	0.638750	2.541645
-1.235039	5.413586	2.552287
-1.331513	6.116933	2.555819
-1.681478	5.420522	2.532696
-1.692620	1.227380	2.548984
-1.852000	5.019163	2.537953
-1.979944	3.880281	2.548652
-2.128043	1.031304	2.535652
-2.260517	2.463276	2.533448
-2.541786	5.612937	2.544048
-2.556711	2.197763	2.529342
-2.891061	2.903128	2.543464
-2.939326	3.979775	2.541723
-3.015351	2.398129	2.557719
-3.250141	2.026761	2.535493
-3.424741	0.439310	2.531810
-3.580674	6.153820	2.530112
-3.941633	0.359660	2.535442
-4.453465	3.429604	2.532772
-0.521842	3.434803	2.546250
-1.086025	4.543185	2.561531
-1.209908	4.775505	2.547798
-1.459494	4.150759	2.539620
-1.898557	3.371443	2.545155
-1.942182	5.308682	2.556182
-2.185493	3.568028	2.544085
-2.353778	5.231185	2.551704
-2.503462	3.608956	2.560440
-2.816154	0.788077	2.542981
-3.378608	3.930253	2.544684
-3.537847	2.306794	2.555311
-3.833854	3.194688	2.542292
-4.077838	2.209730	2.534595
-4.131368	1.009368	2.552526
-4.168194	0.468472	2.554537
-4.301471	2.131176	2.542647
-0.952720	2.524400	2.559120
-1.414374	3.684019	2.573759
-1.501952	1.035833	2.576571
-2.420899	0.435043	2.573217
-2.628075	4.283054	2.564519
-2.807763	2.220274	2.560457
-3.550405	4.900270	2.563581
-3.610588	1.164163	2.563439
-3.902203	2.956780	2.547627
-4.128602	4.985508	2.564492
-4.203593	3.546587	2.560419
-4.414286	1.723036	2.550714
-4.459975	4.594081	2.565894
-4.480182	5.216364	2.556727
-4.652357	5.026650	2.568809
-4.666839	3.144943	2.557931
-0.525217	2.222717	2.560761
-0.960909	0.010000	2.554545
-0.996034	0.363190	2.565172
-1.359624	3.007970	2.568045
-1.607286	5.004429	2.563000
-1.711377	3.542395	2.569401
-1.768704	3.048611	2.572963
-2.088478	2.946957	2.562609
-2.292674	5.750698	2.563605
-2.644229	0.606432	2.570176
-2.860465	2.651395	2.558372
-2.930095	1.799714	2.577079
-3.091299	6.178468	2.580286
-3.334187	6.067355	2.586667
-3.638261	1.438261	2.560145
-3.727941	5.747647	2.557059
-3.828333	5.295370	2.562037
-3.855796	2.308938	2.578274
-4.091201	3.134047	2.584047
-4.250128	4.114615	2.559872
-4.278000	4.779000	2.565143
-4.436281	0.716942	2.565537
-0.517722	4.935316	2.575823
-0.932987	1.955325	2.584870
-1.174304	2.256311	2.588350
-1.380973	0.792478	2.578938
-1.577108	2.877169	2.578193
-1.685153	5.685194	2.593313
-1.747273	3.787727	2.564318
-1.892587	2.778187	2.591973
-1.988264	4.149097	2.583264
-2.166061	0.452929	2.574545
-2.310107	1.280643	2.591850
-2.367217	3.302565	2.579913
-2.442216	3.045412	2.580206
-2.593061	0.058131	2.597336
-2.624801	5.875909	2.591790
-3.044118	5.918235	2.576471
-3.333813	3.614676	2.574173
-3.600698	0.599070	2.577093
-3.663089	3.010244	2.582033
-4.441494	5.478276	2.585575
-4.494519	5.910000	2.573111
-0.520183	6.182385	2.584587
-0.519800	3.784400	2.584800
-0.521053	1.977895	2.582105
-0.749567	1.152987	2.596017
-0.990458	5.608431	2.601176
-1.175690	1.928103	2.581034
-1.204652	6.358182	2.590588
-1.248383	3.890240	2.589222
-1.316328	2.747574	2.606459
-1.881591	0.486667	2.603258
-2.244855	0.220217	2.587826
-2.451071	4.102262	2.588810
-2.754404	3.731124	2.599679
-2.793585	5.672981	2.591321
-3.433493	2.550478	2.596801
-4.257757	1.243694	2.604037
-4.453023	0.209302	2.580233
-0.740767	3.185879	2.603546
-0.744397	3.889397	2.596810
-0.790373	5.414533	2.606293
-1.141971	5.923019	2.615367
-1.381750	1.808500	2.593000
-1.773226	1.616989	2.592258
-2.696154	3.435128	2.598034
-2.871277	4.219574	2.592128
-3.877872	4.097340	2.592128
-4.055500	5.675900	2.597900
-4.189037	0.752222	2.600444
-4.245577	5.244615	2.587115
-4.325364	5.714904	2.607548
-4.661984	2.685709	2.607935
-4.663902	4.753049	2.602317
-0.532658	0.785443	2.605063
-0.537764	4.045000	2.625590
-0.948269	2.990641	2.609615
-1.086111	1.492778	2.605317
-1.134601	5.013497	2.605276
-1.790406	6.021265	2.628401
-1.995593	0.162667	2.609741
-2.299455	2.827891	2.614727
-2.707650	2.458060	2.629126
-3.076544	0.128456	2.607426
-3.171938	1.671125	2.606063
-3.287411	0.700670	2.615402
-3.312234	5.257056	2.615990
-3.512347	5.632721	2.621190
-3.525854	6.387561	2.603415
-3.709884	5.089884	2.603023
-3.736271	3.712712	2.598136
-3.748874	6.312517	2.605563
-3.915044	2.634167	2.619649
-4.507546	1.370417	2.611111
-4.673267	1.993663	2.601584
-0.531179	4.616829	2.626341
-0.532674	2.661444	2.626898
-0.533346	4.340769	2.633308
-0.728793	2.093621	2.613276
-0.759958	2.359792	2.623792
-0.758000	2.824846	2.617615
-1.151220	3.159762	2.625744
-1.410855	0.544737	2.617171
-1.437373	2.276314	2.626186
-1.461399	5.546923	2.619231
-2.032412	2.038235	2.618000
-2.826098	1.339268	2.606341
-3.130324	2.820926	2.620000
-3.287592	0.259634	2.624817
-3.353770	2.963811	2.623648
-3.675800	0.921400	2.610000
-3.982680	3.723196	2.620722
-4.015613	4.517350	2.630912
-4.144313	6.153359	2.631565
-4.660187	3.802336	2.628785
-4.661563	4.252969	2.612969
-4.682391	1.175652	2.609565
-0.532226	5.705110	2.645799
-0.748947	0.891579	2.620526
-0.960833	1.703214	2.626429
-1.167657	1.247483	2.641434
-1.488025	5.290988	2.634259
-1.526952	2.003524	2.629524
-1.673107	2.405000	2.634854
-1.743444	4.032384	2.633046
-1.765877	4.461801	2.628578
-2.102195	5.506234	2.645337
-2.163140	1.720814	2.623256
-2.241939	2.183091	2.629818
-2.622632	2.712105	2.623474
-2.642069	0.941724	2.619138
-2.806093	4.457417	2.633709
-3.041983	1.457190	2.623223
-3.039667	5.668500	2.622833
-3.076181	0.838611	2.629375
-3.219025	3.202086	2.641247
-3.253366	5.798000	2.630927
-3.459063	2.073750	2.636016
-3.606556	3.268036	2.635589
-3.621702	4.137518	2.638156
-3.701122	2.110102	2.629898
-3.918095	5.874127	2.628095
-3.935977	2.044828	2.629885
-4.188371	0.215140	2.644803
-4.359293	3.012989	2.641033
-4.447660	3.663723	2.622340
-4.664601	0.395460	2.635153
-0.524286	1.745714	2.628000
-1.246996	3.454032	2.643004
-1.248271	0.992944	2.651682
-1.440233	4.839535	2.634341
-1.475615	4.390462	2.642962
-2.129912	5.155242	2.637841
-2.250588	0.851307	2.642353
-2.522614	3.866863	2.639150
-2.920643	4.888006	2.645434
-3.070552	2.149816	2.648098
-3.084753	4.425157	2.647982
-3.367770	1.834865	2.638851
-3.531791	2.792090	2.627463
-3.590686	5.319840	2.647666
-3.680795	4.467500	2.635341
-3.751188	4.736875	2.642875
-3.863457	1.486543	2.631728
-3.900333	6.122111	2.636556
-4.085882	3.951078	2.638333
-4.157468	5.896709	2.637595
-4.187091	1.708182	2.641636
-0.540536	0.125179	2.640357
-0.990984	5.226230	2.637213
-1.023974	4.266538	2.638974
-1.243229	0.090646	2.663274
-1.364333	5.078000	2.644833
-1.573392	0.145636	2.666908
-1.856800	2.241600	2.645333
-2.218293	4.724042	2.655749
-2.657175	0.353234	2.664535
-3.395417	1.053833	2.657458
-3.759247	1.713011	2.647957
-4.079378	2.427772	2.652073
-0.958541	3.336865	2.662649
-1.060385	2.756154	2.661319
-1.186313	2.517095	2.678547
-1.240855	4.141453	2.656581
-1.632649	0.424106	2.665364
-1.921096	1.807123	2.657329
-2.034556	5.916006	2.669852
-2.044006	6.217596	2.666409
-2.068673	2.367092	2.668878
-2.276901	1.928592	2.652394
-2.279524	5.979921	2.651429
-2.305574	3.745574	2.650656
-2.624943	6.142586	2.672069
-2.670597	2.024925	2.650149
-2.711919	4.712551	2.668555
-3.261012	4.626640	2.660243
-3.511509	4.671321	2.660189
-3.970901	1.182973	2.654685
-4.123874	1.461982	2.652703
-4.351744	0.935814	2.650814
-4.667852	0.662349	2.659463
-4.669888	3.386180	2.648315
-0.734359	4.865846	2.673128
-0.775914	0.413710	2.674140
-0.961434	0.595814	2.673372
-1.009304	6.215304	2.671304
-2.137966	2.624068	2.675480
-2.224298	4.201157	2.674298
-2.411455	2.597818	2.668273
-2.594362	1.374947	2.678245
-2.836667	5.994881	2.669167
-2.864074	6.265556	2.682481
-2.937365	5.447814	2.679341
-3.229854	1.267816	2.687694
-3.431245	4.424440	2.677386
-4.266667	3.322510	2.677412
-4.671111	2.257222	2.666825
-0.540851	6.393617	2.672340
-0.736250	3.450357	2.665714
-0.747826	1.818478	2.665435
-1.340270	1.435811	2.683446
-1.450516	2.537613	2.679032
-1.727217	0.910061	2.680214
-1.729315	5.202904	2.686411
-2.187681	3.151304	2.676957
-2.251641	4.458750	2.676484
-2.266667	6.361897	2.691626
-2.526839	4.498705	2.689326
-2.528647	5.355714	2.680451
-2.604428	5.034797	2.690775
-2.903224	0.277632	2.682829
-3.131395	3.714264	2.686512
-3.153793	3.465862	2.668621
-3.342247	1.504270	2.668090
-3.680139	0.062404	2.688362
-4.171818	1.965682	2.673409
-4.181026	2.672821	2.667308
-4.420440	2.745535	2.684214
-4.657319	0.044933	2.687748
-0.529530	5.211745	2.687047
-0.546745	1.028019	2.698396
-0.906400	5.848400	2.676933
-0.920909	1.325207	2.682314
-1.237855	5.672013	2.703729
-1.332735	4.610122	2.694327
-1.503148	3.450247	2.688642
-1.556452	3.104301	2.689677
-1.667838	2.666419	2.690473
-1.861007	1.400104	2.696528
-1.887107	1.125028	2.706713
-2.005664	4.392920	2.687434
-2.031855	4.913345	2.699527
-2.105161	3.382796	2.687634
-2.153529	0.011176	2.680588
-2.346404	1.542959	2.697678
-2.430053	2.340160	2.691016
-2.572645	6.386777	2.690826
-2.585000	1.627097	2.685968
-2.860899	3.202360	2.685056
-3.165149	3.983731	2.696381
-3.503210	3.772399	2.694982
-3.774267	0.725600	2.683733
-3.937322	0.120711	2.708104
-3.956646	5.133634	2.705217
-4.207182	5.491572	2.705203
-4.420446	6.345785	2.700246
-0.776382	1.537884	2.705870
-0.908933	4.682267	2.688933
-1.016542	3.844034	2.700000
-1.513300	1.620800	2.697500
-1.674609	1.819922	2.699531
-1.925135	4.661189	2.699946
-2.172164	3.949179	2.702015
-2.505636	1.853636	2.688909
-3.078203	6.388281	2.708828
-3.200843	5.475172	2.705670
-3.604505	3.527143	2.696813
-3.685130	6.003239	2.708227
-3.790493	0.470987	2.706951
-4.158803	6.388632	2.703675
-4.238129	4.334082	2.709456
-4.430909	2.270000	2.685455
-4.444973	4.172295	2.704809
-1.014737	3.570526	2.694737
-1.602431	0.682099	2.717514
-1.882727	2.540420	2.712448
-1.921250	5.685395	2.708355
-2.512251	1.131602	2.716234
-2.831762	1.576211	2.712291
-2.856641	0.539733	2.715115
-2.868545	0.960933	2.717985
-3.129558	0.517666	2.720442
-3.133700	1.901145	2.721762
-3.387724	3.401870	2.703659
-3.581970	0.323788	2.711212
-3.964842	0.893079	2.724184
-3.998968	0.623175	2.709048
-4.629157	2.933652	2.707303
-4.660055	0.926813	2.714725
-4.657636	4.487818	2.707636
-0.531961	2.417647	2.716275
-0.777677	6.054949	2.711515
-0.966407	0.168982	2.715808
-1.513122	6.248416	2.722127
-2.372299	5.543678	2.717816
-2.448526	0.230842	2.718421
-2.620231	3.173308	2.713846
-2.964299	4.636075	2.719346
-2.986316	1.187632	2.709474
-3.203151	2.501005	2.721781
-3.465669	5.081260	2.714016
-3.526053	1.653947	2.709342
-3.518653	0.775699	2.727306
-3.853548	3.534903	2.715097
-4.370661	6.064793	2.722314
-4.634306	6.075231	2.729364
-4.652209	5.528023	2.713023
-0.595478	1.346752	2.730510
-0.784878	2.599106	2.729919
-1.124651	0.784574	2.734651
-1.309716	2.077441	2.733602
-1.379948	0.319636	2.741429
-1.491071	5.996429	2.724375
-1.585827	1.373309	2.724892
-1.818966	5.454414	2.734966
-2.023030	0.907879	2.726742
-2.070818	3.721727	2.726000
-2.463177	4.775156	2.733646
-2.479805	0.799707	2.732732
-2.709505	2.926847	2.733919
-2.751406	5.273438	2.724063
-2.910544	3.456463	2.742075
-3.604632	1.892316	2.720105
-3.942047	5.431913	2.740906
-3.982486	4.812057	2.741343
-4.250533	4.594533	2.722667
-4.371507	1.557911	2.734349
-4.435698	5.041977	2.717907
-4.438498	1.896197	2.732582
-4.452414	4.802069	2.716897
-4.470000	1.138500	2.723750
-4.650169	5.265932	2.724576
-0.788299	6.337631	2.755755
-0.903357	4.079860	2.743007
-0.988571	2.360268	2.740625
-1.181654	0.486850	2.735354
-1.234600	4.380000	2.728000
-1.434203	3.995942	2.733841
-1.800375	0.259083	2.746042
-1.803390	6.258475	2.743051
-1.815070	2.014930	2.730563
-1.940433	3.179300	2.742667
-2.288533	0.627200	2.739200
-2.450444	2.087667	2.735556
-2.707755	4.103980	2.734490
-3.203448	5.054253	2.736264
-3.252063	4.256349	2.731270
-3.292287	2.245919	2.742960
-3.363737	4.855758	2.730202
-3.418315	0.081573	2.736404
-3.511148	1.330383	2.756530
-3.651667	2.597299	2.743218
-3.765000	1.287222	2.724444
-3.955871	3.295226	2.740903
-3.974063	1.817902	2.746696
-4.014385	2.844115	2.744115
-4.316525	2.478559	2.736780
-4.632598	1.548583	2.734331
-0.543074	5.960777	2.753108
-0.546780	0.342542	2.739153
-0.774047	5.175117	2.764543
-0.790346	3.696199	2.764773
-1.178487	1.717311	2.742521
-1.759851	3.372239	2.746716
-1.880063	0.706313	2.752125
-2.736379	1.804138	2.739828
-2.895298	1.997440	2.748571
-3.284699	6.265060	2.747169
-3.399123	4.074035	2.741754
-3.460672	5.875126	2.750420
-3.863488	4.340349	2.747209
-4.205572	3.750663	2.758163
-4.462105	3.901316	2.736842
-4.649643	5.811786	2.742143
-0.535600	3.117200	2.750800
-0.762108	4.309307	2.767139
-0.754271	5.656042	2.764271
-1.399615	1.199872	2.749231
-1.491938	5.748682	2.760388
-1.776011	4.890730	2.765618
-1.816604	4.240472	2.757170
-2.030909	0.356783	2.758881
-2.129521	1.396322	2.775239
-2.162250	1.120125	2.773125
-2.298234	4.984857	2.769735
-2.436892	5.792243	2.769135
-2.950719	2.546601	2.766928
-3.037373	3.038898	2.760508
-3.332250	2.735700	2.761850
-3.421163	0.530720	2.771801
-3.749589	2.847363	2.769658
-3.915000	6.384521	2.767055
-4.201961	2.213137	2.751667
-4.568899	2.485321	2.757844
-0.537273	3.615795	2.759886
-0.564088	0.596101	2.761321
-0.960757	4.931568	2.776108
-1.042482	2.099433	2.778830
-1.068169	5.411901	2.771479
-1.215385	2.939091	2.771469
-1.228542	3.691146	2.765365
-1.363750	3.240766	2.773266
-1.648255	4.647562	2.778975
-1.762383	0.018135	2.797098
-2.169267	5.723933	2.771200
-2.289873	3.526709	2.760633
-2.515227	3.442500	2.755000
-2.687552	5.523237	2.778880
-2.721789	0.745474	2.762105
-2.926064	2.807128	2.771170
-3.533224	6.212694	2.766653
-4.041166	4.164028	2.778622
-4.395129	5.306258	2.782419
-4.658444	4.051778	2.753556
-0.999477	1.083721	2.791948
-1.185906	5.188898	2.777638
-1.221552	6.183190	2.779397
-1.630548	2.180411	2.791918
-1.636364	1.136667	2.776515
-1.773679	2.914811	2.777736
-1.941089	3.985545	2.779406
-2.278626	0.386565	2.781527
-2.447778	4.258086	2.782407
-2.654342	2.243772	2.780044
-2.754333	1.180889	2.770667
-2.916066	2.297377	2.778525
-3.024259	4.189630	2.764630
-3.163118	1.022971	2.793559
-4.026263	0.377105	2.780526
-4.201429	5.109341	2.778352
-4.384888	0.334218	2.798139
-4.416528	0.064306	2.770139
-4.661509	3.601509	2.774340
-0.552230	2.109189	2.786824
-0.560796	5.465995	2.800498
-0.776098	3.003943	2.800894
-0.983906	4.464017	2.804848
-2.251581	5.333185	2.802450
-2.522237	0.542345	2.801321
-2.928894	0.052211	2.793317
-3.881021	3.938290	2.798812
-4.102404	3.499519	2.797548
-4.238676	0.555588	2.790098
-4.231522	4.858478	2.781957
-0.558624	2.850201	2.814228
-0.731726	0.184772	2.805381
-1.195038	4.804427	2.794656
-1.328407	5.398956	2.798956
-1.444454	0.901965	2.801266
-1.555200	5.036350	2.798950
-1.858580	3.602301	2.815227
-2.022564	1.628974	2.795000
-2.077536	2.952899	2.796232
-2.917843	3.978824	2.793922
-3.124481	4.813485	2.806680
-3.192931	0.021954	2.802701
-3.622527	2.342582	2.803516
-3.672168	5.752937	2.795385
-3.863706	2.444924	2.798731
-3.914733	5.686000	2.798333
-4.163778	1.076044	2.803244
-4.661579	1.789474	2.787895
-0.544545	1.580000	2.798636
-0.549667	3.363067	2.809067
-0.885252	0.799496	2.804748
-1.725562	3.842630	2.820301
-1.739442	5.830172	2.812361
-1.989336	5.285071	2.808815
-2.316182	2.991727	2.808364
-2.395000	4.005000	2.817378
-2.480687	2.795267	2.815458
-2.705878	0.151832	2.808092
-2.739487	5.786769	2.811692
-2.990958	5.851250	2.815708
-3.006972	6.107156	2.805872
-3.120489	0.266895	2.828680
-3.227456	5.993713	2.819474
-3.440515	5.469152	2.819242
-3.599865	1.081892	2.809324
-3.699767	5.497674	2.807829
-3.694194	1.497258	2.802581
-3.780233	4.972907	2.806163
-3.859500	2.189167	2.803500
-4.660500	1.309750	2.802750
-1.005238	6.022585	2.816190
-1.462623	2.916721	2.808525
-2.246889	0.151556	2.820778
-2.423846	0.010000	2.810769
-2.428267	6.061333	2.817200
-2.479134	3.690397	2.821408
-2.830982	5.057991	2.826652
-2.912465	3.731690	2.815775
-3.331184	3.616184	2.824145
-3.509651	2.938488	2.822907
-3.696212	3.096212	2.813788
-4.168136	3.033559	2.808305
-4.159818	5.722000	2.811636
-4.381796	3.515550	2.829142
-4.404800	5.830633	2.831267
-4.466186	0.688186	2.824419
-4.644556	3.195148	2.814675
-0.545783	6.218313	2.833434
-0.574760	3.861336	2.841336
-0.813333	2.206875	2.816250
-0.970211	0.391368	2.821474
-0.988667	1.850000	2.819778
-1.289531	5.897469	2.840375
-1.328988	0.666883	2.836316
-1.402370	4.233642	2.832659
-1.457434	1.836579	2.839967
-1.470444	3.758222	2.829185
-1.600000	5.527407	2.839226
-2.018788	2.178333	2.825227
-2.401940	3.234776	2.831741
-2.686957	4.343430	2.834831
-3.007709	5.244916	2.831006
-3.037314	1.687143	2.828571
-3.294829	1.687222	2.837607
-3.846580	4.593446	2.840959
-4.431607	5.558571	2.819643
-4.446545	4.438091	2.826727
-0.552609	4.746783	2.844348
-1.001827	1.552019	2.831058
-0.999157	3.132410	2.830723
-1.422444	0.029259	2.834370
-2.075393	0.586517	2.835955
-2.458202	5.176404	2.835618
-2.680229	3.867163	2.853954
-2.711356	3.588136	2.828814
-2.965081	0.743257	2.844821
-3.594733	3.965800	2.839733
-3.720891	3.715487	2.850084
-3.759394	5.239091	2.837803
-4.018971	1.339485	2.840662
-4.268873	4.035352	2.842923
-4.636082	4.692990	2.843196
-0.564335	1.843064	2.856821
-0.559474	4.481140	2.862456
-0.755000	1.008173	2.841635
-0.780370	1.964259	2.846852
-0.785723	3.272215	2.860154
-1.134459	3.350796	2.864140
-1.212135	3.940391	2.861744
-1.211509	2.278679	2.839623
-1.935429	6.071333	2.853000
-1.978088	2.729681	2.858685
-2.199812	6.135564	2.858195
-2.231859	2.297692	2.853654
-2.931264	4.415824	2.857637
-3.293438	5.690341	2.856790
-3.337346	2.008499	2.861743
-3.580435	2.094348	2.850435
-3.841543	1.088743	2.850286
-3.934828	3.065000	2.842069
-4.005836	6.168662	2.857695
-4.191637	0.812847	2.856584
-4.333110	1.321159	2.852805
-4.386641	3.170859	2.859805
-4.636063	0.254344	2.854525
-4.646082	2.038144	2.848557
-0.826298	5.422009	2.879142
-0.994683	5.643303	2.874163
-1.115623	4.210101	2.871953
-1.162965	0.244070	2.867638
-1.619528	4.356604	2.852642
-1.635628	4.095953	2.867256
-1.993547	0.125893	2.870587
-2.047526	4.204742	2.868351
-2.096887	4.548675	2.861258
-2.208592	1.771549	2.859437
-2.224318	2.774545	2.849091
-2.352203	1.282203	2.858305
-2.551788	2.499416	2.868978
-2.718065	2.698581	2.859742
-2.997885	1.385962	2.855288
-3.042971	5.599239	2.874964
-3.216967	4.470219	2.874727
-3.257376	5.276540	2.866844
-3.377000	0.287667	2.857083
-3.439677	2.516075	2.860108
-3.485000	3.210250	2.850750
-3.514041	4.247876	2.861503
-3.618968	4.790903	2.855097
-3.731266	3.349177	2.859684
-3.783857	0.268429	2.850000
-3.925894	1.581014	2.860725
-4.626012	6.306607	2.860714
-0.547826	4.994783	2.865362
-0.554017	4.138547	2.868205
-0.577396	0.831245	2.879660
-0.794940	0.569116	2.878594
-1.232000	2.695800	2.861200
-1.319910	5.006306	2.869279
-1.715000	3.165417	2.868125
-1.820732	2.350000	2.868293
-1.853889	4.472111	2.871000
-2.365019	0.985393	2.874869
-2.352108	4.587189	2.875189
-2.437465	1.707465	2.862254
-2.651959	0.965284	2.878325
-2.711473	3.341240	2.877209
-3.210428	3.344385	2.872086
-3.595860	4.499409	2.869946
-3.658588	0.617062	2.878814
-3.675091	6.383727	2.875909
-3.704701	0.869104	2.875522
-3.752941	4.157765	2.864471
-3.884757	5.937427	2.869515
-4.186545	5.976021	2.872513
-4.209742	1.816753	2.878196
-4.244762	6.236190	2.859881
-4.405328	2.110246	2.868443
-4.619400	4.958133	2.877800
-4.633015	2.716332	2.871910
-4.642273	4.278030	2.857879
-0.989286	2.630260	2.879026
-1.098768	1.319783	2.888696
-1.350645	3.494274	2.881694
-1.453417	4.792814	2.885075
-1.525772	0.507805	2.881545
-1.618000	2.490571	2.870429
-1.670000	6.083451	2.891882
-1.828544	1.741553	2.877961
-2.185620	0.803471	2.872562
-2.239863	2.031684	2.890756
-2.746094	1.402969	2.876094
-3.265742	3.085781	2.889180
-3.349922	3.869845	2.876744
-3.385773	0.917629	2.874948
-3.399282	4.666133	2.883149
-4.093054	4.477096	2.887635
-4.120047	2.538821	2.887217
-4.365804	2.897054	2.881339
-0.587417	2.589970	2.904024
-0.795717	5.882245	2.905281
-0.805333	1.714267	2.890000
-1.475362	2.681159	2.882464
-2.001504	1.915398	2.883805
-2.254959	3.802764	2.883740
-2.298175	2.542698	2.890238
-2.638041	1.975773	2.894124
-2.716267	6.030800	2.891511
-2.870189	4.795245	2.897623
-3.280994	1.423205	2.909295
-3.716032	1.722857	2.889048
-3.790059	1.967059	2.892941
-4.048138	2.024575	2.892186
-4.421913	0.937478	2.887826
-0.780663	4.635128	2.909643
-0.820641	1.251352	2.907367
-0.990283	2.888679	2.894434
-1.214394	1.903788	2.898333
-1.241000	1.076235	2.899353
-1.251497	1.532925	2.895170
-1.334063	2.480208	2.891250
-1.591203	5.270886	2.901646
-1.738281	1.505313	2.893906
-1.988533	3.383743	2.913084
-2.048613	2.473323	2.913968
-2.056667	5.519128	2.916744
-2.163088	4.794118	2.900049
-2.498072	6.279699	2.893072
-2.504000	1.468600	2.889000
-2.627000	4.884200	2.893700
-3.079634	2.080650	2.908659
-3.092132	3.572574	2.893750
-3.144036	2.846637	2.906054
-3.577731	0.163529	2.899916
-3.757257	6.151600	2.907714
-4.149273	3.266364	2.909636
-4.210175	0.149605	2.910307
-4.638151	0.517395	2.895714
-0.562613	5.727789	2.910402
-0.575678	1.164746	2.908559
-0.920709	3.499803	2.914921
-1.004144	6.261781	2.917500
-1.062536	0.611312	2.921341
-1.185833	0.010000	2.912083
-1.450863	4.530203	2.915685
-1.985848	5.820939	2.914874
-2.023400	6.304800	2.899800
-2.085569	5.055976	2.917358
-2.251351	4.356351	2.901622
-2.477079	5.428168	2.912079
-2.546971	3.035477	2.918133
-2.600449	4.627978	2.904719
-2.907442	0.387442	2.912558
-3.118970	2.343212	2.913333
-3.513097	5.224773	2.925938
-3.795065	0.030325	2.910844
-3.895146	2.677961	2.902039
-3.978011	3.695966	2.918977
-0.778571	2.765306	2.907551
-0.821531	2.440714	2.927143
-1.410306	6.114585	2.930044
-1.423771	6.373829	2.915829
-1.578886	3.378257	2.931629
-1.821166	5.112914	2.929580
-1.825929	1.270796	2.917345
-2.136087	3.161196	2.923750
-2.674141	1.646520	2.919780
-3.210132	0.757368	2.907500
-3.232430	4.097664	2.926776
-3.507990	3.453920	2.919749
-4.062528	5.268210	2.925795
-4.180732	1.540427	2.930915
-4.373627	2.635840	2.936933
-4.387752	4.669922	2.913488
-4.624673	1.088844	2.920251
-4.627841	2.286705	2.918182
-0.992422	5.164297	2.929219
-1.661173	6.361939	2.926071
-1.685920	1.943793	2.930057
-1.736331	0.977171	2.938768
-1.729010	2.715623	2.942204
-1.825287	5.622184	2.920805
-2.259347	5.891847	2.946705
-2.662846	0.364154	2.924385
-2.862826	5.413913	2.931087
-2.963523	3.280783	2.939075
-3.121375	6.280750	2.925625
-3.380063	1.173365	2.940283
-3.905000	0.725987	2.924013
-4.047445	2.288248	2.935401
-4.057355	4.977806	2.936710
-4.456875	1.716354	2.917500
-0.585404	2.304485	2.949522
-0.582712	5.236356	2.933983
-1.043333	3.735310	2.948178
-1.346042	5.667292	2.935417
-2.273591	6.372317	2.940270
-2.824747	2.143434	2.936061
-2.844615	6.230256	2.929744
-2.853065	4.171429	2.955377
-3.097868	3.863807	2.938629
-4.608776	5.418299	2.942313
-0.745729	6.141563	2.938125
-1.975950	1.084380	2.948264
-2.113418	3.606962	2.942532
-2.268871	1.552097	2.938710
-2.325197	5.636535	2.947717
-2.677410	5.228584	2.962410
-2.859203	1.822319	2.949420
-3.056356	5.022712	2.964350
-3.131000	2.590000	2.942800
-3.350226	4.983982	2.951538
-3.522110	5.682110	2.957156
-3.519710	1.598696	2.946667
-4.369305	2.353874	2.966556
-4.382044	3.815660	2.962013
-4.609503	3.429752	2.954876
-4.607908	5.681503	2.950392
-0.630000	6.400000	2.930000
-0.778592	4.123944	2.948732
-0.793213	4.993371	2.972081
-0.832313	3.873955	2.958507
-1.043587	4.672310	2.966474
-1.068624	0.886746	2.972963
-1.201522	4.449755	2.972364
-1.211739	3.118804	2.956087
-1.293286	0.441714	2.954143
-1.439294	2.073176	2.971676
-1.506768	1.572348	2.971311
-1.582976	0.756976	2.961756
-1.610675	0.124262	2.966793
-1.640513	3.638376	2.960684
-1.724115	0.362718	2.975062
-1.905962	3.031122	2.966218
-1.954537	0.825610	2.966244
-2.029538	3.835692	2.952154
-2.570364	5.664227	2.963500
-2.589734	1.220631	2.963688
-2.589788	4.111555	2.964488
-2.772178	0.599530	2.967054
-2.963931	0.982901	2.966069
-3.381854	6.183609	2.969371
-3.428922	2.257059	2.956863
-3.856667	0.476250	2.954896
-4.061374	5.553132	2.958626
-4.440645	4.195806	2.954194
-4.451496	6.150709	2.956142
-4.604857	2.972714	2.969171
-4.603529	5.945529	2.962059
-4.634242	0.822121	2.950606
-0.673841	3.557256	2.963659
-1.010698	2.274767	2.969767
-1.446349	3.097460	2.960794
-1.589677	1.322581	2.967097
-1.821967	5.375738	2.974098
-2.251799	3.397226	2.975488
-2.409465	0.290053	2.969626
-2.556105	0.736105	2.965684
-3.122000	1.208667	2.971111
-3.323333	6.397778	2.955000
-3.438519	0.697593	2.970556
-3.540000	1.878205	2.964188
-3.787949	1.307564	2.956795
-4.147686	2.791843	2.971843
-4.140172	4.728970	2.980129
-4.279718	5.443099	2.967606
-4.378636	4.918818	2.973182
-4.623243	3.737027	2.958919
-0.584430	1.404051	2.971772
-0.591183	0.380860	2.976774
-0.595098	3.049248	2.991732
-1.179446	5.487196	2.990369
-1.379280	0.210800	2.984400
-1.489661	1.083842	2.990367
-1.803846	0.618173	2.979760
-1.970240	1.464251	2.979701
-2.468077	2.138154	2.981769
-2.516000	5.915280	2.979360
-2.550647	0.084676	2.982806
-2.820882	2.895882	2.963235
-2.881604	2.427380	2.989626
-3.101616	0.539167	2.990783
-3.372746	0.041051	2.982271
-3.608080	2.766449	2.985435
-3.699009	2.511509	2.990819
-3.931100	3.446100	2.980400
-4.009053	0.951053	2.973684
-4.073558	3.929519	2.973269
-4.205401	4.244453	2.985766
-1.104513	4.938407	2.990442
-1.338686	1.311752	2.985839
-1.430426	4.010426	2.985638
-1.574441	5.748323	3.002484
-1.641067	2.957467	2.976667
-1.978692	0.430093	2.989346
-2.404566	4.815029	2.985838
-2.494366	4.409718	2.982958
-3.157006	1.845150	2.996407
-3.412473	5.913055	2.997527
-3.938529	4.280711	3.002010
-4.599196	4.001929	2.999678
-0.811795	1.493462	2.992179
-0.962454	0.085810	3.014282
-1.059556	5.862111	2.993667
-1.078889	1.711389	2.988056
-1.178089	6.085122	3.002846
-1.487313	2.331194	2.989701
-1.656981	4.911294	3.009865
-1.791356	4.681073	3.002655
-2.552769	3.498769	2.987231
-2.768261	3.131087	2.985652
-2.901264	1.558276	2.995057
-3.052028	0.081538	3.006573
-3.501915	3.710395	3.012948
-3.670876	5.887883	2.996934
-3.885631	6.353584	3.007952
-3.938226	1.796774	2.991129
-3.982487	0.260160	3.016417
-4.313269	5.173948	3.007120
-4.346824	6.392118	3.002471
-4.383024	0.503902	3.007171
-4.563333	5.178148	2.995741
-4.627188	1.560000	2.983125
-4.616522	4.498913	2.992391
-0.574348	5.966087	3.008152
-0.847073	4.360813	3.004797
-0.831297	0.318973	3.015622
-1.309068	2.894472	3.012050
-1.303876	3.712416	3.020758
-1.794305	4.256983	3.015932
-2.146888	1.269947	3.020186
-2.465091	3.864545	3.011727
-2.831880	5.656453	3.015556
-2.868916	1.234011	3.021111
-3.144691	5.851303	3.022443
-3.344422	2.699456	3.012177
-3.641162	5.008485	3.013586
-3.763290	5.653032	3.007806
-3.849693	5.406858	3.014483
-3.853712	2.903939	3.005076
-4.206617	3.605613	3.017361
-4.463099	0.146959	3.014094
-0.619245	0.134340	3.031321
-0.776604	5.644340	3.017107
-1.434645	5.456120	3.025519
-1.858778	2.137443	3.028125
-2.246563	0.470000	3.016172
-2.293333	5.157879	3.012879
-2.409600	1.883920	3.024160
-2.918045	2.687594	3.022481
-2.939975	6.012574	3.032277
-3.015106	3.033404	3.017553
-3.031495	4.592732	3.017268
-3.084866	4.289286	3.023170
-3.090000	5.392331	3.023006
-3.554808	1.361538	3.014615
-3.851057	4.848238	3.024626
-4.112820	0.502762	3.029622
-4.160495	1.222387	3.018288
-0.604194	1.656636	3.030276
-0.785479	0.807671	3.028082
-1.190548	2.123151	3.015616
-1.227989	5.166931	3.035556
-1.328938	0.876372	3.032566
-1.839646	6.226814	3.026726
-1.922000	4.036727	3.014000
-2.036383	1.704823	3.027730
-2.648554	2.311281	3.035289
-2.697941	6.395000	3.018824
-2.807178	0.194724	3.034110
-2.872027	3.916351	3.025946
-3.352867	0.468400	3.027867
-3.596714	5.454714	3.033857
-3.808177	2.271302	3.035573
-4.362868	5.669412	3.031912
-4.402759	1.153276	3.016724
-0.591667	2.059286	3.025714
-0.995349	4.046395	3.033140
-1.310984	1.722131	3.031639
-1.476782	5.098276	3.039425
-1.827576	0.012424	3.030909
-2.165479	0.229175	3.047228
-2.507978	5.039551	3.042135
-3.224842	4.770791	3.050253
-3.665972	1.103833	3.055250
-3.859615	3.197308	3.027308
-3.979545	5.775909	3.028485
-4.076650	3.050911	3.056404
-4.358105	3.354373	3.055452
-4.376240	1.928640	3.036240
-4.411852	1.474568	3.034691
-4.611852	1.865556	3.024815
-4.604184	1.318367	3.039694
-0.603711	4.297062	3.054175
-1.071839	0.389425	3.047241
-1.114377	2.486748	3.062340
-1.291735	4.682653	3.045918
-1.926182	4.897939	3.045758
-2.134639	2.932990	3.040103
-2.226963	3.986667	3.050444
-2.260786	5.418176	3.064025
-2.357424	3.634444	3.051566
-2.357818	2.835273	3.038182
-2.606012	2.816190	3.051905
-2.838409	3.475455	3.036818
-3.208217	0.964650	3.047261
-3.608493	0.433797	3.058464
-3.697647	4.651569	3.046471
-3.711103	3.544412	3.052059
-3.854268	4.025223	3.053185
-3.860929	5.142301	3.056195
-4.229257	2.142012	3.062167
-4.238431	0.978627	3.045294
-4.356806	0.758194	3.044722
-4.580442	2.505959	3.063363
-0.615091	3.318649	3.069221
-0.836852	2.113386	3.071852
-0.937294	6.056706	3.047059
-1.029681	1.944043	3.059894
-1.301309	4.214698	3.071779
-2.036773	5.275100	3.065100
-2.116545	2.195818	3.064682
-2.178099	0.974678	3.067427
-2.326323	0.718215	3.077677
-2.340226	3.089173	3.057669
-2.365336	2.363109	3.079397
-2.504116	0.510145	3.073275
-2.698911	3.694719	3.061386
-2.767626	4.997071	3.080657
-2.955570	6.392405	3.058734
-3.140643	1.590000	3.061053
-3.240539	0.247246	3.057425
-3.342381	5.428294	3.064960
-3.430638	2.936064	3.055745
-3.651544	3.064926	3.056029
-3.754658	1.539530	3.058718
-4.303206	4.470802	3.068473
-0.600556	2.796389	3.063611
-0.629172	0.616847	3.082930
-0.728088	1.871324	3.063824
-0.795752	5.242920	3.068319
-0.868333	1.045591	3.067796
-1.140300	3.509200	3.064400
-1.344414	3.302207	3.081172
-1.667595	4.473797	3.060253
-1.809377	3.813863	3.081713
-1.831977	2.506186	3.080819
-1.851461	3.541685	3.066067
-2.005217	4.402174	3.067702
-2.164639	2.673436	3.075326
-2.366364	4.208267	3.080398
-2.369153	1.141864	3.067119
-2.452162	2.621622	3.063784
-3.166927	6.061094	3.065625
-3.254877	3.647654	3.072222
-3.366824	4.262128	3.082804
-3.492162	4.796967	3.086186
-3.714184	4.397245	3.071429
-3.942389	2.493097	3.064956
-4.570455	4.779318	3.082143
-0.590200	6.240400	3.074400
-0.616429	5.447989	3.089577
-0.620177	0.982920	3.077168
-0.839900	3.130000	3.080348
-1.092000	2.755636	3.087182
-1.332266	2.646059	3.088079
-2.035725	4.664638	3.079420
-2.372338	6.080390	3.065974
-2.629547	6.191317	3.087613
-2.672617	5.463925	3.084346
-2.695846	2.573923	3.081692
-2.907789	5.223579	3.084105
-2.963410	3.686994	3.078728
-3.150000	5.940000	3.050000
-3.327005	2.448122	3.087310
-3.368018	1.743514	3.075946
-3.600000	0.010000	3.060000
-3.626393	4.168525	3.077705
-3.733908	0.198966	3.076782
-0.614457	4.822659	3.091685
-0.629560	3.779223	3.106736
-1.067917	1.485641	3.102564
-1.095000	1.155476	3.081905
-1.276556	5.848222	3.086000
-1.394232	0.628652	3.094569
-1.497568	6.120967	3.122077
-1.664955	5.524324	3.092252
-1.808000	5.792933	3.081467
-1.870442	1.880088	3.090796
-1.941758	6.006703	3.103242
-2.072295	0.638197	3.089344
-2.124315	6.191986	3.089863
-2.228841	4.516522	3.079130
-2.388758	1.400229	3.103693
-2.500719	0.941871	3.090863
-2.728981	5.875370	3.081389
-3.165393	3.217416	3.083483
-3.322698	3.402857	3.086190
-3.414000	3.183400	3.077400
-3.471455	4.509515	3.101381
-3.542456	6.354199	3.094128
-3.628608	3.922152	3.083544
-3.660653	2.063015	3.091658
-3.920761	1.143370	3.087391
-3.958051	4.571186	3.103729
-3.978148	1.383519	3.082407
-4.337213	3.048197	3.078852
-4.581728	0.364938	3.093519
-0.829332	6.313819	3.111169
-1.526292	1.825899	3.097191
-1.545745	4.687660	3.098511
-1.636916	3.183383	3.112246
-1.730515	1.661838	3.103235
-2.133487	5.713026	3.102993
-2.136038	1.920189	3.091509
-2.219130	4.941159	3.093333
-2.480000	1.641707	3.092561
-2.637381	1.462857	3.087619
-2.636863	1.820196	3.088235
-3.044909	0.775455	3.099636
-3.229945	5.170685	3.113151
-3.392329	3.983425	3.096027
-4.089104	6.053582	3.089552
-4.307248	4.019060	3.103490
-4.462569	3.596147	3.088991
-4.578966	2.108828	3.093931
-0.614406	4.554266	3.107063
-0.611190	4.043690	3.106905
-1.078693	3.264602	3.114716
-1.298685	6.285014	3.120630
-1.309775	0.016854	3.114494
-1.494802	0.393164	3.108870
-1.537893	3.816679	3.116643
-1.550377	4.260849	3.103113
-1.569021	2.534000	3.112383
-1.924551	2.799449	3.116435
-2.634435	3.295043	3.115565
-2.638000	4.770286	3.110286
-2.691007	4.519424	3.113381
-3.193438	2.207344	3.100781
-3.602194	0.831484	3.106839
-3.612222	6.101111	3.099667
-3.847700	6.028650	3.112100
-4.132923	1.897769	3.111308
-4.309740	5.918842	3.119385
-4.578312	3.209740	3.104286
-0.854523	2.866231	3.127588
-0.858194	3.640220	3.127048
-0.896061	0.552963	3.122727
-1.044767	5.313837	3.117326
-1.052529	4.288059	3.122471
-1.476947	3.534466	3.132176
-1.639533	5.969844	3.128599
-1.675067	4.032400	3.110533
-1.893800	3.246800	3.119500
-1.912118	0.219082	3.127012
-2.060135	0.019324	3.115135
-2.746538	1.016955	3.133494
-3.053333	4.050476	3.109286
-3.074449	3.454487	3.124601
-3.335948	5.692714	3.121970
-3.400792	2.065667	3.121667
-3.614847	3.313190	3.120123
-3.733200	1.815200	3.113867
-3.825814	3.772326	3.113721
-3.903465	1.997228	3.121683
-4.308075	1.693369	3.133610
-4.560851	6.311560	3.115248
-0.880652	1.692717	3.118804
-0.871169	4.790974	3.133117
-1.044895	5.658531	3.145431
-1.220912	3.957541	3.139751
-1.316803	4.916531	3.125034
-1.528333	2.805238	3.122381
-1.685254	2.297119	3.123559
-1.773426	1.394422	3.137729
-2.090484	4.169677	3.120968
-2.349530	0.054201	3.130940
-2.452821	4.608803	3.125470
-2.486731	5.288770	3.128414
-2.978380	4.827887	3.141502
-3.096190	5.621524	3.122286
-3.477760	0.223120	3.125520
-3.785692	0.646000	3.141577
-4.070934	0.753391	3.133356
-4.570667	0.645487	3.129487
-4.570980	4.299118	3.125588
-0.634694	2.487296	3.143112
-1.291184	1.937763	3.135000
-1.316212	1.504394	3.136818
-1.917964	5.546764	3.142509
-2.592751	0.270106	3.156376
-2.692348	2.069103	3.152902
-2.692326	4.268372	3.128372
-2.994000	1.968000	3.132000
-3.015357	0.295714	3.133690
-3.047959	1.375714	3.132041
-3.224744	4.468590	3.132051
-3.389455	1.498364	3.130364
-3.435285	1.015854	3.139756
-3.581090	2.331280	3.149668
-4.096705	6.305233	3.141783
-4.104336	3.361538	3.144755
-4.352766	2.811064	3.133191
-4.585814	2.760000	3.118372
-0.636207	1.231379	3.141494
-0.858750	3.378523	3.146591
-0.876538	2.556667	3.148718
-1.093429	3.006190	3.145714
-1.638036	2.054286	3.150804
-1.695693	1.144818	3.149489
-2.156349	1.495556	3.142698
-2.256075	1.720093	3.150280
-2.387438	5.779835	3.157769
-2.661560	3.946086	3.162569
-2.939948	2.227959	3.160103
-3.212189	6.331108	3.156216
-3.269810	0.677286	3.152048
-3.273492	1.286508	3.154206
-3.804286	2.696807	3.140924
-4.039974	1.628675	3.157870
-4.074884	4.101163	3.136744
-4.099206	5.115556	3.138571
-4.270000	0.045100	3.165267
-0.628686	5.085200	3.161257
-0.853501	5.846024	3.168457
-0.882227	1.306597	3.163655
-0.963894	5.072861	3.174543
-1.147487	0.696884	3.164271
-1.389164	4.473908	3.171752
-1.620114	0.908523	3.156364
-1.872750	0.972125	3.152875
-2.023167	3.691000	3.148500
-2.067673	3.440204	3.167837
-2.150000	6.397500	3.143333
-2.374500	6.323833	3.164833
-2.808937	0.421884	3.160242
-3.215714	2.989429	3.150286
-3.523583	2.597250	3.160833
-3.631647	5.220884	3.167068
-3.843342	0.916247	3.172986
-4.197966	2.391441	3.155678
-4.324233	4.721104	3.159877
-4.519342	0.894737	3.156053
-4.548725	5.541544	3.161074
-0.617551	5.755510	3.155102
-0.863176	5.468243	3.166284
-1.147528	0.190148	3.183100
-1.304255	5.615691	3.176064
-1.577111	5.295827	3.180938
-1.637439	0.615732	3.159024
-1.704110	6.389863	3.166027
-2.122802	2.435495	3.174835
-2.311452	2.068710	3.156613
-2.562715	3.041900	3.178914
-2.801111	0.754138	3.184215
-2.869286	0.010714	3.150000
-2.915226	4.419095	3.174422
-2.938462	1.730888	3.175207
-4.073960	5.373926	3.175336
-4.205161	1.426022	3.159677
-4.332582	6.215879	3.168297
-4.547045	5.802045	3.168068
-0.852059	4.541324	3.176176
-1.062056	6.219065	3.172991
-1.548302	0.026981	3.185535
-2.157048	3.197048	3.178667
-2.190839	5.973077	3.182168
-3.178317	3.860099	3.179505
-3.935281	5.592809	3.175281
-4.057363	4.873035	3.190000
-4.157851	5.699256	3.173471
-4.287514	0.322977	3.187225
-4.537803	6.064470	3.180227
-4.556304	5.017826	3.168478
-0.644805	2.232857	3.190260
-0.827101	4.172678	3.202531
-1.481391	1.290397	3.192583
-1.662885	0.239808	3.185288
-1.775054	5.050975	3.201552
-1.845149	0.477127	3.198507
-2.828082	3.011289	3.202925
-2.884167	3.277647	3.190588
-3.178375	2.629500	3.178375
-3.447256	5.035915	3.184634
-3.569355	1.652903	3.182581
-3.578505	5.646168	3.193178
-3.829828	0.395603	3.192845
-4.003011	0.052707	3.195663
-4.006403	3.601367	3.196079
-4.006761	2.828732	3.194930
-4.009735	2.215503	3.195291
-4.129688	2.618281	3.176875
-4.562500	1.682500	3.180500
-1.100619	3.725457	3.213540
-1.121461	4.774270	3.194719
-1.254048	0.436587	3.197937
-1.271545	5.357091	3.208409
-1.433535	3.036768	3.203838
-2.089831	0.417119	3.199492
-2.612594	0.021992	3.226729
-2.906904	5.462703	3.206904
-2.986506	6.208476	3.206766
-3.029881	2.836119	3.209284
-3.094375	1.119018	3.201696
-3.506393	0.623279	3.192623
-3.854138	3.368161	3.207414
-4.360326	2.572065	3.194674
-4.552857	3.828000	3.183429
-0.671004	1.478476	3.214535
-0.893686	3.890784	3.215333
-1.093647	5.965176	3.209765
-1.345943	2.165314	3.220457
-1.735185	2.952074	3.208741
-1.854113	4.551210	3.210403
-2.033529	3.938235	3.215147
-2.037834	5.055207	3.216636
-2.245432	4.727037	3.202099
-2.552426	5.985503	3.213077
-2.629018	5.686727	3.215018
-2.841224	1.448776	3.204694
-3.498508	3.529905	3.219937
-3.771905	1.314139	3.213956
-3.780090	5.796937	3.218243
-4.096180	4.346242	3.219410
-4.305568	3.767622	3.214649
-4.306196	4.991196	3.202935
-4.304371	5.495166	3.211656
-4.339828	4.253621	3.195345
-4.521964	4.545018	3.221964
-4.537808	5.290000	3.210959
-4.556061	1.139697	3.198788
-0.672273	0.334034	3.217898
-0.918170	2.316027	3.228571
-1.127735	4.514872	3.229872
-1.149238	0.956000	3.213238
-1.317200	2.420640	3.214000
-1.374259	1.058580	3.227716
-1.879778	0.730556	3.219667
-1.939800	1.572400	3.207800
-1.957241	6.309261	3.225468
-2.248630	3.795260	3.234986
-2.337640	0.324607	3.227865
-2.414355	3.991452	3.215161
-2.651865	1.252694	3.219275
-3.194630	0.438148	3.227259
-3.284820	5.931317	3.229611
-3.409754	6.164472	3.227359
-3.542304	5.899032	3.222811
-3.759279	6.268417	3.234028
-4.063841	3.860530	3.218411
-4.272075	0.603208	3.226478
-4.438263	2.285154	3.228067
-1.100035	1.755140	3.238287
-1.396304	0.204130	3.226087
-1.446935	4.069032	3.225403
-1.473917	5.802581	3.237512
-1.836693	5.308645	3.232829
-1.911972	2.302066	3.231033
-2.041579	1.135439	3.228596
-2.323631	3.400238	3.230298
-2.445578	4.875378	3.234940
-2.501333	4.381583	3.228000
-2.506585	3.742846	3.233659
-2.548824	3.495588	3.222647
-2.710833	1.639792	3.221667
-2.776364	6.355522	3.237037
-2.781136	2.754545	3.219773
-2.853036	4.100714	3.220893
-2.920097	2.539094	3.235825
-3.238390	1.887881	3.228475
-3.514534	1.251093	3.236478
-3.614271	2.876979	3.220000
-3.822205	4.211614	3.234370
-4.080400	0.988400	3.217600
-4.528400	2.982356	3.230178
-0.652368	5.984474	3.239386
-0.666346	2.995321	3.243397
-0.893905	0.227524	3.236952
-0.916875	0.853068	3.237216
-1.228861	1.295730	3.240819
-1.530302	1.574523	3.247236
-1.540603	4.931525	3.247305
-1.717143	3.404347	3.247599
-1.740000	4.770467	3.235421
-1.868088	4.139755	3.240441
-2.540769	0.743793	3.252944
-2.785979	6.059897	3.231959
-3.828168	3.007634	3.234275
-4.311209	1.115055	3.234615
-4.518472	4.076332	3.249782
-0.666284	3.511093	3.249617
-0.678100	0.023100	3.244200
-0.883947	1.902456	3.250000
-1.058477	2.104371	3.247881
-1.779060	6.136410	3.249060
-1.996316	2.048308	3.256805
-2.273600	2.936000	3.237600
-2.300614	5.102982	3.252544
-2.531639	2.486393	3.238525
-2.914909	5.720909	3.240727
-3.135303	2.389773	3.252727
-3.199200	4.942840	3.257160
-3.366212	2.792727	3.258030
-3.734706	5.452549	3.250353
-4.013623	5.884058	3.238116
-4.274386	3.510702	3.255000
-4.534149	1.445319	3.249681
-4.537750	3.417000	3.238500
-0.672097	0.812097	3.246452
-1.258895	2.859448	3.264807
-1.372066	5.128404	3.268873
-1.421961	0.814314	3.255490
-2.162281	4.358947	3.248421
-2.466018	1.822301	3.257788
-2.950806	3.867258	3.251452
-2.981073	0.586590	3.264713
-3.059174	0.086281	3.264876
-3.573616	4.325203	3.270738
-3.756717	0.036919	3.263838
-3.825387	4.978297	3.267678
-4.264125	3.206500	3.249500
-4.284859	0.859366	3.260423
-4.285374	5.239728	3.266463
-4.526383	1.924610	3.258298
-0.667500	1.999500	3.258000
-1.691441	3.670932	3.263390
-1.699643	2.698669	3.283117
-1.718824	4.346387	3.264790
-2.023896	1.788701	3.262468
-2.319667	0.897444	3.267000
-2.320213	2.601915	3.255532
-2.477054	2.794274	3.277676
-2.515971	2.234029	3.268417
-2.738491	2.359340	3.268868
-2.971437	5.062874	3.270958
-3.018412	5.952396	3.281894
-3.070036	4.610253	3.279603
-3.359710	2.269203	3.270580
-3.412261	5.292783	3.269217
-3.494262	1.871557	3.263852
-3.677897	4.744369	3.286799
-4.044340	0.304528	3.256604
-4.205278	2.950556	3.263611
-0.691536	2.706519	3.282321
-0.883673	6.083527	3.285745
-1.351625	1.744750	3.267500
-1.374437	4.724225	3.286690
-1.704851	5.687264	3.291020
-1.708961	1.854156	3.270779
-1.968805	3.049386	3.285358
-1.981371	4.810323	3.279194
-2.282026	1.240727	3.292883
-2.788843	3.496942	3.273388
-2.812378	0.191443	3.297988
-2.817926	4.664815	3.280593
-3.109238	4.291143	3.275238
-3.267059	1.638431	3.276863
-3.486346	0.033109	3.288718
-3.544865	4.053243	3.274324
-3.997885	3.178846	3.271154
-4.103137	1.227451	3.265098
-4.513952	0.192455	3.278024
-0.688708	4.384125	3.291125
-0.703504	1.729562	3.292044
-1.031356	0.411525	3.280339
-1.177556	2.617778	3.284667
-1.231375	3.159625	3.289625
-1.220660	3.423160	3.297264
-1.362374	3.717393	3.291362
-1.959298	2.605165	3.296364
-2.073175	0.882169	3.298254
-2.126652	5.531448	3.292986
-2.765682	5.206477	3.295909
-2.894255	1.223191	3.278298
-2.941932	0.944659	3.282841
-3.178269	0.904038	3.281731
-3.402778	3.042222	3.279167
-3.561203	3.789622	3.295636
-3.750350	3.617273	3.291608
-3.770370	3.951605	3.283704
-4.305909	2.026970	3.279545
-0.677734	6.230156	3.301328
-0.911784	1.534054	3.307351
-0.940000	0.010000	3.270000
-0.968112	1.100629	3.293846
-2.540758	5.101061	3.286515
-2.766400	1.868400	3.294700
-3.076829	3.646341	3.305061
-3.254907	5.501173	3.310247
-3.291830	0.190850	3.299739
-3.400732	6.392317	3.298780
-3.444010	0.411719	3.299115
-3.432021	3.287553	3.295745
-3.647155	0.258707	3.295776
-3.780231	2.260694	3.302486
-3.937465	1.825493	3.293239
-3.985688	6.130182	3.315195
-3.997286	2.449286	3.295000
-4.436531	6.394898	3.303061
-0.711304	1.056877	3.311344
-0.712129	3.251000	3.321581
-0.903538	3.035846	3.304462
-0.952764	2.724874	3.317889
-1.058195	4.084269	3.319914
-1.463140	6.242369	3.324766
-1.470167	1.957333	3.301000
-1.478756	3.270207	3.312280
-1.600000	4.557344	3.300938
-1.959000	5.733900	3.302800
-2.318019	5.355566	3.314057
-2.335828	0.581943	3.316306
-2.369762	3.154206	3.307222
-2.489781	1.073880	3.306721
-2.513500	1.521625	3.306313
-2.582061	4.147576	3.310667
-2.612906	0.487048	3.327368
-3.101185	5.284007	3.320348
-3.116667	2.099964	3.318261
-3.413227	0.825777	3.313108
-3.630116	3.129767	3.301279
-3.647680	1.031438	3.319150
-3.830065	1.559351	3.305325
-3.985270	0.571577	3.307973
-4.482375	0.471167	3.315125
-0.730143	0.572837	3.335931
-1.167188	4.983984	3.314297
-1.239842	4.289974	3.326359
-1.728485	2.442121	3.304848
-2.083719	4.583058	3.316364
-2.237778	1.896481	3.316852
-2.607163	5.402837	3.328365
-2.698647	4.904839	3.334404
-2.739351	3.748442	3.316948
-3.038594	1.547711	3.330683
-3.247910	3.455149	3.317836
-3.320208	3.689375	3.306250
-3.562347	2.128265	3.316327
-4.183710	4.574234	3.329718
-0.704343	4.905182	3.341533
-0.938067	4.379412	3.326807
-1.434355	2.695323	3.317097
-1.581443	2.218247	3.344021
-2.044536	1.378900	3.335601
-2.075455	5.281515	3.330076
-2.078043	2.825652	3.317391
-2.325359	4.527124	3.327778
-2.359091	6.075195	3.318052
-3.127534	3.170434	3.338428
-3.305636	1.109697	3.332242
-3.763161	2.527548	3.337935
-3.830400	5.232000	3.327867
-4.001527	2.827679	3.392439
-4.479174	4.843760	3.333347
-0.689848	3.996667	3.333788
-0.693718	4.637051	3.334103
-1.165525	6.371381	3.336961
-1.191645	5.787500	3.336382
-1.479186	0.600000	3.337209
-1.765105	0.083636	3.340420
-1.836429	1.236508	3.340635
-1.914854	3.570766	3.342956
-2.010439	0.108070	3.337982
-2.026650	6.087340	3.337931
-2.075036	0.622929	3.351357
-2.205199	6.271618	3.350663
-2.313947	2.370614	3.340088
-2.720944	4.409485	3.349270
-3.110397	4.037960	3.359943
-3.137921	5.729406	3.334356
-3.183256	6.134477	3.340407
-3.344367	4.191265	3.345753
-3.347170	3.929811	3.330755
-3.399488	4.795116	3.338419
-3.604627	1.468806	3.330149
-3.733486	6.021101	3.334404
-4.189689	1.810518	3.344560
-4.218923	4.099538	3.329385
-4.248507	6.050149	3.337463
-4.494141	3.640202	3.332222
-0.694255	5.476596	3.340957
-0.960743	3.539459	3.351588
-0.955457	5.313241	3.360055
-0.974037	3.271101	3.343028
-1.160000	0.010000	3.320000
-1.170545	1.526000	3.342182
-1.647168	0.414661	3.362861
-1.666387	0.760126	3.359580
-1.806439	3.905707	3.349707
-2.205125	5.785625	3.360271
-2.342308	4.229128	3.351949
-2.426775	5.592085	3.352769
-2.570470	4.620671	3.347651
-3.359532	2.528857	3.356208
-3.357500	1.414474	3.350000
-3.669065	0.761667	3.354187
-3.780441	2.003676	3.346029
-3.903947	1.105197	3.363750
-3.955556	4.699487	3.344017
-4.408723	5.695213	3.343191
-4.474307	2.744270	3.351049
-0.703883	5.226019	3.356117
-0.928766	6.330519	3.361169
-0.986410	0.641603	3.360577
-1.203947	6.119035	3.364123
-1.477129	5.572327	3.357772
-1.646381	1.380667	3.360952
-1.765496	1.631908	3.364351
-1.808670	5.916543	3.362766
-2.166053	1.615263	3.359145
-2.197257	4.909115	3.360442
-2.258090	0.117990	3.365628
-3.133893	1.304966	3.358993
-3.510227	4.564091	3.347727
-3.674583	0.503250	3.355333
-3.700986	1.766056	3.350704
-3.984545	4.055455	3.351970
-3.995192	6.386250	3.353462
-4.215000	2.237245	3.360612
-0.717593	2.387685	3.371204
-0.733443	3.736437	3.377395
-0.936000	5.586594	3.385125
-0.959219	4.839023	3.375508
-1.244359	1.992821	3.366795
-1.492329	4.334932	3.372808
-1.553333	3.893333	3.361053
-1.596829	6.033537	3.361829
-1.642966	4.127797	3.366695
-1.713297	3.156341	3.374384
-1.755254	0.994746	3.357119
-1.929274	3.300484	3.370242
-1.945629	4.372781	3.377483
-2.094600	4.147133	3.375900
-2.184783	3.568127	3.378462
-2.579851	3.292677	3.376840
-2.684412	0.922353	3.370662
-3.654634	3.378537	3.382561
-4.062946	5.190775	3.373023
-4.229800	4.829800	3.361800
-4.479769	0.730615	3.367615
-4.484519	3.203558	3.360865
-0.719000	5.728667	3.375467
-1.503617	2.464787	3.373511
-1.558000	1.138471	3.386647
-1.873205	0.298974	3.370256
-2.566308	2.013231	3.377308
-2.710959	5.877021	3.382705
-3.004556	3.405089	3.381479
-3.033134	1.858507	3.369552
-3.276524	4.460024	3.386952
-3.375288	5.722404	3.370481
-3.809317	2.788075	3.372609
-4.052438	2.034000	3.386594
-4.223701	6.298110	3.371575
-4.465769	5.930577	3.370385
-4.479692	4.335077	3.368769
-4.477500	5.122639	3.370833
-1.206513	5.529145	3.400461
-1.236098	0.590585	3.394683
-1.395841	1.421327	3.391416
-1.499293	3.516061	3.385960
-1.559850	2.905225	3.397800
-1.670920	5.421954	3.388391
-1.699559	6.314485	3.389265
-1.899748	5.512516	3.393899
-2.503975	0.175607	3.399038
-2.703851	2.586988	3.394689
-3.036400	0.316267	3.389911
-3.508704	5.503333	3.397623
-3.569434	2.693585	3.387925
-3.585949	4.977487	3.403282
-4.200000	5.817963	3.379444
-4.212059	0.170000	3.382941
-4.220891	2.488317	3.388812
-4.469638	0.989783	3.389565
-4.461429	6.181633	3.380816
-4.473043	5.459783	3.382174
-0.762303	1.302191	3.402079
-1.008214	2.479762	3.400595
-1.385273	0.376800	3.406691
-1.374078	5.957670	3.401165
-1.400000	0.010000	3.372500
-1.605376	5.141221	3.408427
-2.099082	2.258163	3.392857
-2.310636	2.122182	3.394818
-2.453523	6.300303	3.406023
-2.458192	5.847910	3.401751
-2.785277	5.594298	3.405277
-3.163502	6.378953	3.411372
-3.302319	0.604589	3.398986
-3.350310	2.030543	3.399302
-3.930986	0.818630	3.415507
-3.959143	1.364000	3.392143
-3.968500	5.430833	3.394500
-4.221932	2.747273	3.392159
-4.227679	1.379464	3.397679
-4.455167	1.258662	3.404201
-0.948082	5.861049	3.425601
-1.032595	1.324524	3.423119
-1.195985	1.097406	3.425761
-1.254394	3.927197	3.414508
-1.429759	5.328072	3.410000
-1.547729	0.176507	3.420306
-2.719419	1.406977	3.404767
-2.949719	2.315082	3.420304
-2.960939	4.839797	3.420203
-3.169821	2.716786	3.398929
-3.473288	1.665856	3.419452
-3.567881	2.368390	3.403559
-3.860154	0.206462	3.406615
-3.907055	3.781650	3.417508
-3.919124	5.677591	3.404161
-4.189924	0.438550	3.415420
-4.460909	3.878523	3.404091
-4.470857	2.481714	3.396571
-0.876481	5.074630	3.412593
-1.240714	0.835000	3.405952
-1.539889	1.760000	3.420667
-2.119273	0.327932	3.437886
-2.182996	3.289401	3.427753
-2.502078	1.295974	3.417273
-2.552551	3.917092	3.422857
-2.877074	2.047340	3.425691
-2.929024	2.712683	3.423049
-3.356792	5.095849	3.407925
-3.620413	5.751770	3.424690
-4.174317	5.569137	3.418561
-4.393981	1.566852	3.414722
-0.762000	2.144909	3.432455
-1.073061	2.910000	3.416735
-1.813571	4.912755	3.426429
-1.823795	2.155281	3.438020
-1.859094	2.857774	3.435736
-2.041282	3.794359	3.438872
-2.290507	3.970254	3.442535
-2.536849	3.005000	3.428767
-2.926563	4.204063	3.418438
-2.925222	6.295611	3.433278
-2.976618	2.966029	3.431127
-3.447737	6.007956	3.425912
-3.933119	3.505505	3.433211
-4.023758	4.934395	3.440637
-4.048842	1.605946	3.433822
-0.762436	0.133846	3.436282
-0.995049	3.809126	3.434175
-1.016585	0.129538	3.452985
-1.197365	5.219606	3.450197
-1.284557	4.532966	3.452446
-1.602663	4.767389	3.452611
-1.832177	0.576122	3.438299
-1.849655	4.665747	3.432069
-1.887389	1.894522	3.445987
-2.167692	2.545846	3.430000
-2.219464	1.031250	3.436429
-2.276897	2.772155	3.434914
-2.726145	1.156867	3.439759
-2.767590	3.118313	3.438494
-2.809948	3.967098	3.438290
-2.831514	1.673267	3.442510
-3.067233	0.752327	3.441384
-3.604090	5.250396	3.453087
-4.152908	3.634610	3.442979
-4.173825	0.698470	3.448415
-4.213556	3.870667	3.423556
-4.238462	4.323718	3.444872
-1.176264	3.641319	3.446044
-1.876234	5.171778	3.462594
-2.200676	3.028514	3.446351
-2.371243	4.744320	3.451243
-2.389252	1.680204	3.453333
-2.564915	6.074542	3.463559
-2.723043	2.846957	3.442899
-2.731190	0.687738	3.447738
-2.897033	5.363445	3.455502
-2.954559	4.453088	3.448603
-3.081200	1.072350	3.453950
-3.542308	2.941209	3.443077
-3.615494	6.208670	3.450043
-3.696286	4.142286	3.440714
-3.983646	4.286133	3.452155
-4.151250	3.120417	3.440417
-1.009744	4.589829	3.468889
-1.021572	1.942704	3.463019
-1.188974	4.773846	3.447179
-1.265739	0.161565	3.453565
-1.273765	2.228704	3.461049
-1.388697	4.959910	3.476472
-1.914797	6.382276	3.454146
-2.307419	1.433065	3.451613
-2.400120	3.700876	3.468167
-2.400805	5.003678	3.455862
-2.612584	3.546292	3.449551
-2.923717	0.027368	3.476776
-3.241155	2.955988	3.464985
-3.257635	1.801554	3.463784
-3.700615	1.251385	3.460103
-4.165758	0.957374	3.455960
-4.409133	3.432954	3.472222
-4.417432	4.568716	3.463268
-0.773524	1.888667	3.474286
-0.804188	2.875550	3.478429
-1.007265	2.232059	3.482941
-1.014430	0.916709	3.458987
-1.007377	1.690328	3.467213
-1.278167	2.481833	3.467833
-1.300968	3.004409	3.476505
-1.641486	1.981622	3.462703
-1.893117	0.816104	3.460000
-1.911757	2.408745	3.471757
-1.971908	1.066151	3.474375
-2.460598	0.862735	3.467009
-2.613200	1.789000	3.464200
-2.871736	6.050826	3.469256
-2.941061	5.792122	3.477510
-3.195745	5.928404	3.473245
-3.874434	3.254660	3.479968
-3.920682	5.926515	3.461364
-4.025422	0.029333	3.475156
-4.411440	1.851206	3.483502
-0.770526	0.788246	3.467719
-1.244783	1.717681	3.477681
-1.497561	0.907195	3.469146
-1.584133	5.819867	3.473333
-1.731273	4.462727	3.478909
-2.391034	3.437586	3.467586
-2.407568	0.393063	3.474414
-2.493813	4.397813	3.475000
-2.664854	0.016505	3.483398
-2.685325	6.297597	3.476883
-2.879163	0.495665	3.483498
-2.888760	3.621405	3.484339
-3.128704	5.038765	3.482654
-3.195870	4.717640	3.487994
-3.278938	0.357611	3.485310
-3.365754	6.242291	3.475251
-3.437944	3.513084	3.474673
-3.647738	0.095714	3.475714
-3.706200	4.559600	3.467400
-3.769000	3.017250	3.472250
-4.261822	5.051051	3.492079
-4.417360	2.133600	3.481240
-4.423878	0.044354	3.477551
-4.435373	2.987910	3.468060
-0.753902	6.006585	3.476341
-0.797816	2.592031	3.499885
-0.804186	0.377535	3.493023
-1.247821	2.743619	3.501362
-1.381667	4.142308	3.491026
-2.190882	4.385539	3.495343
-2.205542	5.146988	3.484819
-2.489651	2.463953	3.483140
-3.131683	2.492970	3.487822
-3.584681	1.944043	3.480319
-4.145551	3.371066	3.496801
-0.801513	4.187697	3.499342
-1.686505	3.745922	3.497087
-1.725340	3.486456	3.505388
-1.836324	6.135784	3.509608
-1.860210	4.147832	3.495594
-2.073947	4.743158	3.494211
-2.104306	2.030417	3.489583
-2.880749	5.102834	3.507166
-3.054516	3.815726	3.493548
-3.241429	2.249365	3.507937
-3.324112	5.320374	3.492056
-3.403786	3.159500	3.499643
-3.749744	5.516282	3.498910
-3.797517	6.380455	3.516818
-3.872024	0.435893	3.500893
-4.402427	4.130921	3.500209
-1.304086	3.273555	3.516080
-1.360000	5.734000	3.512000
-1.842734	1.419820	3.517014
-2.438542	5.248177	3.514740
-2.629204	5.085664	3.508850
-2.688757	0.316836	3.521808
-2.924505	1.293297	3.504615
-3.094264	5.513876	3.510698
-3.284159	0.931416	3.505310
-3.480577	4.035096	3.511442
-3.638841	3.654493	3.514130
-3.809916	4.813866	3.508151
-4.017895	2.277895	3.503553
-4.398525	0.308579	3.513770
-0.788962	3.441038	3.515472
-0.993971	6.129779	3.511691
-1.041897	4.251897	3.513793
-1.055692	0.446443	3.527826
-1.826870	5.722672	3.520687
-1.973503	5.943450	3.603259
-2.250000	5.486522	3.517043
-2.261957	5.989946	3.520924
-2.708000	4.211333	3.523111
-2.743023	4.716434	3.522093
-2.788528	3.369722	3.532472
-2.885842	0.930891	3.518812
-3.201917	3.604889	3.534417
-3.242938	1.551688	3.523000
-3.412978	3.784831	3.521236
-3.493961	1.093052	3.532792
-3.529607	0.312295	3.532000
-3.688077	3.900769	3.507500
-3.809408	5.074737	3.513750
-0.786604	4.450000	3.520755
-1.077148	3.132096	3.540687
-1.519091	6.386883	3.521818
-1.513103	3.132759	3.518276
-2.037143	4.983571	3.526143
-2.063333	5.643141	3.535449
-2.169247	1.246986	3.530959
-2.384167	1.927222	3.517639
-2.502780	0.618976	3.534537
-2.511014	2.206329	3.538841
-2.517432	2.730137	3.539016
-2.707544	2.361930	3.518070
-3.157757	4.240514	3.531028
-3.306923	1.261346	3.522500
-3.402194	0.066367	3.532266
-3.515069	4.297743	3.534688
-3.701127	1.593333	3.528333
-3.881118	1.778882	3.529627
-4.108615	1.187385	3.518462
-4.386084	5.288112	3.527692
-0.783415	6.242683	3.527805
-1.069558	3.402210	3.546022
-1.171906	5.950809	3.552689
-1.433935	3.769379	3.544379
-1.601975	1.550191	3.540000
-1.670513	2.403077	3.533333
-1.723911	2.659815	3.545978
-2.111745	0.030468	3.550170
-2.168486	1.790784	3.554541
-3.149109	0.144368	3.552759
-3.216360	3.326207	3.545900
-3.370914	2.735635	3.542995
-3.519486	0.579673	3.543224
-3.555029	4.746192	3.549477
-3.934834	4.525762	3.542384
-4.114264	6.073953	3.537907
-4.382345	0.568207	3.541379
-0.798571	3.928571	3.545000
-0.795075	4.711940	3.542537
-0.825455	1.038485	3.548182
-0.824388	3.187908	3.555306
-0.835980	1.523660	3.556438
-1.096763	4.988426	3.567339
-1.347276	6.203621	3.555483
-1.406832	0.700495	3.551188
-1.417287	2.041117	3.549043
-1.930345	1.666069	3.551379
-1.978804	3.059185	3.553804
-1.980733	2.659400	3.549933
-2.222301	0.805739	3.558011
-2.225758	0.541273	3.554545
-3.521333	6.396889	3.540667
-3.735049	0.931845	3.545728
-3.796731	2.356731	3.535000
-4.047059	0.272745	3.538039
-4.118435	4.712652	3.552087
-0.826979	5.429532	3.572255
-1.592180	6.166992	3.559549
-2.026656	5.372125	3.575750
-2.419442	3.191076	3.568606
-2.454767	1.098895	3.560756
-2.459337	4.143976	3.567349
-2.517759	1.496207	3.550000
-2.606235	5.709471	3.564000
-2.987215	3.192877	3.566712
-3.121023	0.536093	3.568791
-3.155263	2.006974	3.553947
-3.497115	2.170224	3.567821
-3.480618	1.442542	3.577482
-3.655549	5.980445	3.574036
-3.860755	6.141415	3.561698
-4.139005	4.079147	3.565261
-4.146094	5.335938	3.551250
-4.377450	3.689060	3.554966
-1.000896	2.736418	3.560746
-1.089823	5.689381	3.586047
-1.467798	2.616607	3.569583
-1.520377	4.539811	3.567484
-1.527162	1.311892	3.565541
-1.617700	5.587100	3.571550
-1.742822	1.181245	3.574689
-2.080283	6.242085	3.586862
-2.100789	1.490132	3.561711
-2.668729	5.349171	3.568674
-2.689067	3.752000	3.571067
-3.504744	0.828205	3.563846
-3.638485	2.530758	3.563485
-3.776165	0.665090	3.578746
-4.357639	0.836898	3.579769
-4.364430	4.805436	3.572416
-4.361447	5.825921	3.561711
-4.370833	5.582083	3.559583
-1.032941	4.006176	3.583015
-1.092876	0.714335	3.583219
-1.343956	3.522637	3.578242
-1.585598	4.011624	3.586068
-1.712356	0.289540	3.582069
-1.936200	0.197600	3.571200
-1.994712	4.529640	3.594317
-2.019883	3.432953	3.589357
-2.356000	5.697778	3.569778
-2.885849	2.519245	3.575597
-3.098333	5.269643	3.575714
-3.143341	6.160935	3.591449
-3.242362	3.973568	3.582563
-3.336667	4.914394	3.567576
-3.330278	5.568167	3.580944
-3.814118	2.103529	3.589538
-3.895985	4.012117	3.580730
-4.060552	6.342566	3.588585
-4.077802	5.770055	3.582253
-4.358352	6.075824	3.571978
-4.351011	6.341011	3.581180
-1.239780	1.301282	3.597179
-1.373055	5.489539	3.606455
-1.403016	1.105794	3.584206
-1.573488	0.520640	3.590116
-1.607930	4.280881	3.598943
-1.715376	0.922688	3.587634
-1.812428	3.254529	3.601377
-2.300053	6.379158	3.590526
-2.551389	4.862361	3.588750
-3.038653	1.751036	3.594870
-3.418352	2.426758	3.593077
-3.432773	5.820504	3.585714
-3.638235	3.209804	3.587598
-3.675680	2.792426	3.593550
-3.880611	5.307889	3.590000
-4.120774	1.815806	3.592903
-4.228667	2.943939	3.591879
-4.351444	1.106203	3.593209
-4.368831	2.735455	3.583636
-0.831892	5.699527	3.596216
-0.860798	0.604172	3.598221
-0.953507	5.209478	3.603284
-1.078051	5.422542	3.600169
-1.097869	1.509016	3.595410
-1.353439	1.536688	3.605605
-1.594301	5.327306	3.608342
-1.710547	1.785323	3.605970
-1.711310	2.998363	3.615239
-2.079528	4.009571	3.599442
-2.258778	2.270833	3.609222
-2.293003	0.217157	3.612875
-2.368526	2.934211	3.601158
-2.686800	2.004571	3.601314
-3.000103	4.038144	3.594948
-3.011321	1.499245	3.589057
-3.420137	4.533288	3.591096
-3.771192	4.306995	3.606736
-3.964481	1.008506	3.602597
-0.858421	3.698684	3.618202
-1.118328	6.332958	3.610836
-1.365673	4.730481	3.608462
-1.444706	2.361373	3.608725
-1.609464	2.187321	3.599643
-1.894737	3.653053	3.606947
-2.007513	0.657919	3.615685
-2.127989	2.857759	3.615287
-2.475612	5.491122	3.615306
-2.734535	4.459942	3.609070
-2.926564	0.258650	3.613190
-3.760132	3.454305	3.608874
-3.805699	5.763656	3.620573
-4.095254	2.521949	3.605424
-4.109853	1.424265	3.597794
-4.324235	3.195882	3.617529
-4.353294	1.405059	3.602588
-4.340872	2.481544	3.615235
-1.656794	4.976327	3.627983
-1.832141	3.908049	3.635095
-2.004595	2.219459	3.614189
-2.517605	4.609191	3.631327
-2.900786	0.705286	3.625571
-3.135421	4.493645	3.611776
-3.472200	5.102000	3.616400
-3.833333	0.010000	3.607778
-3.859952	1.409614	3.621981
-3.995315	3.060961	3.633123
-4.036269	5.120896	3.611194
-4.072019	3.826442	3.625577
-4.229516	2.245484	3.609516
-0.842791	4.961744	3.619767
-0.875985	1.274672	3.631606
-1.173196	3.812165	3.627423
-1.288864	0.481761	3.631250
-1.361410	4.357436	3.630641
-1.442927	2.865000	3.625122
-1.461458	5.966667	3.633802
-2.212659	3.615635	3.638690
-2.258171	4.896286	3.629314
-2.621233	1.277808	3.634795
-2.682417	1.008083	3.631917
-2.752484	1.506369	3.641783
-2.743786	5.918786	3.631786
-3.070000	2.739500	3.617000
-3.138867	5.735123	3.629901
-3.296475	0.713852	3.629098
-4.009187	5.524228	3.624309
-4.079085	0.526078	3.637320
-4.238174	0.145434	3.634658
-0.873237	2.058417	3.635252
-1.230324	0.930356	3.647152
-1.416786	1.790982	3.637143
-1.460544	0.299456	3.638095
-1.534621	3.349798	3.650303
-1.734420	5.927800	3.655780
-2.236679	4.626900	3.648524
-2.291632	2.618289	3.647816
-2.901389	5.601389	3.630972
-3.010299	3.456866	3.634478
-3.020556	6.398889	3.624444
-3.389636	1.926727	3.629273
-3.765329	0.243699	3.645517
-3.866575	2.626740	3.639337
-4.319156	1.663556	3.645600
-4.326316	3.926491	3.631404
-1.063832	1.124673	3.648318
-1.129432	4.434545	3.640682
-2.408044	6.151240	3.660744
-2.463636	5.896883	3.641429
-2.540143	0.139810	3.652190
-2.558349	3.405000	3.653761
-2.830933	2.205333	3.641067
-2.850198	2.998218	3.647426
-2.927826	4.289437	3.663299
-2.952154	4.647846	3.646308
-4.058421	2.083289	3.643026
-1.114412	1.811471	3.646471
-1.126947	2.076632	3.652105
-1.128448	2.914138	3.655517
-1.155578	0.248741	3.666871
-1.381409	0.052610	3.675935
-1.427500	5.147440	3.660595
-1.781304	2.026739	3.657174
-1.823369	4.750494	3.678820
-2.090000	2.455522	3.647910
-2.375476	1.312143	3.647857
-2.410528	3.891901	3.674261
-2.649032	3.997097	3.650000
-2.825607	2.746262	3.660748
-2.854724	4.900394	3.656929
-3.423136	2.964746	3.654068
-3.497750	5.390875	3.652250
-0.879020	1.769020	3.653922
-0.900541	5.944472	3.678575
-0.902661	0.228548	3.668226
-1.137848	4.695949	3.672405
-1.174272	2.382722	3.682880
-1.813803	0.019108	3.682629
-2.232843	4.198235	3.662745
-2.256964	3.359107	3.656964
-2.313989	1.565319	3.667979
-2.646986	2.549658	3.671575
-2.663993	3.161282	3.677839
-2.714146	0.519024	3.657805
-2.774667	1.775500	3.661500
-2.937754	1.978941	3.676102
-2.955349	1.105659	3.672713
-2.995269	5.951935	3.681774
-3.048717	2.338586	3.683272
-3.096353	0.852941	3.667412
-3.440046	3.356250	3.675463
-3.450560	6.110960	3.663920
-3.837167	3.723348	3.670129
-4.033214	3.535268	3.665893
-4.046842	0.775000	3.661711
-1.808913	0.505261	3.682609
-1.838953	5.528014	3.688412
-2.227154	1.049112	3.693029
-2.248829	5.300360	3.679820
-2.517407	1.731414	3.690135
-2.660769	0.758803	3.683675
-2.666480	6.156786	3.684235
-3.116240	4.873872	3.694039
-3.209700	1.078300	3.698200
-3.265307	6.376316	3.686272
-3.438344	1.687748	3.680265
-3.675392	1.810506	3.688101
-3.673581	4.077973	3.683514
-4.294481	2.001749	3.681803
-4.275556	4.545313	3.691146
-0.907067	0.850933	3.681600
-0.905059	2.989882	3.688706
-1.354592	3.972602	3.693469
-1.592407	3.616420	3.687593
-1.991146	0.914167	3.695052
-2.038626	0.389121	3.688132
-2.195904	3.108883	3.698883
-2.365789	4.408421	3.686842
-2.761622	6.394865	3.677838
-3.102171	2.983808	3.697651
-3.579631	5.634538	3.699103
-3.661583	4.949778	3.698861
-3.985089	4.884464	3.699196
-4.259547	4.270121	3.705438
-0.895179	4.320893	3.695536
-1.192140	4.176347	3.711107
-1.824200	5.270600	3.693000
-1.903364	6.389813	3.694766
-1.956197	1.864648	3.694225
-1.979416	1.191948	3.709286
-2.188473	5.816158	3.706355
-2.462765	5.069625	3.703481
-2.508131	0.401495	3.697009
-3.235451	2.573819	3.705625
-3.243717	5.109867	3.703982
-3.338710	0.475968	3.691290
-3.643618	4.511709	3.698141
-3.988761	1.620000	3.707212
-4.056410	2.788051	3.703897
-1.149167	3.577667	3.707500
-1.192019	5.234327	3.714904
-1.855158	2.504421	3.702211
-1.898356	5.041507	3.708219
-2.622368	2.898053	3.715632
-2.785364	3.565099	3.715695
-2.903910	5.359799	3.724211
-2.914907	6.217920	3.717547
-3.034556	3.691000	3.710222
-3.189835	1.363992	3.715679
-3.269425	5.950402	3.713966
-3.317425	4.345389	3.714731
-3.591875	0.032500	3.706063
-3.651161	1.283125	3.705804
-3.672727	5.215455	3.705354
-3.958605	5.963688	3.723121
-4.002914	4.344686	3.712686
-4.279778	3.445778	3.704667
-0.919053	4.574852	3.715325
-0.939395	2.542326	3.718419
-1.774891	4.470876	3.719124
-1.892888	2.830036	3.725740
-2.131833	5.089167	3.711167
-2.196483	2.017585	3.737987
-2.444197	0.899343	3.724854
-2.440845	2.417042	3.714789
-2.461032	3.634603	3.716825
-2.788235	0.010000	3.707647
-2.859148	3.873409	3.724432
-3.373578	0.237890	3.721193
-3.576405	3.841373	3.719477
-3.748596	3.016082	3.719766
-3.988727	0.123000	3.724909
-4.249200	5.188100	3.726700
-0.923194	6.218168	3.728586
-0.917119	3.476949	3.722881
-0.933932	2.284274	3.724615
-1.181592	2.648726	3.733503
-1.517328	0.841422	3.738799
-1.789158	4.156842	3.735684
-2.465282	2.023944	3.729085
-2.725344	5.159924	3.739771
-3.140618	0.338146	3.729045
-3.267075	5.371429	3.729728
-3.289306	2.123750	3.721528
-3.666542	0.482712	3.748427
-3.685304	6.185217	3.726522
-3.810000	4.702361	3.723472
-3.930424	3.298545	3.732303
-3.942857	2.360974	3.733636
-4.265306	5.440408	3.725306
-4.283409	0.407045	3.713182
-1.243195	3.140237	3.742071
-1.278407	5.794973	3.751209
-1.462332	6.351989	3.763320
-1.753713	6.207178	3.744455
-1.794405	2.261548	3.736310
-1.937076	5.761345	3.738596
-2.525655	6.372768	3.745238
-2.991322	5.100460	3.739425
-3.276217	4.664957	3.744174
-3.407711	1.238554	3.736627
-3.486901	2.625704	3.741831
-3.567667	3.575400	3.752967
-4.218723	5.932553	3.726809
-1.337426	2.181864	3.762663
-1.545693	5.757154	3.756217
-1.756458	1.574792	3.737500
-1.801667	3.466778	3.752056
-1.948269	1.446346	3.742692
-2.015576	4.283680	3.756320
-2.057742	3.789194	3.748978
-2.363485	0.640644	3.756515
-2.690689	5.537356	3.760467
-2.944967	0.492026	3.752157
-3.281111	3.169630	3.746852
-3.298616	3.739322	3.757627
-3.702703	2.292568	3.741892
-3.794123	5.493070	3.743596
-3.927421	1.895833	3.754206
-3.985020	1.220040	3.756397
-4.196594	0.966006	3.757337
-4.220826	6.191364	3.752645
-4.261449	0.666957	3.741159
-4.259714	5.698857	3.734571
-0.985059	3.232485	3.778491
-1.272739	6.068185	3.769236
-1.285315	0.699505	3.768468
-1.499862	3.074050	3.771433
-1.565455	4.708446	3.771378
-1.575000	1.148276	3.748621
-1.610522	2.521522	3.770478
-1.637533	2.785267	3.756867
-2.047045	4.858864	3.758636
-2.076195	1.657345	3.758938
-2.085028	5.542486	3.766851
-2.093977	0.157614	3.760795
-2.184409	6.069685	3.748976
-3.193821	1.625472	3.768726
-3.223512	3.474762	3.770000
-3.417595	4.050541	3.770622
-3.438681	0.968462	3.755055
-3.629388	2.054694	3.751633
-3.675122	1.037561	3.749024
-0.947723	5.553762	3.763267
-1.261549	4.993662	3.766901
-1.536697	1.448394	3.774312
-1.546081	2.014542	3.773516
-2.135556	6.396667	3.763333
-2.924900	1.341833	3.779100
-3.017800	0.069546	3.777959
-3.646996	1.536567	3.778712
-3.668889	0.801944	3.756389
-4.031692	4.600154	3.777744
-4.236581	1.251453	3.764615
-4.238854	3.688854	3.762604
-0.982157	3.853922	3.785441
-1.004648	0.449805	3.786563
-1.190667	5.552933	3.775867
-1.287440	3.394480	3.781120
-1.608261	0.135280	3.782919
-2.600072	2.238406	3.776594
-2.716133	4.201067	3.777467
-2.740327	4.656797	3.776013
-2.848103	0.899770	3.781954
-3.194101	1.891573	3.778315
-3.487753	6.338590	3.779339
-3.921791	6.226418	3.783358
-4.215491	4.793757	3.779249
-4.239844	2.647813	3.771406
-0.954167	4.811875	3.778750
-1.255373	1.677015	3.795224
-1.266757	1.927838	3.787297
-1.352030	3.718687	3.803851
-1.536410	4.426325	3.795983
-1.574925	3.853134	3.775224
-1.849075	0.247543	3.805377
-1.943402	3.137191	3.806160
-2.075802	2.661975	3.781481
-2.428472	4.796806	3.780278
-2.541972	5.327606	3.777324
-2.762424	0.326212	3.778788
-3.172292	4.153125	3.782917
-3.558060	4.278881	3.800709
-3.951446	0.360602	3.785542
-0.964462	4.112615	3.794000
-0.980444	1.426000	3.789556
-0.979500	2.779300	3.793900
-0.979587	5.060000	3.803140
-1.788588	1.032316	3.809040
-2.287656	1.774531	3.796406
-2.583407	4.404505	3.791209
-2.795714	2.392101	3.799916
-2.943462	1.608590	3.793205
-2.984982	2.597365	3.808845
-3.065603	3.278621	3.799397
-3.108304	3.914620	3.805322
-3.352420	5.722038	3.799936
-3.471351	0.662819	3.807876
-3.543376	5.903939	3.808824
-3.877725	5.102036	3.797305
-3.902031	0.615430	3.810039
-4.029571	5.325643	3.810643
-4.189388	2.389429	3.814327
-1.123409	0.026688	3.818669
-1.575769	1.709231	3.796731
-1.586066	5.495972	3.810664
-1.626818	0.375682	3.797045
-2.287799	0.374654	3.815409
-2.411731	5.713269	3.800769
-2.655126	4.907787	3.823165
-2.852521	5.754062	3.821541
-3.417876	4.945693	3.821298
-3.538654	3.122404	3.805577
-3.560331	4.727769	3.808926
-3.666056	3.334648	3.809437
-4.029684	4.106013	3.808101
-4.197668	1.507720	3.812850
-0.996267	1.932800	3.810800
-1.219149	1.431277	3.809574
-1.293288	4.509452	3.814795
-1.340098	1.202580	3.833317
-1.416392	2.685979	3.809485
-1.554643	4.161964	3.817321
-1.758516	1.305875	3.830326
-1.863944	0.727702	3.828292
-1.960325	2.102927	3.816423
-2.038682	5.289591	3.828773
-2.191282	0.823718	3.817051
-2.621394	3.811010	3.819615
-2.813229	3.329561	3.832853
-3.576476	2.853429	3.828143
-3.714331	2.533622	3.814173
-3.840172	3.935776	3.810690
-3.891606	0.894234	3.821168
-0.989180	5.313115	3.823279
-1.013289	1.667105	3.828026
-1.037898	0.702102	3.836433
-1.305089	2.907054	3.825536
-1.483580	4.952716	3.821111
-1.568846	2.273077	3.813462
-1.600612	5.199592	3.819388
-1.808010	3.725000	3.841505
-2.001864	4.626780	3.826610
-2.226575	4.003119	3.833211
-2.265714	2.813354	3.827391
-2.414140	3.285478	3.830701
-2.484146	4.101341	3.835823
-2.480196	2.657647	3.842745
-2.612025	5.851139	3.826076
-2.653333	1.897895	3.824912
-3.102788	4.388077	3.829135
-3.143949	5.568587	3.835072
-3.451230	5.218095	3.835357
-3.479667	2.236167	3.816500
-1.206214	6.306214	3.841714
-1.355476	5.377143	3.840873
-1.694931	3.245590	3.844271
-1.710000	6.400000	3.820000
-1.969778	4.014222	3.833333
-2.120260	0.577857	3.848409
-2.115833	2.307222	3.847222
-2.321618	5.472228	3.854271
-2.332692	0.100994	3.850577
-2.424881	3.017698	3.843333
-3.190769	2.790385	3.834103
-3.589134	0.245118	3.842362
-3.834236	2.787896	3.853084
-3.847627	3.524350	3.840000
-4.157373	2.994235	3.842196
-4.163709	3.256490	3.841656
-4.177059	0.010000	3.836176
-4.169239	1.831576	3.842989
-4.196250	3.926528	3.826944
-1.024028	5.777109	3.847630
-1.066828	0.964793	3.858069
-1.317531	4.765188	3.860837
-1.410784	0.490833	3.857598
-2.036099	3.546233	3.854798
-2.173925	1.444393	3.843084
-2.185427	4.457607	3.861068
-2.608333	1.107886	3.859756
-2.930259	4.090570	3.849378
-3.003571	0.715238	3.845357
-3.075562	2.114894	3.862766
-3.094457	6.354286	3.849314
-3.303696	6.163519	3.862557
-3.872283	2.141096	3.851370
-3.902742	5.688871	3.837903
-4.017373	2.579407	3.841949
-0.996667	6.400000	3.833333
-1.377303	2.433717	3.867500
-1.607308	6.038615	3.858308
-1.748700	1.876100	3.849500
-2.286061	3.748485	3.846364
-2.297710	3.503588	3.860916
-2.362897	2.215888	3.866308
-2.566667	0.010370	3.850000
-2.659042	1.372682	3.876054
-2.703492	1.647354	3.867725
-2.800518	6.021224	3.870918
-2.799713	2.099936	3.874236
-3.266733	0.804158	3.853564
-3.444808	4.509808	3.856154
-4.011448	3.751136	3.877706
-4.159160	0.245378	3.858824
-1.392857	0.235714	3.866633
-1.630379	0.620530	3.863939
-2.137879	3.307652	3.865833
-2.277927	4.967683	3.862805
-2.767586	0.630251	3.886708
-2.916837	3.086122	3.865000
-3.121379	5.822069	3.860517
-3.238194	2.315139	3.858333
-1.041948	6.053831	3.877857
-1.072161	3.000879	3.886667
-1.071473	4.387649	3.889467
-1.089537	2.161907	3.891526
-1.725268	4.902282	3.888254
-1.741048	2.981210	3.882097
-2.041583	6.221636	3.893298
-2.311548	6.239409	3.899572
-2.343905	5.936381	3.876476
-2.356045	5.205522	3.885149
-2.416818	4.559318	3.871364
-2.457843	1.560667	3.887294
-2.880462	1.830923	3.868308
-3.182508	0.538482	3.889571
-3.414054	0.011351	3.875135
-3.442055	1.854466	3.882648
-3.870278	1.447500	3.865278
-4.133096	2.104184	3.880544
-4.126016	5.020398	3.884382
-1.062308	1.223590	3.880256
-1.332128	0.940426	3.885957
-1.354314	4.280131	3.890588
-1.484259	3.502889	3.902519
-2.215044	4.725575	3.887699
-2.410140	1.281121	3.897383
-2.554127	0.247922	3.900000
-2.539763	6.096746	3.905030
-2.728371	6.302664	3.905145
-2.742199	2.634894	3.886738
-2.950735	4.568382	3.878088
-2.982245	3.511633	3.875918
-3.413097	1.542258	3.890194
-3.821959	1.691031	3.884021
-3.916574	3.094815	3.885463
-4.118641	5.570924	3.889511
-4.135045	0.496396	3.887838
-1.074895	3.447622	3.902238
-1.207647	3.928941	3.897529
-1.760492	5.662077	3.900492
-1.817834	5.914331	3.899299
-2.164541	1.194031	3.909439
-2.281833	2.496000	3.899750
-2.872903	2.840968	3.888226
-2.889346	4.821308	3.899346
-3.058333	6.082613	3.907613
-3.070530	0.945303	3.905530
-3.354669	2.974587	3.899504
-3.417505	5.487027	3.916881
-3.767880	6.019954	3.902028
-3.801765	4.163137	3.887451
-3.819785	4.872366	3.894194
-4.128087	3.507652	3.897913
-1.724321	4.325309	3.907037
-1.803188	5.389710	3.906449
-2.073256	1.860930	3.912558
-2.592700	3.440900	3.906500
-2.782827	0.120169	3.913924
-2.861646	1.128608	3.902785
-2.970928	0.299283	3.917342
-3.104324	1.198649	3.904324
-3.231019	0.160370	3.909861
-3.723417	3.733583	3.905250
-3.757400	4.412700	3.902200
-3.778661	1.199643	3.905625
-4.102824	0.762137	3.912519
-4.092645	5.827025	3.908512
-1.085419	4.653935	3.917097
-1.112279	2.483628	3.927349
-1.140637	0.264111	3.929151
-1.384311	5.622800	3.918356
-1.381343	5.144179	3.916716
-1.735655	3.981138	3.922448
-1.774819	4.632691	3.927108
-1.808542	5.141042	3.908333
-1.885698	1.671396	3.933077
-2.355000	1.030676	3.917297
-3.051471	5.272206	3.913529
-3.431364	2.451061	3.910152
-3.826696	0.189554	3.912143
-1.120667	3.693167	3.917500
-1.410000	0.013659	3.930000
-1.447867	3.982000	3.927200
-1.718065	2.136129	3.920000
-1.875156	0.482595	3.941661
-1.879059	2.657412	3.920941
-2.030288	5.040385	3.924423
-2.393962	4.324528	3.919623
-2.520315	0.521374	3.942027
-2.634545	0.853831	3.927338
-2.745048	5.330571	3.924571
-2.862208	4.337083	3.932917
-3.394216	0.385226	3.938711
-3.462143	3.337619	3.924762
-3.793968	5.326825	3.928175
-1.861351	2.411892	3.927297
-1.970320	0.041715	3.952384
-2.073031	5.947478	3.952876
-2.192685	5.701644	3.947616
-2.620537	3.176157	3.946777
-2.906632	5.521969	3.941451
-2.963333	3.757634	3.933441
-3.534716	1.176023	3.938295
-3.548932	6.144369	3.944612
-3.664707	5.098000	3.951488
-3.702292	1.907000	3.944375
-4.066696	6.085507	3.940088
-1.121394	4.909212	3.953333
-1.417277	3.245982	3.959063
-1.445176	1.852196	3.956549
-1.969375	0.924375	3.943958
-2.076455	0.308973	3.971149
-2.418036	1.910357	3.941250
-2.705797	4.015217	3.939420
-3.003043	2.366242	3.956025
-3.108365	1.459519	3.943942
-3.131439	4.819928	3.951799
-3.307322	1.047541	3.953224
-3.313723	6.391702	3.952128
-3.389401	3.580539	3.947784
-3.433043	3.861159	3.943333
-3.741584	6.339306	3.956377
-1.431587	1.586508	3.950317
-1.421378	6.167774	3.968127
-1.508778	2.872333	3.961556
-1.682638	0.857242	3.978633
-1.946168	4.425911	3.977430
-2.519096	2.406497	3.955593
-2.591886	5.132982	3.959868
-2.752143	3.641224	3.951735
-2.857952	5.097128	3.966862
-3.142857	3.101048	3.961905
-3.325130	1.312597	3.961104
-3.327596	5.915385	3.957596
-3.336505	2.087849	3.962527
-3.401478	2.722435	3.962174
-3.713889	5.775926	3.957222
-3.859000	4.633364	3.959364
-4.059259	4.415231	3.960509
-4.061579	6.356118	3.955526
-1.138643	5.172362	3.970905
-1.146667	1.819677	3.970645
-1.168052	2.745233	3.976919
-1.179963	0.531355	3.974139
-1.438571	0.742294	3.976494
-1.897360	3.363360	3.974960
-1.918000	6.400000	3.944000
-1.969126	2.896764	3.974595
-2.166406	4.217266	3.971875
-2.394024	0.788293	3.963537
-2.478011	3.655580	3.970994
-2.580781	5.653906	3.963906
-2.612491	2.854684	3.972379
-3.203557	2.552420	3.975656
-3.370667	4.737333	3.975778
-4.075000	1.328276	3.963621
-1.229889	5.923667	3.993111
-1.460955	4.584777	3.986115
-1.531410	1.080865	3.989647
-1.679803	1.496908	3.984211
-1.815604	6.149780	3.975824
-2.690690	4.517816	3.977816
-3.072870	1.708148	3.978426
-3.177869	4.567951	3.982787
-3.320537	4.320289	3.976818
-3.480478	0.853072	3.993242
-3.654141	2.157071	3.976667
-3.668633	5.533381	3.978273
-3.708828	0.969609	3.982422
-3.795844	0.445325	3.971169
-4.034076	1.596902	3.988696
-4.060000	1.015278	3.973148
-4.050396	4.790990	3.975941
-1.149490	4.159796	3.985510
-1.163176	3.225203	3.989932
-1.158266	5.433988	3.992775
-1.522937	5.847619	3.991825
-1.923130	1.163652	3.984000
-1.936447	1.413553	3.983684
-1.953333	4.815167	3.983750
-2.555789	4.727594	3.984135
-2.863881	1.485224	3.993582
-3.226452	3.338548	3.975968
-3.272617	4.058505	3.990000
-3.662043	3.972787	4.005809
-3.737778	0.721667	3.971944
-1.480651	2.152055	4.008664
-1.493559	1.335254	3.994576
-1.528309	3.751654	4.008640
-2.003121	3.830709	3.998936
-2.171720	2.095161	3.994839
-2.618046	4.255977	3.996437
-3.209722	3.787639	3.997639
-3.642574	3.508713	3.993366
-3.668765	1.392469	3.997284
-4.014143	2.302929	3.996929
-1.174043	1.569787	4.000851
-1.195385	0.798077	4.011058
-1.552593	2.613992	4.016626
-1.889204	4.162301	4.014248
-2.025264	5.489421	4.020378
-2.149137	1.635268	4.020655
-2.225543	2.970870	4.016957
-2.519130	5.395489	4.016033
-2.749442	0.396000	4.017907
-3.272000	5.287905	4.009048
-3.656526	2.677371	4.018638
-3.971456	1.844175	4.006796
-1.562379	5.342103	4.022172
-2.137395	2.701261	4.015462
-2.422847	3.910569	4.025907
-3.077714	4.229486	4.025600
-3.133553	5.067237	4.014079
-3.624582	0.064558	4.035895
-3.644667	2.401778	4.018556
-3.973489	3.308006	4.026822
-4.021324	0.068971	4.008676
-1.172708	5.679583	4.024583
-1.232868	1.332574	4.037721
-1.635098	6.322451	4.046803
-1.883923	1.985414	4.030608
-3.054423	2.749038	4.020192
-3.261343	5.689627	4.034925
-3.596150	4.847914	4.033155
-3.607051	1.640000	4.034423
-3.620196	4.580833	4.030931
-3.972107	5.170868	4.033802
-3.998970	2.903273	4.028364
-1.211837	1.084490	4.030408
-1.485652	4.833370	4.034130
-1.578532	5.071147	4.051009
-1.629899	0.437475	4.044007
-1.961341	2.226951	4.035366
-2.115556	0.755556	4.032593
-2.622308	1.999038	4.033654
-3.547455	0.576818	4.051273
-3.631944	2.985000	4.044583
-3.663305	3.251674	4.052833
-4.003902	0.329512	4.028537
-1.184935	6.166623	4.036364
-1.258153	2.286908	4.058835
-1.557931	0.159770	4.038046
-1.956522	5.741739	4.044348
-2.046183	3.149167	4.060161
-2.071088	2.455026	4.058549
-2.179605	3.656974	4.046645
-2.284118	0.571000	4.056059
-2.301500	3.211583	4.045667
-2.519739	5.884870	4.047130
-2.977036	0.528458	4.058696
-2.998252	3.286699	4.042233
-3.008382	1.941156	4.055723
-3.042654	3.964691	4.048395
-3.151750	3.553000	4.043250
-3.241519	1.869494	4.046203
-3.424214	5.075000	4.052643
-3.983438	4.137500	4.047031
-3.983469	5.426735	4.044286
-1.235093	4.492500	4.061944
-1.251232	2.021667	4.059420
-1.268105	2.985333	4.072070
-1.540000	4.272745	4.045882
-1.596813	3.092637	4.050659
-1.639075	3.367746	4.068208
-1.669583	1.740556	4.048889
-2.351440	0.314647	4.068152
-2.375349	2.776395	4.059651
-2.573182	1.760455	4.048864
-2.895506	0.788892	4.071139
-3.012622	5.724085	4.059085
-3.150498	0.733817	4.070498
-3.581289	4.230028	4.064818
-3.924339	2.647845	4.075776
-3.974464	0.582679	4.055357
-1.274863	3.451096	4.075479
-1.671325	2.328400	4.080675
-1.736788	2.805907	4.064767
-1.755170	3.593333	4.065850
-1.800112	0.240615	4.068492
-1.968904	5.233151	4.066849
-2.174454	4.886639	4.075042
-2.199159	0.096726	4.077345
-2.199727	5.146909	4.069727
-2.426809	4.941712	4.070934
-2.772703	2.444919	4.077676
-3.155814	6.257519	4.067442
-3.175948	0.351046	4.081307
-3.954922	3.573047	4.065781
-1.293926	6.381846	4.088926
-2.088242	4.624424	4.079697
-2.116387	6.381849	4.077227
-2.166684	1.003211	4.079895
-2.457485	0.062695	4.086437
-2.758406	5.787943	4.094524
-2.820913	1.721142	4.086393
-2.922311	6.366642	4.086764
-2.990517	0.106034	4.072586
-3.123953	5.477945	4.086996
-3.546950	5.312293	4.088392
-3.546667	5.908404	4.080939
-3.612683	0.324146	4.066829
-3.915388	3.894828	4.085862
-3.912196	5.686627	4.087843
-1.306749	2.550000	4.098848
-2.157586	1.378793	4.081034
-2.576116	2.620083	4.086281
-2.694523	4.920492	4.096769
-2.748185	1.009963	4.101593
-2.957197	2.980071	4.099834
-3.270641	1.605385	4.088077
-3.371342	3.154204	4.127942
-3.938875	2.080375	4.086625
-1.283467	3.723467	4.095467
-1.605691	6.049675	4.101301
-1.664854	4.475437	4.093495
-1.698364	1.275636	4.093273
-2.172872	6.140745	4.094362
-2.191875	4.000313	4.093281
-2.269903	5.390388	4.103350
-2.326667	2.314063	4.094271
-2.358774	3.461806	4.101548
-2.376119	4.158209	4.086866
-2.408837	2.085116	4.100349
-2.456364	3.016606	4.103394
-2.781635	1.267788	4.095000
-3.157874	2.207874	4.097087
-3.564692	3.725000	4.103231
-3.870444	6.145444	4.114290
-3.926517	0.824494	4.094157
-1.311690	5.000352	4.114542
-1.344164	0.284947	4.115089
-1.553516	5.631641	4.111563
-1.650806	1.989032	4.095323
-1.828526	5.008237	4.119359
-2.109486	3.411200	4.112400
-2.281979	5.884599	4.111283
-2.342673	4.662508	4.116898
-2.417857	1.427857	4.112083
-2.489187	0.963902	4.112033
-2.623611	2.236389	4.100278
-2.652621	3.795931	4.106000
-2.697075	6.055975	4.120849
-2.813571	2.738661	4.119286
-2.820292	4.686642	4.106058
-2.853112	4.129751	4.111411
-2.906494	2.174113	4.113247
-2.925789	3.559211	4.100263
-2.949097	5.969375	4.103611
-2.995736	1.086822	4.104341
-3.213063	2.912523	4.112252
-3.386466	0.165414	4.109323
-3.519681	1.995745	4.108617
-3.894000	1.411590	4.112615
-3.918298	1.160426	4.103830
-1.280877	4.728596	4.108772
-1.299744	3.987179	4.116538
-1.325789	5.282782	4.130902
-1.732331	5.810339	4.129280
-1.773263	0.648178	4.122246
-1.780719	5.527964	4.118263
-2.229483	4.409138	4.111034
-2.310274	1.201918	4.117397
-2.387547	5.631863	4.129741
-2.411894	6.112727	4.121288
-2.492475	4.436568	4.128515
-2.645389	0.685171	4.128131
-2.653636	1.526783	4.126364
-2.720359	5.517545	4.122395
-2.769535	3.303372	4.116860
-2.928490	5.306615	4.119740
-2.979943	4.489716	4.120398
-3.363703	6.110167	4.131109
-1.586429	4.037857	4.126071
-1.704898	4.776871	4.132313
-2.252638	1.891656	4.125767
-2.357013	6.369497	4.132013
-2.960627	4.914269	4.138478
-3.461948	1.449351	4.137143
-3.486912	5.626324	4.133088
-3.510476	6.327429	4.120095
-3.855654	3.093145	4.137915
-3.873609	4.349112	4.126568
-1.322388	1.714478	4.127164
-1.321087	4.236739	4.136413
-1.365153	0.928282	4.138650
-1.732527	3.841648	4.138242
-1.770343	1.046514	4.147943
-1.804444	3.190667	4.140444
-2.590000	6.288678	4.135289
-2.630282	3.521567	4.153605
-2.681739	0.183370	4.134130
-2.705341	3.027045	4.134318
-3.121439	1.300758	4.140909
-3.422566	2.245044	4.141239
-3.456080	2.552049	4.152606
-3.833010	4.849465	4.149465
-3.839389	1.670229	4.150687
-1.327879	5.537879	4.147273
-1.410866	0.548656	4.161936
-1.765921	2.563026	4.143947
-2.287037	2.557037	4.138889
-2.374528	1.675283	4.138113
-2.434333	5.194833	4.154389
-2.550968	1.215161	4.144194
-2.597183	4.064225	4.142394
-3.472273	3.427348	4.153182
-1.809070	0.018023	4.166628
-1.888000	6.331497	4.180395
-2.685750	5.269250	4.160125
-3.442746	3.962977	4.174827
-3.546120	1.048770	4.167319
-3.786078	5.896667	4.151961
-1.360678	5.784153	4.167712
-1.381646	0.031013	4.161013
-1.418356	1.484612	4.180776
-2.759804	4.372255	4.162647
-2.896541	3.799248	4.169323
-3.003520	2.558715	4.174413
-3.429726	1.767260	4.161370
-3.448776	2.852653	4.164082
-3.835313	0.177604	4.161771
-1.386883	1.198182	4.170779
-1.399200	2.778933	4.176800
-1.905475	1.770380	4.187152
-1.930815	0.849741	4.185630
-2.516944	3.261389	4.187361
-3.037444	1.546457	4.178655
-3.300665	0.925831	4.190818
-3.448285	4.455793	4.185696
-3.832000	2.428909	4.176545
-1.378909	6.042636	4.184636
-1.757206	5.276520	4.190882
-1.863497	4.586993	4.192587
-2.563196	0.421753	4.182990
-3.336488	3.644080	4.195318
-3.760373	5.163593	4.200814
-3.780947	5.434579	4.190421
-3.781049	3.434012	4.195988
-3.796154	2.841692	4.184923
-1.833788	6.043652	4.204573
-1.902731	0.435419	4.201145
-1.913409	1.294091	4.200568
-2.062097	4.175645	4.186774
-2.136757	5.648649	4.193243
-2.364719	3.714607	4.197640
-2.947861	0.314975	4.205323
-3.351898	1.217810	4.195839
-3.397627	0.397966	4.191525
-3.398163	4.867959	4.186327
-3.761321	1.922000	4.205321
-3.778943	0.656179	4.203496
-3.792404	3.701827	4.197692
-3.793765	4.120353	4.197647
-1.442268	4.452862	4.212528
-1.447722	1.905886	4.210506
-1.463909	3.590453	4.220041
-1.564433	0.772296	4.227995
-1.937399	3.959641	4.212960
-1.993729	1.524068	4.198305
-2.002563	0.183266	4.219246
-2.142703	0.384865	4.204324
-2.361239	0.770642	4.212339
-2.799455	1.952228	4.209554
-3.220625	2.420188	4.211250
-3.224818	2.679909	4.206364
-3.265556	4.650427	4.218860
-3.308824	5.862353	4.198627
-3.357396	0.658958	4.206875
-3.370698	4.208372	4.204884
-3.752719	2.192120	4.214424
-1.446917	2.368417	4.215333
-1.456293	3.267854	4.219561
-1.793671	4.280058	4.227312
-1.800128	2.134231	4.229231
-1.878263	2.960297	4.224746
-1.890704	2.371972	4.215775
-1.945145	3.681503	4.212428
-2.050746	5.894030	4.226806
-3.201277	4.390851	4.207872
-3.219358	3.393850	4.229599
-3.304082	2.043469	4.206735
-3.731794	6.356500	4.223941
-3.781351	0.960811	4.213243
-1.746508	1.482937	4.238333
-1.884167	3.422583	4.227333
-1.981121	4.817375	4.244484
-2.039922	2.005273	4.246545
-2.109260	2.827577	4.243903
-2.593720	4.669795	4.235768
-2.600000	2.826092	4.227931
-3.191879	3.855030	4.235697
-3.189310	4.970345	4.225345
-3.341474	5.446421	4.220105
-3.584889	0.795778	4.222667
-3.778846	0.403462	4.214231
-1.457317	3.011463	4.231707
-1.461753	3.854639	4.236701
-3.153958	4.111042	4.240313
-3.302932	5.191152	4.243508
-1.983881	2.596866	4.241194
-2.039935	5.082810	4.252680
-2.124087	2.272198	4.255728
-2.138085	0.630372	4.254787
-2.146279	3.816977	4.246163
-3.092638	3.155337	4.255215
-3.176400	0.153000	4.256500
-3.644798	6.085253	4.259495
-3.705741	5.684136	4.248889
-3.727759	1.208448	4.239310
-1.473950	6.306807	4.252521
-1.523095	4.934000	4.266429
-2.032015	5.383460	4.270228
-2.038216	4.416865	4.266541
-2.220492	3.070758	4.264470
-3.156563	5.672500	4.256172
-3.287015	6.364259	4.268601
-3.688889	1.471242	4.260719
-1.524311	5.436347	4.270539
-1.547198	2.137857	4.270440
-1.549250	0.337500	4.265333
-1.547455	1.041909	4.270000
-1.570251	1.677538	4.273668
-1.595647	0.079483	4.279009
-1.905055	5.683956	4.277418
-2.232347	1.520102	4.276939
-2.486176	5.425588	4.275074
-2.592000	2.445444	4.270500
-2.941571	5.518846	4.278910
-2.951255	3.379176	4.278980
-3.216667	1.756092	4.268621
-3.626197	4.687508	4.284164
-3.683448	3.913966	4.266897
-3.688750	4.433611	4.265417
-3.702593	2.637593	4.265185
-1.508478	5.184348	4.273696
-1.549188	2.591015	4.279239
-3.046726	6.243673	4.288540
-3.055605	0.862803	4.282994
-3.078394	3.624599	4.290255
-1.532941	4.678971	4.281912
-1.548020	4.227228	4.287525
-1.554086	5.898710	4.290645
-1.565714	1.314643	4.287619
-2.265227	3.319773	4.280909
-2.285609	4.986346	4.300128
-2.465328	5.937810	4.282993
-2.937143	5.795866	4.302006
-2.986862	4.295372	4.306676
-3.032062	5.143093	4.282371
-3.582606	0.240394	4.305273
-3.606727	4.963200	4.299345
-3.676000	0.010000	4.280667
-1.978824	1.076824	4.293294
-2.119353	6.258557	4.304677
-2.152924	1.254503	4.302865
-2.246392	6.040619	4.299072
-2.439262	3.935403	4.310940
-2.480400	2.214467	4.301067
-2.779673	5.066667	4.296993
-2.923910	1.298269	4.316597
-2.962195	1.766765	4.316968
-2.997188	0.621875	4.300313
-3.039072	2.827629	4.298557
-3.080297	2.000396	4.294059
-3.128544	5.992492	4.311715
-3.251351	1.465946	4.293694
-3.609955	3.276532	4.304730
-3.667660	3.011702	4.286809
-1.650462	2.837370	4.320636
-2.039000	3.246429	4.305286
-2.140220	1.762802	4.315165
-2.160449	0.895000	4.313596
-2.188302	3.567170	4.318459
-2.180685	4.617808	4.307397
-2.240736	0.192393	4.312577
-2.369253	2.865000	4.314770
-2.479015	4.209562	4.312956
-2.501304	0.212372	4.314032
-2.563879	1.968318	4.315935
-2.686416	1.743410	4.314393
-2.764310	0.509914	4.317586
-2.801656	6.326225	4.312715
-2.928379	0.066421	4.320926
-3.030959	4.724110	4.296986
-3.041673	2.266809	4.319377
-3.147817	1.112792	4.310558
-3.578505	0.533737	4.317153
-3.631702	1.714787	4.301277
-3.624300	2.411200	4.304300
-1.644769	3.426690	4.325587
-2.237667	4.286000	4.310667
-2.249333	5.252417	4.319583
-2.368828	1.049375	4.327930
-2.495314	1.561882	4.329446
-2.562570	4.922793	4.324022
-2.629231	0.010000	4.308462
-2.658502	1.353913	4.319855
-2.741253	2.191798	4.328392
-2.791610	0.785381	4.324831
-2.818996	3.611528	4.323668
-2.840078	3.136039	4.326824
-2.868145	6.060806	4.316290
-3.181016	0.456203	4.322246
-1.658316	3.122105	4.336316
-1.665974	0.552403	4.333442
-1.688981	1.913719	4.340413
-2.303750	2.034259	4.334815
-2.332584	2.411461	4.327753
-2.349630	0.412963	4.314444
-2.702955	3.929167	4.326667
-2.805439	4.805088	4.331930
-2.830843	1.538795	4.324337
-2.855169	4.551356	4.332203
-2.877704	1.035111	4.329037
-2.958047	3.990118	4.332189
-3.137547	5.362642	4.324717
-3.521488	5.847741	4.340854
-3.569650	5.486434	4.331049
-3.604706	3.559412	4.319412
-3.596800	4.215467	4.322933
-1.658459	5.650824	4.343262
-1.638000	6.137226	4.341290
-1.672864	4.486667	4.348967
-2.203143	4.038000	4.327429
-2.253889	5.498889	4.334259
-2.449405	3.471071	4.343571
-2.502727	0.595657	4.361145
-2.535307	5.690000	4.346842
-2.567725	3.052515	4.340299
-2.576524	3.703777	4.347253
-2.697931	5.885172	4.329310
-2.741420	4.193977	4.341761
-2.851932	2.431364	4.335909
-3.537655	5.226966	4.345241
-1.646709	3.728101	4.341392
-2.264980	5.790648	4.358178
-2.377500	0.010000	4.327500
-2.399076	1.312554	4.356304
-2.389434	1.789434	4.345472
-2.606494	6.134945	4.357860
-2.633235	1.086765	4.335000
-2.693206	3.364667	4.363714
-2.726962	2.642405	4.345443
-3.552063	1.941429	4.345397
-1.662475	3.979208	4.352277
-1.695789	2.329035	4.357281
-1.721842	5.092829	4.371382
-2.372953	6.246062	4.360259
-2.382881	4.476017	4.363898
-2.627625	4.442375	4.354625
-2.755682	0.254545	4.353409
-2.803288	2.876301	4.356027
-2.832128	5.303830	4.352979
-3.240448	2.963632	4.358969
-3.490905	3.782387	4.368107
-3.529189	1.289595	4.356486
-3.522604	6.357988	4.357337
-3.542258	2.186452	4.352581
-1.679832	6.383613	4.364454
-1.744808	0.913333	4.367821
-1.762068	1.183346	4.375677
-2.381563	4.749792	4.361875
-2.490851	2.654468	4.362340
-2.545410	0.863934	4.369262
-2.572941	6.385765	4.361059
-2.572308	5.194835	4.373242
-3.506667	2.733548	4.364301
-1.740659	4.811923	4.385714
-2.709459	5.513378	4.369730
-1.766395	0.330349	4.383256
-1.785546	2.573843	4.393100
-1.869191	0.694220	4.391156
-2.250000	2.643855	4.384880
-3.302930	2.251245	4.400330
-3.414346	1.067991	4.399393
-3.413360	6.092400	4.399040
-3.476889	1.529444	4.382333
-1.780150	5.878100	4.403150
-1.839664	0.086765	4.402437
-3.366831	5.626541	4.411715
-3.387686	2.509628	4.411529
-3.418191	0.805106	4.401702
-3.461188	3.092772	4.391287
-1.753871	5.407903	4.404516
-1.790130	1.676364	4.399870
-3.372039	0.088092	4.412895
-3.422033	3.420440	4.405659
-1.832656	3.578984	4.420078
-1.869385	4.101423	4.429231
-3.417193	4.560000	4.413158
-3.422449	4.800612	4.410612
-3.420000	4.073171	4.410976
-1.835120	3.283600	4.426720
-1.854615	3.835804	4.430490
-2.985375	2.620625	4.420500
-3.402115	4.316154	4.420000
-3.396567	5.046269	4.422687
-3.411875	1.763333	4.415417
-1.888414	2.816414	4.439379
-1.921985	6.370773	4.454072
-1.942976	1.352390	4.447024
-2.421905	3.221429	4.430000
-3.267258	3.224839	4.427903
-3.381739	0.334348	4.422609
-1.874386	4.610175	4.446053
-1.895455	6.102216	4.451591
-1.929106	1.872846	4.450244
-2.031634	0.500113	4.465380
-3.285890	3.633252	4.453804
-3.339167	1.993000	4.443167
-3.336800	5.342000	4.445400
-3.357778	0.573056	4.435556
-1.881967	4.357705	4.450984
-1.927667	5.234667	4.459778
-1.941207	4.969310	4.462299
-1.943193	2.361849	4.458739
-1.946067	3.064719	4.449888
-2.281107	3.778730	4.464139
-3.202211	4.889158	4.469579
-3.222500	2.714812	4.468925
-3.276398	1.279814	4.458882
-1.911379	2.111379	4.455517
-1.956587	5.523571	4.473571
-2.021105	5.799830	4.480397
-2.016705	1.605549	4.475780
-2.955467	4.987378	4.470178
-3.297115	5.873654	4.459615
-1.968889	0.906481	4.470556
-2.041504	0.232481	4.475564
-2.030139	3.425486	4.484167
-3.167750	4.372083	4.478500
-3.182201	5.152327	4.488239
-3.202281	6.209298	4.483333
-3.211528	0.930833	4.478750
-3.288889	3.885000	4.465278
-2.023051	2.607712	4.486102
-2.085117	4.752368	4.498889
-2.162039	5.105137	4.514118
-2.188956	0.027071	4.501650
-3.137778	2.434192	4.498485
-3.164298	0.261818	4.490083
-3.178559	4.106695	4.490508
-3.193238	4.630286	4.487714
-3.222206	1.627059	4.479853
-2.112585	4.194153	4.506356
-2.388241	6.031667	4.507454
-3.110000	0.017125	4.501000
-3.133874	1.860270	4.500450
-3.146815	3.428000	4.500444
-3.150125	0.681375	4.496250
-2.043220	3.683559	4.499322
-2.078488	3.928256	4.506163
-2.080877	1.126491	4.502105
-2.143235	2.845252	4.511807
-2.142185	0.737059	4.510000
-2.162036	3.174253	4.515701
-2.195234	1.414299	4.517196
-2.420727	5.516000	4.502909
-3.092024	5.753988	4.513988
-2.083636	4.481091	4.509818
-2.129890	6.037403	4.519945
-2.136481	2.158333	4.517222
-2.147413	5.365035	4.521608
-2.171013	1.912278	4.520253
-2.517957	0.374946	4.532177
-2.611892	2.870579	4.528996
-2.639500	2.342538	4.529577
-2.965216	6.326264	4.529954
-3.017746	0.466879	4.518786
-3.054196	3.141538	4.521748
-3.087407	1.429012	4.517407
-3.125645	2.122581	4.510000
-2.182571	2.419524	4.527810
-2.261818	1.677219	4.531604
-2.284662	3.413818	4.537534
-2.299140	0.529892	4.534140
-2.368175	3.002000	4.546975
-2.898807	3.353263	4.541649
-2.928312	4.164262	4.540295
-2.974531	3.611563	4.533281
-2.984802	5.996980	4.534109
-3.035253	1.178687	4.525758
-3.055048	3.859429	4.526857
-3.099677	5.502903	4.517742
-2.201294	6.287824	4.538647
-2.201583	5.622734	4.538705
-2.387429	2.229968	4.546286
-2.384335	5.253536	4.550875
-2.450701	0.081274	4.545796
-2.657893	2.056588	4.556825
-2.673548	1.546828	4.540538
-2.763293	5.149102	4.553802
-2.802667	3.819304	4.549739
-2.887919	2.252483	4.546309
-2.906238	0.700693	4.542772
-2.928047	1.623395	4.540744
-2.914365	1.994444	4.544683
-2.962179	4.728974	4.541859
-3.044590	2.888197	4.530984
-2.280435	0.271957	4.538913
-2.294800	0.918600	4.542200
-2.301515	4.893788	4.551667
-2.312439	1.174878	4.547073
-2.309103	4.029655	4.550828
-2.726194	4.601754	4.558694
-2.725085	4.331017	4.563941
-2.774916	1.125028	4.553911
-2.844211	5.784737	4.541228
-2.941930	4.460526	4.547018
-2.967167	0.940333	4.540500
-2.979506	5.288395	4.543951
-2.291538	4.609385	4.556769
-2.456503	3.606713	4.563497
-2.515185	1.033426	4.557130
-2.511747	3.871710	4.564758
-2.524069	5.024372	4.568009
-2.575205	1.286712	4.559110
-2.623849	5.376653	4.566318
-2.613053	5.920929	4.567212
-2.669851	0.613806	4.562612
-2.685503	4.064550	4.566720
-2.712057	0.869220	4.561986
-2.715388	3.560728	4.563107
-2.717687	6.388582	4.564104
-2.746135	1.800491	4.560245
-2.738658	4.873087	4.567517
-2.769551	6.130843	4.562978
-2.781688	0.388831	4.558831
-2.833500	3.021857	4.559286
-2.835000	2.745700	4.561000
-2.867373	5.508814	4.558559
-2.935610	0.197561	4.545122
-2.286970	4.363636	4.558182
-2.410946	1.958784	4.560405
-2.410723	5.755904	4.566145
-2.408519	2.482593	4.561111
-2.430769	1.498205	4.565385
-2.454750	0.745000	4.564750
-2.476559	4.215484	4.570753
-2.509652	4.752609	4.570870
-2.621308	2.607196	4.570280
-2.648615	5.639692	4.572615
-2.698732	0.138310	4.561972
-2.851094	1.366250	4.559688
-2.393023	2.731163	4.565581
-2.503182	1.733030	4.570000
-2.523095	6.235595	4.577262
-2.551757	3.370135	4.575676
-2.614267	3.130667	4.572133
-2.845000	2.492000	4.567000
-2.509355	4.466290	4.579032
-3.527562	3.019352	0.627099
+2.397382	1.487592	0.417539
+2.368312	0.792199	0.414552
+2.404938	2.334875	0.417688
+2.408864	2.601136	0.404545
+2.452162	1.733784	0.398378
+2.472830	1.032642	0.402264
+2.468872	3.203534	0.411805
+2.490606	0.355152	0.398030
+2.500741	2.847513	0.410899
+2.501491	3.461930	0.407456
+2.500772	4.533719	0.422211
+2.531121	0.099776	0.408834
+2.558878	2.130816	0.400204
+2.620484	3.703871	0.402419
+2.614297	4.973498	0.416388
+2.644836	0.817089	0.406291
+2.635581	1.892093	0.398605
+2.677556	1.652444	0.397556
+2.669632	3.966691	0.414338
+2.683929	4.230982	0.409732
+2.728095	3.262286	0.423016
+2.753871	2.333710	0.405806
+2.750204	2.847755	0.402449
+2.777037	1.429630	0.408025
+2.798280	1.170376	0.417204
+2.312500	1.244167	0.411111
+2.366619	3.733986	0.428577
+2.363713	4.770099	0.427030
+2.408919	3.997405	0.428757
+2.491375	6.236543	0.430558
+2.589587	5.468347	0.425744
+2.608462	6.005923	0.420077
+2.637723	5.740660	0.427030
+2.664545	2.572893	0.415289
+2.690426	4.716170	0.410213
+2.780526	0.172632	0.401579
+2.783232	3.521717	0.414343
+2.810497	2.085580	0.424530
+2.819956	0.425200	0.421333
+2.819569	4.457682	0.438086
+2.875584	0.925455	0.419610
+2.877581	1.836613	0.423629
+2.265437	0.469612	0.424563
+2.259412	3.500980	0.424902
+2.288827	0.202793	0.432346
+2.302544	3.008402	0.430059
+2.356620	5.347183	0.421549
+2.368495	5.600430	0.424516
+2.375093	5.864472	0.428385
+2.432959	4.265867	0.430612
+2.563371	1.290400	0.426457
+2.602632	0.558421	0.415789
+2.740566	6.211321	0.420189
+2.829774	5.125338	0.431955
+2.838870	5.382435	0.429739
+2.865577	3.788462	0.439872
+2.847897	5.915187	0.440374
+2.898192	3.055346	0.439769
+2.216304	1.783152	0.435652
+2.221633	2.760476	0.439932
+2.223838	3.253838	0.437576
+2.250484	4.436290	0.429677
+2.258552	6.356552	0.438069
+2.916866	4.065791	0.447194
+2.928049	2.513049	0.436402
+2.940404	4.720594	0.456318
+2.975446	0.030792	0.433267
+2.969467	1.592311	0.446756
+2.144865	1.535811	0.449392
+2.156744	2.021163	0.442558
+2.156667	2.267901	0.445185
+2.171579	1.063509	0.437193
+2.166571	4.189810	0.458810
+2.274286	6.090571	0.440714
+2.369961	5.077266	0.455352
+2.385510	1.964898	0.432857
+2.858182	0.678939	0.442879
+2.971250	3.340000	0.438750
+3.004615	1.326731	0.444615
+3.000741	2.265926	0.441296
+3.042338	0.280260	0.452403
+2.094858	0.035330	0.467264
+2.132318	4.651060	0.462185
+2.142250	5.478550	0.466050
+2.161797	3.918125	0.455859
+2.145514	4.923730	0.474622
+2.148750	5.214632	0.460147
+2.195714	2.506786	0.443214
+2.941860	6.391395	0.446977
+2.974000	6.154833	0.451167
+3.055106	0.528723	0.445106
+3.058617	2.027766	0.457766
+3.081667	1.067250	0.460333
+2.063247	0.837273	0.473961
+2.092911	3.675443	0.462532
+3.048129	4.291367	0.465396
+3.094164	0.790214	0.473523
+3.061724	5.223448	0.463448
+3.056184	5.756579	0.467895
+2.057681	0.324525	0.483042
+2.045430	1.293333	0.479194
+2.045737	2.946526	0.479158
+3.079532	5.489169	0.491065
+3.134628	2.888512	0.480992
+3.128677	3.869613	0.492581
+3.152727	1.765818	0.473273
+2.025338	3.420912	0.495304
+2.006329	4.409306	0.504913
+2.036471	6.218431	0.481765
+2.057520	5.966545	0.494797
+2.167024	5.732976	0.489167
+3.130435	4.535217	0.484493
+3.143043	2.634348	0.473478
+3.159627	3.167801	0.492116
+1.969557	1.845897	0.512681
+1.978909	0.585527	0.508655
+1.986923	2.689615	0.482308
+3.154933	6.001600	0.499933
+3.226455	0.106636	0.502455
+1.936972	1.054404	0.508532
+1.932615	2.168769	0.506000
+1.962500	2.444196	0.512768
+2.852981	5.625481	0.504904
+3.215521	2.400097	0.521671
+3.209871	4.781484	0.511806
+3.218000	3.433500	0.505750
+3.216122	4.110204	0.500204
+1.918834	3.856632	0.534275
+1.918261	1.586087	0.504348
+1.929562	5.083577	0.526350
+1.934507	5.338169	0.511831
+3.030447	4.983610	0.530000
+2.612966	5.216525	0.531949
+3.242780	1.275415	0.540361
+3.314545	1.517576	0.523939
+1.873882	0.138118	0.530235
+1.905200	4.762945	0.545200
+1.923365	5.594952	0.546346
+2.643443	3.031721	0.542787
+3.010687	3.587694	0.553548
+3.297042	3.669437	0.530282
+3.293654	4.351346	0.529038
+3.295675	5.044810	0.548927
+3.291660	5.332648	0.545929
+3.289350	5.657870	0.552599
+3.337926	0.339407	0.535407
+1.850217	3.090290	0.545290
+1.844217	5.836627	0.546988
+2.929859	2.756268	0.541761
+2.944545	3.086364	0.571364
+3.348621	0.782759	0.532414
+3.345065	2.166623	0.540909
+3.371015	1.038609	0.557594
+1.814949	0.388788	0.556465
+1.812745	1.256863	0.548039
+1.816522	2.840435	0.547391
+1.818585	3.604906	0.553491
+1.825911	4.121921	0.567340
+1.828148	0.835556	0.546481
+1.831011	6.089787	0.562926
+3.382353	1.753382	0.547941
+3.368929	4.582321	0.556071
+1.778737	4.525051	0.577929
+1.796909	6.365164	0.573091
+3.363967	6.160516	0.584321
+3.379647	3.914706	0.564000
+1.767957	2.000215	0.570860
+1.753034	2.605655	0.586414
+1.769918	3.343607	0.589536
+2.227092	0.668723	0.587943
+2.603869	1.503065	0.580352
+2.651250	1.001705	0.577614
+3.131751	6.325036	0.591823
+3.367500	5.897833	0.567167
+1.737204	1.734194	0.585806
+1.728414	2.337252	0.609207
+2.333005	2.151913	0.587432
+2.593492	2.401270	0.574921
+3.454105	2.508158	0.592842
+3.444286	4.162381	0.593401
+1.720179	1.479107	0.599524
+1.723238	4.936238	0.603238
+1.724337	5.434217	0.596747
+1.732581	0.618065	0.579032
+2.322714	0.020714	0.597714
+2.545033	3.848301	0.600458
+2.598500	0.265500	0.598375
+3.245395	1.952500	0.594211
+3.340714	2.715000	0.579286
+3.369130	6.396087	0.583913
+3.460809	3.489223	0.615469
+3.477054	0.140536	0.591339
+3.486379	0.603966	0.590000
+3.484865	1.971757	0.596892
+3.490536	1.330357	0.596964
+1.704972	1.040608	0.610442
+2.438477	0.507531	0.615103
+2.538158	4.723947	0.610197
+2.589894	4.377447	0.608511
+3.237879	0.587677	0.603838
+2.265368	1.378896	0.628067
+2.326066	1.646256	0.622701
+2.519722	1.812917	0.617639
+2.744512	1.927439	0.623963
+2.758642	0.061204	0.626296
+2.791951	1.679024	0.607073
+3.489624	5.489286	0.629023
+1.651161	4.308968	0.633935
+1.670833	5.676019	0.623889
+2.076077	3.182488	0.631675
+2.324197	4.569663	0.641580
+2.448690	1.151508	0.636111
+2.462908	6.001454	0.641684
+2.576327	3.291927	0.642218
+2.818669	6.096730	0.638403
+2.861266	2.353418	0.621899
+3.103488	1.480233	0.623605
+3.498596	5.195000	0.624561
+3.535577	1.580769	0.622115
+1.643774	0.225849	0.635094
+1.632230	2.987311	0.648918
+1.633757	5.196618	0.654538
+1.673731	3.804231	0.641154
+2.306959	2.417872	0.650372
+2.321044	3.387071	0.650135
+2.348478	4.144042	0.655643
+2.480896	5.739254	0.629701
+2.488994	0.820828	0.637515
+2.526848	3.567994	0.648854
+2.658209	6.280000	0.635970
+2.679266	2.178807	0.637982
+2.701818	2.794034	0.645966
+2.798589	4.234896	0.640290
+2.812050	3.416584	0.643043
+2.890765	1.048412	0.644824
+2.950000	3.040000	0.610000
+3.439524	4.813061	0.635374
+3.537865	3.738989	0.638315
+3.550663	0.866188	0.646906
+1.634384	5.934155	0.654292
+1.621625	6.201875	0.647625
+2.259130	3.634565	0.638696
+2.279091	1.907172	0.646768
+2.483165	2.612615	0.651927
+2.701071	1.248049	0.660769
+2.689926	5.880370	0.650815
+2.705106	0.497690	0.661489
+2.743851	0.777905	0.649730
+2.762778	4.604747	0.657424
+3.002613	1.862484	0.655871
+3.590247	0.387407	0.653765
+1.602545	1.265636	0.650364
+1.596048	3.544948	0.670447
+1.614746	4.711695	0.648983
+2.158065	2.643706	0.671853
+2.292331	5.574942	0.675315
+2.304000	3.869143	0.651143
+2.337895	3.117953	0.663450
+2.348532	4.893257	0.658807
+2.441409	5.354228	0.656644
+2.457704	2.882185	0.665333
+2.738983	5.419322	0.649831
+2.833563	4.860063	0.657250
+2.956210	2.968629	0.684435
+2.967804	4.436682	0.663318
+2.984370	5.906296	0.655037
+3.559372	2.208010	0.660471
+3.562955	5.792386	0.655568
+3.604661	1.123898	0.657542
+1.576404	4.068090	0.667978
+2.065062	2.033765	0.675741
+2.071416	4.043382	0.679075
+2.176311	6.350299	0.676013
+2.762201	3.713491	0.680252
+2.968413	0.645329	0.676617
+3.012778	0.133611	0.653889
+3.033940	2.537616	0.682848
+3.572809	6.316340	0.672723
+3.592857	4.620893	0.660893
+1.559213	0.475354	0.682677
+1.555547	0.748984	0.683672
+1.563000	1.879714	0.677571
+1.569689	2.137358	0.676684
+1.557460	2.729206	0.682222
+2.197280	2.908640	0.676000
+2.207910	6.061721	0.693238
+2.269611	0.946833	0.678389
+2.357645	0.259504	0.684545
+2.420127	6.254051	0.673291
+2.633662	5.012817	0.682629
+2.861502	5.178115	0.690990
+2.918478	2.112536	0.677681
+3.020902	3.278443	0.685984
+3.608667	3.989714	0.674476
+2.074688	2.294531	0.676563
+2.112326	1.160066	0.697841
+3.035946	5.656284	0.699527
+3.071687	0.387055	0.701963
+3.126940	5.192672	0.700043
+3.615870	4.983804	0.682391
+3.615655	6.046773	0.702843
+2.020390	3.669894	0.710496
+2.090877	1.557544	0.683860
+2.098194	0.179226	0.711387
+2.131899	4.748354	0.702658
+2.168091	0.433727	0.696273
+2.729212	3.980242	0.704545
+2.910952	6.396190	0.685238
+3.149504	4.244771	0.710458
+3.669000	2.437100	0.696400
+1.515508	2.456017	0.708559
+1.512258	5.511505	0.705699
+2.166268	5.266197	0.709014
+2.795035	3.161678	0.712448
+2.974080	4.058000	0.703120
+3.001826	1.270609	0.702435
+3.161604	1.084528	0.703396
+3.160127	2.172278	0.700000
+3.196029	3.030588	0.695735
+3.455374	4.407357	0.714361
+3.662241	4.262586	0.704741
+3.678974	1.781496	0.707863
+3.663786	3.310214	0.714643
+3.697296	0.664025	0.715597
+1.499756	3.242033	0.724350
+1.506481	4.499568	0.716358
+1.493799	4.973436	0.735307
+2.005123	0.905215	0.727362
+3.007302	3.800476	0.711111
+3.148400	2.783300	0.722600
+1.478393	1.002917	0.735417
+1.496667	1.485145	0.724565
+1.501742	6.389318	0.731136
+1.933623	1.371739	0.724493
+1.962326	4.279457	0.727442
+2.127321	5.007143	0.725089
+2.504146	2.023902	0.720732
+2.734013	2.545405	0.737864
+3.234436	1.664812	0.721278
+3.690556	3.560000	0.713611
+3.728997	0.185350	0.745380
+2.085038	4.496241	0.741729
+2.782862	5.656325	0.749399
+2.835618	0.285843	0.732697
+2.997536	4.684058	0.727246
+3.140611	6.086889	0.740611
+3.147182	0.826364	0.735273
+3.209386	4.514910	0.749675
+3.219636	3.986545	0.746727
+3.225019	5.491407	0.749011
+3.703736	5.610220	0.739011
+3.738947	1.494842	0.738632
+1.905000	0.011429	0.742143
+1.904796	5.291403	0.758100
+2.081667	3.412667	0.750667
+2.795053	1.484526	0.744000
+3.232353	0.188067	0.747059
+3.322683	1.427642	0.751951
+3.350551	2.319291	0.748425
+3.711596	5.226702	0.740000
+1.442583	3.743432	0.763100
+1.426824	4.257882	0.759294
+1.430851	5.808617	0.763298
+1.444762	6.077302	0.748571
+1.840419	2.143263	0.770210
+1.955492	5.879590	0.762705
+1.986272	6.176805	0.759882
+2.368182	5.130545	0.745455
+3.177489	3.459910	0.762960
+3.752035	3.803451	0.760619
+1.432299	0.271839	0.758851
+1.851186	0.237119	0.757627
+1.932055	0.469589	0.760137
+2.486620	1.367512	0.779390
+2.956429	5.419571	0.774429
+3.223431	4.790962	0.775816
+3.234353	3.723882	0.768588
+3.285859	2.574978	0.780661
+3.391176	1.184118	0.762941
+3.408194	3.053965	0.795507
+3.777143	0.920000	0.770286
+1.404593	2.972185	0.789444
+1.406768	4.725253	0.773434
+1.412171	5.260465	0.774961
+1.822931	4.681034	0.765690
+1.836053	1.868947	0.766579
+1.849159	0.705421	0.777290
+1.860621	1.616158	0.789209
+1.921852	2.600926	0.770185
+1.953125	6.397500	0.764375
+2.076073	1.796164	0.781826
+2.203869	5.809311	0.792066
+2.989551	1.631910	0.777865
+3.758429	4.754031	0.781047
+3.784390	2.231220	0.765122
+1.389431	1.249701	0.804251
+1.389762	1.734762	0.780476
+1.852257	2.850817	0.793035
+1.849811	5.538679	0.778868
+2.476749	0.052792	0.797138
+2.506463	2.266463	0.785122
+2.535452	5.552776	0.798194
+2.585108	4.191477	0.794554
+3.028158	4.963474	0.794263
+3.316235	0.435608	0.800314
+3.368723	0.699734	0.789681
+3.362439	2.064024	0.790610
+3.377851	5.004050	0.791240
+3.786757	2.847568	0.786216
+3.809590	0.439147	0.800341
+3.811440	1.186070	0.799728
+1.380195	2.258878	0.803366
+1.375563	3.466406	0.813000
+1.375208	1.987292	0.801875
+1.734930	3.178944	0.795634
+1.866233	1.137860	0.801349
+2.077397	5.481233	0.790000
+2.555560	1.630474	0.803319
+2.629226	5.252440	0.808542
+2.907613	2.741757	0.803964
+3.173286	5.840143	0.795143
+3.377489	5.698018	0.799780
+3.374660	5.999796	0.809048
+3.777983	5.866481	0.799313
+3.803864	4.073977	0.808750
+1.371229	4.010000	0.817973
+1.871671	3.861671	0.825633
+2.091046	0.659346	0.813007
+2.388529	4.367157	0.808922
+2.544516	0.647097	0.802419
+3.323380	6.306852	0.809630
+3.350526	5.261316	0.803684
+3.435177	1.800851	0.822979
+3.770916	6.232977	0.811527
+3.816222	3.103889	0.797222
+1.794958	5.065714	0.816387
+1.839585	3.474473	0.824984
+2.329545	0.741970	0.813485
+2.403438	3.724063	0.813750
+2.536557	3.081639	0.809344
+2.561082	4.564131	0.822754
+2.908693	0.863660	0.825229
+2.943148	3.586296	0.808889
+3.010943	2.320000	0.819057
+3.348889	0.951556	0.810889
+3.471038	0.236415	0.817642
+3.601707	2.000610	0.813171
+1.611400	1.677600	0.823800
+1.774286	4.110000	0.828869
+2.650233	4.804884	0.814884
+2.710141	1.034930	0.819014
+3.193696	1.892174	0.825761
+3.396579	3.332105	0.824737
+3.593151	1.313836	0.823973
+3.857794	1.988578	0.837990
+1.340148	0.490815	0.833852
+1.674087	5.383652	0.834087
+1.680149	0.067139	0.856219
+1.709560	1.397170	0.842327
+1.727326	6.336028	0.852009
+1.721634	0.921206	0.850428
+1.952759	4.875241	0.839103
+2.040645	3.022258	0.828925
+2.299583	2.060625	0.837708
+2.563333	0.351026	0.835449
+2.573607	6.145689	0.849208
+2.779414	4.403555	0.845391
+3.715385	2.627179	0.827436
+3.835978	5.421285	0.837933
+3.871071	2.445893	0.830536
+1.312034	5.530339	0.846356
+1.330120	0.053593	0.843952
+1.309809	2.524306	0.868565
+1.683378	2.599392	0.848986
+1.745817	5.753983	0.866361
+1.777284	6.041802	0.862741
+2.160153	3.857691	0.865294
+2.176571	4.218476	0.853714
+2.433579	3.974632	0.848211
+2.525333	6.392889	0.842222
+2.654748	3.441978	0.854676
+2.744180	2.941719	0.859688
+2.753918	2.295448	0.861493
+2.803908	6.258621	0.842759
+3.069479	6.320274	0.856192
+3.383600	2.793600	0.836000
+3.435035	4.647588	0.862084
+3.447405	3.606997	0.862624
+3.490390	4.128485	0.853030
+3.801609	5.013166	0.863958
+3.861077	4.320615	0.836308
+1.296452	4.491290	0.850484
+1.299860	6.307378	0.869755
+1.739548	4.398404	0.866506
+1.820364	2.390727	0.846545
+2.143789	1.369158	0.869158
+2.203188	3.227536	0.864855
+2.316842	1.180351	0.848421
+2.379250	1.824600	0.870000
+2.445319	3.295319	0.853404
+2.460857	0.950429	0.858429
+2.533789	5.812484	0.860248
+2.847848	1.960000	0.855696
+2.920777	0.050971	0.855243
+3.476173	3.863086	0.858272
+3.562095	5.394775	0.870133
+3.662546	4.487056	0.868488
+3.895920	1.723731	0.864925
+3.885516	3.349008	0.869405
+3.906026	0.689423	0.873429
+1.293172	1.526621	0.866276
+1.281688	3.230130	0.863636
+1.285058	5.057965	0.873256
+1.610789	3.921842	0.861579
+1.662078	0.334416	0.867662
+2.208000	3.591231	0.867385
+2.320694	1.550417	0.862083
+2.352879	0.491629	0.876402
+2.563237	2.743734	0.873817
+2.623462	1.873077	0.860577
+3.510606	1.536364	0.861818
+1.621017	1.161864	0.868305
+1.656279	1.985581	0.875349
+1.685665	3.674162	0.886069
+2.064332	2.429170	0.887148
+2.302759	5.397085	0.888621
+2.427705	2.495738	0.867049
+2.700635	0.150000	0.877460
+2.937527	5.810430	0.879247
+3.138703	0.616444	0.885649
+3.177879	3.224545	0.874444
+3.507094	2.474926	0.882118
+1.264448	0.979178	0.905042
+1.641003	0.599027	0.903186
+1.958750	3.250500	0.875500
+2.284030	2.305970	0.879104
+2.737640	5.954944	0.884719
+2.828667	4.147000	0.882000
+3.547773	0.535547	0.896761
+3.887363	3.622239	0.891294
+3.909011	4.569780	0.884066
+3.940263	1.468684	0.890526
+1.253410	6.032605	0.907241
+1.625374	2.241905	0.911871
+1.622440	4.635833	0.903333
+2.078704	2.168889	0.891481
+2.320027	2.874521	0.902986
+2.358804	5.992919	0.904976
+2.417100	4.796283	0.907063
+2.774314	5.044216	0.895196
+2.901889	3.355056	0.898611
+3.000382	1.095038	0.890916
+3.532148	6.196242	0.901611
+3.568757	1.035444	0.898757
+3.915479	5.668537	0.911755
+3.916205	6.058554	0.902590
+3.943674	0.168295	0.906023
+1.245827	0.711575	0.906299
+1.633989	2.975426	0.913936
+1.998702	5.681985	0.906489
+2.249545	4.605227	0.899886
+2.344211	6.250752	0.905338
+2.520085	5.037627	0.909576
+2.629735	3.707743	0.917168
+2.796157	0.483843	0.911065
+2.852662	3.842230	0.909281
+2.965039	3.091836	0.920664
+2.975780	1.418688	0.917589
+3.199946	1.266965	0.922195
+3.569256	4.878837	0.912140
+3.558571	5.131224	0.902653
+3.942876	3.881046	0.912222
+3.955171	2.686844	0.921217
+1.235251	3.672040	0.926488
+1.223385	4.813231	0.913692
+1.222681	5.767101	0.924275
+1.467032	2.747385	0.926042
+1.484718	0.822077	0.926232
+1.579177	5.140823	0.925127
+2.101038	6.019937	0.930692
+2.746882	5.460000	0.921118
+2.790596	1.666358	0.924503
+2.960647	6.077314	0.937627
+3.058412	2.082575	0.926223
+3.139735	5.320596	0.923576
+3.194096	2.945000	0.927711
+3.599104	2.952939	0.932616
+3.926241	6.387092	0.921135
+3.969286	1.005000	0.906429
+3.968000	2.232333	0.916500
+1.223284	0.286418	0.920448
+1.216129	2.753226	0.915806
+1.219004	5.307229	0.933939
+1.517917	5.647188	0.926979
+1.604080	3.430800	0.932800
+2.000000	4.640552	0.935521
+2.062077	0.040831	0.932971
+2.120691	6.368351	0.923298
+2.669925	0.813284	0.930672
+2.859073	4.746537	0.928683
+3.009104	4.522127	0.931642
+3.522596	2.210894	0.936255
+3.952545	5.216545	0.919636
+2.102935	0.413478	0.947754
+2.160833	2.668854	0.933646
+2.197617	0.917584	0.945336
+2.295225	0.241892	0.935225
+2.340513	5.653718	0.933974
+2.898299	2.515910	0.949433
+3.136286	5.645143	0.939657
+3.248462	4.161026	0.937179
+3.633443	0.782350	0.941366
+3.665512	3.475354	0.943780
+3.966357	4.817214	0.933786
+1.203127	1.761273	0.950873
+1.197041	2.108136	0.959675
+1.198472	3.008908	0.953450
+1.554718	4.157534	0.965147
+1.561045	5.920000	0.938955
+2.081849	5.252798	0.958491
+2.709218	3.189609	0.956034
+2.794648	1.230000	0.958592
+3.029576	4.016186	0.944576
+3.073704	3.737593	0.947963
+3.347132	4.410441	0.951838
+3.582606	5.926649	0.948670
+3.591888	3.224847	0.951480
+3.587091	5.654390	0.965896
+1.177792	3.923766	0.953117
+1.496143	4.414714	0.949429
+1.525031	6.176180	0.968354
+1.729424	4.870373	0.968339
+2.665758	1.448182	0.948333
+3.006909	1.800182	0.963333
+3.154424	0.305707	0.968822
+3.156456	1.603291	0.953038
+3.198233	5.064224	0.970517
+3.263884	0.052416	0.968807
+3.645668	1.718704	0.964615
+3.732841	0.033125	0.960227
+3.949706	2.943971	0.949265
+4.015778	0.408444	0.943778
+4.014265	1.241176	0.949412
+1.181769	1.238435	0.965034
+1.166528	3.423194	0.964028
+1.295723	4.267803	0.971272
+1.488462	3.171209	0.967582
+1.962958	3.657324	0.957042
+2.423423	3.518255	0.964094
+2.522401	2.076095	0.975515
+2.660000	3.986567	0.958209
+3.228920	2.395634	0.968263
+3.664131	0.306239	0.982165
+1.523655	1.506948	0.985542
+1.891134	1.993763	0.981546
+1.934558	4.250726	0.992177
+1.963838	0.807374	0.973636
+2.166076	4.845204	0.991090
+2.542938	1.162147	0.980395
+2.641094	2.519688	0.975469
+2.901918	0.263425	0.972466
+3.029474	4.261228	0.975263
+3.092979	2.718723	0.969787
+3.228386	6.131713	0.999114
+3.254305	3.897219	0.988874
+3.345795	5.506705	0.980000
+3.992872	4.125213	0.972660
+1.468807	4.911684	0.995579
+1.476220	5.396457	0.994685
+1.860000	3.054098	0.984918
+1.913974	1.345364	0.990066
+1.932464	5.454493	0.985217
+2.141969	1.937480	0.991260
+2.320667	5.153333	0.977333
+2.911980	5.226040	0.985248
+3.114300	0.859900	0.983100
+3.656426	3.739279	0.999459
+3.682578	4.245781	0.985781
+4.031020	3.180612	0.976327
+1.134942	4.599826	1.005581
+1.807582	5.242008	1.002664
+1.868811	0.223216	1.010617
+2.032481	1.117786	1.010840
+2.315714	0.014405	1.008452
+2.394439	4.184439	0.999112
+2.730625	5.731625	0.988375
+3.102121	4.755606	0.990455
+3.550635	2.701111	1.002910
+3.705417	1.460000	1.006250
+3.751892	2.308919	0.985676
+4.031121	5.446379	0.997500
+4.054758	2.454516	0.999355
+1.128452	2.395000	1.001786
+1.125000	5.531724	1.002069
+1.147391	0.504239	1.004891
+1.388894	4.652304	1.017235
+1.424488	3.841417	1.007953
+1.452677	0.323780	1.008504
+1.527427	2.468299	1.015975
+1.535000	6.400000	0.990000
+1.923284	6.215654	1.020765
+1.965618	1.738146	1.011124
+2.000923	2.847923	1.014077
+2.073362	3.433491	1.013879
+2.373387	1.347661	1.011935
+2.386604	3.112830	1.000377
+3.084390	3.495122	0.997073
+3.334043	4.847518	1.006667
+3.354638	5.844493	1.004493
+4.040190	4.383641	1.020788
+4.054638	2.013957	1.011489
+1.463051	1.779153	1.010000
+1.753936	2.778617	1.013830
+1.863553	0.508711	1.024654
+2.569657	0.531486	1.021943
+2.574615	0.010000	1.018462
+2.614414	4.313862	1.025448
+2.880625	0.700063	1.019688
+3.291429	2.147500	1.006786
+3.451975	1.978642	1.013457
+4.078571	1.640238	1.015238
+1.105259	6.259397	1.030690
+1.467759	2.075862	1.021638
+1.778759	1.550483	1.033862
+2.002813	3.987188	1.015313
+2.184810	4.398228	1.026835
+2.425111	4.488278	1.033000
+2.444648	0.769859	1.025211
+2.512006	5.314904	1.042866
+2.657029	6.349086	1.028114
+2.776438	2.730959	1.016986
+2.821739	0.984203	1.030145
+2.895489	6.382030	1.033759
+2.964153	4.958602	1.041695
+3.121290	5.891720	1.023333
+3.344231	1.454167	1.031731
+3.449132	1.219589	1.032100
+3.506912	0.107353	1.021029
+3.697500	1.198906	1.025469
+3.707475	4.697273	1.030657
+4.044763	5.872145	1.037326
+4.081846	0.825385	1.018923
+1.106707	1.485122	1.028537
+1.097320	5.033608	1.035464
+1.711202	1.809457	1.042907
+1.705263	5.525724	1.038750
+1.711566	3.235301	1.037349
+1.784030	1.093433	1.035224
+1.911446	5.877107	1.045537
+1.923237	2.593816	1.046184
+1.961901	5.028521	1.038873
+2.148022	1.571758	1.031209
+2.150877	5.535263	1.037544
+2.215120	0.650756	1.043643
+2.786273	2.106182	1.039909
+2.868906	3.616875	1.040391
+2.971798	5.471629	1.039438
+3.273469	1.036531	1.023673
+3.401111	0.328254	1.028571
+3.700880	1.968160	1.035520
+3.721598	6.119315	1.048311
+3.731921	3.991854	1.046291
+3.774390	0.974146	1.028537
+4.076887	3.438344	1.039205
+1.458144	3.591237	1.053608
+2.468173	2.330288	1.042019
+2.481825	1.580079	1.059802
+2.562054	2.936811	1.048595
+2.727699	4.552773	1.061475
+3.335229	3.130065	1.044837
+3.355696	3.438386	1.059272
+3.353281	5.256979	1.056719
+3.402579	0.717557	1.049321
+3.387769	6.350808	1.054115
+3.807518	3.127021	1.045745
+4.086526	3.701579	1.042737
+1.075000	4.112500	1.055385
+1.078333	4.355000	1.048889
+1.343299	2.302577	1.052577
+2.146349	3.063983	1.067967
+2.168985	5.794708	1.067600
+2.646436	4.833317	1.060149
+2.684048	0.310357	1.051905
+3.003115	0.489508	1.055246
+3.000920	2.299920	1.073040
+3.306829	2.634512	1.054878
+3.359425	1.720345	1.055402
+3.762390	2.549044	1.070000
+4.086694	6.129008	1.061983
+1.409247	0.574603	1.071423
+1.415899	1.281079	1.066978
+1.542207	1.036207	1.063793
+1.759046	3.960871	1.070913
+2.254000	2.151273	1.057818
+2.311180	3.944438	1.079551
+2.757742	1.863871	1.059677
+3.741739	5.469217	1.065130
+4.123350	0.045583	1.069369
+4.102563	4.650094	1.081313
+1.069763	0.777515	1.088876
+1.383464	5.171508	1.086927
+1.816339	4.535268	1.076339
+2.310297	1.106441	1.090424
+2.696045	6.091921	1.086384
+2.812427	0.058074	1.090923
+3.219877	1.920370	1.072222
+3.776679	2.824723	1.090000
+3.947168	5.034740	1.083353
+1.062269	1.039244	1.085462
+1.055388	1.927397	1.096895
+1.312022	0.120815	1.100730
+1.368933	3.352135	1.094663
+1.410439	5.798596	1.091140
+1.438595	2.953388	1.083306
+1.673463	1.318382	1.101974
+1.770277	2.383391	1.092907
+1.821115	3.462446	1.092086
+2.190444	3.713556	1.091444
+2.334571	2.555276	1.093436
+2.434861	5.820025	1.104810
+2.524808	1.835385	1.076923
+2.586500	5.563400	1.080500
+3.137896	6.375648	1.105043
+3.260388	0.512816	1.083981
+3.409390	2.889512	1.085488
+3.451176	4.225000	1.083971
+4.016903	0.600265	1.089912
+4.136770	1.069503	1.095590
+4.127400	3.944200	1.078000
+4.142364	2.240909	1.082182
+1.050250	0.294500	1.097500
+1.046941	2.731647	1.093176
+1.049630	3.244321	1.098580
+1.047273	3.737727	1.089394
+1.076241	6.011879	1.110709
+1.602805	0.115732	1.099512
+1.754380	0.851570	1.102562
+2.216496	6.175474	1.099416
+2.287222	1.767460	1.100952
+2.453077	6.129744	1.092308
+2.454624	3.727688	1.107052
+2.509065	3.315234	1.094393
+2.750714	3.404643	1.096786
+3.413152	3.729565	1.096304
+3.482273	3.973364	1.100909
+3.543064	4.469306	1.103179
+3.689076	5.017395	1.112227
+3.783444	0.500927	1.102252
+4.113622	6.383214	1.108724
+4.122259	5.229778	1.105630
+4.134774	2.855827	1.103835
+1.035225	5.739075	1.128575
+1.315020	2.638327	1.114286
+1.327222	4.052698	1.105476
+1.975623	2.200038	1.118717
+2.160670	4.157113	1.111495
+2.257073	3.291463	1.096341
+2.660528	5.097520	1.116341
+2.837485	2.954417	1.109141
+2.960945	5.724800	1.122109
+3.229266	4.574321	1.122283
+3.601795	5.271197	1.103590
+3.916301	1.817534	1.110342
+4.153655	1.369379	1.108759
+4.160659	0.300879	1.102967
+1.027251	4.803555	1.124882
+1.318231	6.387846	1.116846
+1.316667	1.568000	1.113111
+1.669193	5.776278	1.132377
+1.712500	4.312917	1.108542
+1.731586	6.035655	1.123103
+1.954286	3.233214	1.111071
+2.116400	0.215326	1.132189
+2.305795	0.414318	1.127008
+2.420592	4.949079	1.119934
+2.462093	0.193811	1.130154
+2.576349	0.949365	1.110635
+2.749035	2.349649	1.111228
+2.835813	1.504581	1.125567
+3.147434	3.286903	1.115752
+3.474736	6.086504	1.134085
+3.824179	0.754478	1.105821
+1.042597	0.036806	1.141403
+1.015289	2.982975	1.133967
+1.304578	1.923494	1.120843
+1.676667	0.349706	1.126373
+1.698793	6.281379	1.117759
+1.922314	4.791616	1.137118
+2.160328	1.308689	1.117541
+2.160164	2.373115	1.116885
+2.373435	6.371174	1.128217
+2.732892	3.820482	1.123735
+2.809591	4.094737	1.126374
+3.057020	1.052879	1.138990
+3.085870	2.533478	1.116087
+3.787529	5.723435	1.144635
+3.808516	4.475137	1.143104
+3.842378	3.523066	1.140372
+3.856058	2.141923	1.135769
+3.909710	1.369275	1.122899
+4.181786	1.825357	1.123214
+1.008873	3.494225	1.134789
+1.329345	0.814940	1.143155
+1.369534	6.052007	1.144731
+1.682694	3.687917	1.154250
+1.720263	2.089868	1.142303
+2.274423	5.321538	1.134423
+2.557638	2.690236	1.137165
+2.987347	3.866854	1.156502
+3.074758	0.084573	1.151293
+3.220732	4.301707	1.135366
+3.498224	0.966044	1.147383
+3.840977	6.325263	1.139699
+3.881721	0.268605	1.144605
+3.872857	3.791286	1.143714
+4.174059	4.190792	1.139109
+1.276575	4.855205	1.142329
+1.300854	1.073293	1.146951
+1.930897	0.029013	1.159193
+1.957391	5.642120	1.152446
+2.750941	5.347569	1.157020
+2.903973	3.208447	1.154612
+2.958254	1.973175	1.137143
+3.085391	3.020348	1.145130
+3.096380	1.454389	1.158643
+3.495410	2.499836	1.134918
+3.529241	0.514388	1.162110
+4.171959	4.923574	1.158179
+1.005208	1.289396	1.163509
+0.992558	5.205814	1.150233
+1.241750	3.552500	1.153750
+1.572026	2.685294	1.157908
+1.577356	4.517788	1.159808
+1.691725	2.970176	1.172817
+1.718028	5.053216	1.172653
+2.100571	4.595842	1.173451
+2.106222	6.383056	1.168333
+2.582894	1.360547	1.173473
+3.106418	0.685672	1.152239
+3.119667	5.242000	1.157778
+3.174783	4.066957	1.153043
+3.525658	4.810000	1.155000
+3.553691	3.085168	1.158523
+3.847615	5.258231	1.153692
+4.177056	3.117850	1.160467
+0.981475	2.277213	1.166393
+1.670117	0.614869	1.179155
+2.359342	2.836447	1.156974
+2.353275	5.568908	1.180387
+2.544195	3.976839	1.175000
+2.675947	0.722392	1.175482
+2.893846	5.970962	1.162212
+3.204839	3.617258	1.156129
+3.219476	5.713886	1.175764
+3.412326	2.273488	1.161395
+3.542567	1.587647	1.173422
+3.537478	5.818457	1.186647
+3.599783	6.319058	1.163188
+3.994650	2.637899	1.187395
+4.187927	5.699634	1.167439
+1.258122	3.126396	1.180305
+1.281478	4.483024	1.187354
+1.989054	0.661892	1.182568
+2.123402	2.691392	1.185155
+2.200373	5.079814	1.187578
+2.460388	4.695874	1.183350
+2.923806	1.266269	1.183731
+2.969677	2.753548	1.169032
+3.143390	1.710847	1.170678
+3.239277	1.234980	1.189518
+3.407509	5.036194	1.192076
+3.573355	3.546513	1.184770
+3.897380	4.793464	1.191054
+3.898947	0.019649	1.193860
+0.976316	0.520263	1.172632
+0.966866	2.522687	1.184627
+0.972500	4.528889	1.185208
+0.973534	5.461802	1.196007
+1.216288	5.338595	1.197391
+1.268571	0.365824	1.186044
+1.463746	4.275549	1.199634
+1.554854	2.274369	1.177767
+1.973971	1.490294	1.183529
+1.989829	0.932457	1.199010
+2.047612	5.378209	1.181194
+2.281799	0.866296	1.193228
+2.677113	5.860928	1.186495
+2.711143	1.138429	1.178429
+2.794024	0.486402	1.187805
+3.041176	6.157529	1.179412
+3.134706	2.116765	1.178529
+3.483315	5.547983	1.200580
+3.553636	1.841091	1.180364
+4.195686	5.460196	1.178627
+4.219247	2.444384	1.191096
+4.232700	0.526000	1.188200
+1.233130	2.864783	1.200522
+1.255333	3.823367	1.211367
+1.561583	1.646834	1.209151
+1.948912	3.704765	1.207206
+2.022527	6.050989	1.189341
+2.322781	3.513841	1.206424
+2.655697	3.126855	1.206439
+2.908750	1.737000	1.185000
+2.987224	4.492571	1.207510
+3.203176	2.811176	1.196118
+3.260543	0.871628	1.198450
+3.605191	2.126565	1.200916
+3.645474	0.021368	1.196421
+3.699377	3.300649	1.216831
+3.863871	1.131290	1.211548
+3.932133	4.033867	1.191600
+0.961502	1.554725	1.220733
+1.538750	1.920240	1.207596
+1.547023	3.915907	1.218605
+1.670119	4.777774	1.219139
+2.389449	2.001356	1.208771
+2.674101	1.688561	1.208273
+2.937399	4.765507	1.219696
+3.242438	0.294492	1.228600
+3.362075	0.053942	1.216307
+3.873204	5.962039	1.206311
+3.934674	2.375761	1.206522
+3.942133	2.992267	1.210267
+4.238052	1.592792	1.209481
+4.214545	4.453896	1.207532
+4.242757	0.852991	1.217804
+1.161917	1.727083	1.216667
+1.175139	2.138333	1.213472
+1.512676	3.168559	1.226324
+1.587367	3.440253	1.232937
+1.921019	1.237321	1.231434
+1.922661	4.099495	1.227431
+2.328993	4.337114	1.215973
+2.435750	0.619625	1.223625
+2.579707	2.188787	1.223138
+2.584300	3.537000	1.208200
+2.790947	2.585758	1.221061
+2.780000	4.336932	1.211364
+2.901224	5.137343	1.228706
+2.928966	0.850517	1.216983
+2.986050	3.460784	1.223697
+3.005648	4.230741	1.220741
+3.151056	4.996056	1.218732
+3.235876	5.454948	1.225000
+3.223860	5.985175	1.219298
+3.542931	0.252291	1.235739
+3.757184	4.219223	1.229320
+3.944364	5.518682	1.218864
+3.963382	3.260676	1.219710
+4.220690	5.938966	1.207069
+4.243544	3.621772	1.213165
+4.251184	2.054342	1.221513
+0.935085	4.010000	1.225085
+1.221944	2.420833	1.223889
+1.244286	1.366310	1.223810
+1.796533	5.373443	1.239552
+1.872292	2.773125	1.232431
+1.914118	1.924118	1.222000
+1.952243	4.373946	1.238135
+2.106504	3.917154	1.225772
+3.197087	2.348058	1.230388
+3.608202	0.748652	1.229213
+3.817568	1.611171	1.223694
+4.241705	3.362171	1.224961
+1.200744	0.608558	1.244233
+1.195580	4.232536	1.251812
+1.441181	5.463386	1.239055
+1.968723	0.401773	1.243546
+2.081929	1.713655	1.240508
+2.133590	2.031410	1.229103
+2.245104	5.972917	1.236771
+2.289583	1.547946	1.247470
+2.561310	0.409524	1.236786
+2.977692	0.320070	1.232937
+3.987723	0.897991	1.245134
+0.926601	4.273861	1.262673
+0.918961	5.001558	1.246234
+0.928209	6.184142	1.254627
+1.209368	5.074349	1.261152
+1.464815	4.984228	1.258981
+1.822110	1.688165	1.254862
+1.957462	5.157868	1.258528
+1.968053	2.441947	1.244956
+2.235692	4.817826	1.254901
+2.388850	3.144985	1.255811
+2.441931	5.168571	1.256757
+2.529577	2.463169	1.250000
+2.562342	4.457627	1.262975
+2.594444	6.251032	1.252222
+2.784205	5.587273	1.239545
+2.842091	6.269682	1.254136
+3.239173	3.850000	1.246241
+3.300349	4.800233	1.248023
+3.362906	2.042075	1.255434
+3.408627	3.270196	1.246078
+3.682017	2.371335	1.266307
+4.239324	6.192324	1.260206
+0.915054	2.063441	1.258495
+1.562464	0.838261	1.253478
+2.334837	2.272561	1.266748
+3.288995	6.235582	1.270767
+3.458150	1.357500	1.269150
+3.706593	1.391209	1.252747
+4.272817	2.683803	1.249859
+1.234016	5.852582	1.278484
+1.417994	4.694922	1.282821
+1.556632	5.239895	1.270895
+1.671720	4.127204	1.261183
+2.016038	3.446462	1.277962
+2.348333	1.292333	1.257333
+2.633853	1.935229	1.273211
+2.698684	4.696842	1.263421
+3.307324	1.561127	1.261549
+4.014045	1.988427	1.261461
+4.273681	4.710833	1.275417
+0.900545	2.820182	1.271818
+0.902540	3.668889	1.266667
+0.904518	1.805361	1.286807
+0.910569	5.917967	1.285285
+1.131903	6.365000	1.288419
+1.489452	0.247945	1.287705
+1.486585	1.401220	1.284146
+1.558714	6.388857	1.277286
+1.775616	3.240616	1.275205
+1.771563	1.037969	1.274688
+1.897778	6.275641	1.284217
+2.661915	2.869574	1.268298
+2.729163	0.224412	1.293643
+2.810000	3.649752	1.288515
+3.420698	2.733721	1.267209
+3.776604	1.938679	1.265660
+3.984275	6.180290	1.279638
+4.277500	4.006394	1.285433
+0.905478	0.722783	1.286261
+0.897876	3.334115	1.293584
+0.910754	0.214563	1.296310
+1.192807	3.352544	1.283333
+1.222201	5.583082	1.290629
+1.458500	2.481231	1.297269
+1.553254	1.148402	1.293669
+1.698462	0.010000	1.280000
+1.812785	0.211646	1.289367
+1.922767	3.028735	1.294269
+2.053412	5.829529	1.288118
+2.129537	3.200556	1.299722
+2.169713	2.926338	1.301083
+2.486207	1.098103	1.291853
+2.533433	5.411045	1.287687
+2.916073	2.165215	1.295446
+2.971407	5.406422	1.298593
+3.404677	4.357419	1.282419
+3.433929	4.603750	1.277321
+3.613864	1.152273	1.288333
+3.653990	2.641347	1.294301
+3.678217	4.659720	1.293881
+3.707610	3.925975	1.287547
+4.035810	0.413429	1.282286
+4.097035	3.814292	1.285531
+4.305370	1.105278	1.294537
+0.921429	0.985979	1.306455
+1.746818	2.555955	1.303545
+2.151045	1.115771	1.298259
+2.344308	4.087231	1.289077
+2.447355	1.759669	1.298347
+2.488227	5.997608	1.312928
+3.434656	5.299246	1.305180
+3.690606	5.418636	1.301818
+3.729651	6.156483	1.308779
+4.085942	0.156957	1.311957
+4.302000	2.935000	1.303063
+0.874149	4.724149	1.310957
+1.140308	2.654954	1.322923
+1.158462	4.679670	1.307308
+1.363647	6.250294	1.314588
+1.479080	0.507701	1.307356
+2.175613	0.547301	1.319724
+2.563146	5.666067	1.301798
+2.599423	4.185577	1.317356
+2.975263	2.433474	1.301895
+3.529494	4.139747	1.301013
+3.999146	4.245244	1.299390
+4.021944	1.482847	1.312083
+4.049314	1.735490	1.310098
+4.312768	0.318839	1.322202
+4.317212	1.372035	1.321327
+0.900000	6.400000	1.290000
+1.450000	0.010000	1.301818
+1.448333	5.699333	1.312833
+1.615981	6.151646	1.328196
+1.787560	3.892337	1.327629
+1.834861	4.601181	1.316389
+2.498667	0.841778	1.308667
+2.710398	4.952898	1.336748
+3.132793	1.916170	1.335559
+3.219355	2.592396	1.323041
+3.231739	3.429435	1.328696
+3.358132	2.968901	1.317143
+3.658475	5.166949	1.324322
+4.039680	3.500581	1.331512
+4.086304	1.233986	1.319130
+4.324355	1.803710	1.317742
+0.867500	3.070938	1.316250
+0.869730	5.667622	1.331351
+1.158635	1.151683	1.343714
+1.179364	0.173410	1.328439
+1.409143	2.746571	1.319714
+1.656441	5.576356	1.323390
+1.825833	0.775000	1.324333
+1.826612	2.229752	1.329174
+2.137075	5.594318	1.341281
+2.324439	3.834081	1.333184
+2.389058	2.658768	1.331522
+2.581344	3.763226	1.330538
+2.739205	6.052159	1.325568
+2.992016	0.555806	1.322177
+3.192179	3.159615	1.341325
+3.249042	0.546518	1.337029
+3.381086	3.644434	1.339095
+3.740415	0.936062	1.337306
+3.865490	5.021863	1.322451
+3.966364	6.395455	1.319091
+4.036400	4.614044	1.336978
+4.078589	0.665394	1.331992
+4.111341	2.253171	1.323537
+4.270000	6.400000	1.300000
+4.308716	5.305405	1.331757
+1.149106	0.854503	1.346126
+1.357895	2.238421	1.338421
+1.396420	3.588210	1.338827
+2.164020	6.189122	1.355898
+2.200957	2.485826	1.345391
+2.279438	0.237871	1.343373
+2.307586	4.560575	1.339483
+2.727000	0.913500	1.330000
+2.768797	3.956015	1.360301
+3.605538	2.901474	1.340518
+3.644286	4.914945	1.339451
+3.824559	0.695441	1.336912
+3.845833	2.806042	1.336667
+4.315200	4.261920	1.333520
+4.313750	5.044728	1.345707
+1.156528	6.096424	1.360000
+1.377477	4.066495	1.353925
+1.384706	0.975588	1.348088
+1.704571	4.378619	1.349333
+1.839889	6.030667	1.346667
+1.875227	4.927879	1.359318
+2.084819	2.243261	1.363080
+2.126173	1.371296	1.352531
+2.157342	3.651266	1.348987
+2.344268	5.771715	1.358410
+2.730000	3.340859	1.358591
+3.060522	3.692450	1.351044
+3.376984	1.788492	1.352738
+3.457834	3.898344	1.351529
+3.738717	0.450831	1.363302
+4.078687	5.148485	1.344545
+1.084583	0.408542	1.355729
+1.135497	3.637016	1.362356
+1.244487	1.955513	1.356282
+1.335696	1.603882	1.357637
+1.457939	5.945420	1.357939
+1.729015	1.359091	1.355985
+2.135015	4.216481	1.369120
+2.758523	1.415485	1.362700
+2.837645	5.802258	1.369613
+2.848545	3.035818	1.347636
+3.036848	5.651630	1.350652
+3.181591	4.399091	1.350227
+3.281456	4.145890	1.374919
+3.404486	2.420841	1.353551
+3.630000	4.404839	1.357419
+3.655556	5.664222	1.364000
+3.775558	0.175012	1.373753
+4.091207	2.804310	1.351552
+4.326549	5.560070	1.359155
+4.344778	0.665167	1.365167
+4.351406	2.237656	1.355156
+0.847818	1.228242	1.374000
+1.377763	2.996484	1.374338
+1.582590	2.116595	1.384269
+1.657879	2.796364	1.372828
+1.713889	0.433278	1.368389
+1.790446	3.553705	1.371473
+2.046124	0.109018	1.380233
+2.233437	5.276000	1.382000
+2.444154	4.926410	1.377436
+2.470517	3.368793	1.369598
+2.526916	1.529626	1.364579
+2.719306	2.353889	1.357500
+2.864492	1.898984	1.373743
+3.023582	4.027575	1.376157
+3.129722	4.659361	1.374972
+3.221282	1.051795	1.365641
+3.384872	5.723077	1.368718
+3.420748	5.985596	1.384709
+3.673100	1.740900	1.373100
+4.360917	0.051835	1.370000
+4.350606	3.778182	1.360606
+0.841000	2.608438	1.384438
+1.089630	2.986173	1.381687
+1.382932	0.724060	1.384286
+1.729583	1.895000	1.371111
+2.225150	1.873593	1.404012
+2.793818	4.511818	1.376182
+2.949115	0.122478	1.378496
+2.984740	6.023149	1.389513
+3.059641	6.287541	1.392238
+3.078446	2.930052	1.390104
+3.112981	0.775321	1.388226
+3.717143	6.391905	1.369048
+3.883071	3.700357	1.380857
+4.346309	3.184497	1.387349
+0.844133	0.483265	1.391173
+0.826000	3.870621	1.392828
+0.829286	4.488714	1.385857
+0.963611	2.389583	1.383472
+1.056606	5.241946	1.400317
+1.082564	3.890000	1.391731
+1.098129	4.437419	1.386516
+1.689801	5.830618	1.404967
+1.883774	5.639057	1.388962
+2.108968	0.797460	1.391706
+2.400566	6.292925	1.387453
+2.430973	2.912324	1.389189
+2.505862	0.143218	1.382874
+2.859053	2.783158	1.394105
+3.071224	5.173017	1.446753
+3.783445	2.159328	1.382773
+3.870891	4.432772	1.390000
+3.878529	5.775735	1.380588
+4.089015	5.650099	1.388670
+4.084909	5.392000	1.384182
+2.000500	2.634500	1.398500
+2.046866	4.727604	1.420346
+2.671796	0.564012	1.394910
+2.970301	4.954060	1.406466
+3.005614	1.461754	1.395614
+3.035809	1.207794	1.404118
+3.376698	0.763396	1.396604
+3.576977	1.961860	1.387442
+3.569504	3.149917	1.404628
+3.673413	5.915449	1.399940
+3.870000	5.277450	1.405839
+4.095899	4.862158	1.396619
+4.097667	3.068128	1.415026
+4.357117	4.510541	1.399369
+4.366977	2.510930	1.392326
+1.050526	1.380526	1.401447
+1.415051	3.335354	1.412475
+1.606606	3.723761	1.403303
+2.205000	6.400000	1.385000
+2.629545	2.674697	1.398333
+2.860000	1.641778	1.399333
+2.962241	3.241207	1.400000
+3.167941	5.842059	1.399265
+3.519714	3.419643	1.407786
+3.533788	0.053515	1.418703
+3.630476	3.667937	1.396032
+3.819254	3.074319	1.424859
+4.123897	2.549632	1.410221
+4.292117	5.823396	1.424528
+0.807556	2.212000	1.411778
+0.807763	5.174474	1.414079
+0.806409	5.432873	1.429282
+1.053097	4.886940	1.424291
+1.752398	5.149240	1.418363
+1.986961	5.359510	1.421029
+2.396250	0.447955	1.410795
+2.723195	5.304436	1.427594
+2.775779	1.144805	1.427955
+3.137885	1.655962	1.408269
+3.198026	2.169828	1.417854
+3.242581	1.373024	1.420282
+3.498679	0.534528	1.409811
+3.507470	0.969398	1.416506
+3.512042	6.241300	1.429443
+3.774858	3.461862	1.427085
+4.392708	0.914792	1.413333
+0.812923	1.482974	1.434308
+1.375444	4.365000	1.424889
+1.700197	3.048816	1.430724
+1.931885	0.573977	1.443977
+1.926968	1.515968	1.439258
+2.224978	3.416211	1.438326
+2.307626	0.958131	1.435455
+2.523114	4.662216	1.430120
+2.663684	6.390921	1.426053
+2.855479	0.735205	1.425548
+2.959091	0.970000	1.428030
+3.498934	1.561726	1.427005
+3.524577	2.209055	1.433532
+3.918663	3.961089	1.446386
+4.373262	3.455638	1.436099
+4.393878	2.010408	1.422857
+1.062055	2.156043	1.455368
+1.307524	5.321768	1.452958
+1.386154	3.824038	1.432500
+1.624685	0.671958	1.432448
+1.634444	4.911111	1.439753
+1.668833	1.595667	1.442722
+2.214474	5.017456	1.442018
+2.365397	5.518254	1.429524
+2.396709	3.608354	1.435570
+2.709792	2.116458	1.431250
+2.854478	0.395970	1.436567
+2.959224	4.347328	1.434310
+3.850247	1.293333	1.440988
+3.896721	6.014262	1.439672
+4.135205	6.029452	1.426164
+0.794451	4.920751	1.450751
+0.789545	1.963636	1.440000
+1.046000	5.488667	1.436000
+1.315153	0.374133	1.448316
+1.612015	4.608408	1.459204
+1.920444	0.949111	1.444667
+2.020000	3.986737	1.446316
+2.355709	0.699459	1.461047
+3.291993	0.155559	1.453706
+3.448842	4.791053	1.451526
+3.453307	5.074213	1.457387
+3.844691	4.802438	1.462346
+3.934620	1.057468	1.457911
+4.132540	4.398254	1.443810
+4.141161	0.895488	1.462665
+4.158165	1.917982	1.447431
+4.375161	6.080000	1.456129
+1.034009	1.632026	1.470881
+1.083352	5.739066	1.458791
+1.664194	2.363963	1.464885
+2.076054	4.456667	1.459660
+2.276301	2.104384	1.455068
+2.521081	3.985135	1.461351
+2.546716	1.290235	1.474604
+2.565544	3.128601	1.457358
+2.647702	1.761925	1.454783
+3.105244	0.339553	1.459268
+3.228527	4.922558	1.463721
+3.413919	1.191757	1.454865
+3.483619	5.517143	1.458571
+3.712296	4.118667	1.458741
+3.758879	1.526034	1.457845
+3.860100	5.536567	1.466667
+4.220435	1.632609	1.455109
+4.403351	2.752577	1.467268
+1.041712	4.145582	1.475479
+1.184957	2.443043	1.467478
+1.361250	4.864231	1.471731
+1.560867	4.207052	1.472543
+1.602414	0.100172	1.457586
+1.686452	0.903226	1.455484
+1.931212	3.245051	1.467172
+1.963409	3.736439	1.477652
+2.078350	0.353786	1.463786
+2.173713	1.621435	1.477848
+2.182375	5.938294	1.482074
+2.421783	4.377984	1.470698
+2.500455	2.231250	1.460795
+2.630492	3.550492	1.456393
+2.714774	5.567806	1.473613
+2.817516	4.755294	1.474444
+3.167261	5.474331	1.479904
+3.209437	6.098451	1.470423
+3.900410	1.866803	1.477336
+0.772708	2.837708	1.470208
+0.780220	4.257665	1.493901
+0.772667	6.136833	1.470833
+0.865840	3.540720	1.475040
+1.062985	0.631306	1.481903
+1.492881	1.762203	1.472373
+1.652105	5.376374	1.478187
+1.904151	4.266038	1.464717
+1.925045	1.778198	1.473784
+1.985544	1.196361	1.489592
+2.034770	2.011925	1.486109
+2.497372	1.972244	1.495160
+2.593307	6.172996	1.489416
+2.822593	2.544815	1.478272
+2.914925	3.488910	1.487744
+3.481295	2.622302	1.481295
+3.623568	0.749296	1.491044
+3.604557	1.332911	1.476456
+3.963407	3.290296	1.473704
+4.119423	4.120962	1.472692
+4.135503	6.272011	1.482328
+4.182327	0.486449	1.495163
+4.392415	4.811220	1.490707
+0.767037	5.896852	1.480370
+0.975932	0.052091	1.497338
+1.040000	1.890213	1.481915
+1.237054	3.171550	1.490388
+1.371509	0.128679	1.479623
+1.456471	5.527206	1.477941
+1.493114	5.120830	1.493806
+1.831138	0.017886	1.494797
+1.922759	2.860172	1.494741
+1.937105	2.412105	1.487105
+2.207647	2.737843	1.476078
+2.294492	1.213136	1.483390
+2.598608	0.341772	1.482025
+2.603097	5.828344	1.500903
+3.143769	2.414154	1.492846
+3.226022	3.914624	1.488065
+3.285193	2.796941	1.497969
+3.961523	2.361695	1.501351
+4.001818	2.099697	1.479848
+4.184000	3.654000	1.476286
+0.770244	0.706707	1.495976
+0.990336	3.218403	1.499412
+0.993832	6.247665	1.503293
+1.415000	1.205313	1.499375
+1.515524	6.316643	1.498112
+1.674980	3.305451	1.502941
+1.717576	1.147172	1.490202
+1.757295	6.291475	1.497705
+1.935255	5.856861	1.493212
+1.987935	6.378261	1.505109
+2.296000	4.758370	1.498667
+2.488413	2.489087	1.501827
+2.530078	5.140625	1.505000
+2.675082	4.338525	1.497541
+2.830833	6.246083	1.504083
+3.579063	0.300625	1.499844
+3.731556	2.497111	1.496667
+3.978500	0.305000	1.493625
+4.426387	1.191355	1.500129
+0.769730	1.730721	1.503784
+0.759173	3.309774	1.512105
+0.758119	6.386139	1.507723
+0.991527	4.633969	1.512824
+1.001000	2.774800	1.495400
+1.582949	3.949615	1.505128
+1.989300	5.113457	1.518889
+2.313013	3.179289	1.513598
+2.661130	2.895391	1.521609
+2.910377	2.314528	1.511887
+3.284897	6.349259	1.506296
+3.366479	2.000845	1.508662
+3.474921	4.530632	1.522079
+3.470196	4.262941	1.501373
+3.883431	6.274891	1.514453
+4.144576	1.386949	1.506610
+4.198478	3.895435	1.498043
+4.390608	6.356225	1.516852
+0.768269	0.270577	1.505769
+0.763622	1.015748	1.516378
+1.139143	3.428143	1.524821
+1.220058	5.075706	1.532680
+1.347322	4.607596	1.536393
+2.274233	4.040476	1.520106
+2.569324	1.014865	1.517838
+2.603963	0.764756	1.527500
+2.841714	4.150143	1.520000
+2.869740	3.757584	1.525651
+3.051639	2.662941	1.521050
+3.640380	5.323919	1.534133
+3.691373	1.102892	1.532647
+3.928506	0.569545	1.535227
+0.748310	4.680000	1.524648
+0.987244	5.990787	1.532441
+1.248358	1.777015	1.526567
+1.550845	0.325070	1.529789
+1.802545	4.053636	1.523091
+1.980920	6.115690	1.547070
+3.099281	0.020327	1.538497
+3.361878	3.238619	1.531271
+3.649297	3.878486	1.533514
+3.695610	2.750854	1.524878
+3.984727	1.617030	1.533030
+4.438533	1.461400	1.540900
+4.442609	1.734783	1.529891
+4.444211	0.239240	1.549357
+0.756059	2.420402	1.549812
+1.260738	6.266510	1.540940
+1.798763	0.263746	1.544089
+1.797333	2.091444	1.530333
+1.984824	3.488176	1.538765
+2.253588	0.060463	1.546250
+2.421066	1.682377	1.533607
+2.985594	2.067548	1.545441
+3.737570	4.579065	1.535140
+3.869872	0.828590	1.540128
+4.180617	1.144074	1.535926
+4.451597	0.504167	1.543403
+0.737656	5.659844	1.543594
+1.224308	5.936308	1.544154
+1.241796	1.002994	1.546347
+1.403705	1.987771	1.554940
+1.431962	5.774522	1.561411
+1.531302	3.529438	1.560947
+1.564082	1.387347	1.535918
+1.631932	2.610386	1.552850
+1.707153	6.052847	1.548681
+1.820317	4.755926	1.553175
+2.288794	2.338227	1.551844
+2.355030	6.114970	1.548698
+2.738489	0.159568	1.545827
+3.347873	0.396284	1.563863
+3.918151	0.035210	1.549874
+4.044706	5.844444	1.553007
+4.192803	0.188662	1.543949
+4.197474	5.242784	1.554794
+4.203944	4.642394	1.537887
+4.235577	2.139038	1.544423
+4.434722	3.936875	1.551806
+4.442787	4.327213	1.538197
+4.448652	3.676067	1.554607
+4.456964	2.344643	1.543750
+0.800000	3.062791	1.545116
+1.004716	1.106114	1.558777
+1.242222	2.874444	1.548889
+1.400196	2.692745	1.550196
+1.424984	2.437210	1.568464
+1.838259	4.488905	1.562587
+2.161698	2.972013	1.563585
+2.174203	5.455362	1.550435
+2.341538	1.445192	1.546154
+2.783852	6.011475	1.558934
+2.923148	5.443148	1.560926
+3.123909	3.354682	1.560045
+3.330597	3.504080	1.560995
+3.367290	5.315576	1.562679
+3.473529	2.971123	1.564278
+3.696269	5.047388	1.557985
+3.700952	6.109841	1.555238
+3.955831	5.078563	1.565887
+4.439916	5.322185	1.551597
+1.234712	5.573077	1.561731
+1.286710	3.651042	1.580684
+1.440571	6.075285	1.583052
+1.447722	0.553544	1.575612
+1.475618	3.141011	1.561124
+1.525000	2.897000	1.553667
+2.601826	4.864348	1.564261
+2.767320	5.070261	1.569216
+2.933440	4.550960	1.574240
+2.993046	0.540152	1.576701
+3.010172	1.798190	1.572543
+3.113846	4.181538	1.563462
+3.271791	0.905075	1.559851
+3.416989	3.758817	1.576559
+3.514000	5.818105	1.567316
+3.519744	1.801744	1.570564
+3.936667	2.870000	1.559216
+3.945766	2.617297	1.574595
+4.224419	2.381628	1.556512
+4.403148	2.995185	1.554630
+4.447183	5.065211	1.560282
+4.475577	0.759423	1.565000
+0.962102	5.076752	1.577261
+1.281275	2.216765	1.574314
+1.308767	4.160308	1.588062
+1.654043	5.636330	1.585213
+2.160443	0.566650	1.584926
+2.451379	2.732759	1.562586
+2.655973	1.533122	1.585204
+3.243027	0.650412	1.593995
+3.297971	1.596087	1.575072
+3.438551	4.027056	1.582991
+4.187818	2.875591	1.580273
+4.190299	5.512989	1.591413
+4.203366	4.981188	1.575347
+4.430524	5.647640	1.583708
+0.728545	3.729552	1.599179
+0.721798	3.993933	1.583596
+0.986327	2.538878	1.587143
+1.165962	0.215625	1.601851
+1.192875	1.284292	1.594875
+1.493164	0.978418	1.590791
+1.850159	5.494762	1.576190
+2.130696	2.535886	1.589747
+2.197714	3.627238	1.583905
+2.269738	5.681937	1.589372
+2.371268	3.810352	1.590211
+2.617372	3.772993	1.592190
+2.892852	3.012814	1.602281
+3.041767	4.790964	1.592450
+3.071364	5.695682	1.590000
+3.155168	3.080638	1.599195
+3.160909	3.696364	1.589636
+3.207455	1.157182	1.588091
+3.345200	2.304480	1.585920
+3.748878	5.743061	1.580510
+3.981260	4.541732	1.585984
+0.726214	1.294612	1.599854
+0.736584	0.035018	1.605089
+1.253784	1.530270	1.590405
+2.025625	5.647344	1.587031
+2.273548	4.529785	1.599140
+2.423152	5.356957	1.605109
+2.584795	3.358493	1.593973
+2.752480	1.945984	1.607402
+2.791207	0.925000	1.586034
+2.815650	3.271073	1.601243
+2.821694	1.340000	1.600242
+3.181145	4.427786	1.596794
+3.261724	4.668736	1.594368
+3.322450	5.647050	1.601750
+3.694539	4.328628	1.617157
+4.021296	3.506605	1.597284
+4.197219	3.269821	1.608724
+0.974479	0.400888	1.611853
+0.983810	4.371905	1.600000
+1.012857	0.844082	1.601224
+1.646993	1.907692	1.604336
+1.846406	0.763488	1.616335
+2.102105	1.405789	1.608852
+2.200965	6.301667	1.609693
+2.506053	5.606263	1.616474
+2.681911	4.584311	1.612222
+3.024609	6.152344	1.610000
+3.276097	5.907000	1.619774
+3.713101	2.263178	1.601705
+3.775961	3.660471	1.618667
+3.918159	4.169683	1.622857
+4.010230	3.770000	1.598851
+4.358293	0.015000	1.620488
+4.472182	4.581455	1.608545
+0.696613	5.090968	1.615000
+0.719866	0.493795	1.627679
+1.017292	3.683538	1.631046
+1.215000	4.397639	1.608194
+1.709596	0.518051	1.627243
+1.778246	4.996579	1.622982
+2.071391	2.232522	1.617913
+2.090305	4.899329	1.623049
+2.449971	6.348657	1.625714
+2.472749	0.193743	1.620877
+2.505934	4.187552	1.627676
+2.691379	2.382512	1.625714
+2.941346	1.552308	1.608846
+3.069811	1.354717	1.606981
+3.583735	2.046867	1.616145
+3.689470	0.110227	1.616364
+3.710000	6.398889	1.607778
+3.973333	5.365859	1.624293
+1.105986	5.352552	1.646334
+1.166204	4.774745	1.632263
+1.339167	0.780648	1.626944
+1.537314	2.208400	1.636057
+1.595452	4.405452	1.640268
+1.887895	2.622836	1.637778
+2.038412	0.179588	1.636765
+2.121786	1.820595	1.627024
+2.192567	0.834358	1.645012
+2.221387	5.193090	1.644307
+2.376127	4.966861	1.642658
+2.503281	0.501797	1.632188
+2.829292	5.775487	1.635708
+2.944620	1.120163	1.629837
+2.986806	3.976806	1.639660
+3.641019	4.799962	1.634264
+3.780306	0.376735	1.636871
+4.248761	2.619381	1.628230
+4.250000	0.701935	1.619032
+4.462857	5.905357	1.628316
+4.477893	3.232587	1.642053
+4.493467	2.113733	1.627467
+0.706134	2.170672	1.636050
+0.702661	2.665000	1.633952
+0.838036	5.289286	1.639643
+0.915652	5.523913	1.634348
+1.034953	2.982978	1.645235
+1.537404	4.792979	1.640128
+2.252240	4.274536	1.639508
+2.256756	0.331073	1.657415
+2.433750	2.984295	1.644103
+2.739123	0.456316	1.632281
+2.927964	0.287725	1.653593
+3.030484	0.797419	1.628226
+3.288969	2.568041	1.631753
+3.481951	6.053537	1.631707
+3.580914	3.487665	1.646802
+3.761316	1.715833	1.640746
+3.770975	3.306441	1.640254
+4.039739	4.786903	1.655970
+4.233115	5.989180	1.634590
+4.297778	4.160741	1.625185
+4.322048	1.933810	1.649143
+4.492160	2.572960	1.637360
+0.695914	4.468657	1.664029
+0.915476	2.030714	1.643452
+1.113953	3.943446	1.653176
+1.774355	1.486129	1.641129
+1.943632	3.071667	1.657265
+2.059400	4.116000	1.642800
+2.113106	3.290429	1.658359
+2.121168	3.866332	1.660326
+2.831393	2.737214	1.657183
+3.252421	1.824105	1.649368
+3.460317	1.049683	1.653571
+3.564028	0.542678	1.664431
+3.727297	2.967946	1.649243
+4.330256	0.937821	1.642179
+0.691250	1.912813	1.653594
+0.910055	4.826565	1.673740
+0.922410	5.780103	1.658821
+0.964932	2.293741	1.671837
+1.358267	3.349318	1.671136
+1.368904	3.922466	1.659041
+1.524912	1.588772	1.650000
+1.778817	5.249785	1.651398
+2.692378	4.008841	1.664634
+2.998027	5.035646	1.663061
+3.251611	5.099667	1.660556
+3.834559	2.046863	1.660882
+4.024505	6.116264	1.656209
+4.263784	3.521622	1.654865
+1.813393	2.298036	1.657500
+1.853136	3.861124	1.669586
+1.955000	0.435336	1.675268
+2.044195	4.621268	1.681512
+2.464138	3.579496	1.686021
+2.598293	2.139634	1.666829
+2.807923	0.693865	1.678406
+3.087521	5.287355	1.665785
+3.308256	1.367326	1.669186
+3.442282	0.176913	1.666107
+3.545322	2.446271	1.680271
+3.845761	5.948152	1.664457
+3.973889	3.106190	1.676270
+4.239911	4.419710	1.681071
+0.672903	6.231613	1.673226
+0.952544	1.772403	1.690318
+1.508011	5.303441	1.680054
+1.589954	0.752857	1.678433
+1.737854	2.847098	1.692122
+1.797099	4.243704	1.685185
+2.019873	4.352785	1.684051
+2.375893	1.028997	1.690502
+2.468286	4.693143	1.673714
+2.662185	5.278403	1.690868
+2.739500	3.557639	1.687333
+3.182638	0.219049	1.688466
+3.496163	6.324070	1.694462
+3.515096	1.504327	1.672788
+3.631197	5.548547	1.672564
+3.954221	5.647662	1.681688
+3.970862	1.375862	1.665690
+4.235410	1.535246	1.676885
+4.485430	6.163620	1.680995
+0.686071	0.840119	1.682024
+0.682757	3.481243	1.694919
+0.934254	3.414420	1.689779
+1.194069	2.670414	1.685724
+1.207066	0.548430	1.691322
+1.576944	1.200000	1.680833
+1.593934	3.782960	1.704357
+1.689830	3.113182	1.684773
+1.727073	0.987805	1.676341
+1.757381	3.561190	1.697619
+1.892667	1.915048	1.695302
+1.978451	0.984965	1.698204
+2.353333	1.861481	1.679074
+2.574662	6.012180	1.701429
+2.659870	3.091948	1.689351
+2.702273	1.141591	1.672727
+2.928421	2.488900	1.698708
+4.125302	1.761581	1.697953
+4.520167	2.826833	1.682333
+0.675414	5.480446	1.700382
+0.674226	5.847484	1.712452
+0.677565	2.916477	1.702953
+0.818763	1.516598	1.691031
+1.140895	6.109579	1.700105
+1.163425	1.948370	1.708204
+1.583333	0.147241	1.689655
+1.830334	1.239554	1.709136
+1.819859	5.782535	1.691690
+1.851429	3.317792	1.696818
+2.007812	5.350443	1.715568
+2.170545	1.175818	1.694000
+2.589126	1.769417	1.695825
+2.971289	4.333822	1.705600
+3.072556	2.850224	1.705426
+3.236045	2.099364	1.704273
+3.266602	6.162492	1.703625
+3.321994	4.233826	1.708296
+3.458267	4.963600	1.691733
+3.548182	3.184318	1.701023
+3.669038	0.913269	1.686346
+3.665476	4.069762	1.710179
+3.750217	1.464130	1.695217
+4.248958	6.224792	1.695521
+4.516889	4.130444	1.693333
+0.928231	0.640615	1.705308
+0.962101	1.308986	1.710000
+1.127143	3.246032	1.702222
+1.284556	3.054497	1.714911
+1.372308	0.345144	1.713365
+1.969246	1.634295	1.716328
+2.064439	5.896257	1.706791
+2.326026	5.913675	1.708377
+2.354870	2.114348	1.702957
+2.430735	0.725588	1.701471
+2.481136	4.439205	1.710852
+2.603632	2.607164	1.717313
+2.683644	6.264810	1.719096
+2.808866	4.839446	1.724106
+3.531286	2.711857	1.709571
+3.599438	1.265542	1.721888
+3.873981	1.131165	1.707864
+4.017748	0.193576	1.718742
+4.027791	0.735465	1.706279
+4.085203	0.993446	1.706014
+4.087789	2.026131	1.709196
+4.090513	3.984359	1.707487
+4.219310	5.750739	1.712660
+4.282021	3.802766	1.700851
+4.295229	0.383119	1.705688
+4.306798	1.292895	1.714868
+4.515061	3.494268	1.712195
+0.658387	4.793548	1.715968
+1.198252	2.410699	1.717063
+1.341818	4.926364	1.705682
+1.431375	5.558768	1.730516
+1.553537	4.138830	1.736056
+2.265521	2.793542	1.708958
+2.351506	2.552108	1.719699
+2.369351	3.326703	1.721081
+2.437557	1.286989	1.717443
+2.755130	5.537642	1.733782
+3.033690	5.921310	1.724310
+3.039137	2.261223	1.719640
+3.447565	0.784555	1.730628
+3.774957	0.692051	1.719829
+4.512482	4.854184	1.720426
+4.536667	1.127576	1.710606
+0.667147	4.199679	1.741410
+0.939191	0.163003	1.745796
+1.056800	6.360750	1.730650
+1.407143	1.382786	1.732464
+1.535682	6.386477	1.724318
+1.597251	5.920584	1.736495
+1.627419	2.428226	1.721774
+1.766871	6.371224	1.726327
+2.026434	2.835035	1.733916
+2.227391	1.614720	1.733851
+3.249157	3.885542	1.725060
+3.792339	5.215088	1.724737
+3.845244	3.899756	1.722317
+4.051800	0.444600	1.722400
+0.670085	0.260085	1.735043
+0.929215	4.564660	1.751675
+0.957786	2.745496	1.734962
+1.097273	4.206676	1.752159
+1.350000	1.127250	1.726250
+1.357246	0.086087	1.731304
+1.460235	1.806235	1.735176
+1.558051	5.050636	1.745466
+1.707887	4.624227	1.744072
+1.723529	1.708382	1.730735
+1.989700	6.284500	1.741100
+2.469211	2.334211	1.729868
+2.730625	4.255208	1.731563
+2.904379	0.040339	1.751977
+3.810997	2.460587	1.748915
+3.947943	6.373698	1.756901
+3.957391	2.250725	1.733768
+4.538054	1.628725	1.744430
+0.661928	1.088373	1.748855
+0.876766	6.063027	1.756439
+1.293458	6.385981	1.751121
+1.605000	3.362813	1.743750
+1.848566	6.026846	1.760108
+1.999664	3.640839	1.760101
+2.251781	4.764658	1.742740
+2.459710	1.542319	1.744203
+2.607610	0.900467	1.760852
+2.638116	0.046014	1.764638
+2.832222	1.732857	1.735079
+2.973258	3.665955	1.740449
+3.130698	0.989369	1.760897
+3.164359	5.508462	1.737821
+3.244433	4.859691	1.748969
+3.523662	5.214085	1.762934
+3.612949	4.550897	1.739872
+3.832077	4.666385	1.756000
+4.077617	2.472228	1.752124
+4.291404	5.109298	1.744211
+4.525140	5.471215	1.744953
+4.542299	0.387126	1.746207
+4.545935	0.108130	1.757317
+4.545273	0.889273	1.743091
+0.883966	4.066724	1.749310
+1.108300	4.985200	1.763650
+1.291156	5.175306	1.756735
+1.694590	5.451475	1.746393
+1.823007	0.114755	1.763881
+1.993542	2.418125	1.754792
+2.122870	2.035093	1.756111
+2.609321	5.021196	1.776984
+2.826739	2.138261	1.745217
+3.126612	1.634973	1.759180
+3.165041	3.513577	1.754797
+3.437705	4.712623	1.752787
+3.815400	4.952560	1.767680
+4.313649	5.354459	1.752973
+4.533721	3.800093	1.764605
+4.550495	1.371287	1.762673
+0.897813	3.169688	1.757344
+1.167071	3.509607	1.782250
+1.380000	4.332763	1.767763
+1.430849	2.850425	1.777028
+1.481852	2.600370	1.755926
+1.712796	2.086452	1.765054
+1.957789	5.092632	1.772526
+2.334559	3.987000	1.782971
+3.354138	4.487069	1.758276
+3.413290	5.467915	1.776059
+3.784074	2.734120	1.769259
+4.049540	2.760460	1.767816
+4.204961	2.250472	1.767638
+4.218242	3.051923	1.769121
+4.435158	0.632127	1.772262
+4.533979	4.380052	1.767958
+4.546462	1.912718	1.775436
+4.544689	2.331340	1.777703
+1.056332	1.543317	1.781005
+1.127021	1.042766	1.774043
+1.223600	4.580400	1.765800
+1.461413	4.586848	1.768370
+2.234722	3.087500	1.791493
+2.253333	5.431354	1.791736
+2.619775	2.859775	1.779213
+2.626923	5.758889	1.778291
+2.860619	6.095773	1.770619
+3.028152	1.967725	1.786540
+3.066245	4.607844	1.786989
+3.430299	1.945373	1.777164
+3.482381	2.203690	1.770476
+3.635591	5.935118	1.776772
+3.786878	6.164049	1.781073
+3.918333	4.389444	1.765741
+3.946087	1.591304	1.777304
+0.646410	3.164038	1.801987
+1.623657	6.173433	1.788955
+1.900724	4.831743	1.800080
+2.178360	6.118818	1.805326
+2.344363	0.047170	1.797170
+2.670833	1.362667	1.790333
+3.096691	0.440216	1.789065
+3.400719	3.615683	1.788417
+3.497626	3.887671	1.804589
+4.265859	4.850391	1.791406
+4.539952	5.109904	1.791483
+0.638440	5.242200	1.808360
+0.851122	5.053163	1.799082
+1.152404	0.784421	1.812552
+1.191529	5.631294	1.791882
+1.429020	3.581520	1.802804
+2.222167	2.328208	1.805042
+2.625152	0.310649	1.802900
+2.768042	3.802917	1.804833
+3.124835	3.264286	1.801648
+3.374620	3.348511	1.810274
+3.671913	1.902696	1.793304
+4.044250	5.909125	1.790625
+4.069301	5.005175	1.800699
+4.100303	3.656162	1.802929
+4.259716	0.151344	1.817261
+4.306178	2.806497	1.804140
+0.639834	3.909006	1.808785
+0.685412	2.476118	1.799412
+1.233151	3.767740	1.807055
+1.705125	0.334750	1.797125
+1.900301	5.572711	1.807470
+2.136870	5.669696	1.809261
+2.275625	3.716250	1.799167
+2.933679	3.426038	1.807453
+3.099167	4.140833	1.803472
+3.315025	2.807635	1.813645
+3.306162	3.085051	1.816061
+3.499698	5.719430	1.814262
+3.511980	1.708416	1.811188
+3.865299	3.494321	1.814891
+3.908630	1.850822	1.804247
+4.098278	4.229569	1.811292
+4.330000	2.471558	1.811558
+4.545000	5.724189	1.796622
+4.563585	3.034340	1.795849
+0.897862	0.868690	1.819448
+1.104310	5.875324	1.829014
+1.221237	2.179175	1.816082
+1.309111	1.621143	1.827810
+1.366310	5.795833	1.811190
+1.411324	2.334412	1.812794
+1.447577	2.053148	1.833983
+1.478288	3.172432	1.823063
+2.020404	0.727879	1.817980
+2.810392	4.498758	1.815163
+3.119536	2.618543	1.843422
+3.163333	0.010000	1.805000
+3.253840	2.342640	1.818480
+3.342589	0.512816	1.827443
+3.531172	2.949448	1.814690
+3.573375	0.329625	1.820438
+4.081818	1.223766	1.809221
+4.077013	4.582554	1.825455
+4.342857	4.618214	1.803214
+0.641742	1.628949	1.840150
+0.646178	0.634522	1.844650
+0.835368	6.311789	1.820947
+0.857317	3.614390	1.819268
+1.360428	6.050272	1.836654
+1.642979	1.385319	1.815319
+1.906335	4.059050	1.831131
+1.934486	2.175081	1.838541
+2.123121	2.621676	1.829422
+2.153662	0.499415	1.844923
+2.227568	1.370811	1.828378
+2.229691	4.450617	1.830062
+2.386491	5.698333	1.826140
+2.525803	1.968705	1.835181
+2.645839	0.572416	1.829396
+2.894848	1.262121	1.826212
+2.982651	5.654419	1.842302
+3.230519	5.752078	1.829913
+3.309177	1.176450	1.830823
+3.533577	4.335122	1.829756
+3.755714	5.721250	1.829464
+3.876006	0.906433	1.839878
+4.080000	5.257462	1.828231
+4.106087	3.393623	1.821449
+4.324221	4.021388	1.836856
+0.846293	0.417857	1.848333
+0.880267	4.326310	1.848930
+0.946172	3.842813	1.842266
+1.314286	4.097619	1.831905
+1.551087	0.957464	1.836159
+1.563429	0.522762	1.834857
+1.646162	5.680669	1.846655
+1.711392	2.629304	1.842278
+1.985111	1.404667	1.826889
+2.188706	3.472824	1.839118
+2.437050	6.187969	1.848621
+2.513032	3.800323	1.835226
+2.517931	5.473687	1.846393
+2.613920	3.374198	1.849599
+2.834133	1.018700	1.852867
+3.061975	6.222654	1.845247
+3.205280	0.748960	1.838800
+3.586787	0.061155	1.844260
+3.768364	3.136614	1.857000
+3.846652	5.437602	1.845701
+0.618938	6.064779	1.842212
+1.110329	0.356548	1.862027
+1.189344	2.862459	1.840000
+1.193067	1.269067	1.848533
+1.841073	4.431512	1.853902
+2.484199	3.140331	1.859282
+2.637258	4.679274	1.844677
+2.817318	3.199080	1.853870
+2.853511	0.439008	1.850916
+2.851061	5.124182	1.860242
+2.900266	1.521293	1.854905
+2.980833	0.643571	1.844762
+3.130679	1.375299	1.858451
+3.340513	1.535385	1.846154
+3.402414	5.960000	1.845862
+3.652201	3.660647	1.861748
+3.734896	2.221111	1.859028
+3.800183	0.221005	1.850000
+4.089070	5.514651	1.846667
+4.286825	1.075556	1.839206
+4.283770	0.810656	1.846066
+4.340451	1.776285	1.861701
+0.619115	2.105929	1.858584
+0.625698	0.043605	1.853953
+0.714203	1.317536	1.854638
+0.836517	1.934944	1.854382
+0.954328	5.622313	1.858358
+1.411066	0.735279	1.865736
+1.762482	0.817445	1.857518
+1.823356	0.569726	1.860137
+2.388480	4.245673	1.855731
+2.377813	5.109875	1.864250
+2.404938	0.550000	1.853951
+2.662500	1.605882	1.853382
+3.027500	3.047813	1.859479
+3.026415	4.876792	1.850189
+3.386989	2.559659	1.866080
+3.849830	0.500284	1.859205
+4.199762	0.585595	1.851905
+4.321822	3.276215	1.859766
+4.558580	5.997870	1.858580
+4.572113	4.615493	1.854789
+0.614651	3.656047	1.855581
+0.603939	5.650606	1.865758
+0.612682	4.608492	1.876592
+0.616131	4.981055	1.878593
+0.871656	2.946146	1.882325
+1.237967	5.396429	1.874341
+1.646351	4.842342	1.875360
+2.118047	4.210078	1.875742
+2.133211	0.220183	1.865229
+2.141865	4.942538	1.880734
+2.188727	0.971273	1.861455
+2.771845	2.339821	1.867976
+2.779231	1.933654	1.854231
+2.828517	5.869952	1.876890
+2.874884	4.040388	1.873760
+2.995111	5.387222	1.867556
+3.164277	4.378072	1.870783
+3.630617	3.372901	1.873765
+3.766393	4.243279	1.865246
+3.841224	1.319184	1.855306
+4.228097	6.053545	1.877239
+4.337525	5.581287	1.880248
+4.344611	2.064278	1.869222
+4.350441	3.622687	1.874053
+0.817277	2.277574	1.885248
+0.842570	5.390782	1.879441
+0.883333	1.131959	1.888866
+1.002857	2.442208	1.877143
+1.160650	0.080224	1.902623
+1.681488	5.243962	1.895744
+1.678667	3.957333	1.871778
+1.994531	3.218672	1.881328
+2.013190	1.164724	1.886748
+2.136034	1.811552	1.869828
+2.276061	0.746364	1.879596
+2.445789	4.826526	1.877474
+2.572905	1.143953	1.891588
+2.848247	2.879935	1.880455
+3.056256	3.854566	1.885753
+3.102500	5.107381	1.878690
+3.229880	5.312048	1.867470
+3.349754	0.109344	1.880656
+4.561316	6.395789	1.872895
+4.583798	2.565039	1.879845
+0.754257	2.706824	1.883649
+1.040356	5.210156	1.898022
+1.795131	3.740785	1.891257
+1.872618	2.973168	1.902147
+2.375671	0.298758	1.901443
+2.392806	1.739774	1.900935
+2.397760	2.894792	1.896250
+2.602667	4.106513	1.891231
+3.011782	0.226238	1.882772
+3.348776	5.062092	1.895663
+3.565660	6.147689	1.896085
+4.356725	1.485352	1.897852
+4.368551	5.845072	1.886957
+4.582350	3.265683	1.892186
+0.598883	6.326214	1.901165
+0.853804	5.845435	1.894891
+1.072824	4.722118	1.898529
+1.108393	1.770268	1.894286
+1.335000	4.760367	1.905932
+1.441757	3.893694	1.903559
+1.489929	0.221560	1.902128
+1.563444	1.616325	1.912715
+1.613636	2.980390	1.892857
+1.631085	0.023101	1.901008
+1.646772	1.879494	1.906519
+1.782105	1.064605	1.896316
+1.799063	2.379063	1.885938
+1.805405	1.545541	1.893919
+2.143532	5.217621	1.904498
+2.805277	2.613388	1.906710
+3.279637	1.791613	1.902661
+3.308992	4.049758	1.907702
+3.595976	4.998415	1.891707
+3.635037	4.739526	1.917606
+3.648061	0.801531	1.900000
+3.712469	1.111967	1.902259
+3.742698	1.692540	1.892857
+4.005149	6.171045	1.896493
+4.336339	4.292679	1.894196
+4.581236	4.015674	1.904213
+0.818778	4.757333	1.916000
+1.003008	2.109593	1.909756
+1.033366	3.333366	1.908020
+1.494497	1.212910	1.912593
+1.598904	4.431233	1.896986
+1.736772	3.234055	1.921299
+1.895109	3.456304	1.901630
+1.934252	5.808766	1.920945
+2.037414	3.860948	1.907069
+2.319167	1.164500	1.900667
+3.475545	0.986455	1.916636
+3.627189	1.466959	1.910829
+3.737796	6.373578	1.925687
+3.838714	5.958143	1.900429
+3.906202	2.913876	1.910620
+3.930261	4.063913	1.910957
+0.619701	0.894132	1.922934
+1.102599	3.081864	1.918136
+1.094952	4.445810	1.922000
+1.191317	6.231779	1.924164
+1.305691	2.536334	1.927203
+1.328830	0.494947	1.925426
+1.313681	0.971656	1.919264
+1.444816	6.284041	1.924122
+1.822197	6.223712	1.916136
+1.931591	0.352091	1.925909
+2.264385	6.365246	1.918689
+2.487353	5.909225	1.938102
+2.580691	6.379724	1.924608
+2.608087	4.368634	1.919235
+2.776284	0.769128	1.928349
+2.835910	6.328648	1.930295
+3.170375	6.014250	1.919000
+3.622787	5.517541	1.911967
+4.148733	6.375067	1.909667
+0.607845	3.400276	1.941188
+1.143065	3.965645	1.924032
+1.650435	3.521818	1.936522
+1.894806	1.801395	1.928915
+2.114975	4.675990	1.935939
+2.221935	5.882608	1.943817
+2.434364	4.559364	1.934636
+2.444000	2.197294	1.925882
+2.671799	6.103422	1.937670
+2.982667	1.759667	1.926250
+3.277480	4.658880	1.939240
+3.631765	2.522549	1.918431
+3.761321	4.496011	1.943558
+4.363033	6.259180	1.926393
+4.491238	5.317143	1.932667
+4.593481	2.118191	1.938840
+4.592968	2.821677	1.924645
+0.587750	4.353750	1.932500
+0.875672	1.701940	1.929701
+1.017064	0.594771	1.942615
+1.078911	2.672376	1.940099
+1.717011	4.207346	1.950754
+2.289366	1.996828	1.946082
+2.419091	0.940455	1.937879
+2.418067	3.526267	1.941733
+2.555841	2.470354	1.940442
+2.584231	5.235962	1.935577
+2.881471	4.706569	1.934706
+3.018433	2.388571	1.947465
+3.731520	3.908922	1.940931
+3.948571	2.596000	1.930571
+4.029376	0.329792	1.953222
+4.029186	0.052558	1.939186
+4.064748	3.169928	1.941871
+4.129091	1.916733	1.952614
+4.356326	0.370447	1.952236
+4.442838	1.236824	1.946284
+4.609423	1.064615	1.926346
+0.588276	2.952931	1.940000
+0.909754	0.021921	1.962660
+1.423832	5.248598	1.947944
+1.544714	5.465500	1.945357
+1.807324	5.023239	1.943662
+2.653214	3.619732	1.942411
+3.011233	0.856575	1.947671
+3.283732	6.235455	1.951148
+3.297656	3.778205	1.962784
+3.316973	2.139027	1.955081
+3.482636	6.385182	1.943727
+3.563961	4.107488	1.950097
+3.612580	0.546953	1.968010
+3.901389	3.722500	1.942593
+3.992083	0.694435	1.963512
+4.014368	2.152414	1.947586
+4.109179	3.876188	1.955660
+4.132675	1.633640	1.957807
+4.144792	5.756771	1.944375
+4.184151	2.634717	1.936981
+4.588851	3.529109	1.960517
+4.608621	0.565000	1.952069
+0.599724	1.865690	1.969414
+1.276845	5.027798	1.970516
+1.347785	3.016203	1.957278
+1.569012	2.454691	1.954691
+1.631862	2.211034	1.960897
+2.047892	1.602973	1.967784
+2.160577	2.835192	1.943846
+2.340818	2.647636	1.958364
+2.676269	2.130746	1.951642
+2.845319	4.286596	1.950638
+3.054428	1.125161	1.978270
+3.235781	0.310625	1.957656
+3.516241	3.162766	1.959291
+3.558919	2.064414	1.956937
+3.697763	5.255263	1.950526
+4.106194	0.952090	1.965858
+4.365345	5.015309	1.965855
+4.383235	3.015647	1.965000
+4.591244	4.877358	1.959171
+4.608263	0.274324	1.969846
+0.582742	2.327097	1.966452
+0.586609	4.106781	1.982103
+0.605129	0.398635	1.978007
+1.062565	3.661299	1.982305
+1.221848	1.986250	1.971033
+1.343731	4.488846	1.976962
+1.816048	1.309435	1.974355
+1.920575	5.339342	1.985068
+1.975764	0.926650	1.977931
+1.984815	6.057901	1.966914
+2.453108	1.362973	1.957973
+2.714261	4.879478	1.964522
+2.922346	2.111006	1.972291
+3.515600	1.251000	1.962400
+3.532716	2.745000	1.967840
+3.910978	5.125378	1.969956
+4.594306	5.538056	1.958056
+4.618571	0.818413	1.967778
+0.976269	4.129254	1.965970
+1.000636	1.354162	1.978902
+1.350761	5.618122	1.982284
+1.511677	2.706129	1.978581
+1.529780	5.866154	1.973626
+1.796995	4.662759	1.982906
+1.948786	0.096837	1.990863
+2.303762	3.282257	1.987053
+2.745242	5.613855	1.999758
+2.989757	3.602014	1.991319
+3.247722	5.540116	1.984015
+3.465618	2.341798	1.969663
+3.816589	2.000047	1.982757
+4.129800	1.379200	1.975600
+4.148162	2.900515	1.983971
+4.156206	2.382286	1.997186
+4.399610	2.281818	1.975325
+4.593484	1.729895	1.977317
+0.584767	5.428178	1.993566
+0.589474	1.141789	1.984316
+0.832141	3.188498	2.002268
+0.980847	4.947619	1.988783
+1.262727	3.278977	1.986364
+1.344229	1.410647	1.991592
+1.452771	4.245582	1.999880
+1.747565	5.989026	2.000617
+2.515016	0.101286	1.996945
+2.584270	2.741601	2.002633
+3.248976	3.507831	2.002048
+3.407965	0.733473	2.003650
+3.492736	4.529623	1.980472
+4.252364	5.348909	1.993273
+4.584740	0.019769	1.995376
+4.618125	1.462411	1.993929
+0.577636	2.573273	1.988727
+0.627368	5.862693	2.007926
+1.196559	4.228925	1.998387
+1.394943	0.021364	2.006648
+1.410984	1.815902	1.995164
+2.053976	2.439277	1.987229
+2.361309	5.326806	2.004764
+2.522373	0.713458	2.006305
+2.632372	1.802051	1.998654
+2.657153	3.004555	2.006619
+2.925741	6.073651	2.013307
+2.978488	4.488023	1.998023
+3.057667	2.820444	1.996778
+3.155298	0.566905	2.000774
+3.238784	0.939189	1.990676
+3.897073	2.363780	1.998171
+3.918272	5.634319	2.010930
+4.123545	4.842075	2.007032
+4.593560	6.203400	2.006480
+1.174200	2.322600	2.009200
+1.546163	4.647558	2.001047
+1.555833	5.043222	2.011778
+1.610522	0.687130	2.011043
+1.961404	2.693509	1.997544
+2.041250	6.298672	2.011797
+2.046462	4.439923	2.009000
+2.130658	2.191118	2.007829
+2.268945	5.579592	2.022926
+2.285214	1.526923	2.010342
+3.361429	4.290592	2.014321
+3.431004	5.352450	2.013414
+3.857138	4.864862	2.020069
+3.945433	1.157647	2.022768
+3.984836	4.348770	2.013852
+0.793333	3.738519	2.027619
+0.799692	5.170359	2.018462
+0.802037	4.507506	2.041304
+0.800884	6.062376	2.021768
+0.791084	0.227711	2.015060
+0.815826	0.741826	2.023957
+0.864505	3.472192	2.031892
+1.116316	1.101283	2.027566
+1.278189	5.882189	2.027887
+1.713185	0.223926	2.027506
+2.077531	3.628364	2.030370
+2.255063	3.823797	2.009747
+3.021623	3.330026	2.031597
+3.127602	1.958480	2.023743
+3.166277	1.588701	2.024762
+3.606283	5.935664	2.019292
+3.906634	1.498414	2.026926
+4.254737	4.538195	2.014286
+4.357500	3.831250	2.016750
+4.375567	0.657730	2.033156
+4.492848	4.443671	2.017722
+0.794806	1.491473	2.028062
+0.779167	5.640417	2.028229
+0.818386	2.508133	2.043544
+1.142615	1.556308	2.017231
+1.511642	3.304627	2.029403
+1.814223	2.045340	2.028592
+2.140963	3.076741	2.037370
+2.324270	2.406180	2.028989
+2.436410	3.972308	2.018462
+2.546941	0.455434	2.038950
+2.671716	3.900539	2.032647
+2.741711	0.308684	2.023947
+2.811584	5.326739	2.035870
+2.790000	3.440319	2.031170
+3.379000	2.953600	2.037486
+3.419017	4.856532	2.034682
+3.682273	2.950909	2.037098
+3.874332	3.313529	2.028877
+4.028720	3.519040	2.025440
+4.046115	5.967962	2.031975
+4.398168	0.943194	2.040209
+4.574088	5.787409	2.032336
+4.630323	2.358710	2.016774
+0.561169	4.797922	2.037922
+1.030769	0.855000	2.033077
+1.040110	5.438453	2.040110
+1.116615	5.681385	2.030154
+1.292611	0.273744	2.047734
+1.323064	3.551272	2.042717
+1.390851	2.210213	2.033511
+2.101905	1.350595	2.031548
+2.255849	0.083606	2.049371
+2.709200	1.416267	2.031067
+3.066550	6.373755	2.042751
+3.178140	4.930698	2.031473
+3.324522	1.379478	2.034000
+3.377322	5.756995	2.039945
+3.467260	1.626575	2.042466
+3.493317	0.236277	2.054033
+3.755904	0.051165	2.054940
+3.770923	2.707385	2.035077
+3.773524	6.145619	2.035048
+3.924381	1.772286	2.034000
+4.147148	4.135387	2.052218
+4.264583	3.445000	2.035000
+0.570000	1.378525	2.046721
+1.231121	0.703049	2.050269
+2.262292	4.332708	2.042917
+2.314286	6.101203	2.048647
+2.524220	1.575780	2.050000
+2.643492	0.955794	2.055992
+2.726216	4.554775	2.044234
+2.770989	1.175714	2.046044
+2.951274	1.362972	2.056085
+3.010172	5.816978	2.063440
+3.133100	4.169100	2.057500
+3.241429	2.459206	2.055952
+3.280400	2.703200	2.040200
+3.513308	3.523308	2.048462
+4.246790	0.026914	2.039136
+4.400794	2.517143	2.045714
+4.612660	3.795638	2.056277
+4.611813	5.123212	2.047772
+4.625170	3.061818	2.049318
+4.625298	4.221192	2.052318
+0.556833	5.155833	2.058333
+0.787362	6.321411	2.061166
+0.795714	3.984000	2.049429
+1.279182	2.768931	2.057547
+1.595463	1.401806	2.062685
+1.958232	4.855016	2.064695
+2.005167	5.580958	2.059417
+2.055240	1.947644	2.063750
+2.495191	4.980710	2.064426
+2.930285	4.971585	2.068943
+2.990435	0.390580	2.056812
+3.303876	3.247697	2.062416
+3.536868	3.790495	2.065275
+3.621657	1.837426	2.072130
+3.731875	0.341250	2.059271
+3.971595	4.621396	2.069202
+3.982186	5.365628	2.060283
+4.371243	2.770113	2.060339
+4.377596	4.761672	2.072648
+4.406168	6.012243	2.061589
+0.784043	2.049574	2.055532
+0.985799	1.905465	2.076171
+1.019766	5.918361	2.083396
+1.715368	2.839789	2.060421
+1.778278	2.541483	2.074163
+1.852908	0.718652	2.070142
+1.949181	4.135198	2.081299
+2.288604	0.483063	2.070225
+2.285183	4.821829	2.069939
+2.796049	0.555640	2.083515
+2.814655	1.637471	2.075000
+2.930000	3.290000	2.040000
+3.051017	5.253559	2.058136
+3.412813	6.068854	2.068333
+3.952549	6.355724	2.075054
+4.218827	1.171349	2.082639
+0.573353	3.168699	2.086705
+0.788315	4.237865	2.074270
+0.905652	2.771848	2.076630
+1.027333	0.233200	2.078200
+1.257079	3.807423	2.090550
+1.449377	6.077574	2.083082
+1.570000	4.035109	2.079891
+1.640215	6.242903	2.077204
+1.735085	5.735495	2.090717
+1.794983	3.912594	2.093481
+2.030605	0.536178	2.084936
+2.220339	4.084373	2.094271
+2.479274	3.731129	2.083468
+2.558621	4.723621	2.068793
+2.555447	3.237977	2.089027
+2.992606	5.526704	2.092205
+3.341887	1.132830	2.074906
+3.623694	5.688949	2.096667
+3.740606	1.300152	2.075606
+3.769837	3.553455	2.078659
+4.153537	5.126234	2.094453
+4.164444	6.188593	2.089407
+4.394919	1.922298	2.081815
+0.556320	6.102320	2.083200
+0.561314	3.617371	2.095771
+0.752105	4.927368	2.082281
+0.999333	6.202800	2.079467
+1.501767	0.915700	2.094333
+1.748140	1.677791	2.085465
+1.776667	0.468014	2.087660
+1.827143	6.388667	2.090476
+2.035360	3.362882	2.103343
+2.145714	0.775764	2.091527
+2.162061	1.120611	2.091221
+2.211169	1.748831	2.084286
+2.264348	5.085466	2.091801
+2.478853	4.217202	2.091743
+2.505514	2.022243	2.086075
+2.696595	5.867500	2.091897
+2.711333	5.095333	2.077333
+2.847944	1.895234	2.084673
+2.887076	3.120292	2.098421
+2.916125	0.151500	2.095500
+3.135962	3.048732	2.089624
+3.383502	0.480135	2.099697
+3.540936	5.127362	2.100681
+3.613944	4.327746	2.097218
+3.782905	0.942997	2.095719
+4.155364	0.519136	2.092091
+4.150759	5.555063	2.080253
+4.226458	2.131956	2.094207
+4.409004	4.077925	2.093402
+0.567415	1.635122	2.103415
+0.786949	1.247797	2.095085
+1.540741	2.017325	2.107695
+1.562960	3.770072	2.107509
+1.665532	1.155957	2.092234
+1.879114	2.294629	2.116057
+2.014615	5.112821	2.103590
+2.579267	5.425267	2.098800
+3.075113	4.702105	2.103985
+3.121088	2.208435	2.102109
+3.675556	2.364444	2.086296
+3.816040	4.178020	2.096634
+4.357733	1.653600	2.094400
+4.405106	3.237943	2.099078
+4.621818	4.653826	2.102273
+4.645965	1.235263	2.093158
+0.556133	2.102533	2.099867
+0.568761	0.176018	2.104867
+0.576637	0.655045	2.115646
+0.833603	0.994377	2.121448
+0.846966	0.461241	2.114483
+1.237619	5.288762	2.108048
+1.812065	4.431336	2.119717
+1.898190	3.142381	2.104952
+2.388089	3.035689	2.120578
+2.507339	5.682817	2.118941
+2.922638	3.840624	2.117554
+3.010101	2.598480	2.116453
+3.473810	2.545714	2.097381
+3.901585	0.499390	2.104146
+3.910709	3.065787	2.122756
+0.560725	2.787874	2.119130
+0.760946	2.965946	2.122905
+1.322464	4.056957	2.111739
+1.361250	1.139145	2.118224
+1.703944	5.388239	2.122324
+1.710353	4.871529	2.114235
+1.820206	3.626186	2.117629
+1.900886	1.126835	2.108228
+2.261901	4.569091	2.117769
+2.583000	2.281000	2.102750
+2.825153	2.377761	2.128098
+2.809674	4.093370	2.118804
+3.273712	5.156564	2.127178
+3.635755	3.316763	2.120144
+4.324330	5.761134	2.124089
+4.411787	5.503992	2.131103
+4.649231	1.927885	2.111346
+0.551966	3.885674	2.129719
+0.555569	4.557294	2.138275
+0.546667	5.645580	2.133986
+0.810897	5.401410	2.122949
+0.955714	4.711579	2.124962
+0.997411	3.872946	2.129955
+1.108868	3.441698	2.113019
+1.145826	0.467982	2.131101
+1.152000	4.565286	2.130571
+1.202430	4.822077	2.138063
+1.203784	1.767432	2.120000
+1.456165	4.840226	2.125789
+1.490000	2.903231	2.124000
+1.647093	3.108789	2.138443
+1.776316	3.384211	2.115263
+2.163846	2.611905	2.136190
+2.405021	1.196008	2.134856
+2.684924	6.281667	2.138485
+2.839808	2.870577	2.125577
+3.139823	6.151947	2.129558
+3.196327	4.462836	2.135200
+3.573822	6.255096	2.125987
+3.656811	5.418993	2.147458
+3.825586	5.871650	2.142485
+3.989574	2.774255	2.128617
+4.610000	6.400000	2.115000
+4.651935	2.584839	2.114839
+0.750847	2.276780	2.130339
+1.007343	4.362841	2.146679
+1.054857	3.197048	2.143905
+1.093226	2.130645	2.136290
+1.148511	2.539198	2.146870
+1.397500	1.610972	2.134028
+1.478368	0.429540	2.142887
+1.956739	2.887826	2.131522
+2.071818	5.810341	2.136591
+2.118529	0.291912	2.147831
+2.135816	5.366667	2.136099
+3.140367	0.771193	2.137706
+3.162515	0.126140	2.140058
+3.230968	5.925242	2.142339
+4.174286	3.687143	2.124762
+4.206526	3.093368	2.134211
+4.210357	0.256339	2.136250
+4.407500	3.617000	2.134500
+4.395308	5.213077	2.141615
+4.415162	1.400767	2.152507
+4.631796	5.370299	2.138623
+4.638768	3.329668	2.144739
+0.725769	0.011538	2.143077
+1.189904	2.992596	2.145673
+1.205313	6.091875	2.146250
+1.552146	4.443765	2.151619
+1.863077	6.165275	2.147363
+1.881498	1.473921	2.161145
+2.058674	3.878934	2.163343
+2.267667	3.493250	2.141083
+2.409433	0.275709	2.160324
+2.538093	6.067034	2.156907
+2.706038	4.323585	2.157673
+3.175084	3.926034	2.150838
+3.402000	1.999533	2.150733
+3.403823	4.059932	2.162765
+3.543250	1.409500	2.137750
+3.603115	1.115246	2.137213
+3.640714	4.899524	2.137857
+3.728028	4.658451	2.148451
+3.949091	3.960663	2.165430
+4.095529	3.311294	2.147882
+4.170077	0.777846	2.144538
+0.547103	4.291121	2.163364
+0.763068	1.798125	2.163693
+0.964842	1.645579	2.158947
+0.982316	2.344737	2.153789
+1.188416	6.354505	2.152871
+1.390000	2.435596	2.156943
+1.757308	0.930000	2.168974
+1.762865	5.124568	2.176432
+2.336484	2.193077	2.157637
+2.364068	5.890085	2.159237
+2.873426	0.814143	2.165857
+3.288095	1.775000	2.155833
+3.701152	1.596848	2.158121
+3.820602	2.187349	2.154096
+3.974979	0.170083	2.162075
+3.999014	2.018310	2.161690
+4.458750	0.176977	2.166570
+4.635104	6.004583	2.155313
+0.539452	6.359726	2.162123
+1.111912	5.080735	2.161618
+1.173802	1.315950	2.159421
+1.426538	6.361394	2.163221
+1.493750	0.172880	2.178315
+1.499512	5.719878	2.158780
+1.540522	3.511381	2.185075
+2.233846	6.302010	2.184293
+2.325909	0.944848	2.178636
+2.443762	1.780396	2.166733
+2.510236	4.498850	2.179027
+2.555161	3.489677	2.168581
+2.761429	2.632976	2.161905
+2.953587	4.298804	2.169239
+3.041961	1.763007	2.169346
+3.616667	0.750698	2.163643
+3.654478	4.002836	2.166119
+3.936098	2.528699	2.176748
+4.193073	2.576094	2.179792
+4.403199	6.264412	2.172831
+4.649162	0.438534	2.174712
+4.646818	0.970455	2.173364
+0.562948	0.922500	2.182724
+1.232563	0.929625	2.183000
+1.395391	3.129565	2.177478
+1.455862	5.471724	2.172414
+1.513275	5.228838	2.191690
+1.630000	2.352642	2.173962
+1.975432	1.729388	2.185252
+2.095792	6.066264	2.200000
+2.706423	3.697664	2.179927
+3.352500	2.274000	2.168000
+3.420766	5.547033	2.182392
+3.445309	0.933454	2.184021
+3.774430	5.188228	2.171646
+4.598396	0.698160	2.191132
+1.290494	4.352889	2.207901
+2.199503	2.872762	2.191989
+2.405682	2.716909	2.196227
+2.480121	5.201660	2.198826
+2.684660	0.133223	2.206816
+2.749524	2.126786	2.182857
+2.786192	4.785771	2.201519
+3.142051	1.252692	2.186026
+3.581613	2.164032	2.180161
+3.946216	3.693514	2.183784
+4.071129	5.770040	2.191976
+4.167484	1.799097	2.199161
+4.618390	2.832634	2.196000
+4.660879	2.176374	2.189231
+0.967097	6.395484	2.192581
+1.094411	4.113042	2.204753
+1.440233	0.680543	2.195581
+1.559245	1.776415	2.194717
+2.146484	2.354176	2.199011
+2.554470	2.510000	2.195606
+3.163171	3.668902	2.193171
+3.193924	5.676181	2.206354
+3.329944	4.684551	2.197022
+3.341556	6.256778	2.193222
+3.536947	3.093009	2.209469
+3.739000	6.399000	2.183000
+4.026341	1.337268	2.198976
+4.166885	1.538361	2.191639
+4.198421	6.395000	2.191579
+4.382673	0.435220	2.210094
+4.450755	1.142453	2.191887
+1.297129	2.004484	2.218258
+2.061166	0.045276	2.210491
+2.271905	1.949524	2.199206
+2.357535	0.685634	2.205986
+2.935097	1.081039	2.219662
+3.455878	2.766486	2.208446
+3.908841	0.734663	2.220647
+3.944050	6.113524	2.224622
+3.944964	5.021241	2.210438
+4.167455	4.397818	2.205545
+4.217346	3.927668	2.216756
+4.320909	2.352576	2.199848
+4.644932	4.014527	2.222162
+0.546171	4.967229	2.230286
+0.794988	5.873963	2.237063
+0.938995	1.398141	2.227839
+1.378696	4.616377	2.210145
+1.576901	2.599624	2.226761
+1.709559	0.040662	2.210882
+1.711315	4.204877	2.230247
+1.867353	5.915686	2.214804
+2.139429	1.523048	2.216619
+2.437897	0.026172	2.235483
+2.552532	1.393427	2.237519
+2.779231	6.067527	2.227143
+3.197966	5.394972	2.227712
+3.182977	0.370194	2.229968
+3.527436	4.536026	2.215641
+3.823897	4.436197	2.220939
+4.033324	0.981633	2.229799
+4.051071	2.296952	2.239571
+4.178615	4.682872	2.222103
+4.335427	4.975366	2.224390
+4.437099	3.013969	2.220611
+4.589375	4.924010	2.217031
+4.655200	4.425600	2.218800
+0.539691	1.890619	2.224845
+0.536207	5.345402	2.240000
+0.637690	2.540854	2.240316
+1.261603	0.078092	2.228550
+1.265203	5.713514	2.224459
+1.347788	5.039135	2.224712
+1.779434	1.883208	2.229434
+1.862513	4.668901	2.228534
+1.884957	0.220261	2.224174
+2.224472	3.230081	2.227724
+2.341617	3.891320	2.240231
+2.359027	5.445324	2.240405
+2.907598	4.545196	2.229497
+2.924014	6.293116	2.247746
+2.978594	2.048906	2.220156
+3.152688	2.795336	2.236759
+3.198987	1.003671	2.239968
+3.322577	1.536810	2.232086
+3.683622	2.563465	2.232441
+3.690233	0.518915	2.229690
+4.184185	5.364630	2.240148
+4.646733	3.587833	2.232867
+4.651234	1.701591	2.241396
+0.554754	1.190352	2.241937
+0.550313	3.396677	2.245549
+0.562153	0.419059	2.256757
+0.669000	4.084143	2.231143
+0.727874	4.739275	2.238986
+0.967442	5.256860	2.230000
+1.024021	5.601678	2.250420
+1.320794	3.363730	2.238254
+1.416844	1.364867	2.252625
+1.656827	6.053896	2.240482
+2.027823	0.954962	2.246937
+2.102826	4.716522	2.226304
+2.651552	1.898103	2.232414
+2.844092	5.705036	2.247482
+2.931220	3.522857	2.244821
+3.012581	0.574919	2.247581
+3.070412	1.488765	2.244882
+3.172584	3.419101	2.234045
+3.475926	5.874321	2.231728
+3.649030	6.042313	2.235597
+4.225163	5.981276	2.246142
+4.389205	4.512045	2.230568
+4.463333	4.275789	2.237544
+0.768354	3.583171	2.257866
+0.933128	4.935922	2.248324
+0.950558	0.055020	2.250000
+1.029200	3.636831	2.260369
+1.099021	2.776154	2.248112
+1.679623	0.639434	2.242264
+1.815424	2.718644	2.250678
+1.956966	2.517528	2.247753
+2.034303	2.129084	2.259801
+2.593182	0.785682	2.236364
+2.741245	3.332101	2.256926
+3.815500	1.862333	2.241750
+3.814070	5.604186	2.240349
+3.948471	1.642851	2.255950
+4.208840	2.830552	2.248619
+4.560779	2.402532	2.248312
+0.533282	5.879590	2.266667
+0.540897	2.290493	2.269507
+0.757041	0.234794	2.266067
+0.770000	3.199115	2.255929
+1.187203	1.557106	2.271286
+1.236566	2.272929	2.268283
+1.670353	0.328471	2.261294
+1.718793	2.133448	2.255000
+1.994806	6.348101	2.255853
+2.031186	1.280339	2.270169
+2.036255	4.475404	2.265660
+2.161015	5.617481	2.268722
+2.640056	1.646348	2.268090
+2.629091	2.807500	2.256364
+2.668134	0.403085	2.271294
+2.815392	1.458387	2.260046
+3.056139	5.089430	2.262975
+3.390847	0.081230	2.265628
+3.375505	1.288165	2.264037
+3.417197	4.973131	2.275025
+3.436842	3.339684	2.260526
+3.446073	5.304977	2.272283
+3.704887	3.764561	2.274712
+3.717385	2.820769	2.248462
+3.838925	1.156262	2.263271
+4.656000	1.426333	2.259556
+0.755857	1.567143	2.262571
+0.756000	5.123838	2.268432
+0.757068	5.601142	2.280710
+0.795469	0.665429	2.275184
+0.928729	3.390847	2.272966
+0.973253	2.993373	2.258434
+1.594634	1.550366	2.268415
+1.612051	4.697436	2.268718
+2.101905	4.227619	2.262381
+2.131690	4.963451	2.265423
+2.421176	4.736642	2.286225
+2.561353	4.041014	2.270531
+2.688176	3.060486	2.274863
+2.939231	5.329402	2.273704
+3.019390	5.986098	2.276402
+3.115728	2.407616	2.276594
+3.411257	4.315286	2.279829
+3.853151	3.402059	2.277773
+3.984400	4.248933	2.259600
+4.437121	2.633485	2.268737
+4.436556	2.091000	2.262778
+4.458667	3.832917	2.262000
+4.640505	6.229343	2.266263
+0.760000	2.768070	2.268070
+0.923722	2.574233	2.287670
+0.990000	0.844112	2.271776
+1.468626	2.192748	2.278931
+1.704625	1.330875	2.287125
+1.903922	5.670915	2.287353
+2.006818	3.565808	2.278737
+2.054896	3.059167	2.275000
+2.478623	6.318000	2.294522
+2.552931	1.037915	2.291118
+2.919823	0.318009	2.291416
+2.988000	3.267000	2.273750
+3.001543	4.072394	2.280798
+3.168137	6.387081	2.286087
+3.175388	4.865437	2.286602
+3.513617	1.714468	2.268723
+3.612803	3.508333	2.283182
+3.644044	0.138603	2.278971
+3.911114	4.771969	2.293057
+4.083684	3.521729	2.282857
+4.219635	0.055401	2.279489
+4.430462	3.414740	2.283237
+0.534896	2.981354	2.280208
+0.539762	1.450952	2.285794
+0.738805	6.380377	2.290377
+0.862632	2.106813	2.296199
+1.003663	6.083762	2.282673
+1.064242	1.127980	2.287475
+1.160792	0.667624	2.286931
+1.331145	2.665771	2.295066
+1.322007	3.622847	2.301204
+1.442529	5.917529	2.287241
+1.473026	4.126842	2.287500
+2.294722	4.386333	2.285833
+2.375283	1.582170	2.285566
+2.597759	4.935862	2.284310
+2.993675	2.984701	2.290000
+3.402462	3.823231	2.301169
+3.502902	0.346814	2.300757
+3.815366	0.317154	2.285285
+3.809111	1.414667	2.278889
+3.835000	0.012353	2.288529
+4.049452	0.381918	2.279589
+4.635596	5.791927	2.280917
+0.737525	3.838416	2.291881
+0.766949	6.126949	2.295678
+0.889888	4.544906	2.309288
+0.995919	0.343860	2.305699
+1.243481	5.465414	2.299834
+1.301474	0.317053	2.289158
+1.400891	3.880545	2.307475
+1.549434	3.282453	2.292830
+1.733622	6.297135	2.300270
+1.870260	4.919545	2.303247
+1.878746	5.385559	2.312508
+2.326752	2.496838	2.303419
+2.335321	6.088899	2.294312
+2.372500	4.996176	2.295882
+2.537000	2.147000	2.293667
+2.688077	5.312051	2.294103
+2.806579	5.069123	2.304211
+3.211910	3.179775	2.297865
+3.339164	2.554695	2.312154
+3.331596	2.967766	2.290638
+3.895765	5.356588	2.294235
+4.244308	4.182923	2.289385
+4.662733	3.115291	2.298895
+0.751993	4.313838	2.320000
+1.538627	1.126415	2.318319
+1.645977	3.957931	2.304368
+1.913262	0.464946	2.313692
+1.899444	0.730185	2.318843
+2.133571	0.638333	2.302540
+2.236220	5.210697	2.320590
+2.397732	3.636320	2.316729
+2.633071	5.551929	2.310857
+2.730455	1.218030	2.300909
+3.160326	4.271739	2.299239
+3.530949	2.369854	2.305182
+4.398750	1.773571	2.310357
+4.431007	0.927987	2.306577
+4.654881	5.546071	2.308571
+1.034404	1.827294	2.325275
+1.667129	5.537129	2.315248
+1.808305	2.995254	2.321017
+1.821579	3.259323	2.322406
+1.863754	3.780853	2.326109
+2.280738	0.423839	2.335423
+2.453527	3.169130	2.333961
+2.610513	5.814103	2.330000
+2.789000	3.943400	2.311400
+2.992827	0.062560	2.330107
+3.591910	1.952022	2.310337
+3.616842	1.272406	2.323985
+3.658873	0.963237	2.334393
+4.035135	5.552973	2.315811
+4.373533	0.673952	2.322575
+4.456545	6.058364	2.304727
+4.658056	1.937611	2.342333
+4.635922	5.171714	2.328494
+0.523802	6.131818	2.330661
+0.808188	1.174161	2.334396
+0.886316	4.028246	2.317368
+1.350959	2.928082	2.326233
+1.349774	1.762594	2.337030
+1.436729	6.169159	2.324206
+1.607204	2.830645	2.325161
+1.672965	5.804024	2.345271
+1.764571	3.503905	2.325333
+2.195371	1.752522	2.343501
+2.247810	0.165143	2.324095
+2.769763	0.646126	2.337510
+2.852417	1.800083	2.325917
+2.905813	2.750813	2.332063
+3.351348	3.562809	2.323371
+3.580379	4.759300	2.341137
+3.807800	2.359800	2.333200
+3.993939	2.932727	2.319091
+4.124643	4.903750	2.324107
+4.667572	1.175723	2.336879
+1.100163	4.688455	2.339756
+1.150417	3.856111	2.331944
+1.427724	0.885854	2.339919
+1.627273	4.941818	2.332078
+1.832841	1.112564	2.357460
+2.200502	5.866164	2.344110
+2.211111	1.108889	2.325333
+2.316545	1.326364	2.336000
+2.528876	4.289438	2.332247
+2.919189	2.246892	2.334730
+3.125647	4.609964	2.353345
+3.287625	0.785000	2.335750
+3.481770	0.617472	2.350787
+3.670000	5.776667	2.330575
+3.698936	5.015390	2.349858
+3.800565	4.102177	2.340565
+3.991479	3.188343	2.343728
+4.119919	0.619514	2.344332
+4.165064	2.080833	2.345513
+4.246782	1.087356	2.334253
+4.407130	4.747523	2.345257
+0.522449	3.678571	2.342653
+1.201657	3.132857	2.351943
+1.207157	5.206559	2.364190
+1.202581	5.947903	2.354839
+1.791458	1.662917	2.343542
+1.981179	5.146103	2.355487
+2.331716	4.132781	2.353018
+2.385802	5.702099	2.339753
+2.387885	2.918077	2.356474
+2.680199	2.343625	2.358645
+3.430882	6.086029	2.346912
+3.523671	6.341529	2.362071
+3.776242	3.045839	2.346107
+4.163250	6.223114	2.364565
+4.240382	1.359013	2.355669
+4.447692	5.365128	2.351923
+0.552811	0.081281	2.372792
+0.781872	2.355882	2.364439
+1.157708	4.938819	2.363125
+1.541076	1.959861	2.372396
+1.600880	3.706053	2.370240
+1.730484	4.482881	2.369007
+2.778479	4.192350	2.362166
+2.888904	2.496849	2.354247
+3.046339	0.828142	2.363989
+3.149677	2.155806	2.359113
+3.199487	6.139231	2.358846
+3.768482	6.249805	2.365058
+3.913173	2.709904	2.355865
+4.016631	4.533690	2.366043
+4.303571	3.656964	2.355060
+4.666606	4.712294	2.352936
+4.673146	2.648652	2.353146
+0.528169	1.691831	2.361127
+0.568462	0.743956	2.366374
+0.744884	5.351163	2.362558
+0.764211	0.908129	2.369532
+1.191875	6.205313	2.360000
+1.396070	4.816422	2.376716
+1.811374	2.345906	2.379883
+2.001034	2.834828	2.365402
+2.496292	0.564607	2.365618
+2.776173	0.940864	2.366543
+3.123448	1.909655	2.359655
+3.170500	1.678000	2.359250
+3.240385	4.043846	2.368385
+3.417037	2.139185	2.378543
+3.528723	1.494681	2.360426
+3.653333	3.264651	2.370310
+3.678462	5.280000	2.370513
+4.202590	5.138012	2.372048
+4.401149	5.817241	2.362644
+4.661789	4.229368	2.369368
+0.526343	3.932090	2.382164
+0.532703	2.741689	2.379932
+0.553072	4.472440	2.395361
+0.617107	2.071322	2.378512
+1.112892	2.081010	2.393275
+1.350500	0.543083	2.376167
+1.442102	5.627159	2.380625
+1.863023	4.047674	2.376163
+1.861135	6.098298	2.381418
+1.875315	0.031748	2.380909
+1.987439	1.903049	2.374756
+2.054444	3.331778	2.364444
+2.146615	3.755795	2.387231
+2.271176	3.423971	2.373382
+2.715613	4.459368	2.387589
+2.948476	3.759529	2.385374
+3.267766	5.893040	2.390220
+3.361522	1.868478	2.381449
+3.553596	4.093933	2.371236
+3.623432	5.535680	2.386509
+3.911919	2.113023	2.382965
+4.013902	1.888780	2.376585
+4.205610	0.850732	2.372439
+4.218571	3.042619	2.374524
+4.278618	5.563309	2.391564
+4.592744	0.291353	2.388496
+0.520000	5.649462	2.389785
+1.002201	4.273684	2.394593
+1.240000	6.400000	2.370000
+1.485970	4.360224	2.382761
+1.906618	4.296176	2.381471
+2.107473	4.021648	2.382527
+2.220497	0.852236	2.393230
+2.485274	0.227221	2.411444
+2.591718	3.800264	2.392643
+2.689545	3.561212	2.384091
+2.943923	4.881077	2.390538
+2.958750	1.291389	2.403090
+3.258333	5.177937	2.385397
+3.425702	5.694737	2.387632
+3.430955	1.081180	2.394270
+3.882935	0.534457	2.379239
+3.911004	5.781632	2.390962
+4.280144	0.282383	2.397220
+4.443231	4.063593	2.398078
+4.447670	1.530000	2.393252
+4.438884	0.046884	2.396000
+4.676522	3.811522	2.378261
+0.526633	4.197437	2.406080
+0.524194	4.753978	2.398118
+0.768686	2.989705	2.411528
+0.774160	1.879920	2.403680
+0.961270	1.587540	2.403413
+1.049200	2.371000	2.390900
+1.258919	4.073243	2.403784
+1.479800	5.374200	2.400300
+1.533780	2.407835	2.406850
+2.670702	2.614503	2.396784
+3.052407	5.762685	2.397407
+3.227742	0.552742	2.408656
+3.546164	2.914795	2.389452
+3.721389	0.711944	2.398796
+4.053102	4.046241	2.403431
+4.088291	3.777778	2.397949
+4.210945	3.325879	2.407585
+0.524737	6.376165	2.419286
+0.964446	6.305997	2.426780
+0.995426	5.806628	2.413915
+1.293852	1.102295	2.412623
+1.552945	3.063630	2.408356
+1.601226	0.139811	2.407925
+1.671055	0.901350	2.415654
+2.058261	0.291196	2.409348
+2.223901	4.603369	2.418050
+2.344700	2.260950	2.409650
+2.507903	3.405161	2.401935
+2.609849	6.076679	2.413132
+2.962419	4.376250	2.417782
+3.206049	0.185556	2.398395
+3.667917	2.167917	2.398750
+3.742670	1.610631	2.415777
+3.885373	3.625672	2.408731
+4.044776	0.174627	2.408284
+4.415576	2.850643	2.425630
+4.637895	3.344737	2.398684
+4.669538	0.828615	2.415538
+4.664654	0.551567	2.420276
+0.529371	5.153457	2.427486
+0.532954	3.193077	2.426615
+0.726667	4.917246	2.412174
+0.769685	0.437244	2.420000
+0.974314	5.413268	2.423072
+1.139507	3.376761	2.417042
+1.701048	5.193100	2.422926
+2.111667	5.416250	2.407361
+2.195323	2.681255	2.420875
+2.647500	4.711333	2.411750
+3.201273	1.192061	2.425152
+3.768780	4.591585	2.429065
+4.006111	2.488333	2.417333
+4.038687	1.197879	2.417475
+4.434212	3.170322	2.431768
+4.659278	5.996495	2.413918
+0.736604	3.380377	2.427830
+0.955324	3.192676	2.440971
+0.980706	0.568941	2.418353
+1.113259	0.146593	2.434593
+1.192778	0.869630	2.430494
+1.223846	1.350769	2.417231
+1.453488	5.126628	2.426279
+2.168200	6.331188	2.445840
+2.203514	2.020324	2.428865
+2.572568	5.132568	2.441694
+2.709655	2.036724	2.417759
+2.840769	5.887038	2.442462
+2.945842	5.540368	2.430737
+3.109725	2.625902	2.438043
+3.124560	3.568160	2.429280
+3.553667	2.674000	2.416333
+3.956907	5.141546	2.426186
+4.003960	1.452819	2.425772
+4.173000	5.794667	2.420222
+4.208846	1.605577	2.417885
+4.227353	2.645294	2.424902
+4.233978	2.374199	2.437735
+4.418089	6.271178	2.435796
+4.681974	0.041053	2.433816
+0.532662	0.991295	2.441439
+0.934702	3.803841	2.445232
+0.978132	5.097253	2.432857
+1.279815	2.451296	2.438519
+1.304795	4.578356	2.435479
+1.497143	3.474000	2.433810
+1.694211	0.489158	2.430526
+1.870414	1.449172	2.437724
+2.087391	2.310580	2.427681
+2.102679	0.022321	2.442768
+2.231278	3.102180	2.440000
+2.470667	4.530000	2.436778
+3.207205	5.564083	2.451157
+3.424000	3.157739	2.450261
+3.773910	5.998077	2.453910
+4.036400	6.002450	2.445400
+4.247708	4.530104	2.438438
+4.438636	1.217121	2.427879
+4.460175	2.267544	2.429825
+4.674262	2.174098	2.430000
+0.931732	2.787087	2.442756
+1.360714	0.140833	2.442262
+1.387950	1.532733	2.455776
+1.541882	0.677294	2.440000
+1.864177	2.096203	2.447595
+1.900375	5.866375	2.452000
+2.505056	5.386517	2.438202
+2.544512	1.241674	2.458326
+2.739244	0.213025	2.451092
+2.948033	1.586230	2.437705
+3.191961	3.806078	2.444314
+3.213438	1.448542	2.444271
+3.271757	3.367027	2.448243
+3.330976	2.777886	2.446423
+3.349200	4.725467	2.441867
+4.673119	2.899174	2.447798
+0.527925	2.463145	2.464403
+0.764074	1.397870	2.469398
+0.992407	1.305741	2.453704
+1.137805	2.642195	2.451707
+1.194176	5.656484	2.453407
+1.576593	1.711239	2.464469
+1.754321	2.596605	2.459259
+1.769928	4.751151	2.463237
+1.816641	0.271390	2.461583
+2.029636	4.781844	2.465818
+2.093708	6.063596	2.464326
+2.413761	5.927064	2.451468
+2.444262	2.696230	2.450000
+2.459151	1.971550	2.465203
+2.501385	0.793723	2.470130
+2.851624	6.145635	2.457411
+2.887732	3.142784	2.452268
+3.497612	4.538209	2.455821
+3.846137	4.328164	2.472575
+3.858701	3.877597	2.460390
+4.114797	4.309926	2.470406
+0.730899	2.618820	2.474944
+1.245085	4.331898	2.480305
+1.486869	0.354720	2.469159
+2.189720	1.503808	2.478855
+2.890415	4.640829	2.473594
+2.945641	2.038333	2.460641
+3.271798	4.427472	2.473146
+3.493004	5.144635	2.469528
+3.540185	3.680556	2.457778
+3.592857	4.317619	2.460238
+3.804805	0.151289	2.476484
+4.236471	1.874853	2.461324
+4.396745	4.993632	2.472406
+4.465682	1.961667	2.471515
+4.670575	4.465747	2.465287
+0.933158	3.531228	2.474737
+1.145639	2.908797	2.475338
+1.515775	2.658169	2.472113
+1.568427	6.023387	2.480081
+1.766207	1.875862	2.475172
+1.901289	6.338328	2.482822
+1.988036	1.663571	2.469107
+2.129740	4.346364	2.479675
+2.351016	0.023594	2.497383
+2.633609	2.912782	2.481880
+2.657107	1.786038	2.497201
+2.661127	3.225352	2.474225
+2.657482	6.317482	2.480144
+2.707760	1.517656	2.485885
+3.158406	3.019275	2.468261
+3.277958	2.355870	2.489211
+3.377258	1.637742	2.474839
+3.878877	1.007935	2.485833
+4.058884	5.371373	2.483734
+4.409646	4.324513	2.488820
+4.673761	2.426923	2.478632
+0.640640	5.968160	2.501520
+0.753574	4.669398	2.494779
+0.956716	4.842799	2.499179
+1.348095	2.084603	2.485238
+1.448934	6.362738	2.490490
+1.631931	2.180621	2.486207
+1.687725	4.246825	2.495782
+1.996804	2.534536	2.487732
+2.071593	5.711062	2.488230
+2.300244	0.639593	2.490569
+2.313069	5.522277	2.484950
+2.380992	1.030413	2.500468
+2.462889	1.472000	2.482444
+2.492000	2.458182	2.481818
+2.816371	0.448871	2.484677
+2.967627	6.379831	2.488192
+3.075969	0.361323	2.504923
+3.297514	6.326851	2.499475
+3.425634	5.433239	2.485070
+3.474143	0.843429	2.487286
+3.527765	5.896332	2.504756
+3.684506	0.379691	2.487160
+3.795339	1.908898	2.481441
+3.818738	1.297767	2.485243
+3.860741	5.542525	2.496094
+3.954249	0.750363	2.491036
+4.298636	6.023750	2.486023
+4.659563	5.382313	2.495313
+0.532365	1.252230	2.500541
+0.549219	0.313125	2.494375
+0.709912	3.647478	2.504735
+0.740294	1.650294	2.486176
+1.150186	3.666097	2.500149
+1.367320	3.266000	2.505000
+1.622667	1.452889	2.490444
+1.910952	0.906786	2.503810
+1.981351	3.143649	2.490811
+2.233077	4.952203	2.505455
+2.306966	3.930112	2.495506
+2.484721	4.887462	2.501726
+2.728125	4.936250	2.489750
+2.999009	1.045129	2.503664
+3.086794	5.321435	2.500191
+3.232444	0.956889	2.490667
+3.507929	0.170165	2.507882
+3.491364	3.446136	2.488864
+3.574029	1.792662	2.497122
+4.672532	3.579241	2.492405
+0.529976	5.423501	2.523693
+0.761914	5.723301	2.518182
+0.779319	0.168637	2.532525
+0.925556	6.035291	2.516032
+1.171667	1.700000	2.500000
+1.446493	1.286716	2.507015
+1.543000	4.630150	2.520650
+1.890326	5.551630	2.510326
+1.960270	4.528378	2.497297
+2.399532	1.712222	2.512982
+2.389907	6.181757	2.526505
+2.667162	4.017297	2.501892
+2.739337	5.420422	2.508795
+2.856462	5.192736	2.516792
+3.001469	0.618898	2.510653
+3.033982	3.333009	2.507965
+3.071686	5.054767	2.516105
+3.418487	1.332237	2.508355
+3.703611	2.503889	2.507917
+3.734762	3.456786	2.507262
+3.983616	3.414915	2.512881
+4.046133	4.738267	2.503867
+4.131753	2.861169	2.512403
+4.438609	2.532180	2.513045
+4.652937	5.701599	2.517807
+4.678400	1.504800	2.493600
+0.772952	4.139692	2.521322
+0.766190	5.172619	2.510476
+0.963484	0.806129	2.525806
+1.023050	4.038450	2.519650
+1.389290	5.833470	2.531995
+1.543613	3.912941	2.521345
+1.650732	3.281288	2.527197
+1.948992	3.622868	2.521395
+2.372375	4.324125	2.514500
+2.897143	3.536327	2.502653
+3.310068	4.967055	2.514384
+3.380378	4.194244	2.526176
+3.618125	3.902813	2.511094
+3.743623	2.785217	2.511014
+3.876915	4.923682	2.520448
+3.967176	1.694824	2.514824
+4.307410	3.860392	2.527199
+4.429173	0.455276	2.525157
+4.655197	6.227566	2.518026
+4.665923	1.753462	2.519385
+0.531216	0.555000	2.518243
+0.744429	6.208286	2.526143
+0.934222	2.206111	2.529000
+0.983832	1.066287	2.527904
+1.238395	0.347778	2.525123
+1.672331	6.245276	2.530920
+1.769512	0.699512	2.529512
+2.041377	1.281138	2.541737
+2.053938	0.690702	2.552982
+2.394000	6.400000	2.508000
+2.756695	1.128898	2.522797
+2.853870	0.023448	2.549349
+3.112986	4.190569	2.530711
+3.130260	4.796104	2.526623
+3.303274	0.018053	2.534690
+3.985702	6.348764	2.532837
+4.537069	1.017759	2.516724
+4.673833	4.027667	2.516833
+0.536860	1.515041	2.538140
+0.537128	2.949773	2.560101
+0.755041	0.661488	2.531157
+0.847281	4.425392	2.545530
+1.187961	0.638750	2.541645
+1.235039	5.413586	2.552287
+1.331513	6.116933	2.555819
+1.681478	5.420522	2.532696
+1.692620	1.227380	2.548984
+1.852000	5.019163	2.537953
+1.979944	3.880281	2.548652
+2.128043	1.031304	2.535652
+2.260517	2.463276	2.533448
+2.541786	5.612937	2.544048
+2.556711	2.197763	2.529342
+2.891061	2.903128	2.543464
+2.939326	3.979775	2.541723
+3.015351	2.398129	2.557719
+3.250141	2.026761	2.535493
+3.424741	0.439310	2.531810
+3.580674	6.153820	2.530112
+3.941633	0.359660	2.535442
+4.453465	3.429604	2.532772
+0.521842	3.434803	2.546250
+1.086025	4.543185	2.561531
+1.209908	4.775505	2.547798
+1.459494	4.150759	2.539620
+1.898557	3.371443	2.545155
+1.942182	5.308682	2.556182
+2.185493	3.568028	2.544085
+2.353778	5.231185	2.551704
+2.503462	3.608956	2.560440
+2.816154	0.788077	2.542981
+3.378608	3.930253	2.544684
+3.537847	2.306794	2.555311
+3.833854	3.194688	2.542292
+4.077838	2.209730	2.534595
+4.131368	1.009368	2.552526
+4.168194	0.468472	2.554537
+4.301471	2.131176	2.542647
+0.952720	2.524400	2.559120
+1.414374	3.684019	2.573759
+1.501952	1.035833	2.576571
+2.420899	0.435043	2.573217
+2.628075	4.283054	2.564519
+2.807763	2.220274	2.560457
+3.550405	4.900270	2.563581
+3.610588	1.164163	2.563439
+3.902203	2.956780	2.547627
+4.128602	4.985508	2.564492
+4.203593	3.546587	2.560419
+4.414286	1.723036	2.550714
+4.459975	4.594081	2.565894
+4.480182	5.216364	2.556727
+4.652357	5.026650	2.568809
+4.666839	3.144943	2.557931
+0.525217	2.222717	2.560761
+0.960909	0.010000	2.554545
+0.996034	0.363190	2.565172
+1.359624	3.007970	2.568045
+1.607286	5.004429	2.563000
+1.711377	3.542395	2.569401
+1.768704	3.048611	2.572963
+2.088478	2.946957	2.562609
+2.292674	5.750698	2.563605
+2.644229	0.606432	2.570176
+2.860465	2.651395	2.558372
+2.930095	1.799714	2.577079
+3.091299	6.178468	2.580286
+3.334187	6.067355	2.586667
+3.638261	1.438261	2.560145
+3.727941	5.747647	2.557059
+3.828333	5.295370	2.562037
+3.855796	2.308938	2.578274
+4.091201	3.134047	2.584047
+4.250128	4.114615	2.559872
+4.278000	4.779000	2.565143
+4.436281	0.716942	2.565537
+0.517722	4.935316	2.575823
+0.932987	1.955325	2.584870
+1.174304	2.256311	2.588350
+1.380973	0.792478	2.578938
+1.577108	2.877169	2.578193
+1.685153	5.685194	2.593313
+1.747273	3.787727	2.564318
+1.892587	2.778187	2.591973
+1.988264	4.149097	2.583264
+2.166061	0.452929	2.574545
+2.310107	1.280643	2.591850
+2.367217	3.302565	2.579913
+2.442216	3.045412	2.580206
+2.593061	0.058131	2.597336
+2.624801	5.875909	2.591790
+3.044118	5.918235	2.576471
+3.333813	3.614676	2.574173
+3.600698	0.599070	2.577093
+3.663089	3.010244	2.582033
+4.441494	5.478276	2.585575
+4.494519	5.910000	2.573111
+0.520183	6.182385	2.584587
+0.519800	3.784400	2.584800
+0.521053	1.977895	2.582105
+0.749567	1.152987	2.596017
+0.990458	5.608431	2.601176
+1.175690	1.928103	2.581034
+1.204652	6.358182	2.590588
+1.248383	3.890240	2.589222
+1.316328	2.747574	2.606459
+1.881591	0.486667	2.603258
+2.244855	0.220217	2.587826
+2.451071	4.102262	2.588810
+2.754404	3.731124	2.599679
+2.793585	5.672981	2.591321
+3.433493	2.550478	2.596801
+4.257757	1.243694	2.604037
+4.453023	0.209302	2.580233
+0.740767	3.185879	2.603546
+0.744397	3.889397	2.596810
+0.790373	5.414533	2.606293
+1.141971	5.923019	2.615367
+1.381750	1.808500	2.593000
+1.773226	1.616989	2.592258
+2.696154	3.435128	2.598034
+2.871277	4.219574	2.592128
+3.877872	4.097340	2.592128
+4.055500	5.675900	2.597900
+4.189037	0.752222	2.600444
+4.245577	5.244615	2.587115
+4.325364	5.714904	2.607548
+4.661984	2.685709	2.607935
+4.663902	4.753049	2.602317
+0.532658	0.785443	2.605063
+0.537764	4.045000	2.625590
+0.948269	2.990641	2.609615
+1.086111	1.492778	2.605317
+1.134601	5.013497	2.605276
+1.790406	6.021265	2.628401
+1.995593	0.162667	2.609741
+2.299455	2.827891	2.614727
+2.707650	2.458060	2.629126
+3.076544	0.128456	2.607426
+3.171938	1.671125	2.606063
+3.287411	0.700670	2.615402
+3.312234	5.257056	2.615990
+3.512347	5.632721	2.621190
+3.525854	6.387561	2.603415
+3.709884	5.089884	2.603023
+3.736271	3.712712	2.598136
+3.748874	6.312517	2.605563
+3.915044	2.634167	2.619649
+4.507546	1.370417	2.611111
+4.673267	1.993663	2.601584
+0.531179	4.616829	2.626341
+0.532674	2.661444	2.626898
+0.533346	4.340769	2.633308
+0.728793	2.093621	2.613276
+0.759958	2.359792	2.623792
+0.758000	2.824846	2.617615
+1.151220	3.159762	2.625744
+1.410855	0.544737	2.617171
+1.437373	2.276314	2.626186
+1.461399	5.546923	2.619231
+2.032412	2.038235	2.618000
+2.826098	1.339268	2.606341
+3.130324	2.820926	2.620000
+3.287592	0.259634	2.624817
+3.353770	2.963811	2.623648
+3.675800	0.921400	2.610000
+3.982680	3.723196	2.620722
+4.015613	4.517350	2.630912
+4.144313	6.153359	2.631565
+4.660187	3.802336	2.628785
+4.661563	4.252969	2.612969
+4.682391	1.175652	2.609565
+0.532226	5.705110	2.645799
+0.748947	0.891579	2.620526
+0.960833	1.703214	2.626429
+1.167657	1.247483	2.641434
+1.488025	5.290988	2.634259
+1.526952	2.003524	2.629524
+1.673107	2.405000	2.634854
+1.743444	4.032384	2.633046
+1.765877	4.461801	2.628578
+2.102195	5.506234	2.645337
+2.163140	1.720814	2.623256
+2.241939	2.183091	2.629818
+2.622632	2.712105	2.623474
+2.642069	0.941724	2.619138
+2.806093	4.457417	2.633709
+3.041983	1.457190	2.623223
+3.039667	5.668500	2.622833
+3.076181	0.838611	2.629375
+3.219025	3.202086	2.641247
+3.253366	5.798000	2.630927
+3.459063	2.073750	2.636016
+3.606556	3.268036	2.635589
+3.621702	4.137518	2.638156
+3.701122	2.110102	2.629898
+3.918095	5.874127	2.628095
+3.935977	2.044828	2.629885
+4.188371	0.215140	2.644803
+4.359293	3.012989	2.641033
+4.447660	3.663723	2.622340
+4.664601	0.395460	2.635153
+0.524286	1.745714	2.628000
+1.246996	3.454032	2.643004
+1.248271	0.992944	2.651682
+1.440233	4.839535	2.634341
+1.475615	4.390462	2.642962
+2.129912	5.155242	2.637841
+2.250588	0.851307	2.642353
+2.522614	3.866863	2.639150
+2.920643	4.888006	2.645434
+3.070552	2.149816	2.648098
+3.084753	4.425157	2.647982
+3.367770	1.834865	2.638851
+3.531791	2.792090	2.627463
+3.590686	5.319840	2.647666
+3.680795	4.467500	2.635341
+3.751188	4.736875	2.642875
+3.863457	1.486543	2.631728
+3.900333	6.122111	2.636556
+4.085882	3.951078	2.638333
+4.157468	5.896709	2.637595
+4.187091	1.708182	2.641636
+0.540536	0.125179	2.640357
+0.990984	5.226230	2.637213
+1.023974	4.266538	2.638974
+1.243229	0.090646	2.663274
+1.364333	5.078000	2.644833
+1.573392	0.145636	2.666908
+1.856800	2.241600	2.645333
+2.218293	4.724042	2.655749
+2.657175	0.353234	2.664535
+3.395417	1.053833	2.657458
+3.759247	1.713011	2.647957
+4.079378	2.427772	2.652073
+0.958541	3.336865	2.662649
+1.060385	2.756154	2.661319
+1.186313	2.517095	2.678547
+1.240855	4.141453	2.656581
+1.632649	0.424106	2.665364
+1.921096	1.807123	2.657329
+2.034556	5.916006	2.669852
+2.044006	6.217596	2.666409
+2.068673	2.367092	2.668878
+2.276901	1.928592	2.652394
+2.279524	5.979921	2.651429
+2.305574	3.745574	2.650656
+2.624943	6.142586	2.672069
+2.670597	2.024925	2.650149
+2.711919	4.712551	2.668555
+3.261012	4.626640	2.660243
+3.511509	4.671321	2.660189
+3.970901	1.182973	2.654685
+4.123874	1.461982	2.652703
+4.351744	0.935814	2.650814
+4.667852	0.662349	2.659463
+4.669888	3.386180	2.648315
+0.734359	4.865846	2.673128
+0.775914	0.413710	2.674140
+0.961434	0.595814	2.673372
+1.009304	6.215304	2.671304
+2.137966	2.624068	2.675480
+2.224298	4.201157	2.674298
+2.411455	2.597818	2.668273
+2.594362	1.374947	2.678245
+2.836667	5.994881	2.669167
+2.864074	6.265556	2.682481
+2.937365	5.447814	2.679341
+3.229854	1.267816	2.687694
+3.431245	4.424440	2.677386
+4.266667	3.322510	2.677412
+4.671111	2.257222	2.666825
+0.540851	6.393617	2.672340
+0.736250	3.450357	2.665714
+0.747826	1.818478	2.665435
+1.340270	1.435811	2.683446
+1.450516	2.537613	2.679032
+1.727217	0.910061	2.680214
+1.729315	5.202904	2.686411
+2.187681	3.151304	2.676957
+2.251641	4.458750	2.676484
+2.266667	6.361897	2.691626
+2.526839	4.498705	2.689326
+2.528647	5.355714	2.680451
+2.604428	5.034797	2.690775
+2.903224	0.277632	2.682829
+3.131395	3.714264	2.686512
+3.153793	3.465862	2.668621
+3.342247	1.504270	2.668090
+3.680139	0.062404	2.688362
+4.171818	1.965682	2.673409
+4.181026	2.672821	2.667308
+4.420440	2.745535	2.684214
+4.657319	0.044933	2.687748
+0.529530	5.211745	2.687047
+0.546745	1.028019	2.698396
+0.906400	5.848400	2.676933
+0.920909	1.325207	2.682314
+1.237855	5.672013	2.703729
+1.332735	4.610122	2.694327
+1.503148	3.450247	2.688642
+1.556452	3.104301	2.689677
+1.667838	2.666419	2.690473
+1.861007	1.400104	2.696528
+1.887107	1.125028	2.706713
+2.005664	4.392920	2.687434
+2.031855	4.913345	2.699527
+2.105161	3.382796	2.687634
+2.153529	0.011176	2.680588
+2.346404	1.542959	2.697678
+2.430053	2.340160	2.691016
+2.572645	6.386777	2.690826
+2.585000	1.627097	2.685968
+2.860899	3.202360	2.685056
+3.165149	3.983731	2.696381
+3.503210	3.772399	2.694982
+3.774267	0.725600	2.683733
+3.937322	0.120711	2.708104
+3.956646	5.133634	2.705217
+4.207182	5.491572	2.705203
+4.420446	6.345785	2.700246
+0.776382	1.537884	2.705870
+0.908933	4.682267	2.688933
+1.016542	3.844034	2.700000
+1.513300	1.620800	2.697500
+1.674609	1.819922	2.699531
+1.925135	4.661189	2.699946
+2.172164	3.949179	2.702015
+2.505636	1.853636	2.688909
+3.078203	6.388281	2.708828
+3.200843	5.475172	2.705670
+3.604505	3.527143	2.696813
+3.685130	6.003239	2.708227
+3.790493	0.470987	2.706951
+4.158803	6.388632	2.703675
+4.238129	4.334082	2.709456
+4.430909	2.270000	2.685455
+4.444973	4.172295	2.704809
+1.014737	3.570526	2.694737
+1.602431	0.682099	2.717514
+1.882727	2.540420	2.712448
+1.921250	5.685395	2.708355
+2.512251	1.131602	2.716234
+2.831762	1.576211	2.712291
+2.856641	0.539733	2.715115
+2.868545	0.960933	2.717985
+3.129558	0.517666	2.720442
+3.133700	1.901145	2.721762
+3.387724	3.401870	2.703659
+3.581970	0.323788	2.711212
+3.964842	0.893079	2.724184
+3.998968	0.623175	2.709048
+4.629157	2.933652	2.707303
+4.660055	0.926813	2.714725
+4.657636	4.487818	2.707636
+0.531961	2.417647	2.716275
+0.777677	6.054949	2.711515
+0.966407	0.168982	2.715808
+1.513122	6.248416	2.722127
+2.372299	5.543678	2.717816
+2.448526	0.230842	2.718421
+2.620231	3.173308	2.713846
+2.964299	4.636075	2.719346
+2.986316	1.187632	2.709474
+3.203151	2.501005	2.721781
+3.465669	5.081260	2.714016
+3.526053	1.653947	2.709342
+3.518653	0.775699	2.727306
+3.853548	3.534903	2.715097
+4.370661	6.064793	2.722314
+4.634306	6.075231	2.729364
+4.652209	5.528023	2.713023
+0.595478	1.346752	2.730510
+0.784878	2.599106	2.729919
+1.124651	0.784574	2.734651
+1.309716	2.077441	2.733602
+1.379948	0.319636	2.741429
+1.491071	5.996429	2.724375
+1.585827	1.373309	2.724892
+1.818966	5.454414	2.734966
+2.023030	0.907879	2.726742
+2.070818	3.721727	2.726000
+2.463177	4.775156	2.733646
+2.479805	0.799707	2.732732
+2.709505	2.926847	2.733919
+2.751406	5.273438	2.724063
+2.910544	3.456463	2.742075
+3.604632	1.892316	2.720105
+3.942047	5.431913	2.740906
+3.982486	4.812057	2.741343
+4.250533	4.594533	2.722667
+4.371507	1.557911	2.734349
+4.435698	5.041977	2.717907
+4.438498	1.896197	2.732582
+4.452414	4.802069	2.716897
+4.470000	1.138500	2.723750
+4.650169	5.265932	2.724576
+0.788299	6.337631	2.755755
+0.903357	4.079860	2.743007
+0.988571	2.360268	2.740625
+1.181654	0.486850	2.735354
+1.234600	4.380000	2.728000
+1.434203	3.995942	2.733841
+1.800375	0.259083	2.746042
+1.803390	6.258475	2.743051
+1.815070	2.014930	2.730563
+1.940433	3.179300	2.742667
+2.288533	0.627200	2.739200
+2.450444	2.087667	2.735556
+2.707755	4.103980	2.734490
+3.203448	5.054253	2.736264
+3.252063	4.256349	2.731270
+3.292287	2.245919	2.742960
+3.363737	4.855758	2.730202
+3.418315	0.081573	2.736404
+3.511148	1.330383	2.756530
+3.651667	2.597299	2.743218
+3.765000	1.287222	2.724444
+3.955871	3.295226	2.740903
+3.974063	1.817902	2.746696
+4.014385	2.844115	2.744115
+4.316525	2.478559	2.736780
+4.632598	1.548583	2.734331
+0.543074	5.960777	2.753108
+0.546780	0.342542	2.739153
+0.774047	5.175117	2.764543
+0.790346	3.696199	2.764773
+1.178487	1.717311	2.742521
+1.759851	3.372239	2.746716
+1.880063	0.706313	2.752125
+2.736379	1.804138	2.739828
+2.895298	1.997440	2.748571
+3.284699	6.265060	2.747169
+3.399123	4.074035	2.741754
+3.460672	5.875126	2.750420
+3.863488	4.340349	2.747209
+4.205572	3.750663	2.758163
+4.462105	3.901316	2.736842
+4.649643	5.811786	2.742143
+0.535600	3.117200	2.750800
+0.762108	4.309307	2.767139
+0.754271	5.656042	2.764271
+1.399615	1.199872	2.749231
+1.491938	5.748682	2.760388
+1.776011	4.890730	2.765618
+1.816604	4.240472	2.757170
+2.030909	0.356783	2.758881
+2.129521	1.396322	2.775239
+2.162250	1.120125	2.773125
+2.298234	4.984857	2.769735
+2.436892	5.792243	2.769135
+2.950719	2.546601	2.766928
+3.037373	3.038898	2.760508
+3.332250	2.735700	2.761850
+3.421163	0.530720	2.771801
+3.749589	2.847363	2.769658
+3.915000	6.384521	2.767055
+4.201961	2.213137	2.751667
+4.568899	2.485321	2.757844
+0.537273	3.615795	2.759886
+0.564088	0.596101	2.761321
+0.960757	4.931568	2.776108
+1.042482	2.099433	2.778830
+1.068169	5.411901	2.771479
+1.215385	2.939091	2.771469
+1.228542	3.691146	2.765365
+1.363750	3.240766	2.773266
+1.648255	4.647562	2.778975
+1.762383	0.018135	2.797098
+2.169267	5.723933	2.771200
+2.289873	3.526709	2.760633
+2.515227	3.442500	2.755000
+2.687552	5.523237	2.778880
+2.721789	0.745474	2.762105
+2.926064	2.807128	2.771170
+3.533224	6.212694	2.766653
+4.041166	4.164028	2.778622
+4.395129	5.306258	2.782419
+4.658444	4.051778	2.753556
+0.999477	1.083721	2.791948
+1.185906	5.188898	2.777638
+1.221552	6.183190	2.779397
+1.630548	2.180411	2.791918
+1.636364	1.136667	2.776515
+1.773679	2.914811	2.777736
+1.941089	3.985545	2.779406
+2.278626	0.386565	2.781527
+2.447778	4.258086	2.782407
+2.654342	2.243772	2.780044
+2.754333	1.180889	2.770667
+2.916066	2.297377	2.778525
+3.024259	4.189630	2.764630
+3.163118	1.022971	2.793559
+4.026263	0.377105	2.780526
+4.201429	5.109341	2.778352
+4.384888	0.334218	2.798139
+4.416528	0.064306	2.770139
+4.661509	3.601509	2.774340
+0.552230	2.109189	2.786824
+0.560796	5.465995	2.800498
+0.776098	3.003943	2.800894
+0.983906	4.464017	2.804848
+2.251581	5.333185	2.802450
+2.522237	0.542345	2.801321
+2.928894	0.052211	2.793317
+3.881021	3.938290	2.798812
+4.102404	3.499519	2.797548
+4.238676	0.555588	2.790098
+4.231522	4.858478	2.781957
+0.558624	2.850201	2.814228
+0.731726	0.184772	2.805381
+1.195038	4.804427	2.794656
+1.328407	5.398956	2.798956
+1.444454	0.901965	2.801266
+1.555200	5.036350	2.798950
+1.858580	3.602301	2.815227
+2.022564	1.628974	2.795000
+2.077536	2.952899	2.796232
+2.917843	3.978824	2.793922
+3.124481	4.813485	2.806680
+3.192931	0.021954	2.802701
+3.622527	2.342582	2.803516
+3.672168	5.752937	2.795385
+3.863706	2.444924	2.798731
+3.914733	5.686000	2.798333
+4.163778	1.076044	2.803244
+4.661579	1.789474	2.787895
+0.544545	1.580000	2.798636
+0.549667	3.363067	2.809067
+0.885252	0.799496	2.804748
+1.725562	3.842630	2.820301
+1.739442	5.830172	2.812361
+1.989336	5.285071	2.808815
+2.316182	2.991727	2.808364
+2.395000	4.005000	2.817378
+2.480687	2.795267	2.815458
+2.705878	0.151832	2.808092
+2.739487	5.786769	2.811692
+2.990958	5.851250	2.815708
+3.006972	6.107156	2.805872
+3.120489	0.266895	2.828680
+3.227456	5.993713	2.819474
+3.440515	5.469152	2.819242
+3.599865	1.081892	2.809324
+3.699767	5.497674	2.807829
+3.694194	1.497258	2.802581
+3.780233	4.972907	2.806163
+3.859500	2.189167	2.803500
+4.660500	1.309750	2.802750
+1.005238	6.022585	2.816190
+1.462623	2.916721	2.808525
+2.246889	0.151556	2.820778
+2.423846	0.010000	2.810769
+2.428267	6.061333	2.817200
+2.479134	3.690397	2.821408
+2.830982	5.057991	2.826652
+2.912465	3.731690	2.815775
+3.331184	3.616184	2.824145
+3.509651	2.938488	2.822907
+3.696212	3.096212	2.813788
+4.168136	3.033559	2.808305
+4.159818	5.722000	2.811636
+4.381796	3.515550	2.829142
+4.404800	5.830633	2.831267
+4.466186	0.688186	2.824419
+4.644556	3.195148	2.814675
+0.545783	6.218313	2.833434
+0.574760	3.861336	2.841336
+0.813333	2.206875	2.816250
+0.970211	0.391368	2.821474
+0.988667	1.850000	2.819778
+1.289531	5.897469	2.840375
+1.328988	0.666883	2.836316
+1.402370	4.233642	2.832659
+1.457434	1.836579	2.839967
+1.470444	3.758222	2.829185
+1.600000	5.527407	2.839226
+2.018788	2.178333	2.825227
+2.401940	3.234776	2.831741
+2.686957	4.343430	2.834831
+3.007709	5.244916	2.831006
+3.037314	1.687143	2.828571
+3.294829	1.687222	2.837607
+3.846580	4.593446	2.840959
+4.431607	5.558571	2.819643
+4.446545	4.438091	2.826727
+0.552609	4.746783	2.844348
+1.001827	1.552019	2.831058
+0.999157	3.132410	2.830723
+1.422444	0.029259	2.834370
+2.075393	0.586517	2.835955
+2.458202	5.176404	2.835618
+2.680229	3.867163	2.853954
+2.711356	3.588136	2.828814
+2.965081	0.743257	2.844821
+3.594733	3.965800	2.839733
+3.720891	3.715487	2.850084
+3.759394	5.239091	2.837803
+4.018971	1.339485	2.840662
+4.268873	4.035352	2.842923
+4.636082	4.692990	2.843196
+0.564335	1.843064	2.856821
+0.559474	4.481140	2.862456
+0.755000	1.008173	2.841635
+0.780370	1.964259	2.846852
+0.785723	3.272215	2.860154
+1.134459	3.350796	2.864140
+1.212135	3.940391	2.861744
+1.211509	2.278679	2.839623
+1.935429	6.071333	2.853000
+1.978088	2.729681	2.858685
+2.199812	6.135564	2.858195
+2.231859	2.297692	2.853654
+2.931264	4.415824	2.857637
+3.293438	5.690341	2.856790
+3.337346	2.008499	2.861743
+3.580435	2.094348	2.850435
+3.841543	1.088743	2.850286
+3.934828	3.065000	2.842069
+4.005836	6.168662	2.857695
+4.191637	0.812847	2.856584
+4.333110	1.321159	2.852805
+4.386641	3.170859	2.859805
+4.636063	0.254344	2.854525
+4.646082	2.038144	2.848557
+0.826298	5.422009	2.879142
+0.994683	5.643303	2.874163
+1.115623	4.210101	2.871953
+1.162965	0.244070	2.867638
+1.619528	4.356604	2.852642
+1.635628	4.095953	2.867256
+1.993547	0.125893	2.870587
+2.047526	4.204742	2.868351
+2.096887	4.548675	2.861258
+2.208592	1.771549	2.859437
+2.224318	2.774545	2.849091
+2.352203	1.282203	2.858305
+2.551788	2.499416	2.868978
+2.718065	2.698581	2.859742
+2.997885	1.385962	2.855288
+3.042971	5.599239	2.874964
+3.216967	4.470219	2.874727
+3.257376	5.276540	2.866844
+3.377000	0.287667	2.857083
+3.439677	2.516075	2.860108
+3.485000	3.210250	2.850750
+3.514041	4.247876	2.861503
+3.618968	4.790903	2.855097
+3.731266	3.349177	2.859684
+3.783857	0.268429	2.850000
+3.925894	1.581014	2.860725
+4.626012	6.306607	2.860714
+0.547826	4.994783	2.865362
+0.554017	4.138547	2.868205
+0.577396	0.831245	2.879660
+0.794940	0.569116	2.878594
+1.232000	2.695800	2.861200
+1.319910	5.006306	2.869279
+1.715000	3.165417	2.868125
+1.820732	2.350000	2.868293
+1.853889	4.472111	2.871000
+2.365019	0.985393	2.874869
+2.352108	4.587189	2.875189
+2.437465	1.707465	2.862254
+2.651959	0.965284	2.878325
+2.711473	3.341240	2.877209
+3.210428	3.344385	2.872086
+3.595860	4.499409	2.869946
+3.658588	0.617062	2.878814
+3.675091	6.383727	2.875909
+3.704701	0.869104	2.875522
+3.752941	4.157765	2.864471
+3.884757	5.937427	2.869515
+4.186545	5.976021	2.872513
+4.209742	1.816753	2.878196
+4.244762	6.236190	2.859881
+4.405328	2.110246	2.868443
+4.619400	4.958133	2.877800
+4.633015	2.716332	2.871910
+4.642273	4.278030	2.857879
+0.989286	2.630260	2.879026
+1.098768	1.319783	2.888696
+1.350645	3.494274	2.881694
+1.453417	4.792814	2.885075
+1.525772	0.507805	2.881545
+1.618000	2.490571	2.870429
+1.670000	6.083451	2.891882
+1.828544	1.741553	2.877961
+2.185620	0.803471	2.872562
+2.239863	2.031684	2.890756
+2.746094	1.402969	2.876094
+3.265742	3.085781	2.889180
+3.349922	3.869845	2.876744
+3.385773	0.917629	2.874948
+3.399282	4.666133	2.883149
+4.093054	4.477096	2.887635
+4.120047	2.538821	2.887217
+4.365804	2.897054	2.881339
+0.587417	2.589970	2.904024
+0.795717	5.882245	2.905281
+0.805333	1.714267	2.890000
+1.475362	2.681159	2.882464
+2.001504	1.915398	2.883805
+2.254959	3.802764	2.883740
+2.298175	2.542698	2.890238
+2.638041	1.975773	2.894124
+2.716267	6.030800	2.891511
+2.870189	4.795245	2.897623
+3.280994	1.423205	2.909295
+3.716032	1.722857	2.889048
+3.790059	1.967059	2.892941
+4.048138	2.024575	2.892186
+4.421913	0.937478	2.887826
+0.780663	4.635128	2.909643
+0.820641	1.251352	2.907367
+0.990283	2.888679	2.894434
+1.214394	1.903788	2.898333
+1.241000	1.076235	2.899353
+1.251497	1.532925	2.895170
+1.334063	2.480208	2.891250
+1.591203	5.270886	2.901646
+1.738281	1.505313	2.893906
+1.988533	3.383743	2.913084
+2.048613	2.473323	2.913968
+2.056667	5.519128	2.916744
+2.163088	4.794118	2.900049
+2.498072	6.279699	2.893072
+2.504000	1.468600	2.889000
+2.627000	4.884200	2.893700
+3.079634	2.080650	2.908659
+3.092132	3.572574	2.893750
+3.144036	2.846637	2.906054
+3.577731	0.163529	2.899916
+3.757257	6.151600	2.907714
+4.149273	3.266364	2.909636
+4.210175	0.149605	2.910307
+4.638151	0.517395	2.895714
+0.562613	5.727789	2.910402
+0.575678	1.164746	2.908559
+0.920709	3.499803	2.914921
+1.004144	6.261781	2.917500
+1.062536	0.611312	2.921341
+1.185833	0.010000	2.912083
+1.450863	4.530203	2.915685
+1.985848	5.820939	2.914874
+2.023400	6.304800	2.899800
+2.085569	5.055976	2.917358
+2.251351	4.356351	2.901622
+2.477079	5.428168	2.912079
+2.546971	3.035477	2.918133
+2.600449	4.627978	2.904719
+2.907442	0.387442	2.912558
+3.118970	2.343212	2.913333
+3.513097	5.224773	2.925938
+3.795065	0.030325	2.910844
+3.895146	2.677961	2.902039
+3.978011	3.695966	2.918977
+0.778571	2.765306	2.907551
+0.821531	2.440714	2.927143
+1.410306	6.114585	2.930044
+1.423771	6.373829	2.915829
+1.578886	3.378257	2.931629
+1.821166	5.112914	2.929580
+1.825929	1.270796	2.917345
+2.136087	3.161196	2.923750
+2.674141	1.646520	2.919780
+3.210132	0.757368	2.907500
+3.232430	4.097664	2.926776
+3.507990	3.453920	2.919749
+4.062528	5.268210	2.925795
+4.180732	1.540427	2.930915
+4.373627	2.635840	2.936933
+4.387752	4.669922	2.913488
+4.624673	1.088844	2.920251
+4.627841	2.286705	2.918182
+0.992422	5.164297	2.929219
+1.661173	6.361939	2.926071
+1.685920	1.943793	2.930057
+1.736331	0.977171	2.938768
+1.729010	2.715623	2.942204
+1.825287	5.622184	2.920805
+2.259347	5.891847	2.946705
+2.662846	0.364154	2.924385
+2.862826	5.413913	2.931087
+2.963523	3.280783	2.939075
+3.121375	6.280750	2.925625
+3.380063	1.173365	2.940283
+3.905000	0.725987	2.924013
+4.047445	2.288248	2.935401
+4.057355	4.977806	2.936710
+4.456875	1.716354	2.917500
+0.585404	2.304485	2.949522
+0.582712	5.236356	2.933983
+1.043333	3.735310	2.948178
+1.346042	5.667292	2.935417
+2.273591	6.372317	2.940270
+2.824747	2.143434	2.936061
+2.844615	6.230256	2.929744
+2.853065	4.171429	2.955377
+3.097868	3.863807	2.938629
+4.608776	5.418299	2.942313
+0.745729	6.141563	2.938125
+1.975950	1.084380	2.948264
+2.113418	3.606962	2.942532
+2.268871	1.552097	2.938710
+2.325197	5.636535	2.947717
+2.677410	5.228584	2.962410
+2.859203	1.822319	2.949420
+3.056356	5.022712	2.964350
+3.131000	2.590000	2.942800
+3.350226	4.983982	2.951538
+3.522110	5.682110	2.957156
+3.519710	1.598696	2.946667
+4.369305	2.353874	2.966556
+4.382044	3.815660	2.962013
+4.609503	3.429752	2.954876
+4.607908	5.681503	2.950392
+0.630000	6.400000	2.930000
+0.778592	4.123944	2.948732
+0.793213	4.993371	2.972081
+0.832313	3.873955	2.958507
+1.043587	4.672310	2.966474
+1.068624	0.886746	2.972963
+1.201522	4.449755	2.972364
+1.211739	3.118804	2.956087
+1.293286	0.441714	2.954143
+1.439294	2.073176	2.971676
+1.506768	1.572348	2.971311
+1.582976	0.756976	2.961756
+1.610675	0.124262	2.966793
+1.640513	3.638376	2.960684
+1.724115	0.362718	2.975062
+1.905962	3.031122	2.966218
+1.954537	0.825610	2.966244
+2.029538	3.835692	2.952154
+2.570364	5.664227	2.963500
+2.589734	1.220631	2.963688
+2.589788	4.111555	2.964488
+2.772178	0.599530	2.967054
+2.963931	0.982901	2.966069
+3.381854	6.183609	2.969371
+3.428922	2.257059	2.956863
+3.856667	0.476250	2.954896
+4.061374	5.553132	2.958626
+4.440645	4.195806	2.954194
+4.451496	6.150709	2.956142
+4.604857	2.972714	2.969171
+4.603529	5.945529	2.962059
+4.634242	0.822121	2.950606
+0.673841	3.557256	2.963659
+1.010698	2.274767	2.969767
+1.446349	3.097460	2.960794
+1.589677	1.322581	2.967097
+1.821967	5.375738	2.974098
+2.251799	3.397226	2.975488
+2.409465	0.290053	2.969626
+2.556105	0.736105	2.965684
+3.122000	1.208667	2.971111
+3.323333	6.397778	2.955000
+3.438519	0.697593	2.970556
+3.540000	1.878205	2.964188
+3.787949	1.307564	2.956795
+4.147686	2.791843	2.971843
+4.140172	4.728970	2.980129
+4.279718	5.443099	2.967606
+4.378636	4.918818	2.973182
+4.623243	3.737027	2.958919
+0.584430	1.404051	2.971772
+0.591183	0.380860	2.976774
+0.595098	3.049248	2.991732
+1.179446	5.487196	2.990369
+1.379280	0.210800	2.984400
+1.489661	1.083842	2.990367
+1.803846	0.618173	2.979760
+1.970240	1.464251	2.979701
+2.468077	2.138154	2.981769
+2.516000	5.915280	2.979360
+2.550647	0.084676	2.982806
+2.820882	2.895882	2.963235
+2.881604	2.427380	2.989626
+3.101616	0.539167	2.990783
+3.372746	0.041051	2.982271
+3.608080	2.766449	2.985435
+3.699009	2.511509	2.990819
+3.931100	3.446100	2.980400
+4.009053	0.951053	2.973684
+4.073558	3.929519	2.973269
+4.205401	4.244453	2.985766
+1.104513	4.938407	2.990442
+1.338686	1.311752	2.985839
+1.430426	4.010426	2.985638
+1.574441	5.748323	3.002484
+1.641067	2.957467	2.976667
+1.978692	0.430093	2.989346
+2.404566	4.815029	2.985838
+2.494366	4.409718	2.982958
+3.157006	1.845150	2.996407
+3.412473	5.913055	2.997527
+3.938529	4.280711	3.002010
+4.599196	4.001929	2.999678
+0.811795	1.493462	2.992179
+0.962454	0.085810	3.014282
+1.059556	5.862111	2.993667
+1.078889	1.711389	2.988056
+1.178089	6.085122	3.002846
+1.487313	2.331194	2.989701
+1.656981	4.911294	3.009865
+1.791356	4.681073	3.002655
+2.552769	3.498769	2.987231
+2.768261	3.131087	2.985652
+2.901264	1.558276	2.995057
+3.052028	0.081538	3.006573
+3.501915	3.710395	3.012948
+3.670876	5.887883	2.996934
+3.885631	6.353584	3.007952
+3.938226	1.796774	2.991129
+3.982487	0.260160	3.016417
+4.313269	5.173948	3.007120
+4.346824	6.392118	3.002471
+4.383024	0.503902	3.007171
+4.563333	5.178148	2.995741
+4.627188	1.560000	2.983125
+4.616522	4.498913	2.992391
+0.574348	5.966087	3.008152
+0.847073	4.360813	3.004797
+0.831297	0.318973	3.015622
+1.309068	2.894472	3.012050
+1.303876	3.712416	3.020758
+1.794305	4.256983	3.015932
+2.146888	1.269947	3.020186
+2.465091	3.864545	3.011727
+2.831880	5.656453	3.015556
+2.868916	1.234011	3.021111
+3.144691	5.851303	3.022443
+3.344422	2.699456	3.012177
+3.641162	5.008485	3.013586
+3.763290	5.653032	3.007806
+3.849693	5.406858	3.014483
+3.853712	2.903939	3.005076
+4.206617	3.605613	3.017361
+4.463099	0.146959	3.014094
+0.619245	0.134340	3.031321
+0.776604	5.644340	3.017107
+1.434645	5.456120	3.025519
+1.858778	2.137443	3.028125
+2.246563	0.470000	3.016172
+2.293333	5.157879	3.012879
+2.409600	1.883920	3.024160
+2.918045	2.687594	3.022481
+2.939975	6.012574	3.032277
+3.015106	3.033404	3.017553
+3.031495	4.592732	3.017268
+3.084866	4.289286	3.023170
+3.090000	5.392331	3.023006
+3.554808	1.361538	3.014615
+3.851057	4.848238	3.024626
+4.112820	0.502762	3.029622
+4.160495	1.222387	3.018288
+0.604194	1.656636	3.030276
+0.785479	0.807671	3.028082
+1.190548	2.123151	3.015616
+1.227989	5.166931	3.035556
+1.328938	0.876372	3.032566
+1.839646	6.226814	3.026726
+1.922000	4.036727	3.014000
+2.036383	1.704823	3.027730
+2.648554	2.311281	3.035289
+2.697941	6.395000	3.018824
+2.807178	0.194724	3.034110
+2.872027	3.916351	3.025946
+3.352867	0.468400	3.027867
+3.596714	5.454714	3.033857
+3.808177	2.271302	3.035573
+4.362868	5.669412	3.031912
+4.402759	1.153276	3.016724
+0.591667	2.059286	3.025714
+0.995349	4.046395	3.033140
+1.310984	1.722131	3.031639
+1.476782	5.098276	3.039425
+1.827576	0.012424	3.030909
+2.165479	0.229175	3.047228
+2.507978	5.039551	3.042135
+3.224842	4.770791	3.050253
+3.665972	1.103833	3.055250
+3.859615	3.197308	3.027308
+3.979545	5.775909	3.028485
+4.076650	3.050911	3.056404
+4.358105	3.354373	3.055452
+4.376240	1.928640	3.036240
+4.411852	1.474568	3.034691
+4.611852	1.865556	3.024815
+4.604184	1.318367	3.039694
+0.603711	4.297062	3.054175
+1.071839	0.389425	3.047241
+1.114377	2.486748	3.062340
+1.291735	4.682653	3.045918
+1.926182	4.897939	3.045758
+2.134639	2.932990	3.040103
+2.226963	3.986667	3.050444
+2.260786	5.418176	3.064025
+2.357424	3.634444	3.051566
+2.357818	2.835273	3.038182
+2.606012	2.816190	3.051905
+2.838409	3.475455	3.036818
+3.208217	0.964650	3.047261
+3.608493	0.433797	3.058464
+3.697647	4.651569	3.046471
+3.711103	3.544412	3.052059
+3.854268	4.025223	3.053185
+3.860929	5.142301	3.056195
+4.229257	2.142012	3.062167
+4.238431	0.978627	3.045294
+4.356806	0.758194	3.044722
+4.580442	2.505959	3.063363
+0.615091	3.318649	3.069221
+0.836852	2.113386	3.071852
+0.937294	6.056706	3.047059
+1.029681	1.944043	3.059894
+1.301309	4.214698	3.071779
+2.036773	5.275100	3.065100
+2.116545	2.195818	3.064682
+2.178099	0.974678	3.067427
+2.326323	0.718215	3.077677
+2.340226	3.089173	3.057669
+2.365336	2.363109	3.079397
+2.504116	0.510145	3.073275
+2.698911	3.694719	3.061386
+2.767626	4.997071	3.080657
+2.955570	6.392405	3.058734
+3.140643	1.590000	3.061053
+3.240539	0.247246	3.057425
+3.342381	5.428294	3.064960
+3.430638	2.936064	3.055745
+3.651544	3.064926	3.056029
+3.754658	1.539530	3.058718
+4.303206	4.470802	3.068473
+0.600556	2.796389	3.063611
+0.629172	0.616847	3.082930
+0.728088	1.871324	3.063824
+0.795752	5.242920	3.068319
+0.868333	1.045591	3.067796
+1.140300	3.509200	3.064400
+1.344414	3.302207	3.081172
+1.667595	4.473797	3.060253
+1.809377	3.813863	3.081713
+1.831977	2.506186	3.080819
+1.851461	3.541685	3.066067
+2.005217	4.402174	3.067702
+2.164639	2.673436	3.075326
+2.366364	4.208267	3.080398
+2.369153	1.141864	3.067119
+2.452162	2.621622	3.063784
+3.166927	6.061094	3.065625
+3.254877	3.647654	3.072222
+3.366824	4.262128	3.082804
+3.492162	4.796967	3.086186
+3.714184	4.397245	3.071429
+3.942389	2.493097	3.064956
+4.570455	4.779318	3.082143
+0.590200	6.240400	3.074400
+0.616429	5.447989	3.089577
+0.620177	0.982920	3.077168
+0.839900	3.130000	3.080348
+1.092000	2.755636	3.087182
+1.332266	2.646059	3.088079
+2.035725	4.664638	3.079420
+2.372338	6.080390	3.065974
+2.629547	6.191317	3.087613
+2.672617	5.463925	3.084346
+2.695846	2.573923	3.081692
+2.907789	5.223579	3.084105
+2.963410	3.686994	3.078728
+3.150000	5.940000	3.050000
+3.327005	2.448122	3.087310
+3.368018	1.743514	3.075946
+3.600000	0.010000	3.060000
+3.626393	4.168525	3.077705
+3.733908	0.198966	3.076782
+0.614457	4.822659	3.091685
+0.629560	3.779223	3.106736
+1.067917	1.485641	3.102564
+1.095000	1.155476	3.081905
+1.276556	5.848222	3.086000
+1.394232	0.628652	3.094569
+1.497568	6.120967	3.122077
+1.664955	5.524324	3.092252
+1.808000	5.792933	3.081467
+1.870442	1.880088	3.090796
+1.941758	6.006703	3.103242
+2.072295	0.638197	3.089344
+2.124315	6.191986	3.089863
+2.228841	4.516522	3.079130
+2.388758	1.400229	3.103693
+2.500719	0.941871	3.090863
+2.728981	5.875370	3.081389
+3.165393	3.217416	3.083483
+3.322698	3.402857	3.086190
+3.414000	3.183400	3.077400
+3.471455	4.509515	3.101381
+3.542456	6.354199	3.094128
+3.628608	3.922152	3.083544
+3.660653	2.063015	3.091658
+3.920761	1.143370	3.087391
+3.958051	4.571186	3.103729
+3.978148	1.383519	3.082407
+4.337213	3.048197	3.078852
+4.581728	0.364938	3.093519
+0.829332	6.313819	3.111169
+1.526292	1.825899	3.097191
+1.545745	4.687660	3.098511
+1.636916	3.183383	3.112246
+1.730515	1.661838	3.103235
+2.133487	5.713026	3.102993
+2.136038	1.920189	3.091509
+2.219130	4.941159	3.093333
+2.480000	1.641707	3.092561
+2.637381	1.462857	3.087619
+2.636863	1.820196	3.088235
+3.044909	0.775455	3.099636
+3.229945	5.170685	3.113151
+3.392329	3.983425	3.096027
+4.089104	6.053582	3.089552
+4.307248	4.019060	3.103490
+4.462569	3.596147	3.088991
+4.578966	2.108828	3.093931
+0.614406	4.554266	3.107063
+0.611190	4.043690	3.106905
+1.078693	3.264602	3.114716
+1.298685	6.285014	3.120630
+1.309775	0.016854	3.114494
+1.494802	0.393164	3.108870
+1.537893	3.816679	3.116643
+1.550377	4.260849	3.103113
+1.569021	2.534000	3.112383
+1.924551	2.799449	3.116435
+2.634435	3.295043	3.115565
+2.638000	4.770286	3.110286
+2.691007	4.519424	3.113381
+3.193438	2.207344	3.100781
+3.602194	0.831484	3.106839
+3.612222	6.101111	3.099667
+3.847700	6.028650	3.112100
+4.132923	1.897769	3.111308
+4.309740	5.918842	3.119385
+4.578312	3.209740	3.104286
+0.854523	2.866231	3.127588
+0.858194	3.640220	3.127048
+0.896061	0.552963	3.122727
+1.044767	5.313837	3.117326
+1.052529	4.288059	3.122471
+1.476947	3.534466	3.132176
+1.639533	5.969844	3.128599
+1.675067	4.032400	3.110533
+1.893800	3.246800	3.119500
+1.912118	0.219082	3.127012
+2.060135	0.019324	3.115135
+2.746538	1.016955	3.133494
+3.053333	4.050476	3.109286
+3.074449	3.454487	3.124601
+3.335948	5.692714	3.121970
+3.400792	2.065667	3.121667
+3.614847	3.313190	3.120123
+3.733200	1.815200	3.113867
+3.825814	3.772326	3.113721
+3.903465	1.997228	3.121683
+4.308075	1.693369	3.133610
+4.560851	6.311560	3.115248
+0.880652	1.692717	3.118804
+0.871169	4.790974	3.133117
+1.044895	5.658531	3.145431
+1.220912	3.957541	3.139751
+1.316803	4.916531	3.125034
+1.528333	2.805238	3.122381
+1.685254	2.297119	3.123559
+1.773426	1.394422	3.137729
+2.090484	4.169677	3.120968
+2.349530	0.054201	3.130940
+2.452821	4.608803	3.125470
+2.486731	5.288770	3.128414
+2.978380	4.827887	3.141502
+3.096190	5.621524	3.122286
+3.477760	0.223120	3.125520
+3.785692	0.646000	3.141577
+4.070934	0.753391	3.133356
+4.570667	0.645487	3.129487
+4.570980	4.299118	3.125588
+0.634694	2.487296	3.143112
+1.291184	1.937763	3.135000
+1.316212	1.504394	3.136818
+1.917964	5.546764	3.142509
+2.592751	0.270106	3.156376
+2.692348	2.069103	3.152902
+2.692326	4.268372	3.128372
+2.994000	1.968000	3.132000
+3.015357	0.295714	3.133690
+3.047959	1.375714	3.132041
+3.224744	4.468590	3.132051
+3.389455	1.498364	3.130364
+3.435285	1.015854	3.139756
+3.581090	2.331280	3.149668
+4.096705	6.305233	3.141783
+4.104336	3.361538	3.144755
+4.352766	2.811064	3.133191
+4.585814	2.760000	3.118372
+0.636207	1.231379	3.141494
+0.858750	3.378523	3.146591
+0.876538	2.556667	3.148718
+1.093429	3.006190	3.145714
+1.638036	2.054286	3.150804
+1.695693	1.144818	3.149489
+2.156349	1.495556	3.142698
+2.256075	1.720093	3.150280
+2.387438	5.779835	3.157769
+2.661560	3.946086	3.162569
+2.939948	2.227959	3.160103
+3.212189	6.331108	3.156216
+3.269810	0.677286	3.152048
+3.273492	1.286508	3.154206
+3.804286	2.696807	3.140924
+4.039974	1.628675	3.157870
+4.074884	4.101163	3.136744
+4.099206	5.115556	3.138571
+4.270000	0.045100	3.165267
+0.628686	5.085200	3.161257
+0.853501	5.846024	3.168457
+0.882227	1.306597	3.163655
+0.963894	5.072861	3.174543
+1.147487	0.696884	3.164271
+1.389164	4.473908	3.171752
+1.620114	0.908523	3.156364
+1.872750	0.972125	3.152875
+2.023167	3.691000	3.148500
+2.067673	3.440204	3.167837
+2.150000	6.397500	3.143333
+2.374500	6.323833	3.164833
+2.808937	0.421884	3.160242
+3.215714	2.989429	3.150286
+3.523583	2.597250	3.160833
+3.631647	5.220884	3.167068
+3.843342	0.916247	3.172986
+4.197966	2.391441	3.155678
+4.324233	4.721104	3.159877
+4.519342	0.894737	3.156053
+4.548725	5.541544	3.161074
+0.617551	5.755510	3.155102
+0.863176	5.468243	3.166284
+1.147528	0.190148	3.183100
+1.304255	5.615691	3.176064
+1.577111	5.295827	3.180938
+1.637439	0.615732	3.159024
+1.704110	6.389863	3.166027
+2.122802	2.435495	3.174835
+2.311452	2.068710	3.156613
+2.562715	3.041900	3.178914
+2.801111	0.754138	3.184215
+2.869286	0.010714	3.150000
+2.915226	4.419095	3.174422
+2.938462	1.730888	3.175207
+4.073960	5.373926	3.175336
+4.205161	1.426022	3.159677
+4.332582	6.215879	3.168297
+4.547045	5.802045	3.168068
+0.852059	4.541324	3.176176
+1.062056	6.219065	3.172991
+1.548302	0.026981	3.185535
+2.157048	3.197048	3.178667
+2.190839	5.973077	3.182168
+3.178317	3.860099	3.179505
+3.935281	5.592809	3.175281
+4.057363	4.873035	3.190000
+4.157851	5.699256	3.173471
+4.287514	0.322977	3.187225
+4.537803	6.064470	3.180227
+4.556304	5.017826	3.168478
+0.644805	2.232857	3.190260
+0.827101	4.172678	3.202531
+1.481391	1.290397	3.192583
+1.662885	0.239808	3.185288
+1.775054	5.050975	3.201552
+1.845149	0.477127	3.198507
+2.828082	3.011289	3.202925
+2.884167	3.277647	3.190588
+3.178375	2.629500	3.178375
+3.447256	5.035915	3.184634
+3.569355	1.652903	3.182581
+3.578505	5.646168	3.193178
+3.829828	0.395603	3.192845
+4.003011	0.052707	3.195663
+4.006403	3.601367	3.196079
+4.006761	2.828732	3.194930
+4.009735	2.215503	3.195291
+4.129688	2.618281	3.176875
+4.562500	1.682500	3.180500
+1.100619	3.725457	3.213540
+1.121461	4.774270	3.194719
+1.254048	0.436587	3.197937
+1.271545	5.357091	3.208409
+1.433535	3.036768	3.203838
+2.089831	0.417119	3.199492
+2.612594	0.021992	3.226729
+2.906904	5.462703	3.206904
+2.986506	6.208476	3.206766
+3.029881	2.836119	3.209284
+3.094375	1.119018	3.201696
+3.506393	0.623279	3.192623
+3.854138	3.368161	3.207414
+4.360326	2.572065	3.194674
+4.552857	3.828000	3.183429
+0.671004	1.478476	3.214535
+0.893686	3.890784	3.215333
+1.093647	5.965176	3.209765
+1.345943	2.165314	3.220457
+1.735185	2.952074	3.208741
+1.854113	4.551210	3.210403
+2.033529	3.938235	3.215147
+2.037834	5.055207	3.216636
+2.245432	4.727037	3.202099
+2.552426	5.985503	3.213077
+2.629018	5.686727	3.215018
+2.841224	1.448776	3.204694
+3.498508	3.529905	3.219937
+3.771905	1.314139	3.213956
+3.780090	5.796937	3.218243
+4.096180	4.346242	3.219410
+4.305568	3.767622	3.214649
+4.306196	4.991196	3.202935
+4.304371	5.495166	3.211656
+4.339828	4.253621	3.195345
+4.521964	4.545018	3.221964
+4.537808	5.290000	3.210959
+4.556061	1.139697	3.198788
+0.672273	0.334034	3.217898
+0.918170	2.316027	3.228571
+1.127735	4.514872	3.229872
+1.149238	0.956000	3.213238
+1.317200	2.420640	3.214000
+1.374259	1.058580	3.227716
+1.879778	0.730556	3.219667
+1.939800	1.572400	3.207800
+1.957241	6.309261	3.225468
+2.248630	3.795260	3.234986
+2.337640	0.324607	3.227865
+2.414355	3.991452	3.215161
+2.651865	1.252694	3.219275
+3.194630	0.438148	3.227259
+3.284820	5.931317	3.229611
+3.409754	6.164472	3.227359
+3.542304	5.899032	3.222811
+3.759279	6.268417	3.234028
+4.063841	3.860530	3.218411
+4.272075	0.603208	3.226478
+4.438263	2.285154	3.228067
+1.100035	1.755140	3.238287
+1.396304	0.204130	3.226087
+1.446935	4.069032	3.225403
+1.473917	5.802581	3.237512
+1.836693	5.308645	3.232829
+1.911972	2.302066	3.231033
+2.041579	1.135439	3.228596
+2.323631	3.400238	3.230298
+2.445578	4.875378	3.234940
+2.501333	4.381583	3.228000
+2.506585	3.742846	3.233659
+2.548824	3.495588	3.222647
+2.710833	1.639792	3.221667
+2.776364	6.355522	3.237037
+2.781136	2.754545	3.219773
+2.853036	4.100714	3.220893
+2.920097	2.539094	3.235825
+3.238390	1.887881	3.228475
+3.514534	1.251093	3.236478
+3.614271	2.876979	3.220000
+3.822205	4.211614	3.234370
+4.080400	0.988400	3.217600
+4.528400	2.982356	3.230178
+0.652368	5.984474	3.239386
+0.666346	2.995321	3.243397
+0.893905	0.227524	3.236952
+0.916875	0.853068	3.237216
+1.228861	1.295730	3.240819
+1.530302	1.574523	3.247236
+1.540603	4.931525	3.247305
+1.717143	3.404347	3.247599
+1.740000	4.770467	3.235421
+1.868088	4.139755	3.240441
+2.540769	0.743793	3.252944
+2.785979	6.059897	3.231959
+3.828168	3.007634	3.234275
+4.311209	1.115055	3.234615
+4.518472	4.076332	3.249782
+0.666284	3.511093	3.249617
+0.678100	0.023100	3.244200
+0.883947	1.902456	3.250000
+1.058477	2.104371	3.247881
+1.779060	6.136410	3.249060
+1.996316	2.048308	3.256805
+2.273600	2.936000	3.237600
+2.300614	5.102982	3.252544
+2.531639	2.486393	3.238525
+2.914909	5.720909	3.240727
+3.135303	2.389773	3.252727
+3.199200	4.942840	3.257160
+3.366212	2.792727	3.258030
+3.734706	5.452549	3.250353
+4.013623	5.884058	3.238116
+4.274386	3.510702	3.255000
+4.534149	1.445319	3.249681
+4.537750	3.417000	3.238500
+0.672097	0.812097	3.246452
+1.258895	2.859448	3.264807
+1.372066	5.128404	3.268873
+1.421961	0.814314	3.255490
+2.162281	4.358947	3.248421
+2.466018	1.822301	3.257788
+2.950806	3.867258	3.251452
+2.981073	0.586590	3.264713
+3.059174	0.086281	3.264876
+3.573616	4.325203	3.270738
+3.756717	0.036919	3.263838
+3.825387	4.978297	3.267678
+4.264125	3.206500	3.249500
+4.284859	0.859366	3.260423
+4.285374	5.239728	3.266463
+4.526383	1.924610	3.258298
+0.667500	1.999500	3.258000
+1.691441	3.670932	3.263390
+1.699643	2.698669	3.283117
+1.718824	4.346387	3.264790
+2.023896	1.788701	3.262468
+2.319667	0.897444	3.267000
+2.320213	2.601915	3.255532
+2.477054	2.794274	3.277676
+2.515971	2.234029	3.268417
+2.738491	2.359340	3.268868
+2.971437	5.062874	3.270958
+3.018412	5.952396	3.281894
+3.070036	4.610253	3.279603
+3.359710	2.269203	3.270580
+3.412261	5.292783	3.269217
+3.494262	1.871557	3.263852
+3.677897	4.744369	3.286799
+4.044340	0.304528	3.256604
+4.205278	2.950556	3.263611
+0.691536	2.706519	3.282321
+0.883673	6.083527	3.285745
+1.351625	1.744750	3.267500
+1.374437	4.724225	3.286690
+1.704851	5.687264	3.291020
+1.708961	1.854156	3.270779
+1.968805	3.049386	3.285358
+1.981371	4.810323	3.279194
+2.282026	1.240727	3.292883
+2.788843	3.496942	3.273388
+2.812378	0.191443	3.297988
+2.817926	4.664815	3.280593
+3.109238	4.291143	3.275238
+3.267059	1.638431	3.276863
+3.486346	0.033109	3.288718
+3.544865	4.053243	3.274324
+3.997885	3.178846	3.271154
+4.103137	1.227451	3.265098
+4.513952	0.192455	3.278024
+0.688708	4.384125	3.291125
+0.703504	1.729562	3.292044
+1.031356	0.411525	3.280339
+1.177556	2.617778	3.284667
+1.231375	3.159625	3.289625
+1.220660	3.423160	3.297264
+1.362374	3.717393	3.291362
+1.959298	2.605165	3.296364
+2.073175	0.882169	3.298254
+2.126652	5.531448	3.292986
+2.765682	5.206477	3.295909
+2.894255	1.223191	3.278298
+2.941932	0.944659	3.282841
+3.178269	0.904038	3.281731
+3.402778	3.042222	3.279167
+3.561203	3.789622	3.295636
+3.750350	3.617273	3.291608
+3.770370	3.951605	3.283704
+4.305909	2.026970	3.279545
+0.677734	6.230156	3.301328
+0.911784	1.534054	3.307351
+0.940000	0.010000	3.270000
+0.968112	1.100629	3.293846
+2.540758	5.101061	3.286515
+2.766400	1.868400	3.294700
+3.076829	3.646341	3.305061
+3.254907	5.501173	3.310247
+3.291830	0.190850	3.299739
+3.400732	6.392317	3.298780
+3.444010	0.411719	3.299115
+3.432021	3.287553	3.295745
+3.647155	0.258707	3.295776
+3.780231	2.260694	3.302486
+3.937465	1.825493	3.293239
+3.985688	6.130182	3.315195
+3.997286	2.449286	3.295000
+4.436531	6.394898	3.303061
+0.711304	1.056877	3.311344
+0.712129	3.251000	3.321581
+0.903538	3.035846	3.304462
+0.952764	2.724874	3.317889
+1.058195	4.084269	3.319914
+1.463140	6.242369	3.324766
+1.470167	1.957333	3.301000
+1.478756	3.270207	3.312280
+1.600000	4.557344	3.300938
+1.959000	5.733900	3.302800
+2.318019	5.355566	3.314057
+2.335828	0.581943	3.316306
+2.369762	3.154206	3.307222
+2.489781	1.073880	3.306721
+2.513500	1.521625	3.306313
+2.582061	4.147576	3.310667
+2.612906	0.487048	3.327368
+3.101185	5.284007	3.320348
+3.116667	2.099964	3.318261
+3.413227	0.825777	3.313108
+3.630116	3.129767	3.301279
+3.647680	1.031438	3.319150
+3.830065	1.559351	3.305325
+3.985270	0.571577	3.307973
+4.482375	0.471167	3.315125
+0.730143	0.572837	3.335931
+1.167188	4.983984	3.314297
+1.239842	4.289974	3.326359
+1.728485	2.442121	3.304848
+2.083719	4.583058	3.316364
+2.237778	1.896481	3.316852
+2.607163	5.402837	3.328365
+2.698647	4.904839	3.334404
+2.739351	3.748442	3.316948
+3.038594	1.547711	3.330683
+3.247910	3.455149	3.317836
+3.320208	3.689375	3.306250
+3.562347	2.128265	3.316327
+4.183710	4.574234	3.329718
+0.704343	4.905182	3.341533
+0.938067	4.379412	3.326807
+1.434355	2.695323	3.317097
+1.581443	2.218247	3.344021
+2.044536	1.378900	3.335601
+2.075455	5.281515	3.330076
+2.078043	2.825652	3.317391
+2.325359	4.527124	3.327778
+2.359091	6.075195	3.318052
+3.127534	3.170434	3.338428
+3.305636	1.109697	3.332242
+3.763161	2.527548	3.337935
+3.830400	5.232000	3.327867
+4.001527	2.827679	3.392439
+4.479174	4.843760	3.333347
+0.689848	3.996667	3.333788
+0.693718	4.637051	3.334103
+1.165525	6.371381	3.336961
+1.191645	5.787500	3.336382
+1.479186	0.600000	3.337209
+1.765105	0.083636	3.340420
+1.836429	1.236508	3.340635
+1.914854	3.570766	3.342956
+2.010439	0.108070	3.337982
+2.026650	6.087340	3.337931
+2.075036	0.622929	3.351357
+2.205199	6.271618	3.350663
+2.313947	2.370614	3.340088
+2.720944	4.409485	3.349270
+3.110397	4.037960	3.359943
+3.137921	5.729406	3.334356
+3.183256	6.134477	3.340407
+3.344367	4.191265	3.345753
+3.347170	3.929811	3.330755
+3.399488	4.795116	3.338419
+3.604627	1.468806	3.330149
+3.733486	6.021101	3.334404
+4.189689	1.810518	3.344560
+4.218923	4.099538	3.329385
+4.248507	6.050149	3.337463
+4.494141	3.640202	3.332222
+0.694255	5.476596	3.340957
+0.960743	3.539459	3.351588
+0.955457	5.313241	3.360055
+0.974037	3.271101	3.343028
+1.160000	0.010000	3.320000
+1.170545	1.526000	3.342182
+1.647168	0.414661	3.362861
+1.666387	0.760126	3.359580
+1.806439	3.905707	3.349707
+2.205125	5.785625	3.360271
+2.342308	4.229128	3.351949
+2.426775	5.592085	3.352769
+2.570470	4.620671	3.347651
+3.359532	2.528857	3.356208
+3.357500	1.414474	3.350000
+3.669065	0.761667	3.354187
+3.780441	2.003676	3.346029
+3.903947	1.105197	3.363750
+3.955556	4.699487	3.344017
+4.408723	5.695213	3.343191
+4.474307	2.744270	3.351049
+0.703883	5.226019	3.356117
+0.928766	6.330519	3.361169
+0.986410	0.641603	3.360577
+1.203947	6.119035	3.364123
+1.477129	5.572327	3.357772
+1.646381	1.380667	3.360952
+1.765496	1.631908	3.364351
+1.808670	5.916543	3.362766
+2.166053	1.615263	3.359145
+2.197257	4.909115	3.360442
+2.258090	0.117990	3.365628
+3.133893	1.304966	3.358993
+3.510227	4.564091	3.347727
+3.674583	0.503250	3.355333
+3.700986	1.766056	3.350704
+3.984545	4.055455	3.351970
+3.995192	6.386250	3.353462
+4.215000	2.237245	3.360612
+0.717593	2.387685	3.371204
+0.733443	3.736437	3.377395
+0.936000	5.586594	3.385125
+0.959219	4.839023	3.375508
+1.244359	1.992821	3.366795
+1.492329	4.334932	3.372808
+1.553333	3.893333	3.361053
+1.596829	6.033537	3.361829
+1.642966	4.127797	3.366695
+1.713297	3.156341	3.374384
+1.755254	0.994746	3.357119
+1.929274	3.300484	3.370242
+1.945629	4.372781	3.377483
+2.094600	4.147133	3.375900
+2.184783	3.568127	3.378462
+2.579851	3.292677	3.376840
+2.684412	0.922353	3.370662
+3.654634	3.378537	3.382561
+4.062946	5.190775	3.373023
+4.229800	4.829800	3.361800
+4.479769	0.730615	3.367615
+4.484519	3.203558	3.360865
+0.719000	5.728667	3.375467
+1.503617	2.464787	3.373511
+1.558000	1.138471	3.386647
+1.873205	0.298974	3.370256
+2.566308	2.013231	3.377308
+2.710959	5.877021	3.382705
+3.004556	3.405089	3.381479
+3.033134	1.858507	3.369552
+3.276524	4.460024	3.386952
+3.375288	5.722404	3.370481
+3.809317	2.788075	3.372609
+4.052438	2.034000	3.386594
+4.223701	6.298110	3.371575
+4.465769	5.930577	3.370385
+4.479692	4.335077	3.368769
+4.477500	5.122639	3.370833
+1.206513	5.529145	3.400461
+1.236098	0.590585	3.394683
+1.395841	1.421327	3.391416
+1.499293	3.516061	3.385960
+1.559850	2.905225	3.397800
+1.670920	5.421954	3.388391
+1.699559	6.314485	3.389265
+1.899748	5.512516	3.393899
+2.503975	0.175607	3.399038
+2.703851	2.586988	3.394689
+3.036400	0.316267	3.389911
+3.508704	5.503333	3.397623
+3.569434	2.693585	3.387925
+3.585949	4.977487	3.403282
+4.200000	5.817963	3.379444
+4.212059	0.170000	3.382941
+4.220891	2.488317	3.388812
+4.469638	0.989783	3.389565
+4.461429	6.181633	3.380816
+4.473043	5.459783	3.382174
+0.762303	1.302191	3.402079
+1.008214	2.479762	3.400595
+1.385273	0.376800	3.406691
+1.374078	5.957670	3.401165
+1.400000	0.010000	3.372500
+1.605376	5.141221	3.408427
+2.099082	2.258163	3.392857
+2.310636	2.122182	3.394818
+2.453523	6.300303	3.406023
+2.458192	5.847910	3.401751
+2.785277	5.594298	3.405277
+3.163502	6.378953	3.411372
+3.302319	0.604589	3.398986
+3.350310	2.030543	3.399302
+3.930986	0.818630	3.415507
+3.959143	1.364000	3.392143
+3.968500	5.430833	3.394500
+4.221932	2.747273	3.392159
+4.227679	1.379464	3.397679
+4.455167	1.258662	3.404201
+0.948082	5.861049	3.425601
+1.032595	1.324524	3.423119
+1.195985	1.097406	3.425761
+1.254394	3.927197	3.414508
+1.429759	5.328072	3.410000
+1.547729	0.176507	3.420306
+2.719419	1.406977	3.404767
+2.949719	2.315082	3.420304
+2.960939	4.839797	3.420203
+3.169821	2.716786	3.398929
+3.473288	1.665856	3.419452
+3.567881	2.368390	3.403559
+3.860154	0.206462	3.406615
+3.907055	3.781650	3.417508
+3.919124	5.677591	3.404161
+4.189924	0.438550	3.415420
+4.460909	3.878523	3.404091
+4.470857	2.481714	3.396571
+0.876481	5.074630	3.412593
+1.240714	0.835000	3.405952
+1.539889	1.760000	3.420667
+2.119273	0.327932	3.437886
+2.182996	3.289401	3.427753
+2.502078	1.295974	3.417273
+2.552551	3.917092	3.422857
+2.877074	2.047340	3.425691
+2.929024	2.712683	3.423049
+3.356792	5.095849	3.407925
+3.620413	5.751770	3.424690
+4.174317	5.569137	3.418561
+4.393981	1.566852	3.414722
+0.762000	2.144909	3.432455
+1.073061	2.910000	3.416735
+1.813571	4.912755	3.426429
+1.823795	2.155281	3.438020
+1.859094	2.857774	3.435736
+2.041282	3.794359	3.438872
+2.290507	3.970254	3.442535
+2.536849	3.005000	3.428767
+2.926563	4.204063	3.418438
+2.925222	6.295611	3.433278
+2.976618	2.966029	3.431127
+3.447737	6.007956	3.425912
+3.933119	3.505505	3.433211
+4.023758	4.934395	3.440637
+4.048842	1.605946	3.433822
+0.762436	0.133846	3.436282
+0.995049	3.809126	3.434175
+1.016585	0.129538	3.452985
+1.197365	5.219606	3.450197
+1.284557	4.532966	3.452446
+1.602663	4.767389	3.452611
+1.832177	0.576122	3.438299
+1.849655	4.665747	3.432069
+1.887389	1.894522	3.445987
+2.167692	2.545846	3.430000
+2.219464	1.031250	3.436429
+2.276897	2.772155	3.434914
+2.726145	1.156867	3.439759
+2.767590	3.118313	3.438494
+2.809948	3.967098	3.438290
+2.831514	1.673267	3.442510
+3.067233	0.752327	3.441384
+3.604090	5.250396	3.453087
+4.152908	3.634610	3.442979
+4.173825	0.698470	3.448415
+4.213556	3.870667	3.423556
+4.238462	4.323718	3.444872
+1.176264	3.641319	3.446044
+1.876234	5.171778	3.462594
+2.200676	3.028514	3.446351
+2.371243	4.744320	3.451243
+2.389252	1.680204	3.453333
+2.564915	6.074542	3.463559
+2.723043	2.846957	3.442899
+2.731190	0.687738	3.447738
+2.897033	5.363445	3.455502
+2.954559	4.453088	3.448603
+3.081200	1.072350	3.453950
+3.542308	2.941209	3.443077
+3.615494	6.208670	3.450043
+3.696286	4.142286	3.440714
+3.983646	4.286133	3.452155
+4.151250	3.120417	3.440417
+1.009744	4.589829	3.468889
+1.021572	1.942704	3.463019
+1.188974	4.773846	3.447179
+1.265739	0.161565	3.453565
+1.273765	2.228704	3.461049
+1.388697	4.959910	3.476472
+1.914797	6.382276	3.454146
+2.307419	1.433065	3.451613
+2.400120	3.700876	3.468167
+2.400805	5.003678	3.455862
+2.612584	3.546292	3.449551
+2.923717	0.027368	3.476776
+3.241155	2.955988	3.464985
+3.257635	1.801554	3.463784
+3.700615	1.251385	3.460103
+4.165758	0.957374	3.455960
+4.409133	3.432954	3.472222
+4.417432	4.568716	3.463268
+0.773524	1.888667	3.474286
+0.804188	2.875550	3.478429
+1.007265	2.232059	3.482941
+1.014430	0.916709	3.458987
+1.007377	1.690328	3.467213
+1.278167	2.481833	3.467833
+1.300968	3.004409	3.476505
+1.641486	1.981622	3.462703
+1.893117	0.816104	3.460000
+1.911757	2.408745	3.471757
+1.971908	1.066151	3.474375
+2.460598	0.862735	3.467009
+2.613200	1.789000	3.464200
+2.871736	6.050826	3.469256
+2.941061	5.792122	3.477510
+3.195745	5.928404	3.473245
+3.874434	3.254660	3.479968
+3.920682	5.926515	3.461364
+4.025422	0.029333	3.475156
+4.411440	1.851206	3.483502
+0.770526	0.788246	3.467719
+1.244783	1.717681	3.477681
+1.497561	0.907195	3.469146
+1.584133	5.819867	3.473333
+1.731273	4.462727	3.478909
+2.391034	3.437586	3.467586
+2.407568	0.393063	3.474414
+2.493813	4.397813	3.475000
+2.664854	0.016505	3.483398
+2.685325	6.297597	3.476883
+2.879163	0.495665	3.483498
+2.888760	3.621405	3.484339
+3.128704	5.038765	3.482654
+3.195870	4.717640	3.487994
+3.278938	0.357611	3.485310
+3.365754	6.242291	3.475251
+3.437944	3.513084	3.474673
+3.647738	0.095714	3.475714
+3.706200	4.559600	3.467400
+3.769000	3.017250	3.472250
+4.261822	5.051051	3.492079
+4.417360	2.133600	3.481240
+4.423878	0.044354	3.477551
+4.435373	2.987910	3.468060
+0.753902	6.006585	3.476341
+0.797816	2.592031	3.499885
+0.804186	0.377535	3.493023
+1.247821	2.743619	3.501362
+1.381667	4.142308	3.491026
+2.190882	4.385539	3.495343
+2.205542	5.146988	3.484819
+2.489651	2.463953	3.483140
+3.131683	2.492970	3.487822
+3.584681	1.944043	3.480319
+4.145551	3.371066	3.496801
+0.801513	4.187697	3.499342
+1.686505	3.745922	3.497087
+1.725340	3.486456	3.505388
+1.836324	6.135784	3.509608
+1.860210	4.147832	3.495594
+2.073947	4.743158	3.494211
+2.104306	2.030417	3.489583
+2.880749	5.102834	3.507166
+3.054516	3.815726	3.493548
+3.241429	2.249365	3.507937
+3.324112	5.320374	3.492056
+3.403786	3.159500	3.499643
+3.749744	5.516282	3.498910
+3.797517	6.380455	3.516818
+3.872024	0.435893	3.500893
+4.402427	4.130921	3.500209
+1.304086	3.273555	3.516080
+1.360000	5.734000	3.512000
+1.842734	1.419820	3.517014
+2.438542	5.248177	3.514740
+2.629204	5.085664	3.508850
+2.688757	0.316836	3.521808
+2.924505	1.293297	3.504615
+3.094264	5.513876	3.510698
+3.284159	0.931416	3.505310
+3.480577	4.035096	3.511442
+3.638841	3.654493	3.514130
+3.809916	4.813866	3.508151
+4.017895	2.277895	3.503553
+4.398525	0.308579	3.513770
+0.788962	3.441038	3.515472
+0.993971	6.129779	3.511691
+1.041897	4.251897	3.513793
+1.055692	0.446443	3.527826
+1.826870	5.722672	3.520687
+1.973503	5.943450	3.603259
+2.250000	5.486522	3.517043
+2.261957	5.989946	3.520924
+2.708000	4.211333	3.523111
+2.743023	4.716434	3.522093
+2.788528	3.369722	3.532472
+2.885842	0.930891	3.518812
+3.201917	3.604889	3.534417
+3.242938	1.551688	3.523000
+3.412978	3.784831	3.521236
+3.493961	1.093052	3.532792
+3.529607	0.312295	3.532000
+3.688077	3.900769	3.507500
+3.809408	5.074737	3.513750
+0.786604	4.450000	3.520755
+1.077148	3.132096	3.540687
+1.519091	6.386883	3.521818
+1.513103	3.132759	3.518276
+2.037143	4.983571	3.526143
+2.063333	5.643141	3.535449
+2.169247	1.246986	3.530959
+2.384167	1.927222	3.517639
+2.502780	0.618976	3.534537
+2.511014	2.206329	3.538841
+2.517432	2.730137	3.539016
+2.707544	2.361930	3.518070
+3.157757	4.240514	3.531028
+3.306923	1.261346	3.522500
+3.402194	0.066367	3.532266
+3.515069	4.297743	3.534688
+3.701127	1.593333	3.528333
+3.881118	1.778882	3.529627
+4.108615	1.187385	3.518462
+4.386084	5.288112	3.527692
+0.783415	6.242683	3.527805
+1.069558	3.402210	3.546022
+1.171906	5.950809	3.552689
+1.433935	3.769379	3.544379
+1.601975	1.550191	3.540000
+1.670513	2.403077	3.533333
+1.723911	2.659815	3.545978
+2.111745	0.030468	3.550170
+2.168486	1.790784	3.554541
+3.149109	0.144368	3.552759
+3.216360	3.326207	3.545900
+3.370914	2.735635	3.542995
+3.519486	0.579673	3.543224
+3.555029	4.746192	3.549477
+3.934834	4.525762	3.542384
+4.114264	6.073953	3.537907
+4.382345	0.568207	3.541379
+0.798571	3.928571	3.545000
+0.795075	4.711940	3.542537
+0.825455	1.038485	3.548182
+0.824388	3.187908	3.555306
+0.835980	1.523660	3.556438
+1.096763	4.988426	3.567339
+1.347276	6.203621	3.555483
+1.406832	0.700495	3.551188
+1.417287	2.041117	3.549043
+1.930345	1.666069	3.551379
+1.978804	3.059185	3.553804
+1.980733	2.659400	3.549933
+2.222301	0.805739	3.558011
+2.225758	0.541273	3.554545
+3.521333	6.396889	3.540667
+3.735049	0.931845	3.545728
+3.796731	2.356731	3.535000
+4.047059	0.272745	3.538039
+4.118435	4.712652	3.552087
+0.826979	5.429532	3.572255
+1.592180	6.166992	3.559549
+2.026656	5.372125	3.575750
+2.419442	3.191076	3.568606
+2.454767	1.098895	3.560756
+2.459337	4.143976	3.567349
+2.517759	1.496207	3.550000
+2.606235	5.709471	3.564000
+2.987215	3.192877	3.566712
+3.121023	0.536093	3.568791
+3.155263	2.006974	3.553947
+3.497115	2.170224	3.567821
+3.480618	1.442542	3.577482
+3.655549	5.980445	3.574036
+3.860755	6.141415	3.561698
+4.139005	4.079147	3.565261
+4.146094	5.335938	3.551250
+4.377450	3.689060	3.554966
+1.000896	2.736418	3.560746
+1.089823	5.689381	3.586047
+1.467798	2.616607	3.569583
+1.520377	4.539811	3.567484
+1.527162	1.311892	3.565541
+1.617700	5.587100	3.571550
+1.742822	1.181245	3.574689
+2.080283	6.242085	3.586862
+2.100789	1.490132	3.561711
+2.668729	5.349171	3.568674
+2.689067	3.752000	3.571067
+3.504744	0.828205	3.563846
+3.638485	2.530758	3.563485
+3.776165	0.665090	3.578746
+4.357639	0.836898	3.579769
+4.364430	4.805436	3.572416
+4.361447	5.825921	3.561711
+4.370833	5.582083	3.559583
+1.032941	4.006176	3.583015
+1.092876	0.714335	3.583219
+1.343956	3.522637	3.578242
+1.585598	4.011624	3.586068
+1.712356	0.289540	3.582069
+1.936200	0.197600	3.571200
+1.994712	4.529640	3.594317
+2.019883	3.432953	3.589357
+2.356000	5.697778	3.569778
+2.885849	2.519245	3.575597
+3.098333	5.269643	3.575714
+3.143341	6.160935	3.591449
+3.242362	3.973568	3.582563
+3.336667	4.914394	3.567576
+3.330278	5.568167	3.580944
+3.814118	2.103529	3.589538
+3.895985	4.012117	3.580730
+4.060552	6.342566	3.588585
+4.077802	5.770055	3.582253
+4.358352	6.075824	3.571978
+4.351011	6.341011	3.581180
+1.239780	1.301282	3.597179
+1.373055	5.489539	3.606455
+1.403016	1.105794	3.584206
+1.573488	0.520640	3.590116
+1.607930	4.280881	3.598943
+1.715376	0.922688	3.587634
+1.812428	3.254529	3.601377
+2.300053	6.379158	3.590526
+2.551389	4.862361	3.588750
+3.038653	1.751036	3.594870
+3.418352	2.426758	3.593077
+3.432773	5.820504	3.585714
+3.638235	3.209804	3.587598
+3.675680	2.792426	3.593550
+3.880611	5.307889	3.590000
+4.120774	1.815806	3.592903
+4.228667	2.943939	3.591879
+4.351444	1.106203	3.593209
+4.368831	2.735455	3.583636
+0.831892	5.699527	3.596216
+0.860798	0.604172	3.598221
+0.953507	5.209478	3.603284
+1.078051	5.422542	3.600169
+1.097869	1.509016	3.595410
+1.353439	1.536688	3.605605
+1.594301	5.327306	3.608342
+1.710547	1.785323	3.605970
+1.711310	2.998363	3.615239
+2.079528	4.009571	3.599442
+2.258778	2.270833	3.609222
+2.293003	0.217157	3.612875
+2.368526	2.934211	3.601158
+2.686800	2.004571	3.601314
+3.000103	4.038144	3.594948
+3.011321	1.499245	3.589057
+3.420137	4.533288	3.591096
+3.771192	4.306995	3.606736
+3.964481	1.008506	3.602597
+0.858421	3.698684	3.618202
+1.118328	6.332958	3.610836
+1.365673	4.730481	3.608462
+1.444706	2.361373	3.608725
+1.609464	2.187321	3.599643
+1.894737	3.653053	3.606947
+2.007513	0.657919	3.615685
+2.127989	2.857759	3.615287
+2.475612	5.491122	3.615306
+2.734535	4.459942	3.609070
+2.926564	0.258650	3.613190
+3.760132	3.454305	3.608874
+3.805699	5.763656	3.620573
+4.095254	2.521949	3.605424
+4.109853	1.424265	3.597794
+4.324235	3.195882	3.617529
+4.353294	1.405059	3.602588
+4.340872	2.481544	3.615235
+1.656794	4.976327	3.627983
+1.832141	3.908049	3.635095
+2.004595	2.219459	3.614189
+2.517605	4.609191	3.631327
+2.900786	0.705286	3.625571
+3.135421	4.493645	3.611776
+3.472200	5.102000	3.616400
+3.833333	0.010000	3.607778
+3.859952	1.409614	3.621981
+3.995315	3.060961	3.633123
+4.036269	5.120896	3.611194
+4.072019	3.826442	3.625577
+4.229516	2.245484	3.609516
+0.842791	4.961744	3.619767
+0.875985	1.274672	3.631606
+1.173196	3.812165	3.627423
+1.288864	0.481761	3.631250
+1.361410	4.357436	3.630641
+1.442927	2.865000	3.625122
+1.461458	5.966667	3.633802
+2.212659	3.615635	3.638690
+2.258171	4.896286	3.629314
+2.621233	1.277808	3.634795
+2.682417	1.008083	3.631917
+2.752484	1.506369	3.641783
+2.743786	5.918786	3.631786
+3.070000	2.739500	3.617000
+3.138867	5.735123	3.629901
+3.296475	0.713852	3.629098
+4.009187	5.524228	3.624309
+4.079085	0.526078	3.637320
+4.238174	0.145434	3.634658
+0.873237	2.058417	3.635252
+1.230324	0.930356	3.647152
+1.416786	1.790982	3.637143
+1.460544	0.299456	3.638095
+1.534621	3.349798	3.650303
+1.734420	5.927800	3.655780
+2.236679	4.626900	3.648524
+2.291632	2.618289	3.647816
+2.901389	5.601389	3.630972
+3.010299	3.456866	3.634478
+3.020556	6.398889	3.624444
+3.389636	1.926727	3.629273
+3.765329	0.243699	3.645517
+3.866575	2.626740	3.639337
+4.319156	1.663556	3.645600
+4.326316	3.926491	3.631404
+1.063832	1.124673	3.648318
+1.129432	4.434545	3.640682
+2.408044	6.151240	3.660744
+2.463636	5.896883	3.641429
+2.540143	0.139810	3.652190
+2.558349	3.405000	3.653761
+2.830933	2.205333	3.641067
+2.850198	2.998218	3.647426
+2.927826	4.289437	3.663299
+2.952154	4.647846	3.646308
+4.058421	2.083289	3.643026
+1.114412	1.811471	3.646471
+1.126947	2.076632	3.652105
+1.128448	2.914138	3.655517
+1.155578	0.248741	3.666871
+1.381409	0.052610	3.675935
+1.427500	5.147440	3.660595
+1.781304	2.026739	3.657174
+1.823369	4.750494	3.678820
+2.090000	2.455522	3.647910
+2.375476	1.312143	3.647857
+2.410528	3.891901	3.674261
+2.649032	3.997097	3.650000
+2.825607	2.746262	3.660748
+2.854724	4.900394	3.656929
+3.423136	2.964746	3.654068
+3.497750	5.390875	3.652250
+0.879020	1.769020	3.653922
+0.900541	5.944472	3.678575
+0.902661	0.228548	3.668226
+1.137848	4.695949	3.672405
+1.174272	2.382722	3.682880
+1.813803	0.019108	3.682629
+2.232843	4.198235	3.662745
+2.256964	3.359107	3.656964
+2.313989	1.565319	3.667979
+2.646986	2.549658	3.671575
+2.663993	3.161282	3.677839
+2.714146	0.519024	3.657805
+2.774667	1.775500	3.661500
+2.937754	1.978941	3.676102
+2.955349	1.105659	3.672713
+2.995269	5.951935	3.681774
+3.048717	2.338586	3.683272
+3.096353	0.852941	3.667412
+3.440046	3.356250	3.675463
+3.450560	6.110960	3.663920
+3.837167	3.723348	3.670129
+4.033214	3.535268	3.665893
+4.046842	0.775000	3.661711
+1.808913	0.505261	3.682609
+1.838953	5.528014	3.688412
+2.227154	1.049112	3.693029
+2.248829	5.300360	3.679820
+2.517407	1.731414	3.690135
+2.660769	0.758803	3.683675
+2.666480	6.156786	3.684235
+3.116240	4.873872	3.694039
+3.209700	1.078300	3.698200
+3.265307	6.376316	3.686272
+3.438344	1.687748	3.680265
+3.675392	1.810506	3.688101
+3.673581	4.077973	3.683514
+4.294481	2.001749	3.681803
+4.275556	4.545313	3.691146
+0.907067	0.850933	3.681600
+0.905059	2.989882	3.688706
+1.354592	3.972602	3.693469
+1.592407	3.616420	3.687593
+1.991146	0.914167	3.695052
+2.038626	0.389121	3.688132
+2.195904	3.108883	3.698883
+2.365789	4.408421	3.686842
+2.761622	6.394865	3.677838
+3.102171	2.983808	3.697651
+3.579631	5.634538	3.699103
+3.661583	4.949778	3.698861
+3.985089	4.884464	3.699196
+4.259547	4.270121	3.705438
+0.895179	4.320893	3.695536
+1.192140	4.176347	3.711107
+1.824200	5.270600	3.693000
+1.903364	6.389813	3.694766
+1.956197	1.864648	3.694225
+1.979416	1.191948	3.709286
+2.188473	5.816158	3.706355
+2.462765	5.069625	3.703481
+2.508131	0.401495	3.697009
+3.235451	2.573819	3.705625
+3.243717	5.109867	3.703982
+3.338710	0.475968	3.691290
+3.643618	4.511709	3.698141
+3.988761	1.620000	3.707212
+4.056410	2.788051	3.703897
+1.149167	3.577667	3.707500
+1.192019	5.234327	3.714904
+1.855158	2.504421	3.702211
+1.898356	5.041507	3.708219
+2.622368	2.898053	3.715632
+2.785364	3.565099	3.715695
+2.903910	5.359799	3.724211
+2.914907	6.217920	3.717547
+3.034556	3.691000	3.710222
+3.189835	1.363992	3.715679
+3.269425	5.950402	3.713966
+3.317425	4.345389	3.714731
+3.591875	0.032500	3.706063
+3.651161	1.283125	3.705804
+3.672727	5.215455	3.705354
+3.958605	5.963688	3.723121
+4.002914	4.344686	3.712686
+4.279778	3.445778	3.704667
+0.919053	4.574852	3.715325
+0.939395	2.542326	3.718419
+1.774891	4.470876	3.719124
+1.892888	2.830036	3.725740
+2.131833	5.089167	3.711167
+2.196483	2.017585	3.737987
+2.444197	0.899343	3.724854
+2.440845	2.417042	3.714789
+2.461032	3.634603	3.716825
+2.788235	0.010000	3.707647
+2.859148	3.873409	3.724432
+3.373578	0.237890	3.721193
+3.576405	3.841373	3.719477
+3.748596	3.016082	3.719766
+3.988727	0.123000	3.724909
+4.249200	5.188100	3.726700
+0.923194	6.218168	3.728586
+0.917119	3.476949	3.722881
+0.933932	2.284274	3.724615
+1.181592	2.648726	3.733503
+1.517328	0.841422	3.738799
+1.789158	4.156842	3.735684
+2.465282	2.023944	3.729085
+2.725344	5.159924	3.739771
+3.140618	0.338146	3.729045
+3.267075	5.371429	3.729728
+3.289306	2.123750	3.721528
+3.666542	0.482712	3.748427
+3.685304	6.185217	3.726522
+3.810000	4.702361	3.723472
+3.930424	3.298545	3.732303
+3.942857	2.360974	3.733636
+4.265306	5.440408	3.725306
+4.283409	0.407045	3.713182
+1.243195	3.140237	3.742071
+1.278407	5.794973	3.751209
+1.462332	6.351989	3.763320
+1.753713	6.207178	3.744455
+1.794405	2.261548	3.736310
+1.937076	5.761345	3.738596
+2.525655	6.372768	3.745238
+2.991322	5.100460	3.739425
+3.276217	4.664957	3.744174
+3.407711	1.238554	3.736627
+3.486901	2.625704	3.741831
+3.567667	3.575400	3.752967
+4.218723	5.932553	3.726809
+1.337426	2.181864	3.762663
+1.545693	5.757154	3.756217
+1.756458	1.574792	3.737500
+1.801667	3.466778	3.752056
+1.948269	1.446346	3.742692
+2.015576	4.283680	3.756320
+2.057742	3.789194	3.748978
+2.363485	0.640644	3.756515
+2.690689	5.537356	3.760467
+2.944967	0.492026	3.752157
+3.281111	3.169630	3.746852
+3.298616	3.739322	3.757627
+3.702703	2.292568	3.741892
+3.794123	5.493070	3.743596
+3.927421	1.895833	3.754206
+3.985020	1.220040	3.756397
+4.196594	0.966006	3.757337
+4.220826	6.191364	3.752645
+4.261449	0.666957	3.741159
+4.259714	5.698857	3.734571
+0.985059	3.232485	3.778491
+1.272739	6.068185	3.769236
+1.285315	0.699505	3.768468
+1.499862	3.074050	3.771433
+1.565455	4.708446	3.771378
+1.575000	1.148276	3.748621
+1.610522	2.521522	3.770478
+1.637533	2.785267	3.756867
+2.047045	4.858864	3.758636
+2.076195	1.657345	3.758938
+2.085028	5.542486	3.766851
+2.093977	0.157614	3.760795
+2.184409	6.069685	3.748976
+3.193821	1.625472	3.768726
+3.223512	3.474762	3.770000
+3.417595	4.050541	3.770622
+3.438681	0.968462	3.755055
+3.629388	2.054694	3.751633
+3.675122	1.037561	3.749024
+0.947723	5.553762	3.763267
+1.261549	4.993662	3.766901
+1.536697	1.448394	3.774312
+1.546081	2.014542	3.773516
+2.135556	6.396667	3.763333
+2.924900	1.341833	3.779100
+3.017800	0.069546	3.777959
+3.646996	1.536567	3.778712
+3.668889	0.801944	3.756389
+4.031692	4.600154	3.777744
+4.236581	1.251453	3.764615
+4.238854	3.688854	3.762604
+0.982157	3.853922	3.785441
+1.004648	0.449805	3.786563
+1.190667	5.552933	3.775867
+1.287440	3.394480	3.781120
+1.608261	0.135280	3.782919
+2.600072	2.238406	3.776594
+2.716133	4.201067	3.777467
+2.740327	4.656797	3.776013
+2.848103	0.899770	3.781954
+3.194101	1.891573	3.778315
+3.487753	6.338590	3.779339
+3.921791	6.226418	3.783358
+4.215491	4.793757	3.779249
+4.239844	2.647813	3.771406
+0.954167	4.811875	3.778750
+1.255373	1.677015	3.795224
+1.266757	1.927838	3.787297
+1.352030	3.718687	3.803851
+1.536410	4.426325	3.795983
+1.574925	3.853134	3.775224
+1.849075	0.247543	3.805377
+1.943402	3.137191	3.806160
+2.075802	2.661975	3.781481
+2.428472	4.796806	3.780278
+2.541972	5.327606	3.777324
+2.762424	0.326212	3.778788
+3.172292	4.153125	3.782917
+3.558060	4.278881	3.800709
+3.951446	0.360602	3.785542
+0.964462	4.112615	3.794000
+0.980444	1.426000	3.789556
+0.979500	2.779300	3.793900
+0.979587	5.060000	3.803140
+1.788588	1.032316	3.809040
+2.287656	1.774531	3.796406
+2.583407	4.404505	3.791209
+2.795714	2.392101	3.799916
+2.943462	1.608590	3.793205
+2.984982	2.597365	3.808845
+3.065603	3.278621	3.799397
+3.108304	3.914620	3.805322
+3.352420	5.722038	3.799936
+3.471351	0.662819	3.807876
+3.543376	5.903939	3.808824
+3.877725	5.102036	3.797305
+3.902031	0.615430	3.810039
+4.029571	5.325643	3.810643
+4.189388	2.389429	3.814327
+1.123409	0.026688	3.818669
+1.575769	1.709231	3.796731
+1.586066	5.495972	3.810664
+1.626818	0.375682	3.797045
+2.287799	0.374654	3.815409
+2.411731	5.713269	3.800769
+2.655126	4.907787	3.823165
+2.852521	5.754062	3.821541
+3.417876	4.945693	3.821298
+3.538654	3.122404	3.805577
+3.560331	4.727769	3.808926
+3.666056	3.334648	3.809437
+4.029684	4.106013	3.808101
+4.197668	1.507720	3.812850
+0.996267	1.932800	3.810800
+1.219149	1.431277	3.809574
+1.293288	4.509452	3.814795
+1.340098	1.202580	3.833317
+1.416392	2.685979	3.809485
+1.554643	4.161964	3.817321
+1.758516	1.305875	3.830326
+1.863944	0.727702	3.828292
+1.960325	2.102927	3.816423
+2.038682	5.289591	3.828773
+2.191282	0.823718	3.817051
+2.621394	3.811010	3.819615
+2.813229	3.329561	3.832853
+3.576476	2.853429	3.828143
+3.714331	2.533622	3.814173
+3.840172	3.935776	3.810690
+3.891606	0.894234	3.821168
+0.989180	5.313115	3.823279
+1.013289	1.667105	3.828026
+1.037898	0.702102	3.836433
+1.305089	2.907054	3.825536
+1.483580	4.952716	3.821111
+1.568846	2.273077	3.813462
+1.600612	5.199592	3.819388
+1.808010	3.725000	3.841505
+2.001864	4.626780	3.826610
+2.226575	4.003119	3.833211
+2.265714	2.813354	3.827391
+2.414140	3.285478	3.830701
+2.484146	4.101341	3.835823
+2.480196	2.657647	3.842745
+2.612025	5.851139	3.826076
+2.653333	1.897895	3.824912
+3.102788	4.388077	3.829135
+3.143949	5.568587	3.835072
+3.451230	5.218095	3.835357
+3.479667	2.236167	3.816500
+1.206214	6.306214	3.841714
+1.355476	5.377143	3.840873
+1.694931	3.245590	3.844271
+1.710000	6.400000	3.820000
+1.969778	4.014222	3.833333
+2.120260	0.577857	3.848409
+2.115833	2.307222	3.847222
+2.321618	5.472228	3.854271
+2.332692	0.100994	3.850577
+2.424881	3.017698	3.843333
+3.190769	2.790385	3.834103
+3.589134	0.245118	3.842362
+3.834236	2.787896	3.853084
+3.847627	3.524350	3.840000
+4.157373	2.994235	3.842196
+4.163709	3.256490	3.841656
+4.177059	0.010000	3.836176
+4.169239	1.831576	3.842989
+4.196250	3.926528	3.826944
+1.024028	5.777109	3.847630
+1.066828	0.964793	3.858069
+1.317531	4.765188	3.860837
+1.410784	0.490833	3.857598
+2.036099	3.546233	3.854798
+2.173925	1.444393	3.843084
+2.185427	4.457607	3.861068
+2.608333	1.107886	3.859756
+2.930259	4.090570	3.849378
+3.003571	0.715238	3.845357
+3.075562	2.114894	3.862766
+3.094457	6.354286	3.849314
+3.303696	6.163519	3.862557
+3.872283	2.141096	3.851370
+3.902742	5.688871	3.837903
+4.017373	2.579407	3.841949
+0.996667	6.400000	3.833333
+1.377303	2.433717	3.867500
+1.607308	6.038615	3.858308
+1.748700	1.876100	3.849500
+2.286061	3.748485	3.846364
+2.297710	3.503588	3.860916
+2.362897	2.215888	3.866308
+2.566667	0.010370	3.850000
+2.659042	1.372682	3.876054
+2.703492	1.647354	3.867725
+2.800518	6.021224	3.870918
+2.799713	2.099936	3.874236
+3.266733	0.804158	3.853564
+3.444808	4.509808	3.856154
+4.011448	3.751136	3.877706
+4.159160	0.245378	3.858824
+1.392857	0.235714	3.866633
+1.630379	0.620530	3.863939
+2.137879	3.307652	3.865833
+2.277927	4.967683	3.862805
+2.767586	0.630251	3.886708
+2.916837	3.086122	3.865000
+3.121379	5.822069	3.860517
+3.238194	2.315139	3.858333
+1.041948	6.053831	3.877857
+1.072161	3.000879	3.886667
+1.071473	4.387649	3.889467
+1.089537	2.161907	3.891526
+1.725268	4.902282	3.888254
+1.741048	2.981210	3.882097
+2.041583	6.221636	3.893298
+2.311548	6.239409	3.899572
+2.343905	5.936381	3.876476
+2.356045	5.205522	3.885149
+2.416818	4.559318	3.871364
+2.457843	1.560667	3.887294
+2.880462	1.830923	3.868308
+3.182508	0.538482	3.889571
+3.414054	0.011351	3.875135
+3.442055	1.854466	3.882648
+3.870278	1.447500	3.865278
+4.133096	2.104184	3.880544
+4.126016	5.020398	3.884382
+1.062308	1.223590	3.880256
+1.332128	0.940426	3.885957
+1.354314	4.280131	3.890588
+1.484259	3.502889	3.902519
+2.215044	4.725575	3.887699
+2.410140	1.281121	3.897383
+2.554127	0.247922	3.900000
+2.539763	6.096746	3.905030
+2.728371	6.302664	3.905145
+2.742199	2.634894	3.886738
+2.950735	4.568382	3.878088
+2.982245	3.511633	3.875918
+3.413097	1.542258	3.890194
+3.821959	1.691031	3.884021
+3.916574	3.094815	3.885463
+4.118641	5.570924	3.889511
+4.135045	0.496396	3.887838
+1.074895	3.447622	3.902238
+1.207647	3.928941	3.897529
+1.760492	5.662077	3.900492
+1.817834	5.914331	3.899299
+2.164541	1.194031	3.909439
+2.281833	2.496000	3.899750
+2.872903	2.840968	3.888226
+2.889346	4.821308	3.899346
+3.058333	6.082613	3.907613
+3.070530	0.945303	3.905530
+3.354669	2.974587	3.899504
+3.417505	5.487027	3.916881
+3.767880	6.019954	3.902028
+3.801765	4.163137	3.887451
+3.819785	4.872366	3.894194
+4.128087	3.507652	3.897913
+1.724321	4.325309	3.907037
+1.803188	5.389710	3.906449
+2.073256	1.860930	3.912558
+2.592700	3.440900	3.906500
+2.782827	0.120169	3.913924
+2.861646	1.128608	3.902785
+2.970928	0.299283	3.917342
+3.104324	1.198649	3.904324
+3.231019	0.160370	3.909861
+3.723417	3.733583	3.905250
+3.757400	4.412700	3.902200
+3.778661	1.199643	3.905625
+4.102824	0.762137	3.912519
+4.092645	5.827025	3.908512
+1.085419	4.653935	3.917097
+1.112279	2.483628	3.927349
+1.140637	0.264111	3.929151
+1.384311	5.622800	3.918356
+1.381343	5.144179	3.916716
+1.735655	3.981138	3.922448
+1.774819	4.632691	3.927108
+1.808542	5.141042	3.908333
+1.885698	1.671396	3.933077
+2.355000	1.030676	3.917297
+3.051471	5.272206	3.913529
+3.431364	2.451061	3.910152
+3.826696	0.189554	3.912143
+1.120667	3.693167	3.917500
+1.410000	0.013659	3.930000
+1.447867	3.982000	3.927200
+1.718065	2.136129	3.920000
+1.875156	0.482595	3.941661
+1.879059	2.657412	3.920941
+2.030288	5.040385	3.924423
+2.393962	4.324528	3.919623
+2.520315	0.521374	3.942027
+2.634545	0.853831	3.927338
+2.745048	5.330571	3.924571
+2.862208	4.337083	3.932917
+3.394216	0.385226	3.938711
+3.462143	3.337619	3.924762
+3.793968	5.326825	3.928175
+1.861351	2.411892	3.927297
+1.970320	0.041715	3.952384
+2.073031	5.947478	3.952876
+2.192685	5.701644	3.947616
+2.620537	3.176157	3.946777
+2.906632	5.521969	3.941451
+2.963333	3.757634	3.933441
+3.534716	1.176023	3.938295
+3.548932	6.144369	3.944612
+3.664707	5.098000	3.951488
+3.702292	1.907000	3.944375
+4.066696	6.085507	3.940088
+1.121394	4.909212	3.953333
+1.417277	3.245982	3.959063
+1.445176	1.852196	3.956549
+1.969375	0.924375	3.943958
+2.076455	0.308973	3.971149
+2.418036	1.910357	3.941250
+2.705797	4.015217	3.939420
+3.003043	2.366242	3.956025
+3.108365	1.459519	3.943942
+3.131439	4.819928	3.951799
+3.307322	1.047541	3.953224
+3.313723	6.391702	3.952128
+3.389401	3.580539	3.947784
+3.433043	3.861159	3.943333
+3.741584	6.339306	3.956377
+1.431587	1.586508	3.950317
+1.421378	6.167774	3.968127
+1.508778	2.872333	3.961556
+1.682638	0.857242	3.978633
+1.946168	4.425911	3.977430
+2.519096	2.406497	3.955593
+2.591886	5.132982	3.959868
+2.752143	3.641224	3.951735
+2.857952	5.097128	3.966862
+3.142857	3.101048	3.961905
+3.325130	1.312597	3.961104
+3.327596	5.915385	3.957596
+3.336505	2.087849	3.962527
+3.401478	2.722435	3.962174
+3.713889	5.775926	3.957222
+3.859000	4.633364	3.959364
+4.059259	4.415231	3.960509
+4.061579	6.356118	3.955526
+1.138643	5.172362	3.970905
+1.146667	1.819677	3.970645
+1.168052	2.745233	3.976919
+1.179963	0.531355	3.974139
+1.438571	0.742294	3.976494
+1.897360	3.363360	3.974960
+1.918000	6.400000	3.944000
+1.969126	2.896764	3.974595
+2.166406	4.217266	3.971875
+2.394024	0.788293	3.963537
+2.478011	3.655580	3.970994
+2.580781	5.653906	3.963906
+2.612491	2.854684	3.972379
+3.203557	2.552420	3.975656
+3.370667	4.737333	3.975778
+4.075000	1.328276	3.963621
+1.229889	5.923667	3.993111
+1.460955	4.584777	3.986115
+1.531410	1.080865	3.989647
+1.679803	1.496908	3.984211
+1.815604	6.149780	3.975824
+2.690690	4.517816	3.977816
+3.072870	1.708148	3.978426
+3.177869	4.567951	3.982787
+3.320537	4.320289	3.976818
+3.480478	0.853072	3.993242
+3.654141	2.157071	3.976667
+3.668633	5.533381	3.978273
+3.708828	0.969609	3.982422
+3.795844	0.445325	3.971169
+4.034076	1.596902	3.988696
+4.060000	1.015278	3.973148
+4.050396	4.790990	3.975941
+1.149490	4.159796	3.985510
+1.163176	3.225203	3.989932
+1.158266	5.433988	3.992775
+1.522937	5.847619	3.991825
+1.923130	1.163652	3.984000
+1.936447	1.413553	3.983684
+1.953333	4.815167	3.983750
+2.555789	4.727594	3.984135
+2.863881	1.485224	3.993582
+3.226452	3.338548	3.975968
+3.272617	4.058505	3.990000
+3.662043	3.972787	4.005809
+3.737778	0.721667	3.971944
+1.480651	2.152055	4.008664
+1.493559	1.335254	3.994576
+1.528309	3.751654	4.008640
+2.003121	3.830709	3.998936
+2.171720	2.095161	3.994839
+2.618046	4.255977	3.996437
+3.209722	3.787639	3.997639
+3.642574	3.508713	3.993366
+3.668765	1.392469	3.997284
+4.014143	2.302929	3.996929
+1.174043	1.569787	4.000851
+1.195385	0.798077	4.011058
+1.552593	2.613992	4.016626
+1.889204	4.162301	4.014248
+2.025264	5.489421	4.020378
+2.149137	1.635268	4.020655
+2.225543	2.970870	4.016957
+2.519130	5.395489	4.016033
+2.749442	0.396000	4.017907
+3.272000	5.287905	4.009048
+3.656526	2.677371	4.018638
+3.971456	1.844175	4.006796
+1.562379	5.342103	4.022172
+2.137395	2.701261	4.015462
+2.422847	3.910569	4.025907
+3.077714	4.229486	4.025600
+3.133553	5.067237	4.014079
+3.624582	0.064558	4.035895
+3.644667	2.401778	4.018556
+3.973489	3.308006	4.026822
+4.021324	0.068971	4.008676
+1.172708	5.679583	4.024583
+1.232868	1.332574	4.037721
+1.635098	6.322451	4.046803
+1.883923	1.985414	4.030608
+3.054423	2.749038	4.020192
+3.261343	5.689627	4.034925
+3.596150	4.847914	4.033155
+3.607051	1.640000	4.034423
+3.620196	4.580833	4.030931
+3.972107	5.170868	4.033802
+3.998970	2.903273	4.028364
+1.211837	1.084490	4.030408
+1.485652	4.833370	4.034130
+1.578532	5.071147	4.051009
+1.629899	0.437475	4.044007
+1.961341	2.226951	4.035366
+2.115556	0.755556	4.032593
+2.622308	1.999038	4.033654
+3.547455	0.576818	4.051273
+3.631944	2.985000	4.044583
+3.663305	3.251674	4.052833
+4.003902	0.329512	4.028537
+1.184935	6.166623	4.036364
+1.258153	2.286908	4.058835
+1.557931	0.159770	4.038046
+1.956522	5.741739	4.044348
+2.046183	3.149167	4.060161
+2.071088	2.455026	4.058549
+2.179605	3.656974	4.046645
+2.284118	0.571000	4.056059
+2.301500	3.211583	4.045667
+2.519739	5.884870	4.047130
+2.977036	0.528458	4.058696
+2.998252	3.286699	4.042233
+3.008382	1.941156	4.055723
+3.042654	3.964691	4.048395
+3.151750	3.553000	4.043250
+3.241519	1.869494	4.046203
+3.424214	5.075000	4.052643
+3.983438	4.137500	4.047031
+3.983469	5.426735	4.044286
+1.235093	4.492500	4.061944
+1.251232	2.021667	4.059420
+1.268105	2.985333	4.072070
+1.540000	4.272745	4.045882
+1.596813	3.092637	4.050659
+1.639075	3.367746	4.068208
+1.669583	1.740556	4.048889
+2.351440	0.314647	4.068152
+2.375349	2.776395	4.059651
+2.573182	1.760455	4.048864
+2.895506	0.788892	4.071139
+3.012622	5.724085	4.059085
+3.150498	0.733817	4.070498
+3.581289	4.230028	4.064818
+3.924339	2.647845	4.075776
+3.974464	0.582679	4.055357
+1.274863	3.451096	4.075479
+1.671325	2.328400	4.080675
+1.736788	2.805907	4.064767
+1.755170	3.593333	4.065850
+1.800112	0.240615	4.068492
+1.968904	5.233151	4.066849
+2.174454	4.886639	4.075042
+2.199159	0.096726	4.077345
+2.199727	5.146909	4.069727
+2.426809	4.941712	4.070934
+2.772703	2.444919	4.077676
+3.155814	6.257519	4.067442
+3.175948	0.351046	4.081307
+3.954922	3.573047	4.065781
+1.293926	6.381846	4.088926
+2.088242	4.624424	4.079697
+2.116387	6.381849	4.077227
+2.166684	1.003211	4.079895
+2.457485	0.062695	4.086437
+2.758406	5.787943	4.094524
+2.820913	1.721142	4.086393
+2.922311	6.366642	4.086764
+2.990517	0.106034	4.072586
+3.123953	5.477945	4.086996
+3.546950	5.312293	4.088392
+3.546667	5.908404	4.080939
+3.612683	0.324146	4.066829
+3.915388	3.894828	4.085862
+3.912196	5.686627	4.087843
+1.306749	2.550000	4.098848
+2.157586	1.378793	4.081034
+2.576116	2.620083	4.086281
+2.694523	4.920492	4.096769
+2.748185	1.009963	4.101593
+2.957197	2.980071	4.099834
+3.270641	1.605385	4.088077
+3.371342	3.154204	4.127942
+3.938875	2.080375	4.086625
+1.283467	3.723467	4.095467
+1.605691	6.049675	4.101301
+1.664854	4.475437	4.093495
+1.698364	1.275636	4.093273
+2.172872	6.140745	4.094362
+2.191875	4.000313	4.093281
+2.269903	5.390388	4.103350
+2.326667	2.314063	4.094271
+2.358774	3.461806	4.101548
+2.376119	4.158209	4.086866
+2.408837	2.085116	4.100349
+2.456364	3.016606	4.103394
+2.781635	1.267788	4.095000
+3.157874	2.207874	4.097087
+3.564692	3.725000	4.103231
+3.870444	6.145444	4.114290
+3.926517	0.824494	4.094157
+1.311690	5.000352	4.114542
+1.344164	0.284947	4.115089
+1.553516	5.631641	4.111563
+1.650806	1.989032	4.095323
+1.828526	5.008237	4.119359
+2.109486	3.411200	4.112400
+2.281979	5.884599	4.111283
+2.342673	4.662508	4.116898
+2.417857	1.427857	4.112083
+2.489187	0.963902	4.112033
+2.623611	2.236389	4.100278
+2.652621	3.795931	4.106000
+2.697075	6.055975	4.120849
+2.813571	2.738661	4.119286
+2.820292	4.686642	4.106058
+2.853112	4.129751	4.111411
+2.906494	2.174113	4.113247
+2.925789	3.559211	4.100263
+2.949097	5.969375	4.103611
+2.995736	1.086822	4.104341
+3.213063	2.912523	4.112252
+3.386466	0.165414	4.109323
+3.519681	1.995745	4.108617
+3.894000	1.411590	4.112615
+3.918298	1.160426	4.103830
+1.280877	4.728596	4.108772
+1.299744	3.987179	4.116538
+1.325789	5.282782	4.130902
+1.732331	5.810339	4.129280
+1.773263	0.648178	4.122246
+1.780719	5.527964	4.118263
+2.229483	4.409138	4.111034
+2.310274	1.201918	4.117397
+2.387547	5.631863	4.129741
+2.411894	6.112727	4.121288
+2.492475	4.436568	4.128515
+2.645389	0.685171	4.128131
+2.653636	1.526783	4.126364
+2.720359	5.517545	4.122395
+2.769535	3.303372	4.116860
+2.928490	5.306615	4.119740
+2.979943	4.489716	4.120398
+3.363703	6.110167	4.131109
+1.586429	4.037857	4.126071
+1.704898	4.776871	4.132313
+2.252638	1.891656	4.125767
+2.357013	6.369497	4.132013
+2.960627	4.914269	4.138478
+3.461948	1.449351	4.137143
+3.486912	5.626324	4.133088
+3.510476	6.327429	4.120095
+3.855654	3.093145	4.137915
+3.873609	4.349112	4.126568
+1.322388	1.714478	4.127164
+1.321087	4.236739	4.136413
+1.365153	0.928282	4.138650
+1.732527	3.841648	4.138242
+1.770343	1.046514	4.147943
+1.804444	3.190667	4.140444
+2.590000	6.288678	4.135289
+2.630282	3.521567	4.153605
+2.681739	0.183370	4.134130
+2.705341	3.027045	4.134318
+3.121439	1.300758	4.140909
+3.422566	2.245044	4.141239
+3.456080	2.552049	4.152606
+3.833010	4.849465	4.149465
+3.839389	1.670229	4.150687
+1.327879	5.537879	4.147273
+1.410866	0.548656	4.161936
+1.765921	2.563026	4.143947
+2.287037	2.557037	4.138889
+2.374528	1.675283	4.138113
+2.434333	5.194833	4.154389
+2.550968	1.215161	4.144194
+2.597183	4.064225	4.142394
+3.472273	3.427348	4.153182
+1.809070	0.018023	4.166628
+1.888000	6.331497	4.180395
+2.685750	5.269250	4.160125
+3.442746	3.962977	4.174827
+3.546120	1.048770	4.167319
+3.786078	5.896667	4.151961
+1.360678	5.784153	4.167712
+1.381646	0.031013	4.161013
+1.418356	1.484612	4.180776
+2.759804	4.372255	4.162647
+2.896541	3.799248	4.169323
+3.003520	2.558715	4.174413
+3.429726	1.767260	4.161370
+3.448776	2.852653	4.164082
+3.835313	0.177604	4.161771
+1.386883	1.198182	4.170779
+1.399200	2.778933	4.176800
+1.905475	1.770380	4.187152
+1.930815	0.849741	4.185630
+2.516944	3.261389	4.187361
+3.037444	1.546457	4.178655
+3.300665	0.925831	4.190818
+3.448285	4.455793	4.185696
+3.832000	2.428909	4.176545
+1.378909	6.042636	4.184636
+1.757206	5.276520	4.190882
+1.863497	4.586993	4.192587
+2.563196	0.421753	4.182990
+3.336488	3.644080	4.195318
+3.760373	5.163593	4.200814
+3.780947	5.434579	4.190421
+3.781049	3.434012	4.195988
+3.796154	2.841692	4.184923
+1.833788	6.043652	4.204573
+1.902731	0.435419	4.201145
+1.913409	1.294091	4.200568
+2.062097	4.175645	4.186774
+2.136757	5.648649	4.193243
+2.364719	3.714607	4.197640
+2.947861	0.314975	4.205323
+3.351898	1.217810	4.195839
+3.397627	0.397966	4.191525
+3.398163	4.867959	4.186327
+3.761321	1.922000	4.205321
+3.778943	0.656179	4.203496
+3.792404	3.701827	4.197692
+3.793765	4.120353	4.197647
+1.442268	4.452862	4.212528
+1.447722	1.905886	4.210506
+1.463909	3.590453	4.220041
+1.564433	0.772296	4.227995
+1.937399	3.959641	4.212960
+1.993729	1.524068	4.198305
+2.002563	0.183266	4.219246
+2.142703	0.384865	4.204324
+2.361239	0.770642	4.212339
+2.799455	1.952228	4.209554
+3.220625	2.420188	4.211250
+3.224818	2.679909	4.206364
+3.265556	4.650427	4.218860
+3.308824	5.862353	4.198627
+3.357396	0.658958	4.206875
+3.370698	4.208372	4.204884
+3.752719	2.192120	4.214424
+1.446917	2.368417	4.215333
+1.456293	3.267854	4.219561
+1.793671	4.280058	4.227312
+1.800128	2.134231	4.229231
+1.878263	2.960297	4.224746
+1.890704	2.371972	4.215775
+1.945145	3.681503	4.212428
+2.050746	5.894030	4.226806
+3.201277	4.390851	4.207872
+3.219358	3.393850	4.229599
+3.304082	2.043469	4.206735
+3.731794	6.356500	4.223941
+3.781351	0.960811	4.213243
+1.746508	1.482937	4.238333
+1.884167	3.422583	4.227333
+1.981121	4.817375	4.244484
+2.039922	2.005273	4.246545
+2.109260	2.827577	4.243903
+2.593720	4.669795	4.235768
+2.600000	2.826092	4.227931
+3.191879	3.855030	4.235697
+3.189310	4.970345	4.225345
+3.341474	5.446421	4.220105
+3.584889	0.795778	4.222667
+3.778846	0.403462	4.214231
+1.457317	3.011463	4.231707
+1.461753	3.854639	4.236701
+3.153958	4.111042	4.240313
+3.302932	5.191152	4.243508
+1.983881	2.596866	4.241194
+2.039935	5.082810	4.252680
+2.124087	2.272198	4.255728
+2.138085	0.630372	4.254787
+2.146279	3.816977	4.246163
+3.092638	3.155337	4.255215
+3.176400	0.153000	4.256500
+3.644798	6.085253	4.259495
+3.705741	5.684136	4.248889
+3.727759	1.208448	4.239310
+1.473950	6.306807	4.252521
+1.523095	4.934000	4.266429
+2.032015	5.383460	4.270228
+2.038216	4.416865	4.266541
+2.220492	3.070758	4.264470
+3.156563	5.672500	4.256172
+3.287015	6.364259	4.268601
+3.688889	1.471242	4.260719
+1.524311	5.436347	4.270539
+1.547198	2.137857	4.270440
+1.549250	0.337500	4.265333
+1.547455	1.041909	4.270000
+1.570251	1.677538	4.273668
+1.595647	0.079483	4.279009
+1.905055	5.683956	4.277418
+2.232347	1.520102	4.276939
+2.486176	5.425588	4.275074
+2.592000	2.445444	4.270500
+2.941571	5.518846	4.278910
+2.951255	3.379176	4.278980
+3.216667	1.756092	4.268621
+3.626197	4.687508	4.284164
+3.683448	3.913966	4.266897
+3.688750	4.433611	4.265417
+3.702593	2.637593	4.265185
+1.508478	5.184348	4.273696
+1.549188	2.591015	4.279239
+3.046726	6.243673	4.288540
+3.055605	0.862803	4.282994
+3.078394	3.624599	4.290255
+1.532941	4.678971	4.281912
+1.548020	4.227228	4.287525
+1.554086	5.898710	4.290645
+1.565714	1.314643	4.287619
+2.265227	3.319773	4.280909
+2.285609	4.986346	4.300128
+2.465328	5.937810	4.282993
+2.937143	5.795866	4.302006
+2.986862	4.295372	4.306676
+3.032062	5.143093	4.282371
+3.582606	0.240394	4.305273
+3.606727	4.963200	4.299345
+3.676000	0.010000	4.280667
+1.978824	1.076824	4.293294
+2.119353	6.258557	4.304677
+2.152924	1.254503	4.302865
+2.246392	6.040619	4.299072
+2.439262	3.935403	4.310940
+2.480400	2.214467	4.301067
+2.779673	5.066667	4.296993
+2.923910	1.298269	4.316597
+2.962195	1.766765	4.316968
+2.997188	0.621875	4.300313
+3.039072	2.827629	4.298557
+3.080297	2.000396	4.294059
+3.128544	5.992492	4.311715
+3.251351	1.465946	4.293694
+3.609955	3.276532	4.304730
+3.667660	3.011702	4.286809
+1.650462	2.837370	4.320636
+2.039000	3.246429	4.305286
+2.140220	1.762802	4.315165
+2.160449	0.895000	4.313596
+2.188302	3.567170	4.318459
+2.180685	4.617808	4.307397
+2.240736	0.192393	4.312577
+2.369253	2.865000	4.314770
+2.479015	4.209562	4.312956
+2.501304	0.212372	4.314032
+2.563879	1.968318	4.315935
+2.686416	1.743410	4.314393
+2.764310	0.509914	4.317586
+2.801656	6.326225	4.312715
+2.928379	0.066421	4.320926
+3.030959	4.724110	4.296986
+3.041673	2.266809	4.319377
+3.147817	1.112792	4.310558
+3.578505	0.533737	4.317153
+3.631702	1.714787	4.301277
+3.624300	2.411200	4.304300
+1.644769	3.426690	4.325587
+2.237667	4.286000	4.310667
+2.249333	5.252417	4.319583
+2.368828	1.049375	4.327930
+2.495314	1.561882	4.329446
+2.562570	4.922793	4.324022
+2.629231	0.010000	4.308462
+2.658502	1.353913	4.319855
+2.741253	2.191798	4.328392
+2.791610	0.785381	4.324831
+2.818996	3.611528	4.323668
+2.840078	3.136039	4.326824
+2.868145	6.060806	4.316290
+3.181016	0.456203	4.322246
+1.658316	3.122105	4.336316
+1.665974	0.552403	4.333442
+1.688981	1.913719	4.340413
+2.303750	2.034259	4.334815
+2.332584	2.411461	4.327753
+2.349630	0.412963	4.314444
+2.702955	3.929167	4.326667
+2.805439	4.805088	4.331930
+2.830843	1.538795	4.324337
+2.855169	4.551356	4.332203
+2.877704	1.035111	4.329037
+2.958047	3.990118	4.332189
+3.137547	5.362642	4.324717
+3.521488	5.847741	4.340854
+3.569650	5.486434	4.331049
+3.604706	3.559412	4.319412
+3.596800	4.215467	4.322933
+1.658459	5.650824	4.343262
+1.638000	6.137226	4.341290
+1.672864	4.486667	4.348967
+2.203143	4.038000	4.327429
+2.253889	5.498889	4.334259
+2.449405	3.471071	4.343571
+2.502727	0.595657	4.361145
+2.535307	5.690000	4.346842
+2.567725	3.052515	4.340299
+2.576524	3.703777	4.347253
+2.697931	5.885172	4.329310
+2.741420	4.193977	4.341761
+2.851932	2.431364	4.335909
+3.537655	5.226966	4.345241
+1.646709	3.728101	4.341392
+2.264980	5.790648	4.358178
+2.377500	0.010000	4.327500
+2.399076	1.312554	4.356304
+2.389434	1.789434	4.345472
+2.606494	6.134945	4.357860
+2.633235	1.086765	4.335000
+2.693206	3.364667	4.363714
+2.726962	2.642405	4.345443
+3.552063	1.941429	4.345397
+1.662475	3.979208	4.352277
+1.695789	2.329035	4.357281
+1.721842	5.092829	4.371382
+2.372953	6.246062	4.360259
+2.382881	4.476017	4.363898
+2.627625	4.442375	4.354625
+2.755682	0.254545	4.353409
+2.803288	2.876301	4.356027
+2.832128	5.303830	4.352979
+3.240448	2.963632	4.358969
+3.490905	3.782387	4.368107
+3.529189	1.289595	4.356486
+3.522604	6.357988	4.357337
+3.542258	2.186452	4.352581
+1.679832	6.383613	4.364454
+1.744808	0.913333	4.367821
+1.762068	1.183346	4.375677
+2.381563	4.749792	4.361875
+2.490851	2.654468	4.362340
+2.545410	0.863934	4.369262
+2.572941	6.385765	4.361059
+2.572308	5.194835	4.373242
+3.506667	2.733548	4.364301
+1.740659	4.811923	4.385714
+2.709459	5.513378	4.369730
+1.766395	0.330349	4.383256
+1.785546	2.573843	4.393100
+1.869191	0.694220	4.391156
+2.250000	2.643855	4.384880
+3.302930	2.251245	4.400330
+3.414346	1.067991	4.399393
+3.413360	6.092400	4.399040
+3.476889	1.529444	4.382333
+1.780150	5.878100	4.403150
+1.839664	0.086765	4.402437
+3.366831	5.626541	4.411715
+3.387686	2.509628	4.411529
+3.418191	0.805106	4.401702
+3.461188	3.092772	4.391287
+1.753871	5.407903	4.404516
+1.790130	1.676364	4.399870
+3.372039	0.088092	4.412895
+3.422033	3.420440	4.405659
+1.832656	3.578984	4.420078
+1.869385	4.101423	4.429231
+3.417193	4.560000	4.413158
+3.422449	4.800612	4.410612
+3.420000	4.073171	4.410976
+1.835120	3.283600	4.426720
+1.854615	3.835804	4.430490
+2.985375	2.620625	4.420500
+3.402115	4.316154	4.420000
+3.396567	5.046269	4.422687
+3.411875	1.763333	4.415417
+1.888414	2.816414	4.439379
+1.921985	6.370773	4.454072
+1.942976	1.352390	4.447024
+2.421905	3.221429	4.430000
+3.267258	3.224839	4.427903
+3.381739	0.334348	4.422609
+1.874386	4.610175	4.446053
+1.895455	6.102216	4.451591
+1.929106	1.872846	4.450244
+2.031634	0.500113	4.465380
+3.285890	3.633252	4.453804
+3.339167	1.993000	4.443167
+3.336800	5.342000	4.445400
+3.357778	0.573056	4.435556
+1.881967	4.357705	4.450984
+1.927667	5.234667	4.459778
+1.941207	4.969310	4.462299
+1.943193	2.361849	4.458739
+1.946067	3.064719	4.449888
+2.281107	3.778730	4.464139
+3.202211	4.889158	4.469579
+3.222500	2.714812	4.468925
+3.276398	1.279814	4.458882
+1.911379	2.111379	4.455517
+1.956587	5.523571	4.473571
+2.021105	5.799830	4.480397
+2.016705	1.605549	4.475780
+2.955467	4.987378	4.470178
+3.297115	5.873654	4.459615
+1.968889	0.906481	4.470556
+2.041504	0.232481	4.475564
+2.030139	3.425486	4.484167
+3.167750	4.372083	4.478500
+3.182201	5.152327	4.488239
+3.202281	6.209298	4.483333
+3.211528	0.930833	4.478750
+3.288889	3.885000	4.465278
+2.023051	2.607712	4.486102
+2.085117	4.752368	4.498889
+2.162039	5.105137	4.514118
+2.188956	0.027071	4.501650
+3.137778	2.434192	4.498485
+3.164298	0.261818	4.490083
+3.178559	4.106695	4.490508
+3.193238	4.630286	4.487714
+3.222206	1.627059	4.479853
+2.112585	4.194153	4.506356
+2.388241	6.031667	4.507454
+3.110000	0.017125	4.501000
+3.133874	1.860270	4.500450
+3.146815	3.428000	4.500444
+3.150125	0.681375	4.496250
+2.043220	3.683559	4.499322
+2.078488	3.928256	4.506163
+2.080877	1.126491	4.502105
+2.143235	2.845252	4.511807
+2.142185	0.737059	4.510000
+2.162036	3.174253	4.515701
+2.195234	1.414299	4.517196
+2.420727	5.516000	4.502909
+3.092024	5.753988	4.513988
+2.083636	4.481091	4.509818
+2.129890	6.037403	4.519945
+2.136481	2.158333	4.517222
+2.147413	5.365035	4.521608
+2.171013	1.912278	4.520253
+2.517957	0.374946	4.532177
+2.611892	2.870579	4.528996
+2.639500	2.342538	4.529577
+2.965216	6.326264	4.529954
+3.017746	0.466879	4.518786
+3.054196	3.141538	4.521748
+3.087407	1.429012	4.517407
+3.125645	2.122581	4.510000
+2.182571	2.419524	4.527810
+2.261818	1.677219	4.531604
+2.284662	3.413818	4.537534
+2.299140	0.529892	4.534140
+2.368175	3.002000	4.546975
+2.898807	3.353263	4.541649
+2.928312	4.164262	4.540295
+2.974531	3.611563	4.533281
+2.984802	5.996980	4.534109
+3.035253	1.178687	4.525758
+3.055048	3.859429	4.526857
+3.099677	5.502903	4.517742
+2.201294	6.287824	4.538647
+2.201583	5.622734	4.538705
+2.387429	2.229968	4.546286
+2.384335	5.253536	4.550875
+2.450701	0.081274	4.545796
+2.657893	2.056588	4.556825
+2.673548	1.546828	4.540538
+2.763293	5.149102	4.553802
+2.802667	3.819304	4.549739
+2.887919	2.252483	4.546309
+2.906238	0.700693	4.542772
+2.928047	1.623395	4.540744
+2.914365	1.994444	4.544683
+2.962179	4.728974	4.541859
+3.044590	2.888197	4.530984
+2.280435	0.271957	4.538913
+2.294800	0.918600	4.542200
+2.301515	4.893788	4.551667
+2.312439	1.174878	4.547073
+2.309103	4.029655	4.550828
+2.726194	4.601754	4.558694
+2.725085	4.331017	4.563941
+2.774916	1.125028	4.553911
+2.844211	5.784737	4.541228
+2.941930	4.460526	4.547018
+2.967167	0.940333	4.540500
+2.979506	5.288395	4.543951
+2.291538	4.609385	4.556769
+2.456503	3.606713	4.563497
+2.515185	1.033426	4.557130
+2.511747	3.871710	4.564758
+2.524069	5.024372	4.568009
+2.575205	1.286712	4.559110
+2.623849	5.376653	4.566318
+2.613053	5.920929	4.567212
+2.669851	0.613806	4.562612
+2.685503	4.064550	4.566720
+2.712057	0.869220	4.561986
+2.715388	3.560728	4.563107
+2.717687	6.388582	4.564104
+2.746135	1.800491	4.560245
+2.738658	4.873087	4.567517
+2.769551	6.130843	4.562978
+2.781688	0.388831	4.558831
+2.833500	3.021857	4.559286
+2.835000	2.745700	4.561000
+2.867373	5.508814	4.558559
+2.935610	0.197561	4.545122
+2.286970	4.363636	4.558182
+2.410946	1.958784	4.560405
+2.410723	5.755904	4.566145
+2.408519	2.482593	4.561111
+2.430769	1.498205	4.565385
+2.454750	0.745000	4.564750
+2.476559	4.215484	4.570753
+2.509652	4.752609	4.570870
+2.621308	2.607196	4.570280
+2.648615	5.639692	4.572615
+2.698732	0.138310	4.561972
+2.851094	1.366250	4.559688
+2.393023	2.731163	4.565581
+2.503182	1.733030	4.570000
+2.523095	6.235595	4.577262
+2.551757	3.370135	4.575676
+2.614267	3.130667	4.572133
+2.845000	2.492000	4.567000
+2.509355	4.466290	4.579032
+3.527562	3.019352	0.627099
 3.443333	3.203333	0.580000
\ No newline at end of file
diff --git a/apps/cpu/BoxBenchmark/CMakeLists.txt b/apps/cpu/BoxBenchmark/CMakeLists.txt
index ddae32fc951e23ba59082c74efa55d861fd814f3..d253304fe89da47654efa1dcc3c8d01c24d75c25 100644
--- a/apps/cpu/BoxBenchmark/CMakeLists.txt
+++ b/apps/cpu/BoxBenchmark/CMakeLists.txt
@@ -1,25 +1,25 @@
-CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
-
-########################################################
-## C++ PROJECT                                       ###
-########################################################
-PROJECT(BoxBenchmark)
-
-INCLUDE(${APPS_ROOT}/IncludsList.cmake) 
-
-#################################################################
-###   LOCAL FILES                                             ###
-#################################################################
-FILE(GLOB SPECIFIC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.h
-                         ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
-                         ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp  )
- 
-SET(ALL_SOURCES ${ALL_SOURCES} ${SPECIFIC_FILES})
-SOURCE_GROUP(src FILES ${SPECIFIC_FILES})
-  
-SET(CAB_ADDITIONAL_LINK_LIBRARIES VirtualFluids)
-
-#################################################################
-###   CREATE PROJECT                                          ###
-#################################################################
-CREATE_CAB_PROJECT(bb BINARY)
+CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
+
+########################################################
+## C++ PROJECT                                       ###
+########################################################
+PROJECT(BoxBenchmark)
+
+INCLUDE(${APPS_ROOT}/IncludsList.cmake) 
+
+#################################################################
+###   LOCAL FILES                                             ###
+#################################################################
+FILE(GLOB SPECIFIC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.h
+                         ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
+                         ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp  )
+ 
+SET(ALL_SOURCES ${ALL_SOURCES} ${SPECIFIC_FILES})
+SOURCE_GROUP(src FILES ${SPECIFIC_FILES})
+  
+SET(CAB_ADDITIONAL_LINK_LIBRARIES VirtualFluids)
+
+#################################################################
+###   CREATE PROJECT                                          ###
+#################################################################
+CREATE_CAB_PROJECT(bb BINARY)
diff --git a/apps/cpu/BoxBenchmark/bb.cfg b/apps/cpu/BoxBenchmark/bb.cfg
index c2abee2e2781b8f9ffb781ddc6a29ee474cc5073..c74d2cd0da1644dcf0da6ed769ccdb8d10530da8 100644
--- a/apps/cpu/BoxBenchmark/bb.cfg
+++ b/apps/cpu/BoxBenchmark/bb.cfg
@@ -1,25 +1,25 @@
-pathname = d:/temp/BoxBenchmark
-numOfThreads = 4
-availMem = 11e9
-
-#Grid
-length =  32 32 32 
-blocknx = 8 8 8
-
-dx = 1
-refineLevel = 0
-
-#Simulation
-uLB = 0.001
-Re = 10
-
-
-outTime = 1000
-endTime = 1000
-
-logToFile = false
-
-cpStep     = 10000     
-cpStepStart= 100000
-restart    = false    
+pathname = d:/temp/BoxBenchmark
+numOfThreads = 4
+availMem = 11e9
+
+#Grid
+length =  32 32 32 
+blocknx = 8 8 8
+
+dx = 1
+refineLevel = 0
+
+#Simulation
+uLB = 0.001
+Re = 10
+
+
+outTime = 1000
+endTime = 1000
+
+logToFile = false
+
+cpStep     = 10000     
+cpStepStart= 100000
+restart    = false    
 restartStep= 100000
\ No newline at end of file
diff --git a/apps/cpu/BoxBenchmark/bb.cpp b/apps/cpu/BoxBenchmark/bb.cpp
index 5bf050216aaab09a751a4535ff50cbf5c72a442c..547e654b35096e66e9400b16ad5a01be024ed2c5 100644
--- a/apps/cpu/BoxBenchmark/bb.cpp
+++ b/apps/cpu/BoxBenchmark/bb.cpp
@@ -1,321 +1,321 @@
-#include <iostream>
-#include <string>
-#include <vector>
-#include <sstream> //istringstream
-#include <iostream> // cout
-#include <fstream> // ifstream
-
-#include "VirtualFluids.h"
-
-using namespace std;
-
-
-void run(string configname)
-{
-   try
-   {
-      ConfigurationFile   config;
-      config.load(configname);
-
-      string          pathname = config.getValue<string>("pathname");
-      int             numOfThreads = config.getValue<int>("numOfThreads");
-      vector<int>     blocknx = config.getVector<int>("blocknx");
-      double          uLB = config.getValue<double>("uLB");
-      double          endTime = config.getValue<double>("endTime");
-      double          outTime = config.getValue<double>("outTime");
-      double          availMem = config.getValue<double>("availMem");
-      int             refineLevel = config.getValue<int>("refineLevel");
-      double          Re = config.getValue<double>("Re");
-      double          dx = config.getValue<double>("dx");
-      vector<double>  length = config.getVector<double>("length");
-      bool            logToFile = config.getValue<bool>("logToFile");
-
-      double          cpStep      = config.getValue<double>("cpStep");
-      double          cpStepStart = config.getValue<double>("cpStepStart");
-      bool            restart     = config.getValue<bool>("restart");
-      double          restartStep = config.getValue<double>("restartStep");
-
-      //UbLog::reportingLevel() = UbLog::logLevelFromString("DEBUG3");
-
-      SPtr<Communicator> comm = MPICommunicator::getInstance();
-      int myid = comm->getProcessID();
-
-      if (logToFile)
-      {
-#if defined(__unix__)
-         if (myid == 0)
-         {
-            const char* str = pathname.c_str();
-            mkdir(str, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
-   }
-#endif 
-
-         if (myid == 0)
-         {
-            stringstream logFilename;
-            logFilename << pathname + "/logfile" + UbSystem::toString(UbSystem::getTimeStamp()) + ".txt";
-            UbLog::output_policy::setStream(logFilename.str());
-         }
-}
-
-      LBMReal dLB = length[1] / dx;
-      LBMReal rhoLB = 0.0;
-      LBMReal nuLB = (uLB*dLB) / Re;
-
-      SPtr<LBMUnitConverter> conv = SPtr<LBMUnitConverter>(new LBMUnitConverter());
-
-      const int baseLevel = 0;
-
-      //bounding box
-      double g_minX1 = 0.0;
-      double g_minX2 = 0.0;
-      double g_minX3 = 0.0;
-
-      double g_maxX1 = length[0];
-      double g_maxX2 = length[1];
-      double g_maxX3 = length[2];
-
-      //geometry
-      SPtr<GbObject3D> box(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
-      //if (myid == 0) GbSystem3D::writeGeoObject(box.get(), pathname + "/geo/box", WbWriterVtkXmlBinary::getInstance());
-
-      SPtr<GbObject3D> gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
-      //if (myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), pathname + "/geo/gridCube", WbWriterVtkXmlBinary::getInstance());
-
-
-      double blockLength = blocknx[0] * dx;
-
-      SPtr<Grid3D> grid(new Grid3D(comm));
-
-      SPtr<UbScheduler> rSch2(new UbScheduler(cpStep, cpStepStart));
-      MPIIORestartCoProcessor rcp(grid, rSch2, pathname, comm);
-
-      if (!restart)
-      {
-         if (myid == 0)
-         {
-            UBLOG(logINFO, "uLb = " << uLB);
-            UBLOG(logINFO, "rho = " << rhoLB);
-            UBLOG(logINFO, "nuLb = " << nuLB);
-            UBLOG(logINFO, "Re = " << Re);
-            UBLOG(logINFO, "dx = " << dx);
-            UBLOG(logINFO, "length = " << length[0] << " " << length[1] << " " << length[2]);
-            UBLOG(logINFO, "blocknx = " << blocknx[0] << " " << blocknx[1] << " " << blocknx[2]);
-            UBLOG(logINFO, "number of levels = " << refineLevel + 1);
-            UBLOG(logINFO, "number of processes = " << comm->getNumberOfProcesses());
-            UBLOG(logINFO, "number of threads = " << numOfThreads);
-            UBLOG(logINFO, "Preprocess - start");
-         }
-
-         grid->setDeltaX(dx);
-         grid->setBlockNX(blocknx[0], blocknx[1], blocknx[2]);
-
-         //if (myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), pathname + "/geo/gridCube", WbWriterVtkXmlBinary::getInstance());
-
-         GenBlocksGridVisitor genBlocks(gridCube);
-         grid->accept(genBlocks);
-
-         SPtr<CoProcessor> ppblocks(new WriteBlocksCoProcessor(grid, SPtr<UbScheduler>(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm));
-
-         //int bbOption = 1; //0=simple Bounce Back, 1=quadr. BB
-         //D3Q27BoundaryConditionAdapterPtr bcObst(new D3Q27NoSlipBCAdapter(bbOption));
-         //SPtr<D3Q27Interactor> boxInt(new D3Q27Interactor(box, grid, bcObst, Interactor3D::INVERSESOLID));
-
-         SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B));
-         InteractorsHelper intHelper(grid, metisVisitor);
-         //intHelper.addInteractor(boxInt);
-         intHelper.selectBlocks();
-
-         ppblocks->process(0);
-         ppblocks.reset();
-
-         //set connectors
-         //InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor());
-         //SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
-         //grid->accept(setConnsVisitor);
-
-         unsigned long long numberOfBlocks = (unsigned long long)grid->getNumberOfBlocks();
-         int ghostLayer = 3;
-         unsigned long long numberOfNodesPerBlock = (unsigned long long)(blocknx[0])* (unsigned long long)(blocknx[1])* (unsigned long long)(blocknx[2]);
-         unsigned long long numberOfNodes = numberOfBlocks * numberOfNodesPerBlock;
-         unsigned long long numberOfNodesPerBlockWithGhostLayer = numberOfBlocks * (blocknx[0] + ghostLayer) * (blocknx[1] + ghostLayer) * (blocknx[2] + ghostLayer);
-         double needMemAll = double(numberOfNodesPerBlockWithGhostLayer*(27 * sizeof(double) + sizeof(int) + sizeof(float) * 4));
-         double needMem = needMemAll / double(comm->getNumberOfProcesses());
-
-         if (myid == 0)
-         {
-            UBLOG(logINFO, "Number of blocks = " << numberOfBlocks);
-            UBLOG(logINFO, "Number of nodes  = " << numberOfNodes);
-            int minInitLevel = grid->getCoarsestInitializedLevel();
-            int maxInitLevel = grid->getFinestInitializedLevel();
-            for (int level = minInitLevel; level <= maxInitLevel; level++)
-            {
-               int nobl = grid->getNumberOfBlocks(level);
-               UBLOG(logINFO, "Number of blocks for level " << level << " = " << nobl);
-               UBLOG(logINFO, "Number of nodes for level " << level << " = " << nobl*numberOfNodesPerBlock);
-            }
-            UBLOG(logINFO, "Necessary memory  = " << needMemAll << " bytes");
-            UBLOG(logINFO, "Necessary memory per process = " << needMem << " bytes");
-            UBLOG(logINFO, "Available memory per process = " << availMem << " bytes");
-         }
-
-         SPtr<LBMKernel> kernel;
-         //kernel = SPtr<LBMKernel>(new IncompressibleCumulantLBMKernel());
-         kernel = SPtr<LBMKernel>(new CompressibleCumulant4thOrderViscosityLBMKernel());
-         SPtr<BCProcessor> bcProc(new BCProcessor());
-         kernel->setBCProcessor(bcProc);
-         kernel->setForcingX1(0.1);
-
-         SetKernelBlockVisitor kernelVisitor(kernel, nuLB, availMem, needMem);
-         grid->accept(kernelVisitor);
-
-         if (refineLevel > 0)
-         {
-            SetUndefinedNodesBlockVisitor undefNodesVisitor;
-            grid->accept(undefNodesVisitor);
-         }
-
-         intHelper.setBC();
-
-         //BoundaryConditionBlockVisitor bcVisitor;
-         //grid->accept(bcVisitor);
-
-         //initialization of distributions
-         InitDistributionsBlockVisitor initVisitor;
-         initVisitor.setVx1(0.5);
-         grid->accept(initVisitor);
-
-         if (myid == 0) UBLOG(logINFO, "Preprocess - end");
-      }
-      else
-      {
-         rcp.restart((int)restartStep);
-         grid->setTimeStep(restartStep);
-         //set connectors
-         InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor());
-         SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
-         grid->accept(setConnsVisitor);
-
-         //domain decomposition for threads
-         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
-         grid->accept(pqPartVisitor);
-
-         if (myid==0) UBLOG(logINFO, "Restart - end");
-      }
-
-
-      if (myid == 0)
-      {
-         UBLOG(logINFO, "PID = " << myid << " Total Physical Memory (RAM): " << Utilities::getTotalPhysMem());
-         UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used: " << Utilities::getPhysMemUsed());
-         UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe());
-      }
-
-      SPtr<UbScheduler> visSch(new UbScheduler(outTime));
-      SPtr<CoProcessor> mqCoProcessor(new WriteMacroscopicQuantitiesCoProcessor(grid, visSch, pathname, WbWriterVtkXmlASCII::getInstance(), conv, comm));
-
-      SPtr<UbScheduler> nupsSch(new UbScheduler(10, 30, 100));
-      SPtr<CoProcessor> nupsCoProcessor(new NUPSCounterCoProcessor(grid, nupsSch, numOfThreads, comm));
-
-      //omp_set_num_threads(numOfThreads);
-      SPtr<Calculator> calculator(new BasicCalculator(grid, visSch, (int)endTime));
-      calculator->addCoProcessor(nupsCoProcessor);
-      calculator->addCoProcessor(mqCoProcessor);
-      if (myid == 0) UBLOG(logINFO, "Simulation-start");
-      calculator->calculate();
-      if (myid == 0) UBLOG(logINFO, "Simulation-end");
-   }
-   catch (std::exception& e)
-   {
-      cerr << e.what() << endl << flush;
-   }
-   catch (std::string& s)
-   {
-      cerr << s << endl;
-   }
-   catch (...)
-   {
-      cerr << "unknown exception" << endl;
-   }
-
-}
-
-/**
- * Reads csv file into table, exported as a vector of vector of doubles.
- * @param inputFileName input file name (full path).
- * @return data as vector of vector of doubles.
- */
-vector<vector<double>> parse2DCsvFile(string inputFileName) {
- 
-    vector<vector<double> > data;
-    ifstream inputFile(inputFileName);
-    int l = 0;
- 
-    while (inputFile) {
-        l++;
-        string s;
-        if (!getline(inputFile, s)) break;
-        if (s[0] != '#') {
-            istringstream ss(s);
-            vector<double> record;
- 
-            while (ss) {
-                string line;
-                if (!getline(ss, line, ';'))
-                    break;
-                try {
-                    record.push_back(stof(line));
-                }
-                catch (const std::invalid_argument e) {
-                    //cout << "NaN found in file " << inputFileName << " line " << l
-                    //     << endl;
-                    //e.what();
-                }
-            }
- 
-            data.push_back(record);
-        }
-    }
- 
-    if (!inputFile.eof()) {
-        cerr << "Could not read file " << inputFileName << "\n";
-        //__throw_invalid_argument("File not found.");
-    }
- 
-    return data;
-}
-
-void createPoints()
-{
-   string inputFile = "d:/Projects/SFB880/DLR-F16/PIANO/LambVector/grid.csv";
-   vector<vector<double>> data = parse2DCsvFile(inputFile);
-   
-   std::vector<UbTupleFloat3> nodes(data.size());
-   int i = 0;
-   for (auto x : data) 
-   {
-      nodes[i] =(UbTupleFloat3(float(x[0]), float(x[1]), float(x[2])));
-      i++;
-   }
-
-   string file = "d:/Projects/SFB880/DLR-F16/PIANO/LambVector/grid";
-   std::string partName = WbWriterVtkXmlASCII::getInstance()->writeNodes(file,nodes);
-}
-
-int main(int argc, char* argv[])
-{
-   //if (argv != NULL)
-   //{
-   //   if (argv[1] != NULL)
-   //   {
-         run(string(argv[1]));
-         //createPoints();
-      //}
-      //else
-      //{
-      //   cout << "Configuration file is missing!" << endl;
-      //}
-   //}
-
-}
-
+#include <iostream>
+#include <string>
+#include <vector>
+#include <sstream> //istringstream
+#include <iostream> // cout
+#include <fstream> // ifstream
+
+#include "VirtualFluids.h"
+
+using namespace std;
+
+
+void run(string configname)
+{
+   try
+   {
+      ConfigurationFile   config;
+      config.load(configname);
+
+      string          pathname = config.getValue<string>("pathname");
+      int             numOfThreads = config.getValue<int>("numOfThreads");
+      vector<int>     blocknx = config.getVector<int>("blocknx");
+      double          uLB = config.getValue<double>("uLB");
+      double          endTime = config.getValue<double>("endTime");
+      double          outTime = config.getValue<double>("outTime");
+      double          availMem = config.getValue<double>("availMem");
+      int             refineLevel = config.getValue<int>("refineLevel");
+      double          Re = config.getValue<double>("Re");
+      double          dx = config.getValue<double>("dx");
+      vector<double>  length = config.getVector<double>("length");
+      bool            logToFile = config.getValue<bool>("logToFile");
+
+      double          cpStep      = config.getValue<double>("cpStep");
+      double          cpStepStart = config.getValue<double>("cpStepStart");
+      bool            restart     = config.getValue<bool>("restart");
+      double          restartStep = config.getValue<double>("restartStep");
+
+      //UbLog::reportingLevel() = UbLog::logLevelFromString("DEBUG3");
+
+      SPtr<Communicator> comm = MPICommunicator::getInstance();
+      int myid = comm->getProcessID();
+
+      if (logToFile)
+      {
+#if defined(__unix__)
+         if (myid == 0)
+         {
+            const char* str = pathname.c_str();
+            mkdir(str, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
+   }
+#endif 
+
+         if (myid == 0)
+         {
+            stringstream logFilename;
+            logFilename << pathname + "/logfile" + UbSystem::toString(UbSystem::getTimeStamp()) + ".txt";
+            UbLog::output_policy::setStream(logFilename.str());
+         }
+}
+
+      LBMReal dLB = length[1] / dx;
+      LBMReal rhoLB = 0.0;
+      LBMReal nuLB = (uLB*dLB) / Re;
+
+      SPtr<LBMUnitConverter> conv = SPtr<LBMUnitConverter>(new LBMUnitConverter());
+
+      const int baseLevel = 0;
+
+      //bounding box
+      double g_minX1 = 0.0;
+      double g_minX2 = 0.0;
+      double g_minX3 = 0.0;
+
+      double g_maxX1 = length[0];
+      double g_maxX2 = length[1];
+      double g_maxX3 = length[2];
+
+      //geometry
+      SPtr<GbObject3D> box(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
+      //if (myid == 0) GbSystem3D::writeGeoObject(box.get(), pathname + "/geo/box", WbWriterVtkXmlBinary::getInstance());
+
+      SPtr<GbObject3D> gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
+      //if (myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), pathname + "/geo/gridCube", WbWriterVtkXmlBinary::getInstance());
+
+
+      double blockLength = blocknx[0] * dx;
+
+      SPtr<Grid3D> grid(new Grid3D(comm));
+
+      SPtr<UbScheduler> rSch2(new UbScheduler(cpStep, cpStepStart));
+      MPIIORestartCoProcessor rcp(grid, rSch2, pathname, comm);
+
+      if (!restart)
+      {
+         if (myid == 0)
+         {
+            UBLOG(logINFO, "uLb = " << uLB);
+            UBLOG(logINFO, "rho = " << rhoLB);
+            UBLOG(logINFO, "nuLb = " << nuLB);
+            UBLOG(logINFO, "Re = " << Re);
+            UBLOG(logINFO, "dx = " << dx);
+            UBLOG(logINFO, "length = " << length[0] << " " << length[1] << " " << length[2]);
+            UBLOG(logINFO, "blocknx = " << blocknx[0] << " " << blocknx[1] << " " << blocknx[2]);
+            UBLOG(logINFO, "number of levels = " << refineLevel + 1);
+            UBLOG(logINFO, "number of processes = " << comm->getNumberOfProcesses());
+            UBLOG(logINFO, "number of threads = " << numOfThreads);
+            UBLOG(logINFO, "Preprocess - start");
+         }
+
+         grid->setDeltaX(dx);
+         grid->setBlockNX(blocknx[0], blocknx[1], blocknx[2]);
+
+         //if (myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), pathname + "/geo/gridCube", WbWriterVtkXmlBinary::getInstance());
+
+         GenBlocksGridVisitor genBlocks(gridCube);
+         grid->accept(genBlocks);
+
+         SPtr<CoProcessor> ppblocks(new WriteBlocksCoProcessor(grid, SPtr<UbScheduler>(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm));
+
+         //int bbOption = 1; //0=simple Bounce Back, 1=quadr. BB
+         //D3Q27BoundaryConditionAdapterPtr bcObst(new D3Q27NoSlipBCAdapter(bbOption));
+         //SPtr<D3Q27Interactor> boxInt(new D3Q27Interactor(box, grid, bcObst, Interactor3D::INVERSESOLID));
+
+         SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B));
+         InteractorsHelper intHelper(grid, metisVisitor);
+         //intHelper.addInteractor(boxInt);
+         intHelper.selectBlocks();
+
+         ppblocks->process(0);
+         ppblocks.reset();
+
+         //set connectors
+         //InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor());
+         //SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
+         //grid->accept(setConnsVisitor);
+
+         unsigned long long numberOfBlocks = (unsigned long long)grid->getNumberOfBlocks();
+         int ghostLayer = 3;
+         unsigned long long numberOfNodesPerBlock = (unsigned long long)(blocknx[0])* (unsigned long long)(blocknx[1])* (unsigned long long)(blocknx[2]);
+         unsigned long long numberOfNodes = numberOfBlocks * numberOfNodesPerBlock;
+         unsigned long long numberOfNodesPerBlockWithGhostLayer = numberOfBlocks * (blocknx[0] + ghostLayer) * (blocknx[1] + ghostLayer) * (blocknx[2] + ghostLayer);
+         double needMemAll = double(numberOfNodesPerBlockWithGhostLayer*(27 * sizeof(double) + sizeof(int) + sizeof(float) * 4));
+         double needMem = needMemAll / double(comm->getNumberOfProcesses());
+
+         if (myid == 0)
+         {
+            UBLOG(logINFO, "Number of blocks = " << numberOfBlocks);
+            UBLOG(logINFO, "Number of nodes  = " << numberOfNodes);
+            int minInitLevel = grid->getCoarsestInitializedLevel();
+            int maxInitLevel = grid->getFinestInitializedLevel();
+            for (int level = minInitLevel; level <= maxInitLevel; level++)
+            {
+               int nobl = grid->getNumberOfBlocks(level);
+               UBLOG(logINFO, "Number of blocks for level " << level << " = " << nobl);
+               UBLOG(logINFO, "Number of nodes for level " << level << " = " << nobl*numberOfNodesPerBlock);
+            }
+            UBLOG(logINFO, "Necessary memory  = " << needMemAll << " bytes");
+            UBLOG(logINFO, "Necessary memory per process = " << needMem << " bytes");
+            UBLOG(logINFO, "Available memory per process = " << availMem << " bytes");
+         }
+
+         SPtr<LBMKernel> kernel;
+         //kernel = SPtr<LBMKernel>(new IncompressibleCumulantLBMKernel());
+         kernel = SPtr<LBMKernel>(new CompressibleCumulant4thOrderViscosityLBMKernel());
+         SPtr<BCProcessor> bcProc(new BCProcessor());
+         kernel->setBCProcessor(bcProc);
+         kernel->setForcingX1(0.1);
+
+         SetKernelBlockVisitor kernelVisitor(kernel, nuLB, availMem, needMem);
+         grid->accept(kernelVisitor);
+
+         if (refineLevel > 0)
+         {
+            SetUndefinedNodesBlockVisitor undefNodesVisitor;
+            grid->accept(undefNodesVisitor);
+         }
+
+         intHelper.setBC();
+
+         //BoundaryConditionBlockVisitor bcVisitor;
+         //grid->accept(bcVisitor);
+
+         //initialization of distributions
+         InitDistributionsBlockVisitor initVisitor;
+         initVisitor.setVx1(0.5);
+         grid->accept(initVisitor);
+
+         if (myid == 0) UBLOG(logINFO, "Preprocess - end");
+      }
+      else
+      {
+         rcp.restart((int)restartStep);
+         grid->setTimeStep(restartStep);
+         //set connectors
+         InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor());
+         SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
+         grid->accept(setConnsVisitor);
+
+         //domain decomposition for threads
+         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
+         grid->accept(pqPartVisitor);
+
+         if (myid==0) UBLOG(logINFO, "Restart - end");
+      }
+
+
+      if (myid == 0)
+      {
+         UBLOG(logINFO, "PID = " << myid << " Total Physical Memory (RAM): " << Utilities::getTotalPhysMem());
+         UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used: " << Utilities::getPhysMemUsed());
+         UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe());
+      }
+
+      SPtr<UbScheduler> visSch(new UbScheduler(outTime));
+      SPtr<CoProcessor> mqCoProcessor(new WriteMacroscopicQuantitiesCoProcessor(grid, visSch, pathname, WbWriterVtkXmlASCII::getInstance(), conv, comm));
+
+      SPtr<UbScheduler> nupsSch(new UbScheduler(10, 30, 100));
+      SPtr<CoProcessor> nupsCoProcessor(new NUPSCounterCoProcessor(grid, nupsSch, numOfThreads, comm));
+
+      //omp_set_num_threads(numOfThreads);
+      SPtr<Calculator> calculator(new BasicCalculator(grid, visSch, (int)endTime));
+      calculator->addCoProcessor(nupsCoProcessor);
+      calculator->addCoProcessor(mqCoProcessor);
+      if (myid == 0) UBLOG(logINFO, "Simulation-start");
+      calculator->calculate();
+      if (myid == 0) UBLOG(logINFO, "Simulation-end");
+   }
+   catch (std::exception& e)
+   {
+      cerr << e.what() << endl << flush;
+   }
+   catch (std::string& s)
+   {
+      cerr << s << endl;
+   }
+   catch (...)
+   {
+      cerr << "unknown exception" << endl;
+   }
+
+}
+
+/**
+ * Reads csv file into table, exported as a vector of vector of doubles.
+ * @param inputFileName input file name (full path).
+ * @return data as vector of vector of doubles.
+ */
+vector<vector<double>> parse2DCsvFile(string inputFileName) {
+ 
+    vector<vector<double> > data;
+    ifstream inputFile(inputFileName);
+    int l = 0;
+ 
+    while (inputFile) {
+        l++;
+        string s;
+        if (!getline(inputFile, s)) break;
+        if (s[0] != '#') {
+            istringstream ss(s);
+            vector<double> record;
+ 
+            while (ss) {
+                string line;
+                if (!getline(ss, line, ';'))
+                    break;
+                try {
+                    record.push_back(stof(line));
+                }
+                catch (const std::invalid_argument e) {
+                    //cout << "NaN found in file " << inputFileName << " line " << l
+                    //     << endl;
+                    //e.what();
+                }
+            }
+ 
+            data.push_back(record);
+        }
+    }
+ 
+    if (!inputFile.eof()) {
+        cerr << "Could not read file " << inputFileName << "\n";
+        //__throw_invalid_argument("File not found.");
+    }
+ 
+    return data;
+}
+
+void createPoints()
+{
+   string inputFile = "d:/Projects/SFB880/DLR-F16/PIANO/LambVector/grid.csv";
+   vector<vector<double>> data = parse2DCsvFile(inputFile);
+   
+   std::vector<UbTupleFloat3> nodes(data.size());
+   int i = 0;
+   for (auto x : data) 
+   {
+      nodes[i] =(UbTupleFloat3(float(x[0]), float(x[1]), float(x[2])));
+      i++;
+   }
+
+   string file = "d:/Projects/SFB880/DLR-F16/PIANO/LambVector/grid";
+   std::string partName = WbWriterVtkXmlASCII::getInstance()->writeNodes(file,nodes);
+}
+
+int main(int argc, char* argv[])
+{
+   //if (argv != NULL)
+   //{
+   //   if (argv[1] != NULL)
+   //   {
+         run(string(argv[1]));
+         //createPoints();
+      //}
+      //else
+      //{
+      //   cout << "Configuration file is missing!" << endl;
+      //}
+   //}
+
+}
+
diff --git a/apps/cpu/BoxBenchmark/bbVB.cfg b/apps/cpu/BoxBenchmark/bbVB.cfg
index b5be695b7ffdc8a0bb3da6e6072e346fa1f7dc91..a356b0cc46062d5e61d2553821fbb743dd499173 100644
--- a/apps/cpu/BoxBenchmark/bbVB.cfg
+++ b/apps/cpu/BoxBenchmark/bbVB.cfg
@@ -1,13 +1,13 @@
-##########################################
-#Configuration of VirtualFluids-Benchmark#
-##########################################
-
-#available memory on the computing node [Bytes]
-availMem = 64e9
-
-#block size: 16 or 32
-blockNx = 32 32 32
-
-#computational domain
-length = 256 256 256
-
+##########################################
+#Configuration of VirtualFluids-Benchmark#
+##########################################
+
+#available memory on the computing node [Bytes]
+availMem = 64e9
+
+#block size: 16 or 32
+blockNx = 32 32 32
+
+#computational domain
+length = 256 256 256
+
diff --git a/apps/cpu/CylinderSt/CMakeLists.txt b/apps/cpu/CylinderSt/CMakeLists.txt
index 5e13bd6602ede27bcfc4baded712194118506571..26c7dbc4e5dd6091cd8286dc698b0498563ad808 100644
--- a/apps/cpu/CylinderSt/CMakeLists.txt
+++ b/apps/cpu/CylinderSt/CMakeLists.txt
@@ -1,25 +1,25 @@
-CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
-
-########################################################
-## C++ PROJECT                                       ###
-########################################################
-PROJECT(cylinder_st)
-
-INCLUDE(${SOURCE_ROOT}/core/IncludsList.txt) 
-
-#################################################################
-###   LOCAL FILES                                             ###
-#################################################################
-FILE(GLOB SPECIFIC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.h
-                         ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
-                         ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp  )
- 
-SET(ALL_SOURCES ${ALL_SOURCES} ${SPECIFIC_FILES})
-SOURCE_GROUP(src FILES ${SPECIFIC_FILES})
-  
-SET(CAB_ADDITIONAL_LINK_LIBRARIES core)
-
-#################################################################
-###   CREATE PROJECT                                          ###
-#################################################################
-CREATE_CAB_PROJECT(cylinder_st BINARY)
+CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
+
+########################################################
+## C++ PROJECT                                       ###
+########################################################
+PROJECT(cylinder_st)
+
+INCLUDE(${SOURCE_ROOT}/core/IncludsList.txt) 
+
+#################################################################
+###   LOCAL FILES                                             ###
+#################################################################
+FILE(GLOB SPECIFIC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.h
+                         ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
+                         ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp  )
+ 
+SET(ALL_SOURCES ${ALL_SOURCES} ${SPECIFIC_FILES})
+SOURCE_GROUP(src FILES ${SPECIFIC_FILES})
+  
+SET(CAB_ADDITIONAL_LINK_LIBRARIES core)
+
+#################################################################
+###   CREATE PROJECT                                          ###
+#################################################################
+CREATE_CAB_PROJECT(cylinder_st BINARY)
diff --git a/apps/cpu/CylinderSt/cylinder_st.cpp b/apps/cpu/CylinderSt/cylinder_st.cpp
index 824a4d12e8eac4187e06f394a01dddf0f7f5dbde..15e17a8f94099982791d844a8effbe7eff403292 100644
--- a/apps/cpu/CylinderSt/cylinder_st.cpp
+++ b/apps/cpu/CylinderSt/cylinder_st.cpp
@@ -1,425 +1,425 @@
-#include <iostream>
-#include <string>
-
-#include "geometry3d/CoordinateTransformation3D.h"
-#include "Grid3D.h"
-#include "GenBlocksGridVisitor.h"
-#include "geometry3d/GbSystem3D.h"
-#include "geometry3d/GbCuboid3D.h"
-#include "geometry3d/GbCylinder3D.h"
-#include "basics/writer/WbWriterVtkXmlASCII.h"
-#include "basics/writer/WbWriterVtkXmlBinary.h"
-#include "RefineCrossAndInsideGbObjectBlockVisitor.h"
-#include "RatioBlockVisitor.h"
-#include "RatioSmoothBlockVisitor.h"
-#include "OverlapBlockVisitor.h"
-#include "RefineInterGbObjectsVisitor.h"
-#include "SetKernelBlockVisitor.h"
-#include "LBMKernelETD3Q27Cascaded.h"
-#include "D3Q27MacroscopicQuantitiesPostprocessor.h"
-#include "MPICommunicator.h"
-#include "D3Q27ETBCProcessor.h"
-#include "SimulationParameters.h"
-#include "D3Q27SetUndefinedNodesBlockVisitor.h"
-#include "SetInterpolationDirsBlockVisitor.h"
-#include "D3Q27SetConnectorsBlockVisitor.h"
-#include "NullCommunicator.h"
-#include "D3Q27ETInitDistributionsBlockVisitor.h"
-#include "CalculationManager.h"
-#include "PQueuePartitioningGridVisitor.h"
-#include "MetisPartitioningGridVisitor.h"
-#include "D3Q27Interactor.h"
-#include "D3Q27NoSlipBCAdapter.h"
-#include "D3Q27VelocityBCAdapter.h"
-#include "D3Q27DensityBCAdapter.h"
-#include "D3Q27BoundaryConditionAdapter.h"
-#include "StringUtil.hpp"
-#include "D3Q27OffsetInterpolationProcessor.h"
-#include "D3Q27CompactInterpolationProcessor.h"
-#include "D3Q27PressureDifferencePostprocessor.h"
-#include "D3Q27IntegrateValuesHelper.h"
-#include "RestartPostprocessor.h"
-#include "SolidBlocksHelper.h"
-#include "NUPSCounterPostprocessor.h"
-#include "BlocksPostprocessor.h"
-#include "LBMKernelETD3Q27BGK.h"
-#include "EmergencyExitPostprocessor.h"
-#include "D3Q27ForcesPostprocessor.h"
-
-using namespace std;
-
-
-void run(const char *cstr)
-{
-   try
-   {
-      string machine = QUOTEME(CAB_MACHINE);
-      string pathname; 
-      int numOfThreads = 1;
-      double availMem = 0;
-
-      CommunicatorPtr comm(new MPICommunicator());
-      int myid = comm->getProcessID();
-
-      if(machine == "BOMBADIL") 
-      {
-         pathname = "c:/temp/cylinder_st";
-         numOfThreads = 3;
-         availMem = 3.0e9;
-      }
-      else if(machine == "M01" || machine == "M02")      
-      {
-         pathname = "/work/koskuche/scratch/cylinder_st";
-         numOfThreads = 8;
-         availMem = 12.0e9;
-
-         if(myid ==0)
-         {
-           stringstream logFilename;
-           logFilename <<  pathname + "/logfile.txt";
-           UbLog::output_policy::setStream(logFilename.str());
-         }
-      }
-      else throw UbException(UB_EXARGS, "unknown CAB_MACHINE");
-
-      double dx = 0.00207051;
-
-      double L1 = 2.5;
-      double L2, L3, H;
-      L2 = L3 = H = 0.41;
-
-      LBMReal radius = 0.05;
-      LBMReal uLB = 0.05;
-      LBMReal Re = 1000.0;
-      LBMReal rhoLB = 1.0;
-      LBMReal l = L2 / dx;
-      //LBMReal nueLB = (uLB*l)/Re;
-      LBMReal nueLB = (((4.0/9.0)*uLB)*2.0*(radius/dx))/Re;
-
-      LBMUnitConverterPtr conv = LBMUnitConverterPtr(new LBMUnitConverter());
-
-      const int baseLevel = 0;
-      const int refineLevel = 2;
-
-      //obstacle
-      GbObject3DPtr cylinder(new GbCylinder3D(0.5, 0.2, -0.1, 0.5, 0.2, L3+0.1, radius));
-      GbSystem3D::writeGeoObject(cylinder.get(),pathname + "/geo/cylinder", WbWriterVtkXmlBinary::getInstance());
-
-      D3Q27InteractorPtr cylinderInt;
-
-      //bounding box
-      double d_minX1 = 0.0;
-      double d_minX2 = 0.0;
-      double d_minX3 = 0.0;
-
-      double d_maxX1 = L1;
-      double d_maxX2 = L2;
-      double d_maxX3 = L3;
-
-      double offs = dx;
-
-      //double g_minX1 = d_minX1-offs-0.499999*dx;
-      double g_minX1 = d_minX1-offs;
-      double g_minX2 = d_minX2-offs;
-      double g_minX3 = d_minX3-offs;
-
-      double g_maxX1 = d_maxX1+offs;
-      double g_maxX2 = d_maxX2+offs;
-      double g_maxX3 = d_maxX3+offs;
-
-      GbObject3DPtr gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
-
-      const int blocknx1 = 10;
-      const int blocknx2 = 10;
-      const int blocknx3 = 10;
-      
-      dx = (0.41+2*dx)/(20.0*(int)blocknx2);
-
-      double blockLength = blocknx1*dx;
-
-      //refinement area
-      //double rf = cylinder->getLengthX1()/5;
-      //GbObject3DPtr refineCube(new  GbCuboid3D(cylinder->getX1Minimum()-rf, cylinder->getX2Minimum()-rf, cylinder->getX3Minimum(), 
-      //   cylinder->getX1Maximum()+6.0*rf, cylinder->getX2Maximum()+rf, cylinder->getX3Maximum()));
-      GbObject3DPtr refineCube(new  GbCuboid3D(g_minX1 + 20.0*blockLength, g_minX2 + 6.0*blockLength, cylinder->getX3Minimum(), 
-                                               g_minX1 + 33.0*blockLength, g_maxX2 - 6.0*blockLength, cylinder->getX3Maximum()));
-
-      Grid3DPtr grid(new Grid3D());
-
-      UbSchedulerPtr rSch(new UbScheduler(100000, 100000));
-      RestartPostprocessorPtr rp(new RestartPostprocessor(grid, rSch, comm, pathname+"/checkpoints", RestartPostprocessor::BINARY));
-
-      //UbSchedulerPtr emSch(new UbScheduler(1000, 1000));
-      //EmergencyExitPostprocessor em(grid, emSch, pathname+"/checkpoints/emex.txt", rp, comm);
-
-      std::string opt;
-
-      if(cstr!= NULL)
-         opt = std::string(cstr);
-
-      if/*(cstr== NULL)*/(cstr!= NULL)
-      {
-         opt = std::string(cstr);
-
-         if(myid==0) UBLOG(logINFO,"Restart step: " << opt);
-
-         grid = rp->restart(UbSystem::stringTo<int>(opt));
-         rp->reconnect();
-
-         //cylinderInt = 
-
-         //set connectors
-         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27OffsetInterpolationProcessor());
-         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
-         grid->accept( setConnsVisitor );
-
-         //domain decomposition
-         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
-         grid->accept(pqPartVisitor);
-      }
-      else
-      {
-         if(myid ==0)
-         {
-            UBLOG(logINFO,"L = " << l );
-            UBLOG(logINFO,"v = " << uLB );
-            UBLOG(logINFO,"rho = " << rhoLB );
-            UBLOG(logINFO,"nue = " << nueLB );
-            UBLOG(logINFO,"Re = " << Re );
-            UBLOG(logINFO,"dx = " << dx );
-            UBLOG(logINFO,"Preprozess - start");
-         }
-        
-         grid->setDeltaX(dx);
-         grid->setBlockNX(blocknx1, blocknx2, blocknx3);
-         
-         // UbTupleDouble6 bouningBox(gridCube->getX1Minimum(),gridCube->getX2Minimum(),gridCube->getX3Minimum(),
-                                   // gridCube->getX1Maximum(),gridCube->getX2Maximum(),gridCube->getX3Maximum());
-         // UbTupleInt3 blockNx(blocknx1, blocknx2, blocknx3);
-         // UbTupleInt3 gridNx(8, 16, 16);
-         // grid = Grid3DPtr(new Grid3D(bouningBox, blockNx, gridNx));
-         
-         if(myid ==0) GbSystem3D::writeGeoObject(gridCube.get(),pathname + "/geo/gridCube", WbWriterVtkXmlBinary::getInstance());
-         if(myid ==0) GbSystem3D::writeGeoObject(refineCube.get(),pathname + "/geo/refineCube", WbWriterVtkXmlBinary::getInstance());
-      
-         GenBlocksGridVisitor genBlocks;
-         genBlocks.addGeoObject(gridCube);
-         grid->accept(genBlocks);
-
-         //walls
-         GbCuboid3DPtr addWallYmin (new GbCuboid3D(d_minX1-blockLength, d_minX2-blockLength, d_minX3-blockLength, d_maxX1+blockLength, d_minX2, d_maxX3+blockLength));
-         if(myid == 0) GbSystem3D::writeGeoObject(addWallYmin.get(), pathname+"/geo/addWallYmin", WbWriterVtkXmlASCII::getInstance());
-      
-         GbCuboid3DPtr addWallZmin (new GbCuboid3D(d_minX1-blockLength, d_minX2-blockLength, d_minX3-blockLength, d_maxX1+blockLength, d_maxX2+blockLength, d_minX3));
-         if(myid == 0) GbSystem3D::writeGeoObject(addWallZmin.get(), pathname+"/geo/addWallZmin", WbWriterVtkXmlASCII::getInstance());
-
-         GbCuboid3DPtr addWallYmax (new GbCuboid3D(d_minX1-blockLength, d_maxX2, d_minX3-blockLength, d_maxX1+blockLength, d_maxX2+2.0*blockLength, d_maxX3+blockLength));
-         if(myid == 0) GbSystem3D::writeGeoObject(addWallYmax.get(), pathname+"/geo/addWallYmax", WbWriterVtkXmlASCII::getInstance());
-
-         GbCuboid3DPtr addWallZmax (new GbCuboid3D(d_minX1-blockLength, d_minX2-blockLength, d_maxX3, d_maxX1+blockLength, d_maxX2+blockLength, d_maxX3+2.0*blockLength));
-         if(myid == 0) GbSystem3D::writeGeoObject(addWallZmax.get(), pathname+"/geo/addWallZmax", WbWriterVtkXmlASCII::getInstance());
-
-         //inflow
-         GbCuboid3DPtr geoInflow (new GbCuboid3D(d_minX1-blockLength, d_minX2-blockLength, d_minX3-blockLength, d_minX1, d_maxX2+blockLength, d_maxX3+blockLength));
-         if(myid == 0) GbSystem3D::writeGeoObject(geoInflow.get(), pathname+"/geo/geoInflow", WbWriterVtkXmlASCII::getInstance());
-
-         //outflow
-         GbCuboid3DPtr geoOutflow (new GbCuboid3D(d_maxX1, d_minX2-blockLength, d_minX3-blockLength, d_maxX1+2.0*blockLength, d_maxX2+blockLength, d_maxX3+blockLength));
-         if(myid == 0) GbSystem3D::writeGeoObject(geoOutflow.get(), pathname+"/geo/geoOutflow", WbWriterVtkXmlASCII::getInstance());
-
-         BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname + "/grid/blocks", WbWriterVtkXmlBinary::getInstance(), comm));
-
-         if (refineLevel > 0)
-         {
-            if(myid == 0) UBLOG(logINFO,"Refinement - start");	
-            RefineCrossAndInsideGbObjectBlockVisitor refVisitor(refineCube, baseLevel, refineLevel-1);
-            grid->accept(refVisitor);
-
-            RatioBlockVisitor ratioVisitor(refineLevel);
-            grid->accept(ratioVisitor);
-
-            RatioSmoothBlockVisitor ratioSmoothVisitor(refineLevel);
-            grid->accept(ratioSmoothVisitor);
-
-            OverlapBlockVisitor overlapVisitor(refineLevel);
-            grid->accept(overlapVisitor);
-
-            std::vector<int> dirs;
-            D3Q27System::getLBMDirections(dirs);
-            SetInterpolationDirsBlockVisitor interDirsVisitor(dirs);
-            grid->accept(interDirsVisitor);
-            if(myid == 0) UBLOG(logINFO,"Refinement - end");	
-         }
-
-         MetisPartitioningGridVisitor metisVisitor(numOfThreads, D3Q27System::B, comm, false);
-         grid->accept( metisVisitor );
-
-         SolidBlocksHelper sd(grid, comm);
-
-         int bbOption = 1; //0=simple Bounce Back, 1=quadr. BB
-         D3Q27BoundaryConditionAdapterPtr bcObst(new D3Q27NoSlipBCAdapter(bbOption));
-         cylinderInt = D3Q27InteractorPtr ( new D3Q27Interactor(cylinder, grid, bcObst,Interactor3D::SOLID));
-
-         //walls
-         D3Q27InteractorPtr addWallYminInt(new D3Q27Interactor(addWallYmin, grid, bcObst,Interactor3D::SOLID));
-         D3Q27InteractorPtr addWallZminInt(new D3Q27Interactor(addWallZmin, grid, bcObst,Interactor3D::SOLID));
-         D3Q27InteractorPtr addWallYmaxInt(new D3Q27Interactor(addWallYmax, grid, bcObst,Interactor3D::SOLID));
-         D3Q27InteractorPtr addWallZmaxInt(new D3Q27Interactor(addWallZmax, grid, bcObst,Interactor3D::SOLID));
-
-         mu::Parser fct;
-         fct.SetExpr("16*U*x2*x3*(H-x2)*(H-x3)/H^4");
-         fct.DefineConst("U", uLB);
-         fct.DefineConst("H", H);
-
-         //inflow
-         D3Q27BoundaryConditionAdapterPtr velBCAdapter(new D3Q27VelocityBCAdapter (true, false ,false ,fct, 0, D3Q27BCFunction::INFCONST));
-         velBCAdapter->setSecondaryBcOption(2);
-         D3Q27InteractorPtr inflowInt  = D3Q27InteractorPtr( new D3Q27Interactor(geoInflow, grid, velBCAdapter, Interactor3D::SOLID));
-
-         //outflow
-         D3Q27BoundaryConditionAdapterPtr denBCAdapter(new D3Q27DensityBCAdapter(rhoLB));
-         D3Q27InteractorPtr outflowInt = D3Q27InteractorPtr( new D3Q27Interactor(geoOutflow, grid, denBCAdapter,Interactor3D::SOLID));
-
-         sd.addInteractor(cylinderInt);
-         sd.addInteractor(addWallYminInt);
-         sd.addInteractor(addWallZminInt);
-         sd.addInteractor(addWallYmaxInt);
-         sd.addInteractor(addWallZmaxInt);
-         sd.addInteractor(inflowInt);
-         sd.addInteractor(outflowInt);
-         
-         sd.deleteSolidBlocks();
-         
-         grid->accept( metisVisitor );
-
-
-         ppblocks->update(0);
-         ppblocks.reset();
-
-         //set connectors
-         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27OffsetInterpolationProcessor());
-         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
-         grid->accept( setConnsVisitor );
-
-         unsigned long nob = grid->getNumberOfBlocks();
-         int gl = 3;
-         unsigned long nod = nob * (blocknx1+gl) * (blocknx2+gl) * (blocknx3+gl);
-
-         double needMemAll  = double(nod*(27*sizeof(double) + sizeof(int) + sizeof(float)*4));
-         double needMem  = needMemAll / double(comm->getNumberOfProcesses());
-
-         if(myid == 0)
-         {
-            UBLOG(logINFO,"Number of blocks = " << nob);
-            UBLOG(logINFO,"Number of nodes  = " << nod);
-            UBLOG(logINFO,"Necessary memory  = " << needMemAll  << " bytes");
-            UBLOG(logINFO,"Necessary memory per process = " << needMem  << " bytes");
-            UBLOG(logINFO,"Available memory per process = " << availMem << " bytes");
-         }            
-
-         LBMKernel3DPtr kernel(new LBMKernelETD3Q27Cascaded(blocknx1, blocknx2, blocknx3));
-         //LBMKernel3DPtr kernel(new LBMKernelETD3Q27BGK(blocknx1, blocknx2, blocknx3, true));
-
-         BCProcessorPtr bcProc(new D3Q27ETBCProcessor());
-         kernel->setBCProcessor(bcProc);
-
-         SetKernelBlockVisitor kernelVisitor(kernel, nueLB, availMem, needMem);
-         grid->accept(kernelVisitor);
-
-         if (refineLevel > 0)
-         {
-            D3Q27SetUndefinedNodesBlockVisitor undefNodesVisitor;
-            grid->accept(undefNodesVisitor);
-         }
-
-         //walls
-         grid->addAndInitInteractor(addWallYminInt);
-         grid->addAndInitInteractor(addWallZminInt);
-         grid->addAndInitInteractor(addWallYmaxInt);
-         grid->addAndInitInteractor(addWallZmaxInt);
-
-         //obstacle
-         grid->addAndInitInteractor(cylinderInt);
-
-         //inflow
-         grid->addAndInitInteractor(inflowInt);
-
-         //outflow
-         grid->addAndInitInteractor(outflowInt);
-
-         //domain decomposition
-         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
-         grid->accept(pqPartVisitor);
-
-         //initialization of distributions
-         D3Q27ETInitDistributionsBlockVisitor initVisitor(1.0);
-         initVisitor.setVx1(fct);
-         grid->accept(initVisitor);
-
-         //Postrozess
-         UbSchedulerPtr geoSch(new UbScheduler(1));
-         D3Q27MacroscopicQuantitiesPostprocessorPtr ppgeo(
-            new D3Q27MacroscopicQuantitiesPostprocessor(grid, geoSch, pathname + "/grid/nodes", WbWriterVtkXmlBinary::getInstance(), conv, comm, true));
-         ppgeo->update(0);
-         ppgeo.reset();
-         
-         if(myid == 0) UBLOG(logINFO,"Preprozess - end"); 
-      }
-
-      double outTime = 50000.0;
-      UbSchedulerPtr visSch(new UbScheduler(outTime));
-      visSch->addSchedule(1000, 1000, 10000);
-      visSch->addSchedule(10000, 10000, 50000);
-      visSch->addSchedule(1, 1, 10000);
-
-      D3Q27MacroscopicQuantitiesPostprocessor pp(grid, visSch, pathname + "/steps/step", WbWriterVtkXmlBinary::getInstance(), conv, comm);
-
-      double fdx = grid->getDeltaX(grid->getFinestInitializedLevel());
-      double point1[3] = {0.45, 0.20, 0.205};
-      double point2[3] = {0.55, 0.20, 0.205};
-
-      D3Q27IntegrateValuesHelperPtr h1(new D3Q27IntegrateValuesHelper(grid, comm, 
-         point1[0]-1.0*fdx, point1[1]-1.0*fdx, point1[2]-1.0*fdx, 
-         point1[0], point1[1], point1[2]));
-      if(myid ==0) GbSystem3D::writeGeoObject(h1->getBoundingBox().get(),pathname + "/geo/iv1", WbWriterVtkXmlBinary::getInstance());
-      D3Q27IntegrateValuesHelperPtr h2(new D3Q27IntegrateValuesHelper(grid, comm, 
-         point2[0], point2[1]-1.0*fdx, point2[2]-1.0*fdx, 
-         point2[0]+1.0*fdx, point2[1], point2[2]));
-      if(myid ==0) GbSystem3D::writeGeoObject(h2->getBoundingBox().get(),pathname + "/geo/iv2", WbWriterVtkXmlBinary::getInstance());
-      D3Q27PressureDifferencePostprocessor rhopp(grid, visSch, pathname + "/results/rho_diff.txt", h1, h2, conv, comm);
-
-      UbSchedulerPtr nupsSch(new UbScheduler(10, 10, 10));
-      double area = (radius*radius*H)/fdx;
-      double v    = 4.0*uLB/9.0;
-      D3Q27ForcesPostprocessor fp(grid, visSch, pathname + "/results/forces.txt", cylinderInt, comm, rhoLB, v, area, D3Q27ForcesPostprocessor::X, D3Q27ForcesPostprocessor::Y);
-
-      NUPSCounterPostprocessor npr(grid, nupsSch, pathname + "/results/nups.txt", comm);
-
-      double endTime = 1000001.0;
-      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, visSch));
-      if(myid == 0) UBLOG(logINFO,"Simulation-start");
-      calculation->calculate();
-      if(myid == 0) UBLOG(logINFO,"Simulation-end");
-   }
-   catch(std::exception& e)
-   {
-      cerr << e.what() << endl << flush;
-   }
-   catch(std::string& s)
-   {
-      cerr << s << endl;
-   }
-   catch(...)
-   {
-      cerr << "unknown exception" << endl;
-   }
-
-}
-int main(int argc, char* argv[])
-{
-
-   run(argv[1]);
-
-   return 0;
-}
-
+#include <iostream>
+#include <string>
+
+#include "geometry3d/CoordinateTransformation3D.h"
+#include "Grid3D.h"
+#include "GenBlocksGridVisitor.h"
+#include "geometry3d/GbSystem3D.h"
+#include "geometry3d/GbCuboid3D.h"
+#include "geometry3d/GbCylinder3D.h"
+#include "basics/writer/WbWriterVtkXmlASCII.h"
+#include "basics/writer/WbWriterVtkXmlBinary.h"
+#include "RefineCrossAndInsideGbObjectBlockVisitor.h"
+#include "RatioBlockVisitor.h"
+#include "RatioSmoothBlockVisitor.h"
+#include "OverlapBlockVisitor.h"
+#include "RefineInterGbObjectsVisitor.h"
+#include "SetKernelBlockVisitor.h"
+#include "LBMKernelETD3Q27Cascaded.h"
+#include "D3Q27MacroscopicQuantitiesPostprocessor.h"
+#include "MPICommunicator.h"
+#include "D3Q27ETBCProcessor.h"
+#include "SimulationParameters.h"
+#include "D3Q27SetUndefinedNodesBlockVisitor.h"
+#include "SetInterpolationDirsBlockVisitor.h"
+#include "D3Q27SetConnectorsBlockVisitor.h"
+#include "NullCommunicator.h"
+#include "D3Q27ETInitDistributionsBlockVisitor.h"
+#include "CalculationManager.h"
+#include "PQueuePartitioningGridVisitor.h"
+#include "MetisPartitioningGridVisitor.h"
+#include "D3Q27Interactor.h"
+#include "D3Q27NoSlipBCAdapter.h"
+#include "D3Q27VelocityBCAdapter.h"
+#include "D3Q27DensityBCAdapter.h"
+#include "D3Q27BoundaryConditionAdapter.h"
+#include "StringUtil.hpp"
+#include "D3Q27OffsetInterpolationProcessor.h"
+#include "D3Q27CompactInterpolationProcessor.h"
+#include "D3Q27PressureDifferencePostprocessor.h"
+#include "D3Q27IntegrateValuesHelper.h"
+#include "RestartPostprocessor.h"
+#include "SolidBlocksHelper.h"
+#include "NUPSCounterPostprocessor.h"
+#include "BlocksPostprocessor.h"
+#include "LBMKernelETD3Q27BGK.h"
+#include "EmergencyExitPostprocessor.h"
+#include "D3Q27ForcesPostprocessor.h"
+
+using namespace std;
+
+
+void run(const char *cstr)
+{
+   try
+   {
+      string machine = QUOTEME(CAB_MACHINE);
+      string pathname; 
+      int numOfThreads = 1;
+      double availMem = 0;
+
+      CommunicatorPtr comm(new MPICommunicator());
+      int myid = comm->getProcessID();
+
+      if(machine == "BOMBADIL") 
+      {
+         pathname = "c:/temp/cylinder_st";
+         numOfThreads = 3;
+         availMem = 3.0e9;
+      }
+      else if(machine == "M01" || machine == "M02")      
+      {
+         pathname = "/work/koskuche/scratch/cylinder_st";
+         numOfThreads = 8;
+         availMem = 12.0e9;
+
+         if(myid ==0)
+         {
+           stringstream logFilename;
+           logFilename <<  pathname + "/logfile.txt";
+           UbLog::output_policy::setStream(logFilename.str());
+         }
+      }
+      else throw UbException(UB_EXARGS, "unknown CAB_MACHINE");
+
+      double dx = 0.00207051;
+
+      double L1 = 2.5;
+      double L2, L3, H;
+      L2 = L3 = H = 0.41;
+
+      LBMReal radius = 0.05;
+      LBMReal uLB = 0.05;
+      LBMReal Re = 1000.0;
+      LBMReal rhoLB = 1.0;
+      LBMReal l = L2 / dx;
+      //LBMReal nueLB = (uLB*l)/Re;
+      LBMReal nueLB = (((4.0/9.0)*uLB)*2.0*(radius/dx))/Re;
+
+      LBMUnitConverterPtr conv = LBMUnitConverterPtr(new LBMUnitConverter());
+
+      const int baseLevel = 0;
+      const int refineLevel = 2;
+
+      //obstacle
+      GbObject3DPtr cylinder(new GbCylinder3D(0.5, 0.2, -0.1, 0.5, 0.2, L3+0.1, radius));
+      GbSystem3D::writeGeoObject(cylinder.get(),pathname + "/geo/cylinder", WbWriterVtkXmlBinary::getInstance());
+
+      D3Q27InteractorPtr cylinderInt;
+
+      //bounding box
+      double d_minX1 = 0.0;
+      double d_minX2 = 0.0;
+      double d_minX3 = 0.0;
+
+      double d_maxX1 = L1;
+      double d_maxX2 = L2;
+      double d_maxX3 = L3;
+
+      double offs = dx;
+
+      //double g_minX1 = d_minX1-offs-0.499999*dx;
+      double g_minX1 = d_minX1-offs;
+      double g_minX2 = d_minX2-offs;
+      double g_minX3 = d_minX3-offs;
+
+      double g_maxX1 = d_maxX1+offs;
+      double g_maxX2 = d_maxX2+offs;
+      double g_maxX3 = d_maxX3+offs;
+
+      GbObject3DPtr gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
+
+      const int blocknx1 = 10;
+      const int blocknx2 = 10;
+      const int blocknx3 = 10;
+      
+      dx = (0.41+2*dx)/(20.0*(int)blocknx2);
+
+      double blockLength = blocknx1*dx;
+
+      //refinement area
+      //double rf = cylinder->getLengthX1()/5;
+      //GbObject3DPtr refineCube(new  GbCuboid3D(cylinder->getX1Minimum()-rf, cylinder->getX2Minimum()-rf, cylinder->getX3Minimum(), 
+      //   cylinder->getX1Maximum()+6.0*rf, cylinder->getX2Maximum()+rf, cylinder->getX3Maximum()));
+      GbObject3DPtr refineCube(new  GbCuboid3D(g_minX1 + 20.0*blockLength, g_minX2 + 6.0*blockLength, cylinder->getX3Minimum(), 
+                                               g_minX1 + 33.0*blockLength, g_maxX2 - 6.0*blockLength, cylinder->getX3Maximum()));
+
+      Grid3DPtr grid(new Grid3D());
+
+      UbSchedulerPtr rSch(new UbScheduler(100000, 100000));
+      RestartPostprocessorPtr rp(new RestartPostprocessor(grid, rSch, comm, pathname+"/checkpoints", RestartPostprocessor::BINARY));
+
+      //UbSchedulerPtr emSch(new UbScheduler(1000, 1000));
+      //EmergencyExitPostprocessor em(grid, emSch, pathname+"/checkpoints/emex.txt", rp, comm);
+
+      std::string opt;
+
+      if(cstr!= NULL)
+         opt = std::string(cstr);
+
+      if/*(cstr== NULL)*/(cstr!= NULL)
+      {
+         opt = std::string(cstr);
+
+         if(myid==0) UBLOG(logINFO,"Restart step: " << opt);
+
+         grid = rp->restart(UbSystem::stringTo<int>(opt));
+         rp->reconnect();
+
+         //cylinderInt = 
+
+         //set connectors
+         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27OffsetInterpolationProcessor());
+         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
+         grid->accept( setConnsVisitor );
+
+         //domain decomposition
+         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
+         grid->accept(pqPartVisitor);
+      }
+      else
+      {
+         if(myid ==0)
+         {
+            UBLOG(logINFO,"L = " << l );
+            UBLOG(logINFO,"v = " << uLB );
+            UBLOG(logINFO,"rho = " << rhoLB );
+            UBLOG(logINFO,"nue = " << nueLB );
+            UBLOG(logINFO,"Re = " << Re );
+            UBLOG(logINFO,"dx = " << dx );
+            UBLOG(logINFO,"Preprozess - start");
+         }
+        
+         grid->setDeltaX(dx);
+         grid->setBlockNX(blocknx1, blocknx2, blocknx3);
+         
+         // UbTupleDouble6 bouningBox(gridCube->getX1Minimum(),gridCube->getX2Minimum(),gridCube->getX3Minimum(),
+                                   // gridCube->getX1Maximum(),gridCube->getX2Maximum(),gridCube->getX3Maximum());
+         // UbTupleInt3 blockNx(blocknx1, blocknx2, blocknx3);
+         // UbTupleInt3 gridNx(8, 16, 16);
+         // grid = Grid3DPtr(new Grid3D(bouningBox, blockNx, gridNx));
+         
+         if(myid ==0) GbSystem3D::writeGeoObject(gridCube.get(),pathname + "/geo/gridCube", WbWriterVtkXmlBinary::getInstance());
+         if(myid ==0) GbSystem3D::writeGeoObject(refineCube.get(),pathname + "/geo/refineCube", WbWriterVtkXmlBinary::getInstance());
+      
+         GenBlocksGridVisitor genBlocks;
+         genBlocks.addGeoObject(gridCube);
+         grid->accept(genBlocks);
+
+         //walls
+         GbCuboid3DPtr addWallYmin (new GbCuboid3D(d_minX1-blockLength, d_minX2-blockLength, d_minX3-blockLength, d_maxX1+blockLength, d_minX2, d_maxX3+blockLength));
+         if(myid == 0) GbSystem3D::writeGeoObject(addWallYmin.get(), pathname+"/geo/addWallYmin", WbWriterVtkXmlASCII::getInstance());
+      
+         GbCuboid3DPtr addWallZmin (new GbCuboid3D(d_minX1-blockLength, d_minX2-blockLength, d_minX3-blockLength, d_maxX1+blockLength, d_maxX2+blockLength, d_minX3));
+         if(myid == 0) GbSystem3D::writeGeoObject(addWallZmin.get(), pathname+"/geo/addWallZmin", WbWriterVtkXmlASCII::getInstance());
+
+         GbCuboid3DPtr addWallYmax (new GbCuboid3D(d_minX1-blockLength, d_maxX2, d_minX3-blockLength, d_maxX1+blockLength, d_maxX2+2.0*blockLength, d_maxX3+blockLength));
+         if(myid == 0) GbSystem3D::writeGeoObject(addWallYmax.get(), pathname+"/geo/addWallYmax", WbWriterVtkXmlASCII::getInstance());
+
+         GbCuboid3DPtr addWallZmax (new GbCuboid3D(d_minX1-blockLength, d_minX2-blockLength, d_maxX3, d_maxX1+blockLength, d_maxX2+blockLength, d_maxX3+2.0*blockLength));
+         if(myid == 0) GbSystem3D::writeGeoObject(addWallZmax.get(), pathname+"/geo/addWallZmax", WbWriterVtkXmlASCII::getInstance());
+
+         //inflow
+         GbCuboid3DPtr geoInflow (new GbCuboid3D(d_minX1-blockLength, d_minX2-blockLength, d_minX3-blockLength, d_minX1, d_maxX2+blockLength, d_maxX3+blockLength));
+         if(myid == 0) GbSystem3D::writeGeoObject(geoInflow.get(), pathname+"/geo/geoInflow", WbWriterVtkXmlASCII::getInstance());
+
+         //outflow
+         GbCuboid3DPtr geoOutflow (new GbCuboid3D(d_maxX1, d_minX2-blockLength, d_minX3-blockLength, d_maxX1+2.0*blockLength, d_maxX2+blockLength, d_maxX3+blockLength));
+         if(myid == 0) GbSystem3D::writeGeoObject(geoOutflow.get(), pathname+"/geo/geoOutflow", WbWriterVtkXmlASCII::getInstance());
+
+         BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname + "/grid/blocks", WbWriterVtkXmlBinary::getInstance(), comm));
+
+         if (refineLevel > 0)
+         {
+            if(myid == 0) UBLOG(logINFO,"Refinement - start");	
+            RefineCrossAndInsideGbObjectBlockVisitor refVisitor(refineCube, baseLevel, refineLevel-1);
+            grid->accept(refVisitor);
+
+            RatioBlockVisitor ratioVisitor(refineLevel);
+            grid->accept(ratioVisitor);
+
+            RatioSmoothBlockVisitor ratioSmoothVisitor(refineLevel);
+            grid->accept(ratioSmoothVisitor);
+
+            OverlapBlockVisitor overlapVisitor(refineLevel);
+            grid->accept(overlapVisitor);
+
+            std::vector<int> dirs;
+            D3Q27System::getLBMDirections(dirs);
+            SetInterpolationDirsBlockVisitor interDirsVisitor(dirs);
+            grid->accept(interDirsVisitor);
+            if(myid == 0) UBLOG(logINFO,"Refinement - end");	
+         }
+
+         MetisPartitioningGridVisitor metisVisitor(numOfThreads, D3Q27System::B, comm, false);
+         grid->accept( metisVisitor );
+
+         SolidBlocksHelper sd(grid, comm);
+
+         int bbOption = 1; //0=simple Bounce Back, 1=quadr. BB
+         D3Q27BoundaryConditionAdapterPtr bcObst(new D3Q27NoSlipBCAdapter(bbOption));
+         cylinderInt = D3Q27InteractorPtr ( new D3Q27Interactor(cylinder, grid, bcObst,Interactor3D::SOLID));
+
+         //walls
+         D3Q27InteractorPtr addWallYminInt(new D3Q27Interactor(addWallYmin, grid, bcObst,Interactor3D::SOLID));
+         D3Q27InteractorPtr addWallZminInt(new D3Q27Interactor(addWallZmin, grid, bcObst,Interactor3D::SOLID));
+         D3Q27InteractorPtr addWallYmaxInt(new D3Q27Interactor(addWallYmax, grid, bcObst,Interactor3D::SOLID));
+         D3Q27InteractorPtr addWallZmaxInt(new D3Q27Interactor(addWallZmax, grid, bcObst,Interactor3D::SOLID));
+
+         mu::Parser fct;
+         fct.SetExpr("16*U*x2*x3*(H-x2)*(H-x3)/H^4");
+         fct.DefineConst("U", uLB);
+         fct.DefineConst("H", H);
+
+         //inflow
+         D3Q27BoundaryConditionAdapterPtr velBCAdapter(new D3Q27VelocityBCAdapter (true, false ,false ,fct, 0, D3Q27BCFunction::INFCONST));
+         velBCAdapter->setSecondaryBcOption(2);
+         D3Q27InteractorPtr inflowInt  = D3Q27InteractorPtr( new D3Q27Interactor(geoInflow, grid, velBCAdapter, Interactor3D::SOLID));
+
+         //outflow
+         D3Q27BoundaryConditionAdapterPtr denBCAdapter(new D3Q27DensityBCAdapter(rhoLB));
+         D3Q27InteractorPtr outflowInt = D3Q27InteractorPtr( new D3Q27Interactor(geoOutflow, grid, denBCAdapter,Interactor3D::SOLID));
+
+         sd.addInteractor(cylinderInt);
+         sd.addInteractor(addWallYminInt);
+         sd.addInteractor(addWallZminInt);
+         sd.addInteractor(addWallYmaxInt);
+         sd.addInteractor(addWallZmaxInt);
+         sd.addInteractor(inflowInt);
+         sd.addInteractor(outflowInt);
+         
+         sd.deleteSolidBlocks();
+         
+         grid->accept( metisVisitor );
+
+
+         ppblocks->update(0);
+         ppblocks.reset();
+
+         //set connectors
+         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27OffsetInterpolationProcessor());
+         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
+         grid->accept( setConnsVisitor );
+
+         unsigned long nob = grid->getNumberOfBlocks();
+         int gl = 3;
+         unsigned long nod = nob * (blocknx1+gl) * (blocknx2+gl) * (blocknx3+gl);
+
+         double needMemAll  = double(nod*(27*sizeof(double) + sizeof(int) + sizeof(float)*4));
+         double needMem  = needMemAll / double(comm->getNumberOfProcesses());
+
+         if(myid == 0)
+         {
+            UBLOG(logINFO,"Number of blocks = " << nob);
+            UBLOG(logINFO,"Number of nodes  = " << nod);
+            UBLOG(logINFO,"Necessary memory  = " << needMemAll  << " bytes");
+            UBLOG(logINFO,"Necessary memory per process = " << needMem  << " bytes");
+            UBLOG(logINFO,"Available memory per process = " << availMem << " bytes");
+         }            
+
+         LBMKernel3DPtr kernel(new LBMKernelETD3Q27Cascaded(blocknx1, blocknx2, blocknx3));
+         //LBMKernel3DPtr kernel(new LBMKernelETD3Q27BGK(blocknx1, blocknx2, blocknx3, true));
+
+         BCProcessorPtr bcProc(new D3Q27ETBCProcessor());
+         kernel->setBCProcessor(bcProc);
+
+         SetKernelBlockVisitor kernelVisitor(kernel, nueLB, availMem, needMem);
+         grid->accept(kernelVisitor);
+
+         if (refineLevel > 0)
+         {
+            D3Q27SetUndefinedNodesBlockVisitor undefNodesVisitor;
+            grid->accept(undefNodesVisitor);
+         }
+
+         //walls
+         grid->addAndInitInteractor(addWallYminInt);
+         grid->addAndInitInteractor(addWallZminInt);
+         grid->addAndInitInteractor(addWallYmaxInt);
+         grid->addAndInitInteractor(addWallZmaxInt);
+
+         //obstacle
+         grid->addAndInitInteractor(cylinderInt);
+
+         //inflow
+         grid->addAndInitInteractor(inflowInt);
+
+         //outflow
+         grid->addAndInitInteractor(outflowInt);
+
+         //domain decomposition
+         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
+         grid->accept(pqPartVisitor);
+
+         //initialization of distributions
+         D3Q27ETInitDistributionsBlockVisitor initVisitor(1.0);
+         initVisitor.setVx1(fct);
+         grid->accept(initVisitor);
+
+         //Postrozess
+         UbSchedulerPtr geoSch(new UbScheduler(1));
+         D3Q27MacroscopicQuantitiesPostprocessorPtr ppgeo(
+            new D3Q27MacroscopicQuantitiesPostprocessor(grid, geoSch, pathname + "/grid/nodes", WbWriterVtkXmlBinary::getInstance(), conv, comm, true));
+         ppgeo->update(0);
+         ppgeo.reset();
+         
+         if(myid == 0) UBLOG(logINFO,"Preprozess - end"); 
+      }
+
+      double outTime = 50000.0;
+      UbSchedulerPtr visSch(new UbScheduler(outTime));
+      visSch->addSchedule(1000, 1000, 10000);
+      visSch->addSchedule(10000, 10000, 50000);
+      visSch->addSchedule(1, 1, 10000);
+
+      D3Q27MacroscopicQuantitiesPostprocessor pp(grid, visSch, pathname + "/steps/step", WbWriterVtkXmlBinary::getInstance(), conv, comm);
+
+      double fdx = grid->getDeltaX(grid->getFinestInitializedLevel());
+      double point1[3] = {0.45, 0.20, 0.205};
+      double point2[3] = {0.55, 0.20, 0.205};
+
+      D3Q27IntegrateValuesHelperPtr h1(new D3Q27IntegrateValuesHelper(grid, comm, 
+         point1[0]-1.0*fdx, point1[1]-1.0*fdx, point1[2]-1.0*fdx, 
+         point1[0], point1[1], point1[2]));
+      if(myid ==0) GbSystem3D::writeGeoObject(h1->getBoundingBox().get(),pathname + "/geo/iv1", WbWriterVtkXmlBinary::getInstance());
+      D3Q27IntegrateValuesHelperPtr h2(new D3Q27IntegrateValuesHelper(grid, comm, 
+         point2[0], point2[1]-1.0*fdx, point2[2]-1.0*fdx, 
+         point2[0]+1.0*fdx, point2[1], point2[2]));
+      if(myid ==0) GbSystem3D::writeGeoObject(h2->getBoundingBox().get(),pathname + "/geo/iv2", WbWriterVtkXmlBinary::getInstance());
+      D3Q27PressureDifferencePostprocessor rhopp(grid, visSch, pathname + "/results/rho_diff.txt", h1, h2, conv, comm);
+
+      UbSchedulerPtr nupsSch(new UbScheduler(10, 10, 10));
+      double area = (radius*radius*H)/fdx;
+      double v    = 4.0*uLB/9.0;
+      D3Q27ForcesPostprocessor fp(grid, visSch, pathname + "/results/forces.txt", cylinderInt, comm, rhoLB, v, area, D3Q27ForcesPostprocessor::X, D3Q27ForcesPostprocessor::Y);
+
+      NUPSCounterPostprocessor npr(grid, nupsSch, pathname + "/results/nups.txt", comm);
+
+      double endTime = 1000001.0;
+      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, visSch));
+      if(myid == 0) UBLOG(logINFO,"Simulation-start");
+      calculation->calculate();
+      if(myid == 0) UBLOG(logINFO,"Simulation-end");
+   }
+   catch(std::exception& e)
+   {
+      cerr << e.what() << endl << flush;
+   }
+   catch(std::string& s)
+   {
+      cerr << s << endl;
+   }
+   catch(...)
+   {
+      cerr << "unknown exception" << endl;
+   }
+
+}
+int main(int argc, char* argv[])
+{
+
+   run(argv[1]);
+
+   return 0;
+}
+
diff --git a/apps/cpu/DHIT/dhit.cfg b/apps/cpu/DHIT/dhit.cfg
index d7c0cfd4f438c0a29505b1a00e8a96ab5b262689..6aa2779c2acd45b7421b4795ae9d59a831e4fccc 100644
--- a/apps/cpu/DHIT/dhit.cfg
+++ b/apps/cpu/DHIT/dhit.cfg
@@ -1,21 +1,21 @@
-pathname = d:/temp/DHIT_Green
-numOfThreads = 4
-availMem = 11e9
-
-#Grid
-length =  128 128 128 
-blocknx = 32 32 32
-
-initTime = 10
-
-outTime = 1
-endTime = 10
-
-logToFile = false
-
-#Simulation
-initFile = d:/Projects/DHIT/Velocities.txt
-nuLB = 1.2395e-2
-uRMS = 0.0234
-lambda = 0.1
-
+pathname = d:/temp/DHIT_Green
+numOfThreads = 4
+availMem = 11e9
+
+#Grid
+length =  128 128 128 
+blocknx = 32 32 32
+
+initTime = 10
+
+outTime = 1
+endTime = 10
+
+logToFile = false
+
+#Simulation
+initFile = d:/Projects/DHIT/Velocities.txt
+nuLB = 1.2395e-2
+uRMS = 0.0234
+lambda = 0.1
+
diff --git a/apps/cpu/DHIT/dhit.cpp b/apps/cpu/DHIT/dhit.cpp
index 57d9bdca7f1674621ec675f950061bda30d35bb7..7eb78c37ee35d99af6ac9ca665beba023896290f 100644
--- a/apps/cpu/DHIT/dhit.cpp
+++ b/apps/cpu/DHIT/dhit.cpp
@@ -1,269 +1,269 @@
-#include <iostream>
-#include <string>
-
-#include "VirtualFluids.h"
-
-using namespace std;
-
-
-void run(string configname)
-{
-   try
-   {
-      //Sleep(30000);
-
-      ConfigurationFile   config;
-      config.load(configname);
-
-      string          pathname = config.getString("pathname");
-      int             numOfThreads = config.getInt("numOfThreads");
-      vector<int>     blocknx = config.getVector<int>("blocknx");
-      double          endTime = config.getDouble("endTime");
-      double          outTime = config.getDouble("outTime");
-      double          availMem = config.getDouble("availMem");
-      vector<double>  length = config.getVector<double>("length");
-      bool            logToFile = config.getBool("logToFile");
-      string          initFile = config.getString("initFile");
-      double          nuLB = config.getDouble("nuLB");
-      double          uRMS = config.getDouble("uRMS");
-      double          lambda = config.getDouble("lambda");
-      double          initTime = config.getDouble("initTime");
-
-      SPtr<Communicator> comm = MPICommunicator::getInstance();
-      int myid = comm->getProcessID();
-
-      if (logToFile)
-      {
-#if defined(__unix__)
-         if (myid == 0)
-         {
-            const char* str = pathname.c_str();
-            mkdir(str, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
-         }
-#endif 
-
-         if (myid == 0)
-         {
-            stringstream logFilename;
-            logFilename << pathname + "/logfile" + UbSystem::toString(UbSystem::getTimeStamp()) + ".txt";
-            UbLog::output_policy::setStream(logFilename.str());
-         }
-      }
-
-      //LBMReal uLB = 0.032;
-      LBMReal dx = 1.0;
-      LBMReal rhoLB = 0.0;
-
-
-
-      SPtr<LBMUnitConverter> conv = SPtr<LBMUnitConverter>(new LBMUnitConverter());
-
-      //bounding box
-      double g_minX1 = 0.0;
-      double g_minX2 = 0.0;
-      double g_minX3 = 0.0;
-
-      double g_maxX1 = length[0];//-1.0;
-      double g_maxX2 = length[1];//-1.0;
-      double g_maxX3 = length[2];//-1.0;
-
-      //geometry
-      SPtr<GbObject3D> box(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
-      if (myid == 0) GbSystem3D::writeGeoObject(box.get(), pathname + "/geo/box", WbWriterVtkXmlBinary::getInstance());
-
-      SPtr<GbObject3D> gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
-      if (myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), pathname + "/geo/gridCube", WbWriterVtkXmlBinary::getInstance());
-
-
-      double blockLength = blocknx[0] * dx;
-
-      SPtr<Grid3D> grid(new Grid3D(comm));
-
-      if (myid == 0)
-      {
-         //UBLOG(logINFO, "uLb = " << uLB);
-         UBLOG(logINFO, "rho = " << rhoLB);
-         UBLOG(logINFO, "nuLb = " << nuLB);
-         UBLOG(logINFO, "uRMS = " << uRMS);
-         UBLOG(logINFO, "lambda = " << lambda);
-         UBLOG(logINFO, "Re = " << (uRMS*lambda)/nuLB);
-         UBLOG(logINFO, "dx = " << dx);
-         UBLOG(logINFO, "length = " << length[0] << " " << length[1] << " " << length[2]);
-         UBLOG(logINFO, "blocknx = " << blocknx[0] << " " << blocknx[1] << " " << blocknx[2]);
-         UBLOG(logINFO, "number of processes = " << comm->getNumberOfProcesses());
-         UBLOG(logINFO, "number of threads = " << numOfThreads);
-         UBLOG(logINFO, "Preprocess - start");
-      }
-
-      grid->setDeltaX(dx);
-      grid->setBlockNX(blocknx[0], blocknx[1], blocknx[2]);
-      grid->setPeriodicX1(true);
-      grid->setPeriodicX2(true);
-      grid->setPeriodicX3(true);
-
-      if (myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), pathname + "/geo/gridCube", WbWriterVtkXmlBinary::getInstance());
-
-      GenBlocksGridVisitor genBlocks(gridCube);
-      grid->accept(genBlocks);
-
-      WriteBlocksSPtr<CoProcessor> ppblocks(new WriteBlocksCoProcessor(grid, SPtr<UbScheduler>(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm));
-
-      SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::BSW));
-      InteractorsHelper intHelper(grid, metisVisitor);
-      //intHelper.addInteractor(boxInt);
-      intHelper.selectBlocks();
-
-      ppblocks->process(0);
-      ppblocks.reset();
-
-      //set connectors
-      InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor());
-      SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
-      grid->accept(setConnsVisitor);
-
-      //domain decomposition for threads
-      PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
-      grid->accept(pqPartVisitor);
-
-      unsigned long long numberOfBlocks = (unsigned long long)grid->getNumberOfBlocks();
-      int ghostLayer = 3;
-      unsigned long long numberOfNodesPerBlock = (unsigned long long)(blocknx[0])* (unsigned long long)(blocknx[1])* (unsigned long long)(blocknx[2]);
-      unsigned long long numberOfNodes = numberOfBlocks * numberOfNodesPerBlock;
-      unsigned long long numberOfNodesPerBlockWithGhostLayer = numberOfBlocks * (blocknx[0] + ghostLayer) * (blocknx[1] + ghostLayer) * (blocknx[2] + ghostLayer);
-      double needMemAll = double(numberOfNodesPerBlockWithGhostLayer*(27 * sizeof(double) + sizeof(int) + sizeof(float) * 4));
-      double needMem = needMemAll / double(comm->getNumberOfProcesses());
-
-      if (myid == 0)
-      {
-         UBLOG(logINFO, "Number of blocks = " << numberOfBlocks);
-         UBLOG(logINFO, "Number of nodes  = " << numberOfNodes);
-         int minInitLevel = grid->getCoarsestInitializedLevel();
-         int maxInitLevel = grid->getFinestInitializedLevel();
-         for (int level = minInitLevel; level <= maxInitLevel; level++)
-         {
-            int nobl = grid->getNumberOfBlocks(level);
-            UBLOG(logINFO, "Number of blocks for level " << level << " = " << nobl);
-            UBLOG(logINFO, "Number of nodes for level " << level << " = " << nobl*numberOfNodesPerBlock);
-         }
-         UBLOG(logINFO, "Necessary memory  = " << needMemAll << " bytes");
-         UBLOG(logINFO, "Necessary memory per process = " << needMem << " bytes");
-         UBLOG(logINFO, "Available memory per process = " << availMem << " bytes");
-      }
-
-      SPtr<LBMKernel> kernel;
-
-      //kernel = LBMKernel3DPtr(new LBMKernelETD3Q27CCLB(blocknx[0], blocknx[1], blocknx[2], LBMKernelETD3Q27CCLB::NORMAL));
-      kernel = SPtr<LBMKernel>(new InitDensityLBMKernel(blocknx[0], blocknx[1], blocknx[2]));
-
-      SPtr<BCProcessor> bcProc(new BCProcessor());
-      kernel->setBCProcessor(bcProc);
-
-      SetKernelBlockVisitor kernelVisitor(kernel, nuLB, availMem, needMem);
-      grid->accept(kernelVisitor);
-
-      intHelper.setBC();
-
-      //initialization of distributions
-      InitDistributionsBlockVisitor initVisitor(nuLB, rhoLB);
-      double u_LB = 0.01;
-      mu::Parser inflowProfileVx1, inflowProfileVx2, inflowProfileVx3;
-      inflowProfileVx1.DefineConst("U", u_LB);
-      inflowProfileVx1.DefineConst("PI", PI);
-      inflowProfileVx1.DefineConst("L1", g_maxX1-g_minX1);
-      inflowProfileVx1.DefineConst("L2", g_maxX2-g_minX2);
-      inflowProfileVx1.DefineConst("L3", g_maxX3-g_minX3);
-      inflowProfileVx1.SetExpr("U*cos(2.0*PI*x1/L1)*sin(2.0*PI*x2/L2)*sin(2.0*PI*x3/L3)");
-      inflowProfileVx2.DefineConst("U", u_LB);
-      inflowProfileVx2.DefineConst("PI", PI);
-      inflowProfileVx2.DefineConst("L1", g_maxX1-g_minX1);
-      inflowProfileVx2.DefineConst("L2", g_maxX2-g_minX2);
-      inflowProfileVx2.DefineConst("L3", g_maxX3-g_minX3);
-      inflowProfileVx2.SetExpr("-U*cos(2.0*PI*x1/L1)*sin(2.0*PI*x2/L2)*cos(2.0*PI*x3/L3)");
-      inflowProfileVx3.DefineConst("U", u_LB);
-      inflowProfileVx3.DefineConst("PI", PI);
-      inflowProfileVx3.DefineConst("L1", g_maxX1-g_minX1);
-      inflowProfileVx3.DefineConst("L2", g_maxX2-g_minX2);
-      inflowProfileVx3.DefineConst("L3", g_maxX3-g_minX3);
-      inflowProfileVx3.SetExpr("-U/2.0*sin(8.0*PI*(x1)/(L1))*cos(8.0*PI*(x3)/L3)");
-      initVisitor.setVx1(inflowProfileVx1);
-      initVisitor.setVx2(inflowProfileVx2);
-      initVisitor.setVx3(inflowProfileVx3);
-      //InitDistributionsFromFileBlockVisitor initVisitor(nuLB, rhoLB, initFile);
-      grid->accept(initVisitor);
-
-      //boundary conditions grid
-      {
-         SPtr<UbScheduler> geoSch(new UbScheduler(1));
-         WriteBoundaryConditionsSPtr<CoProcessor> ppgeo(
-            new WriteBoundaryConditionsCoProcessor(grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, comm));
-         grid->coProcess(0);
-      }
-
-      if (myid == 0) UBLOG(logINFO, "Preprocess - end");
-
-      if (myid == 0)
-      {
-         UBLOG(logINFO, "PID = " << myid << " Total Physical Memory (RAM): " << Utilities::getTotalPhysMem());
-         UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used: " << Utilities::getPhysMemUsed());
-         UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe());
-      }
-
-      SPtr<UbScheduler> outputSch(new UbScheduler(outTime));
-      WriteMacroscopicQuantitiesCoProcessor pp(grid, outputSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, comm);
-
-      SPtr<UbScheduler> nupsSch(new UbScheduler(10, 30, 100));
-      NUPSCounterCoProcessor npr(grid, nupsSch, numOfThreads, comm);
-
-      const SPtr<ConcreteCalculatorFactory> calculatorFactory = std::make_shared<ConcreteCalculatorFactory>(outputSch);
-      CalculationManagerPtr initialisation(new CalculationManager(grid, numOfThreads, endTime, calculatorFactory, CalculatorType::HYBRID));
-      if (myid == 0) UBLOG(logINFO, "Initialisation-start");
-      initialisation->calculate();
-      if (myid == 0) UBLOG(logINFO, "Initialisation-end");
-
-
-      kernel = SPtr<LBMKernel>(new IncompressibleCumulantLBMKernel(blocknx[0], blocknx[1], blocknx[2], IncompressibleCumulantLBMKernel::NORMAL));
-      kernel->setBCProcessor(bcProc);
-      SetKernelBlockVisitor kernelVisitor2(kernel, nuLB, availMem, needMem, SetKernelBlockVisitor::ChangeKernel);
-      grid->accept(kernelVisitor2);
-
-      SPtr<UbScheduler> visSch(new UbScheduler(outTime));
-
-      if (myid==0) UBLOG(logINFO, "Simulation-start");
-      grid->setTimeStep(initTime+1.0);
-
-      const SPtr<ConcreteCalculatorFactory> calculatorFactory2 = std::make_shared<ConcreteCalculatorFactory>(visSch);
-      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, calculatorFactory2, CalculatorType::HYBRID));
-      calculation->calculate();
-      if (myid==0) UBLOG(logINFO, "Simulation-end");
-
-   }
-   catch (std::exception& e)
-   {
-      cerr << e.what() << endl << flush;
-   }
-   catch (std::string& s)
-   {
-      cerr << s << endl;
-   }
-   catch (...)
-   {
-      cerr << "unknown exception" << endl;
-   }
-
-}
-int main(int argc, char* argv[])
-{
-   if (argv != NULL)
-   {
-      if (argv[1] != NULL)
-      {
-         run(string(argv[1]));
-      }
-      else
-      {
-         cout << "Configuration file is missing!" << endl;
-      }
-   }
-
-}
-
+#include <iostream>
+#include <string>
+
+#include "VirtualFluids.h"
+
+using namespace std;
+
+
+void run(string configname)
+{
+   try
+   {
+      //Sleep(30000);
+
+      ConfigurationFile   config;
+      config.load(configname);
+
+      string          pathname = config.getString("pathname");
+      int             numOfThreads = config.getInt("numOfThreads");
+      vector<int>     blocknx = config.getVector<int>("blocknx");
+      double          endTime = config.getDouble("endTime");
+      double          outTime = config.getDouble("outTime");
+      double          availMem = config.getDouble("availMem");
+      vector<double>  length = config.getVector<double>("length");
+      bool            logToFile = config.getBool("logToFile");
+      string          initFile = config.getString("initFile");
+      double          nuLB = config.getDouble("nuLB");
+      double          uRMS = config.getDouble("uRMS");
+      double          lambda = config.getDouble("lambda");
+      double          initTime = config.getDouble("initTime");
+
+      SPtr<Communicator> comm = MPICommunicator::getInstance();
+      int myid = comm->getProcessID();
+
+      if (logToFile)
+      {
+#if defined(__unix__)
+         if (myid == 0)
+         {
+            const char* str = pathname.c_str();
+            mkdir(str, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
+         }
+#endif 
+
+         if (myid == 0)
+         {
+            stringstream logFilename;
+            logFilename << pathname + "/logfile" + UbSystem::toString(UbSystem::getTimeStamp()) + ".txt";
+            UbLog::output_policy::setStream(logFilename.str());
+         }
+      }
+
+      //LBMReal uLB = 0.032;
+      LBMReal dx = 1.0;
+      LBMReal rhoLB = 0.0;
+
+
+
+      SPtr<LBMUnitConverter> conv = SPtr<LBMUnitConverter>(new LBMUnitConverter());
+
+      //bounding box
+      double g_minX1 = 0.0;
+      double g_minX2 = 0.0;
+      double g_minX3 = 0.0;
+
+      double g_maxX1 = length[0];//-1.0;
+      double g_maxX2 = length[1];//-1.0;
+      double g_maxX3 = length[2];//-1.0;
+
+      //geometry
+      SPtr<GbObject3D> box(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
+      if (myid == 0) GbSystem3D::writeGeoObject(box.get(), pathname + "/geo/box", WbWriterVtkXmlBinary::getInstance());
+
+      SPtr<GbObject3D> gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
+      if (myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), pathname + "/geo/gridCube", WbWriterVtkXmlBinary::getInstance());
+
+
+      double blockLength = blocknx[0] * dx;
+
+      SPtr<Grid3D> grid(new Grid3D(comm));
+
+      if (myid == 0)
+      {
+         //UBLOG(logINFO, "uLb = " << uLB);
+         UBLOG(logINFO, "rho = " << rhoLB);
+         UBLOG(logINFO, "nuLb = " << nuLB);
+         UBLOG(logINFO, "uRMS = " << uRMS);
+         UBLOG(logINFO, "lambda = " << lambda);
+         UBLOG(logINFO, "Re = " << (uRMS*lambda)/nuLB);
+         UBLOG(logINFO, "dx = " << dx);
+         UBLOG(logINFO, "length = " << length[0] << " " << length[1] << " " << length[2]);
+         UBLOG(logINFO, "blocknx = " << blocknx[0] << " " << blocknx[1] << " " << blocknx[2]);
+         UBLOG(logINFO, "number of processes = " << comm->getNumberOfProcesses());
+         UBLOG(logINFO, "number of threads = " << numOfThreads);
+         UBLOG(logINFO, "Preprocess - start");
+      }
+
+      grid->setDeltaX(dx);
+      grid->setBlockNX(blocknx[0], blocknx[1], blocknx[2]);
+      grid->setPeriodicX1(true);
+      grid->setPeriodicX2(true);
+      grid->setPeriodicX3(true);
+
+      if (myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), pathname + "/geo/gridCube", WbWriterVtkXmlBinary::getInstance());
+
+      GenBlocksGridVisitor genBlocks(gridCube);
+      grid->accept(genBlocks);
+
+      WriteBlocksSPtr<CoProcessor> ppblocks(new WriteBlocksCoProcessor(grid, SPtr<UbScheduler>(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm));
+
+      SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::BSW));
+      InteractorsHelper intHelper(grid, metisVisitor);
+      //intHelper.addInteractor(boxInt);
+      intHelper.selectBlocks();
+
+      ppblocks->process(0);
+      ppblocks.reset();
+
+      //set connectors
+      InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor());
+      SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
+      grid->accept(setConnsVisitor);
+
+      //domain decomposition for threads
+      PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
+      grid->accept(pqPartVisitor);
+
+      unsigned long long numberOfBlocks = (unsigned long long)grid->getNumberOfBlocks();
+      int ghostLayer = 3;
+      unsigned long long numberOfNodesPerBlock = (unsigned long long)(blocknx[0])* (unsigned long long)(blocknx[1])* (unsigned long long)(blocknx[2]);
+      unsigned long long numberOfNodes = numberOfBlocks * numberOfNodesPerBlock;
+      unsigned long long numberOfNodesPerBlockWithGhostLayer = numberOfBlocks * (blocknx[0] + ghostLayer) * (blocknx[1] + ghostLayer) * (blocknx[2] + ghostLayer);
+      double needMemAll = double(numberOfNodesPerBlockWithGhostLayer*(27 * sizeof(double) + sizeof(int) + sizeof(float) * 4));
+      double needMem = needMemAll / double(comm->getNumberOfProcesses());
+
+      if (myid == 0)
+      {
+         UBLOG(logINFO, "Number of blocks = " << numberOfBlocks);
+         UBLOG(logINFO, "Number of nodes  = " << numberOfNodes);
+         int minInitLevel = grid->getCoarsestInitializedLevel();
+         int maxInitLevel = grid->getFinestInitializedLevel();
+         for (int level = minInitLevel; level <= maxInitLevel; level++)
+         {
+            int nobl = grid->getNumberOfBlocks(level);
+            UBLOG(logINFO, "Number of blocks for level " << level << " = " << nobl);
+            UBLOG(logINFO, "Number of nodes for level " << level << " = " << nobl*numberOfNodesPerBlock);
+         }
+         UBLOG(logINFO, "Necessary memory  = " << needMemAll << " bytes");
+         UBLOG(logINFO, "Necessary memory per process = " << needMem << " bytes");
+         UBLOG(logINFO, "Available memory per process = " << availMem << " bytes");
+      }
+
+      SPtr<LBMKernel> kernel;
+
+      //kernel = LBMKernel3DPtr(new LBMKernelETD3Q27CCLB(blocknx[0], blocknx[1], blocknx[2], LBMKernelETD3Q27CCLB::NORMAL));
+      kernel = SPtr<LBMKernel>(new InitDensityLBMKernel(blocknx[0], blocknx[1], blocknx[2]));
+
+      SPtr<BCProcessor> bcProc(new BCProcessor());
+      kernel->setBCProcessor(bcProc);
+
+      SetKernelBlockVisitor kernelVisitor(kernel, nuLB, availMem, needMem);
+      grid->accept(kernelVisitor);
+
+      intHelper.setBC();
+
+      //initialization of distributions
+      InitDistributionsBlockVisitor initVisitor(nuLB, rhoLB);
+      double u_LB = 0.01;
+      mu::Parser inflowProfileVx1, inflowProfileVx2, inflowProfileVx3;
+      inflowProfileVx1.DefineConst("U", u_LB);
+      inflowProfileVx1.DefineConst("PI", PI);
+      inflowProfileVx1.DefineConst("L1", g_maxX1-g_minX1);
+      inflowProfileVx1.DefineConst("L2", g_maxX2-g_minX2);
+      inflowProfileVx1.DefineConst("L3", g_maxX3-g_minX3);
+      inflowProfileVx1.SetExpr("U*cos(2.0*PI*x1/L1)*sin(2.0*PI*x2/L2)*sin(2.0*PI*x3/L3)");
+      inflowProfileVx2.DefineConst("U", u_LB);
+      inflowProfileVx2.DefineConst("PI", PI);
+      inflowProfileVx2.DefineConst("L1", g_maxX1-g_minX1);
+      inflowProfileVx2.DefineConst("L2", g_maxX2-g_minX2);
+      inflowProfileVx2.DefineConst("L3", g_maxX3-g_minX3);
+      inflowProfileVx2.SetExpr("-U*cos(2.0*PI*x1/L1)*sin(2.0*PI*x2/L2)*cos(2.0*PI*x3/L3)");
+      inflowProfileVx3.DefineConst("U", u_LB);
+      inflowProfileVx3.DefineConst("PI", PI);
+      inflowProfileVx3.DefineConst("L1", g_maxX1-g_minX1);
+      inflowProfileVx3.DefineConst("L2", g_maxX2-g_minX2);
+      inflowProfileVx3.DefineConst("L3", g_maxX3-g_minX3);
+      inflowProfileVx3.SetExpr("-U/2.0*sin(8.0*PI*(x1)/(L1))*cos(8.0*PI*(x3)/L3)");
+      initVisitor.setVx1(inflowProfileVx1);
+      initVisitor.setVx2(inflowProfileVx2);
+      initVisitor.setVx3(inflowProfileVx3);
+      //InitDistributionsFromFileBlockVisitor initVisitor(nuLB, rhoLB, initFile);
+      grid->accept(initVisitor);
+
+      //boundary conditions grid
+      {
+         SPtr<UbScheduler> geoSch(new UbScheduler(1));
+         WriteBoundaryConditionsSPtr<CoProcessor> ppgeo(
+            new WriteBoundaryConditionsCoProcessor(grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, comm));
+         grid->coProcess(0);
+      }
+
+      if (myid == 0) UBLOG(logINFO, "Preprocess - end");
+
+      if (myid == 0)
+      {
+         UBLOG(logINFO, "PID = " << myid << " Total Physical Memory (RAM): " << Utilities::getTotalPhysMem());
+         UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used: " << Utilities::getPhysMemUsed());
+         UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe());
+      }
+
+      SPtr<UbScheduler> outputSch(new UbScheduler(outTime));
+      WriteMacroscopicQuantitiesCoProcessor pp(grid, outputSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, comm);
+
+      SPtr<UbScheduler> nupsSch(new UbScheduler(10, 30, 100));
+      NUPSCounterCoProcessor npr(grid, nupsSch, numOfThreads, comm);
+
+      const SPtr<ConcreteCalculatorFactory> calculatorFactory = std::make_shared<ConcreteCalculatorFactory>(outputSch);
+      CalculationManagerPtr initialisation(new CalculationManager(grid, numOfThreads, endTime, calculatorFactory, CalculatorType::HYBRID));
+      if (myid == 0) UBLOG(logINFO, "Initialisation-start");
+      initialisation->calculate();
+      if (myid == 0) UBLOG(logINFO, "Initialisation-end");
+
+
+      kernel = SPtr<LBMKernel>(new IncompressibleCumulantLBMKernel(blocknx[0], blocknx[1], blocknx[2], IncompressibleCumulantLBMKernel::NORMAL));
+      kernel->setBCProcessor(bcProc);
+      SetKernelBlockVisitor kernelVisitor2(kernel, nuLB, availMem, needMem, SetKernelBlockVisitor::ChangeKernel);
+      grid->accept(kernelVisitor2);
+
+      SPtr<UbScheduler> visSch(new UbScheduler(outTime));
+
+      if (myid==0) UBLOG(logINFO, "Simulation-start");
+      grid->setTimeStep(initTime+1.0);
+
+      const SPtr<ConcreteCalculatorFactory> calculatorFactory2 = std::make_shared<ConcreteCalculatorFactory>(visSch);
+      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, calculatorFactory2, CalculatorType::HYBRID));
+      calculation->calculate();
+      if (myid==0) UBLOG(logINFO, "Simulation-end");
+
+   }
+   catch (std::exception& e)
+   {
+      cerr << e.what() << endl << flush;
+   }
+   catch (std::string& s)
+   {
+      cerr << s << endl;
+   }
+   catch (...)
+   {
+      cerr << "unknown exception" << endl;
+   }
+
+}
+int main(int argc, char* argv[])
+{
+   if (argv != NULL)
+   {
+      if (argv[1] != NULL)
+      {
+         run(string(argv[1]));
+      }
+      else
+      {
+         cout << "Configuration file is missing!" << endl;
+      }
+   }
+
+}
+
diff --git a/apps/cpu/DLR-F16-Porous/f16.cpp b/apps/cpu/DLR-F16-Porous/f16.cpp
index cbc94322586f6d6a03a61d237c2f4712a234ce80..422c2dead86796d935fb73b8a16ebf94db53df71 100644
--- a/apps/cpu/DLR-F16-Porous/f16.cpp
+++ b/apps/cpu/DLR-F16-Porous/f16.cpp
@@ -1,774 +1,774 @@
-#include <iostream>
-#include <string>
-
-#include <PointerDefinitions.h>
-#include "VirtualFluids.h"
-#include <omp.h>
-using namespace std;
-
-
-//////////////////////////////////////////////////////////////////////////
-void initPteBlock(SPtr<Grid3D> grid, SPtr<Block3D> block)
-{
-   int gridRank = grid->getRank();
-   int blockRank = block->getRank();
-
-   if (blockRank == gridRank)
-   {
-      SPtr<ILBMKernel> kernel = block->getKernel();
-      if (!kernel)
-         throw UbException(UB_EXARGS, "The LBM kernel isn't exist in block: "+block->toString());
-
-      SPtr<BCArray3D> bcArray = kernel->getBCProcessor()->getBCArray();
-      SPtr<DistributionArray3D> distributions = kernel->getDataSet()->getFdistributions();
-
-      LBMReal f[D3Q27System::ENDF+1];
-
-      size_t nx1 = distributions->getNX1();
-      size_t nx2 = distributions->getNX2();
-      size_t nx3 = distributions->getNX3();
-
-      for (int ix3=0; ix3<bcArray->getNX3(); ix3++)
-         for (int ix2=0; ix2<bcArray->getNX2(); ix2++)
-            for (int ix1=0; ix1<bcArray->getNX1(); ix1++)
-            {
-               D3Q27System::calcCompFeq(f, 0, 0, 0, 0);
-               distributions->setDistribution(f, ix1, ix2, ix3);
-               distributions->setDistributionInv(f, ix1, ix2, ix3);
-            }
-      block->setActive(true);
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-void initPteFs(SPtr<Grid3D> grid, vector<SPtr<Block3D>>& vectorTE)
-{
-   for (SPtr<Block3D> block : vectorTE)
-   {
-      initPteBlock(grid, block);
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-
-void run(string configname)
-{
-   try
-   {
-      ConfigurationFile   config;
-      config.load(configname);
-
-      string          pathOut = config.getValue<string>("pathOut");
-      string          pathGeo = config.getValue<string>("pathGeo");
-      string          fngFileNoTapeFull = config.getValue<string>("fngFileNoTapeFull");
-      string          fngFileFull = config.getValue<string>("fngFileFull");
-      string          fngFileNoTapeBody = config.getValue<string>("fngFileNoTapeBody");
-      string          fngFileBody = config.getValue<string>("fngFileBody");
-      string          fngFileTE = config.getValue<string>("fngFileTE");
-
-      int             accuracy = config.getValue<int>("accuracy");
-      int             numOfThreads = config.getValue<int>("numOfThreads");
-      vector<int>     blockNx = config.getVector<int>("blockNx");
-      vector<double>  boundingBox = config.getVector<double>("boundingBox");
-      double          restartStep = config.getValue<double>("restartStep");
-      double          cpStart = config.getValue<double>("cpStart");
-      double          cpStep = config.getValue<double>("cpStep");
-      int             endTime = config.getValue<int>("endTime");
-      double          outTimeStep = config.getValue<double>("outTimeStep");
-      double          outTimeStart = config.getValue<double>("outTimeStart");
-      double          availMem = config.getValue<double>("availMem");
-      int             refineLevel = config.getValue<int>("refineLevel");
-      bool            logToFile = config.getValue<bool>("logToFile");
-      double          deltaXfine = config.getValue<double>("deltaXfine");
-      double          refineDistance = config.getValue<double>("refineDistance");
-      double          startDistance = config.getValue<double>("startDistance");
-      vector<double>  nupsStep = config.getVector<double>("nupsStep");
-      bool            newStart = config.getValue<bool>("newStart");
-      bool            writeBlocks = config.getValue<bool>("writeBlocks");
-
-      double          timeAvStart       = config.getValue<double>("timeAvStart");
-      double          timeAvStop        = config.getValue<double>("timeAvStop");
-
-      vector<int>     pmNX              = config.getVector<int>("pmNX");
-      double          lthreshold        = config.getValue<double>("lthreshold");
-      double          uthreshold        = config.getValue<double>("uthreshold");
-      vector<float>   voxelDeltaX       = config.getVector<float>("voxelDeltaX");
-      string          pathGeoTEvoxel    = config.getValue<string>("pathGeoTEvoxel");
-      
-
-
-      SPtr<Communicator> comm = MPICommunicator::getInstance();
-      int myid = comm->getProcessID();
-
-      if (logToFile)
-      {
-#if defined(__unix__)
-         if (myid==0)
-         {
-            const char* str = pathOut.c_str();
-            mkdir(str, S_IRWXU|S_IRWXG|S_IROTH|S_IXOTH);
-         }
-#endif 
-
-         if (myid==0)
-         {
-            stringstream logFilename;
-            logFilename<<pathOut+"/logfile"+UbSystem::toString(UbSystem::getTimeStamp())+".txt";
-            UbLog::output_policy::setStream(logFilename.str());
-         }
-      }
-
-      if (myid==0)
-      {
-         UBLOG(logINFO, "PID = "<<myid<<" Point 1");
-         UBLOG(logINFO, "PID = "<<myid<<" Total Physical Memory (RAM): "<<Utilities::getTotalPhysMem());
-         UBLOG(logINFO, "PID = "<<myid<<" Physical Memory currently used: "<<Utilities::getPhysMemUsed());
-         UBLOG(logINFO, "PID = "<<myid<<" Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB");
-      }
-
-
-      //the geometry is in mm
-
-      double g_minX1 = boundingBox[0];//*1000.0;
-      double g_minX2 = boundingBox[2];//*1000.0;
-      double g_minX3 = boundingBox[4];//*1000.0;
-      double g_maxX1 = boundingBox[1];//*1000.0;
-      double g_maxX2 = boundingBox[3];//*1000.0;
-      double g_maxX3 = boundingBox[5];//*1000.0;
-      //deltaXfine *=1000.0;
-
-      //////////////////////////////////////////////////////////////////////////
-      double deltaXcoarse = deltaXfine*(double)(1<<refineLevel);
-      //////////////////////////////////////////////////////////////////////////
-      double blockLength = (double)blockNx[0]*deltaXcoarse;
-
-      //##########################################################################
-      //## physical parameters
-      //##########################################################################
-      double Re = 1e6;
-
-      double rhoLB = 0.0;
-      double rhoReal = 1.2041; //(kg/m3)
-      //double nueReal = 153.5e-7; //m^2/s
-      double uReal = 55; //m/s
-      double lReal = 0.3;//m
-      //double uReal = Re*nueReal / lReal;
-      double nuReal = (uReal*lReal)/Re; //m^2/s
-
-      //##Machzahl:
-      //#Ma     = uReal/csReal
-      double Ma = 0.15;//Ma-Real!
-      double csReal = uReal / Ma;
-      double hLB = lReal / deltaXcoarse;
-
-      LBMUnitConverter unitConverter(lReal, csReal, rhoReal, hLB);
-
-      double uLB = uReal   * unitConverter.getFactorVelocityWToLb();
-      double nuLB = nuReal * unitConverter.getFactorViscosityWToLb();
-      double lLB = lReal/deltaXcoarse;
-      //double nuLB = (uLB*lLB)/Re; //0.005;
-      //double nuLB = 0.005;
-
-      SPtr<LBMUnitConverter> conv = SPtr<LBMUnitConverter>(new LBMUnitConverter());
-
-      const int baseLevel = 0;
-
-      ////////////////////////////////////////////////////////////////////////
-      //Grid
-      //////////////////////////////////////////////////////////////////////////
-      SPtr<Grid3D> grid(new Grid3D(comm));
-
-      //BC adapters
-      SPtr<BCAdapter> noSlipBCAdapter(new NoSlipBCAdapter());
-      noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new ThinWallNoSlipBCAlgorithm()));
-
-      //SPtr<BCAdapter> slipBCAdapter(new SlipBCAdapter());
-      //slipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new SlipBCAlgorithm()));
-
-      mu::Parser fct;
-      fct.SetExpr("U");
-      fct.DefineConst("U", uLB);
-      SPtr<BCAdapter> velBCAdapter(new VelocityBCAdapter(true, false, false, fct, 0, BCFunction::INFCONST));
-      velBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new VelocityWithDensityBCAlgorithm()));
-
-      //fct.SetExpr("U");
-      //fct.DefineConst("U", 0.01);
-      //SPtr<BCAdapter> velBCAdapterOut(new VelocityBCAdapter(true, false, false, fct, 0, BCFunction::INFCONST));
-      //velBCAdapterOut->setBcAlgorithm(SPtr<BCAlgorithm>(new VelocityBCAlgorithm()));
-
-      SPtr<BCAdapter> outflowBCAdapter(new DensityBCAdapter(rhoLB));
-      outflowBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NonReflectingOutflowBCAlgorithm()));
-
-      BoundaryConditionsBlockVisitor bcVisitor;
-      bcVisitor.addBC(noSlipBCAdapter);
-      bcVisitor.addBC(velBCAdapter);
-      bcVisitor.addBC(outflowBCAdapter);
-
-      SPtr<BCProcessor> bcProc;
-      //bcProc = SPtr<BCProcessor>(new BCProcessor());
-      bcProc = SPtr<BCProcessor>(new ThinWallBCProcessor());
-
-      SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new CompressibleCumulant4thOrderViscosityLBMKernel());
-      //t = 21.8, P = 1.0145 atm, Relative Humidity = 45.8, Second Coefficient of Viscosity = 3120
      //Ash, R. L., Zuckerwar, A. J., & Zheng, Z. (1991). Second coefficient of viscosity in air.
-      double bulckViscosity = 3120 * nuLB;
-      dynamicPointerCast<CompressibleCumulant4thOrderViscosityLBMKernel>(kernel)->setBulkViscosity(bulckViscosity);
-      kernel->setBCProcessor(bcProc);
-
-      SPtr<LBMKernel> spKernel = SPtr<LBMKernel>(new CompressibleCumulantLBMKernel());
-      spKernel->setBCProcessor(bcProc);
-      //////////////////////////////////////////////////////////////////////////
-      //restart
-      SPtr<UbScheduler> rSch(new UbScheduler(cpStep, cpStart));
-      SPtr<MPIIORestartCoProcessor> restartCoProcessor(new MPIIORestartCoProcessor(grid, rSch, pathOut, comm));
-      restartCoProcessor->setLBMKernel(kernel);
-      restartCoProcessor->setBCProcessor(bcProc);
-
-      SPtr<UbScheduler> mSch(new UbScheduler(cpStep, cpStart));
-      SPtr<MPIIOMigrationCoProcessor> migCoProcessor(new MPIIOMigrationCoProcessor(grid, mSch, pathOut+"/mig", comm));
-      migCoProcessor->setLBMKernel(kernel);
-      migCoProcessor->setBCProcessor(bcProc);
-      //////////////////////////////////////////////////////////////////////////
-
-      if (myid==0)
-      {
-         UBLOG(logINFO, "PID = "<<myid<<" Point 2");
-         UBLOG(logINFO, "PID = "<<myid<<" Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB");
-      }
-
-      if (myid==0)
-      {
-         UBLOG(logINFO, "Parameters:");
-         UBLOG(logINFO, "* Re                  = "<<Re);
-         UBLOG(logINFO, "* Ma                  = "<<Ma);
-         UBLOG(logINFO, "* velocity (uReal)    = "<<uReal<<" m/s");
-         UBLOG(logINFO, "* viscosity (nuReal)  = "<<nuReal<<" m^2/s");
-         UBLOG(logINFO, "* chord length (lReal)= "<<lReal<<" m");
-         UBLOG(logINFO, "* velocity LB (uLB)   = "<<uLB);
-         UBLOG(logINFO, "* viscosity LB (nuLB) = "<<nuLB);
-         UBLOG(logINFO, "* chord length (l_LB) = "<<lLB<<" dx_base");
-         UBLOG(logINFO, "* dx_base             = "<<deltaXcoarse<<" m");
-         UBLOG(logINFO, "* dx_refine           = "<<deltaXfine<<" m");
-         UBLOG(logINFO, "* blocknx             = "<<blockNx[0]<<"x"<<blockNx[1]<<"x"<<blockNx[2]);
-         UBLOG(logINFO, "* refineDistance      = "<<refineDistance);
-         UBLOG(logINFO, "* number of levels    = "<<refineLevel+1);
-         UBLOG(logINFO, "* number of threads   = "<<numOfThreads);
-         UBLOG(logINFO, "* number of processes = "<<comm->getNumberOfProcesses());
-         UBLOG(logINFO, "* path = "<<pathOut);
-       }
-
-      if (newStart)
-      {
-         ////////////////////////////////////////////////////////////////////////
-         //define grid
-         //////////////////////////////////////////////////////////////////////////
-         grid->setDeltaX(deltaXcoarse);
-         grid->setBlockNX(blockNx[0], blockNx[1], blockNx[2]);
-
-         SPtr<GbObject3D> gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
-         if (myid==0) GbSystem3D::writeGeoObject(gridCube.get(), pathOut+"/geo/gridCube", WbWriterVtkXmlASCII::getInstance());
-         GenBlocksGridVisitor genBlocks(gridCube);
-         grid->accept(genBlocks);
-
-         grid->setPeriodicX1(false);
-         grid->setPeriodicX2(true);
-         grid->setPeriodicX3(false);
-
-         if (myid==0)
-         {
-            UBLOG(logINFO, "Preprocessing - start");
-            UBLOG(logINFO, "PID = "<<myid<<" Point 3");
-            UBLOG(logINFO, "PID = "<<myid<<" Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB");
-         }
-         //////////////////////////////////////////////////////////////////////////
-
-
-         //voxelMatrixTransformation(pmNX, lthreshold, uthreshold, voxelDeltaX, pathGeoTEvoxel, pathOut, comm);
-
-         //return;
-
-
-         SPtr<GbTriFaceMesh3D> fngMeshTE;
-         if (myid==0) UBLOG(logINFO, "Read fngMeshTE:start");
-         fngMeshTE = SPtr<GbTriFaceMesh3D>(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile2(pathGeo+"/"+fngFileTE, "fngMeshTE", GbTriFaceMesh3D::KDTREE_SAHPLIT, false));
-         if (myid==0) UBLOG(logINFO, "Read fngMeshTE:end");
-         fngMeshTE->rotate(0.0, 0.5, 0.0);
-         fngMeshTE->translate(0.0, 0.0, 0.0012 - 0.0000192);
-         if (myid==0) GbSystem3D::writeGeoObject(fngMeshTE.get(), pathOut+"/geo/fngMeshTE", WbWriterVtkXmlBinary::getInstance());
-
-         SPtr<Interactor3D> fngIntrTE = SPtr<D3Q27TriFaceMeshInteractor>(new D3Q27TriFaceMeshInteractor(fngMeshTE, grid, noSlipBCAdapter, Interactor3D::SOLID, (Interactor3D::Accuracy)accuracy));
-
-         double zTranslate = -0.0001308;
-
-         if (refineLevel>0 && myid==0 && writeBlocks)
-         {
-            if (myid==0) UBLOG(logINFO, "Refinement - start");
-            int rank = grid->getRank();
-            grid->setRank(0);
-
-            SPtr<GbTriFaceMesh3D> fngMeshNoTapeFull;
-            if (myid==0) UBLOG(logINFO, "Read fngFileNoTapeFull:start");
-            fngMeshNoTapeFull = SPtr<GbTriFaceMesh3D>(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile2(pathGeo+"/"+fngFileNoTapeFull, "fngMeshNoTapeBody", GbTriFaceMesh3D::KDTREE_SAHPLIT, false));
-            if (myid==0) UBLOG(logINFO, "Read fngFileNoTapeFull:end");
-            fngMeshNoTapeFull->rotate(0.0, 0.5, 0.0);
-            if (myid==0) GbSystem3D::writeGeoObject(fngMeshNoTapeFull.get(), pathOut+"/geo/fngMeshNoTapeFull", WbWriterVtkXmlBinary::getInstance());
-
-            SPtr<Interactor3D> fngIntrNoTapeFull = SPtr<D3Q27TriFaceMeshInteractor>(new D3Q27TriFaceMeshInteractor(fngMeshNoTapeFull, grid, noSlipBCAdapter, Interactor3D::SOLID, (Interactor3D::Accuracy)accuracy));
-
-            int level;
-
-			level = 1;
-			if (refineLevel - level >= 0)
-			{
-				dynamicPointerCast<D3Q27TriFaceMeshInteractor>(fngIntrNoTapeFull)->refineBlockGridToLevel(level, startDistance, refineDistance);
-			}
-
-            level = 2;
-			if (refineLevel - level >= 0)
-			{
-				dynamicPointerCast<D3Q27TriFaceMeshInteractor>(fngIntrNoTapeFull)->refineBlockGridToLevel(level, startDistance, refineDistance);
-			}
-
-            level = 3;
-            if (refineLevel - level >= 0)
-            {
-               dynamicPointerCast<D3Q27TriFaceMeshInteractor>(fngIntrNoTapeFull)->refineBlockGridToLevel(level, startDistance, 24.0*refineDistance);
-            }
-
-            level = 4;
-            if (refineLevel - level >= 0)
-            {
-               dynamicPointerCast<D3Q27TriFaceMeshInteractor>(fngIntrNoTapeFull)->refineBlockGridToLevel(level, startDistance, 12.0*refineDistance);
-            }
-
-            level = 5;
-            if (refineLevel - level >= 0)
-            {
-               dynamicPointerCast<D3Q27TriFaceMeshInteractor>(fngIntrNoTapeFull)->refineBlockGridToLevel(level, startDistance, 6.0*refineDistance);
-            }
-
-            level = 6;
-            if (refineLevel - level >= 0)
-            {
-               dynamicPointerCast<D3Q27TriFaceMeshInteractor>(fngIntrNoTapeFull)->refineBlockGridToLevel(level, startDistance, 3.0*refineDistance);
-               RefineCrossAndInsideGbObjectBlockVisitor refVisitorTE(fngMeshTE, level);
-               grid->accept(refVisitorTE);
-            }
-
-            ///////delete solid blocks
-            if (myid==0) UBLOG(logINFO, "deleteSolidBlocks - start");
-
-            SPtr<GbTriFaceMesh3D> fngMeshNoTapeBody;
-            if (myid==0) UBLOG(logINFO, "Read fngFileNoTapeBody:start");
-            fngMeshNoTapeBody = SPtr<GbTriFaceMesh3D>(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile2(pathGeo+"/"+fngFileNoTapeBody, "fngMeshNoTapeBody", GbTriFaceMesh3D::KDTREE_SAHPLIT, false));
-            if (myid==0) UBLOG(logINFO, "Read fngFileNoTapeBody:end");
-            fngMeshNoTapeBody->rotate(0.0, 0.5, 0.0);
-            fngMeshNoTapeBody->translate(0.0, 0.0, zTranslate);
-            //fngMeshNoTapeBody->translate(0.0, 0.0, -0.00011);
-            
-            if (myid==0) GbSystem3D::writeGeoObject(fngMeshNoTapeBody.get(), pathOut+"/geo/fngMeshNoTapeBody", WbWriterVtkXmlBinary::getInstance());
-
-            SPtr<Interactor3D> fngIntrNoTapeBody = SPtr<D3Q27TriFaceMeshInteractor>(new D3Q27TriFaceMeshInteractor(fngMeshNoTapeBody, grid, noSlipBCAdapter, Interactor3D::SOLID, (Interactor3D::Accuracy)accuracy));//, Interactor3D::POINTS));
-
-            SetSolidBlocksBlockVisitor v(fngIntrNoTapeBody);
-            grid->accept(v);
-            std::vector<SPtr<Block3D>>& sb = fngIntrNoTapeBody->getSolidBlockSet();
-            for (SPtr<Block3D> block : sb)
-            {
-               grid->deleteBlock(block);
-            }
-            fngIntrNoTapeBody->removeSolidBlocks();
-            fngIntrNoTapeBody->removeBcBlocks();
-
-
-            if (myid==0) UBLOG(logINFO, "deleteSolidBlocks - end");
-            //////////////////////////////////////////
-
-            {
-               WriteBlocksCoProcessor ppblocks(grid, SPtr<UbScheduler>(new UbScheduler(1)), pathOut, WbWriterVtkXmlBinary::getInstance(), comm);
-               ppblocks.process(0);
-            }
-
-            grid->setRank(rank);
-
-            RatioBlockVisitor ratioVisitor(refineLevel);
-            CheckRatioBlockVisitor checkRatio(refineLevel);
-            int count = 0;
-
-            do {
-               if (myid==0) UBLOG(logINFO, "ratioVisitor - start");
-               grid->accept(ratioVisitor);
-               if (myid==0) UBLOG(logINFO, "ratioVisitor - end");
-               if (myid==0) UBLOG(logINFO, "checkRatio - start");
-               checkRatio.resetState();
-               grid->accept(checkRatio);
-               if (myid==0) UBLOG(logINFO, "checkRatio - end");
-               if (myid==0) UBLOG(logINFO, "count = "<<count++<<" state = "<<checkRatio.getState());
-            } while (!checkRatio.getState());
-
-
-            {
-               WriteBlocksCoProcessor ppblocks(grid, SPtr<UbScheduler>(new UbScheduler(1)), pathOut, WbWriterVtkXmlBinary::getInstance(), comm);
-               ppblocks.process(1);
-            }
-
-            OverlapBlockVisitor overlapVisitor(refineLevel, false);
-            grid->accept(overlapVisitor);
-
-            if (myid==0) UBLOG(logINFO, "Refinement - end");
-         }
-         else if (refineLevel>0 && !writeBlocks)
-         {
-            migCoProcessor->readBlocks(0);
-         }
-         grid->updateDistributedBlocks(comm);
-
-         std::vector<int> dirs;
-         for (int i = D3Q27System::E; i<=D3Q27System::TS; i++)
-         {
-            dirs.push_back(i);
-         }
-         SetInterpolationDirsBlockVisitor interDirsVisitor(dirs);
-         grid->accept(interDirsVisitor);
-
-         //walls
-         GbCuboid3DPtr addWallZmin(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_minX3));
-         if (myid==0) GbSystem3D::writeGeoObject(addWallZmin.get(), pathOut+"/geo/addWallZmin", WbWriterVtkXmlASCII::getInstance());
-
-         GbCuboid3DPtr addWallZmax(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_maxX3, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength));
-         if (myid==0) GbSystem3D::writeGeoObject(addWallZmax.get(), pathOut+"/geo/addWallZmax", WbWriterVtkXmlASCII::getInstance());
-
-         //wall interactors
-         SPtr<D3Q27Interactor> addWallZminInt(new D3Q27Interactor(addWallZmin, grid, velBCAdapter, Interactor3D::SOLID));
-         SPtr<D3Q27Interactor> addWallZmaxInt(new D3Q27Interactor(addWallZmax, grid, velBCAdapter, Interactor3D::SOLID));
-
-         //inflow
-         GbCuboid3DPtr geoInflow(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3-blockLength, g_minX1, g_maxX2+blockLength, g_maxX3+blockLength));
-         if (myid==0) GbSystem3D::writeGeoObject(geoInflow.get(), pathOut+"/geo/geoInflow", WbWriterVtkXmlASCII::getInstance());
-
-         //outflow
-         GbCuboid3DPtr geoOutflow(new GbCuboid3D(g_maxX1, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength));
-         if (myid==0) GbSystem3D::writeGeoObject(geoOutflow.get(), pathOut+"/geo/geoOutflow", WbWriterVtkXmlASCII::getInstance());
-
-         //inflow
-         SPtr<D3Q27Interactor> inflowIntr = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoInflow, grid, velBCAdapter, Interactor3D::SOLID));
-
-         //outflow
-         SPtr<D3Q27Interactor> outflowIntr = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoOutflow, grid, outflowBCAdapter, Interactor3D::SOLID));
-
-         //airfoil
-         SPtr<GbTriFaceMesh3D> fngMeshBody;
-         if (myid==0) UBLOG(logINFO, "Read fngFileBody:start");
-         fngMeshBody = SPtr<GbTriFaceMesh3D>(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile2(pathGeo+"/"+fngFileBody, "fngMeshBody", GbTriFaceMesh3D::KDTREE_SAHPLIT, false));
-         if (myid==0) UBLOG(logINFO, "Read fngFileBody:end");
-         fngMeshBody->rotate(0.0, 0.5, 0.0);
-         //fngMeshBody->translate(0.0, 0.0, -0.00011);
-         fngMeshBody->translate(0.0, 0.0, zTranslate);
-         if (myid==0) GbSystem3D::writeGeoObject(fngMeshBody.get(), pathOut+"/geo/fngMeshBody", WbWriterVtkXmlBinary::getInstance());
-
-         SPtr<Interactor3D> fngIntrBody = SPtr<D3Q27TriFaceMeshInteractor>(new D3Q27TriFaceMeshInteractor(fngMeshBody, grid, noSlipBCAdapter, Interactor3D::SOLID, (Interactor3D::Accuracy)accuracy));
-         fngMeshBody.reset();
-
-         GbCuboid3DPtr geoAddWallP(new GbCuboid3D(0.269, g_minX2-blockLength, 0.0016, 0.27028, g_maxX2+blockLength, 0.0076));
-         if (myid==0) GbSystem3D::writeGeoObject(geoAddWallP.get(), pathOut+"/geo/geoAddWallP", WbWriterVtkXmlASCII::getInstance());
-         SPtr<D3Q27Interactor> addWallPIntr = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoAddWallP, grid, noSlipBCAdapter, Interactor3D::SOLID));
-
-         //////////////////////////////////////////////////////////////////////////
-         vector<double> origin(3);
-         origin[0] = 0;
-         origin[1] = 0;
-         origin[2] = 0;
-
-         double vmZtranslate = 0.0042 - 0.007587;
-
-         SPtr<GbVoxelMatrix3D> voxelMatrix1(new GbVoxelMatrix3D(pmNX[0], pmNX[1], pmNX[2], 0, lthreshold, uthreshold));
-         voxelMatrix1->readMatrixFromRawFile<unsigned short>(pathGeoTEvoxel, GbVoxelMatrix3D::BigEndian);
-         voxelMatrix1->setVoxelMatrixDelta(voxelDeltaX[0], voxelDeltaX[1], voxelDeltaX[2]);
-         voxelMatrix1->setVoxelMatrixMininum(origin[0], origin[1], origin[2]);
-
-         voxelMatrix1->rotate90aroundZ();
-         voxelMatrix1->rotate90aroundZ();
-         voxelMatrix1->rotate90aroundZ();
-         voxelMatrix1->rotate90aroundX();
-         voxelMatrix1->translate(0.2813, 0, vmZtranslate);
-         double offset = ((g_maxX2-g_minX2)/2.0 - voxelMatrix1->getLengthX2())/2.0;
-         voxelMatrix1->setVoxelMatrixMinX2(g_minX2+offset);
-
-         if (myid==0) voxelMatrix1->writeToVTKImageDataAppended(pathOut+"/geo/fngTEvoxel1");
-
-         SPtr<D3Q27Interactor> fngIntrTEvoxel1 = SPtr<D3Q27Interactor>(new D3Q27Interactor(voxelMatrix1, grid, noSlipBCAdapter, Interactor3D::SOLID));
-
-         SPtr<GbVoxelMatrix3D> voxelMatrix2(new GbVoxelMatrix3D(pmNX[0], pmNX[1], pmNX[2], 0, lthreshold, uthreshold));
-         voxelMatrix2->readMatrixFromRawFile<unsigned short>(pathGeoTEvoxel, GbVoxelMatrix3D::BigEndian);
-         voxelMatrix2->setVoxelMatrixDelta(voxelDeltaX[0], voxelDeltaX[1], voxelDeltaX[2]);
-         voxelMatrix2->setVoxelMatrixMininum(origin[0], origin[1], origin[2]);
-
-         voxelMatrix2->rotate90aroundZ();
-         voxelMatrix2->rotate90aroundZ();
-         voxelMatrix2->rotate90aroundZ();
-         voxelMatrix2->rotate90aroundX();
-         voxelMatrix2->translate(0.2813, 0, vmZtranslate);
-         voxelMatrix2->mirrorY();
-         voxelMatrix2->setVoxelMatrixMinX2(voxelMatrix1->getX2Maximum());
-
-         if (myid==0) voxelMatrix2->writeToVTKImageDataAppended(pathOut+"/geo/fngTEvoxel2");
-
-         SPtr<D3Q27Interactor> fngIntrTEvoxel2 = SPtr<D3Q27Interactor>(new D3Q27Interactor(voxelMatrix2, grid, noSlipBCAdapter, Interactor3D::SOLID));
-         //////////////////////////////////////////////////////////////////////////
-
-         ////////////////////////////////////////////
-         //METIS
-         SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::BSW, MetisPartitioner::KWAY));
-         ////////////////////////////////////////////
-         /////delete solid blocks
-         if (myid==0) UBLOG(logINFO, "deleteSolidBlocks - start");
-         InteractorsHelper intHelper(grid, metisVisitor);
-         intHelper.addInteractor(inflowIntr);
-         intHelper.addInteractor(outflowIntr);
-         intHelper.addInteractor(addWallZminInt);
-         intHelper.addInteractor(addWallZmaxInt);
-         intHelper.addInteractor(fngIntrBody);
-         intHelper.addInteractor(addWallPIntr);
-         intHelper.addInteractor(fngIntrTEvoxel1);
-         intHelper.addInteractor(fngIntrTEvoxel2);
-         intHelper.selectBlocks();
-
-         if (myid==0) UBLOG(logINFO, "deleteSolidBlocks - end");
-
-         if (myid==0)
-         {
-            UBLOG(logINFO, "PID = "<<myid<<" Point 4");
-            UBLOG(logINFO, "PID = "<<myid<<" Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB");
-         }
-         //////////////////////////////////////
-
-         unsigned long long numberOfBlocks = (unsigned long long)grid->getNumberOfBlocks();
-         int ghostLayer = 3;
-         unsigned long long numberOfNodesPerBlock = (unsigned long long)(blockNx[0])* (unsigned long long)(blockNx[1])* (unsigned long long)(blockNx[2]);
-         unsigned long long numberOfNodes = numberOfBlocks * numberOfNodesPerBlock;
-         unsigned long long numberOfNodesPerBlockWithGhostLayer = numberOfBlocks * (blockNx[0]+ghostLayer) * (blockNx[1]+ghostLayer) * (blockNx[2]+ghostLayer);
-         double needMemAll = double(numberOfNodesPerBlockWithGhostLayer*(27*sizeof(double)+sizeof(int)+sizeof(float)*4));
-         double needMem = needMemAll/double(comm->getNumberOfProcesses());
-
-         if (myid==0)
-         {
-            UBLOG(logINFO, "Number of blocks = "<<numberOfBlocks);
-            UBLOG(logINFO, "Number of nodes  = "<<numberOfNodes);
-            int minInitLevel = grid->getCoarsestInitializedLevel();
-            int maxInitLevel = grid->getFinestInitializedLevel();
-            for (int level = minInitLevel; level<=maxInitLevel; level++)
-            {
-               int nobl = grid->getNumberOfBlocks(level);
-               UBLOG(logINFO, "Number of blocks for level "<<level<<" = "<<nobl);
-               UBLOG(logINFO, "Number of nodes for level "<<level<<" = "<<nobl*numberOfNodesPerBlock);
-            }
-            UBLOG(logINFO, "Necessary memory  = "<<needMemAll<<" bytes");
-            UBLOG(logINFO, "Necessary memory per process = "<<needMem<<" bytes");
-            UBLOG(logINFO, "Available memory per process = "<<availMem<<" bytes");
-         }
-
-         if (writeBlocks)
-         {
-            migCoProcessor->writeBlocks(0);
-         }
-
-         {
-            WriteBlocksCoProcessor ppblocks(grid, SPtr<UbScheduler>(new UbScheduler(1)), pathOut, WbWriterVtkXmlBinary::getInstance(), comm);
-            ppblocks.process(2);
-         }
-
-         SetKernelBlockVisitor kernelVisitor(kernel, nuLB, availMem, needMem);
-         grid->accept(kernelVisitor);
-
-         if (myid==0) UBLOG(logINFO, "SetKernelBlockVisitor:end");
-
-         if (myid==0)
-         {
-            UBLOG(logINFO, "PID = "<<myid<<" Point 5");
-            UBLOG(logINFO, "PID = "<<myid<<" Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB");
-         }
-
-         if (refineLevel>0)
-         {
-            SetUndefinedNodesBlockVisitor undefNodesVisitor;
-            grid->accept(undefNodesVisitor);
-         }
-
-         if (myid==0) UBLOG(logINFO, "SetUndefinedNodesBlockVisitor:end");
-
-         //BC
-         intHelper.setBC();
-
-         if (myid==0) UBLOG(logINFO, "intHelper.setBC():end");
-         if (myid==0) UBLOG(logINFO, "PID = "<<myid<<" Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB");
-
-         if (myid==0) UBLOG(logINFO, "vectorTE:start");
-         SetSolidBlocksBlockVisitor v1(fngIntrTE);
-         grid->accept(v1);
-         SetBcBlocksBlockVisitor v2(fngIntrTE);
-         grid->accept(v2);
-         std::vector<SPtr<Block3D>>& vectorTE = fngIntrTE->getSolidBlockSet();
-         std::vector<SPtr<Block3D>>& bb = fngIntrTE->getBcBlocks();
-         vectorTE.insert(vectorTE.end(), bb.begin(), bb.end());
-         if (myid==0) UBLOG(logINFO, "vectorTE:end");
-
-         if (myid==0)
-         {
-            UBLOG(logINFO, "PID = "<<myid<<" Point 6");
-            UBLOG(logINFO, "PID = "<<myid<<" Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB");
-         }
-
-         //initialization of distributions
-         InitDistributionsBlockVisitor initVisitor;
-         initVisitor.setVx1(fct);
-         grid->accept(initVisitor);
-
-         initPteFs(grid, vectorTE);
-
-         if (myid==0)
-         {
-            UBLOG(logINFO, "PID = "<<myid<<" Point 7");
-            UBLOG(logINFO, "PID = "<<myid<<" Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB");
-         }
-
-         //Post process
-         {
-            SPtr<UbScheduler> geoSch(new UbScheduler(1));
-            WriteBoundaryConditionsCoProcessor ppgeo(grid, geoSch, pathOut, WbWriterVtkXmlBinary::getInstance(), comm);
-            ppgeo.process(0);
-         }
-
-         if (myid==0)
-         {
-            UBLOG(logINFO, "PID = "<<myid<<" Point 8");
-            UBLOG(logINFO, "PID = "<<myid<<" Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB");
-         }
-
-         /////////////////////////////////////////////////////////////////////////////
-         if (myid==0) UBLOG(logINFO, "Preprozess - end");
-      }
-      else
-      {
-         //restartCoProcessor->restart((int)restartStep);
-         migCoProcessor->restart((int)restartStep);
-         grid->setTimeStep(restartStep);
-
-         WriteBlocksCoProcessor ppblocks(grid, SPtr<UbScheduler>(new UbScheduler(1)), pathOut, WbWriterVtkXmlBinary::getInstance(), comm);
-         ppblocks.process(3);
-         ////////////////////////////////////////////////////////////////////////////
-      }
-      ////set connectors
-      SPtr<InterpolationProcessor> iProcessor(new CompressibleOffsetMomentsInterpolationProcessor());
-      dynamicPointerCast<CompressibleOffsetMomentsInterpolationProcessor>(iProcessor)->setBulkViscosity(nuLB, bulckViscosity);
-      SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
-      grid->accept(setConnsVisitor);
-
-      //bcVisitor should be accept after initialization!!!!
-      grid->accept(bcVisitor);
-      if (myid == 0) UBLOG(logINFO, "grid->accept(bcVisitor):end");
-
-      ////sponge layer
-      GbCuboid3DPtr spongeLayerX1max(new GbCuboid3D(g_maxX1 - 0.35, g_minX2 - blockLength, g_minX3 - blockLength, g_maxX1 + blockLength, g_maxX2 + blockLength, g_maxX3 + blockLength));
-      if (myid == 0) GbSystem3D::writeGeoObject(spongeLayerX1max.get(), pathOut + "/geo/spongeLayerX1max", WbWriterVtkXmlASCII::getInstance());
-      SpongeLayerBlockVisitor slVisitorX1max(spongeLayerX1max, spKernel, nuLB, D3Q27System::E);
-      grid->accept(slVisitorX1max);
-
-      SPtr<UbScheduler> nupsSch(new UbScheduler(nupsStep[0], nupsStep[1], nupsStep[2]));
-      std::shared_ptr<NUPSCounterCoProcessor> nupsCoProcessor(new NUPSCounterCoProcessor(grid, nupsSch, numOfThreads, comm));
-
-      SPtr<UbScheduler> stepSch(new UbScheduler(outTimeStep, outTimeStart));
-
-      if (myid==0)
-      {
-         UBLOG(logINFO, "PID = "<<myid<<" Point 9");
-         UBLOG(logINFO, "PID = "<<myid<<" Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB");
-      }
-
-      SPtr<WriteMacroscopicQuantitiesCoProcessor> writeMQCoProcessor(new WriteMacroscopicQuantitiesCoProcessor(grid, stepSch, pathOut, WbWriterVtkXmlBinary::getInstance(), conv, comm));
-
-      SPtr<GbObject3D> bbBox(new GbCuboid3D(g_minX1-blockLength, (g_maxX2-g_minX2)/2.0, g_minX3-blockLength, g_maxX1+blockLength, (g_maxX2-g_minX2)/2.0+deltaXcoarse, g_maxX3+blockLength));
-      if (myid==0) GbSystem3D::writeGeoObject(bbBox.get(), pathOut+"/geo/bbBox", WbWriterVtkXmlASCII::getInstance());
-      SPtr<WriteMQFromSelectionCoProcessor> writeMQSelectCoProcessor(new WriteMQFromSelectionCoProcessor(grid, stepSch, bbBox, pathOut, WbWriterVtkXmlBinary::getInstance(), conv, comm));
-
-      SPtr<UbScheduler> tavSch(new UbScheduler(1, timeAvStart, timeAvStop));
-      SPtr<TimeAveragedValuesCoProcessor> tav(new TimeAveragedValuesCoProcessor(grid, pathOut, WbWriterVtkXmlBinary::getInstance(), tavSch, comm,
-         TimeAveragedValuesCoProcessor::Density | TimeAveragedValuesCoProcessor::Velocity | TimeAveragedValuesCoProcessor::Fluctuations));
-      tav->setWithGhostLayer(true);
-
-	  //set microfons
-	  SPtr<UbScheduler> stepMV(new UbScheduler(1, 0, 1000000));
-	  SPtr<MicrophoneArrayCoProcessor> micCoProcessor(new MicrophoneArrayCoProcessor(grid, stepSch, pathOut, comm));
-	  double offsetX1 = 0.017;
-	  double offsetZ1 = 0.11375;
-	  std::vector<UbTupleFloat3> nodes;
-	  for (int i = 0; i <= 10; i++)
-	  {
-		  micCoProcessor->addMicrophone(Vector3D(0.3 + deltaXcoarse + offsetX1 * double(i), 0.015, 0.0 - offsetZ1 * double(i)));
-		  nodes.push_back(UbTupleFloat3(float(0.3 + deltaXcoarse + offsetX1 * float(i)), float(0.015), float(0.0 - offsetZ1 * float(i))));
-	  }
-	  double offsetX2 = 0.1;
-	  for (int i = 0; i <= 6; i++)
-	  {
-		  micCoProcessor->addMicrophone(Vector3D(0.17 + offsetX2 * double(i), 0.015, -1.1375));
-		  nodes.push_back(UbTupleFloat3(float(0.17 + offsetX2 * float(i)), float(0.015), float(-1.1375)));
-	  }
-
-	  if (myid == 0) WbWriterVtkXmlBinary::getInstance()->writeNodes(pathOut + "/geo/mic", nodes);
-	  ///////////////////////////////////////////////////////////
-
-      //omp_set_num_threads(numOfThreads);
-      SPtr<UbScheduler> stepGhostLayer(new UbScheduler(1));
-      SPtr<Calculator> calculator(new BasicCalculator(grid, stepGhostLayer, endTime));
-      calculator->addCoProcessor(nupsCoProcessor);
-	  calculator->addCoProcessor(micCoProcessor);
-      calculator->addCoProcessor(restartCoProcessor);
-      calculator->addCoProcessor(writeMQSelectCoProcessor);
-      calculator->addCoProcessor(writeMQCoProcessor);
-      calculator->addCoProcessor(tav);
-
-      if (myid==0) UBLOG(logINFO, "Simulation-start");
-      calculator->calculate();
-      if (myid==0) UBLOG(logINFO, "Simulation-end");
-
-      if (myid==0)
-      {
-         UBLOG(logINFO, "PID = "<<myid<<" Point 10");
-         UBLOG(logINFO, "PID = "<<myid<<" Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB");
-      }
-   }
-   catch (std::exception& e)
-   {
-      cerr<<e.what()<<endl<<flush;
-   }
-   catch (std::string& s)
-   {
-      cerr<<s<<endl;
-   }
-   catch (...)
-   {
-      cerr<<"unknown exception"<<endl;
-   }
-
-}
-
-
-int main(int argc, char* argv[])
-{
-
-   if (argv!=NULL)
-   {
-      if (argv[1]!=NULL)
-      {
-         run(string(argv[1]));
-      }
-      else
-      {
-         cout<<"Configuration file must be set!: "<<argv[0]<<" <config file>"<<endl<<std::flush;
-      }
-   }
-
-   //test_run();
-
-   //SuperMUC
-   //MPI_Finalize();
-
-   return 0;
-}
-
+#include <iostream>
+#include <string>
+
+#include <PointerDefinitions.h>
+#include "VirtualFluids.h"
+#include <omp.h>
+using namespace std;
+
+
+//////////////////////////////////////////////////////////////////////////
+void initPteBlock(SPtr<Grid3D> grid, SPtr<Block3D> block)
+{
+   int gridRank = grid->getRank();
+   int blockRank = block->getRank();
+
+   if (blockRank == gridRank)
+   {
+      SPtr<ILBMKernel> kernel = block->getKernel();
+      if (!kernel)
+         throw UbException(UB_EXARGS, "The LBM kernel isn't exist in block: "+block->toString());
+
+      SPtr<BCArray3D> bcArray = kernel->getBCProcessor()->getBCArray();
+      SPtr<DistributionArray3D> distributions = kernel->getDataSet()->getFdistributions();
+
+      LBMReal f[D3Q27System::ENDF+1];
+
+      size_t nx1 = distributions->getNX1();
+      size_t nx2 = distributions->getNX2();
+      size_t nx3 = distributions->getNX3();
+
+      for (int ix3=0; ix3<bcArray->getNX3(); ix3++)
+         for (int ix2=0; ix2<bcArray->getNX2(); ix2++)
+            for (int ix1=0; ix1<bcArray->getNX1(); ix1++)
+            {
+               D3Q27System::calcCompFeq(f, 0, 0, 0, 0);
+               distributions->setDistribution(f, ix1, ix2, ix3);
+               distributions->setDistributionInv(f, ix1, ix2, ix3);
+            }
+      block->setActive(true);
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+void initPteFs(SPtr<Grid3D> grid, vector<SPtr<Block3D>>& vectorTE)
+{
+   for (SPtr<Block3D> block : vectorTE)
+   {
+      initPteBlock(grid, block);
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+
+void run(string configname)
+{
+   try
+   {
+      ConfigurationFile   config;
+      config.load(configname);
+
+      string          pathOut = config.getValue<string>("pathOut");
+      string          pathGeo = config.getValue<string>("pathGeo");
+      string          fngFileNoTapeFull = config.getValue<string>("fngFileNoTapeFull");
+      string          fngFileFull = config.getValue<string>("fngFileFull");
+      string          fngFileNoTapeBody = config.getValue<string>("fngFileNoTapeBody");
+      string          fngFileBody = config.getValue<string>("fngFileBody");
+      string          fngFileTE = config.getValue<string>("fngFileTE");
+
+      int             accuracy = config.getValue<int>("accuracy");
+      int             numOfThreads = config.getValue<int>("numOfThreads");
+      vector<int>     blockNx = config.getVector<int>("blockNx");
+      vector<double>  boundingBox = config.getVector<double>("boundingBox");
+      double          restartStep = config.getValue<double>("restartStep");
+      double          cpStart = config.getValue<double>("cpStart");
+      double          cpStep = config.getValue<double>("cpStep");
+      int             endTime = config.getValue<int>("endTime");
+      double          outTimeStep = config.getValue<double>("outTimeStep");
+      double          outTimeStart = config.getValue<double>("outTimeStart");
+      double          availMem = config.getValue<double>("availMem");
+      int             refineLevel = config.getValue<int>("refineLevel");
+      bool            logToFile = config.getValue<bool>("logToFile");
+      double          deltaXfine = config.getValue<double>("deltaXfine");
+      double          refineDistance = config.getValue<double>("refineDistance");
+      double          startDistance = config.getValue<double>("startDistance");
+      vector<double>  nupsStep = config.getVector<double>("nupsStep");
+      bool            newStart = config.getValue<bool>("newStart");
+      bool            writeBlocks = config.getValue<bool>("writeBlocks");
+
+      double          timeAvStart       = config.getValue<double>("timeAvStart");
+      double          timeAvStop        = config.getValue<double>("timeAvStop");
+
+      vector<int>     pmNX              = config.getVector<int>("pmNX");
+      double          lthreshold        = config.getValue<double>("lthreshold");
+      double          uthreshold        = config.getValue<double>("uthreshold");
+      vector<float>   voxelDeltaX       = config.getVector<float>("voxelDeltaX");
+      string          pathGeoTEvoxel    = config.getValue<string>("pathGeoTEvoxel");
+      
+
+
+      SPtr<Communicator> comm = MPICommunicator::getInstance();
+      int myid = comm->getProcessID();
+
+      if (logToFile)
+      {
+#if defined(__unix__)
+         if (myid==0)
+         {
+            const char* str = pathOut.c_str();
+            mkdir(str, S_IRWXU|S_IRWXG|S_IROTH|S_IXOTH);
+         }
+#endif 
+
+         if (myid==0)
+         {
+            stringstream logFilename;
+            logFilename<<pathOut+"/logfile"+UbSystem::toString(UbSystem::getTimeStamp())+".txt";
+            UbLog::output_policy::setStream(logFilename.str());
+         }
+      }
+
+      if (myid==0)
+      {
+         UBLOG(logINFO, "PID = "<<myid<<" Point 1");
+         UBLOG(logINFO, "PID = "<<myid<<" Total Physical Memory (RAM): "<<Utilities::getTotalPhysMem());
+         UBLOG(logINFO, "PID = "<<myid<<" Physical Memory currently used: "<<Utilities::getPhysMemUsed());
+         UBLOG(logINFO, "PID = "<<myid<<" Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB");
+      }
+
+
+      //the geometry is in mm
+
+      double g_minX1 = boundingBox[0];//*1000.0;
+      double g_minX2 = boundingBox[2];//*1000.0;
+      double g_minX3 = boundingBox[4];//*1000.0;
+      double g_maxX1 = boundingBox[1];//*1000.0;
+      double g_maxX2 = boundingBox[3];//*1000.0;
+      double g_maxX3 = boundingBox[5];//*1000.0;
+      //deltaXfine *=1000.0;
+
+      //////////////////////////////////////////////////////////////////////////
+      double deltaXcoarse = deltaXfine*(double)(1<<refineLevel);
+      //////////////////////////////////////////////////////////////////////////
+      double blockLength = (double)blockNx[0]*deltaXcoarse;
+
+      //##########################################################################
+      //## physical parameters
+      //##########################################################################
+      double Re = 1e6;
+
+      double rhoLB = 0.0;
+      double rhoReal = 1.2041; //(kg/m3)
+      //double nueReal = 153.5e-7; //m^2/s
+      double uReal = 55; //m/s
+      double lReal = 0.3;//m
+      //double uReal = Re*nueReal / lReal;
+      double nuReal = (uReal*lReal)/Re; //m^2/s
+
+      //##Machzahl:
+      //#Ma     = uReal/csReal
+      double Ma = 0.15;//Ma-Real!
+      double csReal = uReal / Ma;
+      double hLB = lReal / deltaXcoarse;
+
+      LBMUnitConverter unitConverter(lReal, csReal, rhoReal, hLB);
+
+      double uLB = uReal   * unitConverter.getFactorVelocityWToLb();
+      double nuLB = nuReal * unitConverter.getFactorViscosityWToLb();
+      double lLB = lReal/deltaXcoarse;
+      //double nuLB = (uLB*lLB)/Re; //0.005;
+      //double nuLB = 0.005;
+
+      SPtr<LBMUnitConverter> conv = SPtr<LBMUnitConverter>(new LBMUnitConverter());
+
+      const int baseLevel = 0;
+
+      ////////////////////////////////////////////////////////////////////////
+      //Grid
+      //////////////////////////////////////////////////////////////////////////
+      SPtr<Grid3D> grid(new Grid3D(comm));
+
+      //BC adapters
+      SPtr<BCAdapter> noSlipBCAdapter(new NoSlipBCAdapter());
+      noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new ThinWallNoSlipBCAlgorithm()));
+
+      //SPtr<BCAdapter> slipBCAdapter(new SlipBCAdapter());
+      //slipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new SlipBCAlgorithm()));
+
+      mu::Parser fct;
+      fct.SetExpr("U");
+      fct.DefineConst("U", uLB);
+      SPtr<BCAdapter> velBCAdapter(new VelocityBCAdapter(true, false, false, fct, 0, BCFunction::INFCONST));
+      velBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new VelocityWithDensityBCAlgorithm()));
+
+      //fct.SetExpr("U");
+      //fct.DefineConst("U", 0.01);
+      //SPtr<BCAdapter> velBCAdapterOut(new VelocityBCAdapter(true, false, false, fct, 0, BCFunction::INFCONST));
+      //velBCAdapterOut->setBcAlgorithm(SPtr<BCAlgorithm>(new VelocityBCAlgorithm()));
+
+      SPtr<BCAdapter> outflowBCAdapter(new DensityBCAdapter(rhoLB));
+      outflowBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NonReflectingOutflowBCAlgorithm()));
+
+      BoundaryConditionsBlockVisitor bcVisitor;
+      bcVisitor.addBC(noSlipBCAdapter);
+      bcVisitor.addBC(velBCAdapter);
+      bcVisitor.addBC(outflowBCAdapter);
+
+      SPtr<BCProcessor> bcProc;
+      //bcProc = SPtr<BCProcessor>(new BCProcessor());
+      bcProc = SPtr<BCProcessor>(new ThinWallBCProcessor());
+
+      SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new CompressibleCumulant4thOrderViscosityLBMKernel());
+      //t = 21.8, P = 1.0145 atm, Relative Humidity = 45.8, Second Coefficient of Viscosity = 3120
      //Ash, R. L., Zuckerwar, A. J., & Zheng, Z. (1991). Second coefficient of viscosity in air.
+      double bulckViscosity = 3120 * nuLB;
+      dynamicPointerCast<CompressibleCumulant4thOrderViscosityLBMKernel>(kernel)->setBulkViscosity(bulckViscosity);
+      kernel->setBCProcessor(bcProc);
+
+      SPtr<LBMKernel> spKernel = SPtr<LBMKernel>(new CompressibleCumulantLBMKernel());
+      spKernel->setBCProcessor(bcProc);
+      //////////////////////////////////////////////////////////////////////////
+      //restart
+      SPtr<UbScheduler> rSch(new UbScheduler(cpStep, cpStart));
+      SPtr<MPIIORestartCoProcessor> restartCoProcessor(new MPIIORestartCoProcessor(grid, rSch, pathOut, comm));
+      restartCoProcessor->setLBMKernel(kernel);
+      restartCoProcessor->setBCProcessor(bcProc);
+
+      SPtr<UbScheduler> mSch(new UbScheduler(cpStep, cpStart));
+      SPtr<MPIIOMigrationCoProcessor> migCoProcessor(new MPIIOMigrationCoProcessor(grid, mSch, pathOut+"/mig", comm));
+      migCoProcessor->setLBMKernel(kernel);
+      migCoProcessor->setBCProcessor(bcProc);
+      //////////////////////////////////////////////////////////////////////////
+
+      if (myid==0)
+      {
+         UBLOG(logINFO, "PID = "<<myid<<" Point 2");
+         UBLOG(logINFO, "PID = "<<myid<<" Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB");
+      }
+
+      if (myid==0)
+      {
+         UBLOG(logINFO, "Parameters:");
+         UBLOG(logINFO, "* Re                  = "<<Re);
+         UBLOG(logINFO, "* Ma                  = "<<Ma);
+         UBLOG(logINFO, "* velocity (uReal)    = "<<uReal<<" m/s");
+         UBLOG(logINFO, "* viscosity (nuReal)  = "<<nuReal<<" m^2/s");
+         UBLOG(logINFO, "* chord length (lReal)= "<<lReal<<" m");
+         UBLOG(logINFO, "* velocity LB (uLB)   = "<<uLB);
+         UBLOG(logINFO, "* viscosity LB (nuLB) = "<<nuLB);
+         UBLOG(logINFO, "* chord length (l_LB) = "<<lLB<<" dx_base");
+         UBLOG(logINFO, "* dx_base             = "<<deltaXcoarse<<" m");
+         UBLOG(logINFO, "* dx_refine           = "<<deltaXfine<<" m");
+         UBLOG(logINFO, "* blocknx             = "<<blockNx[0]<<"x"<<blockNx[1]<<"x"<<blockNx[2]);
+         UBLOG(logINFO, "* refineDistance      = "<<refineDistance);
+         UBLOG(logINFO, "* number of levels    = "<<refineLevel+1);
+         UBLOG(logINFO, "* number of threads   = "<<numOfThreads);
+         UBLOG(logINFO, "* number of processes = "<<comm->getNumberOfProcesses());
+         UBLOG(logINFO, "* path = "<<pathOut);
+       }
+
+      if (newStart)
+      {
+         ////////////////////////////////////////////////////////////////////////
+         //define grid
+         //////////////////////////////////////////////////////////////////////////
+         grid->setDeltaX(deltaXcoarse);
+         grid->setBlockNX(blockNx[0], blockNx[1], blockNx[2]);
+
+         SPtr<GbObject3D> gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
+         if (myid==0) GbSystem3D::writeGeoObject(gridCube.get(), pathOut+"/geo/gridCube", WbWriterVtkXmlASCII::getInstance());
+         GenBlocksGridVisitor genBlocks(gridCube);
+         grid->accept(genBlocks);
+
+         grid->setPeriodicX1(false);
+         grid->setPeriodicX2(true);
+         grid->setPeriodicX3(false);
+
+         if (myid==0)
+         {
+            UBLOG(logINFO, "Preprocessing - start");
+            UBLOG(logINFO, "PID = "<<myid<<" Point 3");
+            UBLOG(logINFO, "PID = "<<myid<<" Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB");
+         }
+         //////////////////////////////////////////////////////////////////////////
+
+
+         //voxelMatrixTransformation(pmNX, lthreshold, uthreshold, voxelDeltaX, pathGeoTEvoxel, pathOut, comm);
+
+         //return;
+
+
+         SPtr<GbTriFaceMesh3D> fngMeshTE;
+         if (myid==0) UBLOG(logINFO, "Read fngMeshTE:start");
+         fngMeshTE = SPtr<GbTriFaceMesh3D>(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile2(pathGeo+"/"+fngFileTE, "fngMeshTE", GbTriFaceMesh3D::KDTREE_SAHPLIT, false));
+         if (myid==0) UBLOG(logINFO, "Read fngMeshTE:end");
+         fngMeshTE->rotate(0.0, 0.5, 0.0);
+         fngMeshTE->translate(0.0, 0.0, 0.0012 - 0.0000192);
+         if (myid==0) GbSystem3D::writeGeoObject(fngMeshTE.get(), pathOut+"/geo/fngMeshTE", WbWriterVtkXmlBinary::getInstance());
+
+         SPtr<Interactor3D> fngIntrTE = SPtr<D3Q27TriFaceMeshInteractor>(new D3Q27TriFaceMeshInteractor(fngMeshTE, grid, noSlipBCAdapter, Interactor3D::SOLID, (Interactor3D::Accuracy)accuracy));
+
+         double zTranslate = -0.0001308;
+
+         if (refineLevel>0 && myid==0 && writeBlocks)
+         {
+            if (myid==0) UBLOG(logINFO, "Refinement - start");
+            int rank = grid->getRank();
+            grid->setRank(0);
+
+            SPtr<GbTriFaceMesh3D> fngMeshNoTapeFull;
+            if (myid==0) UBLOG(logINFO, "Read fngFileNoTapeFull:start");
+            fngMeshNoTapeFull = SPtr<GbTriFaceMesh3D>(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile2(pathGeo+"/"+fngFileNoTapeFull, "fngMeshNoTapeBody", GbTriFaceMesh3D::KDTREE_SAHPLIT, false));
+            if (myid==0) UBLOG(logINFO, "Read fngFileNoTapeFull:end");
+            fngMeshNoTapeFull->rotate(0.0, 0.5, 0.0);
+            if (myid==0) GbSystem3D::writeGeoObject(fngMeshNoTapeFull.get(), pathOut+"/geo/fngMeshNoTapeFull", WbWriterVtkXmlBinary::getInstance());
+
+            SPtr<Interactor3D> fngIntrNoTapeFull = SPtr<D3Q27TriFaceMeshInteractor>(new D3Q27TriFaceMeshInteractor(fngMeshNoTapeFull, grid, noSlipBCAdapter, Interactor3D::SOLID, (Interactor3D::Accuracy)accuracy));
+
+            int level;
+
+			level = 1;
+			if (refineLevel - level >= 0)
+			{
+				dynamicPointerCast<D3Q27TriFaceMeshInteractor>(fngIntrNoTapeFull)->refineBlockGridToLevel(level, startDistance, refineDistance);
+			}
+
+            level = 2;
+			if (refineLevel - level >= 0)
+			{
+				dynamicPointerCast<D3Q27TriFaceMeshInteractor>(fngIntrNoTapeFull)->refineBlockGridToLevel(level, startDistance, refineDistance);
+			}
+
+            level = 3;
+            if (refineLevel - level >= 0)
+            {
+               dynamicPointerCast<D3Q27TriFaceMeshInteractor>(fngIntrNoTapeFull)->refineBlockGridToLevel(level, startDistance, 24.0*refineDistance);
+            }
+
+            level = 4;
+            if (refineLevel - level >= 0)
+            {
+               dynamicPointerCast<D3Q27TriFaceMeshInteractor>(fngIntrNoTapeFull)->refineBlockGridToLevel(level, startDistance, 12.0*refineDistance);
+            }
+
+            level = 5;
+            if (refineLevel - level >= 0)
+            {
+               dynamicPointerCast<D3Q27TriFaceMeshInteractor>(fngIntrNoTapeFull)->refineBlockGridToLevel(level, startDistance, 6.0*refineDistance);
+            }
+
+            level = 6;
+            if (refineLevel - level >= 0)
+            {
+               dynamicPointerCast<D3Q27TriFaceMeshInteractor>(fngIntrNoTapeFull)->refineBlockGridToLevel(level, startDistance, 3.0*refineDistance);
+               RefineCrossAndInsideGbObjectBlockVisitor refVisitorTE(fngMeshTE, level);
+               grid->accept(refVisitorTE);
+            }
+
+            ///////delete solid blocks
+            if (myid==0) UBLOG(logINFO, "deleteSolidBlocks - start");
+
+            SPtr<GbTriFaceMesh3D> fngMeshNoTapeBody;
+            if (myid==0) UBLOG(logINFO, "Read fngFileNoTapeBody:start");
+            fngMeshNoTapeBody = SPtr<GbTriFaceMesh3D>(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile2(pathGeo+"/"+fngFileNoTapeBody, "fngMeshNoTapeBody", GbTriFaceMesh3D::KDTREE_SAHPLIT, false));
+            if (myid==0) UBLOG(logINFO, "Read fngFileNoTapeBody:end");
+            fngMeshNoTapeBody->rotate(0.0, 0.5, 0.0);
+            fngMeshNoTapeBody->translate(0.0, 0.0, zTranslate);
+            //fngMeshNoTapeBody->translate(0.0, 0.0, -0.00011);
+            
+            if (myid==0) GbSystem3D::writeGeoObject(fngMeshNoTapeBody.get(), pathOut+"/geo/fngMeshNoTapeBody", WbWriterVtkXmlBinary::getInstance());
+
+            SPtr<Interactor3D> fngIntrNoTapeBody = SPtr<D3Q27TriFaceMeshInteractor>(new D3Q27TriFaceMeshInteractor(fngMeshNoTapeBody, grid, noSlipBCAdapter, Interactor3D::SOLID, (Interactor3D::Accuracy)accuracy));//, Interactor3D::POINTS));
+
+            SetSolidBlocksBlockVisitor v(fngIntrNoTapeBody);
+            grid->accept(v);
+            std::vector<SPtr<Block3D>>& sb = fngIntrNoTapeBody->getSolidBlockSet();
+            for (SPtr<Block3D> block : sb)
+            {
+               grid->deleteBlock(block);
+            }
+            fngIntrNoTapeBody->removeSolidBlocks();
+            fngIntrNoTapeBody->removeBcBlocks();
+
+
+            if (myid==0) UBLOG(logINFO, "deleteSolidBlocks - end");
+            //////////////////////////////////////////
+
+            {
+               WriteBlocksCoProcessor ppblocks(grid, SPtr<UbScheduler>(new UbScheduler(1)), pathOut, WbWriterVtkXmlBinary::getInstance(), comm);
+               ppblocks.process(0);
+            }
+
+            grid->setRank(rank);
+
+            RatioBlockVisitor ratioVisitor(refineLevel);
+            CheckRatioBlockVisitor checkRatio(refineLevel);
+            int count = 0;
+
+            do {
+               if (myid==0) UBLOG(logINFO, "ratioVisitor - start");
+               grid->accept(ratioVisitor);
+               if (myid==0) UBLOG(logINFO, "ratioVisitor - end");
+               if (myid==0) UBLOG(logINFO, "checkRatio - start");
+               checkRatio.resetState();
+               grid->accept(checkRatio);
+               if (myid==0) UBLOG(logINFO, "checkRatio - end");
+               if (myid==0) UBLOG(logINFO, "count = "<<count++<<" state = "<<checkRatio.getState());
+            } while (!checkRatio.getState());
+
+
+            {
+               WriteBlocksCoProcessor ppblocks(grid, SPtr<UbScheduler>(new UbScheduler(1)), pathOut, WbWriterVtkXmlBinary::getInstance(), comm);
+               ppblocks.process(1);
+            }
+
+            OverlapBlockVisitor overlapVisitor(refineLevel, false);
+            grid->accept(overlapVisitor);
+
+            if (myid==0) UBLOG(logINFO, "Refinement - end");
+         }
+         else if (refineLevel>0 && !writeBlocks)
+         {
+            migCoProcessor->readBlocks(0);
+         }
+         grid->updateDistributedBlocks(comm);
+
+         std::vector<int> dirs;
+         for (int i = D3Q27System::E; i<=D3Q27System::TS; i++)
+         {
+            dirs.push_back(i);
+         }
+         SetInterpolationDirsBlockVisitor interDirsVisitor(dirs);
+         grid->accept(interDirsVisitor);
+
+         //walls
+         GbCuboid3DPtr addWallZmin(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_minX3));
+         if (myid==0) GbSystem3D::writeGeoObject(addWallZmin.get(), pathOut+"/geo/addWallZmin", WbWriterVtkXmlASCII::getInstance());
+
+         GbCuboid3DPtr addWallZmax(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_maxX3, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength));
+         if (myid==0) GbSystem3D::writeGeoObject(addWallZmax.get(), pathOut+"/geo/addWallZmax", WbWriterVtkXmlASCII::getInstance());
+
+         //wall interactors
+         SPtr<D3Q27Interactor> addWallZminInt(new D3Q27Interactor(addWallZmin, grid, velBCAdapter, Interactor3D::SOLID));
+         SPtr<D3Q27Interactor> addWallZmaxInt(new D3Q27Interactor(addWallZmax, grid, velBCAdapter, Interactor3D::SOLID));
+
+         //inflow
+         GbCuboid3DPtr geoInflow(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3-blockLength, g_minX1, g_maxX2+blockLength, g_maxX3+blockLength));
+         if (myid==0) GbSystem3D::writeGeoObject(geoInflow.get(), pathOut+"/geo/geoInflow", WbWriterVtkXmlASCII::getInstance());
+
+         //outflow
+         GbCuboid3DPtr geoOutflow(new GbCuboid3D(g_maxX1, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength));
+         if (myid==0) GbSystem3D::writeGeoObject(geoOutflow.get(), pathOut+"/geo/geoOutflow", WbWriterVtkXmlASCII::getInstance());
+
+         //inflow
+         SPtr<D3Q27Interactor> inflowIntr = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoInflow, grid, velBCAdapter, Interactor3D::SOLID));
+
+         //outflow
+         SPtr<D3Q27Interactor> outflowIntr = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoOutflow, grid, outflowBCAdapter, Interactor3D::SOLID));
+
+         //airfoil
+         SPtr<GbTriFaceMesh3D> fngMeshBody;
+         if (myid==0) UBLOG(logINFO, "Read fngFileBody:start");
+         fngMeshBody = SPtr<GbTriFaceMesh3D>(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile2(pathGeo+"/"+fngFileBody, "fngMeshBody", GbTriFaceMesh3D::KDTREE_SAHPLIT, false));
+         if (myid==0) UBLOG(logINFO, "Read fngFileBody:end");
+         fngMeshBody->rotate(0.0, 0.5, 0.0);
+         //fngMeshBody->translate(0.0, 0.0, -0.00011);
+         fngMeshBody->translate(0.0, 0.0, zTranslate);
+         if (myid==0) GbSystem3D::writeGeoObject(fngMeshBody.get(), pathOut+"/geo/fngMeshBody", WbWriterVtkXmlBinary::getInstance());
+
+         SPtr<Interactor3D> fngIntrBody = SPtr<D3Q27TriFaceMeshInteractor>(new D3Q27TriFaceMeshInteractor(fngMeshBody, grid, noSlipBCAdapter, Interactor3D::SOLID, (Interactor3D::Accuracy)accuracy));
+         fngMeshBody.reset();
+
+         GbCuboid3DPtr geoAddWallP(new GbCuboid3D(0.269, g_minX2-blockLength, 0.0016, 0.27028, g_maxX2+blockLength, 0.0076));
+         if (myid==0) GbSystem3D::writeGeoObject(geoAddWallP.get(), pathOut+"/geo/geoAddWallP", WbWriterVtkXmlASCII::getInstance());
+         SPtr<D3Q27Interactor> addWallPIntr = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoAddWallP, grid, noSlipBCAdapter, Interactor3D::SOLID));
+
+         //////////////////////////////////////////////////////////////////////////
+         vector<double> origin(3);
+         origin[0] = 0;
+         origin[1] = 0;
+         origin[2] = 0;
+
+         double vmZtranslate = 0.0042 - 0.007587;
+
+         SPtr<GbVoxelMatrix3D> voxelMatrix1(new GbVoxelMatrix3D(pmNX[0], pmNX[1], pmNX[2], 0, lthreshold, uthreshold));
+         voxelMatrix1->readMatrixFromRawFile<unsigned short>(pathGeoTEvoxel, GbVoxelMatrix3D::BigEndian);
+         voxelMatrix1->setVoxelMatrixDelta(voxelDeltaX[0], voxelDeltaX[1], voxelDeltaX[2]);
+         voxelMatrix1->setVoxelMatrixMininum(origin[0], origin[1], origin[2]);
+
+         voxelMatrix1->rotate90aroundZ();
+         voxelMatrix1->rotate90aroundZ();
+         voxelMatrix1->rotate90aroundZ();
+         voxelMatrix1->rotate90aroundX();
+         voxelMatrix1->translate(0.2813, 0, vmZtranslate);
+         double offset = ((g_maxX2-g_minX2)/2.0 - voxelMatrix1->getLengthX2())/2.0;
+         voxelMatrix1->setVoxelMatrixMinX2(g_minX2+offset);
+
+         if (myid==0) voxelMatrix1->writeToVTKImageDataAppended(pathOut+"/geo/fngTEvoxel1");
+
+         SPtr<D3Q27Interactor> fngIntrTEvoxel1 = SPtr<D3Q27Interactor>(new D3Q27Interactor(voxelMatrix1, grid, noSlipBCAdapter, Interactor3D::SOLID));
+
+         SPtr<GbVoxelMatrix3D> voxelMatrix2(new GbVoxelMatrix3D(pmNX[0], pmNX[1], pmNX[2], 0, lthreshold, uthreshold));
+         voxelMatrix2->readMatrixFromRawFile<unsigned short>(pathGeoTEvoxel, GbVoxelMatrix3D::BigEndian);
+         voxelMatrix2->setVoxelMatrixDelta(voxelDeltaX[0], voxelDeltaX[1], voxelDeltaX[2]);
+         voxelMatrix2->setVoxelMatrixMininum(origin[0], origin[1], origin[2]);
+
+         voxelMatrix2->rotate90aroundZ();
+         voxelMatrix2->rotate90aroundZ();
+         voxelMatrix2->rotate90aroundZ();
+         voxelMatrix2->rotate90aroundX();
+         voxelMatrix2->translate(0.2813, 0, vmZtranslate);
+         voxelMatrix2->mirrorY();
+         voxelMatrix2->setVoxelMatrixMinX2(voxelMatrix1->getX2Maximum());
+
+         if (myid==0) voxelMatrix2->writeToVTKImageDataAppended(pathOut+"/geo/fngTEvoxel2");
+
+         SPtr<D3Q27Interactor> fngIntrTEvoxel2 = SPtr<D3Q27Interactor>(new D3Q27Interactor(voxelMatrix2, grid, noSlipBCAdapter, Interactor3D::SOLID));
+         //////////////////////////////////////////////////////////////////////////
+
+         ////////////////////////////////////////////
+         //METIS
+         SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::BSW, MetisPartitioner::KWAY));
+         ////////////////////////////////////////////
+         /////delete solid blocks
+         if (myid==0) UBLOG(logINFO, "deleteSolidBlocks - start");
+         InteractorsHelper intHelper(grid, metisVisitor);
+         intHelper.addInteractor(inflowIntr);
+         intHelper.addInteractor(outflowIntr);
+         intHelper.addInteractor(addWallZminInt);
+         intHelper.addInteractor(addWallZmaxInt);
+         intHelper.addInteractor(fngIntrBody);
+         intHelper.addInteractor(addWallPIntr);
+         intHelper.addInteractor(fngIntrTEvoxel1);
+         intHelper.addInteractor(fngIntrTEvoxel2);
+         intHelper.selectBlocks();
+
+         if (myid==0) UBLOG(logINFO, "deleteSolidBlocks - end");
+
+         if (myid==0)
+         {
+            UBLOG(logINFO, "PID = "<<myid<<" Point 4");
+            UBLOG(logINFO, "PID = "<<myid<<" Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB");
+         }
+         //////////////////////////////////////
+
+         unsigned long long numberOfBlocks = (unsigned long long)grid->getNumberOfBlocks();
+         int ghostLayer = 3;
+         unsigned long long numberOfNodesPerBlock = (unsigned long long)(blockNx[0])* (unsigned long long)(blockNx[1])* (unsigned long long)(blockNx[2]);
+         unsigned long long numberOfNodes = numberOfBlocks * numberOfNodesPerBlock;
+         unsigned long long numberOfNodesPerBlockWithGhostLayer = numberOfBlocks * (blockNx[0]+ghostLayer) * (blockNx[1]+ghostLayer) * (blockNx[2]+ghostLayer);
+         double needMemAll = double(numberOfNodesPerBlockWithGhostLayer*(27*sizeof(double)+sizeof(int)+sizeof(float)*4));
+         double needMem = needMemAll/double(comm->getNumberOfProcesses());
+
+         if (myid==0)
+         {
+            UBLOG(logINFO, "Number of blocks = "<<numberOfBlocks);
+            UBLOG(logINFO, "Number of nodes  = "<<numberOfNodes);
+            int minInitLevel = grid->getCoarsestInitializedLevel();
+            int maxInitLevel = grid->getFinestInitializedLevel();
+            for (int level = minInitLevel; level<=maxInitLevel; level++)
+            {
+               int nobl = grid->getNumberOfBlocks(level);
+               UBLOG(logINFO, "Number of blocks for level "<<level<<" = "<<nobl);
+               UBLOG(logINFO, "Number of nodes for level "<<level<<" = "<<nobl*numberOfNodesPerBlock);
+            }
+            UBLOG(logINFO, "Necessary memory  = "<<needMemAll<<" bytes");
+            UBLOG(logINFO, "Necessary memory per process = "<<needMem<<" bytes");
+            UBLOG(logINFO, "Available memory per process = "<<availMem<<" bytes");
+         }
+
+         if (writeBlocks)
+         {
+            migCoProcessor->writeBlocks(0);
+         }
+
+         {
+            WriteBlocksCoProcessor ppblocks(grid, SPtr<UbScheduler>(new UbScheduler(1)), pathOut, WbWriterVtkXmlBinary::getInstance(), comm);
+            ppblocks.process(2);
+         }
+
+         SetKernelBlockVisitor kernelVisitor(kernel, nuLB, availMem, needMem);
+         grid->accept(kernelVisitor);
+
+         if (myid==0) UBLOG(logINFO, "SetKernelBlockVisitor:end");
+
+         if (myid==0)
+         {
+            UBLOG(logINFO, "PID = "<<myid<<" Point 5");
+            UBLOG(logINFO, "PID = "<<myid<<" Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB");
+         }
+
+         if (refineLevel>0)
+         {
+            SetUndefinedNodesBlockVisitor undefNodesVisitor;
+            grid->accept(undefNodesVisitor);
+         }
+
+         if (myid==0) UBLOG(logINFO, "SetUndefinedNodesBlockVisitor:end");
+
+         //BC
+         intHelper.setBC();
+
+         if (myid==0) UBLOG(logINFO, "intHelper.setBC():end");
+         if (myid==0) UBLOG(logINFO, "PID = "<<myid<<" Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB");
+
+         if (myid==0) UBLOG(logINFO, "vectorTE:start");
+         SetSolidBlocksBlockVisitor v1(fngIntrTE);
+         grid->accept(v1);
+         SetBcBlocksBlockVisitor v2(fngIntrTE);
+         grid->accept(v2);
+         std::vector<SPtr<Block3D>>& vectorTE = fngIntrTE->getSolidBlockSet();
+         std::vector<SPtr<Block3D>>& bb = fngIntrTE->getBcBlocks();
+         vectorTE.insert(vectorTE.end(), bb.begin(), bb.end());
+         if (myid==0) UBLOG(logINFO, "vectorTE:end");
+
+         if (myid==0)
+         {
+            UBLOG(logINFO, "PID = "<<myid<<" Point 6");
+            UBLOG(logINFO, "PID = "<<myid<<" Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB");
+         }
+
+         //initialization of distributions
+         InitDistributionsBlockVisitor initVisitor;
+         initVisitor.setVx1(fct);
+         grid->accept(initVisitor);
+
+         initPteFs(grid, vectorTE);
+
+         if (myid==0)
+         {
+            UBLOG(logINFO, "PID = "<<myid<<" Point 7");
+            UBLOG(logINFO, "PID = "<<myid<<" Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB");
+         }
+
+         //Post process
+         {
+            SPtr<UbScheduler> geoSch(new UbScheduler(1));
+            WriteBoundaryConditionsCoProcessor ppgeo(grid, geoSch, pathOut, WbWriterVtkXmlBinary::getInstance(), comm);
+            ppgeo.process(0);
+         }
+
+         if (myid==0)
+         {
+            UBLOG(logINFO, "PID = "<<myid<<" Point 8");
+            UBLOG(logINFO, "PID = "<<myid<<" Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB");
+         }
+
+         /////////////////////////////////////////////////////////////////////////////
+         if (myid==0) UBLOG(logINFO, "Preprozess - end");
+      }
+      else
+      {
+         //restartCoProcessor->restart((int)restartStep);
+         migCoProcessor->restart((int)restartStep);
+         grid->setTimeStep(restartStep);
+
+         WriteBlocksCoProcessor ppblocks(grid, SPtr<UbScheduler>(new UbScheduler(1)), pathOut, WbWriterVtkXmlBinary::getInstance(), comm);
+         ppblocks.process(3);
+         ////////////////////////////////////////////////////////////////////////////
+      }
+      ////set connectors
+      SPtr<InterpolationProcessor> iProcessor(new CompressibleOffsetMomentsInterpolationProcessor());
+      dynamicPointerCast<CompressibleOffsetMomentsInterpolationProcessor>(iProcessor)->setBulkViscosity(nuLB, bulckViscosity);
+      SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
+      grid->accept(setConnsVisitor);
+
+      //bcVisitor should be accept after initialization!!!!
+      grid->accept(bcVisitor);
+      if (myid == 0) UBLOG(logINFO, "grid->accept(bcVisitor):end");
+
+      ////sponge layer
+      GbCuboid3DPtr spongeLayerX1max(new GbCuboid3D(g_maxX1 - 0.35, g_minX2 - blockLength, g_minX3 - blockLength, g_maxX1 + blockLength, g_maxX2 + blockLength, g_maxX3 + blockLength));
+      if (myid == 0) GbSystem3D::writeGeoObject(spongeLayerX1max.get(), pathOut + "/geo/spongeLayerX1max", WbWriterVtkXmlASCII::getInstance());
+      SpongeLayerBlockVisitor slVisitorX1max(spongeLayerX1max, spKernel, nuLB, D3Q27System::E);
+      grid->accept(slVisitorX1max);
+
+      SPtr<UbScheduler> nupsSch(new UbScheduler(nupsStep[0], nupsStep[1], nupsStep[2]));
+      std::shared_ptr<NUPSCounterCoProcessor> nupsCoProcessor(new NUPSCounterCoProcessor(grid, nupsSch, numOfThreads, comm));
+
+      SPtr<UbScheduler> stepSch(new UbScheduler(outTimeStep, outTimeStart));
+
+      if (myid==0)
+      {
+         UBLOG(logINFO, "PID = "<<myid<<" Point 9");
+         UBLOG(logINFO, "PID = "<<myid<<" Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB");
+      }
+
+      SPtr<WriteMacroscopicQuantitiesCoProcessor> writeMQCoProcessor(new WriteMacroscopicQuantitiesCoProcessor(grid, stepSch, pathOut, WbWriterVtkXmlBinary::getInstance(), conv, comm));
+
+      SPtr<GbObject3D> bbBox(new GbCuboid3D(g_minX1-blockLength, (g_maxX2-g_minX2)/2.0, g_minX3-blockLength, g_maxX1+blockLength, (g_maxX2-g_minX2)/2.0+deltaXcoarse, g_maxX3+blockLength));
+      if (myid==0) GbSystem3D::writeGeoObject(bbBox.get(), pathOut+"/geo/bbBox", WbWriterVtkXmlASCII::getInstance());
+      SPtr<WriteMQFromSelectionCoProcessor> writeMQSelectCoProcessor(new WriteMQFromSelectionCoProcessor(grid, stepSch, bbBox, pathOut, WbWriterVtkXmlBinary::getInstance(), conv, comm));
+
+      SPtr<UbScheduler> tavSch(new UbScheduler(1, timeAvStart, timeAvStop));
+      SPtr<TimeAveragedValuesCoProcessor> tav(new TimeAveragedValuesCoProcessor(grid, pathOut, WbWriterVtkXmlBinary::getInstance(), tavSch, comm,
+         TimeAveragedValuesCoProcessor::Density | TimeAveragedValuesCoProcessor::Velocity | TimeAveragedValuesCoProcessor::Fluctuations));
+      tav->setWithGhostLayer(true);
+
+	  //set microfons
+	  SPtr<UbScheduler> stepMV(new UbScheduler(1, 0, 1000000));
+	  SPtr<MicrophoneArrayCoProcessor> micCoProcessor(new MicrophoneArrayCoProcessor(grid, stepSch, pathOut, comm));
+	  double offsetX1 = 0.017;
+	  double offsetZ1 = 0.11375;
+	  std::vector<UbTupleFloat3> nodes;
+	  for (int i = 0; i <= 10; i++)
+	  {
+		  micCoProcessor->addMicrophone(Vector3D(0.3 + deltaXcoarse + offsetX1 * double(i), 0.015, 0.0 - offsetZ1 * double(i)));
+		  nodes.push_back(UbTupleFloat3(float(0.3 + deltaXcoarse + offsetX1 * float(i)), float(0.015), float(0.0 - offsetZ1 * float(i))));
+	  }
+	  double offsetX2 = 0.1;
+	  for (int i = 0; i <= 6; i++)
+	  {
+		  micCoProcessor->addMicrophone(Vector3D(0.17 + offsetX2 * double(i), 0.015, -1.1375));
+		  nodes.push_back(UbTupleFloat3(float(0.17 + offsetX2 * float(i)), float(0.015), float(-1.1375)));
+	  }
+
+	  if (myid == 0) WbWriterVtkXmlBinary::getInstance()->writeNodes(pathOut + "/geo/mic", nodes);
+	  ///////////////////////////////////////////////////////////
+
+      //omp_set_num_threads(numOfThreads);
+      SPtr<UbScheduler> stepGhostLayer(new UbScheduler(1));
+      SPtr<Calculator> calculator(new BasicCalculator(grid, stepGhostLayer, endTime));
+      calculator->addCoProcessor(nupsCoProcessor);
+	  calculator->addCoProcessor(micCoProcessor);
+      calculator->addCoProcessor(restartCoProcessor);
+      calculator->addCoProcessor(writeMQSelectCoProcessor);
+      calculator->addCoProcessor(writeMQCoProcessor);
+      calculator->addCoProcessor(tav);
+
+      if (myid==0) UBLOG(logINFO, "Simulation-start");
+      calculator->calculate();
+      if (myid==0) UBLOG(logINFO, "Simulation-end");
+
+      if (myid==0)
+      {
+         UBLOG(logINFO, "PID = "<<myid<<" Point 10");
+         UBLOG(logINFO, "PID = "<<myid<<" Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB");
+      }
+   }
+   catch (std::exception& e)
+   {
+      cerr<<e.what()<<endl<<flush;
+   }
+   catch (std::string& s)
+   {
+      cerr<<s<<endl;
+   }
+   catch (...)
+   {
+      cerr<<"unknown exception"<<endl;
+   }
+
+}
+
+
+int main(int argc, char* argv[])
+{
+
+   if (argv!=NULL)
+   {
+      if (argv[1]!=NULL)
+      {
+         run(string(argv[1]));
+      }
+      else
+      {
+         cout<<"Configuration file must be set!: "<<argv[0]<<" <config file>"<<endl<<std::flush;
+      }
+   }
+
+   //test_run();
+
+   //SuperMUC
+   //MPI_Finalize();
+
+   return 0;
+}
+
diff --git a/apps/cpu/DLR-F16-Solid/f16.cpp b/apps/cpu/DLR-F16-Solid/f16.cpp
index 321793153557256f208e8d98a1f739e58a800604..99983c3c3fd4171e1feb0ea5635805e019a25d44 100644
--- a/apps/cpu/DLR-F16-Solid/f16.cpp
+++ b/apps/cpu/DLR-F16-Solid/f16.cpp
@@ -1,754 +1,754 @@
-#include <iostream>
-#include <string>
-
-#include <PointerDefinitions.h>
-#include "VirtualFluids.h"
-#include <omp.h>
-using namespace std;
-
-void run(string configname)
-{
-   try
-   {
-      ConfigurationFile   config;
-      config.load(configname);
-
-      string          pathOut = config.getValue<string>("pathOut");
-      string          pathGeo = config.getValue<string>("pathGeo");
-      string          fngFileWhole1 = config.getValue<string>("fngFileWhole1");
-      string          fngFileWhole2 = config.getValue<string>("fngFileWhole2");
-      //string          tapeFile = config.getValue<string>("tapeFile");
-      int             accuracy = config.getValue<int>("accuracy");
-      int             numOfThreads = config.getValue<int>("numOfThreads");
-      vector<int>     blockNx = config.getVector<int>("blockNx");
-      vector<double>  boundingBox = config.getVector<double>("boundingBox");
-      double          restartStep = config.getValue<double>("restartStep");
-      double          cpStart = config.getValue<double>("cpStart");
-      double          cpStep = config.getValue<double>("cpStep");
-      int             endTime = config.getValue<int>("endTime");
-      double          outTimeStep = config.getValue<double>("outTimeStep");
-      double          outTimeStart = config.getValue<double>("outTimeStart");
-      double          availMem = config.getValue<double>("availMem");
-      int             refineLevel = config.getValue<int>("refineLevel");
-      bool            logToFile = config.getValue<bool>("logToFile");
-      double          deltaXfine = config.getValue<double>("deltaXfine");
-      double          refineDistance = config.getValue<double>("refineDistance");
-      double          startDistance = config.getValue<double>("startDistance");
-      vector<double>  nupsStep = config.getVector<double>("nupsStep");
-      bool            newStart = config.getValue<bool>("newStart");
-      bool            writeBlocks = config.getValue<bool>("writeBlocks");
-      //string          pathReInit = config.getValue<string>("pathReInit");
-      //int             stepReInit = config.getValue<int>("stepReInit");
-      //bool            reinit = config.getValue<bool>("reinit");
-
-      //double          pcpStart = config.getValue<double>("pcpStart");
-      //double          pcpStop  = config.getValue<double>("pcpStop");
-
-      double          timeAvStart       = config.getValue<double>("timeAvStart");
-      double          timeAvStop        = config.getValue<double>("timeAvStop");
-
-      SPtr<Communicator> comm = MPICommunicator::getInstance();
-      int myid = comm->getProcessID();
-
-      if (logToFile)
-      {
-#if defined(__unix__)
-         if (myid==0)
-         {
-            const char* str = pathOut.c_str();
-            mkdir(str, S_IRWXU|S_IRWXG|S_IROTH|S_IXOTH);
-         }
-#endif 
-
-         if (myid==0)
-         {
-            stringstream logFilename;
-            logFilename<<pathOut+"/logfile"+UbSystem::toString(UbSystem::getTimeStamp())+".txt";
-            UbLog::output_policy::setStream(logFilename.str());
-         }
-      }
-
-      if (myid==0)
-      {
-         UBLOG(logINFO, "PID = "<<myid<<" Point 1");
-         UBLOG(logINFO, "PID = "<<myid<<" Total Physical Memory (RAM): "<<Utilities::getTotalPhysMem());
-         UBLOG(logINFO, "PID = "<<myid<<" Physical Memory currently used: "<<Utilities::getPhysMemUsed());
-         UBLOG(logINFO, "PID = "<<myid<<" Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB");
-      }
-
-
-      //the geometry is in mm
-
-      double g_minX1 = boundingBox[0];//*1000.0;
-      double g_minX2 = boundingBox[2];//*1000.0;
-      double g_minX3 = boundingBox[4];//*1000.0;
-      double g_maxX1 = boundingBox[1];//*1000.0;
-      double g_maxX2 = boundingBox[3];//*1000.0;
-      double g_maxX3 = boundingBox[5];//*1000.0;
-      //deltaXfine *=1000.0;
-
-      //////////////////////////////////////////////////////////////////////////
-      double deltaXcoarse = deltaXfine*(double)(1<<refineLevel);
-      //////////////////////////////////////////////////////////////////////////
-      double blockLength = (double)blockNx[0]*deltaXcoarse;
-
-      //##########################################################################
-      //## physical parameters
-      //##########################################################################
-      double Re = 1e6;
-
-      double rhoLB = 0.0;
-      double rhoReal = 1.2041; //(kg/m3)
-      //double nueReal = 153.5e-7; //m^2/s
-      double uReal = 50; //m/s
-      double lReal = 0.3;//m
-      //double uReal = Re*nueReal / lReal;
-      double nuReal = (uReal*lReal)/Re; //m^2/s
-
-      //##Machzahl:
-      //#Ma     = uReal/csReal
-      double Ma = 0.15;//Ma-Real!
-      double csReal = uReal / Ma;
-      double hLB = lReal / deltaXcoarse;
-
-      LBMUnitConverter unitConverter(lReal, csReal, rhoReal, hLB);
-
-      double uLB = uReal   * unitConverter.getFactorVelocityWToLb();
-      double nuLB = nuReal * unitConverter.getFactorViscosityWToLb();
-      double lLB = lReal/deltaXcoarse;
-      //double nuLB = (uLB*lLB)/Re; //0.005;
-      //double nuLB = 0.005;
-
-      if (myid==0) UBLOG(logINFO, unitConverter.toString());
-     
-
-      SPtr<LBMUnitConverter> conv = SPtr<LBMUnitConverter>(new LBMUnitConverter());
-
-      const int baseLevel = 0;
-
-      //SPtr<GbObject3D> mic6(new GbCuboid3D(0.3, 0.015, -0.46+4.25*deltaXcoarse, 0.3+deltaXcoarse, 0.015+deltaXcoarse, -0.46+5.25*deltaXcoarse));
-      //if (myid==0) GbSystem3D::writeGeoObject(mic6.get(), pathOut+"/geo/mic6", WbWriterVtkXmlBinary::getInstance());
-
-      //GbCuboid3DPtr spongeLayerX1max(new GbCuboid3D(g_maxX1-0.35, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength));
-      //if (myid==0) GbSystem3D::writeGeoObject(spongeLayerX1max.get(), pathOut+"/geo/spongeLayerX1max", WbWriterVtkXmlASCII::getInstance());
-      //return;
-
-
-      ////////////////////////////////////////////////////////////////////////
-      //Grid
-      //////////////////////////////////////////////////////////////////////////
-      SPtr<Grid3D> grid(new Grid3D(comm));
-
-      //BC adapters
-      SPtr<BCAdapter> noSlipBCAdapter(new NoSlipBCAdapter());
-      noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NoSlipBCAlgorithm()));
-
-      SPtr<BCAdapter> slipBCAdapter(new SlipBCAdapter());
-      slipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new SlipBCAlgorithm()));
-
-      mu::Parser fct;
-      fct.SetExpr("U");
-      fct.DefineConst("U", uLB);
-      SPtr<BCAdapter> velBCAdapter(new VelocityBCAdapter(true, false, false, fct, 0, BCFunction::INFCONST));
-      velBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new VelocityWithDensityBCAlgorithm()));
-
-      //fct.SetExpr("U");
-      //fct.DefineConst("U", 0.01);
-      //SPtr<BCAdapter> velBCAdapterOut(new VelocityBCAdapter(true, false, false, fct, 0, BCFunction::INFCONST));
-      //velBCAdapterOut->setBcAlgorithm(SPtr<BCAlgorithm>(new VelocityBCAlgorithm()));
-
-      SPtr<BCAdapter> outflowBCAdapter(new DensityBCAdapter(rhoLB));
-      outflowBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NonReflectingOutflowBCAlgorithm()));
-
-      BoundaryConditionsBlockVisitor bcVisitor;
-      bcVisitor.addBC(noSlipBCAdapter);
-      bcVisitor.addBC(velBCAdapter);
-      bcVisitor.addBC(outflowBCAdapter);
-
-      SPtr<BCProcessor> bcProc;
-      bcProc = SPtr<BCProcessor>(new BCProcessor());
-
-      SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new CompressibleCumulant4thOrderViscosityLBMKernel());
-      //t = 21.8, P = 1.0145 atm, Relative Humidity = 45.8, Second Coefficient of Viscosity = 3120
      //Ash, R. L., Zuckerwar, A. J., & Zheng, Z. (1991). Second coefficient of viscosity in air.
-      double bulckViscosity = 3120 * nuLB;
-      dynamicPointerCast<CompressibleCumulant4thOrderViscosityLBMKernel>(kernel)->setBulkViscosity(bulckViscosity);
-
-      kernel->setBCProcessor(bcProc);
-
-      SPtr<LBMKernel> spKernel = SPtr<LBMKernel>(new CompressibleCumulantLBMKernel());
-      spKernel->setBCProcessor(bcProc);
-      //////////////////////////////////////////////////////////////////////////
-      //restart
-      //SPtr<UbScheduler> rSch(new UbScheduler(cpStep, cpStart));
-      //SPtr<MPIIORestartCoProcessor> restartCoProcessor(new MPIIORestartCoProcessor(grid, rSch, pathOut, comm));
-      //restartCoProcessor->setLBMKernel(kernel);
-      //restartCoProcessor->setBCProcessor(bcProc);
-
-      SPtr<UbScheduler> mSch(new UbScheduler(cpStep, cpStart));
-      SPtr<MPIIOMigrationCoProcessor> migCoProcessor(new MPIIOMigrationCoProcessor(grid, mSch, pathOut+"/mig", comm));
-      migCoProcessor->setLBMKernel(kernel);
-      migCoProcessor->setBCProcessor(bcProc);
-      //////////////////////////////////////////////////////////////////////////
-
-      if (myid==0)
-      {
-         UBLOG(logINFO, "PID = "<<myid<<" Point 2");
-         UBLOG(logINFO, "PID = "<<myid<<" Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB");
-      }
-
-      if (myid==0)
-      {
-         UBLOG(logINFO, "Parameters:");
-         UBLOG(logINFO, "* Re                  = "<<Re);
-         UBLOG(logINFO, "* Ma                  = "<<Ma);
-         UBLOG(logINFO, "* velocity (uReal)    = "<<uReal<<" m/s");
-         UBLOG(logINFO, "* viscosity (nuReal)  = "<<nuReal<<" m^2/s");
-         UBLOG(logINFO, "* chord length (lReal)= "<<lReal<<" m");
-         UBLOG(logINFO, "* velocity LB (uLB)   = "<<uLB);
-         UBLOG(logINFO, "* viscosity LB (nuLB) = "<<nuLB);
-         UBLOG(logINFO, "* chord length (l_LB) = "<<lLB<<" dx_base");
-         UBLOG(logINFO, "* dx_base             = "<<deltaXcoarse<<" m");
-         UBLOG(logINFO, "* dx_refine           = "<<deltaXfine<<" m");
-         UBLOG(logINFO, "* blocknx             = "<<blockNx[0]<<"x"<<blockNx[1]<<"x"<<blockNx[2]);
-         UBLOG(logINFO, "* refineDistance      = "<<refineDistance);
-         UBLOG(logINFO, "* number of levels    = "<<refineLevel+1);
-         UBLOG(logINFO, "* number of threads   = "<<numOfThreads);
-         UBLOG(logINFO, "* number of processes = "<<comm->getNumberOfProcesses());
-         UBLOG(logINFO, "* path = "<<pathOut);
-      }
-
-      if (newStart)
-      {
-         ////////////////////////////////////////////////////////////////////////
-         //define grid
-         //////////////////////////////////////////////////////////////////////////
-         grid->setDeltaX(deltaXcoarse);
-         grid->setBlockNX(blockNx[0], blockNx[1], blockNx[2]);
-
-         SPtr<GbObject3D> gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
-         if (myid==0) GbSystem3D::writeGeoObject(gridCube.get(), pathOut+"/geo/gridCube", WbWriterVtkXmlASCII::getInstance());
-         GenBlocksGridVisitor genBlocks(gridCube);
-         grid->accept(genBlocks);
-
-         grid->setPeriodicX1(false);
-         grid->setPeriodicX2(true);
-         grid->setPeriodicX3(false);
-
-
-         //GbCuboid3DPtr spongeLayerX1max(new GbCuboid3D(g_maxX1-0.4, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength));
-         //if (myid==0) GbSystem3D::writeGeoObject(spongeLayerX1max.get(), pathOut+"/geo/spongeLayerX1max", WbWriterVtkXmlASCII::getInstance());
-
-         if (myid==0)
-         {
-            UBLOG(logINFO, "Preprocessing - start");
-         }
-
-         {
-            WriteBlocksCoProcessor ppblocks(grid, SPtr<UbScheduler>(new UbScheduler(1)), pathOut, WbWriterVtkXmlBinary::getInstance(), comm);
-            ppblocks.process(0);
-         }
-         
-         //SPtr<GbObject3D> fngMeshWhole(new GbCylinder3D(15.0, 0.0, 0.0, 15.0, 100.0, 0.0, 25.0));
-         //GbSystem3D::writeGeoObject(fngMeshWhole.get(), pathOut + "/geo/fngMeshWholeCylinder", WbWriterVtkXmlBinary::getInstance());
-
-         SPtr<GbTriFaceMesh3D> fngMeshWhole1;
-         if (myid==0) UBLOG(logINFO, "Read fngFileWhole1:start");
-         fngMeshWhole1 = SPtr<GbTriFaceMesh3D>(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile2(pathGeo+"/"+fngFileWhole1, "fngMeshWhole1", GbTriFaceMesh3D::KDTREE_SAHPLIT, false));
-         if (myid==0) UBLOG(logINFO, "Read fngFileWhole1:end");
-         fngMeshWhole1->rotate(0.0, 0.5, 0.0);
-         //fngMeshWhole->scale(1e3,1e3,1e3);
-         //fngMeshWhole->translate(1.932008e-5-149.867,-0.03-49.95,-0.0172298-1.32814);
-         if (myid==0) GbSystem3D::writeGeoObject(fngMeshWhole1.get(), pathOut+"/geo/fngMeshWhole1", WbWriterVtkXmlBinary::getInstance());
-
-         SPtr<GbTriFaceMesh3D> fngMeshWhole2;
-         if (myid==0) UBLOG(logINFO, "Read fngFileWhole2:start");
-         fngMeshWhole2 = SPtr<GbTriFaceMesh3D>(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile2(pathGeo+"/"+fngFileWhole2, "fngMeshWhole2", GbTriFaceMesh3D::KDTREE_SAHPLIT, false));
-         if (myid==0) UBLOG(logINFO, "Read fngFileWhole2:end");
-         fngMeshWhole2->rotate(0.0, 0.5, 0.0);
-         //fngMeshWhole->scale(1e3,1e3,1e3);
-         //fngMeshWhole->translate(1.932008e-5-149.867,-0.03-49.95,-0.0172298-1.32814);
-         if (myid==0) GbSystem3D::writeGeoObject(fngMeshWhole2.get(), pathOut+"/geo/fngMeshWhole2", WbWriterVtkXmlBinary::getInstance());
-
-         //SPtr<GbTriFaceMesh3D> tapeMesh;
-         //if (myid==0) UBLOG(logINFO, "Read fngFileWhole:start");
-         //tapeMesh = SPtr<GbTriFaceMesh3D>(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile2(pathGeo+"/"+tapeFile, "tapeMesh", GbTriFaceMesh3D::KDTREE_SAHPLIT, false));
-         //if (myid==0) UBLOG(logINFO, "Read fngFileWhole:end");
-         //tapeMesh->rotate(0.0, 0.5, 0.0);
-         ////fngMeshWhole->scale(1e3,1e3,1e3);
-         //tapeMesh->translate(0.0,0.0,-0.001085);
-         //if (myid==0) GbSystem3D::writeGeoObject(tapeMesh.get(), pathOut+"/geo/tapeMesh", WbWriterVtkXmlBinary::getInstance());
-
-         if (myid==0)
-         {
-            UBLOG(logINFO, "PID = "<<myid<<" Point 3");
-            UBLOG(logINFO, "PID = "<<myid<<" Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB");
-         }
-         //////////////////////////////////////////////////////////////////////////
-         SPtr<Interactor3D> fngIntrWhole1 = SPtr<D3Q27TriFaceMeshInteractor>(new D3Q27TriFaceMeshInteractor(fngMeshWhole1, grid, noSlipBCAdapter, Interactor3D::SOLID, (Interactor3D::Accuracy)accuracy));//, Interactor3D::POINTS));
-         SPtr<Interactor3D> fngIntrWhole2 = SPtr<D3Q27TriFaceMeshInteractor>(new D3Q27TriFaceMeshInteractor(fngMeshWhole2, grid, noSlipBCAdapter, Interactor3D::SOLID, (Interactor3D::Accuracy)accuracy));
-
-         if (refineLevel>0 && myid==0 && writeBlocks)
-         {
-            if (myid==0) UBLOG(logINFO, "Refinement - start");
-            int rank = grid->getRank();
-            grid->setRank(0);
-
-
-            int level;
-
-            level = 1;
-            if (refineLevel - level >= 0)
-            {
-               dynamicPointerCast<D3Q27TriFaceMeshInteractor>(fngIntrWhole1)->refineBlockGridToLevel(level, startDistance, refineDistance);
-               //SPtr<GbObject3D> refCylinderL1(new GbCylinder3D(0.3, -0.03, 0.001, 0.3, 0.06, 0.001, 0.1));
-               //RefineCrossAndInsideGbObjectBlockVisitor refVisitorCylinderL1(refCylinderL1, level);
-               //grid->accept(refVisitorCylinderL1);
-
-               //SPtr<GbObject3D> refBoxL1(new GbCuboid3D(0.15, -0.03, -0.035, 0.45, 0.06, 0.035));
-               //if (myid==0) GbSystem3D::writeGeoObject(refBoxL1.get(), pathOut+"/geo/refBoxL1", WbWriterVtkXmlASCII::getInstance());
-               //RefineCrossAndInsideGbObjectBlockVisitor refVisitorBoxL1(refBoxL1, level);
-               //grid->accept(refVisitorBoxL1);
-            }
-            
-            level = 2;
-            if (refineLevel - level >= 0)
-            {
-               dynamicPointerCast<D3Q27TriFaceMeshInteractor>(fngIntrWhole1)->refineBlockGridToLevel(level, startDistance, refineDistance);
-            }
-
-            level = 3;
-            if (refineLevel - level >= 0)
-            {
-               //SPtr<GbObject3D> refCylinderL1(new GbCylinder3D(0.015, -0.03, 0.0, 0.015, 0.06, 0.0, 0.03));
-               //GbSystem3D::writeGeoObject(refCylinderL1.get(), pathOut + "/geo/refCylinderL1", WbWriterVtkXmlBinary::getInstance());
-               //RefineCrossAndInsideGbObjectBlockVisitor refVisitorCylinderL1(refCylinderL1, level);
-               //grid->accept(refVisitorCylinderL1);
-
-               ////SPtr<GbObject3D> refBoxL1(new GbCuboid3D(0.015, -0.03, -0.03, 1.100, 0.06, 0.03));
-               ////SPtr<GbObject3D> refBoxL1(new GbCuboid3D(0.12, -0.02625, -0.03, 1.0, 0.06, 0.03));
-               //SPtr<GbObject3D> refBoxL1(new GbCuboid3D(0.12, -0.02625, -0.03, 0.34, 0.06, 0.03));
-               //if (myid==0) GbSystem3D::writeGeoObject(refBoxL1.get(), pathOut+"/geo/refBoxL1", WbWriterVtkXmlASCII::getInstance());
-               //RefineCrossAndInsideGbObjectBlockVisitor refVisitorBoxL1(refBoxL1, level);
-               //grid->accept(refVisitorBoxL1);
-
-               //SPtr<GbObject3D> refCylinderL1(new GbCylinder3D(0.3, -0.03, 0.001, 0.3, 0.06, 0.001, 0.03));
-               //GbSystem3D::writeGeoObject(refCylinderL1.get(), pathOut + "/geo/refCylinderL1", WbWriterVtkXmlBinary::getInstance());
-               //RefineCrossAndInsideGbObjectBlockVisitor refVisitorCylinderL1(refCylinderL1, level);
-               //grid->accept(refVisitorCylinderL1);
-
-               SPtr<GbObject3D> refBoxL2(new GbCuboid3D(0.15, -0.03, -0.015, 0.42, 0.06, 0.015));
-               if (myid==0) GbSystem3D::writeGeoObject(refBoxL2.get(), pathOut+"/geo/refBoxL2", WbWriterVtkXmlASCII::getInstance());
-               RefineCrossAndInsideGbObjectBlockVisitor refVisitorBoxL2(refBoxL2, level);
-               grid->accept(refVisitorBoxL2);
-
-               //dynamicPointerCast<D3Q27TriFaceMeshInteractor>(fngIntrWhole1)->refineBlockGridToLevel(level, startDistance, 24.0*refineDistance);
-               dynamicPointerCast<D3Q27TriFaceMeshInteractor>(fngIntrWhole1)->refineBlockGridToLevel(level, startDistance, 12.0*refineDistance);
-            }
-
-            //level = 4;
-            //if (refineLevel - level >= 0)
-            //{
-            //   //SPtr<GbObject3D> refCylinderL2(new GbCylinder3D(0.015, -0.03, 0.0, 0.015, 0.06, 0.0, 0.03));
-            //   //GbSystem3D::writeGeoObject(refCylinderL2.get(), pathOut + "/geo/refCylinderL2", WbWriterVtkXmlBinary::getInstance());
-            //   //RefineCrossAndInsideGbObjectBlockVisitor refVisitorCylinderL2(refCylinderL2, level);
-            //   //grid->accept(refVisitorCylinderL2);
-
-            //   //SPtr<GbObject3D> refBoxL2(new GbCuboid3D(0.15, -0.03, -0.015, 0.7, 0.06, 0.015));
-            //   SPtr<GbObject3D> refBoxL2(new GbCuboid3D(0.15, -0.03, -0.015, 0.42, 0.06, 0.015));
-            //   if (myid==0) GbSystem3D::writeGeoObject(refBoxL2.get(), pathOut+"/geo/refBoxL2", WbWriterVtkXmlASCII::getInstance());
-            //   RefineCrossAndInsideGbObjectBlockVisitor refVisitorBoxL2(refBoxL2, level);
-            //   grid->accept(refVisitorBoxL2);
-
-            //   //SPtr<GbObject3D> refCylinderL1(new GbCylinder3D(0.3, -0.03, 0.001, 0.3, 0.06, 0.001, 0.03));
-            //   //GbSystem3D::writeGeoObject(refCylinderL1.get(), pathOut + "/geo/refCylinderL1", WbWriterVtkXmlBinary::getInstance());
-            //   //RefineCrossAndInsideGbObjectBlockVisitor refVisitorCylinderL1(refCylinderL1, level);
-            //   //grid->accept(refVisitorCylinderL1);
-
-            //   dynamicPointerCast<D3Q27TriFaceMeshInteractor>(fngIntrWhole1)->refineBlockGridToLevel(level, startDistance, 6.0*refineDistance);
-            //}
-
-            //level = 5;
-            //if (refineLevel - level >= 0)
-            //{
-            //   //SPtr<GbObject3D> refCylinderL3(new GbCylinder3D(0.015, -0.03, 0.0, 0.015, 0.06, 0.0, 0.025));
-            //   //GbSystem3D::writeGeoObject(refCylinderL3.get(), pathOut + "/geo/refCylinderL3", WbWriterVtkXmlBinary::getInstance());
-            //   //RefineCrossAndInsideGbObjectBlockVisitor refVisitorCylinderL3(refCylinderL3, level);
-            //   //grid->accept(refVisitorCylinderL3);
-
-            //   //SPtr<GbObject3D> refBoxL3(new GbCuboid3D(0.15, -0.03, -0.010, 0.32, 0.06, 0.012));
-            //   //if (myid==0) GbSystem3D::writeGeoObject(refBoxL3.get(), pathOut+"/geo/refBoxL3", WbWriterVtkXmlASCII::getInstance());
-            //   //RefineCrossAndInsideGbObjectBlockVisitor refVisitorBoxL3(refBoxL3, level);
-            //   //grid->accept(refVisitorBoxL3);
-
-            //   dynamicPointerCast<D3Q27TriFaceMeshInteractor>(fngIntrWhole1)->refineBlockGridToLevel(level, startDistance, 6.0*refineDistance);
-            //}
-
-            //level = 6;
-            //if (refineLevel - level >= 0)
-            //{
-            //   //SPtr<GbObject3D> refBoxL4(new GbCuboid3D(0.15, -0.03, -0.005, 0.31, 0.06, 0.01));
-            //   //if (myid==0) GbSystem3D::writeGeoObject(refBoxL4.get(), pathOut+"/geo/refBoxL4", WbWriterVtkXmlASCII::getInstance());
-            //   //RefineCrossAndInsideGbObjectBlockVisitor refVisitorBoxL4(refBoxL4, level);
-            //   //grid->accept(refVisitorBoxL4);
-
-            //   dynamicPointerCast<D3Q27TriFaceMeshInteractor>(fngIntrWhole1)->refineBlockGridToLevel(level, startDistance, 3.0*refineDistance);
-            //}
-
-            //level = 7;
-            //if (refineLevel - level >= 0)
-            //{
-            //   dynamicPointerCast<D3Q27TriFaceMeshInteractor>(fngIntrWhole1)->refineBlockGridToLevel(level, startDistance, refineDistance);
-            //}
-
-            //dynamicPointerCast<D3Q27TriFaceMeshInteractor>(fngIntrWhole1)->refineBlockGridToLevel(refineLevel, startDistance, refineDistance);
-            //
-
-            /////delete solid blocks
-            if (myid==0) UBLOG(logINFO, "deleteSolidBlocks - start");
-
-            SetSolidBlocksBlockVisitor v(fngIntrWhole1);
-            grid->accept(v);
-            std::vector<SPtr<Block3D>>& sb = fngIntrWhole1->getSolidBlockSet();
-            for (SPtr<Block3D> block : sb)
-            {
-               grid->deleteBlock(block);
-            }
-            fngIntrWhole1->removeSolidBlocks();
-            fngIntrWhole1->removeBcBlocks();
-
-            //SPtr<GbObject3D> delBox(new GbCuboid3D(0.03, -0.03, -0.010, 0.2, 0.06, 0.012));
-            //if (myid==0) GbSystem3D::writeGeoObject(delBox.get(), pathOut+"/geo/delBox", WbWriterVtkXmlASCII::getInstance());
-            //SPtr<D3Q27Interactor> delBoxInter(new D3Q27Interactor(delBox, grid, noSlipBCAdapter, Interactor3D::SOLID));
-            //SetSolidBlockVisitor v(delBoxInter, BlockType::SOLID);
-            //grid->accept(v);
-            //std::vector<SPtr<Block3D>>& sb = delBoxInter->getSolidBlockSet();
-            //for (SPtr<Block3D> block : sb)
-            //{
-            //   grid->deleteBlock(block);
-            //}
-            //delBoxInter->removeSolidBlocks();
-            //delBoxInter->removeBcBlocks();
-
-            if (myid==0) UBLOG(logINFO, "deleteSolidBlocks - end");
-            ////////////////////////////////////////
-
-            {
-               WriteBlocksCoProcessor ppblocks(grid, SPtr<UbScheduler>(new UbScheduler(1)), pathOut, WbWriterVtkXmlBinary::getInstance(), comm);
-               ppblocks.process(1);
-            }
-
-            grid->setRank(rank);
-
-            RatioBlockVisitor ratioVisitor(refineLevel);
-            CheckRatioBlockVisitor checkRatio(refineLevel);
-            int count = 0;
-
-            do {
-               if (myid==0) UBLOG(logINFO, "ratioVisitor - start");
-               grid->accept(ratioVisitor);
-               if (myid==0) UBLOG(logINFO, "ratioVisitor - end");
-               if (myid==0) UBLOG(logINFO, "checkRatio - start");
-               checkRatio.resetState();
-               grid->accept(checkRatio);
-               if (myid==0) UBLOG(logINFO, "checkRatio - end");
-               if (myid==0) UBLOG(logINFO, "count = "<<count++<<" state = "<<checkRatio.getState());
-            } while (!checkRatio.getState());
-
-
-            {
-               WriteBlocksCoProcessor ppblocks(grid, SPtr<UbScheduler>(new UbScheduler(1)), pathOut, WbWriterVtkXmlBinary::getInstance(), comm);
-               ppblocks.process(2);
-            }
-
-            OverlapBlockVisitor overlapVisitor(refineLevel, false);
-            grid->accept(overlapVisitor);
-
-            if (myid==0) UBLOG(logINFO, "Refinement - end");
-         }
-         //else
-         //{
-         //   migCoProcessor->readBlocks(0);
-         //}
-         grid->updateDistributedBlocks(comm);
-
-         //if (writeBlocks)
-         //{
-         //   migCoProcessor->writeBlocks(0);
-         //}
-
-         std::vector<int> dirs;
-         for (int i = D3Q27System::E; i<=D3Q27System::TS; i++)
-         {
-            dirs.push_back(i);
-         }
-         SetInterpolationDirsBlockVisitor interDirsVisitor(dirs);
-         grid->accept(interDirsVisitor);
-
-         //walls
-         GbCuboid3DPtr addWallZmin(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_minX3));
-         if (myid==0) GbSystem3D::writeGeoObject(addWallZmin.get(), pathOut+"/geo/addWallZmin", WbWriterVtkXmlASCII::getInstance());
-
-         GbCuboid3DPtr addWallZmax(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_maxX3, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength));
-         if (myid==0) GbSystem3D::writeGeoObject(addWallZmax.get(), pathOut+"/geo/addWallZmax", WbWriterVtkXmlASCII::getInstance());
-
-         //wall interactors
-         SPtr<D3Q27Interactor> addWallZminInt(new D3Q27Interactor(addWallZmin, grid, velBCAdapter, Interactor3D::SOLID));
-         SPtr<D3Q27Interactor> addWallZmaxInt(new D3Q27Interactor(addWallZmax, grid, velBCAdapter, Interactor3D::SOLID));
-
-         //inflow
-         GbCuboid3DPtr geoInflow(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3-blockLength, g_minX1, g_maxX2+blockLength, g_maxX3+blockLength));
-         if (myid==0) GbSystem3D::writeGeoObject(geoInflow.get(), pathOut+"/geo/geoInflow", WbWriterVtkXmlASCII::getInstance());
-
-         //outflow
-         GbCuboid3DPtr geoOutflow(new GbCuboid3D(g_maxX1, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength));
-         if (myid==0) GbSystem3D::writeGeoObject(geoOutflow.get(), pathOut+"/geo/geoOutflow", WbWriterVtkXmlASCII::getInstance());
-
-         //inflow
-         SPtr<D3Q27Interactor> inflowIntr = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoInflow, grid, velBCAdapter, Interactor3D::SOLID));
-
-         //outflow
-         SPtr<D3Q27Interactor> outflowIntr = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoOutflow, grid, outflowBCAdapter, Interactor3D::SOLID));
-
-         ////////////////////////////////////////////
-         //METIS
-         SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B, MetisPartitioner::RECURSIVE));
-         //std::dynamic_pointer_cast<MetisPartitioningGridVisitor>(metisVisitor)->setNumberOfProcesses(4000);
-         ////////////////////////////////////////////
-         /////delete solid blocks
-         if (myid==0) UBLOG(logINFO, "deleteSolidBlocks - start");
-         InteractorsHelper intHelper(grid, metisVisitor);
-         intHelper.addInteractor(inflowIntr);
-         intHelper.addInteractor(outflowIntr);
-         intHelper.addInteractor(addWallZminInt);
-         intHelper.addInteractor(addWallZmaxInt);
-         intHelper.addInteractor(fngIntrWhole2);
-         intHelper.selectBlocks();
-
-         if (myid==0) UBLOG(logINFO, "deleteSolidBlocks - end");
-
-         if (myid==0)
-         {
-            UBLOG(logINFO, "PID = "<<myid<<" Point 4");
-            UBLOG(logINFO, "PID = "<<myid<<" Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB");
-         }
-         //////////////////////////////////////
-
-         {
-            WriteBlocksCoProcessor ppblocks(grid, SPtr<UbScheduler>(new UbScheduler(1)), pathOut, WbWriterVtkXmlBinary::getInstance(), comm);
-            ppblocks.process(3);
-         }
-
-
-         unsigned long long numberOfBlocks = (unsigned long long)grid->getNumberOfBlocks();
-         int ghostLayer = 3;
-         unsigned long long numberOfNodesPerBlock = (unsigned long long)(blockNx[0])* (unsigned long long)(blockNx[1])* (unsigned long long)(blockNx[2]);
-         unsigned long long numberOfNodes = numberOfBlocks * numberOfNodesPerBlock;
-         unsigned long long numberOfNodesPerBlockWithGhostLayer = numberOfBlocks * (blockNx[0]+ghostLayer) * (blockNx[1]+ghostLayer) * (blockNx[2]+ghostLayer);
-         double needMemAll = double(numberOfNodesPerBlockWithGhostLayer*(27*sizeof(double)+sizeof(int)+sizeof(float)*4));
-         double needMem = needMemAll/double(comm->getNumberOfProcesses());
-
-         if (myid==0)
-         {
-            UBLOG(logINFO, "Number of blocks = "<<numberOfBlocks);
-            UBLOG(logINFO, "Number of nodes  = "<<numberOfNodes);
-            int minInitLevel = grid->getCoarsestInitializedLevel();
-            int maxInitLevel = grid->getFinestInitializedLevel();
-            for (int level = minInitLevel; level<=maxInitLevel; level++)
-            {
-               int nobl = grid->getNumberOfBlocks(level);
-               UBLOG(logINFO, "Number of blocks for level "<<level<<" = "<<nobl);
-               UBLOG(logINFO, "Number of nodes for level "<<level<<" = "<<nobl*numberOfNodesPerBlock);
-            }
-            UBLOG(logINFO, "Necessary memory  = "<<needMemAll<<" bytes");
-            UBLOG(logINFO, "Necessary memory per process = "<<needMem<<" bytes");
-            UBLOG(logINFO, "Available memory per process = "<<availMem<<" bytes");
-         }
-
-         SetKernelBlockVisitor kernelVisitor(kernel, nuLB, availMem, needMem);
-         grid->accept(kernelVisitor);
-
-         if (myid==0) UBLOG(logINFO, "SetKernelBlockVisitor:end");
-
-         if (myid==0)
-         {
-            UBLOG(logINFO, "PID = "<<myid<<" Point 5");
-            UBLOG(logINFO, "PID = "<<myid<<" Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB");
-         }
-
-         if (refineLevel>0)
-         {
-            SetUndefinedNodesBlockVisitor undefNodesVisitor;
-            grid->accept(undefNodesVisitor);
-         }
-
-         if (myid==0) UBLOG(logINFO, "SetUndefinedNodesBlockVisitor:end");
-
-         //BC
-         intHelper.setBC();
-
-        
-         if (myid==0) UBLOG(logINFO, "intHelper.setBC():end");
-
-         if (myid==0)
-         {
-            UBLOG(logINFO, "PID = "<<myid<<" Point 6");
-            UBLOG(logINFO, "PID = "<<myid<<" Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB");
-         }
-
-         //initialization of distributions
-         InitDistributionsBlockVisitor initVisitor;
-         initVisitor.setVx1(fct);
-         grid->accept(initVisitor);
-
-         if (myid==0)
-         {
-            UBLOG(logINFO, "PID = "<<myid<<" Point 7");
-            UBLOG(logINFO, "PID = "<<myid<<" Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB");
-         }
-
-         //Post process
-         {
-            SPtr<UbScheduler> geoSch(new UbScheduler(1));
-            WriteBoundaryConditionsCoProcessor ppgeo(grid, geoSch, pathOut, WbWriterVtkXmlBinary::getInstance(), comm);
-            ppgeo.process(0);
-         }
-
-         if (myid==0)
-         {
-            UBLOG(logINFO, "PID = "<<myid<<" Point 8");
-            UBLOG(logINFO, "PID = "<<myid<<" Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB");
-         }
-
-         if (myid==0) UBLOG(logINFO, "Preprozess - end");
-      }
-      else
-      {
-         //restartCoProcessor->restart((int)restartStep);
-         migCoProcessor->restart((int)restartStep);
-         grid->setTimeStep(restartStep);
-         ////////////////////////////////////////////////////////////////////////////
-         WriteBlocksCoProcessor ppblocks(grid, SPtr<UbScheduler>(new UbScheduler(1)), pathOut, WbWriterVtkXmlBinary::getInstance(), comm);
-         ppblocks.process(0);
-         ////////////////////////////////////////////////////////////////////////////
-      }
-      
-      ////set connectors
-      SPtr<InterpolationProcessor> iProcessor(new CompressibleOffsetMomentsInterpolationProcessor());
-      dynamicPointerCast<CompressibleOffsetMomentsInterpolationProcessor>(iProcessor)->setBulkViscosity(nuLB, bulckViscosity);
-      SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
-      grid->accept(setConnsVisitor);
-
-      //bcVisitor should be accept after initialization!!!!
-      grid->accept(bcVisitor);
-      if (myid == 0) UBLOG(logINFO, "grid->accept(bcVisitor):end");
-
-      ////sponge layer
-      GbCuboid3DPtr spongeLayerX1max(new GbCuboid3D(g_maxX1-0.35, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength));
-      if (myid==0) GbSystem3D::writeGeoObject(spongeLayerX1max.get(), pathOut+"/geo/spongeLayerX1max", WbWriterVtkXmlASCII::getInstance());
-      SpongeLayerBlockVisitor slVisitorX1max(spongeLayerX1max, spKernel, nuLB, D3Q27System::E);
-      grid->accept(slVisitorX1max);
-
-      SPtr<UbScheduler> nupsSch(new UbScheduler(nupsStep[0], nupsStep[1], nupsStep[2]));
-      std::shared_ptr<CoProcessor> nupsCoProcessor(new NUPSCounterCoProcessor(grid, nupsSch, numOfThreads, comm));
-
-      SPtr<UbScheduler> stepSch(new UbScheduler(outTimeStep, outTimeStart));
-
-      if (myid==0)
-      {
-         UBLOG(logINFO, "PID = "<<myid<<" Point 9");
-         UBLOG(logINFO, "PID = "<<myid<<" Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB");
-      }
-
-      SPtr<CoProcessor> writeMQCoProcessor(new WriteMacroscopicQuantitiesCoProcessor(grid, stepSch, pathOut, WbWriterVtkXmlBinary::getInstance(), conv, comm));
-
-      SPtr<GbObject3D> bbBox(new GbCuboid3D(g_minX1-blockLength, (g_maxX2-g_minX2)/2.0, g_minX3-blockLength, g_maxX1+blockLength, (g_maxX2-g_minX2)/2.0+deltaXcoarse, g_maxX3+blockLength));
-      if (myid==0) GbSystem3D::writeGeoObject(bbBox.get(), pathOut+"/geo/bbBox", WbWriterVtkXmlASCII::getInstance());
-      SPtr<WriteMQFromSelectionCoProcessor> writeMQSelectCoProcessor(new WriteMQFromSelectionCoProcessor(grid, stepSch, bbBox, pathOut, WbWriterVtkXmlBinary::getInstance(), conv, comm));
-
-      SPtr<UbScheduler> tavSch(new UbScheduler(1, timeAvStart, timeAvStop));
-      SPtr<TimeAveragedValuesCoProcessor> tav(new TimeAveragedValuesCoProcessor(grid, pathOut, WbWriterVtkXmlBinary::getInstance(), tavSch, comm,
-         TimeAveragedValuesCoProcessor::Density | TimeAveragedValuesCoProcessor::Velocity | TimeAveragedValuesCoProcessor::Fluctuations));
-      tav->setWithGhostLayer(true);
-
-      SPtr<UbScheduler> stepMV(new UbScheduler(1, 0, 1000000));
-      SPtr<MicrophoneArrayCoProcessor> micCoProcessor(new MicrophoneArrayCoProcessor(grid, stepSch, pathOut, comm) );
-      double offsetX1 = 0.017;
-      double offsetZ1 = 0.11375;
-      std::vector<UbTupleFloat3> nodes;
-      //for (int i = 0; i <= 10; i++)
-      for (int i = 0; i <= 6; i++)
-      {
-         micCoProcessor->addMicrophone(Vector3D(0.3+deltaXcoarse+offsetX1*double(i), 0.015, 0.0-offsetZ1*double(i)));
-         nodes.push_back(UbTupleFloat3(float(0.3+deltaXcoarse+offsetX1*float(i)), float(0.015), float(0.0-offsetZ1*float(i))));
-      }
-      //double offsetX2 = 0.1;
-      //for (int i = 0; i <= 6; i++)
-      //{
-      //   micCoProcessor->addMicrophone(Vector3D(0.17+offsetX2*double(i), 0.015, -1.1375));
-      //   nodes.push_back(UbTupleFloat3(float(0.17+offsetX2*float(i)), float(0.015), float(-1.1375)));
-      //}
-      
-      if (myid==0) WbWriterVtkXmlBinary::getInstance()->writeNodes(pathOut+"/geo/mic", nodes);
-
-      //omp_set_num_threads(numOfThreads);
-      SPtr<UbScheduler> stepGhostLayer(new UbScheduler(1));
-      SPtr<Calculator> calculator(new BasicCalculator(grid, stepGhostLayer, endTime));
-      calculator->addCoProcessor(nupsCoProcessor);
-      calculator->addCoProcessor(micCoProcessor);
-      //calculator->addCoProcessor(restartCoProcessor);
-      calculator->addCoProcessor(migCoProcessor);
-      //calculator->addCoProcessor(writeMQSelectCoProcessor);
-      calculator->addCoProcessor(writeMQCoProcessor);
-      calculator->addCoProcessor(tav);
-
-
-      if (myid==0) UBLOG(logINFO, "Simulation-start");
-      calculator->calculate();
-      if (myid==0) UBLOG(logINFO, "Simulation-end");
-
-      if (myid==0)
-      {
-         UBLOG(logINFO, "PID = "<<myid<<" Point 10");
-         UBLOG(logINFO, "PID = "<<myid<<" Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB");
-      }
-   }
-   catch (std::exception& e)
-   {
-      cerr<<e.what()<<endl<<flush;
-   }
-   catch (std::string& s)
-   {
-      cerr<<s<<endl;
-   }
-   catch (...)
-   {
-      cerr<<"unknown exception"<<endl;
-   }
-
-}
-
-
-int main(int argc, char* argv[])
-{
-   //Sleep(30000);
-
-   if (argv!=NULL)
-   {
-      if (argv[1]!=NULL)
-      {
-         run(string(argv[1]));
-      }
-      else
-      {
-         cout<<"Configuration file must be set!: "<<argv[0]<<" <config file>"<<endl<<std::flush;
-      }
-   }
-
-   //test_run();
-   
-   //SuperMUC
-   //MPI_Finalize();
-
-   return 0;
-}
-
+#include <iostream>
+#include <string>
+
+#include <PointerDefinitions.h>
+#include "VirtualFluids.h"
+#include <omp.h>
+using namespace std;
+
+void run(string configname)
+{
+   try
+   {
+      ConfigurationFile   config;
+      config.load(configname);
+
+      string          pathOut = config.getValue<string>("pathOut");
+      string          pathGeo = config.getValue<string>("pathGeo");
+      string          fngFileWhole1 = config.getValue<string>("fngFileWhole1");
+      string          fngFileWhole2 = config.getValue<string>("fngFileWhole2");
+      //string          tapeFile = config.getValue<string>("tapeFile");
+      int             accuracy = config.getValue<int>("accuracy");
+      int             numOfThreads = config.getValue<int>("numOfThreads");
+      vector<int>     blockNx = config.getVector<int>("blockNx");
+      vector<double>  boundingBox = config.getVector<double>("boundingBox");
+      double          restartStep = config.getValue<double>("restartStep");
+      double          cpStart = config.getValue<double>("cpStart");
+      double          cpStep = config.getValue<double>("cpStep");
+      int             endTime = config.getValue<int>("endTime");
+      double          outTimeStep = config.getValue<double>("outTimeStep");
+      double          outTimeStart = config.getValue<double>("outTimeStart");
+      double          availMem = config.getValue<double>("availMem");
+      int             refineLevel = config.getValue<int>("refineLevel");
+      bool            logToFile = config.getValue<bool>("logToFile");
+      double          deltaXfine = config.getValue<double>("deltaXfine");
+      double          refineDistance = config.getValue<double>("refineDistance");
+      double          startDistance = config.getValue<double>("startDistance");
+      vector<double>  nupsStep = config.getVector<double>("nupsStep");
+      bool            newStart = config.getValue<bool>("newStart");
+      bool            writeBlocks = config.getValue<bool>("writeBlocks");
+      //string          pathReInit = config.getValue<string>("pathReInit");
+      //int             stepReInit = config.getValue<int>("stepReInit");
+      //bool            reinit = config.getValue<bool>("reinit");
+
+      //double          pcpStart = config.getValue<double>("pcpStart");
+      //double          pcpStop  = config.getValue<double>("pcpStop");
+
+      double          timeAvStart       = config.getValue<double>("timeAvStart");
+      double          timeAvStop        = config.getValue<double>("timeAvStop");
+
+      SPtr<Communicator> comm = MPICommunicator::getInstance();
+      int myid = comm->getProcessID();
+
+      if (logToFile)
+      {
+#if defined(__unix__)
+         if (myid==0)
+         {
+            const char* str = pathOut.c_str();
+            mkdir(str, S_IRWXU|S_IRWXG|S_IROTH|S_IXOTH);
+         }
+#endif 
+
+         if (myid==0)
+         {
+            stringstream logFilename;
+            logFilename<<pathOut+"/logfile"+UbSystem::toString(UbSystem::getTimeStamp())+".txt";
+            UbLog::output_policy::setStream(logFilename.str());
+         }
+      }
+
+      if (myid==0)
+      {
+         UBLOG(logINFO, "PID = "<<myid<<" Point 1");
+         UBLOG(logINFO, "PID = "<<myid<<" Total Physical Memory (RAM): "<<Utilities::getTotalPhysMem());
+         UBLOG(logINFO, "PID = "<<myid<<" Physical Memory currently used: "<<Utilities::getPhysMemUsed());
+         UBLOG(logINFO, "PID = "<<myid<<" Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB");
+      }
+
+
+      //the geometry is in mm
+
+      double g_minX1 = boundingBox[0];//*1000.0;
+      double g_minX2 = boundingBox[2];//*1000.0;
+      double g_minX3 = boundingBox[4];//*1000.0;
+      double g_maxX1 = boundingBox[1];//*1000.0;
+      double g_maxX2 = boundingBox[3];//*1000.0;
+      double g_maxX3 = boundingBox[5];//*1000.0;
+      //deltaXfine *=1000.0;
+
+      //////////////////////////////////////////////////////////////////////////
+      double deltaXcoarse = deltaXfine*(double)(1<<refineLevel);
+      //////////////////////////////////////////////////////////////////////////
+      double blockLength = (double)blockNx[0]*deltaXcoarse;
+
+      //##########################################################################
+      //## physical parameters
+      //##########################################################################
+      double Re = 1e6;
+
+      double rhoLB = 0.0;
+      double rhoReal = 1.2041; //(kg/m3)
+      //double nueReal = 153.5e-7; //m^2/s
+      double uReal = 50; //m/s
+      double lReal = 0.3;//m
+      //double uReal = Re*nueReal / lReal;
+      double nuReal = (uReal*lReal)/Re; //m^2/s
+
+      //##Machzahl:
+      //#Ma     = uReal/csReal
+      double Ma = 0.15;//Ma-Real!
+      double csReal = uReal / Ma;
+      double hLB = lReal / deltaXcoarse;
+
+      LBMUnitConverter unitConverter(lReal, csReal, rhoReal, hLB);
+
+      double uLB = uReal   * unitConverter.getFactorVelocityWToLb();
+      double nuLB = nuReal * unitConverter.getFactorViscosityWToLb();
+      double lLB = lReal/deltaXcoarse;
+      //double nuLB = (uLB*lLB)/Re; //0.005;
+      //double nuLB = 0.005;
+
+      if (myid==0) UBLOG(logINFO, unitConverter.toString());
+     
+
+      SPtr<LBMUnitConverter> conv = SPtr<LBMUnitConverter>(new LBMUnitConverter());
+
+      const int baseLevel = 0;
+
+      //SPtr<GbObject3D> mic6(new GbCuboid3D(0.3, 0.015, -0.46+4.25*deltaXcoarse, 0.3+deltaXcoarse, 0.015+deltaXcoarse, -0.46+5.25*deltaXcoarse));
+      //if (myid==0) GbSystem3D::writeGeoObject(mic6.get(), pathOut+"/geo/mic6", WbWriterVtkXmlBinary::getInstance());
+
+      //GbCuboid3DPtr spongeLayerX1max(new GbCuboid3D(g_maxX1-0.35, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength));
+      //if (myid==0) GbSystem3D::writeGeoObject(spongeLayerX1max.get(), pathOut+"/geo/spongeLayerX1max", WbWriterVtkXmlASCII::getInstance());
+      //return;
+
+
+      ////////////////////////////////////////////////////////////////////////
+      //Grid
+      //////////////////////////////////////////////////////////////////////////
+      SPtr<Grid3D> grid(new Grid3D(comm));
+
+      //BC adapters
+      SPtr<BCAdapter> noSlipBCAdapter(new NoSlipBCAdapter());
+      noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NoSlipBCAlgorithm()));
+
+      SPtr<BCAdapter> slipBCAdapter(new SlipBCAdapter());
+      slipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new SlipBCAlgorithm()));
+
+      mu::Parser fct;
+      fct.SetExpr("U");
+      fct.DefineConst("U", uLB);
+      SPtr<BCAdapter> velBCAdapter(new VelocityBCAdapter(true, false, false, fct, 0, BCFunction::INFCONST));
+      velBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new VelocityWithDensityBCAlgorithm()));
+
+      //fct.SetExpr("U");
+      //fct.DefineConst("U", 0.01);
+      //SPtr<BCAdapter> velBCAdapterOut(new VelocityBCAdapter(true, false, false, fct, 0, BCFunction::INFCONST));
+      //velBCAdapterOut->setBcAlgorithm(SPtr<BCAlgorithm>(new VelocityBCAlgorithm()));
+
+      SPtr<BCAdapter> outflowBCAdapter(new DensityBCAdapter(rhoLB));
+      outflowBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NonReflectingOutflowBCAlgorithm()));
+
+      BoundaryConditionsBlockVisitor bcVisitor;
+      bcVisitor.addBC(noSlipBCAdapter);
+      bcVisitor.addBC(velBCAdapter);
+      bcVisitor.addBC(outflowBCAdapter);
+
+      SPtr<BCProcessor> bcProc;
+      bcProc = SPtr<BCProcessor>(new BCProcessor());
+
+      SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new CompressibleCumulant4thOrderViscosityLBMKernel());
+      //t = 21.8, P = 1.0145 atm, Relative Humidity = 45.8, Second Coefficient of Viscosity = 3120
      //Ash, R. L., Zuckerwar, A. J., & Zheng, Z. (1991). Second coefficient of viscosity in air.
+      double bulckViscosity = 3120 * nuLB;
+      dynamicPointerCast<CompressibleCumulant4thOrderViscosityLBMKernel>(kernel)->setBulkViscosity(bulckViscosity);
+
+      kernel->setBCProcessor(bcProc);
+
+      SPtr<LBMKernel> spKernel = SPtr<LBMKernel>(new CompressibleCumulantLBMKernel());
+      spKernel->setBCProcessor(bcProc);
+      //////////////////////////////////////////////////////////////////////////
+      //restart
+      //SPtr<UbScheduler> rSch(new UbScheduler(cpStep, cpStart));
+      //SPtr<MPIIORestartCoProcessor> restartCoProcessor(new MPIIORestartCoProcessor(grid, rSch, pathOut, comm));
+      //restartCoProcessor->setLBMKernel(kernel);
+      //restartCoProcessor->setBCProcessor(bcProc);
+
+      SPtr<UbScheduler> mSch(new UbScheduler(cpStep, cpStart));
+      SPtr<MPIIOMigrationCoProcessor> migCoProcessor(new MPIIOMigrationCoProcessor(grid, mSch, pathOut+"/mig", comm));
+      migCoProcessor->setLBMKernel(kernel);
+      migCoProcessor->setBCProcessor(bcProc);
+      //////////////////////////////////////////////////////////////////////////
+
+      if (myid==0)
+      {
+         UBLOG(logINFO, "PID = "<<myid<<" Point 2");
+         UBLOG(logINFO, "PID = "<<myid<<" Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB");
+      }
+
+      if (myid==0)
+      {
+         UBLOG(logINFO, "Parameters:");
+         UBLOG(logINFO, "* Re                  = "<<Re);
+         UBLOG(logINFO, "* Ma                  = "<<Ma);
+         UBLOG(logINFO, "* velocity (uReal)    = "<<uReal<<" m/s");
+         UBLOG(logINFO, "* viscosity (nuReal)  = "<<nuReal<<" m^2/s");
+         UBLOG(logINFO, "* chord length (lReal)= "<<lReal<<" m");
+         UBLOG(logINFO, "* velocity LB (uLB)   = "<<uLB);
+         UBLOG(logINFO, "* viscosity LB (nuLB) = "<<nuLB);
+         UBLOG(logINFO, "* chord length (l_LB) = "<<lLB<<" dx_base");
+         UBLOG(logINFO, "* dx_base             = "<<deltaXcoarse<<" m");
+         UBLOG(logINFO, "* dx_refine           = "<<deltaXfine<<" m");
+         UBLOG(logINFO, "* blocknx             = "<<blockNx[0]<<"x"<<blockNx[1]<<"x"<<blockNx[2]);
+         UBLOG(logINFO, "* refineDistance      = "<<refineDistance);
+         UBLOG(logINFO, "* number of levels    = "<<refineLevel+1);
+         UBLOG(logINFO, "* number of threads   = "<<numOfThreads);
+         UBLOG(logINFO, "* number of processes = "<<comm->getNumberOfProcesses());
+         UBLOG(logINFO, "* path = "<<pathOut);
+      }
+
+      if (newStart)
+      {
+         ////////////////////////////////////////////////////////////////////////
+         //define grid
+         //////////////////////////////////////////////////////////////////////////
+         grid->setDeltaX(deltaXcoarse);
+         grid->setBlockNX(blockNx[0], blockNx[1], blockNx[2]);
+
+         SPtr<GbObject3D> gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
+         if (myid==0) GbSystem3D::writeGeoObject(gridCube.get(), pathOut+"/geo/gridCube", WbWriterVtkXmlASCII::getInstance());
+         GenBlocksGridVisitor genBlocks(gridCube);
+         grid->accept(genBlocks);
+
+         grid->setPeriodicX1(false);
+         grid->setPeriodicX2(true);
+         grid->setPeriodicX3(false);
+
+
+         //GbCuboid3DPtr spongeLayerX1max(new GbCuboid3D(g_maxX1-0.4, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength));
+         //if (myid==0) GbSystem3D::writeGeoObject(spongeLayerX1max.get(), pathOut+"/geo/spongeLayerX1max", WbWriterVtkXmlASCII::getInstance());
+
+         if (myid==0)
+         {
+            UBLOG(logINFO, "Preprocessing - start");
+         }
+
+         {
+            WriteBlocksCoProcessor ppblocks(grid, SPtr<UbScheduler>(new UbScheduler(1)), pathOut, WbWriterVtkXmlBinary::getInstance(), comm);
+            ppblocks.process(0);
+         }
+         
+         //SPtr<GbObject3D> fngMeshWhole(new GbCylinder3D(15.0, 0.0, 0.0, 15.0, 100.0, 0.0, 25.0));
+         //GbSystem3D::writeGeoObject(fngMeshWhole.get(), pathOut + "/geo/fngMeshWholeCylinder", WbWriterVtkXmlBinary::getInstance());
+
+         SPtr<GbTriFaceMesh3D> fngMeshWhole1;
+         if (myid==0) UBLOG(logINFO, "Read fngFileWhole1:start");
+         fngMeshWhole1 = SPtr<GbTriFaceMesh3D>(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile2(pathGeo+"/"+fngFileWhole1, "fngMeshWhole1", GbTriFaceMesh3D::KDTREE_SAHPLIT, false));
+         if (myid==0) UBLOG(logINFO, "Read fngFileWhole1:end");
+         fngMeshWhole1->rotate(0.0, 0.5, 0.0);
+         //fngMeshWhole->scale(1e3,1e3,1e3);
+         //fngMeshWhole->translate(1.932008e-5-149.867,-0.03-49.95,-0.0172298-1.32814);
+         if (myid==0) GbSystem3D::writeGeoObject(fngMeshWhole1.get(), pathOut+"/geo/fngMeshWhole1", WbWriterVtkXmlBinary::getInstance());
+
+         SPtr<GbTriFaceMesh3D> fngMeshWhole2;
+         if (myid==0) UBLOG(logINFO, "Read fngFileWhole2:start");
+         fngMeshWhole2 = SPtr<GbTriFaceMesh3D>(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile2(pathGeo+"/"+fngFileWhole2, "fngMeshWhole2", GbTriFaceMesh3D::KDTREE_SAHPLIT, false));
+         if (myid==0) UBLOG(logINFO, "Read fngFileWhole2:end");
+         fngMeshWhole2->rotate(0.0, 0.5, 0.0);
+         //fngMeshWhole->scale(1e3,1e3,1e3);
+         //fngMeshWhole->translate(1.932008e-5-149.867,-0.03-49.95,-0.0172298-1.32814);
+         if (myid==0) GbSystem3D::writeGeoObject(fngMeshWhole2.get(), pathOut+"/geo/fngMeshWhole2", WbWriterVtkXmlBinary::getInstance());
+
+         //SPtr<GbTriFaceMesh3D> tapeMesh;
+         //if (myid==0) UBLOG(logINFO, "Read fngFileWhole:start");
+         //tapeMesh = SPtr<GbTriFaceMesh3D>(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile2(pathGeo+"/"+tapeFile, "tapeMesh", GbTriFaceMesh3D::KDTREE_SAHPLIT, false));
+         //if (myid==0) UBLOG(logINFO, "Read fngFileWhole:end");
+         //tapeMesh->rotate(0.0, 0.5, 0.0);
+         ////fngMeshWhole->scale(1e3,1e3,1e3);
+         //tapeMesh->translate(0.0,0.0,-0.001085);
+         //if (myid==0) GbSystem3D::writeGeoObject(tapeMesh.get(), pathOut+"/geo/tapeMesh", WbWriterVtkXmlBinary::getInstance());
+
+         if (myid==0)
+         {
+            UBLOG(logINFO, "PID = "<<myid<<" Point 3");
+            UBLOG(logINFO, "PID = "<<myid<<" Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB");
+         }
+         //////////////////////////////////////////////////////////////////////////
+         SPtr<Interactor3D> fngIntrWhole1 = SPtr<D3Q27TriFaceMeshInteractor>(new D3Q27TriFaceMeshInteractor(fngMeshWhole1, grid, noSlipBCAdapter, Interactor3D::SOLID, (Interactor3D::Accuracy)accuracy));//, Interactor3D::POINTS));
+         SPtr<Interactor3D> fngIntrWhole2 = SPtr<D3Q27TriFaceMeshInteractor>(new D3Q27TriFaceMeshInteractor(fngMeshWhole2, grid, noSlipBCAdapter, Interactor3D::SOLID, (Interactor3D::Accuracy)accuracy));
+
+         if (refineLevel>0 && myid==0 && writeBlocks)
+         {
+            if (myid==0) UBLOG(logINFO, "Refinement - start");
+            int rank = grid->getRank();
+            grid->setRank(0);
+
+
+            int level;
+
+            level = 1;
+            if (refineLevel - level >= 0)
+            {
+               dynamicPointerCast<D3Q27TriFaceMeshInteractor>(fngIntrWhole1)->refineBlockGridToLevel(level, startDistance, refineDistance);
+               //SPtr<GbObject3D> refCylinderL1(new GbCylinder3D(0.3, -0.03, 0.001, 0.3, 0.06, 0.001, 0.1));
+               //RefineCrossAndInsideGbObjectBlockVisitor refVisitorCylinderL1(refCylinderL1, level);
+               //grid->accept(refVisitorCylinderL1);
+
+               //SPtr<GbObject3D> refBoxL1(new GbCuboid3D(0.15, -0.03, -0.035, 0.45, 0.06, 0.035));
+               //if (myid==0) GbSystem3D::writeGeoObject(refBoxL1.get(), pathOut+"/geo/refBoxL1", WbWriterVtkXmlASCII::getInstance());
+               //RefineCrossAndInsideGbObjectBlockVisitor refVisitorBoxL1(refBoxL1, level);
+               //grid->accept(refVisitorBoxL1);
+            }
+            
+            level = 2;
+            if (refineLevel - level >= 0)
+            {
+               dynamicPointerCast<D3Q27TriFaceMeshInteractor>(fngIntrWhole1)->refineBlockGridToLevel(level, startDistance, refineDistance);
+            }
+
+            level = 3;
+            if (refineLevel - level >= 0)
+            {
+               //SPtr<GbObject3D> refCylinderL1(new GbCylinder3D(0.015, -0.03, 0.0, 0.015, 0.06, 0.0, 0.03));
+               //GbSystem3D::writeGeoObject(refCylinderL1.get(), pathOut + "/geo/refCylinderL1", WbWriterVtkXmlBinary::getInstance());
+               //RefineCrossAndInsideGbObjectBlockVisitor refVisitorCylinderL1(refCylinderL1, level);
+               //grid->accept(refVisitorCylinderL1);
+
+               ////SPtr<GbObject3D> refBoxL1(new GbCuboid3D(0.015, -0.03, -0.03, 1.100, 0.06, 0.03));
+               ////SPtr<GbObject3D> refBoxL1(new GbCuboid3D(0.12, -0.02625, -0.03, 1.0, 0.06, 0.03));
+               //SPtr<GbObject3D> refBoxL1(new GbCuboid3D(0.12, -0.02625, -0.03, 0.34, 0.06, 0.03));
+               //if (myid==0) GbSystem3D::writeGeoObject(refBoxL1.get(), pathOut+"/geo/refBoxL1", WbWriterVtkXmlASCII::getInstance());
+               //RefineCrossAndInsideGbObjectBlockVisitor refVisitorBoxL1(refBoxL1, level);
+               //grid->accept(refVisitorBoxL1);
+
+               //SPtr<GbObject3D> refCylinderL1(new GbCylinder3D(0.3, -0.03, 0.001, 0.3, 0.06, 0.001, 0.03));
+               //GbSystem3D::writeGeoObject(refCylinderL1.get(), pathOut + "/geo/refCylinderL1", WbWriterVtkXmlBinary::getInstance());
+               //RefineCrossAndInsideGbObjectBlockVisitor refVisitorCylinderL1(refCylinderL1, level);
+               //grid->accept(refVisitorCylinderL1);
+
+               SPtr<GbObject3D> refBoxL2(new GbCuboid3D(0.15, -0.03, -0.015, 0.42, 0.06, 0.015));
+               if (myid==0) GbSystem3D::writeGeoObject(refBoxL2.get(), pathOut+"/geo/refBoxL2", WbWriterVtkXmlASCII::getInstance());
+               RefineCrossAndInsideGbObjectBlockVisitor refVisitorBoxL2(refBoxL2, level);
+               grid->accept(refVisitorBoxL2);
+
+               //dynamicPointerCast<D3Q27TriFaceMeshInteractor>(fngIntrWhole1)->refineBlockGridToLevel(level, startDistance, 24.0*refineDistance);
+               dynamicPointerCast<D3Q27TriFaceMeshInteractor>(fngIntrWhole1)->refineBlockGridToLevel(level, startDistance, 12.0*refineDistance);
+            }
+
+            //level = 4;
+            //if (refineLevel - level >= 0)
+            //{
+            //   //SPtr<GbObject3D> refCylinderL2(new GbCylinder3D(0.015, -0.03, 0.0, 0.015, 0.06, 0.0, 0.03));
+            //   //GbSystem3D::writeGeoObject(refCylinderL2.get(), pathOut + "/geo/refCylinderL2", WbWriterVtkXmlBinary::getInstance());
+            //   //RefineCrossAndInsideGbObjectBlockVisitor refVisitorCylinderL2(refCylinderL2, level);
+            //   //grid->accept(refVisitorCylinderL2);
+
+            //   //SPtr<GbObject3D> refBoxL2(new GbCuboid3D(0.15, -0.03, -0.015, 0.7, 0.06, 0.015));
+            //   SPtr<GbObject3D> refBoxL2(new GbCuboid3D(0.15, -0.03, -0.015, 0.42, 0.06, 0.015));
+            //   if (myid==0) GbSystem3D::writeGeoObject(refBoxL2.get(), pathOut+"/geo/refBoxL2", WbWriterVtkXmlASCII::getInstance());
+            //   RefineCrossAndInsideGbObjectBlockVisitor refVisitorBoxL2(refBoxL2, level);
+            //   grid->accept(refVisitorBoxL2);
+
+            //   //SPtr<GbObject3D> refCylinderL1(new GbCylinder3D(0.3, -0.03, 0.001, 0.3, 0.06, 0.001, 0.03));
+            //   //GbSystem3D::writeGeoObject(refCylinderL1.get(), pathOut + "/geo/refCylinderL1", WbWriterVtkXmlBinary::getInstance());
+            //   //RefineCrossAndInsideGbObjectBlockVisitor refVisitorCylinderL1(refCylinderL1, level);
+            //   //grid->accept(refVisitorCylinderL1);
+
+            //   dynamicPointerCast<D3Q27TriFaceMeshInteractor>(fngIntrWhole1)->refineBlockGridToLevel(level, startDistance, 6.0*refineDistance);
+            //}
+
+            //level = 5;
+            //if (refineLevel - level >= 0)
+            //{
+            //   //SPtr<GbObject3D> refCylinderL3(new GbCylinder3D(0.015, -0.03, 0.0, 0.015, 0.06, 0.0, 0.025));
+            //   //GbSystem3D::writeGeoObject(refCylinderL3.get(), pathOut + "/geo/refCylinderL3", WbWriterVtkXmlBinary::getInstance());
+            //   //RefineCrossAndInsideGbObjectBlockVisitor refVisitorCylinderL3(refCylinderL3, level);
+            //   //grid->accept(refVisitorCylinderL3);
+
+            //   //SPtr<GbObject3D> refBoxL3(new GbCuboid3D(0.15, -0.03, -0.010, 0.32, 0.06, 0.012));
+            //   //if (myid==0) GbSystem3D::writeGeoObject(refBoxL3.get(), pathOut+"/geo/refBoxL3", WbWriterVtkXmlASCII::getInstance());
+            //   //RefineCrossAndInsideGbObjectBlockVisitor refVisitorBoxL3(refBoxL3, level);
+            //   //grid->accept(refVisitorBoxL3);
+
+            //   dynamicPointerCast<D3Q27TriFaceMeshInteractor>(fngIntrWhole1)->refineBlockGridToLevel(level, startDistance, 6.0*refineDistance);
+            //}
+
+            //level = 6;
+            //if (refineLevel - level >= 0)
+            //{
+            //   //SPtr<GbObject3D> refBoxL4(new GbCuboid3D(0.15, -0.03, -0.005, 0.31, 0.06, 0.01));
+            //   //if (myid==0) GbSystem3D::writeGeoObject(refBoxL4.get(), pathOut+"/geo/refBoxL4", WbWriterVtkXmlASCII::getInstance());
+            //   //RefineCrossAndInsideGbObjectBlockVisitor refVisitorBoxL4(refBoxL4, level);
+            //   //grid->accept(refVisitorBoxL4);
+
+            //   dynamicPointerCast<D3Q27TriFaceMeshInteractor>(fngIntrWhole1)->refineBlockGridToLevel(level, startDistance, 3.0*refineDistance);
+            //}
+
+            //level = 7;
+            //if (refineLevel - level >= 0)
+            //{
+            //   dynamicPointerCast<D3Q27TriFaceMeshInteractor>(fngIntrWhole1)->refineBlockGridToLevel(level, startDistance, refineDistance);
+            //}
+
+            //dynamicPointerCast<D3Q27TriFaceMeshInteractor>(fngIntrWhole1)->refineBlockGridToLevel(refineLevel, startDistance, refineDistance);
+            //
+
+            /////delete solid blocks
+            if (myid==0) UBLOG(logINFO, "deleteSolidBlocks - start");
+
+            SetSolidBlocksBlockVisitor v(fngIntrWhole1);
+            grid->accept(v);
+            std::vector<SPtr<Block3D>>& sb = fngIntrWhole1->getSolidBlockSet();
+            for (SPtr<Block3D> block : sb)
+            {
+               grid->deleteBlock(block);
+            }
+            fngIntrWhole1->removeSolidBlocks();
+            fngIntrWhole1->removeBcBlocks();
+
+            //SPtr<GbObject3D> delBox(new GbCuboid3D(0.03, -0.03, -0.010, 0.2, 0.06, 0.012));
+            //if (myid==0) GbSystem3D::writeGeoObject(delBox.get(), pathOut+"/geo/delBox", WbWriterVtkXmlASCII::getInstance());
+            //SPtr<D3Q27Interactor> delBoxInter(new D3Q27Interactor(delBox, grid, noSlipBCAdapter, Interactor3D::SOLID));
+            //SetSolidBlockVisitor v(delBoxInter, BlockType::SOLID);
+            //grid->accept(v);
+            //std::vector<SPtr<Block3D>>& sb = delBoxInter->getSolidBlockSet();
+            //for (SPtr<Block3D> block : sb)
+            //{
+            //   grid->deleteBlock(block);
+            //}
+            //delBoxInter->removeSolidBlocks();
+            //delBoxInter->removeBcBlocks();
+
+            if (myid==0) UBLOG(logINFO, "deleteSolidBlocks - end");
+            ////////////////////////////////////////
+
+            {
+               WriteBlocksCoProcessor ppblocks(grid, SPtr<UbScheduler>(new UbScheduler(1)), pathOut, WbWriterVtkXmlBinary::getInstance(), comm);
+               ppblocks.process(1);
+            }
+
+            grid->setRank(rank);
+
+            RatioBlockVisitor ratioVisitor(refineLevel);
+            CheckRatioBlockVisitor checkRatio(refineLevel);
+            int count = 0;
+
+            do {
+               if (myid==0) UBLOG(logINFO, "ratioVisitor - start");
+               grid->accept(ratioVisitor);
+               if (myid==0) UBLOG(logINFO, "ratioVisitor - end");
+               if (myid==0) UBLOG(logINFO, "checkRatio - start");
+               checkRatio.resetState();
+               grid->accept(checkRatio);
+               if (myid==0) UBLOG(logINFO, "checkRatio - end");
+               if (myid==0) UBLOG(logINFO, "count = "<<count++<<" state = "<<checkRatio.getState());
+            } while (!checkRatio.getState());
+
+
+            {
+               WriteBlocksCoProcessor ppblocks(grid, SPtr<UbScheduler>(new UbScheduler(1)), pathOut, WbWriterVtkXmlBinary::getInstance(), comm);
+               ppblocks.process(2);
+            }
+
+            OverlapBlockVisitor overlapVisitor(refineLevel, false);
+            grid->accept(overlapVisitor);
+
+            if (myid==0) UBLOG(logINFO, "Refinement - end");
+         }
+         //else
+         //{
+         //   migCoProcessor->readBlocks(0);
+         //}
+         grid->updateDistributedBlocks(comm);
+
+         //if (writeBlocks)
+         //{
+         //   migCoProcessor->writeBlocks(0);
+         //}
+
+         std::vector<int> dirs;
+         for (int i = D3Q27System::E; i<=D3Q27System::TS; i++)
+         {
+            dirs.push_back(i);
+         }
+         SetInterpolationDirsBlockVisitor interDirsVisitor(dirs);
+         grid->accept(interDirsVisitor);
+
+         //walls
+         GbCuboid3DPtr addWallZmin(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_minX3));
+         if (myid==0) GbSystem3D::writeGeoObject(addWallZmin.get(), pathOut+"/geo/addWallZmin", WbWriterVtkXmlASCII::getInstance());
+
+         GbCuboid3DPtr addWallZmax(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_maxX3, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength));
+         if (myid==0) GbSystem3D::writeGeoObject(addWallZmax.get(), pathOut+"/geo/addWallZmax", WbWriterVtkXmlASCII::getInstance());
+
+         //wall interactors
+         SPtr<D3Q27Interactor> addWallZminInt(new D3Q27Interactor(addWallZmin, grid, velBCAdapter, Interactor3D::SOLID));
+         SPtr<D3Q27Interactor> addWallZmaxInt(new D3Q27Interactor(addWallZmax, grid, velBCAdapter, Interactor3D::SOLID));
+
+         //inflow
+         GbCuboid3DPtr geoInflow(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3-blockLength, g_minX1, g_maxX2+blockLength, g_maxX3+blockLength));
+         if (myid==0) GbSystem3D::writeGeoObject(geoInflow.get(), pathOut+"/geo/geoInflow", WbWriterVtkXmlASCII::getInstance());
+
+         //outflow
+         GbCuboid3DPtr geoOutflow(new GbCuboid3D(g_maxX1, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength));
+         if (myid==0) GbSystem3D::writeGeoObject(geoOutflow.get(), pathOut+"/geo/geoOutflow", WbWriterVtkXmlASCII::getInstance());
+
+         //inflow
+         SPtr<D3Q27Interactor> inflowIntr = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoInflow, grid, velBCAdapter, Interactor3D::SOLID));
+
+         //outflow
+         SPtr<D3Q27Interactor> outflowIntr = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoOutflow, grid, outflowBCAdapter, Interactor3D::SOLID));
+
+         ////////////////////////////////////////////
+         //METIS
+         SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B, MetisPartitioner::RECURSIVE));
+         //std::dynamic_pointer_cast<MetisPartitioningGridVisitor>(metisVisitor)->setNumberOfProcesses(4000);
+         ////////////////////////////////////////////
+         /////delete solid blocks
+         if (myid==0) UBLOG(logINFO, "deleteSolidBlocks - start");
+         InteractorsHelper intHelper(grid, metisVisitor);
+         intHelper.addInteractor(inflowIntr);
+         intHelper.addInteractor(outflowIntr);
+         intHelper.addInteractor(addWallZminInt);
+         intHelper.addInteractor(addWallZmaxInt);
+         intHelper.addInteractor(fngIntrWhole2);
+         intHelper.selectBlocks();
+
+         if (myid==0) UBLOG(logINFO, "deleteSolidBlocks - end");
+
+         if (myid==0)
+         {
+            UBLOG(logINFO, "PID = "<<myid<<" Point 4");
+            UBLOG(logINFO, "PID = "<<myid<<" Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB");
+         }
+         //////////////////////////////////////
+
+         {
+            WriteBlocksCoProcessor ppblocks(grid, SPtr<UbScheduler>(new UbScheduler(1)), pathOut, WbWriterVtkXmlBinary::getInstance(), comm);
+            ppblocks.process(3);
+         }
+
+
+         unsigned long long numberOfBlocks = (unsigned long long)grid->getNumberOfBlocks();
+         int ghostLayer = 3;
+         unsigned long long numberOfNodesPerBlock = (unsigned long long)(blockNx[0])* (unsigned long long)(blockNx[1])* (unsigned long long)(blockNx[2]);
+         unsigned long long numberOfNodes = numberOfBlocks * numberOfNodesPerBlock;
+         unsigned long long numberOfNodesPerBlockWithGhostLayer = numberOfBlocks * (blockNx[0]+ghostLayer) * (blockNx[1]+ghostLayer) * (blockNx[2]+ghostLayer);
+         double needMemAll = double(numberOfNodesPerBlockWithGhostLayer*(27*sizeof(double)+sizeof(int)+sizeof(float)*4));
+         double needMem = needMemAll/double(comm->getNumberOfProcesses());
+
+         if (myid==0)
+         {
+            UBLOG(logINFO, "Number of blocks = "<<numberOfBlocks);
+            UBLOG(logINFO, "Number of nodes  = "<<numberOfNodes);
+            int minInitLevel = grid->getCoarsestInitializedLevel();
+            int maxInitLevel = grid->getFinestInitializedLevel();
+            for (int level = minInitLevel; level<=maxInitLevel; level++)
+            {
+               int nobl = grid->getNumberOfBlocks(level);
+               UBLOG(logINFO, "Number of blocks for level "<<level<<" = "<<nobl);
+               UBLOG(logINFO, "Number of nodes for level "<<level<<" = "<<nobl*numberOfNodesPerBlock);
+            }
+            UBLOG(logINFO, "Necessary memory  = "<<needMemAll<<" bytes");
+            UBLOG(logINFO, "Necessary memory per process = "<<needMem<<" bytes");
+            UBLOG(logINFO, "Available memory per process = "<<availMem<<" bytes");
+         }
+
+         SetKernelBlockVisitor kernelVisitor(kernel, nuLB, availMem, needMem);
+         grid->accept(kernelVisitor);
+
+         if (myid==0) UBLOG(logINFO, "SetKernelBlockVisitor:end");
+
+         if (myid==0)
+         {
+            UBLOG(logINFO, "PID = "<<myid<<" Point 5");
+            UBLOG(logINFO, "PID = "<<myid<<" Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB");
+         }
+
+         if (refineLevel>0)
+         {
+            SetUndefinedNodesBlockVisitor undefNodesVisitor;
+            grid->accept(undefNodesVisitor);
+         }
+
+         if (myid==0) UBLOG(logINFO, "SetUndefinedNodesBlockVisitor:end");
+
+         //BC
+         intHelper.setBC();
+
+        
+         if (myid==0) UBLOG(logINFO, "intHelper.setBC():end");
+
+         if (myid==0)
+         {
+            UBLOG(logINFO, "PID = "<<myid<<" Point 6");
+            UBLOG(logINFO, "PID = "<<myid<<" Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB");
+         }
+
+         //initialization of distributions
+         InitDistributionsBlockVisitor initVisitor;
+         initVisitor.setVx1(fct);
+         grid->accept(initVisitor);
+
+         if (myid==0)
+         {
+            UBLOG(logINFO, "PID = "<<myid<<" Point 7");
+            UBLOG(logINFO, "PID = "<<myid<<" Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB");
+         }
+
+         //Post process
+         {
+            SPtr<UbScheduler> geoSch(new UbScheduler(1));
+            WriteBoundaryConditionsCoProcessor ppgeo(grid, geoSch, pathOut, WbWriterVtkXmlBinary::getInstance(), comm);
+            ppgeo.process(0);
+         }
+
+         if (myid==0)
+         {
+            UBLOG(logINFO, "PID = "<<myid<<" Point 8");
+            UBLOG(logINFO, "PID = "<<myid<<" Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB");
+         }
+
+         if (myid==0) UBLOG(logINFO, "Preprozess - end");
+      }
+      else
+      {
+         //restartCoProcessor->restart((int)restartStep);
+         migCoProcessor->restart((int)restartStep);
+         grid->setTimeStep(restartStep);
+         ////////////////////////////////////////////////////////////////////////////
+         WriteBlocksCoProcessor ppblocks(grid, SPtr<UbScheduler>(new UbScheduler(1)), pathOut, WbWriterVtkXmlBinary::getInstance(), comm);
+         ppblocks.process(0);
+         ////////////////////////////////////////////////////////////////////////////
+      }
+      
+      ////set connectors
+      SPtr<InterpolationProcessor> iProcessor(new CompressibleOffsetMomentsInterpolationProcessor());
+      dynamicPointerCast<CompressibleOffsetMomentsInterpolationProcessor>(iProcessor)->setBulkViscosity(nuLB, bulckViscosity);
+      SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
+      grid->accept(setConnsVisitor);
+
+      //bcVisitor should be accept after initialization!!!!
+      grid->accept(bcVisitor);
+      if (myid == 0) UBLOG(logINFO, "grid->accept(bcVisitor):end");
+
+      ////sponge layer
+      GbCuboid3DPtr spongeLayerX1max(new GbCuboid3D(g_maxX1-0.35, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength));
+      if (myid==0) GbSystem3D::writeGeoObject(spongeLayerX1max.get(), pathOut+"/geo/spongeLayerX1max", WbWriterVtkXmlASCII::getInstance());
+      SpongeLayerBlockVisitor slVisitorX1max(spongeLayerX1max, spKernel, nuLB, D3Q27System::E);
+      grid->accept(slVisitorX1max);
+
+      SPtr<UbScheduler> nupsSch(new UbScheduler(nupsStep[0], nupsStep[1], nupsStep[2]));
+      std::shared_ptr<CoProcessor> nupsCoProcessor(new NUPSCounterCoProcessor(grid, nupsSch, numOfThreads, comm));
+
+      SPtr<UbScheduler> stepSch(new UbScheduler(outTimeStep, outTimeStart));
+
+      if (myid==0)
+      {
+         UBLOG(logINFO, "PID = "<<myid<<" Point 9");
+         UBLOG(logINFO, "PID = "<<myid<<" Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB");
+      }
+
+      SPtr<CoProcessor> writeMQCoProcessor(new WriteMacroscopicQuantitiesCoProcessor(grid, stepSch, pathOut, WbWriterVtkXmlBinary::getInstance(), conv, comm));
+
+      SPtr<GbObject3D> bbBox(new GbCuboid3D(g_minX1-blockLength, (g_maxX2-g_minX2)/2.0, g_minX3-blockLength, g_maxX1+blockLength, (g_maxX2-g_minX2)/2.0+deltaXcoarse, g_maxX3+blockLength));
+      if (myid==0) GbSystem3D::writeGeoObject(bbBox.get(), pathOut+"/geo/bbBox", WbWriterVtkXmlASCII::getInstance());
+      SPtr<WriteMQFromSelectionCoProcessor> writeMQSelectCoProcessor(new WriteMQFromSelectionCoProcessor(grid, stepSch, bbBox, pathOut, WbWriterVtkXmlBinary::getInstance(), conv, comm));
+
+      SPtr<UbScheduler> tavSch(new UbScheduler(1, timeAvStart, timeAvStop));
+      SPtr<TimeAveragedValuesCoProcessor> tav(new TimeAveragedValuesCoProcessor(grid, pathOut, WbWriterVtkXmlBinary::getInstance(), tavSch, comm,
+         TimeAveragedValuesCoProcessor::Density | TimeAveragedValuesCoProcessor::Velocity | TimeAveragedValuesCoProcessor::Fluctuations));
+      tav->setWithGhostLayer(true);
+
+      SPtr<UbScheduler> stepMV(new UbScheduler(1, 0, 1000000));
+      SPtr<MicrophoneArrayCoProcessor> micCoProcessor(new MicrophoneArrayCoProcessor(grid, stepSch, pathOut, comm) );
+      double offsetX1 = 0.017;
+      double offsetZ1 = 0.11375;
+      std::vector<UbTupleFloat3> nodes;
+      //for (int i = 0; i <= 10; i++)
+      for (int i = 0; i <= 6; i++)
+      {
+         micCoProcessor->addMicrophone(Vector3D(0.3+deltaXcoarse+offsetX1*double(i), 0.015, 0.0-offsetZ1*double(i)));
+         nodes.push_back(UbTupleFloat3(float(0.3+deltaXcoarse+offsetX1*float(i)), float(0.015), float(0.0-offsetZ1*float(i))));
+      }
+      //double offsetX2 = 0.1;
+      //for (int i = 0; i <= 6; i++)
+      //{
+      //   micCoProcessor->addMicrophone(Vector3D(0.17+offsetX2*double(i), 0.015, -1.1375));
+      //   nodes.push_back(UbTupleFloat3(float(0.17+offsetX2*float(i)), float(0.015), float(-1.1375)));
+      //}
+      
+      if (myid==0) WbWriterVtkXmlBinary::getInstance()->writeNodes(pathOut+"/geo/mic", nodes);
+
+      //omp_set_num_threads(numOfThreads);
+      SPtr<UbScheduler> stepGhostLayer(new UbScheduler(1));
+      SPtr<Calculator> calculator(new BasicCalculator(grid, stepGhostLayer, endTime));
+      calculator->addCoProcessor(nupsCoProcessor);
+      calculator->addCoProcessor(micCoProcessor);
+      //calculator->addCoProcessor(restartCoProcessor);
+      calculator->addCoProcessor(migCoProcessor);
+      //calculator->addCoProcessor(writeMQSelectCoProcessor);
+      calculator->addCoProcessor(writeMQCoProcessor);
+      calculator->addCoProcessor(tav);
+
+
+      if (myid==0) UBLOG(logINFO, "Simulation-start");
+      calculator->calculate();
+      if (myid==0) UBLOG(logINFO, "Simulation-end");
+
+      if (myid==0)
+      {
+         UBLOG(logINFO, "PID = "<<myid<<" Point 10");
+         UBLOG(logINFO, "PID = "<<myid<<" Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB");
+      }
+   }
+   catch (std::exception& e)
+   {
+      cerr<<e.what()<<endl<<flush;
+   }
+   catch (std::string& s)
+   {
+      cerr<<s<<endl;
+   }
+   catch (...)
+   {
+      cerr<<"unknown exception"<<endl;
+   }
+
+}
+
+
+int main(int argc, char* argv[])
+{
+   //Sleep(30000);
+
+   if (argv!=NULL)
+   {
+      if (argv[1]!=NULL)
+      {
+         run(string(argv[1]));
+      }
+      else
+      {
+         cout<<"Configuration file must be set!: "<<argv[0]<<" <config file>"<<endl<<std::flush;
+      }
+   }
+
+   //test_run();
+   
+   //SuperMUC
+   //MPI_Finalize();
+
+   return 0;
+}
+
diff --git a/apps/cpu/DLR-F16/Bombadil.cfg b/apps/cpu/DLR-F16/Bombadil.cfg
index 0196e80f4e12cffd18d4b6d4524d148d6a7acd0a..f8b9ebd61b7f0b8f18bb6351dfd22acd70085800 100644
--- a/apps/cpu/DLR-F16/Bombadil.cfg
+++ b/apps/cpu/DLR-F16/Bombadil.cfg
@@ -1,27 +1,27 @@
-pathOut = d:/temp/fng
-pathGeo = d:/Projects/SFB880/FNG/A1_Forschungsdaten_Profilgeometrie_STL_CATIA_Rossian
-fngFileWhole = f16-ascii.stl
-fngFileBodyPart = f16-body-part-ascii.stl
-fngFileTrailingEdge = f16-trailing-edge-ascii.stl
-
-numOfThreads = 1
-availMem = 20e9
-refineLevel = 3
-blockNx = 16 16 16
-uLB = 0.1
-
-#x1min x1max x2min x2max x3min x3max [mm]
-boundingBox = -50 400 45 55 -60 80 
-deltaXfine = 0.1
-
-restartStep = 10000
-restartStepStart = 10000
-
-outTime = 1000
-endTime = 1000
-
-logToFile = false
-
-porousTralingEdge = false
-
+pathOut = d:/temp/fng
+pathGeo = d:/Projects/SFB880/FNG/A1_Forschungsdaten_Profilgeometrie_STL_CATIA_Rossian
+fngFileWhole = f16-ascii.stl
+fngFileBodyPart = f16-body-part-ascii.stl
+fngFileTrailingEdge = f16-trailing-edge-ascii.stl
+
+numOfThreads = 1
+availMem = 20e9
+refineLevel = 3
+blockNx = 16 16 16
+uLB = 0.1
+
+#x1min x1max x2min x2max x3min x3max [mm]
+boundingBox = -50 400 45 55 -60 80 
+deltaXfine = 0.1
+
+restartStep = 10000
+restartStepStart = 10000
+
+outTime = 1000
+endTime = 1000
+
+logToFile = false
+
+porousTralingEdge = false
+
 thinWall = false
\ No newline at end of file
diff --git a/apps/cpu/DLR-F16/DLR-F16-Phoenix.cfg b/apps/cpu/DLR-F16/DLR-F16-Phoenix.cfg
index 3cf6b61b3f2fbafe3c99bec79d2668c5db5b7833..2bb8dbd6935744104f3022d7186a84444d08f7e3 100644
--- a/apps/cpu/DLR-F16/DLR-F16-Phoenix.cfg
+++ b/apps/cpu/DLR-F16/DLR-F16-Phoenix.cfg
@@ -1,54 +1,54 @@
-pathOut = /home/koskuche/work/DLR-F16
-pathGeo = /home/koskuche/data/DLR-F16
-fngFileWhole = f16-ascii.stl
-#fngFileWhole = grundgeometrie-direkter-export.stl
-#fngFileWhole = grundgeometrie-mittel.stl
-
-#fngFileWhole = cylinder.ASCII.stl
-
-fngFileBodyPart = f16-body-part-ascii.stl
-fngFileTrailingEdge = f16-trailing-edge-ascii.stl
-zigZagTape = 2zackenbaender0.stl
-
-numOfThreads = 20
-availMem = 64e9
-refineLevel = 8
-blockNx = 7 6 7
-#blockNx = 21 6 13
-#blockNx = 294 12 247
-uLB = 0.1
-
-#x1min x1max x2min x2max x3min x3max [m]
-boundingBox = -0.90 1.20 0.035 0.065 -0.65 0.65
-#boundingBox = -0.1 0.60 0.035 0.065 -0.3 0.3
-#boundingBox = -10e-3 310e-3 0.035 0.065 -21e-3 21e-3
-
-#boundingBox = -0.255 0.27 0.035 0.065 -0.17 0.155
-#boundingBox = -0.255 0.27 0.035 0.185 -0.17 0.155
-
-#deltaXfine = 0.005 #level 0
-#deltaXfine = 0.0025 #level 1
-#deltaXfine = 0.00125 #level 2
-#deltaXfine = 0.000625 #level 3
-#deltaXfine = 0.0003125 #level 4
-#deltaXfine = 0.00015625 #level 5
-#deltaXfine = 0.000078125 #level 6
-#deltaXfine = 0.0000390625 #level 7
-deltaXfine = 0.00001953125 #level 8
-
-
-refineDistance = 0.1
-
-restartStep = 100
-restartStepStart = 100
-
-outTime = 100
-endTime = 100
-
-logToFile = true
-
-porousTralingEdge = false
-
-thinWall = false
-
-nupsStep = 10 10 10000000
+pathOut = /home/koskuche/work/DLR-F16
+pathGeo = /home/koskuche/data/DLR-F16
+fngFileWhole = f16-ascii.stl
+#fngFileWhole = grundgeometrie-direkter-export.stl
+#fngFileWhole = grundgeometrie-mittel.stl
+
+#fngFileWhole = cylinder.ASCII.stl
+
+fngFileBodyPart = f16-body-part-ascii.stl
+fngFileTrailingEdge = f16-trailing-edge-ascii.stl
+zigZagTape = 2zackenbaender0.stl
+
+numOfThreads = 20
+availMem = 64e9
+refineLevel = 8
+blockNx = 7 6 7
+#blockNx = 21 6 13
+#blockNx = 294 12 247
+uLB = 0.1
+
+#x1min x1max x2min x2max x3min x3max [m]
+boundingBox = -0.90 1.20 0.035 0.065 -0.65 0.65
+#boundingBox = -0.1 0.60 0.035 0.065 -0.3 0.3
+#boundingBox = -10e-3 310e-3 0.035 0.065 -21e-3 21e-3
+
+#boundingBox = -0.255 0.27 0.035 0.065 -0.17 0.155
+#boundingBox = -0.255 0.27 0.035 0.185 -0.17 0.155
+
+#deltaXfine = 0.005 #level 0
+#deltaXfine = 0.0025 #level 1
+#deltaXfine = 0.00125 #level 2
+#deltaXfine = 0.000625 #level 3
+#deltaXfine = 0.0003125 #level 4
+#deltaXfine = 0.00015625 #level 5
+#deltaXfine = 0.000078125 #level 6
+#deltaXfine = 0.0000390625 #level 7
+deltaXfine = 0.00001953125 #level 8
+
+
+refineDistance = 0.1
+
+restartStep = 100
+restartStepStart = 100
+
+outTime = 100
+endTime = 100
+
+logToFile = true
+
+porousTralingEdge = false
+
+thinWall = false
+
+nupsStep = 10 10 10000000
diff --git a/apps/cpu/DLR-F16/F16Bombadil.cfg b/apps/cpu/DLR-F16/F16Bombadil.cfg
index a27fbb5cf7eaddab5ea9becd3f8f18e4fe6428a2..8dcb782d09ad79474841cfd0e9f803c59f0e49aa 100644
--- a/apps/cpu/DLR-F16/F16Bombadil.cfg
+++ b/apps/cpu/DLR-F16/F16Bombadil.cfg
@@ -1,39 +1,39 @@
-pathOut = d:/temp/fngPorous
-pathGeo = d:/Projects/SFB880/FNG/A1_Forschungsdaten_Profilgeometrie_STL_CATIA_Rossian
-#fngFileWhole = f16-ascii.stl
-fngFileWhole = grundgeometrie-direkter-export.stl
-fngFileBodyPart = f16-body-part-ascii.stl
-fngFileTrailingEdge = f16-trailing-edge-ascii.stl
-zigZagTape = 2zackenbaender0.stl
-
-numOfThreads = 4
-availMem = 20e9
-refineLevel = 8
-#blockNx = 8 4 8
-blockNx = 21 6 13
-uLB = 0.1
-
-#x1min x1max x2min x2max x3min x3max [m]
-boundingBox = -0.90 1.20 0.035 0.065 -0.65 0.65
-
-#deltaXfine = 0.001
-#deltaXfine = 0.00375
-#deltaXfine = 1.46484375e-5
-#deltaXfine = 0.00001171875
-#deltaXfine = 9.765625e-6
-deltaXfine = 19.53125e-6
-#10e-6
-
-refineDistance = 0.3
-
-restartStep = 10000
-restartStepStart = 10000
-
-outTime = 1
-endTime = 2000
-
-logToFile = false
-
-porousTralingEdge = true
-
-thinWall = false
+pathOut = d:/temp/fngPorous
+pathGeo = d:/Projects/SFB880/FNG/A1_Forschungsdaten_Profilgeometrie_STL_CATIA_Rossian
+#fngFileWhole = f16-ascii.stl
+fngFileWhole = grundgeometrie-direkter-export.stl
+fngFileBodyPart = f16-body-part-ascii.stl
+fngFileTrailingEdge = f16-trailing-edge-ascii.stl
+zigZagTape = 2zackenbaender0.stl
+
+numOfThreads = 4
+availMem = 20e9
+refineLevel = 8
+#blockNx = 8 4 8
+blockNx = 21 6 13
+uLB = 0.1
+
+#x1min x1max x2min x2max x3min x3max [m]
+boundingBox = -0.90 1.20 0.035 0.065 -0.65 0.65
+
+#deltaXfine = 0.001
+#deltaXfine = 0.00375
+#deltaXfine = 1.46484375e-5
+#deltaXfine = 0.00001171875
+#deltaXfine = 9.765625e-6
+deltaXfine = 19.53125e-6
+#10e-6
+
+refineDistance = 0.3
+
+restartStep = 10000
+restartStepStart = 10000
+
+outTime = 1
+endTime = 2000
+
+logToFile = false
+
+porousTralingEdge = true
+
+thinWall = false
diff --git a/apps/cpu/DLR-F16/F16BombadilTest.cfg b/apps/cpu/DLR-F16/F16BombadilTest.cfg
index 4ee554a1cc477af62a25ffdfdc7d1fb70e817f01..3902693838407cc490b95848e28ec76b3e81fa6e 100644
--- a/apps/cpu/DLR-F16/F16BombadilTest.cfg
+++ b/apps/cpu/DLR-F16/F16BombadilTest.cfg
@@ -1,51 +1,51 @@
-pathOut = d:/temp/f16Grid_x21
-pathGeo = d:/Projects/SFB880/DLR-F16/A1_Forschungsdaten_Profilgeometrie_STL_CATIA_Rossian
-#fngFileWhole = f16-ascii.stl
-fngFileWhole = grundgeometrie-direkter-export.stl
-#fngFileWhole = grundgeometrie-mittel.stl
-fngFileBodyPart = f16-body-part-ascii.stl
-fngFileTrailingEdge = f16-trailing-edge-ascii.stl
-zigZagTape = 2zackenbaender0.stl
-
-numOfThreads = 4
-availMem = 10e9
-refineLevel = 8
-blockNx = 21 6 6
-#blockNx = 21 6 13
-#blockNx = 294 12 247
-uLB = 0.1
-
-#x1min x1max x2min x2max x3min x3max [m]
-boundingBox = -0.90 1.20 0.035 0.065 -0.65 0.65
-#boundingBox = -0.90 1.20 0.035 0.065 -0.65 0.65048
-#boundingBox = -0.1 0.60 0.035 0.065 -0.3 0.3
-#boundingBox = -10e-3 310e-3 0.035 0.065 -21e-3 21e-3
-
-#deltaXfine = 0.005 #level 0
-#deltaXfine = 0.0025 #level 1
-#deltaXfine = 0.00125 #level 2
-#deltaXfine = 0.000625 #level 3
-#deltaXfine = 0.0003125 #level 4
-#deltaXfine = 0.00015625 #level 5
-#deltaXfine = 0.000078125 #level 6
-#deltaXfine = 0.0000390625 #level 7
-deltaXfine = 0.00001953125 #level 8
-
-
-refineDistance = 0.3
-
-restartStep = 100000
-restartStepStart = 100000
-
-outTime = 1000
-endTime = 200000
-
-logToFile = false
-
-porousTralingEdge = false
-
-thinWall = false
-
-testBox=false
-
+pathOut = d:/temp/f16Grid_x21
+pathGeo = d:/Projects/SFB880/DLR-F16/A1_Forschungsdaten_Profilgeometrie_STL_CATIA_Rossian
+#fngFileWhole = f16-ascii.stl
+fngFileWhole = grundgeometrie-direkter-export.stl
+#fngFileWhole = grundgeometrie-mittel.stl
+fngFileBodyPart = f16-body-part-ascii.stl
+fngFileTrailingEdge = f16-trailing-edge-ascii.stl
+zigZagTape = 2zackenbaender0.stl
+
+numOfThreads = 4
+availMem = 10e9
+refineLevel = 8
+blockNx = 21 6 6
+#blockNx = 21 6 13
+#blockNx = 294 12 247
+uLB = 0.1
+
+#x1min x1max x2min x2max x3min x3max [m]
+boundingBox = -0.90 1.20 0.035 0.065 -0.65 0.65
+#boundingBox = -0.90 1.20 0.035 0.065 -0.65 0.65048
+#boundingBox = -0.1 0.60 0.035 0.065 -0.3 0.3
+#boundingBox = -10e-3 310e-3 0.035 0.065 -21e-3 21e-3
+
+#deltaXfine = 0.005 #level 0
+#deltaXfine = 0.0025 #level 1
+#deltaXfine = 0.00125 #level 2
+#deltaXfine = 0.000625 #level 3
+#deltaXfine = 0.0003125 #level 4
+#deltaXfine = 0.00015625 #level 5
+#deltaXfine = 0.000078125 #level 6
+#deltaXfine = 0.0000390625 #level 7
+deltaXfine = 0.00001953125 #level 8
+
+
+refineDistance = 0.3
+
+restartStep = 100000
+restartStepStart = 100000
+
+outTime = 1000
+endTime = 200000
+
+logToFile = false
+
+porousTralingEdge = false
+
+thinWall = false
+
+testBox=false
+
 nupsStep = 10 10 10000000
\ No newline at end of file
diff --git a/apps/cpu/DLR-F16/F16BombadilTest10e-6.cfg b/apps/cpu/DLR-F16/F16BombadilTest10e-6.cfg
index 9066cf548a47cbede96e5a15e51060c76283d17b..a694947ec9dc141fdb84d310ea0868d47c3dbe56 100644
--- a/apps/cpu/DLR-F16/F16BombadilTest10e-6.cfg
+++ b/apps/cpu/DLR-F16/F16BombadilTest10e-6.cfg
@@ -1,72 +1,72 @@
-pathOut = d:/temp/DLR-F16
-pathGeo = d:/Projects/SFB880/DLR-F16/A1_Forschungsdaten_Profilgeometrie_STL_CATIA_Rossian
-#fngFileWhole = f16-ascii.stl
-fngFileWhole = grundgeometrie-direkter-export.stl
-#fngFileWhole = grundgeometrie-mittel.stl
-fngFileBodyPart = f16-body-part-ascii.stl
-fngFileTrailingEdge = f16-trailing-edge-ascii.stl
-zigZagTape = 2zackenbaender0.stl
-
-numOfThreads = 1
-availMem = 13e9
-refineLevel = 9 #10
-#blockNx = 7 8 8
-#blockNx = 7 6 7
-blockNx = 21 6 13
-uLB = 0.1
-
-#x1min x1max x2min x2max x3min x3max [m]
-boundingBox = -0.90 1.20 0.035 0.065 -0.65 0.65
-
-#boundingBox = -0.90 1.1992 0.035 0.065 -0.65 0.65
-#boundingBox = -0.1 0.635 0.035 0.065 -0.3 0.3
-#boundingBox = -10e-3 310e-3 0.035 0.065 -21e-3 25e-3
-
-#boundingBox = 0 65.6e-3 35e-3 75e-3 -30e-3 0
-
-
-#deltaXfine = 5120e-6 #level 0
-#deltaXfine = 2560e-6 #level 1
-#deltaXfine = 1280e-6 #level 2
-#deltaXfine = 640e-6 #level 3
-#deltaXfine = 320e-6 #level 4
-#deltaXfine = 160e-6 #level 5
-#deltaXfine = 80e-6 #level 6
-#deltaXfine = 40e-6 #level 7
-#deltaXfine = 20e-6 #level 8
-#deltaXfine = 10e-6 #level 9
-#deltaXfine = 0.000009765625
-
-#deltaXfine = 0.005 #level 0
-#deltaXfine = 0.0025 #level 1
-#deltaXfine = 0.00125 #level 2
-#deltaXfine = 0.000625 #level 3
-#deltaXfine = 0.0003125 #level 4
-#deltaXfine = 0.00015625 #level 5
-#deltaXfine = 0.000078125 #level 6
-#deltaXfine = 0.0000390625 #level 7
-#deltaXfine = 0.00001953125 #level 8
-deltaXfine = 0.000009765625 #level 9
-
-#deltaXfine = 6.5e-6
-
-startDistance = -1.0
-refineDistance = 0.3
-
-newStart = true
-restartStep = 10
-
-cpStart = 1
-cpStep = 1
-
-outTime = 1000
-endTime = 1
-
-logToFile = false
-
-porousTralingEdge = true
-
-thinWall = false
-
-
+pathOut = d:/temp/DLR-F16
+pathGeo = d:/Projects/SFB880/DLR-F16/A1_Forschungsdaten_Profilgeometrie_STL_CATIA_Rossian
+#fngFileWhole = f16-ascii.stl
+fngFileWhole = grundgeometrie-direkter-export.stl
+#fngFileWhole = grundgeometrie-mittel.stl
+fngFileBodyPart = f16-body-part-ascii.stl
+fngFileTrailingEdge = f16-trailing-edge-ascii.stl
+zigZagTape = 2zackenbaender0.stl
+
+numOfThreads = 1
+availMem = 13e9
+refineLevel = 9 #10
+#blockNx = 7 8 8
+#blockNx = 7 6 7
+blockNx = 21 6 13
+uLB = 0.1
+
+#x1min x1max x2min x2max x3min x3max [m]
+boundingBox = -0.90 1.20 0.035 0.065 -0.65 0.65
+
+#boundingBox = -0.90 1.1992 0.035 0.065 -0.65 0.65
+#boundingBox = -0.1 0.635 0.035 0.065 -0.3 0.3
+#boundingBox = -10e-3 310e-3 0.035 0.065 -21e-3 25e-3
+
+#boundingBox = 0 65.6e-3 35e-3 75e-3 -30e-3 0
+
+
+#deltaXfine = 5120e-6 #level 0
+#deltaXfine = 2560e-6 #level 1
+#deltaXfine = 1280e-6 #level 2
+#deltaXfine = 640e-6 #level 3
+#deltaXfine = 320e-6 #level 4
+#deltaXfine = 160e-6 #level 5
+#deltaXfine = 80e-6 #level 6
+#deltaXfine = 40e-6 #level 7
+#deltaXfine = 20e-6 #level 8
+#deltaXfine = 10e-6 #level 9
+#deltaXfine = 0.000009765625
+
+#deltaXfine = 0.005 #level 0
+#deltaXfine = 0.0025 #level 1
+#deltaXfine = 0.00125 #level 2
+#deltaXfine = 0.000625 #level 3
+#deltaXfine = 0.0003125 #level 4
+#deltaXfine = 0.00015625 #level 5
+#deltaXfine = 0.000078125 #level 6
+#deltaXfine = 0.0000390625 #level 7
+#deltaXfine = 0.00001953125 #level 8
+deltaXfine = 0.000009765625 #level 9
+
+#deltaXfine = 6.5e-6
+
+startDistance = -1.0
+refineDistance = 0.3
+
+newStart = true
+restartStep = 10
+
+cpStart = 1
+cpStep = 1
+
+outTime = 1000
+endTime = 1
+
+logToFile = false
+
+porousTralingEdge = true
+
+thinWall = false
+
+
 nupsStep = 100 100 10000000
\ No newline at end of file
diff --git a/apps/cpu/DLR-F16/F16BombadilTestSmall.cfg b/apps/cpu/DLR-F16/F16BombadilTestSmall.cfg
index cce67bbcf397ce8493f52343735e7619f618f795..9b56585d541d9898a86f45779ed664626cb30d24 100644
--- a/apps/cpu/DLR-F16/F16BombadilTestSmall.cfg
+++ b/apps/cpu/DLR-F16/F16BombadilTestSmall.cfg
@@ -1,53 +1,53 @@
-pathOut = d:/temp/fng6
-pathGeo = d:/Projects/SFB880/FNG/A1_Forschungsdaten_Profilgeometrie_STL_CATIA_Rossian
-#fngFileWhole = f16-ascii.stl
-fngFileWhole = grundgeometrie-direkter-export.stl
-#fngFileWhole = grundgeometrie-mittel.stl
-fngFileBodyPart = f16-body-part-ascii.stl
-fngFileTrailingEdge = f16-trailing-edge-ascii.stl
-zigZagTape = 2zackenbaender0.stl
-
-numOfThreads = 1
-availMem = 10e9
-refineLevel = 1
-#blockNx = 8 4 8
-blockNx = 21 6 13
-#blockNx = 294 12 247
-uLB = 0.1
-
-#x1min x1max x2min x2max x3min x3max [m]
-#boundingBox = -0.90 1.20 0.035 0.065 -0.65 0.65
-#boundingBox = -0.1 0.60 0.035 0.065 -0.3 0.3
-#boundingBox = -10e-3 310e-3 0.035 0.065 -21e-3 21e-3
-
-boundingBox = -0.360 0.660 0.035 0.065 -0.30 0.30
-
-
-#deltaXfine = 0.005 #level 0
-#deltaXfine = 0.0025 #level 1
-#deltaXfine = 0.00125 #level 2
-#deltaXfine = 0.000625 #level 3
-#deltaXfine = 0.0003125 #level 4
-#deltaXfine = 0.00015625 #level 5
-#deltaXfine = 0.000078125 #level 6
-#deltaXfine = 0.0000390625 #level 7
-deltaXfine = 0.00001953125 #level 8
-
-
-refineDistance = 0.3
-
-restartStep = 100
-restartStepStart = 100
-
-outTime = 100
-endTime = 100
-
-logToFile = false
-
-porousTralingEdge = false
-
-thinWall = false
-
-testBox=true
-
+pathOut = d:/temp/fng6
+pathGeo = d:/Projects/SFB880/FNG/A1_Forschungsdaten_Profilgeometrie_STL_CATIA_Rossian
+#fngFileWhole = f16-ascii.stl
+fngFileWhole = grundgeometrie-direkter-export.stl
+#fngFileWhole = grundgeometrie-mittel.stl
+fngFileBodyPart = f16-body-part-ascii.stl
+fngFileTrailingEdge = f16-trailing-edge-ascii.stl
+zigZagTape = 2zackenbaender0.stl
+
+numOfThreads = 1
+availMem = 10e9
+refineLevel = 1
+#blockNx = 8 4 8
+blockNx = 21 6 13
+#blockNx = 294 12 247
+uLB = 0.1
+
+#x1min x1max x2min x2max x3min x3max [m]
+#boundingBox = -0.90 1.20 0.035 0.065 -0.65 0.65
+#boundingBox = -0.1 0.60 0.035 0.065 -0.3 0.3
+#boundingBox = -10e-3 310e-3 0.035 0.065 -21e-3 21e-3
+
+boundingBox = -0.360 0.660 0.035 0.065 -0.30 0.30
+
+
+#deltaXfine = 0.005 #level 0
+#deltaXfine = 0.0025 #level 1
+#deltaXfine = 0.00125 #level 2
+#deltaXfine = 0.000625 #level 3
+#deltaXfine = 0.0003125 #level 4
+#deltaXfine = 0.00015625 #level 5
+#deltaXfine = 0.000078125 #level 6
+#deltaXfine = 0.0000390625 #level 7
+deltaXfine = 0.00001953125 #level 8
+
+
+refineDistance = 0.3
+
+restartStep = 100
+restartStepStart = 100
+
+outTime = 100
+endTime = 100
+
+logToFile = false
+
+porousTralingEdge = false
+
+thinWall = false
+
+testBox=true
+
 nupsStep = 10 10 10000000
\ No newline at end of file
diff --git a/apps/cpu/DLR-F16/f16-porous.cfg b/apps/cpu/DLR-F16/f16-porous.cfg
index f28f60eeb33d0ace58adc7af3cb0c1d5f26cc6cb..703172b6993c5e53df0b7bcb492063afd7fbd729 100644
--- a/apps/cpu/DLR-F16/f16-porous.cfg
+++ b/apps/cpu/DLR-F16/f16-porous.cfg
@@ -1,78 +1,78 @@
-15
-fngFileWhole1 = grundgeometrie-direkter-export.stl
-fngFileWhole2 = f16-ascii.stl
-#fngFileWhole = grundgeometrie-mittel.stl
-fngFileBodyPart = f16-body-part-ascii.stl
-fngFileTrailingEdge = f16-trailing-edge-ascii.stl
-zigZagTape = 2zackenbaender0.stl
-#sampleFilename = f16-pte-669x2945x1119.raw
-#sampleFilename = f16-pte-669x2945x100.raw
-#sampleFilename = f16-pte-15.stl #test10_1.stl
-sampleFilename = output.stl
-
-
-#pathReInit = d:/temp/DLR-F16_L0_vx0_V
-pathReInit = d:/temp/DLR-F16_L2_init
-stepReInit = 0
-
-numOfThreads = 1
-availMem = 13e9
-
-uLB = 0.1
-
-#x1min x1max x2min x2max x3min x3max [m]
-#deltaXfine = 0.00001171875
-#deltaXfine = 0.00075
-boundingBox = -0.90 1.20 0.035 0.065 -0.65 0.65
-blockNx = 10 10 10
-
-#deltaXfine = 13393e-9
-#boundingBox = -0.90 1.19145087 0.035 0.06928608 -0.65 0.65
-#blockNx = 10 10 10
-
-#boundingBox = -0.90 1.19998697917 0.035 6.49869791667e-2 -0.65 0.65
-#deltaXfine = 1.30208333333e-5
-#blockNx = 9 9 9
-
-refineLevel = 0
-
-deltaXfine = 0.003 #level 0
-#deltaXfine = 0.0015 #level 1
-#deltaXfine = 0.00075 #level 2
-#deltaXfine = 0.000375 #level 3
-#deltaXfine = 0.0001875 #level 4
-#deltaXfine = 0.00009375 #level 5
-#deltaXfine = 0.000046875 #level 6
-#deltaXfine = 0.0000234375 #level 7
-#deltaXfine = 0.00001171875 #level 8
-#deltaXfine = 13393e-9 #level 8
-
-startDistance = -1.0
-refineDistance = 0.3
-
-writeBlocks = true
-
-newStart = true
-restartStep = 60000
-
-cpStart = 60000
-cpStep = 60000
-
-outTimeStep = 60000
-outTimeStart = 60000
-endTime = 60000
-
-logToFile = false
-
-porousTralingEdge = false
-
-thinWall = true
-
-#Cp
-pcpStart = 10
-pcpStop = 100
-p_inf = -0.00759931
-
-
-
+15
+fngFileWhole1 = grundgeometrie-direkter-export.stl
+fngFileWhole2 = f16-ascii.stl
+#fngFileWhole = grundgeometrie-mittel.stl
+fngFileBodyPart = f16-body-part-ascii.stl
+fngFileTrailingEdge = f16-trailing-edge-ascii.stl
+zigZagTape = 2zackenbaender0.stl
+#sampleFilename = f16-pte-669x2945x1119.raw
+#sampleFilename = f16-pte-669x2945x100.raw
+#sampleFilename = f16-pte-15.stl #test10_1.stl
+sampleFilename = output.stl
+
+
+#pathReInit = d:/temp/DLR-F16_L0_vx0_V
+pathReInit = d:/temp/DLR-F16_L2_init
+stepReInit = 0
+
+numOfThreads = 1
+availMem = 13e9
+
+uLB = 0.1
+
+#x1min x1max x2min x2max x3min x3max [m]
+#deltaXfine = 0.00001171875
+#deltaXfine = 0.00075
+boundingBox = -0.90 1.20 0.035 0.065 -0.65 0.65
+blockNx = 10 10 10
+
+#deltaXfine = 13393e-9
+#boundingBox = -0.90 1.19145087 0.035 0.06928608 -0.65 0.65
+#blockNx = 10 10 10
+
+#boundingBox = -0.90 1.19998697917 0.035 6.49869791667e-2 -0.65 0.65
+#deltaXfine = 1.30208333333e-5
+#blockNx = 9 9 9
+
+refineLevel = 0
+
+deltaXfine = 0.003 #level 0
+#deltaXfine = 0.0015 #level 1
+#deltaXfine = 0.00075 #level 2
+#deltaXfine = 0.000375 #level 3
+#deltaXfine = 0.0001875 #level 4
+#deltaXfine = 0.00009375 #level 5
+#deltaXfine = 0.000046875 #level 6
+#deltaXfine = 0.0000234375 #level 7
+#deltaXfine = 0.00001171875 #level 8
+#deltaXfine = 13393e-9 #level 8
+
+startDistance = -1.0
+refineDistance = 0.3
+
+writeBlocks = true
+
+newStart = true
+restartStep = 60000
+
+cpStart = 60000
+cpStep = 60000
+
+outTimeStep = 60000
+outTimeStart = 60000
+endTime = 60000
+
+logToFile = false
+
+porousTralingEdge = false
+
+thinWall = true
+
+#Cp
+pcpStart = 10
+pcpStop = 100
+p_inf = -0.00759931
+
+
+
 nupsStep = 1000 1000 10000000
\ No newline at end of file
diff --git a/apps/cpu/DLR-F16/f16.cpp b/apps/cpu/DLR-F16/f16.cpp
index 10cb017ac26ec9b4e78df89c6b08c6d32f24ab43..ca204d3807d8304dc15ca68b227a29d6ffed6f35 100644
--- a/apps/cpu/DLR-F16/f16.cpp
+++ b/apps/cpu/DLR-F16/f16.cpp
@@ -1,1305 +1,1305 @@
-#include <iostream>
-#include <string>
-
-
-#include "VirtualFluids.h"
-#include <omp.h>
-using namespace std;
-
-double rangeRandom1()
-{
-   return (2.0*rand())/RAND_MAX-1.0;
-}
-
-void setBC(SPtr<Grid3D> grid, string pathGeo, string fngFileWhole, string zigZagTape, vector<double>  boundingBox, double uLB, double rhoLB, double blockLength, SPtr<BCProcessor> bcProcessor)
-{
-   SPtr<Communicator> comm = MPICommunicator::getInstance();
-   int myid = comm->getProcessID();
-   
-   std::vector<std::vector<SPtr<Block3D>> > blockVector;
-   int minInitLevel;
-   int maxInitLevel;
-   int gridRank;
-
-   gridRank = comm->getProcessID();
-   minInitLevel = grid->getCoarsestInitializedLevel();
-   maxInitLevel = grid->getFinestInitializedLevel();
-   blockVector.resize(maxInitLevel+1);
-   for (int level = minInitLevel; level<=maxInitLevel; level++)
-   {
-      grid->getBlocks(level, gridRank, true, blockVector[level]);
-   }
-
-   for (int level = minInitLevel; level<=maxInitLevel; level++)
-   {
-      for(SPtr<Block3D> block : blockVector[level])
-      {
-         if (block)
-         {
-            SPtr<ILBMKernel> kernel = block->getKernel();
-            kernel->setBCProcessor(bcProcessor->clone(kernel));
-         }
-      }
-   }
-   
-   SetUndefinedNodesBlockVisitor undefNodesVisitor;
-   grid->accept(undefNodesVisitor);
-   
-   SPtr<BCAdapter> noSlipBCAdapter(new NoSlipBCAdapter());
-   noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NoSlipBCAlgorithm()));
-   if (myid==0) UBLOG(logINFO, "Read fngFileWhole:start");
-   SPtr<GbTriFaceMesh3D> fngMeshWhole = SPtr<GbTriFaceMesh3D>(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(pathGeo+"/"+fngFileWhole, "fngMeshWhole", GbTriFaceMesh3D::KDTREE_SAHPLIT, false));
-   if (myid==0) UBLOG(logINFO, "Read fngFileWhole:end");
-   fngMeshWhole->rotate(0.0, 0.5, 0.0);
-   SPtr<D3Q27TriFaceMeshInteractor> fngIntrWhole = SPtr<D3Q27TriFaceMeshInteractor>(new D3Q27TriFaceMeshInteractor(fngMeshWhole, grid, noSlipBCAdapter, Interactor3D::SOLID));
-
-   if (myid==0) UBLOG(logINFO, "Read zigZagTape:start");
-   string ZckbndFilename = pathGeo+"/"+zigZagTape;
-   SPtr<GbTriFaceMesh3D> meshBand1(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "zigZagTape1"));
-   meshBand1->rotate(0.0, 5, 0.0);
-   meshBand1->translate(15, 0, -12.850);
-   // Zackenband2
-   SPtr<GbTriFaceMesh3D> meshBand2(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "zigZagTape2"));
-   meshBand2->rotate(0.0, 5, 0.0);
-   meshBand2->translate(15, 5, -12.850);
-
-   SPtr<GbTriFaceMesh3D> meshBand5(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "zigZagTape5"));
-   meshBand5->rotate(0.0, -1, 0.0);
-   meshBand5->rotate(0.0, 0.0, 180.0);
-   //meshBand5->translate(30, 0, -37.3);
-   meshBand5->translate(30, 0, -37.2);
-   
-   // Zackenband6
-   SPtr<GbTriFaceMesh3D> meshBand6(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "zigZagTape6"));
-   meshBand6->rotate(0.0, -1, 0.0);
-   meshBand6->rotate(0.0, 0.0, 180.0);
-   //meshBand6->translate(30, 5, -37.3);
-   meshBand6->translate(30, 5, -37.2);
-
-   SPtr<D3Q27TriFaceMeshInteractor> triBand1Interactor(new D3Q27TriFaceMeshInteractor(meshBand1, grid, noSlipBCAdapter, Interactor3D::SOLID, Interactor3D::EDGES));
-   SPtr<D3Q27TriFaceMeshInteractor> triBand2Interactor(new D3Q27TriFaceMeshInteractor(meshBand2, grid, noSlipBCAdapter, Interactor3D::SOLID, Interactor3D::EDGES));
-   SPtr<D3Q27TriFaceMeshInteractor> triBand3Interactor(new D3Q27TriFaceMeshInteractor(meshBand5, grid, noSlipBCAdapter, Interactor3D::SOLID, Interactor3D::EDGES));
-   SPtr<D3Q27TriFaceMeshInteractor> triBand4Interactor(new D3Q27TriFaceMeshInteractor(meshBand6, grid, noSlipBCAdapter, Interactor3D::SOLID, Interactor3D::EDGES));
-
-   mu::Parser fct;
-   fct.SetExpr("U");
-   fct.DefineConst("U", uLB);
-   SPtr<BCAdapter> velBCAdapter(new VelocityBCAdapter(true, false, false, fct, 0, BCFunction::INFCONST));
-   velBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new VelocityWithDensityBCAlgorithm()));
-
-   SPtr<BCAdapter> outflowBCAdapter(new DensityBCAdapter(rhoLB));
-   outflowBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NonReflectingOutflowBCAlgorithm()));
-
-   double g_minX1 = boundingBox[0]*1000.0;
-   double g_minX2 = boundingBox[2]*1000.0;
-   double g_minX3 = boundingBox[4]*1000.0;
-
-   double g_maxX1 = boundingBox[1]*1000.0;
-   double g_maxX2 = boundingBox[3]*1000.0;
-   double g_maxX3 = boundingBox[5]*1000.0;
-   
-   GbCuboid3DPtr addWallZmin(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_minX3));
-   
-   GbCuboid3DPtr addWallZmax(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_maxX3, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength));
-   
-   SPtr<D3Q27Interactor> addWallZminInt(new D3Q27Interactor(addWallZmin, grid, velBCAdapter, Interactor3D::SOLID));
-   SPtr<D3Q27Interactor> addWallZmaxInt(new D3Q27Interactor(addWallZmax, grid, velBCAdapter, Interactor3D::SOLID));
-   //inflow
-   GbCuboid3DPtr geoInflow(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3-blockLength, g_minX1, g_maxX2+blockLength, g_maxX3+blockLength));
-   //outflow
-   GbCuboid3DPtr geoOutflow(new GbCuboid3D(g_maxX1, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength));
-   //inflow
-   SPtr<D3Q27Interactor> inflowIntr = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoInflow, grid, velBCAdapter, Interactor3D::SOLID));
-   //outflow
-   SPtr<D3Q27Interactor> outflowIntr = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoOutflow, grid, outflowBCAdapter, Interactor3D::SOLID));
-
-   SetSolidBlockVisitor v1(fngIntrWhole, BlockType::BC);
-   grid->accept(v1);
-
-   SetSolidBlockVisitor v2(triBand1Interactor, BlockType::BC);
-   grid->accept(v2);
-
-   SetSolidBlockVisitor v3(triBand1Interactor, BlockType::BC);
-   grid->accept(v3);
-
-   SetSolidBlockVisitor v4(triBand2Interactor, BlockType::BC);
-   grid->accept(v4);
-   
-   SetSolidBlockVisitor v5(triBand3Interactor, BlockType::BC);
-   grid->accept(v5);
-
-   SetSolidBlockVisitor v6(triBand4Interactor, BlockType::BC);
-   grid->accept(v6);
-
-   SetSolidBlockVisitor v7(addWallZminInt, BlockType::BC);
-   grid->accept(v7);
-
-   SetSolidBlockVisitor v8(addWallZmaxInt, BlockType::BC);
-   grid->accept(v8);
-
-   SetSolidBlockVisitor v9(inflowIntr, BlockType::BC);
-   grid->accept(v9);
-
-   SetSolidBlockVisitor v10(outflowIntr, BlockType::BC);
-   grid->accept(v10);
-   
-   inflowIntr->initInteractor();
-   outflowIntr->initInteractor();
-   addWallZminInt->initInteractor();
-   addWallZmaxInt->initInteractor();
-   fngIntrWhole->initInteractor();
-   triBand1Interactor->initInteractor();
-   triBand2Interactor->initInteractor();
-   triBand3Interactor->initInteractor();
-   triBand3Interactor->initInteractor();
-   triBand4Interactor->initInteractor();
-}
-
-void run(string configname)
-{
-   try
-   {
-
-      ConfigurationFile   config;
-      config.load(configname);
-
-      string          pathOut = config.getValue<string>("pathOut");
-      string          pathGeo = config.getValue<string>("pathGeo");
-      string          fngFileWhole1 = config.getValue<string>("fngFileWhole1");
-      string          fngFileWhole2 = config.getValue<string>("fngFileWhole2");
-      string          fngFileTrailingEdge = config.getValue<string>("fngFileTrailingEdge");
-      string          fngFileBodyPart = config.getValue<string>("fngFileBodyPart");
-      string          zigZagTape = config.getValue<string>("zigZagTape");
-      int             numOfThreads = config.getValue<int>("numOfThreads");
-      vector<int>     blockNx = config.getVector<int>("blockNx");
-      vector<double>  boundingBox = config.getVector<double>("boundingBox");
-      double          uLB = config.getValue<double>("uLB");
-      double          restartStep = config.getValue<double>("restartStep");
-      double          cpStart = config.getValue<double>("cpStart");
-      double          cpStep = config.getValue<double>("cpStep");
-      double          endTime = config.getValue<double>("endTime");
-      double          outTimeStep = config.getValue<double>("outTimeStep");
-      double          outTimeStart = config.getValue<double>("outTimeStart");
-      double          availMem = config.getValue<double>("availMem");
-      int             refineLevel = config.getValue<int>("refineLevel");
-      bool            logToFile = config.getValue<bool>("logToFile");
-      bool            porousTralingEdge = config.getValue<bool>("porousTralingEdge");
-      double          deltaXfine = config.getValue<double>("deltaXfine")*1000.0;
-      bool            thinWall = config.getValue<bool>("thinWall");
-      double          refineDistance = config.getValue<double>("refineDistance");
-      double          startDistance = config.getValue<double>("startDistance");
-      vector<double>  nupsStep = config.getVector<double>("nupsStep");
-      bool            newStart = config.getValue<bool>("newStart");
-      bool            writeBlocks = config.getValue<bool>("writeBlocks");
-      string          sampleFilename = config.getValue<string>("sampleFilename");
-      string          pathReInit = config.getValue<string>("pathReInit");
-      int             stepReInit = config.getValue<int>("stepReInit");
-      
-      double          pcpStart = config.getValue<double>("pcpStart");
-      double          pcpStop  = config.getValue<double>("pcpStop");
-      //double          p_inf    = config.getValue<double>("p_inf");
-      
-      double          timeAvStart       = config.getValue<double>("timeAvStart");
-      double          timeAvStop        = config.getValue<double>("timeAvStop");
-      
-      int             chunk = config.getValue<int>("chunk");
-
-
-      SPtr<Communicator> comm = MPICommunicator::getInstance();
-      int myid = comm->getProcessID();
-
-      if (logToFile)
-      {
-#if defined(__unix__)
-         if (myid==0)
-         {
-            const char* str = pathOut.c_str();
-            mkdir(str, S_IRWXU|S_IRWXG|S_IROTH|S_IXOTH);
-         }
-#endif 
-
-         if (myid==0)
-         {
-            stringstream logFilename;
-            logFilename<<pathOut+"/logfile"+UbSystem::toString(UbSystem::getTimeStamp())+".txt";
-            UbLog::output_policy::setStream(logFilename.str());
-         }
-      }
-
-      if (myid==0)
-      {
-         UBLOG(logINFO, "PID = "<<myid<<" Point 1");
-         UBLOG(logINFO, "PID = "<<myid<<" Total Physical Memory (RAM): "<<Utilities::getTotalPhysMem());
-         UBLOG(logINFO, "PID = "<<myid<<" Physical Memory currently used: "<<Utilities::getPhysMemUsed());
-         UBLOG(logINFO, "PID = "<<myid<<" Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB");
-      }
-
-
-      //the geometry is in mm
-
-      double g_minX1 = boundingBox[0]*1000.0;
-      double g_minX2 = boundingBox[2]*1000.0;
-      double g_minX3 = boundingBox[4]*1000.0;
-
-      double g_maxX1 = boundingBox[1]*1000.0;
-      double g_maxX2 = boundingBox[3]*1000.0;
-      double g_maxX3 = boundingBox[5]*1000.0;
-
-      //////////////////////////////////////////////////////////////////////////
-      double deltaXcoarse = deltaXfine*(double)(1<<refineLevel);
-      //double nx2_temp = floor((g_maxX2 - g_minX2) / (deltaXcoarse*(double)blockNx[0]));
-
-      //deltaXcoarse = (g_maxX2 - g_minX2) / (nx2_temp*(double)blockNx[0]);
-      //UBLOG(logINFO, "nx2_temp:"<<nx2_temp);
-      //g_maxX2 -= 0.5* deltaXcoarse;
-      //////////////////////////////////////////////////////////////////////////
-      double blockLength = (double)blockNx[0]*deltaXcoarse;
-
-      //##########################################################################
-      //## physical parameters
-      //##########################################################################
-      double Re = 1e6;
-
-      double rhoLB = 0.0;
-      double rhoReal = 1.2041; //(kg/m3)
-      //double nueReal = 153.5e-7; //m^2/s
-      double uReal = 55; //m/s
-      double lReal = 0.3;//m
-      //double uReal = Re*nueReal / lReal;
-      double nuReal = (uReal*lReal)/Re; //m^2/s
-
-      //##Machzahl:
-      //#Ma     = uReal/csReal
-      double Ma = 0.15;//Ma-Real!
-      //double csReal = uReal / Ma;
-      //double hLB = lReal / deltaXcoarse;
-
-      //LBMUnitConverter unitConverter(lReal, csReal, rhoReal, hLB);
-
-      //double u_LB = uReal   * unitConverter.getFactorVelocityWToLb();
-      //double nu_LB = nueReal * unitConverter.getFactorViscosityWToLb();
-      double lLB = lReal*1000.0/deltaXcoarse;
-      double nuLB = (uLB*lLB)/Re; //0.005;
-      //double nuLB = 0.005;
-
-      SPtr<LBMUnitConverter> conv = SPtr<LBMUnitConverter>(new LBMUnitConverter());
-
-      const int baseLevel = 0;
-
-      ////////////////////////////////////////////////////////////////////////
-      //Grid
-      //////////////////////////////////////////////////////////////////////////
-      SPtr<Grid3D> grid(new Grid3D(comm));
-
-      //BC adapters
-      SPtr<BCAdapter> noSlipBCAdapter(new NoSlipBCAdapter());
-      if (thinWall)
-      {
-         noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new ThinWallNoSlipBCAlgorithm()));
-      }
-      else
-      {
-         noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NoSlipBCAlgorithm()));
-      }
-
-      SPtr<BCAdapter> slipBCAdapter(new SlipBCAdapter());
-      slipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new SlipBCAlgorithm()));
-
-      mu::Parser fct;
-      fct.SetExpr("U");
-      fct.DefineConst("U", uLB);
-      SPtr<BCAdapter> velBCAdapter(new VelocityBCAdapter(true, false, false, fct, 0, BCFunction::INFCONST));
-      velBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new VelocityWithDensityBCAlgorithm()));
-      //velBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new VelocityBCAlgorithm()));
-
-      SPtr<BCAdapter> outflowBCAdapter(new DensityBCAdapter(rhoLB));
-      outflowBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NonReflectingOutflowBCAlgorithm()));
-      //denBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NonEqDensityBCAlgorithm()));
-
-      BoundaryConditionsBlockVisitor bcVisitor;
-      bcVisitor.addBC(noSlipBCAdapter);
-      //bcVisitor.addBC(slipBCAdapter);
-      bcVisitor.addBC(velBCAdapter);
-      bcVisitor.addBC(outflowBCAdapter);
-
-      SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new CompressibleCumulant2LBMKernel(blockNx[0], blockNx[1], blockNx[2], CompressibleCumulant2LBMKernel::NORMAL));
-      SPtr<BCProcessor> bcProc;
-      if (thinWall)
-      {
-         bcProc = SPtr<BCProcessor>(new ThinWallBCProcessor());
-      }
-      else
-      {
-         bcProc = SPtr<BCProcessor>(new BCProcessor());
-      }
-      kernel->setBCProcessor(bcProc);
-      //////////////////////////////////////////////////////////////////////////
-      //restart
-      SPtr<UbScheduler> rSch(new UbScheduler(cpStep, cpStart));
-      //MPIIORestartCoProcessor rcp(grid, rSch, pathOut, comm);
-      //rcp.setChunk(chunk);
-      
-      SPtr<UbScheduler> rSch2(new UbScheduler(restartStep));
-      //RestartCoProcessor rp(grid, rSch2, comm, pathOut, RestartCoProcessor::BINARY);
-     
-      //MPIIORestart2CoProcessor rcp2(grid, rSch2, pathOut+"/mpiio2", comm);      
-      //rcp2.setLBMKernel(kernel);
-      //rcp2.setBCProcessor(bcProc);
-      
-      
-      MPIIORestart1CoProcessor rcp3(grid, rSch, pathOut+"/mpiio3", comm);
-      rcp3.setLBMKernel(kernel);
-      rcp3.setBCProcessor(bcProc);
-      
-      //MPIIORestart3CoProcessor rcp4(grid, rSch, pathOut+"/mpiio4", comm);
-      //rcp4.setLBMKernel(kernel);
-      //rcp4.setBCProcessor(bcProc);
-      //////////////////////////////////////////////////////////////////////////
-
-
-      if (myid==0)
-      {
-         UBLOG(logINFO, "PID = "<<myid<<" Point 2");
-         UBLOG(logINFO, "PID = "<<myid<<" Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB");
-      }
-
-      //if (grid->getTimeStep() == 0)
-      if (newStart)
-      {
-         ////////////////////////////////////////////////////////////////////////
-         //define grid
-         //////////////////////////////////////////////////////////////////////////
-         grid->setDeltaX(deltaXcoarse);
-         grid->setBlockNX(blockNx[0], blockNx[1], blockNx[2]);
-
-         SPtr<GbObject3D> gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
-         if (myid==0) GbSystem3D::writeGeoObject(gridCube.get(), pathOut+"/geo/gridCube", WbWriterVtkXmlASCII::getInstance());
-         GenBlocksGridVisitor genBlocks(gridCube);
-         grid->accept(genBlocks);
-
-         grid->setPeriodicX1(false);
-         grid->setPeriodicX2(true);
-         grid->setPeriodicX3(false);
-
-         if (myid==0)
-         {
-            UBLOG(logINFO, "Parameters:");
-            UBLOG(logINFO, "* Re                  = "<<Re);
-            UBLOG(logINFO, "* Ma                  = "<<Ma);
-            UBLOG(logINFO, "* velocity (uReal)    = "<<uReal<<" m/s");
-            UBLOG(logINFO, "* viscosity (nuReal)  = "<<nuReal<<" m^2/s");
-            UBLOG(logINFO, "* chord length (lReal)= "<<lReal<<" m");
-            UBLOG(logINFO, "* velocity LB (uLB)   = "<<uLB);
-            UBLOG(logINFO, "* viscosity LB (nuLB) = "<<nuLB);
-            UBLOG(logINFO, "* chord length (l_LB) = "<<lLB<<" dx_base");
-            UBLOG(logINFO, "* dx_base             = "<<deltaXcoarse/1000<<" m");
-            UBLOG(logINFO, "* dx_refine           = "<<deltaXfine/1000<<" m");
-            UBLOG(logINFO, "* blocknx             = "<<blockNx[0]<<"x"<<blockNx[1]<<"x"<<blockNx[2]);
-            UBLOG(logINFO, "* refineDistance      = "<<refineDistance);
-            UBLOG(logINFO, "* number of levels    = "<<refineLevel+1);
-            UBLOG(logINFO, "* number of threads   = "<<numOfThreads);
-            UBLOG(logINFO, "* number of processes = "<<comm->getNumberOfProcesses());
-            UBLOG(logINFO, "Preprozess - start");
-         }
-
-         SPtr<GbTriFaceMesh3D> fngMeshWhole1;
-         SPtr<GbTriFaceMesh3D> fngMeshWhole2;
-         SPtr<GbTriFaceMesh3D> fngMeshBodyPart;
-         SPtr<GbTriFaceMesh3D> fngMeshTrailingEdge;
-         SPtr<GbTriFaceMesh3D> porousTrailingEdge;
-         if (porousTralingEdge)
-         {
-            if (myid==0) UBLOG(logINFO, "Read fngFileBodyPart:start");
-            fngMeshBodyPart = SPtr<GbTriFaceMesh3D>(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(pathGeo+"/"+fngFileBodyPart, "fngMeshBody", GbTriFaceMesh3D::KDTREE_SAHPLIT, false));
-            if (myid==0) UBLOG(logINFO, "Read fngFileBodyPart:end");
-            fngMeshBodyPart->rotate(0.0, 0.5, 0.0);
-            if (myid==0) GbSystem3D::writeGeoObject(fngMeshBodyPart.get(), pathOut+"/geo/fngMeshBody", WbWriterVtkXmlBinary::getInstance());
-
-            if (myid==0) UBLOG(logINFO, "Read fngFileTrailingEdge:start");
-            fngMeshTrailingEdge = SPtr<GbTriFaceMesh3D>(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(pathGeo+"/"+fngFileTrailingEdge, "fngMeshTrailingEdge", GbTriFaceMesh3D::KDTREE_SAHPLIT, false));
-            if (myid==0) UBLOG(logINFO, "Read fngFileTrailingEdge:end");
-            fngMeshTrailingEdge->rotate(0.0, 0.5, 0.0);
-            fngMeshTrailingEdge->translate(-0.05, 0, 1.3);
-            if (myid==0) GbSystem3D::writeGeoObject(fngMeshTrailingEdge.get(), pathOut+"/geo/fngMeshTrailingEdge", WbWriterVtkXmlBinary::getInstance());
-
-            if (myid==0) UBLOG(logINFO, "Read porousTrailingEdge:start");
-            //porousTrailingEdge = SPtr<GbTriFaceMesh3D>(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(pathGeo+"/"+sampleFilename, "porousTrailingEdge", GbTriFaceMesh3D::KDTREE_SAHPLIT, false));
-            porousTrailingEdge = SPtr<GbTriFaceMesh3D>(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile2(pathGeo+"/"+sampleFilename, "porousTrailingEdge", GbTriFaceMesh3D::KDTREE_SAHPLIT, false));
-            if (myid==0) UBLOG(logINFO, "Read porousTrailingEdge:end");
-            porousTrailingEdge->rotate(90, -90, 0.0);
-            porousTrailingEdge->rotate(0, -4.3, 0.0);
-            //porousTrailingEdge->translate(280.5, 40.0, 3.5);
-            porousTrailingEdge->translate(276, 15.95, 3.5);
-            if (myid==0) GbSystem3D::writeGeoObject(porousTrailingEdge.get(), pathOut+"/geo/porousTrailingEdge", WbWriterVtkXmlASCII::getInstance());
-
-            //string samplePathname = pathGeo+"/"+sampleFilename;
-
-            //int pmNX1 = 669;
-            //int pmNX2 = 2945;
-            //int pmNX3 = 100;
-
-            //double deltaVoxelX1 = 13393e-6;
-            //double deltaVoxelX2 = 13393e-6;
-            //double deltaVoxelX3 = 13393e-6;
-
-            //double lthreshold = 11538;
-            //double uthreshold = 65535;
-
-            //if (myid==0) UBLOG(logINFO, "read voxel matrix: start");
-            //GbVoxelMatrix3DPtr porousTrailingEdge(new GbVoxelMatrix3D(pmNX1, pmNX2, pmNX3, 0.0 , lthreshold, uthreshold));
-            //porousTrailingEdge->readMatrixFromRawFile<unsigned short>(samplePathname, GbVoxelMatrix3D::BigEndian);
-            //porousTrailingEdge->setVoxelMatrixDelta((float)deltaVoxelX1, (float)deltaVoxelX2, (float)deltaVoxelX3);
-            //porousTrailingEdge->setVoxelMatrixMininum(0.0, 0.0, 0.0);
-            //if (myid==0) UBLOG(logINFO, "read voxel matrix: end");
-
-            //if (myid==0) UBLOG(logINFO, "rotate voxel matrix: start");
-            //porousTrailingEdge->rotate90aroundZ();
-            //porousTrailingEdge->rotate90aroundZ();
-            //porousTrailingEdge->rotate90aroundZ();
-            //porousTrailingEdge->rotate90aroundX();
-            //porousTrailingEdge->rotateAroundY(0.07);
-            //porousTrailingEdge->translate(276, 15.95, 3.26);
-            //
-            //if (myid==0) UBLOG(logINFO, "rotate voxel matrix: end");
-
-            ////if (myid==0) porousTrailingEdge->writeToVTKImageDataASCII(pathOut+"/geo/PorousTrailingEdge");
-            //if (myid==0) porousTrailingEdge->writeToVTKImageDataAppended(pathOut+"/geo/PorousTrailingEdge");
-
-         }
-         else
-         {
-            //if (myid==0) UBLOG(logINFO, "Read fngFileWhole1:start");
-            //fngMeshWhole1 = SPtr<GbTriFaceMesh3D>(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(pathGeo+"/"+fngFileWhole1, "fngMeshWhole1", GbTriFaceMesh3D::KDTREE_SAHPLIT, false));
-            //if (myid==0) UBLOG(logINFO, "Read fngFileWhole1:end");
-            //fngMeshWhole1->rotate(0.0, 0.5, 0.0);
-            //if (myid==0) GbSystem3D::writeGeoObject(fngMeshWhole1.get(), pathOut+"/geo/fngMeshWhole1", WbWriterVtkXmlBinary::getInstance());
-            
-            if (myid==0) UBLOG(logINFO, "Read fngFileWhole2:start");
-            fngMeshWhole2 = SPtr<GbTriFaceMesh3D>(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(pathGeo+"/"+fngFileWhole2, "fngMeshWhole2", GbTriFaceMesh3D::KDTREE_SAHPLIT, false));
-            if (myid==0) UBLOG(logINFO, "Read fngFileWhole2:end");
-            fngMeshWhole2->rotate(0.0, 0.5, 0.0);
-            if (myid==0) GbSystem3D::writeGeoObject(fngMeshWhole2.get(), pathOut+"/geo/fngMeshWhole2", WbWriterVtkXmlBinary::getInstance());
-         }
-
-         //////////////////////////////////////////////////////////////////////////
-         // Zackenband
-         //////////////////////////////////////////////////////////////////////////
-         //top
-         //////////////////////////////////////////////////////////////////////////
-         if (myid==0) UBLOG(logINFO, "Read zigZagTape:start");
-         string ZckbndFilename = pathGeo+"/"+zigZagTape;
-         SPtr<GbTriFaceMesh3D> meshBand1(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "zigZagTape1"));
-         meshBand1->rotate(0.0, 5, 0.0);
-         meshBand1->translate(15, 0, -12.850);
-         if (myid==0) GbSystem3D::writeGeoObject(meshBand1.get(), pathOut+"/geo/zigZagTape1", WbWriterVtkXmlASCII::getInstance());
-         // Zackenband2
-         SPtr<GbTriFaceMesh3D> meshBand2(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "zigZagTape2"));
-         meshBand2->rotate(0.0, 5, 0.0);
-         meshBand2->translate(15, 5, -12.850);
-         if (myid==0) GbSystem3D::writeGeoObject(meshBand2.get(), pathOut+"/geo/zigZagTape2", WbWriterVtkXmlASCII::getInstance());
-         //// Zackenband3
-         //SPtr<GbTriFaceMesh3D> meshBand3(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "zigZagTape3"));
-         //meshBand3->rotate(0.0, 5, 0.0);
-         //meshBand3->translate(15, 0, -12.35);
-         //if (myid==0) GbSystem3D::writeGeoObject(meshBand3.get(), pathOut+"/geo/zigZagTape3", WbWriterVtkXmlASCII::getInstance());
-         //// Zackenband4
-         //SPtr<GbTriFaceMesh3D> meshBand4(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "zigZagTape4"));
-         //meshBand4->rotate(0.0, 5, 0.0);
-         //meshBand4->translate(15, 5, -12.35);
-         //if (myid==0) GbSystem3D::writeGeoObject(meshBand4.get(), pathOut+"/geo/zigZagTape4", WbWriterVtkXmlASCII::getInstance());
-
-         //bottom
-         SPtr<GbTriFaceMesh3D> meshBand5(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "zigZagTape5"));
-         meshBand5->rotate(0.0, -1, 0.0);
-         meshBand5->rotate(0.0, 0.0, 180.0);
-         //meshBand5->translate(30, 0, -37.3);
-         meshBand5->translate(30, 0, -37.2);
-         if (myid==0) GbSystem3D::writeGeoObject(meshBand5.get(), pathOut+"/geo/zigZagTape5", WbWriterVtkXmlASCII::getInstance());
-         // Zackenband6
-         SPtr<GbTriFaceMesh3D> meshBand6(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "zigZagTape6"));
-         meshBand6->rotate(0.0, -1, 0.0);
-         meshBand6->rotate(0.0, 0.0, 180.0);
-         //meshBand6->translate(30, 5, -37.3);
-         meshBand6->translate(30, 5, -37.2);
-         if (myid==0) GbSystem3D::writeGeoObject(meshBand6.get(), pathOut+"/geo/zigZagTape6", WbWriterVtkXmlASCII::getInstance());
-         //// Zackenband7
-         //SPtr<GbTriFaceMesh3D> meshBand7(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "zigZagTape7"));
-         //meshBand7->rotate(0.0, 5, 0.0);
-         //meshBand7->translate(15, 0, -12.35);
-         //if (myid==0) GbSystem3D::writeGeoObject(meshBand7.get(), pathOut+"/geo/zigZagTape7", WbWriterVtkXmlASCII::getInstance());
-         //// Zackenband8
-         //SPtr<GbTriFaceMesh3D> meshBan8(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "zigZagTape8"));
-         //meshBan8->rotate(0.0, 5, 0.0);
-         //meshBan8->translate(15, 5, -12.35);
-         //if (myid==0) GbSystem3D::writeGeoObject(meshBan8.get(), pathOut+"/geo/zigZagTape8", WbWriterVtkXmlASCII::getInstance());
-         if (myid==0) UBLOG(logINFO, "Read zigZagTape:end");
-
-
-         if (myid==0)
-         {
-            UBLOG(logINFO, "PID = "<<myid<<" Point 3");
-            UBLOG(logINFO, "PID = "<<myid<<" Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB");
-         }
-         //////////////////////////////////////////////////////////////////////////
-         //return;
-
-         //SPtr<Interactor3D> fngIntrWhole1;
-         SPtr<Interactor3D> fngIntrWhole2;
-         SPtr<Interactor3D> fngIntrBodyPart;
-         SPtr<Interactor3D> fngIntrTrailingEdge;
-         SPtr<Interactor3D> porousIntrTrailingEdge;
-
-         if (porousTralingEdge)
-         {
-            fngIntrBodyPart = SPtr<D3Q27TriFaceMeshInteractor>(new D3Q27TriFaceMeshInteractor(fngMeshBodyPart, grid, noSlipBCAdapter, Interactor3D::SOLID, Interactor3D::EDGES));
-            fngIntrTrailingEdge = SPtr<D3Q27TriFaceMeshInteractor>(new D3Q27TriFaceMeshInteractor(fngMeshTrailingEdge, grid, noSlipBCAdapter, Interactor3D::SOLID, Interactor3D::EDGES));
-            porousIntrTrailingEdge = SPtr<D3Q27TriFaceMeshInteractor>(new D3Q27TriFaceMeshInteractor(porousTrailingEdge, grid, noSlipBCAdapter, Interactor3D::SOLID, Interactor3D::EDGES));
-         }
-         else
-         {
-            //fngIntrWhole1 = SPtr<D3Q27TriFaceMeshInteractor>(new D3Q27TriFaceMeshInteractor(fngMeshWhole1, grid, noSlipBCAdapter, Interactor3D::SOLID));
-            fngIntrWhole2 = SPtr<D3Q27TriFaceMeshInteractor>(new D3Q27TriFaceMeshInteractor(fngMeshWhole2, grid, noSlipBCAdapter, Interactor3D::SOLID));//, Interactor3D::POINTS));
-         }
-
-         SPtr<D3Q27TriFaceMeshInteractor> triBand1Interactor(new D3Q27TriFaceMeshInteractor(meshBand1, grid, noSlipBCAdapter, Interactor3D::SOLID, Interactor3D::EDGES));
-         SPtr<D3Q27TriFaceMeshInteractor> triBand2Interactor(new D3Q27TriFaceMeshInteractor(meshBand2, grid, noSlipBCAdapter, Interactor3D::SOLID, Interactor3D::EDGES));
-         SPtr<D3Q27TriFaceMeshInteractor> triBand3Interactor(new D3Q27TriFaceMeshInteractor(meshBand5, grid, noSlipBCAdapter, Interactor3D::SOLID, Interactor3D::EDGES));
-         SPtr<D3Q27TriFaceMeshInteractor> triBand4Interactor(new D3Q27TriFaceMeshInteractor(meshBand6, grid, noSlipBCAdapter, Interactor3D::SOLID, Interactor3D::EDGES));
-
-         if (refineLevel>0&&myid==0&&writeBlocks)
-         {
-            if (myid==0) UBLOG(logINFO, "Refinement - start");
-            //RefineCrossAndInsideGbObjectHelper refineHelper(grid, refineLevel);
-            //refineHelper.addGbObject(geo, refineLevel);
-            //refineHelper.refine();
-
-            //RefineAroundGbObjectHelper refineHelper1(grid, refineLevel-1, boost::dynamic_pointer_cast<D3Q27TriFaceMeshInteractor>(geoIntr1), 0.0, 10.0, comm);
-            //refineHelper1.refine();
-            //RefineAroundGbObjectHelper refineHelper2(grid, refineLevel, boost::dynamic_pointer_cast<D3Q27TriFaceMeshInteractor>(geoIntr2), -1.0, 5.0, comm);
-            //refineHelper2.refine();
-
-
-            int rank = grid->getRank();
-            grid->setRank(0);
-
-            if (porousTralingEdge)
-            {
-                dynamicPointerCast<D3Q27TriFaceMeshInteractor>(fngIntrBodyPart)->refineBlockGridToLevel(refineLevel-1, startDistance, refineDistance);
-            }
-            else
-            {
-                dynamicPointerCast<D3Q27TriFaceMeshInteractor>(fngIntrWhole2)->refineBlockGridToLevel(refineLevel, startDistance, refineDistance);
-            }
-
-            //boost::dynamic_pointer_cast<D3Q27TriFaceMeshInteractor>(triBand1Interactor)->refineBlockGridToLevel(refineLevel, 0.0, refineDistance);
-            //boost::dynamic_pointer_cast<D3Q27TriFaceMeshInteractor>(triBand2Interactor)->refineBlockGridToLevel(refineLevel, 0.0, refineDistance);
-            //boost::dynamic_pointer_cast<D3Q27TriFaceMeshInteractor>(triBand3Interactor)->refineBlockGridToLevel(refineLevel, 0.0, refineDistance);
-            //boost::dynamic_pointer_cast<D3Q27TriFaceMeshInteractor>(triBand4Interactor)->refineBlockGridToLevel(refineLevel, 0.0, refineDistance);
-
-
-            //SPtr<GbObject3D> fngBox(new GbCuboid3D(fngMeshWhole->getX1Minimum(), fngMeshWhole->getX2Minimum(), fngMeshWhole->getX3Minimum(),
-            //                                    fngMeshWhole->getX1Maximum(), fngMeshWhole->getX2Maximum(), fngMeshWhole->getX3Maximum()));
-            //if (myid==0) GbSystem3D::writeGeoObject(fngBox.get(), pathOut+"/geo/fngBox", WbWriterVtkXmlASCII::getInstance());
-
-            //RefineCrossAndInsideGbObjectBlockVisitor refVisitor0(fngBox, refineLevel);
-            //grid->accept(refVisitor0);
-
-
-            //SPtr<GbObject3D> bandTopBox(new GbCuboid3D(meshBand1->getX1Minimum(), meshBand1->getX2Minimum(), meshBand1->getX3Minimum(),
-            //   meshBand1->getX1Maximum(), meshBand1->getX2Maximum(), meshBand1->getX3Maximum()));
-            //if (myid==0) GbSystem3D::writeGeoObject(bandTopBox.get(), pathOut+"/geo/bandTopBox", WbWriterVtkXmlASCII::getInstance());
-
-            //RefineCrossAndInsideGbObjectBlockVisitor refVisitor1(bandTopBox, refineLevel-1);
-            //grid->accept(refVisitor1);
-
-            //SPtr<GbObject3D> bandBottomBox(new GbCuboid3D(meshBand5->getX1Minimum(), meshBand5->getX2Minimum(), meshBand5->getX3Minimum(),
-            //   meshBand5->getX1Maximum(), meshBand5->getX2Maximum(), meshBand5->getX3Maximum()));
-            //if (myid==0) GbSystem3D::writeGeoObject(bandBottomBox.get(), pathOut+"/geo/bandBottomBox", WbWriterVtkXmlASCII::getInstance());
-
-            //RefineCrossAndInsideGbObjectBlockVisitor refVisitor2(bandBottomBox, refineLevel-1);
-            //grid->accept(refVisitor2);
-
-            //SPtr<GbObject3D> teBox1(new GbCuboid3D(269.0, 0.0, 1.0, 270.0, 100.0, 8.5));
-            // for porous teY
-            //SPtr<GbObject3D> teBox1(new GbCuboid3D(269.0, 0.0, -10.0, 310.0, 100.0, 20.5));
-            //SPtr<GbObject3D> teBox1(new GbCuboid3D(200.0, 0.0, -20.0, 400.0, 100.0, 20.0));
-            //if (myid==0) GbSystem3D::writeGeoObject(teBox1.get(), pathOut+"/geo/teBox1", WbWriterVtkXmlASCII::getInstance());
-
-            //RefineCrossAndInsideGbObjectBlockVisitor refVisitor3(teBox1, 5);
-            //grid->accept(refVisitor3);
-
-            //SPtr<GbObject3D> teBox2(new GbCuboid3D(271.0, 0.0, 3.0, 279.0, 100.0, 5.7));
-            //if (myid==0) GbSystem3D::writeGeoObject(teBox2.get(), pathOut+"/geo/teBox2", WbWriterVtkXmlASCII::getInstance());
-
-            //RefineCrossAndInsideGbObjectBlockVisitor refVisitor4(teBox2, refineLevel);
-            //grid->accept(refVisitor4);
-
-            //level 1
-            SPtr<GbObject3D> wakeBoxL1(new GbCuboid3D(200.0, 0.0, -20.0, 2000.0, 100.0, 20.0));
-            if (myid==0) GbSystem3D::writeGeoObject(wakeBoxL1.get(), pathOut+"/geo/wakeBoxL1", WbWriterVtkXmlASCII::getInstance());
-            RefineCrossAndInsideGbObjectBlockVisitor refVisitorWakeBoxL1(wakeBoxL1, 1);
-            grid->accept(refVisitorWakeBoxL1);
-            
-            //level 4
-            //SPtr<GbObject3D> teBoxL5(new GbCuboid3D(200.0, 0.0, -20.0, 400.0, 100.0, 20.0));
-            //if (myid==0) GbSystem3D::writeGeoObject(teBoxL5.get(), pathOut+"/geo/teBoxL5", WbWriterVtkXmlASCII::getInstance());
-            //RefineCrossAndInsideGbObjectBlockVisitor refVisitorTeBoxL5(teBoxL5, 4);
-            //grid->accept(refVisitorTeBoxL5);
-            
-            //level 5
-            //SPtr<GbObject3D> teBoxL6(new GbCuboid3D(270.0, 0.0, -3.0, 320.0, 100.0, 10.0));
-            //if (myid==0) GbSystem3D::writeGeoObject(teBoxL6.get(), pathOut+"/geo/teBoxL6", WbWriterVtkXmlASCII::getInstance());
-            //RefineCrossAndInsideGbObjectBlockVisitor refVisitorTeBoxL6(teBoxL6, 5);
-            //grid->accept(refVisitorTeBoxL6);
-
-            grid->setRank(rank);
-
-            {
-               WriteBlocksCoProcessor ppblocks(grid, SPtr<UbScheduler>(new UbScheduler(1)), pathOut, WbWriterVtkXmlBinary::getInstance(), comm);
-               ppblocks.process(0);
-            }
-
-            ////////////////////////////////////////////
-            //METIS
-            //SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::BSW, MetisPartitioner::KWAY));
-            ////////////////////////////////////////////
-            /////delete solid blocks
-            if (myid==0) UBLOG(logINFO, "deleteSolidBlocks - start");
-            //InteractorsHelper intHelper(grid, metisVisitor);
-            //if (porousTralingEdge)
-            //{
-            //   intHelper.addInteractor(fngIntrBodyPart);
-            //}
-            //else
-            //{
-            //   intHelper.addInteractor(fngIntrWhole);
-            //}
-            //////////////////////////////////////////////////////////////////////////
-
-            //intHelper.selectBlocks();
-
-            if (porousTralingEdge)
-            {
-               SetSolidBlockVisitor v(fngIntrBodyPart, BlockType::SOLID);
-               grid->accept(v);
-               std::vector<SPtr<Block3D>>& sb = fngIntrBodyPart->getSolidBlockSet();
-               for(SPtr<Block3D> block : sb)
-               {
-                  grid->deleteBlock(block);
-               }
-               fngIntrBodyPart->removeSolidBlocks();
-               fngIntrBodyPart->removeBcBlocks();
-            }
-            else
-            {
-               SetSolidBlockVisitor v(fngIntrWhole2, BlockType::SOLID);
-               grid->accept(v);
-               std::vector<SPtr<Block3D>>& sb = fngIntrWhole2->getSolidBlockSet();
-               for(SPtr<Block3D> block : sb)
-               {
-                  grid->deleteBlock(block);
-               }
-               fngIntrWhole2->removeSolidBlocks();
-               fngIntrWhole2->removeBcBlocks();
-            }
-
-            if (myid==0) UBLOG(logINFO, "deleteSolidBlocks - end");
-            //////////////////////////////////////
-
-            //if (porousTralingEdge)
-            //{
-            //   grid->setRank(0);
-            //   boost::dynamic_pointer_cast<D3Q27TriFaceMeshInteractor>(fngIntrTrailingEdge)->refineBlockGridToLevel(refineLevel, startDistance, refineDistance);
-            //   grid->setRank(rank);
-
-            //   //SPtr<GbObject3D> trailingEdgeCube(new GbCuboid3D(fngMeshTrailingEdge->getX1Minimum()-blockLength, fngMeshTrailingEdge->getX2Minimum(), fngMeshTrailingEdge->getX3Minimum()-blockLength/2.0,
-            //   //   fngMeshTrailingEdge->getX1Maximum()+blockLength, fngMeshTrailingEdge->getX2Maximum(), fngMeshTrailingEdge->getX3Maximum()+blockLength/2.0));
-            //   //if (myid == 0) GbSystem3D::writeGeoObject(trailingEdgeCube.get(), pathOut + "/geo/trailingEdgeCube", WbWriterVtkXmlASCII::getInstance());
-
-            //   //RefineCrossAndInsideGbObjectBlockVisitor refVisitor(trailingEdgeCube, refineLevel);
-            //   //grid->accept(refVisitor);
-            //}
-
-            RatioBlockVisitor ratioVisitor(refineLevel);
-            CheckRatioBlockVisitor checkRatio(refineLevel);
-            int count = 0;
-
-            do {
-               grid->accept(ratioVisitor);
-               checkRatio.resetState();
-               grid->accept(checkRatio);
-               if (myid==0) UBLOG(logINFO, "count = "<<count++<<" state = "<<checkRatio.getState());
-            } while (!checkRatio.getState());
-
-            //RatioSmoothBlockVisitor ratioSmoothVisitor(refineLevel);
-            //grid->accept(ratioSmoothVisitor);
-
-            {
-               WriteBlocksCoProcessor ppblocks(grid, SPtr<UbScheduler>(new UbScheduler(1)), pathOut, WbWriterVtkXmlBinary::getInstance(), comm);
-               ppblocks.process(1);
-            }
-
-            OverlapBlockVisitor overlapVisitor(refineLevel, false);
-            grid->accept(overlapVisitor);
-
-            //std::vector<int> dirs;
-            //for (int i = D3Q27System::E; i <= D3Q27System::TS; i++)
-            //{
-            //   dirs.push_back(i);
-            //}
-            //SetInterpolationDirsBlockVisitor interDirsVisitor(dirs);
-            //grid->accept(interDirsVisitor);
-
-            if (myid==0) UBLOG(logINFO, "Refinement - end");
-         }
-         grid->updateDistributedBlocks(comm);
-
-         //if (writeBlocks)
-         //{
-         //   grid->updateDistributedBlocks(comm);
-         //   rcp.writeBlocks(0);
-         //}
-         //else
-         //{
-           //rcp.readBlocks(restartStep);
-           //grid->setTimeStep(restartStep);
-         //}
-
-         //return;
-
-         //Sleep(1000*myid);
-
-           
-
-
-         std::vector<int> dirs;
-         for (int i = D3Q27System::E; i<=D3Q27System::TS; i++)
-         {
-            dirs.push_back(i);
-         }
-         SetInterpolationDirsBlockVisitor interDirsVisitor(dirs);
-         grid->accept(interDirsVisitor);
-
-         //walls
-         GbCuboid3DPtr addWallZmin(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_minX3));
-         if (myid==0) GbSystem3D::writeGeoObject(addWallZmin.get(), pathOut+"/geo/addWallZmin", WbWriterVtkXmlASCII::getInstance());
-
-         GbCuboid3DPtr addWallZmax(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_maxX3, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength));
-         if (myid==0) GbSystem3D::writeGeoObject(addWallZmax.get(), pathOut+"/geo/addWallZmax", WbWriterVtkXmlASCII::getInstance());
-
-
-
-         //wall interactors
-         //SPtr<D3Q27Interactor> addWallZminInt(new D3Q27Interactor(addWallZmin, grid, slipBCAdapter, Interactor3D::SOLID));
-         //SPtr<D3Q27Interactor> addWallZmaxInt(new D3Q27Interactor(addWallZmax, grid, slipBCAdapter, Interactor3D::SOLID));
-         SPtr<D3Q27Interactor> addWallZminInt(new D3Q27Interactor(addWallZmin, grid, velBCAdapter, Interactor3D::SOLID));
-         SPtr<D3Q27Interactor> addWallZmaxInt(new D3Q27Interactor(addWallZmax, grid, velBCAdapter, Interactor3D::SOLID));
-
-         //inflow
-         GbCuboid3DPtr geoInflow(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3-blockLength, g_minX1, g_maxX2+blockLength, g_maxX3+blockLength));
-         if (myid==0) GbSystem3D::writeGeoObject(geoInflow.get(), pathOut+"/geo/geoInflow", WbWriterVtkXmlASCII::getInstance());
-
-         //outflow
-         GbCuboid3DPtr geoOutflow(new GbCuboid3D(g_maxX1, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength));
-         if (myid==0) GbSystem3D::writeGeoObject(geoOutflow.get(), pathOut+"/geo/geoOutflow", WbWriterVtkXmlASCII::getInstance());
-
-         //inflow
-         SPtr<D3Q27Interactor> inflowIntr = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoInflow, grid, velBCAdapter, Interactor3D::SOLID));
-
-         //outflow
-         SPtr<D3Q27Interactor> outflowIntr = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoOutflow, grid, outflowBCAdapter, Interactor3D::SOLID));
-
-         ////////////////////////////////////////////
-         //METIS
-         //grid->deleteBlockIDs();
-         //RenumberBlockVisitor renumber;
-         //grid->accept(renumber);
-         SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::BSW, MetisPartitioner::KWAY));
-         ////////////////////////////////////////////
-         /////delete solid blocks
-         if (myid==0) UBLOG(logINFO, "deleteSolidBlocks - start");
-         InteractorsHelper intHelper(grid, metisVisitor);
-         intHelper.addInteractor(inflowIntr);
-         intHelper.addInteractor(outflowIntr);
-         intHelper.addInteractor(addWallZminInt);
-         intHelper.addInteractor(addWallZmaxInt);
-         intHelper.addInteractor(triBand1Interactor);
-         intHelper.addInteractor(triBand2Interactor);
-         intHelper.addInteractor(triBand3Interactor);
-         intHelper.addInteractor(triBand4Interactor);
-         
-
-         if (porousTralingEdge)
-         {
-            intHelper.addInteractor(fngIntrBodyPart);
-            intHelper.addInteractor(porousIntrTrailingEdge);
-
-            //string samplePathname = pathGeo+"/"+sampleFilename;
-
-            //double pmNX1 = 669;
-            //double pmNX2 = 2945;
-            //double pmNX3 = 1119;
-
-            //double deltaVoxelX1 = 13393e-6;
-            //double deltaVoxelX2 = 13393e-6;
-            //double deltaVoxelX3 = 13393e-6;
-            //
-            //double lthreshold = 11538;
-            //double uthreshold = 65535;
-
-            //if (myid==0) UBLOG(logINFO, "read voxel matrix: start");
-            //GbVoxelMatrix3DPtr porousTrailingEdge(new GbVoxelMatrix3D(pmNX1, pmNX2, pmNX3, 0, lthreshold, uthreshold));
-            //porousTrailingEdge->readMatrixFromRawFile<unsigned short>(samplePathname, GbVoxelMatrix3D::BigEndian);
-            //porousTrailingEdge->setVoxelMatrixDelta((float)deltaVoxelX1, (float)deltaVoxelX2, (float)deltaVoxelX3);
-            //porousTrailingEdge->setVoxelMatrixMininum(0.0, 0.0, 0.0);
-            //if (myid==0) UBLOG(logINFO, "read voxel matrix: end");
-
-            //if (myid==0) UBLOG(logINFO, "rotate voxel matrix: start");
-            //porousTrailingEdge->rotate90aroundZ();
-            //porousTrailingEdge->rotate90aroundX();
-            //if (myid==0) UBLOG(logINFO, "rotate voxel matrix: end");
-
-            //if (myid==0) porousTrailingEdge->writeToVTKImageDataASCII(pathOut+"/geo/PorousTrailingEdge");
-         }
-         else
-         {
-            intHelper.addInteractor(fngIntrWhole2);
-         }
-
-         //////////////////////////////////////////////////////////////////////////
-         intHelper.selectBlocks();
-
-         if (myid==0) UBLOG(logINFO, "deleteSolidBlocks - end");
-
-         if (myid==0)
-         {
-            UBLOG(logINFO, "PID = "<<myid<<" Point 4");
-            UBLOG(logINFO, "PID = "<<myid<<" Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB");
-         }
-         //////////////////////////////////////
-
-         {
-            WriteBlocksCoProcessor ppblocks(grid, SPtr<UbScheduler>(new UbScheduler(1)), pathOut, WbWriterVtkXmlBinary::getInstance(), comm);
-            ppblocks.process(2);
-         }
-
-         unsigned long long numberOfBlocks = (unsigned long long)grid->getNumberOfBlocks();
-         int ghostLayer = 3;
-         unsigned long long numberOfNodesPerBlock = (unsigned long long)(blockNx[0])* (unsigned long long)(blockNx[1])* (unsigned long long)(blockNx[2]);
-         unsigned long long numberOfNodes = numberOfBlocks * numberOfNodesPerBlock;
-         unsigned long long numberOfNodesPerBlockWithGhostLayer = numberOfBlocks * (blockNx[0]+ghostLayer) * (blockNx[1]+ghostLayer) * (blockNx[2]+ghostLayer);
-         double needMemAll = double(numberOfNodesPerBlockWithGhostLayer*(27*sizeof(double)+sizeof(int)+sizeof(float)*4));
-         double needMem = needMemAll/double(comm->getNumberOfProcesses());
-
-         if (myid==0)
-         {
-            UBLOG(logINFO, "Number of blocks = "<<numberOfBlocks);
-            UBLOG(logINFO, "Number of nodes  = "<<numberOfNodes);
-            int minInitLevel = grid->getCoarsestInitializedLevel();
-            int maxInitLevel = grid->getFinestInitializedLevel();
-            for (int level = minInitLevel; level<=maxInitLevel; level++)
-            {
-               int nobl = grid->getNumberOfBlocks(level);
-               UBLOG(logINFO, "Number of blocks for level "<<level<<" = "<<nobl);
-               UBLOG(logINFO, "Number of nodes for level "<<level<<" = "<<nobl*numberOfNodesPerBlock);
-            }
-            UBLOG(logINFO, "Necessary memory  = "<<needMemAll<<" bytes");
-            UBLOG(logINFO, "Necessary memory per process = "<<needMem<<" bytes");
-            UBLOG(logINFO, "Available memory per process = "<<availMem<<" bytes");
-         }
-
-         //SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new CompressibleCumulantLBMKernel(blockNx[0], blockNx[1], blockNx[2], CompressibleCumulantLBMKernel::NORMAL));
-         ////SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new IncompressibleCumulantLBMKernel(blockNx[0], blockNx[1], blockNx[2], IncompressibleCumulantLBMKernel::NORMAL));
-
-         //SPtr<BCProcessor> bcProc;
-
-         //if (thinWall)
-         //{
-            //bcProc = SPtr<BCProcessor>(new ThinWallBCProcessor());
-         //}
-         //else
-         //{
-            //bcProc = SPtr<BCProcessor>(new BCProcessor());
-         //}
-
-         //kernel->setBCProcessor(bcProc);
-
-         SetKernelBlockVisitor kernelVisitor(kernel, nuLB, availMem, needMem);
-         grid->accept(kernelVisitor);
-
-         if (myid==0) UBLOG(logINFO, "SetKernelBlockVisitor:end");
-
-         if (myid==0)
-         {
-            UBLOG(logINFO, "PID = "<<myid<<" Point 5");
-            UBLOG(logINFO, "PID = "<<myid<<" Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB");
-         }
-
-         if (refineLevel>0)
-         {
-            SetUndefinedNodesBlockVisitor undefNodesVisitor;
-            grid->accept(undefNodesVisitor);
-         }
-
-         if (myid==0) UBLOG(logINFO, "SetUndefinedNodesBlockVisitor:end");
-
-         //BC
-         intHelper.setBC();
-         if (myid==0) UBLOG(logINFO, "intHelper.setBC():end");
-
-         if (myid==0)
-         {
-            UBLOG(logINFO, "PID = "<<myid<<" Point 6");
-            UBLOG(logINFO, "PID = "<<myid<<" Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB");
-         }
-
-
-
-         //initialization of distributions
-         mu::Parser inflowProfileVx1, inflowProfileVx2, inflowProfileVx3;
-         inflowProfileVx1.SetExpr("U*rangeRandom1()");
-         inflowProfileVx1.DefineConst("U", uLB);
-         inflowProfileVx1.DefineFun("rangeRandom1", rangeRandom1);
-         inflowProfileVx2.SetExpr("0.1*U*rangeRandom1()");
-         inflowProfileVx2.DefineConst("U", uLB);
-         inflowProfileVx2.DefineFun("rangeRandom1", rangeRandom1);
-         inflowProfileVx3.SetExpr("0.1*U*rangeRandom1()");
-         inflowProfileVx3.DefineConst("U", uLB);
-         inflowProfileVx3.DefineFun("rangeRandom1", rangeRandom1);
-
-         InitDistributionsBlockVisitor initVisitor1(nuLB, rhoLB);
-         initVisitor1.setVx1(fct);
-         ////initVisitor.setVx1(inflowProfileVx1);
-         ////initVisitor.setVx2(inflowProfileVx2);
-         ////initVisitor.setVx3(inflowProfileVx3);
-         ////initVisitor.setNu(nuLB);
-         grid->accept(initVisitor1);
-
-
-
-         ////set connectors
-         InterpolationProcessorPtr iProcessor(new CompressibleOffsetInterpolationProcessor());
-         //InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor());
-         SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
-         grid->accept(setConnsVisitor);
-
-         
-         //SPtr<Grid3D> oldGrid(new Grid3D(comm));
-         //
-         ////with MPIIORestartCoProcessor
-         //SPtr<UbScheduler> iSch(new UbScheduler());
-         //MPIIORestart1CoProcessor rcpInit(oldGrid, iSch, pathReInit, comm);
-         //rcpInit.setChunk(chunk);
-         //rcpInit.restart(stepReInit);
-
-         //////with MPIIORestart2CoProcessor
-         ////SPtr<UbScheduler> iSch(new UbScheduler());
-         ////MPIIORestart2CoProcessor rcp(oldGrid, iSch, pathReInit, comm);
-         ////rcp.readBlocks(stepReInit);
-         ////SPtr<Grid3DVisitor> newMetisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::BSW, MetisPartitioner::KWAY));
-         ////oldGrid->accept(newMetisVisitor);
-         ////rcp.readDataSet(stepReInit);
-         ////rcp.readBoundaryConds(stepReInit);
-
-         //InitDistributionsWithInterpolationGridVisitor initVisitor(oldGrid, iProcessor, nuLB);
-         //grid->accept(initVisitor);
-
-         //domain decomposition for threads
-         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
-         grid->accept(pqPartVisitor);
-
-         //bcVisitor should be accept after initialization!!!!
-         grid->accept(bcVisitor);
-         if (myid==0) UBLOG(logINFO, "grid->accept(bcVisitor):end");
-
-         if (myid==0)
-         {
-            UBLOG(logINFO, "PID = "<<myid<<" Point 7");
-            UBLOG(logINFO, "PID = "<<myid<<" Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB");
-         }
-
-
-         //Postrozess
-         {
-            SPtr<UbScheduler> geoSch(new UbScheduler(1));
-            WriteBoundaryConditionsCoProcessor ppgeo(grid, geoSch, pathOut, WbWriterVtkXmlBinary::getInstance(), conv, comm);
-            ppgeo.process(0);
-         }
-
-         if (myid==0)
-         {
-            UBLOG(logINFO, "PID = "<<myid<<" Point 8");
-            UBLOG(logINFO, "PID = "<<myid<<" Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB");
-         }
-
-         //fngIntrWhole1.reset();
-         fngIntrWhole2.reset();
-
-         ////SPtr<UbScheduler> rSch(new UbScheduler(cpStep, cpStart));
-         ////MPIIORestartCoProcessor rcp(grid, rSch, pathOut, comm);
-
-         GbCuboid3DPtr sponfeLayerBB1(new GbCuboid3D(g_maxX1-750, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength));
-         if (myid==0) GbSystem3D::writeGeoObject(geoOutflow.get(), pathOut+"/geo/geoOutflow", WbWriterVtkXmlASCII::getInstance());
-         SpongeLayerBlockVisitor slVisitor(sponfeLayerBB1);
-
-         if (myid==0) UBLOG(logINFO, "Preprozess - end");
-      }
-      else
-      {
-         
-         //rcp2.process(restartStep);
-         //return;
-         //////////////////////////////////////////////////////////////////////////
-         //////MPIIORestart2CoProcessor
-         //SPtr<UbScheduler> iSch(new UbScheduler());
-         //rcp2.readBlocks(restartStep);
-         //grid->updateDistributedBlocks(comm);
-         
-         //SPtr<Grid3DVisitor> newMetisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::BSW, MetisPartitioner::KWAY));
-         //grid->accept(newMetisVisitor);
-         
-         //rcp2.restart((int)restartStep);
-         //grid->setTimeStep(restartStep);
-         
-         //rcp.readBlocks(restartStep);
-         //rcp.readDataSet(restartStep);
-         //rcp.readBoundaryConds(restartStep);
-         //grid->setTimeStep(restartStep);
-         
-         //setBC(grid, pathGeo, fngFileWhole2, zigZagTape, boundingBox, uLB, rhoLB, blockLength, bcProc);
-         
-         //rp.process(restartStep);
-
-         rcp3.restart((int)restartStep);
-         grid->setTimeStep(restartStep);
-         
-         //{
-            //WriteBlocksCoProcessor ppblocks(grid, SPtr<UbScheduler>(new UbScheduler(1)), pathOut+"/mpiio3", WbWriterVtkXmlASCII::getInstance(), comm);
-            //ppblocks.process(0);
-         //}
-         
-         //{
-            //SPtr<UbScheduler> stepSch(new UbScheduler(1));
-            //WriteMacroscopicQuantitiesCoProcessor pp(grid, stepSch, pathOut+"/mpiio3", WbWriterVtkXmlBinary::getInstance(), conv, comm);
-            //pp.process(restartStep);
-         //} 
- 
-         //{
-           
-            //SPtr<UbScheduler> geoSch(new UbScheduler(1));
-            //WriteBoundaryConditionsCoProcessor ppgeo(grid, geoSch, pathOut+"/mpiio3", WbWriterVtkXmlBinary::getInstance(), conv, comm);
-            //ppgeo.process(0);
-         //}
-
-         //rcp3.process(restartStep);
-         
-         //return;
-         
-         
-     
-            
-         
-                 
-         ////////////////////////////////////////////////////////////////////////////
-         InterpolationProcessorPtr iProcessor(new CompressibleOffsetInterpolationProcessor());
-         SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
-         grid->accept(setConnsVisitor);
-
-         grid->accept(bcVisitor);
-
-         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
-         grid->accept(pqPartVisitor);
-         
-      }
-
-      SPtr<UbScheduler> nupsSch(new UbScheduler(nupsStep[0], nupsStep[1], nupsStep[2]));
-      NUPSCounterCoProcessor npr(grid, nupsSch, numOfThreads, comm);
-
-      SPtr<UbScheduler> stepSch(new UbScheduler(outTimeStep,outTimeStart));
-
-
-
-      if (myid==0)
-      {
-         UBLOG(logINFO, "PID = "<<myid<<" Point 9");
-         UBLOG(logINFO, "PID = "<<myid<<" Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB");
-      }
-
-      ////////////////////////////////////////////////////////////////////////
-      ////MPIIORestart2CoProcessor 
-      //grid->deleteBlockIDs();
-      //RenumberBlockVisitor renumber;
-      //grid->accept(renumber);
-      //SPtr<UbScheduler> iSch(new UbScheduler(1));
-      //MPIIORestart2CoProcessor rcpInit(grid, iSch, pathOut+"/mpiio2", comm);
-      //rcpInit.process(0);
-      ////////////////////////////////////////////////////////////////////////
-
-      //////////////////////////////////////////////////////////////////////////
-      ////MPIIORestartCoProcessor 
-      //SPtr<UbScheduler> iSch(new UbScheduler(1));
-      //MPIIORestartCoProcessor rcpInit(grid, iSch, pathOut, comm);
-      //rcpInit.process(0);
-      //////////////////////////////////////////////////////////////////////////
-
-      WriteMacroscopicQuantitiesCoProcessor pp(grid, stepSch, pathOut, WbWriterVtkXmlBinary::getInstance(), conv, comm);
-      //pp.process(0);
-
-      //rcp.process(0);
-
-      //return;
-
-      //////////////////////////////////////////////////////////////////////////
-      ////Forces calculation
-      //////////////////////////////////////////////////////////////////////////
-      //if (myid==0) UBLOG(logINFO, "Read fngFileWhole2:start");
-      //SPtr<GbTriFaceMesh3D> fngMeshWhole2 = SPtr<GbTriFaceMesh3D>(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(pathGeo+"/"+fngFileWhole2, "fngMeshWhole2", GbTriFaceMesh3D::KDTREE_SAHPLIT, false));
-      //if (myid==0) UBLOG(logINFO, "Read fngFileWhole2:end");
-      //fngMeshWhole2->rotate(0.0, 0.5, 0.0);
-      //SPtr<D3Q27TriFaceMeshInteractor> fngIntrWhole2 = SPtr<D3Q27TriFaceMeshInteractor>(new D3Q27TriFaceMeshInteractor(fngMeshWhole2, grid, noSlipBCAdapter, Interactor3D::SOLID));
-
-      //SetSolidBlockVisitor fngVisitor(fngIntrWhole2, SetSolidBlockVisitor::BC);
-      //grid->accept(fngVisitor);
-      //fngIntrWhole2->initInteractor();
-      
-      //grid->accept(bcVisitor);
-
-      //string ZckbndFilename = pathGeo+"/"+zigZagTape;
-      //SPtr<GbTriFaceMesh3D> meshBand1(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "zigZagTape1"));
-      //meshBand1->rotate(0.0, 5, 0.0);
-      //meshBand1->translate(15, 0, -12.850);
-      //// Zackenband2
-      //SPtr<GbTriFaceMesh3D> meshBand2(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "zigZagTape2"));
-      //meshBand2->rotate(0.0, 5, 0.0);
-      //meshBand2->translate(15, 5, -12.850);
-
-      //SPtr<GbTriFaceMesh3D> meshBand5(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "zigZagTape5"));
-      //meshBand5->rotate(0.0, -1, 0.0);
-      //meshBand5->rotate(0.0, 0.0, 180.0);
-      //meshBand5->translate(30, 0, -37.2);
-      //// Zackenband6
-      //SPtr<GbTriFaceMesh3D> meshBand6(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "zigZagTape6"));
-      //meshBand6->rotate(0.0, -1, 0.0);
-      //meshBand6->rotate(0.0, 0.0, 180.0);
-      //meshBand6->translate(30, 5, -37.2);
-
-      //SPtr<D3Q27TriFaceMeshInteractor> triBand1Interactor(new D3Q27TriFaceMeshInteractor(meshBand1, grid, noSlipBCAdapter, Interactor3D::SOLID, Interactor3D::EDGES));
-      //SPtr<D3Q27TriFaceMeshInteractor> triBand2Interactor(new D3Q27TriFaceMeshInteractor(meshBand2, grid, noSlipBCAdapter, Interactor3D::SOLID, Interactor3D::EDGES));
-      //SPtr<D3Q27TriFaceMeshInteractor> triBand3Interactor(new D3Q27TriFaceMeshInteractor(meshBand5, grid, noSlipBCAdapter, Interactor3D::SOLID, Interactor3D::EDGES));
-      //SPtr<D3Q27TriFaceMeshInteractor> triBand4Interactor(new D3Q27TriFaceMeshInteractor(meshBand6, grid, noSlipBCAdapter, Interactor3D::SOLID, Interactor3D::EDGES));
-
-      //SetSolidOrTransBlockVisitor band1Visitor(triBand1Interactor, SetSolidOrTransBlockVisitor::TRANS);
-      //grid->accept(band1Visitor);
-      //triBand1Interactor->initInteractor();
-
-      //SetSolidOrTransBlockVisitor band2Visitor(triBand2Interactor, SetSolidOrTransBlockVisitor::TRANS);
-      //grid->accept(band2Visitor);
-      //triBand2Interactor->initInteractor();
-
-      //SetSolidOrTransBlockVisitor band3Visitor(triBand3Interactor, SetSolidOrTransBlockVisitor::TRANS);
-      //grid->accept(band3Visitor);
-      //triBand3Interactor->initInteractor();
-
-      //SetSolidOrTransBlockVisitor band4Visitor(triBand4Interactor, SetSolidOrTransBlockVisitor::TRANS);
-      //grid->accept(band4Visitor);
-      //triBand4Interactor->initInteractor();
-
-      //double b    = 30; //wingspan
-      //double t    = 300; //chord length
-      //double area = (b*t)/(deltaXcoarse*deltaXcoarse);
-      //double v    = uLB;
-
-      //CalculateForcesCoProcessor fp(grid, stepSch, pathOut + "/forces/forces.txt", comm, v, area);
-      //fp.addInteractor(fngIntrWhole2);
-      //fp.addInteractor(triBand1Interactor);
-      //fp.addInteractor(triBand2Interactor);
-      //fp.addInteractor(triBand3Interactor);
-      //fp.addInteractor(triBand4Interactor);
-      //////////////////////////////////////////////////////////////////////////
-
-      //////////////////////////////////////////////////////////////////////////
-      ////Cp calculation
-      //////////////////////////////////////////////////////////////////////////
-      //SPtr<UbScheduler> pcpSch(new UbScheduler(1, pcpStart, pcpStop));
-
-      //double planeCenter = g_minX2+(g_maxX2-g_minX2)/2.0;
-      //double planeX2min = planeCenter-deltaXfine;
-      //double planeX2max = planeCenter;//planeCenter+deltaXfine;
-      //GbCuboid3DPtr plane(new GbCuboid3D(g_minX1,planeX2min,g_minX3,g_maxX1,planeX2max,g_maxX3));
-      //if (myid==0) GbSystem3D::writeGeoObject(plane.get(), pathOut+"/geo/plane", WbWriterVtkXmlASCII::getInstance());
-
-      //PressureCoefficientCoProcessor pcp(grid, pcpSch, plane, pathOut+"/cp/cp", comm);
-      //pcp.addInteractor(fngIntrWhole2);
-      //////////////////////////////////////////////////////////////////////////
-
-      SPtr<UbScheduler> tavSch(new UbScheduler(1, timeAvStart, timeAvStop));
-      TimeAveragedValuesSPtr<CoProcessor> tav(new TimeAveragedValuesCoProcessor(grid, pathOut, WbWriterVtkXmlBinary::getInstance(), tavSch, comm,
-        TimeAveragedValuesCoProcessor::Density | TimeAveragedValuesCoProcessor::Velocity | TimeAveragedValuesCoProcessor::Fluctuations));
-      tav->setWithGhostLayer(true);
-
-      SPtr<IntegrateValuesHelper> mic1(new IntegrateValuesHelper(grid, comm,300-deltaXcoarse,35,-600-deltaXcoarse,
-         300,65,-600));
-      if (myid==0) GbSystem3D::writeGeoObject(mic1->getBoundingBox().get(), pathOut+"/geo/mic1", WbWriterVtkXmlBinary::getInstance());
-      SPtr<UbScheduler> stepMV(new UbScheduler(1));
-      //TimeseriesCoProcessor tsp1(grid, stepMV, mic1, pathOut+"/mic/mic1", comm);
-
-      //CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, stepSch));
-      //CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, tavSch, CalculationManager::MPI));
-
-
-      const SPtr<ConcreteCalculatorFactory> calculatorFactory = std::make_shared<ConcreteCalculatorFactory>(stepSch);
-      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, calculatorFactory, CalculatorType::PREPOSTBC));
-
-      if (myid==0) UBLOG(logINFO, "Simulation-start");
-      calculation->calculate();
-      if (myid==0) UBLOG(logINFO, "Simulation-end");
-      
-      ////////////////////////////////////////////////////////////////////////
-      //MPIIORestart2CoProcessor 
-      //grid->deleteBlockIDs();
-      //RenumberBlockVisitor renumber;
-      //grid->accept(renumber);
-      //SPtr<UbScheduler> iSch(new UbScheduler(1));
-      //MPIIORestart2CoProcessor rcpInit(grid, iSch, pathOut+"/mpiio2", comm);
-      //rcpInit.process(0);
-      ////////////////////////////////////////////////////////////////////////
-
-      if (myid==0)
-      {
-         UBLOG(logINFO, "PID = "<<myid<<" Point 10");
-         UBLOG(logINFO, "PID = "<<myid<<" Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB");
-      }
-   }
-   catch (std::exception& e)
-   {
-      cerr<<e.what()<<endl<<flush;
-   }
-   catch (std::string& s)
-   {
-      cerr<<s<<endl;
-   }
-   catch (...)
-   {
-      cerr<<"unknown exception"<<endl;
-   }
-
-}
-
-int main(int argc, char* argv[])
-{
-
-   if (argv!=NULL)
-   {
-      if (argv[1]!=NULL)
-      {
-         run(string(argv[1]));
-      }
-      else
-      {
-         cout<<"Configuration file must be set!: "<<argv[0]<<" <config file>"<<endl<<std::flush;
-      }
-   }
-
-   return 0;
-}
-
+#include <iostream>
+#include <string>
+
+
+#include "VirtualFluids.h"
+#include <omp.h>
+using namespace std;
+
+double rangeRandom1()
+{
+   return (2.0*rand())/RAND_MAX-1.0;
+}
+
+void setBC(SPtr<Grid3D> grid, string pathGeo, string fngFileWhole, string zigZagTape, vector<double>  boundingBox, double uLB, double rhoLB, double blockLength, SPtr<BCProcessor> bcProcessor)
+{
+   SPtr<Communicator> comm = MPICommunicator::getInstance();
+   int myid = comm->getProcessID();
+   
+   std::vector<std::vector<SPtr<Block3D>> > blockVector;
+   int minInitLevel;
+   int maxInitLevel;
+   int gridRank;
+
+   gridRank = comm->getProcessID();
+   minInitLevel = grid->getCoarsestInitializedLevel();
+   maxInitLevel = grid->getFinestInitializedLevel();
+   blockVector.resize(maxInitLevel+1);
+   for (int level = minInitLevel; level<=maxInitLevel; level++)
+   {
+      grid->getBlocks(level, gridRank, true, blockVector[level]);
+   }
+
+   for (int level = minInitLevel; level<=maxInitLevel; level++)
+   {
+      for(SPtr<Block3D> block : blockVector[level])
+      {
+         if (block)
+         {
+            SPtr<ILBMKernel> kernel = block->getKernel();
+            kernel->setBCProcessor(bcProcessor->clone(kernel));
+         }
+      }
+   }
+   
+   SetUndefinedNodesBlockVisitor undefNodesVisitor;
+   grid->accept(undefNodesVisitor);
+   
+   SPtr<BCAdapter> noSlipBCAdapter(new NoSlipBCAdapter());
+   noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NoSlipBCAlgorithm()));
+   if (myid==0) UBLOG(logINFO, "Read fngFileWhole:start");
+   SPtr<GbTriFaceMesh3D> fngMeshWhole = SPtr<GbTriFaceMesh3D>(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(pathGeo+"/"+fngFileWhole, "fngMeshWhole", GbTriFaceMesh3D::KDTREE_SAHPLIT, false));
+   if (myid==0) UBLOG(logINFO, "Read fngFileWhole:end");
+   fngMeshWhole->rotate(0.0, 0.5, 0.0);
+   SPtr<D3Q27TriFaceMeshInteractor> fngIntrWhole = SPtr<D3Q27TriFaceMeshInteractor>(new D3Q27TriFaceMeshInteractor(fngMeshWhole, grid, noSlipBCAdapter, Interactor3D::SOLID));
+
+   if (myid==0) UBLOG(logINFO, "Read zigZagTape:start");
+   string ZckbndFilename = pathGeo+"/"+zigZagTape;
+   SPtr<GbTriFaceMesh3D> meshBand1(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "zigZagTape1"));
+   meshBand1->rotate(0.0, 5, 0.0);
+   meshBand1->translate(15, 0, -12.850);
+   // Zackenband2
+   SPtr<GbTriFaceMesh3D> meshBand2(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "zigZagTape2"));
+   meshBand2->rotate(0.0, 5, 0.0);
+   meshBand2->translate(15, 5, -12.850);
+
+   SPtr<GbTriFaceMesh3D> meshBand5(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "zigZagTape5"));
+   meshBand5->rotate(0.0, -1, 0.0);
+   meshBand5->rotate(0.0, 0.0, 180.0);
+   //meshBand5->translate(30, 0, -37.3);
+   meshBand5->translate(30, 0, -37.2);
+   
+   // Zackenband6
+   SPtr<GbTriFaceMesh3D> meshBand6(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "zigZagTape6"));
+   meshBand6->rotate(0.0, -1, 0.0);
+   meshBand6->rotate(0.0, 0.0, 180.0);
+   //meshBand6->translate(30, 5, -37.3);
+   meshBand6->translate(30, 5, -37.2);
+
+   SPtr<D3Q27TriFaceMeshInteractor> triBand1Interactor(new D3Q27TriFaceMeshInteractor(meshBand1, grid, noSlipBCAdapter, Interactor3D::SOLID, Interactor3D::EDGES));
+   SPtr<D3Q27TriFaceMeshInteractor> triBand2Interactor(new D3Q27TriFaceMeshInteractor(meshBand2, grid, noSlipBCAdapter, Interactor3D::SOLID, Interactor3D::EDGES));
+   SPtr<D3Q27TriFaceMeshInteractor> triBand3Interactor(new D3Q27TriFaceMeshInteractor(meshBand5, grid, noSlipBCAdapter, Interactor3D::SOLID, Interactor3D::EDGES));
+   SPtr<D3Q27TriFaceMeshInteractor> triBand4Interactor(new D3Q27TriFaceMeshInteractor(meshBand6, grid, noSlipBCAdapter, Interactor3D::SOLID, Interactor3D::EDGES));
+
+   mu::Parser fct;
+   fct.SetExpr("U");
+   fct.DefineConst("U", uLB);
+   SPtr<BCAdapter> velBCAdapter(new VelocityBCAdapter(true, false, false, fct, 0, BCFunction::INFCONST));
+   velBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new VelocityWithDensityBCAlgorithm()));
+
+   SPtr<BCAdapter> outflowBCAdapter(new DensityBCAdapter(rhoLB));
+   outflowBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NonReflectingOutflowBCAlgorithm()));
+
+   double g_minX1 = boundingBox[0]*1000.0;
+   double g_minX2 = boundingBox[2]*1000.0;
+   double g_minX3 = boundingBox[4]*1000.0;
+
+   double g_maxX1 = boundingBox[1]*1000.0;
+   double g_maxX2 = boundingBox[3]*1000.0;
+   double g_maxX3 = boundingBox[5]*1000.0;
+   
+   GbCuboid3DPtr addWallZmin(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_minX3));
+   
+   GbCuboid3DPtr addWallZmax(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_maxX3, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength));
+   
+   SPtr<D3Q27Interactor> addWallZminInt(new D3Q27Interactor(addWallZmin, grid, velBCAdapter, Interactor3D::SOLID));
+   SPtr<D3Q27Interactor> addWallZmaxInt(new D3Q27Interactor(addWallZmax, grid, velBCAdapter, Interactor3D::SOLID));
+   //inflow
+   GbCuboid3DPtr geoInflow(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3-blockLength, g_minX1, g_maxX2+blockLength, g_maxX3+blockLength));
+   //outflow
+   GbCuboid3DPtr geoOutflow(new GbCuboid3D(g_maxX1, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength));
+   //inflow
+   SPtr<D3Q27Interactor> inflowIntr = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoInflow, grid, velBCAdapter, Interactor3D::SOLID));
+   //outflow
+   SPtr<D3Q27Interactor> outflowIntr = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoOutflow, grid, outflowBCAdapter, Interactor3D::SOLID));
+
+   SetSolidBlockVisitor v1(fngIntrWhole, BlockType::BC);
+   grid->accept(v1);
+
+   SetSolidBlockVisitor v2(triBand1Interactor, BlockType::BC);
+   grid->accept(v2);
+
+   SetSolidBlockVisitor v3(triBand1Interactor, BlockType::BC);
+   grid->accept(v3);
+
+   SetSolidBlockVisitor v4(triBand2Interactor, BlockType::BC);
+   grid->accept(v4);
+   
+   SetSolidBlockVisitor v5(triBand3Interactor, BlockType::BC);
+   grid->accept(v5);
+
+   SetSolidBlockVisitor v6(triBand4Interactor, BlockType::BC);
+   grid->accept(v6);
+
+   SetSolidBlockVisitor v7(addWallZminInt, BlockType::BC);
+   grid->accept(v7);
+
+   SetSolidBlockVisitor v8(addWallZmaxInt, BlockType::BC);
+   grid->accept(v8);
+
+   SetSolidBlockVisitor v9(inflowIntr, BlockType::BC);
+   grid->accept(v9);
+
+   SetSolidBlockVisitor v10(outflowIntr, BlockType::BC);
+   grid->accept(v10);
+   
+   inflowIntr->initInteractor();
+   outflowIntr->initInteractor();
+   addWallZminInt->initInteractor();
+   addWallZmaxInt->initInteractor();
+   fngIntrWhole->initInteractor();
+   triBand1Interactor->initInteractor();
+   triBand2Interactor->initInteractor();
+   triBand3Interactor->initInteractor();
+   triBand3Interactor->initInteractor();
+   triBand4Interactor->initInteractor();
+}
+
+void run(string configname)
+{
+   try
+   {
+
+      ConfigurationFile   config;
+      config.load(configname);
+
+      string          pathOut = config.getValue<string>("pathOut");
+      string          pathGeo = config.getValue<string>("pathGeo");
+      string          fngFileWhole1 = config.getValue<string>("fngFileWhole1");
+      string          fngFileWhole2 = config.getValue<string>("fngFileWhole2");
+      string          fngFileTrailingEdge = config.getValue<string>("fngFileTrailingEdge");
+      string          fngFileBodyPart = config.getValue<string>("fngFileBodyPart");
+      string          zigZagTape = config.getValue<string>("zigZagTape");
+      int             numOfThreads = config.getValue<int>("numOfThreads");
+      vector<int>     blockNx = config.getVector<int>("blockNx");
+      vector<double>  boundingBox = config.getVector<double>("boundingBox");
+      double          uLB = config.getValue<double>("uLB");
+      double          restartStep = config.getValue<double>("restartStep");
+      double          cpStart = config.getValue<double>("cpStart");
+      double          cpStep = config.getValue<double>("cpStep");
+      double          endTime = config.getValue<double>("endTime");
+      double          outTimeStep = config.getValue<double>("outTimeStep");
+      double          outTimeStart = config.getValue<double>("outTimeStart");
+      double          availMem = config.getValue<double>("availMem");
+      int             refineLevel = config.getValue<int>("refineLevel");
+      bool            logToFile = config.getValue<bool>("logToFile");
+      bool            porousTralingEdge = config.getValue<bool>("porousTralingEdge");
+      double          deltaXfine = config.getValue<double>("deltaXfine")*1000.0;
+      bool            thinWall = config.getValue<bool>("thinWall");
+      double          refineDistance = config.getValue<double>("refineDistance");
+      double          startDistance = config.getValue<double>("startDistance");
+      vector<double>  nupsStep = config.getVector<double>("nupsStep");
+      bool            newStart = config.getValue<bool>("newStart");
+      bool            writeBlocks = config.getValue<bool>("writeBlocks");
+      string          sampleFilename = config.getValue<string>("sampleFilename");
+      string          pathReInit = config.getValue<string>("pathReInit");
+      int             stepReInit = config.getValue<int>("stepReInit");
+      
+      double          pcpStart = config.getValue<double>("pcpStart");
+      double          pcpStop  = config.getValue<double>("pcpStop");
+      //double          p_inf    = config.getValue<double>("p_inf");
+      
+      double          timeAvStart       = config.getValue<double>("timeAvStart");
+      double          timeAvStop        = config.getValue<double>("timeAvStop");
+      
+      int             chunk = config.getValue<int>("chunk");
+
+
+      SPtr<Communicator> comm = MPICommunicator::getInstance();
+      int myid = comm->getProcessID();
+
+      if (logToFile)
+      {
+#if defined(__unix__)
+         if (myid==0)
+         {
+            const char* str = pathOut.c_str();
+            mkdir(str, S_IRWXU|S_IRWXG|S_IROTH|S_IXOTH);
+         }
+#endif 
+
+         if (myid==0)
+         {
+            stringstream logFilename;
+            logFilename<<pathOut+"/logfile"+UbSystem::toString(UbSystem::getTimeStamp())+".txt";
+            UbLog::output_policy::setStream(logFilename.str());
+         }
+      }
+
+      if (myid==0)
+      {
+         UBLOG(logINFO, "PID = "<<myid<<" Point 1");
+         UBLOG(logINFO, "PID = "<<myid<<" Total Physical Memory (RAM): "<<Utilities::getTotalPhysMem());
+         UBLOG(logINFO, "PID = "<<myid<<" Physical Memory currently used: "<<Utilities::getPhysMemUsed());
+         UBLOG(logINFO, "PID = "<<myid<<" Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB");
+      }
+
+
+      //the geometry is in mm
+
+      double g_minX1 = boundingBox[0]*1000.0;
+      double g_minX2 = boundingBox[2]*1000.0;
+      double g_minX3 = boundingBox[4]*1000.0;
+
+      double g_maxX1 = boundingBox[1]*1000.0;
+      double g_maxX2 = boundingBox[3]*1000.0;
+      double g_maxX3 = boundingBox[5]*1000.0;
+
+      //////////////////////////////////////////////////////////////////////////
+      double deltaXcoarse = deltaXfine*(double)(1<<refineLevel);
+      //double nx2_temp = floor((g_maxX2 - g_minX2) / (deltaXcoarse*(double)blockNx[0]));
+
+      //deltaXcoarse = (g_maxX2 - g_minX2) / (nx2_temp*(double)blockNx[0]);
+      //UBLOG(logINFO, "nx2_temp:"<<nx2_temp);
+      //g_maxX2 -= 0.5* deltaXcoarse;
+      //////////////////////////////////////////////////////////////////////////
+      double blockLength = (double)blockNx[0]*deltaXcoarse;
+
+      //##########################################################################
+      //## physical parameters
+      //##########################################################################
+      double Re = 1e6;
+
+      double rhoLB = 0.0;
+      double rhoReal = 1.2041; //(kg/m3)
+      //double nueReal = 153.5e-7; //m^2/s
+      double uReal = 55; //m/s
+      double lReal = 0.3;//m
+      //double uReal = Re*nueReal / lReal;
+      double nuReal = (uReal*lReal)/Re; //m^2/s
+
+      //##Machzahl:
+      //#Ma     = uReal/csReal
+      double Ma = 0.15;//Ma-Real!
+      //double csReal = uReal / Ma;
+      //double hLB = lReal / deltaXcoarse;
+
+      //LBMUnitConverter unitConverter(lReal, csReal, rhoReal, hLB);
+
+      //double u_LB = uReal   * unitConverter.getFactorVelocityWToLb();
+      //double nu_LB = nueReal * unitConverter.getFactorViscosityWToLb();
+      double lLB = lReal*1000.0/deltaXcoarse;
+      double nuLB = (uLB*lLB)/Re; //0.005;
+      //double nuLB = 0.005;
+
+      SPtr<LBMUnitConverter> conv = SPtr<LBMUnitConverter>(new LBMUnitConverter());
+
+      const int baseLevel = 0;
+
+      ////////////////////////////////////////////////////////////////////////
+      //Grid
+      //////////////////////////////////////////////////////////////////////////
+      SPtr<Grid3D> grid(new Grid3D(comm));
+
+      //BC adapters
+      SPtr<BCAdapter> noSlipBCAdapter(new NoSlipBCAdapter());
+      if (thinWall)
+      {
+         noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new ThinWallNoSlipBCAlgorithm()));
+      }
+      else
+      {
+         noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NoSlipBCAlgorithm()));
+      }
+
+      SPtr<BCAdapter> slipBCAdapter(new SlipBCAdapter());
+      slipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new SlipBCAlgorithm()));
+
+      mu::Parser fct;
+      fct.SetExpr("U");
+      fct.DefineConst("U", uLB);
+      SPtr<BCAdapter> velBCAdapter(new VelocityBCAdapter(true, false, false, fct, 0, BCFunction::INFCONST));
+      velBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new VelocityWithDensityBCAlgorithm()));
+      //velBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new VelocityBCAlgorithm()));
+
+      SPtr<BCAdapter> outflowBCAdapter(new DensityBCAdapter(rhoLB));
+      outflowBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NonReflectingOutflowBCAlgorithm()));
+      //denBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NonEqDensityBCAlgorithm()));
+
+      BoundaryConditionsBlockVisitor bcVisitor;
+      bcVisitor.addBC(noSlipBCAdapter);
+      //bcVisitor.addBC(slipBCAdapter);
+      bcVisitor.addBC(velBCAdapter);
+      bcVisitor.addBC(outflowBCAdapter);
+
+      SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new CompressibleCumulant2LBMKernel(blockNx[0], blockNx[1], blockNx[2], CompressibleCumulant2LBMKernel::NORMAL));
+      SPtr<BCProcessor> bcProc;
+      if (thinWall)
+      {
+         bcProc = SPtr<BCProcessor>(new ThinWallBCProcessor());
+      }
+      else
+      {
+         bcProc = SPtr<BCProcessor>(new BCProcessor());
+      }
+      kernel->setBCProcessor(bcProc);
+      //////////////////////////////////////////////////////////////////////////
+      //restart
+      SPtr<UbScheduler> rSch(new UbScheduler(cpStep, cpStart));
+      //MPIIORestartCoProcessor rcp(grid, rSch, pathOut, comm);
+      //rcp.setChunk(chunk);
+      
+      SPtr<UbScheduler> rSch2(new UbScheduler(restartStep));
+      //RestartCoProcessor rp(grid, rSch2, comm, pathOut, RestartCoProcessor::BINARY);
+     
+      //MPIIORestart2CoProcessor rcp2(grid, rSch2, pathOut+"/mpiio2", comm);      
+      //rcp2.setLBMKernel(kernel);
+      //rcp2.setBCProcessor(bcProc);
+      
+      
+      MPIIORestart1CoProcessor rcp3(grid, rSch, pathOut+"/mpiio3", comm);
+      rcp3.setLBMKernel(kernel);
+      rcp3.setBCProcessor(bcProc);
+      
+      //MPIIORestart3CoProcessor rcp4(grid, rSch, pathOut+"/mpiio4", comm);
+      //rcp4.setLBMKernel(kernel);
+      //rcp4.setBCProcessor(bcProc);
+      //////////////////////////////////////////////////////////////////////////
+
+
+      if (myid==0)
+      {
+         UBLOG(logINFO, "PID = "<<myid<<" Point 2");
+         UBLOG(logINFO, "PID = "<<myid<<" Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB");
+      }
+
+      //if (grid->getTimeStep() == 0)
+      if (newStart)
+      {
+         ////////////////////////////////////////////////////////////////////////
+         //define grid
+         //////////////////////////////////////////////////////////////////////////
+         grid->setDeltaX(deltaXcoarse);
+         grid->setBlockNX(blockNx[0], blockNx[1], blockNx[2]);
+
+         SPtr<GbObject3D> gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
+         if (myid==0) GbSystem3D::writeGeoObject(gridCube.get(), pathOut+"/geo/gridCube", WbWriterVtkXmlASCII::getInstance());
+         GenBlocksGridVisitor genBlocks(gridCube);
+         grid->accept(genBlocks);
+
+         grid->setPeriodicX1(false);
+         grid->setPeriodicX2(true);
+         grid->setPeriodicX3(false);
+
+         if (myid==0)
+         {
+            UBLOG(logINFO, "Parameters:");
+            UBLOG(logINFO, "* Re                  = "<<Re);
+            UBLOG(logINFO, "* Ma                  = "<<Ma);
+            UBLOG(logINFO, "* velocity (uReal)    = "<<uReal<<" m/s");
+            UBLOG(logINFO, "* viscosity (nuReal)  = "<<nuReal<<" m^2/s");
+            UBLOG(logINFO, "* chord length (lReal)= "<<lReal<<" m");
+            UBLOG(logINFO, "* velocity LB (uLB)   = "<<uLB);
+            UBLOG(logINFO, "* viscosity LB (nuLB) = "<<nuLB);
+            UBLOG(logINFO, "* chord length (l_LB) = "<<lLB<<" dx_base");
+            UBLOG(logINFO, "* dx_base             = "<<deltaXcoarse/1000<<" m");
+            UBLOG(logINFO, "* dx_refine           = "<<deltaXfine/1000<<" m");
+            UBLOG(logINFO, "* blocknx             = "<<blockNx[0]<<"x"<<blockNx[1]<<"x"<<blockNx[2]);
+            UBLOG(logINFO, "* refineDistance      = "<<refineDistance);
+            UBLOG(logINFO, "* number of levels    = "<<refineLevel+1);
+            UBLOG(logINFO, "* number of threads   = "<<numOfThreads);
+            UBLOG(logINFO, "* number of processes = "<<comm->getNumberOfProcesses());
+            UBLOG(logINFO, "Preprozess - start");
+         }
+
+         SPtr<GbTriFaceMesh3D> fngMeshWhole1;
+         SPtr<GbTriFaceMesh3D> fngMeshWhole2;
+         SPtr<GbTriFaceMesh3D> fngMeshBodyPart;
+         SPtr<GbTriFaceMesh3D> fngMeshTrailingEdge;
+         SPtr<GbTriFaceMesh3D> porousTrailingEdge;
+         if (porousTralingEdge)
+         {
+            if (myid==0) UBLOG(logINFO, "Read fngFileBodyPart:start");
+            fngMeshBodyPart = SPtr<GbTriFaceMesh3D>(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(pathGeo+"/"+fngFileBodyPart, "fngMeshBody", GbTriFaceMesh3D::KDTREE_SAHPLIT, false));
+            if (myid==0) UBLOG(logINFO, "Read fngFileBodyPart:end");
+            fngMeshBodyPart->rotate(0.0, 0.5, 0.0);
+            if (myid==0) GbSystem3D::writeGeoObject(fngMeshBodyPart.get(), pathOut+"/geo/fngMeshBody", WbWriterVtkXmlBinary::getInstance());
+
+            if (myid==0) UBLOG(logINFO, "Read fngFileTrailingEdge:start");
+            fngMeshTrailingEdge = SPtr<GbTriFaceMesh3D>(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(pathGeo+"/"+fngFileTrailingEdge, "fngMeshTrailingEdge", GbTriFaceMesh3D::KDTREE_SAHPLIT, false));
+            if (myid==0) UBLOG(logINFO, "Read fngFileTrailingEdge:end");
+            fngMeshTrailingEdge->rotate(0.0, 0.5, 0.0);
+            fngMeshTrailingEdge->translate(-0.05, 0, 1.3);
+            if (myid==0) GbSystem3D::writeGeoObject(fngMeshTrailingEdge.get(), pathOut+"/geo/fngMeshTrailingEdge", WbWriterVtkXmlBinary::getInstance());
+
+            if (myid==0) UBLOG(logINFO, "Read porousTrailingEdge:start");
+            //porousTrailingEdge = SPtr<GbTriFaceMesh3D>(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(pathGeo+"/"+sampleFilename, "porousTrailingEdge", GbTriFaceMesh3D::KDTREE_SAHPLIT, false));
+            porousTrailingEdge = SPtr<GbTriFaceMesh3D>(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile2(pathGeo+"/"+sampleFilename, "porousTrailingEdge", GbTriFaceMesh3D::KDTREE_SAHPLIT, false));
+            if (myid==0) UBLOG(logINFO, "Read porousTrailingEdge:end");
+            porousTrailingEdge->rotate(90, -90, 0.0);
+            porousTrailingEdge->rotate(0, -4.3, 0.0);
+            //porousTrailingEdge->translate(280.5, 40.0, 3.5);
+            porousTrailingEdge->translate(276, 15.95, 3.5);
+            if (myid==0) GbSystem3D::writeGeoObject(porousTrailingEdge.get(), pathOut+"/geo/porousTrailingEdge", WbWriterVtkXmlASCII::getInstance());
+
+            //string samplePathname = pathGeo+"/"+sampleFilename;
+
+            //int pmNX1 = 669;
+            //int pmNX2 = 2945;
+            //int pmNX3 = 100;
+
+            //double deltaVoxelX1 = 13393e-6;
+            //double deltaVoxelX2 = 13393e-6;
+            //double deltaVoxelX3 = 13393e-6;
+
+            //double lthreshold = 11538;
+            //double uthreshold = 65535;
+
+            //if (myid==0) UBLOG(logINFO, "read voxel matrix: start");
+            //GbVoxelMatrix3DPtr porousTrailingEdge(new GbVoxelMatrix3D(pmNX1, pmNX2, pmNX3, 0.0 , lthreshold, uthreshold));
+            //porousTrailingEdge->readMatrixFromRawFile<unsigned short>(samplePathname, GbVoxelMatrix3D::BigEndian);
+            //porousTrailingEdge->setVoxelMatrixDelta((float)deltaVoxelX1, (float)deltaVoxelX2, (float)deltaVoxelX3);
+            //porousTrailingEdge->setVoxelMatrixMininum(0.0, 0.0, 0.0);
+            //if (myid==0) UBLOG(logINFO, "read voxel matrix: end");
+
+            //if (myid==0) UBLOG(logINFO, "rotate voxel matrix: start");
+            //porousTrailingEdge->rotate90aroundZ();
+            //porousTrailingEdge->rotate90aroundZ();
+            //porousTrailingEdge->rotate90aroundZ();
+            //porousTrailingEdge->rotate90aroundX();
+            //porousTrailingEdge->rotateAroundY(0.07);
+            //porousTrailingEdge->translate(276, 15.95, 3.26);
+            //
+            //if (myid==0) UBLOG(logINFO, "rotate voxel matrix: end");
+
+            ////if (myid==0) porousTrailingEdge->writeToVTKImageDataASCII(pathOut+"/geo/PorousTrailingEdge");
+            //if (myid==0) porousTrailingEdge->writeToVTKImageDataAppended(pathOut+"/geo/PorousTrailingEdge");
+
+         }
+         else
+         {
+            //if (myid==0) UBLOG(logINFO, "Read fngFileWhole1:start");
+            //fngMeshWhole1 = SPtr<GbTriFaceMesh3D>(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(pathGeo+"/"+fngFileWhole1, "fngMeshWhole1", GbTriFaceMesh3D::KDTREE_SAHPLIT, false));
+            //if (myid==0) UBLOG(logINFO, "Read fngFileWhole1:end");
+            //fngMeshWhole1->rotate(0.0, 0.5, 0.0);
+            //if (myid==0) GbSystem3D::writeGeoObject(fngMeshWhole1.get(), pathOut+"/geo/fngMeshWhole1", WbWriterVtkXmlBinary::getInstance());
+            
+            if (myid==0) UBLOG(logINFO, "Read fngFileWhole2:start");
+            fngMeshWhole2 = SPtr<GbTriFaceMesh3D>(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(pathGeo+"/"+fngFileWhole2, "fngMeshWhole2", GbTriFaceMesh3D::KDTREE_SAHPLIT, false));
+            if (myid==0) UBLOG(logINFO, "Read fngFileWhole2:end");
+            fngMeshWhole2->rotate(0.0, 0.5, 0.0);
+            if (myid==0) GbSystem3D::writeGeoObject(fngMeshWhole2.get(), pathOut+"/geo/fngMeshWhole2", WbWriterVtkXmlBinary::getInstance());
+         }
+
+         //////////////////////////////////////////////////////////////////////////
+         // Zackenband
+         //////////////////////////////////////////////////////////////////////////
+         //top
+         //////////////////////////////////////////////////////////////////////////
+         if (myid==0) UBLOG(logINFO, "Read zigZagTape:start");
+         string ZckbndFilename = pathGeo+"/"+zigZagTape;
+         SPtr<GbTriFaceMesh3D> meshBand1(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "zigZagTape1"));
+         meshBand1->rotate(0.0, 5, 0.0);
+         meshBand1->translate(15, 0, -12.850);
+         if (myid==0) GbSystem3D::writeGeoObject(meshBand1.get(), pathOut+"/geo/zigZagTape1", WbWriterVtkXmlASCII::getInstance());
+         // Zackenband2
+         SPtr<GbTriFaceMesh3D> meshBand2(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "zigZagTape2"));
+         meshBand2->rotate(0.0, 5, 0.0);
+         meshBand2->translate(15, 5, -12.850);
+         if (myid==0) GbSystem3D::writeGeoObject(meshBand2.get(), pathOut+"/geo/zigZagTape2", WbWriterVtkXmlASCII::getInstance());
+         //// Zackenband3
+         //SPtr<GbTriFaceMesh3D> meshBand3(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "zigZagTape3"));
+         //meshBand3->rotate(0.0, 5, 0.0);
+         //meshBand3->translate(15, 0, -12.35);
+         //if (myid==0) GbSystem3D::writeGeoObject(meshBand3.get(), pathOut+"/geo/zigZagTape3", WbWriterVtkXmlASCII::getInstance());
+         //// Zackenband4
+         //SPtr<GbTriFaceMesh3D> meshBand4(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "zigZagTape4"));
+         //meshBand4->rotate(0.0, 5, 0.0);
+         //meshBand4->translate(15, 5, -12.35);
+         //if (myid==0) GbSystem3D::writeGeoObject(meshBand4.get(), pathOut+"/geo/zigZagTape4", WbWriterVtkXmlASCII::getInstance());
+
+         //bottom
+         SPtr<GbTriFaceMesh3D> meshBand5(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "zigZagTape5"));
+         meshBand5->rotate(0.0, -1, 0.0);
+         meshBand5->rotate(0.0, 0.0, 180.0);
+         //meshBand5->translate(30, 0, -37.3);
+         meshBand5->translate(30, 0, -37.2);
+         if (myid==0) GbSystem3D::writeGeoObject(meshBand5.get(), pathOut+"/geo/zigZagTape5", WbWriterVtkXmlASCII::getInstance());
+         // Zackenband6
+         SPtr<GbTriFaceMesh3D> meshBand6(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "zigZagTape6"));
+         meshBand6->rotate(0.0, -1, 0.0);
+         meshBand6->rotate(0.0, 0.0, 180.0);
+         //meshBand6->translate(30, 5, -37.3);
+         meshBand6->translate(30, 5, -37.2);
+         if (myid==0) GbSystem3D::writeGeoObject(meshBand6.get(), pathOut+"/geo/zigZagTape6", WbWriterVtkXmlASCII::getInstance());
+         //// Zackenband7
+         //SPtr<GbTriFaceMesh3D> meshBand7(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "zigZagTape7"));
+         //meshBand7->rotate(0.0, 5, 0.0);
+         //meshBand7->translate(15, 0, -12.35);
+         //if (myid==0) GbSystem3D::writeGeoObject(meshBand7.get(), pathOut+"/geo/zigZagTape7", WbWriterVtkXmlASCII::getInstance());
+         //// Zackenband8
+         //SPtr<GbTriFaceMesh3D> meshBan8(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "zigZagTape8"));
+         //meshBan8->rotate(0.0, 5, 0.0);
+         //meshBan8->translate(15, 5, -12.35);
+         //if (myid==0) GbSystem3D::writeGeoObject(meshBan8.get(), pathOut+"/geo/zigZagTape8", WbWriterVtkXmlASCII::getInstance());
+         if (myid==0) UBLOG(logINFO, "Read zigZagTape:end");
+
+
+         if (myid==0)
+         {
+            UBLOG(logINFO, "PID = "<<myid<<" Point 3");
+            UBLOG(logINFO, "PID = "<<myid<<" Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB");
+         }
+         //////////////////////////////////////////////////////////////////////////
+         //return;
+
+         //SPtr<Interactor3D> fngIntrWhole1;
+         SPtr<Interactor3D> fngIntrWhole2;
+         SPtr<Interactor3D> fngIntrBodyPart;
+         SPtr<Interactor3D> fngIntrTrailingEdge;
+         SPtr<Interactor3D> porousIntrTrailingEdge;
+
+         if (porousTralingEdge)
+         {
+            fngIntrBodyPart = SPtr<D3Q27TriFaceMeshInteractor>(new D3Q27TriFaceMeshInteractor(fngMeshBodyPart, grid, noSlipBCAdapter, Interactor3D::SOLID, Interactor3D::EDGES));
+            fngIntrTrailingEdge = SPtr<D3Q27TriFaceMeshInteractor>(new D3Q27TriFaceMeshInteractor(fngMeshTrailingEdge, grid, noSlipBCAdapter, Interactor3D::SOLID, Interactor3D::EDGES));
+            porousIntrTrailingEdge = SPtr<D3Q27TriFaceMeshInteractor>(new D3Q27TriFaceMeshInteractor(porousTrailingEdge, grid, noSlipBCAdapter, Interactor3D::SOLID, Interactor3D::EDGES));
+         }
+         else
+         {
+            //fngIntrWhole1 = SPtr<D3Q27TriFaceMeshInteractor>(new D3Q27TriFaceMeshInteractor(fngMeshWhole1, grid, noSlipBCAdapter, Interactor3D::SOLID));
+            fngIntrWhole2 = SPtr<D3Q27TriFaceMeshInteractor>(new D3Q27TriFaceMeshInteractor(fngMeshWhole2, grid, noSlipBCAdapter, Interactor3D::SOLID));//, Interactor3D::POINTS));
+         }
+
+         SPtr<D3Q27TriFaceMeshInteractor> triBand1Interactor(new D3Q27TriFaceMeshInteractor(meshBand1, grid, noSlipBCAdapter, Interactor3D::SOLID, Interactor3D::EDGES));
+         SPtr<D3Q27TriFaceMeshInteractor> triBand2Interactor(new D3Q27TriFaceMeshInteractor(meshBand2, grid, noSlipBCAdapter, Interactor3D::SOLID, Interactor3D::EDGES));
+         SPtr<D3Q27TriFaceMeshInteractor> triBand3Interactor(new D3Q27TriFaceMeshInteractor(meshBand5, grid, noSlipBCAdapter, Interactor3D::SOLID, Interactor3D::EDGES));
+         SPtr<D3Q27TriFaceMeshInteractor> triBand4Interactor(new D3Q27TriFaceMeshInteractor(meshBand6, grid, noSlipBCAdapter, Interactor3D::SOLID, Interactor3D::EDGES));
+
+         if (refineLevel>0&&myid==0&&writeBlocks)
+         {
+            if (myid==0) UBLOG(logINFO, "Refinement - start");
+            //RefineCrossAndInsideGbObjectHelper refineHelper(grid, refineLevel);
+            //refineHelper.addGbObject(geo, refineLevel);
+            //refineHelper.refine();
+
+            //RefineAroundGbObjectHelper refineHelper1(grid, refineLevel-1, boost::dynamic_pointer_cast<D3Q27TriFaceMeshInteractor>(geoIntr1), 0.0, 10.0, comm);
+            //refineHelper1.refine();
+            //RefineAroundGbObjectHelper refineHelper2(grid, refineLevel, boost::dynamic_pointer_cast<D3Q27TriFaceMeshInteractor>(geoIntr2), -1.0, 5.0, comm);
+            //refineHelper2.refine();
+
+
+            int rank = grid->getRank();
+            grid->setRank(0);
+
+            if (porousTralingEdge)
+            {
+                dynamicPointerCast<D3Q27TriFaceMeshInteractor>(fngIntrBodyPart)->refineBlockGridToLevel(refineLevel-1, startDistance, refineDistance);
+            }
+            else
+            {
+                dynamicPointerCast<D3Q27TriFaceMeshInteractor>(fngIntrWhole2)->refineBlockGridToLevel(refineLevel, startDistance, refineDistance);
+            }
+
+            //boost::dynamic_pointer_cast<D3Q27TriFaceMeshInteractor>(triBand1Interactor)->refineBlockGridToLevel(refineLevel, 0.0, refineDistance);
+            //boost::dynamic_pointer_cast<D3Q27TriFaceMeshInteractor>(triBand2Interactor)->refineBlockGridToLevel(refineLevel, 0.0, refineDistance);
+            //boost::dynamic_pointer_cast<D3Q27TriFaceMeshInteractor>(triBand3Interactor)->refineBlockGridToLevel(refineLevel, 0.0, refineDistance);
+            //boost::dynamic_pointer_cast<D3Q27TriFaceMeshInteractor>(triBand4Interactor)->refineBlockGridToLevel(refineLevel, 0.0, refineDistance);
+
+
+            //SPtr<GbObject3D> fngBox(new GbCuboid3D(fngMeshWhole->getX1Minimum(), fngMeshWhole->getX2Minimum(), fngMeshWhole->getX3Minimum(),
+            //                                    fngMeshWhole->getX1Maximum(), fngMeshWhole->getX2Maximum(), fngMeshWhole->getX3Maximum()));
+            //if (myid==0) GbSystem3D::writeGeoObject(fngBox.get(), pathOut+"/geo/fngBox", WbWriterVtkXmlASCII::getInstance());
+
+            //RefineCrossAndInsideGbObjectBlockVisitor refVisitor0(fngBox, refineLevel);
+            //grid->accept(refVisitor0);
+
+
+            //SPtr<GbObject3D> bandTopBox(new GbCuboid3D(meshBand1->getX1Minimum(), meshBand1->getX2Minimum(), meshBand1->getX3Minimum(),
+            //   meshBand1->getX1Maximum(), meshBand1->getX2Maximum(), meshBand1->getX3Maximum()));
+            //if (myid==0) GbSystem3D::writeGeoObject(bandTopBox.get(), pathOut+"/geo/bandTopBox", WbWriterVtkXmlASCII::getInstance());
+
+            //RefineCrossAndInsideGbObjectBlockVisitor refVisitor1(bandTopBox, refineLevel-1);
+            //grid->accept(refVisitor1);
+
+            //SPtr<GbObject3D> bandBottomBox(new GbCuboid3D(meshBand5->getX1Minimum(), meshBand5->getX2Minimum(), meshBand5->getX3Minimum(),
+            //   meshBand5->getX1Maximum(), meshBand5->getX2Maximum(), meshBand5->getX3Maximum()));
+            //if (myid==0) GbSystem3D::writeGeoObject(bandBottomBox.get(), pathOut+"/geo/bandBottomBox", WbWriterVtkXmlASCII::getInstance());
+
+            //RefineCrossAndInsideGbObjectBlockVisitor refVisitor2(bandBottomBox, refineLevel-1);
+            //grid->accept(refVisitor2);
+
+            //SPtr<GbObject3D> teBox1(new GbCuboid3D(269.0, 0.0, 1.0, 270.0, 100.0, 8.5));
+            // for porous teY
+            //SPtr<GbObject3D> teBox1(new GbCuboid3D(269.0, 0.0, -10.0, 310.0, 100.0, 20.5));
+            //SPtr<GbObject3D> teBox1(new GbCuboid3D(200.0, 0.0, -20.0, 400.0, 100.0, 20.0));
+            //if (myid==0) GbSystem3D::writeGeoObject(teBox1.get(), pathOut+"/geo/teBox1", WbWriterVtkXmlASCII::getInstance());
+
+            //RefineCrossAndInsideGbObjectBlockVisitor refVisitor3(teBox1, 5);
+            //grid->accept(refVisitor3);
+
+            //SPtr<GbObject3D> teBox2(new GbCuboid3D(271.0, 0.0, 3.0, 279.0, 100.0, 5.7));
+            //if (myid==0) GbSystem3D::writeGeoObject(teBox2.get(), pathOut+"/geo/teBox2", WbWriterVtkXmlASCII::getInstance());
+
+            //RefineCrossAndInsideGbObjectBlockVisitor refVisitor4(teBox2, refineLevel);
+            //grid->accept(refVisitor4);
+
+            //level 1
+            SPtr<GbObject3D> wakeBoxL1(new GbCuboid3D(200.0, 0.0, -20.0, 2000.0, 100.0, 20.0));
+            if (myid==0) GbSystem3D::writeGeoObject(wakeBoxL1.get(), pathOut+"/geo/wakeBoxL1", WbWriterVtkXmlASCII::getInstance());
+            RefineCrossAndInsideGbObjectBlockVisitor refVisitorWakeBoxL1(wakeBoxL1, 1);
+            grid->accept(refVisitorWakeBoxL1);
+            
+            //level 4
+            //SPtr<GbObject3D> teBoxL5(new GbCuboid3D(200.0, 0.0, -20.0, 400.0, 100.0, 20.0));
+            //if (myid==0) GbSystem3D::writeGeoObject(teBoxL5.get(), pathOut+"/geo/teBoxL5", WbWriterVtkXmlASCII::getInstance());
+            //RefineCrossAndInsideGbObjectBlockVisitor refVisitorTeBoxL5(teBoxL5, 4);
+            //grid->accept(refVisitorTeBoxL5);
+            
+            //level 5
+            //SPtr<GbObject3D> teBoxL6(new GbCuboid3D(270.0, 0.0, -3.0, 320.0, 100.0, 10.0));
+            //if (myid==0) GbSystem3D::writeGeoObject(teBoxL6.get(), pathOut+"/geo/teBoxL6", WbWriterVtkXmlASCII::getInstance());
+            //RefineCrossAndInsideGbObjectBlockVisitor refVisitorTeBoxL6(teBoxL6, 5);
+            //grid->accept(refVisitorTeBoxL6);
+
+            grid->setRank(rank);
+
+            {
+               WriteBlocksCoProcessor ppblocks(grid, SPtr<UbScheduler>(new UbScheduler(1)), pathOut, WbWriterVtkXmlBinary::getInstance(), comm);
+               ppblocks.process(0);
+            }
+
+            ////////////////////////////////////////////
+            //METIS
+            //SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::BSW, MetisPartitioner::KWAY));
+            ////////////////////////////////////////////
+            /////delete solid blocks
+            if (myid==0) UBLOG(logINFO, "deleteSolidBlocks - start");
+            //InteractorsHelper intHelper(grid, metisVisitor);
+            //if (porousTralingEdge)
+            //{
+            //   intHelper.addInteractor(fngIntrBodyPart);
+            //}
+            //else
+            //{
+            //   intHelper.addInteractor(fngIntrWhole);
+            //}
+            //////////////////////////////////////////////////////////////////////////
+
+            //intHelper.selectBlocks();
+
+            if (porousTralingEdge)
+            {
+               SetSolidBlockVisitor v(fngIntrBodyPart, BlockType::SOLID);
+               grid->accept(v);
+               std::vector<SPtr<Block3D>>& sb = fngIntrBodyPart->getSolidBlockSet();
+               for(SPtr<Block3D> block : sb)
+               {
+                  grid->deleteBlock(block);
+               }
+               fngIntrBodyPart->removeSolidBlocks();
+               fngIntrBodyPart->removeBcBlocks();
+            }
+            else
+            {
+               SetSolidBlockVisitor v(fngIntrWhole2, BlockType::SOLID);
+               grid->accept(v);
+               std::vector<SPtr<Block3D>>& sb = fngIntrWhole2->getSolidBlockSet();
+               for(SPtr<Block3D> block : sb)
+               {
+                  grid->deleteBlock(block);
+               }
+               fngIntrWhole2->removeSolidBlocks();
+               fngIntrWhole2->removeBcBlocks();
+            }
+
+            if (myid==0) UBLOG(logINFO, "deleteSolidBlocks - end");
+            //////////////////////////////////////
+
+            //if (porousTralingEdge)
+            //{
+            //   grid->setRank(0);
+            //   boost::dynamic_pointer_cast<D3Q27TriFaceMeshInteractor>(fngIntrTrailingEdge)->refineBlockGridToLevel(refineLevel, startDistance, refineDistance);
+            //   grid->setRank(rank);
+
+            //   //SPtr<GbObject3D> trailingEdgeCube(new GbCuboid3D(fngMeshTrailingEdge->getX1Minimum()-blockLength, fngMeshTrailingEdge->getX2Minimum(), fngMeshTrailingEdge->getX3Minimum()-blockLength/2.0,
+            //   //   fngMeshTrailingEdge->getX1Maximum()+blockLength, fngMeshTrailingEdge->getX2Maximum(), fngMeshTrailingEdge->getX3Maximum()+blockLength/2.0));
+            //   //if (myid == 0) GbSystem3D::writeGeoObject(trailingEdgeCube.get(), pathOut + "/geo/trailingEdgeCube", WbWriterVtkXmlASCII::getInstance());
+
+            //   //RefineCrossAndInsideGbObjectBlockVisitor refVisitor(trailingEdgeCube, refineLevel);
+            //   //grid->accept(refVisitor);
+            //}
+
+            RatioBlockVisitor ratioVisitor(refineLevel);
+            CheckRatioBlockVisitor checkRatio(refineLevel);
+            int count = 0;
+
+            do {
+               grid->accept(ratioVisitor);
+               checkRatio.resetState();
+               grid->accept(checkRatio);
+               if (myid==0) UBLOG(logINFO, "count = "<<count++<<" state = "<<checkRatio.getState());
+            } while (!checkRatio.getState());
+
+            //RatioSmoothBlockVisitor ratioSmoothVisitor(refineLevel);
+            //grid->accept(ratioSmoothVisitor);
+
+            {
+               WriteBlocksCoProcessor ppblocks(grid, SPtr<UbScheduler>(new UbScheduler(1)), pathOut, WbWriterVtkXmlBinary::getInstance(), comm);
+               ppblocks.process(1);
+            }
+
+            OverlapBlockVisitor overlapVisitor(refineLevel, false);
+            grid->accept(overlapVisitor);
+
+            //std::vector<int> dirs;
+            //for (int i = D3Q27System::E; i <= D3Q27System::TS; i++)
+            //{
+            //   dirs.push_back(i);
+            //}
+            //SetInterpolationDirsBlockVisitor interDirsVisitor(dirs);
+            //grid->accept(interDirsVisitor);
+
+            if (myid==0) UBLOG(logINFO, "Refinement - end");
+         }
+         grid->updateDistributedBlocks(comm);
+
+         //if (writeBlocks)
+         //{
+         //   grid->updateDistributedBlocks(comm);
+         //   rcp.writeBlocks(0);
+         //}
+         //else
+         //{
+           //rcp.readBlocks(restartStep);
+           //grid->setTimeStep(restartStep);
+         //}
+
+         //return;
+
+         //Sleep(1000*myid);
+
+           
+
+
+         std::vector<int> dirs;
+         for (int i = D3Q27System::E; i<=D3Q27System::TS; i++)
+         {
+            dirs.push_back(i);
+         }
+         SetInterpolationDirsBlockVisitor interDirsVisitor(dirs);
+         grid->accept(interDirsVisitor);
+
+         //walls
+         GbCuboid3DPtr addWallZmin(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_minX3));
+         if (myid==0) GbSystem3D::writeGeoObject(addWallZmin.get(), pathOut+"/geo/addWallZmin", WbWriterVtkXmlASCII::getInstance());
+
+         GbCuboid3DPtr addWallZmax(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_maxX3, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength));
+         if (myid==0) GbSystem3D::writeGeoObject(addWallZmax.get(), pathOut+"/geo/addWallZmax", WbWriterVtkXmlASCII::getInstance());
+
+
+
+         //wall interactors
+         //SPtr<D3Q27Interactor> addWallZminInt(new D3Q27Interactor(addWallZmin, grid, slipBCAdapter, Interactor3D::SOLID));
+         //SPtr<D3Q27Interactor> addWallZmaxInt(new D3Q27Interactor(addWallZmax, grid, slipBCAdapter, Interactor3D::SOLID));
+         SPtr<D3Q27Interactor> addWallZminInt(new D3Q27Interactor(addWallZmin, grid, velBCAdapter, Interactor3D::SOLID));
+         SPtr<D3Q27Interactor> addWallZmaxInt(new D3Q27Interactor(addWallZmax, grid, velBCAdapter, Interactor3D::SOLID));
+
+         //inflow
+         GbCuboid3DPtr geoInflow(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3-blockLength, g_minX1, g_maxX2+blockLength, g_maxX3+blockLength));
+         if (myid==0) GbSystem3D::writeGeoObject(geoInflow.get(), pathOut+"/geo/geoInflow", WbWriterVtkXmlASCII::getInstance());
+
+         //outflow
+         GbCuboid3DPtr geoOutflow(new GbCuboid3D(g_maxX1, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength));
+         if (myid==0) GbSystem3D::writeGeoObject(geoOutflow.get(), pathOut+"/geo/geoOutflow", WbWriterVtkXmlASCII::getInstance());
+
+         //inflow
+         SPtr<D3Q27Interactor> inflowIntr = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoInflow, grid, velBCAdapter, Interactor3D::SOLID));
+
+         //outflow
+         SPtr<D3Q27Interactor> outflowIntr = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoOutflow, grid, outflowBCAdapter, Interactor3D::SOLID));
+
+         ////////////////////////////////////////////
+         //METIS
+         //grid->deleteBlockIDs();
+         //RenumberBlockVisitor renumber;
+         //grid->accept(renumber);
+         SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::BSW, MetisPartitioner::KWAY));
+         ////////////////////////////////////////////
+         /////delete solid blocks
+         if (myid==0) UBLOG(logINFO, "deleteSolidBlocks - start");
+         InteractorsHelper intHelper(grid, metisVisitor);
+         intHelper.addInteractor(inflowIntr);
+         intHelper.addInteractor(outflowIntr);
+         intHelper.addInteractor(addWallZminInt);
+         intHelper.addInteractor(addWallZmaxInt);
+         intHelper.addInteractor(triBand1Interactor);
+         intHelper.addInteractor(triBand2Interactor);
+         intHelper.addInteractor(triBand3Interactor);
+         intHelper.addInteractor(triBand4Interactor);
+         
+
+         if (porousTralingEdge)
+         {
+            intHelper.addInteractor(fngIntrBodyPart);
+            intHelper.addInteractor(porousIntrTrailingEdge);
+
+            //string samplePathname = pathGeo+"/"+sampleFilename;
+
+            //double pmNX1 = 669;
+            //double pmNX2 = 2945;
+            //double pmNX3 = 1119;
+
+            //double deltaVoxelX1 = 13393e-6;
+            //double deltaVoxelX2 = 13393e-6;
+            //double deltaVoxelX3 = 13393e-6;
+            //
+            //double lthreshold = 11538;
+            //double uthreshold = 65535;
+
+            //if (myid==0) UBLOG(logINFO, "read voxel matrix: start");
+            //GbVoxelMatrix3DPtr porousTrailingEdge(new GbVoxelMatrix3D(pmNX1, pmNX2, pmNX3, 0, lthreshold, uthreshold));
+            //porousTrailingEdge->readMatrixFromRawFile<unsigned short>(samplePathname, GbVoxelMatrix3D::BigEndian);
+            //porousTrailingEdge->setVoxelMatrixDelta((float)deltaVoxelX1, (float)deltaVoxelX2, (float)deltaVoxelX3);
+            //porousTrailingEdge->setVoxelMatrixMininum(0.0, 0.0, 0.0);
+            //if (myid==0) UBLOG(logINFO, "read voxel matrix: end");
+
+            //if (myid==0) UBLOG(logINFO, "rotate voxel matrix: start");
+            //porousTrailingEdge->rotate90aroundZ();
+            //porousTrailingEdge->rotate90aroundX();
+            //if (myid==0) UBLOG(logINFO, "rotate voxel matrix: end");
+
+            //if (myid==0) porousTrailingEdge->writeToVTKImageDataASCII(pathOut+"/geo/PorousTrailingEdge");
+         }
+         else
+         {
+            intHelper.addInteractor(fngIntrWhole2);
+         }
+
+         //////////////////////////////////////////////////////////////////////////
+         intHelper.selectBlocks();
+
+         if (myid==0) UBLOG(logINFO, "deleteSolidBlocks - end");
+
+         if (myid==0)
+         {
+            UBLOG(logINFO, "PID = "<<myid<<" Point 4");
+            UBLOG(logINFO, "PID = "<<myid<<" Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB");
+         }
+         //////////////////////////////////////
+
+         {
+            WriteBlocksCoProcessor ppblocks(grid, SPtr<UbScheduler>(new UbScheduler(1)), pathOut, WbWriterVtkXmlBinary::getInstance(), comm);
+            ppblocks.process(2);
+         }
+
+         unsigned long long numberOfBlocks = (unsigned long long)grid->getNumberOfBlocks();
+         int ghostLayer = 3;
+         unsigned long long numberOfNodesPerBlock = (unsigned long long)(blockNx[0])* (unsigned long long)(blockNx[1])* (unsigned long long)(blockNx[2]);
+         unsigned long long numberOfNodes = numberOfBlocks * numberOfNodesPerBlock;
+         unsigned long long numberOfNodesPerBlockWithGhostLayer = numberOfBlocks * (blockNx[0]+ghostLayer) * (blockNx[1]+ghostLayer) * (blockNx[2]+ghostLayer);
+         double needMemAll = double(numberOfNodesPerBlockWithGhostLayer*(27*sizeof(double)+sizeof(int)+sizeof(float)*4));
+         double needMem = needMemAll/double(comm->getNumberOfProcesses());
+
+         if (myid==0)
+         {
+            UBLOG(logINFO, "Number of blocks = "<<numberOfBlocks);
+            UBLOG(logINFO, "Number of nodes  = "<<numberOfNodes);
+            int minInitLevel = grid->getCoarsestInitializedLevel();
+            int maxInitLevel = grid->getFinestInitializedLevel();
+            for (int level = minInitLevel; level<=maxInitLevel; level++)
+            {
+               int nobl = grid->getNumberOfBlocks(level);
+               UBLOG(logINFO, "Number of blocks for level "<<level<<" = "<<nobl);
+               UBLOG(logINFO, "Number of nodes for level "<<level<<" = "<<nobl*numberOfNodesPerBlock);
+            }
+            UBLOG(logINFO, "Necessary memory  = "<<needMemAll<<" bytes");
+            UBLOG(logINFO, "Necessary memory per process = "<<needMem<<" bytes");
+            UBLOG(logINFO, "Available memory per process = "<<availMem<<" bytes");
+         }
+
+         //SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new CompressibleCumulantLBMKernel(blockNx[0], blockNx[1], blockNx[2], CompressibleCumulantLBMKernel::NORMAL));
+         ////SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new IncompressibleCumulantLBMKernel(blockNx[0], blockNx[1], blockNx[2], IncompressibleCumulantLBMKernel::NORMAL));
+
+         //SPtr<BCProcessor> bcProc;
+
+         //if (thinWall)
+         //{
+            //bcProc = SPtr<BCProcessor>(new ThinWallBCProcessor());
+         //}
+         //else
+         //{
+            //bcProc = SPtr<BCProcessor>(new BCProcessor());
+         //}
+
+         //kernel->setBCProcessor(bcProc);
+
+         SetKernelBlockVisitor kernelVisitor(kernel, nuLB, availMem, needMem);
+         grid->accept(kernelVisitor);
+
+         if (myid==0) UBLOG(logINFO, "SetKernelBlockVisitor:end");
+
+         if (myid==0)
+         {
+            UBLOG(logINFO, "PID = "<<myid<<" Point 5");
+            UBLOG(logINFO, "PID = "<<myid<<" Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB");
+         }
+
+         if (refineLevel>0)
+         {
+            SetUndefinedNodesBlockVisitor undefNodesVisitor;
+            grid->accept(undefNodesVisitor);
+         }
+
+         if (myid==0) UBLOG(logINFO, "SetUndefinedNodesBlockVisitor:end");
+
+         //BC
+         intHelper.setBC();
+         if (myid==0) UBLOG(logINFO, "intHelper.setBC():end");
+
+         if (myid==0)
+         {
+            UBLOG(logINFO, "PID = "<<myid<<" Point 6");
+            UBLOG(logINFO, "PID = "<<myid<<" Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB");
+         }
+
+
+
+         //initialization of distributions
+         mu::Parser inflowProfileVx1, inflowProfileVx2, inflowProfileVx3;
+         inflowProfileVx1.SetExpr("U*rangeRandom1()");
+         inflowProfileVx1.DefineConst("U", uLB);
+         inflowProfileVx1.DefineFun("rangeRandom1", rangeRandom1);
+         inflowProfileVx2.SetExpr("0.1*U*rangeRandom1()");
+         inflowProfileVx2.DefineConst("U", uLB);
+         inflowProfileVx2.DefineFun("rangeRandom1", rangeRandom1);
+         inflowProfileVx3.SetExpr("0.1*U*rangeRandom1()");
+         inflowProfileVx3.DefineConst("U", uLB);
+         inflowProfileVx3.DefineFun("rangeRandom1", rangeRandom1);
+
+         InitDistributionsBlockVisitor initVisitor1(nuLB, rhoLB);
+         initVisitor1.setVx1(fct);
+         ////initVisitor.setVx1(inflowProfileVx1);
+         ////initVisitor.setVx2(inflowProfileVx2);
+         ////initVisitor.setVx3(inflowProfileVx3);
+         ////initVisitor.setNu(nuLB);
+         grid->accept(initVisitor1);
+
+
+
+         ////set connectors
+         InterpolationProcessorPtr iProcessor(new CompressibleOffsetInterpolationProcessor());
+         //InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor());
+         SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
+         grid->accept(setConnsVisitor);
+
+         
+         //SPtr<Grid3D> oldGrid(new Grid3D(comm));
+         //
+         ////with MPIIORestartCoProcessor
+         //SPtr<UbScheduler> iSch(new UbScheduler());
+         //MPIIORestart1CoProcessor rcpInit(oldGrid, iSch, pathReInit, comm);
+         //rcpInit.setChunk(chunk);
+         //rcpInit.restart(stepReInit);
+
+         //////with MPIIORestart2CoProcessor
+         ////SPtr<UbScheduler> iSch(new UbScheduler());
+         ////MPIIORestart2CoProcessor rcp(oldGrid, iSch, pathReInit, comm);
+         ////rcp.readBlocks(stepReInit);
+         ////SPtr<Grid3DVisitor> newMetisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::BSW, MetisPartitioner::KWAY));
+         ////oldGrid->accept(newMetisVisitor);
+         ////rcp.readDataSet(stepReInit);
+         ////rcp.readBoundaryConds(stepReInit);
+
+         //InitDistributionsWithInterpolationGridVisitor initVisitor(oldGrid, iProcessor, nuLB);
+         //grid->accept(initVisitor);
+
+         //domain decomposition for threads
+         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
+         grid->accept(pqPartVisitor);
+
+         //bcVisitor should be accept after initialization!!!!
+         grid->accept(bcVisitor);
+         if (myid==0) UBLOG(logINFO, "grid->accept(bcVisitor):end");
+
+         if (myid==0)
+         {
+            UBLOG(logINFO, "PID = "<<myid<<" Point 7");
+            UBLOG(logINFO, "PID = "<<myid<<" Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB");
+         }
+
+
+         //Postrozess
+         {
+            SPtr<UbScheduler> geoSch(new UbScheduler(1));
+            WriteBoundaryConditionsCoProcessor ppgeo(grid, geoSch, pathOut, WbWriterVtkXmlBinary::getInstance(), conv, comm);
+            ppgeo.process(0);
+         }
+
+         if (myid==0)
+         {
+            UBLOG(logINFO, "PID = "<<myid<<" Point 8");
+            UBLOG(logINFO, "PID = "<<myid<<" Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB");
+         }
+
+         //fngIntrWhole1.reset();
+         fngIntrWhole2.reset();
+
+         ////SPtr<UbScheduler> rSch(new UbScheduler(cpStep, cpStart));
+         ////MPIIORestartCoProcessor rcp(grid, rSch, pathOut, comm);
+
+         GbCuboid3DPtr sponfeLayerBB1(new GbCuboid3D(g_maxX1-750, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength));
+         if (myid==0) GbSystem3D::writeGeoObject(geoOutflow.get(), pathOut+"/geo/geoOutflow", WbWriterVtkXmlASCII::getInstance());
+         SpongeLayerBlockVisitor slVisitor(sponfeLayerBB1);
+
+         if (myid==0) UBLOG(logINFO, "Preprozess - end");
+      }
+      else
+      {
+         
+         //rcp2.process(restartStep);
+         //return;
+         //////////////////////////////////////////////////////////////////////////
+         //////MPIIORestart2CoProcessor
+         //SPtr<UbScheduler> iSch(new UbScheduler());
+         //rcp2.readBlocks(restartStep);
+         //grid->updateDistributedBlocks(comm);
+         
+         //SPtr<Grid3DVisitor> newMetisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::BSW, MetisPartitioner::KWAY));
+         //grid->accept(newMetisVisitor);
+         
+         //rcp2.restart((int)restartStep);
+         //grid->setTimeStep(restartStep);
+         
+         //rcp.readBlocks(restartStep);
+         //rcp.readDataSet(restartStep);
+         //rcp.readBoundaryConds(restartStep);
+         //grid->setTimeStep(restartStep);
+         
+         //setBC(grid, pathGeo, fngFileWhole2, zigZagTape, boundingBox, uLB, rhoLB, blockLength, bcProc);
+         
+         //rp.process(restartStep);
+
+         rcp3.restart((int)restartStep);
+         grid->setTimeStep(restartStep);
+         
+         //{
+            //WriteBlocksCoProcessor ppblocks(grid, SPtr<UbScheduler>(new UbScheduler(1)), pathOut+"/mpiio3", WbWriterVtkXmlASCII::getInstance(), comm);
+            //ppblocks.process(0);
+         //}
+         
+         //{
+            //SPtr<UbScheduler> stepSch(new UbScheduler(1));
+            //WriteMacroscopicQuantitiesCoProcessor pp(grid, stepSch, pathOut+"/mpiio3", WbWriterVtkXmlBinary::getInstance(), conv, comm);
+            //pp.process(restartStep);
+         //} 
+ 
+         //{
+           
+            //SPtr<UbScheduler> geoSch(new UbScheduler(1));
+            //WriteBoundaryConditionsCoProcessor ppgeo(grid, geoSch, pathOut+"/mpiio3", WbWriterVtkXmlBinary::getInstance(), conv, comm);
+            //ppgeo.process(0);
+         //}
+
+         //rcp3.process(restartStep);
+         
+         //return;
+         
+         
+     
+            
+         
+                 
+         ////////////////////////////////////////////////////////////////////////////
+         InterpolationProcessorPtr iProcessor(new CompressibleOffsetInterpolationProcessor());
+         SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
+         grid->accept(setConnsVisitor);
+
+         grid->accept(bcVisitor);
+
+         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
+         grid->accept(pqPartVisitor);
+         
+      }
+
+      SPtr<UbScheduler> nupsSch(new UbScheduler(nupsStep[0], nupsStep[1], nupsStep[2]));
+      NUPSCounterCoProcessor npr(grid, nupsSch, numOfThreads, comm);
+
+      SPtr<UbScheduler> stepSch(new UbScheduler(outTimeStep,outTimeStart));
+
+
+
+      if (myid==0)
+      {
+         UBLOG(logINFO, "PID = "<<myid<<" Point 9");
+         UBLOG(logINFO, "PID = "<<myid<<" Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB");
+      }
+
+      ////////////////////////////////////////////////////////////////////////
+      ////MPIIORestart2CoProcessor 
+      //grid->deleteBlockIDs();
+      //RenumberBlockVisitor renumber;
+      //grid->accept(renumber);
+      //SPtr<UbScheduler> iSch(new UbScheduler(1));
+      //MPIIORestart2CoProcessor rcpInit(grid, iSch, pathOut+"/mpiio2", comm);
+      //rcpInit.process(0);
+      ////////////////////////////////////////////////////////////////////////
+
+      //////////////////////////////////////////////////////////////////////////
+      ////MPIIORestartCoProcessor 
+      //SPtr<UbScheduler> iSch(new UbScheduler(1));
+      //MPIIORestartCoProcessor rcpInit(grid, iSch, pathOut, comm);
+      //rcpInit.process(0);
+      //////////////////////////////////////////////////////////////////////////
+
+      WriteMacroscopicQuantitiesCoProcessor pp(grid, stepSch, pathOut, WbWriterVtkXmlBinary::getInstance(), conv, comm);
+      //pp.process(0);
+
+      //rcp.process(0);
+
+      //return;
+
+      //////////////////////////////////////////////////////////////////////////
+      ////Forces calculation
+      //////////////////////////////////////////////////////////////////////////
+      //if (myid==0) UBLOG(logINFO, "Read fngFileWhole2:start");
+      //SPtr<GbTriFaceMesh3D> fngMeshWhole2 = SPtr<GbTriFaceMesh3D>(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(pathGeo+"/"+fngFileWhole2, "fngMeshWhole2", GbTriFaceMesh3D::KDTREE_SAHPLIT, false));
+      //if (myid==0) UBLOG(logINFO, "Read fngFileWhole2:end");
+      //fngMeshWhole2->rotate(0.0, 0.5, 0.0);
+      //SPtr<D3Q27TriFaceMeshInteractor> fngIntrWhole2 = SPtr<D3Q27TriFaceMeshInteractor>(new D3Q27TriFaceMeshInteractor(fngMeshWhole2, grid, noSlipBCAdapter, Interactor3D::SOLID));
+
+      //SetSolidBlockVisitor fngVisitor(fngIntrWhole2, SetSolidBlockVisitor::BC);
+      //grid->accept(fngVisitor);
+      //fngIntrWhole2->initInteractor();
+      
+      //grid->accept(bcVisitor);
+
+      //string ZckbndFilename = pathGeo+"/"+zigZagTape;
+      //SPtr<GbTriFaceMesh3D> meshBand1(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "zigZagTape1"));
+      //meshBand1->rotate(0.0, 5, 0.0);
+      //meshBand1->translate(15, 0, -12.850);
+      //// Zackenband2
+      //SPtr<GbTriFaceMesh3D> meshBand2(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "zigZagTape2"));
+      //meshBand2->rotate(0.0, 5, 0.0);
+      //meshBand2->translate(15, 5, -12.850);
+
+      //SPtr<GbTriFaceMesh3D> meshBand5(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "zigZagTape5"));
+      //meshBand5->rotate(0.0, -1, 0.0);
+      //meshBand5->rotate(0.0, 0.0, 180.0);
+      //meshBand5->translate(30, 0, -37.2);
+      //// Zackenband6
+      //SPtr<GbTriFaceMesh3D> meshBand6(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "zigZagTape6"));
+      //meshBand6->rotate(0.0, -1, 0.0);
+      //meshBand6->rotate(0.0, 0.0, 180.0);
+      //meshBand6->translate(30, 5, -37.2);
+
+      //SPtr<D3Q27TriFaceMeshInteractor> triBand1Interactor(new D3Q27TriFaceMeshInteractor(meshBand1, grid, noSlipBCAdapter, Interactor3D::SOLID, Interactor3D::EDGES));
+      //SPtr<D3Q27TriFaceMeshInteractor> triBand2Interactor(new D3Q27TriFaceMeshInteractor(meshBand2, grid, noSlipBCAdapter, Interactor3D::SOLID, Interactor3D::EDGES));
+      //SPtr<D3Q27TriFaceMeshInteractor> triBand3Interactor(new D3Q27TriFaceMeshInteractor(meshBand5, grid, noSlipBCAdapter, Interactor3D::SOLID, Interactor3D::EDGES));
+      //SPtr<D3Q27TriFaceMeshInteractor> triBand4Interactor(new D3Q27TriFaceMeshInteractor(meshBand6, grid, noSlipBCAdapter, Interactor3D::SOLID, Interactor3D::EDGES));
+
+      //SetSolidOrTransBlockVisitor band1Visitor(triBand1Interactor, SetSolidOrTransBlockVisitor::TRANS);
+      //grid->accept(band1Visitor);
+      //triBand1Interactor->initInteractor();
+
+      //SetSolidOrTransBlockVisitor band2Visitor(triBand2Interactor, SetSolidOrTransBlockVisitor::TRANS);
+      //grid->accept(band2Visitor);
+      //triBand2Interactor->initInteractor();
+
+      //SetSolidOrTransBlockVisitor band3Visitor(triBand3Interactor, SetSolidOrTransBlockVisitor::TRANS);
+      //grid->accept(band3Visitor);
+      //triBand3Interactor->initInteractor();
+
+      //SetSolidOrTransBlockVisitor band4Visitor(triBand4Interactor, SetSolidOrTransBlockVisitor::TRANS);
+      //grid->accept(band4Visitor);
+      //triBand4Interactor->initInteractor();
+
+      //double b    = 30; //wingspan
+      //double t    = 300; //chord length
+      //double area = (b*t)/(deltaXcoarse*deltaXcoarse);
+      //double v    = uLB;
+
+      //CalculateForcesCoProcessor fp(grid, stepSch, pathOut + "/forces/forces.txt", comm, v, area);
+      //fp.addInteractor(fngIntrWhole2);
+      //fp.addInteractor(triBand1Interactor);
+      //fp.addInteractor(triBand2Interactor);
+      //fp.addInteractor(triBand3Interactor);
+      //fp.addInteractor(triBand4Interactor);
+      //////////////////////////////////////////////////////////////////////////
+
+      //////////////////////////////////////////////////////////////////////////
+      ////Cp calculation
+      //////////////////////////////////////////////////////////////////////////
+      //SPtr<UbScheduler> pcpSch(new UbScheduler(1, pcpStart, pcpStop));
+
+      //double planeCenter = g_minX2+(g_maxX2-g_minX2)/2.0;
+      //double planeX2min = planeCenter-deltaXfine;
+      //double planeX2max = planeCenter;//planeCenter+deltaXfine;
+      //GbCuboid3DPtr plane(new GbCuboid3D(g_minX1,planeX2min,g_minX3,g_maxX1,planeX2max,g_maxX3));
+      //if (myid==0) GbSystem3D::writeGeoObject(plane.get(), pathOut+"/geo/plane", WbWriterVtkXmlASCII::getInstance());
+
+      //PressureCoefficientCoProcessor pcp(grid, pcpSch, plane, pathOut+"/cp/cp", comm);
+      //pcp.addInteractor(fngIntrWhole2);
+      //////////////////////////////////////////////////////////////////////////
+
+      SPtr<UbScheduler> tavSch(new UbScheduler(1, timeAvStart, timeAvStop));
+      TimeAveragedValuesSPtr<CoProcessor> tav(new TimeAveragedValuesCoProcessor(grid, pathOut, WbWriterVtkXmlBinary::getInstance(), tavSch, comm,
+        TimeAveragedValuesCoProcessor::Density | TimeAveragedValuesCoProcessor::Velocity | TimeAveragedValuesCoProcessor::Fluctuations));
+      tav->setWithGhostLayer(true);
+
+      SPtr<IntegrateValuesHelper> mic1(new IntegrateValuesHelper(grid, comm,300-deltaXcoarse,35,-600-deltaXcoarse,
+         300,65,-600));
+      if (myid==0) GbSystem3D::writeGeoObject(mic1->getBoundingBox().get(), pathOut+"/geo/mic1", WbWriterVtkXmlBinary::getInstance());
+      SPtr<UbScheduler> stepMV(new UbScheduler(1));
+      //TimeseriesCoProcessor tsp1(grid, stepMV, mic1, pathOut+"/mic/mic1", comm);
+
+      //CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, stepSch));
+      //CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, tavSch, CalculationManager::MPI));
+
+
+      const SPtr<ConcreteCalculatorFactory> calculatorFactory = std::make_shared<ConcreteCalculatorFactory>(stepSch);
+      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, calculatorFactory, CalculatorType::PREPOSTBC));
+
+      if (myid==0) UBLOG(logINFO, "Simulation-start");
+      calculation->calculate();
+      if (myid==0) UBLOG(logINFO, "Simulation-end");
+      
+      ////////////////////////////////////////////////////////////////////////
+      //MPIIORestart2CoProcessor 
+      //grid->deleteBlockIDs();
+      //RenumberBlockVisitor renumber;
+      //grid->accept(renumber);
+      //SPtr<UbScheduler> iSch(new UbScheduler(1));
+      //MPIIORestart2CoProcessor rcpInit(grid, iSch, pathOut+"/mpiio2", comm);
+      //rcpInit.process(0);
+      ////////////////////////////////////////////////////////////////////////
+
+      if (myid==0)
+      {
+         UBLOG(logINFO, "PID = "<<myid<<" Point 10");
+         UBLOG(logINFO, "PID = "<<myid<<" Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB");
+      }
+   }
+   catch (std::exception& e)
+   {
+      cerr<<e.what()<<endl<<flush;
+   }
+   catch (std::string& s)
+   {
+      cerr<<s<<endl;
+   }
+   catch (...)
+   {
+      cerr<<"unknown exception"<<endl;
+   }
+
+}
+
+int main(int argc, char* argv[])
+{
+
+   if (argv!=NULL)
+   {
+      if (argv[1]!=NULL)
+      {
+         run(string(argv[1]));
+      }
+      else
+      {
+         cout<<"Configuration file must be set!: "<<argv[0]<<" <config file>"<<endl<<std::flush;
+      }
+   }
+
+   return 0;
+}
+
diff --git a/apps/cpu/DLR-F16/startJobPhoenix.slrm b/apps/cpu/DLR-F16/startJobPhoenix.slrm
index 666fa2a97efae9416875987448185890692bc632..6d6cddb976f0f5c82272068ec08b642f81f55415 100644
--- a/apps/cpu/DLR-F16/startJobPhoenix.slrm
+++ b/apps/cpu/DLR-F16/startJobPhoenix.slrm
@@ -1,14 +1,14 @@
-#!/bin/bash
-#SBATCH -J f16 
-#SBATCH --ntasks=300
-#SBATCH --ntasks-per-node=1
-#SBATCH --time=08:00:00 
-
-module load lib/boost/1.63.0/intel
-module load mpi/intelmpi/2017.2.174
-module load intel-studio-2017
-
-APP=./f16
-CONF=./DLR-F16-Phoenix.cfg
-
+#!/bin/bash
+#SBATCH -J f16 
+#SBATCH --ntasks=300
+#SBATCH --ntasks-per-node=1
+#SBATCH --time=08:00:00 
+
+module load lib/boost/1.63.0/intel
+module load mpi/intelmpi/2017.2.174
+module load intel-studio-2017
+
+APP=./f16
+CONF=./DLR-F16-Phoenix.cfg
+
 mpiexec $APP $CONF
\ No newline at end of file
diff --git a/apps/cpu/FlowAroundCylinder/CMakeLists.txt b/apps/cpu/FlowAroundCylinder/CMakeLists.txt
index f90461ae0426645645aee95d7861b12817464445..a4173b62b4aee940c48262c99ee0cd003d596bc5 100644
--- a/apps/cpu/FlowAroundCylinder/CMakeLists.txt
+++ b/apps/cpu/FlowAroundCylinder/CMakeLists.txt
@@ -1,25 +1,25 @@
-CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
-
-########################################################
-## C++ PROJECT                                       ###
-########################################################
-PROJECT(cylinder)
-
-INCLUDE(${APPS_ROOT}/IncludsList.cmake)  
-
-#################################################################
-###   LOCAL FILES                                             ###
-#################################################################
-FILE(GLOB SPECIFIC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.h
-                         ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
-                         ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp  )
- 
-SET(ALL_SOURCES ${ALL_SOURCES} ${SPECIFIC_FILES})
-SOURCE_GROUP(src FILES ${SPECIFIC_FILES})
-  
-SET(CAB_ADDITIONAL_LINK_LIBRARIES VirtualFluids)
-
-#################################################################
-###   CREATE PROJECT                                          ###
-#################################################################
-CREATE_CAB_PROJECT(cylinder BINARY)
+CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
+
+########################################################
+## C++ PROJECT                                       ###
+########################################################
+PROJECT(cylinder)
+
+INCLUDE(${APPS_ROOT}/IncludsList.cmake)  
+
+#################################################################
+###   LOCAL FILES                                             ###
+#################################################################
+FILE(GLOB SPECIFIC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.h
+                         ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
+                         ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp  )
+ 
+SET(ALL_SOURCES ${ALL_SOURCES} ${SPECIFIC_FILES})
+SOURCE_GROUP(src FILES ${SPECIFIC_FILES})
+  
+SET(CAB_ADDITIONAL_LINK_LIBRARIES VirtualFluids)
+
+#################################################################
+###   CREATE PROJECT                                          ###
+#################################################################
+CREATE_CAB_PROJECT(cylinder BINARY)
diff --git a/apps/cpu/FlowAroundCylinder/cylinder.cfg b/apps/cpu/FlowAroundCylinder/cylinder.cfg
index 3dd05a82b55438dc59653f15d4373d26d3238daf..b895c7a4949fd9b3367d76b50db1532461d1e0b3 100644
--- a/apps/cpu/FlowAroundCylinder/cylinder.cfg
+++ b/apps/cpu/FlowAroundCylinder/cylinder.cfg
@@ -1,22 +1,22 @@
-pathOut = d:/temp/cylinder_test
-
-numOfThreads = 4
-availMem = 15e9
-refineLevel = 1 
-blockNx = 25 41 41
-uLB = 0.001
-dx = 0.005
-#dx = 0.01
-
-logToFile = false
-
-newStart = true
-restartStep = 1000
-
-cpStart = 1000
-cpStep = 1000
-
-outTime = 100
-endTime = 100000
-
+pathOut = d:/temp/cylinder_test
+
+numOfThreads = 4
+availMem = 15e9
+refineLevel = 1 
+blockNx = 25 41 41
+uLB = 0.001
+dx = 0.005
+#dx = 0.01
+
+logToFile = false
+
+newStart = true
+restartStep = 1000
+
+cpStart = 1000
+cpStep = 1000
+
+outTime = 100
+endTime = 100000
+
 nupsStep = 100 100 10000000
\ No newline at end of file
diff --git a/apps/cpu/FlowAroundCylinder/cylinder.cpp b/apps/cpu/FlowAroundCylinder/cylinder.cpp
index ed3decfcaa58e62e1d629f141e71af08df51f932..da443cc37e002088316df79b3630225de54a490d 100644
--- a/apps/cpu/FlowAroundCylinder/cylinder.cpp
+++ b/apps/cpu/FlowAroundCylinder/cylinder.cpp
@@ -1,347 +1,347 @@
-#include <iostream>
-#include <string>
-
-#include "VirtualFluids.h"
-
-using namespace std;
-
-
-//////////////////////////////////////////////////////////////////////////
-void run(string configname)
-{
-   try
-   {
-      //DEBUG///////////////////////////////////////
-      //Sleep(30000);
-      /////////////////////////////////////////////
-      ConfigurationFile   config;
-      config.load(configname);
-
-      string          pathOut = config.getValue<string>("pathOut");
-      double          uLB = config.getValue<double>("uLB");
-      double          restartStep = config.getValue<double>("restartStep");
-      double          cpStart = config.getValue<double>("cpStart");
-      double          cpStep = config.getValue<double>("cpStep");
-      double          endTime = config.getValue<double>("endTime");
-      double          outTime = config.getValue<double>("outTime");
-      double          availMem = config.getValue<double>("availMem");
-      int             refineLevel = config.getValue<int>("refineLevel");
-      bool            logToFile = config.getValue<bool>("logToFile");
-      vector<double>  nupsStep = config.getVector<double>("nupsStep");
-      bool            newStart = config.getValue<bool>("newStart");
-      int             numOfThreads = config.getValue<int>("numOfThreads");
-      vector<int>     blockNx = config.getVector<int>("blockNx");
-      double          dx = config.getValue<double>("dx");
-
-      SPtr<Communicator> comm = MPICommunicator::getInstance();
-      int myid = comm->getProcessID();
-
-      if (logToFile)
-      {
-#if defined(__unix__)
-         if (myid==0)
-         {
-            const char* str = pathOut.c_str();
-            mkdir(str, S_IRWXU|S_IRWXG|S_IROTH|S_IXOTH);
-         }
-#endif 
-
-         if (myid==0)
-         {
-            stringstream logFilename;
-            logFilename<<pathOut+"/logfile"+UbSystem::toString(UbSystem::getTimeStamp())+".txt";
-            UbLog::output_policy::setStream(logFilename.str());
-         }
-      }
-
-      if (myid == 0) UBLOG(logINFO, "Test case: flow around cylinder");
-
-      
-
-      double L1 = 2.5;
-      double L2, L3, H;
-      L2 = L3 = H = 0.41;
-
-      LBMReal Re = 20.0;
-      LBMReal radius = 0.05;
-      LBMReal rhoReal = 1.0; //kg/m^3
-      LBMReal uReal = 0.45;//m/s
-      LBMReal nueReal = (uReal*radius*2.0)/Re;
-      
-      LBMReal rhoLB = 0.0;
-      LBMReal nueLB = (((4.0/9.0)*uLB)*2.0*(radius/dx))/Re;
-
-      SPtr<LBMUnitConverter> conv = SPtr<LBMUnitConverter>(new LBMUnitConverter());
-
-      const int baseLevel = 0;
-
-      SPtr<Grid3D> grid(new Grid3D(comm));
-
-      //BC
-      SPtr<BCAdapter> noSlipAdapter(new NoSlipBCAdapter());
-      noSlipAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NoSlipBCAlgorithm()));
-
-      mu::Parser fct;
-      fct.SetExpr("16*U*x2*x3*(H-x2)*(H-x3)/H^4");
-      fct.DefineConst("U", uLB);
-      fct.DefineConst("H", H);
-      SPtr<BCAdapter> velBCAdapter(new VelocityBCAdapter(true, false, false, fct, 0, BCFunction::INFCONST));
-      velBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new VelocityWithDensityBCAlgorithm()));
-
-      SPtr<BCAdapter> denBCAdapter(new DensityBCAdapter(rhoLB));
-      denBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NonReflectingOutflowBCAlgorithm()));
-      
-      BoundaryConditionsBlockVisitor bcVisitor;
-      bcVisitor.addBC(noSlipAdapter);
-      bcVisitor.addBC(velBCAdapter);
-      bcVisitor.addBC(denBCAdapter);
-
-      //////////////////////////////////////////////////////////////////////////
-      //restart
-      SPtr<UbScheduler> rSch(new UbScheduler(cpStep, cpStart));
-      //RestartCoProcessor rp(grid, rSch, comm, pathOut, RestartCoProcessor::BINARY);
-      MPIIORestartCoProcessor rcp(grid, rSch, pathOut, comm);
-      //////////////////////////////////////////////////////////////////////////
-
-      ////cylinder
-      SPtr<GbObject3D> cylinder(new GbCylinder3D(0.5, 0.2, -0.1, 0.5, 0.2, L3+0.1, radius));
-      GbSystem3D::writeGeoObject(cylinder.get(), pathOut+"/geo/cylinder", WbWriterVtkXmlBinary::getInstance());
-      
-      SPtr<D3Q27Interactor> cylinderInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(cylinder, grid, noSlipAdapter, Interactor3D::SOLID));
-
-      if (newStart)
-      {
-         if (myid==0)
-         {
-            UBLOG(logINFO, "Number of processes = "<<comm->getNumberOfProcesses());
-            UBLOG(logINFO, "Number of threads = "<<numOfThreads);
-            UBLOG(logINFO, "path = "<<pathOut);
-            UBLOG(logINFO, "L = "<<L1/dx);
-            UBLOG(logINFO, "H = "<<H/dx);
-            UBLOG(logINFO, "uReal = "<<uReal<<" m/s");
-            UBLOG(logINFO, "rhoReal = "<<rhoReal<<" kg/m^3");
-            UBLOG(logINFO, "nueReal = "<<nueReal<<" m^2/s");
-            UBLOG(logINFO, "uLB = "<<uLB);
-            UBLOG(logINFO, "rhoLB = "<<rhoLB);
-            UBLOG(logINFO, "nueLB = "<<nueLB);
-            UBLOG(logINFO, "Re = "<<Re);
-            UBLOG(logINFO, "dx coarse= "<<dx);
-            UBLOG(logINFO, "dx fine = "<<dx/(1<<refineLevel) );
-            UBLOG(logINFO, "Number of level = "<<refineLevel+1);
-            UBLOG(logINFO, "Preprozess - start");
-         }
-
-         SPtr<GbObject3D> refCylinder(new GbCylinder3D(0.5, 0.2, -0.1, 0.5, 0.2, L3+0.1, radius+7.0*dx/(1<<refineLevel)));
-         GbSystem3D::writeGeoObject(refCylinder.get(), pathOut+"/geo/refCylinder", WbWriterVtkXmlBinary::getInstance());
-
-         //bounding box
-         double g_minX1 = 0.0;
-         double g_minX2 = 0.0;
-         double g_minX3 = 0.0;
-
-         double g_maxX1 = L1;
-         double g_maxX2 = L2;
-         double g_maxX3 = L3;
-
-         SPtr<GbObject3D> gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
-         if (myid==0) GbSystem3D::writeGeoObject(gridCube.get(), pathOut+"/geo/gridCube", WbWriterVtkXmlBinary::getInstance());
-
-         const int blocknx1 = blockNx[0];
-         const int blocknx2 = blockNx[1];
-         const int blocknx3 = blockNx[2];
-
-         double blockLength = blocknx1*dx;
-
-         grid->setDeltaX(dx);
-         grid->setBlockNX(blocknx1, blocknx2, blocknx3);
-
-         GenBlocksGridVisitor genBlocks(gridCube);
-         grid->accept(genBlocks);
-
-         //walls
-         GbCuboid3DPtr addWallYmin(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_minX2, g_maxX3+blockLength));
-         if (myid==0) GbSystem3D::writeGeoObject(addWallYmin.get(), pathOut+"/geo/addWallYmin", WbWriterVtkXmlASCII::getInstance());
-
-         GbCuboid3DPtr addWallYmax(new GbCuboid3D(g_minX1-blockLength, g_maxX2, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength));
-         if (myid==0) GbSystem3D::writeGeoObject(addWallYmax.get(), pathOut+"/geo/addWallYmax", WbWriterVtkXmlASCII::getInstance());
-
-         GbCuboid3DPtr addWallZmin(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_minX3));
-         if (myid==0) GbSystem3D::writeGeoObject(addWallZmin.get(), pathOut+"/geo/addWallZmin", WbWriterVtkXmlASCII::getInstance());
-
-         GbCuboid3DPtr addWallZmax(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_maxX3, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength));
-         if (myid==0) GbSystem3D::writeGeoObject(addWallZmax.get(), pathOut+"/geo/addWallZmax", WbWriterVtkXmlASCII::getInstance());
-
-         //inflow
-         GbCuboid3DPtr geoInflow(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3-blockLength, g_minX1, g_maxX2+blockLength, g_maxX3+blockLength));
-         if (myid==0) GbSystem3D::writeGeoObject(geoInflow.get(), pathOut+"/geo/geoInflow", WbWriterVtkXmlASCII::getInstance());
-
-         //outflow
-         GbCuboid3DPtr geoOutflow(new GbCuboid3D(g_maxX1, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength));
-         if (myid==0) GbSystem3D::writeGeoObject(geoOutflow.get(), pathOut+"/geo/geoOutflow", WbWriterVtkXmlASCII::getInstance());
-
-         SPtr<CoProcessor> ppblocks(new WriteBlocksCoProcessor(grid, SPtr<UbScheduler>(new UbScheduler(1)), pathOut, WbWriterVtkXmlBinary::getInstance(), comm));
-
-         if (refineLevel>0)
-         {
-            if (myid==0) UBLOG(logINFO, "Refinement - start");
-            RefineCrossAndInsideGbObjectHelper refineHelper(grid, refineLevel, comm);
-            refineHelper.addGbObject(refCylinder, refineLevel);
-            refineHelper.refine();
-            if (myid==0) UBLOG(logINFO, "Refinement - end");
-         }
-
-         //walls
-         SPtr<D3Q27Interactor> addWallYminInt(new D3Q27Interactor(addWallYmin, grid, noSlipAdapter, Interactor3D::SOLID));
-         SPtr<D3Q27Interactor> addWallYmaxInt(new D3Q27Interactor(addWallYmax, grid, noSlipAdapter, Interactor3D::SOLID));
-         SPtr<D3Q27Interactor> addWallZminInt(new D3Q27Interactor(addWallZmin, grid, noSlipAdapter, Interactor3D::SOLID));
-         SPtr<D3Q27Interactor> addWallZmaxInt(new D3Q27Interactor(addWallZmax, grid, noSlipAdapter, Interactor3D::SOLID));
-
-         //inflow
-         SPtr<D3Q27Interactor> inflowInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoInflow, grid, velBCAdapter, Interactor3D::SOLID));
-
-         //outflow
-         SPtr<D3Q27Interactor> outflowInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoOutflow, grid, denBCAdapter, Interactor3D::SOLID));
-
-         
-         SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B));
-         InteractorsHelper intHelper(grid, metisVisitor);
-         intHelper.addInteractor(cylinderInt);
-         intHelper.addInteractor(addWallYminInt);
-         intHelper.addInteractor(addWallYmaxInt);
-         intHelper.addInteractor(addWallZminInt);
-         intHelper.addInteractor(addWallZmaxInt);
-         intHelper.addInteractor(inflowInt);
-         intHelper.addInteractor(outflowInt);
-         intHelper.selectBlocks();
-
-
-         ppblocks->process(0);
-         ppblocks.reset();
-
-         unsigned long long numberOfBlocks = (unsigned long long)grid->getNumberOfBlocks();
-         int ghostLayer = 3;
-         unsigned long long numberOfNodesPerBlock = (unsigned long long)(blockNx[0])* (unsigned long long)(blockNx[1])* (unsigned long long)(blockNx[2]);
-         unsigned long long numberOfNodes = numberOfBlocks * numberOfNodesPerBlock;
-         unsigned long long numberOfNodesPerBlockWithGhostLayer = numberOfBlocks * (blockNx[0]+ghostLayer) * (blockNx[1]+ghostLayer) * (blockNx[2]+ghostLayer);
-         double needMemAll = double(numberOfNodesPerBlockWithGhostLayer*(27*sizeof(double)+sizeof(int)+sizeof(float)*4));
-         double needMem = needMemAll/double(comm->getNumberOfProcesses());
-
-         if (myid==0)
-         {
-            UBLOG(logINFO, "Number of blocks = "<<numberOfBlocks);
-            UBLOG(logINFO, "Number of nodes  = "<<numberOfNodes);
-            int minInitLevel = grid->getCoarsestInitializedLevel();
-            int maxInitLevel = grid->getFinestInitializedLevel();
-            for (int level = minInitLevel; level<=maxInitLevel; level++)
-            {
-               int nobl = grid->getNumberOfBlocks(level);
-               UBLOG(logINFO, "Number of blocks for level "<<level<<" = "<<nobl);
-               UBLOG(logINFO, "Number of nodes for level "<<level<<" = "<<nobl*numberOfNodesPerBlock);
-            }
-            UBLOG(logINFO, "Necessary memory  = "<<needMemAll<<" bytes");
-            UBLOG(logINFO, "Necessary memory per process = "<<needMem<<" bytes");
-            UBLOG(logINFO, "Available memory per process = "<<availMem<<" bytes");
-         }
-
-         SPtr<LBMKernel> kernel(new CompressibleCumulantLBMKernel());
-
-         SPtr<BCProcessor> bcProc(new BCProcessor());
-         kernel->setBCProcessor(bcProc);
-
-         SetKernelBlockVisitor kernelVisitor(kernel, nueLB, availMem, needMem);
-         grid->accept(kernelVisitor);
-
-         if (refineLevel>0)
-         {
-            SetUndefinedNodesBlockVisitor undefNodesVisitor;
-            grid->accept(undefNodesVisitor);
-         }
-
-         intHelper.setBC();
-
-         //domain decomposition
-         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
-         grid->accept(pqPartVisitor);
-
-         //initialization of distributions
-         InitDistributionsBlockVisitor initVisitor;
-         initVisitor.setVx1(fct);
-         grid->accept(initVisitor);
-
-;
-         grid->accept(bcVisitor);
-
-         //Postrozess
-         SPtr<UbScheduler> geoSch(new UbScheduler(1));
-         SPtr<CoProcessor> ppgeo(
-            new WriteBoundaryConditionsCoProcessor(grid, geoSch, pathOut, WbWriterVtkXmlBinary::getInstance(), comm));
-         ppgeo->process(0);
-         ppgeo.reset();
-
-         if (myid==0) UBLOG(logINFO, "Preprozess - end");
-      }
-      else
-      {
-         rcp.restart((int)restartStep);
-         grid->setTimeStep(restartStep);
-
-         grid->accept(bcVisitor);
-      }
-
-	  //set connectors
-	  InterpolationProcessorPtr iProcessor(new CompressibleOffsetMomentsInterpolationProcessor());
-	  SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
-	  grid->accept(setConnsVisitor);
-
-      SPtr<UbScheduler> stepSch(new UbScheduler(outTime));
-
-	  SPtr<CoProcessor> writeMQCoProcessor(new WriteMacroscopicQuantitiesCoProcessor(grid, stepSch, pathOut, WbWriterVtkXmlBinary::getInstance(), conv, comm));
-
-      //double area = (2.0*radius*H)/(dx*dx);
-      //double v    = 4.0*uLB/9.0;
-      //CalculateForcesCoProcessor fp(grid, stepSch, pathOut + "/results/forces.txt", comm, v, area);
-      //fp.addInteractor(cylinderInt);
-
-	  SPtr<UbScheduler> nupsSch(new UbScheduler(nupsStep[0], nupsStep[1], nupsStep[2]));
-	  std::shared_ptr<CoProcessor> nupsCoProcessor(new NUPSCounterCoProcessor(grid, nupsSch, numOfThreads, comm));
-
-	  omp_set_num_threads(numOfThreads);
-	  SPtr<UbScheduler> stepGhostLayer(new UbScheduler(1));
-	  SPtr<Calculator> calculator(new BasicCalculator(grid, stepGhostLayer, endTime));
-	  calculator->addCoProcessor(nupsCoProcessor);
-	  calculator->addCoProcessor(writeMQCoProcessor);
-      if(myid == 0) UBLOG(logINFO,"Simulation-start");
-	  calculator->calculate();
-      if(myid == 0) UBLOG(logINFO,"Simulation-end");
-   }
-   catch(std::exception& e)
-   {
-      cerr << e.what() << endl << flush;
-   }
-   catch(std::string& s)
-   {
-      cerr << s << endl;
-   }
-   catch(...)
-   {
-      cerr << "unknown exception" << endl;
-   }
-
-}
-//////////////////////////////////////////////////////////////////////////
-int main(int argc, char* argv[])
-{
-   if (argv!=NULL)
-   {
-      if (argv[1]!=NULL)
-      {
-         run(string(argv[1]));
-      }
-      else
-      {
-         cout<<"Configuration file must be set!: "<<argv[0]<<" <config file>"<<endl<<std::flush;
-      }
-   }
-   return 0;
-}
-
+#include <iostream>
+#include <string>
+
+#include "VirtualFluids.h"
+
+using namespace std;
+
+
+//////////////////////////////////////////////////////////////////////////
+void run(string configname)
+{
+   try
+   {
+      //DEBUG///////////////////////////////////////
+      //Sleep(30000);
+      /////////////////////////////////////////////
+      ConfigurationFile   config;
+      config.load(configname);
+
+      string          pathOut = config.getValue<string>("pathOut");
+      double          uLB = config.getValue<double>("uLB");
+      double          restartStep = config.getValue<double>("restartStep");
+      double          cpStart = config.getValue<double>("cpStart");
+      double          cpStep = config.getValue<double>("cpStep");
+      double          endTime = config.getValue<double>("endTime");
+      double          outTime = config.getValue<double>("outTime");
+      double          availMem = config.getValue<double>("availMem");
+      int             refineLevel = config.getValue<int>("refineLevel");
+      bool            logToFile = config.getValue<bool>("logToFile");
+      vector<double>  nupsStep = config.getVector<double>("nupsStep");
+      bool            newStart = config.getValue<bool>("newStart");
+      int             numOfThreads = config.getValue<int>("numOfThreads");
+      vector<int>     blockNx = config.getVector<int>("blockNx");
+      double          dx = config.getValue<double>("dx");
+
+      SPtr<Communicator> comm = MPICommunicator::getInstance();
+      int myid = comm->getProcessID();
+
+      if (logToFile)
+      {
+#if defined(__unix__)
+         if (myid==0)
+         {
+            const char* str = pathOut.c_str();
+            mkdir(str, S_IRWXU|S_IRWXG|S_IROTH|S_IXOTH);
+         }
+#endif 
+
+         if (myid==0)
+         {
+            stringstream logFilename;
+            logFilename<<pathOut+"/logfile"+UbSystem::toString(UbSystem::getTimeStamp())+".txt";
+            UbLog::output_policy::setStream(logFilename.str());
+         }
+      }
+
+      if (myid == 0) UBLOG(logINFO, "Test case: flow around cylinder");
+
+      
+
+      double L1 = 2.5;
+      double L2, L3, H;
+      L2 = L3 = H = 0.41;
+
+      LBMReal Re = 20.0;
+      LBMReal radius = 0.05;
+      LBMReal rhoReal = 1.0; //kg/m^3
+      LBMReal uReal = 0.45;//m/s
+      LBMReal nueReal = (uReal*radius*2.0)/Re;
+      
+      LBMReal rhoLB = 0.0;
+      LBMReal nueLB = (((4.0/9.0)*uLB)*2.0*(radius/dx))/Re;
+
+      SPtr<LBMUnitConverter> conv = SPtr<LBMUnitConverter>(new LBMUnitConverter());
+
+      const int baseLevel = 0;
+
+      SPtr<Grid3D> grid(new Grid3D(comm));
+
+      //BC
+      SPtr<BCAdapter> noSlipAdapter(new NoSlipBCAdapter());
+      noSlipAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NoSlipBCAlgorithm()));
+
+      mu::Parser fct;
+      fct.SetExpr("16*U*x2*x3*(H-x2)*(H-x3)/H^4");
+      fct.DefineConst("U", uLB);
+      fct.DefineConst("H", H);
+      SPtr<BCAdapter> velBCAdapter(new VelocityBCAdapter(true, false, false, fct, 0, BCFunction::INFCONST));
+      velBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new VelocityWithDensityBCAlgorithm()));
+
+      SPtr<BCAdapter> denBCAdapter(new DensityBCAdapter(rhoLB));
+      denBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NonReflectingOutflowBCAlgorithm()));
+      
+      BoundaryConditionsBlockVisitor bcVisitor;
+      bcVisitor.addBC(noSlipAdapter);
+      bcVisitor.addBC(velBCAdapter);
+      bcVisitor.addBC(denBCAdapter);
+
+      //////////////////////////////////////////////////////////////////////////
+      //restart
+      SPtr<UbScheduler> rSch(new UbScheduler(cpStep, cpStart));
+      //RestartCoProcessor rp(grid, rSch, comm, pathOut, RestartCoProcessor::BINARY);
+      MPIIORestartCoProcessor rcp(grid, rSch, pathOut, comm);
+      //////////////////////////////////////////////////////////////////////////
+
+      ////cylinder
+      SPtr<GbObject3D> cylinder(new GbCylinder3D(0.5, 0.2, -0.1, 0.5, 0.2, L3+0.1, radius));
+      GbSystem3D::writeGeoObject(cylinder.get(), pathOut+"/geo/cylinder", WbWriterVtkXmlBinary::getInstance());
+      
+      SPtr<D3Q27Interactor> cylinderInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(cylinder, grid, noSlipAdapter, Interactor3D::SOLID));
+
+      if (newStart)
+      {
+         if (myid==0)
+         {
+            UBLOG(logINFO, "Number of processes = "<<comm->getNumberOfProcesses());
+            UBLOG(logINFO, "Number of threads = "<<numOfThreads);
+            UBLOG(logINFO, "path = "<<pathOut);
+            UBLOG(logINFO, "L = "<<L1/dx);
+            UBLOG(logINFO, "H = "<<H/dx);
+            UBLOG(logINFO, "uReal = "<<uReal<<" m/s");
+            UBLOG(logINFO, "rhoReal = "<<rhoReal<<" kg/m^3");
+            UBLOG(logINFO, "nueReal = "<<nueReal<<" m^2/s");
+            UBLOG(logINFO, "uLB = "<<uLB);
+            UBLOG(logINFO, "rhoLB = "<<rhoLB);
+            UBLOG(logINFO, "nueLB = "<<nueLB);
+            UBLOG(logINFO, "Re = "<<Re);
+            UBLOG(logINFO, "dx coarse= "<<dx);
+            UBLOG(logINFO, "dx fine = "<<dx/(1<<refineLevel) );
+            UBLOG(logINFO, "Number of level = "<<refineLevel+1);
+            UBLOG(logINFO, "Preprozess - start");
+         }
+
+         SPtr<GbObject3D> refCylinder(new GbCylinder3D(0.5, 0.2, -0.1, 0.5, 0.2, L3+0.1, radius+7.0*dx/(1<<refineLevel)));
+         GbSystem3D::writeGeoObject(refCylinder.get(), pathOut+"/geo/refCylinder", WbWriterVtkXmlBinary::getInstance());
+
+         //bounding box
+         double g_minX1 = 0.0;
+         double g_minX2 = 0.0;
+         double g_minX3 = 0.0;
+
+         double g_maxX1 = L1;
+         double g_maxX2 = L2;
+         double g_maxX3 = L3;
+
+         SPtr<GbObject3D> gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
+         if (myid==0) GbSystem3D::writeGeoObject(gridCube.get(), pathOut+"/geo/gridCube", WbWriterVtkXmlBinary::getInstance());
+
+         const int blocknx1 = blockNx[0];
+         const int blocknx2 = blockNx[1];
+         const int blocknx3 = blockNx[2];
+
+         double blockLength = blocknx1*dx;
+
+         grid->setDeltaX(dx);
+         grid->setBlockNX(blocknx1, blocknx2, blocknx3);
+
+         GenBlocksGridVisitor genBlocks(gridCube);
+         grid->accept(genBlocks);
+
+         //walls
+         GbCuboid3DPtr addWallYmin(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_minX2, g_maxX3+blockLength));
+         if (myid==0) GbSystem3D::writeGeoObject(addWallYmin.get(), pathOut+"/geo/addWallYmin", WbWriterVtkXmlASCII::getInstance());
+
+         GbCuboid3DPtr addWallYmax(new GbCuboid3D(g_minX1-blockLength, g_maxX2, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength));
+         if (myid==0) GbSystem3D::writeGeoObject(addWallYmax.get(), pathOut+"/geo/addWallYmax", WbWriterVtkXmlASCII::getInstance());
+
+         GbCuboid3DPtr addWallZmin(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_minX3));
+         if (myid==0) GbSystem3D::writeGeoObject(addWallZmin.get(), pathOut+"/geo/addWallZmin", WbWriterVtkXmlASCII::getInstance());
+
+         GbCuboid3DPtr addWallZmax(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_maxX3, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength));
+         if (myid==0) GbSystem3D::writeGeoObject(addWallZmax.get(), pathOut+"/geo/addWallZmax", WbWriterVtkXmlASCII::getInstance());
+
+         //inflow
+         GbCuboid3DPtr geoInflow(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3-blockLength, g_minX1, g_maxX2+blockLength, g_maxX3+blockLength));
+         if (myid==0) GbSystem3D::writeGeoObject(geoInflow.get(), pathOut+"/geo/geoInflow", WbWriterVtkXmlASCII::getInstance());
+
+         //outflow
+         GbCuboid3DPtr geoOutflow(new GbCuboid3D(g_maxX1, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength));
+         if (myid==0) GbSystem3D::writeGeoObject(geoOutflow.get(), pathOut+"/geo/geoOutflow", WbWriterVtkXmlASCII::getInstance());
+
+         SPtr<CoProcessor> ppblocks(new WriteBlocksCoProcessor(grid, SPtr<UbScheduler>(new UbScheduler(1)), pathOut, WbWriterVtkXmlBinary::getInstance(), comm));
+
+         if (refineLevel>0)
+         {
+            if (myid==0) UBLOG(logINFO, "Refinement - start");
+            RefineCrossAndInsideGbObjectHelper refineHelper(grid, refineLevel, comm);
+            refineHelper.addGbObject(refCylinder, refineLevel);
+            refineHelper.refine();
+            if (myid==0) UBLOG(logINFO, "Refinement - end");
+         }
+
+         //walls
+         SPtr<D3Q27Interactor> addWallYminInt(new D3Q27Interactor(addWallYmin, grid, noSlipAdapter, Interactor3D::SOLID));
+         SPtr<D3Q27Interactor> addWallYmaxInt(new D3Q27Interactor(addWallYmax, grid, noSlipAdapter, Interactor3D::SOLID));
+         SPtr<D3Q27Interactor> addWallZminInt(new D3Q27Interactor(addWallZmin, grid, noSlipAdapter, Interactor3D::SOLID));
+         SPtr<D3Q27Interactor> addWallZmaxInt(new D3Q27Interactor(addWallZmax, grid, noSlipAdapter, Interactor3D::SOLID));
+
+         //inflow
+         SPtr<D3Q27Interactor> inflowInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoInflow, grid, velBCAdapter, Interactor3D::SOLID));
+
+         //outflow
+         SPtr<D3Q27Interactor> outflowInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoOutflow, grid, denBCAdapter, Interactor3D::SOLID));
+
+         
+         SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B));
+         InteractorsHelper intHelper(grid, metisVisitor);
+         intHelper.addInteractor(cylinderInt);
+         intHelper.addInteractor(addWallYminInt);
+         intHelper.addInteractor(addWallYmaxInt);
+         intHelper.addInteractor(addWallZminInt);
+         intHelper.addInteractor(addWallZmaxInt);
+         intHelper.addInteractor(inflowInt);
+         intHelper.addInteractor(outflowInt);
+         intHelper.selectBlocks();
+
+
+         ppblocks->process(0);
+         ppblocks.reset();
+
+         unsigned long long numberOfBlocks = (unsigned long long)grid->getNumberOfBlocks();
+         int ghostLayer = 3;
+         unsigned long long numberOfNodesPerBlock = (unsigned long long)(blockNx[0])* (unsigned long long)(blockNx[1])* (unsigned long long)(blockNx[2]);
+         unsigned long long numberOfNodes = numberOfBlocks * numberOfNodesPerBlock;
+         unsigned long long numberOfNodesPerBlockWithGhostLayer = numberOfBlocks * (blockNx[0]+ghostLayer) * (blockNx[1]+ghostLayer) * (blockNx[2]+ghostLayer);
+         double needMemAll = double(numberOfNodesPerBlockWithGhostLayer*(27*sizeof(double)+sizeof(int)+sizeof(float)*4));
+         double needMem = needMemAll/double(comm->getNumberOfProcesses());
+
+         if (myid==0)
+         {
+            UBLOG(logINFO, "Number of blocks = "<<numberOfBlocks);
+            UBLOG(logINFO, "Number of nodes  = "<<numberOfNodes);
+            int minInitLevel = grid->getCoarsestInitializedLevel();
+            int maxInitLevel = grid->getFinestInitializedLevel();
+            for (int level = minInitLevel; level<=maxInitLevel; level++)
+            {
+               int nobl = grid->getNumberOfBlocks(level);
+               UBLOG(logINFO, "Number of blocks for level "<<level<<" = "<<nobl);
+               UBLOG(logINFO, "Number of nodes for level "<<level<<" = "<<nobl*numberOfNodesPerBlock);
+            }
+            UBLOG(logINFO, "Necessary memory  = "<<needMemAll<<" bytes");
+            UBLOG(logINFO, "Necessary memory per process = "<<needMem<<" bytes");
+            UBLOG(logINFO, "Available memory per process = "<<availMem<<" bytes");
+         }
+
+         SPtr<LBMKernel> kernel(new CompressibleCumulantLBMKernel());
+
+         SPtr<BCProcessor> bcProc(new BCProcessor());
+         kernel->setBCProcessor(bcProc);
+
+         SetKernelBlockVisitor kernelVisitor(kernel, nueLB, availMem, needMem);
+         grid->accept(kernelVisitor);
+
+         if (refineLevel>0)
+         {
+            SetUndefinedNodesBlockVisitor undefNodesVisitor;
+            grid->accept(undefNodesVisitor);
+         }
+
+         intHelper.setBC();
+
+         //domain decomposition
+         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
+         grid->accept(pqPartVisitor);
+
+         //initialization of distributions
+         InitDistributionsBlockVisitor initVisitor;
+         initVisitor.setVx1(fct);
+         grid->accept(initVisitor);
+
+;
+         grid->accept(bcVisitor);
+
+         //Postrozess
+         SPtr<UbScheduler> geoSch(new UbScheduler(1));
+         SPtr<CoProcessor> ppgeo(
+            new WriteBoundaryConditionsCoProcessor(grid, geoSch, pathOut, WbWriterVtkXmlBinary::getInstance(), comm));
+         ppgeo->process(0);
+         ppgeo.reset();
+
+         if (myid==0) UBLOG(logINFO, "Preprozess - end");
+      }
+      else
+      {
+         rcp.restart((int)restartStep);
+         grid->setTimeStep(restartStep);
+
+         grid->accept(bcVisitor);
+      }
+
+	  //set connectors
+	  InterpolationProcessorPtr iProcessor(new CompressibleOffsetMomentsInterpolationProcessor());
+	  SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
+	  grid->accept(setConnsVisitor);
+
+      SPtr<UbScheduler> stepSch(new UbScheduler(outTime));
+
+	  SPtr<CoProcessor> writeMQCoProcessor(new WriteMacroscopicQuantitiesCoProcessor(grid, stepSch, pathOut, WbWriterVtkXmlBinary::getInstance(), conv, comm));
+
+      //double area = (2.0*radius*H)/(dx*dx);
+      //double v    = 4.0*uLB/9.0;
+      //CalculateForcesCoProcessor fp(grid, stepSch, pathOut + "/results/forces.txt", comm, v, area);
+      //fp.addInteractor(cylinderInt);
+
+	  SPtr<UbScheduler> nupsSch(new UbScheduler(nupsStep[0], nupsStep[1], nupsStep[2]));
+	  std::shared_ptr<CoProcessor> nupsCoProcessor(new NUPSCounterCoProcessor(grid, nupsSch, numOfThreads, comm));
+
+	  omp_set_num_threads(numOfThreads);
+	  SPtr<UbScheduler> stepGhostLayer(new UbScheduler(1));
+	  SPtr<Calculator> calculator(new BasicCalculator(grid, stepGhostLayer, endTime));
+	  calculator->addCoProcessor(nupsCoProcessor);
+	  calculator->addCoProcessor(writeMQCoProcessor);
+      if(myid == 0) UBLOG(logINFO,"Simulation-start");
+	  calculator->calculate();
+      if(myid == 0) UBLOG(logINFO,"Simulation-end");
+   }
+   catch(std::exception& e)
+   {
+      cerr << e.what() << endl << flush;
+   }
+   catch(std::string& s)
+   {
+      cerr << s << endl;
+   }
+   catch(...)
+   {
+      cerr << "unknown exception" << endl;
+   }
+
+}
+//////////////////////////////////////////////////////////////////////////
+int main(int argc, char* argv[])
+{
+   if (argv!=NULL)
+   {
+      if (argv[1]!=NULL)
+      {
+         run(string(argv[1]));
+      }
+      else
+      {
+         cout<<"Configuration file must be set!: "<<argv[0]<<" <config file>"<<endl<<std::flush;
+      }
+   }
+   return 0;
+}
+
diff --git a/apps/cpu/FlowAroundCylinder/cylinder.cpp.old b/apps/cpu/FlowAroundCylinder/cylinder.cpp.old
index ea310c84f8f2ea691391538bc4a9e6d03777e938..7293ab62fcbe0e43511df29b995aa82c2be37ca5 100644
--- a/apps/cpu/FlowAroundCylinder/cylinder.cpp.old
+++ b/apps/cpu/FlowAroundCylinder/cylinder.cpp.old
@@ -1,755 +1,755 @@
-#include <iostream>
-#include <string>
-
-#include <vfluids.h>
-
-using namespace std;
-
-
-void run(const char *cstr)
-{
-   try
-   {
-      string machine = QUOTEME(CAB_MACHINE);
-      string pathname; 
-      int numOfThreads = 1;
-      double availMem = 0;
-
-      CommunicatorPtr comm = MPICommunicator::getInstance();
-      int myid = comm->getProcessID();
-
-      if(machine == "BOMBADIL") 
-      {
-         pathname = "d:/temp/cylinder_20nu";
-         numOfThreads = 4;
-         availMem = 10.0e9;
-      }
-      else if(machine == "M01" || machine == "M02")      
-      {
-         pathname = "/work/koskuche/scratch/cylinder_Re20nu2l";
-         numOfThreads = 1;
-         availMem = 12.0e9;
-
-         if(myid ==0)
-         {
-            stringstream logFilename;
-            logFilename <<  pathname + "/logfile"+UbSystem::toString(UbSystem::getTimeStamp())+".txt";
-            UbLog::output_policy::setStream(logFilename.str());
-         }
-      }
-      else throw UbException(UB_EXARGS, "unknown CAB_MACHINE");
-
-      double dx = 0.1;
-
-      double L1 = 2.5;
-      double L2, L3, H;
-      L2 = L3 = H = 0.41;
-
-      LBMReal radius = 0.05;
-      LBMReal rhoReal = 1.0; //kg/m^3
-      LBMReal uReal = 0.45;//m/s
-      LBMReal uLB = 0.05;
-      LBMReal Re = 20.0;
-      LBMReal rhoLB = 0.0;
-      LBMReal l = L2 / dx;
-
-      //LBMUnitConverterPtr conv = LBMUnitConverterPtr(new LBMUnitConverter(1.0, 1/sqrt(3.0)*(uReal/uLB), 1.0, 1.0/dx, dx*dx*dx));
-      LBMUnitConverterPtr conv = LBMUnitConverterPtr(new LBMUnitConverter());
-
-      const int baseLevel = 0;
-      const int refineLevel = 3;
-
-      //obstacle
-      GbObject3DPtr cylinder(new GbCylinder3D(0.5, 0.2, -0.1, 0.5, 0.2, L3+0.1, radius));
-      GbSystem3D::writeGeoObject(cylinder.get(),pathname + "/geo/cylinder", WbWriterVtkXmlBinary::getInstance());
-
-      GbObject3DPtr refCylinder(new GbCylinder3D(0.5, 0.2, -0.1, 0.5, 0.2, L3+0.1, radius+2.0*dx/(1<<refineLevel)));
-      GbSystem3D::writeGeoObject(refCylinder.get(),pathname + "/geo/refCylinder", WbWriterVtkXmlBinary::getInstance());
-
-      D3Q27InteractorPtr cylinderInt;
-
-      //bounding box
-      double d_minX1 = 0.0;
-      double d_minX2 = 0.0;
-      double d_minX3 = 0.0;
-
-      double d_maxX1 = L1;
-      double d_maxX2 = L2;
-      double d_maxX3 = L3;
-
-      double offs = dx;
-
-      //double g_minX1 = d_minX1-offs-0.499999*dx;
-      double g_minX1 = d_minX1-offs;
-      double g_minX2 = d_minX2-offs;
-      double g_minX3 = d_minX3-offs;
-
-      double g_maxX1 = d_maxX1+offs;
-      double g_maxX2 = d_maxX2+offs;
-      double g_maxX3 = d_maxX3+offs;
-
-      GbObject3DPtr gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
-
-      const int blocknx1 = 8;
-      const int blocknx2 = 8;
-      const int blocknx3 = 8;
-
-      dx = (0.41+2.0*dx)/(10.0*(int)blocknx2);
-
-      LBMReal nueLB = (((4.0/9.0)*uLB)*2.0*(radius/dx))/Re;
-
-      double blockLength = blocknx1*dx;
-
-      //refinement area
-      double rf = cylinder->getLengthX1()/4;
-      GbObject3DPtr refineCube(new  GbCuboid3D(cylinder->getX1Minimum()-rf, cylinder->getX2Minimum()-rf, cylinder->getX3Minimum(), 
-        cylinder->getX1Maximum()+rf, cylinder->getX2Maximum()+rf, cylinder->getX3Maximum()));
-//       GbObject3DPtr refineCube(new  GbCuboid3D(g_minX1 + 7.05*blockLength, g_minX2 + 3.05*blockLength, cylinder->getX3Minimum(), 
-//          g_minX1 + 12.95*blockLength, g_maxX2 - 3.05*blockLength, cylinder->getX3Maximum()));
-
-      Grid3DPtr grid(new Grid3D(comm));
-
-      UbSchedulerPtr rSch(new UbScheduler(100000, 100000));
-      //RestartPostprocessorPtr rp(new RestartPostprocessor(grid, rSch, comm, pathname+"/checkpoints", RestartPostprocessor::BINARY));
-
-      //UbSchedulerPtr emSch(new UbScheduler(1000, 1000));
-      //EmergencyExitPostprocessor em(grid, emSch, pathname+"/checkpoints/emex.txt", rp, comm);
-
-      std::string opt;
-
-      if(cstr!= NULL)
-         opt = std::string(cstr);
-
-      if/*(cstr== NULL)*/(cstr!= NULL)
-      {
-         opt = std::string(cstr);
-
-         if(myid==0) UBLOG(logINFO,"Restart step: " << opt);
-
-         //grid = rp->restart(UbSystem::stringTo<int>(opt));
-         //rp->reconnect();
-
-         //cylinderInt = 
-
-         //set connectors
-         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27OffsetInterpolationProcessor());
-         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
-         grid->accept( setConnsVisitor );
-
-         //domain decomposition
-         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
-         grid->accept(pqPartVisitor);
-      }
-      else
-      {
-         if(myid ==0)
-         {
-            UBLOG(logINFO,"Number of processes = " << comm->getNumberOfProcesses() );
-            UBLOG(logINFO,"path = " << pathname );
-            UBLOG(logINFO,"L = " << L1/dx );
-            UBLOG(logINFO,"H = " << H/dx );
-            UBLOG(logINFO,"v = " << uLB );
-            UBLOG(logINFO,"rho = " << rhoLB );
-            UBLOG(logINFO,"nue = " << nueLB );
-            UBLOG(logINFO,"Re = " << Re );
-            UBLOG(logINFO,"dx = " << dx );
-            UBLOG(logINFO,"Number of level = " << refineLevel+1 );
-            //UBLOG(logINFO,conv->toString() );
-            UBLOG(logINFO,"Preprozess - start");
-         }
-
-         grid->setDeltaX(dx);
-         grid->setBlockNX(blocknx1, blocknx2, blocknx3);
-
-         // UbTupleDouble6 bouningBox(gridCube->getX1Minimum(),gridCube->getX2Minimum(),gridCube->getX3Minimum(),
-         // gridCube->getX1Maximum(),gridCube->getX2Maximum(),gridCube->getX3Maximum());
-         // UbTupleInt3 blockNx(blocknx1, blocknx2, blocknx3);
-         // UbTupleInt3 gridNx(8, 16, 16);
-         // grid = Grid3DPtr(new Grid3D(bouningBox, blockNx, gridNx));
-
-         if(myid ==0) GbSystem3D::writeGeoObject(gridCube.get(),pathname + "/geo/gridCube", WbWriterVtkXmlBinary::getInstance());
-         if(myid ==0) GbSystem3D::writeGeoObject(refineCube.get(),pathname + "/geo/refineCube", WbWriterVtkXmlBinary::getInstance());
-
-         GenBlocksGridVisitor genBlocks;
-         genBlocks.addGeoObject(gridCube);
-         grid->accept(genBlocks);
-
-         //walls
-         GbCuboid3DPtr addWallYmin (new GbCuboid3D(d_minX1-4.0*blockLength, d_minX2-4.0*blockLength, d_minX3-4.0*blockLength, d_maxX1+4.0*blockLength, d_minX2, d_maxX3+4.0*blockLength));
-         if(myid == 0) GbSystem3D::writeGeoObject(addWallYmin.get(), pathname+"/geo/addWallYmin", WbWriterVtkXmlASCII::getInstance());
-
-         GbCuboid3DPtr addWallZmin (new GbCuboid3D(d_minX1-4.0*blockLength, d_minX2-4.0*blockLength, d_minX3-4.0*blockLength, d_maxX1+4.0*blockLength, d_maxX2+4.0*blockLength, d_minX3));
-         if(myid == 0) GbSystem3D::writeGeoObject(addWallZmin.get(), pathname+"/geo/addWallZmin", WbWriterVtkXmlASCII::getInstance());
-
-         GbCuboid3DPtr addWallYmax (new GbCuboid3D(d_minX1-4.0*blockLength, d_maxX2, d_minX3-4.0*blockLength, d_maxX1+4.0*blockLength, d_maxX2+4.0*blockLength, d_maxX3+4.0*blockLength));
-         if(myid == 0) GbSystem3D::writeGeoObject(addWallYmax.get(), pathname+"/geo/addWallYmax", WbWriterVtkXmlASCII::getInstance());
-
-         GbCuboid3DPtr addWallZmax (new GbCuboid3D(d_minX1-4.0*blockLength, d_minX2-4.0*blockLength, d_maxX3, d_maxX1+4.0*blockLength, d_maxX2+4.0*blockLength, d_maxX3+4.0*blockLength));
-         if(myid == 0) GbSystem3D::writeGeoObject(addWallZmax.get(), pathname+"/geo/addWallZmax", WbWriterVtkXmlASCII::getInstance());
-
-         //inflow
-         GbCuboid3DPtr geoInflow (new GbCuboid3D(d_minX1-4.0*blockLength, d_minX2-4.0*blockLength, d_minX3-4.0*blockLength, d_minX1, d_maxX2+4.0*blockLength, d_maxX3+4.0*blockLength));
-         if(myid == 0) GbSystem3D::writeGeoObject(geoInflow.get(), pathname+"/geo/geoInflow", WbWriterVtkXmlASCII::getInstance());
-
-         //outflow
-         GbCuboid3DPtr geoOutflow (new GbCuboid3D(d_maxX1, d_minX2-4.0*blockLength, d_minX3-4.0*blockLength, d_maxX1+4.0*blockLength, d_maxX2+4.0*blockLength, d_maxX3+4.0*blockLength));
-         if(myid == 0) GbSystem3D::writeGeoObject(geoOutflow.get(), pathname+"/geo/geoOutflow", WbWriterVtkXmlASCII::getInstance());
-
-         BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname + "/grid/blocks", WbWriterVtkXmlBinary::getInstance(), comm));
-
-         if (refineLevel > 0)
-         {
-            if(myid == 0) UBLOG(logINFO,"Refinement - start");	
-            RefineCrossAndInsideGbObjectHelper refineHelper(grid, refineLevel);
-            //refineHelper.addGbObject(refineCube, refineLevel);
-            refineHelper.addGbObject(refCylinder, refineLevel);
-            refineHelper.refine();
-            if(myid == 0) UBLOG(logINFO,"Refinement - end");	
-         }
-
-         MetisPartitioningGridVisitor metisVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B);
-         grid->accept( metisVisitor );
-
-         SolidBlocksHelper sd(grid, comm);
-
-         int bbOption = 1; //0=simple Bounce Back, 1=quadr. BB
-         D3Q27BoundaryConditionAdapterPtr bcObst(new D3Q27NoSlipBCAdapter(bbOption));
-         cylinderInt = D3Q27InteractorPtr ( new D3Q27Interactor(cylinder, grid, bcObst,Interactor3D::SOLID));
-
-         //walls
-         D3Q27InteractorPtr addWallYminInt(new D3Q27Interactor(addWallYmin, grid, bcObst,Interactor3D::SOLID));
-         D3Q27InteractorPtr addWallZminInt(new D3Q27Interactor(addWallZmin, grid, bcObst,Interactor3D::SOLID));
-         D3Q27InteractorPtr addWallYmaxInt(new D3Q27Interactor(addWallYmax, grid, bcObst,Interactor3D::SOLID));
-         D3Q27InteractorPtr addWallZmaxInt(new D3Q27Interactor(addWallZmax, grid, bcObst,Interactor3D::SOLID));
-
-         mu::Parser fct;
-         fct.SetExpr("16*U*x2*x3*(H-x2)*(H-x3)/H^4");
-         fct.DefineConst("U", uLB);
-         fct.DefineConst("H", H);
-
-         //inflow
-         D3Q27BoundaryConditionAdapterPtr velBCAdapter(new D3Q27VelocityBCAdapter (true, false ,false ,fct, 0, D3Q27BCFunction::INFCONST));
-         velBCAdapter->setSecondaryBcOption(2);
-         D3Q27InteractorPtr inflowInt  = D3Q27InteractorPtr( new D3Q27Interactor(geoInflow, grid, velBCAdapter, Interactor3D::SOLID));
-
-         //outflow
-         D3Q27BoundaryConditionAdapterPtr denBCAdapter(new D3Q27DensityBCAdapter(rhoLB));
-         D3Q27InteractorPtr outflowInt = D3Q27InteractorPtr( new D3Q27Interactor(geoOutflow, grid, denBCAdapter,Interactor3D::SOLID));
-
-         sd.addInteractor(cylinderInt);
-         sd.addInteractor(addWallYminInt);
-         sd.addInteractor(addWallZminInt);
-         sd.addInteractor(addWallYmaxInt);
-         sd.addInteractor(addWallZmaxInt);
-         sd.addInteractor(inflowInt);
-         sd.addInteractor(outflowInt);
-
-         sd.deleteSolidBlocks();
-
-         grid->accept( metisVisitor );
-
-         sd.setTransBlocks();
-
-         ppblocks->update(0);
-         ppblocks.reset();
-
-         //set connectors
-         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
-         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
-         grid->accept( setConnsVisitor );
-
-         unsigned long nob = grid->getNumberOfBlocks();
-         int gl = 3;
-         unsigned long nod = nob * (blocknx1+gl) * (blocknx2+gl) * (blocknx3+gl);
-
-         double needMemAll  = double(nod*(27*sizeof(double) + sizeof(int) + sizeof(float)*4));
-         double needMem  = needMemAll / double(comm->getNumberOfProcesses());
-
-         if(myid == 0)
-         {
-            UBLOG(logINFO,"Number of blocks = " << nob);
-            UBLOG(logINFO,"Number of nodes  = " << nod);
-            UBLOG(logINFO,"Necessary memory  = " << needMemAll  << " bytes");
-            UBLOG(logINFO,"Necessary memory per process = " << needMem  << " bytes");
-            UBLOG(logINFO,"Available memory per process = " << availMem << " bytes");
-         }            
-
-         LBMKernel3DPtr kernel(new LBMKernelETD3Q27CCLB(blocknx1, blocknx2, blocknx3, LBMKernelETD3Q27CCLB::NORMAL));
-
-         BCProcessorPtr bcProc(new D3Q27ETBCProcessor());
-         kernel->setBCProcessor(bcProc);
-
-         SetKernelBlockVisitor kernelVisitor(kernel, nueLB, availMem, needMem);
-         grid->accept(kernelVisitor);
-
-         if (refineLevel > 0)
-         {
-            D3Q27SetUndefinedNodesBlockVisitor undefNodesVisitor;
-            grid->accept(undefNodesVisitor);
-         }
-
-         //walls
-         grid->addAndInitInteractor(addWallYminInt);
-         grid->addAndInitInteractor(addWallZminInt);
-         grid->addAndInitInteractor(addWallYmaxInt);
-         grid->addAndInitInteractor(addWallZmaxInt);
-
-         //obstacle
-         grid->addAndInitInteractor(cylinderInt);
-
-         //inflow
-         grid->addAndInitInteractor(inflowInt);
-
-         //outflow
-         grid->addAndInitInteractor(outflowInt);
-
-         //domain decomposition
-         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
-         grid->accept(pqPartVisitor);
-
-         //initialization of distributions
-         D3Q27ETInitDistributionsBlockVisitor initVisitor(nueLB, rhoLB);
-         initVisitor.setVx1(fct);
-         grid->accept(initVisitor);
-
-         //Postrozess
-         UbSchedulerPtr geoSch(new UbScheduler(1));
-         D3Q27MacroscopicQuantitiesPostprocessorPtr ppgeo(
-            new D3Q27MacroscopicQuantitiesPostprocessor(grid, geoSch, pathname + "/grid/nodes", WbWriterVtkXmlBinary::getInstance(), conv, comm, true));
-         ppgeo->update(0);
-         ppgeo.reset();
-
-         if(myid == 0) UBLOG(logINFO,"Preprozess - end"); 
-      }
-
-      double outTime = 10000.0;
-      UbSchedulerPtr visSch(new UbScheduler(outTime));
-      //visSch->addSchedule(1000, 1000, 10000);
-      //visSch->addSchedule(10000, 10000, 50000);
-      //visSch->addSchedule(100, 100, 10000);
-
-      D3Q27MacroscopicQuantitiesPostprocessor pp(grid, visSch, pathname + "/steps/step", WbWriterVtkXmlBinary::getInstance(), conv, comm);
-
-      double fdx = grid->getDeltaX(grid->getFinestInitializedLevel());
-      double point1[3] = {0.45, 0.20, 0.205};
-      double point2[3] = {0.55, 0.20, 0.205};
-
-      D3Q27IntegrateValuesHelperPtr h1(new D3Q27IntegrateValuesHelper(grid, comm, 
-         point1[0]-1.0*fdx, point1[1]-1.0*fdx, point1[2]-1.0*fdx, 
-         point1[0], point1[1], point1[2]));
-      if(myid ==0) GbSystem3D::writeGeoObject(h1->getBoundingBox().get(),pathname + "/geo/iv1", WbWriterVtkXmlBinary::getInstance());
-      D3Q27IntegrateValuesHelperPtr h2(new D3Q27IntegrateValuesHelper(grid, comm, 
-         point2[0], point2[1]-1.0*fdx, point2[2]-1.0*fdx, 
-         point2[0]+1.0*fdx, point2[1], point2[2]));
-      if(myid ==0) GbSystem3D::writeGeoObject(h2->getBoundingBox().get(),pathname + "/geo/iv2", WbWriterVtkXmlBinary::getInstance());
-      //D3Q27PressureDifferencePostprocessor rhopp(grid, visSch, pathname + "/results/rho_diff.txt", h1, h2, conv, comm);
-      D3Q27PressureDifferencePostprocessor rhopp(grid, visSch, pathname + "/results/rho_diff.txt", h1, h2, rhoReal, uReal, uLB, comm);
-      
-      double area = (2.0*radius*H)/(dx*dx);
-      double v    = 4.0*uLB/9.0;
-      D3Q27ForcesPostprocessor fp(grid, visSch, pathname + "/results/forces.txt", comm, v, area);
-      fp.addInteractor(cylinderInt);
-      
-      UbSchedulerPtr nupsSch(new UbScheduler(10, 10, 40));
-      NUPSCounterPostprocessor npr(grid, nupsSch, pathname + "/results/nups.txt", comm);
-
-      double endTime = 100001.0;
-      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, visSch));
-      if(myid == 0) UBLOG(logINFO,"Simulation-start");
-      calculation->calculate();
-      if(myid == 0) UBLOG(logINFO,"Simulation-end");
-   }
-   catch(std::exception& e)
-   {
-      cerr << e.what() << endl << flush;
-   }
-   catch(std::string& s)
-   {
-      cerr << s << endl;
-   }
-   catch(...)
-   {
-      cerr << "unknown exception" << endl;
-   }
-
-}
-
-//////////////////////////////////////////////////////////////////////////
-void run2(const char *cstr)
-{
-   try
-   {
-      Sleep(30000);
-      string machine = QUOTEME(CAB_MACHINE);
-      string pathname; 
-      int numOfThreads = 1;
-      double availMem = 0;
-
-      CommunicatorPtr comm = MPICommunicator::getInstance();
-      int myid = comm->getProcessID();
-
-      if(machine == "BOMBADIL") 
-      {
-         pathname = "d:/temp/cylinder_20nu";
-         numOfThreads = 4;
-         availMem = 10.0e9;
-      }
-      else if(machine == "M01" || machine == "M02")      
-      {
-         pathname = "/work/koskuche/scratch/cylinder_Re20nu4l";
-         numOfThreads = 1;
-         availMem = 12.0e9;
-
-         if(myid ==0)
-         {
-            stringstream logFilename;
-            logFilename <<  pathname + "/logfile"+UbSystem::toString(UbSystem::getTimeStamp())+".txt";
-            UbLog::output_policy::setStream(logFilename.str());
-         }
-      }
-      else throw UbException(UB_EXARGS, "unknown CAB_MACHINE");
-
-      double dx = 0.01;
-
-      double L1 = 2.5*2.0;
-      double L2, L3, H;
-      L2 = L3 = H = 0.41*2.0;
-
-      LBMReal radius = 0.05*2.0;
-      LBMReal rhoReal = 1.0; //kg/m^3
-      LBMReal uReal = 0.45;//m/s
-      LBMReal uLB = 0.05;
-      LBMReal Re = 20.0;
-      LBMReal rhoLB = 0.0;
-      LBMReal l = L2 / dx;
-
-      //LBMUnitConverterPtr conv = LBMUnitConverterPtr(new LBMUnitConverter(1.0, 1/sqrt(3.0)*(uReal/uLB), 1.0, 1.0/dx, dx*dx*dx));
-      LBMUnitConverterPtr conv = LBMUnitConverterPtr(new LBMUnitConverter());
-
-      const int baseLevel = 0;
-      const int refineLevel = 1;
-
-      //obstacle
-      GbObject3DPtr cylinder(new GbCylinder3D(0.5*2.0, 0.2*2.0, -0.1, 0.5*2.0, 0.2*2.0, L3+0.1, radius));
-      GbSystem3D::writeGeoObject(cylinder.get(),pathname + "/geo/cylinder", WbWriterVtkXmlBinary::getInstance());
-
-      GbObject3DPtr refCylinder(new GbCylinder3D(0.5*2.0, 0.2*2.0, -0.1, 0.5*2.0, 0.2*2.0, L3+0.1, radius+7.0*dx/(1<<refineLevel)));
-      GbSystem3D::writeGeoObject(refCylinder.get(),pathname + "/geo/refCylinder", WbWriterVtkXmlBinary::getInstance());
-
-      D3Q27InteractorPtr cylinderInt;
-
-      //bounding box
-      double d_minX1 = 0.0;
-      double d_minX2 = 0.0;
-      double d_minX3 = 0.0;
-
-      double d_maxX1 = L1;
-      double d_maxX2 = L2;
-      double d_maxX3 = L3;
-
-      //double offs = dx;
-      double offs = 0;
-
-      //double g_minX1 = d_minX1-offs-0.499999*dx;
-      double g_minX1 = d_minX1;
-      double g_minX2 = d_minX2-7.0*dx;
-      double g_minX3 = d_minX3;
-
-      double g_maxX1 = d_maxX1;
-      double g_maxX2 = d_maxX2;
-      double g_maxX3 = d_maxX3;
-
-      GbObject3DPtr gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
-
-      const int blocknx1 = 8;
-      const int blocknx2 = 8;
-      const int blocknx3 = 8;
-
-      //dx = (0.41+2.0*dx)/(10.0*(int)blocknx2);
-
-      LBMReal nueLB = (((4.0/9.0)*uLB)*2.0*(radius/dx))/Re;
-
-      double blockLength = blocknx1*dx;
-
-      //refinement area
-      double rf = cylinder->getLengthX1()/4;
-      GbObject3DPtr refineCube(new  GbCuboid3D(cylinder->getX1Minimum()-rf, cylinder->getX2Minimum()-rf, cylinder->getX3Minimum(), 
-         cylinder->getX1Maximum()+rf, cylinder->getX2Maximum()+rf, cylinder->getX3Maximum()));
-      //       GbObject3DPtr refineCube(new  GbCuboid3D(g_minX1 + 7.05*blockLength, g_minX2 + 3.05*blockLength, cylinder->getX3Minimum(), 
-      //          g_minX1 + 12.95*blockLength, g_maxX2 - 3.05*blockLength, cylinder->getX3Maximum()));
-
-      Grid3DPtr grid(new Grid3D(comm));
-
-      UbSchedulerPtr rSch(new UbScheduler(100000, 100000));
-      //RestartPostprocessorPtr rp(new RestartPostprocessor(grid, rSch, comm, pathname+"/checkpoints", RestartPostprocessor::BINARY));
-
-      //UbSchedulerPtr emSch(new UbScheduler(1000, 1000));
-      //EmergencyExitPostprocessor em(grid, emSch, pathname+"/checkpoints/emex.txt", rp, comm);
-
-      std::string opt;
-
-      if(cstr!= NULL)
-         opt = std::string(cstr);
-
-      if/*(cstr== NULL)*/(cstr!= NULL)
-      {
-         opt = std::string(cstr);
-
-         if(myid==0) UBLOG(logINFO,"Restart step: " << opt);
-
-         //grid = rp->restart(UbSystem::stringTo<int>(opt));
-         //rp->reconnect();
-
-         //cylinderInt = 
-
-         //set connectors
-         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27OffsetInterpolationProcessor());
-         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
-         grid->accept( setConnsVisitor );
-
-         //domain decomposition
-         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
-         grid->accept(pqPartVisitor);
-      }
-      else
-      {
-         if(myid ==0)
-         {
-            UBLOG(logINFO,"Number of processes = " << comm->getNumberOfProcesses() );
-            UBLOG(logINFO,"path = " << pathname );
-            UBLOG(logINFO,"L = " << L1/dx );
-            UBLOG(logINFO,"H = " << H/dx );
-            UBLOG(logINFO,"v = " << uLB );
-            UBLOG(logINFO,"rho = " << rhoLB );
-            UBLOG(logINFO,"nue = " << nueLB );
-            UBLOG(logINFO,"Re = " << Re );
-            UBLOG(logINFO,"dx = " << dx );
-            UBLOG(logINFO,"Number of level = " << refineLevel+1 );
-            //UBLOG(logINFO,conv->toString() );
-            UBLOG(logINFO,"Preprozess - start");
-         }
-
-         grid->setDeltaX(dx);
-         grid->setBlockNX(blocknx1, blocknx2, blocknx3);
-
-         // UbTupleDouble6 bouningBox(gridCube->getX1Minimum(),gridCube->getX2Minimum(),gridCube->getX3Minimum(),
-         // gridCube->getX1Maximum(),gridCube->getX2Maximum(),gridCube->getX3Maximum());
-         // UbTupleInt3 blockNx(blocknx1, blocknx2, blocknx3);
-         // UbTupleInt3 gridNx(8, 16, 16);
-         // grid = Grid3DPtr(new Grid3D(bouningBox, blockNx, gridNx));
-
-         if(myid ==0) GbSystem3D::writeGeoObject(gridCube.get(),pathname + "/geo/gridCube", WbWriterVtkXmlBinary::getInstance());
-         if(myid ==0) GbSystem3D::writeGeoObject(refineCube.get(),pathname + "/geo/refineCube", WbWriterVtkXmlBinary::getInstance());
-
-         GenBlocksGridVisitor genBlocks;
-         genBlocks.addGeoObject(gridCube);
-         grid->accept(genBlocks);
-
-         //walls
-         GbCuboid3DPtr addWallYmin (new GbCuboid3D(d_minX1-blockLength, d_minX2-blockLength, d_minX3-blockLength, d_maxX1+blockLength, d_minX2, d_maxX3+blockLength));
-         if(myid == 0) GbSystem3D::writeGeoObject(addWallYmin.get(), pathname+"/geo/addWallYmin", WbWriterVtkXmlASCII::getInstance());
-
-         GbCuboid3DPtr addWallZmin (new GbCuboid3D(d_minX1-blockLength, d_minX2-blockLength, d_minX3-blockLength, d_maxX1+blockLength, d_maxX2+blockLength, d_minX3));
-         if(myid == 0) GbSystem3D::writeGeoObject(addWallZmin.get(), pathname+"/geo/addWallZmin", WbWriterVtkXmlASCII::getInstance());
-
-         GbCuboid3DPtr addWallYmax (new GbCuboid3D(d_minX1-blockLength, d_maxX2, d_minX3-blockLength, d_maxX1+blockLength, d_maxX2+blockLength, d_maxX3+blockLength));
-         if(myid == 0) GbSystem3D::writeGeoObject(addWallYmax.get(), pathname+"/geo/addWallYmax", WbWriterVtkXmlASCII::getInstance());
-
-         GbCuboid3DPtr addWallZmax (new GbCuboid3D(d_minX1-blockLength, d_minX2-blockLength, d_maxX3, d_maxX1+blockLength, d_maxX2+blockLength, d_maxX3+blockLength));
-         if(myid == 0) GbSystem3D::writeGeoObject(addWallZmax.get(), pathname+"/geo/addWallZmax", WbWriterVtkXmlASCII::getInstance());
-
-         //inflow
-         GbCuboid3DPtr geoInflow (new GbCuboid3D(d_minX1-blockLength, d_minX2-blockLength, d_minX3-blockLength, d_minX1, d_maxX2+blockLength, d_maxX3+blockLength));
-         if(myid == 0) GbSystem3D::writeGeoObject(geoInflow.get(), pathname+"/geo/geoInflow", WbWriterVtkXmlASCII::getInstance());
-
-         //outflow
-         GbCuboid3DPtr geoOutflow (new GbCuboid3D(d_maxX1, d_minX2-blockLength, d_minX3-blockLength, d_maxX1+blockLength, d_maxX2+blockLength, d_maxX3+blockLength));
-         if(myid == 0) GbSystem3D::writeGeoObject(geoOutflow.get(), pathname+"/geo/geoOutflow", WbWriterVtkXmlASCII::getInstance());
-
-         BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname + "/grid/blocks", WbWriterVtkXmlBinary::getInstance(), comm));
-
-         if (refineLevel > 0)
-         {
-            if(myid == 0) UBLOG(logINFO,"Refinement - start");	
-            RefineCrossAndInsideGbObjectHelper refineHelper(grid, refineLevel);
-            //refineHelper.addGbObject(refineCube, refineLevel);
-            refineHelper.addGbObject(refCylinder, refineLevel);
-            refineHelper.refine();
-            if(myid == 0) UBLOG(logINFO,"Refinement - end");	
-         }
-
-         MetisPartitioningGridVisitor metisVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B);
-         grid->accept( metisVisitor );
-
-         SolidBlocksHelper sd(grid, comm);
-
-         int bbOption = 1; //0=simple Bounce Back, 1=quadr. BB
-         D3Q27BoundaryConditionAdapterPtr bcObst(new D3Q27NoSlipBCAdapter(bbOption));
-         cylinderInt = D3Q27InteractorPtr ( new D3Q27Interactor(cylinder, grid, bcObst,Interactor3D::SOLID));
-
-         //walls
-         D3Q27InteractorPtr addWallYminInt(new D3Q27Interactor(addWallYmin, grid, bcObst,Interactor3D::SOLID));
-         D3Q27InteractorPtr addWallZminInt(new D3Q27Interactor(addWallZmin, grid, bcObst,Interactor3D::SOLID));
-         D3Q27InteractorPtr addWallYmaxInt(new D3Q27Interactor(addWallYmax, grid, bcObst,Interactor3D::SOLID));
-         D3Q27InteractorPtr addWallZmaxInt(new D3Q27Interactor(addWallZmax, grid, bcObst,Interactor3D::SOLID));
-
-         mu::Parser fct;
-         fct.SetExpr("16*U*x2*x3*(H-x2)*(H-x3)/H^4");
-         fct.DefineConst("U", uLB);
-         fct.DefineConst("H", H);
-
-         //inflow
-         D3Q27BoundaryConditionAdapterPtr velBCAdapter(new D3Q27VelocityBCAdapter (true, false ,false ,fct, 0, D3Q27BCFunction::INFCONST));
-         velBCAdapter->setSecondaryBcOption(2);
-         D3Q27InteractorPtr inflowInt  = D3Q27InteractorPtr( new D3Q27Interactor(geoInflow, grid, velBCAdapter, Interactor3D::SOLID));
-
-         //outflow
-         D3Q27BoundaryConditionAdapterPtr denBCAdapter(new D3Q27DensityBCAdapter(rhoLB));
-         D3Q27InteractorPtr outflowInt = D3Q27InteractorPtr( new D3Q27Interactor(geoOutflow, grid, denBCAdapter,Interactor3D::SOLID));
-
-         sd.addInteractor(cylinderInt);
-         sd.addInteractor(addWallYminInt);
-         sd.addInteractor(addWallZminInt);
-         sd.addInteractor(addWallYmaxInt);
-         sd.addInteractor(addWallZmaxInt);
-         sd.addInteractor(inflowInt);
-         sd.addInteractor(outflowInt);
-
-         sd.deleteSolidBlocks();
-
-         grid->accept( metisVisitor );
-
-         sd.setTransBlocks();
-
-         ppblocks->update(0);
-         ppblocks.reset();
-
-         //set connectors
-         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
-         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
-         grid->accept( setConnsVisitor );
-
-         unsigned long nob = grid->getNumberOfBlocks();
-         int gl = 3;
-         unsigned long nod = nob * (blocknx1+gl) * (blocknx2+gl) * (blocknx3+gl);
-
-         double needMemAll  = double(nod*(27*sizeof(double) + sizeof(int) + sizeof(float)*4));
-         double needMem  = needMemAll / double(comm->getNumberOfProcesses());
-
-         if(myid == 0)
-         {
-            UBLOG(logINFO,"Number of blocks = " << nob);
-            UBLOG(logINFO,"Number of nodes  = " << nod);
-            UBLOG(logINFO,"Necessary memory  = " << needMemAll  << " bytes");
-            UBLOG(logINFO,"Necessary memory per process = " << needMem  << " bytes");
-            UBLOG(logINFO,"Available memory per process = " << availMem << " bytes");
-         }            
-
-         LBMKernel3DPtr kernel(new LBMKernelETD3Q27CCLB(blocknx1, blocknx2, blocknx3, LBMKernelETD3Q27CCLB::NORMAL));
-
-         BCProcessorPtr bcProc(new D3Q27ETBCProcessor());
-         kernel->setBCProcessor(bcProc);
-
-         SetKernelBlockVisitor kernelVisitor(kernel, nueLB, availMem, needMem);
-         grid->accept(kernelVisitor);
-
-         if (refineLevel > 0)
-         {
-            D3Q27SetUndefinedNodesBlockVisitor undefNodesVisitor;
-            grid->accept(undefNodesVisitor);
-         }
-
-         //walls
-         grid->addAndInitInteractor(addWallYminInt);
-         grid->addAndInitInteractor(addWallZminInt);
-         grid->addAndInitInteractor(addWallYmaxInt);
-         grid->addAndInitInteractor(addWallZmaxInt);
-
-         //obstacle
-         grid->addAndInitInteractor(cylinderInt);
-
-         //inflow
-         grid->addAndInitInteractor(inflowInt);
-
-         //outflow
-         grid->addAndInitInteractor(outflowInt);
-
-         //domain decomposition
-         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
-         grid->accept(pqPartVisitor);
-
-         //initialization of distributions
-         D3Q27ETInitDistributionsBlockVisitor initVisitor(nueLB, rhoLB);
-         initVisitor.setVx1(fct);
-         grid->accept(initVisitor);
-
-         //Postrozess
-         UbSchedulerPtr geoSch(new UbScheduler(1));
-         D3Q27MacroscopicQuantitiesPostprocessorPtr ppgeo(
-            new D3Q27MacroscopicQuantitiesPostprocessor(grid, geoSch, pathname + "/grid/nodes", WbWriterVtkXmlBinary::getInstance(), conv, comm, true));
-         ppgeo->update(0);
-         ppgeo.reset();
-
-         if(myid == 0) UBLOG(logINFO,"Preprozess - end"); 
-      }
-
-      double outTime = 100.0;
-      UbSchedulerPtr visSch(new UbScheduler(outTime));
-      //visSch->addSchedule(1000, 1000, 10000);
-      //visSch->addSchedule(10000, 10000, 50000);
-      //visSch->addSchedule(100, 100, 10000);
-
-      D3Q27MacroscopicQuantitiesPostprocessor pp(grid, visSch, pathname + "/steps/step", WbWriterVtkXmlBinary::getInstance(), conv, comm);
-
-      double fdx = grid->getDeltaX(grid->getFinestInitializedLevel());
-      double point1[3] = {0.45, 0.20, 0.205};
-      double point2[3] = {0.55, 0.20, 0.205};
-
-      D3Q27IntegrateValuesHelperPtr h1(new D3Q27IntegrateValuesHelper(grid, comm, 
-         point1[0]-1.0*fdx, point1[1]-1.0*fdx, point1[2]-1.0*fdx, 
-         point1[0], point1[1], point1[2]));
-      if(myid ==0) GbSystem3D::writeGeoObject(h1->getBoundingBox().get(),pathname + "/geo/iv1", WbWriterVtkXmlBinary::getInstance());
-      D3Q27IntegrateValuesHelperPtr h2(new D3Q27IntegrateValuesHelper(grid, comm, 
-         point2[0], point2[1]-1.0*fdx, point2[2]-1.0*fdx, 
-         point2[0]+1.0*fdx, point2[1], point2[2]));
-      if(myid ==0) GbSystem3D::writeGeoObject(h2->getBoundingBox().get(),pathname + "/geo/iv2", WbWriterVtkXmlBinary::getInstance());
-      //D3Q27PressureDifferencePostprocessor rhopp(grid, visSch, pathname + "/results/rho_diff.txt", h1, h2, conv, comm);
-      D3Q27PressureDifferencePostprocessor rhopp(grid, visSch, pathname + "/results/rho_diff.txt", h1, h2, rhoReal, uReal, uLB, comm);
-
-      double area = (2.0*radius*H)/(dx*dx);
-      double v    = 4.0*uLB/9.0;
-      D3Q27ForcesPostprocessor fp(grid, visSch, pathname + "/results/forces.txt", comm, v, area);
-      fp.addInteractor(cylinderInt);
-
-      UbSchedulerPtr nupsSch(new UbScheduler(10, 10, 40));
-      NUPSCounterPostprocessor npr(grid, nupsSch, pathname + "/results/nups.txt", comm);
-
-      double endTime = 100001.0;
-      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, visSch));
-      if(myid == 0) UBLOG(logINFO,"Simulation-start");
-      calculation->calculate();
-      if(myid == 0) UBLOG(logINFO,"Simulation-end");
-   }
-   catch(std::exception& e)
-   {
-      cerr << e.what() << endl << flush;
-   }
-   catch(std::string& s)
-   {
-      cerr << s << endl;
-   }
-   catch(...)
-   {
-      cerr << "unknown exception" << endl;
-   }
-
-}
-//////////////////////////////////////////////////////////////////////////
-int main(int argc, char* argv[])
-{
-
-   run2(argv[1]);
-
-   return 0;
-}
-
+#include <iostream>
+#include <string>
+
+#include <vfluids.h>
+
+using namespace std;
+
+
+void run(const char *cstr)
+{
+   try
+   {
+      string machine = QUOTEME(CAB_MACHINE);
+      string pathname; 
+      int numOfThreads = 1;
+      double availMem = 0;
+
+      CommunicatorPtr comm = MPICommunicator::getInstance();
+      int myid = comm->getProcessID();
+
+      if(machine == "BOMBADIL") 
+      {
+         pathname = "d:/temp/cylinder_20nu";
+         numOfThreads = 4;
+         availMem = 10.0e9;
+      }
+      else if(machine == "M01" || machine == "M02")      
+      {
+         pathname = "/work/koskuche/scratch/cylinder_Re20nu2l";
+         numOfThreads = 1;
+         availMem = 12.0e9;
+
+         if(myid ==0)
+         {
+            stringstream logFilename;
+            logFilename <<  pathname + "/logfile"+UbSystem::toString(UbSystem::getTimeStamp())+".txt";
+            UbLog::output_policy::setStream(logFilename.str());
+         }
+      }
+      else throw UbException(UB_EXARGS, "unknown CAB_MACHINE");
+
+      double dx = 0.1;
+
+      double L1 = 2.5;
+      double L2, L3, H;
+      L2 = L3 = H = 0.41;
+
+      LBMReal radius = 0.05;
+      LBMReal rhoReal = 1.0; //kg/m^3
+      LBMReal uReal = 0.45;//m/s
+      LBMReal uLB = 0.05;
+      LBMReal Re = 20.0;
+      LBMReal rhoLB = 0.0;
+      LBMReal l = L2 / dx;
+
+      //LBMUnitConverterPtr conv = LBMUnitConverterPtr(new LBMUnitConverter(1.0, 1/sqrt(3.0)*(uReal/uLB), 1.0, 1.0/dx, dx*dx*dx));
+      LBMUnitConverterPtr conv = LBMUnitConverterPtr(new LBMUnitConverter());
+
+      const int baseLevel = 0;
+      const int refineLevel = 3;
+
+      //obstacle
+      GbObject3DPtr cylinder(new GbCylinder3D(0.5, 0.2, -0.1, 0.5, 0.2, L3+0.1, radius));
+      GbSystem3D::writeGeoObject(cylinder.get(),pathname + "/geo/cylinder", WbWriterVtkXmlBinary::getInstance());
+
+      GbObject3DPtr refCylinder(new GbCylinder3D(0.5, 0.2, -0.1, 0.5, 0.2, L3+0.1, radius+2.0*dx/(1<<refineLevel)));
+      GbSystem3D::writeGeoObject(refCylinder.get(),pathname + "/geo/refCylinder", WbWriterVtkXmlBinary::getInstance());
+
+      D3Q27InteractorPtr cylinderInt;
+
+      //bounding box
+      double d_minX1 = 0.0;
+      double d_minX2 = 0.0;
+      double d_minX3 = 0.0;
+
+      double d_maxX1 = L1;
+      double d_maxX2 = L2;
+      double d_maxX3 = L3;
+
+      double offs = dx;
+
+      //double g_minX1 = d_minX1-offs-0.499999*dx;
+      double g_minX1 = d_minX1-offs;
+      double g_minX2 = d_minX2-offs;
+      double g_minX3 = d_minX3-offs;
+
+      double g_maxX1 = d_maxX1+offs;
+      double g_maxX2 = d_maxX2+offs;
+      double g_maxX3 = d_maxX3+offs;
+
+      GbObject3DPtr gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
+
+      const int blocknx1 = 8;
+      const int blocknx2 = 8;
+      const int blocknx3 = 8;
+
+      dx = (0.41+2.0*dx)/(10.0*(int)blocknx2);
+
+      LBMReal nueLB = (((4.0/9.0)*uLB)*2.0*(radius/dx))/Re;
+
+      double blockLength = blocknx1*dx;
+
+      //refinement area
+      double rf = cylinder->getLengthX1()/4;
+      GbObject3DPtr refineCube(new  GbCuboid3D(cylinder->getX1Minimum()-rf, cylinder->getX2Minimum()-rf, cylinder->getX3Minimum(), 
+        cylinder->getX1Maximum()+rf, cylinder->getX2Maximum()+rf, cylinder->getX3Maximum()));
+//       GbObject3DPtr refineCube(new  GbCuboid3D(g_minX1 + 7.05*blockLength, g_minX2 + 3.05*blockLength, cylinder->getX3Minimum(), 
+//          g_minX1 + 12.95*blockLength, g_maxX2 - 3.05*blockLength, cylinder->getX3Maximum()));
+
+      Grid3DPtr grid(new Grid3D(comm));
+
+      UbSchedulerPtr rSch(new UbScheduler(100000, 100000));
+      //RestartPostprocessorPtr rp(new RestartPostprocessor(grid, rSch, comm, pathname+"/checkpoints", RestartPostprocessor::BINARY));
+
+      //UbSchedulerPtr emSch(new UbScheduler(1000, 1000));
+      //EmergencyExitPostprocessor em(grid, emSch, pathname+"/checkpoints/emex.txt", rp, comm);
+
+      std::string opt;
+
+      if(cstr!= NULL)
+         opt = std::string(cstr);
+
+      if/*(cstr== NULL)*/(cstr!= NULL)
+      {
+         opt = std::string(cstr);
+
+         if(myid==0) UBLOG(logINFO,"Restart step: " << opt);
+
+         //grid = rp->restart(UbSystem::stringTo<int>(opt));
+         //rp->reconnect();
+
+         //cylinderInt = 
+
+         //set connectors
+         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27OffsetInterpolationProcessor());
+         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
+         grid->accept( setConnsVisitor );
+
+         //domain decomposition
+         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
+         grid->accept(pqPartVisitor);
+      }
+      else
+      {
+         if(myid ==0)
+         {
+            UBLOG(logINFO,"Number of processes = " << comm->getNumberOfProcesses() );
+            UBLOG(logINFO,"path = " << pathname );
+            UBLOG(logINFO,"L = " << L1/dx );
+            UBLOG(logINFO,"H = " << H/dx );
+            UBLOG(logINFO,"v = " << uLB );
+            UBLOG(logINFO,"rho = " << rhoLB );
+            UBLOG(logINFO,"nue = " << nueLB );
+            UBLOG(logINFO,"Re = " << Re );
+            UBLOG(logINFO,"dx = " << dx );
+            UBLOG(logINFO,"Number of level = " << refineLevel+1 );
+            //UBLOG(logINFO,conv->toString() );
+            UBLOG(logINFO,"Preprozess - start");
+         }
+
+         grid->setDeltaX(dx);
+         grid->setBlockNX(blocknx1, blocknx2, blocknx3);
+
+         // UbTupleDouble6 bouningBox(gridCube->getX1Minimum(),gridCube->getX2Minimum(),gridCube->getX3Minimum(),
+         // gridCube->getX1Maximum(),gridCube->getX2Maximum(),gridCube->getX3Maximum());
+         // UbTupleInt3 blockNx(blocknx1, blocknx2, blocknx3);
+         // UbTupleInt3 gridNx(8, 16, 16);
+         // grid = Grid3DPtr(new Grid3D(bouningBox, blockNx, gridNx));
+
+         if(myid ==0) GbSystem3D::writeGeoObject(gridCube.get(),pathname + "/geo/gridCube", WbWriterVtkXmlBinary::getInstance());
+         if(myid ==0) GbSystem3D::writeGeoObject(refineCube.get(),pathname + "/geo/refineCube", WbWriterVtkXmlBinary::getInstance());
+
+         GenBlocksGridVisitor genBlocks;
+         genBlocks.addGeoObject(gridCube);
+         grid->accept(genBlocks);
+
+         //walls
+         GbCuboid3DPtr addWallYmin (new GbCuboid3D(d_minX1-4.0*blockLength, d_minX2-4.0*blockLength, d_minX3-4.0*blockLength, d_maxX1+4.0*blockLength, d_minX2, d_maxX3+4.0*blockLength));
+         if(myid == 0) GbSystem3D::writeGeoObject(addWallYmin.get(), pathname+"/geo/addWallYmin", WbWriterVtkXmlASCII::getInstance());
+
+         GbCuboid3DPtr addWallZmin (new GbCuboid3D(d_minX1-4.0*blockLength, d_minX2-4.0*blockLength, d_minX3-4.0*blockLength, d_maxX1+4.0*blockLength, d_maxX2+4.0*blockLength, d_minX3));
+         if(myid == 0) GbSystem3D::writeGeoObject(addWallZmin.get(), pathname+"/geo/addWallZmin", WbWriterVtkXmlASCII::getInstance());
+
+         GbCuboid3DPtr addWallYmax (new GbCuboid3D(d_minX1-4.0*blockLength, d_maxX2, d_minX3-4.0*blockLength, d_maxX1+4.0*blockLength, d_maxX2+4.0*blockLength, d_maxX3+4.0*blockLength));
+         if(myid == 0) GbSystem3D::writeGeoObject(addWallYmax.get(), pathname+"/geo/addWallYmax", WbWriterVtkXmlASCII::getInstance());
+
+         GbCuboid3DPtr addWallZmax (new GbCuboid3D(d_minX1-4.0*blockLength, d_minX2-4.0*blockLength, d_maxX3, d_maxX1+4.0*blockLength, d_maxX2+4.0*blockLength, d_maxX3+4.0*blockLength));
+         if(myid == 0) GbSystem3D::writeGeoObject(addWallZmax.get(), pathname+"/geo/addWallZmax", WbWriterVtkXmlASCII::getInstance());
+
+         //inflow
+         GbCuboid3DPtr geoInflow (new GbCuboid3D(d_minX1-4.0*blockLength, d_minX2-4.0*blockLength, d_minX3-4.0*blockLength, d_minX1, d_maxX2+4.0*blockLength, d_maxX3+4.0*blockLength));
+         if(myid == 0) GbSystem3D::writeGeoObject(geoInflow.get(), pathname+"/geo/geoInflow", WbWriterVtkXmlASCII::getInstance());
+
+         //outflow
+         GbCuboid3DPtr geoOutflow (new GbCuboid3D(d_maxX1, d_minX2-4.0*blockLength, d_minX3-4.0*blockLength, d_maxX1+4.0*blockLength, d_maxX2+4.0*blockLength, d_maxX3+4.0*blockLength));
+         if(myid == 0) GbSystem3D::writeGeoObject(geoOutflow.get(), pathname+"/geo/geoOutflow", WbWriterVtkXmlASCII::getInstance());
+
+         BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname + "/grid/blocks", WbWriterVtkXmlBinary::getInstance(), comm));
+
+         if (refineLevel > 0)
+         {
+            if(myid == 0) UBLOG(logINFO,"Refinement - start");	
+            RefineCrossAndInsideGbObjectHelper refineHelper(grid, refineLevel);
+            //refineHelper.addGbObject(refineCube, refineLevel);
+            refineHelper.addGbObject(refCylinder, refineLevel);
+            refineHelper.refine();
+            if(myid == 0) UBLOG(logINFO,"Refinement - end");	
+         }
+
+         MetisPartitioningGridVisitor metisVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B);
+         grid->accept( metisVisitor );
+
+         SolidBlocksHelper sd(grid, comm);
+
+         int bbOption = 1; //0=simple Bounce Back, 1=quadr. BB
+         D3Q27BoundaryConditionAdapterPtr bcObst(new D3Q27NoSlipBCAdapter(bbOption));
+         cylinderInt = D3Q27InteractorPtr ( new D3Q27Interactor(cylinder, grid, bcObst,Interactor3D::SOLID));
+
+         //walls
+         D3Q27InteractorPtr addWallYminInt(new D3Q27Interactor(addWallYmin, grid, bcObst,Interactor3D::SOLID));
+         D3Q27InteractorPtr addWallZminInt(new D3Q27Interactor(addWallZmin, grid, bcObst,Interactor3D::SOLID));
+         D3Q27InteractorPtr addWallYmaxInt(new D3Q27Interactor(addWallYmax, grid, bcObst,Interactor3D::SOLID));
+         D3Q27InteractorPtr addWallZmaxInt(new D3Q27Interactor(addWallZmax, grid, bcObst,Interactor3D::SOLID));
+
+         mu::Parser fct;
+         fct.SetExpr("16*U*x2*x3*(H-x2)*(H-x3)/H^4");
+         fct.DefineConst("U", uLB);
+         fct.DefineConst("H", H);
+
+         //inflow
+         D3Q27BoundaryConditionAdapterPtr velBCAdapter(new D3Q27VelocityBCAdapter (true, false ,false ,fct, 0, D3Q27BCFunction::INFCONST));
+         velBCAdapter->setSecondaryBcOption(2);
+         D3Q27InteractorPtr inflowInt  = D3Q27InteractorPtr( new D3Q27Interactor(geoInflow, grid, velBCAdapter, Interactor3D::SOLID));
+
+         //outflow
+         D3Q27BoundaryConditionAdapterPtr denBCAdapter(new D3Q27DensityBCAdapter(rhoLB));
+         D3Q27InteractorPtr outflowInt = D3Q27InteractorPtr( new D3Q27Interactor(geoOutflow, grid, denBCAdapter,Interactor3D::SOLID));
+
+         sd.addInteractor(cylinderInt);
+         sd.addInteractor(addWallYminInt);
+         sd.addInteractor(addWallZminInt);
+         sd.addInteractor(addWallYmaxInt);
+         sd.addInteractor(addWallZmaxInt);
+         sd.addInteractor(inflowInt);
+         sd.addInteractor(outflowInt);
+
+         sd.deleteSolidBlocks();
+
+         grid->accept( metisVisitor );
+
+         sd.setTransBlocks();
+
+         ppblocks->update(0);
+         ppblocks.reset();
+
+         //set connectors
+         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
+         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
+         grid->accept( setConnsVisitor );
+
+         unsigned long nob = grid->getNumberOfBlocks();
+         int gl = 3;
+         unsigned long nod = nob * (blocknx1+gl) * (blocknx2+gl) * (blocknx3+gl);
+
+         double needMemAll  = double(nod*(27*sizeof(double) + sizeof(int) + sizeof(float)*4));
+         double needMem  = needMemAll / double(comm->getNumberOfProcesses());
+
+         if(myid == 0)
+         {
+            UBLOG(logINFO,"Number of blocks = " << nob);
+            UBLOG(logINFO,"Number of nodes  = " << nod);
+            UBLOG(logINFO,"Necessary memory  = " << needMemAll  << " bytes");
+            UBLOG(logINFO,"Necessary memory per process = " << needMem  << " bytes");
+            UBLOG(logINFO,"Available memory per process = " << availMem << " bytes");
+         }            
+
+         LBMKernel3DPtr kernel(new LBMKernelETD3Q27CCLB(blocknx1, blocknx2, blocknx3, LBMKernelETD3Q27CCLB::NORMAL));
+
+         BCProcessorPtr bcProc(new D3Q27ETBCProcessor());
+         kernel->setBCProcessor(bcProc);
+
+         SetKernelBlockVisitor kernelVisitor(kernel, nueLB, availMem, needMem);
+         grid->accept(kernelVisitor);
+
+         if (refineLevel > 0)
+         {
+            D3Q27SetUndefinedNodesBlockVisitor undefNodesVisitor;
+            grid->accept(undefNodesVisitor);
+         }
+
+         //walls
+         grid->addAndInitInteractor(addWallYminInt);
+         grid->addAndInitInteractor(addWallZminInt);
+         grid->addAndInitInteractor(addWallYmaxInt);
+         grid->addAndInitInteractor(addWallZmaxInt);
+
+         //obstacle
+         grid->addAndInitInteractor(cylinderInt);
+
+         //inflow
+         grid->addAndInitInteractor(inflowInt);
+
+         //outflow
+         grid->addAndInitInteractor(outflowInt);
+
+         //domain decomposition
+         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
+         grid->accept(pqPartVisitor);
+
+         //initialization of distributions
+         D3Q27ETInitDistributionsBlockVisitor initVisitor(nueLB, rhoLB);
+         initVisitor.setVx1(fct);
+         grid->accept(initVisitor);
+
+         //Postrozess
+         UbSchedulerPtr geoSch(new UbScheduler(1));
+         D3Q27MacroscopicQuantitiesPostprocessorPtr ppgeo(
+            new D3Q27MacroscopicQuantitiesPostprocessor(grid, geoSch, pathname + "/grid/nodes", WbWriterVtkXmlBinary::getInstance(), conv, comm, true));
+         ppgeo->update(0);
+         ppgeo.reset();
+
+         if(myid == 0) UBLOG(logINFO,"Preprozess - end"); 
+      }
+
+      double outTime = 10000.0;
+      UbSchedulerPtr visSch(new UbScheduler(outTime));
+      //visSch->addSchedule(1000, 1000, 10000);
+      //visSch->addSchedule(10000, 10000, 50000);
+      //visSch->addSchedule(100, 100, 10000);
+
+      D3Q27MacroscopicQuantitiesPostprocessor pp(grid, visSch, pathname + "/steps/step", WbWriterVtkXmlBinary::getInstance(), conv, comm);
+
+      double fdx = grid->getDeltaX(grid->getFinestInitializedLevel());
+      double point1[3] = {0.45, 0.20, 0.205};
+      double point2[3] = {0.55, 0.20, 0.205};
+
+      D3Q27IntegrateValuesHelperPtr h1(new D3Q27IntegrateValuesHelper(grid, comm, 
+         point1[0]-1.0*fdx, point1[1]-1.0*fdx, point1[2]-1.0*fdx, 
+         point1[0], point1[1], point1[2]));
+      if(myid ==0) GbSystem3D::writeGeoObject(h1->getBoundingBox().get(),pathname + "/geo/iv1", WbWriterVtkXmlBinary::getInstance());
+      D3Q27IntegrateValuesHelperPtr h2(new D3Q27IntegrateValuesHelper(grid, comm, 
+         point2[0], point2[1]-1.0*fdx, point2[2]-1.0*fdx, 
+         point2[0]+1.0*fdx, point2[1], point2[2]));
+      if(myid ==0) GbSystem3D::writeGeoObject(h2->getBoundingBox().get(),pathname + "/geo/iv2", WbWriterVtkXmlBinary::getInstance());
+      //D3Q27PressureDifferencePostprocessor rhopp(grid, visSch, pathname + "/results/rho_diff.txt", h1, h2, conv, comm);
+      D3Q27PressureDifferencePostprocessor rhopp(grid, visSch, pathname + "/results/rho_diff.txt", h1, h2, rhoReal, uReal, uLB, comm);
+      
+      double area = (2.0*radius*H)/(dx*dx);
+      double v    = 4.0*uLB/9.0;
+      D3Q27ForcesPostprocessor fp(grid, visSch, pathname + "/results/forces.txt", comm, v, area);
+      fp.addInteractor(cylinderInt);
+      
+      UbSchedulerPtr nupsSch(new UbScheduler(10, 10, 40));
+      NUPSCounterPostprocessor npr(grid, nupsSch, pathname + "/results/nups.txt", comm);
+
+      double endTime = 100001.0;
+      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, visSch));
+      if(myid == 0) UBLOG(logINFO,"Simulation-start");
+      calculation->calculate();
+      if(myid == 0) UBLOG(logINFO,"Simulation-end");
+   }
+   catch(std::exception& e)
+   {
+      cerr << e.what() << endl << flush;
+   }
+   catch(std::string& s)
+   {
+      cerr << s << endl;
+   }
+   catch(...)
+   {
+      cerr << "unknown exception" << endl;
+   }
+
+}
+
+//////////////////////////////////////////////////////////////////////////
+void run2(const char *cstr)
+{
+   try
+   {
+      Sleep(30000);
+      string machine = QUOTEME(CAB_MACHINE);
+      string pathname; 
+      int numOfThreads = 1;
+      double availMem = 0;
+
+      CommunicatorPtr comm = MPICommunicator::getInstance();
+      int myid = comm->getProcessID();
+
+      if(machine == "BOMBADIL") 
+      {
+         pathname = "d:/temp/cylinder_20nu";
+         numOfThreads = 4;
+         availMem = 10.0e9;
+      }
+      else if(machine == "M01" || machine == "M02")      
+      {
+         pathname = "/work/koskuche/scratch/cylinder_Re20nu4l";
+         numOfThreads = 1;
+         availMem = 12.0e9;
+
+         if(myid ==0)
+         {
+            stringstream logFilename;
+            logFilename <<  pathname + "/logfile"+UbSystem::toString(UbSystem::getTimeStamp())+".txt";
+            UbLog::output_policy::setStream(logFilename.str());
+         }
+      }
+      else throw UbException(UB_EXARGS, "unknown CAB_MACHINE");
+
+      double dx = 0.01;
+
+      double L1 = 2.5*2.0;
+      double L2, L3, H;
+      L2 = L3 = H = 0.41*2.0;
+
+      LBMReal radius = 0.05*2.0;
+      LBMReal rhoReal = 1.0; //kg/m^3
+      LBMReal uReal = 0.45;//m/s
+      LBMReal uLB = 0.05;
+      LBMReal Re = 20.0;
+      LBMReal rhoLB = 0.0;
+      LBMReal l = L2 / dx;
+
+      //LBMUnitConverterPtr conv = LBMUnitConverterPtr(new LBMUnitConverter(1.0, 1/sqrt(3.0)*(uReal/uLB), 1.0, 1.0/dx, dx*dx*dx));
+      LBMUnitConverterPtr conv = LBMUnitConverterPtr(new LBMUnitConverter());
+
+      const int baseLevel = 0;
+      const int refineLevel = 1;
+
+      //obstacle
+      GbObject3DPtr cylinder(new GbCylinder3D(0.5*2.0, 0.2*2.0, -0.1, 0.5*2.0, 0.2*2.0, L3+0.1, radius));
+      GbSystem3D::writeGeoObject(cylinder.get(),pathname + "/geo/cylinder", WbWriterVtkXmlBinary::getInstance());
+
+      GbObject3DPtr refCylinder(new GbCylinder3D(0.5*2.0, 0.2*2.0, -0.1, 0.5*2.0, 0.2*2.0, L3+0.1, radius+7.0*dx/(1<<refineLevel)));
+      GbSystem3D::writeGeoObject(refCylinder.get(),pathname + "/geo/refCylinder", WbWriterVtkXmlBinary::getInstance());
+
+      D3Q27InteractorPtr cylinderInt;
+
+      //bounding box
+      double d_minX1 = 0.0;
+      double d_minX2 = 0.0;
+      double d_minX3 = 0.0;
+
+      double d_maxX1 = L1;
+      double d_maxX2 = L2;
+      double d_maxX3 = L3;
+
+      //double offs = dx;
+      double offs = 0;
+
+      //double g_minX1 = d_minX1-offs-0.499999*dx;
+      double g_minX1 = d_minX1;
+      double g_minX2 = d_minX2-7.0*dx;
+      double g_minX3 = d_minX3;
+
+      double g_maxX1 = d_maxX1;
+      double g_maxX2 = d_maxX2;
+      double g_maxX3 = d_maxX3;
+
+      GbObject3DPtr gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
+
+      const int blocknx1 = 8;
+      const int blocknx2 = 8;
+      const int blocknx3 = 8;
+
+      //dx = (0.41+2.0*dx)/(10.0*(int)blocknx2);
+
+      LBMReal nueLB = (((4.0/9.0)*uLB)*2.0*(radius/dx))/Re;
+
+      double blockLength = blocknx1*dx;
+
+      //refinement area
+      double rf = cylinder->getLengthX1()/4;
+      GbObject3DPtr refineCube(new  GbCuboid3D(cylinder->getX1Minimum()-rf, cylinder->getX2Minimum()-rf, cylinder->getX3Minimum(), 
+         cylinder->getX1Maximum()+rf, cylinder->getX2Maximum()+rf, cylinder->getX3Maximum()));
+      //       GbObject3DPtr refineCube(new  GbCuboid3D(g_minX1 + 7.05*blockLength, g_minX2 + 3.05*blockLength, cylinder->getX3Minimum(), 
+      //          g_minX1 + 12.95*blockLength, g_maxX2 - 3.05*blockLength, cylinder->getX3Maximum()));
+
+      Grid3DPtr grid(new Grid3D(comm));
+
+      UbSchedulerPtr rSch(new UbScheduler(100000, 100000));
+      //RestartPostprocessorPtr rp(new RestartPostprocessor(grid, rSch, comm, pathname+"/checkpoints", RestartPostprocessor::BINARY));
+
+      //UbSchedulerPtr emSch(new UbScheduler(1000, 1000));
+      //EmergencyExitPostprocessor em(grid, emSch, pathname+"/checkpoints/emex.txt", rp, comm);
+
+      std::string opt;
+
+      if(cstr!= NULL)
+         opt = std::string(cstr);
+
+      if/*(cstr== NULL)*/(cstr!= NULL)
+      {
+         opt = std::string(cstr);
+
+         if(myid==0) UBLOG(logINFO,"Restart step: " << opt);
+
+         //grid = rp->restart(UbSystem::stringTo<int>(opt));
+         //rp->reconnect();
+
+         //cylinderInt = 
+
+         //set connectors
+         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27OffsetInterpolationProcessor());
+         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
+         grid->accept( setConnsVisitor );
+
+         //domain decomposition
+         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
+         grid->accept(pqPartVisitor);
+      }
+      else
+      {
+         if(myid ==0)
+         {
+            UBLOG(logINFO,"Number of processes = " << comm->getNumberOfProcesses() );
+            UBLOG(logINFO,"path = " << pathname );
+            UBLOG(logINFO,"L = " << L1/dx );
+            UBLOG(logINFO,"H = " << H/dx );
+            UBLOG(logINFO,"v = " << uLB );
+            UBLOG(logINFO,"rho = " << rhoLB );
+            UBLOG(logINFO,"nue = " << nueLB );
+            UBLOG(logINFO,"Re = " << Re );
+            UBLOG(logINFO,"dx = " << dx );
+            UBLOG(logINFO,"Number of level = " << refineLevel+1 );
+            //UBLOG(logINFO,conv->toString() );
+            UBLOG(logINFO,"Preprozess - start");
+         }
+
+         grid->setDeltaX(dx);
+         grid->setBlockNX(blocknx1, blocknx2, blocknx3);
+
+         // UbTupleDouble6 bouningBox(gridCube->getX1Minimum(),gridCube->getX2Minimum(),gridCube->getX3Minimum(),
+         // gridCube->getX1Maximum(),gridCube->getX2Maximum(),gridCube->getX3Maximum());
+         // UbTupleInt3 blockNx(blocknx1, blocknx2, blocknx3);
+         // UbTupleInt3 gridNx(8, 16, 16);
+         // grid = Grid3DPtr(new Grid3D(bouningBox, blockNx, gridNx));
+
+         if(myid ==0) GbSystem3D::writeGeoObject(gridCube.get(),pathname + "/geo/gridCube", WbWriterVtkXmlBinary::getInstance());
+         if(myid ==0) GbSystem3D::writeGeoObject(refineCube.get(),pathname + "/geo/refineCube", WbWriterVtkXmlBinary::getInstance());
+
+         GenBlocksGridVisitor genBlocks;
+         genBlocks.addGeoObject(gridCube);
+         grid->accept(genBlocks);
+
+         //walls
+         GbCuboid3DPtr addWallYmin (new GbCuboid3D(d_minX1-blockLength, d_minX2-blockLength, d_minX3-blockLength, d_maxX1+blockLength, d_minX2, d_maxX3+blockLength));
+         if(myid == 0) GbSystem3D::writeGeoObject(addWallYmin.get(), pathname+"/geo/addWallYmin", WbWriterVtkXmlASCII::getInstance());
+
+         GbCuboid3DPtr addWallZmin (new GbCuboid3D(d_minX1-blockLength, d_minX2-blockLength, d_minX3-blockLength, d_maxX1+blockLength, d_maxX2+blockLength, d_minX3));
+         if(myid == 0) GbSystem3D::writeGeoObject(addWallZmin.get(), pathname+"/geo/addWallZmin", WbWriterVtkXmlASCII::getInstance());
+
+         GbCuboid3DPtr addWallYmax (new GbCuboid3D(d_minX1-blockLength, d_maxX2, d_minX3-blockLength, d_maxX1+blockLength, d_maxX2+blockLength, d_maxX3+blockLength));
+         if(myid == 0) GbSystem3D::writeGeoObject(addWallYmax.get(), pathname+"/geo/addWallYmax", WbWriterVtkXmlASCII::getInstance());
+
+         GbCuboid3DPtr addWallZmax (new GbCuboid3D(d_minX1-blockLength, d_minX2-blockLength, d_maxX3, d_maxX1+blockLength, d_maxX2+blockLength, d_maxX3+blockLength));
+         if(myid == 0) GbSystem3D::writeGeoObject(addWallZmax.get(), pathname+"/geo/addWallZmax", WbWriterVtkXmlASCII::getInstance());
+
+         //inflow
+         GbCuboid3DPtr geoInflow (new GbCuboid3D(d_minX1-blockLength, d_minX2-blockLength, d_minX3-blockLength, d_minX1, d_maxX2+blockLength, d_maxX3+blockLength));
+         if(myid == 0) GbSystem3D::writeGeoObject(geoInflow.get(), pathname+"/geo/geoInflow", WbWriterVtkXmlASCII::getInstance());
+
+         //outflow
+         GbCuboid3DPtr geoOutflow (new GbCuboid3D(d_maxX1, d_minX2-blockLength, d_minX3-blockLength, d_maxX1+blockLength, d_maxX2+blockLength, d_maxX3+blockLength));
+         if(myid == 0) GbSystem3D::writeGeoObject(geoOutflow.get(), pathname+"/geo/geoOutflow", WbWriterVtkXmlASCII::getInstance());
+
+         BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname + "/grid/blocks", WbWriterVtkXmlBinary::getInstance(), comm));
+
+         if (refineLevel > 0)
+         {
+            if(myid == 0) UBLOG(logINFO,"Refinement - start");	
+            RefineCrossAndInsideGbObjectHelper refineHelper(grid, refineLevel);
+            //refineHelper.addGbObject(refineCube, refineLevel);
+            refineHelper.addGbObject(refCylinder, refineLevel);
+            refineHelper.refine();
+            if(myid == 0) UBLOG(logINFO,"Refinement - end");	
+         }
+
+         MetisPartitioningGridVisitor metisVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B);
+         grid->accept( metisVisitor );
+
+         SolidBlocksHelper sd(grid, comm);
+
+         int bbOption = 1; //0=simple Bounce Back, 1=quadr. BB
+         D3Q27BoundaryConditionAdapterPtr bcObst(new D3Q27NoSlipBCAdapter(bbOption));
+         cylinderInt = D3Q27InteractorPtr ( new D3Q27Interactor(cylinder, grid, bcObst,Interactor3D::SOLID));
+
+         //walls
+         D3Q27InteractorPtr addWallYminInt(new D3Q27Interactor(addWallYmin, grid, bcObst,Interactor3D::SOLID));
+         D3Q27InteractorPtr addWallZminInt(new D3Q27Interactor(addWallZmin, grid, bcObst,Interactor3D::SOLID));
+         D3Q27InteractorPtr addWallYmaxInt(new D3Q27Interactor(addWallYmax, grid, bcObst,Interactor3D::SOLID));
+         D3Q27InteractorPtr addWallZmaxInt(new D3Q27Interactor(addWallZmax, grid, bcObst,Interactor3D::SOLID));
+
+         mu::Parser fct;
+         fct.SetExpr("16*U*x2*x3*(H-x2)*(H-x3)/H^4");
+         fct.DefineConst("U", uLB);
+         fct.DefineConst("H", H);
+
+         //inflow
+         D3Q27BoundaryConditionAdapterPtr velBCAdapter(new D3Q27VelocityBCAdapter (true, false ,false ,fct, 0, D3Q27BCFunction::INFCONST));
+         velBCAdapter->setSecondaryBcOption(2);
+         D3Q27InteractorPtr inflowInt  = D3Q27InteractorPtr( new D3Q27Interactor(geoInflow, grid, velBCAdapter, Interactor3D::SOLID));
+
+         //outflow
+         D3Q27BoundaryConditionAdapterPtr denBCAdapter(new D3Q27DensityBCAdapter(rhoLB));
+         D3Q27InteractorPtr outflowInt = D3Q27InteractorPtr( new D3Q27Interactor(geoOutflow, grid, denBCAdapter,Interactor3D::SOLID));
+
+         sd.addInteractor(cylinderInt);
+         sd.addInteractor(addWallYminInt);
+         sd.addInteractor(addWallZminInt);
+         sd.addInteractor(addWallYmaxInt);
+         sd.addInteractor(addWallZmaxInt);
+         sd.addInteractor(inflowInt);
+         sd.addInteractor(outflowInt);
+
+         sd.deleteSolidBlocks();
+
+         grid->accept( metisVisitor );
+
+         sd.setTransBlocks();
+
+         ppblocks->update(0);
+         ppblocks.reset();
+
+         //set connectors
+         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
+         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
+         grid->accept( setConnsVisitor );
+
+         unsigned long nob = grid->getNumberOfBlocks();
+         int gl = 3;
+         unsigned long nod = nob * (blocknx1+gl) * (blocknx2+gl) * (blocknx3+gl);
+
+         double needMemAll  = double(nod*(27*sizeof(double) + sizeof(int) + sizeof(float)*4));
+         double needMem  = needMemAll / double(comm->getNumberOfProcesses());
+
+         if(myid == 0)
+         {
+            UBLOG(logINFO,"Number of blocks = " << nob);
+            UBLOG(logINFO,"Number of nodes  = " << nod);
+            UBLOG(logINFO,"Necessary memory  = " << needMemAll  << " bytes");
+            UBLOG(logINFO,"Necessary memory per process = " << needMem  << " bytes");
+            UBLOG(logINFO,"Available memory per process = " << availMem << " bytes");
+         }            
+
+         LBMKernel3DPtr kernel(new LBMKernelETD3Q27CCLB(blocknx1, blocknx2, blocknx3, LBMKernelETD3Q27CCLB::NORMAL));
+
+         BCProcessorPtr bcProc(new D3Q27ETBCProcessor());
+         kernel->setBCProcessor(bcProc);
+
+         SetKernelBlockVisitor kernelVisitor(kernel, nueLB, availMem, needMem);
+         grid->accept(kernelVisitor);
+
+         if (refineLevel > 0)
+         {
+            D3Q27SetUndefinedNodesBlockVisitor undefNodesVisitor;
+            grid->accept(undefNodesVisitor);
+         }
+
+         //walls
+         grid->addAndInitInteractor(addWallYminInt);
+         grid->addAndInitInteractor(addWallZminInt);
+         grid->addAndInitInteractor(addWallYmaxInt);
+         grid->addAndInitInteractor(addWallZmaxInt);
+
+         //obstacle
+         grid->addAndInitInteractor(cylinderInt);
+
+         //inflow
+         grid->addAndInitInteractor(inflowInt);
+
+         //outflow
+         grid->addAndInitInteractor(outflowInt);
+
+         //domain decomposition
+         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
+         grid->accept(pqPartVisitor);
+
+         //initialization of distributions
+         D3Q27ETInitDistributionsBlockVisitor initVisitor(nueLB, rhoLB);
+         initVisitor.setVx1(fct);
+         grid->accept(initVisitor);
+
+         //Postrozess
+         UbSchedulerPtr geoSch(new UbScheduler(1));
+         D3Q27MacroscopicQuantitiesPostprocessorPtr ppgeo(
+            new D3Q27MacroscopicQuantitiesPostprocessor(grid, geoSch, pathname + "/grid/nodes", WbWriterVtkXmlBinary::getInstance(), conv, comm, true));
+         ppgeo->update(0);
+         ppgeo.reset();
+
+         if(myid == 0) UBLOG(logINFO,"Preprozess - end"); 
+      }
+
+      double outTime = 100.0;
+      UbSchedulerPtr visSch(new UbScheduler(outTime));
+      //visSch->addSchedule(1000, 1000, 10000);
+      //visSch->addSchedule(10000, 10000, 50000);
+      //visSch->addSchedule(100, 100, 10000);
+
+      D3Q27MacroscopicQuantitiesPostprocessor pp(grid, visSch, pathname + "/steps/step", WbWriterVtkXmlBinary::getInstance(), conv, comm);
+
+      double fdx = grid->getDeltaX(grid->getFinestInitializedLevel());
+      double point1[3] = {0.45, 0.20, 0.205};
+      double point2[3] = {0.55, 0.20, 0.205};
+
+      D3Q27IntegrateValuesHelperPtr h1(new D3Q27IntegrateValuesHelper(grid, comm, 
+         point1[0]-1.0*fdx, point1[1]-1.0*fdx, point1[2]-1.0*fdx, 
+         point1[0], point1[1], point1[2]));
+      if(myid ==0) GbSystem3D::writeGeoObject(h1->getBoundingBox().get(),pathname + "/geo/iv1", WbWriterVtkXmlBinary::getInstance());
+      D3Q27IntegrateValuesHelperPtr h2(new D3Q27IntegrateValuesHelper(grid, comm, 
+         point2[0], point2[1]-1.0*fdx, point2[2]-1.0*fdx, 
+         point2[0]+1.0*fdx, point2[1], point2[2]));
+      if(myid ==0) GbSystem3D::writeGeoObject(h2->getBoundingBox().get(),pathname + "/geo/iv2", WbWriterVtkXmlBinary::getInstance());
+      //D3Q27PressureDifferencePostprocessor rhopp(grid, visSch, pathname + "/results/rho_diff.txt", h1, h2, conv, comm);
+      D3Q27PressureDifferencePostprocessor rhopp(grid, visSch, pathname + "/results/rho_diff.txt", h1, h2, rhoReal, uReal, uLB, comm);
+
+      double area = (2.0*radius*H)/(dx*dx);
+      double v    = 4.0*uLB/9.0;
+      D3Q27ForcesPostprocessor fp(grid, visSch, pathname + "/results/forces.txt", comm, v, area);
+      fp.addInteractor(cylinderInt);
+
+      UbSchedulerPtr nupsSch(new UbScheduler(10, 10, 40));
+      NUPSCounterPostprocessor npr(grid, nupsSch, pathname + "/results/nups.txt", comm);
+
+      double endTime = 100001.0;
+      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, visSch));
+      if(myid == 0) UBLOG(logINFO,"Simulation-start");
+      calculation->calculate();
+      if(myid == 0) UBLOG(logINFO,"Simulation-end");
+   }
+   catch(std::exception& e)
+   {
+      cerr << e.what() << endl << flush;
+   }
+   catch(std::string& s)
+   {
+      cerr << s << endl;
+   }
+   catch(...)
+   {
+      cerr << "unknown exception" << endl;
+   }
+
+}
+//////////////////////////////////////////////////////////////////////////
+int main(int argc, char* argv[])
+{
+
+   run2(argv[1]);
+
+   return 0;
+}
+
diff --git a/apps/cpu/Hagen_Poiseuille_flow/CMakeLists.txt b/apps/cpu/Hagen_Poiseuille_flow/CMakeLists.txt
index a08cabcebb8ad5a1bbc9279c8acd9f1577cdfd36..e2045614ccd4921c1b3c55a5bbb772c813e871e1 100644
--- a/apps/cpu/Hagen_Poiseuille_flow/CMakeLists.txt
+++ b/apps/cpu/Hagen_Poiseuille_flow/CMakeLists.txt
@@ -1,25 +1,25 @@
-CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
-
-########################################################
-## C++ PROJECT                                       ###
-########################################################
-PROJECT(pflow)
-
-INCLUDE(${APPS_ROOT}/IncludsList.cmake) 
-
-#################################################################
-###   LOCAL FILES                                             ###
-#################################################################
-FILE(GLOB SPECIFIC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.h
-                         ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
-                         ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp  )
- 
-SET(ALL_SOURCES ${ALL_SOURCES} ${SPECIFIC_FILES})
-SOURCE_GROUP(src FILES ${SPECIFIC_FILES})
-  
-SET(CAB_ADDITIONAL_LINK_LIBRARIES VirtualFluids)
-
-#################################################################
-###   CREATE PROJECT                                          ###
-#################################################################
-CREATE_CAB_PROJECT(pflow BINARY)
+CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
+
+########################################################
+## C++ PROJECT                                       ###
+########################################################
+PROJECT(pflow)
+
+INCLUDE(${APPS_ROOT}/IncludsList.cmake) 
+
+#################################################################
+###   LOCAL FILES                                             ###
+#################################################################
+FILE(GLOB SPECIFIC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.h
+                         ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
+                         ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp  )
+ 
+SET(ALL_SOURCES ${ALL_SOURCES} ${SPECIFIC_FILES})
+SOURCE_GROUP(src FILES ${SPECIFIC_FILES})
+  
+SET(CAB_ADDITIONAL_LINK_LIBRARIES VirtualFluids)
+
+#################################################################
+###   CREATE PROJECT                                          ###
+#################################################################
+CREATE_CAB_PROJECT(pflow BINARY)
diff --git a/apps/cpu/Hagen_Poiseuille_flow/pf1.cfg b/apps/cpu/Hagen_Poiseuille_flow/pf1.cfg
index 68de4f8f90c49e5d50ae00749742a7eb1b27882a..c813f9c35e0eb52e705917d14454c8fb9d5c6845 100644
--- a/apps/cpu/Hagen_Poiseuille_flow/pf1.cfg
+++ b/apps/cpu/Hagen_Poiseuille_flow/pf1.cfg
@@ -1,18 +1,18 @@
-pathname = d:/temp/pflow1
-numOfThreads = 4
-availMem = 8e9
-logToFile = false
-blocknx = 10 10 10
-gridnx = 2 1 2
-nuLB = 1e-2
-forcing = 5e-8
-deltax = 0.1
-
-refineLevel = 0
-logToFile=false
-thinWall = false
-
-restartStep = 100000
-
-endTime = 100000
+pathname = d:/temp/pflow1
+numOfThreads = 4
+availMem = 8e9
+logToFile = false
+blocknx = 10 10 10
+gridnx = 2 1 2
+nuLB = 1e-2
+forcing = 5e-8
+deltax = 0.1
+
+refineLevel = 0
+logToFile=false
+thinWall = false
+
+restartStep = 100000
+
+endTime = 100000
 outTime = 100000
\ No newline at end of file
diff --git a/apps/cpu/Hagen_Poiseuille_flow/pf2.cfg b/apps/cpu/Hagen_Poiseuille_flow/pf2.cfg
index 348eb0c962aec6742b9882cf83b4935cd3d2c83d..6ecbc0dfe05bc2973aa0c2ef6529bc9c80d1e197 100644
--- a/apps/cpu/Hagen_Poiseuille_flow/pf2.cfg
+++ b/apps/cpu/Hagen_Poiseuille_flow/pf2.cfg
@@ -1,18 +1,18 @@
-pathname = d:/temp/pflow2
-numOfThreads = 4
-availMem = 8e9
-logToFile = false
-blocknx = 10 10 10
-gridnx = 2 0.5 2
-nuLB = 1e-2
-forcing = 6.25e-9
-deltax = 0.05
-
-refineLevel = 0
-logToFile=false
-thinWall = false
-
-restartStep = 400000
-
-endTime = 400000
+pathname = d:/temp/pflow2
+numOfThreads = 4
+availMem = 8e9
+logToFile = false
+blocknx = 10 10 10
+gridnx = 2 0.5 2
+nuLB = 1e-2
+forcing = 6.25e-9
+deltax = 0.05
+
+refineLevel = 0
+logToFile=false
+thinWall = false
+
+restartStep = 400000
+
+endTime = 400000
 outTime = 400000
\ No newline at end of file
diff --git a/apps/cpu/Hagen_Poiseuille_flow/pf3.cfg b/apps/cpu/Hagen_Poiseuille_flow/pf3.cfg
index 1104e07971f97a0fefc7f8f21a1bf29602bbb5d3..111829262c062689296819e0c6cc771d92584d4d 100644
--- a/apps/cpu/Hagen_Poiseuille_flow/pf3.cfg
+++ b/apps/cpu/Hagen_Poiseuille_flow/pf3.cfg
@@ -1,18 +1,18 @@
-pathname = d:/temp/pflow4
-numOfThreads = 8
-availMem = 8e9
-logToFile = false
-blocknx = 10 10 10
-gridnx = 2 0.25 2
-nuLB = 1e-2
-forcing = 7.8125e-10
-deltax = 0.025
-
-refineLevel = 0
-logToFile=false
-thinWall = false
-
-restartStep = 400000
-
-endTime = 1600000
+pathname = d:/temp/pflow4
+numOfThreads = 8
+availMem = 8e9
+logToFile = false
+blocknx = 10 10 10
+gridnx = 2 0.25 2
+nuLB = 1e-2
+forcing = 7.8125e-10
+deltax = 0.025
+
+refineLevel = 0
+logToFile=false
+thinWall = false
+
+restartStep = 400000
+
+endTime = 1600000
 outTime = 400000
\ No newline at end of file
diff --git a/apps/cpu/Hagen_Poiseuille_flow/pf4.cfg b/apps/cpu/Hagen_Poiseuille_flow/pf4.cfg
index c7b2430129b76170a69cb863c76ce991c7fe3fac..41a53e96ad0e4c3ec10f8559fda567357bd1e65c 100644
--- a/apps/cpu/Hagen_Poiseuille_flow/pf4.cfg
+++ b/apps/cpu/Hagen_Poiseuille_flow/pf4.cfg
@@ -1,19 +1,19 @@
-pathname = d:/temp/pflow4
-numOfThreads = 8
-availMem = 8e9
-logToFile = false
-blocknx = 10 10 10
-gridnx = 2 0.25 2
-nuLB = 1e-2
-forcing = 7.8125e-10
-deltax = 0.025
-
-refineLevel = 1
-logToFile=false
-thinWall = false
-
-restartStep = 400000
-
-endTime = 1600000
-#outTime = 400000
+pathname = d:/temp/pflow4
+numOfThreads = 8
+availMem = 8e9
+logToFile = false
+blocknx = 10 10 10
+gridnx = 2 0.25 2
+nuLB = 1e-2
+forcing = 7.8125e-10
+deltax = 0.025
+
+refineLevel = 1
+logToFile=false
+thinWall = false
+
+restartStep = 400000
+
+endTime = 1600000
+#outTime = 400000
 outTime = 400
\ No newline at end of file
diff --git a/apps/cpu/Hagen_Poiseuille_flow/pfDP.cfg b/apps/cpu/Hagen_Poiseuille_flow/pfDP.cfg
index e70b0c343bce3568839c3aa734a2585fcf350886..ad2cfe7e1b4a5008121ab0863b0a6e05fcc3e24d 100644
--- a/apps/cpu/Hagen_Poiseuille_flow/pfDP.cfg
+++ b/apps/cpu/Hagen_Poiseuille_flow/pfDP.cfg
@@ -1,24 +1,24 @@
-pathname = d:/temp/pflowDP
-numOfThreads = 1
-availMem = 3e9
-logToFile = false
-blocknx = 10 10 10
-boundingBox = 20 20 20 
-nuLB = 0.01
-dpLB = 1e-6 #9.99685e-7
-deltax = 1
-#deltax = 3.9999999e-6
-
-#deltax = 1
-
-refineLevel = 0
-thinWall = false
-
-
-newStart    = true
-restartStep = 100
-
-cpStep      = 100
-cpStepStart = 100
-outTime     = 1
-endTime     = 100
+pathname = d:/temp/pflowDP
+numOfThreads = 1
+availMem = 3e9
+logToFile = false
+blocknx = 10 10 10
+boundingBox = 20 20 20 
+nuLB = 0.01
+dpLB = 1e-6 #9.99685e-7
+deltax = 1
+#deltax = 3.9999999e-6
+
+#deltax = 1
+
+refineLevel = 0
+thinWall = false
+
+
+newStart    = true
+restartStep = 100
+
+cpStep      = 100
+cpStepStart = 100
+outTime     = 1
+endTime     = 100
diff --git a/apps/cpu/Hagen_Poiseuille_flow/pflow.cpp b/apps/cpu/Hagen_Poiseuille_flow/pflow.cpp
index 559ba2bd0ea94894ec7d34a41f831ad912b54db7..c448a5de53c96309be9e24ff4f507fee20a462c6 100644
--- a/apps/cpu/Hagen_Poiseuille_flow/pflow.cpp
+++ b/apps/cpu/Hagen_Poiseuille_flow/pflow.cpp
@@ -1,734 +1,734 @@
-#include <iostream>
-#include <string>
-
-#include <VirtualFluids.h>
-
-using namespace std;
-
-
-//void pflowForcing(string configname)
-//{
-//   try
-//   {
-//      ConfigurationFile   config;
-//      config.load(configname);
-//
-//      string          pathname = config.getString("pathname");
-//      int             numOfThreads = config.getInt("numOfThreads");
-//      vector<int>     blocknx = config.getVector<int>("blocknx");
-//      vector<double>  gridnx = config.getVector<double>("gridnx");
-//      double          nuLB = config.getDouble("nuLB");
-//      double          endTime = config.getDouble("endTime");
-//      double          outTime = config.getDouble("outTime");
-//      double          availMem = config.getDouble("availMem");
-//      int             refineLevel = config.getInt("refineLevel");
-//      bool            logToFile = config.getBool("logToFile");
-//      double          restartStep = config.getDouble("restartStep");
-//      double          forcing = config.getDouble("forcing");
-//      bool            thinWall = config.getBool("thinWall");
-//      double          deltax = config.getDouble("deltax");
-//
-//
-//      SPtr<Communicator> comm = MPICommunicator::getInstance();
-//      int myid = comm->getProcessID();
-//
-//      if (logToFile)
-//      {
-//#if defined(__unix__)
-//         if (myid == 0)
-//         {
-//            const char* str = pathname.c_str();
-//            mkdir(str, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
-//         }
-//#endif 
-//
-//         if (myid == 0)
-//         {
-//            stringstream logFilename;
-//            logFilename << pathname + "/logfile" + UbSystem::toString(UbSystem::getTimeStamp()) + ".txt";
-//            UbLog::output_policy::setStream(logFilename.str());
-//         }
-//      }
-//
-//      double dx = deltax;
-//
-//      const int blocknx1 = blocknx[0];
-//      const int blocknx2 = blocknx[1];
-//      const int blocknx3 = blocknx[2];
-//
-//      LBMReal rhoLB = 0.0;
-//
-//      SPtr<LBMUnitConverter> conv = SPtr<LBMUnitConverter>(new LBMUnitConverter());
-//
-//      const int baseLevel = 0;
-//
-//      //bounding box
-//      double g_minX1 = 0;
-//      double g_minX2 = 0;
-//      double g_minX3 = 0;
-//
-//      double g_maxX1 = gridnx[0];
-//      double g_maxX2 = gridnx[1];
-//      double g_maxX3 = gridnx[2];
-//
-//      double blockLength = blocknx1*dx;
-//
-//      SPtr<Grid3D> grid(new Grid3D(comm));
-//      grid->setPeriodicX1(true);
-//      grid->setPeriodicX2(true);
-//      grid->setPeriodicX3(false);
-//      grid->setDeltaX(dx);
-//      grid->setBlockNX(blocknx1, blocknx2, blocknx3);
-//
-//      SPtr<GbObject3D> gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
-//      if (myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), pathname + "/geo/gridCube", WbWriterVtkXmlBinary::getInstance());
-//
-//      //////////////////////////////////////////////////////////////////////////
-//      //restart
-//      SPtr<UbScheduler> rSch(new UbScheduler(restartStep, restartStep));
-//      RestartCoProcessor rp(grid, rSch, comm, pathname, RestartCoProcessor::TXT);
-//      //////////////////////////////////////////////////////////////////////////
-//
-//      if (grid->getTimeStep() == 0)
-//      {
-//         GenBlocksGridVisitor genBlocks(gridCube);
-//         grid->accept(genBlocks);
-//
-//         if (myid == 0)
-//         {
-//            UBLOG(logINFO, "Parameters:");
-//            UBLOG(logINFO, "forcing = " << forcing);
-//            UBLOG(logINFO, "rho = " << rhoLB);
-//            UBLOG(logINFO, "nu = " << nuLB);
-//            UBLOG(logINFO, "dx = " << dx);
-//            UBLOG(logINFO, "number of levels = " << refineLevel + 1);
-//            UBLOG(logINFO, "numOfThreads = " << numOfThreads);
-//            UBLOG(logINFO, "Preprozess - start");
-//         }
-//
-//         //////////////////////////////////////////////////////////////////////////
-//         //refinement
-//         double blockLengthX3Fine = grid->getDeltaX(refineLevel) * blocknx[2];
-//
-//         GbCuboid3DPtr refineBoxTop(new GbCuboid3D(g_minX1 - blockLength, g_minX2 - blockLength, g_maxX3 - blockLengthX3Fine, g_maxX1 + blockLength, g_maxX2 + blockLength, g_maxX3 + blockLength));
-//         if (myid == 0) GbSystem3D::writeGeoObject(refineBoxTop.get(), pathname + "/geo/refineBoxTop", WbWriterVtkXmlASCII::getInstance());
-//
-//         //GbCuboid3DPtr refineBoxBottom(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3, g_maxX1+blockLength, g_maxX2+blockLength, g_minX3+offsetMinX3+blockLengthX3Fine));
-//         GbCuboid3DPtr refineBoxBottom(new GbCuboid3D(g_minX1 - blockLength, g_minX2 - blockLength, g_minX3 - blockLengthX3Fine, g_maxX1 + blockLength, g_maxX2 + blockLength, g_minX3 + blockLengthX3Fine));
-//         if (myid == 0) GbSystem3D::writeGeoObject(refineBoxBottom.get(), pathname + "/geo/refineBoxBottom", WbWriterVtkXmlASCII::getInstance());
-//
-//         if (refineLevel > 0)
-//         {
-//            if (myid == 0) UBLOG(logINFO, "Refinement - start");
-//            RefineCrossAndInsideGbObjectHelper refineHelper(grid, refineLevel);
-//            refineHelper.addGbObject(refineBoxTop, refineLevel);
-//            refineHelper.addGbObject(refineBoxBottom, refineLevel);
-//            refineHelper.refine();
-//            if (myid == 0) UBLOG(logINFO, "Refinement - end");
-//         }
-//         //////////////////////////////////////////////////////////////////////////
-//
-//         //walls
-//         GbCuboid3DPtr addWallZmin(new GbCuboid3D(g_minX1 - blockLength, g_minX2 - blockLength, g_minX3 - blockLength, g_maxX1 + blockLength, g_maxX2 + blockLength, g_minX3));
-//         if (myid == 0) GbSystem3D::writeGeoObject(addWallZmin.get(), pathname + "/geo/addWallZmin", WbWriterVtkXmlASCII::getInstance());
-//
-//         GbCuboid3DPtr addWallZmax(new GbCuboid3D(g_minX1 - blockLength, g_minX2 - blockLength, g_maxX3, g_maxX1 + blockLength, g_maxX2 + blockLength, g_maxX3 + blockLength));
-//         if (myid == 0) GbSystem3D::writeGeoObject(addWallZmax.get(), pathname + "/geo/addWallZmax", WbWriterVtkXmlASCII::getInstance());
-//
-//         //wall interactors
-//         int bbOption = 1;
-//         D3Q27BoundaryConditionAdapterPtr bcNoSlip(new D3Q27NoSlipBCAdapter(bbOption));
-//         SPtr<D3Q27Interactor> addWallZminInt(new D3Q27Interactor(addWallZmin, grid, bcNoSlip, Interactor3D::SOLID));
-//         SPtr<D3Q27Interactor> addWallZmaxInt(new D3Q27Interactor(addWallZmax, grid, bcNoSlip, Interactor3D::SOLID));
-//
-//         ////////////////////////////////////////////
-//         //METIS
-//         SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::BSW, MetisPartitioner::KWAY));
-//         ////////////////////////////////////////////
-//         /////delete solid blocks
-//         if (myid == 0) UBLOG(logINFO, "deleteSolidBlocks - start");
-//         InteractorsHelper intHelper(grid, metisVisitor);
-//         intHelper.addInteractor(addWallZminInt);
-//         intHelper.addInteractor(addWallZmaxInt);
-//         intHelper.selectBlocks();
-//         if (myid == 0) UBLOG(logINFO, "deleteSolidBlocks - end");
-//         //////////////////////////////////////
-//
-//         //set connectors
-//         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
-//         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
-//         grid->accept(setConnsVisitor);
-//
-//         //domain decomposition for threads
-//         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
-//         grid->accept(pqPartVisitor);
-//
-//         WriteBlocksSPtr<CoProcessor> ppblocks(new WriteBlocksCoProcessor(grid, SPtr<UbScheduler>(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm));
-//         ppblocks->process(0);
-//         ppblocks.reset();
-//
-//         unsigned long nob = grid->getNumberOfBlocks();
-//         int gl = 3;
-//         unsigned long nodb = (blocknx1) * (blocknx2) * (blocknx3);
-//         unsigned long nod = nob * (blocknx1) * (blocknx2) * (blocknx3);
-//         unsigned long nodg = nob * (blocknx1 + gl) * (blocknx2 + gl) * (blocknx3 + gl);
-//         double needMemAll = double(nodg*(27 * sizeof(double) + sizeof(int) + sizeof(float) * 4));
-//         double needMem = needMemAll / double(comm->getNumberOfProcesses());
-//
-//         if (myid == 0)
-//         {
-//            UBLOG(logINFO, "Number of blocks = " << nob);
-//            UBLOG(logINFO, "Number of nodes  = " << nod);
-//            int minInitLevel = grid->getCoarsestInitializedLevel();
-//            int maxInitLevel = grid->getFinestInitializedLevel();
-//            for (int level = minInitLevel; level <= maxInitLevel; level++)
-//            {
-//               int nobl = grid->getNumberOfBlocks(level);
-//               UBLOG(logINFO, "Number of blocks for level " << level << " = " << nob);
-//               UBLOG(logINFO, "Number of nodes for level " << level << " = " << nob*nodb);
-//            }
-//            UBLOG(logINFO, "Necessary memory  = " << needMemAll << " bytes");
-//            UBLOG(logINFO, "Necessary memory per process = " << needMem << " bytes");
-//            UBLOG(logINFO, "Available memory per process = " << availMem << " bytes");
-//         }
-//
-//         LBMKernel3DPtr kernel = LBMKernel3DPtr(new LBMKernelETD3Q27CCLB(blocknx[0], blocknx[1], blocknx[2], LBMKernelETD3Q27CCLB::NORMAL));
-//
-//         mu::Parser fctForcingX1;
-//         fctForcingX1.SetExpr("Fx1");
-//         fctForcingX1.DefineConst("Fx1", forcing);
-//
-//         kernel->setWithForcing(true);
-//         kernel->setForcingX1(fctForcingX1);
-//
-//         SPtr<BCProcessor> bcProc;
-//         BoundaryConditionPtr noSlipBC;
-//
-//         if (thinWall)
-//         {
-//            bcProc = SPtr<BCProcessor>(new D3Q27ETForThinWallBCProcessor());
-//            noSlipBC = BoundaryConditionPtr(new ThinWallNoSlipBoundaryCondition());
-//         }
-//         else
-//         {
-//            bcProc = SPtr<BCProcessor>(new D3Q27ETBCProcessor());
-//            noSlipBC = BoundaryConditionPtr(new NoSlipBoundaryCondition());
-//         }
-//
-//         bcProc->addBC(noSlipBC);
-//
-//         kernel->setBCProcessor(bcProc);
-//
-//         SetKernelBlockVisitor kernelVisitor(kernel, nuLB, availMem, needMem);
-//         grid->accept(kernelVisitor);
-//
-//         //////////////////////////////////
-//         //undef nodes for refinement
-//         if (refineLevel > 0)
-//         {
-//            D3Q27SetUndefinedNodesBlockVisitor undefNodesVisitor;
-//            grid->accept(undefNodesVisitor);
-//         }
-//
-//         //BC
-//         intHelper.setBC();
-//         BoundaryConditionBlockVisitor bcVisitor;
-//         grid->accept(bcVisitor);
-//
-//         //initialization of distributions
-//         D3Q27ETInitDistributionsBlockVisitor initVisitor(nuLB, rhoLB);
-//         grid->accept(initVisitor);
-//
-//         //Postrozess
-//         SPtr<UbScheduler> geoSch(new UbScheduler(1));
-//         MacroscopicQuantitiesSPtr<CoProcessor> ppgeo(
-//            new MacroscopicQuantitiesCoProcessor(grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, true));
-//         ppgeo->process(0);
-//         ppgeo.reset();
-//
-//         if (myid == 0) UBLOG(logINFO, "Preprozess - end");
-//      }
-//      else
-//      {
-//         mu::Parser fctForcingX1;
-//         mu::Parser fctForcingX2;
-//         mu::Parser fctForcingX3;
-//         fctForcingX1.SetExpr("Fx1");
-//         fctForcingX1.DefineConst("Fx1", forcing);
-//         fctForcingX2.SetExpr("0.0");
-//         fctForcingX3.SetExpr("0.0");
-//
-//         SetForcingBlockVisitor forcingVisitor(fctForcingX1, fctForcingX2, fctForcingX3);
-//         grid->accept(forcingVisitor);
-//
-//         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
-//         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
-//         grid->accept(setConnsVisitor);
-//
-//         //domain decomposition for threads
-//         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
-//         grid->accept(pqPartVisitor);
-//      }
-//
-//      SPtr<UbScheduler> nupsSch(new UbScheduler(10, 30, 100));
-//      NUPSCounterCoProcessor npr(grid, nupsSch, numOfThreads, comm);
-//
-//      SPtr<UbScheduler> stepSch(new UbScheduler(outTime));
-//
-//      MacroscopicQuantitiesCoProcessor pp(grid, stepSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv);
-//
-//      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, stepSch));
-//      if (myid == 0) UBLOG(logINFO, "Simulation-start");
-//      calculation->calculate();
-//      if (myid == 0) UBLOG(logINFO, "Simulation-end");
-//   }
-//   catch (std::exception& e)
-//   {
-//      cerr << e.what() << endl << flush;
-//   }
-//   catch (std::string& s)
-//   {
-//      cerr << s << endl;
-//   }
-//   catch (...)
-//   {
-//      cerr << "unknown exception" << endl;
-//   }
-//
-//}
-//////////////////////////////////////////////////////////////////////////
-void pflowdp(string configname)
-{
-   try
-   {
-      ConfigurationFile   config;
-      config.load(configname);
-
-      string          pathname = config.getValue<string>("pathname");
-      int             numOfThreads = config.getValue<int>("numOfThreads");
-      vector<int>     blocknx = config.getVector<int>("blocknx");
-      vector<double>  boundingBox = config.getVector<double>("boundingBox");
-      double          nuLB = config.getValue<double>("nuLB");
-      double          endTime = config.getValue<double>("endTime");
-      double          outTime = config.getValue<double>("outTime");
-      double          availMem = config.getValue<double>("availMem");
-      int             refineLevel = config.getValue<int>("refineLevel");
-      bool            logToFile = config.getValue<bool>("logToFile");
-      double          restartStep = config.getValue<double>("restartStep");
-      double          dpLB = config.getValue<double>("dpLB");
-      bool            thinWall = config.getValue<bool>("thinWall");
-      double          deltax = config.getValue<double>("deltax");
-      double          cpStep = config.getValue<double>("cpStep");
-      double          cpStepStart = config.getValue<double>("cpStepStart");
-      bool            newStart = config.getValue<bool>("newStart");
-
-      SPtr<Communicator> comm = MPICommunicator::getInstance();
-      int myid = comm->getProcessID();
-
-      LBMReal rhoLB = 0.0;
-      double rhoLBinflow = dpLB * 3.0;
-
-      SPtr<LBMUnitConverter> conv = SPtr<LBMUnitConverter>(new LBMUnitConverter());
-
-      const int baseLevel = 0;
-
-      //bounding box
-      double g_minX1 = 0;
-      double g_minX2 = 0;
-      double g_minX3 = 0;
-
-      double g_maxX1 = boundingBox[0];
-      double g_maxX2 = boundingBox[1];
-      double g_maxX3 = boundingBox[2];
-
-      double blockLength = 3.0 * deltax;
-
-      double h = (g_maxX2) / 2.0;
-      double dex = g_maxX1;
-      double Umax = (1.0 / (4.0 * nuLB)) * (dpLB / dex) * (h * h);
-      double Re = (4 * h * Umax) / (3 * nuLB);
-
-      //bc
-      LBMReal uLB = 0.01;
-      mu::Parser fct;
-      fct.SetExpr("U");
-      fct.DefineConst("U", uLB);
-      SPtr<BCAdapter> denBCAdapterInflow(new VelocityBCAdapter(true, false, false, fct, 0, BCFunction::INFCONST));
-      //denBCAdapterInflow->setBcAlgorithm(SPtr<BCAlgorithm>(new VelocityWithDensityBCAlgorithm()));
-      denBCAdapterInflow->setBcAlgorithm(SPtr<BCAlgorithm>(new VelocityBCAlgorithm()));
-
-      //SPtr<BCAdapter> denBCAdapterOutflow(new DensityBCAdapter(rhoLB));
-      //denBCAdapterOutflow->setBcAlgorithm(SPtr<BCAlgorithm>(new NonReflectingOutflowBCAlgorithm()));
-      ////denBCAdapterOutflow->setBcAlgorithm(SPtr<BCAlgorithm>(new NonEqDensityBCAlgorithm()));
-
-      //SPtr<BCAdapter> slipBCAdapter(new SlipBCAdapter());
-      ////slipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NonReflectingSlipBCAlgorithm()));
-      //slipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new SlipBCAlgorithm()));
-      //
-
-      //SPtr<BCAdapter> noSlipBCAdapter(new NoSlipBCAdapter());
-      //noSlipBCAdapter->setBcAlgorithm(NoSlipSPtr<BCAlgorithm>(new NoSlipBCAlgorithm()));
-
-      //BoundaryConditionsBlockVisitor bcVisitor;
-      //bcVisitor.addBC(noSlipBCAdapter);
-      //bcVisitor.addBC(slipBCAdapter);
-      //bcVisitor.addBC(denBCAdapterInflow);
-      //bcVisitor.addBC(denBCAdapterOutflow);
-
-
-
-      SPtr<BCAdapter> noSlipBCAdapter(new NoSlipBCAdapter());
-      noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NoSlipBCAlgorithm()));
-
-      //SPtr<BCAdapter> denBCAdapterInflow(new DensityBCAdapter(rhoLBinflow));
-      //denBCAdapterInflow->setBcAlgorithm(SPtr<BCAlgorithm>(new NonEqDensityBCAlgorithm()));
-
-      SPtr<BCAdapter> denBCAdapterOutflow(new DensityBCAdapter(rhoLB));
-      denBCAdapterOutflow->setBcAlgorithm(SPtr<BCAlgorithm>(new NonEqDensityBCAlgorithm()));
-
-      //BS visitor
-      BoundaryConditionsBlockVisitor bcVisitor;
-      bcVisitor.addBC(noSlipBCAdapter);
-      bcVisitor.addBC(denBCAdapterInflow);
-      bcVisitor.addBC(denBCAdapterOutflow);
-
-      SPtr<Grid3D> grid(new Grid3D(comm));
-      grid->setPeriodicX1(false);
-      grid->setPeriodicX2(true);
-      grid->setPeriodicX3(false);
-      grid->setDeltaX(deltax);
-      grid->setBlockNX(blocknx[0], blocknx[1], blocknx[2]);
-
-      SPtr<GbObject3D> gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
-      if (myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), pathname + "/geo/gridCube", WbWriterVtkXmlBinary::getInstance());
-
-      double k1 = 4;
-      double k2 = 8;
-
-      SPtr<GbObject3D> refineCube1_1(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2 / k1 - 1.0, g_maxX3));
-      if (myid == 0) GbSystem3D::writeGeoObject(refineCube1_1.get(), pathname + "/geo/refineCube1_1", WbWriterVtkXmlBinary::getInstance());
-
-      SPtr<GbObject3D> refineCube1_2(new GbCuboid3D(g_minX1, g_maxX2 - g_maxX2 / k1 + 1.0, g_minX3, g_maxX1, g_maxX2, g_maxX3));
-      if (myid == 0) GbSystem3D::writeGeoObject(refineCube1_2.get(), pathname + "/geo/refineCube1_2", WbWriterVtkXmlBinary::getInstance());
-
-      SPtr<GbObject3D> refineCube2_1(new GbCuboid3D(g_minX1 + 2 * blockLength + 2 * deltax, g_minX2, g_minX3, g_maxX1 - 2 * blockLength - 2 * deltax, g_maxX2 / k2 - 1.0, g_maxX3));
-      if (myid == 0) GbSystem3D::writeGeoObject(refineCube2_1.get(), pathname + "/geo/refineCube2_1", WbWriterVtkXmlBinary::getInstance());
-
-      SPtr<GbObject3D> refineCube2_2(new GbCuboid3D(g_minX1 + 2 * blockLength + 2 * deltax, g_maxX2 - g_maxX2 / k2 + 1.0, g_minX3, g_maxX1 - 2 * blockLength - 2 * deltax, g_maxX2, g_maxX3));
-      if (myid == 0) GbSystem3D::writeGeoObject(refineCube2_2.get(), pathname + "/geo/refineCube2_2", WbWriterVtkXmlBinary::getInstance());
-
-      SPtr<GbObject3D> refineCube2_3(new GbCuboid3D(g_minX1 + blockLength + 2 * deltax, g_minX2 + blockLength + 2 * deltax, g_minX3 + blockLength + 2 * deltax, g_maxX1 - blockLength - 2 * deltax, g_maxX2 - blockLength - 2 * deltax, g_maxX3 - blockLength - 2 * deltax));
-      if (myid == 0) GbSystem3D::writeGeoObject(refineCube2_3.get(), pathname + "/geo/refineCube2_3", WbWriterVtkXmlBinary::getInstance());
-
-      //////////////////////////////////////////////////////////////////////////
-      //restart
-      //SPtr<UbScheduler> rSch(new UbScheduler(restartStep));
-      //RestartCoProcessor rp(grid, rSch, comm, pathname, RestartCoProcessor::TXT);
-
-      //SPtr<UbScheduler> rSch2(new UbScheduler(cpStep, cpStepStart));
-      //MPIIORestart1CoProcessor rcp(grid, rSch2, pathname, comm);
-
-      SPtr<LBMKernel> kernel;
-      kernel = SPtr<LBMKernel>(new IncompressibleCumulantLBMKernel());
-
-      SPtr<BCProcessor> bcProc(new BCProcessor());
-      //SPtr<BCProcessor> bcProc = SPtr<BCProcessor>(new ThinWallBCProcessor());
-      kernel->setBCProcessor(bcProc);
-
-      //rcp.setLBMKernel(kernel);
-      //rcp.setBCProcessor(bcProc);
-      //rcp.setChunk(1);
-      //////////////////////////////////////////////////////////////////////////
-
-      if (newStart)
-      {
-         GenBlocksGridVisitor genBlocks(gridCube);
-         grid->accept(genBlocks);
-
-         if (myid == 0)
-         {
-            UBLOG(logINFO, "Parameters:");
-            UBLOG(logINFO, "h = " << h);
-            UBLOG(logINFO, "rho = " << rhoLB);
-            UBLOG(logINFO, "nue = " << nuLB);
-            UBLOG(logINFO, "Re = " << Re);
-            UBLOG(logINFO, "dx = " << deltax);
-            UBLOG(logINFO, "dpLB = " << dpLB);
-            UBLOG(logINFO, "Umax = " << Umax);
-            UBLOG(logINFO, "number of levels = " << refineLevel + 1);
-            UBLOG(logINFO, "numOfThreads = " << numOfThreads);
-            UBLOG(logINFO, "path = " << pathname);
-            UBLOG(logINFO, "Preprozess - start");
-         }
-
-         //walls
-         GbCuboid3DPtr addWallYmin(new GbCuboid3D(g_minX1 - blockLength, g_minX2 - blockLength, g_minX3 - blockLength, g_maxX1 + blockLength, g_minX2, g_maxX3 + blockLength));
-         if (myid == 0) GbSystem3D::writeGeoObject(addWallYmin.get(), pathname + "/geo/addWallYmin", WbWriterVtkXmlASCII::getInstance());
-
-         GbCuboid3DPtr addWallYmax(new GbCuboid3D(g_minX1 - blockLength, g_maxX2, g_minX3 - blockLength, g_maxX1 + blockLength, g_maxX2 + blockLength, g_maxX3 + blockLength));
-         if (myid == 0) GbSystem3D::writeGeoObject(addWallYmax.get(), pathname + "/geo/addWallYmax", WbWriterVtkXmlASCII::getInstance());
-
-         GbCuboid3DPtr addWallZmin(new GbCuboid3D(g_minX1 - blockLength, g_minX2 - blockLength, g_minX3 - blockLength, g_maxX1 + blockLength, g_maxX2 + blockLength, g_minX3));
-         if (myid == 0) GbSystem3D::writeGeoObject(addWallZmin.get(), pathname + "/geo/addWallZmin", WbWriterVtkXmlASCII::getInstance());
-
-         GbCuboid3DPtr addWallZmax(new GbCuboid3D(g_minX1 - blockLength, g_minX2 - blockLength, g_maxX3, g_maxX1 + blockLength, g_maxX2 + blockLength, g_maxX3 + blockLength));
-         if (myid == 0) GbSystem3D::writeGeoObject(addWallZmax.get(), pathname + "/geo/addWallZmax", WbWriterVtkXmlASCII::getInstance());
-
-
-         //GbCuboid3DPtr addWallXmax(new GbCuboid3D(g_maxX1-4.0*deltax, g_maxX2, g_minX3 - 4.0*blockLength, g_maxX1 + 4.0*blockLength, g_maxX2 + 4.0*blockLength, g_maxX3 + 4.0*blockLength));
-         //if (myid == 0) GbSystem3D::writeGeoObject(addWallXmax.get(), pathname+"/geo/addWallXmax", WbWriterVtkXmlASCII::getInstance());
-
-         //inflow
-         GbCuboid3DPtr geoInflow(new GbCuboid3D(g_minX1 - blockLength, g_minX2 - blockLength, g_minX3 - blockLength, g_minX1, g_maxX2 + blockLength, g_maxX3 + blockLength));
-         if (myid == 0) GbSystem3D::writeGeoObject(geoInflow.get(), pathname + "/geo/geoInflow", WbWriterVtkXmlASCII::getInstance());
-
-         //outflow
-         GbCuboid3DPtr geoOutflow(new GbCuboid3D(g_maxX1, g_minX2 - blockLength, g_minX3 - blockLength, g_maxX1 + blockLength, g_maxX2 + blockLength, g_maxX3 + blockLength));
-         if (myid == 0) GbSystem3D::writeGeoObject(geoOutflow.get(), pathname + "/geo/geoOutflow", WbWriterVtkXmlASCII::getInstance());
-
-         //GbCuboid3DPtr geoOutflowSolid(new GbCuboid3D(g_maxX1-1.0*deltax, g_minX2 - 4.0*blockLength, g_minX3 - 4.0*blockLength, g_maxX1 + 4.0*blockLength, g_maxX2+4.0*blockLength, g_maxX3 + 4.0*blockLength));
-         //if (myid == 0) GbSystem3D::writeGeoObject(geoOutflowSolid.get(), pathname + "/geo/geoOutflowSolid", WbWriterVtkXmlASCII::getInstance());
-
-         ////inflow
-         //GbCuboid3DPtr geoInflow (new GbCuboid3D(g_minX1-4.0*blockLength, g_minX2-4.0*blockLength, g_minX3-4.0*blockLength, g_maxX1+4.0*blockLength, g_maxX2+4.0*blockLength, g_minX3));
-         //if(myid == 0) GbSystem3D::writeGeoObject(geoInflow.get(), pathname+"/geo/geoInflow", WbWriterVtkXmlASCII::getInstance());
-
-         ////outflow
-         //GbCuboid3DPtr geoOutflow (new GbCuboid3D(g_minX1-4.0*blockLength, g_minX2-4.0*blockLength, g_maxX3, g_maxX1+4.0*blockLength, g_maxX2+4.0*blockLength, g_maxX3+4.0*blockLength));
-         //if(myid == 0) GbSystem3D::writeGeoObject(geoOutflow.get(), pathname+"/geo/geoOutflow", WbWriterVtkXmlASCII::getInstance());
-
-         SPtr<CoProcessor> ppblocks(new WriteBlocksCoProcessor(grid, SPtr<UbScheduler>(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm));
-
-         if (refineLevel > 0)
-         {
-            if (myid == 0) UBLOG(logINFO, "Refinement - start");
-            RefineCrossAndInsideGbObjectHelper refineHelper(grid, refineLevel, comm);
-            //refineHelper.addGbObject(refineCube1_1, 1);
-            //refineHelper.addGbObject(refineCube1_2, 1);
-            //refineHelper.addGbObject(refineCube2_1, 2);
-            //refineHelper.addGbObject(refineCube2_2, 2);
-            refineHelper.addGbObject(refineCube2_3, refineLevel);
-            refineHelper.refine();
-            if (myid == 0) UBLOG(logINFO, "Refinement - end");
-         }
-
-         //walls
-         SPtr<D3Q27Interactor> addWallYminInt(new D3Q27Interactor(addWallYmin, grid, noSlipBCAdapter, Interactor3D::SOLID));
-         SPtr<D3Q27Interactor> addWallYmaxInt(new D3Q27Interactor(addWallYmax, grid, noSlipBCAdapter, Interactor3D::SOLID));
-
-         SPtr<D3Q27Interactor> addWallZminInt(new D3Q27Interactor(addWallZmin, grid, noSlipBCAdapter, Interactor3D::SOLID));
-         SPtr<D3Q27Interactor> addWallZmaxInt(new D3Q27Interactor(addWallZmax, grid, noSlipBCAdapter, Interactor3D::SOLID));
-
-         //SPtr<D3Q27Interactor> addWallXmaxInt(new D3Q27Interactor(addWallXmax, grid, denBCAdapterOutflow,Interactor3D::SOLID));
-
-         SPtr<D3Q27Interactor> inflowInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoInflow, grid, denBCAdapterInflow, Interactor3D::SOLID));
-
-         //outflow
-         SPtr<D3Q27Interactor> outflowInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoOutflow, grid, denBCAdapterOutflow, Interactor3D::SOLID));
-         //SPtr<D3Q27Interactor> outflowSolidInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoOutflow, grid, noSlipBCAdapter, Interactor3D::SOLID));
-
-         ////////////////////////////////////////////
-         //METIS
-         SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B));
-         ////////////////////////////////////////////
-         /////delete solid blocks
-         if (myid == 0) UBLOG(logINFO, "deleteSolidBlocks - start");
-         InteractorsHelper intHelper(grid, metisVisitor);
-
-         //intHelper.addInteractor(addWallYminInt);
-         //intHelper.addInteractor(addWallYmaxInt);
-         intHelper.addInteractor(addWallZminInt);
-         intHelper.addInteractor(addWallZmaxInt);
-
-         intHelper.addInteractor(inflowInt);
-
-         intHelper.addInteractor(outflowInt);
-
-         //die Geschwindigkeit Randbedingung soll Ausflüß überdecken !!!!!
-
-
-
-         intHelper.selectBlocks();
-         if (myid == 0) UBLOG(logINFO, "deleteSolidBlocks - end");
-         //////////////////////////////////////
-
-         //set connectors
-         //InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor());
-         InterpolationProcessorPtr iProcessor(new CompressibleOffsetInterpolationProcessor());
-         SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
-         grid->accept(setConnsVisitor);
-
-         //domain decomposition for threads
-         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
-         grid->accept(pqPartVisitor);
-
-         ppblocks->process(0);
-         ppblocks.reset();
-
-         unsigned long nob = grid->getNumberOfBlocks();
-         int gl = 3;
-         unsigned long nodb = (blocknx[0]) * (blocknx[1]) * (blocknx[2]);
-         unsigned long nod = nob * (blocknx[0]) * (blocknx[1]) * (blocknx[2]);
-         unsigned long nodg = nob * (blocknx[0] + gl) * (blocknx[1] + gl) * (blocknx[1] + gl);
-         double needMemAll = double(nodg * (27 * sizeof(double) + sizeof(int) + sizeof(float) * 4));
-         double needMem = needMemAll / double(comm->getNumberOfProcesses());
-
-         if (myid == 0)
-         {
-            UBLOG(logINFO, "Number of blocks = " << nob);
-            UBLOG(logINFO, "Number of nodes  = " << nod);
-            int minInitLevel = grid->getCoarsestInitializedLevel();
-            int maxInitLevel = grid->getFinestInitializedLevel();
-            for (int level = minInitLevel; level <= maxInitLevel; level++)
-            {
-               int nobl = grid->getNumberOfBlocks(level);
-               UBLOG(logINFO, "Number of blocks for level " << level << " = " << nobl);
-               UBLOG(logINFO, "Number of nodes for level " << level << " = " << nobl * nodb);
-            }
-            UBLOG(logINFO, "Necessary memory  = " << needMemAll << " bytes");
-            UBLOG(logINFO, "Necessary memory per process = " << needMem << " bytes");
-            UBLOG(logINFO, "Available memory per process = " << availMem << " bytes");
-         }
-
-         //SPtr<LBMKernel> kernel;
-         //kernel = SPtr<LBMKernel>(new IncompressibleCumulantLBMKernel(blocknx[0], blocknx[1], blocknx[2], IncompressibleCumulantLBMKernel::NORMAL));
-         //kernel = SPtr<LBMKernel>(new CompressibleCumulantLBMKernel(blocknx[0], blocknx[1], blocknx[2], CompressibleCumulantLBMKernel::NORMAL));
-         //}
-         //kernel->setWithForcing(true);
-         //kernel->setForcingX1(2e-6);
-         //SPtr<BCProcessor> bcProc(new BCProcessor());
-         //kernel->setBCProcessor(bcProc);
-
-         SetKernelBlockVisitor kernelVisitor(kernel, nuLB, availMem, needMem);
-         grid->accept(kernelVisitor);
-
-         if (refineLevel > 0)
-         {
-            SetUndefinedNodesBlockVisitor undefNodesVisitor;
-            grid->accept(undefNodesVisitor);
-         }
-
-         //walls
-         intHelper.setBC();
-
-         grid->accept(bcVisitor);
-
-
-         //initialization of distributions
-         //mu::Parser fct;
-         //fct.SetExpr("-(1.0/(2.0*nu))*(dp/dx)*((x2-h)^2 - h^2)");
-         //fct.DefineConst("dp", dpLB);
-         //fct.DefineConst("dx", dex);
-         //fct.DefineConst("h", h);
-         //fct.DefineConst("nu", nuLB);
-
-         mu::Parser fct;
-         fct.SetExpr("(x1max-x1)/l*dp*3.0");
-         fct.DefineConst("dp", dpLB);
-         fct.DefineConst("x1max", g_maxX1);
-         fct.DefineConst("l", g_maxX1 - g_minX1);
-
-         InitDistributionsBlockVisitor initVisitor;
-         //initVisitor.setVx1(fct);
-         //initVisitor.setVx1(uLB);
-         //initVisitor.setVx3(fct);
-         //initVisitor.setRho(fct);
-         grid->accept(initVisitor);
-
-         //Postrozess
-         SPtr<UbScheduler> geoSch(new UbScheduler(1));
-         SPtr<CoProcessor> ppgeo(
-            new WriteBoundaryConditionsCoProcessor(grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), comm));
-         ppgeo->process(0);
-         ppgeo.reset();
-
-         if (myid == 0) UBLOG(logINFO, "Preprozess - end");
-      }
-      else
-      {
-         //rcp.readBlocks(restartStep);
-         //SPtr<Grid3DVisitor> newMetisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::BSW, MetisPartitioner::KWAY));
-         //grid->accept(newMetisVisitor);
-         //rcp.readDataSet(restartStep);
-         //rcp.readBoundaryConds(restartStep);
-
-         //rcp.restart((int)restartStep);
-
-         grid->setTimeStep(restartStep);
-
-         //set connectors
-         InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor());
-         SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
-         grid->accept(setConnsVisitor);
-
-         grid->accept(bcVisitor);
-
-         SPtr<UbScheduler> geoSch(new UbScheduler(1));
-         WriteBoundaryConditionsCoProcessor ppgeo = WriteBoundaryConditionsCoProcessor(grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), comm);
-         ppgeo.process(1);
-
-         if (myid == 0) UBLOG(logINFO, "Restart - end");
-      }
-      SPtr<UbScheduler> nupsSch(new UbScheduler(10, 30, 100));
-      SPtr<CoProcessor> npr(new NUPSCounterCoProcessor (grid, nupsSch, numOfThreads, comm));
-
-      //write data for visualization of macroscopic quantities
-      SPtr<UbScheduler> visSch(new UbScheduler(outTime));
-      SPtr<WriteMacroscopicQuantitiesCoProcessor> writeMQCoProcessor(new WriteMacroscopicQuantitiesCoProcessor(grid, visSch, pathname, 
-      WbWriterVtkXmlASCII::getInstance(), SPtr<LBMUnitConverter>(new LBMUnitConverter()), comm));
-
-      SPtr<UbScheduler> AdjForcSch(new UbScheduler());
-      AdjForcSch->addSchedule(10, 0, 10000000);
-      SPtr<IntegrateValuesHelper> intValHelp(new IntegrateValuesHelper(grid, comm,
-         g_minX1, g_minX2, g_minX3,
-         g_maxX1, g_maxX2, g_maxX3));
-      if (myid == 0) GbSystem3D::writeGeoObject(intValHelp->getBoundingBox().get(), pathname + "/geo/IntValHelp", WbWriterVtkXmlBinary::getInstance());
-
-      double vxTarget = uLB;
-      AdjustForcingCoProcessor AdjForcPPPtr(grid, AdjForcSch, pathname, intValHelp, vxTarget, comm);
-
-      //start simulation 
-      //omp_set_num_threads(numOfThreads);
-      SPtr<UbScheduler> stepGhostLayer(new UbScheduler(outTime));
-      SPtr<Calculator> calculator(new BasicCalculator(grid, stepGhostLayer, endTime));
-      calculator->addCoProcessor(npr);
-      calculator->addCoProcessor(writeMQCoProcessor);
-      //calculator->addCoProcessor(migCoProcessor);
-      //calculator->addCoProcessor(restartCoProcessor);
-
-      if (myid == 0) UBLOG(logINFO, "Simulation-start");
-      calculator->calculate();
-      if (myid == 0) UBLOG(logINFO, "Simulation-end");
-   }
-   catch (std::exception & e)
-   {
-      cerr << e.what() << endl << flush;
-   }
-   catch (std::string & s)
-   {
-      cerr << s << endl;
-   }
-   catch (...)
-   {
-      cerr << "unknown exception" << endl;
-   }
-
-}
-//////////////////////////////////////////////////////////////////////////
-int main(int argc, char* argv[])
-{
-   if (argv != NULL)
-   {
-      if (argv[1] != NULL)
-      {
-         //pflowForcing(string(argv[1]));
-         pflowdp(string(argv[1]));
-      }
-      else
-      {
-         cout << "Configuration file is missing!" << endl;
-      }
-   }
-
-   return 0;
-}
+#include <iostream>
+#include <string>
+
+#include <VirtualFluids.h>
+
+using namespace std;
+
+
+//void pflowForcing(string configname)
+//{
+//   try
+//   {
+//      ConfigurationFile   config;
+//      config.load(configname);
+//
+//      string          pathname = config.getString("pathname");
+//      int             numOfThreads = config.getInt("numOfThreads");
+//      vector<int>     blocknx = config.getVector<int>("blocknx");
+//      vector<double>  gridnx = config.getVector<double>("gridnx");
+//      double          nuLB = config.getDouble("nuLB");
+//      double          endTime = config.getDouble("endTime");
+//      double          outTime = config.getDouble("outTime");
+//      double          availMem = config.getDouble("availMem");
+//      int             refineLevel = config.getInt("refineLevel");
+//      bool            logToFile = config.getBool("logToFile");
+//      double          restartStep = config.getDouble("restartStep");
+//      double          forcing = config.getDouble("forcing");
+//      bool            thinWall = config.getBool("thinWall");
+//      double          deltax = config.getDouble("deltax");
+//
+//
+//      SPtr<Communicator> comm = MPICommunicator::getInstance();
+//      int myid = comm->getProcessID();
+//
+//      if (logToFile)
+//      {
+//#if defined(__unix__)
+//         if (myid == 0)
+//         {
+//            const char* str = pathname.c_str();
+//            mkdir(str, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
+//         }
+//#endif 
+//
+//         if (myid == 0)
+//         {
+//            stringstream logFilename;
+//            logFilename << pathname + "/logfile" + UbSystem::toString(UbSystem::getTimeStamp()) + ".txt";
+//            UbLog::output_policy::setStream(logFilename.str());
+//         }
+//      }
+//
+//      double dx = deltax;
+//
+//      const int blocknx1 = blocknx[0];
+//      const int blocknx2 = blocknx[1];
+//      const int blocknx3 = blocknx[2];
+//
+//      LBMReal rhoLB = 0.0;
+//
+//      SPtr<LBMUnitConverter> conv = SPtr<LBMUnitConverter>(new LBMUnitConverter());
+//
+//      const int baseLevel = 0;
+//
+//      //bounding box
+//      double g_minX1 = 0;
+//      double g_minX2 = 0;
+//      double g_minX3 = 0;
+//
+//      double g_maxX1 = gridnx[0];
+//      double g_maxX2 = gridnx[1];
+//      double g_maxX3 = gridnx[2];
+//
+//      double blockLength = blocknx1*dx;
+//
+//      SPtr<Grid3D> grid(new Grid3D(comm));
+//      grid->setPeriodicX1(true);
+//      grid->setPeriodicX2(true);
+//      grid->setPeriodicX3(false);
+//      grid->setDeltaX(dx);
+//      grid->setBlockNX(blocknx1, blocknx2, blocknx3);
+//
+//      SPtr<GbObject3D> gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
+//      if (myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), pathname + "/geo/gridCube", WbWriterVtkXmlBinary::getInstance());
+//
+//      //////////////////////////////////////////////////////////////////////////
+//      //restart
+//      SPtr<UbScheduler> rSch(new UbScheduler(restartStep, restartStep));
+//      RestartCoProcessor rp(grid, rSch, comm, pathname, RestartCoProcessor::TXT);
+//      //////////////////////////////////////////////////////////////////////////
+//
+//      if (grid->getTimeStep() == 0)
+//      {
+//         GenBlocksGridVisitor genBlocks(gridCube);
+//         grid->accept(genBlocks);
+//
+//         if (myid == 0)
+//         {
+//            UBLOG(logINFO, "Parameters:");
+//            UBLOG(logINFO, "forcing = " << forcing);
+//            UBLOG(logINFO, "rho = " << rhoLB);
+//            UBLOG(logINFO, "nu = " << nuLB);
+//            UBLOG(logINFO, "dx = " << dx);
+//            UBLOG(logINFO, "number of levels = " << refineLevel + 1);
+//            UBLOG(logINFO, "numOfThreads = " << numOfThreads);
+//            UBLOG(logINFO, "Preprozess - start");
+//         }
+//
+//         //////////////////////////////////////////////////////////////////////////
+//         //refinement
+//         double blockLengthX3Fine = grid->getDeltaX(refineLevel) * blocknx[2];
+//
+//         GbCuboid3DPtr refineBoxTop(new GbCuboid3D(g_minX1 - blockLength, g_minX2 - blockLength, g_maxX3 - blockLengthX3Fine, g_maxX1 + blockLength, g_maxX2 + blockLength, g_maxX3 + blockLength));
+//         if (myid == 0) GbSystem3D::writeGeoObject(refineBoxTop.get(), pathname + "/geo/refineBoxTop", WbWriterVtkXmlASCII::getInstance());
+//
+//         //GbCuboid3DPtr refineBoxBottom(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3, g_maxX1+blockLength, g_maxX2+blockLength, g_minX3+offsetMinX3+blockLengthX3Fine));
+//         GbCuboid3DPtr refineBoxBottom(new GbCuboid3D(g_minX1 - blockLength, g_minX2 - blockLength, g_minX3 - blockLengthX3Fine, g_maxX1 + blockLength, g_maxX2 + blockLength, g_minX3 + blockLengthX3Fine));
+//         if (myid == 0) GbSystem3D::writeGeoObject(refineBoxBottom.get(), pathname + "/geo/refineBoxBottom", WbWriterVtkXmlASCII::getInstance());
+//
+//         if (refineLevel > 0)
+//         {
+//            if (myid == 0) UBLOG(logINFO, "Refinement - start");
+//            RefineCrossAndInsideGbObjectHelper refineHelper(grid, refineLevel);
+//            refineHelper.addGbObject(refineBoxTop, refineLevel);
+//            refineHelper.addGbObject(refineBoxBottom, refineLevel);
+//            refineHelper.refine();
+//            if (myid == 0) UBLOG(logINFO, "Refinement - end");
+//         }
+//         //////////////////////////////////////////////////////////////////////////
+//
+//         //walls
+//         GbCuboid3DPtr addWallZmin(new GbCuboid3D(g_minX1 - blockLength, g_minX2 - blockLength, g_minX3 - blockLength, g_maxX1 + blockLength, g_maxX2 + blockLength, g_minX3));
+//         if (myid == 0) GbSystem3D::writeGeoObject(addWallZmin.get(), pathname + "/geo/addWallZmin", WbWriterVtkXmlASCII::getInstance());
+//
+//         GbCuboid3DPtr addWallZmax(new GbCuboid3D(g_minX1 - blockLength, g_minX2 - blockLength, g_maxX3, g_maxX1 + blockLength, g_maxX2 + blockLength, g_maxX3 + blockLength));
+//         if (myid == 0) GbSystem3D::writeGeoObject(addWallZmax.get(), pathname + "/geo/addWallZmax", WbWriterVtkXmlASCII::getInstance());
+//
+//         //wall interactors
+//         int bbOption = 1;
+//         D3Q27BoundaryConditionAdapterPtr bcNoSlip(new D3Q27NoSlipBCAdapter(bbOption));
+//         SPtr<D3Q27Interactor> addWallZminInt(new D3Q27Interactor(addWallZmin, grid, bcNoSlip, Interactor3D::SOLID));
+//         SPtr<D3Q27Interactor> addWallZmaxInt(new D3Q27Interactor(addWallZmax, grid, bcNoSlip, Interactor3D::SOLID));
+//
+//         ////////////////////////////////////////////
+//         //METIS
+//         SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::BSW, MetisPartitioner::KWAY));
+//         ////////////////////////////////////////////
+//         /////delete solid blocks
+//         if (myid == 0) UBLOG(logINFO, "deleteSolidBlocks - start");
+//         InteractorsHelper intHelper(grid, metisVisitor);
+//         intHelper.addInteractor(addWallZminInt);
+//         intHelper.addInteractor(addWallZmaxInt);
+//         intHelper.selectBlocks();
+//         if (myid == 0) UBLOG(logINFO, "deleteSolidBlocks - end");
+//         //////////////////////////////////////
+//
+//         //set connectors
+//         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
+//         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
+//         grid->accept(setConnsVisitor);
+//
+//         //domain decomposition for threads
+//         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
+//         grid->accept(pqPartVisitor);
+//
+//         WriteBlocksSPtr<CoProcessor> ppblocks(new WriteBlocksCoProcessor(grid, SPtr<UbScheduler>(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm));
+//         ppblocks->process(0);
+//         ppblocks.reset();
+//
+//         unsigned long nob = grid->getNumberOfBlocks();
+//         int gl = 3;
+//         unsigned long nodb = (blocknx1) * (blocknx2) * (blocknx3);
+//         unsigned long nod = nob * (blocknx1) * (blocknx2) * (blocknx3);
+//         unsigned long nodg = nob * (blocknx1 + gl) * (blocknx2 + gl) * (blocknx3 + gl);
+//         double needMemAll = double(nodg*(27 * sizeof(double) + sizeof(int) + sizeof(float) * 4));
+//         double needMem = needMemAll / double(comm->getNumberOfProcesses());
+//
+//         if (myid == 0)
+//         {
+//            UBLOG(logINFO, "Number of blocks = " << nob);
+//            UBLOG(logINFO, "Number of nodes  = " << nod);
+//            int minInitLevel = grid->getCoarsestInitializedLevel();
+//            int maxInitLevel = grid->getFinestInitializedLevel();
+//            for (int level = minInitLevel; level <= maxInitLevel; level++)
+//            {
+//               int nobl = grid->getNumberOfBlocks(level);
+//               UBLOG(logINFO, "Number of blocks for level " << level << " = " << nob);
+//               UBLOG(logINFO, "Number of nodes for level " << level << " = " << nob*nodb);
+//            }
+//            UBLOG(logINFO, "Necessary memory  = " << needMemAll << " bytes");
+//            UBLOG(logINFO, "Necessary memory per process = " << needMem << " bytes");
+//            UBLOG(logINFO, "Available memory per process = " << availMem << " bytes");
+//         }
+//
+//         LBMKernel3DPtr kernel = LBMKernel3DPtr(new LBMKernelETD3Q27CCLB(blocknx[0], blocknx[1], blocknx[2], LBMKernelETD3Q27CCLB::NORMAL));
+//
+//         mu::Parser fctForcingX1;
+//         fctForcingX1.SetExpr("Fx1");
+//         fctForcingX1.DefineConst("Fx1", forcing);
+//
+//         kernel->setWithForcing(true);
+//         kernel->setForcingX1(fctForcingX1);
+//
+//         SPtr<BCProcessor> bcProc;
+//         BoundaryConditionPtr noSlipBC;
+//
+//         if (thinWall)
+//         {
+//            bcProc = SPtr<BCProcessor>(new D3Q27ETForThinWallBCProcessor());
+//            noSlipBC = BoundaryConditionPtr(new ThinWallNoSlipBoundaryCondition());
+//         }
+//         else
+//         {
+//            bcProc = SPtr<BCProcessor>(new D3Q27ETBCProcessor());
+//            noSlipBC = BoundaryConditionPtr(new NoSlipBoundaryCondition());
+//         }
+//
+//         bcProc->addBC(noSlipBC);
+//
+//         kernel->setBCProcessor(bcProc);
+//
+//         SetKernelBlockVisitor kernelVisitor(kernel, nuLB, availMem, needMem);
+//         grid->accept(kernelVisitor);
+//
+//         //////////////////////////////////
+//         //undef nodes for refinement
+//         if (refineLevel > 0)
+//         {
+//            D3Q27SetUndefinedNodesBlockVisitor undefNodesVisitor;
+//            grid->accept(undefNodesVisitor);
+//         }
+//
+//         //BC
+//         intHelper.setBC();
+//         BoundaryConditionBlockVisitor bcVisitor;
+//         grid->accept(bcVisitor);
+//
+//         //initialization of distributions
+//         D3Q27ETInitDistributionsBlockVisitor initVisitor(nuLB, rhoLB);
+//         grid->accept(initVisitor);
+//
+//         //Postrozess
+//         SPtr<UbScheduler> geoSch(new UbScheduler(1));
+//         MacroscopicQuantitiesSPtr<CoProcessor> ppgeo(
+//            new MacroscopicQuantitiesCoProcessor(grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, true));
+//         ppgeo->process(0);
+//         ppgeo.reset();
+//
+//         if (myid == 0) UBLOG(logINFO, "Preprozess - end");
+//      }
+//      else
+//      {
+//         mu::Parser fctForcingX1;
+//         mu::Parser fctForcingX2;
+//         mu::Parser fctForcingX3;
+//         fctForcingX1.SetExpr("Fx1");
+//         fctForcingX1.DefineConst("Fx1", forcing);
+//         fctForcingX2.SetExpr("0.0");
+//         fctForcingX3.SetExpr("0.0");
+//
+//         SetForcingBlockVisitor forcingVisitor(fctForcingX1, fctForcingX2, fctForcingX3);
+//         grid->accept(forcingVisitor);
+//
+//         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
+//         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
+//         grid->accept(setConnsVisitor);
+//
+//         //domain decomposition for threads
+//         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
+//         grid->accept(pqPartVisitor);
+//      }
+//
+//      SPtr<UbScheduler> nupsSch(new UbScheduler(10, 30, 100));
+//      NUPSCounterCoProcessor npr(grid, nupsSch, numOfThreads, comm);
+//
+//      SPtr<UbScheduler> stepSch(new UbScheduler(outTime));
+//
+//      MacroscopicQuantitiesCoProcessor pp(grid, stepSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv);
+//
+//      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, stepSch));
+//      if (myid == 0) UBLOG(logINFO, "Simulation-start");
+//      calculation->calculate();
+//      if (myid == 0) UBLOG(logINFO, "Simulation-end");
+//   }
+//   catch (std::exception& e)
+//   {
+//      cerr << e.what() << endl << flush;
+//   }
+//   catch (std::string& s)
+//   {
+//      cerr << s << endl;
+//   }
+//   catch (...)
+//   {
+//      cerr << "unknown exception" << endl;
+//   }
+//
+//}
+//////////////////////////////////////////////////////////////////////////
+void pflowdp(string configname)
+{
+   try
+   {
+      ConfigurationFile   config;
+      config.load(configname);
+
+      string          pathname = config.getValue<string>("pathname");
+      int             numOfThreads = config.getValue<int>("numOfThreads");
+      vector<int>     blocknx = config.getVector<int>("blocknx");
+      vector<double>  boundingBox = config.getVector<double>("boundingBox");
+      double          nuLB = config.getValue<double>("nuLB");
+      double          endTime = config.getValue<double>("endTime");
+      double          outTime = config.getValue<double>("outTime");
+      double          availMem = config.getValue<double>("availMem");
+      int             refineLevel = config.getValue<int>("refineLevel");
+      bool            logToFile = config.getValue<bool>("logToFile");
+      double          restartStep = config.getValue<double>("restartStep");
+      double          dpLB = config.getValue<double>("dpLB");
+      bool            thinWall = config.getValue<bool>("thinWall");
+      double          deltax = config.getValue<double>("deltax");
+      double          cpStep = config.getValue<double>("cpStep");
+      double          cpStepStart = config.getValue<double>("cpStepStart");
+      bool            newStart = config.getValue<bool>("newStart");
+
+      SPtr<Communicator> comm = MPICommunicator::getInstance();
+      int myid = comm->getProcessID();
+
+      LBMReal rhoLB = 0.0;
+      double rhoLBinflow = dpLB * 3.0;
+
+      SPtr<LBMUnitConverter> conv = SPtr<LBMUnitConverter>(new LBMUnitConverter());
+
+      const int baseLevel = 0;
+
+      //bounding box
+      double g_minX1 = 0;
+      double g_minX2 = 0;
+      double g_minX3 = 0;
+
+      double g_maxX1 = boundingBox[0];
+      double g_maxX2 = boundingBox[1];
+      double g_maxX3 = boundingBox[2];
+
+      double blockLength = 3.0 * deltax;
+
+      double h = (g_maxX2) / 2.0;
+      double dex = g_maxX1;
+      double Umax = (1.0 / (4.0 * nuLB)) * (dpLB / dex) * (h * h);
+      double Re = (4 * h * Umax) / (3 * nuLB);
+
+      //bc
+      LBMReal uLB = 0.01;
+      mu::Parser fct;
+      fct.SetExpr("U");
+      fct.DefineConst("U", uLB);
+      SPtr<BCAdapter> denBCAdapterInflow(new VelocityBCAdapter(true, false, false, fct, 0, BCFunction::INFCONST));
+      //denBCAdapterInflow->setBcAlgorithm(SPtr<BCAlgorithm>(new VelocityWithDensityBCAlgorithm()));
+      denBCAdapterInflow->setBcAlgorithm(SPtr<BCAlgorithm>(new VelocityBCAlgorithm()));
+
+      //SPtr<BCAdapter> denBCAdapterOutflow(new DensityBCAdapter(rhoLB));
+      //denBCAdapterOutflow->setBcAlgorithm(SPtr<BCAlgorithm>(new NonReflectingOutflowBCAlgorithm()));
+      ////denBCAdapterOutflow->setBcAlgorithm(SPtr<BCAlgorithm>(new NonEqDensityBCAlgorithm()));
+
+      //SPtr<BCAdapter> slipBCAdapter(new SlipBCAdapter());
+      ////slipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NonReflectingSlipBCAlgorithm()));
+      //slipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new SlipBCAlgorithm()));
+      //
+
+      //SPtr<BCAdapter> noSlipBCAdapter(new NoSlipBCAdapter());
+      //noSlipBCAdapter->setBcAlgorithm(NoSlipSPtr<BCAlgorithm>(new NoSlipBCAlgorithm()));
+
+      //BoundaryConditionsBlockVisitor bcVisitor;
+      //bcVisitor.addBC(noSlipBCAdapter);
+      //bcVisitor.addBC(slipBCAdapter);
+      //bcVisitor.addBC(denBCAdapterInflow);
+      //bcVisitor.addBC(denBCAdapterOutflow);
+
+
+
+      SPtr<BCAdapter> noSlipBCAdapter(new NoSlipBCAdapter());
+      noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NoSlipBCAlgorithm()));
+
+      //SPtr<BCAdapter> denBCAdapterInflow(new DensityBCAdapter(rhoLBinflow));
+      //denBCAdapterInflow->setBcAlgorithm(SPtr<BCAlgorithm>(new NonEqDensityBCAlgorithm()));
+
+      SPtr<BCAdapter> denBCAdapterOutflow(new DensityBCAdapter(rhoLB));
+      denBCAdapterOutflow->setBcAlgorithm(SPtr<BCAlgorithm>(new NonEqDensityBCAlgorithm()));
+
+      //BS visitor
+      BoundaryConditionsBlockVisitor bcVisitor;
+      bcVisitor.addBC(noSlipBCAdapter);
+      bcVisitor.addBC(denBCAdapterInflow);
+      bcVisitor.addBC(denBCAdapterOutflow);
+
+      SPtr<Grid3D> grid(new Grid3D(comm));
+      grid->setPeriodicX1(false);
+      grid->setPeriodicX2(true);
+      grid->setPeriodicX3(false);
+      grid->setDeltaX(deltax);
+      grid->setBlockNX(blocknx[0], blocknx[1], blocknx[2]);
+
+      SPtr<GbObject3D> gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
+      if (myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), pathname + "/geo/gridCube", WbWriterVtkXmlBinary::getInstance());
+
+      double k1 = 4;
+      double k2 = 8;
+
+      SPtr<GbObject3D> refineCube1_1(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2 / k1 - 1.0, g_maxX3));
+      if (myid == 0) GbSystem3D::writeGeoObject(refineCube1_1.get(), pathname + "/geo/refineCube1_1", WbWriterVtkXmlBinary::getInstance());
+
+      SPtr<GbObject3D> refineCube1_2(new GbCuboid3D(g_minX1, g_maxX2 - g_maxX2 / k1 + 1.0, g_minX3, g_maxX1, g_maxX2, g_maxX3));
+      if (myid == 0) GbSystem3D::writeGeoObject(refineCube1_2.get(), pathname + "/geo/refineCube1_2", WbWriterVtkXmlBinary::getInstance());
+
+      SPtr<GbObject3D> refineCube2_1(new GbCuboid3D(g_minX1 + 2 * blockLength + 2 * deltax, g_minX2, g_minX3, g_maxX1 - 2 * blockLength - 2 * deltax, g_maxX2 / k2 - 1.0, g_maxX3));
+      if (myid == 0) GbSystem3D::writeGeoObject(refineCube2_1.get(), pathname + "/geo/refineCube2_1", WbWriterVtkXmlBinary::getInstance());
+
+      SPtr<GbObject3D> refineCube2_2(new GbCuboid3D(g_minX1 + 2 * blockLength + 2 * deltax, g_maxX2 - g_maxX2 / k2 + 1.0, g_minX3, g_maxX1 - 2 * blockLength - 2 * deltax, g_maxX2, g_maxX3));
+      if (myid == 0) GbSystem3D::writeGeoObject(refineCube2_2.get(), pathname + "/geo/refineCube2_2", WbWriterVtkXmlBinary::getInstance());
+
+      SPtr<GbObject3D> refineCube2_3(new GbCuboid3D(g_minX1 + blockLength + 2 * deltax, g_minX2 + blockLength + 2 * deltax, g_minX3 + blockLength + 2 * deltax, g_maxX1 - blockLength - 2 * deltax, g_maxX2 - blockLength - 2 * deltax, g_maxX3 - blockLength - 2 * deltax));
+      if (myid == 0) GbSystem3D::writeGeoObject(refineCube2_3.get(), pathname + "/geo/refineCube2_3", WbWriterVtkXmlBinary::getInstance());
+
+      //////////////////////////////////////////////////////////////////////////
+      //restart
+      //SPtr<UbScheduler> rSch(new UbScheduler(restartStep));
+      //RestartCoProcessor rp(grid, rSch, comm, pathname, RestartCoProcessor::TXT);
+
+      //SPtr<UbScheduler> rSch2(new UbScheduler(cpStep, cpStepStart));
+      //MPIIORestart1CoProcessor rcp(grid, rSch2, pathname, comm);
+
+      SPtr<LBMKernel> kernel;
+      kernel = SPtr<LBMKernel>(new IncompressibleCumulantLBMKernel());
+
+      SPtr<BCProcessor> bcProc(new BCProcessor());
+      //SPtr<BCProcessor> bcProc = SPtr<BCProcessor>(new ThinWallBCProcessor());
+      kernel->setBCProcessor(bcProc);
+
+      //rcp.setLBMKernel(kernel);
+      //rcp.setBCProcessor(bcProc);
+      //rcp.setChunk(1);
+      //////////////////////////////////////////////////////////////////////////
+
+      if (newStart)
+      {
+         GenBlocksGridVisitor genBlocks(gridCube);
+         grid->accept(genBlocks);
+
+         if (myid == 0)
+         {
+            UBLOG(logINFO, "Parameters:");
+            UBLOG(logINFO, "h = " << h);
+            UBLOG(logINFO, "rho = " << rhoLB);
+            UBLOG(logINFO, "nue = " << nuLB);
+            UBLOG(logINFO, "Re = " << Re);
+            UBLOG(logINFO, "dx = " << deltax);
+            UBLOG(logINFO, "dpLB = " << dpLB);
+            UBLOG(logINFO, "Umax = " << Umax);
+            UBLOG(logINFO, "number of levels = " << refineLevel + 1);
+            UBLOG(logINFO, "numOfThreads = " << numOfThreads);
+            UBLOG(logINFO, "path = " << pathname);
+            UBLOG(logINFO, "Preprozess - start");
+         }
+
+         //walls
+         GbCuboid3DPtr addWallYmin(new GbCuboid3D(g_minX1 - blockLength, g_minX2 - blockLength, g_minX3 - blockLength, g_maxX1 + blockLength, g_minX2, g_maxX3 + blockLength));
+         if (myid == 0) GbSystem3D::writeGeoObject(addWallYmin.get(), pathname + "/geo/addWallYmin", WbWriterVtkXmlASCII::getInstance());
+
+         GbCuboid3DPtr addWallYmax(new GbCuboid3D(g_minX1 - blockLength, g_maxX2, g_minX3 - blockLength, g_maxX1 + blockLength, g_maxX2 + blockLength, g_maxX3 + blockLength));
+         if (myid == 0) GbSystem3D::writeGeoObject(addWallYmax.get(), pathname + "/geo/addWallYmax", WbWriterVtkXmlASCII::getInstance());
+
+         GbCuboid3DPtr addWallZmin(new GbCuboid3D(g_minX1 - blockLength, g_minX2 - blockLength, g_minX3 - blockLength, g_maxX1 + blockLength, g_maxX2 + blockLength, g_minX3));
+         if (myid == 0) GbSystem3D::writeGeoObject(addWallZmin.get(), pathname + "/geo/addWallZmin", WbWriterVtkXmlASCII::getInstance());
+
+         GbCuboid3DPtr addWallZmax(new GbCuboid3D(g_minX1 - blockLength, g_minX2 - blockLength, g_maxX3, g_maxX1 + blockLength, g_maxX2 + blockLength, g_maxX3 + blockLength));
+         if (myid == 0) GbSystem3D::writeGeoObject(addWallZmax.get(), pathname + "/geo/addWallZmax", WbWriterVtkXmlASCII::getInstance());
+
+
+         //GbCuboid3DPtr addWallXmax(new GbCuboid3D(g_maxX1-4.0*deltax, g_maxX2, g_minX3 - 4.0*blockLength, g_maxX1 + 4.0*blockLength, g_maxX2 + 4.0*blockLength, g_maxX3 + 4.0*blockLength));
+         //if (myid == 0) GbSystem3D::writeGeoObject(addWallXmax.get(), pathname+"/geo/addWallXmax", WbWriterVtkXmlASCII::getInstance());
+
+         //inflow
+         GbCuboid3DPtr geoInflow(new GbCuboid3D(g_minX1 - blockLength, g_minX2 - blockLength, g_minX3 - blockLength, g_minX1, g_maxX2 + blockLength, g_maxX3 + blockLength));
+         if (myid == 0) GbSystem3D::writeGeoObject(geoInflow.get(), pathname + "/geo/geoInflow", WbWriterVtkXmlASCII::getInstance());
+
+         //outflow
+         GbCuboid3DPtr geoOutflow(new GbCuboid3D(g_maxX1, g_minX2 - blockLength, g_minX3 - blockLength, g_maxX1 + blockLength, g_maxX2 + blockLength, g_maxX3 + blockLength));
+         if (myid == 0) GbSystem3D::writeGeoObject(geoOutflow.get(), pathname + "/geo/geoOutflow", WbWriterVtkXmlASCII::getInstance());
+
+         //GbCuboid3DPtr geoOutflowSolid(new GbCuboid3D(g_maxX1-1.0*deltax, g_minX2 - 4.0*blockLength, g_minX3 - 4.0*blockLength, g_maxX1 + 4.0*blockLength, g_maxX2+4.0*blockLength, g_maxX3 + 4.0*blockLength));
+         //if (myid == 0) GbSystem3D::writeGeoObject(geoOutflowSolid.get(), pathname + "/geo/geoOutflowSolid", WbWriterVtkXmlASCII::getInstance());
+
+         ////inflow
+         //GbCuboid3DPtr geoInflow (new GbCuboid3D(g_minX1-4.0*blockLength, g_minX2-4.0*blockLength, g_minX3-4.0*blockLength, g_maxX1+4.0*blockLength, g_maxX2+4.0*blockLength, g_minX3));
+         //if(myid == 0) GbSystem3D::writeGeoObject(geoInflow.get(), pathname+"/geo/geoInflow", WbWriterVtkXmlASCII::getInstance());
+
+         ////outflow
+         //GbCuboid3DPtr geoOutflow (new GbCuboid3D(g_minX1-4.0*blockLength, g_minX2-4.0*blockLength, g_maxX3, g_maxX1+4.0*blockLength, g_maxX2+4.0*blockLength, g_maxX3+4.0*blockLength));
+         //if(myid == 0) GbSystem3D::writeGeoObject(geoOutflow.get(), pathname+"/geo/geoOutflow", WbWriterVtkXmlASCII::getInstance());
+
+         SPtr<CoProcessor> ppblocks(new WriteBlocksCoProcessor(grid, SPtr<UbScheduler>(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm));
+
+         if (refineLevel > 0)
+         {
+            if (myid == 0) UBLOG(logINFO, "Refinement - start");
+            RefineCrossAndInsideGbObjectHelper refineHelper(grid, refineLevel, comm);
+            //refineHelper.addGbObject(refineCube1_1, 1);
+            //refineHelper.addGbObject(refineCube1_2, 1);
+            //refineHelper.addGbObject(refineCube2_1, 2);
+            //refineHelper.addGbObject(refineCube2_2, 2);
+            refineHelper.addGbObject(refineCube2_3, refineLevel);
+            refineHelper.refine();
+            if (myid == 0) UBLOG(logINFO, "Refinement - end");
+         }
+
+         //walls
+         SPtr<D3Q27Interactor> addWallYminInt(new D3Q27Interactor(addWallYmin, grid, noSlipBCAdapter, Interactor3D::SOLID));
+         SPtr<D3Q27Interactor> addWallYmaxInt(new D3Q27Interactor(addWallYmax, grid, noSlipBCAdapter, Interactor3D::SOLID));
+
+         SPtr<D3Q27Interactor> addWallZminInt(new D3Q27Interactor(addWallZmin, grid, noSlipBCAdapter, Interactor3D::SOLID));
+         SPtr<D3Q27Interactor> addWallZmaxInt(new D3Q27Interactor(addWallZmax, grid, noSlipBCAdapter, Interactor3D::SOLID));
+
+         //SPtr<D3Q27Interactor> addWallXmaxInt(new D3Q27Interactor(addWallXmax, grid, denBCAdapterOutflow,Interactor3D::SOLID));
+
+         SPtr<D3Q27Interactor> inflowInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoInflow, grid, denBCAdapterInflow, Interactor3D::SOLID));
+
+         //outflow
+         SPtr<D3Q27Interactor> outflowInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoOutflow, grid, denBCAdapterOutflow, Interactor3D::SOLID));
+         //SPtr<D3Q27Interactor> outflowSolidInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoOutflow, grid, noSlipBCAdapter, Interactor3D::SOLID));
+
+         ////////////////////////////////////////////
+         //METIS
+         SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B));
+         ////////////////////////////////////////////
+         /////delete solid blocks
+         if (myid == 0) UBLOG(logINFO, "deleteSolidBlocks - start");
+         InteractorsHelper intHelper(grid, metisVisitor);
+
+         //intHelper.addInteractor(addWallYminInt);
+         //intHelper.addInteractor(addWallYmaxInt);
+         intHelper.addInteractor(addWallZminInt);
+         intHelper.addInteractor(addWallZmaxInt);
+
+         intHelper.addInteractor(inflowInt);
+
+         intHelper.addInteractor(outflowInt);
+
+         //die Geschwindigkeit Randbedingung soll Ausflüß überdecken !!!!!
+
+
+
+         intHelper.selectBlocks();
+         if (myid == 0) UBLOG(logINFO, "deleteSolidBlocks - end");
+         //////////////////////////////////////
+
+         //set connectors
+         //InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor());
+         InterpolationProcessorPtr iProcessor(new CompressibleOffsetInterpolationProcessor());
+         SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
+         grid->accept(setConnsVisitor);
+
+         //domain decomposition for threads
+         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
+         grid->accept(pqPartVisitor);
+
+         ppblocks->process(0);
+         ppblocks.reset();
+
+         unsigned long nob = grid->getNumberOfBlocks();
+         int gl = 3;
+         unsigned long nodb = (blocknx[0]) * (blocknx[1]) * (blocknx[2]);
+         unsigned long nod = nob * (blocknx[0]) * (blocknx[1]) * (blocknx[2]);
+         unsigned long nodg = nob * (blocknx[0] + gl) * (blocknx[1] + gl) * (blocknx[1] + gl);
+         double needMemAll = double(nodg * (27 * sizeof(double) + sizeof(int) + sizeof(float) * 4));
+         double needMem = needMemAll / double(comm->getNumberOfProcesses());
+
+         if (myid == 0)
+         {
+            UBLOG(logINFO, "Number of blocks = " << nob);
+            UBLOG(logINFO, "Number of nodes  = " << nod);
+            int minInitLevel = grid->getCoarsestInitializedLevel();
+            int maxInitLevel = grid->getFinestInitializedLevel();
+            for (int level = minInitLevel; level <= maxInitLevel; level++)
+            {
+               int nobl = grid->getNumberOfBlocks(level);
+               UBLOG(logINFO, "Number of blocks for level " << level << " = " << nobl);
+               UBLOG(logINFO, "Number of nodes for level " << level << " = " << nobl * nodb);
+            }
+            UBLOG(logINFO, "Necessary memory  = " << needMemAll << " bytes");
+            UBLOG(logINFO, "Necessary memory per process = " << needMem << " bytes");
+            UBLOG(logINFO, "Available memory per process = " << availMem << " bytes");
+         }
+
+         //SPtr<LBMKernel> kernel;
+         //kernel = SPtr<LBMKernel>(new IncompressibleCumulantLBMKernel(blocknx[0], blocknx[1], blocknx[2], IncompressibleCumulantLBMKernel::NORMAL));
+         //kernel = SPtr<LBMKernel>(new CompressibleCumulantLBMKernel(blocknx[0], blocknx[1], blocknx[2], CompressibleCumulantLBMKernel::NORMAL));
+         //}
+         //kernel->setWithForcing(true);
+         //kernel->setForcingX1(2e-6);
+         //SPtr<BCProcessor> bcProc(new BCProcessor());
+         //kernel->setBCProcessor(bcProc);
+
+         SetKernelBlockVisitor kernelVisitor(kernel, nuLB, availMem, needMem);
+         grid->accept(kernelVisitor);
+
+         if (refineLevel > 0)
+         {
+            SetUndefinedNodesBlockVisitor undefNodesVisitor;
+            grid->accept(undefNodesVisitor);
+         }
+
+         //walls
+         intHelper.setBC();
+
+         grid->accept(bcVisitor);
+
+
+         //initialization of distributions
+         //mu::Parser fct;
+         //fct.SetExpr("-(1.0/(2.0*nu))*(dp/dx)*((x2-h)^2 - h^2)");
+         //fct.DefineConst("dp", dpLB);
+         //fct.DefineConst("dx", dex);
+         //fct.DefineConst("h", h);
+         //fct.DefineConst("nu", nuLB);
+
+         mu::Parser fct;
+         fct.SetExpr("(x1max-x1)/l*dp*3.0");
+         fct.DefineConst("dp", dpLB);
+         fct.DefineConst("x1max", g_maxX1);
+         fct.DefineConst("l", g_maxX1 - g_minX1);
+
+         InitDistributionsBlockVisitor initVisitor;
+         //initVisitor.setVx1(fct);
+         //initVisitor.setVx1(uLB);
+         //initVisitor.setVx3(fct);
+         //initVisitor.setRho(fct);
+         grid->accept(initVisitor);
+
+         //Postrozess
+         SPtr<UbScheduler> geoSch(new UbScheduler(1));
+         SPtr<CoProcessor> ppgeo(
+            new WriteBoundaryConditionsCoProcessor(grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), comm));
+         ppgeo->process(0);
+         ppgeo.reset();
+
+         if (myid == 0) UBLOG(logINFO, "Preprozess - end");
+      }
+      else
+      {
+         //rcp.readBlocks(restartStep);
+         //SPtr<Grid3DVisitor> newMetisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::BSW, MetisPartitioner::KWAY));
+         //grid->accept(newMetisVisitor);
+         //rcp.readDataSet(restartStep);
+         //rcp.readBoundaryConds(restartStep);
+
+         //rcp.restart((int)restartStep);
+
+         grid->setTimeStep(restartStep);
+
+         //set connectors
+         InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor());
+         SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
+         grid->accept(setConnsVisitor);
+
+         grid->accept(bcVisitor);
+
+         SPtr<UbScheduler> geoSch(new UbScheduler(1));
+         WriteBoundaryConditionsCoProcessor ppgeo = WriteBoundaryConditionsCoProcessor(grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), comm);
+         ppgeo.process(1);
+
+         if (myid == 0) UBLOG(logINFO, "Restart - end");
+      }
+      SPtr<UbScheduler> nupsSch(new UbScheduler(10, 30, 100));
+      SPtr<CoProcessor> npr(new NUPSCounterCoProcessor (grid, nupsSch, numOfThreads, comm));
+
+      //write data for visualization of macroscopic quantities
+      SPtr<UbScheduler> visSch(new UbScheduler(outTime));
+      SPtr<WriteMacroscopicQuantitiesCoProcessor> writeMQCoProcessor(new WriteMacroscopicQuantitiesCoProcessor(grid, visSch, pathname, 
+      WbWriterVtkXmlASCII::getInstance(), SPtr<LBMUnitConverter>(new LBMUnitConverter()), comm));
+
+      SPtr<UbScheduler> AdjForcSch(new UbScheduler());
+      AdjForcSch->addSchedule(10, 0, 10000000);
+      SPtr<IntegrateValuesHelper> intValHelp(new IntegrateValuesHelper(grid, comm,
+         g_minX1, g_minX2, g_minX3,
+         g_maxX1, g_maxX2, g_maxX3));
+      if (myid == 0) GbSystem3D::writeGeoObject(intValHelp->getBoundingBox().get(), pathname + "/geo/IntValHelp", WbWriterVtkXmlBinary::getInstance());
+
+      double vxTarget = uLB;
+      AdjustForcingCoProcessor AdjForcPPPtr(grid, AdjForcSch, pathname, intValHelp, vxTarget, comm);
+
+      //start simulation 
+      //omp_set_num_threads(numOfThreads);
+      SPtr<UbScheduler> stepGhostLayer(new UbScheduler(outTime));
+      SPtr<Calculator> calculator(new BasicCalculator(grid, stepGhostLayer, endTime));
+      calculator->addCoProcessor(npr);
+      calculator->addCoProcessor(writeMQCoProcessor);
+      //calculator->addCoProcessor(migCoProcessor);
+      //calculator->addCoProcessor(restartCoProcessor);
+
+      if (myid == 0) UBLOG(logINFO, "Simulation-start");
+      calculator->calculate();
+      if (myid == 0) UBLOG(logINFO, "Simulation-end");
+   }
+   catch (std::exception & e)
+   {
+      cerr << e.what() << endl << flush;
+   }
+   catch (std::string & s)
+   {
+      cerr << s << endl;
+   }
+   catch (...)
+   {
+      cerr << "unknown exception" << endl;
+   }
+
+}
+//////////////////////////////////////////////////////////////////////////
+int main(int argc, char* argv[])
+{
+   if (argv != NULL)
+   {
+      if (argv[1] != NULL)
+      {
+         //pflowForcing(string(argv[1]));
+         pflowdp(string(argv[1]));
+      }
+      else
+      {
+         cout << "Configuration file is missing!" << endl;
+      }
+   }
+
+   return 0;
+}
diff --git a/apps/cpu/Hagen_Poiseuille_flow2/CMakeLists.txt b/apps/cpu/Hagen_Poiseuille_flow2/CMakeLists.txt
index 89a138ea268f1b62abda3e9d472e656fcf28f8cb..10c19fab4ef7efb98263a7d6fefbe6f5d17ff0a7 100644
--- a/apps/cpu/Hagen_Poiseuille_flow2/CMakeLists.txt
+++ b/apps/cpu/Hagen_Poiseuille_flow2/CMakeLists.txt
@@ -1,25 +1,25 @@
-CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
-
-########################################################
-## C++ PROJECT                                       ###
-########################################################
-PROJECT(pflow2)
-
-INCLUDE(${APPS_ROOT}/IncludsList.cmake) 
-
-#################################################################
-###   LOCAL FILES                                             ###
-#################################################################
-FILE(GLOB SPECIFIC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.h
-                         ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
-                         ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp  )
- 
-SET(ALL_SOURCES ${ALL_SOURCES} ${SPECIFIC_FILES})
-SOURCE_GROUP(src FILES ${SPECIFIC_FILES})
-  
-SET(CAB_ADDITIONAL_LINK_LIBRARIES VirtualFluids)
-
-#################################################################
-###   CREATE PROJECT                                          ###
-#################################################################
-CREATE_CAB_PROJECT(pflow2 BINARY)
+CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
+
+########################################################
+## C++ PROJECT                                       ###
+########################################################
+PROJECT(pflow2)
+
+INCLUDE(${APPS_ROOT}/IncludsList.cmake) 
+
+#################################################################
+###   LOCAL FILES                                             ###
+#################################################################
+FILE(GLOB SPECIFIC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.h
+                         ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
+                         ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp  )
+ 
+SET(ALL_SOURCES ${ALL_SOURCES} ${SPECIFIC_FILES})
+SOURCE_GROUP(src FILES ${SPECIFIC_FILES})
+  
+SET(CAB_ADDITIONAL_LINK_LIBRARIES VirtualFluids)
+
+#################################################################
+###   CREATE PROJECT                                          ###
+#################################################################
+CREATE_CAB_PROJECT(pflow2 BINARY)
diff --git a/apps/cpu/Hagen_Poiseuille_flow2/pf1.cfg b/apps/cpu/Hagen_Poiseuille_flow2/pf1.cfg
index 68de4f8f90c49e5d50ae00749742a7eb1b27882a..c813f9c35e0eb52e705917d14454c8fb9d5c6845 100644
--- a/apps/cpu/Hagen_Poiseuille_flow2/pf1.cfg
+++ b/apps/cpu/Hagen_Poiseuille_flow2/pf1.cfg
@@ -1,18 +1,18 @@
-pathname = d:/temp/pflow1
-numOfThreads = 4
-availMem = 8e9
-logToFile = false
-blocknx = 10 10 10
-gridnx = 2 1 2
-nuLB = 1e-2
-forcing = 5e-8
-deltax = 0.1
-
-refineLevel = 0
-logToFile=false
-thinWall = false
-
-restartStep = 100000
-
-endTime = 100000
+pathname = d:/temp/pflow1
+numOfThreads = 4
+availMem = 8e9
+logToFile = false
+blocknx = 10 10 10
+gridnx = 2 1 2
+nuLB = 1e-2
+forcing = 5e-8
+deltax = 0.1
+
+refineLevel = 0
+logToFile=false
+thinWall = false
+
+restartStep = 100000
+
+endTime = 100000
 outTime = 100000
\ No newline at end of file
diff --git a/apps/cpu/Hagen_Poiseuille_flow2/pf2.cfg b/apps/cpu/Hagen_Poiseuille_flow2/pf2.cfg
index 348eb0c962aec6742b9882cf83b4935cd3d2c83d..6ecbc0dfe05bc2973aa0c2ef6529bc9c80d1e197 100644
--- a/apps/cpu/Hagen_Poiseuille_flow2/pf2.cfg
+++ b/apps/cpu/Hagen_Poiseuille_flow2/pf2.cfg
@@ -1,18 +1,18 @@
-pathname = d:/temp/pflow2
-numOfThreads = 4
-availMem = 8e9
-logToFile = false
-blocknx = 10 10 10
-gridnx = 2 0.5 2
-nuLB = 1e-2
-forcing = 6.25e-9
-deltax = 0.05
-
-refineLevel = 0
-logToFile=false
-thinWall = false
-
-restartStep = 400000
-
-endTime = 400000
+pathname = d:/temp/pflow2
+numOfThreads = 4
+availMem = 8e9
+logToFile = false
+blocknx = 10 10 10
+gridnx = 2 0.5 2
+nuLB = 1e-2
+forcing = 6.25e-9
+deltax = 0.05
+
+refineLevel = 0
+logToFile=false
+thinWall = false
+
+restartStep = 400000
+
+endTime = 400000
 outTime = 400000
\ No newline at end of file
diff --git a/apps/cpu/Hagen_Poiseuille_flow2/pf3.cfg b/apps/cpu/Hagen_Poiseuille_flow2/pf3.cfg
index 1104e07971f97a0fefc7f8f21a1bf29602bbb5d3..111829262c062689296819e0c6cc771d92584d4d 100644
--- a/apps/cpu/Hagen_Poiseuille_flow2/pf3.cfg
+++ b/apps/cpu/Hagen_Poiseuille_flow2/pf3.cfg
@@ -1,18 +1,18 @@
-pathname = d:/temp/pflow4
-numOfThreads = 8
-availMem = 8e9
-logToFile = false
-blocknx = 10 10 10
-gridnx = 2 0.25 2
-nuLB = 1e-2
-forcing = 7.8125e-10
-deltax = 0.025
-
-refineLevel = 0
-logToFile=false
-thinWall = false
-
-restartStep = 400000
-
-endTime = 1600000
+pathname = d:/temp/pflow4
+numOfThreads = 8
+availMem = 8e9
+logToFile = false
+blocknx = 10 10 10
+gridnx = 2 0.25 2
+nuLB = 1e-2
+forcing = 7.8125e-10
+deltax = 0.025
+
+refineLevel = 0
+logToFile=false
+thinWall = false
+
+restartStep = 400000
+
+endTime = 1600000
 outTime = 400000
\ No newline at end of file
diff --git a/apps/cpu/Hagen_Poiseuille_flow2/pf4.cfg b/apps/cpu/Hagen_Poiseuille_flow2/pf4.cfg
index c7b2430129b76170a69cb863c76ce991c7fe3fac..41a53e96ad0e4c3ec10f8559fda567357bd1e65c 100644
--- a/apps/cpu/Hagen_Poiseuille_flow2/pf4.cfg
+++ b/apps/cpu/Hagen_Poiseuille_flow2/pf4.cfg
@@ -1,19 +1,19 @@
-pathname = d:/temp/pflow4
-numOfThreads = 8
-availMem = 8e9
-logToFile = false
-blocknx = 10 10 10
-gridnx = 2 0.25 2
-nuLB = 1e-2
-forcing = 7.8125e-10
-deltax = 0.025
-
-refineLevel = 1
-logToFile=false
-thinWall = false
-
-restartStep = 400000
-
-endTime = 1600000
-#outTime = 400000
+pathname = d:/temp/pflow4
+numOfThreads = 8
+availMem = 8e9
+logToFile = false
+blocknx = 10 10 10
+gridnx = 2 0.25 2
+nuLB = 1e-2
+forcing = 7.8125e-10
+deltax = 0.025
+
+refineLevel = 1
+logToFile=false
+thinWall = false
+
+restartStep = 400000
+
+endTime = 1600000
+#outTime = 400000
 outTime = 400
\ No newline at end of file
diff --git a/apps/cpu/Hagen_Poiseuille_flow2/pfDP.cfg b/apps/cpu/Hagen_Poiseuille_flow2/pfDP.cfg
index a79eae0329df5c9ccab9c1a9b82d4cfcceaef40f..99d519628021dfe9cf53e1d53c10142478bd8e13 100644
--- a/apps/cpu/Hagen_Poiseuille_flow2/pfDP.cfg
+++ b/apps/cpu/Hagen_Poiseuille_flow2/pfDP.cfg
@@ -1,18 +1,18 @@
-pathname = d:/temp/pflowDP_compact_5_10-3_NoAveraging
-numOfThreads = 4
-availMem = 8e9
-logToFile = false
-blocknx = 10 10 2
-gridnx = 4 2 0.2
-nuLB = 5e-3
-dpLB = 1e-7
-deltax = 0.1
-
-refineLevel = 1
-logToFile=false
-thinWall = false
-
-restartStep = 100000
-
-endTime = 500000
+pathname = d:/temp/pflowDP_compact_5_10-3_NoAveraging
+numOfThreads = 4
+availMem = 8e9
+logToFile = false
+blocknx = 10 10 2
+gridnx = 4 2 0.2
+nuLB = 5e-3
+dpLB = 1e-7
+deltax = 0.1
+
+refineLevel = 1
+logToFile=false
+thinWall = false
+
+restartStep = 100000
+
+endTime = 500000
 outTime = 50000
\ No newline at end of file
diff --git a/apps/cpu/Hagen_Poiseuille_flow2/pflow2.cpp b/apps/cpu/Hagen_Poiseuille_flow2/pflow2.cpp
index 68ba4e9e93eeaf1bd2593a14233a828839324cd2..76124d72ecedbed258aa163dc72e7a1cadff2bcc 100644
--- a/apps/cpu/Hagen_Poiseuille_flow2/pflow2.cpp
+++ b/apps/cpu/Hagen_Poiseuille_flow2/pflow2.cpp
@@ -1,337 +1,337 @@
-#include <iostream>
-#include <string>
-
-#include <VirtualFluids.h>
-
-using namespace std;
-
-
-void pflowdp(string configname)
-{
-   try
-   {
-      ConfigurationFile   config;
-      config.load(configname);
-
-      string          pathname = config.getString("pathname");
-      int             numOfThreads = config.getValue<int>("numOfThreads");
-      vector<int>     blocknx = config.getVector<int>("blocknx");
-      vector<double>  gridnx = config.getVector<double>("gridnx");
-      double          nuLB = config.getValue<double>("nuLB");
-      double          endTime = config.getValue<double>("endTime");
-      double          outTime = config.getValue<double>("outTime");
-      double          availMem = config.getValue<double>("availMem");
-      int             refineLevel = config.getValue<int>("refineLevel");
-      bool            logToFile = config.getValue<bool>("logToFile");
-      double          restartStep = config.getValue<double>("restartStep");
-      double          dpLB = config.getValue<double>("dpLB");
-      bool            thinWall = config.getValue<bool>("thinWall");
-      double          deltax = config.getValue<double>("deltax");
-
-
-      SPtr<Communicator> comm = MPICommunicator::getInstance();
-      int myid = comm->getProcessID();
-
-      LBMReal rhoLB = 0.0;
-      double rhoLBinflow = dpLB*3.0;
-
-      SPtr<LBMUnitConverter> conv = SPtr<LBMUnitConverter>(new LBMUnitConverter());
-
-      const int baseLevel = 0;
-
-            //bounding box
-            double g_minX1 = 0;
-            double g_minX2 = 0;
-            double g_minX3 = 0;
-      
-            double g_maxX1 = gridnx[0];
-            double g_maxX2 = gridnx[1];
-            double g_maxX3 = gridnx[2];
-
-      double blockLength = (double)blocknx[0]*deltax;
-
-      double h = (g_maxX2) / 2.0;
-      double dex = g_maxX1;
-      double Umax = (1.0 / (4.0*nuLB))*(dpLB / dex)*(h*h);
-      double Re = (4 * h*Umax) / (3 * nuLB);
-
-      //bc
-      SPtr<BCAdapter> noSlipBCAdapter(new NoSlipBCAdapter());
-      noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NoSlipBCAlgorithm()));
-
-      SPtr<BCAdapter> denBCAdapterInflow(new DensityBCAdapter(rhoLBinflow));
-      denBCAdapterInflow->setBcAlgorithm(SPtr<BCAlgorithm>(new NonEqDensityBCAlgorithm()));
-
-      SPtr<BCAdapter> denBCAdapterOutflow(new DensityBCAdapter(rhoLB));
-      denBCAdapterOutflow->setBcAlgorithm(SPtr<BCAlgorithm>(new NonEqDensityBCAlgorithm()));
-
-      //BS visitor
-      BoundaryConditionsBlockVisitor bcVisitor;
-      bcVisitor.addBC(noSlipBCAdapter);
-      bcVisitor.addBC(denBCAdapterInflow);
-      bcVisitor.addBC(denBCAdapterOutflow);
-
-      SPtr<Grid3D> grid(new Grid3D(comm));
-      grid->setPeriodicX1(false);
-      grid->setPeriodicX2(false);
-      grid->setPeriodicX3(true);
-      grid->setDeltaX(deltax);
-      grid->setBlockNX(blocknx[0], blocknx[1], blocknx[2]);
-
-      SPtr<GbObject3D> gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
-      if (myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), pathname + "/geo/gridCube", WbWriterVtkXmlBinary::getInstance());
-
-      double k1 = 4;
-      double k2 = 8;
-
-      SPtr<GbObject3D> refineCube1_1(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2 / k1 - 1.0, g_maxX3));
-      if (myid == 0) GbSystem3D::writeGeoObject(refineCube1_1.get(), pathname + "/geo/refineCube1_1", WbWriterVtkXmlBinary::getInstance());
-
-      SPtr<GbObject3D> refineCube1_2(new GbCuboid3D(g_minX1, g_maxX2 - g_maxX2 / k1 + 1.0, g_minX3, g_maxX1, g_maxX2, g_maxX3));
-      if (myid == 0) GbSystem3D::writeGeoObject(refineCube1_2.get(), pathname + "/geo/refineCube1_2", WbWriterVtkXmlBinary::getInstance());
-
-      SPtr<GbObject3D> refineCube2_1(new GbCuboid3D(g_minX1 + 2 * blockLength + 2 * deltax, g_minX2, g_minX3, g_maxX1 - 2 * blockLength - 2 * deltax, g_maxX2 / k2 - 1.0, g_maxX3));
-      if (myid == 0) GbSystem3D::writeGeoObject(refineCube2_1.get(), pathname + "/geo/refineCube2_1", WbWriterVtkXmlBinary::getInstance());
-
-      SPtr<GbObject3D> refineCube2_2(new GbCuboid3D(g_minX1 + 2 * blockLength + 2 * deltax, g_maxX2 - g_maxX2 / k2 + 1.0, g_minX3, g_maxX1 - 2 * blockLength - 2 * deltax, g_maxX2, g_maxX3));
-      if (myid == 0) GbSystem3D::writeGeoObject(refineCube2_2.get(), pathname + "/geo/refineCube2_2", WbWriterVtkXmlBinary::getInstance());
-
-      SPtr<GbObject3D> refineCube2_3(new GbCuboid3D(g_minX1 + blockLength + 2 * deltax, g_minX2 + blockLength + 2 * deltax, g_minX3 + blockLength + 2 * deltax, g_maxX1 - blockLength - 2 * deltax, g_maxX2 - blockLength - 2 * deltax, g_maxX3 - blockLength - 2 * deltax));
-      if (myid == 0) GbSystem3D::writeGeoObject(refineCube2_3.get(), pathname + "/geo/refineCube2_3", WbWriterVtkXmlBinary::getInstance());
-
-      SPtr<GbObject3D> refineCube3(new GbCuboid3D(g_minX1 + 2.0*(g_maxX1/3.0), g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
-      if (myid == 0) GbSystem3D::writeGeoObject(refineCube3.get(), pathname + "/geo/refineCube3", WbWriterVtkXmlBinary::getInstance());
-
-      //////////////////////////////////////////////////////////////////////////
-      //restart
-      //SPtr<UbScheduler> rSch(new UbScheduler(restartStep));
-      //RestartCoProcessor rp(grid, rSch, comm, pathname, RestartCoProcessor::TXT);
-      //////////////////////////////////////////////////////////////////////////
-
-      if (grid->getTimeStep() == 0)
-      {
-         GenBlocksGridVisitor genBlocks(gridCube);
-         grid->accept(genBlocks);
-
-         if (myid == 0)
-         {
-            UBLOG(logINFO, "Parameters:");
-            UBLOG(logINFO, "h = " << h);
-            UBLOG(logINFO, "rho = " << rhoLB);
-            UBLOG(logINFO, "nue = " << nuLB);
-            UBLOG(logINFO, "Re = " << Re);
-            UBLOG(logINFO, "dx = " << deltax);
-            UBLOG(logINFO, "dpLB = " << dpLB);
-            UBLOG(logINFO, "Umax = " << Umax);
-            UBLOG(logINFO, "number of levels = " << refineLevel + 1);
-            UBLOG(logINFO, "numOfThreads = " << numOfThreads);
-            UBLOG(logINFO, "path = " << pathname);
-            UBLOG(logINFO, "Preprozess - start");
-         }
-
-         //walls
-         GbCuboid3DPtr addWallYmin (new GbCuboid3D(g_minX1-4.0*blockLength, g_minX2-4.0*blockLength, g_minX3-4.0*blockLength, g_maxX1+4.0*blockLength, g_minX2, g_maxX3+4.0*blockLength));
-         if(myid == 0) GbSystem3D::writeGeoObject(addWallYmin.get(), pathname+"/geo/addWallYmin", WbWriterVtkXmlASCII::getInstance());
-
-         GbCuboid3DPtr addWallYmax (new GbCuboid3D(g_minX1-4.0*blockLength, g_maxX2, g_minX3-4.0*blockLength, g_maxX1+4.0*blockLength, g_maxX2+4.0*blockLength, g_maxX3+4.0*blockLength));
-         if(myid == 0) GbSystem3D::writeGeoObject(addWallYmax.get(), pathname+"/geo/addWallYmax", WbWriterVtkXmlASCII::getInstance());
-
-         //inflow
-         GbCuboid3DPtr geoInflow(new GbCuboid3D(g_minX1 - 4.0*blockLength, g_minX2 - 4.0*blockLength, g_minX3 - 4.0*blockLength, g_minX1, g_maxX2 + 4.0*blockLength, g_maxX3 + 4.0*blockLength));
-         if (myid == 0) GbSystem3D::writeGeoObject(geoInflow.get(), pathname + "/geo/geoInflow", WbWriterVtkXmlASCII::getInstance());
-
-         //outflow
-         GbCuboid3DPtr geoOutflow(new GbCuboid3D(g_maxX1, g_minX2 - 4.0*blockLength, g_minX3 - 4.0*blockLength, g_maxX1 + 4.0*blockLength, g_maxX2 + 4.0*blockLength, g_maxX3 + 4.0*blockLength));
-         if (myid == 0) GbSystem3D::writeGeoObject(geoOutflow.get(), pathname + "/geo/geoOutflow", WbWriterVtkXmlASCII::getInstance());
-
-         ////inflow
-         //GbCuboid3DPtr geoInflow (new GbCuboid3D(g_minX1-4.0*blockLength, g_minX2-4.0*blockLength, g_minX3-4.0*blockLength, g_maxX1+4.0*blockLength, g_maxX2+4.0*blockLength, g_minX3));
-         //if(myid == 0) GbSystem3D::writeGeoObject(geoInflow.get(), pathname+"/geo/geoInflow", WbWriterVtkXmlASCII::getInstance());
-
-         ////outflow
-         //GbCuboid3DPtr geoOutflow (new GbCuboid3D(g_minX1-4.0*blockLength, g_minX2-4.0*blockLength, g_maxX3, g_maxX1+4.0*blockLength, g_maxX2+4.0*blockLength, g_maxX3+4.0*blockLength));
-         //if(myid == 0) GbSystem3D::writeGeoObject(geoOutflow.get(), pathname+"/geo/geoOutflow", WbWriterVtkXmlASCII::getInstance());
-
-         SPtr<CoProcessor> ppblocks(new WriteBlocksCoProcessor(grid, SPtr<UbScheduler>(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm));
-
-         if (refineLevel > 0)
-         {
-            if (myid == 0) UBLOG(logINFO, "Refinement - start");
-            RefineCrossAndInsideGbObjectHelper refineHelper(grid, refineLevel, comm);
-            //refineHelper.addGbObject(refineCube1_1, 1);
-            //refineHelper.addGbObject(refineCube1_2, 1);
-            //refineHelper.addGbObject(refineCube2_1, 2);
-            //refineHelper.addGbObject(refineCube2_2, 2);
-            //refineHelper.addGbObject(refineCube2_3, refineLevel);
-            refineHelper.addGbObject(refineCube3, refineLevel);
-            
-            refineHelper.refine();
-            if (myid == 0) UBLOG(logINFO, "Refinement - end");
-         }
-
-         //walls
-         SPtr<D3Q27Interactor> addWallYminInt(new D3Q27Interactor(addWallYmin, grid, noSlipBCAdapter,Interactor3D::SOLID));
-         SPtr<D3Q27Interactor> addWallYmaxInt(new D3Q27Interactor(addWallYmax, grid, noSlipBCAdapter,Interactor3D::SOLID));
-
-         SPtr<D3Q27Interactor> inflowInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoInflow, grid, denBCAdapterInflow, Interactor3D::SOLID));
-
-         //outflow
-         SPtr<D3Q27Interactor> outflowInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoOutflow, grid, denBCAdapterOutflow, Interactor3D::SOLID));
-
-         ////////////////////////////////////////////
-         //METIS
-         SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B));
-         ////////////////////////////////////////////
-         /////delete solid blocks
-         if (myid == 0) UBLOG(logINFO, "deleteSolidBlocks - start");
-         InteractorsHelper intHelper(grid, metisVisitor);
-         intHelper.addInteractor(addWallYminInt);
-         intHelper.addInteractor(addWallYmaxInt);
-         intHelper.addInteractor(inflowInt);
-         intHelper.addInteractor(outflowInt);
-         intHelper.selectBlocks();
-         if (myid == 0) UBLOG(logINFO, "deleteSolidBlocks - end");
-         //////////////////////////////////////
-
-         //set connectors
-         InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor());
-         SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
-         grid->accept(setConnsVisitor);
-
-         //domain decomposition for threads
-         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
-         grid->accept(pqPartVisitor);
-
-         ppblocks->process(0);
-         ppblocks.reset();
-
-         unsigned long nob = grid->getNumberOfBlocks();
-         int gl = 3;
-         unsigned long nodb = (blocknx[0]) * (blocknx[1]) * (blocknx[2]);
-         unsigned long nod = nob * (blocknx[0]) * (blocknx[1]) * (blocknx[2]);
-         unsigned long nodg = nob * (blocknx[0] + gl) * (blocknx[1] + gl) * (blocknx[1] + gl);
-         double needMemAll = double(nodg*(27 * sizeof(double) + sizeof(int) + sizeof(float) * 4));
-         double needMem = needMemAll / double(comm->getNumberOfProcesses());
-
-         if (myid == 0)
-         {
-            UBLOG(logINFO, "Number of blocks = " << nob);
-            UBLOG(logINFO, "Number of nodes  = " << nod);
-            int minInitLevel = grid->getCoarsestInitializedLevel();
-            int maxInitLevel = grid->getFinestInitializedLevel();
-            for (int level = minInitLevel; level <= maxInitLevel; level++)
-            {
-               int nobl = grid->getNumberOfBlocks(level);
-               UBLOG(logINFO, "Number of blocks for level " << level << " = " << nobl);
-               UBLOG(logINFO, "Number of nodes for level " << level << " = " << nobl*nodb);
-            }
-            UBLOG(logINFO, "Necessary memory  = " << needMemAll << " bytes");
-            UBLOG(logINFO, "Necessary memory per process = " << needMem << " bytes");
-            UBLOG(logINFO, "Available memory per process = " << availMem << " bytes");
-         }
-
-         int kernelType = 2;
-         SPtr<LBMKernel> kernel;
-         kernel = SPtr<LBMKernel>(new IncompressibleCumulantLBMKernel());
-         //}
-
-         SPtr<BCProcessor> bcProc(new BCProcessor());
-         kernel->setBCProcessor(bcProc);
-
-         SetKernelBlockVisitor kernelVisitor(kernel, nuLB, availMem, needMem);
-         grid->accept(kernelVisitor);
-
-         if (refineLevel > 0)
-         {
-            SetUndefinedNodesBlockVisitor undefNodesVisitor;
-            grid->accept(undefNodesVisitor);
-         }
-
-         //walls
-         intHelper.setBC();
-
-         grid->accept(bcVisitor);
-
-         //initialization of distributions
-         mu::Parser fct;
-         fct.SetExpr("-(1.0/(2.0*nu))*(dp/dx)*((x2-h)^2 - h^2)");
-         fct.DefineConst("dp", dpLB);
-         fct.DefineConst("dx", dex);
-         fct.DefineConst("h", h);
-         fct.DefineConst("nu", nuLB);
-
-         InitDistributionsBlockVisitor initVisitor;
-         //initVisitor.setVx1(fct);
-         initVisitor.setVx1(0.0);
-         //initVisitor.setVx3(fct);
-         grid->accept(initVisitor);
-
-         //Postrozess
-         SPtr<UbScheduler> geoSch(new UbScheduler(1));
-         SPtr<CoProcessor> ppgeo(
-            new WriteBoundaryConditionsCoProcessor(grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, comm));
-         ppgeo->process(0);
-         ppgeo.reset();
-
-         if (myid == 0) UBLOG(logINFO, "Preprozess - end");
-      }
-      else
-      {
-         grid->accept(bcVisitor);
-
-         //set connectors
-         InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor());
-         SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
-         grid->accept(setConnsVisitor);
-
-         if (myid == 0) UBLOG(logINFO, "Restart - end");
-      }
-      SPtr<UbScheduler> nupsSch(new UbScheduler(10, 30, 100));
-      SPtr<NUPSCounterCoProcessor> npr(new NUPSCounterCoProcessor(grid, nupsSch, numOfThreads, comm));
-
-      SPtr<UbScheduler> stepSch(new UbScheduler(outTime));
-
-      SPtr<WriteMacroscopicQuantitiesCoProcessor> writeMQCoProcessor(new WriteMacroscopicQuantitiesCoProcessor(grid, stepSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, comm));
-
-
-      omp_set_num_threads(numOfThreads);
-      SPtr<Calculator> calculator(new BasicCalculator(grid, stepSch, endTime));
-      calculator->addCoProcessor(npr);
-      calculator->addCoProcessor(writeMQCoProcessor);
-
-      if (myid == 0) UBLOG(logINFO, "Simulation-start");
-      calculator->calculate();
-      if (myid == 0) UBLOG(logINFO, "Simulation-end");
-   }
-   catch (std::exception& e)
-   {
-      cerr << e.what() << endl << flush;
-   }
-   catch (std::string& s)
-   {
-      cerr << s << endl;
-   }
-   catch (...)
-   {
-      cerr << "unknown exception" << endl;
-   }
-
-}
-//////////////////////////////////////////////////////////////////////////
-int main(int argc, char* argv[])
-{
-   if (argv != NULL)
-   {
-      if (argv[1] != NULL)
-      {
-         //pflowForcing(string(argv[1]));
-         pflowdp(string(argv[1]));
-      }
-      else
-      {
-         cout << "Configuration file is missing!" << endl;
-      }
-   }
-
-   return 0;
-}
+#include <iostream>
+#include <string>
+
+#include <VirtualFluids.h>
+
+using namespace std;
+
+
+void pflowdp(string configname)
+{
+   try
+   {
+      ConfigurationFile   config;
+      config.load(configname);
+
+      string          pathname = config.getString("pathname");
+      int             numOfThreads = config.getValue<int>("numOfThreads");
+      vector<int>     blocknx = config.getVector<int>("blocknx");
+      vector<double>  gridnx = config.getVector<double>("gridnx");
+      double          nuLB = config.getValue<double>("nuLB");
+      double          endTime = config.getValue<double>("endTime");
+      double          outTime = config.getValue<double>("outTime");
+      double          availMem = config.getValue<double>("availMem");
+      int             refineLevel = config.getValue<int>("refineLevel");
+      bool            logToFile = config.getValue<bool>("logToFile");
+      double          restartStep = config.getValue<double>("restartStep");
+      double          dpLB = config.getValue<double>("dpLB");
+      bool            thinWall = config.getValue<bool>("thinWall");
+      double          deltax = config.getValue<double>("deltax");
+
+
+      SPtr<Communicator> comm = MPICommunicator::getInstance();
+      int myid = comm->getProcessID();
+
+      LBMReal rhoLB = 0.0;
+      double rhoLBinflow = dpLB*3.0;
+
+      SPtr<LBMUnitConverter> conv = SPtr<LBMUnitConverter>(new LBMUnitConverter());
+
+      const int baseLevel = 0;
+
+            //bounding box
+            double g_minX1 = 0;
+            double g_minX2 = 0;
+            double g_minX3 = 0;
+      
+            double g_maxX1 = gridnx[0];
+            double g_maxX2 = gridnx[1];
+            double g_maxX3 = gridnx[2];
+
+      double blockLength = (double)blocknx[0]*deltax;
+
+      double h = (g_maxX2) / 2.0;
+      double dex = g_maxX1;
+      double Umax = (1.0 / (4.0*nuLB))*(dpLB / dex)*(h*h);
+      double Re = (4 * h*Umax) / (3 * nuLB);
+
+      //bc
+      SPtr<BCAdapter> noSlipBCAdapter(new NoSlipBCAdapter());
+      noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NoSlipBCAlgorithm()));
+
+      SPtr<BCAdapter> denBCAdapterInflow(new DensityBCAdapter(rhoLBinflow));
+      denBCAdapterInflow->setBcAlgorithm(SPtr<BCAlgorithm>(new NonEqDensityBCAlgorithm()));
+
+      SPtr<BCAdapter> denBCAdapterOutflow(new DensityBCAdapter(rhoLB));
+      denBCAdapterOutflow->setBcAlgorithm(SPtr<BCAlgorithm>(new NonEqDensityBCAlgorithm()));
+
+      //BS visitor
+      BoundaryConditionsBlockVisitor bcVisitor;
+      bcVisitor.addBC(noSlipBCAdapter);
+      bcVisitor.addBC(denBCAdapterInflow);
+      bcVisitor.addBC(denBCAdapterOutflow);
+
+      SPtr<Grid3D> grid(new Grid3D(comm));
+      grid->setPeriodicX1(false);
+      grid->setPeriodicX2(false);
+      grid->setPeriodicX3(true);
+      grid->setDeltaX(deltax);
+      grid->setBlockNX(blocknx[0], blocknx[1], blocknx[2]);
+
+      SPtr<GbObject3D> gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
+      if (myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), pathname + "/geo/gridCube", WbWriterVtkXmlBinary::getInstance());
+
+      double k1 = 4;
+      double k2 = 8;
+
+      SPtr<GbObject3D> refineCube1_1(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2 / k1 - 1.0, g_maxX3));
+      if (myid == 0) GbSystem3D::writeGeoObject(refineCube1_1.get(), pathname + "/geo/refineCube1_1", WbWriterVtkXmlBinary::getInstance());
+
+      SPtr<GbObject3D> refineCube1_2(new GbCuboid3D(g_minX1, g_maxX2 - g_maxX2 / k1 + 1.0, g_minX3, g_maxX1, g_maxX2, g_maxX3));
+      if (myid == 0) GbSystem3D::writeGeoObject(refineCube1_2.get(), pathname + "/geo/refineCube1_2", WbWriterVtkXmlBinary::getInstance());
+
+      SPtr<GbObject3D> refineCube2_1(new GbCuboid3D(g_minX1 + 2 * blockLength + 2 * deltax, g_minX2, g_minX3, g_maxX1 - 2 * blockLength - 2 * deltax, g_maxX2 / k2 - 1.0, g_maxX3));
+      if (myid == 0) GbSystem3D::writeGeoObject(refineCube2_1.get(), pathname + "/geo/refineCube2_1", WbWriterVtkXmlBinary::getInstance());
+
+      SPtr<GbObject3D> refineCube2_2(new GbCuboid3D(g_minX1 + 2 * blockLength + 2 * deltax, g_maxX2 - g_maxX2 / k2 + 1.0, g_minX3, g_maxX1 - 2 * blockLength - 2 * deltax, g_maxX2, g_maxX3));
+      if (myid == 0) GbSystem3D::writeGeoObject(refineCube2_2.get(), pathname + "/geo/refineCube2_2", WbWriterVtkXmlBinary::getInstance());
+
+      SPtr<GbObject3D> refineCube2_3(new GbCuboid3D(g_minX1 + blockLength + 2 * deltax, g_minX2 + blockLength + 2 * deltax, g_minX3 + blockLength + 2 * deltax, g_maxX1 - blockLength - 2 * deltax, g_maxX2 - blockLength - 2 * deltax, g_maxX3 - blockLength - 2 * deltax));
+      if (myid == 0) GbSystem3D::writeGeoObject(refineCube2_3.get(), pathname + "/geo/refineCube2_3", WbWriterVtkXmlBinary::getInstance());
+
+      SPtr<GbObject3D> refineCube3(new GbCuboid3D(g_minX1 + 2.0*(g_maxX1/3.0), g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
+      if (myid == 0) GbSystem3D::writeGeoObject(refineCube3.get(), pathname + "/geo/refineCube3", WbWriterVtkXmlBinary::getInstance());
+
+      //////////////////////////////////////////////////////////////////////////
+      //restart
+      //SPtr<UbScheduler> rSch(new UbScheduler(restartStep));
+      //RestartCoProcessor rp(grid, rSch, comm, pathname, RestartCoProcessor::TXT);
+      //////////////////////////////////////////////////////////////////////////
+
+      if (grid->getTimeStep() == 0)
+      {
+         GenBlocksGridVisitor genBlocks(gridCube);
+         grid->accept(genBlocks);
+
+         if (myid == 0)
+         {
+            UBLOG(logINFO, "Parameters:");
+            UBLOG(logINFO, "h = " << h);
+            UBLOG(logINFO, "rho = " << rhoLB);
+            UBLOG(logINFO, "nue = " << nuLB);
+            UBLOG(logINFO, "Re = " << Re);
+            UBLOG(logINFO, "dx = " << deltax);
+            UBLOG(logINFO, "dpLB = " << dpLB);
+            UBLOG(logINFO, "Umax = " << Umax);
+            UBLOG(logINFO, "number of levels = " << refineLevel + 1);
+            UBLOG(logINFO, "numOfThreads = " << numOfThreads);
+            UBLOG(logINFO, "path = " << pathname);
+            UBLOG(logINFO, "Preprozess - start");
+         }
+
+         //walls
+         GbCuboid3DPtr addWallYmin (new GbCuboid3D(g_minX1-4.0*blockLength, g_minX2-4.0*blockLength, g_minX3-4.0*blockLength, g_maxX1+4.0*blockLength, g_minX2, g_maxX3+4.0*blockLength));
+         if(myid == 0) GbSystem3D::writeGeoObject(addWallYmin.get(), pathname+"/geo/addWallYmin", WbWriterVtkXmlASCII::getInstance());
+
+         GbCuboid3DPtr addWallYmax (new GbCuboid3D(g_minX1-4.0*blockLength, g_maxX2, g_minX3-4.0*blockLength, g_maxX1+4.0*blockLength, g_maxX2+4.0*blockLength, g_maxX3+4.0*blockLength));
+         if(myid == 0) GbSystem3D::writeGeoObject(addWallYmax.get(), pathname+"/geo/addWallYmax", WbWriterVtkXmlASCII::getInstance());
+
+         //inflow
+         GbCuboid3DPtr geoInflow(new GbCuboid3D(g_minX1 - 4.0*blockLength, g_minX2 - 4.0*blockLength, g_minX3 - 4.0*blockLength, g_minX1, g_maxX2 + 4.0*blockLength, g_maxX3 + 4.0*blockLength));
+         if (myid == 0) GbSystem3D::writeGeoObject(geoInflow.get(), pathname + "/geo/geoInflow", WbWriterVtkXmlASCII::getInstance());
+
+         //outflow
+         GbCuboid3DPtr geoOutflow(new GbCuboid3D(g_maxX1, g_minX2 - 4.0*blockLength, g_minX3 - 4.0*blockLength, g_maxX1 + 4.0*blockLength, g_maxX2 + 4.0*blockLength, g_maxX3 + 4.0*blockLength));
+         if (myid == 0) GbSystem3D::writeGeoObject(geoOutflow.get(), pathname + "/geo/geoOutflow", WbWriterVtkXmlASCII::getInstance());
+
+         ////inflow
+         //GbCuboid3DPtr geoInflow (new GbCuboid3D(g_minX1-4.0*blockLength, g_minX2-4.0*blockLength, g_minX3-4.0*blockLength, g_maxX1+4.0*blockLength, g_maxX2+4.0*blockLength, g_minX3));
+         //if(myid == 0) GbSystem3D::writeGeoObject(geoInflow.get(), pathname+"/geo/geoInflow", WbWriterVtkXmlASCII::getInstance());
+
+         ////outflow
+         //GbCuboid3DPtr geoOutflow (new GbCuboid3D(g_minX1-4.0*blockLength, g_minX2-4.0*blockLength, g_maxX3, g_maxX1+4.0*blockLength, g_maxX2+4.0*blockLength, g_maxX3+4.0*blockLength));
+         //if(myid == 0) GbSystem3D::writeGeoObject(geoOutflow.get(), pathname+"/geo/geoOutflow", WbWriterVtkXmlASCII::getInstance());
+
+         SPtr<CoProcessor> ppblocks(new WriteBlocksCoProcessor(grid, SPtr<UbScheduler>(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm));
+
+         if (refineLevel > 0)
+         {
+            if (myid == 0) UBLOG(logINFO, "Refinement - start");
+            RefineCrossAndInsideGbObjectHelper refineHelper(grid, refineLevel, comm);
+            //refineHelper.addGbObject(refineCube1_1, 1);
+            //refineHelper.addGbObject(refineCube1_2, 1);
+            //refineHelper.addGbObject(refineCube2_1, 2);
+            //refineHelper.addGbObject(refineCube2_2, 2);
+            //refineHelper.addGbObject(refineCube2_3, refineLevel);
+            refineHelper.addGbObject(refineCube3, refineLevel);
+            
+            refineHelper.refine();
+            if (myid == 0) UBLOG(logINFO, "Refinement - end");
+         }
+
+         //walls
+         SPtr<D3Q27Interactor> addWallYminInt(new D3Q27Interactor(addWallYmin, grid, noSlipBCAdapter,Interactor3D::SOLID));
+         SPtr<D3Q27Interactor> addWallYmaxInt(new D3Q27Interactor(addWallYmax, grid, noSlipBCAdapter,Interactor3D::SOLID));
+
+         SPtr<D3Q27Interactor> inflowInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoInflow, grid, denBCAdapterInflow, Interactor3D::SOLID));
+
+         //outflow
+         SPtr<D3Q27Interactor> outflowInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoOutflow, grid, denBCAdapterOutflow, Interactor3D::SOLID));
+
+         ////////////////////////////////////////////
+         //METIS
+         SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B));
+         ////////////////////////////////////////////
+         /////delete solid blocks
+         if (myid == 0) UBLOG(logINFO, "deleteSolidBlocks - start");
+         InteractorsHelper intHelper(grid, metisVisitor);
+         intHelper.addInteractor(addWallYminInt);
+         intHelper.addInteractor(addWallYmaxInt);
+         intHelper.addInteractor(inflowInt);
+         intHelper.addInteractor(outflowInt);
+         intHelper.selectBlocks();
+         if (myid == 0) UBLOG(logINFO, "deleteSolidBlocks - end");
+         //////////////////////////////////////
+
+         //set connectors
+         InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor());
+         SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
+         grid->accept(setConnsVisitor);
+
+         //domain decomposition for threads
+         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
+         grid->accept(pqPartVisitor);
+
+         ppblocks->process(0);
+         ppblocks.reset();
+
+         unsigned long nob = grid->getNumberOfBlocks();
+         int gl = 3;
+         unsigned long nodb = (blocknx[0]) * (blocknx[1]) * (blocknx[2]);
+         unsigned long nod = nob * (blocknx[0]) * (blocknx[1]) * (blocknx[2]);
+         unsigned long nodg = nob * (blocknx[0] + gl) * (blocknx[1] + gl) * (blocknx[1] + gl);
+         double needMemAll = double(nodg*(27 * sizeof(double) + sizeof(int) + sizeof(float) * 4));
+         double needMem = needMemAll / double(comm->getNumberOfProcesses());
+
+         if (myid == 0)
+         {
+            UBLOG(logINFO, "Number of blocks = " << nob);
+            UBLOG(logINFO, "Number of nodes  = " << nod);
+            int minInitLevel = grid->getCoarsestInitializedLevel();
+            int maxInitLevel = grid->getFinestInitializedLevel();
+            for (int level = minInitLevel; level <= maxInitLevel; level++)
+            {
+               int nobl = grid->getNumberOfBlocks(level);
+               UBLOG(logINFO, "Number of blocks for level " << level << " = " << nobl);
+               UBLOG(logINFO, "Number of nodes for level " << level << " = " << nobl*nodb);
+            }
+            UBLOG(logINFO, "Necessary memory  = " << needMemAll << " bytes");
+            UBLOG(logINFO, "Necessary memory per process = " << needMem << " bytes");
+            UBLOG(logINFO, "Available memory per process = " << availMem << " bytes");
+         }
+
+         int kernelType = 2;
+         SPtr<LBMKernel> kernel;
+         kernel = SPtr<LBMKernel>(new IncompressibleCumulantLBMKernel());
+         //}
+
+         SPtr<BCProcessor> bcProc(new BCProcessor());
+         kernel->setBCProcessor(bcProc);
+
+         SetKernelBlockVisitor kernelVisitor(kernel, nuLB, availMem, needMem);
+         grid->accept(kernelVisitor);
+
+         if (refineLevel > 0)
+         {
+            SetUndefinedNodesBlockVisitor undefNodesVisitor;
+            grid->accept(undefNodesVisitor);
+         }
+
+         //walls
+         intHelper.setBC();
+
+         grid->accept(bcVisitor);
+
+         //initialization of distributions
+         mu::Parser fct;
+         fct.SetExpr("-(1.0/(2.0*nu))*(dp/dx)*((x2-h)^2 - h^2)");
+         fct.DefineConst("dp", dpLB);
+         fct.DefineConst("dx", dex);
+         fct.DefineConst("h", h);
+         fct.DefineConst("nu", nuLB);
+
+         InitDistributionsBlockVisitor initVisitor;
+         //initVisitor.setVx1(fct);
+         initVisitor.setVx1(0.0);
+         //initVisitor.setVx3(fct);
+         grid->accept(initVisitor);
+
+         //Postrozess
+         SPtr<UbScheduler> geoSch(new UbScheduler(1));
+         SPtr<CoProcessor> ppgeo(
+            new WriteBoundaryConditionsCoProcessor(grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, comm));
+         ppgeo->process(0);
+         ppgeo.reset();
+
+         if (myid == 0) UBLOG(logINFO, "Preprozess - end");
+      }
+      else
+      {
+         grid->accept(bcVisitor);
+
+         //set connectors
+         InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor());
+         SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
+         grid->accept(setConnsVisitor);
+
+         if (myid == 0) UBLOG(logINFO, "Restart - end");
+      }
+      SPtr<UbScheduler> nupsSch(new UbScheduler(10, 30, 100));
+      SPtr<NUPSCounterCoProcessor> npr(new NUPSCounterCoProcessor(grid, nupsSch, numOfThreads, comm));
+
+      SPtr<UbScheduler> stepSch(new UbScheduler(outTime));
+
+      SPtr<WriteMacroscopicQuantitiesCoProcessor> writeMQCoProcessor(new WriteMacroscopicQuantitiesCoProcessor(grid, stepSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, comm));
+
+
+      omp_set_num_threads(numOfThreads);
+      SPtr<Calculator> calculator(new BasicCalculator(grid, stepSch, endTime));
+      calculator->addCoProcessor(npr);
+      calculator->addCoProcessor(writeMQCoProcessor);
+
+      if (myid == 0) UBLOG(logINFO, "Simulation-start");
+      calculator->calculate();
+      if (myid == 0) UBLOG(logINFO, "Simulation-end");
+   }
+   catch (std::exception& e)
+   {
+      cerr << e.what() << endl << flush;
+   }
+   catch (std::string& s)
+   {
+      cerr << s << endl;
+   }
+   catch (...)
+   {
+      cerr << "unknown exception" << endl;
+   }
+
+}
+//////////////////////////////////////////////////////////////////////////
+int main(int argc, char* argv[])
+{
+   if (argv != NULL)
+   {
+      if (argv[1] != NULL)
+      {
+         //pflowForcing(string(argv[1]));
+         pflowdp(string(argv[1]));
+      }
+      else
+      {
+         cout << "Configuration file is missing!" << endl;
+      }
+   }
+
+   return 0;
+}
diff --git a/apps/cpu/LaminarTubeFlow/CMakeLists.txt b/apps/cpu/LaminarTubeFlow/CMakeLists.txt
index 2176598fe83b5f6d276c65d8b5fd02c512e2712f..24e6fb397e31bae4856b174798972a0e130acf12 100644
--- a/apps/cpu/LaminarTubeFlow/CMakeLists.txt
+++ b/apps/cpu/LaminarTubeFlow/CMakeLists.txt
@@ -1,7 +1,7 @@
-
-PROJECT(ltf)
-
-vf_add_library(BUILDTYPE binary DEPENDS VirtualFluidsCore muparser basics ${MPI_CXX_LIBRARIES} FILES ltf.cpp )
-
-vf_get_library_name (library_name)
+
+PROJECT(ltf)
+
+vf_add_library(BUILDTYPE binary DEPENDS VirtualFluidsCore muparser basics ${MPI_CXX_LIBRARIES} FILES ltf.cpp )
+
+vf_get_library_name (library_name)
 target_include_directories(${library_name} PRIVATE ${APPS_ROOT_CPU})
\ No newline at end of file
diff --git a/apps/cpu/LaminarTubeFlow/ltf.cfg b/apps/cpu/LaminarTubeFlow/ltf.cfg
index 7f2b8c724b3fa6fee5d376d548fce21123db161a..91ddfb2da46e3e6a207d8240aeb610c5803cc5bb 100644
--- a/apps/cpu/LaminarTubeFlow/ltf.cfg
+++ b/apps/cpu/LaminarTubeFlow/ltf.cfg
@@ -1,26 +1,26 @@
-pathname = d:/temp/LaminarTubeFlow
-numOfThreads = 4
-availMem = 10e9
-
-#Grid
-length = 64 32 32
-#length = 21 6 13
-blocknx = 8 8 8
-dx = 1
-refineLevel = 0
-
-#Simulation
-uLB = 0.1
-Re = 10
-
-
-logToFile = false
-
-newStart = true
-restartStep = 100000
-
-cpStart = 100000
-cpStep = 100000
-
-outTime = 1
+pathname = d:/temp/LaminarTubeFlow
+numOfThreads = 4
+availMem = 10e9
+
+#Grid
+length = 64 32 32
+#length = 21 6 13
+blocknx = 8 8 8
+dx = 1
+refineLevel = 0
+
+#Simulation
+uLB = 0.1
+Re = 10
+
+
+logToFile = false
+
+newStart = true
+restartStep = 100000
+
+cpStart = 100000
+cpStep = 100000
+
+outTime = 1
 endTime = 100
\ No newline at end of file
diff --git a/apps/cpu/LaminarTubeFlow/ltf.cpp b/apps/cpu/LaminarTubeFlow/ltf.cpp
index 91c02485557e671553dc4f3db97dc25332ed0ca1..bb65bc627abdfeb1f9973b9ce8818ceff17029e4 100644
--- a/apps/cpu/LaminarTubeFlow/ltf.cpp
+++ b/apps/cpu/LaminarTubeFlow/ltf.cpp
@@ -1,344 +1,344 @@
-#include <iostream>
-#include <string>
-//#include <omp.h>
-
-#include "VirtualFluids.h"
-
-using namespace std;
-
-
-void run(string configname)
-{
-   try
-   {
-      ConfigurationFile   config;
-      config.load(configname);
-
-      string          pathname = config.getValue<string>("pathname");
-      int             numOfThreads = config.getValue<int>("numOfThreads");
-      vector<int>     blocknx = config.getVector<int>("blocknx");
-      double          uLB = config.getValue<double>("uLB");
-      double          endTime = config.getValue<double>("endTime");
-      double          outTime = config.getValue<double>("outTime");
-      double          availMem = config.getValue<double>("availMem");
-      int             refineLevel = config.getValue<int>("refineLevel");
-      double          Re = config.getValue<double>("Re");
-      double          dx = config.getValue<double>("dx");
-      vector<double>  length = config.getVector<double>("length");
-      bool            logToFile = config.getValue<bool>("logToFile");
-      double          restartStep = config.getValue<double>("restartStep");
-      double          cpStart = config.getValue<double>("cpStart");
-      double          cpStep = config.getValue<double>("cpStep");
-      bool            newStart = config.getValue<bool>("newStart");
-
-      SPtr<Communicator> comm = MPICommunicator::getInstance();
-      int myid = comm->getProcessID();
-
-      if (logToFile)
-      {
-#if defined(__unix__)
-         if (myid == 0)
-         {
-            const char* str = pathname.c_str();
-            mkdir(str, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
-         }
-#endif 
-
-         if (myid == 0)
-         {
-            stringstream logFilename;
-            logFilename << pathname + "/logfile" + UbSystem::toString(UbSystem::getTimeStamp()) + ".txt";
-            UbLog::output_policy::setStream(logFilename.str());
-         }
-      }
-
-      //Sleep(30000);
-
-      LBMReal dLB = length[1] / dx;
-      LBMReal rhoLB = 0.0;
-      LBMReal nuLB = (uLB*dLB) / Re;
-
-      SPtr<LBMUnitConverter> conv = SPtr<LBMUnitConverter>(new LBMUnitConverter());
-
-      const int baseLevel = 0;
-
-      //BC Adapter
-      //////////////////////////////////////////////////////////////////////////////
-      SPtr<BCAdapter> noSlipBCAdapter(new NoSlipBCAdapter());
-      //noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new ThinWallNoSlipBCAlgorithm()));
-      //SPtr<BCAdapter> denBCAdapter(new DensityBCAdapter(rhoLB));
-      //denBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new EqDensityBCAlgorithm()));
-
-      noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NoSlipBCAlgorithm()));
-
-      SPtr<BCAdapter> denBCAdapter(new DensityBCAdapter(rhoLB));
-      //denBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NonReflectingOutflowBCAlgorithm()));
-      denBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NonEqDensityBCAlgorithm()));
-
-      //mu::Parser fct;
-      //fct.SetExpr("U");
-      //fct.DefineConst("U", uLB);
-      //SPtr<BCAdapter> velBCAdapter(new VelocityBCAdapter(true, false, false, fct, 0, BCFunction::INFCONST));
-      //velBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NonReflectingVelocityBCAlgorithm()));
-
-
-      //////////////////////////////////////////////////////////////////////////////////
-      //BS visitor
-      BoundaryConditionsBlockVisitor bcVisitor;
-      bcVisitor.addBC(noSlipBCAdapter);
-      bcVisitor.addBC(denBCAdapter);
-      //bcVisitor.addBC(velBCAdapter);
-
-      SPtr<Grid3D> grid(new Grid3D(comm));
-
-      SPtr<BCProcessor> bcProc;
-      bcProc = SPtr<BCProcessor>(new BCProcessor());
-
-      SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new CompressibleCumulant4thOrderViscosityLBMKernel());
-      double bulckViscosity = 3700*nuLB;
-      dynamicPointerCast<CompressibleCumulant4thOrderViscosityLBMKernel>(kernel)->setBulkViscosity(bulckViscosity);
-      kernel->setBCProcessor(bcProc);
-      kernel->setBCProcessor(bcProc);
-
-      //////////////////////////////////////////////////////////////////////////
-      //restart
-      SPtr<UbScheduler> mSch(new UbScheduler(cpStep, cpStart));
-      SPtr<MPIIOMigrationCoProcessor> migCoProcessor(new MPIIOMigrationCoProcessor(grid, mSch, pathname + "/mig", comm));
-      migCoProcessor->setLBMKernel(kernel);
-      migCoProcessor->setBCProcessor(bcProc);
-      //////////////////////////////////////////////////////////////////////////
-
-      if (newStart)
-      {
-
-         //bounding box
-         double g_minX1 = 0.0;
-         double g_minX2 = -length[1] / 2.0;
-         double g_minX3 = -length[2] / 2.0;
-
-         double g_maxX1 = length[0];
-         double g_maxX2 = length[1] / 2.0;
-         double g_maxX3 = length[2] / 2.0;
-
-         //geometry
-         //x
-         //SPtr<GbObject3D> cylinder(new GbCylinder3D(g_minX1 - 2.0*dx, 0.0, 0.0, g_maxX1 + 2.0*dx, 0.0, 0.0, dLB / 2.0));
-         //y
-         SPtr<GbObject3D> cylinder(new GbCylinder3D(g_minX1 - 2.0*dx, 0.0, 0.0, g_maxX1 + 2.0*dx, 0.0, 0.0, dLB / 2.0));
-         GbSystem3D::writeGeoObject(cylinder.get(), pathname + "/geo/cylinder", WbWriterVtkXmlBinary::getInstance());
-
-         SPtr<GbObject3D> gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
-         if (myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), pathname + "/geo/gridCube", WbWriterVtkXmlBinary::getInstance());
-
-
-         double blockLength = blocknx[0] * dx;
-
-
-
-         if (myid == 0)
-         {
-            UBLOG(logINFO, "uLb = " << uLB);
-            UBLOG(logINFO, "rho = " << rhoLB);
-            UBLOG(logINFO, "nuLb = " << nuLB);
-            UBLOG(logINFO, "Re = " << Re);
-            UBLOG(logINFO, "dx = " << dx);
-            UBLOG(logINFO, "Preprocess - start");
-         }
-
-         grid->setDeltaX(dx);
-         grid->setBlockNX(blocknx[0], blocknx[1], blocknx[2]);
-
-         grid->setPeriodicX1(false);
-         grid->setPeriodicX2(true);
-         grid->setPeriodicX3(false);
-
-         if (myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), pathname + "/geo/gridCube", WbWriterVtkXmlBinary::getInstance());
-
-         GenBlocksGridVisitor genBlocks(gridCube);
-         grid->accept(genBlocks);
-
-         ////inflow
-         //GbCuboid3DPtr geoInflow(new GbCuboid3D(g_minX1 - 2.0*dx, g_minX2 - dx, g_minX3 - dx, g_minX1, g_maxX2, g_maxX3 + dx));
-         //if (myid == 0) GbSystem3D::writeGeoObject(geoInflow.get(), pathname + "/geo/geoInflow", WbWriterVtkXmlASCII::getInstance());
-
-         ////outflow
-         //GbCuboid3DPtr geoOutflow(new GbCuboid3D(g_maxX1, g_minX2, g_minX3 - dx, g_maxX1 + 2.0*dx, g_maxX2 + dx, g_maxX3 + dx));
-         //if (myid == 0) GbSystem3D::writeGeoObject(geoOutflow.get(), pathname + "/geo/geoOutflow", WbWriterVtkXmlASCII::getInstance());
-
-         //inflow
-         GbCuboid3DPtr geoInflow(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3-blockLength, g_minX1, g_maxX2+blockLength, g_maxX3+blockLength));
-         if (myid==0) GbSystem3D::writeGeoObject(geoInflow.get(), pathname+"/geo/geoInflow", WbWriterVtkXmlASCII::getInstance());
-
-         //outflow
-         GbCuboid3DPtr geoOutflow(new GbCuboid3D(g_maxX1, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength));
-         if (myid==0) GbSystem3D::writeGeoObject(geoOutflow.get(), pathname+"/geo/geoOutflow", WbWriterVtkXmlASCII::getInstance());
-
-         SPtr<CoProcessor> ppblocks(new WriteBlocksCoProcessor(grid, SPtr<UbScheduler>(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm));
-
-         ppblocks->process(0);
-
-         SPtr<D3Q27Interactor> cylinderInt(new D3Q27Interactor(cylinder, grid, noSlipBCAdapter, Interactor3D::INVERSESOLID));
-
-         double r = dynamicPointerCast<GbCylinder3D>(cylinder)->getRadius();
-         double cx1 = g_minX1;
-         double cx2 = cylinder->getX2Centroid();
-         double cx3 = cylinder->getX3Centroid();
-
-         mu::Parser fct;
-         fct.SetExpr("vx1");
-         //fct.SetExpr("vx1*(1-((x2-y0)^2+(x3-z0)^2)/(R^2))");
-         //fct.DefineConst("x2Vmax", 0.0); //x2-Pos fuer vmax
-         //fct.DefineConst("x3Vmax", 0.0); //x3-Pos fuer vmax
-         //fct.DefineConst("R", r);
-         fct.DefineConst("vx1", uLB);
-         //fct.DefineConst("x0", cx1);
-         //fct.DefineConst("y0", cx2);
-         //fct.DefineConst("z0", cx3);
-         //fct.DefineConst("nue", nuLB);
-         SPtr<BCAdapter> velBCAdapter(new VelocityBCAdapter(true, false, false, fct, 0, BCFunction::INFCONST));
-         velBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new VelocityBCAlgorithm()));
-         //velBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new VelocityWithDensityBCAlgorithm()));
-         SPtr<D3Q27Interactor> inflowInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoInflow, grid, velBCAdapter, Interactor3D::SOLID));
-
-         //outflow
-         SPtr<D3Q27Interactor> outflowInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoOutflow, grid, denBCAdapter, Interactor3D::SOLID));
-
-         SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B));
-         InteractorsHelper intHelper(grid, metisVisitor);
-         intHelper.addInteractor(cylinderInt);
-         intHelper.addInteractor(inflowInt);
-         intHelper.addInteractor(outflowInt);
-         intHelper.selectBlocks();
-
-         ppblocks->process(0);
-         ppblocks.reset();
-
-         unsigned long long numberOfBlocks = (unsigned long long)grid->getNumberOfBlocks();
-         int ghostLayer = 3;
-         unsigned long long numberOfNodesPerBlock = (unsigned long long)(blocknx[0])* (unsigned long long)(blocknx[1])* (unsigned long long)(blocknx[2]);
-         unsigned long long numberOfNodes = numberOfBlocks * numberOfNodesPerBlock;
-         unsigned long long numberOfNodesPerBlockWithGhostLayer = numberOfBlocks * (blocknx[0] + ghostLayer) * (blocknx[1] + ghostLayer) * (blocknx[2] + ghostLayer);
-         double needMemAll = double(numberOfNodesPerBlockWithGhostLayer*(27 * sizeof(double) + sizeof(int) + sizeof(float) * 4));
-         double needMem = needMemAll / double(comm->getNumberOfProcesses());
-
-         if (myid == 0)
-         {
-            UBLOG(logINFO, "Number of blocks = " << numberOfBlocks);
-            UBLOG(logINFO, "Number of nodes  = " << numberOfNodes);
-            int minInitLevel = grid->getCoarsestInitializedLevel();
-            int maxInitLevel = grid->getFinestInitializedLevel();
-            for (int level = minInitLevel; level <= maxInitLevel; level++)
-            {
-               int nobl = grid->getNumberOfBlocks(level);
-               UBLOG(logINFO, "Number of blocks for level " << level << " = " << nobl);
-               UBLOG(logINFO, "Number of nodes for level " << level << " = " << nobl*numberOfNodesPerBlock);
-            }
-            UBLOG(logINFO, "Necessary memory  = " << needMemAll << " bytes");
-            UBLOG(logINFO, "Necessary memory per process = " << needMem << " bytes");
-            UBLOG(logINFO, "Available memory per process = " << availMem << " bytes");
-         }
-
-         SetKernelBlockVisitor kernelVisitor(kernel, nuLB, availMem, needMem);
-         grid->accept(kernelVisitor);
-
-         if (refineLevel > 0)
-         {
-            SetUndefinedNodesBlockVisitor undefNodesVisitor;
-            grid->accept(undefNodesVisitor);
-         }
-
-         intHelper.setBC();
-
-         bcVisitor.addBC(velBCAdapter);
-         grid->accept(bcVisitor);
-
-         //initialization of distributions
-         InitDistributionsBlockVisitor initVisitor;
-         //initVisitor.setVx1(fct);
-         //initVisitor.setVx1(uLB);
-         grid->accept(initVisitor);
-
-         //boundary conditions grid
-         {
-            SPtr<UbScheduler> geoSch(new UbScheduler(1));
-            SPtr<CoProcessor> ppgeo(new WriteBoundaryConditionsCoProcessor(grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), comm));
-            ppgeo->process(0);
-            ppgeo.reset();
-         }
-
-         if (myid == 0) UBLOG(logINFO, "Preprocess - end");
-      }
-      else
-      {
-         if (myid == 0)
-         {
-            UBLOG(logINFO, "Parameters:");
-            UBLOG(logINFO, "uLb = " << uLB);
-            UBLOG(logINFO, "rho = " << rhoLB);
-            UBLOG(logINFO, "nuLb = " << nuLB);
-            UBLOG(logINFO, "Re = " << Re);
-            UBLOG(logINFO, "dx = " << dx);
-            UBLOG(logINFO, "number of levels = " << refineLevel + 1);
-            UBLOG(logINFO, "numOfThreads = " << numOfThreads);
-            UBLOG(logINFO, "path = " << pathname);
-         }
-
-         migCoProcessor->restart((int)restartStep);
-         grid->setTimeStep(restartStep);
-
-         if (myid == 0) UBLOG(logINFO, "Restart - end");
-      }
-
-      SPtr<InterpolationProcessor> iProcessor(new CompressibleOffsetMomentsInterpolationProcessor());
-      dynamicPointerCast<CompressibleOffsetMomentsInterpolationProcessor>(iProcessor)->setBulkViscosity(nuLB, bulckViscosity);
-      SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
-      grid->accept(setConnsVisitor);
-
-      SPtr<UbScheduler> visSch(new UbScheduler(outTime));
-      SPtr<CoProcessor> pp(new WriteMacroscopicQuantitiesCoProcessor(grid, visSch, pathname, WbWriterVtkXmlASCII::getInstance(), conv, comm));
-
-      SPtr<UbScheduler> nupsSch(new UbScheduler(100, 100, 100000000));
-      SPtr<CoProcessor> npr(new NUPSCounterCoProcessor(grid, nupsSch, numOfThreads, comm));
-
-      //omp_set_num_threads(numOfThreads);
-      numOfThreads = 1;
-      SPtr<UbScheduler> stepGhostLayer(visSch);
-      SPtr<Calculator> calculator(new BasicCalculator(grid, stepGhostLayer, endTime));
-      calculator->addCoProcessor(npr);
-      calculator->addCoProcessor(pp);
-      calculator->addCoProcessor(migCoProcessor);
-
-      if (myid == 0) UBLOG(logINFO, "Simulation-start");
-      calculator->calculate();
-      if (myid == 0) UBLOG(logINFO, "Simulation-end");
-   }
-   catch (std::exception& e)
-   {
-      cerr << e.what() << endl << flush;
-   }
-   catch (std::string& s)
-   {
-      cerr << s << endl;
-   }
-   catch (...)
-   {
-      cerr << "unknown exception" << endl;
-   }
-
-}
-int main(int argc, char* argv[])
-{
-   if (argv != NULL)
-   {
-      if (argv[1] != NULL)
-      {
-         run(string(argv[1]));
-      }
-      else
-      {
-         cout << "Configuration file is missing!" << endl;
-      }
-   }
-
-}
-
+#include <iostream>
+#include <string>
+//#include <omp.h>
+
+#include "VirtualFluids.h"
+
+using namespace std;
+
+
+void run(string configname)
+{
+   try
+   {
+      ConfigurationFile   config;
+      config.load(configname);
+
+      string          pathname = config.getValue<string>("pathname");
+      int             numOfThreads = config.getValue<int>("numOfThreads");
+      vector<int>     blocknx = config.getVector<int>("blocknx");
+      double          uLB = config.getValue<double>("uLB");
+      double          endTime = config.getValue<double>("endTime");
+      double          outTime = config.getValue<double>("outTime");
+      double          availMem = config.getValue<double>("availMem");
+      int             refineLevel = config.getValue<int>("refineLevel");
+      double          Re = config.getValue<double>("Re");
+      double          dx = config.getValue<double>("dx");
+      vector<double>  length = config.getVector<double>("length");
+      bool            logToFile = config.getValue<bool>("logToFile");
+      double          restartStep = config.getValue<double>("restartStep");
+      double          cpStart = config.getValue<double>("cpStart");
+      double          cpStep = config.getValue<double>("cpStep");
+      bool            newStart = config.getValue<bool>("newStart");
+
+      SPtr<Communicator> comm = MPICommunicator::getInstance();
+      int myid = comm->getProcessID();
+
+      if (logToFile)
+      {
+#if defined(__unix__)
+         if (myid == 0)
+         {
+            const char* str = pathname.c_str();
+            mkdir(str, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
+         }
+#endif 
+
+         if (myid == 0)
+         {
+            stringstream logFilename;
+            logFilename << pathname + "/logfile" + UbSystem::toString(UbSystem::getTimeStamp()) + ".txt";
+            UbLog::output_policy::setStream(logFilename.str());
+         }
+      }
+
+      //Sleep(30000);
+
+      LBMReal dLB = length[1] / dx;
+      LBMReal rhoLB = 0.0;
+      LBMReal nuLB = (uLB*dLB) / Re;
+
+      SPtr<LBMUnitConverter> conv = SPtr<LBMUnitConverter>(new LBMUnitConverter());
+
+      const int baseLevel = 0;
+
+      //BC Adapter
+      //////////////////////////////////////////////////////////////////////////////
+      SPtr<BCAdapter> noSlipBCAdapter(new NoSlipBCAdapter());
+      //noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new ThinWallNoSlipBCAlgorithm()));
+      //SPtr<BCAdapter> denBCAdapter(new DensityBCAdapter(rhoLB));
+      //denBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new EqDensityBCAlgorithm()));
+
+      noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NoSlipBCAlgorithm()));
+
+      SPtr<BCAdapter> denBCAdapter(new DensityBCAdapter(rhoLB));
+      //denBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NonReflectingOutflowBCAlgorithm()));
+      denBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NonEqDensityBCAlgorithm()));
+
+      //mu::Parser fct;
+      //fct.SetExpr("U");
+      //fct.DefineConst("U", uLB);
+      //SPtr<BCAdapter> velBCAdapter(new VelocityBCAdapter(true, false, false, fct, 0, BCFunction::INFCONST));
+      //velBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NonReflectingVelocityBCAlgorithm()));
+
+
+      //////////////////////////////////////////////////////////////////////////////////
+      //BS visitor
+      BoundaryConditionsBlockVisitor bcVisitor;
+      bcVisitor.addBC(noSlipBCAdapter);
+      bcVisitor.addBC(denBCAdapter);
+      //bcVisitor.addBC(velBCAdapter);
+
+      SPtr<Grid3D> grid(new Grid3D(comm));
+
+      SPtr<BCProcessor> bcProc;
+      bcProc = SPtr<BCProcessor>(new BCProcessor());
+
+      SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new CompressibleCumulant4thOrderViscosityLBMKernel());
+      double bulckViscosity = 3700*nuLB;
+      dynamicPointerCast<CompressibleCumulant4thOrderViscosityLBMKernel>(kernel)->setBulkViscosity(bulckViscosity);
+      kernel->setBCProcessor(bcProc);
+      kernel->setBCProcessor(bcProc);
+
+      //////////////////////////////////////////////////////////////////////////
+      //restart
+      SPtr<UbScheduler> mSch(new UbScheduler(cpStep, cpStart));
+      SPtr<MPIIOMigrationCoProcessor> migCoProcessor(new MPIIOMigrationCoProcessor(grid, mSch, pathname + "/mig", comm));
+      migCoProcessor->setLBMKernel(kernel);
+      migCoProcessor->setBCProcessor(bcProc);
+      //////////////////////////////////////////////////////////////////////////
+
+      if (newStart)
+      {
+
+         //bounding box
+         double g_minX1 = 0.0;
+         double g_minX2 = -length[1] / 2.0;
+         double g_minX3 = -length[2] / 2.0;
+
+         double g_maxX1 = length[0];
+         double g_maxX2 = length[1] / 2.0;
+         double g_maxX3 = length[2] / 2.0;
+
+         //geometry
+         //x
+         //SPtr<GbObject3D> cylinder(new GbCylinder3D(g_minX1 - 2.0*dx, 0.0, 0.0, g_maxX1 + 2.0*dx, 0.0, 0.0, dLB / 2.0));
+         //y
+         SPtr<GbObject3D> cylinder(new GbCylinder3D(g_minX1 - 2.0*dx, 0.0, 0.0, g_maxX1 + 2.0*dx, 0.0, 0.0, dLB / 2.0));
+         GbSystem3D::writeGeoObject(cylinder.get(), pathname + "/geo/cylinder", WbWriterVtkXmlBinary::getInstance());
+
+         SPtr<GbObject3D> gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
+         if (myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), pathname + "/geo/gridCube", WbWriterVtkXmlBinary::getInstance());
+
+
+         double blockLength = blocknx[0] * dx;
+
+
+
+         if (myid == 0)
+         {
+            UBLOG(logINFO, "uLb = " << uLB);
+            UBLOG(logINFO, "rho = " << rhoLB);
+            UBLOG(logINFO, "nuLb = " << nuLB);
+            UBLOG(logINFO, "Re = " << Re);
+            UBLOG(logINFO, "dx = " << dx);
+            UBLOG(logINFO, "Preprocess - start");
+         }
+
+         grid->setDeltaX(dx);
+         grid->setBlockNX(blocknx[0], blocknx[1], blocknx[2]);
+
+         grid->setPeriodicX1(false);
+         grid->setPeriodicX2(true);
+         grid->setPeriodicX3(false);
+
+         if (myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), pathname + "/geo/gridCube", WbWriterVtkXmlBinary::getInstance());
+
+         GenBlocksGridVisitor genBlocks(gridCube);
+         grid->accept(genBlocks);
+
+         ////inflow
+         //GbCuboid3DPtr geoInflow(new GbCuboid3D(g_minX1 - 2.0*dx, g_minX2 - dx, g_minX3 - dx, g_minX1, g_maxX2, g_maxX3 + dx));
+         //if (myid == 0) GbSystem3D::writeGeoObject(geoInflow.get(), pathname + "/geo/geoInflow", WbWriterVtkXmlASCII::getInstance());
+
+         ////outflow
+         //GbCuboid3DPtr geoOutflow(new GbCuboid3D(g_maxX1, g_minX2, g_minX3 - dx, g_maxX1 + 2.0*dx, g_maxX2 + dx, g_maxX3 + dx));
+         //if (myid == 0) GbSystem3D::writeGeoObject(geoOutflow.get(), pathname + "/geo/geoOutflow", WbWriterVtkXmlASCII::getInstance());
+
+         //inflow
+         GbCuboid3DPtr geoInflow(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3-blockLength, g_minX1, g_maxX2+blockLength, g_maxX3+blockLength));
+         if (myid==0) GbSystem3D::writeGeoObject(geoInflow.get(), pathname+"/geo/geoInflow", WbWriterVtkXmlASCII::getInstance());
+
+         //outflow
+         GbCuboid3DPtr geoOutflow(new GbCuboid3D(g_maxX1, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength));
+         if (myid==0) GbSystem3D::writeGeoObject(geoOutflow.get(), pathname+"/geo/geoOutflow", WbWriterVtkXmlASCII::getInstance());
+
+         SPtr<CoProcessor> ppblocks(new WriteBlocksCoProcessor(grid, SPtr<UbScheduler>(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm));
+
+         ppblocks->process(0);
+
+         SPtr<D3Q27Interactor> cylinderInt(new D3Q27Interactor(cylinder, grid, noSlipBCAdapter, Interactor3D::INVERSESOLID));
+
+         double r = dynamicPointerCast<GbCylinder3D>(cylinder)->getRadius();
+         double cx1 = g_minX1;
+         double cx2 = cylinder->getX2Centroid();
+         double cx3 = cylinder->getX3Centroid();
+
+         mu::Parser fct;
+         fct.SetExpr("vx1");
+         //fct.SetExpr("vx1*(1-((x2-y0)^2+(x3-z0)^2)/(R^2))");
+         //fct.DefineConst("x2Vmax", 0.0); //x2-Pos fuer vmax
+         //fct.DefineConst("x3Vmax", 0.0); //x3-Pos fuer vmax
+         //fct.DefineConst("R", r);
+         fct.DefineConst("vx1", uLB);
+         //fct.DefineConst("x0", cx1);
+         //fct.DefineConst("y0", cx2);
+         //fct.DefineConst("z0", cx3);
+         //fct.DefineConst("nue", nuLB);
+         SPtr<BCAdapter> velBCAdapter(new VelocityBCAdapter(true, false, false, fct, 0, BCFunction::INFCONST));
+         velBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new VelocityBCAlgorithm()));
+         //velBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new VelocityWithDensityBCAlgorithm()));
+         SPtr<D3Q27Interactor> inflowInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoInflow, grid, velBCAdapter, Interactor3D::SOLID));
+
+         //outflow
+         SPtr<D3Q27Interactor> outflowInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoOutflow, grid, denBCAdapter, Interactor3D::SOLID));
+
+         SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B));
+         InteractorsHelper intHelper(grid, metisVisitor);
+         intHelper.addInteractor(cylinderInt);
+         intHelper.addInteractor(inflowInt);
+         intHelper.addInteractor(outflowInt);
+         intHelper.selectBlocks();
+
+         ppblocks->process(0);
+         ppblocks.reset();
+
+         unsigned long long numberOfBlocks = (unsigned long long)grid->getNumberOfBlocks();
+         int ghostLayer = 3;
+         unsigned long long numberOfNodesPerBlock = (unsigned long long)(blocknx[0])* (unsigned long long)(blocknx[1])* (unsigned long long)(blocknx[2]);
+         unsigned long long numberOfNodes = numberOfBlocks * numberOfNodesPerBlock;
+         unsigned long long numberOfNodesPerBlockWithGhostLayer = numberOfBlocks * (blocknx[0] + ghostLayer) * (blocknx[1] + ghostLayer) * (blocknx[2] + ghostLayer);
+         double needMemAll = double(numberOfNodesPerBlockWithGhostLayer*(27 * sizeof(double) + sizeof(int) + sizeof(float) * 4));
+         double needMem = needMemAll / double(comm->getNumberOfProcesses());
+
+         if (myid == 0)
+         {
+            UBLOG(logINFO, "Number of blocks = " << numberOfBlocks);
+            UBLOG(logINFO, "Number of nodes  = " << numberOfNodes);
+            int minInitLevel = grid->getCoarsestInitializedLevel();
+            int maxInitLevel = grid->getFinestInitializedLevel();
+            for (int level = minInitLevel; level <= maxInitLevel; level++)
+            {
+               int nobl = grid->getNumberOfBlocks(level);
+               UBLOG(logINFO, "Number of blocks for level " << level << " = " << nobl);
+               UBLOG(logINFO, "Number of nodes for level " << level << " = " << nobl*numberOfNodesPerBlock);
+            }
+            UBLOG(logINFO, "Necessary memory  = " << needMemAll << " bytes");
+            UBLOG(logINFO, "Necessary memory per process = " << needMem << " bytes");
+            UBLOG(logINFO, "Available memory per process = " << availMem << " bytes");
+         }
+
+         SetKernelBlockVisitor kernelVisitor(kernel, nuLB, availMem, needMem);
+         grid->accept(kernelVisitor);
+
+         if (refineLevel > 0)
+         {
+            SetUndefinedNodesBlockVisitor undefNodesVisitor;
+            grid->accept(undefNodesVisitor);
+         }
+
+         intHelper.setBC();
+
+         bcVisitor.addBC(velBCAdapter);
+         grid->accept(bcVisitor);
+
+         //initialization of distributions
+         InitDistributionsBlockVisitor initVisitor;
+         //initVisitor.setVx1(fct);
+         //initVisitor.setVx1(uLB);
+         grid->accept(initVisitor);
+
+         //boundary conditions grid
+         {
+            SPtr<UbScheduler> geoSch(new UbScheduler(1));
+            SPtr<CoProcessor> ppgeo(new WriteBoundaryConditionsCoProcessor(grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), comm));
+            ppgeo->process(0);
+            ppgeo.reset();
+         }
+
+         if (myid == 0) UBLOG(logINFO, "Preprocess - end");
+      }
+      else
+      {
+         if (myid == 0)
+         {
+            UBLOG(logINFO, "Parameters:");
+            UBLOG(logINFO, "uLb = " << uLB);
+            UBLOG(logINFO, "rho = " << rhoLB);
+            UBLOG(logINFO, "nuLb = " << nuLB);
+            UBLOG(logINFO, "Re = " << Re);
+            UBLOG(logINFO, "dx = " << dx);
+            UBLOG(logINFO, "number of levels = " << refineLevel + 1);
+            UBLOG(logINFO, "numOfThreads = " << numOfThreads);
+            UBLOG(logINFO, "path = " << pathname);
+         }
+
+         migCoProcessor->restart((int)restartStep);
+         grid->setTimeStep(restartStep);
+
+         if (myid == 0) UBLOG(logINFO, "Restart - end");
+      }
+
+      SPtr<InterpolationProcessor> iProcessor(new CompressibleOffsetMomentsInterpolationProcessor());
+      dynamicPointerCast<CompressibleOffsetMomentsInterpolationProcessor>(iProcessor)->setBulkViscosity(nuLB, bulckViscosity);
+      SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
+      grid->accept(setConnsVisitor);
+
+      SPtr<UbScheduler> visSch(new UbScheduler(outTime));
+      SPtr<CoProcessor> pp(new WriteMacroscopicQuantitiesCoProcessor(grid, visSch, pathname, WbWriterVtkXmlASCII::getInstance(), conv, comm));
+
+      SPtr<UbScheduler> nupsSch(new UbScheduler(100, 100, 100000000));
+      SPtr<CoProcessor> npr(new NUPSCounterCoProcessor(grid, nupsSch, numOfThreads, comm));
+
+      //omp_set_num_threads(numOfThreads);
+      numOfThreads = 1;
+      SPtr<UbScheduler> stepGhostLayer(visSch);
+      SPtr<Calculator> calculator(new BasicCalculator(grid, stepGhostLayer, endTime));
+      calculator->addCoProcessor(npr);
+      calculator->addCoProcessor(pp);
+      calculator->addCoProcessor(migCoProcessor);
+
+      if (myid == 0) UBLOG(logINFO, "Simulation-start");
+      calculator->calculate();
+      if (myid == 0) UBLOG(logINFO, "Simulation-end");
+   }
+   catch (std::exception& e)
+   {
+      cerr << e.what() << endl << flush;
+   }
+   catch (std::string& s)
+   {
+      cerr << s << endl;
+   }
+   catch (...)
+   {
+      cerr << "unknown exception" << endl;
+   }
+
+}
+int main(int argc, char* argv[])
+{
+   if (argv != NULL)
+   {
+      if (argv[1] != NULL)
+      {
+         run(string(argv[1]));
+      }
+      else
+      {
+         cout << "Configuration file is missing!" << endl;
+      }
+   }
+
+}
+
diff --git a/apps/cpu/LaminarTubeFlowConv/CMakeLists.txt b/apps/cpu/LaminarTubeFlowConv/CMakeLists.txt
index 31cf787822aedf1f4c43cc6a1eb20a722209306f..268e5b925c04e8a88efcc5acf0f4b0c5b09da11b 100644
--- a/apps/cpu/LaminarTubeFlowConv/CMakeLists.txt
+++ b/apps/cpu/LaminarTubeFlowConv/CMakeLists.txt
@@ -1,25 +1,25 @@
-CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
-
-########################################################
-## C++ PROJECT                                       ###
-########################################################
-PROJECT(ltfc)
-
-INCLUDE(${SOURCE_ROOT}/lib/IncludsList.txt) 
-
-#################################################################
-###   LOCAL FILES                                             ###
-#################################################################
-FILE(GLOB SPECIFIC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.h
-                         ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
-                         ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp  )
- 
-SET(ALL_SOURCES ${ALL_SOURCES} ${SPECIFIC_FILES})
-SOURCE_GROUP(src FILES ${SPECIFIC_FILES})
-  
-SET(CAB_ADDITIONAL_LINK_LIBRARIES vfluids)
-
-#################################################################
-###   CREATE PROJECT                                          ###
-#################################################################
-CREATE_CAB_PROJECT(ltfc BINARY)
+CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
+
+########################################################
+## C++ PROJECT                                       ###
+########################################################
+PROJECT(ltfc)
+
+INCLUDE(${SOURCE_ROOT}/lib/IncludsList.txt) 
+
+#################################################################
+###   LOCAL FILES                                             ###
+#################################################################
+FILE(GLOB SPECIFIC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.h
+                         ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
+                         ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp  )
+ 
+SET(ALL_SOURCES ${ALL_SOURCES} ${SPECIFIC_FILES})
+SOURCE_GROUP(src FILES ${SPECIFIC_FILES})
+  
+SET(CAB_ADDITIONAL_LINK_LIBRARIES vfluids)
+
+#################################################################
+###   CREATE PROJECT                                          ###
+#################################################################
+CREATE_CAB_PROJECT(ltfc BINARY)
diff --git a/apps/cpu/LaminarTubeFlowConv/ltf.cpp b/apps/cpu/LaminarTubeFlowConv/ltf.cpp
index 44ed43de11db630ea185b6db89fbe70f420b6cce..6c20cdea96b775b9ae3314daa628c26774c30788 100644
--- a/apps/cpu/LaminarTubeFlowConv/ltf.cpp
+++ b/apps/cpu/LaminarTubeFlowConv/ltf.cpp
@@ -1,279 +1,279 @@
-#include <iostream>
-#include <string>
-
-#include "vfluids.h"
-
-using namespace std;
-
-
-int x[3] = { 120, 240, 480 };
-int y[3] = { 20, 40, 80 };
-int z[3] = { 20, 40, 80 };
-
-//int x[3] = { 120, 120, 120 };
-//int y[3] = { 20, 20, 20 };
-//int z[3] = { 20, 20, 20 };
-double nuLB = 0.001;
-double dp[3] = { 25000.0, 100000.0, 400000.0 };
-double tout[3] = { 4000.0, 16000.0, 64000.0 };
-double tend[3] = { 100001.0, 400001.0, 1600001.0 };
-//double deltax[3] = { 1.0, 0.5, 0.25 };
-double deltax[3] = { 1.0, 1.0, 1.0 };
-
-
-void run(int tn)
-{
-   try
-   {
-      string machine = QUOTEME(CAB_MACHINE);
-      string pathname; 
-      int numOfThreads = 1;
-      double availMem = 0;
-
-      CommunicatorPtr comm = MPICommunicator::getInstance();
-      int myid = comm->getProcessID();
-
-      if(machine == "BOMBADIL") 
-      {
-         pathname = "d:/temp/ltfc" + UbSystem::toString(tn);
-         numOfThreads = 1;
-         availMem = 3.0e9;
-      }
-      else if(machine == "M01" || machine == "M02")      
-      {
-         pathname = "/work/koskuche/scratch/ltfc"+UbSystem::toString(tn);
-         numOfThreads = 8;
-         availMem = 12.0e9;
-
-#if defined(__unix__)
-         if (myid == 0)
-         {
-            const char* str = pathname.c_str();
-            int status = mkdir(str, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
-         }
-#endif 
-
-         if(myid ==0)
-         {
-            stringstream logFilename;
-            logFilename << pathname + "/logfile" + UbSystem::toString(UbSystem::getTimeStamp()) + "_" + UbSystem::toString(myid) + ".txt";
-            UbLog::output_policy::setStream(logFilename.str());
-         }
-      }
-      else throw UbException(UB_EXARGS, "unknown CAB_MACHINE");
-
-      double dx = deltax[tn];
-
-      double L1 = x[tn];
-      double L2 = y[tn];
-      double L3 = z[tn];
-
-      LBMReal dLB = L2;
-      LBMReal rhoLB = 0.0;
-      LBMReal l = L2 / dx;
-
-
-      LBMUnitConverterPtr conv = LBMUnitConverterPtr(new LBMUnitConverter());
-
-      const int baseLevel = 0;
-      const int refineLevel = 0;
-
-      //bounding box
-      double g_minX1 = 0.0;
-      double g_minX2 = -L2 / 2.0;
-      double g_minX3 = -L3 / 2.0;
-
-      double g_maxX1 = L1;
-      double g_maxX2 = L2 / 2.0;
-      double g_maxX3 = L3 / 2.0;
-
-      //obstacle
-      GbObject3DPtr cylinder(new GbCylinder3D(g_minX1-2.0*dx, 0.0, 0.0, g_maxX1+2.0*dx, 0.0, 0.0, dLB/2.0));
-      GbSystem3D::writeGeoObject(cylinder.get(),pathname + "/geo/cylinder", WbWriterVtkXmlBinary::getInstance());
-
-      double offs = dx;
-      //GbObject3DPtr gridCube(new GbCuboid3D(g_minX1-offs, g_minX2-offs, g_minX3-offs, g_maxX1+offs, g_maxX2+offs, g_maxX3+offs));
-      GbObject3DPtr gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
-      if (myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), pathname + "/geo/gridCube", WbWriterVtkXmlBinary::getInstance());
-
-      const int blocknx1 = 10;
-      const int blocknx2 = 10;
-      const int blocknx3 = 10;
-      
-      double blockLength = blocknx1*dx;
-
-      Grid3DPtr grid(new Grid3D(comm));
-      UbSchedulerPtr rSch(new UbScheduler(100000, 100000));
-      RestartPostprocessor rp(grid, rSch, comm, pathname, RestartPostprocessor::BINARY);
-
-         if(myid ==0)
-         {
-            UBLOG(logINFO,"L = " << l );
-            UBLOG(logINFO,"lLB = " << L1 );
-            UBLOG(logINFO,"rho = " << rhoLB );
-            UBLOG(logINFO,"nue = " << nuLB );
-            UBLOG(logINFO,"dx = " << dx );
-            UBLOG(logINFO,"Preprozess - start");
-         }
-
-         grid->setDeltaX(dx);
-         grid->setBlockNX(blocknx1, blocknx2, blocknx3);
-         //grid->setPeriodicX3(true);
-
-         if(myid ==0) GbSystem3D::writeGeoObject(gridCube.get(),pathname + "/geo/gridCube", WbWriterVtkXmlBinary::getInstance());
-      
-         GenBlocksGridVisitor genBlocks(gridCube);
-         grid->accept(genBlocks);
-
-         //inflow
-         GbCuboid3DPtr geoInflow(new GbCuboid3D(g_minX1 - 2.0*dx, g_minX2 - dx, g_minX3 - dx, g_minX1, g_maxX2, g_maxX3 + dx));
-          if(myid == 0) GbSystem3D::writeGeoObject(geoInflow.get(), pathname+"/geo/geoInflow", WbWriterVtkXmlASCII::getInstance());
-
-         //outflow
-         GbCuboid3DPtr geoOutflow (new GbCuboid3D(g_maxX1, g_minX2, g_minX3-dx, g_maxX1+2.0*dx, g_maxX2+dx, g_maxX3+dx));
-          if(myid == 0) GbSystem3D::writeGeoObject(geoOutflow.get(), pathname+"/geo/geoOutflow", WbWriterVtkXmlASCII::getInstance());
-
-         BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm));
-
-         ppblocks->update(0);
-      
-         int bbOption = 1; //0=simple Bounce Back, 1=quadr. BB
-         D3Q27BoundaryConditionAdapterPtr bcObst(new D3Q27NoSlipBCAdapter(bbOption));
-         D3Q27InteractorPtr cylinderInt( new D3Q27Interactor(cylinder, grid, bcObst,Interactor3D::INVERSESOLID));
-
-         D3Q27BoundaryConditionAdapterPtr denBCAdapter1(new D3Q27DensityBCAdapter(1.0/dp[tn]));
-         D3Q27InteractorPtr inflowInt = D3Q27InteractorPtr( new D3Q27Interactor(geoInflow, grid, denBCAdapter1,Interactor3D::SOLID));
-         grid->addAndInitInteractor(inflowInt);
-
-         //outflow
-         D3Q27BoundaryConditionAdapterPtr denBCAdapter2(new D3Q27DensityBCAdapter(-1.0/dp[tn]));
-         denBCAdapter2->setSecondaryBcOption(0);
-         D3Q27InteractorPtr outflowInt = D3Q27InteractorPtr(new D3Q27Interactor(geoOutflow, grid, denBCAdapter2, Interactor3D::SOLID));
-         grid->addAndInitInteractor(outflowInt);
-
-         Grid3DVisitorPtr metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B));
-         InteractorsHelper intHelper(grid, metisVisitor);
-         intHelper.addInteractor(cylinderInt);
-         intHelper.addInteractor(inflowInt);
-         intHelper.addInteractor(outflowInt);
-         intHelper.selectBlocks();
-
-         //set connectors
-         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
-         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
-         grid->accept(setConnsVisitor);
-
-         //domain decomposition for threads
-         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
-         grid->accept(pqPartVisitor);
-
-         ppblocks->update(0);
-         ppblocks.reset();
-
-         unsigned long nob = grid->getNumberOfBlocks();
-         int gl = 3;
-         unsigned long nodb = (blocknx1)* (blocknx2)* (blocknx3);
-         unsigned long nod = nob * (blocknx1)* (blocknx2)* (blocknx3);
-         unsigned long nodg = nob * (blocknx1 + gl) * (blocknx2 + gl) * (blocknx3 + gl);
-         double needMemAll = double(nodg*(27 * sizeof(double) + sizeof(int) + sizeof(float) * 4));
-         double needMem = needMemAll / double(comm->getNumberOfProcesses());
-
-         if (myid == 0)
-         {
-            UBLOG(logINFO, "Number of blocks = " << nob);
-            UBLOG(logINFO, "Number of nodes  = " << nod);
-            int minInitLevel = grid->getCoarsestInitializedLevel();
-            int maxInitLevel = grid->getFinestInitializedLevel();
-            for (int level = minInitLevel; level <= maxInitLevel; level++)
-            {
-               int nobl = grid->getNumberOfBlocks(level);
-               UBLOG(logINFO, "Number of blocks for level " << level << " = " << nob);
-               UBLOG(logINFO, "Number of nodes for level " << level << " = " << nob*nodb);
-            }
-            UBLOG(logINFO, "Necessary memory  = " << needMemAll << " bytes");
-            UBLOG(logINFO, "Necessary memory per process = " << needMem << " bytes");
-            UBLOG(logINFO, "Available memory per process = " << availMem << " bytes");
-         }
-
-         LBMKernel3DPtr kernel;
-         rhoLB = 0.0;
-         kernel = LBMKernel3DPtr(new LBMKernelETD3Q27CCLB(blocknx1, blocknx2, blocknx3, LBMKernelETD3Q27CCLB::NORMAL));
-
-         //
-         BCProcessorPtr bcProc(new D3Q27ETBCProcessor());
-         kernel->setBCProcessor(bcProc);
-
-         SetKernelBlockVisitor kernelVisitor(kernel, nuLB, availMem, needMem);
-
-         grid->accept(kernelVisitor);
-
-         if (refineLevel > 0)
-         {
-            D3Q27SetUndefinedNodesBlockVisitor undefNodesVisitor;
-            grid->accept(undefNodesVisitor);
-         }
-
-         intHelper.setBC();
-
-         //initialization of distributions
-         D3Q27ETInitDistributionsBlockVisitor initVisitor(nuLB, rhoLB);
-
-         mu::Parser vx1;
-         vx1.DefineConst("dp", dp[tn]);
-         vx1.DefineConst("L", x[tn]);
-         vx1.DefineConst("nu", nuLB);
-         vx1.DefineConst("r", z[tn] * 0.5); 
-         vx1.DefineConst("c", 0.0);
-         vx1.SetExpr("(2/dp)/(3.0*4.0*L*nu)*(r^2-((c-x2)^2+(c-x3)^2))");
-
-         initVisitor.setVx1(vx1);
-         grid->accept(initVisitor);
-
-
-         //Postrozess
-         {
-            UbSchedulerPtr geoSch(new UbScheduler(1));
-            D3Q27MacroscopicQuantitiesPostprocessorPtr ppgeo(
-               new D3Q27MacroscopicQuantitiesPostprocessor(grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, true));
-            ppgeo->update(0);
-            ppgeo.reset();
-         }
-
-      if (myid == 0) UBLOG(logINFO, "Preprozess - end");
-
-      double outTime = tout[tn];
-      UbSchedulerPtr visSch(new UbScheduler(outTime));
-
-      D3Q27MacroscopicQuantitiesPostprocessor pp(grid, visSch, pathname, WbWriterVtkXmlASCII::getInstance(), conv);
-
-      UbSchedulerPtr nupsSch(new UbScheduler(10, 10, 30));
-      NUPSCounterPostprocessor npr(grid, nupsSch, numOfThreads, comm);
-
-      double endTime = tend[tn];
-      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, visSch));
-      if(myid == 0) UBLOG(logINFO,"Simulation-start");
-      calculation->calculate();
-      if(myid == 0) UBLOG(logINFO,"Simulation-end");
-   }
-   catch(std::exception& e)
-   {
-      cerr << e.what() << endl << flush;
-   }
-   catch(std::string& s)
-   {
-      cerr << s << endl;
-   }
-   catch(...)
-   {
-      cerr << "unknown exception" << endl;
-   }
-
-}
-int main(int argc, char* argv[])
-{
-
-   run(UbSystem::stringTo<int>(argv[1]));
-
-   return 0;
-}
-
+#include <iostream>
+#include <string>
+
+#include "vfluids.h"
+
+using namespace std;
+
+
+int x[3] = { 120, 240, 480 };
+int y[3] = { 20, 40, 80 };
+int z[3] = { 20, 40, 80 };
+
+//int x[3] = { 120, 120, 120 };
+//int y[3] = { 20, 20, 20 };
+//int z[3] = { 20, 20, 20 };
+double nuLB = 0.001;
+double dp[3] = { 25000.0, 100000.0, 400000.0 };
+double tout[3] = { 4000.0, 16000.0, 64000.0 };
+double tend[3] = { 100001.0, 400001.0, 1600001.0 };
+//double deltax[3] = { 1.0, 0.5, 0.25 };
+double deltax[3] = { 1.0, 1.0, 1.0 };
+
+
+void run(int tn)
+{
+   try
+   {
+      string machine = QUOTEME(CAB_MACHINE);
+      string pathname; 
+      int numOfThreads = 1;
+      double availMem = 0;
+
+      CommunicatorPtr comm = MPICommunicator::getInstance();
+      int myid = comm->getProcessID();
+
+      if(machine == "BOMBADIL") 
+      {
+         pathname = "d:/temp/ltfc" + UbSystem::toString(tn);
+         numOfThreads = 1;
+         availMem = 3.0e9;
+      }
+      else if(machine == "M01" || machine == "M02")      
+      {
+         pathname = "/work/koskuche/scratch/ltfc"+UbSystem::toString(tn);
+         numOfThreads = 8;
+         availMem = 12.0e9;
+
+#if defined(__unix__)
+         if (myid == 0)
+         {
+            const char* str = pathname.c_str();
+            int status = mkdir(str, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
+         }
+#endif 
+
+         if(myid ==0)
+         {
+            stringstream logFilename;
+            logFilename << pathname + "/logfile" + UbSystem::toString(UbSystem::getTimeStamp()) + "_" + UbSystem::toString(myid) + ".txt";
+            UbLog::output_policy::setStream(logFilename.str());
+         }
+      }
+      else throw UbException(UB_EXARGS, "unknown CAB_MACHINE");
+
+      double dx = deltax[tn];
+
+      double L1 = x[tn];
+      double L2 = y[tn];
+      double L3 = z[tn];
+
+      LBMReal dLB = L2;
+      LBMReal rhoLB = 0.0;
+      LBMReal l = L2 / dx;
+
+
+      LBMUnitConverterPtr conv = LBMUnitConverterPtr(new LBMUnitConverter());
+
+      const int baseLevel = 0;
+      const int refineLevel = 0;
+
+      //bounding box
+      double g_minX1 = 0.0;
+      double g_minX2 = -L2 / 2.0;
+      double g_minX3 = -L3 / 2.0;
+
+      double g_maxX1 = L1;
+      double g_maxX2 = L2 / 2.0;
+      double g_maxX3 = L3 / 2.0;
+
+      //obstacle
+      GbObject3DPtr cylinder(new GbCylinder3D(g_minX1-2.0*dx, 0.0, 0.0, g_maxX1+2.0*dx, 0.0, 0.0, dLB/2.0));
+      GbSystem3D::writeGeoObject(cylinder.get(),pathname + "/geo/cylinder", WbWriterVtkXmlBinary::getInstance());
+
+      double offs = dx;
+      //GbObject3DPtr gridCube(new GbCuboid3D(g_minX1-offs, g_minX2-offs, g_minX3-offs, g_maxX1+offs, g_maxX2+offs, g_maxX3+offs));
+      GbObject3DPtr gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
+      if (myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), pathname + "/geo/gridCube", WbWriterVtkXmlBinary::getInstance());
+
+      const int blocknx1 = 10;
+      const int blocknx2 = 10;
+      const int blocknx3 = 10;
+      
+      double blockLength = blocknx1*dx;
+
+      Grid3DPtr grid(new Grid3D(comm));
+      UbSchedulerPtr rSch(new UbScheduler(100000, 100000));
+      RestartPostprocessor rp(grid, rSch, comm, pathname, RestartPostprocessor::BINARY);
+
+         if(myid ==0)
+         {
+            UBLOG(logINFO,"L = " << l );
+            UBLOG(logINFO,"lLB = " << L1 );
+            UBLOG(logINFO,"rho = " << rhoLB );
+            UBLOG(logINFO,"nue = " << nuLB );
+            UBLOG(logINFO,"dx = " << dx );
+            UBLOG(logINFO,"Preprozess - start");
+         }
+
+         grid->setDeltaX(dx);
+         grid->setBlockNX(blocknx1, blocknx2, blocknx3);
+         //grid->setPeriodicX3(true);
+
+         if(myid ==0) GbSystem3D::writeGeoObject(gridCube.get(),pathname + "/geo/gridCube", WbWriterVtkXmlBinary::getInstance());
+      
+         GenBlocksGridVisitor genBlocks(gridCube);
+         grid->accept(genBlocks);
+
+         //inflow
+         GbCuboid3DPtr geoInflow(new GbCuboid3D(g_minX1 - 2.0*dx, g_minX2 - dx, g_minX3 - dx, g_minX1, g_maxX2, g_maxX3 + dx));
+          if(myid == 0) GbSystem3D::writeGeoObject(geoInflow.get(), pathname+"/geo/geoInflow", WbWriterVtkXmlASCII::getInstance());
+
+         //outflow
+         GbCuboid3DPtr geoOutflow (new GbCuboid3D(g_maxX1, g_minX2, g_minX3-dx, g_maxX1+2.0*dx, g_maxX2+dx, g_maxX3+dx));
+          if(myid == 0) GbSystem3D::writeGeoObject(geoOutflow.get(), pathname+"/geo/geoOutflow", WbWriterVtkXmlASCII::getInstance());
+
+         BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm));
+
+         ppblocks->update(0);
+      
+         int bbOption = 1; //0=simple Bounce Back, 1=quadr. BB
+         D3Q27BoundaryConditionAdapterPtr bcObst(new D3Q27NoSlipBCAdapter(bbOption));
+         D3Q27InteractorPtr cylinderInt( new D3Q27Interactor(cylinder, grid, bcObst,Interactor3D::INVERSESOLID));
+
+         D3Q27BoundaryConditionAdapterPtr denBCAdapter1(new D3Q27DensityBCAdapter(1.0/dp[tn]));
+         D3Q27InteractorPtr inflowInt = D3Q27InteractorPtr( new D3Q27Interactor(geoInflow, grid, denBCAdapter1,Interactor3D::SOLID));
+         grid->addAndInitInteractor(inflowInt);
+
+         //outflow
+         D3Q27BoundaryConditionAdapterPtr denBCAdapter2(new D3Q27DensityBCAdapter(-1.0/dp[tn]));
+         denBCAdapter2->setSecondaryBcOption(0);
+         D3Q27InteractorPtr outflowInt = D3Q27InteractorPtr(new D3Q27Interactor(geoOutflow, grid, denBCAdapter2, Interactor3D::SOLID));
+         grid->addAndInitInteractor(outflowInt);
+
+         Grid3DVisitorPtr metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B));
+         InteractorsHelper intHelper(grid, metisVisitor);
+         intHelper.addInteractor(cylinderInt);
+         intHelper.addInteractor(inflowInt);
+         intHelper.addInteractor(outflowInt);
+         intHelper.selectBlocks();
+
+         //set connectors
+         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
+         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
+         grid->accept(setConnsVisitor);
+
+         //domain decomposition for threads
+         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
+         grid->accept(pqPartVisitor);
+
+         ppblocks->update(0);
+         ppblocks.reset();
+
+         unsigned long nob = grid->getNumberOfBlocks();
+         int gl = 3;
+         unsigned long nodb = (blocknx1)* (blocknx2)* (blocknx3);
+         unsigned long nod = nob * (blocknx1)* (blocknx2)* (blocknx3);
+         unsigned long nodg = nob * (blocknx1 + gl) * (blocknx2 + gl) * (blocknx3 + gl);
+         double needMemAll = double(nodg*(27 * sizeof(double) + sizeof(int) + sizeof(float) * 4));
+         double needMem = needMemAll / double(comm->getNumberOfProcesses());
+
+         if (myid == 0)
+         {
+            UBLOG(logINFO, "Number of blocks = " << nob);
+            UBLOG(logINFO, "Number of nodes  = " << nod);
+            int minInitLevel = grid->getCoarsestInitializedLevel();
+            int maxInitLevel = grid->getFinestInitializedLevel();
+            for (int level = minInitLevel; level <= maxInitLevel; level++)
+            {
+               int nobl = grid->getNumberOfBlocks(level);
+               UBLOG(logINFO, "Number of blocks for level " << level << " = " << nob);
+               UBLOG(logINFO, "Number of nodes for level " << level << " = " << nob*nodb);
+            }
+            UBLOG(logINFO, "Necessary memory  = " << needMemAll << " bytes");
+            UBLOG(logINFO, "Necessary memory per process = " << needMem << " bytes");
+            UBLOG(logINFO, "Available memory per process = " << availMem << " bytes");
+         }
+
+         LBMKernel3DPtr kernel;
+         rhoLB = 0.0;
+         kernel = LBMKernel3DPtr(new LBMKernelETD3Q27CCLB(blocknx1, blocknx2, blocknx3, LBMKernelETD3Q27CCLB::NORMAL));
+
+         //
+         BCProcessorPtr bcProc(new D3Q27ETBCProcessor());
+         kernel->setBCProcessor(bcProc);
+
+         SetKernelBlockVisitor kernelVisitor(kernel, nuLB, availMem, needMem);
+
+         grid->accept(kernelVisitor);
+
+         if (refineLevel > 0)
+         {
+            D3Q27SetUndefinedNodesBlockVisitor undefNodesVisitor;
+            grid->accept(undefNodesVisitor);
+         }
+
+         intHelper.setBC();
+
+         //initialization of distributions
+         D3Q27ETInitDistributionsBlockVisitor initVisitor(nuLB, rhoLB);
+
+         mu::Parser vx1;
+         vx1.DefineConst("dp", dp[tn]);
+         vx1.DefineConst("L", x[tn]);
+         vx1.DefineConst("nu", nuLB);
+         vx1.DefineConst("r", z[tn] * 0.5); 
+         vx1.DefineConst("c", 0.0);
+         vx1.SetExpr("(2/dp)/(3.0*4.0*L*nu)*(r^2-((c-x2)^2+(c-x3)^2))");
+
+         initVisitor.setVx1(vx1);
+         grid->accept(initVisitor);
+
+
+         //Postrozess
+         {
+            UbSchedulerPtr geoSch(new UbScheduler(1));
+            D3Q27MacroscopicQuantitiesPostprocessorPtr ppgeo(
+               new D3Q27MacroscopicQuantitiesPostprocessor(grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, true));
+            ppgeo->update(0);
+            ppgeo.reset();
+         }
+
+      if (myid == 0) UBLOG(logINFO, "Preprozess - end");
+
+      double outTime = tout[tn];
+      UbSchedulerPtr visSch(new UbScheduler(outTime));
+
+      D3Q27MacroscopicQuantitiesPostprocessor pp(grid, visSch, pathname, WbWriterVtkXmlASCII::getInstance(), conv);
+
+      UbSchedulerPtr nupsSch(new UbScheduler(10, 10, 30));
+      NUPSCounterPostprocessor npr(grid, nupsSch, numOfThreads, comm);
+
+      double endTime = tend[tn];
+      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, visSch));
+      if(myid == 0) UBLOG(logINFO,"Simulation-start");
+      calculation->calculate();
+      if(myid == 0) UBLOG(logINFO,"Simulation-end");
+   }
+   catch(std::exception& e)
+   {
+      cerr << e.what() << endl << flush;
+   }
+   catch(std::string& s)
+   {
+      cerr << s << endl;
+   }
+   catch(...)
+   {
+      cerr << "unknown exception" << endl;
+   }
+
+}
+int main(int argc, char* argv[])
+{
+
+   run(UbSystem::stringTo<int>(argv[1]));
+
+   return 0;
+}
+
diff --git a/apps/cpu/PlateWithPorousInlay/CMakeLists.txt b/apps/cpu/PlateWithPorousInlay/CMakeLists.txt
index 18fd893e8a6b67bf87a6ab81a88a7b149cbcfc73..019ea34a9f344bd8f095bd0e9c37208baec22947 100644
--- a/apps/cpu/PlateWithPorousInlay/CMakeLists.txt
+++ b/apps/cpu/PlateWithPorousInlay/CMakeLists.txt
@@ -1,25 +1,25 @@
-CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
-
-########################################################
-## C++ PROJECT                                       ###
-########################################################
-PROJECT(porplate)
-
-INCLUDE(${SOURCE_ROOT}/lib/IncludsList.txt) 
-
-#################################################################
-###   LOCAL FILES                                             ###
-#################################################################
-FILE(GLOB SPECIFIC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.h
-                         ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
-                         ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp  )
- 
-SET(ALL_SOURCES ${ALL_SOURCES} ${SPECIFIC_FILES})
-SOURCE_GROUP(src FILES ${SPECIFIC_FILES})
-  
-SET(CAB_ADDITIONAL_LINK_LIBRARIES vfluids)
-
-#################################################################
-###   CREATE PROJECT                                          ###
-#################################################################
-CREATE_CAB_PROJECT(porplate BINARY)
+CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
+
+########################################################
+## C++ PROJECT                                       ###
+########################################################
+PROJECT(porplate)
+
+INCLUDE(${SOURCE_ROOT}/lib/IncludsList.txt) 
+
+#################################################################
+###   LOCAL FILES                                             ###
+#################################################################
+FILE(GLOB SPECIFIC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.h
+                         ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
+                         ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp  )
+ 
+SET(ALL_SOURCES ${ALL_SOURCES} ${SPECIFIC_FILES})
+SOURCE_GROUP(src FILES ${SPECIFIC_FILES})
+  
+SET(CAB_ADDITIONAL_LINK_LIBRARIES vfluids)
+
+#################################################################
+###   CREATE PROJECT                                          ###
+#################################################################
+CREATE_CAB_PROJECT(porplate BINARY)
diff --git a/apps/cpu/PlateWithPorousInlay/plate.cpp b/apps/cpu/PlateWithPorousInlay/plate.cpp
index ea5dca784dd82ffa27b3e9c5de0050438c5b87a7..60531c9ae960eec48264d3876395a5edc69bc499 100644
--- a/apps/cpu/PlateWithPorousInlay/plate.cpp
+++ b/apps/cpu/PlateWithPorousInlay/plate.cpp
@@ -1,700 +1,700 @@
-
-
-#include <iostream>
-#include <string>
-#include <math.h> 
-
-#include <vfluids.h>
-
-using namespace std;
-
-//////////////////////////////////////////////////////////////////////////
-void inlay(GbVoxelMatrix3DPtr pmMesh, string& pathname, int myid, int i, Grid3DPtr grid)
-{
-   int bbOptionPM = 2; //quadratic bounce back with for thin walls
-   D3Q27BoundaryConditionAdapterPtr noSlipPM(new D3Q27NoSlipBCAdapter(bbOptionPM));
-   D3Q27InteractorPtr inlayInt = D3Q27InteractorPtr(new D3Q27Interactor(pmMesh, grid, noSlipPM, Interactor3D::SOLID));
-
-   GbCuboid3DPtr inlayBox(new GbCuboid3D(pmMesh->getX1Minimum(), pmMesh->getX2Minimum(), pmMesh->getX3Minimum(), pmMesh->getX1Maximum(), pmMesh->getX2Maximum(), pmMesh->getX3Maximum()));
-   if (myid == 0) GbSystem3D::writeGeoObject(inlayBox.get(), pathname + "/geo/inlay" + UbSystem::toString(i), WbWriterVtkXmlASCII::getInstance());
-   D3Q27InteractorPtr inlayBoxInt = D3Q27InteractorPtr(new D3Q27Interactor(inlayBox, grid, noSlipPM, Interactor3D::SOLID));
-   SetSolidOrTransBlockVisitor v1(inlayBoxInt, SetSolidOrTransBlockVisitor::SOLID);
-   grid->accept(v1);
-   SetSolidOrTransBlockVisitor v2(inlayBoxInt, SetSolidOrTransBlockVisitor::TRANS);
-   grid->accept(v2);
-
-   vector<Block3DPtr> inlayBlocks;
-   vector<Block3DPtr>& sb = inlayBoxInt->getSolidBlockSet();
-   if (myid == 0) UBLOG(logINFO, "sb.size = " << sb.size());
-   inlayBlocks.insert(inlayBlocks.end(), sb.begin(), sb.end());
-   vector<Block3DPtr>& tb = inlayBoxInt->getTransBlockSet();
-   if (myid == 0) UBLOG(logINFO, "tb.size = " << tb.size());
-   inlayBlocks.insert(inlayBlocks.end(), tb.begin(), tb.end());
-
-   if (myid == 0) UBLOG(logINFO, "inlayBlocks.size = " << inlayBlocks.size());
-
-   BOOST_FOREACH(Block3DPtr block, inlayBlocks)
-   {
-      block->setActive(true);
-      inlayInt->setDifferencesToGbObject3D(block);
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-void run(const char *cstr)
-{
-   try
-   {
-      string pathname;
-      string pathGeo;
-      string pathLog;
-      int numOfThreads = 1;
-      bool logfile = false;
-      stringstream logFilename;
-      double availMem = 0;
-
-      CommunicatorPtr comm = MPICommunicator::getInstance();
-      int myid = comm->getProcessID();
-
-      string machine = string(cstr);
-
-      if (machine == "my")
-      {
-         pathname = "d:/temp/porplate";
-         pathGeo = "d:/Data/plate";
-         pathLog = pathname;
-         numOfThreads = 4;
-         logfile = false;
-         availMem = 15.0e9;
-      }
-      else if (machine == "Ludwig")
-      {
-         pathname = "/work/koskuche/SFB880/porplate";
-         pathGeo = "/home/koskuche/data/plate";
-         pathLog = pathname;
-         numOfThreads = 8;
-         availMem = 12.0e9;///8*numOfThreads;
-         logfile = true;
-      }
-      else if (machine == "HLRS")
-      {
-         pathname = "/univ_1/ws1/ws/xrmkuchr-plate3-0";
-         pathGeo = "/zhome/academic/HLRS/xrm/xrmkuchr/data/plate";
-         pathLog = "/zhome/academic/HLRS/xrm/xrmkuchr/work/plate";
-         numOfThreads = 12;
-         availMem = 2.0e9;
-         logfile = true;
-      }
-      else if (machine == "HLRN")
-      {
-         pathname = "/gfs1/work/niikonst/scratch/porplate";
-         pathGeo = "/gfs1/work/niikonst/data/plate";
-         pathLog = pathname;
-         numOfThreads = 24;
-         availMem = 64.0e9;
-         logfile = true;
-      }
-      else throw UbException(UB_EXARGS, "unknown CAB_MACHINE");
-
-#if defined(__unix__)
-      if (myid==0) 
-      {
-         const char* str = pathLog.c_str();
-         int status=mkdir(str, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
-      }
-#endif 
-
-      if (myid == 0 && logfile)
-      {
-         //UbLog::reportingLevel() = logDEBUG5;
-         logFilename << pathLog + "/logfile" + UbSystem::toString(UbSystem::getTimeStamp()) + "_" + UbSystem::toString(myid) + ".txt";
-         UbLog::output_policy::setStream(logFilename.str());
-      }
-
-      if (myid == 0) UBLOG(logINFO, "Testcase plate");
-
-      string PlatteFilename = pathGeo + "/Platte_bearbeitet2.stl";
-
-      string ZckbndFilename = pathGeo + "/2zackenbaender0.stl";
-
-      ///////////////Knotenabmessungen:
-      int nx[3], blocknx[3];
-      nx[0] = 90;//240;//120;//60;//86;//43;//65;//50;  //länge
-      nx[1] = 2;//2;//6;///1;//5;// //breite
-      nx[2] = 30;//64;//32;//18;//5;//15;//15; //höhe gebiet
-      blocknx[0] = 16;//10;//6;
-      blocknx[1] = 16;//10;//6;
-      blocknx[2] = 16;//10;//6;
-
-      int baseLevel = 0;
-      int refineLevel = 5;
-
-      double H = 600.0; // Kanalhöhe [mm]
-      double cdx = H / (double)(nx[2] * blocknx[2]);
-      double fdx = cdx / double(1 << refineLevel);
-
-      //double h = 200.0; // gewünschte Plattenhöhe in Gitterpunkten
-      //double fdx = plate->getLengthX3()/h;
-      //double cdx = fdx*double(1<<refineLevel);
-
-      LBMUnitConverterPtr unitConverter = LBMUnitConverterPtr(new LBMUnitConverter());
-
-      //////////////////////////////////////////////////////////////////////////
-      // physik
-      //////////////////////////////////////////////////////////////////////////
-
-      //////////////////////////////////////////////////////////////////////////
-      // Experiment Parametr
-      // Re = 1000000
-      // V = 16.05  # m / s
-      // p = 994.7  #hPa(manuell abgelesen von MUB)
-      // T = 21.78  #°C
-      // Luftfeuchte = 50.5   # %
-      //////////////////////////////////////////////////////////////////////////
-      // Simulation Parametr
-      //////////////////////////////////////////////////////////////////////////
-      double Re = 1e6; // 1133333.3333333335;
-      double rhoLB = 0.0;
-      double uLB = 0.1;
-      double lReal = 1000; //Plattenlänge in mm
-      double nuLB = (uLB*(lReal / cdx)) / Re;
-
-      int sizeSP = 4;
-      mu::Parser spongeLayer;
-      spongeLayer.SetExpr("x1>=(sizeX-sizeSP)/dx ? (sizeX-(x1+1))/sizeSP/2.0 + 0.5 : 1.0");
-      spongeLayer.DefineConst("sizeX", nx[0] * blocknx[0]);
-      spongeLayer.DefineConst("sizeSP", sizeSP*blocknx[0]);
-
-      Grid3DPtr grid(new Grid3D(comm));
-
-      //////////////////////////////////////////////////////////////////////////
-      //restart
-      UbSchedulerPtr rSch(new UbScheduler(1000, 1000, 10000000));
-      RestartPostprocessor rp(grid, rSch, comm, pathname, RestartPostprocessor::BINARY);
-      //////////////////////////////////////////////////////////////////////////
-      bool restart;
-
-      if (grid->getTimeStep() == 0)
-      {
-
-         if (myid == 0) UBLOG(logINFO, "Neustart..");
-         restart = false;
-         //////////////////////////////////////////////////////////////////////////
-         //Platte
-         GbTriFaceMesh3DPtr plate(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(PlatteFilename, "Netz"));
-         if (myid == 0) GbSystem3D::writeGeoObject(plate.get(), pathname + "/geo/platte", WbWriterVtkXmlBinary::getInstance());
-         //////////////////////////////////////////////////////////////////////////
-         // Zackenband
-         //////////////////////////////////////////////////////////////////////////
-         GbTriFaceMesh3DPtr meshBand1(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "NetzBand"));
-         meshBand1->translate(5.0, -2.86, -14.717);
-         meshBand1->rotate(0.0, -0.5, 0.0);
-         if (myid == 0) GbSystem3D::writeGeoObject(meshBand1.get(), pathname + "/geo/Band1", WbWriterVtkXmlASCII::getInstance());
-         // Zackenband2
-         GbTriFaceMesh3DPtr meshBand2(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "NetzBand2"));
-         meshBand2->translate(5.0, -7.86, -14.717);
-         meshBand2->rotate(0.0, -0.5, 0.0);
-         if (myid == 0) GbSystem3D::writeGeoObject(meshBand2.get(), pathname + "/geo/Band2", WbWriterVtkXmlASCII::getInstance());
-         // Zackenband3
-         GbTriFaceMesh3DPtr meshBand3(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "NetzBand3"));
-         meshBand3->translate(5.0, -2.86, -14.417); //+0.3
-         meshBand3->rotate(0.0, -0.5, 0.0);
-         if (myid == 0) GbSystem3D::writeGeoObject(meshBand3.get(), pathname + "/geo/Band3", WbWriterVtkXmlASCII::getInstance());
-         // Zackenband4
-         GbTriFaceMesh3DPtr meshBand4(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "NetzBand4"));
-         meshBand4->translate(5.0, -7.86, -14.417);
-         meshBand4->rotate(0.0, -0.5, 0.0);
-         if (myid == 0) GbSystem3D::writeGeoObject(meshBand4.get(), pathname + "/geo/Band4", WbWriterVtkXmlASCII::getInstance());
-         //////////////////////////////////////////////////////////////////////////
-
-         //////////////////////////////////////////////////////////////////////////
-         //porous inlay
-         // string pmFilename1  = pathGeo + "/CT-2014-039.raw";
-         // int pmNX1t=1333;  //abmessung einzelbild in x-richtung
-         // int pmNX2t=463; //abmessung einzelbild in y richtung
-         // int pmNX3t=1333; //anzahl der bilder
-         // float lthresholdt = 27686.97;
-         // float uthresholdt = 65535.0;
-
-         //// string pmFilename1  = pathGeo + "/membran370x357x101.raw";
-         //// int pmNX1t=370;  //abmessung einzelbild in x-richtung
-         //// int pmNX2t=357; //abmessung einzelbild in y richtung
-         //// int pmNX3t=101; //anzahl der bilder
-         //// float lthresholdt = 55.0;
-         //// float uthresholdt = 182.0;
-
-         // GbVoxelMatrix3DPtr pmMesht(new GbVoxelMatrix3D(pmNX1t,pmNX2t,pmNX3t,0,lthresholdt,uthresholdt));
-         // pmMesht->readMatrixFromRawFile<unsigned short>(pmFilename1);
-         // //pmMesht->readMatrixFromRawFile<unsigned char>(pmFilename1);
-         // double deltaX1 = 0.05/pmNX2t;
-         // double deltaX2 = 0.05/pmNX2t;
-         // double deltaX3 = 0.05/pmNX3t;
-         // double scaleFactort = 0.001;
-         // double deltat = 3.75*scaleFactort;
-         // pmMesht->setVoxelMatrixDelta(deltat, deltat, deltat);
-         // pmMesht->rotate90aroundX(); 
-         // pmMesht->rotate90aroundX();
-         // pmMesht->rotate90aroundX();
-         // double inlayXmin = 0;
-         // double inlayYmin = 0;
-         // double inlayZmin = 0;
-         // pmMesht->setVoxelMatrixMininum(inlayXmin, inlayYmin, inlayZmin);
-         // 
-         // if(myid == 0) pmMesht->writeToLegacyVTKBinary(pathname+"/geo/pmMesh");
-
-         // return;
-         ////////////////////////////////////////////////////////////////////////////
-
-         double blockLengthx1 = blocknx[0] * cdx; //geowerte
-         double blockLengthx2 = blockLengthx1;
-         double blockLengthx3 = blockLengthx1;
-
-         double geoLength[] = { nx[0] * blockLengthx1, nx[1] * blockLengthx2, nx[2] * blockLengthx3 };
-
-         double originX1 = plate->getX1Minimum() - plate->getLengthX1() / 4.0;
-         double originX2 = plate->getX2Minimum();
-         double originX3 = plate->getX3Minimum() - 299.5;
-
-
-         bool periodicx1 = false;
-         bool periodicx2 = true;
-         bool periodicx3 = false;
-
-         //bounding box
-         double g_minX1 = originX1;
-         double g_minX2 = originX2;
-         double g_minX3 = originX3;
-
-         double g_maxX1 = originX1 + geoLength[0];
-         double g_maxX2 = originX2 + geoLength[1];
-         double g_maxX3 = originX3 + geoLength[2];;
-
-
-         //set grid
-         grid->setDeltaX(cdx);
-         grid->setBlockNX(blocknx[0], blocknx[1], blocknx[2]);
-         grid->setPeriodicX1(periodicx1);
-         grid->setPeriodicX2(periodicx2);
-         grid->setPeriodicX3(periodicx3);
-
-         GbObject3DPtr gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
-         gridCube->setCenterCoordinates(gridCube->getX1Centroid(), meshBand1->getX2Centroid(), gridCube->getX3Centroid());
-         if (myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), pathname + "/geo/gridCube", WbWriterVtkXmlASCII::getInstance());
-
-         originX2 = gridCube->getX2Minimum();
-         g_minX2 = originX2;
-         g_maxX2 = originX2 + geoLength[1];
-
-         GenBlocksGridVisitor genBlocks(gridCube);
-         grid->accept(genBlocks);
-
-         //////////////////////////////////////////////////////////////////////////
-         if (myid == 0)
-         {
-            UBLOG(logINFO, "*****************************************");
-            UBLOG(logINFO, "* Parameters                            *");
-            UBLOG(logINFO, "* Re            =" << Re);
-            UBLOG(logINFO, "* nuLB          =" << nuLB);
-            UBLOG(logINFO, "* uLB           =" << uLB);
-            UBLOG(logINFO, "* cdx           =" << cdx);
-            UBLOG(logINFO, "* fdx           =" << fdx);
-            double Hzb = 0.6 / fdx;
-            UBLOG(logINFO, "* Height of Zackenband =" << Hzb);
-            UBLOG(logINFO, "* Re on Zackenband =" << (uLB*Hzb) / (nuLB*double(1 << refineLevel)));
-            UBLOG(logINFO, "* nx1/2/3       =" << nx[0] << "/" << nx[1] << "/" << nx[2]);
-            UBLOG(logINFO, "* blocknx1/2/3  =" << blocknx[0] << "/" << blocknx[1] << "/" << blocknx[2]);
-            UBLOG(logINFO, "* x1Periodic    =" << periodicx1);
-            UBLOG(logINFO, "* x2Periodic    =" << periodicx2);
-            UBLOG(logINFO, "* x3Periodic    =" << periodicx3);
-            UBLOG(logINFO, "* number of levels  =" << refineLevel + 1);
-            UBLOG(logINFO, "* path          =" << pathname);
-
-            UBLOG(logINFO, "*****************************************");
-            UBLOG(logINFO, "* number of threads    =" << numOfThreads);
-            UBLOG(logINFO, "* number of processes  =" << comm->getNumberOfProcesses());
-            UBLOG(logINFO, "*****************************************");
-            UBLOG(logINFO, "*****************************************");
-         }
-         //////////////////////////////////////////////////////////////////////////
-
-
-         //////////////////////////////////////////////////////////////////////////
-         //refinement
-         GbCuboid3DPtr refinePlatteBox(new GbCuboid3D(plate->getX1Minimum() - 1.0, plate->getX2Minimum(), plate->getX3Minimum() + (plate->getX3Maximum() - plate->getX3Minimum()) / 2.0,
-            plate->getX1Maximum() + 40.0, plate->getX2Maximum(), plate->getX3Maximum() + 2.0));
-         if (myid == 0) GbSystem3D::writeGeoObject(refinePlatteBox.get(), pathname + "/geo/refinePlatteBox", WbWriterVtkXmlASCII::getInstance());
-
-         //inlay patch
-         GbCuboid3DPtr refineInlayBox(new GbCuboid3D(plate->getX1Maximum() - 85.0, plate->getX2Minimum(), plate->getX3Minimum() + (plate->getX3Maximum() - plate->getX3Minimum()) / 2.0,
-            plate->getX1Maximum() + 1.0, plate->getX2Maximum(), plate->getX3Maximum() + 1.0));
-         if (myid == 0) GbSystem3D::writeGeoObject(refineInlayBox.get(), pathname + "/geo/refineInlayBox", WbWriterVtkXmlASCII::getInstance());
-
-         if (refineLevel > 0)
-         {
-            if (myid == 0) UBLOG(logINFO, "Refinement - start");
-            RefineCrossAndInsideGbObjectHelper refineHelper(grid, refineLevel);
-            refineHelper.addGbObject(refinePlatteBox, refineLevel - 1);
-            refineHelper.addGbObject(refineInlayBox, refineLevel);
-
-            refineHelper.refine();
-            if (myid == 0) UBLOG(logINFO, "Refinement - end");
-         }
-
-         //if(myid == 0)
-         //{
-         //   UBLOG(logINFO,"Write blocks - start");
-         //   BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm));
-         //   ppblocks->update(0);
-         //   UBLOG(logINFO,"Write blocks - end");
-         //}
-
-         //return;
-
-
-         {
-
-            ////walls
-            GbCuboid3DPtr addWallZmin(new GbCuboid3D(g_minX1 - blockLengthx1, g_minX2 - blockLengthx1, g_minX3 - blockLengthx1, g_maxX1 + blockLengthx1, g_maxX2 + blockLengthx1, g_minX3));
-            if (myid == 0) GbSystem3D::writeGeoObject(addWallZmin.get(), pathname + "/geo/addWallZmin", WbWriterVtkXmlASCII::getInstance());
-
-            GbCuboid3DPtr addWallZmax(new GbCuboid3D(g_minX1 - blockLengthx1, g_minX2 - blockLengthx1, g_maxX3, g_maxX1 + blockLengthx1, g_maxX2 + blockLengthx1, g_maxX3 + blockLengthx1));
-            if (myid == 0) GbSystem3D::writeGeoObject(addWallZmax.get(), pathname + "/geo/addWallZmax", WbWriterVtkXmlASCII::getInstance());
-
-            //walls
-            int bbOption = 1; //0=simple Bounce Back, 1=quadr. BB
-            D3Q27BoundaryConditionAdapterPtr slip(new D3Q27SlipBCAdapter(bbOption));
-            D3Q27InteractorPtr addWallZminInt(new D3Q27Interactor(addWallZmin, grid, slip, Interactor3D::SOLID));
-            D3Q27InteractorPtr addWallZmaxInt(new D3Q27Interactor(addWallZmax, grid, slip, Interactor3D::SOLID));
-
-            /////////////////////////////////////////////////
-            ///interactoren
-            int bbOption1 = 1; //0=simple Bounce Back, 1=quadr. BB
-            D3Q27BoundaryConditionAdapterPtr noSlip(new D3Q27NoSlipBCAdapter(bbOption1));
-            D3Q27TriFaceMeshInteractorPtr triPlateInteractor(new D3Q27TriFaceMeshInteractor(plate, grid, noSlip, Interactor3D::SOLID, Interactor3D::POINTS));
-            D3Q27TriFaceMeshInteractorPtr triBand1Interactor(new D3Q27TriFaceMeshInteractor(meshBand1, grid, noSlip, Interactor3D::SOLID, Interactor3D::EDGES));
-            D3Q27TriFaceMeshInteractorPtr triBand2Interactor(new D3Q27TriFaceMeshInteractor(meshBand2, grid, noSlip, Interactor3D::SOLID, Interactor3D::EDGES));
-            D3Q27TriFaceMeshInteractorPtr triBand3Interactor(new D3Q27TriFaceMeshInteractor(meshBand3, grid, noSlip, Interactor3D::SOLID, Interactor3D::EDGES));
-            D3Q27TriFaceMeshInteractorPtr triBand4Interactor(new D3Q27TriFaceMeshInteractor(meshBand4, grid, noSlip, Interactor3D::SOLID, Interactor3D::EDGES));
-
-            //inflow
-            GbCuboid3DPtr velBCCuboid(new GbCuboid3D(originX1 - blockLengthx1, originX2 - blockLengthx1, originX3 - blockLengthx1,
-               originX1, originX2 + geoLength[1] + blockLengthx1, originX3 + geoLength[2] + blockLengthx1));
-            if (myid == 0) GbSystem3D::writeGeoObject(velBCCuboid.get(), pathname + "/geo/velBCCuboid", WbWriterVtkXmlASCII::getInstance());
-            D3Q27InteractorPtr velBCInteractor(new D3Q27Interactor(velBCCuboid, grid, Interactor3D::SOLID));
-
-            //inflow
-            double raiseVelSteps = 0;
-            vector<D3Q27BCFunction> velcX1BCs, dummy;
-
-            mu::Parser inflowProfile;
-            inflowProfile.SetExpr("uLB");
-            inflowProfile.DefineConst("uLB", uLB);
-            velcX1BCs.push_back(D3Q27BCFunction(inflowProfile, raiseVelSteps, D3Q27BCFunction::INFCONST));
-
-            D3Q27BoundaryConditionAdapterPtr velBCAdapter(new D3Q27VelocityBCAdapter(velcX1BCs, dummy, dummy));
-            velBCInteractor->addBCAdapter(velBCAdapter);
-
-            //outflow
-            GbCuboid3DPtr densCuboid(new GbCuboid3D(originX1 + geoLength[0], originX2 - blockLengthx1, originX3 - blockLengthx1,
-               originX1 + geoLength[0] + blockLengthx1, originX2 + geoLength[1] + blockLengthx1, originX3 + geoLength[2] + blockLengthx1));
-            if (myid == 0) GbSystem3D::writeGeoObject(densCuboid.get(), pathname + "/geo/densCuboid", WbWriterVtkXmlASCII::getInstance());
-            D3Q27BoundaryConditionAdapterPtr denBCAdapter(new D3Q27DensityBCAdapter(rhoLB));
-            D3Q27InteractorPtr densInteractor(new D3Q27Interactor(densCuboid, grid, denBCAdapter, Interactor3D::SOLID));
-
-            ////////////////////////////////////////////
-            //METIS
-            Grid3DVisitorPtr metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B));
-
-            ////////////////////////////////////////////
-            /////delete solid blocks
-            if (myid == 0) UBLOG(logINFO, "deleteSolidBlocks - start");
-            InteractorsHelper intHelper(grid, metisVisitor);
-            intHelper.addInteractor(triPlateInteractor);
-            intHelper.addInteractor(triBand1Interactor);
-            intHelper.addInteractor(triBand2Interactor);
-            intHelper.addInteractor(triBand3Interactor);
-            intHelper.addInteractor(triBand4Interactor);
-            intHelper.addInteractor(addWallZminInt);
-            intHelper.addInteractor(addWallZmaxInt);
-            intHelper.addInteractor(densInteractor);
-            intHelper.addInteractor(velBCInteractor);
-            intHelper.selectBlocks();
-            if (myid == 0) UBLOG(logINFO, "deleteSolidBlocks - end");
-            //////////////////////////////////////
-
-            //domain decomposition for threads
-            if (numOfThreads > 1)
-            {
-               PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
-               grid->accept(pqPartVisitor);
-            }
-
-            if (myid == 0)
-            {
-               UBLOG(logINFO, "Write blocks - start");
-               BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm));
-               ppblocks->update(0);
-               UBLOG(logINFO, "Write blocks - end");
-            }
-
-            unsigned long nob = grid->getNumberOfBlocks();
-            unsigned long nod = nob * blocknx[0] * blocknx[1] * blocknx[2];
-            unsigned long nod_real = nob * (blocknx[0] + 3)*(blocknx[1] + 3)*(blocknx[2] + 3);
-            unsigned long nodb = (blocknx[0]) * (blocknx[1]) * (blocknx[2]);
-
-            double needMemAll = double(nod_real*(27 * sizeof(double) + sizeof(int)));
-            double needMem = needMemAll / double(comm->getNumberOfProcesses());
-
-            double nup = 0;
-
-            if (myid == 0)
-            {
-               UBLOG(logINFO, "Number of blocks = " << nob);
-               UBLOG(logINFO, "Number of nodes  = " << nod);
-               int minInitLevel = grid->getCoarsestInitializedLevel();
-               int maxInitLevel = grid->getFinestInitializedLevel();
-               for (int level = minInitLevel; level <= maxInitLevel; level++)
-               {
-                  int nobl = grid->getNumberOfBlocks(level);
-                  UBLOG(logINFO, "Number of blocks for level " << level << " = " << nobl);
-                  UBLOG(logINFO, "Number of nodes for level " << level << " = " << nobl*nodb);
-                  nup += nobl*nodb*double(1 << level);
-               }
-               UBLOG(logINFO, "Hypothetically time for calculation step for 120 nodes  = " << nup / 6.0e5 / (120 * 8) << " s");
-               UBLOG(logINFO, "Necessary memory  = " << needMemAll << " bytes");
-               UBLOG(logINFO, "Necessary memory per process = " << needMem << " bytes");
-               UBLOG(logINFO, "Available memory per process = " << availMem << " bytes");
-               UBLOG(logINFO, "Available memory per node/8.0 = " << (availMem / 8.0) << " bytes");
-            }
-
-            //////////////////////////////////////////
-            //set connectors
-            if (myid == 0) UBLOG(logINFO, "set connectors - start");
-            D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
-            D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
-            grid->accept(setConnsVisitor);
-            if (myid == 0) UBLOG(logINFO, "set connectors - end");
-
-            ////////////////////////////
-            LBMKernel3DPtr kernel;
-            //kernel = LBMKernel3DPtr(new LBMKernelETD3Q27CCLB(blocknx[0], blocknx[1], blocknx[2], LBMKernelETD3Q27CCLB::NORMAL));
-
-            //with sponge layer
-            kernel = LBMKernel3DPtr(new LBMKernelETD3Q27CCLBWithSpongeLayer(blocknx[0], blocknx[1], blocknx[2], LBMKernelETD3Q27CCLB::NORMAL));
-            kernel->setWithSpongeLayer(true);
-            kernel->setSpongeLayer(spongeLayer);
-
-            //BCProcessorPtr bcProc(new D3Q27ETBCProcessor());
-            BCProcessorPtr bcProc(new D3Q27ETForThinWallBCProcessor());
-            kernel->setBCProcessor(bcProc);
-            SetKernelBlockVisitor kernelVisitor(kernel, nuLB, availMem, needMem);
-            grid->accept(kernelVisitor);
-            //////////////////////////////////
-            //undef nodes
-            if (refineLevel > 0)
-            {
-               D3Q27SetUndefinedNodesBlockVisitor undefNodesVisitor;
-               grid->accept(undefNodesVisitor);
-            }
-
-
-            intHelper.setBC();
-
-         }
-         //////////////////////////////////////////////////////////////////////////
-         //porous inlay
-         {
-            string pmFilename = pathGeo + "/CT-2014-039.raw";
-            int pmNX1 = 1333;  //abmessung einzelbild in x-richtung
-            int pmNX2 = 463; //abmessung einzelbild in y richtung
-            int pmNX3 = 1333; //anzahl der bilder
-            float lthreshold = 27686.97;
-            float uthreshold = 65535.0;
-
-            GbVoxelMatrix3DPtr pmMesh(new GbVoxelMatrix3D(pmNX1, pmNX2, pmNX3, 0, lthreshold, uthreshold));
-            pmMesh->readMatrixFromRawFile<unsigned short>(pmFilename, GbVoxelMatrix3D::LittleEndian);
-
-            double scaleFactor = 0.001;
-            double delta = 3.75*scaleFactor;
-            pmMesh->setVoxelMatrixDelta(delta, delta, delta);
-            pmMesh->rotate90aroundX();
-            pmMesh->rotate90aroundX();
-            pmMesh->rotate90aroundX();
-
-            double inlayXmin = plate->getX1Maximum() - 5.0;//995.0;
-            double inlayYmin = gridCube->getX2Minimum();//180.0;
-            double inlayZmin = 8.84 + fdx;//8.73;
-
-            //pmMesh->setVoxelMatrixMininum(inlayXmin, inlayYmin, inlayZmin);
-            //if(myid == 0) pmMesh->writeToLegacyVTKBinary(pathname+"/geo/pmMesh");
-
-            int i = 0;
-            for (int y = 0; y <= 35; y += 10)
-               for (int x = 0; x <= 75; x += 10)
-               {
-                  if (myid == 0) UBLOG(logINFO, "inlay # " << i);
-                  pmMesh->setVoxelMatrixMininum(inlayXmin - (double)x, inlayYmin + (double)y, inlayZmin);
-                  inlay(pmMesh, pathname, myid, i, grid);
-                  i++;
-
-                  if (myid == 0) UBLOG(logINFO, "inlay # " << i);
-                  pmMesh->setVoxelMatrixMininum(inlayXmin - (double)(x + 5), inlayYmin + (double)y, inlayZmin);
-                  pmMesh->mirrorX();
-                  inlay(pmMesh, pathname, myid, i, grid);
-                  i++;
-
-                  if (myid == 0) UBLOG(logINFO, "inlay # " << i);
-                  pmMesh->setVoxelMatrixMininum(inlayXmin - (double)(x + 5), inlayYmin + (double)(y + 5), inlayZmin);
-                  pmMesh->mirrorY();
-                  inlay(pmMesh, pathname, myid, i, grid);
-                  i++;
-
-                  if (myid == 0) UBLOG(logINFO, "inlay # " << i);
-                  pmMesh->setVoxelMatrixMininum(inlayXmin - (double)x, inlayYmin + (double)(y + 5), inlayZmin);
-                  pmMesh->mirrorX();
-                  inlay(pmMesh, pathname, myid, i, grid);
-                  pmMesh->mirrorY();
-                  i++;
-               }
-
-            if (myid == 0)
-            {
-               UBLOG(logINFO, "mit VoxelMatrix");
-               UBLOG(logINFO, "PID = " << myid << " Total Physical Memory (RAM): " << Utilities::getTotalPhysMem());
-               UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used: " << Utilities::getPhysMemUsed());
-               UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe());
-            }
-         }
-         //////////////////////////////////////////////////////////////////////////
-
-
-         //initialization of decompositions
-         D3Q27ETInitDistributionsBlockVisitor initVisitor(nuLB, rhoLB);
-         initVisitor.setVx1(uLB);
-         grid->accept(initVisitor);
-
-         //Postprozess
-         UbSchedulerPtr geoSch(new UbScheduler(1));
-         D3Q27MacroscopicQuantitiesPostprocessorPtr ppgeo(
-            new D3Q27MacroscopicQuantitiesPostprocessor(grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(),
-            unitConverter, true));
-         ppgeo->update(0);
-         ppgeo.reset();
-         geoSch.reset();
-
-         if (myid == 0) UBLOG(logINFO, "Preprozess - end");
-      }
-      else
-      {
-         restart = true;
-
-         ////////////////////////////////////////////////////////////////////////////
-         //change viscosity
-         Re = 1e6;
-         nuLB = ((uLB*(lReal/cdx))/Re)*1.043;
-         if (myid == 0) UBLOG(logINFO, "nuLB =" << nuLB);
-
-         int gridRank = grid->getRank();
-         int minInitLevel = grid->getCoarsestInitializedLevel();
-         int maxInitLevel = grid->getFinestInitializedLevel();
-
-         std::vector<std::vector<Block3DPtr> > blockVector;
-         blockVector.resize(maxInitLevel + 1);
-
-         for (int level = minInitLevel; level <= maxInitLevel; level++)
-         {
-            grid->getBlocks(level, gridRank, true, blockVector[level]);
-
-            BOOST_FOREACH(Block3DPtr block, blockVector[level])
-            {
-               LBMReal collFactor = LBMSystem::calcCollisionFactor(nuLB, block->getLevel());
-               block->getKernel()->setCollisionFactor(collFactor);
-            }
-         }
-         ////////////////////////////////////////////////////////////////////////////
-
-         //domain decomposition for threads
-         if (numOfThreads > 1)
-         {
-            PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
-            grid->accept(pqPartVisitor);
-         }
-         //set connectors
-         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
-         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
-         grid->accept(setConnsVisitor);
-         SetSpongeLayerBlockVisitor ssp(spongeLayer);
-         grid->accept(ssp);
-         if (myid == 0) UBLOG(logINFO, "Restart - end");
-      }
-      UbSchedulerPtr visSch(new UbScheduler());
-      //visSch->addSchedule(1,0,10);
-      visSch->addSchedule(100, 100, 1000);
-      //visSch->addSchedule(1000,1000,5000);
-      //visSch->addSchedule(5000,5000,100000);
-      //visSch->addSchedule(100000,100000,10000000);
-
-      visSch->addSchedule(1000, 1000, 10000000);
-
-      D3Q27MacroscopicQuantitiesPostprocessor pp(grid, visSch, pathname, WbWriterVtkXmlBinary::getInstance(), unitConverter);
-
-      double startStep = 33000;
-
-      UbSchedulerPtr resSchRMS(new UbScheduler());
-      resSchRMS->addSchedule(1000000, startStep, 10000000);
-      UbSchedulerPtr resSchMeans(new UbScheduler());
-      resSchMeans->addSchedule(1000000, startStep, 10000000);
-      UbSchedulerPtr stepAvSch(new UbScheduler());
-      int averageInterval = 100;
-
-      stepAvSch->addSchedule(averageInterval, 0, 10000000);
-      AverageValuesPostprocessor Avpp(grid, pathname, WbWriterVtkXmlBinary::getInstance(), visSch/*wann wird rausgeschrieben*/,
-         stepAvSch/*wann wird gemittelt*/, resSchMeans, resSchRMS/*wann wird resettet*/, restart);
-
-      UbSchedulerPtr nupsSch(new UbScheduler(10, 10, 30));
-      nupsSch->addSchedule(500, 500, 1e6);
-      NUPSCounterPostprocessor npr(grid, nupsSch, numOfThreads, comm);
-
-      UbSchedulerPtr emSch(new UbScheduler(10));
-      EmergencyExitPostprocessor empr(grid, emSch, pathname, RestartPostprocessorPtr(&rp), comm);
-
-      if (myid == 0)
-      {
-         UBLOG(logINFO, "PID = " << myid << " Total Physical Memory (RAM): " << Utilities::getTotalPhysMem());
-         UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used: " << Utilities::getPhysMemUsed());
-         UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe());
-      }
-
-      double endTime = 100000001;
-      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, visSch));
-      if (myid == 0) UBLOG(logINFO, "Simulation-start");
-      calculation->calculate();
-      if (myid == 0) UBLOG(logINFO, "Simulation-end");
-   }
-   catch (std::exception& e)
-   {
-      cerr << e.what() << endl << flush;
-   }
-   catch (std::string& s)
-   {
-      cerr << s << endl;
-   }
-   catch (...)
-   {
-      cerr << "unknown exception" << endl;
-   }
-
-}
-//////////////////////////////////////////////////////////////////////////
-int main(int argc, char* argv[])
-{
-   if (argc == 1)
-   {
-      cout << "Command line argument isn't specified!" << endl;
-      cout << "plate2 <machine name>" << endl;
-      return 1;
-   }
-   run(argv[1]);
-
-   return 0;
-}
-
+
+
+#include <iostream>
+#include <string>
+#include <math.h> 
+
+#include <vfluids.h>
+
+using namespace std;
+
+//////////////////////////////////////////////////////////////////////////
+void inlay(GbVoxelMatrix3DPtr pmMesh, string& pathname, int myid, int i, Grid3DPtr grid)
+{
+   int bbOptionPM = 2; //quadratic bounce back with for thin walls
+   D3Q27BoundaryConditionAdapterPtr noSlipPM(new D3Q27NoSlipBCAdapter(bbOptionPM));
+   D3Q27InteractorPtr inlayInt = D3Q27InteractorPtr(new D3Q27Interactor(pmMesh, grid, noSlipPM, Interactor3D::SOLID));
+
+   GbCuboid3DPtr inlayBox(new GbCuboid3D(pmMesh->getX1Minimum(), pmMesh->getX2Minimum(), pmMesh->getX3Minimum(), pmMesh->getX1Maximum(), pmMesh->getX2Maximum(), pmMesh->getX3Maximum()));
+   if (myid == 0) GbSystem3D::writeGeoObject(inlayBox.get(), pathname + "/geo/inlay" + UbSystem::toString(i), WbWriterVtkXmlASCII::getInstance());
+   D3Q27InteractorPtr inlayBoxInt = D3Q27InteractorPtr(new D3Q27Interactor(inlayBox, grid, noSlipPM, Interactor3D::SOLID));
+   SetSolidOrTransBlockVisitor v1(inlayBoxInt, SetSolidOrTransBlockVisitor::SOLID);
+   grid->accept(v1);
+   SetSolidOrTransBlockVisitor v2(inlayBoxInt, SetSolidOrTransBlockVisitor::TRANS);
+   grid->accept(v2);
+
+   vector<Block3DPtr> inlayBlocks;
+   vector<Block3DPtr>& sb = inlayBoxInt->getSolidBlockSet();
+   if (myid == 0) UBLOG(logINFO, "sb.size = " << sb.size());
+   inlayBlocks.insert(inlayBlocks.end(), sb.begin(), sb.end());
+   vector<Block3DPtr>& tb = inlayBoxInt->getTransBlockSet();
+   if (myid == 0) UBLOG(logINFO, "tb.size = " << tb.size());
+   inlayBlocks.insert(inlayBlocks.end(), tb.begin(), tb.end());
+
+   if (myid == 0) UBLOG(logINFO, "inlayBlocks.size = " << inlayBlocks.size());
+
+   BOOST_FOREACH(Block3DPtr block, inlayBlocks)
+   {
+      block->setActive(true);
+      inlayInt->setDifferencesToGbObject3D(block);
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+void run(const char *cstr)
+{
+   try
+   {
+      string pathname;
+      string pathGeo;
+      string pathLog;
+      int numOfThreads = 1;
+      bool logfile = false;
+      stringstream logFilename;
+      double availMem = 0;
+
+      CommunicatorPtr comm = MPICommunicator::getInstance();
+      int myid = comm->getProcessID();
+
+      string machine = string(cstr);
+
+      if (machine == "my")
+      {
+         pathname = "d:/temp/porplate";
+         pathGeo = "d:/Data/plate";
+         pathLog = pathname;
+         numOfThreads = 4;
+         logfile = false;
+         availMem = 15.0e9;
+      }
+      else if (machine == "Ludwig")
+      {
+         pathname = "/work/koskuche/SFB880/porplate";
+         pathGeo = "/home/koskuche/data/plate";
+         pathLog = pathname;
+         numOfThreads = 8;
+         availMem = 12.0e9;///8*numOfThreads;
+         logfile = true;
+      }
+      else if (machine == "HLRS")
+      {
+         pathname = "/univ_1/ws1/ws/xrmkuchr-plate3-0";
+         pathGeo = "/zhome/academic/HLRS/xrm/xrmkuchr/data/plate";
+         pathLog = "/zhome/academic/HLRS/xrm/xrmkuchr/work/plate";
+         numOfThreads = 12;
+         availMem = 2.0e9;
+         logfile = true;
+      }
+      else if (machine == "HLRN")
+      {
+         pathname = "/gfs1/work/niikonst/scratch/porplate";
+         pathGeo = "/gfs1/work/niikonst/data/plate";
+         pathLog = pathname;
+         numOfThreads = 24;
+         availMem = 64.0e9;
+         logfile = true;
+      }
+      else throw UbException(UB_EXARGS, "unknown CAB_MACHINE");
+
+#if defined(__unix__)
+      if (myid==0) 
+      {
+         const char* str = pathLog.c_str();
+         int status=mkdir(str, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
+      }
+#endif 
+
+      if (myid == 0 && logfile)
+      {
+         //UbLog::reportingLevel() = logDEBUG5;
+         logFilename << pathLog + "/logfile" + UbSystem::toString(UbSystem::getTimeStamp()) + "_" + UbSystem::toString(myid) + ".txt";
+         UbLog::output_policy::setStream(logFilename.str());
+      }
+
+      if (myid == 0) UBLOG(logINFO, "Testcase plate");
+
+      string PlatteFilename = pathGeo + "/Platte_bearbeitet2.stl";
+
+      string ZckbndFilename = pathGeo + "/2zackenbaender0.stl";
+
+      ///////////////Knotenabmessungen:
+      int nx[3], blocknx[3];
+      nx[0] = 90;//240;//120;//60;//86;//43;//65;//50;  //länge
+      nx[1] = 2;//2;//6;///1;//5;// //breite
+      nx[2] = 30;//64;//32;//18;//5;//15;//15; //höhe gebiet
+      blocknx[0] = 16;//10;//6;
+      blocknx[1] = 16;//10;//6;
+      blocknx[2] = 16;//10;//6;
+
+      int baseLevel = 0;
+      int refineLevel = 5;
+
+      double H = 600.0; // Kanalhöhe [mm]
+      double cdx = H / (double)(nx[2] * blocknx[2]);
+      double fdx = cdx / double(1 << refineLevel);
+
+      //double h = 200.0; // gewünschte Plattenhöhe in Gitterpunkten
+      //double fdx = plate->getLengthX3()/h;
+      //double cdx = fdx*double(1<<refineLevel);
+
+      LBMUnitConverterPtr unitConverter = LBMUnitConverterPtr(new LBMUnitConverter());
+
+      //////////////////////////////////////////////////////////////////////////
+      // physik
+      //////////////////////////////////////////////////////////////////////////
+
+      //////////////////////////////////////////////////////////////////////////
+      // Experiment Parametr
+      // Re = 1000000
+      // V = 16.05  # m / s
+      // p = 994.7  #hPa(manuell abgelesen von MUB)
+      // T = 21.78  #°C
+      // Luftfeuchte = 50.5   # %
+      //////////////////////////////////////////////////////////////////////////
+      // Simulation Parametr
+      //////////////////////////////////////////////////////////////////////////
+      double Re = 1e6; // 1133333.3333333335;
+      double rhoLB = 0.0;
+      double uLB = 0.1;
+      double lReal = 1000; //Plattenlänge in mm
+      double nuLB = (uLB*(lReal / cdx)) / Re;
+
+      int sizeSP = 4;
+      mu::Parser spongeLayer;
+      spongeLayer.SetExpr("x1>=(sizeX-sizeSP)/dx ? (sizeX-(x1+1))/sizeSP/2.0 + 0.5 : 1.0");
+      spongeLayer.DefineConst("sizeX", nx[0] * blocknx[0]);
+      spongeLayer.DefineConst("sizeSP", sizeSP*blocknx[0]);
+
+      Grid3DPtr grid(new Grid3D(comm));
+
+      //////////////////////////////////////////////////////////////////////////
+      //restart
+      UbSchedulerPtr rSch(new UbScheduler(1000, 1000, 10000000));
+      RestartPostprocessor rp(grid, rSch, comm, pathname, RestartPostprocessor::BINARY);
+      //////////////////////////////////////////////////////////////////////////
+      bool restart;
+
+      if (grid->getTimeStep() == 0)
+      {
+
+         if (myid == 0) UBLOG(logINFO, "Neustart..");
+         restart = false;
+         //////////////////////////////////////////////////////////////////////////
+         //Platte
+         GbTriFaceMesh3DPtr plate(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(PlatteFilename, "Netz"));
+         if (myid == 0) GbSystem3D::writeGeoObject(plate.get(), pathname + "/geo/platte", WbWriterVtkXmlBinary::getInstance());
+         //////////////////////////////////////////////////////////////////////////
+         // Zackenband
+         //////////////////////////////////////////////////////////////////////////
+         GbTriFaceMesh3DPtr meshBand1(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "NetzBand"));
+         meshBand1->translate(5.0, -2.86, -14.717);
+         meshBand1->rotate(0.0, -0.5, 0.0);
+         if (myid == 0) GbSystem3D::writeGeoObject(meshBand1.get(), pathname + "/geo/Band1", WbWriterVtkXmlASCII::getInstance());
+         // Zackenband2
+         GbTriFaceMesh3DPtr meshBand2(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "NetzBand2"));
+         meshBand2->translate(5.0, -7.86, -14.717);
+         meshBand2->rotate(0.0, -0.5, 0.0);
+         if (myid == 0) GbSystem3D::writeGeoObject(meshBand2.get(), pathname + "/geo/Band2", WbWriterVtkXmlASCII::getInstance());
+         // Zackenband3
+         GbTriFaceMesh3DPtr meshBand3(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "NetzBand3"));
+         meshBand3->translate(5.0, -2.86, -14.417); //+0.3
+         meshBand3->rotate(0.0, -0.5, 0.0);
+         if (myid == 0) GbSystem3D::writeGeoObject(meshBand3.get(), pathname + "/geo/Band3", WbWriterVtkXmlASCII::getInstance());
+         // Zackenband4
+         GbTriFaceMesh3DPtr meshBand4(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "NetzBand4"));
+         meshBand4->translate(5.0, -7.86, -14.417);
+         meshBand4->rotate(0.0, -0.5, 0.0);
+         if (myid == 0) GbSystem3D::writeGeoObject(meshBand4.get(), pathname + "/geo/Band4", WbWriterVtkXmlASCII::getInstance());
+         //////////////////////////////////////////////////////////////////////////
+
+         //////////////////////////////////////////////////////////////////////////
+         //porous inlay
+         // string pmFilename1  = pathGeo + "/CT-2014-039.raw";
+         // int pmNX1t=1333;  //abmessung einzelbild in x-richtung
+         // int pmNX2t=463; //abmessung einzelbild in y richtung
+         // int pmNX3t=1333; //anzahl der bilder
+         // float lthresholdt = 27686.97;
+         // float uthresholdt = 65535.0;
+
+         //// string pmFilename1  = pathGeo + "/membran370x357x101.raw";
+         //// int pmNX1t=370;  //abmessung einzelbild in x-richtung
+         //// int pmNX2t=357; //abmessung einzelbild in y richtung
+         //// int pmNX3t=101; //anzahl der bilder
+         //// float lthresholdt = 55.0;
+         //// float uthresholdt = 182.0;
+
+         // GbVoxelMatrix3DPtr pmMesht(new GbVoxelMatrix3D(pmNX1t,pmNX2t,pmNX3t,0,lthresholdt,uthresholdt));
+         // pmMesht->readMatrixFromRawFile<unsigned short>(pmFilename1);
+         // //pmMesht->readMatrixFromRawFile<unsigned char>(pmFilename1);
+         // double deltaX1 = 0.05/pmNX2t;
+         // double deltaX2 = 0.05/pmNX2t;
+         // double deltaX3 = 0.05/pmNX3t;
+         // double scaleFactort = 0.001;
+         // double deltat = 3.75*scaleFactort;
+         // pmMesht->setVoxelMatrixDelta(deltat, deltat, deltat);
+         // pmMesht->rotate90aroundX(); 
+         // pmMesht->rotate90aroundX();
+         // pmMesht->rotate90aroundX();
+         // double inlayXmin = 0;
+         // double inlayYmin = 0;
+         // double inlayZmin = 0;
+         // pmMesht->setVoxelMatrixMininum(inlayXmin, inlayYmin, inlayZmin);
+         // 
+         // if(myid == 0) pmMesht->writeToLegacyVTKBinary(pathname+"/geo/pmMesh");
+
+         // return;
+         ////////////////////////////////////////////////////////////////////////////
+
+         double blockLengthx1 = blocknx[0] * cdx; //geowerte
+         double blockLengthx2 = blockLengthx1;
+         double blockLengthx3 = blockLengthx1;
+
+         double geoLength[] = { nx[0] * blockLengthx1, nx[1] * blockLengthx2, nx[2] * blockLengthx3 };
+
+         double originX1 = plate->getX1Minimum() - plate->getLengthX1() / 4.0;
+         double originX2 = plate->getX2Minimum();
+         double originX3 = plate->getX3Minimum() - 299.5;
+
+
+         bool periodicx1 = false;
+         bool periodicx2 = true;
+         bool periodicx3 = false;
+
+         //bounding box
+         double g_minX1 = originX1;
+         double g_minX2 = originX2;
+         double g_minX3 = originX3;
+
+         double g_maxX1 = originX1 + geoLength[0];
+         double g_maxX2 = originX2 + geoLength[1];
+         double g_maxX3 = originX3 + geoLength[2];;
+
+
+         //set grid
+         grid->setDeltaX(cdx);
+         grid->setBlockNX(blocknx[0], blocknx[1], blocknx[2]);
+         grid->setPeriodicX1(periodicx1);
+         grid->setPeriodicX2(periodicx2);
+         grid->setPeriodicX3(periodicx3);
+
+         GbObject3DPtr gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
+         gridCube->setCenterCoordinates(gridCube->getX1Centroid(), meshBand1->getX2Centroid(), gridCube->getX3Centroid());
+         if (myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), pathname + "/geo/gridCube", WbWriterVtkXmlASCII::getInstance());
+
+         originX2 = gridCube->getX2Minimum();
+         g_minX2 = originX2;
+         g_maxX2 = originX2 + geoLength[1];
+
+         GenBlocksGridVisitor genBlocks(gridCube);
+         grid->accept(genBlocks);
+
+         //////////////////////////////////////////////////////////////////////////
+         if (myid == 0)
+         {
+            UBLOG(logINFO, "*****************************************");
+            UBLOG(logINFO, "* Parameters                            *");
+            UBLOG(logINFO, "* Re            =" << Re);
+            UBLOG(logINFO, "* nuLB          =" << nuLB);
+            UBLOG(logINFO, "* uLB           =" << uLB);
+            UBLOG(logINFO, "* cdx           =" << cdx);
+            UBLOG(logINFO, "* fdx           =" << fdx);
+            double Hzb = 0.6 / fdx;
+            UBLOG(logINFO, "* Height of Zackenband =" << Hzb);
+            UBLOG(logINFO, "* Re on Zackenband =" << (uLB*Hzb) / (nuLB*double(1 << refineLevel)));
+            UBLOG(logINFO, "* nx1/2/3       =" << nx[0] << "/" << nx[1] << "/" << nx[2]);
+            UBLOG(logINFO, "* blocknx1/2/3  =" << blocknx[0] << "/" << blocknx[1] << "/" << blocknx[2]);
+            UBLOG(logINFO, "* x1Periodic    =" << periodicx1);
+            UBLOG(logINFO, "* x2Periodic    =" << periodicx2);
+            UBLOG(logINFO, "* x3Periodic    =" << periodicx3);
+            UBLOG(logINFO, "* number of levels  =" << refineLevel + 1);
+            UBLOG(logINFO, "* path          =" << pathname);
+
+            UBLOG(logINFO, "*****************************************");
+            UBLOG(logINFO, "* number of threads    =" << numOfThreads);
+            UBLOG(logINFO, "* number of processes  =" << comm->getNumberOfProcesses());
+            UBLOG(logINFO, "*****************************************");
+            UBLOG(logINFO, "*****************************************");
+         }
+         //////////////////////////////////////////////////////////////////////////
+
+
+         //////////////////////////////////////////////////////////////////////////
+         //refinement
+         GbCuboid3DPtr refinePlatteBox(new GbCuboid3D(plate->getX1Minimum() - 1.0, plate->getX2Minimum(), plate->getX3Minimum() + (plate->getX3Maximum() - plate->getX3Minimum()) / 2.0,
+            plate->getX1Maximum() + 40.0, plate->getX2Maximum(), plate->getX3Maximum() + 2.0));
+         if (myid == 0) GbSystem3D::writeGeoObject(refinePlatteBox.get(), pathname + "/geo/refinePlatteBox", WbWriterVtkXmlASCII::getInstance());
+
+         //inlay patch
+         GbCuboid3DPtr refineInlayBox(new GbCuboid3D(plate->getX1Maximum() - 85.0, plate->getX2Minimum(), plate->getX3Minimum() + (plate->getX3Maximum() - plate->getX3Minimum()) / 2.0,
+            plate->getX1Maximum() + 1.0, plate->getX2Maximum(), plate->getX3Maximum() + 1.0));
+         if (myid == 0) GbSystem3D::writeGeoObject(refineInlayBox.get(), pathname + "/geo/refineInlayBox", WbWriterVtkXmlASCII::getInstance());
+
+         if (refineLevel > 0)
+         {
+            if (myid == 0) UBLOG(logINFO, "Refinement - start");
+            RefineCrossAndInsideGbObjectHelper refineHelper(grid, refineLevel);
+            refineHelper.addGbObject(refinePlatteBox, refineLevel - 1);
+            refineHelper.addGbObject(refineInlayBox, refineLevel);
+
+            refineHelper.refine();
+            if (myid == 0) UBLOG(logINFO, "Refinement - end");
+         }
+
+         //if(myid == 0)
+         //{
+         //   UBLOG(logINFO,"Write blocks - start");
+         //   BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm));
+         //   ppblocks->update(0);
+         //   UBLOG(logINFO,"Write blocks - end");
+         //}
+
+         //return;
+
+
+         {
+
+            ////walls
+            GbCuboid3DPtr addWallZmin(new GbCuboid3D(g_minX1 - blockLengthx1, g_minX2 - blockLengthx1, g_minX3 - blockLengthx1, g_maxX1 + blockLengthx1, g_maxX2 + blockLengthx1, g_minX3));
+            if (myid == 0) GbSystem3D::writeGeoObject(addWallZmin.get(), pathname + "/geo/addWallZmin", WbWriterVtkXmlASCII::getInstance());
+
+            GbCuboid3DPtr addWallZmax(new GbCuboid3D(g_minX1 - blockLengthx1, g_minX2 - blockLengthx1, g_maxX3, g_maxX1 + blockLengthx1, g_maxX2 + blockLengthx1, g_maxX3 + blockLengthx1));
+            if (myid == 0) GbSystem3D::writeGeoObject(addWallZmax.get(), pathname + "/geo/addWallZmax", WbWriterVtkXmlASCII::getInstance());
+
+            //walls
+            int bbOption = 1; //0=simple Bounce Back, 1=quadr. BB
+            D3Q27BoundaryConditionAdapterPtr slip(new D3Q27SlipBCAdapter(bbOption));
+            D3Q27InteractorPtr addWallZminInt(new D3Q27Interactor(addWallZmin, grid, slip, Interactor3D::SOLID));
+            D3Q27InteractorPtr addWallZmaxInt(new D3Q27Interactor(addWallZmax, grid, slip, Interactor3D::SOLID));
+
+            /////////////////////////////////////////////////
+            ///interactoren
+            int bbOption1 = 1; //0=simple Bounce Back, 1=quadr. BB
+            D3Q27BoundaryConditionAdapterPtr noSlip(new D3Q27NoSlipBCAdapter(bbOption1));
+            D3Q27TriFaceMeshInteractorPtr triPlateInteractor(new D3Q27TriFaceMeshInteractor(plate, grid, noSlip, Interactor3D::SOLID, Interactor3D::POINTS));
+            D3Q27TriFaceMeshInteractorPtr triBand1Interactor(new D3Q27TriFaceMeshInteractor(meshBand1, grid, noSlip, Interactor3D::SOLID, Interactor3D::EDGES));
+            D3Q27TriFaceMeshInteractorPtr triBand2Interactor(new D3Q27TriFaceMeshInteractor(meshBand2, grid, noSlip, Interactor3D::SOLID, Interactor3D::EDGES));
+            D3Q27TriFaceMeshInteractorPtr triBand3Interactor(new D3Q27TriFaceMeshInteractor(meshBand3, grid, noSlip, Interactor3D::SOLID, Interactor3D::EDGES));
+            D3Q27TriFaceMeshInteractorPtr triBand4Interactor(new D3Q27TriFaceMeshInteractor(meshBand4, grid, noSlip, Interactor3D::SOLID, Interactor3D::EDGES));
+
+            //inflow
+            GbCuboid3DPtr velBCCuboid(new GbCuboid3D(originX1 - blockLengthx1, originX2 - blockLengthx1, originX3 - blockLengthx1,
+               originX1, originX2 + geoLength[1] + blockLengthx1, originX3 + geoLength[2] + blockLengthx1));
+            if (myid == 0) GbSystem3D::writeGeoObject(velBCCuboid.get(), pathname + "/geo/velBCCuboid", WbWriterVtkXmlASCII::getInstance());
+            D3Q27InteractorPtr velBCInteractor(new D3Q27Interactor(velBCCuboid, grid, Interactor3D::SOLID));
+
+            //inflow
+            double raiseVelSteps = 0;
+            vector<D3Q27BCFunction> velcX1BCs, dummy;
+
+            mu::Parser inflowProfile;
+            inflowProfile.SetExpr("uLB");
+            inflowProfile.DefineConst("uLB", uLB);
+            velcX1BCs.push_back(D3Q27BCFunction(inflowProfile, raiseVelSteps, D3Q27BCFunction::INFCONST));
+
+            D3Q27BoundaryConditionAdapterPtr velBCAdapter(new D3Q27VelocityBCAdapter(velcX1BCs, dummy, dummy));
+            velBCInteractor->addBCAdapter(velBCAdapter);
+
+            //outflow
+            GbCuboid3DPtr densCuboid(new GbCuboid3D(originX1 + geoLength[0], originX2 - blockLengthx1, originX3 - blockLengthx1,
+               originX1 + geoLength[0] + blockLengthx1, originX2 + geoLength[1] + blockLengthx1, originX3 + geoLength[2] + blockLengthx1));
+            if (myid == 0) GbSystem3D::writeGeoObject(densCuboid.get(), pathname + "/geo/densCuboid", WbWriterVtkXmlASCII::getInstance());
+            D3Q27BoundaryConditionAdapterPtr denBCAdapter(new D3Q27DensityBCAdapter(rhoLB));
+            D3Q27InteractorPtr densInteractor(new D3Q27Interactor(densCuboid, grid, denBCAdapter, Interactor3D::SOLID));
+
+            ////////////////////////////////////////////
+            //METIS
+            Grid3DVisitorPtr metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B));
+
+            ////////////////////////////////////////////
+            /////delete solid blocks
+            if (myid == 0) UBLOG(logINFO, "deleteSolidBlocks - start");
+            InteractorsHelper intHelper(grid, metisVisitor);
+            intHelper.addInteractor(triPlateInteractor);
+            intHelper.addInteractor(triBand1Interactor);
+            intHelper.addInteractor(triBand2Interactor);
+            intHelper.addInteractor(triBand3Interactor);
+            intHelper.addInteractor(triBand4Interactor);
+            intHelper.addInteractor(addWallZminInt);
+            intHelper.addInteractor(addWallZmaxInt);
+            intHelper.addInteractor(densInteractor);
+            intHelper.addInteractor(velBCInteractor);
+            intHelper.selectBlocks();
+            if (myid == 0) UBLOG(logINFO, "deleteSolidBlocks - end");
+            //////////////////////////////////////
+
+            //domain decomposition for threads
+            if (numOfThreads > 1)
+            {
+               PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
+               grid->accept(pqPartVisitor);
+            }
+
+            if (myid == 0)
+            {
+               UBLOG(logINFO, "Write blocks - start");
+               BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm));
+               ppblocks->update(0);
+               UBLOG(logINFO, "Write blocks - end");
+            }
+
+            unsigned long nob = grid->getNumberOfBlocks();
+            unsigned long nod = nob * blocknx[0] * blocknx[1] * blocknx[2];
+            unsigned long nod_real = nob * (blocknx[0] + 3)*(blocknx[1] + 3)*(blocknx[2] + 3);
+            unsigned long nodb = (blocknx[0]) * (blocknx[1]) * (blocknx[2]);
+
+            double needMemAll = double(nod_real*(27 * sizeof(double) + sizeof(int)));
+            double needMem = needMemAll / double(comm->getNumberOfProcesses());
+
+            double nup = 0;
+
+            if (myid == 0)
+            {
+               UBLOG(logINFO, "Number of blocks = " << nob);
+               UBLOG(logINFO, "Number of nodes  = " << nod);
+               int minInitLevel = grid->getCoarsestInitializedLevel();
+               int maxInitLevel = grid->getFinestInitializedLevel();
+               for (int level = minInitLevel; level <= maxInitLevel; level++)
+               {
+                  int nobl = grid->getNumberOfBlocks(level);
+                  UBLOG(logINFO, "Number of blocks for level " << level << " = " << nobl);
+                  UBLOG(logINFO, "Number of nodes for level " << level << " = " << nobl*nodb);
+                  nup += nobl*nodb*double(1 << level);
+               }
+               UBLOG(logINFO, "Hypothetically time for calculation step for 120 nodes  = " << nup / 6.0e5 / (120 * 8) << " s");
+               UBLOG(logINFO, "Necessary memory  = " << needMemAll << " bytes");
+               UBLOG(logINFO, "Necessary memory per process = " << needMem << " bytes");
+               UBLOG(logINFO, "Available memory per process = " << availMem << " bytes");
+               UBLOG(logINFO, "Available memory per node/8.0 = " << (availMem / 8.0) << " bytes");
+            }
+
+            //////////////////////////////////////////
+            //set connectors
+            if (myid == 0) UBLOG(logINFO, "set connectors - start");
+            D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
+            D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
+            grid->accept(setConnsVisitor);
+            if (myid == 0) UBLOG(logINFO, "set connectors - end");
+
+            ////////////////////////////
+            LBMKernel3DPtr kernel;
+            //kernel = LBMKernel3DPtr(new LBMKernelETD3Q27CCLB(blocknx[0], blocknx[1], blocknx[2], LBMKernelETD3Q27CCLB::NORMAL));
+
+            //with sponge layer
+            kernel = LBMKernel3DPtr(new LBMKernelETD3Q27CCLBWithSpongeLayer(blocknx[0], blocknx[1], blocknx[2], LBMKernelETD3Q27CCLB::NORMAL));
+            kernel->setWithSpongeLayer(true);
+            kernel->setSpongeLayer(spongeLayer);
+
+            //BCProcessorPtr bcProc(new D3Q27ETBCProcessor());
+            BCProcessorPtr bcProc(new D3Q27ETForThinWallBCProcessor());
+            kernel->setBCProcessor(bcProc);
+            SetKernelBlockVisitor kernelVisitor(kernel, nuLB, availMem, needMem);
+            grid->accept(kernelVisitor);
+            //////////////////////////////////
+            //undef nodes
+            if (refineLevel > 0)
+            {
+               D3Q27SetUndefinedNodesBlockVisitor undefNodesVisitor;
+               grid->accept(undefNodesVisitor);
+            }
+
+
+            intHelper.setBC();
+
+         }
+         //////////////////////////////////////////////////////////////////////////
+         //porous inlay
+         {
+            string pmFilename = pathGeo + "/CT-2014-039.raw";
+            int pmNX1 = 1333;  //abmessung einzelbild in x-richtung
+            int pmNX2 = 463; //abmessung einzelbild in y richtung
+            int pmNX3 = 1333; //anzahl der bilder
+            float lthreshold = 27686.97;
+            float uthreshold = 65535.0;
+
+            GbVoxelMatrix3DPtr pmMesh(new GbVoxelMatrix3D(pmNX1, pmNX2, pmNX3, 0, lthreshold, uthreshold));
+            pmMesh->readMatrixFromRawFile<unsigned short>(pmFilename, GbVoxelMatrix3D::LittleEndian);
+
+            double scaleFactor = 0.001;
+            double delta = 3.75*scaleFactor;
+            pmMesh->setVoxelMatrixDelta(delta, delta, delta);
+            pmMesh->rotate90aroundX();
+            pmMesh->rotate90aroundX();
+            pmMesh->rotate90aroundX();
+
+            double inlayXmin = plate->getX1Maximum() - 5.0;//995.0;
+            double inlayYmin = gridCube->getX2Minimum();//180.0;
+            double inlayZmin = 8.84 + fdx;//8.73;
+
+            //pmMesh->setVoxelMatrixMininum(inlayXmin, inlayYmin, inlayZmin);
+            //if(myid == 0) pmMesh->writeToLegacyVTKBinary(pathname+"/geo/pmMesh");
+
+            int i = 0;
+            for (int y = 0; y <= 35; y += 10)
+               for (int x = 0; x <= 75; x += 10)
+               {
+                  if (myid == 0) UBLOG(logINFO, "inlay # " << i);
+                  pmMesh->setVoxelMatrixMininum(inlayXmin - (double)x, inlayYmin + (double)y, inlayZmin);
+                  inlay(pmMesh, pathname, myid, i, grid);
+                  i++;
+
+                  if (myid == 0) UBLOG(logINFO, "inlay # " << i);
+                  pmMesh->setVoxelMatrixMininum(inlayXmin - (double)(x + 5), inlayYmin + (double)y, inlayZmin);
+                  pmMesh->mirrorX();
+                  inlay(pmMesh, pathname, myid, i, grid);
+                  i++;
+
+                  if (myid == 0) UBLOG(logINFO, "inlay # " << i);
+                  pmMesh->setVoxelMatrixMininum(inlayXmin - (double)(x + 5), inlayYmin + (double)(y + 5), inlayZmin);
+                  pmMesh->mirrorY();
+                  inlay(pmMesh, pathname, myid, i, grid);
+                  i++;
+
+                  if (myid == 0) UBLOG(logINFO, "inlay # " << i);
+                  pmMesh->setVoxelMatrixMininum(inlayXmin - (double)x, inlayYmin + (double)(y + 5), inlayZmin);
+                  pmMesh->mirrorX();
+                  inlay(pmMesh, pathname, myid, i, grid);
+                  pmMesh->mirrorY();
+                  i++;
+               }
+
+            if (myid == 0)
+            {
+               UBLOG(logINFO, "mit VoxelMatrix");
+               UBLOG(logINFO, "PID = " << myid << " Total Physical Memory (RAM): " << Utilities::getTotalPhysMem());
+               UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used: " << Utilities::getPhysMemUsed());
+               UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe());
+            }
+         }
+         //////////////////////////////////////////////////////////////////////////
+
+
+         //initialization of decompositions
+         D3Q27ETInitDistributionsBlockVisitor initVisitor(nuLB, rhoLB);
+         initVisitor.setVx1(uLB);
+         grid->accept(initVisitor);
+
+         //Postprozess
+         UbSchedulerPtr geoSch(new UbScheduler(1));
+         D3Q27MacroscopicQuantitiesPostprocessorPtr ppgeo(
+            new D3Q27MacroscopicQuantitiesPostprocessor(grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(),
+            unitConverter, true));
+         ppgeo->update(0);
+         ppgeo.reset();
+         geoSch.reset();
+
+         if (myid == 0) UBLOG(logINFO, "Preprozess - end");
+      }
+      else
+      {
+         restart = true;
+
+         ////////////////////////////////////////////////////////////////////////////
+         //change viscosity
+         Re = 1e6;
+         nuLB = ((uLB*(lReal/cdx))/Re)*1.043;
+         if (myid == 0) UBLOG(logINFO, "nuLB =" << nuLB);
+
+         int gridRank = grid->getRank();
+         int minInitLevel = grid->getCoarsestInitializedLevel();
+         int maxInitLevel = grid->getFinestInitializedLevel();
+
+         std::vector<std::vector<Block3DPtr> > blockVector;
+         blockVector.resize(maxInitLevel + 1);
+
+         for (int level = minInitLevel; level <= maxInitLevel; level++)
+         {
+            grid->getBlocks(level, gridRank, true, blockVector[level]);
+
+            BOOST_FOREACH(Block3DPtr block, blockVector[level])
+            {
+               LBMReal collFactor = LBMSystem::calcCollisionFactor(nuLB, block->getLevel());
+               block->getKernel()->setCollisionFactor(collFactor);
+            }
+         }
+         ////////////////////////////////////////////////////////////////////////////
+
+         //domain decomposition for threads
+         if (numOfThreads > 1)
+         {
+            PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
+            grid->accept(pqPartVisitor);
+         }
+         //set connectors
+         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
+         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
+         grid->accept(setConnsVisitor);
+         SetSpongeLayerBlockVisitor ssp(spongeLayer);
+         grid->accept(ssp);
+         if (myid == 0) UBLOG(logINFO, "Restart - end");
+      }
+      UbSchedulerPtr visSch(new UbScheduler());
+      //visSch->addSchedule(1,0,10);
+      visSch->addSchedule(100, 100, 1000);
+      //visSch->addSchedule(1000,1000,5000);
+      //visSch->addSchedule(5000,5000,100000);
+      //visSch->addSchedule(100000,100000,10000000);
+
+      visSch->addSchedule(1000, 1000, 10000000);
+
+      D3Q27MacroscopicQuantitiesPostprocessor pp(grid, visSch, pathname, WbWriterVtkXmlBinary::getInstance(), unitConverter);
+
+      double startStep = 33000;
+
+      UbSchedulerPtr resSchRMS(new UbScheduler());
+      resSchRMS->addSchedule(1000000, startStep, 10000000);
+      UbSchedulerPtr resSchMeans(new UbScheduler());
+      resSchMeans->addSchedule(1000000, startStep, 10000000);
+      UbSchedulerPtr stepAvSch(new UbScheduler());
+      int averageInterval = 100;
+
+      stepAvSch->addSchedule(averageInterval, 0, 10000000);
+      AverageValuesPostprocessor Avpp(grid, pathname, WbWriterVtkXmlBinary::getInstance(), visSch/*wann wird rausgeschrieben*/,
+         stepAvSch/*wann wird gemittelt*/, resSchMeans, resSchRMS/*wann wird resettet*/, restart);
+
+      UbSchedulerPtr nupsSch(new UbScheduler(10, 10, 30));
+      nupsSch->addSchedule(500, 500, 1e6);
+      NUPSCounterPostprocessor npr(grid, nupsSch, numOfThreads, comm);
+
+      UbSchedulerPtr emSch(new UbScheduler(10));
+      EmergencyExitPostprocessor empr(grid, emSch, pathname, RestartPostprocessorPtr(&rp), comm);
+
+      if (myid == 0)
+      {
+         UBLOG(logINFO, "PID = " << myid << " Total Physical Memory (RAM): " << Utilities::getTotalPhysMem());
+         UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used: " << Utilities::getPhysMemUsed());
+         UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe());
+      }
+
+      double endTime = 100000001;
+      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, visSch));
+      if (myid == 0) UBLOG(logINFO, "Simulation-start");
+      calculation->calculate();
+      if (myid == 0) UBLOG(logINFO, "Simulation-end");
+   }
+   catch (std::exception& e)
+   {
+      cerr << e.what() << endl << flush;
+   }
+   catch (std::string& s)
+   {
+      cerr << s << endl;
+   }
+   catch (...)
+   {
+      cerr << "unknown exception" << endl;
+   }
+
+}
+//////////////////////////////////////////////////////////////////////////
+int main(int argc, char* argv[])
+{
+   if (argc == 1)
+   {
+      cout << "Command line argument isn't specified!" << endl;
+      cout << "plate2 <machine name>" << endl;
+      return 1;
+   }
+   run(argv[1]);
+
+   return 0;
+}
+
diff --git a/apps/cpu/Thermoplast/thermoplast.cpp b/apps/cpu/Thermoplast/thermoplast.cpp
index b1319d70b39b10858f9ea4a181d847a495423644..60057f28ea51fe10da93d07cfad9cf3f35d1411d 100644
--- a/apps/cpu/Thermoplast/thermoplast.cpp
+++ b/apps/cpu/Thermoplast/thermoplast.cpp
@@ -1,763 +1,763 @@
-#include <iostream>
-#include <string>
-
-#include "PointerDefinitions.h"
-
-#include <iostream>
-#include <string>
-#include <memory>
-#include <array>
-
-#include "VirtualFluids.h"
-#include <muParser.h>
-#include "ForceCalculator.h"
-
-
-#include <MovableObjectInteractor.h>
-#include <DemCoProcessor.h>
-#include <PePartitioningGridVisitor.h>
-
-#include <PePhysicsEngineMaterialAdapter.h>
-#include <PePhysicsEngineGeometryAdapter.h>
-#include <PePhysicsEngineSolverAdapter.h>
-#include "PeLoadBalancerAdapter.h"
-
-#include <VelocityBcReconstructor.h>
-#include <EquilibriumReconstructor.h>
-#include <ExtrapolationReconstructor.h>
-
-#include <DummyPhysicsEngineSolverAdapter.h>
-#include <DummyPhysicsEngineMaterialAdapter.h>
-#include <DummyPhysicsEngineGeometryAdapter.h>
-#include <WriteDemObjectsCoProcessor.h>
-#include <WritePeBlocksCoProcessor.h>
-
-#include "CreateDemObjectsCoProcessor.h"
-#include "RestartDemObjectsCoProcessor.h"
-
-using namespace std;
-
-//simulation bounding box
-double g_minX1 = 0;
-double g_minX2 = 0;
-double g_minX3 = 0;
-
-double g_maxX1 = 0;
-double g_maxX2 = 0;
-double g_maxX3 = 0;
-
-vector<double> peMinOffset;
-vector<double> peMaxOffset;
-
-string          pathOut;// = "d:/temp/thermoplastCluster";
-string          pathGeo;// = "d:/Projects/ThermoPlast/Geometrie";
-
-void addNozzle(SPtr<Grid3D> grid, SPtr<Communicator> comm, SPtr<BCAdapter> noSlipBCAdapter/*, InteractorsHelper& intHelper*/)
-{
-   int myid = comm->getProcessID();
-   if (myid==0) UBLOG(logINFO, "Add nozzles:start");
-
-   SPtr<UbScheduler> sch(new UbScheduler(1));
-   WriteGbObjectsCoProcessor gbObjectsCoProcessor(grid, sch, pathOut, WbWriterVtkXmlBinary::getInstance(), comm);
-
-   std::vector< SPtr<Interactor3D> > interactors;
-
-   for (int i = 0; i <= 55; i++)
-   {
-      SPtr<GbTriFaceMesh3D> bbGeo = SPtr<GbTriFaceMesh3D>(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile2(pathGeo+"/n_bb_new/bb_new"+UbSystem::toString(i)+".stl", "bb", GbTriFaceMesh3D::KDTREE_SAHPLIT, false));
-      SPtr<Interactor3D> bbInt = SPtr<D3Q27TriFaceMeshInteractor>(new D3Q27TriFaceMeshInteractor(bbGeo, grid, noSlipBCAdapter, Interactor3D::SOLID, Interactor3D::EDGES));
-      //GbSystem3D::writeGeoObject(bbGeo.get(), pathOut+"/ns/bbGeo"+UbSystem::toString(i), WbWriterVtkXmlBinary::getInstance());
-      //intHelper.addInteractor(bbInt);
-      if (myid==0) gbObjectsCoProcessor.addGbObject(bbGeo);
-      interactors.push_back(bbInt);
-   }
-
-   for (int i = 0; i <= 334; i++)
-   {
-      SPtr<GbTriFaceMesh3D> bbGeo = SPtr<GbTriFaceMesh3D>(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile2(pathGeo+"/n_bb/bb"+UbSystem::toString(i)+".stl", "bb", GbTriFaceMesh3D::KDTREE_SAHPLIT, false));
-      SPtr<Interactor3D> bbInt = SPtr<D3Q27TriFaceMeshInteractor>(new D3Q27TriFaceMeshInteractor(bbGeo, grid, noSlipBCAdapter, Interactor3D::SOLID, Interactor3D::EDGES));
-      //GbSystem3D::writeGeoObject(bbGeo.get(), pathOut+"/ns/bbGeo"+UbSystem::toString(i), WbWriterVtkXmlBinary::getInstance());
-      //intHelper.addInteractor(bbInt);
-      if (myid==0) gbObjectsCoProcessor.addGbObject(bbGeo);
-      interactors.push_back(bbInt);
-   }
-
-   for (int i = 0; i <= 51; i++)
-   {
-      SPtr<GbTriFaceMesh3D> bsGeo = SPtr<GbTriFaceMesh3D>(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile2(pathGeo+"/n_bs/bs"+UbSystem::toString(i)+".stl", "bs", GbTriFaceMesh3D::KDTREE_SAHPLIT, false));
-      SPtr<Interactor3D> bsInt = SPtr<D3Q27TriFaceMeshInteractor>(new D3Q27TriFaceMeshInteractor(bsGeo, grid, noSlipBCAdapter, Interactor3D::SOLID, Interactor3D::EDGES));
-      //intHelper.addInteractor(bsInt);
-      if (myid==0) gbObjectsCoProcessor.addGbObject(bsGeo);
-      interactors.push_back(bsInt);
-   }
-
-   std::array<int, 6> n ={ 0,1,3,4,6,7 };
-
-   for (int i = 0; i < n.size(); i++)
-   {
-      SPtr<GbTriFaceMesh3D> biGeo = SPtr<GbTriFaceMesh3D>(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile2(pathGeo+"/n_bi/bi"+UbSystem::toString(n[i])+".stl", "bi", GbTriFaceMesh3D::KDTREE_SAHPLIT, false));
-      SPtr<Interactor3D> biInt = SPtr<D3Q27TriFaceMeshInteractor>(new D3Q27TriFaceMeshInteractor(biGeo, grid, noSlipBCAdapter, Interactor3D::SOLID, Interactor3D::EDGES));
-      //intHelper.addInteractor(biInt);
-      if (myid==0) gbObjectsCoProcessor.addGbObject(biGeo);
-      interactors.push_back(biInt);
-   }
-
-   if (myid==0) gbObjectsCoProcessor.process(0);
-
-
-   for (SPtr<Interactor3D> interactor : interactors)
-   {
-      std::vector< std::shared_ptr<Block3D> > blockVector;
-      UbTupleInt3 blockNX=grid->getBlockNX();
-      SPtr<GbObject3D> geoObject(interactor->getGbObject3D());
-      double ext = 0.0;
-      std::array<double, 6> AABB ={ geoObject->getX1Minimum(),geoObject->getX2Minimum(),geoObject->getX3Minimum(),geoObject->getX1Maximum(),geoObject->getX2Maximum(),geoObject->getX3Maximum() };
-      grid->getBlocksByCuboid(AABB[0]-(double)val<1>(blockNX)*ext, AABB[1]-(double)val<2>(blockNX)*ext, AABB[2]-(double)val<3>(blockNX)*ext, AABB[3]+(double)val<1>(blockNX)*ext, AABB[4]+(double)val<2>(blockNX)*ext, AABB[5]+(double)val<3>(blockNX)*ext, blockVector);
-      for (std::shared_ptr<Block3D> block : blockVector)
-      {
-         if (block->getKernel())
-         {
-            interactor->setBCBlock(block);
-         }
-      }
-      interactor->initInteractor();
-   }
-
-   if (myid==0) UBLOG(logINFO, "Add nozzles:end");
-}
-
-std::shared_ptr<DemCoProcessor> makePeCoProcessor(SPtr<Grid3D> grid, SPtr<Communicator> comm, const SPtr<UbScheduler> peScheduler, const std::shared_ptr<LBMUnitConverter> lbmUnitConverter, int maxpeIterations)
-{
-   double peRelaxtion = 0.7;
-   //int maxpeIterations = 10000;
-   //Beschleunigung g
-   double g = 9.81 * lbmUnitConverter->getFactorAccWToLb();
-   //Vector3D globalLinearAcc(0.0, -g, 0.0);
-   //Vector3D globalLinearAcc(0.0, 0.0, -g);
-   Vector3D globalLinearAcc(0.0, 0.0, 0.0);
-
-   std::shared_ptr<PePhysicsEngineMaterialAdapter> planeMaterial = std::make_shared<PePhysicsEngineMaterialAdapter>("granular", 1.0, 0, 0.1 / 2, 0.1 / 2, 0.5, 1, 1, 0, 0);
-
-   const int gridNX1 = val<1>(grid->getBlockNX()) * grid->getNX1();
-   const int gridNX2 = val<2>(grid->getBlockNX()) * grid->getNX2();
-   const int gridNX3 = val<3>(grid->getBlockNX()) * grid->getNX3();
-
-   //UbTupleInt3 simulationDomain(gridNx, gridNy, gridNz);
-   //std::array<double, 6> simulationDomain = {1, 1, 1, 30, 30, 30};
-   std::array<double, 6> simulationDomain ={ g_minX1, g_minX2, g_minX3, g_minX1+gridNX1, g_minX2+gridNX2, g_minX3+gridNX3 };
-   UbTupleInt3 numberOfBlocks(grid->getNX1(), grid->getNX2(), grid->getNX3());
-   //UbTupleInt3 numberOfBlocks((simulationDomain[3]-simulationDomain[0])/val<1>(grid->getBlockNX()), (simulationDomain[4]-simulationDomain[1])/val<2>(grid->getBlockNX()), (simulationDomain[5]-simulationDomain[2])/val<3>(grid->getBlockNX()));
-   UbTupleBool3 isPeriodic(grid->isPeriodicX1(), grid->isPeriodicX2(), grid->isPeriodicX3());
-   Vector3D minOffset(peMinOffset[0], peMinOffset[1], peMinOffset[2]);
-   Vector3D maxOffset(peMaxOffset[0], peMaxOffset[1], peMaxOffset[2]);
-
-   SPtr<GbObject3D> boxPE(new GbCuboid3D(simulationDomain[0]+minOffset[0], simulationDomain[1]+minOffset[1], simulationDomain[2]+minOffset[2], simulationDomain[3]+maxOffset[0], simulationDomain[4]+maxOffset[1], simulationDomain[5]+maxOffset[2]));
-   GbSystem3D::writeGeoObject(boxPE.get(), pathOut + "/geo/boxPE", WbWriterVtkXmlBinary::getInstance());
-
-   std::shared_ptr<PeParameter> peParamter = std::make_shared<PeParameter>(peRelaxtion, maxpeIterations, globalLinearAcc,
-      planeMaterial, simulationDomain, numberOfBlocks, isPeriodic, minOffset, maxOffset);
-   std::shared_ptr<PeLoadBalancerAdapter> loadBalancer(new PeLoadBalancerAdapter(grid, comm->getNumberOfProcesses(), comm->getProcessID()));
-   std::shared_ptr<PhysicsEngineSolverAdapter> peSolver = std::make_shared<PePhysicsEngineSolverAdapter>(peParamter, loadBalancer);
-   //create obstacle
-   //test
-   std::dynamic_pointer_cast<PePhysicsEngineSolverAdapter>(peSolver)->createObstacle(Vector3D( 90, 260, 472), Vector3D( 115, 320, 460));
-   //production
-   //std::dynamic_pointer_cast<PePhysicsEngineSolverAdapter>(peSolver)->createObstacle(Vector3D( 90, 430, 472), Vector3D( 115, 320, 460));
-   //std::dynamic_pointer_cast<PePhysicsEngineSolverAdapter>(peSolver)->createObstacle(Vector3D( 100, 430, 1840), Vector3D( 130, 320, 470));
-   //std::dynamic_pointer_cast<PePhysicsEngineSolverAdapter>(peSolver)->createObstacle(Vector3D( 100, 821, 1159), Vector3D( 125, 625, 625));
-   //walberla::pe::createSphere(*globalBodyStorage, *forest, *storageId, 0, walberla::pe::Vec3( -720, 820, 1150), 900, global, communicating, infiniteMass);
-   //walberla::pe::createSphere(*globalBodyStorage, *forest, *storageId, 0, walberla::pe::Vec3( -720, 220, 472), 900, material, global, communicating, infiniteMass);
-
-   SPtr<CoProcessor> peblocks(new WritePeBlocksCoProcessor(grid, SPtr<UbScheduler>(new UbScheduler(1)), pathOut, WbWriterVtkXmlBinary::getInstance(), comm, std::dynamic_pointer_cast<PePhysicsEngineSolverAdapter>(peSolver)->getBlockForest()));
-   peblocks->process(0);
-   peblocks.reset();
-
-   const std::shared_ptr<ForceCalculator> forceCalculator = std::make_shared<ForceCalculator>(comm);
-
-   return std::make_shared<DemCoProcessor>(grid, peScheduler, comm, forceCalculator, peSolver);
-}
-
-void createSpheres(double radius, Vector3D origin, int maxX2, int maxX3, double uLB, SPtr<CreateDemObjectsCoProcessor> createSphereCoProcessor)
-{
-   double d = 2.0*radius;
-   double dividerX2 = (double)maxX2/2.0;
-   double dividerX3 = (double)maxX3/2.0;
-   for (int x3 = 0; x3 < maxX3; x3++)
-      for (int x2 = 0; x2 < maxX2; x2++)
-         //for (int x1 = 0; x1 < 1; x1++)
-      {
-         //SPtr<GbObject3D> sphere(new GbSphere3D(origin[0]+2.0*d*(double)x1, origin[1]+(double)x2*1.0*d, origin[2]+(double)x3*1.0*d, radius));
-         SPtr<GbObject3D> sphere(new GbSphere3D(origin[0]+2.0*d, origin[1]+(double)x2*1.0*d, origin[2]+(double)x3*1.0*d, radius));
-         createSphereCoProcessor->addGeoObject(sphere, Vector3D(uLB, -uLB+uLB/dividerX2*(double)x2, -uLB+uLB/dividerX3*(double)x3));
-      }
-}
-
-void thermoplast(string configname)
-{
-   SPtr<Communicator> comm = MPICommunicator::getInstance();
-   int myid = comm->getProcessID();
-
-   ConfigurationFile   config;
-   config.load(configname);
-
-   vector<int>     blocknx = config.getVector<int>("blocknx");
-   vector<double>  boundingBox = config.getVector<double>("boundingBox");
-
-   int             endTime = config.getValue<int>("endTime");
-   double          outTime = config.getValue<double>("outTime");
-   double          availMem = config.getValue<double>("availMem");
-   double          uLB = config.getValue<double>("uLB");
-   double          Re = config.getValue<double>("Re");
-
-   string          michel = config.getValue<string>("michel");
-   string          plexiglas = config.getValue<string>("plexiglas");
-   double          sphereTime = config.getValue<double>("sphereTime");
-
-   double          cpStart = config.getValue<double>("cpStart");
-   double          cpStep = config.getValue<double>("cpStep");
-   bool            restart = config.getValue<bool>("restart");
-   int             restartStep = config.getValue<int>("restartStep");
-
-   peMinOffset = config.getVector<double>("peMinOffset");
-   peMaxOffset = config.getVector<double>("peMaxOffset");
-
-   pathOut = config.getValue<string>("pathOut");
-   pathGeo = config.getValue<string>("pathGeo");
-
-   vector<int>     nupsTime = config.getVector<int>("nupsTime");
-
-   bool            logToFile = config.getValue<bool>("logToFile");
-   if (logToFile)
-   {
-#if defined(__unix__)
-      if (myid==0)
-      {
-         const char* str = pathOut.c_str();
-         mkdir(str, S_IRWXU|S_IRWXG|S_IROTH|S_IXOTH);
-      }
-#endif 
-
-      if (myid==0)
-      {
-         stringstream logFilename;
-         logFilename<<pathOut+"/logfile"+UbSystem::getTimeStamp()+".txt";
-         UbLog::output_policy::setStream(logFilename.str());
-      }
-   }
-
-   bool obstacle = config.getValue<bool>("obstacle");
-   string obstacleGeo1 = config.getValue<string>("obstacleGeo1");
-   string obstacleGeo2 = config.getValue<string>("obstacleGeo2");
-   string obstacleGeo3 = config.getValue<string>("obstacleGeo3");
-
-   if (myid==0) UBLOG(logINFO, "BEGIN LOGGING - " << UbSystem::getTimeStamp());
-
-   //parameters
-   //string          pathOut = "d:/temp/thermoplast3";
-   //string          pathGeo = "d:/Projects/ThermoPlast/Geometrie";
-   int             numOfThreads = 1;
-   //int             blocknx[3] ={ 10,10,10 };
-   //double          endTime = 1000000;
-   //double          outTime = 300;
-   //double          availMem = 8e9;
-   double          deltax = 1;
-   double          rhoLB = 0.0;
-   //double          uLB =  0.1;
-   double          radiusLB = 7.5;
-   double          radiusWorld = 1.5e-3;
-   //double          nuLB = 0.000333333;
-   //double          Re = (uLB*2.0*radiusLB)/nuLB;
-   //double          Re = 900;
-   double          nuLB = (uLB*2.0*radiusLB)/Re;
-
-   //geometry definition
-
-   //simulation bounding box
-   g_minX1 = boundingBox[0];
-   g_minX2 = boundingBox[1];
-   g_minX3 = boundingBox[2];
-
-   g_maxX1 = boundingBox[3];
-   g_maxX2 = boundingBox[4];
-   g_maxX3 = boundingBox[5];
-
-   double blockLength = blocknx[0]*deltax;
-
-   //Grid definition
-   SPtr<Grid3D> grid(new Grid3D(comm));
-   grid->setDeltaX(deltax);
-   grid->setBlockNX(blocknx[0], blocknx[1], blocknx[2]);
-   grid->setPeriodicX1(false);
-   grid->setPeriodicX2(false);
-   grid->setPeriodicX3(false);
-
-   //boundary conditions definition 
-   //////////////////////////////////////////////////////////////////////////////
-   SPtr<BCAdapter> noSlipBCAdapter(new NoSlipBCAdapter());
-   //noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NoSlipBCAlgorithm()));
-   noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new ThinWallNoSlipBCAlgorithm()));
-
-   mu::Parser fct;
-   fct.SetExpr("U");
-   fct.DefineConst("U", uLB);
-   SPtr<BCAdapter> inflowAdapter(new VelocityBCAdapter(true, false, false, fct, 0, BCFunction::INFCONST));
-   inflowAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new VelocityBCAlgorithm()));
-   //inflowAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new VelocityWithDensityBCAlgorithm()));
-
-   SPtr<BCAdapter> outflowAdapter(new DensityBCAdapter(rhoLB));
-   outflowAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new EqDensityBCAlgorithm()));
-   //outflowAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NonEqDensityBCAlgorithm()));
-   //outflowAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NonReflectingOutflowBCAlgorithm()));
-
-   //sphere BC
-   mu::Parser fct2;
-   fct2.SetExpr("U");
-   fct2.DefineConst("U", 0.0);
-   SPtr<BCAdapter> velocityBcParticleAdapter(new VelocityBCAdapter(true, false, false, fct2, 0, BCFunction::INFCONST));
-   velocityBcParticleAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new VelocityWithDensityBCAlgorithm()));
-
-   //boundary conditions visitor
-   SPtr<BoundaryConditionsBlockVisitor> bcVisitor(new BoundaryConditionsBlockVisitor());
-   bcVisitor->addBC(noSlipBCAdapter);
-   bcVisitor->addBC(inflowAdapter);
-   bcVisitor->addBC(outflowAdapter);
-   bcVisitor->addBC(velocityBcParticleAdapter);
-   //////////////////////////////////////////////////////////////////////////////////
-
-   //LBM kernel definition
-   SPtr<LBMKernel> kernel;
-   kernel = SPtr<LBMKernel>(new IncompressibleCumulantLBMKernel());
-   //SPtr<BCProcessor> bcProc(new BCProcessor());
-   SPtr<BCProcessor> bcProc(new ThinWallBCProcessor());
-   kernel->setBCProcessor(bcProc);
-
-   //if (myid==0) UBLOG(logINFO, "Read obstacleGeo1:start");
-   //SPtr<GbTriFaceMesh3D> obstacleGeo1geo = SPtr<GbTriFaceMesh3D>(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile2(pathGeo+obstacleGeo1, "michelGeo", GbTriFaceMesh3D::KDTREE_SAHPLIT, false));
-   //if (myid==0) UBLOG(logINFO, "Read obstacleGeo1:end");
-   //if (myid==0) GbSystem3D::writeGeoObject(obstacleGeo1geo.get(), pathOut+"/geo/obstacleGeo1", WbWriterVtkXmlBinary::getInstance());
-   //g_minX1 = obstacleGeo1geo->getX1Minimum();
-   //g_minX2 = obstacleGeo1geo->getX2Minimum();
-   //g_minX3 = obstacleGeo1geo->getX3Minimum();
-   //g_maxX1 = obstacleGeo1geo->getX1Maximum();
-   //g_maxX2 = obstacleGeo1geo->getX2Maximum();
-   //g_maxX3 = obstacleGeo1geo->getX3Maximum();
-
-
-
-   //blocks generating
-   SPtr<GbObject3D> gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
-   if (myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), pathOut + "/geo/gridCube", WbWriterVtkXmlBinary::getInstance());
-   GenBlocksGridVisitor genBlocks(gridCube);
-   grid->accept(genBlocks);
-
-
-   //{
-     //SPtr<Interactor3D> obstacleGeo1int = SPtr<D3Q27TriFaceMeshInteractor>(new D3Q27TriFaceMeshInteractor(obstacleGeo1geo, grid, noSlipBCAdapter, Interactor3D::SOLID));
-     //SPtr<Grid3DVisitor> peVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::BSW, MetisPartitioner::KWAY));
-      //InteractorsHelper intHelper(grid, peVisitor, true);
-     //intHelper.addInteractor(obstacleGeo1int);
-     //intHelper.selectBlocks();
-
-     ////create LBM kernel
-      ////SetKernelBlockVisitor kernelVisitor(kernel, nuLB, availMem, 1);
-      ////grid->accept(kernelVisitor);
-
-      ////SPtr<Interactor3D> obstacleGeo1int = SPtr<D3Q27Interactor>(new D3Q27Interactor(obstacleGeo1geo, grid, noSlipBCAdapter, Interactor3D::SOLID));
-      ////UBLOG(logINFO, "Obst: start");
-      ////std::vector< std::shared_ptr<Block3D> > blockVector;
-      ////UbTupleInt3 blockNX=grid->getBlockNX();
-      ////SPtr<GbObject3D> geoObject(obstacleGeo1int->getGbObject3D());
-      ////double ext = 0.0;
-      ////std::array<double, 6> AABB ={ geoObject->getX1Minimum(),geoObject->getX2Minimum(),geoObject->getX3Minimum(),geoObject->getX1Maximum(),geoObject->getX2Maximum(),geoObject->getX3Maximum() };
-      ////grid->getBlocksByCuboid(AABB[0]-(double)val<1>(blockNX)*ext, AABB[1]-(double)val<2>(blockNX)*ext, AABB[2]-(double)val<3>(blockNX)*ext, AABB[3]+(double)val<1>(blockNX)*ext, AABB[4]+(double)val<2>(blockNX)*ext, AABB[5]+(double)val<3>(blockNX)*ext, blockVector);
-      ////for (std::shared_ptr<Block3D> block : blockVector)
-      ////{
-         ////if (block->getKernel())
-         ////{
-            ////obstacleGeo1int->setBCBlock(block);
-         ////}
-      ////}
-      ////UBLOG(logINFO, "Obst: select blocks");
-      ////obstacleGeo1int->initInteractor();
-      ////UBLOG(logINFO, "Obst: end");
-
-      //SPtr<CoProcessor> ppblocks(new WriteBlocksCoProcessor(grid, SPtr<UbScheduler>(new UbScheduler(1)), pathOut, WbWriterVtkXmlBinary::getInstance(), comm));
-      //ppblocks->process(0);
-      //ppblocks.reset();
-   //}
-
-   //return;
-
-
-   /////////////////////////////////////////////////////
-   ////PE domain test
-   //std::array<double, 6> simulationDomain ={ g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3 };
-   //Vector3D minOffset(peMinOffset[0], peMinOffset[1], peMinOffset[2]);
-   //Vector3D maxOffset(peMaxOffset[0], peMaxOffset[1], peMaxOffset[2]);
-   //SPtr<GbObject3D> boxPE(new GbCuboid3D(simulationDomain[0]+minOffset[0], simulationDomain[1]+minOffset[1], simulationDomain[2]+minOffset[2], simulationDomain[3]+maxOffset[0], simulationDomain[4]+maxOffset[1], simulationDomain[5]+maxOffset[2]));
-   //GbSystem3D::writeGeoObject(boxPE.get(), pathOut + "/geo/boxPE", WbWriterVtkXmlBinary::getInstance());
-   //return;
-   //////////////////////////////////////////////////////
-
-
-   if (myid == 0)
-   {
-      UBLOG(logINFO, "Parameters:");
-      UBLOG(logINFO, "* uLB    = " << uLB);
-      UBLOG(logINFO, "* rhoLB  = " << rhoLB);
-      UBLOG(logINFO, "* nuLB   = " << nuLB);
-      UBLOG(logINFO, "* deltaX = " << deltax);
-      UBLOG(logINFO, "* radius = " << radiusLB);
-      UBLOG(logINFO, "* Re     = " << Re);
-      UBLOG(logINFO, "* number of threads   = "<<numOfThreads);
-      UBLOG(logINFO, "* number of processes = "<<comm->getNumberOfProcesses());
-      UBLOG(logINFO, "* path = "<<pathOut);
-      UBLOG(logINFO, "Preprocess - start");
-   }
-
-   //GbCuboid3DPtr geoInjector2(new GbCuboid3D(-12, -5, 1210, 64, 105, 1320));
-   //if (myid == 0) GbSystem3D::writeGeoObject(geoInjector2.get(), pathOut + "/geo/geoInjector2", WbWriterVtkXmlASCII::getInstance());
-
-   //GbCuboid3DPtr geoInjector5(new GbCuboid3D(-12, 1415, 205, 64, 1525, 315));
-   //if (myid == 0) GbSystem3D::writeGeoObject(geoInjector5.get(), pathOut + "/geo/geoInjector5", WbWriterVtkXmlASCII::getInstance());
-
-   GbCuboid3DPtr geoInjector4(new GbCuboid3D(-12, -5, 205, 64, 105, 315));
-   if (myid == 0) GbSystem3D::writeGeoObject(geoInjector4.get(), pathOut + "/geo/geoInjector4", WbWriterVtkXmlASCII::getInstance());
-
-   //GbCuboid3DPtr geoInjector7(new GbCuboid3D(28, 705, 542, 103, 815, 652));
-   //if (myid == 0) GbSystem3D::writeGeoObject(geoInjector7.get(), pathOut + "/geo/geoInjector7", WbWriterVtkXmlASCII::getInstance());
-
-   GbCuboid3DPtr testWallGeo(new GbCuboid3D(g_minX1-blockLength, g_minX2 - blockLength, g_maxX3, g_maxX1 + blockLength, g_maxX2 + blockLength, g_maxX3 + blockLength));
-   if (myid == 0) GbSystem3D::writeGeoObject(testWallGeo.get(), pathOut + "/geo/testWallGeo", WbWriterVtkXmlASCII::getInstance());
-
-   if (!restart)
-   {
-      //box
-      SPtr<GbObject3D> box(new GbCuboid3D(g_minX1-blockLength, g_minX2, g_minX3, g_maxX1+blockLength, g_maxX2, g_maxX3));
-      GbSystem3D::writeGeoObject(box.get(), pathOut + "/geo/box", WbWriterVtkXmlBinary::getInstance());
-
-      //michel
-      if (myid==0) UBLOG(logINFO, "Read michelGeo:start");
-      SPtr<GbTriFaceMesh3D> michelGeo = SPtr<GbTriFaceMesh3D>(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile2(pathGeo+michel, "michelGeo", GbTriFaceMesh3D::KDTREE_SAHPLIT, false));
-      if (myid==0) UBLOG(logINFO, "Read michelGeo:end");
-      if (myid==0) GbSystem3D::writeGeoObject(michelGeo.get(), pathOut+"/geo/michelGeo", WbWriterVtkXmlBinary::getInstance());
-
-      //plexiglas
-      if (myid==0) UBLOG(logINFO, "Read plexiglasGeo:start");
-      SPtr<GbTriFaceMesh3D> plexiglasGeo = SPtr<GbTriFaceMesh3D>(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile2(pathGeo+plexiglas, "plexiglasGeo", GbTriFaceMesh3D::KDTREE_SAHPLIT, false));
-      if (myid==0) UBLOG(logINFO, "Read plexiglasGeo:end");
-      if (myid==0) GbSystem3D::writeGeoObject(plexiglasGeo.get(), pathOut+"/geo/plexiglasGeo", WbWriterVtkXmlBinary::getInstance());
-
-      //inflow
-      GbCuboid3DPtr geoOutflowMichel(new GbCuboid3D(g_minX1-blockLength, g_minX2 - blockLength, g_minX3 - blockLength, g_minX1, g_maxX2 + blockLength, g_maxX3 + blockLength));
-      if (myid == 0) GbSystem3D::writeGeoObject(geoOutflowMichel.get(), pathOut + "/geo/geoOutflowMichel", WbWriterVtkXmlASCII::getInstance());
-
-      //outflow
-      GbCuboid3DPtr geoOutflowPlexiglas(new GbCuboid3D(g_maxX1, g_minX2 - blockLength, g_minX3 - blockLength, g_maxX1 + blockLength, g_maxX2 + blockLength, g_maxX3 + blockLength));
-      if (myid == 0) GbSystem3D::writeGeoObject(geoOutflowPlexiglas.get(), pathOut + "/geo/geoOutflowPlexiglas", WbWriterVtkXmlASCII::getInstance());
-
-      //set boundary conditions for blocks and create process decomposition for MPI
-      SPtr<D3Q27Interactor> boxInt(new D3Q27Interactor(box, grid, noSlipBCAdapter, Interactor3D::INVERSESOLID));
-
-      //inflow
-      //SPtr<D3Q27Interactor> inflowInjector2Int = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoInjector2, grid, inflowAdapter, Interactor3D::SOLID));
-      //SPtr<D3Q27Interactor> inflowInjector5Int = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoInjector5, grid, inflowAdapter, Interactor3D::SOLID));
-      SPtr<D3Q27Interactor> inflowInjector4Int = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoInjector4, grid, inflowAdapter, Interactor3D::SOLID));
-      //SPtr<D3Q27Interactor> inflowInjector7Int = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoInjector7, grid, inflowAdapter, Interactor3D::SOLID));
-
-      SPtr<D3Q27Interactor> outflowMichelInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoOutflowMichel, grid, outflowAdapter, Interactor3D::SOLID));
-
-      //outflow
-      SPtr<D3Q27Interactor> outflowPlexiglasInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoOutflowPlexiglas, grid, outflowAdapter, Interactor3D::SOLID));
-
-      //michel
-      SPtr<Interactor3D> michelInt = SPtr<D3Q27TriFaceMeshInteractor>(new D3Q27TriFaceMeshInteractor(michelGeo, grid, noSlipBCAdapter, Interactor3D::SOLID));
-
-      //plexiglas
-      SPtr<Interactor3D> plexiglasInt = SPtr<D3Q27TriFaceMeshInteractor>(new D3Q27TriFaceMeshInteractor(plexiglasGeo, grid, noSlipBCAdapter, Interactor3D::SOLID));
-
-      SPtr<D3Q27Interactor> testWallInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(testWallGeo, grid, inflowAdapter, Interactor3D::SOLID));
-
-      SPtr<Interactor3D> obstacleGeo1int, obstacleGeo2int, obstacleGeo3int;
-      if (obstacle)
-      {
-         //obstacleGeo1
-         if (myid==0) UBLOG(logINFO, "Read obstacleGeo1:start");
-         SPtr<GbTriFaceMesh3D> obstacleGeo1geo = SPtr<GbTriFaceMesh3D>(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile2(pathGeo+obstacleGeo1, "michelGeo", GbTriFaceMesh3D::KDTREE_SAHPLIT, false));
-         if (myid==0) UBLOG(logINFO, "Read obstacleGeo1:end");
-         if (myid==0) GbSystem3D::writeGeoObject(obstacleGeo1geo.get(), pathOut+"/geo/obstacleGeo1", WbWriterVtkXmlBinary::getInstance());
-         obstacleGeo1int = SPtr<D3Q27TriFaceMeshInteractor>(new D3Q27TriFaceMeshInteractor(obstacleGeo1geo, grid, noSlipBCAdapter, Interactor3D::SOLID));
-         //obstacleGeo2
-         if (myid==0) UBLOG(logINFO, "Read obstacleGeo2:start");
-         SPtr<GbTriFaceMesh3D> obstacleGeo2geo = SPtr<GbTriFaceMesh3D>(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile2(pathGeo+obstacleGeo2, "michelGeo", GbTriFaceMesh3D::KDTREE_SAHPLIT, false));
-         if (myid==0) UBLOG(logINFO, "Read obstacleGeo2:end");
-         if (myid==0) GbSystem3D::writeGeoObject(obstacleGeo2geo.get(), pathOut+"/geo/obstacleGeo2", WbWriterVtkXmlBinary::getInstance());
-         obstacleGeo2int = SPtr<D3Q27TriFaceMeshInteractor>(new D3Q27TriFaceMeshInteractor(obstacleGeo2geo, grid, noSlipBCAdapter, Interactor3D::SOLID));
-         //obstacleGeo3
-         if (myid==0) UBLOG(logINFO, "Read obstacleGeo3:start");
-         SPtr<GbTriFaceMesh3D> obstacleGeo3geo = SPtr<GbTriFaceMesh3D>(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile2(pathGeo+obstacleGeo3, "michelGeo", GbTriFaceMesh3D::KDTREE_SAHPLIT, false));
-         if (myid==0) UBLOG(logINFO, "Read obstacleGeo3:end");
-         if (myid==0) GbSystem3D::writeGeoObject(obstacleGeo3geo.get(), pathOut+"/geo/obstacleGeo3", WbWriterVtkXmlBinary::getInstance());
-         obstacleGeo3int = SPtr<D3Q27TriFaceMeshInteractor>(new D3Q27TriFaceMeshInteractor(obstacleGeo3geo, grid, noSlipBCAdapter, Interactor3D::SOLID));
-      }
-
-      //////////////////////////////////////////////////////////////////////////
-      //SPtr<Grid3DVisitor> peVisitor(new PePartitioningGridVisitor(comm, demCoProcessor));
-      SPtr<Grid3DVisitor> peVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::BSW, MetisPartitioner::KWAY));
-      InteractorsHelper intHelper(grid, peVisitor, true);
-
-      //intHelper.addInteractor(obstacleGeo1int);
-
-      intHelper.addInteractor(boxInt);
-      intHelper.addInteractor(michelInt);
-      intHelper.addInteractor(plexiglasInt);
-      //intHelper.addInteractor(inflowInjector2Int);
-      //intHelper.addInteractor(inflowInjector5Int);
-      intHelper.addInteractor(inflowInjector4Int);
-      //intHelper.addInteractor(inflowInjector7Int);
-      intHelper.addInteractor(outflowPlexiglasInt);
-      intHelper.addInteractor(outflowMichelInt);
-      intHelper.addInteractor(obstacleGeo1int);
-      intHelper.addInteractor(obstacleGeo2int);
-      intHelper.addInteractor(obstacleGeo3int);
-      //intHelper.addInteractor(testWallInt);
-      intHelper.selectBlocks();
-
-      //write data for visualization of block grid
-      SPtr<CoProcessor> ppblocks(new WriteBlocksCoProcessor(grid, SPtr<UbScheduler>(new UbScheduler(1)), pathOut, WbWriterVtkXmlBinary::getInstance(), comm));
-      ppblocks->process(0);
-      ppblocks.reset();
-
-      unsigned long long numberOfBlocks = (unsigned long long)grid->getNumberOfBlocks();
-      int ghostLayer = 3;
-      unsigned long long numberOfNodesPerBlock = (unsigned long long)(blocknx[0])* (unsigned long long)(blocknx[1])* (unsigned long long)(blocknx[2]);
-      unsigned long long numberOfNodes = numberOfBlocks * numberOfNodesPerBlock;
-      unsigned long long numberOfNodesPerBlockWithGhostLayer = numberOfBlocks * (blocknx[0] + ghostLayer) * (blocknx[1] + ghostLayer) * (blocknx[2] + ghostLayer);
-      double needMemAll = double(numberOfNodesPerBlockWithGhostLayer*(27 * sizeof(double) + sizeof(int) + sizeof(float) * 4));
-      double needMem = needMemAll / double(comm->getNumberOfProcesses());
-
-      if (myid == 0)
-      {
-         UBLOG(logINFO, "Number of blocks = " << numberOfBlocks);
-         UBLOG(logINFO, "Number of nodes  = " << numberOfNodes);
-         int minInitLevel = grid->getCoarsestInitializedLevel();
-         int maxInitLevel = grid->getFinestInitializedLevel();
-         for (int level = minInitLevel; level <= maxInitLevel; level++)
-         {
-            int nobl = grid->getNumberOfBlocks(level);
-            UBLOG(logINFO, "Number of blocks for level " << level << " = " << nobl);
-            UBLOG(logINFO, "Number of nodes for level " << level << " = " << nobl*numberOfNodesPerBlock);
-         }
-         UBLOG(logINFO, "Necessary memory  = " << needMemAll << " bytes");
-         UBLOG(logINFO, "Necessary memory per process = " << needMem << " bytes");
-         UBLOG(logINFO, "Available memory per process = " << availMem << " bytes");
-      }
-
-      //create LBM kernel
-      SetKernelBlockVisitor kernelVisitor(kernel, nuLB, availMem, needMem);
-      grid->accept(kernelVisitor);
-
-      addNozzle(grid, comm, noSlipBCAdapter/*,intHelper*/);
-
-      intHelper.setBC();
-
-
-      ////////////////////////////////////////////////////////////////////////////////////////////////////
-      //{
-         ////UBLOG(logINFO, "Obst: start, rank="<<myid);
-            //std::vector< std::shared_ptr<Block3D> > blockVector;
-            //UbTupleInt3 blockNX=grid->getBlockNX();
-            //SPtr<GbObject3D> geoObject(obstacleGeo3int->getGbObject3D());
-            //double ext = 0.0;
-            //std::array<double, 6> AABB ={ geoObject->getX1Minimum(),geoObject->getX2Minimum(),geoObject->getX3Minimum(),geoObject->getX1Maximum(),geoObject->getX2Maximum(),geoObject->getX3Maximum() };
-            //grid->getBlocksByCuboid(AABB[0]-(double)val<1>(blockNX)*ext, AABB[1]-(double)val<2>(blockNX)*ext, AABB[2]-(double)val<3>(blockNX)*ext, AABB[3]+(double)val<1>(blockNX)*ext, AABB[4]+(double)val<2>(blockNX)*ext, AABB[5]+(double)val<3>(blockNX)*ext, blockVector);
-            //for (std::shared_ptr<Block3D> block : blockVector)
-            //{
-               //if (block->getKernel())
-               //{
-                  //obstacleGeo3int->setBCBlock(block);
-               //}
-            //}
-            //UBLOG(logINFO, "Obst: select blocks, number of blocks="<<blockVector.size()<<", rank="<<myid);
-            //obstacleGeo3int->initInteractor();
-            //UBLOG(logINFO, "Obst: end, rank="<<myid);
-      //}
-      //////////////////////////////////////////////////////////////////////////////////////////////////////
-            //initialization of distributions
-      InitDistributionsBlockVisitor initVisitor;
-      //initVisitor.setVx1(uLB);
-      grid->accept(initVisitor);
-
-      //write data for visualization of boundary conditions
-      {
-         //SPtr<UbScheduler> geoSch(new UbScheduler(1));
-         //WriteBoundaryConditionsCoProcessor ppgeo(grid, geoSch, pathOut, WbWriterVtkXmlBinary::getInstance(), comm);
-         //ppgeo.process(0);
-
-         //WriteMacroscopicQuantitiesCoProcessor ppInit(grid, geoSch, pathOut, WbWriterVtkXmlBinary::getInstance(), SPtr<LBMUnitConverter>(new LBMUnitConverter()), comm);
-         //ppInit.process(0);
-      }
-
-      if (myid == 0) UBLOG(logINFO, "Preprocess - end");
-   }
-   //restart
-   //UBLOG(logINFO, "restart definition - start, rank="<<myid);
-   SPtr<UbScheduler> restartSch(new UbScheduler(cpStep, cpStart));
-   //SPtr<MPIIORestartCoProcessor> restartCoProcessor(new MPIIORestartCoProcessor(grid, restartSch, pathOut, comm));
-   SPtr<MPIIOMigrationCoProcessor> restartCoProcessor(new MPIIOMigrationCoProcessor(grid, restartSch, pathOut, comm));
-   restartCoProcessor->setLBMKernel(kernel);
-   restartCoProcessor->setBCProcessor(bcProc);
-
-   if (restart)
-   {
-      //restartStep = restartCoProcessor->readCpTimeStep();
-      restartCoProcessor->restart(restartStep);
-   }
-
-   //PE initialization
-   double refLengthLb = radiusLB*2.0;
-   double refLengthWorld = radiusWorld*2.0;
-   const std::shared_ptr<LBMUnitConverter> lbmUnitConverter = std::make_shared<LBMUnitConverter>(refLengthWorld, LBMUnitConverter::WORLD_MATERIAL::AIR_20C, refLengthLb);
-   if (myid == 0) std::cout << lbmUnitConverter->toString() << std::endl;
-   double rhoSphere = 915 * lbmUnitConverter->getFactorDensityWToLb();  // kg/m^3
-   if (myid == 0) UBLOG(logINFO, "rhoSphere = "<<rhoSphere);
-   SPtr<PhysicsEngineMaterialAdapter> sphereMaterial(new PePhysicsEngineMaterialAdapter("Polypropylen", rhoSphere, 0, 0.15, 0.1, 0.45, 0.5, 1, 0, 0));
-   const int timestep = 2;
-   const SPtr<UbScheduler> peScheduler(new UbScheduler(timestep));
-   int maxpeIterations = 10;//endTime/2;
-   SPtr<DemCoProcessor> demCoProcessor = makePeCoProcessor(grid, comm, peScheduler, lbmUnitConverter, maxpeIterations);
-   demCoProcessor->setBlockVisitor(bcVisitor);
-
-   ////////////////////////////////////////////////////////////////////////////
-   ////generating spheres 
-   //UBLOG(logINFO, "generating spheres - start, rank="<<myid);
-   SPtr<UbScheduler> sphereScheduler(new UbScheduler(sphereTime/*10,10,10*/));
-   double toleranz = 0.0;//0.05;
-   SPtr<CreateDemObjectsCoProcessor> createSphereCoProcessor(new CreateDemObjectsCoProcessor(grid, sphereScheduler, comm, demCoProcessor, sphereMaterial, toleranz));
-   //UBLOG(logINFO, "generating spheres - stop, rank="<<myid);
-
-   ////restart
-   ////UBLOG(logINFO, "restart definition - start, rank="<<myid);
-   //SPtr<UbScheduler> restartSch(new UbScheduler(cpStep, cpStart));
-   ////SPtr<MPIIORestartCoProcessor> restartCoProcessor(new MPIIORestartCoProcessor(grid, restartSch, pathOut, comm));
-   //SPtr<MPIIOMigrationCoProcessor> restartCoProcessor(new MPIIOMigrationCoProcessor(grid, restartSch, pathOut, comm));
-   //restartCoProcessor->setLBMKernel(kernel);
-   //restartCoProcessor->setBCProcessor(bcProc);
-   SPtr<RestartDemObjectsCoProcessor> restartDemObjectsCoProcessor(new RestartDemObjectsCoProcessor(grid, restartSch, pathOut, demCoProcessor, createSphereCoProcessor, radiusLB, comm));
-   //UBLOG(logINFO, "restart definition - stop, rank="<<myid);
-
-   if (restart)
-   {
-      createSphereCoProcessor->setToleranz(0.05);
-      restartDemObjectsCoProcessor->restart(restartStep);
-      createSphereCoProcessor->setToleranz(toleranz);
-   }
-
-   //set connectors
-   //UBLOG(logINFO, "set connectors - start, rank="<<myid);
-   InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor());
-   SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
-   grid->accept(setConnsVisitor);
-   //UBLOG(logINFO, "set connectors - stop, rank="<<myid);
-
-   //BC visitor
-   //UBLOG(logINFO, "BC visitor - start, rank="<<myid);
-   grid->accept(*bcVisitor.get());
-   //UBLOG(logINFO, "BC visitor - stop, rank="<<myid);
-
-   //sphere prototypes
-   //UBLOG(logINFO, "sphere prototypes - start, rank="<<myid);
-   double d = 2.0*radiusLB;
-   int maxX2 = 5;
-   int maxX3 = 5;
-   //Vector3D origin1(g_minX1+peMinOffset[0]-1.5*d, geoInjector5->getX2Minimum()+1.4*d-6.0, geoInjector5->getX3Minimum()+1.5*d);
-   //createSpheres(radiusLB, origin1, maxX2, maxX3, uLB, createSphereCoProcessor);
-   //Vector3D origin2(g_minX1+peMinOffset[0]-1.5*d, geoInjector2->getX2Minimum()+2.2*d, geoInjector2->getX3Minimum()+1.5*d);
-   //createSpheres(radiusLB, origin2, maxX2, maxX3, uLB, createSphereCoProcessor);
-
-   Vector3D origin2(g_minX1+peMinOffset[0]-1.5*d, geoInjector4->getX2Minimum()+2.4*d, geoInjector4->getX3Minimum()+1.5*d);
-   createSpheres(radiusLB,origin2,maxX2,maxX3,uLB,createSphereCoProcessor);
-
-   //maxX2 = 7;
-   //maxX3 = 7;
-   //Vector3D origin3(g_minX1+peMinOffset[0]-1.5*d, geoInjector7->getX2Minimum()+0.5*d, geoInjector7->getX3Minimum()+0.5*d);
-   //createSpheres(radiusLB,origin3,maxX2,maxX3,uLB,createSphereCoProcessor);
-
-
-   createSphereCoProcessor->process(0);
-
-   //write data for visualization of macroscopic quantities
-   SPtr<UbScheduler> visSch(new UbScheduler(outTime));
-   SPtr<WriteMacroscopicQuantitiesCoProcessor> writeMQCoProcessor(new WriteMacroscopicQuantitiesCoProcessor(grid, visSch, pathOut,
-      WbWriterVtkXmlBinary::getInstance(), SPtr<LBMUnitConverter>(new LBMUnitConverter()), comm));
-
-   SPtr<WriteBoundaryConditionsCoProcessor> writeBCCoProcessor(new WriteBoundaryConditionsCoProcessor(grid, visSch, pathOut,
-      WbWriterVtkXmlBinary::getInstance(), comm));
-
-   SPtr<WriteDemObjectsCoProcessor> writeDemObjectsCoProcessor(new WriteDemObjectsCoProcessor(grid, visSch, pathOut, WbWriterVtkXmlBinary::getInstance(), demCoProcessor, comm));
-
-   if (!restart)
-   {
-      writeMQCoProcessor->process(0);
-      writeBCCoProcessor->process(0);
-      writeDemObjectsCoProcessor->process(0);
-   }
-   ////performance control
-   SPtr<UbScheduler> nupsSch(new UbScheduler(nupsTime[0], nupsTime[1], nupsTime[2]));
-   SPtr<NUPSCounterCoProcessor> npr(new NUPSCounterCoProcessor(grid, nupsSch, numOfThreads, comm));
-
-   //start simulation 
-   //omp_set_num_threads(numOfThreads);
-   SPtr<UbScheduler> stepGhostLayer(peScheduler);
-   SPtr<Calculator> calculator(new BasicCalculator(grid, stepGhostLayer, endTime));
-
-   calculator->addCoProcessor(npr);
-   calculator->addCoProcessor(createSphereCoProcessor);
-   calculator->addCoProcessor(demCoProcessor);
-   ////calculator->addCoProcessor(writeBCCoProcessor);
-   calculator->addCoProcessor(writeDemObjectsCoProcessor);
-   calculator->addCoProcessor(writeMQCoProcessor);
-   calculator->addCoProcessor(restartDemObjectsCoProcessor);
-   calculator->addCoProcessor(restartCoProcessor);
-
-   if (myid == 0) UBLOG(logINFO, "Simulation-start");
-   calculator->calculate();
-   if (myid == 0) UBLOG(logINFO, "Simulation-end");
-   if (myid==0) UBLOG(logINFO, "END LOGGING - " << UbSystem::getTimeStamp());
-}
-
-//////////////////////////////////////////////////////////////////////////
-int main(int argc, char* argv[])
-{
-   try
-   {
-      //Sleep(30000);
-      walberla::Environment env(argc, argv);
-
-      if (argv!=NULL)
-      {
-         //if (argv[1]!=NULL)
-         //{
-            //thermoplast(string("thermoplast.cfg"));
-         thermoplast(string("d:/Projects/VirtualFluidsGit/source/Applications/Thermoplast/config.txt"));
-         //}
-         //else
-         //{
-            //cout<<"Configuration file must be set!: "<<argv[0]<<" <config file>"<<endl<<std::flush;
-         //}
-      }
-      return 0;
-   }
-   catch (std::exception& e)
-   {
-      UBLOG(logERROR, e.what());
-   }
-   catch (std::string& s)
-   {
-      UBLOG(logERROR, s);
-   }
-   catch (...)
-   {
-      UBLOG(logERROR, "unknown exception");
-   }
-}
+#include <iostream>
+#include <string>
+
+#include "PointerDefinitions.h"
+
+#include <iostream>
+#include <string>
+#include <memory>
+#include <array>
+
+#include "VirtualFluids.h"
+#include <muParser.h>
+#include "ForceCalculator.h"
+
+
+#include <MovableObjectInteractor.h>
+#include <DemCoProcessor.h>
+#include <PePartitioningGridVisitor.h>
+
+#include <PePhysicsEngineMaterialAdapter.h>
+#include <PePhysicsEngineGeometryAdapter.h>
+#include <PePhysicsEngineSolverAdapter.h>
+#include "PeLoadBalancerAdapter.h"
+
+#include <VelocityBcReconstructor.h>
+#include <EquilibriumReconstructor.h>
+#include <ExtrapolationReconstructor.h>
+
+#include <DummyPhysicsEngineSolverAdapter.h>
+#include <DummyPhysicsEngineMaterialAdapter.h>
+#include <DummyPhysicsEngineGeometryAdapter.h>
+#include <WriteDemObjectsCoProcessor.h>
+#include <WritePeBlocksCoProcessor.h>
+
+#include "CreateDemObjectsCoProcessor.h"
+#include "RestartDemObjectsCoProcessor.h"
+
+using namespace std;
+
+//simulation bounding box
+double g_minX1 = 0;
+double g_minX2 = 0;
+double g_minX3 = 0;
+
+double g_maxX1 = 0;
+double g_maxX2 = 0;
+double g_maxX3 = 0;
+
+vector<double> peMinOffset;
+vector<double> peMaxOffset;
+
+string          pathOut;// = "d:/temp/thermoplastCluster";
+string          pathGeo;// = "d:/Projects/ThermoPlast/Geometrie";
+
+void addNozzle(SPtr<Grid3D> grid, SPtr<Communicator> comm, SPtr<BCAdapter> noSlipBCAdapter/*, InteractorsHelper& intHelper*/)
+{
+   int myid = comm->getProcessID();
+   if (myid==0) UBLOG(logINFO, "Add nozzles:start");
+
+   SPtr<UbScheduler> sch(new UbScheduler(1));
+   WriteGbObjectsCoProcessor gbObjectsCoProcessor(grid, sch, pathOut, WbWriterVtkXmlBinary::getInstance(), comm);
+
+   std::vector< SPtr<Interactor3D> > interactors;
+
+   for (int i = 0; i <= 55; i++)
+   {
+      SPtr<GbTriFaceMesh3D> bbGeo = SPtr<GbTriFaceMesh3D>(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile2(pathGeo+"/n_bb_new/bb_new"+UbSystem::toString(i)+".stl", "bb", GbTriFaceMesh3D::KDTREE_SAHPLIT, false));
+      SPtr<Interactor3D> bbInt = SPtr<D3Q27TriFaceMeshInteractor>(new D3Q27TriFaceMeshInteractor(bbGeo, grid, noSlipBCAdapter, Interactor3D::SOLID, Interactor3D::EDGES));
+      //GbSystem3D::writeGeoObject(bbGeo.get(), pathOut+"/ns/bbGeo"+UbSystem::toString(i), WbWriterVtkXmlBinary::getInstance());
+      //intHelper.addInteractor(bbInt);
+      if (myid==0) gbObjectsCoProcessor.addGbObject(bbGeo);
+      interactors.push_back(bbInt);
+   }
+
+   for (int i = 0; i <= 334; i++)
+   {
+      SPtr<GbTriFaceMesh3D> bbGeo = SPtr<GbTriFaceMesh3D>(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile2(pathGeo+"/n_bb/bb"+UbSystem::toString(i)+".stl", "bb", GbTriFaceMesh3D::KDTREE_SAHPLIT, false));
+      SPtr<Interactor3D> bbInt = SPtr<D3Q27TriFaceMeshInteractor>(new D3Q27TriFaceMeshInteractor(bbGeo, grid, noSlipBCAdapter, Interactor3D::SOLID, Interactor3D::EDGES));
+      //GbSystem3D::writeGeoObject(bbGeo.get(), pathOut+"/ns/bbGeo"+UbSystem::toString(i), WbWriterVtkXmlBinary::getInstance());
+      //intHelper.addInteractor(bbInt);
+      if (myid==0) gbObjectsCoProcessor.addGbObject(bbGeo);
+      interactors.push_back(bbInt);
+   }
+
+   for (int i = 0; i <= 51; i++)
+   {
+      SPtr<GbTriFaceMesh3D> bsGeo = SPtr<GbTriFaceMesh3D>(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile2(pathGeo+"/n_bs/bs"+UbSystem::toString(i)+".stl", "bs", GbTriFaceMesh3D::KDTREE_SAHPLIT, false));
+      SPtr<Interactor3D> bsInt = SPtr<D3Q27TriFaceMeshInteractor>(new D3Q27TriFaceMeshInteractor(bsGeo, grid, noSlipBCAdapter, Interactor3D::SOLID, Interactor3D::EDGES));
+      //intHelper.addInteractor(bsInt);
+      if (myid==0) gbObjectsCoProcessor.addGbObject(bsGeo);
+      interactors.push_back(bsInt);
+   }
+
+   std::array<int, 6> n ={ 0,1,3,4,6,7 };
+
+   for (int i = 0; i < n.size(); i++)
+   {
+      SPtr<GbTriFaceMesh3D> biGeo = SPtr<GbTriFaceMesh3D>(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile2(pathGeo+"/n_bi/bi"+UbSystem::toString(n[i])+".stl", "bi", GbTriFaceMesh3D::KDTREE_SAHPLIT, false));
+      SPtr<Interactor3D> biInt = SPtr<D3Q27TriFaceMeshInteractor>(new D3Q27TriFaceMeshInteractor(biGeo, grid, noSlipBCAdapter, Interactor3D::SOLID, Interactor3D::EDGES));
+      //intHelper.addInteractor(biInt);
+      if (myid==0) gbObjectsCoProcessor.addGbObject(biGeo);
+      interactors.push_back(biInt);
+   }
+
+   if (myid==0) gbObjectsCoProcessor.process(0);
+
+
+   for (SPtr<Interactor3D> interactor : interactors)
+   {
+      std::vector< std::shared_ptr<Block3D> > blockVector;
+      UbTupleInt3 blockNX=grid->getBlockNX();
+      SPtr<GbObject3D> geoObject(interactor->getGbObject3D());
+      double ext = 0.0;
+      std::array<double, 6> AABB ={ geoObject->getX1Minimum(),geoObject->getX2Minimum(),geoObject->getX3Minimum(),geoObject->getX1Maximum(),geoObject->getX2Maximum(),geoObject->getX3Maximum() };
+      grid->getBlocksByCuboid(AABB[0]-(double)val<1>(blockNX)*ext, AABB[1]-(double)val<2>(blockNX)*ext, AABB[2]-(double)val<3>(blockNX)*ext, AABB[3]+(double)val<1>(blockNX)*ext, AABB[4]+(double)val<2>(blockNX)*ext, AABB[5]+(double)val<3>(blockNX)*ext, blockVector);
+      for (std::shared_ptr<Block3D> block : blockVector)
+      {
+         if (block->getKernel())
+         {
+            interactor->setBCBlock(block);
+         }
+      }
+      interactor->initInteractor();
+   }
+
+   if (myid==0) UBLOG(logINFO, "Add nozzles:end");
+}
+
+std::shared_ptr<DemCoProcessor> makePeCoProcessor(SPtr<Grid3D> grid, SPtr<Communicator> comm, const SPtr<UbScheduler> peScheduler, const std::shared_ptr<LBMUnitConverter> lbmUnitConverter, int maxpeIterations)
+{
+   double peRelaxtion = 0.7;
+   //int maxpeIterations = 10000;
+   //Beschleunigung g
+   double g = 9.81 * lbmUnitConverter->getFactorAccWToLb();
+   //Vector3D globalLinearAcc(0.0, -g, 0.0);
+   //Vector3D globalLinearAcc(0.0, 0.0, -g);
+   Vector3D globalLinearAcc(0.0, 0.0, 0.0);
+
+   std::shared_ptr<PePhysicsEngineMaterialAdapter> planeMaterial = std::make_shared<PePhysicsEngineMaterialAdapter>("granular", 1.0, 0, 0.1 / 2, 0.1 / 2, 0.5, 1, 1, 0, 0);
+
+   const int gridNX1 = val<1>(grid->getBlockNX()) * grid->getNX1();
+   const int gridNX2 = val<2>(grid->getBlockNX()) * grid->getNX2();
+   const int gridNX3 = val<3>(grid->getBlockNX()) * grid->getNX3();
+
+   //UbTupleInt3 simulationDomain(gridNx, gridNy, gridNz);
+   //std::array<double, 6> simulationDomain = {1, 1, 1, 30, 30, 30};
+   std::array<double, 6> simulationDomain ={ g_minX1, g_minX2, g_minX3, g_minX1+gridNX1, g_minX2+gridNX2, g_minX3+gridNX3 };
+   UbTupleInt3 numberOfBlocks(grid->getNX1(), grid->getNX2(), grid->getNX3());
+   //UbTupleInt3 numberOfBlocks((simulationDomain[3]-simulationDomain[0])/val<1>(grid->getBlockNX()), (simulationDomain[4]-simulationDomain[1])/val<2>(grid->getBlockNX()), (simulationDomain[5]-simulationDomain[2])/val<3>(grid->getBlockNX()));
+   UbTupleBool3 isPeriodic(grid->isPeriodicX1(), grid->isPeriodicX2(), grid->isPeriodicX3());
+   Vector3D minOffset(peMinOffset[0], peMinOffset[1], peMinOffset[2]);
+   Vector3D maxOffset(peMaxOffset[0], peMaxOffset[1], peMaxOffset[2]);
+
+   SPtr<GbObject3D> boxPE(new GbCuboid3D(simulationDomain[0]+minOffset[0], simulationDomain[1]+minOffset[1], simulationDomain[2]+minOffset[2], simulationDomain[3]+maxOffset[0], simulationDomain[4]+maxOffset[1], simulationDomain[5]+maxOffset[2]));
+   GbSystem3D::writeGeoObject(boxPE.get(), pathOut + "/geo/boxPE", WbWriterVtkXmlBinary::getInstance());
+
+   std::shared_ptr<PeParameter> peParamter = std::make_shared<PeParameter>(peRelaxtion, maxpeIterations, globalLinearAcc,
+      planeMaterial, simulationDomain, numberOfBlocks, isPeriodic, minOffset, maxOffset);
+   std::shared_ptr<PeLoadBalancerAdapter> loadBalancer(new PeLoadBalancerAdapter(grid, comm->getNumberOfProcesses(), comm->getProcessID()));
+   std::shared_ptr<PhysicsEngineSolverAdapter> peSolver = std::make_shared<PePhysicsEngineSolverAdapter>(peParamter, loadBalancer);
+   //create obstacle
+   //test
+   std::dynamic_pointer_cast<PePhysicsEngineSolverAdapter>(peSolver)->createObstacle(Vector3D( 90, 260, 472), Vector3D( 115, 320, 460));
+   //production
+   //std::dynamic_pointer_cast<PePhysicsEngineSolverAdapter>(peSolver)->createObstacle(Vector3D( 90, 430, 472), Vector3D( 115, 320, 460));
+   //std::dynamic_pointer_cast<PePhysicsEngineSolverAdapter>(peSolver)->createObstacle(Vector3D( 100, 430, 1840), Vector3D( 130, 320, 470));
+   //std::dynamic_pointer_cast<PePhysicsEngineSolverAdapter>(peSolver)->createObstacle(Vector3D( 100, 821, 1159), Vector3D( 125, 625, 625));
+   //walberla::pe::createSphere(*globalBodyStorage, *forest, *storageId, 0, walberla::pe::Vec3( -720, 820, 1150), 900, global, communicating, infiniteMass);
+   //walberla::pe::createSphere(*globalBodyStorage, *forest, *storageId, 0, walberla::pe::Vec3( -720, 220, 472), 900, material, global, communicating, infiniteMass);
+
+   SPtr<CoProcessor> peblocks(new WritePeBlocksCoProcessor(grid, SPtr<UbScheduler>(new UbScheduler(1)), pathOut, WbWriterVtkXmlBinary::getInstance(), comm, std::dynamic_pointer_cast<PePhysicsEngineSolverAdapter>(peSolver)->getBlockForest()));
+   peblocks->process(0);
+   peblocks.reset();
+
+   const std::shared_ptr<ForceCalculator> forceCalculator = std::make_shared<ForceCalculator>(comm);
+
+   return std::make_shared<DemCoProcessor>(grid, peScheduler, comm, forceCalculator, peSolver);
+}
+
+void createSpheres(double radius, Vector3D origin, int maxX2, int maxX3, double uLB, SPtr<CreateDemObjectsCoProcessor> createSphereCoProcessor)
+{
+   double d = 2.0*radius;
+   double dividerX2 = (double)maxX2/2.0;
+   double dividerX3 = (double)maxX3/2.0;
+   for (int x3 = 0; x3 < maxX3; x3++)
+      for (int x2 = 0; x2 < maxX2; x2++)
+         //for (int x1 = 0; x1 < 1; x1++)
+      {
+         //SPtr<GbObject3D> sphere(new GbSphere3D(origin[0]+2.0*d*(double)x1, origin[1]+(double)x2*1.0*d, origin[2]+(double)x3*1.0*d, radius));
+         SPtr<GbObject3D> sphere(new GbSphere3D(origin[0]+2.0*d, origin[1]+(double)x2*1.0*d, origin[2]+(double)x3*1.0*d, radius));
+         createSphereCoProcessor->addGeoObject(sphere, Vector3D(uLB, -uLB+uLB/dividerX2*(double)x2, -uLB+uLB/dividerX3*(double)x3));
+      }
+}
+
+void thermoplast(string configname)
+{
+   SPtr<Communicator> comm = MPICommunicator::getInstance();
+   int myid = comm->getProcessID();
+
+   ConfigurationFile   config;
+   config.load(configname);
+
+   vector<int>     blocknx = config.getVector<int>("blocknx");
+   vector<double>  boundingBox = config.getVector<double>("boundingBox");
+
+   int             endTime = config.getValue<int>("endTime");
+   double          outTime = config.getValue<double>("outTime");
+   double          availMem = config.getValue<double>("availMem");
+   double          uLB = config.getValue<double>("uLB");
+   double          Re = config.getValue<double>("Re");
+
+   string          michel = config.getValue<string>("michel");
+   string          plexiglas = config.getValue<string>("plexiglas");
+   double          sphereTime = config.getValue<double>("sphereTime");
+
+   double          cpStart = config.getValue<double>("cpStart");
+   double          cpStep = config.getValue<double>("cpStep");
+   bool            restart = config.getValue<bool>("restart");
+   int             restartStep = config.getValue<int>("restartStep");
+
+   peMinOffset = config.getVector<double>("peMinOffset");
+   peMaxOffset = config.getVector<double>("peMaxOffset");
+
+   pathOut = config.getValue<string>("pathOut");
+   pathGeo = config.getValue<string>("pathGeo");
+
+   vector<int>     nupsTime = config.getVector<int>("nupsTime");
+
+   bool            logToFile = config.getValue<bool>("logToFile");
+   if (logToFile)
+   {
+#if defined(__unix__)
+      if (myid==0)
+      {
+         const char* str = pathOut.c_str();
+         mkdir(str, S_IRWXU|S_IRWXG|S_IROTH|S_IXOTH);
+      }
+#endif 
+
+      if (myid==0)
+      {
+         stringstream logFilename;
+         logFilename<<pathOut+"/logfile"+UbSystem::getTimeStamp()+".txt";
+         UbLog::output_policy::setStream(logFilename.str());
+      }
+   }
+
+   bool obstacle = config.getValue<bool>("obstacle");
+   string obstacleGeo1 = config.getValue<string>("obstacleGeo1");
+   string obstacleGeo2 = config.getValue<string>("obstacleGeo2");
+   string obstacleGeo3 = config.getValue<string>("obstacleGeo3");
+
+   if (myid==0) UBLOG(logINFO, "BEGIN LOGGING - " << UbSystem::getTimeStamp());
+
+   //parameters
+   //string          pathOut = "d:/temp/thermoplast3";
+   //string          pathGeo = "d:/Projects/ThermoPlast/Geometrie";
+   int             numOfThreads = 1;
+   //int             blocknx[3] ={ 10,10,10 };
+   //double          endTime = 1000000;
+   //double          outTime = 300;
+   //double          availMem = 8e9;
+   double          deltax = 1;
+   double          rhoLB = 0.0;
+   //double          uLB =  0.1;
+   double          radiusLB = 7.5;
+   double          radiusWorld = 1.5e-3;
+   //double          nuLB = 0.000333333;
+   //double          Re = (uLB*2.0*radiusLB)/nuLB;
+   //double          Re = 900;
+   double          nuLB = (uLB*2.0*radiusLB)/Re;
+
+   //geometry definition
+
+   //simulation bounding box
+   g_minX1 = boundingBox[0];
+   g_minX2 = boundingBox[1];
+   g_minX3 = boundingBox[2];
+
+   g_maxX1 = boundingBox[3];
+   g_maxX2 = boundingBox[4];
+   g_maxX3 = boundingBox[5];
+
+   double blockLength = blocknx[0]*deltax;
+
+   //Grid definition
+   SPtr<Grid3D> grid(new Grid3D(comm));
+   grid->setDeltaX(deltax);
+   grid->setBlockNX(blocknx[0], blocknx[1], blocknx[2]);
+   grid->setPeriodicX1(false);
+   grid->setPeriodicX2(false);
+   grid->setPeriodicX3(false);
+
+   //boundary conditions definition 
+   //////////////////////////////////////////////////////////////////////////////
+   SPtr<BCAdapter> noSlipBCAdapter(new NoSlipBCAdapter());
+   //noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NoSlipBCAlgorithm()));
+   noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new ThinWallNoSlipBCAlgorithm()));
+
+   mu::Parser fct;
+   fct.SetExpr("U");
+   fct.DefineConst("U", uLB);
+   SPtr<BCAdapter> inflowAdapter(new VelocityBCAdapter(true, false, false, fct, 0, BCFunction::INFCONST));
+   inflowAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new VelocityBCAlgorithm()));
+   //inflowAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new VelocityWithDensityBCAlgorithm()));
+
+   SPtr<BCAdapter> outflowAdapter(new DensityBCAdapter(rhoLB));
+   outflowAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new EqDensityBCAlgorithm()));
+   //outflowAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NonEqDensityBCAlgorithm()));
+   //outflowAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NonReflectingOutflowBCAlgorithm()));
+
+   //sphere BC
+   mu::Parser fct2;
+   fct2.SetExpr("U");
+   fct2.DefineConst("U", 0.0);
+   SPtr<BCAdapter> velocityBcParticleAdapter(new VelocityBCAdapter(true, false, false, fct2, 0, BCFunction::INFCONST));
+   velocityBcParticleAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new VelocityWithDensityBCAlgorithm()));
+
+   //boundary conditions visitor
+   SPtr<BoundaryConditionsBlockVisitor> bcVisitor(new BoundaryConditionsBlockVisitor());
+   bcVisitor->addBC(noSlipBCAdapter);
+   bcVisitor->addBC(inflowAdapter);
+   bcVisitor->addBC(outflowAdapter);
+   bcVisitor->addBC(velocityBcParticleAdapter);
+   //////////////////////////////////////////////////////////////////////////////////
+
+   //LBM kernel definition
+   SPtr<LBMKernel> kernel;
+   kernel = SPtr<LBMKernel>(new IncompressibleCumulantLBMKernel());
+   //SPtr<BCProcessor> bcProc(new BCProcessor());
+   SPtr<BCProcessor> bcProc(new ThinWallBCProcessor());
+   kernel->setBCProcessor(bcProc);
+
+   //if (myid==0) UBLOG(logINFO, "Read obstacleGeo1:start");
+   //SPtr<GbTriFaceMesh3D> obstacleGeo1geo = SPtr<GbTriFaceMesh3D>(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile2(pathGeo+obstacleGeo1, "michelGeo", GbTriFaceMesh3D::KDTREE_SAHPLIT, false));
+   //if (myid==0) UBLOG(logINFO, "Read obstacleGeo1:end");
+   //if (myid==0) GbSystem3D::writeGeoObject(obstacleGeo1geo.get(), pathOut+"/geo/obstacleGeo1", WbWriterVtkXmlBinary::getInstance());
+   //g_minX1 = obstacleGeo1geo->getX1Minimum();
+   //g_minX2 = obstacleGeo1geo->getX2Minimum();
+   //g_minX3 = obstacleGeo1geo->getX3Minimum();
+   //g_maxX1 = obstacleGeo1geo->getX1Maximum();
+   //g_maxX2 = obstacleGeo1geo->getX2Maximum();
+   //g_maxX3 = obstacleGeo1geo->getX3Maximum();
+
+
+
+   //blocks generating
+   SPtr<GbObject3D> gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
+   if (myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), pathOut + "/geo/gridCube", WbWriterVtkXmlBinary::getInstance());
+   GenBlocksGridVisitor genBlocks(gridCube);
+   grid->accept(genBlocks);
+
+
+   //{
+     //SPtr<Interactor3D> obstacleGeo1int = SPtr<D3Q27TriFaceMeshInteractor>(new D3Q27TriFaceMeshInteractor(obstacleGeo1geo, grid, noSlipBCAdapter, Interactor3D::SOLID));
+     //SPtr<Grid3DVisitor> peVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::BSW, MetisPartitioner::KWAY));
+      //InteractorsHelper intHelper(grid, peVisitor, true);
+     //intHelper.addInteractor(obstacleGeo1int);
+     //intHelper.selectBlocks();
+
+     ////create LBM kernel
+      ////SetKernelBlockVisitor kernelVisitor(kernel, nuLB, availMem, 1);
+      ////grid->accept(kernelVisitor);
+
+      ////SPtr<Interactor3D> obstacleGeo1int = SPtr<D3Q27Interactor>(new D3Q27Interactor(obstacleGeo1geo, grid, noSlipBCAdapter, Interactor3D::SOLID));
+      ////UBLOG(logINFO, "Obst: start");
+      ////std::vector< std::shared_ptr<Block3D> > blockVector;
+      ////UbTupleInt3 blockNX=grid->getBlockNX();
+      ////SPtr<GbObject3D> geoObject(obstacleGeo1int->getGbObject3D());
+      ////double ext = 0.0;
+      ////std::array<double, 6> AABB ={ geoObject->getX1Minimum(),geoObject->getX2Minimum(),geoObject->getX3Minimum(),geoObject->getX1Maximum(),geoObject->getX2Maximum(),geoObject->getX3Maximum() };
+      ////grid->getBlocksByCuboid(AABB[0]-(double)val<1>(blockNX)*ext, AABB[1]-(double)val<2>(blockNX)*ext, AABB[2]-(double)val<3>(blockNX)*ext, AABB[3]+(double)val<1>(blockNX)*ext, AABB[4]+(double)val<2>(blockNX)*ext, AABB[5]+(double)val<3>(blockNX)*ext, blockVector);
+      ////for (std::shared_ptr<Block3D> block : blockVector)
+      ////{
+         ////if (block->getKernel())
+         ////{
+            ////obstacleGeo1int->setBCBlock(block);
+         ////}
+      ////}
+      ////UBLOG(logINFO, "Obst: select blocks");
+      ////obstacleGeo1int->initInteractor();
+      ////UBLOG(logINFO, "Obst: end");
+
+      //SPtr<CoProcessor> ppblocks(new WriteBlocksCoProcessor(grid, SPtr<UbScheduler>(new UbScheduler(1)), pathOut, WbWriterVtkXmlBinary::getInstance(), comm));
+      //ppblocks->process(0);
+      //ppblocks.reset();
+   //}
+
+   //return;
+
+
+   /////////////////////////////////////////////////////
+   ////PE domain test
+   //std::array<double, 6> simulationDomain ={ g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3 };
+   //Vector3D minOffset(peMinOffset[0], peMinOffset[1], peMinOffset[2]);
+   //Vector3D maxOffset(peMaxOffset[0], peMaxOffset[1], peMaxOffset[2]);
+   //SPtr<GbObject3D> boxPE(new GbCuboid3D(simulationDomain[0]+minOffset[0], simulationDomain[1]+minOffset[1], simulationDomain[2]+minOffset[2], simulationDomain[3]+maxOffset[0], simulationDomain[4]+maxOffset[1], simulationDomain[5]+maxOffset[2]));
+   //GbSystem3D::writeGeoObject(boxPE.get(), pathOut + "/geo/boxPE", WbWriterVtkXmlBinary::getInstance());
+   //return;
+   //////////////////////////////////////////////////////
+
+
+   if (myid == 0)
+   {
+      UBLOG(logINFO, "Parameters:");
+      UBLOG(logINFO, "* uLB    = " << uLB);
+      UBLOG(logINFO, "* rhoLB  = " << rhoLB);
+      UBLOG(logINFO, "* nuLB   = " << nuLB);
+      UBLOG(logINFO, "* deltaX = " << deltax);
+      UBLOG(logINFO, "* radius = " << radiusLB);
+      UBLOG(logINFO, "* Re     = " << Re);
+      UBLOG(logINFO, "* number of threads   = "<<numOfThreads);
+      UBLOG(logINFO, "* number of processes = "<<comm->getNumberOfProcesses());
+      UBLOG(logINFO, "* path = "<<pathOut);
+      UBLOG(logINFO, "Preprocess - start");
+   }
+
+   //GbCuboid3DPtr geoInjector2(new GbCuboid3D(-12, -5, 1210, 64, 105, 1320));
+   //if (myid == 0) GbSystem3D::writeGeoObject(geoInjector2.get(), pathOut + "/geo/geoInjector2", WbWriterVtkXmlASCII::getInstance());
+
+   //GbCuboid3DPtr geoInjector5(new GbCuboid3D(-12, 1415, 205, 64, 1525, 315));
+   //if (myid == 0) GbSystem3D::writeGeoObject(geoInjector5.get(), pathOut + "/geo/geoInjector5", WbWriterVtkXmlASCII::getInstance());
+
+   GbCuboid3DPtr geoInjector4(new GbCuboid3D(-12, -5, 205, 64, 105, 315));
+   if (myid == 0) GbSystem3D::writeGeoObject(geoInjector4.get(), pathOut + "/geo/geoInjector4", WbWriterVtkXmlASCII::getInstance());
+
+   //GbCuboid3DPtr geoInjector7(new GbCuboid3D(28, 705, 542, 103, 815, 652));
+   //if (myid == 0) GbSystem3D::writeGeoObject(geoInjector7.get(), pathOut + "/geo/geoInjector7", WbWriterVtkXmlASCII::getInstance());
+
+   GbCuboid3DPtr testWallGeo(new GbCuboid3D(g_minX1-blockLength, g_minX2 - blockLength, g_maxX3, g_maxX1 + blockLength, g_maxX2 + blockLength, g_maxX3 + blockLength));
+   if (myid == 0) GbSystem3D::writeGeoObject(testWallGeo.get(), pathOut + "/geo/testWallGeo", WbWriterVtkXmlASCII::getInstance());
+
+   if (!restart)
+   {
+      //box
+      SPtr<GbObject3D> box(new GbCuboid3D(g_minX1-blockLength, g_minX2, g_minX3, g_maxX1+blockLength, g_maxX2, g_maxX3));
+      GbSystem3D::writeGeoObject(box.get(), pathOut + "/geo/box", WbWriterVtkXmlBinary::getInstance());
+
+      //michel
+      if (myid==0) UBLOG(logINFO, "Read michelGeo:start");
+      SPtr<GbTriFaceMesh3D> michelGeo = SPtr<GbTriFaceMesh3D>(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile2(pathGeo+michel, "michelGeo", GbTriFaceMesh3D::KDTREE_SAHPLIT, false));
+      if (myid==0) UBLOG(logINFO, "Read michelGeo:end");
+      if (myid==0) GbSystem3D::writeGeoObject(michelGeo.get(), pathOut+"/geo/michelGeo", WbWriterVtkXmlBinary::getInstance());
+
+      //plexiglas
+      if (myid==0) UBLOG(logINFO, "Read plexiglasGeo:start");
+      SPtr<GbTriFaceMesh3D> plexiglasGeo = SPtr<GbTriFaceMesh3D>(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile2(pathGeo+plexiglas, "plexiglasGeo", GbTriFaceMesh3D::KDTREE_SAHPLIT, false));
+      if (myid==0) UBLOG(logINFO, "Read plexiglasGeo:end");
+      if (myid==0) GbSystem3D::writeGeoObject(plexiglasGeo.get(), pathOut+"/geo/plexiglasGeo", WbWriterVtkXmlBinary::getInstance());
+
+      //inflow
+      GbCuboid3DPtr geoOutflowMichel(new GbCuboid3D(g_minX1-blockLength, g_minX2 - blockLength, g_minX3 - blockLength, g_minX1, g_maxX2 + blockLength, g_maxX3 + blockLength));
+      if (myid == 0) GbSystem3D::writeGeoObject(geoOutflowMichel.get(), pathOut + "/geo/geoOutflowMichel", WbWriterVtkXmlASCII::getInstance());
+
+      //outflow
+      GbCuboid3DPtr geoOutflowPlexiglas(new GbCuboid3D(g_maxX1, g_minX2 - blockLength, g_minX3 - blockLength, g_maxX1 + blockLength, g_maxX2 + blockLength, g_maxX3 + blockLength));
+      if (myid == 0) GbSystem3D::writeGeoObject(geoOutflowPlexiglas.get(), pathOut + "/geo/geoOutflowPlexiglas", WbWriterVtkXmlASCII::getInstance());
+
+      //set boundary conditions for blocks and create process decomposition for MPI
+      SPtr<D3Q27Interactor> boxInt(new D3Q27Interactor(box, grid, noSlipBCAdapter, Interactor3D::INVERSESOLID));
+
+      //inflow
+      //SPtr<D3Q27Interactor> inflowInjector2Int = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoInjector2, grid, inflowAdapter, Interactor3D::SOLID));
+      //SPtr<D3Q27Interactor> inflowInjector5Int = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoInjector5, grid, inflowAdapter, Interactor3D::SOLID));
+      SPtr<D3Q27Interactor> inflowInjector4Int = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoInjector4, grid, inflowAdapter, Interactor3D::SOLID));
+      //SPtr<D3Q27Interactor> inflowInjector7Int = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoInjector7, grid, inflowAdapter, Interactor3D::SOLID));
+
+      SPtr<D3Q27Interactor> outflowMichelInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoOutflowMichel, grid, outflowAdapter, Interactor3D::SOLID));
+
+      //outflow
+      SPtr<D3Q27Interactor> outflowPlexiglasInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoOutflowPlexiglas, grid, outflowAdapter, Interactor3D::SOLID));
+
+      //michel
+      SPtr<Interactor3D> michelInt = SPtr<D3Q27TriFaceMeshInteractor>(new D3Q27TriFaceMeshInteractor(michelGeo, grid, noSlipBCAdapter, Interactor3D::SOLID));
+
+      //plexiglas
+      SPtr<Interactor3D> plexiglasInt = SPtr<D3Q27TriFaceMeshInteractor>(new D3Q27TriFaceMeshInteractor(plexiglasGeo, grid, noSlipBCAdapter, Interactor3D::SOLID));
+
+      SPtr<D3Q27Interactor> testWallInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(testWallGeo, grid, inflowAdapter, Interactor3D::SOLID));
+
+      SPtr<Interactor3D> obstacleGeo1int, obstacleGeo2int, obstacleGeo3int;
+      if (obstacle)
+      {
+         //obstacleGeo1
+         if (myid==0) UBLOG(logINFO, "Read obstacleGeo1:start");
+         SPtr<GbTriFaceMesh3D> obstacleGeo1geo = SPtr<GbTriFaceMesh3D>(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile2(pathGeo+obstacleGeo1, "michelGeo", GbTriFaceMesh3D::KDTREE_SAHPLIT, false));
+         if (myid==0) UBLOG(logINFO, "Read obstacleGeo1:end");
+         if (myid==0) GbSystem3D::writeGeoObject(obstacleGeo1geo.get(), pathOut+"/geo/obstacleGeo1", WbWriterVtkXmlBinary::getInstance());
+         obstacleGeo1int = SPtr<D3Q27TriFaceMeshInteractor>(new D3Q27TriFaceMeshInteractor(obstacleGeo1geo, grid, noSlipBCAdapter, Interactor3D::SOLID));
+         //obstacleGeo2
+         if (myid==0) UBLOG(logINFO, "Read obstacleGeo2:start");
+         SPtr<GbTriFaceMesh3D> obstacleGeo2geo = SPtr<GbTriFaceMesh3D>(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile2(pathGeo+obstacleGeo2, "michelGeo", GbTriFaceMesh3D::KDTREE_SAHPLIT, false));
+         if (myid==0) UBLOG(logINFO, "Read obstacleGeo2:end");
+         if (myid==0) GbSystem3D::writeGeoObject(obstacleGeo2geo.get(), pathOut+"/geo/obstacleGeo2", WbWriterVtkXmlBinary::getInstance());
+         obstacleGeo2int = SPtr<D3Q27TriFaceMeshInteractor>(new D3Q27TriFaceMeshInteractor(obstacleGeo2geo, grid, noSlipBCAdapter, Interactor3D::SOLID));
+         //obstacleGeo3
+         if (myid==0) UBLOG(logINFO, "Read obstacleGeo3:start");
+         SPtr<GbTriFaceMesh3D> obstacleGeo3geo = SPtr<GbTriFaceMesh3D>(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile2(pathGeo+obstacleGeo3, "michelGeo", GbTriFaceMesh3D::KDTREE_SAHPLIT, false));
+         if (myid==0) UBLOG(logINFO, "Read obstacleGeo3:end");
+         if (myid==0) GbSystem3D::writeGeoObject(obstacleGeo3geo.get(), pathOut+"/geo/obstacleGeo3", WbWriterVtkXmlBinary::getInstance());
+         obstacleGeo3int = SPtr<D3Q27TriFaceMeshInteractor>(new D3Q27TriFaceMeshInteractor(obstacleGeo3geo, grid, noSlipBCAdapter, Interactor3D::SOLID));
+      }
+
+      //////////////////////////////////////////////////////////////////////////
+      //SPtr<Grid3DVisitor> peVisitor(new PePartitioningGridVisitor(comm, demCoProcessor));
+      SPtr<Grid3DVisitor> peVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::BSW, MetisPartitioner::KWAY));
+      InteractorsHelper intHelper(grid, peVisitor, true);
+
+      //intHelper.addInteractor(obstacleGeo1int);
+
+      intHelper.addInteractor(boxInt);
+      intHelper.addInteractor(michelInt);
+      intHelper.addInteractor(plexiglasInt);
+      //intHelper.addInteractor(inflowInjector2Int);
+      //intHelper.addInteractor(inflowInjector5Int);
+      intHelper.addInteractor(inflowInjector4Int);
+      //intHelper.addInteractor(inflowInjector7Int);
+      intHelper.addInteractor(outflowPlexiglasInt);
+      intHelper.addInteractor(outflowMichelInt);
+      intHelper.addInteractor(obstacleGeo1int);
+      intHelper.addInteractor(obstacleGeo2int);
+      intHelper.addInteractor(obstacleGeo3int);
+      //intHelper.addInteractor(testWallInt);
+      intHelper.selectBlocks();
+
+      //write data for visualization of block grid
+      SPtr<CoProcessor> ppblocks(new WriteBlocksCoProcessor(grid, SPtr<UbScheduler>(new UbScheduler(1)), pathOut, WbWriterVtkXmlBinary::getInstance(), comm));
+      ppblocks->process(0);
+      ppblocks.reset();
+
+      unsigned long long numberOfBlocks = (unsigned long long)grid->getNumberOfBlocks();
+      int ghostLayer = 3;
+      unsigned long long numberOfNodesPerBlock = (unsigned long long)(blocknx[0])* (unsigned long long)(blocknx[1])* (unsigned long long)(blocknx[2]);
+      unsigned long long numberOfNodes = numberOfBlocks * numberOfNodesPerBlock;
+      unsigned long long numberOfNodesPerBlockWithGhostLayer = numberOfBlocks * (blocknx[0] + ghostLayer) * (blocknx[1] + ghostLayer) * (blocknx[2] + ghostLayer);
+      double needMemAll = double(numberOfNodesPerBlockWithGhostLayer*(27 * sizeof(double) + sizeof(int) + sizeof(float) * 4));
+      double needMem = needMemAll / double(comm->getNumberOfProcesses());
+
+      if (myid == 0)
+      {
+         UBLOG(logINFO, "Number of blocks = " << numberOfBlocks);
+         UBLOG(logINFO, "Number of nodes  = " << numberOfNodes);
+         int minInitLevel = grid->getCoarsestInitializedLevel();
+         int maxInitLevel = grid->getFinestInitializedLevel();
+         for (int level = minInitLevel; level <= maxInitLevel; level++)
+         {
+            int nobl = grid->getNumberOfBlocks(level);
+            UBLOG(logINFO, "Number of blocks for level " << level << " = " << nobl);
+            UBLOG(logINFO, "Number of nodes for level " << level << " = " << nobl*numberOfNodesPerBlock);
+         }
+         UBLOG(logINFO, "Necessary memory  = " << needMemAll << " bytes");
+         UBLOG(logINFO, "Necessary memory per process = " << needMem << " bytes");
+         UBLOG(logINFO, "Available memory per process = " << availMem << " bytes");
+      }
+
+      //create LBM kernel
+      SetKernelBlockVisitor kernelVisitor(kernel, nuLB, availMem, needMem);
+      grid->accept(kernelVisitor);
+
+      addNozzle(grid, comm, noSlipBCAdapter/*,intHelper*/);
+
+      intHelper.setBC();
+
+
+      ////////////////////////////////////////////////////////////////////////////////////////////////////
+      //{
+         ////UBLOG(logINFO, "Obst: start, rank="<<myid);
+            //std::vector< std::shared_ptr<Block3D> > blockVector;
+            //UbTupleInt3 blockNX=grid->getBlockNX();
+            //SPtr<GbObject3D> geoObject(obstacleGeo3int->getGbObject3D());
+            //double ext = 0.0;
+            //std::array<double, 6> AABB ={ geoObject->getX1Minimum(),geoObject->getX2Minimum(),geoObject->getX3Minimum(),geoObject->getX1Maximum(),geoObject->getX2Maximum(),geoObject->getX3Maximum() };
+            //grid->getBlocksByCuboid(AABB[0]-(double)val<1>(blockNX)*ext, AABB[1]-(double)val<2>(blockNX)*ext, AABB[2]-(double)val<3>(blockNX)*ext, AABB[3]+(double)val<1>(blockNX)*ext, AABB[4]+(double)val<2>(blockNX)*ext, AABB[5]+(double)val<3>(blockNX)*ext, blockVector);
+            //for (std::shared_ptr<Block3D> block : blockVector)
+            //{
+               //if (block->getKernel())
+               //{
+                  //obstacleGeo3int->setBCBlock(block);
+               //}
+            //}
+            //UBLOG(logINFO, "Obst: select blocks, number of blocks="<<blockVector.size()<<", rank="<<myid);
+            //obstacleGeo3int->initInteractor();
+            //UBLOG(logINFO, "Obst: end, rank="<<myid);
+      //}
+      //////////////////////////////////////////////////////////////////////////////////////////////////////
+            //initialization of distributions
+      InitDistributionsBlockVisitor initVisitor;
+      //initVisitor.setVx1(uLB);
+      grid->accept(initVisitor);
+
+      //write data for visualization of boundary conditions
+      {
+         //SPtr<UbScheduler> geoSch(new UbScheduler(1));
+         //WriteBoundaryConditionsCoProcessor ppgeo(grid, geoSch, pathOut, WbWriterVtkXmlBinary::getInstance(), comm);
+         //ppgeo.process(0);
+
+         //WriteMacroscopicQuantitiesCoProcessor ppInit(grid, geoSch, pathOut, WbWriterVtkXmlBinary::getInstance(), SPtr<LBMUnitConverter>(new LBMUnitConverter()), comm);
+         //ppInit.process(0);
+      }
+
+      if (myid == 0) UBLOG(logINFO, "Preprocess - end");
+   }
+   //restart
+   //UBLOG(logINFO, "restart definition - start, rank="<<myid);
+   SPtr<UbScheduler> restartSch(new UbScheduler(cpStep, cpStart));
+   //SPtr<MPIIORestartCoProcessor> restartCoProcessor(new MPIIORestartCoProcessor(grid, restartSch, pathOut, comm));
+   SPtr<MPIIOMigrationCoProcessor> restartCoProcessor(new MPIIOMigrationCoProcessor(grid, restartSch, pathOut, comm));
+   restartCoProcessor->setLBMKernel(kernel);
+   restartCoProcessor->setBCProcessor(bcProc);
+
+   if (restart)
+   {
+      //restartStep = restartCoProcessor->readCpTimeStep();
+      restartCoProcessor->restart(restartStep);
+   }
+
+   //PE initialization
+   double refLengthLb = radiusLB*2.0;
+   double refLengthWorld = radiusWorld*2.0;
+   const std::shared_ptr<LBMUnitConverter> lbmUnitConverter = std::make_shared<LBMUnitConverter>(refLengthWorld, LBMUnitConverter::WORLD_MATERIAL::AIR_20C, refLengthLb);
+   if (myid == 0) std::cout << lbmUnitConverter->toString() << std::endl;
+   double rhoSphere = 915 * lbmUnitConverter->getFactorDensityWToLb();  // kg/m^3
+   if (myid == 0) UBLOG(logINFO, "rhoSphere = "<<rhoSphere);
+   SPtr<PhysicsEngineMaterialAdapter> sphereMaterial(new PePhysicsEngineMaterialAdapter("Polypropylen", rhoSphere, 0, 0.15, 0.1, 0.45, 0.5, 1, 0, 0));
+   const int timestep = 2;
+   const SPtr<UbScheduler> peScheduler(new UbScheduler(timestep));
+   int maxpeIterations = 10;//endTime/2;
+   SPtr<DemCoProcessor> demCoProcessor = makePeCoProcessor(grid, comm, peScheduler, lbmUnitConverter, maxpeIterations);
+   demCoProcessor->setBlockVisitor(bcVisitor);
+
+   ////////////////////////////////////////////////////////////////////////////
+   ////generating spheres 
+   //UBLOG(logINFO, "generating spheres - start, rank="<<myid);
+   SPtr<UbScheduler> sphereScheduler(new UbScheduler(sphereTime/*10,10,10*/));
+   double toleranz = 0.0;//0.05;
+   SPtr<CreateDemObjectsCoProcessor> createSphereCoProcessor(new CreateDemObjectsCoProcessor(grid, sphereScheduler, comm, demCoProcessor, sphereMaterial, toleranz));
+   //UBLOG(logINFO, "generating spheres - stop, rank="<<myid);
+
+   ////restart
+   ////UBLOG(logINFO, "restart definition - start, rank="<<myid);
+   //SPtr<UbScheduler> restartSch(new UbScheduler(cpStep, cpStart));
+   ////SPtr<MPIIORestartCoProcessor> restartCoProcessor(new MPIIORestartCoProcessor(grid, restartSch, pathOut, comm));
+   //SPtr<MPIIOMigrationCoProcessor> restartCoProcessor(new MPIIOMigrationCoProcessor(grid, restartSch, pathOut, comm));
+   //restartCoProcessor->setLBMKernel(kernel);
+   //restartCoProcessor->setBCProcessor(bcProc);
+   SPtr<RestartDemObjectsCoProcessor> restartDemObjectsCoProcessor(new RestartDemObjectsCoProcessor(grid, restartSch, pathOut, demCoProcessor, createSphereCoProcessor, radiusLB, comm));
+   //UBLOG(logINFO, "restart definition - stop, rank="<<myid);
+
+   if (restart)
+   {
+      createSphereCoProcessor->setToleranz(0.05);
+      restartDemObjectsCoProcessor->restart(restartStep);
+      createSphereCoProcessor->setToleranz(toleranz);
+   }
+
+   //set connectors
+   //UBLOG(logINFO, "set connectors - start, rank="<<myid);
+   InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor());
+   SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
+   grid->accept(setConnsVisitor);
+   //UBLOG(logINFO, "set connectors - stop, rank="<<myid);
+
+   //BC visitor
+   //UBLOG(logINFO, "BC visitor - start, rank="<<myid);
+   grid->accept(*bcVisitor.get());
+   //UBLOG(logINFO, "BC visitor - stop, rank="<<myid);
+
+   //sphere prototypes
+   //UBLOG(logINFO, "sphere prototypes - start, rank="<<myid);
+   double d = 2.0*radiusLB;
+   int maxX2 = 5;
+   int maxX3 = 5;
+   //Vector3D origin1(g_minX1+peMinOffset[0]-1.5*d, geoInjector5->getX2Minimum()+1.4*d-6.0, geoInjector5->getX3Minimum()+1.5*d);
+   //createSpheres(radiusLB, origin1, maxX2, maxX3, uLB, createSphereCoProcessor);
+   //Vector3D origin2(g_minX1+peMinOffset[0]-1.5*d, geoInjector2->getX2Minimum()+2.2*d, geoInjector2->getX3Minimum()+1.5*d);
+   //createSpheres(radiusLB, origin2, maxX2, maxX3, uLB, createSphereCoProcessor);
+
+   Vector3D origin2(g_minX1+peMinOffset[0]-1.5*d, geoInjector4->getX2Minimum()+2.4*d, geoInjector4->getX3Minimum()+1.5*d);
+   createSpheres(radiusLB,origin2,maxX2,maxX3,uLB,createSphereCoProcessor);
+
+   //maxX2 = 7;
+   //maxX3 = 7;
+   //Vector3D origin3(g_minX1+peMinOffset[0]-1.5*d, geoInjector7->getX2Minimum()+0.5*d, geoInjector7->getX3Minimum()+0.5*d);
+   //createSpheres(radiusLB,origin3,maxX2,maxX3,uLB,createSphereCoProcessor);
+
+
+   createSphereCoProcessor->process(0);
+
+   //write data for visualization of macroscopic quantities
+   SPtr<UbScheduler> visSch(new UbScheduler(outTime));
+   SPtr<WriteMacroscopicQuantitiesCoProcessor> writeMQCoProcessor(new WriteMacroscopicQuantitiesCoProcessor(grid, visSch, pathOut,
+      WbWriterVtkXmlBinary::getInstance(), SPtr<LBMUnitConverter>(new LBMUnitConverter()), comm));
+
+   SPtr<WriteBoundaryConditionsCoProcessor> writeBCCoProcessor(new WriteBoundaryConditionsCoProcessor(grid, visSch, pathOut,
+      WbWriterVtkXmlBinary::getInstance(), comm));
+
+   SPtr<WriteDemObjectsCoProcessor> writeDemObjectsCoProcessor(new WriteDemObjectsCoProcessor(grid, visSch, pathOut, WbWriterVtkXmlBinary::getInstance(), demCoProcessor, comm));
+
+   if (!restart)
+   {
+      writeMQCoProcessor->process(0);
+      writeBCCoProcessor->process(0);
+      writeDemObjectsCoProcessor->process(0);
+   }
+   ////performance control
+   SPtr<UbScheduler> nupsSch(new UbScheduler(nupsTime[0], nupsTime[1], nupsTime[2]));
+   SPtr<NUPSCounterCoProcessor> npr(new NUPSCounterCoProcessor(grid, nupsSch, numOfThreads, comm));
+
+   //start simulation 
+   //omp_set_num_threads(numOfThreads);
+   SPtr<UbScheduler> stepGhostLayer(peScheduler);
+   SPtr<Calculator> calculator(new BasicCalculator(grid, stepGhostLayer, endTime));
+
+   calculator->addCoProcessor(npr);
+   calculator->addCoProcessor(createSphereCoProcessor);
+   calculator->addCoProcessor(demCoProcessor);
+   ////calculator->addCoProcessor(writeBCCoProcessor);
+   calculator->addCoProcessor(writeDemObjectsCoProcessor);
+   calculator->addCoProcessor(writeMQCoProcessor);
+   calculator->addCoProcessor(restartDemObjectsCoProcessor);
+   calculator->addCoProcessor(restartCoProcessor);
+
+   if (myid == 0) UBLOG(logINFO, "Simulation-start");
+   calculator->calculate();
+   if (myid == 0) UBLOG(logINFO, "Simulation-end");
+   if (myid==0) UBLOG(logINFO, "END LOGGING - " << UbSystem::getTimeStamp());
+}
+
+//////////////////////////////////////////////////////////////////////////
+int main(int argc, char* argv[])
+{
+   try
+   {
+      //Sleep(30000);
+      walberla::Environment env(argc, argv);
+
+      if (argv!=NULL)
+      {
+         //if (argv[1]!=NULL)
+         //{
+            //thermoplast(string("thermoplast.cfg"));
+         thermoplast(string("d:/Projects/VirtualFluidsGit/source/Applications/Thermoplast/config.txt"));
+         //}
+         //else
+         //{
+            //cout<<"Configuration file must be set!: "<<argv[0]<<" <config file>"<<endl<<std::flush;
+         //}
+      }
+      return 0;
+   }
+   catch (std::exception& e)
+   {
+      UBLOG(logERROR, e.what());
+   }
+   catch (std::string& s)
+   {
+      UBLOG(logERROR, s);
+   }
+   catch (...)
+   {
+      UBLOG(logERROR, "unknown exception");
+   }
+}
diff --git a/apps/cpu/Wing/Bombadil.cfg b/apps/cpu/Wing/Bombadil.cfg
index 4ee9dd64929b43391ede80ab568d53339b24be63..17b15243d313b7ed6d5b8ae1516be90ad1c70ead 100644
--- a/apps/cpu/Wing/Bombadil.cfg
+++ b/apps/cpu/Wing/Bombadil.cfg
@@ -1,8 +1,8 @@
-machine=Bombadil
-path="d:/temp/wing/"
-geoFile="d:/Data/SFB/grundgeometrie.stl"
-numOfThreads=1
-availMem=15e9
-refineLevel=5
-blocknx=8
+machine=Bombadil
+path="d:/temp/wing/"
+geoFile="d:/Data/SFB/grundgeometrie.stl"
+numOfThreads=1
+availMem=15e9
+refineLevel=5
+blocknx=8
 endTime=10
\ No newline at end of file
diff --git a/apps/cpu/Wing/wing.cpp b/apps/cpu/Wing/wing.cpp
index 78f4763e39d2bdd3fbea3d4e85fad4b30e01f03e..34f75cebaa8f23c913e2bf19130299e307a707f2 100644
--- a/apps/cpu/Wing/wing.cpp
+++ b/apps/cpu/Wing/wing.cpp
@@ -1,414 +1,414 @@
-#include <iostream>
-#include <string>
-
-#include <boost/pointer_cast.hpp>
-
-#include "vfluids.h"
-
-using namespace std;
-
-
-void setup(const char *cstr1, const char *cstr2)
-{
-   try
-   {
-      //Sleep(30000);
-
-      ConfigFileReader cf(cstr1);
-      if ( !cf.read() )
-      {
-         std::string exceptionText = "Unable to read configuration file\n";
-         throw exceptionText;
-      }
-
-      //parameters from config file
-      string machine = cf.getValue("machine");
-      string pathname = cf.getValue("path");
-      string geoFile = cf.getValue("geoFile");
-      int numOfThreads = UbSystem::stringTo<int>(cf.getValue("numOfThreads"));
-      double availMem = UbSystem::stringTo<double>(cf.getValue("availMem"));
-      int refineLevel = UbSystem::stringTo<int>(cf.getValue("refineLevel"));
-      int blocknx = UbSystem::stringTo<int>(cf.getValue("blocknx"));
-
-      CommunicatorPtr comm = MPICommunicator::getInstance();
-      int myid = comm->getProcessID();
-
-      if(machine == "Bombadil") int dumy=0; 
-      else if(machine == "Ludwig" || machine == "HLRN")      
-      {
-         if(myid ==0)
-         {
-            stringstream logFilename;
-            logFilename <<  pathname + "/logfile"+UbSystem::toString(UbSystem::getTimeStamp())+".txt";
-            UbLog::output_policy::setStream(logFilename.str());
-         }
-      }
-      else throw UbException(UB_EXARGS, "unknown machine");
-
-      GbTriFaceMesh3DPtr geo (GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(geoFile,"geo"));
-      if(myid == 0) GbSystem3D::writeGeoObject(geo.get(), pathname+"/geo/geo", WbWriterVtkXmlASCII::getInstance());
-
-      double dx = (fabs(geo->getX3Maximum()-geo->getX3Minimum())*10e-3)*(double)(1<<refineLevel);
-      dx /= 4.0;
-
-      double blockLength = blocknx*dx;
-
-      double offsetX1 = fabs(geo->getX1Maximum()-geo->getX1Minimum());
-      double h = fabs(geo->getX3Maximum()-geo->getX3Minimum());
-      double offsetX2 = fabs(geo->getX2Maximum()-geo->getX2Minimum())/3.0;
-      double offsetX3 = 3.0*h; //30.0*h;
-
-      double g_minX1 = geo->getX1Minimum()-offsetX1;
-      double g_minX2 = geo->getX2Minimum()+offsetX2;
-      double g_minX3 = geo->getX3Centroid()-offsetX3;
-
-      double g_maxX1 = geo->getX1Maximum()+5.0*offsetX1;
-      double g_maxX2 = g_minX2 + 4.0*blockLength; 
-      double g_maxX3 = geo->getX3Centroid()+offsetX3;
-
-      //##########################################################################
-      //## physical parameters
-      //##########################################################################
-      double Re            = 1e6;
-
-      double rhoLB    = 0.0;
-      double rhoReal  = 1.0;
-      double nueReal  = 0.000015;//0.015;
-
-      double lReal    =  3.0;//<-m     ;//Profile laenge in cm(! cm nicht m !)
-      double uReal    = Re*nueReal/lReal;
-
-      //##Machzahl:
-      //#Ma     = uReal/csReal
-      double Ma      = 0.1;//Ma-Real!
-      double csReal  = uReal/Ma;
-      double hLB     = lReal/dx;
-
-      LBMUnitConverter unitConverter(lReal, csReal, rhoReal, hLB);
-
-      double uLB     = uReal   * unitConverter.getFactorVelocityWToLb();
-      double nueLB   = nueReal * unitConverter.getFactorViscosityWToLb();
-
-      LBMUnitConverterPtr conv = LBMUnitConverterPtr(new LBMUnitConverter());
-
-      const int baseLevel = 0;
-
-      ////////////////////////////////////////////////////////////////////////
-      //Grid
-      //////////////////////////////////////////////////////////////////////////
-      Grid3DPtr grid(new Grid3D(comm));
-      grid->setDeltaX(dx);
-      grid->setBlockNX(blocknx, blocknx, blocknx);
-      
-      GbObject3DPtr gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
-      //gridCube->setCenterCoordinates(geo->getX1Centroid(), geo->getX2Centroid(), geo->getX3Centroid());
-      if(myid == 0) GbSystem3D::writeGeoObject(gridCube.get(),pathname+"/geo/gridCube", WbWriterVtkXmlASCII::getInstance());
-      GenBlocksGridVisitor genBlocks(gridCube);
-      grid->accept(genBlocks);
-
-      grid->setPeriodicX2(true);
-      grid->setPeriodicX3(true);
-
-      double outTime = 1.0;
-      UbSchedulerPtr stepSch(new UbScheduler(outTime));
-      //PostprocessorPtr pp(new D3Q27MacroscopicQuantitiesPostprocessor(grid, stepSch, pathname + "/steps/step", WbWriterVtkXmlASCII::getInstance(), conv, comm));
-
-      UbSchedulerPtr rSch(new UbScheduler());
-      rSch->addSchedule(50,50,50);
-      RestartPostprocessorPtr rp(new RestartPostprocessor(grid, rSch, comm, pathname+"/checkpoints", RestartPostprocessor::TXT));
-      
-
-      std::string opt;
-
-      if(cstr2!= NULL)
-         opt = std::string(cstr2);
-
-      if/*(cstr== NULL)*/(cstr2!= NULL)
-      {
-         if(myid==0) UBLOG(logINFO,"Restart step: " << opt);
-         grid = rp->restart(UbSystem::stringTo<int>(opt));
-         rp->reconnect(grid);
-
-         SetForcingBlockVisitor forcingVisitor(0.0, 0.0, 0.0);
-         grid->accept(forcingVisitor);
-
-         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
-         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
-         grid->accept( setConnsVisitor );
-      }
-      else
-{
-      //rp->addPostprocessor(pp);
-      if(myid ==0)
-      {
-         UBLOG(logINFO,"Parameters:");
-         UBLOG(logINFO, "* Re            ="<<Re);
-         UBLOG(logINFO, "* Ma            ="<<Ma);
-         UBLOG(logINFO, "* uReal         ="<<uReal);
-         UBLOG(logINFO, "* nueReal       ="<<nueReal);
-         UBLOG(logINFO, "* nue           ="<<nueLB);
-         UBLOG(logINFO, "* velocity      ="<<uLB);
-         //UBLOG(logINFO, "* LX1 (world/LB)="<<kanallaengeSI<<"/"<<kanallaengeSI/coarseNodeDx);
-         //UBLOG(logINFO, "* LX2 (world/LB)="<<kanalbreiteSI<<"/"<<kanalbreiteSI/coarseNodeDx);
-         //UBLOG(logINFO, "* LX3 (world/LB)="<<kanalhoeheSI<<"/"<<kanalhoeheSI/coarseNodeDx);
-         UBLOG(logINFO, "* dx_base       ="<<dx);
-         UBLOG(logINFO, "* dx_refine     ="<<dx/(double)(1<<refineLevel));
-         //UBLOG(logINFO, "* nx1/2/3       ="<<nx[0]<<"/"<<nx[1]<<"/"<<nx[2]);
-         UBLOG(logINFO, "* blocknx1/2/3  ="<<blocknx<<"/"<<blocknx<<"/"<<blocknx);
-         //UBLOG(logINFO, "* x2Periodic    ="<<periodicx2);
-         //UBLOG(logINFO, "* x3Periodic    ="<<periodicx3);
-         UBLOG(logINFO, "*****************************************");
-         UBLOGML(logINFO, "UnitConverter:"<<unitConverter.toString());
-         UBLOG(logINFO, "*****************************************");    
-         UBLOG(logINFO,"number of levels = " << refineLevel+1 );
-         UBLOG(logINFO,"numOfThreads     = " << numOfThreads );
-         UBLOG(logINFO,"Preprozess - start");
-      }
-
-
-      //inflow
-      GbCuboid3DPtr geoInflow (new GbCuboid3D(g_minX1-4.0*blockLength, g_minX2-4.0*blockLength, g_minX3-4.0*blockLength, g_minX1+2.0*dx, g_maxX2+4.0*blockLength, g_maxX3+4.0*blockLength));
-      if(myid == 0) GbSystem3D::writeGeoObject(geoInflow.get(), pathname+"/geo/geoInflow", WbWriterVtkXmlASCII::getInstance());
-
-      //outflow
-      GbCuboid3DPtr geoOutflow (new GbCuboid3D(g_maxX1-2.0*dx, g_minX2-4.0*blockLength, g_minX3-4.0*blockLength, g_maxX1+4.0*blockLength, g_maxX2+4.0*blockLength, g_maxX3+4.0*blockLength));
-      if(myid == 0) GbSystem3D::writeGeoObject(geoOutflow.get(), pathname+"/geo/geoOutflow", WbWriterVtkXmlASCII::getInstance());
-
-      BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname + "/grid/blocks", WbWriterVtkXmlBinary::getInstance(), comm));
-
-      double scaleFactorX = 1.2;
-      double scaleFactorZ = 1.2;
-      //geo->scale(scaleFactorX, 1.0, scaleFactorZ);
-      if(myid == 0) GbSystem3D::writeGeoObject(geo.get(), pathname+"/geo/geo2", WbWriterVtkXmlASCII::getInstance());
-
-      int bbOption = 1; //0=simple Bounce Back, 1=quadr. BB
-      D3Q27BoundaryConditionAdapterPtr noSlipBCAdapter(new D3Q27NoSlipBCAdapter(bbOption));
-
-      Interactor3DPtr geoIntr = D3Q27TriFaceMeshInteractorPtr(new D3Q27TriFaceMeshInteractor(geo, grid, noSlipBCAdapter,Interactor3D::SOLID));
-
-      //boost::dynamic_pointer_cast<D3Q27TriFaceMeshInteractor>(geoIntr)->refineBlockGridToLevel(refineLevel, 0.0, 5.0);
-
-      if (refineLevel > 0)
-      {
-         if(myid == 0) UBLOG(logINFO,"Refinement - start");	
-         //RefineCrossAndInsideGbObjectHelper refineHelper(grid, refineLevel);
-         //refineHelper.addGbObject(geo, refineLevel);
-         //refineHelper.refine();
-         RefineAroundGbObjectHelper refineHelper(grid, refineLevel, boost::dynamic_pointer_cast<D3Q27TriFaceMeshInteractor>(geoIntr), 0.0, 0.5);
-         refineHelper.refine();
-         if(myid == 0) UBLOG(logINFO,"Refinement - end");	
-      }
-
-      ppblocks->update(0);
-      ppblocks.reset();
-      return;
-
-      //geo->scale(1.0/scaleFactorX, 1.0, 1.0/scaleFactorX);
-      //geo = GbTriFaceMesh3DPtr(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(geoFile,"geo"));
-      if(myid == 0) GbSystem3D::writeGeoObject(geo.get(), pathname+"/geo/geo3", WbWriterVtkXmlASCII::getInstance());
-
-      MetisPartitioningGridVisitor metisVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B, true, numOfThreads);
-      grid->accept( metisVisitor );
-
-      SolidBlocksHelper sd(grid, comm);
-
-      mu::Parser fct;
-      fct.SetExpr("U");
-      fct.DefineConst("U", uLB);
-
-      //inflow
-      D3Q27BoundaryConditionAdapterPtr velBCAdapter(new D3Q27VelocityBCAdapter (true, false ,false ,fct, 0, D3Q27BCFunction::INFCONST));
-      velBCAdapter->setSecondaryBcOption(2);
-      D3Q27InteractorPtr inflowIntr  = D3Q27InteractorPtr( new D3Q27Interactor(geoInflow, grid, velBCAdapter, Interactor3D::SOLID));
-
-      //outflow
-      D3Q27BoundaryConditionAdapterPtr denBCAdapter(new D3Q27DensityBCAdapter(rhoLB));
-      denBCAdapter->setSecondaryBcOption(0);
-      D3Q27InteractorPtr outflowIntr = D3Q27InteractorPtr( new D3Q27Interactor(geoOutflow, grid, denBCAdapter,Interactor3D::SOLID));
-
-
-      sd.addInteractor(inflowIntr);
-      sd.addInteractor(outflowIntr);
-      sd.addInteractor(geoIntr);
-
-      sd.deleteSolidBlocks();
-
-      grid->accept( metisVisitor );
-
-      sd.setTransBlocks();
-
-      ppblocks->update(0);
-      ppblocks.reset();
-
-      //set connectors
-      D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
-      D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
-      grid->accept( setConnsVisitor );
-
-      //domain decomposition for threads
-      //PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
-      //grid->accept(pqPartVisitor);
-
-
-      unsigned long nob = grid->getNumberOfBlocks();
-      int gl = 3;
-      unsigned long nodb = (blocknx) * (blocknx) * (blocknx);
-      unsigned long nod = nob * (blocknx) * (blocknx) * (blocknx);
-      unsigned long nodg = nob * (blocknx+gl) * (blocknx+gl) * (blocknx+gl);
-      double needMemAll  = double(nodg*(27*sizeof(double) + sizeof(int) + sizeof(float)*4));
-      double needMem  = needMemAll / double(comm->getNumberOfProcesses());
-
-      if(myid == 0)
-      {
-         UBLOG(logINFO,"Number of blocks = " << nob);
-         UBLOG(logINFO,"Number of nodes  = " << nod);
-         int minInitLevel = grid->getCoarsestInitializedLevel();
-         int maxInitLevel = grid->getFinestInitializedLevel();
-         for(int level = minInitLevel; level<=maxInitLevel; level++)
-         {
-            int nobl = grid->getNumberOfBlocks(level);
-            UBLOG(logINFO,"Number of blocks for level " << level <<" = " << nobl);
-            UBLOG(logINFO,"Number of nodes for level " << level <<" = " << nobl*nodb);
-         }
-         UBLOG(logINFO,"Necessary memory  = " << needMemAll  << " bytes");
-         UBLOG(logINFO,"Necessary memory per process = " << needMem  << " bytes");
-         UBLOG(logINFO,"Available memory per process = " << availMem << " bytes");
-      }            
-
-      LBMKernel3DPtr kernel;
-      kernel = LBMKernel3DPtr(new LBMKernelETD3Q27CCLB(blocknx, blocknx, blocknx, LBMKernelETD3Q27CCLB::NORMAL));
-
-      //mu::Parser fctForcingX1;
-      //fctForcingX1.SetExpr("Fx1");
-      //fctForcingX1.DefineConst("Fx1", 9.99685e-7);
-
-      //kernel->setForcingX1(fctForcingX1);
-      //kernel->setWithForcing(true);
-      //
-      BCProcessorPtr bcProc(new D3Q27ETBCProcessor());
-      kernel->setBCProcessor(bcProc);
-
-      SetKernelBlockVisitor kernelVisitor(kernel, nueLB, availMem, needMem);
-      grid->accept(kernelVisitor);
-
-      if (refineLevel > 0)
-      {
-         D3Q27SetUndefinedNodesBlockVisitor undefNodesVisitor;
-         grid->accept(undefNodesVisitor);
-      }
-
-	  //UbSchedulerPtr geoSch(new UbScheduler(1));
-	  //D3Q27MacroscopicQuantitiesPostprocessorPtr ppgeo(
-		 // new D3Q27MacroscopicQuantitiesPostprocessor(grid, geoSch, pathname + "/grid/nodes", WbWriterVtkXmlBinary::getInstance(), conv, comm, true));
-	  //ppgeo->update(0);
-	  //ppgeo.reset();
-
-	  //return;
-
-      //inflow
-      grid->addAndInitInteractor(inflowIntr);
-
-      //outflow
-      grid->addAndInitInteractor(outflowIntr);
-
-      //geo
-      grid->addAndInitInteractor(geoIntr);
-
-      //initialization of distributions
-      D3Q27ETInitDistributionsBlockVisitor initVisitor(nueLB, rhoLB);
-      initVisitor.setVx1(fct);
-      initVisitor.setNu(nueLB);
-      grid->accept(initVisitor);
-
-      //Postrozess
-      //UbSchedulerPtr geoSch(new UbScheduler(1));
-      //D3Q27MacroscopicQuantitiesPostprocessorPtr ppgeo(
-      //   new D3Q27MacroscopicQuantitiesPostprocessor(grid, geoSch, pathname + "/grid/nodes", WbWriterVtkXmlBinary::getInstance(), conv, comm, true));
-      //ppgeo->update(0);
-      //ppgeo.reset();
-
-      {
-         UbSchedulerPtr geoSch(new UbScheduler(1));
-         //D3Q27MacroscopicQuantitiesPostprocessor ppgeo(grid,geoSch, pathname + "/grid/nodes", WbWriterVtkXmlBinary::getInstance(), conv,  comm, true);
-         D3Q27MacroscopicQuantitiesPostprocessorPtr ppgeo(
-            new D3Q27MacroscopicQuantitiesPostprocessor(grid, geoSch, pathname + "/grid/nodes", WbWriterVtkXmlBinary::getInstance(), conv, true));
-         //grid->addObserver(ppgeo);
-         grid->doPostProcess(0);
-         //grid->notifyObservers(0);
-         //grid->removeObserver(ppgeo);
-      }
-
-      //grid->notifyObservers(0);
-
-      //UbSchedulerPtr stepSch(new UbScheduler(outTime));
-      D3Q27MacroscopicQuantitiesPostprocessorPtr pp(new D3Q27MacroscopicQuantitiesPostprocessor(grid, stepSch, pathname + "/steps/step", WbWriterVtkXmlASCII::getInstance(), conv));
-      rp->addPostprocessor(pp);
-
-      if(myid == 0) UBLOG(logINFO,"Preprozess - end"); 
-}
-      UbSchedulerPtr nupsSch(new UbScheduler(10, 30, 100));
-      NUPSCounterPostprocessor npr(grid, nupsSch, pathname + "/results/nups.txt", comm);
-
-     // double outTime = 3.0;
-     // UbSchedulerPtr stepSch(new UbScheduler(outTime));
-      //UbSchedulerPtr stepSch(new UbScheduler());
-      //stepSch->addSchedule(10, 100, 1000);
-      //nodeSch->addSchedule(1000, 1000, 10000);
-      //nodeSch->addSchedule(10000, 10000, 50000);
-      //stepSch->addSchedule(100, 100, 1000);
-
-      //UbSchedulerPtr st(new UbScheduler(100,50,1000));
-      //UbSchedulerPtr rs(new UbScheduler(3));
-      //AverageValuesPostprocessor ap(grid, pathname + "/av/av", WbWriterVtkXmlASCII::getInstance(), stepSch, rs, comm);
-
-      //D3Q27ShearStressPostprocessor shs(grid,pathname + "/shs/shs", WbWriterVtkXmlASCII::getInstance(), stepSch, rs, comm);
-      //shs.addInteractor(boost::dynamic_pointer_cast<D3Q27Interactor>(addWallZminInt));
-
-      //D3Q27MacroscopicQuantitiesPostprocessor pp(grid, stepSch, pathname + "/steps/step", WbWriterVtkXmlASCII::getInstance(), conv, comm);
-
-      UbSchedulerPtr visSch(new UbScheduler(1));
-      //UbSchedulerPtr visSch(stepSch);
-      double endTime = UbSystem::stringTo<int>(cf.getValue("endTime"));//10001.0;
-
-      //cout << "PID = " << myid << " Total Physical Memory (RAM): " << MemoryUtil::getTotalPhysMem()<<endl;
-      //cout << "PID = " << myid << " Physical Memory currently used: " << MemoryUtil::getPhysMemUsed()<<endl;
-      //cout << "PID = " << myid << " Physical Memory currently used by current process: " << MemoryUtil::getPhysMemUsedByMe()<<endl;
-
-      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, visSch));
-      if(myid == 0) UBLOG(logINFO,"Simulation-start");
-      calculation->calculate();
-      if(myid == 0) UBLOG(logINFO,"Simulation-end");
-   }
-   catch(std::exception& e)
-   {
-      cerr << e.what() << endl << flush;
-   }
-   catch(std::string& s)
-   {
-      cerr << s << endl;
-   }
-   catch(...)
-   {
-      cerr << "unknown exception" << endl;
-   }
-
-}
-
-int main(int argc, char* argv[])
-{
-
-   if ( argv != NULL )
-   {
-      if (argc > 1)
-      {
-         setup(argv[1], argv[2]);
-      }
-      else
-      {
-         cout << "Configuration file must be set!: " <<  argv[0] << " <config file>" << endl << std::flush;
-      }
-   }
-
-   return 0;
-} 
-
+#include <iostream>
+#include <string>
+
+#include <boost/pointer_cast.hpp>
+
+#include "vfluids.h"
+
+using namespace std;
+
+
+void setup(const char *cstr1, const char *cstr2)
+{
+   try
+   {
+      //Sleep(30000);
+
+      ConfigFileReader cf(cstr1);
+      if ( !cf.read() )
+      {
+         std::string exceptionText = "Unable to read configuration file\n";
+         throw exceptionText;
+      }
+
+      //parameters from config file
+      string machine = cf.getValue("machine");
+      string pathname = cf.getValue("path");
+      string geoFile = cf.getValue("geoFile");
+      int numOfThreads = UbSystem::stringTo<int>(cf.getValue("numOfThreads"));
+      double availMem = UbSystem::stringTo<double>(cf.getValue("availMem"));
+      int refineLevel = UbSystem::stringTo<int>(cf.getValue("refineLevel"));
+      int blocknx = UbSystem::stringTo<int>(cf.getValue("blocknx"));
+
+      CommunicatorPtr comm = MPICommunicator::getInstance();
+      int myid = comm->getProcessID();
+
+      if(machine == "Bombadil") int dumy=0; 
+      else if(machine == "Ludwig" || machine == "HLRN")      
+      {
+         if(myid ==0)
+         {
+            stringstream logFilename;
+            logFilename <<  pathname + "/logfile"+UbSystem::toString(UbSystem::getTimeStamp())+".txt";
+            UbLog::output_policy::setStream(logFilename.str());
+         }
+      }
+      else throw UbException(UB_EXARGS, "unknown machine");
+
+      GbTriFaceMesh3DPtr geo (GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(geoFile,"geo"));
+      if(myid == 0) GbSystem3D::writeGeoObject(geo.get(), pathname+"/geo/geo", WbWriterVtkXmlASCII::getInstance());
+
+      double dx = (fabs(geo->getX3Maximum()-geo->getX3Minimum())*10e-3)*(double)(1<<refineLevel);
+      dx /= 4.0;
+
+      double blockLength = blocknx*dx;
+
+      double offsetX1 = fabs(geo->getX1Maximum()-geo->getX1Minimum());
+      double h = fabs(geo->getX3Maximum()-geo->getX3Minimum());
+      double offsetX2 = fabs(geo->getX2Maximum()-geo->getX2Minimum())/3.0;
+      double offsetX3 = 3.0*h; //30.0*h;
+
+      double g_minX1 = geo->getX1Minimum()-offsetX1;
+      double g_minX2 = geo->getX2Minimum()+offsetX2;
+      double g_minX3 = geo->getX3Centroid()-offsetX3;
+
+      double g_maxX1 = geo->getX1Maximum()+5.0*offsetX1;
+      double g_maxX2 = g_minX2 + 4.0*blockLength; 
+      double g_maxX3 = geo->getX3Centroid()+offsetX3;
+
+      //##########################################################################
+      //## physical parameters
+      //##########################################################################
+      double Re            = 1e6;
+
+      double rhoLB    = 0.0;
+      double rhoReal  = 1.0;
+      double nueReal  = 0.000015;//0.015;
+
+      double lReal    =  3.0;//<-m     ;//Profile laenge in cm(! cm nicht m !)
+      double uReal    = Re*nueReal/lReal;
+
+      //##Machzahl:
+      //#Ma     = uReal/csReal
+      double Ma      = 0.1;//Ma-Real!
+      double csReal  = uReal/Ma;
+      double hLB     = lReal/dx;
+
+      LBMUnitConverter unitConverter(lReal, csReal, rhoReal, hLB);
+
+      double uLB     = uReal   * unitConverter.getFactorVelocityWToLb();
+      double nueLB   = nueReal * unitConverter.getFactorViscosityWToLb();
+
+      LBMUnitConverterPtr conv = LBMUnitConverterPtr(new LBMUnitConverter());
+
+      const int baseLevel = 0;
+
+      ////////////////////////////////////////////////////////////////////////
+      //Grid
+      //////////////////////////////////////////////////////////////////////////
+      Grid3DPtr grid(new Grid3D(comm));
+      grid->setDeltaX(dx);
+      grid->setBlockNX(blocknx, blocknx, blocknx);
+      
+      GbObject3DPtr gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
+      //gridCube->setCenterCoordinates(geo->getX1Centroid(), geo->getX2Centroid(), geo->getX3Centroid());
+      if(myid == 0) GbSystem3D::writeGeoObject(gridCube.get(),pathname+"/geo/gridCube", WbWriterVtkXmlASCII::getInstance());
+      GenBlocksGridVisitor genBlocks(gridCube);
+      grid->accept(genBlocks);
+
+      grid->setPeriodicX2(true);
+      grid->setPeriodicX3(true);
+
+      double outTime = 1.0;
+      UbSchedulerPtr stepSch(new UbScheduler(outTime));
+      //PostprocessorPtr pp(new D3Q27MacroscopicQuantitiesPostprocessor(grid, stepSch, pathname + "/steps/step", WbWriterVtkXmlASCII::getInstance(), conv, comm));
+
+      UbSchedulerPtr rSch(new UbScheduler());
+      rSch->addSchedule(50,50,50);
+      RestartPostprocessorPtr rp(new RestartPostprocessor(grid, rSch, comm, pathname+"/checkpoints", RestartPostprocessor::TXT));
+      
+
+      std::string opt;
+
+      if(cstr2!= NULL)
+         opt = std::string(cstr2);
+
+      if/*(cstr== NULL)*/(cstr2!= NULL)
+      {
+         if(myid==0) UBLOG(logINFO,"Restart step: " << opt);
+         grid = rp->restart(UbSystem::stringTo<int>(opt));
+         rp->reconnect(grid);
+
+         SetForcingBlockVisitor forcingVisitor(0.0, 0.0, 0.0);
+         grid->accept(forcingVisitor);
+
+         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
+         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
+         grid->accept( setConnsVisitor );
+      }
+      else
+{
+      //rp->addPostprocessor(pp);
+      if(myid ==0)
+      {
+         UBLOG(logINFO,"Parameters:");
+         UBLOG(logINFO, "* Re            ="<<Re);
+         UBLOG(logINFO, "* Ma            ="<<Ma);
+         UBLOG(logINFO, "* uReal         ="<<uReal);
+         UBLOG(logINFO, "* nueReal       ="<<nueReal);
+         UBLOG(logINFO, "* nue           ="<<nueLB);
+         UBLOG(logINFO, "* velocity      ="<<uLB);
+         //UBLOG(logINFO, "* LX1 (world/LB)="<<kanallaengeSI<<"/"<<kanallaengeSI/coarseNodeDx);
+         //UBLOG(logINFO, "* LX2 (world/LB)="<<kanalbreiteSI<<"/"<<kanalbreiteSI/coarseNodeDx);
+         //UBLOG(logINFO, "* LX3 (world/LB)="<<kanalhoeheSI<<"/"<<kanalhoeheSI/coarseNodeDx);
+         UBLOG(logINFO, "* dx_base       ="<<dx);
+         UBLOG(logINFO, "* dx_refine     ="<<dx/(double)(1<<refineLevel));
+         //UBLOG(logINFO, "* nx1/2/3       ="<<nx[0]<<"/"<<nx[1]<<"/"<<nx[2]);
+         UBLOG(logINFO, "* blocknx1/2/3  ="<<blocknx<<"/"<<blocknx<<"/"<<blocknx);
+         //UBLOG(logINFO, "* x2Periodic    ="<<periodicx2);
+         //UBLOG(logINFO, "* x3Periodic    ="<<periodicx3);
+         UBLOG(logINFO, "*****************************************");
+         UBLOGML(logINFO, "UnitConverter:"<<unitConverter.toString());
+         UBLOG(logINFO, "*****************************************");    
+         UBLOG(logINFO,"number of levels = " << refineLevel+1 );
+         UBLOG(logINFO,"numOfThreads     = " << numOfThreads );
+         UBLOG(logINFO,"Preprozess - start");
+      }
+
+
+      //inflow
+      GbCuboid3DPtr geoInflow (new GbCuboid3D(g_minX1-4.0*blockLength, g_minX2-4.0*blockLength, g_minX3-4.0*blockLength, g_minX1+2.0*dx, g_maxX2+4.0*blockLength, g_maxX3+4.0*blockLength));
+      if(myid == 0) GbSystem3D::writeGeoObject(geoInflow.get(), pathname+"/geo/geoInflow", WbWriterVtkXmlASCII::getInstance());
+
+      //outflow
+      GbCuboid3DPtr geoOutflow (new GbCuboid3D(g_maxX1-2.0*dx, g_minX2-4.0*blockLength, g_minX3-4.0*blockLength, g_maxX1+4.0*blockLength, g_maxX2+4.0*blockLength, g_maxX3+4.0*blockLength));
+      if(myid == 0) GbSystem3D::writeGeoObject(geoOutflow.get(), pathname+"/geo/geoOutflow", WbWriterVtkXmlASCII::getInstance());
+
+      BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname + "/grid/blocks", WbWriterVtkXmlBinary::getInstance(), comm));
+
+      double scaleFactorX = 1.2;
+      double scaleFactorZ = 1.2;
+      //geo->scale(scaleFactorX, 1.0, scaleFactorZ);
+      if(myid == 0) GbSystem3D::writeGeoObject(geo.get(), pathname+"/geo/geo2", WbWriterVtkXmlASCII::getInstance());
+
+      int bbOption = 1; //0=simple Bounce Back, 1=quadr. BB
+      D3Q27BoundaryConditionAdapterPtr noSlipBCAdapter(new D3Q27NoSlipBCAdapter(bbOption));
+
+      Interactor3DPtr geoIntr = D3Q27TriFaceMeshInteractorPtr(new D3Q27TriFaceMeshInteractor(geo, grid, noSlipBCAdapter,Interactor3D::SOLID));
+
+      //boost::dynamic_pointer_cast<D3Q27TriFaceMeshInteractor>(geoIntr)->refineBlockGridToLevel(refineLevel, 0.0, 5.0);
+
+      if (refineLevel > 0)
+      {
+         if(myid == 0) UBLOG(logINFO,"Refinement - start");	
+         //RefineCrossAndInsideGbObjectHelper refineHelper(grid, refineLevel);
+         //refineHelper.addGbObject(geo, refineLevel);
+         //refineHelper.refine();
+         RefineAroundGbObjectHelper refineHelper(grid, refineLevel, boost::dynamic_pointer_cast<D3Q27TriFaceMeshInteractor>(geoIntr), 0.0, 0.5);
+         refineHelper.refine();
+         if(myid == 0) UBLOG(logINFO,"Refinement - end");	
+      }
+
+      ppblocks->update(0);
+      ppblocks.reset();
+      return;
+
+      //geo->scale(1.0/scaleFactorX, 1.0, 1.0/scaleFactorX);
+      //geo = GbTriFaceMesh3DPtr(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(geoFile,"geo"));
+      if(myid == 0) GbSystem3D::writeGeoObject(geo.get(), pathname+"/geo/geo3", WbWriterVtkXmlASCII::getInstance());
+
+      MetisPartitioningGridVisitor metisVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B, true, numOfThreads);
+      grid->accept( metisVisitor );
+
+      SolidBlocksHelper sd(grid, comm);
+
+      mu::Parser fct;
+      fct.SetExpr("U");
+      fct.DefineConst("U", uLB);
+
+      //inflow
+      D3Q27BoundaryConditionAdapterPtr velBCAdapter(new D3Q27VelocityBCAdapter (true, false ,false ,fct, 0, D3Q27BCFunction::INFCONST));
+      velBCAdapter->setSecondaryBcOption(2);
+      D3Q27InteractorPtr inflowIntr  = D3Q27InteractorPtr( new D3Q27Interactor(geoInflow, grid, velBCAdapter, Interactor3D::SOLID));
+
+      //outflow
+      D3Q27BoundaryConditionAdapterPtr denBCAdapter(new D3Q27DensityBCAdapter(rhoLB));
+      denBCAdapter->setSecondaryBcOption(0);
+      D3Q27InteractorPtr outflowIntr = D3Q27InteractorPtr( new D3Q27Interactor(geoOutflow, grid, denBCAdapter,Interactor3D::SOLID));
+
+
+      sd.addInteractor(inflowIntr);
+      sd.addInteractor(outflowIntr);
+      sd.addInteractor(geoIntr);
+
+      sd.deleteSolidBlocks();
+
+      grid->accept( metisVisitor );
+
+      sd.setTransBlocks();
+
+      ppblocks->update(0);
+      ppblocks.reset();
+
+      //set connectors
+      D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
+      D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
+      grid->accept( setConnsVisitor );
+
+      //domain decomposition for threads
+      //PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
+      //grid->accept(pqPartVisitor);
+
+
+      unsigned long nob = grid->getNumberOfBlocks();
+      int gl = 3;
+      unsigned long nodb = (blocknx) * (blocknx) * (blocknx);
+      unsigned long nod = nob * (blocknx) * (blocknx) * (blocknx);
+      unsigned long nodg = nob * (blocknx+gl) * (blocknx+gl) * (blocknx+gl);
+      double needMemAll  = double(nodg*(27*sizeof(double) + sizeof(int) + sizeof(float)*4));
+      double needMem  = needMemAll / double(comm->getNumberOfProcesses());
+
+      if(myid == 0)
+      {
+         UBLOG(logINFO,"Number of blocks = " << nob);
+         UBLOG(logINFO,"Number of nodes  = " << nod);
+         int minInitLevel = grid->getCoarsestInitializedLevel();
+         int maxInitLevel = grid->getFinestInitializedLevel();
+         for(int level = minInitLevel; level<=maxInitLevel; level++)
+         {
+            int nobl = grid->getNumberOfBlocks(level);
+            UBLOG(logINFO,"Number of blocks for level " << level <<" = " << nobl);
+            UBLOG(logINFO,"Number of nodes for level " << level <<" = " << nobl*nodb);
+         }
+         UBLOG(logINFO,"Necessary memory  = " << needMemAll  << " bytes");
+         UBLOG(logINFO,"Necessary memory per process = " << needMem  << " bytes");
+         UBLOG(logINFO,"Available memory per process = " << availMem << " bytes");
+      }            
+
+      LBMKernel3DPtr kernel;
+      kernel = LBMKernel3DPtr(new LBMKernelETD3Q27CCLB(blocknx, blocknx, blocknx, LBMKernelETD3Q27CCLB::NORMAL));
+
+      //mu::Parser fctForcingX1;
+      //fctForcingX1.SetExpr("Fx1");
+      //fctForcingX1.DefineConst("Fx1", 9.99685e-7);
+
+      //kernel->setForcingX1(fctForcingX1);
+      //kernel->setWithForcing(true);
+      //
+      BCProcessorPtr bcProc(new D3Q27ETBCProcessor());
+      kernel->setBCProcessor(bcProc);
+
+      SetKernelBlockVisitor kernelVisitor(kernel, nueLB, availMem, needMem);
+      grid->accept(kernelVisitor);
+
+      if (refineLevel > 0)
+      {
+         D3Q27SetUndefinedNodesBlockVisitor undefNodesVisitor;
+         grid->accept(undefNodesVisitor);
+      }
+
+	  //UbSchedulerPtr geoSch(new UbScheduler(1));
+	  //D3Q27MacroscopicQuantitiesPostprocessorPtr ppgeo(
+		 // new D3Q27MacroscopicQuantitiesPostprocessor(grid, geoSch, pathname + "/grid/nodes", WbWriterVtkXmlBinary::getInstance(), conv, comm, true));
+	  //ppgeo->update(0);
+	  //ppgeo.reset();
+
+	  //return;
+
+      //inflow
+      grid->addAndInitInteractor(inflowIntr);
+
+      //outflow
+      grid->addAndInitInteractor(outflowIntr);
+
+      //geo
+      grid->addAndInitInteractor(geoIntr);
+
+      //initialization of distributions
+      D3Q27ETInitDistributionsBlockVisitor initVisitor(nueLB, rhoLB);
+      initVisitor.setVx1(fct);
+      initVisitor.setNu(nueLB);
+      grid->accept(initVisitor);
+
+      //Postrozess
+      //UbSchedulerPtr geoSch(new UbScheduler(1));
+      //D3Q27MacroscopicQuantitiesPostprocessorPtr ppgeo(
+      //   new D3Q27MacroscopicQuantitiesPostprocessor(grid, geoSch, pathname + "/grid/nodes", WbWriterVtkXmlBinary::getInstance(), conv, comm, true));
+      //ppgeo->update(0);
+      //ppgeo.reset();
+
+      {
+         UbSchedulerPtr geoSch(new UbScheduler(1));
+         //D3Q27MacroscopicQuantitiesPostprocessor ppgeo(grid,geoSch, pathname + "/grid/nodes", WbWriterVtkXmlBinary::getInstance(), conv,  comm, true);
+         D3Q27MacroscopicQuantitiesPostprocessorPtr ppgeo(
+            new D3Q27MacroscopicQuantitiesPostprocessor(grid, geoSch, pathname + "/grid/nodes", WbWriterVtkXmlBinary::getInstance(), conv, true));
+         //grid->addObserver(ppgeo);
+         grid->doPostProcess(0);
+         //grid->notifyObservers(0);
+         //grid->removeObserver(ppgeo);
+      }
+
+      //grid->notifyObservers(0);
+
+      //UbSchedulerPtr stepSch(new UbScheduler(outTime));
+      D3Q27MacroscopicQuantitiesPostprocessorPtr pp(new D3Q27MacroscopicQuantitiesPostprocessor(grid, stepSch, pathname + "/steps/step", WbWriterVtkXmlASCII::getInstance(), conv));
+      rp->addPostprocessor(pp);
+
+      if(myid == 0) UBLOG(logINFO,"Preprozess - end"); 
+}
+      UbSchedulerPtr nupsSch(new UbScheduler(10, 30, 100));
+      NUPSCounterPostprocessor npr(grid, nupsSch, pathname + "/results/nups.txt", comm);
+
+     // double outTime = 3.0;
+     // UbSchedulerPtr stepSch(new UbScheduler(outTime));
+      //UbSchedulerPtr stepSch(new UbScheduler());
+      //stepSch->addSchedule(10, 100, 1000);
+      //nodeSch->addSchedule(1000, 1000, 10000);
+      //nodeSch->addSchedule(10000, 10000, 50000);
+      //stepSch->addSchedule(100, 100, 1000);
+
+      //UbSchedulerPtr st(new UbScheduler(100,50,1000));
+      //UbSchedulerPtr rs(new UbScheduler(3));
+      //AverageValuesPostprocessor ap(grid, pathname + "/av/av", WbWriterVtkXmlASCII::getInstance(), stepSch, rs, comm);
+
+      //D3Q27ShearStressPostprocessor shs(grid,pathname + "/shs/shs", WbWriterVtkXmlASCII::getInstance(), stepSch, rs, comm);
+      //shs.addInteractor(boost::dynamic_pointer_cast<D3Q27Interactor>(addWallZminInt));
+
+      //D3Q27MacroscopicQuantitiesPostprocessor pp(grid, stepSch, pathname + "/steps/step", WbWriterVtkXmlASCII::getInstance(), conv, comm);
+
+      UbSchedulerPtr visSch(new UbScheduler(1));
+      //UbSchedulerPtr visSch(stepSch);
+      double endTime = UbSystem::stringTo<int>(cf.getValue("endTime"));//10001.0;
+
+      //cout << "PID = " << myid << " Total Physical Memory (RAM): " << MemoryUtil::getTotalPhysMem()<<endl;
+      //cout << "PID = " << myid << " Physical Memory currently used: " << MemoryUtil::getPhysMemUsed()<<endl;
+      //cout << "PID = " << myid << " Physical Memory currently used by current process: " << MemoryUtil::getPhysMemUsedByMe()<<endl;
+
+      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, visSch));
+      if(myid == 0) UBLOG(logINFO,"Simulation-start");
+      calculation->calculate();
+      if(myid == 0) UBLOG(logINFO,"Simulation-end");
+   }
+   catch(std::exception& e)
+   {
+      cerr << e.what() << endl << flush;
+   }
+   catch(std::string& s)
+   {
+      cerr << s << endl;
+   }
+   catch(...)
+   {
+      cerr << "unknown exception" << endl;
+   }
+
+}
+
+int main(int argc, char* argv[])
+{
+
+   if ( argv != NULL )
+   {
+      if (argc > 1)
+      {
+         setup(argv[1], argv[2]);
+      }
+      else
+      {
+         cout << "Configuration file must be set!: " <<  argv[0] << " <config file>" << endl << std::flush;
+      }
+   }
+
+   return 0;
+} 
+
diff --git a/apps/cpu/aperm/CMakeLists.txt b/apps/cpu/aperm/CMakeLists.txt
index f2439bd5db69073faf1df2457c43717fb950f4c7..c6362507ee96c1f5712e2fce600e5f44a334e2ed 100644
--- a/apps/cpu/aperm/CMakeLists.txt
+++ b/apps/cpu/aperm/CMakeLists.txt
@@ -1,25 +1,25 @@
-CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
-
-########################################################
-## C++ PROJECT                                       ###
-########################################################
-PROJECT(aperm)
-
-INCLUDE(${APPS_ROOT}/IncludsList.cmake)  
-
-#################################################################
-###   LOCAL FILES                                             ###
-#################################################################
-FILE(GLOB SPECIFIC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.h
-                         ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
-                         ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp  )
- 
-SET(ALL_SOURCES ${ALL_SOURCES} ${SPECIFIC_FILES})
-SOURCE_GROUP(src FILES ${SPECIFIC_FILES})
-  
-SET(CAB_ADDITIONAL_LINK_LIBRARIES VirtualFluids)
-
-#################################################################
-###   CREATE PROJECT                                          ###
-#################################################################
-CREATE_CAB_PROJECT(aperm BINARY)
+CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
+
+########################################################
+## C++ PROJECT                                       ###
+########################################################
+PROJECT(aperm)
+
+INCLUDE(${APPS_ROOT}/IncludsList.cmake)  
+
+#################################################################
+###   LOCAL FILES                                             ###
+#################################################################
+FILE(GLOB SPECIFIC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.h
+                         ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
+                         ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp  )
+ 
+SET(ALL_SOURCES ${ALL_SOURCES} ${SPECIFIC_FILES})
+SOURCE_GROUP(src FILES ${SPECIFIC_FILES})
+  
+SET(CAB_ADDITIONAL_LINK_LIBRARIES VirtualFluids)
+
+#################################################################
+###   CREATE PROJECT                                          ###
+#################################################################
+CREATE_CAB_PROJECT(aperm BINARY)
diff --git a/apps/cpu/aperm/PA200-250-50_800MPI.cfg b/apps/cpu/aperm/PA200-250-50_800MPI.cfg
index 71251b1dde2d1ca1412a4362a22e577a6b3b20f2..9fc6561972b903fbda884e8341c60e8801e1c8c7 100644
--- a/apps/cpu/aperm/PA200-250-50_800MPI.cfg
+++ b/apps/cpu/aperm/PA200-250-50_800MPI.cfg
@@ -1,53 +1,53 @@
-pathname = /hpc3lustre/work/koskuche/SFB880/Permeability/anisotropic/PA200-250-50_800MPI
-pathGeo = /hpc3lustre/work/koskuche/SFB880/Materials/anisotropic
-
-numOfThreads = 1
-availMem = 11e9
-logToFile = true
-
-#porous media
-rawFile = true
-sampleFilename = /PA_200-250-50%_gewalzt_1575x1616x1643_32922.raw
-
-#diminsions [voxel]
-pmNX1 = 1575 
-pmNX2 = 1616 
-pmNX3 = 1643
-
-#threshold
-lthreshold = 32922
-uthreshold = 65535
-
-#diminsions [m]
-pmL1 = 15.75e-3
-pmL2 = 16.16e-3
-pmL3 = 16.43e-3
-
-#grid
-blocknx = 32
-nx3 = 10
-deltax = 20e-6
-spongeLayer=false
-
-#physic
-newPressure = false
-dp_LB = 1e-7
-newViscosity = false
-nu_LB = 0.0005
-
-timeSeriesFile = /timeseries/1
-timeSeriesOutTime = 1000
-
-gridPrepare = true
-numOfParts = 800
-
-restartStep = 50000
-restartStepStart=50000
-flowInit = true
-
-endTime = 800000
-outTime = 50000
-
-nupsStep = 1000 1000 10000000
-
-
+pathname = /hpc3lustre/work/koskuche/SFB880/Permeability/anisotropic/PA200-250-50_800MPI
+pathGeo = /hpc3lustre/work/koskuche/SFB880/Materials/anisotropic
+
+numOfThreads = 1
+availMem = 11e9
+logToFile = true
+
+#porous media
+rawFile = true
+sampleFilename = /PA_200-250-50%_gewalzt_1575x1616x1643_32922.raw
+
+#diminsions [voxel]
+pmNX1 = 1575 
+pmNX2 = 1616 
+pmNX3 = 1643
+
+#threshold
+lthreshold = 32922
+uthreshold = 65535
+
+#diminsions [m]
+pmL1 = 15.75e-3
+pmL2 = 16.16e-3
+pmL3 = 16.43e-3
+
+#grid
+blocknx = 32
+nx3 = 10
+deltax = 20e-6
+spongeLayer=false
+
+#physic
+newPressure = false
+dp_LB = 1e-7
+newViscosity = false
+nu_LB = 0.0005
+
+timeSeriesFile = /timeseries/1
+timeSeriesOutTime = 1000
+
+gridPrepare = true
+numOfParts = 800
+
+restartStep = 50000
+restartStepStart=50000
+flowInit = true
+
+endTime = 800000
+outTime = 50000
+
+nupsStep = 1000 1000 10000000
+
+
diff --git a/apps/cpu/aperm/PA80-110+120-150_MPI.cfg b/apps/cpu/aperm/PA80-110+120-150_MPI.cfg
index 9d836a0a4aa44b3fa652f1ca70e930da963fc099..6ba92ac1503650cdc40f56494927791a8a6c51c5 100644
--- a/apps/cpu/aperm/PA80-110+120-150_MPI.cfg
+++ b/apps/cpu/aperm/PA80-110+120-150_MPI.cfg
@@ -1,50 +1,50 @@
-pathname = /hpc3lustre/work/koskuche/SFB880/Permeability/anisotropic/PA80-110+120-150_MPI
-pathGeo = /hpc3lustre/work/koskuche/SFB880/Materials/anisotropic
-
-numOfThreads = 1
-availMem = 11e9
-logToFile = true
-
-#porous media
-rawFile = false
-#sampleFilename = /PA_80-110+120-150_1824x1735x1603_8656.raw
-sampleFilename = /vtk/PA80-110+120-150_1600x1600x1600_8656.vti
-
-#diminsions [voxel]
-pmNX1 = 1600 
-pmNX2 = 1600 
-pmNX3 = 1600
-
-#threshold
-lthreshold = 8656
-uthreshold = 30294
-
-#diminsions [m]
-pmL1 = 16e-3
-pmL2 = 16e-3
-pmL3 = 16e-3
-
-
-#grid
-blocknx = 32
-nx3 = 10
-deltax = 16e-6
-spongeLayer=false
-
-#physic
-dp_LB = 1e-6
-nu_LB = 0.0005
-
-timeSeriesFile = /timeseries/1
-timeSeriesOutTime = 1000
-
-restartStep = 50000
-restartStepStart=50000
-
-endTime = 800000
-outTime = 50000
-
-nupsStep = 1000 1000 10000000
-
-gridPrepare = false
-numOfParts = 800
+pathname = /hpc3lustre/work/koskuche/SFB880/Permeability/anisotropic/PA80-110+120-150_MPI
+pathGeo = /hpc3lustre/work/koskuche/SFB880/Materials/anisotropic
+
+numOfThreads = 1
+availMem = 11e9
+logToFile = true
+
+#porous media
+rawFile = false
+#sampleFilename = /PA_80-110+120-150_1824x1735x1603_8656.raw
+sampleFilename = /vtk/PA80-110+120-150_1600x1600x1600_8656.vti
+
+#diminsions [voxel]
+pmNX1 = 1600 
+pmNX2 = 1600 
+pmNX3 = 1600
+
+#threshold
+lthreshold = 8656
+uthreshold = 30294
+
+#diminsions [m]
+pmL1 = 16e-3
+pmL2 = 16e-3
+pmL3 = 16e-3
+
+
+#grid
+blocknx = 32
+nx3 = 10
+deltax = 16e-6
+spongeLayer=false
+
+#physic
+dp_LB = 1e-6
+nu_LB = 0.0005
+
+timeSeriesFile = /timeseries/1
+timeSeriesOutTime = 1000
+
+restartStep = 50000
+restartStepStart=50000
+
+endTime = 800000
+outTime = 50000
+
+nupsStep = 1000 1000 10000000
+
+gridPrepare = false
+numOfParts = 800
diff --git a/apps/cpu/aperm/PA80-110+120-150_dx80.cfg b/apps/cpu/aperm/PA80-110+120-150_dx80.cfg
index 6ef5c889469da3fa839a1cb385ae857235f26ed7..8e0237077b725ff4adb9ed8e3d4bfeb4352ea697 100644
--- a/apps/cpu/aperm/PA80-110+120-150_dx80.cfg
+++ b/apps/cpu/aperm/PA80-110+120-150_dx80.cfg
@@ -1,63 +1,63 @@
-pathname = d:/temp/apermPA80-110+120-150
-pathGeo = f:/
-
-numOfThreads = 4
-availMem = 11e9
-logToFile = flse
-
-#porous media
-rawFile = false
-sampleFilename = /PA80-110+120-150_1600x1600x1600_8656.vti
-
-#diminsions [voxel]
-pmNX1 = 1600 
-pmNX2 = 1600 
-pmNX3 = 1600
-
-#threshold
-lthreshold = 8656
-uthreshold = 30294
-
-#diminsions [m]
-pmL1 = 16e-3
-pmL2 = 16e-3
-pmL3 = 16e-3
-
-pmDeltas = true
-
-#deltas [m]
-pmDeltaX1 = 0.01e-3
-pmDeltaX2 = 0.01e-3
-pmDeltaX3 = 0.01e-3
-
-yDir = false
-zDir = false
-
-#grid
-blocknx = 32
-nx3 = 10
-deltax = 80e-6
-spongeLayer=false
-
-#physic
-newPressure = false
-dp_LB = 1e-6
-
-newViscosity = false
-nu_LB = 0.0005
-
-vx1=0
-vx2=0
-vx3=0
-
-timeSeriesFile = /timeseries/1
-timeSeriesOutTime = 1000
-
-restartStep = 50000
-restartStepStart=50000
-
-endTime = 800000
-outTime = 50000
-
-nupsStep = 1000 1000 10000000
-
+pathname = d:/temp/apermPA80-110+120-150
+pathGeo = f:/
+
+numOfThreads = 4
+availMem = 11e9
+logToFile = flse
+
+#porous media
+rawFile = false
+sampleFilename = /PA80-110+120-150_1600x1600x1600_8656.vti
+
+#diminsions [voxel]
+pmNX1 = 1600 
+pmNX2 = 1600 
+pmNX3 = 1600
+
+#threshold
+lthreshold = 8656
+uthreshold = 30294
+
+#diminsions [m]
+pmL1 = 16e-3
+pmL2 = 16e-3
+pmL3 = 16e-3
+
+pmDeltas = true
+
+#deltas [m]
+pmDeltaX1 = 0.01e-3
+pmDeltaX2 = 0.01e-3
+pmDeltaX3 = 0.01e-3
+
+yDir = false
+zDir = false
+
+#grid
+blocknx = 32
+nx3 = 10
+deltax = 80e-6
+spongeLayer=false
+
+#physic
+newPressure = false
+dp_LB = 1e-6
+
+newViscosity = false
+nu_LB = 0.0005
+
+vx1=0
+vx2=0
+vx3=0
+
+timeSeriesFile = /timeseries/1
+timeSeriesOutTime = 1000
+
+restartStep = 50000
+restartStepStart=50000
+
+endTime = 800000
+outTime = 50000
+
+nupsStep = 1000 1000 10000000
+
diff --git a/apps/cpu/aperm/aperm.cpp b/apps/cpu/aperm/aperm.cpp
index 1cc306822b6471e7bfef56a3486e0a77b4a8b6af..8745b732b04cd449c52ef23d9e8176a780a1ebbb 100644
--- a/apps/cpu/aperm/aperm.cpp
+++ b/apps/cpu/aperm/aperm.cpp
@@ -1,574 +1,574 @@
-#include <iostream>
-#include <string>
-#include <VirtualFluids.h>
-
-using namespace std;
-
-void changeDP()
-{
-}
-//////////////////////////////////////////////////////////////////////////
-void run(string configname)
-{
-   try
-   {
-      ConfigurationFile   config;
-      config.load(configname);
-
-      string          pathname = config.getString("pathname");
-      string          pathGeo = config.getString("pathGeo");
-      int             numOfThreads = config.getInt("numOfThreads");
-      string          sampleFilename = config.getString("sampleFilename");
-      int             pmNX1 = config.getInt("pmNX1");
-      int             pmNX2 = config.getInt("pmNX2");
-      int             pmNX3 = config.getInt("pmNX3");
-      double          lthreshold = config.getDouble("lthreshold");
-      double          uthreshold = config.getDouble("uthreshold");
-      double          pmL1 = config.getDouble("pmL1");
-      double          pmL2 = config.getDouble("pmL2");
-      double          pmL3 = config.getDouble("pmL3");
-      int             blocknx = config.getInt("blocknx");
-      //double          nx3 = config.getDouble("nx3");
-      double          dpLB = config.getDouble("dp_LB");
-      double          nu_LB = config.getDouble("nu_LB");
-      string          timeSeriesFile = config.getString("timeSeriesFile");
-      double          restartStep = config.getDouble("restartStep");
-      //double          restartStepStart = config.getDouble("restartStepStart");
-      double          endTime = config.getDouble("endTime");
-      double          outTimeStep = config.getValue<double>("outTimeStep");
-      double          outTimeStart = config.getValue<double>("outTimeStart");
-      double          availMem = config.getDouble("availMem");
-      bool            rawFile = config.getBool("rawFile");
-      double          timeSeriesOutTime = config.getDouble("timeSeriesOutTime");
-      bool            logToFile = config.getBool("logToFile");
-      bool            spongeLayer = config.getBool("spongeLayer");
-      vector<double>  nupsStep = config.getVector<double>("nupsStep");
-      double          deltax = config.getDouble("deltax");
-      bool            newViscosity = config.getBool("newViscosity");
-      bool            newPressure = config.getBool("newPressure");
-      bool            pmDeltas = config.getBool("pmDeltas");
-      double          pmDeltaX1 = config.getDouble("pmDeltaX1");
-      double          pmDeltaX2 = config.getDouble("pmDeltaX2");
-      double          pmDeltaX3 = config.getDouble("pmDeltaX3");
-      double          vx1 = config.getDouble("vx1");
-      double          vx2 = config.getDouble("vx2");
-      double          vx3 = config.getDouble("vx3");
-      bool            yDir = config.getBool("yDir");
-      bool            zDir = config.getBool("zDir");
-      double          cpStep = config.getDouble("cpStep");
-      double          cpStepStart = config.getDouble("cpStepStart");
-      bool            newStart = config.getValue<bool>("newStart");
-
-      SPtr<Communicator> comm = MPICommunicator::getInstance();
-      int myid = comm->getProcessID();
-
-      if (logToFile)
-      {
-#if defined(__unix__)
-         if (myid==0)
-         {
-            const char* str = pathname.c_str();
-            int status = mkdir(str, S_IRWXU|S_IRWXG|S_IROTH|S_IXOTH);
-         }
-#endif 
-
-         if (myid==0)
-         {
-            stringstream logFilename;
-            logFilename<<pathname+"/logfile"+UbSystem::toString(UbSystem::getTimeStamp())+".txt";
-            UbLog::output_policy::setStream(logFilename.str());
-         }
-      }
-
-      //Sleep(30000);
-
-      if (myid==0) UBLOG(logINFO, "Testcase permeability");
-
-      string machinename = UbSystem::getMachineName();
-      //UBLOG(logINFO, "PID = " << myid << " Hostname: " << machinename);
-      //UBLOG(logINFO, "PID = " << myid << " Total Physical Memory (RAM): " << Utilities::getTotalPhysMem());
-      //UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used: " << Utilities::getPhysMemUsed());
-      //UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe());
-
-      int blocknx1 = blocknx;
-      int blocknx2 = blocknx;
-      int blocknx3 = blocknx;
-
-      LBMReal rhoLB = 0.0;
-      double rhoLBinflow = dpLB*3.0;
-
-      SPtr<LBMUnitConverter> conv = SPtr<LBMUnitConverter>(new LBMUnitConverter());
-
-      const int baseLevel = 0;
-
-      double coord[6];
-      //double deltax;
-
-      SPtr<Grid3D> grid(new Grid3D(comm));
-
-      //////////////////////////////////////////////////////////////////////////
-      //restart
-      //SPtr<UbScheduler> rSch(new UbScheduler(cpStep, cpStepStart));
-      //RestartCoProcessor rp(grid, rSch, comm, pathname, RestartCoProcessor::TXT);
-      
-      SPtr<UbScheduler> rSch2(new UbScheduler(cpStep, cpStepStart));
-      MPIIORestart11CoProcessor rcp(grid, rSch2, pathname, comm);
-
-      SPtr<LBMKernel> kernel;
-      kernel = SPtr<LBMKernel>(new IncompressibleCumulantLBMKernel(blocknx1, blocknx2, blocknx3, IncompressibleCumulantLBMKernel::NORMAL));
-
-      //SPtr<BCProcessor> bcProc(new BCProcessor());
-      SPtr<BCProcessor> bcProc = SPtr<BCProcessor>(new ThinWallBCProcessor());
-      kernel->setBCProcessor(bcProc);
-
-      rcp.setLBMKernel(kernel);
-      rcp.setBCProcessor(bcProc);
-      rcp.setChunk(1);
-      //////////////////////////////////////////////////////////////////////////
-
-      //BC Adapter
-      //////////////////////////////////////////////////////////////////////////////
-      SPtr<BCAdapter> noSlipBCAdapter(new NoSlipBCAdapter());
-      noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new ThinWallNoSlipBCAlgorithm()));
-      //noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NoSlipBCAlgorithm()));
-
-      SPtr<BCAdapter> denBCAdapterInflow(new DensityBCAdapter(rhoLBinflow));
-      denBCAdapterInflow->setBcAlgorithm(SPtr<BCAlgorithm>(new NonEqDensityBCAlgorithm()));
-
-      SPtr<BCAdapter> denBCAdapterOutflow(new DensityBCAdapter(rhoLB));
-      denBCAdapterOutflow->setBcAlgorithm(SPtr<BCAlgorithm>(new NonEqDensityBCAlgorithm()));
-      //////////////////////////////////////////////////////////////////////////////////
-      //BS visitor
-      BoundaryConditionsBlockVisitor bcVisitor;
-      bcVisitor.addBC(noSlipBCAdapter);
-      bcVisitor.addBC(denBCAdapterInflow);
-      bcVisitor.addBC(denBCAdapterOutflow);
-
-      if (newStart)
-      {
-         if (myid==0) UBLOG(logINFO, "new start..");
-         if (myid==0) UBLOG(logINFO, "preprocess start..");
-
-         //UBLOG(logINFO, "new start PID = " << myid << " Hostname: " << machinename);
-         //UBLOG(logINFO, "new start PID = " << myid << " Total Physical Memory (RAM): " << Utilities::getTotalPhysMem());
-         //UBLOG(logINFO, "new start PID = " << myid << " Physical Memory currently used: " << Utilities::getPhysMemUsed());
-         //UBLOG(logINFO, "new start PID = " << myid << " Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe());
-
-         string samplePathname = pathGeo+sampleFilename;
-
-         double deltaVoxelX1 = pmL1/(double)pmNX1;
-         double deltaVoxelX2 = pmL2/(double)pmNX2;
-         double deltaVoxelX3 = pmL3/(double)pmNX3;
-
-         if (pmDeltas)
-         {
-            deltaVoxelX1 = pmDeltaX1;
-            deltaVoxelX2 = pmDeltaX2;
-            deltaVoxelX3 = pmDeltaX3;
-         }
-
-         if (myid==0) UBLOG(logINFO, "read voxel matrix: start");
-         GbVoxelMatrix3DPtr sample(new GbVoxelMatrix3D(pmNX1, pmNX2, pmNX3, 0, lthreshold, uthreshold));
-         if (rawFile)
-         {
-            sample->readMatrixFromRawFile<unsigned short>(samplePathname, GbVoxelMatrix3D::BigEndian);
-         }
-         else
-         {
-            sample->readMatrixFromVtiASCIIFile(samplePathname);
-         }
-
-         sample->setVoxelMatrixDelta((float)deltaVoxelX1, (float)deltaVoxelX2, (float)deltaVoxelX3);
-         sample->setVoxelMatrixMininum(0.0, 0.0, 0.0);
-         if (myid==0) UBLOG(logINFO, "read voxel matrix: end");
-
-
-         if (myid==0) UBLOG(logINFO, "rotate voxel matrix: start");
-         if (yDir)
-         {
-            sample->rotate90aroundZ();
-            //sample->rotate90aroundZ();
-            //sample->rotate90aroundZ();
-         }
-         if (zDir)
-         {
-            sample->rotate90aroundY();
-         }
-         if (myid==0) UBLOG(logINFO, "rotate voxel matrix: end");
-
-         if (myid==0) sample->writeToVTKImageDataASCII(pathname+"/geo/sample");
-        
-         ///////////////////////////////////////////////////////
-
-         ////////////////////////////////////////////////////////////////////////
-
-         double offset1 = sample->getLengthX1()/10.0;
-         double offset2 = 2.0*offset1;
-         //double offset2 = offset1;
-         //bounding box
-         double g_minX1 = sample->getX1Minimum()-offset1;
-         double g_minX2 = sample->getX2Minimum();
-         double g_minX3 = sample->getX3Minimum();
-
-         double g_maxX1 = sample->getX1Maximum()+offset2;
-         double g_maxX2 = sample->getX2Maximum();
-         double g_maxX3 = sample->getX3Maximum();
-
-         ////////////////////////////////////////////////////////////////////////////
-         //double nx1_temp = floor((g_maxX1-g_minX1)/(deltax*(double)blocknx));
-
-         //deltax = (g_maxX1-g_minX1)/(nx1_temp*(double)blocknx);
-
-         // g_maxX3 -= 0.5* deltax;
-          ////////////////////////////////////////////////////////////////////////////
-
-          ////deltax = (g_maxX3-g_minX3) /(nx3*blocknx3);
-
-         double blockLength = (double)blocknx1*deltax;
-
-         grid->setPeriodicX1(false);
-         grid->setPeriodicX2(false);
-         grid->setPeriodicX3(false);
-         grid->setDeltaX(deltax);
-         grid->setBlockNX(blocknx1, blocknx2, blocknx3);
-
-         SPtr<GbObject3D> gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
-         if (myid==0) GbSystem3D::writeGeoObject(gridCube.get(), pathname+"/geo/gridCube", WbWriterVtkXmlBinary::getInstance());
-
-         GenBlocksGridVisitor genBlocks(gridCube);
-         grid->accept(genBlocks);
-
-         if (myid==0)
-         {
-            UBLOG(logINFO, "Parameters:");
-            UBLOG(logINFO, "rho_LB = "<<rhoLB);
-            UBLOG(logINFO, "nu_LB = "<<nu_LB);
-            UBLOG(logINFO, "dp_LB = "<<dpLB);
-            UBLOG(logINFO, "dx = "<<deltax<<" m");
-            UBLOG(logINFO, "numOfThreads = "<<numOfThreads);
-            UBLOG(logINFO, "path = "<<pathname);
-            UBLOG(logINFO, "Preprozess - start");
-         }
-
-         //walls
-         GbCuboid3DPtr addWallYmin(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_minX2, g_maxX3+blockLength));
-         if (myid==0) GbSystem3D::writeGeoObject(addWallYmin.get(), pathname+"/geo/addWallYmin", WbWriterVtkXmlASCII::getInstance());
-
-         GbCuboid3DPtr addWallZmin(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_minX3));
-         if (myid==0) GbSystem3D::writeGeoObject(addWallZmin.get(), pathname+"/geo/addWallZmin", WbWriterVtkXmlASCII::getInstance());
-
-         GbCuboid3DPtr addWallYmax(new GbCuboid3D(g_minX1-blockLength, g_maxX2, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength));
-         if (myid==0) GbSystem3D::writeGeoObject(addWallYmax.get(), pathname+"/geo/addWallYmax", WbWriterVtkXmlASCII::getInstance());
-
-         GbCuboid3DPtr addWallZmax(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_maxX3, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength));
-         if (myid==0) GbSystem3D::writeGeoObject(addWallZmax.get(), pathname+"/geo/addWallZmax", WbWriterVtkXmlASCII::getInstance());
-
-
-         //inflow
-         GbCuboid3DPtr geoInflow(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3-blockLength, g_minX1, g_maxX2+blockLength, g_maxX3+blockLength));
-         if (myid==0) GbSystem3D::writeGeoObject(geoInflow.get(), pathname+"/geo/geoInflow", WbWriterVtkXmlASCII::getInstance());
-
-         //outflow
-         GbCuboid3DPtr geoOutflow(new GbCuboid3D(g_maxX1, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength));
-         if (myid==0) GbSystem3D::writeGeoObject(geoOutflow.get(), pathname+"/geo/geoOutflow", WbWriterVtkXmlASCII::getInstance());
-
-         WriteBlocksSPtr<CoProcessor> ppblocks(new WriteBlocksCoProcessor(grid, SPtr<UbScheduler>(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm));
-
-         
-         //PM interactor
-         SPtr<D3Q27Interactor> sampleInt(new D3Q27Interactor(sample, grid, noSlipBCAdapter, Interactor3D::SOLID));
-
-         //wall interactors
-         SPtr<D3Q27Interactor> addWallYminInt(new D3Q27Interactor(addWallYmin, grid, noSlipBCAdapter, Interactor3D::SOLID));
-         SPtr<D3Q27Interactor> addWallZminInt(new D3Q27Interactor(addWallZmin, grid, noSlipBCAdapter, Interactor3D::SOLID));
-         SPtr<D3Q27Interactor> addWallYmaxInt(new D3Q27Interactor(addWallYmax, grid, noSlipBCAdapter, Interactor3D::SOLID));
-         SPtr<D3Q27Interactor> addWallZmaxInt(new D3Q27Interactor(addWallZmax, grid, noSlipBCAdapter, Interactor3D::SOLID));
-
-
-         SPtr<D3Q27Interactor> inflowInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoInflow, grid, denBCAdapterInflow, Interactor3D::SOLID));
-
-         //outflow
-         SPtr<D3Q27Interactor> outflowInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoOutflow, grid, denBCAdapterOutflow, Interactor3D::SOLID));
-
-
-         //UBLOG(logINFO, "PID = "<<myid<<" Hostname: "<<machinename);
-         //UBLOG(logINFO, "PID = "<<myid<<" Total Physical Memory (RAM): "<<Utilities::getTotalPhysMem());
-         //UBLOG(logINFO, "PID = "<<myid<<" Physical Memory currently used: "<<Utilities::getPhysMemUsed());
-         //UBLOG(logINFO, "PID = "<<myid<<" Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe());
-
-
-         ////////////////////////////////////////////
-         //METIS
-         SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::BSW, MetisPartitioner::RECURSIVE));
-         ////////////////////////////////////////////
-         //Zoltan
-         //SPtr<Grid3DVisitor> zoltanVisitor(new ZoltanPartitioningGridVisitor(comm, D3Q27System::BSW, 1));
-         //grid->accept(zoltanVisitor);
-
-         /////delete solid blocks
-         if (myid==0) UBLOG(logINFO, "deleteSolidBlocks - start");
-         InteractorsHelper intHelper(grid, metisVisitor);
-         intHelper.addInteractor(addWallYminInt);
-         intHelper.addInteractor(addWallZminInt);
-         intHelper.addInteractor(addWallYmaxInt);
-         intHelper.addInteractor(addWallZmaxInt);
-         intHelper.addInteractor(inflowInt);
-         intHelper.addInteractor(outflowInt);
-         intHelper.addInteractor(sampleInt);
-         intHelper.selectBlocks();
-         if (myid==0) UBLOG(logINFO, "deleteSolidBlocks - end");
-         //////////////////////////////////////
-
-         //set connectors
-         InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor());
-         SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nu_LB, iProcessor);
-         grid->accept(setConnsVisitor);
-
-         //domain decomposition for threads
-         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
-         grid->accept(pqPartVisitor);
-
-         ppblocks->process(0);
-         ppblocks.reset();
-
-
-         unsigned long nob = grid->getNumberOfBlocks();
-         int gl = 3;
-         unsigned long nodb = (blocknx1)* (blocknx2)* (blocknx3);
-         unsigned long nod = nob * (blocknx1)* (blocknx2)* (blocknx3);
-         unsigned long nodg = nob * (blocknx1+gl) * (blocknx2+gl) * (blocknx3+gl);
-         double needMemAll = double(nodg*(27*sizeof(double)+sizeof(int)+sizeof(float)*4));
-         double needMem = needMemAll/double(comm->getNumberOfProcesses());
-
-         if (myid==0)
-         {
-            UBLOG(logINFO, "Number of blocks = "<<nob);
-            UBLOG(logINFO, "Number of nodes  = "<<nod);
-            int minInitLevel = grid->getCoarsestInitializedLevel();
-            int maxInitLevel = grid->getFinestInitializedLevel();
-            for (int level = minInitLevel; level<=maxInitLevel; level++)
-            {
-               int nobl = grid->getNumberOfBlocks(level);
-               UBLOG(logINFO, "Number of blocks for level "<<level<<" = "<<nobl);
-               UBLOG(logINFO, "Number of nodes for level "<<level<<" = "<<nobl*nodb);
-            }
-            UBLOG(logINFO, "Necessary memory  = "<<needMemAll<<" bytes");
-            UBLOG(logINFO, "Necessary memory per process = "<<needMem<<" bytes");
-            UBLOG(logINFO, "Available memory per process = "<<availMem<<" bytes");
-         }
-
-         //SPtr<LBMKernel> kernel;
-         //kernel = SPtr<LBMKernel>(new IncompressibleCumulantLBMKernel(blocknx1, blocknx2, blocknx3, IncompressibleCumulantLBMKernel::NORMAL));
-
-         ////SPtr<BCProcessor> bcProc(new BCProcessor());
-         //SPtr<BCProcessor> bcProc = SPtr<BCProcessor>(new ThinWallBCProcessor());
-         kernel->setBCProcessor(bcProc);
-
-         SetKernelBlockVisitor kernelVisitor(kernel, nu_LB, availMem, needMem);
-         grid->accept(kernelVisitor);
-
-         //BC
-         intHelper.setBC();
-
-         //BS visitor
-         grid->accept(bcVisitor);
-
-         //Press*1.6e8+(14.76-coordsX)/3.5*5000
-         //initialization of distributions
-         mu::Parser fct;
-         fct.SetExpr("(x1max-x1)/l*dp*3.0");
-         fct.DefineConst("dp", dpLB);
-         fct.DefineConst("x1max", g_maxX1);
-         fct.DefineConst("l", g_maxX1-g_minX1);
-
-         InitDistributionsBlockVisitor initVisitor(nu_LB, rhoLB);
-         initVisitor.setRho(fct);
-         grid->accept(initVisitor);
-
-         //Postrozess
-         SPtr<UbScheduler> geoSch(new UbScheduler(1));
-         WriteBoundaryConditionsSPtr<CoProcessor> ppgeo(
-            new WriteBoundaryConditionsCoProcessor(grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, comm));
-         ppgeo->process(0);
-         ppgeo.reset();
-
-         coord[0] = sample->getX1Minimum();
-         coord[1] = sample->getX2Minimum();
-         coord[2] = sample->getX3Minimum();
-         coord[3] = sample->getX1Maximum();
-         coord[4] = sample->getX2Maximum();
-         coord[5] = sample->getX3Maximum();
-
-         ////////////////////////////////////////////////////////
-         UbFileOutputASCII outf(pathname+"/checkpoints/coord.txt");
-         outf.writeDouble(deltax);
-         outf.writeDouble(coord[0]);
-         outf.writeDouble(coord[1]);
-         outf.writeDouble(coord[2]);
-         outf.writeDouble(coord[3]);
-         outf.writeDouble(coord[4]);
-         outf.writeDouble(coord[5]);
-         outf.writeDouble(g_minX1);
-         outf.writeDouble(g_maxX1);
-         outf.writeDouble(availMem);
-         outf.writeDouble(needMem);
-         ////////////////////////////////////////////////////////
-
-         grid->addInteractor(inflowInt);
-
-         if (myid==0) UBLOG(logINFO, "Preprozess - end");
-      }
-      else
-      {
-         ////////////////////////////////////////////////////////
-         UbFileInputASCII inf(pathname+"/checkpoints/coord.txt");
-         deltax = inf.readDouble();
-         coord[0] = inf.readDouble();
-         coord[1] = inf.readDouble();
-         coord[2] = inf.readDouble();
-         coord[3] = inf.readDouble();
-         coord[4] = inf.readDouble();
-         coord[5] = inf.readDouble();
-         double g_minX1 = inf.readDouble();
-         double g_maxX1 = inf.readDouble();
-         double availMem = inf.readDouble();
-         double needMem = inf.readDouble();
-         ////////////////////////////////////////////////////////
-         
-         rcp.restart((int)restartStep);
-         grid->setTimeStep(restartStep);
-
-         //new nu
-         if (newViscosity)
-         {
-            ViscosityBlockVisitor nuVisitor(nu_LB);
-            grid->accept(nuVisitor);
-         }
-
-         //new dp
-         if (newPressure)
-         {
-            Grid3D::Interactor3DSet interactors = grid->getInteractors();
-            interactors[0]->setGrid3D(grid);
-            dynamicPointerCast<D3Q27Interactor>(interactors[0])->deleteBCAdapter();
-            SPtr<BCAdapter> denBCAdapterFront(new DensityBCAdapter(rhoLBinflow));
-            denBCAdapterFront->setBcAlgorithm(SPtr<BCAlgorithm>(new EqDensityBCAlgorithm()));
-            dynamicPointerCast<D3Q27Interactor>(interactors[0])->addBCAdapter(denBCAdapterFront);
-            interactors[0]->updateInteractor();
-         }
-
-         if (myid==0)
-         {
-            UBLOG(logINFO, "Parameters:");
-            UBLOG(logINFO, "rho_LB = "<<rhoLB);
-            UBLOG(logINFO, "nu_LB = "<<nu_LB);
-            UBLOG(logINFO, "dp_LB = "<<dpLB);
-            UBLOG(logINFO, "dx = "<<deltax<<" m");
-         }
-
-         //set connectors
-         InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor());
-         SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nu_LB, iProcessor);
-         grid->accept(setConnsVisitor);
-
-         //domain decomposition for threads
-         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
-         grid->accept(pqPartVisitor);
-
-         //BS visitor
-         grid->accept(bcVisitor);
-
-         SPtr<UbScheduler> geoSch(new UbScheduler(1));
-         WriteBoundaryConditionsCoProcessor ppgeo = WriteBoundaryConditionsCoProcessor(grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, comm);
-         ppgeo.process(1);
-
-
-         if (myid==0) UBLOG(logINFO, "Restart - end");
-      }
-      SPtr<UbScheduler> nupsSch(new UbScheduler(nupsStep[0], nupsStep[1], nupsStep[2]));
-      //nupsSch->addSchedule(nupsStep[0], nupsStep[1], nupsStep[2]);
-      NUPSCounterCoProcessor npr(grid, nupsSch, numOfThreads, comm);
-
-      SPtr<UbScheduler> stepSch(new UbScheduler(outTimeStep,outTimeStart));
-
-      WriteMacroscopicQuantitiesCoProcessor pp(grid, stepSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, comm);
-
-      deltax = grid->getDeltaX(baseLevel);
-      double dxd2 = deltax/2.0;
-
-      SPtr<IntegrateValuesHelper> ih1(new IntegrateValuesHelper(grid, comm, coord[0]-dxd2*10.0, coord[1]-dxd2, coord[2]-dxd2,
-         coord[0]-dxd2*10.0-2.0*dxd2, coord[4]+dxd2, coord[5]+dxd2));
-
-      //D3Q27SPtr<IntegrateValuesHelper> ih2(new D3Q27IntegrateValuesHelper(grid, comm, coord[3]/2.0, coord[1] - dxd2, coord[2] - dxd2,
-      //   coord[3]/2.0 + 2.0*dxd2, coord[4] + dxd2, coord[5] + dxd2));
-      SPtr<IntegrateValuesHelper> ih2(new IntegrateValuesHelper(grid, comm, coord[0], coord[1], coord[2], coord[3], coord[4], coord[5]));
-
-      SPtr<IntegrateValuesHelper> ih3(new IntegrateValuesHelper(grid, comm, coord[3]+dxd2*10.0, coord[1]-dxd2, coord[2]-dxd2,
-         coord[3]+dxd2*10.0+2.0*dxd2, coord[4]+dxd2, coord[5]+dxd2));
-
-      //D3Q27SPtr<IntegrateValuesHelper> ih1(new D3Q27IntegrateValuesHelper(grid, comm, coord[0], coord[1], coord[2], coord[3], coord[4], coord[5]));
-      if (myid==0) GbSystem3D::writeGeoObject(ih1->getBoundingBox().get(), pathname+"/geo/ih1", WbWriterVtkXmlBinary::getInstance());
-      if (myid==0) GbSystem3D::writeGeoObject(ih2->getBoundingBox().get(), pathname+"/geo/ih2", WbWriterVtkXmlBinary::getInstance());
-      if (myid==0) GbSystem3D::writeGeoObject(ih3->getBoundingBox().get(), pathname+"/geo/ih3", WbWriterVtkXmlBinary::getInstance());
-
-      double factorp = 1; // dp_real / dp_LB;
-      double factorv = 1;// dx / dt;
-      SPtr<UbScheduler> stepMV(new UbScheduler(timeSeriesOutTime));
-
-      TimeseriesCoProcessor tsp1(grid, stepMV, ih1, pathname+timeSeriesFile+"_1", comm);
-      TimeseriesCoProcessor tsp2(grid, stepMV, ih2, pathname+timeSeriesFile+"_2", comm);
-      TimeseriesCoProcessor tsp3(grid, stepMV, ih3, pathname+timeSeriesFile+"_3", comm);
-
-      if (myid==0)
-      {
-         UBLOG(logINFO, "PID = "<<myid<<" Total Physical Memory (RAM): "<<Utilities::getTotalPhysMem());
-         UBLOG(logINFO, "PID = "<<myid<<" Physical Memory currently used: "<<Utilities::getPhysMemUsed());
-         UBLOG(logINFO, "PID = "<<myid<<" Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe());
-      }
-
-      const SPtr<ConcreteCalculatorFactory> calculatorFactory = std::make_shared<ConcreteCalculatorFactory>(stepSch);
-      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, calculatorFactory, CalculatorType::HYBRID));
-      if (myid==0) UBLOG(logINFO, "Simulation-start");
-      calculation->calculate();
-      if (myid==0) UBLOG(logINFO, "Simulation-end");
-      
-      //////MPIIORestart2CoProcessor 
-      //grid->deleteBlockIDs();
-      //RenumberBlockVisitor renumber;
-      //grid->accept(renumber);
-      //SPtr<UbScheduler> iiSch(new UbScheduler(1));
-      //MPIIORestart2CoProcessor rcpInit(grid, iiSch, pathname, comm);
-      //rcpInit.process(300);
-   }
-   catch (exception& e)
-   {
-      cerr<<e.what()<<endl<<flush;
-   }
-   catch (string& s)
-   {
-      cerr<<s<<endl;
-   }
-   catch (...)
-   {
-      cerr<<"unknown exception"<<endl;
-   }
-
-}
-//////////////////////////////////////////////////////////////////////////
-int main(int argc, char* argv[])
-{
-
-   if (argv!=NULL)
-   {
-      if (argv[1]!=NULL)
-      {
-         run(string(argv[1]));
-      }
-      else
-      {
-         cout<<"Configuration file is missing!"<<endl;
-      }
-   }
-
-   return 0;
-}
+#include <iostream>
+#include <string>
+#include <VirtualFluids.h>
+
+using namespace std;
+
+void changeDP()
+{
+}
+//////////////////////////////////////////////////////////////////////////
+void run(string configname)
+{
+   try
+   {
+      ConfigurationFile   config;
+      config.load(configname);
+
+      string          pathname = config.getString("pathname");
+      string          pathGeo = config.getString("pathGeo");
+      int             numOfThreads = config.getInt("numOfThreads");
+      string          sampleFilename = config.getString("sampleFilename");
+      int             pmNX1 = config.getInt("pmNX1");
+      int             pmNX2 = config.getInt("pmNX2");
+      int             pmNX3 = config.getInt("pmNX3");
+      double          lthreshold = config.getDouble("lthreshold");
+      double          uthreshold = config.getDouble("uthreshold");
+      double          pmL1 = config.getDouble("pmL1");
+      double          pmL2 = config.getDouble("pmL2");
+      double          pmL3 = config.getDouble("pmL3");
+      int             blocknx = config.getInt("blocknx");
+      //double          nx3 = config.getDouble("nx3");
+      double          dpLB = config.getDouble("dp_LB");
+      double          nu_LB = config.getDouble("nu_LB");
+      string          timeSeriesFile = config.getString("timeSeriesFile");
+      double          restartStep = config.getDouble("restartStep");
+      //double          restartStepStart = config.getDouble("restartStepStart");
+      double          endTime = config.getDouble("endTime");
+      double          outTimeStep = config.getValue<double>("outTimeStep");
+      double          outTimeStart = config.getValue<double>("outTimeStart");
+      double          availMem = config.getDouble("availMem");
+      bool            rawFile = config.getBool("rawFile");
+      double          timeSeriesOutTime = config.getDouble("timeSeriesOutTime");
+      bool            logToFile = config.getBool("logToFile");
+      bool            spongeLayer = config.getBool("spongeLayer");
+      vector<double>  nupsStep = config.getVector<double>("nupsStep");
+      double          deltax = config.getDouble("deltax");
+      bool            newViscosity = config.getBool("newViscosity");
+      bool            newPressure = config.getBool("newPressure");
+      bool            pmDeltas = config.getBool("pmDeltas");
+      double          pmDeltaX1 = config.getDouble("pmDeltaX1");
+      double          pmDeltaX2 = config.getDouble("pmDeltaX2");
+      double          pmDeltaX3 = config.getDouble("pmDeltaX3");
+      double          vx1 = config.getDouble("vx1");
+      double          vx2 = config.getDouble("vx2");
+      double          vx3 = config.getDouble("vx3");
+      bool            yDir = config.getBool("yDir");
+      bool            zDir = config.getBool("zDir");
+      double          cpStep = config.getDouble("cpStep");
+      double          cpStepStart = config.getDouble("cpStepStart");
+      bool            newStart = config.getValue<bool>("newStart");
+
+      SPtr<Communicator> comm = MPICommunicator::getInstance();
+      int myid = comm->getProcessID();
+
+      if (logToFile)
+      {
+#if defined(__unix__)
+         if (myid==0)
+         {
+            const char* str = pathname.c_str();
+            int status = mkdir(str, S_IRWXU|S_IRWXG|S_IROTH|S_IXOTH);
+         }
+#endif 
+
+         if (myid==0)
+         {
+            stringstream logFilename;
+            logFilename<<pathname+"/logfile"+UbSystem::toString(UbSystem::getTimeStamp())+".txt";
+            UbLog::output_policy::setStream(logFilename.str());
+         }
+      }
+
+      //Sleep(30000);
+
+      if (myid==0) UBLOG(logINFO, "Testcase permeability");
+
+      string machinename = UbSystem::getMachineName();
+      //UBLOG(logINFO, "PID = " << myid << " Hostname: " << machinename);
+      //UBLOG(logINFO, "PID = " << myid << " Total Physical Memory (RAM): " << Utilities::getTotalPhysMem());
+      //UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used: " << Utilities::getPhysMemUsed());
+      //UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe());
+
+      int blocknx1 = blocknx;
+      int blocknx2 = blocknx;
+      int blocknx3 = blocknx;
+
+      LBMReal rhoLB = 0.0;
+      double rhoLBinflow = dpLB*3.0;
+
+      SPtr<LBMUnitConverter> conv = SPtr<LBMUnitConverter>(new LBMUnitConverter());
+
+      const int baseLevel = 0;
+
+      double coord[6];
+      //double deltax;
+
+      SPtr<Grid3D> grid(new Grid3D(comm));
+
+      //////////////////////////////////////////////////////////////////////////
+      //restart
+      //SPtr<UbScheduler> rSch(new UbScheduler(cpStep, cpStepStart));
+      //RestartCoProcessor rp(grid, rSch, comm, pathname, RestartCoProcessor::TXT);
+      
+      SPtr<UbScheduler> rSch2(new UbScheduler(cpStep, cpStepStart));
+      MPIIORestart11CoProcessor rcp(grid, rSch2, pathname, comm);
+
+      SPtr<LBMKernel> kernel;
+      kernel = SPtr<LBMKernel>(new IncompressibleCumulantLBMKernel(blocknx1, blocknx2, blocknx3, IncompressibleCumulantLBMKernel::NORMAL));
+
+      //SPtr<BCProcessor> bcProc(new BCProcessor());
+      SPtr<BCProcessor> bcProc = SPtr<BCProcessor>(new ThinWallBCProcessor());
+      kernel->setBCProcessor(bcProc);
+
+      rcp.setLBMKernel(kernel);
+      rcp.setBCProcessor(bcProc);
+      rcp.setChunk(1);
+      //////////////////////////////////////////////////////////////////////////
+
+      //BC Adapter
+      //////////////////////////////////////////////////////////////////////////////
+      SPtr<BCAdapter> noSlipBCAdapter(new NoSlipBCAdapter());
+      noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new ThinWallNoSlipBCAlgorithm()));
+      //noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NoSlipBCAlgorithm()));
+
+      SPtr<BCAdapter> denBCAdapterInflow(new DensityBCAdapter(rhoLBinflow));
+      denBCAdapterInflow->setBcAlgorithm(SPtr<BCAlgorithm>(new NonEqDensityBCAlgorithm()));
+
+      SPtr<BCAdapter> denBCAdapterOutflow(new DensityBCAdapter(rhoLB));
+      denBCAdapterOutflow->setBcAlgorithm(SPtr<BCAlgorithm>(new NonEqDensityBCAlgorithm()));
+      //////////////////////////////////////////////////////////////////////////////////
+      //BS visitor
+      BoundaryConditionsBlockVisitor bcVisitor;
+      bcVisitor.addBC(noSlipBCAdapter);
+      bcVisitor.addBC(denBCAdapterInflow);
+      bcVisitor.addBC(denBCAdapterOutflow);
+
+      if (newStart)
+      {
+         if (myid==0) UBLOG(logINFO, "new start..");
+         if (myid==0) UBLOG(logINFO, "preprocess start..");
+
+         //UBLOG(logINFO, "new start PID = " << myid << " Hostname: " << machinename);
+         //UBLOG(logINFO, "new start PID = " << myid << " Total Physical Memory (RAM): " << Utilities::getTotalPhysMem());
+         //UBLOG(logINFO, "new start PID = " << myid << " Physical Memory currently used: " << Utilities::getPhysMemUsed());
+         //UBLOG(logINFO, "new start PID = " << myid << " Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe());
+
+         string samplePathname = pathGeo+sampleFilename;
+
+         double deltaVoxelX1 = pmL1/(double)pmNX1;
+         double deltaVoxelX2 = pmL2/(double)pmNX2;
+         double deltaVoxelX3 = pmL3/(double)pmNX3;
+
+         if (pmDeltas)
+         {
+            deltaVoxelX1 = pmDeltaX1;
+            deltaVoxelX2 = pmDeltaX2;
+            deltaVoxelX3 = pmDeltaX3;
+         }
+
+         if (myid==0) UBLOG(logINFO, "read voxel matrix: start");
+         GbVoxelMatrix3DPtr sample(new GbVoxelMatrix3D(pmNX1, pmNX2, pmNX3, 0, lthreshold, uthreshold));
+         if (rawFile)
+         {
+            sample->readMatrixFromRawFile<unsigned short>(samplePathname, GbVoxelMatrix3D::BigEndian);
+         }
+         else
+         {
+            sample->readMatrixFromVtiASCIIFile(samplePathname);
+         }
+
+         sample->setVoxelMatrixDelta((float)deltaVoxelX1, (float)deltaVoxelX2, (float)deltaVoxelX3);
+         sample->setVoxelMatrixMininum(0.0, 0.0, 0.0);
+         if (myid==0) UBLOG(logINFO, "read voxel matrix: end");
+
+
+         if (myid==0) UBLOG(logINFO, "rotate voxel matrix: start");
+         if (yDir)
+         {
+            sample->rotate90aroundZ();
+            //sample->rotate90aroundZ();
+            //sample->rotate90aroundZ();
+         }
+         if (zDir)
+         {
+            sample->rotate90aroundY();
+         }
+         if (myid==0) UBLOG(logINFO, "rotate voxel matrix: end");
+
+         if (myid==0) sample->writeToVTKImageDataASCII(pathname+"/geo/sample");
+        
+         ///////////////////////////////////////////////////////
+
+         ////////////////////////////////////////////////////////////////////////
+
+         double offset1 = sample->getLengthX1()/10.0;
+         double offset2 = 2.0*offset1;
+         //double offset2 = offset1;
+         //bounding box
+         double g_minX1 = sample->getX1Minimum()-offset1;
+         double g_minX2 = sample->getX2Minimum();
+         double g_minX3 = sample->getX3Minimum();
+
+         double g_maxX1 = sample->getX1Maximum()+offset2;
+         double g_maxX2 = sample->getX2Maximum();
+         double g_maxX3 = sample->getX3Maximum();
+
+         ////////////////////////////////////////////////////////////////////////////
+         //double nx1_temp = floor((g_maxX1-g_minX1)/(deltax*(double)blocknx));
+
+         //deltax = (g_maxX1-g_minX1)/(nx1_temp*(double)blocknx);
+
+         // g_maxX3 -= 0.5* deltax;
+          ////////////////////////////////////////////////////////////////////////////
+
+          ////deltax = (g_maxX3-g_minX3) /(nx3*blocknx3);
+
+         double blockLength = (double)blocknx1*deltax;
+
+         grid->setPeriodicX1(false);
+         grid->setPeriodicX2(false);
+         grid->setPeriodicX3(false);
+         grid->setDeltaX(deltax);
+         grid->setBlockNX(blocknx1, blocknx2, blocknx3);
+
+         SPtr<GbObject3D> gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
+         if (myid==0) GbSystem3D::writeGeoObject(gridCube.get(), pathname+"/geo/gridCube", WbWriterVtkXmlBinary::getInstance());
+
+         GenBlocksGridVisitor genBlocks(gridCube);
+         grid->accept(genBlocks);
+
+         if (myid==0)
+         {
+            UBLOG(logINFO, "Parameters:");
+            UBLOG(logINFO, "rho_LB = "<<rhoLB);
+            UBLOG(logINFO, "nu_LB = "<<nu_LB);
+            UBLOG(logINFO, "dp_LB = "<<dpLB);
+            UBLOG(logINFO, "dx = "<<deltax<<" m");
+            UBLOG(logINFO, "numOfThreads = "<<numOfThreads);
+            UBLOG(logINFO, "path = "<<pathname);
+            UBLOG(logINFO, "Preprozess - start");
+         }
+
+         //walls
+         GbCuboid3DPtr addWallYmin(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_minX2, g_maxX3+blockLength));
+         if (myid==0) GbSystem3D::writeGeoObject(addWallYmin.get(), pathname+"/geo/addWallYmin", WbWriterVtkXmlASCII::getInstance());
+
+         GbCuboid3DPtr addWallZmin(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_minX3));
+         if (myid==0) GbSystem3D::writeGeoObject(addWallZmin.get(), pathname+"/geo/addWallZmin", WbWriterVtkXmlASCII::getInstance());
+
+         GbCuboid3DPtr addWallYmax(new GbCuboid3D(g_minX1-blockLength, g_maxX2, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength));
+         if (myid==0) GbSystem3D::writeGeoObject(addWallYmax.get(), pathname+"/geo/addWallYmax", WbWriterVtkXmlASCII::getInstance());
+
+         GbCuboid3DPtr addWallZmax(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_maxX3, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength));
+         if (myid==0) GbSystem3D::writeGeoObject(addWallZmax.get(), pathname+"/geo/addWallZmax", WbWriterVtkXmlASCII::getInstance());
+
+
+         //inflow
+         GbCuboid3DPtr geoInflow(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3-blockLength, g_minX1, g_maxX2+blockLength, g_maxX3+blockLength));
+         if (myid==0) GbSystem3D::writeGeoObject(geoInflow.get(), pathname+"/geo/geoInflow", WbWriterVtkXmlASCII::getInstance());
+
+         //outflow
+         GbCuboid3DPtr geoOutflow(new GbCuboid3D(g_maxX1, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength));
+         if (myid==0) GbSystem3D::writeGeoObject(geoOutflow.get(), pathname+"/geo/geoOutflow", WbWriterVtkXmlASCII::getInstance());
+
+         WriteBlocksSPtr<CoProcessor> ppblocks(new WriteBlocksCoProcessor(grid, SPtr<UbScheduler>(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm));
+
+         
+         //PM interactor
+         SPtr<D3Q27Interactor> sampleInt(new D3Q27Interactor(sample, grid, noSlipBCAdapter, Interactor3D::SOLID));
+
+         //wall interactors
+         SPtr<D3Q27Interactor> addWallYminInt(new D3Q27Interactor(addWallYmin, grid, noSlipBCAdapter, Interactor3D::SOLID));
+         SPtr<D3Q27Interactor> addWallZminInt(new D3Q27Interactor(addWallZmin, grid, noSlipBCAdapter, Interactor3D::SOLID));
+         SPtr<D3Q27Interactor> addWallYmaxInt(new D3Q27Interactor(addWallYmax, grid, noSlipBCAdapter, Interactor3D::SOLID));
+         SPtr<D3Q27Interactor> addWallZmaxInt(new D3Q27Interactor(addWallZmax, grid, noSlipBCAdapter, Interactor3D::SOLID));
+
+
+         SPtr<D3Q27Interactor> inflowInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoInflow, grid, denBCAdapterInflow, Interactor3D::SOLID));
+
+         //outflow
+         SPtr<D3Q27Interactor> outflowInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoOutflow, grid, denBCAdapterOutflow, Interactor3D::SOLID));
+
+
+         //UBLOG(logINFO, "PID = "<<myid<<" Hostname: "<<machinename);
+         //UBLOG(logINFO, "PID = "<<myid<<" Total Physical Memory (RAM): "<<Utilities::getTotalPhysMem());
+         //UBLOG(logINFO, "PID = "<<myid<<" Physical Memory currently used: "<<Utilities::getPhysMemUsed());
+         //UBLOG(logINFO, "PID = "<<myid<<" Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe());
+
+
+         ////////////////////////////////////////////
+         //METIS
+         SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::BSW, MetisPartitioner::RECURSIVE));
+         ////////////////////////////////////////////
+         //Zoltan
+         //SPtr<Grid3DVisitor> zoltanVisitor(new ZoltanPartitioningGridVisitor(comm, D3Q27System::BSW, 1));
+         //grid->accept(zoltanVisitor);
+
+         /////delete solid blocks
+         if (myid==0) UBLOG(logINFO, "deleteSolidBlocks - start");
+         InteractorsHelper intHelper(grid, metisVisitor);
+         intHelper.addInteractor(addWallYminInt);
+         intHelper.addInteractor(addWallZminInt);
+         intHelper.addInteractor(addWallYmaxInt);
+         intHelper.addInteractor(addWallZmaxInt);
+         intHelper.addInteractor(inflowInt);
+         intHelper.addInteractor(outflowInt);
+         intHelper.addInteractor(sampleInt);
+         intHelper.selectBlocks();
+         if (myid==0) UBLOG(logINFO, "deleteSolidBlocks - end");
+         //////////////////////////////////////
+
+         //set connectors
+         InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor());
+         SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nu_LB, iProcessor);
+         grid->accept(setConnsVisitor);
+
+         //domain decomposition for threads
+         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
+         grid->accept(pqPartVisitor);
+
+         ppblocks->process(0);
+         ppblocks.reset();
+
+
+         unsigned long nob = grid->getNumberOfBlocks();
+         int gl = 3;
+         unsigned long nodb = (blocknx1)* (blocknx2)* (blocknx3);
+         unsigned long nod = nob * (blocknx1)* (blocknx2)* (blocknx3);
+         unsigned long nodg = nob * (blocknx1+gl) * (blocknx2+gl) * (blocknx3+gl);
+         double needMemAll = double(nodg*(27*sizeof(double)+sizeof(int)+sizeof(float)*4));
+         double needMem = needMemAll/double(comm->getNumberOfProcesses());
+
+         if (myid==0)
+         {
+            UBLOG(logINFO, "Number of blocks = "<<nob);
+            UBLOG(logINFO, "Number of nodes  = "<<nod);
+            int minInitLevel = grid->getCoarsestInitializedLevel();
+            int maxInitLevel = grid->getFinestInitializedLevel();
+            for (int level = minInitLevel; level<=maxInitLevel; level++)
+            {
+               int nobl = grid->getNumberOfBlocks(level);
+               UBLOG(logINFO, "Number of blocks for level "<<level<<" = "<<nobl);
+               UBLOG(logINFO, "Number of nodes for level "<<level<<" = "<<nobl*nodb);
+            }
+            UBLOG(logINFO, "Necessary memory  = "<<needMemAll<<" bytes");
+            UBLOG(logINFO, "Necessary memory per process = "<<needMem<<" bytes");
+            UBLOG(logINFO, "Available memory per process = "<<availMem<<" bytes");
+         }
+
+         //SPtr<LBMKernel> kernel;
+         //kernel = SPtr<LBMKernel>(new IncompressibleCumulantLBMKernel(blocknx1, blocknx2, blocknx3, IncompressibleCumulantLBMKernel::NORMAL));
+
+         ////SPtr<BCProcessor> bcProc(new BCProcessor());
+         //SPtr<BCProcessor> bcProc = SPtr<BCProcessor>(new ThinWallBCProcessor());
+         kernel->setBCProcessor(bcProc);
+
+         SetKernelBlockVisitor kernelVisitor(kernel, nu_LB, availMem, needMem);
+         grid->accept(kernelVisitor);
+
+         //BC
+         intHelper.setBC();
+
+         //BS visitor
+         grid->accept(bcVisitor);
+
+         //Press*1.6e8+(14.76-coordsX)/3.5*5000
+         //initialization of distributions
+         mu::Parser fct;
+         fct.SetExpr("(x1max-x1)/l*dp*3.0");
+         fct.DefineConst("dp", dpLB);
+         fct.DefineConst("x1max", g_maxX1);
+         fct.DefineConst("l", g_maxX1-g_minX1);
+
+         InitDistributionsBlockVisitor initVisitor(nu_LB, rhoLB);
+         initVisitor.setRho(fct);
+         grid->accept(initVisitor);
+
+         //Postrozess
+         SPtr<UbScheduler> geoSch(new UbScheduler(1));
+         WriteBoundaryConditionsSPtr<CoProcessor> ppgeo(
+            new WriteBoundaryConditionsCoProcessor(grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, comm));
+         ppgeo->process(0);
+         ppgeo.reset();
+
+         coord[0] = sample->getX1Minimum();
+         coord[1] = sample->getX2Minimum();
+         coord[2] = sample->getX3Minimum();
+         coord[3] = sample->getX1Maximum();
+         coord[4] = sample->getX2Maximum();
+         coord[5] = sample->getX3Maximum();
+
+         ////////////////////////////////////////////////////////
+         UbFileOutputASCII outf(pathname+"/checkpoints/coord.txt");
+         outf.writeDouble(deltax);
+         outf.writeDouble(coord[0]);
+         outf.writeDouble(coord[1]);
+         outf.writeDouble(coord[2]);
+         outf.writeDouble(coord[3]);
+         outf.writeDouble(coord[4]);
+         outf.writeDouble(coord[5]);
+         outf.writeDouble(g_minX1);
+         outf.writeDouble(g_maxX1);
+         outf.writeDouble(availMem);
+         outf.writeDouble(needMem);
+         ////////////////////////////////////////////////////////
+
+         grid->addInteractor(inflowInt);
+
+         if (myid==0) UBLOG(logINFO, "Preprozess - end");
+      }
+      else
+      {
+         ////////////////////////////////////////////////////////
+         UbFileInputASCII inf(pathname+"/checkpoints/coord.txt");
+         deltax = inf.readDouble();
+         coord[0] = inf.readDouble();
+         coord[1] = inf.readDouble();
+         coord[2] = inf.readDouble();
+         coord[3] = inf.readDouble();
+         coord[4] = inf.readDouble();
+         coord[5] = inf.readDouble();
+         double g_minX1 = inf.readDouble();
+         double g_maxX1 = inf.readDouble();
+         double availMem = inf.readDouble();
+         double needMem = inf.readDouble();
+         ////////////////////////////////////////////////////////
+         
+         rcp.restart((int)restartStep);
+         grid->setTimeStep(restartStep);
+
+         //new nu
+         if (newViscosity)
+         {
+            ViscosityBlockVisitor nuVisitor(nu_LB);
+            grid->accept(nuVisitor);
+         }
+
+         //new dp
+         if (newPressure)
+         {
+            Grid3D::Interactor3DSet interactors = grid->getInteractors();
+            interactors[0]->setGrid3D(grid);
+            dynamicPointerCast<D3Q27Interactor>(interactors[0])->deleteBCAdapter();
+            SPtr<BCAdapter> denBCAdapterFront(new DensityBCAdapter(rhoLBinflow));
+            denBCAdapterFront->setBcAlgorithm(SPtr<BCAlgorithm>(new EqDensityBCAlgorithm()));
+            dynamicPointerCast<D3Q27Interactor>(interactors[0])->addBCAdapter(denBCAdapterFront);
+            interactors[0]->updateInteractor();
+         }
+
+         if (myid==0)
+         {
+            UBLOG(logINFO, "Parameters:");
+            UBLOG(logINFO, "rho_LB = "<<rhoLB);
+            UBLOG(logINFO, "nu_LB = "<<nu_LB);
+            UBLOG(logINFO, "dp_LB = "<<dpLB);
+            UBLOG(logINFO, "dx = "<<deltax<<" m");
+         }
+
+         //set connectors
+         InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor());
+         SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nu_LB, iProcessor);
+         grid->accept(setConnsVisitor);
+
+         //domain decomposition for threads
+         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
+         grid->accept(pqPartVisitor);
+
+         //BS visitor
+         grid->accept(bcVisitor);
+
+         SPtr<UbScheduler> geoSch(new UbScheduler(1));
+         WriteBoundaryConditionsCoProcessor ppgeo = WriteBoundaryConditionsCoProcessor(grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, comm);
+         ppgeo.process(1);
+
+
+         if (myid==0) UBLOG(logINFO, "Restart - end");
+      }
+      SPtr<UbScheduler> nupsSch(new UbScheduler(nupsStep[0], nupsStep[1], nupsStep[2]));
+      //nupsSch->addSchedule(nupsStep[0], nupsStep[1], nupsStep[2]);
+      NUPSCounterCoProcessor npr(grid, nupsSch, numOfThreads, comm);
+
+      SPtr<UbScheduler> stepSch(new UbScheduler(outTimeStep,outTimeStart));
+
+      WriteMacroscopicQuantitiesCoProcessor pp(grid, stepSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, comm);
+
+      deltax = grid->getDeltaX(baseLevel);
+      double dxd2 = deltax/2.0;
+
+      SPtr<IntegrateValuesHelper> ih1(new IntegrateValuesHelper(grid, comm, coord[0]-dxd2*10.0, coord[1]-dxd2, coord[2]-dxd2,
+         coord[0]-dxd2*10.0-2.0*dxd2, coord[4]+dxd2, coord[5]+dxd2));
+
+      //D3Q27SPtr<IntegrateValuesHelper> ih2(new D3Q27IntegrateValuesHelper(grid, comm, coord[3]/2.0, coord[1] - dxd2, coord[2] - dxd2,
+      //   coord[3]/2.0 + 2.0*dxd2, coord[4] + dxd2, coord[5] + dxd2));
+      SPtr<IntegrateValuesHelper> ih2(new IntegrateValuesHelper(grid, comm, coord[0], coord[1], coord[2], coord[3], coord[4], coord[5]));
+
+      SPtr<IntegrateValuesHelper> ih3(new IntegrateValuesHelper(grid, comm, coord[3]+dxd2*10.0, coord[1]-dxd2, coord[2]-dxd2,
+         coord[3]+dxd2*10.0+2.0*dxd2, coord[4]+dxd2, coord[5]+dxd2));
+
+      //D3Q27SPtr<IntegrateValuesHelper> ih1(new D3Q27IntegrateValuesHelper(grid, comm, coord[0], coord[1], coord[2], coord[3], coord[4], coord[5]));
+      if (myid==0) GbSystem3D::writeGeoObject(ih1->getBoundingBox().get(), pathname+"/geo/ih1", WbWriterVtkXmlBinary::getInstance());
+      if (myid==0) GbSystem3D::writeGeoObject(ih2->getBoundingBox().get(), pathname+"/geo/ih2", WbWriterVtkXmlBinary::getInstance());
+      if (myid==0) GbSystem3D::writeGeoObject(ih3->getBoundingBox().get(), pathname+"/geo/ih3", WbWriterVtkXmlBinary::getInstance());
+
+      double factorp = 1; // dp_real / dp_LB;
+      double factorv = 1;// dx / dt;
+      SPtr<UbScheduler> stepMV(new UbScheduler(timeSeriesOutTime));
+
+      TimeseriesCoProcessor tsp1(grid, stepMV, ih1, pathname+timeSeriesFile+"_1", comm);
+      TimeseriesCoProcessor tsp2(grid, stepMV, ih2, pathname+timeSeriesFile+"_2", comm);
+      TimeseriesCoProcessor tsp3(grid, stepMV, ih3, pathname+timeSeriesFile+"_3", comm);
+
+      if (myid==0)
+      {
+         UBLOG(logINFO, "PID = "<<myid<<" Total Physical Memory (RAM): "<<Utilities::getTotalPhysMem());
+         UBLOG(logINFO, "PID = "<<myid<<" Physical Memory currently used: "<<Utilities::getPhysMemUsed());
+         UBLOG(logINFO, "PID = "<<myid<<" Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe());
+      }
+
+      const SPtr<ConcreteCalculatorFactory> calculatorFactory = std::make_shared<ConcreteCalculatorFactory>(stepSch);
+      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, calculatorFactory, CalculatorType::HYBRID));
+      if (myid==0) UBLOG(logINFO, "Simulation-start");
+      calculation->calculate();
+      if (myid==0) UBLOG(logINFO, "Simulation-end");
+      
+      //////MPIIORestart2CoProcessor 
+      //grid->deleteBlockIDs();
+      //RenumberBlockVisitor renumber;
+      //grid->accept(renumber);
+      //SPtr<UbScheduler> iiSch(new UbScheduler(1));
+      //MPIIORestart2CoProcessor rcpInit(grid, iiSch, pathname, comm);
+      //rcpInit.process(300);
+   }
+   catch (exception& e)
+   {
+      cerr<<e.what()<<endl<<flush;
+   }
+   catch (string& s)
+   {
+      cerr<<s<<endl;
+   }
+   catch (...)
+   {
+      cerr<<"unknown exception"<<endl;
+   }
+
+}
+//////////////////////////////////////////////////////////////////////////
+int main(int argc, char* argv[])
+{
+
+   if (argv!=NULL)
+   {
+      if (argv[1]!=NULL)
+      {
+         run(string(argv[1]));
+      }
+      else
+      {
+         cout<<"Configuration file is missing!"<<endl;
+      }
+   }
+
+   return 0;
+}
diff --git a/apps/cpu/aperm/aperm.cpp.old b/apps/cpu/aperm/aperm.cpp.old
index 107294e3d05c5a38c5b38c62f036caf1d923b84e..ce21e06c2d7713665596886c152c6e384f5003d2 100644
--- a/apps/cpu/aperm/aperm.cpp.old
+++ b/apps/cpu/aperm/aperm.cpp.old
@@ -1,573 +1,573 @@
-#include <iostream>
-#include <string>
-#include <VirtualFluids.h>
-
-using namespace std;
-
-void changeDP()
-{
-}
-//////////////////////////////////////////////////////////////////////////
-void run(string configname)
-{
-   try
-   {
-      ConfigurationFile   config;
-      config.load(configname);
-
-      string          pathname = config.getString("pathname");
-      string          pathGeo = config.getString("pathGeo");
-      int             numOfThreads = config.getInt("numOfThreads");
-      string          sampleFilename = config.getString("sampleFilename");
-      int             pmNX1 = config.getInt("pmNX1");
-      int             pmNX2 = config.getInt("pmNX2");
-      int             pmNX3 = config.getInt("pmNX3");
-      double          lthreshold = config.getDouble("lthreshold");
-      double          uthreshold = config.getDouble("uthreshold");
-      double          pmL1 = config.getDouble("pmL1");
-      double          pmL2 = config.getDouble("pmL2");
-      double          pmL3 = config.getDouble("pmL3");
-      int             blocknx = config.getInt("blocknx");
-      double          nx3 = config.getDouble("nx3");
-      double          dp_LB = config.getDouble("dp_LB");
-      double          nu_LB = config.getDouble("nu_LB");
-      string          timeSeriesFile = config.getString("timeSeriesFile");
-      double          restartStep = config.getDouble("restartStep");
-      double          restartStepStart = config.getDouble("restartStepStart");
-      double          endTime = config.getDouble("endTime");
-      double          outTime = config.getDouble("outTime");
-      double          availMem = config.getDouble("availMem");
-      bool            rawFile = config.getBool("rawFile");
-      double          timeSeriesOutTime = config.getDouble("timeSeriesOutTime");
-      bool            logToFile = config.getBool("logToFile");
-      bool            spongeLayer = config.getBool("spongeLayer");
-      vector<double>  nupsStep = config.getVector<double>("nupsStep");
-      int             numOfParts = config.getInt("numOfParts");
-      bool            gridPrepare = config.getBool("gridPrepare");
-      double          deltax = config.getDouble("deltax");
-      bool            flowInit = config.getBool("flowInit");
-      bool            newViscosity = config.getBool("newViscosity");
-      bool            newPressure = config.getBool("newPressure");
-      bool            pmDeltas = config.getBool("pmDeltas");
-      double          pmDeltaX1 = config.getDouble("pmDeltaX1");
-      double          pmDeltaX2 = config.getDouble("pmDeltaX2");
-      double          pmDeltaX3 = config.getDouble("pmDeltaX3");
-      double          vx1 = config.getDouble("vx1");
-      double          vx2 = config.getDouble("vx2");
-      double          vx3 = config.getDouble("vx3");
-      bool            yDir = config.getBool("yDir");
-      bool            zDir = config.getBool("zDir");
-
-      CommunicatorPtr comm = MPICommunicator::getInstance();
-      int myid = comm->getProcessID();
-
-      if (logToFile)
-      {
-#if defined(__unix__)
-         if (myid == 0)
-         {
-            const char* str = pathname.c_str();
-            int status = mkdir(str, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
-         }
-#endif 
-
-         if (myid == 0)
-         {
-            stringstream logFilename;
-            logFilename << pathname + "/logfile" + UbSystem::toString(UbSystem::getTimeStamp()) + ".txt";
-            UbLog::output_policy::setStream(logFilename.str());
-         }
-      }
-
-      //Sleep(30000);
-
-      if (myid == 0) UBLOG(logINFO, "Testcase permeability");
-
-      string machinename = UbSystem::getMachineName();
-      //UBLOG(logINFO, "PID = " << myid << " Hostname: " << machinename);
-      //UBLOG(logINFO, "PID = " << myid << " Total Physical Memory (RAM): " << Utilities::getTotalPhysMem());
-      //UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used: " << Utilities::getPhysMemUsed());
-      //UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe());
-
-      int blocknx1 = blocknx;
-      int blocknx2 = blocknx;
-      int blocknx3 = blocknx;
-
-      LBMReal rho_LB = 0.0;
-      double rhoLBinflow = dp_LB*3.0;
-
-      LBMUnitConverterPtr conv = LBMUnitConverterPtr(new LBMUnitConverter());
-
-      const int baseLevel = 0;
-
-      double coord[6];
-      //double deltax;
-
-      Grid3DPtr grid(new Grid3D(comm));
-
-      //////////////////////////////////////////////////////////////////////////
-      //restart
-      UbSchedulerPtr rSch(new UbScheduler(restartStep, restartStepStart));
-      RestartCoProcessor rp(grid, rSch, comm, pathname, RestartCoProcessor::BINARY);
-      //////////////////////////////////////////////////////////////////////////
-
-      if (gridPrepare)
-      {
-         if (myid == 0) UBLOG(logINFO, "new start..");
-
-         UBLOG(logINFO, "new start PID = " << myid << " Hostname: " << machinename);
-         UBLOG(logINFO, "new start PID = " << myid << " Total Physical Memory (RAM): " << Utilities::getTotalPhysMem());
-         UBLOG(logINFO, "new start PID = " << myid << " Physical Memory currently used: " << Utilities::getPhysMemUsed());
-         UBLOG(logINFO, "new start PID = " << myid << " Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe());
-
-         string samplePathname = pathGeo + sampleFilename;
-
-         double deltaVoxelX1 = pmL1/(double)pmNX1;
-         double deltaVoxelX2 = pmL2/(double)pmNX2;
-         double deltaVoxelX3 = pmL3/(double)pmNX3;
-
-         if (pmDeltas)
-         {
-            deltaVoxelX1 = pmDeltaX1;
-            deltaVoxelX2 = pmDeltaX2;
-            deltaVoxelX3 = pmDeltaX3;
-         }
-
-         GbVoxelMatrix3DPtr sample(new GbVoxelMatrix3D(pmNX1, pmNX2, pmNX3, 0, lthreshold, uthreshold));
-         if (rawFile)
-         {
-            sample->readMatrixFromRawFile<unsigned short>(samplePathname, GbVoxelMatrix3D::BigEndian);
-         }
-         else
-         {
-            sample->readMatrixFromVtiASCIIFile(samplePathname);
-         }
-
-         sample->setVoxelMatrixDelta((float)deltaVoxelX1, (float)deltaVoxelX2, (float)deltaVoxelX3);
-         sample->setVoxelMatrixMininum(0.0, 0.0, 0.0);
-
-         if (yDir)
-         {
-            sample->rotate90aroundZ();
-            sample->rotate90aroundZ();
-            sample->rotate90aroundZ();
-         }
-         if (zDir)
-         {
-            sample->rotate90aroundY();
-         }
-
-         if (myid == 0) sample->writeToVTKImageDataASCII(pathname + "/geo/sample");
-
-         ///////////////////////////////////////////////////////
-
-         ////////////////////////////////////////////////////////////////////////
-
-         double offset1 = sample->getLengthX1()/10.0;
-         double offset2 = 2.0*offset1;
-         //double offset2 = offset1;
-         //bounding box
-         double g_minX1 = sample->getX1Minimum() - offset1;
-         double g_minX2 = sample->getX2Minimum();
-         double g_minX3 = sample->getX3Minimum();
-
-         double g_maxX1 = sample->getX1Maximum() + offset2;
-         double g_maxX2 = sample->getX2Maximum();
-         double g_maxX3 = sample->getX3Maximum();
-
-         ////////////////////////////////////////////////////////////////////////////
-         double nx1_temp = floor((g_maxX1-g_minX1)/(deltax*(double)blocknx));
-
-         deltax = (g_maxX1-g_minX1)/(nx1_temp*(double)blocknx);
-
-        // g_maxX3 -= 0.5* deltax;
-         ////////////////////////////////////////////////////////////////////////////
-
-         ////deltax = (g_maxX3-g_minX3) /(nx3*blocknx3);
-
-         double blockLength = (double)blocknx1*deltax;
-
-         grid->setPeriodicX1(false);
-         grid->setPeriodicX2(false);
-         grid->setPeriodicX3(false);
-         grid->setDeltaX(deltax);
-         grid->setBlockNX(blocknx1, blocknx2, blocknx3);
-
-         GbObject3DPtr gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
-         if (myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), pathname + "/geo/gridCube", WbWriterVtkXmlBinary::getInstance());
-
-         GenBlocksGridVisitor genBlocks(gridCube);
-         grid->accept(genBlocks);
-
-         if (myid == 0)
-         {
-            UBLOG(logINFO, "Parameters:");
-            UBLOG(logINFO, "rho_LB = " << rho_LB);
-            UBLOG(logINFO, "nu_LB = " << nu_LB);
-            UBLOG(logINFO, "dp_LB = " << dp_LB);
-            UBLOG(logINFO, "dx = " << deltax << " m");
-            UBLOG(logINFO, "numOfThreads = " << numOfThreads);
-            UBLOG(logINFO, "path = " << pathname);
-            UBLOG(logINFO, "Preprozess - start");
-         }
-
-         //walls
-         GbCuboid3DPtr addWallYmin(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_minX2, g_maxX3+blockLength));
-         if (myid == 0) GbSystem3D::writeGeoObject(addWallYmin.get(), pathname+"/geo/addWallYmin", WbWriterVtkXmlASCII::getInstance());
-
-         GbCuboid3DPtr addWallZmin(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_minX3));
-         if (myid == 0) GbSystem3D::writeGeoObject(addWallZmin.get(), pathname+"/geo/addWallZmin", WbWriterVtkXmlASCII::getInstance());
-
-         GbCuboid3DPtr addWallYmax(new GbCuboid3D(g_minX1-blockLength, g_maxX2, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength));
-         if (myid == 0) GbSystem3D::writeGeoObject(addWallYmax.get(), pathname+"/geo/addWallYmax", WbWriterVtkXmlASCII::getInstance());
-
-         GbCuboid3DPtr addWallZmax(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_maxX3, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength));
-         if (myid == 0) GbSystem3D::writeGeoObject(addWallZmax.get(), pathname+"/geo/addWallZmax", WbWriterVtkXmlASCII::getInstance());
-
-
-         //inflow
-         GbCuboid3DPtr geoInflow(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3-blockLength, g_minX1, g_maxX2+blockLength, g_maxX3+blockLength));
-         if (myid == 0) GbSystem3D::writeGeoObject(geoInflow.get(), pathname + "/geo/geoInflow", WbWriterVtkXmlASCII::getInstance());
-
-         //outflow
-         GbCuboid3DPtr geoOutflow(new GbCuboid3D(g_maxX1, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength));
-         if (myid == 0) GbSystem3D::writeGeoObject(geoOutflow.get(), pathname + "/geo/geoOutflow", WbWriterVtkXmlASCII::getInstance());
-
-         WriteBlocksCoProcessorPtr ppblocks(new WriteBlocksCoProcessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm));
-
-         //PM interactor
-         BCAdapterPtr noSlipBCAdapter(new NoSlipBCAdapter());
-         noSlipBCAdapter->setBcAlgorithm(BCAlgorithmPtr(new ThinWallNoSlipBCAlgorithm()));
-         D3Q27InteractorPtr sampleInt(new D3Q27Interactor(sample, grid, noSlipBCAdapter, Interactor3D::SOLID));
-
-         //wall interactors
-         D3Q27InteractorPtr addWallYminInt(new D3Q27Interactor(addWallYmin, grid, noSlipBCAdapter, Interactor3D::SOLID));
-         D3Q27InteractorPtr addWallZminInt(new D3Q27Interactor(addWallZmin, grid, noSlipBCAdapter, Interactor3D::SOLID));
-         D3Q27InteractorPtr addWallYmaxInt(new D3Q27Interactor(addWallYmax, grid, noSlipBCAdapter, Interactor3D::SOLID));
-         D3Q27InteractorPtr addWallZmaxInt(new D3Q27Interactor(addWallZmax, grid, noSlipBCAdapter, Interactor3D::SOLID));
-
-         BCAdapterPtr denBCAdapterInflow(new DensityBCAdapter(rhoLBinflow));
-         denBCAdapterInflow->setBcAlgorithm(BCAlgorithmPtr(new EqDensityBCAlgorithm()));
-         D3Q27InteractorPtr inflowInt = D3Q27InteractorPtr(new D3Q27Interactor(geoInflow, grid, denBCAdapterInflow, Interactor3D::SOLID));
-
-         //outflow
-         BCAdapterPtr denBCAdapterOutflow(new DensityBCAdapter(rho_LB));
-         denBCAdapterOutflow->setBcAlgorithm(BCAlgorithmPtr(new EqDensityBCAlgorithm()));
-         D3Q27InteractorPtr outflowInt = D3Q27InteractorPtr(new D3Q27Interactor(geoOutflow, grid, denBCAdapterOutflow, Interactor3D::SOLID));
-
-         
-         UBLOG(logINFO, "PID = " << myid << " Hostname: " << machinename);
-         UBLOG(logINFO, "PID = " << myid << " Total Physical Memory (RAM): " << Utilities::getTotalPhysMem());
-         UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used: " << Utilities::getPhysMemUsed());
-         UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe());
-
-
-         ////////////////////////////////////////////
-         //METIS
-         Grid3DVisitorPtr metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::BSW, MetisPartitioner::RECURSIVE));
-         ////////////////////////////////////////////
-         //Zoltan
-         //Grid3DVisitorPtr zoltanVisitor(new ZoltanPartitioningGridVisitor(comm, D3Q27System::BSW, 1));
-         //grid->accept(zoltanVisitor);
-
-         /////delete solid blocks
-         if (myid == 0) UBLOG(logINFO, "deleteSolidBlocks - start");
-         InteractorsHelper intHelper(grid, metisVisitor);
-         intHelper.addInteractor(addWallYminInt);
-         intHelper.addInteractor(addWallZminInt);
-         intHelper.addInteractor(addWallYmaxInt);
-         intHelper.addInteractor(addWallZmaxInt);
-         intHelper.addInteractor(inflowInt);
-         intHelper.addInteractor(outflowInt);
-         intHelper.addInteractor(sampleInt);
-         intHelper.selectBlocks();
-         if (myid == 0) UBLOG(logINFO, "deleteSolidBlocks - end");
-         //////////////////////////////////////
-
-         //set connectors
-         D3Q27InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor());
-         SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nu_LB, iProcessor);
-         grid->accept(setConnsVisitor);
-
-         //domain decomposition for threads
-         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
-         grid->accept(pqPartVisitor);
-
-         ppblocks->process(0);
-         ppblocks.reset();
-  
-
-         unsigned long nob = grid->getNumberOfBlocks();
-         int gl = 3;
-         unsigned long nodb = (blocknx1)* (blocknx2)* (blocknx3);
-         unsigned long nod = nob * (blocknx1)* (blocknx2)* (blocknx3);
-         unsigned long nodg = nob * (blocknx1 + gl) * (blocknx2 + gl) * (blocknx3 + gl);
-         double needMemAll = double(nodg*(27 * sizeof(double) + sizeof(int) + sizeof(float) * 4));
-         double needMem = needMemAll / double(comm->getNumberOfProcesses());
-
-         if (myid == 0)
-         {
-            UBLOG(logINFO, "Number of blocks = " << nob);
-            UBLOG(logINFO, "Number of nodes  = " << nod);
-            int minInitLevel = grid->getCoarsestInitializedLevel();
-            int maxInitLevel = grid->getFinestInitializedLevel();
-            for (int level = minInitLevel; level <= maxInitLevel; level++)
-            {
-               int nobl = grid->getNumberOfBlocks(level);
-               UBLOG(logINFO, "Number of blocks for level " << level << " = " << nobl);
-               UBLOG(logINFO, "Number of nodes for level " << level << " = " << nobl*nodb);
-            }
-            UBLOG(logINFO, "Necessary memory  = " << needMemAll << " bytes");
-            UBLOG(logINFO, "Necessary memory per process = " << needMem << " bytes");
-            UBLOG(logINFO, "Available memory per process = " << availMem << " bytes");
-         }
-
-         LBMKernelPtr kernel;
-         if (comm->getNumberOfProcesses()>1 && gridPrepare)
-         {
-            kernel = LBMKernelPtr(new IncompressibleCumulantLBMKernel(blocknx1, blocknx2, blocknx3, IncompressibleCumulantLBMKernel::NORMAL));
-         }
-         else
-         {
-            kernel = LBMKernelPtr(new VoidLBMKernel(blocknx1, blocknx2, blocknx3));
-         }
-
-         //BCProcessorPtr bcProc(new D3Q27ETBCProcessor());
-         BCProcessorPtr bcProc = BCProcessorPtr(new ThinWallBCProcessor());
-         kernel->setBCProcessor(bcProc);
-
-         SetKernelBlockVisitor kernelVisitor(kernel, nu_LB, availMem, needMem);
-         grid->accept(kernelVisitor);
-
-         //BC
-         intHelper.setBC();
-
-         if (comm->getNumberOfProcesses()>1 && gridPrepare)
-         {
-            BoundaryConditionBlockVisitor bcVisitor;
-            //bcVisitor.addBC('N', BCAlgorithmPtr(new NoSlipBCAlgorithm()));
-            //bcVisitor.addBC('I', BCAlgorithmPtr(new EqDensityBCAlgorithm()));
-            //bcVisitor.addBC('O', BCAlgorithmPtr(new EqDensityBCAlgorithm()));
-            bcVisitor.addBC(noSlipBCAdapter);
-            bcVisitor.addBC(denBCAdapterInflow);
-            bcVisitor.addBC(denBCAdapterOutflow);
-            grid->accept(bcVisitor);
-
-            //Press*1.6e8+(14.76-coordsX)/3.5*5000
-            //initialization of distributions
-            mu::Parser fct;
-            fct.SetExpr("(x1max-x1)/l*dp*3.0");
-            fct.DefineConst("dp", dp_LB);
-            fct.DefineConst("x1max", g_maxX1);
-            fct.DefineConst("l", g_maxX1-g_minX1);
-
-            InitDistributionsBlockVisitor initVisitor(nu_LB, rho_LB);
-            initVisitor.setRho(fct);
-            grid->accept(initVisitor);
-
-            //Postrozess
-            UbSchedulerPtr geoSch(new UbScheduler(1));
-            WriteBoundaryConditionsCoProcessorPtr ppgeo(
-               new WriteBoundaryConditionsCoProcessor(grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, comm));
-            ppgeo->process(0);
-            ppgeo.reset();
-         }
-
-
-         coord[0] = sample->getX1Minimum();
-         coord[1] = sample->getX2Minimum();
-         coord[2] = sample->getX3Minimum();
-         coord[3] = sample->getX1Maximum();
-         coord[4] = sample->getX2Maximum();
-         coord[5] = sample->getX3Maximum();
-
-         ////////////////////////////////////////////////////////
-         UbFileOutputASCII outf(pathname + "/checkpoints/coord.txt");
-         outf.writeDouble(deltax);
-         outf.writeDouble(coord[0]);
-         outf.writeDouble(coord[1]);
-         outf.writeDouble(coord[2]);
-         outf.writeDouble(coord[3]);
-         outf.writeDouble(coord[4]);
-         outf.writeDouble(coord[5]);
-         outf.writeDouble(g_minX1);
-         outf.writeDouble(g_maxX1);
-         outf.writeDouble(availMem);
-         outf.writeDouble(needMem);
-         ////////////////////////////////////////////////////////
-
-         grid->addInteractor(inflowInt);
-
-
-         if (myid == 0) UBLOG(logINFO, "Preprozess - end");
-
-         if (comm->getNumberOfProcesses() == 1 && gridPrepare)
-         {
-            UBLOG(logINFO, "Prepare grid - start");
-            rp.writeDistributedGrid(grid, numOfParts);
-            UBLOG(logINFO, "Prepare grid - end");
-            return;
-         }
-      }
-      else
-      {
-         ////////////////////////////////////////////////////////
-         UbFileInputASCII inf(pathname+"/checkpoints/coord.txt");
-         deltax   = inf.readDouble();
-         coord[0] = inf.readDouble();
-         coord[1] = inf.readDouble();
-         coord[2] = inf.readDouble();
-         coord[3] = inf.readDouble();
-         coord[4] = inf.readDouble();
-         coord[5] = inf.readDouble();
-         double g_minX1 = inf.readDouble();
-         double g_maxX1 = inf.readDouble();
-         double availMem = inf.readDouble();
-         double needMem = inf.readDouble();
-         ////////////////////////////////////////////////////////
-
-         if (flowInit)
-         {
-            grid->setRank(myid);
-            LBMKernelPtr kernel = LBMKernelPtr(new IncompressibleCumulantLBMKernel(blocknx1, blocknx2, blocknx3, IncompressibleCumulantLBMKernel::NORMAL));
-            BCProcessorPtr bcProc(new BCProcessor());
-            kernel->setBCProcessor(bcProc);
-            SetKernelBlockVisitor kernelVisitor(kernel, nu_LB, availMem, needMem, SetKernelBlockVisitor::ChangeKernelWithData);
-            grid->accept(kernelVisitor);
-
-            BoundaryConditionBlockVisitor bcVisitor;
-            grid->accept(bcVisitor);
-            
-            UbSchedulerPtr geoSch(new UbScheduler(1));
-            WriteBoundaryConditionsCoProcessor pp(grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, comm);
-            pp.process(0);
-
-            //Press*1.6e8+(14.76-coordsX)/3.5*5000
-            //initialization of distributions
-            mu::Parser fct;
-            fct.SetExpr("(x1max-x1)/l*dp*3.0");
-            fct.DefineConst("dp", dp_LB);
-            fct.DefineConst("x1max", g_maxX1);
-            fct.DefineConst("l", g_maxX1-g_minX1);
-
-            InitDistributionsBlockVisitor initVisitor(nu_LB, rho_LB);
-            initVisitor.setRho(fct);
-            initVisitor.setVx1(vx1);
-            initVisitor.setVx1(vx2);
-            initVisitor.setVx1(vx3);
-            grid->accept(initVisitor);
-         }
-
-         //new nu
-         if (newViscosity)
-         {
-            ViscosityBlockVisitor nuVisitor(nu_LB);
-            grid->accept(nuVisitor);
-         }
-
-         //new dp
-         if (newPressure)
-         {
-            Grid3D::Interactor3DSet interactors = grid->getInteractors();
-            interactors[0]->setGrid3D(grid);
-            boost::dynamic_pointer_cast<D3Q27Interactor>(interactors[0])->deleteBCAdapter();
-            BCAdapterPtr denBCAdapterFront(new DensityBCAdapter(rhoLBinflow));
-            denBCAdapterFront->setBcAlgorithm(BCAlgorithmPtr(new EqDensityBCAlgorithm()));
-            boost::dynamic_pointer_cast<D3Q27Interactor>(interactors[0])->addBCAdapter(denBCAdapterFront);
-            interactors[0]->updateInteractor();
-         }
-
-         if (myid == 0)
-         {
-	         UBLOG(logINFO, "Parameters:");
-	         UBLOG(logINFO, "rho_LB = " << rho_LB);
-	         UBLOG(logINFO, "nu_LB = " << nu_LB);
-	         UBLOG(logINFO, "dp_LB = " << dp_LB);
-	         UBLOG(logINFO, "dx = " << deltax << " m");
-         }
-
-         //set connectors
-         D3Q27InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor());
-         SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nu_LB, iProcessor);
-         grid->accept(setConnsVisitor);
-
-         if (myid == 0) UBLOG(logINFO, "Restart - end");
-      }
-      UbSchedulerPtr nupsSch(new UbScheduler(nupsStep[0], nupsStep[1], nupsStep[2]));
-      //nupsSch->addSchedule(nupsStep[0], nupsStep[1], nupsStep[2]);
-      NUPSCounterCoProcessor npr(grid, nupsSch, numOfThreads, comm);
-
-      UbSchedulerPtr stepSch(new UbScheduler(outTime));
-
-      WriteMacroscopicQuantitiesCoProcessor pp(grid, stepSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, comm);
-
-      deltax = grid->getDeltaX(baseLevel);
-      double dxd2 = deltax / 2.0;
-
-      IntegrateValuesHelperPtr ih1(new IntegrateValuesHelper(grid, comm, coord[0] - dxd2*10.0, coord[1] - dxd2, coord[2] - dxd2,
-         coord[0] - dxd2*10.0 - 2.0*dxd2, coord[4] + dxd2, coord[5] + dxd2));
-
-      //D3Q27IntegrateValuesHelperPtr ih2(new D3Q27IntegrateValuesHelper(grid, comm, coord[3]/2.0, coord[1] - dxd2, coord[2] - dxd2,
-      //   coord[3]/2.0 + 2.0*dxd2, coord[4] + dxd2, coord[5] + dxd2));
-      IntegrateValuesHelperPtr ih2(new IntegrateValuesHelper(grid, comm, coord[0], coord[1], coord[2], coord[3], coord[4], coord[5]));
-
-      IntegrateValuesHelperPtr ih3(new IntegrateValuesHelper(grid, comm, coord[3] + dxd2*10.0, coord[1] - dxd2, coord[2] - dxd2,
-         coord[3] + dxd2*10.0 + 2.0*dxd2, coord[4] + dxd2, coord[5] + dxd2));
-
-      //D3Q27IntegrateValuesHelperPtr ih1(new D3Q27IntegrateValuesHelper(grid, comm, coord[0], coord[1], coord[2], coord[3], coord[4], coord[5]));
-      if (myid == 0) GbSystem3D::writeGeoObject(ih1->getBoundingBox().get(), pathname + "/geo/ih1", WbWriterVtkXmlBinary::getInstance());
-      if (myid == 0) GbSystem3D::writeGeoObject(ih2->getBoundingBox().get(), pathname + "/geo/ih2", WbWriterVtkXmlBinary::getInstance());
-      if (myid == 0) GbSystem3D::writeGeoObject(ih3->getBoundingBox().get(), pathname + "/geo/ih3", WbWriterVtkXmlBinary::getInstance());
-
-      double factorp = 1; // dp_real / dp_LB;
-      double factorv = 1;// dx / dt;
-      UbSchedulerPtr stepMV(new UbScheduler(timeSeriesOutTime));
-      
-      TimeseriesCoProcessor tsp1(grid, stepMV, ih1, pathname+timeSeriesFile+"_1", comm);
-      TimeseriesCoProcessor tsp2(grid, stepMV, ih2, pathname+timeSeriesFile+"_2", comm);
-      TimeseriesCoProcessor tsp3(grid, stepMV, ih3, pathname+timeSeriesFile+"_3", comm);
-
-      if (myid == 0)
-      {
-         UBLOG(logINFO, "PID = " << myid << " Total Physical Memory (RAM): " << Utilities::getTotalPhysMem());
-         UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used: " << Utilities::getPhysMemUsed());
-         UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe());
-      }
-
-      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, stepMV));
-      if (myid == 0) UBLOG(logINFO, "Simulation-start");
-      calculation->calculate();
-      if (myid == 0) UBLOG(logINFO, "Simulation-end");
-   }
-   catch (exception& e)
-   {
-      cerr << e.what() << endl << flush;
-   }
-   catch (string& s)
-   {
-      cerr << s << endl;
-   }
-   catch (...)
-   {
-      cerr << "unknown exception" << endl;
-   }
-
-}
-//////////////////////////////////////////////////////////////////////////
-int main(int argc, char* argv[])
-{
-
-   if (argv!=NULL)
-   {
-      if (argv[1]!=NULL)
-      {
-         run(string(argv[1]));
-      }
-      else
-      {
-         cout<<"Configuration file is missing!"<<endl;
-      }
-   }
-
-   return 0;
-}
+#include <iostream>
+#include <string>
+#include <VirtualFluids.h>
+
+using namespace std;
+
+void changeDP()
+{
+}
+//////////////////////////////////////////////////////////////////////////
+void run(string configname)
+{
+   try
+   {
+      ConfigurationFile   config;
+      config.load(configname);
+
+      string          pathname = config.getString("pathname");
+      string          pathGeo = config.getString("pathGeo");
+      int             numOfThreads = config.getInt("numOfThreads");
+      string          sampleFilename = config.getString("sampleFilename");
+      int             pmNX1 = config.getInt("pmNX1");
+      int             pmNX2 = config.getInt("pmNX2");
+      int             pmNX3 = config.getInt("pmNX3");
+      double          lthreshold = config.getDouble("lthreshold");
+      double          uthreshold = config.getDouble("uthreshold");
+      double          pmL1 = config.getDouble("pmL1");
+      double          pmL2 = config.getDouble("pmL2");
+      double          pmL3 = config.getDouble("pmL3");
+      int             blocknx = config.getInt("blocknx");
+      double          nx3 = config.getDouble("nx3");
+      double          dp_LB = config.getDouble("dp_LB");
+      double          nu_LB = config.getDouble("nu_LB");
+      string          timeSeriesFile = config.getString("timeSeriesFile");
+      double          restartStep = config.getDouble("restartStep");
+      double          restartStepStart = config.getDouble("restartStepStart");
+      double          endTime = config.getDouble("endTime");
+      double          outTime = config.getDouble("outTime");
+      double          availMem = config.getDouble("availMem");
+      bool            rawFile = config.getBool("rawFile");
+      double          timeSeriesOutTime = config.getDouble("timeSeriesOutTime");
+      bool            logToFile = config.getBool("logToFile");
+      bool            spongeLayer = config.getBool("spongeLayer");
+      vector<double>  nupsStep = config.getVector<double>("nupsStep");
+      int             numOfParts = config.getInt("numOfParts");
+      bool            gridPrepare = config.getBool("gridPrepare");
+      double          deltax = config.getDouble("deltax");
+      bool            flowInit = config.getBool("flowInit");
+      bool            newViscosity = config.getBool("newViscosity");
+      bool            newPressure = config.getBool("newPressure");
+      bool            pmDeltas = config.getBool("pmDeltas");
+      double          pmDeltaX1 = config.getDouble("pmDeltaX1");
+      double          pmDeltaX2 = config.getDouble("pmDeltaX2");
+      double          pmDeltaX3 = config.getDouble("pmDeltaX3");
+      double          vx1 = config.getDouble("vx1");
+      double          vx2 = config.getDouble("vx2");
+      double          vx3 = config.getDouble("vx3");
+      bool            yDir = config.getBool("yDir");
+      bool            zDir = config.getBool("zDir");
+
+      CommunicatorPtr comm = MPICommunicator::getInstance();
+      int myid = comm->getProcessID();
+
+      if (logToFile)
+      {
+#if defined(__unix__)
+         if (myid == 0)
+         {
+            const char* str = pathname.c_str();
+            int status = mkdir(str, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
+         }
+#endif 
+
+         if (myid == 0)
+         {
+            stringstream logFilename;
+            logFilename << pathname + "/logfile" + UbSystem::toString(UbSystem::getTimeStamp()) + ".txt";
+            UbLog::output_policy::setStream(logFilename.str());
+         }
+      }
+
+      //Sleep(30000);
+
+      if (myid == 0) UBLOG(logINFO, "Testcase permeability");
+
+      string machinename = UbSystem::getMachineName();
+      //UBLOG(logINFO, "PID = " << myid << " Hostname: " << machinename);
+      //UBLOG(logINFO, "PID = " << myid << " Total Physical Memory (RAM): " << Utilities::getTotalPhysMem());
+      //UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used: " << Utilities::getPhysMemUsed());
+      //UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe());
+
+      int blocknx1 = blocknx;
+      int blocknx2 = blocknx;
+      int blocknx3 = blocknx;
+
+      LBMReal rho_LB = 0.0;
+      double rhoLBinflow = dp_LB*3.0;
+
+      LBMUnitConverterPtr conv = LBMUnitConverterPtr(new LBMUnitConverter());
+
+      const int baseLevel = 0;
+
+      double coord[6];
+      //double deltax;
+
+      Grid3DPtr grid(new Grid3D(comm));
+
+      //////////////////////////////////////////////////////////////////////////
+      //restart
+      UbSchedulerPtr rSch(new UbScheduler(restartStep, restartStepStart));
+      RestartCoProcessor rp(grid, rSch, comm, pathname, RestartCoProcessor::BINARY);
+      //////////////////////////////////////////////////////////////////////////
+
+      if (gridPrepare)
+      {
+         if (myid == 0) UBLOG(logINFO, "new start..");
+
+         UBLOG(logINFO, "new start PID = " << myid << " Hostname: " << machinename);
+         UBLOG(logINFO, "new start PID = " << myid << " Total Physical Memory (RAM): " << Utilities::getTotalPhysMem());
+         UBLOG(logINFO, "new start PID = " << myid << " Physical Memory currently used: " << Utilities::getPhysMemUsed());
+         UBLOG(logINFO, "new start PID = " << myid << " Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe());
+
+         string samplePathname = pathGeo + sampleFilename;
+
+         double deltaVoxelX1 = pmL1/(double)pmNX1;
+         double deltaVoxelX2 = pmL2/(double)pmNX2;
+         double deltaVoxelX3 = pmL3/(double)pmNX3;
+
+         if (pmDeltas)
+         {
+            deltaVoxelX1 = pmDeltaX1;
+            deltaVoxelX2 = pmDeltaX2;
+            deltaVoxelX3 = pmDeltaX3;
+         }
+
+         GbVoxelMatrix3DPtr sample(new GbVoxelMatrix3D(pmNX1, pmNX2, pmNX3, 0, lthreshold, uthreshold));
+         if (rawFile)
+         {
+            sample->readMatrixFromRawFile<unsigned short>(samplePathname, GbVoxelMatrix3D::BigEndian);
+         }
+         else
+         {
+            sample->readMatrixFromVtiASCIIFile(samplePathname);
+         }
+
+         sample->setVoxelMatrixDelta((float)deltaVoxelX1, (float)deltaVoxelX2, (float)deltaVoxelX3);
+         sample->setVoxelMatrixMininum(0.0, 0.0, 0.0);
+
+         if (yDir)
+         {
+            sample->rotate90aroundZ();
+            sample->rotate90aroundZ();
+            sample->rotate90aroundZ();
+         }
+         if (zDir)
+         {
+            sample->rotate90aroundY();
+         }
+
+         if (myid == 0) sample->writeToVTKImageDataASCII(pathname + "/geo/sample");
+
+         ///////////////////////////////////////////////////////
+
+         ////////////////////////////////////////////////////////////////////////
+
+         double offset1 = sample->getLengthX1()/10.0;
+         double offset2 = 2.0*offset1;
+         //double offset2 = offset1;
+         //bounding box
+         double g_minX1 = sample->getX1Minimum() - offset1;
+         double g_minX2 = sample->getX2Minimum();
+         double g_minX3 = sample->getX3Minimum();
+
+         double g_maxX1 = sample->getX1Maximum() + offset2;
+         double g_maxX2 = sample->getX2Maximum();
+         double g_maxX3 = sample->getX3Maximum();
+
+         ////////////////////////////////////////////////////////////////////////////
+         double nx1_temp = floor((g_maxX1-g_minX1)/(deltax*(double)blocknx));
+
+         deltax = (g_maxX1-g_minX1)/(nx1_temp*(double)blocknx);
+
+        // g_maxX3 -= 0.5* deltax;
+         ////////////////////////////////////////////////////////////////////////////
+
+         ////deltax = (g_maxX3-g_minX3) /(nx3*blocknx3);
+
+         double blockLength = (double)blocknx1*deltax;
+
+         grid->setPeriodicX1(false);
+         grid->setPeriodicX2(false);
+         grid->setPeriodicX3(false);
+         grid->setDeltaX(deltax);
+         grid->setBlockNX(blocknx1, blocknx2, blocknx3);
+
+         GbObject3DPtr gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
+         if (myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), pathname + "/geo/gridCube", WbWriterVtkXmlBinary::getInstance());
+
+         GenBlocksGridVisitor genBlocks(gridCube);
+         grid->accept(genBlocks);
+
+         if (myid == 0)
+         {
+            UBLOG(logINFO, "Parameters:");
+            UBLOG(logINFO, "rho_LB = " << rho_LB);
+            UBLOG(logINFO, "nu_LB = " << nu_LB);
+            UBLOG(logINFO, "dp_LB = " << dp_LB);
+            UBLOG(logINFO, "dx = " << deltax << " m");
+            UBLOG(logINFO, "numOfThreads = " << numOfThreads);
+            UBLOG(logINFO, "path = " << pathname);
+            UBLOG(logINFO, "Preprozess - start");
+         }
+
+         //walls
+         GbCuboid3DPtr addWallYmin(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_minX2, g_maxX3+blockLength));
+         if (myid == 0) GbSystem3D::writeGeoObject(addWallYmin.get(), pathname+"/geo/addWallYmin", WbWriterVtkXmlASCII::getInstance());
+
+         GbCuboid3DPtr addWallZmin(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_minX3));
+         if (myid == 0) GbSystem3D::writeGeoObject(addWallZmin.get(), pathname+"/geo/addWallZmin", WbWriterVtkXmlASCII::getInstance());
+
+         GbCuboid3DPtr addWallYmax(new GbCuboid3D(g_minX1-blockLength, g_maxX2, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength));
+         if (myid == 0) GbSystem3D::writeGeoObject(addWallYmax.get(), pathname+"/geo/addWallYmax", WbWriterVtkXmlASCII::getInstance());
+
+         GbCuboid3DPtr addWallZmax(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_maxX3, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength));
+         if (myid == 0) GbSystem3D::writeGeoObject(addWallZmax.get(), pathname+"/geo/addWallZmax", WbWriterVtkXmlASCII::getInstance());
+
+
+         //inflow
+         GbCuboid3DPtr geoInflow(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3-blockLength, g_minX1, g_maxX2+blockLength, g_maxX3+blockLength));
+         if (myid == 0) GbSystem3D::writeGeoObject(geoInflow.get(), pathname + "/geo/geoInflow", WbWriterVtkXmlASCII::getInstance());
+
+         //outflow
+         GbCuboid3DPtr geoOutflow(new GbCuboid3D(g_maxX1, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength));
+         if (myid == 0) GbSystem3D::writeGeoObject(geoOutflow.get(), pathname + "/geo/geoOutflow", WbWriterVtkXmlASCII::getInstance());
+
+         WriteBlocksCoProcessorPtr ppblocks(new WriteBlocksCoProcessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm));
+
+         //PM interactor
+         BCAdapterPtr noSlipBCAdapter(new NoSlipBCAdapter());
+         noSlipBCAdapter->setBcAlgorithm(BCAlgorithmPtr(new ThinWallNoSlipBCAlgorithm()));
+         D3Q27InteractorPtr sampleInt(new D3Q27Interactor(sample, grid, noSlipBCAdapter, Interactor3D::SOLID));
+
+         //wall interactors
+         D3Q27InteractorPtr addWallYminInt(new D3Q27Interactor(addWallYmin, grid, noSlipBCAdapter, Interactor3D::SOLID));
+         D3Q27InteractorPtr addWallZminInt(new D3Q27Interactor(addWallZmin, grid, noSlipBCAdapter, Interactor3D::SOLID));
+         D3Q27InteractorPtr addWallYmaxInt(new D3Q27Interactor(addWallYmax, grid, noSlipBCAdapter, Interactor3D::SOLID));
+         D3Q27InteractorPtr addWallZmaxInt(new D3Q27Interactor(addWallZmax, grid, noSlipBCAdapter, Interactor3D::SOLID));
+
+         BCAdapterPtr denBCAdapterInflow(new DensityBCAdapter(rhoLBinflow));
+         denBCAdapterInflow->setBcAlgorithm(BCAlgorithmPtr(new EqDensityBCAlgorithm()));
+         D3Q27InteractorPtr inflowInt = D3Q27InteractorPtr(new D3Q27Interactor(geoInflow, grid, denBCAdapterInflow, Interactor3D::SOLID));
+
+         //outflow
+         BCAdapterPtr denBCAdapterOutflow(new DensityBCAdapter(rho_LB));
+         denBCAdapterOutflow->setBcAlgorithm(BCAlgorithmPtr(new EqDensityBCAlgorithm()));
+         D3Q27InteractorPtr outflowInt = D3Q27InteractorPtr(new D3Q27Interactor(geoOutflow, grid, denBCAdapterOutflow, Interactor3D::SOLID));
+
+         
+         UBLOG(logINFO, "PID = " << myid << " Hostname: " << machinename);
+         UBLOG(logINFO, "PID = " << myid << " Total Physical Memory (RAM): " << Utilities::getTotalPhysMem());
+         UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used: " << Utilities::getPhysMemUsed());
+         UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe());
+
+
+         ////////////////////////////////////////////
+         //METIS
+         Grid3DVisitorPtr metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::BSW, MetisPartitioner::RECURSIVE));
+         ////////////////////////////////////////////
+         //Zoltan
+         //Grid3DVisitorPtr zoltanVisitor(new ZoltanPartitioningGridVisitor(comm, D3Q27System::BSW, 1));
+         //grid->accept(zoltanVisitor);
+
+         /////delete solid blocks
+         if (myid == 0) UBLOG(logINFO, "deleteSolidBlocks - start");
+         InteractorsHelper intHelper(grid, metisVisitor);
+         intHelper.addInteractor(addWallYminInt);
+         intHelper.addInteractor(addWallZminInt);
+         intHelper.addInteractor(addWallYmaxInt);
+         intHelper.addInteractor(addWallZmaxInt);
+         intHelper.addInteractor(inflowInt);
+         intHelper.addInteractor(outflowInt);
+         intHelper.addInteractor(sampleInt);
+         intHelper.selectBlocks();
+         if (myid == 0) UBLOG(logINFO, "deleteSolidBlocks - end");
+         //////////////////////////////////////
+
+         //set connectors
+         D3Q27InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor());
+         SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nu_LB, iProcessor);
+         grid->accept(setConnsVisitor);
+
+         //domain decomposition for threads
+         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
+         grid->accept(pqPartVisitor);
+
+         ppblocks->process(0);
+         ppblocks.reset();
+  
+
+         unsigned long nob = grid->getNumberOfBlocks();
+         int gl = 3;
+         unsigned long nodb = (blocknx1)* (blocknx2)* (blocknx3);
+         unsigned long nod = nob * (blocknx1)* (blocknx2)* (blocknx3);
+         unsigned long nodg = nob * (blocknx1 + gl) * (blocknx2 + gl) * (blocknx3 + gl);
+         double needMemAll = double(nodg*(27 * sizeof(double) + sizeof(int) + sizeof(float) * 4));
+         double needMem = needMemAll / double(comm->getNumberOfProcesses());
+
+         if (myid == 0)
+         {
+            UBLOG(logINFO, "Number of blocks = " << nob);
+            UBLOG(logINFO, "Number of nodes  = " << nod);
+            int minInitLevel = grid->getCoarsestInitializedLevel();
+            int maxInitLevel = grid->getFinestInitializedLevel();
+            for (int level = minInitLevel; level <= maxInitLevel; level++)
+            {
+               int nobl = grid->getNumberOfBlocks(level);
+               UBLOG(logINFO, "Number of blocks for level " << level << " = " << nobl);
+               UBLOG(logINFO, "Number of nodes for level " << level << " = " << nobl*nodb);
+            }
+            UBLOG(logINFO, "Necessary memory  = " << needMemAll << " bytes");
+            UBLOG(logINFO, "Necessary memory per process = " << needMem << " bytes");
+            UBLOG(logINFO, "Available memory per process = " << availMem << " bytes");
+         }
+
+         LBMKernelPtr kernel;
+         if (comm->getNumberOfProcesses()>1 && gridPrepare)
+         {
+            kernel = LBMKernelPtr(new IncompressibleCumulantLBMKernel(blocknx1, blocknx2, blocknx3, IncompressibleCumulantLBMKernel::NORMAL));
+         }
+         else
+         {
+            kernel = LBMKernelPtr(new VoidLBMKernel(blocknx1, blocknx2, blocknx3));
+         }
+
+         //BCProcessorPtr bcProc(new D3Q27ETBCProcessor());
+         BCProcessorPtr bcProc = BCProcessorPtr(new ThinWallBCProcessor());
+         kernel->setBCProcessor(bcProc);
+
+         SetKernelBlockVisitor kernelVisitor(kernel, nu_LB, availMem, needMem);
+         grid->accept(kernelVisitor);
+
+         //BC
+         intHelper.setBC();
+
+         if (comm->getNumberOfProcesses()>1 && gridPrepare)
+         {
+            BoundaryConditionBlockVisitor bcVisitor;
+            //bcVisitor.addBC('N', BCAlgorithmPtr(new NoSlipBCAlgorithm()));
+            //bcVisitor.addBC('I', BCAlgorithmPtr(new EqDensityBCAlgorithm()));
+            //bcVisitor.addBC('O', BCAlgorithmPtr(new EqDensityBCAlgorithm()));
+            bcVisitor.addBC(noSlipBCAdapter);
+            bcVisitor.addBC(denBCAdapterInflow);
+            bcVisitor.addBC(denBCAdapterOutflow);
+            grid->accept(bcVisitor);
+
+            //Press*1.6e8+(14.76-coordsX)/3.5*5000
+            //initialization of distributions
+            mu::Parser fct;
+            fct.SetExpr("(x1max-x1)/l*dp*3.0");
+            fct.DefineConst("dp", dp_LB);
+            fct.DefineConst("x1max", g_maxX1);
+            fct.DefineConst("l", g_maxX1-g_minX1);
+
+            InitDistributionsBlockVisitor initVisitor(nu_LB, rho_LB);
+            initVisitor.setRho(fct);
+            grid->accept(initVisitor);
+
+            //Postrozess
+            UbSchedulerPtr geoSch(new UbScheduler(1));
+            WriteBoundaryConditionsCoProcessorPtr ppgeo(
+               new WriteBoundaryConditionsCoProcessor(grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, comm));
+            ppgeo->process(0);
+            ppgeo.reset();
+         }
+
+
+         coord[0] = sample->getX1Minimum();
+         coord[1] = sample->getX2Minimum();
+         coord[2] = sample->getX3Minimum();
+         coord[3] = sample->getX1Maximum();
+         coord[4] = sample->getX2Maximum();
+         coord[5] = sample->getX3Maximum();
+
+         ////////////////////////////////////////////////////////
+         UbFileOutputASCII outf(pathname + "/checkpoints/coord.txt");
+         outf.writeDouble(deltax);
+         outf.writeDouble(coord[0]);
+         outf.writeDouble(coord[1]);
+         outf.writeDouble(coord[2]);
+         outf.writeDouble(coord[3]);
+         outf.writeDouble(coord[4]);
+         outf.writeDouble(coord[5]);
+         outf.writeDouble(g_minX1);
+         outf.writeDouble(g_maxX1);
+         outf.writeDouble(availMem);
+         outf.writeDouble(needMem);
+         ////////////////////////////////////////////////////////
+
+         grid->addInteractor(inflowInt);
+
+
+         if (myid == 0) UBLOG(logINFO, "Preprozess - end");
+
+         if (comm->getNumberOfProcesses() == 1 && gridPrepare)
+         {
+            UBLOG(logINFO, "Prepare grid - start");
+            rp.writeDistributedGrid(grid, numOfParts);
+            UBLOG(logINFO, "Prepare grid - end");
+            return;
+         }
+      }
+      else
+      {
+         ////////////////////////////////////////////////////////
+         UbFileInputASCII inf(pathname+"/checkpoints/coord.txt");
+         deltax   = inf.readDouble();
+         coord[0] = inf.readDouble();
+         coord[1] = inf.readDouble();
+         coord[2] = inf.readDouble();
+         coord[3] = inf.readDouble();
+         coord[4] = inf.readDouble();
+         coord[5] = inf.readDouble();
+         double g_minX1 = inf.readDouble();
+         double g_maxX1 = inf.readDouble();
+         double availMem = inf.readDouble();
+         double needMem = inf.readDouble();
+         ////////////////////////////////////////////////////////
+
+         if (flowInit)
+         {
+            grid->setRank(myid);
+            LBMKernelPtr kernel = LBMKernelPtr(new IncompressibleCumulantLBMKernel(blocknx1, blocknx2, blocknx3, IncompressibleCumulantLBMKernel::NORMAL));
+            BCProcessorPtr bcProc(new BCProcessor());
+            kernel->setBCProcessor(bcProc);
+            SetKernelBlockVisitor kernelVisitor(kernel, nu_LB, availMem, needMem, SetKernelBlockVisitor::ChangeKernelWithData);
+            grid->accept(kernelVisitor);
+
+            BoundaryConditionBlockVisitor bcVisitor;
+            grid->accept(bcVisitor);
+            
+            UbSchedulerPtr geoSch(new UbScheduler(1));
+            WriteBoundaryConditionsCoProcessor pp(grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, comm);
+            pp.process(0);
+
+            //Press*1.6e8+(14.76-coordsX)/3.5*5000
+            //initialization of distributions
+            mu::Parser fct;
+            fct.SetExpr("(x1max-x1)/l*dp*3.0");
+            fct.DefineConst("dp", dp_LB);
+            fct.DefineConst("x1max", g_maxX1);
+            fct.DefineConst("l", g_maxX1-g_minX1);
+
+            InitDistributionsBlockVisitor initVisitor(nu_LB, rho_LB);
+            initVisitor.setRho(fct);
+            initVisitor.setVx1(vx1);
+            initVisitor.setVx1(vx2);
+            initVisitor.setVx1(vx3);
+            grid->accept(initVisitor);
+         }
+
+         //new nu
+         if (newViscosity)
+         {
+            ViscosityBlockVisitor nuVisitor(nu_LB);
+            grid->accept(nuVisitor);
+         }
+
+         //new dp
+         if (newPressure)
+         {
+            Grid3D::Interactor3DSet interactors = grid->getInteractors();
+            interactors[0]->setGrid3D(grid);
+            boost::dynamic_pointer_cast<D3Q27Interactor>(interactors[0])->deleteBCAdapter();
+            BCAdapterPtr denBCAdapterFront(new DensityBCAdapter(rhoLBinflow));
+            denBCAdapterFront->setBcAlgorithm(BCAlgorithmPtr(new EqDensityBCAlgorithm()));
+            boost::dynamic_pointer_cast<D3Q27Interactor>(interactors[0])->addBCAdapter(denBCAdapterFront);
+            interactors[0]->updateInteractor();
+         }
+
+         if (myid == 0)
+         {
+	         UBLOG(logINFO, "Parameters:");
+	         UBLOG(logINFO, "rho_LB = " << rho_LB);
+	         UBLOG(logINFO, "nu_LB = " << nu_LB);
+	         UBLOG(logINFO, "dp_LB = " << dp_LB);
+	         UBLOG(logINFO, "dx = " << deltax << " m");
+         }
+
+         //set connectors
+         D3Q27InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor());
+         SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nu_LB, iProcessor);
+         grid->accept(setConnsVisitor);
+
+         if (myid == 0) UBLOG(logINFO, "Restart - end");
+      }
+      UbSchedulerPtr nupsSch(new UbScheduler(nupsStep[0], nupsStep[1], nupsStep[2]));
+      //nupsSch->addSchedule(nupsStep[0], nupsStep[1], nupsStep[2]);
+      NUPSCounterCoProcessor npr(grid, nupsSch, numOfThreads, comm);
+
+      UbSchedulerPtr stepSch(new UbScheduler(outTime));
+
+      WriteMacroscopicQuantitiesCoProcessor pp(grid, stepSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, comm);
+
+      deltax = grid->getDeltaX(baseLevel);
+      double dxd2 = deltax / 2.0;
+
+      IntegrateValuesHelperPtr ih1(new IntegrateValuesHelper(grid, comm, coord[0] - dxd2*10.0, coord[1] - dxd2, coord[2] - dxd2,
+         coord[0] - dxd2*10.0 - 2.0*dxd2, coord[4] + dxd2, coord[5] + dxd2));
+
+      //D3Q27IntegrateValuesHelperPtr ih2(new D3Q27IntegrateValuesHelper(grid, comm, coord[3]/2.0, coord[1] - dxd2, coord[2] - dxd2,
+      //   coord[3]/2.0 + 2.0*dxd2, coord[4] + dxd2, coord[5] + dxd2));
+      IntegrateValuesHelperPtr ih2(new IntegrateValuesHelper(grid, comm, coord[0], coord[1], coord[2], coord[3], coord[4], coord[5]));
+
+      IntegrateValuesHelperPtr ih3(new IntegrateValuesHelper(grid, comm, coord[3] + dxd2*10.0, coord[1] - dxd2, coord[2] - dxd2,
+         coord[3] + dxd2*10.0 + 2.0*dxd2, coord[4] + dxd2, coord[5] + dxd2));
+
+      //D3Q27IntegrateValuesHelperPtr ih1(new D3Q27IntegrateValuesHelper(grid, comm, coord[0], coord[1], coord[2], coord[3], coord[4], coord[5]));
+      if (myid == 0) GbSystem3D::writeGeoObject(ih1->getBoundingBox().get(), pathname + "/geo/ih1", WbWriterVtkXmlBinary::getInstance());
+      if (myid == 0) GbSystem3D::writeGeoObject(ih2->getBoundingBox().get(), pathname + "/geo/ih2", WbWriterVtkXmlBinary::getInstance());
+      if (myid == 0) GbSystem3D::writeGeoObject(ih3->getBoundingBox().get(), pathname + "/geo/ih3", WbWriterVtkXmlBinary::getInstance());
+
+      double factorp = 1; // dp_real / dp_LB;
+      double factorv = 1;// dx / dt;
+      UbSchedulerPtr stepMV(new UbScheduler(timeSeriesOutTime));
+      
+      TimeseriesCoProcessor tsp1(grid, stepMV, ih1, pathname+timeSeriesFile+"_1", comm);
+      TimeseriesCoProcessor tsp2(grid, stepMV, ih2, pathname+timeSeriesFile+"_2", comm);
+      TimeseriesCoProcessor tsp3(grid, stepMV, ih3, pathname+timeSeriesFile+"_3", comm);
+
+      if (myid == 0)
+      {
+         UBLOG(logINFO, "PID = " << myid << " Total Physical Memory (RAM): " << Utilities::getTotalPhysMem());
+         UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used: " << Utilities::getPhysMemUsed());
+         UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe());
+      }
+
+      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, stepMV));
+      if (myid == 0) UBLOG(logINFO, "Simulation-start");
+      calculation->calculate();
+      if (myid == 0) UBLOG(logINFO, "Simulation-end");
+   }
+   catch (exception& e)
+   {
+      cerr << e.what() << endl << flush;
+   }
+   catch (string& s)
+   {
+      cerr << s << endl;
+   }
+   catch (...)
+   {
+      cerr << "unknown exception" << endl;
+   }
+
+}
+//////////////////////////////////////////////////////////////////////////
+int main(int argc, char* argv[])
+{
+
+   if (argv!=NULL)
+   {
+      if (argv[1]!=NULL)
+      {
+         run(string(argv[1]));
+      }
+      else
+      {
+         cout<<"Configuration file is missing!"<<endl;
+      }
+   }
+
+   return 0;
+}
diff --git a/apps/cpu/aperm/configBombadil2.txt b/apps/cpu/aperm/configBombadil2.txt
index 2b88a2fd94769d5ad3fb702f9ec4ed24081c7bf7..4e79ff63f0f6d1c6b14333bbd2e9b18ee25cf760 100644
--- a/apps/cpu/aperm/configBombadil2.txt
+++ b/apps/cpu/aperm/configBombadil2.txt
@@ -1,90 +1,90 @@
-pathname = d:/temp/aperm5
-pathGeo = d:/Projects/SFB880/GeometrienPoroeseMedien/isotrop/PA80-110
-#pathGeo = d:/Projects/SFB880/GeometrienPoroeseMedien/isotrop/SBP120
-numOfThreads = 4
-availMem = 5e9
-logToFile = false
-
-#poroeses Medium
-rawFile = false
-sampleFilename = /alu_80-110.vti
-#sampleFilename = /SBP120s500_center.vti
-#sampleFilename = /Sinterbronze_SBP120_1358x1376x1572_new.raw
-
-#sampleFilename = /1.raw
-
-#Diminsion in Voxel
-pmNX1 = 200
-pmNX2 = 200
-pmNX3 = 200
-
-#pmNX1 = 500
-#pmNX2 = 500
-#pmNX3 = 500
-
-#pmNX1 = 1358
-#pmNX2 = 1376
-#pmNX3 = 1572
-
-
-#Threshold
-lthreshold = 29041
-uthreshold = 65535
-
-#lthreshold = 38370
-
-#Diminsion in m
-pmL1 = 0.726e-3
-pmL2 = 0.75e-3
-pmL3 = 0.786e-3
-
-pmDeltas = true
-
-#deltas [m]
-pmDeltaX1 = 3.6e-6
-pmDeltaX2 = 3.6e-6
-pmDeltaX3 = 3.6e-6
-
-#pmDeltaX1 = 3.75e-6
-#pmDeltaX2 = 3.75e-6
-#pmDeltaX3 = 3.75e-6
-
-yDir = false
-zDir = false
-
-#grid
-blocknx = 95
-nx3 = 5
-deltax = 10e-6
-spongeLayer=false
-
-#physic
-newPressure = false
-dp_LB = 1e-6
-
-newViscosity = false
-nu_LB = 0.0005
-
-vx1=0
-vx2=0
-vx3=0
-
-timeSeriesFile = /timeseries/1
-timeSeriesOutTime = 100
-
-nupsStep = 10000 10000 10000000
-
-restartStepStart = 240000
-
-newStart    = false
-restartStep = 10
-
-cpStep      = 20
-cpStepStart = 20
-
-outTimeStart = 0
-outTimeStep = 1
-
-endTime = 20
-
-
+pathname = d:/temp/aperm5
+pathGeo = d:/Projects/SFB880/GeometrienPoroeseMedien/isotrop/PA80-110
+#pathGeo = d:/Projects/SFB880/GeometrienPoroeseMedien/isotrop/SBP120
+numOfThreads = 4
+availMem = 5e9
+logToFile = false
+
+#poroeses Medium
+rawFile = false
+sampleFilename = /alu_80-110.vti
+#sampleFilename = /SBP120s500_center.vti
+#sampleFilename = /Sinterbronze_SBP120_1358x1376x1572_new.raw
+
+#sampleFilename = /1.raw
+
+#Diminsion in Voxel
+pmNX1 = 200
+pmNX2 = 200
+pmNX3 = 200
+
+#pmNX1 = 500
+#pmNX2 = 500
+#pmNX3 = 500
+
+#pmNX1 = 1358
+#pmNX2 = 1376
+#pmNX3 = 1572
+
+
+#Threshold
+lthreshold = 29041
+uthreshold = 65535
+
+#lthreshold = 38370
+
+#Diminsion in m
+pmL1 = 0.726e-3
+pmL2 = 0.75e-3
+pmL3 = 0.786e-3
+
+pmDeltas = true
+
+#deltas [m]
+pmDeltaX1 = 3.6e-6
+pmDeltaX2 = 3.6e-6
+pmDeltaX3 = 3.6e-6
+
+#pmDeltaX1 = 3.75e-6
+#pmDeltaX2 = 3.75e-6
+#pmDeltaX3 = 3.75e-6
+
+yDir = false
+zDir = false
+
+#grid
+blocknx = 95
+nx3 = 5
+deltax = 10e-6
+spongeLayer=false
+
+#physic
+newPressure = false
+dp_LB = 1e-6
+
+newViscosity = false
+nu_LB = 0.0005
+
+vx1=0
+vx2=0
+vx3=0
+
+timeSeriesFile = /timeseries/1
+timeSeriesOutTime = 100
+
+nupsStep = 10000 10000 10000000
+
+restartStepStart = 240000
+
+newStart    = false
+restartStep = 10
+
+cpStep      = 20
+cpStepStart = 20
+
+outTimeStart = 0
+outTimeStep = 1
+
+endTime = 20
+
+
diff --git a/apps/cpu/aperm/configBombadilSBP120s500.txt b/apps/cpu/aperm/configBombadilSBP120s500.txt
index 2b91e335d00219b7c10566d4e2fb65de81df7dd2..3a07c4d9803771aeba821a26d3de6fc048690e81 100644
--- a/apps/cpu/aperm/configBombadilSBP120s500.txt
+++ b/apps/cpu/aperm/configBombadilSBP120s500.txt
@@ -1,50 +1,50 @@
-#
-#Simulation parameters for determitatoin of permeability
-#SBP120
-
-pathname = d:/temp/perm
-pathGeo = d:/Projects/SFB880/GeometrienPoroeseMedien/isotrop/SBP120
-numOfThreads = 4
-availMem = 3e9
-logToFile = false
-
-#porous media
-rawFile = false
-sampleFilename = /SBP120s500_center_closed.vti
-
-#diminsions [voxel]
-pmNX1 = 500
-pmNX2 = 500
-pmNX3 = 500
-
-#threshold
-#lthreshold = 38370
-#uthreshold = 65535
-lthreshold = 1
-uthreshold = 1
-
-
-#diminsions [m]
-pmL1 = 1.87e-3
-pmL2 = 1.87e-3
-pmL3 = 1.87e-3
-
-#grid
-#blocknx = 30
-#nx3 = 5
-blocknx = 50
-nx3 = 10
-spongeLayer=false
-
-#physic
-dp_LB = 1e-7
-nu_LB = 0.01
-
-timeSeriesFile = /timeseries/simSBP120_1
-timeSeriesOutTime = 10
-
-restartStep = 200
-restartStepStart=200
-
-endTime = 60000
-outTime = 100
+#
+#Simulation parameters for determitatoin of permeability
+#SBP120
+
+pathname = d:/temp/perm
+pathGeo = d:/Projects/SFB880/GeometrienPoroeseMedien/isotrop/SBP120
+numOfThreads = 4
+availMem = 3e9
+logToFile = false
+
+#porous media
+rawFile = false
+sampleFilename = /SBP120s500_center_closed.vti
+
+#diminsions [voxel]
+pmNX1 = 500
+pmNX2 = 500
+pmNX3 = 500
+
+#threshold
+#lthreshold = 38370
+#uthreshold = 65535
+lthreshold = 1
+uthreshold = 1
+
+
+#diminsions [m]
+pmL1 = 1.87e-3
+pmL2 = 1.87e-3
+pmL3 = 1.87e-3
+
+#grid
+#blocknx = 30
+#nx3 = 5
+blocknx = 50
+nx3 = 10
+spongeLayer=false
+
+#physic
+dp_LB = 1e-7
+nu_LB = 0.01
+
+timeSeriesFile = /timeseries/simSBP120_1
+timeSeriesOutTime = 10
+
+restartStep = 200
+restartStepStart=200
+
+endTime = 60000
+outTime = 100
diff --git a/apps/cpu/aperm/config_HLRS_SBP120.cfg b/apps/cpu/aperm/config_HLRS_SBP120.cfg
index 54ceee42016bd06904a472fedccb35c68bbb06be..720302622a33d7cb8119e66c82a0992383da511e 100644
--- a/apps/cpu/aperm/config_HLRS_SBP120.cfg
+++ b/apps/cpu/aperm/config_HLRS_SBP120.cfg
@@ -1,43 +1,43 @@
-#HLRS
-#Simulation parameters for determitatoin of permeability
-#SBP120
-
-pathname = /univ_1/ws1/ws/xrmkuchr-perm-0/SBP120
-pathGeo = /univ_1/ws1/ws/xrmkuchr-perm-0/SBP120/Data
-numOfThreads = 24
-availMem = 128e9
-logToFile = true
-#porous media
-rawFile = false
-sampleFilename = /Sinterbronze_SBP120_1358x1376x1572.raw
-
-#diminsions [voxel]
-pmNX1 = 1358
-pmNX2 = 1376
-pmNX3 = 1572
-
-#threshold
-lthreshold = 38370
-uthreshold = 65535
-
-#diminsions [m]
-pmL1 = 5092499.73e-9
-pmL2 = 5159999.85e-9
-pmL3 = 5894999.98e-9
-
-#grid
-blocknx = 64
-nx3 = 22
-
-#physic
-dp_LB = 1e-7
-nu_LB = 0.01
-
-timeSeriesFile = /timeseries/simSBP120_1
-timeSeriesOutTime = 100
-
-restartStep = 1000
-restartStepStart=1000
-
-endTime = 2000
-outTime = 1000
+#HLRS
+#Simulation parameters for determitatoin of permeability
+#SBP120
+
+pathname = /univ_1/ws1/ws/xrmkuchr-perm-0/SBP120
+pathGeo = /univ_1/ws1/ws/xrmkuchr-perm-0/SBP120/Data
+numOfThreads = 24
+availMem = 128e9
+logToFile = true
+#porous media
+rawFile = false
+sampleFilename = /Sinterbronze_SBP120_1358x1376x1572.raw
+
+#diminsions [voxel]
+pmNX1 = 1358
+pmNX2 = 1376
+pmNX3 = 1572
+
+#threshold
+lthreshold = 38370
+uthreshold = 65535
+
+#diminsions [m]
+pmL1 = 5092499.73e-9
+pmL2 = 5159999.85e-9
+pmL3 = 5894999.98e-9
+
+#grid
+blocknx = 64
+nx3 = 22
+
+#physic
+dp_LB = 1e-7
+nu_LB = 0.01
+
+timeSeriesFile = /timeseries/simSBP120_1
+timeSeriesOutTime = 100
+
+restartStep = 1000
+restartStepStart=1000
+
+endTime = 2000
+outTime = 1000
diff --git a/apps/cpu/bKanal/bKanal.cpp b/apps/cpu/bKanal/bKanal.cpp
index b1bff75b08f2ff6989f02dd8ee7f58ada48263ba..b6ee71f79963d0c2e6336cbe2455babba6b3cea2 100644
--- a/apps/cpu/bKanal/bKanal.cpp
+++ b/apps/cpu/bKanal/bKanal.cpp
@@ -1,565 +1,565 @@
-
-
-#include <iostream>
-#include <string>
-#include <math.h> 
-
-#include <sys/types.h> //mkdir rights
-#include <sys/stat.h> //mkdir
-#include <vfluids.h>
-
-using namespace std;
-
-
-void run(const char *cstr)
-{
-   try
-   {
-      string pathname; 
-      string pathnameRestart;
-      int numOfThreads =1;
-      bool logfile = false;
-      stringstream logFilename;
-      double availMem = 0;
-
-      UbLog::reportingLevel() = logINFO;
-
-      CommunicatorPtr comm = MPICommunicator::getInstance();
-      int myid = comm->getProcessID();
-
-      string machine = string(cstr);
-
-      if(machine == "my") 
-      {
-         pathname = "d:/temp/BKanal";
-         numOfThreads = 1;
-         logfile = false;
-         availMem = 10.0e9;
-      }
-      else if(machine == "Ludwig")      
-      {
-         pathname =        "/work/koskuche/SFB880/BKanal";
-         pathnameRestart = "/work/koskuche/SFB880/BKanal";
-         numOfThreads = 8;
-         availMem = 1.0e9;
-         logfile = true;
-
-         if (myid==0) 
-         {
-            const char* str = pathname.c_str();
-#if defined(__unix__)
-            int status=mkdir(str, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
-#endif 
-         }
-
-         if(myid ==0)
-         {
-            logFilename <<  pathname + "/logfile"+UbSystem::toString(UbSystem::getTimeStamp())+"_"+UbSystem::toString(myid)+".txt";
-         }
-
-      }
-      else throw UbException(UB_EXARGS, "unknown CAB_MACHINE");
-
-      if(myid ==0 && logfile)
-      {
-         UbLog::output_policy::setStream(logFilename.str());
-      }
-
-      UBLOG(logINFO,"Testcase BreugemChannel");
-
-      int baseLevel, refineLevel,nx[3],blocknx[3];
-      double Re,velocity,rhoInit,vx1Init;//,vx2Init,vx3Init;
-
-      //////////////////////////////////////////////////////////////////////////
-      //physik
-      //////////////////////////////////////////////////////////////////////////
-      Re            = 5500;// 13286;//13286;//gemessen 18.98 m/s...*5.0 zum  testen ob was passiert
-      velocity      = 0.01;  
-      vx1Init       = 0.01;  
-      rhoInit       = 0.0;
-      SimulationParametersPtr param = SimulationParameters::getInstanz();
-
-      int H=200;//200;//392;
-
-      //  nx[0]      =8;//ok mit 8// (int)(3.0*(double)H/8.0/8.0);//2;// (int)(0.3*(double)H/6.0/4.0);//das "/4" hier ist wegen der verfeinerung da! //länge
-      //  nx[1]      =8;//ok mit 8// (int)(2.0*(double)H/8.0/8.0);//2;// (int)(0.2*(double)H/6.0/4.0);//  //breite
-      nx[2]      = (int)(2.0*(double)H/5.0/8.0);// //höhe gebiet
-
-      //(3/2/2)-ratio:
-      nx[1]=nx[2];
-      nx[0]=15;
-
-      blocknx[0] = 15;//10;//5;
-      blocknx[1] = 15;//10;//5;
-      blocknx[2] = 15;//10;//5;
-
-      baseLevel   = 0;
-      refineLevel = 2;//1;////3;//3 soll 1 test;
-
-      ///////////////Weltabmessungen:
-      //double kanallaengeSI = ( 2.0*(double)H);
-      // double kanalbreiteSI = ( 1.0*(double)H);
-      double kanalhoeheSI  = ( 2.0*(double)H);
-
-      // double refinewidth1=kanalhoeheSI/10.0;
-
-      double fineNodeDx   = (kanalhoeheSI) / (double)( blocknx[2]*nx[2]*(1<<refineLevel)+1 ); //+1--> gitter liegt jeweils 0.5dx innerhalb
-      double coarseNodeDx = fineNodeDx * (double)(1<<refineLevel);//geowerte
-
-      double blockLengthx1 = blocknx[0]*coarseNodeDx; //geowerte
-      double blockLengthx2 = blockLengthx1;
-      double blockLengthx3 = blockLengthx1;
-
-      double originX1 = 0.0;//-50.0*propellerDurchmesser;  //geowerte
-      double originX2 = 0.0;//-0.5*blockLengthx2*nx2;
-      double originX3 = 0.0;// minX3 + 0.5*fineNodeDx;
-
-      double geoLength[]   = {  nx[0]*blockLengthx1, nx[1]*blockLengthx2, nx[2]*blockLengthx3}; 
-
-      bool periodicx1 = true;
-      bool periodicx2 = true;
-      bool periodicx3 = false;
-
-
-      //##########################################################################
-      //## physical parameters
-      //##########################################################################
-      double smagorinskiConstant = 0.18;
-
-
-      double rhoLB         = 0.0;
-
-      double rhoReal       = 1.0;
-      double nueReal  = 1;//0.000016;//0.015;
-
-      double hReal         = blocknx[2]*nx[2];//H*0.9;//0.0105;//<-m     1.05;//Plattendicke in cm(! cm nicht m !)
-      double uReal         = Re*nueReal/hReal;
-
-      //##Machzahl:
-      //#Ma     = uReal/csReal
-      double csReal=343.0;
-      double Ma      = uReal/csReal;//Ma-Real!
-      //double csReal  = uReal/Ma;
-      double hLB     = hReal/coarseNodeDx;
-
-      //LBMUnitConverterPtr unitConverter = LBMUnitConverterPtr(new LBMUnitConverter(hReal, csReal, rhoReal, hLB));
-
-      LBMUnitConverterPtr unitConverter = LBMUnitConverterPtr(new LBMUnitConverter());
-      double uLB          = velocity;
-      double nuLB         = (uLB*hLB)/Re;
-
-      //double uLB           = uReal   * unitConverter->getFactorVelocityWToLb();
-      //double nueLB         = nueReal * unitConverter->getFactorViscosityWToLb();
-      //double timestep      = unitConverter->getFactorTimeLbToW(coarseNodeDx);
-
-      //velocity = uLB;
-      // double viscosity =nueLB*1000.0;
-
-      Grid3DPtr grid(new Grid3D(comm));
-
-      //////////////////////////////////////////////////////////////////////////
-      //restart
-      UbSchedulerPtr rSch(new UbScheduler(10000,10000,10000000));
-      RestartPostprocessor rp(grid, rSch, comm, pathname+"/checkpoints", RestartPostprocessor::BINARY);
-      grid = rp.restart(-1);
-      //////////////////////////////////////////////////////////////////////////
-
-       if (grid->getTimeStep() == 0)
-       {
-         //bounding box
-         double g_minX1 = originX1;
-         double g_minX2 = originX2;
-         double g_minX3 = originX3;
-
-         double g_maxX1 = originX1 + geoLength[0];
-         double g_maxX2 = originX2 + geoLength[1];
-         double g_maxX3 = originX3 + geoLength[2];
-
-         //set grid
-         grid->setDeltaX(coarseNodeDx);
-         grid->setBlockNX(blocknx[0], blocknx[1], blocknx[2]);
-         grid->setPeriodicX1(periodicx1);
-         grid->setPeriodicX2(periodicx2);
-         grid->setPeriodicX3(periodicx3);
-
-
-         GbObject3DPtr gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
-         if(myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), pathname+"/geo/gridCube", WbWriterVtkXmlASCII::getInstance());
-
-         GenBlocksGridVisitor genBlocks(gridCube);
-         grid->accept(genBlocks);
-
-
-
-         //bottom and top solid bc
-         //iteractors
-         int bbOption1 = 1; //0=simple Bounce Back, 1=quadr. BB
-         D3Q27BoundaryConditionAdapterPtr bcObst(new D3Q27NoSlipBCAdapter(bbOption1));
-         double geoOverlap = coarseNodeDx;
-         GbCuboid3DPtr bottomBCCuboid(new GbCuboid3D(originX1-geoOverlap, originX2-geoOverlap, originX3-geoOverlap, 
-            originX1+geoLength[0]+coarseNodeDx, originX2+geoLength[1]+geoOverlap, originX3));
-         if(myid == 0) GbSystem3D::writeGeoObject(bottomBCCuboid.get(), pathname+"/geo/bottomBCCuboid", WbWriterVtkXmlASCII::getInstance());
-         D3Q27InteractorPtr bottomBCInteractor(new D3Q27Interactor(bottomBCCuboid,grid,bcObst,Interactor3D::SOLID)); 
-
-         GbCuboid3DPtr topBCCuboid(new GbCuboid3D(originX1-geoLength[0]-coarseNodeDx, originX2-geoOverlap, originX3+geoLength[2],//-coarseNodeDx*0.5, 
-            originX1+geoLength[0]+coarseNodeDx, originX2+geoLength[1]+geoOverlap, originX3+geoLength[2]+geoOverlap));
-         if(myid == 0) GbSystem3D::writeGeoObject(topBCCuboid.get(), pathname+"/geo/topBCCuboid", WbWriterVtkXmlASCII::getInstance());
-         D3Q27InteractorPtr topBCInteractor(new D3Q27Interactor(topBCCuboid,grid,bcObst,Interactor3D::SOLID)); 
-         //grid->addAndInitInteractor( bottomBCInteractor ); 
-         // grid->addAndInitInteractor( topBCInteractor ); 
-         //////////////////////////////////////////////////////////////////////////
-         if(myid == 0)
-         {
-            UBLOG(logINFO, "*****************************************");
-            UBLOG(logINFO, "* Parameters                            *");
-            UBLOG(logINFO, "* Re            ="<<Re);
-            UBLOG(logINFO, "* Ma            ="<<Ma);
-            UBLOG(logINFO, "* uReal         ="<<uReal);
-            UBLOG(logINFO, "* nueReal       ="<<nueReal);
-            UBLOG(logINFO, "* nue           ="<<nuLB);
-            UBLOG(logINFO, "* velocity      ="<<uLB);
-            // UBLOG(logINFO, "* LX1 (world/LB)="<<kanallaengeSI<<"/"<<kanallaengeSI/coarseNodeDx);
-            //  UBLOG(logINFO, "* LX2 (world/LB)="<<kanalbreiteSI<<"/"<<kanalbreiteSI/coarseNodeDx);
-            UBLOG(logINFO, "* LX3 (world/LB)="<<kanalhoeheSI<<"/"<<kanalhoeheSI/coarseNodeDx);
-            UBLOG(logINFO, "* cdx           ="<<coarseNodeDx);
-            UBLOG(logINFO, "* fdx           ="<<fineNodeDx);
-            UBLOG(logINFO, "* dx_base       ="<<coarseNodeDx<<" == "<<coarseNodeDx);
-            UBLOG(logINFO, "* dx_refine     ="<<fineNodeDx<<" == "<<fineNodeDx );
-            UBLOG(logINFO, "* nx1/2/3       ="<<nx[0]<<"/"<<nx[1]<<"/"<<nx[2]);
-            UBLOG(logINFO, "* blocknx1/2/3  ="<<blocknx[0]<<"/"<<blocknx[1]<<"/"<<blocknx[2]);
-            UBLOG(logINFO, "* x2Periodic    ="<<periodicx2);
-            UBLOG(logINFO, "* x3Periodic    ="<<periodicx3);
-            UBLOG(logINFO, "*****************************************");
-/*            UBLOGML(logINFO, "UnitConverter:"<<unitConverter->toString());
-            UBLOG(logINFO, "*****************************************");  */   
-         }
-
-         if(myid == 0) UBLOG(logINFO,"Refinement - start");	
-
-         //////////////////////////////////////////////////////////////////////////
-         // refine
-         //////////////////////////////////////////////////////////////////////////
-         GbCuboid3DPtr wallsX1X2minRef3(new GbCuboid3D(  originX1-3.0*geoOverlap   , originX2-3.0*geoOverlap  , originX3-3.0*geoOverlap
-            , originX1+geoLength[0]+geoOverlap, originX2+geoOverlap+geoLength[1], kanalhoeheSI*0.6/*0.55*/));
-
-         GbCuboid3DPtr wallsX1X2minRef4(new GbCuboid3D(  originX1-3.0*geoOverlap   , originX2-3.0*geoOverlap  ,kanalhoeheSI*0.49
-            , originX1+geoLength[0]+geoOverlap, originX2+geoOverlap+geoLength[1], kanalhoeheSI*0.53));
-
-         GbCuboid3DPtr wallsX1X2maxRef2(new GbCuboid3D(  originX1-3.0*geoOverlap   , originX2-3.0*geoOverlap  ,kanalhoeheSI*0.9
-            , originX1+geoLength[0]+geoOverlap, originX2+geoOverlap+geoLength[1], originX3+geoOverlap+geoLength[2]));
-
-         GbCuboid3DPtr wallsX1X2maxRef1(new GbCuboid3D(  originX1-3.0*geoOverlap   , originX2-3.0*geoOverlap  ,kanalhoeheSI*0.95
-            , originX1+geoLength[0]+geoOverlap, originX2+geoOverlap+geoLength[1], originX3+geoOverlap+geoLength[2]));
-
-         if (refineLevel > 0)
-         {
-
-            RefineCrossAndInsideGbObjectHelper refineHelper(grid, refineLevel);
-            refineHelper.addGbObject(wallsX1X2minRef3, refineLevel-1);
-            refineHelper.addGbObject(wallsX1X2minRef4, refineLevel);
-            refineHelper.addGbObject(wallsX1X2maxRef2, refineLevel-1);
-            refineHelper.addGbObject(wallsX1X2maxRef1, refineLevel);
-
-            refineHelper.refine();
-            if(myid == 0) UBLOG(logINFO,"Refinement - end");	
-         }
-
-         ///interactoren
-         //int bbOption1 = 0; //0=simple Bounce Back, 1=quadr. BB
-         //D3Q27BoundaryConditionAdapterPtr bcObst(new D3Q27NoSlipBCAdapter(bbOption1));
-         ///////würfel unten version ende
-         ////////////////////////////////////////////////////////////////////////////////
-         ////////PM grid
-         //Temporär:
-         //double  H=1.0;
-
-         vector<D3Q27InteractorPtr> D3Q27InteractorPtrarray;
-         ////////////////////////////////////////////////////////////////////////////////
-         double inflowCubeDx = coarseNodeDx;///(double)(1<<inflowCubeLevel);
-         double dpCubes=(double)H/20.0;//100.0; //30zum testen 100real
-         double offsetZgrid=H+0.5*inflowCubeDx;
-         double epschoch1drittel= 0.928318;
-         double abstandIn=2.0*dpCubes;
-         double c1oAbst=1.0/abstandIn;
-         for (int Nflowdir=0;Nflowdir<((nx[0]*blocknx[0]*c1oAbst)*coarseNodeDx); Nflowdir++)
-         {
-            // for (int Nhorizon=((nx[2]*blocknx[2]*c1oAbst)*coarseNodeDx)*0.5-2; Nhorizon<((nx[2]*blocknx[2]*c1oAbst)*coarseNodeDx)*0.5-1-1; Nhorizon++)
-            // {
-            //  for (int Nhorizon=0;  Nhorizon<(((nx[2]*blocknx[2]+1)*c1oAbst)*coarseNodeDx)*0.1; Nhorizon++)//Nhorizon<((nx[2]*blocknx[2]*c1oAbst)*coarseNodeDx)*0.5; Nhorizon++)
-            for (int Nhorizon=0;  Nhorizon<(((nx[2]*blocknx[2]+1)*c1oAbst)*coarseNodeDx)*0.5-1; Nhorizon++)//Nhorizon<((nx[2]*blocknx[2]*c1oAbst)*coarseNodeDx)*0.5; Nhorizon++)
-
-            {
-               for (int Nspanw=0; Nspanw<((nx[1]*blocknx[1]*c1oAbst)*coarseNodeDx); Nspanw++)
-               {
-                  // stringstream ss;
-                  //     ss<<"cubeH"<<Nflowdir<<"x"<<Nhorizon<<"x"<<Nspanw;
-                  ////     //   //geoOrigin ist Mitte, nicht vordere Ecke -> korrigieren
-                  // int Nflowdir=1;
-                  //int Nhorizon=0;
-                  //int Nspanw=1;
-                  double xminCubes1=originX1+(Nflowdir*abstandIn)-0.5*dpCubes+0.5*inflowCubeDx+3.0*coarseNodeDx/pow(2.0,refineLevel-1);
-                  double xmaxCubes1=originX1+(Nflowdir*abstandIn)+0.5*dpCubes+0.5*inflowCubeDx+3.0*coarseNodeDx/pow(2.0,refineLevel-1);
-                  double xminCubes=std::max(xminCubes1,2.0*coarseNodeDx/pow(2.0,refineLevel));
-                  double xmaxCubes=std::min(xmaxCubes1,originX1+geoLength[0]-coarseNodeDx/pow(2.0,refineLevel));
-                  double yminCubes=std::max(originX2+(Nspanw*abstandIn)-0.5*dpCubes+0.5*inflowCubeDx+3.0*coarseNodeDx/pow(2.0,refineLevel-1),2.0*coarseNodeDx/pow(2.0,refineLevel));
-                  double ymaxCubes=std::min(originX2+(Nspanw*abstandIn)+0.5*dpCubes+0.5*inflowCubeDx+3.0*coarseNodeDx/pow(2.0,refineLevel-1),originX2+geoLength[1]-coarseNodeDx/pow(2.0,refineLevel));
-                  double zminCubes=std::max(originX3+(Nhorizon*abstandIn)+4.0*coarseNodeDx/pow(2.0,refineLevel-1),2.0*coarseNodeDx/pow(2.0,refineLevel));
-                  double zmaxCubes=std::min(originX3+(Nhorizon*abstandIn)+dpCubes+4.0*coarseNodeDx/pow(2.0,refineLevel-1),originX3+geoLength[2]-coarseNodeDx/pow(2.0,refineLevel));
-                  ////     /*GbCuboid3D  *rectTemp = new GbCuboid3D(originX1+(Nflowdir*abstandIn)-0.5*dpCubes+0.5*inflowCubeDx, originX2+(Nspanw*abstandIn)-0.5*dpCubes+0.5*inflowCubeDx, originX3+(Nhorizon*abstandIn)-0.5*dpCubes+0.5*inflowCubeDx, 
-                  ////										 originX1+(Nflowdir*abstandIn)+0.5*dpCubes+0.5*inflowCubeDx, originX2+(Nspanw*abstandIn)+0.5*dpCubes+0.5*inflowCubeDx, originX3+(Nhorizon*abstandIn)+0.5*dpCubes+0.5*inflowCubeDx );
-                  ////*/
-                  ////  
-                  GbCuboid3DPtr rectTemp(new GbCuboid3D(xminCubes, yminCubes, zminCubes, 
-                     xmaxCubes, ymaxCubes, zmaxCubes));
-                  ////
-                  //     ostringstream ostrcubes;
-                  //	 ostrcubes<<pathname <<"/cubeH"<<Nflowdir<<"x"<<Nhorizon<<"x"<<Nspanw;
-                  ////       
-                  ////   
-                  //// // GbSystem3D::writeGeoObject(rectTemp,outpath+cubeschar,WbWriterAvsASCII::getInstance());
-                  ////  GbSystem3D::writeGeoObject(rectTemp,ostrcubes.str(),WbWriterAvsASCII::getInstance()); //??
-                  //        ostrcubes.str("");
-                  //         ostrcubes.clear();
-
-                  ////  boost::shared_ptr<D3Q19AMRInteractor> interactorTemp( new D3Q19AMRInteractor( rectTemp,new D3Q19NoSlipBCAdapter(),AMR3DInteractor::SOLID,ss.str()) );
-                  //  //  interactorService.addInteractor(interactorTemp);
-                  D3Q27BoundaryConditionAdapterPtr cubeBCAdapter(new D3Q27NoSlipBCAdapter());                   //D3Q27DensityBCAdapter(rhoInit));
-                  D3Q27InteractorPtr cubeInteractor( new D3Q27Interactor(rectTemp,grid,cubeBCAdapter,Interactor3D::SOLID));
-                  D3Q27InteractorPtrarray.push_back(cubeInteractor);  
-
-
-               }
-            }}
-         ////////////////
-         //ende cubes
-         //////////
-         ////////////////////////////////////////////
-         //METIS
-         Grid3DVisitorPtr metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B));
-
-         ////////////////////////////////////////////
-         /////delete solid blocks
-         if(myid == 0) UBLOG(logINFO,"deleteSolidBlocks - start");
-         InteractorsHelper intHelper(grid, metisVisitor);
-         intHelper.addInteractor(topBCInteractor);
-         intHelper.addInteractor(bottomBCInteractor);
-         for(size_t i=0; i<D3Q27InteractorPtrarray.size(); ++i)
-         {
-            intHelper.addInteractor(D3Q27InteractorPtrarray[i]);
-         }
-         intHelper.selectBlocks();
-         if(myid == 0) UBLOG(logINFO,"deleteSolidBlocks - end");	 
-         //////////////////////////////////////
-
-         //domain decomposition for threads
-         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
-         grid->accept(pqPartVisitor);
-
-         unsigned long nob = grid->getNumberOfBlocks();
-         unsigned long nod = nob * blocknx[0]*blocknx[1]*blocknx[2];
-         unsigned long nod_real = nob * (blocknx[0]+3)*(blocknx[1]+3)*(blocknx[2]+3);
-
-         double needMemAll  = double(nod_real*(27*sizeof(double) + sizeof(int)));
-         double needMem  = needMemAll / double(comm->getNumberOfProcesses());
-
-         if(myid == 0)
-         {
-            UBLOG(logINFO,"Number of blocks = " << nob);
-            UBLOG(logINFO,"Number of nodes  = " << nod);
-            UBLOG(logINFO,"Necessary memory  = " << needMemAll  << " bytes");
-            UBLOG(logINFO,"Necessary memory per process = " << needMem  << " bytes");
-            UBLOG(logINFO,"Available memory per process = " << availMem << " bytes");
-         }
-
-         LBMKernel3DPtr kernel;
-         kernel = LBMKernel3DPtr(new LBMKernelETD3Q27CCLB(blocknx[0], blocknx[1], blocknx[2], LBMKernelETD3Q27CCLB::NORMAL));
-
-         // LBMKernel3DPtr kernel(new LBMKernelETD3Q27CascadedTI(blocknx[0], blocknx[1], blocknx[2]));
-         //LBMKernel3DPtr kernel(new LBMKernelETD3Q27BGK(blocknx[0], blocknx[1], blocknx[2],1));
-         BCProcessorPtr bcProc(new D3Q27ETBCProcessor());
-         kernel->setBCProcessor(bcProc);
-         //	  //scheint neuerdings fuer absturz zu sorgen:
-         mu::Parser fctForcingX1;
-         fctForcingX1.SetExpr("Fx1*dx");
-         fctForcingX1.DefineConst("Fx1", 0.6*5.0e-6);//9.99685e-7);
-
-         kernel->setForcingX1(fctForcingX1);
-         kernel->setWithForcing(true); 
-
-         SetKernelBlockVisitor kernelVisitor(kernel, nuLB, availMem, needMem);
-
-         grid->accept(kernelVisitor);
-
-         //////////////////////////////////
-         //undef nodes
-         if (refineLevel > 0)
-         {
-            D3Q27SetUndefinedNodesBlockVisitor undefNodesVisitor;
-            grid->accept(undefNodesVisitor);
-         }
-         //////////////////////////////////////////
-         intHelper.setBC();
-
-         for(size_t i=0; i<D3Q27InteractorPtrarray.size(); ++i)
-         {
-            grid->addAndInitInteractor( D3Q27InteractorPtrarray[i] ); 
-            char numstr[21];
-            sprintf(numstr, "%f", (double)i);
-            std::string pathObstCube = pathname+"/geo/obstBCCuboid"+ numstr;
-            if(myid == 0) GbSystem3D::writeGeoObject(D3Q27InteractorPtrarray[i]->getGbObject3D().get(),
-               /* rectTemp.get(),*/ pathObstCube, WbWriterVtkXmlASCII::getInstance());
-         }
-
-         UbTimer timer;
-         timer.start();
-         grid->accept( metisVisitor );
-
-         if(myid == 0) UBLOG(logINFO,"Write blocks - start");
-         BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname + "/grid/blocks", WbWriterVtkXmlBinary::getInstance(), comm));
-         if(myid == 0) ppblocks->update(0);
-         if(myid == 0) UBLOG(logINFO,"Write blocks - end");
-
-         if(myid == 0) UBLOG(logINFO,"Write blocks - start");
-         grid->accept( metisVisitor );
-         if(myid == 0) ppblocks->update(1);
-         ppblocks.reset();
-         if(myid == 0) UBLOG(logINFO,"Write blocks - end");
-
-         //inflow
-         double uLB2=uLB;
-         double raiseVelSteps = 0;
-         vector<D3Q27BCFunction> velcX1BCs,dummy;
-
-         mu::Parser inflowProfile;
-         inflowProfile.SetExpr("uLB*0.9"); 
-
-         inflowProfile.DefineConst("uLB",uLB2);
-         velcX1BCs.push_back(D3Q27BCFunction(inflowProfile,raiseVelSteps,D3Q27BCFunction::INFCONST));
-
-
-         //set connectors
-         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
-         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
-         grid->accept( setConnsVisitor );
-
-         //domain decomposition
-
-         //initialization of decompositions
-         D3Q27ETInitDistributionsBlockVisitor initVisitor( nuLB,rhoInit);
-         initVisitor.setVx1(inflowProfile);
-         grid->accept(initVisitor);
-
-         //Postrozess
-         //LBMUnitConverterPtr conv = LBMUnitConverterPtr(new LBMUnitConverter());
-
-         UbSchedulerPtr geoSch(new UbScheduler(1));
-         D3Q27MacroscopicQuantitiesPostprocessorPtr ppgeo(
-            new D3Q27MacroscopicQuantitiesPostprocessor(grid, geoSch, pathname + "/grid/nodes", WbWriterVtkXmlBinary::getInstance(), 
-            unitConverter,true));
-
-
-
-         grid->doPostProcess(0);
-         ppgeo.reset();
-         geoSch.reset();
-
-         if(myid == 0) UBLOG(logINFO,"Preprozess - end");      
-
-      }
-            else
-            {
-               //set forcing
-               mu::Parser fctForcingX1, fctForcingX2, fctForcingX3;
-               fctForcingX1.SetExpr("Fx1*dx");
-               fctForcingX1.DefineConst("Fx1", 0.6*5.0e-6);
-               SetForcingBlockVisitor forcingVisitor(fctForcingX1, fctForcingX2, fctForcingX3);
-               grid->accept(forcingVisitor);
-
-               //set connectors
-               D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
-               D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
-               grid->accept( setConnsVisitor );
-               if(myid == 0) UBLOG(logINFO,"Restart - end"); 
-      }
-
-
-      UbSchedulerPtr visSch(new UbScheduler());
-      //visSch->addSchedule(100,1,1000);
-      //visSch->addSchedule(1000,1000,10000);
-      //visSch->addSchedule(10000,10000,100000);
-      //visSch->addSchedule(20000,20000,800000);
-      //visSch->addSchedule(50,350000,350500);
-      //visSch->addSchedule(50,420000,420500);
-      //visSch->addSchedule(50000,420500,10000000);
-      visSch->addSchedule(2250,140000,450001);
-      UbSchedulerPtr resSch(new UbScheduler());
-      resSch->addSchedule(20000,20,10000000);
-      UbSchedulerPtr resSchRMS(new UbScheduler());
-      resSchRMS->addSchedule(40000,420000,10000000);
-      UbSchedulerPtr resSchMeans(new UbScheduler());
-      resSchMeans->addSchedule(40000,0,10000000);
-      UbSchedulerPtr stepAvSch(new UbScheduler());
-      stepAvSch->addSchedule(20,0,10000000);
-      AverageValuesPostprocessor Avpp(grid, pathname + "/steps/stepAV", WbWriterVtkXmlBinary::getInstance(), 
-                                      visSch/*wann wird rausgeschrieben*/, stepAvSch/*wann wird gemittelt*/, resSchMeans, resSchRMS/*wann wird resettet*/);
-
-      D3Q27MacroscopicQuantitiesPostprocessor pp(grid, visSch, pathname + "/steps/step", WbWriterVtkXmlBinary::getInstance(), unitConverter, comm);
-
-      UbSchedulerPtr nupsSch(new UbScheduler(10, 90050, 90080));
-      NUPSCounterPostprocessor npr(grid, nupsSch, pathname + "/results/nups.txt", comm);
-
-
-      UbSchedulerPtr AdjForcSch(new UbScheduler());
-      AdjForcSch->addSchedule(100,20,20000000);
-      D3Q27IntegrateValuesHelperPtr IntValHelp(new D3Q27IntegrateValuesHelper(grid, comm, 
-         originX1, originX2, kanalhoeheSI*0.55/*0.501*/, 
-         nx[0]*blockLengthx1, nx[1]*blockLengthx2, kanalhoeheSI*0.999));
-
-      double vxZiel=uLB;
-      //D3Q27AdjustForcingPostprocessor AdjForcPPPtr(grid, AdjForcSch,IntValHelp, vxZiel*0.6, comm);//da am 11.3.2013 velo um 1/0.6 zu hoch
-      D3Q27AdjustForcingPostprocessor AdjForcPPPtr(grid, AdjForcSch,IntValHelp, vxZiel, comm);//dies sollte zu Re=5500 fuehren..
-
-      UbSchedulerPtr visQSch(new UbScheduler());
-      visQSch->addSchedule(10,90100,90130);
-      QCriterionPostprocessor QKritPtr(grid,pathname+"/steps/Qq",WbWriterVtkXmlBinary::getInstance(),visQSch, comm);
-
-      mu::Parser decrViscFunc;
-      decrViscFunc.SetExpr("nue0+c0/(t+1)/(t+1)");
-      decrViscFunc.DefineConst("nue0", nuLB);
-      decrViscFunc.DefineConst("c0", 0.1);
-      UbSchedulerPtr DecrViscSch(new UbScheduler());
-      DecrViscSch->addSchedule(10,10,1000);
-      DecreaseViscosityPostprocessor decrViscPPPtr(grid, DecrViscSch,&decrViscFunc, comm);
-
-      cout << "PID = " << myid << " Total Physical Memory (RAM): " << Utilities::getTotalPhysMem()<<endl;
-      cout << "PID = " << myid << " Physical Memory currently used: " << Utilities::getPhysMemUsed()<<endl;
-      cout << "PID = " << myid << " Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe()<<endl;
-
-      double endTime = 2000000;//20000001;
-      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, visSch));
-      if(myid == 0) UBLOG(logINFO,"Simulation-start");
-      calculation->calculate();
-      if(myid == 0) UBLOG(logINFO,"Simulation-end");
-   }
-   catch(std::exception& e)
-   {
-      cerr << e.what() << endl << flush;
-   }
-   catch(std::string& s)
-   {
-      cerr << s << endl;
-   }
-   catch(...)
-   {
-      cerr << "unknown exception" << endl;
-   }
-
-}
-int main(int argc, char* argv[])
-{
-
-   run(argv[1]);
-
-   return 0;
-}
-
+
+
+#include <iostream>
+#include <string>
+#include <math.h> 
+
+#include <sys/types.h> //mkdir rights
+#include <sys/stat.h> //mkdir
+#include <vfluids.h>
+
+using namespace std;
+
+
+void run(const char *cstr)
+{
+   try
+   {
+      string pathname; 
+      string pathnameRestart;
+      int numOfThreads =1;
+      bool logfile = false;
+      stringstream logFilename;
+      double availMem = 0;
+
+      UbLog::reportingLevel() = logINFO;
+
+      CommunicatorPtr comm = MPICommunicator::getInstance();
+      int myid = comm->getProcessID();
+
+      string machine = string(cstr);
+
+      if(machine == "my") 
+      {
+         pathname = "d:/temp/BKanal";
+         numOfThreads = 1;
+         logfile = false;
+         availMem = 10.0e9;
+      }
+      else if(machine == "Ludwig")      
+      {
+         pathname =        "/work/koskuche/SFB880/BKanal";
+         pathnameRestart = "/work/koskuche/SFB880/BKanal";
+         numOfThreads = 8;
+         availMem = 1.0e9;
+         logfile = true;
+
+         if (myid==0) 
+         {
+            const char* str = pathname.c_str();
+#if defined(__unix__)
+            int status=mkdir(str, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
+#endif 
+         }
+
+         if(myid ==0)
+         {
+            logFilename <<  pathname + "/logfile"+UbSystem::toString(UbSystem::getTimeStamp())+"_"+UbSystem::toString(myid)+".txt";
+         }
+
+      }
+      else throw UbException(UB_EXARGS, "unknown CAB_MACHINE");
+
+      if(myid ==0 && logfile)
+      {
+         UbLog::output_policy::setStream(logFilename.str());
+      }
+
+      UBLOG(logINFO,"Testcase BreugemChannel");
+
+      int baseLevel, refineLevel,nx[3],blocknx[3];
+      double Re,velocity,rhoInit,vx1Init;//,vx2Init,vx3Init;
+
+      //////////////////////////////////////////////////////////////////////////
+      //physik
+      //////////////////////////////////////////////////////////////////////////
+      Re            = 5500;// 13286;//13286;//gemessen 18.98 m/s...*5.0 zum  testen ob was passiert
+      velocity      = 0.01;  
+      vx1Init       = 0.01;  
+      rhoInit       = 0.0;
+      SimulationParametersPtr param = SimulationParameters::getInstanz();
+
+      int H=200;//200;//392;
+
+      //  nx[0]      =8;//ok mit 8// (int)(3.0*(double)H/8.0/8.0);//2;// (int)(0.3*(double)H/6.0/4.0);//das "/4" hier ist wegen der verfeinerung da! //länge
+      //  nx[1]      =8;//ok mit 8// (int)(2.0*(double)H/8.0/8.0);//2;// (int)(0.2*(double)H/6.0/4.0);//  //breite
+      nx[2]      = (int)(2.0*(double)H/5.0/8.0);// //höhe gebiet
+
+      //(3/2/2)-ratio:
+      nx[1]=nx[2];
+      nx[0]=15;
+
+      blocknx[0] = 15;//10;//5;
+      blocknx[1] = 15;//10;//5;
+      blocknx[2] = 15;//10;//5;
+
+      baseLevel   = 0;
+      refineLevel = 2;//1;////3;//3 soll 1 test;
+
+      ///////////////Weltabmessungen:
+      //double kanallaengeSI = ( 2.0*(double)H);
+      // double kanalbreiteSI = ( 1.0*(double)H);
+      double kanalhoeheSI  = ( 2.0*(double)H);
+
+      // double refinewidth1=kanalhoeheSI/10.0;
+
+      double fineNodeDx   = (kanalhoeheSI) / (double)( blocknx[2]*nx[2]*(1<<refineLevel)+1 ); //+1--> gitter liegt jeweils 0.5dx innerhalb
+      double coarseNodeDx = fineNodeDx * (double)(1<<refineLevel);//geowerte
+
+      double blockLengthx1 = blocknx[0]*coarseNodeDx; //geowerte
+      double blockLengthx2 = blockLengthx1;
+      double blockLengthx3 = blockLengthx1;
+
+      double originX1 = 0.0;//-50.0*propellerDurchmesser;  //geowerte
+      double originX2 = 0.0;//-0.5*blockLengthx2*nx2;
+      double originX3 = 0.0;// minX3 + 0.5*fineNodeDx;
+
+      double geoLength[]   = {  nx[0]*blockLengthx1, nx[1]*blockLengthx2, nx[2]*blockLengthx3}; 
+
+      bool periodicx1 = true;
+      bool periodicx2 = true;
+      bool periodicx3 = false;
+
+
+      //##########################################################################
+      //## physical parameters
+      //##########################################################################
+      double smagorinskiConstant = 0.18;
+
+
+      double rhoLB         = 0.0;
+
+      double rhoReal       = 1.0;
+      double nueReal  = 1;//0.000016;//0.015;
+
+      double hReal         = blocknx[2]*nx[2];//H*0.9;//0.0105;//<-m     1.05;//Plattendicke in cm(! cm nicht m !)
+      double uReal         = Re*nueReal/hReal;
+
+      //##Machzahl:
+      //#Ma     = uReal/csReal
+      double csReal=343.0;
+      double Ma      = uReal/csReal;//Ma-Real!
+      //double csReal  = uReal/Ma;
+      double hLB     = hReal/coarseNodeDx;
+
+      //LBMUnitConverterPtr unitConverter = LBMUnitConverterPtr(new LBMUnitConverter(hReal, csReal, rhoReal, hLB));
+
+      LBMUnitConverterPtr unitConverter = LBMUnitConverterPtr(new LBMUnitConverter());
+      double uLB          = velocity;
+      double nuLB         = (uLB*hLB)/Re;
+
+      //double uLB           = uReal   * unitConverter->getFactorVelocityWToLb();
+      //double nueLB         = nueReal * unitConverter->getFactorViscosityWToLb();
+      //double timestep      = unitConverter->getFactorTimeLbToW(coarseNodeDx);
+
+      //velocity = uLB;
+      // double viscosity =nueLB*1000.0;
+
+      Grid3DPtr grid(new Grid3D(comm));
+
+      //////////////////////////////////////////////////////////////////////////
+      //restart
+      UbSchedulerPtr rSch(new UbScheduler(10000,10000,10000000));
+      RestartPostprocessor rp(grid, rSch, comm, pathname+"/checkpoints", RestartPostprocessor::BINARY);
+      grid = rp.restart(-1);
+      //////////////////////////////////////////////////////////////////////////
+
+       if (grid->getTimeStep() == 0)
+       {
+         //bounding box
+         double g_minX1 = originX1;
+         double g_minX2 = originX2;
+         double g_minX3 = originX3;
+
+         double g_maxX1 = originX1 + geoLength[0];
+         double g_maxX2 = originX2 + geoLength[1];
+         double g_maxX3 = originX3 + geoLength[2];
+
+         //set grid
+         grid->setDeltaX(coarseNodeDx);
+         grid->setBlockNX(blocknx[0], blocknx[1], blocknx[2]);
+         grid->setPeriodicX1(periodicx1);
+         grid->setPeriodicX2(periodicx2);
+         grid->setPeriodicX3(periodicx3);
+
+
+         GbObject3DPtr gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
+         if(myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), pathname+"/geo/gridCube", WbWriterVtkXmlASCII::getInstance());
+
+         GenBlocksGridVisitor genBlocks(gridCube);
+         grid->accept(genBlocks);
+
+
+
+         //bottom and top solid bc
+         //iteractors
+         int bbOption1 = 1; //0=simple Bounce Back, 1=quadr. BB
+         D3Q27BoundaryConditionAdapterPtr bcObst(new D3Q27NoSlipBCAdapter(bbOption1));
+         double geoOverlap = coarseNodeDx;
+         GbCuboid3DPtr bottomBCCuboid(new GbCuboid3D(originX1-geoOverlap, originX2-geoOverlap, originX3-geoOverlap, 
+            originX1+geoLength[0]+coarseNodeDx, originX2+geoLength[1]+geoOverlap, originX3));
+         if(myid == 0) GbSystem3D::writeGeoObject(bottomBCCuboid.get(), pathname+"/geo/bottomBCCuboid", WbWriterVtkXmlASCII::getInstance());
+         D3Q27InteractorPtr bottomBCInteractor(new D3Q27Interactor(bottomBCCuboid,grid,bcObst,Interactor3D::SOLID)); 
+
+         GbCuboid3DPtr topBCCuboid(new GbCuboid3D(originX1-geoLength[0]-coarseNodeDx, originX2-geoOverlap, originX3+geoLength[2],//-coarseNodeDx*0.5, 
+            originX1+geoLength[0]+coarseNodeDx, originX2+geoLength[1]+geoOverlap, originX3+geoLength[2]+geoOverlap));
+         if(myid == 0) GbSystem3D::writeGeoObject(topBCCuboid.get(), pathname+"/geo/topBCCuboid", WbWriterVtkXmlASCII::getInstance());
+         D3Q27InteractorPtr topBCInteractor(new D3Q27Interactor(topBCCuboid,grid,bcObst,Interactor3D::SOLID)); 
+         //grid->addAndInitInteractor( bottomBCInteractor ); 
+         // grid->addAndInitInteractor( topBCInteractor ); 
+         //////////////////////////////////////////////////////////////////////////
+         if(myid == 0)
+         {
+            UBLOG(logINFO, "*****************************************");
+            UBLOG(logINFO, "* Parameters                            *");
+            UBLOG(logINFO, "* Re            ="<<Re);
+            UBLOG(logINFO, "* Ma            ="<<Ma);
+            UBLOG(logINFO, "* uReal         ="<<uReal);
+            UBLOG(logINFO, "* nueReal       ="<<nueReal);
+            UBLOG(logINFO, "* nue           ="<<nuLB);
+            UBLOG(logINFO, "* velocity      ="<<uLB);
+            // UBLOG(logINFO, "* LX1 (world/LB)="<<kanallaengeSI<<"/"<<kanallaengeSI/coarseNodeDx);
+            //  UBLOG(logINFO, "* LX2 (world/LB)="<<kanalbreiteSI<<"/"<<kanalbreiteSI/coarseNodeDx);
+            UBLOG(logINFO, "* LX3 (world/LB)="<<kanalhoeheSI<<"/"<<kanalhoeheSI/coarseNodeDx);
+            UBLOG(logINFO, "* cdx           ="<<coarseNodeDx);
+            UBLOG(logINFO, "* fdx           ="<<fineNodeDx);
+            UBLOG(logINFO, "* dx_base       ="<<coarseNodeDx<<" == "<<coarseNodeDx);
+            UBLOG(logINFO, "* dx_refine     ="<<fineNodeDx<<" == "<<fineNodeDx );
+            UBLOG(logINFO, "* nx1/2/3       ="<<nx[0]<<"/"<<nx[1]<<"/"<<nx[2]);
+            UBLOG(logINFO, "* blocknx1/2/3  ="<<blocknx[0]<<"/"<<blocknx[1]<<"/"<<blocknx[2]);
+            UBLOG(logINFO, "* x2Periodic    ="<<periodicx2);
+            UBLOG(logINFO, "* x3Periodic    ="<<periodicx3);
+            UBLOG(logINFO, "*****************************************");
+/*            UBLOGML(logINFO, "UnitConverter:"<<unitConverter->toString());
+            UBLOG(logINFO, "*****************************************");  */   
+         }
+
+         if(myid == 0) UBLOG(logINFO,"Refinement - start");	
+
+         //////////////////////////////////////////////////////////////////////////
+         // refine
+         //////////////////////////////////////////////////////////////////////////
+         GbCuboid3DPtr wallsX1X2minRef3(new GbCuboid3D(  originX1-3.0*geoOverlap   , originX2-3.0*geoOverlap  , originX3-3.0*geoOverlap
+            , originX1+geoLength[0]+geoOverlap, originX2+geoOverlap+geoLength[1], kanalhoeheSI*0.6/*0.55*/));
+
+         GbCuboid3DPtr wallsX1X2minRef4(new GbCuboid3D(  originX1-3.0*geoOverlap   , originX2-3.0*geoOverlap  ,kanalhoeheSI*0.49
+            , originX1+geoLength[0]+geoOverlap, originX2+geoOverlap+geoLength[1], kanalhoeheSI*0.53));
+
+         GbCuboid3DPtr wallsX1X2maxRef2(new GbCuboid3D(  originX1-3.0*geoOverlap   , originX2-3.0*geoOverlap  ,kanalhoeheSI*0.9
+            , originX1+geoLength[0]+geoOverlap, originX2+geoOverlap+geoLength[1], originX3+geoOverlap+geoLength[2]));
+
+         GbCuboid3DPtr wallsX1X2maxRef1(new GbCuboid3D(  originX1-3.0*geoOverlap   , originX2-3.0*geoOverlap  ,kanalhoeheSI*0.95
+            , originX1+geoLength[0]+geoOverlap, originX2+geoOverlap+geoLength[1], originX3+geoOverlap+geoLength[2]));
+
+         if (refineLevel > 0)
+         {
+
+            RefineCrossAndInsideGbObjectHelper refineHelper(grid, refineLevel);
+            refineHelper.addGbObject(wallsX1X2minRef3, refineLevel-1);
+            refineHelper.addGbObject(wallsX1X2minRef4, refineLevel);
+            refineHelper.addGbObject(wallsX1X2maxRef2, refineLevel-1);
+            refineHelper.addGbObject(wallsX1X2maxRef1, refineLevel);
+
+            refineHelper.refine();
+            if(myid == 0) UBLOG(logINFO,"Refinement - end");	
+         }
+
+         ///interactoren
+         //int bbOption1 = 0; //0=simple Bounce Back, 1=quadr. BB
+         //D3Q27BoundaryConditionAdapterPtr bcObst(new D3Q27NoSlipBCAdapter(bbOption1));
+         ///////würfel unten version ende
+         ////////////////////////////////////////////////////////////////////////////////
+         ////////PM grid
+         //Temporär:
+         //double  H=1.0;
+
+         vector<D3Q27InteractorPtr> D3Q27InteractorPtrarray;
+         ////////////////////////////////////////////////////////////////////////////////
+         double inflowCubeDx = coarseNodeDx;///(double)(1<<inflowCubeLevel);
+         double dpCubes=(double)H/20.0;//100.0; //30zum testen 100real
+         double offsetZgrid=H+0.5*inflowCubeDx;
+         double epschoch1drittel= 0.928318;
+         double abstandIn=2.0*dpCubes;
+         double c1oAbst=1.0/abstandIn;
+         for (int Nflowdir=0;Nflowdir<((nx[0]*blocknx[0]*c1oAbst)*coarseNodeDx); Nflowdir++)
+         {
+            // for (int Nhorizon=((nx[2]*blocknx[2]*c1oAbst)*coarseNodeDx)*0.5-2; Nhorizon<((nx[2]*blocknx[2]*c1oAbst)*coarseNodeDx)*0.5-1-1; Nhorizon++)
+            // {
+            //  for (int Nhorizon=0;  Nhorizon<(((nx[2]*blocknx[2]+1)*c1oAbst)*coarseNodeDx)*0.1; Nhorizon++)//Nhorizon<((nx[2]*blocknx[2]*c1oAbst)*coarseNodeDx)*0.5; Nhorizon++)
+            for (int Nhorizon=0;  Nhorizon<(((nx[2]*blocknx[2]+1)*c1oAbst)*coarseNodeDx)*0.5-1; Nhorizon++)//Nhorizon<((nx[2]*blocknx[2]*c1oAbst)*coarseNodeDx)*0.5; Nhorizon++)
+
+            {
+               for (int Nspanw=0; Nspanw<((nx[1]*blocknx[1]*c1oAbst)*coarseNodeDx); Nspanw++)
+               {
+                  // stringstream ss;
+                  //     ss<<"cubeH"<<Nflowdir<<"x"<<Nhorizon<<"x"<<Nspanw;
+                  ////     //   //geoOrigin ist Mitte, nicht vordere Ecke -> korrigieren
+                  // int Nflowdir=1;
+                  //int Nhorizon=0;
+                  //int Nspanw=1;
+                  double xminCubes1=originX1+(Nflowdir*abstandIn)-0.5*dpCubes+0.5*inflowCubeDx+3.0*coarseNodeDx/pow(2.0,refineLevel-1);
+                  double xmaxCubes1=originX1+(Nflowdir*abstandIn)+0.5*dpCubes+0.5*inflowCubeDx+3.0*coarseNodeDx/pow(2.0,refineLevel-1);
+                  double xminCubes=std::max(xminCubes1,2.0*coarseNodeDx/pow(2.0,refineLevel));
+                  double xmaxCubes=std::min(xmaxCubes1,originX1+geoLength[0]-coarseNodeDx/pow(2.0,refineLevel));
+                  double yminCubes=std::max(originX2+(Nspanw*abstandIn)-0.5*dpCubes+0.5*inflowCubeDx+3.0*coarseNodeDx/pow(2.0,refineLevel-1),2.0*coarseNodeDx/pow(2.0,refineLevel));
+                  double ymaxCubes=std::min(originX2+(Nspanw*abstandIn)+0.5*dpCubes+0.5*inflowCubeDx+3.0*coarseNodeDx/pow(2.0,refineLevel-1),originX2+geoLength[1]-coarseNodeDx/pow(2.0,refineLevel));
+                  double zminCubes=std::max(originX3+(Nhorizon*abstandIn)+4.0*coarseNodeDx/pow(2.0,refineLevel-1),2.0*coarseNodeDx/pow(2.0,refineLevel));
+                  double zmaxCubes=std::min(originX3+(Nhorizon*abstandIn)+dpCubes+4.0*coarseNodeDx/pow(2.0,refineLevel-1),originX3+geoLength[2]-coarseNodeDx/pow(2.0,refineLevel));
+                  ////     /*GbCuboid3D  *rectTemp = new GbCuboid3D(originX1+(Nflowdir*abstandIn)-0.5*dpCubes+0.5*inflowCubeDx, originX2+(Nspanw*abstandIn)-0.5*dpCubes+0.5*inflowCubeDx, originX3+(Nhorizon*abstandIn)-0.5*dpCubes+0.5*inflowCubeDx, 
+                  ////										 originX1+(Nflowdir*abstandIn)+0.5*dpCubes+0.5*inflowCubeDx, originX2+(Nspanw*abstandIn)+0.5*dpCubes+0.5*inflowCubeDx, originX3+(Nhorizon*abstandIn)+0.5*dpCubes+0.5*inflowCubeDx );
+                  ////*/
+                  ////  
+                  GbCuboid3DPtr rectTemp(new GbCuboid3D(xminCubes, yminCubes, zminCubes, 
+                     xmaxCubes, ymaxCubes, zmaxCubes));
+                  ////
+                  //     ostringstream ostrcubes;
+                  //	 ostrcubes<<pathname <<"/cubeH"<<Nflowdir<<"x"<<Nhorizon<<"x"<<Nspanw;
+                  ////       
+                  ////   
+                  //// // GbSystem3D::writeGeoObject(rectTemp,outpath+cubeschar,WbWriterAvsASCII::getInstance());
+                  ////  GbSystem3D::writeGeoObject(rectTemp,ostrcubes.str(),WbWriterAvsASCII::getInstance()); //??
+                  //        ostrcubes.str("");
+                  //         ostrcubes.clear();
+
+                  ////  boost::shared_ptr<D3Q19AMRInteractor> interactorTemp( new D3Q19AMRInteractor( rectTemp,new D3Q19NoSlipBCAdapter(),AMR3DInteractor::SOLID,ss.str()) );
+                  //  //  interactorService.addInteractor(interactorTemp);
+                  D3Q27BoundaryConditionAdapterPtr cubeBCAdapter(new D3Q27NoSlipBCAdapter());                   //D3Q27DensityBCAdapter(rhoInit));
+                  D3Q27InteractorPtr cubeInteractor( new D3Q27Interactor(rectTemp,grid,cubeBCAdapter,Interactor3D::SOLID));
+                  D3Q27InteractorPtrarray.push_back(cubeInteractor);  
+
+
+               }
+            }}
+         ////////////////
+         //ende cubes
+         //////////
+         ////////////////////////////////////////////
+         //METIS
+         Grid3DVisitorPtr metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B));
+
+         ////////////////////////////////////////////
+         /////delete solid blocks
+         if(myid == 0) UBLOG(logINFO,"deleteSolidBlocks - start");
+         InteractorsHelper intHelper(grid, metisVisitor);
+         intHelper.addInteractor(topBCInteractor);
+         intHelper.addInteractor(bottomBCInteractor);
+         for(size_t i=0; i<D3Q27InteractorPtrarray.size(); ++i)
+         {
+            intHelper.addInteractor(D3Q27InteractorPtrarray[i]);
+         }
+         intHelper.selectBlocks();
+         if(myid == 0) UBLOG(logINFO,"deleteSolidBlocks - end");	 
+         //////////////////////////////////////
+
+         //domain decomposition for threads
+         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
+         grid->accept(pqPartVisitor);
+
+         unsigned long nob = grid->getNumberOfBlocks();
+         unsigned long nod = nob * blocknx[0]*blocknx[1]*blocknx[2];
+         unsigned long nod_real = nob * (blocknx[0]+3)*(blocknx[1]+3)*(blocknx[2]+3);
+
+         double needMemAll  = double(nod_real*(27*sizeof(double) + sizeof(int)));
+         double needMem  = needMemAll / double(comm->getNumberOfProcesses());
+
+         if(myid == 0)
+         {
+            UBLOG(logINFO,"Number of blocks = " << nob);
+            UBLOG(logINFO,"Number of nodes  = " << nod);
+            UBLOG(logINFO,"Necessary memory  = " << needMemAll  << " bytes");
+            UBLOG(logINFO,"Necessary memory per process = " << needMem  << " bytes");
+            UBLOG(logINFO,"Available memory per process = " << availMem << " bytes");
+         }
+
+         LBMKernel3DPtr kernel;
+         kernel = LBMKernel3DPtr(new LBMKernelETD3Q27CCLB(blocknx[0], blocknx[1], blocknx[2], LBMKernelETD3Q27CCLB::NORMAL));
+
+         // LBMKernel3DPtr kernel(new LBMKernelETD3Q27CascadedTI(blocknx[0], blocknx[1], blocknx[2]));
+         //LBMKernel3DPtr kernel(new LBMKernelETD3Q27BGK(blocknx[0], blocknx[1], blocknx[2],1));
+         BCProcessorPtr bcProc(new D3Q27ETBCProcessor());
+         kernel->setBCProcessor(bcProc);
+         //	  //scheint neuerdings fuer absturz zu sorgen:
+         mu::Parser fctForcingX1;
+         fctForcingX1.SetExpr("Fx1*dx");
+         fctForcingX1.DefineConst("Fx1", 0.6*5.0e-6);//9.99685e-7);
+
+         kernel->setForcingX1(fctForcingX1);
+         kernel->setWithForcing(true); 
+
+         SetKernelBlockVisitor kernelVisitor(kernel, nuLB, availMem, needMem);
+
+         grid->accept(kernelVisitor);
+
+         //////////////////////////////////
+         //undef nodes
+         if (refineLevel > 0)
+         {
+            D3Q27SetUndefinedNodesBlockVisitor undefNodesVisitor;
+            grid->accept(undefNodesVisitor);
+         }
+         //////////////////////////////////////////
+         intHelper.setBC();
+
+         for(size_t i=0; i<D3Q27InteractorPtrarray.size(); ++i)
+         {
+            grid->addAndInitInteractor( D3Q27InteractorPtrarray[i] ); 
+            char numstr[21];
+            sprintf(numstr, "%f", (double)i);
+            std::string pathObstCube = pathname+"/geo/obstBCCuboid"+ numstr;
+            if(myid == 0) GbSystem3D::writeGeoObject(D3Q27InteractorPtrarray[i]->getGbObject3D().get(),
+               /* rectTemp.get(),*/ pathObstCube, WbWriterVtkXmlASCII::getInstance());
+         }
+
+         UbTimer timer;
+         timer.start();
+         grid->accept( metisVisitor );
+
+         if(myid == 0) UBLOG(logINFO,"Write blocks - start");
+         BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname + "/grid/blocks", WbWriterVtkXmlBinary::getInstance(), comm));
+         if(myid == 0) ppblocks->update(0);
+         if(myid == 0) UBLOG(logINFO,"Write blocks - end");
+
+         if(myid == 0) UBLOG(logINFO,"Write blocks - start");
+         grid->accept( metisVisitor );
+         if(myid == 0) ppblocks->update(1);
+         ppblocks.reset();
+         if(myid == 0) UBLOG(logINFO,"Write blocks - end");
+
+         //inflow
+         double uLB2=uLB;
+         double raiseVelSteps = 0;
+         vector<D3Q27BCFunction> velcX1BCs,dummy;
+
+         mu::Parser inflowProfile;
+         inflowProfile.SetExpr("uLB*0.9"); 
+
+         inflowProfile.DefineConst("uLB",uLB2);
+         velcX1BCs.push_back(D3Q27BCFunction(inflowProfile,raiseVelSteps,D3Q27BCFunction::INFCONST));
+
+
+         //set connectors
+         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
+         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
+         grid->accept( setConnsVisitor );
+
+         //domain decomposition
+
+         //initialization of decompositions
+         D3Q27ETInitDistributionsBlockVisitor initVisitor( nuLB,rhoInit);
+         initVisitor.setVx1(inflowProfile);
+         grid->accept(initVisitor);
+
+         //Postrozess
+         //LBMUnitConverterPtr conv = LBMUnitConverterPtr(new LBMUnitConverter());
+
+         UbSchedulerPtr geoSch(new UbScheduler(1));
+         D3Q27MacroscopicQuantitiesPostprocessorPtr ppgeo(
+            new D3Q27MacroscopicQuantitiesPostprocessor(grid, geoSch, pathname + "/grid/nodes", WbWriterVtkXmlBinary::getInstance(), 
+            unitConverter,true));
+
+
+
+         grid->doPostProcess(0);
+         ppgeo.reset();
+         geoSch.reset();
+
+         if(myid == 0) UBLOG(logINFO,"Preprozess - end");      
+
+      }
+            else
+            {
+               //set forcing
+               mu::Parser fctForcingX1, fctForcingX2, fctForcingX3;
+               fctForcingX1.SetExpr("Fx1*dx");
+               fctForcingX1.DefineConst("Fx1", 0.6*5.0e-6);
+               SetForcingBlockVisitor forcingVisitor(fctForcingX1, fctForcingX2, fctForcingX3);
+               grid->accept(forcingVisitor);
+
+               //set connectors
+               D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
+               D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
+               grid->accept( setConnsVisitor );
+               if(myid == 0) UBLOG(logINFO,"Restart - end"); 
+      }
+
+
+      UbSchedulerPtr visSch(new UbScheduler());
+      //visSch->addSchedule(100,1,1000);
+      //visSch->addSchedule(1000,1000,10000);
+      //visSch->addSchedule(10000,10000,100000);
+      //visSch->addSchedule(20000,20000,800000);
+      //visSch->addSchedule(50,350000,350500);
+      //visSch->addSchedule(50,420000,420500);
+      //visSch->addSchedule(50000,420500,10000000);
+      visSch->addSchedule(2250,140000,450001);
+      UbSchedulerPtr resSch(new UbScheduler());
+      resSch->addSchedule(20000,20,10000000);
+      UbSchedulerPtr resSchRMS(new UbScheduler());
+      resSchRMS->addSchedule(40000,420000,10000000);
+      UbSchedulerPtr resSchMeans(new UbScheduler());
+      resSchMeans->addSchedule(40000,0,10000000);
+      UbSchedulerPtr stepAvSch(new UbScheduler());
+      stepAvSch->addSchedule(20,0,10000000);
+      AverageValuesPostprocessor Avpp(grid, pathname + "/steps/stepAV", WbWriterVtkXmlBinary::getInstance(), 
+                                      visSch/*wann wird rausgeschrieben*/, stepAvSch/*wann wird gemittelt*/, resSchMeans, resSchRMS/*wann wird resettet*/);
+
+      D3Q27MacroscopicQuantitiesPostprocessor pp(grid, visSch, pathname + "/steps/step", WbWriterVtkXmlBinary::getInstance(), unitConverter, comm);
+
+      UbSchedulerPtr nupsSch(new UbScheduler(10, 90050, 90080));
+      NUPSCounterPostprocessor npr(grid, nupsSch, pathname + "/results/nups.txt", comm);
+
+
+      UbSchedulerPtr AdjForcSch(new UbScheduler());
+      AdjForcSch->addSchedule(100,20,20000000);
+      D3Q27IntegrateValuesHelperPtr IntValHelp(new D3Q27IntegrateValuesHelper(grid, comm, 
+         originX1, originX2, kanalhoeheSI*0.55/*0.501*/, 
+         nx[0]*blockLengthx1, nx[1]*blockLengthx2, kanalhoeheSI*0.999));
+
+      double vxZiel=uLB;
+      //D3Q27AdjustForcingPostprocessor AdjForcPPPtr(grid, AdjForcSch,IntValHelp, vxZiel*0.6, comm);//da am 11.3.2013 velo um 1/0.6 zu hoch
+      D3Q27AdjustForcingPostprocessor AdjForcPPPtr(grid, AdjForcSch,IntValHelp, vxZiel, comm);//dies sollte zu Re=5500 fuehren..
+
+      UbSchedulerPtr visQSch(new UbScheduler());
+      visQSch->addSchedule(10,90100,90130);
+      QCriterionPostprocessor QKritPtr(grid,pathname+"/steps/Qq",WbWriterVtkXmlBinary::getInstance(),visQSch, comm);
+
+      mu::Parser decrViscFunc;
+      decrViscFunc.SetExpr("nue0+c0/(t+1)/(t+1)");
+      decrViscFunc.DefineConst("nue0", nuLB);
+      decrViscFunc.DefineConst("c0", 0.1);
+      UbSchedulerPtr DecrViscSch(new UbScheduler());
+      DecrViscSch->addSchedule(10,10,1000);
+      DecreaseViscosityPostprocessor decrViscPPPtr(grid, DecrViscSch,&decrViscFunc, comm);
+
+      cout << "PID = " << myid << " Total Physical Memory (RAM): " << Utilities::getTotalPhysMem()<<endl;
+      cout << "PID = " << myid << " Physical Memory currently used: " << Utilities::getPhysMemUsed()<<endl;
+      cout << "PID = " << myid << " Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe()<<endl;
+
+      double endTime = 2000000;//20000001;
+      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, visSch));
+      if(myid == 0) UBLOG(logINFO,"Simulation-start");
+      calculation->calculate();
+      if(myid == 0) UBLOG(logINFO,"Simulation-end");
+   }
+   catch(std::exception& e)
+   {
+      cerr << e.what() << endl << flush;
+   }
+   catch(std::string& s)
+   {
+      cerr << s << endl;
+   }
+   catch(...)
+   {
+      cerr << "unknown exception" << endl;
+   }
+
+}
+int main(int argc, char* argv[])
+{
+
+   run(argv[1]);
+
+   return 0;
+}
+
diff --git a/apps/cpu/bKanal2/bKanal2.cpp b/apps/cpu/bKanal2/bKanal2.cpp
index 0b0175d1652f1ac4e3f0783364ef57b601169445..87181a20e7c8542456c220d80e76a214c9b0c779 100644
--- a/apps/cpu/bKanal2/bKanal2.cpp
+++ b/apps/cpu/bKanal2/bKanal2.cpp
@@ -1,466 +1,466 @@
-
-
-#include <iostream>
-#include <string>
-#include <math.h> 
-
-#include <sys/types.h> //mkdir rights
-#include <sys/stat.h> //mkdir
-#include <vfluids.h>
-
-using namespace std;
-
-
-void run(const char *cstr)
-{
-   try
-   {
-      string pathname; 
-      string pathnameRestart;
-      int numOfThreads =1;
-      bool logfile = false;
-      stringstream logFilename;
-      double availMem = 0;
-
-      UbLog::reportingLevel() = logINFO;
-
-      CommunicatorPtr comm = MPICommunicator::getInstance();
-      int myid = comm->getProcessID();
-
-      string machine = string(cstr);
-
-      if(machine == "my") 
-      {
-         pathname = "d:/temp/BKanal";
-         numOfThreads = 4;
-         logfile = false;
-         availMem = 10.0e9;
-      }
-      else if(machine == "Ludwig")      
-      {
-         pathname =        "/work/koskuche/SFB880/BKanal";
-         pathnameRestart = "/work/koskuche/SFB880/BKanal";
-         numOfThreads = 8;
-         availMem = 1.0e9;
-         logfile = true;
-
-         if (myid==0) 
-         {
-            const char* str = pathname.c_str();
-#if defined(__unix__)
-            int status=mkdir(str, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
-#endif 
-         }
-
-         if(myid ==0)
-         {
-            logFilename <<  pathname + "/logfile"+UbSystem::toString(UbSystem::getTimeStamp())+"_"+UbSystem::toString(myid)+".txt";
-         }
-
-      }
-      else throw UbException(UB_EXARGS, "unknown CAB_MACHINE");
-
-      if(myid ==0 && logfile)
-      {
-         UbLog::output_policy::setStream(logFilename.str());
-      }
-
-      UBLOG(logINFO,"Testcase BreugemChannel");
-
-      //////////////////////////////////////////////////////////////////////////
-      //physik
-      //////////////////////////////////////////////////////////////////////////
-      double Re    = 5500;
-      double uLB   = 0.1;  
-      double rhoLB = 0.0;
-
-      int blocknx[3];
-      blocknx[0] = 20;//10;//5;
-      blocknx[1] = 20;//10;//5;
-      blocknx[2] = 20;//10;//5;
-
-      int nx[3];
-      nx[0] = 15;
-      nx[1] = 10;
-      nx[2] = 10;
-
-      double coarseNodeDx = 1.0;
-      double H     = (double)(nx[2]*blocknx[2])/2.0;
-      double hLB   = H/coarseNodeDx;
-      double nuLB  = (uLB*hLB)/Re;
-
-      int baseLevel   = 0;
-      int refineLevel = 0;//2;//1;////3;//3 soll 1 test;
-
-      ///////////////Weltabmessungen:
-      double blockLengthx1 = blocknx[0]*coarseNodeDx; //geowerte
-      double blockLengthx2 = blockLengthx1;
-      double blockLengthx3 = blockLengthx1;
-
-      double originX1 = 0.0;
-      double originX2 = 0.0;
-      double originX3 = 0.0;
-
-      //bounding box
-      double g_minX1 = originX1;
-      double g_minX2 = originX2;
-      double g_minX3 = originX3;
-
-      double g_maxX1 = originX1 + 3.0*H;
-      double g_maxX2 = originX2 + 2.0*H;
-      double g_maxX3 = originX3 + 2.0*H;
-
-      //double geoLength[]   = {  nx[0]*blockLengthx1, nx[1]*blockLengthx2, nx[2]*blockLengthx3}; 
-
-      bool periodicx1 = true;
-      bool periodicx2 = true;
-      bool periodicx3 = false;
-
-      LBMUnitConverterPtr unitConverter = LBMUnitConverterPtr(new LBMUnitConverter());
-
-      Grid3DPtr grid(new Grid3D(comm));
-
-      //////////////////////////////////////////////////////////////////////////
-      //restart
-      UbSchedulerPtr rSch(new UbScheduler(10000,10000,10000000));
-      RestartPostprocessor rp(grid, rSch, comm, pathname+"/checkpoints", RestartPostprocessor::BINARY);
-      grid = rp.restart(-1);
-      //////////////////////////////////////////////////////////////////////////
-
-       if (grid->getTimeStep() == 0)
-       {
-
-         //set grid
-         grid->setDeltaX(coarseNodeDx);
-         grid->setBlockNX(blocknx[0], blocknx[1], blocknx[2]);
-         grid->setPeriodicX1(periodicx1);
-         grid->setPeriodicX2(periodicx2);
-         grid->setPeriodicX3(periodicx3);
-
-
-         GbObject3DPtr gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
-         if(myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), pathname+"/geo/gridCube", WbWriterVtkXmlASCII::getInstance());
-
-         GenBlocksGridVisitor genBlocks(gridCube);
-         grid->accept(genBlocks);
-
-
-
-         //bottom and top solid bc
-         //iteractors
-         int bbOption1 = 1; //0=simple Bounce Back, 1=quadr. BB
-         D3Q27BoundaryConditionAdapterPtr bcObst(new D3Q27NoSlipBCAdapter(bbOption1));
-         double geoOverlap = coarseNodeDx;
-         GbCuboid3DPtr bottomBCCuboid(new GbCuboid3D(g_minX1-blockLengthx1, g_minX2-blockLengthx1, g_minX3-blockLengthx1, g_maxX1+blockLengthx1, g_maxX2+blockLengthx1, g_minX3));
-         if(myid == 0) GbSystem3D::writeGeoObject(bottomBCCuboid.get(), pathname+"/geo/bottomBCCuboid", WbWriterVtkXmlASCII::getInstance());
-         D3Q27InteractorPtr bottomBCInteractor(new D3Q27Interactor(bottomBCCuboid,grid,bcObst,Interactor3D::SOLID)); 
-
-         GbCuboid3DPtr topBCCuboid(new GbCuboid3D(g_minX1-blockLengthx1, g_minX2-blockLengthx1, g_maxX3, g_maxX1+blockLengthx1, g_maxX2+blockLengthx1, g_maxX3+blockLengthx1));
-         if(myid == 0) GbSystem3D::writeGeoObject(topBCCuboid.get(), pathname+"/geo/topBCCuboid", WbWriterVtkXmlASCII::getInstance());
-         D3Q27InteractorPtr topBCInteractor(new D3Q27Interactor(topBCCuboid,grid,bcObst,Interactor3D::SOLID)); 
-         //grid->addAndInitInteractor( bottomBCInteractor ); 
-         // grid->addAndInitInteractor( topBCInteractor ); 
-         //////////////////////////////////////////////////////////////////////////
-         if(myid == 0)
-         {
-            UBLOG(logINFO, "*****************************************");
-            UBLOG(logINFO, "* Parameters                            *");
-            UBLOG(logINFO, "* Re            ="<<Re);
-            //UBLOG(logINFO, "* Ma            ="<<Ma);
-            //UBLOG(logINFO, "* uReal         ="<<uReal);
-            //UBLOG(logINFO, "* nueReal       ="<<nueReal);
-            UBLOG(logINFO, "* nue           ="<<nuLB);
-            UBLOG(logINFO, "* velocity      ="<<uLB);
-            // UBLOG(logINFO, "* LX1 (world/LB)="<<kanallaengeSI<<"/"<<kanallaengeSI/coarseNodeDx);
-            //  UBLOG(logINFO, "* LX2 (world/LB)="<<kanalbreiteSI<<"/"<<kanalbreiteSI/coarseNodeDx);
-            //UBLOG(logINFO, "* LX3 (world/LB)="<<kanalhoeheSI<<"/"<<kanalhoeheSI/coarseNodeDx);
-            UBLOG(logINFO, "* cdx           ="<<coarseNodeDx);
-            //UBLOG(logINFO, "* fdx           ="<<fineNodeDx);
-            UBLOG(logINFO, "* dx_base       ="<<coarseNodeDx<<" == "<<coarseNodeDx);
-            //UBLOG(logINFO, "* dx_refine     ="<<fineNodeDx<<" == "<<fineNodeDx );
-            //UBLOG(logINFO, "* nx1/2/3       ="<<nx[0]<<"/"<<nx[1]<<"/"<<nx[2]);
-            UBLOG(logINFO, "* blocknx1/2/3  ="<<blocknx[0]<<"/"<<blocknx[1]<<"/"<<blocknx[2]);
-            UBLOG(logINFO, "* x2Periodic    ="<<periodicx2);
-            UBLOG(logINFO, "* x3Periodic    ="<<periodicx3);
-            UBLOG(logINFO, "* number of threads ="<<numOfThreads);
-            UBLOG(logINFO, "* number of processes ="<<comm->getNumberOfProcesses());
-            UBLOG(logINFO, "*****************************************");
-/*            UBLOGML(logINFO, "UnitConverter:"<<unitConverter->toString());
-            UBLOG(logINFO, "*****************************************");  */   
-         }
-
-         if(myid == 0) UBLOG(logINFO,"Refinement - start");	
-
-         //////////////////////////////////////////////////////////////////////////
-         // refine
-         //////////////////////////////////////////////////////////////////////////
-         //GbCuboid3DPtr wallsX1X2minRef3(new GbCuboid3D(  originX1-3.0*geoOverlap   , originX2-3.0*geoOverlap  , originX3-3.0*geoOverlap
-         //   , originX1+geoLength[0]+geoOverlap, originX2+geoOverlap+geoLength[1], kanalhoeheSI*0.6/*0.55*/));
-
-         //GbCuboid3DPtr wallsX1X2minRef4(new GbCuboid3D(  originX1-3.0*geoOverlap   , originX2-3.0*geoOverlap  ,kanalhoeheSI*0.49
-         //   , originX1+geoLength[0]+geoOverlap, originX2+geoOverlap+geoLength[1], kanalhoeheSI*0.53));
-
-         //GbCuboid3DPtr wallsX1X2maxRef2(new GbCuboid3D(  originX1-3.0*geoOverlap   , originX2-3.0*geoOverlap  ,kanalhoeheSI*0.9
-         //   , originX1+geoLength[0]+geoOverlap, originX2+geoOverlap+geoLength[1], originX3+geoOverlap+geoLength[2]));
-
-         //GbCuboid3DPtr wallsX1X2maxRef1(new GbCuboid3D(  originX1-3.0*geoOverlap   , originX2-3.0*geoOverlap  ,kanalhoeheSI*0.95
-         //   , originX1+geoLength[0]+geoOverlap, originX2+geoOverlap+geoLength[1], originX3+geoOverlap+geoLength[2]));
-
-         //if (refineLevel > 0)
-         //{
-
-         //   RefineCrossAndInsideGbObjectHelper refineHelper(grid, refineLevel);
-         //   refineHelper.addGbObject(wallsX1X2minRef3, refineLevel-1);
-         //   refineHelper.addGbObject(wallsX1X2minRef4, refineLevel);
-         //   refineHelper.addGbObject(wallsX1X2maxRef2, refineLevel-1);
-         //   refineHelper.addGbObject(wallsX1X2maxRef1, refineLevel);
-
-         //   refineHelper.refine();
-         //   if(myid == 0) UBLOG(logINFO,"Refinement - end");	
-         //}
-
-         ///interactoren
-         //int bbOption1 = 0; //0=simple Bounce Back, 1=quadr. BB
-         //D3Q27BoundaryConditionAdapterPtr bcObst(new D3Q27NoSlipBCAdapter(bbOption1));
-         ///////würfel unten version ende
-         ////////////////////////////////////////////////////////////////////////////////
-         ////////PM grid
-         //Temporär:
-         //double  H=1.0;
-
-         vector<D3Q27InteractorPtr> D3Q27InteractorPtrarray;
-         ////////////////////////////////////////////////////////////////////////////////
-         double dpCubes=(double)H/20.0;
-         double distanceXY=dpCubes/2.0-coarseNodeDx*0.5;
-         double distanceZ=0;
-   
-         for (int x = 0; x<30; x++)
-            for (int y = 0; y<20; y++)
-               for (int z = 0; z<9; z++)
-               {
-                  double xminCubes = originX1+distanceXY+2.0*dpCubes*x;
-                  double yminCubes = originX2+distanceXY+2.0*dpCubes*y;
-                  double zminCubes = originX3+distanceZ+2.0*dpCubes*z;
-                  double xmaxCubes = xminCubes+dpCubes;
-                  double ymaxCubes = yminCubes+dpCubes;
-                  double zmaxCubes = zminCubes+dpCubes;
-                  GbCuboid3DPtr rectTemp(new GbCuboid3D(xminCubes, yminCubes, zminCubes, xmaxCubes, ymaxCubes, zmaxCubes));
-                  D3Q27BoundaryConditionAdapterPtr cubeBCAdapter(new D3Q27NoSlipBCAdapter());                   
-                  D3Q27InteractorPtr cubeInteractor( new D3Q27Interactor(rectTemp,grid,cubeBCAdapter,Interactor3D::SOLID));
-                  D3Q27InteractorPtrarray.push_back(cubeInteractor); 
-               }
-
-         ////////////////
-         //ende cubes
-         //////////
-         ////////////////////////////////////////////
-         //METIS
-         Grid3DVisitorPtr metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B));
-
-         ////////////////////////////////////////////
-         /////delete solid blocks
-         if(myid == 0) UBLOG(logINFO,"deleteSolidBlocks - start");
-         InteractorsHelper intHelper(grid, metisVisitor);
-         intHelper.addInteractor(topBCInteractor);
-         intHelper.addInteractor(bottomBCInteractor);
-         for(size_t i=0; i<D3Q27InteractorPtrarray.size(); ++i)
-         {
-            intHelper.addInteractor(D3Q27InteractorPtrarray[i]);
-         }
-         intHelper.selectBlocks();
-         if(myid == 0) UBLOG(logINFO,"deleteSolidBlocks - end");	 
-         //////////////////////////////////////
-
-         //domain decomposition for threads
-         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
-         grid->accept(pqPartVisitor);
-
-         if(myid == 0) UBLOG(logINFO,"Write blocks - start");
-         BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname + "/grid/blocks", WbWriterVtkXmlBinary::getInstance(), comm));
-         if(myid == 0) ppblocks->update(0);
-         if(myid == 0) UBLOG(logINFO,"Write blocks - end");
-
-         unsigned long nob = grid->getNumberOfBlocks();
-         unsigned long nod = nob * blocknx[0]*blocknx[1]*blocknx[2];
-         unsigned long nod_real = nob * (blocknx[0]+3)*(blocknx[1]+3)*(blocknx[2]+3);
-
-         double needMemAll  = double(nod_real*(27*sizeof(double) + sizeof(int)));
-         double needMem  = needMemAll / double(comm->getNumberOfProcesses());
-
-         if(myid == 0)
-         {
-            UBLOG(logINFO,"Number of blocks = " << nob);
-            UBLOG(logINFO,"Number of nodes  = " << nod);
-            UBLOG(logINFO,"Necessary memory  = " << needMemAll  << " bytes");
-            UBLOG(logINFO,"Necessary memory per process = " << needMem  << " bytes");
-            UBLOG(logINFO,"Available memory per process = " << availMem << " bytes");
-         }
-
-         LBMKernel3DPtr kernel;
-         kernel = LBMKernel3DPtr(new LBMKernelETD3Q27CCLB(blocknx[0], blocknx[1], blocknx[2], LBMKernelETD3Q27CCLB::NORMAL));
-         BCProcessorPtr bcProc(new D3Q27ETBCProcessor());
-         kernel->setBCProcessor(bcProc);
-     
-         mu::Parser fctForcingX1;
-         fctForcingX1.SetExpr("Fx1*dx");
-         fctForcingX1.DefineConst("Fx1", 0.6*5.0e-6);//9.99685e-7);
-
-         kernel->setForcingX1(fctForcingX1);
-         kernel->setWithForcing(true); 
-
-         SetKernelBlockVisitor kernelVisitor(kernel, nuLB, availMem, needMem);
-         grid->accept(kernelVisitor);
-
-         //////////////////////////////////
-         //undef nodes
-         if (refineLevel > 0)
-         {
-            D3Q27SetUndefinedNodesBlockVisitor undefNodesVisitor;
-            grid->accept(undefNodesVisitor);
-         }
-         //////////////////////////////////////////
-         intHelper.setBC();
-
-         for(size_t i=0; i<D3Q27InteractorPtrarray.size(); ++i)
-         {
-            grid->addAndInitInteractor( D3Q27InteractorPtrarray[i] ); 
-            char numstr[21];
-            sprintf(numstr, "%f", (double)i);
-            std::string pathObstCube = pathname+"/geo/obstBCCuboid"+ numstr;
-            if(myid == 0) GbSystem3D::writeGeoObject(D3Q27InteractorPtrarray[i]->getGbObject3D().get(),
-               /* rectTemp.get(),*/ pathObstCube, WbWriterVtkXmlASCII::getInstance());
-         }
-
-
-         ppblocks.reset();
-
-         //inflow
-         mu::Parser inflowProfile;
-         inflowProfile.SetExpr("uLB*0.9"); 
-         inflowProfile.DefineConst("uLB",uLB);
-
-         //set connectors
-         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
-         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
-         grid->accept( setConnsVisitor );
-
-         //initialization of decompositions
-         D3Q27ETInitDistributionsBlockVisitor initVisitor( nuLB,rhoLB);
-         initVisitor.setVx1(inflowProfile);
-         grid->accept(initVisitor);
-
-         //Postrozess
-         UbSchedulerPtr geoSch(new UbScheduler(1));
-         D3Q27MacroscopicQuantitiesPostprocessorPtr ppgeo(
-            new D3Q27MacroscopicQuantitiesPostprocessor(grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), 
-            unitConverter,true));
-
-         ppgeo->update(0);
-         ppgeo.reset();
-         geoSch.reset();
-
-         if(myid == 0) UBLOG(logINFO,"Preprozess - end");      
-
-      }
-            else
-            {
-               //set forcing
-               mu::Parser fctForcingX1, fctForcingX2, fctForcingX3;
-               fctForcingX1.SetExpr("Fx1*dx");
-               fctForcingX1.DefineConst("Fx1", 0.6*5.0e-6);
-               fctForcingX2.SetExpr("0.0");
-               fctForcingX3.SetExpr("0.0");
-               SetForcingBlockVisitor forcingVisitor(fctForcingX1, fctForcingX2, fctForcingX3);
-               grid->accept(forcingVisitor);
-
-               //set connectors
-               D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
-               D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
-               grid->accept( setConnsVisitor );
-               if(myid == 0) UBLOG(logINFO,"Restart - end"); 
-      }
-
-
-      UbSchedulerPtr visSch(new UbScheduler());
-      visSch->addSchedule(100,100,1000);
-      visSch->addSchedule(1000,1000,10000);
-      visSch->addSchedule(10000,10000,100000);
-      //visSch->addSchedule(20000,20000,800000);
-      //visSch->addSchedule(50,350000,350500);
-      //visSch->addSchedule(50,420000,420500);
-      //visSch->addSchedule(50000,420500,10000000);
-      //visSch->addSchedule(2250,140000,450001);
-      //UbSchedulerPtr resSch(new UbScheduler());
-      //resSch->addSchedule(20000,20,10000000);
-      //UbSchedulerPtr resSchRMS(new UbScheduler());
-      //resSchRMS->addSchedule(40000,420000,10000000);
-      //UbSchedulerPtr resSchMeans(new UbScheduler());
-      //resSchMeans->addSchedule(40000,0,10000000);
-      //UbSchedulerPtr stepAvSch(new UbScheduler());
-      //stepAvSch->addSchedule(20,0,10000000);
-      //AverageValuesPostprocessor Avpp(grid, pathname + "/steps/stepAV", WbWriterVtkXmlBinary::getInstance(), 
-      //                                visSch/*wann wird rausgeschrieben*/, stepAvSch/*wann wird gemittelt*/, resSchMeans, resSchRMS/*wann wird resettet*/);
-
-      D3Q27MacroscopicQuantitiesPostprocessor pp(grid, visSch, pathname, WbWriterVtkXmlBinary::getInstance(), unitConverter);
-
-      UbSchedulerPtr nupsSch(new UbScheduler(10, 30, 100));
-      NUPSCounterPostprocessor npr(grid, nupsSch, pathname + "/results/nups.txt", comm);
-
-
-      UbSchedulerPtr AdjForcSch(new UbScheduler());
-      AdjForcSch->addSchedule(100,100,20000000);
-      //D3Q27IntegrateValuesHelperPtr IntValHelp(new D3Q27IntegrateValuesHelper(grid, comm, 
-      //   originX1, originX2, kanalhoeheSI*0.55/*0.501*/, 
-      //   nx[0]*blockLengthx1, nx[1]*blockLengthx2, kanalhoeheSI*0.999));
-      D3Q27IntegrateValuesHelperPtr IntValHelp(new D3Q27IntegrateValuesHelper(grid, comm, 
-         originX1, originX2, g_maxX3*0.55/*0.501*/, 
-         g_maxX1, g_maxX2, g_maxX3*0.999));
-
-      double vxZiel=uLB;
-      //D3Q27AdjustForcingPostprocessor AdjForcPPPtr(grid, AdjForcSch,IntValHelp, vxZiel*0.6, comm);//da am 11.3.2013 velo um 1/0.6 zu hoch
-      D3Q27AdjustForcingPostprocessor AdjForcPPPtr(grid, AdjForcSch,IntValHelp, vxZiel, comm);//dies sollte zu Re=5500 fuehren..
-
-      UbSchedulerPtr visQSch(new UbScheduler());
-      visQSch->addSchedule(10,90100,90130);
-      QCriterionPostprocessor QKritPtr(grid,pathname+"/steps/Qq",WbWriterVtkXmlBinary::getInstance(),visQSch, comm);
-
-      //mu::Parser decrViscFunc;
-      //decrViscFunc.SetExpr("nue0+c0/(t+1)/(t+1)");
-      //decrViscFunc.DefineConst("nue0", nuLB);
-      //decrViscFunc.DefineConst("c0", 0.1);
-      //UbSchedulerPtr DecrViscSch(new UbScheduler());
-      //DecrViscSch->addSchedule(10,10,1000);
-      //DecreaseViscosityPostprocessor decrViscPPPtr(grid, DecrViscSch,&decrViscFunc, comm);
-
-      cout << "PID = " << myid << " Total Physical Memory (RAM): " << Utilities::getTotalPhysMem()<<endl;
-      cout << "PID = " << myid << " Physical Memory currently used: " << Utilities::getPhysMemUsed()<<endl;
-      cout << "PID = " << myid << " Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe()<<endl;
-
-      double endTime = 2000000;//20000001;
-      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, visSch));
-      if(myid == 0) UBLOG(logINFO,"Simulation-start");
-      calculation->calculate();
-      if(myid == 0) UBLOG(logINFO,"Simulation-end");
-   }
-   catch(std::exception& e)
-   {
-      cerr << e.what() << endl << flush;
-   }
-   catch(std::string& s)
-   {
-      cerr << s << endl;
-   }
-   catch(...)
-   {
-      cerr << "unknown exception" << endl;
-   }
-
-}
-int main(int argc, char* argv[])
-{
-
-   run(argv[1]);
-
-   return 0;
-}
-
+
+
+#include <iostream>
+#include <string>
+#include <math.h> 
+
+#include <sys/types.h> //mkdir rights
+#include <sys/stat.h> //mkdir
+#include <vfluids.h>
+
+using namespace std;
+
+
+void run(const char *cstr)
+{
+   try
+   {
+      string pathname; 
+      string pathnameRestart;
+      int numOfThreads =1;
+      bool logfile = false;
+      stringstream logFilename;
+      double availMem = 0;
+
+      UbLog::reportingLevel() = logINFO;
+
+      CommunicatorPtr comm = MPICommunicator::getInstance();
+      int myid = comm->getProcessID();
+
+      string machine = string(cstr);
+
+      if(machine == "my") 
+      {
+         pathname = "d:/temp/BKanal";
+         numOfThreads = 4;
+         logfile = false;
+         availMem = 10.0e9;
+      }
+      else if(machine == "Ludwig")      
+      {
+         pathname =        "/work/koskuche/SFB880/BKanal";
+         pathnameRestart = "/work/koskuche/SFB880/BKanal";
+         numOfThreads = 8;
+         availMem = 1.0e9;
+         logfile = true;
+
+         if (myid==0) 
+         {
+            const char* str = pathname.c_str();
+#if defined(__unix__)
+            int status=mkdir(str, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
+#endif 
+         }
+
+         if(myid ==0)
+         {
+            logFilename <<  pathname + "/logfile"+UbSystem::toString(UbSystem::getTimeStamp())+"_"+UbSystem::toString(myid)+".txt";
+         }
+
+      }
+      else throw UbException(UB_EXARGS, "unknown CAB_MACHINE");
+
+      if(myid ==0 && logfile)
+      {
+         UbLog::output_policy::setStream(logFilename.str());
+      }
+
+      UBLOG(logINFO,"Testcase BreugemChannel");
+
+      //////////////////////////////////////////////////////////////////////////
+      //physik
+      //////////////////////////////////////////////////////////////////////////
+      double Re    = 5500;
+      double uLB   = 0.1;  
+      double rhoLB = 0.0;
+
+      int blocknx[3];
+      blocknx[0] = 20;//10;//5;
+      blocknx[1] = 20;//10;//5;
+      blocknx[2] = 20;//10;//5;
+
+      int nx[3];
+      nx[0] = 15;
+      nx[1] = 10;
+      nx[2] = 10;
+
+      double coarseNodeDx = 1.0;
+      double H     = (double)(nx[2]*blocknx[2])/2.0;
+      double hLB   = H/coarseNodeDx;
+      double nuLB  = (uLB*hLB)/Re;
+
+      int baseLevel   = 0;
+      int refineLevel = 0;//2;//1;////3;//3 soll 1 test;
+
+      ///////////////Weltabmessungen:
+      double blockLengthx1 = blocknx[0]*coarseNodeDx; //geowerte
+      double blockLengthx2 = blockLengthx1;
+      double blockLengthx3 = blockLengthx1;
+
+      double originX1 = 0.0;
+      double originX2 = 0.0;
+      double originX3 = 0.0;
+
+      //bounding box
+      double g_minX1 = originX1;
+      double g_minX2 = originX2;
+      double g_minX3 = originX3;
+
+      double g_maxX1 = originX1 + 3.0*H;
+      double g_maxX2 = originX2 + 2.0*H;
+      double g_maxX3 = originX3 + 2.0*H;
+
+      //double geoLength[]   = {  nx[0]*blockLengthx1, nx[1]*blockLengthx2, nx[2]*blockLengthx3}; 
+
+      bool periodicx1 = true;
+      bool periodicx2 = true;
+      bool periodicx3 = false;
+
+      LBMUnitConverterPtr unitConverter = LBMUnitConverterPtr(new LBMUnitConverter());
+
+      Grid3DPtr grid(new Grid3D(comm));
+
+      //////////////////////////////////////////////////////////////////////////
+      //restart
+      UbSchedulerPtr rSch(new UbScheduler(10000,10000,10000000));
+      RestartPostprocessor rp(grid, rSch, comm, pathname+"/checkpoints", RestartPostprocessor::BINARY);
+      grid = rp.restart(-1);
+      //////////////////////////////////////////////////////////////////////////
+
+       if (grid->getTimeStep() == 0)
+       {
+
+         //set grid
+         grid->setDeltaX(coarseNodeDx);
+         grid->setBlockNX(blocknx[0], blocknx[1], blocknx[2]);
+         grid->setPeriodicX1(periodicx1);
+         grid->setPeriodicX2(periodicx2);
+         grid->setPeriodicX3(periodicx3);
+
+
+         GbObject3DPtr gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
+         if(myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), pathname+"/geo/gridCube", WbWriterVtkXmlASCII::getInstance());
+
+         GenBlocksGridVisitor genBlocks(gridCube);
+         grid->accept(genBlocks);
+
+
+
+         //bottom and top solid bc
+         //iteractors
+         int bbOption1 = 1; //0=simple Bounce Back, 1=quadr. BB
+         D3Q27BoundaryConditionAdapterPtr bcObst(new D3Q27NoSlipBCAdapter(bbOption1));
+         double geoOverlap = coarseNodeDx;
+         GbCuboid3DPtr bottomBCCuboid(new GbCuboid3D(g_minX1-blockLengthx1, g_minX2-blockLengthx1, g_minX3-blockLengthx1, g_maxX1+blockLengthx1, g_maxX2+blockLengthx1, g_minX3));
+         if(myid == 0) GbSystem3D::writeGeoObject(bottomBCCuboid.get(), pathname+"/geo/bottomBCCuboid", WbWriterVtkXmlASCII::getInstance());
+         D3Q27InteractorPtr bottomBCInteractor(new D3Q27Interactor(bottomBCCuboid,grid,bcObst,Interactor3D::SOLID)); 
+
+         GbCuboid3DPtr topBCCuboid(new GbCuboid3D(g_minX1-blockLengthx1, g_minX2-blockLengthx1, g_maxX3, g_maxX1+blockLengthx1, g_maxX2+blockLengthx1, g_maxX3+blockLengthx1));
+         if(myid == 0) GbSystem3D::writeGeoObject(topBCCuboid.get(), pathname+"/geo/topBCCuboid", WbWriterVtkXmlASCII::getInstance());
+         D3Q27InteractorPtr topBCInteractor(new D3Q27Interactor(topBCCuboid,grid,bcObst,Interactor3D::SOLID)); 
+         //grid->addAndInitInteractor( bottomBCInteractor ); 
+         // grid->addAndInitInteractor( topBCInteractor ); 
+         //////////////////////////////////////////////////////////////////////////
+         if(myid == 0)
+         {
+            UBLOG(logINFO, "*****************************************");
+            UBLOG(logINFO, "* Parameters                            *");
+            UBLOG(logINFO, "* Re            ="<<Re);
+            //UBLOG(logINFO, "* Ma            ="<<Ma);
+            //UBLOG(logINFO, "* uReal         ="<<uReal);
+            //UBLOG(logINFO, "* nueReal       ="<<nueReal);
+            UBLOG(logINFO, "* nue           ="<<nuLB);
+            UBLOG(logINFO, "* velocity      ="<<uLB);
+            // UBLOG(logINFO, "* LX1 (world/LB)="<<kanallaengeSI<<"/"<<kanallaengeSI/coarseNodeDx);
+            //  UBLOG(logINFO, "* LX2 (world/LB)="<<kanalbreiteSI<<"/"<<kanalbreiteSI/coarseNodeDx);
+            //UBLOG(logINFO, "* LX3 (world/LB)="<<kanalhoeheSI<<"/"<<kanalhoeheSI/coarseNodeDx);
+            UBLOG(logINFO, "* cdx           ="<<coarseNodeDx);
+            //UBLOG(logINFO, "* fdx           ="<<fineNodeDx);
+            UBLOG(logINFO, "* dx_base       ="<<coarseNodeDx<<" == "<<coarseNodeDx);
+            //UBLOG(logINFO, "* dx_refine     ="<<fineNodeDx<<" == "<<fineNodeDx );
+            //UBLOG(logINFO, "* nx1/2/3       ="<<nx[0]<<"/"<<nx[1]<<"/"<<nx[2]);
+            UBLOG(logINFO, "* blocknx1/2/3  ="<<blocknx[0]<<"/"<<blocknx[1]<<"/"<<blocknx[2]);
+            UBLOG(logINFO, "* x2Periodic    ="<<periodicx2);
+            UBLOG(logINFO, "* x3Periodic    ="<<periodicx3);
+            UBLOG(logINFO, "* number of threads ="<<numOfThreads);
+            UBLOG(logINFO, "* number of processes ="<<comm->getNumberOfProcesses());
+            UBLOG(logINFO, "*****************************************");
+/*            UBLOGML(logINFO, "UnitConverter:"<<unitConverter->toString());
+            UBLOG(logINFO, "*****************************************");  */   
+         }
+
+         if(myid == 0) UBLOG(logINFO,"Refinement - start");	
+
+         //////////////////////////////////////////////////////////////////////////
+         // refine
+         //////////////////////////////////////////////////////////////////////////
+         //GbCuboid3DPtr wallsX1X2minRef3(new GbCuboid3D(  originX1-3.0*geoOverlap   , originX2-3.0*geoOverlap  , originX3-3.0*geoOverlap
+         //   , originX1+geoLength[0]+geoOverlap, originX2+geoOverlap+geoLength[1], kanalhoeheSI*0.6/*0.55*/));
+
+         //GbCuboid3DPtr wallsX1X2minRef4(new GbCuboid3D(  originX1-3.0*geoOverlap   , originX2-3.0*geoOverlap  ,kanalhoeheSI*0.49
+         //   , originX1+geoLength[0]+geoOverlap, originX2+geoOverlap+geoLength[1], kanalhoeheSI*0.53));
+
+         //GbCuboid3DPtr wallsX1X2maxRef2(new GbCuboid3D(  originX1-3.0*geoOverlap   , originX2-3.0*geoOverlap  ,kanalhoeheSI*0.9
+         //   , originX1+geoLength[0]+geoOverlap, originX2+geoOverlap+geoLength[1], originX3+geoOverlap+geoLength[2]));
+
+         //GbCuboid3DPtr wallsX1X2maxRef1(new GbCuboid3D(  originX1-3.0*geoOverlap   , originX2-3.0*geoOverlap  ,kanalhoeheSI*0.95
+         //   , originX1+geoLength[0]+geoOverlap, originX2+geoOverlap+geoLength[1], originX3+geoOverlap+geoLength[2]));
+
+         //if (refineLevel > 0)
+         //{
+
+         //   RefineCrossAndInsideGbObjectHelper refineHelper(grid, refineLevel);
+         //   refineHelper.addGbObject(wallsX1X2minRef3, refineLevel-1);
+         //   refineHelper.addGbObject(wallsX1X2minRef4, refineLevel);
+         //   refineHelper.addGbObject(wallsX1X2maxRef2, refineLevel-1);
+         //   refineHelper.addGbObject(wallsX1X2maxRef1, refineLevel);
+
+         //   refineHelper.refine();
+         //   if(myid == 0) UBLOG(logINFO,"Refinement - end");	
+         //}
+
+         ///interactoren
+         //int bbOption1 = 0; //0=simple Bounce Back, 1=quadr. BB
+         //D3Q27BoundaryConditionAdapterPtr bcObst(new D3Q27NoSlipBCAdapter(bbOption1));
+         ///////würfel unten version ende
+         ////////////////////////////////////////////////////////////////////////////////
+         ////////PM grid
+         //Temporär:
+         //double  H=1.0;
+
+         vector<D3Q27InteractorPtr> D3Q27InteractorPtrarray;
+         ////////////////////////////////////////////////////////////////////////////////
+         double dpCubes=(double)H/20.0;
+         double distanceXY=dpCubes/2.0-coarseNodeDx*0.5;
+         double distanceZ=0;
+   
+         for (int x = 0; x<30; x++)
+            for (int y = 0; y<20; y++)
+               for (int z = 0; z<9; z++)
+               {
+                  double xminCubes = originX1+distanceXY+2.0*dpCubes*x;
+                  double yminCubes = originX2+distanceXY+2.0*dpCubes*y;
+                  double zminCubes = originX3+distanceZ+2.0*dpCubes*z;
+                  double xmaxCubes = xminCubes+dpCubes;
+                  double ymaxCubes = yminCubes+dpCubes;
+                  double zmaxCubes = zminCubes+dpCubes;
+                  GbCuboid3DPtr rectTemp(new GbCuboid3D(xminCubes, yminCubes, zminCubes, xmaxCubes, ymaxCubes, zmaxCubes));
+                  D3Q27BoundaryConditionAdapterPtr cubeBCAdapter(new D3Q27NoSlipBCAdapter());                   
+                  D3Q27InteractorPtr cubeInteractor( new D3Q27Interactor(rectTemp,grid,cubeBCAdapter,Interactor3D::SOLID));
+                  D3Q27InteractorPtrarray.push_back(cubeInteractor); 
+               }
+
+         ////////////////
+         //ende cubes
+         //////////
+         ////////////////////////////////////////////
+         //METIS
+         Grid3DVisitorPtr metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B));
+
+         ////////////////////////////////////////////
+         /////delete solid blocks
+         if(myid == 0) UBLOG(logINFO,"deleteSolidBlocks - start");
+         InteractorsHelper intHelper(grid, metisVisitor);
+         intHelper.addInteractor(topBCInteractor);
+         intHelper.addInteractor(bottomBCInteractor);
+         for(size_t i=0; i<D3Q27InteractorPtrarray.size(); ++i)
+         {
+            intHelper.addInteractor(D3Q27InteractorPtrarray[i]);
+         }
+         intHelper.selectBlocks();
+         if(myid == 0) UBLOG(logINFO,"deleteSolidBlocks - end");	 
+         //////////////////////////////////////
+
+         //domain decomposition for threads
+         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
+         grid->accept(pqPartVisitor);
+
+         if(myid == 0) UBLOG(logINFO,"Write blocks - start");
+         BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname + "/grid/blocks", WbWriterVtkXmlBinary::getInstance(), comm));
+         if(myid == 0) ppblocks->update(0);
+         if(myid == 0) UBLOG(logINFO,"Write blocks - end");
+
+         unsigned long nob = grid->getNumberOfBlocks();
+         unsigned long nod = nob * blocknx[0]*blocknx[1]*blocknx[2];
+         unsigned long nod_real = nob * (blocknx[0]+3)*(blocknx[1]+3)*(blocknx[2]+3);
+
+         double needMemAll  = double(nod_real*(27*sizeof(double) + sizeof(int)));
+         double needMem  = needMemAll / double(comm->getNumberOfProcesses());
+
+         if(myid == 0)
+         {
+            UBLOG(logINFO,"Number of blocks = " << nob);
+            UBLOG(logINFO,"Number of nodes  = " << nod);
+            UBLOG(logINFO,"Necessary memory  = " << needMemAll  << " bytes");
+            UBLOG(logINFO,"Necessary memory per process = " << needMem  << " bytes");
+            UBLOG(logINFO,"Available memory per process = " << availMem << " bytes");
+         }
+
+         LBMKernel3DPtr kernel;
+         kernel = LBMKernel3DPtr(new LBMKernelETD3Q27CCLB(blocknx[0], blocknx[1], blocknx[2], LBMKernelETD3Q27CCLB::NORMAL));
+         BCProcessorPtr bcProc(new D3Q27ETBCProcessor());
+         kernel->setBCProcessor(bcProc);
+     
+         mu::Parser fctForcingX1;
+         fctForcingX1.SetExpr("Fx1*dx");
+         fctForcingX1.DefineConst("Fx1", 0.6*5.0e-6);//9.99685e-7);
+
+         kernel->setForcingX1(fctForcingX1);
+         kernel->setWithForcing(true); 
+
+         SetKernelBlockVisitor kernelVisitor(kernel, nuLB, availMem, needMem);
+         grid->accept(kernelVisitor);
+
+         //////////////////////////////////
+         //undef nodes
+         if (refineLevel > 0)
+         {
+            D3Q27SetUndefinedNodesBlockVisitor undefNodesVisitor;
+            grid->accept(undefNodesVisitor);
+         }
+         //////////////////////////////////////////
+         intHelper.setBC();
+
+         for(size_t i=0; i<D3Q27InteractorPtrarray.size(); ++i)
+         {
+            grid->addAndInitInteractor( D3Q27InteractorPtrarray[i] ); 
+            char numstr[21];
+            sprintf(numstr, "%f", (double)i);
+            std::string pathObstCube = pathname+"/geo/obstBCCuboid"+ numstr;
+            if(myid == 0) GbSystem3D::writeGeoObject(D3Q27InteractorPtrarray[i]->getGbObject3D().get(),
+               /* rectTemp.get(),*/ pathObstCube, WbWriterVtkXmlASCII::getInstance());
+         }
+
+
+         ppblocks.reset();
+
+         //inflow
+         mu::Parser inflowProfile;
+         inflowProfile.SetExpr("uLB*0.9"); 
+         inflowProfile.DefineConst("uLB",uLB);
+
+         //set connectors
+         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
+         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
+         grid->accept( setConnsVisitor );
+
+         //initialization of decompositions
+         D3Q27ETInitDistributionsBlockVisitor initVisitor( nuLB,rhoLB);
+         initVisitor.setVx1(inflowProfile);
+         grid->accept(initVisitor);
+
+         //Postrozess
+         UbSchedulerPtr geoSch(new UbScheduler(1));
+         D3Q27MacroscopicQuantitiesPostprocessorPtr ppgeo(
+            new D3Q27MacroscopicQuantitiesPostprocessor(grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), 
+            unitConverter,true));
+
+         ppgeo->update(0);
+         ppgeo.reset();
+         geoSch.reset();
+
+         if(myid == 0) UBLOG(logINFO,"Preprozess - end");      
+
+      }
+            else
+            {
+               //set forcing
+               mu::Parser fctForcingX1, fctForcingX2, fctForcingX3;
+               fctForcingX1.SetExpr("Fx1*dx");
+               fctForcingX1.DefineConst("Fx1", 0.6*5.0e-6);
+               fctForcingX2.SetExpr("0.0");
+               fctForcingX3.SetExpr("0.0");
+               SetForcingBlockVisitor forcingVisitor(fctForcingX1, fctForcingX2, fctForcingX3);
+               grid->accept(forcingVisitor);
+
+               //set connectors
+               D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
+               D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
+               grid->accept( setConnsVisitor );
+               if(myid == 0) UBLOG(logINFO,"Restart - end"); 
+      }
+
+
+      UbSchedulerPtr visSch(new UbScheduler());
+      visSch->addSchedule(100,100,1000);
+      visSch->addSchedule(1000,1000,10000);
+      visSch->addSchedule(10000,10000,100000);
+      //visSch->addSchedule(20000,20000,800000);
+      //visSch->addSchedule(50,350000,350500);
+      //visSch->addSchedule(50,420000,420500);
+      //visSch->addSchedule(50000,420500,10000000);
+      //visSch->addSchedule(2250,140000,450001);
+      //UbSchedulerPtr resSch(new UbScheduler());
+      //resSch->addSchedule(20000,20,10000000);
+      //UbSchedulerPtr resSchRMS(new UbScheduler());
+      //resSchRMS->addSchedule(40000,420000,10000000);
+      //UbSchedulerPtr resSchMeans(new UbScheduler());
+      //resSchMeans->addSchedule(40000,0,10000000);
+      //UbSchedulerPtr stepAvSch(new UbScheduler());
+      //stepAvSch->addSchedule(20,0,10000000);
+      //AverageValuesPostprocessor Avpp(grid, pathname + "/steps/stepAV", WbWriterVtkXmlBinary::getInstance(), 
+      //                                visSch/*wann wird rausgeschrieben*/, stepAvSch/*wann wird gemittelt*/, resSchMeans, resSchRMS/*wann wird resettet*/);
+
+      D3Q27MacroscopicQuantitiesPostprocessor pp(grid, visSch, pathname, WbWriterVtkXmlBinary::getInstance(), unitConverter);
+
+      UbSchedulerPtr nupsSch(new UbScheduler(10, 30, 100));
+      NUPSCounterPostprocessor npr(grid, nupsSch, pathname + "/results/nups.txt", comm);
+
+
+      UbSchedulerPtr AdjForcSch(new UbScheduler());
+      AdjForcSch->addSchedule(100,100,20000000);
+      //D3Q27IntegrateValuesHelperPtr IntValHelp(new D3Q27IntegrateValuesHelper(grid, comm, 
+      //   originX1, originX2, kanalhoeheSI*0.55/*0.501*/, 
+      //   nx[0]*blockLengthx1, nx[1]*blockLengthx2, kanalhoeheSI*0.999));
+      D3Q27IntegrateValuesHelperPtr IntValHelp(new D3Q27IntegrateValuesHelper(grid, comm, 
+         originX1, originX2, g_maxX3*0.55/*0.501*/, 
+         g_maxX1, g_maxX2, g_maxX3*0.999));
+
+      double vxZiel=uLB;
+      //D3Q27AdjustForcingPostprocessor AdjForcPPPtr(grid, AdjForcSch,IntValHelp, vxZiel*0.6, comm);//da am 11.3.2013 velo um 1/0.6 zu hoch
+      D3Q27AdjustForcingPostprocessor AdjForcPPPtr(grid, AdjForcSch,IntValHelp, vxZiel, comm);//dies sollte zu Re=5500 fuehren..
+
+      UbSchedulerPtr visQSch(new UbScheduler());
+      visQSch->addSchedule(10,90100,90130);
+      QCriterionPostprocessor QKritPtr(grid,pathname+"/steps/Qq",WbWriterVtkXmlBinary::getInstance(),visQSch, comm);
+
+      //mu::Parser decrViscFunc;
+      //decrViscFunc.SetExpr("nue0+c0/(t+1)/(t+1)");
+      //decrViscFunc.DefineConst("nue0", nuLB);
+      //decrViscFunc.DefineConst("c0", 0.1);
+      //UbSchedulerPtr DecrViscSch(new UbScheduler());
+      //DecrViscSch->addSchedule(10,10,1000);
+      //DecreaseViscosityPostprocessor decrViscPPPtr(grid, DecrViscSch,&decrViscFunc, comm);
+
+      cout << "PID = " << myid << " Total Physical Memory (RAM): " << Utilities::getTotalPhysMem()<<endl;
+      cout << "PID = " << myid << " Physical Memory currently used: " << Utilities::getPhysMemUsed()<<endl;
+      cout << "PID = " << myid << " Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe()<<endl;
+
+      double endTime = 2000000;//20000001;
+      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, visSch));
+      if(myid == 0) UBLOG(logINFO,"Simulation-start");
+      calculation->calculate();
+      if(myid == 0) UBLOG(logINFO,"Simulation-end");
+   }
+   catch(std::exception& e)
+   {
+      cerr << e.what() << endl << flush;
+   }
+   catch(std::string& s)
+   {
+      cerr << s << endl;
+   }
+   catch(...)
+   {
+      cerr << "unknown exception" << endl;
+   }
+
+}
+int main(int argc, char* argv[])
+{
+
+   run(argv[1]);
+
+   return 0;
+}
+
diff --git a/apps/cpu/bKanalAv/bKanal.cpp b/apps/cpu/bKanalAv/bKanal.cpp
index 28f3456abe6d47603ee857e2d64e7fd8940c0ce3..067aabbddc7284603bf3d8dfa2c6bf4a5eca99a8 100644
--- a/apps/cpu/bKanalAv/bKanal.cpp
+++ b/apps/cpu/bKanalAv/bKanal.cpp
@@ -1,738 +1,738 @@
-
-
-#include <iostream>
-#include <string>
-#include <math.h> 
-
-#include <sys/types.h> //mkdir rights
-#include <sys/stat.h> //mkdir
-#include <vfluids.h>
-
-using namespace std;
-
-
-void run(const char *cstr)
-{
-   try
-   {
-      string machine = QUOTEME(CAB_MACHINE);
-      UBLOG(logINFO,"Testcase BreugemChannel");
-      string pathname; 
-      string pathnameRestart;
-      string pathGeo;
-      int numOfThreads =1;
-      bool logfile = false;
-      stringstream logFilename;
-      double availMem = 0;
-
-      UbLog::reportingLevel() = logINFO;
-
-      CommunicatorPtr comm = MPICommunicator::getInstance();
-      int myid = comm->getProcessID();
-
-
-         pathname =        "./";
-         //pathnameRestart = "/gfs1/work/niivfcpu/scratch/kucher/BKanaltest";//BKanaltest0Ref2up0612";//BKanaltest0Ref2up1012Out";
-         //pathname =        "/work/koskuche/SFB880/BKanaltestRe260000Out";
-         //pathnameRestart = "/work/koskuche/SFB880/BKanaltestRe260000";//BKanaltest0Ref2up0612";//BKanaltest0Ref2up1012Out";
-
-   	 //pathGeo = "/home/koskuche/data/plate";
-         numOfThreads = 1;
-         availMem = 64.0e9;
-         logfile = true;
-
-//         if (myid==0) 
-//         {
-//            const char* str = pathname.c_str();
-//#if defined(__unix__)
-//            int status=mkdir(str, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
-//#endif 
-//
-//         }
-//
-//         if(myid ==0)
-//         {
-//            logFilename <<  pathname + "/logfile"+UbSystem::toString(UbSystem::getTimeStamp())+"_"+UbSystem::toString(myid)+".txt";
-//         }
-
-
-
-
-      //if(myid ==0 && logfile)
-      //{
-      UbLog::output_policy::setStream(logFilename.str());
-      //}
-
-      int baseLevel, refineLevel,nx[3],blocknx[3];
-      double Re,velocity,rhoInit,vx1Init;//,vx2Init,vx3Init;
-
-      //////////////////////////////////////////////////////////////////////////
-      //physik
-      //////////////////////////////////////////////////////////////////////////
-      Re            = 5500;// 13286;//13286;//gemessen 18.98 m/s...*5.0 zum  testen ob was passiert
-      velocity      = 0.01;  
-      vx1Init       = 0.01;  
-      rhoInit       = 0.0;
-      SimulationParametersPtr param = SimulationParameters::getInstanz();
-
-      int H=200;//200;//392;
-
-      //  nx[0]      =8;//ok mit 8// (int)(3.0*(double)H/8.0/8.0);//2;// (int)(0.3*(double)H/6.0/4.0);//das "/4" hier ist wegen der verfeinerung da! //länge
-      //  nx[1]      =8;//ok mit 8// (int)(2.0*(double)H/8.0/8.0);//2;// (int)(0.2*(double)H/6.0/4.0);//  //breite
-      nx[2]      = (int)(2.0*(double)H/5.0/8.0);// //höhe gebiet
-
-      //(3/2/2)-ratio:
-      nx[1]=nx[2];
-      nx[0]=15;
-
-      blocknx[0] = 15;//10;//5;
-      blocknx[1] = 15;//10;//5;
-      blocknx[2] = 15;//10;//5;
-
-      baseLevel   = 0;
-      refineLevel = 2;//1;////3;//3 soll 1 test;
-
-
-      ///////////////Weltabmessungen:
-      //double kanallaengeSI = ( 2.0*(double)H);
-      // double kanalbreiteSI = ( 1.0*(double)H);
-      double kanalhoeheSI  = ( 2.0*(double)H);
-
-      // double refinewidth1=kanalhoeheSI/10.0;
-
-      double fineNodeDx   = (kanalhoeheSI) / (double)( blocknx[2]*nx[2]*(1<<refineLevel)+1 ); //+1--> gitter liegt jeweils 0.5dx innerhalb
-      double coarseNodeDx = fineNodeDx * (double)(1<<refineLevel);//geowerte
-
-      double blockLengthx1 = blocknx[0]*coarseNodeDx; //geowerte
-      double blockLengthx2 = blockLengthx1;
-      double blockLengthx3 = blockLengthx1;
-
-      double originX1 = 0.0;//-50.0*propellerDurchmesser;  //geowerte
-      double originX2 = 0.0;//-0.5*blockLengthx2*nx2;
-      double originX3 = 0.0;// minX3 + 0.5*fineNodeDx;
-
-      double geoLength[]   = {  nx[0]*blockLengthx1, nx[1]*blockLengthx2, nx[2]*blockLengthx3}; 
-
-      bool periodicx1 = true;
-      bool periodicx2 = true;
-      bool periodicx3 = false;
-
-
-      //##########################################################################
-      //## physical parameters
-      //##########################################################################
-      double smagorinskiConstant = 0.18;
-
-
-      double rhoLB         = 0.0;
-
-      double rhoReal       = 1.0;
-      double nueReal  = 1;//0.000016;//0.015;
-
-      double hReal         = blocknx[2]*nx[2];//H*0.9;//0.0105;//<-m     1.05;//Plattendicke in cm(! cm nicht m !)
-      double uReal         = Re*nueReal/hReal;
-
-      //##Machzahl:
-      //#Ma     = uReal/csReal
-      double csReal=343.0;
-      double Ma      = uReal/csReal;//Ma-Real!
-      //double csReal  = uReal/Ma;
-      double hLB     = hReal/coarseNodeDx;
-
-      LBMUnitConverterPtr unitConverter = LBMUnitConverterPtr(new LBMUnitConverter(hReal, csReal, rhoReal, hLB));
-
-      double uLB           = uReal   * unitConverter->getFactorVelocityWToLb();
-      double nueLB         = nueReal * unitConverter->getFactorViscosityWToLb();
-      double timestep      = unitConverter->getFactorTimeLbToW(coarseNodeDx);
-
-      velocity = uLB;
-      // double viscosity =nueLB*1000.0;
-
-      Grid3DPtr grid(new Grid3D(comm));
-      //UbSchedulerPtr rSch(new UbScheduler(10000,100000,30000000000));//(50000,50000,1000000));
-      //UbSchedulerPtr rSch(new UbScheduler(18000,268250,770000));//(50000,50000,1000000));
-      //RestartPostprocessor rp(grid, rSch, comm, pathnameRestart+"/checkpoints", RestartPostprocessor::BINARY);
-
-      //////////////////////////////////////////////////////////////////////////
-
-      std::string opt;
-
-//      if(cstr!= NULL)
-//         opt = std::string(cstr);
-//
-//      if(/*(cstr== NULL)*/cstr!= NULL)
-//      {
-//         opt = std::string(cstr);
-//
-//         if(myid==0) {
-//            UBLOG(logINFO,"Restart step: " << opt);
-//            UBLOG(logINFO, "Restart=:" << pathnameRestart);
-//         }
-//
-//         grid = rp.restart(UbSystem::stringTo<int>(opt));
-//         rp.reconnect(grid);
-//
-////          mu::Parser fctForcingX1, fctForcingX2, fctForcingX3;
-////          fctForcingX1.SetExpr("Fx1*dx");
-////          fctForcingX1.DefineConst("Fx1", 0.6*5.0e-6);
-//// 
-////          SetForcingBlockVisitor forcingVisitor(fctForcingX1, fctForcingX2, fctForcingX3);
-////          grid->accept(forcingVisitor);
-//
-//         //set connectors
-//         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
-//         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
-//         grid->accept( setConnsVisitor );
-//
-//      }
-//      else
-//      {
-         //bounding box
-         double g_minX1 = originX1;
-         double g_minX2 = originX2;
-         double g_minX3 = originX3;
-
-         double g_maxX1 = originX1 + geoLength[0];
-         double g_maxX2 = originX2 + geoLength[1];
-         double g_maxX3 = originX3 + geoLength[2];
-
-         //set grid
-         grid->setDeltaX(coarseNodeDx);
-         grid->setBlockNX(blocknx[0], blocknx[1], blocknx[2]);
-         grid->setPeriodicX1(periodicx1);
-         grid->setPeriodicX2(periodicx2);
-         grid->setPeriodicX3(periodicx3);
-
-
-         GbObject3DPtr gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
-         if(myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), pathname+"/geo/gridCube", WbWriterVtkXmlASCII::getInstance());
-
-         //GenBlocksGridVisitor genBlocks;
-         //genBlocks.addGeoObject(gridCube);
-         //grid->accept(genBlocks);
-
-
-
-         //bottom and top solid bc
-         //iteractors
-         int bbOption1 = 1; //0=simple Bounce Back, 1=quadr. BB
-         D3Q27BoundaryConditionAdapterPtr bcObst(new D3Q27NoSlipBCAdapter(bbOption1));
-         double geoOverlap = coarseNodeDx;
-         GbCuboid3DPtr bottomBCCuboid(new GbCuboid3D(originX1-geoOverlap, originX2-geoOverlap, originX3-geoOverlap, 
-            originX1+geoLength[0]+coarseNodeDx, originX2+geoLength[1]+geoOverlap, originX3));
-         if(myid == 0) GbSystem3D::writeGeoObject(bottomBCCuboid.get(), pathname+"/geo/bottomBCCuboid", WbWriterVtkXmlASCII::getInstance());
-         D3Q27InteractorPtr bottomBCInteractor(new D3Q27Interactor(bottomBCCuboid,grid,bcObst,Interactor3D::SOLID)); 
-
-         GbCuboid3DPtr topBCCuboid(new GbCuboid3D(originX1-geoLength[0]-coarseNodeDx, originX2-geoOverlap, originX3+geoLength[2],//-coarseNodeDx*0.5, 
-            originX1+geoLength[0]+coarseNodeDx, originX2+geoLength[1]+geoOverlap, originX3+geoLength[2]+geoOverlap));
-         if(myid == 0) GbSystem3D::writeGeoObject(topBCCuboid.get(), pathname+"/geo/topBCCuboid", WbWriterVtkXmlASCII::getInstance());
-         D3Q27InteractorPtr topBCInteractor(new D3Q27Interactor(topBCCuboid,grid,bcObst,Interactor3D::SOLID)); 
-         //grid->addAndInitInteractor( bottomBCInteractor ); 
-         // grid->addAndInitInteractor( topBCInteractor ); 
-         //////////////////////////////////////////////////////////////////////////
-         if(myid == 0)
-         {
-            UBLOG(logINFO, "*****************************************");
-            UBLOG(logINFO, "* Parameters                            *");
-            UBLOG(logINFO, "* Re            ="<<Re);
-            UBLOG(logINFO, "* Ma            ="<<Ma);
-            UBLOG(logINFO, "* uReal         ="<<uReal);
-            UBLOG(logINFO, "* nueReal       ="<<nueReal);
-            UBLOG(logINFO, "* nue           ="<<nueLB);
-            UBLOG(logINFO, "* velocity      ="<<uLB);
-            // UBLOG(logINFO, "* LX1 (world/LB)="<<kanallaengeSI<<"/"<<kanallaengeSI/coarseNodeDx);
-            //  UBLOG(logINFO, "* LX2 (world/LB)="<<kanalbreiteSI<<"/"<<kanalbreiteSI/coarseNodeDx);
-            UBLOG(logINFO, "* LX3 (world/LB)="<<kanalhoeheSI<<"/"<<kanalhoeheSI/coarseNodeDx);
-            UBLOG(logINFO, "* cdx           ="<<coarseNodeDx);
-            UBLOG(logINFO, "* fdx           ="<<fineNodeDx);
-            UBLOG(logINFO, "* dx_base       ="<<coarseNodeDx<<" == "<<coarseNodeDx);
-            UBLOG(logINFO, "* dx_refine     ="<<fineNodeDx<<" == "<<fineNodeDx );
-            UBLOG(logINFO, "* nx1/2/3       ="<<nx[0]<<"/"<<nx[1]<<"/"<<nx[2]);
-            UBLOG(logINFO, "* blocknx1/2/3  ="<<blocknx[0]<<"/"<<blocknx[1]<<"/"<<blocknx[2]);
-            UBLOG(logINFO, "* x2Periodic    ="<<periodicx2);
-            UBLOG(logINFO, "* x3Periodic    ="<<periodicx3);
-            UBLOG(logINFO, "*****************************************");
-            UBLOGML(logINFO, "UnitConverter:"<<unitConverter->toString());
-            UBLOG(logINFO, "*****************************************");     
-         }
-
-         if(myid == 0) UBLOG(logINFO,"Refinement - start");	
-
-         //////////////////////////////////////////////////////////////////////////
-         // refine
-         //////////////////////////////////////////////////////////////////////////
-         //GbCuboid3DPtr wallsX1X2maxRef1( new GbCuboid3D(  originX1-geoOverlap   , originX2-geoOverlap  , kanalhoeheSI*0.95
-         //    , originX1+geoLength[0]+geoOverlap, originX2+geoOverlap+geoLength[1], kanalhoeheSI));
-         //RefineCrossAndInsideGbObjectBlockVisitor refineVisitormax1(wallsX1X2maxRef1, 0,refineLevel-3);
-         //grid->accept(refineVisitormax1);
-         //
-         //GbCuboid3DPtr wallsX1X2minRef1(new GbCuboid3D(  originX1-geoOverlap   , originX2-geoOverlap  , kanalhoeheSI*0.55
-         //    , originX1+geoLength[0]+geoOverlap, originX2+geoOverlap+geoLength[1], kanalhoeheSI*0.47));
-         // RefineCrossAndInsideGbObjectBlockVisitor refineVisitormin1(wallsX1X2minRef1, 0,refineLevel-3);
-         // grid->accept(refineVisitormin1);
-
-         //   GbCuboid3DPtr wallsX1X2maxRef2(new GbCuboid3D(  originX1-geoOverlap   , originX2-geoOverlap  , kanalhoeheSI
-         //   , originX1+geoLength[0]+geoOverlap, originX2+geoOverlap+geoLength[1], kanalhoeheSI*0.98));
-         //RefineCrossAndInsideGbObjectBlockVisitor refineVisitormax2(wallsX1X2maxRef2, 0,refineLevel-2);
-         //grid->accept(refineVisitormax2);
-         //   GbCuboid3DPtr wallsX1X2maxRef2(new GbCuboid3D(  originX1-geoOverlap   , originX2-geoOverlap  , kanalhoeheSI
-         //   , originX1+geoLength[0]+geoOverlap, originX2+geoOverlap+geoLength[1], kanalhoeheSI*0.9));
-         //RefineCrossAndInsideGbObjectBlockVisitor refineVisitormax2(wallsX1X2maxRef2, 0,refineLevel-2);
-         //grid->accept(refineVisitormax2);
-
-         // GbCuboid3DPtr wallsX1X2maxRef3(new GbCuboid3D(  originX1-geoOverlap   , originX2-geoOverlap  , kanalhoeheSI
-         //   , originX1+geoLength[0]+geoOverlap, originX2+geoOverlap+geoLength[1], kanalhoeheSI*0.9995));
-         //RefineCrossAndInsideGbObjectBlockVisitor refineVisitormax3(wallsX1X2maxRef3, 0,refineLevel-1);
-         //grid->accept(refineVisitormax3);
-
-         //         GbCuboid3DPtr wallsX1X2minRefl3(new GbCuboid3D(  originX1-3.0*geoOverlap   , originX2-3.0*geoOverlap  , originX3-3.0*geoOverlap
-         //   , originX1+geoLength[0]+geoOverlap, originX2+geoOverlap+geoLength[1], kanalhoeheSI*0.25));
-         //RefineCrossAndInsideGbObjectBlockVisitor refineVisitorminl3(wallsX1X2minRefl3, 0,refineLevel-3);
-         //grid->accept(refineVisitorminl3);
-         /////würfel unten version
-         //      GbCuboid3DPtr wallsX1X2minRef2(new GbCuboid3D(  originX1-3.0*geoOverlap   , originX2-3.0*geoOverlap  , originX3-3.0*geoOverlap
-         //   , originX1+geoLength[0]+geoOverlap, originX2+geoOverlap+geoLength[1], kanalhoeheSI*0.2));
-         //RefineCrossAndInsideGbObjectBlockVisitor refineVisitormin2(wallsX1X2minRef2, 0,refineLevel-2);
-         //grid->accept(refineVisitormin2);
-
-         //   GbCuboid3DPtr wallsX1X2minRef3(new GbCuboid3D(  originX1-3.0*geoOverlap   , originX2-3.0*geoOverlap  , kanalhoeheSI*0.04
-         //   , originX1+geoLength[0]+geoOverlap, originX2+geoOverlap+geoLength[1], kanalhoeheSI*0.18));
-         //RefineCrossAndInsideGbObjectBlockVisitor refineVisitormin3(wallsX1X2minRef3, 0,refineLevel-1);
-         //grid->accept(refineVisitormin3);
-
-         //      GbCuboid3DPtr wallsX1X2minRef4(new GbCuboid3D(  originX1-3.0*geoOverlap   , originX2-3.0*geoOverlap  , kanalhoeheSI*0.09
-         //   , originX1+geoLength[0]+geoOverlap, originX2+geoOverlap+geoLength[1], kanalhoeheSI*0.16));
-         //RefineCrossAndInsideGbObjectBlockVisitor refineVisitormin4(wallsX1X2minRef4, 0,refineLevel);
-         //grid->accept(refineVisitormin4);
-
-
-
-
-         /////würfel anfang version
-         //       GbCuboid3DPtr wallsX1X2minRef2(new GbCuboid3D(  originX1-3.0*geoOverlap   , originX2-3.0*geoOverlap  , originX3-3.0*geoOverlap
-         //   , originX1+geoLength[0]+geoOverlap, originX2+geoOverlap+geoLength[1], kanalhoeheSI*0.56));
-         //RefineCrossAndInsideGbObjectBlockVisitor refineVisitormin2(wallsX1X2minRef2, 0,refineLevel-2);
-         //grid->accept(refineVisitormin2);
-
-         //   GbCuboid3DPtr wallsX1X2minRef3(new GbCuboid3D(  originX1-3.0*geoOverlap   , originX2-3.0*geoOverlap  , originX3-3.0*geoOverlap
-         //   , originX1+geoLength[0]+geoOverlap, originX2+geoOverlap+geoLength[1], kanalhoeheSI*0.55));
-         //RefineCrossAndInsideGbObjectBlockVisitor refineVisitormin3(wallsX1X2minRef3, 0,refineLevel-2);
-         //grid->accept(refineVisitormin3);
-
-         //      GbCuboid3DPtr wallsX1X2minRef4(new GbCuboid3D(  originX1-3.0*geoOverlap   , originX2-3.0*geoOverlap  ,kanalhoeheSI*0.49
-         //   , originX1+geoLength[0]+geoOverlap, originX2+geoOverlap+geoLength[1], kanalhoeheSI*0.53));
-         //RefineCrossAndInsideGbObjectBlockVisitor refineVisitormin4(wallsX1X2minRef4, 0,refineLevel-1);
-         //grid->accept(refineVisitormin4);
-
-
-         /*           GbCuboid3DPtr wallsX1X2minRef4(new GbCuboid3D(  originX1-3.0*geoOverlap   , originX2-3.0*geoOverlap  , originX1-3.0*geoOverlap
-         , originX1+geoLength[0]+geoOverlap, originX2+geoOverlap+geoLength[1], kanalhoeheSI*0.1));
-         RefineCrossAndInsideGbObjectBlockVisitor refineVisitormin4(wallsX1X2minRef4, 0,refineLevel-1);
-         grid->accept(refineVisitormin4);*/
-
-         ////GbCuboid3DPtr refine1PlatteCube(new GbCuboid3D(  originX1-geoOverlap   , originX2-geoOverlap  , x3minMesh-H3
-         ////   , x1maxMesh+H3*5.0, originX2+geoOverlap+geoLength[1], x3maxMesh+H3));
-         ////RefineCrossAndInsideGbObjectBlockVisitor refineAdapterP1(refine1PlatteCube, baseLevel, refineLevel-6);
-         ////grid->accept(refineAdapterP1);
-
-         //GbCuboid3DPtr refine2PlatteCube(new GbCuboid3D(  originX1-geoOverlap   , originX2-geoOverlap  , x3minMesh-H3*0.5
-         //  , x1maxMesh+H3*5.0, originX2+geoOverlap+geoLength[1], x3maxMesh+H3));
-         //RefineCrossAndInsideGbObjectBlockVisitor refineAdapterP2(refine2PlatteCube, baseLevel, refineLevel-5);
-         //grid->accept(refineAdapterP2);
-
-         //GbCuboid3DPtr refine3PlatteCube(new GbCuboid3D(  originX1-geoOverlap  , originX2-geoOverlap  , x3minMesh-H3*0.5
-         //   , x1maxMesh+H3*5.0, originX2+geoOverlap+geoLength[1], x3maxMesh+H3*0.5));
-         //RefineCrossAndInsideGbObjectBlockVisitor refineAdapterP3(refine3PlatteCube, baseLevel, refineLevel-4);
-         //grid->accept(refineAdapterP3);
-
-         //GbCuboid3DPtr refine4PlatteCube(new GbCuboid3D(   originX1-geoOverlap  , originX2-geoOverlap  , x3minMesh+deltaX3Platte*0.0
-         //   ,  x1maxMesh+H3*5.0, originX2+geoOverlap+geoLength[1], x3maxMesh+H3*0.25));
-         //if(myid == 0) GbSystem3D::writeGeoObject(refine4PlatteCube.get(), pathname+"/geo/refine4PlatteCube", WbWriterVtkXmlASCII::getInstance());
-         //RefineCrossAndInsideGbObjectBlockVisitor refineAdapterP4(refine4PlatteCube, baseLevel, refineLevel-3);
-         //grid->accept(refineAdapterP4);
-
-         //GbCuboid3DPtr refine5PlatteCube(new GbCuboid3D(   originX1-geoOverlap , originX2-geoOverlap  ,x3minMesh+deltaX3Platte*0.1/* x3minMesh+deltaX3Platte*0.8*/
-         //   ,  x1maxMesh+H3*5.0, originX2+geoOverlap+geoLength[1], x3maxMesh+H3*0.00375));
-         //if(myid == 0) GbSystem3D::writeGeoObject(refine5PlatteCube.get(), pathname+"/geo/refine5PlatteCube", WbWriterVtkXmlASCII::getInstance());
-         //RefineCrossAndInsideGbObjectBlockVisitor refineAdapterP5(refine5PlatteCube, baseLevel, refineLevel-2);
-         //grid->accept(refineAdapterP5);
-
-
-         //GbCuboid3DPtr wallsX1X2minRef4(new GbCuboid3D(  originX1-3.0*geoOverlap   , originX2-3.0*geoOverlap  , originX1-3.0*geoOverlap
-         //	  , originX1+geoLength[0]+geoOverlap, originX2+geoOverlap+geoLength[1], kanalhoeheSI*0.1));
-
-         GbCuboid3DPtr wallsX1X2minRef3(new GbCuboid3D(  originX1-3.0*geoOverlap   , originX2-3.0*geoOverlap  , originX3-3.0*geoOverlap
-            , originX1+geoLength[0]+geoOverlap, originX2+geoOverlap+geoLength[1], kanalhoeheSI*0.6/*0.55*/));
-
-         GbCuboid3DPtr wallsX1X2minRef4(new GbCuboid3D(  originX1-3.0*geoOverlap   , originX2-3.0*geoOverlap  ,kanalhoeheSI*0.49
-            , originX1+geoLength[0]+geoOverlap, originX2+geoOverlap+geoLength[1], kanalhoeheSI*0.53));
-
-         GbCuboid3DPtr wallsX1X2maxRef2(new GbCuboid3D(  originX1-3.0*geoOverlap   , originX2-3.0*geoOverlap  ,kanalhoeheSI*0.9
-            , originX1+geoLength[0]+geoOverlap, originX2+geoOverlap+geoLength[1], originX3+geoOverlap+geoLength[2]));
-
-         GbCuboid3DPtr wallsX1X2maxRef1(new GbCuboid3D(  originX1-3.0*geoOverlap   , originX2-3.0*geoOverlap  ,kanalhoeheSI*0.95
-            , originX1+geoLength[0]+geoOverlap, originX2+geoOverlap+geoLength[1], originX3+geoOverlap+geoLength[2]));
-
-         //if (refineLevel > 0)
-         //{
-
-         //   RefineCrossAndInsideGbObjectHelper refineHelper(grid, refineLevel);
-         //   refineHelper.addGbObject(wallsX1X2minRef3, refineLevel-1);
-         //   refineHelper.addGbObject(wallsX1X2minRef4, refineLevel);
-         //   refineHelper.addGbObject(wallsX1X2maxRef2, refineLevel-1);
-         //   refineHelper.addGbObject(wallsX1X2maxRef1, refineLevel);
-
-         //   refineHelper.refine();
-         //   if(myid == 0) UBLOG(logINFO,"Refinement - end");	
-         //}
-
-         ///interactoren
-         //int bbOption1 = 0; //0=simple Bounce Back, 1=quadr. BB
-         //D3Q27BoundaryConditionAdapterPtr bcObst(new D3Q27NoSlipBCAdapter(bbOption1));
-         ///////würfel unten version ende
-         ////////////////////////////////////////////////////////////////////////////////
-         ////////PM grid
-         //Temporär:
-         //double  H=1.0;
-
-         //vector<D3Q27InteractorPtr> D3Q27InteractorPtrarray;
-         
-         double newDx = fineNodeDx;///2.0;
-         int geoNX1=(int)(600.0/newDx)-1; 
-         int geoNX2=(int)(400.0/newDx)-1; 
-         int geoNX3=(int)((398.0+newDx*2)/newDx); 
-         GbVoxelMatrix3D geoMatrix(geoNX1,geoNX2,geoNX3,0);
-         geoMatrix.setVoxelMatrixDelta(newDx, newDx, newDx);
-         double m_minX1 = 0 - newDx/2.0;
-         double m_minX2 = 0 - newDx/2.0;
-         double m_minX3 = 0.666 + newDx/2.0;
-         geoMatrix.setVoxelMatrixMininum(m_minX1, m_minX2, m_minX3);
-
-         //geoMatrix.writeToVTKImageDataASCII(pathname + "/geo/geoMatrix");
-         //return;
-
-         CoordinateTransformation3D trafo(m_minX1, m_minX2, m_minX3, newDx, newDx, newDx);
-
-         ////////////////////////////////////////////////////////////////////////////////
-         double inflowCubeDx = coarseNodeDx;///(double)(1<<inflowCubeLevel);
-         double dpCubes=(double)H/20.0;//100.0; //30zum testen 100real
-         double offsetZgrid=H+0.5*inflowCubeDx;
-         double epschoch1drittel= 0.928318;
-         double abstandIn=2.0*dpCubes;
-         double c1oAbst=1.0/abstandIn;
-         
-         UBLOG(logINFO,"cubes:start");
-         
-         for (int Nflowdir=0;Nflowdir<((nx[0]*blocknx[0]*c1oAbst)*coarseNodeDx); Nflowdir++)
-         {
-            // for (int Nhorizon=((nx[2]*blocknx[2]*c1oAbst)*coarseNodeDx)*0.5-2; Nhorizon<((nx[2]*blocknx[2]*c1oAbst)*coarseNodeDx)*0.5-1-1; Nhorizon++)
-            // {
-            //  for (int Nhorizon=0;  Nhorizon<(((nx[2]*blocknx[2]+1)*c1oAbst)*coarseNodeDx)*0.1; Nhorizon++)//Nhorizon<((nx[2]*blocknx[2]*c1oAbst)*coarseNodeDx)*0.5; Nhorizon++)
-            for (int Nhorizon=0;  Nhorizon<(((nx[2]*blocknx[2]+1)*c1oAbst)*coarseNodeDx)*0.5-1; Nhorizon++)//Nhorizon<((nx[2]*blocknx[2]*c1oAbst)*coarseNodeDx)*0.5; Nhorizon++)
-
-            {
-               for (int Nspanw=0; Nspanw<((nx[1]*blocknx[1]*c1oAbst)*coarseNodeDx); Nspanw++)
-               {
-                  // stringstream ss;
-                  //     ss<<"cubeH"<<Nflowdir<<"x"<<Nhorizon<<"x"<<Nspanw;
-                  ////     //   //geoOrigin ist Mitte, nicht vordere Ecke -> korrigieren
-                  // int Nflowdir=1;
-                  //int Nhorizon=0;
-                  //int Nspanw=1;
-                  double xminCubes1=originX1+(Nflowdir*abstandIn)-0.5*dpCubes+0.5*inflowCubeDx+3.0*coarseNodeDx/pow(2.0,refineLevel-1);
-                  double xmaxCubes1=originX1+(Nflowdir*abstandIn)+0.5*dpCubes+0.5*inflowCubeDx+3.0*coarseNodeDx/pow(2.0,refineLevel-1);
-                  double xminCubes=std::max(xminCubes1,2.0*coarseNodeDx/pow(2.0,refineLevel));
-                  double xmaxCubes=std::min(xmaxCubes1,originX1+geoLength[0]-coarseNodeDx/pow(2.0,refineLevel));
-                  double yminCubes=std::max(originX2+(Nspanw*abstandIn)-0.5*dpCubes+0.5*inflowCubeDx+3.0*coarseNodeDx/pow(2.0,refineLevel-1),2.0*coarseNodeDx/pow(2.0,refineLevel));
-                  double ymaxCubes=std::min(originX2+(Nspanw*abstandIn)+0.5*dpCubes+0.5*inflowCubeDx+3.0*coarseNodeDx/pow(2.0,refineLevel-1),originX2+geoLength[1]-coarseNodeDx/pow(2.0,refineLevel));
-                  double zminCubes=std::max(originX3+(Nhorizon*abstandIn)+4.0*coarseNodeDx/pow(2.0,refineLevel-1),2.0*coarseNodeDx/pow(2.0,refineLevel));
-                  double zmaxCubes=std::min(originX3+(Nhorizon*abstandIn)+dpCubes+4.0*coarseNodeDx/pow(2.0,refineLevel-1),originX3+geoLength[2]-coarseNodeDx/pow(2.0,refineLevel));
-                  ////     /*GbCuboid3D  *rectTemp = new GbCuboid3D(originX1+(Nflowdir*abstandIn)-0.5*dpCubes+0.5*inflowCubeDx, originX2+(Nspanw*abstandIn)-0.5*dpCubes+0.5*inflowCubeDx, originX3+(Nhorizon*abstandIn)-0.5*dpCubes+0.5*inflowCubeDx, 
-                  ////										 originX1+(Nflowdir*abstandIn)+0.5*dpCubes+0.5*inflowCubeDx, originX2+(Nspanw*abstandIn)+0.5*dpCubes+0.5*inflowCubeDx, originX3+(Nhorizon*abstandIn)+0.5*dpCubes+0.5*inflowCubeDx );
-                  ////*/
-                  ////  
-                  //GbCuboid3DPtr rectTemp(new GbCuboid3D(xminCubes, yminCubes, zminCubes, xmaxCubes, ymaxCubes, zmaxCubes));
-
-                  double x1min = trafo.transformForwardToX1Coordinate( xminCubes, yminCubes, zminCubes );
-                  double x2min = trafo.transformForwardToX2Coordinate( xminCubes, yminCubes, zminCubes );
-                  double x3min = trafo.transformForwardToX3Coordinate( xminCubes, yminCubes, zminCubes );
-
-                  int ix1min, ix2min, ix3min; 
-
-                  if (x1min-(int)x1min>.9999999999) ix1min=(int)x1min+1;else ix1min=(int)x1min; 
-                  if (x2min-(int)x2min>.9999999999) ix2min=(int)x2min+1;else ix2min=(int)x2min; 
-                  if (x3min-(int)x3min>.9999999999) ix3min=(int)x3min+1;else ix3min=(int)x3min; 
-
-                  double x1max = trafo.transformForwardToX1Coordinate( xmaxCubes, ymaxCubes, zmaxCubes );
-                  double x2max = trafo.transformForwardToX2Coordinate( xmaxCubes, ymaxCubes, zmaxCubes );
-                  double x3max = trafo.transformForwardToX3Coordinate( xmaxCubes, ymaxCubes, zmaxCubes );
-
-                  int ix1max, ix2max, ix3max; 
-
-                  if (x1max-(int)x1max>.9999999999) ix1max=(int)x1max+1;else ix1max=(int)x1max; 
-                  if (x2max-(int)x2max>.9999999999) ix2max=(int)x2max+1;else ix2max=(int)x2max; 
-                  if (x3max-(int)x3max>.9999999999) ix3max=(int)x3max+1;else ix3max=(int)x3max; 
-
-                  for (int z = ix3min+1; z <= ix3max; z++)
-                     for (int y = ix2min+1; y <= ix2max; y++)
-                        for (int x = ix1min+1; x <= ix1max; x++)
-                  {
-                     geoMatrix(x,y,z)=GbVoxelMatrix3D::SOLID;
-                  }
-
-
-                  ////
-                  //     ostringstream ostrcubes;
-                  //	 ostrcubes<<pathname <<"/cubeH"<<Nflowdir<<"x"<<Nhorizon<<"x"<<Nspanw;
-                  ////       
-                  ////   
-                  //// // GbSystem3D::writeGeoObject(rectTemp,outpath+cubeschar,WbWriterAvsASCII::getInstance());
-                  ////  GbSystem3D::writeGeoObject(rectTemp,ostrcubes.str(),WbWriterAvsASCII::getInstance()); //??
-                  //        ostrcubes.str("");
-                  //         ostrcubes.clear();
-
-                  ////  boost::shared_ptr<D3Q19AMRInteractor> interactorTemp( new D3Q19AMRInteractor( rectTemp,new D3Q19NoSlipBCAdapter(),AMR3DInteractor::SOLID,ss.str()) );
-                  //  //  interactorService.addInteractor(interactorTemp);
-                  //D3Q27BoundaryConditionAdapterPtr cubeBCAdapter(new D3Q27NoSlipBCAdapter());                   //D3Q27DensityBCAdapter(rhoInit));
-                  //D3Q27InteractorPtr cubeInteractor( new D3Q27Interactor(rectTemp,grid,cubeBCAdapter,Interactor3D::SOLID));
-                  //D3Q27InteractorPtrarray.push_back(cubeInteractor);  
-
-
-               }
-            }}
-         ////////////////
-         //ende cubes
-         //////////
-         UBLOG(logINFO,"cubes:end");
-
-         UBLOG(logINFO,"write geo matrix:start");
-         //geoMatrix.writeToLegacyVTKBinary(pathname + "/geo/geoMatrix");
-         geoMatrix.writeToVTKImageDataASCII(pathname + "/geo/geoMatrix");
-         UBLOG(logINFO,"write geo matrix:end");
-
-         ////////////////////////////////////////////
-      //   //METIS
-      //   MetisPartitioningGridVisitor metisVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B);
-      //   grid->accept( metisVisitor );
-
-
-      //   ////////////////////////////////////////////
-      //   /////delete solid blocks
-      //   if(myid == 0) UBLOG(logINFO,"deleteSolidBlocks - start");
-      //   SolidBlocksHelper sd(grid, comm);
-
-      //   sd.addInteractor(topBCInteractor);
-      //   sd.addInteractor(bottomBCInteractor);
-      //   for(size_t i=0; i<D3Q27InteractorPtrarray.size(); ++i)
-      //   {
-      //      sd.addInteractor(D3Q27InteractorPtrarray[i]);
-      //   }
-      //   sd.deleteSolidBlocks();
-      //   if(myid == 0) UBLOG(logINFO,"deleteSolidBlocks - end");	 
-      //   //////////////////////////////////////
-      //   grid->accept( metisVisitor );
-
-      //   sd.setTransBlocks(); 
-
-
-      //   unsigned long nob = grid->getNumberOfBlocks();
-      //   unsigned long nod = nob * blocknx[0]*blocknx[1]*blocknx[2];
-      //   unsigned long nod_real = nob * (blocknx[0]+3)*(blocknx[1]+3)*(blocknx[2]+3);
-
-      //   double needMemAll  = double(nod_real*(27*sizeof(double) + sizeof(int)));
-      //   double needMem  = needMemAll / double(comm->getNumberOfProcesses());
-
-      //   if(myid == 0)
-      //   {
-      //      UBLOG(logINFO,"Number of blocks = " << nob);
-      //      UBLOG(logINFO,"Number of nodes  = " << nod);
-      //      UBLOG(logINFO,"Necessary memory  = " << needMemAll  << " bytes");
-      //      UBLOG(logINFO,"Necessary memory per process = " << needMem  << " bytes");
-      //      UBLOG(logINFO,"Available memory per process = " << availMem << " bytes");
-      //   }
-
-      //   LBMKernel3DPtr kernel;
-      //   kernel = LBMKernel3DPtr(new LBMKernelETD3Q27CCLB(blocknx[0], blocknx[1], blocknx[2], LBMKernelETD3Q27CCLB::NORMAL));
-
-      //   // LBMKernel3DPtr kernel(new LBMKernelETD3Q27CascadedTI(blocknx[0], blocknx[1], blocknx[2]));
-      //   //LBMKernel3DPtr kernel(new LBMKernelETD3Q27BGK(blocknx[0], blocknx[1], blocknx[2],1));
-      //   BCProcessorPtr bcProc(new D3Q27ETBCProcessor());
-      //   kernel->setBCProcessor(bcProc);
-      //   //	  //scheint neuerdings fuer absturz zu sorgen:
-      //   mu::Parser fctForcingX1;
-      //   fctForcingX1.SetExpr("Fx1*dx");
-      //   fctForcingX1.DefineConst("Fx1", 0.6*5.0e-6);//9.99685e-7);
-
-      //   kernel->setForcingX1(fctForcingX1);
-      //   kernel->setWithForcing(true); 
-
-      //   SetKernelBlockVisitor kernelVisitor(kernel, nueLB, availMem, needMem);
-
-      //   grid->accept(kernelVisitor);
-
-      //   //////////////////////////////////
-      //   //undef nodes
-      //   if (refineLevel > 0)
-      //   {
-      //      D3Q27SetUndefinedNodesBlockVisitor undefNodesVisitor;
-      //      grid->accept(undefNodesVisitor);
-      //   }
-      //   //////////////////////////////////////////
-
-      //   grid->addAndInitInteractor( bottomBCInteractor ); 
-      //   grid->addAndInitInteractor( topBCInteractor );
-      //   for(size_t i=0; i<D3Q27InteractorPtrarray.size(); ++i)
-      //   {
-      //      grid->addAndInitInteractor( D3Q27InteractorPtrarray[i] ); 
-      //      char numstr[21];
-      //      sprintf(numstr, "%f", (double)i);
-      //      std::string pathObstCube = pathname+"/geo/obstBCCuboid"+ numstr;
-      //      if(myid == 0) GbSystem3D::writeGeoObject(D3Q27InteractorPtrarray[i]->getGbObject3D().get(),
-      //         /* rectTemp.get(),*/ pathObstCube, WbWriterVtkXmlASCII::getInstance());
-      //   }
-
-
-      //   UbTimer timer;
-      //   timer.start();
-      //   grid->accept( metisVisitor );
-
-      //   if(myid == 0) UBLOG(logINFO,"Write blocks - start");
-      //   BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname + "/grid/blocks", WbWriterVtkXmlBinary::getInstance(), comm));
-      //   if(myid == 0) ppblocks->update(0);
-      //   if(myid == 0) UBLOG(logINFO,"Write blocks - end");
-
-
-      //   if(myid == 0) UBLOG(logINFO,"Write blocks - start");
-      //   grid->accept( metisVisitor );
-      //   if(myid == 0) ppblocks->update(1);
-      //   ppblocks.reset();
-      //   if(myid == 0) UBLOG(logINFO,"Write blocks - end");
-
-      //   //inflow
-      //   double uLB2=uLB;
-      //   double raiseVelSteps = 0;
-      //   vector<D3Q27BCFunction> velcX1BCs,dummy;
-
-      //   mu::Parser inflowProfile;
-      //   inflowProfile.SetExpr("uLB*0.9"); 
-
-      //   inflowProfile.DefineConst("uLB",uLB2);
-      //   velcX1BCs.push_back(D3Q27BCFunction(inflowProfile,raiseVelSteps,D3Q27BCFunction::INFCONST));
-
-
-      //   //set connectors
-      //   D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
-      //   D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
-      //   grid->accept( setConnsVisitor );
-
-      //   //domain decomposition
-
-      //   //initialization of decompositions
-      //   D3Q27ETInitDistributionsBlockVisitor initVisitor( nueLB,rhoInit);
-      //   initVisitor.setVx1(inflowProfile);
-      //   grid->accept(initVisitor);
-
-      //   //Postrozess
-      //   //LBMUnitConverterPtr conv = LBMUnitConverterPtr(new LBMUnitConverter());
-
-      //   UbSchedulerPtr geoSch(new UbScheduler(1));
-      //   D3Q27MacroscopicQuantitiesPostprocessorPtr ppgeo(
-      //      new D3Q27MacroscopicQuantitiesPostprocessor(grid, geoSch, pathname + "/grid/nodes", WbWriterVtkXmlBinary::getInstance(), 
-      //      unitConverter, comm, true));
-
-
-
-      //   grid->doPostProcess(0);
-      //   ppgeo.reset();
-      //   geoSch.reset();
-
-      //   if(myid == 0) UBLOG(logINFO,"Preprozess - end");      
-
-      //}
-
-
-
-      //UbSchedulerPtr visSch(new UbScheduler());
-      ////visSch->addSchedule(100,1,1000);
-      ////visSch->addSchedule(1000,1000,10000);
-      ////visSch->addSchedule(10000,10000,100000);
-      ////visSch->addSchedule(20000,20000,800000);
-      ////visSch->addSchedule(50,350000,350500);
-      ////visSch->addSchedule(50,420000,420500);
-      ////visSch->addSchedule(50000,420500,10000000);
-      //visSch->addSchedule(2250,268250,592250);
-      //UbSchedulerPtr resSch(new UbScheduler());
-      //resSch->addSchedule(20000,20,10000000);
-      //// AverageValuesPostprocessor       Avpp(grid,  pathname + "/steps/stepAV", WbWriterVtkXmlBinary::getInstance(), visSch/*wann wird rausgeschrieben*/,resSch/*wann wird resettet*/,comm);
-      //UbSchedulerPtr resSchRMS(new UbScheduler());
-      //resSchRMS->addSchedule(40000,420000,10000000);
-      //UbSchedulerPtr resSchMeans(new UbScheduler());
-      //resSchMeans->addSchedule(40000,0,10000000);
-      //UbSchedulerPtr stepAvSch(new UbScheduler());
-      //int averageInterval=20;
-      //stepAvSch->addSchedule(averageInterval,0,10000000);
-
-      //double restart=10000; //??????????
-      //AverageValuesPostprocessor       Avpp(grid,  pathname + "/steps/stepAV", WbWriterVtkXmlBinary::getInstance(), stepAvSch/*wann wird gemittelt*/, averageInterval,visSch/*wann wird rausgeschrieben*/,resSchMeans,resSchRMS/*wann wird resettet*/,comm,restart);
-
-
-      //D3Q27MacroscopicQuantitiesPostprocessor pp(grid, visSch, pathname + "/steps/step", WbWriterVtkXmlBinary::getInstance(), unitConverter, comm);
-
-      //UbSchedulerPtr nupsSch(new UbScheduler(10, 90050, 90080));
-      //NUPSCounterPostprocessor npr(grid, nupsSch, pathname + "/results/nups.txt", comm);
-
-
-      //UbSchedulerPtr AdjForcSch(new UbScheduler());
-      //AdjForcSch->addSchedule(100,20,20000000);
-      //D3Q27IntegrateValuesHelperPtr IntValHelp(new D3Q27IntegrateValuesHelper(grid, comm, 
-      //   originX1, originX2, kanalhoeheSI*0.55/*0.501*/, 
-      //   nx[0]*blockLengthx1, nx[1]*blockLengthx2, kanalhoeheSI*0.999));
-
-      //double vxZiel=uLB;
-      ////D3Q27AdjustForcingPostprocessor AdjForcPPPtr(grid, AdjForcSch,IntValHelp, vxZiel*0.6, comm);//da am 11.3.2013 velo um 1/0.6 zu hoch
-      //D3Q27AdjustForcingPostprocessor AdjForcPPPtr(grid, AdjForcSch,IntValHelp, vxZiel, comm);//dies sollte zu Re=5500 fuehren..
-
-      //UbSchedulerPtr visQSch(new UbScheduler());
-      //visQSch->addSchedule(10,90100,90130);
-      //QKritPostprocessor QKritPtr(grid,pathname+"/steps/Qq",WbWriterVtkXmlBinary::getInstance(),visQSch, comm);
-
-      //mu::Parser decrViscFunc;
-      //decrViscFunc.SetExpr("nue0+c0/(t+1)/(t+1)");
-      //decrViscFunc.DefineConst("nue0", nueLB);
-      //decrViscFunc.DefineConst("c0", 0.1);
-      //UbSchedulerPtr DecrViscSch(new UbScheduler());
-      //DecrViscSch->addSchedule(10,10,1000);
-      //DecreaseViscosityPostprocessor decrViscPPPtr(grid, DecrViscSch,&decrViscFunc, comm);
-
-      //cout << "PID = " << myid << " Total Physical Memory (RAM): " << MemoryUtil::getTotalPhysMem()<<endl;
-      //cout << "PID = " << myid << " Physical Memory currently used: " << MemoryUtil::getPhysMemUsed()<<endl;
-      //cout << "PID = " << myid << " Physical Memory currently used by current process: " << MemoryUtil::getPhysMemUsedByMe()<<endl;
-
-      //double endTime = 520000;//20000001;
-      //CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, visSch));
-      //if(myid == 0) UBLOG(logINFO,"Simulation-start");
-      //calculation->calculate();
-      //if(myid == 0) UBLOG(logINFO,"Simulation-end");
-   }
-   catch(std::exception& e)
-   {
-      cerr << e.what() << endl << flush;
-   }
-   catch(std::string& s)
-   {
-      cerr << s << endl;
-   }
-   catch(...)
-   {
-      cerr << "unknown exception" << endl;
-   }
-
-}
-int main(int argc, char* argv[])
-{
-
-   run(argv[1]);
-
-   return 0;
-}
-
+
+
+#include <iostream>
+#include <string>
+#include <math.h> 
+
+#include <sys/types.h> //mkdir rights
+#include <sys/stat.h> //mkdir
+#include <vfluids.h>
+
+using namespace std;
+
+
+void run(const char *cstr)
+{
+   try
+   {
+      string machine = QUOTEME(CAB_MACHINE);
+      UBLOG(logINFO,"Testcase BreugemChannel");
+      string pathname; 
+      string pathnameRestart;
+      string pathGeo;
+      int numOfThreads =1;
+      bool logfile = false;
+      stringstream logFilename;
+      double availMem = 0;
+
+      UbLog::reportingLevel() = logINFO;
+
+      CommunicatorPtr comm = MPICommunicator::getInstance();
+      int myid = comm->getProcessID();
+
+
+         pathname =        "./";
+         //pathnameRestart = "/gfs1/work/niivfcpu/scratch/kucher/BKanaltest";//BKanaltest0Ref2up0612";//BKanaltest0Ref2up1012Out";
+         //pathname =        "/work/koskuche/SFB880/BKanaltestRe260000Out";
+         //pathnameRestart = "/work/koskuche/SFB880/BKanaltestRe260000";//BKanaltest0Ref2up0612";//BKanaltest0Ref2up1012Out";
+
+   	 //pathGeo = "/home/koskuche/data/plate";
+         numOfThreads = 1;
+         availMem = 64.0e9;
+         logfile = true;
+
+//         if (myid==0) 
+//         {
+//            const char* str = pathname.c_str();
+//#if defined(__unix__)
+//            int status=mkdir(str, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
+//#endif 
+//
+//         }
+//
+//         if(myid ==0)
+//         {
+//            logFilename <<  pathname + "/logfile"+UbSystem::toString(UbSystem::getTimeStamp())+"_"+UbSystem::toString(myid)+".txt";
+//         }
+
+
+
+
+      //if(myid ==0 && logfile)
+      //{
+      UbLog::output_policy::setStream(logFilename.str());
+      //}
+
+      int baseLevel, refineLevel,nx[3],blocknx[3];
+      double Re,velocity,rhoInit,vx1Init;//,vx2Init,vx3Init;
+
+      //////////////////////////////////////////////////////////////////////////
+      //physik
+      //////////////////////////////////////////////////////////////////////////
+      Re            = 5500;// 13286;//13286;//gemessen 18.98 m/s...*5.0 zum  testen ob was passiert
+      velocity      = 0.01;  
+      vx1Init       = 0.01;  
+      rhoInit       = 0.0;
+      SimulationParametersPtr param = SimulationParameters::getInstanz();
+
+      int H=200;//200;//392;
+
+      //  nx[0]      =8;//ok mit 8// (int)(3.0*(double)H/8.0/8.0);//2;// (int)(0.3*(double)H/6.0/4.0);//das "/4" hier ist wegen der verfeinerung da! //länge
+      //  nx[1]      =8;//ok mit 8// (int)(2.0*(double)H/8.0/8.0);//2;// (int)(0.2*(double)H/6.0/4.0);//  //breite
+      nx[2]      = (int)(2.0*(double)H/5.0/8.0);// //höhe gebiet
+
+      //(3/2/2)-ratio:
+      nx[1]=nx[2];
+      nx[0]=15;
+
+      blocknx[0] = 15;//10;//5;
+      blocknx[1] = 15;//10;//5;
+      blocknx[2] = 15;//10;//5;
+
+      baseLevel   = 0;
+      refineLevel = 2;//1;////3;//3 soll 1 test;
+
+
+      ///////////////Weltabmessungen:
+      //double kanallaengeSI = ( 2.0*(double)H);
+      // double kanalbreiteSI = ( 1.0*(double)H);
+      double kanalhoeheSI  = ( 2.0*(double)H);
+
+      // double refinewidth1=kanalhoeheSI/10.0;
+
+      double fineNodeDx   = (kanalhoeheSI) / (double)( blocknx[2]*nx[2]*(1<<refineLevel)+1 ); //+1--> gitter liegt jeweils 0.5dx innerhalb
+      double coarseNodeDx = fineNodeDx * (double)(1<<refineLevel);//geowerte
+
+      double blockLengthx1 = blocknx[0]*coarseNodeDx; //geowerte
+      double blockLengthx2 = blockLengthx1;
+      double blockLengthx3 = blockLengthx1;
+
+      double originX1 = 0.0;//-50.0*propellerDurchmesser;  //geowerte
+      double originX2 = 0.0;//-0.5*blockLengthx2*nx2;
+      double originX3 = 0.0;// minX3 + 0.5*fineNodeDx;
+
+      double geoLength[]   = {  nx[0]*blockLengthx1, nx[1]*blockLengthx2, nx[2]*blockLengthx3}; 
+
+      bool periodicx1 = true;
+      bool periodicx2 = true;
+      bool periodicx3 = false;
+
+
+      //##########################################################################
+      //## physical parameters
+      //##########################################################################
+      double smagorinskiConstant = 0.18;
+
+
+      double rhoLB         = 0.0;
+
+      double rhoReal       = 1.0;
+      double nueReal  = 1;//0.000016;//0.015;
+
+      double hReal         = blocknx[2]*nx[2];//H*0.9;//0.0105;//<-m     1.05;//Plattendicke in cm(! cm nicht m !)
+      double uReal         = Re*nueReal/hReal;
+
+      //##Machzahl:
+      //#Ma     = uReal/csReal
+      double csReal=343.0;
+      double Ma      = uReal/csReal;//Ma-Real!
+      //double csReal  = uReal/Ma;
+      double hLB     = hReal/coarseNodeDx;
+
+      LBMUnitConverterPtr unitConverter = LBMUnitConverterPtr(new LBMUnitConverter(hReal, csReal, rhoReal, hLB));
+
+      double uLB           = uReal   * unitConverter->getFactorVelocityWToLb();
+      double nueLB         = nueReal * unitConverter->getFactorViscosityWToLb();
+      double timestep      = unitConverter->getFactorTimeLbToW(coarseNodeDx);
+
+      velocity = uLB;
+      // double viscosity =nueLB*1000.0;
+
+      Grid3DPtr grid(new Grid3D(comm));
+      //UbSchedulerPtr rSch(new UbScheduler(10000,100000,30000000000));//(50000,50000,1000000));
+      //UbSchedulerPtr rSch(new UbScheduler(18000,268250,770000));//(50000,50000,1000000));
+      //RestartPostprocessor rp(grid, rSch, comm, pathnameRestart+"/checkpoints", RestartPostprocessor::BINARY);
+
+      //////////////////////////////////////////////////////////////////////////
+
+      std::string opt;
+
+//      if(cstr!= NULL)
+//         opt = std::string(cstr);
+//
+//      if(/*(cstr== NULL)*/cstr!= NULL)
+//      {
+//         opt = std::string(cstr);
+//
+//         if(myid==0) {
+//            UBLOG(logINFO,"Restart step: " << opt);
+//            UBLOG(logINFO, "Restart=:" << pathnameRestart);
+//         }
+//
+//         grid = rp.restart(UbSystem::stringTo<int>(opt));
+//         rp.reconnect(grid);
+//
+////          mu::Parser fctForcingX1, fctForcingX2, fctForcingX3;
+////          fctForcingX1.SetExpr("Fx1*dx");
+////          fctForcingX1.DefineConst("Fx1", 0.6*5.0e-6);
+//// 
+////          SetForcingBlockVisitor forcingVisitor(fctForcingX1, fctForcingX2, fctForcingX3);
+////          grid->accept(forcingVisitor);
+//
+//         //set connectors
+//         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
+//         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
+//         grid->accept( setConnsVisitor );
+//
+//      }
+//      else
+//      {
+         //bounding box
+         double g_minX1 = originX1;
+         double g_minX2 = originX2;
+         double g_minX3 = originX3;
+
+         double g_maxX1 = originX1 + geoLength[0];
+         double g_maxX2 = originX2 + geoLength[1];
+         double g_maxX3 = originX3 + geoLength[2];
+
+         //set grid
+         grid->setDeltaX(coarseNodeDx);
+         grid->setBlockNX(blocknx[0], blocknx[1], blocknx[2]);
+         grid->setPeriodicX1(periodicx1);
+         grid->setPeriodicX2(periodicx2);
+         grid->setPeriodicX3(periodicx3);
+
+
+         GbObject3DPtr gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
+         if(myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), pathname+"/geo/gridCube", WbWriterVtkXmlASCII::getInstance());
+
+         //GenBlocksGridVisitor genBlocks;
+         //genBlocks.addGeoObject(gridCube);
+         //grid->accept(genBlocks);
+
+
+
+         //bottom and top solid bc
+         //iteractors
+         int bbOption1 = 1; //0=simple Bounce Back, 1=quadr. BB
+         D3Q27BoundaryConditionAdapterPtr bcObst(new D3Q27NoSlipBCAdapter(bbOption1));
+         double geoOverlap = coarseNodeDx;
+         GbCuboid3DPtr bottomBCCuboid(new GbCuboid3D(originX1-geoOverlap, originX2-geoOverlap, originX3-geoOverlap, 
+            originX1+geoLength[0]+coarseNodeDx, originX2+geoLength[1]+geoOverlap, originX3));
+         if(myid == 0) GbSystem3D::writeGeoObject(bottomBCCuboid.get(), pathname+"/geo/bottomBCCuboid", WbWriterVtkXmlASCII::getInstance());
+         D3Q27InteractorPtr bottomBCInteractor(new D3Q27Interactor(bottomBCCuboid,grid,bcObst,Interactor3D::SOLID)); 
+
+         GbCuboid3DPtr topBCCuboid(new GbCuboid3D(originX1-geoLength[0]-coarseNodeDx, originX2-geoOverlap, originX3+geoLength[2],//-coarseNodeDx*0.5, 
+            originX1+geoLength[0]+coarseNodeDx, originX2+geoLength[1]+geoOverlap, originX3+geoLength[2]+geoOverlap));
+         if(myid == 0) GbSystem3D::writeGeoObject(topBCCuboid.get(), pathname+"/geo/topBCCuboid", WbWriterVtkXmlASCII::getInstance());
+         D3Q27InteractorPtr topBCInteractor(new D3Q27Interactor(topBCCuboid,grid,bcObst,Interactor3D::SOLID)); 
+         //grid->addAndInitInteractor( bottomBCInteractor ); 
+         // grid->addAndInitInteractor( topBCInteractor ); 
+         //////////////////////////////////////////////////////////////////////////
+         if(myid == 0)
+         {
+            UBLOG(logINFO, "*****************************************");
+            UBLOG(logINFO, "* Parameters                            *");
+            UBLOG(logINFO, "* Re            ="<<Re);
+            UBLOG(logINFO, "* Ma            ="<<Ma);
+            UBLOG(logINFO, "* uReal         ="<<uReal);
+            UBLOG(logINFO, "* nueReal       ="<<nueReal);
+            UBLOG(logINFO, "* nue           ="<<nueLB);
+            UBLOG(logINFO, "* velocity      ="<<uLB);
+            // UBLOG(logINFO, "* LX1 (world/LB)="<<kanallaengeSI<<"/"<<kanallaengeSI/coarseNodeDx);
+            //  UBLOG(logINFO, "* LX2 (world/LB)="<<kanalbreiteSI<<"/"<<kanalbreiteSI/coarseNodeDx);
+            UBLOG(logINFO, "* LX3 (world/LB)="<<kanalhoeheSI<<"/"<<kanalhoeheSI/coarseNodeDx);
+            UBLOG(logINFO, "* cdx           ="<<coarseNodeDx);
+            UBLOG(logINFO, "* fdx           ="<<fineNodeDx);
+            UBLOG(logINFO, "* dx_base       ="<<coarseNodeDx<<" == "<<coarseNodeDx);
+            UBLOG(logINFO, "* dx_refine     ="<<fineNodeDx<<" == "<<fineNodeDx );
+            UBLOG(logINFO, "* nx1/2/3       ="<<nx[0]<<"/"<<nx[1]<<"/"<<nx[2]);
+            UBLOG(logINFO, "* blocknx1/2/3  ="<<blocknx[0]<<"/"<<blocknx[1]<<"/"<<blocknx[2]);
+            UBLOG(logINFO, "* x2Periodic    ="<<periodicx2);
+            UBLOG(logINFO, "* x3Periodic    ="<<periodicx3);
+            UBLOG(logINFO, "*****************************************");
+            UBLOGML(logINFO, "UnitConverter:"<<unitConverter->toString());
+            UBLOG(logINFO, "*****************************************");     
+         }
+
+         if(myid == 0) UBLOG(logINFO,"Refinement - start");	
+
+         //////////////////////////////////////////////////////////////////////////
+         // refine
+         //////////////////////////////////////////////////////////////////////////
+         //GbCuboid3DPtr wallsX1X2maxRef1( new GbCuboid3D(  originX1-geoOverlap   , originX2-geoOverlap  , kanalhoeheSI*0.95
+         //    , originX1+geoLength[0]+geoOverlap, originX2+geoOverlap+geoLength[1], kanalhoeheSI));
+         //RefineCrossAndInsideGbObjectBlockVisitor refineVisitormax1(wallsX1X2maxRef1, 0,refineLevel-3);
+         //grid->accept(refineVisitormax1);
+         //
+         //GbCuboid3DPtr wallsX1X2minRef1(new GbCuboid3D(  originX1-geoOverlap   , originX2-geoOverlap  , kanalhoeheSI*0.55
+         //    , originX1+geoLength[0]+geoOverlap, originX2+geoOverlap+geoLength[1], kanalhoeheSI*0.47));
+         // RefineCrossAndInsideGbObjectBlockVisitor refineVisitormin1(wallsX1X2minRef1, 0,refineLevel-3);
+         // grid->accept(refineVisitormin1);
+
+         //   GbCuboid3DPtr wallsX1X2maxRef2(new GbCuboid3D(  originX1-geoOverlap   , originX2-geoOverlap  , kanalhoeheSI
+         //   , originX1+geoLength[0]+geoOverlap, originX2+geoOverlap+geoLength[1], kanalhoeheSI*0.98));
+         //RefineCrossAndInsideGbObjectBlockVisitor refineVisitormax2(wallsX1X2maxRef2, 0,refineLevel-2);
+         //grid->accept(refineVisitormax2);
+         //   GbCuboid3DPtr wallsX1X2maxRef2(new GbCuboid3D(  originX1-geoOverlap   , originX2-geoOverlap  , kanalhoeheSI
+         //   , originX1+geoLength[0]+geoOverlap, originX2+geoOverlap+geoLength[1], kanalhoeheSI*0.9));
+         //RefineCrossAndInsideGbObjectBlockVisitor refineVisitormax2(wallsX1X2maxRef2, 0,refineLevel-2);
+         //grid->accept(refineVisitormax2);
+
+         // GbCuboid3DPtr wallsX1X2maxRef3(new GbCuboid3D(  originX1-geoOverlap   , originX2-geoOverlap  , kanalhoeheSI
+         //   , originX1+geoLength[0]+geoOverlap, originX2+geoOverlap+geoLength[1], kanalhoeheSI*0.9995));
+         //RefineCrossAndInsideGbObjectBlockVisitor refineVisitormax3(wallsX1X2maxRef3, 0,refineLevel-1);
+         //grid->accept(refineVisitormax3);
+
+         //         GbCuboid3DPtr wallsX1X2minRefl3(new GbCuboid3D(  originX1-3.0*geoOverlap   , originX2-3.0*geoOverlap  , originX3-3.0*geoOverlap
+         //   , originX1+geoLength[0]+geoOverlap, originX2+geoOverlap+geoLength[1], kanalhoeheSI*0.25));
+         //RefineCrossAndInsideGbObjectBlockVisitor refineVisitorminl3(wallsX1X2minRefl3, 0,refineLevel-3);
+         //grid->accept(refineVisitorminl3);
+         /////würfel unten version
+         //      GbCuboid3DPtr wallsX1X2minRef2(new GbCuboid3D(  originX1-3.0*geoOverlap   , originX2-3.0*geoOverlap  , originX3-3.0*geoOverlap
+         //   , originX1+geoLength[0]+geoOverlap, originX2+geoOverlap+geoLength[1], kanalhoeheSI*0.2));
+         //RefineCrossAndInsideGbObjectBlockVisitor refineVisitormin2(wallsX1X2minRef2, 0,refineLevel-2);
+         //grid->accept(refineVisitormin2);
+
+         //   GbCuboid3DPtr wallsX1X2minRef3(new GbCuboid3D(  originX1-3.0*geoOverlap   , originX2-3.0*geoOverlap  , kanalhoeheSI*0.04
+         //   , originX1+geoLength[0]+geoOverlap, originX2+geoOverlap+geoLength[1], kanalhoeheSI*0.18));
+         //RefineCrossAndInsideGbObjectBlockVisitor refineVisitormin3(wallsX1X2minRef3, 0,refineLevel-1);
+         //grid->accept(refineVisitormin3);
+
+         //      GbCuboid3DPtr wallsX1X2minRef4(new GbCuboid3D(  originX1-3.0*geoOverlap   , originX2-3.0*geoOverlap  , kanalhoeheSI*0.09
+         //   , originX1+geoLength[0]+geoOverlap, originX2+geoOverlap+geoLength[1], kanalhoeheSI*0.16));
+         //RefineCrossAndInsideGbObjectBlockVisitor refineVisitormin4(wallsX1X2minRef4, 0,refineLevel);
+         //grid->accept(refineVisitormin4);
+
+
+
+
+         /////würfel anfang version
+         //       GbCuboid3DPtr wallsX1X2minRef2(new GbCuboid3D(  originX1-3.0*geoOverlap   , originX2-3.0*geoOverlap  , originX3-3.0*geoOverlap
+         //   , originX1+geoLength[0]+geoOverlap, originX2+geoOverlap+geoLength[1], kanalhoeheSI*0.56));
+         //RefineCrossAndInsideGbObjectBlockVisitor refineVisitormin2(wallsX1X2minRef2, 0,refineLevel-2);
+         //grid->accept(refineVisitormin2);
+
+         //   GbCuboid3DPtr wallsX1X2minRef3(new GbCuboid3D(  originX1-3.0*geoOverlap   , originX2-3.0*geoOverlap  , originX3-3.0*geoOverlap
+         //   , originX1+geoLength[0]+geoOverlap, originX2+geoOverlap+geoLength[1], kanalhoeheSI*0.55));
+         //RefineCrossAndInsideGbObjectBlockVisitor refineVisitormin3(wallsX1X2minRef3, 0,refineLevel-2);
+         //grid->accept(refineVisitormin3);
+
+         //      GbCuboid3DPtr wallsX1X2minRef4(new GbCuboid3D(  originX1-3.0*geoOverlap   , originX2-3.0*geoOverlap  ,kanalhoeheSI*0.49
+         //   , originX1+geoLength[0]+geoOverlap, originX2+geoOverlap+geoLength[1], kanalhoeheSI*0.53));
+         //RefineCrossAndInsideGbObjectBlockVisitor refineVisitormin4(wallsX1X2minRef4, 0,refineLevel-1);
+         //grid->accept(refineVisitormin4);
+
+
+         /*           GbCuboid3DPtr wallsX1X2minRef4(new GbCuboid3D(  originX1-3.0*geoOverlap   , originX2-3.0*geoOverlap  , originX1-3.0*geoOverlap
+         , originX1+geoLength[0]+geoOverlap, originX2+geoOverlap+geoLength[1], kanalhoeheSI*0.1));
+         RefineCrossAndInsideGbObjectBlockVisitor refineVisitormin4(wallsX1X2minRef4, 0,refineLevel-1);
+         grid->accept(refineVisitormin4);*/
+
+         ////GbCuboid3DPtr refine1PlatteCube(new GbCuboid3D(  originX1-geoOverlap   , originX2-geoOverlap  , x3minMesh-H3
+         ////   , x1maxMesh+H3*5.0, originX2+geoOverlap+geoLength[1], x3maxMesh+H3));
+         ////RefineCrossAndInsideGbObjectBlockVisitor refineAdapterP1(refine1PlatteCube, baseLevel, refineLevel-6);
+         ////grid->accept(refineAdapterP1);
+
+         //GbCuboid3DPtr refine2PlatteCube(new GbCuboid3D(  originX1-geoOverlap   , originX2-geoOverlap  , x3minMesh-H3*0.5
+         //  , x1maxMesh+H3*5.0, originX2+geoOverlap+geoLength[1], x3maxMesh+H3));
+         //RefineCrossAndInsideGbObjectBlockVisitor refineAdapterP2(refine2PlatteCube, baseLevel, refineLevel-5);
+         //grid->accept(refineAdapterP2);
+
+         //GbCuboid3DPtr refine3PlatteCube(new GbCuboid3D(  originX1-geoOverlap  , originX2-geoOverlap  , x3minMesh-H3*0.5
+         //   , x1maxMesh+H3*5.0, originX2+geoOverlap+geoLength[1], x3maxMesh+H3*0.5));
+         //RefineCrossAndInsideGbObjectBlockVisitor refineAdapterP3(refine3PlatteCube, baseLevel, refineLevel-4);
+         //grid->accept(refineAdapterP3);
+
+         //GbCuboid3DPtr refine4PlatteCube(new GbCuboid3D(   originX1-geoOverlap  , originX2-geoOverlap  , x3minMesh+deltaX3Platte*0.0
+         //   ,  x1maxMesh+H3*5.0, originX2+geoOverlap+geoLength[1], x3maxMesh+H3*0.25));
+         //if(myid == 0) GbSystem3D::writeGeoObject(refine4PlatteCube.get(), pathname+"/geo/refine4PlatteCube", WbWriterVtkXmlASCII::getInstance());
+         //RefineCrossAndInsideGbObjectBlockVisitor refineAdapterP4(refine4PlatteCube, baseLevel, refineLevel-3);
+         //grid->accept(refineAdapterP4);
+
+         //GbCuboid3DPtr refine5PlatteCube(new GbCuboid3D(   originX1-geoOverlap , originX2-geoOverlap  ,x3minMesh+deltaX3Platte*0.1/* x3minMesh+deltaX3Platte*0.8*/
+         //   ,  x1maxMesh+H3*5.0, originX2+geoOverlap+geoLength[1], x3maxMesh+H3*0.00375));
+         //if(myid == 0) GbSystem3D::writeGeoObject(refine5PlatteCube.get(), pathname+"/geo/refine5PlatteCube", WbWriterVtkXmlASCII::getInstance());
+         //RefineCrossAndInsideGbObjectBlockVisitor refineAdapterP5(refine5PlatteCube, baseLevel, refineLevel-2);
+         //grid->accept(refineAdapterP5);
+
+
+         //GbCuboid3DPtr wallsX1X2minRef4(new GbCuboid3D(  originX1-3.0*geoOverlap   , originX2-3.0*geoOverlap  , originX1-3.0*geoOverlap
+         //	  , originX1+geoLength[0]+geoOverlap, originX2+geoOverlap+geoLength[1], kanalhoeheSI*0.1));
+
+         GbCuboid3DPtr wallsX1X2minRef3(new GbCuboid3D(  originX1-3.0*geoOverlap   , originX2-3.0*geoOverlap  , originX3-3.0*geoOverlap
+            , originX1+geoLength[0]+geoOverlap, originX2+geoOverlap+geoLength[1], kanalhoeheSI*0.6/*0.55*/));
+
+         GbCuboid3DPtr wallsX1X2minRef4(new GbCuboid3D(  originX1-3.0*geoOverlap   , originX2-3.0*geoOverlap  ,kanalhoeheSI*0.49
+            , originX1+geoLength[0]+geoOverlap, originX2+geoOverlap+geoLength[1], kanalhoeheSI*0.53));
+
+         GbCuboid3DPtr wallsX1X2maxRef2(new GbCuboid3D(  originX1-3.0*geoOverlap   , originX2-3.0*geoOverlap  ,kanalhoeheSI*0.9
+            , originX1+geoLength[0]+geoOverlap, originX2+geoOverlap+geoLength[1], originX3+geoOverlap+geoLength[2]));
+
+         GbCuboid3DPtr wallsX1X2maxRef1(new GbCuboid3D(  originX1-3.0*geoOverlap   , originX2-3.0*geoOverlap  ,kanalhoeheSI*0.95
+            , originX1+geoLength[0]+geoOverlap, originX2+geoOverlap+geoLength[1], originX3+geoOverlap+geoLength[2]));
+
+         //if (refineLevel > 0)
+         //{
+
+         //   RefineCrossAndInsideGbObjectHelper refineHelper(grid, refineLevel);
+         //   refineHelper.addGbObject(wallsX1X2minRef3, refineLevel-1);
+         //   refineHelper.addGbObject(wallsX1X2minRef4, refineLevel);
+         //   refineHelper.addGbObject(wallsX1X2maxRef2, refineLevel-1);
+         //   refineHelper.addGbObject(wallsX1X2maxRef1, refineLevel);
+
+         //   refineHelper.refine();
+         //   if(myid == 0) UBLOG(logINFO,"Refinement - end");	
+         //}
+
+         ///interactoren
+         //int bbOption1 = 0; //0=simple Bounce Back, 1=quadr. BB
+         //D3Q27BoundaryConditionAdapterPtr bcObst(new D3Q27NoSlipBCAdapter(bbOption1));
+         ///////würfel unten version ende
+         ////////////////////////////////////////////////////////////////////////////////
+         ////////PM grid
+         //Temporär:
+         //double  H=1.0;
+
+         //vector<D3Q27InteractorPtr> D3Q27InteractorPtrarray;
+         
+         double newDx = fineNodeDx;///2.0;
+         int geoNX1=(int)(600.0/newDx)-1; 
+         int geoNX2=(int)(400.0/newDx)-1; 
+         int geoNX3=(int)((398.0+newDx*2)/newDx); 
+         GbVoxelMatrix3D geoMatrix(geoNX1,geoNX2,geoNX3,0);
+         geoMatrix.setVoxelMatrixDelta(newDx, newDx, newDx);
+         double m_minX1 = 0 - newDx/2.0;
+         double m_minX2 = 0 - newDx/2.0;
+         double m_minX3 = 0.666 + newDx/2.0;
+         geoMatrix.setVoxelMatrixMininum(m_minX1, m_minX2, m_minX3);
+
+         //geoMatrix.writeToVTKImageDataASCII(pathname + "/geo/geoMatrix");
+         //return;
+
+         CoordinateTransformation3D trafo(m_minX1, m_minX2, m_minX3, newDx, newDx, newDx);
+
+         ////////////////////////////////////////////////////////////////////////////////
+         double inflowCubeDx = coarseNodeDx;///(double)(1<<inflowCubeLevel);
+         double dpCubes=(double)H/20.0;//100.0; //30zum testen 100real
+         double offsetZgrid=H+0.5*inflowCubeDx;
+         double epschoch1drittel= 0.928318;
+         double abstandIn=2.0*dpCubes;
+         double c1oAbst=1.0/abstandIn;
+         
+         UBLOG(logINFO,"cubes:start");
+         
+         for (int Nflowdir=0;Nflowdir<((nx[0]*blocknx[0]*c1oAbst)*coarseNodeDx); Nflowdir++)
+         {
+            // for (int Nhorizon=((nx[2]*blocknx[2]*c1oAbst)*coarseNodeDx)*0.5-2; Nhorizon<((nx[2]*blocknx[2]*c1oAbst)*coarseNodeDx)*0.5-1-1; Nhorizon++)
+            // {
+            //  for (int Nhorizon=0;  Nhorizon<(((nx[2]*blocknx[2]+1)*c1oAbst)*coarseNodeDx)*0.1; Nhorizon++)//Nhorizon<((nx[2]*blocknx[2]*c1oAbst)*coarseNodeDx)*0.5; Nhorizon++)
+            for (int Nhorizon=0;  Nhorizon<(((nx[2]*blocknx[2]+1)*c1oAbst)*coarseNodeDx)*0.5-1; Nhorizon++)//Nhorizon<((nx[2]*blocknx[2]*c1oAbst)*coarseNodeDx)*0.5; Nhorizon++)
+
+            {
+               for (int Nspanw=0; Nspanw<((nx[1]*blocknx[1]*c1oAbst)*coarseNodeDx); Nspanw++)
+               {
+                  // stringstream ss;
+                  //     ss<<"cubeH"<<Nflowdir<<"x"<<Nhorizon<<"x"<<Nspanw;
+                  ////     //   //geoOrigin ist Mitte, nicht vordere Ecke -> korrigieren
+                  // int Nflowdir=1;
+                  //int Nhorizon=0;
+                  //int Nspanw=1;
+                  double xminCubes1=originX1+(Nflowdir*abstandIn)-0.5*dpCubes+0.5*inflowCubeDx+3.0*coarseNodeDx/pow(2.0,refineLevel-1);
+                  double xmaxCubes1=originX1+(Nflowdir*abstandIn)+0.5*dpCubes+0.5*inflowCubeDx+3.0*coarseNodeDx/pow(2.0,refineLevel-1);
+                  double xminCubes=std::max(xminCubes1,2.0*coarseNodeDx/pow(2.0,refineLevel));
+                  double xmaxCubes=std::min(xmaxCubes1,originX1+geoLength[0]-coarseNodeDx/pow(2.0,refineLevel));
+                  double yminCubes=std::max(originX2+(Nspanw*abstandIn)-0.5*dpCubes+0.5*inflowCubeDx+3.0*coarseNodeDx/pow(2.0,refineLevel-1),2.0*coarseNodeDx/pow(2.0,refineLevel));
+                  double ymaxCubes=std::min(originX2+(Nspanw*abstandIn)+0.5*dpCubes+0.5*inflowCubeDx+3.0*coarseNodeDx/pow(2.0,refineLevel-1),originX2+geoLength[1]-coarseNodeDx/pow(2.0,refineLevel));
+                  double zminCubes=std::max(originX3+(Nhorizon*abstandIn)+4.0*coarseNodeDx/pow(2.0,refineLevel-1),2.0*coarseNodeDx/pow(2.0,refineLevel));
+                  double zmaxCubes=std::min(originX3+(Nhorizon*abstandIn)+dpCubes+4.0*coarseNodeDx/pow(2.0,refineLevel-1),originX3+geoLength[2]-coarseNodeDx/pow(2.0,refineLevel));
+                  ////     /*GbCuboid3D  *rectTemp = new GbCuboid3D(originX1+(Nflowdir*abstandIn)-0.5*dpCubes+0.5*inflowCubeDx, originX2+(Nspanw*abstandIn)-0.5*dpCubes+0.5*inflowCubeDx, originX3+(Nhorizon*abstandIn)-0.5*dpCubes+0.5*inflowCubeDx, 
+                  ////										 originX1+(Nflowdir*abstandIn)+0.5*dpCubes+0.5*inflowCubeDx, originX2+(Nspanw*abstandIn)+0.5*dpCubes+0.5*inflowCubeDx, originX3+(Nhorizon*abstandIn)+0.5*dpCubes+0.5*inflowCubeDx );
+                  ////*/
+                  ////  
+                  //GbCuboid3DPtr rectTemp(new GbCuboid3D(xminCubes, yminCubes, zminCubes, xmaxCubes, ymaxCubes, zmaxCubes));
+
+                  double x1min = trafo.transformForwardToX1Coordinate( xminCubes, yminCubes, zminCubes );
+                  double x2min = trafo.transformForwardToX2Coordinate( xminCubes, yminCubes, zminCubes );
+                  double x3min = trafo.transformForwardToX3Coordinate( xminCubes, yminCubes, zminCubes );
+
+                  int ix1min, ix2min, ix3min; 
+
+                  if (x1min-(int)x1min>.9999999999) ix1min=(int)x1min+1;else ix1min=(int)x1min; 
+                  if (x2min-(int)x2min>.9999999999) ix2min=(int)x2min+1;else ix2min=(int)x2min; 
+                  if (x3min-(int)x3min>.9999999999) ix3min=(int)x3min+1;else ix3min=(int)x3min; 
+
+                  double x1max = trafo.transformForwardToX1Coordinate( xmaxCubes, ymaxCubes, zmaxCubes );
+                  double x2max = trafo.transformForwardToX2Coordinate( xmaxCubes, ymaxCubes, zmaxCubes );
+                  double x3max = trafo.transformForwardToX3Coordinate( xmaxCubes, ymaxCubes, zmaxCubes );
+
+                  int ix1max, ix2max, ix3max; 
+
+                  if (x1max-(int)x1max>.9999999999) ix1max=(int)x1max+1;else ix1max=(int)x1max; 
+                  if (x2max-(int)x2max>.9999999999) ix2max=(int)x2max+1;else ix2max=(int)x2max; 
+                  if (x3max-(int)x3max>.9999999999) ix3max=(int)x3max+1;else ix3max=(int)x3max; 
+
+                  for (int z = ix3min+1; z <= ix3max; z++)
+                     for (int y = ix2min+1; y <= ix2max; y++)
+                        for (int x = ix1min+1; x <= ix1max; x++)
+                  {
+                     geoMatrix(x,y,z)=GbVoxelMatrix3D::SOLID;
+                  }
+
+
+                  ////
+                  //     ostringstream ostrcubes;
+                  //	 ostrcubes<<pathname <<"/cubeH"<<Nflowdir<<"x"<<Nhorizon<<"x"<<Nspanw;
+                  ////       
+                  ////   
+                  //// // GbSystem3D::writeGeoObject(rectTemp,outpath+cubeschar,WbWriterAvsASCII::getInstance());
+                  ////  GbSystem3D::writeGeoObject(rectTemp,ostrcubes.str(),WbWriterAvsASCII::getInstance()); //??
+                  //        ostrcubes.str("");
+                  //         ostrcubes.clear();
+
+                  ////  boost::shared_ptr<D3Q19AMRInteractor> interactorTemp( new D3Q19AMRInteractor( rectTemp,new D3Q19NoSlipBCAdapter(),AMR3DInteractor::SOLID,ss.str()) );
+                  //  //  interactorService.addInteractor(interactorTemp);
+                  //D3Q27BoundaryConditionAdapterPtr cubeBCAdapter(new D3Q27NoSlipBCAdapter());                   //D3Q27DensityBCAdapter(rhoInit));
+                  //D3Q27InteractorPtr cubeInteractor( new D3Q27Interactor(rectTemp,grid,cubeBCAdapter,Interactor3D::SOLID));
+                  //D3Q27InteractorPtrarray.push_back(cubeInteractor);  
+
+
+               }
+            }}
+         ////////////////
+         //ende cubes
+         //////////
+         UBLOG(logINFO,"cubes:end");
+
+         UBLOG(logINFO,"write geo matrix:start");
+         //geoMatrix.writeToLegacyVTKBinary(pathname + "/geo/geoMatrix");
+         geoMatrix.writeToVTKImageDataASCII(pathname + "/geo/geoMatrix");
+         UBLOG(logINFO,"write geo matrix:end");
+
+         ////////////////////////////////////////////
+      //   //METIS
+      //   MetisPartitioningGridVisitor metisVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B);
+      //   grid->accept( metisVisitor );
+
+
+      //   ////////////////////////////////////////////
+      //   /////delete solid blocks
+      //   if(myid == 0) UBLOG(logINFO,"deleteSolidBlocks - start");
+      //   SolidBlocksHelper sd(grid, comm);
+
+      //   sd.addInteractor(topBCInteractor);
+      //   sd.addInteractor(bottomBCInteractor);
+      //   for(size_t i=0; i<D3Q27InteractorPtrarray.size(); ++i)
+      //   {
+      //      sd.addInteractor(D3Q27InteractorPtrarray[i]);
+      //   }
+      //   sd.deleteSolidBlocks();
+      //   if(myid == 0) UBLOG(logINFO,"deleteSolidBlocks - end");	 
+      //   //////////////////////////////////////
+      //   grid->accept( metisVisitor );
+
+      //   sd.setTransBlocks(); 
+
+
+      //   unsigned long nob = grid->getNumberOfBlocks();
+      //   unsigned long nod = nob * blocknx[0]*blocknx[1]*blocknx[2];
+      //   unsigned long nod_real = nob * (blocknx[0]+3)*(blocknx[1]+3)*(blocknx[2]+3);
+
+      //   double needMemAll  = double(nod_real*(27*sizeof(double) + sizeof(int)));
+      //   double needMem  = needMemAll / double(comm->getNumberOfProcesses());
+
+      //   if(myid == 0)
+      //   {
+      //      UBLOG(logINFO,"Number of blocks = " << nob);
+      //      UBLOG(logINFO,"Number of nodes  = " << nod);
+      //      UBLOG(logINFO,"Necessary memory  = " << needMemAll  << " bytes");
+      //      UBLOG(logINFO,"Necessary memory per process = " << needMem  << " bytes");
+      //      UBLOG(logINFO,"Available memory per process = " << availMem << " bytes");
+      //   }
+
+      //   LBMKernel3DPtr kernel;
+      //   kernel = LBMKernel3DPtr(new LBMKernelETD3Q27CCLB(blocknx[0], blocknx[1], blocknx[2], LBMKernelETD3Q27CCLB::NORMAL));
+
+      //   // LBMKernel3DPtr kernel(new LBMKernelETD3Q27CascadedTI(blocknx[0], blocknx[1], blocknx[2]));
+      //   //LBMKernel3DPtr kernel(new LBMKernelETD3Q27BGK(blocknx[0], blocknx[1], blocknx[2],1));
+      //   BCProcessorPtr bcProc(new D3Q27ETBCProcessor());
+      //   kernel->setBCProcessor(bcProc);
+      //   //	  //scheint neuerdings fuer absturz zu sorgen:
+      //   mu::Parser fctForcingX1;
+      //   fctForcingX1.SetExpr("Fx1*dx");
+      //   fctForcingX1.DefineConst("Fx1", 0.6*5.0e-6);//9.99685e-7);
+
+      //   kernel->setForcingX1(fctForcingX1);
+      //   kernel->setWithForcing(true); 
+
+      //   SetKernelBlockVisitor kernelVisitor(kernel, nueLB, availMem, needMem);
+
+      //   grid->accept(kernelVisitor);
+
+      //   //////////////////////////////////
+      //   //undef nodes
+      //   if (refineLevel > 0)
+      //   {
+      //      D3Q27SetUndefinedNodesBlockVisitor undefNodesVisitor;
+      //      grid->accept(undefNodesVisitor);
+      //   }
+      //   //////////////////////////////////////////
+
+      //   grid->addAndInitInteractor( bottomBCInteractor ); 
+      //   grid->addAndInitInteractor( topBCInteractor );
+      //   for(size_t i=0; i<D3Q27InteractorPtrarray.size(); ++i)
+      //   {
+      //      grid->addAndInitInteractor( D3Q27InteractorPtrarray[i] ); 
+      //      char numstr[21];
+      //      sprintf(numstr, "%f", (double)i);
+      //      std::string pathObstCube = pathname+"/geo/obstBCCuboid"+ numstr;
+      //      if(myid == 0) GbSystem3D::writeGeoObject(D3Q27InteractorPtrarray[i]->getGbObject3D().get(),
+      //         /* rectTemp.get(),*/ pathObstCube, WbWriterVtkXmlASCII::getInstance());
+      //   }
+
+
+      //   UbTimer timer;
+      //   timer.start();
+      //   grid->accept( metisVisitor );
+
+      //   if(myid == 0) UBLOG(logINFO,"Write blocks - start");
+      //   BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname + "/grid/blocks", WbWriterVtkXmlBinary::getInstance(), comm));
+      //   if(myid == 0) ppblocks->update(0);
+      //   if(myid == 0) UBLOG(logINFO,"Write blocks - end");
+
+
+      //   if(myid == 0) UBLOG(logINFO,"Write blocks - start");
+      //   grid->accept( metisVisitor );
+      //   if(myid == 0) ppblocks->update(1);
+      //   ppblocks.reset();
+      //   if(myid == 0) UBLOG(logINFO,"Write blocks - end");
+
+      //   //inflow
+      //   double uLB2=uLB;
+      //   double raiseVelSteps = 0;
+      //   vector<D3Q27BCFunction> velcX1BCs,dummy;
+
+      //   mu::Parser inflowProfile;
+      //   inflowProfile.SetExpr("uLB*0.9"); 
+
+      //   inflowProfile.DefineConst("uLB",uLB2);
+      //   velcX1BCs.push_back(D3Q27BCFunction(inflowProfile,raiseVelSteps,D3Q27BCFunction::INFCONST));
+
+
+      //   //set connectors
+      //   D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
+      //   D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
+      //   grid->accept( setConnsVisitor );
+
+      //   //domain decomposition
+
+      //   //initialization of decompositions
+      //   D3Q27ETInitDistributionsBlockVisitor initVisitor( nueLB,rhoInit);
+      //   initVisitor.setVx1(inflowProfile);
+      //   grid->accept(initVisitor);
+
+      //   //Postrozess
+      //   //LBMUnitConverterPtr conv = LBMUnitConverterPtr(new LBMUnitConverter());
+
+      //   UbSchedulerPtr geoSch(new UbScheduler(1));
+      //   D3Q27MacroscopicQuantitiesPostprocessorPtr ppgeo(
+      //      new D3Q27MacroscopicQuantitiesPostprocessor(grid, geoSch, pathname + "/grid/nodes", WbWriterVtkXmlBinary::getInstance(), 
+      //      unitConverter, comm, true));
+
+
+
+      //   grid->doPostProcess(0);
+      //   ppgeo.reset();
+      //   geoSch.reset();
+
+      //   if(myid == 0) UBLOG(logINFO,"Preprozess - end");      
+
+      //}
+
+
+
+      //UbSchedulerPtr visSch(new UbScheduler());
+      ////visSch->addSchedule(100,1,1000);
+      ////visSch->addSchedule(1000,1000,10000);
+      ////visSch->addSchedule(10000,10000,100000);
+      ////visSch->addSchedule(20000,20000,800000);
+      ////visSch->addSchedule(50,350000,350500);
+      ////visSch->addSchedule(50,420000,420500);
+      ////visSch->addSchedule(50000,420500,10000000);
+      //visSch->addSchedule(2250,268250,592250);
+      //UbSchedulerPtr resSch(new UbScheduler());
+      //resSch->addSchedule(20000,20,10000000);
+      //// AverageValuesPostprocessor       Avpp(grid,  pathname + "/steps/stepAV", WbWriterVtkXmlBinary::getInstance(), visSch/*wann wird rausgeschrieben*/,resSch/*wann wird resettet*/,comm);
+      //UbSchedulerPtr resSchRMS(new UbScheduler());
+      //resSchRMS->addSchedule(40000,420000,10000000);
+      //UbSchedulerPtr resSchMeans(new UbScheduler());
+      //resSchMeans->addSchedule(40000,0,10000000);
+      //UbSchedulerPtr stepAvSch(new UbScheduler());
+      //int averageInterval=20;
+      //stepAvSch->addSchedule(averageInterval,0,10000000);
+
+      //double restart=10000; //??????????
+      //AverageValuesPostprocessor       Avpp(grid,  pathname + "/steps/stepAV", WbWriterVtkXmlBinary::getInstance(), stepAvSch/*wann wird gemittelt*/, averageInterval,visSch/*wann wird rausgeschrieben*/,resSchMeans,resSchRMS/*wann wird resettet*/,comm,restart);
+
+
+      //D3Q27MacroscopicQuantitiesPostprocessor pp(grid, visSch, pathname + "/steps/step", WbWriterVtkXmlBinary::getInstance(), unitConverter, comm);
+
+      //UbSchedulerPtr nupsSch(new UbScheduler(10, 90050, 90080));
+      //NUPSCounterPostprocessor npr(grid, nupsSch, pathname + "/results/nups.txt", comm);
+
+
+      //UbSchedulerPtr AdjForcSch(new UbScheduler());
+      //AdjForcSch->addSchedule(100,20,20000000);
+      //D3Q27IntegrateValuesHelperPtr IntValHelp(new D3Q27IntegrateValuesHelper(grid, comm, 
+      //   originX1, originX2, kanalhoeheSI*0.55/*0.501*/, 
+      //   nx[0]*blockLengthx1, nx[1]*blockLengthx2, kanalhoeheSI*0.999));
+
+      //double vxZiel=uLB;
+      ////D3Q27AdjustForcingPostprocessor AdjForcPPPtr(grid, AdjForcSch,IntValHelp, vxZiel*0.6, comm);//da am 11.3.2013 velo um 1/0.6 zu hoch
+      //D3Q27AdjustForcingPostprocessor AdjForcPPPtr(grid, AdjForcSch,IntValHelp, vxZiel, comm);//dies sollte zu Re=5500 fuehren..
+
+      //UbSchedulerPtr visQSch(new UbScheduler());
+      //visQSch->addSchedule(10,90100,90130);
+      //QKritPostprocessor QKritPtr(grid,pathname+"/steps/Qq",WbWriterVtkXmlBinary::getInstance(),visQSch, comm);
+
+      //mu::Parser decrViscFunc;
+      //decrViscFunc.SetExpr("nue0+c0/(t+1)/(t+1)");
+      //decrViscFunc.DefineConst("nue0", nueLB);
+      //decrViscFunc.DefineConst("c0", 0.1);
+      //UbSchedulerPtr DecrViscSch(new UbScheduler());
+      //DecrViscSch->addSchedule(10,10,1000);
+      //DecreaseViscosityPostprocessor decrViscPPPtr(grid, DecrViscSch,&decrViscFunc, comm);
+
+      //cout << "PID = " << myid << " Total Physical Memory (RAM): " << MemoryUtil::getTotalPhysMem()<<endl;
+      //cout << "PID = " << myid << " Physical Memory currently used: " << MemoryUtil::getPhysMemUsed()<<endl;
+      //cout << "PID = " << myid << " Physical Memory currently used by current process: " << MemoryUtil::getPhysMemUsedByMe()<<endl;
+
+      //double endTime = 520000;//20000001;
+      //CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, visSch));
+      //if(myid == 0) UBLOG(logINFO,"Simulation-start");
+      //calculation->calculate();
+      //if(myid == 0) UBLOG(logINFO,"Simulation-end");
+   }
+   catch(std::exception& e)
+   {
+      cerr << e.what() << endl << flush;
+   }
+   catch(std::string& s)
+   {
+      cerr << s << endl;
+   }
+   catch(...)
+   {
+      cerr << "unknown exception" << endl;
+   }
+
+}
+int main(int argc, char* argv[])
+{
+
+   run(argv[1]);
+
+   return 0;
+}
+
diff --git a/apps/cpu/bananas/CMakeLists.txt b/apps/cpu/bananas/CMakeLists.txt
index 54ddbbc6cb16197abdc19b7787b21092a4a12593..744322b5274e2dc924a40c3c7cd22169cd59338e 100644
--- a/apps/cpu/bananas/CMakeLists.txt
+++ b/apps/cpu/bananas/CMakeLists.txt
@@ -1,25 +1,25 @@
-CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
-
-########################################################
-## C++ PROJECT                                       ###
-########################################################
-PROJECT(bananas)
-
-INCLUDE(${SOURCE_ROOT}/core/IncludsList.txt) 
-
-#################################################################
-###   LOCAL FILES                                             ###
-#################################################################
-FILE(GLOB SPECIFIC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.h
-                         ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
-                         ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp  )
- 
-SET(ALL_SOURCES ${ALL_SOURCES} ${SPECIFIC_FILES})
-SOURCE_GROUP(src FILES ${SPECIFIC_FILES})
-  
-SET(CAB_ADDITIONAL_LINK_LIBRARIES core)
-
-#################################################################
-###   CREATE PROJECT                                          ###
-#################################################################
-CREATE_CAB_PROJECT(bananas BINARY)
+CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
+
+########################################################
+## C++ PROJECT                                       ###
+########################################################
+PROJECT(bananas)
+
+INCLUDE(${SOURCE_ROOT}/core/IncludsList.txt) 
+
+#################################################################
+###   LOCAL FILES                                             ###
+#################################################################
+FILE(GLOB SPECIFIC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.h
+                         ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
+                         ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp  )
+ 
+SET(ALL_SOURCES ${ALL_SOURCES} ${SPECIFIC_FILES})
+SOURCE_GROUP(src FILES ${SPECIFIC_FILES})
+  
+SET(CAB_ADDITIONAL_LINK_LIBRARIES core)
+
+#################################################################
+###   CREATE PROJECT                                          ###
+#################################################################
+CREATE_CAB_PROJECT(bananas BINARY)
diff --git a/apps/cpu/bananas/bananas.cpp b/apps/cpu/bananas/bananas.cpp
index 223fe402890758427361f7861f8ded5fffaa16e1..7d8b05a97fbd611144e2916eb992659f39aa15a0 100644
--- a/apps/cpu/bananas/bananas.cpp
+++ b/apps/cpu/bananas/bananas.cpp
@@ -1,457 +1,457 @@
-#include <iostream>
-#include <string>
-
-#include "geometry3d/CoordinateTransformation3D.h"
-#include "Grid3D.h"
-#include "GenBlocksGridVisitor.h"
-#include "geometry3d/GbSystem3D.h"
-#include "geometry3d/GbCuboid3D.h"
-#include "geometry3d/GbCylinder3D.h"
-#include <geometry3d/GbSphere3D.h>
-#include "basics/writer/WbWriterVtkXmlASCII.h"
-#include "basics/writer/WbWriterVtkXmlBinary.h"
-#include "RefineCrossAndInsideGbObjectBlockVisitor.h"
-#include "RatioBlockVisitor.h"
-#include "RatioSmoothBlockVisitor.h"
-#include "OverlapBlockVisitor.h"
-#include "RefineInterGbObjectsVisitor.h"
-#include "RefineCrossAndInsideGbObjectBlockVisitor.h"
-#include "SetKernelBlockVisitor.h"
-#include "LBMKernelETD3Q27Cascaded.h"
-#include "D3Q27MacroscopicQuantitiesPostprocessor.h"
-#include "MPICommunicator.h"
-#include "D3Q27ETBCProcessor.h"
-#include "SimulationParameters.h"
-#include "D3Q27SetUndefinedNodesBlockVisitor.h"
-#include "SetInterpolationDirsBlockVisitor.h"
-#include "D3Q27SetConnectorsBlockVisitor.h"
-#include "NullCommunicator.h"
-#include "D3Q27ETInitDistributionsBlockVisitor.h"
-#include "CalculationManager.h"
-#include "PQueuePartitioningGridVisitor.h"
-#include "MetisPartitioningGridVisitor.h"
-#include "D3Q27Interactor.h"
-#include "D3Q27NoSlipBCAdapter.h"
-#include "D3Q27VelocityBCAdapter.h"
-#include "D3Q27DensityBCAdapter.h"
-#include "D3Q27BoundaryConditionAdapter.h"
-#include "StringUtil.hpp"
-#include "D3Q27OffsetInterpolationProcessor.h"
-#include "D3Q27CompactInterpolationProcessor.h"
-#include "SyncBcBlockVisitor.h"
-#include "geometry3d/creator/GbTriFaceMesh3DCreator.h"
-#include "geometry3d/GbTriFaceMesh3D.h"
-#include "D3Q27TriFaceMeshInteractor.h"
-#include "basics/utilities/UbFileOutputASCII.h"
-#include "basics/utilities/UbFileInputASCII.h"
-#include "basics/utilities/UbFileInputBinary.h"
-#include "basics/container/CbArray3D.h"
-#include "geometry3d/GbVoxelMatrix3D.h"
-
-#define CONVEXHULL
-
-using namespace std;
-
-const int FLUID = 1;
-const int SOLID = 15;
-
-//////////////////////////////////////////////////////////////////////////
-void writeMatrixToVtkImageFile(const std::string& fileName, const CbArray3D <int>& geoMatrix,
-                               double itsDeltaXWorld, double orgX1, double orgX2, double orgX3)
-{
-   UbFileOutputASCII out(fileName);
-
-   int NX1 = (int)geoMatrix.getNX1();	
-   int NX2 = (int)geoMatrix.getNX2();	
-   int NX3 = (int)geoMatrix.getNX3();
-   int nn = NX1*NX2*NX3;
-   out.writeLine("# vtk DataFile Version 3.0");
-   out.writeLine(fileName);
-   out.writeLine("ASCII");
-   out.writeLine("DATASET STRUCTURED_POINTS");
-   out.writeString("DIMENSIONS");
-   out.writeInteger(NX1);
-   out.writeInteger(NX2);
-   out.writeInteger(NX3);
-   out.writeLine();
-   out.writeString("ORIGIN");
-   out.writeDouble(orgX1);
-   out.writeDouble(orgX2);
-   out.writeDouble(orgX3);
-   out.writeLine();
-   out.writeString("SPACING");
-   out.writeDouble(itsDeltaXWorld);
-   out.writeDouble(itsDeltaXWorld);
-   out.writeDouble(itsDeltaXWorld);
-   out.writeLine();
-   out.writeString("POINT_DATA");
-   out.writeInteger(nn);
-   out.writeLine();
-   out.writeLine("SCALARS Geo integer");
-   out.writeLine("LOOKUP_TABLE default");
-
-   for(int k=0 ; k<NX3 ; k++){
-      for(int j=0 ; j<NX2 ; j++){
-         for(int i=0 ; i<NX1 ; i++){
-            out.writeInteger( geoMatrix(i,j,k) );
-         }
-      }
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-void readDimensionsFromFldFile(const std::string& fileName, int& d1, int& d2, int& d3)
-{
-   UbFileInputASCII in(fileName);
-   // read grid nx3
-   int dim   = in.readIntegerAfterString("ndim=");
-
-   if (dim != 3) throw UbException(UB_EXARGS,"readGeoMatrixFromFldFile() - Wrong number of dimensions.");
-
-   d1 = in.readIntegerAfterString("dim1=");
-   d2 = in.readIntegerAfterString("dim2=");
-   d3 = in.readIntegerAfterString("dim3=");
-}
-//////////////////////////////////////////////////////////////////////////
-void readGeoMatrixFromFldFile(const std::string& fileName, GbVoxelMatrix3DPtr geoMatrix)
-{
-   UbFileInputASCII in(fileName);
-   // read grid nx3
-   int dim   = in.readIntegerAfterString("ndim=");
-
-   if (dim != 3) throw UbException(UB_EXARGS,"readGeoMatrixFromFldFile() - Wrong number of dimensions.");
-
-   int sizeX = in.readIntegerAfterString("dim1=");
-   int sizeY = in.readIntegerAfterString("dim2=");
-   int sizeZ = in.readIntegerAfterString("dim3=");
-
-   std::string binFileName = in.readStringAfterString("variable 1 file=");
-
-   //separate name from path
-   std::string path = fileName.substr( 0, fileName.find_last_of('//')+1 );
-
-   binFileName = path.append(binFileName);
-
-   UbFileInputBinary binIn(binFileName);
-
-   for (int i=0; i<2048; i++) 
-   {
-      binIn.readChar();
-   }
-
-   int x, y, z, val;
-
-   for(z=0; z<sizeZ; z++)
-   {
-      for(y=0; y<sizeY; y++)
-      {
-         for(x=0; x<sizeX; x++)
-         {
-            val = binIn.readChar();
-
-            if(x!=0 && x!=sizeX-1 && 
-               y!=0 && y!=sizeY-1 &&
-               z!=0 && z!=sizeZ-1   )
-            {
-               if(val == 0)
-               {
-                   (*geoMatrix)(x,y,z) = GbVoxelMatrix3D::SOLID;
-               }
-            }
-         }
-      }
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-void discretizeGeoObject(GbObject3DPtr geoObject, CbArray3D<int>& geoMatrix, double delta, double orgX1, double orgX2, double orgX3)
-{
-   int nx1 = (int)geoMatrix.getNX1();
-   int nx2 = (int)geoMatrix.getNX2();
-   int nx3 = (int)geoMatrix.getNX3();
-
-   for(int k=0 ; k<nx3 ; k++)
-   {
-      for(int j=0 ; j<nx2 ; j++)
-      {
-         for(int i=0 ; i<nx1 ; i++)
-         {
-            double x = orgX1 + i*delta;
-            double y = orgX2 + j*delta;
-            double z = orgX3 + k*delta;
-            if(geoObject->isPointInGbObject3D(x, y, z)) geoMatrix(i,j,k) = SOLID;
-         }
-      }
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-void writeGbVoxelMatrix3DtoVtuXmlASCII(const std::string& fileName, GbVoxelMatrix3DPtr voxelMatrix, 
-                                       double worldDeltaX1, double worldDeltaX2, double worldDeltaX3,
-                                       int nx1, int nx2, int nx3)
-{
-   std::vector< UbTupleFloat3 > nodes;
-   std::vector<std::string > datanames;
-   std::vector<std::vector<double > > nodedata;
-   
-   datanames.resize(0);
-   datanames.push_back("Solid");
-   nodes.resize(0);
-   nodedata.resize(datanames.size());
-
-   double orgX1 = voxelMatrix->getX1Minimum();
-   double orgX2 = voxelMatrix->getX2Minimum();
-   double orgX3 = voxelMatrix->getX3Minimum();
-
-   int index = 0;
-   double x1KO,x2KO,x3KO;
-   
-      for (int x3=0; x3<nx3;x3++){
-         for (int x2=0; x2<nx2;x2++){
-            for(int x1=0; x1<nx1;x1++)
-            {
-                  x1KO = orgX1 + worldDeltaX1*(double)x1;
-                  x2KO = orgX2 + worldDeltaX2*(double)x2;
-                  x3KO = orgX3 + worldDeltaX3*(double)x3;
-                  nodes.push_back( makeUbTuple(float(x1KO), float(x2KO), float(x3KO)) );
-                  nodedata[0].push_back((*voxelMatrix)(x1,x2,x3));
-            }
-         }
-      }
-   WbWriterVtkXmlASCII::getInstance()->writeNodesWithNodeData(fileName, nodes,  datanames, nodedata); 
-}
-//////////////////////////////////////////////////////////////////////////
-void writeGbVoxelMatrix3DtoLegacyVTK(const std::string& fileName, GbVoxelMatrix3DPtr voxelMatrix,
-                                       double worldDeltaX1, double worldDeltaX2, double worldDeltaX3,
-                                       int nx1, int nx2, int nx3)
-{
-   UbFileOutputASCII out(fileName);
-
-   int nn = nx1*nx2*nx3;
-   out.writeLine("# vtk DataFile Version 3.0");
-   out.writeLine(fileName);
-   out.writeLine("ASCII");
-   out.writeLine("DATASET STRUCTURED_POINTS");
-   out.writeString("DIMENSIONS");
-   out.writeInteger(nx1);
-   out.writeInteger(nx2);
-   out.writeInteger(nx3);
-   out.writeLine();
-   out.writeString("ORIGIN");
-   out.writeDouble(voxelMatrix->getX1Minimum());
-   out.writeDouble(voxelMatrix->getX2Minimum());
-   out.writeDouble(voxelMatrix->getX3Minimum());
-   out.writeLine();
-   out.writeString("SPACING");
-   out.writeDouble(worldDeltaX1);
-   out.writeDouble(worldDeltaX2);
-   out.writeDouble(worldDeltaX3);
-   out.writeLine();
-   out.writeString("POINT_DATA");
-   out.writeInteger(nn);
-   out.writeLine();
-   out.writeLine("SCALARS Geo integer");
-   out.writeLine("LOOKUP_TABLE default");
-
-   for(int k=0 ; k<nx3 ; k++){
-      for(int j=0 ; j<nx2 ; j++){
-         for(int i=0 ; i<nx1 ; i++){
-            out.writeInteger( (int)(*voxelMatrix)(i,j,k) );
-         }
-      }
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-void run(const char *cstr)
-{
-   try
-   {
-      //string pathname = "c:/temp/bananas/out";
-      //string pathnameGeo = "c:/temp/bananas/geo";
-
-      std::string opt;
-      if(cstr!= NULL)
-         opt = std::string(cstr);
-      else
-      {
-         UBLOG(logINFO,"no option: x, y or z");
-         return;
-      }
-      
-      string pathnameGeo = "/home/koskuche/data/bananas";
-      string pathname;
-
-      if(opt == "z") pathname = "/work/koskuche/scratch/bananas/setupZ/out";
-
-      if(opt == "x") pathname = "/work/koskuche/scratch/bananas/setupX/out";
-
-      if(opt == "y") pathname = "/work/koskuche/scratch/bananas/setupY/out";
-
-      CommunicatorPtr comm(new MPICommunicator());
-     
-      //////////////////////////////////////////////////////////////////////////
-      // Geometries
-      //////////////////////////////////////////////////////////////////////////
-      //bananas box geometry
-      UBLOG(logINFO,"Start read bananas box geometry");
-      GbTriFaceMesh3DPtr bananaBox (GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(pathnameGeo+"/Banana_boxD.stl","banana_box"));
-      UBLOG(logINFO,"Stop read bananas box geometry");
-      bananaBox->rotate(90.0, 0.0, 0.0); //around Z
-
-      double b_minX1 = bananaBox->getX1Minimum();
-      double b_minX2 = bananaBox->getX2Minimum();
-      double b_minX3 = bananaBox->getX3Minimum();
-
-      double b_maxX1 = bananaBox->getX1Maximum();
-      double b_maxX2 = bananaBox->getX2Maximum();
-      double b_maxX3 = bananaBox->getX3Maximum();
-
-      if(opt == "x") bananaBox->rotate(0.0, 0.0, -90.0); //around X
-      
-      if(opt == "y") bananaBox->rotate(0.0, -90.0, 0.0); //around Y
-
-      UBLOG(logINFO,"Start write bananas box geometry");
-      GbSystem3D::writeGeoObject(bananaBox.get(), pathname+"/banana_box", WbWriterVtkXmlASCII::getInstance());
-      UBLOG(logINFO,"Stop write bananas box geometry");
-
-      //distances for bounding box
-      double dist_z = 0.12;
-      double dist_x = 0.26;
-      double dist_y = 0.195;
-
-      double g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3;
-
-      //bounding box of simulation
-      //setup1 - z
-      if(opt == "z")
-      {
-         g_minX1 = bananaBox->getX1Minimum();
-         g_minX2 = bananaBox->getX2Minimum();
-         g_minX3 = bananaBox->getX3Minimum()-dist_z;
-
-         g_maxX1 = bananaBox->getX1Maximum();
-         g_maxX2 = bananaBox->getX2Maximum();
-         g_maxX3 = bananaBox->getX3Maximum()+dist_z*2.0;
-      }
-
-      //setup2 - x
-      if(opt == "x")
-      {
-         g_minX1 = bananaBox->getX1Minimum();
-         g_minX2 = bananaBox->getX2Minimum();
-         g_minX3 = bananaBox->getX3Minimum()-dist_x;
-
-         g_maxX1 = bananaBox->getX1Maximum();
-         g_maxX2 = bananaBox->getX2Maximum();
-         g_maxX3 = bananaBox->getX3Maximum()+dist_x*2.0;
-      }
-
-      //setup3 - y
-      if(opt == "y")
-      {
-         g_minX1 = bananaBox->getX1Minimum();
-         g_minX2 = bananaBox->getX2Minimum();
-         g_minX3 = bananaBox->getX3Minimum()-dist_y;
-
-         g_maxX1 = bananaBox->getX1Maximum();
-         g_maxX2 = bananaBox->getX2Maximum();
-         g_maxX3 = bananaBox->getX3Maximum()+dist_y*2.0;
-      }
-
-      const double gridOriginX1 = g_minX1;
-      const double gridOriginX2 = g_minX2;
-      const double gridOriginX3 = g_minX3;
-
-      //int gridNX1 = 170;
-      //int gridNX2 = 226;
-      //int gridNX3 = 104;
-
-      const double dx = 2.20183486239e-3; //blockLentghX1/static_cast<double>(blocknx1);
-
-      UBLOG(logINFO,"DeltaX = " << dx);
-
-      CbArray3D<int> grid(int((g_maxX1-g_minX1)/dx)+1, int((g_maxX2-g_minX2)/dx)+1, int((g_maxX3-g_minX3)/dx)+1, FLUID);
-
-      UBLOG(logINFO,"Start write geo matrix empty");
-      writeMatrixToVtkImageFile(pathname + "/geo_matrix_empty.vtk", grid, dx, gridOriginX1, gridOriginX2, gridOriginX3);
-      UBLOG(logINFO,"Stop write geo matrix empty");
-
-#ifdef BANANAS
-      //reed bananas
-      UBLOG(logINFO,"Start read bananas geometry");
-      int d1, d2, d3;
-      readDimensionsFromFldFile(pathnameGeo + "/BANANA_8binn_Binear_A.fld", d1, d2, d3);
-      UBLOG(logINFO,"Dimensions of bananas geometry: " << d1 << ", " << d2 << ", " << d3);
-      GbVoxelMatrix3DPtr bananas(new GbVoxelMatrix3D(d1, d2, d3, float(GbVoxelMatrix3D::FLUID))); 
-      readGeoMatrixFromFldFile(pathnameGeo + "/BANANA_8binn_Binear_A.fld", bananas);
-      UBLOG(logINFO,"Stop read bananas geometry");
-      double bananasDx1 = (b_maxX1 - b_minX1) / float(d1);
-      double bananasDx2 = (b_maxX2 - b_minX2) / float(d2);
-      double bananasDx3 = (b_maxX3 - b_minX3) / float(d3);
-      bananas->setVoxelMatrixDelta(float(bananasDx1), float(bananasDx2), float(bananasDx3));
-      bananas->setCenterCoordinates(bananaBox->getX1Centroid(), bananaBox->getX2Centroid(), bananaBox->getX3Centroid());
-      bananas->setVoxelMatrixMininum(float(b_minX1), float(b_minX2), float(b_minX3));
-
-      bananas->rotate90aroundX();
-      bananas->rotate90aroundY();
-      //bananas->rotate90aroundX();
-
-      UBLOG(logINFO,"Start write bananas geometry");
-      bananas->writeToLegacyVTK(pathname + "/bananas.vtk");
-      UBLOG(logINFO,"Stop write bananas geometry");
-#endif
-
-#ifdef CONVEXHULL
-      UBLOG(logINFO,"Start read bananas box geometry");
-      GbTriFaceMesh3DPtr bananaHull (GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(pathnameGeo+"/convexhullASCII.stl","banana_hull"));
-      UBLOG(logINFO,"Stop read bananas box geometry");
-      bananaHull->translate(0.0, 0.0, 5.0*dx);
-      if(opt == "x") bananaHull->rotateAroundPoint(bananaBox->getX1Centroid(), bananaBox->getX2Centroid(), bananaBox->getX3Centroid(), 0.0, 0.0, -90.0); //around X
-      if(opt == "y") bananaHull->rotateAroundPoint(bananaBox->getX1Centroid(), bananaBox->getX2Centroid(), bananaBox->getX3Centroid(), 0.0, -90.0, 0.0); //around Y
-      UBLOG(logINFO,"Start write banana hull geometry");
-      GbSystem3D::writeGeoObject(bananaHull.get(), pathname+"/banana_hull", WbWriterVtkXmlASCII::getInstance());
-      UBLOG(logINFO,"Stop write banana hull geometry");
-#endif
-      ////////////////////////////////////////
-      //return;
-      /////////////////////////////////////////
-
-      UBLOG(logINFO,"Start discretization of banana box");
-      discretizeGeoObject(bananaBox, grid, dx, gridOriginX1, gridOriginX2, gridOriginX3);
-      UBLOG(logINFO,"Stop discretization of banana box");
-
-#ifdef BANANAS
-      UBLOG(logINFO,"Start discretization of bananas");
-      discretizeGeoObject(bananas, grid, dx, gridOriginX1, gridOriginX2, gridOriginX3);
-      UBLOG(logINFO,"Stop discretization of bananas");
-#endif
-
-#ifdef CONVEXHULL
-      UBLOG(logINFO,"Start discretization of banana hull");
-      discretizeGeoObject(bananaHull, grid, dx, gridOriginX1, gridOriginX2, gridOriginX3);
-      UBLOG(logINFO,"Stop discretization of banana hull");
-#endif
-
-      UBLOG(logINFO,"Start write geo matrix");
-      writeMatrixToVtkImageFile(pathname + "/geo_matrix.vtk", grid, dx, gridOriginX1, gridOriginX2, gridOriginX3);
-      UBLOG(logINFO,"Stop write geo matrix");
-   }
-   catch(std::exception& e)
-   {
-      cerr << e.what() << endl << flush;
-   }
-   catch(std::string& s)
-   {
-      cerr << s << endl;
-   }
-   catch(...)
-   {
-      cerr << "unknown exception" << endl;
-   }
-
-}
-int main(int argc, char* argv[])
-{
-
-   run(argv[1]);
-
-   return 0;
-}
-
+#include <iostream>
+#include <string>
+
+#include "geometry3d/CoordinateTransformation3D.h"
+#include "Grid3D.h"
+#include "GenBlocksGridVisitor.h"
+#include "geometry3d/GbSystem3D.h"
+#include "geometry3d/GbCuboid3D.h"
+#include "geometry3d/GbCylinder3D.h"
+#include <geometry3d/GbSphere3D.h>
+#include "basics/writer/WbWriterVtkXmlASCII.h"
+#include "basics/writer/WbWriterVtkXmlBinary.h"
+#include "RefineCrossAndInsideGbObjectBlockVisitor.h"
+#include "RatioBlockVisitor.h"
+#include "RatioSmoothBlockVisitor.h"
+#include "OverlapBlockVisitor.h"
+#include "RefineInterGbObjectsVisitor.h"
+#include "RefineCrossAndInsideGbObjectBlockVisitor.h"
+#include "SetKernelBlockVisitor.h"
+#include "LBMKernelETD3Q27Cascaded.h"
+#include "D3Q27MacroscopicQuantitiesPostprocessor.h"
+#include "MPICommunicator.h"
+#include "D3Q27ETBCProcessor.h"
+#include "SimulationParameters.h"
+#include "D3Q27SetUndefinedNodesBlockVisitor.h"
+#include "SetInterpolationDirsBlockVisitor.h"
+#include "D3Q27SetConnectorsBlockVisitor.h"
+#include "NullCommunicator.h"
+#include "D3Q27ETInitDistributionsBlockVisitor.h"
+#include "CalculationManager.h"
+#include "PQueuePartitioningGridVisitor.h"
+#include "MetisPartitioningGridVisitor.h"
+#include "D3Q27Interactor.h"
+#include "D3Q27NoSlipBCAdapter.h"
+#include "D3Q27VelocityBCAdapter.h"
+#include "D3Q27DensityBCAdapter.h"
+#include "D3Q27BoundaryConditionAdapter.h"
+#include "StringUtil.hpp"
+#include "D3Q27OffsetInterpolationProcessor.h"
+#include "D3Q27CompactInterpolationProcessor.h"
+#include "SyncBcBlockVisitor.h"
+#include "geometry3d/creator/GbTriFaceMesh3DCreator.h"
+#include "geometry3d/GbTriFaceMesh3D.h"
+#include "D3Q27TriFaceMeshInteractor.h"
+#include "basics/utilities/UbFileOutputASCII.h"
+#include "basics/utilities/UbFileInputASCII.h"
+#include "basics/utilities/UbFileInputBinary.h"
+#include "basics/container/CbArray3D.h"
+#include "geometry3d/GbVoxelMatrix3D.h"
+
+#define CONVEXHULL
+
+using namespace std;
+
+const int FLUID = 1;
+const int SOLID = 15;
+
+//////////////////////////////////////////////////////////////////////////
+void writeMatrixToVtkImageFile(const std::string& fileName, const CbArray3D <int>& geoMatrix,
+                               double itsDeltaXWorld, double orgX1, double orgX2, double orgX3)
+{
+   UbFileOutputASCII out(fileName);
+
+   int NX1 = (int)geoMatrix.getNX1();	
+   int NX2 = (int)geoMatrix.getNX2();	
+   int NX3 = (int)geoMatrix.getNX3();
+   int nn = NX1*NX2*NX3;
+   out.writeLine("# vtk DataFile Version 3.0");
+   out.writeLine(fileName);
+   out.writeLine("ASCII");
+   out.writeLine("DATASET STRUCTURED_POINTS");
+   out.writeString("DIMENSIONS");
+   out.writeInteger(NX1);
+   out.writeInteger(NX2);
+   out.writeInteger(NX3);
+   out.writeLine();
+   out.writeString("ORIGIN");
+   out.writeDouble(orgX1);
+   out.writeDouble(orgX2);
+   out.writeDouble(orgX3);
+   out.writeLine();
+   out.writeString("SPACING");
+   out.writeDouble(itsDeltaXWorld);
+   out.writeDouble(itsDeltaXWorld);
+   out.writeDouble(itsDeltaXWorld);
+   out.writeLine();
+   out.writeString("POINT_DATA");
+   out.writeInteger(nn);
+   out.writeLine();
+   out.writeLine("SCALARS Geo integer");
+   out.writeLine("LOOKUP_TABLE default");
+
+   for(int k=0 ; k<NX3 ; k++){
+      for(int j=0 ; j<NX2 ; j++){
+         for(int i=0 ; i<NX1 ; i++){
+            out.writeInteger( geoMatrix(i,j,k) );
+         }
+      }
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+void readDimensionsFromFldFile(const std::string& fileName, int& d1, int& d2, int& d3)
+{
+   UbFileInputASCII in(fileName);
+   // read grid nx3
+   int dim   = in.readIntegerAfterString("ndim=");
+
+   if (dim != 3) throw UbException(UB_EXARGS,"readGeoMatrixFromFldFile() - Wrong number of dimensions.");
+
+   d1 = in.readIntegerAfterString("dim1=");
+   d2 = in.readIntegerAfterString("dim2=");
+   d3 = in.readIntegerAfterString("dim3=");
+}
+//////////////////////////////////////////////////////////////////////////
+void readGeoMatrixFromFldFile(const std::string& fileName, GbVoxelMatrix3DPtr geoMatrix)
+{
+   UbFileInputASCII in(fileName);
+   // read grid nx3
+   int dim   = in.readIntegerAfterString("ndim=");
+
+   if (dim != 3) throw UbException(UB_EXARGS,"readGeoMatrixFromFldFile() - Wrong number of dimensions.");
+
+   int sizeX = in.readIntegerAfterString("dim1=");
+   int sizeY = in.readIntegerAfterString("dim2=");
+   int sizeZ = in.readIntegerAfterString("dim3=");
+
+   std::string binFileName = in.readStringAfterString("variable 1 file=");
+
+   //separate name from path
+   std::string path = fileName.substr( 0, fileName.find_last_of('//')+1 );
+
+   binFileName = path.append(binFileName);
+
+   UbFileInputBinary binIn(binFileName);
+
+   for (int i=0; i<2048; i++) 
+   {
+      binIn.readChar();
+   }
+
+   int x, y, z, val;
+
+   for(z=0; z<sizeZ; z++)
+   {
+      for(y=0; y<sizeY; y++)
+      {
+         for(x=0; x<sizeX; x++)
+         {
+            val = binIn.readChar();
+
+            if(x!=0 && x!=sizeX-1 && 
+               y!=0 && y!=sizeY-1 &&
+               z!=0 && z!=sizeZ-1   )
+            {
+               if(val == 0)
+               {
+                   (*geoMatrix)(x,y,z) = GbVoxelMatrix3D::SOLID;
+               }
+            }
+         }
+      }
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+void discretizeGeoObject(GbObject3DPtr geoObject, CbArray3D<int>& geoMatrix, double delta, double orgX1, double orgX2, double orgX3)
+{
+   int nx1 = (int)geoMatrix.getNX1();
+   int nx2 = (int)geoMatrix.getNX2();
+   int nx3 = (int)geoMatrix.getNX3();
+
+   for(int k=0 ; k<nx3 ; k++)
+   {
+      for(int j=0 ; j<nx2 ; j++)
+      {
+         for(int i=0 ; i<nx1 ; i++)
+         {
+            double x = orgX1 + i*delta;
+            double y = orgX2 + j*delta;
+            double z = orgX3 + k*delta;
+            if(geoObject->isPointInGbObject3D(x, y, z)) geoMatrix(i,j,k) = SOLID;
+         }
+      }
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+void writeGbVoxelMatrix3DtoVtuXmlASCII(const std::string& fileName, GbVoxelMatrix3DPtr voxelMatrix, 
+                                       double worldDeltaX1, double worldDeltaX2, double worldDeltaX3,
+                                       int nx1, int nx2, int nx3)
+{
+   std::vector< UbTupleFloat3 > nodes;
+   std::vector<std::string > datanames;
+   std::vector<std::vector<double > > nodedata;
+   
+   datanames.resize(0);
+   datanames.push_back("Solid");
+   nodes.resize(0);
+   nodedata.resize(datanames.size());
+
+   double orgX1 = voxelMatrix->getX1Minimum();
+   double orgX2 = voxelMatrix->getX2Minimum();
+   double orgX3 = voxelMatrix->getX3Minimum();
+
+   int index = 0;
+   double x1KO,x2KO,x3KO;
+   
+      for (int x3=0; x3<nx3;x3++){
+         for (int x2=0; x2<nx2;x2++){
+            for(int x1=0; x1<nx1;x1++)
+            {
+                  x1KO = orgX1 + worldDeltaX1*(double)x1;
+                  x2KO = orgX2 + worldDeltaX2*(double)x2;
+                  x3KO = orgX3 + worldDeltaX3*(double)x3;
+                  nodes.push_back( makeUbTuple(float(x1KO), float(x2KO), float(x3KO)) );
+                  nodedata[0].push_back((*voxelMatrix)(x1,x2,x3));
+            }
+         }
+      }
+   WbWriterVtkXmlASCII::getInstance()->writeNodesWithNodeData(fileName, nodes,  datanames, nodedata); 
+}
+//////////////////////////////////////////////////////////////////////////
+void writeGbVoxelMatrix3DtoLegacyVTK(const std::string& fileName, GbVoxelMatrix3DPtr voxelMatrix,
+                                       double worldDeltaX1, double worldDeltaX2, double worldDeltaX3,
+                                       int nx1, int nx2, int nx3)
+{
+   UbFileOutputASCII out(fileName);
+
+   int nn = nx1*nx2*nx3;
+   out.writeLine("# vtk DataFile Version 3.0");
+   out.writeLine(fileName);
+   out.writeLine("ASCII");
+   out.writeLine("DATASET STRUCTURED_POINTS");
+   out.writeString("DIMENSIONS");
+   out.writeInteger(nx1);
+   out.writeInteger(nx2);
+   out.writeInteger(nx3);
+   out.writeLine();
+   out.writeString("ORIGIN");
+   out.writeDouble(voxelMatrix->getX1Minimum());
+   out.writeDouble(voxelMatrix->getX2Minimum());
+   out.writeDouble(voxelMatrix->getX3Minimum());
+   out.writeLine();
+   out.writeString("SPACING");
+   out.writeDouble(worldDeltaX1);
+   out.writeDouble(worldDeltaX2);
+   out.writeDouble(worldDeltaX3);
+   out.writeLine();
+   out.writeString("POINT_DATA");
+   out.writeInteger(nn);
+   out.writeLine();
+   out.writeLine("SCALARS Geo integer");
+   out.writeLine("LOOKUP_TABLE default");
+
+   for(int k=0 ; k<nx3 ; k++){
+      for(int j=0 ; j<nx2 ; j++){
+         for(int i=0 ; i<nx1 ; i++){
+            out.writeInteger( (int)(*voxelMatrix)(i,j,k) );
+         }
+      }
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+void run(const char *cstr)
+{
+   try
+   {
+      //string pathname = "c:/temp/bananas/out";
+      //string pathnameGeo = "c:/temp/bananas/geo";
+
+      std::string opt;
+      if(cstr!= NULL)
+         opt = std::string(cstr);
+      else
+      {
+         UBLOG(logINFO,"no option: x, y or z");
+         return;
+      }
+      
+      string pathnameGeo = "/home/koskuche/data/bananas";
+      string pathname;
+
+      if(opt == "z") pathname = "/work/koskuche/scratch/bananas/setupZ/out";
+
+      if(opt == "x") pathname = "/work/koskuche/scratch/bananas/setupX/out";
+
+      if(opt == "y") pathname = "/work/koskuche/scratch/bananas/setupY/out";
+
+      CommunicatorPtr comm(new MPICommunicator());
+     
+      //////////////////////////////////////////////////////////////////////////
+      // Geometries
+      //////////////////////////////////////////////////////////////////////////
+      //bananas box geometry
+      UBLOG(logINFO,"Start read bananas box geometry");
+      GbTriFaceMesh3DPtr bananaBox (GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(pathnameGeo+"/Banana_boxD.stl","banana_box"));
+      UBLOG(logINFO,"Stop read bananas box geometry");
+      bananaBox->rotate(90.0, 0.0, 0.0); //around Z
+
+      double b_minX1 = bananaBox->getX1Minimum();
+      double b_minX2 = bananaBox->getX2Minimum();
+      double b_minX3 = bananaBox->getX3Minimum();
+
+      double b_maxX1 = bananaBox->getX1Maximum();
+      double b_maxX2 = bananaBox->getX2Maximum();
+      double b_maxX3 = bananaBox->getX3Maximum();
+
+      if(opt == "x") bananaBox->rotate(0.0, 0.0, -90.0); //around X
+      
+      if(opt == "y") bananaBox->rotate(0.0, -90.0, 0.0); //around Y
+
+      UBLOG(logINFO,"Start write bananas box geometry");
+      GbSystem3D::writeGeoObject(bananaBox.get(), pathname+"/banana_box", WbWriterVtkXmlASCII::getInstance());
+      UBLOG(logINFO,"Stop write bananas box geometry");
+
+      //distances for bounding box
+      double dist_z = 0.12;
+      double dist_x = 0.26;
+      double dist_y = 0.195;
+
+      double g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3;
+
+      //bounding box of simulation
+      //setup1 - z
+      if(opt == "z")
+      {
+         g_minX1 = bananaBox->getX1Minimum();
+         g_minX2 = bananaBox->getX2Minimum();
+         g_minX3 = bananaBox->getX3Minimum()-dist_z;
+
+         g_maxX1 = bananaBox->getX1Maximum();
+         g_maxX2 = bananaBox->getX2Maximum();
+         g_maxX3 = bananaBox->getX3Maximum()+dist_z*2.0;
+      }
+
+      //setup2 - x
+      if(opt == "x")
+      {
+         g_minX1 = bananaBox->getX1Minimum();
+         g_minX2 = bananaBox->getX2Minimum();
+         g_minX3 = bananaBox->getX3Minimum()-dist_x;
+
+         g_maxX1 = bananaBox->getX1Maximum();
+         g_maxX2 = bananaBox->getX2Maximum();
+         g_maxX3 = bananaBox->getX3Maximum()+dist_x*2.0;
+      }
+
+      //setup3 - y
+      if(opt == "y")
+      {
+         g_minX1 = bananaBox->getX1Minimum();
+         g_minX2 = bananaBox->getX2Minimum();
+         g_minX3 = bananaBox->getX3Minimum()-dist_y;
+
+         g_maxX1 = bananaBox->getX1Maximum();
+         g_maxX2 = bananaBox->getX2Maximum();
+         g_maxX3 = bananaBox->getX3Maximum()+dist_y*2.0;
+      }
+
+      const double gridOriginX1 = g_minX1;
+      const double gridOriginX2 = g_minX2;
+      const double gridOriginX3 = g_minX3;
+
+      //int gridNX1 = 170;
+      //int gridNX2 = 226;
+      //int gridNX3 = 104;
+
+      const double dx = 2.20183486239e-3; //blockLentghX1/static_cast<double>(blocknx1);
+
+      UBLOG(logINFO,"DeltaX = " << dx);
+
+      CbArray3D<int> grid(int((g_maxX1-g_minX1)/dx)+1, int((g_maxX2-g_minX2)/dx)+1, int((g_maxX3-g_minX3)/dx)+1, FLUID);
+
+      UBLOG(logINFO,"Start write geo matrix empty");
+      writeMatrixToVtkImageFile(pathname + "/geo_matrix_empty.vtk", grid, dx, gridOriginX1, gridOriginX2, gridOriginX3);
+      UBLOG(logINFO,"Stop write geo matrix empty");
+
+#ifdef BANANAS
+      //reed bananas
+      UBLOG(logINFO,"Start read bananas geometry");
+      int d1, d2, d3;
+      readDimensionsFromFldFile(pathnameGeo + "/BANANA_8binn_Binear_A.fld", d1, d2, d3);
+      UBLOG(logINFO,"Dimensions of bananas geometry: " << d1 << ", " << d2 << ", " << d3);
+      GbVoxelMatrix3DPtr bananas(new GbVoxelMatrix3D(d1, d2, d3, float(GbVoxelMatrix3D::FLUID))); 
+      readGeoMatrixFromFldFile(pathnameGeo + "/BANANA_8binn_Binear_A.fld", bananas);
+      UBLOG(logINFO,"Stop read bananas geometry");
+      double bananasDx1 = (b_maxX1 - b_minX1) / float(d1);
+      double bananasDx2 = (b_maxX2 - b_minX2) / float(d2);
+      double bananasDx3 = (b_maxX3 - b_minX3) / float(d3);
+      bananas->setVoxelMatrixDelta(float(bananasDx1), float(bananasDx2), float(bananasDx3));
+      bananas->setCenterCoordinates(bananaBox->getX1Centroid(), bananaBox->getX2Centroid(), bananaBox->getX3Centroid());
+      bananas->setVoxelMatrixMininum(float(b_minX1), float(b_minX2), float(b_minX3));
+
+      bananas->rotate90aroundX();
+      bananas->rotate90aroundY();
+      //bananas->rotate90aroundX();
+
+      UBLOG(logINFO,"Start write bananas geometry");
+      bananas->writeToLegacyVTK(pathname + "/bananas.vtk");
+      UBLOG(logINFO,"Stop write bananas geometry");
+#endif
+
+#ifdef CONVEXHULL
+      UBLOG(logINFO,"Start read bananas box geometry");
+      GbTriFaceMesh3DPtr bananaHull (GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(pathnameGeo+"/convexhullASCII.stl","banana_hull"));
+      UBLOG(logINFO,"Stop read bananas box geometry");
+      bananaHull->translate(0.0, 0.0, 5.0*dx);
+      if(opt == "x") bananaHull->rotateAroundPoint(bananaBox->getX1Centroid(), bananaBox->getX2Centroid(), bananaBox->getX3Centroid(), 0.0, 0.0, -90.0); //around X
+      if(opt == "y") bananaHull->rotateAroundPoint(bananaBox->getX1Centroid(), bananaBox->getX2Centroid(), bananaBox->getX3Centroid(), 0.0, -90.0, 0.0); //around Y
+      UBLOG(logINFO,"Start write banana hull geometry");
+      GbSystem3D::writeGeoObject(bananaHull.get(), pathname+"/banana_hull", WbWriterVtkXmlASCII::getInstance());
+      UBLOG(logINFO,"Stop write banana hull geometry");
+#endif
+      ////////////////////////////////////////
+      //return;
+      /////////////////////////////////////////
+
+      UBLOG(logINFO,"Start discretization of banana box");
+      discretizeGeoObject(bananaBox, grid, dx, gridOriginX1, gridOriginX2, gridOriginX3);
+      UBLOG(logINFO,"Stop discretization of banana box");
+
+#ifdef BANANAS
+      UBLOG(logINFO,"Start discretization of bananas");
+      discretizeGeoObject(bananas, grid, dx, gridOriginX1, gridOriginX2, gridOriginX3);
+      UBLOG(logINFO,"Stop discretization of bananas");
+#endif
+
+#ifdef CONVEXHULL
+      UBLOG(logINFO,"Start discretization of banana hull");
+      discretizeGeoObject(bananaHull, grid, dx, gridOriginX1, gridOriginX2, gridOriginX3);
+      UBLOG(logINFO,"Stop discretization of banana hull");
+#endif
+
+      UBLOG(logINFO,"Start write geo matrix");
+      writeMatrixToVtkImageFile(pathname + "/geo_matrix.vtk", grid, dx, gridOriginX1, gridOriginX2, gridOriginX3);
+      UBLOG(logINFO,"Stop write geo matrix");
+   }
+   catch(std::exception& e)
+   {
+      cerr << e.what() << endl << flush;
+   }
+   catch(std::string& s)
+   {
+      cerr << s << endl;
+   }
+   catch(...)
+   {
+      cerr << "unknown exception" << endl;
+   }
+
+}
+int main(int argc, char* argv[])
+{
+
+   run(argv[1]);
+
+   return 0;
+}
+
diff --git a/apps/cpu/bananas2/CMakeLists.txt b/apps/cpu/bananas2/CMakeLists.txt
index c2c655e8053b47e1537a70bd50b27b49d540ba8e..2abcdd2b640f525b8e026592c641ef8921532bfb 100644
--- a/apps/cpu/bananas2/CMakeLists.txt
+++ b/apps/cpu/bananas2/CMakeLists.txt
@@ -1,25 +1,25 @@
-CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
-
-########################################################
-## C++ PROJECT                                       ###
-########################################################
-PROJECT(bananas2)
-
-INCLUDE(${SOURCE_ROOT}/core/IncludsList.txt) 
-
-#################################################################
-###   LOCAL FILES                                             ###
-#################################################################
-FILE(GLOB SPECIFIC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.h
-                         ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
-                         ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp  )
- 
-SET(ALL_SOURCES ${ALL_SOURCES} ${SPECIFIC_FILES})
-SOURCE_GROUP(src FILES ${SPECIFIC_FILES})
-  
-SET(CAB_ADDITIONAL_LINK_LIBRARIES core)
-
-#################################################################
-###   CREATE PROJECT                                          ###
-#################################################################
-CREATE_CAB_PROJECT(bananas2 BINARY)
+CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
+
+########################################################
+## C++ PROJECT                                       ###
+########################################################
+PROJECT(bananas2)
+
+INCLUDE(${SOURCE_ROOT}/core/IncludsList.txt) 
+
+#################################################################
+###   LOCAL FILES                                             ###
+#################################################################
+FILE(GLOB SPECIFIC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.h
+                         ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
+                         ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp  )
+ 
+SET(ALL_SOURCES ${ALL_SOURCES} ${SPECIFIC_FILES})
+SOURCE_GROUP(src FILES ${SPECIFIC_FILES})
+  
+SET(CAB_ADDITIONAL_LINK_LIBRARIES core)
+
+#################################################################
+###   CREATE PROJECT                                          ###
+#################################################################
+CREATE_CAB_PROJECT(bananas2 BINARY)
diff --git a/apps/cpu/bananas2/bananas2.cpp b/apps/cpu/bananas2/bananas2.cpp
index 4a348c219e975782ed52b6a6ac2e6481ed9c63b4..447e1702c72a8a193d21134f6f983eb9b10366cf 100644
--- a/apps/cpu/bananas2/bananas2.cpp
+++ b/apps/cpu/bananas2/bananas2.cpp
@@ -1,633 +1,633 @@
-#include <iostream>
-#include <string>
-
-#include "geometry3d/CoordinateTransformation3D.h"
-#include "Grid3D.h"
-#include "GenBlocksGridVisitor.h"
-#include "geometry3d/GbSystem3D.h"
-#include "geometry3d/GbCuboid3D.h"
-#include "geometry3d/GbCylinder3D.h"
-#include <geometry3d/GbSphere3D.h>
-#include "basics/writer/WbWriterVtkXmlASCII.h"
-#include "basics/writer/WbWriterVtkXmlBinary.h"
-#include "RefineCrossAndInsideGbObjectBlockVisitor.h"
-#include "RatioBlockVisitor.h"
-#include "RatioSmoothBlockVisitor.h"
-#include "OverlapBlockVisitor.h"
-#include "RefineInterGbObjectsVisitor.h"
-#include "RefineCrossAndInsideGbObjectBlockVisitor.h"
-#include "SetKernelBlockVisitor.h"
-#include "LBMKernelETD3Q27Cascaded.h"
-#include "D3Q27MacroscopicQuantitiesPostprocessor.h"
-#include "MPICommunicator.h"
-#include "D3Q27ETBCProcessor.h"
-#include "SimulationParameters.h"
-#include "D3Q27SetUndefinedNodesBlockVisitor.h"
-#include "SetInterpolationDirsBlockVisitor.h"
-#include "D3Q27SetConnectorsBlockVisitor.h"
-#include "NullCommunicator.h"
-#include "D3Q27ETInitDistributionsBlockVisitor.h"
-#include "CalculationManager.h"
-#include "PQueuePartitioningGridVisitor.h"
-#include "MetisPartitioningGridVisitor.h"
-#include "D3Q27Interactor.h"
-#include "D3Q27NoSlipBCAdapter.h"
-#include "D3Q27VelocityBCAdapter.h"
-#include "D3Q27DensityBCAdapter.h"
-#include "D3Q27BoundaryConditionAdapter.h"
-#include "StringUtil.hpp"
-#include "D3Q27OffsetInterpolationProcessor.h"
-#include "D3Q27CompactInterpolationProcessor.h"
-#include "SyncBcBlockVisitor.h"
-#include "geometry3d/creator/GbTriFaceMesh3DCreator.h"
-#include "geometry3d/GbTriFaceMesh3D.h"
-#include "D3Q27TriFaceMeshInteractor.h"
-#include "basics/utilities/UbFileOutputASCII.h"
-#include "basics/utilities/UbFileInputASCII.h"
-#include "basics/utilities/UbFileInputBinary.h"
-#include "basics/container/CbArray3D.h"
-#include "geometry3d/GbVoxelMatrix3D.h"
-
-
-/* 
- *  The first 3 bits contain node type (fluid, inlet, etc.).
- *  The remaining 5 bits contain the unique geometry number 
- *  in case of solid nodes.
- *
- *  0 0 0 0 0 | 0 0 0
- */
-#define getGeoType(geo) (geo & 0x7) /*= 00000111*/
-#define getNormal(geo) (geo >> 3)
-#define setGeoType(dest, geo_type) dest = (dest & 0xF8) + geo_type
-#define setGeoNormal(dest, geo_id) dest = (geo_id << 3) + getGeoType(dest)
-
-#define GEO_INVALID 0
-#define GEO_FLUID 1
-#define GEO_INLET 2
-#define GEO_HULL 3           //hull
-#define GEO_FLUID_IN_HULL 4  //fluid inside hull
-#define GEO_BANANAS 5        //bananas    
-#define GEO_BOX 6            //box
-
-#define NORMAL_POS_X1 1
-#define NORMAL_NEG_X1 2
-
-#define NORMAL_POS_X2 3
-#define NORMAL_NEG_X2 4
-
-#define NORMAL_POS_X3 5
-#define NORMAL_NEG_X3 6
-
-#define CONVEXHULL
-
-using namespace std;
-
-typedef CbArray3D<int> VoxelMatrix;
-
-//index             0   1   2   3   4   5  6   7   8    9  10  11  12  13  14  15  16  17  18
-//f:                E,  W,  N,  S,  T,  B, NE, SW, SE, NW, TE, BW, BE, TW, TN, BS, BN, TS, ZERO
-const int EX1[] = { 1, -1,  0,  0,  0,  0,  1, -1,  1, -1,  1, -1,  1, -1,  0,  0,  0,  0,  0 };
-const int EX2[] = { 0,  0,  1, -1,  0,  0,  1, -1, -1,  1,  0,  0,  0,  0,  1, -1,  1, -1,  0 };
-const int EX3[] = { 0,  0,  0,  0,  1, -1,  0,  0,  0,  0,  1, -1, -1,  1,  1, -1, -1,  1,  0 };
-
-//////////////////////////////////////////////////////////////////////////
-void writeMatrixToVtkImageFile(const std::string& fileName, const VoxelMatrix& geoMatrix,
-                               double itsDeltaXWorld, double orgX1, double orgX2, double orgX3)
-{
-   UbFileOutputASCII out(fileName);
-
-   int NX1 = (int)geoMatrix.getNX1();	
-   int NX2 = (int)geoMatrix.getNX2();	
-   int NX3 = (int)geoMatrix.getNX3();
-   int nn = NX1*NX2*NX3;
-   out.writeLine("# vtk DataFile Version 3.0");
-   out.writeLine(fileName);
-   out.writeLine("ASCII");
-   out.writeLine("DATASET STRUCTURED_POINTS");
-   out.writeString("DIMENSIONS");
-   out.writeInteger(NX1);
-   out.writeInteger(NX2);
-   out.writeInteger(NX3);
-   out.writeLine();
-   out.writeString("ORIGIN");
-   out.writeDouble(orgX1);
-   out.writeDouble(orgX2);
-   out.writeDouble(orgX3);
-   out.writeLine();
-   out.writeString("SPACING");
-   out.writeDouble(itsDeltaXWorld);
-   out.writeDouble(itsDeltaXWorld);
-   out.writeDouble(itsDeltaXWorld);
-   out.writeLine();
-   out.writeString("POINT_DATA");
-   out.writeInteger(nn);
-   out.writeLine();
-   out.writeLine("SCALARS Geo integer");
-   out.writeLine("LOOKUP_TABLE default");
-
-   for(int k=0 ; k<NX3 ; k++){
-      for(int j=0 ; j<NX2 ; j++){
-         for(int i=0 ; i<NX1 ; i++){
-            out.writeInteger( geoMatrix(i,j,k) );
-         }
-      }
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-void readDimensionsFromFldFile(const std::string& fileName, int& d1, int& d2, int& d3)
-{
-   UbFileInputASCII in(fileName);
-   // read grid nx3
-   int dim   = in.readIntegerAfterString("ndim=");
-
-   if (dim != 3) throw UbException(UB_EXARGS,"readGeoMatrixFromFldFile() - Wrong number of dimensions.");
-
-   d1 = in.readIntegerAfterString("dim1=");
-   d2 = in.readIntegerAfterString("dim2=");
-   d3 = in.readIntegerAfterString("dim3=");
-}
-//////////////////////////////////////////////////////////////////////////
-void readGeoMatrixFromFldFile(const std::string& fileName, GbVoxelMatrix3DPtr geoMatrix)
-{
-   UbFileInputASCII in(fileName);
-   // read grid nx3
-   int dim   = in.readIntegerAfterString("ndim=");
-
-   if (dim != 3) throw UbException(UB_EXARGS,"readGeoMatrixFromFldFile() - Wrong number of dimensions.");
-
-   int sizeX = in.readIntegerAfterString("dim1=");
-   int sizeY = in.readIntegerAfterString("dim2=");
-   int sizeZ = in.readIntegerAfterString("dim3=");
-
-   std::string binFileName = in.readStringAfterString("variable 1 file=");
-
-   //separate name from path
-   std::string path = fileName.substr( 0, fileName.find_last_of('//')+1 );
-
-   binFileName = path.append(binFileName);
-
-   UbFileInputBinary binIn(binFileName);
-
-   for (int i=0; i<2048; i++) 
-   {
-      binIn.readChar();
-   }
-
-   int x, y, z, val;
-
-   for(z=0; z<sizeZ; z++)
-   {
-      for(y=0; y<sizeY; y++)
-      {
-         for(x=0; x<sizeX; x++)
-         {
-            val = binIn.readChar();
-
-            if(x!=0 && x!=sizeX-1 && 
-               y!=0 && y!=sizeY-1 &&
-               z!=0 && z!=sizeZ-1   )
-            {
-               if(val == 0)
-               {
-                   (*geoMatrix)(x,y,z) = GbVoxelMatrix3D::SOLID;
-               }
-            }
-         }
-      }
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-void discretizeGeoObject(GbObject3DPtr geoObject, VoxelMatrix& geoMatrix, double delta, 
-                         double orgX1, double orgX2, double orgX3, 
-                         int inValue, int outValue, bool bothSides,
-                         bool overwriteIn, bool overwriteOut,
-                         int noInValue, int noOutValue)
-{
-   int nx1 = (int)geoMatrix.getNX1();
-   int nx2 = (int)geoMatrix.getNX2();
-   int nx3 = (int)geoMatrix.getNX3();
-
-   for(int k=0 ; k<nx3 ; k++)
-   {
-      for(int j=0 ; j<nx2 ; j++)
-      {
-         for(int i=0 ; i<nx1 ; i++)
-         {
-            double x = orgX1 + i*delta;
-            double y = orgX2 + j*delta;
-            double z = orgX3 + k*delta;
-
-            int temp = 0;
-            int gm = geoMatrix(i,j,k);
-
-            if(geoObject->isPointInGbObject3D(x, y, z))  
-            {
-               setGeoType(temp, inValue);
-               if (overwriteIn)
-               {
-                  geoMatrix(i,j,k) = temp;
-               }
-               else
-               {
-                  if(gm != noInValue) 
-                  {
-                     geoMatrix(i,j,k) = temp;
-                  }
-               }
-            }
-            else if(bothSides)
-            {
-               setGeoType(temp, outValue);
-               if (overwriteOut)
-               {
-                  geoMatrix(i,j,k) = temp;
-               }
-               else
-               {
-                  if(gm != noOutValue) 
-                  {
-                     geoMatrix(i,j,k) = temp;
-                  }
-               }
-            }
-         }
-      }
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-bool hasNeighbor(VoxelMatrix& geoMatrix, int x1, int x2, int x3)
-{
-   bool result = false;
-   for( int dir = 0; dir < 18; dir++)
-   {
-      int temp = geoMatrix(x1+EX1[dir], x2+EX2[dir], x3+EX3[dir]);
-      if(temp == GEO_BANANAS || temp == GEO_FLUID_IN_HULL)
-      {
-         result = true;
-         break;
-      }
-   }
-   return result;
-}
-//////////////////////////////////////////////////////////////////////////
-void createHull(VoxelMatrix& geoMatrix)
-{
-   int nx1 = (int)geoMatrix.getNX1();
-   int nx2 = (int)geoMatrix.getNX2();
-   int nx3 = (int)geoMatrix.getNX3();
-
-   for(int k=1 ; k<nx3-1 ; k++)
-   {
-      for(int j=1 ; j<nx2-1 ; j++)
-      {
-         for(int i=1 ; i<nx1-1 ; i++)
-         {
-            int val = geoMatrix(i,j,k);
-            if(val == GEO_FLUID)
-            {
-               if(hasNeighbor(geoMatrix, i, j, k))
-               {
-                  int temp = 0;
-                  setGeoType(temp, GEO_HULL);
-                  geoMatrix(i,j,k) = temp;
-               }
-            }
-         }
-      }
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-void writeGbVoxelMatrix3DtoVtuXmlASCII(const std::string& fileName, GbVoxelMatrix3DPtr voxelMatrix, 
-                                       double worldDeltaX1, double worldDeltaX2, double worldDeltaX3,
-                                       int nx1, int nx2, int nx3)
-{
-   std::vector< UbTupleFloat3 > nodes;
-   std::vector<std::string > datanames;
-   std::vector<std::vector<double > > nodedata;
-   
-   datanames.resize(0);
-   datanames.push_back("Solid");
-   nodes.resize(0);
-   nodedata.resize(datanames.size());
-
-   double orgX1 = voxelMatrix->getX1Minimum();
-   double orgX2 = voxelMatrix->getX2Minimum();
-   double orgX3 = voxelMatrix->getX3Minimum();
-
-   int index = 0;
-   double x1KO,x2KO,x3KO;
-   
-      for (int x3=0; x3<nx3;x3++){
-         for (int x2=0; x2<nx2;x2++){
-            for(int x1=0; x1<nx1;x1++)
-            {
-                  x1KO = orgX1 + worldDeltaX1*(double)x1;
-                  x2KO = orgX2 + worldDeltaX2*(double)x2;
-                  x3KO = orgX3 + worldDeltaX3*(double)x3;
-                  nodes.push_back( makeUbTuple(float(x1KO), float(x2KO), float(x3KO)) );
-                  nodedata[0].push_back((*voxelMatrix)(x1,x2,x3));
-            }
-         }
-      }
-   WbWriterVtkXmlASCII::getInstance()->writeNodesWithNodeData(fileName, nodes,  datanames, nodedata); 
-}
-//////////////////////////////////////////////////////////////////////////
-void writeGbVoxelMatrix3DtoLegacyVTK(const std::string& fileName, GbVoxelMatrix3DPtr voxelMatrix,
-                                       double worldDeltaX1, double worldDeltaX2, double worldDeltaX3,
-                                       int nx1, int nx2, int nx3)
-{
-   UbFileOutputASCII out(fileName);
-
-   int nn = nx1*nx2*nx3;
-   out.writeLine("# vtk DataFile Version 3.0");
-   out.writeLine(fileName);
-   out.writeLine("ASCII");
-   out.writeLine("DATASET STRUCTURED_POINTS");
-   out.writeString("DIMENSIONS");
-   out.writeInteger(nx1);
-   out.writeInteger(nx2);
-   out.writeInteger(nx3);
-   out.writeLine();
-   out.writeString("ORIGIN");
-   out.writeDouble(voxelMatrix->getX1Minimum());
-   out.writeDouble(voxelMatrix->getX2Minimum());
-   out.writeDouble(voxelMatrix->getX3Minimum());
-   out.writeLine();
-   out.writeString("SPACING");
-   out.writeDouble(worldDeltaX1);
-   out.writeDouble(worldDeltaX2);
-   out.writeDouble(worldDeltaX3);
-   out.writeLine();
-   out.writeString("POINT_DATA");
-   out.writeInteger(nn);
-   out.writeLine();
-   out.writeLine("SCALARS Geo integer");
-   out.writeLine("LOOKUP_TABLE default");
-
-   for(int k=0 ; k<nx3 ; k++){
-      for(int j=0 ; j<nx2 ; j++){
-         for(int i=0 ; i<nx1 ; i++){
-            out.writeInteger( (int)(*voxelMatrix)(i,j,k) );
-         }
-      }
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-void setNormalsOnBoundary(int minX1, int minX2, int minX3, int maxX1, int maxX2, int maxX3, VoxelMatrix& matrix, int dir)
-{
-   for (int ix3 = minX3; ix3 <= maxX3; ix3++)
-      for (int ix2 = minX2; ix2 <= maxX2; ix2++)
-         for (int ix1 = minX1; ix1 <= maxX1; ix1++)
-         {
-
-            int temp = 0;
-            temp = getGeoType(matrix(ix1, ix2, ix3));
-            setGeoNormal(temp, dir);
-            matrix(ix1, ix2, ix3) = temp;
-         }
-}
-//////////////////////////////////////////////////////////////////////////
-void run(const char *cstr)
-{
-   try
-   {
-      std::string opt;
-      if(cstr!= NULL)
-         opt = std::string(cstr);
-      else
-      {
-         UBLOG(logINFO,"no option: x, y or z");
-         return;
-      }
-
-      string pathnameGeo = "/home/koskuche/data/bananas";
-      string pathname;
-
-      if(opt == "z") pathname = "/work/koskuche/scratch/bananas2/setupZ";
-
-      if(opt == "x") pathname = "/work/koskuche/scratch/bananas2/setupX";
-
-      if(opt == "y") pathname = "/work/koskuche/scratch/bananas2/setupY";
-
-      CommunicatorPtr comm(new MPICommunicator());
-     
-      //////////////////////////////////////////////////////////////////////////
-      // Geometries
-      //////////////////////////////////////////////////////////////////////////
-      //bananas box geometry
-      UBLOG(logINFO,"Start read bananas box geometry");
-      GbTriFaceMesh3DPtr bananaBox (GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(pathnameGeo+"/Banana_boxD.stl","banana_box"));
-      UBLOG(logINFO,"Stop read bananas box geometry");
-      bananaBox->rotate(90.0, 0.0, 0.0); //around Z
-
-      double b_minX1 = bananaBox->getX1Minimum();
-      double b_minX2 = bananaBox->getX2Minimum();
-      double b_minX3 = bananaBox->getX3Minimum();
-
-      double b_maxX1 = bananaBox->getX1Maximum();
-      double b_maxX2 = bananaBox->getX2Maximum();
-      double b_maxX3 = bananaBox->getX3Maximum();
-
-      if(opt == "x") bananaBox->rotate(0.0, 0.0, -90.0); //around X
-
-      if(opt == "y") bananaBox->rotate(0.0, -90.0, 0.0); //around Y
-
-      //after rotation for setup 2-3
-      double bb_minX1 = bananaBox->getX1Minimum();
-      double bb_minX2 = bananaBox->getX2Minimum();
-      double bb_minX3 = bananaBox->getX3Minimum();
-
-      double bb_maxX1 = bananaBox->getX1Maximum();
-      double bb_maxX2 = bananaBox->getX2Maximum();
-      double bb_maxX3 = bananaBox->getX3Maximum();
-
-      UBLOG(logINFO,"Start write bananas box geometry");
-      GbSystem3D::writeGeoObject(bananaBox.get(), pathname+"/banana_box", WbWriterVtkXmlASCII::getInstance());
-      UBLOG(logINFO,"Stop write bananas box geometry");
-
-      //distances for bounding box
-      double dist_z = 0.022;
-      double site   = 0.011;
-
-      //bounding box of simulation
-      double g_minX1 = bananaBox->getX1Minimum()-site;
-      double g_minX2 = bananaBox->getX2Minimum()-site;
-      double g_minX3 = bananaBox->getX3Minimum()-dist_z*2.0;
-
-      double g_maxX1 = bananaBox->getX1Maximum()+site;
-      double g_maxX2 = bananaBox->getX2Maximum()+site;
-      double g_maxX3 = bananaBox->getX3Maximum()+dist_z*2.0;
-
-      const double gridOriginX1 = g_minX1;
-      const double gridOriginX2 = g_minX2;
-      const double gridOriginX3 = g_minX3;
-
-      const double dx = 2.20183486239e-3;
-      UBLOG(logINFO,"DeltaX = " << dx);
-
-      GbCuboid3DPtr addWall1 (new GbCuboid3D(g_minX1, g_minX2, bb_minX3, bb_minX1, g_maxX2, bb_minX3+2*dx));
-      GbSystem3D::writeGeoObject(addWall1.get(), pathname+"/addWall1", WbWriterVtkXmlASCII::getInstance());
-
-      GbCuboid3DPtr addWall2 (new GbCuboid3D(bb_maxX1, g_minX2, bb_minX3, g_maxX1, g_maxX2, bb_minX3+2*dx));
-      GbSystem3D::writeGeoObject(addWall2.get(), pathname+"/addWall2", WbWriterVtkXmlASCII::getInstance());
-
-      GbCuboid3DPtr addWall3 (new GbCuboid3D(g_minX1, g_minX2, bb_minX3, g_maxX1, bb_minX2, bb_minX3+2*dx));
-      GbSystem3D::writeGeoObject(addWall3.get(), pathname+"/addWall3", WbWriterVtkXmlASCII::getInstance());
-
-      GbCuboid3DPtr addWall4 (new GbCuboid3D(g_minX1, bb_maxX2, bb_minX3, g_maxX1, g_maxX2, bb_minX3+2*dx));
-      GbSystem3D::writeGeoObject(addWall4.get(), pathname+"/addWall4", WbWriterVtkXmlASCII::getInstance());
-
-      VoxelMatrix grid(int((g_maxX1-g_minX1)/dx)+1, int((g_maxX2-g_minX2)/dx)+1, int((g_maxX3-g_minX3)/dx)+1, GEO_FLUID);
-
-      UBLOG(logINFO,"Start write geo matrix empty");
-      writeMatrixToVtkImageFile(pathname + "/geo_matrix_empty.vtk", grid, dx, gridOriginX1, gridOriginX2, gridOriginX3);
-      UBLOG(logINFO,"Stop write geo matrix empty");
-
-#ifdef CONVEXHULL
-      UBLOG(logINFO,"Start read bananas box geometry");
-      GbTriFaceMesh3DPtr bananasHull (GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(pathnameGeo+"/convexhullASCII.stl","banana_hull"));
-      UBLOG(logINFO,"Stop read bananas box geometry");
-      double tr1 = bananasHull->getX3Minimum() - bananaBox->getX3Minimum();
-      bananasHull->translate(0.0, 0.0, 5.0*dx);
-#endif
-
-      //reed bananas
-      UBLOG(logINFO,"Start read bananas geometry");
-      int d1, d2, d3;
-      readDimensionsFromFldFile(pathnameGeo + "/BANANA_8binn_Binear_A.fld", d1, d2, d3);
-      UBLOG(logINFO,"Dimensions of bananas geometry: " << d1 << ", " << d2 << ", " << d3);
-      GbVoxelMatrix3DPtr bananas(new GbVoxelMatrix3D(d1, d2, d3, float(GbVoxelMatrix3D::FLUID))); 
-      readGeoMatrixFromFldFile(pathnameGeo + "/BANANA_8binn_Binear_A.fld", bananas);
-      UBLOG(logINFO,"Stop read bananas geometry");
-      double bananasDx1 = (b_maxX1 - b_minX1) / float(d1);
-      double bananasDx2 = (b_maxX2 - b_minX2) / float(d2);
-      double bananasDx3 = (b_maxX3 - b_minX3) / float(d3);
-      bananas->setVoxelMatrixDelta(float(bananasDx1), float(bananasDx2), float(bananasDx3));
-      bananas->setCenterCoordinates(bananaBox->getX1Centroid(), bananaBox->getX2Centroid(), bananaBox->getX3Centroid());
-      bananas->setVoxelMatrixMininum(float(b_minX1), float(b_minX2), float(b_minX3));
-      
-      bananas->rotate90aroundY();
-      bananas->rotate90aroundY();
-      bananas->rotate90aroundZ();
-      bananas->rotate90aroundZ();
-      
-#ifdef CONVEXHULL
-      std::cout << "translate bananas: " <<bananasHull->getX3Minimum() - bananas->getX3Minimum() - tr1<<"\n";
-      bananas->translate(0.0, 0.0, bananasHull->getX3Minimum() - bananas->getX3Minimum() - tr1);
-      if(opt == "x") bananasHull->rotateAroundPoint(bananaBox->getX1Centroid(), bananaBox->getX2Centroid(), bananaBox->getX3Centroid(), 0.0, 0.0, -90.0); //around X
-      if(opt == "y") bananasHull->rotateAroundPoint(bananaBox->getX1Centroid(), bananaBox->getX2Centroid(), bananaBox->getX3Centroid(), 0.0, -90.0, 0.0); //around Y
-      UBLOG(logINFO,"Start write banana hull geometry");
-      GbSystem3D::writeGeoObject(bananasHull.get(), pathname+"/banana_hull", WbWriterVtkXmlASCII::getInstance());
-      UBLOG(logINFO,"Stop write banana hull geometry");
-#endif
-      
-      if(opt == "x")
-      {
-         bananas->rotate90aroundX(bananaBox->getX1Centroid(), bananaBox->getX2Centroid(), bananaBox->getX3Centroid());
-         bananas->rotate90aroundX(bananaBox->getX1Centroid(), bananaBox->getX2Centroid(), bananaBox->getX3Centroid());
-         bananas->rotate90aroundX(bananaBox->getX1Centroid(), bananaBox->getX2Centroid(), bananaBox->getX3Centroid());
-      }
-      else if(opt == "y")
-      {
-         bananas->rotate90aroundY(bananaBox->getX1Centroid(), bananaBox->getX2Centroid(), bananaBox->getX3Centroid());
-         bananas->rotate90aroundY(bananaBox->getX1Centroid(), bananaBox->getX2Centroid(), bananaBox->getX3Centroid());
-         bananas->rotate90aroundY(bananaBox->getX1Centroid(), bananaBox->getX2Centroid(), bananaBox->getX3Centroid());
-      }
-
-      UBLOG(logINFO,"Start write bananas geometry");
-      bananas->writeToLegacyVTK(pathname + "/bananas.vtk");
-      UBLOG(logINFO,"Stop write bananas geometry");
-
-#ifdef BANANAS
-      UBLOG(logINFO,"Start discretization of banana box");
-      discretizeGeoObject(bananaBox, grid, dx, gridOriginX1, gridOriginX2, gridOriginX3, GEO_BOX);
-      UBLOG(logINFO,"Stop discretization of banana box");
-      UBLOG(logINFO,"Start discretization of bananas");
-      discretizeGeoObject(bananas, grid, dx, gridOriginX1, gridOriginX2, gridOriginX3, GEO_BANANAS);
-      UBLOG(logINFO,"Stop discretization of bananas");
-#endif
-
-#ifdef CONVEXHULL
-      UBLOG(logINFO,"Start discretization of bananas");
-      discretizeGeoObject(bananas, grid, dx, gridOriginX1, gridOriginX2, gridOriginX3, GEO_BANANAS, GEO_FLUID, false, true, true, GEO_INVALID, GEO_INVALID);
-      UBLOG(logINFO,"Stop discretization of bananas");
-      UBLOG(logINFO,"Start discretization of hull");
-      discretizeGeoObject(bananasHull, grid, dx, gridOriginX1, gridOriginX2, gridOriginX3, GEO_FLUID_IN_HULL, GEO_FLUID, true, false, true, GEO_BANANAS, GEO_INVALID);
-      UBLOG(logINFO,"Stop discretization of hull");
-      UBLOG(logINFO,"Start creation of hull film");
-      createHull(grid);
-      UBLOG(logINFO,"Stop creation of hull film");
-      UBLOG(logINFO,"Start discretization of banana box");
-      discretizeGeoObject(bananaBox, grid, dx, gridOriginX1, gridOriginX2, gridOriginX3, GEO_BOX, GEO_FLUID, false, true, true, GEO_INVALID, GEO_INVALID);
-      UBLOG(logINFO,"Stop discretization of banana box");
-#endif
-
-      UBLOG(logINFO,"Start discretization of add walls");
-      discretizeGeoObject(addWall1, grid, dx, gridOriginX1, gridOriginX2, gridOriginX3, GEO_BOX, GEO_FLUID, false, true, true, GEO_INVALID, GEO_INVALID);
-      discretizeGeoObject(addWall2, grid, dx, gridOriginX1, gridOriginX2, gridOriginX3, GEO_BOX, GEO_FLUID, false, true, true, GEO_INVALID, GEO_INVALID);
-      discretizeGeoObject(addWall3, grid, dx, gridOriginX1, gridOriginX2, gridOriginX3, GEO_BOX, GEO_FLUID, false, true, true, GEO_INVALID, GEO_INVALID);
-      discretizeGeoObject(addWall4, grid, dx, gridOriginX1, gridOriginX2, gridOriginX3, GEO_BOX, GEO_FLUID, false, true, true, GEO_INVALID, GEO_INVALID);
-      UBLOG(logINFO,"Stop discretization of add walls");
-
-      UBLOG(logINFO,"Start set normals");
-      int boxNX1 = int(bananaBox->getLengthX1() / dx);
-      int boxNX2 = int(bananaBox->getLengthX2() / dx);
-      int boxNX3 = int(bananaBox->getLengthX3() / dx);
-
-      int minX1 = int((bb_minX1 - gridOriginX1) / dx)+1;
-      int minX2 = int((bb_minX2 - gridOriginX2) / dx)+1;
-      int minX3 = int((bb_minX3 - gridOriginX3) / dx)+1;
-
-      int maxX1 = minX1 + boxNX1;
-      int maxX2 = minX2 + boxNX2;
-      int maxX3 = minX3 + boxNX3;
-
-      UBLOG(logINFO,"minX1="<<minX1<<",minX2= "<<minX2<<",minX3="<<minX3);
-      UBLOG(logINFO,"maxX1="<<maxX1<<",maxX2= "<<maxX2<<",maxX3="<<maxX3);
-
-
-      for (int ix3 = 0; ix3 < grid.getNX3(); ix3++)
-         for (int ix2 = 0; ix2 < grid.getNX2(); ix2++)
-            for (int ix1 = 0; ix1 < grid.getNX1(); ix1++)
-            {
-               int temp = grid(ix1, ix2, ix3);
-               setGeoNormal(temp, 0);
-               grid(ix1, ix2, ix3) = temp;
-            }
-
-
-      setNormalsOnBoundary(minX1, minX2, minX3, minX1, maxX2, maxX3, grid, NORMAL_NEG_X1);
-      setNormalsOnBoundary(maxX1, minX2, minX3, maxX1, maxX2, maxX3, grid, NORMAL_POS_X1);
-      setNormalsOnBoundary(minX1, minX2, minX3, maxX1, minX2, maxX3, grid, NORMAL_NEG_X2);
-      setNormalsOnBoundary(minX1, maxX2, minX3, maxX1, maxX2, maxX3, grid, NORMAL_POS_X2);
-      setNormalsOnBoundary(minX1, minX2, minX3, maxX1, maxX2, minX3, grid, NORMAL_NEG_X3);
-      setNormalsOnBoundary(minX1, minX2, maxX3, maxX1, maxX2, maxX3, grid, NORMAL_POS_X3);
-      UBLOG(logINFO,"Stop set normals");
-
-
-      UBLOG(logINFO,"Start write geo matrix");
-      writeMatrixToVtkImageFile(pathname + "/geo_matrix.vtk", grid, dx, gridOriginX1, gridOriginX2, gridOriginX3);
-      UBLOG(logINFO,"Stop write geo matrix");
-   }
-   catch(std::exception& e)
-   {
-      cerr << e.what() << endl << flush;
-   }
-   catch(std::string& s)
-   {
-      cerr << s << endl;
-   }
-   catch(...)
-   {
-      cerr << "unknown exception" << endl;
-   }
-
-}
-int main(int argc, char* argv[])
-{
-
-   run(argv[1]);
-
-   return 0;
-}
-
+#include <iostream>
+#include <string>
+
+#include "geometry3d/CoordinateTransformation3D.h"
+#include "Grid3D.h"
+#include "GenBlocksGridVisitor.h"
+#include "geometry3d/GbSystem3D.h"
+#include "geometry3d/GbCuboid3D.h"
+#include "geometry3d/GbCylinder3D.h"
+#include <geometry3d/GbSphere3D.h>
+#include "basics/writer/WbWriterVtkXmlASCII.h"
+#include "basics/writer/WbWriterVtkXmlBinary.h"
+#include "RefineCrossAndInsideGbObjectBlockVisitor.h"
+#include "RatioBlockVisitor.h"
+#include "RatioSmoothBlockVisitor.h"
+#include "OverlapBlockVisitor.h"
+#include "RefineInterGbObjectsVisitor.h"
+#include "RefineCrossAndInsideGbObjectBlockVisitor.h"
+#include "SetKernelBlockVisitor.h"
+#include "LBMKernelETD3Q27Cascaded.h"
+#include "D3Q27MacroscopicQuantitiesPostprocessor.h"
+#include "MPICommunicator.h"
+#include "D3Q27ETBCProcessor.h"
+#include "SimulationParameters.h"
+#include "D3Q27SetUndefinedNodesBlockVisitor.h"
+#include "SetInterpolationDirsBlockVisitor.h"
+#include "D3Q27SetConnectorsBlockVisitor.h"
+#include "NullCommunicator.h"
+#include "D3Q27ETInitDistributionsBlockVisitor.h"
+#include "CalculationManager.h"
+#include "PQueuePartitioningGridVisitor.h"
+#include "MetisPartitioningGridVisitor.h"
+#include "D3Q27Interactor.h"
+#include "D3Q27NoSlipBCAdapter.h"
+#include "D3Q27VelocityBCAdapter.h"
+#include "D3Q27DensityBCAdapter.h"
+#include "D3Q27BoundaryConditionAdapter.h"
+#include "StringUtil.hpp"
+#include "D3Q27OffsetInterpolationProcessor.h"
+#include "D3Q27CompactInterpolationProcessor.h"
+#include "SyncBcBlockVisitor.h"
+#include "geometry3d/creator/GbTriFaceMesh3DCreator.h"
+#include "geometry3d/GbTriFaceMesh3D.h"
+#include "D3Q27TriFaceMeshInteractor.h"
+#include "basics/utilities/UbFileOutputASCII.h"
+#include "basics/utilities/UbFileInputASCII.h"
+#include "basics/utilities/UbFileInputBinary.h"
+#include "basics/container/CbArray3D.h"
+#include "geometry3d/GbVoxelMatrix3D.h"
+
+
+/* 
+ *  The first 3 bits contain node type (fluid, inlet, etc.).
+ *  The remaining 5 bits contain the unique geometry number 
+ *  in case of solid nodes.
+ *
+ *  0 0 0 0 0 | 0 0 0
+ */
+#define getGeoType(geo) (geo & 0x7) /*= 00000111*/
+#define getNormal(geo) (geo >> 3)
+#define setGeoType(dest, geo_type) dest = (dest & 0xF8) + geo_type
+#define setGeoNormal(dest, geo_id) dest = (geo_id << 3) + getGeoType(dest)
+
+#define GEO_INVALID 0
+#define GEO_FLUID 1
+#define GEO_INLET 2
+#define GEO_HULL 3           //hull
+#define GEO_FLUID_IN_HULL 4  //fluid inside hull
+#define GEO_BANANAS 5        //bananas    
+#define GEO_BOX 6            //box
+
+#define NORMAL_POS_X1 1
+#define NORMAL_NEG_X1 2
+
+#define NORMAL_POS_X2 3
+#define NORMAL_NEG_X2 4
+
+#define NORMAL_POS_X3 5
+#define NORMAL_NEG_X3 6
+
+#define CONVEXHULL
+
+using namespace std;
+
+typedef CbArray3D<int> VoxelMatrix;
+
+//index             0   1   2   3   4   5  6   7   8    9  10  11  12  13  14  15  16  17  18
+//f:                E,  W,  N,  S,  T,  B, NE, SW, SE, NW, TE, BW, BE, TW, TN, BS, BN, TS, ZERO
+const int EX1[] = { 1, -1,  0,  0,  0,  0,  1, -1,  1, -1,  1, -1,  1, -1,  0,  0,  0,  0,  0 };
+const int EX2[] = { 0,  0,  1, -1,  0,  0,  1, -1, -1,  1,  0,  0,  0,  0,  1, -1,  1, -1,  0 };
+const int EX3[] = { 0,  0,  0,  0,  1, -1,  0,  0,  0,  0,  1, -1, -1,  1,  1, -1, -1,  1,  0 };
+
+//////////////////////////////////////////////////////////////////////////
+void writeMatrixToVtkImageFile(const std::string& fileName, const VoxelMatrix& geoMatrix,
+                               double itsDeltaXWorld, double orgX1, double orgX2, double orgX3)
+{
+   UbFileOutputASCII out(fileName);
+
+   int NX1 = (int)geoMatrix.getNX1();	
+   int NX2 = (int)geoMatrix.getNX2();	
+   int NX3 = (int)geoMatrix.getNX3();
+   int nn = NX1*NX2*NX3;
+   out.writeLine("# vtk DataFile Version 3.0");
+   out.writeLine(fileName);
+   out.writeLine("ASCII");
+   out.writeLine("DATASET STRUCTURED_POINTS");
+   out.writeString("DIMENSIONS");
+   out.writeInteger(NX1);
+   out.writeInteger(NX2);
+   out.writeInteger(NX3);
+   out.writeLine();
+   out.writeString("ORIGIN");
+   out.writeDouble(orgX1);
+   out.writeDouble(orgX2);
+   out.writeDouble(orgX3);
+   out.writeLine();
+   out.writeString("SPACING");
+   out.writeDouble(itsDeltaXWorld);
+   out.writeDouble(itsDeltaXWorld);
+   out.writeDouble(itsDeltaXWorld);
+   out.writeLine();
+   out.writeString("POINT_DATA");
+   out.writeInteger(nn);
+   out.writeLine();
+   out.writeLine("SCALARS Geo integer");
+   out.writeLine("LOOKUP_TABLE default");
+
+   for(int k=0 ; k<NX3 ; k++){
+      for(int j=0 ; j<NX2 ; j++){
+         for(int i=0 ; i<NX1 ; i++){
+            out.writeInteger( geoMatrix(i,j,k) );
+         }
+      }
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+void readDimensionsFromFldFile(const std::string& fileName, int& d1, int& d2, int& d3)
+{
+   UbFileInputASCII in(fileName);
+   // read grid nx3
+   int dim   = in.readIntegerAfterString("ndim=");
+
+   if (dim != 3) throw UbException(UB_EXARGS,"readGeoMatrixFromFldFile() - Wrong number of dimensions.");
+
+   d1 = in.readIntegerAfterString("dim1=");
+   d2 = in.readIntegerAfterString("dim2=");
+   d3 = in.readIntegerAfterString("dim3=");
+}
+//////////////////////////////////////////////////////////////////////////
+void readGeoMatrixFromFldFile(const std::string& fileName, GbVoxelMatrix3DPtr geoMatrix)
+{
+   UbFileInputASCII in(fileName);
+   // read grid nx3
+   int dim   = in.readIntegerAfterString("ndim=");
+
+   if (dim != 3) throw UbException(UB_EXARGS,"readGeoMatrixFromFldFile() - Wrong number of dimensions.");
+
+   int sizeX = in.readIntegerAfterString("dim1=");
+   int sizeY = in.readIntegerAfterString("dim2=");
+   int sizeZ = in.readIntegerAfterString("dim3=");
+
+   std::string binFileName = in.readStringAfterString("variable 1 file=");
+
+   //separate name from path
+   std::string path = fileName.substr( 0, fileName.find_last_of('//')+1 );
+
+   binFileName = path.append(binFileName);
+
+   UbFileInputBinary binIn(binFileName);
+
+   for (int i=0; i<2048; i++) 
+   {
+      binIn.readChar();
+   }
+
+   int x, y, z, val;
+
+   for(z=0; z<sizeZ; z++)
+   {
+      for(y=0; y<sizeY; y++)
+      {
+         for(x=0; x<sizeX; x++)
+         {
+            val = binIn.readChar();
+
+            if(x!=0 && x!=sizeX-1 && 
+               y!=0 && y!=sizeY-1 &&
+               z!=0 && z!=sizeZ-1   )
+            {
+               if(val == 0)
+               {
+                   (*geoMatrix)(x,y,z) = GbVoxelMatrix3D::SOLID;
+               }
+            }
+         }
+      }
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+void discretizeGeoObject(GbObject3DPtr geoObject, VoxelMatrix& geoMatrix, double delta, 
+                         double orgX1, double orgX2, double orgX3, 
+                         int inValue, int outValue, bool bothSides,
+                         bool overwriteIn, bool overwriteOut,
+                         int noInValue, int noOutValue)
+{
+   int nx1 = (int)geoMatrix.getNX1();
+   int nx2 = (int)geoMatrix.getNX2();
+   int nx3 = (int)geoMatrix.getNX3();
+
+   for(int k=0 ; k<nx3 ; k++)
+   {
+      for(int j=0 ; j<nx2 ; j++)
+      {
+         for(int i=0 ; i<nx1 ; i++)
+         {
+            double x = orgX1 + i*delta;
+            double y = orgX2 + j*delta;
+            double z = orgX3 + k*delta;
+
+            int temp = 0;
+            int gm = geoMatrix(i,j,k);
+
+            if(geoObject->isPointInGbObject3D(x, y, z))  
+            {
+               setGeoType(temp, inValue);
+               if (overwriteIn)
+               {
+                  geoMatrix(i,j,k) = temp;
+               }
+               else
+               {
+                  if(gm != noInValue) 
+                  {
+                     geoMatrix(i,j,k) = temp;
+                  }
+               }
+            }
+            else if(bothSides)
+            {
+               setGeoType(temp, outValue);
+               if (overwriteOut)
+               {
+                  geoMatrix(i,j,k) = temp;
+               }
+               else
+               {
+                  if(gm != noOutValue) 
+                  {
+                     geoMatrix(i,j,k) = temp;
+                  }
+               }
+            }
+         }
+      }
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+bool hasNeighbor(VoxelMatrix& geoMatrix, int x1, int x2, int x3)
+{
+   bool result = false;
+   for( int dir = 0; dir < 18; dir++)
+   {
+      int temp = geoMatrix(x1+EX1[dir], x2+EX2[dir], x3+EX3[dir]);
+      if(temp == GEO_BANANAS || temp == GEO_FLUID_IN_HULL)
+      {
+         result = true;
+         break;
+      }
+   }
+   return result;
+}
+//////////////////////////////////////////////////////////////////////////
+void createHull(VoxelMatrix& geoMatrix)
+{
+   int nx1 = (int)geoMatrix.getNX1();
+   int nx2 = (int)geoMatrix.getNX2();
+   int nx3 = (int)geoMatrix.getNX3();
+
+   for(int k=1 ; k<nx3-1 ; k++)
+   {
+      for(int j=1 ; j<nx2-1 ; j++)
+      {
+         for(int i=1 ; i<nx1-1 ; i++)
+         {
+            int val = geoMatrix(i,j,k);
+            if(val == GEO_FLUID)
+            {
+               if(hasNeighbor(geoMatrix, i, j, k))
+               {
+                  int temp = 0;
+                  setGeoType(temp, GEO_HULL);
+                  geoMatrix(i,j,k) = temp;
+               }
+            }
+         }
+      }
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+void writeGbVoxelMatrix3DtoVtuXmlASCII(const std::string& fileName, GbVoxelMatrix3DPtr voxelMatrix, 
+                                       double worldDeltaX1, double worldDeltaX2, double worldDeltaX3,
+                                       int nx1, int nx2, int nx3)
+{
+   std::vector< UbTupleFloat3 > nodes;
+   std::vector<std::string > datanames;
+   std::vector<std::vector<double > > nodedata;
+   
+   datanames.resize(0);
+   datanames.push_back("Solid");
+   nodes.resize(0);
+   nodedata.resize(datanames.size());
+
+   double orgX1 = voxelMatrix->getX1Minimum();
+   double orgX2 = voxelMatrix->getX2Minimum();
+   double orgX3 = voxelMatrix->getX3Minimum();
+
+   int index = 0;
+   double x1KO,x2KO,x3KO;
+   
+      for (int x3=0; x3<nx3;x3++){
+         for (int x2=0; x2<nx2;x2++){
+            for(int x1=0; x1<nx1;x1++)
+            {
+                  x1KO = orgX1 + worldDeltaX1*(double)x1;
+                  x2KO = orgX2 + worldDeltaX2*(double)x2;
+                  x3KO = orgX3 + worldDeltaX3*(double)x3;
+                  nodes.push_back( makeUbTuple(float(x1KO), float(x2KO), float(x3KO)) );
+                  nodedata[0].push_back((*voxelMatrix)(x1,x2,x3));
+            }
+         }
+      }
+   WbWriterVtkXmlASCII::getInstance()->writeNodesWithNodeData(fileName, nodes,  datanames, nodedata); 
+}
+//////////////////////////////////////////////////////////////////////////
+void writeGbVoxelMatrix3DtoLegacyVTK(const std::string& fileName, GbVoxelMatrix3DPtr voxelMatrix,
+                                       double worldDeltaX1, double worldDeltaX2, double worldDeltaX3,
+                                       int nx1, int nx2, int nx3)
+{
+   UbFileOutputASCII out(fileName);
+
+   int nn = nx1*nx2*nx3;
+   out.writeLine("# vtk DataFile Version 3.0");
+   out.writeLine(fileName);
+   out.writeLine("ASCII");
+   out.writeLine("DATASET STRUCTURED_POINTS");
+   out.writeString("DIMENSIONS");
+   out.writeInteger(nx1);
+   out.writeInteger(nx2);
+   out.writeInteger(nx3);
+   out.writeLine();
+   out.writeString("ORIGIN");
+   out.writeDouble(voxelMatrix->getX1Minimum());
+   out.writeDouble(voxelMatrix->getX2Minimum());
+   out.writeDouble(voxelMatrix->getX3Minimum());
+   out.writeLine();
+   out.writeString("SPACING");
+   out.writeDouble(worldDeltaX1);
+   out.writeDouble(worldDeltaX2);
+   out.writeDouble(worldDeltaX3);
+   out.writeLine();
+   out.writeString("POINT_DATA");
+   out.writeInteger(nn);
+   out.writeLine();
+   out.writeLine("SCALARS Geo integer");
+   out.writeLine("LOOKUP_TABLE default");
+
+   for(int k=0 ; k<nx3 ; k++){
+      for(int j=0 ; j<nx2 ; j++){
+         for(int i=0 ; i<nx1 ; i++){
+            out.writeInteger( (int)(*voxelMatrix)(i,j,k) );
+         }
+      }
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+void setNormalsOnBoundary(int minX1, int minX2, int minX3, int maxX1, int maxX2, int maxX3, VoxelMatrix& matrix, int dir)
+{
+   for (int ix3 = minX3; ix3 <= maxX3; ix3++)
+      for (int ix2 = minX2; ix2 <= maxX2; ix2++)
+         for (int ix1 = minX1; ix1 <= maxX1; ix1++)
+         {
+
+            int temp = 0;
+            temp = getGeoType(matrix(ix1, ix2, ix3));
+            setGeoNormal(temp, dir);
+            matrix(ix1, ix2, ix3) = temp;
+         }
+}
+//////////////////////////////////////////////////////////////////////////
+void run(const char *cstr)
+{
+   try
+   {
+      std::string opt;
+      if(cstr!= NULL)
+         opt = std::string(cstr);
+      else
+      {
+         UBLOG(logINFO,"no option: x, y or z");
+         return;
+      }
+
+      string pathnameGeo = "/home/koskuche/data/bananas";
+      string pathname;
+
+      if(opt == "z") pathname = "/work/koskuche/scratch/bananas2/setupZ";
+
+      if(opt == "x") pathname = "/work/koskuche/scratch/bananas2/setupX";
+
+      if(opt == "y") pathname = "/work/koskuche/scratch/bananas2/setupY";
+
+      CommunicatorPtr comm(new MPICommunicator());
+     
+      //////////////////////////////////////////////////////////////////////////
+      // Geometries
+      //////////////////////////////////////////////////////////////////////////
+      //bananas box geometry
+      UBLOG(logINFO,"Start read bananas box geometry");
+      GbTriFaceMesh3DPtr bananaBox (GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(pathnameGeo+"/Banana_boxD.stl","banana_box"));
+      UBLOG(logINFO,"Stop read bananas box geometry");
+      bananaBox->rotate(90.0, 0.0, 0.0); //around Z
+
+      double b_minX1 = bananaBox->getX1Minimum();
+      double b_minX2 = bananaBox->getX2Minimum();
+      double b_minX3 = bananaBox->getX3Minimum();
+
+      double b_maxX1 = bananaBox->getX1Maximum();
+      double b_maxX2 = bananaBox->getX2Maximum();
+      double b_maxX3 = bananaBox->getX3Maximum();
+
+      if(opt == "x") bananaBox->rotate(0.0, 0.0, -90.0); //around X
+
+      if(opt == "y") bananaBox->rotate(0.0, -90.0, 0.0); //around Y
+
+      //after rotation for setup 2-3
+      double bb_minX1 = bananaBox->getX1Minimum();
+      double bb_minX2 = bananaBox->getX2Minimum();
+      double bb_minX3 = bananaBox->getX3Minimum();
+
+      double bb_maxX1 = bananaBox->getX1Maximum();
+      double bb_maxX2 = bananaBox->getX2Maximum();
+      double bb_maxX3 = bananaBox->getX3Maximum();
+
+      UBLOG(logINFO,"Start write bananas box geometry");
+      GbSystem3D::writeGeoObject(bananaBox.get(), pathname+"/banana_box", WbWriterVtkXmlASCII::getInstance());
+      UBLOG(logINFO,"Stop write bananas box geometry");
+
+      //distances for bounding box
+      double dist_z = 0.022;
+      double site   = 0.011;
+
+      //bounding box of simulation
+      double g_minX1 = bananaBox->getX1Minimum()-site;
+      double g_minX2 = bananaBox->getX2Minimum()-site;
+      double g_minX3 = bananaBox->getX3Minimum()-dist_z*2.0;
+
+      double g_maxX1 = bananaBox->getX1Maximum()+site;
+      double g_maxX2 = bananaBox->getX2Maximum()+site;
+      double g_maxX3 = bananaBox->getX3Maximum()+dist_z*2.0;
+
+      const double gridOriginX1 = g_minX1;
+      const double gridOriginX2 = g_minX2;
+      const double gridOriginX3 = g_minX3;
+
+      const double dx = 2.20183486239e-3;
+      UBLOG(logINFO,"DeltaX = " << dx);
+
+      GbCuboid3DPtr addWall1 (new GbCuboid3D(g_minX1, g_minX2, bb_minX3, bb_minX1, g_maxX2, bb_minX3+2*dx));
+      GbSystem3D::writeGeoObject(addWall1.get(), pathname+"/addWall1", WbWriterVtkXmlASCII::getInstance());
+
+      GbCuboid3DPtr addWall2 (new GbCuboid3D(bb_maxX1, g_minX2, bb_minX3, g_maxX1, g_maxX2, bb_minX3+2*dx));
+      GbSystem3D::writeGeoObject(addWall2.get(), pathname+"/addWall2", WbWriterVtkXmlASCII::getInstance());
+
+      GbCuboid3DPtr addWall3 (new GbCuboid3D(g_minX1, g_minX2, bb_minX3, g_maxX1, bb_minX2, bb_minX3+2*dx));
+      GbSystem3D::writeGeoObject(addWall3.get(), pathname+"/addWall3", WbWriterVtkXmlASCII::getInstance());
+
+      GbCuboid3DPtr addWall4 (new GbCuboid3D(g_minX1, bb_maxX2, bb_minX3, g_maxX1, g_maxX2, bb_minX3+2*dx));
+      GbSystem3D::writeGeoObject(addWall4.get(), pathname+"/addWall4", WbWriterVtkXmlASCII::getInstance());
+
+      VoxelMatrix grid(int((g_maxX1-g_minX1)/dx)+1, int((g_maxX2-g_minX2)/dx)+1, int((g_maxX3-g_minX3)/dx)+1, GEO_FLUID);
+
+      UBLOG(logINFO,"Start write geo matrix empty");
+      writeMatrixToVtkImageFile(pathname + "/geo_matrix_empty.vtk", grid, dx, gridOriginX1, gridOriginX2, gridOriginX3);
+      UBLOG(logINFO,"Stop write geo matrix empty");
+
+#ifdef CONVEXHULL
+      UBLOG(logINFO,"Start read bananas box geometry");
+      GbTriFaceMesh3DPtr bananasHull (GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(pathnameGeo+"/convexhullASCII.stl","banana_hull"));
+      UBLOG(logINFO,"Stop read bananas box geometry");
+      double tr1 = bananasHull->getX3Minimum() - bananaBox->getX3Minimum();
+      bananasHull->translate(0.0, 0.0, 5.0*dx);
+#endif
+
+      //reed bananas
+      UBLOG(logINFO,"Start read bananas geometry");
+      int d1, d2, d3;
+      readDimensionsFromFldFile(pathnameGeo + "/BANANA_8binn_Binear_A.fld", d1, d2, d3);
+      UBLOG(logINFO,"Dimensions of bananas geometry: " << d1 << ", " << d2 << ", " << d3);
+      GbVoxelMatrix3DPtr bananas(new GbVoxelMatrix3D(d1, d2, d3, float(GbVoxelMatrix3D::FLUID))); 
+      readGeoMatrixFromFldFile(pathnameGeo + "/BANANA_8binn_Binear_A.fld", bananas);
+      UBLOG(logINFO,"Stop read bananas geometry");
+      double bananasDx1 = (b_maxX1 - b_minX1) / float(d1);
+      double bananasDx2 = (b_maxX2 - b_minX2) / float(d2);
+      double bananasDx3 = (b_maxX3 - b_minX3) / float(d3);
+      bananas->setVoxelMatrixDelta(float(bananasDx1), float(bananasDx2), float(bananasDx3));
+      bananas->setCenterCoordinates(bananaBox->getX1Centroid(), bananaBox->getX2Centroid(), bananaBox->getX3Centroid());
+      bananas->setVoxelMatrixMininum(float(b_minX1), float(b_minX2), float(b_minX3));
+      
+      bananas->rotate90aroundY();
+      bananas->rotate90aroundY();
+      bananas->rotate90aroundZ();
+      bananas->rotate90aroundZ();
+      
+#ifdef CONVEXHULL
+      std::cout << "translate bananas: " <<bananasHull->getX3Minimum() - bananas->getX3Minimum() - tr1<<"\n";
+      bananas->translate(0.0, 0.0, bananasHull->getX3Minimum() - bananas->getX3Minimum() - tr1);
+      if(opt == "x") bananasHull->rotateAroundPoint(bananaBox->getX1Centroid(), bananaBox->getX2Centroid(), bananaBox->getX3Centroid(), 0.0, 0.0, -90.0); //around X
+      if(opt == "y") bananasHull->rotateAroundPoint(bananaBox->getX1Centroid(), bananaBox->getX2Centroid(), bananaBox->getX3Centroid(), 0.0, -90.0, 0.0); //around Y
+      UBLOG(logINFO,"Start write banana hull geometry");
+      GbSystem3D::writeGeoObject(bananasHull.get(), pathname+"/banana_hull", WbWriterVtkXmlASCII::getInstance());
+      UBLOG(logINFO,"Stop write banana hull geometry");
+#endif
+      
+      if(opt == "x")
+      {
+         bananas->rotate90aroundX(bananaBox->getX1Centroid(), bananaBox->getX2Centroid(), bananaBox->getX3Centroid());
+         bananas->rotate90aroundX(bananaBox->getX1Centroid(), bananaBox->getX2Centroid(), bananaBox->getX3Centroid());
+         bananas->rotate90aroundX(bananaBox->getX1Centroid(), bananaBox->getX2Centroid(), bananaBox->getX3Centroid());
+      }
+      else if(opt == "y")
+      {
+         bananas->rotate90aroundY(bananaBox->getX1Centroid(), bananaBox->getX2Centroid(), bananaBox->getX3Centroid());
+         bananas->rotate90aroundY(bananaBox->getX1Centroid(), bananaBox->getX2Centroid(), bananaBox->getX3Centroid());
+         bananas->rotate90aroundY(bananaBox->getX1Centroid(), bananaBox->getX2Centroid(), bananaBox->getX3Centroid());
+      }
+
+      UBLOG(logINFO,"Start write bananas geometry");
+      bananas->writeToLegacyVTK(pathname + "/bananas.vtk");
+      UBLOG(logINFO,"Stop write bananas geometry");
+
+#ifdef BANANAS
+      UBLOG(logINFO,"Start discretization of banana box");
+      discretizeGeoObject(bananaBox, grid, dx, gridOriginX1, gridOriginX2, gridOriginX3, GEO_BOX);
+      UBLOG(logINFO,"Stop discretization of banana box");
+      UBLOG(logINFO,"Start discretization of bananas");
+      discretizeGeoObject(bananas, grid, dx, gridOriginX1, gridOriginX2, gridOriginX3, GEO_BANANAS);
+      UBLOG(logINFO,"Stop discretization of bananas");
+#endif
+
+#ifdef CONVEXHULL
+      UBLOG(logINFO,"Start discretization of bananas");
+      discretizeGeoObject(bananas, grid, dx, gridOriginX1, gridOriginX2, gridOriginX3, GEO_BANANAS, GEO_FLUID, false, true, true, GEO_INVALID, GEO_INVALID);
+      UBLOG(logINFO,"Stop discretization of bananas");
+      UBLOG(logINFO,"Start discretization of hull");
+      discretizeGeoObject(bananasHull, grid, dx, gridOriginX1, gridOriginX2, gridOriginX3, GEO_FLUID_IN_HULL, GEO_FLUID, true, false, true, GEO_BANANAS, GEO_INVALID);
+      UBLOG(logINFO,"Stop discretization of hull");
+      UBLOG(logINFO,"Start creation of hull film");
+      createHull(grid);
+      UBLOG(logINFO,"Stop creation of hull film");
+      UBLOG(logINFO,"Start discretization of banana box");
+      discretizeGeoObject(bananaBox, grid, dx, gridOriginX1, gridOriginX2, gridOriginX3, GEO_BOX, GEO_FLUID, false, true, true, GEO_INVALID, GEO_INVALID);
+      UBLOG(logINFO,"Stop discretization of banana box");
+#endif
+
+      UBLOG(logINFO,"Start discretization of add walls");
+      discretizeGeoObject(addWall1, grid, dx, gridOriginX1, gridOriginX2, gridOriginX3, GEO_BOX, GEO_FLUID, false, true, true, GEO_INVALID, GEO_INVALID);
+      discretizeGeoObject(addWall2, grid, dx, gridOriginX1, gridOriginX2, gridOriginX3, GEO_BOX, GEO_FLUID, false, true, true, GEO_INVALID, GEO_INVALID);
+      discretizeGeoObject(addWall3, grid, dx, gridOriginX1, gridOriginX2, gridOriginX3, GEO_BOX, GEO_FLUID, false, true, true, GEO_INVALID, GEO_INVALID);
+      discretizeGeoObject(addWall4, grid, dx, gridOriginX1, gridOriginX2, gridOriginX3, GEO_BOX, GEO_FLUID, false, true, true, GEO_INVALID, GEO_INVALID);
+      UBLOG(logINFO,"Stop discretization of add walls");
+
+      UBLOG(logINFO,"Start set normals");
+      int boxNX1 = int(bananaBox->getLengthX1() / dx);
+      int boxNX2 = int(bananaBox->getLengthX2() / dx);
+      int boxNX3 = int(bananaBox->getLengthX3() / dx);
+
+      int minX1 = int((bb_minX1 - gridOriginX1) / dx)+1;
+      int minX2 = int((bb_minX2 - gridOriginX2) / dx)+1;
+      int minX3 = int((bb_minX3 - gridOriginX3) / dx)+1;
+
+      int maxX1 = minX1 + boxNX1;
+      int maxX2 = minX2 + boxNX2;
+      int maxX3 = minX3 + boxNX3;
+
+      UBLOG(logINFO,"minX1="<<minX1<<",minX2= "<<minX2<<",minX3="<<minX3);
+      UBLOG(logINFO,"maxX1="<<maxX1<<",maxX2= "<<maxX2<<",maxX3="<<maxX3);
+
+
+      for (int ix3 = 0; ix3 < grid.getNX3(); ix3++)
+         for (int ix2 = 0; ix2 < grid.getNX2(); ix2++)
+            for (int ix1 = 0; ix1 < grid.getNX1(); ix1++)
+            {
+               int temp = grid(ix1, ix2, ix3);
+               setGeoNormal(temp, 0);
+               grid(ix1, ix2, ix3) = temp;
+            }
+
+
+      setNormalsOnBoundary(minX1, minX2, minX3, minX1, maxX2, maxX3, grid, NORMAL_NEG_X1);
+      setNormalsOnBoundary(maxX1, minX2, minX3, maxX1, maxX2, maxX3, grid, NORMAL_POS_X1);
+      setNormalsOnBoundary(minX1, minX2, minX3, maxX1, minX2, maxX3, grid, NORMAL_NEG_X2);
+      setNormalsOnBoundary(minX1, maxX2, minX3, maxX1, maxX2, maxX3, grid, NORMAL_POS_X2);
+      setNormalsOnBoundary(minX1, minX2, minX3, maxX1, maxX2, minX3, grid, NORMAL_NEG_X3);
+      setNormalsOnBoundary(minX1, minX2, maxX3, maxX1, maxX2, maxX3, grid, NORMAL_POS_X3);
+      UBLOG(logINFO,"Stop set normals");
+
+
+      UBLOG(logINFO,"Start write geo matrix");
+      writeMatrixToVtkImageFile(pathname + "/geo_matrix.vtk", grid, dx, gridOriginX1, gridOriginX2, gridOriginX3);
+      UBLOG(logINFO,"Stop write geo matrix");
+   }
+   catch(std::exception& e)
+   {
+      cerr << e.what() << endl << flush;
+   }
+   catch(std::string& s)
+   {
+      cerr << s << endl;
+   }
+   catch(...)
+   {
+      cerr << "unknown exception" << endl;
+   }
+
+}
+int main(int argc, char* argv[])
+{
+
+   run(argv[1]);
+
+   return 0;
+}
+
diff --git a/apps/cpu/band/CMakeLists.txt b/apps/cpu/band/CMakeLists.txt
index d8eeb0e810acde26f45352d4e7d8e066a4427de7..12ce29ac441f5652e41994663e749bed70bca181 100644
--- a/apps/cpu/band/CMakeLists.txt
+++ b/apps/cpu/band/CMakeLists.txt
@@ -1,25 +1,25 @@
-CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
-
-########################################################
-## C++ PROJECT                                       ###
-########################################################
-PROJECT(band)
-
-INCLUDE(${SOURCE_ROOT}/lib/IncludsList.txt) 
-
-#################################################################
-###   LOCAL FILES                                             ###
-#################################################################
-FILE(GLOB SPECIFIC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.h
-                         ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
-                         ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp  )
- 
-SET(ALL_SOURCES ${ALL_SOURCES} ${SPECIFIC_FILES})
-SOURCE_GROUP(src FILES ${SPECIFIC_FILES})
-  
-SET(CAB_ADDITIONAL_LINK_LIBRARIES vfluids)
-
-#################################################################
-###   CREATE PROJECT                                          ###
-#################################################################
-CREATE_CAB_PROJECT(band BINARY)
+CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
+
+########################################################
+## C++ PROJECT                                       ###
+########################################################
+PROJECT(band)
+
+INCLUDE(${SOURCE_ROOT}/lib/IncludsList.txt) 
+
+#################################################################
+###   LOCAL FILES                                             ###
+#################################################################
+FILE(GLOB SPECIFIC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.h
+                         ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
+                         ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp  )
+ 
+SET(ALL_SOURCES ${ALL_SOURCES} ${SPECIFIC_FILES})
+SOURCE_GROUP(src FILES ${SPECIFIC_FILES})
+  
+SET(CAB_ADDITIONAL_LINK_LIBRARIES vfluids)
+
+#################################################################
+###   CREATE PROJECT                                          ###
+#################################################################
+CREATE_CAB_PROJECT(band BINARY)
diff --git a/apps/cpu/band/band.cpp b/apps/cpu/band/band.cpp
index 4424b62595741c9479cff83eea138a7cbcbbb290..ed3103ef6b5ab8854b4b2244f01f08776a069b9a 100644
--- a/apps/cpu/band/band.cpp
+++ b/apps/cpu/band/band.cpp
@@ -1,582 +1,582 @@
-#include <iostream>
-#include <string>
-#include <math.h> 
-
-#include <vfluids.h>
-
-using namespace std;
-
-void run(const char *cstr)
-{
-   try
-   {
-      string pathname; 
-      string pathGeo;
-      string pathLog;
-      int numOfThreads = 1;
-      bool logfile = false;
-      stringstream logFilename;
-      double availMem = 0;
-
-      //UbLog::reportingLevel() = logDEBUG5;
-
-      CommunicatorPtr comm = MPICommunicator::getInstance();
-      int myid = comm->getProcessID();
-
-      string machine = string(cstr);
-
-      if(machine == "my") 
-      {
-         pathname = "d:/temp/band";
-         pathGeo = "d:/Data/plate";
-         pathLog = "d:/temp/band";
-         numOfThreads = 6;
-         logfile = false;
-         availMem = 16.0e9;
-      }
-      else if(machine == "Ludwig")      
-      {
-         pathname = "/work/koskuche/SFB880/band";
-         pathGeo = "/home/koskuche/data/plate";
-         pathLog = "/work/koskuche/SFB880/band";
-         numOfThreads = 1;
-         availMem = 12.0e9;
-         logfile = true;
-      }
-      else if(machine == "Hermit")      
-      {
-         //Hermit
-         pathname = "/univ_1/ws1/ws/xrmkuchr-plate3-0";
-         pathGeo = "/zhome/academic/HLRS/xrm/xrmkuchr/data/plate";
-         pathLog = "/zhome/academic/HLRS/xrm/xrmkuchr/work/plate";
-         numOfThreads = 16;
-         availMem = 2.0e9;
-         logfile = true;
-      }
-      else throw UbException(UB_EXARGS, "unknown CAB_MACHINE");
-
-#if defined(__unix__)
-      if (myid==0) 
-      {
-         const char* str = pathLog.c_str();
-         int status=mkdir(str, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
-      }
-#endif 
-
-      if(myid == 0 && logfile)
-      {
-         logFilename <<  pathLog + "/logfile"+UbSystem::toString(UbSystem::getTimeStamp())+"_"+UbSystem::toString(myid)+".txt";
-         UbLog::output_policy::setStream(logFilename.str());
-      }
-
-      if(myid==0) UBLOG(logINFO,"Testcase band");
-
-      //string PlatteFilename = pathGeo + "/Platte4mesh_1.8mmProbendicke22.stl";
-      //string PlatteFilename = pathGeo + "/platte_raw.stl";
-      //string PlatteFilename = pathGeo + "/plate.stl";
-      string PlatteFilename = pathGeo + "/Platte_bearbeitet2.stl";
-
-      string ZckbndFilename = pathGeo + "/2zackenbaender0.stl";
-
-      ///////////////Knotenabmessungen:
-      int nx[3], blocknx[3];
-      nx[0]      = 10;//240;//120;//60;//86;//43;//65;//50;  //länge
-      nx[1]      = 1;//2;//6;///1;//5;// //breite
-      nx[2]      = 2;//64;//32;//18;//5;//15;//15; //höhe gebiet
-      blocknx[0] = 10;//10;//6;
-      blocknx[1] = 10;//10;//6;
-      blocknx[2] = 10;//10;//6;
-
-      int baseLevel   = 0;
-      int refineLevel = 0;
-
-      double H = 0.6; // Kanalhöhe [mm]
-      //double cdx = H/blocknx[2];
-      double cdx = 0.0390625;
-      double fdx = cdx/double(1<<refineLevel);
-
-      //double h = 200.0; // gewünschte Plattenhöhe in Gitterpunkten
-      //double fdx = plate->getLengthX3()/h;
-      //double cdx = fdx*double(1<<refineLevel);
-
-      LBMUnitConverterPtr unitConverter = LBMUnitConverterPtr(new LBMUnitConverter());
-
-      //////////////////////////////////////////////////////////////////////////
-      //physik
-      //////////////////////////////////////////////////////////////////////////
-      double Re            = 680; 
-      double rhoLB         = 0.0;
-      double uLB           = 0.1; 
-      double lReal         = 0.6; //Zackenhöhe in mm
-      double nuLB          = (uLB*(lReal/cdx))/Re;
-
-      Grid3DPtr grid(new Grid3D(comm));
-
-      //////////////////////////////////////////////////////////////////////////
-      //restart
-      UbSchedulerPtr rSch(new UbScheduler(10,10,10000000));
-      RestartPostprocessor rp(grid, rSch, comm, pathname, RestartPostprocessor::BINARY);
-      //////////////////////////////////////////////////////////////////////////
-
-      if (grid->getTimeStep() == 0)
-      {
-
-         if(myid==0) UBLOG(logINFO,"Neustart..");
-
-         //////////////////////////////////////////////////////////////////////////
-         //Platte
-         GbTriFaceMesh3DPtr plate (GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(PlatteFilename,"Netz"));
-         //plate->rotate(180.0,0.0,0.0);  //TriFacMesh-KO-System anders als LB-KO-System
-         //plate->rotate(90.0,0.0,0.0);  //TriFacMesh-KO-System anders als LB-KO-System
-         if(myid == 0) GbSystem3D::writeGeoObject( plate.get(), pathname+"/geo/platte", WbWriterVtkXmlBinary::getInstance() );
-         //////////////////////////////////////////////////////////////////////////
-         // Zackenband
-         //////////////////////////////////////////////////////////////////////////
-         GbTriFaceMesh3DPtr meshBand1 (GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "NetzBand"));
-         meshBand1->translate(-995, -203, -20.35);
-         //meshBand1->scale(1.0, 1.0, 2.0);
-         meshBand1->rotate(0.0, -0.5, 0.0);
-         if(myid == 0) GbSystem3D::writeGeoObject( meshBand1.get(), pathname+"/geo/Band1", WbWriterVtkXmlASCII::getInstance() );
-         //// Zackenband2
-         //GbTriFaceMesh3DPtr meshBand2(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "NetzBand2"));
-         //meshBand2->translate(-995, -208, -20.35); 
-         //meshBand2->rotate(0.0, -0.5, 0.0);
-         //if(myid == 0) GbSystem3D::writeGeoObject( meshBand2.get(), pathname+"/geo/Band2", WbWriterVtkXmlASCII::getInstance() );
-
-         //GbTriFaceMesh3DPtr meshBand1 (GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "NetzBand"));
-         //meshBand1->translate(-496, -700, -20.106);
-         //if(myid == 0) GbSystem3D::writeGeoObject( meshBand1.get(), pathname+"/geo/Band1", WbWriterVtkXmlASCII::getInstance() );
-         // Zackenband2
-         //GbTriFaceMesh3DPtr meshBand2(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "NetzBand2"));
-         //meshBand2->translate(-496, -705, -20.106); 
-         //if(myid == 0) GbSystem3D::writeGeoObject( meshBand2.get(), pathname+"/geo/Band2", WbWriterVtkXmlASCII::getInstance() );
-         // Zackenband3
-         //GbTriFaceMesh3DPtr meshBand3(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "NetzBand3"));
-         //meshBand3->translate(-496, -700, -19.806); 
-         //if(myid == 0) GbSystem3D::writeGeoObject( meshBand3.get(), pathname+"/geo/Band3", WbWriterVtkXmlASCII::getInstance() );
-         //// Zackenband4
-         //GbTriFaceMesh3DPtr meshBand4(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "NetzBand4"));
-         //meshBand4->translate(-496, -705, -19.806); 
-         //if(myid == 0) GbSystem3D::writeGeoObject( meshBand4.get(), pathname+"/geo/Band4", WbWriterVtkXmlASCII::getInstance() );
-         //////////////////////////////////////////////////////////////////////////
-
-
-         string pmFilename  = pathGeo + "/CT-2014-039.raw";
-         int pmNX1=1333;  //abmessung einzelbild in x-richtung
-         int pmNX2=463; //abmessung einzelbild in y richtung
-         int pmNX3=1333; //anzahl der bilder
-         float lthreshold = 27686.97;
-         float uthreshold = 65535.0;
-
-         GbVoxelMatrix3DPtr pmMesh(new GbVoxelMatrix3D(pmNX1,pmNX2,pmNX3,0,lthreshold,uthreshold));
-         pmMesh->readMatrixFromRawFile<unsigned short>(pmFilename, GbVoxelMatrix3D::LittleEndian);
-
-         double scaleFactor = 0.001;
-         double delta = 3.75*scaleFactor;
-         pmMesh->setVoxelMatrixDelta(delta, delta, delta);
-         pmMesh->rotate90aroundX(); 
-         pmMesh->rotate90aroundX();
-         pmMesh->rotate90aroundX();
-
-         GbCuboid3DPtr inlayBox(new GbCuboid3D(pmMesh->getX1Minimum(), pmMesh->getX2Minimum(), pmMesh->getX3Minimum(), 
-                                pmMesh->getX1Maximum(), pmMesh->getX2Maximum(), pmMesh->getX3Maximum()));
-         if(myid == 0) GbSystem3D::writeGeoObject(inlayBox.get(), pathname+"/geo/inlay", WbWriterVtkXmlASCII::getInstance());
-
-
-         double blockLengthx1 = blocknx[0]*cdx; //geowerte
-         double blockLengthx2 = blockLengthx1;
-         double blockLengthx3 = blockLengthx1;
-
-         double geoLength[]   = {  nx[0]*blockLengthx1, nx[1]*blockLengthx2, nx[2]*blockLengthx3}; 
-
-         //double originX1 = plate->getX1Maximum()-30.0;//meshBand1->getX1Minimum()-10.0;
-         //double originX2 = plate->getX2Minimum()+191.0;
-         //double originX3 = plate->getX3Maximum()-1.7;//meshBand1->getX3Minimum();//-2.0;
-         double originX1 = pmMesh->getX1Minimum()-5.0;//meshBand1->getX1Minimum()-10.0;
-         double originX2 = pmMesh->getX2Minimum()-1.0;
-         double originX3 = pmMesh->getX3Minimum()-5.0;//meshBand1->getX3Minimum();//-2.0;
-
-
-         bool periodicx1 = false;
-         bool periodicx2 = true;
-         bool periodicx3 = false;
-
-         //bounding box
-         double g_minX1 = originX1-cdx;
-         double g_minX2 = originX2;
-         double g_minX3 = originX3;
-
-         //double g_maxX1 = originX1+20.0;//meshBand1->getX1Maximum()+40.0;
-         //double g_maxX2 = originX2+5.0;//meshBand1->getX2Minimum()-0.6;
-         //double g_maxX3 = plate->getX3Maximum()+7.0;//meshBand1->getX3Maximum()+10.0;
-
-         double g_maxX1 = pmMesh->getX1Maximum()+5.0-cdx;
-         double g_maxX2 = pmMesh->getX2Maximum()+1.0;
-         double g_maxX3 = pmMesh->getX3Maximum()+5.0;
-
-
-         //set grid
-         grid->setDeltaX(cdx);
-         grid->setBlockNX(blocknx[0], blocknx[1], blocknx[2]);
-         grid->setPeriodicX1(periodicx1);
-         grid->setPeriodicX2(periodicx2);
-         grid->setPeriodicX3(periodicx3);
-
-
-         GbObject3DPtr gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
-         //gridCube->setCenterCoordinates(gridCube->getX1Centroid(),meshBand1->getX2Centroid(),gridCube->getX3Centroid());
-         if(myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), pathname+"/geo/gridCube", WbWriterVtkXmlASCII::getInstance());
-
-         GenBlocksGridVisitor genBlocks(gridCube);
-         grid->accept(genBlocks);
-
-         //////////////////////////////////////////////////////////////////////////
-         if(myid == 0)
-         {
-            UBLOG(logINFO, "*****************************************");
-            UBLOG(logINFO, "* Parameters                            *");
-            UBLOG(logINFO, "* Re            ="<<Re);
-            UBLOG(logINFO, "* nuLB          ="<<nuLB);
-            UBLOG(logINFO, "* uLB           ="<<uLB);
-            UBLOG(logINFO, "* cdx           ="<<cdx);
-            UBLOG(logINFO, "* fdx           ="<<fdx);
-            UBLOG(logINFO, "* nx1/2/3       ="<<nx[0]<<"/"<<nx[1]<<"/"<<nx[2]);
-            UBLOG(logINFO, "* blocknx1/2/3  ="<<blocknx[0]<<"/"<<blocknx[1]<<"/"<<blocknx[2]);
-            UBLOG(logINFO, "* x1Periodic    ="<<periodicx1);
-            UBLOG(logINFO, "* x2Periodic    ="<<periodicx2);
-            UBLOG(logINFO, "* x3Periodic    ="<<periodicx3);
-            UBLOG(logINFO, "* number of levels  ="<<refineLevel+1);
-            UBLOG(logINFO, "* path          ="<<pathname);
-
-            UBLOG(logINFO, "*****************************************");
-            UBLOG(logINFO, "* number of threads    ="<<numOfThreads);
-            UBLOG(logINFO, "* number of processes  ="<<comm->getNumberOfProcesses());
-            UBLOG(logINFO, "*****************************************");
-            UBLOG(logINFO, "*****************************************");     
-         }
-         //////////////////////////////////////////////////////////////////////////
-
-
-         //////////////////////////////////////////////////////////////////////////
-         //refinement
-         GbCuboid3DPtr refinePlatteBox(new GbCuboid3D(plate->getX1Minimum(), plate->getX2Minimum(), plate->getX3Minimum()+(plate->getX3Maximum()-plate->getX3Minimum())/2.0, 
-            plate->getX1Maximum(), plate->getX2Maximum(), plate->getX3Maximum()));
-         if(myid == 0) GbSystem3D::writeGeoObject( refinePlatteBox.get(), pathname+"/geo/refinePlatteBox", WbWriterVtkXmlASCII::getInstance() );
-
-         if (refineLevel > 0)
-         {
-            if(myid == 0) UBLOG(logINFO,"Refinement - start");	
-            RefineCrossAndInsideGbObjectHelper refineHelper(grid, refineLevel);
-            refineHelper.addGbObject(refinePlatteBox, refineLevel);
-            refineHelper.refine();
-            if(myid == 0) UBLOG(logINFO,"Refinement - end");	
-         }
-
-         /////////////////////////////////////////////////
-         ///interactoren
-         int bbOption1 = 1; //0=simple Bounce Back, 1=quadr. BB
-         D3Q27BoundaryConditionAdapterPtr bcObst(new D3Q27NoSlipBCAdapter(bbOption1));
-         D3Q27TriFaceMeshInteractorPtr triPlateInteractor( new D3Q27TriFaceMeshInteractor(plate, grid, bcObst,Interactor3D::SOLID));
-         D3Q27TriFaceMeshInteractorPtr triBand1Interactor( new D3Q27TriFaceMeshInteractor( meshBand1, grid, bcObst,Interactor3D::SOLID, Interactor3D::POINTS) );
-         //D3Q27TriFaceMeshInteractorPtr triBand2Interactor( new D3Q27TriFaceMeshInteractor( meshBand2, grid, bcObst,Interactor3D::SOLID, Interactor3D::POINTS) );
-         //D3Q27TriFaceMeshInteractorPtr triBand3Interactor( new D3Q27TriFaceMeshInteractor( meshBand3, grid, bcObst,Interactor3D::SOLID, Interactor3D::POINTS) );
-         //D3Q27TriFaceMeshInteractorPtr triBand4Interactor( new D3Q27TriFaceMeshInteractor( meshBand4, grid, bcObst,Interactor3D::SOLID, Interactor3D::POINTS) );
-
-         //walls
-         GbCuboid3DPtr addWallZmin (new GbCuboid3D(g_minX1-blockLengthx1-cdx, g_minX2-blockLengthx1, g_minX3-blockLengthx1, g_maxX1+blockLengthx1-cdx, g_maxX2+blockLengthx1, g_minX3));
-         if(myid == 0) GbSystem3D::writeGeoObject(addWallZmin.get(), pathname+"/geo/addWallZmin", WbWriterVtkXmlASCII::getInstance());
-
-         GbCuboid3DPtr addWallZmax (new GbCuboid3D(g_minX1-blockLengthx1-cdx, g_minX2-blockLengthx1, g_maxX3, g_maxX1+blockLengthx1-cdx, g_maxX2+blockLengthx1, g_maxX3+blockLengthx1));
-         if(myid == 0) GbSystem3D::writeGeoObject(addWallZmax.get(), pathname+"/geo/addWallZmax", WbWriterVtkXmlASCII::getInstance());
-
-         //walls
-         int bbOption = 1; //0=simple Bounce Back, 1=quadr. BB
-         D3Q27BoundaryConditionAdapterPtr noSlip(new D3Q27NoSlipBCAdapter(bbOption));
-         D3Q27InteractorPtr addWallZminExInt(new D3Q27Interactor(addWallZmin, grid, noSlip,Interactor3D::SOLID));
-         D3Q27InteractorPtr addWallZmaxExInt(new D3Q27Interactor(addWallZmax, grid, noSlip,Interactor3D::SOLID));
-
-         D3Q27BoundaryConditionAdapterPtr slip(new D3Q27SlipBCAdapter(bbOption));
-         D3Q27InteractorPtr addWallZminInt(new D3Q27Interactor(addWallZmin, grid, slip,Interactor3D::SOLID));
-         D3Q27InteractorPtr addWallZmaxInt(new D3Q27Interactor(addWallZmax, grid, slip,Interactor3D::SOLID));
-
-         //porouse medium
-         int bbOptionPM = 2; //quadratic bounce back with for thin walls
-         D3Q27BoundaryConditionAdapterPtr noSlipPM(new D3Q27NoSlipBCAdapter(bbOptionPM));
-         D3Q27InteractorPtr pmMeshInt(new D3Q27Interactor(pmMesh, grid, noSlipPM,Interactor3D::SOLID));
-         
-         //inflow
-         GbCuboid3DPtr velBCCuboid(new GbCuboid3D(g_minX1-blockLengthx1, g_minX2-blockLengthx1, g_minX3-blockLengthx1, 
-            g_minX1, g_maxX2+blockLengthx1, g_maxX3+blockLengthx1));
-         if(myid == 0) GbSystem3D::writeGeoObject(velBCCuboid.get(), pathname+"/geo/velBCCuboid", WbWriterVtkXmlASCII::getInstance());
-         D3Q27InteractorPtr velBCInteractor(new D3Q27Interactor(velBCCuboid,grid,Interactor3D::SOLID)); 
-
-         //inflow
-         double raiseVelSteps = 0;
-         vector<D3Q27BCFunction> velcX1BCs,dummy;
-
-         mu::Parser inflowProfile;
-         inflowProfile.SetExpr("uLB"); 
-         inflowProfile.DefineConst("uLB",uLB);
-         velcX1BCs.push_back(D3Q27BCFunction(inflowProfile,raiseVelSteps,D3Q27BCFunction::INFCONST));
-
-         D3Q27BoundaryConditionAdapterPtr velBCAdapter(new D3Q27VelocityBCAdapter (velcX1BCs,dummy,dummy));
-         velBCInteractor->addBCAdapter(velBCAdapter);
-
-         //outflow
-         GbCuboid3DPtr densCuboid(new GbCuboid3D(g_maxX1, g_minX2-blockLengthx1, g_minX3-blockLengthx1, 
-            g_maxX1+blockLengthx1, g_maxX2+blockLengthx1, g_maxX3+blockLengthx1 ));
-         if(myid == 0) GbSystem3D::writeGeoObject(densCuboid.get(), pathname+"/geo/densCuboid", WbWriterVtkXmlASCII::getInstance());
-         D3Q27BoundaryConditionAdapterPtr denBCAdapter(new D3Q27DensityBCAdapter(rhoLB));
-         D3Q27InteractorPtr densInteractor( new D3Q27Interactor(densCuboid,grid,denBCAdapter,Interactor3D::SOLID) );
-
-         ////////////////////////////////////////////
-         //METIS
-         Grid3DVisitorPtr metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B));	
-
-         ////////////////////////////////////////////
-         /////delete solid blocks
-         if(myid == 0) UBLOG(logINFO,"deleteSolidBlocks - start");
-         InteractorsHelper intHelper(grid, metisVisitor);
-         //intHelper.addInteractor(triPlateInteractor);
-         //intHelper.addInteractor(triBand1Interactor);
-         //intHelper.addInteractor(triBand2Interactor);
-         //intHelper.addInteractor(triBand3Interactor);
-         //intHelper.addInteractor(triBand4Interactor);
-         //intHelper.addInteractor(addWallZminExInt);
-         //intHelper.addInteractor(addWallZmaxExInt);
-         intHelper.addInteractor(pmMeshInt);
-         intHelper.addInteractor(addWallZminInt);
-         intHelper.addInteractor(addWallZmaxInt);
-         intHelper.addInteractor(densInteractor);
-         intHelper.addInteractor(velBCInteractor);
-         intHelper.selectBlocks();
-         if(myid == 0) UBLOG(logINFO,"deleteSolidBlocks - end");	 
-         //////////////////////////////////////
-
-         //domain decomposition for threads
-         if(numOfThreads > 1)
-         {
-            PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
-            grid->accept(pqPartVisitor);
-         }
-
-         if(myid == 0)
-         {
-            UBLOG(logINFO,"Write blocks - start");
-            BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm));
-            ppblocks->update(0);
-            UBLOG(logINFO,"Write blocks - end");
-         }
-
-         unsigned long nob = grid->getNumberOfBlocks();
-         unsigned long nod = nob * blocknx[0]*blocknx[1]*blocknx[2];
-         unsigned long nod_real = nob * (blocknx[0]+3)*(blocknx[1]+3)*(blocknx[2]+3);
-
-         double needMemAll  = double(nod_real*(27*sizeof(double) + sizeof(int)));
-         double needMem  = needMemAll / double(comm->getNumberOfProcesses());
-
-         if(myid == 0)
-         {
-            UBLOG(logINFO,"Number of blocks = " << nob);
-            UBLOG(logINFO,"Number of nodes  = " << nod);
-            UBLOG(logINFO,"Necessary memory  = " << needMemAll  << " bytes");
-            UBLOG(logINFO,"Necessary memory per process = " << needMem  << " bytes");
-            UBLOG(logINFO,"Available memory per process = " << availMem << " bytes");
-            UBLOG(logINFO,"Available memory per node/8.0 = " << (availMem/8.0) << " bytes");
-         }
-
-         //////////////////////////////////////////
-         //set connectors
-         UBLOG(logINFO,"set connectors - start");
-         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
-         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
-         grid->accept( setConnsVisitor );
-         UBLOG(logINFO,"set connectors - end");
-
-         ////////////////////////////
-         LBMKernel3DPtr kernel;
-         kernel = LBMKernel3DPtr(new LBMKernelETD3Q27CCLB(blocknx[0], blocknx[1], blocknx[2], LBMKernelETD3Q27CCLB::NORMAL));
-
-         //with sponge layer
-         //kernel = LBMKernel3DPtr(new LBMKernelETD3Q27CCLBWithSpongeLayer(blocknx[0], blocknx[1], blocknx[2], LBMKernelETD3Q27CCLB::NORMAL));
-         int sizeSP=4;
-         mu::Parser spongeLayer;
-         spongeLayer.SetExpr("x1>=(sizeX-sizeSP)/dx ? (sizeX-(x1+1))/sizeSP/2.0 + 0.5 : 1.0");
-         spongeLayer.DefineConst("sizeX", nx[0]*blocknx[0]);
-         spongeLayer.DefineConst("sizeSP", sizeSP*blocknx[0]);
-         kernel->setWithSpongeLayer(true);
-         kernel->setSpongeLayer(spongeLayer);
-
-         //BCProcessorPtr bcProc(new D3Q27ETBCProcessor());
-         BCProcessorPtr bcProc(new D3Q27ETForThinWallBCProcessor());
-         kernel->setBCProcessor(bcProc);
-         SetKernelBlockVisitor kernelVisitor(kernel, nuLB, availMem, needMem);
-         grid->accept(kernelVisitor);
-         //////////////////////////////////
-         //undef nodes
-         if (refineLevel > 0)
-         {
-            D3Q27SetUndefinedNodesBlockVisitor undefNodesVisitor;
-            grid->accept(undefNodesVisitor);
-         }
-
-
-         intHelper.setBC();
-
-         //////////////////////////////////////////////////////////////////////////
-         ////porous inlay
-         //string pmFilename  = pathGeo + "/CT-2014-039.raw";
-         //int pmNX1=1333;  //abmessung einzelbild in x-richtung
-         //int pmNX2=463; //abmessung einzelbild in y richtung
-         //int pmNX3=1333; //anzahl der bilder
-         //float lthreshold = 27686.97;
-         //float uthreshold = 65535.0;
-
-         //GbVoxelMatrix3DPtr pmMesh(new GbVoxelMatrix3D(pmNX1,pmNX2,pmNX3,0,lthreshold,uthreshold));
-         //pmMesh->readMatrixFromRawFile<unsigned short>(pmFilename);
-
-         //double scaleFactor = 0.001;
-         //double delta = 3.75*scaleFactor;
-         //pmMesh->setVoxelMatrixDelta(delta, delta, delta);
-         //pmMesh->rotate90aroundX(); 
-         //pmMesh->rotate90aroundX();
-         //pmMesh->rotate90aroundX();
-
-         //double inlayXmin = 995.0;
-         //double inlayYmin = 180.0;
-         //double inlayZmin = 8.73;
-
-         //GbCuboid3DPtr inlayBox(new GbCuboid3D(inlayXmin, inlayYmin, inlayZmin, inlayXmin+(double)75, inlayYmin+(double)35, inlayZmin));
-         //if(myid == 0) GbSystem3D::writeGeoObject(inlayBox.get(), pathname+"/geo/inlay"+UbSystem::toString(i), WbWriterVtkXmlASCII::getInstance());
-         //D3Q27InteractorPtr inlayBoxInt = D3Q27InteractorPtr ( new D3Q27Interactor(inlayBox, grid, bcObst,Interactor3D::SOLID));
-         //SetSolidOrTransBlockVisitor v(inlayBoxInt, SetSolidOrTransBlockVisitor::SOLID);
-         //grid->accept(v);
-         //SetSolidOrTransBlockVisitor v(inlayBoxInt, SetSolidOrTransBlockVisitor::TRANS);
-         //grid->accept(v);
-
-         //vector<Block3DPtr> inlayBlocks;
-         //vector<Block3DPtr>& sb = inlayBoxInt->getSolidBlockSet();
-         //inlayBlocks.insert(inlayBlocks.end(), sb.begin(), sb.end());
-         //vector<Block3DPtr>& tb = inlayBoxInt->getTransBlockSet();
-         //inlayBlocks.insert(inlayBlocks.end(), tb.begin(), tb.end());
-
-
-         //int i = 0;
-         //for (int y = 0; y<=35; y+=5)
-         //   for (int x = 0; x<=75; x+=5)
-         //   {
-         //      UBLOG(logINFO,"inlay # "<<i);
-         //      GbVoxelMatrix3DPtr pmM = GbVoxelMatrix3DPtr(pmMesh->clone());
-         //      pmM->setVoxelMatrixDelta(delta, delta, delta);
-         //      pmM->setVoxelMatrixMininum(inlayXmin-(double)x, inlayYmin+(double)y, inlayZmin);
-         //      D3Q27InteractorPtr inlayInt = D3Q27InteractorPtr ( new D3Q27Interactor(pmM, grid, bcObst,Interactor3D::SOLID));
-         //      SetSolidOrTransBlockVisitor v(inlayInt, SetSolidOrTransBlockVisitor::TRANS);
-         //      grid->accept(v);
-         //      inlayInt->initInteractor();
-
-         //      GbCuboid3DPtr inlayBox(new GbCuboid3D(pmM->getX1Minimum(),pmM->getX2Minimum(),pmM->getX3Minimum(),pmM->getX1Maximum(),pmM->getX2Maximum(),pmM->getX3Maximum()));
-         //      if(myid == 0) GbSystem3D::writeGeoObject(inlayBox.get(), pathname+"/geo/inlay"+UbSystem::toString(i), WbWriterVtkXmlASCII::getInstance());
-         //      D3Q27InteractorPtr inlayBoxInt = D3Q27InteractorPtr ( new D3Q27Interactor(inlayBox, grid, bcObst,Interactor3D::SOLID));
-         //      SetSolidOrTransBlockVisitor v1(inlayBoxInt, SetSolidOrTransBlockVisitor::SOLID);
-         //      grid->accept(v1);
-         //      SetSolidOrTransBlockVisitor v2(inlayBoxInt, SetSolidOrTransBlockVisitor::TRANS);
-         //      grid->accept(v2);
-
-         //      vector<Block3DPtr> inlayBlocks;
-         //      vector<Block3DPtr>& sb = inlayBoxInt->getSolidBlockSet();
-         //      //UBLOG(logINFO, "sb.size = "<<sb.size());
-         //      inlayBlocks.insert(inlayBlocks.end(), sb.begin(), sb.end());
-         //      vector<Block3DPtr>& tb = inlayBoxInt->getTransBlockSet();
-         //      //UBLOG(logINFO, "tb.size = "<<tb.size());
-         //      inlayBlocks.insert(inlayBlocks.end(), tb.begin(), tb.end());
-
-         //      //UBLOG(logINFO, "inlayBlocks.size = "<<inlayBlocks.size());
-
-         //      BOOST_FOREACH(Block3DPtr block, inlayBlocks)
-         //      {
-         //         block->setActive(true);
-         //         inlayInt->setDifferencesToGbObject3D(block);
-         //      }
-         //      i++;
-         //   }
-         //////////////////////////////////////////////////////////////////////
-
-         //initialization of decompositions
-         D3Q27ETInitDistributionsBlockVisitor initVisitor( nuLB,rhoLB);
-         initVisitor.setVx1(uLB);
-         grid->accept(initVisitor);
-
-         //Postprozess
-         UbSchedulerPtr geoSch(new UbScheduler(1));
-         D3Q27MacroscopicQuantitiesPostprocessorPtr ppgeo(
-            new D3Q27MacroscopicQuantitiesPostprocessor(grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), 
-            unitConverter, true));
-         ppgeo->update(0);
-         ppgeo.reset();
-         geoSch.reset();
-
-         if(myid == 0) UBLOG(logINFO,"Preprozess - end");      
-      }
-      else
-      {
-         //set connectors
-         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
-         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
-         grid->accept( setConnsVisitor );
-         if(myid == 0) UBLOG(logINFO,"Restart - end"); 
-      }
-      UbSchedulerPtr visSch(new UbScheduler());
-      //visSch->addSchedule(1,0,3);
-      //visSch->addSchedule(100,100,1000);
-      //visSch->addSchedule(1000,1000,5000);
-      //visSch->addSchedule(5000,5000,100000);
-      //visSch->addSchedule(100000,100000,10000000);
-
-      visSch->addSchedule(100,100,10000000);
-
-      D3Q27MacroscopicQuantitiesPostprocessor pp(grid, visSch, pathname, WbWriterVtkXmlBinary::getInstance(), unitConverter);
-
-      UbSchedulerPtr nupsSch(new UbScheduler(10, 10, 30));
-      NUPSCounterPostprocessor npr(grid, nupsSch, numOfThreads, comm);
-
-      if(myid == 0)
-      {
-         UBLOG(logINFO,"PID = " << myid << " Total Physical Memory (RAM): " << Utilities::getTotalPhysMem());
-         UBLOG(logINFO,"PID = " << myid << " Physical Memory currently used: " << Utilities::getPhysMemUsed());
-         UBLOG(logINFO,"PID = " << myid << " Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe());
-      }
-
-      double endTime = 10000000;
-      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, visSch));
-      if(myid == 0) UBLOG(logINFO,"Simulation-start");
-      calculation->calculate();
-      if(myid == 0) UBLOG(logINFO,"Simulation-end");
-   }
-   catch(std::exception& e)
-   {
-      cerr << e.what() << endl << flush;
-   }
-   catch(std::string& s)
-   {
-      cerr << s << endl;
-   }
-   catch(...)
-   {
-      cerr << "unknown exception" << endl;
-   }
-
-}
-//////////////////////////////////////////////////////////////////////////
-int main(int argc, char* argv[])
-{
-   if (argc == 1)
-   {
-      cout<<"Command line argument isn't specified!"<<endl;
-      cout<<"plate2 <machine name>"<<endl;
-      return 1;
-   }
-   run(argv[1]);
-
-   return 0;
-}
-
+#include <iostream>
+#include <string>
+#include <math.h> 
+
+#include <vfluids.h>
+
+using namespace std;
+
+void run(const char *cstr)
+{
+   try
+   {
+      string pathname; 
+      string pathGeo;
+      string pathLog;
+      int numOfThreads = 1;
+      bool logfile = false;
+      stringstream logFilename;
+      double availMem = 0;
+
+      //UbLog::reportingLevel() = logDEBUG5;
+
+      CommunicatorPtr comm = MPICommunicator::getInstance();
+      int myid = comm->getProcessID();
+
+      string machine = string(cstr);
+
+      if(machine == "my") 
+      {
+         pathname = "d:/temp/band";
+         pathGeo = "d:/Data/plate";
+         pathLog = "d:/temp/band";
+         numOfThreads = 6;
+         logfile = false;
+         availMem = 16.0e9;
+      }
+      else if(machine == "Ludwig")      
+      {
+         pathname = "/work/koskuche/SFB880/band";
+         pathGeo = "/home/koskuche/data/plate";
+         pathLog = "/work/koskuche/SFB880/band";
+         numOfThreads = 1;
+         availMem = 12.0e9;
+         logfile = true;
+      }
+      else if(machine == "Hermit")      
+      {
+         //Hermit
+         pathname = "/univ_1/ws1/ws/xrmkuchr-plate3-0";
+         pathGeo = "/zhome/academic/HLRS/xrm/xrmkuchr/data/plate";
+         pathLog = "/zhome/academic/HLRS/xrm/xrmkuchr/work/plate";
+         numOfThreads = 16;
+         availMem = 2.0e9;
+         logfile = true;
+      }
+      else throw UbException(UB_EXARGS, "unknown CAB_MACHINE");
+
+#if defined(__unix__)
+      if (myid==0) 
+      {
+         const char* str = pathLog.c_str();
+         int status=mkdir(str, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
+      }
+#endif 
+
+      if(myid == 0 && logfile)
+      {
+         logFilename <<  pathLog + "/logfile"+UbSystem::toString(UbSystem::getTimeStamp())+"_"+UbSystem::toString(myid)+".txt";
+         UbLog::output_policy::setStream(logFilename.str());
+      }
+
+      if(myid==0) UBLOG(logINFO,"Testcase band");
+
+      //string PlatteFilename = pathGeo + "/Platte4mesh_1.8mmProbendicke22.stl";
+      //string PlatteFilename = pathGeo + "/platte_raw.stl";
+      //string PlatteFilename = pathGeo + "/plate.stl";
+      string PlatteFilename = pathGeo + "/Platte_bearbeitet2.stl";
+
+      string ZckbndFilename = pathGeo + "/2zackenbaender0.stl";
+
+      ///////////////Knotenabmessungen:
+      int nx[3], blocknx[3];
+      nx[0]      = 10;//240;//120;//60;//86;//43;//65;//50;  //länge
+      nx[1]      = 1;//2;//6;///1;//5;// //breite
+      nx[2]      = 2;//64;//32;//18;//5;//15;//15; //höhe gebiet
+      blocknx[0] = 10;//10;//6;
+      blocknx[1] = 10;//10;//6;
+      blocknx[2] = 10;//10;//6;
+
+      int baseLevel   = 0;
+      int refineLevel = 0;
+
+      double H = 0.6; // Kanalhöhe [mm]
+      //double cdx = H/blocknx[2];
+      double cdx = 0.0390625;
+      double fdx = cdx/double(1<<refineLevel);
+
+      //double h = 200.0; // gewünschte Plattenhöhe in Gitterpunkten
+      //double fdx = plate->getLengthX3()/h;
+      //double cdx = fdx*double(1<<refineLevel);
+
+      LBMUnitConverterPtr unitConverter = LBMUnitConverterPtr(new LBMUnitConverter());
+
+      //////////////////////////////////////////////////////////////////////////
+      //physik
+      //////////////////////////////////////////////////////////////////////////
+      double Re            = 680; 
+      double rhoLB         = 0.0;
+      double uLB           = 0.1; 
+      double lReal         = 0.6; //Zackenhöhe in mm
+      double nuLB          = (uLB*(lReal/cdx))/Re;
+
+      Grid3DPtr grid(new Grid3D(comm));
+
+      //////////////////////////////////////////////////////////////////////////
+      //restart
+      UbSchedulerPtr rSch(new UbScheduler(10,10,10000000));
+      RestartPostprocessor rp(grid, rSch, comm, pathname, RestartPostprocessor::BINARY);
+      //////////////////////////////////////////////////////////////////////////
+
+      if (grid->getTimeStep() == 0)
+      {
+
+         if(myid==0) UBLOG(logINFO,"Neustart..");
+
+         //////////////////////////////////////////////////////////////////////////
+         //Platte
+         GbTriFaceMesh3DPtr plate (GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(PlatteFilename,"Netz"));
+         //plate->rotate(180.0,0.0,0.0);  //TriFacMesh-KO-System anders als LB-KO-System
+         //plate->rotate(90.0,0.0,0.0);  //TriFacMesh-KO-System anders als LB-KO-System
+         if(myid == 0) GbSystem3D::writeGeoObject( plate.get(), pathname+"/geo/platte", WbWriterVtkXmlBinary::getInstance() );
+         //////////////////////////////////////////////////////////////////////////
+         // Zackenband
+         //////////////////////////////////////////////////////////////////////////
+         GbTriFaceMesh3DPtr meshBand1 (GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "NetzBand"));
+         meshBand1->translate(-995, -203, -20.35);
+         //meshBand1->scale(1.0, 1.0, 2.0);
+         meshBand1->rotate(0.0, -0.5, 0.0);
+         if(myid == 0) GbSystem3D::writeGeoObject( meshBand1.get(), pathname+"/geo/Band1", WbWriterVtkXmlASCII::getInstance() );
+         //// Zackenband2
+         //GbTriFaceMesh3DPtr meshBand2(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "NetzBand2"));
+         //meshBand2->translate(-995, -208, -20.35); 
+         //meshBand2->rotate(0.0, -0.5, 0.0);
+         //if(myid == 0) GbSystem3D::writeGeoObject( meshBand2.get(), pathname+"/geo/Band2", WbWriterVtkXmlASCII::getInstance() );
+
+         //GbTriFaceMesh3DPtr meshBand1 (GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "NetzBand"));
+         //meshBand1->translate(-496, -700, -20.106);
+         //if(myid == 0) GbSystem3D::writeGeoObject( meshBand1.get(), pathname+"/geo/Band1", WbWriterVtkXmlASCII::getInstance() );
+         // Zackenband2
+         //GbTriFaceMesh3DPtr meshBand2(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "NetzBand2"));
+         //meshBand2->translate(-496, -705, -20.106); 
+         //if(myid == 0) GbSystem3D::writeGeoObject( meshBand2.get(), pathname+"/geo/Band2", WbWriterVtkXmlASCII::getInstance() );
+         // Zackenband3
+         //GbTriFaceMesh3DPtr meshBand3(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "NetzBand3"));
+         //meshBand3->translate(-496, -700, -19.806); 
+         //if(myid == 0) GbSystem3D::writeGeoObject( meshBand3.get(), pathname+"/geo/Band3", WbWriterVtkXmlASCII::getInstance() );
+         //// Zackenband4
+         //GbTriFaceMesh3DPtr meshBand4(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "NetzBand4"));
+         //meshBand4->translate(-496, -705, -19.806); 
+         //if(myid == 0) GbSystem3D::writeGeoObject( meshBand4.get(), pathname+"/geo/Band4", WbWriterVtkXmlASCII::getInstance() );
+         //////////////////////////////////////////////////////////////////////////
+
+
+         string pmFilename  = pathGeo + "/CT-2014-039.raw";
+         int pmNX1=1333;  //abmessung einzelbild in x-richtung
+         int pmNX2=463; //abmessung einzelbild in y richtung
+         int pmNX3=1333; //anzahl der bilder
+         float lthreshold = 27686.97;
+         float uthreshold = 65535.0;
+
+         GbVoxelMatrix3DPtr pmMesh(new GbVoxelMatrix3D(pmNX1,pmNX2,pmNX3,0,lthreshold,uthreshold));
+         pmMesh->readMatrixFromRawFile<unsigned short>(pmFilename, GbVoxelMatrix3D::LittleEndian);
+
+         double scaleFactor = 0.001;
+         double delta = 3.75*scaleFactor;
+         pmMesh->setVoxelMatrixDelta(delta, delta, delta);
+         pmMesh->rotate90aroundX(); 
+         pmMesh->rotate90aroundX();
+         pmMesh->rotate90aroundX();
+
+         GbCuboid3DPtr inlayBox(new GbCuboid3D(pmMesh->getX1Minimum(), pmMesh->getX2Minimum(), pmMesh->getX3Minimum(), 
+                                pmMesh->getX1Maximum(), pmMesh->getX2Maximum(), pmMesh->getX3Maximum()));
+         if(myid == 0) GbSystem3D::writeGeoObject(inlayBox.get(), pathname+"/geo/inlay", WbWriterVtkXmlASCII::getInstance());
+
+
+         double blockLengthx1 = blocknx[0]*cdx; //geowerte
+         double blockLengthx2 = blockLengthx1;
+         double blockLengthx3 = blockLengthx1;
+
+         double geoLength[]   = {  nx[0]*blockLengthx1, nx[1]*blockLengthx2, nx[2]*blockLengthx3}; 
+
+         //double originX1 = plate->getX1Maximum()-30.0;//meshBand1->getX1Minimum()-10.0;
+         //double originX2 = plate->getX2Minimum()+191.0;
+         //double originX3 = plate->getX3Maximum()-1.7;//meshBand1->getX3Minimum();//-2.0;
+         double originX1 = pmMesh->getX1Minimum()-5.0;//meshBand1->getX1Minimum()-10.0;
+         double originX2 = pmMesh->getX2Minimum()-1.0;
+         double originX3 = pmMesh->getX3Minimum()-5.0;//meshBand1->getX3Minimum();//-2.0;
+
+
+         bool periodicx1 = false;
+         bool periodicx2 = true;
+         bool periodicx3 = false;
+
+         //bounding box
+         double g_minX1 = originX1-cdx;
+         double g_minX2 = originX2;
+         double g_minX3 = originX3;
+
+         //double g_maxX1 = originX1+20.0;//meshBand1->getX1Maximum()+40.0;
+         //double g_maxX2 = originX2+5.0;//meshBand1->getX2Minimum()-0.6;
+         //double g_maxX3 = plate->getX3Maximum()+7.0;//meshBand1->getX3Maximum()+10.0;
+
+         double g_maxX1 = pmMesh->getX1Maximum()+5.0-cdx;
+         double g_maxX2 = pmMesh->getX2Maximum()+1.0;
+         double g_maxX3 = pmMesh->getX3Maximum()+5.0;
+
+
+         //set grid
+         grid->setDeltaX(cdx);
+         grid->setBlockNX(blocknx[0], blocknx[1], blocknx[2]);
+         grid->setPeriodicX1(periodicx1);
+         grid->setPeriodicX2(periodicx2);
+         grid->setPeriodicX3(periodicx3);
+
+
+         GbObject3DPtr gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
+         //gridCube->setCenterCoordinates(gridCube->getX1Centroid(),meshBand1->getX2Centroid(),gridCube->getX3Centroid());
+         if(myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), pathname+"/geo/gridCube", WbWriterVtkXmlASCII::getInstance());
+
+         GenBlocksGridVisitor genBlocks(gridCube);
+         grid->accept(genBlocks);
+
+         //////////////////////////////////////////////////////////////////////////
+         if(myid == 0)
+         {
+            UBLOG(logINFO, "*****************************************");
+            UBLOG(logINFO, "* Parameters                            *");
+            UBLOG(logINFO, "* Re            ="<<Re);
+            UBLOG(logINFO, "* nuLB          ="<<nuLB);
+            UBLOG(logINFO, "* uLB           ="<<uLB);
+            UBLOG(logINFO, "* cdx           ="<<cdx);
+            UBLOG(logINFO, "* fdx           ="<<fdx);
+            UBLOG(logINFO, "* nx1/2/3       ="<<nx[0]<<"/"<<nx[1]<<"/"<<nx[2]);
+            UBLOG(logINFO, "* blocknx1/2/3  ="<<blocknx[0]<<"/"<<blocknx[1]<<"/"<<blocknx[2]);
+            UBLOG(logINFO, "* x1Periodic    ="<<periodicx1);
+            UBLOG(logINFO, "* x2Periodic    ="<<periodicx2);
+            UBLOG(logINFO, "* x3Periodic    ="<<periodicx3);
+            UBLOG(logINFO, "* number of levels  ="<<refineLevel+1);
+            UBLOG(logINFO, "* path          ="<<pathname);
+
+            UBLOG(logINFO, "*****************************************");
+            UBLOG(logINFO, "* number of threads    ="<<numOfThreads);
+            UBLOG(logINFO, "* number of processes  ="<<comm->getNumberOfProcesses());
+            UBLOG(logINFO, "*****************************************");
+            UBLOG(logINFO, "*****************************************");     
+         }
+         //////////////////////////////////////////////////////////////////////////
+
+
+         //////////////////////////////////////////////////////////////////////////
+         //refinement
+         GbCuboid3DPtr refinePlatteBox(new GbCuboid3D(plate->getX1Minimum(), plate->getX2Minimum(), plate->getX3Minimum()+(plate->getX3Maximum()-plate->getX3Minimum())/2.0, 
+            plate->getX1Maximum(), plate->getX2Maximum(), plate->getX3Maximum()));
+         if(myid == 0) GbSystem3D::writeGeoObject( refinePlatteBox.get(), pathname+"/geo/refinePlatteBox", WbWriterVtkXmlASCII::getInstance() );
+
+         if (refineLevel > 0)
+         {
+            if(myid == 0) UBLOG(logINFO,"Refinement - start");	
+            RefineCrossAndInsideGbObjectHelper refineHelper(grid, refineLevel);
+            refineHelper.addGbObject(refinePlatteBox, refineLevel);
+            refineHelper.refine();
+            if(myid == 0) UBLOG(logINFO,"Refinement - end");	
+         }
+
+         /////////////////////////////////////////////////
+         ///interactoren
+         int bbOption1 = 1; //0=simple Bounce Back, 1=quadr. BB
+         D3Q27BoundaryConditionAdapterPtr bcObst(new D3Q27NoSlipBCAdapter(bbOption1));
+         D3Q27TriFaceMeshInteractorPtr triPlateInteractor( new D3Q27TriFaceMeshInteractor(plate, grid, bcObst,Interactor3D::SOLID));
+         D3Q27TriFaceMeshInteractorPtr triBand1Interactor( new D3Q27TriFaceMeshInteractor( meshBand1, grid, bcObst,Interactor3D::SOLID, Interactor3D::POINTS) );
+         //D3Q27TriFaceMeshInteractorPtr triBand2Interactor( new D3Q27TriFaceMeshInteractor( meshBand2, grid, bcObst,Interactor3D::SOLID, Interactor3D::POINTS) );
+         //D3Q27TriFaceMeshInteractorPtr triBand3Interactor( new D3Q27TriFaceMeshInteractor( meshBand3, grid, bcObst,Interactor3D::SOLID, Interactor3D::POINTS) );
+         //D3Q27TriFaceMeshInteractorPtr triBand4Interactor( new D3Q27TriFaceMeshInteractor( meshBand4, grid, bcObst,Interactor3D::SOLID, Interactor3D::POINTS) );
+
+         //walls
+         GbCuboid3DPtr addWallZmin (new GbCuboid3D(g_minX1-blockLengthx1-cdx, g_minX2-blockLengthx1, g_minX3-blockLengthx1, g_maxX1+blockLengthx1-cdx, g_maxX2+blockLengthx1, g_minX3));
+         if(myid == 0) GbSystem3D::writeGeoObject(addWallZmin.get(), pathname+"/geo/addWallZmin", WbWriterVtkXmlASCII::getInstance());
+
+         GbCuboid3DPtr addWallZmax (new GbCuboid3D(g_minX1-blockLengthx1-cdx, g_minX2-blockLengthx1, g_maxX3, g_maxX1+blockLengthx1-cdx, g_maxX2+blockLengthx1, g_maxX3+blockLengthx1));
+         if(myid == 0) GbSystem3D::writeGeoObject(addWallZmax.get(), pathname+"/geo/addWallZmax", WbWriterVtkXmlASCII::getInstance());
+
+         //walls
+         int bbOption = 1; //0=simple Bounce Back, 1=quadr. BB
+         D3Q27BoundaryConditionAdapterPtr noSlip(new D3Q27NoSlipBCAdapter(bbOption));
+         D3Q27InteractorPtr addWallZminExInt(new D3Q27Interactor(addWallZmin, grid, noSlip,Interactor3D::SOLID));
+         D3Q27InteractorPtr addWallZmaxExInt(new D3Q27Interactor(addWallZmax, grid, noSlip,Interactor3D::SOLID));
+
+         D3Q27BoundaryConditionAdapterPtr slip(new D3Q27SlipBCAdapter(bbOption));
+         D3Q27InteractorPtr addWallZminInt(new D3Q27Interactor(addWallZmin, grid, slip,Interactor3D::SOLID));
+         D3Q27InteractorPtr addWallZmaxInt(new D3Q27Interactor(addWallZmax, grid, slip,Interactor3D::SOLID));
+
+         //porouse medium
+         int bbOptionPM = 2; //quadratic bounce back with for thin walls
+         D3Q27BoundaryConditionAdapterPtr noSlipPM(new D3Q27NoSlipBCAdapter(bbOptionPM));
+         D3Q27InteractorPtr pmMeshInt(new D3Q27Interactor(pmMesh, grid, noSlipPM,Interactor3D::SOLID));
+         
+         //inflow
+         GbCuboid3DPtr velBCCuboid(new GbCuboid3D(g_minX1-blockLengthx1, g_minX2-blockLengthx1, g_minX3-blockLengthx1, 
+            g_minX1, g_maxX2+blockLengthx1, g_maxX3+blockLengthx1));
+         if(myid == 0) GbSystem3D::writeGeoObject(velBCCuboid.get(), pathname+"/geo/velBCCuboid", WbWriterVtkXmlASCII::getInstance());
+         D3Q27InteractorPtr velBCInteractor(new D3Q27Interactor(velBCCuboid,grid,Interactor3D::SOLID)); 
+
+         //inflow
+         double raiseVelSteps = 0;
+         vector<D3Q27BCFunction> velcX1BCs,dummy;
+
+         mu::Parser inflowProfile;
+         inflowProfile.SetExpr("uLB"); 
+         inflowProfile.DefineConst("uLB",uLB);
+         velcX1BCs.push_back(D3Q27BCFunction(inflowProfile,raiseVelSteps,D3Q27BCFunction::INFCONST));
+
+         D3Q27BoundaryConditionAdapterPtr velBCAdapter(new D3Q27VelocityBCAdapter (velcX1BCs,dummy,dummy));
+         velBCInteractor->addBCAdapter(velBCAdapter);
+
+         //outflow
+         GbCuboid3DPtr densCuboid(new GbCuboid3D(g_maxX1, g_minX2-blockLengthx1, g_minX3-blockLengthx1, 
+            g_maxX1+blockLengthx1, g_maxX2+blockLengthx1, g_maxX3+blockLengthx1 ));
+         if(myid == 0) GbSystem3D::writeGeoObject(densCuboid.get(), pathname+"/geo/densCuboid", WbWriterVtkXmlASCII::getInstance());
+         D3Q27BoundaryConditionAdapterPtr denBCAdapter(new D3Q27DensityBCAdapter(rhoLB));
+         D3Q27InteractorPtr densInteractor( new D3Q27Interactor(densCuboid,grid,denBCAdapter,Interactor3D::SOLID) );
+
+         ////////////////////////////////////////////
+         //METIS
+         Grid3DVisitorPtr metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B));	
+
+         ////////////////////////////////////////////
+         /////delete solid blocks
+         if(myid == 0) UBLOG(logINFO,"deleteSolidBlocks - start");
+         InteractorsHelper intHelper(grid, metisVisitor);
+         //intHelper.addInteractor(triPlateInteractor);
+         //intHelper.addInteractor(triBand1Interactor);
+         //intHelper.addInteractor(triBand2Interactor);
+         //intHelper.addInteractor(triBand3Interactor);
+         //intHelper.addInteractor(triBand4Interactor);
+         //intHelper.addInteractor(addWallZminExInt);
+         //intHelper.addInteractor(addWallZmaxExInt);
+         intHelper.addInteractor(pmMeshInt);
+         intHelper.addInteractor(addWallZminInt);
+         intHelper.addInteractor(addWallZmaxInt);
+         intHelper.addInteractor(densInteractor);
+         intHelper.addInteractor(velBCInteractor);
+         intHelper.selectBlocks();
+         if(myid == 0) UBLOG(logINFO,"deleteSolidBlocks - end");	 
+         //////////////////////////////////////
+
+         //domain decomposition for threads
+         if(numOfThreads > 1)
+         {
+            PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
+            grid->accept(pqPartVisitor);
+         }
+
+         if(myid == 0)
+         {
+            UBLOG(logINFO,"Write blocks - start");
+            BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm));
+            ppblocks->update(0);
+            UBLOG(logINFO,"Write blocks - end");
+         }
+
+         unsigned long nob = grid->getNumberOfBlocks();
+         unsigned long nod = nob * blocknx[0]*blocknx[1]*blocknx[2];
+         unsigned long nod_real = nob * (blocknx[0]+3)*(blocknx[1]+3)*(blocknx[2]+3);
+
+         double needMemAll  = double(nod_real*(27*sizeof(double) + sizeof(int)));
+         double needMem  = needMemAll / double(comm->getNumberOfProcesses());
+
+         if(myid == 0)
+         {
+            UBLOG(logINFO,"Number of blocks = " << nob);
+            UBLOG(logINFO,"Number of nodes  = " << nod);
+            UBLOG(logINFO,"Necessary memory  = " << needMemAll  << " bytes");
+            UBLOG(logINFO,"Necessary memory per process = " << needMem  << " bytes");
+            UBLOG(logINFO,"Available memory per process = " << availMem << " bytes");
+            UBLOG(logINFO,"Available memory per node/8.0 = " << (availMem/8.0) << " bytes");
+         }
+
+         //////////////////////////////////////////
+         //set connectors
+         UBLOG(logINFO,"set connectors - start");
+         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
+         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
+         grid->accept( setConnsVisitor );
+         UBLOG(logINFO,"set connectors - end");
+
+         ////////////////////////////
+         LBMKernel3DPtr kernel;
+         kernel = LBMKernel3DPtr(new LBMKernelETD3Q27CCLB(blocknx[0], blocknx[1], blocknx[2], LBMKernelETD3Q27CCLB::NORMAL));
+
+         //with sponge layer
+         //kernel = LBMKernel3DPtr(new LBMKernelETD3Q27CCLBWithSpongeLayer(blocknx[0], blocknx[1], blocknx[2], LBMKernelETD3Q27CCLB::NORMAL));
+         int sizeSP=4;
+         mu::Parser spongeLayer;
+         spongeLayer.SetExpr("x1>=(sizeX-sizeSP)/dx ? (sizeX-(x1+1))/sizeSP/2.0 + 0.5 : 1.0");
+         spongeLayer.DefineConst("sizeX", nx[0]*blocknx[0]);
+         spongeLayer.DefineConst("sizeSP", sizeSP*blocknx[0]);
+         kernel->setWithSpongeLayer(true);
+         kernel->setSpongeLayer(spongeLayer);
+
+         //BCProcessorPtr bcProc(new D3Q27ETBCProcessor());
+         BCProcessorPtr bcProc(new D3Q27ETForThinWallBCProcessor());
+         kernel->setBCProcessor(bcProc);
+         SetKernelBlockVisitor kernelVisitor(kernel, nuLB, availMem, needMem);
+         grid->accept(kernelVisitor);
+         //////////////////////////////////
+         //undef nodes
+         if (refineLevel > 0)
+         {
+            D3Q27SetUndefinedNodesBlockVisitor undefNodesVisitor;
+            grid->accept(undefNodesVisitor);
+         }
+
+
+         intHelper.setBC();
+
+         //////////////////////////////////////////////////////////////////////////
+         ////porous inlay
+         //string pmFilename  = pathGeo + "/CT-2014-039.raw";
+         //int pmNX1=1333;  //abmessung einzelbild in x-richtung
+         //int pmNX2=463; //abmessung einzelbild in y richtung
+         //int pmNX3=1333; //anzahl der bilder
+         //float lthreshold = 27686.97;
+         //float uthreshold = 65535.0;
+
+         //GbVoxelMatrix3DPtr pmMesh(new GbVoxelMatrix3D(pmNX1,pmNX2,pmNX3,0,lthreshold,uthreshold));
+         //pmMesh->readMatrixFromRawFile<unsigned short>(pmFilename);
+
+         //double scaleFactor = 0.001;
+         //double delta = 3.75*scaleFactor;
+         //pmMesh->setVoxelMatrixDelta(delta, delta, delta);
+         //pmMesh->rotate90aroundX(); 
+         //pmMesh->rotate90aroundX();
+         //pmMesh->rotate90aroundX();
+
+         //double inlayXmin = 995.0;
+         //double inlayYmin = 180.0;
+         //double inlayZmin = 8.73;
+
+         //GbCuboid3DPtr inlayBox(new GbCuboid3D(inlayXmin, inlayYmin, inlayZmin, inlayXmin+(double)75, inlayYmin+(double)35, inlayZmin));
+         //if(myid == 0) GbSystem3D::writeGeoObject(inlayBox.get(), pathname+"/geo/inlay"+UbSystem::toString(i), WbWriterVtkXmlASCII::getInstance());
+         //D3Q27InteractorPtr inlayBoxInt = D3Q27InteractorPtr ( new D3Q27Interactor(inlayBox, grid, bcObst,Interactor3D::SOLID));
+         //SetSolidOrTransBlockVisitor v(inlayBoxInt, SetSolidOrTransBlockVisitor::SOLID);
+         //grid->accept(v);
+         //SetSolidOrTransBlockVisitor v(inlayBoxInt, SetSolidOrTransBlockVisitor::TRANS);
+         //grid->accept(v);
+
+         //vector<Block3DPtr> inlayBlocks;
+         //vector<Block3DPtr>& sb = inlayBoxInt->getSolidBlockSet();
+         //inlayBlocks.insert(inlayBlocks.end(), sb.begin(), sb.end());
+         //vector<Block3DPtr>& tb = inlayBoxInt->getTransBlockSet();
+         //inlayBlocks.insert(inlayBlocks.end(), tb.begin(), tb.end());
+
+
+         //int i = 0;
+         //for (int y = 0; y<=35; y+=5)
+         //   for (int x = 0; x<=75; x+=5)
+         //   {
+         //      UBLOG(logINFO,"inlay # "<<i);
+         //      GbVoxelMatrix3DPtr pmM = GbVoxelMatrix3DPtr(pmMesh->clone());
+         //      pmM->setVoxelMatrixDelta(delta, delta, delta);
+         //      pmM->setVoxelMatrixMininum(inlayXmin-(double)x, inlayYmin+(double)y, inlayZmin);
+         //      D3Q27InteractorPtr inlayInt = D3Q27InteractorPtr ( new D3Q27Interactor(pmM, grid, bcObst,Interactor3D::SOLID));
+         //      SetSolidOrTransBlockVisitor v(inlayInt, SetSolidOrTransBlockVisitor::TRANS);
+         //      grid->accept(v);
+         //      inlayInt->initInteractor();
+
+         //      GbCuboid3DPtr inlayBox(new GbCuboid3D(pmM->getX1Minimum(),pmM->getX2Minimum(),pmM->getX3Minimum(),pmM->getX1Maximum(),pmM->getX2Maximum(),pmM->getX3Maximum()));
+         //      if(myid == 0) GbSystem3D::writeGeoObject(inlayBox.get(), pathname+"/geo/inlay"+UbSystem::toString(i), WbWriterVtkXmlASCII::getInstance());
+         //      D3Q27InteractorPtr inlayBoxInt = D3Q27InteractorPtr ( new D3Q27Interactor(inlayBox, grid, bcObst,Interactor3D::SOLID));
+         //      SetSolidOrTransBlockVisitor v1(inlayBoxInt, SetSolidOrTransBlockVisitor::SOLID);
+         //      grid->accept(v1);
+         //      SetSolidOrTransBlockVisitor v2(inlayBoxInt, SetSolidOrTransBlockVisitor::TRANS);
+         //      grid->accept(v2);
+
+         //      vector<Block3DPtr> inlayBlocks;
+         //      vector<Block3DPtr>& sb = inlayBoxInt->getSolidBlockSet();
+         //      //UBLOG(logINFO, "sb.size = "<<sb.size());
+         //      inlayBlocks.insert(inlayBlocks.end(), sb.begin(), sb.end());
+         //      vector<Block3DPtr>& tb = inlayBoxInt->getTransBlockSet();
+         //      //UBLOG(logINFO, "tb.size = "<<tb.size());
+         //      inlayBlocks.insert(inlayBlocks.end(), tb.begin(), tb.end());
+
+         //      //UBLOG(logINFO, "inlayBlocks.size = "<<inlayBlocks.size());
+
+         //      BOOST_FOREACH(Block3DPtr block, inlayBlocks)
+         //      {
+         //         block->setActive(true);
+         //         inlayInt->setDifferencesToGbObject3D(block);
+         //      }
+         //      i++;
+         //   }
+         //////////////////////////////////////////////////////////////////////
+
+         //initialization of decompositions
+         D3Q27ETInitDistributionsBlockVisitor initVisitor( nuLB,rhoLB);
+         initVisitor.setVx1(uLB);
+         grid->accept(initVisitor);
+
+         //Postprozess
+         UbSchedulerPtr geoSch(new UbScheduler(1));
+         D3Q27MacroscopicQuantitiesPostprocessorPtr ppgeo(
+            new D3Q27MacroscopicQuantitiesPostprocessor(grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), 
+            unitConverter, true));
+         ppgeo->update(0);
+         ppgeo.reset();
+         geoSch.reset();
+
+         if(myid == 0) UBLOG(logINFO,"Preprozess - end");      
+      }
+      else
+      {
+         //set connectors
+         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
+         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
+         grid->accept( setConnsVisitor );
+         if(myid == 0) UBLOG(logINFO,"Restart - end"); 
+      }
+      UbSchedulerPtr visSch(new UbScheduler());
+      //visSch->addSchedule(1,0,3);
+      //visSch->addSchedule(100,100,1000);
+      //visSch->addSchedule(1000,1000,5000);
+      //visSch->addSchedule(5000,5000,100000);
+      //visSch->addSchedule(100000,100000,10000000);
+
+      visSch->addSchedule(100,100,10000000);
+
+      D3Q27MacroscopicQuantitiesPostprocessor pp(grid, visSch, pathname, WbWriterVtkXmlBinary::getInstance(), unitConverter);
+
+      UbSchedulerPtr nupsSch(new UbScheduler(10, 10, 30));
+      NUPSCounterPostprocessor npr(grid, nupsSch, numOfThreads, comm);
+
+      if(myid == 0)
+      {
+         UBLOG(logINFO,"PID = " << myid << " Total Physical Memory (RAM): " << Utilities::getTotalPhysMem());
+         UBLOG(logINFO,"PID = " << myid << " Physical Memory currently used: " << Utilities::getPhysMemUsed());
+         UBLOG(logINFO,"PID = " << myid << " Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe());
+      }
+
+      double endTime = 10000000;
+      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, visSch));
+      if(myid == 0) UBLOG(logINFO,"Simulation-start");
+      calculation->calculate();
+      if(myid == 0) UBLOG(logINFO,"Simulation-end");
+   }
+   catch(std::exception& e)
+   {
+      cerr << e.what() << endl << flush;
+   }
+   catch(std::string& s)
+   {
+      cerr << s << endl;
+   }
+   catch(...)
+   {
+      cerr << "unknown exception" << endl;
+   }
+
+}
+//////////////////////////////////////////////////////////////////////////
+int main(int argc, char* argv[])
+{
+   if (argc == 1)
+   {
+      cout<<"Command line argument isn't specified!"<<endl;
+      cout<<"plate2 <machine name>"<<endl;
+      return 1;
+   }
+   run(argv[1]);
+
+   return 0;
+}
+
diff --git a/apps/cpu/bbone/CMakeLists.txt b/apps/cpu/bbone/CMakeLists.txt
index 607daeb54917ea99811cf3c25082b151ec4567a8..42a14bfafe227eae31150ee23d24d9c37622e501 100644
--- a/apps/cpu/bbone/CMakeLists.txt
+++ b/apps/cpu/bbone/CMakeLists.txt
@@ -1,25 +1,25 @@
-CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
-
-########################################################
-## C++ PROJECT                                       ###
-########################################################
-PROJECT(bbone)
-
-INCLUDE(${SOURCE_ROOT}/lib/IncludsList.txt) 
-
-#################################################################
-###   LOCAL FILES                                             ###
-#################################################################
-FILE(GLOB SPECIFIC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.h
-                         ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
-                         ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp  )
- 
-SET(ALL_SOURCES ${ALL_SOURCES} ${SPECIFIC_FILES})
-SOURCE_GROUP(src FILES ${SPECIFIC_FILES})
-  
-SET(CAB_ADDITIONAL_LINK_LIBRARIES vfluids)
-
-#################################################################
-###   CREATE PROJECT                                          ###
-#################################################################
-CREATE_CAB_PROJECT(bbone BINARY)
+CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
+
+########################################################
+## C++ PROJECT                                       ###
+########################################################
+PROJECT(bbone)
+
+INCLUDE(${SOURCE_ROOT}/lib/IncludsList.txt) 
+
+#################################################################
+###   LOCAL FILES                                             ###
+#################################################################
+FILE(GLOB SPECIFIC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.h
+                         ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
+                         ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp  )
+ 
+SET(ALL_SOURCES ${ALL_SOURCES} ${SPECIFIC_FILES})
+SOURCE_GROUP(src FILES ${SPECIFIC_FILES})
+  
+SET(CAB_ADDITIONAL_LINK_LIBRARIES vfluids)
+
+#################################################################
+###   CREATE PROJECT                                          ###
+#################################################################
+CREATE_CAB_PROJECT(bbone BINARY)
diff --git a/apps/cpu/bbone/bbone.cpp b/apps/cpu/bbone/bbone.cpp
index 5f24304eac06d9b6976ebcb65f76606d7b178940..30a2b28c32e78f65b4c79d185b302e83e38e8579 100644
--- a/apps/cpu/bbone/bbone.cpp
+++ b/apps/cpu/bbone/bbone.cpp
@@ -1,427 +1,427 @@
-#include <iostream>
-#include <string>
-
-#include <vfluids.h>
-
-using namespace std;
-
-
-void sbonepd(string configname)
-{
-   try
-   {
-      Configuration   config;
-      config.load(configname);
-
-      string          pathname          = config.getString("pathname");
-      string          pathGeo           = config.getString("pathGeo");
-      int             numOfThreads      = config.getInt("numOfThreads");
-      string          sampleFilename    = config.getString("sampleFilename");
-      int             pmNX1             = config.getInt("pmNX1");
-      int             pmNX2             = config.getInt("pmNX2");
-      int             pmNX3             = config.getInt("pmNX3");
-      double          lthreshold        = config.getDouble("lthreshold");
-      double          uthreshold        = config.getDouble("uthreshold");
-      double          dp_real           = config.getDouble("dp_real");
-      string          timeSeriesFile    = config.getString("timeSeriesFile");
-      double          restartStep       = config.getDouble("restartStep");
-      double          restartStepStart  = config.getDouble("restartStepStart");
-      double          endTime           = config.getDouble("endTime");
-      double          outTime           = config.getDouble("outTime");
-      double          availMem          = config.getDouble("availMem");
-      double          timeSeriesOutTime = config.getDouble("timeSeriesOutTime");
-      bool            logToFile         = config.getBool("logToFile");
-      double          deltaT            = config.getDouble("deltaT");
-      
-      CommunicatorPtr comm = MPICommunicator::getInstance();
-      int myid = comm->getProcessID();
-
-      if (logToFile)
-      {
-#if defined(__unix__)
-         if (myid == 0)
-         {
-            const char* str = pathname.c_str();
-            int status = mkdir(str, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
-         }
-#endif 
-
-         if (myid == 0)
-         {
-            stringstream logFilename;
-            logFilename << pathname + "/logfile" + UbSystem::toString(UbSystem::getTimeStamp()) + ".txt";
-            UbLog::output_policy::setStream(logFilename.str());
-         }
-      }
-
-
-
-      if (myid == 0) UBLOG(logINFO, "Testcase big bone");
-
-      Grid3DPtr grid(new Grid3D(comm));
-      double deltaVoxel = 11.658e-6;
-
-      double dx = deltaVoxel;
-
-      const int blocknx1 = 64;
-      const int blocknx2 = 64;
-      const int blocknx3 = 64;
-
-      LBMReal rho_LB = 0.0;
-      //nueWasser = 1e-6 m^2/s
-      double nu_real = 1e-6;
-      LBMReal dt = deltaT; //1e-5; // s (frei gewählt)
-      //dx - frei gewählt
-      //
-      LBMReal nu_LB = nu_real / (dx*dx / dt);
-
-
-      //dp = 50000 Pa - 0 Pa = 50000 Pa
-      //rho wasser = 1000 kg*m^-3
-      double rho_real = 1000;
-      //dp/rho = 50000/1000 = 50 m^2/s^2
-      double dp_div_rho_real = dp_real / rho_real;
-
-      double dp_LB = dp_div_rho_real / ((dx / dt)*(dx / dt));
-
-      double rhoLBinflow;
-      rhoLBinflow = dp_LB*3.0;
-     
-      double deltax = dx;
-
-      LBMUnitConverterPtr conv = LBMUnitConverterPtr(new LBMUnitConverter());
-
-      const int baseLevel = 0;
-      const int refineLevel = 0;
-
-      double coord[6];
-
-      //////////////////////////////////////////////////////////////////////////
-      //restart
-      UbSchedulerPtr rSch(new UbScheduler(restartStep, restartStepStart));
-      RestartPostprocessor rp(grid, rSch, comm, pathname, RestartPostprocessor::BINARY);
-      //////////////////////////////////////////////////////////////////////////
-
-      if (grid->getTimeStep() == 0)
-      {
-         if (myid == 0) UBLOG(logINFO, "Neustart..");
-
-         string boneFilename = pathGeo + sampleFilename;
-
-         //int pmNX1 = 1164;  //abmessung einzelbild in x-richtung
-         //int pmNX2 = 972; //abmessung einzelbild in y richtung
-         //int pmNX3 = 900; //anzahl der bilder
-         ////int pmNX3 = 10; //anzahl der bilder
-         //float lthreshold = 109.0;
-         //float uthreshold = 255.0;
-
-         GbVoxelMatrix3DPtr bone(new GbVoxelMatrix3D(pmNX1, pmNX2, pmNX3, 0, lthreshold, uthreshold));
-         bone->readMatrixFromRawFile<unsigned char>(boneFilename, GbVoxelMatrix3D::BigEndian);
-         bone->setVoxelMatrixDelta(deltaVoxel, deltaVoxel, deltaVoxel);
-         bone->setVoxelMatrixMininum(0.0, 0.0, 0.0);
-
-         if (myid == 0) bone->writeToVTKImageDataASCII(pathname + "/geo/bone");
-
-         ///////////////////////////////////////////////////////
-
-         ////////////////////////////////////////////////////////////////////////
-
-         double offset = 0.5e-3;
-         //bounding box
-         double g_minX1 = bone->getX1Minimum();
-         double g_minX2 = bone->getX2Minimum();
-         double g_minX3 = bone->getX3Minimum() - offset;
-
-         double g_maxX1 = bone->getX1Maximum();
-         double g_maxX2 = bone->getX2Maximum();
-         double g_maxX3 = bone->getX3Maximum() + offset;
-
-         double blockLength = (double)blocknx1*deltax;
-
-         grid->setPeriodicX1(false);
-         grid->setPeriodicX2(false);
-         grid->setPeriodicX3(false);
-         grid->setDeltaX(deltax);
-         grid->setBlockNX(blocknx1, blocknx2, blocknx3);
-
-         GbObject3DPtr gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
-         if (myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), pathname + "/geo/gridCube", WbWriterVtkXmlBinary::getInstance());
-
-
-         GenBlocksGridVisitor genBlocks(gridCube);
-         grid->accept(genBlocks);
-
-         if (myid == 0)
-         {
-            UBLOG(logINFO, "Parameters:");
-            UBLOG(logINFO, "rho_LB = " << rho_LB);
-            UBLOG(logINFO, "nu_LB = " << nu_LB);
-            UBLOG(logINFO, "dp_LB = " << dp_LB);
-            UBLOG(logINFO, "dx = " << dx << " m");
-            UBLOG(logINFO, "dt = " << dt << " s");
-            UBLOG(logINFO, "rho_real = " << rho_real << " kg*m^-3");
-            UBLOG(logINFO, "nu_real = " << nu_real << " m^2/s");
-            UBLOG(logINFO, "dp_real = " << dp_real << " Pa");
-
-            UBLOG(logINFO, "number of levels = " << refineLevel + 1);
-            UBLOG(logINFO, "numOfThreads = " << numOfThreads);
-            UBLOG(logINFO, "path = " << pathname);
-            UBLOG(logINFO, "Preprozess - start");
-         }
-
-         //cylinder
-         double radius = 0.0036;
-         double cx1 = 0.007;
-         double cx2 = 0.0046;
-
-         GbObject3DPtr cylinder(new GbCylinder3D(cx1, cx2, g_minX3 - offset, cx1, cx2, g_maxX3 + offset, radius));
-         GbSystem3D::writeGeoObject(cylinder.get(), pathname + "/geo/cylinder", WbWriterVtkXmlBinary::getInstance());
-
-         //inflow
-         GbCuboid3DPtr geoInflow(new GbCuboid3D(g_minX1 - blockLength, g_minX2 - blockLength, g_minX3 - blockLength, g_maxX1 + blockLength, g_maxX2 + blockLength, g_minX3));
-         if (myid == 0) GbSystem3D::writeGeoObject(geoInflow.get(), pathname + "/geo/geoInflow", WbWriterVtkXmlASCII::getInstance());
-
-         //outflow
-         GbCuboid3DPtr geoOutflow(new GbCuboid3D(g_minX1 - blockLength, g_minX2 - blockLength, g_maxX3, g_maxX1 + blockLength, g_maxX2 + blockLength, g_maxX3 + blockLength));
-         if (myid == 0) GbSystem3D::writeGeoObject(geoOutflow.get(), pathname + "/geo/geoOutflow", WbWriterVtkXmlASCII::getInstance());
-
-         BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm));
-
-         //bone interactor
-         int bcOptionBone = 1; //0=simple Bounce Back, 1=quadr. BB, 2=thin wall
-         D3Q27BoundaryConditionAdapterPtr bcBone(new D3Q27NoSlipBCAdapter(bcOptionBone));
-         D3Q27InteractorPtr boneInt(new D3Q27Interactor(bone, grid, bcBone, Interactor3D::SOLID));
-
-         //wall interactors
-         int bcOptionWall = 1; //0=simple Bounce Back, 1=quadr. BB, 2=thin wall
-         D3Q27BoundaryConditionAdapterPtr bcWall(new D3Q27NoSlipBCAdapter(bcOptionWall));
-         D3Q27InteractorPtr cylInt(new D3Q27Interactor(cylinder, grid, bcWall, Interactor3D::INVERSESOLID));
-
-         D3Q27BoundaryConditionAdapterPtr denBCAdapterInflow(new D3Q27DensityBCAdapter(rhoLBinflow));
-         denBCAdapterInflow->setSecondaryBcOption(0);
-         D3Q27InteractorPtr inflowInt = D3Q27InteractorPtr(new D3Q27Interactor(geoInflow, grid, denBCAdapterInflow, Interactor3D::SOLID));
-
-         //outflow
-         D3Q27BoundaryConditionAdapterPtr denBCAdapterOutflow(new D3Q27DensityBCAdapter(rho_LB));
-         denBCAdapterOutflow->setSecondaryBcOption(0);
-         D3Q27InteractorPtr outflowInt = D3Q27InteractorPtr(new D3Q27Interactor(geoOutflow, grid, denBCAdapterOutflow, Interactor3D::SOLID));
-
-         ////////////////////////////////////////////
-         //METIS
-         Grid3DVisitorPtr metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::BSW));
-         ////////////////////////////////////////////
-         //Zoltan
-         //Grid3DVisitorPtr zoltanVisitor(new ZoltanPartitioningGridVisitor(comm, D3Q27System::BSW, 1));
-         //////////////////////////////////////////////////////////////////////////
-         /////delete solid blocks
-         if (myid == 0) UBLOG(logINFO, "deleteSolidBlocks - start");
-         InteractorsHelper intHelper(grid, metisVisitor);
-         intHelper.addInteractor(boneInt);
-         intHelper.addInteractor(cylInt);
-         intHelper.addInteractor(inflowInt);
-         intHelper.addInteractor(outflowInt);
-         intHelper.selectBlocks();
-         if (myid == 0) UBLOG(logINFO, "deleteSolidBlocks - end");
-         //////////////////////////////////////
-
-         //set connectors
-         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
-         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nu_LB, iProcessor);
-         grid->accept(setConnsVisitor);
-
-         //domain decomposition for threads
-         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
-         grid->accept(pqPartVisitor);
-
-         ppblocks->update(0);
-         ppblocks.reset();
-
-         unsigned long nob = grid->getNumberOfBlocks();
-         int gl = 3;
-         unsigned long nodb = (blocknx1)* (blocknx2)* (blocknx3);
-         unsigned long nod = nob * (blocknx1)* (blocknx2)* (blocknx3);
-         unsigned long nodg = nob * (blocknx1 + gl) * (blocknx2 + gl) * (blocknx3 + gl);
-         double needMemAll = double(nodg*(27 * sizeof(double) + sizeof(int) + sizeof(float) * 4));
-         double needMem = needMemAll / double(comm->getNumberOfProcesses());
-
-         if (myid == 0)
-         {
-            UBLOG(logINFO, "Number of blocks = " << nob);
-            UBLOG(logINFO, "Number of nodes  = " << nod);
-            int minInitLevel = grid->getCoarsestInitializedLevel();
-            int maxInitLevel = grid->getFinestInitializedLevel();
-            for (int level = minInitLevel; level <= maxInitLevel; level++)
-            {
-               int nobl = grid->getNumberOfBlocks(level);
-               UBLOG(logINFO, "Number of blocks for level " << level << " = " << nobl);
-               UBLOG(logINFO, "Number of nodes for level " << level << " = " << nobl*nodb);
-            }
-            UBLOG(logINFO, "Necessary memory  = " << needMemAll << " bytes");
-            UBLOG(logINFO, "Necessary memory per process = " << needMem << " bytes");
-            UBLOG(logINFO, "Available memory per process = " << availMem << " bytes");
-         }
-
-         LBMKernel3DPtr kernel = LBMKernel3DPtr(new LBMKernelETD3Q27CCLB(blocknx1, blocknx2, blocknx3, LBMKernelETD3Q27CCLB::NORMAL));
-
-         //BCProcessorPtr bcProc(new D3Q27ETForThinWallBCProcessor());
-         BCProcessorPtr bcProc(new D3Q27ETBCProcessor());
-         BoundaryConditionPtr densityBC(new NonEqDensityBoundaryCondition());
-         BoundaryConditionPtr noSlipBC(new NoSlipBoundaryCondition());
-         bcProc->addBC(densityBC);
-         bcProc->addBC(noSlipBC);
-         kernel->setBCProcessor(bcProc);
-
-         SetKernelBlockVisitor kernelVisitor(kernel, nu_LB, availMem, needMem);
-         grid->accept(kernelVisitor);
-
-         //BC
-         intHelper.setBC();
-
-         BoundaryConditionBlockVisitor bcVisitor;
-         grid->accept(bcVisitor);
-
-         //Press*1.6e8+(14.76-coordsX)/3.5*5000
-         //initialization of distributions
-         mu::Parser fct;
-         fct.SetExpr("(x3max-x3)/l*dp*3.0");
-         fct.DefineConst("dp", dp_LB);
-         fct.DefineConst("x3max", g_maxX3);
-         fct.DefineConst("l", g_maxX3-g_minX3);
-
-         D3Q27ETInitDistributionsBlockVisitor initVisitor(nu_LB, rho_LB);
-         initVisitor.setRho(fct);
-         //initVisitor.setVx1(fct);
-         //initVisitor.setVx1(0.0);
-         grid->accept(initVisitor);
-
-         //Postrozess
-         UbSchedulerPtr geoSch(new UbScheduler(1));
-         D3Q27MacroscopicQuantitiesPostprocessorPtr ppgeo(
-            new D3Q27MacroscopicQuantitiesPostprocessor(grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, true));
-         ppgeo->update(0);
-         ppgeo.reset();
-
-
-         coord[0] = bone->getX1Minimum();
-         coord[1] = bone->getX2Minimum();
-         coord[2] = bone->getX3Minimum();//cylinder->getX3Centroid();
-         coord[3] = bone->getX1Maximum();
-         coord[4] = bone->getX2Maximum();
-         coord[5] = bone->getX3Maximum(); //cylinder->getX3Centroid();
-
-         ////////////////////////////////////////////////////////
-         FILE * pFile;
-         string str = pathname + "/checkpoints/coord.txt";
-         pFile = fopen(str.c_str(), "w");
-         fprintf(pFile, "%g\n", coord[0]);
-         fprintf(pFile, "%g\n", coord[1]);
-         fprintf(pFile, "%g\n", coord[2]);
-         fprintf(pFile, "%g\n", coord[3]);
-         fprintf(pFile, "%g\n", coord[4]);
-         fprintf(pFile, "%g\n", coord[5]);
-         fclose(pFile);
-         ////////////////////////////////////////////////////////
-         grid->addInteractor(inflowInt);
-         if (myid == 0) UBLOG(logINFO, "Preprozess - end");
-      }
-      else
-      {
-         Grid3D::Interactor3DSet interactors = grid->getInteractors();
-         interactors[0]->setGrid3D(grid);
-         boost::dynamic_pointer_cast<D3Q27Interactor>(interactors[0])->deleteBCAdapter();
-         D3Q27BoundaryConditionAdapterPtr denBCAdapterFront(new D3Q27DensityBCAdapter(rhoLBinflow));
-         boost::dynamic_pointer_cast<D3Q27Interactor>(interactors[0])->addBCAdapter(denBCAdapterFront);
-         interactors[0]->updateInteractor();
-
-         UBLOG(logINFO, "rhoLBinflow = "<<rhoLBinflow);
-
-         BoundaryConditionBlockVisitor bcVisitor;
-         grid->accept(bcVisitor);
-
-         //set connectors
-         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
-         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nu_LB, iProcessor);
-         grid->accept(setConnsVisitor);
-
-         ////////////////////////////////////////////////////////
-         FILE * pFile;
-         string str = pathname + "/checkpoints/coord.txt";
-         pFile = fopen(str.c_str(), "r");
-         fscanf(pFile, "%lg\n", &coord[0]);
-         fscanf(pFile, "%lg\n", &coord[1]);
-         fscanf(pFile, "%lg\n", &coord[2]);
-         fscanf(pFile, "%lg\n", &coord[3]);
-         fscanf(pFile, "%lg\n", &coord[4]);
-         fscanf(pFile, "%lg\n", &coord[5]);
-         fclose(pFile);
-         ////////////////////////////////////////////////////////
-
-         if (myid == 0) UBLOG(logINFO, "Restart - end");
-      }
-      UbSchedulerPtr nupsSch(new UbScheduler(10, 30, 100));
-      NUPSCounterPostprocessor npr(grid, nupsSch, numOfThreads, comm);
-
-      UbSchedulerPtr stepSch(new UbScheduler(outTime));
-      //stepSch->addSchedule(10, 10, 10);
-      //stepSch->addSchedule(100, 100, 100);
-      //stepSch->addSchedule(1000, 1000, 1000);
-      //stepSch->addSchedule(100, 1500, 2000);
-      //stepSch->addSchedule(10000, 10000, 10000);
-
-      D3Q27MacroscopicQuantitiesPostprocessor pp(grid, stepSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv);
-
-      double dxd2 = deltax / 2.0;
-      D3Q27IntegrateValuesHelperPtr ih1(new D3Q27IntegrateValuesHelper(grid, comm, coord[0], coord[1], coord[2] - dxd2*10.0,
-         coord[3], coord[4], coord[2] - dxd2*10.0 - 2.0*dxd2));
-      D3Q27IntegrateValuesHelperPtr ih2(new D3Q27IntegrateValuesHelper(grid, comm, coord[0], coord[1], coord[2], coord[3], coord[4], coord[5]));
-      D3Q27IntegrateValuesHelperPtr ih3(new D3Q27IntegrateValuesHelper(grid, comm, coord[0], coord[1], coord[5] + dxd2*10.0,
-         coord[3], coord[4], coord[5] + dxd2*10.0 + 2.0*dxd2));
-
-      if (myid == 0) GbSystem3D::writeGeoObject(ih1->getBoundingBox().get(), pathname + "/geo/ih1", WbWriterVtkXmlBinary::getInstance());
-      if (myid == 0) GbSystem3D::writeGeoObject(ih2->getBoundingBox().get(), pathname + "/geo/ih2", WbWriterVtkXmlBinary::getInstance());
-      if (myid == 0) GbSystem3D::writeGeoObject(ih3->getBoundingBox().get(), pathname + "/geo/ih3", WbWriterVtkXmlBinary::getInstance());
-
-      UbSchedulerPtr stepMV(new UbScheduler(timeSeriesOutTime));
-
-      TimeseriesPostprocessor tsp1(grid, stepMV, ih1, pathname+timeSeriesFile+"_1", comm);
-      TimeseriesPostprocessor tsp2(grid, stepMV, ih2, pathname+timeSeriesFile+"_2", comm);
-      TimeseriesPostprocessor tsp3(grid, stepMV, ih3, pathname+timeSeriesFile+"_3", comm);
-
-      if (myid == 0)
-      {
-         UBLOG(logINFO, "PID = " << myid << " Total Physical Memory (RAM): " << Utilities::getTotalPhysMem());
-         UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used: " << Utilities::getPhysMemUsed());
-         UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe());
-      }
-
-      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, stepMV));
-      if (myid == 0) UBLOG(logINFO, "Simulation-start");
-      calculation->calculate();
-      if (myid == 0) UBLOG(logINFO, "Simulation-end");
-   }
-   catch (exception& e)
-   {
-      cerr << e.what() << endl << flush;
-   }
-   catch (string& s)
-   {
-      cerr << s << endl;
-   }
-   catch (...)
-   {
-      cerr << "unknown exception" << endl;
-   }
-
-}
-//////////////////////////////////////////////////////////////////////////
-int main(int argc, char* argv[])
-{
-
-   if (argv != NULL)
-   {
-      if (argv[1] != NULL)
-         sbonepd(string(argv[1]));
-   }
-
-   return 0;
-}
+#include <iostream>
+#include <string>
+
+#include <vfluids.h>
+
+using namespace std;
+
+
+void sbonepd(string configname)
+{
+   try
+   {
+      Configuration   config;
+      config.load(configname);
+
+      string          pathname          = config.getString("pathname");
+      string          pathGeo           = config.getString("pathGeo");
+      int             numOfThreads      = config.getInt("numOfThreads");
+      string          sampleFilename    = config.getString("sampleFilename");
+      int             pmNX1             = config.getInt("pmNX1");
+      int             pmNX2             = config.getInt("pmNX2");
+      int             pmNX3             = config.getInt("pmNX3");
+      double          lthreshold        = config.getDouble("lthreshold");
+      double          uthreshold        = config.getDouble("uthreshold");
+      double          dp_real           = config.getDouble("dp_real");
+      string          timeSeriesFile    = config.getString("timeSeriesFile");
+      double          restartStep       = config.getDouble("restartStep");
+      double          restartStepStart  = config.getDouble("restartStepStart");
+      double          endTime           = config.getDouble("endTime");
+      double          outTime           = config.getDouble("outTime");
+      double          availMem          = config.getDouble("availMem");
+      double          timeSeriesOutTime = config.getDouble("timeSeriesOutTime");
+      bool            logToFile         = config.getBool("logToFile");
+      double          deltaT            = config.getDouble("deltaT");
+      
+      CommunicatorPtr comm = MPICommunicator::getInstance();
+      int myid = comm->getProcessID();
+
+      if (logToFile)
+      {
+#if defined(__unix__)
+         if (myid == 0)
+         {
+            const char* str = pathname.c_str();
+            int status = mkdir(str, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
+         }
+#endif 
+
+         if (myid == 0)
+         {
+            stringstream logFilename;
+            logFilename << pathname + "/logfile" + UbSystem::toString(UbSystem::getTimeStamp()) + ".txt";
+            UbLog::output_policy::setStream(logFilename.str());
+         }
+      }
+
+
+
+      if (myid == 0) UBLOG(logINFO, "Testcase big bone");
+
+      Grid3DPtr grid(new Grid3D(comm));
+      double deltaVoxel = 11.658e-6;
+
+      double dx = deltaVoxel;
+
+      const int blocknx1 = 64;
+      const int blocknx2 = 64;
+      const int blocknx3 = 64;
+
+      LBMReal rho_LB = 0.0;
+      //nueWasser = 1e-6 m^2/s
+      double nu_real = 1e-6;
+      LBMReal dt = deltaT; //1e-5; // s (frei gewählt)
+      //dx - frei gewählt
+      //
+      LBMReal nu_LB = nu_real / (dx*dx / dt);
+
+
+      //dp = 50000 Pa - 0 Pa = 50000 Pa
+      //rho wasser = 1000 kg*m^-3
+      double rho_real = 1000;
+      //dp/rho = 50000/1000 = 50 m^2/s^2
+      double dp_div_rho_real = dp_real / rho_real;
+
+      double dp_LB = dp_div_rho_real / ((dx / dt)*(dx / dt));
+
+      double rhoLBinflow;
+      rhoLBinflow = dp_LB*3.0;
+     
+      double deltax = dx;
+
+      LBMUnitConverterPtr conv = LBMUnitConverterPtr(new LBMUnitConverter());
+
+      const int baseLevel = 0;
+      const int refineLevel = 0;
+
+      double coord[6];
+
+      //////////////////////////////////////////////////////////////////////////
+      //restart
+      UbSchedulerPtr rSch(new UbScheduler(restartStep, restartStepStart));
+      RestartPostprocessor rp(grid, rSch, comm, pathname, RestartPostprocessor::BINARY);
+      //////////////////////////////////////////////////////////////////////////
+
+      if (grid->getTimeStep() == 0)
+      {
+         if (myid == 0) UBLOG(logINFO, "Neustart..");
+
+         string boneFilename = pathGeo + sampleFilename;
+
+         //int pmNX1 = 1164;  //abmessung einzelbild in x-richtung
+         //int pmNX2 = 972; //abmessung einzelbild in y richtung
+         //int pmNX3 = 900; //anzahl der bilder
+         ////int pmNX3 = 10; //anzahl der bilder
+         //float lthreshold = 109.0;
+         //float uthreshold = 255.0;
+
+         GbVoxelMatrix3DPtr bone(new GbVoxelMatrix3D(pmNX1, pmNX2, pmNX3, 0, lthreshold, uthreshold));
+         bone->readMatrixFromRawFile<unsigned char>(boneFilename, GbVoxelMatrix3D::BigEndian);
+         bone->setVoxelMatrixDelta(deltaVoxel, deltaVoxel, deltaVoxel);
+         bone->setVoxelMatrixMininum(0.0, 0.0, 0.0);
+
+         if (myid == 0) bone->writeToVTKImageDataASCII(pathname + "/geo/bone");
+
+         ///////////////////////////////////////////////////////
+
+         ////////////////////////////////////////////////////////////////////////
+
+         double offset = 0.5e-3;
+         //bounding box
+         double g_minX1 = bone->getX1Minimum();
+         double g_minX2 = bone->getX2Minimum();
+         double g_minX3 = bone->getX3Minimum() - offset;
+
+         double g_maxX1 = bone->getX1Maximum();
+         double g_maxX2 = bone->getX2Maximum();
+         double g_maxX3 = bone->getX3Maximum() + offset;
+
+         double blockLength = (double)blocknx1*deltax;
+
+         grid->setPeriodicX1(false);
+         grid->setPeriodicX2(false);
+         grid->setPeriodicX3(false);
+         grid->setDeltaX(deltax);
+         grid->setBlockNX(blocknx1, blocknx2, blocknx3);
+
+         GbObject3DPtr gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
+         if (myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), pathname + "/geo/gridCube", WbWriterVtkXmlBinary::getInstance());
+
+
+         GenBlocksGridVisitor genBlocks(gridCube);
+         grid->accept(genBlocks);
+
+         if (myid == 0)
+         {
+            UBLOG(logINFO, "Parameters:");
+            UBLOG(logINFO, "rho_LB = " << rho_LB);
+            UBLOG(logINFO, "nu_LB = " << nu_LB);
+            UBLOG(logINFO, "dp_LB = " << dp_LB);
+            UBLOG(logINFO, "dx = " << dx << " m");
+            UBLOG(logINFO, "dt = " << dt << " s");
+            UBLOG(logINFO, "rho_real = " << rho_real << " kg*m^-3");
+            UBLOG(logINFO, "nu_real = " << nu_real << " m^2/s");
+            UBLOG(logINFO, "dp_real = " << dp_real << " Pa");
+
+            UBLOG(logINFO, "number of levels = " << refineLevel + 1);
+            UBLOG(logINFO, "numOfThreads = " << numOfThreads);
+            UBLOG(logINFO, "path = " << pathname);
+            UBLOG(logINFO, "Preprozess - start");
+         }
+
+         //cylinder
+         double radius = 0.0036;
+         double cx1 = 0.007;
+         double cx2 = 0.0046;
+
+         GbObject3DPtr cylinder(new GbCylinder3D(cx1, cx2, g_minX3 - offset, cx1, cx2, g_maxX3 + offset, radius));
+         GbSystem3D::writeGeoObject(cylinder.get(), pathname + "/geo/cylinder", WbWriterVtkXmlBinary::getInstance());
+
+         //inflow
+         GbCuboid3DPtr geoInflow(new GbCuboid3D(g_minX1 - blockLength, g_minX2 - blockLength, g_minX3 - blockLength, g_maxX1 + blockLength, g_maxX2 + blockLength, g_minX3));
+         if (myid == 0) GbSystem3D::writeGeoObject(geoInflow.get(), pathname + "/geo/geoInflow", WbWriterVtkXmlASCII::getInstance());
+
+         //outflow
+         GbCuboid3DPtr geoOutflow(new GbCuboid3D(g_minX1 - blockLength, g_minX2 - blockLength, g_maxX3, g_maxX1 + blockLength, g_maxX2 + blockLength, g_maxX3 + blockLength));
+         if (myid == 0) GbSystem3D::writeGeoObject(geoOutflow.get(), pathname + "/geo/geoOutflow", WbWriterVtkXmlASCII::getInstance());
+
+         BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm));
+
+         //bone interactor
+         int bcOptionBone = 1; //0=simple Bounce Back, 1=quadr. BB, 2=thin wall
+         D3Q27BoundaryConditionAdapterPtr bcBone(new D3Q27NoSlipBCAdapter(bcOptionBone));
+         D3Q27InteractorPtr boneInt(new D3Q27Interactor(bone, grid, bcBone, Interactor3D::SOLID));
+
+         //wall interactors
+         int bcOptionWall = 1; //0=simple Bounce Back, 1=quadr. BB, 2=thin wall
+         D3Q27BoundaryConditionAdapterPtr bcWall(new D3Q27NoSlipBCAdapter(bcOptionWall));
+         D3Q27InteractorPtr cylInt(new D3Q27Interactor(cylinder, grid, bcWall, Interactor3D::INVERSESOLID));
+
+         D3Q27BoundaryConditionAdapterPtr denBCAdapterInflow(new D3Q27DensityBCAdapter(rhoLBinflow));
+         denBCAdapterInflow->setSecondaryBcOption(0);
+         D3Q27InteractorPtr inflowInt = D3Q27InteractorPtr(new D3Q27Interactor(geoInflow, grid, denBCAdapterInflow, Interactor3D::SOLID));
+
+         //outflow
+         D3Q27BoundaryConditionAdapterPtr denBCAdapterOutflow(new D3Q27DensityBCAdapter(rho_LB));
+         denBCAdapterOutflow->setSecondaryBcOption(0);
+         D3Q27InteractorPtr outflowInt = D3Q27InteractorPtr(new D3Q27Interactor(geoOutflow, grid, denBCAdapterOutflow, Interactor3D::SOLID));
+
+         ////////////////////////////////////////////
+         //METIS
+         Grid3DVisitorPtr metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::BSW));
+         ////////////////////////////////////////////
+         //Zoltan
+         //Grid3DVisitorPtr zoltanVisitor(new ZoltanPartitioningGridVisitor(comm, D3Q27System::BSW, 1));
+         //////////////////////////////////////////////////////////////////////////
+         /////delete solid blocks
+         if (myid == 0) UBLOG(logINFO, "deleteSolidBlocks - start");
+         InteractorsHelper intHelper(grid, metisVisitor);
+         intHelper.addInteractor(boneInt);
+         intHelper.addInteractor(cylInt);
+         intHelper.addInteractor(inflowInt);
+         intHelper.addInteractor(outflowInt);
+         intHelper.selectBlocks();
+         if (myid == 0) UBLOG(logINFO, "deleteSolidBlocks - end");
+         //////////////////////////////////////
+
+         //set connectors
+         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
+         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nu_LB, iProcessor);
+         grid->accept(setConnsVisitor);
+
+         //domain decomposition for threads
+         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
+         grid->accept(pqPartVisitor);
+
+         ppblocks->update(0);
+         ppblocks.reset();
+
+         unsigned long nob = grid->getNumberOfBlocks();
+         int gl = 3;
+         unsigned long nodb = (blocknx1)* (blocknx2)* (blocknx3);
+         unsigned long nod = nob * (blocknx1)* (blocknx2)* (blocknx3);
+         unsigned long nodg = nob * (blocknx1 + gl) * (blocknx2 + gl) * (blocknx3 + gl);
+         double needMemAll = double(nodg*(27 * sizeof(double) + sizeof(int) + sizeof(float) * 4));
+         double needMem = needMemAll / double(comm->getNumberOfProcesses());
+
+         if (myid == 0)
+         {
+            UBLOG(logINFO, "Number of blocks = " << nob);
+            UBLOG(logINFO, "Number of nodes  = " << nod);
+            int minInitLevel = grid->getCoarsestInitializedLevel();
+            int maxInitLevel = grid->getFinestInitializedLevel();
+            for (int level = minInitLevel; level <= maxInitLevel; level++)
+            {
+               int nobl = grid->getNumberOfBlocks(level);
+               UBLOG(logINFO, "Number of blocks for level " << level << " = " << nobl);
+               UBLOG(logINFO, "Number of nodes for level " << level << " = " << nobl*nodb);
+            }
+            UBLOG(logINFO, "Necessary memory  = " << needMemAll << " bytes");
+            UBLOG(logINFO, "Necessary memory per process = " << needMem << " bytes");
+            UBLOG(logINFO, "Available memory per process = " << availMem << " bytes");
+         }
+
+         LBMKernel3DPtr kernel = LBMKernel3DPtr(new LBMKernelETD3Q27CCLB(blocknx1, blocknx2, blocknx3, LBMKernelETD3Q27CCLB::NORMAL));
+
+         //BCProcessorPtr bcProc(new D3Q27ETForThinWallBCProcessor());
+         BCProcessorPtr bcProc(new D3Q27ETBCProcessor());
+         BoundaryConditionPtr densityBC(new NonEqDensityBoundaryCondition());
+         BoundaryConditionPtr noSlipBC(new NoSlipBoundaryCondition());
+         bcProc->addBC(densityBC);
+         bcProc->addBC(noSlipBC);
+         kernel->setBCProcessor(bcProc);
+
+         SetKernelBlockVisitor kernelVisitor(kernel, nu_LB, availMem, needMem);
+         grid->accept(kernelVisitor);
+
+         //BC
+         intHelper.setBC();
+
+         BoundaryConditionBlockVisitor bcVisitor;
+         grid->accept(bcVisitor);
+
+         //Press*1.6e8+(14.76-coordsX)/3.5*5000
+         //initialization of distributions
+         mu::Parser fct;
+         fct.SetExpr("(x3max-x3)/l*dp*3.0");
+         fct.DefineConst("dp", dp_LB);
+         fct.DefineConst("x3max", g_maxX3);
+         fct.DefineConst("l", g_maxX3-g_minX3);
+
+         D3Q27ETInitDistributionsBlockVisitor initVisitor(nu_LB, rho_LB);
+         initVisitor.setRho(fct);
+         //initVisitor.setVx1(fct);
+         //initVisitor.setVx1(0.0);
+         grid->accept(initVisitor);
+
+         //Postrozess
+         UbSchedulerPtr geoSch(new UbScheduler(1));
+         D3Q27MacroscopicQuantitiesPostprocessorPtr ppgeo(
+            new D3Q27MacroscopicQuantitiesPostprocessor(grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, true));
+         ppgeo->update(0);
+         ppgeo.reset();
+
+
+         coord[0] = bone->getX1Minimum();
+         coord[1] = bone->getX2Minimum();
+         coord[2] = bone->getX3Minimum();//cylinder->getX3Centroid();
+         coord[3] = bone->getX1Maximum();
+         coord[4] = bone->getX2Maximum();
+         coord[5] = bone->getX3Maximum(); //cylinder->getX3Centroid();
+
+         ////////////////////////////////////////////////////////
+         FILE * pFile;
+         string str = pathname + "/checkpoints/coord.txt";
+         pFile = fopen(str.c_str(), "w");
+         fprintf(pFile, "%g\n", coord[0]);
+         fprintf(pFile, "%g\n", coord[1]);
+         fprintf(pFile, "%g\n", coord[2]);
+         fprintf(pFile, "%g\n", coord[3]);
+         fprintf(pFile, "%g\n", coord[4]);
+         fprintf(pFile, "%g\n", coord[5]);
+         fclose(pFile);
+         ////////////////////////////////////////////////////////
+         grid->addInteractor(inflowInt);
+         if (myid == 0) UBLOG(logINFO, "Preprozess - end");
+      }
+      else
+      {
+         Grid3D::Interactor3DSet interactors = grid->getInteractors();
+         interactors[0]->setGrid3D(grid);
+         boost::dynamic_pointer_cast<D3Q27Interactor>(interactors[0])->deleteBCAdapter();
+         D3Q27BoundaryConditionAdapterPtr denBCAdapterFront(new D3Q27DensityBCAdapter(rhoLBinflow));
+         boost::dynamic_pointer_cast<D3Q27Interactor>(interactors[0])->addBCAdapter(denBCAdapterFront);
+         interactors[0]->updateInteractor();
+
+         UBLOG(logINFO, "rhoLBinflow = "<<rhoLBinflow);
+
+         BoundaryConditionBlockVisitor bcVisitor;
+         grid->accept(bcVisitor);
+
+         //set connectors
+         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
+         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nu_LB, iProcessor);
+         grid->accept(setConnsVisitor);
+
+         ////////////////////////////////////////////////////////
+         FILE * pFile;
+         string str = pathname + "/checkpoints/coord.txt";
+         pFile = fopen(str.c_str(), "r");
+         fscanf(pFile, "%lg\n", &coord[0]);
+         fscanf(pFile, "%lg\n", &coord[1]);
+         fscanf(pFile, "%lg\n", &coord[2]);
+         fscanf(pFile, "%lg\n", &coord[3]);
+         fscanf(pFile, "%lg\n", &coord[4]);
+         fscanf(pFile, "%lg\n", &coord[5]);
+         fclose(pFile);
+         ////////////////////////////////////////////////////////
+
+         if (myid == 0) UBLOG(logINFO, "Restart - end");
+      }
+      UbSchedulerPtr nupsSch(new UbScheduler(10, 30, 100));
+      NUPSCounterPostprocessor npr(grid, nupsSch, numOfThreads, comm);
+
+      UbSchedulerPtr stepSch(new UbScheduler(outTime));
+      //stepSch->addSchedule(10, 10, 10);
+      //stepSch->addSchedule(100, 100, 100);
+      //stepSch->addSchedule(1000, 1000, 1000);
+      //stepSch->addSchedule(100, 1500, 2000);
+      //stepSch->addSchedule(10000, 10000, 10000);
+
+      D3Q27MacroscopicQuantitiesPostprocessor pp(grid, stepSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv);
+
+      double dxd2 = deltax / 2.0;
+      D3Q27IntegrateValuesHelperPtr ih1(new D3Q27IntegrateValuesHelper(grid, comm, coord[0], coord[1], coord[2] - dxd2*10.0,
+         coord[3], coord[4], coord[2] - dxd2*10.0 - 2.0*dxd2));
+      D3Q27IntegrateValuesHelperPtr ih2(new D3Q27IntegrateValuesHelper(grid, comm, coord[0], coord[1], coord[2], coord[3], coord[4], coord[5]));
+      D3Q27IntegrateValuesHelperPtr ih3(new D3Q27IntegrateValuesHelper(grid, comm, coord[0], coord[1], coord[5] + dxd2*10.0,
+         coord[3], coord[4], coord[5] + dxd2*10.0 + 2.0*dxd2));
+
+      if (myid == 0) GbSystem3D::writeGeoObject(ih1->getBoundingBox().get(), pathname + "/geo/ih1", WbWriterVtkXmlBinary::getInstance());
+      if (myid == 0) GbSystem3D::writeGeoObject(ih2->getBoundingBox().get(), pathname + "/geo/ih2", WbWriterVtkXmlBinary::getInstance());
+      if (myid == 0) GbSystem3D::writeGeoObject(ih3->getBoundingBox().get(), pathname + "/geo/ih3", WbWriterVtkXmlBinary::getInstance());
+
+      UbSchedulerPtr stepMV(new UbScheduler(timeSeriesOutTime));
+
+      TimeseriesPostprocessor tsp1(grid, stepMV, ih1, pathname+timeSeriesFile+"_1", comm);
+      TimeseriesPostprocessor tsp2(grid, stepMV, ih2, pathname+timeSeriesFile+"_2", comm);
+      TimeseriesPostprocessor tsp3(grid, stepMV, ih3, pathname+timeSeriesFile+"_3", comm);
+
+      if (myid == 0)
+      {
+         UBLOG(logINFO, "PID = " << myid << " Total Physical Memory (RAM): " << Utilities::getTotalPhysMem());
+         UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used: " << Utilities::getPhysMemUsed());
+         UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe());
+      }
+
+      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, stepMV));
+      if (myid == 0) UBLOG(logINFO, "Simulation-start");
+      calculation->calculate();
+      if (myid == 0) UBLOG(logINFO, "Simulation-end");
+   }
+   catch (exception& e)
+   {
+      cerr << e.what() << endl << flush;
+   }
+   catch (string& s)
+   {
+      cerr << s << endl;
+   }
+   catch (...)
+   {
+      cerr << "unknown exception" << endl;
+   }
+
+}
+//////////////////////////////////////////////////////////////////////////
+int main(int argc, char* argv[])
+{
+
+   if (argv != NULL)
+   {
+      if (argv[1] != NULL)
+         sbonepd(string(argv[1]));
+   }
+
+   return 0;
+}
diff --git a/apps/cpu/bbone/configBombadilBone.txt b/apps/cpu/bbone/configBombadilBone.txt
index b5fa00058f05e277ea2418d9c33890129bec18ce..880c0cce60766fc9c4d8327ed275a9bda0d072ba 100644
--- a/apps/cpu/bbone/configBombadilBone.txt
+++ b/apps/cpu/bbone/configBombadilBone.txt
@@ -1,46 +1,46 @@
-#
-#Simulation parameters for determitatoin of permeability
-#SBP120
-
-pathname = d:/temp/bbone2
-pathGeo = d:/Data/Bone/BigBone
-numOfThreads = 4
-availMem = 3e9
-logToFile = false
-
-#porous media
-#rawFile = false
-sampleFilename = /cyl_bone2.raw
-
-#diminsions [voxel]
-pmNX1 = 1164
-pmNX2 = 972
-pmNX3 = 900
-
-#threshold
-lthreshold = 109
-uthreshold = 255
-
-#diminsions [m]
-#pmL1 = 1.87e-3
-#pmL2 = 1.87e-3
-#pmL3 = 1.87e-3
-
-#grid
-#blocknx = 30
-#nx3 = 5
-#blocknx = 50
-#nx3 = 10
-#spongeLayer=true
-
-#physic
-dp_real = 1
-
-timeSeriesFile = /timeseries/bone1
-timeSeriesOutTime = 10
-
-restartStep = 20000
-restartStepStart=20000
-
-endTime = 60000
-outTime = 100
+#
+#Simulation parameters for determitatoin of permeability
+#SBP120
+
+pathname = d:/temp/bbone2
+pathGeo = d:/Data/Bone/BigBone
+numOfThreads = 4
+availMem = 3e9
+logToFile = false
+
+#porous media
+#rawFile = false
+sampleFilename = /cyl_bone2.raw
+
+#diminsions [voxel]
+pmNX1 = 1164
+pmNX2 = 972
+pmNX3 = 900
+
+#threshold
+lthreshold = 109
+uthreshold = 255
+
+#diminsions [m]
+#pmL1 = 1.87e-3
+#pmL2 = 1.87e-3
+#pmL3 = 1.87e-3
+
+#grid
+#blocknx = 30
+#nx3 = 5
+#blocknx = 50
+#nx3 = 10
+#spongeLayer=true
+
+#physic
+dp_real = 1
+
+timeSeriesFile = /timeseries/bone1
+timeSeriesOutTime = 10
+
+restartStep = 20000
+restartStepStart=20000
+
+endTime = 60000
+outTime = 100
diff --git a/apps/cpu/bbone/configLudwigBone.cfg b/apps/cpu/bbone/configLudwigBone.cfg
index 7ce59bfdbef2929d9e9bef8e8fbcf0c831a4a9fc..aee907cae82eccf522b8ed7d29cdca57a7e6f018 100644
--- a/apps/cpu/bbone/configLudwigBone.cfg
+++ b/apps/cpu/bbone/configLudwigBone.cfg
@@ -1,33 +1,33 @@
-#
-#Simulation parameters for determitatoin of permeability
-#SBP120
-
-pathname = /hpc3lustre/work/koskuche/Bone/BigBone2
-pathGeo = /hpc3lustre/work/koskuche/Bone/data/bbone
-numOfThreads = 4
-availMem = 11e9
-logToFile = true
-
-#porous media
-sampleFilename = /cyl_bone2.raw
-
-#diminsions [voxel]
-pmNX1 = 1164
-pmNX2 = 972
-pmNX3 = 900
-
-#threshold
-lthreshold = 109
-uthreshold = 255
-
-#physic
-dp_real = 1
-
-timeSeriesFile = /timeseries/bone1
-timeSeriesOutTime = 10
-
-restartStep = 20000
-restartStepStart=20000
-
-endTime = 60000
-outTime = 10000
+#
+#Simulation parameters for determitatoin of permeability
+#SBP120
+
+pathname = /hpc3lustre/work/koskuche/Bone/BigBone2
+pathGeo = /hpc3lustre/work/koskuche/Bone/data/bbone
+numOfThreads = 4
+availMem = 11e9
+logToFile = true
+
+#porous media
+sampleFilename = /cyl_bone2.raw
+
+#diminsions [voxel]
+pmNX1 = 1164
+pmNX2 = 972
+pmNX3 = 900
+
+#threshold
+lthreshold = 109
+uthreshold = 255
+
+#physic
+dp_real = 1
+
+timeSeriesFile = /timeseries/bone1
+timeSeriesOutTime = 10
+
+restartStep = 20000
+restartStepStart=20000
+
+endTime = 60000
+outTime = 10000
diff --git a/apps/cpu/block_test/block_test.cpp b/apps/cpu/block_test/block_test.cpp
index 92f3ff2bb2506324caeae7ae5d6243ea56b9a98b..b24eb5430d72815c1782b0abedf82a2bceb02faa 100644
--- a/apps/cpu/block_test/block_test.cpp
+++ b/apps/cpu/block_test/block_test.cpp
@@ -1,20 +1,20 @@
-#include "block_test_incompressible.hpp"
-
-int main(int argc, char* argv[])
-{
-
-   if ( argv != NULL )
-   {
-      if (argc > 1)
-      {
-         block_test_incompressible(argv[1], argv[2]);
-      }
-      else
-      {
-         cout << "Configuration file must be set!: " <<  argv[0] << " <config file>" << endl << std::flush;
-      }
-   }
-
-   return 0;
-}
-
+#include "block_test_incompressible.hpp"
+
+int main(int argc, char* argv[])
+{
+
+   if ( argv != NULL )
+   {
+      if (argc > 1)
+      {
+         block_test_incompressible(argv[1], argv[2]);
+      }
+      else
+      {
+         cout << "Configuration file must be set!: " <<  argv[0] << " <config file>" << endl << std::flush;
+      }
+   }
+
+   return 0;
+}
+
diff --git a/apps/cpu/block_test/block_test_all.hpp b/apps/cpu/block_test/block_test_all.hpp
index d530c0a11e0d01af705337d84d5e7142cc5f5185..bbe172dd3f6477a5262bc9eee997d32ceed95e5e 100644
--- a/apps/cpu/block_test/block_test_all.hpp
+++ b/apps/cpu/block_test/block_test_all.hpp
@@ -1,397 +1,397 @@
-#include <iostream>
-#include <string>
-
-#include "geometry3d/CoordinateTransformation3D.h"
-#include "Grid3D.h"
-#include "GenBlocksGridVisitor.h"
-#include "geometry3d/GbSystem3D.h"
-#include "geometry3d/GbCuboid3D.h"
-#include "geometry3d/GbCylinder3D.h"
-#include "basics/writer/WbWriterVtkXmlASCII.h"
-#include "basics/writer/WbWriterVtkXmlBinary.h"
-#include "RefineCrossAndInsideGbObjectBlockVisitor.h"
-#include "RatioBlockVisitor.h"
-#include "RatioSmoothBlockVisitor.h"
-#include "OverlapBlockVisitor.h"
-#include "RefineInterGbObjectsVisitor.h"
-#include "SetKernelBlockVisitor.h"
-#include "LBMKernelETD3Q27Cascaded.h"
-#include "D3Q27MacroscopicQuantitiesPostprocessor.h"
-#include "MPICommunicator.h"
-#include "D3Q27ETBCProcessor.h"
-#include "SimulationParameters.h"
-#include "D3Q27SetUndefinedNodesBlockVisitor.h"
-#include "SetInterpolationDirsBlockVisitor.h"
-#include "D3Q27SetConnectorsBlockVisitor.h"
-#include "NullCommunicator.h"
-#include "D3Q27ETInitDistributionsBlockVisitor.h"
-#include "CalculationManager.h"
-#include "PQueuePartitioningGridVisitor.h"
-#include "MetisPartitioningGridVisitor.h"
-#include "D3Q27Interactor.h"
-#include "D3Q27NoSlipBCAdapter.h"
-#include "D3Q27VelocityBCAdapter.h"
-#include "D3Q27DensityBCAdapter.h"
-#include "D3Q27BoundaryConditionAdapter.h"
-#include "StringUtil.hpp"
-#include "D3Q27OffsetInterpolationProcessor.h"
-#include "D3Q27CompactInterpolationProcessor.h"
-#include "D3Q27PressureDifferencePostprocessor.h"
-#include "D3Q27IntegrateValuesHelper.h"
-#include "RestartPostprocessor.h"
-#include "SolidBlocksHelper.h"
-#include "NUPSCounterPostprocessor.h"
-#include "BlocksPostprocessor.h"
-#include "LBMKernelETD3Q27BGK.h"
-#include "EmergencyExitPostprocessor.h"
-#include "D3Q27ForcesPostprocessor.h"
-#include "ConfigFileReader.h"
-#include "MemoryUtil.h"
-#include "LBMKernelETD3Q27CCLB.h"
-
-
-using namespace std;
-
-
-void block_test_all(const char *cstr)
-{
-   try
-   {
-      ConfigFileReader cf(cstr);
-      if ( !cf.read() )
-      {
-         std::string exceptionText = "Unable to read configuration file\n";
-         throw exceptionText;
-      }
-
-      string machine = QUOTEME(CAB_MACHINE);
-      string pathname = cf.getValue("path"); 
-      int numOfThreads = UbSystem::stringTo<int>(cf.getValue("numOfThreads"));
-      double availMem = 0;
-
-      CommunicatorPtr comm(new MPICommunicator());
-      int myid = comm->getProcessID();
-
-      if(machine == "BOMBADIL") 
-      {
-         //pathname = "c:/temp/block_test";
-         availMem = 3.0e9;
-      }
-      else if(machine == "M01" || machine == "M02")      
-      {
-         //pathname = "/work/koskuche/scratch/block_test";
-         availMem = 12.0e9;
-
-         if(myid ==0)
-         {
-            stringstream logFilename;
-            logFilename <<  pathname + "/logfile"+UbSystem::toString(UbSystem::getTimeStamp())+".txt";
-            UbLog::output_policy::setStream(logFilename.str());
-         }
-      }
-      else throw UbException(UB_EXARGS, "unknown CAB_MACHINE");
-
-      double dx = 1;
-
-      const int blocknx1 = UbSystem::stringTo<int>(cf.getValue("blocknx1")); //16;
-      const int blocknx2 = UbSystem::stringTo<int>(cf.getValue("blocknx2"));//16;
-      const int blocknx3 = UbSystem::stringTo<int>(cf.getValue("blocknx3"));//16;
-
-      const int gridNx1 = UbSystem::stringTo<int>(cf.getValue("gridNx1"));//3;
-      const int gridNx2 = UbSystem::stringTo<int>(cf.getValue("gridNx2"));//3;
-      const int gridNx3 = UbSystem::stringTo<int>(cf.getValue("gridNx3"));//3;
-
-
-      double L1 = gridNx1*blocknx1;
-      double L2, L3, H;
-      L2 = L3 = H = gridNx2*blocknx1;
-
-      LBMReal radius = 3;
-      LBMReal uLB = 0.05;
-      LBMReal Re = 300.0;
-      LBMReal rhoLB = 1.0;
-      LBMReal l = L2 / dx;
-      LBMReal nueLB = (((4.0/9.0)*uLB)*2.0*(radius/dx))/Re;
-
-
-      LBMUnitConverterPtr conv = LBMUnitConverterPtr(new LBMUnitConverter());
-
-      const int baseLevel = 0;
-      const int refineLevel = UbSystem::stringTo<int>(cf.getValue("refineLevel"));
-
-      //obstacle
-      GbObject3DPtr cylinder(new GbCylinder3D(L1*0.5, L2*0.5, 0, L1*0.5, L2*0.5, L3, radius));
-      GbSystem3D::writeGeoObject(cylinder.get(),pathname + "/geo/cylinder", WbWriterVtkXmlBinary::getInstance());
-
-      D3Q27InteractorPtr cylinderInt;
-
-      //bounding box
-      double d_minX1 = 0.0;
-      double d_minX2 = 0.0;
-      double d_minX3 = 0.0;
-
-      double d_maxX1 = L1;
-      double d_maxX2 = L2;
-      double d_maxX3 = L3;
-
-      double offs = dx;
-
-      //double g_minX1 = d_minX1-offs-0.499999*dx;
-      double g_minX1 = d_minX1-offs;
-      double g_minX2 = d_minX2-offs;
-      double g_minX3 = d_minX3-offs;
-
-      double g_maxX1 = d_maxX1+offs;
-      double g_maxX2 = d_maxX2+offs;
-      double g_maxX3 = d_maxX3+offs;
-
-      double blockLength = blocknx1*dx;
-
-      //refinement area
-      double off = 1;
-      GbObject3DPtr refineCube(new  GbCuboid3D(cylinder->getX1Minimum()-off, cylinder->getX2Minimum()-off, cylinder->getX3Minimum(), 
-         cylinder->getX1Maximum()+off, cylinder->getX2Maximum()+off, cylinder->getX3Maximum()));
-
-      Grid3DPtr grid(new Grid3D(blocknx1, blocknx2, blocknx3, gridNx1, gridNx2, gridNx3));
-
-
-      if(myid ==0)
-      {
-         UBLOG(logINFO,"Parameters:");
-         UBLOG(logINFO,"L = " << L2/dx );
-         UBLOG(logINFO,"v = " << uLB );
-         UBLOG(logINFO,"rho = " << rhoLB );
-         UBLOG(logINFO,"nue = " << nueLB );
-         UBLOG(logINFO,"Re = " << Re );
-         UBLOG(logINFO,"dx = " << dx );
-         UBLOG(logINFO,"number of levels = " << refineLevel+1 );
-         UBLOG(logINFO,"numOfThreads = " << numOfThreads );
-         UBLOG(logINFO,"Preprozess - start");
-      }
-
-      if(myid ==0) GbSystem3D::writeGeoObject(refineCube.get(),pathname + "/geo/refineCube", WbWriterVtkXmlBinary::getInstance());
-
-      //walls
-      GbCuboid3DPtr addWallYmin (new GbCuboid3D(d_minX1-4.0*blockLength, d_minX2-4.0*blockLength, d_minX3-4.0*blockLength, d_maxX1+4.0*blockLength, d_minX2, d_maxX3+4.0*blockLength));
-      if(myid == 0) GbSystem3D::writeGeoObject(addWallYmin.get(), pathname+"/geo/addWallYmin", WbWriterVtkXmlASCII::getInstance());
-
-      GbCuboid3DPtr addWallZmin (new GbCuboid3D(d_minX1-4.0*blockLength, d_minX2-4.0*blockLength, d_minX3-4.0*blockLength, d_maxX1+4.0*blockLength, d_maxX2+4.0*blockLength, d_minX3));
-      if(myid == 0) GbSystem3D::writeGeoObject(addWallZmin.get(), pathname+"/geo/addWallZmin", WbWriterVtkXmlASCII::getInstance());
-
-      GbCuboid3DPtr addWallYmax (new GbCuboid3D(d_minX1-4.0*blockLength, d_maxX2, d_minX3-4.0*blockLength, d_maxX1+4.0*blockLength, d_maxX2+4.0*blockLength, d_maxX3+4.0*blockLength));
-      if(myid == 0) GbSystem3D::writeGeoObject(addWallYmax.get(), pathname+"/geo/addWallYmax", WbWriterVtkXmlASCII::getInstance());
-
-      GbCuboid3DPtr addWallZmax (new GbCuboid3D(d_minX1-4.0*blockLength, d_minX2-4.0*blockLength, d_maxX3, d_maxX1+4.0*blockLength, d_maxX2+4.0*blockLength, d_maxX3+4.0*blockLength));
-      if(myid == 0) GbSystem3D::writeGeoObject(addWallZmax.get(), pathname+"/geo/addWallZmax", WbWriterVtkXmlASCII::getInstance());
-
-      //inflow
-      GbCuboid3DPtr geoInflow (new GbCuboid3D(d_minX1-4.0*blockLength, d_minX2-4.0*blockLength, d_minX3-4.0*blockLength, d_minX1, d_maxX2+4.0*blockLength, d_maxX3+4.0*blockLength));
-      if(myid == 0) GbSystem3D::writeGeoObject(geoInflow.get(), pathname+"/geo/geoInflow", WbWriterVtkXmlASCII::getInstance());
-
-      //outflow
-      GbCuboid3DPtr geoOutflow (new GbCuboid3D(d_maxX1, d_minX2-4.0*blockLength, d_minX3-4.0*blockLength, d_maxX1+4.0*blockLength, d_maxX2+4.0*blockLength, d_maxX3+4.0*blockLength));
-      if(myid == 0) GbSystem3D::writeGeoObject(geoOutflow.get(), pathname+"/geo/geoOutflow", WbWriterVtkXmlASCII::getInstance());
-
-      BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname + "/grid/blocks", WbWriterVtkXmlBinary::getInstance(), comm));
-
-      if (refineLevel > 0)
-      {
-         if(myid == 0) UBLOG(logINFO,"Refinement - start");	
-         RefineCrossAndInsideGbObjectBlockVisitor refVisitor(refineCube, baseLevel, refineLevel-1);
-         grid->accept(refVisitor);
-
-         RatioBlockVisitor ratioVisitor(refineLevel);
-         grid->accept(ratioVisitor);
-
-         RatioSmoothBlockVisitor ratioSmoothVisitor(refineLevel);
-         grid->accept(ratioSmoothVisitor);
-
-         OverlapBlockVisitor overlapVisitor(refineLevel);
-         grid->accept(overlapVisitor);
-
-         std::vector<int> dirs;
-         D3Q27System::getLBMDirections(dirs);
-         SetInterpolationDirsBlockVisitor interDirsVisitor(dirs);
-         grid->accept(interDirsVisitor);
-         if(myid == 0) UBLOG(logINFO,"Refinement - end");	
-      }
-
-      MetisPartitioningGridVisitor metisVisitor(numOfThreads, D3Q27System::B, comm, true);
-      grid->accept( metisVisitor );
-
-      SolidBlocksHelper sd(grid, comm);
-
-      int bbOption = 1; //0=simple Bounce Back, 1=quadr. BB
-      D3Q27BoundaryConditionAdapterPtr bcObst(new D3Q27NoSlipBCAdapter(bbOption));
-      cylinderInt = D3Q27InteractorPtr ( new D3Q27Interactor(cylinder, grid, bcObst,Interactor3D::SOLID));
-
-      //walls
-      D3Q27InteractorPtr addWallYminInt(new D3Q27Interactor(addWallYmin, grid, bcObst,Interactor3D::SOLID));
-      D3Q27InteractorPtr addWallZminInt(new D3Q27Interactor(addWallZmin, grid, bcObst,Interactor3D::SOLID));
-      D3Q27InteractorPtr addWallYmaxInt(new D3Q27Interactor(addWallYmax, grid, bcObst,Interactor3D::SOLID));
-      D3Q27InteractorPtr addWallZmaxInt(new D3Q27Interactor(addWallZmax, grid, bcObst,Interactor3D::SOLID));
-
-      mu::Parser fct;
-      fct.SetExpr("16*U*x2*x3*(H-x2)*(H-x3)/H^4");
-      fct.DefineConst("U", uLB);
-      fct.DefineConst("H", H);
-
-      //inflow
-      D3Q27BoundaryConditionAdapterPtr velBCAdapter(new D3Q27VelocityBCAdapter (true, false ,false ,fct, 0, D3Q27BCFunction::INFCONST));
-      velBCAdapter->setSecondaryBcOption(2);
-      D3Q27BoundaryConditionAdapterPtr denBCAdapterFront(new D3Q27DensityBCAdapter(rhoLB));
-      denBCAdapterFront->setSecondaryBcOption(1);
-      D3Q27InteractorPtr inflowInt  = D3Q27InteractorPtr( new D3Q27Interactor(geoInflow, grid, velBCAdapter, Interactor3D::SOLID));
-      //D3Q27InteractorPtr inflowInt  = D3Q27InteractorPtr( new D3Q27Interactor(geoInflow, grid, bcObst, Interactor3D::SOLID));
-
-      //outflow
-      D3Q27BoundaryConditionAdapterPtr denBCAdapter(new D3Q27DensityBCAdapter(rhoLB));
-      denBCAdapter->setSecondaryBcOption(1);
-      D3Q27InteractorPtr outflowInt = D3Q27InteractorPtr( new D3Q27Interactor(geoOutflow, grid, denBCAdapter,Interactor3D::SOLID));
-      //D3Q27InteractorPtr outflowInt = D3Q27InteractorPtr( new D3Q27Interactor(geoOutflow, grid, bcObst,Interactor3D::SOLID));
-
-      //sd.addInteractor(cylinderInt);
-      sd.addInteractor(addWallYminInt);
-      sd.addInteractor(addWallZminInt);
-      sd.addInteractor(addWallYmaxInt);
-      sd.addInteractor(addWallZmaxInt);
-      sd.addInteractor(inflowInt);
-      sd.addInteractor(outflowInt);
-
-      sd.deleteSolidBlocks();
-
-      grid->accept( metisVisitor );
-
-      //set connectors
-      D3Q27InterpolationProcessorPtr iProcessor(new D3Q27OffsetInterpolationProcessor());
-      D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
-      grid->accept( setConnsVisitor );
-
-      //domain decomposition for threads
-      //PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
-      //grid->accept(pqPartVisitor);
-
-      ppblocks->update(0);
-      ppblocks.reset();
-
-      unsigned long nob = grid->getNumberOfBlocks();
-      int gl = 3;
-      unsigned long nodb = (blocknx1) * (blocknx2) * (blocknx3);
-      unsigned long nod = nob * (blocknx1) * (blocknx2) * (blocknx3);
-      unsigned long nodg = nob * (blocknx1+gl) * (blocknx2+gl) * (blocknx3+gl);
-      double needMemAll  = double(nodg*(27*sizeof(double) + sizeof(int) + sizeof(float)*4));
-      double needMem  = needMemAll / double(comm->getNumberOfProcesses());
-
-      if(myid == 0)
-      {
-         UBLOG(logINFO,"Number of blocks = " << nob);
-         UBLOG(logINFO,"Number of nodes  = " << nod);
-         int minInitLevel = grid->getCoarsestInitializedLevel();
-         int maxInitLevel = grid->getFinestInitializedLevel();
-         for(int level = minInitLevel; level<=maxInitLevel; level++)
-         {
-            int nobl = grid->getNumberOfBlocks(level);
-            UBLOG(logINFO,"Number of blocks for level " << level <<" = " << nob);
-            UBLOG(logINFO,"Number of nodes for level " << level <<" = " << nob*nodb);
-         }
-         UBLOG(logINFO,"Necessary memory  = " << needMemAll  << " bytes");
-         UBLOG(logINFO,"Necessary memory per process = " << needMem  << " bytes");
-         UBLOG(logINFO,"Available memory per process = " << availMem << " bytes");
-      }            
-
-      int kernelType = UbSystem::stringTo<int>(cf.getValue("kernel"));
-      LBMKernel3DPtr kernel;
-      if (kernelType == 0)
-      {
-         kernel = LBMKernel3DPtr(new LBMKernelETD3Q27BGK(blocknx1, blocknx2, blocknx3, true));
-      }
-      else if (kernelType == 1)
-      {
-         kernel = LBMKernel3DPtr(new LBMKernelETD3Q27Cascaded(blocknx1, blocknx2, blocknx3));
-      }
-      else if (kernelType == 2)
-      {
-         kernel = LBMKernel3DPtr(new LBMKernelETD3Q27CCLB(blocknx1, blocknx2, blocknx3));
-      }
-
-      BCProcessorPtr bcProc(new D3Q27ETBCProcessor());
-      kernel->setBCProcessor(bcProc);
-
-      SetKernelBlockVisitor kernelVisitor(kernel, nueLB, availMem, needMem);
-      grid->accept(kernelVisitor);
-
-      if (refineLevel > 0)
-      {
-         D3Q27SetUndefinedNodesBlockVisitor undefNodesVisitor;
-         grid->accept(undefNodesVisitor);
-      }
-
-      //walls
-      grid->addAndInitInteractor(addWallYminInt);
-      grid->addAndInitInteractor(addWallZminInt);
-      grid->addAndInitInteractor(addWallYmaxInt);
-      grid->addAndInitInteractor(addWallZmaxInt);
-
-      //obstacle
-      //grid->addAndInitInteractor(cylinderInt);
-
-      //inflow
-      grid->addAndInitInteractor(inflowInt);
-
-      //outflow
-      grid->addAndInitInteractor(outflowInt);
-
-      //initialization of distributions
-      D3Q27ETInitDistributionsBlockVisitor initVisitor(1.0);
-      //initVisitor.setVx1(fct);
-      grid->accept(initVisitor);
-
-      //Postrozess
-      UbSchedulerPtr geoSch(new UbScheduler(1));
-      D3Q27MacroscopicQuantitiesPostprocessorPtr ppgeo(
-         new D3Q27MacroscopicQuantitiesPostprocessor(grid, geoSch, pathname + "/grid/nodes", WbWriterVtkXmlBinary::getInstance(), conv, comm, true));
-      ppgeo->update(0);
-      ppgeo.reset();
-
-      if(myid == 0) UBLOG(logINFO,"Preprozess - end"); 
-
-      UbSchedulerPtr nupsSch(new UbScheduler(10, 30, 100));
-      NUPSCounterPostprocessor npr(grid, nupsSch, pathname + "/results/nups.txt", comm);
-
-      double outTime = 1.0;
-      UbSchedulerPtr stepSch(new UbScheduler(outTime));
-      //UbSchedulerPtr stepSch(new UbScheduler());
-      //stepSch->addSchedule(10, 100, 1000);
-      //nodeSch->addSchedule(1000, 1000, 10000);
-      //nodeSch->addSchedule(10000, 10000, 50000);
-      //stepSch->addSchedule(100, 100, 1000);
-
-      D3Q27MacroscopicQuantitiesPostprocessor pp(grid, stepSch, pathname + "/steps/step", WbWriterVtkXmlBinary::getInstance(), conv, comm);
-
-      UbSchedulerPtr visSch(new UbScheduler());
-      //UbSchedulerPtr visSch(stepSch);
-      double endTime = UbSystem::stringTo<int>(cf.getValue("endTime"));//10001.0;
-
-      //cout << "PID = " << myid << " Total Physical Memory (RAM): " << MemoryUtil::getTotalPhysMem()<<endl;
-      //cout << "PID = " << myid << " Physical Memory currently used: " << MemoryUtil::getPhysMemUsed()<<endl;
-      //cout << "PID = " << myid << " Physical Memory currently used by current process: " << MemoryUtil::getPhysMemUsedByMe()<<endl;
-
-      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, visSch));
-      if(myid == 0) UBLOG(logINFO,"Simulation-start");
-      calculation->calculate();
-      if(myid == 0) UBLOG(logINFO,"Simulation-end");
-   }
-   catch(std::exception& e)
-   {
-      cerr << e.what() << endl << flush;
-   }
-   catch(std::string& s)
-   {
-      cerr << s << endl;
-   }
-   catch(...)
-   {
-      cerr << "unknown exception" << endl;
-   }
-
+#include <iostream>
+#include <string>
+
+#include "geometry3d/CoordinateTransformation3D.h"
+#include "Grid3D.h"
+#include "GenBlocksGridVisitor.h"
+#include "geometry3d/GbSystem3D.h"
+#include "geometry3d/GbCuboid3D.h"
+#include "geometry3d/GbCylinder3D.h"
+#include "basics/writer/WbWriterVtkXmlASCII.h"
+#include "basics/writer/WbWriterVtkXmlBinary.h"
+#include "RefineCrossAndInsideGbObjectBlockVisitor.h"
+#include "RatioBlockVisitor.h"
+#include "RatioSmoothBlockVisitor.h"
+#include "OverlapBlockVisitor.h"
+#include "RefineInterGbObjectsVisitor.h"
+#include "SetKernelBlockVisitor.h"
+#include "LBMKernelETD3Q27Cascaded.h"
+#include "D3Q27MacroscopicQuantitiesPostprocessor.h"
+#include "MPICommunicator.h"
+#include "D3Q27ETBCProcessor.h"
+#include "SimulationParameters.h"
+#include "D3Q27SetUndefinedNodesBlockVisitor.h"
+#include "SetInterpolationDirsBlockVisitor.h"
+#include "D3Q27SetConnectorsBlockVisitor.h"
+#include "NullCommunicator.h"
+#include "D3Q27ETInitDistributionsBlockVisitor.h"
+#include "CalculationManager.h"
+#include "PQueuePartitioningGridVisitor.h"
+#include "MetisPartitioningGridVisitor.h"
+#include "D3Q27Interactor.h"
+#include "D3Q27NoSlipBCAdapter.h"
+#include "D3Q27VelocityBCAdapter.h"
+#include "D3Q27DensityBCAdapter.h"
+#include "D3Q27BoundaryConditionAdapter.h"
+#include "StringUtil.hpp"
+#include "D3Q27OffsetInterpolationProcessor.h"
+#include "D3Q27CompactInterpolationProcessor.h"
+#include "D3Q27PressureDifferencePostprocessor.h"
+#include "D3Q27IntegrateValuesHelper.h"
+#include "RestartPostprocessor.h"
+#include "SolidBlocksHelper.h"
+#include "NUPSCounterPostprocessor.h"
+#include "BlocksPostprocessor.h"
+#include "LBMKernelETD3Q27BGK.h"
+#include "EmergencyExitPostprocessor.h"
+#include "D3Q27ForcesPostprocessor.h"
+#include "ConfigFileReader.h"
+#include "MemoryUtil.h"
+#include "LBMKernelETD3Q27CCLB.h"
+
+
+using namespace std;
+
+
+void block_test_all(const char *cstr)
+{
+   try
+   {
+      ConfigFileReader cf(cstr);
+      if ( !cf.read() )
+      {
+         std::string exceptionText = "Unable to read configuration file\n";
+         throw exceptionText;
+      }
+
+      string machine = QUOTEME(CAB_MACHINE);
+      string pathname = cf.getValue("path"); 
+      int numOfThreads = UbSystem::stringTo<int>(cf.getValue("numOfThreads"));
+      double availMem = 0;
+
+      CommunicatorPtr comm(new MPICommunicator());
+      int myid = comm->getProcessID();
+
+      if(machine == "BOMBADIL") 
+      {
+         //pathname = "c:/temp/block_test";
+         availMem = 3.0e9;
+      }
+      else if(machine == "M01" || machine == "M02")      
+      {
+         //pathname = "/work/koskuche/scratch/block_test";
+         availMem = 12.0e9;
+
+         if(myid ==0)
+         {
+            stringstream logFilename;
+            logFilename <<  pathname + "/logfile"+UbSystem::toString(UbSystem::getTimeStamp())+".txt";
+            UbLog::output_policy::setStream(logFilename.str());
+         }
+      }
+      else throw UbException(UB_EXARGS, "unknown CAB_MACHINE");
+
+      double dx = 1;
+
+      const int blocknx1 = UbSystem::stringTo<int>(cf.getValue("blocknx1")); //16;
+      const int blocknx2 = UbSystem::stringTo<int>(cf.getValue("blocknx2"));//16;
+      const int blocknx3 = UbSystem::stringTo<int>(cf.getValue("blocknx3"));//16;
+
+      const int gridNx1 = UbSystem::stringTo<int>(cf.getValue("gridNx1"));//3;
+      const int gridNx2 = UbSystem::stringTo<int>(cf.getValue("gridNx2"));//3;
+      const int gridNx3 = UbSystem::stringTo<int>(cf.getValue("gridNx3"));//3;
+
+
+      double L1 = gridNx1*blocknx1;
+      double L2, L3, H;
+      L2 = L3 = H = gridNx2*blocknx1;
+
+      LBMReal radius = 3;
+      LBMReal uLB = 0.05;
+      LBMReal Re = 300.0;
+      LBMReal rhoLB = 1.0;
+      LBMReal l = L2 / dx;
+      LBMReal nueLB = (((4.0/9.0)*uLB)*2.0*(radius/dx))/Re;
+
+
+      LBMUnitConverterPtr conv = LBMUnitConverterPtr(new LBMUnitConverter());
+
+      const int baseLevel = 0;
+      const int refineLevel = UbSystem::stringTo<int>(cf.getValue("refineLevel"));
+
+      //obstacle
+      GbObject3DPtr cylinder(new GbCylinder3D(L1*0.5, L2*0.5, 0, L1*0.5, L2*0.5, L3, radius));
+      GbSystem3D::writeGeoObject(cylinder.get(),pathname + "/geo/cylinder", WbWriterVtkXmlBinary::getInstance());
+
+      D3Q27InteractorPtr cylinderInt;
+
+      //bounding box
+      double d_minX1 = 0.0;
+      double d_minX2 = 0.0;
+      double d_minX3 = 0.0;
+
+      double d_maxX1 = L1;
+      double d_maxX2 = L2;
+      double d_maxX3 = L3;
+
+      double offs = dx;
+
+      //double g_minX1 = d_minX1-offs-0.499999*dx;
+      double g_minX1 = d_minX1-offs;
+      double g_minX2 = d_minX2-offs;
+      double g_minX3 = d_minX3-offs;
+
+      double g_maxX1 = d_maxX1+offs;
+      double g_maxX2 = d_maxX2+offs;
+      double g_maxX3 = d_maxX3+offs;
+
+      double blockLength = blocknx1*dx;
+
+      //refinement area
+      double off = 1;
+      GbObject3DPtr refineCube(new  GbCuboid3D(cylinder->getX1Minimum()-off, cylinder->getX2Minimum()-off, cylinder->getX3Minimum(), 
+         cylinder->getX1Maximum()+off, cylinder->getX2Maximum()+off, cylinder->getX3Maximum()));
+
+      Grid3DPtr grid(new Grid3D(blocknx1, blocknx2, blocknx3, gridNx1, gridNx2, gridNx3));
+
+
+      if(myid ==0)
+      {
+         UBLOG(logINFO,"Parameters:");
+         UBLOG(logINFO,"L = " << L2/dx );
+         UBLOG(logINFO,"v = " << uLB );
+         UBLOG(logINFO,"rho = " << rhoLB );
+         UBLOG(logINFO,"nue = " << nueLB );
+         UBLOG(logINFO,"Re = " << Re );
+         UBLOG(logINFO,"dx = " << dx );
+         UBLOG(logINFO,"number of levels = " << refineLevel+1 );
+         UBLOG(logINFO,"numOfThreads = " << numOfThreads );
+         UBLOG(logINFO,"Preprozess - start");
+      }
+
+      if(myid ==0) GbSystem3D::writeGeoObject(refineCube.get(),pathname + "/geo/refineCube", WbWriterVtkXmlBinary::getInstance());
+
+      //walls
+      GbCuboid3DPtr addWallYmin (new GbCuboid3D(d_minX1-4.0*blockLength, d_minX2-4.0*blockLength, d_minX3-4.0*blockLength, d_maxX1+4.0*blockLength, d_minX2, d_maxX3+4.0*blockLength));
+      if(myid == 0) GbSystem3D::writeGeoObject(addWallYmin.get(), pathname+"/geo/addWallYmin", WbWriterVtkXmlASCII::getInstance());
+
+      GbCuboid3DPtr addWallZmin (new GbCuboid3D(d_minX1-4.0*blockLength, d_minX2-4.0*blockLength, d_minX3-4.0*blockLength, d_maxX1+4.0*blockLength, d_maxX2+4.0*blockLength, d_minX3));
+      if(myid == 0) GbSystem3D::writeGeoObject(addWallZmin.get(), pathname+"/geo/addWallZmin", WbWriterVtkXmlASCII::getInstance());
+
+      GbCuboid3DPtr addWallYmax (new GbCuboid3D(d_minX1-4.0*blockLength, d_maxX2, d_minX3-4.0*blockLength, d_maxX1+4.0*blockLength, d_maxX2+4.0*blockLength, d_maxX3+4.0*blockLength));
+      if(myid == 0) GbSystem3D::writeGeoObject(addWallYmax.get(), pathname+"/geo/addWallYmax", WbWriterVtkXmlASCII::getInstance());
+
+      GbCuboid3DPtr addWallZmax (new GbCuboid3D(d_minX1-4.0*blockLength, d_minX2-4.0*blockLength, d_maxX3, d_maxX1+4.0*blockLength, d_maxX2+4.0*blockLength, d_maxX3+4.0*blockLength));
+      if(myid == 0) GbSystem3D::writeGeoObject(addWallZmax.get(), pathname+"/geo/addWallZmax", WbWriterVtkXmlASCII::getInstance());
+
+      //inflow
+      GbCuboid3DPtr geoInflow (new GbCuboid3D(d_minX1-4.0*blockLength, d_minX2-4.0*blockLength, d_minX3-4.0*blockLength, d_minX1, d_maxX2+4.0*blockLength, d_maxX3+4.0*blockLength));
+      if(myid == 0) GbSystem3D::writeGeoObject(geoInflow.get(), pathname+"/geo/geoInflow", WbWriterVtkXmlASCII::getInstance());
+
+      //outflow
+      GbCuboid3DPtr geoOutflow (new GbCuboid3D(d_maxX1, d_minX2-4.0*blockLength, d_minX3-4.0*blockLength, d_maxX1+4.0*blockLength, d_maxX2+4.0*blockLength, d_maxX3+4.0*blockLength));
+      if(myid == 0) GbSystem3D::writeGeoObject(geoOutflow.get(), pathname+"/geo/geoOutflow", WbWriterVtkXmlASCII::getInstance());
+
+      BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname + "/grid/blocks", WbWriterVtkXmlBinary::getInstance(), comm));
+
+      if (refineLevel > 0)
+      {
+         if(myid == 0) UBLOG(logINFO,"Refinement - start");	
+         RefineCrossAndInsideGbObjectBlockVisitor refVisitor(refineCube, baseLevel, refineLevel-1);
+         grid->accept(refVisitor);
+
+         RatioBlockVisitor ratioVisitor(refineLevel);
+         grid->accept(ratioVisitor);
+
+         RatioSmoothBlockVisitor ratioSmoothVisitor(refineLevel);
+         grid->accept(ratioSmoothVisitor);
+
+         OverlapBlockVisitor overlapVisitor(refineLevel);
+         grid->accept(overlapVisitor);
+
+         std::vector<int> dirs;
+         D3Q27System::getLBMDirections(dirs);
+         SetInterpolationDirsBlockVisitor interDirsVisitor(dirs);
+         grid->accept(interDirsVisitor);
+         if(myid == 0) UBLOG(logINFO,"Refinement - end");	
+      }
+
+      MetisPartitioningGridVisitor metisVisitor(numOfThreads, D3Q27System::B, comm, true);
+      grid->accept( metisVisitor );
+
+      SolidBlocksHelper sd(grid, comm);
+
+      int bbOption = 1; //0=simple Bounce Back, 1=quadr. BB
+      D3Q27BoundaryConditionAdapterPtr bcObst(new D3Q27NoSlipBCAdapter(bbOption));
+      cylinderInt = D3Q27InteractorPtr ( new D3Q27Interactor(cylinder, grid, bcObst,Interactor3D::SOLID));
+
+      //walls
+      D3Q27InteractorPtr addWallYminInt(new D3Q27Interactor(addWallYmin, grid, bcObst,Interactor3D::SOLID));
+      D3Q27InteractorPtr addWallZminInt(new D3Q27Interactor(addWallZmin, grid, bcObst,Interactor3D::SOLID));
+      D3Q27InteractorPtr addWallYmaxInt(new D3Q27Interactor(addWallYmax, grid, bcObst,Interactor3D::SOLID));
+      D3Q27InteractorPtr addWallZmaxInt(new D3Q27Interactor(addWallZmax, grid, bcObst,Interactor3D::SOLID));
+
+      mu::Parser fct;
+      fct.SetExpr("16*U*x2*x3*(H-x2)*(H-x3)/H^4");
+      fct.DefineConst("U", uLB);
+      fct.DefineConst("H", H);
+
+      //inflow
+      D3Q27BoundaryConditionAdapterPtr velBCAdapter(new D3Q27VelocityBCAdapter (true, false ,false ,fct, 0, D3Q27BCFunction::INFCONST));
+      velBCAdapter->setSecondaryBcOption(2);
+      D3Q27BoundaryConditionAdapterPtr denBCAdapterFront(new D3Q27DensityBCAdapter(rhoLB));
+      denBCAdapterFront->setSecondaryBcOption(1);
+      D3Q27InteractorPtr inflowInt  = D3Q27InteractorPtr( new D3Q27Interactor(geoInflow, grid, velBCAdapter, Interactor3D::SOLID));
+      //D3Q27InteractorPtr inflowInt  = D3Q27InteractorPtr( new D3Q27Interactor(geoInflow, grid, bcObst, Interactor3D::SOLID));
+
+      //outflow
+      D3Q27BoundaryConditionAdapterPtr denBCAdapter(new D3Q27DensityBCAdapter(rhoLB));
+      denBCAdapter->setSecondaryBcOption(1);
+      D3Q27InteractorPtr outflowInt = D3Q27InteractorPtr( new D3Q27Interactor(geoOutflow, grid, denBCAdapter,Interactor3D::SOLID));
+      //D3Q27InteractorPtr outflowInt = D3Q27InteractorPtr( new D3Q27Interactor(geoOutflow, grid, bcObst,Interactor3D::SOLID));
+
+      //sd.addInteractor(cylinderInt);
+      sd.addInteractor(addWallYminInt);
+      sd.addInteractor(addWallZminInt);
+      sd.addInteractor(addWallYmaxInt);
+      sd.addInteractor(addWallZmaxInt);
+      sd.addInteractor(inflowInt);
+      sd.addInteractor(outflowInt);
+
+      sd.deleteSolidBlocks();
+
+      grid->accept( metisVisitor );
+
+      //set connectors
+      D3Q27InterpolationProcessorPtr iProcessor(new D3Q27OffsetInterpolationProcessor());
+      D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
+      grid->accept( setConnsVisitor );
+
+      //domain decomposition for threads
+      //PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
+      //grid->accept(pqPartVisitor);
+
+      ppblocks->update(0);
+      ppblocks.reset();
+
+      unsigned long nob = grid->getNumberOfBlocks();
+      int gl = 3;
+      unsigned long nodb = (blocknx1) * (blocknx2) * (blocknx3);
+      unsigned long nod = nob * (blocknx1) * (blocknx2) * (blocknx3);
+      unsigned long nodg = nob * (blocknx1+gl) * (blocknx2+gl) * (blocknx3+gl);
+      double needMemAll  = double(nodg*(27*sizeof(double) + sizeof(int) + sizeof(float)*4));
+      double needMem  = needMemAll / double(comm->getNumberOfProcesses());
+
+      if(myid == 0)
+      {
+         UBLOG(logINFO,"Number of blocks = " << nob);
+         UBLOG(logINFO,"Number of nodes  = " << nod);
+         int minInitLevel = grid->getCoarsestInitializedLevel();
+         int maxInitLevel = grid->getFinestInitializedLevel();
+         for(int level = minInitLevel; level<=maxInitLevel; level++)
+         {
+            int nobl = grid->getNumberOfBlocks(level);
+            UBLOG(logINFO,"Number of blocks for level " << level <<" = " << nob);
+            UBLOG(logINFO,"Number of nodes for level " << level <<" = " << nob*nodb);
+         }
+         UBLOG(logINFO,"Necessary memory  = " << needMemAll  << " bytes");
+         UBLOG(logINFO,"Necessary memory per process = " << needMem  << " bytes");
+         UBLOG(logINFO,"Available memory per process = " << availMem << " bytes");
+      }            
+
+      int kernelType = UbSystem::stringTo<int>(cf.getValue("kernel"));
+      LBMKernel3DPtr kernel;
+      if (kernelType == 0)
+      {
+         kernel = LBMKernel3DPtr(new LBMKernelETD3Q27BGK(blocknx1, blocknx2, blocknx3, true));
+      }
+      else if (kernelType == 1)
+      {
+         kernel = LBMKernel3DPtr(new LBMKernelETD3Q27Cascaded(blocknx1, blocknx2, blocknx3));
+      }
+      else if (kernelType == 2)
+      {
+         kernel = LBMKernel3DPtr(new LBMKernelETD3Q27CCLB(blocknx1, blocknx2, blocknx3));
+      }
+
+      BCProcessorPtr bcProc(new D3Q27ETBCProcessor());
+      kernel->setBCProcessor(bcProc);
+
+      SetKernelBlockVisitor kernelVisitor(kernel, nueLB, availMem, needMem);
+      grid->accept(kernelVisitor);
+
+      if (refineLevel > 0)
+      {
+         D3Q27SetUndefinedNodesBlockVisitor undefNodesVisitor;
+         grid->accept(undefNodesVisitor);
+      }
+
+      //walls
+      grid->addAndInitInteractor(addWallYminInt);
+      grid->addAndInitInteractor(addWallZminInt);
+      grid->addAndInitInteractor(addWallYmaxInt);
+      grid->addAndInitInteractor(addWallZmaxInt);
+
+      //obstacle
+      //grid->addAndInitInteractor(cylinderInt);
+
+      //inflow
+      grid->addAndInitInteractor(inflowInt);
+
+      //outflow
+      grid->addAndInitInteractor(outflowInt);
+
+      //initialization of distributions
+      D3Q27ETInitDistributionsBlockVisitor initVisitor(1.0);
+      //initVisitor.setVx1(fct);
+      grid->accept(initVisitor);
+
+      //Postrozess
+      UbSchedulerPtr geoSch(new UbScheduler(1));
+      D3Q27MacroscopicQuantitiesPostprocessorPtr ppgeo(
+         new D3Q27MacroscopicQuantitiesPostprocessor(grid, geoSch, pathname + "/grid/nodes", WbWriterVtkXmlBinary::getInstance(), conv, comm, true));
+      ppgeo->update(0);
+      ppgeo.reset();
+
+      if(myid == 0) UBLOG(logINFO,"Preprozess - end"); 
+
+      UbSchedulerPtr nupsSch(new UbScheduler(10, 30, 100));
+      NUPSCounterPostprocessor npr(grid, nupsSch, pathname + "/results/nups.txt", comm);
+
+      double outTime = 1.0;
+      UbSchedulerPtr stepSch(new UbScheduler(outTime));
+      //UbSchedulerPtr stepSch(new UbScheduler());
+      //stepSch->addSchedule(10, 100, 1000);
+      //nodeSch->addSchedule(1000, 1000, 10000);
+      //nodeSch->addSchedule(10000, 10000, 50000);
+      //stepSch->addSchedule(100, 100, 1000);
+
+      D3Q27MacroscopicQuantitiesPostprocessor pp(grid, stepSch, pathname + "/steps/step", WbWriterVtkXmlBinary::getInstance(), conv, comm);
+
+      UbSchedulerPtr visSch(new UbScheduler());
+      //UbSchedulerPtr visSch(stepSch);
+      double endTime = UbSystem::stringTo<int>(cf.getValue("endTime"));//10001.0;
+
+      //cout << "PID = " << myid << " Total Physical Memory (RAM): " << MemoryUtil::getTotalPhysMem()<<endl;
+      //cout << "PID = " << myid << " Physical Memory currently used: " << MemoryUtil::getPhysMemUsed()<<endl;
+      //cout << "PID = " << myid << " Physical Memory currently used by current process: " << MemoryUtil::getPhysMemUsedByMe()<<endl;
+
+      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, visSch));
+      if(myid == 0) UBLOG(logINFO,"Simulation-start");
+      calculation->calculate();
+      if(myid == 0) UBLOG(logINFO,"Simulation-end");
+   }
+   catch(std::exception& e)
+   {
+      cerr << e.what() << endl << flush;
+   }
+   catch(std::string& s)
+   {
+      cerr << s << endl;
+   }
+   catch(...)
+   {
+      cerr << "unknown exception" << endl;
+   }
+
 }
\ No newline at end of file
diff --git a/apps/cpu/block_test/block_test_incompressible.hpp b/apps/cpu/block_test/block_test_incompressible.hpp
index eaa6c1b78838a64416465e2ceabc55a1e1bb4ceb..d7c1c49f4ca01f2899e1d721afdf9d6b47e870cd 100644
--- a/apps/cpu/block_test/block_test_incompressible.hpp
+++ b/apps/cpu/block_test/block_test_incompressible.hpp
@@ -1,522 +1,522 @@
-#include <iostream>
-#include <string>
-
-#include <boost/pointer_cast.hpp>
-
-#include "vfluids.h"
-
-using namespace std;
-
-#include <omp.h>
-
-void block_test_incompressible(const char *cstr1, const char *cstr2)
-{
-
-   try
-   {
-
-      //Sleep(30000);
-
-      ConfigFileReader cf(cstr1);
-      if ( !cf.read() )
-      {
-         std::string exceptionText = "Unable to read configuration file\n";
-         throw exceptionText;
-      }
-
-      string machine = QUOTEME(CAB_MACHINE);
-      string pathname = cf.getValue("path"); 
-      int numOfThreads = UbSystem::stringTo<int>(cf.getValue("numOfThreads"));
-      double availMem = 0;
-
-      CommunicatorPtr comm = MPICommunicator::getInstance();
-      int myid = comm->getProcessID();
-
-      if(machine == "BOMBADIL") 
-      {
-         //pathname = "c:/temp/block_test";
-         availMem = 3.0e9;
-      }
-      else if(machine == "M01" || machine == "M02")      
-      {
-         //pathname = "/work/koskuche/scratch/block_test";
-         availMem = 12.0e9;
-      }
-      else throw UbException(UB_EXARGS, "unknown CAB_MACHINE");
-
-
-      //if(myid ==0)
-      //{
-      //   UbLog::reportingLevel() = logDEBUG5;
-      //   stringstream logFilename;
-      //   logFilename <<  pathname + "/logfile"+UbSystem::toString(UbSystem::getTimeStamp())+"_"+UbSystem::toString(myid)+".txt";
-      //   UbLog::output_policy::setStream(logFilename.str());
-      //}
-
-      double dx = 1.0;
-
-      const int blocknx1 = UbSystem::stringTo<int>(cf.getValue("blocknx1")); //16;
-      const int blocknx2 = UbSystem::stringTo<int>(cf.getValue("blocknx2"));//16;
-      const int blocknx3 = UbSystem::stringTo<int>(cf.getValue("blocknx3"));//16;
-
-      const int gridNx1 = UbSystem::stringTo<int>(cf.getValue("gridNx1"));//3;
-      const int gridNx2 = UbSystem::stringTo<int>(cf.getValue("gridNx2"));//3;
-      const int gridNx3 = UbSystem::stringTo<int>(cf.getValue("gridNx3"));//3;
-
-
-      double L1 = gridNx1*blocknx1*dx;
-      double L2, L3, H;
-      L2 = L3 = H = gridNx2*blocknx1*dx;
-
-      LBMReal radius = 3.0*dx;
-      LBMReal uLB = 0.01;
-      LBMReal Re = 0.5;
-      LBMReal rhoLB = 0.0;
-      LBMReal l = L2 / dx;
-      LBMReal nuLB = (((4.0/9.0)*uLB)*2.0*(radius/dx))/Re;
-      //LBMReal nueLB = 0.005842;
-
-      LBMUnitConverterPtr conv = LBMUnitConverterPtr(new LBMUnitConverter());
-
-      const int baseLevel = 0;
-      const int refineLevel = UbSystem::stringTo<int>(cf.getValue("refineLevel"));
-
-      //bounding box
-      double d_minX1 = 0.0;
-      double d_minX2 = 0.0;
-      double d_minX3 = 0.0;
-
-      double d_maxX1 = L1;
-      double d_maxX2 = L2;
-      double d_maxX3 = L3;
-
-      double offs = 0.0;
-
-      //double g_minX1 = d_minX1-offs-0.499999*dx;
-      double g_minX1 = d_minX1-offs;
-      double g_minX2 = d_minX2-offs;
-      double g_minX3 = d_minX3-offs;
-
-      double g_maxX1 = d_maxX1+offs;
-      double g_maxX2 = d_maxX2+offs;
-      double g_maxX3 = d_maxX3+offs;
-
-      double blockLength = blocknx1*dx;
-
-      //obstacle
-      GbObject3DPtr cylinder(new GbCylinder3D(L1*0.5-2*blockLength, L2*0.5+dx, -1.0*dx, L1*0.5-2*blockLength, L2*0.5+dx, L3+1.0*dx, radius));
-      GbSystem3D::writeGeoObject(cylinder.get(),pathname + "/geo/cylinder", WbWriterVtkXmlBinary::getInstance());
-
-      D3Q27InteractorPtr cylinderInt;
-      D3Q27InteractorPtr addWallZminInt;
-
-      //refinement area
-      double off = dx;
-      GbObject3DPtr refineCube(new  GbCuboid3D(cylinder->getX1Minimum()-off, cylinder->getX2Minimum()-off, cylinder->getX3Minimum(), 
-         cylinder->getX1Maximum()+off, cylinder->getX2Maximum()+off, cylinder->getX3Maximum()));
-
-      GbObject3DPtr gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
-      if(myid ==0) GbSystem3D::writeGeoObject(gridCube.get(),pathname + "/geo/gridCube", WbWriterVtkXmlBinary::getInstance()); 
-
-      Grid3DPtr grid(new Grid3D(comm));
-      grid->setDeltaX(dx);
-      grid->setBlockNX(blocknx1, blocknx2, blocknx3);
-
-      //Grid3DPtr grid(new Grid3D(comm, blocknx1, blocknx2, blocknx3, gridNx1, gridNx2, gridNx3));
-      //grid->setPeriodicX1(true);
-      //grid->setPeriodicX2(true);
-      //grid->setPeriodicX3(true);
-
-      double outTime = 1.0;
-      UbSchedulerPtr stepSch(new UbScheduler(outTime));
-      //PostprocessorPtr pp; //(new D3Q27MacroscopicQuantitiesPostprocessor(grid, stepSch, pathname + "/steps/step", WbWriterVtkXmlASCII::getInstance(), conv, comm));
-
-      //////////////////////////////////////////////////////////////////////////
-      //restart
-      UbSchedulerPtr rSch(new UbScheduler(1000,10,10000));
-      //RestartPostprocessor rp(grid, rSch, comm, pathname, RestartPostprocessor::BINARY);
-      //////////////////////////////////////////////////////////////////////////
-
-      if (grid->getTimeStep() == 0)
-      {
-         GenBlocksGridVisitor genBlocks(gridCube);
-         grid->accept(genBlocks);
-
-         //rp->addPostprocessor(pp);
-         if(myid ==0)
-         {
-            UBLOG(logINFO,"Parameters:");
-            UBLOG(logINFO,"L = " << L2/dx );
-            UBLOG(logINFO,"v = " << uLB );
-            UBLOG(logINFO,"rho = " << rhoLB );
-            UBLOG(logINFO,"nue = " << nuLB );
-            UBLOG(logINFO,"Re = " << Re );
-            UBLOG(logINFO,"dx = " << dx );
-            UBLOG(logINFO,"number of levels = " << refineLevel+1 );
-            UBLOG(logINFO,"numOfThreads = " << numOfThreads );
-            UBLOG(logINFO,"Preprozess - start");
-         }
-
-         if(myid ==0) GbSystem3D::writeGeoObject(refineCube.get(),pathname + "/geo/refineCube", WbWriterVtkXmlBinary::getInstance());
-
-         //walls
-         GbCuboid3DPtr addWallYmin (new GbCuboid3D(d_minX1-blockLength, d_minX2-blockLength, d_minX3-blockLength, d_maxX1+blockLength, d_minX2, d_maxX3+blockLength));
-         if(myid == 0) GbSystem3D::writeGeoObject(addWallYmin.get(), pathname+"/geo/addWallYmin", WbWriterVtkXmlASCII::getInstance());
-
-         GbCuboid3DPtr addWallZmin (new GbCuboid3D(d_minX1-blockLength, d_minX2-blockLength, d_minX3-blockLength, d_maxX1+blockLength, d_maxX2+blockLength, d_minX3));
-         if(myid == 0) GbSystem3D::writeGeoObject(addWallZmin.get(), pathname+"/geo/addWallZmin", WbWriterVtkXmlASCII::getInstance());
-
-         GbCuboid3DPtr addWallYmax (new GbCuboid3D(d_minX1-blockLength, d_maxX2, d_minX3-blockLength, d_maxX1+blockLength, d_maxX2+blockLength, d_maxX3+blockLength));
-         if(myid == 0) GbSystem3D::writeGeoObject(addWallYmax.get(), pathname+"/geo/addWallYmax", WbWriterVtkXmlASCII::getInstance());
-
-         GbCuboid3DPtr addWallZmax (new GbCuboid3D(d_minX1-blockLength, d_minX2-blockLength, d_maxX3, d_maxX1+blockLength, d_maxX2+blockLength, d_maxX3+blockLength));
-         if(myid == 0) GbSystem3D::writeGeoObject(addWallZmax.get(), pathname+"/geo/addWallZmax", WbWriterVtkXmlASCII::getInstance());
-
-         //inflow
-         GbCuboid3DPtr geoInflow (new GbCuboid3D(d_minX1-blockLength, d_minX2-blockLength, d_minX3-blockLength, d_minX1, d_maxX2+blockLength, d_maxX3+blockLength));
-         if(myid == 0) GbSystem3D::writeGeoObject(geoInflow.get(), pathname+"/geo/geoInflow", WbWriterVtkXmlASCII::getInstance());
-
-         //outflow
-         GbCuboid3DPtr geoOutflow (new GbCuboid3D(d_maxX1, d_minX2-blockLength, d_minX3-blockLength, d_maxX1+blockLength, d_maxX2+blockLength, d_maxX3+blockLength));
-         if(myid == 0) GbSystem3D::writeGeoObject(geoOutflow.get(), pathname+"/geo/geoOutflow", WbWriterVtkXmlASCII::getInstance());
-
-         //GbCuboid3DPtr addWallYmax (new GbCuboid3D(d_minX1-4.0*blockLength, d_maxX2-2*dx, d_minX3-4.0*blockLength, d_maxX1+4.0*blockLength, d_maxX2+4.0*blockLength, d_maxX3+4.0*blockLength));
-         //if(myid == 0) GbSystem3D::writeGeoObject(addWallYmax.get(), pathname+"/geo/addWallYmax", WbWriterVtkXmlASCII::getInstance());
-
-         //GbCuboid3DPtr addWallZmax (new GbCuboid3D(d_minX1-4.0*blockLength, d_minX2-4.0*blockLength, d_maxX3-2*dx, d_maxX1+4.0*blockLength, d_maxX2+4.0*blockLength, d_maxX3+4.0*blockLength));
-         //if(myid == 0) GbSystem3D::writeGeoObject(addWallZmax.get(), pathname+"/geo/addWallZmax", WbWriterVtkXmlASCII::getInstance());
-
-         ////inflow
-         //GbCuboid3DPtr geoInflow (new GbCuboid3D(d_minX1-4.0*blockLength, d_minX2-4.0*blockLength, d_minX3-4.0*blockLength, d_minX1+2*dx, d_maxX2+4.0*blockLength, d_maxX3+4.0*blockLength));
-         //if(myid == 0) GbSystem3D::writeGeoObject(geoInflow.get(), pathname+"/geo/geoInflow", WbWriterVtkXmlASCII::getInstance());
-
-         ////outflow
-         //GbCuboid3DPtr geoOutflow (new GbCuboid3D(d_maxX1-2*dx, d_minX2-4.0*blockLength, d_minX3-4.0*blockLength, d_maxX1+4.0*blockLength, d_maxX2+4.0*blockLength, d_maxX3+4.0*blockLength));
-         //if(myid == 0) GbSystem3D::writeGeoObject(geoOutflow.get(), pathname+"/geo/geoOutflow", WbWriterVtkXmlASCII::getInstance());
-
-         BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm));
-
-         if (refineLevel > 0)
-         {
-            if(myid == 0) UBLOG(logINFO,"Refinement - start");	
-            RefineCrossAndInsideGbObjectHelper refineHelper(grid, refineLevel);
-            refineHelper.addGbObject(refineCube, refineLevel);
-            refineHelper.refine();
-            if(myid == 0) UBLOG(logINFO,"Refinement - end");	
-         }
-
-
-         int bbOptionC = 1; //0=simple Bounce Back, 1=quadr. BB
-         D3Q27BoundaryConditionAdapterPtr bcObstC(new D3Q27NoSlipBCAdapter(bbOptionC));
-         cylinderInt = D3Q27InteractorPtr ( new D3Q27Interactor(cylinder, grid, bcObstC,Interactor3D::SOLID));
-
-         int bbOption = 1; //0=simple Bounce Back, 1=quadr. BB
-         D3Q27BoundaryConditionAdapterPtr bcObst(new D3Q27NoSlipBCAdapter(bbOption));
-         //walls
-         D3Q27InteractorPtr addWallYminInt(new D3Q27Interactor(addWallYmin, grid, bcObst,Interactor3D::SOLID));
-         addWallZminInt = D3Q27InteractorPtr(new D3Q27Interactor(addWallZmin, grid, bcObst,Interactor3D::SOLID));
-         D3Q27InteractorPtr addWallYmaxInt(new D3Q27Interactor(addWallYmax, grid, bcObst,Interactor3D::SOLID));
-         D3Q27InteractorPtr addWallZmaxInt(new D3Q27Interactor(addWallZmax, grid, bcObst,Interactor3D::SOLID));
-
-         mu::Parser fct;
-         //fct.SetExpr("16*U*x2*x3*(H-x2)*(H-x3)/H^4");
-         //fct.SetExpr("-4*U*(x2^2-H*x2)/H^2");
-         //fct.DefineConst("U", 3/2*uLB);
-         //fct.DefineConst("H", H);
-
-         fct.SetExpr("U");
-         fct.DefineConst("U", uLB);
-
-         //inflow
-         D3Q27BoundaryConditionAdapterPtr velBCAdapter(new D3Q27VelocityBCAdapter (true, false ,false ,fct, 0, D3Q27BCFunction::INFCONST));
-         velBCAdapter->setSecondaryBcOption(2);
-         //double dp_Ph=0.1*10000.0;//
-         //double dp_lb=dp_Ph*0.001*(nueLB*dx)*(nueLB*dx);//nue_ph=10e-6
-         //if(myid == 0) UBLOG(logINFO,"dp_lb = " << dp_lb );
-         //D3Q27BoundaryConditionAdapterPtr denBCAdapterFront(new D3Q27DensityBCAdapter(3.0*(dp_lb-rhoLB)));
-         //denBCAdapterFront->setSecondaryBcOption(0);
-         D3Q27InteractorPtr inflowInt  = D3Q27InteractorPtr( new D3Q27Interactor(geoInflow, grid, velBCAdapter, Interactor3D::SOLID));
-         //D3Q27InteractorPtr inflowInt  = D3Q27InteractorPtr( new D3Q27Interactor(geoInflow, grid, denBCAdapterFront, Interactor3D::SOLID));
-
-         //outflow
-         D3Q27BoundaryConditionAdapterPtr denBCAdapter(new D3Q27DensityBCAdapter(rhoLB));
-         denBCAdapter->setSecondaryBcOption(0);
-         D3Q27InteractorPtr outflowInt = D3Q27InteractorPtr( new D3Q27Interactor(geoOutflow, grid, denBCAdapter,Interactor3D::SOLID));
-         //D3Q27InteractorPtr outflowInt = D3Q27InteractorPtr( new D3Q27Interactor(geoOutflow, grid, bcObst,Interactor3D::SOLID));
-
-         Grid3DVisitorPtr metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B));
-         InteractorsHelper intHelper(grid, metisVisitor);
-         intHelper.addInteractor(cylinderInt);
-         intHelper.addInteractor(addWallYminInt);
-         intHelper.addInteractor(addWallZminInt);
-         intHelper.addInteractor(addWallYmaxInt);
-         intHelper.addInteractor(addWallZmaxInt);
-         intHelper.addInteractor(inflowInt);
-         intHelper.addInteractor(outflowInt);
-         intHelper.selectBlocks();
-
-         //set connectors
-         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
-         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
-         grid->accept( setConnsVisitor );
-
-         //domain decomposition for threads
-         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
-         grid->accept(pqPartVisitor);
-
-         ppblocks->update(0);
-         ppblocks.reset();
-
-         unsigned long nob = grid->getNumberOfBlocks();
-         int gl = 3;
-         unsigned long nodb = (blocknx1) * (blocknx2) * (blocknx3);
-         unsigned long nod = nob * (blocknx1) * (blocknx2) * (blocknx3);
-         unsigned long nodg = nob * (blocknx1+gl) * (blocknx2+gl) * (blocknx3+gl);
-         double needMemAll  = double(nodg*(27*sizeof(double) + sizeof(int) + sizeof(float)*4));
-         double needMem  = needMemAll / double(comm->getNumberOfProcesses());
-
-         if(myid == 0)
-         {
-            UBLOG(logINFO,"Number of blocks = " << nob);
-            UBLOG(logINFO,"Number of nodes  = " << nod);
-            int minInitLevel = grid->getCoarsestInitializedLevel();
-            int maxInitLevel = grid->getFinestInitializedLevel();
-            for(int level = minInitLevel; level<=maxInitLevel; level++)
-            {
-               int nobl = grid->getNumberOfBlocks(level);
-               UBLOG(logINFO,"Number of blocks for level " << level <<" = " << nob);
-               UBLOG(logINFO,"Number of nodes for level " << level <<" = " << nob*nodb);
-            }
-            UBLOG(logINFO,"Necessary memory  = " << needMemAll  << " bytes");
-            UBLOG(logINFO,"Necessary memory per process = " << needMem  << " bytes");
-            UBLOG(logINFO,"Available memory per process = " << availMem << " bytes");
-         }            
-
-         //int kernelType = UbSystem::stringTo<int>(cf.getValue("kernel"));
-         LBMKernel3DPtr kernel;
-         //if (kernelType == 0)
-         //{
-         //   rhoLB = 1.0;
-         //   kernel = LBMKernel3DPtr(new LBMKernelETD3Q27BGK(blocknx1, blocknx2, blocknx3, true));
-         //}
-         //else if (kernelType == 1)
-         //{
-         //   rhoLB = 1.0;
-         //   kernel = LBMKernel3DPtr(new LBMKernelETD3Q27Cascaded(blocknx1, blocknx2, blocknx3));
-         //}
-         //else if (kernelType == 2)
-         //{
-            rhoLB = 0.0;
-            kernel = LBMKernel3DPtr(new LBMKernelETD3Q27CCLB(blocknx1, blocknx2, blocknx3, LBMKernelETD3Q27CCLB::NORMAL));
-            //kernel = LBMKernel3DPtr(new LBMKernelETD3Q27CCLBWithSpongeLayer(blocknx1, blocknx2, blocknx3, LBMKernelETD3Q27CCLB::NORMAL));
-            //int nx[4];
-            //nx[0]=gridNx1*blocknx1*(1<<refineLevel);
-            //nx[1]=gridNx2*blocknx2*(1<<refineLevel);
-            //nx[2]=gridNx3*blocknx3*(1<<refineLevel);
-            //nx[3]=refineLevel+1;
-            //EsoTwistD3Q27SparseData::setSize(nx);
-            //kernel = LBMKernel3DPtr(new LBMKernelETD3Q27CCLBSparse(blocknx1, blocknx2, blocknx3, LBMKernelETD3Q27CCLBSparse::NORMAL));
-            //kernel = LBMKernel3DPtr(new LBMKernelESD3Q27CCLB(blocknx1, blocknx2, blocknx3, grid));
-            //kernel = LBMKernel3DPtr(new LBMKernelETD3Q27CCLBex(blocknx1, blocknx2, blocknx3, 0, grid));
-         //}
-
-         //int sizeSP=2;
-         //mu::Parser spongeLayer;
-         //spongeLayer.SetExpr("x1>=(sizeX-sizeSP)/dx ? (sizeX-(x1+1))/sizeSP/2.0 + 0.5 : 1.0");
-         //spongeLayer.DefineConst("sizeX", gridNx1*blocknx1);
-         //spongeLayer.DefineConst("sizeSP", sizeSP*blocknx1);
-         //kernel->setWithSpongeLayer(true);
-         //kernel->setSpongeLayer(spongeLayer);
-
-
-
-         //mu::Parser fctForcingX1;
-         //fctForcingX1.SetExpr("Fx1");
-         //fctForcingX1.DefineConst("Fx1", 9.99685e-7);
-
-         //kernel->setForcingX1(fctForcingX1);
-         //kernel->setWithForcing(true);
-         //
-         BCProcessorPtr bcProc(new D3Q27ETBCProcessor());
-         //BCProcessorPtr bcProc(new D3Q27ETForThinWallBCProcessor());
-         kernel->setBCProcessor(bcProc);
-
-         SetKernelBlockVisitor kernelVisitor(kernel, nuLB, availMem, needMem);
-
-         grid->accept(kernelVisitor);
-
-         //////////////////////////////////////////////////////////////////////////
-         //Experemintel
-         //////////////////////////////////////////////////////////////////////////
-         //int minInitLevel = grid->getCoarsestInitializedLevel();
-
-         //for(int level = minInitLevel; level<=maxInitLevel; level++)
-         //{
-         //   vector<Block3DPtr> blockVector;
-         //   grid->getBlocks(level, blockVector);
-         //   BOOST_FOREACH(Block3DPtr block, blockVector)
-         //   {
-         //      if (block)
-         //      {
-         //         boost::dynamic_pointer_cast<LBMKernelESD3Q27CCLB>(block->getKernel())->initNeighbours();
-         //      }
-         //   }
-         //}
-         //////////////////////////////////////////////////////////////////////////
-
-
-         if (refineLevel > 0)
-         {
-            D3Q27SetUndefinedNodesBlockVisitor undefNodesVisitor;
-            grid->accept(undefNodesVisitor);
-         }
-
-         //UbSchedulerPtr geoSch(new UbScheduler(1));
-         //D3Q27MacroscopicQuantitiesPostprocessorPtr ppgeo(
-         // new D3Q27MacroscopicQuantitiesPostprocessor(grid, geoSch, pathname + "/grid/nodes", WbWriterVtkXmlBinary::getInstance(), conv, comm, true));
-         //ppgeo->update(0);
-         //ppgeo.reset();
-
-         //return;
-
-         intHelper.setBC();
-
-         //initialization of distributions
-         D3Q27ETInitDistributionsBlockVisitor initVisitor(nuLB, rhoLB);
-         //initVisitor.setVx1(fct);
-         //initVisitor.setNu(nueLB);
-         //initVisitor.setVx1(0.01);
-         //initVisitor.setVx2(0.02);
-         //initVisitor.setVx3(0.03);
-         grid->accept(initVisitor);
-
-         //Postrozess
-         //UbSchedulerPtr geoSch(new UbScheduler(1));
-         //D3Q27MacroscopicQuantitiesPostprocessorPtr ppgeo(
-         //   new D3Q27MacroscopicQuantitiesPostprocessor(grid, geoSch, pathname + "/grid/nodes", WbWriterVtkXmlBinary::getInstance(), conv, comm, true));
-         //ppgeo->update(0);
-         //ppgeo.reset();
-
-         {
-            UbSchedulerPtr geoSch(new UbScheduler(1));
-            //D3Q27MacroscopicQuantitiesPostprocessor ppgeo(grid,geoSch, pathname + "/grid/nodes", WbWriterVtkXmlBinary::getInstance(), conv,  comm, true);
-            D3Q27MacroscopicQuantitiesPostprocessorPtr ppgeo(
-               new D3Q27MacroscopicQuantitiesPostprocessor(grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, true));
-            //grid->addObserver(ppgeo);
-            grid->doPostProcess(0);
-            //grid->notifyObservers(0);
-            //grid->removeObserver(ppgeo);
-         }
-
-         //grid->notifyObservers(0);
-
-         //UbSchedulerPtr stepSch(new UbScheduler(outTime));
-         //D3Q27MacroscopicQuantitiesPostprocessorPtr pp(new D3Q27MacroscopicQuantitiesPostprocessor(grid, stepSch, pathname + "/steps/step", WbWriterVtkXmlASCII::getInstance(), conv));
-         //rp->addPostprocessor(pp);
-
-         //for (int i=0; i < 10; i++)
-         //{
-         //   grid->doPostProcess(i);
-         //}
-
-         //return;
-
-         //UbSchedulerPtr rs(new UbScheduler(3));
-         //D3Q27ShearStressPostprocessorPtr shsPp(new D3Q27ShearStressPostprocessor(grid,pathname + "/shs/shs", WbWriterVtkXmlASCII::getInstance(), stepSch, rs));
-         //shsPp->addInteractor(boost::dynamic_pointer_cast<D3Q27Interactor>(addWallZminInt));
-         //rp->addPostprocessor(shsPp);
-
-         if(myid == 0) UBLOG(logINFO,"Preprozess - end"); 
-      }
-
-      else
-      {
-         //set connectors
-         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
-         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
-         grid->accept( setConnsVisitor );
-         if(myid == 0) UBLOG(logINFO,"Restart - end"); 
-      }
-      UbSchedulerPtr nupsSch(new UbScheduler(10, 30, 100));
-      NUPSCounterPostprocessor npr(grid, nupsSch, numOfThreads, comm);
-
-      //UbSchedulerPtr visSch(new UbScheduler());
-      //visSch->addSchedule(1,1,3);
-      //visSch->addSchedule(100,100,1000);
-      //visSch->addSchedule(1000,1000,5000);
-      //visSch->addSchedule(5000,5000,100000);
-      //visSch->addSchedule(100000,100000,10000000);
-
-      
-      D3Q27IntegrateValuesHelperPtr ih1(new D3Q27IntegrateValuesHelper(grid, comm, gridCube->getX1Minimum(), gridCube->getX2Minimum(), gridCube->getX3Minimum(), 
-         gridCube->getX1Maximum(), gridCube->getX2Maximum(), gridCube->getX3Maximum()));
-      if (myid == 0) GbSystem3D::writeGeoObject(ih1->getBoundingBox().get(), pathname + "/geo/ih1", WbWriterVtkXmlBinary::getInstance());
-
-      double factorp = 1; // dp_real / dp_LB;
-      double factorv = 1;// dx / dt;
-      UbSchedulerPtr stepMV(new UbScheduler(500));
-
-      TimeseriesPostprocessor tsp(grid, stepMV, ih1, pathname+cf.getValue("timeSeriesOut"), comm);
-
-      UbSchedulerPtr visSch(stepSch);
-
-      //UbSchedulerPtr avSch(new UbScheduler());
-      //avSch->addSchedule(100,100,10000);
-      //
-      //double startStep = 32000;
-      //UbSchedulerPtr resSchRMS(new UbScheduler());
-      //resSchRMS->addSchedule(100000, startStep, 10000000);
-      //UbSchedulerPtr resSchMeans(new UbScheduler());
-      //resSchMeans->addSchedule(100000, startStep, 10000000);
-      //UbSchedulerPtr stepAvSch(new UbScheduler());
-      //int averageInterval=100;
-      //stepAvSch->addSchedule(averageInterval,0,10000000);
-
-      //AverageValuesPostprocessor Avpp(grid, pathname, WbWriterVtkXmlBinary::getInstance(), visSch/*wann wird rausgeschrieben*/, stepAvSch/*wann wird gemittelt*/, resSchMeans,resSchRMS/*wann wird resettet*/);
-
-      UbSchedulerPtr emSch(new UbScheduler(100));
-      //EmergencyExitPostprocessor empr(grid, emSch, pathname, RestartPostprocessorPtr(&rp), comm);
-
-      //rp->addPostprocessor(avPp);
-
-      //D3Q27ShearStressPostprocessor shs(grid,pathname, WbWriterVtkXmlASCII::getInstance(), stepSch, resSchMeans);
-      //shs.addInteractor(boost::dynamic_pointer_cast<D3Q27Interactor>(addWallZminInt));
-
-      D3Q27MacroscopicQuantitiesPostprocessor pp(grid, stepSch, pathname, WbWriterVtkXmlASCII::getInstance(), conv);
-
-      //UbSchedulerPtr visSch(new UbScheduler(1));
-
-      double endTime = UbSystem::stringTo<int>(cf.getValue("endTime"));//10001.0;
-
-      cout << "PID = " << myid << " Total Physical Memory (RAM): " << Utilities::getTotalPhysMem()<<endl;
-      cout << "PID = " << myid << " Physical Memory currently used: " << Utilities::getPhysMemUsed()<<endl;
-      cout << "PID = " << myid << " Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe()<<endl;
-
-      //#pragma omp parallel num_threads(4)
-      //      {
-      //         int i = omp_get_thread_num();
-      //         printf_s("Hello from thread %d\n", i);
-      //      }
-
-      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, visSch));
-      if(myid == 0) UBLOG(logINFO,"Simulation-start");
-      calculation->calculate();
-      if(myid == 0) UBLOG(logINFO,"Simulation-end");
-   }
-   catch(std::exception& e)
-   {
-      cerr << e.what() << endl << flush;
-   }
-   catch(std::string& s)
-   {
-      cerr << s << endl;
-   }
-   catch(...)
-   {
-      cerr << "unknown exception" << endl;
-   }
-
-}
-
-
-
+#include <iostream>
+#include <string>
+
+#include <boost/pointer_cast.hpp>
+
+#include "vfluids.h"
+
+using namespace std;
+
+#include <omp.h>
+
+void block_test_incompressible(const char *cstr1, const char *cstr2)
+{
+
+   try
+   {
+
+      //Sleep(30000);
+
+      ConfigFileReader cf(cstr1);
+      if ( !cf.read() )
+      {
+         std::string exceptionText = "Unable to read configuration file\n";
+         throw exceptionText;
+      }
+
+      string machine = QUOTEME(CAB_MACHINE);
+      string pathname = cf.getValue("path"); 
+      int numOfThreads = UbSystem::stringTo<int>(cf.getValue("numOfThreads"));
+      double availMem = 0;
+
+      CommunicatorPtr comm = MPICommunicator::getInstance();
+      int myid = comm->getProcessID();
+
+      if(machine == "BOMBADIL") 
+      {
+         //pathname = "c:/temp/block_test";
+         availMem = 3.0e9;
+      }
+      else if(machine == "M01" || machine == "M02")      
+      {
+         //pathname = "/work/koskuche/scratch/block_test";
+         availMem = 12.0e9;
+      }
+      else throw UbException(UB_EXARGS, "unknown CAB_MACHINE");
+
+
+      //if(myid ==0)
+      //{
+      //   UbLog::reportingLevel() = logDEBUG5;
+      //   stringstream logFilename;
+      //   logFilename <<  pathname + "/logfile"+UbSystem::toString(UbSystem::getTimeStamp())+"_"+UbSystem::toString(myid)+".txt";
+      //   UbLog::output_policy::setStream(logFilename.str());
+      //}
+
+      double dx = 1.0;
+
+      const int blocknx1 = UbSystem::stringTo<int>(cf.getValue("blocknx1")); //16;
+      const int blocknx2 = UbSystem::stringTo<int>(cf.getValue("blocknx2"));//16;
+      const int blocknx3 = UbSystem::stringTo<int>(cf.getValue("blocknx3"));//16;
+
+      const int gridNx1 = UbSystem::stringTo<int>(cf.getValue("gridNx1"));//3;
+      const int gridNx2 = UbSystem::stringTo<int>(cf.getValue("gridNx2"));//3;
+      const int gridNx3 = UbSystem::stringTo<int>(cf.getValue("gridNx3"));//3;
+
+
+      double L1 = gridNx1*blocknx1*dx;
+      double L2, L3, H;
+      L2 = L3 = H = gridNx2*blocknx1*dx;
+
+      LBMReal radius = 3.0*dx;
+      LBMReal uLB = 0.01;
+      LBMReal Re = 0.5;
+      LBMReal rhoLB = 0.0;
+      LBMReal l = L2 / dx;
+      LBMReal nuLB = (((4.0/9.0)*uLB)*2.0*(radius/dx))/Re;
+      //LBMReal nueLB = 0.005842;
+
+      LBMUnitConverterPtr conv = LBMUnitConverterPtr(new LBMUnitConverter());
+
+      const int baseLevel = 0;
+      const int refineLevel = UbSystem::stringTo<int>(cf.getValue("refineLevel"));
+
+      //bounding box
+      double d_minX1 = 0.0;
+      double d_minX2 = 0.0;
+      double d_minX3 = 0.0;
+
+      double d_maxX1 = L1;
+      double d_maxX2 = L2;
+      double d_maxX3 = L3;
+
+      double offs = 0.0;
+
+      //double g_minX1 = d_minX1-offs-0.499999*dx;
+      double g_minX1 = d_minX1-offs;
+      double g_minX2 = d_minX2-offs;
+      double g_minX3 = d_minX3-offs;
+
+      double g_maxX1 = d_maxX1+offs;
+      double g_maxX2 = d_maxX2+offs;
+      double g_maxX3 = d_maxX3+offs;
+
+      double blockLength = blocknx1*dx;
+
+      //obstacle
+      GbObject3DPtr cylinder(new GbCylinder3D(L1*0.5-2*blockLength, L2*0.5+dx, -1.0*dx, L1*0.5-2*blockLength, L2*0.5+dx, L3+1.0*dx, radius));
+      GbSystem3D::writeGeoObject(cylinder.get(),pathname + "/geo/cylinder", WbWriterVtkXmlBinary::getInstance());
+
+      D3Q27InteractorPtr cylinderInt;
+      D3Q27InteractorPtr addWallZminInt;
+
+      //refinement area
+      double off = dx;
+      GbObject3DPtr refineCube(new  GbCuboid3D(cylinder->getX1Minimum()-off, cylinder->getX2Minimum()-off, cylinder->getX3Minimum(), 
+         cylinder->getX1Maximum()+off, cylinder->getX2Maximum()+off, cylinder->getX3Maximum()));
+
+      GbObject3DPtr gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
+      if(myid ==0) GbSystem3D::writeGeoObject(gridCube.get(),pathname + "/geo/gridCube", WbWriterVtkXmlBinary::getInstance()); 
+
+      Grid3DPtr grid(new Grid3D(comm));
+      grid->setDeltaX(dx);
+      grid->setBlockNX(blocknx1, blocknx2, blocknx3);
+
+      //Grid3DPtr grid(new Grid3D(comm, blocknx1, blocknx2, blocknx3, gridNx1, gridNx2, gridNx3));
+      //grid->setPeriodicX1(true);
+      //grid->setPeriodicX2(true);
+      //grid->setPeriodicX3(true);
+
+      double outTime = 1.0;
+      UbSchedulerPtr stepSch(new UbScheduler(outTime));
+      //PostprocessorPtr pp; //(new D3Q27MacroscopicQuantitiesPostprocessor(grid, stepSch, pathname + "/steps/step", WbWriterVtkXmlASCII::getInstance(), conv, comm));
+
+      //////////////////////////////////////////////////////////////////////////
+      //restart
+      UbSchedulerPtr rSch(new UbScheduler(1000,10,10000));
+      //RestartPostprocessor rp(grid, rSch, comm, pathname, RestartPostprocessor::BINARY);
+      //////////////////////////////////////////////////////////////////////////
+
+      if (grid->getTimeStep() == 0)
+      {
+         GenBlocksGridVisitor genBlocks(gridCube);
+         grid->accept(genBlocks);
+
+         //rp->addPostprocessor(pp);
+         if(myid ==0)
+         {
+            UBLOG(logINFO,"Parameters:");
+            UBLOG(logINFO,"L = " << L2/dx );
+            UBLOG(logINFO,"v = " << uLB );
+            UBLOG(logINFO,"rho = " << rhoLB );
+            UBLOG(logINFO,"nue = " << nuLB );
+            UBLOG(logINFO,"Re = " << Re );
+            UBLOG(logINFO,"dx = " << dx );
+            UBLOG(logINFO,"number of levels = " << refineLevel+1 );
+            UBLOG(logINFO,"numOfThreads = " << numOfThreads );
+            UBLOG(logINFO,"Preprozess - start");
+         }
+
+         if(myid ==0) GbSystem3D::writeGeoObject(refineCube.get(),pathname + "/geo/refineCube", WbWriterVtkXmlBinary::getInstance());
+
+         //walls
+         GbCuboid3DPtr addWallYmin (new GbCuboid3D(d_minX1-blockLength, d_minX2-blockLength, d_minX3-blockLength, d_maxX1+blockLength, d_minX2, d_maxX3+blockLength));
+         if(myid == 0) GbSystem3D::writeGeoObject(addWallYmin.get(), pathname+"/geo/addWallYmin", WbWriterVtkXmlASCII::getInstance());
+
+         GbCuboid3DPtr addWallZmin (new GbCuboid3D(d_minX1-blockLength, d_minX2-blockLength, d_minX3-blockLength, d_maxX1+blockLength, d_maxX2+blockLength, d_minX3));
+         if(myid == 0) GbSystem3D::writeGeoObject(addWallZmin.get(), pathname+"/geo/addWallZmin", WbWriterVtkXmlASCII::getInstance());
+
+         GbCuboid3DPtr addWallYmax (new GbCuboid3D(d_minX1-blockLength, d_maxX2, d_minX3-blockLength, d_maxX1+blockLength, d_maxX2+blockLength, d_maxX3+blockLength));
+         if(myid == 0) GbSystem3D::writeGeoObject(addWallYmax.get(), pathname+"/geo/addWallYmax", WbWriterVtkXmlASCII::getInstance());
+
+         GbCuboid3DPtr addWallZmax (new GbCuboid3D(d_minX1-blockLength, d_minX2-blockLength, d_maxX3, d_maxX1+blockLength, d_maxX2+blockLength, d_maxX3+blockLength));
+         if(myid == 0) GbSystem3D::writeGeoObject(addWallZmax.get(), pathname+"/geo/addWallZmax", WbWriterVtkXmlASCII::getInstance());
+
+         //inflow
+         GbCuboid3DPtr geoInflow (new GbCuboid3D(d_minX1-blockLength, d_minX2-blockLength, d_minX3-blockLength, d_minX1, d_maxX2+blockLength, d_maxX3+blockLength));
+         if(myid == 0) GbSystem3D::writeGeoObject(geoInflow.get(), pathname+"/geo/geoInflow", WbWriterVtkXmlASCII::getInstance());
+
+         //outflow
+         GbCuboid3DPtr geoOutflow (new GbCuboid3D(d_maxX1, d_minX2-blockLength, d_minX3-blockLength, d_maxX1+blockLength, d_maxX2+blockLength, d_maxX3+blockLength));
+         if(myid == 0) GbSystem3D::writeGeoObject(geoOutflow.get(), pathname+"/geo/geoOutflow", WbWriterVtkXmlASCII::getInstance());
+
+         //GbCuboid3DPtr addWallYmax (new GbCuboid3D(d_minX1-4.0*blockLength, d_maxX2-2*dx, d_minX3-4.0*blockLength, d_maxX1+4.0*blockLength, d_maxX2+4.0*blockLength, d_maxX3+4.0*blockLength));
+         //if(myid == 0) GbSystem3D::writeGeoObject(addWallYmax.get(), pathname+"/geo/addWallYmax", WbWriterVtkXmlASCII::getInstance());
+
+         //GbCuboid3DPtr addWallZmax (new GbCuboid3D(d_minX1-4.0*blockLength, d_minX2-4.0*blockLength, d_maxX3-2*dx, d_maxX1+4.0*blockLength, d_maxX2+4.0*blockLength, d_maxX3+4.0*blockLength));
+         //if(myid == 0) GbSystem3D::writeGeoObject(addWallZmax.get(), pathname+"/geo/addWallZmax", WbWriterVtkXmlASCII::getInstance());
+
+         ////inflow
+         //GbCuboid3DPtr geoInflow (new GbCuboid3D(d_minX1-4.0*blockLength, d_minX2-4.0*blockLength, d_minX3-4.0*blockLength, d_minX1+2*dx, d_maxX2+4.0*blockLength, d_maxX3+4.0*blockLength));
+         //if(myid == 0) GbSystem3D::writeGeoObject(geoInflow.get(), pathname+"/geo/geoInflow", WbWriterVtkXmlASCII::getInstance());
+
+         ////outflow
+         //GbCuboid3DPtr geoOutflow (new GbCuboid3D(d_maxX1-2*dx, d_minX2-4.0*blockLength, d_minX3-4.0*blockLength, d_maxX1+4.0*blockLength, d_maxX2+4.0*blockLength, d_maxX3+4.0*blockLength));
+         //if(myid == 0) GbSystem3D::writeGeoObject(geoOutflow.get(), pathname+"/geo/geoOutflow", WbWriterVtkXmlASCII::getInstance());
+
+         BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm));
+
+         if (refineLevel > 0)
+         {
+            if(myid == 0) UBLOG(logINFO,"Refinement - start");	
+            RefineCrossAndInsideGbObjectHelper refineHelper(grid, refineLevel);
+            refineHelper.addGbObject(refineCube, refineLevel);
+            refineHelper.refine();
+            if(myid == 0) UBLOG(logINFO,"Refinement - end");	
+         }
+
+
+         int bbOptionC = 1; //0=simple Bounce Back, 1=quadr. BB
+         D3Q27BoundaryConditionAdapterPtr bcObstC(new D3Q27NoSlipBCAdapter(bbOptionC));
+         cylinderInt = D3Q27InteractorPtr ( new D3Q27Interactor(cylinder, grid, bcObstC,Interactor3D::SOLID));
+
+         int bbOption = 1; //0=simple Bounce Back, 1=quadr. BB
+         D3Q27BoundaryConditionAdapterPtr bcObst(new D3Q27NoSlipBCAdapter(bbOption));
+         //walls
+         D3Q27InteractorPtr addWallYminInt(new D3Q27Interactor(addWallYmin, grid, bcObst,Interactor3D::SOLID));
+         addWallZminInt = D3Q27InteractorPtr(new D3Q27Interactor(addWallZmin, grid, bcObst,Interactor3D::SOLID));
+         D3Q27InteractorPtr addWallYmaxInt(new D3Q27Interactor(addWallYmax, grid, bcObst,Interactor3D::SOLID));
+         D3Q27InteractorPtr addWallZmaxInt(new D3Q27Interactor(addWallZmax, grid, bcObst,Interactor3D::SOLID));
+
+         mu::Parser fct;
+         //fct.SetExpr("16*U*x2*x3*(H-x2)*(H-x3)/H^4");
+         //fct.SetExpr("-4*U*(x2^2-H*x2)/H^2");
+         //fct.DefineConst("U", 3/2*uLB);
+         //fct.DefineConst("H", H);
+
+         fct.SetExpr("U");
+         fct.DefineConst("U", uLB);
+
+         //inflow
+         D3Q27BoundaryConditionAdapterPtr velBCAdapter(new D3Q27VelocityBCAdapter (true, false ,false ,fct, 0, D3Q27BCFunction::INFCONST));
+         velBCAdapter->setSecondaryBcOption(2);
+         //double dp_Ph=0.1*10000.0;//
+         //double dp_lb=dp_Ph*0.001*(nueLB*dx)*(nueLB*dx);//nue_ph=10e-6
+         //if(myid == 0) UBLOG(logINFO,"dp_lb = " << dp_lb );
+         //D3Q27BoundaryConditionAdapterPtr denBCAdapterFront(new D3Q27DensityBCAdapter(3.0*(dp_lb-rhoLB)));
+         //denBCAdapterFront->setSecondaryBcOption(0);
+         D3Q27InteractorPtr inflowInt  = D3Q27InteractorPtr( new D3Q27Interactor(geoInflow, grid, velBCAdapter, Interactor3D::SOLID));
+         //D3Q27InteractorPtr inflowInt  = D3Q27InteractorPtr( new D3Q27Interactor(geoInflow, grid, denBCAdapterFront, Interactor3D::SOLID));
+
+         //outflow
+         D3Q27BoundaryConditionAdapterPtr denBCAdapter(new D3Q27DensityBCAdapter(rhoLB));
+         denBCAdapter->setSecondaryBcOption(0);
+         D3Q27InteractorPtr outflowInt = D3Q27InteractorPtr( new D3Q27Interactor(geoOutflow, grid, denBCAdapter,Interactor3D::SOLID));
+         //D3Q27InteractorPtr outflowInt = D3Q27InteractorPtr( new D3Q27Interactor(geoOutflow, grid, bcObst,Interactor3D::SOLID));
+
+         Grid3DVisitorPtr metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B));
+         InteractorsHelper intHelper(grid, metisVisitor);
+         intHelper.addInteractor(cylinderInt);
+         intHelper.addInteractor(addWallYminInt);
+         intHelper.addInteractor(addWallZminInt);
+         intHelper.addInteractor(addWallYmaxInt);
+         intHelper.addInteractor(addWallZmaxInt);
+         intHelper.addInteractor(inflowInt);
+         intHelper.addInteractor(outflowInt);
+         intHelper.selectBlocks();
+
+         //set connectors
+         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
+         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
+         grid->accept( setConnsVisitor );
+
+         //domain decomposition for threads
+         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
+         grid->accept(pqPartVisitor);
+
+         ppblocks->update(0);
+         ppblocks.reset();
+
+         unsigned long nob = grid->getNumberOfBlocks();
+         int gl = 3;
+         unsigned long nodb = (blocknx1) * (blocknx2) * (blocknx3);
+         unsigned long nod = nob * (blocknx1) * (blocknx2) * (blocknx3);
+         unsigned long nodg = nob * (blocknx1+gl) * (blocknx2+gl) * (blocknx3+gl);
+         double needMemAll  = double(nodg*(27*sizeof(double) + sizeof(int) + sizeof(float)*4));
+         double needMem  = needMemAll / double(comm->getNumberOfProcesses());
+
+         if(myid == 0)
+         {
+            UBLOG(logINFO,"Number of blocks = " << nob);
+            UBLOG(logINFO,"Number of nodes  = " << nod);
+            int minInitLevel = grid->getCoarsestInitializedLevel();
+            int maxInitLevel = grid->getFinestInitializedLevel();
+            for(int level = minInitLevel; level<=maxInitLevel; level++)
+            {
+               int nobl = grid->getNumberOfBlocks(level);
+               UBLOG(logINFO,"Number of blocks for level " << level <<" = " << nob);
+               UBLOG(logINFO,"Number of nodes for level " << level <<" = " << nob*nodb);
+            }
+            UBLOG(logINFO,"Necessary memory  = " << needMemAll  << " bytes");
+            UBLOG(logINFO,"Necessary memory per process = " << needMem  << " bytes");
+            UBLOG(logINFO,"Available memory per process = " << availMem << " bytes");
+         }            
+
+         //int kernelType = UbSystem::stringTo<int>(cf.getValue("kernel"));
+         LBMKernel3DPtr kernel;
+         //if (kernelType == 0)
+         //{
+         //   rhoLB = 1.0;
+         //   kernel = LBMKernel3DPtr(new LBMKernelETD3Q27BGK(blocknx1, blocknx2, blocknx3, true));
+         //}
+         //else if (kernelType == 1)
+         //{
+         //   rhoLB = 1.0;
+         //   kernel = LBMKernel3DPtr(new LBMKernelETD3Q27Cascaded(blocknx1, blocknx2, blocknx3));
+         //}
+         //else if (kernelType == 2)
+         //{
+            rhoLB = 0.0;
+            kernel = LBMKernel3DPtr(new LBMKernelETD3Q27CCLB(blocknx1, blocknx2, blocknx3, LBMKernelETD3Q27CCLB::NORMAL));
+            //kernel = LBMKernel3DPtr(new LBMKernelETD3Q27CCLBWithSpongeLayer(blocknx1, blocknx2, blocknx3, LBMKernelETD3Q27CCLB::NORMAL));
+            //int nx[4];
+            //nx[0]=gridNx1*blocknx1*(1<<refineLevel);
+            //nx[1]=gridNx2*blocknx2*(1<<refineLevel);
+            //nx[2]=gridNx3*blocknx3*(1<<refineLevel);
+            //nx[3]=refineLevel+1;
+            //EsoTwistD3Q27SparseData::setSize(nx);
+            //kernel = LBMKernel3DPtr(new LBMKernelETD3Q27CCLBSparse(blocknx1, blocknx2, blocknx3, LBMKernelETD3Q27CCLBSparse::NORMAL));
+            //kernel = LBMKernel3DPtr(new LBMKernelESD3Q27CCLB(blocknx1, blocknx2, blocknx3, grid));
+            //kernel = LBMKernel3DPtr(new LBMKernelETD3Q27CCLBex(blocknx1, blocknx2, blocknx3, 0, grid));
+         //}
+
+         //int sizeSP=2;
+         //mu::Parser spongeLayer;
+         //spongeLayer.SetExpr("x1>=(sizeX-sizeSP)/dx ? (sizeX-(x1+1))/sizeSP/2.0 + 0.5 : 1.0");
+         //spongeLayer.DefineConst("sizeX", gridNx1*blocknx1);
+         //spongeLayer.DefineConst("sizeSP", sizeSP*blocknx1);
+         //kernel->setWithSpongeLayer(true);
+         //kernel->setSpongeLayer(spongeLayer);
+
+
+
+         //mu::Parser fctForcingX1;
+         //fctForcingX1.SetExpr("Fx1");
+         //fctForcingX1.DefineConst("Fx1", 9.99685e-7);
+
+         //kernel->setForcingX1(fctForcingX1);
+         //kernel->setWithForcing(true);
+         //
+         BCProcessorPtr bcProc(new D3Q27ETBCProcessor());
+         //BCProcessorPtr bcProc(new D3Q27ETForThinWallBCProcessor());
+         kernel->setBCProcessor(bcProc);
+
+         SetKernelBlockVisitor kernelVisitor(kernel, nuLB, availMem, needMem);
+
+         grid->accept(kernelVisitor);
+
+         //////////////////////////////////////////////////////////////////////////
+         //Experemintel
+         //////////////////////////////////////////////////////////////////////////
+         //int minInitLevel = grid->getCoarsestInitializedLevel();
+
+         //for(int level = minInitLevel; level<=maxInitLevel; level++)
+         //{
+         //   vector<Block3DPtr> blockVector;
+         //   grid->getBlocks(level, blockVector);
+         //   BOOST_FOREACH(Block3DPtr block, blockVector)
+         //   {
+         //      if (block)
+         //      {
+         //         boost::dynamic_pointer_cast<LBMKernelESD3Q27CCLB>(block->getKernel())->initNeighbours();
+         //      }
+         //   }
+         //}
+         //////////////////////////////////////////////////////////////////////////
+
+
+         if (refineLevel > 0)
+         {
+            D3Q27SetUndefinedNodesBlockVisitor undefNodesVisitor;
+            grid->accept(undefNodesVisitor);
+         }
+
+         //UbSchedulerPtr geoSch(new UbScheduler(1));
+         //D3Q27MacroscopicQuantitiesPostprocessorPtr ppgeo(
+         // new D3Q27MacroscopicQuantitiesPostprocessor(grid, geoSch, pathname + "/grid/nodes", WbWriterVtkXmlBinary::getInstance(), conv, comm, true));
+         //ppgeo->update(0);
+         //ppgeo.reset();
+
+         //return;
+
+         intHelper.setBC();
+
+         //initialization of distributions
+         D3Q27ETInitDistributionsBlockVisitor initVisitor(nuLB, rhoLB);
+         //initVisitor.setVx1(fct);
+         //initVisitor.setNu(nueLB);
+         //initVisitor.setVx1(0.01);
+         //initVisitor.setVx2(0.02);
+         //initVisitor.setVx3(0.03);
+         grid->accept(initVisitor);
+
+         //Postrozess
+         //UbSchedulerPtr geoSch(new UbScheduler(1));
+         //D3Q27MacroscopicQuantitiesPostprocessorPtr ppgeo(
+         //   new D3Q27MacroscopicQuantitiesPostprocessor(grid, geoSch, pathname + "/grid/nodes", WbWriterVtkXmlBinary::getInstance(), conv, comm, true));
+         //ppgeo->update(0);
+         //ppgeo.reset();
+
+         {
+            UbSchedulerPtr geoSch(new UbScheduler(1));
+            //D3Q27MacroscopicQuantitiesPostprocessor ppgeo(grid,geoSch, pathname + "/grid/nodes", WbWriterVtkXmlBinary::getInstance(), conv,  comm, true);
+            D3Q27MacroscopicQuantitiesPostprocessorPtr ppgeo(
+               new D3Q27MacroscopicQuantitiesPostprocessor(grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, true));
+            //grid->addObserver(ppgeo);
+            grid->doPostProcess(0);
+            //grid->notifyObservers(0);
+            //grid->removeObserver(ppgeo);
+         }
+
+         //grid->notifyObservers(0);
+
+         //UbSchedulerPtr stepSch(new UbScheduler(outTime));
+         //D3Q27MacroscopicQuantitiesPostprocessorPtr pp(new D3Q27MacroscopicQuantitiesPostprocessor(grid, stepSch, pathname + "/steps/step", WbWriterVtkXmlASCII::getInstance(), conv));
+         //rp->addPostprocessor(pp);
+
+         //for (int i=0; i < 10; i++)
+         //{
+         //   grid->doPostProcess(i);
+         //}
+
+         //return;
+
+         //UbSchedulerPtr rs(new UbScheduler(3));
+         //D3Q27ShearStressPostprocessorPtr shsPp(new D3Q27ShearStressPostprocessor(grid,pathname + "/shs/shs", WbWriterVtkXmlASCII::getInstance(), stepSch, rs));
+         //shsPp->addInteractor(boost::dynamic_pointer_cast<D3Q27Interactor>(addWallZminInt));
+         //rp->addPostprocessor(shsPp);
+
+         if(myid == 0) UBLOG(logINFO,"Preprozess - end"); 
+      }
+
+      else
+      {
+         //set connectors
+         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
+         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
+         grid->accept( setConnsVisitor );
+         if(myid == 0) UBLOG(logINFO,"Restart - end"); 
+      }
+      UbSchedulerPtr nupsSch(new UbScheduler(10, 30, 100));
+      NUPSCounterPostprocessor npr(grid, nupsSch, numOfThreads, comm);
+
+      //UbSchedulerPtr visSch(new UbScheduler());
+      //visSch->addSchedule(1,1,3);
+      //visSch->addSchedule(100,100,1000);
+      //visSch->addSchedule(1000,1000,5000);
+      //visSch->addSchedule(5000,5000,100000);
+      //visSch->addSchedule(100000,100000,10000000);
+
+      
+      D3Q27IntegrateValuesHelperPtr ih1(new D3Q27IntegrateValuesHelper(grid, comm, gridCube->getX1Minimum(), gridCube->getX2Minimum(), gridCube->getX3Minimum(), 
+         gridCube->getX1Maximum(), gridCube->getX2Maximum(), gridCube->getX3Maximum()));
+      if (myid == 0) GbSystem3D::writeGeoObject(ih1->getBoundingBox().get(), pathname + "/geo/ih1", WbWriterVtkXmlBinary::getInstance());
+
+      double factorp = 1; // dp_real / dp_LB;
+      double factorv = 1;// dx / dt;
+      UbSchedulerPtr stepMV(new UbScheduler(500));
+
+      TimeseriesPostprocessor tsp(grid, stepMV, ih1, pathname+cf.getValue("timeSeriesOut"), comm);
+
+      UbSchedulerPtr visSch(stepSch);
+
+      //UbSchedulerPtr avSch(new UbScheduler());
+      //avSch->addSchedule(100,100,10000);
+      //
+      //double startStep = 32000;
+      //UbSchedulerPtr resSchRMS(new UbScheduler());
+      //resSchRMS->addSchedule(100000, startStep, 10000000);
+      //UbSchedulerPtr resSchMeans(new UbScheduler());
+      //resSchMeans->addSchedule(100000, startStep, 10000000);
+      //UbSchedulerPtr stepAvSch(new UbScheduler());
+      //int averageInterval=100;
+      //stepAvSch->addSchedule(averageInterval,0,10000000);
+
+      //AverageValuesPostprocessor Avpp(grid, pathname, WbWriterVtkXmlBinary::getInstance(), visSch/*wann wird rausgeschrieben*/, stepAvSch/*wann wird gemittelt*/, resSchMeans,resSchRMS/*wann wird resettet*/);
+
+      UbSchedulerPtr emSch(new UbScheduler(100));
+      //EmergencyExitPostprocessor empr(grid, emSch, pathname, RestartPostprocessorPtr(&rp), comm);
+
+      //rp->addPostprocessor(avPp);
+
+      //D3Q27ShearStressPostprocessor shs(grid,pathname, WbWriterVtkXmlASCII::getInstance(), stepSch, resSchMeans);
+      //shs.addInteractor(boost::dynamic_pointer_cast<D3Q27Interactor>(addWallZminInt));
+
+      D3Q27MacroscopicQuantitiesPostprocessor pp(grid, stepSch, pathname, WbWriterVtkXmlASCII::getInstance(), conv);
+
+      //UbSchedulerPtr visSch(new UbScheduler(1));
+
+      double endTime = UbSystem::stringTo<int>(cf.getValue("endTime"));//10001.0;
+
+      cout << "PID = " << myid << " Total Physical Memory (RAM): " << Utilities::getTotalPhysMem()<<endl;
+      cout << "PID = " << myid << " Physical Memory currently used: " << Utilities::getPhysMemUsed()<<endl;
+      cout << "PID = " << myid << " Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe()<<endl;
+
+      //#pragma omp parallel num_threads(4)
+      //      {
+      //         int i = omp_get_thread_num();
+      //         printf_s("Hello from thread %d\n", i);
+      //      }
+
+      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, visSch));
+      if(myid == 0) UBLOG(logINFO,"Simulation-start");
+      calculation->calculate();
+      if(myid == 0) UBLOG(logINFO,"Simulation-end");
+   }
+   catch(std::exception& e)
+   {
+      cerr << e.what() << endl << flush;
+   }
+   catch(std::string& s)
+   {
+      cerr << s << endl;
+   }
+   catch(...)
+   {
+      cerr << "unknown exception" << endl;
+   }
+
+}
+
+
+
diff --git a/apps/cpu/block_test/block_test_periodic.hpp b/apps/cpu/block_test/block_test_periodic.hpp
index ab6d2ad4145b00f94ce41434328479d12b29980e..4189a903a791cbff4dac801f8b0e34c25bcfac4c 100644
--- a/apps/cpu/block_test/block_test_periodic.hpp
+++ b/apps/cpu/block_test/block_test_periodic.hpp
@@ -1,430 +1,430 @@
-#include <iostream>
-#include <string>
-
-#include "vfluids.h"
-
-using namespace std;
-
-
-void block_test_periodic(const char *cstr1, const char *cstr2)
-{
-   try
-   {
-      ConfigFileReader cf(cstr1);
-      if ( !cf.read() )
-      {
-         std::string exceptionText = "Unable to read configuration file\n";
-         throw exceptionText;
-      }
-
-      string machine = QUOTEME(CAB_MACHINE);
-      string pathname = cf.getValue("path"); 
-      int numOfThreads = UbSystem::stringTo<int>(cf.getValue("numOfThreads"));
-      double availMem = 0;
-
-      CommunicatorPtr comm(new MPICommunicator());
-      int myid = comm->getProcessID();
-
-      if(machine == "BOMBADIL") 
-      {
-         //pathname = "c:/temp/block_test";
-         availMem = 3.0e9;
-      }
-      else if(machine == "HICEGATE0")      
-      {
-         //pathname = "/work/koskuche/scratch/block_test";
-         availMem = 6.0e9;
-
-         if(myid ==0)
-         {
-            stringstream logFilename;
-            logFilename <<  pathname + "/logfile"+UbSystem::toString(UbSystem::getTimeStamp())+".txt";
-            UbLog::output_policy::setStream(logFilename.str());
-         }
-      }
-      else throw UbException(UB_EXARGS, "unknown CAB_MACHINE");
-
-      double dx = 1;
-
-      const int blocknx1 = UbSystem::stringTo<int>(cf.getValue("blocknx1")); //16;
-      const int blocknx2 = UbSystem::stringTo<int>(cf.getValue("blocknx2"));//16;
-      const int blocknx3 = UbSystem::stringTo<int>(cf.getValue("blocknx3"));//16;
-
-      const int gridNx1 = UbSystem::stringTo<int>(cf.getValue("gridNx1"));//3;
-      const int gridNx2 = UbSystem::stringTo<int>(cf.getValue("gridNx2"));//3;
-      const int gridNx3 = UbSystem::stringTo<int>(cf.getValue("gridNx3"));//3;
-
-
-      double L1 = gridNx1*blocknx1;
-      double L2, L3, H;
-      L2 = L3 = H = gridNx2*blocknx1;
-
-      LBMReal radius = 3;
-      LBMReal uLB = 0.05;
-      LBMReal Re = 20.0;
-      LBMReal rhoLB = 0.0;
-      LBMReal l = L2 / dx;
-      //LBMReal nueLB = (((4.0/9.0)*uLB)*2.0*(radius/dx))/Re;
-      LBMReal nueLB = 0.05842;
-
-      LBMUnitConverterPtr conv = LBMUnitConverterPtr(new LBMUnitConverter());
-
-      const int baseLevel = 0;
-      const int refineLevel = UbSystem::stringTo<int>(cf.getValue("refineLevel"));
-
-      //obstacle
-      GbObject3DPtr cylinder(new GbCylinder3D(L1*0.5, L2*0.5, 0, L1*0.5, L2*0.5, L3, radius));
-      GbSystem3D::writeGeoObject(cylinder.get(),pathname + "/geo/cylinder", WbWriterVtkXmlBinary::getInstance());
-
-      D3Q27InteractorPtr cylinderInt;
-
-      //bounding box
-      double d_minX1 = 0.0;
-      double d_minX2 = 0.0;
-      double d_minX3 = 0.0;
-
-      double d_maxX1 = L1;
-      double d_maxX2 = L2;
-      double d_maxX3 = L3;
-
-      double offs = dx;
-
-      //double g_minX1 = d_minX1-offs-0.499999*dx;
-      double g_minX1 = d_minX1-offs;
-      double g_minX2 = d_minX2-offs;
-      double g_minX3 = d_minX3-offs;
-
-      double g_maxX1 = d_maxX1+offs;
-      double g_maxX2 = d_maxX2+offs;
-      double g_maxX3 = d_maxX3+offs;
-
-      double blockLength = blocknx1*dx;
-
-      //refinement area
-      double off = 1;
-      GbObject3DPtr refineCube(new  GbCuboid3D(cylinder->getX1Minimum()-off, cylinder->getX2Minimum()-off, cylinder->getX3Minimum(), 
-         cylinder->getX1Maximum()+off, cylinder->getX2Maximum()+off, cylinder->getX3Maximum()));
-
-      Grid3DPtr grid(new Grid3D(comm, blocknx1, blocknx2, blocknx3, gridNx1, gridNx2, gridNx3));
-      grid->setPeriodicX1(true);
-      grid->setPeriodicX2(true);
-      grid->setPeriodicX3(true);
-
-      UbSchedulerPtr rSch(new UbScheduler());
-      rSch->addSchedule(5000, 5000, 5000);
-      RestartPostprocessorPtr rp(new RestartPostprocessor(grid, rSch, comm, pathname+"/checkpoints", RestartPostprocessor::TXT));
-
-      std::string opt;
-
-      if(cstr2!= NULL)
-         opt = std::string(cstr2);
-
-      if/*(cstr== NULL)*/(cstr2!= NULL)
-      {
-         if(myid==0) UBLOG(logINFO,"Restart step: " << opt);
-         grid = rp->restart(UbSystem::stringTo<int>(opt));
-
-         SetForcingBlockVisitor forcingVisitor(0.0, 0.0, 0.0);
-         grid->accept(forcingVisitor);
-
-         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
-         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
-         grid->accept( setConnsVisitor );
-      }
-      else
-{
-      if(myid ==0)
-      {
-         UBLOG(logINFO,"Parameters:");
-         UBLOG(logINFO,"L = " << L2/dx );
-         UBLOG(logINFO,"v = " << uLB );
-         UBLOG(logINFO,"rho = " << rhoLB );
-         UBLOG(logINFO,"nue = " << nueLB );
-         UBLOG(logINFO,"Re = " << Re );
-         UBLOG(logINFO,"dx = " << dx );
-         UBLOG(logINFO,"number of levels = " << refineLevel+1 );
-         UBLOG(logINFO,"number of threads = " << numOfThreads );
-         UBLOG(logINFO,"number of processes = " << comm->getNumberOfProcesses() );
-         UBLOG(logINFO,"Preprocess - start");
-      }
-
-      //if(myid ==0) GbSystem3D::writeGeoObject(refineCube.get(),pathname + "/geo/refineCube", WbWriterVtkXmlBinary::getInstance());
-
-      //walls
-      GbCuboid3DPtr addWallYmin (new GbCuboid3D(d_minX1-4.0*blockLength, d_minX2-4.0*blockLength, d_minX3-4.0*blockLength, d_maxX1+4.0*blockLength, d_minX2, d_maxX3+4.0*blockLength));
-      //if(myid == 0) GbSystem3D::writeGeoObject(addWallYmin.get(), pathname+"/geo/addWallYmin", WbWriterVtkXmlASCII::getInstance());
-
-      GbCuboid3DPtr addWallZmin (new GbCuboid3D(d_minX1-4.0*blockLength, d_minX2-4.0*blockLength, d_minX3-4.0*blockLength, d_maxX1+4.0*blockLength, d_maxX2+4.0*blockLength, d_minX3));
-      //if(myid == 0) GbSystem3D::writeGeoObject(addWallZmin.get(), pathname+"/geo/addWallZmin", WbWriterVtkXmlASCII::getInstance());
-
-      GbCuboid3DPtr addWallYmax (new GbCuboid3D(d_minX1-4.0*blockLength, d_maxX2, d_minX3-4.0*blockLength, d_maxX1+4.0*blockLength, d_maxX2+4.0*blockLength, d_maxX3+4.0*blockLength));
-      //if(myid == 0) GbSystem3D::writeGeoObject(addWallYmax.get(), pathname+"/geo/addWallYmax", WbWriterVtkXmlASCII::getInstance());
-
-      GbCuboid3DPtr addWallZmax (new GbCuboid3D(d_minX1-4.0*blockLength, d_minX2-4.0*blockLength, d_maxX3, d_maxX1+4.0*blockLength, d_maxX2+4.0*blockLength, d_maxX3+4.0*blockLength));
-      //if(myid == 0) GbSystem3D::writeGeoObject(addWallZmax.get(), pathname+"/geo/addWallZmax", WbWriterVtkXmlASCII::getInstance());
-
-      //inflow
-      GbCuboid3DPtr geoInflow (new GbCuboid3D(d_minX1-4.0*blockLength, d_minX2-4.0*blockLength, d_minX3-4.0*blockLength, d_minX1, d_maxX2+4.0*blockLength, d_maxX3+4.0*blockLength));
-      //if(myid == 0) GbSystem3D::writeGeoObject(geoInflow.get(), pathname+"/geo/geoInflow", WbWriterVtkXmlASCII::getInstance());
-
-      //outflow
-      GbCuboid3DPtr geoOutflow (new GbCuboid3D(d_maxX1, d_minX2-4.0*blockLength, d_minX3-4.0*blockLength, d_maxX1+4.0*blockLength, d_maxX2+4.0*blockLength, d_maxX3+4.0*blockLength));
-      //if(myid == 0) GbSystem3D::writeGeoObject(geoOutflow.get(), pathname+"/geo/geoOutflow", WbWriterVtkXmlASCII::getInstance());
-
-      //GbCuboid3DPtr addWallYmax (new GbCuboid3D(d_minX1-4.0*blockLength, d_maxX2-2*dx, d_minX3-4.0*blockLength, d_maxX1+4.0*blockLength, d_maxX2+4.0*blockLength, d_maxX3+4.0*blockLength));
-      //if(myid == 0) GbSystem3D::writeGeoObject(addWallYmax.get(), pathname+"/geo/addWallYmax", WbWriterVtkXmlASCII::getInstance());
-
-      //GbCuboid3DPtr addWallZmax (new GbCuboid3D(d_minX1-4.0*blockLength, d_minX2-4.0*blockLength, d_maxX3-2*dx, d_maxX1+4.0*blockLength, d_maxX2+4.0*blockLength, d_maxX3+4.0*blockLength));
-      //if(myid == 0) GbSystem3D::writeGeoObject(addWallZmax.get(), pathname+"/geo/addWallZmax", WbWriterVtkXmlASCII::getInstance());
-
-      ////inflow
-      //GbCuboid3DPtr geoInflow (new GbCuboid3D(d_minX1-4.0*blockLength, d_minX2-4.0*blockLength, d_minX3-4.0*blockLength, d_minX1+2*dx, d_maxX2+4.0*blockLength, d_maxX3+4.0*blockLength));
-      //if(myid == 0) GbSystem3D::writeGeoObject(geoInflow.get(), pathname+"/geo/geoInflow", WbWriterVtkXmlASCII::getInstance());
-
-      ////outflow
-      //GbCuboid3DPtr geoOutflow (new GbCuboid3D(d_maxX1-2*dx, d_minX2-4.0*blockLength, d_minX3-4.0*blockLength, d_maxX1+4.0*blockLength, d_maxX2+4.0*blockLength, d_maxX3+4.0*blockLength));
-      //if(myid == 0) GbSystem3D::writeGeoObject(geoOutflow.get(), pathname+"/geo/geoOutflow", WbWriterVtkXmlASCII::getInstance());
-
-//      BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname + "/grid/blocks", WbWriterVtkXmlBinary::getInstance(), comm));
-
-      if (refineLevel > 0)
-      {
-         if(myid == 0) UBLOG(logINFO,"Refinement - start");	
-         RefineCrossAndInsideGbObjectBlockVisitor refVisitor(refineCube, refineLevel);
-         grid->accept(refVisitor);
-
-         RatioBlockVisitor ratioVisitor(refineLevel);
-         grid->accept(ratioVisitor);
-
-         RatioSmoothBlockVisitor ratioSmoothVisitor(refineLevel);
-         grid->accept(ratioSmoothVisitor);
-
-         OverlapBlockVisitor overlapVisitor(refineLevel);
-         grid->accept(overlapVisitor);
-
-         std::vector<int> dirs;
-         D3Q27System::getLBMDirections(dirs);
-         SetInterpolationDirsBlockVisitor interDirsVisitor(dirs);
-         grid->accept(interDirsVisitor);
-         if(myid == 0) UBLOG(logINFO,"Refinement - end");	
-      }
-
-      MetisPartitioningGridVisitor metisVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B, true, numOfThreads);
-      grid->accept( metisVisitor );
-
-      SolidBlocksHelper sd(grid, comm);
-
-      int bbOption = 1; //0=simple Bounce Back, 1=quadr. BB
-      D3Q27BoundaryConditionAdapterPtr bcObst(new D3Q27NoSlipBCAdapter(bbOption));
-      cylinderInt = D3Q27InteractorPtr ( new D3Q27Interactor(cylinder, grid, bcObst,Interactor3D::SOLID));
-
-      //walls
-      D3Q27InteractorPtr addWallYminInt(new D3Q27Interactor(addWallYmin, grid, bcObst,Interactor3D::SOLID));
-      D3Q27InteractorPtr addWallZminInt(new D3Q27Interactor(addWallZmin, grid, bcObst,Interactor3D::SOLID));
-      D3Q27InteractorPtr addWallYmaxInt(new D3Q27Interactor(addWallYmax, grid, bcObst,Interactor3D::SOLID));
-      D3Q27InteractorPtr addWallZmaxInt(new D3Q27Interactor(addWallZmax, grid, bcObst,Interactor3D::SOLID));
-
-      mu::Parser fct;
-      fct.SetExpr("16*U*x2*x3*(H-x2)*(H-x3)/H^4");
-      fct.DefineConst("U", uLB);
-      fct.DefineConst("H", H);
-      fct.SetExpr("U");
-
-      //inflow
-      D3Q27BoundaryConditionAdapterPtr velBCAdapter(new D3Q27VelocityBCAdapter (true, false ,false ,fct, 0, D3Q27BCFunction::INFCONST));
-      velBCAdapter->setSecondaryBcOption(2);
-      //D3Q27BoundaryConditionAdapterPtr denBCAdapterFront(new D3Q27DensityBCAdapter(rhoLB));
-      //denBCAdapterFront->setSecondaryBcOption(1);
-      D3Q27InteractorPtr inflowInt  = D3Q27InteractorPtr( new D3Q27Interactor(geoInflow, grid, velBCAdapter, Interactor3D::SOLID));
-      //D3Q27InteractorPtr inflowInt  = D3Q27InteractorPtr( new D3Q27Interactor(geoInflow, grid, bcObst, Interactor3D::SOLID));
-
-      //outflow
-      D3Q27BoundaryConditionAdapterPtr denBCAdapter(new D3Q27DensityBCAdapter(rhoLB));
-      denBCAdapter->setSecondaryBcOption(1);
-      D3Q27InteractorPtr outflowInt = D3Q27InteractorPtr( new D3Q27Interactor(geoOutflow, grid, denBCAdapter,Interactor3D::SOLID));
-      //D3Q27InteractorPtr outflowInt = D3Q27InteractorPtr( new D3Q27Interactor(geoOutflow, grid, bcObst,Interactor3D::SOLID));
-
-      //sd.addInteractor(cylinderInt);
-      //sd.addInteractor(addWallYminInt);
-      //sd.addInteractor(addWallZminInt);
-      //sd.addInteractor(addWallYmaxInt);
-      //sd.addInteractor(addWallZmaxInt);
-      //sd.addInteractor(inflowInt);
-      //sd.addInteractor(outflowInt);
-
-      //sd.deleteSolidBlocks();
-
-      grid->accept( metisVisitor );
-
-      //set connectors
-      D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
-      D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
-      grid->accept( setConnsVisitor );
-
-      //domain decomposition for threads
-      //PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
-      //grid->accept(pqPartVisitor);
-
-//      ppblocks->update(0);
-//      ppblocks.reset();
-
-      unsigned long nob = grid->getNumberOfBlocks();
-      int gl = 3;
-      unsigned long nodb = (blocknx1) * (blocknx2) * (blocknx3);
-      unsigned long nod = nob * (blocknx1) * (blocknx2) * (blocknx3);
-      unsigned long nodg = nob * (blocknx1+gl) * (blocknx2+gl) * (blocknx3+gl);
-      double needMemAll  = double(nodg*(27*sizeof(double) + sizeof(int) + sizeof(float)*4));
-      double needMem  = needMemAll / double(comm->getNumberOfProcesses());
-
-      if(myid == 0)
-      {
-         UBLOG(logINFO,"Number of blocks = " << nob);
-         UBLOG(logINFO,"Number of nodes  = " << nod);
-         int minInitLevel = grid->getCoarsestInitializedLevel();
-         int maxInitLevel = grid->getFinestInitializedLevel();
-         for(int level = minInitLevel; level<=maxInitLevel; level++)
-         {
-            int nobl = grid->getNumberOfBlocks(level);
-            UBLOG(logINFO,"Number of blocks for level " << level <<" = " << nob);
-            UBLOG(logINFO,"Number of nodes for level " << level <<" = " << nob*nodb);
-         }
-         UBLOG(logINFO,"Necessary memory  = " << needMemAll  << " bytes");
-         UBLOG(logINFO,"Necessary memory per process = " << needMem  << " bytes");
-         UBLOG(logINFO,"Available memory per process = " << availMem << " bytes");
-      }            
-
-      int kernelType = UbSystem::stringTo<int>(cf.getValue("kernel"));
-      LBMKernel3DPtr kernel;
-      if (kernelType == 0)
-      {
-         rhoLB = 1.0;
-         kernel = LBMKernel3DPtr(new LBMKernelETD3Q27BGK(blocknx1, blocknx2, blocknx3, true));
-      }
-      else if (kernelType == 1)
-      {
-         rhoLB = 1.0;
-         kernel = LBMKernel3DPtr(new LBMKernelETD3Q27Cascaded(blocknx1, blocknx2, blocknx3));
-      }
-      else if (kernelType == 2)
-      {
-         rhoLB = 0.0;
-         kernel = LBMKernel3DPtr(new LBMKernelETD3Q27CCLB(blocknx1, blocknx2, blocknx3, 0));
-         //kernel = LBMKernel3DPtr(new LBMKernelESD3Q27CCLB(blocknx1, blocknx2, blocknx3, grid));
-         //kernel = LBMKernel3DPtr(new LBMKernelETD3Q27CCLBex(blocknx1, blocknx2, blocknx3, 0, grid));
-      }
-
-      //mu::Parser fctForcingX1;
-      //fctForcingX1.SetExpr("Fx1");
-      //fctForcingX1.DefineConst("Fx1", 9.99685e-7);
-
-      //kernel->setForcingX1(fctForcingX1);
-      //kernel->setWithForcing(true);
-      //
-      BCProcessorPtr bcProc(new D3Q27ETBCProcessor());
-      kernel->setBCProcessor(bcProc);
-
-      SetKernelBlockVisitor kernelVisitor(kernel, nueLB, availMem, needMem);
-      grid->accept(kernelVisitor);
-
-      //////////////////////////////////////////////////////////////////////////
-      //Experemintel
-      //////////////////////////////////////////////////////////////////////////
-      //int minInitLevel = grid->getCoarsestInitializedLevel();
-      //int maxInitLevel = grid->getFinestInitializedLevel();
-
-      //for(int level = minInitLevel; level<=maxInitLevel; level++)
-      //{
-      //   vector<Block3DPtr> blockVector;
-      //   grid->getBlocks(level, blockVector);
-      //   BOOST_FOREACH(Block3DPtr block, blockVector)
-      //   {
-      //      if (block)
-      //      {
-      //         boost::dynamic_pointer_cast<LBMKernelESD3Q27CCLB>(block->getKernel())->initNeighbours();
-      //      }
-      //   }
-      //}
-      //////////////////////////////////////////////////////////////////////////
-
-
-      if (refineLevel > 0)
-      {
-         D3Q27SetUndefinedNodesBlockVisitor undefNodesVisitor;
-         grid->accept(undefNodesVisitor);
-      }
-
-      //walls
-      //grid->addAndInitInteractor(addWallYminInt);
-      //grid->addAndInitInteractor(addWallZminInt);
-      //grid->addAndInitInteractor(addWallYmaxInt);
-      //grid->addAndInitInteractor(addWallZmaxInt);
-
-
-      //addWallYminInt->updateInteractor(0);
-
-      //obstacle
-      //grid->addAndInitInteractor(cylinderInt);
-
-      //inflow
-      //grid->addAndInitInteractor(inflowInt);
-
-      //outflow
-      //grid->addAndInitInteractor(outflowInt);
-
-      //initialization of distributions
-      D3Q27ETInitDistributionsBlockVisitor initVisitor(rhoLB);
-      initVisitor.setVx1(0.0);
-      grid->accept(initVisitor);
-
-      //Postrozess
-      //UbSchedulerPtr geoSch(new UbScheduler(1));
-      //D3Q27MacroscopicQuantitiesPostprocessorPtr ppgeo(
-         //new D3Q27MacroscopicQuantitiesPostprocessor(grid, geoSch, pathname + "/grid/nodes", WbWriterVtkXmlBinary::getInstance(), conv, comm, true));
-      //ppgeo->update(0);
-      //ppgeo.reset();
-
-      if(myid == 0) UBLOG(logINFO,"Preprocess - end"); 
-}
-      UbSchedulerPtr nupsSch(new UbScheduler(10, 30, 100));
-      NUPSCounterPostprocessor npr(grid, nupsSch, pathname + "/results/nups.txt", comm);
-
-      double outTime = 500.0;
-      UbSchedulerPtr stepSch(new UbScheduler(outTime));
-      //UbSchedulerPtr stepSch(new UbScheduler());
-      //stepSch->addSchedule(10, 100, 1000);
-      //nodeSch->addSchedule(1000, 1000, 10000);
-      //nodeSch->addSchedule(10000, 10000, 50000);
-      //stepSch->addSchedule(100, 100, 1000);
-
-      //D3Q27MacroscopicQuantitiesPostprocessor pp(grid, stepSch, pathname + "/steps/step", WbWriterVtkXmlASCII::getInstance(), conv, comm);
-
-      UbSchedulerPtr visSch(new UbScheduler());
-      //UbSchedulerPtr visSch(stepSch);
-      double endTime = UbSystem::stringTo<int>(cf.getValue("endTime"));//10001.0;
-
-      //cout << "PID = " << myid << " Total Physical Memory (RAM): " << MemoryUtil::getTotalPhysMem()<<endl;
-      //cout << "PID = " << myid << " Physical Memory currently used: " << MemoryUtil::getPhysMemUsed()<<endl;
-      //cout << "PID = " << myid << " Physical Memory currently used by current process: " << MemoryUtil::getPhysMemUsedByMe()<<endl;
-
-      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, stepSch));
-      if(myid == 0) UBLOG(logINFO,"Simulation-start");
-      calculation->calculate();
-      if(myid == 0) UBLOG(logINFO,"Simulation-end");
-   }
-   catch(std::exception& e)
-   {
-      cerr << e.what() << endl << flush;
-   }
-   catch(std::string& s)
-   {
-      cerr << s << endl;
-   }
-   catch(...)
-   {
-      cerr << "unknown exception" << endl;
-   }
-
-}
-
- 
-
+#include <iostream>
+#include <string>
+
+#include "vfluids.h"
+
+using namespace std;
+
+
+void block_test_periodic(const char *cstr1, const char *cstr2)
+{
+   try
+   {
+      ConfigFileReader cf(cstr1);
+      if ( !cf.read() )
+      {
+         std::string exceptionText = "Unable to read configuration file\n";
+         throw exceptionText;
+      }
+
+      string machine = QUOTEME(CAB_MACHINE);
+      string pathname = cf.getValue("path"); 
+      int numOfThreads = UbSystem::stringTo<int>(cf.getValue("numOfThreads"));
+      double availMem = 0;
+
+      CommunicatorPtr comm(new MPICommunicator());
+      int myid = comm->getProcessID();
+
+      if(machine == "BOMBADIL") 
+      {
+         //pathname = "c:/temp/block_test";
+         availMem = 3.0e9;
+      }
+      else if(machine == "HICEGATE0")      
+      {
+         //pathname = "/work/koskuche/scratch/block_test";
+         availMem = 6.0e9;
+
+         if(myid ==0)
+         {
+            stringstream logFilename;
+            logFilename <<  pathname + "/logfile"+UbSystem::toString(UbSystem::getTimeStamp())+".txt";
+            UbLog::output_policy::setStream(logFilename.str());
+         }
+      }
+      else throw UbException(UB_EXARGS, "unknown CAB_MACHINE");
+
+      double dx = 1;
+
+      const int blocknx1 = UbSystem::stringTo<int>(cf.getValue("blocknx1")); //16;
+      const int blocknx2 = UbSystem::stringTo<int>(cf.getValue("blocknx2"));//16;
+      const int blocknx3 = UbSystem::stringTo<int>(cf.getValue("blocknx3"));//16;
+
+      const int gridNx1 = UbSystem::stringTo<int>(cf.getValue("gridNx1"));//3;
+      const int gridNx2 = UbSystem::stringTo<int>(cf.getValue("gridNx2"));//3;
+      const int gridNx3 = UbSystem::stringTo<int>(cf.getValue("gridNx3"));//3;
+
+
+      double L1 = gridNx1*blocknx1;
+      double L2, L3, H;
+      L2 = L3 = H = gridNx2*blocknx1;
+
+      LBMReal radius = 3;
+      LBMReal uLB = 0.05;
+      LBMReal Re = 20.0;
+      LBMReal rhoLB = 0.0;
+      LBMReal l = L2 / dx;
+      //LBMReal nueLB = (((4.0/9.0)*uLB)*2.0*(radius/dx))/Re;
+      LBMReal nueLB = 0.05842;
+
+      LBMUnitConverterPtr conv = LBMUnitConverterPtr(new LBMUnitConverter());
+
+      const int baseLevel = 0;
+      const int refineLevel = UbSystem::stringTo<int>(cf.getValue("refineLevel"));
+
+      //obstacle
+      GbObject3DPtr cylinder(new GbCylinder3D(L1*0.5, L2*0.5, 0, L1*0.5, L2*0.5, L3, radius));
+      GbSystem3D::writeGeoObject(cylinder.get(),pathname + "/geo/cylinder", WbWriterVtkXmlBinary::getInstance());
+
+      D3Q27InteractorPtr cylinderInt;
+
+      //bounding box
+      double d_minX1 = 0.0;
+      double d_minX2 = 0.0;
+      double d_minX3 = 0.0;
+
+      double d_maxX1 = L1;
+      double d_maxX2 = L2;
+      double d_maxX3 = L3;
+
+      double offs = dx;
+
+      //double g_minX1 = d_minX1-offs-0.499999*dx;
+      double g_minX1 = d_minX1-offs;
+      double g_minX2 = d_minX2-offs;
+      double g_minX3 = d_minX3-offs;
+
+      double g_maxX1 = d_maxX1+offs;
+      double g_maxX2 = d_maxX2+offs;
+      double g_maxX3 = d_maxX3+offs;
+
+      double blockLength = blocknx1*dx;
+
+      //refinement area
+      double off = 1;
+      GbObject3DPtr refineCube(new  GbCuboid3D(cylinder->getX1Minimum()-off, cylinder->getX2Minimum()-off, cylinder->getX3Minimum(), 
+         cylinder->getX1Maximum()+off, cylinder->getX2Maximum()+off, cylinder->getX3Maximum()));
+
+      Grid3DPtr grid(new Grid3D(comm, blocknx1, blocknx2, blocknx3, gridNx1, gridNx2, gridNx3));
+      grid->setPeriodicX1(true);
+      grid->setPeriodicX2(true);
+      grid->setPeriodicX3(true);
+
+      UbSchedulerPtr rSch(new UbScheduler());
+      rSch->addSchedule(5000, 5000, 5000);
+      RestartPostprocessorPtr rp(new RestartPostprocessor(grid, rSch, comm, pathname+"/checkpoints", RestartPostprocessor::TXT));
+
+      std::string opt;
+
+      if(cstr2!= NULL)
+         opt = std::string(cstr2);
+
+      if/*(cstr== NULL)*/(cstr2!= NULL)
+      {
+         if(myid==0) UBLOG(logINFO,"Restart step: " << opt);
+         grid = rp->restart(UbSystem::stringTo<int>(opt));
+
+         SetForcingBlockVisitor forcingVisitor(0.0, 0.0, 0.0);
+         grid->accept(forcingVisitor);
+
+         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
+         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
+         grid->accept( setConnsVisitor );
+      }
+      else
+{
+      if(myid ==0)
+      {
+         UBLOG(logINFO,"Parameters:");
+         UBLOG(logINFO,"L = " << L2/dx );
+         UBLOG(logINFO,"v = " << uLB );
+         UBLOG(logINFO,"rho = " << rhoLB );
+         UBLOG(logINFO,"nue = " << nueLB );
+         UBLOG(logINFO,"Re = " << Re );
+         UBLOG(logINFO,"dx = " << dx );
+         UBLOG(logINFO,"number of levels = " << refineLevel+1 );
+         UBLOG(logINFO,"number of threads = " << numOfThreads );
+         UBLOG(logINFO,"number of processes = " << comm->getNumberOfProcesses() );
+         UBLOG(logINFO,"Preprocess - start");
+      }
+
+      //if(myid ==0) GbSystem3D::writeGeoObject(refineCube.get(),pathname + "/geo/refineCube", WbWriterVtkXmlBinary::getInstance());
+
+      //walls
+      GbCuboid3DPtr addWallYmin (new GbCuboid3D(d_minX1-4.0*blockLength, d_minX2-4.0*blockLength, d_minX3-4.0*blockLength, d_maxX1+4.0*blockLength, d_minX2, d_maxX3+4.0*blockLength));
+      //if(myid == 0) GbSystem3D::writeGeoObject(addWallYmin.get(), pathname+"/geo/addWallYmin", WbWriterVtkXmlASCII::getInstance());
+
+      GbCuboid3DPtr addWallZmin (new GbCuboid3D(d_minX1-4.0*blockLength, d_minX2-4.0*blockLength, d_minX3-4.0*blockLength, d_maxX1+4.0*blockLength, d_maxX2+4.0*blockLength, d_minX3));
+      //if(myid == 0) GbSystem3D::writeGeoObject(addWallZmin.get(), pathname+"/geo/addWallZmin", WbWriterVtkXmlASCII::getInstance());
+
+      GbCuboid3DPtr addWallYmax (new GbCuboid3D(d_minX1-4.0*blockLength, d_maxX2, d_minX3-4.0*blockLength, d_maxX1+4.0*blockLength, d_maxX2+4.0*blockLength, d_maxX3+4.0*blockLength));
+      //if(myid == 0) GbSystem3D::writeGeoObject(addWallYmax.get(), pathname+"/geo/addWallYmax", WbWriterVtkXmlASCII::getInstance());
+
+      GbCuboid3DPtr addWallZmax (new GbCuboid3D(d_minX1-4.0*blockLength, d_minX2-4.0*blockLength, d_maxX3, d_maxX1+4.0*blockLength, d_maxX2+4.0*blockLength, d_maxX3+4.0*blockLength));
+      //if(myid == 0) GbSystem3D::writeGeoObject(addWallZmax.get(), pathname+"/geo/addWallZmax", WbWriterVtkXmlASCII::getInstance());
+
+      //inflow
+      GbCuboid3DPtr geoInflow (new GbCuboid3D(d_minX1-4.0*blockLength, d_minX2-4.0*blockLength, d_minX3-4.0*blockLength, d_minX1, d_maxX2+4.0*blockLength, d_maxX3+4.0*blockLength));
+      //if(myid == 0) GbSystem3D::writeGeoObject(geoInflow.get(), pathname+"/geo/geoInflow", WbWriterVtkXmlASCII::getInstance());
+
+      //outflow
+      GbCuboid3DPtr geoOutflow (new GbCuboid3D(d_maxX1, d_minX2-4.0*blockLength, d_minX3-4.0*blockLength, d_maxX1+4.0*blockLength, d_maxX2+4.0*blockLength, d_maxX3+4.0*blockLength));
+      //if(myid == 0) GbSystem3D::writeGeoObject(geoOutflow.get(), pathname+"/geo/geoOutflow", WbWriterVtkXmlASCII::getInstance());
+
+      //GbCuboid3DPtr addWallYmax (new GbCuboid3D(d_minX1-4.0*blockLength, d_maxX2-2*dx, d_minX3-4.0*blockLength, d_maxX1+4.0*blockLength, d_maxX2+4.0*blockLength, d_maxX3+4.0*blockLength));
+      //if(myid == 0) GbSystem3D::writeGeoObject(addWallYmax.get(), pathname+"/geo/addWallYmax", WbWriterVtkXmlASCII::getInstance());
+
+      //GbCuboid3DPtr addWallZmax (new GbCuboid3D(d_minX1-4.0*blockLength, d_minX2-4.0*blockLength, d_maxX3-2*dx, d_maxX1+4.0*blockLength, d_maxX2+4.0*blockLength, d_maxX3+4.0*blockLength));
+      //if(myid == 0) GbSystem3D::writeGeoObject(addWallZmax.get(), pathname+"/geo/addWallZmax", WbWriterVtkXmlASCII::getInstance());
+
+      ////inflow
+      //GbCuboid3DPtr geoInflow (new GbCuboid3D(d_minX1-4.0*blockLength, d_minX2-4.0*blockLength, d_minX3-4.0*blockLength, d_minX1+2*dx, d_maxX2+4.0*blockLength, d_maxX3+4.0*blockLength));
+      //if(myid == 0) GbSystem3D::writeGeoObject(geoInflow.get(), pathname+"/geo/geoInflow", WbWriterVtkXmlASCII::getInstance());
+
+      ////outflow
+      //GbCuboid3DPtr geoOutflow (new GbCuboid3D(d_maxX1-2*dx, d_minX2-4.0*blockLength, d_minX3-4.0*blockLength, d_maxX1+4.0*blockLength, d_maxX2+4.0*blockLength, d_maxX3+4.0*blockLength));
+      //if(myid == 0) GbSystem3D::writeGeoObject(geoOutflow.get(), pathname+"/geo/geoOutflow", WbWriterVtkXmlASCII::getInstance());
+
+//      BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname + "/grid/blocks", WbWriterVtkXmlBinary::getInstance(), comm));
+
+      if (refineLevel > 0)
+      {
+         if(myid == 0) UBLOG(logINFO,"Refinement - start");	
+         RefineCrossAndInsideGbObjectBlockVisitor refVisitor(refineCube, refineLevel);
+         grid->accept(refVisitor);
+
+         RatioBlockVisitor ratioVisitor(refineLevel);
+         grid->accept(ratioVisitor);
+
+         RatioSmoothBlockVisitor ratioSmoothVisitor(refineLevel);
+         grid->accept(ratioSmoothVisitor);
+
+         OverlapBlockVisitor overlapVisitor(refineLevel);
+         grid->accept(overlapVisitor);
+
+         std::vector<int> dirs;
+         D3Q27System::getLBMDirections(dirs);
+         SetInterpolationDirsBlockVisitor interDirsVisitor(dirs);
+         grid->accept(interDirsVisitor);
+         if(myid == 0) UBLOG(logINFO,"Refinement - end");	
+      }
+
+      MetisPartitioningGridVisitor metisVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B, true, numOfThreads);
+      grid->accept( metisVisitor );
+
+      SolidBlocksHelper sd(grid, comm);
+
+      int bbOption = 1; //0=simple Bounce Back, 1=quadr. BB
+      D3Q27BoundaryConditionAdapterPtr bcObst(new D3Q27NoSlipBCAdapter(bbOption));
+      cylinderInt = D3Q27InteractorPtr ( new D3Q27Interactor(cylinder, grid, bcObst,Interactor3D::SOLID));
+
+      //walls
+      D3Q27InteractorPtr addWallYminInt(new D3Q27Interactor(addWallYmin, grid, bcObst,Interactor3D::SOLID));
+      D3Q27InteractorPtr addWallZminInt(new D3Q27Interactor(addWallZmin, grid, bcObst,Interactor3D::SOLID));
+      D3Q27InteractorPtr addWallYmaxInt(new D3Q27Interactor(addWallYmax, grid, bcObst,Interactor3D::SOLID));
+      D3Q27InteractorPtr addWallZmaxInt(new D3Q27Interactor(addWallZmax, grid, bcObst,Interactor3D::SOLID));
+
+      mu::Parser fct;
+      fct.SetExpr("16*U*x2*x3*(H-x2)*(H-x3)/H^4");
+      fct.DefineConst("U", uLB);
+      fct.DefineConst("H", H);
+      fct.SetExpr("U");
+
+      //inflow
+      D3Q27BoundaryConditionAdapterPtr velBCAdapter(new D3Q27VelocityBCAdapter (true, false ,false ,fct, 0, D3Q27BCFunction::INFCONST));
+      velBCAdapter->setSecondaryBcOption(2);
+      //D3Q27BoundaryConditionAdapterPtr denBCAdapterFront(new D3Q27DensityBCAdapter(rhoLB));
+      //denBCAdapterFront->setSecondaryBcOption(1);
+      D3Q27InteractorPtr inflowInt  = D3Q27InteractorPtr( new D3Q27Interactor(geoInflow, grid, velBCAdapter, Interactor3D::SOLID));
+      //D3Q27InteractorPtr inflowInt  = D3Q27InteractorPtr( new D3Q27Interactor(geoInflow, grid, bcObst, Interactor3D::SOLID));
+
+      //outflow
+      D3Q27BoundaryConditionAdapterPtr denBCAdapter(new D3Q27DensityBCAdapter(rhoLB));
+      denBCAdapter->setSecondaryBcOption(1);
+      D3Q27InteractorPtr outflowInt = D3Q27InteractorPtr( new D3Q27Interactor(geoOutflow, grid, denBCAdapter,Interactor3D::SOLID));
+      //D3Q27InteractorPtr outflowInt = D3Q27InteractorPtr( new D3Q27Interactor(geoOutflow, grid, bcObst,Interactor3D::SOLID));
+
+      //sd.addInteractor(cylinderInt);
+      //sd.addInteractor(addWallYminInt);
+      //sd.addInteractor(addWallZminInt);
+      //sd.addInteractor(addWallYmaxInt);
+      //sd.addInteractor(addWallZmaxInt);
+      //sd.addInteractor(inflowInt);
+      //sd.addInteractor(outflowInt);
+
+      //sd.deleteSolidBlocks();
+
+      grid->accept( metisVisitor );
+
+      //set connectors
+      D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
+      D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
+      grid->accept( setConnsVisitor );
+
+      //domain decomposition for threads
+      //PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
+      //grid->accept(pqPartVisitor);
+
+//      ppblocks->update(0);
+//      ppblocks.reset();
+
+      unsigned long nob = grid->getNumberOfBlocks();
+      int gl = 3;
+      unsigned long nodb = (blocknx1) * (blocknx2) * (blocknx3);
+      unsigned long nod = nob * (blocknx1) * (blocknx2) * (blocknx3);
+      unsigned long nodg = nob * (blocknx1+gl) * (blocknx2+gl) * (blocknx3+gl);
+      double needMemAll  = double(nodg*(27*sizeof(double) + sizeof(int) + sizeof(float)*4));
+      double needMem  = needMemAll / double(comm->getNumberOfProcesses());
+
+      if(myid == 0)
+      {
+         UBLOG(logINFO,"Number of blocks = " << nob);
+         UBLOG(logINFO,"Number of nodes  = " << nod);
+         int minInitLevel = grid->getCoarsestInitializedLevel();
+         int maxInitLevel = grid->getFinestInitializedLevel();
+         for(int level = minInitLevel; level<=maxInitLevel; level++)
+         {
+            int nobl = grid->getNumberOfBlocks(level);
+            UBLOG(logINFO,"Number of blocks for level " << level <<" = " << nob);
+            UBLOG(logINFO,"Number of nodes for level " << level <<" = " << nob*nodb);
+         }
+         UBLOG(logINFO,"Necessary memory  = " << needMemAll  << " bytes");
+         UBLOG(logINFO,"Necessary memory per process = " << needMem  << " bytes");
+         UBLOG(logINFO,"Available memory per process = " << availMem << " bytes");
+      }            
+
+      int kernelType = UbSystem::stringTo<int>(cf.getValue("kernel"));
+      LBMKernel3DPtr kernel;
+      if (kernelType == 0)
+      {
+         rhoLB = 1.0;
+         kernel = LBMKernel3DPtr(new LBMKernelETD3Q27BGK(blocknx1, blocknx2, blocknx3, true));
+      }
+      else if (kernelType == 1)
+      {
+         rhoLB = 1.0;
+         kernel = LBMKernel3DPtr(new LBMKernelETD3Q27Cascaded(blocknx1, blocknx2, blocknx3));
+      }
+      else if (kernelType == 2)
+      {
+         rhoLB = 0.0;
+         kernel = LBMKernel3DPtr(new LBMKernelETD3Q27CCLB(blocknx1, blocknx2, blocknx3, 0));
+         //kernel = LBMKernel3DPtr(new LBMKernelESD3Q27CCLB(blocknx1, blocknx2, blocknx3, grid));
+         //kernel = LBMKernel3DPtr(new LBMKernelETD3Q27CCLBex(blocknx1, blocknx2, blocknx3, 0, grid));
+      }
+
+      //mu::Parser fctForcingX1;
+      //fctForcingX1.SetExpr("Fx1");
+      //fctForcingX1.DefineConst("Fx1", 9.99685e-7);
+
+      //kernel->setForcingX1(fctForcingX1);
+      //kernel->setWithForcing(true);
+      //
+      BCProcessorPtr bcProc(new D3Q27ETBCProcessor());
+      kernel->setBCProcessor(bcProc);
+
+      SetKernelBlockVisitor kernelVisitor(kernel, nueLB, availMem, needMem);
+      grid->accept(kernelVisitor);
+
+      //////////////////////////////////////////////////////////////////////////
+      //Experemintel
+      //////////////////////////////////////////////////////////////////////////
+      //int minInitLevel = grid->getCoarsestInitializedLevel();
+      //int maxInitLevel = grid->getFinestInitializedLevel();
+
+      //for(int level = minInitLevel; level<=maxInitLevel; level++)
+      //{
+      //   vector<Block3DPtr> blockVector;
+      //   grid->getBlocks(level, blockVector);
+      //   BOOST_FOREACH(Block3DPtr block, blockVector)
+      //   {
+      //      if (block)
+      //      {
+      //         boost::dynamic_pointer_cast<LBMKernelESD3Q27CCLB>(block->getKernel())->initNeighbours();
+      //      }
+      //   }
+      //}
+      //////////////////////////////////////////////////////////////////////////
+
+
+      if (refineLevel > 0)
+      {
+         D3Q27SetUndefinedNodesBlockVisitor undefNodesVisitor;
+         grid->accept(undefNodesVisitor);
+      }
+
+      //walls
+      //grid->addAndInitInteractor(addWallYminInt);
+      //grid->addAndInitInteractor(addWallZminInt);
+      //grid->addAndInitInteractor(addWallYmaxInt);
+      //grid->addAndInitInteractor(addWallZmaxInt);
+
+
+      //addWallYminInt->updateInteractor(0);
+
+      //obstacle
+      //grid->addAndInitInteractor(cylinderInt);
+
+      //inflow
+      //grid->addAndInitInteractor(inflowInt);
+
+      //outflow
+      //grid->addAndInitInteractor(outflowInt);
+
+      //initialization of distributions
+      D3Q27ETInitDistributionsBlockVisitor initVisitor(rhoLB);
+      initVisitor.setVx1(0.0);
+      grid->accept(initVisitor);
+
+      //Postrozess
+      //UbSchedulerPtr geoSch(new UbScheduler(1));
+      //D3Q27MacroscopicQuantitiesPostprocessorPtr ppgeo(
+         //new D3Q27MacroscopicQuantitiesPostprocessor(grid, geoSch, pathname + "/grid/nodes", WbWriterVtkXmlBinary::getInstance(), conv, comm, true));
+      //ppgeo->update(0);
+      //ppgeo.reset();
+
+      if(myid == 0) UBLOG(logINFO,"Preprocess - end"); 
+}
+      UbSchedulerPtr nupsSch(new UbScheduler(10, 30, 100));
+      NUPSCounterPostprocessor npr(grid, nupsSch, pathname + "/results/nups.txt", comm);
+
+      double outTime = 500.0;
+      UbSchedulerPtr stepSch(new UbScheduler(outTime));
+      //UbSchedulerPtr stepSch(new UbScheduler());
+      //stepSch->addSchedule(10, 100, 1000);
+      //nodeSch->addSchedule(1000, 1000, 10000);
+      //nodeSch->addSchedule(10000, 10000, 50000);
+      //stepSch->addSchedule(100, 100, 1000);
+
+      //D3Q27MacroscopicQuantitiesPostprocessor pp(grid, stepSch, pathname + "/steps/step", WbWriterVtkXmlASCII::getInstance(), conv, comm);
+
+      UbSchedulerPtr visSch(new UbScheduler());
+      //UbSchedulerPtr visSch(stepSch);
+      double endTime = UbSystem::stringTo<int>(cf.getValue("endTime"));//10001.0;
+
+      //cout << "PID = " << myid << " Total Physical Memory (RAM): " << MemoryUtil::getTotalPhysMem()<<endl;
+      //cout << "PID = " << myid << " Physical Memory currently used: " << MemoryUtil::getPhysMemUsed()<<endl;
+      //cout << "PID = " << myid << " Physical Memory currently used by current process: " << MemoryUtil::getPhysMemUsedByMe()<<endl;
+
+      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, stepSch));
+      if(myid == 0) UBLOG(logINFO,"Simulation-start");
+      calculation->calculate();
+      if(myid == 0) UBLOG(logINFO,"Simulation-end");
+   }
+   catch(std::exception& e)
+   {
+      cerr << e.what() << endl << flush;
+   }
+   catch(std::string& s)
+   {
+      cerr << s << endl;
+   }
+   catch(...)
+   {
+      cerr << "unknown exception" << endl;
+   }
+
+}
+
+ 
+
diff --git a/apps/cpu/bond_benchmark/CMakeLists.txt b/apps/cpu/bond_benchmark/CMakeLists.txt
index a059287d53b6ba3b66e0fa446f7f9c0a5f4367ca..a7a2dcd0bd305d4a90e6d3f6be85d897085002ac 100644
--- a/apps/cpu/bond_benchmark/CMakeLists.txt
+++ b/apps/cpu/bond_benchmark/CMakeLists.txt
@@ -1,25 +1,25 @@
-CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
-
-########################################################
-## C++ PROJECT                                       ###
-########################################################
-PROJECT(bond_b)
-
-INCLUDE(${SOURCE_ROOT}/lib/IncludsList.txt) 
-
-#################################################################
-###   LOCAL FILES                                             ###
-#################################################################
-FILE(GLOB SPECIFIC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.h
-                         ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
-                         ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp  )
- 
-SET(ALL_SOURCES ${ALL_SOURCES} ${SPECIFIC_FILES})
-SOURCE_GROUP(src FILES ${SPECIFIC_FILES})
-  
-SET(CAB_ADDITIONAL_LINK_LIBRARIES vfluids)
-
-#################################################################
-###   CREATE PROJECT                                          ###
-#################################################################
-CREATE_CAB_PROJECT(bond_b BINARY)
+CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
+
+########################################################
+## C++ PROJECT                                       ###
+########################################################
+PROJECT(bond_b)
+
+INCLUDE(${SOURCE_ROOT}/lib/IncludsList.txt) 
+
+#################################################################
+###   LOCAL FILES                                             ###
+#################################################################
+FILE(GLOB SPECIFIC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.h
+                         ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
+                         ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp  )
+ 
+SET(ALL_SOURCES ${ALL_SOURCES} ${SPECIFIC_FILES})
+SOURCE_GROUP(src FILES ${SPECIFIC_FILES})
+  
+SET(CAB_ADDITIONAL_LINK_LIBRARIES vfluids)
+
+#################################################################
+###   CREATE PROJECT                                          ###
+#################################################################
+CREATE_CAB_PROJECT(bond_b BINARY)
diff --git a/apps/cpu/bond_benchmark/bond_b.cpp b/apps/cpu/bond_benchmark/bond_b.cpp
index e85f9347796f3a0223f45d851bef28c91913fcaa..ba3221aa058aad9d9b0fb807bbbde05c21bc3bc0 100644
--- a/apps/cpu/bond_benchmark/bond_b.cpp
+++ b/apps/cpu/bond_benchmark/bond_b.cpp
@@ -1,337 +1,337 @@
-#ifdef VF_BOND
-
-#include <iostream>
-#include <string>
-
-#include <vfluids.h>
-
-#include "fbond.h"
-#include "Version.h"
-
-#include <stdlib.h>
-
-using namespace std;
-
-
-//////////////////////////////////////////////////////////////////////////
-void periodic(const char *cstr1, const char *cstr2)
-{
-   try
-   {
-      //Sleep(10000);
-      ConfigFileReader cf(cstr1);
-      if ( !cf.read() )
-      {
-         std::string exceptionText = "Unable to read configuration file\n";
-         throw exceptionText;
-      }
-
-      string machine = QUOTEME(CAB_MACHINE);
-      string pathname; 
-      int numOfThreads = UbSystem::stringTo<int>(cf.getValue("numOfThreads"));
-      double availMem = 0;
-
-      CommunicatorPtr comm;
-
-      string comm_type = cf.getValue("comm");
-      if(comm_type == "MPI")
-         comm = MPICommunicator::getInstance();
-      else if(comm_type == "BOND")
-         comm = BondCommunicator::getInstance();
-
-      int myid = comm->getProcessID();
-      int mybundle = comm->getBundleID();
-      int root = comm->getRoot();
-
-      UbLog::reportingLevel() = logDEBUG5;
-      system("hostname");
-      
-////////////////////////////////////////////// 
-//       char hostname[1024];
-//       hostname[1023] = '\0';
-//       gethostname(hostname, 1023);
-//       puts(hostname);
-//       UBLOG(logINFO,"hostname = " << string(hostname) );
-//////////////////////////////////////////////      
-
-      pathname = cf.getValue("path");
-
-      if(machine == "BOMBADIL") 
-      {
-         //pathname = "c:/temp/bond_test";
-         availMem = 3.0e9;
-      }
-      else if(machine == "M01" || machine == "M02")      
-      {
-         //pathname = "/work/koskuche/scratch/bond_test";
-         availMem = 1.5e9;
-
-         if(myid==root /*&& mybundle==root*/)
-         {
-            //UBLOG(logINFO,"bundle = " << mybundle);
-            //UBLOG(logINFO,"process ID = " << myid);
-            stringstream logFilename;
-            //logFilename <<  pathname + "/logfile"+UbSystem::toString(UbSystem::getTimeStamp())+"_"+UbSystem::toString(mybundle)+"_"+UbSystem::toString(myid)+"_"+comm_type+".txt";
-            logFilename <<  pathname + "/logfile"+UbSystem::toString(UbSystem::getTimeStamp())+"_"+UbSystem::toString(comm->getNumberOfProcesses())+"p_"+comm_type+".txt";
-            UbLog::output_policy::setStream(logFilename.str());
-            //UbLog::reportingLevel() = logDEBUG5;
-         }
-      }
-      else if(machine == "HICEGATE0")      
-      {
-         //pathname = "/work/koskuche/scratch/block_test";
-         availMem = 6.0e9;
-
-         if(myid ==0)
-         {
-            stringstream logFilename;
-            logFilename <<  pathname + "/logfile"+UbSystem::toString(UbSystem::getTimeStamp())+".txt";
-            UbLog::output_policy::setStream(logFilename.str());
-         }
-      } 
-      else throw UbException(UB_EXARGS, "unknown CAB_MACHINE");
-
-      //UBLOG(logINFO,"bundle = " << mybundle);
-      //UBLOG(logINFO,"process ID = " << myid);
-
-      double dx = 1;
-
-      const int blocknx1 = UbSystem::stringTo<int>(cf.getValue("blocknx1")); //16;
-      const int blocknx2 = UbSystem::stringTo<int>(cf.getValue("blocknx2"));//16;
-      const int blocknx3 = UbSystem::stringTo<int>(cf.getValue("blocknx3"));//16;
-
-      const int gridNx1 = UbSystem::stringTo<int>(cf.getValue("gridNx1"));//3;
-      const int gridNx2 = UbSystem::stringTo<int>(cf.getValue("gridNx2"));//3;
-      const int gridNx3 = UbSystem::stringTo<int>(cf.getValue("gridNx3"));//3;
-
-      double L1 = gridNx1*blocknx1;
-      double L2, L3, H;
-      L2 = L3 = H = gridNx2*blocknx1;
-
-      LBMReal uLB = 0.05;
-      LBMReal Re = 20.0;
-      LBMReal rhoLB = 0.0;
-      LBMReal nueLB = 0.05842;
-
-      LBMUnitConverterPtr conv = LBMUnitConverterPtr(new LBMUnitConverter());
-
-      const int baseLevel = 0;
-      const int refineLevel = UbSystem::stringTo<int>(cf.getValue("refineLevel"));
-
-      //bounding box
-      double d_minX1 = 0.0;
-      double d_minX2 = 0.0;
-      double d_minX3 = 0.0;
-
-      double d_maxX1 = L1;
-      double d_maxX2 = L2;
-      double d_maxX3 = L3;
-
-      double offs = dx;
-
-      double g_minX1 = d_minX1-offs;
-      double g_minX2 = d_minX2-offs;
-      double g_minX3 = d_minX3-offs;
-
-      double g_maxX1 = d_maxX1+offs;
-      double g_maxX2 = d_maxX2+offs;
-      double g_maxX3 = d_maxX3+offs;
-
-      double blockLength = blocknx1*dx;
-
-      //refinement area
-      //double off = 1;
-      //GbObject3DPtr refineCube(new  GbCuboid3D(cylinder->getX1Minimum()-off, cylinder->getX2Minimum()-off, cylinder->getX3Minimum(), 
-      //   cylinder->getX1Maximum()+off, cylinder->getX2Maximum()+off, cylinder->getX3Maximum()));
-
-      Grid3DPtr grid(new Grid3D(comm, blocknx1, blocknx2, blocknx3, gridNx1, gridNx2, gridNx3));
-      grid->setPeriodicX1(true);
-      grid->setPeriodicX2(true);
-      grid->setPeriodicX3(true);
-
-
-      if(myid ==0)
-      {
-         //UBLOG(logINFO,"bundle = " << mybundle);
-         //UBLOG(logINFO,"process ID = " << myid);
-         UBLOG(logINFO,"Parameters:");
-         UBLOG(logINFO,"Communicator =  " << comm_type);
-         UBLOG(logINFO,"Grid size =  " << gridNx1);
-         UBLOG(logINFO,"L = " << L1 );
-         UBLOG(logINFO,"v = " << uLB );
-         UBLOG(logINFO,"rho = " << rhoLB );
-         UBLOG(logINFO,"nue = " << nueLB );
-         UBLOG(logINFO,"Re = " << Re );
-         UBLOG(logINFO,"dx = " << dx );
-         UBLOG(logINFO,"number of levels = " << refineLevel+1 );
-         UBLOG(logINFO,"number of threads = " << numOfThreads );
-         UBLOG(logINFO,"number of processes = " << comm->getNumberOfProcesses() );
-         UBLOG(logINFO,"Preprocess - start");
-      }
-
-
-      //if (refineLevel > 0)
-      //{
-      //   if(myid == 0) UBLOG(logINFO,"Refinement - start");	
-      //   RefineCrossAndInsideGbObjectHelper refineHelper(grid, refineLevel);
-      //   refineHelper.addGbObject(refineCube, 1);
-      //   refineHelper.refine();
-      //   if(myid == 0) UBLOG(logINFO,"Refinement - end");	
-      //}
-
-      D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
-
-      if(comm_type == "MPI")
-      {
-         MetisPartitioningGridVisitor metisVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B, true, numOfThreads);
-         grid->accept( metisVisitor );
-         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
-         grid->accept( setConnsVisitor );
-      }
-      else if(comm_type == "BOND")
-      {
-         //MetisPartitioningWithBundlesGridVisitor metisVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B, true, numOfThreads);
-	 MetisPartitioningGridVisitor metisVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B, true, numOfThreads);
-         grid->accept( metisVisitor );
-         D3Q27BondSetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
-         grid->accept( setConnsVisitor );
-         setConnsVisitor.activate();
-      }
-
-      BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname + "/grid/blocks", WbWriterVtkXmlBinary::getInstance(), comm));
-      ppblocks->update(0);
-      ppblocks.reset();
-
-      unsigned long nob = grid->getNumberOfBlocks();
-      int gl = 3;
-
-      unsigned long nod = nob * (blocknx1) * (blocknx2) * (blocknx3);
-      unsigned long nodg = nob * (blocknx1+gl) * (blocknx2+gl) * (blocknx3+gl);
-      double needMemAll  = double(nodg*(27*sizeof(double) + sizeof(int) + sizeof(float)*4));
-      double needMem  = needMemAll / double(comm->getNumberOfProcesses());
-
-
-      if(myid == 0)
-      {
-         UBLOG(logINFO,"Number of blocks = " << nob);
-         UBLOG(logINFO,"Number of nodes  = " << nod);
-         int minInitLevel = grid->getCoarsestInitializedLevel();
-         int maxInitLevel = grid->getFinestInitializedLevel();
-         unsigned long nodb = (blocknx1) * (blocknx2) * (blocknx3);
-         for(int level = minInitLevel; level<=maxInitLevel; level++)
-         {
-            unsigned long nobl = grid->getNumberOfBlocks(level);
-            UBLOG(logINFO,"Number of blocks for level " << level <<" = " << nobl);
-            UBLOG(logINFO,"Number of nodes for level " << level <<" = " << nobl*nodb);
-         }
-         UBLOG(logINFO,"Necessary memory  = " << needMemAll  << " bytes");
-         UBLOG(logINFO,"Necessary memory per process = " << needMem  << " bytes");
-         UBLOG(logINFO,"Available memory per process = " << availMem << " bytes");
-      }            
-
-      LBMKernel3DPtr kernel;
-      rhoLB = 0.0;
-      kernel = LBMKernel3DPtr(new LBMKernelETD3Q27CCLB(blocknx1, blocknx2, blocknx3, LBMKernelETD3Q27CCLB::NORMAL));
-
-      BCProcessorPtr bcProc(new D3Q27ETBCProcessor());
-      kernel->setBCProcessor(bcProc);
-
-
-      SetKernelBlockVisitor kernelVisitor(kernel, nueLB, availMem, needMem);
-      grid->accept(kernelVisitor);
-
-      //if (refineLevel > 0)
-      //{
-      //   D3Q27SetUndefinedNodesBlockVisitor undefNodesVisitor;
-      //   grid->accept(undefNodesVisitor);
-      //}
-
-      //initialization of distributions
-      D3Q27ETInitDistributionsBlockVisitor initVisitor(nueLB, rhoLB);
-      initVisitor.setVx1(0.0);
-      grid->accept(initVisitor);
-
-      if(myid == 0) UBLOG(logINFO,"Preprocess - end"); 
-      
-      UbSchedulerPtr stepSch(new UbScheduler());
-      
-      UbSchedulerPtr nupsSch(new UbScheduler(10, 30, 100));
-      NUPSCounterPostprocessor npr(grid, nupsSch, pathname + "/results/nups.txt", comm);
-
-      UbSchedulerPtr visSch(new UbScheduler());
-      double endTime = UbSystem::stringTo<int>(cf.getValue("endTime"));//10001.0;
-
-      if(myid == 0)
-      {
-         UBLOG(logINFO,"//////////////////////////////////////////////////////////////////////////");
-         UBLOG(logINFO,"System information:");
-         UBLOG(logINFO,"Total Physical Memory (RAM): " << Utilities::getTotalPhysMem()/1073741824.0<< " GB");
-         UBLOG(logINFO,"Physical Memory currently used: " << Utilities::getPhysMemUsed()/1073741824.0<<" GB");
-         UBLOG(logINFO,"Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB");
-         UBLOG(logINFO,"//////////////////////////////////////////////////////////////////////////");
-      }
-
-      CalculationManagerPtr calculation;
-      if(comm_type == "MPI")
-         calculation = CalculationManagerPtr(new CalculationManager(grid, numOfThreads, endTime, stepSch, CalculationManager::MPI));
-      else if(comm_type == "BOND")
-         calculation = CalculationManagerPtr(new CalculationManager(grid, numOfThreads, endTime, stepSch, CalculationManager::MPI));
-      if(myid == 0) UBLOG(logINFO,"Simulation-start");
-      calculation->calculate();
-      if(myid == 0) UBLOG(logINFO,"Simulation-end");
-   }
-   catch(std::exception& e)
-   {
-      cerr << e.what() << endl << flush;
-   }
-   catch(std::string& s)
-   {
-      cerr << s << endl;
-   }
-   catch(...)
-   {
-      cerr << "unknown exception" << endl;
-   }
-
-}
-
-//////////////////////////////////////////////////////////////////////////
-int main(int argc, char* argv[])
-{
-   int returnval = 0;
-   try
-   {
-      if ( argv != NULL )
-      {
-         if (argc > 1)
-         {
-            //chanel(argv[1]);
-            periodic(argv[1], argv[2]);
-         }
-         else
-         {
-            cout << "Configuration file must be set!: " <<  argv[0] << " <config file>" << endl << std::flush;
-         }
-      }
-   }
-   catch(std::runtime_error& e)
-   {
-      std::cerr<<"\nRUNTIME ERROR: "<<e.what()<<"\n"<<std::endl;
-   }
-   catch(...)
-   {
-      std::cerr<<"unknown error"<<std::endl;
-   }
-   return returnval;
-}
-
-#endif
-
-
-
-
-
-
-
-
-
+#ifdef VF_BOND
+
+#include <iostream>
+#include <string>
+
+#include <vfluids.h>
+
+#include "fbond.h"
+#include "Version.h"
+
+#include <stdlib.h>
+
+using namespace std;
+
+
+//////////////////////////////////////////////////////////////////////////
+void periodic(const char *cstr1, const char *cstr2)
+{
+   try
+   {
+      //Sleep(10000);
+      ConfigFileReader cf(cstr1);
+      if ( !cf.read() )
+      {
+         std::string exceptionText = "Unable to read configuration file\n";
+         throw exceptionText;
+      }
+
+      string machine = QUOTEME(CAB_MACHINE);
+      string pathname; 
+      int numOfThreads = UbSystem::stringTo<int>(cf.getValue("numOfThreads"));
+      double availMem = 0;
+
+      CommunicatorPtr comm;
+
+      string comm_type = cf.getValue("comm");
+      if(comm_type == "MPI")
+         comm = MPICommunicator::getInstance();
+      else if(comm_type == "BOND")
+         comm = BondCommunicator::getInstance();
+
+      int myid = comm->getProcessID();
+      int mybundle = comm->getBundleID();
+      int root = comm->getRoot();
+
+      UbLog::reportingLevel() = logDEBUG5;
+      system("hostname");
+      
+////////////////////////////////////////////// 
+//       char hostname[1024];
+//       hostname[1023] = '\0';
+//       gethostname(hostname, 1023);
+//       puts(hostname);
+//       UBLOG(logINFO,"hostname = " << string(hostname) );
+//////////////////////////////////////////////      
+
+      pathname = cf.getValue("path");
+
+      if(machine == "BOMBADIL") 
+      {
+         //pathname = "c:/temp/bond_test";
+         availMem = 3.0e9;
+      }
+      else if(machine == "M01" || machine == "M02")      
+      {
+         //pathname = "/work/koskuche/scratch/bond_test";
+         availMem = 1.5e9;
+
+         if(myid==root /*&& mybundle==root*/)
+         {
+            //UBLOG(logINFO,"bundle = " << mybundle);
+            //UBLOG(logINFO,"process ID = " << myid);
+            stringstream logFilename;
+            //logFilename <<  pathname + "/logfile"+UbSystem::toString(UbSystem::getTimeStamp())+"_"+UbSystem::toString(mybundle)+"_"+UbSystem::toString(myid)+"_"+comm_type+".txt";
+            logFilename <<  pathname + "/logfile"+UbSystem::toString(UbSystem::getTimeStamp())+"_"+UbSystem::toString(comm->getNumberOfProcesses())+"p_"+comm_type+".txt";
+            UbLog::output_policy::setStream(logFilename.str());
+            //UbLog::reportingLevel() = logDEBUG5;
+         }
+      }
+      else if(machine == "HICEGATE0")      
+      {
+         //pathname = "/work/koskuche/scratch/block_test";
+         availMem = 6.0e9;
+
+         if(myid ==0)
+         {
+            stringstream logFilename;
+            logFilename <<  pathname + "/logfile"+UbSystem::toString(UbSystem::getTimeStamp())+".txt";
+            UbLog::output_policy::setStream(logFilename.str());
+         }
+      } 
+      else throw UbException(UB_EXARGS, "unknown CAB_MACHINE");
+
+      //UBLOG(logINFO,"bundle = " << mybundle);
+      //UBLOG(logINFO,"process ID = " << myid);
+
+      double dx = 1;
+
+      const int blocknx1 = UbSystem::stringTo<int>(cf.getValue("blocknx1")); //16;
+      const int blocknx2 = UbSystem::stringTo<int>(cf.getValue("blocknx2"));//16;
+      const int blocknx3 = UbSystem::stringTo<int>(cf.getValue("blocknx3"));//16;
+
+      const int gridNx1 = UbSystem::stringTo<int>(cf.getValue("gridNx1"));//3;
+      const int gridNx2 = UbSystem::stringTo<int>(cf.getValue("gridNx2"));//3;
+      const int gridNx3 = UbSystem::stringTo<int>(cf.getValue("gridNx3"));//3;
+
+      double L1 = gridNx1*blocknx1;
+      double L2, L3, H;
+      L2 = L3 = H = gridNx2*blocknx1;
+
+      LBMReal uLB = 0.05;
+      LBMReal Re = 20.0;
+      LBMReal rhoLB = 0.0;
+      LBMReal nueLB = 0.05842;
+
+      LBMUnitConverterPtr conv = LBMUnitConverterPtr(new LBMUnitConverter());
+
+      const int baseLevel = 0;
+      const int refineLevel = UbSystem::stringTo<int>(cf.getValue("refineLevel"));
+
+      //bounding box
+      double d_minX1 = 0.0;
+      double d_minX2 = 0.0;
+      double d_minX3 = 0.0;
+
+      double d_maxX1 = L1;
+      double d_maxX2 = L2;
+      double d_maxX3 = L3;
+
+      double offs = dx;
+
+      double g_minX1 = d_minX1-offs;
+      double g_minX2 = d_minX2-offs;
+      double g_minX3 = d_minX3-offs;
+
+      double g_maxX1 = d_maxX1+offs;
+      double g_maxX2 = d_maxX2+offs;
+      double g_maxX3 = d_maxX3+offs;
+
+      double blockLength = blocknx1*dx;
+
+      //refinement area
+      //double off = 1;
+      //GbObject3DPtr refineCube(new  GbCuboid3D(cylinder->getX1Minimum()-off, cylinder->getX2Minimum()-off, cylinder->getX3Minimum(), 
+      //   cylinder->getX1Maximum()+off, cylinder->getX2Maximum()+off, cylinder->getX3Maximum()));
+
+      Grid3DPtr grid(new Grid3D(comm, blocknx1, blocknx2, blocknx3, gridNx1, gridNx2, gridNx3));
+      grid->setPeriodicX1(true);
+      grid->setPeriodicX2(true);
+      grid->setPeriodicX3(true);
+
+
+      if(myid ==0)
+      {
+         //UBLOG(logINFO,"bundle = " << mybundle);
+         //UBLOG(logINFO,"process ID = " << myid);
+         UBLOG(logINFO,"Parameters:");
+         UBLOG(logINFO,"Communicator =  " << comm_type);
+         UBLOG(logINFO,"Grid size =  " << gridNx1);
+         UBLOG(logINFO,"L = " << L1 );
+         UBLOG(logINFO,"v = " << uLB );
+         UBLOG(logINFO,"rho = " << rhoLB );
+         UBLOG(logINFO,"nue = " << nueLB );
+         UBLOG(logINFO,"Re = " << Re );
+         UBLOG(logINFO,"dx = " << dx );
+         UBLOG(logINFO,"number of levels = " << refineLevel+1 );
+         UBLOG(logINFO,"number of threads = " << numOfThreads );
+         UBLOG(logINFO,"number of processes = " << comm->getNumberOfProcesses() );
+         UBLOG(logINFO,"Preprocess - start");
+      }
+
+
+      //if (refineLevel > 0)
+      //{
+      //   if(myid == 0) UBLOG(logINFO,"Refinement - start");	
+      //   RefineCrossAndInsideGbObjectHelper refineHelper(grid, refineLevel);
+      //   refineHelper.addGbObject(refineCube, 1);
+      //   refineHelper.refine();
+      //   if(myid == 0) UBLOG(logINFO,"Refinement - end");	
+      //}
+
+      D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
+
+      if(comm_type == "MPI")
+      {
+         MetisPartitioningGridVisitor metisVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B, true, numOfThreads);
+         grid->accept( metisVisitor );
+         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
+         grid->accept( setConnsVisitor );
+      }
+      else if(comm_type == "BOND")
+      {
+         //MetisPartitioningWithBundlesGridVisitor metisVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B, true, numOfThreads);
+	 MetisPartitioningGridVisitor metisVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B, true, numOfThreads);
+         grid->accept( metisVisitor );
+         D3Q27BondSetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
+         grid->accept( setConnsVisitor );
+         setConnsVisitor.activate();
+      }
+
+      BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname + "/grid/blocks", WbWriterVtkXmlBinary::getInstance(), comm));
+      ppblocks->update(0);
+      ppblocks.reset();
+
+      unsigned long nob = grid->getNumberOfBlocks();
+      int gl = 3;
+
+      unsigned long nod = nob * (blocknx1) * (blocknx2) * (blocknx3);
+      unsigned long nodg = nob * (blocknx1+gl) * (blocknx2+gl) * (blocknx3+gl);
+      double needMemAll  = double(nodg*(27*sizeof(double) + sizeof(int) + sizeof(float)*4));
+      double needMem  = needMemAll / double(comm->getNumberOfProcesses());
+
+
+      if(myid == 0)
+      {
+         UBLOG(logINFO,"Number of blocks = " << nob);
+         UBLOG(logINFO,"Number of nodes  = " << nod);
+         int minInitLevel = grid->getCoarsestInitializedLevel();
+         int maxInitLevel = grid->getFinestInitializedLevel();
+         unsigned long nodb = (blocknx1) * (blocknx2) * (blocknx3);
+         for(int level = minInitLevel; level<=maxInitLevel; level++)
+         {
+            unsigned long nobl = grid->getNumberOfBlocks(level);
+            UBLOG(logINFO,"Number of blocks for level " << level <<" = " << nobl);
+            UBLOG(logINFO,"Number of nodes for level " << level <<" = " << nobl*nodb);
+         }
+         UBLOG(logINFO,"Necessary memory  = " << needMemAll  << " bytes");
+         UBLOG(logINFO,"Necessary memory per process = " << needMem  << " bytes");
+         UBLOG(logINFO,"Available memory per process = " << availMem << " bytes");
+      }            
+
+      LBMKernel3DPtr kernel;
+      rhoLB = 0.0;
+      kernel = LBMKernel3DPtr(new LBMKernelETD3Q27CCLB(blocknx1, blocknx2, blocknx3, LBMKernelETD3Q27CCLB::NORMAL));
+
+      BCProcessorPtr bcProc(new D3Q27ETBCProcessor());
+      kernel->setBCProcessor(bcProc);
+
+
+      SetKernelBlockVisitor kernelVisitor(kernel, nueLB, availMem, needMem);
+      grid->accept(kernelVisitor);
+
+      //if (refineLevel > 0)
+      //{
+      //   D3Q27SetUndefinedNodesBlockVisitor undefNodesVisitor;
+      //   grid->accept(undefNodesVisitor);
+      //}
+
+      //initialization of distributions
+      D3Q27ETInitDistributionsBlockVisitor initVisitor(nueLB, rhoLB);
+      initVisitor.setVx1(0.0);
+      grid->accept(initVisitor);
+
+      if(myid == 0) UBLOG(logINFO,"Preprocess - end"); 
+      
+      UbSchedulerPtr stepSch(new UbScheduler());
+      
+      UbSchedulerPtr nupsSch(new UbScheduler(10, 30, 100));
+      NUPSCounterPostprocessor npr(grid, nupsSch, pathname + "/results/nups.txt", comm);
+
+      UbSchedulerPtr visSch(new UbScheduler());
+      double endTime = UbSystem::stringTo<int>(cf.getValue("endTime"));//10001.0;
+
+      if(myid == 0)
+      {
+         UBLOG(logINFO,"//////////////////////////////////////////////////////////////////////////");
+         UBLOG(logINFO,"System information:");
+         UBLOG(logINFO,"Total Physical Memory (RAM): " << Utilities::getTotalPhysMem()/1073741824.0<< " GB");
+         UBLOG(logINFO,"Physical Memory currently used: " << Utilities::getPhysMemUsed()/1073741824.0<<" GB");
+         UBLOG(logINFO,"Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB");
+         UBLOG(logINFO,"//////////////////////////////////////////////////////////////////////////");
+      }
+
+      CalculationManagerPtr calculation;
+      if(comm_type == "MPI")
+         calculation = CalculationManagerPtr(new CalculationManager(grid, numOfThreads, endTime, stepSch, CalculationManager::MPI));
+      else if(comm_type == "BOND")
+         calculation = CalculationManagerPtr(new CalculationManager(grid, numOfThreads, endTime, stepSch, CalculationManager::MPI));
+      if(myid == 0) UBLOG(logINFO,"Simulation-start");
+      calculation->calculate();
+      if(myid == 0) UBLOG(logINFO,"Simulation-end");
+   }
+   catch(std::exception& e)
+   {
+      cerr << e.what() << endl << flush;
+   }
+   catch(std::string& s)
+   {
+      cerr << s << endl;
+   }
+   catch(...)
+   {
+      cerr << "unknown exception" << endl;
+   }
+
+}
+
+//////////////////////////////////////////////////////////////////////////
+int main(int argc, char* argv[])
+{
+   int returnval = 0;
+   try
+   {
+      if ( argv != NULL )
+      {
+         if (argc > 1)
+         {
+            //chanel(argv[1]);
+            periodic(argv[1], argv[2]);
+         }
+         else
+         {
+            cout << "Configuration file must be set!: " <<  argv[0] << " <config file>" << endl << std::flush;
+         }
+      }
+   }
+   catch(std::runtime_error& e)
+   {
+      std::cerr<<"\nRUNTIME ERROR: "<<e.what()<<"\n"<<std::endl;
+   }
+   catch(...)
+   {
+      std::cerr<<"unknown error"<<std::endl;
+   }
+   return returnval;
+}
+
+#endif
+
+
+
+
+
+
+
+
+
diff --git a/apps/cpu/bond_benchmark/config.txt b/apps/cpu/bond_benchmark/config.txt
index 7c83ead3a3acec963e60fa429e713b09ec865fda..48f758eba2751e762d72b97fb91503aaf82b7c0f 100644
--- a/apps/cpu/bond_benchmark/config.txt
+++ b/apps/cpu/bond_benchmark/config.txt
@@ -1,31 +1,31 @@
-#number of threads
-numOfThreads = 1
-
-#block dimesions
-blocknx1 = 8
-blocknx2 = 8
-blocknx3 = 8
-
-#grid dimensions
-gridNx1 = 20
-#100
-gridNx2 = 6
-#20
-gridNx3 = 6
-#20
-
-#grid refinement
-refineLevel = 0
-
-#communication
-comm=MPI
-#comm=BOND
-
-#simulation
-path = /work/koskuche/scratch/bond_b
-endTime = 101
-
-#NUPS count scheduler
-step  = 10
-begin = 20
-end   = 100
+#number of threads
+numOfThreads = 1
+
+#block dimesions
+blocknx1 = 8
+blocknx2 = 8
+blocknx3 = 8
+
+#grid dimensions
+gridNx1 = 20
+#100
+gridNx2 = 6
+#20
+gridNx3 = 6
+#20
+
+#grid refinement
+refineLevel = 0
+
+#communication
+comm=MPI
+#comm=BOND
+
+#simulation
+path = /work/koskuche/scratch/bond_b
+endTime = 101
+
+#NUPS count scheduler
+step  = 10
+begin = 20
+end   = 100
diff --git a/apps/cpu/bond_test/CMakeLists.txt b/apps/cpu/bond_test/CMakeLists.txt
index a13830a0264757027227dc484337e75e4e2ee13c..1bb473c949127f4deedabd11f23e02f3478db7d5 100644
--- a/apps/cpu/bond_test/CMakeLists.txt
+++ b/apps/cpu/bond_test/CMakeLists.txt
@@ -1,25 +1,25 @@
-CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
-
-########################################################
-## C++ PROJECT                                       ###
-########################################################
-PROJECT(bond_test)
-
-INCLUDE(${SOURCE_ROOT}/lib/IncludsList.txt) 
-
-#################################################################
-###   LOCAL FILES                                             ###
-#################################################################
-FILE(GLOB SPECIFIC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.h
-                         ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
-                         ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp  )
- 
-SET(ALL_SOURCES ${ALL_SOURCES} ${SPECIFIC_FILES})
-SOURCE_GROUP(src FILES ${SPECIFIC_FILES})
-  
-SET(CAB_ADDITIONAL_LINK_LIBRARIES vfluids)
-
-#################################################################
-###   CREATE PROJECT                                          ###
-#################################################################
-CREATE_CAB_PROJECT(bond_test BINARY)
+CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
+
+########################################################
+## C++ PROJECT                                       ###
+########################################################
+PROJECT(bond_test)
+
+INCLUDE(${SOURCE_ROOT}/lib/IncludsList.txt) 
+
+#################################################################
+###   LOCAL FILES                                             ###
+#################################################################
+FILE(GLOB SPECIFIC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.h
+                         ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
+                         ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp  )
+ 
+SET(ALL_SOURCES ${ALL_SOURCES} ${SPECIFIC_FILES})
+SOURCE_GROUP(src FILES ${SPECIFIC_FILES})
+  
+SET(CAB_ADDITIONAL_LINK_LIBRARIES vfluids)
+
+#################################################################
+###   CREATE PROJECT                                          ###
+#################################################################
+CREATE_CAB_PROJECT(bond_test BINARY)
diff --git a/apps/cpu/bond_test/bond_test.cpp b/apps/cpu/bond_test/bond_test.cpp
index 6511603e0108cc4b77409e1b1394692750c9349b..06e9d7710b7067d289292df29a615763f9b0b5fa 100644
--- a/apps/cpu/bond_test/bond_test.cpp
+++ b/apps/cpu/bond_test/bond_test.cpp
@@ -1,500 +1,500 @@
-#ifdef VF_BOND
-
-#include <iostream>
-#include <string>
-
-#include <vfluids.h>
-
-#include "fbond.h"
-#include "Version.h"
-
-
-using namespace std;
-
-int agent_main();
-void simulation(const char *cstr);
-
-int main(int argc, char* argv[])
-{
-   int returnval = 0;
-   try
-   {
-      bond::init();
-      returnval = agent_main();
-      bond::finalize();
-
-      //CommunicatorPtr comm(new BondCommunicator());
-      //cout<<"Bundle ID = "<<comm->getBundleID()<<", MPI rank = "<<comm->getProcessID()<<", root = "<<comm->getRoot()<<endl;
-
-      //if ( argv != NULL )
-      //{
-      //   if (argc > 1)
-      //   {
-      //      simulation(argv[1]);
-      //   }
-      //   else
-      //   {
-      //      cout << "Configuration file must be set!: " <<  argv[0] << " <config file>" << endl << std::flush;
-      //   }
-      //}
-   }
-   catch(std::runtime_error& e)
-   {
-      std::cerr<<"\nRUNTIME ERROR: "<<e.what()<<"\n"<<std::endl;
-   }
-   catch(...)
-   {
-      std::cerr<<"unknown error"<<std::endl;
-   }
-   return returnval;
-}
-
-
-int agent_main()
-{
-   cout<<"\n=== bond lib info:\n"<<bond::Version::info()<<"\n===\n\n";
-
-   // try to work around a bug in mpich (at least mpich2-1.4.1p1 and mpich2-1.5a1)
-   int _mpiInitialized = (int)false;
-   MPI_Initialized(&_mpiInitialized);
-   if(!_mpiInitialized)
-      MPI_Init(0, 0);	
-
-   int mpi_rank;
-   MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
-   int mpi_size;
-   MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
-   cout<<"I am process "<<bond::processID()<<" of "<<bond::processCount()
-      <<", bundle ID "<<bond::bundleID()<<" of "<<bond::bundleCount()
-      <<", MPI rank "<<mpi_rank<<" of "<<mpi_size<<"\n";
-
-   if(bond::processID() == 0)
-   {
-      try
-      {
-         Sleep(10000);
-         // send
-         vector<double> data(42);
-         data[0] = 123.1;
-         data[data.size()-1] = -999.1;
-
-         int dst_rank = 1;
-         int msg_tag = 42;
-         cout<<"["<<bond::processID()<<"] nonblocking send ... "<<data[0]<<"..."<<data[data.size()-1]<<"\n";
-         std::tr1::shared_ptr<bond::FutureSend> fus = bond::sendFuture(&data[0], data.size(), MPI_DOUBLE, dst_rank, msg_tag);
-
-         vector<double> data2(42);
-         data2[0] = 123.2;
-         data2[data2.size()-1] = -999.2;
-         cout<<"["<<bond::processID()<<"] blocking send ... "<<data2[0]<<"..."<<data2[data.size()-1]<<"\n";
-         bond::sendComplete(&data2[0], data2.size(), MPI_DOUBLE, dst_rank, msg_tag);
-
-         //Sleep(10000);
-
-         fus->complete();
-      }
-      catch(std::runtime_error& e)
-      {
-         std::cerr<<"\nSEND ERROR: "<<e.what()<<"\n"<<std::endl;
-      }
-   }
-   else
-   {
-      try
-      {
-         // receive
-         vector<double> data(42);
-         int src_rank = 0;
-         cout<<"["<<bond::processID()<<"] nonblocking receive ...\n";
-         int msg_tag = 42;
-         std::tr1::shared_ptr<bond::FutureReceive> fur = bond::receiveFuture(&data[0], data.size(), MPI_DOUBLE, src_rank, msg_tag);
-
-
-         //Sleep(10000);
-
-         cout<<"["<<bond::processID()<<"] blocking receive ...\n";
-         vector<double> data2(42);
-         bond::receiveComplete(&data2[0], data2.size(), MPI_DOUBLE, src_rank, msg_tag);
-         cout<<"received blocking "<<data2[0]<<"..."<<data2[data.size()-1]<<"\n";
-
-         
-
-         fur->complete();
-         cout<<"received nonblocking "<<data[0]<<"..."<<data[data.size()-1]<<"\n";
-      }
-      catch(std::runtime_error& e)
-      {
-         std::cerr<<"\nRECEIVE ERROR: "<<e.what()<<"\n"<<std::endl;
-      }
-   }
-
-   cout<<"process "<<bond::processID()<<" done\n";
-   return 0;
-}
-//////////////////////////////////////////////////////////////////////////
-void simulation(const char *cstr)
-{
-   try
-   {
-      ConfigFileReader cf(cstr);
-      if ( !cf.read() )
-      {
-         std::string exceptionText = "Unable to read configuration file\n";
-         throw exceptionText;
-      }
-
-      //UbLog::reportingLevel() = logDEBUG5;
-
-      string machine = QUOTEME(CAB_MACHINE);
-      string pathname = cf.getValue("path"); 
-      int numOfThreads = UbSystem::stringTo<int>(cf.getValue("numOfThreads"));
-      double availMem = 0;
-
-      CommunicatorPtr comm;
-      string comm_type = cf.getValue("comm");
-      if(comm_type == "MPI")
-         comm = MPICommunicator::getInstance();
-      else if(comm_type == "BOND")
-         comm = BondCommunicator::getInstance();
-
-      int myid = comm->getProcessID();
-      int mybundle = comm->getBundleID();
-      int root = comm->getRoot();
-
-      //UbLog::reportingLevel() = logDEBUG5;
-
-      if(machine == "BOMBADIL") 
-      {
-         availMem = 3.0e9;
-      }
-      else if(machine == "M01" || machine == "M02")      
-      {
-         availMem = 12.0e9;
-
-         if(myid==root && mybundle==root)
-         {
-            stringstream logFilename;
-            logFilename <<  pathname + "/logfile"+UbSystem::toString(UbSystem::getTimeStamp())+".txt";
-            UbLog::output_policy::setStream(logFilename.str());
-         }
-      }
-      else throw UbException(UB_EXARGS, "unknown CAB_MACHINE");
-
-      double dx = 1;
-
-      const int blocknx1 = UbSystem::stringTo<int>(cf.getValue("blocknx1")); //16;
-      const int blocknx2 = UbSystem::stringTo<int>(cf.getValue("blocknx2"));//16;
-      const int blocknx3 = UbSystem::stringTo<int>(cf.getValue("blocknx3"));//16;
-
-      const int gridNx1 = UbSystem::stringTo<int>(cf.getValue("gridNx1"));//3;
-      const int gridNx2 = UbSystem::stringTo<int>(cf.getValue("gridNx2"));//3;
-      const int gridNx3 = UbSystem::stringTo<int>(cf.getValue("gridNx3"));//3;
-
-
-      double L1 = gridNx1*blocknx1;
-      double L2, L3, H;
-      L2 = L3 = H = gridNx2*blocknx1;
-
-      LBMReal radius = 7;
-      LBMReal uLB = 0.05;
-      LBMReal Re = 300.0;
-      LBMReal rhoLB = 0.0;
-      LBMReal l = L2 / dx;
-      LBMReal nueLB = (((4.0/9.0)*uLB)*2.0*(radius/dx))/Re;
-
-
-      LBMUnitConverterPtr conv = LBMUnitConverterPtr(new LBMUnitConverter());
-
-      const int baseLevel = 0;
-      const int refineLevel = UbSystem::stringTo<int>(cf.getValue("refineLevel"));
-
-      //obstacle
-      GbObject3DPtr cylinder(new GbCylinder3D(L1*0.5, L2*0.5, 0, L1*0.5, L2*0.5, L3, radius));
-      GbSystem3D::writeGeoObject(cylinder.get(),pathname + "/geo/cylinder", WbWriterVtkXmlBinary::getInstance());
-
-      D3Q27InteractorPtr cylinderInt;
-
-      //bounding box
-      double d_minX1 = 0.0;
-      double d_minX2 = 0.0;
-      double d_minX3 = 0.0;
-
-      double d_maxX1 = L1;
-      double d_maxX2 = L2;
-      double d_maxX3 = L3;
-
-      double offs = dx;
-
-      //double g_minX1 = d_minX1-offs-0.499999*dx;
-      double g_minX1 = d_minX1-offs;
-      double g_minX2 = d_minX2-offs;
-      double g_minX3 = d_minX3-offs;
-
-      double g_maxX1 = d_maxX1+offs;
-      double g_maxX2 = d_maxX2+offs;
-      double g_maxX3 = d_maxX3+offs;
-
-      double blockLength = blocknx1*dx;
-
-      //refinement area
-      double off = 1;
-      GbObject3DPtr refineCube(new  GbCuboid3D(cylinder->getX1Minimum()-off, cylinder->getX2Minimum()-off, cylinder->getX3Minimum(), 
-         cylinder->getX1Maximum()+off, cylinder->getX2Maximum()+off, cylinder->getX3Maximum()));
-
-      Grid3DPtr grid(new Grid3D(comm, blocknx1, blocknx2, blocknx3, gridNx1, gridNx2, gridNx3));
-
-      //grid->setPeriodicX1(true);
-      //grid->setPeriodicX2(true);
-      //grid->setPeriodicX3(true);
-
-
-      if(myid ==0)
-      {
-         UBLOG(logINFO,"Parameters:");
-         UBLOG(logINFO,"L = " << L2/dx );
-         UBLOG(logINFO,"v = " << uLB );
-         UBLOG(logINFO,"rho = " << rhoLB );
-         UBLOG(logINFO,"nue = " << nueLB );
-         UBLOG(logINFO,"Re = " << Re );
-         UBLOG(logINFO,"dx = " << dx );
-         UBLOG(logINFO,"number of levels = " << refineLevel+1 );
-         UBLOG(logINFO,"numOfThreads = " << numOfThreads );
-         UBLOG(logINFO,"Preprozess - start");
-      }
-
-      if(myid ==0) GbSystem3D::writeGeoObject(refineCube.get(),pathname + "/geo/refineCube", WbWriterVtkXmlBinary::getInstance());
-
-      //walls
-      GbCuboid3DPtr addWallYmin (new GbCuboid3D(d_minX1-4.0*blockLength, d_minX2-4.0*blockLength, d_minX3-4.0*blockLength, d_maxX1+4.0*blockLength, d_minX2, d_maxX3+4.0*blockLength));
-      if(myid == 0) GbSystem3D::writeGeoObject(addWallYmin.get(), pathname+"/geo/addWallYmin", WbWriterVtkXmlASCII::getInstance());
-
-      GbCuboid3DPtr addWallZmin (new GbCuboid3D(d_minX1-4.0*blockLength, d_minX2-4.0*blockLength, d_minX3-4.0*blockLength, d_maxX1+4.0*blockLength, d_maxX2+4.0*blockLength, d_minX3));
-      if(myid == 0) GbSystem3D::writeGeoObject(addWallZmin.get(), pathname+"/geo/addWallZmin", WbWriterVtkXmlASCII::getInstance());
-
-      GbCuboid3DPtr addWallYmax (new GbCuboid3D(d_minX1-4.0*blockLength, d_maxX2, d_minX3-4.0*blockLength, d_maxX1+4.0*blockLength, d_maxX2+4.0*blockLength, d_maxX3+4.0*blockLength));
-      if(myid == 0) GbSystem3D::writeGeoObject(addWallYmax.get(), pathname+"/geo/addWallYmax", WbWriterVtkXmlASCII::getInstance());
-
-      GbCuboid3DPtr addWallZmax (new GbCuboid3D(d_minX1-4.0*blockLength, d_minX2-4.0*blockLength, d_maxX3, d_maxX1+4.0*blockLength, d_maxX2+4.0*blockLength, d_maxX3+4.0*blockLength));
-      if(myid == 0) GbSystem3D::writeGeoObject(addWallZmax.get(), pathname+"/geo/addWallZmax", WbWriterVtkXmlASCII::getInstance());
-
-      //inflow
-      GbCuboid3DPtr geoInflow (new GbCuboid3D(d_minX1-4.0*blockLength, d_minX2-4.0*blockLength, d_minX3-4.0*blockLength, d_minX1, d_maxX2+4.0*blockLength, d_maxX3+4.0*blockLength));
-      if(myid == 0) GbSystem3D::writeGeoObject(geoInflow.get(), pathname+"/geo/geoInflow", WbWriterVtkXmlASCII::getInstance());
-
-      //outflow
-      GbCuboid3DPtr geoOutflow (new GbCuboid3D(d_maxX1, d_minX2-4.0*blockLength, d_minX3-4.0*blockLength, d_maxX1+4.0*blockLength, d_maxX2+4.0*blockLength, d_maxX3+4.0*blockLength));
-      if(myid == 0) GbSystem3D::writeGeoObject(geoOutflow.get(), pathname+"/geo/geoOutflow", WbWriterVtkXmlASCII::getInstance());
-
-      BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname + "/grid/blocks", WbWriterVtkXmlBinary::getInstance(), comm));
-
-      if (refineLevel > 0)
-      {
-         if(myid == 0) UBLOG(logINFO,"Refinement - start");	
-         RefineCrossAndInsideGbObjectBlockVisitor refVisitor(refineCube, refineLevel);
-         grid->accept(refVisitor);
-
-         RatioBlockVisitor ratioVisitor(refineLevel);
-         grid->accept(ratioVisitor);
-
-         RatioSmoothBlockVisitor ratioSmoothVisitor(refineLevel);
-         grid->accept(ratioSmoothVisitor);
-
-         OverlapBlockVisitor overlapVisitor(refineLevel);
-         grid->accept(overlapVisitor);
-
-         std::vector<int> dirs;
-         D3Q27System::getLBMDirections(dirs);
-         SetInterpolationDirsBlockVisitor interDirsVisitor(dirs);
-         grid->accept(interDirsVisitor);
-         if(myid == 0) UBLOG(logINFO,"Refinement - end");	
-      }
-
-
-      D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
-
-      if(comm_type == "MPI")
-      {
-         MetisPartitioningGridVisitor metisVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B, true, numOfThreads);
-         grid->accept( metisVisitor );
-         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
-         grid->accept( setConnsVisitor );
-      }
-      else if(comm_type == "BOND")
-      {
-         MetisPartitioningWithBundlesGridVisitor metisVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B, true, numOfThreads);
-         grid->accept( metisVisitor );
-         D3Q27BondSetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
-         grid->accept( setConnsVisitor );
-         setConnsVisitor.activate();
-      }
-      
-      int bbOption = 1; //0=simple Bounce Back, 1=quadr. BB
-      D3Q27BoundaryConditionAdapterPtr bcObst(new D3Q27NoSlipBCAdapter(bbOption));
-      cylinderInt = D3Q27InteractorPtr ( new D3Q27Interactor(cylinder, grid, bcObst,Interactor3D::SOLID));
-
-      //walls
-      D3Q27InteractorPtr addWallYminInt(new D3Q27Interactor(addWallYmin, grid, bcObst,Interactor3D::SOLID));
-      D3Q27InteractorPtr addWallZminInt(new D3Q27Interactor(addWallZmin, grid, bcObst,Interactor3D::SOLID));
-      D3Q27InteractorPtr addWallYmaxInt(new D3Q27Interactor(addWallYmax, grid, bcObst,Interactor3D::SOLID));
-      D3Q27InteractorPtr addWallZmaxInt(new D3Q27Interactor(addWallZmax, grid, bcObst,Interactor3D::SOLID));
-
-      mu::Parser fct;
-      fct.SetExpr("16*U*x2*x3*(H-x2)*(H-x3)/H^4");
-      fct.DefineConst("U", uLB);
-      fct.DefineConst("H", H);
-
-      //inflow
-      D3Q27BoundaryConditionAdapterPtr velBCAdapter(new D3Q27VelocityBCAdapter (true, false ,false ,fct, 0, D3Q27BCFunction::INFCONST));
-      velBCAdapter->setSecondaryBcOption(2);
-      D3Q27InteractorPtr inflowInt  = D3Q27InteractorPtr( new D3Q27Interactor(geoInflow, grid, velBCAdapter, Interactor3D::SOLID));
-
-      //outflow
-      D3Q27BoundaryConditionAdapterPtr denBCAdapter(new D3Q27DensityBCAdapter(rhoLB));
-      D3Q27InteractorPtr outflowInt = D3Q27InteractorPtr( new D3Q27Interactor(geoOutflow, grid, denBCAdapter,Interactor3D::SOLID));
-
-      //SolidBlocksHelper sd(grid, comm);
-      //sd.addInteractor(cylinderInt);
-      //sd.addInteractor(addWallYminInt);
-      //sd.addInteractor(addWallZminInt);
-      //sd.addInteractor(addWallYmaxInt);
-      //sd.addInteractor(addWallZmaxInt);
-      //sd.addInteractor(inflowInt);
-      //sd.addInteractor(outflowInt);
-
-      //sd.deleteSolidBlocks();
-
-      //grid->accept( metisVisitor );
-
-      //grid->getBlock(0)->setBundle(0);
-      //grid->getBlock(0)->setRank(0);
-      //grid->getBlock(1)->setBundle(1);
-      //grid->getBlock(1)->setRank(1);
-      //grid->getBlock(2)->setBundle(0);
-      //grid->getBlock(2)->setRank(0);
-      //grid->getBlock(3)->setBundle(1);
-      //grid->getBlock(3)->setRank(1);
-      //grid->getBlock(4)->setBundle(0);
-      //grid->getBlock(4)->setRank(0);
-      //grid->getBlock(5)->setBundle(1);
-      //grid->getBlock(5)->setRank(1);
-      //grid->getBlock(6)->setBundle(1);
-      //grid->getBlock(6)->setRank(1);
-      //grid->getBlock(7)->setBundle(0);
-      //grid->getBlock(7)->setRank(0);
-
-      ppblocks->update(0);
-      ppblocks.reset();
-
-      unsigned long nob = grid->getNumberOfBlocks();
-      int gl = 3;
-      unsigned long nod = nob * (blocknx1+gl) * (blocknx2+gl) * (blocknx3+gl);
-
-      double needMemAll  = double(nod*(27*sizeof(double) + sizeof(int) + sizeof(float)*4));
-      double needMem  = needMemAll / double(comm->getNumberOfProcesses());
-
-      if(myid == 0)
-      {
-         UBLOG(logINFO,"Number of blocks = " << nob);
-         UBLOG(logINFO,"Number of nodes  = " << nod);
-         UBLOG(logINFO,"Necessary memory  = " << needMemAll  << " bytes");
-         UBLOG(logINFO,"Necessary memory per process = " << needMem  << " bytes");
-         UBLOG(logINFO,"Available memory per process = " << availMem << " bytes");
-      }            
-
-      //LBMKernel3DPtr kernel(new LBMKernelETD3Q27Cascaded(blocknx1, blocknx2, blocknx3));
-      //LBMKernel3DPtr kernel(new LBMKernelETD3Q27BGK(blocknx1, blocknx2, blocknx3, true));
-      //option = 0 - ohne param., option = 1 - mit param.
-      int option = 0;
-      LBMKernel3DPtr kernel(new LBMKernelETD3Q27CCLB(blocknx1, blocknx2, blocknx3, LBMKernelETD3Q27CCLB::NORMAL));
-
-      BCProcessorPtr bcProc(new D3Q27ETBCProcessor());
-      kernel->setBCProcessor(bcProc);
-
-      SetKernelBlockVisitor kernelVisitor(kernel, nueLB, availMem, needMem);
-      grid->accept(kernelVisitor);
-
-      if (refineLevel > 0)
-      {
-         D3Q27SetUndefinedNodesBlockVisitor undefNodesVisitor;
-         grid->accept(undefNodesVisitor);
-      }
-
-      //walls
-      grid->addAndInitInteractor(addWallYminInt);
-      grid->addAndInitInteractor(addWallZminInt);
-      grid->addAndInitInteractor(addWallYmaxInt);
-      grid->addAndInitInteractor(addWallZmaxInt);
-
-      //obstacle
-      //grid->addAndInitInteractor(cylinderInt);
-
-      //inflow
-      grid->addAndInitInteractor(inflowInt);
-
-      //outflow
-      grid->addAndInitInteractor(outflowInt);
-
-      //initialization of distributions
-      D3Q27ETInitDistributionsBlockVisitor initVisitor(nueLB, rhoLB);
-      initVisitor.setVx1(fct);
-      grid->accept(initVisitor);
-
-      //Postrozess
-      UbSchedulerPtr geoSch(new UbScheduler(1));
-      D3Q27MacroscopicQuantitiesPostprocessorPtr ppgeo(
-         new D3Q27MacroscopicQuantitiesPostprocessor(grid, geoSch, pathname + "/grid/nodes", WbWriterVtkXmlBinary::getInstance(), conv, true));
-      ppgeo->update(0);
-      ppgeo.reset();
-
-      if(myid == 0) UBLOG(logINFO,"Preprozess - end"); 
-
-            //double outTime = 100.0;
-      UbSchedulerPtr stepSch(new UbScheduler());
-      stepSch->addSchedule(100, 0, 1000);
-      //nodeSch->addSchedule(1000, 1000, 10000);
-      //nodeSch->addSchedule(10000, 10000, 50000);
-      //nodeSch->addSchedule(100, 100, 10000);
-
-      D3Q27MacroscopicQuantitiesPostprocessor pp(grid, stepSch, pathname + "/steps/step", WbWriterVtkXmlBinary::getInstance(), conv, comm);
-
-      UbSchedulerPtr nupsSch(new UbScheduler(10, 30, 100));
-      NUPSCounterPostprocessor npr(grid, nupsSch, pathname + "/results/nups.txt", comm);
-
-      UbSchedulerPtr visSch(new UbScheduler(10.0));
-      double endTime = UbSystem::stringTo<int>(cf.getValue("endTime"));
-      //CalculatorPtr calc = CalculatorPtr(new FETOLCalculator());
-      //CalculatorPtr calc = CalculatorPtr(new Calculator());
-      //CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, stepSch, calc));
-      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, stepSch));
-      //if(myid == 0) 
-      UBLOG(logINFO,"Simulation-start");
-      calculation->calculate();
-      //if(myid == 0) 
-      UBLOG(logINFO,"Simulation-end");
-   }
-   catch(std::exception& e)
-   {
-      cerr << e.what() << endl << flush;
-   }
-   catch(std::string& s)
-   {
-      cerr << s << endl;
-   }
-   catch(...)
-   {
-      cerr << "unknown exception" << endl;
-   }
-
-}
-#endif
-
-
-
-
-
-
-
-
-
-
-
+#ifdef VF_BOND
+
+#include <iostream>
+#include <string>
+
+#include <vfluids.h>
+
+#include "fbond.h"
+#include "Version.h"
+
+
+using namespace std;
+
+int agent_main();
+void simulation(const char *cstr);
+
+int main(int argc, char* argv[])
+{
+   int returnval = 0;
+   try
+   {
+      bond::init();
+      returnval = agent_main();
+      bond::finalize();
+
+      //CommunicatorPtr comm(new BondCommunicator());
+      //cout<<"Bundle ID = "<<comm->getBundleID()<<", MPI rank = "<<comm->getProcessID()<<", root = "<<comm->getRoot()<<endl;
+
+      //if ( argv != NULL )
+      //{
+      //   if (argc > 1)
+      //   {
+      //      simulation(argv[1]);
+      //   }
+      //   else
+      //   {
+      //      cout << "Configuration file must be set!: " <<  argv[0] << " <config file>" << endl << std::flush;
+      //   }
+      //}
+   }
+   catch(std::runtime_error& e)
+   {
+      std::cerr<<"\nRUNTIME ERROR: "<<e.what()<<"\n"<<std::endl;
+   }
+   catch(...)
+   {
+      std::cerr<<"unknown error"<<std::endl;
+   }
+   return returnval;
+}
+
+
+int agent_main()
+{
+   cout<<"\n=== bond lib info:\n"<<bond::Version::info()<<"\n===\n\n";
+
+   // try to work around a bug in mpich (at least mpich2-1.4.1p1 and mpich2-1.5a1)
+   int _mpiInitialized = (int)false;
+   MPI_Initialized(&_mpiInitialized);
+   if(!_mpiInitialized)
+      MPI_Init(0, 0);	
+
+   int mpi_rank;
+   MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
+   int mpi_size;
+   MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
+   cout<<"I am process "<<bond::processID()<<" of "<<bond::processCount()
+      <<", bundle ID "<<bond::bundleID()<<" of "<<bond::bundleCount()
+      <<", MPI rank "<<mpi_rank<<" of "<<mpi_size<<"\n";
+
+   if(bond::processID() == 0)
+   {
+      try
+      {
+         Sleep(10000);
+         // send
+         vector<double> data(42);
+         data[0] = 123.1;
+         data[data.size()-1] = -999.1;
+
+         int dst_rank = 1;
+         int msg_tag = 42;
+         cout<<"["<<bond::processID()<<"] nonblocking send ... "<<data[0]<<"..."<<data[data.size()-1]<<"\n";
+         std::tr1::shared_ptr<bond::FutureSend> fus = bond::sendFuture(&data[0], data.size(), MPI_DOUBLE, dst_rank, msg_tag);
+
+         vector<double> data2(42);
+         data2[0] = 123.2;
+         data2[data2.size()-1] = -999.2;
+         cout<<"["<<bond::processID()<<"] blocking send ... "<<data2[0]<<"..."<<data2[data.size()-1]<<"\n";
+         bond::sendComplete(&data2[0], data2.size(), MPI_DOUBLE, dst_rank, msg_tag);
+
+         //Sleep(10000);
+
+         fus->complete();
+      }
+      catch(std::runtime_error& e)
+      {
+         std::cerr<<"\nSEND ERROR: "<<e.what()<<"\n"<<std::endl;
+      }
+   }
+   else
+   {
+      try
+      {
+         // receive
+         vector<double> data(42);
+         int src_rank = 0;
+         cout<<"["<<bond::processID()<<"] nonblocking receive ...\n";
+         int msg_tag = 42;
+         std::tr1::shared_ptr<bond::FutureReceive> fur = bond::receiveFuture(&data[0], data.size(), MPI_DOUBLE, src_rank, msg_tag);
+
+
+         //Sleep(10000);
+
+         cout<<"["<<bond::processID()<<"] blocking receive ...\n";
+         vector<double> data2(42);
+         bond::receiveComplete(&data2[0], data2.size(), MPI_DOUBLE, src_rank, msg_tag);
+         cout<<"received blocking "<<data2[0]<<"..."<<data2[data.size()-1]<<"\n";
+
+         
+
+         fur->complete();
+         cout<<"received nonblocking "<<data[0]<<"..."<<data[data.size()-1]<<"\n";
+      }
+      catch(std::runtime_error& e)
+      {
+         std::cerr<<"\nRECEIVE ERROR: "<<e.what()<<"\n"<<std::endl;
+      }
+   }
+
+   cout<<"process "<<bond::processID()<<" done\n";
+   return 0;
+}
+//////////////////////////////////////////////////////////////////////////
+void simulation(const char *cstr)
+{
+   try
+   {
+      ConfigFileReader cf(cstr);
+      if ( !cf.read() )
+      {
+         std::string exceptionText = "Unable to read configuration file\n";
+         throw exceptionText;
+      }
+
+      //UbLog::reportingLevel() = logDEBUG5;
+
+      string machine = QUOTEME(CAB_MACHINE);
+      string pathname = cf.getValue("path"); 
+      int numOfThreads = UbSystem::stringTo<int>(cf.getValue("numOfThreads"));
+      double availMem = 0;
+
+      CommunicatorPtr comm;
+      string comm_type = cf.getValue("comm");
+      if(comm_type == "MPI")
+         comm = MPICommunicator::getInstance();
+      else if(comm_type == "BOND")
+         comm = BondCommunicator::getInstance();
+
+      int myid = comm->getProcessID();
+      int mybundle = comm->getBundleID();
+      int root = comm->getRoot();
+
+      //UbLog::reportingLevel() = logDEBUG5;
+
+      if(machine == "BOMBADIL") 
+      {
+         availMem = 3.0e9;
+      }
+      else if(machine == "M01" || machine == "M02")      
+      {
+         availMem = 12.0e9;
+
+         if(myid==root && mybundle==root)
+         {
+            stringstream logFilename;
+            logFilename <<  pathname + "/logfile"+UbSystem::toString(UbSystem::getTimeStamp())+".txt";
+            UbLog::output_policy::setStream(logFilename.str());
+         }
+      }
+      else throw UbException(UB_EXARGS, "unknown CAB_MACHINE");
+
+      double dx = 1;
+
+      const int blocknx1 = UbSystem::stringTo<int>(cf.getValue("blocknx1")); //16;
+      const int blocknx2 = UbSystem::stringTo<int>(cf.getValue("blocknx2"));//16;
+      const int blocknx3 = UbSystem::stringTo<int>(cf.getValue("blocknx3"));//16;
+
+      const int gridNx1 = UbSystem::stringTo<int>(cf.getValue("gridNx1"));//3;
+      const int gridNx2 = UbSystem::stringTo<int>(cf.getValue("gridNx2"));//3;
+      const int gridNx3 = UbSystem::stringTo<int>(cf.getValue("gridNx3"));//3;
+
+
+      double L1 = gridNx1*blocknx1;
+      double L2, L3, H;
+      L2 = L3 = H = gridNx2*blocknx1;
+
+      LBMReal radius = 7;
+      LBMReal uLB = 0.05;
+      LBMReal Re = 300.0;
+      LBMReal rhoLB = 0.0;
+      LBMReal l = L2 / dx;
+      LBMReal nueLB = (((4.0/9.0)*uLB)*2.0*(radius/dx))/Re;
+
+
+      LBMUnitConverterPtr conv = LBMUnitConverterPtr(new LBMUnitConverter());
+
+      const int baseLevel = 0;
+      const int refineLevel = UbSystem::stringTo<int>(cf.getValue("refineLevel"));
+
+      //obstacle
+      GbObject3DPtr cylinder(new GbCylinder3D(L1*0.5, L2*0.5, 0, L1*0.5, L2*0.5, L3, radius));
+      GbSystem3D::writeGeoObject(cylinder.get(),pathname + "/geo/cylinder", WbWriterVtkXmlBinary::getInstance());
+
+      D3Q27InteractorPtr cylinderInt;
+
+      //bounding box
+      double d_minX1 = 0.0;
+      double d_minX2 = 0.0;
+      double d_minX3 = 0.0;
+
+      double d_maxX1 = L1;
+      double d_maxX2 = L2;
+      double d_maxX3 = L3;
+
+      double offs = dx;
+
+      //double g_minX1 = d_minX1-offs-0.499999*dx;
+      double g_minX1 = d_minX1-offs;
+      double g_minX2 = d_minX2-offs;
+      double g_minX3 = d_minX3-offs;
+
+      double g_maxX1 = d_maxX1+offs;
+      double g_maxX2 = d_maxX2+offs;
+      double g_maxX3 = d_maxX3+offs;
+
+      double blockLength = blocknx1*dx;
+
+      //refinement area
+      double off = 1;
+      GbObject3DPtr refineCube(new  GbCuboid3D(cylinder->getX1Minimum()-off, cylinder->getX2Minimum()-off, cylinder->getX3Minimum(), 
+         cylinder->getX1Maximum()+off, cylinder->getX2Maximum()+off, cylinder->getX3Maximum()));
+
+      Grid3DPtr grid(new Grid3D(comm, blocknx1, blocknx2, blocknx3, gridNx1, gridNx2, gridNx3));
+
+      //grid->setPeriodicX1(true);
+      //grid->setPeriodicX2(true);
+      //grid->setPeriodicX3(true);
+
+
+      if(myid ==0)
+      {
+         UBLOG(logINFO,"Parameters:");
+         UBLOG(logINFO,"L = " << L2/dx );
+         UBLOG(logINFO,"v = " << uLB );
+         UBLOG(logINFO,"rho = " << rhoLB );
+         UBLOG(logINFO,"nue = " << nueLB );
+         UBLOG(logINFO,"Re = " << Re );
+         UBLOG(logINFO,"dx = " << dx );
+         UBLOG(logINFO,"number of levels = " << refineLevel+1 );
+         UBLOG(logINFO,"numOfThreads = " << numOfThreads );
+         UBLOG(logINFO,"Preprozess - start");
+      }
+
+      if(myid ==0) GbSystem3D::writeGeoObject(refineCube.get(),pathname + "/geo/refineCube", WbWriterVtkXmlBinary::getInstance());
+
+      //walls
+      GbCuboid3DPtr addWallYmin (new GbCuboid3D(d_minX1-4.0*blockLength, d_minX2-4.0*blockLength, d_minX3-4.0*blockLength, d_maxX1+4.0*blockLength, d_minX2, d_maxX3+4.0*blockLength));
+      if(myid == 0) GbSystem3D::writeGeoObject(addWallYmin.get(), pathname+"/geo/addWallYmin", WbWriterVtkXmlASCII::getInstance());
+
+      GbCuboid3DPtr addWallZmin (new GbCuboid3D(d_minX1-4.0*blockLength, d_minX2-4.0*blockLength, d_minX3-4.0*blockLength, d_maxX1+4.0*blockLength, d_maxX2+4.0*blockLength, d_minX3));
+      if(myid == 0) GbSystem3D::writeGeoObject(addWallZmin.get(), pathname+"/geo/addWallZmin", WbWriterVtkXmlASCII::getInstance());
+
+      GbCuboid3DPtr addWallYmax (new GbCuboid3D(d_minX1-4.0*blockLength, d_maxX2, d_minX3-4.0*blockLength, d_maxX1+4.0*blockLength, d_maxX2+4.0*blockLength, d_maxX3+4.0*blockLength));
+      if(myid == 0) GbSystem3D::writeGeoObject(addWallYmax.get(), pathname+"/geo/addWallYmax", WbWriterVtkXmlASCII::getInstance());
+
+      GbCuboid3DPtr addWallZmax (new GbCuboid3D(d_minX1-4.0*blockLength, d_minX2-4.0*blockLength, d_maxX3, d_maxX1+4.0*blockLength, d_maxX2+4.0*blockLength, d_maxX3+4.0*blockLength));
+      if(myid == 0) GbSystem3D::writeGeoObject(addWallZmax.get(), pathname+"/geo/addWallZmax", WbWriterVtkXmlASCII::getInstance());
+
+      //inflow
+      GbCuboid3DPtr geoInflow (new GbCuboid3D(d_minX1-4.0*blockLength, d_minX2-4.0*blockLength, d_minX3-4.0*blockLength, d_minX1, d_maxX2+4.0*blockLength, d_maxX3+4.0*blockLength));
+      if(myid == 0) GbSystem3D::writeGeoObject(geoInflow.get(), pathname+"/geo/geoInflow", WbWriterVtkXmlASCII::getInstance());
+
+      //outflow
+      GbCuboid3DPtr geoOutflow (new GbCuboid3D(d_maxX1, d_minX2-4.0*blockLength, d_minX3-4.0*blockLength, d_maxX1+4.0*blockLength, d_maxX2+4.0*blockLength, d_maxX3+4.0*blockLength));
+      if(myid == 0) GbSystem3D::writeGeoObject(geoOutflow.get(), pathname+"/geo/geoOutflow", WbWriterVtkXmlASCII::getInstance());
+
+      BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname + "/grid/blocks", WbWriterVtkXmlBinary::getInstance(), comm));
+
+      if (refineLevel > 0)
+      {
+         if(myid == 0) UBLOG(logINFO,"Refinement - start");	
+         RefineCrossAndInsideGbObjectBlockVisitor refVisitor(refineCube, refineLevel);
+         grid->accept(refVisitor);
+
+         RatioBlockVisitor ratioVisitor(refineLevel);
+         grid->accept(ratioVisitor);
+
+         RatioSmoothBlockVisitor ratioSmoothVisitor(refineLevel);
+         grid->accept(ratioSmoothVisitor);
+
+         OverlapBlockVisitor overlapVisitor(refineLevel);
+         grid->accept(overlapVisitor);
+
+         std::vector<int> dirs;
+         D3Q27System::getLBMDirections(dirs);
+         SetInterpolationDirsBlockVisitor interDirsVisitor(dirs);
+         grid->accept(interDirsVisitor);
+         if(myid == 0) UBLOG(logINFO,"Refinement - end");	
+      }
+
+
+      D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
+
+      if(comm_type == "MPI")
+      {
+         MetisPartitioningGridVisitor metisVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B, true, numOfThreads);
+         grid->accept( metisVisitor );
+         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
+         grid->accept( setConnsVisitor );
+      }
+      else if(comm_type == "BOND")
+      {
+         MetisPartitioningWithBundlesGridVisitor metisVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B, true, numOfThreads);
+         grid->accept( metisVisitor );
+         D3Q27BondSetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
+         grid->accept( setConnsVisitor );
+         setConnsVisitor.activate();
+      }
+      
+      int bbOption = 1; //0=simple Bounce Back, 1=quadr. BB
+      D3Q27BoundaryConditionAdapterPtr bcObst(new D3Q27NoSlipBCAdapter(bbOption));
+      cylinderInt = D3Q27InteractorPtr ( new D3Q27Interactor(cylinder, grid, bcObst,Interactor3D::SOLID));
+
+      //walls
+      D3Q27InteractorPtr addWallYminInt(new D3Q27Interactor(addWallYmin, grid, bcObst,Interactor3D::SOLID));
+      D3Q27InteractorPtr addWallZminInt(new D3Q27Interactor(addWallZmin, grid, bcObst,Interactor3D::SOLID));
+      D3Q27InteractorPtr addWallYmaxInt(new D3Q27Interactor(addWallYmax, grid, bcObst,Interactor3D::SOLID));
+      D3Q27InteractorPtr addWallZmaxInt(new D3Q27Interactor(addWallZmax, grid, bcObst,Interactor3D::SOLID));
+
+      mu::Parser fct;
+      fct.SetExpr("16*U*x2*x3*(H-x2)*(H-x3)/H^4");
+      fct.DefineConst("U", uLB);
+      fct.DefineConst("H", H);
+
+      //inflow
+      D3Q27BoundaryConditionAdapterPtr velBCAdapter(new D3Q27VelocityBCAdapter (true, false ,false ,fct, 0, D3Q27BCFunction::INFCONST));
+      velBCAdapter->setSecondaryBcOption(2);
+      D3Q27InteractorPtr inflowInt  = D3Q27InteractorPtr( new D3Q27Interactor(geoInflow, grid, velBCAdapter, Interactor3D::SOLID));
+
+      //outflow
+      D3Q27BoundaryConditionAdapterPtr denBCAdapter(new D3Q27DensityBCAdapter(rhoLB));
+      D3Q27InteractorPtr outflowInt = D3Q27InteractorPtr( new D3Q27Interactor(geoOutflow, grid, denBCAdapter,Interactor3D::SOLID));
+
+      //SolidBlocksHelper sd(grid, comm);
+      //sd.addInteractor(cylinderInt);
+      //sd.addInteractor(addWallYminInt);
+      //sd.addInteractor(addWallZminInt);
+      //sd.addInteractor(addWallYmaxInt);
+      //sd.addInteractor(addWallZmaxInt);
+      //sd.addInteractor(inflowInt);
+      //sd.addInteractor(outflowInt);
+
+      //sd.deleteSolidBlocks();
+
+      //grid->accept( metisVisitor );
+
+      //grid->getBlock(0)->setBundle(0);
+      //grid->getBlock(0)->setRank(0);
+      //grid->getBlock(1)->setBundle(1);
+      //grid->getBlock(1)->setRank(1);
+      //grid->getBlock(2)->setBundle(0);
+      //grid->getBlock(2)->setRank(0);
+      //grid->getBlock(3)->setBundle(1);
+      //grid->getBlock(3)->setRank(1);
+      //grid->getBlock(4)->setBundle(0);
+      //grid->getBlock(4)->setRank(0);
+      //grid->getBlock(5)->setBundle(1);
+      //grid->getBlock(5)->setRank(1);
+      //grid->getBlock(6)->setBundle(1);
+      //grid->getBlock(6)->setRank(1);
+      //grid->getBlock(7)->setBundle(0);
+      //grid->getBlock(7)->setRank(0);
+
+      ppblocks->update(0);
+      ppblocks.reset();
+
+      unsigned long nob = grid->getNumberOfBlocks();
+      int gl = 3;
+      unsigned long nod = nob * (blocknx1+gl) * (blocknx2+gl) * (blocknx3+gl);
+
+      double needMemAll  = double(nod*(27*sizeof(double) + sizeof(int) + sizeof(float)*4));
+      double needMem  = needMemAll / double(comm->getNumberOfProcesses());
+
+      if(myid == 0)
+      {
+         UBLOG(logINFO,"Number of blocks = " << nob);
+         UBLOG(logINFO,"Number of nodes  = " << nod);
+         UBLOG(logINFO,"Necessary memory  = " << needMemAll  << " bytes");
+         UBLOG(logINFO,"Necessary memory per process = " << needMem  << " bytes");
+         UBLOG(logINFO,"Available memory per process = " << availMem << " bytes");
+      }            
+
+      //LBMKernel3DPtr kernel(new LBMKernelETD3Q27Cascaded(blocknx1, blocknx2, blocknx3));
+      //LBMKernel3DPtr kernel(new LBMKernelETD3Q27BGK(blocknx1, blocknx2, blocknx3, true));
+      //option = 0 - ohne param., option = 1 - mit param.
+      int option = 0;
+      LBMKernel3DPtr kernel(new LBMKernelETD3Q27CCLB(blocknx1, blocknx2, blocknx3, LBMKernelETD3Q27CCLB::NORMAL));
+
+      BCProcessorPtr bcProc(new D3Q27ETBCProcessor());
+      kernel->setBCProcessor(bcProc);
+
+      SetKernelBlockVisitor kernelVisitor(kernel, nueLB, availMem, needMem);
+      grid->accept(kernelVisitor);
+
+      if (refineLevel > 0)
+      {
+         D3Q27SetUndefinedNodesBlockVisitor undefNodesVisitor;
+         grid->accept(undefNodesVisitor);
+      }
+
+      //walls
+      grid->addAndInitInteractor(addWallYminInt);
+      grid->addAndInitInteractor(addWallZminInt);
+      grid->addAndInitInteractor(addWallYmaxInt);
+      grid->addAndInitInteractor(addWallZmaxInt);
+
+      //obstacle
+      //grid->addAndInitInteractor(cylinderInt);
+
+      //inflow
+      grid->addAndInitInteractor(inflowInt);
+
+      //outflow
+      grid->addAndInitInteractor(outflowInt);
+
+      //initialization of distributions
+      D3Q27ETInitDistributionsBlockVisitor initVisitor(nueLB, rhoLB);
+      initVisitor.setVx1(fct);
+      grid->accept(initVisitor);
+
+      //Postrozess
+      UbSchedulerPtr geoSch(new UbScheduler(1));
+      D3Q27MacroscopicQuantitiesPostprocessorPtr ppgeo(
+         new D3Q27MacroscopicQuantitiesPostprocessor(grid, geoSch, pathname + "/grid/nodes", WbWriterVtkXmlBinary::getInstance(), conv, true));
+      ppgeo->update(0);
+      ppgeo.reset();
+
+      if(myid == 0) UBLOG(logINFO,"Preprozess - end"); 
+
+            //double outTime = 100.0;
+      UbSchedulerPtr stepSch(new UbScheduler());
+      stepSch->addSchedule(100, 0, 1000);
+      //nodeSch->addSchedule(1000, 1000, 10000);
+      //nodeSch->addSchedule(10000, 10000, 50000);
+      //nodeSch->addSchedule(100, 100, 10000);
+
+      D3Q27MacroscopicQuantitiesPostprocessor pp(grid, stepSch, pathname + "/steps/step", WbWriterVtkXmlBinary::getInstance(), conv, comm);
+
+      UbSchedulerPtr nupsSch(new UbScheduler(10, 30, 100));
+      NUPSCounterPostprocessor npr(grid, nupsSch, pathname + "/results/nups.txt", comm);
+
+      UbSchedulerPtr visSch(new UbScheduler(10.0));
+      double endTime = UbSystem::stringTo<int>(cf.getValue("endTime"));
+      //CalculatorPtr calc = CalculatorPtr(new FETOLCalculator());
+      //CalculatorPtr calc = CalculatorPtr(new Calculator());
+      //CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, stepSch, calc));
+      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, stepSch));
+      //if(myid == 0) 
+      UBLOG(logINFO,"Simulation-start");
+      calculation->calculate();
+      //if(myid == 0) 
+      UBLOG(logINFO,"Simulation-end");
+   }
+   catch(std::exception& e)
+   {
+      cerr << e.what() << endl << flush;
+   }
+   catch(std::string& s)
+   {
+      cerr << s << endl;
+   }
+   catch(...)
+   {
+      cerr << "unknown exception" << endl;
+   }
+
+}
+#endif
+
+
+
+
+
+
+
+
+
+
+
diff --git a/apps/cpu/bond_test/start.bat b/apps/cpu/bond_test/start.bat
index ec3fc5640dfcec57412401946ef92a85c9366fec..b824f13a4f7d5f3feb8f7084ea708a9e90b86127 100644
--- a/apps/cpu/bond_test/start.bat
+++ b/apps/cpu/bond_test/start.bat
@@ -1,6 +1,6 @@
-@echo off
-set FETOL_BUNDLE_INFO_PATH=c:\Projects\FETOL\dev\bond_config\YAML_Bond_ConfigFile.yaml
-set FETOL_CLASSPATH=c:\Projects\FETOL\dev\fetol_bond\fetol_bond.jar
-
-set FETOL_BUNDLE_ID=%1
+@echo off
+set FETOL_BUNDLE_INFO_PATH=c:\Projects\FETOL\dev\bond_config\YAML_Bond_ConfigFile.yaml
+set FETOL_CLASSPATH=c:\Projects\FETOL\dev\fetol_bond\fetol_bond.jar
+
+set FETOL_BUNDLE_ID=%1
 call %2
\ No newline at end of file
diff --git a/apps/cpu/bone/CMakeLists.txt b/apps/cpu/bone/CMakeLists.txt
index f03f31b3b06d73c6708883c25ab3db36dc4bb058..0677fd51b64a263a209cc16569ce62d3b2741ad3 100644
--- a/apps/cpu/bone/CMakeLists.txt
+++ b/apps/cpu/bone/CMakeLists.txt
@@ -1,25 +1,25 @@
-CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
-
-########################################################
-## C++ PROJECT                                       ###
-########################################################
-PROJECT(bone)
-
-INCLUDE(${SOURCE_ROOT}/lib/IncludsList.txt) 
-
-#################################################################
-###   LOCAL FILES                                             ###
-#################################################################
-FILE(GLOB SPECIFIC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.h
-                         ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
-                         ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp  )
- 
-SET(ALL_SOURCES ${ALL_SOURCES} ${SPECIFIC_FILES})
-SOURCE_GROUP(src FILES ${SPECIFIC_FILES})
-  
-SET(CAB_ADDITIONAL_LINK_LIBRARIES vfluids)
-
-#################################################################
-###   CREATE PROJECT                                          ###
-#################################################################
-CREATE_CAB_PROJECT(bone BINARY)
+CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
+
+########################################################
+## C++ PROJECT                                       ###
+########################################################
+PROJECT(bone)
+
+INCLUDE(${SOURCE_ROOT}/lib/IncludsList.txt) 
+
+#################################################################
+###   LOCAL FILES                                             ###
+#################################################################
+FILE(GLOB SPECIFIC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.h
+                         ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
+                         ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp  )
+ 
+SET(ALL_SOURCES ${ALL_SOURCES} ${SPECIFIC_FILES})
+SOURCE_GROUP(src FILES ${SPECIFIC_FILES})
+  
+SET(CAB_ADDITIONAL_LINK_LIBRARIES vfluids)
+
+#################################################################
+###   CREATE PROJECT                                          ###
+#################################################################
+CREATE_CAB_PROJECT(bone BINARY)
diff --git a/apps/cpu/bone/bone.cpp b/apps/cpu/bone/bone.cpp
index a45ece43199d1d8713a7881b952d06de993240ed..9ad9321d601fff1caf126b776f9697fdd22876f1 100644
--- a/apps/cpu/bone/bone.cpp
+++ b/apps/cpu/bone/bone.cpp
@@ -1,568 +1,568 @@
-#include <iostream>
-#include <string>
-#include <math.h> 
-
-#include <vfluids.h>
-
-using namespace std;
-
-void run(const char *cstr1, const char *cstr2)
-{
-   try
-   {
-      string pathname; 
-      string pathGeo;
-      string pathLog;
-      int numOfThreads = 1;
-      bool logfile = false;
-      stringstream logFilename;
-      double availMem = 0;
-
-      CommunicatorPtr comm = MPICommunicator::getInstance();
-      int myid = comm->getProcessID();
-
-      string machine = string(cstr1);
-
-      if(machine == "my") 
-      {
-         pathname = "d:/temp/bone";
-         pathGeo = "d:/Data/Bone/BigBone";
-         pathLog = "d:/temp/bone";
-         numOfThreads = 4;
-         logfile = false;
-         availMem = 15.0e9;
-      }
-      else if(machine == "Ludwig")      
-      {
-         pathname = "/work/koskuche/SFB880/plate2Con";
-         pathGeo = "/home/koskuche/data/plate";
-         pathLog = pathname;
-         numOfThreads = 8;
-         availMem = 12.0e9;///8*numOfThreads;
-         logfile = true;
-      }
-      else if(machine == "HLRS")      
-      {
-         pathname = "/univ_1/ws1/ws/xrmkuchr-plate3-0";
-         pathGeo = "/zhome/academic/HLRS/xrm/xrmkuchr/data/plate";
-         pathLog = "/zhome/academic/HLRS/xrm/xrmkuchr/work/plate";
-         numOfThreads = 16;
-         availMem = 2.0e9;
-         logfile = true;
-      }
-      else if(machine == "HLRN")      
-      {
-         pathname = "/gfs1/work/niivfcpu/scratch/plateEx";
-         pathGeo = "/gfs1/work/niivfcpu/data/plate";
-         pathLog = pathname;
-         numOfThreads = 24;
-         availMem = 64.0e9/24.0*numOfThreads;
-         logfile = true;
-      }
-      else throw UbException(UB_EXARGS, "unknown CAB_MACHINE");
-
-#if defined(__unix__)
-      if (myid==0) 
-      {
-         const char* str = pathLog.c_str();
-         int status=mkdir(str, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
-      }
-#endif 
-
-      if(myid == 0 && logfile)
-      {
-         //UbLog::reportingLevel() = logDEBUG5;
-         logFilename <<  pathLog + "/logfile"+UbSystem::toString(UbSystem::getTimeStamp())+"_"+UbSystem::toString(myid)+".txt";
-         UbLog::output_policy::setStream(logFilename.str());
-      }
-
-      if(myid==0) UBLOG(logINFO,"Testcase bone");
-
-      string boneFilename = pathGeo + "/bone.raw";
-      
-      int pmNX1=1800;  //abmessung einzelbild in x-richtung
-      int pmNX2=972; //abmessung einzelbild in y richtung
-      int pmNX3=1164; //anzahl der bilder
-      float lthreshold = 27756.0;
-      float uthreshold = 65535.0;
-
-      GbVoxelMatrix3DPtr pmMesh(new GbVoxelMatrix3D(pmNX1,pmNX2,pmNX3,0,lthreshold,uthreshold));
-      pmMesh->readMatrixFromRawFile<unsigned short>(boneFilename, GbVoxelMatrix3D::BigEndian);
-
-      double scaleFactor = 0.001;
-      double delta = 11.0*scaleFactor;
-      pmMesh->setVoxelMatrixDelta(delta, delta, delta);
-
-      pmMesh->setVoxelMatrixMininum(0.0, 0.0, 0.0);
-      if(myid == 0) pmMesh->writeToLegacyVTKBinary(pathname+"/geo/bone");
-
-      ///////////////////////////////////////////////////////
-      return;
-
-
-      /////////////////Knotenabmessungen:
-      //int nx[3], blocknx[3];
-      //nx[0]      = 90;//240;//120;//60;//86;//43;//65;//50;  //länge
-      //nx[1]      = 2;//2;//6;///1;//5;// //breite
-      //nx[2]      = 30;//64;//32;//18;//5;//15;//15; //höhe gebiet
-      //blocknx[0] = 16;//10;//6;
-      //blocknx[1] = 16;//10;//6;
-      //blocknx[2] = 16;//10;//6;
-
-      //int baseLevel   = 0;
-      //int refineLevel = 4;
-
-      //double H = 600.0; // Kanalhöhe [mm]
-      //double cdx = H/(double)(nx[2]*blocknx[2]);
-      //double fdx = cdx/double(1<<refineLevel);
-
-      ////double h = 200.0; // gewünschte Plattenhöhe in Gitterpunkten
-      ////double fdx = plate->getLengthX3()/h;
-      ////double cdx = fdx*double(1<<refineLevel);
-
-      //LBMUnitConverterPtr unitConverter = LBMUnitConverterPtr(new LBMUnitConverter());
-
-      ////////////////////////////////////////////////////////////////////////////
-      ////physik
-      ////////////////////////////////////////////////////////////////////////////
-      //double Re            = 1133333.3333333335; 
-      //double rhoLB         = 0.0;
-      //double uLB           = 0.1; 
-      //double lReal         = 1000; //Plattenlänge in mm
-      //double nuLB          = (uLB*(lReal/cdx))/Re;
-
-      //int sizeSP=4;
-      //mu::Parser spongeLayer;
-      //spongeLayer.SetExpr("x1>=(sizeX-sizeSP)/dx ? (sizeX-(x1+1))/sizeSP/2.0 + 0.5 : 1.0");
-      //spongeLayer.DefineConst("sizeX", nx[0]*blocknx[0]);
-      //spongeLayer.DefineConst("sizeSP", sizeSP*blocknx[0]);
-
-      //Grid3DPtr grid(new Grid3D(comm));
-
-      ////////////////////////////////////////////////////////////////////////////
-      ////restart
-      //UbSchedulerPtr rSch(new UbScheduler(1000,1000,10000000));
-      //RestartPostprocessor rp(grid, rSch, comm, pathname, RestartPostprocessor::BINARY);
-      ////////////////////////////////////////////////////////////////////////////
-
-      //if (grid->getTimeStep() == 0)
-      //{
-
-      //   if(myid==0) UBLOG(logINFO,"Neustart..");
-
-      //   //////////////////////////////////////////////////////////////////////////
-      //   //Platte
-      //   GbTriFaceMesh3DPtr plate (GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(PlatteFilename,"Netz"));
-      //   plate->rotate(90.0,0.0,0.0);  //TriFacMesh-KO-System anders als LB-KO-System
-      //   if(myid == 0) GbSystem3D::writeGeoObject( plate.get(), pathname+"/geo/platte", WbWriterVtkXmlBinary::getInstance() );
-      //   //////////////////////////////////////////////////////////////////////////
-      //   // Zackenband
-      //   //////////////////////////////////////////////////////////////////////////
-      //   GbTriFaceMesh3DPtr meshBand1 (GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "NetzBand"));
-      //   meshBand1->translate(-495, -700, -19.94);
-      //   if(myid == 0) GbSystem3D::writeGeoObject( meshBand1.get(), pathname+"/geo/Band1", WbWriterVtkXmlASCII::getInstance() );
-      //   // Zackenband2
-      //   GbTriFaceMesh3DPtr meshBand2(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "NetzBand2"));
-      //   meshBand2->translate(-495, -705, -19.94); 
-      //   if(myid == 0) GbSystem3D::writeGeoObject( meshBand2.get(), pathname+"/geo/Band2", WbWriterVtkXmlASCII::getInstance() );
-      //   // Zackenband3
-      //   GbTriFaceMesh3DPtr meshBand3(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "NetzBand3"));
-      //   meshBand3->translate(-495, -700, -19.64); 
-      //   if(myid == 0) GbSystem3D::writeGeoObject( meshBand3.get(), pathname+"/geo/Band3", WbWriterVtkXmlASCII::getInstance() );
-      //   // Zackenband4
-      //   GbTriFaceMesh3DPtr meshBand4(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "NetzBand4"));
-      //   meshBand4->translate(-495, -705, -19.64); 
-      //   if(myid == 0) GbSystem3D::writeGeoObject( meshBand4.get(), pathname+"/geo/Band4", WbWriterVtkXmlASCII::getInstance() );
-      //   //////////////////////////////////////////////////////////////////////////
-
-      //   double blockLengthx1 = blocknx[0]*cdx; //geowerte
-      //   double blockLengthx2 = blockLengthx1;
-      //   double blockLengthx3 = blockLengthx1;
-
-      //   double geoLength[]   = {  nx[0]*blockLengthx1, nx[1]*blockLengthx2, nx[2]*blockLengthx3}; 
-
-      //   double originX1 = plate->getX1Minimum()-plate->getLengthX1()/4.0;
-      //   double originX2 = plate->getX2Minimum();
-      //   double originX3 = plate->getX3Minimum()-299.5;
-
-
-      //   bool periodicx1 = false;
-      //   bool periodicx2 = true;
-      //   bool periodicx3 = true;
-
-      //   //bounding box
-      //   double g_minX1 = originX1;
-      //   double g_minX2 = originX2;
-      //   double g_minX3 = originX3;
-
-      //   double g_maxX1 = originX1 + geoLength[0];
-      //   double g_maxX2 = originX2 + geoLength[1];
-      //   double g_maxX3 = originX3 + geoLength[2];;
-
-
-      //   //set grid
-      //   grid->setDeltaX(cdx);
-      //   grid->setBlockNX(blocknx[0], blocknx[1], blocknx[2]);
-      //   grid->setPeriodicX1(periodicx1);
-      //   grid->setPeriodicX2(periodicx2);
-      //   grid->setPeriodicX3(periodicx3);
-
-      //   GbObject3DPtr gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
-      //   gridCube->setCenterCoordinates(gridCube->getX1Centroid(),meshBand1->getX2Centroid(),gridCube->getX3Centroid());
-      //   if(myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), pathname+"/geo/gridCube", WbWriterVtkXmlASCII::getInstance());
-
-      //   originX2 = gridCube->getX2Minimum();
-      //   g_minX2 = originX2;
-      //   g_maxX2 = originX2 + geoLength[1];
-
-      //   GenBlocksGridVisitor genBlocks(gridCube);
-      //   grid->accept(genBlocks);
-
-      //   //////////////////////////////////////////////////////////////////////////
-      //   if(myid == 0)
-      //   {
-      //      UBLOG(logINFO, "*****************************************");
-      //      UBLOG(logINFO, "* Parameters                            *");
-      //      UBLOG(logINFO, "* Re            ="<<Re);
-      //      UBLOG(logINFO, "* nuLB          ="<<nuLB);
-      //      UBLOG(logINFO, "* uLB           ="<<uLB);
-      //      UBLOG(logINFO, "* cdx           ="<<cdx);
-      //      UBLOG(logINFO, "* fdx           ="<<fdx);
-      //      double Hzb = 0.6/fdx;
-      //      UBLOG(logINFO, "* Height of Zackenband ="<<Hzb);
-      //      UBLOG(logINFO, "* Re on Zackenband ="<<(uLB*Hzb)/(nuLB*double(1<<refineLevel)));
-      //      UBLOG(logINFO, "* nx1/2/3       ="<<nx[0]<<"/"<<nx[1]<<"/"<<nx[2]);
-      //      UBLOG(logINFO, "* blocknx1/2/3  ="<<blocknx[0]<<"/"<<blocknx[1]<<"/"<<blocknx[2]);
-      //      UBLOG(logINFO, "* x1Periodic    ="<<periodicx1);
-      //      UBLOG(logINFO, "* x2Periodic    ="<<periodicx2);
-      //      UBLOG(logINFO, "* x3Periodic    ="<<periodicx3);
-      //      UBLOG(logINFO, "* number of levels  ="<<refineLevel+1);
-      //      UBLOG(logINFO, "* path          ="<<pathname);
-
-      //      UBLOG(logINFO, "*****************************************");
-      //      UBLOG(logINFO, "* number of threads    ="<<numOfThreads);
-      //      UBLOG(logINFO, "* number of processes  ="<<comm->getNumberOfProcesses());
-      //      UBLOG(logINFO, "*****************************************");
-      //      UBLOG(logINFO, "*****************************************");     
-      //   }
-      //   //////////////////////////////////////////////////////////////////////////
-
-
-      //   //////////////////////////////////////////////////////////////////////////
-      //   //refinement
-      //   GbCuboid3DPtr refinePlatteBox(new GbCuboid3D(plate->getX1Minimum(), plate->getX2Minimum(), plate->getX3Minimum()+(plate->getX3Maximum()-plate->getX3Minimum())/2.0, 
-      //      plate->getX1Maximum()+40.0, plate->getX2Maximum(), plate->getX3Maximum()));
-      //   if(myid == 0) GbSystem3D::writeGeoObject( refinePlatteBox.get(), pathname+"/geo/refinePlatteBox", WbWriterVtkXmlASCII::getInstance() );
-
-      //   if (refineLevel > 0)
-      //   {
-      //      if(myid == 0) UBLOG(logINFO,"Refinement - start");	
-      //      RefineCrossAndInsideGbObjectHelper refineHelper(grid, refineLevel);
-      //      refineHelper.addGbObject(refinePlatteBox, refineLevel);
-      //      refineHelper.refine();
-      //      if(myid == 0) UBLOG(logINFO,"Refinement - end");	
-      //   }
-
-      //   /////////////////////////////////////////////////
-      //   ///interactoren
-      //   int bbOption1 = 1; //0=simple Bounce Back, 1=quadr. BB
-      //   D3Q27BoundaryConditionAdapterPtr bcObst(new D3Q27NoSlipBCAdapter(bbOption1));
-      //   D3Q27TriFaceMeshInteractorPtr triPlateInteractor( new D3Q27TriFaceMeshInteractor(plate, grid, bcObst,Interactor3D::SOLID));
-      //   D3Q27TriFaceMeshInteractorPtr triBand1Interactor( new D3Q27TriFaceMeshInteractor( meshBand1, grid, bcObst,Interactor3D::SOLID, Interactor3D::EDGES) );
-      //   D3Q27TriFaceMeshInteractorPtr triBand2Interactor( new D3Q27TriFaceMeshInteractor( meshBand2, grid, bcObst,Interactor3D::SOLID, Interactor3D::EDGES) );
-      //   D3Q27TriFaceMeshInteractorPtr triBand3Interactor( new D3Q27TriFaceMeshInteractor( meshBand3, grid, bcObst,Interactor3D::SOLID, Interactor3D::EDGES) );
-      //   D3Q27TriFaceMeshInteractorPtr triBand4Interactor( new D3Q27TriFaceMeshInteractor( meshBand4, grid, bcObst,Interactor3D::SOLID, Interactor3D::EDGES) );
-
-      //   //inflow
-      //   GbCuboid3DPtr velBCCuboid(new GbCuboid3D(originX1-blockLengthx1, originX2-blockLengthx1, originX3-blockLengthx1, 
-      //      originX1, originX2+geoLength[1]+blockLengthx1, originX3+geoLength[2]+blockLengthx1));
-      //   if(myid == 0) GbSystem3D::writeGeoObject(velBCCuboid.get(), pathname+"/geo/velBCCuboid", WbWriterVtkXmlASCII::getInstance());
-      //   D3Q27InteractorPtr velBCInteractor(new D3Q27Interactor(velBCCuboid,grid,Interactor3D::SOLID)); 
-
-      //   //inflow
-      //   double raiseVelSteps = 0;
-      //   vector<D3Q27BCFunction> velcX1BCs,dummy;
-
-      //   mu::Parser inflowProfile;
-      //   inflowProfile.SetExpr("uLB"); 
-      //   inflowProfile.DefineConst("uLB",uLB);
-      //   velcX1BCs.push_back(D3Q27BCFunction(inflowProfile,raiseVelSteps,D3Q27BCFunction::INFCONST));
-
-      //   D3Q27BoundaryConditionAdapterPtr velBCAdapter(new D3Q27VelocityBCAdapter (velcX1BCs,dummy,dummy));
-      //   velBCInteractor->addBCAdapter(velBCAdapter);
-
-      //   //outflow
-      //   GbCuboid3DPtr densCuboid(new GbCuboid3D(originX1+geoLength[0], originX2-blockLengthx1, originX3-blockLengthx1, 
-      //      originX1+geoLength[0]+blockLengthx1, originX2+geoLength[1]+blockLengthx1, originX3+geoLength[2]+blockLengthx1 ));
-      //   if(myid == 0) GbSystem3D::writeGeoObject(densCuboid.get(), pathname+"/geo/densCuboid", WbWriterVtkXmlASCII::getInstance());
-      //   D3Q27BoundaryConditionAdapterPtr denBCAdapter(new D3Q27DensityBCAdapter(rhoLB));
-      //   D3Q27InteractorPtr densInteractor( new D3Q27Interactor(densCuboid,grid,denBCAdapter,Interactor3D::SOLID) );
-
-      //   ////////////////////////////////////////////
-      //   //METIS
-      //   Grid3DVisitorPtr metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B));	
-
-      //   ////////////////////////////////////////////
-      //   /////delete solid blocks
-      //   if(myid == 0) UBLOG(logINFO,"deleteSolidBlocks - start");
-      //   InteractorsHelper intHelper(grid, metisVisitor);
-      //   intHelper.addInteractor(triPlateInteractor);
-      //   intHelper.addInteractor(triBand1Interactor);
-      //   intHelper.addInteractor(triBand2Interactor);
-      //   intHelper.addInteractor(triBand3Interactor);
-      //   intHelper.addInteractor(triBand4Interactor);
-      //   intHelper.addInteractor(densInteractor);
-      //   intHelper.addInteractor(velBCInteractor);
-      //   intHelper.selectBlocks();
-      //   if(myid == 0) UBLOG(logINFO,"deleteSolidBlocks - end");	 
-      //   //////////////////////////////////////
-
-      //   //domain decomposition for threads
-      //   if(numOfThreads > 1)
-      //   {
-      //      PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
-      //      grid->accept(pqPartVisitor);
-      //   }
-
-      //   if(myid == 0)
-      //   {
-      //      UBLOG(logINFO,"Write blocks - start");
-      //      BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm));
-      //      ppblocks->update(0);
-      //      UBLOG(logINFO,"Write blocks - end");
-      //   }
-
-      //   unsigned long nob = grid->getNumberOfBlocks();
-      //   unsigned long nod = nob * blocknx[0]*blocknx[1]*blocknx[2];
-      //   unsigned long nod_real = nob * (blocknx[0]+3)*(blocknx[1]+3)*(blocknx[2]+3);
-      //   unsigned long nodb = (blocknx[0]) * (blocknx[1]) * (blocknx[2]);
-
-      //   double needMemAll  = double(nod_real*(27*sizeof(double) + sizeof(int)));
-      //   double needMem  = needMemAll / double(comm->getNumberOfProcesses());
-      //   
-      //   double nup = 0; 
-
-      //   if(myid == 0)
-      //   {
-      //      UBLOG(logINFO,"Number of blocks = " << nob);
-      //      UBLOG(logINFO,"Number of nodes  = " << nod);
-      //      int minInitLevel = grid->getCoarsestInitializedLevel();
-      //      int maxInitLevel = grid->getFinestInitializedLevel();
-      //      for(int level = minInitLevel; level<=maxInitLevel; level++)
-      //      {
-      //         int nobl = grid->getNumberOfBlocks(level);
-      //         UBLOG(logINFO,"Number of blocks for level " << level <<" = " << nobl);
-      //         UBLOG(logINFO,"Number of nodes for level " << level <<" = " << nobl*nodb);
-      //         nup += nobl*nodb*double(1<<level); 
-      //      }
-      //      UBLOG(logINFO,"Hypothetically time for calculation step for 120 nodes  = " << nup/6.0e5/(120*8)  << " s");
-      //      UBLOG(logINFO,"Necessary memory  = " << needMemAll  << " bytes");
-      //      UBLOG(logINFO,"Necessary memory per process = " << needMem  << " bytes");
-      //      UBLOG(logINFO,"Available memory per process = " << availMem << " bytes");
-      //      UBLOG(logINFO,"Available memory per node/8.0 = " << (availMem/8.0) << " bytes");
-      //   }
-
-      //   //////////////////////////////////////////
-      //   //set connectors
-      //   if(myid == 0) UBLOG(logINFO,"set connectors - start");
-      //   D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
-      //   D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
-      //   grid->accept( setConnsVisitor );
-      //   if(myid == 0) UBLOG(logINFO,"set connectors - end");
-
-      //   ////////////////////////////
-      //   LBMKernel3DPtr kernel;
-      //   //kernel = LBMKernel3DPtr(new LBMKernelETD3Q27CCLB(blocknx[0], blocknx[1], blocknx[2], LBMKernelETD3Q27CCLB::NORMAL));
-
-      //   //with sponge layer
-      //   kernel = LBMKernel3DPtr(new LBMKernelETD3Q27CCLBWithSpongeLayer(blocknx[0], blocknx[1], blocknx[2], LBMKernelETD3Q27CCLB::NORMAL));
-      //   kernel->setWithSpongeLayer(true);
-      //   kernel->setSpongeLayer(spongeLayer);
-
-      //   BCProcessorPtr bcProc(new D3Q27ETBCProcessor());
-      //   kernel->setBCProcessor(bcProc);
-      //   SetKernelBlockVisitor kernelVisitor(kernel, nuLB, availMem, needMem);
-      //   grid->accept(kernelVisitor);
-      //   //////////////////////////////////
-      //   //undef nodes
-      //   if (refineLevel > 0)
-      //   {
-      //      D3Q27SetUndefinedNodesBlockVisitor undefNodesVisitor;
-      //      grid->accept(undefNodesVisitor);
-      //   }
-
-
-      //   intHelper.setBC();
-
-      //   //initialization of decompositions
-      //   D3Q27ETInitDistributionsBlockVisitor initVisitor( nuLB,rhoLB);
-      //   initVisitor.setVx1(uLB);
-      //   grid->accept(initVisitor);
-
-      //   //Postprozess
-      //   UbSchedulerPtr geoSch(new UbScheduler(1));
-      //   D3Q27MacroscopicQuantitiesPostprocessorPtr ppgeo(
-      //      new D3Q27MacroscopicQuantitiesPostprocessor(grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), 
-      //      unitConverter, true));
-      //   ppgeo->update(0);
-      //   ppgeo.reset();
-      //   geoSch.reset();
-
-      //   if(myid == 0) UBLOG(logINFO,"Preprozess - end");      
-      //}
-      //else
-      //{
-      //   //domain decomposition for threads
-      //   if(numOfThreads > 1)
-      //   {
-      //      PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
-      //      grid->accept(pqPartVisitor);
-      //   }
-      //   //set connectors
-      //   //grid->setPeriodicX3(false);
-      //   D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
-      //   D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
-      //   grid->accept( setConnsVisitor );
-      //   SetSpongeLayerBlockVisitor ssp(spongeLayer);
-      //   grid->accept(ssp);
-
-      //   //////////////////////////////////////////////////////////////////////////
-      //   //////////////////////////////////////////////////////////////////////////
-      //   //Platte
-      //   GbTriFaceMesh3DPtr plate (GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(PlatteFilename,"Netz"));
-      //   plate->rotate(90.0,0.0,0.0);  //TriFacMesh-KO-System anders als LB-KO-System
-      //   if(myid == 0) GbSystem3D::writeGeoObject( plate.get(), pathname+"/geo/platte", WbWriterVtkXmlBinary::getInstance() );
-      //   //////////////////////////////////////////////////////////////////////////
-      //   //////////////////////////////////////////////////////////////////////////
-      //   // Zackenband
-      //   //////////////////////////////////////////////////////////////////////////
-      //   GbTriFaceMesh3DPtr meshBand1 (GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "NetzBand"));
-      //   meshBand1->translate(-495, -700, -19.94);
-      //   if(myid == 0) GbSystem3D::writeGeoObject( meshBand1.get(), pathname+"/geo/Band1", WbWriterVtkXmlASCII::getInstance() );
-
-      //   double blockLengthx1 = blocknx[0]*cdx; //geowerte
-      //   double blockLengthx2 = blockLengthx1;
-      //   double blockLengthx3 = blockLengthx1;
-
-      //   double geoLength[]   = {  nx[0]*blockLengthx1, nx[1]*blockLengthx2, nx[2]*blockLengthx3}; 
-
-      //   double originX1 = plate->getX1Minimum()-plate->getLengthX1()/4.0;
-      //   double originX2 = plate->getX2Minimum();
-      //   double originX3 = plate->getX3Minimum()-299.5;
-
-      //   //bounding box
-      //   double g_minX1 = originX1;
-      //   double g_minX2 = originX2;
-      //   double g_minX3 = originX3;
-
-      //   double g_maxX1 = originX1 + geoLength[0];
-      //   double g_maxX2 = originX2 + geoLength[1];
-      //   double g_maxX3 = originX3 + geoLength[2];;
-
-      //   GbObject3DPtr gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
-      //   gridCube->setCenterCoordinates(gridCube->getX1Centroid(),meshBand1->getX2Centroid(),gridCube->getX3Centroid());
-      //   if(myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), pathname+"/geo/gridCube", WbWriterVtkXmlASCII::getInstance());
-
-      //   originX2 = gridCube->getX2Minimum();
-      //   g_minX2 = originX2;
-      //   g_maxX2 = originX2 + geoLength[1];
-      //   //walls
-      //   GbCuboid3DPtr addWallZmin (new GbCuboid3D(g_minX1-blockLengthx1, g_minX2-blockLengthx1, g_minX3-blockLengthx1, g_maxX1+blockLengthx1, g_maxX2+blockLengthx1, g_minX3));
-      //   if(myid == 0) GbSystem3D::writeGeoObject(addWallZmin.get(), pathname+"/geo/addWallZmin", WbWriterVtkXmlASCII::getInstance());
-
-      //   GbCuboid3DPtr addWallZmax (new GbCuboid3D(g_minX1-blockLengthx1, g_minX2-blockLengthx1, g_maxX3, g_maxX1+blockLengthx1, g_maxX2+blockLengthx1, g_maxX3+blockLengthx1));
-      //   if(myid == 0) GbSystem3D::writeGeoObject(addWallZmax.get(), pathname+"/geo/addWallZmax", WbWriterVtkXmlASCII::getInstance());
-
-      //   //walls
-      //   int bbOption = 1; //0=simple Bounce Back, 1=quadr. BB        
-      //   D3Q27BoundaryConditionAdapterPtr slip(new D3Q27SlipBCAdapter(bbOption));
-      //   D3Q27InteractorPtr addWallZminInt(new D3Q27Interactor(addWallZmin, grid, slip,Interactor3D::SOLID));
-      //   D3Q27InteractorPtr addWallZmaxInt(new D3Q27Interactor(addWallZmax, grid, slip,Interactor3D::SOLID));
-
-      //   SetSolidOrTransBlockVisitor v1(addWallZminInt, SetSolidOrTransBlockVisitor::TRANS);
-      //   grid->accept(v1);
-      //   addWallZminInt->initInteractor();
-      //   SetSolidOrTransBlockVisitor v2(addWallZmaxInt, SetSolidOrTransBlockVisitor::TRANS);
-      //   grid->accept(v2);        
-      //   addWallZmaxInt->initInteractor();
-
-      //   UbSchedulerPtr geoSch(new UbScheduler(1));
-      //   D3Q27MacroscopicQuantitiesPostprocessorPtr ppgeo(
-      //      new D3Q27MacroscopicQuantitiesPostprocessor(grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), 
-      //      unitConverter, true));
-      //   ppgeo->update(0);
-      //   ppgeo.reset();
-      //   geoSch.reset();
-      //   //////////////////////////////////////////////////////////////////////////
-
-      //   if(myid == 0) UBLOG(logINFO,"Restart - end"); 
-      //}
-      //UbSchedulerPtr visSch(new UbScheduler());
-      ////visSch->addSchedule(1,0,3);
-      ////visSch->addSchedule(100,100,1000);
-      ////visSch->addSchedule(1000,1000,5000);
-      ////visSch->addSchedule(5000,5000,100000);
-      ////visSch->addSchedule(100000,100000,10000000);
-
-      //visSch->addSchedule(1000,1000,10000000);
-
-      //D3Q27MacroscopicQuantitiesPostprocessor pp(grid, visSch, pathname, WbWriterVtkXmlBinary::getInstance(), unitConverter);
-
-      //UbSchedulerPtr resSchRMS(new UbScheduler());
-      //resSchRMS->addSchedule(1000000,93000,10000000);
-      //UbSchedulerPtr resSchMeans(new UbScheduler());
-      //resSchMeans->addSchedule(1000000,93000,10000000);
-      //UbSchedulerPtr stepAvSch(new UbScheduler());
-      //int averageInterval=100;
-      //stepAvSch->addSchedule(averageInterval,0,10000000);
-      //AverageValuesPostprocessor Avpp(grid, pathname, WbWriterVtkXmlBinary::getInstance(), visSch/*wann wird rausgeschrieben*/, stepAvSch/*wann wird gemittelt*/, resSchMeans,resSchRMS/*wann wird resettet*/);
-
-      //UbSchedulerPtr nupsSch(new UbScheduler(10, 10, 30));
-      //nupsSch->addSchedule(500,500,1e6);
-      //NUPSCounterPostprocessor npr(grid, nupsSch, numOfThreads, comm);
-
-      //UbSchedulerPtr emSch(new UbScheduler(10));
-      //EmergencyExitPostprocessor empr(grid, emSch, pathname, RestartPostprocessorPtr(&rp), comm);
-
-      //if(myid == 0)
-      //{
-      //   UBLOG(logINFO,"PID = " << myid << " Total Physical Memory (RAM): " << MemoryUtil::getTotalPhysMem());
-      //   UBLOG(logINFO,"PID = " << myid << " Physical Memory currently used: " << MemoryUtil::getPhysMemUsed());
-      //   UBLOG(logINFO,"PID = " << myid << " Physical Memory currently used by current process: " << MemoryUtil::getPhysMemUsedByMe());
-      //}
-
-      //string lastStep = string(cstr2);
-      //double endTime = UbSystem::stringTo<double>(lastStep);
-      //CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, visSch));
-      //if(myid == 0) UBLOG(logINFO,"Simulation-start");
-      //calculation->calculate();
-      //if(myid == 0) UBLOG(logINFO,"Simulation-end");
-   }
-   catch(std::exception& e)
-   {
-      cerr << e.what() << endl << flush;
-   }
-   catch(std::string& s)
-   {
-      cerr << s << endl;
-   }
-   catch(...)
-   {
-      cerr << "unknown exception" << endl;
-   }
-
-}
-//////////////////////////////////////////////////////////////////////////
-int main(int argc, char* argv[])
-{
-   if (argc == 1)
-   {
-      cout<<"Command line argument isn't specified!"<<endl;
-      cout<<"plate2 <machine name>"<<endl;
-      return 1;
-   }
-   run(argv[1], argv[2]);
-
-   return 0;
-}
-
+#include <iostream>
+#include <string>
+#include <math.h> 
+
+#include <vfluids.h>
+
+using namespace std;
+
+void run(const char *cstr1, const char *cstr2)
+{
+   try
+   {
+      string pathname; 
+      string pathGeo;
+      string pathLog;
+      int numOfThreads = 1;
+      bool logfile = false;
+      stringstream logFilename;
+      double availMem = 0;
+
+      CommunicatorPtr comm = MPICommunicator::getInstance();
+      int myid = comm->getProcessID();
+
+      string machine = string(cstr1);
+
+      if(machine == "my") 
+      {
+         pathname = "d:/temp/bone";
+         pathGeo = "d:/Data/Bone/BigBone";
+         pathLog = "d:/temp/bone";
+         numOfThreads = 4;
+         logfile = false;
+         availMem = 15.0e9;
+      }
+      else if(machine == "Ludwig")      
+      {
+         pathname = "/work/koskuche/SFB880/plate2Con";
+         pathGeo = "/home/koskuche/data/plate";
+         pathLog = pathname;
+         numOfThreads = 8;
+         availMem = 12.0e9;///8*numOfThreads;
+         logfile = true;
+      }
+      else if(machine == "HLRS")      
+      {
+         pathname = "/univ_1/ws1/ws/xrmkuchr-plate3-0";
+         pathGeo = "/zhome/academic/HLRS/xrm/xrmkuchr/data/plate";
+         pathLog = "/zhome/academic/HLRS/xrm/xrmkuchr/work/plate";
+         numOfThreads = 16;
+         availMem = 2.0e9;
+         logfile = true;
+      }
+      else if(machine == "HLRN")      
+      {
+         pathname = "/gfs1/work/niivfcpu/scratch/plateEx";
+         pathGeo = "/gfs1/work/niivfcpu/data/plate";
+         pathLog = pathname;
+         numOfThreads = 24;
+         availMem = 64.0e9/24.0*numOfThreads;
+         logfile = true;
+      }
+      else throw UbException(UB_EXARGS, "unknown CAB_MACHINE");
+
+#if defined(__unix__)
+      if (myid==0) 
+      {
+         const char* str = pathLog.c_str();
+         int status=mkdir(str, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
+      }
+#endif 
+
+      if(myid == 0 && logfile)
+      {
+         //UbLog::reportingLevel() = logDEBUG5;
+         logFilename <<  pathLog + "/logfile"+UbSystem::toString(UbSystem::getTimeStamp())+"_"+UbSystem::toString(myid)+".txt";
+         UbLog::output_policy::setStream(logFilename.str());
+      }
+
+      if(myid==0) UBLOG(logINFO,"Testcase bone");
+
+      string boneFilename = pathGeo + "/bone.raw";
+      
+      int pmNX1=1800;  //abmessung einzelbild in x-richtung
+      int pmNX2=972; //abmessung einzelbild in y richtung
+      int pmNX3=1164; //anzahl der bilder
+      float lthreshold = 27756.0;
+      float uthreshold = 65535.0;
+
+      GbVoxelMatrix3DPtr pmMesh(new GbVoxelMatrix3D(pmNX1,pmNX2,pmNX3,0,lthreshold,uthreshold));
+      pmMesh->readMatrixFromRawFile<unsigned short>(boneFilename, GbVoxelMatrix3D::BigEndian);
+
+      double scaleFactor = 0.001;
+      double delta = 11.0*scaleFactor;
+      pmMesh->setVoxelMatrixDelta(delta, delta, delta);
+
+      pmMesh->setVoxelMatrixMininum(0.0, 0.0, 0.0);
+      if(myid == 0) pmMesh->writeToLegacyVTKBinary(pathname+"/geo/bone");
+
+      ///////////////////////////////////////////////////////
+      return;
+
+
+      /////////////////Knotenabmessungen:
+      //int nx[3], blocknx[3];
+      //nx[0]      = 90;//240;//120;//60;//86;//43;//65;//50;  //länge
+      //nx[1]      = 2;//2;//6;///1;//5;// //breite
+      //nx[2]      = 30;//64;//32;//18;//5;//15;//15; //höhe gebiet
+      //blocknx[0] = 16;//10;//6;
+      //blocknx[1] = 16;//10;//6;
+      //blocknx[2] = 16;//10;//6;
+
+      //int baseLevel   = 0;
+      //int refineLevel = 4;
+
+      //double H = 600.0; // Kanalhöhe [mm]
+      //double cdx = H/(double)(nx[2]*blocknx[2]);
+      //double fdx = cdx/double(1<<refineLevel);
+
+      ////double h = 200.0; // gewünschte Plattenhöhe in Gitterpunkten
+      ////double fdx = plate->getLengthX3()/h;
+      ////double cdx = fdx*double(1<<refineLevel);
+
+      //LBMUnitConverterPtr unitConverter = LBMUnitConverterPtr(new LBMUnitConverter());
+
+      ////////////////////////////////////////////////////////////////////////////
+      ////physik
+      ////////////////////////////////////////////////////////////////////////////
+      //double Re            = 1133333.3333333335; 
+      //double rhoLB         = 0.0;
+      //double uLB           = 0.1; 
+      //double lReal         = 1000; //Plattenlänge in mm
+      //double nuLB          = (uLB*(lReal/cdx))/Re;
+
+      //int sizeSP=4;
+      //mu::Parser spongeLayer;
+      //spongeLayer.SetExpr("x1>=(sizeX-sizeSP)/dx ? (sizeX-(x1+1))/sizeSP/2.0 + 0.5 : 1.0");
+      //spongeLayer.DefineConst("sizeX", nx[0]*blocknx[0]);
+      //spongeLayer.DefineConst("sizeSP", sizeSP*blocknx[0]);
+
+      //Grid3DPtr grid(new Grid3D(comm));
+
+      ////////////////////////////////////////////////////////////////////////////
+      ////restart
+      //UbSchedulerPtr rSch(new UbScheduler(1000,1000,10000000));
+      //RestartPostprocessor rp(grid, rSch, comm, pathname, RestartPostprocessor::BINARY);
+      ////////////////////////////////////////////////////////////////////////////
+
+      //if (grid->getTimeStep() == 0)
+      //{
+
+      //   if(myid==0) UBLOG(logINFO,"Neustart..");
+
+      //   //////////////////////////////////////////////////////////////////////////
+      //   //Platte
+      //   GbTriFaceMesh3DPtr plate (GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(PlatteFilename,"Netz"));
+      //   plate->rotate(90.0,0.0,0.0);  //TriFacMesh-KO-System anders als LB-KO-System
+      //   if(myid == 0) GbSystem3D::writeGeoObject( plate.get(), pathname+"/geo/platte", WbWriterVtkXmlBinary::getInstance() );
+      //   //////////////////////////////////////////////////////////////////////////
+      //   // Zackenband
+      //   //////////////////////////////////////////////////////////////////////////
+      //   GbTriFaceMesh3DPtr meshBand1 (GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "NetzBand"));
+      //   meshBand1->translate(-495, -700, -19.94);
+      //   if(myid == 0) GbSystem3D::writeGeoObject( meshBand1.get(), pathname+"/geo/Band1", WbWriterVtkXmlASCII::getInstance() );
+      //   // Zackenband2
+      //   GbTriFaceMesh3DPtr meshBand2(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "NetzBand2"));
+      //   meshBand2->translate(-495, -705, -19.94); 
+      //   if(myid == 0) GbSystem3D::writeGeoObject( meshBand2.get(), pathname+"/geo/Band2", WbWriterVtkXmlASCII::getInstance() );
+      //   // Zackenband3
+      //   GbTriFaceMesh3DPtr meshBand3(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "NetzBand3"));
+      //   meshBand3->translate(-495, -700, -19.64); 
+      //   if(myid == 0) GbSystem3D::writeGeoObject( meshBand3.get(), pathname+"/geo/Band3", WbWriterVtkXmlASCII::getInstance() );
+      //   // Zackenband4
+      //   GbTriFaceMesh3DPtr meshBand4(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "NetzBand4"));
+      //   meshBand4->translate(-495, -705, -19.64); 
+      //   if(myid == 0) GbSystem3D::writeGeoObject( meshBand4.get(), pathname+"/geo/Band4", WbWriterVtkXmlASCII::getInstance() );
+      //   //////////////////////////////////////////////////////////////////////////
+
+      //   double blockLengthx1 = blocknx[0]*cdx; //geowerte
+      //   double blockLengthx2 = blockLengthx1;
+      //   double blockLengthx3 = blockLengthx1;
+
+      //   double geoLength[]   = {  nx[0]*blockLengthx1, nx[1]*blockLengthx2, nx[2]*blockLengthx3}; 
+
+      //   double originX1 = plate->getX1Minimum()-plate->getLengthX1()/4.0;
+      //   double originX2 = plate->getX2Minimum();
+      //   double originX3 = plate->getX3Minimum()-299.5;
+
+
+      //   bool periodicx1 = false;
+      //   bool periodicx2 = true;
+      //   bool periodicx3 = true;
+
+      //   //bounding box
+      //   double g_minX1 = originX1;
+      //   double g_minX2 = originX2;
+      //   double g_minX3 = originX3;
+
+      //   double g_maxX1 = originX1 + geoLength[0];
+      //   double g_maxX2 = originX2 + geoLength[1];
+      //   double g_maxX3 = originX3 + geoLength[2];;
+
+
+      //   //set grid
+      //   grid->setDeltaX(cdx);
+      //   grid->setBlockNX(blocknx[0], blocknx[1], blocknx[2]);
+      //   grid->setPeriodicX1(periodicx1);
+      //   grid->setPeriodicX2(periodicx2);
+      //   grid->setPeriodicX3(periodicx3);
+
+      //   GbObject3DPtr gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
+      //   gridCube->setCenterCoordinates(gridCube->getX1Centroid(),meshBand1->getX2Centroid(),gridCube->getX3Centroid());
+      //   if(myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), pathname+"/geo/gridCube", WbWriterVtkXmlASCII::getInstance());
+
+      //   originX2 = gridCube->getX2Minimum();
+      //   g_minX2 = originX2;
+      //   g_maxX2 = originX2 + geoLength[1];
+
+      //   GenBlocksGridVisitor genBlocks(gridCube);
+      //   grid->accept(genBlocks);
+
+      //   //////////////////////////////////////////////////////////////////////////
+      //   if(myid == 0)
+      //   {
+      //      UBLOG(logINFO, "*****************************************");
+      //      UBLOG(logINFO, "* Parameters                            *");
+      //      UBLOG(logINFO, "* Re            ="<<Re);
+      //      UBLOG(logINFO, "* nuLB          ="<<nuLB);
+      //      UBLOG(logINFO, "* uLB           ="<<uLB);
+      //      UBLOG(logINFO, "* cdx           ="<<cdx);
+      //      UBLOG(logINFO, "* fdx           ="<<fdx);
+      //      double Hzb = 0.6/fdx;
+      //      UBLOG(logINFO, "* Height of Zackenband ="<<Hzb);
+      //      UBLOG(logINFO, "* Re on Zackenband ="<<(uLB*Hzb)/(nuLB*double(1<<refineLevel)));
+      //      UBLOG(logINFO, "* nx1/2/3       ="<<nx[0]<<"/"<<nx[1]<<"/"<<nx[2]);
+      //      UBLOG(logINFO, "* blocknx1/2/3  ="<<blocknx[0]<<"/"<<blocknx[1]<<"/"<<blocknx[2]);
+      //      UBLOG(logINFO, "* x1Periodic    ="<<periodicx1);
+      //      UBLOG(logINFO, "* x2Periodic    ="<<periodicx2);
+      //      UBLOG(logINFO, "* x3Periodic    ="<<periodicx3);
+      //      UBLOG(logINFO, "* number of levels  ="<<refineLevel+1);
+      //      UBLOG(logINFO, "* path          ="<<pathname);
+
+      //      UBLOG(logINFO, "*****************************************");
+      //      UBLOG(logINFO, "* number of threads    ="<<numOfThreads);
+      //      UBLOG(logINFO, "* number of processes  ="<<comm->getNumberOfProcesses());
+      //      UBLOG(logINFO, "*****************************************");
+      //      UBLOG(logINFO, "*****************************************");     
+      //   }
+      //   //////////////////////////////////////////////////////////////////////////
+
+
+      //   //////////////////////////////////////////////////////////////////////////
+      //   //refinement
+      //   GbCuboid3DPtr refinePlatteBox(new GbCuboid3D(plate->getX1Minimum(), plate->getX2Minimum(), plate->getX3Minimum()+(plate->getX3Maximum()-plate->getX3Minimum())/2.0, 
+      //      plate->getX1Maximum()+40.0, plate->getX2Maximum(), plate->getX3Maximum()));
+      //   if(myid == 0) GbSystem3D::writeGeoObject( refinePlatteBox.get(), pathname+"/geo/refinePlatteBox", WbWriterVtkXmlASCII::getInstance() );
+
+      //   if (refineLevel > 0)
+      //   {
+      //      if(myid == 0) UBLOG(logINFO,"Refinement - start");	
+      //      RefineCrossAndInsideGbObjectHelper refineHelper(grid, refineLevel);
+      //      refineHelper.addGbObject(refinePlatteBox, refineLevel);
+      //      refineHelper.refine();
+      //      if(myid == 0) UBLOG(logINFO,"Refinement - end");	
+      //   }
+
+      //   /////////////////////////////////////////////////
+      //   ///interactoren
+      //   int bbOption1 = 1; //0=simple Bounce Back, 1=quadr. BB
+      //   D3Q27BoundaryConditionAdapterPtr bcObst(new D3Q27NoSlipBCAdapter(bbOption1));
+      //   D3Q27TriFaceMeshInteractorPtr triPlateInteractor( new D3Q27TriFaceMeshInteractor(plate, grid, bcObst,Interactor3D::SOLID));
+      //   D3Q27TriFaceMeshInteractorPtr triBand1Interactor( new D3Q27TriFaceMeshInteractor( meshBand1, grid, bcObst,Interactor3D::SOLID, Interactor3D::EDGES) );
+      //   D3Q27TriFaceMeshInteractorPtr triBand2Interactor( new D3Q27TriFaceMeshInteractor( meshBand2, grid, bcObst,Interactor3D::SOLID, Interactor3D::EDGES) );
+      //   D3Q27TriFaceMeshInteractorPtr triBand3Interactor( new D3Q27TriFaceMeshInteractor( meshBand3, grid, bcObst,Interactor3D::SOLID, Interactor3D::EDGES) );
+      //   D3Q27TriFaceMeshInteractorPtr triBand4Interactor( new D3Q27TriFaceMeshInteractor( meshBand4, grid, bcObst,Interactor3D::SOLID, Interactor3D::EDGES) );
+
+      //   //inflow
+      //   GbCuboid3DPtr velBCCuboid(new GbCuboid3D(originX1-blockLengthx1, originX2-blockLengthx1, originX3-blockLengthx1, 
+      //      originX1, originX2+geoLength[1]+blockLengthx1, originX3+geoLength[2]+blockLengthx1));
+      //   if(myid == 0) GbSystem3D::writeGeoObject(velBCCuboid.get(), pathname+"/geo/velBCCuboid", WbWriterVtkXmlASCII::getInstance());
+      //   D3Q27InteractorPtr velBCInteractor(new D3Q27Interactor(velBCCuboid,grid,Interactor3D::SOLID)); 
+
+      //   //inflow
+      //   double raiseVelSteps = 0;
+      //   vector<D3Q27BCFunction> velcX1BCs,dummy;
+
+      //   mu::Parser inflowProfile;
+      //   inflowProfile.SetExpr("uLB"); 
+      //   inflowProfile.DefineConst("uLB",uLB);
+      //   velcX1BCs.push_back(D3Q27BCFunction(inflowProfile,raiseVelSteps,D3Q27BCFunction::INFCONST));
+
+      //   D3Q27BoundaryConditionAdapterPtr velBCAdapter(new D3Q27VelocityBCAdapter (velcX1BCs,dummy,dummy));
+      //   velBCInteractor->addBCAdapter(velBCAdapter);
+
+      //   //outflow
+      //   GbCuboid3DPtr densCuboid(new GbCuboid3D(originX1+geoLength[0], originX2-blockLengthx1, originX3-blockLengthx1, 
+      //      originX1+geoLength[0]+blockLengthx1, originX2+geoLength[1]+blockLengthx1, originX3+geoLength[2]+blockLengthx1 ));
+      //   if(myid == 0) GbSystem3D::writeGeoObject(densCuboid.get(), pathname+"/geo/densCuboid", WbWriterVtkXmlASCII::getInstance());
+      //   D3Q27BoundaryConditionAdapterPtr denBCAdapter(new D3Q27DensityBCAdapter(rhoLB));
+      //   D3Q27InteractorPtr densInteractor( new D3Q27Interactor(densCuboid,grid,denBCAdapter,Interactor3D::SOLID) );
+
+      //   ////////////////////////////////////////////
+      //   //METIS
+      //   Grid3DVisitorPtr metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B));	
+
+      //   ////////////////////////////////////////////
+      //   /////delete solid blocks
+      //   if(myid == 0) UBLOG(logINFO,"deleteSolidBlocks - start");
+      //   InteractorsHelper intHelper(grid, metisVisitor);
+      //   intHelper.addInteractor(triPlateInteractor);
+      //   intHelper.addInteractor(triBand1Interactor);
+      //   intHelper.addInteractor(triBand2Interactor);
+      //   intHelper.addInteractor(triBand3Interactor);
+      //   intHelper.addInteractor(triBand4Interactor);
+      //   intHelper.addInteractor(densInteractor);
+      //   intHelper.addInteractor(velBCInteractor);
+      //   intHelper.selectBlocks();
+      //   if(myid == 0) UBLOG(logINFO,"deleteSolidBlocks - end");	 
+      //   //////////////////////////////////////
+
+      //   //domain decomposition for threads
+      //   if(numOfThreads > 1)
+      //   {
+      //      PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
+      //      grid->accept(pqPartVisitor);
+      //   }
+
+      //   if(myid == 0)
+      //   {
+      //      UBLOG(logINFO,"Write blocks - start");
+      //      BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm));
+      //      ppblocks->update(0);
+      //      UBLOG(logINFO,"Write blocks - end");
+      //   }
+
+      //   unsigned long nob = grid->getNumberOfBlocks();
+      //   unsigned long nod = nob * blocknx[0]*blocknx[1]*blocknx[2];
+      //   unsigned long nod_real = nob * (blocknx[0]+3)*(blocknx[1]+3)*(blocknx[2]+3);
+      //   unsigned long nodb = (blocknx[0]) * (blocknx[1]) * (blocknx[2]);
+
+      //   double needMemAll  = double(nod_real*(27*sizeof(double) + sizeof(int)));
+      //   double needMem  = needMemAll / double(comm->getNumberOfProcesses());
+      //   
+      //   double nup = 0; 
+
+      //   if(myid == 0)
+      //   {
+      //      UBLOG(logINFO,"Number of blocks = " << nob);
+      //      UBLOG(logINFO,"Number of nodes  = " << nod);
+      //      int minInitLevel = grid->getCoarsestInitializedLevel();
+      //      int maxInitLevel = grid->getFinestInitializedLevel();
+      //      for(int level = minInitLevel; level<=maxInitLevel; level++)
+      //      {
+      //         int nobl = grid->getNumberOfBlocks(level);
+      //         UBLOG(logINFO,"Number of blocks for level " << level <<" = " << nobl);
+      //         UBLOG(logINFO,"Number of nodes for level " << level <<" = " << nobl*nodb);
+      //         nup += nobl*nodb*double(1<<level); 
+      //      }
+      //      UBLOG(logINFO,"Hypothetically time for calculation step for 120 nodes  = " << nup/6.0e5/(120*8)  << " s");
+      //      UBLOG(logINFO,"Necessary memory  = " << needMemAll  << " bytes");
+      //      UBLOG(logINFO,"Necessary memory per process = " << needMem  << " bytes");
+      //      UBLOG(logINFO,"Available memory per process = " << availMem << " bytes");
+      //      UBLOG(logINFO,"Available memory per node/8.0 = " << (availMem/8.0) << " bytes");
+      //   }
+
+      //   //////////////////////////////////////////
+      //   //set connectors
+      //   if(myid == 0) UBLOG(logINFO,"set connectors - start");
+      //   D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
+      //   D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
+      //   grid->accept( setConnsVisitor );
+      //   if(myid == 0) UBLOG(logINFO,"set connectors - end");
+
+      //   ////////////////////////////
+      //   LBMKernel3DPtr kernel;
+      //   //kernel = LBMKernel3DPtr(new LBMKernelETD3Q27CCLB(blocknx[0], blocknx[1], blocknx[2], LBMKernelETD3Q27CCLB::NORMAL));
+
+      //   //with sponge layer
+      //   kernel = LBMKernel3DPtr(new LBMKernelETD3Q27CCLBWithSpongeLayer(blocknx[0], blocknx[1], blocknx[2], LBMKernelETD3Q27CCLB::NORMAL));
+      //   kernel->setWithSpongeLayer(true);
+      //   kernel->setSpongeLayer(spongeLayer);
+
+      //   BCProcessorPtr bcProc(new D3Q27ETBCProcessor());
+      //   kernel->setBCProcessor(bcProc);
+      //   SetKernelBlockVisitor kernelVisitor(kernel, nuLB, availMem, needMem);
+      //   grid->accept(kernelVisitor);
+      //   //////////////////////////////////
+      //   //undef nodes
+      //   if (refineLevel > 0)
+      //   {
+      //      D3Q27SetUndefinedNodesBlockVisitor undefNodesVisitor;
+      //      grid->accept(undefNodesVisitor);
+      //   }
+
+
+      //   intHelper.setBC();
+
+      //   //initialization of decompositions
+      //   D3Q27ETInitDistributionsBlockVisitor initVisitor( nuLB,rhoLB);
+      //   initVisitor.setVx1(uLB);
+      //   grid->accept(initVisitor);
+
+      //   //Postprozess
+      //   UbSchedulerPtr geoSch(new UbScheduler(1));
+      //   D3Q27MacroscopicQuantitiesPostprocessorPtr ppgeo(
+      //      new D3Q27MacroscopicQuantitiesPostprocessor(grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), 
+      //      unitConverter, true));
+      //   ppgeo->update(0);
+      //   ppgeo.reset();
+      //   geoSch.reset();
+
+      //   if(myid == 0) UBLOG(logINFO,"Preprozess - end");      
+      //}
+      //else
+      //{
+      //   //domain decomposition for threads
+      //   if(numOfThreads > 1)
+      //   {
+      //      PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
+      //      grid->accept(pqPartVisitor);
+      //   }
+      //   //set connectors
+      //   //grid->setPeriodicX3(false);
+      //   D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
+      //   D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
+      //   grid->accept( setConnsVisitor );
+      //   SetSpongeLayerBlockVisitor ssp(spongeLayer);
+      //   grid->accept(ssp);
+
+      //   //////////////////////////////////////////////////////////////////////////
+      //   //////////////////////////////////////////////////////////////////////////
+      //   //Platte
+      //   GbTriFaceMesh3DPtr plate (GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(PlatteFilename,"Netz"));
+      //   plate->rotate(90.0,0.0,0.0);  //TriFacMesh-KO-System anders als LB-KO-System
+      //   if(myid == 0) GbSystem3D::writeGeoObject( plate.get(), pathname+"/geo/platte", WbWriterVtkXmlBinary::getInstance() );
+      //   //////////////////////////////////////////////////////////////////////////
+      //   //////////////////////////////////////////////////////////////////////////
+      //   // Zackenband
+      //   //////////////////////////////////////////////////////////////////////////
+      //   GbTriFaceMesh3DPtr meshBand1 (GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "NetzBand"));
+      //   meshBand1->translate(-495, -700, -19.94);
+      //   if(myid == 0) GbSystem3D::writeGeoObject( meshBand1.get(), pathname+"/geo/Band1", WbWriterVtkXmlASCII::getInstance() );
+
+      //   double blockLengthx1 = blocknx[0]*cdx; //geowerte
+      //   double blockLengthx2 = blockLengthx1;
+      //   double blockLengthx3 = blockLengthx1;
+
+      //   double geoLength[]   = {  nx[0]*blockLengthx1, nx[1]*blockLengthx2, nx[2]*blockLengthx3}; 
+
+      //   double originX1 = plate->getX1Minimum()-plate->getLengthX1()/4.0;
+      //   double originX2 = plate->getX2Minimum();
+      //   double originX3 = plate->getX3Minimum()-299.5;
+
+      //   //bounding box
+      //   double g_minX1 = originX1;
+      //   double g_minX2 = originX2;
+      //   double g_minX3 = originX3;
+
+      //   double g_maxX1 = originX1 + geoLength[0];
+      //   double g_maxX2 = originX2 + geoLength[1];
+      //   double g_maxX3 = originX3 + geoLength[2];;
+
+      //   GbObject3DPtr gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
+      //   gridCube->setCenterCoordinates(gridCube->getX1Centroid(),meshBand1->getX2Centroid(),gridCube->getX3Centroid());
+      //   if(myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), pathname+"/geo/gridCube", WbWriterVtkXmlASCII::getInstance());
+
+      //   originX2 = gridCube->getX2Minimum();
+      //   g_minX2 = originX2;
+      //   g_maxX2 = originX2 + geoLength[1];
+      //   //walls
+      //   GbCuboid3DPtr addWallZmin (new GbCuboid3D(g_minX1-blockLengthx1, g_minX2-blockLengthx1, g_minX3-blockLengthx1, g_maxX1+blockLengthx1, g_maxX2+blockLengthx1, g_minX3));
+      //   if(myid == 0) GbSystem3D::writeGeoObject(addWallZmin.get(), pathname+"/geo/addWallZmin", WbWriterVtkXmlASCII::getInstance());
+
+      //   GbCuboid3DPtr addWallZmax (new GbCuboid3D(g_minX1-blockLengthx1, g_minX2-blockLengthx1, g_maxX3, g_maxX1+blockLengthx1, g_maxX2+blockLengthx1, g_maxX3+blockLengthx1));
+      //   if(myid == 0) GbSystem3D::writeGeoObject(addWallZmax.get(), pathname+"/geo/addWallZmax", WbWriterVtkXmlASCII::getInstance());
+
+      //   //walls
+      //   int bbOption = 1; //0=simple Bounce Back, 1=quadr. BB        
+      //   D3Q27BoundaryConditionAdapterPtr slip(new D3Q27SlipBCAdapter(bbOption));
+      //   D3Q27InteractorPtr addWallZminInt(new D3Q27Interactor(addWallZmin, grid, slip,Interactor3D::SOLID));
+      //   D3Q27InteractorPtr addWallZmaxInt(new D3Q27Interactor(addWallZmax, grid, slip,Interactor3D::SOLID));
+
+      //   SetSolidOrTransBlockVisitor v1(addWallZminInt, SetSolidOrTransBlockVisitor::TRANS);
+      //   grid->accept(v1);
+      //   addWallZminInt->initInteractor();
+      //   SetSolidOrTransBlockVisitor v2(addWallZmaxInt, SetSolidOrTransBlockVisitor::TRANS);
+      //   grid->accept(v2);        
+      //   addWallZmaxInt->initInteractor();
+
+      //   UbSchedulerPtr geoSch(new UbScheduler(1));
+      //   D3Q27MacroscopicQuantitiesPostprocessorPtr ppgeo(
+      //      new D3Q27MacroscopicQuantitiesPostprocessor(grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), 
+      //      unitConverter, true));
+      //   ppgeo->update(0);
+      //   ppgeo.reset();
+      //   geoSch.reset();
+      //   //////////////////////////////////////////////////////////////////////////
+
+      //   if(myid == 0) UBLOG(logINFO,"Restart - end"); 
+      //}
+      //UbSchedulerPtr visSch(new UbScheduler());
+      ////visSch->addSchedule(1,0,3);
+      ////visSch->addSchedule(100,100,1000);
+      ////visSch->addSchedule(1000,1000,5000);
+      ////visSch->addSchedule(5000,5000,100000);
+      ////visSch->addSchedule(100000,100000,10000000);
+
+      //visSch->addSchedule(1000,1000,10000000);
+
+      //D3Q27MacroscopicQuantitiesPostprocessor pp(grid, visSch, pathname, WbWriterVtkXmlBinary::getInstance(), unitConverter);
+
+      //UbSchedulerPtr resSchRMS(new UbScheduler());
+      //resSchRMS->addSchedule(1000000,93000,10000000);
+      //UbSchedulerPtr resSchMeans(new UbScheduler());
+      //resSchMeans->addSchedule(1000000,93000,10000000);
+      //UbSchedulerPtr stepAvSch(new UbScheduler());
+      //int averageInterval=100;
+      //stepAvSch->addSchedule(averageInterval,0,10000000);
+      //AverageValuesPostprocessor Avpp(grid, pathname, WbWriterVtkXmlBinary::getInstance(), visSch/*wann wird rausgeschrieben*/, stepAvSch/*wann wird gemittelt*/, resSchMeans,resSchRMS/*wann wird resettet*/);
+
+      //UbSchedulerPtr nupsSch(new UbScheduler(10, 10, 30));
+      //nupsSch->addSchedule(500,500,1e6);
+      //NUPSCounterPostprocessor npr(grid, nupsSch, numOfThreads, comm);
+
+      //UbSchedulerPtr emSch(new UbScheduler(10));
+      //EmergencyExitPostprocessor empr(grid, emSch, pathname, RestartPostprocessorPtr(&rp), comm);
+
+      //if(myid == 0)
+      //{
+      //   UBLOG(logINFO,"PID = " << myid << " Total Physical Memory (RAM): " << MemoryUtil::getTotalPhysMem());
+      //   UBLOG(logINFO,"PID = " << myid << " Physical Memory currently used: " << MemoryUtil::getPhysMemUsed());
+      //   UBLOG(logINFO,"PID = " << myid << " Physical Memory currently used by current process: " << MemoryUtil::getPhysMemUsedByMe());
+      //}
+
+      //string lastStep = string(cstr2);
+      //double endTime = UbSystem::stringTo<double>(lastStep);
+      //CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, visSch));
+      //if(myid == 0) UBLOG(logINFO,"Simulation-start");
+      //calculation->calculate();
+      //if(myid == 0) UBLOG(logINFO,"Simulation-end");
+   }
+   catch(std::exception& e)
+   {
+      cerr << e.what() << endl << flush;
+   }
+   catch(std::string& s)
+   {
+      cerr << s << endl;
+   }
+   catch(...)
+   {
+      cerr << "unknown exception" << endl;
+   }
+
+}
+//////////////////////////////////////////////////////////////////////////
+int main(int argc, char* argv[])
+{
+   if (argc == 1)
+   {
+      cout<<"Command line argument isn't specified!"<<endl;
+      cout<<"plate2 <machine name>"<<endl;
+      return 1;
+   }
+   run(argv[1], argv[2]);
+
+   return 0;
+}
+
diff --git a/apps/cpu/f16Test/F16BombadilTestSmall.cfg b/apps/cpu/f16Test/F16BombadilTestSmall.cfg
index eec8b2855c6a71cc209c05aab30864b8a62cb1f9..c0ee5662e270b6450e8d3dc0bb6bda4617512cce 100644
--- a/apps/cpu/f16Test/F16BombadilTestSmall.cfg
+++ b/apps/cpu/f16Test/F16BombadilTestSmall.cfg
@@ -1,55 +1,55 @@
-pathOut = d:/temp/f16Small
-pathGeo = d:/Projects/SFB880/DLR-F16/A1_Forschungsdaten_Profilgeometrie_STL_CATIA_Rossian
-#fngFileWhole = f16-ascii.stl
-#fngFileWhole = grundgeometrie-direkter-export.stl
-#fngFileWhole = grundgeometrie-mittel.stl
-
-fngFileWhole = cylinder.ASCII.stl
-
-fngFileBodyPart = f16-body-part-ascii.stl
-fngFileTrailingEdge = f16-trailing-edge-ascii.stl
-zigZagTape = 2zackenbaender0.stl
-
-numOfThreads = 2
-availMem = 10e9
-refineLevel = 8
-#blockNx = 8 4 8
-blockNx = 21 6 13
-#blockNx = 294 12 247
-uLB = 0.1
-
-#x1min x1max x2min x2max x3min x3max [m]
-#boundingBox = -0.90 1.20 0.035 0.065 -0.65 0.65
-#boundingBox = -0.1 0.60 0.035 0.065 -0.3 0.3
-#boundingBox = -10e-3 310e-3 0.035 0.065 -21e-3 21e-3
-
-boundingBox = -0.255 0.27 0.035 0.065 -0.17 0.155
-
-#deltaXfine = 0.005 #level 0
-#deltaXfine = 0.0025 #level 1
-#deltaXfine = 0.00125 #level 2
-#deltaXfine = 0.000625 #level 3
-#deltaXfine = 0.0003125 #level 4
-#deltaXfine = 0.00015625 #level 5
-#deltaXfine = 0.000078125 #level 6
-#deltaXfine = 0.0000390625 #level 7
-deltaXfine = 0.00001953125 #level 8
-
-
-refineDistance = 0.3
-
-restartStep = 10
-restartStepStart = 10
-
-outTime = 1
-endTime = 10
-
-logToFile = false
-
-porousTralingEdge = false
-
-thinWall = false
-
-testBox=false
-
+pathOut = d:/temp/f16Small
+pathGeo = d:/Projects/SFB880/DLR-F16/A1_Forschungsdaten_Profilgeometrie_STL_CATIA_Rossian
+#fngFileWhole = f16-ascii.stl
+#fngFileWhole = grundgeometrie-direkter-export.stl
+#fngFileWhole = grundgeometrie-mittel.stl
+
+fngFileWhole = cylinder.ASCII.stl
+
+fngFileBodyPart = f16-body-part-ascii.stl
+fngFileTrailingEdge = f16-trailing-edge-ascii.stl
+zigZagTape = 2zackenbaender0.stl
+
+numOfThreads = 2
+availMem = 10e9
+refineLevel = 8
+#blockNx = 8 4 8
+blockNx = 21 6 13
+#blockNx = 294 12 247
+uLB = 0.1
+
+#x1min x1max x2min x2max x3min x3max [m]
+#boundingBox = -0.90 1.20 0.035 0.065 -0.65 0.65
+#boundingBox = -0.1 0.60 0.035 0.065 -0.3 0.3
+#boundingBox = -10e-3 310e-3 0.035 0.065 -21e-3 21e-3
+
+boundingBox = -0.255 0.27 0.035 0.065 -0.17 0.155
+
+#deltaXfine = 0.005 #level 0
+#deltaXfine = 0.0025 #level 1
+#deltaXfine = 0.00125 #level 2
+#deltaXfine = 0.000625 #level 3
+#deltaXfine = 0.0003125 #level 4
+#deltaXfine = 0.00015625 #level 5
+#deltaXfine = 0.000078125 #level 6
+#deltaXfine = 0.0000390625 #level 7
+deltaXfine = 0.00001953125 #level 8
+
+
+refineDistance = 0.3
+
+restartStep = 10
+restartStepStart = 10
+
+outTime = 1
+endTime = 10
+
+logToFile = false
+
+porousTralingEdge = false
+
+thinWall = false
+
+testBox=false
+
 nupsStep = 1 1 10000000
\ No newline at end of file
diff --git a/apps/cpu/f16Test/f16test.cpp b/apps/cpu/f16Test/f16test.cpp
index dffcd8b284563a645ce12b76fc8fab7985901b99..8e3bb726e638fb1946e23d841e5c35aaa085d0cc 100644
--- a/apps/cpu/f16Test/f16test.cpp
+++ b/apps/cpu/f16Test/f16test.cpp
@@ -1,659 +1,659 @@
-#include <iostream>
-#include <string>
-
-#include <boost/pointer_cast.hpp>
-
-#include "VirtualFluids.h"
-
-using namespace std;
-
-double rangeRandom1()
-{
-   return (2.0*rand())/RAND_MAX-1.0;
-}
-
-void run(string configname)
-{
-   try
-   {
-      ConfigurationFile   config;
-      config.load(configname);
-
-      string          pathOut = config.getString("pathOut");
-      string          pathGeo = config.getString("pathGeo");
-      string          fngFileWhole = config.getString("fngFileWhole");
-      string          fngFileTrailingEdge = config.getString("fngFileTrailingEdge");
-      string          fngFileBodyPart = config.getString("fngFileBodyPart");
-      string          zigZagTape = config.getString("zigZagTape");
-      int             numOfThreads = config.getInt("numOfThreads");
-      vector<int>     blockNx = config.getVector<int>("blockNx");
-      vector<double>  boundingBox = config.getVector<double>("boundingBox");
-      double          uLB = config.getDouble("uLB");
-      double          restartStep = config.getDouble("restartStep");
-      double          restartStepStart = config.getDouble("restartStepStart");
-      double          endTime = config.getDouble("endTime");
-      double          outTime = config.getDouble("outTime");
-      double          availMem = config.getDouble("availMem");
-      int             refineLevel = config.getInt("refineLevel");
-      bool            logToFile = config.getBool("logToFile");
-      bool            porousTralingEdge = config.getBool("porousTralingEdge");
-      double          deltaXfine = config.getDouble("deltaXfine")*1000.0;
-      bool            thinWall = config.getBool("thinWall");
-      double          refineDistance = config.getDouble("refineDistance");
-      vector<double>  nupsStep = config.getVector<double>("nupsStep");
-
-      SPtr<Communicator> comm = MPICommunicator::getInstance();
-      int myid = comm->getProcessID();
-
-      if (logToFile)
-      {
-#if defined(__unix__)
-         if (myid == 0)
-         {
-            const char* str = pathOut.c_str();
-            mkdir(str, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
-         }
-#endif 
-
-         if (myid == 0)
-         {
-            stringstream logFilename;
-            logFilename << pathOut + "/logfile" + UbSystem::toString(UbSystem::getTimeStamp()) + ".txt";
-            UbLog::output_policy::setStream(logFilename.str());
-         }
-      }
-
-      
-      double g_minX1 = boundingBox[0]*1000.0;
-      double g_minX2 = boundingBox[2]*1000.0;
-      double g_minX3 = boundingBox[4]*1000.0;
-
-      double g_maxX1 = boundingBox[1]*1000.0;
-      double g_maxX2 = boundingBox[3]*1000.0;
-      double g_maxX3 = boundingBox[5]*1000.0;
-       
-      //////////////////////////////////////////////////////////////////////////
-      double deltaXcoarse = deltaXfine*(double)(1 << refineLevel);
-      //double nx2_temp = floor((g_maxX2 - g_minX2) / (deltaXcoarse*(double)blockNx[0]));
-
-      //deltaXcoarse = (g_maxX2 - g_minX2) / (nx2_temp*(double)blockNx[0]);
-      //UBLOG(logINFO, "nx2_temp:"<<nx2_temp);
-      //g_maxX2 -= 0.5* deltaXcoarse;
-      //////////////////////////////////////////////////////////////////////////
-      double blockLength = (double)blockNx[0] * deltaXcoarse;
-
-      //##########################################################################
-      //## physical parameters
-      //##########################################################################
-      double Re = 1;//e6;
-
-      double rhoLB = 0.0;
-      double rhoReal = 1.2041; //(kg/m3)
-      double nueReal = 153.5e-7; //m^2/s
-
-      double lReal = 3.0;//m
-      double uReal = Re*nueReal / lReal;
-
-      //##Machzahl:
-      //#Ma     = uReal/csReal
-      double Ma = 0.15;//Ma-Real!
-      //double csReal = uReal / Ma;
-      //double hLB = lReal / deltaXcoarse;
-
-      //LBMUnitConverter unitConverter(lReal, csReal, rhoReal, hLB);
-
-      //double u_LB = uReal   * unitConverter.getFactorVelocityWToLb();
-      //double nu_LB = nueReal * unitConverter.getFactorViscosityWToLb();
-      double l_LB = 300 / deltaXcoarse;
-      double nuLB = (uLB*l_LB) / Re; //0.005;
-      //double nuLB = 0.005;
-
-      SPtr<LBMUnitConverter> conv = SPtr<LBMUnitConverter>(new LBMUnitConverter());
-
-      const int baseLevel = 0;
-
-      ////////////////////////////////////////////////////////////////////////
-      //Grid
-      //////////////////////////////////////////////////////////////////////////
-      SPtr<Grid3D> grid(new Grid3D(comm));
-      grid->setDeltaX(deltaXcoarse);
-      grid->setBlockNX(blockNx[0], blockNx[1], blockNx[2]);
-
-      SPtr<GbObject3D> gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
-      //gridCube->setCenterCoordinates(geo->getX1Centroid(), geo->getX2Centroid(), geo->getX3Centroid());
-      if (myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), pathOut + "/geo/gridCube", WbWriterVtkXmlASCII::getInstance());
-      GenBlocksGridVisitor genBlocks(gridCube);
-      grid->accept(genBlocks);
-
-      grid->setPeriodicX1(false);
-      grid->setPeriodicX2(true);
-      grid->setPeriodicX3(false);
-
-      //BC adapters
-      SPtr<BCAdapter> noSlipBCAdapter(new NoSlipBCAdapter());
-      if (thinWall)
-      {
-         noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new ThinWallNoSlipBCAlgorithm()));
-      }
-      else
-      {
-         noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NoSlipBCAlgorithm()));
-      }
-
-      SPtr<BCAdapter> slipBCAdapter(new SlipBCAdapter());
-      slipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new SlipBCAlgorithm()));
-
-      mu::Parser fct;
-      fct.SetExpr("U");
-      fct.DefineConst("U", uLB);
-      SPtr<BCAdapter> velBCAdapter(new VelocityBCAdapter(true, false, false, fct, 0, BCFunction::INFCONST));
-      velBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NonReflectingOutflowBCAlgorithm()));
-
-      SPtr<BCAdapter> denBCAdapter(new DensityBCAdapter(rhoLB));
-      denBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NonReflectingOutflowBCAlgorithm()));
-
-      BoundaryConditionsBlockVisitor bcVisitor;
-      bcVisitor.addBC(noSlipBCAdapter);
-      bcVisitor.addBC(slipBCAdapter);
-      bcVisitor.addBC(velBCAdapter);
-      bcVisitor.addBC(denBCAdapter);
-
-      //////////////////////////////////////////////////////////////////////////
-      //restart
-      SPtr<UbScheduler> rSch(new UbScheduler(restartStep, restartStep));
-      RestartCoProcessor rp(grid, rSch, comm, pathOut, RestartCoProcessor::TXT);
-      //////////////////////////////////////////////////////////////////////////
-
-
-      if (grid->getTimeStep() == 0)
-      {
-         if (myid == 0)
-         {
-            UBLOG(logINFO, "Parameters:");
-            UBLOG(logINFO, "* Re                  = "<<Re);
-            UBLOG(logINFO, "* Ma                  = "<<Ma);
-            UBLOG(logINFO, "* velocity (uReal)    = "<<uReal<<" m/s");
-            UBLOG(logINFO, "* viscosity (nuReal)  = "<<nueReal<<" m^2/s");
-            UBLOG(logINFO, "* velocity LB (uLB)   = "<<uLB);
-            UBLOG(logINFO, "* viscosity LB (nuLB) = "<<nuLB);
-            UBLOG(logINFO, "* dx_base             = "<<deltaXcoarse/1000.0<<" m");
-            UBLOG(logINFO, "* dx_refine           = "<<deltaXfine/1000.0<<" m");
-            UBLOG(logINFO, "* number of levels    = " << refineLevel + 1);
-            UBLOG(logINFO, "* number of threads   = " << numOfThreads);
-            UBLOG(logINFO, "* number of processes = " << comm->getNumberOfProcesses());
-            UBLOG(logINFO, "Preprozess - start");
-         }
-
-         SPtr<GbTriFaceMesh3D> fngMeshWhole;
-         SPtr<GbTriFaceMesh3D> fngMeshBodyPart;
-         SPtr<GbTriFaceMesh3D> fngMeshTrailingEdge;
-         if (porousTralingEdge)
-         {
-            if (myid==0) UBLOG(logINFO, "Read fngFileBodyPart:start");
-            fngMeshBodyPart = SPtr<GbTriFaceMesh3D>(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(pathGeo+"/"+fngFileBodyPart, "fngMeshBody", GbTriFaceMesh3D::KDTREE_SAHPLIT, false));
-            if (myid==0) UBLOG(logINFO, "Read fngFileBodyPart:end");
-            fngMeshBodyPart->rotate(0.0, 0.5, 0.0);
-            if (myid==0) GbSystem3D::writeGeoObject(fngMeshBodyPart.get(), pathOut+"/geo/fngMeshBody", WbWriterVtkXmlBinary::getInstance());
-
-            if (myid==0) UBLOG(logINFO, "Read fngFileTrailingEdge:start");
-            fngMeshTrailingEdge = SPtr<GbTriFaceMesh3D>(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(pathGeo+"/"+fngFileTrailingEdge, "fngMeshTrailingEdge", GbTriFaceMesh3D::KDTREE_SAHPLIT, false));
-            if (myid==0) UBLOG(logINFO, "Read fngFileTrailingEdge:end");
-            fngMeshTrailingEdge->rotate(0.0, 0.5, 0.0);
-            fngMeshTrailingEdge->translate(0,0,1.3);
-            if (myid==0) GbSystem3D::writeGeoObject(fngMeshTrailingEdge.get(), pathOut+"/geo/fngMeshTrailingEdge", WbWriterVtkXmlBinary::getInstance());
-         }
-         else
-         {
-            if (myid==0) UBLOG(logINFO, "Read fngFileWhole:start");
-            fngMeshWhole = SPtr<GbTriFaceMesh3D>(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(pathGeo+"/"+fngFileWhole, "fngMeshWhole", GbTriFaceMesh3D::KDTREE_SAHPLIT, false));
-            if (myid==0) UBLOG(logINFO, "Read fngFileWhole:end");
-            fngMeshWhole->rotate(0.0, 0.5, 0.0);
-            if (myid==0) GbSystem3D::writeGeoObject(fngMeshWhole.get(), pathOut+"/geo/fngMeshWhole", WbWriterVtkXmlBinary::getInstance());
-         }
-
-         //////////////////////////////////////////////////////////////////////////
-         // Zackenband
-         //////////////////////////////////////////////////////////////////////////
-         //top
-         //////////////////////////////////////////////////////////////////////////
-         //if (myid==0) UBLOG(logINFO, "Read zigZagTape:start");
-         //string ZckbndFilename = pathGeo+"/"+zigZagTape;
-         //SPtr<GbTriFaceMesh3D> meshBand1(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "zigZagTape1"));
-         //meshBand1->rotate(0.0, 5, 0.0);
-         //meshBand1->translate(15, 0, -12.850);
-         //if (myid==0) GbSystem3D::writeGeoObject(meshBand1.get(), pathOut+"/geo/zigZagTape1", WbWriterVtkXmlASCII::getInstance());
-         //// Zackenband2
-         //SPtr<GbTriFaceMesh3D> meshBand2(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "zigZagTape2"));
-         //meshBand2->rotate(0.0, 5, 0.0);
-         //meshBand2->translate(15, 5, -12.850);
-         //if (myid==0) GbSystem3D::writeGeoObject(meshBand2.get(), pathOut+"/geo/zigZagTape2", WbWriterVtkXmlASCII::getInstance());
-         ////// Zackenband3
-         ////SPtr<GbTriFaceMesh3D> meshBand3(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "zigZagTape3"));
-         ////meshBand3->rotate(0.0, 5, 0.0);
-         ////meshBand3->translate(15, 0, -12.35);
-         ////if (myid==0) GbSystem3D::writeGeoObject(meshBand3.get(), pathOut+"/geo/zigZagTape3", WbWriterVtkXmlASCII::getInstance());
-         ////// Zackenband4
-         ////SPtr<GbTriFaceMesh3D> meshBand4(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "zigZagTape4"));
-         ////meshBand4->rotate(0.0, 5, 0.0);
-         ////meshBand4->translate(15, 5, -12.35);
-         ////if (myid==0) GbSystem3D::writeGeoObject(meshBand4.get(), pathOut+"/geo/zigZagTape4", WbWriterVtkXmlASCII::getInstance());
-        
-         ////bottom
-         //SPtr<GbTriFaceMesh3D> meshBand5(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "zigZagTape5"));
-         //meshBand5->rotate(0.0, -1, 0.0);
-         //meshBand5->rotate(0.0, 0.0,180.0);
-         //meshBand5->translate(30, 0, -37.3);
-         //if (myid==0) GbSystem3D::writeGeoObject(meshBand5.get(), pathOut+"/geo/zigZagTape5", WbWriterVtkXmlASCII::getInstance());
-         //// Zackenband6
-         //SPtr<GbTriFaceMesh3D> meshBand6(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "zigZagTape6"));
-         //meshBand6->rotate(0.0, -1, 0.0);
-         //meshBand6->rotate(0.0, 0.0, 180.0);
-         //meshBand6->translate(30, 5, -37.3);
-         //if (myid==0) GbSystem3D::writeGeoObject(meshBand6.get(), pathOut+"/geo/zigZagTape6", WbWriterVtkXmlASCII::getInstance());
-         ////// Zackenband7
-         ////SPtr<GbTriFaceMesh3D> meshBand7(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "zigZagTape7"));
-         ////meshBand7->rotate(0.0, 5, 0.0);
-         ////meshBand7->translate(15, 0, -12.35);
-         ////if (myid==0) GbSystem3D::writeGeoObject(meshBand7.get(), pathOut+"/geo/zigZagTape7", WbWriterVtkXmlASCII::getInstance());
-         ////// Zackenband8
-         ////SPtr<GbTriFaceMesh3D> meshBan8(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "zigZagTape8"));
-         ////meshBan8->rotate(0.0, 5, 0.0);
-         ////meshBan8->translate(15, 5, -12.35);
-         ////if (myid==0) GbSystem3D::writeGeoObject(meshBan8.get(), pathOut+"/geo/zigZagTape8", WbWriterVtkXmlASCII::getInstance());
-         //if (myid==0) UBLOG(logINFO, "Read zigZagTape:end");
-
-         //////////////////////////////////////////////////////////////////////////
-
-         SPtr<Interactor3D> fngIntrWhole;
-         SPtr<Interactor3D> fngIntrBodyPart;
-         SPtr<Interactor3D> fngIntrTrailingEdge;
-         if (porousTralingEdge)
-         {
-            fngIntrBodyPart = SPtr<D3Q27TriFaceMeshInteractor>(new D3Q27TriFaceMeshInteractor(fngMeshBodyPart, grid, noSlipBCAdapter, Interactor3D::SOLID));
-            fngIntrTrailingEdge = SPtr<D3Q27TriFaceMeshInteractor>(new D3Q27TriFaceMeshInteractor(fngMeshTrailingEdge, grid, noSlipBCAdapter, Interactor3D::SOLID));
-         }
-         else
-         {
-            fngIntrWhole = SPtr<D3Q27TriFaceMeshInteractor>(new D3Q27TriFaceMeshInteractor(fngMeshWhole, grid, noSlipBCAdapter, Interactor3D::SOLID));//, Interactor3D::EDGES));
-         }
-
-         //SPtr<D3Q27TriFaceMeshInteractor> triBand1Interactor(new D3Q27TriFaceMeshInteractor(meshBand1, grid, noSlipBCAdapter, Interactor3D::SOLID));//, Interactor3D::EDGES));
-         //SPtr<D3Q27TriFaceMeshInteractor> triBand2Interactor(new D3Q27TriFaceMeshInteractor(meshBand2, grid, noSlipBCAdapter, Interactor3D::SOLID));//, Interactor3D::EDGES));
-         //SPtr<D3Q27TriFaceMeshInteractor> triBand3Interactor(new D3Q27TriFaceMeshInteractor(meshBand3, grid, noSlipBCAdapter, Interactor3D::SOLID));//, Interactor3D::EDGES));
-         //SPtr<D3Q27TriFaceMeshInteractor> triBand4Interactor(new D3Q27TriFaceMeshInteractor(meshBand4, grid, noSlipBCAdapter, Interactor3D::SOLID));//, Interactor3D::EDGES));
-
-
-
-         if (refineLevel > 0 && myid == 0)
-         {
-            if (myid == 0) UBLOG(logINFO, "Refinement - start");
-            //RefineCrossAndInsideGbObjectHelper refineHelper(grid, refineLevel);
-            //refineHelper.addGbObject(geo, refineLevel);
-            //refineHelper.refine();
-            
-            //RefineAroundGbObjectHelper refineHelper1(grid, refineLevel-1, boost::dynamic_pointer_cast<D3Q27TriFaceMeshInteractor>(geoIntr1), 0.0, 10.0, comm);
-            //refineHelper1.refine();
-            //RefineAroundGbObjectHelper refineHelper2(grid, refineLevel, boost::dynamic_pointer_cast<D3Q27TriFaceMeshInteractor>(geoIntr2), -1.0, 5.0, comm);
-            //refineHelper2.refine();
-            
-
-            int rank = grid->getRank();
-            grid->setRank(0);
-            //boost::dynamic_pointer_cast<D3Q27TriFaceMeshInteractor>(triBand1Interactor)->refineBlockGridToLevel(refineLevel, 0.0, refineDistance);
-            //boost::dynamic_pointer_cast<D3Q27TriFaceMeshInteractor>(triBand2Interactor)->refineBlockGridToLevel(refineLevel, 0.0, refineDistance);
-            //boost::dynamic_pointer_cast<D3Q27TriFaceMeshInteractor>(triBand3Interactor)->refineBlockGridToLevel(refineLevel, 0.0, refineDistance);
-            //boost::dynamic_pointer_cast<D3Q27TriFaceMeshInteractor>(triBand4Interactor)->refineBlockGridToLevel(refineLevel, 0.0, refineDistance);
-            grid->setRank(rank);
-
-            if (porousTralingEdge)
-            {
-               int rank = grid->getRank();
-               grid->setRank(0);
-               boost::dynamic_pointer_cast<D3Q27TriFaceMeshInteractor>(fngIntrBodyPart)->refineBlockGridToLevel(refineLevel, 0.0, refineDistance);
-               grid->setRank(rank);
-            }
-            else
-            {
-               int rank = grid->getRank();
-               grid->setRank(0);
-               boost::dynamic_pointer_cast<D3Q27TriFaceMeshInteractor>(fngIntrWhole)->refineBlockGridToLevel(refineLevel, 0.0, refineDistance);
-               grid->setRank(rank);
-            }
-
-
-
-            ////////////////////////////////////////////
-            //METIS
-            //SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::BSW, MetisPartitioner::KWAY));
-            ////////////////////////////////////////////
-            /////delete solid blocks
-            if (myid == 0) UBLOG(logINFO, "deleteSolidBlocks - start");
-            //InteractorsHelper intHelper(grid, metisVisitor);
-            //if (porousTralingEdge)
-            //{
-            //   intHelper.addInteractor(fngIntrBodyPart);
-            //}
-            //else
-            //{
-            //   intHelper.addInteractor(fngIntrWhole);
-            //}
-            //////////////////////////////////////////////////////////////////////////
-            
-            //intHelper.selectBlocks();
-            
-            if (porousTralingEdge)
-            {
-               SetSolidBlockVisitor v(fngIntrBodyPart, BlockType::SOLID);
-               grid->accept(v);
-               std::vector<SPtr<Block3D>>& sb = fngIntrBodyPart->getSolidBlockSet();
-               for(SPtr<Block3D> block : sb)
-               {
-                  grid->deleteBlock(block);
-               }
-               fngIntrBodyPart->removeSolidBlocks();
-               fngIntrBodyPart->removeBcBlocks();
-            }
-            else
-            {
-               SetSolidBlockVisitor v(fngIntrWhole, BlockType::SOLID);
-               grid->accept(v);
-               std::vector<SPtr<Block3D>>& sb = fngIntrWhole->getSolidBlockSet();
-               for(SPtr<Block3D> block : sb)
-               {
-                  grid->deleteBlock(block);
-               }
-               fngIntrWhole->removeSolidBlocks();
-               fngIntrWhole->removeBcBlocks();
-            }
-
-            if (myid == 0) UBLOG(logINFO, "deleteSolidBlocks - end");
-            //////////////////////////////////////
-
-            if (porousTralingEdge)
-            {
-               grid->setRank(0);
-               boost::dynamic_pointer_cast<D3Q27TriFaceMeshInteractor>(fngIntrTrailingEdge)->refineBlockGridToLevel(refineLevel, -2.0, refineDistance);
-               grid->setRank(rank);
-
-               //SPtr<GbObject3D> trailingEdgeCube(new GbCuboid3D(fngMeshTrailingEdge->getX1Minimum()-blockLength, fngMeshTrailingEdge->getX2Minimum(), fngMeshTrailingEdge->getX3Minimum()-blockLength/2.0,
-               //   fngMeshTrailingEdge->getX1Maximum()+blockLength, fngMeshTrailingEdge->getX2Maximum(), fngMeshTrailingEdge->getX3Maximum()+blockLength/2.0));
-               //if (myid == 0) GbSystem3D::writeGeoObject(trailingEdgeCube.get(), pathOut + "/geo/trailingEdgeCube", WbWriterVtkXmlASCII::getInstance());
-
-               //RefineCrossAndInsideGbObjectBlockVisitor refVisitor(trailingEdgeCube, refineLevel);
-               //grid->accept(refVisitor);
-            }
-
-            RatioBlockVisitor ratioVisitor(refineLevel);
-            CheckRatioBlockVisitor checkRatio(refineLevel);
-            int count = 0;
-            
-            do {
-               grid->accept(ratioVisitor);
-               checkRatio.resetState();
-               grid->accept(checkRatio);
-               if (myid == 0) UBLOG(logINFO, "count ="<<count++<<" state="<<checkRatio.getState());
-            } while (!checkRatio.getState());
-
-            //RatioSmoothBlockVisitor ratioSmoothVisitor(refineLevel);
-            //grid->accept(ratioSmoothVisitor);
-
-            {
-               WriteBlocksSPtr<CoProcessor> ppblocks(new WriteBlocksCoProcessor(grid, SPtr<UbScheduler>(new UbScheduler(1)), pathOut, WbWriterVtkXmlBinary::getInstance(), comm));
-               ppblocks->process(0);
-               ppblocks.reset();
-            }
-
-            OverlapBlockVisitor overlapVisitor(refineLevel, false);
-            grid->accept(overlapVisitor);
-
-            //std::vector<int> dirs;
-            //for (int i = D3Q27System::E; i <= D3Q27System::TS; i++)
-            //{
-            //   dirs.push_back(i);
-            //}
-            //SetInterpolationDirsBlockVisitor interDirsVisitor(dirs);
-            //grid->accept(interDirsVisitor);
-
-            if (myid == 0) UBLOG(logINFO, "Refinement - end");
-         }
-
-         grid->updateDistributedBlocks(comm);
-
-
-         //return;
-
-         std::vector<int> dirs;
-         for (int i = D3Q27System::E; i<=D3Q27System::TS; i++)
-         {
-            dirs.push_back(i);
-         }
-         SetInterpolationDirsBlockVisitor interDirsVisitor(dirs);
-         grid->accept(interDirsVisitor);
-
-         //walls
-         GbCuboid3DPtr addWallZmin(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_minX3));
-         if (myid==0) GbSystem3D::writeGeoObject(addWallZmin.get(), pathOut+"/geo/addWallZmin", WbWriterVtkXmlASCII::getInstance());
-
-         GbCuboid3DPtr addWallZmax(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_maxX3, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength));
-         if (myid==0) GbSystem3D::writeGeoObject(addWallZmax.get(), pathOut+"/geo/addWallZmax", WbWriterVtkXmlASCII::getInstance());
-
-
-
-         //wall interactors
-         SPtr<D3Q27Interactor> addWallZminInt(new D3Q27Interactor(addWallZmin, grid, slipBCAdapter, Interactor3D::SOLID));
-         SPtr<D3Q27Interactor> addWallZmaxInt(new D3Q27Interactor(addWallZmax, grid, slipBCAdapter, Interactor3D::SOLID));
-         //SPtr<D3Q27Interactor> addWallZminInt(new D3Q27Interactor(addWallZmin, grid, noSlipBCAdapter, Interactor3D::SOLID));
-         //SPtr<D3Q27Interactor> addWallZmaxInt(new D3Q27Interactor(addWallZmax, grid, noSlipBCAdapter, Interactor3D::SOLID));
-
-         //inflow
-         GbCuboid3DPtr geoInflow(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3-blockLength, g_minX1, g_maxX2+blockLength, g_maxX3+blockLength));
-         if (myid==0) GbSystem3D::writeGeoObject(geoInflow.get(), pathOut+"/geo/geoInflow", WbWriterVtkXmlASCII::getInstance());
-
-         //outflow
-         GbCuboid3DPtr geoOutflow(new GbCuboid3D(g_maxX1, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength));
-         if (myid==0) GbSystem3D::writeGeoObject(geoOutflow.get(), pathOut+"/geo/geoOutflow", WbWriterVtkXmlASCII::getInstance());
-
-         //inflow
-         SPtr<D3Q27Interactor> inflowIntr = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoInflow, grid, velBCAdapter, Interactor3D::SOLID));
-
-         //outflow
-         SPtr<D3Q27Interactor> outflowIntr = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoOutflow, grid, denBCAdapter, Interactor3D::SOLID));
-
-         ////////////////////////////////////////////
-         //METIS
-         SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::BSW, MetisPartitioner::KWAY));
-         ////////////////////////////////////////////
-         /////delete solid blocks
-         if (myid == 0) UBLOG(logINFO, "deleteSolidBlocks - start");
-         InteractorsHelper intHelper(grid, metisVisitor);
-         intHelper.addInteractor(inflowIntr);
-         intHelper.addInteractor(outflowIntr);
-         intHelper.addInteractor(addWallZminInt);
-         intHelper.addInteractor(addWallZmaxInt);
-         //intHelper.addInteractor(triBand1Interactor);
-         //intHelper.addInteractor(triBand2Interactor);
-         //intHelper.addInteractor(triBand3Interactor);
-         //intHelper.addInteractor(triBand4Interactor);
-         
-         if (porousTralingEdge)
-         {
-            intHelper.addInteractor(fngIntrBodyPart);
-            //intHelper.addInteractor(fngIntrTrailingEdge);
-         } 
-         else
-         {
-            intHelper.addInteractor(fngIntrWhole);
-         }
-         
-         //////////////////////////////////////////////////////////////////////////
-         intHelper.selectBlocks();
-
-         if (myid == 0) UBLOG(logINFO, "deleteSolidBlocks - end");
-         //////////////////////////////////////
-
-         WriteBlocksSPtr<CoProcessor> ppblocks(new WriteBlocksCoProcessor(grid, SPtr<UbScheduler>(new UbScheduler(1)), pathOut, WbWriterVtkXmlBinary::getInstance(), comm));
-         ppblocks->process(1);
-         ppblocks.reset();
-
-         unsigned long long numberOfBlocks = (unsigned long long)grid->getNumberOfBlocks();
-         int ghostLayer = 3;
-         unsigned long long numberOfNodesPerBlock = (unsigned long long)(blockNx[0])* (unsigned long long)(blockNx[1])* (unsigned long long)(blockNx[2]);
-         unsigned long long numberOfNodes = numberOfBlocks * numberOfNodesPerBlock;
-         unsigned long long numberOfNodesPerBlockWithGhostLayer = numberOfBlocks * (blockNx[0] + ghostLayer) * (blockNx[1] + ghostLayer) * (blockNx[2] + ghostLayer);
-         double needMemAll = double(numberOfNodesPerBlockWithGhostLayer*(27 * sizeof(double) + sizeof(int) + sizeof(float) * 4));
-         double needMem = needMemAll / double(comm->getNumberOfProcesses());
-
-         if (myid == 0)
-         {
-            UBLOG(logINFO, "Number of blocks = " << numberOfBlocks);
-            UBLOG(logINFO, "Number of nodes  = " << numberOfNodes);
-            int minInitLevel = grid->getCoarsestInitializedLevel();
-            int maxInitLevel = grid->getFinestInitializedLevel();
-            for (int level = minInitLevel; level <= maxInitLevel; level++)
-            {
-               int nobl = grid->getNumberOfBlocks(level);
-               UBLOG(logINFO, "Number of blocks for level " << level << " = " << nobl);
-               UBLOG(logINFO, "Number of nodes for level " << level << " = " << nobl*numberOfNodesPerBlock);
-            }
-            UBLOG(logINFO, "Necessary memory  = " << needMemAll << " bytes");
-            UBLOG(logINFO, "Necessary memory per process = " << needMem << " bytes");
-            UBLOG(logINFO, "Available memory per process = " << availMem << " bytes");
-         }
-
-         SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new CompressibleCumulantLBMKernel(blockNx[0], blockNx[1], blockNx[2], CompressibleCumulantLBMKernel::NORMAL));
-         //SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new IncompressibleCumulantLBMKernel(blockNx[0], blockNx[1], blockNx[2], IncompressibleCumulantLBMKernel::NORMAL));
-
-         SPtr<BCProcessor> bcProc;
-
-         if (thinWall)
-         {
-            bcProc = SPtr<BCProcessor>(new ThinWallBCProcessor());
-         }
-         else
-         {
-            bcProc = SPtr<BCProcessor>(new BCProcessor());
-         }
-
-         kernel->setBCProcessor(bcProc);
-
-         SetKernelBlockVisitor kernelVisitor(kernel, nuLB, availMem, needMem);
-         grid->accept(kernelVisitor);
-
-         if (refineLevel > 0)
-         {
-            SetUndefinedNodesBlockVisitor undefNodesVisitor;
-            grid->accept(undefNodesVisitor);
-         }
-
-         //BC
-         intHelper.setBC();
-         
-         grid->accept(bcVisitor);
-
-         //initialization of distributions
-         mu::Parser inflowProfileVx1, inflowProfileVx2, inflowProfileVx3;
-         inflowProfileVx1.SetExpr("U*rangeRandom1()");
-         inflowProfileVx1.DefineConst("U", uLB);
-         inflowProfileVx1.DefineFun("rangeRandom1", rangeRandom1);
-         inflowProfileVx2.SetExpr("0.1*U*rangeRandom1()");
-         inflowProfileVx2.DefineConst("U", uLB);
-         inflowProfileVx2.DefineFun("rangeRandom1", rangeRandom1);
-         inflowProfileVx3.SetExpr("0.1*U*rangeRandom1()");
-         inflowProfileVx3.DefineConst("U", uLB);
-         inflowProfileVx3.DefineFun("rangeRandom1", rangeRandom1);
-         
-         InitDistributionsBlockVisitor initVisitor(nuLB, rhoLB);
-         //initVisitor.setVx1(fct);
-         //initVisitor.setVx1(inflowProfileVx1);
-         //initVisitor.setVx2(inflowProfileVx2);
-         //initVisitor.setVx3(inflowProfileVx3);
-         //initVisitor.setNu(nuLB);
-         grid->accept(initVisitor);
-
-         ////set connectors
-         InterpolationProcessorPtr iProcessor(new CompressibleOffsetInterpolationProcessor());
-         //InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor());
-         SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
-         grid->accept(setConnsVisitor);
-
-         //domain decomposition for threads
-         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
-         grid->accept(pqPartVisitor);
-
-         //Postrozess
-         SPtr<UbScheduler> geoSch(new UbScheduler(1));
-         WriteBoundaryConditionsSPtr<CoProcessor> ppgeo(
-            new WriteBoundaryConditionsCoProcessor(grid, geoSch, pathOut, WbWriterVtkXmlBinary::getInstance(), conv, comm));
-         ppgeo->process(0);
-         ppgeo.reset();
-
-         if (myid == 0) UBLOG(logINFO, "Preprozess - end");
-      }
-      else
-      {
-         InterpolationProcessorPtr iProcessor(new CompressibleOffsetInterpolationProcessor());
-         SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
-         grid->accept(setConnsVisitor);
-
-         //domain decomposition for threads
-         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
-         grid->accept(pqPartVisitor);
-
-         grid->accept(bcVisitor);
-      }
-
-      SPtr<UbScheduler> nupsSch(new UbScheduler(nupsStep[0], nupsStep[1], nupsStep[2]));
-      NUPSCounterCoProcessor npr(grid, nupsSch, numOfThreads, comm);
-
-      SPtr<UbScheduler> stepSch(new UbScheduler(outTime));
-
-      WriteMacroscopicQuantitiesCoProcessor pp(grid, stepSch, pathOut, WbWriterVtkXmlBinary::getInstance(), conv,comm);
-
-      if (myid == 0)
-      {
-         UBLOG(logINFO, "PID = " << myid << " Total Physical Memory (RAM): " << Utilities::getTotalPhysMem());
-         UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used: " << Utilities::getPhysMemUsed());
-         UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe());
-      }
-
-      const SPtr<ConcreteCalculatorFactory> calculatorFactory = std::make_shared<ConcreteCalculatorFactory>(stepSch);
-      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, calculatorFactory, CalculatorType::HYBRID));
-      //CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, stepSch, CalculationManager::PrePostBc));
-      //calculation->setTimeAveragedValuesCoProcessor(tav);
-      if (myid == 0) UBLOG(logINFO, "Simulation-start");
-      calculation->calculate();
-      if (myid == 0) UBLOG(logINFO, "Simulation-end");
-   }
-   catch (std::exception& e)
-   {
-      cerr << e.what() << endl << flush;
-   }
-   catch (std::string& s)
-   {
-      cerr << s << endl;
-   }
-   catch (...)
-   {
-      cerr << "unknown exception" << endl;
-   }
-
-}
-
-int main(int argc, char* argv[])
-{
-
-   if (argv != NULL)
-   {
-      if (argv[1] != NULL)
-      {
-         run(string(argv[1]));
-      }
-      else
-      {
-         cout << "Configuration file must be set!: " << argv[0] << " <config file>" << endl << std::flush;
-      }
-   }
-
-   return 0;
-}
-
+#include <iostream>
+#include <string>
+
+#include <boost/pointer_cast.hpp>
+
+#include "VirtualFluids.h"
+
+using namespace std;
+
+double rangeRandom1()
+{
+   return (2.0*rand())/RAND_MAX-1.0;
+}
+
+void run(string configname)
+{
+   try
+   {
+      ConfigurationFile   config;
+      config.load(configname);
+
+      string          pathOut = config.getString("pathOut");
+      string          pathGeo = config.getString("pathGeo");
+      string          fngFileWhole = config.getString("fngFileWhole");
+      string          fngFileTrailingEdge = config.getString("fngFileTrailingEdge");
+      string          fngFileBodyPart = config.getString("fngFileBodyPart");
+      string          zigZagTape = config.getString("zigZagTape");
+      int             numOfThreads = config.getInt("numOfThreads");
+      vector<int>     blockNx = config.getVector<int>("blockNx");
+      vector<double>  boundingBox = config.getVector<double>("boundingBox");
+      double          uLB = config.getDouble("uLB");
+      double          restartStep = config.getDouble("restartStep");
+      double          restartStepStart = config.getDouble("restartStepStart");
+      double          endTime = config.getDouble("endTime");
+      double          outTime = config.getDouble("outTime");
+      double          availMem = config.getDouble("availMem");
+      int             refineLevel = config.getInt("refineLevel");
+      bool            logToFile = config.getBool("logToFile");
+      bool            porousTralingEdge = config.getBool("porousTralingEdge");
+      double          deltaXfine = config.getDouble("deltaXfine")*1000.0;
+      bool            thinWall = config.getBool("thinWall");
+      double          refineDistance = config.getDouble("refineDistance");
+      vector<double>  nupsStep = config.getVector<double>("nupsStep");
+
+      SPtr<Communicator> comm = MPICommunicator::getInstance();
+      int myid = comm->getProcessID();
+
+      if (logToFile)
+      {
+#if defined(__unix__)
+         if (myid == 0)
+         {
+            const char* str = pathOut.c_str();
+            mkdir(str, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
+         }
+#endif 
+
+         if (myid == 0)
+         {
+            stringstream logFilename;
+            logFilename << pathOut + "/logfile" + UbSystem::toString(UbSystem::getTimeStamp()) + ".txt";
+            UbLog::output_policy::setStream(logFilename.str());
+         }
+      }
+
+      
+      double g_minX1 = boundingBox[0]*1000.0;
+      double g_minX2 = boundingBox[2]*1000.0;
+      double g_minX3 = boundingBox[4]*1000.0;
+
+      double g_maxX1 = boundingBox[1]*1000.0;
+      double g_maxX2 = boundingBox[3]*1000.0;
+      double g_maxX3 = boundingBox[5]*1000.0;
+       
+      //////////////////////////////////////////////////////////////////////////
+      double deltaXcoarse = deltaXfine*(double)(1 << refineLevel);
+      //double nx2_temp = floor((g_maxX2 - g_minX2) / (deltaXcoarse*(double)blockNx[0]));
+
+      //deltaXcoarse = (g_maxX2 - g_minX2) / (nx2_temp*(double)blockNx[0]);
+      //UBLOG(logINFO, "nx2_temp:"<<nx2_temp);
+      //g_maxX2 -= 0.5* deltaXcoarse;
+      //////////////////////////////////////////////////////////////////////////
+      double blockLength = (double)blockNx[0] * deltaXcoarse;
+
+      //##########################################################################
+      //## physical parameters
+      //##########################################################################
+      double Re = 1;//e6;
+
+      double rhoLB = 0.0;
+      double rhoReal = 1.2041; //(kg/m3)
+      double nueReal = 153.5e-7; //m^2/s
+
+      double lReal = 3.0;//m
+      double uReal = Re*nueReal / lReal;
+
+      //##Machzahl:
+      //#Ma     = uReal/csReal
+      double Ma = 0.15;//Ma-Real!
+      //double csReal = uReal / Ma;
+      //double hLB = lReal / deltaXcoarse;
+
+      //LBMUnitConverter unitConverter(lReal, csReal, rhoReal, hLB);
+
+      //double u_LB = uReal   * unitConverter.getFactorVelocityWToLb();
+      //double nu_LB = nueReal * unitConverter.getFactorViscosityWToLb();
+      double l_LB = 300 / deltaXcoarse;
+      double nuLB = (uLB*l_LB) / Re; //0.005;
+      //double nuLB = 0.005;
+
+      SPtr<LBMUnitConverter> conv = SPtr<LBMUnitConverter>(new LBMUnitConverter());
+
+      const int baseLevel = 0;
+
+      ////////////////////////////////////////////////////////////////////////
+      //Grid
+      //////////////////////////////////////////////////////////////////////////
+      SPtr<Grid3D> grid(new Grid3D(comm));
+      grid->setDeltaX(deltaXcoarse);
+      grid->setBlockNX(blockNx[0], blockNx[1], blockNx[2]);
+
+      SPtr<GbObject3D> gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
+      //gridCube->setCenterCoordinates(geo->getX1Centroid(), geo->getX2Centroid(), geo->getX3Centroid());
+      if (myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), pathOut + "/geo/gridCube", WbWriterVtkXmlASCII::getInstance());
+      GenBlocksGridVisitor genBlocks(gridCube);
+      grid->accept(genBlocks);
+
+      grid->setPeriodicX1(false);
+      grid->setPeriodicX2(true);
+      grid->setPeriodicX3(false);
+
+      //BC adapters
+      SPtr<BCAdapter> noSlipBCAdapter(new NoSlipBCAdapter());
+      if (thinWall)
+      {
+         noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new ThinWallNoSlipBCAlgorithm()));
+      }
+      else
+      {
+         noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NoSlipBCAlgorithm()));
+      }
+
+      SPtr<BCAdapter> slipBCAdapter(new SlipBCAdapter());
+      slipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new SlipBCAlgorithm()));
+
+      mu::Parser fct;
+      fct.SetExpr("U");
+      fct.DefineConst("U", uLB);
+      SPtr<BCAdapter> velBCAdapter(new VelocityBCAdapter(true, false, false, fct, 0, BCFunction::INFCONST));
+      velBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NonReflectingOutflowBCAlgorithm()));
+
+      SPtr<BCAdapter> denBCAdapter(new DensityBCAdapter(rhoLB));
+      denBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NonReflectingOutflowBCAlgorithm()));
+
+      BoundaryConditionsBlockVisitor bcVisitor;
+      bcVisitor.addBC(noSlipBCAdapter);
+      bcVisitor.addBC(slipBCAdapter);
+      bcVisitor.addBC(velBCAdapter);
+      bcVisitor.addBC(denBCAdapter);
+
+      //////////////////////////////////////////////////////////////////////////
+      //restart
+      SPtr<UbScheduler> rSch(new UbScheduler(restartStep, restartStep));
+      RestartCoProcessor rp(grid, rSch, comm, pathOut, RestartCoProcessor::TXT);
+      //////////////////////////////////////////////////////////////////////////
+
+
+      if (grid->getTimeStep() == 0)
+      {
+         if (myid == 0)
+         {
+            UBLOG(logINFO, "Parameters:");
+            UBLOG(logINFO, "* Re                  = "<<Re);
+            UBLOG(logINFO, "* Ma                  = "<<Ma);
+            UBLOG(logINFO, "* velocity (uReal)    = "<<uReal<<" m/s");
+            UBLOG(logINFO, "* viscosity (nuReal)  = "<<nueReal<<" m^2/s");
+            UBLOG(logINFO, "* velocity LB (uLB)   = "<<uLB);
+            UBLOG(logINFO, "* viscosity LB (nuLB) = "<<nuLB);
+            UBLOG(logINFO, "* dx_base             = "<<deltaXcoarse/1000.0<<" m");
+            UBLOG(logINFO, "* dx_refine           = "<<deltaXfine/1000.0<<" m");
+            UBLOG(logINFO, "* number of levels    = " << refineLevel + 1);
+            UBLOG(logINFO, "* number of threads   = " << numOfThreads);
+            UBLOG(logINFO, "* number of processes = " << comm->getNumberOfProcesses());
+            UBLOG(logINFO, "Preprozess - start");
+         }
+
+         SPtr<GbTriFaceMesh3D> fngMeshWhole;
+         SPtr<GbTriFaceMesh3D> fngMeshBodyPart;
+         SPtr<GbTriFaceMesh3D> fngMeshTrailingEdge;
+         if (porousTralingEdge)
+         {
+            if (myid==0) UBLOG(logINFO, "Read fngFileBodyPart:start");
+            fngMeshBodyPart = SPtr<GbTriFaceMesh3D>(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(pathGeo+"/"+fngFileBodyPart, "fngMeshBody", GbTriFaceMesh3D::KDTREE_SAHPLIT, false));
+            if (myid==0) UBLOG(logINFO, "Read fngFileBodyPart:end");
+            fngMeshBodyPart->rotate(0.0, 0.5, 0.0);
+            if (myid==0) GbSystem3D::writeGeoObject(fngMeshBodyPart.get(), pathOut+"/geo/fngMeshBody", WbWriterVtkXmlBinary::getInstance());
+
+            if (myid==0) UBLOG(logINFO, "Read fngFileTrailingEdge:start");
+            fngMeshTrailingEdge = SPtr<GbTriFaceMesh3D>(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(pathGeo+"/"+fngFileTrailingEdge, "fngMeshTrailingEdge", GbTriFaceMesh3D::KDTREE_SAHPLIT, false));
+            if (myid==0) UBLOG(logINFO, "Read fngFileTrailingEdge:end");
+            fngMeshTrailingEdge->rotate(0.0, 0.5, 0.0);
+            fngMeshTrailingEdge->translate(0,0,1.3);
+            if (myid==0) GbSystem3D::writeGeoObject(fngMeshTrailingEdge.get(), pathOut+"/geo/fngMeshTrailingEdge", WbWriterVtkXmlBinary::getInstance());
+         }
+         else
+         {
+            if (myid==0) UBLOG(logINFO, "Read fngFileWhole:start");
+            fngMeshWhole = SPtr<GbTriFaceMesh3D>(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(pathGeo+"/"+fngFileWhole, "fngMeshWhole", GbTriFaceMesh3D::KDTREE_SAHPLIT, false));
+            if (myid==0) UBLOG(logINFO, "Read fngFileWhole:end");
+            fngMeshWhole->rotate(0.0, 0.5, 0.0);
+            if (myid==0) GbSystem3D::writeGeoObject(fngMeshWhole.get(), pathOut+"/geo/fngMeshWhole", WbWriterVtkXmlBinary::getInstance());
+         }
+
+         //////////////////////////////////////////////////////////////////////////
+         // Zackenband
+         //////////////////////////////////////////////////////////////////////////
+         //top
+         //////////////////////////////////////////////////////////////////////////
+         //if (myid==0) UBLOG(logINFO, "Read zigZagTape:start");
+         //string ZckbndFilename = pathGeo+"/"+zigZagTape;
+         //SPtr<GbTriFaceMesh3D> meshBand1(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "zigZagTape1"));
+         //meshBand1->rotate(0.0, 5, 0.0);
+         //meshBand1->translate(15, 0, -12.850);
+         //if (myid==0) GbSystem3D::writeGeoObject(meshBand1.get(), pathOut+"/geo/zigZagTape1", WbWriterVtkXmlASCII::getInstance());
+         //// Zackenband2
+         //SPtr<GbTriFaceMesh3D> meshBand2(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "zigZagTape2"));
+         //meshBand2->rotate(0.0, 5, 0.0);
+         //meshBand2->translate(15, 5, -12.850);
+         //if (myid==0) GbSystem3D::writeGeoObject(meshBand2.get(), pathOut+"/geo/zigZagTape2", WbWriterVtkXmlASCII::getInstance());
+         ////// Zackenband3
+         ////SPtr<GbTriFaceMesh3D> meshBand3(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "zigZagTape3"));
+         ////meshBand3->rotate(0.0, 5, 0.0);
+         ////meshBand3->translate(15, 0, -12.35);
+         ////if (myid==0) GbSystem3D::writeGeoObject(meshBand3.get(), pathOut+"/geo/zigZagTape3", WbWriterVtkXmlASCII::getInstance());
+         ////// Zackenband4
+         ////SPtr<GbTriFaceMesh3D> meshBand4(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "zigZagTape4"));
+         ////meshBand4->rotate(0.0, 5, 0.0);
+         ////meshBand4->translate(15, 5, -12.35);
+         ////if (myid==0) GbSystem3D::writeGeoObject(meshBand4.get(), pathOut+"/geo/zigZagTape4", WbWriterVtkXmlASCII::getInstance());
+        
+         ////bottom
+         //SPtr<GbTriFaceMesh3D> meshBand5(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "zigZagTape5"));
+         //meshBand5->rotate(0.0, -1, 0.0);
+         //meshBand5->rotate(0.0, 0.0,180.0);
+         //meshBand5->translate(30, 0, -37.3);
+         //if (myid==0) GbSystem3D::writeGeoObject(meshBand5.get(), pathOut+"/geo/zigZagTape5", WbWriterVtkXmlASCII::getInstance());
+         //// Zackenband6
+         //SPtr<GbTriFaceMesh3D> meshBand6(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "zigZagTape6"));
+         //meshBand6->rotate(0.0, -1, 0.0);
+         //meshBand6->rotate(0.0, 0.0, 180.0);
+         //meshBand6->translate(30, 5, -37.3);
+         //if (myid==0) GbSystem3D::writeGeoObject(meshBand6.get(), pathOut+"/geo/zigZagTape6", WbWriterVtkXmlASCII::getInstance());
+         ////// Zackenband7
+         ////SPtr<GbTriFaceMesh3D> meshBand7(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "zigZagTape7"));
+         ////meshBand7->rotate(0.0, 5, 0.0);
+         ////meshBand7->translate(15, 0, -12.35);
+         ////if (myid==0) GbSystem3D::writeGeoObject(meshBand7.get(), pathOut+"/geo/zigZagTape7", WbWriterVtkXmlASCII::getInstance());
+         ////// Zackenband8
+         ////SPtr<GbTriFaceMesh3D> meshBan8(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "zigZagTape8"));
+         ////meshBan8->rotate(0.0, 5, 0.0);
+         ////meshBan8->translate(15, 5, -12.35);
+         ////if (myid==0) GbSystem3D::writeGeoObject(meshBan8.get(), pathOut+"/geo/zigZagTape8", WbWriterVtkXmlASCII::getInstance());
+         //if (myid==0) UBLOG(logINFO, "Read zigZagTape:end");
+
+         //////////////////////////////////////////////////////////////////////////
+
+         SPtr<Interactor3D> fngIntrWhole;
+         SPtr<Interactor3D> fngIntrBodyPart;
+         SPtr<Interactor3D> fngIntrTrailingEdge;
+         if (porousTralingEdge)
+         {
+            fngIntrBodyPart = SPtr<D3Q27TriFaceMeshInteractor>(new D3Q27TriFaceMeshInteractor(fngMeshBodyPart, grid, noSlipBCAdapter, Interactor3D::SOLID));
+            fngIntrTrailingEdge = SPtr<D3Q27TriFaceMeshInteractor>(new D3Q27TriFaceMeshInteractor(fngMeshTrailingEdge, grid, noSlipBCAdapter, Interactor3D::SOLID));
+         }
+         else
+         {
+            fngIntrWhole = SPtr<D3Q27TriFaceMeshInteractor>(new D3Q27TriFaceMeshInteractor(fngMeshWhole, grid, noSlipBCAdapter, Interactor3D::SOLID));//, Interactor3D::EDGES));
+         }
+
+         //SPtr<D3Q27TriFaceMeshInteractor> triBand1Interactor(new D3Q27TriFaceMeshInteractor(meshBand1, grid, noSlipBCAdapter, Interactor3D::SOLID));//, Interactor3D::EDGES));
+         //SPtr<D3Q27TriFaceMeshInteractor> triBand2Interactor(new D3Q27TriFaceMeshInteractor(meshBand2, grid, noSlipBCAdapter, Interactor3D::SOLID));//, Interactor3D::EDGES));
+         //SPtr<D3Q27TriFaceMeshInteractor> triBand3Interactor(new D3Q27TriFaceMeshInteractor(meshBand3, grid, noSlipBCAdapter, Interactor3D::SOLID));//, Interactor3D::EDGES));
+         //SPtr<D3Q27TriFaceMeshInteractor> triBand4Interactor(new D3Q27TriFaceMeshInteractor(meshBand4, grid, noSlipBCAdapter, Interactor3D::SOLID));//, Interactor3D::EDGES));
+
+
+
+         if (refineLevel > 0 && myid == 0)
+         {
+            if (myid == 0) UBLOG(logINFO, "Refinement - start");
+            //RefineCrossAndInsideGbObjectHelper refineHelper(grid, refineLevel);
+            //refineHelper.addGbObject(geo, refineLevel);
+            //refineHelper.refine();
+            
+            //RefineAroundGbObjectHelper refineHelper1(grid, refineLevel-1, boost::dynamic_pointer_cast<D3Q27TriFaceMeshInteractor>(geoIntr1), 0.0, 10.0, comm);
+            //refineHelper1.refine();
+            //RefineAroundGbObjectHelper refineHelper2(grid, refineLevel, boost::dynamic_pointer_cast<D3Q27TriFaceMeshInteractor>(geoIntr2), -1.0, 5.0, comm);
+            //refineHelper2.refine();
+            
+
+            int rank = grid->getRank();
+            grid->setRank(0);
+            //boost::dynamic_pointer_cast<D3Q27TriFaceMeshInteractor>(triBand1Interactor)->refineBlockGridToLevel(refineLevel, 0.0, refineDistance);
+            //boost::dynamic_pointer_cast<D3Q27TriFaceMeshInteractor>(triBand2Interactor)->refineBlockGridToLevel(refineLevel, 0.0, refineDistance);
+            //boost::dynamic_pointer_cast<D3Q27TriFaceMeshInteractor>(triBand3Interactor)->refineBlockGridToLevel(refineLevel, 0.0, refineDistance);
+            //boost::dynamic_pointer_cast<D3Q27TriFaceMeshInteractor>(triBand4Interactor)->refineBlockGridToLevel(refineLevel, 0.0, refineDistance);
+            grid->setRank(rank);
+
+            if (porousTralingEdge)
+            {
+               int rank = grid->getRank();
+               grid->setRank(0);
+               boost::dynamic_pointer_cast<D3Q27TriFaceMeshInteractor>(fngIntrBodyPart)->refineBlockGridToLevel(refineLevel, 0.0, refineDistance);
+               grid->setRank(rank);
+            }
+            else
+            {
+               int rank = grid->getRank();
+               grid->setRank(0);
+               boost::dynamic_pointer_cast<D3Q27TriFaceMeshInteractor>(fngIntrWhole)->refineBlockGridToLevel(refineLevel, 0.0, refineDistance);
+               grid->setRank(rank);
+            }
+
+
+
+            ////////////////////////////////////////////
+            //METIS
+            //SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::BSW, MetisPartitioner::KWAY));
+            ////////////////////////////////////////////
+            /////delete solid blocks
+            if (myid == 0) UBLOG(logINFO, "deleteSolidBlocks - start");
+            //InteractorsHelper intHelper(grid, metisVisitor);
+            //if (porousTralingEdge)
+            //{
+            //   intHelper.addInteractor(fngIntrBodyPart);
+            //}
+            //else
+            //{
+            //   intHelper.addInteractor(fngIntrWhole);
+            //}
+            //////////////////////////////////////////////////////////////////////////
+            
+            //intHelper.selectBlocks();
+            
+            if (porousTralingEdge)
+            {
+               SetSolidBlockVisitor v(fngIntrBodyPart, BlockType::SOLID);
+               grid->accept(v);
+               std::vector<SPtr<Block3D>>& sb = fngIntrBodyPart->getSolidBlockSet();
+               for(SPtr<Block3D> block : sb)
+               {
+                  grid->deleteBlock(block);
+               }
+               fngIntrBodyPart->removeSolidBlocks();
+               fngIntrBodyPart->removeBcBlocks();
+            }
+            else
+            {
+               SetSolidBlockVisitor v(fngIntrWhole, BlockType::SOLID);
+               grid->accept(v);
+               std::vector<SPtr<Block3D>>& sb = fngIntrWhole->getSolidBlockSet();
+               for(SPtr<Block3D> block : sb)
+               {
+                  grid->deleteBlock(block);
+               }
+               fngIntrWhole->removeSolidBlocks();
+               fngIntrWhole->removeBcBlocks();
+            }
+
+            if (myid == 0) UBLOG(logINFO, "deleteSolidBlocks - end");
+            //////////////////////////////////////
+
+            if (porousTralingEdge)
+            {
+               grid->setRank(0);
+               boost::dynamic_pointer_cast<D3Q27TriFaceMeshInteractor>(fngIntrTrailingEdge)->refineBlockGridToLevel(refineLevel, -2.0, refineDistance);
+               grid->setRank(rank);
+
+               //SPtr<GbObject3D> trailingEdgeCube(new GbCuboid3D(fngMeshTrailingEdge->getX1Minimum()-blockLength, fngMeshTrailingEdge->getX2Minimum(), fngMeshTrailingEdge->getX3Minimum()-blockLength/2.0,
+               //   fngMeshTrailingEdge->getX1Maximum()+blockLength, fngMeshTrailingEdge->getX2Maximum(), fngMeshTrailingEdge->getX3Maximum()+blockLength/2.0));
+               //if (myid == 0) GbSystem3D::writeGeoObject(trailingEdgeCube.get(), pathOut + "/geo/trailingEdgeCube", WbWriterVtkXmlASCII::getInstance());
+
+               //RefineCrossAndInsideGbObjectBlockVisitor refVisitor(trailingEdgeCube, refineLevel);
+               //grid->accept(refVisitor);
+            }
+
+            RatioBlockVisitor ratioVisitor(refineLevel);
+            CheckRatioBlockVisitor checkRatio(refineLevel);
+            int count = 0;
+            
+            do {
+               grid->accept(ratioVisitor);
+               checkRatio.resetState();
+               grid->accept(checkRatio);
+               if (myid == 0) UBLOG(logINFO, "count ="<<count++<<" state="<<checkRatio.getState());
+            } while (!checkRatio.getState());
+
+            //RatioSmoothBlockVisitor ratioSmoothVisitor(refineLevel);
+            //grid->accept(ratioSmoothVisitor);
+
+            {
+               WriteBlocksSPtr<CoProcessor> ppblocks(new WriteBlocksCoProcessor(grid, SPtr<UbScheduler>(new UbScheduler(1)), pathOut, WbWriterVtkXmlBinary::getInstance(), comm));
+               ppblocks->process(0);
+               ppblocks.reset();
+            }
+
+            OverlapBlockVisitor overlapVisitor(refineLevel, false);
+            grid->accept(overlapVisitor);
+
+            //std::vector<int> dirs;
+            //for (int i = D3Q27System::E; i <= D3Q27System::TS; i++)
+            //{
+            //   dirs.push_back(i);
+            //}
+            //SetInterpolationDirsBlockVisitor interDirsVisitor(dirs);
+            //grid->accept(interDirsVisitor);
+
+            if (myid == 0) UBLOG(logINFO, "Refinement - end");
+         }
+
+         grid->updateDistributedBlocks(comm);
+
+
+         //return;
+
+         std::vector<int> dirs;
+         for (int i = D3Q27System::E; i<=D3Q27System::TS; i++)
+         {
+            dirs.push_back(i);
+         }
+         SetInterpolationDirsBlockVisitor interDirsVisitor(dirs);
+         grid->accept(interDirsVisitor);
+
+         //walls
+         GbCuboid3DPtr addWallZmin(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_minX3));
+         if (myid==0) GbSystem3D::writeGeoObject(addWallZmin.get(), pathOut+"/geo/addWallZmin", WbWriterVtkXmlASCII::getInstance());
+
+         GbCuboid3DPtr addWallZmax(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_maxX3, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength));
+         if (myid==0) GbSystem3D::writeGeoObject(addWallZmax.get(), pathOut+"/geo/addWallZmax", WbWriterVtkXmlASCII::getInstance());
+
+
+
+         //wall interactors
+         SPtr<D3Q27Interactor> addWallZminInt(new D3Q27Interactor(addWallZmin, grid, slipBCAdapter, Interactor3D::SOLID));
+         SPtr<D3Q27Interactor> addWallZmaxInt(new D3Q27Interactor(addWallZmax, grid, slipBCAdapter, Interactor3D::SOLID));
+         //SPtr<D3Q27Interactor> addWallZminInt(new D3Q27Interactor(addWallZmin, grid, noSlipBCAdapter, Interactor3D::SOLID));
+         //SPtr<D3Q27Interactor> addWallZmaxInt(new D3Q27Interactor(addWallZmax, grid, noSlipBCAdapter, Interactor3D::SOLID));
+
+         //inflow
+         GbCuboid3DPtr geoInflow(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3-blockLength, g_minX1, g_maxX2+blockLength, g_maxX3+blockLength));
+         if (myid==0) GbSystem3D::writeGeoObject(geoInflow.get(), pathOut+"/geo/geoInflow", WbWriterVtkXmlASCII::getInstance());
+
+         //outflow
+         GbCuboid3DPtr geoOutflow(new GbCuboid3D(g_maxX1, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength));
+         if (myid==0) GbSystem3D::writeGeoObject(geoOutflow.get(), pathOut+"/geo/geoOutflow", WbWriterVtkXmlASCII::getInstance());
+
+         //inflow
+         SPtr<D3Q27Interactor> inflowIntr = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoInflow, grid, velBCAdapter, Interactor3D::SOLID));
+
+         //outflow
+         SPtr<D3Q27Interactor> outflowIntr = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoOutflow, grid, denBCAdapter, Interactor3D::SOLID));
+
+         ////////////////////////////////////////////
+         //METIS
+         SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::BSW, MetisPartitioner::KWAY));
+         ////////////////////////////////////////////
+         /////delete solid blocks
+         if (myid == 0) UBLOG(logINFO, "deleteSolidBlocks - start");
+         InteractorsHelper intHelper(grid, metisVisitor);
+         intHelper.addInteractor(inflowIntr);
+         intHelper.addInteractor(outflowIntr);
+         intHelper.addInteractor(addWallZminInt);
+         intHelper.addInteractor(addWallZmaxInt);
+         //intHelper.addInteractor(triBand1Interactor);
+         //intHelper.addInteractor(triBand2Interactor);
+         //intHelper.addInteractor(triBand3Interactor);
+         //intHelper.addInteractor(triBand4Interactor);
+         
+         if (porousTralingEdge)
+         {
+            intHelper.addInteractor(fngIntrBodyPart);
+            //intHelper.addInteractor(fngIntrTrailingEdge);
+         } 
+         else
+         {
+            intHelper.addInteractor(fngIntrWhole);
+         }
+         
+         //////////////////////////////////////////////////////////////////////////
+         intHelper.selectBlocks();
+
+         if (myid == 0) UBLOG(logINFO, "deleteSolidBlocks - end");
+         //////////////////////////////////////
+
+         WriteBlocksSPtr<CoProcessor> ppblocks(new WriteBlocksCoProcessor(grid, SPtr<UbScheduler>(new UbScheduler(1)), pathOut, WbWriterVtkXmlBinary::getInstance(), comm));
+         ppblocks->process(1);
+         ppblocks.reset();
+
+         unsigned long long numberOfBlocks = (unsigned long long)grid->getNumberOfBlocks();
+         int ghostLayer = 3;
+         unsigned long long numberOfNodesPerBlock = (unsigned long long)(blockNx[0])* (unsigned long long)(blockNx[1])* (unsigned long long)(blockNx[2]);
+         unsigned long long numberOfNodes = numberOfBlocks * numberOfNodesPerBlock;
+         unsigned long long numberOfNodesPerBlockWithGhostLayer = numberOfBlocks * (blockNx[0] + ghostLayer) * (blockNx[1] + ghostLayer) * (blockNx[2] + ghostLayer);
+         double needMemAll = double(numberOfNodesPerBlockWithGhostLayer*(27 * sizeof(double) + sizeof(int) + sizeof(float) * 4));
+         double needMem = needMemAll / double(comm->getNumberOfProcesses());
+
+         if (myid == 0)
+         {
+            UBLOG(logINFO, "Number of blocks = " << numberOfBlocks);
+            UBLOG(logINFO, "Number of nodes  = " << numberOfNodes);
+            int minInitLevel = grid->getCoarsestInitializedLevel();
+            int maxInitLevel = grid->getFinestInitializedLevel();
+            for (int level = minInitLevel; level <= maxInitLevel; level++)
+            {
+               int nobl = grid->getNumberOfBlocks(level);
+               UBLOG(logINFO, "Number of blocks for level " << level << " = " << nobl);
+               UBLOG(logINFO, "Number of nodes for level " << level << " = " << nobl*numberOfNodesPerBlock);
+            }
+            UBLOG(logINFO, "Necessary memory  = " << needMemAll << " bytes");
+            UBLOG(logINFO, "Necessary memory per process = " << needMem << " bytes");
+            UBLOG(logINFO, "Available memory per process = " << availMem << " bytes");
+         }
+
+         SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new CompressibleCumulantLBMKernel(blockNx[0], blockNx[1], blockNx[2], CompressibleCumulantLBMKernel::NORMAL));
+         //SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new IncompressibleCumulantLBMKernel(blockNx[0], blockNx[1], blockNx[2], IncompressibleCumulantLBMKernel::NORMAL));
+
+         SPtr<BCProcessor> bcProc;
+
+         if (thinWall)
+         {
+            bcProc = SPtr<BCProcessor>(new ThinWallBCProcessor());
+         }
+         else
+         {
+            bcProc = SPtr<BCProcessor>(new BCProcessor());
+         }
+
+         kernel->setBCProcessor(bcProc);
+
+         SetKernelBlockVisitor kernelVisitor(kernel, nuLB, availMem, needMem);
+         grid->accept(kernelVisitor);
+
+         if (refineLevel > 0)
+         {
+            SetUndefinedNodesBlockVisitor undefNodesVisitor;
+            grid->accept(undefNodesVisitor);
+         }
+
+         //BC
+         intHelper.setBC();
+         
+         grid->accept(bcVisitor);
+
+         //initialization of distributions
+         mu::Parser inflowProfileVx1, inflowProfileVx2, inflowProfileVx3;
+         inflowProfileVx1.SetExpr("U*rangeRandom1()");
+         inflowProfileVx1.DefineConst("U", uLB);
+         inflowProfileVx1.DefineFun("rangeRandom1", rangeRandom1);
+         inflowProfileVx2.SetExpr("0.1*U*rangeRandom1()");
+         inflowProfileVx2.DefineConst("U", uLB);
+         inflowProfileVx2.DefineFun("rangeRandom1", rangeRandom1);
+         inflowProfileVx3.SetExpr("0.1*U*rangeRandom1()");
+         inflowProfileVx3.DefineConst("U", uLB);
+         inflowProfileVx3.DefineFun("rangeRandom1", rangeRandom1);
+         
+         InitDistributionsBlockVisitor initVisitor(nuLB, rhoLB);
+         //initVisitor.setVx1(fct);
+         //initVisitor.setVx1(inflowProfileVx1);
+         //initVisitor.setVx2(inflowProfileVx2);
+         //initVisitor.setVx3(inflowProfileVx3);
+         //initVisitor.setNu(nuLB);
+         grid->accept(initVisitor);
+
+         ////set connectors
+         InterpolationProcessorPtr iProcessor(new CompressibleOffsetInterpolationProcessor());
+         //InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor());
+         SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
+         grid->accept(setConnsVisitor);
+
+         //domain decomposition for threads
+         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
+         grid->accept(pqPartVisitor);
+
+         //Postrozess
+         SPtr<UbScheduler> geoSch(new UbScheduler(1));
+         WriteBoundaryConditionsSPtr<CoProcessor> ppgeo(
+            new WriteBoundaryConditionsCoProcessor(grid, geoSch, pathOut, WbWriterVtkXmlBinary::getInstance(), conv, comm));
+         ppgeo->process(0);
+         ppgeo.reset();
+
+         if (myid == 0) UBLOG(logINFO, "Preprozess - end");
+      }
+      else
+      {
+         InterpolationProcessorPtr iProcessor(new CompressibleOffsetInterpolationProcessor());
+         SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
+         grid->accept(setConnsVisitor);
+
+         //domain decomposition for threads
+         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
+         grid->accept(pqPartVisitor);
+
+         grid->accept(bcVisitor);
+      }
+
+      SPtr<UbScheduler> nupsSch(new UbScheduler(nupsStep[0], nupsStep[1], nupsStep[2]));
+      NUPSCounterCoProcessor npr(grid, nupsSch, numOfThreads, comm);
+
+      SPtr<UbScheduler> stepSch(new UbScheduler(outTime));
+
+      WriteMacroscopicQuantitiesCoProcessor pp(grid, stepSch, pathOut, WbWriterVtkXmlBinary::getInstance(), conv,comm);
+
+      if (myid == 0)
+      {
+         UBLOG(logINFO, "PID = " << myid << " Total Physical Memory (RAM): " << Utilities::getTotalPhysMem());
+         UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used: " << Utilities::getPhysMemUsed());
+         UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe());
+      }
+
+      const SPtr<ConcreteCalculatorFactory> calculatorFactory = std::make_shared<ConcreteCalculatorFactory>(stepSch);
+      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, calculatorFactory, CalculatorType::HYBRID));
+      //CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, stepSch, CalculationManager::PrePostBc));
+      //calculation->setTimeAveragedValuesCoProcessor(tav);
+      if (myid == 0) UBLOG(logINFO, "Simulation-start");
+      calculation->calculate();
+      if (myid == 0) UBLOG(logINFO, "Simulation-end");
+   }
+   catch (std::exception& e)
+   {
+      cerr << e.what() << endl << flush;
+   }
+   catch (std::string& s)
+   {
+      cerr << s << endl;
+   }
+   catch (...)
+   {
+      cerr << "unknown exception" << endl;
+   }
+
+}
+
+int main(int argc, char* argv[])
+{
+
+   if (argv != NULL)
+   {
+      if (argv[1] != NULL)
+      {
+         run(string(argv[1]));
+      }
+      else
+      {
+         cout << "Configuration file must be set!: " << argv[0] << " <config file>" << endl << std::flush;
+      }
+   }
+
+   return 0;
+}
+
diff --git a/apps/cpu/fetol_demo/CMakeLists.txt b/apps/cpu/fetol_demo/CMakeLists.txt
index 878ba5dceb5e2f800426c374f745b138aaf8dc04..c0c5a123ce7efead3757eac4c52af02ea26cb4f3 100644
--- a/apps/cpu/fetol_demo/CMakeLists.txt
+++ b/apps/cpu/fetol_demo/CMakeLists.txt
@@ -1,25 +1,25 @@
-CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
-
-########################################################
-## C++ PROJECT                                       ###
-########################################################
-PROJECT(fetol_demo)
-
-INCLUDE(${SOURCE_ROOT}/lib/IncludsList.txt) 
-
-#################################################################
-###   LOCAL FILES                                             ###
-#################################################################
-FILE(GLOB SPECIFIC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.h
-                         ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
-                         ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp  )
- 
-SET(ALL_SOURCES ${ALL_SOURCES} ${SPECIFIC_FILES})
-SOURCE_GROUP(src FILES ${SPECIFIC_FILES})
-  
-SET(CAB_ADDITIONAL_LINK_LIBRARIES vfluids ${FETOL_RELEASE_LIBRARY})
-
-#################################################################
-###   CREATE PROJECT                                          ###
-#################################################################
-CREATE_CAB_PROJECT(fetol_demo BINARY)
+CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
+
+########################################################
+## C++ PROJECT                                       ###
+########################################################
+PROJECT(fetol_demo)
+
+INCLUDE(${SOURCE_ROOT}/lib/IncludsList.txt) 
+
+#################################################################
+###   LOCAL FILES                                             ###
+#################################################################
+FILE(GLOB SPECIFIC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.h
+                         ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
+                         ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp  )
+ 
+SET(ALL_SOURCES ${ALL_SOURCES} ${SPECIFIC_FILES})
+SOURCE_GROUP(src FILES ${SPECIFIC_FILES})
+  
+SET(CAB_ADDITIONAL_LINK_LIBRARIES vfluids ${FETOL_RELEASE_LIBRARY})
+
+#################################################################
+###   CREATE PROJECT                                          ###
+#################################################################
+CREATE_CAB_PROJECT(fetol_demo BINARY)
diff --git a/apps/cpu/fetol_demo/fetol_demo.cpp b/apps/cpu/fetol_demo/fetol_demo.cpp
index b3a103805a3a2a0e02deb45d5c768c833002bcf4..a4cf176cdd8f12dc005c405ac4a067d7aecdce7d 100644
--- a/apps/cpu/fetol_demo/fetol_demo.cpp
+++ b/apps/cpu/fetol_demo/fetol_demo.cpp
@@ -1,306 +1,306 @@
-#include <vfluids.h>
-
-#include <fbond.h>
-#include <Version.h>
-
-#include <JM.h>
-
-using namespace std;
-
-using namespace fetol;
-
-////////////////////////////////////////////////////////////////////////
-void chanel(const char *cstr)
-{
-   try
-   {
-      string machine = QUOTEME(CAB_MACHINE);
-      string pathname; 
-      int numOfThreads = 1;
-      double availMem = 0;
-
-      UBLOG(logINFO,"Communicator-init::strat");
-      CommunicatorPtr comm = FETOLCommunicator::getInstance();
-      UBLOG(logINFO,"Communicator-init::end");
-
-      int myid = comm->getProcessID();
-      int mybundle = comm->getBundleID();
-      int root = comm->getRoot();
-      int myrank = boost::dynamic_pointer_cast<FETOLCommunicator>(comm)->getMPIRank();
-
-      UBLOG(logINFO,"myid = " << myid );
-      UBLOG(logINFO,"mybundle = " << mybundle );
-      UBLOG(logINFO,"myrank = " << myrank );
-
-      JM::init(mybundle, myrank);
-
-      //UbLog::reportingLevel() = logDEBUG5;
-
-      if(machine == "BOMBADIL") 
-      {
-         pathname = "d:/temp/fetol_demo";
-         availMem = 3.0e9;
-      }
-      else if(machine == "M01" || machine == "M02")      
-      {
-         //pathname = "/work/koskuche/scratch/fetol_demo";
-
-         pathname = string(cstr);
-         availMem = 1.5e9;
-
-        if(myid==root && mybundle==root)
-         {
-            stringstream logFilename;
-            logFilename <<  pathname + "/log/logfile"+UbSystem::toString(UbSystem::getTimeStamp())+"_"+UbSystem::toString(myid)+".txt";
-            UbLog::output_policy::setStream(logFilename.str());
-         }
-      }
-      else throw UbException(UB_EXARGS, "unknown CAB_MACHINE");
-
-      LBMUnitConverterPtr conv = LBMUnitConverterPtr(new LBMUnitConverter());
-
-      double dx = 1;
-
-      const int blocknx1 = 40;
-      const int blocknx2 = 40;
-      const int blocknx3 = 40;
-
-      const int gridNx1 = 4;
-      const int gridNx2 = 2;
-      const int gridNx3 = 2;
-
-      double L1 = gridNx1*blocknx1;
-      double L2, L3, H;
-      L2 = H = gridNx2*blocknx1;
-      L3 = gridNx3*blocknx1;
-
-      LBMReal radius = 7;
-      LBMReal uLB = 0.1;
-      LBMReal Re = 3000.0;
-      LBMReal rhoLB = 0.0;
-      LBMReal l = L2 / dx;
-      LBMReal nueLB = (uLB*2.0*radius)/Re;
-
-      Grid3DPtr grid(new Grid3D(comm));
-      grid->setDeltaX(dx);
-      grid->setBlockNX(blocknx1, blocknx2, blocknx3);
-
-      //UBLOG(logINFO,"Restart:start");
-      UbSchedulerPtr restartSch(new UbScheduler(1000, 1000, 100000));
-      RestartPostprocessor rp(grid, restartSch, comm, pathname+"/checkpoints", RestartPostprocessor::BINARY);
-      grid = rp.restart(-1);
-      //UBLOG(logINFO,"Restart:end");
-
-      if (grid->getTimeStep() == 0)
-      {
-
-         const int baseLevel = 0;
-         const int refineLevel = 0;
-
-         //obstacle
-         GbObject3DPtr sphere(new GbSphere3D(L1/4.0, L2*0.5, L3*0.5, radius));
-         GbSystem3D::writeGeoObject(sphere.get(),pathname + "/geo/sphere", WbWriterVtkXmlBinary::getInstance());
-
-         D3Q27InteractorPtr sphereInt;
-
-         //bounding box
-         double d_minX1 = 0.0;
-         double d_minX2 = 0.0;
-         double d_minX3 = 0.0;
-
-         double d_maxX1 = L1;
-         double d_maxX2 = L2;
-         double d_maxX3 = L3;
-
-         double blockLength = blocknx1*dx;
-
-         GbObject3DPtr gridCube(new GbCuboid3D(d_minX1, d_minX2, d_minX3, d_maxX1, d_maxX2, d_maxX3));
-         if(myid ==0) GbSystem3D::writeGeoObject(gridCube.get(),pathname + "/geo/gridCube", WbWriterVtkXmlBinary::getInstance()); 
-
-         GenBlocksGridVisitor genBlocks(gridCube);
-         grid->accept(genBlocks);
-
-         if(myid ==0)
-         {
-            UBLOG(logINFO,"Parameters:");
-            UBLOG(logINFO,"L = " << L2/dx );
-            UBLOG(logINFO,"v = " << uLB );
-            UBLOG(logINFO,"rho = " << rhoLB );
-            UBLOG(logINFO,"nue = " << nueLB );
-            UBLOG(logINFO,"Re = " << Re );
-            UBLOG(logINFO,"dx = " << dx );
-            UBLOG(logINFO,"number of levels = " << refineLevel+1 );
-            UBLOG(logINFO,"numOfThreads = " << numOfThreads );
-            UBLOG(logINFO,"Preprozess - start");
-         }
-
-         //walls
-         GbCuboid3DPtr addWallYmin (new GbCuboid3D(d_minX1-4.0*blockLength, d_minX2-4.0*blockLength, d_minX3-4.0*blockLength, d_maxX1+4.0*blockLength, d_minX2, d_maxX3+4.0*blockLength));
-         if(myid == 0) GbSystem3D::writeGeoObject(addWallYmin.get(), pathname+"/geo/addWallYmin", WbWriterVtkXmlASCII::getInstance());
-
-         GbCuboid3DPtr addWallZmin (new GbCuboid3D(d_minX1-4.0*blockLength, d_minX2-4.0*blockLength, d_minX3-4.0*blockLength, d_maxX1+4.0*blockLength, d_maxX2+4.0*blockLength, d_minX3));
-         if(myid == 0) GbSystem3D::writeGeoObject(addWallZmin.get(), pathname+"/geo/addWallZmin", WbWriterVtkXmlASCII::getInstance());
-
-         GbCuboid3DPtr addWallYmax (new GbCuboid3D(d_minX1-4.0*blockLength, d_maxX2, d_minX3-4.0*blockLength, d_maxX1+4.0*blockLength, d_maxX2+4.0*blockLength, d_maxX3+4.0*blockLength));
-         if(myid == 0) GbSystem3D::writeGeoObject(addWallYmax.get(), pathname+"/geo/addWallYmax", WbWriterVtkXmlASCII::getInstance());
-
-         GbCuboid3DPtr addWallZmax (new GbCuboid3D(d_minX1-4.0*blockLength, d_minX2-4.0*blockLength, d_maxX3, d_maxX1+4.0*blockLength, d_maxX2+4.0*blockLength, d_maxX3+4.0*blockLength));
-         if(myid == 0) GbSystem3D::writeGeoObject(addWallZmax.get(), pathname+"/geo/addWallZmax", WbWriterVtkXmlASCII::getInstance());
-
-         //inflow
-         GbCuboid3DPtr geoInflow (new GbCuboid3D(d_minX1-4.0*blockLength, d_minX2-4.0*blockLength, d_minX3-4.0*blockLength, d_minX1, d_maxX2+4.0*blockLength, d_maxX3+4.0*blockLength));
-         if(myid == 0) GbSystem3D::writeGeoObject(geoInflow.get(), pathname+"/geo/geoInflow", WbWriterVtkXmlASCII::getInstance());
-
-         //outflow
-         GbCuboid3DPtr geoOutflow (new GbCuboid3D(d_maxX1, d_minX2-4.0*blockLength, d_minX3-4.0*blockLength, d_maxX1+4.0*blockLength, d_maxX2+4.0*blockLength, d_maxX3+4.0*blockLength));
-         if(myid == 0) GbSystem3D::writeGeoObject(geoOutflow.get(), pathname+"/geo/geoOutflow", WbWriterVtkXmlASCII::getInstance());
-
-         BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname + "/grid/blocks", WbWriterVtkXmlBinary::getInstance(), comm));
-
-         //sphere
-         int bbOption = 1; //0=simple Bounce Back, 1=quadr. BB
-         D3Q27BoundaryConditionAdapterPtr bcObst(new D3Q27NoSlipBCAdapter(bbOption));
-         sphereInt = D3Q27InteractorPtr ( new D3Q27Interactor(sphere, grid, bcObst,Interactor3D::SOLID));
-
-         //walls
-         D3Q27InteractorPtr addWallYminInt(new D3Q27Interactor(addWallYmin, grid, bcObst,Interactor3D::SOLID));
-         D3Q27InteractorPtr addWallZminInt(new D3Q27Interactor(addWallZmin, grid, bcObst,Interactor3D::SOLID));
-         D3Q27InteractorPtr addWallYmaxInt(new D3Q27Interactor(addWallYmax, grid, bcObst,Interactor3D::SOLID));
-         D3Q27InteractorPtr addWallZmaxInt(new D3Q27Interactor(addWallZmax, grid, bcObst,Interactor3D::SOLID));
-
-         mu::Parser fct;
-         fct.SetExpr("16*U*x2*x3*(H-x2)*(H-x3)/H^4");
-         fct.DefineConst("U", uLB);
-         fct.DefineConst("H", H);
-
-         //inflow
-         D3Q27BoundaryConditionAdapterPtr velBCAdapter(new D3Q27VelocityBCAdapter (true, false ,false ,fct, 0, D3Q27BCFunction::INFCONST));
-         velBCAdapter->setSecondaryBcOption(2);
-         D3Q27InteractorPtr inflowInt  = D3Q27InteractorPtr( new D3Q27Interactor(geoInflow, grid, velBCAdapter, Interactor3D::SOLID));
-
-         //outflow
-         D3Q27BoundaryConditionAdapterPtr denBCAdapter(new D3Q27DensityBCAdapter(rhoLB));
-         D3Q27InteractorPtr outflowInt = D3Q27InteractorPtr( new D3Q27Interactor(geoOutflow, grid, denBCAdapter,Interactor3D::SOLID));
-
-         Grid3DVisitorPtr metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B));
-         InteractorsHelper intHelper(grid, metisVisitor);
-         intHelper.addInteractor(sphereInt);
-         intHelper.addInteractor(addWallYminInt);
-         intHelper.addInteractor(addWallZminInt);
-         intHelper.addInteractor(addWallYmaxInt);
-         intHelper.addInteractor(addWallZmaxInt);
-         intHelper.addInteractor(inflowInt);
-         intHelper.addInteractor(outflowInt);
-         intHelper.selectBlocks();
-
-         ppblocks->update(0);
-         ppblocks.reset();
-
-         //set connectors
-         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27OffsetInterpolationProcessor());
-         FETOLSetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
-         grid->accept( setConnsVisitor );
-
-         unsigned long nob = grid->getNumberOfBlocks();
-         int gl = 3;
-         unsigned long nod = nob * (blocknx1+gl) * (blocknx2+gl) * (blocknx3+gl);
-
-         double needMemAll  = double(nod*(27*sizeof(double) + sizeof(int) + sizeof(float)*4));
-         double needMem  = needMemAll / double(comm->getNumberOfProcesses());
-
-         if(myid == 0)
-         {
-            UBLOG(logINFO,"Number of blocks = " << nob);
-            UBLOG(logINFO,"Number of nodes  = " << nod);
-            UBLOG(logINFO,"Necessary memory  = " << needMemAll  << " bytes");
-            UBLOG(logINFO,"Necessary memory per process = " << needMem  << " bytes");
-            UBLOG(logINFO,"Available memory per process = " << availMem << " bytes");
-         }            
-
-         LBMKernel3DPtr kernel(new LBMKernelETD3Q27CCLB(blocknx1, blocknx2, blocknx3, LBMKernelETD3Q27CCLB::NORMAL));
-
-         BCProcessorPtr bcProc(new D3Q27ETBCProcessor());
-         kernel->setBCProcessor(bcProc);
-
-         SetKernelBlockVisitor kernelVisitor(kernel, nueLB, availMem, needMem);
-         grid->accept(kernelVisitor);
-
-         intHelper.setBC();
-
-         //initialization of distributions
-         D3Q27ETInitDistributionsBlockVisitor initVisitor(nueLB, rhoLB);
-         initVisitor.setVx1(fct);
-         grid->accept(initVisitor);
-
-         //Postrozess
-         UbSchedulerPtr geoSch(new UbScheduler(1));
-         D3Q27MacroscopicQuantitiesPostprocessorPtr ppgeo(
-            new D3Q27MacroscopicQuantitiesPostprocessor(grid, geoSch, pathname + "/grid/nodes", WbWriterVtkXmlBinary::getInstance(), conv, true));
-         ppgeo->update(0);
-         ppgeo.reset();
-
-         if(myid == 0) UBLOG(logINFO,"Preprozess - end"); 
-      }
-      else
-      {
-         UBLOG(logINFO,"SetConnectors - start, id="<<myid);
-
-         //set connectors
-         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27OffsetInterpolationProcessor());
-         FETOLSetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
-         grid->accept( setConnsVisitor );
-         
-         UBLOG(logINFO,"SetConnectors - end, id="<<myid); 
-      }
-
-      UbSchedulerPtr stepSch(new UbScheduler());
-      stepSch->addSchedule(1000, 0, 1000000);
-      D3Q27MacroscopicQuantitiesPostprocessor pp(grid, stepSch, pathname + "/steps/step", WbWriterVtkXmlBinary::getInstance(), conv);
-
-      //UbSchedulerPtr nupsSch(new UbScheduler(10, 30, 100));
-      //NUPSCounterPostprocessor npr(grid, nupsSch, pathname + "/results/nups.txt", comm);
-
-      double endTime = 100000;
-      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, stepSch, CalculationManager::FETOL));
-      
-      if(myid == 0) 
-         UBLOG(logINFO,"Simulation-start");
-      
-      calculation->calculate();
-      
-      if(myid == 0) 
-         UBLOG(logINFO,"Simulation-end");
-
-      JM::finalize();
-   }
-   catch(std::exception& e)
-   {
-      cerr << e.what() << endl << flush;
-   }
-   catch(std::string& s)
-   {
-      cerr << s << endl;
-   }
-   catch(...)
-   {
-      cerr << "unknown exception" << endl;
-   }
-
-}
-
-//////////////////////////////////////////////////////////////////////////
-int main(int argc, char* argv[])
-{
-   if ( argv != NULL )
-   {
-      if (argc > 1)
-      {
-         chanel(argv[1]);
-      }
-      else
-      {
-         cout << "Configuration file must be set!: " <<  argv[0] << " <config file>" << endl << std::flush;
-      }
-   }
-}
-
+#include <vfluids.h>
+
+#include <fbond.h>
+#include <Version.h>
+
+#include <JM.h>
+
+using namespace std;
+
+using namespace fetol;
+
+////////////////////////////////////////////////////////////////////////
+void chanel(const char *cstr)
+{
+   try
+   {
+      string machine = QUOTEME(CAB_MACHINE);
+      string pathname; 
+      int numOfThreads = 1;
+      double availMem = 0;
+
+      UBLOG(logINFO,"Communicator-init::strat");
+      CommunicatorPtr comm = FETOLCommunicator::getInstance();
+      UBLOG(logINFO,"Communicator-init::end");
+
+      int myid = comm->getProcessID();
+      int mybundle = comm->getBundleID();
+      int root = comm->getRoot();
+      int myrank = boost::dynamic_pointer_cast<FETOLCommunicator>(comm)->getMPIRank();
+
+      UBLOG(logINFO,"myid = " << myid );
+      UBLOG(logINFO,"mybundle = " << mybundle );
+      UBLOG(logINFO,"myrank = " << myrank );
+
+      JM::init(mybundle, myrank);
+
+      //UbLog::reportingLevel() = logDEBUG5;
+
+      if(machine == "BOMBADIL") 
+      {
+         pathname = "d:/temp/fetol_demo";
+         availMem = 3.0e9;
+      }
+      else if(machine == "M01" || machine == "M02")      
+      {
+         //pathname = "/work/koskuche/scratch/fetol_demo";
+
+         pathname = string(cstr);
+         availMem = 1.5e9;
+
+        if(myid==root && mybundle==root)
+         {
+            stringstream logFilename;
+            logFilename <<  pathname + "/log/logfile"+UbSystem::toString(UbSystem::getTimeStamp())+"_"+UbSystem::toString(myid)+".txt";
+            UbLog::output_policy::setStream(logFilename.str());
+         }
+      }
+      else throw UbException(UB_EXARGS, "unknown CAB_MACHINE");
+
+      LBMUnitConverterPtr conv = LBMUnitConverterPtr(new LBMUnitConverter());
+
+      double dx = 1;
+
+      const int blocknx1 = 40;
+      const int blocknx2 = 40;
+      const int blocknx3 = 40;
+
+      const int gridNx1 = 4;
+      const int gridNx2 = 2;
+      const int gridNx3 = 2;
+
+      double L1 = gridNx1*blocknx1;
+      double L2, L3, H;
+      L2 = H = gridNx2*blocknx1;
+      L3 = gridNx3*blocknx1;
+
+      LBMReal radius = 7;
+      LBMReal uLB = 0.1;
+      LBMReal Re = 3000.0;
+      LBMReal rhoLB = 0.0;
+      LBMReal l = L2 / dx;
+      LBMReal nueLB = (uLB*2.0*radius)/Re;
+
+      Grid3DPtr grid(new Grid3D(comm));
+      grid->setDeltaX(dx);
+      grid->setBlockNX(blocknx1, blocknx2, blocknx3);
+
+      //UBLOG(logINFO,"Restart:start");
+      UbSchedulerPtr restartSch(new UbScheduler(1000, 1000, 100000));
+      RestartPostprocessor rp(grid, restartSch, comm, pathname+"/checkpoints", RestartPostprocessor::BINARY);
+      grid = rp.restart(-1);
+      //UBLOG(logINFO,"Restart:end");
+
+      if (grid->getTimeStep() == 0)
+      {
+
+         const int baseLevel = 0;
+         const int refineLevel = 0;
+
+         //obstacle
+         GbObject3DPtr sphere(new GbSphere3D(L1/4.0, L2*0.5, L3*0.5, radius));
+         GbSystem3D::writeGeoObject(sphere.get(),pathname + "/geo/sphere", WbWriterVtkXmlBinary::getInstance());
+
+         D3Q27InteractorPtr sphereInt;
+
+         //bounding box
+         double d_minX1 = 0.0;
+         double d_minX2 = 0.0;
+         double d_minX3 = 0.0;
+
+         double d_maxX1 = L1;
+         double d_maxX2 = L2;
+         double d_maxX3 = L3;
+
+         double blockLength = blocknx1*dx;
+
+         GbObject3DPtr gridCube(new GbCuboid3D(d_minX1, d_minX2, d_minX3, d_maxX1, d_maxX2, d_maxX3));
+         if(myid ==0) GbSystem3D::writeGeoObject(gridCube.get(),pathname + "/geo/gridCube", WbWriterVtkXmlBinary::getInstance()); 
+
+         GenBlocksGridVisitor genBlocks(gridCube);
+         grid->accept(genBlocks);
+
+         if(myid ==0)
+         {
+            UBLOG(logINFO,"Parameters:");
+            UBLOG(logINFO,"L = " << L2/dx );
+            UBLOG(logINFO,"v = " << uLB );
+            UBLOG(logINFO,"rho = " << rhoLB );
+            UBLOG(logINFO,"nue = " << nueLB );
+            UBLOG(logINFO,"Re = " << Re );
+            UBLOG(logINFO,"dx = " << dx );
+            UBLOG(logINFO,"number of levels = " << refineLevel+1 );
+            UBLOG(logINFO,"numOfThreads = " << numOfThreads );
+            UBLOG(logINFO,"Preprozess - start");
+         }
+
+         //walls
+         GbCuboid3DPtr addWallYmin (new GbCuboid3D(d_minX1-4.0*blockLength, d_minX2-4.0*blockLength, d_minX3-4.0*blockLength, d_maxX1+4.0*blockLength, d_minX2, d_maxX3+4.0*blockLength));
+         if(myid == 0) GbSystem3D::writeGeoObject(addWallYmin.get(), pathname+"/geo/addWallYmin", WbWriterVtkXmlASCII::getInstance());
+
+         GbCuboid3DPtr addWallZmin (new GbCuboid3D(d_minX1-4.0*blockLength, d_minX2-4.0*blockLength, d_minX3-4.0*blockLength, d_maxX1+4.0*blockLength, d_maxX2+4.0*blockLength, d_minX3));
+         if(myid == 0) GbSystem3D::writeGeoObject(addWallZmin.get(), pathname+"/geo/addWallZmin", WbWriterVtkXmlASCII::getInstance());
+
+         GbCuboid3DPtr addWallYmax (new GbCuboid3D(d_minX1-4.0*blockLength, d_maxX2, d_minX3-4.0*blockLength, d_maxX1+4.0*blockLength, d_maxX2+4.0*blockLength, d_maxX3+4.0*blockLength));
+         if(myid == 0) GbSystem3D::writeGeoObject(addWallYmax.get(), pathname+"/geo/addWallYmax", WbWriterVtkXmlASCII::getInstance());
+
+         GbCuboid3DPtr addWallZmax (new GbCuboid3D(d_minX1-4.0*blockLength, d_minX2-4.0*blockLength, d_maxX3, d_maxX1+4.0*blockLength, d_maxX2+4.0*blockLength, d_maxX3+4.0*blockLength));
+         if(myid == 0) GbSystem3D::writeGeoObject(addWallZmax.get(), pathname+"/geo/addWallZmax", WbWriterVtkXmlASCII::getInstance());
+
+         //inflow
+         GbCuboid3DPtr geoInflow (new GbCuboid3D(d_minX1-4.0*blockLength, d_minX2-4.0*blockLength, d_minX3-4.0*blockLength, d_minX1, d_maxX2+4.0*blockLength, d_maxX3+4.0*blockLength));
+         if(myid == 0) GbSystem3D::writeGeoObject(geoInflow.get(), pathname+"/geo/geoInflow", WbWriterVtkXmlASCII::getInstance());
+
+         //outflow
+         GbCuboid3DPtr geoOutflow (new GbCuboid3D(d_maxX1, d_minX2-4.0*blockLength, d_minX3-4.0*blockLength, d_maxX1+4.0*blockLength, d_maxX2+4.0*blockLength, d_maxX3+4.0*blockLength));
+         if(myid == 0) GbSystem3D::writeGeoObject(geoOutflow.get(), pathname+"/geo/geoOutflow", WbWriterVtkXmlASCII::getInstance());
+
+         BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname + "/grid/blocks", WbWriterVtkXmlBinary::getInstance(), comm));
+
+         //sphere
+         int bbOption = 1; //0=simple Bounce Back, 1=quadr. BB
+         D3Q27BoundaryConditionAdapterPtr bcObst(new D3Q27NoSlipBCAdapter(bbOption));
+         sphereInt = D3Q27InteractorPtr ( new D3Q27Interactor(sphere, grid, bcObst,Interactor3D::SOLID));
+
+         //walls
+         D3Q27InteractorPtr addWallYminInt(new D3Q27Interactor(addWallYmin, grid, bcObst,Interactor3D::SOLID));
+         D3Q27InteractorPtr addWallZminInt(new D3Q27Interactor(addWallZmin, grid, bcObst,Interactor3D::SOLID));
+         D3Q27InteractorPtr addWallYmaxInt(new D3Q27Interactor(addWallYmax, grid, bcObst,Interactor3D::SOLID));
+         D3Q27InteractorPtr addWallZmaxInt(new D3Q27Interactor(addWallZmax, grid, bcObst,Interactor3D::SOLID));
+
+         mu::Parser fct;
+         fct.SetExpr("16*U*x2*x3*(H-x2)*(H-x3)/H^4");
+         fct.DefineConst("U", uLB);
+         fct.DefineConst("H", H);
+
+         //inflow
+         D3Q27BoundaryConditionAdapterPtr velBCAdapter(new D3Q27VelocityBCAdapter (true, false ,false ,fct, 0, D3Q27BCFunction::INFCONST));
+         velBCAdapter->setSecondaryBcOption(2);
+         D3Q27InteractorPtr inflowInt  = D3Q27InteractorPtr( new D3Q27Interactor(geoInflow, grid, velBCAdapter, Interactor3D::SOLID));
+
+         //outflow
+         D3Q27BoundaryConditionAdapterPtr denBCAdapter(new D3Q27DensityBCAdapter(rhoLB));
+         D3Q27InteractorPtr outflowInt = D3Q27InteractorPtr( new D3Q27Interactor(geoOutflow, grid, denBCAdapter,Interactor3D::SOLID));
+
+         Grid3DVisitorPtr metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B));
+         InteractorsHelper intHelper(grid, metisVisitor);
+         intHelper.addInteractor(sphereInt);
+         intHelper.addInteractor(addWallYminInt);
+         intHelper.addInteractor(addWallZminInt);
+         intHelper.addInteractor(addWallYmaxInt);
+         intHelper.addInteractor(addWallZmaxInt);
+         intHelper.addInteractor(inflowInt);
+         intHelper.addInteractor(outflowInt);
+         intHelper.selectBlocks();
+
+         ppblocks->update(0);
+         ppblocks.reset();
+
+         //set connectors
+         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27OffsetInterpolationProcessor());
+         FETOLSetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
+         grid->accept( setConnsVisitor );
+
+         unsigned long nob = grid->getNumberOfBlocks();
+         int gl = 3;
+         unsigned long nod = nob * (blocknx1+gl) * (blocknx2+gl) * (blocknx3+gl);
+
+         double needMemAll  = double(nod*(27*sizeof(double) + sizeof(int) + sizeof(float)*4));
+         double needMem  = needMemAll / double(comm->getNumberOfProcesses());
+
+         if(myid == 0)
+         {
+            UBLOG(logINFO,"Number of blocks = " << nob);
+            UBLOG(logINFO,"Number of nodes  = " << nod);
+            UBLOG(logINFO,"Necessary memory  = " << needMemAll  << " bytes");
+            UBLOG(logINFO,"Necessary memory per process = " << needMem  << " bytes");
+            UBLOG(logINFO,"Available memory per process = " << availMem << " bytes");
+         }            
+
+         LBMKernel3DPtr kernel(new LBMKernelETD3Q27CCLB(blocknx1, blocknx2, blocknx3, LBMKernelETD3Q27CCLB::NORMAL));
+
+         BCProcessorPtr bcProc(new D3Q27ETBCProcessor());
+         kernel->setBCProcessor(bcProc);
+
+         SetKernelBlockVisitor kernelVisitor(kernel, nueLB, availMem, needMem);
+         grid->accept(kernelVisitor);
+
+         intHelper.setBC();
+
+         //initialization of distributions
+         D3Q27ETInitDistributionsBlockVisitor initVisitor(nueLB, rhoLB);
+         initVisitor.setVx1(fct);
+         grid->accept(initVisitor);
+
+         //Postrozess
+         UbSchedulerPtr geoSch(new UbScheduler(1));
+         D3Q27MacroscopicQuantitiesPostprocessorPtr ppgeo(
+            new D3Q27MacroscopicQuantitiesPostprocessor(grid, geoSch, pathname + "/grid/nodes", WbWriterVtkXmlBinary::getInstance(), conv, true));
+         ppgeo->update(0);
+         ppgeo.reset();
+
+         if(myid == 0) UBLOG(logINFO,"Preprozess - end"); 
+      }
+      else
+      {
+         UBLOG(logINFO,"SetConnectors - start, id="<<myid);
+
+         //set connectors
+         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27OffsetInterpolationProcessor());
+         FETOLSetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
+         grid->accept( setConnsVisitor );
+         
+         UBLOG(logINFO,"SetConnectors - end, id="<<myid); 
+      }
+
+      UbSchedulerPtr stepSch(new UbScheduler());
+      stepSch->addSchedule(1000, 0, 1000000);
+      D3Q27MacroscopicQuantitiesPostprocessor pp(grid, stepSch, pathname + "/steps/step", WbWriterVtkXmlBinary::getInstance(), conv);
+
+      //UbSchedulerPtr nupsSch(new UbScheduler(10, 30, 100));
+      //NUPSCounterPostprocessor npr(grid, nupsSch, pathname + "/results/nups.txt", comm);
+
+      double endTime = 100000;
+      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, stepSch, CalculationManager::FETOL));
+      
+      if(myid == 0) 
+         UBLOG(logINFO,"Simulation-start");
+      
+      calculation->calculate();
+      
+      if(myid == 0) 
+         UBLOG(logINFO,"Simulation-end");
+
+      JM::finalize();
+   }
+   catch(std::exception& e)
+   {
+      cerr << e.what() << endl << flush;
+   }
+   catch(std::string& s)
+   {
+      cerr << s << endl;
+   }
+   catch(...)
+   {
+      cerr << "unknown exception" << endl;
+   }
+
+}
+
+//////////////////////////////////////////////////////////////////////////
+int main(int argc, char* argv[])
+{
+   if ( argv != NULL )
+   {
+      if (argc > 1)
+      {
+         chanel(argv[1]);
+      }
+      else
+      {
+         cout << "Configuration file must be set!: " <<  argv[0] << " <config file>" << endl << std::flush;
+      }
+   }
+}
+
diff --git a/apps/cpu/greenvortex/CMakeLists.txt b/apps/cpu/greenvortex/CMakeLists.txt
index 2715bc92017327fd1354dc5d4e54241d55cf5324..088c4472a843e5cb76b6a7c27aa2a3b93dee905c 100644
--- a/apps/cpu/greenvortex/CMakeLists.txt
+++ b/apps/cpu/greenvortex/CMakeLists.txt
@@ -1,25 +1,25 @@
-CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
-
-########################################################
-## C++ PROJECT                                       ###
-########################################################
-PROJECT(greenvortex)
-
-INCLUDE(${SOURCE_ROOT}/core/IncludsList.txt) 
-
-#################################################################
-###   LOCAL FILES                                             ###
-#################################################################
-FILE(GLOB SPECIFIC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.h
-                         ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
-                         ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp  )
- 
-SET(ALL_SOURCES ${ALL_SOURCES} ${SPECIFIC_FILES})
-SOURCE_GROUP(src FILES ${SPECIFIC_FILES})
-  
-SET(CAB_ADDITIONAL_LINK_LIBRARIES core)
-
-#################################################################
-###   CREATE PROJECT                                          ###
-#################################################################
-CREATE_CAB_PROJECT(greenvortex BINARY)
+CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
+
+########################################################
+## C++ PROJECT                                       ###
+########################################################
+PROJECT(greenvortex)
+
+INCLUDE(${SOURCE_ROOT}/core/IncludsList.txt) 
+
+#################################################################
+###   LOCAL FILES                                             ###
+#################################################################
+FILE(GLOB SPECIFIC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.h
+                         ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
+                         ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp  )
+ 
+SET(ALL_SOURCES ${ALL_SOURCES} ${SPECIFIC_FILES})
+SOURCE_GROUP(src FILES ${SPECIFIC_FILES})
+  
+SET(CAB_ADDITIONAL_LINK_LIBRARIES core)
+
+#################################################################
+###   CREATE PROJECT                                          ###
+#################################################################
+CREATE_CAB_PROJECT(greenvortex BINARY)
diff --git a/apps/cpu/greenvortex/greenvortex.cpp b/apps/cpu/greenvortex/greenvortex.cpp
index 618bcf0b93cc44bed4bbc4d229a143d570214843..ba54105e338e28b660d79613eae67aa6bfcd76a2 100644
--- a/apps/cpu/greenvortex/greenvortex.cpp
+++ b/apps/cpu/greenvortex/greenvortex.cpp
@@ -1,211 +1,211 @@
-#include <iostream>
-#include <string>
-
-#include "geometry3d/CoordinateTransformation3D.h"
-#include "Grid3D.h"
-#include "GenBlocksGridVisitor.h"
-#include "geometry3d/GbSystem3D.h"
-#include "geometry3d/GbCuboid3D.h"
-#include "geometry3d/GbCylinder3D.h"
-#include <geometry3d/GbSphere3D.h>
-#include "basics/writer/WbWriterVtkXmlASCII.h"
-#include "basics/writer/WbWriterVtkXmlBinary.h"
-#include "RefineCrossAndInsideGbObjectBlockVisitor.h"
-#include "RatioBlockVisitor.h"
-#include "RatioSmoothBlockVisitor.h"
-#include "OverlapBlockVisitor.h"
-#include "RefineInterGbObjectsVisitor.h"
-#include "RefineCrossAndInsideGbObjectBlockVisitor.h"
-#include "SetKernelBlockVisitor.h"
-#include "LBMKernelETD3Q27Cascaded.h"
-#include "D3Q27MacroscopicQuantitiesPostprocessor.h"
-#include "MPICommunicator.h"
-#include "D3Q27ETBCProcessor.h"
-#include "SimulationParameters.h"
-#include "D3Q27SetUndefinedNodesBlockVisitor.h"
-#include "SetInterpolationDirsBlockVisitor.h"
-#include "D3Q27SetConnectorsBlockVisitor.h"
-#include "NullCommunicator.h"
-#include "D3Q27ETInitDistributionsBlockVisitor.h"
-#include "CalculationManager.h"
-#include "PQueuePartitioningGridVisitor.h"
-#include "MetisPartitioningGridVisitor.h"
-#include "D3Q27Interactor.h"
-#include "D3Q27NoSlipBCAdapter.h"
-#include "D3Q27BoundaryConditionAdapter.h"
-#include "D3Q27PathLinePostprocessor.h"
-#include "D3Q27OffsetInterpolationProcessor.h"
-#include "BlocksPostprocessor.h"
-
-using namespace std;
-
-
-void run(const char *cstr)
-{
-   try
-   {
-      string pathname = "c:/temp/greenvortex/out";
-
-      int numOfThreads = 3;
-
-      const int blocknx1 = 5;
-      const int blocknx2 = 5;
-      const int blocknx3 = 5;
-
-      const int baseLevel = 0;
-      const int refineLevel = 1;
-
-      const double blockLentghX1 = 1.0;
-      const double blockLentghX2 = 1.0;
-      const double blockLentghX3 = 1.0;
-
-      const double gridOriginX1 = 0.0;
-      const double gridOriginX2 = 0.0;
-      const double gridOriginX3 = 0.0;
-
-      double L1 = 5.0;
-      double L2 = 5.0;
-      double L3 = 5.0;
-
-      const double dx = blockLentghX1/static_cast<double>(blocknx1);
-
-      CommunicatorPtr comm(new MPICommunicator());
-
-      LBMReal uLB = 0.01;
-      LBMReal Re = 20.0;
-      LBMReal rhoLB = 1.0;
-      LBMReal l = blockLentghX2 / dx;
-      LBMReal nueLB = (uLB*l)/Re;
-
-      SimulationParametersPtr param = SimulationParameters::getInstanz();
-      param->setCollisionModelType(SimulationParameters::COMPRESSIBLE);
-      param->setRho(rhoLB);
-      param->setVelocityX(uLB);
-      param->setViscosity(nueLB);
-
-      Grid3DPtr grid(new Grid3D());
-      grid->setDeltaX(dx);
-      grid->setBlockNX(blocknx1, blocknx2, blocknx3);
-      grid->setPeriodicX1(true);
-      grid->setPeriodicX2(false);
-      grid->setPeriodicX3(false);
-
-
-      GbObject3DPtr gridCube(new GbCuboid3D(0.0, 0.0, 0.0, L1, L2, L3));
-      GenBlocksGridVisitor genBlocks;
-      genBlocks.addGeoObject(gridCube);
-      grid->accept(genBlocks);
-
-      LBMKernel3DPtr kernel(new LBMKernelETD3Q27Cascaded(blocknx1, blocknx2, blocknx3));
-
-      mu::Parser fctForcingX1, fctForcingX2;
-      fctForcingX1.SetExpr("2.0*rho* (4.0*PI*PI/(L1/dx)/(L2/dx))*( nue*vlb*sin(x1*2.0*PI/(L1/dx))*cos(x2*2.0*PI/(L2/dx)))");
-      fctForcingX2.SetExpr("-2.0*rho*(4.0*PI*PI/(L1/dx)/(L2/dx))*( nue*vlb*cos(x1*2.0*PI/(L1/dx))*sin(x2*2.0*PI/(L2/dx)))");
-
-      fctForcingX1.DefineConst("L1"     , static_cast<double>(L1*blocknx1));
-      fctForcingX1.DefineConst("L2"     , static_cast<double>(L2*blocknx2));
-      fctForcingX1.DefineConst("PI"     , PI);
-      fctForcingX1.DefineConst("rho"    , rhoLB);
-      fctForcingX1.DefineConst("vlb"    , uLB);
-
-      fctForcingX2.DefineConst("L1"     , static_cast<double>(L1*blocknx1));
-      fctForcingX2.DefineConst("L2"     , static_cast<double>(L2*blocknx2));
-      fctForcingX2.DefineConst("PI"     , PI);
-      fctForcingX2.DefineConst("rho"    , rhoLB);
-      fctForcingX2.DefineConst("vlb"    , uLB);
-
-      kernel->setForcingX1(fctForcingX1);
-      kernel->setForcingX2(fctForcingX2);
-
-      BCProcessorPtr bcProc(new D3Q27ETBCProcessor());
-      kernel->setBCProcessor(bcProc);
-
-      SetKernelBlockVisitor kernelVisitor(kernel, nueLB);
-      grid->accept(kernelVisitor);
-
-      D3Q27InterpolationProcessorPtr iProcessor(new D3Q27OffsetInterpolationProcessor());
-      D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
-      grid->accept( setConnsVisitor );
-
-      PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
-      grid->accept(pqPartVisitor);
-
-      D3Q27ETInitDistributionsBlockVisitor initVisitor(1.0);
-
-      mu::Parser fct,fct2,fct3;
-      fct.SetExpr(" vLB*sin( ( (x1)*2.0*PI/ L1))*cos( (x2)*2.0*PI/L2)");
-      fct.DefineConst("L1"     , L1);
-      fct.DefineConst("L2"     , L2);
-      fct.DefineConst("vLB"  , uLB);
-      fct.DefineConst("PI"  , PI);
-      initVisitor.setVx1(fct);
-
-      fct2.SetExpr(" -vLB*cos( ( (x1)*2.0*PI/ L1))*sin( (x2)*2.0*PI/L2)");
-      fct2.DefineConst("L1"     , L1);
-      fct2.DefineConst("L2"     , L2);
-      fct2.DefineConst("vLB"  , uLB           );
-      fct2.DefineConst("PI"  , PI);
-      initVisitor.setVx2(fct2);
-
-      initVisitor.setVx3(0.0);
-
-      fct3.SetExpr(" 1.0+(vLB*vLB)*3.0/4.0*(cos((x1)*4.0*PI/L1)+cos((x2)*4.0*PI/L2))");
-      fct3.DefineConst("L1"     , L1);
-      fct3.DefineConst("L2"     , L2);
-      fct3.DefineConst("vLB"  , uLB           );
-      fct3.DefineConst("PI"  , PI);
-      initVisitor.setRho(fct3);
-
-      grid->accept(initVisitor);
-
-      BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname + "/grid/blocks", WbWriterVtkXmlBinary::getInstance(), comm));
-      ppblocks->update(0);
-      ppblocks.reset();
-
-      LBMUnitConverterPtr conv = LBMUnitConverterPtr(new LBMUnitConverter());
-      {
-         UbSchedulerPtr geoSch(new UbScheduler(1));
-         D3Q27MacroscopicQuantitiesPostprocessor ppgeo(grid, geoSch, pathname + "/nodes_geo", WbWriterVtkXmlBinary::getInstance(), conv, comm, true);
-         grid->doPostProcess(0);
-      }
-      double outTime = 1000.0;
-      UbSchedulerPtr visSch(new UbScheduler(outTime));
-      D3Q27MacroscopicQuantitiesPostprocessor pp(grid, visSch, pathname + "/nodes", WbWriterVtkXmlBinary::getInstance(), conv, comm);
-
-      //////////////////////////////////////////////////////////////////////////
-      //PathLine
-      UbSchedulerPtr plSch(new UbScheduler(1000, 1000));
-      D3Q27PathLinePostprocessor pathLine(grid, pathname + "/pathLine", WbWriterVtkXmlASCII::getInstance(), conv, plSch, comm, 4.2, 4.2, 4.2, nueLB, iProcessor);
-      //////////////////////////////////////////////////////////////////////////
-
-      //////////////////////////////////////////////////////////////////////////
-      //Simulation
-      //////////////////////////////////////////////////////////////////////////
-      double endTime = 10000.0;
-      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, visSch));
-      UBLOG(logINFO,"Simulation-start");
-      calculation->calculate();
-
-   }
-   catch(std::exception& e)
-   {
-      cerr << e.what() << endl << flush;
-   }
-   catch(std::string& s)
-   {
-      cerr << s << endl;
-   }
-   catch(...)
-   {
-      cerr << "unknown exception" << endl;
-   }
-
-}
-int main(int argc, char* argv[])
-{
-
-   run(argv[1]);
-
-   return 0;
-}
-
+#include <iostream>
+#include <string>
+
+#include "geometry3d/CoordinateTransformation3D.h"
+#include "Grid3D.h"
+#include "GenBlocksGridVisitor.h"
+#include "geometry3d/GbSystem3D.h"
+#include "geometry3d/GbCuboid3D.h"
+#include "geometry3d/GbCylinder3D.h"
+#include <geometry3d/GbSphere3D.h>
+#include "basics/writer/WbWriterVtkXmlASCII.h"
+#include "basics/writer/WbWriterVtkXmlBinary.h"
+#include "RefineCrossAndInsideGbObjectBlockVisitor.h"
+#include "RatioBlockVisitor.h"
+#include "RatioSmoothBlockVisitor.h"
+#include "OverlapBlockVisitor.h"
+#include "RefineInterGbObjectsVisitor.h"
+#include "RefineCrossAndInsideGbObjectBlockVisitor.h"
+#include "SetKernelBlockVisitor.h"
+#include "LBMKernelETD3Q27Cascaded.h"
+#include "D3Q27MacroscopicQuantitiesPostprocessor.h"
+#include "MPICommunicator.h"
+#include "D3Q27ETBCProcessor.h"
+#include "SimulationParameters.h"
+#include "D3Q27SetUndefinedNodesBlockVisitor.h"
+#include "SetInterpolationDirsBlockVisitor.h"
+#include "D3Q27SetConnectorsBlockVisitor.h"
+#include "NullCommunicator.h"
+#include "D3Q27ETInitDistributionsBlockVisitor.h"
+#include "CalculationManager.h"
+#include "PQueuePartitioningGridVisitor.h"
+#include "MetisPartitioningGridVisitor.h"
+#include "D3Q27Interactor.h"
+#include "D3Q27NoSlipBCAdapter.h"
+#include "D3Q27BoundaryConditionAdapter.h"
+#include "D3Q27PathLinePostprocessor.h"
+#include "D3Q27OffsetInterpolationProcessor.h"
+#include "BlocksPostprocessor.h"
+
+using namespace std;
+
+
+void run(const char *cstr)
+{
+   try
+   {
+      string pathname = "c:/temp/greenvortex/out";
+
+      int numOfThreads = 3;
+
+      const int blocknx1 = 5;
+      const int blocknx2 = 5;
+      const int blocknx3 = 5;
+
+      const int baseLevel = 0;
+      const int refineLevel = 1;
+
+      const double blockLentghX1 = 1.0;
+      const double blockLentghX2 = 1.0;
+      const double blockLentghX3 = 1.0;
+
+      const double gridOriginX1 = 0.0;
+      const double gridOriginX2 = 0.0;
+      const double gridOriginX3 = 0.0;
+
+      double L1 = 5.0;
+      double L2 = 5.0;
+      double L3 = 5.0;
+
+      const double dx = blockLentghX1/static_cast<double>(blocknx1);
+
+      CommunicatorPtr comm(new MPICommunicator());
+
+      LBMReal uLB = 0.01;
+      LBMReal Re = 20.0;
+      LBMReal rhoLB = 1.0;
+      LBMReal l = blockLentghX2 / dx;
+      LBMReal nueLB = (uLB*l)/Re;
+
+      SimulationParametersPtr param = SimulationParameters::getInstanz();
+      param->setCollisionModelType(SimulationParameters::COMPRESSIBLE);
+      param->setRho(rhoLB);
+      param->setVelocityX(uLB);
+      param->setViscosity(nueLB);
+
+      Grid3DPtr grid(new Grid3D());
+      grid->setDeltaX(dx);
+      grid->setBlockNX(blocknx1, blocknx2, blocknx3);
+      grid->setPeriodicX1(true);
+      grid->setPeriodicX2(false);
+      grid->setPeriodicX3(false);
+
+
+      GbObject3DPtr gridCube(new GbCuboid3D(0.0, 0.0, 0.0, L1, L2, L3));
+      GenBlocksGridVisitor genBlocks;
+      genBlocks.addGeoObject(gridCube);
+      grid->accept(genBlocks);
+
+      LBMKernel3DPtr kernel(new LBMKernelETD3Q27Cascaded(blocknx1, blocknx2, blocknx3));
+
+      mu::Parser fctForcingX1, fctForcingX2;
+      fctForcingX1.SetExpr("2.0*rho* (4.0*PI*PI/(L1/dx)/(L2/dx))*( nue*vlb*sin(x1*2.0*PI/(L1/dx))*cos(x2*2.0*PI/(L2/dx)))");
+      fctForcingX2.SetExpr("-2.0*rho*(4.0*PI*PI/(L1/dx)/(L2/dx))*( nue*vlb*cos(x1*2.0*PI/(L1/dx))*sin(x2*2.0*PI/(L2/dx)))");
+
+      fctForcingX1.DefineConst("L1"     , static_cast<double>(L1*blocknx1));
+      fctForcingX1.DefineConst("L2"     , static_cast<double>(L2*blocknx2));
+      fctForcingX1.DefineConst("PI"     , PI);
+      fctForcingX1.DefineConst("rho"    , rhoLB);
+      fctForcingX1.DefineConst("vlb"    , uLB);
+
+      fctForcingX2.DefineConst("L1"     , static_cast<double>(L1*blocknx1));
+      fctForcingX2.DefineConst("L2"     , static_cast<double>(L2*blocknx2));
+      fctForcingX2.DefineConst("PI"     , PI);
+      fctForcingX2.DefineConst("rho"    , rhoLB);
+      fctForcingX2.DefineConst("vlb"    , uLB);
+
+      kernel->setForcingX1(fctForcingX1);
+      kernel->setForcingX2(fctForcingX2);
+
+      BCProcessorPtr bcProc(new D3Q27ETBCProcessor());
+      kernel->setBCProcessor(bcProc);
+
+      SetKernelBlockVisitor kernelVisitor(kernel, nueLB);
+      grid->accept(kernelVisitor);
+
+      D3Q27InterpolationProcessorPtr iProcessor(new D3Q27OffsetInterpolationProcessor());
+      D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
+      grid->accept( setConnsVisitor );
+
+      PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
+      grid->accept(pqPartVisitor);
+
+      D3Q27ETInitDistributionsBlockVisitor initVisitor(1.0);
+
+      mu::Parser fct,fct2,fct3;
+      fct.SetExpr(" vLB*sin( ( (x1)*2.0*PI/ L1))*cos( (x2)*2.0*PI/L2)");
+      fct.DefineConst("L1"     , L1);
+      fct.DefineConst("L2"     , L2);
+      fct.DefineConst("vLB"  , uLB);
+      fct.DefineConst("PI"  , PI);
+      initVisitor.setVx1(fct);
+
+      fct2.SetExpr(" -vLB*cos( ( (x1)*2.0*PI/ L1))*sin( (x2)*2.0*PI/L2)");
+      fct2.DefineConst("L1"     , L1);
+      fct2.DefineConst("L2"     , L2);
+      fct2.DefineConst("vLB"  , uLB           );
+      fct2.DefineConst("PI"  , PI);
+      initVisitor.setVx2(fct2);
+
+      initVisitor.setVx3(0.0);
+
+      fct3.SetExpr(" 1.0+(vLB*vLB)*3.0/4.0*(cos((x1)*4.0*PI/L1)+cos((x2)*4.0*PI/L2))");
+      fct3.DefineConst("L1"     , L1);
+      fct3.DefineConst("L2"     , L2);
+      fct3.DefineConst("vLB"  , uLB           );
+      fct3.DefineConst("PI"  , PI);
+      initVisitor.setRho(fct3);
+
+      grid->accept(initVisitor);
+
+      BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname + "/grid/blocks", WbWriterVtkXmlBinary::getInstance(), comm));
+      ppblocks->update(0);
+      ppblocks.reset();
+
+      LBMUnitConverterPtr conv = LBMUnitConverterPtr(new LBMUnitConverter());
+      {
+         UbSchedulerPtr geoSch(new UbScheduler(1));
+         D3Q27MacroscopicQuantitiesPostprocessor ppgeo(grid, geoSch, pathname + "/nodes_geo", WbWriterVtkXmlBinary::getInstance(), conv, comm, true);
+         grid->doPostProcess(0);
+      }
+      double outTime = 1000.0;
+      UbSchedulerPtr visSch(new UbScheduler(outTime));
+      D3Q27MacroscopicQuantitiesPostprocessor pp(grid, visSch, pathname + "/nodes", WbWriterVtkXmlBinary::getInstance(), conv, comm);
+
+      //////////////////////////////////////////////////////////////////////////
+      //PathLine
+      UbSchedulerPtr plSch(new UbScheduler(1000, 1000));
+      D3Q27PathLinePostprocessor pathLine(grid, pathname + "/pathLine", WbWriterVtkXmlASCII::getInstance(), conv, plSch, comm, 4.2, 4.2, 4.2, nueLB, iProcessor);
+      //////////////////////////////////////////////////////////////////////////
+
+      //////////////////////////////////////////////////////////////////////////
+      //Simulation
+      //////////////////////////////////////////////////////////////////////////
+      double endTime = 10000.0;
+      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, visSch));
+      UBLOG(logINFO,"Simulation-start");
+      calculation->calculate();
+
+   }
+   catch(std::exception& e)
+   {
+      cerr << e.what() << endl << flush;
+   }
+   catch(std::string& s)
+   {
+      cerr << s << endl;
+   }
+   catch(...)
+   {
+      cerr << "unknown exception" << endl;
+   }
+
+}
+int main(int argc, char* argv[])
+{
+
+   run(argv[1]);
+
+   return 0;
+}
+
diff --git a/apps/cpu/gridRf/CMakeLists.txt b/apps/cpu/gridRf/CMakeLists.txt
index d67a3834a408228619d509d1053d7b8db05c6793..3a569b1e6daf7a3192a1590d23a48fd3197908e4 100644
--- a/apps/cpu/gridRf/CMakeLists.txt
+++ b/apps/cpu/gridRf/CMakeLists.txt
@@ -1,25 +1,25 @@
-CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
-
-########################################################
-## C++ PROJECT                                       ###
-########################################################
-PROJECT(gridRf)
-
-INCLUDE(${SOURCE_ROOT}/core/IncludsList.txt) 
-
-#################################################################
-###   LOCAL FILES                                             ###
-#################################################################
-FILE(GLOB SPECIFIC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.h
-                         ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
-                         ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp  )
- 
-SET(ALL_SOURCES ${ALL_SOURCES} ${SPECIFIC_FILES})
-SOURCE_GROUP(src FILES ${SPECIFIC_FILES})
-  
-SET(CAB_ADDITIONAL_LINK_LIBRARIES core)
-
-#################################################################
-###   CREATE PROJECT                                          ###
-#################################################################
-CREATE_CAB_PROJECT(gridRf BINARY)
+CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
+
+########################################################
+## C++ PROJECT                                       ###
+########################################################
+PROJECT(gridRf)
+
+INCLUDE(${SOURCE_ROOT}/core/IncludsList.txt) 
+
+#################################################################
+###   LOCAL FILES                                             ###
+#################################################################
+FILE(GLOB SPECIFIC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.h
+                         ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
+                         ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp  )
+ 
+SET(ALL_SOURCES ${ALL_SOURCES} ${SPECIFIC_FILES})
+SOURCE_GROUP(src FILES ${SPECIFIC_FILES})
+  
+SET(CAB_ADDITIONAL_LINK_LIBRARIES core)
+
+#################################################################
+###   CREATE PROJECT                                          ###
+#################################################################
+CREATE_CAB_PROJECT(gridRf BINARY)
diff --git a/apps/cpu/gridRf/gridRf.cpp b/apps/cpu/gridRf/gridRf.cpp
index 6064022b851637f6b68e09919d1ffa677785d7e5..38e5c46f53e59fff2cb5135549cf69370c933a09 100644
--- a/apps/cpu/gridRf/gridRf.cpp
+++ b/apps/cpu/gridRf/gridRf.cpp
@@ -1,253 +1,253 @@
-#include <iostream>
-#include <string>
-
-#include "geometry3d/CoordinateTransformation3D.h"
-#include "Grid3D.h"
-#include "GenBlocksGridVisitor.h"
-#include "geometry3d/GbSystem3D.h"
-#include "geometry3d/GbCuboid3D.h"
-#include "geometry3d/GbCylinder3D.h"
-#include <geometry3d/GbSphere3D.h>
-#include "basics/writer/WbWriterVtkXmlASCII.h"
-#include "basics/writer/WbWriterVtkXmlBinary.h"
-#include "RefineCrossAndInsideGbObjectBlockVisitor.h"
-#include "RatioBlockVisitor.h"
-#include "RatioSmoothBlockVisitor.h"
-#include "OverlapBlockVisitor.h"
-#include "RefineInterGbObjectsVisitor.h"
-#include "RefineCrossAndInsideGbObjectBlockVisitor.h"
-#include "SetKernelBlockVisitor.h"
-#include "LBMKernelETD3Q27Cascaded.h"
-#include "D3Q27MacroscopicQuantitiesPostprocessor.h"
-#include "MPICommunicator.h"
-#include "D3Q27ETBCProcessor.h"
-#include "SimulationParameters.h"
-#include "D3Q27SetUndefinedNodesBlockVisitor.h"
-#include "SetInterpolationDirsBlockVisitor.h"
-#include "D3Q27SetConnectorsBlockVisitor.h"
-#include "NullCommunicator.h"
-#include "D3Q27ETInitDistributionsBlockVisitor.h"
-#include "CalculationManager.h"
-#include "PQueuePartitioningGridVisitor.h"
-#include "MetisPartitioningGridVisitor.h"
-#include "D3Q27Interactor.h"
-#include "D3Q27NoSlipBCAdapter.h"
-#include "D3Q27BoundaryConditionAdapter.h"
-#include "D3Q27OffsetInterpolationProcessor.h"
-#include "BlocksPostprocessor.h"
-
-using namespace std;
-
-
-void run(const char *cstr)
-{
-   try
-   {
-      string pathname = "c:/temp/bFluid/out";
-
-      int numOfThreads = 3;
-
-      const int blocknx1 = 5;
-      const int blocknx2 = 5;
-      const int blocknx3 = 5;
-
-      const int baseLevel = 0;
-      const int refineLevel = 1;
-
-      const double blockLentghX1 = 1.0;
-      const double blockLentghX2 = 1.0;
-      const double blockLentghX3 = 1.0;
-
-      const double gridOriginX1 = 0.0;
-      const double gridOriginX2 = 0.0;
-      const double gridOriginX3 = 0.0;
-
-      double L1 = 7.0;
-      double L2 = 7.0;
-      double L3 = 7.0;
-
-      const double dx = blockLentghX1/static_cast<double>(blocknx1);
-
-      CommunicatorPtr comm(new MPICommunicator());
-
-      LBMReal uLB = 0.01;
-      LBMReal Re = 20.0;
-      LBMReal rhoLB = 1.0;
-      LBMReal l = blockLentghX2 / dx;
-      LBMReal nueLB = (uLB*l)/Re;
-
-      SimulationParametersPtr param = SimulationParameters::getInstanz();
-      param->setCollisionModelType(SimulationParameters::COMPRESSIBLE);
-      param->setRho(rhoLB);
-      param->setVelocityX(uLB);
-      param->setViscosity(nueLB);
-
-      Grid3DPtr grid(new Grid3D());
-      grid->setDeltaX(dx);
-      grid->setBlockNX(blocknx1, blocknx2, blocknx3);
-      grid->setPeriodicX1(true);
-      grid->setPeriodicX2(false);
-      grid->setPeriodicX3(false);
-
-      
-      GbObject3DPtr gridCube(new GbCuboid3D(0.0, 0.0, 0.0, L1, L2, L3));
-      GbObject3DPtr geoObject2(new GbCuboid3D(0.0, 0.0+dx, 0.0+dx, L1, L2-dx, L3-dx));
-      //GbObject3DPtr geoObject1(new GbCylinder3D(0.0, 0.0, 0.0, 5.0, 0.0, 0.0, 3.0));
-      GenBlocksGridVisitor genBlocks;
-      genBlocks.addGeoObject(gridCube);
-      //genBlocks.addGeoObject(geoObject2);
-      grid->accept(genBlocks);
-
-      GbObject3DPtr refineCube(new  GbCuboid3D(2.2, 2.2, 2.2, 3.8, 3.8, 3.8));
-      //GbObject3DPtr refineCube(new  GbCuboid3D(1.5, 1.5, 1.5, 3.5, 3.5, 3.5));
-      GbSphere3DPtr refineSphere(new GbSphere3D(3.5, 3.5, 3.5, 0.5));
-
-      RefineCrossAndInsideGbObjectBlockVisitor refVisitor(refineCube, baseLevel, refineLevel-1);
-      grid->accept(refVisitor);
-
-      //RefineInterGbObjectsVisitor refVisitor(refineSphere, refineCube, baseLevel, refineLevel-1);
-      //grid->accept(refVisitor);
-
-      RatioBlockVisitor ratioVisitor(refineLevel);
-      grid->accept(ratioVisitor);
-
-      RatioSmoothBlockVisitor ratioSmoothVisitor(refineLevel);
-      grid->accept(ratioSmoothVisitor);
-
-
-      OverlapBlockVisitor overlapVisitor(refineLevel);
-      grid->accept(overlapVisitor);
-
-      GbSystem3D::writeGeoObject(refineCube.get(),pathname + "/geoC", WbWriterVtkXmlASCII::getInstance());
-      GbSystem3D::writeGeoObject(refineSphere.get(),pathname + "/geoS", WbWriterVtkXmlASCII::getInstance());
-
-      LBMKernel3DPtr kernel(new LBMKernelETD3Q27Cascaded(blocknx1, blocknx2, blocknx3));
-
-      mu::Parser fctForcingX1, fctForcingX2;
-      //fctForcingX1.SetExpr("2.0*rho* (4.0*PI*PI/(L1/dx)/(L2/dx))*( nue*vlb*sin(x1*2.0*PI/(L1/dx))*cos(x2*2.0*PI/(L2/dx)))");
-      //fctForcingX2.SetExpr("-2.0*rho*(4.0*PI*PI/(L1/dx)/(L2/dx))*( nue*vlb*cos(x1*2.0*PI/(L1/dx))*sin(x2*2.0*PI/(L2/dx)))");
-
-      fctForcingX1.SetExpr("2.0*rho* (4.0*PI*PI/(L1/dx)/(L2/dx))*nue*vlb");
-
-      fctForcingX1.DefineConst("L1"     , static_cast<double>(L1*blocknx1));
-      fctForcingX1.DefineConst("L2"     , static_cast<double>(L2*blocknx2));
-      fctForcingX1.DefineConst("PI"     , PI);
-      fctForcingX1.DefineConst("rho"    , rhoLB);
-      //fctForcingX1.DefineConst("nuelb"  , nueLB);
-      fctForcingX1.DefineConst("vlb"    , uLB);
-
-      fctForcingX2.DefineConst("L1"     , static_cast<double>(L1*blocknx1));
-      fctForcingX2.DefineConst("L2"     , static_cast<double>(L2*blocknx2));
-      fctForcingX2.DefineConst("PI"     , PI);
-      fctForcingX2.DefineConst("rho"    , rhoLB);
-      //fctForcingX2.DefineConst("nuelb"  , nueLB);
-      fctForcingX2.DefineConst("vlb"    , uLB);
-
-      kernel->setForcingX1(fctForcingX1);
-      kernel->setForcingX2(0.0);
-
-
-      BCProcessorPtr bcProc(new D3Q27ETBCProcessor());
-      kernel->setBCProcessor(bcProc);
-
-      //MetisPartitioningGridVisitor metisVisitor(numOfThreads, D3Q27System::B, comm, true);
-      //grid->accept( metisVisitor );
-
-      SetKernelBlockVisitor kernelVisitor(kernel, nueLB);
-      grid->accept(kernelVisitor);
-
-      std::vector<int> dirs;
-      D3Q27System::getLBMDirections(dirs);
-      SetInterpolationDirsBlockVisitor interDirsVisitor(dirs);
-      grid->accept(interDirsVisitor);
-
-      D3Q27SetUndefinedNodesBlockVisitor undefNodesVisitor;
-      grid->accept(undefNodesVisitor);
-
-      int bbOption = 0; //0=simple Bounce Back, 1=quadr. BB
-      D3Q27BoundaryConditionAdapterPtr bc(new D3Q27NoSlipBCAdapter(bbOption));
-      D3Q27InteractorPtr chanel( new D3Q27Interactor(geoObject2, grid, bc,Interactor3D::INVERSESOLID));
-      grid->addAndInitInteractor(chanel);
-
-      D3Q27InterpolationProcessorPtr iProcessor(new D3Q27OffsetInterpolationProcessor());
-      D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
-      grid->accept( setConnsVisitor );
-
-      PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
-      grid->accept(pqPartVisitor);
-
-      D3Q27ETInitDistributionsBlockVisitor initVisitor(1.0);
-
-      mu::Parser fct,fct2,fct3;
-      fct.SetExpr(" vLB*sin( ( (x1)*2.0*PI/ L1))*cos( (x2)*2.0*PI/L2)");
-      fct.DefineConst("L1"     , L1);
-      fct.DefineConst("L2"     , L2);
-      fct.DefineConst("vLB"  , uLB);
-      fct.DefineConst("PI"  , PI);
-      //initVisitor.setVx1(fct);
-      initVisitor.setVx1(0.0);
-
-      fct2.SetExpr(" -vLB*cos( ( (x1)*2.0*PI/ L1))*sin( (x2)*2.0*PI/L2)");
-      fct2.DefineConst("L1"     , L1);
-      fct2.DefineConst("L2"     , L2);
-      fct2.DefineConst("vLB"  , uLB           );
-      fct2.DefineConst("PI"  , PI);
-      //initVisitor.setVx2(fct2);
-      initVisitor.setVx2(0.0);
-
-      initVisitor.setVx3(0.0);
-
-      fct3.SetExpr(" 1.0+(vLB*vLB)*3.0/4.0*(cos((x1)*4.0*PI/L1)+cos((x2)*4.0*PI/L2))");
-      fct3.DefineConst("L1"     , L1);
-      fct3.DefineConst("L2"     , L2);
-      fct3.DefineConst("vLB"  , uLB           );
-      fct3.DefineConst("PI"  , PI);
-      //initVisitor.setRho(fct3);
-      initVisitor.setRho(1.0);
-
-      grid->accept(initVisitor);
-
-      BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname + "/grid/blocks", WbWriterVtkXmlBinary::getInstance(), comm));
-      ppblocks->update(0);
-      ppblocks.reset();
-
-      LBMUnitConverterPtr conv = LBMUnitConverterPtr(new LBMUnitConverter());
-      {
-         UbSchedulerPtr geoSch(new UbScheduler(1));
-         D3Q27MacroscopicQuantitiesPostprocessor ppgeo(grid, geoSch, pathname + "/nodes_geo", WbWriterVtkXmlBinary::getInstance(), conv, comm, true);
-         grid->doPostProcess(0);
-      }
-      double outTime = 1000.0;
-      UbSchedulerPtr visSch(new UbScheduler(outTime));
-      D3Q27MacroscopicQuantitiesPostprocessor pp(grid, visSch, pathname + "/nodes", WbWriterVtkXmlBinary::getInstance(), conv, comm);
-
-      //grid->doPostProcess(0);
-
-      double endTime = 10000.0;
-      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, visSch));
-      UBLOG(logINFO,"Simulation-start");
-      calculation->calculate();
-     
-   }
-   catch(std::exception& e)
-   {
-      cerr << e.what() << endl << flush;
-   }
-   catch(std::string& s)
-   {
-      cerr << s << endl;
-   }
-   catch(...)
-   {
-      cerr << "unknown exception" << endl;
-   }
-
-}
-int main(int argc, char* argv[])
-{
-
-   run(argv[1]);
-
-   return 0;
-}
-
+#include <iostream>
+#include <string>
+
+#include "geometry3d/CoordinateTransformation3D.h"
+#include "Grid3D.h"
+#include "GenBlocksGridVisitor.h"
+#include "geometry3d/GbSystem3D.h"
+#include "geometry3d/GbCuboid3D.h"
+#include "geometry3d/GbCylinder3D.h"
+#include <geometry3d/GbSphere3D.h>
+#include "basics/writer/WbWriterVtkXmlASCII.h"
+#include "basics/writer/WbWriterVtkXmlBinary.h"
+#include "RefineCrossAndInsideGbObjectBlockVisitor.h"
+#include "RatioBlockVisitor.h"
+#include "RatioSmoothBlockVisitor.h"
+#include "OverlapBlockVisitor.h"
+#include "RefineInterGbObjectsVisitor.h"
+#include "RefineCrossAndInsideGbObjectBlockVisitor.h"
+#include "SetKernelBlockVisitor.h"
+#include "LBMKernelETD3Q27Cascaded.h"
+#include "D3Q27MacroscopicQuantitiesPostprocessor.h"
+#include "MPICommunicator.h"
+#include "D3Q27ETBCProcessor.h"
+#include "SimulationParameters.h"
+#include "D3Q27SetUndefinedNodesBlockVisitor.h"
+#include "SetInterpolationDirsBlockVisitor.h"
+#include "D3Q27SetConnectorsBlockVisitor.h"
+#include "NullCommunicator.h"
+#include "D3Q27ETInitDistributionsBlockVisitor.h"
+#include "CalculationManager.h"
+#include "PQueuePartitioningGridVisitor.h"
+#include "MetisPartitioningGridVisitor.h"
+#include "D3Q27Interactor.h"
+#include "D3Q27NoSlipBCAdapter.h"
+#include "D3Q27BoundaryConditionAdapter.h"
+#include "D3Q27OffsetInterpolationProcessor.h"
+#include "BlocksPostprocessor.h"
+
+using namespace std;
+
+
+void run(const char *cstr)
+{
+   try
+   {
+      string pathname = "c:/temp/bFluid/out";
+
+      int numOfThreads = 3;
+
+      const int blocknx1 = 5;
+      const int blocknx2 = 5;
+      const int blocknx3 = 5;
+
+      const int baseLevel = 0;
+      const int refineLevel = 1;
+
+      const double blockLentghX1 = 1.0;
+      const double blockLentghX2 = 1.0;
+      const double blockLentghX3 = 1.0;
+
+      const double gridOriginX1 = 0.0;
+      const double gridOriginX2 = 0.0;
+      const double gridOriginX3 = 0.0;
+
+      double L1 = 7.0;
+      double L2 = 7.0;
+      double L3 = 7.0;
+
+      const double dx = blockLentghX1/static_cast<double>(blocknx1);
+
+      CommunicatorPtr comm(new MPICommunicator());
+
+      LBMReal uLB = 0.01;
+      LBMReal Re = 20.0;
+      LBMReal rhoLB = 1.0;
+      LBMReal l = blockLentghX2 / dx;
+      LBMReal nueLB = (uLB*l)/Re;
+
+      SimulationParametersPtr param = SimulationParameters::getInstanz();
+      param->setCollisionModelType(SimulationParameters::COMPRESSIBLE);
+      param->setRho(rhoLB);
+      param->setVelocityX(uLB);
+      param->setViscosity(nueLB);
+
+      Grid3DPtr grid(new Grid3D());
+      grid->setDeltaX(dx);
+      grid->setBlockNX(blocknx1, blocknx2, blocknx3);
+      grid->setPeriodicX1(true);
+      grid->setPeriodicX2(false);
+      grid->setPeriodicX3(false);
+
+      
+      GbObject3DPtr gridCube(new GbCuboid3D(0.0, 0.0, 0.0, L1, L2, L3));
+      GbObject3DPtr geoObject2(new GbCuboid3D(0.0, 0.0+dx, 0.0+dx, L1, L2-dx, L3-dx));
+      //GbObject3DPtr geoObject1(new GbCylinder3D(0.0, 0.0, 0.0, 5.0, 0.0, 0.0, 3.0));
+      GenBlocksGridVisitor genBlocks;
+      genBlocks.addGeoObject(gridCube);
+      //genBlocks.addGeoObject(geoObject2);
+      grid->accept(genBlocks);
+
+      GbObject3DPtr refineCube(new  GbCuboid3D(2.2, 2.2, 2.2, 3.8, 3.8, 3.8));
+      //GbObject3DPtr refineCube(new  GbCuboid3D(1.5, 1.5, 1.5, 3.5, 3.5, 3.5));
+      GbSphere3DPtr refineSphere(new GbSphere3D(3.5, 3.5, 3.5, 0.5));
+
+      RefineCrossAndInsideGbObjectBlockVisitor refVisitor(refineCube, baseLevel, refineLevel-1);
+      grid->accept(refVisitor);
+
+      //RefineInterGbObjectsVisitor refVisitor(refineSphere, refineCube, baseLevel, refineLevel-1);
+      //grid->accept(refVisitor);
+
+      RatioBlockVisitor ratioVisitor(refineLevel);
+      grid->accept(ratioVisitor);
+
+      RatioSmoothBlockVisitor ratioSmoothVisitor(refineLevel);
+      grid->accept(ratioSmoothVisitor);
+
+
+      OverlapBlockVisitor overlapVisitor(refineLevel);
+      grid->accept(overlapVisitor);
+
+      GbSystem3D::writeGeoObject(refineCube.get(),pathname + "/geoC", WbWriterVtkXmlASCII::getInstance());
+      GbSystem3D::writeGeoObject(refineSphere.get(),pathname + "/geoS", WbWriterVtkXmlASCII::getInstance());
+
+      LBMKernel3DPtr kernel(new LBMKernelETD3Q27Cascaded(blocknx1, blocknx2, blocknx3));
+
+      mu::Parser fctForcingX1, fctForcingX2;
+      //fctForcingX1.SetExpr("2.0*rho* (4.0*PI*PI/(L1/dx)/(L2/dx))*( nue*vlb*sin(x1*2.0*PI/(L1/dx))*cos(x2*2.0*PI/(L2/dx)))");
+      //fctForcingX2.SetExpr("-2.0*rho*(4.0*PI*PI/(L1/dx)/(L2/dx))*( nue*vlb*cos(x1*2.0*PI/(L1/dx))*sin(x2*2.0*PI/(L2/dx)))");
+
+      fctForcingX1.SetExpr("2.0*rho* (4.0*PI*PI/(L1/dx)/(L2/dx))*nue*vlb");
+
+      fctForcingX1.DefineConst("L1"     , static_cast<double>(L1*blocknx1));
+      fctForcingX1.DefineConst("L2"     , static_cast<double>(L2*blocknx2));
+      fctForcingX1.DefineConst("PI"     , PI);
+      fctForcingX1.DefineConst("rho"    , rhoLB);
+      //fctForcingX1.DefineConst("nuelb"  , nueLB);
+      fctForcingX1.DefineConst("vlb"    , uLB);
+
+      fctForcingX2.DefineConst("L1"     , static_cast<double>(L1*blocknx1));
+      fctForcingX2.DefineConst("L2"     , static_cast<double>(L2*blocknx2));
+      fctForcingX2.DefineConst("PI"     , PI);
+      fctForcingX2.DefineConst("rho"    , rhoLB);
+      //fctForcingX2.DefineConst("nuelb"  , nueLB);
+      fctForcingX2.DefineConst("vlb"    , uLB);
+
+      kernel->setForcingX1(fctForcingX1);
+      kernel->setForcingX2(0.0);
+
+
+      BCProcessorPtr bcProc(new D3Q27ETBCProcessor());
+      kernel->setBCProcessor(bcProc);
+
+      //MetisPartitioningGridVisitor metisVisitor(numOfThreads, D3Q27System::B, comm, true);
+      //grid->accept( metisVisitor );
+
+      SetKernelBlockVisitor kernelVisitor(kernel, nueLB);
+      grid->accept(kernelVisitor);
+
+      std::vector<int> dirs;
+      D3Q27System::getLBMDirections(dirs);
+      SetInterpolationDirsBlockVisitor interDirsVisitor(dirs);
+      grid->accept(interDirsVisitor);
+
+      D3Q27SetUndefinedNodesBlockVisitor undefNodesVisitor;
+      grid->accept(undefNodesVisitor);
+
+      int bbOption = 0; //0=simple Bounce Back, 1=quadr. BB
+      D3Q27BoundaryConditionAdapterPtr bc(new D3Q27NoSlipBCAdapter(bbOption));
+      D3Q27InteractorPtr chanel( new D3Q27Interactor(geoObject2, grid, bc,Interactor3D::INVERSESOLID));
+      grid->addAndInitInteractor(chanel);
+
+      D3Q27InterpolationProcessorPtr iProcessor(new D3Q27OffsetInterpolationProcessor());
+      D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
+      grid->accept( setConnsVisitor );
+
+      PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
+      grid->accept(pqPartVisitor);
+
+      D3Q27ETInitDistributionsBlockVisitor initVisitor(1.0);
+
+      mu::Parser fct,fct2,fct3;
+      fct.SetExpr(" vLB*sin( ( (x1)*2.0*PI/ L1))*cos( (x2)*2.0*PI/L2)");
+      fct.DefineConst("L1"     , L1);
+      fct.DefineConst("L2"     , L2);
+      fct.DefineConst("vLB"  , uLB);
+      fct.DefineConst("PI"  , PI);
+      //initVisitor.setVx1(fct);
+      initVisitor.setVx1(0.0);
+
+      fct2.SetExpr(" -vLB*cos( ( (x1)*2.0*PI/ L1))*sin( (x2)*2.0*PI/L2)");
+      fct2.DefineConst("L1"     , L1);
+      fct2.DefineConst("L2"     , L2);
+      fct2.DefineConst("vLB"  , uLB           );
+      fct2.DefineConst("PI"  , PI);
+      //initVisitor.setVx2(fct2);
+      initVisitor.setVx2(0.0);
+
+      initVisitor.setVx3(0.0);
+
+      fct3.SetExpr(" 1.0+(vLB*vLB)*3.0/4.0*(cos((x1)*4.0*PI/L1)+cos((x2)*4.0*PI/L2))");
+      fct3.DefineConst("L1"     , L1);
+      fct3.DefineConst("L2"     , L2);
+      fct3.DefineConst("vLB"  , uLB           );
+      fct3.DefineConst("PI"  , PI);
+      //initVisitor.setRho(fct3);
+      initVisitor.setRho(1.0);
+
+      grid->accept(initVisitor);
+
+      BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname + "/grid/blocks", WbWriterVtkXmlBinary::getInstance(), comm));
+      ppblocks->update(0);
+      ppblocks.reset();
+
+      LBMUnitConverterPtr conv = LBMUnitConverterPtr(new LBMUnitConverter());
+      {
+         UbSchedulerPtr geoSch(new UbScheduler(1));
+         D3Q27MacroscopicQuantitiesPostprocessor ppgeo(grid, geoSch, pathname + "/nodes_geo", WbWriterVtkXmlBinary::getInstance(), conv, comm, true);
+         grid->doPostProcess(0);
+      }
+      double outTime = 1000.0;
+      UbSchedulerPtr visSch(new UbScheduler(outTime));
+      D3Q27MacroscopicQuantitiesPostprocessor pp(grid, visSch, pathname + "/nodes", WbWriterVtkXmlBinary::getInstance(), conv, comm);
+
+      //grid->doPostProcess(0);
+
+      double endTime = 10000.0;
+      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, visSch));
+      UBLOG(logINFO,"Simulation-start");
+      calculation->calculate();
+     
+   }
+   catch(std::exception& e)
+   {
+      cerr << e.what() << endl << flush;
+   }
+   catch(std::string& s)
+   {
+      cerr << s << endl;
+   }
+   catch(...)
+   {
+      cerr << "unknown exception" << endl;
+   }
+
+}
+int main(int argc, char* argv[])
+{
+
+   run(argv[1]);
+
+   return 0;
+}
+
diff --git a/apps/cpu/insitu_demo/CMakeLists.txt b/apps/cpu/insitu_demo/CMakeLists.txt
index 5ecce347855a9dd8f0502e273683ce72bef62124..df3d4879adb9e4736fbd393a251b123aa2ede6a5 100644
--- a/apps/cpu/insitu_demo/CMakeLists.txt
+++ b/apps/cpu/insitu_demo/CMakeLists.txt
@@ -1,25 +1,25 @@
-CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
-
-########################################################
-## C++ PROJECT                                       ###
-########################################################
-PROJECT(insitu_demo)
-
-INCLUDE(${SOURCE_ROOT}/lib/IncludsList.txt) 
-
-#################################################################
-###   LOCAL FILES                                             ###
-#################################################################
-FILE(GLOB SPECIFIC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.h
-                         ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
-                         ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp  )
- 
-SET(ALL_SOURCES ${ALL_SOURCES} ${SPECIFIC_FILES})
-SOURCE_GROUP(src FILES ${SPECIFIC_FILES})
-  
-SET(CAB_ADDITIONAL_LINK_LIBRARIES vfluids ${FETOL_RELEASE_LIBRARY})
-
-#################################################################
-###   CREATE PROJECT                                          ###
-#################################################################
-CREATE_CAB_PROJECT(insitu_demo BINARY)
+CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
+
+########################################################
+## C++ PROJECT                                       ###
+########################################################
+PROJECT(insitu_demo)
+
+INCLUDE(${SOURCE_ROOT}/lib/IncludsList.txt) 
+
+#################################################################
+###   LOCAL FILES                                             ###
+#################################################################
+FILE(GLOB SPECIFIC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.h
+                         ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
+                         ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp  )
+ 
+SET(ALL_SOURCES ${ALL_SOURCES} ${SPECIFIC_FILES})
+SOURCE_GROUP(src FILES ${SPECIFIC_FILES})
+  
+SET(CAB_ADDITIONAL_LINK_LIBRARIES vfluids ${FETOL_RELEASE_LIBRARY})
+
+#################################################################
+###   CREATE PROJECT                                          ###
+#################################################################
+CREATE_CAB_PROJECT(insitu_demo BINARY)
diff --git a/apps/cpu/insitu_demo/config.txt b/apps/cpu/insitu_demo/config.txt
index f927708298e2a148da60a827d6960aeec17865bd..0d4b199937822e5235e280e9c8522b0cc7eefc00 100644
--- a/apps/cpu/insitu_demo/config.txt
+++ b/apps/cpu/insitu_demo/config.txt
@@ -1,24 +1,24 @@
-#Ordner für Simulationsergebnisse
-path=d:/temp/insitu_demo
-
-#Verfügbare Arbeitsspeicher in Byte
-memory=12e9
-
-#Pfad zum Metafile
-metafile=d:/Data/insituDemo/metafile.csv
-
-#Ausgabezeitschritt
-outstep=1
-
-#maximale Anzahl Simulationszeitschritte
-endstep=10000
-
-#Blockauflösung in Knoten
-blocknx1=8
-blocknx2=8
-blocknx3=8
-
-#Gitterauflösung in Blöcken
-gridnx1=10
-gridnx2=5
+#Ordner für Simulationsergebnisse
+path=d:/temp/insitu_demo
+
+#Verfügbare Arbeitsspeicher in Byte
+memory=12e9
+
+#Pfad zum Metafile
+metafile=d:/Data/insituDemo/metafile.csv
+
+#Ausgabezeitschritt
+outstep=1
+
+#maximale Anzahl Simulationszeitschritte
+endstep=10000
+
+#Blockauflösung in Knoten
+blocknx1=8
+blocknx2=8
+blocknx3=8
+
+#Gitterauflösung in Blöcken
+gridnx1=10
+gridnx2=5
 gridnx3=5
\ No newline at end of file
diff --git a/apps/cpu/insitu_demo/insitu_demo.cpp b/apps/cpu/insitu_demo/insitu_demo.cpp
index dc6d0381ab02780c6698ad06d95791552fef844d..0e58965c47809e9f35403fc7f330ec0135588bbd 100644
--- a/apps/cpu/insitu_demo/insitu_demo.cpp
+++ b/apps/cpu/insitu_demo/insitu_demo.cpp
@@ -1,329 +1,329 @@
-#include <vfluids.h>
-
-using namespace std;
-
-
-////////////////////////////////////////////////////////////////////////
-void chanel(const char *cstr1)
-{
-   try
-   {
-
-      string machine = QUOTEME(CAB_MACHINE);
-      string pathname; 
-      int numOfThreads = 6;
-      double availMem = 0;
-
-      //CommunicatorPtr comm = FETOLCommunicator::getInstance();
-      CommunicatorPtr comm = MPICommunicator::getInstance();
-
-      int myid = comm->getProcessID();
-      int mybundle = comm->getBundleID();
-      int root = comm->getRoot();
-
-      if(machine == "BOMBADIL") 
-      {
-         pathname = "d:/temp/insitu_demo";
-         availMem = 3.0e9;
-      }
-      else if(machine == "M01" || machine == "M02")      
-      {
-         pathname = "/work/koskuche/scratch/fetol_demo";
-         availMem = 1.5e9;
-
-         if(myid==root && mybundle==root)
-         {
-            stringstream logFilename;
-            logFilename <<  pathname + "/logfile"+UbSystem::toString(UbSystem::getTimeStamp())+"_"+UbSystem::toString(mybundle)+".txt";
-            UbLog::output_policy::setStream(logFilename.str());
-         }
-      }
-      else throw UbException(UB_EXARGS, "unknown CAB_MACHINE");
-
-      ConfigFileReader cf(cstr1);
-      if ( !cf.read() )
-      {
-         std::string exceptionText = "Unable to read configuration file\n";
-         throw exceptionText;
-      }
-
-
-      pathname = cf.getValue("path");
-      availMem = UbSystem::stringTo<double>(cf.getValue("memory"));
-      string metafile = cf.getValue("metafile");
-      double outstep = UbSystem::stringTo<double>(cf.getValue("outstep"));
-      double endstep = UbSystem::stringTo<double>(cf.getValue("endstep"));
-
-      LBMUnitConverterPtr conv = LBMUnitConverterPtr(new LBMUnitConverter());
-
-      double dx = 1;
-
-      const int blocknx1 = UbSystem::stringTo<int>(cf.getValue("blocknx1")); //16;
-      const int blocknx2 = UbSystem::stringTo<int>(cf.getValue("blocknx2"));//16;
-      const int blocknx3 = UbSystem::stringTo<int>(cf.getValue("blocknx3"));//16;
-
-      const int gridNx1 = UbSystem::stringTo<int>(cf.getValue("gridnx1"));//3;
-      const int gridNx2 = UbSystem::stringTo<int>(cf.getValue("gridnx2"));//3;
-      const int gridNx3 = UbSystem::stringTo<int>(cf.getValue("gridnx3"));//3;
-
-      double L1 = gridNx1*blocknx1;
-      double L2, L3, H;
-      L2 = H = gridNx2*blocknx1;
-      L3 = gridNx3*blocknx1;
-
-      LBMReal radius = 7;
-      LBMReal uLB = 0.01;
-      LBMReal Re = 3000.0;
-      LBMReal rhoLB = 0.0;
-      LBMReal l = L2 / dx;
-      LBMReal nueLB = (((4.0/9.0)*uLB)*2.0*(radius/dx))/Re;
-
-      Grid3DPtr grid(new Grid3D(comm));
-      grid->setDeltaX(dx);
-      grid->setBlockNX(blocknx1, blocknx2, blocknx3);
-
-      //UbSchedulerPtr restartSch(new UbScheduler(10000, 10000, 100000));
-      //RestartPostprocessor rp(grid, restartSch, comm, pathname+"/checkpoints", RestartPostprocessor::BINARY);
-      //grid = rp.restart(-1);
-
-      if (grid->getTimeStep() == 0)
-      {
-
-         const int baseLevel = 0;
-         const int refineLevel = 0;
-
-         //obstacle
-         GbObject3DPtr cylinder(new GbCylinder3D(L1*0.5, L2*0.5, 0, L1*0.5, L2*0.5, L3, radius));
-         GbSystem3D::writeGeoObject(cylinder.get(),pathname + "/geo/cylinder", WbWriterVtkXmlBinary::getInstance());
-
-         D3Q27InteractorPtr cylinderInt;
-
-         //bounding box
-         double d_minX1 = 0.0;
-         double d_minX2 = 0.0;
-         double d_minX3 = 0.0;
-
-         double d_maxX1 = L1;
-         double d_maxX2 = L2;
-         double d_maxX3 = L3;
-
-
-         double blockLength = blocknx1*dx;
-
-         //refinement area
-         double off = 1;
-         GbObject3DPtr refineCube(new  GbCuboid3D(cylinder->getX1Minimum()-off, cylinder->getX2Minimum()-off, cylinder->getX3Minimum(), 
-            cylinder->getX1Maximum()+off, cylinder->getX2Maximum()+off, cylinder->getX3Maximum()));
-
-         GbObject3DPtr gridCube(new GbCuboid3D(d_minX1, d_minX2, d_minX3, d_maxX1, d_maxX2, d_maxX3));
-         if(myid ==0) GbSystem3D::writeGeoObject(gridCube.get(),pathname + "/geo/gridCube", WbWriterVtkXmlBinary::getInstance()); 
-
-         GenBlocksGridVisitor genBlocks(gridCube);
-         grid->accept(genBlocks);
-
-         if(myid ==0)
-         {
-            UBLOG(logINFO,"Parameters:");
-            UBLOG(logINFO,"L = " << L2/dx );
-            UBLOG(logINFO,"v = " << uLB );
-            UBLOG(logINFO,"rho = " << rhoLB );
-            UBLOG(logINFO,"nue = " << nueLB );
-            UBLOG(logINFO,"Re = " << Re );
-            UBLOG(logINFO,"dx = " << dx );
-            UBLOG(logINFO,"number of levels = " << refineLevel+1 );
-            UBLOG(logINFO,"numOfThreads = " << numOfThreads );
-            UBLOG(logINFO,"Preprozess - start");
-         }
-
-         if(myid ==0) GbSystem3D::writeGeoObject(refineCube.get(),pathname + "/geo/refineCube", WbWriterVtkXmlBinary::getInstance());
-
-         //walls
-         GbCuboid3DPtr addWallYmin (new GbCuboid3D(d_minX1-4.0*blockLength, d_minX2-4.0*blockLength, d_minX3-4.0*blockLength, d_maxX1+4.0*blockLength, d_minX2, d_maxX3+4.0*blockLength));
-         if(myid == 0) GbSystem3D::writeGeoObject(addWallYmin.get(), pathname+"/geo/addWallYmin", WbWriterVtkXmlASCII::getInstance());
-
-         GbCuboid3DPtr addWallZmin (new GbCuboid3D(d_minX1-4.0*blockLength, d_minX2-4.0*blockLength, d_minX3-4.0*blockLength, d_maxX1+4.0*blockLength, d_maxX2+4.0*blockLength, d_minX3));
-         if(myid == 0) GbSystem3D::writeGeoObject(addWallZmin.get(), pathname+"/geo/addWallZmin", WbWriterVtkXmlASCII::getInstance());
-
-         GbCuboid3DPtr addWallYmax (new GbCuboid3D(d_minX1-4.0*blockLength, d_maxX2, d_minX3-4.0*blockLength, d_maxX1+4.0*blockLength, d_maxX2+4.0*blockLength, d_maxX3+4.0*blockLength));
-         if(myid == 0) GbSystem3D::writeGeoObject(addWallYmax.get(), pathname+"/geo/addWallYmax", WbWriterVtkXmlASCII::getInstance());
-
-         GbCuboid3DPtr addWallZmax (new GbCuboid3D(d_minX1-4.0*blockLength, d_minX2-4.0*blockLength, d_maxX3, d_maxX1+4.0*blockLength, d_maxX2+4.0*blockLength, d_maxX3+4.0*blockLength));
-         if(myid == 0) GbSystem3D::writeGeoObject(addWallZmax.get(), pathname+"/geo/addWallZmax", WbWriterVtkXmlASCII::getInstance());
-
-         //inflow
-         GbCuboid3DPtr geoInflow (new GbCuboid3D(d_minX1-4.0*blockLength, d_minX2-4.0*blockLength, d_minX3-4.0*blockLength, d_minX1, d_maxX2+4.0*blockLength, d_maxX3+4.0*blockLength));
-         if(myid == 0) GbSystem3D::writeGeoObject(geoInflow.get(), pathname+"/geo/geoInflow", WbWriterVtkXmlASCII::getInstance());
-
-         //outflow
-         GbCuboid3DPtr geoOutflow (new GbCuboid3D(d_maxX1, d_minX2-4.0*blockLength, d_minX3-4.0*blockLength, d_maxX1+4.0*blockLength, d_maxX2+4.0*blockLength, d_maxX3+4.0*blockLength));
-         if(myid == 0) GbSystem3D::writeGeoObject(geoOutflow.get(), pathname+"/geo/geoOutflow", WbWriterVtkXmlASCII::getInstance());
-
-         BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname + "/grid/blocks", WbWriterVtkXmlBinary::getInstance(), comm));
-
-         if (refineLevel > 0)
-         {
-            if(myid == 0) UBLOG(logINFO,"Refinement - start");	
-            RefineCrossAndInsideGbObjectHelper refineHelper(grid, refineLevel);
-            refineHelper.addGbObject(refineCube, 1);
-            refineHelper.refine();
-            if(myid == 0) UBLOG(logINFO,"Refinement - end");	
-         }
-
-         int bbOption = 1; //0=simple Bounce Back, 1=quadr. BB
-         D3Q27BoundaryConditionAdapterPtr bcObst(new D3Q27NoSlipBCAdapter(bbOption));
-         cylinderInt = D3Q27InteractorPtr ( new D3Q27Interactor(cylinder, grid, bcObst,Interactor3D::SOLID));
-
-         //walls
-         D3Q27InteractorPtr addWallYminInt(new D3Q27Interactor(addWallYmin, grid, bcObst,Interactor3D::SOLID));
-         D3Q27InteractorPtr addWallZminInt(new D3Q27Interactor(addWallZmin, grid, bcObst,Interactor3D::SOLID));
-         D3Q27InteractorPtr addWallYmaxInt(new D3Q27Interactor(addWallYmax, grid, bcObst,Interactor3D::SOLID));
-         D3Q27InteractorPtr addWallZmaxInt(new D3Q27Interactor(addWallZmax, grid, bcObst,Interactor3D::SOLID));
-
-         mu::Parser fct;
-         fct.SetExpr("16*U*x2*x3*(H-x2)*(H-x3)/H^4");
-         fct.DefineConst("U", uLB);
-         fct.DefineConst("H", H);
-
-         //inflow
-         D3Q27BoundaryConditionAdapterPtr velBCAdapter(new D3Q27VelocityBCAdapter (true, false ,false ,fct, 0, D3Q27BCFunction::INFCONST));
-         velBCAdapter->setSecondaryBcOption(2);
-         D3Q27InteractorPtr inflowInt  = D3Q27InteractorPtr( new D3Q27Interactor(geoInflow, grid, velBCAdapter, Interactor3D::SOLID));
-
-         //outflow
-         D3Q27BoundaryConditionAdapterPtr denBCAdapter(new D3Q27DensityBCAdapter(rhoLB));
-         D3Q27InteractorPtr outflowInt = D3Q27InteractorPtr( new D3Q27Interactor(geoOutflow, grid, denBCAdapter,Interactor3D::SOLID));
-
-         Grid3DVisitorPtr metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B));
-         InteractorsHelper intHelper(grid, metisVisitor);
-         //intHelper.addInteractor(cylinderInt);
-         intHelper.addInteractor(addWallYminInt);
-         intHelper.addInteractor(addWallZminInt);
-         intHelper.addInteractor(addWallYmaxInt);
-         intHelper.addInteractor(addWallZmaxInt);
-         intHelper.addInteractor(inflowInt);
-         intHelper.addInteractor(outflowInt);
-         intHelper.selectBlocks();
-
-         ppblocks->update(0);
-         ppblocks.reset();
-
-         //set connectors
-         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27OffsetInterpolationProcessor());
-         //FETOLSetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
-         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
-         grid->accept( setConnsVisitor );
-
-         //domain decomposition for threads
-         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
-         grid->accept(pqPartVisitor);
-
-         unsigned long nob = grid->getNumberOfBlocks();
-         int gl = 3;
-         unsigned long nod = nob * (blocknx1+gl) * (blocknx2+gl) * (blocknx3+gl);
-
-         double needMemAll  = double(nod*(27*sizeof(double) + sizeof(int) + sizeof(float)*4));
-         double needMem  = needMemAll / double(comm->getNumberOfProcesses());
-
-         if(myid == 0)
-         {
-            UBLOG(logINFO,"Number of blocks = " << nob);
-            UBLOG(logINFO,"Number of nodes  = " << nod);
-            UBLOG(logINFO,"Necessary memory  = " << needMemAll  << " bytes");
-            UBLOG(logINFO,"Necessary memory per process = " << needMem  << " bytes");
-            UBLOG(logINFO,"Available memory per process = " << availMem << " bytes");
-         }            
-
-         //LBMKernel3DPtr kernel(new LBMKernelETD3Q27Cascaded(blocknx1, blocknx2, blocknx3));
-         //LBMKernel3DPtr kernel(new LBMKernelETD3Q27BGK(blocknx1, blocknx2, blocknx3, true));
-         //option = 0 - ohne param., option = 1 - mit param.
-         //int option = 0;
-         LBMKernel3DPtr kernel(new LBMKernelETD3Q27CCLB(blocknx1, blocknx2, blocknx3, LBMKernelETD3Q27CCLB::NORMAL));
-
-         BCProcessorPtr bcProc(new D3Q27ETBCProcessor());
-         kernel->setBCProcessor(bcProc);
-
-         SetKernelBlockVisitor kernelVisitor(kernel, nueLB, availMem, needMem);
-         grid->accept(kernelVisitor);
-
-         if (refineLevel > 0)
-         {
-            D3Q27SetUndefinedNodesBlockVisitor undefNodesVisitor;
-            grid->accept(undefNodesVisitor);
-         }
-
-         intHelper.setBC();
-
-         //initialization of distributions
-         D3Q27ETInitDistributionsBlockVisitor initVisitor(nueLB, rhoLB);
-         //initVisitor.setVx1(fct);
-         grid->accept(initVisitor);
-
-         //Postrozess
-         UbSchedulerPtr geoSch(new UbScheduler(1));
-         D3Q27MacroscopicQuantitiesPostprocessorPtr ppgeo(
-            new D3Q27MacroscopicQuantitiesPostprocessor(grid, geoSch, pathname + "/grid/nodes", WbWriterVtkXmlBinary::getInstance(), conv, true));
-         ppgeo->update(0);
-         ppgeo.reset();
-
-         if(myid == 0) UBLOG(logINFO,"Preprozess - end"); 
-      }
-      else
-      {
-         //set connectors
-         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27OffsetInterpolationProcessor());
-         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
-         grid->accept( setConnsVisitor );
-      }
-
-      UbSchedulerPtr stepSch(new UbScheduler(outstep));
-      //D3Q27MacroscopicQuantitiesPostprocessor pp(grid, stepSch, pathname + "/steps/step", WbWriterVtkXmlBinary::getInstance(), conv);
-
-      InSituVTKPostprocessor isp(grid, stepSch, metafile, conv);
-      //isp.update(0);
-
-      UbSchedulerPtr nupsSch(new UbScheduler(10, 30, 100));
-      NUPSCounterPostprocessor npr(grid, nupsSch, pathname + "/results/nups.txt", comm);
-
-      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endstep, stepSch));
-      
-      if(myid == 0) 
-         UBLOG(logINFO,"Simulation-start");
-      
-      calculation->calculate();
-      
-      if(myid == 0) 
-         UBLOG(logINFO,"Simulation-end");
-   }
-   catch(std::exception& e)
-   {
-      cerr << e.what() << endl << flush;
-   }
-   catch(std::string& s)
-   {
-      cerr << s << endl;
-   }
-   catch(...)
-   {
-      cerr << "unknown exception" << endl;
-   }
-
-}
-
-//////////////////////////////////////////////////////////////////////////
-int main(int argc, char* argv[])
-{
-   if ( argv != NULL )
-   {
-      if (argc > 1)
-      {
-            chanel(argv[1]);
-      }
-      else
-      {
-         cout << "Configuration file must be set!: " <<  argv[0] << " <config file>" << endl << std::flush;
-      }
-   }
-
-   return 0;
-}
-
+#include <vfluids.h>
+
+using namespace std;
+
+
+////////////////////////////////////////////////////////////////////////
+void chanel(const char *cstr1)
+{
+   try
+   {
+
+      string machine = QUOTEME(CAB_MACHINE);
+      string pathname; 
+      int numOfThreads = 6;
+      double availMem = 0;
+
+      //CommunicatorPtr comm = FETOLCommunicator::getInstance();
+      CommunicatorPtr comm = MPICommunicator::getInstance();
+
+      int myid = comm->getProcessID();
+      int mybundle = comm->getBundleID();
+      int root = comm->getRoot();
+
+      if(machine == "BOMBADIL") 
+      {
+         pathname = "d:/temp/insitu_demo";
+         availMem = 3.0e9;
+      }
+      else if(machine == "M01" || machine == "M02")      
+      {
+         pathname = "/work/koskuche/scratch/fetol_demo";
+         availMem = 1.5e9;
+
+         if(myid==root && mybundle==root)
+         {
+            stringstream logFilename;
+            logFilename <<  pathname + "/logfile"+UbSystem::toString(UbSystem::getTimeStamp())+"_"+UbSystem::toString(mybundle)+".txt";
+            UbLog::output_policy::setStream(logFilename.str());
+         }
+      }
+      else throw UbException(UB_EXARGS, "unknown CAB_MACHINE");
+
+      ConfigFileReader cf(cstr1);
+      if ( !cf.read() )
+      {
+         std::string exceptionText = "Unable to read configuration file\n";
+         throw exceptionText;
+      }
+
+
+      pathname = cf.getValue("path");
+      availMem = UbSystem::stringTo<double>(cf.getValue("memory"));
+      string metafile = cf.getValue("metafile");
+      double outstep = UbSystem::stringTo<double>(cf.getValue("outstep"));
+      double endstep = UbSystem::stringTo<double>(cf.getValue("endstep"));
+
+      LBMUnitConverterPtr conv = LBMUnitConverterPtr(new LBMUnitConverter());
+
+      double dx = 1;
+
+      const int blocknx1 = UbSystem::stringTo<int>(cf.getValue("blocknx1")); //16;
+      const int blocknx2 = UbSystem::stringTo<int>(cf.getValue("blocknx2"));//16;
+      const int blocknx3 = UbSystem::stringTo<int>(cf.getValue("blocknx3"));//16;
+
+      const int gridNx1 = UbSystem::stringTo<int>(cf.getValue("gridnx1"));//3;
+      const int gridNx2 = UbSystem::stringTo<int>(cf.getValue("gridnx2"));//3;
+      const int gridNx3 = UbSystem::stringTo<int>(cf.getValue("gridnx3"));//3;
+
+      double L1 = gridNx1*blocknx1;
+      double L2, L3, H;
+      L2 = H = gridNx2*blocknx1;
+      L3 = gridNx3*blocknx1;
+
+      LBMReal radius = 7;
+      LBMReal uLB = 0.01;
+      LBMReal Re = 3000.0;
+      LBMReal rhoLB = 0.0;
+      LBMReal l = L2 / dx;
+      LBMReal nueLB = (((4.0/9.0)*uLB)*2.0*(radius/dx))/Re;
+
+      Grid3DPtr grid(new Grid3D(comm));
+      grid->setDeltaX(dx);
+      grid->setBlockNX(blocknx1, blocknx2, blocknx3);
+
+      //UbSchedulerPtr restartSch(new UbScheduler(10000, 10000, 100000));
+      //RestartPostprocessor rp(grid, restartSch, comm, pathname+"/checkpoints", RestartPostprocessor::BINARY);
+      //grid = rp.restart(-1);
+
+      if (grid->getTimeStep() == 0)
+      {
+
+         const int baseLevel = 0;
+         const int refineLevel = 0;
+
+         //obstacle
+         GbObject3DPtr cylinder(new GbCylinder3D(L1*0.5, L2*0.5, 0, L1*0.5, L2*0.5, L3, radius));
+         GbSystem3D::writeGeoObject(cylinder.get(),pathname + "/geo/cylinder", WbWriterVtkXmlBinary::getInstance());
+
+         D3Q27InteractorPtr cylinderInt;
+
+         //bounding box
+         double d_minX1 = 0.0;
+         double d_minX2 = 0.0;
+         double d_minX3 = 0.0;
+
+         double d_maxX1 = L1;
+         double d_maxX2 = L2;
+         double d_maxX3 = L3;
+
+
+         double blockLength = blocknx1*dx;
+
+         //refinement area
+         double off = 1;
+         GbObject3DPtr refineCube(new  GbCuboid3D(cylinder->getX1Minimum()-off, cylinder->getX2Minimum()-off, cylinder->getX3Minimum(), 
+            cylinder->getX1Maximum()+off, cylinder->getX2Maximum()+off, cylinder->getX3Maximum()));
+
+         GbObject3DPtr gridCube(new GbCuboid3D(d_minX1, d_minX2, d_minX3, d_maxX1, d_maxX2, d_maxX3));
+         if(myid ==0) GbSystem3D::writeGeoObject(gridCube.get(),pathname + "/geo/gridCube", WbWriterVtkXmlBinary::getInstance()); 
+
+         GenBlocksGridVisitor genBlocks(gridCube);
+         grid->accept(genBlocks);
+
+         if(myid ==0)
+         {
+            UBLOG(logINFO,"Parameters:");
+            UBLOG(logINFO,"L = " << L2/dx );
+            UBLOG(logINFO,"v = " << uLB );
+            UBLOG(logINFO,"rho = " << rhoLB );
+            UBLOG(logINFO,"nue = " << nueLB );
+            UBLOG(logINFO,"Re = " << Re );
+            UBLOG(logINFO,"dx = " << dx );
+            UBLOG(logINFO,"number of levels = " << refineLevel+1 );
+            UBLOG(logINFO,"numOfThreads = " << numOfThreads );
+            UBLOG(logINFO,"Preprozess - start");
+         }
+
+         if(myid ==0) GbSystem3D::writeGeoObject(refineCube.get(),pathname + "/geo/refineCube", WbWriterVtkXmlBinary::getInstance());
+
+         //walls
+         GbCuboid3DPtr addWallYmin (new GbCuboid3D(d_minX1-4.0*blockLength, d_minX2-4.0*blockLength, d_minX3-4.0*blockLength, d_maxX1+4.0*blockLength, d_minX2, d_maxX3+4.0*blockLength));
+         if(myid == 0) GbSystem3D::writeGeoObject(addWallYmin.get(), pathname+"/geo/addWallYmin", WbWriterVtkXmlASCII::getInstance());
+
+         GbCuboid3DPtr addWallZmin (new GbCuboid3D(d_minX1-4.0*blockLength, d_minX2-4.0*blockLength, d_minX3-4.0*blockLength, d_maxX1+4.0*blockLength, d_maxX2+4.0*blockLength, d_minX3));
+         if(myid == 0) GbSystem3D::writeGeoObject(addWallZmin.get(), pathname+"/geo/addWallZmin", WbWriterVtkXmlASCII::getInstance());
+
+         GbCuboid3DPtr addWallYmax (new GbCuboid3D(d_minX1-4.0*blockLength, d_maxX2, d_minX3-4.0*blockLength, d_maxX1+4.0*blockLength, d_maxX2+4.0*blockLength, d_maxX3+4.0*blockLength));
+         if(myid == 0) GbSystem3D::writeGeoObject(addWallYmax.get(), pathname+"/geo/addWallYmax", WbWriterVtkXmlASCII::getInstance());
+
+         GbCuboid3DPtr addWallZmax (new GbCuboid3D(d_minX1-4.0*blockLength, d_minX2-4.0*blockLength, d_maxX3, d_maxX1+4.0*blockLength, d_maxX2+4.0*blockLength, d_maxX3+4.0*blockLength));
+         if(myid == 0) GbSystem3D::writeGeoObject(addWallZmax.get(), pathname+"/geo/addWallZmax", WbWriterVtkXmlASCII::getInstance());
+
+         //inflow
+         GbCuboid3DPtr geoInflow (new GbCuboid3D(d_minX1-4.0*blockLength, d_minX2-4.0*blockLength, d_minX3-4.0*blockLength, d_minX1, d_maxX2+4.0*blockLength, d_maxX3+4.0*blockLength));
+         if(myid == 0) GbSystem3D::writeGeoObject(geoInflow.get(), pathname+"/geo/geoInflow", WbWriterVtkXmlASCII::getInstance());
+
+         //outflow
+         GbCuboid3DPtr geoOutflow (new GbCuboid3D(d_maxX1, d_minX2-4.0*blockLength, d_minX3-4.0*blockLength, d_maxX1+4.0*blockLength, d_maxX2+4.0*blockLength, d_maxX3+4.0*blockLength));
+         if(myid == 0) GbSystem3D::writeGeoObject(geoOutflow.get(), pathname+"/geo/geoOutflow", WbWriterVtkXmlASCII::getInstance());
+
+         BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname + "/grid/blocks", WbWriterVtkXmlBinary::getInstance(), comm));
+
+         if (refineLevel > 0)
+         {
+            if(myid == 0) UBLOG(logINFO,"Refinement - start");	
+            RefineCrossAndInsideGbObjectHelper refineHelper(grid, refineLevel);
+            refineHelper.addGbObject(refineCube, 1);
+            refineHelper.refine();
+            if(myid == 0) UBLOG(logINFO,"Refinement - end");	
+         }
+
+         int bbOption = 1; //0=simple Bounce Back, 1=quadr. BB
+         D3Q27BoundaryConditionAdapterPtr bcObst(new D3Q27NoSlipBCAdapter(bbOption));
+         cylinderInt = D3Q27InteractorPtr ( new D3Q27Interactor(cylinder, grid, bcObst,Interactor3D::SOLID));
+
+         //walls
+         D3Q27InteractorPtr addWallYminInt(new D3Q27Interactor(addWallYmin, grid, bcObst,Interactor3D::SOLID));
+         D3Q27InteractorPtr addWallZminInt(new D3Q27Interactor(addWallZmin, grid, bcObst,Interactor3D::SOLID));
+         D3Q27InteractorPtr addWallYmaxInt(new D3Q27Interactor(addWallYmax, grid, bcObst,Interactor3D::SOLID));
+         D3Q27InteractorPtr addWallZmaxInt(new D3Q27Interactor(addWallZmax, grid, bcObst,Interactor3D::SOLID));
+
+         mu::Parser fct;
+         fct.SetExpr("16*U*x2*x3*(H-x2)*(H-x3)/H^4");
+         fct.DefineConst("U", uLB);
+         fct.DefineConst("H", H);
+
+         //inflow
+         D3Q27BoundaryConditionAdapterPtr velBCAdapter(new D3Q27VelocityBCAdapter (true, false ,false ,fct, 0, D3Q27BCFunction::INFCONST));
+         velBCAdapter->setSecondaryBcOption(2);
+         D3Q27InteractorPtr inflowInt  = D3Q27InteractorPtr( new D3Q27Interactor(geoInflow, grid, velBCAdapter, Interactor3D::SOLID));
+
+         //outflow
+         D3Q27BoundaryConditionAdapterPtr denBCAdapter(new D3Q27DensityBCAdapter(rhoLB));
+         D3Q27InteractorPtr outflowInt = D3Q27InteractorPtr( new D3Q27Interactor(geoOutflow, grid, denBCAdapter,Interactor3D::SOLID));
+
+         Grid3DVisitorPtr metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B));
+         InteractorsHelper intHelper(grid, metisVisitor);
+         //intHelper.addInteractor(cylinderInt);
+         intHelper.addInteractor(addWallYminInt);
+         intHelper.addInteractor(addWallZminInt);
+         intHelper.addInteractor(addWallYmaxInt);
+         intHelper.addInteractor(addWallZmaxInt);
+         intHelper.addInteractor(inflowInt);
+         intHelper.addInteractor(outflowInt);
+         intHelper.selectBlocks();
+
+         ppblocks->update(0);
+         ppblocks.reset();
+
+         //set connectors
+         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27OffsetInterpolationProcessor());
+         //FETOLSetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
+         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
+         grid->accept( setConnsVisitor );
+
+         //domain decomposition for threads
+         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
+         grid->accept(pqPartVisitor);
+
+         unsigned long nob = grid->getNumberOfBlocks();
+         int gl = 3;
+         unsigned long nod = nob * (blocknx1+gl) * (blocknx2+gl) * (blocknx3+gl);
+
+         double needMemAll  = double(nod*(27*sizeof(double) + sizeof(int) + sizeof(float)*4));
+         double needMem  = needMemAll / double(comm->getNumberOfProcesses());
+
+         if(myid == 0)
+         {
+            UBLOG(logINFO,"Number of blocks = " << nob);
+            UBLOG(logINFO,"Number of nodes  = " << nod);
+            UBLOG(logINFO,"Necessary memory  = " << needMemAll  << " bytes");
+            UBLOG(logINFO,"Necessary memory per process = " << needMem  << " bytes");
+            UBLOG(logINFO,"Available memory per process = " << availMem << " bytes");
+         }            
+
+         //LBMKernel3DPtr kernel(new LBMKernelETD3Q27Cascaded(blocknx1, blocknx2, blocknx3));
+         //LBMKernel3DPtr kernel(new LBMKernelETD3Q27BGK(blocknx1, blocknx2, blocknx3, true));
+         //option = 0 - ohne param., option = 1 - mit param.
+         //int option = 0;
+         LBMKernel3DPtr kernel(new LBMKernelETD3Q27CCLB(blocknx1, blocknx2, blocknx3, LBMKernelETD3Q27CCLB::NORMAL));
+
+         BCProcessorPtr bcProc(new D3Q27ETBCProcessor());
+         kernel->setBCProcessor(bcProc);
+
+         SetKernelBlockVisitor kernelVisitor(kernel, nueLB, availMem, needMem);
+         grid->accept(kernelVisitor);
+
+         if (refineLevel > 0)
+         {
+            D3Q27SetUndefinedNodesBlockVisitor undefNodesVisitor;
+            grid->accept(undefNodesVisitor);
+         }
+
+         intHelper.setBC();
+
+         //initialization of distributions
+         D3Q27ETInitDistributionsBlockVisitor initVisitor(nueLB, rhoLB);
+         //initVisitor.setVx1(fct);
+         grid->accept(initVisitor);
+
+         //Postrozess
+         UbSchedulerPtr geoSch(new UbScheduler(1));
+         D3Q27MacroscopicQuantitiesPostprocessorPtr ppgeo(
+            new D3Q27MacroscopicQuantitiesPostprocessor(grid, geoSch, pathname + "/grid/nodes", WbWriterVtkXmlBinary::getInstance(), conv, true));
+         ppgeo->update(0);
+         ppgeo.reset();
+
+         if(myid == 0) UBLOG(logINFO,"Preprozess - end"); 
+      }
+      else
+      {
+         //set connectors
+         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27OffsetInterpolationProcessor());
+         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
+         grid->accept( setConnsVisitor );
+      }
+
+      UbSchedulerPtr stepSch(new UbScheduler(outstep));
+      //D3Q27MacroscopicQuantitiesPostprocessor pp(grid, stepSch, pathname + "/steps/step", WbWriterVtkXmlBinary::getInstance(), conv);
+
+      InSituVTKPostprocessor isp(grid, stepSch, metafile, conv);
+      //isp.update(0);
+
+      UbSchedulerPtr nupsSch(new UbScheduler(10, 30, 100));
+      NUPSCounterPostprocessor npr(grid, nupsSch, pathname + "/results/nups.txt", comm);
+
+      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endstep, stepSch));
+      
+      if(myid == 0) 
+         UBLOG(logINFO,"Simulation-start");
+      
+      calculation->calculate();
+      
+      if(myid == 0) 
+         UBLOG(logINFO,"Simulation-end");
+   }
+   catch(std::exception& e)
+   {
+      cerr << e.what() << endl << flush;
+   }
+   catch(std::string& s)
+   {
+      cerr << s << endl;
+   }
+   catch(...)
+   {
+      cerr << "unknown exception" << endl;
+   }
+
+}
+
+//////////////////////////////////////////////////////////////////////////
+int main(int argc, char* argv[])
+{
+   if ( argv != NULL )
+   {
+      if (argc > 1)
+      {
+            chanel(argv[1]);
+      }
+      else
+      {
+         cout << "Configuration file must be set!: " <<  argv[0] << " <config file>" << endl << std::flush;
+      }
+   }
+
+   return 0;
+}
+
diff --git a/apps/cpu/insitu_demoserver/CMakeLists.txt b/apps/cpu/insitu_demoserver/CMakeLists.txt
index f88611140ac6498dd878f3074bdf35e23e3dcc67..b7fd3816c02e55f9636069005f5143a3e801f269 100644
--- a/apps/cpu/insitu_demoserver/CMakeLists.txt
+++ b/apps/cpu/insitu_demoserver/CMakeLists.txt
@@ -1,25 +1,25 @@
-CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
-
-########################################################
-## C++ PROJECT                                       ###
-########################################################
-PROJECT(insitu_demoserver)
-
-INCLUDE(${SOURCE_ROOT}/lib/IncludsList.txt) 
-
-#################################################################
-###   LOCAL FILES                                             ###
-#################################################################
-FILE(GLOB SPECIFIC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.h
-                         ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
-                         ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp  )
- 
-SET(ALL_SOURCES ${ALL_SOURCES} ${SPECIFIC_FILES})
-SOURCE_GROUP(src FILES ${SPECIFIC_FILES})
-  
-SET(CAB_ADDITIONAL_LINK_LIBRARIES vfluids ${FETOL_RELEASE_LIBRARY})
-
-#################################################################
-###   CREATE PROJECT                                          ###
-#################################################################
-CREATE_CAB_PROJECT(insitu_demoserver BINARY)
+CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
+
+########################################################
+## C++ PROJECT                                       ###
+########################################################
+PROJECT(insitu_demoserver)
+
+INCLUDE(${SOURCE_ROOT}/lib/IncludsList.txt) 
+
+#################################################################
+###   LOCAL FILES                                             ###
+#################################################################
+FILE(GLOB SPECIFIC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.h
+                         ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
+                         ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp  )
+ 
+SET(ALL_SOURCES ${ALL_SOURCES} ${SPECIFIC_FILES})
+SOURCE_GROUP(src FILES ${SPECIFIC_FILES})
+  
+SET(CAB_ADDITIONAL_LINK_LIBRARIES vfluids ${FETOL_RELEASE_LIBRARY})
+
+#################################################################
+###   CREATE PROJECT                                          ###
+#################################################################
+CREATE_CAB_PROJECT(insitu_demoserver BINARY)
diff --git a/apps/cpu/insitu_demoserver/insitu_demoserver.cpp b/apps/cpu/insitu_demoserver/insitu_demoserver.cpp
index c3f9d3912bc8525d6280360be4ab8eed19332e74..c52d50fcd4567e994f2dfcf912dfac37d149f439 100644
--- a/apps/cpu/insitu_demoserver/insitu_demoserver.cpp
+++ b/apps/cpu/insitu_demoserver/insitu_demoserver.cpp
@@ -1,229 +1,229 @@
-#define vtkRenderingCore_AUTOINIT 4(vtkInteractionStyle,vtkRenderingFreeType,vtkRenderingFreeTypeOpenGL,vtkRenderingOpenGL)
-#define vtkRenderingVolume_AUTOINIT 1(vtkRenderingVolumeOpenGL)
-
-#include "vtkActor.h"
-#include "vtkContourFilter.h"
-#include "vtkDataSetMapper.h"
-#include "vtkDebugLeaks.h"
-#include "vtkDoubleArray.h"
-#include "vtkPolyData.h"
-#include "vtkPolyDataMapper.h"
-#include "vtkRectilinearGrid.h"
-#include "vtkRegressionTestImage.h"
-#include "vtkRenderWindow.h"
-#include "vtkOpenGLRenderer.h"
-#include "vtkSocketCommunicator.h"
-#include "vtkSocketController.h"
-#include "vtkStructuredGrid.h"
-#include "vtkImageData.h"
-#include "vtkUnstructuredGrid.h"
-#include "vtkCamera.h"
-#include "vtkImageActor.h"
-#include <vtkXMLUnstructuredGridWriter.h>
-#include "vtkRenderWindowInteractor.h"
-#include "vtkOpenGLActor.h"
-#include "vtkSmartPointer.h"
-#include "vtkInteractorStyleTrackballCamera.h"
-#include <vtkProperty.h>
-#include <vtkPointData.h>
-#include <vtkPlane.h>
-#include <vtkCutter.h>
-
-#include <boost/thread.hpp>
-
-#define VTK_CREATE(type, name) \
-   vtkSmartPointer<type> name = vtkSmartPointer<type>::New()
-
-
-static const int scMsgLength = 10;
-
-static void CleanUp(vtkSmartPointer<vtkSocketCommunicator> vtkNotUsed(comm),
-                    vtkSmartPointer<vtkSocketController> vtkNotUsed(contr))
-{
-   // This will close the connection as well as delete
-   // the communicator
-   // Deleting no longer necessary with smart pointers.
-   //   comm->Delete();
-   //   contr->Delete();
-}
-
-using namespace std;
-
-vtkSmartPointer<vtkSocketController> contr;
-vtkSmartPointer<vtkSocketCommunicator> comm;
-
-void receive(vtkSmartPointer<vtkUnstructuredGrid> ugrid, vtkSmartPointer<vtkDataSetMapper> umapper, vtkSmartPointer<vtkRenderWindow> renWin)
-{
-   int step;
-   while (true)
-   {
-      if (!comm->Receive(&step, 1, 1, 11))
-      {
-         cerr << "Server error: Error receiving data." << endl;
-         CleanUp(comm, contr);
-         return;
-      }
-
-      cout << "step: "<<step<<"\n";
-
-      if (!comm->Receive(ugrid, 1, 9))
-      {
-         cerr << "Client error: Error receiving data." << endl;
-         CleanUp(comm, contr);
-         return;
-      }
-      double range[2];
-      ugrid->GetPointData()->GetArray("Vx")->GetRange(range);
-      umapper->SetScalarRange(range);
-      umapper->Update();
-      //renWin->Render();
-   }
-}
-
-////////////////////////////////////////////////////////////////////////
-void server()
-{
-   try
-   {
-      contr = vtkSmartPointer<vtkSocketController>::New();
-      contr->Initialize();
-
-      comm = vtkSmartPointer<vtkSocketCommunicator>::New();
-
-      string hostname = "localhost";
-      int port=11111;
-
-      // Establish connection
-      if (!comm->WaitForConnection(port))
-      {
-         cerr << "Server error: Wait timed out or could not initialize socket." << endl;
-         return;
-      }
-
-      // Test receiving vtkDataObject
-      VTK_CREATE(vtkUnstructuredGrid, ugrid);
-
-      int step;
-
-      if (!comm->Receive(&step, 1, 1, 11))
-      {
-         cerr << "Server error: Error receiving data." << endl;
-         CleanUp(comm, contr);
-         return;
-      }
-
-      cout << "step: "<<step<<"\n";
-
-      if (!comm->Receive(ugrid, 1, 9))
-      {
-         cerr << "Client error: Error receiving data." << endl;
-         CleanUp(comm, contr);
-         return;
-      }
-
-      vtkSmartPointer<vtkXMLUnstructuredGridWriter> writer = vtkSmartPointer<vtkXMLUnstructuredGridWriter>::New();
-      writer->SetInput(ugrid);
-      writer->SetFileName("test.vtu");
-      writer->SetDataModeToAscii();
-      writer->Update();
-
-      //vtkPlane
-      vtkSmartPointer<vtkPlane> plane = vtkPlane::New();
-      plane->SetNormal(0.0, 1.0, 0.0);
-      plane->SetOrigin(40, 19.5, 19.5);
-
-      //Cut
-      vtkSmartPointer<vtkCutter> planeCut = vtkCutter::New();
-      planeCut->SetInput(ugrid);
-      planeCut->SetCutFunction(plane);
-      planeCut->Update();
-
-      VTK_CREATE(vtkDataSetMapper, umapper);
-      //umapper->SetInput(planeCut->GetOutput());
-      umapper->SetInput(ugrid);
-
-      umapper->SetScalarModeToUsePointFieldData();
-      umapper->SetColorModeToMapScalars();
-      umapper->ScalarVisibilityOn();
-      double range[2];
-      //planeCut->GetOutput()->GetPointData()->GetArray("Vx")->GetRange(range);
-      ugrid->GetPointData()->GetArray("Vx")->GetRange(range);
-      umapper->SetScalarRange(range);
-      umapper->SelectColorArray("Vx");
-
-      VTK_CREATE(vtkActor, uactor);
-      uactor->SetMapper(umapper);
-
-      VTK_CREATE(vtkRenderer, ren);
-      ren->AddActor(uactor);
-      ren->SetBackground( 0.1, 0.2, 0.4 );
-
-      VTK_CREATE(vtkRenderWindow, renWin);
-      renWin->SetSize(1024,800);
-      renWin->AddRenderer(ren);
-
-      //while (true)
-      //{
-      //   if (!comm->Receive(&step, 1, 1, 11))
-      //   {
-      //      cerr << "Server error: Error receiving data." << endl;
-      //      CleanUp(comm, contr);
-      //      return;
-      //   }
-
-      //   cout << "step: "<<step<<"\n";
-
-      //   if (!comm->Receive(ugrid, 1, 9))
-      //   {
-      //      cerr << "Client error: Error receiving data." << endl;
-      //      CleanUp(comm, contr);
-      //      return;
-      //   }
-
-      //   //writer->Update();
-      //   
-      //   planeCut->Update();
-      //   planeCut->GetOutput()->GetPointData()->GetArray("Vx")->GetRange(range);
-      //   umapper->SetScalarRange(range);
-      //   umapper->Update();
-      //   renWin->Render();
-      //}
-
-      boost::thread t(boost::bind( &receive, ugrid, umapper,renWin));
-
-      vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
-      iren->SetRenderWindow(renWin);
-
-      vtkInteractorStyleTrackballCamera *style = vtkInteractorStyleTrackballCamera::New();
-      iren->SetInteractorStyle(style);
-
-      iren->Initialize();
-      iren->Start();
-
-      iren->Delete();
-      style->Delete();
-
-      CleanUp(comm, contr);
-
-   }
-   catch(std::exception& e)
-   {
-      cerr << e.what() << endl << flush;
-   }
-   catch(std::string& s)
-   {
-      cerr << s << endl;
-   }
-   catch(...)
-   {
-      cerr << "unknown exception" << endl;
-   }
-
-}
-
-//////////////////////////////////////////////////////////////////////////
-int main(int argc, char* argv[])
-{
-   server();
-}
-
+#define vtkRenderingCore_AUTOINIT 4(vtkInteractionStyle,vtkRenderingFreeType,vtkRenderingFreeTypeOpenGL,vtkRenderingOpenGL)
+#define vtkRenderingVolume_AUTOINIT 1(vtkRenderingVolumeOpenGL)
+
+#include "vtkActor.h"
+#include "vtkContourFilter.h"
+#include "vtkDataSetMapper.h"
+#include "vtkDebugLeaks.h"
+#include "vtkDoubleArray.h"
+#include "vtkPolyData.h"
+#include "vtkPolyDataMapper.h"
+#include "vtkRectilinearGrid.h"
+#include "vtkRegressionTestImage.h"
+#include "vtkRenderWindow.h"
+#include "vtkOpenGLRenderer.h"
+#include "vtkSocketCommunicator.h"
+#include "vtkSocketController.h"
+#include "vtkStructuredGrid.h"
+#include "vtkImageData.h"
+#include "vtkUnstructuredGrid.h"
+#include "vtkCamera.h"
+#include "vtkImageActor.h"
+#include <vtkXMLUnstructuredGridWriter.h>
+#include "vtkRenderWindowInteractor.h"
+#include "vtkOpenGLActor.h"
+#include "vtkSmartPointer.h"
+#include "vtkInteractorStyleTrackballCamera.h"
+#include <vtkProperty.h>
+#include <vtkPointData.h>
+#include <vtkPlane.h>
+#include <vtkCutter.h>
+
+#include <boost/thread.hpp>
+
+#define VTK_CREATE(type, name) \
+   vtkSmartPointer<type> name = vtkSmartPointer<type>::New()
+
+
+static const int scMsgLength = 10;
+
+static void CleanUp(vtkSmartPointer<vtkSocketCommunicator> vtkNotUsed(comm),
+                    vtkSmartPointer<vtkSocketController> vtkNotUsed(contr))
+{
+   // This will close the connection as well as delete
+   // the communicator
+   // Deleting no longer necessary with smart pointers.
+   //   comm->Delete();
+   //   contr->Delete();
+}
+
+using namespace std;
+
+vtkSmartPointer<vtkSocketController> contr;
+vtkSmartPointer<vtkSocketCommunicator> comm;
+
+void receive(vtkSmartPointer<vtkUnstructuredGrid> ugrid, vtkSmartPointer<vtkDataSetMapper> umapper, vtkSmartPointer<vtkRenderWindow> renWin)
+{
+   int step;
+   while (true)
+   {
+      if (!comm->Receive(&step, 1, 1, 11))
+      {
+         cerr << "Server error: Error receiving data." << endl;
+         CleanUp(comm, contr);
+         return;
+      }
+
+      cout << "step: "<<step<<"\n";
+
+      if (!comm->Receive(ugrid, 1, 9))
+      {
+         cerr << "Client error: Error receiving data." << endl;
+         CleanUp(comm, contr);
+         return;
+      }
+      double range[2];
+      ugrid->GetPointData()->GetArray("Vx")->GetRange(range);
+      umapper->SetScalarRange(range);
+      umapper->Update();
+      //renWin->Render();
+   }
+}
+
+////////////////////////////////////////////////////////////////////////
+void server()
+{
+   try
+   {
+      contr = vtkSmartPointer<vtkSocketController>::New();
+      contr->Initialize();
+
+      comm = vtkSmartPointer<vtkSocketCommunicator>::New();
+
+      string hostname = "localhost";
+      int port=11111;
+
+      // Establish connection
+      if (!comm->WaitForConnection(port))
+      {
+         cerr << "Server error: Wait timed out or could not initialize socket." << endl;
+         return;
+      }
+
+      // Test receiving vtkDataObject
+      VTK_CREATE(vtkUnstructuredGrid, ugrid);
+
+      int step;
+
+      if (!comm->Receive(&step, 1, 1, 11))
+      {
+         cerr << "Server error: Error receiving data." << endl;
+         CleanUp(comm, contr);
+         return;
+      }
+
+      cout << "step: "<<step<<"\n";
+
+      if (!comm->Receive(ugrid, 1, 9))
+      {
+         cerr << "Client error: Error receiving data." << endl;
+         CleanUp(comm, contr);
+         return;
+      }
+
+      vtkSmartPointer<vtkXMLUnstructuredGridWriter> writer = vtkSmartPointer<vtkXMLUnstructuredGridWriter>::New();
+      writer->SetInput(ugrid);
+      writer->SetFileName("test.vtu");
+      writer->SetDataModeToAscii();
+      writer->Update();
+
+      //vtkPlane
+      vtkSmartPointer<vtkPlane> plane = vtkPlane::New();
+      plane->SetNormal(0.0, 1.0, 0.0);
+      plane->SetOrigin(40, 19.5, 19.5);
+
+      //Cut
+      vtkSmartPointer<vtkCutter> planeCut = vtkCutter::New();
+      planeCut->SetInput(ugrid);
+      planeCut->SetCutFunction(plane);
+      planeCut->Update();
+
+      VTK_CREATE(vtkDataSetMapper, umapper);
+      //umapper->SetInput(planeCut->GetOutput());
+      umapper->SetInput(ugrid);
+
+      umapper->SetScalarModeToUsePointFieldData();
+      umapper->SetColorModeToMapScalars();
+      umapper->ScalarVisibilityOn();
+      double range[2];
+      //planeCut->GetOutput()->GetPointData()->GetArray("Vx")->GetRange(range);
+      ugrid->GetPointData()->GetArray("Vx")->GetRange(range);
+      umapper->SetScalarRange(range);
+      umapper->SelectColorArray("Vx");
+
+      VTK_CREATE(vtkActor, uactor);
+      uactor->SetMapper(umapper);
+
+      VTK_CREATE(vtkRenderer, ren);
+      ren->AddActor(uactor);
+      ren->SetBackground( 0.1, 0.2, 0.4 );
+
+      VTK_CREATE(vtkRenderWindow, renWin);
+      renWin->SetSize(1024,800);
+      renWin->AddRenderer(ren);
+
+      //while (true)
+      //{
+      //   if (!comm->Receive(&step, 1, 1, 11))
+      //   {
+      //      cerr << "Server error: Error receiving data." << endl;
+      //      CleanUp(comm, contr);
+      //      return;
+      //   }
+
+      //   cout << "step: "<<step<<"\n";
+
+      //   if (!comm->Receive(ugrid, 1, 9))
+      //   {
+      //      cerr << "Client error: Error receiving data." << endl;
+      //      CleanUp(comm, contr);
+      //      return;
+      //   }
+
+      //   //writer->Update();
+      //   
+      //   planeCut->Update();
+      //   planeCut->GetOutput()->GetPointData()->GetArray("Vx")->GetRange(range);
+      //   umapper->SetScalarRange(range);
+      //   umapper->Update();
+      //   renWin->Render();
+      //}
+
+      boost::thread t(boost::bind( &receive, ugrid, umapper,renWin));
+
+      vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
+      iren->SetRenderWindow(renWin);
+
+      vtkInteractorStyleTrackballCamera *style = vtkInteractorStyleTrackballCamera::New();
+      iren->SetInteractorStyle(style);
+
+      iren->Initialize();
+      iren->Start();
+
+      iren->Delete();
+      style->Delete();
+
+      CleanUp(comm, contr);
+
+   }
+   catch(std::exception& e)
+   {
+      cerr << e.what() << endl << flush;
+   }
+   catch(std::string& s)
+   {
+      cerr << s << endl;
+   }
+   catch(...)
+   {
+      cerr << "unknown exception" << endl;
+   }
+
+}
+
+//////////////////////////////////////////////////////////////////////////
+int main(int argc, char* argv[])
+{
+   server();
+}
+
diff --git a/apps/cpu/levels/config.txt b/apps/cpu/levels/config.txt
index f905aba06625b87f57516252430464f18f1081d2..570b16d10d0555280987d11a6b1fc20a2ff1dbb3 100644
--- a/apps/cpu/levels/config.txt
+++ b/apps/cpu/levels/config.txt
@@ -1,22 +1,22 @@
-#Ordner für Simulationsergebnisse
-path=d:/temp/levels
-
-#Verfügbare Arbeitsspeicher in Byte
-memory=5e9
-
-#Ausgabezeitschritt
-outstep=100
-
-#maximale Anzahl Simulationszeitschritte
-endstep=100
-
-#Anzahl von Threads
-threads=4
-
-#max refierment level (1 - 5)
-level=3
-
-blockNx = 8 8 8
-dim = 160 8 160
-
+#Ordner für Simulationsergebnisse
+path=d:/temp/levels
+
+#Verfügbare Arbeitsspeicher in Byte
+memory=5e9
+
+#Ausgabezeitschritt
+outstep=100
+
+#maximale Anzahl Simulationszeitschritte
+endstep=100
+
+#Anzahl von Threads
+threads=4
+
+#max refierment level (1 - 5)
+level=3
+
+blockNx = 8 8 8
+dim = 160 8 160
+
 radius = 1.5
\ No newline at end of file
diff --git a/apps/cpu/levels/levels.cpp b/apps/cpu/levels/levels.cpp
index 9f674916cf74f09840d9d259ff4ccd72af9ad277..2f9297f3aa7749db7001ddf6f0ad8f1af8525ac5 100644
--- a/apps/cpu/levels/levels.cpp
+++ b/apps/cpu/levels/levels.cpp
@@ -1,351 +1,351 @@
-#include <VirtualFluids.h>
-#include <set>
-#include <map>
-using namespace std;
-
-
-////////////////////////////////////////////////////////////////////////
-void run(string configname)
-{
-   try
-   {
-
-      //Sleep(30000);
-
-      string machine = QUOTEME(CAB_MACHINE);
-
-      SPtr<Communicator> comm = MPICommunicator::getInstance();
-
-      int myid = comm->getProcessID();
-      int mybundle = comm->getBundleID();
-      int root = comm->getRoot();
-
-      ConfigurationFile   config;
-      config.load(configname);
-
-      string pathname = config.getValue<string>("path");
-      double availMem = config.getValue<double>("memory");
-      double outstep = config.getValue<double>("outstep");
-      double endstep = config.getValue<double>("endstep");
-      int numOfThreads = config.getValue<int>("threads");
-      int refineLevel = config.getValue<int>("level");
-      vector<double> dim = config.getVector<double>("dim");
-      vector<int> blockNx = config.getVector<int>("blockNx");
-      double radius = config.getValue<double>("radius");
-
-      //LBMReal radius = 4;
-      LBMReal uLB = 0.1;
-      LBMReal Re = 1;
-      LBMReal rhoLB = 0.0;
-      //LBMReal nuLB = (uLB*2.0*radius)/Re;
-      //LBMReal nuLB = (uLB*L2)/Re;
-      LBMReal nuLB = 0.168666666667/100;
-
-      double dp_LB = 1e-6;
-      double rhoLBinflow = dp_LB*3.0;
-
-      SPtr<BCAdapter> noSlipBCAdapter(new NoSlipBCAdapter());
-      noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NoSlipBCAlgorithm()));
-
-      mu::Parser fct;
-      fct.SetExpr("U");
-      fct.DefineConst("U", uLB);
-      SPtr<BCAdapter> velBCAdapter(new VelocityBCAdapter(true, false, false, fct, 0, BCFunction::INFCONST));
-      velBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new VelocityBCAlgorithm()));
-
-      SPtr<BCAdapter> denBCAdapter(new DensityBCAdapter(rhoLB));
-      denBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NonEqDensityBCAlgorithm()));
-
-      BoundaryConditionsBlockVisitor bcVisitor;
-      bcVisitor.addBC(noSlipBCAdapter);
-      bcVisitor.addBC(velBCAdapter);
-      bcVisitor.addBC(denBCAdapter);
-
-      SPtr<LBMUnitConverter> conv = SPtr<LBMUnitConverter>(new LBMUnitConverter());
-
-      double dx = 1;
-
-      const int blocknx1 = blockNx[0];
-      const int blocknx2 = blockNx[1];
-      const int blocknx3 = blockNx[2];
-
-      SPtr<Grid3D> grid(new Grid3D(comm));
-      grid->setDeltaX(dx);
-      grid->setBlockNX(blocknx1, blocknx2, blocknx3);
-
-      //////////////////////////////////////////////////////////////////////////
-      //restart
-      SPtr<UbScheduler> restartSch(new UbScheduler(100000, 100000, 100000));
-      RestartCoProcessor rp(grid, restartSch, comm, pathname, RestartCoProcessor::BINARY);
-      //////////////////////////////////////////////////////////////////////////
-
-      if (grid->getTimeStep()==0)
-      {
-
-         const int baseLevel = 0;
-
-         //bounding box
-         double d_minX1 = 0.0;
-         double d_minX2 = 0.0;
-         double d_minX3 = 0.0;
-
-         double d_maxX1 = dim[0];
-         double d_maxX2 = dim[1];
-         double d_maxX3 = dim[2];
-
-         double blockLength = blocknx1*dx;
-
-         if (myid==0)
-         {
-            UBLOG(logINFO, "Parameters:");
-            UBLOG(logINFO, "uLB = "<<uLB);
-            UBLOG(logINFO, "rhoLB = "<<rhoLB);
-            UBLOG(logINFO, "nueLB = "<<nuLB);
-            UBLOG(logINFO, "Re = "<<Re);
-            UBLOG(logINFO, "dx = "<<dx);
-            UBLOG(logINFO, "number of levels = "<<refineLevel+1);
-            UBLOG(logINFO, "numOfThreads = "<<numOfThreads);
-            UBLOG(logINFO, "Preprozess - start");
-         }
-
-         SPtr<GbObject3D> gridCube(new GbCuboid3D(d_minX1, d_minX2, d_minX3, d_maxX1, d_maxX2, d_maxX3));
-         if (myid==0) GbSystem3D::writeGeoObject(gridCube.get(), pathname+"/geo/gridCube", WbWriterVtkXmlBinary::getInstance());
-
-         GenBlocksGridVisitor genBlocks(gridCube);
-         grid->accept(genBlocks);
-
-         //SPtr<CoordinateTransformation3D> trafo = grid->getCoordinateTransformator();
-         //trafo->setRotationX2Angle(4);
-
-         //sphere
-         //SPtr<GbObject3D> sphereRef(new GbSphere3D(L1/4.0, L2*0.5, L3*0.5, radius+1.0));
-         //GbSystem3D::writeGeoObject(sphereRef.get(),pathname + "/geo/sphereRef", WbWriterVtkXmlBinary::getInstance());
-
-
-         //sphere
-         SPtr<GbObject3D> sphere(new GbSphere3D(d_maxX1*0.5, d_maxX2*0.5, d_maxX3*0.5, radius));
-         //SPtr<GbObject3D> sphere(new GbSphere3D(L1/2.0-4.0, L2*0.5+4.0, L3*0.5+4.0, radius));
-         //SPtr<GbObject3D> sphere(new GbCuboid3D(L1/4.0-radius, L2/2.0-radius, L3/2.0-radius, L1/4.0+radius, L2/2.0+radius, L3/2.0+radius));
-         GbSystem3D::writeGeoObject(sphere.get(), pathname+"/geo/sphere", WbWriterVtkXmlBinary::getInstance());
-
-         double off = 0.0;
-         SPtr<GbObject3D> refCube(new GbCuboid3D(sphere->getX1Minimum()-off, sphere->getX2Minimum()-off, sphere->getX3Minimum(),
-            sphere->getX1Maximum()+off, sphere->getX2Maximum()+off, sphere->getX3Maximum()));
-         if (myid==0) GbSystem3D::writeGeoObject(refCube.get(), pathname+"/geo/refCube", WbWriterVtkXmlBinary::getInstance());
-
-         if (refineLevel>0)
-         {
-            if (myid==0) UBLOG(logINFO, "Refinement - start");
-            RefineCrossAndInsideGbObjectHelper refineHelper(grid, refineLevel, comm);
-            //refineHelper.addGbObject(sphere, refineLevel);
-            refineHelper.addGbObject(refCube, refineLevel);
-            refineHelper.refine();
-            if (myid==0) UBLOG(logINFO, "Refinement - end");
-         }
-
-         //walls
-         GbCuboid3DPtr addWallYmin(new GbCuboid3D(d_minX1-4.0*blockLength, d_minX2-4.0*blockLength, d_minX3-4.0*blockLength, d_maxX1+4.0*blockLength, d_minX2, d_maxX3+4.0*blockLength));
-         if (myid==0) GbSystem3D::writeGeoObject(addWallYmin.get(), pathname+"/geo/addWallYmin", WbWriterVtkXmlASCII::getInstance());
-
-         GbCuboid3DPtr addWallZmin(new GbCuboid3D(d_minX1-4.0*blockLength, d_minX2-4.0*blockLength, d_minX3-4.0*blockLength, d_maxX1+4.0*blockLength, d_maxX2+4.0*blockLength, d_minX3));
-         if (myid==0) GbSystem3D::writeGeoObject(addWallZmin.get(), pathname+"/geo/addWallZmin", WbWriterVtkXmlASCII::getInstance());
-
-         GbCuboid3DPtr addWallYmax(new GbCuboid3D(d_minX1-4.0*blockLength, d_maxX2, d_minX3-4.0*blockLength, d_maxX1+4.0*blockLength, d_maxX2+4.0*blockLength, d_maxX3+4.0*blockLength));
-         if (myid==0) GbSystem3D::writeGeoObject(addWallYmax.get(), pathname+"/geo/addWallYmax", WbWriterVtkXmlASCII::getInstance());
-
-         GbCuboid3DPtr addWallZmax(new GbCuboid3D(d_minX1-4.0*blockLength, d_minX2-4.0*blockLength, d_maxX3, d_maxX1+4.0*blockLength, d_maxX2+4.0*blockLength, d_maxX3+4.0*blockLength));
-         if (myid==0) GbSystem3D::writeGeoObject(addWallZmax.get(), pathname+"/geo/addWallZmax", WbWriterVtkXmlASCII::getInstance());
-
-         //inflow
-         GbCuboid3DPtr geoInflow(new GbCuboid3D(d_minX1-4.0*blockLength, d_minX2-4.0*blockLength, d_minX3-4.0*blockLength, d_minX1, d_maxX2+4.0*blockLength, d_maxX3+4.0*blockLength));
-         if (myid==0) GbSystem3D::writeGeoObject(geoInflow.get(), pathname+"/geo/geoInflow", WbWriterVtkXmlASCII::getInstance());
-
-         //outflow
-         GbCuboid3DPtr geoOutflow(new GbCuboid3D(d_maxX1, d_minX2-4.0*blockLength, d_minX3-4.0*blockLength, d_maxX1+4.0*blockLength, d_maxX2+4.0*blockLength, d_maxX3+4.0*blockLength));
-         if (myid==0) GbSystem3D::writeGeoObject(geoOutflow.get(), pathname+"/geo/geoOutflow", WbWriterVtkXmlASCII::getInstance());
-
-         WriteBlocksSPtr<CoProcessor> ppblocks(new WriteBlocksCoProcessor(grid, SPtr<UbScheduler>(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm));
-
-
-
-         //sphere
-         SPtr<D3Q27Interactor> sphereInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(sphere, grid, noSlipBCAdapter, Interactor3D::SOLID));
-
-         //walls
-         SPtr<D3Q27Interactor> addWallYminInt(new D3Q27Interactor(addWallYmin, grid, noSlipBCAdapter, Interactor3D::SOLID));
-         SPtr<D3Q27Interactor> addWallZminInt(new D3Q27Interactor(addWallZmin, grid, noSlipBCAdapter, Interactor3D::SOLID));
-         SPtr<D3Q27Interactor> addWallYmaxInt(new D3Q27Interactor(addWallYmax, grid, noSlipBCAdapter, Interactor3D::SOLID));
-         SPtr<D3Q27Interactor> addWallZmaxInt(new D3Q27Interactor(addWallZmax, grid, noSlipBCAdapter, Interactor3D::SOLID));
-
-         mu::Parser fct;
-         fct.SetExpr("U");
-         fct.DefineConst("U", uLB);
-
-         //inflow
-         SPtr<D3Q27Interactor> inflowInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoInflow, grid, velBCAdapter, Interactor3D::SOLID));
-
-         //D3Q27BoundaryConditionAdapterPtr denBCAdapterInflow(new D3Q27DensityBCAdapter(rhoLBinflow));
-         //denBCAdapterInflow->setSecondaryBcOption(0);
-         //SPtr<D3Q27Interactor> inflowInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoInflow, grid, denBCAdapterInflow, Interactor3D::SOLID));
-
-         //outflow
-         SPtr<D3Q27Interactor> outflowInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoOutflow, grid, denBCAdapter, Interactor3D::SOLID));
-
-         SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B));
-         InteractorsHelper intHelper(grid, metisVisitor);
-         //intHelper.addInteractor(sphereInt);
-         intHelper.addInteractor(addWallYminInt);
-         intHelper.addInteractor(addWallZminInt);
-         intHelper.addInteractor(addWallYmaxInt);
-         intHelper.addInteractor(addWallZmaxInt);
-         intHelper.addInteractor(inflowInt);
-         intHelper.addInteractor(outflowInt);
-         intHelper.selectBlocks();
-
-         //domain decomposition for threads
-         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
-         grid->accept(pqPartVisitor);
-
-
-         //set connectors
-         InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor());
-         SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
-         grid->accept(setConnsVisitor);
-
-         //Block3DSPtr<ConnectorFactory> factory(new Block3DConnectorFactory());
-         //ConnectorBlockVisitor setConnsVisitor(comm, nuLB, iProcessor, factory);
-         //grid->accept(setConnsVisitor);
-
-         ppblocks->process(0);
-         ppblocks.reset();
-
-         unsigned long long numberOfBlocks = (unsigned long long)grid->getNumberOfBlocks();
-         int ghostLayer = 3;
-         unsigned long long numberOfNodesPerBlock = (unsigned long long)(blockNx[0])* (unsigned long long)(blockNx[1])* (unsigned long long)(blockNx[2]);
-         unsigned long long numberOfNodes = numberOfBlocks * numberOfNodesPerBlock;
-         unsigned long long numberOfNodesPerBlockWithGhostLayer = numberOfBlocks * (blockNx[0]+ghostLayer) * (blockNx[1]+ghostLayer) * (blockNx[2]+ghostLayer);
-         double needMemAll = double(numberOfNodesPerBlockWithGhostLayer*(27*sizeof(double)+sizeof(int)+sizeof(float)*4));
-         double needMem = needMemAll/double(comm->getNumberOfProcesses());
-
-         if (myid==0)
-         {
-            UBLOG(logINFO, "Number of blocks = "<<numberOfBlocks);
-            UBLOG(logINFO, "Number of nodes  = "<<numberOfNodes);
-            int minInitLevel = grid->getCoarsestInitializedLevel();
-            int maxInitLevel = grid->getFinestInitializedLevel();
-            for (int level = minInitLevel; level<=maxInitLevel; level++)
-            {
-               int nobl = grid->getNumberOfBlocks(level);
-               UBLOG(logINFO, "Number of blocks for level "<<level<<" = "<<nobl);
-               UBLOG(logINFO, "Number of nodes for level "<<level<<" = "<<nobl*numberOfNodesPerBlock);
-            }
-            UBLOG(logINFO, "Necessary memory  = "<<needMemAll<<" bytes");
-            UBLOG(logINFO, "Necessary memory per process = "<<needMem<<" bytes");
-            UBLOG(logINFO, "Available memory per process = "<<availMem<<" bytes");
-         }
-
-         SPtr<LBMKernel> kernel(new IncompressibleCumulantLBMKernel(blocknx1, blocknx2, blocknx3, IncompressibleCumulantLBMKernel::NORMAL));
-
-         SPtr<BCProcessor> bcProcessor(new BCProcessor());
-
-
-         kernel->setBCProcessor(bcProcessor);
-
-         SetKernelBlockVisitor kernelVisitor(kernel, nuLB, availMem, needMem);
-         grid->accept(kernelVisitor);
-
-         if (refineLevel>0)
-         {
-            SetUndefinedNodesBlockVisitor undefNodesVisitor;
-            grid->accept(undefNodesVisitor);
-         }
-
-         intHelper.setBC();
-
-         grid->accept(bcVisitor);
-
-         mu::Parser fctRoh;
-         fctRoh.SetExpr("(x1max-x1)/l*dp*3.0");
-         fctRoh.DefineConst("dp", dp_LB);
-         fctRoh.DefineConst("x1max", d_maxX1);
-         fctRoh.DefineConst("l", d_maxX1-d_minX1);
-
-         //initialization of distributions
-         InitDistributionsBlockVisitor initVisitor(nuLB, rhoLB);
-         initVisitor.setVx1(fct);
-         //initVisitor.setRho(fctRoh);
-         grid->accept(initVisitor);
-
-         //Postrozess
-         SPtr<UbScheduler> geoSch(new UbScheduler(1));
-         WriteBoundaryConditionsSPtr<CoProcessor> ppgeo(
-            new WriteBoundaryConditionsCoProcessor(grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, comm));
-         ppgeo->process(0);
-         ppgeo.reset();;
-
-         if (myid==0) UBLOG(logINFO, "Preprozess - end");
-      }
-      else
-      {
-         UBLOG(logINFO, "SetConnectors - start, id="<<myid);
-
-         //set connectors
-         InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor());
-         //D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
-         SPtr<ConnectorFactory> cFactory(new Block3DConnectorFactory());
-         ConnectorBlockVisitor setConnsVisitor(comm, nuLB, iProcessor, cFactory);
-         grid->accept(setConnsVisitor);
-
-         UBLOG(logINFO, "SetConnectors - end, id="<<myid);
-      }
-
-      SPtr<UbScheduler> stepSch(new UbScheduler(outstep));
-      //stepSch->addSchedule(10000, 0, 1000000);
-      WriteMacroscopicQuantitiesCoProcessor pp(grid, stepSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, comm);
-
-      SPtr<UbScheduler> nupsSch(new UbScheduler(10, 30, 100));
-      NUPSCounterCoProcessor npr(grid, nupsSch, numOfThreads, comm);
-
-      const SPtr<ConcreteCalculatorFactory> calculatorFactory = std::make_shared<ConcreteCalculatorFactory>(stepSch);
-      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endstep, calculatorFactory, CalculatorType::HYBRID));
-
-      if (myid==0)
-         UBLOG(logINFO, "Simulation-start");
-
-      calculation->calculate();
-
-      if (myid==0)
-         UBLOG(logINFO, "Simulation-end");
-
-   }
-   catch (std::exception& e)
-   {
-      cerr<<e.what()<<endl<<flush;
-   }
-   catch (std::string& s)
-   {
-      cerr<<s<<endl;
-   }
-   catch (...)
-   {
-      cerr<<"unknown exception"<<endl;
-   }
-
-}
-
-//////////////////////////////////////////////////////////////////////////
-int main(int argc, char* argv[])
-{
-   if (argv!=NULL)
-   {
-      if (argv[1]!=NULL)
-      {
-         run(string(argv[1]));
-      }
-      else
-      {
-         cout<<"Configuration file is missing!"<<endl;
-      }
-   }
-}
-
+#include <VirtualFluids.h>
+#include <set>
+#include <map>
+using namespace std;
+
+
+////////////////////////////////////////////////////////////////////////
+void run(string configname)
+{
+   try
+   {
+
+      //Sleep(30000);
+
+      string machine = QUOTEME(CAB_MACHINE);
+
+      SPtr<Communicator> comm = MPICommunicator::getInstance();
+
+      int myid = comm->getProcessID();
+      int mybundle = comm->getBundleID();
+      int root = comm->getRoot();
+
+      ConfigurationFile   config;
+      config.load(configname);
+
+      string pathname = config.getValue<string>("path");
+      double availMem = config.getValue<double>("memory");
+      double outstep = config.getValue<double>("outstep");
+      double endstep = config.getValue<double>("endstep");
+      int numOfThreads = config.getValue<int>("threads");
+      int refineLevel = config.getValue<int>("level");
+      vector<double> dim = config.getVector<double>("dim");
+      vector<int> blockNx = config.getVector<int>("blockNx");
+      double radius = config.getValue<double>("radius");
+
+      //LBMReal radius = 4;
+      LBMReal uLB = 0.1;
+      LBMReal Re = 1;
+      LBMReal rhoLB = 0.0;
+      //LBMReal nuLB = (uLB*2.0*radius)/Re;
+      //LBMReal nuLB = (uLB*L2)/Re;
+      LBMReal nuLB = 0.168666666667/100;
+
+      double dp_LB = 1e-6;
+      double rhoLBinflow = dp_LB*3.0;
+
+      SPtr<BCAdapter> noSlipBCAdapter(new NoSlipBCAdapter());
+      noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NoSlipBCAlgorithm()));
+
+      mu::Parser fct;
+      fct.SetExpr("U");
+      fct.DefineConst("U", uLB);
+      SPtr<BCAdapter> velBCAdapter(new VelocityBCAdapter(true, false, false, fct, 0, BCFunction::INFCONST));
+      velBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new VelocityBCAlgorithm()));
+
+      SPtr<BCAdapter> denBCAdapter(new DensityBCAdapter(rhoLB));
+      denBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NonEqDensityBCAlgorithm()));
+
+      BoundaryConditionsBlockVisitor bcVisitor;
+      bcVisitor.addBC(noSlipBCAdapter);
+      bcVisitor.addBC(velBCAdapter);
+      bcVisitor.addBC(denBCAdapter);
+
+      SPtr<LBMUnitConverter> conv = SPtr<LBMUnitConverter>(new LBMUnitConverter());
+
+      double dx = 1;
+
+      const int blocknx1 = blockNx[0];
+      const int blocknx2 = blockNx[1];
+      const int blocknx3 = blockNx[2];
+
+      SPtr<Grid3D> grid(new Grid3D(comm));
+      grid->setDeltaX(dx);
+      grid->setBlockNX(blocknx1, blocknx2, blocknx3);
+
+      //////////////////////////////////////////////////////////////////////////
+      //restart
+      SPtr<UbScheduler> restartSch(new UbScheduler(100000, 100000, 100000));
+      RestartCoProcessor rp(grid, restartSch, comm, pathname, RestartCoProcessor::BINARY);
+      //////////////////////////////////////////////////////////////////////////
+
+      if (grid->getTimeStep()==0)
+      {
+
+         const int baseLevel = 0;
+
+         //bounding box
+         double d_minX1 = 0.0;
+         double d_minX2 = 0.0;
+         double d_minX3 = 0.0;
+
+         double d_maxX1 = dim[0];
+         double d_maxX2 = dim[1];
+         double d_maxX3 = dim[2];
+
+         double blockLength = blocknx1*dx;
+
+         if (myid==0)
+         {
+            UBLOG(logINFO, "Parameters:");
+            UBLOG(logINFO, "uLB = "<<uLB);
+            UBLOG(logINFO, "rhoLB = "<<rhoLB);
+            UBLOG(logINFO, "nueLB = "<<nuLB);
+            UBLOG(logINFO, "Re = "<<Re);
+            UBLOG(logINFO, "dx = "<<dx);
+            UBLOG(logINFO, "number of levels = "<<refineLevel+1);
+            UBLOG(logINFO, "numOfThreads = "<<numOfThreads);
+            UBLOG(logINFO, "Preprozess - start");
+         }
+
+         SPtr<GbObject3D> gridCube(new GbCuboid3D(d_minX1, d_minX2, d_minX3, d_maxX1, d_maxX2, d_maxX3));
+         if (myid==0) GbSystem3D::writeGeoObject(gridCube.get(), pathname+"/geo/gridCube", WbWriterVtkXmlBinary::getInstance());
+
+         GenBlocksGridVisitor genBlocks(gridCube);
+         grid->accept(genBlocks);
+
+         //SPtr<CoordinateTransformation3D> trafo = grid->getCoordinateTransformator();
+         //trafo->setRotationX2Angle(4);
+
+         //sphere
+         //SPtr<GbObject3D> sphereRef(new GbSphere3D(L1/4.0, L2*0.5, L3*0.5, radius+1.0));
+         //GbSystem3D::writeGeoObject(sphereRef.get(),pathname + "/geo/sphereRef", WbWriterVtkXmlBinary::getInstance());
+
+
+         //sphere
+         SPtr<GbObject3D> sphere(new GbSphere3D(d_maxX1*0.5, d_maxX2*0.5, d_maxX3*0.5, radius));
+         //SPtr<GbObject3D> sphere(new GbSphere3D(L1/2.0-4.0, L2*0.5+4.0, L3*0.5+4.0, radius));
+         //SPtr<GbObject3D> sphere(new GbCuboid3D(L1/4.0-radius, L2/2.0-radius, L3/2.0-radius, L1/4.0+radius, L2/2.0+radius, L3/2.0+radius));
+         GbSystem3D::writeGeoObject(sphere.get(), pathname+"/geo/sphere", WbWriterVtkXmlBinary::getInstance());
+
+         double off = 0.0;
+         SPtr<GbObject3D> refCube(new GbCuboid3D(sphere->getX1Minimum()-off, sphere->getX2Minimum()-off, sphere->getX3Minimum(),
+            sphere->getX1Maximum()+off, sphere->getX2Maximum()+off, sphere->getX3Maximum()));
+         if (myid==0) GbSystem3D::writeGeoObject(refCube.get(), pathname+"/geo/refCube", WbWriterVtkXmlBinary::getInstance());
+
+         if (refineLevel>0)
+         {
+            if (myid==0) UBLOG(logINFO, "Refinement - start");
+            RefineCrossAndInsideGbObjectHelper refineHelper(grid, refineLevel, comm);
+            //refineHelper.addGbObject(sphere, refineLevel);
+            refineHelper.addGbObject(refCube, refineLevel);
+            refineHelper.refine();
+            if (myid==0) UBLOG(logINFO, "Refinement - end");
+         }
+
+         //walls
+         GbCuboid3DPtr addWallYmin(new GbCuboid3D(d_minX1-4.0*blockLength, d_minX2-4.0*blockLength, d_minX3-4.0*blockLength, d_maxX1+4.0*blockLength, d_minX2, d_maxX3+4.0*blockLength));
+         if (myid==0) GbSystem3D::writeGeoObject(addWallYmin.get(), pathname+"/geo/addWallYmin", WbWriterVtkXmlASCII::getInstance());
+
+         GbCuboid3DPtr addWallZmin(new GbCuboid3D(d_minX1-4.0*blockLength, d_minX2-4.0*blockLength, d_minX3-4.0*blockLength, d_maxX1+4.0*blockLength, d_maxX2+4.0*blockLength, d_minX3));
+         if (myid==0) GbSystem3D::writeGeoObject(addWallZmin.get(), pathname+"/geo/addWallZmin", WbWriterVtkXmlASCII::getInstance());
+
+         GbCuboid3DPtr addWallYmax(new GbCuboid3D(d_minX1-4.0*blockLength, d_maxX2, d_minX3-4.0*blockLength, d_maxX1+4.0*blockLength, d_maxX2+4.0*blockLength, d_maxX3+4.0*blockLength));
+         if (myid==0) GbSystem3D::writeGeoObject(addWallYmax.get(), pathname+"/geo/addWallYmax", WbWriterVtkXmlASCII::getInstance());
+
+         GbCuboid3DPtr addWallZmax(new GbCuboid3D(d_minX1-4.0*blockLength, d_minX2-4.0*blockLength, d_maxX3, d_maxX1+4.0*blockLength, d_maxX2+4.0*blockLength, d_maxX3+4.0*blockLength));
+         if (myid==0) GbSystem3D::writeGeoObject(addWallZmax.get(), pathname+"/geo/addWallZmax", WbWriterVtkXmlASCII::getInstance());
+
+         //inflow
+         GbCuboid3DPtr geoInflow(new GbCuboid3D(d_minX1-4.0*blockLength, d_minX2-4.0*blockLength, d_minX3-4.0*blockLength, d_minX1, d_maxX2+4.0*blockLength, d_maxX3+4.0*blockLength));
+         if (myid==0) GbSystem3D::writeGeoObject(geoInflow.get(), pathname+"/geo/geoInflow", WbWriterVtkXmlASCII::getInstance());
+
+         //outflow
+         GbCuboid3DPtr geoOutflow(new GbCuboid3D(d_maxX1, d_minX2-4.0*blockLength, d_minX3-4.0*blockLength, d_maxX1+4.0*blockLength, d_maxX2+4.0*blockLength, d_maxX3+4.0*blockLength));
+         if (myid==0) GbSystem3D::writeGeoObject(geoOutflow.get(), pathname+"/geo/geoOutflow", WbWriterVtkXmlASCII::getInstance());
+
+         WriteBlocksSPtr<CoProcessor> ppblocks(new WriteBlocksCoProcessor(grid, SPtr<UbScheduler>(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm));
+
+
+
+         //sphere
+         SPtr<D3Q27Interactor> sphereInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(sphere, grid, noSlipBCAdapter, Interactor3D::SOLID));
+
+         //walls
+         SPtr<D3Q27Interactor> addWallYminInt(new D3Q27Interactor(addWallYmin, grid, noSlipBCAdapter, Interactor3D::SOLID));
+         SPtr<D3Q27Interactor> addWallZminInt(new D3Q27Interactor(addWallZmin, grid, noSlipBCAdapter, Interactor3D::SOLID));
+         SPtr<D3Q27Interactor> addWallYmaxInt(new D3Q27Interactor(addWallYmax, grid, noSlipBCAdapter, Interactor3D::SOLID));
+         SPtr<D3Q27Interactor> addWallZmaxInt(new D3Q27Interactor(addWallZmax, grid, noSlipBCAdapter, Interactor3D::SOLID));
+
+         mu::Parser fct;
+         fct.SetExpr("U");
+         fct.DefineConst("U", uLB);
+
+         //inflow
+         SPtr<D3Q27Interactor> inflowInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoInflow, grid, velBCAdapter, Interactor3D::SOLID));
+
+         //D3Q27BoundaryConditionAdapterPtr denBCAdapterInflow(new D3Q27DensityBCAdapter(rhoLBinflow));
+         //denBCAdapterInflow->setSecondaryBcOption(0);
+         //SPtr<D3Q27Interactor> inflowInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoInflow, grid, denBCAdapterInflow, Interactor3D::SOLID));
+
+         //outflow
+         SPtr<D3Q27Interactor> outflowInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoOutflow, grid, denBCAdapter, Interactor3D::SOLID));
+
+         SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B));
+         InteractorsHelper intHelper(grid, metisVisitor);
+         //intHelper.addInteractor(sphereInt);
+         intHelper.addInteractor(addWallYminInt);
+         intHelper.addInteractor(addWallZminInt);
+         intHelper.addInteractor(addWallYmaxInt);
+         intHelper.addInteractor(addWallZmaxInt);
+         intHelper.addInteractor(inflowInt);
+         intHelper.addInteractor(outflowInt);
+         intHelper.selectBlocks();
+
+         //domain decomposition for threads
+         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
+         grid->accept(pqPartVisitor);
+
+
+         //set connectors
+         InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor());
+         SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
+         grid->accept(setConnsVisitor);
+
+         //Block3DSPtr<ConnectorFactory> factory(new Block3DConnectorFactory());
+         //ConnectorBlockVisitor setConnsVisitor(comm, nuLB, iProcessor, factory);
+         //grid->accept(setConnsVisitor);
+
+         ppblocks->process(0);
+         ppblocks.reset();
+
+         unsigned long long numberOfBlocks = (unsigned long long)grid->getNumberOfBlocks();
+         int ghostLayer = 3;
+         unsigned long long numberOfNodesPerBlock = (unsigned long long)(blockNx[0])* (unsigned long long)(blockNx[1])* (unsigned long long)(blockNx[2]);
+         unsigned long long numberOfNodes = numberOfBlocks * numberOfNodesPerBlock;
+         unsigned long long numberOfNodesPerBlockWithGhostLayer = numberOfBlocks * (blockNx[0]+ghostLayer) * (blockNx[1]+ghostLayer) * (blockNx[2]+ghostLayer);
+         double needMemAll = double(numberOfNodesPerBlockWithGhostLayer*(27*sizeof(double)+sizeof(int)+sizeof(float)*4));
+         double needMem = needMemAll/double(comm->getNumberOfProcesses());
+
+         if (myid==0)
+         {
+            UBLOG(logINFO, "Number of blocks = "<<numberOfBlocks);
+            UBLOG(logINFO, "Number of nodes  = "<<numberOfNodes);
+            int minInitLevel = grid->getCoarsestInitializedLevel();
+            int maxInitLevel = grid->getFinestInitializedLevel();
+            for (int level = minInitLevel; level<=maxInitLevel; level++)
+            {
+               int nobl = grid->getNumberOfBlocks(level);
+               UBLOG(logINFO, "Number of blocks for level "<<level<<" = "<<nobl);
+               UBLOG(logINFO, "Number of nodes for level "<<level<<" = "<<nobl*numberOfNodesPerBlock);
+            }
+            UBLOG(logINFO, "Necessary memory  = "<<needMemAll<<" bytes");
+            UBLOG(logINFO, "Necessary memory per process = "<<needMem<<" bytes");
+            UBLOG(logINFO, "Available memory per process = "<<availMem<<" bytes");
+         }
+
+         SPtr<LBMKernel> kernel(new IncompressibleCumulantLBMKernel(blocknx1, blocknx2, blocknx3, IncompressibleCumulantLBMKernel::NORMAL));
+
+         SPtr<BCProcessor> bcProcessor(new BCProcessor());
+
+
+         kernel->setBCProcessor(bcProcessor);
+
+         SetKernelBlockVisitor kernelVisitor(kernel, nuLB, availMem, needMem);
+         grid->accept(kernelVisitor);
+
+         if (refineLevel>0)
+         {
+            SetUndefinedNodesBlockVisitor undefNodesVisitor;
+            grid->accept(undefNodesVisitor);
+         }
+
+         intHelper.setBC();
+
+         grid->accept(bcVisitor);
+
+         mu::Parser fctRoh;
+         fctRoh.SetExpr("(x1max-x1)/l*dp*3.0");
+         fctRoh.DefineConst("dp", dp_LB);
+         fctRoh.DefineConst("x1max", d_maxX1);
+         fctRoh.DefineConst("l", d_maxX1-d_minX1);
+
+         //initialization of distributions
+         InitDistributionsBlockVisitor initVisitor(nuLB, rhoLB);
+         initVisitor.setVx1(fct);
+         //initVisitor.setRho(fctRoh);
+         grid->accept(initVisitor);
+
+         //Postrozess
+         SPtr<UbScheduler> geoSch(new UbScheduler(1));
+         WriteBoundaryConditionsSPtr<CoProcessor> ppgeo(
+            new WriteBoundaryConditionsCoProcessor(grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, comm));
+         ppgeo->process(0);
+         ppgeo.reset();;
+
+         if (myid==0) UBLOG(logINFO, "Preprozess - end");
+      }
+      else
+      {
+         UBLOG(logINFO, "SetConnectors - start, id="<<myid);
+
+         //set connectors
+         InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor());
+         //D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
+         SPtr<ConnectorFactory> cFactory(new Block3DConnectorFactory());
+         ConnectorBlockVisitor setConnsVisitor(comm, nuLB, iProcessor, cFactory);
+         grid->accept(setConnsVisitor);
+
+         UBLOG(logINFO, "SetConnectors - end, id="<<myid);
+      }
+
+      SPtr<UbScheduler> stepSch(new UbScheduler(outstep));
+      //stepSch->addSchedule(10000, 0, 1000000);
+      WriteMacroscopicQuantitiesCoProcessor pp(grid, stepSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, comm);
+
+      SPtr<UbScheduler> nupsSch(new UbScheduler(10, 30, 100));
+      NUPSCounterCoProcessor npr(grid, nupsSch, numOfThreads, comm);
+
+      const SPtr<ConcreteCalculatorFactory> calculatorFactory = std::make_shared<ConcreteCalculatorFactory>(stepSch);
+      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endstep, calculatorFactory, CalculatorType::HYBRID));
+
+      if (myid==0)
+         UBLOG(logINFO, "Simulation-start");
+
+      calculation->calculate();
+
+      if (myid==0)
+         UBLOG(logINFO, "Simulation-end");
+
+   }
+   catch (std::exception& e)
+   {
+      cerr<<e.what()<<endl<<flush;
+   }
+   catch (std::string& s)
+   {
+      cerr<<s<<endl;
+   }
+   catch (...)
+   {
+      cerr<<"unknown exception"<<endl;
+   }
+
+}
+
+//////////////////////////////////////////////////////////////////////////
+int main(int argc, char* argv[])
+{
+   if (argv!=NULL)
+   {
+      if (argv[1]!=NULL)
+      {
+         run(string(argv[1]));
+      }
+      else
+      {
+         cout<<"Configuration file is missing!"<<endl;
+      }
+   }
+}
+
diff --git a/apps/cpu/micropart/CMakeLists.txt b/apps/cpu/micropart/CMakeLists.txt
index 15e818a09c9634878780600a3def0002c70d675c..09ebee3c8a5bde68b98a6ac6fcde15b747e28a10 100644
--- a/apps/cpu/micropart/CMakeLists.txt
+++ b/apps/cpu/micropart/CMakeLists.txt
@@ -1,25 +1,25 @@
-CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
-
-########################################################
-## C++ PROJECT                                       ###
-########################################################
-PROJECT(micropart)
-
-INCLUDE(${SOURCE_ROOT}/lib/IncludsList.txt) 
-
-#################################################################
-###   LOCAL FILES                                             ###
-#################################################################
-FILE(GLOB SPECIFIC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.h
-                         ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
-                         ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp  )
- 
-SET(ALL_SOURCES ${ALL_SOURCES} ${SPECIFIC_FILES})
-SOURCE_GROUP(src FILES ${SPECIFIC_FILES})
-  
-SET(CAB_ADDITIONAL_LINK_LIBRARIES vfluids)
-
-#################################################################
-###   CREATE PROJECT                                          ###
-#################################################################
-CREATE_CAB_PROJECT(mcpart BINARY)
+CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
+
+########################################################
+## C++ PROJECT                                       ###
+########################################################
+PROJECT(micropart)
+
+INCLUDE(${SOURCE_ROOT}/lib/IncludsList.txt) 
+
+#################################################################
+###   LOCAL FILES                                             ###
+#################################################################
+FILE(GLOB SPECIFIC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.h
+                         ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
+                         ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp  )
+ 
+SET(ALL_SOURCES ${ALL_SOURCES} ${SPECIFIC_FILES})
+SOURCE_GROUP(src FILES ${SPECIFIC_FILES})
+  
+SET(CAB_ADDITIONAL_LINK_LIBRARIES vfluids)
+
+#################################################################
+###   CREATE PROJECT                                          ###
+#################################################################
+CREATE_CAB_PROJECT(mcpart BINARY)
diff --git a/apps/cpu/micropart/mcpart.cpp b/apps/cpu/micropart/mcpart.cpp
index 3089a6e4311fd1ecee37e52a2eae4dc5fa5c3fa0..1003102e83bb5e221eeb6db3749652ef481fdb98 100644
--- a/apps/cpu/micropart/mcpart.cpp
+++ b/apps/cpu/micropart/mcpart.cpp
@@ -1,14 +1,14 @@
-#include "micropartTestQs3.hpp"
-//#include "micropartSetup1.hpp"
-//#include "micropartSetup2.hpp"
-//#include "orifice.hpp"
-
-int main(int argc, char* argv[])
-{
-   micropartTestQs3(argv[1]);
-   //runSetup1(argv[1]);
-   //runSetup2(argv[1]);
-   //orifice(argv[1]);
-   return 0;
-}
-
+#include "micropartTestQs3.hpp"
+//#include "micropartSetup1.hpp"
+//#include "micropartSetup2.hpp"
+//#include "orifice.hpp"
+
+int main(int argc, char* argv[])
+{
+   micropartTestQs3(argv[1]);
+   //runSetup1(argv[1]);
+   //runSetup2(argv[1]);
+   //orifice(argv[1]);
+   return 0;
+}
+
diff --git a/apps/cpu/micropart/micropartSetup1.hpp b/apps/cpu/micropart/micropartSetup1.hpp
index 268009681451845ffd3945de1338dec01f976b42..843ec702cf017c04f6ed68cba306dfb211d95f49 100644
--- a/apps/cpu/micropart/micropartSetup1.hpp
+++ b/apps/cpu/micropart/micropartSetup1.hpp
@@ -1,451 +1,451 @@
-#include <iostream>
-#include <string>
-#include <map>
-#include "RefineCrossAndInsideGbObjectBlockVisitor.h"
-#include "RatioBlockVisitor.h"
-#include "RatioSmoothBlockVisitor.h"
-#include "OverlapBlockVisitor.h"
-#include "SetInterpolationDirsBlockVisitor.h"
-#include "geometry3d/GbSystem3D.h"
-#include "geometry3d/GbCuboid3D.h"
-#include "geometry3d/GbCylinder3D.h"
-#include "geometry3d/GbSphere3D.h"
-#include "BlocksPostprocessor.h"
-#include "Grid3D.h"
-#include "Patch3D.h"
-#include "Patch3DSystem.h"
-#include "Block3D.h"
-#include "LBMKernelETD3Q27Cascaded.h"
-#include "LBMKernelETD3Q27BGK.h"
-#include "CalculationManager.h" 
-#include "D3Q27SetConnectorsBlockVisitor.h" 
-#include "D3Q27ETInitDistributionsBlockVisitor.h"
-#include "D3Q27Interactor.h"
-#include "D3Q27NoSlipBCAdapter.h"
-#include "D3Q27VelocityBCAdapter.h"
-#include "D3Q27DensityBCAdapter.h"
-#include "SimulationParameters.h"
-#include "Communicator.h"
-#include "MPICommunicator.h"
-#include "SimpleGeometricPartitioner.h"
-#include "D3Q27MacroscopicQuantitiesPostprocessor.h"
-#include "D3Q27ETBCProcessor.h"
-#include "D3Q27TriFaceMeshInteractor.h"
-#include "ConfigFileReader.h"
-#include "StringUtil.hpp"
-#include "D3Q27PressureDifferencePostprocessor.h"
-#include "D3Q27IntegrateValuesHelper.h"
-#include "LBMUnitConverter.h"
-#include "NUPSCounterPostprocessor.h"
-#include "PQueuePartitioningGridVisitor.h"
-#include "SetKernelBlockVisitor.h"
-#include "GenBlocksGridVisitor.h"
-#include "D3Q27PathLinePostprocessor.h"
-#include "D3Q27SetUndefinedNodesBlockVisitor.h"
-   //
-#include "basics/writer/WbWriterVtkXmlBinary.h"
-#include "basics/writer/WbWriterVtkXmlASCII.h"
-#include "geometry3d/creator/GbTriFaceMesh3DCreator.h"
-#include "geometry3d/GbTriFaceMesh3D.h"
-#include "D3Q27System.h"
-#include <basics/transmitter/TbTransmitterMpiPool.h>
-#include "MathUtil.hpp"
-#include "D3Q27OffsetInterpolationProcessor.h"
-#include "SolidBlocksHelper.h"
-#include "MetisPartitioningGridVisitor.h"
-#include "RestartPostprocessor.h"
-#include "LBMKernelETD3Q27CCLB.h"
-#include "D3Q27IncompressibleOffsetInterpolationProcessor.h"
-
-using namespace std;
-
-void runSetup1(const char *cstr)
-{
-   try
-   {
-      CommunicatorPtr comm(new MPICommunicator());
-      int myid = comm->getProcessID();
-      int numprocs = comm->getNumberOfProcesses();
-
-      string machine = QUOTEME(CAB_MACHINE);
-      string pathname; 
-      double availMem = 0;
-      string geoFile;
-      int numOfThreads = 1;
-
-      if(machine == "BOMBADIL") 
-      {
-         pathname = "c:/temp/micropart";
-         availMem = 3.0e9;
-         //geoFile = "c:/Data/micropart/DK19_7_02_Martin.stl";
-         //geoFile = "c:/Data/micropart/ktoolcav.stl";
-         //geoFile = "c:/Data/micropart/boxN.stl";
-         //geoFile = "c:/Data/bananas/Banana_boxD.stl";
-      }
-      else if(machine == "M01" || machine == "M02")      
-      {
-         pathname = "/work/koskuche/scratch/micropart_s1";
-         //pathname = "/work/koskuche/scratch/micropart2";
-         availMem = 12.0e9;
-         geoFile = "/home/koskuche/data/micropart/DK19_7_02_Martin.stl";
-
-         numOfThreads = 1;
-         if(myid ==0)
-         {
-            stringstream logFilename;
-            logFilename <<  pathname + "/logfile"+UbSystem::toString(UbSystem::getTimeStamp())+".txt";
-            UbLog::output_policy::setStream(logFilename.str());
-         }
-      }
-      else throw UbException(UB_EXARGS, "unknown CAB_MACHINE");
-
-      UbLog::reportingLevel() = logINFO;
-      //UbLog::reportingLevel() = logDEBUG1;
-
-      int nodePerBlockX1 = 8; //Anzahl an Knoten pro Block
-      int nodePerBlockX2 = 8;//(int)16;
-      int nodePerBlockX3 = 8;//(int)16;
-
-      double bH = nodePerBlockX1;    //gewuenschte Rand- und Blockbreite
-
-      //Simulation Parameters
-
-      double sf = 1.0;
-      double endTime = 160001*sf;
-      //length [m]
-      double lSI = 0.067;
-      //length [LB]
-      double lLB = 30;
-
-      double dx = 0.0134;//lSI/lLB;
-
-      double left_offset = 0.5;
-      double right_offset  = 0.5;//2*0.5
-      double front_offset = 0.15;
-      double back_offset  = 0.15;
-      double top_offset = 0.0;
-      double bottom_offset  = 0.07;
-
-      LBMReal vLB = 0.016103/sf;
-      LBMReal Re;
-      LBMReal rhoLB = 0.0;
-      LBMReal nueLB = 0.0000249/sf;//(vLB*lLB)/Re;
-      Re = (vLB*(0.303/dx))/nueLB;
-      const int baseLevel = 0;
-      const int refineLevel = 5;
-      LBMUnitConverterPtr conv = LBMUnitConverterPtr(new LBMUnitConverter());
-
-      //////////////////////////////////////////////////////////////////////////
-      GbObject3DPtr refineCube1(new  GbCuboid3D(-0.2222890,-0.52993, -0.141754, 0.578916113,0.6089970,0.0446053));
-      if(myid == 0) GbSystem3D::writeGeoObject(refineCube1.get(), pathname+"/geo/refineCube1", WbWriterVtkXmlASCII::getInstance());
-
-      GbObject3DPtr refineCube2(new  GbCuboid3D(-0.16,-0.05, -0.141754, 0.2,0.05,0.0446053));
-      if(myid == 0) GbSystem3D::writeGeoObject(refineCube2.get(), pathname+"/geo/refineCube2", WbWriterVtkXmlASCII::getInstance());
-      //////////////////////////////////////////////////////////////////////////
-
-      Grid3DPtr grid(new Grid3D());
-
-      UbSchedulerPtr rSch(new UbScheduler());
-      rSch->addSchedule(20000, 20000, endTime-1);
-      RestartPostprocessorPtr rp(new RestartPostprocessor(grid, rSch, comm, pathname+"/checkpoints", RestartPostprocessor::BINARY));
-
-      std::string opt;
-
-      if(cstr!= NULL)
-         opt = std::string(cstr);
-
-      if/*(cstr== NULL)*/(cstr!= NULL)
-      {
-         opt = std::string(cstr);
-
-         if(myid==0) UBLOG(logINFO,"Restart step: " << opt);
-
-         grid = rp->restart(UbSystem::stringTo<int>(opt));
-         rp->reconnect();
-
-         if(myid ==0) UBLOG(logINFO,"TimeStep = " <<grid->getTimeStep());
-
-         //set connectors
-         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
-         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
-         grid->accept( setConnsVisitor );
-
-         //domain decomposition
-         //PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
-         //grid->accept(pqPartVisitor);
-      }
-      else
-      {
-         if(myid ==0)
-         {
-            UBLOG(logINFO,"L = " <<lLB );
-            UBLOG(logINFO,"v = " <<vLB );
-            UBLOG(logINFO,"rho = " <<rhoLB );
-            UBLOG(logINFO,"nue = " << nueLB );
-            UBLOG(logINFO,"Re = " << Re );
-            UBLOG(logINFO,"Preprozess - start");
-         }
-
-
-         ////////////////////////////////////////////////////////////////////////
-         //Grid
-         //////////////////////////////////////////////////////////////////////////
-         grid->setDeltaX(dx);
-         grid->setBlockNX(nodePerBlockX1, nodePerBlockX2, nodePerBlockX2);
-
-         ////////////////////////////////////////////////////////////////////////////
-         //// Geometrie
-         ////////////////////////////////////////////////////////////////////////////
-         //GbTriFaceMesh3DPtr geo (GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(geoFile,"geo"));
-
-         //if(myid == 0) GbSystem3D::writeGeoObject(geo.get(), pathname+"/geo/geo", WbWriterVtkXmlASCII::getInstance());
-
-         ////////////////////////////////////////////////////////////////////////////
-         //// Randgeometrien erstellen
-         ////////////////////////////////////////////////////////////////////////////
-         
-         GbCuboid3DPtr plate1  = GbCuboid3DPtr( new GbCuboid3D( -7.5, -1.515e-1, -6.831e-2, 7.5, 1.515e-1, 0.0 ));
-
-         GbCuboid3DPtr plate2  = GbCuboid3DPtr( new GbCuboid3D( -1.5e-1, -16.51e-1, -16.831e-2, 1.5e-1, -1.6e-2, 1.0 ));
-         GbCuboid3DPtr plate3  = GbCuboid3DPtr( new GbCuboid3D( -1.5e-1, 1.6e-2, -16.831e-2, 1.5e-1, 16.515e-1, 1.0 ));
-
-         GbCuboid3DPtr plate1_1  = GbCuboid3DPtr( new GbCuboid3D( -7.5, -2.515e-1, -1.0e-1, 7.5, 2.515e-1, -6.831e-2 ));
-         GbCuboid3DPtr plate1_2  = GbCuboid3DPtr( new GbCuboid3D( -7.5, -2.515e-1, -0.0000001, 7.5, 2.515e-1, 1.0e-1 ));
-         //GbCuboid3DPtr plate1_3  = GbCuboid3DPtr( new GbCuboid3D( -7.5, 1.515e-1, -6.831e-2, 7.5, 2.515e-1, 0.0  ));
-         GbCuboid3DPtr plate1_3  = GbCuboid3DPtr( new GbCuboid3D( -7.5, 1.515e-1, -9.831e-2, 7.5, 2.515e-1, 0.06  ));
-         GbCuboid3DPtr plate1_4  = GbCuboid3DPtr( new GbCuboid3D( -7.5, -2.515e-1, 0.0, 7.5, -1.515e-1, -1.0e-1 ));
-
-         GbCuboid3DPtr inflow  = GbCuboid3DPtr( new GbCuboid3D( -8.0, -1.0, -1.0, -7.5, 1.0, 1.0 ));
-         GbCuboid3DPtr outflow = GbCuboid3DPtr( new GbCuboid3D( 7.5, -1.0, -1.0, 8.0, 1.0, 1.0 ));
-
-         if(myid == 0)
-         {
-            GbSystem3D::writeGeoObject(plate2.get(),pathname+"/geo/plate2", WbWriterVtkXmlASCII::getInstance());
-            GbSystem3D::writeGeoObject(plate3.get(),pathname+"/geo/plate3", WbWriterVtkXmlASCII::getInstance());
-
-            GbSystem3D::writeGeoObject(plate1_1.get(),pathname+"/geo/plate1_1", WbWriterVtkXmlASCII::getInstance());
-            GbSystem3D::writeGeoObject(plate1_2.get(),pathname+"/geo/plate1_2", WbWriterVtkXmlASCII::getInstance());
-            GbSystem3D::writeGeoObject(plate1_3.get(),pathname+"/geo/plate1_3", WbWriterVtkXmlASCII::getInstance());
-            GbSystem3D::writeGeoObject(plate1_4.get(),pathname+"/geo/plate1_4", WbWriterVtkXmlASCII::getInstance());
-
-            GbSystem3D::writeGeoObject(inflow.get(),pathname+"/geo/inflow", WbWriterVtkXmlASCII::getInstance());
-            GbSystem3D::writeGeoObject(outflow.get(),pathname+"/geo/outflow", WbWriterVtkXmlASCII::getInstance());
-         }
-
-         double shiftForMG=grid->getDeltaX(refineLevel)*nodePerBlockX1 / 3.0*1.5;
-
-         GbObject3DPtr gridCube(new GbCuboid3D(plate1->getX1Minimum()-shiftForMG, plate1->getX2Minimum()-shiftForMG, plate1->getX3Minimum()-shiftForMG,
-                                                plate1->getX1Maximum()+shiftForMG, 
-                                                plate1->getX2Maximum()+shiftForMG, 
-                                                plate1->getX3Maximum()+shiftForMG));
-
-         GenBlocksGridVisitor genBlocks;
-         genBlocks.addGeoObject(gridCube);
-         grid->accept(genBlocks);
-
-         if (refineLevel > 0)
-         {
-            if(myid == 0) UBLOG(logINFO,"Refinement - start");	
-            RefineCrossAndInsideGbObjectBlockVisitor refVisitor1(refineCube1, baseLevel, refineLevel-3);
-            grid->accept(refVisitor1);
-
-            RefineCrossAndInsideGbObjectBlockVisitor refVisitor2(refineCube2, baseLevel, refineLevel-1);
-            grid->accept(refVisitor2);
-
-            RatioBlockVisitor ratioVisitor(refineLevel);
-            grid->accept(ratioVisitor);
-
-            RatioSmoothBlockVisitor ratioSmoothVisitor(refineLevel);
-            grid->accept(ratioSmoothVisitor);
-
-            OverlapBlockVisitor overlapVisitor(refineLevel);
-            grid->accept(overlapVisitor);
-
-            std::vector<int> dirs;
-            D3Q27System::getLBMDirections(dirs);
-            SetInterpolationDirsBlockVisitor interDirsVisitor(dirs);
-            grid->accept(interDirsVisitor);
-            if(myid == 0) UBLOG(logINFO,"Refinement - end");	
-         }
-
-         //////////////////////////////////////////////////////////////////////////
-         //INTERAKTOREN SETZEN (=Randbedingungen)
-         //////////////////////////////////////////////////////////////////////////
-         //oben/unten = Haftrand
-         int bbOption = 1; //0=simple Bounce Back, 1=quadr. BB
-         D3Q27BoundaryConditionAdapterPtr bcObst(new D3Q27NoSlipBCAdapter(bbOption));
-         //D3Q27TriFaceMeshInteractorPtr geoInt = D3Q27TriFaceMeshInteractorPtr( new D3Q27TriFaceMeshInteractor(geo, grid, D3Q27BoundaryConditionAdapterPtr(new D3Q27NoSlipBCAdapter(bbOption)),Interactor3D::SOLID));
-         //geoInt->setUseHalfSpaceCheck(true);
-         //geoInt->setRegardPointInObjectTest(true);
-
-         //D3Q27InteractorPtr plate1Int(new D3Q27Interactor(plate1, grid, bcObst,Interactor3D::INVERSESOLID));
-         D3Q27InteractorPtr plate2Int(new D3Q27Interactor(plate2, grid, bcObst,Interactor3D::SOLID));
-         D3Q27InteractorPtr plate3Int(new D3Q27Interactor(plate3, grid, bcObst,Interactor3D::SOLID));
-
-         D3Q27InteractorPtr plate1_1Int(new D3Q27Interactor(plate1_1, grid, bcObst,Interactor3D::SOLID));
-         D3Q27InteractorPtr plate1_2Int(new D3Q27Interactor(plate1_2, grid, bcObst,Interactor3D::SOLID));
-         D3Q27InteractorPtr plate1_3Int(new D3Q27Interactor(plate1_3, grid, bcObst,Interactor3D::SOLID));
-         D3Q27InteractorPtr plate1_4Int(new D3Q27Interactor(plate1_4, grid, bcObst,Interactor3D::SOLID));
-
-         //links: geschwindigkeits-einfluss
-         //Velocity-BC
-         //////////////////////////////////////////////////////////////////////////
-         mu::Parser fct;
-         fct.DefineConst("vx1"  , vLB*9.0/4.0);
-         fct = Utilities::getDuctParaboloidX(plate1->getX2Centroid(), plate1->getX2Maximum() - plate1->getX2Minimum(), plate1->getX3Centroid(), plate1->getX3Minimum() - plate1->getX3Maximum(), vLB*9.0/4.0);
-         //fct.SetExpr("vx1");
-         //////////////////////////////////////////////////////////////////////////
-         //////////////////////////////////////////////////////////////////////////
-         D3Q27BoundaryConditionAdapterPtr velBCAdapter = D3Q27BoundaryConditionAdapterPtr(new D3Q27VelocityBCAdapter (true, false ,false ,fct, 0, D3Q27BCFunction::INFCONST));
-        // velBCAdapter->setSecondaryBcOption(2);
-         D3Q27InteractorPtr inflowInt  = D3Q27InteractorPtr( new D3Q27Interactor(inflow, grid, velBCAdapter, Interactor3D::SOLID));
-
-         //rechts: druckrand
-         //Density-BC
-         //fuer Kompressibles Modell  rho = 1.0
-         D3Q27BoundaryConditionAdapterPtr denBCAdapter(new D3Q27DensityBCAdapter(rhoLB));
-         denBCAdapter->setSecondaryBcOption(1);
-         D3Q27InteractorPtr outflowInt = D3Q27InteractorPtr( new D3Q27Interactor(outflow, grid, denBCAdapter,Interactor3D::SOLID));
-
-         MetisPartitioningGridVisitor metisVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B);
-         //MetisPartitioningGridVisitor metisVisitor(comm, MetisPartitioningGridVisitor::LevelIntersected, D3Q27System::B, true, numOfThreads);
-         grid->accept( metisVisitor );
-
-         SolidBlocksHelper sd(grid, comm);
-         //sd.addInteractor(geoInt);
-         sd.addInteractor(inflowInt);
-         sd.addInteractor(outflowInt);
-         sd.addInteractor(plate1_1Int);
-         sd.addInteractor(plate1_2Int);
-         sd.addInteractor(plate1_3Int);
-         sd.addInteractor(plate1_4Int);
-         sd.addInteractor(plate2Int);
-         sd.addInteractor(plate3Int);
-         sd.deleteSolidBlocks();     
-
-         grid->accept( metisVisitor );
-
-         BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname + "/grid/blocks", WbWriterVtkXmlBinary::getInstance(), comm));
-         ppblocks->update(0);
-         ppblocks.reset();
-
-         unsigned long nob = grid->getNumberOfBlocks();
-         int gl = 3;
-         unsigned long nod_temp = nob * (nodePerBlockX1+gl) * (nodePerBlockX2+gl) * (nodePerBlockX3+gl);
-         unsigned long nod = nob * (nodePerBlockX1) * (nodePerBlockX2) * (nodePerBlockX3);
-         double needMemAll  = double(nod_temp*(27*sizeof(double) + sizeof(int) + sizeof(float)*4));
-         double needMem  = needMemAll / double(comm->getNumberOfProcesses());
-
-         if(myid == 0)
-         {
-            UBLOG(logINFO,"Number of blocks = " << nob);
-            UBLOG(logINFO,"Number of nodes  = " << nod);
-            UBLOG(logINFO,"Necessary memory  = " << needMemAll  << " bytes");
-            UBLOG(logINFO,"Necessary memory per process = " << needMem  << " bytes");
-            UBLOG(logINFO,"Available memory per process = " << availMem << " bytes");
-         }  
-
-         //LBMKernel3DPtr kernel(new LBMKernelETD3Q27Cascaded(nodePerBlockX1, nodePerBlockX2, nodePerBlockX2));
-         //option = 0 - ohne param., option = 1 - mit param.
-         int option = 0;
-         LBMKernel3DPtr kernel(new LBMKernelETD3Q27CCLB(nodePerBlockX1, nodePerBlockX2, nodePerBlockX2, option));
-
-         BCProcessorPtr bcProc(new D3Q27ETBCProcessor());
-         kernel->setBCProcessor(bcProc);
-
-         SetKernelBlockVisitor kernelVisitor(kernel, nueLB, availMem, needMem);
-         grid->accept(kernelVisitor);
-
-         {
-            D3Q27SetUndefinedNodesBlockVisitor undefNodesVisitor;
-            grid->accept(undefNodesVisitor);
-         }
-
-         //canal
-         //grid->addAndInitInteractor(geoInt);
-         grid->addAndInitInteractor(plate1_1Int);
-         grid->addAndInitInteractor(plate1_2Int);
-         grid->addAndInitInteractor(plate1_3Int);
-         grid->addAndInitInteractor(plate1_4Int);
-         grid->addAndInitInteractor(plate2Int);
-         grid->addAndInitInteractor(plate3Int);
-
-         //inflow
-         grid->addAndInitInteractor(inflowInt);
-
-         //outflow
-         grid->addAndInitInteractor(outflowInt);
-
-         //////////////////////////////////////////////////////////////////////////
-         //connectoren setzen:
-         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
-         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
-         grid->accept( setConnsVisitor );
-         //////////////////////////////////////////////////////////////////////////
-         //domain decomposition
-         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
-         grid->accept(pqPartVisitor);
-         //////////////////////////////////////////////////////////////////////////
-         //Stroemungsfeld initialisieren
-         //////////////////////////////////////////////////////////////////////////
-         D3Q27ETInitDistributionsBlockVisitor initVisitor(rhoLB); //1.0
-         //initVisitor.setVx1(0.0); 
-         grid->accept(initVisitor);
-
-         //if(myid == 0)
-         //{
-         //   //Abst�nde "q" als Linien rausschreiben
-         //   std::vector< UbTupleFloat3 > nodes;
-         //   std::vector< UbTupleInt2 >   lines;
-         //   geoInt->addQsLineSet(nodes, lines);
-         //   WbWriterVtkXmlBinary::getInstance()->writeLines(pathname+"/grid/qs",nodes,lines);
-         //}
-
-         if(myid == 0) UBLOG(logINFO,"Preprozess - end");
-
-      }
-      //////////////////////////////////////////////////////////////////////////
-      //Set Postprozessors
-      //////////////////////////////////////////////////////////////////////////
-      {
-         UbSchedulerPtr geoSch(new UbScheduler(1));
-         D3Q27MacroscopicQuantitiesPostprocessor ppgeo(grid,geoSch, pathname + "/grid/nodes", WbWriterVtkXmlBinary::getInstance(), conv,  comm, true);
-         grid->doPostProcess(0);
-      }
-
-      UbSchedulerPtr nupsSch(new UbScheduler(1, 5, 10));
-      NUPSCounterPostprocessor npr(grid, nupsSch, pathname + "/results/nups.txt", comm);
-
-      double outTime = 2000;
-      UbSchedulerPtr stepSch(new UbScheduler(outTime));
-      stepSch->addSchedule(100, 100, 100);
-      D3Q27MacroscopicQuantitiesPostprocessor pp(grid,stepSch, pathname + "/steps/step", WbWriterVtkXmlBinary::getInstance(), conv,  comm);
-      //////////////////////////////////////////////////////////////////////////
-      //PathLine
-      //UbSchedulerPtr plSch(new UbScheduler(10, 1500));
-      //D3Q27PathLinePostprocessor pathLine(grid, pathname + "/pathLine", WbWriterVtkXmlASCII::getInstance(), conv, plSch, comm, -0.3285474538, 0.09692341,-0.0376166666, nueLB, iProcessor);
-      //////////////////////////////////////////////////////////////////////////
-      //Simulation
-      //////////////////////////////////////////////////////////////////////////
-
-      UbSchedulerPtr visSch(stepSch);
-      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, visSch));
-      if(myid == 0) UBLOG(logINFO,"Simulation-start");
-      calculation->calculate();
-      if(myid == 0) UBLOG(logINFO,"Simulation-end");
-
-   }
-   catch(std::exception& e)
-   {
-      cerr << e.what() << endl;
-   }
-   catch(std::string& s)
-   {
-      cerr << s << endl;
-   }
-   catch(...)
-   {
-      cerr << "unknown exception" << endl;
-   }
-
-}
+#include <iostream>
+#include <string>
+#include <map>
+#include "RefineCrossAndInsideGbObjectBlockVisitor.h"
+#include "RatioBlockVisitor.h"
+#include "RatioSmoothBlockVisitor.h"
+#include "OverlapBlockVisitor.h"
+#include "SetInterpolationDirsBlockVisitor.h"
+#include "geometry3d/GbSystem3D.h"
+#include "geometry3d/GbCuboid3D.h"
+#include "geometry3d/GbCylinder3D.h"
+#include "geometry3d/GbSphere3D.h"
+#include "BlocksPostprocessor.h"
+#include "Grid3D.h"
+#include "Patch3D.h"
+#include "Patch3DSystem.h"
+#include "Block3D.h"
+#include "LBMKernelETD3Q27Cascaded.h"
+#include "LBMKernelETD3Q27BGK.h"
+#include "CalculationManager.h" 
+#include "D3Q27SetConnectorsBlockVisitor.h" 
+#include "D3Q27ETInitDistributionsBlockVisitor.h"
+#include "D3Q27Interactor.h"
+#include "D3Q27NoSlipBCAdapter.h"
+#include "D3Q27VelocityBCAdapter.h"
+#include "D3Q27DensityBCAdapter.h"
+#include "SimulationParameters.h"
+#include "Communicator.h"
+#include "MPICommunicator.h"
+#include "SimpleGeometricPartitioner.h"
+#include "D3Q27MacroscopicQuantitiesPostprocessor.h"
+#include "D3Q27ETBCProcessor.h"
+#include "D3Q27TriFaceMeshInteractor.h"
+#include "ConfigFileReader.h"
+#include "StringUtil.hpp"
+#include "D3Q27PressureDifferencePostprocessor.h"
+#include "D3Q27IntegrateValuesHelper.h"
+#include "LBMUnitConverter.h"
+#include "NUPSCounterPostprocessor.h"
+#include "PQueuePartitioningGridVisitor.h"
+#include "SetKernelBlockVisitor.h"
+#include "GenBlocksGridVisitor.h"
+#include "D3Q27PathLinePostprocessor.h"
+#include "D3Q27SetUndefinedNodesBlockVisitor.h"
+   //
+#include "basics/writer/WbWriterVtkXmlBinary.h"
+#include "basics/writer/WbWriterVtkXmlASCII.h"
+#include "geometry3d/creator/GbTriFaceMesh3DCreator.h"
+#include "geometry3d/GbTriFaceMesh3D.h"
+#include "D3Q27System.h"
+#include <basics/transmitter/TbTransmitterMpiPool.h>
+#include "MathUtil.hpp"
+#include "D3Q27OffsetInterpolationProcessor.h"
+#include "SolidBlocksHelper.h"
+#include "MetisPartitioningGridVisitor.h"
+#include "RestartPostprocessor.h"
+#include "LBMKernelETD3Q27CCLB.h"
+#include "D3Q27IncompressibleOffsetInterpolationProcessor.h"
+
+using namespace std;
+
+void runSetup1(const char *cstr)
+{
+   try
+   {
+      CommunicatorPtr comm(new MPICommunicator());
+      int myid = comm->getProcessID();
+      int numprocs = comm->getNumberOfProcesses();
+
+      string machine = QUOTEME(CAB_MACHINE);
+      string pathname; 
+      double availMem = 0;
+      string geoFile;
+      int numOfThreads = 1;
+
+      if(machine == "BOMBADIL") 
+      {
+         pathname = "c:/temp/micropart";
+         availMem = 3.0e9;
+         //geoFile = "c:/Data/micropart/DK19_7_02_Martin.stl";
+         //geoFile = "c:/Data/micropart/ktoolcav.stl";
+         //geoFile = "c:/Data/micropart/boxN.stl";
+         //geoFile = "c:/Data/bananas/Banana_boxD.stl";
+      }
+      else if(machine == "M01" || machine == "M02")      
+      {
+         pathname = "/work/koskuche/scratch/micropart_s1";
+         //pathname = "/work/koskuche/scratch/micropart2";
+         availMem = 12.0e9;
+         geoFile = "/home/koskuche/data/micropart/DK19_7_02_Martin.stl";
+
+         numOfThreads = 1;
+         if(myid ==0)
+         {
+            stringstream logFilename;
+            logFilename <<  pathname + "/logfile"+UbSystem::toString(UbSystem::getTimeStamp())+".txt";
+            UbLog::output_policy::setStream(logFilename.str());
+         }
+      }
+      else throw UbException(UB_EXARGS, "unknown CAB_MACHINE");
+
+      UbLog::reportingLevel() = logINFO;
+      //UbLog::reportingLevel() = logDEBUG1;
+
+      int nodePerBlockX1 = 8; //Anzahl an Knoten pro Block
+      int nodePerBlockX2 = 8;//(int)16;
+      int nodePerBlockX3 = 8;//(int)16;
+
+      double bH = nodePerBlockX1;    //gewuenschte Rand- und Blockbreite
+
+      //Simulation Parameters
+
+      double sf = 1.0;
+      double endTime = 160001*sf;
+      //length [m]
+      double lSI = 0.067;
+      //length [LB]
+      double lLB = 30;
+
+      double dx = 0.0134;//lSI/lLB;
+
+      double left_offset = 0.5;
+      double right_offset  = 0.5;//2*0.5
+      double front_offset = 0.15;
+      double back_offset  = 0.15;
+      double top_offset = 0.0;
+      double bottom_offset  = 0.07;
+
+      LBMReal vLB = 0.016103/sf;
+      LBMReal Re;
+      LBMReal rhoLB = 0.0;
+      LBMReal nueLB = 0.0000249/sf;//(vLB*lLB)/Re;
+      Re = (vLB*(0.303/dx))/nueLB;
+      const int baseLevel = 0;
+      const int refineLevel = 5;
+      LBMUnitConverterPtr conv = LBMUnitConverterPtr(new LBMUnitConverter());
+
+      //////////////////////////////////////////////////////////////////////////
+      GbObject3DPtr refineCube1(new  GbCuboid3D(-0.2222890,-0.52993, -0.141754, 0.578916113,0.6089970,0.0446053));
+      if(myid == 0) GbSystem3D::writeGeoObject(refineCube1.get(), pathname+"/geo/refineCube1", WbWriterVtkXmlASCII::getInstance());
+
+      GbObject3DPtr refineCube2(new  GbCuboid3D(-0.16,-0.05, -0.141754, 0.2,0.05,0.0446053));
+      if(myid == 0) GbSystem3D::writeGeoObject(refineCube2.get(), pathname+"/geo/refineCube2", WbWriterVtkXmlASCII::getInstance());
+      //////////////////////////////////////////////////////////////////////////
+
+      Grid3DPtr grid(new Grid3D());
+
+      UbSchedulerPtr rSch(new UbScheduler());
+      rSch->addSchedule(20000, 20000, endTime-1);
+      RestartPostprocessorPtr rp(new RestartPostprocessor(grid, rSch, comm, pathname+"/checkpoints", RestartPostprocessor::BINARY));
+
+      std::string opt;
+
+      if(cstr!= NULL)
+         opt = std::string(cstr);
+
+      if/*(cstr== NULL)*/(cstr!= NULL)
+      {
+         opt = std::string(cstr);
+
+         if(myid==0) UBLOG(logINFO,"Restart step: " << opt);
+
+         grid = rp->restart(UbSystem::stringTo<int>(opt));
+         rp->reconnect();
+
+         if(myid ==0) UBLOG(logINFO,"TimeStep = " <<grid->getTimeStep());
+
+         //set connectors
+         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
+         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
+         grid->accept( setConnsVisitor );
+
+         //domain decomposition
+         //PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
+         //grid->accept(pqPartVisitor);
+      }
+      else
+      {
+         if(myid ==0)
+         {
+            UBLOG(logINFO,"L = " <<lLB );
+            UBLOG(logINFO,"v = " <<vLB );
+            UBLOG(logINFO,"rho = " <<rhoLB );
+            UBLOG(logINFO,"nue = " << nueLB );
+            UBLOG(logINFO,"Re = " << Re );
+            UBLOG(logINFO,"Preprozess - start");
+         }
+
+
+         ////////////////////////////////////////////////////////////////////////
+         //Grid
+         //////////////////////////////////////////////////////////////////////////
+         grid->setDeltaX(dx);
+         grid->setBlockNX(nodePerBlockX1, nodePerBlockX2, nodePerBlockX2);
+
+         ////////////////////////////////////////////////////////////////////////////
+         //// Geometrie
+         ////////////////////////////////////////////////////////////////////////////
+         //GbTriFaceMesh3DPtr geo (GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(geoFile,"geo"));
+
+         //if(myid == 0) GbSystem3D::writeGeoObject(geo.get(), pathname+"/geo/geo", WbWriterVtkXmlASCII::getInstance());
+
+         ////////////////////////////////////////////////////////////////////////////
+         //// Randgeometrien erstellen
+         ////////////////////////////////////////////////////////////////////////////
+         
+         GbCuboid3DPtr plate1  = GbCuboid3DPtr( new GbCuboid3D( -7.5, -1.515e-1, -6.831e-2, 7.5, 1.515e-1, 0.0 ));
+
+         GbCuboid3DPtr plate2  = GbCuboid3DPtr( new GbCuboid3D( -1.5e-1, -16.51e-1, -16.831e-2, 1.5e-1, -1.6e-2, 1.0 ));
+         GbCuboid3DPtr plate3  = GbCuboid3DPtr( new GbCuboid3D( -1.5e-1, 1.6e-2, -16.831e-2, 1.5e-1, 16.515e-1, 1.0 ));
+
+         GbCuboid3DPtr plate1_1  = GbCuboid3DPtr( new GbCuboid3D( -7.5, -2.515e-1, -1.0e-1, 7.5, 2.515e-1, -6.831e-2 ));
+         GbCuboid3DPtr plate1_2  = GbCuboid3DPtr( new GbCuboid3D( -7.5, -2.515e-1, -0.0000001, 7.5, 2.515e-1, 1.0e-1 ));
+         //GbCuboid3DPtr plate1_3  = GbCuboid3DPtr( new GbCuboid3D( -7.5, 1.515e-1, -6.831e-2, 7.5, 2.515e-1, 0.0  ));
+         GbCuboid3DPtr plate1_3  = GbCuboid3DPtr( new GbCuboid3D( -7.5, 1.515e-1, -9.831e-2, 7.5, 2.515e-1, 0.06  ));
+         GbCuboid3DPtr plate1_4  = GbCuboid3DPtr( new GbCuboid3D( -7.5, -2.515e-1, 0.0, 7.5, -1.515e-1, -1.0e-1 ));
+
+         GbCuboid3DPtr inflow  = GbCuboid3DPtr( new GbCuboid3D( -8.0, -1.0, -1.0, -7.5, 1.0, 1.0 ));
+         GbCuboid3DPtr outflow = GbCuboid3DPtr( new GbCuboid3D( 7.5, -1.0, -1.0, 8.0, 1.0, 1.0 ));
+
+         if(myid == 0)
+         {
+            GbSystem3D::writeGeoObject(plate2.get(),pathname+"/geo/plate2", WbWriterVtkXmlASCII::getInstance());
+            GbSystem3D::writeGeoObject(plate3.get(),pathname+"/geo/plate3", WbWriterVtkXmlASCII::getInstance());
+
+            GbSystem3D::writeGeoObject(plate1_1.get(),pathname+"/geo/plate1_1", WbWriterVtkXmlASCII::getInstance());
+            GbSystem3D::writeGeoObject(plate1_2.get(),pathname+"/geo/plate1_2", WbWriterVtkXmlASCII::getInstance());
+            GbSystem3D::writeGeoObject(plate1_3.get(),pathname+"/geo/plate1_3", WbWriterVtkXmlASCII::getInstance());
+            GbSystem3D::writeGeoObject(plate1_4.get(),pathname+"/geo/plate1_4", WbWriterVtkXmlASCII::getInstance());
+
+            GbSystem3D::writeGeoObject(inflow.get(),pathname+"/geo/inflow", WbWriterVtkXmlASCII::getInstance());
+            GbSystem3D::writeGeoObject(outflow.get(),pathname+"/geo/outflow", WbWriterVtkXmlASCII::getInstance());
+         }
+
+         double shiftForMG=grid->getDeltaX(refineLevel)*nodePerBlockX1 / 3.0*1.5;
+
+         GbObject3DPtr gridCube(new GbCuboid3D(plate1->getX1Minimum()-shiftForMG, plate1->getX2Minimum()-shiftForMG, plate1->getX3Minimum()-shiftForMG,
+                                                plate1->getX1Maximum()+shiftForMG, 
+                                                plate1->getX2Maximum()+shiftForMG, 
+                                                plate1->getX3Maximum()+shiftForMG));
+
+         GenBlocksGridVisitor genBlocks;
+         genBlocks.addGeoObject(gridCube);
+         grid->accept(genBlocks);
+
+         if (refineLevel > 0)
+         {
+            if(myid == 0) UBLOG(logINFO,"Refinement - start");	
+            RefineCrossAndInsideGbObjectBlockVisitor refVisitor1(refineCube1, baseLevel, refineLevel-3);
+            grid->accept(refVisitor1);
+
+            RefineCrossAndInsideGbObjectBlockVisitor refVisitor2(refineCube2, baseLevel, refineLevel-1);
+            grid->accept(refVisitor2);
+
+            RatioBlockVisitor ratioVisitor(refineLevel);
+            grid->accept(ratioVisitor);
+
+            RatioSmoothBlockVisitor ratioSmoothVisitor(refineLevel);
+            grid->accept(ratioSmoothVisitor);
+
+            OverlapBlockVisitor overlapVisitor(refineLevel);
+            grid->accept(overlapVisitor);
+
+            std::vector<int> dirs;
+            D3Q27System::getLBMDirections(dirs);
+            SetInterpolationDirsBlockVisitor interDirsVisitor(dirs);
+            grid->accept(interDirsVisitor);
+            if(myid == 0) UBLOG(logINFO,"Refinement - end");	
+         }
+
+         //////////////////////////////////////////////////////////////////////////
+         //INTERAKTOREN SETZEN (=Randbedingungen)
+         //////////////////////////////////////////////////////////////////////////
+         //oben/unten = Haftrand
+         int bbOption = 1; //0=simple Bounce Back, 1=quadr. BB
+         D3Q27BoundaryConditionAdapterPtr bcObst(new D3Q27NoSlipBCAdapter(bbOption));
+         //D3Q27TriFaceMeshInteractorPtr geoInt = D3Q27TriFaceMeshInteractorPtr( new D3Q27TriFaceMeshInteractor(geo, grid, D3Q27BoundaryConditionAdapterPtr(new D3Q27NoSlipBCAdapter(bbOption)),Interactor3D::SOLID));
+         //geoInt->setUseHalfSpaceCheck(true);
+         //geoInt->setRegardPointInObjectTest(true);
+
+         //D3Q27InteractorPtr plate1Int(new D3Q27Interactor(plate1, grid, bcObst,Interactor3D::INVERSESOLID));
+         D3Q27InteractorPtr plate2Int(new D3Q27Interactor(plate2, grid, bcObst,Interactor3D::SOLID));
+         D3Q27InteractorPtr plate3Int(new D3Q27Interactor(plate3, grid, bcObst,Interactor3D::SOLID));
+
+         D3Q27InteractorPtr plate1_1Int(new D3Q27Interactor(plate1_1, grid, bcObst,Interactor3D::SOLID));
+         D3Q27InteractorPtr plate1_2Int(new D3Q27Interactor(plate1_2, grid, bcObst,Interactor3D::SOLID));
+         D3Q27InteractorPtr plate1_3Int(new D3Q27Interactor(plate1_3, grid, bcObst,Interactor3D::SOLID));
+         D3Q27InteractorPtr plate1_4Int(new D3Q27Interactor(plate1_4, grid, bcObst,Interactor3D::SOLID));
+
+         //links: geschwindigkeits-einfluss
+         //Velocity-BC
+         //////////////////////////////////////////////////////////////////////////
+         mu::Parser fct;
+         fct.DefineConst("vx1"  , vLB*9.0/4.0);
+         fct = Utilities::getDuctParaboloidX(plate1->getX2Centroid(), plate1->getX2Maximum() - plate1->getX2Minimum(), plate1->getX3Centroid(), plate1->getX3Minimum() - plate1->getX3Maximum(), vLB*9.0/4.0);
+         //fct.SetExpr("vx1");
+         //////////////////////////////////////////////////////////////////////////
+         //////////////////////////////////////////////////////////////////////////
+         D3Q27BoundaryConditionAdapterPtr velBCAdapter = D3Q27BoundaryConditionAdapterPtr(new D3Q27VelocityBCAdapter (true, false ,false ,fct, 0, D3Q27BCFunction::INFCONST));
+        // velBCAdapter->setSecondaryBcOption(2);
+         D3Q27InteractorPtr inflowInt  = D3Q27InteractorPtr( new D3Q27Interactor(inflow, grid, velBCAdapter, Interactor3D::SOLID));
+
+         //rechts: druckrand
+         //Density-BC
+         //fuer Kompressibles Modell  rho = 1.0
+         D3Q27BoundaryConditionAdapterPtr denBCAdapter(new D3Q27DensityBCAdapter(rhoLB));
+         denBCAdapter->setSecondaryBcOption(1);
+         D3Q27InteractorPtr outflowInt = D3Q27InteractorPtr( new D3Q27Interactor(outflow, grid, denBCAdapter,Interactor3D::SOLID));
+
+         MetisPartitioningGridVisitor metisVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B);
+         //MetisPartitioningGridVisitor metisVisitor(comm, MetisPartitioningGridVisitor::LevelIntersected, D3Q27System::B, true, numOfThreads);
+         grid->accept( metisVisitor );
+
+         SolidBlocksHelper sd(grid, comm);
+         //sd.addInteractor(geoInt);
+         sd.addInteractor(inflowInt);
+         sd.addInteractor(outflowInt);
+         sd.addInteractor(plate1_1Int);
+         sd.addInteractor(plate1_2Int);
+         sd.addInteractor(plate1_3Int);
+         sd.addInteractor(plate1_4Int);
+         sd.addInteractor(plate2Int);
+         sd.addInteractor(plate3Int);
+         sd.deleteSolidBlocks();     
+
+         grid->accept( metisVisitor );
+
+         BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname + "/grid/blocks", WbWriterVtkXmlBinary::getInstance(), comm));
+         ppblocks->update(0);
+         ppblocks.reset();
+
+         unsigned long nob = grid->getNumberOfBlocks();
+         int gl = 3;
+         unsigned long nod_temp = nob * (nodePerBlockX1+gl) * (nodePerBlockX2+gl) * (nodePerBlockX3+gl);
+         unsigned long nod = nob * (nodePerBlockX1) * (nodePerBlockX2) * (nodePerBlockX3);
+         double needMemAll  = double(nod_temp*(27*sizeof(double) + sizeof(int) + sizeof(float)*4));
+         double needMem  = needMemAll / double(comm->getNumberOfProcesses());
+
+         if(myid == 0)
+         {
+            UBLOG(logINFO,"Number of blocks = " << nob);
+            UBLOG(logINFO,"Number of nodes  = " << nod);
+            UBLOG(logINFO,"Necessary memory  = " << needMemAll  << " bytes");
+            UBLOG(logINFO,"Necessary memory per process = " << needMem  << " bytes");
+            UBLOG(logINFO,"Available memory per process = " << availMem << " bytes");
+         }  
+
+         //LBMKernel3DPtr kernel(new LBMKernelETD3Q27Cascaded(nodePerBlockX1, nodePerBlockX2, nodePerBlockX2));
+         //option = 0 - ohne param., option = 1 - mit param.
+         int option = 0;
+         LBMKernel3DPtr kernel(new LBMKernelETD3Q27CCLB(nodePerBlockX1, nodePerBlockX2, nodePerBlockX2, option));
+
+         BCProcessorPtr bcProc(new D3Q27ETBCProcessor());
+         kernel->setBCProcessor(bcProc);
+
+         SetKernelBlockVisitor kernelVisitor(kernel, nueLB, availMem, needMem);
+         grid->accept(kernelVisitor);
+
+         {
+            D3Q27SetUndefinedNodesBlockVisitor undefNodesVisitor;
+            grid->accept(undefNodesVisitor);
+         }
+
+         //canal
+         //grid->addAndInitInteractor(geoInt);
+         grid->addAndInitInteractor(plate1_1Int);
+         grid->addAndInitInteractor(plate1_2Int);
+         grid->addAndInitInteractor(plate1_3Int);
+         grid->addAndInitInteractor(plate1_4Int);
+         grid->addAndInitInteractor(plate2Int);
+         grid->addAndInitInteractor(plate3Int);
+
+         //inflow
+         grid->addAndInitInteractor(inflowInt);
+
+         //outflow
+         grid->addAndInitInteractor(outflowInt);
+
+         //////////////////////////////////////////////////////////////////////////
+         //connectoren setzen:
+         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
+         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
+         grid->accept( setConnsVisitor );
+         //////////////////////////////////////////////////////////////////////////
+         //domain decomposition
+         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
+         grid->accept(pqPartVisitor);
+         //////////////////////////////////////////////////////////////////////////
+         //Stroemungsfeld initialisieren
+         //////////////////////////////////////////////////////////////////////////
+         D3Q27ETInitDistributionsBlockVisitor initVisitor(rhoLB); //1.0
+         //initVisitor.setVx1(0.0); 
+         grid->accept(initVisitor);
+
+         //if(myid == 0)
+         //{
+         //   //Abst�nde "q" als Linien rausschreiben
+         //   std::vector< UbTupleFloat3 > nodes;
+         //   std::vector< UbTupleInt2 >   lines;
+         //   geoInt->addQsLineSet(nodes, lines);
+         //   WbWriterVtkXmlBinary::getInstance()->writeLines(pathname+"/grid/qs",nodes,lines);
+         //}
+
+         if(myid == 0) UBLOG(logINFO,"Preprozess - end");
+
+      }
+      //////////////////////////////////////////////////////////////////////////
+      //Set Postprozessors
+      //////////////////////////////////////////////////////////////////////////
+      {
+         UbSchedulerPtr geoSch(new UbScheduler(1));
+         D3Q27MacroscopicQuantitiesPostprocessor ppgeo(grid,geoSch, pathname + "/grid/nodes", WbWriterVtkXmlBinary::getInstance(), conv,  comm, true);
+         grid->doPostProcess(0);
+      }
+
+      UbSchedulerPtr nupsSch(new UbScheduler(1, 5, 10));
+      NUPSCounterPostprocessor npr(grid, nupsSch, pathname + "/results/nups.txt", comm);
+
+      double outTime = 2000;
+      UbSchedulerPtr stepSch(new UbScheduler(outTime));
+      stepSch->addSchedule(100, 100, 100);
+      D3Q27MacroscopicQuantitiesPostprocessor pp(grid,stepSch, pathname + "/steps/step", WbWriterVtkXmlBinary::getInstance(), conv,  comm);
+      //////////////////////////////////////////////////////////////////////////
+      //PathLine
+      //UbSchedulerPtr plSch(new UbScheduler(10, 1500));
+      //D3Q27PathLinePostprocessor pathLine(grid, pathname + "/pathLine", WbWriterVtkXmlASCII::getInstance(), conv, plSch, comm, -0.3285474538, 0.09692341,-0.0376166666, nueLB, iProcessor);
+      //////////////////////////////////////////////////////////////////////////
+      //Simulation
+      //////////////////////////////////////////////////////////////////////////
+
+      UbSchedulerPtr visSch(stepSch);
+      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, visSch));
+      if(myid == 0) UBLOG(logINFO,"Simulation-start");
+      calculation->calculate();
+      if(myid == 0) UBLOG(logINFO,"Simulation-end");
+
+   }
+   catch(std::exception& e)
+   {
+      cerr << e.what() << endl;
+   }
+   catch(std::string& s)
+   {
+      cerr << s << endl;
+   }
+   catch(...)
+   {
+      cerr << "unknown exception" << endl;
+   }
+
+}
diff --git a/apps/cpu/micropart/micropartSetup2.hpp b/apps/cpu/micropart/micropartSetup2.hpp
index 0e8f904dbfa446a77c9295bbb143521bf027c48f..80eff1378c7c6a5cb8e4af6616d48cec286afd93 100644
--- a/apps/cpu/micropart/micropartSetup2.hpp
+++ b/apps/cpu/micropart/micropartSetup2.hpp
@@ -1,444 +1,444 @@
-#include <iostream>
-#include <string>
-#include <map>
-#include "RefineCrossAndInsideGbObjectBlockVisitor.h"
-#include "RatioBlockVisitor.h"
-#include "RatioSmoothBlockVisitor.h"
-#include "OverlapBlockVisitor.h"
-#include "SetInterpolationDirsBlockVisitor.h"
-#include "geometry3d/GbSystem3D.h"
-#include "geometry3d/GbCuboid3D.h"
-#include "geometry3d/GbCylinder3D.h"
-#include "geometry3d/GbSphere3D.h"
-#include "BlocksPostprocessor.h"
-#include "Grid3D.h"
-#include "Patch3D.h"
-#include "Patch3DSystem.h"
-#include "Block3D.h"
-#include "LBMKernelETD3Q27Cascaded.h"
-#include "LBMKernelETD3Q27BGK.h"
-#include "CalculationManager.h" 
-#include "D3Q27SetConnectorsBlockVisitor.h" 
-#include "D3Q27ETInitDistributionsBlockVisitor.h"
-#include "D3Q27Interactor.h"
-#include "D3Q27NoSlipBCAdapter.h"
-#include "D3Q27VelocityBCAdapter.h"
-#include "D3Q27DensityBCAdapter.h"
-#include "SimulationParameters.h"
-#include "Communicator.h"
-#include "MPICommunicator.h"
-#include "SimpleGeometricPartitioner.h"
-#include "D3Q27MacroscopicQuantitiesPostprocessor.h"
-#include "D3Q27ETBCProcessor.h"
-#include "D3Q27TriFaceMeshInteractor.h"
-#include "ConfigFileReader.h"
-#include "StringUtil.hpp"
-#include "D3Q27PressureDifferencePostprocessor.h"
-#include "D3Q27IntegrateValuesHelper.h"
-#include "LBMUnitConverter.h"
-#include "NUPSCounterPostprocessor.h"
-#include "PQueuePartitioningGridVisitor.h"
-#include "SetKernelBlockVisitor.h"
-#include "GenBlocksGridVisitor.h"
-#include "D3Q27PathLinePostprocessor.h"
-#include "D3Q27SetUndefinedNodesBlockVisitor.h"
-   //
-#include "basics/writer/WbWriterVtkXmlBinary.h"
-#include "basics/writer/WbWriterVtkXmlASCII.h"
-#include "geometry3d/creator/GbTriFaceMesh3DCreator.h"
-#include "geometry3d/GbTriFaceMesh3D.h"
-#include "D3Q27System.h"
-#include <basics/transmitter/TbTransmitterMpiPool.h>
-#include "MathUtil.hpp"
-#include "D3Q27OffsetInterpolationProcessor.h"
-#include "SolidBlocksHelper.h"
-#include "MetisPartitioningGridVisitor.h"
-#include "RestartPostprocessor.h"
-#include "D3Q27IncompressibleOffsetInterpolationProcessor.h"
-#include "LBMKernelETD3Q27CCLB.h"
-
-using namespace std;
-
-void runSetup2(const char *cstr)
-{
-   try
-   {
-      CommunicatorPtr comm(new MPICommunicator());
-      int myid = comm->getProcessID();
-      int numprocs = comm->getNumberOfProcesses();
-
-      string machine = QUOTEME(CAB_MACHINE);
-      string pathname; 
-      double availMem = 0;
-      string geoFile;
-      int numOfThreads = 1;
-
-      if(machine == "BOMBADIL") 
-      {
-         pathname = "c:/temp/micropart";
-         availMem = 3.0e9;
-         //geoFile = "c:/Data/micropart/DK19_7_02_Martin.stl";
-         //geoFile = "c:/Data/micropart/ktoolcav.stl";
-         //geoFile = "c:/Data/micropart/boxN.stl";
-         //geoFile = "c:/Data/bananas/Banana_boxD.stl";
-      }
-      else if(machine == "M01" || machine == "M02")      
-      {
-         pathname = "/work/koskuche/scratch/micropart2";
-         availMem = 12.0e9;
-         //geoFile = "/home/koskuche/data/micropart/DK19_7_02_Martin.stl";
-
-         numOfThreads = 1;
-         if(myid ==0)
-         {
-            stringstream logFilename;
-            logFilename <<  pathname + "/logfile"+UbSystem::toString(UbSystem::getTimeStamp())+".txt";
-            UbLog::output_policy::setStream(logFilename.str());
-         }
-      }
-      else throw UbException(UB_EXARGS, "unknown CAB_MACHINE");
-
-      UbLog::reportingLevel() = logINFO;
-      //UbLog::reportingLevel() = logDEBUG1;
-
-      int nodePerBlockX1 = 16; //Anzahl an Knoten pro Block
-      int nodePerBlockX2 = 16;//(int)16;
-      int nodePerBlockX3 = 16;//(int)16;
-
-      double bH = nodePerBlockX1;    //gewuenschte Rand- und Blockbreite
-
-      //Simulation Parameters
-
-      //length [m]
-      double lSI = 0.067;
-      //length [LB]
-      double lLB = 30;
-
-      double dx = 0.0134*0.5;//lSI/lLB;
-
-      double left_offset = 0.5;
-      double right_offset  = 0.5;//2*0.5
-      double front_offset = 0.15;
-      double back_offset  = 0.15;
-      double top_offset = 0.0;
-      double bottom_offset  = 0.07;
-
-      LBMReal vLB = 0.016103;
-      LBMReal Re;
-      LBMReal rhoLB = 0.0;
-      LBMReal nueLB = 0.0000249*2.0;//(vLB*lLB)/Re;
-      Re = (vLB*(0.303/dx))/nueLB;
-      const int baseLevel = 0;
-      const int refineLevel = 5;
-      LBMUnitConverterPtr conv = LBMUnitConverterPtr(new LBMUnitConverter());
-
-      //////////////////////////////////////////////////////////////////////////
-      GbObject3DPtr refineCube1(new  GbCuboid3D(-0.2222890,-0.52993, -0.141754, 0.578916113,0.6089970,0.0446053));
-      if(myid == 0) GbSystem3D::writeGeoObject(refineCube1.get(), pathname+"/geo/refineCube1", WbWriterVtkXmlASCII::getInstance());
-
-      GbObject3DPtr refineCube2(new  GbCuboid3D(-0.16,-0.05, -0.141754, 0.2,0.05,0.0446053));
-      if(myid == 0) GbSystem3D::writeGeoObject(refineCube2.get(), pathname+"/geo/refineCube2", WbWriterVtkXmlASCII::getInstance());
-      //////////////////////////////////////////////////////////////////////////
-
-      Grid3DPtr grid(new Grid3D());
-
-      UbSchedulerPtr rSch(new UbScheduler(1000, 1000));
-      //RestartPostprocessorPtr rp(new RestartPostprocessor(grid, rSch, comm, pathname+"/checkpoints", RestartPostprocessor::BINARY));
-
-      std::string opt;
-
-      if(cstr!= NULL)
-         opt = std::string(cstr);
-
-      if/*(cstr== NULL)*/(cstr!= NULL)
-      {
-         opt = std::string(cstr);
-
-         if(myid==0) UBLOG(logINFO,"Restart step: " << opt);
-
-         //grid = rp->restart(UbSystem::stringTo<int>(opt));
-         //rp->reconnect();
-         grid->setTimeStep(UbSystem::stringTo<int>(opt));
-
-         if(myid ==0) UBLOG(logINFO,"TimeStep = " <<grid->getTimeStep());
-
-         //set connectors
-         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
-         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
-         grid->accept( setConnsVisitor );
-
-         //domain decomposition
-         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
-         grid->accept(pqPartVisitor);
-      }
-      else
-      {
-         if(myid ==0)
-         {
-            UBLOG(logINFO,"L = " <<lLB );
-            UBLOG(logINFO,"v = " <<vLB );
-            UBLOG(logINFO,"rho = " <<rhoLB );
-            UBLOG(logINFO,"nue = " << nueLB );
-            UBLOG(logINFO,"Re = " << Re );
-            UBLOG(logINFO,"Preprozess - start");
-         }
-
-
-         ////////////////////////////////////////////////////////////////////////
-         //Grid
-         //////////////////////////////////////////////////////////////////////////
-         grid->setDeltaX(dx);
-         grid->setBlockNX(nodePerBlockX1, nodePerBlockX2, nodePerBlockX2);
-
-         ////////////////////////////////////////////////////////////////////////////
-         //// Geometrie
-         ////////////////////////////////////////////////////////////////////////////
-         //GbTriFaceMesh3DPtr geo (GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(geoFile,"geo"));
-
-         //if(myid == 0) GbSystem3D::writeGeoObject(geo.get(), pathname+"/geo/geo", WbWriterVtkXmlASCII::getInstance());
-
-         ////////////////////////////////////////////////////////////////////////////
-         //// Randgeometrien erstellen
-         ////////////////////////////////////////////////////////////////////////////
-         double shiftForMG=grid->getDeltaX(refineLevel)*nodePerBlockX1 / 3.0*2.0;
-         GbCuboid3DPtr plate1  = GbCuboid3DPtr( new GbCuboid3D( -7.5, -1.515e-1, -6.831e-2, 7.5, 1.515e-1, 0.0 ));
-
-         GbCuboid3DPtr plate2  = GbCuboid3DPtr( new GbCuboid3D( -1.5e-1, -16.51e-1, -16.831e-2, 1.5e-1, -1.6e-2, 1.0 ));
-         GbCuboid3DPtr plate3  = GbCuboid3DPtr( new GbCuboid3D( -1.5e-1, 1.6e-2, -16.831e-2, 1.5e-1, 16.515e-1, 1.0 ));
-
-         GbCuboid3DPtr plate1_1  = GbCuboid3DPtr( new GbCuboid3D( -7.5, -2.515e-1, -1.0e-1, 7.5, 2.515e-1, -6.831e-2 ));
-         GbCuboid3DPtr plate1_2  = GbCuboid3DPtr( new GbCuboid3D( -7.5, -2.515e-1, -0.0000001, 7.5, 2.515e-1, 1.0e-1 ));
-         GbCuboid3DPtr plate1_3  = GbCuboid3DPtr( new GbCuboid3D( -7.5, 1.515e-1, -6.831e-2, 7.5, 2.515e-1, 0.0  ));
-         GbCuboid3DPtr plate1_4  = GbCuboid3DPtr( new GbCuboid3D( -7.5, -2.515e-1, 0.0, 7.5, -1.515e-1, -1.0e-1 ));
-
-         GbCuboid3DPtr inflow  = GbCuboid3DPtr( new GbCuboid3D( -8.0, -1.0, -1.0, -7.5, 1.0, 1.0 ));
-         GbCuboid3DPtr outflow = GbCuboid3DPtr( new GbCuboid3D( 7.5, -1.0, -1.0, 8.0, 1.0, 1.0 ));
-
-         if(myid == 0)
-         {
-            GbSystem3D::writeGeoObject(plate1.get(),pathname+"/geo/plate1", WbWriterVtkXmlASCII::getInstance());
-            GbSystem3D::writeGeoObject(plate2.get(),pathname+"/geo/plate2", WbWriterVtkXmlASCII::getInstance());
-            GbSystem3D::writeGeoObject(plate3.get(),pathname+"/geo/plate3", WbWriterVtkXmlASCII::getInstance());
-
-            GbSystem3D::writeGeoObject(plate1_1.get(),pathname+"/geo/plate1_1", WbWriterVtkXmlASCII::getInstance());
-            GbSystem3D::writeGeoObject(plate1_2.get(),pathname+"/geo/plate1_2", WbWriterVtkXmlASCII::getInstance());
-            GbSystem3D::writeGeoObject(plate1_3.get(),pathname+"/geo/plate1_3", WbWriterVtkXmlASCII::getInstance());
-            GbSystem3D::writeGeoObject(plate1_4.get(),pathname+"/geo/plate1_4", WbWriterVtkXmlASCII::getInstance());
-
-            GbSystem3D::writeGeoObject(inflow.get(),pathname+"/geo/inflow", WbWriterVtkXmlASCII::getInstance());
-            GbSystem3D::writeGeoObject(outflow.get(),pathname+"/geo/outflow", WbWriterVtkXmlASCII::getInstance());
-         }
-
-         GbObject3DPtr gridCube(new GbCuboid3D(plate1->getX1Minimum()-shiftForMG, plate1->getX2Minimum()-shiftForMG, plate1->getX3Minimum()-shiftForMG,
-                                                plate1->getX1Maximum()+shiftForMG, 
-                                                plate1->getX2Maximum()+shiftForMG, 
-                                                plate1->getX3Maximum()+shiftForMG));
-
-         GenBlocksGridVisitor genBlocks;
-         genBlocks.addGeoObject(gridCube);
-         grid->accept(genBlocks);
-
-         if (refineLevel > 0)
-         {
-            if(myid == 0) UBLOG(logINFO,"Refinement - start");	
-            RefineCrossAndInsideGbObjectBlockVisitor refVisitor1(refineCube1, baseLevel, refineLevel-3);
-            grid->accept(refVisitor1);
-
-            RefineCrossAndInsideGbObjectBlockVisitor refVisitor2(refineCube2, baseLevel, refineLevel-1);
-            grid->accept(refVisitor2);
-
-            RatioBlockVisitor ratioVisitor(refineLevel);
-            grid->accept(ratioVisitor);
-
-            RatioSmoothBlockVisitor ratioSmoothVisitor(refineLevel);
-            grid->accept(ratioSmoothVisitor);
-
-            OverlapBlockVisitor overlapVisitor(refineLevel);
-            grid->accept(overlapVisitor);
-
-            std::vector<int> dirs;
-            D3Q27System::getLBMDirections(dirs);
-            SetInterpolationDirsBlockVisitor interDirsVisitor(dirs);
-            grid->accept(interDirsVisitor);
-            if(myid == 0) UBLOG(logINFO,"Refinement - end");	
-         }
-
-         //////////////////////////////////////////////////////////////////////////
-         //INTERAKTOREN SETZEN (=Randbedingungen)
-         //////////////////////////////////////////////////////////////////////////
-         //oben/unten = Haftrand
-         int bbOption = 1; //0=simple Bounce Back, 1=quadr. BB
-         D3Q27BoundaryConditionAdapterPtr bcObst(new D3Q27NoSlipBCAdapter(bbOption));
-         //D3Q27TriFaceMeshInteractorPtr geoInt = D3Q27TriFaceMeshInteractorPtr( new D3Q27TriFaceMeshInteractor(geo, grid, D3Q27BoundaryConditionAdapterPtr(new D3Q27NoSlipBCAdapter(bbOption)),Interactor3D::SOLID));
-         //geoInt->setUseHalfSpaceCheck(true);
-         //geoInt->setRegardPointInObjectTest(true);
-
-         //D3Q27InteractorPtr plate1Int(new D3Q27Interactor(plate1, grid, bcObst,Interactor3D::INVERSESOLID));
-         D3Q27InteractorPtr plate2Int(new D3Q27Interactor(plate2, grid, bcObst,Interactor3D::SOLID));
-         D3Q27InteractorPtr plate3Int(new D3Q27Interactor(plate3, grid, bcObst,Interactor3D::SOLID));
-
-         D3Q27InteractorPtr plate1_1Int(new D3Q27Interactor(plate1_1, grid, bcObst,Interactor3D::SOLID));
-         D3Q27InteractorPtr plate1_2Int(new D3Q27Interactor(plate1_2, grid, bcObst,Interactor3D::SOLID));
-         D3Q27InteractorPtr plate1_3Int(new D3Q27Interactor(plate1_3, grid, bcObst,Interactor3D::SOLID));
-         D3Q27InteractorPtr plate1_4Int(new D3Q27Interactor(plate1_4, grid, bcObst,Interactor3D::SOLID));
-
-         //links: geschwindigkeits-einfluss
-         //Velocity-BC
-         //////////////////////////////////////////////////////////////////////////
-         mu::Parser fct;
-         fct.DefineConst("vx1"  , vLB*9.0/4.0 );
-         fct = Utilities::getDuctParaboloidX(plate1->getX2Centroid(), plate1->getX2Maximum() - plate1->getX2Minimum(), plate1->getX3Centroid(), plate1->getX3Minimum() - plate1->getX3Maximum(), vLB*9.0/4.0);
-         //fct.SetExpr("vx1");
-         //////////////////////////////////////////////////////////////////////////
-
-         //////////////////////////////////////////////////////////////////////////
-         D3Q27BoundaryConditionAdapterPtr velBCAdapter = D3Q27BoundaryConditionAdapterPtr(new D3Q27VelocityBCAdapter (true, false ,false ,fct, 0, D3Q27BCFunction::INFCONST));
-         velBCAdapter->setSecondaryBcOption(2);
-         D3Q27InteractorPtr inflowInt  = D3Q27InteractorPtr( new D3Q27Interactor(inflow, grid, velBCAdapter, Interactor3D::SOLID));
-
-         //rechts: druckrand
-         //Density-BC
-         //fuer Kompressibles Modell  rho = 1.0
-         D3Q27BoundaryConditionAdapterPtr denBCAdapter(new D3Q27DensityBCAdapter(rhoLB));
-         denBCAdapter->setSecondaryBcOption(1);
-         D3Q27InteractorPtr outflowInt = D3Q27InteractorPtr( new D3Q27Interactor(outflow, grid, denBCAdapter,Interactor3D::SOLID));
-
-         MetisPartitioningGridVisitor metisVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B);
-         grid->accept( metisVisitor );
-
-         SolidBlocksHelper sd(grid, comm);
-         //sd.addInteractor(geoInt);
-         sd.addInteractor(inflowInt);
-         sd.addInteractor(outflowInt);
-         sd.addInteractor(plate1_1Int);
-         sd.addInteractor(plate1_2Int);
-         sd.addInteractor(plate1_3Int);
-         sd.addInteractor(plate1_4Int);
-         sd.addInteractor(plate2Int);
-         sd.addInteractor(plate3Int);
-         sd.deleteSolidBlocks();     
-
-         grid->accept( metisVisitor );
-
-         BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname + "/grid/blocks", WbWriterVtkXmlBinary::getInstance(), comm));
-         ppblocks->update(0);
-         ppblocks.reset();
-
-         unsigned long nob = grid->getNumberOfBlocks();
-         int gl = 3;
-         unsigned long nod_temp = nob * (nodePerBlockX1+gl) * (nodePerBlockX2+gl) * (nodePerBlockX3+gl);
-         unsigned long nod = nob * (nodePerBlockX1) * (nodePerBlockX2) * (nodePerBlockX3);
-         double needMemAll  = double(nod_temp*(27*sizeof(double) + sizeof(int) + sizeof(float)*4));
-         double needMem  = needMemAll / double(comm->getNumberOfProcesses());
-
-         if(myid == 0)
-         {
-            UBLOG(logINFO,"Number of blocks = " << nob);
-            UBLOG(logINFO,"Number of nodes  = " << nod);
-            UBLOG(logINFO,"Necessary memory  = " << needMemAll  << " bytes");
-            UBLOG(logINFO,"Necessary memory per process = " << needMem  << " bytes");
-            UBLOG(logINFO,"Available memory per process = " << availMem << " bytes");
-         }  
-
-         //LBMKernel3DPtr kernel(new LBMKernelETD3Q27Cascaded(nodePerBlockX1, nodePerBlockX2, nodePerBlockX2));
-         LBMKernel3DPtr kernel(new LBMKernelETD3Q27CCLB(nodePerBlockX1, nodePerBlockX2, nodePerBlockX2));
-
-         BCProcessorPtr bcProc(new D3Q27ETBCProcessor());
-         kernel->setBCProcessor(bcProc);
-
-         SetKernelBlockVisitor kernelVisitor(kernel, nueLB, availMem, needMem);
-         grid->accept(kernelVisitor);
-
-         if (refineLevel > 0)
-         {
-            D3Q27SetUndefinedNodesBlockVisitor undefNodesVisitor;
-            grid->accept(undefNodesVisitor);
-         }
-
-         //canal
-         //grid->addAndInitInteractor(geoInt);
-         grid->addAndInitInteractor(plate1_1Int);
-         grid->addAndInitInteractor(plate1_2Int);
-         grid->addAndInitInteractor(plate1_3Int);
-         grid->addAndInitInteractor(plate1_4Int);
-         grid->addAndInitInteractor(plate2Int);
-         grid->addAndInitInteractor(plate3Int);
-
-         //inflow
-         grid->addAndInitInteractor(inflowInt);
-
-         //outflow
-         grid->addAndInitInteractor(outflowInt);
-
-         //////////////////////////////////////////////////////////////////////////
-         //connectoren setzen:
-         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
-         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
-         grid->accept( setConnsVisitor );
-         //////////////////////////////////////////////////////////////////////////
-         //domain decomposition
-         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
-         grid->accept(pqPartVisitor);
-         //////////////////////////////////////////////////////////////////////////
-         //Stroemungsfeld initialisieren
-         //////////////////////////////////////////////////////////////////////////
-         D3Q27ETInitDistributionsBlockVisitor initVisitor(rhoLB); //1.0
-         //initVisitor.setVx1(0.0); 
-         grid->accept(initVisitor);
-
-         //if(myid == 0)
-         //{
-         //   //Abst�nde "q" als Linien rausschreiben
-         //   std::vector< UbTupleFloat3 > nodes;
-         //   std::vector< UbTupleInt2 >   lines;
-         //   geoInt->addQsLineSet(nodes, lines);
-         //   WbWriterVtkXmlBinary::getInstance()->writeLines(pathname+"/grid/qs",nodes,lines);
-         //}
-
-         if(myid == 0) UBLOG(logINFO,"Preprozess - end");
-
-      }
-      //////////////////////////////////////////////////////////////////////////
-      //Set Postprozessors
-      //////////////////////////////////////////////////////////////////////////
-      {
-         UbSchedulerPtr geoSch(new UbScheduler(1));
-         D3Q27MacroscopicQuantitiesPostprocessor ppgeo(grid,geoSch, pathname + "/grid/nodes", WbWriterVtkXmlBinary::getInstance(), conv,  comm, true);
-         grid->doPostProcess(0);
-      }
-
-      UbSchedulerPtr nupsSch(new UbScheduler(1, 5, 10));
-      NUPSCounterPostprocessor npr(grid, nupsSch, pathname + "/results/nups.txt", comm);
-
-      double outTime = 2000;
-      UbSchedulerPtr stepSch(new UbScheduler(outTime));
-      D3Q27MacroscopicQuantitiesPostprocessor pp(grid,stepSch, pathname + "/steps/step", WbWriterVtkXmlBinary::getInstance(), conv,  comm);
-      //////////////////////////////////////////////////////////////////////////
-      //PathLine
-      //UbSchedulerPtr plSch(new UbScheduler(10, 1500));
-      //D3Q27PathLinePostprocessor pathLine(grid, pathname + "/pathLine", WbWriterVtkXmlASCII::getInstance(), conv, plSch, comm, -0.3285474538, 0.09692341,-0.0376166666, nueLB, iProcessor);
-      //////////////////////////////////////////////////////////////////////////
-      //Simulation
-      //////////////////////////////////////////////////////////////////////////
-      double endTime = 1000000;
-      UbSchedulerPtr visSch(stepSch);
-      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, visSch));
-      if(myid == 0) UBLOG(logINFO,"Simulation-start");
-      calculation->calculate();
-      if(myid == 0) UBLOG(logINFO,"Simulation-end");
-
-   }
-   catch(std::exception& e)
-   {
-      cerr << e.what() << endl;
-   }
-   catch(std::string& s)
-   {
-      cerr << s << endl;
-   }
-   catch(...)
-   {
-      cerr << "unknown exception" << endl;
-   }
-
-}
+#include <iostream>
+#include <string>
+#include <map>
+#include "RefineCrossAndInsideGbObjectBlockVisitor.h"
+#include "RatioBlockVisitor.h"
+#include "RatioSmoothBlockVisitor.h"
+#include "OverlapBlockVisitor.h"
+#include "SetInterpolationDirsBlockVisitor.h"
+#include "geometry3d/GbSystem3D.h"
+#include "geometry3d/GbCuboid3D.h"
+#include "geometry3d/GbCylinder3D.h"
+#include "geometry3d/GbSphere3D.h"
+#include "BlocksPostprocessor.h"
+#include "Grid3D.h"
+#include "Patch3D.h"
+#include "Patch3DSystem.h"
+#include "Block3D.h"
+#include "LBMKernelETD3Q27Cascaded.h"
+#include "LBMKernelETD3Q27BGK.h"
+#include "CalculationManager.h" 
+#include "D3Q27SetConnectorsBlockVisitor.h" 
+#include "D3Q27ETInitDistributionsBlockVisitor.h"
+#include "D3Q27Interactor.h"
+#include "D3Q27NoSlipBCAdapter.h"
+#include "D3Q27VelocityBCAdapter.h"
+#include "D3Q27DensityBCAdapter.h"
+#include "SimulationParameters.h"
+#include "Communicator.h"
+#include "MPICommunicator.h"
+#include "SimpleGeometricPartitioner.h"
+#include "D3Q27MacroscopicQuantitiesPostprocessor.h"
+#include "D3Q27ETBCProcessor.h"
+#include "D3Q27TriFaceMeshInteractor.h"
+#include "ConfigFileReader.h"
+#include "StringUtil.hpp"
+#include "D3Q27PressureDifferencePostprocessor.h"
+#include "D3Q27IntegrateValuesHelper.h"
+#include "LBMUnitConverter.h"
+#include "NUPSCounterPostprocessor.h"
+#include "PQueuePartitioningGridVisitor.h"
+#include "SetKernelBlockVisitor.h"
+#include "GenBlocksGridVisitor.h"
+#include "D3Q27PathLinePostprocessor.h"
+#include "D3Q27SetUndefinedNodesBlockVisitor.h"
+   //
+#include "basics/writer/WbWriterVtkXmlBinary.h"
+#include "basics/writer/WbWriterVtkXmlASCII.h"
+#include "geometry3d/creator/GbTriFaceMesh3DCreator.h"
+#include "geometry3d/GbTriFaceMesh3D.h"
+#include "D3Q27System.h"
+#include <basics/transmitter/TbTransmitterMpiPool.h>
+#include "MathUtil.hpp"
+#include "D3Q27OffsetInterpolationProcessor.h"
+#include "SolidBlocksHelper.h"
+#include "MetisPartitioningGridVisitor.h"
+#include "RestartPostprocessor.h"
+#include "D3Q27IncompressibleOffsetInterpolationProcessor.h"
+#include "LBMKernelETD3Q27CCLB.h"
+
+using namespace std;
+
+void runSetup2(const char *cstr)
+{
+   try
+   {
+      CommunicatorPtr comm(new MPICommunicator());
+      int myid = comm->getProcessID();
+      int numprocs = comm->getNumberOfProcesses();
+
+      string machine = QUOTEME(CAB_MACHINE);
+      string pathname; 
+      double availMem = 0;
+      string geoFile;
+      int numOfThreads = 1;
+
+      if(machine == "BOMBADIL") 
+      {
+         pathname = "c:/temp/micropart";
+         availMem = 3.0e9;
+         //geoFile = "c:/Data/micropart/DK19_7_02_Martin.stl";
+         //geoFile = "c:/Data/micropart/ktoolcav.stl";
+         //geoFile = "c:/Data/micropart/boxN.stl";
+         //geoFile = "c:/Data/bananas/Banana_boxD.stl";
+      }
+      else if(machine == "M01" || machine == "M02")      
+      {
+         pathname = "/work/koskuche/scratch/micropart2";
+         availMem = 12.0e9;
+         //geoFile = "/home/koskuche/data/micropart/DK19_7_02_Martin.stl";
+
+         numOfThreads = 1;
+         if(myid ==0)
+         {
+            stringstream logFilename;
+            logFilename <<  pathname + "/logfile"+UbSystem::toString(UbSystem::getTimeStamp())+".txt";
+            UbLog::output_policy::setStream(logFilename.str());
+         }
+      }
+      else throw UbException(UB_EXARGS, "unknown CAB_MACHINE");
+
+      UbLog::reportingLevel() = logINFO;
+      //UbLog::reportingLevel() = logDEBUG1;
+
+      int nodePerBlockX1 = 16; //Anzahl an Knoten pro Block
+      int nodePerBlockX2 = 16;//(int)16;
+      int nodePerBlockX3 = 16;//(int)16;
+
+      double bH = nodePerBlockX1;    //gewuenschte Rand- und Blockbreite
+
+      //Simulation Parameters
+
+      //length [m]
+      double lSI = 0.067;
+      //length [LB]
+      double lLB = 30;
+
+      double dx = 0.0134*0.5;//lSI/lLB;
+
+      double left_offset = 0.5;
+      double right_offset  = 0.5;//2*0.5
+      double front_offset = 0.15;
+      double back_offset  = 0.15;
+      double top_offset = 0.0;
+      double bottom_offset  = 0.07;
+
+      LBMReal vLB = 0.016103;
+      LBMReal Re;
+      LBMReal rhoLB = 0.0;
+      LBMReal nueLB = 0.0000249*2.0;//(vLB*lLB)/Re;
+      Re = (vLB*(0.303/dx))/nueLB;
+      const int baseLevel = 0;
+      const int refineLevel = 5;
+      LBMUnitConverterPtr conv = LBMUnitConverterPtr(new LBMUnitConverter());
+
+      //////////////////////////////////////////////////////////////////////////
+      GbObject3DPtr refineCube1(new  GbCuboid3D(-0.2222890,-0.52993, -0.141754, 0.578916113,0.6089970,0.0446053));
+      if(myid == 0) GbSystem3D::writeGeoObject(refineCube1.get(), pathname+"/geo/refineCube1", WbWriterVtkXmlASCII::getInstance());
+
+      GbObject3DPtr refineCube2(new  GbCuboid3D(-0.16,-0.05, -0.141754, 0.2,0.05,0.0446053));
+      if(myid == 0) GbSystem3D::writeGeoObject(refineCube2.get(), pathname+"/geo/refineCube2", WbWriterVtkXmlASCII::getInstance());
+      //////////////////////////////////////////////////////////////////////////
+
+      Grid3DPtr grid(new Grid3D());
+
+      UbSchedulerPtr rSch(new UbScheduler(1000, 1000));
+      //RestartPostprocessorPtr rp(new RestartPostprocessor(grid, rSch, comm, pathname+"/checkpoints", RestartPostprocessor::BINARY));
+
+      std::string opt;
+
+      if(cstr!= NULL)
+         opt = std::string(cstr);
+
+      if/*(cstr== NULL)*/(cstr!= NULL)
+      {
+         opt = std::string(cstr);
+
+         if(myid==0) UBLOG(logINFO,"Restart step: " << opt);
+
+         //grid = rp->restart(UbSystem::stringTo<int>(opt));
+         //rp->reconnect();
+         grid->setTimeStep(UbSystem::stringTo<int>(opt));
+
+         if(myid ==0) UBLOG(logINFO,"TimeStep = " <<grid->getTimeStep());
+
+         //set connectors
+         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
+         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
+         grid->accept( setConnsVisitor );
+
+         //domain decomposition
+         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
+         grid->accept(pqPartVisitor);
+      }
+      else
+      {
+         if(myid ==0)
+         {
+            UBLOG(logINFO,"L = " <<lLB );
+            UBLOG(logINFO,"v = " <<vLB );
+            UBLOG(logINFO,"rho = " <<rhoLB );
+            UBLOG(logINFO,"nue = " << nueLB );
+            UBLOG(logINFO,"Re = " << Re );
+            UBLOG(logINFO,"Preprozess - start");
+         }
+
+
+         ////////////////////////////////////////////////////////////////////////
+         //Grid
+         //////////////////////////////////////////////////////////////////////////
+         grid->setDeltaX(dx);
+         grid->setBlockNX(nodePerBlockX1, nodePerBlockX2, nodePerBlockX2);
+
+         ////////////////////////////////////////////////////////////////////////////
+         //// Geometrie
+         ////////////////////////////////////////////////////////////////////////////
+         //GbTriFaceMesh3DPtr geo (GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(geoFile,"geo"));
+
+         //if(myid == 0) GbSystem3D::writeGeoObject(geo.get(), pathname+"/geo/geo", WbWriterVtkXmlASCII::getInstance());
+
+         ////////////////////////////////////////////////////////////////////////////
+         //// Randgeometrien erstellen
+         ////////////////////////////////////////////////////////////////////////////
+         double shiftForMG=grid->getDeltaX(refineLevel)*nodePerBlockX1 / 3.0*2.0;
+         GbCuboid3DPtr plate1  = GbCuboid3DPtr( new GbCuboid3D( -7.5, -1.515e-1, -6.831e-2, 7.5, 1.515e-1, 0.0 ));
+
+         GbCuboid3DPtr plate2  = GbCuboid3DPtr( new GbCuboid3D( -1.5e-1, -16.51e-1, -16.831e-2, 1.5e-1, -1.6e-2, 1.0 ));
+         GbCuboid3DPtr plate3  = GbCuboid3DPtr( new GbCuboid3D( -1.5e-1, 1.6e-2, -16.831e-2, 1.5e-1, 16.515e-1, 1.0 ));
+
+         GbCuboid3DPtr plate1_1  = GbCuboid3DPtr( new GbCuboid3D( -7.5, -2.515e-1, -1.0e-1, 7.5, 2.515e-1, -6.831e-2 ));
+         GbCuboid3DPtr plate1_2  = GbCuboid3DPtr( new GbCuboid3D( -7.5, -2.515e-1, -0.0000001, 7.5, 2.515e-1, 1.0e-1 ));
+         GbCuboid3DPtr plate1_3  = GbCuboid3DPtr( new GbCuboid3D( -7.5, 1.515e-1, -6.831e-2, 7.5, 2.515e-1, 0.0  ));
+         GbCuboid3DPtr plate1_4  = GbCuboid3DPtr( new GbCuboid3D( -7.5, -2.515e-1, 0.0, 7.5, -1.515e-1, -1.0e-1 ));
+
+         GbCuboid3DPtr inflow  = GbCuboid3DPtr( new GbCuboid3D( -8.0, -1.0, -1.0, -7.5, 1.0, 1.0 ));
+         GbCuboid3DPtr outflow = GbCuboid3DPtr( new GbCuboid3D( 7.5, -1.0, -1.0, 8.0, 1.0, 1.0 ));
+
+         if(myid == 0)
+         {
+            GbSystem3D::writeGeoObject(plate1.get(),pathname+"/geo/plate1", WbWriterVtkXmlASCII::getInstance());
+            GbSystem3D::writeGeoObject(plate2.get(),pathname+"/geo/plate2", WbWriterVtkXmlASCII::getInstance());
+            GbSystem3D::writeGeoObject(plate3.get(),pathname+"/geo/plate3", WbWriterVtkXmlASCII::getInstance());
+
+            GbSystem3D::writeGeoObject(plate1_1.get(),pathname+"/geo/plate1_1", WbWriterVtkXmlASCII::getInstance());
+            GbSystem3D::writeGeoObject(plate1_2.get(),pathname+"/geo/plate1_2", WbWriterVtkXmlASCII::getInstance());
+            GbSystem3D::writeGeoObject(plate1_3.get(),pathname+"/geo/plate1_3", WbWriterVtkXmlASCII::getInstance());
+            GbSystem3D::writeGeoObject(plate1_4.get(),pathname+"/geo/plate1_4", WbWriterVtkXmlASCII::getInstance());
+
+            GbSystem3D::writeGeoObject(inflow.get(),pathname+"/geo/inflow", WbWriterVtkXmlASCII::getInstance());
+            GbSystem3D::writeGeoObject(outflow.get(),pathname+"/geo/outflow", WbWriterVtkXmlASCII::getInstance());
+         }
+
+         GbObject3DPtr gridCube(new GbCuboid3D(plate1->getX1Minimum()-shiftForMG, plate1->getX2Minimum()-shiftForMG, plate1->getX3Minimum()-shiftForMG,
+                                                plate1->getX1Maximum()+shiftForMG, 
+                                                plate1->getX2Maximum()+shiftForMG, 
+                                                plate1->getX3Maximum()+shiftForMG));
+
+         GenBlocksGridVisitor genBlocks;
+         genBlocks.addGeoObject(gridCube);
+         grid->accept(genBlocks);
+
+         if (refineLevel > 0)
+         {
+            if(myid == 0) UBLOG(logINFO,"Refinement - start");	
+            RefineCrossAndInsideGbObjectBlockVisitor refVisitor1(refineCube1, baseLevel, refineLevel-3);
+            grid->accept(refVisitor1);
+
+            RefineCrossAndInsideGbObjectBlockVisitor refVisitor2(refineCube2, baseLevel, refineLevel-1);
+            grid->accept(refVisitor2);
+
+            RatioBlockVisitor ratioVisitor(refineLevel);
+            grid->accept(ratioVisitor);
+
+            RatioSmoothBlockVisitor ratioSmoothVisitor(refineLevel);
+            grid->accept(ratioSmoothVisitor);
+
+            OverlapBlockVisitor overlapVisitor(refineLevel);
+            grid->accept(overlapVisitor);
+
+            std::vector<int> dirs;
+            D3Q27System::getLBMDirections(dirs);
+            SetInterpolationDirsBlockVisitor interDirsVisitor(dirs);
+            grid->accept(interDirsVisitor);
+            if(myid == 0) UBLOG(logINFO,"Refinement - end");	
+         }
+
+         //////////////////////////////////////////////////////////////////////////
+         //INTERAKTOREN SETZEN (=Randbedingungen)
+         //////////////////////////////////////////////////////////////////////////
+         //oben/unten = Haftrand
+         int bbOption = 1; //0=simple Bounce Back, 1=quadr. BB
+         D3Q27BoundaryConditionAdapterPtr bcObst(new D3Q27NoSlipBCAdapter(bbOption));
+         //D3Q27TriFaceMeshInteractorPtr geoInt = D3Q27TriFaceMeshInteractorPtr( new D3Q27TriFaceMeshInteractor(geo, grid, D3Q27BoundaryConditionAdapterPtr(new D3Q27NoSlipBCAdapter(bbOption)),Interactor3D::SOLID));
+         //geoInt->setUseHalfSpaceCheck(true);
+         //geoInt->setRegardPointInObjectTest(true);
+
+         //D3Q27InteractorPtr plate1Int(new D3Q27Interactor(plate1, grid, bcObst,Interactor3D::INVERSESOLID));
+         D3Q27InteractorPtr plate2Int(new D3Q27Interactor(plate2, grid, bcObst,Interactor3D::SOLID));
+         D3Q27InteractorPtr plate3Int(new D3Q27Interactor(plate3, grid, bcObst,Interactor3D::SOLID));
+
+         D3Q27InteractorPtr plate1_1Int(new D3Q27Interactor(plate1_1, grid, bcObst,Interactor3D::SOLID));
+         D3Q27InteractorPtr plate1_2Int(new D3Q27Interactor(plate1_2, grid, bcObst,Interactor3D::SOLID));
+         D3Q27InteractorPtr plate1_3Int(new D3Q27Interactor(plate1_3, grid, bcObst,Interactor3D::SOLID));
+         D3Q27InteractorPtr plate1_4Int(new D3Q27Interactor(plate1_4, grid, bcObst,Interactor3D::SOLID));
+
+         //links: geschwindigkeits-einfluss
+         //Velocity-BC
+         //////////////////////////////////////////////////////////////////////////
+         mu::Parser fct;
+         fct.DefineConst("vx1"  , vLB*9.0/4.0 );
+         fct = Utilities::getDuctParaboloidX(plate1->getX2Centroid(), plate1->getX2Maximum() - plate1->getX2Minimum(), plate1->getX3Centroid(), plate1->getX3Minimum() - plate1->getX3Maximum(), vLB*9.0/4.0);
+         //fct.SetExpr("vx1");
+         //////////////////////////////////////////////////////////////////////////
+
+         //////////////////////////////////////////////////////////////////////////
+         D3Q27BoundaryConditionAdapterPtr velBCAdapter = D3Q27BoundaryConditionAdapterPtr(new D3Q27VelocityBCAdapter (true, false ,false ,fct, 0, D3Q27BCFunction::INFCONST));
+         velBCAdapter->setSecondaryBcOption(2);
+         D3Q27InteractorPtr inflowInt  = D3Q27InteractorPtr( new D3Q27Interactor(inflow, grid, velBCAdapter, Interactor3D::SOLID));
+
+         //rechts: druckrand
+         //Density-BC
+         //fuer Kompressibles Modell  rho = 1.0
+         D3Q27BoundaryConditionAdapterPtr denBCAdapter(new D3Q27DensityBCAdapter(rhoLB));
+         denBCAdapter->setSecondaryBcOption(1);
+         D3Q27InteractorPtr outflowInt = D3Q27InteractorPtr( new D3Q27Interactor(outflow, grid, denBCAdapter,Interactor3D::SOLID));
+
+         MetisPartitioningGridVisitor metisVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B);
+         grid->accept( metisVisitor );
+
+         SolidBlocksHelper sd(grid, comm);
+         //sd.addInteractor(geoInt);
+         sd.addInteractor(inflowInt);
+         sd.addInteractor(outflowInt);
+         sd.addInteractor(plate1_1Int);
+         sd.addInteractor(plate1_2Int);
+         sd.addInteractor(plate1_3Int);
+         sd.addInteractor(plate1_4Int);
+         sd.addInteractor(plate2Int);
+         sd.addInteractor(plate3Int);
+         sd.deleteSolidBlocks();     
+
+         grid->accept( metisVisitor );
+
+         BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname + "/grid/blocks", WbWriterVtkXmlBinary::getInstance(), comm));
+         ppblocks->update(0);
+         ppblocks.reset();
+
+         unsigned long nob = grid->getNumberOfBlocks();
+         int gl = 3;
+         unsigned long nod_temp = nob * (nodePerBlockX1+gl) * (nodePerBlockX2+gl) * (nodePerBlockX3+gl);
+         unsigned long nod = nob * (nodePerBlockX1) * (nodePerBlockX2) * (nodePerBlockX3);
+         double needMemAll  = double(nod_temp*(27*sizeof(double) + sizeof(int) + sizeof(float)*4));
+         double needMem  = needMemAll / double(comm->getNumberOfProcesses());
+
+         if(myid == 0)
+         {
+            UBLOG(logINFO,"Number of blocks = " << nob);
+            UBLOG(logINFO,"Number of nodes  = " << nod);
+            UBLOG(logINFO,"Necessary memory  = " << needMemAll  << " bytes");
+            UBLOG(logINFO,"Necessary memory per process = " << needMem  << " bytes");
+            UBLOG(logINFO,"Available memory per process = " << availMem << " bytes");
+         }  
+
+         //LBMKernel3DPtr kernel(new LBMKernelETD3Q27Cascaded(nodePerBlockX1, nodePerBlockX2, nodePerBlockX2));
+         LBMKernel3DPtr kernel(new LBMKernelETD3Q27CCLB(nodePerBlockX1, nodePerBlockX2, nodePerBlockX2));
+
+         BCProcessorPtr bcProc(new D3Q27ETBCProcessor());
+         kernel->setBCProcessor(bcProc);
+
+         SetKernelBlockVisitor kernelVisitor(kernel, nueLB, availMem, needMem);
+         grid->accept(kernelVisitor);
+
+         if (refineLevel > 0)
+         {
+            D3Q27SetUndefinedNodesBlockVisitor undefNodesVisitor;
+            grid->accept(undefNodesVisitor);
+         }
+
+         //canal
+         //grid->addAndInitInteractor(geoInt);
+         grid->addAndInitInteractor(plate1_1Int);
+         grid->addAndInitInteractor(plate1_2Int);
+         grid->addAndInitInteractor(plate1_3Int);
+         grid->addAndInitInteractor(plate1_4Int);
+         grid->addAndInitInteractor(plate2Int);
+         grid->addAndInitInteractor(plate3Int);
+
+         //inflow
+         grid->addAndInitInteractor(inflowInt);
+
+         //outflow
+         grid->addAndInitInteractor(outflowInt);
+
+         //////////////////////////////////////////////////////////////////////////
+         //connectoren setzen:
+         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
+         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
+         grid->accept( setConnsVisitor );
+         //////////////////////////////////////////////////////////////////////////
+         //domain decomposition
+         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
+         grid->accept(pqPartVisitor);
+         //////////////////////////////////////////////////////////////////////////
+         //Stroemungsfeld initialisieren
+         //////////////////////////////////////////////////////////////////////////
+         D3Q27ETInitDistributionsBlockVisitor initVisitor(rhoLB); //1.0
+         //initVisitor.setVx1(0.0); 
+         grid->accept(initVisitor);
+
+         //if(myid == 0)
+         //{
+         //   //Abst�nde "q" als Linien rausschreiben
+         //   std::vector< UbTupleFloat3 > nodes;
+         //   std::vector< UbTupleInt2 >   lines;
+         //   geoInt->addQsLineSet(nodes, lines);
+         //   WbWriterVtkXmlBinary::getInstance()->writeLines(pathname+"/grid/qs",nodes,lines);
+         //}
+
+         if(myid == 0) UBLOG(logINFO,"Preprozess - end");
+
+      }
+      //////////////////////////////////////////////////////////////////////////
+      //Set Postprozessors
+      //////////////////////////////////////////////////////////////////////////
+      {
+         UbSchedulerPtr geoSch(new UbScheduler(1));
+         D3Q27MacroscopicQuantitiesPostprocessor ppgeo(grid,geoSch, pathname + "/grid/nodes", WbWriterVtkXmlBinary::getInstance(), conv,  comm, true);
+         grid->doPostProcess(0);
+      }
+
+      UbSchedulerPtr nupsSch(new UbScheduler(1, 5, 10));
+      NUPSCounterPostprocessor npr(grid, nupsSch, pathname + "/results/nups.txt", comm);
+
+      double outTime = 2000;
+      UbSchedulerPtr stepSch(new UbScheduler(outTime));
+      D3Q27MacroscopicQuantitiesPostprocessor pp(grid,stepSch, pathname + "/steps/step", WbWriterVtkXmlBinary::getInstance(), conv,  comm);
+      //////////////////////////////////////////////////////////////////////////
+      //PathLine
+      //UbSchedulerPtr plSch(new UbScheduler(10, 1500));
+      //D3Q27PathLinePostprocessor pathLine(grid, pathname + "/pathLine", WbWriterVtkXmlASCII::getInstance(), conv, plSch, comm, -0.3285474538, 0.09692341,-0.0376166666, nueLB, iProcessor);
+      //////////////////////////////////////////////////////////////////////////
+      //Simulation
+      //////////////////////////////////////////////////////////////////////////
+      double endTime = 1000000;
+      UbSchedulerPtr visSch(stepSch);
+      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, visSch));
+      if(myid == 0) UBLOG(logINFO,"Simulation-start");
+      calculation->calculate();
+      if(myid == 0) UBLOG(logINFO,"Simulation-end");
+
+   }
+   catch(std::exception& e)
+   {
+      cerr << e.what() << endl;
+   }
+   catch(std::string& s)
+   {
+      cerr << s << endl;
+   }
+   catch(...)
+   {
+      cerr << "unknown exception" << endl;
+   }
+
+}
diff --git a/apps/cpu/micropart/micropartTestQs.hpp b/apps/cpu/micropart/micropartTestQs.hpp
index 895e1759239be41dbe1b0b5e433aaee98c6eb200..0ee098948cfee79111ced71a403aac28c0cc3f5b 100644
--- a/apps/cpu/micropart/micropartTestQs.hpp
+++ b/apps/cpu/micropart/micropartTestQs.hpp
@@ -1,380 +1,380 @@
-#include <iostream>
-#include <string>
-#include <map>
-#include <vfluids.h>
-
-
-using namespace std;
-
-void micropartTestQs(const char *cstr)
-{
-   try
-   {
-      CommunicatorPtr comm(new MPICommunicator());
-      int myid = comm->getProcessID();
-      int numprocs = comm->getNumberOfProcesses();
-
-      string machine = QUOTEME(CAB_MACHINE);
-      string pathname; 
-      double availMem = 0;
-      string geoFile;
-      int numOfThreads = 3;
-
-      if(machine == "BOMBADIL") 
-      {
-         pathname = "c:/temp/micropart";
-         availMem = 3.0e9;
-         //geoFile = "c:/Data/micropart/DK19_7_02_Martin.stl";
-         geoFile = "d:/Data/micropart/E0019B_mit_Radien.stl";
-         //geoFile = "c:/Data/micropart/boxN.stl";
-         //geoFile = "c:/Data/bananas/Banana_boxD.stl";
-      }
-      else if(machine == "M01" || machine == "M02")      
-      {
-         pathname = "/work/koskuche/scratch/micropart3";
-         //pathname = "/work/koskuche/scratch/micropart2";
-         availMem = 12.0e9;
-         geoFile = "/home/koskuche/data/micropart/E0019B_mit_Radien_Inv_new_Box.stl";
-
-         numOfThreads = 8;
-         if(myid ==0)
-         {
-            stringstream logFilename;
-            logFilename <<  pathname + "/logfile"+UbSystem::toString(UbSystem::getTimeStamp())+".txt";
-            UbLog::output_policy::setStream(logFilename.str());
-         }
-      }
-      else throw UbException(UB_EXARGS, "unknown CAB_MACHINE");
-
-      UbLog::reportingLevel() = logINFO;
-      //UbLog::reportingLevel() = logDEBUG1;
-
-      int nodePerBlockX1 = 8; //Anzahl an Knoten pro Block
-      int nodePerBlockX2 = 8;//(int)16;
-      int nodePerBlockX3 = 8;//(int)16;
-
-      double bH = nodePerBlockX1;    //gewuenschte Rand- und Blockbreite
-
-      //Simulation Parameters
-
-      //length [m]
-      double lSI = 0.067;
-      //length [LB]
-      double lLB = 30;
-
-      double dx = 5;//0.0134;//lSI/lLB;
-
-      double left_offset = 0.5;
-      double right_offset  = 0.5;//2*0.5
-      double front_offset = 0.15;
-      double back_offset  = 0.15;
-      double top_offset = 0.0;
-      double bottom_offset  = 0.07;
-
-      LBMReal vLB = 0.016103;
-      LBMReal Re;
-      LBMReal rhoLB = 0.0;
-      LBMReal nueLB = 0.0000249;//(vLB*lLB)/Re;
-      Re = (vLB*(0.303/dx))/nueLB;
-      const int baseLevel = 0;
-      const int refineLevel = 2;
-      LBMUnitConverterPtr conv = LBMUnitConverterPtr(new LBMUnitConverter());
-
-      double ft=1000.0;
-      //////////////////////////////////////////////////////////////////////////
-      GbObject3DPtr refineCube1(new  GbCuboid3D(-0.2222890*ft,-0.52993*ft, -0.141754*ft, /*0.578916113*ft*/275.0,0.6089970*ft,0.0446053*ft));
-      if(myid == 0) GbSystem3D::writeGeoObject(refineCube1.get(), pathname+"/geo/refineCube1", WbWriterVtkXmlASCII::getInstance());
-
-      GbObject3DPtr refineCube2(new  GbCuboid3D(-0.16*ft-10.0,-0.05*ft, -0.141754*ft, 0.2*ft+10.0,0.05*ft,0.0446053*ft));
-      if(myid == 0) GbSystem3D::writeGeoObject(refineCube2.get(), pathname+"/geo/refineCube2", WbWriterVtkXmlASCII::getInstance());
-      //////////////////////////////////////////////////////////////////////////
-
-      Grid3DPtr grid(new Grid3D());
-
-      UbSchedulerPtr rSch(new UbScheduler(1000, 1000));
-      RestartPostprocessorPtr rp(new RestartPostprocessor(grid, rSch, comm, pathname+"/checkpoints", RestartPostprocessor::BINARY));
-
-      std::string opt;
-
-      if(cstr!= NULL)
-         opt = std::string(cstr);
-
-      if/*(cstr== NULL)*/(cstr!= NULL)
-      {
-         opt = std::string(cstr);
-
-         if(myid==0) UBLOG(logINFO,"Restart step: " << opt);
-
-         grid = rp->restart(UbSystem::stringTo<int>(opt));
-         rp->reconnect(grid);
-         grid->setTimeStep(UbSystem::stringTo<int>(opt));
-
-         if(myid ==0) UBLOG(logINFO,"TimeStep = " <<grid->getTimeStep());
-
-         //set connectors
-         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27OffsetInterpolationProcessor());
-         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
-         grid->accept( setConnsVisitor );
-
-         //domain decomposition
-         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
-         grid->accept(pqPartVisitor);
-      }
-      else
-      {
-         if(myid ==0)
-         {
-            UBLOG(logINFO,"L = " <<lLB );
-            UBLOG(logINFO,"v = " <<vLB );
-            UBLOG(logINFO,"rho = " <<rhoLB );
-            UBLOG(logINFO,"nue = " << nueLB );
-            UBLOG(logINFO,"Re = " << Re );
-            UBLOG(logINFO,"Preprozess - start");
-         }
-
-
-         ////////////////////////////////////////////////////////////////////////
-         //Grid
-         //////////////////////////////////////////////////////////////////////////
-         grid->setDeltaX(dx);
-         grid->setBlockNX(nodePerBlockX1, nodePerBlockX2, nodePerBlockX2);
-
-         ////////////////////////////////////////////////////////////////////////////
-         //// Geometrie
-         ////////////////////////////////////////////////////////////////////////////
-         UBLOG(logINFO,"Read geometry: start");
-         GbTriFaceMesh3DPtr geo (GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(geoFile,"geo"));
-         UBLOG(logINFO,"Read geometry: end");
-         if(myid == 0) GbSystem3D::writeGeoObject(geo.get(), pathname+"/geo/geo", WbWriterVtkXmlASCII::getInstance());
-
-
-         ////////////////////////////////////////////////////////////////////////////
-         //// Randgeometrien erstellen
-         ////////////////////////////////////////////////////////////////////////////
-         double shiftForMG=grid->getDeltaX(refineLevel)*nodePerBlockX1 / 3.0*2.0;
-
-         GbCuboid3DPtr inflow  = GbCuboid3DPtr( new GbCuboid3D(geo->getX1Minimum()+9100.0,  geo->getX2Minimum()-200.0, geo->getX3Minimum()-200.0,
-                                                               geo->getX1Minimum()+10000.0, geo->getX2Maximum()+200.0, geo->getX3Maximum()+200.0));
-         GbCuboid3DPtr outflow  = GbCuboid3DPtr( new GbCuboid3D(geo->getX1Maximum()-10000.0,  geo->getX2Minimum()-200.0, geo->getX3Minimum()-200.0,
-                                                                geo->getX1Maximum()-9100.0, geo->getX2Maximum()+200.0, geo->getX3Maximum()+200.0));
-
-         if(myid == 0)
-         {
-            GbSystem3D::writeGeoObject(inflow.get(),pathname+"/geo/inflow", WbWriterVtkXmlASCII::getInstance());
-            GbSystem3D::writeGeoObject(outflow.get(),pathname+"/geo/outflow", WbWriterVtkXmlASCII::getInstance());
-         }
-
-         //GbObject3DPtr gridCube(new GbCuboid3D(geo->getX1Minimum()-(double)nodePerBlockX1*dx, geo->getX2Minimum()-(double)nodePerBlockX1*dx, geo->getX3Minimum()-(double)nodePerBlockX1*dx,
-         //   geo->getX1Maximum()+(double)nodePerBlockX1*dx, 
-         //   geo->getX2Maximum()+(double)nodePerBlockX1*dx, 
-         //   geo->getX3Maximum()+(double)nodePerBlockX1*dx));
-
-
-         shiftForMG=0.0;
-         GbObject3DPtr gridCube(new GbCuboid3D(geo->getX1Minimum()+10000.0, geo->getX2Minimum()-shiftForMG, -0.141754*ft/2.0/*geo->getX3Minimum()-shiftForMG*/,
-            geo->getX1Maximum()-10000.0, 
-            geo->getX2Maximum()+shiftForMG, 
-            geo->getX3Maximum()+shiftForMG));
-
-         if(myid == 0) GbSystem3D::writeGeoObject(gridCube.get(),pathname+"/geo/gridCube", WbWriterVtkXmlASCII::getInstance());
-
-         GenBlocksGridVisitor genBlocks;
-         genBlocks.addGeoObject(gridCube);
-         grid->accept(genBlocks);
-
-         if (refineLevel > 0)
-         {
-            if(myid == 0) UBLOG(logINFO,"Refinement - start");	
-            //RefineCrossAndInsideGbObjectBlockVisitor refVisitor1(refineCube1, baseLevel, refineLevel-3);
-            //grid->accept(refVisitor1);
-
-            RefineCrossAndInsideGbObjectBlockVisitor refVisitor2(refineCube1, refineLevel);
-            grid->accept(refVisitor2);
-
-            RatioBlockVisitor ratioVisitor(refineLevel);
-            grid->accept(ratioVisitor);
-
-            RatioSmoothBlockVisitor ratioSmoothVisitor(refineLevel);
-            grid->accept(ratioSmoothVisitor);
-
-            OverlapBlockVisitor overlapVisitor(refineLevel);
-            grid->accept(overlapVisitor);
-
-            std::vector<int> dirs;
-            D3Q27System::getLBMDirections(dirs);
-            SetInterpolationDirsBlockVisitor interDirsVisitor(dirs);
-            grid->accept(interDirsVisitor);
-            if(myid == 0) UBLOG(logINFO,"Refinement - end");	
-         }
-
-         //////////////////////////////////////////////////////////////////////////
-         //INTERAKTOREN SETZEN (=Randbedingungen)
-         //////////////////////////////////////////////////////////////////////////
-         //oben/unten = Haftrand
-         int bbOption = 2; //0=simple Bounce Back, 1=quadr. BB, 2=quadr. BB 2nd choice 
-         D3Q27BoundaryConditionAdapterPtr bcObst(new D3Q27NoSlipBCAdapter(bbOption));
-         D3Q27TriFaceMeshInteractorPtr geoInt = D3Q27TriFaceMeshInteractorPtr( new D3Q27TriFaceMeshInteractor(geo, grid, D3Q27BoundaryConditionAdapterPtr(new D3Q27NoSlipBCAdapter(bbOption)),Interactor3D::INVERSESOLID));
-         geoInt->setUseHalfSpaceCheck(true);
-         geoInt->setRegardPointInObjectTest(true);
-
-         //links: geschwindigkeits-einfluss
-         //Velocity-BC
-         //////////////////////////////////////////////////////////////////////////
-         mu::Parser fct;
-         fct.DefineConst("vx1"  , vLB           );
-         //fct = MathUtil::getDuctParaboloidX(plate1->getX2Centroid(), plate1->getX2Maximum() - plate1->getX2Minimum(), plate1->getX3Centroid(), plate1->getX3Minimum() - plate1->getX3Maximum(), vLB*9.0/4.0);
-         fct.SetExpr("vx1");
-         //////////////////////////////////////////////////////////////////////////
-         //////////////////////////////////////////////////////////////////////////
-         D3Q27BoundaryConditionAdapterPtr velBCAdapter = D3Q27BoundaryConditionAdapterPtr(new D3Q27VelocityBCAdapter (true, false ,false ,fct, 0, D3Q27BCFunction::INFCONST));
-         velBCAdapter->setSecondaryBcOption(2);
-         D3Q27InteractorPtr inflowInt  = D3Q27InteractorPtr( new D3Q27Interactor(inflow, grid, velBCAdapter, Interactor3D::SOLID));
-         //D3Q27InteractorPtr inflowInt  = D3Q27InteractorPtr( new D3Q27Interactor(inflow, grid, bcObst, Interactor3D::SOLID));
-
-         //rechts: druckrand
-         //Density-BC
-         //fuer Kompressibles Modell  rho = 1.0
-         D3Q27InteractorPtr outflowInt = D3Q27InteractorPtr( new D3Q27Interactor(outflow, grid, D3Q27BoundaryConditionAdapterPtr(new D3Q27DensityBCAdapter(rhoLB)),Interactor3D::SOLID));
-         //D3Q27InteractorPtr outflowInt = D3Q27InteractorPtr( new D3Q27Interactor(outflow, grid, bcObst,Interactor3D::SOLID));
-
-         MetisPartitioningGridVisitor metisVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B);
-         grid->accept( metisVisitor );
-
-         SolidBlocksHelper sd(grid, comm);
-         sd.addInteractor(geoInt);
-         sd.addInteractor(inflowInt);
-         sd.addInteractor(outflowInt);
-         sd.deleteSolidBlocks();     
-
-         grid->accept( metisVisitor );
-
-         BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname + "/grid/blocks", WbWriterVtkXmlBinary::getInstance(), comm));
-         ppblocks->update(0);
-         ppblocks.reset();
-
-         UBLOG(logINFO,grid->getBlock(10,12,0,1)->toString());
-         vector<Block3DPtr> blocks;
-         //grid->getNeighborBlocksForDirection(D3Q27System::W,10,12,0,1,3,blocks);
-         grid->getNeighborBlocksForDirection(D3Q27System::E,4,6,0,0,2,blocks);
-         BOOST_FOREACH(Block3DPtr b, blocks)
-            UBLOG(logINFO, b->toString());
-
-
-
-         unsigned long nob = grid->getNumberOfBlocks();
-         int gl = 3;
-         unsigned long nod_temp = nob * (nodePerBlockX1+gl) * (nodePerBlockX2+gl) * (nodePerBlockX3+gl);
-         unsigned long nod = nob * (nodePerBlockX1) * (nodePerBlockX2) * (nodePerBlockX3);
-         double needMemAll  = double(nod_temp*(27*sizeof(double) + sizeof(int) + sizeof(float)*4));
-         double needMem  = needMemAll / double(comm->getNumberOfProcesses());
-
-         if(myid == 0)
-         {
-            UBLOG(logINFO,"Number of blocks = " << nob);
-            UBLOG(logINFO,"Number of nodes  = " << nod);
-            UBLOG(logINFO,"Necessary memory  = " << needMemAll  << " bytes");
-            UBLOG(logINFO,"Necessary memory per process = " << needMem  << " bytes");
-            UBLOG(logINFO,"Available memory per process = " << availMem << " bytes");
-         }  
-
-
-         //LBMKernel3DPtr kernel(new LBMKernelETD3Q27Cascaded(nodePerBlockX1, nodePerBlockX2, nodePerBlockX2));
-         //LBMKernel3DPtr kernel(new LBMKernelETD3Q27BGK(nodePerBlockX1, nodePerBlockX2, nodePerBlockX2, true));
-         LBMKernel3DPtr kernel(new LBMKernelETD3Q27CCLB(nodePerBlockX1, nodePerBlockX2, nodePerBlockX2,0));
-
-         BCProcessorPtr bcProc(new D3Q27ETBCProcessor());
-         kernel->setBCProcessor(bcProc);
-
-         SetKernelBlockVisitor kernelVisitor(kernel, nueLB, availMem, needMem);
-         grid->accept(kernelVisitor);
-
-         if (refineLevel > 0)
-         {
-            D3Q27SetUndefinedNodesBlockVisitor undefNodesVisitor;
-            grid->accept(undefNodesVisitor);
-         }
-
-         //canal
-         grid->addAndInitInteractor(geoInt);
-
-         //inflow
-         grid->addAndInitInteractor(inflowInt);
-
-         //outflow
-         grid->addAndInitInteractor(outflowInt);
-
-         //////////////////////////////////////////////////////////////////////////
-         //connectoren setzen:
-         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
-         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
-         grid->accept( setConnsVisitor );
-         //////////////////////////////////////////////////////////////////////////
-         //domain decomposition
-         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
-         grid->accept(pqPartVisitor);
-         //////////////////////////////////////////////////////////////////////////
-         //Stroemungsfeld initialisieren
-         //////////////////////////////////////////////////////////////////////////
-         D3Q27ETInitDistributionsBlockVisitor initVisitor(rhoLB); //1.0
-         //initVisitor.setVx1(0.0); 
-         grid->accept(initVisitor);
-
-         if(myid == 0)
-         {
-            //Abstände "q" als Linien rausschreiben
-            std::vector< UbTupleFloat3 > nodes;
-            std::vector< UbTupleInt2 >   lines;
-            geoInt->addQsLineSet(nodes, lines);
-            WbWriterVtkXmlBinary::getInstance()->writeLines(pathname+"/grid/qs",nodes,lines);
-         }
-
-         if(myid == 0) UBLOG(logINFO,"Preprozess - end");
-
-      }
-      //////////////////////////////////////////////////////////////////////////
-      //Set Postprozessors
-      //////////////////////////////////////////////////////////////////////////
-      {
-         UbSchedulerPtr geoSch(new UbScheduler(1));
-         D3Q27MacroscopicQuantitiesPostprocessor ppgeo(grid,geoSch, pathname + "/grid/nodes", WbWriterVtkXmlBinary::getInstance(), conv,  comm, true);
-         grid->doPostProcess(0);
-      }
-
-
-      UbSchedulerPtr nupsSch(new UbScheduler(1, 5, 10));
-      NUPSCounterPostprocessor npr(grid, nupsSch, pathname + "/results/nups.txt", comm);
-
-      double outTime = 100;
-      UbSchedulerPtr visSch(new UbScheduler(outTime));
-      //visSch->addSchedule(20, 1010, 1100);
-      D3Q27MacroscopicQuantitiesPostprocessor pp(grid,visSch, pathname + "/steps/step", WbWriterVtkXmlBinary::getInstance(), conv,  comm);
-      //////////////////////////////////////////////////////////////////////////
-      //PathLine
-      //UbSchedulerPtr plSch(new UbScheduler(10, 1500));
-      //D3Q27PathLinePostprocessor pathLine(grid, pathname + "/pathLine", WbWriterVtkXmlASCII::getInstance(), conv, plSch, comm, -0.3285474538, 0.09692341,-0.0376166666, nueLB, iProcessor);
-      //////////////////////////////////////////////////////////////////////////
-      //Simulation
-      //////////////////////////////////////////////////////////////////////////
-      double endTime = 1000;
-      UbSchedulerPtr visSch1(new UbScheduler(1));
-      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, visSch));
-      if(myid == 0) UBLOG(logINFO,"Simulation-start");
-      calculation->calculate();
-      if(myid == 0) UBLOG(logINFO,"Simulation-end");
-
-   }
-   catch(std::exception& e)
-   {
-      cerr << e.what() << endl;
-   }
-   catch(std::string& s)
-   {
-      cerr << s << endl;
-   }
-   catch(...)
-   {
-      cerr << "unknown exception" << endl;
-   }
-
-}
-
+#include <iostream>
+#include <string>
+#include <map>
+#include <vfluids.h>
+
+
+using namespace std;
+
+void micropartTestQs(const char *cstr)
+{
+   try
+   {
+      CommunicatorPtr comm(new MPICommunicator());
+      int myid = comm->getProcessID();
+      int numprocs = comm->getNumberOfProcesses();
+
+      string machine = QUOTEME(CAB_MACHINE);
+      string pathname; 
+      double availMem = 0;
+      string geoFile;
+      int numOfThreads = 3;
+
+      if(machine == "BOMBADIL") 
+      {
+         pathname = "c:/temp/micropart";
+         availMem = 3.0e9;
+         //geoFile = "c:/Data/micropart/DK19_7_02_Martin.stl";
+         geoFile = "d:/Data/micropart/E0019B_mit_Radien.stl";
+         //geoFile = "c:/Data/micropart/boxN.stl";
+         //geoFile = "c:/Data/bananas/Banana_boxD.stl";
+      }
+      else if(machine == "M01" || machine == "M02")      
+      {
+         pathname = "/work/koskuche/scratch/micropart3";
+         //pathname = "/work/koskuche/scratch/micropart2";
+         availMem = 12.0e9;
+         geoFile = "/home/koskuche/data/micropart/E0019B_mit_Radien_Inv_new_Box.stl";
+
+         numOfThreads = 8;
+         if(myid ==0)
+         {
+            stringstream logFilename;
+            logFilename <<  pathname + "/logfile"+UbSystem::toString(UbSystem::getTimeStamp())+".txt";
+            UbLog::output_policy::setStream(logFilename.str());
+         }
+      }
+      else throw UbException(UB_EXARGS, "unknown CAB_MACHINE");
+
+      UbLog::reportingLevel() = logINFO;
+      //UbLog::reportingLevel() = logDEBUG1;
+
+      int nodePerBlockX1 = 8; //Anzahl an Knoten pro Block
+      int nodePerBlockX2 = 8;//(int)16;
+      int nodePerBlockX3 = 8;//(int)16;
+
+      double bH = nodePerBlockX1;    //gewuenschte Rand- und Blockbreite
+
+      //Simulation Parameters
+
+      //length [m]
+      double lSI = 0.067;
+      //length [LB]
+      double lLB = 30;
+
+      double dx = 5;//0.0134;//lSI/lLB;
+
+      double left_offset = 0.5;
+      double right_offset  = 0.5;//2*0.5
+      double front_offset = 0.15;
+      double back_offset  = 0.15;
+      double top_offset = 0.0;
+      double bottom_offset  = 0.07;
+
+      LBMReal vLB = 0.016103;
+      LBMReal Re;
+      LBMReal rhoLB = 0.0;
+      LBMReal nueLB = 0.0000249;//(vLB*lLB)/Re;
+      Re = (vLB*(0.303/dx))/nueLB;
+      const int baseLevel = 0;
+      const int refineLevel = 2;
+      LBMUnitConverterPtr conv = LBMUnitConverterPtr(new LBMUnitConverter());
+
+      double ft=1000.0;
+      //////////////////////////////////////////////////////////////////////////
+      GbObject3DPtr refineCube1(new  GbCuboid3D(-0.2222890*ft,-0.52993*ft, -0.141754*ft, /*0.578916113*ft*/275.0,0.6089970*ft,0.0446053*ft));
+      if(myid == 0) GbSystem3D::writeGeoObject(refineCube1.get(), pathname+"/geo/refineCube1", WbWriterVtkXmlASCII::getInstance());
+
+      GbObject3DPtr refineCube2(new  GbCuboid3D(-0.16*ft-10.0,-0.05*ft, -0.141754*ft, 0.2*ft+10.0,0.05*ft,0.0446053*ft));
+      if(myid == 0) GbSystem3D::writeGeoObject(refineCube2.get(), pathname+"/geo/refineCube2", WbWriterVtkXmlASCII::getInstance());
+      //////////////////////////////////////////////////////////////////////////
+
+      Grid3DPtr grid(new Grid3D());
+
+      UbSchedulerPtr rSch(new UbScheduler(1000, 1000));
+      RestartPostprocessorPtr rp(new RestartPostprocessor(grid, rSch, comm, pathname+"/checkpoints", RestartPostprocessor::BINARY));
+
+      std::string opt;
+
+      if(cstr!= NULL)
+         opt = std::string(cstr);
+
+      if/*(cstr== NULL)*/(cstr!= NULL)
+      {
+         opt = std::string(cstr);
+
+         if(myid==0) UBLOG(logINFO,"Restart step: " << opt);
+
+         grid = rp->restart(UbSystem::stringTo<int>(opt));
+         rp->reconnect(grid);
+         grid->setTimeStep(UbSystem::stringTo<int>(opt));
+
+         if(myid ==0) UBLOG(logINFO,"TimeStep = " <<grid->getTimeStep());
+
+         //set connectors
+         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27OffsetInterpolationProcessor());
+         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
+         grid->accept( setConnsVisitor );
+
+         //domain decomposition
+         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
+         grid->accept(pqPartVisitor);
+      }
+      else
+      {
+         if(myid ==0)
+         {
+            UBLOG(logINFO,"L = " <<lLB );
+            UBLOG(logINFO,"v = " <<vLB );
+            UBLOG(logINFO,"rho = " <<rhoLB );
+            UBLOG(logINFO,"nue = " << nueLB );
+            UBLOG(logINFO,"Re = " << Re );
+            UBLOG(logINFO,"Preprozess - start");
+         }
+
+
+         ////////////////////////////////////////////////////////////////////////
+         //Grid
+         //////////////////////////////////////////////////////////////////////////
+         grid->setDeltaX(dx);
+         grid->setBlockNX(nodePerBlockX1, nodePerBlockX2, nodePerBlockX2);
+
+         ////////////////////////////////////////////////////////////////////////////
+         //// Geometrie
+         ////////////////////////////////////////////////////////////////////////////
+         UBLOG(logINFO,"Read geometry: start");
+         GbTriFaceMesh3DPtr geo (GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(geoFile,"geo"));
+         UBLOG(logINFO,"Read geometry: end");
+         if(myid == 0) GbSystem3D::writeGeoObject(geo.get(), pathname+"/geo/geo", WbWriterVtkXmlASCII::getInstance());
+
+
+         ////////////////////////////////////////////////////////////////////////////
+         //// Randgeometrien erstellen
+         ////////////////////////////////////////////////////////////////////////////
+         double shiftForMG=grid->getDeltaX(refineLevel)*nodePerBlockX1 / 3.0*2.0;
+
+         GbCuboid3DPtr inflow  = GbCuboid3DPtr( new GbCuboid3D(geo->getX1Minimum()+9100.0,  geo->getX2Minimum()-200.0, geo->getX3Minimum()-200.0,
+                                                               geo->getX1Minimum()+10000.0, geo->getX2Maximum()+200.0, geo->getX3Maximum()+200.0));
+         GbCuboid3DPtr outflow  = GbCuboid3DPtr( new GbCuboid3D(geo->getX1Maximum()-10000.0,  geo->getX2Minimum()-200.0, geo->getX3Minimum()-200.0,
+                                                                geo->getX1Maximum()-9100.0, geo->getX2Maximum()+200.0, geo->getX3Maximum()+200.0));
+
+         if(myid == 0)
+         {
+            GbSystem3D::writeGeoObject(inflow.get(),pathname+"/geo/inflow", WbWriterVtkXmlASCII::getInstance());
+            GbSystem3D::writeGeoObject(outflow.get(),pathname+"/geo/outflow", WbWriterVtkXmlASCII::getInstance());
+         }
+
+         //GbObject3DPtr gridCube(new GbCuboid3D(geo->getX1Minimum()-(double)nodePerBlockX1*dx, geo->getX2Minimum()-(double)nodePerBlockX1*dx, geo->getX3Minimum()-(double)nodePerBlockX1*dx,
+         //   geo->getX1Maximum()+(double)nodePerBlockX1*dx, 
+         //   geo->getX2Maximum()+(double)nodePerBlockX1*dx, 
+         //   geo->getX3Maximum()+(double)nodePerBlockX1*dx));
+
+
+         shiftForMG=0.0;
+         GbObject3DPtr gridCube(new GbCuboid3D(geo->getX1Minimum()+10000.0, geo->getX2Minimum()-shiftForMG, -0.141754*ft/2.0/*geo->getX3Minimum()-shiftForMG*/,
+            geo->getX1Maximum()-10000.0, 
+            geo->getX2Maximum()+shiftForMG, 
+            geo->getX3Maximum()+shiftForMG));
+
+         if(myid == 0) GbSystem3D::writeGeoObject(gridCube.get(),pathname+"/geo/gridCube", WbWriterVtkXmlASCII::getInstance());
+
+         GenBlocksGridVisitor genBlocks;
+         genBlocks.addGeoObject(gridCube);
+         grid->accept(genBlocks);
+
+         if (refineLevel > 0)
+         {
+            if(myid == 0) UBLOG(logINFO,"Refinement - start");	
+            //RefineCrossAndInsideGbObjectBlockVisitor refVisitor1(refineCube1, baseLevel, refineLevel-3);
+            //grid->accept(refVisitor1);
+
+            RefineCrossAndInsideGbObjectBlockVisitor refVisitor2(refineCube1, refineLevel);
+            grid->accept(refVisitor2);
+
+            RatioBlockVisitor ratioVisitor(refineLevel);
+            grid->accept(ratioVisitor);
+
+            RatioSmoothBlockVisitor ratioSmoothVisitor(refineLevel);
+            grid->accept(ratioSmoothVisitor);
+
+            OverlapBlockVisitor overlapVisitor(refineLevel);
+            grid->accept(overlapVisitor);
+
+            std::vector<int> dirs;
+            D3Q27System::getLBMDirections(dirs);
+            SetInterpolationDirsBlockVisitor interDirsVisitor(dirs);
+            grid->accept(interDirsVisitor);
+            if(myid == 0) UBLOG(logINFO,"Refinement - end");	
+         }
+
+         //////////////////////////////////////////////////////////////////////////
+         //INTERAKTOREN SETZEN (=Randbedingungen)
+         //////////////////////////////////////////////////////////////////////////
+         //oben/unten = Haftrand
+         int bbOption = 2; //0=simple Bounce Back, 1=quadr. BB, 2=quadr. BB 2nd choice 
+         D3Q27BoundaryConditionAdapterPtr bcObst(new D3Q27NoSlipBCAdapter(bbOption));
+         D3Q27TriFaceMeshInteractorPtr geoInt = D3Q27TriFaceMeshInteractorPtr( new D3Q27TriFaceMeshInteractor(geo, grid, D3Q27BoundaryConditionAdapterPtr(new D3Q27NoSlipBCAdapter(bbOption)),Interactor3D::INVERSESOLID));
+         geoInt->setUseHalfSpaceCheck(true);
+         geoInt->setRegardPointInObjectTest(true);
+
+         //links: geschwindigkeits-einfluss
+         //Velocity-BC
+         //////////////////////////////////////////////////////////////////////////
+         mu::Parser fct;
+         fct.DefineConst("vx1"  , vLB           );
+         //fct = MathUtil::getDuctParaboloidX(plate1->getX2Centroid(), plate1->getX2Maximum() - plate1->getX2Minimum(), plate1->getX3Centroid(), plate1->getX3Minimum() - plate1->getX3Maximum(), vLB*9.0/4.0);
+         fct.SetExpr("vx1");
+         //////////////////////////////////////////////////////////////////////////
+         //////////////////////////////////////////////////////////////////////////
+         D3Q27BoundaryConditionAdapterPtr velBCAdapter = D3Q27BoundaryConditionAdapterPtr(new D3Q27VelocityBCAdapter (true, false ,false ,fct, 0, D3Q27BCFunction::INFCONST));
+         velBCAdapter->setSecondaryBcOption(2);
+         D3Q27InteractorPtr inflowInt  = D3Q27InteractorPtr( new D3Q27Interactor(inflow, grid, velBCAdapter, Interactor3D::SOLID));
+         //D3Q27InteractorPtr inflowInt  = D3Q27InteractorPtr( new D3Q27Interactor(inflow, grid, bcObst, Interactor3D::SOLID));
+
+         //rechts: druckrand
+         //Density-BC
+         //fuer Kompressibles Modell  rho = 1.0
+         D3Q27InteractorPtr outflowInt = D3Q27InteractorPtr( new D3Q27Interactor(outflow, grid, D3Q27BoundaryConditionAdapterPtr(new D3Q27DensityBCAdapter(rhoLB)),Interactor3D::SOLID));
+         //D3Q27InteractorPtr outflowInt = D3Q27InteractorPtr( new D3Q27Interactor(outflow, grid, bcObst,Interactor3D::SOLID));
+
+         MetisPartitioningGridVisitor metisVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B);
+         grid->accept( metisVisitor );
+
+         SolidBlocksHelper sd(grid, comm);
+         sd.addInteractor(geoInt);
+         sd.addInteractor(inflowInt);
+         sd.addInteractor(outflowInt);
+         sd.deleteSolidBlocks();     
+
+         grid->accept( metisVisitor );
+
+         BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname + "/grid/blocks", WbWriterVtkXmlBinary::getInstance(), comm));
+         ppblocks->update(0);
+         ppblocks.reset();
+
+         UBLOG(logINFO,grid->getBlock(10,12,0,1)->toString());
+         vector<Block3DPtr> blocks;
+         //grid->getNeighborBlocksForDirection(D3Q27System::W,10,12,0,1,3,blocks);
+         grid->getNeighborBlocksForDirection(D3Q27System::E,4,6,0,0,2,blocks);
+         BOOST_FOREACH(Block3DPtr b, blocks)
+            UBLOG(logINFO, b->toString());
+
+
+
+         unsigned long nob = grid->getNumberOfBlocks();
+         int gl = 3;
+         unsigned long nod_temp = nob * (nodePerBlockX1+gl) * (nodePerBlockX2+gl) * (nodePerBlockX3+gl);
+         unsigned long nod = nob * (nodePerBlockX1) * (nodePerBlockX2) * (nodePerBlockX3);
+         double needMemAll  = double(nod_temp*(27*sizeof(double) + sizeof(int) + sizeof(float)*4));
+         double needMem  = needMemAll / double(comm->getNumberOfProcesses());
+
+         if(myid == 0)
+         {
+            UBLOG(logINFO,"Number of blocks = " << nob);
+            UBLOG(logINFO,"Number of nodes  = " << nod);
+            UBLOG(logINFO,"Necessary memory  = " << needMemAll  << " bytes");
+            UBLOG(logINFO,"Necessary memory per process = " << needMem  << " bytes");
+            UBLOG(logINFO,"Available memory per process = " << availMem << " bytes");
+         }  
+
+
+         //LBMKernel3DPtr kernel(new LBMKernelETD3Q27Cascaded(nodePerBlockX1, nodePerBlockX2, nodePerBlockX2));
+         //LBMKernel3DPtr kernel(new LBMKernelETD3Q27BGK(nodePerBlockX1, nodePerBlockX2, nodePerBlockX2, true));
+         LBMKernel3DPtr kernel(new LBMKernelETD3Q27CCLB(nodePerBlockX1, nodePerBlockX2, nodePerBlockX2,0));
+
+         BCProcessorPtr bcProc(new D3Q27ETBCProcessor());
+         kernel->setBCProcessor(bcProc);
+
+         SetKernelBlockVisitor kernelVisitor(kernel, nueLB, availMem, needMem);
+         grid->accept(kernelVisitor);
+
+         if (refineLevel > 0)
+         {
+            D3Q27SetUndefinedNodesBlockVisitor undefNodesVisitor;
+            grid->accept(undefNodesVisitor);
+         }
+
+         //canal
+         grid->addAndInitInteractor(geoInt);
+
+         //inflow
+         grid->addAndInitInteractor(inflowInt);
+
+         //outflow
+         grid->addAndInitInteractor(outflowInt);
+
+         //////////////////////////////////////////////////////////////////////////
+         //connectoren setzen:
+         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
+         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
+         grid->accept( setConnsVisitor );
+         //////////////////////////////////////////////////////////////////////////
+         //domain decomposition
+         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
+         grid->accept(pqPartVisitor);
+         //////////////////////////////////////////////////////////////////////////
+         //Stroemungsfeld initialisieren
+         //////////////////////////////////////////////////////////////////////////
+         D3Q27ETInitDistributionsBlockVisitor initVisitor(rhoLB); //1.0
+         //initVisitor.setVx1(0.0); 
+         grid->accept(initVisitor);
+
+         if(myid == 0)
+         {
+            //Abstände "q" als Linien rausschreiben
+            std::vector< UbTupleFloat3 > nodes;
+            std::vector< UbTupleInt2 >   lines;
+            geoInt->addQsLineSet(nodes, lines);
+            WbWriterVtkXmlBinary::getInstance()->writeLines(pathname+"/grid/qs",nodes,lines);
+         }
+
+         if(myid == 0) UBLOG(logINFO,"Preprozess - end");
+
+      }
+      //////////////////////////////////////////////////////////////////////////
+      //Set Postprozessors
+      //////////////////////////////////////////////////////////////////////////
+      {
+         UbSchedulerPtr geoSch(new UbScheduler(1));
+         D3Q27MacroscopicQuantitiesPostprocessor ppgeo(grid,geoSch, pathname + "/grid/nodes", WbWriterVtkXmlBinary::getInstance(), conv,  comm, true);
+         grid->doPostProcess(0);
+      }
+
+
+      UbSchedulerPtr nupsSch(new UbScheduler(1, 5, 10));
+      NUPSCounterPostprocessor npr(grid, nupsSch, pathname + "/results/nups.txt", comm);
+
+      double outTime = 100;
+      UbSchedulerPtr visSch(new UbScheduler(outTime));
+      //visSch->addSchedule(20, 1010, 1100);
+      D3Q27MacroscopicQuantitiesPostprocessor pp(grid,visSch, pathname + "/steps/step", WbWriterVtkXmlBinary::getInstance(), conv,  comm);
+      //////////////////////////////////////////////////////////////////////////
+      //PathLine
+      //UbSchedulerPtr plSch(new UbScheduler(10, 1500));
+      //D3Q27PathLinePostprocessor pathLine(grid, pathname + "/pathLine", WbWriterVtkXmlASCII::getInstance(), conv, plSch, comm, -0.3285474538, 0.09692341,-0.0376166666, nueLB, iProcessor);
+      //////////////////////////////////////////////////////////////////////////
+      //Simulation
+      //////////////////////////////////////////////////////////////////////////
+      double endTime = 1000;
+      UbSchedulerPtr visSch1(new UbScheduler(1));
+      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, visSch));
+      if(myid == 0) UBLOG(logINFO,"Simulation-start");
+      calculation->calculate();
+      if(myid == 0) UBLOG(logINFO,"Simulation-end");
+
+   }
+   catch(std::exception& e)
+   {
+      cerr << e.what() << endl;
+   }
+   catch(std::string& s)
+   {
+      cerr << s << endl;
+   }
+   catch(...)
+   {
+      cerr << "unknown exception" << endl;
+   }
+
+}
+
diff --git a/apps/cpu/micropart/micropartTestQs2.hpp b/apps/cpu/micropart/micropartTestQs2.hpp
index 210b295336cb0171c450d5d04e10f9c3575a2d23..ced24710a450e84c6baa6ce47c573245858fb6ee 100644
--- a/apps/cpu/micropart/micropartTestQs2.hpp
+++ b/apps/cpu/micropart/micropartTestQs2.hpp
@@ -1,592 +1,592 @@
-#include <iostream>
-#include <string>
-#include <map>
-#include "RefineCrossAndInsideGbObjectBlockVisitor.h"
-#include "RatioBlockVisitor.h"
-#include "RatioSmoothBlockVisitor.h"
-#include "OverlapBlockVisitor.h"
-#include "SetInterpolationDirsBlockVisitor.h"
-#include "geometry3d/GbSystem3D.h"
-#include "geometry3d/GbCuboid3D.h"
-#include "geometry3d/GbCylinder3D.h"
-#include "geometry3d/GbSphere3D.h"
-#include "BlocksPostprocessor.h"
-#include "Grid3D.h"
-#include "Patch3D.h"
-#include "Patch3DSystem.h"
-#include "Block3D.h"
-#include "LBMKernelETD3Q27Cascaded.h"
-#include "LBMKernelETD3Q27BGK.h"
-#include "CalculationManager.h" 
-#include "D3Q27SetConnectorsBlockVisitor.h" 
-#include "D3Q27ETInitDistributionsBlockVisitor.h"
-#include "D3Q27Interactor.h"
-#include "D3Q27NoSlipBCAdapter.h"
-#include "D3Q27VelocityBCAdapter.h"
-#include "D3Q27DensityBCAdapter.h"
-#include "SimulationParameters.h"
-#include "Communicator.h"
-#include "MPICommunicator.h"
-#include "SimpleGeometricPartitioner.h"
-#include "D3Q27MacroscopicQuantitiesPostprocessor.h"
-#include "D3Q27ETBCProcessor.h"
-#include "D3Q27TriFaceMeshInteractor.h"
-#include "ConfigFileReader.h"
-#include "StringUtil.hpp"
-#include "D3Q27PressureDifferencePostprocessor.h"
-#include "D3Q27IntegrateValuesHelper.h"
-#include "LBMUnitConverter.h"
-#include "NUPSCounterPostprocessor.h"
-#include "PQueuePartitioningGridVisitor.h"
-#include "SetKernelBlockVisitor.h"
-#include "GenBlocksGridVisitor.h"
-#include "D3Q27PathLinePostprocessorMcpart.h"
-#include "D3Q27SetUndefinedNodesBlockVisitor.h"
-   //
-#include "basics/writer/WbWriterVtkXmlBinary.h"
-#include "basics/writer/WbWriterVtkXmlASCII.h"
-#include "geometry3d/creator/GbTriFaceMesh3DCreator.h"
-#include "geometry3d/GbTriFaceMesh3D.h"
-#include "D3Q27System.h"
-#include <basics/transmitter/TbTransmitterMpiPool.h>
-#include "MathUtil.hpp"
-#include "D3Q27OffsetInterpolationProcessor.h"
-#include "SolidBlocksHelper.h"
-#include "MetisPartitioningGridVisitor.h"
-#include "RestartPostprocessor.h"
-#include "D3Q27IncompressibleOffsetInterpolationProcessor.h"
-#include "LBMKernelETD3Q27CCLB.h"
-#include "AverageValuesPostprocessor.h"
-#include <vfluids.h>
-using namespace std;
-
-void micropartTestQs2(const char *cstr)
-{
-   try
-   {
-      CommunicatorPtr comm(new MPICommunicator());
-      int myid = comm->getProcessID();
-      int numprocs = comm->getNumberOfProcesses();
-
-      string machine = QUOTEME(CAB_MACHINE);
-      string pathname; 
-      double availMem = 0;
-      string geoFile;
-      int numOfThreads = 1;
-
-      if(machine == "EHSAN1491") 
-      {
-         pathname = "/work/ehsan/micropart";
-         availMem = 3.0e9;
-		  int numOfThreads = 1;
-         //geoFile = "c:/Data/micropart/DK19_7_02_Martin.stl";
-         //geoFile = "c:/Data/micropart/ktoolcav.stl";
-         //geoFile = "c:/Data/micropart/boxN.stl";
-        geoFile = "C:/Users/ehsan/Desktop/meshparticles/E0019B_mit_Radien.stl";
-      }
-      else if(machine == "M01" || machine == "M02")      
-      {
-         pathname = "/work/koskuche/scratch/mcpart/out";
-         availMem = 12.0e9/8.0;
-		  geoFile = "/work/ehsan/data/E0019B_mit_Radien.stl";
-         //geoFile = "/home/koskuche/data/micropart/DK19_7_02_Martin.stl";
-
-         numOfThreads = 1;
-         if(myid ==0)
-         {
-            stringstream logFilename;
-            logFilename <<  pathname + "/logfile"+UbSystem::toString(UbSystem::getTimeStamp())+"_"+UbSystem::toString(myid)+".txt";
-            UbLog::output_policy::setStream(logFilename.str());
-         }
-      }
-      else throw UbException(UB_EXARGS, "unknown CAB_MACHINE");
-
-      UbLog::reportingLevel() = logINFO;
-      //UbLog::reportingLevel() = logDEBUG1;
-
-      int nodePerBlockX1 =16; //Anzahl an Knoten pro Block
-      int nodePerBlockX2 =16;//(int)16;
-      int nodePerBlockX3 =8;//8; //(int)16;
-
-      double bH = nodePerBlockX1;    //gewuenschte Rand- und Blockbreite
-
-      //Simulation Parameters
-      const int baseLevel = 0;
-      const int refineLevel =4;
-      //length [m]
-      double lSI = 219;//223.2;
-      //length [LB]
-      double lLB = 30;
-
-      double dx =lSI/lLB;
-
-      double left_offset = 10700;//*0.5;
-      double right_offset  = 107000;//0.5;//2*0.5
-      double front_offset = 750;//0.15;
-      double back_offset  = 750;//0.15;
-      double top_offset = 250;//0.0;
-      double bottom_offset  =750;// 70;//0.07;
-	  
-	   LBMReal vLB =0.00016103/5.0*sqrt(2.0);//0.00016103;
-       LBMReal Re;
-       LBMReal rhoLB = 0.0;
-       LBMReal nueLB = 0.0000249;//(vLB*lLB)/Re;
-       Re = (vLB*(500/dx))/nueLB;
-       double dp_Ph=200.0*100000;//
-	   double dp_lb=dp_Ph*0.001*(nueLB*dx)*(nueLB*dx);//nue_ph=10e-6 and dx is in micrometer
-      // LBMReal nueLB = 0.000016103;
-      // LBMReal Re=15000;
-      // LBMReal rhoLB = 0.0;
-      // LBMReal vLB =nueLB*Re/(500.0/dx);
-     // // Re = (vLB*(0.303/dx))/nueLB;
-	   // //Re = (vLB*lLB)/nueLB;
-	  
-      // LBMReal rhoWord = 1e-15;//kg/micrometre^3;//1000.0;
-	  // LBMReal nueRE = 1e6;//micromter^2/s;//0.000001;
-	  // LBMReal  vWorld=300*1e6;//micrometer/s;//nueRE*Re/ (lSI*4.0/9.0);
-	  LBMUnitConverterPtr conv = LBMUnitConverterPtr(new LBMUnitConverter());
-      //conv->init(lSI*1e-6,30000,rhoWord,vWorld,lLB,1.0/*rhoLB*/,vLB);
-      
-	 
- //////////////////////////////////////////////////////////////////////////
-      GbObject3DPtr refineCube1(new  GbCuboid3D(-500.0+5.0/*-354.0*/,-957.0/*-280.0*/,-684.0/* -72.0*/, 4100/*370.0*/,957.0/*354.0*/,70.0));//-530.0,-280.0, -72.0, 530.0,354.0,70.0));
-      if(myid == 0) GbSystem3D::writeGeoObject(refineCube1.get(), pathname+"/geo/refineCube1", WbWriterVtkXmlASCII::getInstance());
-
-      GbObject3DPtr refineCube2(new  GbCuboid3D(-230.0,-90.0, -684.0/*-72.0*/, 600,100.0,70.0));
-      if(myid == 0) GbSystem3D::writeGeoObject(refineCube2.get(), pathname+"/geo/refineCube2", WbWriterVtkXmlASCII::getInstance());
-	  
-	   GbObject3DPtr refineCube3(new  GbCuboid3D(-350.0,-957.0/*-120.0*/,-684.0/*-684.0*//* -72.0*/, 1700,957.0/*120.0*/,70.0));
-      if(myid == 0) GbSystem3D::writeGeoObject(refineCube3.get(), pathname+"/geo/refineCube3", WbWriterVtkXmlASCII::getInstance());
-	  
-	   GbObject3DPtr refineCube4(new  GbCuboid3D(-170.0,-60.0, -684.0/*-72.0*/, 200,60.0,70.0));
-      if(myid == 0) GbSystem3D::writeGeoObject(refineCube4.get(), pathname+"/geo/refineCube4", WbWriterVtkXmlASCII::getInstance());
-	  
-	   GbObject3DPtr refineCubeInlet(new  GbCuboid3D(-10600.0,-600.0, -600.0/*-72.0*/, -9000,600.0,60.0));
-      if(myid == 0) GbSystem3D::writeGeoObject(refineCubeInlet.get(), pathname+"/geo/refineCubeInlet", WbWriterVtkXmlASCII::getInstance());
-	  
-	  GbObject3DPtr refineCubeOutlet(new  GbCuboid3D(9000,-600.0, -600.0/*-72.0*/,10550.0 ,600.0,60.0));
-      if(myid == 0) GbSystem3D::writeGeoObject(refineCubeOutlet.get(), pathname+"/geo/refineCubeOutlet", WbWriterVtkXmlASCII::getInstance());
-      //////////////////////////////////////////////////////////////////////////
-      D3Q27TriFaceMeshInteractorPtr geoInt;
-	  /////////////////
-      //Grid3DPtr grid(new Grid3D());
-        Grid3DPtr grid(new Grid3D(comm));
-
-      UbSchedulerPtr rSch(new UbScheduler());
-      rSch->addSchedule(100, 200, 20000);
-      RestartPostprocessorPtr rp(new RestartPostprocessor(grid, rSch, comm, pathname+"/checkpoints", RestartPostprocessor::BINARY));
-
-      std::string opt;
-         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
-
-      if(cstr!= NULL)
-         opt = std::string(cstr);
-
-      if/*(cstr== NULL)*/(cstr!= NULL)
-      {
-         if(myid==0) UBLOG(logINFO,"Restart step: " << opt);
-         grid = rp->restart(UbSystem::stringTo<int>(opt));
-         rp->reconnect(grid);
-
-         // SetForcingBlockVisitor forcingVisitor(0.0, 0.0, 0.0);
-         // grid->accept(forcingVisitor);
-
-         //D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
-         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
-         grid->accept( setConnsVisitor );
-		  if(myid==0) UBLOG(logINFO,"Restart finish: " << opt);
-	 
-      }
-      else
-      {
-         if(myid ==0)
-         {
-            UBLOG(logINFO,"L = " <<lLB );
-            UBLOG(logINFO,"v = " <<vLB );
-            UBLOG(logINFO,"rho = " <<rhoLB );
-            UBLOG(logINFO,"nue = " << nueLB );
-			UBLOG(logINFO,"dx = " << dx );
-            UBLOG(logINFO,"Re = " << Re );
-			 UBLOG(logINFO,"dp_lb = " << dp_lb );
-            UBLOG(logINFO,"Preprozess - start");
-         }
-
-
-         ////////////////////////////////////////////////////////////////////////
-         //Grid
-         //////////////////////////////////////////////////////////////////////////
-         grid->setDeltaX(dx);
-         grid->setBlockNX(nodePerBlockX1, nodePerBlockX2, nodePerBlockX3);
-
-         ////////////////////////////////////////////////////////////////////////////
-         //// Geometrie
-         ////////////////////////////////////////////////////////////////////////////
-         GbTriFaceMesh3DPtr geo (GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(geoFile,"geo"));
-
-         if(myid == 0) GbSystem3D::writeGeoObject(geo.get(), pathname+"/geo/geo", WbWriterVtkXmlASCII::getInstance());
-
-         ////////////////////////////////////////////////////////////////////////////
-         //// Randgeometrien erstellen
-         ////////////////////////////////////////////////////////////////////////////
-         double shiftForMG=grid->getDeltaX(refineLevel)*nodePerBlockX1 / 3.0*2.0;
-          GbCuboid3DPtr plate1  = GbCuboid3DPtr( new GbCuboid3D( -7.5, -1.515e-1, -6.831e-2, 7.5, 1.515e-1, 0.0 ));
-
-           GbCuboid3DPtr plate2  = GbCuboid3DPtr( new GbCuboid3D( -1.5e-1, -16.51e-1, -16.831e-2, 1.5e-1, -1.6e-2, 1.0 ));
-           GbCuboid3DPtr plate3  = GbCuboid3DPtr( new GbCuboid3D( -1.5e-1, 1.6e-2, -16.831e-2, 1.5e-1, 16.515e-1, 1.0 ));
-
-          // GbCuboid3DPtr plate1_1  = GbCuboid3DPtr( new GbCuboid3D( -7.5, -2.515e-1, -1.0e-1, 7.5, 2.515e-1, -6.831e-2 ));
-          // GbCuboid3DPtr plate1_2  = GbCuboid3DPtr( new GbCuboid3D( -7.5, -2.515e-1, -0.0000001, 7.5, 2.515e-1, 1.0e-1 ));
-          // GbCuboid3DPtr plate1_3  = GbCuboid3DPtr( new GbCuboid3D( -7.5, 1.515e-1, -6.831e-2, 7.5, 2.515e-1, 0.0  ));
-          // GbCuboid3DPtr plate1_4  = GbCuboid3DPtr( new GbCuboid3D( -7.5, -2.515e-1, 0.0, 7.5, -1.515e-1, -1.0e-1 ));
-
-          // GbCuboid3DPtr inflow  = GbCuboid3DPtr( new GbCuboid3D( -8.0, -1.0, -1.0, -7.5, 1.0, 1.0 ));
-          // GbCuboid3DPtr outflow = GbCuboid3DPtr( new GbCuboid3D( 7.5, -1.0, -1.0, 8.0, 1.0, 1.0 ));
-		  
-		   // GbCuboid3DPtr plate2  = GbCuboid3DPtr( new GbCuboid3D( -1.5e-1, -16.51e-1, -16.831e-2, 1.5e-1, -1.6e-2, 1.0 ));
-          // GbCuboid3DPtr plate3  = GbCuboid3DPtr( new GbCuboid3D( -1.5e-1, 1.6e-2, -16.831e-2, 1.5e-1, 16.515e-1, 1.0 ));
-
-          // GbCuboid3DPtr plate1_1  = GbCuboid3DPtr( new GbCuboid3D( -left_offset-bH*dx, back_offset, -bottom_offset-bH*dx, right_offset+bH*dx, back_offset+bH*dx, top_offset+bH*dx ));
-          // GbCuboid3DPtr plate1_2  = GbCuboid3DPtr( new GbCuboid3D( -left_offset-bH*dx, -front_offset-bH*dx, -bottom_offset-bH*dx, right_offset+bH*dx, -front_offset, top_offset+bH*dx ));
-          // GbCuboid3DPtr plate1_3  = GbCuboid3DPtr( new GbCuboid3D( -left_offset-bH*dx, -front_offset-bH*dx, top_offset, right_offset+bH*dx, back_offset+bH*dx, top_offset+bH*dx+2.0*dx ));
-          // GbCuboid3DPtr plate1_4  = GbCuboid3DPtr( new GbCuboid3D( -left_offset-bH*dx, -front_offset-bH*dx, -bottom_offset-bH*dx, right_offset+bH*dx, back_offset+bH*dx, -bottom_offset ));
-
-          //GbCuboid3DPtr inflow  = GbCuboid3DPtr( new GbCuboid3D( -left_offset-5*bH*dx, -front_offset-5*bH*dx, -bottom_offset-5*bH*dx, -left_offset, back_offset+5*bH*dx, top_offset+5*bH*dx ));
-          //GbCuboid3DPtr outflow = GbCuboid3DPtr( new GbCuboid3D( right_offset, -front_offset-5*bH*dx, -bottom_offset-5*bH*dx, right_offset+5.0*bH*dx, back_offset+5*bH*dx, top_offset+5*bH*dx ));
-		  GbCuboid3DPtr inflow  = GbCuboid3DPtr( new GbCuboid3D( -11000.0,-600.0, -600.0, -9000.0, 600.0, -500 ));
-		  GbCuboid3DPtr outflow = GbCuboid3DPtr( new GbCuboid3D( 9000,-600.0, -600.0, 11000.0, 600.0, -500));
-
-
-		   GbObject3DPtr gridCube(new GbCuboid3D(-10700.0/*inflow->getX1Maximum()-4.0*dx/*.5*shiftForMG*/,-550.0/*-270*/ , -550.0/*-70*/,
-                                                10700.0/*outflow->getX1Minimum()+4.0*dx/*.5*shiftForMG*/, 
-                                                550.0/*270*/, 
-                                                23.0/*10.0*/));
-
-         GenBlocksGridVisitor genBlocks;
-         genBlocks.addGeoObject(gridCube);
-         grid->accept(genBlocks);
-		  
-         if(myid == 0)
-         {
-            GbSystem3D::writeGeoObject(gridCube.get(),pathname+"/geo/gridCube", WbWriterVtkXmlASCII::getInstance());
-            //GbSystem3D::writeGeoObject(plate2.get(),pathname+"/geo/plate2", WbWriterVtkXmlASCII::getInstance());
-            //GbSystem3D::writeGeoObject(plate3.get(),pathname+"/geo/plate3", WbWriterVtkXmlASCII::getInstance());
-
-            // GbSystem3D::writeGeoObject(plate1_1.get(),pathname+"/geo/plate1_1", WbWriterVtkXmlASCII::getInstance());
-            // GbSystem3D::writeGeoObject(plate1_2.get(),pathname+"/geo/plate1_2", WbWriterVtkXmlASCII::getInstance());
-            // GbSystem3D::writeGeoObject(plate1_3.get(),pathname+"/geo/plate1_3", WbWriterVtkXmlASCII::getInstance());
-            // GbSystem3D::writeGeoObject(plate1_4.get(),pathname+"/geo/plate1_4", WbWriterVtkXmlASCII::getInstance());
-
-            GbSystem3D::writeGeoObject(inflow.get(),pathname+"/geo/inflow", WbWriterVtkXmlASCII::getInstance());
-            GbSystem3D::writeGeoObject(outflow.get(),pathname+"/geo/outflow", WbWriterVtkXmlASCII::getInstance());
-         }
-   
-
-         if (refineLevel > 0)
-         {
-		  if(myid == 0) UBLOG(logINFO,"Refinement - start");   
-            RefineCrossAndInsideGbObjectHelper refineHelper(grid, refineLevel);
-            refineHelper.addGbObject(refineCube1, 1);
-            refineHelper.addGbObject(refineCube3, 2);
-			 refineHelper.addGbObject(refineCube2, 3);
-			 refineHelper.addGbObject(refineCube4, 4);
-			 
-			 refineHelper.addGbObject(refineCubeInlet, 1);
-			 refineHelper.addGbObject(refineCubeOutlet, 1);
-            refineHelper.refine();
-            if(myid == 0) UBLOG(logINFO,"Refinement - end");   
-		 
-		 
-           // RefineCrossAndInsideGbObjectBlockVisitor refVisitor1(refineCube1, refineLevel-4);
-            // grid->accept(refVisitor1);
-
-			// RefineCrossAndInsideGbObjectBlockVisitor refVisitor3(refineCube3, refineLevel-3);
-            // grid->accept(refVisitor3);
-
-            // RefineCrossAndInsideGbObjectBlockVisitor refVisitor2(refineCube2, refineLevel-2);
-            // grid->accept(refVisitor2);
-			
-			 // RefineCrossAndInsideGbObjectBlockVisitor refVisitor4(refineCube4, refineLevel-1);
-            // grid->accept(refVisitor4);
-
-            // RatioBlockVisitor ratioVisitor(refineLevel);
-            // grid->accept(ratioVisitor);
-
-            // RatioSmoothBlockVisitor ratioSmoothVisitor(refineLevel);
-            // grid->accept(ratioSmoothVisitor);
-
-            // OverlapBlockVisitor overlapVisitor(refineLevel);
-            // grid->accept(overlapVisitor);
-
-            // std::vector<int> dirs;
-            // D3Q27System::getLBMDirections(dirs);
-            // SetInterpolationDirsBlockVisitor interDirsVisitor(dirs);
-            // grid->accept(interDirsVisitor);
-            // if(myid == 0) UBLOG(logINFO,"Refinement - end");	
-         }
-
-         //////////////////////////////////////////////////////////////////////////
-         //INTERAKTOREN SETZEN (=Randbedingungen)
-         //////////////////////////////////////////////////////////////////////////
-         //oben/unten = Haftrand
-         int bbOption = 1; //0=simple Bounce Back, 1=quadr. BB
-         D3Q27BoundaryConditionAdapterPtr bcObst(new D3Q27NoSlipBCAdapter(bbOption));
-         geoInt = D3Q27TriFaceMeshInteractorPtr( new D3Q27TriFaceMeshInteractor(geo, grid, D3Q27BoundaryConditionAdapterPtr(new D3Q27NoSlipBCAdapter(bbOption)),Interactor3D::INVERSESOLID, Interactor3D::SIMPLE));
-	     geoInt->setUseHalfSpaceCheck(true);
-         geoInt->setRegardPointInObjectTest(true);
-         if(myid == 0) UBLOG(logINFO,"stl - end"); 
-         //D3Q27InteractorPtr plate1Int(new D3Q27Interactor(plate1, grid, bcObst,Interactor3D::INVERSESOLID));
-         // D3Q27InteractorPtr plate2Int(new D3Q27Interactor(plate2, grid, bcObst,Interactor3D::SOLID));
-         // D3Q27InteractorPtr plate3Int(new D3Q27Interactor(plate3, grid, bcObst,Interactor3D::SOLID));
-
-         // D3Q27InteractorPtr plate1_1Int(new D3Q27Interactor(plate1_1, grid, bcObst,Interactor3D::SOLID));
-         // D3Q27InteractorPtr plate1_2Int(new D3Q27Interactor(plate1_2, grid, bcObst,Interactor3D::SOLID));
-         // D3Q27InteractorPtr plate1_3Int(new D3Q27Interactor(plate1_3, grid, bcObst,Interactor3D::SOLID));
-         // D3Q27InteractorPtr plate1_4Int(new D3Q27Interactor(plate1_4, grid, bcObst,Interactor3D::SOLID));
-
-         //links: geschwindigkeits-einfluss
-         //Velocity-BC
-         //////////////////////////////////////////////////////////////////////////
-         mu::Parser fct;
-         fct.DefineConst("vx1"  , vLB*9.0/4.0 );
-         //fct = MathUtil::getDuctParaboloidX(0, 250*2.0, -51.08/2, 51.08, vLB*9.0/4.0);
-         fct.SetExpr("vx1");
-         //////////////////////////////////////////////////////////////////////////
-
-         //////////////////////////////////////////////////////////////////////////
-            // D3Q27BoundaryConditionAdapterPtr velBCAdapter = D3Q27BoundaryConditionAdapterPtr(new D3Q27VelocityBCAdapter (false, false ,true ,fct, 0, D3Q27BCFunction::INFCONST));
-            // velBCAdapter->setSecondaryBcOption(2);
-            // D3Q27InteractorPtr inflowInt  = D3Q27InteractorPtr( new D3Q27Interactor(inflow, grid, velBCAdapter, Interactor3D::SOLID));
-
-		 D3Q27BoundaryConditionAdapterPtr denBCAdapterInlet(new D3Q27DensityBCAdapter(3.0*(dp_lb-rhoLB)));
-        denBCAdapterInlet->setSecondaryBcOption(1);
-        D3Q27InteractorPtr inflowInt = D3Q27InteractorPtr( new D3Q27Interactor(inflow, grid, denBCAdapterInlet,Interactor3D::SOLID));
-		 
-         //rechts: druckrand
-         //Density-BC
-         //fuer Kompressibles Modell  rho = 1.0
-         D3Q27BoundaryConditionAdapterPtr denBCAdapter(new D3Q27DensityBCAdapter(rhoLB));
-         denBCAdapter->setSecondaryBcOption(1);
-         D3Q27InteractorPtr outflowInt = D3Q27InteractorPtr( new D3Q27Interactor(outflow, grid, denBCAdapter,Interactor3D::SOLID));
-
-         MetisPartitioningGridVisitor metisVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B);
-         grid->accept( metisVisitor );
-         
-         BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname + "/grid/blocks", WbWriterVtkXmlBinary::getInstance(), comm));
-         if(myid == 0) ppblocks->update(0);
-         
-         SolidBlocksHelper sd(grid, comm);
-         sd.addInteractor(geoInt);
-         sd.addInteractor(inflowInt);
-         sd.addInteractor(outflowInt);
-         // sd.addInteractor(plate1_1Int);
-         // sd.addInteractor(plate1_2Int);
-         // sd.addInteractor(plate1_3Int);
-         // sd.addInteractor(plate1_4Int);
-         // sd.addInteractor(plate2Int);
-         // sd.addInteractor(plate3Int);
-		   if(myid == 0) UBLOG(logINFO,"line"<<__LINE__); 
-         sd.deleteSolidBlocks();     
-         if(myid == 0) UBLOG(logINFO,"line"<<__LINE__); 
-         grid->accept( metisVisitor );
-         if(myid == 0) UBLOG(logINFO,"line"<<__LINE__);
-
-         sd.setTransBlocks();
-         if(myid == 0) UBLOG(logINFO,"line"<<__LINE__);
-         //BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname + "/grid/blocks", WbWriterVtkXmlBinary::getInstance(), comm));
-         if(myid == 0) ppblocks->update(1);
-         if(myid == 0) ppblocks.reset();
-
-         unsigned long nob = grid->getNumberOfBlocks();
-         int gl = 3;
-         unsigned long nod_temp = nob * (nodePerBlockX1+gl) * (nodePerBlockX2+gl) * (nodePerBlockX3+gl);
-         unsigned long nod = nob * (nodePerBlockX1) * (nodePerBlockX2) * (nodePerBlockX3);
-         double needMemAll  = double(nod_temp*(27*sizeof(double) + sizeof(int) + sizeof(float)*4));
-         double needMem  = needMemAll / double(comm->getNumberOfProcesses());
-
-
-         if(myid == 0)
-         {
-            UBLOG(logINFO,"Number of blocks = " << nob);
-            UBLOG(logINFO,"Number of nodes  = " << nod);
-            UBLOG(logINFO,"Necessary memory  = " << needMemAll  << " bytes");
-            UBLOG(logINFO,"Necessary memory per process = " << needMem  << " bytes");
-            UBLOG(logINFO,"Available memory per process = " << availMem << " bytes");
-         }  
-
-         //LBMKernel3DPtr kernel(new LBMKernelETD3Q27Cascaded(nodePerBlockX1, nodePerBlockX2, nodePerBlockX2));
-         //LBMKernel3DPtr kernel(new LBMKernelETD3Q27CCLB(nodePerBlockX1, nodePerBlockX2, nodePerBlockX2));
-
-		  int option = 0;
-		 LBMKernel3DPtr kernel(new LBMKernelETD3Q27CCLB(nodePerBlockX1, nodePerBlockX2, nodePerBlockX3,option));
-
-		 
-		 
-         BCProcessorPtr bcProc(new D3Q27ETBCProcessor());
-         kernel->setBCProcessor(bcProc);
-
-         SetKernelBlockVisitor kernelVisitor(kernel, nueLB, availMem, needMem);
-         grid->accept(kernelVisitor);
-
-         if (refineLevel > 0)
-         {
-            D3Q27SetUndefinedNodesBlockVisitor undefNodesVisitor;
-            grid->accept(undefNodesVisitor);
-         }
-		 
-		  if(myid == 0) UBLOG(logINFO,"intractor - start"); 
-          //inflow
-         grid->addAndInitInteractor(inflowInt);
-
-         //outflow
-         grid->addAndInitInteractor(outflowInt);
-         //canal
-         grid->addAndInitInteractor(geoInt);
-         // grid->addAndInitInteractor(plate1_1Int);
-         // grid->addAndInitInteractor(plate1_2Int);
-         // grid->addAndInitInteractor(plate1_3Int);
-         // grid->addAndInitInteractor(plate1_4Int);
-         // grid->addAndInitInteractor(plate2Int);
-         // grid->addAndInitInteractor(plate3Int);
-
-       
-
-         //////////////////////////////////////////////////////////////////////////
-         //connectoren setzen:
-
-         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
-         grid->accept( setConnsVisitor );
-         //////////////////////////////////////////////////////////////////////////	 
-         //domain decomposition
-         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
-         grid->accept(pqPartVisitor);
-			 
-         //////////////////////////////////////////////////////////////////////////     
-	   //Stroemungsfeld initialisieren
-         //////////////////////////////////////////////////////////////////////////
-         D3Q27ETInitDistributionsBlockVisitor initVisitor(rhoLB); //1.0
-         initVisitor.setVx1(0); 
-         grid->accept(initVisitor);
-
-         if(myid == 0)
-         {
-            //Abst�nde "q" als Linien rausschreiben
-            std::vector< UbTupleFloat3 > nodes;
-            std::vector< UbTupleInt2 >   lines;
-            geoInt->addQsLineSet(nodes, lines);
-            WbWriterVtkXmlBinary::getInstance()->writeLines(pathname+"/grid/qs",nodes,lines);
-         }
-
-          if(myid == 0) UBLOG(logINFO,"Preprozess - end");
-		 
-		 	  ////////////////////////
-           //Set Postprozessors
-           //////////////////////////////////////////////////////////////////////////
-           {
-            UbSchedulerPtr geoSch(new UbScheduler(1));
-            D3Q27MacroscopicQuantitiesPostprocessor ppgeo(grid,geoSch, pathname + "/grid/nodes", WbWriterVtkXmlBinary::getInstance(), conv,  comm, true);
-            grid->doPostProcess(0);
-           }
-	    
-
-      }
-
-      //////////////////////////////////////////////////////////////////////////
-	   // UbSchedulerPtr visSchAv(new UbScheduler());
-		UbSchedulerPtr visSchAv(new UbScheduler(100,100));
-      // visSchAv->addSchedule(100,10,1000);
-      // UbSchedulerPtr resSchAv(new UbScheduler());
-	   UbSchedulerPtr resSchAv(new UbScheduler(100,100));
-      // resSchAv->addSchedule(20,20,1000);
-      AverageValuesPostprocessor       Avpp(grid,  pathname + "/Turbulence/stepAV", WbWriterVtkXmlBinary::getInstance(), visSchAv/*wann wird rausgeschrieben*/,resSchAv/*wann wird resettet*/,comm);
-	  
-	   D3Q27ShearStressPostprocessor  shear(grid,  pathname + "/shear/step", WbWriterVtkXmlBinary::getInstance(), visSchAv/*wann wird rausgeschrieben*/,resSchAv/*wann wird resettet*/,comm,iProcessor); 
-	   //D3Q27ShearStressPostprocessor  shear(grid,  pathname + "/shear/step", WbWriterVtkXmlBinary::getInstance(), visSchAv/*wann wird rausgeschrieben*/,resSchAv/*wann wird resettet*/,comm);
-	   shear.addInteractor(geoInt);
-	   ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-	  
-
-      UbSchedulerPtr nupsSch(new UbScheduler(1, 5, 10));
-      NUPSCounterPostprocessor npr(grid, nupsSch, pathname + "/results/nups.txt", comm);
-
-      double outTime = 100.0;
-      UbSchedulerPtr stepSch(new UbScheduler(outTime));
-      D3Q27MacroscopicQuantitiesPostprocessor pp(grid,stepSch, pathname + "/steps/step", WbWriterVtkXmlBinary::getInstance(), conv,  comm);
-      //////////////////////////////////////////////////////////////////////////
-      //PathLine
-       UbSchedulerPtr plSch(new UbScheduler(5000, 5000));
-      const int numberofparticle=20;
-	
-	  std::vector<UbTupleDouble3 > potisions;
-	  double randomx[numberofparticle];
-	  double randomy[numberofparticle];
-	  double randomz[numberofparticle];
-	  double lowestx,highestx,lowesty,highesty,lowestz,highestz;
-	  if(myid==0)
-	  {
-		  for(int i = 0; i < numberofparticle; i++)
-		  {
-			  double random; 
-	        lowestx =-10300.0;  lowesty =-230;          lowestz =-250;
-	        highestx=-9792.0;  highesty=-330;          highestz=-250; 
-		  
-	      double rangex=(highestx-lowestx),rangey=(highesty-lowesty),rangez=(highestz-lowestz);	
-           randomx[i] = lowestx+(rangex*rand()/(RAND_MAX + 1.0));
-		   randomy[i] = lowesty+(rangey*rand()/(RAND_MAX + 1.0));
-	       randomz[i] = lowestz+(rangez*rand()/(RAND_MAX + 1.0));
-		  //val<1>(potisions[i])= 0.506983973456;
-		  //val<2>(potisions[i]) = lowesty+(rangey*rand()/(RAND_MAX + 1.0));
-		   //val<3>(potisions[i]) = lowestz+(rangez*rand()/(RAND_MAX + 1.0));
-		  }
-		  for (int i=0;i<comm->getNumberOfProcesses();i++)
-		  {
-			  if (i!=0)
-			  {
-			      MPI_Send(randomx,numberofparticle, MPI_DOUBLE_PRECISION,i,i,MPI_COMM_WORLD);
-				  MPI_Send(randomy,numberofparticle, MPI_DOUBLE_PRECISION,i,i,MPI_COMM_WORLD);
-				  MPI_Send(randomz,numberofparticle, MPI_DOUBLE_PRECISION,i,i,MPI_COMM_WORLD);
-			  }
-		  }
-	  }
-	  if (myid!=0)
-	  {
-		  MPI_Status status; 
-		  MPI_Recv(randomx,numberofparticle, MPI_DOUBLE_PRECISION,0,MPI_ANY_TAG,MPI_COMM_WORLD,&status);
-		  MPI_Recv(randomy,numberofparticle, MPI_DOUBLE_PRECISION,0,MPI_ANY_TAG,MPI_COMM_WORLD,&status);
-		  MPI_Recv(randomz,numberofparticle, MPI_DOUBLE_PRECISION,0,MPI_ANY_TAG,MPI_COMM_WORLD,&status);
-	  }
-	  for(int i = 0; i < numberofparticle; i++)
-	  {	
-		  potisions.push_back( makeUbTuple(randomx[i],randomy[i],randomz[i]) );
-		  //val<1>(potisions[i])= 0.506983973456;
-		  //val<2>(potisions[i]) = randomy[i];
-		  //val<3>(potisions[i]) = randomz[i];
-	  }
-	 //  UBLOG(logINFO,"Rank="<<myid<<" positions  = " <<val<1>(potisions)<< " "<<val<2>(potisions)<<" "<< val<3>(potisions));
-	 // D3Q27InterpolationProcessorPtr iProcessor2;
-     // D3Q27PathLinePostprocessorMcpart pathLine(grid, pathname + "/pathLine/pathLine", WbWriterVtkXmlASCII::getInstance(), conv, plSch, comm,potisions, nueLB, iProcessor);
-      //////////////////////////////////////////////////////////////////////////
-      //Simulation
-      //////////////////////////////////////////////////////////////////////////
-
-	  double endTime = 1000.0;
-      UbSchedulerPtr visSch(stepSch);
-      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, visSch));
-      if(myid == 0) UBLOG(logINFO,"Simulation-start");
-      calculation->calculate();
-      if(myid == 0) UBLOG(logINFO,"Simulation-end");
-
-   }
-   catch(std::exception& e)
-   {
-      cerr << e.what() << endl;
-   }
-   catch(std::string& s)
-   {
-      cerr << s << endl;
-   }
-   catch(...)
-   {
-      cerr << "unknown exception" << endl;
-   }
-
-}
+#include <iostream>
+#include <string>
+#include <map>
+#include "RefineCrossAndInsideGbObjectBlockVisitor.h"
+#include "RatioBlockVisitor.h"
+#include "RatioSmoothBlockVisitor.h"
+#include "OverlapBlockVisitor.h"
+#include "SetInterpolationDirsBlockVisitor.h"
+#include "geometry3d/GbSystem3D.h"
+#include "geometry3d/GbCuboid3D.h"
+#include "geometry3d/GbCylinder3D.h"
+#include "geometry3d/GbSphere3D.h"
+#include "BlocksPostprocessor.h"
+#include "Grid3D.h"
+#include "Patch3D.h"
+#include "Patch3DSystem.h"
+#include "Block3D.h"
+#include "LBMKernelETD3Q27Cascaded.h"
+#include "LBMKernelETD3Q27BGK.h"
+#include "CalculationManager.h" 
+#include "D3Q27SetConnectorsBlockVisitor.h" 
+#include "D3Q27ETInitDistributionsBlockVisitor.h"
+#include "D3Q27Interactor.h"
+#include "D3Q27NoSlipBCAdapter.h"
+#include "D3Q27VelocityBCAdapter.h"
+#include "D3Q27DensityBCAdapter.h"
+#include "SimulationParameters.h"
+#include "Communicator.h"
+#include "MPICommunicator.h"
+#include "SimpleGeometricPartitioner.h"
+#include "D3Q27MacroscopicQuantitiesPostprocessor.h"
+#include "D3Q27ETBCProcessor.h"
+#include "D3Q27TriFaceMeshInteractor.h"
+#include "ConfigFileReader.h"
+#include "StringUtil.hpp"
+#include "D3Q27PressureDifferencePostprocessor.h"
+#include "D3Q27IntegrateValuesHelper.h"
+#include "LBMUnitConverter.h"
+#include "NUPSCounterPostprocessor.h"
+#include "PQueuePartitioningGridVisitor.h"
+#include "SetKernelBlockVisitor.h"
+#include "GenBlocksGridVisitor.h"
+#include "D3Q27PathLinePostprocessorMcpart.h"
+#include "D3Q27SetUndefinedNodesBlockVisitor.h"
+   //
+#include "basics/writer/WbWriterVtkXmlBinary.h"
+#include "basics/writer/WbWriterVtkXmlASCII.h"
+#include "geometry3d/creator/GbTriFaceMesh3DCreator.h"
+#include "geometry3d/GbTriFaceMesh3D.h"
+#include "D3Q27System.h"
+#include <basics/transmitter/TbTransmitterMpiPool.h>
+#include "MathUtil.hpp"
+#include "D3Q27OffsetInterpolationProcessor.h"
+#include "SolidBlocksHelper.h"
+#include "MetisPartitioningGridVisitor.h"
+#include "RestartPostprocessor.h"
+#include "D3Q27IncompressibleOffsetInterpolationProcessor.h"
+#include "LBMKernelETD3Q27CCLB.h"
+#include "AverageValuesPostprocessor.h"
+#include <vfluids.h>
+using namespace std;
+
+void micropartTestQs2(const char *cstr)
+{
+   try
+   {
+      CommunicatorPtr comm(new MPICommunicator());
+      int myid = comm->getProcessID();
+      int numprocs = comm->getNumberOfProcesses();
+
+      string machine = QUOTEME(CAB_MACHINE);
+      string pathname; 
+      double availMem = 0;
+      string geoFile;
+      int numOfThreads = 1;
+
+      if(machine == "EHSAN1491") 
+      {
+         pathname = "/work/ehsan/micropart";
+         availMem = 3.0e9;
+		  int numOfThreads = 1;
+         //geoFile = "c:/Data/micropart/DK19_7_02_Martin.stl";
+         //geoFile = "c:/Data/micropart/ktoolcav.stl";
+         //geoFile = "c:/Data/micropart/boxN.stl";
+        geoFile = "C:/Users/ehsan/Desktop/meshparticles/E0019B_mit_Radien.stl";
+      }
+      else if(machine == "M01" || machine == "M02")      
+      {
+         pathname = "/work/koskuche/scratch/mcpart/out";
+         availMem = 12.0e9/8.0;
+		  geoFile = "/work/ehsan/data/E0019B_mit_Radien.stl";
+         //geoFile = "/home/koskuche/data/micropart/DK19_7_02_Martin.stl";
+
+         numOfThreads = 1;
+         if(myid ==0)
+         {
+            stringstream logFilename;
+            logFilename <<  pathname + "/logfile"+UbSystem::toString(UbSystem::getTimeStamp())+"_"+UbSystem::toString(myid)+".txt";
+            UbLog::output_policy::setStream(logFilename.str());
+         }
+      }
+      else throw UbException(UB_EXARGS, "unknown CAB_MACHINE");
+
+      UbLog::reportingLevel() = logINFO;
+      //UbLog::reportingLevel() = logDEBUG1;
+
+      int nodePerBlockX1 =16; //Anzahl an Knoten pro Block
+      int nodePerBlockX2 =16;//(int)16;
+      int nodePerBlockX3 =8;//8; //(int)16;
+
+      double bH = nodePerBlockX1;    //gewuenschte Rand- und Blockbreite
+
+      //Simulation Parameters
+      const int baseLevel = 0;
+      const int refineLevel =4;
+      //length [m]
+      double lSI = 219;//223.2;
+      //length [LB]
+      double lLB = 30;
+
+      double dx =lSI/lLB;
+
+      double left_offset = 10700;//*0.5;
+      double right_offset  = 107000;//0.5;//2*0.5
+      double front_offset = 750;//0.15;
+      double back_offset  = 750;//0.15;
+      double top_offset = 250;//0.0;
+      double bottom_offset  =750;// 70;//0.07;
+	  
+	   LBMReal vLB =0.00016103/5.0*sqrt(2.0);//0.00016103;
+       LBMReal Re;
+       LBMReal rhoLB = 0.0;
+       LBMReal nueLB = 0.0000249;//(vLB*lLB)/Re;
+       Re = (vLB*(500/dx))/nueLB;
+       double dp_Ph=200.0*100000;//
+	   double dp_lb=dp_Ph*0.001*(nueLB*dx)*(nueLB*dx);//nue_ph=10e-6 and dx is in micrometer
+      // LBMReal nueLB = 0.000016103;
+      // LBMReal Re=15000;
+      // LBMReal rhoLB = 0.0;
+      // LBMReal vLB =nueLB*Re/(500.0/dx);
+     // // Re = (vLB*(0.303/dx))/nueLB;
+	   // //Re = (vLB*lLB)/nueLB;
+	  
+      // LBMReal rhoWord = 1e-15;//kg/micrometre^3;//1000.0;
+	  // LBMReal nueRE = 1e6;//micromter^2/s;//0.000001;
+	  // LBMReal  vWorld=300*1e6;//micrometer/s;//nueRE*Re/ (lSI*4.0/9.0);
+	  LBMUnitConverterPtr conv = LBMUnitConverterPtr(new LBMUnitConverter());
+      //conv->init(lSI*1e-6,30000,rhoWord,vWorld,lLB,1.0/*rhoLB*/,vLB);
+      
+	 
+ //////////////////////////////////////////////////////////////////////////
+      GbObject3DPtr refineCube1(new  GbCuboid3D(-500.0+5.0/*-354.0*/,-957.0/*-280.0*/,-684.0/* -72.0*/, 4100/*370.0*/,957.0/*354.0*/,70.0));//-530.0,-280.0, -72.0, 530.0,354.0,70.0));
+      if(myid == 0) GbSystem3D::writeGeoObject(refineCube1.get(), pathname+"/geo/refineCube1", WbWriterVtkXmlASCII::getInstance());
+
+      GbObject3DPtr refineCube2(new  GbCuboid3D(-230.0,-90.0, -684.0/*-72.0*/, 600,100.0,70.0));
+      if(myid == 0) GbSystem3D::writeGeoObject(refineCube2.get(), pathname+"/geo/refineCube2", WbWriterVtkXmlASCII::getInstance());
+	  
+	   GbObject3DPtr refineCube3(new  GbCuboid3D(-350.0,-957.0/*-120.0*/,-684.0/*-684.0*//* -72.0*/, 1700,957.0/*120.0*/,70.0));
+      if(myid == 0) GbSystem3D::writeGeoObject(refineCube3.get(), pathname+"/geo/refineCube3", WbWriterVtkXmlASCII::getInstance());
+	  
+	   GbObject3DPtr refineCube4(new  GbCuboid3D(-170.0,-60.0, -684.0/*-72.0*/, 200,60.0,70.0));
+      if(myid == 0) GbSystem3D::writeGeoObject(refineCube4.get(), pathname+"/geo/refineCube4", WbWriterVtkXmlASCII::getInstance());
+	  
+	   GbObject3DPtr refineCubeInlet(new  GbCuboid3D(-10600.0,-600.0, -600.0/*-72.0*/, -9000,600.0,60.0));
+      if(myid == 0) GbSystem3D::writeGeoObject(refineCubeInlet.get(), pathname+"/geo/refineCubeInlet", WbWriterVtkXmlASCII::getInstance());
+	  
+	  GbObject3DPtr refineCubeOutlet(new  GbCuboid3D(9000,-600.0, -600.0/*-72.0*/,10550.0 ,600.0,60.0));
+      if(myid == 0) GbSystem3D::writeGeoObject(refineCubeOutlet.get(), pathname+"/geo/refineCubeOutlet", WbWriterVtkXmlASCII::getInstance());
+      //////////////////////////////////////////////////////////////////////////
+      D3Q27TriFaceMeshInteractorPtr geoInt;
+	  /////////////////
+      //Grid3DPtr grid(new Grid3D());
+        Grid3DPtr grid(new Grid3D(comm));
+
+      UbSchedulerPtr rSch(new UbScheduler());
+      rSch->addSchedule(100, 200, 20000);
+      RestartPostprocessorPtr rp(new RestartPostprocessor(grid, rSch, comm, pathname+"/checkpoints", RestartPostprocessor::BINARY));
+
+      std::string opt;
+         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
+
+      if(cstr!= NULL)
+         opt = std::string(cstr);
+
+      if/*(cstr== NULL)*/(cstr!= NULL)
+      {
+         if(myid==0) UBLOG(logINFO,"Restart step: " << opt);
+         grid = rp->restart(UbSystem::stringTo<int>(opt));
+         rp->reconnect(grid);
+
+         // SetForcingBlockVisitor forcingVisitor(0.0, 0.0, 0.0);
+         // grid->accept(forcingVisitor);
+
+         //D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
+         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
+         grid->accept( setConnsVisitor );
+		  if(myid==0) UBLOG(logINFO,"Restart finish: " << opt);
+	 
+      }
+      else
+      {
+         if(myid ==0)
+         {
+            UBLOG(logINFO,"L = " <<lLB );
+            UBLOG(logINFO,"v = " <<vLB );
+            UBLOG(logINFO,"rho = " <<rhoLB );
+            UBLOG(logINFO,"nue = " << nueLB );
+			UBLOG(logINFO,"dx = " << dx );
+            UBLOG(logINFO,"Re = " << Re );
+			 UBLOG(logINFO,"dp_lb = " << dp_lb );
+            UBLOG(logINFO,"Preprozess - start");
+         }
+
+
+         ////////////////////////////////////////////////////////////////////////
+         //Grid
+         //////////////////////////////////////////////////////////////////////////
+         grid->setDeltaX(dx);
+         grid->setBlockNX(nodePerBlockX1, nodePerBlockX2, nodePerBlockX3);
+
+         ////////////////////////////////////////////////////////////////////////////
+         //// Geometrie
+         ////////////////////////////////////////////////////////////////////////////
+         GbTriFaceMesh3DPtr geo (GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(geoFile,"geo"));
+
+         if(myid == 0) GbSystem3D::writeGeoObject(geo.get(), pathname+"/geo/geo", WbWriterVtkXmlASCII::getInstance());
+
+         ////////////////////////////////////////////////////////////////////////////
+         //// Randgeometrien erstellen
+         ////////////////////////////////////////////////////////////////////////////
+         double shiftForMG=grid->getDeltaX(refineLevel)*nodePerBlockX1 / 3.0*2.0;
+          GbCuboid3DPtr plate1  = GbCuboid3DPtr( new GbCuboid3D( -7.5, -1.515e-1, -6.831e-2, 7.5, 1.515e-1, 0.0 ));
+
+           GbCuboid3DPtr plate2  = GbCuboid3DPtr( new GbCuboid3D( -1.5e-1, -16.51e-1, -16.831e-2, 1.5e-1, -1.6e-2, 1.0 ));
+           GbCuboid3DPtr plate3  = GbCuboid3DPtr( new GbCuboid3D( -1.5e-1, 1.6e-2, -16.831e-2, 1.5e-1, 16.515e-1, 1.0 ));
+
+          // GbCuboid3DPtr plate1_1  = GbCuboid3DPtr( new GbCuboid3D( -7.5, -2.515e-1, -1.0e-1, 7.5, 2.515e-1, -6.831e-2 ));
+          // GbCuboid3DPtr plate1_2  = GbCuboid3DPtr( new GbCuboid3D( -7.5, -2.515e-1, -0.0000001, 7.5, 2.515e-1, 1.0e-1 ));
+          // GbCuboid3DPtr plate1_3  = GbCuboid3DPtr( new GbCuboid3D( -7.5, 1.515e-1, -6.831e-2, 7.5, 2.515e-1, 0.0  ));
+          // GbCuboid3DPtr plate1_4  = GbCuboid3DPtr( new GbCuboid3D( -7.5, -2.515e-1, 0.0, 7.5, -1.515e-1, -1.0e-1 ));
+
+          // GbCuboid3DPtr inflow  = GbCuboid3DPtr( new GbCuboid3D( -8.0, -1.0, -1.0, -7.5, 1.0, 1.0 ));
+          // GbCuboid3DPtr outflow = GbCuboid3DPtr( new GbCuboid3D( 7.5, -1.0, -1.0, 8.0, 1.0, 1.0 ));
+		  
+		   // GbCuboid3DPtr plate2  = GbCuboid3DPtr( new GbCuboid3D( -1.5e-1, -16.51e-1, -16.831e-2, 1.5e-1, -1.6e-2, 1.0 ));
+          // GbCuboid3DPtr plate3  = GbCuboid3DPtr( new GbCuboid3D( -1.5e-1, 1.6e-2, -16.831e-2, 1.5e-1, 16.515e-1, 1.0 ));
+
+          // GbCuboid3DPtr plate1_1  = GbCuboid3DPtr( new GbCuboid3D( -left_offset-bH*dx, back_offset, -bottom_offset-bH*dx, right_offset+bH*dx, back_offset+bH*dx, top_offset+bH*dx ));
+          // GbCuboid3DPtr plate1_2  = GbCuboid3DPtr( new GbCuboid3D( -left_offset-bH*dx, -front_offset-bH*dx, -bottom_offset-bH*dx, right_offset+bH*dx, -front_offset, top_offset+bH*dx ));
+          // GbCuboid3DPtr plate1_3  = GbCuboid3DPtr( new GbCuboid3D( -left_offset-bH*dx, -front_offset-bH*dx, top_offset, right_offset+bH*dx, back_offset+bH*dx, top_offset+bH*dx+2.0*dx ));
+          // GbCuboid3DPtr plate1_4  = GbCuboid3DPtr( new GbCuboid3D( -left_offset-bH*dx, -front_offset-bH*dx, -bottom_offset-bH*dx, right_offset+bH*dx, back_offset+bH*dx, -bottom_offset ));
+
+          //GbCuboid3DPtr inflow  = GbCuboid3DPtr( new GbCuboid3D( -left_offset-5*bH*dx, -front_offset-5*bH*dx, -bottom_offset-5*bH*dx, -left_offset, back_offset+5*bH*dx, top_offset+5*bH*dx ));
+          //GbCuboid3DPtr outflow = GbCuboid3DPtr( new GbCuboid3D( right_offset, -front_offset-5*bH*dx, -bottom_offset-5*bH*dx, right_offset+5.0*bH*dx, back_offset+5*bH*dx, top_offset+5*bH*dx ));
+		  GbCuboid3DPtr inflow  = GbCuboid3DPtr( new GbCuboid3D( -11000.0,-600.0, -600.0, -9000.0, 600.0, -500 ));
+		  GbCuboid3DPtr outflow = GbCuboid3DPtr( new GbCuboid3D( 9000,-600.0, -600.0, 11000.0, 600.0, -500));
+
+
+		   GbObject3DPtr gridCube(new GbCuboid3D(-10700.0/*inflow->getX1Maximum()-4.0*dx/*.5*shiftForMG*/,-550.0/*-270*/ , -550.0/*-70*/,
+                                                10700.0/*outflow->getX1Minimum()+4.0*dx/*.5*shiftForMG*/, 
+                                                550.0/*270*/, 
+                                                23.0/*10.0*/));
+
+         GenBlocksGridVisitor genBlocks;
+         genBlocks.addGeoObject(gridCube);
+         grid->accept(genBlocks);
+		  
+         if(myid == 0)
+         {
+            GbSystem3D::writeGeoObject(gridCube.get(),pathname+"/geo/gridCube", WbWriterVtkXmlASCII::getInstance());
+            //GbSystem3D::writeGeoObject(plate2.get(),pathname+"/geo/plate2", WbWriterVtkXmlASCII::getInstance());
+            //GbSystem3D::writeGeoObject(plate3.get(),pathname+"/geo/plate3", WbWriterVtkXmlASCII::getInstance());
+
+            // GbSystem3D::writeGeoObject(plate1_1.get(),pathname+"/geo/plate1_1", WbWriterVtkXmlASCII::getInstance());
+            // GbSystem3D::writeGeoObject(plate1_2.get(),pathname+"/geo/plate1_2", WbWriterVtkXmlASCII::getInstance());
+            // GbSystem3D::writeGeoObject(plate1_3.get(),pathname+"/geo/plate1_3", WbWriterVtkXmlASCII::getInstance());
+            // GbSystem3D::writeGeoObject(plate1_4.get(),pathname+"/geo/plate1_4", WbWriterVtkXmlASCII::getInstance());
+
+            GbSystem3D::writeGeoObject(inflow.get(),pathname+"/geo/inflow", WbWriterVtkXmlASCII::getInstance());
+            GbSystem3D::writeGeoObject(outflow.get(),pathname+"/geo/outflow", WbWriterVtkXmlASCII::getInstance());
+         }
+   
+
+         if (refineLevel > 0)
+         {
+		  if(myid == 0) UBLOG(logINFO,"Refinement - start");   
+            RefineCrossAndInsideGbObjectHelper refineHelper(grid, refineLevel);
+            refineHelper.addGbObject(refineCube1, 1);
+            refineHelper.addGbObject(refineCube3, 2);
+			 refineHelper.addGbObject(refineCube2, 3);
+			 refineHelper.addGbObject(refineCube4, 4);
+			 
+			 refineHelper.addGbObject(refineCubeInlet, 1);
+			 refineHelper.addGbObject(refineCubeOutlet, 1);
+            refineHelper.refine();
+            if(myid == 0) UBLOG(logINFO,"Refinement - end");   
+		 
+		 
+           // RefineCrossAndInsideGbObjectBlockVisitor refVisitor1(refineCube1, refineLevel-4);
+            // grid->accept(refVisitor1);
+
+			// RefineCrossAndInsideGbObjectBlockVisitor refVisitor3(refineCube3, refineLevel-3);
+            // grid->accept(refVisitor3);
+
+            // RefineCrossAndInsideGbObjectBlockVisitor refVisitor2(refineCube2, refineLevel-2);
+            // grid->accept(refVisitor2);
+			
+			 // RefineCrossAndInsideGbObjectBlockVisitor refVisitor4(refineCube4, refineLevel-1);
+            // grid->accept(refVisitor4);
+
+            // RatioBlockVisitor ratioVisitor(refineLevel);
+            // grid->accept(ratioVisitor);
+
+            // RatioSmoothBlockVisitor ratioSmoothVisitor(refineLevel);
+            // grid->accept(ratioSmoothVisitor);
+
+            // OverlapBlockVisitor overlapVisitor(refineLevel);
+            // grid->accept(overlapVisitor);
+
+            // std::vector<int> dirs;
+            // D3Q27System::getLBMDirections(dirs);
+            // SetInterpolationDirsBlockVisitor interDirsVisitor(dirs);
+            // grid->accept(interDirsVisitor);
+            // if(myid == 0) UBLOG(logINFO,"Refinement - end");	
+         }
+
+         //////////////////////////////////////////////////////////////////////////
+         //INTERAKTOREN SETZEN (=Randbedingungen)
+         //////////////////////////////////////////////////////////////////////////
+         //oben/unten = Haftrand
+         int bbOption = 1; //0=simple Bounce Back, 1=quadr. BB
+         D3Q27BoundaryConditionAdapterPtr bcObst(new D3Q27NoSlipBCAdapter(bbOption));
+         geoInt = D3Q27TriFaceMeshInteractorPtr( new D3Q27TriFaceMeshInteractor(geo, grid, D3Q27BoundaryConditionAdapterPtr(new D3Q27NoSlipBCAdapter(bbOption)),Interactor3D::INVERSESOLID, Interactor3D::SIMPLE));
+	     geoInt->setUseHalfSpaceCheck(true);
+         geoInt->setRegardPointInObjectTest(true);
+         if(myid == 0) UBLOG(logINFO,"stl - end"); 
+         //D3Q27InteractorPtr plate1Int(new D3Q27Interactor(plate1, grid, bcObst,Interactor3D::INVERSESOLID));
+         // D3Q27InteractorPtr plate2Int(new D3Q27Interactor(plate2, grid, bcObst,Interactor3D::SOLID));
+         // D3Q27InteractorPtr plate3Int(new D3Q27Interactor(plate3, grid, bcObst,Interactor3D::SOLID));
+
+         // D3Q27InteractorPtr plate1_1Int(new D3Q27Interactor(plate1_1, grid, bcObst,Interactor3D::SOLID));
+         // D3Q27InteractorPtr plate1_2Int(new D3Q27Interactor(plate1_2, grid, bcObst,Interactor3D::SOLID));
+         // D3Q27InteractorPtr plate1_3Int(new D3Q27Interactor(plate1_3, grid, bcObst,Interactor3D::SOLID));
+         // D3Q27InteractorPtr plate1_4Int(new D3Q27Interactor(plate1_4, grid, bcObst,Interactor3D::SOLID));
+
+         //links: geschwindigkeits-einfluss
+         //Velocity-BC
+         //////////////////////////////////////////////////////////////////////////
+         mu::Parser fct;
+         fct.DefineConst("vx1"  , vLB*9.0/4.0 );
+         //fct = MathUtil::getDuctParaboloidX(0, 250*2.0, -51.08/2, 51.08, vLB*9.0/4.0);
+         fct.SetExpr("vx1");
+         //////////////////////////////////////////////////////////////////////////
+
+         //////////////////////////////////////////////////////////////////////////
+            // D3Q27BoundaryConditionAdapterPtr velBCAdapter = D3Q27BoundaryConditionAdapterPtr(new D3Q27VelocityBCAdapter (false, false ,true ,fct, 0, D3Q27BCFunction::INFCONST));
+            // velBCAdapter->setSecondaryBcOption(2);
+            // D3Q27InteractorPtr inflowInt  = D3Q27InteractorPtr( new D3Q27Interactor(inflow, grid, velBCAdapter, Interactor3D::SOLID));
+
+		 D3Q27BoundaryConditionAdapterPtr denBCAdapterInlet(new D3Q27DensityBCAdapter(3.0*(dp_lb-rhoLB)));
+        denBCAdapterInlet->setSecondaryBcOption(1);
+        D3Q27InteractorPtr inflowInt = D3Q27InteractorPtr( new D3Q27Interactor(inflow, grid, denBCAdapterInlet,Interactor3D::SOLID));
+		 
+         //rechts: druckrand
+         //Density-BC
+         //fuer Kompressibles Modell  rho = 1.0
+         D3Q27BoundaryConditionAdapterPtr denBCAdapter(new D3Q27DensityBCAdapter(rhoLB));
+         denBCAdapter->setSecondaryBcOption(1);
+         D3Q27InteractorPtr outflowInt = D3Q27InteractorPtr( new D3Q27Interactor(outflow, grid, denBCAdapter,Interactor3D::SOLID));
+
+         MetisPartitioningGridVisitor metisVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B);
+         grid->accept( metisVisitor );
+         
+         BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname + "/grid/blocks", WbWriterVtkXmlBinary::getInstance(), comm));
+         if(myid == 0) ppblocks->update(0);
+         
+         SolidBlocksHelper sd(grid, comm);
+         sd.addInteractor(geoInt);
+         sd.addInteractor(inflowInt);
+         sd.addInteractor(outflowInt);
+         // sd.addInteractor(plate1_1Int);
+         // sd.addInteractor(plate1_2Int);
+         // sd.addInteractor(plate1_3Int);
+         // sd.addInteractor(plate1_4Int);
+         // sd.addInteractor(plate2Int);
+         // sd.addInteractor(plate3Int);
+		   if(myid == 0) UBLOG(logINFO,"line"<<__LINE__); 
+         sd.deleteSolidBlocks();     
+         if(myid == 0) UBLOG(logINFO,"line"<<__LINE__); 
+         grid->accept( metisVisitor );
+         if(myid == 0) UBLOG(logINFO,"line"<<__LINE__);
+
+         sd.setTransBlocks();
+         if(myid == 0) UBLOG(logINFO,"line"<<__LINE__);
+         //BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname + "/grid/blocks", WbWriterVtkXmlBinary::getInstance(), comm));
+         if(myid == 0) ppblocks->update(1);
+         if(myid == 0) ppblocks.reset();
+
+         unsigned long nob = grid->getNumberOfBlocks();
+         int gl = 3;
+         unsigned long nod_temp = nob * (nodePerBlockX1+gl) * (nodePerBlockX2+gl) * (nodePerBlockX3+gl);
+         unsigned long nod = nob * (nodePerBlockX1) * (nodePerBlockX2) * (nodePerBlockX3);
+         double needMemAll  = double(nod_temp*(27*sizeof(double) + sizeof(int) + sizeof(float)*4));
+         double needMem  = needMemAll / double(comm->getNumberOfProcesses());
+
+
+         if(myid == 0)
+         {
+            UBLOG(logINFO,"Number of blocks = " << nob);
+            UBLOG(logINFO,"Number of nodes  = " << nod);
+            UBLOG(logINFO,"Necessary memory  = " << needMemAll  << " bytes");
+            UBLOG(logINFO,"Necessary memory per process = " << needMem  << " bytes");
+            UBLOG(logINFO,"Available memory per process = " << availMem << " bytes");
+         }  
+
+         //LBMKernel3DPtr kernel(new LBMKernelETD3Q27Cascaded(nodePerBlockX1, nodePerBlockX2, nodePerBlockX2));
+         //LBMKernel3DPtr kernel(new LBMKernelETD3Q27CCLB(nodePerBlockX1, nodePerBlockX2, nodePerBlockX2));
+
+		  int option = 0;
+		 LBMKernel3DPtr kernel(new LBMKernelETD3Q27CCLB(nodePerBlockX1, nodePerBlockX2, nodePerBlockX3,option));
+
+		 
+		 
+         BCProcessorPtr bcProc(new D3Q27ETBCProcessor());
+         kernel->setBCProcessor(bcProc);
+
+         SetKernelBlockVisitor kernelVisitor(kernel, nueLB, availMem, needMem);
+         grid->accept(kernelVisitor);
+
+         if (refineLevel > 0)
+         {
+            D3Q27SetUndefinedNodesBlockVisitor undefNodesVisitor;
+            grid->accept(undefNodesVisitor);
+         }
+		 
+		  if(myid == 0) UBLOG(logINFO,"intractor - start"); 
+          //inflow
+         grid->addAndInitInteractor(inflowInt);
+
+         //outflow
+         grid->addAndInitInteractor(outflowInt);
+         //canal
+         grid->addAndInitInteractor(geoInt);
+         // grid->addAndInitInteractor(plate1_1Int);
+         // grid->addAndInitInteractor(plate1_2Int);
+         // grid->addAndInitInteractor(plate1_3Int);
+         // grid->addAndInitInteractor(plate1_4Int);
+         // grid->addAndInitInteractor(plate2Int);
+         // grid->addAndInitInteractor(plate3Int);
+
+       
+
+         //////////////////////////////////////////////////////////////////////////
+         //connectoren setzen:
+
+         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
+         grid->accept( setConnsVisitor );
+         //////////////////////////////////////////////////////////////////////////	 
+         //domain decomposition
+         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
+         grid->accept(pqPartVisitor);
+			 
+         //////////////////////////////////////////////////////////////////////////     
+	   //Stroemungsfeld initialisieren
+         //////////////////////////////////////////////////////////////////////////
+         D3Q27ETInitDistributionsBlockVisitor initVisitor(rhoLB); //1.0
+         initVisitor.setVx1(0); 
+         grid->accept(initVisitor);
+
+         if(myid == 0)
+         {
+            //Abst�nde "q" als Linien rausschreiben
+            std::vector< UbTupleFloat3 > nodes;
+            std::vector< UbTupleInt2 >   lines;
+            geoInt->addQsLineSet(nodes, lines);
+            WbWriterVtkXmlBinary::getInstance()->writeLines(pathname+"/grid/qs",nodes,lines);
+         }
+
+          if(myid == 0) UBLOG(logINFO,"Preprozess - end");
+		 
+		 	  ////////////////////////
+           //Set Postprozessors
+           //////////////////////////////////////////////////////////////////////////
+           {
+            UbSchedulerPtr geoSch(new UbScheduler(1));
+            D3Q27MacroscopicQuantitiesPostprocessor ppgeo(grid,geoSch, pathname + "/grid/nodes", WbWriterVtkXmlBinary::getInstance(), conv,  comm, true);
+            grid->doPostProcess(0);
+           }
+	    
+
+      }
+
+      //////////////////////////////////////////////////////////////////////////
+	   // UbSchedulerPtr visSchAv(new UbScheduler());
+		UbSchedulerPtr visSchAv(new UbScheduler(100,100));
+      // visSchAv->addSchedule(100,10,1000);
+      // UbSchedulerPtr resSchAv(new UbScheduler());
+	   UbSchedulerPtr resSchAv(new UbScheduler(100,100));
+      // resSchAv->addSchedule(20,20,1000);
+      AverageValuesPostprocessor       Avpp(grid,  pathname + "/Turbulence/stepAV", WbWriterVtkXmlBinary::getInstance(), visSchAv/*wann wird rausgeschrieben*/,resSchAv/*wann wird resettet*/,comm);
+	  
+	   D3Q27ShearStressPostprocessor  shear(grid,  pathname + "/shear/step", WbWriterVtkXmlBinary::getInstance(), visSchAv/*wann wird rausgeschrieben*/,resSchAv/*wann wird resettet*/,comm,iProcessor); 
+	   //D3Q27ShearStressPostprocessor  shear(grid,  pathname + "/shear/step", WbWriterVtkXmlBinary::getInstance(), visSchAv/*wann wird rausgeschrieben*/,resSchAv/*wann wird resettet*/,comm);
+	   shear.addInteractor(geoInt);
+	   ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+	  
+
+      UbSchedulerPtr nupsSch(new UbScheduler(1, 5, 10));
+      NUPSCounterPostprocessor npr(grid, nupsSch, pathname + "/results/nups.txt", comm);
+
+      double outTime = 100.0;
+      UbSchedulerPtr stepSch(new UbScheduler(outTime));
+      D3Q27MacroscopicQuantitiesPostprocessor pp(grid,stepSch, pathname + "/steps/step", WbWriterVtkXmlBinary::getInstance(), conv,  comm);
+      //////////////////////////////////////////////////////////////////////////
+      //PathLine
+       UbSchedulerPtr plSch(new UbScheduler(5000, 5000));
+      const int numberofparticle=20;
+	
+	  std::vector<UbTupleDouble3 > potisions;
+	  double randomx[numberofparticle];
+	  double randomy[numberofparticle];
+	  double randomz[numberofparticle];
+	  double lowestx,highestx,lowesty,highesty,lowestz,highestz;
+	  if(myid==0)
+	  {
+		  for(int i = 0; i < numberofparticle; i++)
+		  {
+			  double random; 
+	        lowestx =-10300.0;  lowesty =-230;          lowestz =-250;
+	        highestx=-9792.0;  highesty=-330;          highestz=-250; 
+		  
+	      double rangex=(highestx-lowestx),rangey=(highesty-lowesty),rangez=(highestz-lowestz);	
+           randomx[i] = lowestx+(rangex*rand()/(RAND_MAX + 1.0));
+		   randomy[i] = lowesty+(rangey*rand()/(RAND_MAX + 1.0));
+	       randomz[i] = lowestz+(rangez*rand()/(RAND_MAX + 1.0));
+		  //val<1>(potisions[i])= 0.506983973456;
+		  //val<2>(potisions[i]) = lowesty+(rangey*rand()/(RAND_MAX + 1.0));
+		   //val<3>(potisions[i]) = lowestz+(rangez*rand()/(RAND_MAX + 1.0));
+		  }
+		  for (int i=0;i<comm->getNumberOfProcesses();i++)
+		  {
+			  if (i!=0)
+			  {
+			      MPI_Send(randomx,numberofparticle, MPI_DOUBLE_PRECISION,i,i,MPI_COMM_WORLD);
+				  MPI_Send(randomy,numberofparticle, MPI_DOUBLE_PRECISION,i,i,MPI_COMM_WORLD);
+				  MPI_Send(randomz,numberofparticle, MPI_DOUBLE_PRECISION,i,i,MPI_COMM_WORLD);
+			  }
+		  }
+	  }
+	  if (myid!=0)
+	  {
+		  MPI_Status status; 
+		  MPI_Recv(randomx,numberofparticle, MPI_DOUBLE_PRECISION,0,MPI_ANY_TAG,MPI_COMM_WORLD,&status);
+		  MPI_Recv(randomy,numberofparticle, MPI_DOUBLE_PRECISION,0,MPI_ANY_TAG,MPI_COMM_WORLD,&status);
+		  MPI_Recv(randomz,numberofparticle, MPI_DOUBLE_PRECISION,0,MPI_ANY_TAG,MPI_COMM_WORLD,&status);
+	  }
+	  for(int i = 0; i < numberofparticle; i++)
+	  {	
+		  potisions.push_back( makeUbTuple(randomx[i],randomy[i],randomz[i]) );
+		  //val<1>(potisions[i])= 0.506983973456;
+		  //val<2>(potisions[i]) = randomy[i];
+		  //val<3>(potisions[i]) = randomz[i];
+	  }
+	 //  UBLOG(logINFO,"Rank="<<myid<<" positions  = " <<val<1>(potisions)<< " "<<val<2>(potisions)<<" "<< val<3>(potisions));
+	 // D3Q27InterpolationProcessorPtr iProcessor2;
+     // D3Q27PathLinePostprocessorMcpart pathLine(grid, pathname + "/pathLine/pathLine", WbWriterVtkXmlASCII::getInstance(), conv, plSch, comm,potisions, nueLB, iProcessor);
+      //////////////////////////////////////////////////////////////////////////
+      //Simulation
+      //////////////////////////////////////////////////////////////////////////
+
+	  double endTime = 1000.0;
+      UbSchedulerPtr visSch(stepSch);
+      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, visSch));
+      if(myid == 0) UBLOG(logINFO,"Simulation-start");
+      calculation->calculate();
+      if(myid == 0) UBLOG(logINFO,"Simulation-end");
+
+   }
+   catch(std::exception& e)
+   {
+      cerr << e.what() << endl;
+   }
+   catch(std::string& s)
+   {
+      cerr << s << endl;
+   }
+   catch(...)
+   {
+      cerr << "unknown exception" << endl;
+   }
+
+}
diff --git a/apps/cpu/micropart/micropartTestQs3.hpp b/apps/cpu/micropart/micropartTestQs3.hpp
index 9bf5aaa9ea3bdb5d81dd4e1a2f45540ff572bff2..11fe1c802e128e5cd36349694de084f7623125f0 100644
--- a/apps/cpu/micropart/micropartTestQs3.hpp
+++ b/apps/cpu/micropart/micropartTestQs3.hpp
@@ -1,560 +1,560 @@
-#include <iostream>
-#include <string>
-#include <map>
-
-#include <vfluids.h>
-using namespace std;
-
-void micropartTestQs3(const char *cstr)
-{
-   try
-   {
-      CommunicatorPtr comm = MPICommunicator::getInstance();
-      int myid = comm->getProcessID();
-      int numprocs = comm->getNumberOfProcesses();
-
-      string machine = QUOTEME(CAB_MACHINE);
-      string pathname; 
-      double availMem = 0;
-      string geoFile;
-      int numOfThreads = 1;
-
-      if(machine == "BOMBADIL") 
-      {
-         pathname = "d:/temp/micropart";
-         availMem = 1.0e9;
-         int numOfThreads = 1;
-         geoFile = "d:/Data/micropart/E0019B_mit_Radien.stl";
-      }
-      else if(machine == "M01" || machine == "M02")      
-      {
-         // pathname = "/work/koskuche/scratch/mcpart/out";
-         pathname = "/work/ehsan/orifice";
-         availMem = 12.0e9;
-         geoFile = "d:/Data/micropart/E0019B_mit_Radien.stl";
-         //geoFile = "/home/koskuche/data/micropart/DK19_7_02_Martin.stl";
-
-         numOfThreads = 1;
-         if(myid ==0)
-         {
-            stringstream logFilename;
-            logFilename <<  pathname + "/logfile"+UbSystem::toString(UbSystem::getTimeStamp())+"_"+UbSystem::toString(myid)+".txt";
-            UbLog::output_policy::setStream(logFilename.str());
-         }
-      }
-      else throw UbException(UB_EXARGS, "unknown CAB_MACHINE");
-
-      UbLog::reportingLevel() = logINFO;
-      //UbLog::reportingLevel() = logDEBUG1;
-
-      int nodePerBlockX1 =16; //Anzahl an Knoten pro Block
-      int nodePerBlockX2 =16;//(int)16;
-      int nodePerBlockX3 =16;//8; //(int)16;
-
-      double bH = nodePerBlockX1;    //gewuenschte Rand- und Blockbreite
-
-
-      //Simulation Parameters
-      const int baseLevel = 0;
-      const int refineLevel = 5;
-      //length [m]
-      double lSI =217.35;// 216.75;//223.2;
-      //length [LB]
-      double lLB = 30;
-
-      double dx =10;//lSI/lLB;
-
-      double left_offset = 10700;//*0.5;
-      double right_offset  = 107000;//0.5;//2*0.5
-      double front_offset = 750;//0.15;
-      double back_offset  = 750;//0.15;
-      double top_offset = 250;//0.0;
-      double bottom_offset  =750;// 70;//0.07;
-
-      LBMReal vLB =0.00016103/5.0*sqrt(2.0);//0.00016103;
-      LBMReal Re;
-      LBMReal rhoLB = 0.0;
-      LBMReal nueLB = 0.0000249;//(vLB*lLB)/Re;
-      Re = (vLB*(500/dx))/nueLB;
-      double dp_Ph=200.0*100000;//
-      //double dp_lb=dp_Ph*0.001*(nueLB)*(nueLB);//nue_ph=10e-6 and dx is in micrometer
-      LBMReal nue_Ph = 1e-6;//
-      double dt=/*(nue_Ph/nueLB)*/(nueLB/nue_Ph)*(dx*1e-6)*(dx*1e-6);//dt=nu_lb/nu_ph*dx*dx;//nue_ph=10e-6;dx is in micrometer;
-      double dp_lb=dp_Ph/1000*(dt*dt)/((dx*1e-6)*(dx*1e-6));//dp_lb=dp_ph/rho_ph*dt*dt/dx/dx
-      // LBMReal nueLB = 0.000016103;
-      // LBMReal Re=15000;
-      // LBMReal rhoLB = 0.0;
-      // LBMReal vLB =nueLB*Re/(500.0/dx);
-      // // Re = (vLB*(0.303/dx))/nueLB;
-      // //Re = (vLB*lLB)/nueLB;
-
-      // LBMReal rhoWord = 1e-15;//kg/micrometre^3;//1000.0;
-      // LBMReal nueRE = 1e6;//micromter^2/s;//0.000001;
-      // LBMReal  vWorld=300*1e6;//micrometer/s;//nueRE*Re/ (lSI*4.0/9.0);
-      LBMUnitConverterPtr conv = LBMUnitConverterPtr(new LBMUnitConverter());
-      //conv->init(lSI*1e-6,30000,rhoWord,vWorld,lLB,1.0/*rhoLB*/,vLB); 
-
-      //////////////////////////////////////////////////////////////////////////
-      GbObject3DPtr refineCube1(new  GbCuboid3D(-500.0+5.0/*-354.0*/,-957.0/*-280.0*/,-684.0/* -72.0*/, 4100/*370.0*/,957.0/*354.0*/,70.0));//-530.0,-280.0, -72.0, 530.0,354.0,70.0));
-      if(myid == 0) GbSystem3D::writeGeoObject(refineCube1.get(), pathname+"/geo/refineCube1", WbWriterVtkXmlASCII::getInstance());
-
-      GbObject3DPtr refineCube2(new  GbCuboid3D(-280.0,-957.0/*-120.0*/,-684.0/*-684.0*//* -72.0*/, 500,957.0/*120.0*/,70.0));
-      if(myid == 0) GbSystem3D::writeGeoObject(refineCube2.get(), pathname+"/geo/refineCube2", WbWriterVtkXmlASCII::getInstance());
-
-      GbObject3DPtr refineCube3(new  GbCuboid3D(-350.0,-957.0/*-120.0*/,-684.0/*-684.0*//* -72.0*/, 1700,957.0/*120.0*/,70.0));
-      if(myid == 0) GbSystem3D::writeGeoObject(refineCube3.get(), pathname+"/geo/refineCube3", WbWriterVtkXmlASCII::getInstance());
-
-      GbObject3DPtr refineCube4(new  GbCuboid3D(-230.0,-150.0/*-120.0*/,-684.0, 225,150,957.0));
-      if(myid == 0) GbSystem3D::writeGeoObject(refineCube4.get(), pathname+"/geo/refineCube4", WbWriterVtkXmlASCII::getInstance());
-
-      GbObject3DPtr refineCube5up(new  GbCuboid3D(-147.0,-50,-5.0, 0.0,50.0,957.0));
-      if(myid == 0) GbSystem3D::writeGeoObject(refineCube5up.get(), pathname+"/geo/refineCube5up", WbWriterVtkXmlASCII::getInstance());
-
-      GbObject3DPtr refineCube5down(new  GbCuboid3D(-147.0,-50,-46.0, 0,50,-957.0));
-      if(myid == 0) GbSystem3D::writeGeoObject(refineCube5down.get(), pathname+"/geo/refineCube5down", WbWriterVtkXmlASCII::getInstance());
-
-      GbObject3DPtr refineCubeInlet(new  GbCuboid3D(-10600.0,-600.0, -600.0/*-72.0*/, -8000,600.0,60.0));
-      if(myid == 0) GbSystem3D::writeGeoObject(refineCubeInlet.get(), pathname+"/geo/refineCubeInlet", WbWriterVtkXmlASCII::getInstance());
-
-      GbObject3DPtr refineCubeOutlet(new  GbCuboid3D(8000,-600.0, -600.0/*-72.0*/,10550.0 ,600.0,60.0));
-      if(myid == 0) GbSystem3D::writeGeoObject(refineCubeOutlet.get(), pathname+"/geo/refineCubeOutlet", WbWriterVtkXmlASCII::getInstance());
-      //////////////////////////////////////////////////////////////////////////
-      D3Q27TriFaceMeshInteractorPtr geoInt;
-      /////////////////
-      //Grid3DPtr grid(new Grid3D());
-      Grid3DPtr grid(new Grid3D(comm));
-
-      UbSchedulerPtr rSch(new UbScheduler());
-      rSch->addSchedule(50000, 50000, 1000000000);
-      RestartPostprocessorPtr rp(new RestartPostprocessor(grid, rSch, comm, pathname+"/checkpoints", RestartPostprocessor::BINARY));
-
-      std::string opt;
-      D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
-
-      if(cstr!= NULL)
-         opt = std::string(cstr);
-
-      if/*(cstr== NULL)*/(cstr!= NULL)
-      {
-         if(myid==0) UBLOG(logINFO,"Restart step: " << opt);
-         grid = rp->restart(UbSystem::stringTo<int>(opt));
-         rp->reconnect(grid);
-
-         // SetForcingBlockVisitor forcingVisitor(0.0, 0.0, 0.0);
-         // grid->accept(forcingVisitor);
-
-         //D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
-         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
-         grid->accept( setConnsVisitor );
-         if(myid==0) UBLOG(logINFO,"Restart finish: " << opt);
-
-      }
-      else
-      {
-         if(myid ==0)
-         {
-            UBLOG(logINFO,"L = " <<lLB );
-            UBLOG(logINFO,"v = " <<vLB );
-            UBLOG(logINFO,"rho = " <<rhoLB );
-            UBLOG(logINFO,"nue = " << nueLB );
-            UBLOG(logINFO,"dx = " << dx );
-            UBLOG(logINFO,"Re = " << Re );
-            UBLOG(logINFO,"dt = " << dt );
-            UBLOG(logINFO,"dp_lb = " << dp_lb );
-            UBLOG(logINFO,"refineLevel = " << refineLevel );
-            UBLOG(logINFO,"Preprozess - start");
-         }
-
-
-         ////////////////////////////////////////////////////////////////////////
-         //Grid
-         //////////////////////////////////////////////////////////////////////////
-         grid->setDeltaX(dx);
-         grid->setBlockNX(nodePerBlockX1, nodePerBlockX2, nodePerBlockX3);
-
-         ////////////////////////////////////////////////////////////////////////////
-         //// Geometrie
-         ////////////////////////////////////////////////////////////////////////////
-         GbTriFaceMesh3DPtr geo (GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(geoFile,"geo"));
-
-         if(myid == 0) GbSystem3D::writeGeoObject(geo.get(), pathname+"/geo/geo", WbWriterVtkXmlASCII::getInstance());
-
-         ////////////////////////////////////////////////////////////////////////////
-         //// Randgeometrien erstellen
-         ////////////////////////////////////////////////////////////////////////////
-         double shiftForMG=grid->getDeltaX(refineLevel)*nodePerBlockX1 / 3.0*2.0;
-         GbCuboid3DPtr plate1  = GbCuboid3DPtr( new GbCuboid3D( -7.5, -1.515e-1, -6.831e-2, 7.5, 1.515e-1, 0.0 ));
-
-         GbCuboid3DPtr plate2  = GbCuboid3DPtr( new GbCuboid3D( -1.5e-1, -16.51e-1, -16.831e-2, 1.5e-1, -1.6e-2, 1.0 ));
-         GbCuboid3DPtr plate3  = GbCuboid3DPtr( new GbCuboid3D( -1.5e-1, 1.6e-2, -16.831e-2, 1.5e-1, 16.515e-1, 1.0 ));
-
-         // GbCuboid3DPtr plate1_1  = GbCuboid3DPtr( new GbCuboid3D( -7.5, -2.515e-1, -1.0e-1, 7.5, 2.515e-1, -6.831e-2 ));
-         // GbCuboid3DPtr plate1_2  = GbCuboid3DPtr( new GbCuboid3D( -7.5, -2.515e-1, -0.0000001, 7.5, 2.515e-1, 1.0e-1 ));
-         // GbCuboid3DPtr plate1_3  = GbCuboid3DPtr( new GbCuboid3D( -7.5, 1.515e-1, -6.831e-2, 7.5, 2.515e-1, 0.0  ));
-         // GbCuboid3DPtr plate1_4  = GbCuboid3DPtr( new GbCuboid3D( -7.5, -2.515e-1, 0.0, 7.5, -1.515e-1, -1.0e-1 ));
-
-         // GbCuboid3DPtr inflow  = GbCuboid3DPtr( new GbCuboid3D( -8.0, -1.0, -1.0, -7.5, 1.0, 1.0 ));
-         // GbCuboid3DPtr outflow = GbCuboid3DPtr( new GbCuboid3D( 7.5, -1.0, -1.0, 8.0, 1.0, 1.0 ));
-
-         // GbCuboid3DPtr plate2  = GbCuboid3DPtr( new GbCuboid3D( -1.5e-1, -16.51e-1, -16.831e-2, 1.5e-1, -1.6e-2, 1.0 ));
-         // GbCuboid3DPtr plate3  = GbCuboid3DPtr( new GbCuboid3D( -1.5e-1, 1.6e-2, -16.831e-2, 1.5e-1, 16.515e-1, 1.0 ));
-
-         // GbCuboid3DPtr plate1_1  = GbCuboid3DPtr( new GbCuboid3D( -left_offset-bH*dx, back_offset, -bottom_offset-bH*dx, right_offset+bH*dx, back_offset+bH*dx, top_offset+bH*dx ));
-         // GbCuboid3DPtr plate1_2  = GbCuboid3DPtr( new GbCuboid3D( -left_offset-bH*dx, -front_offset-bH*dx, -bottom_offset-bH*dx, right_offset+bH*dx, -front_offset, top_offset+bH*dx ));
-         // GbCuboid3DPtr plate1_3  = GbCuboid3DPtr( new GbCuboid3D( -left_offset-bH*dx, -front_offset-bH*dx, top_offset, right_offset+bH*dx, back_offset+bH*dx, top_offset+bH*dx+2.0*dx ));
-         // GbCuboid3DPtr plate1_4  = GbCuboid3DPtr( new GbCuboid3D( -left_offset-bH*dx, -front_offset-bH*dx, -bottom_offset-bH*dx, right_offset+bH*dx, back_offset+bH*dx, -bottom_offset ));
-
-         //GbCuboid3DPtr inflow  = GbCuboid3DPtr( new GbCuboid3D( -left_offset-5*bH*dx, -front_offset-5*bH*dx, -bottom_offset-5*bH*dx, -left_offset, back_offset+5*bH*dx, top_offset+5*bH*dx ));
-         //GbCuboid3DPtr outflow = GbCuboid3DPtr( new GbCuboid3D( right_offset, -front_offset-5*bH*dx, -bottom_offset-5*bH*dx, right_offset+5.0*bH*dx, back_offset+5*bH*dx, top_offset+5*bH*dx ));
-
-         //GbCuboid3DPtr inflow  = GbCuboid3DPtr( new GbCuboid3D( -11000.0,-600.0, -600.0, -9000.0, 600.0, -500 ));
-         //GbCuboid3DPtr outflow = GbCuboid3DPtr( new GbCuboid3D( 9000,-600.0, -600.0, 11000.0, 600.0, -500));
-
-         GbCuboid3DPtr inflow  = GbCuboid3DPtr( new GbCuboid3D( -11000.0,-600.0, -600.0, -9000.0, 600.0, -480 ));
-         GbCuboid3DPtr outflow = GbCuboid3DPtr( new GbCuboid3D( 9000,-600.0, -600.0, 11000.0, 600.0, -480));
-         GbObject3DPtr gridCube(new GbCuboid3D(-1.05e4, -500-140.0, -480.0-25.54, 1.05e4, 500.0, 0.0));
-
-
-
-         //GbObject3DPtr gridCube(new GbCuboid3D(-10700.0/*inflow->getX1Maximum()-4.0*dx/*.5*shiftForMG*/,-550.0/*-270*/ , -550.0/*-70*/,
-         //                                             10700.0/*outflow->getX1Minimum()+4.0*dx/*.5*shiftForMG*/, 
-         //                                             550.0/*270*/, 
-         //                                             23.0/*10.0*/));
-
-
-
-         //GbObject3DPtr gridCube(new GbCuboid3D(-1.05e4, -500.0, -500.0-0.54, 1.05e4, 500.0, 0.0-0.54));
-         //GbObject3DPtr gridCube(new GbCuboid3D(-1.05e4, -500.0, -500.0, 1.05e4, 500.0, 0.0));
-
-         //double difX1 = geo->getX1Centroid() - gridCube->getX1Centroid();
-         //double difX2 = geo->getX2Centroid() - gridCube->getX2Centroid();
-         //double difX3 = geo->getX3Centroid() - gridCube->getX3Centroid();
-
-         ////GbObject3DPtr gridCubeCor(new GbCuboid3D(-1.05e4+difX1, -500.0+difX2, -500.0-0.54, 1.05e4+difX1, 500.0+difX2, 0.0-0.54));
-         //GbObject3DPtr gridCubeCor(new GbCuboid3D(-1.05e4+difX1, -500.0+difX2, -500.0+difX3, 1.05e4+difX1, 500.0+difX2, 0.0+difX3));
-
-         GenBlocksGridVisitor genBlocks;
-         genBlocks.addGeoObject(gridCube);
-         grid->accept(genBlocks);
-
-         if(myid == 0)
-         {
-            GbSystem3D::writeGeoObject(gridCube.get(),pathname+"/geo/gridCube", WbWriterVtkXmlASCII::getInstance());
-            GbSystem3D::writeGeoObject(gridCube.get(),pathname+"/geo/gridCubeCor", WbWriterVtkXmlASCII::getInstance());
-            //GbSystem3D::writeGeoObject(plate2.get(),pathname+"/geo/plate2", WbWriterVtkXmlASCII::getInstance());
-            //GbSystem3D::writeGeoObject(plate3.get(),pathname+"/geo/plate3", WbWriterVtkXmlASCII::getInstance());
-
-            // GbSystem3D::writeGeoObject(plate1_1.get(),pathname+"/geo/plate1_1", WbWriterVtkXmlASCII::getInstance());
-            // GbSystem3D::writeGeoObject(plate1_2.get(),pathname+"/geo/plate1_2", WbWriterVtkXmlASCII::getInstance());
-            // GbSystem3D::writeGeoObject(plate1_3.get(),pathname+"/geo/plate1_3", WbWriterVtkXmlASCII::getInstance());
-            // GbSystem3D::writeGeoObject(plate1_4.get(),pathname+"/geo/plate1_4", WbWriterVtkXmlASCII::getInstance());
-
-            GbSystem3D::writeGeoObject(inflow.get(),pathname+"/geo/inflow", WbWriterVtkXmlASCII::getInstance());
-            GbSystem3D::writeGeoObject(outflow.get(),pathname+"/geo/outflow", WbWriterVtkXmlASCII::getInstance());
-         }
-
-
-         if (refineLevel > 0)
-         {
-            if(myid == 0) UBLOG(logINFO,"Refinement - start");   
-            RefineCrossAndInsideGbObjectHelper refineHelper(grid, refineLevel);
-            refineHelper.addGbObject(refineCube1, 1);
-            refineHelper.addGbObject(refineCube3, 2);
-            refineHelper.addGbObject(refineCube2, 3);
-            refineHelper.addGbObject(refineCube4, 4);
-
-            refineHelper.addGbObject(refineCube5up, 5);
-            refineHelper.addGbObject(refineCube5down, 5);
-
-            refineHelper.addGbObject(refineCubeInlet, 1);
-            refineHelper.addGbObject(refineCubeOutlet, 1);
-            refineHelper.refine();
-            if(myid == 0) UBLOG(logINFO,"Refinement - end");   
-
-
-            // RefineCrossAndInsideGbObjectBlockVisitor refVisitor1(refineCube1, refineLevel-4);
-            // grid->accept(refVisitor1);
-
-            // RefineCrossAndInsideGbObjectBlockVisitor refVisitor3(refineCube3, refineLevel-3);
-            // grid->accept(refVisitor3);
-
-            // RefineCrossAndInsideGbObjectBlockVisitor refVisitor2(refineCube2, refineLevel-2);
-            // grid->accept(refVisitor2);
-
-            // RefineCrossAndInsideGbObjectBlockVisitor refVisitor4(refineCube4, refineLevel-1);
-            // grid->accept(refVisitor4);
-
-            // RatioBlockVisitor ratioVisitor(refineLevel);
-            // grid->accept(ratioVisitor);
-
-            // RatioSmoothBlockVisitor ratioSmoothVisitor(refineLevel);
-            // grid->accept(ratioSmoothVisitor);
-
-            // OverlapBlockVisitor overlapVisitor(refineLevel);
-            // grid->accept(overlapVisitor);
-
-            // std::vector<int> dirs;
-            // D3Q27System::getLBMDirections(dirs);
-            // SetInterpolationDirsBlockVisitor interDirsVisitor(dirs);
-            // grid->accept(interDirsVisitor);
-            // if(myid == 0) UBLOG(logINFO,"Refinement - end");	
-         }
-
-         //////////////////////////////////////////////////////////////////////////
-         //INTERAKTOREN SETZEN (=Randbedingungen)
-         //////////////////////////////////////////////////////////////////////////
-         //oben/unten = Haftrand
-         int bbOption = 1; //0=simple Bounce Back, 1=quadr. BB
-         D3Q27BoundaryConditionAdapterPtr bcObst(new D3Q27NoSlipBCAdapter(bbOption));
-         geoInt = D3Q27TriFaceMeshInteractorPtr( new D3Q27TriFaceMeshInteractor(geo, grid, D3Q27BoundaryConditionAdapterPtr(new D3Q27NoSlipBCAdapter(bbOption)),Interactor3D::INVERSESOLID, Interactor3D::SIMPLE));
-         geoInt->setUseHalfSpaceCheck(true);
-         geoInt->setRegardPointInObjectTest(true);
-         if(myid == 0) UBLOG(logINFO,"stl - end"); 
-         //D3Q27InteractorPtr plate1Int(new D3Q27Interactor(plate1, grid, bcObst,Interactor3D::INVERSESOLID));
-         // D3Q27InteractorPtr plate2Int(new D3Q27Interactor(plate2, grid, bcObst,Interactor3D::SOLID));
-         // D3Q27InteractorPtr plate3Int(new D3Q27Interactor(plate3, grid, bcObst,Interactor3D::SOLID));
-
-         // D3Q27InteractorPtr plate1_1Int(new D3Q27Interactor(plate1_1, grid, bcObst,Interactor3D::SOLID));
-         // D3Q27InteractorPtr plate1_2Int(new D3Q27Interactor(plate1_2, grid, bcObst,Interactor3D::SOLID));
-         // D3Q27InteractorPtr plate1_3Int(new D3Q27Interactor(plate1_3, grid, bcObst,Interactor3D::SOLID));
-         // D3Q27InteractorPtr plate1_4Int(new D3Q27Interactor(plate1_4, grid, bcObst,Interactor3D::SOLID));
-
-         //links: geschwindigkeits-einfluss
-         //Velocity-BC
-         //////////////////////////////////////////////////////////////////////////
-         mu::Parser fct;
-         fct.DefineConst("vx1"  , vLB*9.0/4.0 );
-         //fct = MathUtil::getDuctParaboloidX(0, 250*2.0, -51.08/2, 51.08, vLB*9.0/4.0);
-         fct.SetExpr("vx1");
-         //////////////////////////////////////////////////////////////////////////
-
-         //////////////////////////////////////////////////////////////////////////
-         // D3Q27BoundaryConditionAdapterPtr velBCAdapter = D3Q27BoundaryConditionAdapterPtr(new D3Q27VelocityBCAdapter (false, false ,true ,fct, 0, D3Q27BCFunction::INFCONST));
-         // velBCAdapter->setSecondaryBcOption(2);
-         // D3Q27InteractorPtr inflowInt  = D3Q27InteractorPtr( new D3Q27Interactor(inflow, grid, velBCAdapter, Interactor3D::SOLID));
-
-         D3Q27BoundaryConditionAdapterPtr denBCAdapterInlet(new D3Q27DensityBCAdapter(3.0*(dp_lb-rhoLB)));
-         denBCAdapterInlet->setSecondaryBcOption(1);
-         D3Q27InteractorPtr inflowInt = D3Q27InteractorPtr( new D3Q27Interactor(inflow, grid, denBCAdapterInlet,Interactor3D::SOLID));
-
-         //rechts: druckrand
-         //Density-BC
-         //fuer Kompressibles Modell  rho = 1.0
-         D3Q27BoundaryConditionAdapterPtr denBCAdapter(new D3Q27DensityBCAdapter(rhoLB));
-         denBCAdapter->setSecondaryBcOption(1);
-         D3Q27InteractorPtr outflowInt = D3Q27InteractorPtr( new D3Q27Interactor(outflow, grid, denBCAdapter,Interactor3D::SOLID));
-
-         MetisPartitioningGridVisitor metisVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B);
-         grid->accept( metisVisitor );
-         SolidBlocksHelper sd(grid, comm);
-         sd.addInteractor(geoInt);
-         sd.addInteractor(inflowInt);
-         sd.addInteractor(outflowInt);
-         // sd.addInteractor(plate1_1Int);
-         // sd.addInteractor(plate1_2Int);
-         // sd.addInteractor(plate1_3Int);
-         // sd.addInteractor(plate1_4Int);
-         // sd.addInteractor(plate2Int);
-         // sd.addInteractor(plate3Int);
-         if(myid == 0) UBLOG(logINFO,"line"<<__LINE__); 
-         sd.deleteSolidBlocks();  
-
-         if(myid == 0) UBLOG(logINFO,"line"<<__LINE__); 
-         grid->accept( metisVisitor );
-         sd.setTransBlocks();		 
-         if(myid == 0) UBLOG(logINFO,"line"<<__LINE__); 
-         BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname + "/grid/blocks", WbWriterVtkXmlBinary::getInstance(), comm));
-         ppblocks->update(0);
-         ppblocks.reset();
-
-         unsigned long nob = grid->getNumberOfBlocks();
-         int gl = 3;
-         unsigned long nod_temp = nob * (nodePerBlockX1+gl) * (nodePerBlockX2+gl) * (nodePerBlockX3+gl);
-         unsigned long nod = nob * (nodePerBlockX1) * (nodePerBlockX2) * (nodePerBlockX3);
-         double needMemAll  = double(nod_temp*(27*sizeof(double) + sizeof(int) + sizeof(float)*4));
-         double needMem  = needMemAll / double(comm->getNumberOfProcesses());
-
-
-         if(myid == 0)
-         {
-            UBLOG(logINFO,"Number of blocks = " << nob);
-            UBLOG(logINFO,"Number of nodes  = " << nod);
-            UBLOG(logINFO,"Necessary memory  = " << needMemAll  << " bytes");
-            UBLOG(logINFO,"Necessary memory per process = " << needMem  << " bytes");
-            UBLOG(logINFO,"Available memory per process = " << availMem << " bytes");
-         }  
-
-         LBMKernel3DPtr kernel(new LBMKernelETD3Q27CCLB(nodePerBlockX1, nodePerBlockX2, nodePerBlockX3,LBMKernelETD3Q27CCLB::MAGIC));
-
-
-
-         BCProcessorPtr bcProc(new D3Q27ETBCProcessor());
-         kernel->setBCProcessor(bcProc);
-
-         SetKernelBlockVisitor kernelVisitor(kernel, nueLB, availMem, needMem);
-         grid->accept(kernelVisitor);
-
-         if (refineLevel > 0)
-         {
-            D3Q27SetUndefinedNodesBlockVisitor undefNodesVisitor;
-            grid->accept(undefNodesVisitor);
-         }
-
-         if(myid == 0) UBLOG(logINFO,"intractor - start"); 
-         //inflow
-         grid->addAndInitInteractor(inflowInt);
-
-         //outflow
-         grid->addAndInitInteractor(outflowInt);
-         //canal
-         grid->addAndInitInteractor(geoInt);
-         // grid->addAndInitInteractor(plate1_1Int);
-         // grid->addAndInitInteractor(plate1_2Int);
-         // grid->addAndInitInteractor(plate1_3Int);
-         // grid->addAndInitInteractor(plate1_4Int);
-         // grid->addAndInitInteractor(plate2Int);
-         // grid->addAndInitInteractor(plate3Int);
-
-
-         if(myid == 0) UBLOG(logINFO,"intractor - end");
-         //////////////////////////////////////////////////////////////////////////
-         //connectoren setzen:
-
-         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
-         grid->accept( setConnsVisitor );
-         //////////////////////////////////////////////////////////////////////////	 
-         //domain decomposition
-         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
-         grid->accept(pqPartVisitor);
-
-         //////////////////////////////////////////////////////////////////////////     
-         //Stroemungsfeld initialisieren
-         //////////////////////////////////////////////////////////////////////////
-         D3Q27ETInitDistributionsBlockVisitor initVisitor(nueLB, rhoLB); //1.0
-         initVisitor.setVx1(0); 
-         grid->accept(initVisitor);
-
-         // if(myid == 0)
-         // {
-         // //Abstände "q" als Linien rausschreiben
-         // std::vector< UbTupleFloat3 > nodes;
-         // std::vector< UbTupleInt2 >   lines;
-         // geoInt->addQsLineSet(nodes, lines);
-         // WbWriterVtkXmlBinary::getInstance()->writeLines(pathname+"/grid/qs",nodes,lines);
-         // }
-
-         if(myid == 0) UBLOG(logINFO,"Preprozess - end");
-
-         ////////////////////////
-         //Set Postprozessors
-         //////////////////////////////////////////////////////////////////////////
-         {
-            UbSchedulerPtr geoSch(new UbScheduler(1));
-            D3Q27MacroscopicQuantitiesPostprocessor ppgeo(grid,geoSch, pathname + "/grid/nodes", WbWriterVtkXmlBinary::getInstance(), conv,  comm, true);
-            //grid->doPostProcess(0);
-            grid->notifyObservers(0);
-         }
-
-
-      }
-
-      //////////////////////////////////////////////////////////////////////////
-      // UbSchedulerPtr visSchAv(new UbScheduler());
-      UbSchedulerPtr visSchAv(new UbScheduler(100000,350000));
-      // visSchAv->addSchedule(100,10,1000);
-      // UbSchedulerPtr resSchAv(new UbScheduler());
-      UbSchedulerPtr resSchAv(new UbScheduler(100,10000000000));
-      // resSchAv->addSchedule(20,20,1000);
-      AverageValuesPostprocessor       Avpp(grid,  pathname + "/Turbulence/stepAV", WbWriterVtkXmlBinary::getInstance(), visSchAv/*wann wird rausgeschrieben*/,resSchAv/*wann wird resettet*/,comm);
-
-      D3Q27ShearStressPostprocessor  shear(grid,  pathname + "/shear/step", WbWriterVtkXmlBinary::getInstance(), visSchAv/*wann wird rausgeschrieben*/,resSchAv/*wann wird resettet*/); 
-      // D3Q27ShearStressPostprocessor  shear(grid,  pathname + "/shear/step", WbWriterVtkXmlBinary::getInstance(), visSchAv/*wann wird rausgeschrieben*/,resSchAv/*wann wird resettet*/,comm);
-      shear.addInteractor(geoInt);
-      ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-      UbSchedulerPtr nupsSch(new UbScheduler(1, 5, 10));
-      NUPSCounterPostprocessor npr(grid, nupsSch, pathname + "/results/nups.txt", comm);
-
-      double outTime = 10000.0;
-      UbSchedulerPtr stepSch(new UbScheduler(outTime));
-      D3Q27MacroscopicQuantitiesPostprocessor pp(grid,stepSch, pathname + "/steps/step", WbWriterVtkXmlBinary::getInstance(), conv,  comm);
-      //////////////////////////////////////////////////////////////////////////
-      //PathLine
-      UbSchedulerPtr plSch(new UbScheduler(5000, 5000));
-      const int numberofparticle=20;
-
-      std::vector<UbTupleDouble3 > potisions;
-      double randomx[numberofparticle];
-      double randomy[numberofparticle];
-      double randomz[numberofparticle];
-      double lowestx,highestx,lowesty,highesty,lowestz,highestz;
-      if(myid==0)
-      {
-         for(int i = 0; i < numberofparticle; i++)
-         {
-            double random; 
-            lowestx =-10300.0;  lowesty =-230;          lowestz =-250;
-            highestx=-9792.0;  highesty=-330;          highestz=-250; 
-
-            double rangex=(highestx-lowestx),rangey=(highesty-lowesty),rangez=(highestz-lowestz);	
-            randomx[i] = lowestx+(rangex*rand()/(RAND_MAX + 1.0));
-            randomy[i] = lowesty+(rangey*rand()/(RAND_MAX + 1.0));
-            randomz[i] = lowestz+(rangez*rand()/(RAND_MAX + 1.0));
-            //val<1>(potisions[i])= 0.506983973456;
-            //val<2>(potisions[i]) = lowesty+(rangey*rand()/(RAND_MAX + 1.0));
-            //val<3>(potisions[i]) = lowestz+(rangez*rand()/(RAND_MAX + 1.0));
-         }
-         for (int i=0;i<comm->getNumberOfProcesses();i++)
-         {
-            if (i!=0)
-            {
-               MPI_Send(randomx,numberofparticle, MPI_DOUBLE_PRECISION,i,i,MPI_COMM_WORLD);
-               MPI_Send(randomy,numberofparticle, MPI_DOUBLE_PRECISION,i,i,MPI_COMM_WORLD);
-               MPI_Send(randomz,numberofparticle, MPI_DOUBLE_PRECISION,i,i,MPI_COMM_WORLD);
-            }
-         }
-      }
-      if (myid!=0)
-      {
-         MPI_Status status; 
-         MPI_Recv(randomx,numberofparticle, MPI_DOUBLE_PRECISION,0,MPI_ANY_TAG,MPI_COMM_WORLD,&status);
-         MPI_Recv(randomy,numberofparticle, MPI_DOUBLE_PRECISION,0,MPI_ANY_TAG,MPI_COMM_WORLD,&status);
-         MPI_Recv(randomz,numberofparticle, MPI_DOUBLE_PRECISION,0,MPI_ANY_TAG,MPI_COMM_WORLD,&status);
-      }
-      for(int i = 0; i < numberofparticle; i++)
-      {	
-         potisions.push_back( makeUbTuple(randomx[i],randomy[i],randomz[i]) );
-         //val<1>(potisions[i])= 0.506983973456;
-         //val<2>(potisions[i]) = randomy[i];
-         //val<3>(potisions[i]) = randomz[i];
-      }
-      //  UBLOG(logINFO,"Rank="<<myid<<" positions  = " <<val<1>(potisions)<< " "<<val<2>(potisions)<<" "<< val<3>(potisions));
-      // D3Q27InterpolationProcessorPtr iProcessor2;
-      // D3Q27PathLinePostprocessorMcpart pathLine(grid, pathname + "/pathLine/pathLine", WbWriterVtkXmlASCII::getInstance(), conv, plSch, comm,potisions, nueLB, iProcessor);
-      //////////////////////////////////////////////////////////////////////////
-      //Simulation
-      //////////////////////////////////////////////////////////////////////////
-      return;
-
-      double endTime = 1000000000.0;
-      UbSchedulerPtr visSch(stepSch);
-      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, visSch));
-      if(myid == 0) UBLOG(logINFO,"Simulation-start");
-      calculation->calculate();
-      if(myid == 0) UBLOG(logINFO,"Simulation-end");
-
-   }
-   catch(std::exception& e)
-   {
-      cerr << e.what() << endl;
-   }
-   catch(std::string& s)
-   {
-      cerr << s << endl;
-   }
-   catch(...)
-   {
-      cerr << "unknown exception" << endl;
-   }
-
-}
+#include <iostream>
+#include <string>
+#include <map>
+
+#include <vfluids.h>
+using namespace std;
+
+void micropartTestQs3(const char *cstr)
+{
+   try
+   {
+      CommunicatorPtr comm = MPICommunicator::getInstance();
+      int myid = comm->getProcessID();
+      int numprocs = comm->getNumberOfProcesses();
+
+      string machine = QUOTEME(CAB_MACHINE);
+      string pathname; 
+      double availMem = 0;
+      string geoFile;
+      int numOfThreads = 1;
+
+      if(machine == "BOMBADIL") 
+      {
+         pathname = "d:/temp/micropart";
+         availMem = 1.0e9;
+         int numOfThreads = 1;
+         geoFile = "d:/Data/micropart/E0019B_mit_Radien.stl";
+      }
+      else if(machine == "M01" || machine == "M02")      
+      {
+         // pathname = "/work/koskuche/scratch/mcpart/out";
+         pathname = "/work/ehsan/orifice";
+         availMem = 12.0e9;
+         geoFile = "d:/Data/micropart/E0019B_mit_Radien.stl";
+         //geoFile = "/home/koskuche/data/micropart/DK19_7_02_Martin.stl";
+
+         numOfThreads = 1;
+         if(myid ==0)
+         {
+            stringstream logFilename;
+            logFilename <<  pathname + "/logfile"+UbSystem::toString(UbSystem::getTimeStamp())+"_"+UbSystem::toString(myid)+".txt";
+            UbLog::output_policy::setStream(logFilename.str());
+         }
+      }
+      else throw UbException(UB_EXARGS, "unknown CAB_MACHINE");
+
+      UbLog::reportingLevel() = logINFO;
+      //UbLog::reportingLevel() = logDEBUG1;
+
+      int nodePerBlockX1 =16; //Anzahl an Knoten pro Block
+      int nodePerBlockX2 =16;//(int)16;
+      int nodePerBlockX3 =16;//8; //(int)16;
+
+      double bH = nodePerBlockX1;    //gewuenschte Rand- und Blockbreite
+
+
+      //Simulation Parameters
+      const int baseLevel = 0;
+      const int refineLevel = 5;
+      //length [m]
+      double lSI =217.35;// 216.75;//223.2;
+      //length [LB]
+      double lLB = 30;
+
+      double dx =10;//lSI/lLB;
+
+      double left_offset = 10700;//*0.5;
+      double right_offset  = 107000;//0.5;//2*0.5
+      double front_offset = 750;//0.15;
+      double back_offset  = 750;//0.15;
+      double top_offset = 250;//0.0;
+      double bottom_offset  =750;// 70;//0.07;
+
+      LBMReal vLB =0.00016103/5.0*sqrt(2.0);//0.00016103;
+      LBMReal Re;
+      LBMReal rhoLB = 0.0;
+      LBMReal nueLB = 0.0000249;//(vLB*lLB)/Re;
+      Re = (vLB*(500/dx))/nueLB;
+      double dp_Ph=200.0*100000;//
+      //double dp_lb=dp_Ph*0.001*(nueLB)*(nueLB);//nue_ph=10e-6 and dx is in micrometer
+      LBMReal nue_Ph = 1e-6;//
+      double dt=/*(nue_Ph/nueLB)*/(nueLB/nue_Ph)*(dx*1e-6)*(dx*1e-6);//dt=nu_lb/nu_ph*dx*dx;//nue_ph=10e-6;dx is in micrometer;
+      double dp_lb=dp_Ph/1000*(dt*dt)/((dx*1e-6)*(dx*1e-6));//dp_lb=dp_ph/rho_ph*dt*dt/dx/dx
+      // LBMReal nueLB = 0.000016103;
+      // LBMReal Re=15000;
+      // LBMReal rhoLB = 0.0;
+      // LBMReal vLB =nueLB*Re/(500.0/dx);
+      // // Re = (vLB*(0.303/dx))/nueLB;
+      // //Re = (vLB*lLB)/nueLB;
+
+      // LBMReal rhoWord = 1e-15;//kg/micrometre^3;//1000.0;
+      // LBMReal nueRE = 1e6;//micromter^2/s;//0.000001;
+      // LBMReal  vWorld=300*1e6;//micrometer/s;//nueRE*Re/ (lSI*4.0/9.0);
+      LBMUnitConverterPtr conv = LBMUnitConverterPtr(new LBMUnitConverter());
+      //conv->init(lSI*1e-6,30000,rhoWord,vWorld,lLB,1.0/*rhoLB*/,vLB); 
+
+      //////////////////////////////////////////////////////////////////////////
+      GbObject3DPtr refineCube1(new  GbCuboid3D(-500.0+5.0/*-354.0*/,-957.0/*-280.0*/,-684.0/* -72.0*/, 4100/*370.0*/,957.0/*354.0*/,70.0));//-530.0,-280.0, -72.0, 530.0,354.0,70.0));
+      if(myid == 0) GbSystem3D::writeGeoObject(refineCube1.get(), pathname+"/geo/refineCube1", WbWriterVtkXmlASCII::getInstance());
+
+      GbObject3DPtr refineCube2(new  GbCuboid3D(-280.0,-957.0/*-120.0*/,-684.0/*-684.0*//* -72.0*/, 500,957.0/*120.0*/,70.0));
+      if(myid == 0) GbSystem3D::writeGeoObject(refineCube2.get(), pathname+"/geo/refineCube2", WbWriterVtkXmlASCII::getInstance());
+
+      GbObject3DPtr refineCube3(new  GbCuboid3D(-350.0,-957.0/*-120.0*/,-684.0/*-684.0*//* -72.0*/, 1700,957.0/*120.0*/,70.0));
+      if(myid == 0) GbSystem3D::writeGeoObject(refineCube3.get(), pathname+"/geo/refineCube3", WbWriterVtkXmlASCII::getInstance());
+
+      GbObject3DPtr refineCube4(new  GbCuboid3D(-230.0,-150.0/*-120.0*/,-684.0, 225,150,957.0));
+      if(myid == 0) GbSystem3D::writeGeoObject(refineCube4.get(), pathname+"/geo/refineCube4", WbWriterVtkXmlASCII::getInstance());
+
+      GbObject3DPtr refineCube5up(new  GbCuboid3D(-147.0,-50,-5.0, 0.0,50.0,957.0));
+      if(myid == 0) GbSystem3D::writeGeoObject(refineCube5up.get(), pathname+"/geo/refineCube5up", WbWriterVtkXmlASCII::getInstance());
+
+      GbObject3DPtr refineCube5down(new  GbCuboid3D(-147.0,-50,-46.0, 0,50,-957.0));
+      if(myid == 0) GbSystem3D::writeGeoObject(refineCube5down.get(), pathname+"/geo/refineCube5down", WbWriterVtkXmlASCII::getInstance());
+
+      GbObject3DPtr refineCubeInlet(new  GbCuboid3D(-10600.0,-600.0, -600.0/*-72.0*/, -8000,600.0,60.0));
+      if(myid == 0) GbSystem3D::writeGeoObject(refineCubeInlet.get(), pathname+"/geo/refineCubeInlet", WbWriterVtkXmlASCII::getInstance());
+
+      GbObject3DPtr refineCubeOutlet(new  GbCuboid3D(8000,-600.0, -600.0/*-72.0*/,10550.0 ,600.0,60.0));
+      if(myid == 0) GbSystem3D::writeGeoObject(refineCubeOutlet.get(), pathname+"/geo/refineCubeOutlet", WbWriterVtkXmlASCII::getInstance());
+      //////////////////////////////////////////////////////////////////////////
+      D3Q27TriFaceMeshInteractorPtr geoInt;
+      /////////////////
+      //Grid3DPtr grid(new Grid3D());
+      Grid3DPtr grid(new Grid3D(comm));
+
+      UbSchedulerPtr rSch(new UbScheduler());
+      rSch->addSchedule(50000, 50000, 1000000000);
+      RestartPostprocessorPtr rp(new RestartPostprocessor(grid, rSch, comm, pathname+"/checkpoints", RestartPostprocessor::BINARY));
+
+      std::string opt;
+      D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
+
+      if(cstr!= NULL)
+         opt = std::string(cstr);
+
+      if/*(cstr== NULL)*/(cstr!= NULL)
+      {
+         if(myid==0) UBLOG(logINFO,"Restart step: " << opt);
+         grid = rp->restart(UbSystem::stringTo<int>(opt));
+         rp->reconnect(grid);
+
+         // SetForcingBlockVisitor forcingVisitor(0.0, 0.0, 0.0);
+         // grid->accept(forcingVisitor);
+
+         //D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
+         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
+         grid->accept( setConnsVisitor );
+         if(myid==0) UBLOG(logINFO,"Restart finish: " << opt);
+
+      }
+      else
+      {
+         if(myid ==0)
+         {
+            UBLOG(logINFO,"L = " <<lLB );
+            UBLOG(logINFO,"v = " <<vLB );
+            UBLOG(logINFO,"rho = " <<rhoLB );
+            UBLOG(logINFO,"nue = " << nueLB );
+            UBLOG(logINFO,"dx = " << dx );
+            UBLOG(logINFO,"Re = " << Re );
+            UBLOG(logINFO,"dt = " << dt );
+            UBLOG(logINFO,"dp_lb = " << dp_lb );
+            UBLOG(logINFO,"refineLevel = " << refineLevel );
+            UBLOG(logINFO,"Preprozess - start");
+         }
+
+
+         ////////////////////////////////////////////////////////////////////////
+         //Grid
+         //////////////////////////////////////////////////////////////////////////
+         grid->setDeltaX(dx);
+         grid->setBlockNX(nodePerBlockX1, nodePerBlockX2, nodePerBlockX3);
+
+         ////////////////////////////////////////////////////////////////////////////
+         //// Geometrie
+         ////////////////////////////////////////////////////////////////////////////
+         GbTriFaceMesh3DPtr geo (GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(geoFile,"geo"));
+
+         if(myid == 0) GbSystem3D::writeGeoObject(geo.get(), pathname+"/geo/geo", WbWriterVtkXmlASCII::getInstance());
+
+         ////////////////////////////////////////////////////////////////////////////
+         //// Randgeometrien erstellen
+         ////////////////////////////////////////////////////////////////////////////
+         double shiftForMG=grid->getDeltaX(refineLevel)*nodePerBlockX1 / 3.0*2.0;
+         GbCuboid3DPtr plate1  = GbCuboid3DPtr( new GbCuboid3D( -7.5, -1.515e-1, -6.831e-2, 7.5, 1.515e-1, 0.0 ));
+
+         GbCuboid3DPtr plate2  = GbCuboid3DPtr( new GbCuboid3D( -1.5e-1, -16.51e-1, -16.831e-2, 1.5e-1, -1.6e-2, 1.0 ));
+         GbCuboid3DPtr plate3  = GbCuboid3DPtr( new GbCuboid3D( -1.5e-1, 1.6e-2, -16.831e-2, 1.5e-1, 16.515e-1, 1.0 ));
+
+         // GbCuboid3DPtr plate1_1  = GbCuboid3DPtr( new GbCuboid3D( -7.5, -2.515e-1, -1.0e-1, 7.5, 2.515e-1, -6.831e-2 ));
+         // GbCuboid3DPtr plate1_2  = GbCuboid3DPtr( new GbCuboid3D( -7.5, -2.515e-1, -0.0000001, 7.5, 2.515e-1, 1.0e-1 ));
+         // GbCuboid3DPtr plate1_3  = GbCuboid3DPtr( new GbCuboid3D( -7.5, 1.515e-1, -6.831e-2, 7.5, 2.515e-1, 0.0  ));
+         // GbCuboid3DPtr plate1_4  = GbCuboid3DPtr( new GbCuboid3D( -7.5, -2.515e-1, 0.0, 7.5, -1.515e-1, -1.0e-1 ));
+
+         // GbCuboid3DPtr inflow  = GbCuboid3DPtr( new GbCuboid3D( -8.0, -1.0, -1.0, -7.5, 1.0, 1.0 ));
+         // GbCuboid3DPtr outflow = GbCuboid3DPtr( new GbCuboid3D( 7.5, -1.0, -1.0, 8.0, 1.0, 1.0 ));
+
+         // GbCuboid3DPtr plate2  = GbCuboid3DPtr( new GbCuboid3D( -1.5e-1, -16.51e-1, -16.831e-2, 1.5e-1, -1.6e-2, 1.0 ));
+         // GbCuboid3DPtr plate3  = GbCuboid3DPtr( new GbCuboid3D( -1.5e-1, 1.6e-2, -16.831e-2, 1.5e-1, 16.515e-1, 1.0 ));
+
+         // GbCuboid3DPtr plate1_1  = GbCuboid3DPtr( new GbCuboid3D( -left_offset-bH*dx, back_offset, -bottom_offset-bH*dx, right_offset+bH*dx, back_offset+bH*dx, top_offset+bH*dx ));
+         // GbCuboid3DPtr plate1_2  = GbCuboid3DPtr( new GbCuboid3D( -left_offset-bH*dx, -front_offset-bH*dx, -bottom_offset-bH*dx, right_offset+bH*dx, -front_offset, top_offset+bH*dx ));
+         // GbCuboid3DPtr plate1_3  = GbCuboid3DPtr( new GbCuboid3D( -left_offset-bH*dx, -front_offset-bH*dx, top_offset, right_offset+bH*dx, back_offset+bH*dx, top_offset+bH*dx+2.0*dx ));
+         // GbCuboid3DPtr plate1_4  = GbCuboid3DPtr( new GbCuboid3D( -left_offset-bH*dx, -front_offset-bH*dx, -bottom_offset-bH*dx, right_offset+bH*dx, back_offset+bH*dx, -bottom_offset ));
+
+         //GbCuboid3DPtr inflow  = GbCuboid3DPtr( new GbCuboid3D( -left_offset-5*bH*dx, -front_offset-5*bH*dx, -bottom_offset-5*bH*dx, -left_offset, back_offset+5*bH*dx, top_offset+5*bH*dx ));
+         //GbCuboid3DPtr outflow = GbCuboid3DPtr( new GbCuboid3D( right_offset, -front_offset-5*bH*dx, -bottom_offset-5*bH*dx, right_offset+5.0*bH*dx, back_offset+5*bH*dx, top_offset+5*bH*dx ));
+
+         //GbCuboid3DPtr inflow  = GbCuboid3DPtr( new GbCuboid3D( -11000.0,-600.0, -600.0, -9000.0, 600.0, -500 ));
+         //GbCuboid3DPtr outflow = GbCuboid3DPtr( new GbCuboid3D( 9000,-600.0, -600.0, 11000.0, 600.0, -500));
+
+         GbCuboid3DPtr inflow  = GbCuboid3DPtr( new GbCuboid3D( -11000.0,-600.0, -600.0, -9000.0, 600.0, -480 ));
+         GbCuboid3DPtr outflow = GbCuboid3DPtr( new GbCuboid3D( 9000,-600.0, -600.0, 11000.0, 600.0, -480));
+         GbObject3DPtr gridCube(new GbCuboid3D(-1.05e4, -500-140.0, -480.0-25.54, 1.05e4, 500.0, 0.0));
+
+
+
+         //GbObject3DPtr gridCube(new GbCuboid3D(-10700.0/*inflow->getX1Maximum()-4.0*dx/*.5*shiftForMG*/,-550.0/*-270*/ , -550.0/*-70*/,
+         //                                             10700.0/*outflow->getX1Minimum()+4.0*dx/*.5*shiftForMG*/, 
+         //                                             550.0/*270*/, 
+         //                                             23.0/*10.0*/));
+
+
+
+         //GbObject3DPtr gridCube(new GbCuboid3D(-1.05e4, -500.0, -500.0-0.54, 1.05e4, 500.0, 0.0-0.54));
+         //GbObject3DPtr gridCube(new GbCuboid3D(-1.05e4, -500.0, -500.0, 1.05e4, 500.0, 0.0));
+
+         //double difX1 = geo->getX1Centroid() - gridCube->getX1Centroid();
+         //double difX2 = geo->getX2Centroid() - gridCube->getX2Centroid();
+         //double difX3 = geo->getX3Centroid() - gridCube->getX3Centroid();
+
+         ////GbObject3DPtr gridCubeCor(new GbCuboid3D(-1.05e4+difX1, -500.0+difX2, -500.0-0.54, 1.05e4+difX1, 500.0+difX2, 0.0-0.54));
+         //GbObject3DPtr gridCubeCor(new GbCuboid3D(-1.05e4+difX1, -500.0+difX2, -500.0+difX3, 1.05e4+difX1, 500.0+difX2, 0.0+difX3));
+
+         GenBlocksGridVisitor genBlocks;
+         genBlocks.addGeoObject(gridCube);
+         grid->accept(genBlocks);
+
+         if(myid == 0)
+         {
+            GbSystem3D::writeGeoObject(gridCube.get(),pathname+"/geo/gridCube", WbWriterVtkXmlASCII::getInstance());
+            GbSystem3D::writeGeoObject(gridCube.get(),pathname+"/geo/gridCubeCor", WbWriterVtkXmlASCII::getInstance());
+            //GbSystem3D::writeGeoObject(plate2.get(),pathname+"/geo/plate2", WbWriterVtkXmlASCII::getInstance());
+            //GbSystem3D::writeGeoObject(plate3.get(),pathname+"/geo/plate3", WbWriterVtkXmlASCII::getInstance());
+
+            // GbSystem3D::writeGeoObject(plate1_1.get(),pathname+"/geo/plate1_1", WbWriterVtkXmlASCII::getInstance());
+            // GbSystem3D::writeGeoObject(plate1_2.get(),pathname+"/geo/plate1_2", WbWriterVtkXmlASCII::getInstance());
+            // GbSystem3D::writeGeoObject(plate1_3.get(),pathname+"/geo/plate1_3", WbWriterVtkXmlASCII::getInstance());
+            // GbSystem3D::writeGeoObject(plate1_4.get(),pathname+"/geo/plate1_4", WbWriterVtkXmlASCII::getInstance());
+
+            GbSystem3D::writeGeoObject(inflow.get(),pathname+"/geo/inflow", WbWriterVtkXmlASCII::getInstance());
+            GbSystem3D::writeGeoObject(outflow.get(),pathname+"/geo/outflow", WbWriterVtkXmlASCII::getInstance());
+         }
+
+
+         if (refineLevel > 0)
+         {
+            if(myid == 0) UBLOG(logINFO,"Refinement - start");   
+            RefineCrossAndInsideGbObjectHelper refineHelper(grid, refineLevel);
+            refineHelper.addGbObject(refineCube1, 1);
+            refineHelper.addGbObject(refineCube3, 2);
+            refineHelper.addGbObject(refineCube2, 3);
+            refineHelper.addGbObject(refineCube4, 4);
+
+            refineHelper.addGbObject(refineCube5up, 5);
+            refineHelper.addGbObject(refineCube5down, 5);
+
+            refineHelper.addGbObject(refineCubeInlet, 1);
+            refineHelper.addGbObject(refineCubeOutlet, 1);
+            refineHelper.refine();
+            if(myid == 0) UBLOG(logINFO,"Refinement - end");   
+
+
+            // RefineCrossAndInsideGbObjectBlockVisitor refVisitor1(refineCube1, refineLevel-4);
+            // grid->accept(refVisitor1);
+
+            // RefineCrossAndInsideGbObjectBlockVisitor refVisitor3(refineCube3, refineLevel-3);
+            // grid->accept(refVisitor3);
+
+            // RefineCrossAndInsideGbObjectBlockVisitor refVisitor2(refineCube2, refineLevel-2);
+            // grid->accept(refVisitor2);
+
+            // RefineCrossAndInsideGbObjectBlockVisitor refVisitor4(refineCube4, refineLevel-1);
+            // grid->accept(refVisitor4);
+
+            // RatioBlockVisitor ratioVisitor(refineLevel);
+            // grid->accept(ratioVisitor);
+
+            // RatioSmoothBlockVisitor ratioSmoothVisitor(refineLevel);
+            // grid->accept(ratioSmoothVisitor);
+
+            // OverlapBlockVisitor overlapVisitor(refineLevel);
+            // grid->accept(overlapVisitor);
+
+            // std::vector<int> dirs;
+            // D3Q27System::getLBMDirections(dirs);
+            // SetInterpolationDirsBlockVisitor interDirsVisitor(dirs);
+            // grid->accept(interDirsVisitor);
+            // if(myid == 0) UBLOG(logINFO,"Refinement - end");	
+         }
+
+         //////////////////////////////////////////////////////////////////////////
+         //INTERAKTOREN SETZEN (=Randbedingungen)
+         //////////////////////////////////////////////////////////////////////////
+         //oben/unten = Haftrand
+         int bbOption = 1; //0=simple Bounce Back, 1=quadr. BB
+         D3Q27BoundaryConditionAdapterPtr bcObst(new D3Q27NoSlipBCAdapter(bbOption));
+         geoInt = D3Q27TriFaceMeshInteractorPtr( new D3Q27TriFaceMeshInteractor(geo, grid, D3Q27BoundaryConditionAdapterPtr(new D3Q27NoSlipBCAdapter(bbOption)),Interactor3D::INVERSESOLID, Interactor3D::SIMPLE));
+         geoInt->setUseHalfSpaceCheck(true);
+         geoInt->setRegardPointInObjectTest(true);
+         if(myid == 0) UBLOG(logINFO,"stl - end"); 
+         //D3Q27InteractorPtr plate1Int(new D3Q27Interactor(plate1, grid, bcObst,Interactor3D::INVERSESOLID));
+         // D3Q27InteractorPtr plate2Int(new D3Q27Interactor(plate2, grid, bcObst,Interactor3D::SOLID));
+         // D3Q27InteractorPtr plate3Int(new D3Q27Interactor(plate3, grid, bcObst,Interactor3D::SOLID));
+
+         // D3Q27InteractorPtr plate1_1Int(new D3Q27Interactor(plate1_1, grid, bcObst,Interactor3D::SOLID));
+         // D3Q27InteractorPtr plate1_2Int(new D3Q27Interactor(plate1_2, grid, bcObst,Interactor3D::SOLID));
+         // D3Q27InteractorPtr plate1_3Int(new D3Q27Interactor(plate1_3, grid, bcObst,Interactor3D::SOLID));
+         // D3Q27InteractorPtr plate1_4Int(new D3Q27Interactor(plate1_4, grid, bcObst,Interactor3D::SOLID));
+
+         //links: geschwindigkeits-einfluss
+         //Velocity-BC
+         //////////////////////////////////////////////////////////////////////////
+         mu::Parser fct;
+         fct.DefineConst("vx1"  , vLB*9.0/4.0 );
+         //fct = MathUtil::getDuctParaboloidX(0, 250*2.0, -51.08/2, 51.08, vLB*9.0/4.0);
+         fct.SetExpr("vx1");
+         //////////////////////////////////////////////////////////////////////////
+
+         //////////////////////////////////////////////////////////////////////////
+         // D3Q27BoundaryConditionAdapterPtr velBCAdapter = D3Q27BoundaryConditionAdapterPtr(new D3Q27VelocityBCAdapter (false, false ,true ,fct, 0, D3Q27BCFunction::INFCONST));
+         // velBCAdapter->setSecondaryBcOption(2);
+         // D3Q27InteractorPtr inflowInt  = D3Q27InteractorPtr( new D3Q27Interactor(inflow, grid, velBCAdapter, Interactor3D::SOLID));
+
+         D3Q27BoundaryConditionAdapterPtr denBCAdapterInlet(new D3Q27DensityBCAdapter(3.0*(dp_lb-rhoLB)));
+         denBCAdapterInlet->setSecondaryBcOption(1);
+         D3Q27InteractorPtr inflowInt = D3Q27InteractorPtr( new D3Q27Interactor(inflow, grid, denBCAdapterInlet,Interactor3D::SOLID));
+
+         //rechts: druckrand
+         //Density-BC
+         //fuer Kompressibles Modell  rho = 1.0
+         D3Q27BoundaryConditionAdapterPtr denBCAdapter(new D3Q27DensityBCAdapter(rhoLB));
+         denBCAdapter->setSecondaryBcOption(1);
+         D3Q27InteractorPtr outflowInt = D3Q27InteractorPtr( new D3Q27Interactor(outflow, grid, denBCAdapter,Interactor3D::SOLID));
+
+         MetisPartitioningGridVisitor metisVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B);
+         grid->accept( metisVisitor );
+         SolidBlocksHelper sd(grid, comm);
+         sd.addInteractor(geoInt);
+         sd.addInteractor(inflowInt);
+         sd.addInteractor(outflowInt);
+         // sd.addInteractor(plate1_1Int);
+         // sd.addInteractor(plate1_2Int);
+         // sd.addInteractor(plate1_3Int);
+         // sd.addInteractor(plate1_4Int);
+         // sd.addInteractor(plate2Int);
+         // sd.addInteractor(plate3Int);
+         if(myid == 0) UBLOG(logINFO,"line"<<__LINE__); 
+         sd.deleteSolidBlocks();  
+
+         if(myid == 0) UBLOG(logINFO,"line"<<__LINE__); 
+         grid->accept( metisVisitor );
+         sd.setTransBlocks();		 
+         if(myid == 0) UBLOG(logINFO,"line"<<__LINE__); 
+         BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname + "/grid/blocks", WbWriterVtkXmlBinary::getInstance(), comm));
+         ppblocks->update(0);
+         ppblocks.reset();
+
+         unsigned long nob = grid->getNumberOfBlocks();
+         int gl = 3;
+         unsigned long nod_temp = nob * (nodePerBlockX1+gl) * (nodePerBlockX2+gl) * (nodePerBlockX3+gl);
+         unsigned long nod = nob * (nodePerBlockX1) * (nodePerBlockX2) * (nodePerBlockX3);
+         double needMemAll  = double(nod_temp*(27*sizeof(double) + sizeof(int) + sizeof(float)*4));
+         double needMem  = needMemAll / double(comm->getNumberOfProcesses());
+
+
+         if(myid == 0)
+         {
+            UBLOG(logINFO,"Number of blocks = " << nob);
+            UBLOG(logINFO,"Number of nodes  = " << nod);
+            UBLOG(logINFO,"Necessary memory  = " << needMemAll  << " bytes");
+            UBLOG(logINFO,"Necessary memory per process = " << needMem  << " bytes");
+            UBLOG(logINFO,"Available memory per process = " << availMem << " bytes");
+         }  
+
+         LBMKernel3DPtr kernel(new LBMKernelETD3Q27CCLB(nodePerBlockX1, nodePerBlockX2, nodePerBlockX3,LBMKernelETD3Q27CCLB::MAGIC));
+
+
+
+         BCProcessorPtr bcProc(new D3Q27ETBCProcessor());
+         kernel->setBCProcessor(bcProc);
+
+         SetKernelBlockVisitor kernelVisitor(kernel, nueLB, availMem, needMem);
+         grid->accept(kernelVisitor);
+
+         if (refineLevel > 0)
+         {
+            D3Q27SetUndefinedNodesBlockVisitor undefNodesVisitor;
+            grid->accept(undefNodesVisitor);
+         }
+
+         if(myid == 0) UBLOG(logINFO,"intractor - start"); 
+         //inflow
+         grid->addAndInitInteractor(inflowInt);
+
+         //outflow
+         grid->addAndInitInteractor(outflowInt);
+         //canal
+         grid->addAndInitInteractor(geoInt);
+         // grid->addAndInitInteractor(plate1_1Int);
+         // grid->addAndInitInteractor(plate1_2Int);
+         // grid->addAndInitInteractor(plate1_3Int);
+         // grid->addAndInitInteractor(plate1_4Int);
+         // grid->addAndInitInteractor(plate2Int);
+         // grid->addAndInitInteractor(plate3Int);
+
+
+         if(myid == 0) UBLOG(logINFO,"intractor - end");
+         //////////////////////////////////////////////////////////////////////////
+         //connectoren setzen:
+
+         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
+         grid->accept( setConnsVisitor );
+         //////////////////////////////////////////////////////////////////////////	 
+         //domain decomposition
+         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
+         grid->accept(pqPartVisitor);
+
+         //////////////////////////////////////////////////////////////////////////     
+         //Stroemungsfeld initialisieren
+         //////////////////////////////////////////////////////////////////////////
+         D3Q27ETInitDistributionsBlockVisitor initVisitor(nueLB, rhoLB); //1.0
+         initVisitor.setVx1(0); 
+         grid->accept(initVisitor);
+
+         // if(myid == 0)
+         // {
+         // //Abstände "q" als Linien rausschreiben
+         // std::vector< UbTupleFloat3 > nodes;
+         // std::vector< UbTupleInt2 >   lines;
+         // geoInt->addQsLineSet(nodes, lines);
+         // WbWriterVtkXmlBinary::getInstance()->writeLines(pathname+"/grid/qs",nodes,lines);
+         // }
+
+         if(myid == 0) UBLOG(logINFO,"Preprozess - end");
+
+         ////////////////////////
+         //Set Postprozessors
+         //////////////////////////////////////////////////////////////////////////
+         {
+            UbSchedulerPtr geoSch(new UbScheduler(1));
+            D3Q27MacroscopicQuantitiesPostprocessor ppgeo(grid,geoSch, pathname + "/grid/nodes", WbWriterVtkXmlBinary::getInstance(), conv,  comm, true);
+            //grid->doPostProcess(0);
+            grid->notifyObservers(0);
+         }
+
+
+      }
+
+      //////////////////////////////////////////////////////////////////////////
+      // UbSchedulerPtr visSchAv(new UbScheduler());
+      UbSchedulerPtr visSchAv(new UbScheduler(100000,350000));
+      // visSchAv->addSchedule(100,10,1000);
+      // UbSchedulerPtr resSchAv(new UbScheduler());
+      UbSchedulerPtr resSchAv(new UbScheduler(100,10000000000));
+      // resSchAv->addSchedule(20,20,1000);
+      AverageValuesPostprocessor       Avpp(grid,  pathname + "/Turbulence/stepAV", WbWriterVtkXmlBinary::getInstance(), visSchAv/*wann wird rausgeschrieben*/,resSchAv/*wann wird resettet*/,comm);
+
+      D3Q27ShearStressPostprocessor  shear(grid,  pathname + "/shear/step", WbWriterVtkXmlBinary::getInstance(), visSchAv/*wann wird rausgeschrieben*/,resSchAv/*wann wird resettet*/); 
+      // D3Q27ShearStressPostprocessor  shear(grid,  pathname + "/shear/step", WbWriterVtkXmlBinary::getInstance(), visSchAv/*wann wird rausgeschrieben*/,resSchAv/*wann wird resettet*/,comm);
+      shear.addInteractor(geoInt);
+      ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+      UbSchedulerPtr nupsSch(new UbScheduler(1, 5, 10));
+      NUPSCounterPostprocessor npr(grid, nupsSch, pathname + "/results/nups.txt", comm);
+
+      double outTime = 10000.0;
+      UbSchedulerPtr stepSch(new UbScheduler(outTime));
+      D3Q27MacroscopicQuantitiesPostprocessor pp(grid,stepSch, pathname + "/steps/step", WbWriterVtkXmlBinary::getInstance(), conv,  comm);
+      //////////////////////////////////////////////////////////////////////////
+      //PathLine
+      UbSchedulerPtr plSch(new UbScheduler(5000, 5000));
+      const int numberofparticle=20;
+
+      std::vector<UbTupleDouble3 > potisions;
+      double randomx[numberofparticle];
+      double randomy[numberofparticle];
+      double randomz[numberofparticle];
+      double lowestx,highestx,lowesty,highesty,lowestz,highestz;
+      if(myid==0)
+      {
+         for(int i = 0; i < numberofparticle; i++)
+         {
+            double random; 
+            lowestx =-10300.0;  lowesty =-230;          lowestz =-250;
+            highestx=-9792.0;  highesty=-330;          highestz=-250; 
+
+            double rangex=(highestx-lowestx),rangey=(highesty-lowesty),rangez=(highestz-lowestz);	
+            randomx[i] = lowestx+(rangex*rand()/(RAND_MAX + 1.0));
+            randomy[i] = lowesty+(rangey*rand()/(RAND_MAX + 1.0));
+            randomz[i] = lowestz+(rangez*rand()/(RAND_MAX + 1.0));
+            //val<1>(potisions[i])= 0.506983973456;
+            //val<2>(potisions[i]) = lowesty+(rangey*rand()/(RAND_MAX + 1.0));
+            //val<3>(potisions[i]) = lowestz+(rangez*rand()/(RAND_MAX + 1.0));
+         }
+         for (int i=0;i<comm->getNumberOfProcesses();i++)
+         {
+            if (i!=0)
+            {
+               MPI_Send(randomx,numberofparticle, MPI_DOUBLE_PRECISION,i,i,MPI_COMM_WORLD);
+               MPI_Send(randomy,numberofparticle, MPI_DOUBLE_PRECISION,i,i,MPI_COMM_WORLD);
+               MPI_Send(randomz,numberofparticle, MPI_DOUBLE_PRECISION,i,i,MPI_COMM_WORLD);
+            }
+         }
+      }
+      if (myid!=0)
+      {
+         MPI_Status status; 
+         MPI_Recv(randomx,numberofparticle, MPI_DOUBLE_PRECISION,0,MPI_ANY_TAG,MPI_COMM_WORLD,&status);
+         MPI_Recv(randomy,numberofparticle, MPI_DOUBLE_PRECISION,0,MPI_ANY_TAG,MPI_COMM_WORLD,&status);
+         MPI_Recv(randomz,numberofparticle, MPI_DOUBLE_PRECISION,0,MPI_ANY_TAG,MPI_COMM_WORLD,&status);
+      }
+      for(int i = 0; i < numberofparticle; i++)
+      {	
+         potisions.push_back( makeUbTuple(randomx[i],randomy[i],randomz[i]) );
+         //val<1>(potisions[i])= 0.506983973456;
+         //val<2>(potisions[i]) = randomy[i];
+         //val<3>(potisions[i]) = randomz[i];
+      }
+      //  UBLOG(logINFO,"Rank="<<myid<<" positions  = " <<val<1>(potisions)<< " "<<val<2>(potisions)<<" "<< val<3>(potisions));
+      // D3Q27InterpolationProcessorPtr iProcessor2;
+      // D3Q27PathLinePostprocessorMcpart pathLine(grid, pathname + "/pathLine/pathLine", WbWriterVtkXmlASCII::getInstance(), conv, plSch, comm,potisions, nueLB, iProcessor);
+      //////////////////////////////////////////////////////////////////////////
+      //Simulation
+      //////////////////////////////////////////////////////////////////////////
+      return;
+
+      double endTime = 1000000000.0;
+      UbSchedulerPtr visSch(stepSch);
+      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, visSch));
+      if(myid == 0) UBLOG(logINFO,"Simulation-start");
+      calculation->calculate();
+      if(myid == 0) UBLOG(logINFO,"Simulation-end");
+
+   }
+   catch(std::exception& e)
+   {
+      cerr << e.what() << endl;
+   }
+   catch(std::string& s)
+   {
+      cerr << s << endl;
+   }
+   catch(...)
+   {
+      cerr << "unknown exception" << endl;
+   }
+
+}
diff --git a/apps/cpu/micropart/miro.txt b/apps/cpu/micropart/miro.txt
index d66356a8eb7d6dc58d65434f24a5833eb52357d2..43d3eeae73400b365e06c879de9d869cef851fed 100644
--- a/apps/cpu/micropart/miro.txt
+++ b/apps/cpu/micropart/miro.txt
@@ -1,585 +1,585 @@
-#include <iostream>
-#include <string>
-#include <map>
-#include "RefineCrossAndInsideGbObjectBlockVisitor.h"
-#include "RatioBlockVisitor.h"
-#include "RatioSmoothBlockVisitor.h"
-#include "OverlapBlockVisitor.h"
-#include "SetInterpolationDirsBlockVisitor.h"
-#include "geometry3d/GbSystem3D.h"
-#include "geometry3d/GbCuboid3D.h"
-#include "geometry3d/GbCylinder3D.h"
-#include "geometry3d/GbSphere3D.h"
-#include "BlocksPostprocessor.h"
-#include "Grid3D.h"
-#include "Patch3D.h"
-#include "Patch3DSystem.h"
-#include "Block3D.h"
-#include "LBMKernelETD3Q27Cascaded.h"
-#include "LBMKernelETD3Q27BGK.h"
-#include "CalculationManager.h" 
-#include "D3Q27SetConnectorsBlockVisitor.h" 
-#include "D3Q27ETInitDistributionsBlockVisitor.h"
-#include "D3Q27Interactor.h"
-#include "D3Q27NoSlipBCAdapter.h"
-#include "D3Q27VelocityBCAdapter.h"
-#include "D3Q27DensityBCAdapter.h"
-#include "SimulationParameters.h"
-#include "Communicator.h"
-#include "MPICommunicator.h"
-#include "SimpleGeometricPartitioner.h"
-#include "D3Q27MacroscopicQuantitiesPostprocessor.h"
-#include "D3Q27ETBCProcessor.h"
-#include "D3Q27TriFaceMeshInteractor.h"
-#include "ConfigFileReader.h"
-#include "StringUtil.hpp"
-#include "D3Q27PressureDifferencePostprocessor.h"
-#include "D3Q27IntegrateValuesHelper.h"
-#include "LBMUnitConverter.h"
-#include "NUPSCounterPostprocessor.h"
-#include "PQueuePartitioningGridVisitor.h"
-#include "SetKernelBlockVisitor.h"
-#include "GenBlocksGridVisitor.h"
-#include "D3Q27PathLinePostprocessorMcpart.h"
-#include "D3Q27SetUndefinedNodesBlockVisitor.h"
-   //
-#include "basics/writer/WbWriterVtkXmlBinary.h"
-#include "basics/writer/WbWriterVtkXmlASCII.h"
-#include "geometry3d/creator/GbTriFaceMesh3DCreator.h"
-#include "geometry3d/GbTriFaceMesh3D.h"
-#include "D3Q27System.h"
-#include <basics/transmitter/TbTransmitterMpiPool.h>
-#include "MathUtil.hpp"
-#include "D3Q27OffsetInterpolationProcessor.h"
-#include "SolidBlocksHelper.h"
-#include "MetisPartitioningGridVisitor.h"
-#include "RestartPostprocessor.h"
-#include "D3Q27IncompressibleOffsetInterpolationProcessor.h"
-#include "LBMKernelETD3Q27CCLB.h"
-#include "AverageValuesPostprocessor.h"
-#include <vfluids.h>
-using namespace std;
-
-void micropartTestQs2(const char *cstr)
-{
-   try
-   {
-      CommunicatorPtr comm(new MPICommunicator());
-      int myid = comm->getProcessID();
-      int numprocs = comm->getNumberOfProcesses();
-
-      string machine = QUOTEME(CAB_MACHINE);
-      string pathname; 
-      double availMem = 0;
-      string geoFile;
-      int numOfThreads = 1;
-
-      if(machine == "EHSAN1491") 
-      {
-         pathname = "/work/ehsan/micropart";
-         availMem = 3.0e9;
-		  int numOfThreads = 1;
-         //geoFile = "c:/Data/micropart/DK19_7_02_Martin.stl";
-         //geoFile = "c:/Data/micropart/ktoolcav.stl";
-         //geoFile = "c:/Data/micropart/boxN.stl";
-        geoFile = "C:/Users/ehsan/Desktop/meshparticles/E0019B_mit_Radien.stl";
-      }
-      else if(machine == "M01" || machine == "M02")      
-      {
-         pathname = "/work/ehsan/micropart";
-         availMem = 12.0e9;
-		  geoFile = "/work/ehsan/data/E0019B_mit_Radien.stl";
-         //geoFile = "/home/koskuche/data/micropart/DK19_7_02_Martin.stl";
-
-         numOfThreads = 1;
-         if(myid ==0)
-         {
-            stringstream logFilename;
-            logFilename <<  pathname + "/logfile"+UbSystem::toString(UbSystem::getTimeStamp())+".txt";
-            UbLog::output_policy::setStream(logFilename.str());
-         }
-      }
-      else throw UbException(UB_EXARGS, "unknown CAB_MACHINE");
-
-      UbLog::reportingLevel() = logINFO;
-      //UbLog::reportingLevel() = logDEBUG1;
-
-      int nodePerBlockX1 =16; //Anzahl an Knoten pro Block
-      int nodePerBlockX2 =16;//(int)16;
-      int nodePerBlockX3 =8;//8; //(int)16;
-
-      double bH = nodePerBlockX1;    //gewuenschte Rand- und Blockbreite
-
-      //Simulation Parameters
-      const int baseLevel = 0;
-      const int refineLevel =4;
-      //length [m]
-      double lSI = 219;//223.2;
-      //length [LB]
-      double lLB = 30;
-
-      double dx =lSI/lLB;
-
-      double left_offset = 10700;//*0.5;
-      double right_offset  = 107000;//0.5;//2*0.5
-      double front_offset = 750;//0.15;
-      double back_offset  = 750;//0.15;
-      double top_offset = 250;//0.0;
-      double bottom_offset  =750;// 70;//0.07;
-	  
-	   LBMReal vLB =0.00016103/5.0*sqrt(2.0);//0.00016103;
-       LBMReal Re;
-       LBMReal rhoLB = 0.0;
-       LBMReal nueLB = 0.0000249;//(vLB*lLB)/Re;
-       Re = (vLB*(500/dx))/nueLB;
-       double dp_Ph=200.0*100000;//
-	   double dp_lb=dp_Ph*0.001*(nueLB*dx)*(nueLB*dx);//nue_ph=10e-6 and dx is in micrometer
-      // LBMReal nueLB = 0.000016103;
-      // LBMReal Re=15000;
-      // LBMReal rhoLB = 0.0;
-      // LBMReal vLB =nueLB*Re/(500.0/dx);
-     // // Re = (vLB*(0.303/dx))/nueLB;
-	   // //Re = (vLB*lLB)/nueLB;
-	  
-      // LBMReal rhoWord = 1e-15;//kg/micrometre^3;//1000.0;
-	  // LBMReal nueRE = 1e6;//micromter^2/s;//0.000001;
-	  // LBMReal  vWorld=300*1e6;//micrometer/s;//nueRE*Re/ (lSI*4.0/9.0);
-	  LBMUnitConverterPtr conv = LBMUnitConverterPtr(new LBMUnitConverter());
-      //conv->init(lSI*1e-6,30000,rhoWord,vWorld,lLB,1.0/*rhoLB*/,vLB);
-      
-	 
- //////////////////////////////////////////////////////////////////////////
-      GbObject3DPtr refineCube1(new  GbCuboid3D(-500.0+5.0/*-354.0*/,-957.0/*-280.0*/,-684.0/* -72.0*/, 4100/*370.0*/,957.0/*354.0*/,70.0));//-530.0,-280.0, -72.0, 530.0,354.0,70.0));
-      if(myid == 0) GbSystem3D::writeGeoObject(refineCube1.get(), pathname+"/geo/refineCube1", WbWriterVtkXmlASCII::getInstance());
-
-      GbObject3DPtr refineCube2(new  GbCuboid3D(-230.0,-90.0, -684.0/*-72.0*/, 600,100.0,70.0));
-      if(myid == 0) GbSystem3D::writeGeoObject(refineCube2.get(), pathname+"/geo/refineCube2", WbWriterVtkXmlASCII::getInstance());
-	  
-	   GbObject3DPtr refineCube3(new  GbCuboid3D(-350.0,-957.0/*-120.0*/,-684.0/*-684.0*//* -72.0*/, 1700,957.0/*120.0*/,70.0));
-      if(myid == 0) GbSystem3D::writeGeoObject(refineCube3.get(), pathname+"/geo/refineCube3", WbWriterVtkXmlASCII::getInstance());
-	  
-	   GbObject3DPtr refineCube4(new  GbCuboid3D(-170.0,-60.0, -684.0/*-72.0*/, 200,60.0,70.0));
-      if(myid == 0) GbSystem3D::writeGeoObject(refineCube4.get(), pathname+"/geo/refineCube4", WbWriterVtkXmlASCII::getInstance());
-	  
-	   GbObject3DPtr refineCubeInlet(new  GbCuboid3D(-10600.0,-600.0, -600.0/*-72.0*/, -9000,600.0,60.0));
-      if(myid == 0) GbSystem3D::writeGeoObject(refineCubeInlet.get(), pathname+"/geo/refineCubeInlet", WbWriterVtkXmlASCII::getInstance());
-	  
-	  GbObject3DPtr refineCubeOutlet(new  GbCuboid3D(9000,-600.0, -600.0/*-72.0*/,10550.0 ,600.0,60.0));
-      if(myid == 0) GbSystem3D::writeGeoObject(refineCubeOutlet.get(), pathname+"/geo/refineCubeOutlet", WbWriterVtkXmlASCII::getInstance());
-      //////////////////////////////////////////////////////////////////////////
-      D3Q27TriFaceMeshInteractorPtr geoInt;
-	  /////////////////
-      //Grid3DPtr grid(new Grid3D());
-        Grid3DPtr grid(new Grid3D(comm));
-
-      UbSchedulerPtr rSch(new UbScheduler());
-      rSch->addSchedule(100, 200, 20000);
-      RestartPostprocessorPtr rp(new RestartPostprocessor(grid, rSch, comm, pathname+"/checkpoints", RestartPostprocessor::BINARY));
-
-      std::string opt;
-         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
-
-      if(cstr!= NULL)
-         opt = std::string(cstr);
-
-      if/*(cstr== NULL)*/(cstr!= NULL)
-      {
-         if(myid==0) UBLOG(logINFO,"Restart step: " << opt);
-         grid = rp->restart(UbSystem::stringTo<int>(opt));
-         rp->reconnect(grid);
-
-         // SetForcingBlockVisitor forcingVisitor(0.0, 0.0, 0.0);
-         // grid->accept(forcingVisitor);
-
-         //D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
-         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
-         grid->accept( setConnsVisitor );
-		  if(myid==0) UBLOG(logINFO,"Restart finish: " << opt);
-	 
-      }
-      else
-      {
-         if(myid ==0)
-         {
-            UBLOG(logINFO,"L = " <<lLB );
-            UBLOG(logINFO,"v = " <<vLB );
-            UBLOG(logINFO,"rho = " <<rhoLB );
-            UBLOG(logINFO,"nue = " << nueLB );
-			UBLOG(logINFO,"dx = " << dx );
-            UBLOG(logINFO,"Re = " << Re );
-			 UBLOG(logINFO,"dp_lb = " << dp_lb );
-            UBLOG(logINFO,"Preprozess - start");
-         }
-
-
-         ////////////////////////////////////////////////////////////////////////
-         //Grid
-         //////////////////////////////////////////////////////////////////////////
-         grid->setDeltaX(dx);
-         grid->setBlockNX(nodePerBlockX1, nodePerBlockX2, nodePerBlockX3);
-
-         ////////////////////////////////////////////////////////////////////////////
-         //// Geometrie
-         ////////////////////////////////////////////////////////////////////////////
-         GbTriFaceMesh3DPtr geo (GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(geoFile,"geo"));
-
-         if(myid == 0) GbSystem3D::writeGeoObject(geo.get(), pathname+"/geo/geo", WbWriterVtkXmlASCII::getInstance());
-
-         ////////////////////////////////////////////////////////////////////////////
-         //// Randgeometrien erstellen
-         ////////////////////////////////////////////////////////////////////////////
-         double shiftForMG=grid->getDeltaX(refineLevel)*nodePerBlockX1 / 3.0*2.0;
-          GbCuboid3DPtr plate1  = GbCuboid3DPtr( new GbCuboid3D( -7.5, -1.515e-1, -6.831e-2, 7.5, 1.515e-1, 0.0 ));
-
-           GbCuboid3DPtr plate2  = GbCuboid3DPtr( new GbCuboid3D( -1.5e-1, -16.51e-1, -16.831e-2, 1.5e-1, -1.6e-2, 1.0 ));
-           GbCuboid3DPtr plate3  = GbCuboid3DPtr( new GbCuboid3D( -1.5e-1, 1.6e-2, -16.831e-2, 1.5e-1, 16.515e-1, 1.0 ));
-
-          // GbCuboid3DPtr plate1_1  = GbCuboid3DPtr( new GbCuboid3D( -7.5, -2.515e-1, -1.0e-1, 7.5, 2.515e-1, -6.831e-2 ));
-          // GbCuboid3DPtr plate1_2  = GbCuboid3DPtr( new GbCuboid3D( -7.5, -2.515e-1, -0.0000001, 7.5, 2.515e-1, 1.0e-1 ));
-          // GbCuboid3DPtr plate1_3  = GbCuboid3DPtr( new GbCuboid3D( -7.5, 1.515e-1, -6.831e-2, 7.5, 2.515e-1, 0.0  ));
-          // GbCuboid3DPtr plate1_4  = GbCuboid3DPtr( new GbCuboid3D( -7.5, -2.515e-1, 0.0, 7.5, -1.515e-1, -1.0e-1 ));
-
-          // GbCuboid3DPtr inflow  = GbCuboid3DPtr( new GbCuboid3D( -8.0, -1.0, -1.0, -7.5, 1.0, 1.0 ));
-          // GbCuboid3DPtr outflow = GbCuboid3DPtr( new GbCuboid3D( 7.5, -1.0, -1.0, 8.0, 1.0, 1.0 ));
-		  
-		   // GbCuboid3DPtr plate2  = GbCuboid3DPtr( new GbCuboid3D( -1.5e-1, -16.51e-1, -16.831e-2, 1.5e-1, -1.6e-2, 1.0 ));
-          // GbCuboid3DPtr plate3  = GbCuboid3DPtr( new GbCuboid3D( -1.5e-1, 1.6e-2, -16.831e-2, 1.5e-1, 16.515e-1, 1.0 ));
-
-          // GbCuboid3DPtr plate1_1  = GbCuboid3DPtr( new GbCuboid3D( -left_offset-bH*dx, back_offset, -bottom_offset-bH*dx, right_offset+bH*dx, back_offset+bH*dx, top_offset+bH*dx ));
-          // GbCuboid3DPtr plate1_2  = GbCuboid3DPtr( new GbCuboid3D( -left_offset-bH*dx, -front_offset-bH*dx, -bottom_offset-bH*dx, right_offset+bH*dx, -front_offset, top_offset+bH*dx ));
-          // GbCuboid3DPtr plate1_3  = GbCuboid3DPtr( new GbCuboid3D( -left_offset-bH*dx, -front_offset-bH*dx, top_offset, right_offset+bH*dx, back_offset+bH*dx, top_offset+bH*dx+2.0*dx ));
-          // GbCuboid3DPtr plate1_4  = GbCuboid3DPtr( new GbCuboid3D( -left_offset-bH*dx, -front_offset-bH*dx, -bottom_offset-bH*dx, right_offset+bH*dx, back_offset+bH*dx, -bottom_offset ));
-
-          //GbCuboid3DPtr inflow  = GbCuboid3DPtr( new GbCuboid3D( -left_offset-5*bH*dx, -front_offset-5*bH*dx, -bottom_offset-5*bH*dx, -left_offset, back_offset+5*bH*dx, top_offset+5*bH*dx ));
-          //GbCuboid3DPtr outflow = GbCuboid3DPtr( new GbCuboid3D( right_offset, -front_offset-5*bH*dx, -bottom_offset-5*bH*dx, right_offset+5.0*bH*dx, back_offset+5*bH*dx, top_offset+5*bH*dx ));
-		  GbCuboid3DPtr inflow  = GbCuboid3DPtr( new GbCuboid3D( -11000.0,-600.0, -600.0, -9000.0, 600.0, -500 ));
-		  GbCuboid3DPtr outflow = GbCuboid3DPtr( new GbCuboid3D( 9000,-600.0, -600.0, 11000.0, 600.0, -500));
-
-
-		   GbObject3DPtr gridCube(new GbCuboid3D(-10700.0/*inflow->getX1Maximum()-4.0*dx/*.5*shiftForMG*/,-550.0/*-270*/ , -550.0/*-70*/,
-                                                10700.0/*outflow->getX1Minimum()+4.0*dx/*.5*shiftForMG*/, 
-                                                550.0/*270*/, 
-                                                23.0/*10.0*/));
-
-         GenBlocksGridVisitor genBlocks;
-         genBlocks.addGeoObject(gridCube);
-         grid->accept(genBlocks);
-		  
-         if(myid == 0)
-         {
-            GbSystem3D::writeGeoObject(gridCube.get(),pathname+"/geo/gridCube", WbWriterVtkXmlASCII::getInstance());
-            //GbSystem3D::writeGeoObject(plate2.get(),pathname+"/geo/plate2", WbWriterVtkXmlASCII::getInstance());
-            //GbSystem3D::writeGeoObject(plate3.get(),pathname+"/geo/plate3", WbWriterVtkXmlASCII::getInstance());
-
-            // GbSystem3D::writeGeoObject(plate1_1.get(),pathname+"/geo/plate1_1", WbWriterVtkXmlASCII::getInstance());
-            // GbSystem3D::writeGeoObject(plate1_2.get(),pathname+"/geo/plate1_2", WbWriterVtkXmlASCII::getInstance());
-            // GbSystem3D::writeGeoObject(plate1_3.get(),pathname+"/geo/plate1_3", WbWriterVtkXmlASCII::getInstance());
-            // GbSystem3D::writeGeoObject(plate1_4.get(),pathname+"/geo/plate1_4", WbWriterVtkXmlASCII::getInstance());
-
-            GbSystem3D::writeGeoObject(inflow.get(),pathname+"/geo/inflow", WbWriterVtkXmlASCII::getInstance());
-            GbSystem3D::writeGeoObject(outflow.get(),pathname+"/geo/outflow", WbWriterVtkXmlASCII::getInstance());
-         }
-   
-
-         if (refineLevel > 0)
-         {
-		  if(myid == 0) UBLOG(logINFO,"Refinement - start");   
-            RefineCrossAndInsideGbObjectHelper refineHelper(grid, refineLevel);
-            refineHelper.addGbObject(refineCube1, 1);
-            refineHelper.addGbObject(refineCube3, 2);
-			 refineHelper.addGbObject(refineCube2, 3);
-			 refineHelper.addGbObject(refineCube4, 4);
-			 
-			 refineHelper.addGbObject(refineCubeInlet, 1);
-			 refineHelper.addGbObject(refineCubeOutlet, 1);
-            refineHelper.refine();
-            if(myid == 0) UBLOG(logINFO,"Refinement - end");   
-		 
-		 
-           // RefineCrossAndInsideGbObjectBlockVisitor refVisitor1(refineCube1, refineLevel-4);
-            // grid->accept(refVisitor1);
-
-			// RefineCrossAndInsideGbObjectBlockVisitor refVisitor3(refineCube3, refineLevel-3);
-            // grid->accept(refVisitor3);
-
-            // RefineCrossAndInsideGbObjectBlockVisitor refVisitor2(refineCube2, refineLevel-2);
-            // grid->accept(refVisitor2);
-			
-			 // RefineCrossAndInsideGbObjectBlockVisitor refVisitor4(refineCube4, refineLevel-1);
-            // grid->accept(refVisitor4);
-
-            // RatioBlockVisitor ratioVisitor(refineLevel);
-            // grid->accept(ratioVisitor);
-
-            // RatioSmoothBlockVisitor ratioSmoothVisitor(refineLevel);
-            // grid->accept(ratioSmoothVisitor);
-
-            // OverlapBlockVisitor overlapVisitor(refineLevel);
-            // grid->accept(overlapVisitor);
-
-            // std::vector<int> dirs;
-            // D3Q27System::getLBMDirections(dirs);
-            // SetInterpolationDirsBlockVisitor interDirsVisitor(dirs);
-            // grid->accept(interDirsVisitor);
-            // if(myid == 0) UBLOG(logINFO,"Refinement - end");	
-         }
-
-         //////////////////////////////////////////////////////////////////////////
-         //INTERAKTOREN SETZEN (=Randbedingungen)
-         //////////////////////////////////////////////////////////////////////////
-         //oben/unten = Haftrand
-         int bbOption = 1; //0=simple Bounce Back, 1=quadr. BB
-         D3Q27BoundaryConditionAdapterPtr bcObst(new D3Q27NoSlipBCAdapter(bbOption));
-         geoInt = D3Q27TriFaceMeshInteractorPtr( new D3Q27TriFaceMeshInteractor(geo, grid, D3Q27BoundaryConditionAdapterPtr(new D3Q27NoSlipBCAdapter(bbOption)),Interactor3D::INVERSESOLID, Interactor3D::SIMPLE));
-	     geoInt->setUseHalfSpaceCheck(true);
-         geoInt->setRegardPointInObjectTest(true);
-         if(myid == 0) UBLOG(logINFO,"stl - end"); 
-         //D3Q27InteractorPtr plate1Int(new D3Q27Interactor(plate1, grid, bcObst,Interactor3D::INVERSESOLID));
-         // D3Q27InteractorPtr plate2Int(new D3Q27Interactor(plate2, grid, bcObst,Interactor3D::SOLID));
-         // D3Q27InteractorPtr plate3Int(new D3Q27Interactor(plate3, grid, bcObst,Interactor3D::SOLID));
-
-         // D3Q27InteractorPtr plate1_1Int(new D3Q27Interactor(plate1_1, grid, bcObst,Interactor3D::SOLID));
-         // D3Q27InteractorPtr plate1_2Int(new D3Q27Interactor(plate1_2, grid, bcObst,Interactor3D::SOLID));
-         // D3Q27InteractorPtr plate1_3Int(new D3Q27Interactor(plate1_3, grid, bcObst,Interactor3D::SOLID));
-         // D3Q27InteractorPtr plate1_4Int(new D3Q27Interactor(plate1_4, grid, bcObst,Interactor3D::SOLID));
-
-         //links: geschwindigkeits-einfluss
-         //Velocity-BC
-         //////////////////////////////////////////////////////////////////////////
-         mu::Parser fct;
-         fct.DefineConst("vx1"  , vLB*9.0/4.0 );
-         //fct = MathUtil::getDuctParaboloidX(0, 250*2.0, -51.08/2, 51.08, vLB*9.0/4.0);
-         fct.SetExpr("vx1");
-         //////////////////////////////////////////////////////////////////////////
-
-         //////////////////////////////////////////////////////////////////////////
-            // D3Q27BoundaryConditionAdapterPtr velBCAdapter = D3Q27BoundaryConditionAdapterPtr(new D3Q27VelocityBCAdapter (false, false ,true ,fct, 0, D3Q27BCFunction::INFCONST));
-            // velBCAdapter->setSecondaryBcOption(2);
-            // D3Q27InteractorPtr inflowInt  = D3Q27InteractorPtr( new D3Q27Interactor(inflow, grid, velBCAdapter, Interactor3D::SOLID));
-
-		 D3Q27BoundaryConditionAdapterPtr denBCAdapterInlet(new D3Q27DensityBCAdapter(3.0*(dp_lb-rhoLB)));
-        denBCAdapterInlet->setSecondaryBcOption(1);
-        D3Q27InteractorPtr inflowInt = D3Q27InteractorPtr( new D3Q27Interactor(inflow, grid, denBCAdapterInlet,Interactor3D::SOLID));
-		 
-         //rechts: druckrand
-         //Density-BC
-         //fuer Kompressibles Modell  rho = 1.0
-         D3Q27BoundaryConditionAdapterPtr denBCAdapter(new D3Q27DensityBCAdapter(rhoLB));
-         denBCAdapter->setSecondaryBcOption(1);
-         D3Q27InteractorPtr outflowInt = D3Q27InteractorPtr( new D3Q27Interactor(outflow, grid, denBCAdapter,Interactor3D::SOLID));
-
-         MetisPartitioningGridVisitor metisVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B);
-         grid->accept( metisVisitor );
-         SolidBlocksHelper sd(grid, comm);
-         sd.addInteractor(geoInt);
-         sd.addInteractor(inflowInt);
-         sd.addInteractor(outflowInt);
-         // sd.addInteractor(plate1_1Int);
-         // sd.addInteractor(plate1_2Int);
-         // sd.addInteractor(plate1_3Int);
-         // sd.addInteractor(plate1_4Int);
-         // sd.addInteractor(plate2Int);
-         // sd.addInteractor(plate3Int);
-		 if(myid == 0) UBLOG(logINFO,"line"<<__LINE__); 
-         sd.deleteSolidBlocks();     
- if(myid == 0) UBLOG(logINFO,"line"<<__LINE__); 
-         grid->accept( metisVisitor );
-if(myid == 0) UBLOG(logINFO,"line"<<__LINE__); 
-         BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname + "/grid/blocks", WbWriterVtkXmlBinary::getInstance(), comm));
-         ppblocks->update(0);
-         ppblocks.reset();
-
-         unsigned long nob = grid->getNumberOfBlocks();
-         int gl = 3;
-         unsigned long nod_temp = nob * (nodePerBlockX1+gl) * (nodePerBlockX2+gl) * (nodePerBlockX3+gl);
-         unsigned long nod = nob * (nodePerBlockX1) * (nodePerBlockX2) * (nodePerBlockX3);
-         double needMemAll  = double(nod_temp*(27*sizeof(double) + sizeof(int) + sizeof(float)*4));
-         double needMem  = needMemAll / double(comm->getNumberOfProcesses());
-
-
-         if(myid == 0)
-         {
-            UBLOG(logINFO,"Number of blocks = " << nob);
-            UBLOG(logINFO,"Number of nodes  = " << nod);
-            UBLOG(logINFO,"Necessary memory  = " << needMemAll  << " bytes");
-            UBLOG(logINFO,"Necessary memory per process = " << needMem  << " bytes");
-            UBLOG(logINFO,"Available memory per process = " << availMem << " bytes");
-         }  
-
-         //LBMKernel3DPtr kernel(new LBMKernelETD3Q27Cascaded(nodePerBlockX1, nodePerBlockX2, nodePerBlockX2));
-         //LBMKernel3DPtr kernel(new LBMKernelETD3Q27CCLB(nodePerBlockX1, nodePerBlockX2, nodePerBlockX2));
-
-		  int option = 0;
-		 LBMKernel3DPtr kernel(new LBMKernelETD3Q27CCLB(nodePerBlockX1, nodePerBlockX2, nodePerBlockX3,option));
-
-		 
-		 
-         BCProcessorPtr bcProc(new D3Q27ETBCProcessor());
-         kernel->setBCProcessor(bcProc);
-
-         SetKernelBlockVisitor kernelVisitor(kernel, nueLB, availMem, needMem);
-         grid->accept(kernelVisitor);
-
-         if (refineLevel > 0)
-         {
-            D3Q27SetUndefinedNodesBlockVisitor undefNodesVisitor;
-            grid->accept(undefNodesVisitor);
-         }
-		 
-		  if(myid == 0) UBLOG(logINFO,"intractor - start"); 
-          //inflow
-         grid->addAndInitInteractor(inflowInt);
-
-         //outflow
-         grid->addAndInitInteractor(outflowInt);
-         //canal
-         grid->addAndInitInteractor(geoInt);
-         // grid->addAndInitInteractor(plate1_1Int);
-         // grid->addAndInitInteractor(plate1_2Int);
-         // grid->addAndInitInteractor(plate1_3Int);
-         // grid->addAndInitInteractor(plate1_4Int);
-         // grid->addAndInitInteractor(plate2Int);
-         // grid->addAndInitInteractor(plate3Int);
-
-       
-
-         //////////////////////////////////////////////////////////////////////////
-         //connectoren setzen:
-
-         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
-         grid->accept( setConnsVisitor );
-         //////////////////////////////////////////////////////////////////////////	 
-         //domain decomposition
-         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
-         grid->accept(pqPartVisitor);
-			 
-         //////////////////////////////////////////////////////////////////////////     
-	   //Stroemungsfeld initialisieren
-         //////////////////////////////////////////////////////////////////////////
-         D3Q27ETInitDistributionsBlockVisitor initVisitor(rhoLB); //1.0
-         initVisitor.setVx1(0); 
-         grid->accept(initVisitor);
-
-         if(myid == 0)
-         {
-            //Abst�nde "q" als Linien rausschreiben
-            std::vector< UbTupleFloat3 > nodes;
-            std::vector< UbTupleInt2 >   lines;
-            geoInt->addQsLineSet(nodes, lines);
-            WbWriterVtkXmlBinary::getInstance()->writeLines(pathname+"/grid/qs",nodes,lines);
-         }
-
-          if(myid == 0) UBLOG(logINFO,"Preprozess - end");
-		 
-		 	  ////////////////////////
-           //Set Postprozessors
-           //////////////////////////////////////////////////////////////////////////
-           {
-            UbSchedulerPtr geoSch(new UbScheduler(1));
-            D3Q27MacroscopicQuantitiesPostprocessor ppgeo(grid,geoSch, pathname + "/grid/nodes", WbWriterVtkXmlBinary::getInstance(), conv,  comm, true);
-            grid->doPostProcess(0);
-           }
-	    
-
-      }
-
-      //////////////////////////////////////////////////////////////////////////
-	   // UbSchedulerPtr visSchAv(new UbScheduler());
-		UbSchedulerPtr visSchAv(new UbScheduler(100,100));
-      // visSchAv->addSchedule(100,10,1000);
-      // UbSchedulerPtr resSchAv(new UbScheduler());
-	   UbSchedulerPtr resSchAv(new UbScheduler(100,100));
-      // resSchAv->addSchedule(20,20,1000);
-      AverageValuesPostprocessor       Avpp(grid,  pathname + "/Turbulence/stepAV", WbWriterVtkXmlBinary::getInstance(), visSchAv/*wann wird rausgeschrieben*/,resSchAv/*wann wird resettet*/,comm);
-	  
-	 D3Q27ShearStressPostprocessor  shear(grid,  pathname + "/shear/step", WbWriterVtkXmlBinary::getInstance(), visSchAv/*wann wird rausgeschrieben*/,resSchAv/*wann wird resettet*/,comm,iProcessor); 
-	 // D3Q27ShearStressPostprocessor  shear(grid,  pathname + "/shear/step", WbWriterVtkXmlBinary::getInstance(), visSchAv/*wann wird rausgeschrieben*/,resSchAv/*wann wird resettet*/,comm);
-	  shear.addInteractor(geoInt);
-	   ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-	  
-
-      UbSchedulerPtr nupsSch(new UbScheduler(1, 5, 10));
-      NUPSCounterPostprocessor npr(grid, nupsSch, pathname + "/results/nups.txt", comm);
-
-      double outTime = 100.0;
-      UbSchedulerPtr stepSch(new UbScheduler(outTime));
-      D3Q27MacroscopicQuantitiesPostprocessor pp(grid,stepSch, pathname + "/steps/step", WbWriterVtkXmlBinary::getInstance(), conv,  comm);
-      //////////////////////////////////////////////////////////////////////////
-      //PathLine
-       UbSchedulerPtr plSch(new UbScheduler(5000, 5000));
-      const int numberofparticle=20;
-	
-	  std::vector<UbTupleDouble3 > potisions;
-	  double randomx[numberofparticle];
-	  double randomy[numberofparticle];
-	  double randomz[numberofparticle];
-	  double lowestx,highestx,lowesty,highesty,lowestz,highestz;
-	  if(myid==0)
-	  {
-		  for(int i = 0; i < numberofparticle; i++)
-		  {
-			  double random; 
-	        lowestx =-10300.0;  lowesty =-230;          lowestz =-250;
-	        highestx=-9792.0;  highesty=-330;          highestz=-250; 
-		  
-	      double rangex=(highestx-lowestx),rangey=(highesty-lowesty),rangez=(highestz-lowestz);	
-           randomx[i] = lowestx+(rangex*rand()/(RAND_MAX + 1.0));
-		   randomy[i] = lowesty+(rangey*rand()/(RAND_MAX + 1.0));
-	       randomz[i] = lowestz+(rangez*rand()/(RAND_MAX + 1.0));
-		  //val<1>(potisions[i])= 0.506983973456;
-		  //val<2>(potisions[i]) = lowesty+(rangey*rand()/(RAND_MAX + 1.0));
-		   //val<3>(potisions[i]) = lowestz+(rangez*rand()/(RAND_MAX + 1.0));
-		  }
-		  for (int i=0;i<comm->getNumberOfProcesses();i++)
-		  {
-			  if (i!=0)
-			  {
-			      MPI_Send(randomx,numberofparticle, MPI_DOUBLE_PRECISION,i,i,MPI_COMM_WORLD);
-				  MPI_Send(randomy,numberofparticle, MPI_DOUBLE_PRECISION,i,i,MPI_COMM_WORLD);
-				  MPI_Send(randomz,numberofparticle, MPI_DOUBLE_PRECISION,i,i,MPI_COMM_WORLD);
-			  }
-		  }
-	  }
-	  if (myid!=0)
-	  {
-		  MPI_Status status; 
-		  MPI_Recv(randomx,numberofparticle, MPI_DOUBLE_PRECISION,0,MPI_ANY_TAG,MPI_COMM_WORLD,&status);
-		  MPI_Recv(randomy,numberofparticle, MPI_DOUBLE_PRECISION,0,MPI_ANY_TAG,MPI_COMM_WORLD,&status);
-		  MPI_Recv(randomz,numberofparticle, MPI_DOUBLE_PRECISION,0,MPI_ANY_TAG,MPI_COMM_WORLD,&status);
-	  }
-	  for(int i = 0; i < numberofparticle; i++)
-	  {	
-		  potisions.push_back( makeUbTuple(randomx[i],randomy[i],randomz[i]) );
-		  //val<1>(potisions[i])= 0.506983973456;
-		  //val<2>(potisions[i]) = randomy[i];
-		  //val<3>(potisions[i]) = randomz[i];
-	  }
-	 //  UBLOG(logINFO,"Rank="<<myid<<" positions  = " <<val<1>(potisions)<< " "<<val<2>(potisions)<<" "<< val<3>(potisions));
-	 // D3Q27InterpolationProcessorPtr iProcessor2;
-     // D3Q27PathLinePostprocessorMcpart pathLine(grid, pathname + "/pathLine/pathLine", WbWriterVtkXmlASCII::getInstance(), conv, plSch, comm,potisions, nueLB, iProcessor);
-      //////////////////////////////////////////////////////////////////////////
-      //Simulation
-      //////////////////////////////////////////////////////////////////////////
-
-	  double endTime = 1000.0;
-      UbSchedulerPtr visSch(stepSch);
-      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, visSch));
-      if(myid == 0) UBLOG(logINFO,"Simulation-start");
-      calculation->calculate();
-      if(myid == 0) UBLOG(logINFO,"Simulation-end");
-
-   }
-   catch(std::exception& e)
-   {
-      cerr << e.what() << endl;
-   }
-   catch(std::string& s)
-   {
-      cerr << s << endl;
-   }
-   catch(...)
-   {
-      cerr << "unknown exception" << endl;
-   }
-
-}
+#include <iostream>
+#include <string>
+#include <map>
+#include "RefineCrossAndInsideGbObjectBlockVisitor.h"
+#include "RatioBlockVisitor.h"
+#include "RatioSmoothBlockVisitor.h"
+#include "OverlapBlockVisitor.h"
+#include "SetInterpolationDirsBlockVisitor.h"
+#include "geometry3d/GbSystem3D.h"
+#include "geometry3d/GbCuboid3D.h"
+#include "geometry3d/GbCylinder3D.h"
+#include "geometry3d/GbSphere3D.h"
+#include "BlocksPostprocessor.h"
+#include "Grid3D.h"
+#include "Patch3D.h"
+#include "Patch3DSystem.h"
+#include "Block3D.h"
+#include "LBMKernelETD3Q27Cascaded.h"
+#include "LBMKernelETD3Q27BGK.h"
+#include "CalculationManager.h" 
+#include "D3Q27SetConnectorsBlockVisitor.h" 
+#include "D3Q27ETInitDistributionsBlockVisitor.h"
+#include "D3Q27Interactor.h"
+#include "D3Q27NoSlipBCAdapter.h"
+#include "D3Q27VelocityBCAdapter.h"
+#include "D3Q27DensityBCAdapter.h"
+#include "SimulationParameters.h"
+#include "Communicator.h"
+#include "MPICommunicator.h"
+#include "SimpleGeometricPartitioner.h"
+#include "D3Q27MacroscopicQuantitiesPostprocessor.h"
+#include "D3Q27ETBCProcessor.h"
+#include "D3Q27TriFaceMeshInteractor.h"
+#include "ConfigFileReader.h"
+#include "StringUtil.hpp"
+#include "D3Q27PressureDifferencePostprocessor.h"
+#include "D3Q27IntegrateValuesHelper.h"
+#include "LBMUnitConverter.h"
+#include "NUPSCounterPostprocessor.h"
+#include "PQueuePartitioningGridVisitor.h"
+#include "SetKernelBlockVisitor.h"
+#include "GenBlocksGridVisitor.h"
+#include "D3Q27PathLinePostprocessorMcpart.h"
+#include "D3Q27SetUndefinedNodesBlockVisitor.h"
+   //
+#include "basics/writer/WbWriterVtkXmlBinary.h"
+#include "basics/writer/WbWriterVtkXmlASCII.h"
+#include "geometry3d/creator/GbTriFaceMesh3DCreator.h"
+#include "geometry3d/GbTriFaceMesh3D.h"
+#include "D3Q27System.h"
+#include <basics/transmitter/TbTransmitterMpiPool.h>
+#include "MathUtil.hpp"
+#include "D3Q27OffsetInterpolationProcessor.h"
+#include "SolidBlocksHelper.h"
+#include "MetisPartitioningGridVisitor.h"
+#include "RestartPostprocessor.h"
+#include "D3Q27IncompressibleOffsetInterpolationProcessor.h"
+#include "LBMKernelETD3Q27CCLB.h"
+#include "AverageValuesPostprocessor.h"
+#include <vfluids.h>
+using namespace std;
+
+void micropartTestQs2(const char *cstr)
+{
+   try
+   {
+      CommunicatorPtr comm(new MPICommunicator());
+      int myid = comm->getProcessID();
+      int numprocs = comm->getNumberOfProcesses();
+
+      string machine = QUOTEME(CAB_MACHINE);
+      string pathname; 
+      double availMem = 0;
+      string geoFile;
+      int numOfThreads = 1;
+
+      if(machine == "EHSAN1491") 
+      {
+         pathname = "/work/ehsan/micropart";
+         availMem = 3.0e9;
+		  int numOfThreads = 1;
+         //geoFile = "c:/Data/micropart/DK19_7_02_Martin.stl";
+         //geoFile = "c:/Data/micropart/ktoolcav.stl";
+         //geoFile = "c:/Data/micropart/boxN.stl";
+        geoFile = "C:/Users/ehsan/Desktop/meshparticles/E0019B_mit_Radien.stl";
+      }
+      else if(machine == "M01" || machine == "M02")      
+      {
+         pathname = "/work/ehsan/micropart";
+         availMem = 12.0e9;
+		  geoFile = "/work/ehsan/data/E0019B_mit_Radien.stl";
+         //geoFile = "/home/koskuche/data/micropart/DK19_7_02_Martin.stl";
+
+         numOfThreads = 1;
+         if(myid ==0)
+         {
+            stringstream logFilename;
+            logFilename <<  pathname + "/logfile"+UbSystem::toString(UbSystem::getTimeStamp())+".txt";
+            UbLog::output_policy::setStream(logFilename.str());
+         }
+      }
+      else throw UbException(UB_EXARGS, "unknown CAB_MACHINE");
+
+      UbLog::reportingLevel() = logINFO;
+      //UbLog::reportingLevel() = logDEBUG1;
+
+      int nodePerBlockX1 =16; //Anzahl an Knoten pro Block
+      int nodePerBlockX2 =16;//(int)16;
+      int nodePerBlockX3 =8;//8; //(int)16;
+
+      double bH = nodePerBlockX1;    //gewuenschte Rand- und Blockbreite
+
+      //Simulation Parameters
+      const int baseLevel = 0;
+      const int refineLevel =4;
+      //length [m]
+      double lSI = 219;//223.2;
+      //length [LB]
+      double lLB = 30;
+
+      double dx =lSI/lLB;
+
+      double left_offset = 10700;//*0.5;
+      double right_offset  = 107000;//0.5;//2*0.5
+      double front_offset = 750;//0.15;
+      double back_offset  = 750;//0.15;
+      double top_offset = 250;//0.0;
+      double bottom_offset  =750;// 70;//0.07;
+	  
+	   LBMReal vLB =0.00016103/5.0*sqrt(2.0);//0.00016103;
+       LBMReal Re;
+       LBMReal rhoLB = 0.0;
+       LBMReal nueLB = 0.0000249;//(vLB*lLB)/Re;
+       Re = (vLB*(500/dx))/nueLB;
+       double dp_Ph=200.0*100000;//
+	   double dp_lb=dp_Ph*0.001*(nueLB*dx)*(nueLB*dx);//nue_ph=10e-6 and dx is in micrometer
+      // LBMReal nueLB = 0.000016103;
+      // LBMReal Re=15000;
+      // LBMReal rhoLB = 0.0;
+      // LBMReal vLB =nueLB*Re/(500.0/dx);
+     // // Re = (vLB*(0.303/dx))/nueLB;
+	   // //Re = (vLB*lLB)/nueLB;
+	  
+      // LBMReal rhoWord = 1e-15;//kg/micrometre^3;//1000.0;
+	  // LBMReal nueRE = 1e6;//micromter^2/s;//0.000001;
+	  // LBMReal  vWorld=300*1e6;//micrometer/s;//nueRE*Re/ (lSI*4.0/9.0);
+	  LBMUnitConverterPtr conv = LBMUnitConverterPtr(new LBMUnitConverter());
+      //conv->init(lSI*1e-6,30000,rhoWord,vWorld,lLB,1.0/*rhoLB*/,vLB);
+      
+	 
+ //////////////////////////////////////////////////////////////////////////
+      GbObject3DPtr refineCube1(new  GbCuboid3D(-500.0+5.0/*-354.0*/,-957.0/*-280.0*/,-684.0/* -72.0*/, 4100/*370.0*/,957.0/*354.0*/,70.0));//-530.0,-280.0, -72.0, 530.0,354.0,70.0));
+      if(myid == 0) GbSystem3D::writeGeoObject(refineCube1.get(), pathname+"/geo/refineCube1", WbWriterVtkXmlASCII::getInstance());
+
+      GbObject3DPtr refineCube2(new  GbCuboid3D(-230.0,-90.0, -684.0/*-72.0*/, 600,100.0,70.0));
+      if(myid == 0) GbSystem3D::writeGeoObject(refineCube2.get(), pathname+"/geo/refineCube2", WbWriterVtkXmlASCII::getInstance());
+	  
+	   GbObject3DPtr refineCube3(new  GbCuboid3D(-350.0,-957.0/*-120.0*/,-684.0/*-684.0*//* -72.0*/, 1700,957.0/*120.0*/,70.0));
+      if(myid == 0) GbSystem3D::writeGeoObject(refineCube3.get(), pathname+"/geo/refineCube3", WbWriterVtkXmlASCII::getInstance());
+	  
+	   GbObject3DPtr refineCube4(new  GbCuboid3D(-170.0,-60.0, -684.0/*-72.0*/, 200,60.0,70.0));
+      if(myid == 0) GbSystem3D::writeGeoObject(refineCube4.get(), pathname+"/geo/refineCube4", WbWriterVtkXmlASCII::getInstance());
+	  
+	   GbObject3DPtr refineCubeInlet(new  GbCuboid3D(-10600.0,-600.0, -600.0/*-72.0*/, -9000,600.0,60.0));
+      if(myid == 0) GbSystem3D::writeGeoObject(refineCubeInlet.get(), pathname+"/geo/refineCubeInlet", WbWriterVtkXmlASCII::getInstance());
+	  
+	  GbObject3DPtr refineCubeOutlet(new  GbCuboid3D(9000,-600.0, -600.0/*-72.0*/,10550.0 ,600.0,60.0));
+      if(myid == 0) GbSystem3D::writeGeoObject(refineCubeOutlet.get(), pathname+"/geo/refineCubeOutlet", WbWriterVtkXmlASCII::getInstance());
+      //////////////////////////////////////////////////////////////////////////
+      D3Q27TriFaceMeshInteractorPtr geoInt;
+	  /////////////////
+      //Grid3DPtr grid(new Grid3D());
+        Grid3DPtr grid(new Grid3D(comm));
+
+      UbSchedulerPtr rSch(new UbScheduler());
+      rSch->addSchedule(100, 200, 20000);
+      RestartPostprocessorPtr rp(new RestartPostprocessor(grid, rSch, comm, pathname+"/checkpoints", RestartPostprocessor::BINARY));
+
+      std::string opt;
+         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
+
+      if(cstr!= NULL)
+         opt = std::string(cstr);
+
+      if/*(cstr== NULL)*/(cstr!= NULL)
+      {
+         if(myid==0) UBLOG(logINFO,"Restart step: " << opt);
+         grid = rp->restart(UbSystem::stringTo<int>(opt));
+         rp->reconnect(grid);
+
+         // SetForcingBlockVisitor forcingVisitor(0.0, 0.0, 0.0);
+         // grid->accept(forcingVisitor);
+
+         //D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
+         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
+         grid->accept( setConnsVisitor );
+		  if(myid==0) UBLOG(logINFO,"Restart finish: " << opt);
+	 
+      }
+      else
+      {
+         if(myid ==0)
+         {
+            UBLOG(logINFO,"L = " <<lLB );
+            UBLOG(logINFO,"v = " <<vLB );
+            UBLOG(logINFO,"rho = " <<rhoLB );
+            UBLOG(logINFO,"nue = " << nueLB );
+			UBLOG(logINFO,"dx = " << dx );
+            UBLOG(logINFO,"Re = " << Re );
+			 UBLOG(logINFO,"dp_lb = " << dp_lb );
+            UBLOG(logINFO,"Preprozess - start");
+         }
+
+
+         ////////////////////////////////////////////////////////////////////////
+         //Grid
+         //////////////////////////////////////////////////////////////////////////
+         grid->setDeltaX(dx);
+         grid->setBlockNX(nodePerBlockX1, nodePerBlockX2, nodePerBlockX3);
+
+         ////////////////////////////////////////////////////////////////////////////
+         //// Geometrie
+         ////////////////////////////////////////////////////////////////////////////
+         GbTriFaceMesh3DPtr geo (GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(geoFile,"geo"));
+
+         if(myid == 0) GbSystem3D::writeGeoObject(geo.get(), pathname+"/geo/geo", WbWriterVtkXmlASCII::getInstance());
+
+         ////////////////////////////////////////////////////////////////////////////
+         //// Randgeometrien erstellen
+         ////////////////////////////////////////////////////////////////////////////
+         double shiftForMG=grid->getDeltaX(refineLevel)*nodePerBlockX1 / 3.0*2.0;
+          GbCuboid3DPtr plate1  = GbCuboid3DPtr( new GbCuboid3D( -7.5, -1.515e-1, -6.831e-2, 7.5, 1.515e-1, 0.0 ));
+
+           GbCuboid3DPtr plate2  = GbCuboid3DPtr( new GbCuboid3D( -1.5e-1, -16.51e-1, -16.831e-2, 1.5e-1, -1.6e-2, 1.0 ));
+           GbCuboid3DPtr plate3  = GbCuboid3DPtr( new GbCuboid3D( -1.5e-1, 1.6e-2, -16.831e-2, 1.5e-1, 16.515e-1, 1.0 ));
+
+          // GbCuboid3DPtr plate1_1  = GbCuboid3DPtr( new GbCuboid3D( -7.5, -2.515e-1, -1.0e-1, 7.5, 2.515e-1, -6.831e-2 ));
+          // GbCuboid3DPtr plate1_2  = GbCuboid3DPtr( new GbCuboid3D( -7.5, -2.515e-1, -0.0000001, 7.5, 2.515e-1, 1.0e-1 ));
+          // GbCuboid3DPtr plate1_3  = GbCuboid3DPtr( new GbCuboid3D( -7.5, 1.515e-1, -6.831e-2, 7.5, 2.515e-1, 0.0  ));
+          // GbCuboid3DPtr plate1_4  = GbCuboid3DPtr( new GbCuboid3D( -7.5, -2.515e-1, 0.0, 7.5, -1.515e-1, -1.0e-1 ));
+
+          // GbCuboid3DPtr inflow  = GbCuboid3DPtr( new GbCuboid3D( -8.0, -1.0, -1.0, -7.5, 1.0, 1.0 ));
+          // GbCuboid3DPtr outflow = GbCuboid3DPtr( new GbCuboid3D( 7.5, -1.0, -1.0, 8.0, 1.0, 1.0 ));
+		  
+		   // GbCuboid3DPtr plate2  = GbCuboid3DPtr( new GbCuboid3D( -1.5e-1, -16.51e-1, -16.831e-2, 1.5e-1, -1.6e-2, 1.0 ));
+          // GbCuboid3DPtr plate3  = GbCuboid3DPtr( new GbCuboid3D( -1.5e-1, 1.6e-2, -16.831e-2, 1.5e-1, 16.515e-1, 1.0 ));
+
+          // GbCuboid3DPtr plate1_1  = GbCuboid3DPtr( new GbCuboid3D( -left_offset-bH*dx, back_offset, -bottom_offset-bH*dx, right_offset+bH*dx, back_offset+bH*dx, top_offset+bH*dx ));
+          // GbCuboid3DPtr plate1_2  = GbCuboid3DPtr( new GbCuboid3D( -left_offset-bH*dx, -front_offset-bH*dx, -bottom_offset-bH*dx, right_offset+bH*dx, -front_offset, top_offset+bH*dx ));
+          // GbCuboid3DPtr plate1_3  = GbCuboid3DPtr( new GbCuboid3D( -left_offset-bH*dx, -front_offset-bH*dx, top_offset, right_offset+bH*dx, back_offset+bH*dx, top_offset+bH*dx+2.0*dx ));
+          // GbCuboid3DPtr plate1_4  = GbCuboid3DPtr( new GbCuboid3D( -left_offset-bH*dx, -front_offset-bH*dx, -bottom_offset-bH*dx, right_offset+bH*dx, back_offset+bH*dx, -bottom_offset ));
+
+          //GbCuboid3DPtr inflow  = GbCuboid3DPtr( new GbCuboid3D( -left_offset-5*bH*dx, -front_offset-5*bH*dx, -bottom_offset-5*bH*dx, -left_offset, back_offset+5*bH*dx, top_offset+5*bH*dx ));
+          //GbCuboid3DPtr outflow = GbCuboid3DPtr( new GbCuboid3D( right_offset, -front_offset-5*bH*dx, -bottom_offset-5*bH*dx, right_offset+5.0*bH*dx, back_offset+5*bH*dx, top_offset+5*bH*dx ));
+		  GbCuboid3DPtr inflow  = GbCuboid3DPtr( new GbCuboid3D( -11000.0,-600.0, -600.0, -9000.0, 600.0, -500 ));
+		  GbCuboid3DPtr outflow = GbCuboid3DPtr( new GbCuboid3D( 9000,-600.0, -600.0, 11000.0, 600.0, -500));
+
+
+		   GbObject3DPtr gridCube(new GbCuboid3D(-10700.0/*inflow->getX1Maximum()-4.0*dx/*.5*shiftForMG*/,-550.0/*-270*/ , -550.0/*-70*/,
+                                                10700.0/*outflow->getX1Minimum()+4.0*dx/*.5*shiftForMG*/, 
+                                                550.0/*270*/, 
+                                                23.0/*10.0*/));
+
+         GenBlocksGridVisitor genBlocks;
+         genBlocks.addGeoObject(gridCube);
+         grid->accept(genBlocks);
+		  
+         if(myid == 0)
+         {
+            GbSystem3D::writeGeoObject(gridCube.get(),pathname+"/geo/gridCube", WbWriterVtkXmlASCII::getInstance());
+            //GbSystem3D::writeGeoObject(plate2.get(),pathname+"/geo/plate2", WbWriterVtkXmlASCII::getInstance());
+            //GbSystem3D::writeGeoObject(plate3.get(),pathname+"/geo/plate3", WbWriterVtkXmlASCII::getInstance());
+
+            // GbSystem3D::writeGeoObject(plate1_1.get(),pathname+"/geo/plate1_1", WbWriterVtkXmlASCII::getInstance());
+            // GbSystem3D::writeGeoObject(plate1_2.get(),pathname+"/geo/plate1_2", WbWriterVtkXmlASCII::getInstance());
+            // GbSystem3D::writeGeoObject(plate1_3.get(),pathname+"/geo/plate1_3", WbWriterVtkXmlASCII::getInstance());
+            // GbSystem3D::writeGeoObject(plate1_4.get(),pathname+"/geo/plate1_4", WbWriterVtkXmlASCII::getInstance());
+
+            GbSystem3D::writeGeoObject(inflow.get(),pathname+"/geo/inflow", WbWriterVtkXmlASCII::getInstance());
+            GbSystem3D::writeGeoObject(outflow.get(),pathname+"/geo/outflow", WbWriterVtkXmlASCII::getInstance());
+         }
+   
+
+         if (refineLevel > 0)
+         {
+		  if(myid == 0) UBLOG(logINFO,"Refinement - start");   
+            RefineCrossAndInsideGbObjectHelper refineHelper(grid, refineLevel);
+            refineHelper.addGbObject(refineCube1, 1);
+            refineHelper.addGbObject(refineCube3, 2);
+			 refineHelper.addGbObject(refineCube2, 3);
+			 refineHelper.addGbObject(refineCube4, 4);
+			 
+			 refineHelper.addGbObject(refineCubeInlet, 1);
+			 refineHelper.addGbObject(refineCubeOutlet, 1);
+            refineHelper.refine();
+            if(myid == 0) UBLOG(logINFO,"Refinement - end");   
+		 
+		 
+           // RefineCrossAndInsideGbObjectBlockVisitor refVisitor1(refineCube1, refineLevel-4);
+            // grid->accept(refVisitor1);
+
+			// RefineCrossAndInsideGbObjectBlockVisitor refVisitor3(refineCube3, refineLevel-3);
+            // grid->accept(refVisitor3);
+
+            // RefineCrossAndInsideGbObjectBlockVisitor refVisitor2(refineCube2, refineLevel-2);
+            // grid->accept(refVisitor2);
+			
+			 // RefineCrossAndInsideGbObjectBlockVisitor refVisitor4(refineCube4, refineLevel-1);
+            // grid->accept(refVisitor4);
+
+            // RatioBlockVisitor ratioVisitor(refineLevel);
+            // grid->accept(ratioVisitor);
+
+            // RatioSmoothBlockVisitor ratioSmoothVisitor(refineLevel);
+            // grid->accept(ratioSmoothVisitor);
+
+            // OverlapBlockVisitor overlapVisitor(refineLevel);
+            // grid->accept(overlapVisitor);
+
+            // std::vector<int> dirs;
+            // D3Q27System::getLBMDirections(dirs);
+            // SetInterpolationDirsBlockVisitor interDirsVisitor(dirs);
+            // grid->accept(interDirsVisitor);
+            // if(myid == 0) UBLOG(logINFO,"Refinement - end");	
+         }
+
+         //////////////////////////////////////////////////////////////////////////
+         //INTERAKTOREN SETZEN (=Randbedingungen)
+         //////////////////////////////////////////////////////////////////////////
+         //oben/unten = Haftrand
+         int bbOption = 1; //0=simple Bounce Back, 1=quadr. BB
+         D3Q27BoundaryConditionAdapterPtr bcObst(new D3Q27NoSlipBCAdapter(bbOption));
+         geoInt = D3Q27TriFaceMeshInteractorPtr( new D3Q27TriFaceMeshInteractor(geo, grid, D3Q27BoundaryConditionAdapterPtr(new D3Q27NoSlipBCAdapter(bbOption)),Interactor3D::INVERSESOLID, Interactor3D::SIMPLE));
+	     geoInt->setUseHalfSpaceCheck(true);
+         geoInt->setRegardPointInObjectTest(true);
+         if(myid == 0) UBLOG(logINFO,"stl - end"); 
+         //D3Q27InteractorPtr plate1Int(new D3Q27Interactor(plate1, grid, bcObst,Interactor3D::INVERSESOLID));
+         // D3Q27InteractorPtr plate2Int(new D3Q27Interactor(plate2, grid, bcObst,Interactor3D::SOLID));
+         // D3Q27InteractorPtr plate3Int(new D3Q27Interactor(plate3, grid, bcObst,Interactor3D::SOLID));
+
+         // D3Q27InteractorPtr plate1_1Int(new D3Q27Interactor(plate1_1, grid, bcObst,Interactor3D::SOLID));
+         // D3Q27InteractorPtr plate1_2Int(new D3Q27Interactor(plate1_2, grid, bcObst,Interactor3D::SOLID));
+         // D3Q27InteractorPtr plate1_3Int(new D3Q27Interactor(plate1_3, grid, bcObst,Interactor3D::SOLID));
+         // D3Q27InteractorPtr plate1_4Int(new D3Q27Interactor(plate1_4, grid, bcObst,Interactor3D::SOLID));
+
+         //links: geschwindigkeits-einfluss
+         //Velocity-BC
+         //////////////////////////////////////////////////////////////////////////
+         mu::Parser fct;
+         fct.DefineConst("vx1"  , vLB*9.0/4.0 );
+         //fct = MathUtil::getDuctParaboloidX(0, 250*2.0, -51.08/2, 51.08, vLB*9.0/4.0);
+         fct.SetExpr("vx1");
+         //////////////////////////////////////////////////////////////////////////
+
+         //////////////////////////////////////////////////////////////////////////
+            // D3Q27BoundaryConditionAdapterPtr velBCAdapter = D3Q27BoundaryConditionAdapterPtr(new D3Q27VelocityBCAdapter (false, false ,true ,fct, 0, D3Q27BCFunction::INFCONST));
+            // velBCAdapter->setSecondaryBcOption(2);
+            // D3Q27InteractorPtr inflowInt  = D3Q27InteractorPtr( new D3Q27Interactor(inflow, grid, velBCAdapter, Interactor3D::SOLID));
+
+		 D3Q27BoundaryConditionAdapterPtr denBCAdapterInlet(new D3Q27DensityBCAdapter(3.0*(dp_lb-rhoLB)));
+        denBCAdapterInlet->setSecondaryBcOption(1);
+        D3Q27InteractorPtr inflowInt = D3Q27InteractorPtr( new D3Q27Interactor(inflow, grid, denBCAdapterInlet,Interactor3D::SOLID));
+		 
+         //rechts: druckrand
+         //Density-BC
+         //fuer Kompressibles Modell  rho = 1.0
+         D3Q27BoundaryConditionAdapterPtr denBCAdapter(new D3Q27DensityBCAdapter(rhoLB));
+         denBCAdapter->setSecondaryBcOption(1);
+         D3Q27InteractorPtr outflowInt = D3Q27InteractorPtr( new D3Q27Interactor(outflow, grid, denBCAdapter,Interactor3D::SOLID));
+
+         MetisPartitioningGridVisitor metisVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B);
+         grid->accept( metisVisitor );
+         SolidBlocksHelper sd(grid, comm);
+         sd.addInteractor(geoInt);
+         sd.addInteractor(inflowInt);
+         sd.addInteractor(outflowInt);
+         // sd.addInteractor(plate1_1Int);
+         // sd.addInteractor(plate1_2Int);
+         // sd.addInteractor(plate1_3Int);
+         // sd.addInteractor(plate1_4Int);
+         // sd.addInteractor(plate2Int);
+         // sd.addInteractor(plate3Int);
+		 if(myid == 0) UBLOG(logINFO,"line"<<__LINE__); 
+         sd.deleteSolidBlocks();     
+ if(myid == 0) UBLOG(logINFO,"line"<<__LINE__); 
+         grid->accept( metisVisitor );
+if(myid == 0) UBLOG(logINFO,"line"<<__LINE__); 
+         BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname + "/grid/blocks", WbWriterVtkXmlBinary::getInstance(), comm));
+         ppblocks->update(0);
+         ppblocks.reset();
+
+         unsigned long nob = grid->getNumberOfBlocks();
+         int gl = 3;
+         unsigned long nod_temp = nob * (nodePerBlockX1+gl) * (nodePerBlockX2+gl) * (nodePerBlockX3+gl);
+         unsigned long nod = nob * (nodePerBlockX1) * (nodePerBlockX2) * (nodePerBlockX3);
+         double needMemAll  = double(nod_temp*(27*sizeof(double) + sizeof(int) + sizeof(float)*4));
+         double needMem  = needMemAll / double(comm->getNumberOfProcesses());
+
+
+         if(myid == 0)
+         {
+            UBLOG(logINFO,"Number of blocks = " << nob);
+            UBLOG(logINFO,"Number of nodes  = " << nod);
+            UBLOG(logINFO,"Necessary memory  = " << needMemAll  << " bytes");
+            UBLOG(logINFO,"Necessary memory per process = " << needMem  << " bytes");
+            UBLOG(logINFO,"Available memory per process = " << availMem << " bytes");
+         }  
+
+         //LBMKernel3DPtr kernel(new LBMKernelETD3Q27Cascaded(nodePerBlockX1, nodePerBlockX2, nodePerBlockX2));
+         //LBMKernel3DPtr kernel(new LBMKernelETD3Q27CCLB(nodePerBlockX1, nodePerBlockX2, nodePerBlockX2));
+
+		  int option = 0;
+		 LBMKernel3DPtr kernel(new LBMKernelETD3Q27CCLB(nodePerBlockX1, nodePerBlockX2, nodePerBlockX3,option));
+
+		 
+		 
+         BCProcessorPtr bcProc(new D3Q27ETBCProcessor());
+         kernel->setBCProcessor(bcProc);
+
+         SetKernelBlockVisitor kernelVisitor(kernel, nueLB, availMem, needMem);
+         grid->accept(kernelVisitor);
+
+         if (refineLevel > 0)
+         {
+            D3Q27SetUndefinedNodesBlockVisitor undefNodesVisitor;
+            grid->accept(undefNodesVisitor);
+         }
+		 
+		  if(myid == 0) UBLOG(logINFO,"intractor - start"); 
+          //inflow
+         grid->addAndInitInteractor(inflowInt);
+
+         //outflow
+         grid->addAndInitInteractor(outflowInt);
+         //canal
+         grid->addAndInitInteractor(geoInt);
+         // grid->addAndInitInteractor(plate1_1Int);
+         // grid->addAndInitInteractor(plate1_2Int);
+         // grid->addAndInitInteractor(plate1_3Int);
+         // grid->addAndInitInteractor(plate1_4Int);
+         // grid->addAndInitInteractor(plate2Int);
+         // grid->addAndInitInteractor(plate3Int);
+
+       
+
+         //////////////////////////////////////////////////////////////////////////
+         //connectoren setzen:
+
+         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
+         grid->accept( setConnsVisitor );
+         //////////////////////////////////////////////////////////////////////////	 
+         //domain decomposition
+         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
+         grid->accept(pqPartVisitor);
+			 
+         //////////////////////////////////////////////////////////////////////////     
+	   //Stroemungsfeld initialisieren
+         //////////////////////////////////////////////////////////////////////////
+         D3Q27ETInitDistributionsBlockVisitor initVisitor(rhoLB); //1.0
+         initVisitor.setVx1(0); 
+         grid->accept(initVisitor);
+
+         if(myid == 0)
+         {
+            //Abst�nde "q" als Linien rausschreiben
+            std::vector< UbTupleFloat3 > nodes;
+            std::vector< UbTupleInt2 >   lines;
+            geoInt->addQsLineSet(nodes, lines);
+            WbWriterVtkXmlBinary::getInstance()->writeLines(pathname+"/grid/qs",nodes,lines);
+         }
+
+          if(myid == 0) UBLOG(logINFO,"Preprozess - end");
+		 
+		 	  ////////////////////////
+           //Set Postprozessors
+           //////////////////////////////////////////////////////////////////////////
+           {
+            UbSchedulerPtr geoSch(new UbScheduler(1));
+            D3Q27MacroscopicQuantitiesPostprocessor ppgeo(grid,geoSch, pathname + "/grid/nodes", WbWriterVtkXmlBinary::getInstance(), conv,  comm, true);
+            grid->doPostProcess(0);
+           }
+	    
+
+      }
+
+      //////////////////////////////////////////////////////////////////////////
+	   // UbSchedulerPtr visSchAv(new UbScheduler());
+		UbSchedulerPtr visSchAv(new UbScheduler(100,100));
+      // visSchAv->addSchedule(100,10,1000);
+      // UbSchedulerPtr resSchAv(new UbScheduler());
+	   UbSchedulerPtr resSchAv(new UbScheduler(100,100));
+      // resSchAv->addSchedule(20,20,1000);
+      AverageValuesPostprocessor       Avpp(grid,  pathname + "/Turbulence/stepAV", WbWriterVtkXmlBinary::getInstance(), visSchAv/*wann wird rausgeschrieben*/,resSchAv/*wann wird resettet*/,comm);
+	  
+	 D3Q27ShearStressPostprocessor  shear(grid,  pathname + "/shear/step", WbWriterVtkXmlBinary::getInstance(), visSchAv/*wann wird rausgeschrieben*/,resSchAv/*wann wird resettet*/,comm,iProcessor); 
+	 // D3Q27ShearStressPostprocessor  shear(grid,  pathname + "/shear/step", WbWriterVtkXmlBinary::getInstance(), visSchAv/*wann wird rausgeschrieben*/,resSchAv/*wann wird resettet*/,comm);
+	  shear.addInteractor(geoInt);
+	   ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+	  
+
+      UbSchedulerPtr nupsSch(new UbScheduler(1, 5, 10));
+      NUPSCounterPostprocessor npr(grid, nupsSch, pathname + "/results/nups.txt", comm);
+
+      double outTime = 100.0;
+      UbSchedulerPtr stepSch(new UbScheduler(outTime));
+      D3Q27MacroscopicQuantitiesPostprocessor pp(grid,stepSch, pathname + "/steps/step", WbWriterVtkXmlBinary::getInstance(), conv,  comm);
+      //////////////////////////////////////////////////////////////////////////
+      //PathLine
+       UbSchedulerPtr plSch(new UbScheduler(5000, 5000));
+      const int numberofparticle=20;
+	
+	  std::vector<UbTupleDouble3 > potisions;
+	  double randomx[numberofparticle];
+	  double randomy[numberofparticle];
+	  double randomz[numberofparticle];
+	  double lowestx,highestx,lowesty,highesty,lowestz,highestz;
+	  if(myid==0)
+	  {
+		  for(int i = 0; i < numberofparticle; i++)
+		  {
+			  double random; 
+	        lowestx =-10300.0;  lowesty =-230;          lowestz =-250;
+	        highestx=-9792.0;  highesty=-330;          highestz=-250; 
+		  
+	      double rangex=(highestx-lowestx),rangey=(highesty-lowesty),rangez=(highestz-lowestz);	
+           randomx[i] = lowestx+(rangex*rand()/(RAND_MAX + 1.0));
+		   randomy[i] = lowesty+(rangey*rand()/(RAND_MAX + 1.0));
+	       randomz[i] = lowestz+(rangez*rand()/(RAND_MAX + 1.0));
+		  //val<1>(potisions[i])= 0.506983973456;
+		  //val<2>(potisions[i]) = lowesty+(rangey*rand()/(RAND_MAX + 1.0));
+		   //val<3>(potisions[i]) = lowestz+(rangez*rand()/(RAND_MAX + 1.0));
+		  }
+		  for (int i=0;i<comm->getNumberOfProcesses();i++)
+		  {
+			  if (i!=0)
+			  {
+			      MPI_Send(randomx,numberofparticle, MPI_DOUBLE_PRECISION,i,i,MPI_COMM_WORLD);
+				  MPI_Send(randomy,numberofparticle, MPI_DOUBLE_PRECISION,i,i,MPI_COMM_WORLD);
+				  MPI_Send(randomz,numberofparticle, MPI_DOUBLE_PRECISION,i,i,MPI_COMM_WORLD);
+			  }
+		  }
+	  }
+	  if (myid!=0)
+	  {
+		  MPI_Status status; 
+		  MPI_Recv(randomx,numberofparticle, MPI_DOUBLE_PRECISION,0,MPI_ANY_TAG,MPI_COMM_WORLD,&status);
+		  MPI_Recv(randomy,numberofparticle, MPI_DOUBLE_PRECISION,0,MPI_ANY_TAG,MPI_COMM_WORLD,&status);
+		  MPI_Recv(randomz,numberofparticle, MPI_DOUBLE_PRECISION,0,MPI_ANY_TAG,MPI_COMM_WORLD,&status);
+	  }
+	  for(int i = 0; i < numberofparticle; i++)
+	  {	
+		  potisions.push_back( makeUbTuple(randomx[i],randomy[i],randomz[i]) );
+		  //val<1>(potisions[i])= 0.506983973456;
+		  //val<2>(potisions[i]) = randomy[i];
+		  //val<3>(potisions[i]) = randomz[i];
+	  }
+	 //  UBLOG(logINFO,"Rank="<<myid<<" positions  = " <<val<1>(potisions)<< " "<<val<2>(potisions)<<" "<< val<3>(potisions));
+	 // D3Q27InterpolationProcessorPtr iProcessor2;
+     // D3Q27PathLinePostprocessorMcpart pathLine(grid, pathname + "/pathLine/pathLine", WbWriterVtkXmlASCII::getInstance(), conv, plSch, comm,potisions, nueLB, iProcessor);
+      //////////////////////////////////////////////////////////////////////////
+      //Simulation
+      //////////////////////////////////////////////////////////////////////////
+
+	  double endTime = 1000.0;
+      UbSchedulerPtr visSch(stepSch);
+      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, visSch));
+      if(myid == 0) UBLOG(logINFO,"Simulation-start");
+      calculation->calculate();
+      if(myid == 0) UBLOG(logINFO,"Simulation-end");
+
+   }
+   catch(std::exception& e)
+   {
+      cerr << e.what() << endl;
+   }
+   catch(std::string& s)
+   {
+      cerr << s << endl;
+   }
+   catch(...)
+   {
+      cerr << "unknown exception" << endl;
+   }
+
+}
diff --git a/apps/cpu/micropart/orifice.hpp b/apps/cpu/micropart/orifice.hpp
index 2cba0511e7a7e62ca25e1315b3d0f24908a06004..34028cad270bccd50d11ac61c2c515621ff767b6 100644
--- a/apps/cpu/micropart/orifice.hpp
+++ b/apps/cpu/micropart/orifice.hpp
@@ -1,542 +1,542 @@
-#include <vfluids.h>
-using namespace std;
-
-void orifice(const char *cstr)
-{
-   try
-   {
-      CommunicatorPtr comm(new MPICommunicator());
-      int myid = comm->getProcessID();
-      int numprocs = comm->getNumberOfProcesses();
-
-      string machine = QUOTEME(CAB_MACHINE);
-      string pathname; 
-      double availMem = 0;
-      string geoFile;
-      int numOfThreads = 1;
-
-      if(machine == "BOMBADIL") 
-      {
-    //     pathname = "/work/ehsan/orifice";
-		 pathname = "d:/temp/orifice";
-         availMem = 6.0e9;
-		  int numOfThreads = 1;
-         //geoFile = "c:/Data/micropart/DK19_7_02_Martin.stl";
-         //geoFile = "c:/Data/micropart/ktoolcav.stl";
-         //geoFile = "c:/Data/micropart/boxN.stl";
-        geoFile = "d:/Data/Ehsan/orifice.stl";
-      }
-      else if(machine == "M01" || machine == "M02")      
-      {
-        // pathname = "/work/koskuche/scratch/mcpart/out";
-		  pathname = "/work/ehsan/orifice";
-         availMem = 12.0e9;
-		  geoFile = "/work/ehsan/data/orifice.stl";
-         //geoFile = "/home/koskuche/data/micropart/DK19_7_02_Martin.stl";
-
-         numOfThreads = 1;
-         if(myid ==0)
-         {
-            stringstream logFilename;
-            logFilename <<  pathname + "/logfile"+UbSystem::toString(UbSystem::getTimeStamp())+"_"+UbSystem::toString(myid)+".txt";
-            UbLog::output_policy::setStream(logFilename.str());
-         }
-      }
-      else throw UbException(UB_EXARGS, "unknown CAB_MACHINE");
-
-      UbLog::reportingLevel() = logINFO;
-      //UbLog::reportingLevel() = logDEBUG1;
-
-      int nodePerBlockX1 =8; //Anzahl an Knoten pro Block
-      int nodePerBlockX2 =8;//(int)16;
-      int nodePerBlockX3 =8;//8; //(int)16;
-
-      double bH = nodePerBlockX1;    //gewuenschte Rand- und Blockbreite
-
-      //Simulation Parameters
-      const int baseLevel = 0;
-      const int refineLevel =1;
-      //length [m]
-      double lSI = 1.55;//223.2;
-      //length [LB]
-      double lLB = 15;
-
-	  
-      double dx =lSI/lLB *2;
-
-      double left_offset = 0;//*0.5;
-      double right_offset  = 159;//0.5;//2*0.5
-      double front_offset = 750;//0.15;
-      double back_offset  = 750;//0.15;
-      double top_offset = 250;//0.0;
-      double bottom_offset  =750;// 70;//0.07;
-	  
-	   LBMReal vLB =0.00016103/5.0*sqrt(2.0);//0.00016103;
-       LBMReal Re;
-       LBMReal rhoLB = 0.0;
-       LBMReal nueLB = 0.0000249;//(vLB*lLB)/Re;
-       Re = (vLB*(500/dx))/nueLB;
-       double dp_Ph=200.0*100000;//
-	   double dp_lb=dp_Ph*0.001*(nueLB*dx)*(nueLB*dx);//nue_ph=10e-6 and dx is in micrometer
-      // LBMReal nueLB = 0.000016103;
-      // LBMReal Re=15000;
-      // LBMReal rhoLB = 0.0;
-      // LBMReal vLB =nueLB*Re/(500.0/dx);
-     // // Re = (vLB*(0.303/dx))/nueLB;
-	   // //Re = (vLB*lLB)/nueLB;
-	  
-      // LBMReal rhoWord = 1e-15;//kg/micrometre^3;//1000.0;
-	  // LBMReal nueRE = 1e6;//micromter^2/s;//0.000001;
-	  // LBMReal  vWorld=300*1e6;//micrometer/s;//nueRE*Re/ (lSI*4.0/9.0);
-	  LBMUnitConverterPtr conv = LBMUnitConverterPtr(new LBMUnitConverter());
-      //conv->init(lSI*1e-6,30000,rhoWord,vWorld,lLB,1.0/*rhoLB*/,vLB);
-      
-	 
- //////////////////////////////////////////////////////////////////////////
-      GbObject3DPtr refineCube1(new  GbCuboid3D(78.0,-1.0,-1.0, 81/*370.0*/,20.0/*354.0*/,20.0));//-530.0,-280.0, -72.0, 530.0,354.0,70.0));
-      if(myid == 0) GbSystem3D::writeGeoObject(refineCube1.get(), pathname+"/geo/refineCube1", WbWriterVtkXmlASCII::getInstance());
-
-   //   GbObject3DPtr refineCube2(new  GbCuboid3D(-230.0,-90.0, -684.0/*-72.0*/, 600,100.0,70.0));
-   //   if(myid == 0) GbSystem3D::writeGeoObject(refineCube2.get(), pathname+"/geo/refineCube2", WbWriterVtkXmlASCII::getInstance());
-	  //
-	  // GbObject3DPtr refineCube3(new  GbCuboid3D(-350.0,-957.0/*-120.0*/,-684.0/*-684.0*//* -72.0*/, 1700,957.0/*120.0*/,70.0));
-   //   if(myid == 0) GbSystem3D::writeGeoObject(refineCube3.get(), pathname+"/geo/refineCube3", WbWriterVtkXmlASCII::getInstance());
-	  //
-	  // GbObject3DPtr refineCube4(new  GbCuboid3D(-170.0,-60.0, -684.0/*-72.0*/, 200,60.0,70.0));
-   //   if(myid == 0) GbSystem3D::writeGeoObject(refineCube4.get(), pathname+"/geo/refineCube4", WbWriterVtkXmlASCII::getInstance());
-	  //
-	  // GbObject3DPtr refineCubeInlet(new  GbCuboid3D(-10600.0,-600.0, -600.0/*-72.0*/, -9000,600.0,60.0));
-   //   if(myid == 0) GbSystem3D::writeGeoObject(refineCubeInlet.get(), pathname+"/geo/refineCubeInlet", WbWriterVtkXmlASCII::getInstance());
-	  //
-	  //GbObject3DPtr refineCubeOutlet(new  GbCuboid3D(9000,-600.0, -600.0/*-72.0*/,10550.0 ,600.0,60.0));
-   //   if(myid == 0) GbSystem3D::writeGeoObject(refineCubeOutlet.get(), pathname+"/geo/refineCubeOutlet", WbWriterVtkXmlASCII::getInstance());
-      //////////////////////////////////////////////////////////////////////////
-      D3Q27TriFaceMeshInteractorPtr geoInt;
-	  /////////////////
-      //Grid3DPtr grid(new Grid3D());
-        Grid3DPtr grid(new Grid3D(comm));
-
-      UbSchedulerPtr rSch(new UbScheduler());
-      rSch->addSchedule(100, 200, 20000);
-      RestartPostprocessorPtr rp(new RestartPostprocessor(grid, rSch, comm, pathname+"/checkpoints", RestartPostprocessor::BINARY));
-
-      std::string opt;
-         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
-
-      if(cstr!= NULL)
-         opt = std::string(cstr);
-
-      if/*(cstr== NULL)*/(cstr!= NULL)
-      {
-         if(myid==0) UBLOG(logINFO,"Restart step: " << opt);
-         grid = rp->restart(UbSystem::stringTo<int>(opt));
-         rp->reconnect(grid);
-
-         // SetForcingBlockVisitor forcingVisitor(0.0, 0.0, 0.0);
-         // grid->accept(forcingVisitor);
-
-         //D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
-         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
-         grid->accept( setConnsVisitor );
-		  if(myid==0) UBLOG(logINFO,"Restart finish: " << opt);
-	 
-      }
-      else
-      {
-         if(myid ==0)
-         {
-            UBLOG(logINFO,"L = " <<lLB );
-            UBLOG(logINFO,"v = " <<vLB );
-            UBLOG(logINFO,"rho = " <<rhoLB );
-            UBLOG(logINFO,"nue = " << nueLB );
-			UBLOG(logINFO,"dx = " << dx );
-            UBLOG(logINFO,"Re = " << Re );
-			 UBLOG(logINFO,"dp_lb = " << dp_lb );
-            UBLOG(logINFO,"Preprozess - start");
-         }
-
-
-         ////////////////////////////////////////////////////////////////////////
-         //Grid
-         //////////////////////////////////////////////////////////////////////////
-         grid->setDeltaX(dx);
-         grid->setBlockNX(nodePerBlockX1, nodePerBlockX2, nodePerBlockX3);
-
-         ////////////////////////////////////////////////////////////////////////////
-         //// Geometrie
-         ////////////////////////////////////////////////////////////////////////////
-         GbTriFaceMesh3DPtr geo (GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(geoFile,"geo"));
-
-         if(myid == 0) GbSystem3D::writeGeoObject(geo.get(), pathname+"/geo/geo", WbWriterVtkXmlASCII::getInstance());
-
-         ////////////////////////////////////////////////////////////////////////////
-         //// Randgeometrien erstellen
-         ////////////////////////////////////////////////////////////////////////////
-         double shiftForMG=grid->getDeltaX(refineLevel)*nodePerBlockX1 / 3.0*2.0;
-          GbCuboid3DPtr plate1  = GbCuboid3DPtr( new GbCuboid3D( -7.5, -1.515e-1, -6.831e-2, 7.5, 1.515e-1, 0.0 ));
-
-           GbCuboid3DPtr plate2  = GbCuboid3DPtr( new GbCuboid3D( -1.5e-1, -16.51e-1, -16.831e-2, 1.5e-1, -1.6e-2, 1.0 ));
-           GbCuboid3DPtr plate3  = GbCuboid3DPtr( new GbCuboid3D( -1.5e-1, 1.6e-2, -16.831e-2, 1.5e-1, 16.515e-1, 1.0 ));
-
-          // GbCuboid3DPtr plate1_1  = GbCuboid3DPtr( new GbCuboid3D( -7.5, -2.515e-1, -1.0e-1, 7.5, 2.515e-1, -6.831e-2 ));
-          // GbCuboid3DPtr plate1_2  = GbCuboid3DPtr( new GbCuboid3D( -7.5, -2.515e-1, -0.0000001, 7.5, 2.515e-1, 1.0e-1 ));
-          // GbCuboid3DPtr plate1_3  = GbCuboid3DPtr( new GbCuboid3D( -7.5, 1.515e-1, -6.831e-2, 7.5, 2.515e-1, 0.0  ));
-          // GbCuboid3DPtr plate1_4  = GbCuboid3DPtr( new GbCuboid3D( -7.5, -2.515e-1, 0.0, 7.5, -1.515e-1, -1.0e-1 ));
-
-          // GbCuboid3DPtr inflow  = GbCuboid3DPtr( new GbCuboid3D( -8.0, -1.0, -1.0, -7.5, 1.0, 1.0 ));
-          // GbCuboid3DPtr outflow = GbCuboid3DPtr( new GbCuboid3D( 7.5, -1.0, -1.0, 8.0, 1.0, 1.0 ));
-		  
-		   // GbCuboid3DPtr plate2  = GbCuboid3DPtr( new GbCuboid3D( -1.5e-1, -16.51e-1, -16.831e-2, 1.5e-1, -1.6e-2, 1.0 ));
-          // GbCuboid3DPtr plate3  = GbCuboid3DPtr( new GbCuboid3D( -1.5e-1, 1.6e-2, -16.831e-2, 1.5e-1, 16.515e-1, 1.0 ));
-
-          // GbCuboid3DPtr plate1_1  = GbCuboid3DPtr( new GbCuboid3D( -left_offset-bH*dx, back_offset, -bottom_offset-bH*dx, right_offset+bH*dx, back_offset+bH*dx, top_offset+bH*dx ));
-          // GbCuboid3DPtr plate1_2  = GbCuboid3DPtr( new GbCuboid3D( -left_offset-bH*dx, -front_offset-bH*dx, -bottom_offset-bH*dx, right_offset+bH*dx, -front_offset, top_offset+bH*dx ));
-          // GbCuboid3DPtr plate1_3  = GbCuboid3DPtr( new GbCuboid3D( -left_offset-bH*dx, -front_offset-bH*dx, top_offset, right_offset+bH*dx, back_offset+bH*dx, top_offset+bH*dx+2.0*dx ));
-          // GbCuboid3DPtr plate1_4  = GbCuboid3DPtr( new GbCuboid3D( -left_offset-bH*dx, -front_offset-bH*dx, -bottom_offset-bH*dx, right_offset+bH*dx, back_offset+bH*dx, -bottom_offset ));
-
-          //GbCuboid3DPtr inflow  = GbCuboid3DPtr( new GbCuboid3D( -left_offset-5*bH*dx, -front_offset-5*bH*dx, -bottom_offset-5*bH*dx, -left_offset, back_offset+5*bH*dx, top_offset+5*bH*dx ));
-          //GbCuboid3DPtr outflow = GbCuboid3DPtr( new GbCuboid3D( right_offset, -front_offset-5*bH*dx, -bottom_offset-5*bH*dx, right_offset+5.0*bH*dx, back_offset+5*bH*dx, top_offset+5*bH*dx ));
-		  GbCuboid3DPtr inflow  = GbCuboid3DPtr( new GbCuboid3D( -5.0,-1.5, -1.5, 1.5, 20.0, 20.0 ));
-		  GbCuboid3DPtr outflow = GbCuboid3DPtr( new GbCuboid3D( 157.50,-1.5, -1.5, 160.5, 20.0, 20.0));
-
-
-		   GbObject3DPtr gridCube(new GbCuboid3D(inflow->getX1Maximum()-4.0*dx,inflow->getX2Minimum()-4.0*dx ,inflow->getX3Minimum()-4.0*dx,
-			   outflow->getX1Minimum()-4.0*dx,outflow->getX2Maximum()-4.0*dx ,outflow->getX3Maximum()-4.0*dx
-                                               ));
-
-         GenBlocksGridVisitor genBlocks;
-         genBlocks.addGeoObject(gridCube);
-         grid->accept(genBlocks);
-		  
-         if(myid == 0)
-         {
-            GbSystem3D::writeGeoObject(gridCube.get(),pathname+"/geo/gridCube", WbWriterVtkXmlASCII::getInstance());
-            //GbSystem3D::writeGeoObject(plate2.get(),pathname+"/geo/plate2", WbWriterVtkXmlASCII::getInstance());
-            //GbSystem3D::writeGeoObject(plate3.get(),pathname+"/geo/plate3", WbWriterVtkXmlASCII::getInstance());
-
-            // GbSystem3D::writeGeoObject(plate1_1.get(),pathname+"/geo/plate1_1", WbWriterVtkXmlASCII::getInstance());
-            // GbSystem3D::writeGeoObject(plate1_2.get(),pathname+"/geo/plate1_2", WbWriterVtkXmlASCII::getInstance());
-            // GbSystem3D::writeGeoObject(plate1_3.get(),pathname+"/geo/plate1_3", WbWriterVtkXmlASCII::getInstance());
-            // GbSystem3D::writeGeoObject(plate1_4.get(),pathname+"/geo/plate1_4", WbWriterVtkXmlASCII::getInstance());
-
-            GbSystem3D::writeGeoObject(inflow.get(),pathname+"/geo/inflow", WbWriterVtkXmlASCII::getInstance());
-            GbSystem3D::writeGeoObject(outflow.get(),pathname+"/geo/outflow", WbWriterVtkXmlASCII::getInstance());
-         }
-   
-
-         if (refineLevel > 0)
-         {
-		  if(myid == 0) UBLOG(logINFO,"Refinement - start");   
-            RefineCrossAndInsideGbObjectHelper refineHelper(grid, refineLevel);
-            refineHelper.addGbObject(refineCube1, refineLevel);
-    //        refineHelper.addGbObject(refineCube3, 2);
-			 //refineHelper.addGbObject(refineCube2, 3);
-			 //refineHelper.addGbObject(refineCube4, 4);
-			 //
-			 //refineHelper.addGbObject(refineCubeInlet, 1);
-			 //refineHelper.addGbObject(refineCubeOutlet, 1);
-            refineHelper.refine();
-            if(myid == 0) UBLOG(logINFO,"Refinement - end");   
-		 
-		 
-           // RefineCrossAndInsideGbObjectBlockVisitor refVisitor1(refineCube1, refineLevel-4);
-            // grid->accept(refVisitor1);
-
-			// RefineCrossAndInsideGbObjectBlockVisitor refVisitor3(refineCube3, refineLevel-3);
-            // grid->accept(refVisitor3);
-
-            // RefineCrossAndInsideGbObjectBlockVisitor refVisitor2(refineCube2, refineLevel-2);
-            // grid->accept(refVisitor2);
-			
-			 // RefineCrossAndInsideGbObjectBlockVisitor refVisitor4(refineCube4, refineLevel-1);
-            // grid->accept(refVisitor4);
-
-            // RatioBlockVisitor ratioVisitor(refineLevel);
-            // grid->accept(ratioVisitor);
-
-            // RatioSmoothBlockVisitor ratioSmoothVisitor(refineLevel);
-            // grid->accept(ratioSmoothVisitor);
-
-            // OverlapBlockVisitor overlapVisitor(refineLevel);
-            // grid->accept(overlapVisitor);
-
-            // std::vector<int> dirs;
-            // D3Q27System::getLBMDirections(dirs);
-            // SetInterpolationDirsBlockVisitor interDirsVisitor(dirs);
-            // grid->accept(interDirsVisitor);
-            // if(myid == 0) UBLOG(logINFO,"Refinement - end");	
-         }
-
-         //////////////////////////////////////////////////////////////////////////
-         //INTERAKTOREN SETZEN (=Randbedingungen)
-         //////////////////////////////////////////////////////////////////////////
-         //oben/unten = Haftrand
-         int bbOption = 1; //0=simple Bounce Back, 1=quadr. BB
-         D3Q27BoundaryConditionAdapterPtr bcObst(new D3Q27NoSlipBCAdapter(bbOption));
-         geoInt = D3Q27TriFaceMeshInteractorPtr( new D3Q27TriFaceMeshInteractor(geo, grid, D3Q27BoundaryConditionAdapterPtr(new D3Q27NoSlipBCAdapter(bbOption)),Interactor3D::INVERSESOLID, Interactor3D::SIMPLE));
-	     geoInt->setUseHalfSpaceCheck(true);
-         geoInt->setRegardPointInObjectTest(true);
-         if(myid == 0) UBLOG(logINFO,"stl - end"); 
-         //D3Q27InteractorPtr plate1Int(new D3Q27Interactor(plate1, grid, bcObst,Interactor3D::INVERSESOLID));
-         // D3Q27InteractorPtr plate2Int(new D3Q27Interactor(plate2, grid, bcObst,Interactor3D::SOLID));
-         // D3Q27InteractorPtr plate3Int(new D3Q27Interactor(plate3, grid, bcObst,Interactor3D::SOLID));
-
-         // D3Q27InteractorPtr plate1_1Int(new D3Q27Interactor(plate1_1, grid, bcObst,Interactor3D::SOLID));
-         // D3Q27InteractorPtr plate1_2Int(new D3Q27Interactor(plate1_2, grid, bcObst,Interactor3D::SOLID));
-         // D3Q27InteractorPtr plate1_3Int(new D3Q27Interactor(plate1_3, grid, bcObst,Interactor3D::SOLID));
-         // D3Q27InteractorPtr plate1_4Int(new D3Q27Interactor(plate1_4, grid, bcObst,Interactor3D::SOLID));
-
-         //links: geschwindigkeits-einfluss
-         //Velocity-BC
-         //////////////////////////////////////////////////////////////////////////
-         mu::Parser fct;
-         fct.DefineConst("vx1"  , vLB*9.0/4.0 );
-         //fct = MathUtil::getDuctParaboloidX(0, 250*2.0, -51.08/2, 51.08, vLB*9.0/4.0);
-         fct.SetExpr("vx1");
-         //////////////////////////////////////////////////////////////////////////
-
-         //////////////////////////////////////////////////////////////////////////
-             D3Q27BoundaryConditionAdapterPtr velBCAdapter = D3Q27BoundaryConditionAdapterPtr(new D3Q27VelocityBCAdapter (false, false ,true ,fct, 0, D3Q27BCFunction::INFCONST));
-    //     D3Q27BoundaryConditionAdapterPtr velBCAdapter = D3Q27BoundaryConditionAdapterPtr(new D3Q27VelocityBCAdapter (false, false ,true ,fct,fct,fct, 0, D3Q27BCFunction::INFCONST));
-			 // velBCAdapter->setSecondaryBcOption(2);
-            // D3Q27InteractorPtr inflowInt  = D3Q27InteractorPtr( new D3Q27Interactor(inflow, grid, velBCAdapter, Interactor3D::SOLID));
-
-		 D3Q27BoundaryConditionAdapterPtr denBCAdapterInlet(new D3Q27DensityBCAdapter(3.0*(dp_lb-rhoLB)));
-        denBCAdapterInlet->setSecondaryBcOption(1);
-        D3Q27InteractorPtr inflowInt = D3Q27InteractorPtr( new D3Q27Interactor(inflow, grid, denBCAdapterInlet,Interactor3D::SOLID));
-		 
-         //rechts: druckrand
-         //Density-BC
-         //fuer Kompressibles Modell  rho = 1.0
-         D3Q27BoundaryConditionAdapterPtr denBCAdapter(new D3Q27DensityBCAdapter(rhoLB));
-         denBCAdapter->setSecondaryBcOption(1);
-         D3Q27InteractorPtr outflowInt = D3Q27InteractorPtr( new D3Q27Interactor(outflow, grid, denBCAdapter,Interactor3D::SOLID));
-
-         MetisPartitioningGridVisitor metisVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B);
-         grid->accept( metisVisitor );
-         
-      //   BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname + "/grid/blocks", WbWriterVtkXmlBinary::getInstance(), comm));
-        // if(myid == 0) ppblocks->update(0);
-         
-         SolidBlocksHelper sd(grid, comm);
-         sd.addInteractor(geoInt);
-         sd.addInteractor(inflowInt);
-         sd.addInteractor(outflowInt);
-         // sd.addInteractor(plate1_1Int);
-         // sd.addInteractor(plate1_2Int);
-         // sd.addInteractor(plate1_3Int);
-         // sd.addInteractor(plate1_4Int);
-         // sd.addInteractor(plate2Int);
-         // sd.addInteractor(plate3Int);
-		   if(myid == 0) UBLOG(logINFO,"line"<<__LINE__); 
-         sd.deleteSolidBlocks();     
-         if(myid == 0) UBLOG(logINFO,"line"<<__LINE__); 
-         grid->accept( metisVisitor );
-         if(myid == 0) UBLOG(logINFO,"line"<<__LINE__);
-
-         sd.setTransBlocks();
-         if(myid == 0) UBLOG(logINFO,"line"<<__LINE__);
-         BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname + "/grid/blocks", WbWriterVtkXmlBinary::getInstance(), comm));
-         if(myid == 0) ppblocks->update(0);
-         if(myid == 0) ppblocks.reset();
-
-         unsigned long nob = grid->getNumberOfBlocks();
-         int gl = 3;
-         unsigned long nod_temp = nob * (nodePerBlockX1+gl) * (nodePerBlockX2+gl) * (nodePerBlockX3+gl);
-         unsigned long nod = nob * (nodePerBlockX1) * (nodePerBlockX2) * (nodePerBlockX3);
-         double needMemAll  = double(nod_temp*(27*sizeof(double) + sizeof(int) + sizeof(float)*4));
-         double needMem  = needMemAll / double(comm->getNumberOfProcesses());
-
-
-         if(myid == 0)
-         {
-            UBLOG(logINFO,"Number of blocks = " << nob);
-            UBLOG(logINFO,"Number of nodes  = " << nod);
-            UBLOG(logINFO,"Necessary memory  = " << needMemAll  << " bytes");
-            UBLOG(logINFO,"Necessary memory per process = " << needMem  << " bytes");
-            UBLOG(logINFO,"Available memory per process = " << availMem << " bytes");
-         }  
-
-         //LBMKernel3DPtr kernel(new LBMKernelETD3Q27Cascaded(nodePerBlockX1, nodePerBlockX2, nodePerBlockX2));
-         //LBMKernel3DPtr kernel(new LBMKernelETD3Q27CCLB(nodePerBlockX1, nodePerBlockX2, nodePerBlockX2));
-
-		
-		  int option = 0;
-		// LBMKernel3DPtr kernel(new LBMKernelETD3Q27CCLB(nodePerBlockX1, nodePerBlockX2, nodePerBlockX3,option));
-		  LBMKernel3DPtr kernel;
-		kernel = LBMKernel3DPtr(new LBMKernelETD3Q27CCLB(nodePerBlockX1, nodePerBlockX2, nodePerBlockX3, LBMKernelETD3Q27CCLB::MAGIC));
-		//  
-		// kernel = LBMKernel3DPtr(new LBMKernelETD3Q27CCLB(nodePerBlockX1, nodePerBlockX2, nodePerBlockX3, 1));
-		 
-		 
-         BCProcessorPtr bcProc(new D3Q27ETBCProcessor());
-         kernel->setBCProcessor(bcProc);
-
-         SetKernelBlockVisitor kernelVisitor(kernel, nueLB, availMem, needMem);
-         grid->accept(kernelVisitor);
-
-         if (refineLevel > 0)
-         {
-            D3Q27SetUndefinedNodesBlockVisitor undefNodesVisitor;
-            grid->accept(undefNodesVisitor);
-         }
-		 
-		  if(myid == 0) UBLOG(logINFO,"intractor - start"); 
-          //inflow
-         grid->addAndInitInteractor(inflowInt);
-
-         //outflow
-         grid->addAndInitInteractor(outflowInt);
-         //canal
-         grid->addAndInitInteractor(geoInt);
-         // grid->addAndInitInteractor(plate1_1Int);
-         // grid->addAndInitInteractor(plate1_2Int);
-         // grid->addAndInitInteractor(plate1_3Int);
-         // grid->addAndInitInteractor(plate1_4Int);
-         // grid->addAndInitInteractor(plate2Int);
-         // grid->addAndInitInteractor(plate3Int);
-
-       
-
-         //////////////////////////////////////////////////////////////////////////
-         //connectoren setzen:
-
-         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
-         grid->accept( setConnsVisitor );
-         //////////////////////////////////////////////////////////////////////////	 
-         //domain decomposition
-         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
-         grid->accept(pqPartVisitor);
-			 
-         //////////////////////////////////////////////////////////////////////////     
-	   //Stroemungsfeld initialisieren
-         //////////////////////////////////////////////////////////////////////////
-         D3Q27ETInitDistributionsBlockVisitor initVisitor(rhoLB); //1.0
-         initVisitor.setVx1(0); 
-		   initVisitor.setVx1(0); 
-
-         grid->accept(initVisitor);
-
-         if(myid == 0)
-         {
-            //Abstände "q" als Linien rausschreiben
-            std::vector< UbTupleFloat3 > nodes;
-            std::vector< UbTupleInt2 >   lines;
-            geoInt->addQsLineSet(nodes, lines);
-            WbWriterVtkXmlBinary::getInstance()->writeLines(pathname+"/grid/qs",nodes,lines);
-         }
-
-          if(myid == 0) UBLOG(logINFO,"Preprozess - end");
-		 
-		 	  ////////////////////////
-           //Set Postprozessors
-           //////////////////////////////////////////////////////////////////////////
-           {
-            UbSchedulerPtr geoSch(new UbScheduler(1));
-            D3Q27MacroscopicQuantitiesPostprocessor ppgeo(grid,geoSch, pathname + "/grid/nodes", WbWriterVtkXmlBinary::getInstance(), conv,  comm, true);
-            grid->doPostProcess(0);
-           }
-	    
-
-      }
-
-      //////////////////////////////////////////////////////////////////////////
-	   // UbSchedulerPtr visSchAv(new UbScheduler());
-		UbSchedulerPtr visSchAv(new UbScheduler(100,100));
-      // visSchAv->addSchedule(100,10,1000);
-      // UbSchedulerPtr resSchAv(new UbScheduler());
-	   UbSchedulerPtr resSchAv(new UbScheduler(100,100));
-      // resSchAv->addSchedule(20,20,1000);
-      AverageValuesPostprocessor       Avpp(grid,  pathname + "/Turbulence/stepAV", WbWriterVtkXmlBinary::getInstance(), visSchAv/*wann wird rausgeschrieben*/,resSchAv/*wann wird resettet*/,comm);
-	  
-	   D3Q27ShearStressPostprocessor  shear(grid,  pathname + "/shear/step", WbWriterVtkXmlBinary::getInstance(), visSchAv/*wann wird rausgeschrieben*/,resSchAv/*wann wird resettet*/,comm,iProcessor); 
-	   //D3Q27ShearStressPostprocessor  shear(grid,  pathname + "/shear/step", WbWriterVtkXmlBinary::getInstance(), visSchAv/*wann wird rausgeschrieben*/,resSchAv/*wann wird resettet*/,comm);
-	   shear.addInteractor(geoInt);
-	   ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-	  
-
-      UbSchedulerPtr nupsSch(new UbScheduler(1, 5, 10));
-      NUPSCounterPostprocessor npr(grid, nupsSch, pathname + "/results/nups.txt", comm);
-
-      double outTime = 100.0;
-      UbSchedulerPtr stepSch(new UbScheduler(outTime));
-      D3Q27MacroscopicQuantitiesPostprocessor pp(grid,stepSch, pathname + "/steps/step", WbWriterVtkXmlBinary::getInstance(), conv,  comm);
-      //////////////////////////////////////////////////////////////////////////
-      //PathLine
-       UbSchedulerPtr plSch(new UbScheduler(5000, 5000));
-      const int numberofparticle=20;
-	
-	  std::vector<UbTupleDouble3 > potisions;
-	  double randomx[numberofparticle];
-	  double randomy[numberofparticle];
-	  double randomz[numberofparticle];
-	  double lowestx,highestx,lowesty,highesty,lowestz,highestz;
-	  if(myid==0)
-	  {
-		  for(int i = 0; i < numberofparticle; i++)
-		  {
-			  double random; 
-	        lowestx =-10300.0;  lowesty =-230;          lowestz =-250;
-	        highestx=-9792.0;  highesty=-330;          highestz=-250; 
-		  
-	      double rangex=(highestx-lowestx),rangey=(highesty-lowesty),rangez=(highestz-lowestz);	
-           randomx[i] = lowestx+(rangex*rand()/(RAND_MAX + 1.0));
-		   randomy[i] = lowesty+(rangey*rand()/(RAND_MAX + 1.0));
-	       randomz[i] = lowestz+(rangez*rand()/(RAND_MAX + 1.0));
-		  //val<1>(potisions[i])= 0.506983973456;
-		  //val<2>(potisions[i]) = lowesty+(rangey*rand()/(RAND_MAX + 1.0));
-		   //val<3>(potisions[i]) = lowestz+(rangez*rand()/(RAND_MAX + 1.0));
-		  }
-		  for (int i=0;i<comm->getNumberOfProcesses();i++)
-		  {
-			  if (i!=0)
-			  {
-			      MPI_Send(randomx,numberofparticle, MPI_DOUBLE_PRECISION,i,i,MPI_COMM_WORLD);
-				  MPI_Send(randomy,numberofparticle, MPI_DOUBLE_PRECISION,i,i,MPI_COMM_WORLD);
-				  MPI_Send(randomz,numberofparticle, MPI_DOUBLE_PRECISION,i,i,MPI_COMM_WORLD);
-			  }
-		  }
-	  }
-	  if (myid!=0)
-	  {
-		  MPI_Status status; 
-		  MPI_Recv(randomx,numberofparticle, MPI_DOUBLE_PRECISION,0,MPI_ANY_TAG,MPI_COMM_WORLD,&status);
-		  MPI_Recv(randomy,numberofparticle, MPI_DOUBLE_PRECISION,0,MPI_ANY_TAG,MPI_COMM_WORLD,&status);
-		  MPI_Recv(randomz,numberofparticle, MPI_DOUBLE_PRECISION,0,MPI_ANY_TAG,MPI_COMM_WORLD,&status);
-	  }
-	  for(int i = 0; i < numberofparticle; i++)
-	  {	
-		  potisions.push_back( makeUbTuple(randomx[i],randomy[i],randomz[i]) );
-		  //val<1>(potisions[i])= 0.506983973456;
-		  //val<2>(potisions[i]) = randomy[i];
-		  //val<3>(potisions[i]) = randomz[i];
-	  }
-	 //  UBLOG(logINFO,"Rank="<<myid<<" positions  = " <<val<1>(potisions)<< " "<<val<2>(potisions)<<" "<< val<3>(potisions));
-	 // D3Q27InterpolationProcessorPtr iProcessor2;
-     // D3Q27PathLinePostprocessorMcpart pathLine(grid, pathname + "/pathLine/pathLine", WbWriterVtkXmlASCII::getInstance(), conv, plSch, comm,potisions, nueLB, iProcessor);
-      //////////////////////////////////////////////////////////////////////////
-      //Simulation
-      //////////////////////////////////////////////////////////////////////////
-
-	  double endTime = 1000.0;
-      UbSchedulerPtr visSch(stepSch);
-      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, visSch));
-      if(myid == 0) UBLOG(logINFO,"Simulation-start");
-      calculation->calculate();
-      if(myid == 0) UBLOG(logINFO,"Simulation-end");
-
-   }
-   catch(std::exception& e)
-   {
-      cerr << e.what() << endl;
-   }
-   catch(std::string& s)
-   {
-      cerr << s << endl;
-   }
-   catch(...)
-   {
-      cerr << "unknown exception" << endl;
-   }
-
+#include <vfluids.h>
+using namespace std;
+
+void orifice(const char *cstr)
+{
+   try
+   {
+      CommunicatorPtr comm(new MPICommunicator());
+      int myid = comm->getProcessID();
+      int numprocs = comm->getNumberOfProcesses();
+
+      string machine = QUOTEME(CAB_MACHINE);
+      string pathname; 
+      double availMem = 0;
+      string geoFile;
+      int numOfThreads = 1;
+
+      if(machine == "BOMBADIL") 
+      {
+    //     pathname = "/work/ehsan/orifice";
+		 pathname = "d:/temp/orifice";
+         availMem = 6.0e9;
+		  int numOfThreads = 1;
+         //geoFile = "c:/Data/micropart/DK19_7_02_Martin.stl";
+         //geoFile = "c:/Data/micropart/ktoolcav.stl";
+         //geoFile = "c:/Data/micropart/boxN.stl";
+        geoFile = "d:/Data/Ehsan/orifice.stl";
+      }
+      else if(machine == "M01" || machine == "M02")      
+      {
+        // pathname = "/work/koskuche/scratch/mcpart/out";
+		  pathname = "/work/ehsan/orifice";
+         availMem = 12.0e9;
+		  geoFile = "/work/ehsan/data/orifice.stl";
+         //geoFile = "/home/koskuche/data/micropart/DK19_7_02_Martin.stl";
+
+         numOfThreads = 1;
+         if(myid ==0)
+         {
+            stringstream logFilename;
+            logFilename <<  pathname + "/logfile"+UbSystem::toString(UbSystem::getTimeStamp())+"_"+UbSystem::toString(myid)+".txt";
+            UbLog::output_policy::setStream(logFilename.str());
+         }
+      }
+      else throw UbException(UB_EXARGS, "unknown CAB_MACHINE");
+
+      UbLog::reportingLevel() = logINFO;
+      //UbLog::reportingLevel() = logDEBUG1;
+
+      int nodePerBlockX1 =8; //Anzahl an Knoten pro Block
+      int nodePerBlockX2 =8;//(int)16;
+      int nodePerBlockX3 =8;//8; //(int)16;
+
+      double bH = nodePerBlockX1;    //gewuenschte Rand- und Blockbreite
+
+      //Simulation Parameters
+      const int baseLevel = 0;
+      const int refineLevel =1;
+      //length [m]
+      double lSI = 1.55;//223.2;
+      //length [LB]
+      double lLB = 15;
+
+	  
+      double dx =lSI/lLB *2;
+
+      double left_offset = 0;//*0.5;
+      double right_offset  = 159;//0.5;//2*0.5
+      double front_offset = 750;//0.15;
+      double back_offset  = 750;//0.15;
+      double top_offset = 250;//0.0;
+      double bottom_offset  =750;// 70;//0.07;
+	  
+	   LBMReal vLB =0.00016103/5.0*sqrt(2.0);//0.00016103;
+       LBMReal Re;
+       LBMReal rhoLB = 0.0;
+       LBMReal nueLB = 0.0000249;//(vLB*lLB)/Re;
+       Re = (vLB*(500/dx))/nueLB;
+       double dp_Ph=200.0*100000;//
+	   double dp_lb=dp_Ph*0.001*(nueLB*dx)*(nueLB*dx);//nue_ph=10e-6 and dx is in micrometer
+      // LBMReal nueLB = 0.000016103;
+      // LBMReal Re=15000;
+      // LBMReal rhoLB = 0.0;
+      // LBMReal vLB =nueLB*Re/(500.0/dx);
+     // // Re = (vLB*(0.303/dx))/nueLB;
+	   // //Re = (vLB*lLB)/nueLB;
+	  
+      // LBMReal rhoWord = 1e-15;//kg/micrometre^3;//1000.0;
+	  // LBMReal nueRE = 1e6;//micromter^2/s;//0.000001;
+	  // LBMReal  vWorld=300*1e6;//micrometer/s;//nueRE*Re/ (lSI*4.0/9.0);
+	  LBMUnitConverterPtr conv = LBMUnitConverterPtr(new LBMUnitConverter());
+      //conv->init(lSI*1e-6,30000,rhoWord,vWorld,lLB,1.0/*rhoLB*/,vLB);
+      
+	 
+ //////////////////////////////////////////////////////////////////////////
+      GbObject3DPtr refineCube1(new  GbCuboid3D(78.0,-1.0,-1.0, 81/*370.0*/,20.0/*354.0*/,20.0));//-530.0,-280.0, -72.0, 530.0,354.0,70.0));
+      if(myid == 0) GbSystem3D::writeGeoObject(refineCube1.get(), pathname+"/geo/refineCube1", WbWriterVtkXmlASCII::getInstance());
+
+   //   GbObject3DPtr refineCube2(new  GbCuboid3D(-230.0,-90.0, -684.0/*-72.0*/, 600,100.0,70.0));
+   //   if(myid == 0) GbSystem3D::writeGeoObject(refineCube2.get(), pathname+"/geo/refineCube2", WbWriterVtkXmlASCII::getInstance());
+	  //
+	  // GbObject3DPtr refineCube3(new  GbCuboid3D(-350.0,-957.0/*-120.0*/,-684.0/*-684.0*//* -72.0*/, 1700,957.0/*120.0*/,70.0));
+   //   if(myid == 0) GbSystem3D::writeGeoObject(refineCube3.get(), pathname+"/geo/refineCube3", WbWriterVtkXmlASCII::getInstance());
+	  //
+	  // GbObject3DPtr refineCube4(new  GbCuboid3D(-170.0,-60.0, -684.0/*-72.0*/, 200,60.0,70.0));
+   //   if(myid == 0) GbSystem3D::writeGeoObject(refineCube4.get(), pathname+"/geo/refineCube4", WbWriterVtkXmlASCII::getInstance());
+	  //
+	  // GbObject3DPtr refineCubeInlet(new  GbCuboid3D(-10600.0,-600.0, -600.0/*-72.0*/, -9000,600.0,60.0));
+   //   if(myid == 0) GbSystem3D::writeGeoObject(refineCubeInlet.get(), pathname+"/geo/refineCubeInlet", WbWriterVtkXmlASCII::getInstance());
+	  //
+	  //GbObject3DPtr refineCubeOutlet(new  GbCuboid3D(9000,-600.0, -600.0/*-72.0*/,10550.0 ,600.0,60.0));
+   //   if(myid == 0) GbSystem3D::writeGeoObject(refineCubeOutlet.get(), pathname+"/geo/refineCubeOutlet", WbWriterVtkXmlASCII::getInstance());
+      //////////////////////////////////////////////////////////////////////////
+      D3Q27TriFaceMeshInteractorPtr geoInt;
+	  /////////////////
+      //Grid3DPtr grid(new Grid3D());
+        Grid3DPtr grid(new Grid3D(comm));
+
+      UbSchedulerPtr rSch(new UbScheduler());
+      rSch->addSchedule(100, 200, 20000);
+      RestartPostprocessorPtr rp(new RestartPostprocessor(grid, rSch, comm, pathname+"/checkpoints", RestartPostprocessor::BINARY));
+
+      std::string opt;
+         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
+
+      if(cstr!= NULL)
+         opt = std::string(cstr);
+
+      if/*(cstr== NULL)*/(cstr!= NULL)
+      {
+         if(myid==0) UBLOG(logINFO,"Restart step: " << opt);
+         grid = rp->restart(UbSystem::stringTo<int>(opt));
+         rp->reconnect(grid);
+
+         // SetForcingBlockVisitor forcingVisitor(0.0, 0.0, 0.0);
+         // grid->accept(forcingVisitor);
+
+         //D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
+         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
+         grid->accept( setConnsVisitor );
+		  if(myid==0) UBLOG(logINFO,"Restart finish: " << opt);
+	 
+      }
+      else
+      {
+         if(myid ==0)
+         {
+            UBLOG(logINFO,"L = " <<lLB );
+            UBLOG(logINFO,"v = " <<vLB );
+            UBLOG(logINFO,"rho = " <<rhoLB );
+            UBLOG(logINFO,"nue = " << nueLB );
+			UBLOG(logINFO,"dx = " << dx );
+            UBLOG(logINFO,"Re = " << Re );
+			 UBLOG(logINFO,"dp_lb = " << dp_lb );
+            UBLOG(logINFO,"Preprozess - start");
+         }
+
+
+         ////////////////////////////////////////////////////////////////////////
+         //Grid
+         //////////////////////////////////////////////////////////////////////////
+         grid->setDeltaX(dx);
+         grid->setBlockNX(nodePerBlockX1, nodePerBlockX2, nodePerBlockX3);
+
+         ////////////////////////////////////////////////////////////////////////////
+         //// Geometrie
+         ////////////////////////////////////////////////////////////////////////////
+         GbTriFaceMesh3DPtr geo (GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(geoFile,"geo"));
+
+         if(myid == 0) GbSystem3D::writeGeoObject(geo.get(), pathname+"/geo/geo", WbWriterVtkXmlASCII::getInstance());
+
+         ////////////////////////////////////////////////////////////////////////////
+         //// Randgeometrien erstellen
+         ////////////////////////////////////////////////////////////////////////////
+         double shiftForMG=grid->getDeltaX(refineLevel)*nodePerBlockX1 / 3.0*2.0;
+          GbCuboid3DPtr plate1  = GbCuboid3DPtr( new GbCuboid3D( -7.5, -1.515e-1, -6.831e-2, 7.5, 1.515e-1, 0.0 ));
+
+           GbCuboid3DPtr plate2  = GbCuboid3DPtr( new GbCuboid3D( -1.5e-1, -16.51e-1, -16.831e-2, 1.5e-1, -1.6e-2, 1.0 ));
+           GbCuboid3DPtr plate3  = GbCuboid3DPtr( new GbCuboid3D( -1.5e-1, 1.6e-2, -16.831e-2, 1.5e-1, 16.515e-1, 1.0 ));
+
+          // GbCuboid3DPtr plate1_1  = GbCuboid3DPtr( new GbCuboid3D( -7.5, -2.515e-1, -1.0e-1, 7.5, 2.515e-1, -6.831e-2 ));
+          // GbCuboid3DPtr plate1_2  = GbCuboid3DPtr( new GbCuboid3D( -7.5, -2.515e-1, -0.0000001, 7.5, 2.515e-1, 1.0e-1 ));
+          // GbCuboid3DPtr plate1_3  = GbCuboid3DPtr( new GbCuboid3D( -7.5, 1.515e-1, -6.831e-2, 7.5, 2.515e-1, 0.0  ));
+          // GbCuboid3DPtr plate1_4  = GbCuboid3DPtr( new GbCuboid3D( -7.5, -2.515e-1, 0.0, 7.5, -1.515e-1, -1.0e-1 ));
+
+          // GbCuboid3DPtr inflow  = GbCuboid3DPtr( new GbCuboid3D( -8.0, -1.0, -1.0, -7.5, 1.0, 1.0 ));
+          // GbCuboid3DPtr outflow = GbCuboid3DPtr( new GbCuboid3D( 7.5, -1.0, -1.0, 8.0, 1.0, 1.0 ));
+		  
+		   // GbCuboid3DPtr plate2  = GbCuboid3DPtr( new GbCuboid3D( -1.5e-1, -16.51e-1, -16.831e-2, 1.5e-1, -1.6e-2, 1.0 ));
+          // GbCuboid3DPtr plate3  = GbCuboid3DPtr( new GbCuboid3D( -1.5e-1, 1.6e-2, -16.831e-2, 1.5e-1, 16.515e-1, 1.0 ));
+
+          // GbCuboid3DPtr plate1_1  = GbCuboid3DPtr( new GbCuboid3D( -left_offset-bH*dx, back_offset, -bottom_offset-bH*dx, right_offset+bH*dx, back_offset+bH*dx, top_offset+bH*dx ));
+          // GbCuboid3DPtr plate1_2  = GbCuboid3DPtr( new GbCuboid3D( -left_offset-bH*dx, -front_offset-bH*dx, -bottom_offset-bH*dx, right_offset+bH*dx, -front_offset, top_offset+bH*dx ));
+          // GbCuboid3DPtr plate1_3  = GbCuboid3DPtr( new GbCuboid3D( -left_offset-bH*dx, -front_offset-bH*dx, top_offset, right_offset+bH*dx, back_offset+bH*dx, top_offset+bH*dx+2.0*dx ));
+          // GbCuboid3DPtr plate1_4  = GbCuboid3DPtr( new GbCuboid3D( -left_offset-bH*dx, -front_offset-bH*dx, -bottom_offset-bH*dx, right_offset+bH*dx, back_offset+bH*dx, -bottom_offset ));
+
+          //GbCuboid3DPtr inflow  = GbCuboid3DPtr( new GbCuboid3D( -left_offset-5*bH*dx, -front_offset-5*bH*dx, -bottom_offset-5*bH*dx, -left_offset, back_offset+5*bH*dx, top_offset+5*bH*dx ));
+          //GbCuboid3DPtr outflow = GbCuboid3DPtr( new GbCuboid3D( right_offset, -front_offset-5*bH*dx, -bottom_offset-5*bH*dx, right_offset+5.0*bH*dx, back_offset+5*bH*dx, top_offset+5*bH*dx ));
+		  GbCuboid3DPtr inflow  = GbCuboid3DPtr( new GbCuboid3D( -5.0,-1.5, -1.5, 1.5, 20.0, 20.0 ));
+		  GbCuboid3DPtr outflow = GbCuboid3DPtr( new GbCuboid3D( 157.50,-1.5, -1.5, 160.5, 20.0, 20.0));
+
+
+		   GbObject3DPtr gridCube(new GbCuboid3D(inflow->getX1Maximum()-4.0*dx,inflow->getX2Minimum()-4.0*dx ,inflow->getX3Minimum()-4.0*dx,
+			   outflow->getX1Minimum()-4.0*dx,outflow->getX2Maximum()-4.0*dx ,outflow->getX3Maximum()-4.0*dx
+                                               ));
+
+         GenBlocksGridVisitor genBlocks;
+         genBlocks.addGeoObject(gridCube);
+         grid->accept(genBlocks);
+		  
+         if(myid == 0)
+         {
+            GbSystem3D::writeGeoObject(gridCube.get(),pathname+"/geo/gridCube", WbWriterVtkXmlASCII::getInstance());
+            //GbSystem3D::writeGeoObject(plate2.get(),pathname+"/geo/plate2", WbWriterVtkXmlASCII::getInstance());
+            //GbSystem3D::writeGeoObject(plate3.get(),pathname+"/geo/plate3", WbWriterVtkXmlASCII::getInstance());
+
+            // GbSystem3D::writeGeoObject(plate1_1.get(),pathname+"/geo/plate1_1", WbWriterVtkXmlASCII::getInstance());
+            // GbSystem3D::writeGeoObject(plate1_2.get(),pathname+"/geo/plate1_2", WbWriterVtkXmlASCII::getInstance());
+            // GbSystem3D::writeGeoObject(plate1_3.get(),pathname+"/geo/plate1_3", WbWriterVtkXmlASCII::getInstance());
+            // GbSystem3D::writeGeoObject(plate1_4.get(),pathname+"/geo/plate1_4", WbWriterVtkXmlASCII::getInstance());
+
+            GbSystem3D::writeGeoObject(inflow.get(),pathname+"/geo/inflow", WbWriterVtkXmlASCII::getInstance());
+            GbSystem3D::writeGeoObject(outflow.get(),pathname+"/geo/outflow", WbWriterVtkXmlASCII::getInstance());
+         }
+   
+
+         if (refineLevel > 0)
+         {
+		  if(myid == 0) UBLOG(logINFO,"Refinement - start");   
+            RefineCrossAndInsideGbObjectHelper refineHelper(grid, refineLevel);
+            refineHelper.addGbObject(refineCube1, refineLevel);
+    //        refineHelper.addGbObject(refineCube3, 2);
+			 //refineHelper.addGbObject(refineCube2, 3);
+			 //refineHelper.addGbObject(refineCube4, 4);
+			 //
+			 //refineHelper.addGbObject(refineCubeInlet, 1);
+			 //refineHelper.addGbObject(refineCubeOutlet, 1);
+            refineHelper.refine();
+            if(myid == 0) UBLOG(logINFO,"Refinement - end");   
+		 
+		 
+           // RefineCrossAndInsideGbObjectBlockVisitor refVisitor1(refineCube1, refineLevel-4);
+            // grid->accept(refVisitor1);
+
+			// RefineCrossAndInsideGbObjectBlockVisitor refVisitor3(refineCube3, refineLevel-3);
+            // grid->accept(refVisitor3);
+
+            // RefineCrossAndInsideGbObjectBlockVisitor refVisitor2(refineCube2, refineLevel-2);
+            // grid->accept(refVisitor2);
+			
+			 // RefineCrossAndInsideGbObjectBlockVisitor refVisitor4(refineCube4, refineLevel-1);
+            // grid->accept(refVisitor4);
+
+            // RatioBlockVisitor ratioVisitor(refineLevel);
+            // grid->accept(ratioVisitor);
+
+            // RatioSmoothBlockVisitor ratioSmoothVisitor(refineLevel);
+            // grid->accept(ratioSmoothVisitor);
+
+            // OverlapBlockVisitor overlapVisitor(refineLevel);
+            // grid->accept(overlapVisitor);
+
+            // std::vector<int> dirs;
+            // D3Q27System::getLBMDirections(dirs);
+            // SetInterpolationDirsBlockVisitor interDirsVisitor(dirs);
+            // grid->accept(interDirsVisitor);
+            // if(myid == 0) UBLOG(logINFO,"Refinement - end");	
+         }
+
+         //////////////////////////////////////////////////////////////////////////
+         //INTERAKTOREN SETZEN (=Randbedingungen)
+         //////////////////////////////////////////////////////////////////////////
+         //oben/unten = Haftrand
+         int bbOption = 1; //0=simple Bounce Back, 1=quadr. BB
+         D3Q27BoundaryConditionAdapterPtr bcObst(new D3Q27NoSlipBCAdapter(bbOption));
+         geoInt = D3Q27TriFaceMeshInteractorPtr( new D3Q27TriFaceMeshInteractor(geo, grid, D3Q27BoundaryConditionAdapterPtr(new D3Q27NoSlipBCAdapter(bbOption)),Interactor3D::INVERSESOLID, Interactor3D::SIMPLE));
+	     geoInt->setUseHalfSpaceCheck(true);
+         geoInt->setRegardPointInObjectTest(true);
+         if(myid == 0) UBLOG(logINFO,"stl - end"); 
+         //D3Q27InteractorPtr plate1Int(new D3Q27Interactor(plate1, grid, bcObst,Interactor3D::INVERSESOLID));
+         // D3Q27InteractorPtr plate2Int(new D3Q27Interactor(plate2, grid, bcObst,Interactor3D::SOLID));
+         // D3Q27InteractorPtr plate3Int(new D3Q27Interactor(plate3, grid, bcObst,Interactor3D::SOLID));
+
+         // D3Q27InteractorPtr plate1_1Int(new D3Q27Interactor(plate1_1, grid, bcObst,Interactor3D::SOLID));
+         // D3Q27InteractorPtr plate1_2Int(new D3Q27Interactor(plate1_2, grid, bcObst,Interactor3D::SOLID));
+         // D3Q27InteractorPtr plate1_3Int(new D3Q27Interactor(plate1_3, grid, bcObst,Interactor3D::SOLID));
+         // D3Q27InteractorPtr plate1_4Int(new D3Q27Interactor(plate1_4, grid, bcObst,Interactor3D::SOLID));
+
+         //links: geschwindigkeits-einfluss
+         //Velocity-BC
+         //////////////////////////////////////////////////////////////////////////
+         mu::Parser fct;
+         fct.DefineConst("vx1"  , vLB*9.0/4.0 );
+         //fct = MathUtil::getDuctParaboloidX(0, 250*2.0, -51.08/2, 51.08, vLB*9.0/4.0);
+         fct.SetExpr("vx1");
+         //////////////////////////////////////////////////////////////////////////
+
+         //////////////////////////////////////////////////////////////////////////
+             D3Q27BoundaryConditionAdapterPtr velBCAdapter = D3Q27BoundaryConditionAdapterPtr(new D3Q27VelocityBCAdapter (false, false ,true ,fct, 0, D3Q27BCFunction::INFCONST));
+    //     D3Q27BoundaryConditionAdapterPtr velBCAdapter = D3Q27BoundaryConditionAdapterPtr(new D3Q27VelocityBCAdapter (false, false ,true ,fct,fct,fct, 0, D3Q27BCFunction::INFCONST));
+			 // velBCAdapter->setSecondaryBcOption(2);
+            // D3Q27InteractorPtr inflowInt  = D3Q27InteractorPtr( new D3Q27Interactor(inflow, grid, velBCAdapter, Interactor3D::SOLID));
+
+		 D3Q27BoundaryConditionAdapterPtr denBCAdapterInlet(new D3Q27DensityBCAdapter(3.0*(dp_lb-rhoLB)));
+        denBCAdapterInlet->setSecondaryBcOption(1);
+        D3Q27InteractorPtr inflowInt = D3Q27InteractorPtr( new D3Q27Interactor(inflow, grid, denBCAdapterInlet,Interactor3D::SOLID));
+		 
+         //rechts: druckrand
+         //Density-BC
+         //fuer Kompressibles Modell  rho = 1.0
+         D3Q27BoundaryConditionAdapterPtr denBCAdapter(new D3Q27DensityBCAdapter(rhoLB));
+         denBCAdapter->setSecondaryBcOption(1);
+         D3Q27InteractorPtr outflowInt = D3Q27InteractorPtr( new D3Q27Interactor(outflow, grid, denBCAdapter,Interactor3D::SOLID));
+
+         MetisPartitioningGridVisitor metisVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B);
+         grid->accept( metisVisitor );
+         
+      //   BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname + "/grid/blocks", WbWriterVtkXmlBinary::getInstance(), comm));
+        // if(myid == 0) ppblocks->update(0);
+         
+         SolidBlocksHelper sd(grid, comm);
+         sd.addInteractor(geoInt);
+         sd.addInteractor(inflowInt);
+         sd.addInteractor(outflowInt);
+         // sd.addInteractor(plate1_1Int);
+         // sd.addInteractor(plate1_2Int);
+         // sd.addInteractor(plate1_3Int);
+         // sd.addInteractor(plate1_4Int);
+         // sd.addInteractor(plate2Int);
+         // sd.addInteractor(plate3Int);
+		   if(myid == 0) UBLOG(logINFO,"line"<<__LINE__); 
+         sd.deleteSolidBlocks();     
+         if(myid == 0) UBLOG(logINFO,"line"<<__LINE__); 
+         grid->accept( metisVisitor );
+         if(myid == 0) UBLOG(logINFO,"line"<<__LINE__);
+
+         sd.setTransBlocks();
+         if(myid == 0) UBLOG(logINFO,"line"<<__LINE__);
+         BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname + "/grid/blocks", WbWriterVtkXmlBinary::getInstance(), comm));
+         if(myid == 0) ppblocks->update(0);
+         if(myid == 0) ppblocks.reset();
+
+         unsigned long nob = grid->getNumberOfBlocks();
+         int gl = 3;
+         unsigned long nod_temp = nob * (nodePerBlockX1+gl) * (nodePerBlockX2+gl) * (nodePerBlockX3+gl);
+         unsigned long nod = nob * (nodePerBlockX1) * (nodePerBlockX2) * (nodePerBlockX3);
+         double needMemAll  = double(nod_temp*(27*sizeof(double) + sizeof(int) + sizeof(float)*4));
+         double needMem  = needMemAll / double(comm->getNumberOfProcesses());
+
+
+         if(myid == 0)
+         {
+            UBLOG(logINFO,"Number of blocks = " << nob);
+            UBLOG(logINFO,"Number of nodes  = " << nod);
+            UBLOG(logINFO,"Necessary memory  = " << needMemAll  << " bytes");
+            UBLOG(logINFO,"Necessary memory per process = " << needMem  << " bytes");
+            UBLOG(logINFO,"Available memory per process = " << availMem << " bytes");
+         }  
+
+         //LBMKernel3DPtr kernel(new LBMKernelETD3Q27Cascaded(nodePerBlockX1, nodePerBlockX2, nodePerBlockX2));
+         //LBMKernel3DPtr kernel(new LBMKernelETD3Q27CCLB(nodePerBlockX1, nodePerBlockX2, nodePerBlockX2));
+
+		
+		  int option = 0;
+		// LBMKernel3DPtr kernel(new LBMKernelETD3Q27CCLB(nodePerBlockX1, nodePerBlockX2, nodePerBlockX3,option));
+		  LBMKernel3DPtr kernel;
+		kernel = LBMKernel3DPtr(new LBMKernelETD3Q27CCLB(nodePerBlockX1, nodePerBlockX2, nodePerBlockX3, LBMKernelETD3Q27CCLB::MAGIC));
+		//  
+		// kernel = LBMKernel3DPtr(new LBMKernelETD3Q27CCLB(nodePerBlockX1, nodePerBlockX2, nodePerBlockX3, 1));
+		 
+		 
+         BCProcessorPtr bcProc(new D3Q27ETBCProcessor());
+         kernel->setBCProcessor(bcProc);
+
+         SetKernelBlockVisitor kernelVisitor(kernel, nueLB, availMem, needMem);
+         grid->accept(kernelVisitor);
+
+         if (refineLevel > 0)
+         {
+            D3Q27SetUndefinedNodesBlockVisitor undefNodesVisitor;
+            grid->accept(undefNodesVisitor);
+         }
+		 
+		  if(myid == 0) UBLOG(logINFO,"intractor - start"); 
+          //inflow
+         grid->addAndInitInteractor(inflowInt);
+
+         //outflow
+         grid->addAndInitInteractor(outflowInt);
+         //canal
+         grid->addAndInitInteractor(geoInt);
+         // grid->addAndInitInteractor(plate1_1Int);
+         // grid->addAndInitInteractor(plate1_2Int);
+         // grid->addAndInitInteractor(plate1_3Int);
+         // grid->addAndInitInteractor(plate1_4Int);
+         // grid->addAndInitInteractor(plate2Int);
+         // grid->addAndInitInteractor(plate3Int);
+
+       
+
+         //////////////////////////////////////////////////////////////////////////
+         //connectoren setzen:
+
+         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
+         grid->accept( setConnsVisitor );
+         //////////////////////////////////////////////////////////////////////////	 
+         //domain decomposition
+         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
+         grid->accept(pqPartVisitor);
+			 
+         //////////////////////////////////////////////////////////////////////////     
+	   //Stroemungsfeld initialisieren
+         //////////////////////////////////////////////////////////////////////////
+         D3Q27ETInitDistributionsBlockVisitor initVisitor(rhoLB); //1.0
+         initVisitor.setVx1(0); 
+		   initVisitor.setVx1(0); 
+
+         grid->accept(initVisitor);
+
+         if(myid == 0)
+         {
+            //Abstände "q" als Linien rausschreiben
+            std::vector< UbTupleFloat3 > nodes;
+            std::vector< UbTupleInt2 >   lines;
+            geoInt->addQsLineSet(nodes, lines);
+            WbWriterVtkXmlBinary::getInstance()->writeLines(pathname+"/grid/qs",nodes,lines);
+         }
+
+          if(myid == 0) UBLOG(logINFO,"Preprozess - end");
+		 
+		 	  ////////////////////////
+           //Set Postprozessors
+           //////////////////////////////////////////////////////////////////////////
+           {
+            UbSchedulerPtr geoSch(new UbScheduler(1));
+            D3Q27MacroscopicQuantitiesPostprocessor ppgeo(grid,geoSch, pathname + "/grid/nodes", WbWriterVtkXmlBinary::getInstance(), conv,  comm, true);
+            grid->doPostProcess(0);
+           }
+	    
+
+      }
+
+      //////////////////////////////////////////////////////////////////////////
+	   // UbSchedulerPtr visSchAv(new UbScheduler());
+		UbSchedulerPtr visSchAv(new UbScheduler(100,100));
+      // visSchAv->addSchedule(100,10,1000);
+      // UbSchedulerPtr resSchAv(new UbScheduler());
+	   UbSchedulerPtr resSchAv(new UbScheduler(100,100));
+      // resSchAv->addSchedule(20,20,1000);
+      AverageValuesPostprocessor       Avpp(grid,  pathname + "/Turbulence/stepAV", WbWriterVtkXmlBinary::getInstance(), visSchAv/*wann wird rausgeschrieben*/,resSchAv/*wann wird resettet*/,comm);
+	  
+	   D3Q27ShearStressPostprocessor  shear(grid,  pathname + "/shear/step", WbWriterVtkXmlBinary::getInstance(), visSchAv/*wann wird rausgeschrieben*/,resSchAv/*wann wird resettet*/,comm,iProcessor); 
+	   //D3Q27ShearStressPostprocessor  shear(grid,  pathname + "/shear/step", WbWriterVtkXmlBinary::getInstance(), visSchAv/*wann wird rausgeschrieben*/,resSchAv/*wann wird resettet*/,comm);
+	   shear.addInteractor(geoInt);
+	   ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+	  
+
+      UbSchedulerPtr nupsSch(new UbScheduler(1, 5, 10));
+      NUPSCounterPostprocessor npr(grid, nupsSch, pathname + "/results/nups.txt", comm);
+
+      double outTime = 100.0;
+      UbSchedulerPtr stepSch(new UbScheduler(outTime));
+      D3Q27MacroscopicQuantitiesPostprocessor pp(grid,stepSch, pathname + "/steps/step", WbWriterVtkXmlBinary::getInstance(), conv,  comm);
+      //////////////////////////////////////////////////////////////////////////
+      //PathLine
+       UbSchedulerPtr plSch(new UbScheduler(5000, 5000));
+      const int numberofparticle=20;
+	
+	  std::vector<UbTupleDouble3 > potisions;
+	  double randomx[numberofparticle];
+	  double randomy[numberofparticle];
+	  double randomz[numberofparticle];
+	  double lowestx,highestx,lowesty,highesty,lowestz,highestz;
+	  if(myid==0)
+	  {
+		  for(int i = 0; i < numberofparticle; i++)
+		  {
+			  double random; 
+	        lowestx =-10300.0;  lowesty =-230;          lowestz =-250;
+	        highestx=-9792.0;  highesty=-330;          highestz=-250; 
+		  
+	      double rangex=(highestx-lowestx),rangey=(highesty-lowesty),rangez=(highestz-lowestz);	
+           randomx[i] = lowestx+(rangex*rand()/(RAND_MAX + 1.0));
+		   randomy[i] = lowesty+(rangey*rand()/(RAND_MAX + 1.0));
+	       randomz[i] = lowestz+(rangez*rand()/(RAND_MAX + 1.0));
+		  //val<1>(potisions[i])= 0.506983973456;
+		  //val<2>(potisions[i]) = lowesty+(rangey*rand()/(RAND_MAX + 1.0));
+		   //val<3>(potisions[i]) = lowestz+(rangez*rand()/(RAND_MAX + 1.0));
+		  }
+		  for (int i=0;i<comm->getNumberOfProcesses();i++)
+		  {
+			  if (i!=0)
+			  {
+			      MPI_Send(randomx,numberofparticle, MPI_DOUBLE_PRECISION,i,i,MPI_COMM_WORLD);
+				  MPI_Send(randomy,numberofparticle, MPI_DOUBLE_PRECISION,i,i,MPI_COMM_WORLD);
+				  MPI_Send(randomz,numberofparticle, MPI_DOUBLE_PRECISION,i,i,MPI_COMM_WORLD);
+			  }
+		  }
+	  }
+	  if (myid!=0)
+	  {
+		  MPI_Status status; 
+		  MPI_Recv(randomx,numberofparticle, MPI_DOUBLE_PRECISION,0,MPI_ANY_TAG,MPI_COMM_WORLD,&status);
+		  MPI_Recv(randomy,numberofparticle, MPI_DOUBLE_PRECISION,0,MPI_ANY_TAG,MPI_COMM_WORLD,&status);
+		  MPI_Recv(randomz,numberofparticle, MPI_DOUBLE_PRECISION,0,MPI_ANY_TAG,MPI_COMM_WORLD,&status);
+	  }
+	  for(int i = 0; i < numberofparticle; i++)
+	  {	
+		  potisions.push_back( makeUbTuple(randomx[i],randomy[i],randomz[i]) );
+		  //val<1>(potisions[i])= 0.506983973456;
+		  //val<2>(potisions[i]) = randomy[i];
+		  //val<3>(potisions[i]) = randomz[i];
+	  }
+	 //  UBLOG(logINFO,"Rank="<<myid<<" positions  = " <<val<1>(potisions)<< " "<<val<2>(potisions)<<" "<< val<3>(potisions));
+	 // D3Q27InterpolationProcessorPtr iProcessor2;
+     // D3Q27PathLinePostprocessorMcpart pathLine(grid, pathname + "/pathLine/pathLine", WbWriterVtkXmlASCII::getInstance(), conv, plSch, comm,potisions, nueLB, iProcessor);
+      //////////////////////////////////////////////////////////////////////////
+      //Simulation
+      //////////////////////////////////////////////////////////////////////////
+
+	  double endTime = 1000.0;
+      UbSchedulerPtr visSch(stepSch);
+      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, visSch));
+      if(myid == 0) UBLOG(logINFO,"Simulation-start");
+      calculation->calculate();
+      if(myid == 0) UBLOG(logINFO,"Simulation-end");
+
+   }
+   catch(std::exception& e)
+   {
+      cerr << e.what() << endl;
+   }
+   catch(std::string& s)
+   {
+      cerr << s << endl;
+   }
+   catch(...)
+   {
+      cerr << "unknown exception" << endl;
+   }
+
 }
\ No newline at end of file
diff --git a/apps/cpu/micropart/setup.txt b/apps/cpu/micropart/setup.txt
index d0e1e18ff1c94ed14246706de31dd59f3fdc7f14..28a2ee7eab79679cb5a8d59a81565a8541699ba6 100644
--- a/apps/cpu/micropart/setup.txt
+++ b/apps/cpu/micropart/setup.txt
@@ -1,5 +1,5 @@
-pathname = "/work/koskuche/scratch/micropart2";
-blocknx = 16
-double dx = 0.0134*0.5;
-LBMReal nueLB = 0.0000249*2.0;
+pathname = "/work/koskuche/scratch/micropart2";
+blocknx = 16
+double dx = 0.0134*0.5;
+LBMReal nueLB = 0.0000249*2.0;
 double outTime = 2000;
\ No newline at end of file
diff --git a/apps/cpu/mirror/mirror.cfg b/apps/cpu/mirror/mirror.cfg
index 29ebcb3218cef3c70d6eab92f94dd975fe346618..f77377566f869e628ea29245133b22b1961140aa 100644
--- a/apps/cpu/mirror/mirror.cfg
+++ b/apps/cpu/mirror/mirror.cfg
@@ -1,54 +1,54 @@
-pathOut = d:/temp/mirror5
-pathGeo = d:/Projects/Spiegelbenchmark/geometry
-pathMesh = d:/Projects/Spiegelbenchmark/meshBoxes
-
-#geometry
-SAE = SAE_GRUNDKOERPER_CFD_INPUT_VERFEINERT_in_m_SOLID.ASCII_D_0.8.stl
-
-
-#refinement meshes
-VRES0600_chopped = VRES0600_chopped.stl 
-VRES0700_chopped = VRES0700_chopped.stl
-VRES0800_Fahrzeug = VRES0800_Fahrzeug.stl
-#VRES0900 = VRES0900_Cube.stl
-VRES1000_ASaeule = VRES1000_ASaeule.stl
-VRES1000_Scheibe = VRES1000_Scheibe.stl
-VRES1000_Spiegel = VRES1000_Spiegel.stl
-VRES1100_Spiegel_fein = VRES1100_Spiegel_fein.stl
-
-
-numOfThreads = 4
-availMem = 10e9
-refineLevel = 11  
-#blockNx = 9 8 9
-blockNx = 14 8 10
-
-#x1min x1max x2min x2max x3min x3max [m]
-#bounding box
-WTUNNEL1 = -35.8 37.4 -31.5 31.5 -0.177 32.8
-
-#refinement cubes
-VRES0100 = -18.4 24.5 -16.2 16.2 -0.187 16.5
-VRES0200 = -10.7 16.8 -8.56 8.56 -0.187 8.82
-VRES0300 = -6.9 13 -4.72 4.72 -0.187 4.98
-VRES0400 = -4.21 10.8 -2.8 2.8 -0.187 3.06
-VRES0500 = -2.87 8.74 -1.84 1.84 -0.187 2.1
-VRES0700 = -2.6 4.69 -1.25 1.25 -0.255 -0.125 
-VRES0900 = -0.823 0.941 -1.15 -0.7 0.502 1.01
-
-#deltaXcoarse = 4096e-3 #level 0
-deltaXcoarse = 2.048 #level 0
-deltaXfine = 1e-3 #level 11
-
-
-refineDistance = 0.3
-
-restartStep = 1
-restartStepStart = 100
-
-outTime = 1
-endTime = 10
-
-logToFile = flase
-
+pathOut = d:/temp/mirror5
+pathGeo = d:/Projects/Spiegelbenchmark/geometry
+pathMesh = d:/Projects/Spiegelbenchmark/meshBoxes
+
+#geometry
+SAE = SAE_GRUNDKOERPER_CFD_INPUT_VERFEINERT_in_m_SOLID.ASCII_D_0.8.stl
+
+
+#refinement meshes
+VRES0600_chopped = VRES0600_chopped.stl 
+VRES0700_chopped = VRES0700_chopped.stl
+VRES0800_Fahrzeug = VRES0800_Fahrzeug.stl
+#VRES0900 = VRES0900_Cube.stl
+VRES1000_ASaeule = VRES1000_ASaeule.stl
+VRES1000_Scheibe = VRES1000_Scheibe.stl
+VRES1000_Spiegel = VRES1000_Spiegel.stl
+VRES1100_Spiegel_fein = VRES1100_Spiegel_fein.stl
+
+
+numOfThreads = 4
+availMem = 10e9
+refineLevel = 11  
+#blockNx = 9 8 9
+blockNx = 14 8 10
+
+#x1min x1max x2min x2max x3min x3max [m]
+#bounding box
+WTUNNEL1 = -35.8 37.4 -31.5 31.5 -0.177 32.8
+
+#refinement cubes
+VRES0100 = -18.4 24.5 -16.2 16.2 -0.187 16.5
+VRES0200 = -10.7 16.8 -8.56 8.56 -0.187 8.82
+VRES0300 = -6.9 13 -4.72 4.72 -0.187 4.98
+VRES0400 = -4.21 10.8 -2.8 2.8 -0.187 3.06
+VRES0500 = -2.87 8.74 -1.84 1.84 -0.187 2.1
+VRES0700 = -2.6 4.69 -1.25 1.25 -0.255 -0.125 
+VRES0900 = -0.823 0.941 -1.15 -0.7 0.502 1.01
+
+#deltaXcoarse = 4096e-3 #level 0
+deltaXcoarse = 2.048 #level 0
+deltaXfine = 1e-3 #level 11
+
+
+refineDistance = 0.3
+
+restartStep = 1
+restartStepStart = 100
+
+outTime = 1
+endTime = 10
+
+logToFile = flase
+
 nupsStep = 1 1 10000000
\ No newline at end of file
diff --git a/apps/cpu/mirror/mirror.cpp b/apps/cpu/mirror/mirror.cpp
index 8eaa847908a08fd3ea74ae766c8f1b362481c7ca..a5c877bf68df10f3445849de6deac346772b058a 100644
--- a/apps/cpu/mirror/mirror.cpp
+++ b/apps/cpu/mirror/mirror.cpp
@@ -1,572 +1,572 @@
-#include <iostream>
-#include <string>
-
-#include "VirtualFluids.h"
-
-using namespace std;
-
-void run(string configname)
-{
-   try
-   {
-      ConfigurationFile   config;
-      config.load(configname);
-
-      string          pathOut = config.getValue<string>("pathOut");
-      string          pathGeo = config.getValue<string>("pathGeo");
-      string          pathMesh = config.getValue<string>("pathMesh");
-      int             numOfThreads = config.getValue<int>("numOfThreads");
-      vector<int>     blockNx = config.getVector<int>("blockNx");
-      double          restartStep = config.getValue<double>("restartStep");
-      double          restartStepStart = config.getValue<double>("restartStepStart");
-      double          endTime = config.getValue<double>("endTime");
-      double          outTime = config.getValue<double>("outTime");
-      double          availMem = config.getValue<double>("availMem");
-      int             refineLevel = config.getValue<int>("refineLevel");
-      bool            logToFile = config.getValue<bool>("logToFile");
-      double          deltaXcoarse = config.getValue<double>("deltaXcoarse");
-      double          deltaXfine = config.getValue<double>("deltaXfine");
-      double          refineDistance = config.getValue<double>("refineDistance");
-      vector<double>  nupsStep = config.getVector<double>("nupsStep");
-
-      vector<double>  WTUNNEL1 = config.getVector<double>("WTUNNEL1");
-      vector<double>  VRES0100 = config.getVector<double>("VRES0100");
-      vector<double>  VRES0200 = config.getVector<double>("VRES0200");
-      vector<double>  VRES0300 = config.getVector<double>("VRES0300");
-      vector<double>  VRES0400 = config.getVector<double>("VRES0400");
-      vector<double>  VRES0500 = config.getVector<double>("VRES0500");
-      vector<double>  VRES0700 = config.getVector<double>("VRES0700");
-      vector<double>  VRES0900 = config.getVector<double>("VRES0900");
-
-      string          SAE = config.getValue<string>("SAE");
-      string          VRES0600_chopped = config.getValue<string>("VRES0600_chopped");
-      string          VRES0700_chopped = config.getValue<string>("VRES0700_chopped");
-      string          VRES0800_Fahrzeug = config.getValue<string>("VRES0800_Fahrzeug");
-      //string          VRES0900 = config.getValue<string>("VRES0900");
-      string          VRES1000_ASaeule = config.getValue<string>("VRES1000_ASaeule");
-      string          VRES1000_Scheibe = config.getValue<string>("VRES1000_Scheibe");
-      string          VRES1000_Spiegel = config.getValue<string>("VRES1000_Spiegel");
-      string          VRES1100_Spiegel_fein = config.getValue<string>("VRES1100_Spiegel_fein");
-
-
-      SPtr<Communicator> comm = MPICommunicator::getInstance();
-      int myid = comm->getProcessID();
-
-      if (logToFile)
-      {
-#if defined(__unix__)
-         if (myid==0)
-         {
-            const char* str = pathOut.c_str();
-            mkdir(str, S_IRWXU|S_IRWXG|S_IROTH|S_IXOTH);
-         }
-#endif 
-
-         if (myid==0)
-         {
-            stringstream logFilename;
-            logFilename<<pathOut+"/logfile"+UbSystem::toString(UbSystem::getTimeStamp())+".txt";
-            UbLog::output_policy::setStream(logFilename.str());
-         }
-      }
-
-
-      double g_minX1 = WTUNNEL1[0];
-      double g_minX2 = WTUNNEL1[2];
-      double g_minX3 = WTUNNEL1[4];
-
-      double g_maxX1 = WTUNNEL1[1];
-      double g_maxX2 = WTUNNEL1[3];
-      double g_maxX3 = WTUNNEL1[5];
-
-      double blockLength = (double)blockNx[0]*deltaXcoarse;
-
-      //##########################################################################
-      //## physical parameters
-      //##########################################################################
-
-
-      double rhoLB = 0.0;
-      double rhoReal = 1.2041; //(kg/m3)
-      double nueReal = 153.5e-7; //m^2/s
-
-      double lReal = 2.048;//m
-      double uReal = 140.0/3.6;
-
-      double Re = uReal*lReal/nueReal;
-
-      //##Machzahl:
-      //#Ma     = uReal/csReal
-      double Ma = 140.0/1236.0;//Ma-Real!
-
-      double uLB = Ma*sqrt(1.0/3.0);
-      double nuLB = (uLB*1.0)/Re;
-
-      SPtr<LBMUnitConverter> conv = SPtr<LBMUnitConverter>(new LBMUnitConverter());
-
-      const int baseLevel = 0;
-
-      ////////////////////////////////////////////////////////////////////////
-      //Grid
-      //////////////////////////////////////////////////////////////////////////
-      SPtr<Grid3D> grid(new Grid3D(comm));
-      grid->setDeltaX(deltaXcoarse);
-      grid->setBlockNX(blockNx[0], blockNx[1], blockNx[2]);
-
-      SPtr<GbObject3D> gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
-      if (myid==0) GbSystem3D::writeGeoObject(gridCube.get(), pathOut+"/geo/gridCube", WbWriterVtkXmlASCII::getInstance());
-      GenBlocksGridVisitor genBlocks(gridCube);
-      grid->accept(genBlocks);
-
-      grid->setPeriodicX1(false);
-      grid->setPeriodicX2(false);
-      grid->setPeriodicX3(false);
-
-      //BC adapters
-      SPtr<BCAdapter> noSlipBCAdapter(new NoSlipBCAdapter());
-      noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NoSlipBCAlgorithm()));
-
-      SPtr<BCAdapter> slipBCAdapter(new SlipBCAdapter());
-      slipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new SlipBCAlgorithm()));
-
-      mu::Parser fct;
-      fct.SetExpr("U");
-      fct.DefineConst("U", uLB);
-      SPtr<BCAdapter> velBCAdapter(new VelocityBCAdapter(true, false, false, fct, 0, BCFunction::INFCONST));
-      velBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new VelocityBCAlgorithm()));
-
-      SPtr<BCAdapter> denBCAdapter(new DensityBCAdapter(rhoLB));
-      denBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NonEqDensityBCAlgorithm()));
-
-      BoundaryConditionsBlockVisitor bcVisitor;
-      bcVisitor.addBC(noSlipBCAdapter);
-      bcVisitor.addBC(slipBCAdapter);
-      bcVisitor.addBC(velBCAdapter);
-      bcVisitor.addBC(denBCAdapter);
-
-      //////////////////////////////////////////////////////////////////////////
-      //restart
-    
-      //////////////////////////////////////////////////////////////////////////
-
-
-      if (grid->getTimeStep()==0)
-      {
-         if (myid==0)
-         {
-            UBLOG(logINFO, "Parameters:");
-            UBLOG(logINFO, "* Re                  = "<<Re);
-            UBLOG(logINFO, "* Ma                  = "<<Ma);
-            UBLOG(logINFO, "* velocity (uReal)    = "<<uReal<<" m/s");
-            UBLOG(logINFO, "* viscosity (nuReal)  = "<<nueReal<<" m^2/s");
-            UBLOG(logINFO, "* velocity LB (uLB)   = "<<uLB);
-            UBLOG(logINFO, "* viscosity LB (nuLB) = "<<nuLB);
-            UBLOG(logINFO, "* dx_base             = "<<deltaXcoarse<<" m");
-            UBLOG(logINFO, "* dx_refine           = "<<deltaXfine<<" m");
-            UBLOG(logINFO, "* number of levels    = "<<refineLevel+1);
-            UBLOG(logINFO, "* number of threads   = "<<numOfThreads);
-            UBLOG(logINFO, "* number of processes = "<<comm->getNumberOfProcesses());
-            UBLOG(logINFO, "Preprozess - start");
-         }
-
-         GbCuboid3DPtr geoVRES0100(new GbCuboid3D(VRES0100[0], VRES0100[2], VRES0100[4], VRES0100[1], VRES0100[3], VRES0100[5]));
-         if (myid==0) GbSystem3D::writeGeoObject(geoVRES0100.get(), pathOut+"/geo/geoVRES0100", WbWriterVtkXmlASCII::getInstance());
-
-         GbCuboid3DPtr geoVRES0200(new GbCuboid3D(VRES0200[0], VRES0200[2], VRES0200[4], VRES0200[1], VRES0200[3], VRES0200[5]));
-         if (myid==0) GbSystem3D::writeGeoObject(geoVRES0200.get(), pathOut+"/geo/geoVRES0200", WbWriterVtkXmlASCII::getInstance());
-
-         GbCuboid3DPtr geoVRES0300(new GbCuboid3D(VRES0300[0], VRES0300[2], VRES0300[4], VRES0300[1], VRES0300[3], VRES0300[5]));
-         if (myid==0) GbSystem3D::writeGeoObject(geoVRES0300.get(), pathOut+"/geo/geoVRES0300", WbWriterVtkXmlASCII::getInstance());
-
-         GbCuboid3DPtr geoVRES0400(new GbCuboid3D(VRES0400[0], VRES0400[2], VRES0400[4], VRES0400[1], VRES0400[3], VRES0400[5]));
-         if (myid==0) GbSystem3D::writeGeoObject(geoVRES0400.get(), pathOut+"/geo/geoVRES0400", WbWriterVtkXmlASCII::getInstance());
-
-         GbCuboid3DPtr geoVRES0500(new GbCuboid3D(VRES0500[0], VRES0500[2], VRES0500[4], VRES0500[1], VRES0500[3], VRES0500[5]));
-         if (myid==0) GbSystem3D::writeGeoObject(geoVRES0500.get(), pathOut+"/geo/geoVRES0500", WbWriterVtkXmlASCII::getInstance());
-
-         GbCuboid3DPtr geoVRES0700(new GbCuboid3D(VRES0700[0], VRES0700[2], VRES0700[4], VRES0700[1], VRES0700[3], VRES0700[5]));
-         if (myid==0) GbSystem3D::writeGeoObject(geoVRES0700.get(), pathOut+"/geo/geoVRES0700", WbWriterVtkXmlASCII::getInstance());
-
-         GbCuboid3DPtr geoVRES0900(new GbCuboid3D(VRES0900[0], VRES0900[2], VRES0900[4], VRES0900[1], VRES0900[3], VRES0900[5]));
-         if (myid==0) GbSystem3D::writeGeoObject(geoVRES0900.get(), pathOut+"/geo/geoVRES0900", WbWriterVtkXmlASCII::getInstance());
-
-         SPtr<D3Q27Interactor> geoVRES0700Int(new D3Q27Interactor(geoVRES0700, grid, noSlipBCAdapter, Interactor3D::SOLID));
-
-         //GEO
-         if (myid==0) UBLOG(logINFO, "Read geoSAE:start");
-         SPtr<GbTriFaceMesh3D> geoSAE = SPtr<GbTriFaceMesh3D>(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(pathGeo+"/"+SAE, "meshSAE", GbTriFaceMesh3D::KDTREE_SAHPLIT, true));
-         if (myid==0) UBLOG(logINFO, "Read meshSAE:end");
-         if (myid==0) GbSystem3D::writeGeoObject(geoSAE.get(), pathOut+"/geo/meshSAE", WbWriterVtkXmlBinary::getInstance());
-
-         SPtr<D3Q27TriFaceMeshInteractor> geoSAEInteractor(new D3Q27TriFaceMeshInteractor(geoSAE, grid, noSlipBCAdapter, Interactor3D::SOLID));
-
-
-
-         if (myid==0)
-         {
-            //////////////////////////////////////////
-            //meshes
-            if (myid==0) UBLOG(logINFO, "Read meshVRES0600:start");
-            SPtr<GbTriFaceMesh3D> meshVRES0600 = SPtr<GbTriFaceMesh3D>(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(pathMesh+"/"+VRES0600_chopped, "meshVRES0600", GbTriFaceMesh3D::KDTREE_SAHPLIT, false));
-            if (myid==0) UBLOG(logINFO, "Read meshVRES0600:end");
-            if (myid==0) GbSystem3D::writeGeoObject(meshVRES0600.get(), pathOut+"/geo/meshVRES0600", WbWriterVtkXmlBinary::getInstance());
-            SPtr<D3Q27TriFaceMeshInteractor> meshVRES0600Interactor(new D3Q27TriFaceMeshInteractor(meshVRES0600, grid, noSlipBCAdapter, Interactor3D::SOLID));
-
-            if (myid==0) UBLOG(logINFO, "Read meshVRES0700:start");
-            SPtr<GbTriFaceMesh3D> meshVRES0700 = SPtr<GbTriFaceMesh3D>(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(pathMesh+"/"+VRES0700_chopped, "meshVRES0700", GbTriFaceMesh3D::KDTREE_SAHPLIT, false));
-            if (myid==0) UBLOG(logINFO, "Read meshVRES0700:end");
-            if (myid==0) GbSystem3D::writeGeoObject(meshVRES0700.get(), pathOut+"/geo/meshVRES0700", WbWriterVtkXmlBinary::getInstance());
-            SPtr<D3Q27TriFaceMeshInteractor> meshVRES0700Interactor(new D3Q27TriFaceMeshInteractor(meshVRES0700, grid, noSlipBCAdapter, Interactor3D::SOLID));
-
-            if (myid==0) UBLOG(logINFO, "Read meshVRES0800:start");
-            SPtr<GbTriFaceMesh3D> meshVRES0800 = SPtr<GbTriFaceMesh3D>(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(pathMesh+"/"+VRES0800_Fahrzeug, "meshVRES0800", GbTriFaceMesh3D::KDTREE_SAHPLIT, false));
-            if (myid==0) UBLOG(logINFO, "Read meshVRES0800:end");
-            if (myid==0) GbSystem3D::writeGeoObject(meshVRES0800.get(), pathOut+"/geo/meshVRES0800", WbWriterVtkXmlBinary::getInstance());
-            SPtr<D3Q27TriFaceMeshInteractor> meshVRES0800Interactor(new D3Q27TriFaceMeshInteractor(meshVRES0800, grid, noSlipBCAdapter, Interactor3D::SOLID));
-
-            //if (myid==0) UBLOG(logINFO, "Read meshVRES0900:start");
-            //SPtr<GbTriFaceMesh3D> meshVRES0900 = SPtr<GbTriFaceMesh3D>(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(pathMesh+"/"+VRES0900, "meshVRES0900", GbTriFaceMesh3D::KDTREE_SAHPLIT, false));
-            //if (myid==0) UBLOG(logINFO, "Read meshVRES0900:end");
-            //if (myid==0) GbSystem3D::writeGeoObject(meshVRES0900.get(), pathOut+"/geo/meshVRES0900", WbWriterVtkXmlBinary::getInstance());
-            //SPtr<D3Q27TriFaceMeshInteractor> meshVRES0900Interactor(new D3Q27TriFaceMeshInteractor(meshVRES0900, grid, noSlipBCAdapter, Interactor3D::SOLID));
-
-            if (myid==0) UBLOG(logINFO, "Read meshVRES1000ASaeule:start");
-            SPtr<GbTriFaceMesh3D> meshVRES1000ASaeule = SPtr<GbTriFaceMesh3D>(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(pathMesh+"/"+VRES1000_ASaeule, "meshVRES1000ASaeule", GbTriFaceMesh3D::KDTREE_SAHPLIT, false));
-            if (myid==0) UBLOG(logINFO, "Read meshVRES1000ASaeule:end");
-            if (myid==0) GbSystem3D::writeGeoObject(meshVRES1000ASaeule.get(), pathOut+"/geo/meshVRES1000ASaeule", WbWriterVtkXmlBinary::getInstance());
-            SPtr<D3Q27TriFaceMeshInteractor> meshVRES1000ASaeuleInteractor(new D3Q27TriFaceMeshInteractor(meshVRES1000ASaeule, grid, noSlipBCAdapter, Interactor3D::SOLID));
-
-            if (myid==0) UBLOG(logINFO, "Read meshVRES1000Scheibe:start");
-            SPtr<GbTriFaceMesh3D> meshVRES1000Scheibe = SPtr<GbTriFaceMesh3D>(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(pathMesh+"/"+VRES1000_Scheibe, "meshVRES1000Scheibe", GbTriFaceMesh3D::KDTREE_SAHPLIT, false));
-            if (myid==0) UBLOG(logINFO, "Read meshVRES1000Scheibe:end");
-            if (myid==0) GbSystem3D::writeGeoObject(meshVRES1000Scheibe.get(), pathOut+"/geo/meshVRES1000Scheibe", WbWriterVtkXmlBinary::getInstance());
-            SPtr<D3Q27TriFaceMeshInteractor> meshVRES1000ScheibeInteractor(new D3Q27TriFaceMeshInteractor(meshVRES1000Scheibe, grid, noSlipBCAdapter, Interactor3D::SOLID));
-
-            if (myid==0) UBLOG(logINFO, "Read meshVRES1000Spiegel:start");
-            SPtr<GbTriFaceMesh3D> meshVRES1000Spiegel = SPtr<GbTriFaceMesh3D>(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(pathMesh+"/"+VRES1000_Spiegel, "meshSpiegel", GbTriFaceMesh3D::KDTREE_SAHPLIT, false));
-            if (myid==0) UBLOG(logINFO, "Read meshVRES1000Spiegel:end");
-            if (myid==0) GbSystem3D::writeGeoObject(meshVRES1000Spiegel.get(), pathOut+"/geo/meshVRES1000Spiegel", WbWriterVtkXmlBinary::getInstance());
-            SPtr<D3Q27TriFaceMeshInteractor> meshVRES1000SpiegelInteractor(new D3Q27TriFaceMeshInteractor(meshVRES1000Spiegel, grid, noSlipBCAdapter, Interactor3D::SOLID));
-
-            if (myid==0) UBLOG(logINFO, "Read meshVRES1100SpiegelFine:start");
-            SPtr<GbTriFaceMesh3D> meshVRES1100SpiegelFine = SPtr<GbTriFaceMesh3D>(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(pathMesh+"/"+VRES1100_Spiegel_fein, "meshSpiegelFine", GbTriFaceMesh3D::KDTREE_SAHPLIT, false));
-            if (myid==0) UBLOG(logINFO, "Read meshVRES1100SpiegelFine:end");
-            if (myid==0) GbSystem3D::writeGeoObject(meshVRES1100SpiegelFine.get(), pathOut+"/geo/meshVRES1100SpiegelFine", WbWriterVtkXmlBinary::getInstance());
-            SPtr<D3Q27TriFaceMeshInteractor> meshVRES1100SpiegelFineInteractor(new D3Q27TriFaceMeshInteractor(meshVRES1100SpiegelFine, grid, noSlipBCAdapter, Interactor3D::SOLID));
-
-            UBLOG(logINFO, "Refinement - start");
-            RefineCrossAndInsideGbObjectHelper refineHelper(grid, refineLevel, comm);
-            ////refineHelper.addGbObject(geoVRES0100, refineLevel-4);
-            //refineHelper.addGbObject(geoVRES0200, 1);
-            //refineHelper.addGbObject(geoVRES0300, 2);
-            //refineHelper.addGbObject(geoVRES0400, 3);
-            //refineHelper.addGbObject(geoVRES0500, 4);
-            //refineHelper.addGbObject(geoVRES0700, 7);
-            //refineHelper.addGbObject(geoVRES0900, 9);
-            //refineHelper.refine();
-
-            RefineCrossAndInsideGbObjectBlockVisitor geoVRES0200RefVisitor(geoVRES0200, 1);
-            grid->accept(geoVRES0200RefVisitor);
-            RefineCrossAndInsideGbObjectBlockVisitor geoVRES0300RefVisitor(geoVRES0300, 2);
-            grid->accept(geoVRES0300RefVisitor);
-            RefineCrossAndInsideGbObjectBlockVisitor geoVRES0400RefVisitor(geoVRES0400, 3);
-            grid->accept(geoVRES0400RefVisitor);
-            RefineCrossAndInsideGbObjectBlockVisitor geoVRES0500RefVisitor(geoVRES0500, 4);
-            grid->accept(geoVRES0500RefVisitor);
-
-
-            int rank = grid->getRank();
-            grid->setRank(0);
-            meshVRES0600Interactor->refineBlockGridToLevel(5, 0.0, 0.0);
-            meshVRES0700Interactor->refineBlockGridToLevel(6, -0.6, 0.0);
-
-            UBLOG(logINFO, "Refinement - geoVRES0700");
-            RefineCrossAndInsideGbObjectBlockVisitor geoVRES0700RefVisitor(geoVRES0700, 7);
-            grid->accept(geoVRES0700RefVisitor);
-
-            UBLOG(logINFO, "Refinement - geoSAEInteractor");
-            meshVRES0800Interactor->refineBlockGridToLevel(8, -0.5, 0.0);
-            //geoSAEInteractor->refineBlockGridToLevel(8, 0.0, 0.1);
-
-            //SetSolidOrTransBlockVisitor v(geoSAEInteractor, SetSolidOrTransBlockVisitor::SOLID);
-            //grid->accept(v);
-            //std::vector<SPtr<Block3D>>& sb = geoSAEInteractor->getSolidBlockSet();
-            //BOOST_FOREACH(SPtr<Block3D> block, sb)
-            //{
-            //   grid->deleteBlock(block);
-            //}
-            //geoSAEInteractor->removeSolidBlocks();
-            //geoSAEInteractor->removeTransBlocks();
-
-            UBLOG(logINFO, "Refinement - geoVRES0900RefVisitor");
-            //meshVRES0900Interactor->refineBlockGridToLevel(9, 0.0, 0.0);
-            RefineCrossAndInsideGbObjectBlockVisitor geoVRES0900RefVisitor(geoVRES0900, 9);
-            grid->accept(geoVRES0900RefVisitor);
-
-            UBLOG(logINFO, "Refinement - meshVRES1000ASaeuleInteractor");
-            meshVRES1000ASaeuleInteractor->refineBlockGridToLevel(10, -0.1, 0.0);
-
-            UBLOG(logINFO, "Refinement - meshVRES1000ScheibeInteractor");
-            meshVRES1000ScheibeInteractor->refineBlockGridToLevel(10, -0.1, 0.0);
-
-            UBLOG(logINFO, "Refinement - meshVRES1000SpiegelInteractor");
-            meshVRES1000SpiegelInteractor->refineBlockGridToLevel(10, -0.12, 0.0);
-
-            UBLOG(logINFO, "Refinement - meshVRES1100SpiegelFineInteractor");
-            meshVRES1100SpiegelFineInteractor->refineBlockGridToLevel(11, -0.12, 0.0);
-            grid->setRank(rank);
-
-            ///////////////////////////////////////////////////////////
-            ///BOX
-            //GbCuboid3DPtr geoBox1(new GbCuboid3D(-0.495, -0.8, 0.545, -0.045, -0.7, 0.795));
-            //if (myid==0) GbSystem3D::writeGeoObject(geoBox1.get(), pathOut+"/geo/geoBox1", WbWriterVtkXmlASCII::getInstance());
-            //CoarsenCrossAndInsideGbObjectBlockVisitor geoBox1Visitor(geoBox1, 11, 11);
-            //grid->accept(geoBox1Visitor);
-            //////////////////////////////////////////////////////////////////////////
-
-
-            if (myid==0)
-            {
-               WriteBlocksCoProcessor ppblocks(grid, SPtr<UbScheduler>(new UbScheduler(1)), pathOut, WbWriterVtkXmlBinary::getInstance(), comm);
-               ppblocks.process(0);
-            }
-
-            RatioBlockVisitor ratioVisitor(refineLevel);
-            CheckRatioBlockVisitor checkRatio(refineLevel);
-            int count = 0;
-
-            do {
-               UBLOG(logINFO, "Refinement - RatioBlockVisitor");
-               grid->accept(ratioVisitor);
-               checkRatio.resetState();
-               UBLOG(logINFO, "Refinement - CheckRatioBlockVisitor");
-               grid->accept(checkRatio);
-               if (myid==0) UBLOG(logINFO, "count ="<<count++<<" state="<<checkRatio.getState());
-            } while (!checkRatio.getState());
-
-            UBLOG(logINFO, "Refinement - OverlapBlockVisitor");
-            OverlapBlockVisitor overlapVisitor(refineLevel, false);
-            grid->accept(overlapVisitor);
-
-            if (myid==0) UBLOG(logINFO, "Refinement - end");
-
-            if (myid==0)
-            {
-               WriteBlocksCoProcessor ppblocks(grid, SPtr<UbScheduler>(new UbScheduler(1)), pathOut, WbWriterVtkXmlBinary::getInstance(), comm);
-               ppblocks.process(1);
-            }
-         }
-
-         grid->updateDistributedBlocks(comm);
-
-         if (myid == 0) UBLOG(logINFO, "SetInterpolationDirsBlockVisitor");
-         std::vector<int> dirs;
-         for (int i = D3Q27System::E; i<=D3Q27System::TS; i++)
-         {
-            dirs.push_back(i);
-         }
-         SetInterpolationDirsBlockVisitor interDirsVisitor(dirs);
-         grid->accept(interDirsVisitor);
-
-         //////////////////////////////////////////////////////////////////////////
-
-
-         //walls
-         GbCuboid3DPtr addWallYmin(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_minX2, g_maxX3+blockLength));
-         if (myid==0) GbSystem3D::writeGeoObject(addWallYmin.get(), pathOut+"/geo/addWallYmin", WbWriterVtkXmlASCII::getInstance());
-
-         GbCuboid3DPtr addWallYmax(new GbCuboid3D(g_minX1-blockLength, g_maxX2, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength));
-         if (myid==0) GbSystem3D::writeGeoObject(addWallYmax.get(), pathOut+"/geo/addWallYmax", WbWriterVtkXmlASCII::getInstance());
-
-         //wall interactors
-         SPtr<D3Q27Interactor> addWallYminInt(new D3Q27Interactor(addWallYmin, grid, slipBCAdapter, Interactor3D::SOLID));
-         SPtr<D3Q27Interactor> addWallYmaxInt(new D3Q27Interactor(addWallYmax, grid, slipBCAdapter, Interactor3D::SOLID));
-
-         //walls
-         GbCuboid3DPtr addWallZmin(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_minX3));
-         if (myid==0) GbSystem3D::writeGeoObject(addWallZmin.get(), pathOut+"/geo/addWallZmin", WbWriterVtkXmlASCII::getInstance());
-
-         GbCuboid3DPtr addWallZmax(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_maxX3, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength));
-         if (myid==0) GbSystem3D::writeGeoObject(addWallZmax.get(), pathOut+"/geo/addWallZmax", WbWriterVtkXmlASCII::getInstance());
-
-         //wall interactors
-         SPtr<D3Q27Interactor> addWallZminInt(new D3Q27Interactor(addWallZmin, grid, slipBCAdapter, Interactor3D::SOLID));
-         SPtr<D3Q27Interactor> addWallZmaxInt(new D3Q27Interactor(addWallZmax, grid, slipBCAdapter, Interactor3D::SOLID));
-
-         //inflow
-         GbCuboid3DPtr geoInflow(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3-blockLength, g_minX1, g_maxX2+blockLength, g_maxX3+blockLength));
-         if (myid==0) GbSystem3D::writeGeoObject(geoInflow.get(), pathOut+"/geo/geoInflow", WbWriterVtkXmlASCII::getInstance());
-
-         //outflow
-         GbCuboid3DPtr geoOutflow(new GbCuboid3D(g_maxX1, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength));
-         if (myid==0) GbSystem3D::writeGeoObject(geoOutflow.get(), pathOut+"/geo/geoOutflow", WbWriterVtkXmlASCII::getInstance());
-
-         //inflow
-         SPtr<D3Q27Interactor> inflowIntr = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoInflow, grid, velBCAdapter, Interactor3D::SOLID));
-
-         //outflow
-         SPtr<D3Q27Interactor> outflowIntr = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoOutflow, grid, denBCAdapter, Interactor3D::SOLID));
-
-         ////////////////////////////////////////////
-         //METIS
-         SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::BSW, MetisPartitioner::KWAY));
-         ////////////////////////////////////////////
-         /////delete solid blocks
-         if (myid==0) UBLOG(logINFO, "deleteSolidBlocks - start");
-         InteractorsHelper intHelper(grid, metisVisitor);
-         intHelper.addInteractor(inflowIntr);
-         intHelper.addInteractor(outflowIntr);
-         intHelper.addInteractor(addWallYminInt);
-         intHelper.addInteractor(addWallYmaxInt);
-         intHelper.addInteractor(addWallZminInt);
-         intHelper.addInteractor(addWallZmaxInt);
-         intHelper.addInteractor(geoVRES0700Int);
-         intHelper.addInteractor(geoSAEInteractor);
-         //////////////////////////////////////////////////////////////////////////
-         intHelper.selectBlocks();
-
-         if (myid==0) UBLOG(logINFO, "deleteSolidBlocks - end");
-         //////////////////////////////////////
-
-         if (myid==0)
-         {
-            SPtr<CoProcessor> ppblocks(new WriteBlocksCoProcessor(grid, SPtr<UbScheduler>(new UbScheduler(1)), pathOut, WbWriterVtkXmlBinary::getInstance(), comm));
-            ppblocks->process(2);
-            ppblocks.reset();
-         }
-         unsigned long long numberOfBlocks = (unsigned long long)grid->getNumberOfBlocks();
-         int ghostLayer = 3;
-         unsigned long long numberOfNodesPerBlock = (unsigned long long)(blockNx[0])* (unsigned long long)(blockNx[1])* (unsigned long long)(blockNx[2]);
-         unsigned long long numberOfNodes = numberOfBlocks * numberOfNodesPerBlock;
-         unsigned long long numberOfNodesPerBlockWithGhostLayer = numberOfBlocks * (blockNx[0]+ghostLayer) * (blockNx[1]+ghostLayer) * (blockNx[2]+ghostLayer);
-         double needMemAll = double(numberOfNodesPerBlockWithGhostLayer*(27*sizeof(double)+sizeof(int)+sizeof(float)*4));
-         double needMem = needMemAll/double(comm->getNumberOfProcesses());
-
-         if (myid==0)
-         {
-            UBLOG(logINFO, "Number of blocks = "<<numberOfBlocks);
-            UBLOG(logINFO, "Number of nodes  = "<<numberOfNodes);
-            int minInitLevel = grid->getCoarsestInitializedLevel();
-            int maxInitLevel = grid->getFinestInitializedLevel();
-            for (int level = minInitLevel; level<=maxInitLevel; level++)
-            {
-               int nobl = grid->getNumberOfBlocks(level);
-               UBLOG(logINFO, "Number of blocks for level "<<level<<" = "<<nobl);
-               UBLOG(logINFO, "Number of nodes for level "<<level<<" = "<<nobl*numberOfNodesPerBlock);
-            }
-            UBLOG(logINFO, "Necessary memory  = "<<needMemAll<<" bytes");
-            UBLOG(logINFO, "Necessary memory per process = "<<needMem<<" bytes");
-            UBLOG(logINFO, "Available memory per process = "<<availMem<<" bytes");
-         }
-
-         SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new CompressibleCumulantLBMKernel(blockNx[0], blockNx[1], blockNx[2], CompressibleCumulantLBMKernel::NORMAL));
-
-         SPtr<BCProcessor> bcProc;
-
-         bcProc = SPtr<BCProcessor>(new BCProcessor());
-
-         kernel->setBCProcessor(bcProc);
-
-         SetKernelBlockVisitor kernelVisitor(kernel, nuLB, availMem, needMem);
-         grid->accept(kernelVisitor);
-
-         if (refineLevel>0)
-         {
-            SetUndefinedNodesBlockVisitor undefNodesVisitor;
-            grid->accept(undefNodesVisitor);
-         }
-
-         //BC
-         intHelper.setBC();
-
-         grid->accept(bcVisitor);
-
-         //initialization of distributions
-         InitDistributionsBlockVisitor initVisitor(nuLB, rhoLB);
-         initVisitor.setVx1(fct);
-         initVisitor.setNu(nuLB);
-         grid->accept(initVisitor);
-
-         ////set connectors
-         InterpolationProcessorPtr iProcessor(new CompressibleOffsetInterpolationProcessor());
-         SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
-         grid->accept(setConnsVisitor);
-
-         //domain decomposition for threads
-         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
-         grid->accept(pqPartVisitor);
-
-         //Postrozess
-         SPtr<UbScheduler> geoSch(new UbScheduler(1));
-         SPtr<CoProcessor> ppgeo(new WriteBoundaryConditionsCoProcessor(grid, geoSch, pathOut, WbWriterVtkXmlBinary::getInstance(), conv, comm));
-         ppgeo->process(0);
-         ppgeo.reset();
-
-         if (myid==0) UBLOG(logINFO, "Preprozess - end");
-      }
-      else
-      {
-         InterpolationProcessorPtr iProcessor(new CompressibleOffsetInterpolationProcessor());
-         SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
-         grid->accept(setConnsVisitor);
-
-         //domain decomposition for threads
-         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
-         grid->accept(pqPartVisitor);
-
-         grid->accept(bcVisitor);
-      }
-
-      SPtr<UbScheduler> nupsSch(new UbScheduler(nupsStep[0], nupsStep[1], nupsStep[2]));
-      NUPSCounterCoProcessor npr(grid, nupsSch, numOfThreads, comm);
-
-      SPtr<UbScheduler> stepSch(new UbScheduler(outTime));
-
-      WriteMacroscopicQuantitiesCoProcessor pp(grid, stepSch, pathOut, WbWriterVtkXmlBinary::getInstance(), conv, comm);
-
-      if (myid==0)
-      {
-         UBLOG(logINFO, "PID = "<<myid<<" Total Physical Memory (RAM): "<<Utilities::getTotalPhysMem());
-         UBLOG(logINFO, "PID = "<<myid<<" Physical Memory currently used: "<<Utilities::getPhysMemUsed());
-         UBLOG(logINFO, "PID = "<<myid<<" Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe());
-      }
-
-      const SPtr<ConcreteCalculatorFactory> calculatorFactory = std::make_shared<ConcreteCalculatorFactory>(stepSch);
-      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, calculatorFactory, CalculatorType::HYBRID));
-      if (myid==0) UBLOG(logINFO, "Simulation-start");
-      calculation->calculate();
-      if (myid==0) UBLOG(logINFO, "Simulation-end");
-   }
-   catch (std::exception& e)
-   {
-      cerr<<e.what()<<endl<<flush;
-   }
-   catch (std::string& s)
-   {
-      cerr<<s<<endl;
-   }
-   catch (...)
-   {
-      cerr<<"unknown exception"<<endl;
-   }
-
-}
-
-int main(int argc, char* argv[])
-{
-
-   if (argv!=NULL)
-   {
-      if (argv[1]!=NULL)
-      {
-         run(string(argv[1]));
-      }
-      else
-      {
-         cout<<"Configuration file must be set!: "<<argv[0]<<" <config file>"<<endl<<std::flush;
-      }
-   }
-
-   return 0;
-}
-
+#include <iostream>
+#include <string>
+
+#include "VirtualFluids.h"
+
+using namespace std;
+
+void run(string configname)
+{
+   try
+   {
+      ConfigurationFile   config;
+      config.load(configname);
+
+      string          pathOut = config.getValue<string>("pathOut");
+      string          pathGeo = config.getValue<string>("pathGeo");
+      string          pathMesh = config.getValue<string>("pathMesh");
+      int             numOfThreads = config.getValue<int>("numOfThreads");
+      vector<int>     blockNx = config.getVector<int>("blockNx");
+      double          restartStep = config.getValue<double>("restartStep");
+      double          restartStepStart = config.getValue<double>("restartStepStart");
+      double          endTime = config.getValue<double>("endTime");
+      double          outTime = config.getValue<double>("outTime");
+      double          availMem = config.getValue<double>("availMem");
+      int             refineLevel = config.getValue<int>("refineLevel");
+      bool            logToFile = config.getValue<bool>("logToFile");
+      double          deltaXcoarse = config.getValue<double>("deltaXcoarse");
+      double          deltaXfine = config.getValue<double>("deltaXfine");
+      double          refineDistance = config.getValue<double>("refineDistance");
+      vector<double>  nupsStep = config.getVector<double>("nupsStep");
+
+      vector<double>  WTUNNEL1 = config.getVector<double>("WTUNNEL1");
+      vector<double>  VRES0100 = config.getVector<double>("VRES0100");
+      vector<double>  VRES0200 = config.getVector<double>("VRES0200");
+      vector<double>  VRES0300 = config.getVector<double>("VRES0300");
+      vector<double>  VRES0400 = config.getVector<double>("VRES0400");
+      vector<double>  VRES0500 = config.getVector<double>("VRES0500");
+      vector<double>  VRES0700 = config.getVector<double>("VRES0700");
+      vector<double>  VRES0900 = config.getVector<double>("VRES0900");
+
+      string          SAE = config.getValue<string>("SAE");
+      string          VRES0600_chopped = config.getValue<string>("VRES0600_chopped");
+      string          VRES0700_chopped = config.getValue<string>("VRES0700_chopped");
+      string          VRES0800_Fahrzeug = config.getValue<string>("VRES0800_Fahrzeug");
+      //string          VRES0900 = config.getValue<string>("VRES0900");
+      string          VRES1000_ASaeule = config.getValue<string>("VRES1000_ASaeule");
+      string          VRES1000_Scheibe = config.getValue<string>("VRES1000_Scheibe");
+      string          VRES1000_Spiegel = config.getValue<string>("VRES1000_Spiegel");
+      string          VRES1100_Spiegel_fein = config.getValue<string>("VRES1100_Spiegel_fein");
+
+
+      SPtr<Communicator> comm = MPICommunicator::getInstance();
+      int myid = comm->getProcessID();
+
+      if (logToFile)
+      {
+#if defined(__unix__)
+         if (myid==0)
+         {
+            const char* str = pathOut.c_str();
+            mkdir(str, S_IRWXU|S_IRWXG|S_IROTH|S_IXOTH);
+         }
+#endif 
+
+         if (myid==0)
+         {
+            stringstream logFilename;
+            logFilename<<pathOut+"/logfile"+UbSystem::toString(UbSystem::getTimeStamp())+".txt";
+            UbLog::output_policy::setStream(logFilename.str());
+         }
+      }
+
+
+      double g_minX1 = WTUNNEL1[0];
+      double g_minX2 = WTUNNEL1[2];
+      double g_minX3 = WTUNNEL1[4];
+
+      double g_maxX1 = WTUNNEL1[1];
+      double g_maxX2 = WTUNNEL1[3];
+      double g_maxX3 = WTUNNEL1[5];
+
+      double blockLength = (double)blockNx[0]*deltaXcoarse;
+
+      //##########################################################################
+      //## physical parameters
+      //##########################################################################
+
+
+      double rhoLB = 0.0;
+      double rhoReal = 1.2041; //(kg/m3)
+      double nueReal = 153.5e-7; //m^2/s
+
+      double lReal = 2.048;//m
+      double uReal = 140.0/3.6;
+
+      double Re = uReal*lReal/nueReal;
+
+      //##Machzahl:
+      //#Ma     = uReal/csReal
+      double Ma = 140.0/1236.0;//Ma-Real!
+
+      double uLB = Ma*sqrt(1.0/3.0);
+      double nuLB = (uLB*1.0)/Re;
+
+      SPtr<LBMUnitConverter> conv = SPtr<LBMUnitConverter>(new LBMUnitConverter());
+
+      const int baseLevel = 0;
+
+      ////////////////////////////////////////////////////////////////////////
+      //Grid
+      //////////////////////////////////////////////////////////////////////////
+      SPtr<Grid3D> grid(new Grid3D(comm));
+      grid->setDeltaX(deltaXcoarse);
+      grid->setBlockNX(blockNx[0], blockNx[1], blockNx[2]);
+
+      SPtr<GbObject3D> gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
+      if (myid==0) GbSystem3D::writeGeoObject(gridCube.get(), pathOut+"/geo/gridCube", WbWriterVtkXmlASCII::getInstance());
+      GenBlocksGridVisitor genBlocks(gridCube);
+      grid->accept(genBlocks);
+
+      grid->setPeriodicX1(false);
+      grid->setPeriodicX2(false);
+      grid->setPeriodicX3(false);
+
+      //BC adapters
+      SPtr<BCAdapter> noSlipBCAdapter(new NoSlipBCAdapter());
+      noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NoSlipBCAlgorithm()));
+
+      SPtr<BCAdapter> slipBCAdapter(new SlipBCAdapter());
+      slipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new SlipBCAlgorithm()));
+
+      mu::Parser fct;
+      fct.SetExpr("U");
+      fct.DefineConst("U", uLB);
+      SPtr<BCAdapter> velBCAdapter(new VelocityBCAdapter(true, false, false, fct, 0, BCFunction::INFCONST));
+      velBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new VelocityBCAlgorithm()));
+
+      SPtr<BCAdapter> denBCAdapter(new DensityBCAdapter(rhoLB));
+      denBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NonEqDensityBCAlgorithm()));
+
+      BoundaryConditionsBlockVisitor bcVisitor;
+      bcVisitor.addBC(noSlipBCAdapter);
+      bcVisitor.addBC(slipBCAdapter);
+      bcVisitor.addBC(velBCAdapter);
+      bcVisitor.addBC(denBCAdapter);
+
+      //////////////////////////////////////////////////////////////////////////
+      //restart
+    
+      //////////////////////////////////////////////////////////////////////////
+
+
+      if (grid->getTimeStep()==0)
+      {
+         if (myid==0)
+         {
+            UBLOG(logINFO, "Parameters:");
+            UBLOG(logINFO, "* Re                  = "<<Re);
+            UBLOG(logINFO, "* Ma                  = "<<Ma);
+            UBLOG(logINFO, "* velocity (uReal)    = "<<uReal<<" m/s");
+            UBLOG(logINFO, "* viscosity (nuReal)  = "<<nueReal<<" m^2/s");
+            UBLOG(logINFO, "* velocity LB (uLB)   = "<<uLB);
+            UBLOG(logINFO, "* viscosity LB (nuLB) = "<<nuLB);
+            UBLOG(logINFO, "* dx_base             = "<<deltaXcoarse<<" m");
+            UBLOG(logINFO, "* dx_refine           = "<<deltaXfine<<" m");
+            UBLOG(logINFO, "* number of levels    = "<<refineLevel+1);
+            UBLOG(logINFO, "* number of threads   = "<<numOfThreads);
+            UBLOG(logINFO, "* number of processes = "<<comm->getNumberOfProcesses());
+            UBLOG(logINFO, "Preprozess - start");
+         }
+
+         GbCuboid3DPtr geoVRES0100(new GbCuboid3D(VRES0100[0], VRES0100[2], VRES0100[4], VRES0100[1], VRES0100[3], VRES0100[5]));
+         if (myid==0) GbSystem3D::writeGeoObject(geoVRES0100.get(), pathOut+"/geo/geoVRES0100", WbWriterVtkXmlASCII::getInstance());
+
+         GbCuboid3DPtr geoVRES0200(new GbCuboid3D(VRES0200[0], VRES0200[2], VRES0200[4], VRES0200[1], VRES0200[3], VRES0200[5]));
+         if (myid==0) GbSystem3D::writeGeoObject(geoVRES0200.get(), pathOut+"/geo/geoVRES0200", WbWriterVtkXmlASCII::getInstance());
+
+         GbCuboid3DPtr geoVRES0300(new GbCuboid3D(VRES0300[0], VRES0300[2], VRES0300[4], VRES0300[1], VRES0300[3], VRES0300[5]));
+         if (myid==0) GbSystem3D::writeGeoObject(geoVRES0300.get(), pathOut+"/geo/geoVRES0300", WbWriterVtkXmlASCII::getInstance());
+
+         GbCuboid3DPtr geoVRES0400(new GbCuboid3D(VRES0400[0], VRES0400[2], VRES0400[4], VRES0400[1], VRES0400[3], VRES0400[5]));
+         if (myid==0) GbSystem3D::writeGeoObject(geoVRES0400.get(), pathOut+"/geo/geoVRES0400", WbWriterVtkXmlASCII::getInstance());
+
+         GbCuboid3DPtr geoVRES0500(new GbCuboid3D(VRES0500[0], VRES0500[2], VRES0500[4], VRES0500[1], VRES0500[3], VRES0500[5]));
+         if (myid==0) GbSystem3D::writeGeoObject(geoVRES0500.get(), pathOut+"/geo/geoVRES0500", WbWriterVtkXmlASCII::getInstance());
+
+         GbCuboid3DPtr geoVRES0700(new GbCuboid3D(VRES0700[0], VRES0700[2], VRES0700[4], VRES0700[1], VRES0700[3], VRES0700[5]));
+         if (myid==0) GbSystem3D::writeGeoObject(geoVRES0700.get(), pathOut+"/geo/geoVRES0700", WbWriterVtkXmlASCII::getInstance());
+
+         GbCuboid3DPtr geoVRES0900(new GbCuboid3D(VRES0900[0], VRES0900[2], VRES0900[4], VRES0900[1], VRES0900[3], VRES0900[5]));
+         if (myid==0) GbSystem3D::writeGeoObject(geoVRES0900.get(), pathOut+"/geo/geoVRES0900", WbWriterVtkXmlASCII::getInstance());
+
+         SPtr<D3Q27Interactor> geoVRES0700Int(new D3Q27Interactor(geoVRES0700, grid, noSlipBCAdapter, Interactor3D::SOLID));
+
+         //GEO
+         if (myid==0) UBLOG(logINFO, "Read geoSAE:start");
+         SPtr<GbTriFaceMesh3D> geoSAE = SPtr<GbTriFaceMesh3D>(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(pathGeo+"/"+SAE, "meshSAE", GbTriFaceMesh3D::KDTREE_SAHPLIT, true));
+         if (myid==0) UBLOG(logINFO, "Read meshSAE:end");
+         if (myid==0) GbSystem3D::writeGeoObject(geoSAE.get(), pathOut+"/geo/meshSAE", WbWriterVtkXmlBinary::getInstance());
+
+         SPtr<D3Q27TriFaceMeshInteractor> geoSAEInteractor(new D3Q27TriFaceMeshInteractor(geoSAE, grid, noSlipBCAdapter, Interactor3D::SOLID));
+
+
+
+         if (myid==0)
+         {
+            //////////////////////////////////////////
+            //meshes
+            if (myid==0) UBLOG(logINFO, "Read meshVRES0600:start");
+            SPtr<GbTriFaceMesh3D> meshVRES0600 = SPtr<GbTriFaceMesh3D>(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(pathMesh+"/"+VRES0600_chopped, "meshVRES0600", GbTriFaceMesh3D::KDTREE_SAHPLIT, false));
+            if (myid==0) UBLOG(logINFO, "Read meshVRES0600:end");
+            if (myid==0) GbSystem3D::writeGeoObject(meshVRES0600.get(), pathOut+"/geo/meshVRES0600", WbWriterVtkXmlBinary::getInstance());
+            SPtr<D3Q27TriFaceMeshInteractor> meshVRES0600Interactor(new D3Q27TriFaceMeshInteractor(meshVRES0600, grid, noSlipBCAdapter, Interactor3D::SOLID));
+
+            if (myid==0) UBLOG(logINFO, "Read meshVRES0700:start");
+            SPtr<GbTriFaceMesh3D> meshVRES0700 = SPtr<GbTriFaceMesh3D>(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(pathMesh+"/"+VRES0700_chopped, "meshVRES0700", GbTriFaceMesh3D::KDTREE_SAHPLIT, false));
+            if (myid==0) UBLOG(logINFO, "Read meshVRES0700:end");
+            if (myid==0) GbSystem3D::writeGeoObject(meshVRES0700.get(), pathOut+"/geo/meshVRES0700", WbWriterVtkXmlBinary::getInstance());
+            SPtr<D3Q27TriFaceMeshInteractor> meshVRES0700Interactor(new D3Q27TriFaceMeshInteractor(meshVRES0700, grid, noSlipBCAdapter, Interactor3D::SOLID));
+
+            if (myid==0) UBLOG(logINFO, "Read meshVRES0800:start");
+            SPtr<GbTriFaceMesh3D> meshVRES0800 = SPtr<GbTriFaceMesh3D>(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(pathMesh+"/"+VRES0800_Fahrzeug, "meshVRES0800", GbTriFaceMesh3D::KDTREE_SAHPLIT, false));
+            if (myid==0) UBLOG(logINFO, "Read meshVRES0800:end");
+            if (myid==0) GbSystem3D::writeGeoObject(meshVRES0800.get(), pathOut+"/geo/meshVRES0800", WbWriterVtkXmlBinary::getInstance());
+            SPtr<D3Q27TriFaceMeshInteractor> meshVRES0800Interactor(new D3Q27TriFaceMeshInteractor(meshVRES0800, grid, noSlipBCAdapter, Interactor3D::SOLID));
+
+            //if (myid==0) UBLOG(logINFO, "Read meshVRES0900:start");
+            //SPtr<GbTriFaceMesh3D> meshVRES0900 = SPtr<GbTriFaceMesh3D>(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(pathMesh+"/"+VRES0900, "meshVRES0900", GbTriFaceMesh3D::KDTREE_SAHPLIT, false));
+            //if (myid==0) UBLOG(logINFO, "Read meshVRES0900:end");
+            //if (myid==0) GbSystem3D::writeGeoObject(meshVRES0900.get(), pathOut+"/geo/meshVRES0900", WbWriterVtkXmlBinary::getInstance());
+            //SPtr<D3Q27TriFaceMeshInteractor> meshVRES0900Interactor(new D3Q27TriFaceMeshInteractor(meshVRES0900, grid, noSlipBCAdapter, Interactor3D::SOLID));
+
+            if (myid==0) UBLOG(logINFO, "Read meshVRES1000ASaeule:start");
+            SPtr<GbTriFaceMesh3D> meshVRES1000ASaeule = SPtr<GbTriFaceMesh3D>(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(pathMesh+"/"+VRES1000_ASaeule, "meshVRES1000ASaeule", GbTriFaceMesh3D::KDTREE_SAHPLIT, false));
+            if (myid==0) UBLOG(logINFO, "Read meshVRES1000ASaeule:end");
+            if (myid==0) GbSystem3D::writeGeoObject(meshVRES1000ASaeule.get(), pathOut+"/geo/meshVRES1000ASaeule", WbWriterVtkXmlBinary::getInstance());
+            SPtr<D3Q27TriFaceMeshInteractor> meshVRES1000ASaeuleInteractor(new D3Q27TriFaceMeshInteractor(meshVRES1000ASaeule, grid, noSlipBCAdapter, Interactor3D::SOLID));
+
+            if (myid==0) UBLOG(logINFO, "Read meshVRES1000Scheibe:start");
+            SPtr<GbTriFaceMesh3D> meshVRES1000Scheibe = SPtr<GbTriFaceMesh3D>(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(pathMesh+"/"+VRES1000_Scheibe, "meshVRES1000Scheibe", GbTriFaceMesh3D::KDTREE_SAHPLIT, false));
+            if (myid==0) UBLOG(logINFO, "Read meshVRES1000Scheibe:end");
+            if (myid==0) GbSystem3D::writeGeoObject(meshVRES1000Scheibe.get(), pathOut+"/geo/meshVRES1000Scheibe", WbWriterVtkXmlBinary::getInstance());
+            SPtr<D3Q27TriFaceMeshInteractor> meshVRES1000ScheibeInteractor(new D3Q27TriFaceMeshInteractor(meshVRES1000Scheibe, grid, noSlipBCAdapter, Interactor3D::SOLID));
+
+            if (myid==0) UBLOG(logINFO, "Read meshVRES1000Spiegel:start");
+            SPtr<GbTriFaceMesh3D> meshVRES1000Spiegel = SPtr<GbTriFaceMesh3D>(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(pathMesh+"/"+VRES1000_Spiegel, "meshSpiegel", GbTriFaceMesh3D::KDTREE_SAHPLIT, false));
+            if (myid==0) UBLOG(logINFO, "Read meshVRES1000Spiegel:end");
+            if (myid==0) GbSystem3D::writeGeoObject(meshVRES1000Spiegel.get(), pathOut+"/geo/meshVRES1000Spiegel", WbWriterVtkXmlBinary::getInstance());
+            SPtr<D3Q27TriFaceMeshInteractor> meshVRES1000SpiegelInteractor(new D3Q27TriFaceMeshInteractor(meshVRES1000Spiegel, grid, noSlipBCAdapter, Interactor3D::SOLID));
+
+            if (myid==0) UBLOG(logINFO, "Read meshVRES1100SpiegelFine:start");
+            SPtr<GbTriFaceMesh3D> meshVRES1100SpiegelFine = SPtr<GbTriFaceMesh3D>(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(pathMesh+"/"+VRES1100_Spiegel_fein, "meshSpiegelFine", GbTriFaceMesh3D::KDTREE_SAHPLIT, false));
+            if (myid==0) UBLOG(logINFO, "Read meshVRES1100SpiegelFine:end");
+            if (myid==0) GbSystem3D::writeGeoObject(meshVRES1100SpiegelFine.get(), pathOut+"/geo/meshVRES1100SpiegelFine", WbWriterVtkXmlBinary::getInstance());
+            SPtr<D3Q27TriFaceMeshInteractor> meshVRES1100SpiegelFineInteractor(new D3Q27TriFaceMeshInteractor(meshVRES1100SpiegelFine, grid, noSlipBCAdapter, Interactor3D::SOLID));
+
+            UBLOG(logINFO, "Refinement - start");
+            RefineCrossAndInsideGbObjectHelper refineHelper(grid, refineLevel, comm);
+            ////refineHelper.addGbObject(geoVRES0100, refineLevel-4);
+            //refineHelper.addGbObject(geoVRES0200, 1);
+            //refineHelper.addGbObject(geoVRES0300, 2);
+            //refineHelper.addGbObject(geoVRES0400, 3);
+            //refineHelper.addGbObject(geoVRES0500, 4);
+            //refineHelper.addGbObject(geoVRES0700, 7);
+            //refineHelper.addGbObject(geoVRES0900, 9);
+            //refineHelper.refine();
+
+            RefineCrossAndInsideGbObjectBlockVisitor geoVRES0200RefVisitor(geoVRES0200, 1);
+            grid->accept(geoVRES0200RefVisitor);
+            RefineCrossAndInsideGbObjectBlockVisitor geoVRES0300RefVisitor(geoVRES0300, 2);
+            grid->accept(geoVRES0300RefVisitor);
+            RefineCrossAndInsideGbObjectBlockVisitor geoVRES0400RefVisitor(geoVRES0400, 3);
+            grid->accept(geoVRES0400RefVisitor);
+            RefineCrossAndInsideGbObjectBlockVisitor geoVRES0500RefVisitor(geoVRES0500, 4);
+            grid->accept(geoVRES0500RefVisitor);
+
+
+            int rank = grid->getRank();
+            grid->setRank(0);
+            meshVRES0600Interactor->refineBlockGridToLevel(5, 0.0, 0.0);
+            meshVRES0700Interactor->refineBlockGridToLevel(6, -0.6, 0.0);
+
+            UBLOG(logINFO, "Refinement - geoVRES0700");
+            RefineCrossAndInsideGbObjectBlockVisitor geoVRES0700RefVisitor(geoVRES0700, 7);
+            grid->accept(geoVRES0700RefVisitor);
+
+            UBLOG(logINFO, "Refinement - geoSAEInteractor");
+            meshVRES0800Interactor->refineBlockGridToLevel(8, -0.5, 0.0);
+            //geoSAEInteractor->refineBlockGridToLevel(8, 0.0, 0.1);
+
+            //SetSolidOrTransBlockVisitor v(geoSAEInteractor, SetSolidOrTransBlockVisitor::SOLID);
+            //grid->accept(v);
+            //std::vector<SPtr<Block3D>>& sb = geoSAEInteractor->getSolidBlockSet();
+            //BOOST_FOREACH(SPtr<Block3D> block, sb)
+            //{
+            //   grid->deleteBlock(block);
+            //}
+            //geoSAEInteractor->removeSolidBlocks();
+            //geoSAEInteractor->removeTransBlocks();
+
+            UBLOG(logINFO, "Refinement - geoVRES0900RefVisitor");
+            //meshVRES0900Interactor->refineBlockGridToLevel(9, 0.0, 0.0);
+            RefineCrossAndInsideGbObjectBlockVisitor geoVRES0900RefVisitor(geoVRES0900, 9);
+            grid->accept(geoVRES0900RefVisitor);
+
+            UBLOG(logINFO, "Refinement - meshVRES1000ASaeuleInteractor");
+            meshVRES1000ASaeuleInteractor->refineBlockGridToLevel(10, -0.1, 0.0);
+
+            UBLOG(logINFO, "Refinement - meshVRES1000ScheibeInteractor");
+            meshVRES1000ScheibeInteractor->refineBlockGridToLevel(10, -0.1, 0.0);
+
+            UBLOG(logINFO, "Refinement - meshVRES1000SpiegelInteractor");
+            meshVRES1000SpiegelInteractor->refineBlockGridToLevel(10, -0.12, 0.0);
+
+            UBLOG(logINFO, "Refinement - meshVRES1100SpiegelFineInteractor");
+            meshVRES1100SpiegelFineInteractor->refineBlockGridToLevel(11, -0.12, 0.0);
+            grid->setRank(rank);
+
+            ///////////////////////////////////////////////////////////
+            ///BOX
+            //GbCuboid3DPtr geoBox1(new GbCuboid3D(-0.495, -0.8, 0.545, -0.045, -0.7, 0.795));
+            //if (myid==0) GbSystem3D::writeGeoObject(geoBox1.get(), pathOut+"/geo/geoBox1", WbWriterVtkXmlASCII::getInstance());
+            //CoarsenCrossAndInsideGbObjectBlockVisitor geoBox1Visitor(geoBox1, 11, 11);
+            //grid->accept(geoBox1Visitor);
+            //////////////////////////////////////////////////////////////////////////
+
+
+            if (myid==0)
+            {
+               WriteBlocksCoProcessor ppblocks(grid, SPtr<UbScheduler>(new UbScheduler(1)), pathOut, WbWriterVtkXmlBinary::getInstance(), comm);
+               ppblocks.process(0);
+            }
+
+            RatioBlockVisitor ratioVisitor(refineLevel);
+            CheckRatioBlockVisitor checkRatio(refineLevel);
+            int count = 0;
+
+            do {
+               UBLOG(logINFO, "Refinement - RatioBlockVisitor");
+               grid->accept(ratioVisitor);
+               checkRatio.resetState();
+               UBLOG(logINFO, "Refinement - CheckRatioBlockVisitor");
+               grid->accept(checkRatio);
+               if (myid==0) UBLOG(logINFO, "count ="<<count++<<" state="<<checkRatio.getState());
+            } while (!checkRatio.getState());
+
+            UBLOG(logINFO, "Refinement - OverlapBlockVisitor");
+            OverlapBlockVisitor overlapVisitor(refineLevel, false);
+            grid->accept(overlapVisitor);
+
+            if (myid==0) UBLOG(logINFO, "Refinement - end");
+
+            if (myid==0)
+            {
+               WriteBlocksCoProcessor ppblocks(grid, SPtr<UbScheduler>(new UbScheduler(1)), pathOut, WbWriterVtkXmlBinary::getInstance(), comm);
+               ppblocks.process(1);
+            }
+         }
+
+         grid->updateDistributedBlocks(comm);
+
+         if (myid == 0) UBLOG(logINFO, "SetInterpolationDirsBlockVisitor");
+         std::vector<int> dirs;
+         for (int i = D3Q27System::E; i<=D3Q27System::TS; i++)
+         {
+            dirs.push_back(i);
+         }
+         SetInterpolationDirsBlockVisitor interDirsVisitor(dirs);
+         grid->accept(interDirsVisitor);
+
+         //////////////////////////////////////////////////////////////////////////
+
+
+         //walls
+         GbCuboid3DPtr addWallYmin(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_minX2, g_maxX3+blockLength));
+         if (myid==0) GbSystem3D::writeGeoObject(addWallYmin.get(), pathOut+"/geo/addWallYmin", WbWriterVtkXmlASCII::getInstance());
+
+         GbCuboid3DPtr addWallYmax(new GbCuboid3D(g_minX1-blockLength, g_maxX2, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength));
+         if (myid==0) GbSystem3D::writeGeoObject(addWallYmax.get(), pathOut+"/geo/addWallYmax", WbWriterVtkXmlASCII::getInstance());
+
+         //wall interactors
+         SPtr<D3Q27Interactor> addWallYminInt(new D3Q27Interactor(addWallYmin, grid, slipBCAdapter, Interactor3D::SOLID));
+         SPtr<D3Q27Interactor> addWallYmaxInt(new D3Q27Interactor(addWallYmax, grid, slipBCAdapter, Interactor3D::SOLID));
+
+         //walls
+         GbCuboid3DPtr addWallZmin(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_minX3));
+         if (myid==0) GbSystem3D::writeGeoObject(addWallZmin.get(), pathOut+"/geo/addWallZmin", WbWriterVtkXmlASCII::getInstance());
+
+         GbCuboid3DPtr addWallZmax(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_maxX3, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength));
+         if (myid==0) GbSystem3D::writeGeoObject(addWallZmax.get(), pathOut+"/geo/addWallZmax", WbWriterVtkXmlASCII::getInstance());
+
+         //wall interactors
+         SPtr<D3Q27Interactor> addWallZminInt(new D3Q27Interactor(addWallZmin, grid, slipBCAdapter, Interactor3D::SOLID));
+         SPtr<D3Q27Interactor> addWallZmaxInt(new D3Q27Interactor(addWallZmax, grid, slipBCAdapter, Interactor3D::SOLID));
+
+         //inflow
+         GbCuboid3DPtr geoInflow(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3-blockLength, g_minX1, g_maxX2+blockLength, g_maxX3+blockLength));
+         if (myid==0) GbSystem3D::writeGeoObject(geoInflow.get(), pathOut+"/geo/geoInflow", WbWriterVtkXmlASCII::getInstance());
+
+         //outflow
+         GbCuboid3DPtr geoOutflow(new GbCuboid3D(g_maxX1, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength));
+         if (myid==0) GbSystem3D::writeGeoObject(geoOutflow.get(), pathOut+"/geo/geoOutflow", WbWriterVtkXmlASCII::getInstance());
+
+         //inflow
+         SPtr<D3Q27Interactor> inflowIntr = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoInflow, grid, velBCAdapter, Interactor3D::SOLID));
+
+         //outflow
+         SPtr<D3Q27Interactor> outflowIntr = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoOutflow, grid, denBCAdapter, Interactor3D::SOLID));
+
+         ////////////////////////////////////////////
+         //METIS
+         SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::BSW, MetisPartitioner::KWAY));
+         ////////////////////////////////////////////
+         /////delete solid blocks
+         if (myid==0) UBLOG(logINFO, "deleteSolidBlocks - start");
+         InteractorsHelper intHelper(grid, metisVisitor);
+         intHelper.addInteractor(inflowIntr);
+         intHelper.addInteractor(outflowIntr);
+         intHelper.addInteractor(addWallYminInt);
+         intHelper.addInteractor(addWallYmaxInt);
+         intHelper.addInteractor(addWallZminInt);
+         intHelper.addInteractor(addWallZmaxInt);
+         intHelper.addInteractor(geoVRES0700Int);
+         intHelper.addInteractor(geoSAEInteractor);
+         //////////////////////////////////////////////////////////////////////////
+         intHelper.selectBlocks();
+
+         if (myid==0) UBLOG(logINFO, "deleteSolidBlocks - end");
+         //////////////////////////////////////
+
+         if (myid==0)
+         {
+            SPtr<CoProcessor> ppblocks(new WriteBlocksCoProcessor(grid, SPtr<UbScheduler>(new UbScheduler(1)), pathOut, WbWriterVtkXmlBinary::getInstance(), comm));
+            ppblocks->process(2);
+            ppblocks.reset();
+         }
+         unsigned long long numberOfBlocks = (unsigned long long)grid->getNumberOfBlocks();
+         int ghostLayer = 3;
+         unsigned long long numberOfNodesPerBlock = (unsigned long long)(blockNx[0])* (unsigned long long)(blockNx[1])* (unsigned long long)(blockNx[2]);
+         unsigned long long numberOfNodes = numberOfBlocks * numberOfNodesPerBlock;
+         unsigned long long numberOfNodesPerBlockWithGhostLayer = numberOfBlocks * (blockNx[0]+ghostLayer) * (blockNx[1]+ghostLayer) * (blockNx[2]+ghostLayer);
+         double needMemAll = double(numberOfNodesPerBlockWithGhostLayer*(27*sizeof(double)+sizeof(int)+sizeof(float)*4));
+         double needMem = needMemAll/double(comm->getNumberOfProcesses());
+
+         if (myid==0)
+         {
+            UBLOG(logINFO, "Number of blocks = "<<numberOfBlocks);
+            UBLOG(logINFO, "Number of nodes  = "<<numberOfNodes);
+            int minInitLevel = grid->getCoarsestInitializedLevel();
+            int maxInitLevel = grid->getFinestInitializedLevel();
+            for (int level = minInitLevel; level<=maxInitLevel; level++)
+            {
+               int nobl = grid->getNumberOfBlocks(level);
+               UBLOG(logINFO, "Number of blocks for level "<<level<<" = "<<nobl);
+               UBLOG(logINFO, "Number of nodes for level "<<level<<" = "<<nobl*numberOfNodesPerBlock);
+            }
+            UBLOG(logINFO, "Necessary memory  = "<<needMemAll<<" bytes");
+            UBLOG(logINFO, "Necessary memory per process = "<<needMem<<" bytes");
+            UBLOG(logINFO, "Available memory per process = "<<availMem<<" bytes");
+         }
+
+         SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new CompressibleCumulantLBMKernel(blockNx[0], blockNx[1], blockNx[2], CompressibleCumulantLBMKernel::NORMAL));
+
+         SPtr<BCProcessor> bcProc;
+
+         bcProc = SPtr<BCProcessor>(new BCProcessor());
+
+         kernel->setBCProcessor(bcProc);
+
+         SetKernelBlockVisitor kernelVisitor(kernel, nuLB, availMem, needMem);
+         grid->accept(kernelVisitor);
+
+         if (refineLevel>0)
+         {
+            SetUndefinedNodesBlockVisitor undefNodesVisitor;
+            grid->accept(undefNodesVisitor);
+         }
+
+         //BC
+         intHelper.setBC();
+
+         grid->accept(bcVisitor);
+
+         //initialization of distributions
+         InitDistributionsBlockVisitor initVisitor(nuLB, rhoLB);
+         initVisitor.setVx1(fct);
+         initVisitor.setNu(nuLB);
+         grid->accept(initVisitor);
+
+         ////set connectors
+         InterpolationProcessorPtr iProcessor(new CompressibleOffsetInterpolationProcessor());
+         SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
+         grid->accept(setConnsVisitor);
+
+         //domain decomposition for threads
+         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
+         grid->accept(pqPartVisitor);
+
+         //Postrozess
+         SPtr<UbScheduler> geoSch(new UbScheduler(1));
+         SPtr<CoProcessor> ppgeo(new WriteBoundaryConditionsCoProcessor(grid, geoSch, pathOut, WbWriterVtkXmlBinary::getInstance(), conv, comm));
+         ppgeo->process(0);
+         ppgeo.reset();
+
+         if (myid==0) UBLOG(logINFO, "Preprozess - end");
+      }
+      else
+      {
+         InterpolationProcessorPtr iProcessor(new CompressibleOffsetInterpolationProcessor());
+         SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
+         grid->accept(setConnsVisitor);
+
+         //domain decomposition for threads
+         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
+         grid->accept(pqPartVisitor);
+
+         grid->accept(bcVisitor);
+      }
+
+      SPtr<UbScheduler> nupsSch(new UbScheduler(nupsStep[0], nupsStep[1], nupsStep[2]));
+      NUPSCounterCoProcessor npr(grid, nupsSch, numOfThreads, comm);
+
+      SPtr<UbScheduler> stepSch(new UbScheduler(outTime));
+
+      WriteMacroscopicQuantitiesCoProcessor pp(grid, stepSch, pathOut, WbWriterVtkXmlBinary::getInstance(), conv, comm);
+
+      if (myid==0)
+      {
+         UBLOG(logINFO, "PID = "<<myid<<" Total Physical Memory (RAM): "<<Utilities::getTotalPhysMem());
+         UBLOG(logINFO, "PID = "<<myid<<" Physical Memory currently used: "<<Utilities::getPhysMemUsed());
+         UBLOG(logINFO, "PID = "<<myid<<" Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe());
+      }
+
+      const SPtr<ConcreteCalculatorFactory> calculatorFactory = std::make_shared<ConcreteCalculatorFactory>(stepSch);
+      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, calculatorFactory, CalculatorType::HYBRID));
+      if (myid==0) UBLOG(logINFO, "Simulation-start");
+      calculation->calculate();
+      if (myid==0) UBLOG(logINFO, "Simulation-end");
+   }
+   catch (std::exception& e)
+   {
+      cerr<<e.what()<<endl<<flush;
+   }
+   catch (std::string& s)
+   {
+      cerr<<s<<endl;
+   }
+   catch (...)
+   {
+      cerr<<"unknown exception"<<endl;
+   }
+
+}
+
+int main(int argc, char* argv[])
+{
+
+   if (argv!=NULL)
+   {
+      if (argv[1]!=NULL)
+      {
+         run(string(argv[1]));
+      }
+      else
+      {
+         cout<<"Configuration file must be set!: "<<argv[0]<<" <config file>"<<endl<<std::flush;
+      }
+   }
+
+   return 0;
+}
+
diff --git a/apps/cpu/mirror/mirrorV1.cfg b/apps/cpu/mirror/mirrorV1.cfg
index 57d04a768cbc3557542032b103b22bcd3d01ad19..f06bb8efb096a7328edf693cd50f060c9aa727fa 100644
--- a/apps/cpu/mirror/mirrorV1.cfg
+++ b/apps/cpu/mirror/mirrorV1.cfg
@@ -1,60 +1,60 @@
-pathOut = d:/temp/mirror5
-pathGeo = d:/Projects/Spiegelbenchmark/geometry
-pathMesh = d:/Projects/Spiegelbenchmark/meshBoxes
-
-#geometry
-SAE = SAE_GRUNDKOERPER_CFD_INPUT_VERFEINERT_in_m_SOLID.ASCII_D_0.8.stl
-
-
-#refinement meshes
-VRES0600_chopped = VRES0600_chopped.stl 
-VRES0700_chopped = VRES0700_chopped.stl
-VRES0800_Fahrzeug = VRES0800_Fahrzeug.stl
-#VRES0900 = VRES0900_Cube.stl
-VRES1000_ASaeule = VRES1000_ASaeule.stl
-VRES1000_Scheibe = VRES1000_Scheibe.stl
-VRES1000_Spiegel = VRES1000_Spiegel.stl
-VRES1100_Spiegel_fein = VRES1100_Spiegel_fein.stl
-
-
-numOfThreads = 4
-availMem = 10e9
-refineLevel = 11  
-#blockNx = 9 8 9
-blockNx = 5 5 5
-
-#x1min x1max x2min x2max x3min x3max [m]
-#bounding box
-WTUNNEL1 = -35.8 37.4 -31.5 31.5 -0.177 32.8
-
-#refinement cubes
-VRES0100 = -18.4 24.5 -16.2 16.2 -0.187 16.5
-VRES0200 = -10.7 16.8 -8.56 8.56 -0.187 8.82
-VRES0300 = -6.9 13 -4.72 4.72 -0.187 4.98
-VRES0400 = -4.21 10.8 -2.8 2.8 -0.187 3.06
-VRES0500 = -2.87 8.74 -1.84 1.84 -0.187 2.1
-VRES0700 = -2.6 4.69 -1.25 1.25 -0.255 -0.125 
-VRES0900 = -0.823 0.941 -1.15 -0.7 0.502 1.01
-
-#deltaXcoarse = 4096e-3 #level 0
-deltaXcoarse = 2.048 #level 0
-deltaXfine = 1e-3 #level 11
-
-
-refineDistance = 0.3
-
-restartStep = 1
-restartStepStart = 100
-
-outTime = 1
-endTime = 10
-
-logToFile = false
-
-porousTralingEdge = false
-
-thinWall = false
-
-testBox=false
-
+pathOut = d:/temp/mirror5
+pathGeo = d:/Projects/Spiegelbenchmark/geometry
+pathMesh = d:/Projects/Spiegelbenchmark/meshBoxes
+
+#geometry
+SAE = SAE_GRUNDKOERPER_CFD_INPUT_VERFEINERT_in_m_SOLID.ASCII_D_0.8.stl
+
+
+#refinement meshes
+VRES0600_chopped = VRES0600_chopped.stl 
+VRES0700_chopped = VRES0700_chopped.stl
+VRES0800_Fahrzeug = VRES0800_Fahrzeug.stl
+#VRES0900 = VRES0900_Cube.stl
+VRES1000_ASaeule = VRES1000_ASaeule.stl
+VRES1000_Scheibe = VRES1000_Scheibe.stl
+VRES1000_Spiegel = VRES1000_Spiegel.stl
+VRES1100_Spiegel_fein = VRES1100_Spiegel_fein.stl
+
+
+numOfThreads = 4
+availMem = 10e9
+refineLevel = 11  
+#blockNx = 9 8 9
+blockNx = 5 5 5
+
+#x1min x1max x2min x2max x3min x3max [m]
+#bounding box
+WTUNNEL1 = -35.8 37.4 -31.5 31.5 -0.177 32.8
+
+#refinement cubes
+VRES0100 = -18.4 24.5 -16.2 16.2 -0.187 16.5
+VRES0200 = -10.7 16.8 -8.56 8.56 -0.187 8.82
+VRES0300 = -6.9 13 -4.72 4.72 -0.187 4.98
+VRES0400 = -4.21 10.8 -2.8 2.8 -0.187 3.06
+VRES0500 = -2.87 8.74 -1.84 1.84 -0.187 2.1
+VRES0700 = -2.6 4.69 -1.25 1.25 -0.255 -0.125 
+VRES0900 = -0.823 0.941 -1.15 -0.7 0.502 1.01
+
+#deltaXcoarse = 4096e-3 #level 0
+deltaXcoarse = 2.048 #level 0
+deltaXfine = 1e-3 #level 11
+
+
+refineDistance = 0.3
+
+restartStep = 1
+restartStepStart = 100
+
+outTime = 1
+endTime = 10
+
+logToFile = false
+
+porousTralingEdge = false
+
+thinWall = false
+
+testBox=false
+
 nupsStep = 1 1 10000000
\ No newline at end of file
diff --git a/apps/cpu/mpi_benchmark/mpib.cfg b/apps/cpu/mpi_benchmark/mpib.cfg
index dabc02c8d885d83daf1dd6f19690b721a96e262f..61aab5aa4c72ebe363e3e9a1c6330245b2f51360 100644
--- a/apps/cpu/mpi_benchmark/mpib.cfg
+++ b/apps/cpu/mpi_benchmark/mpib.cfg
@@ -1,13 +1,13 @@
-pathOut = d:/temp/mpib
-output = true
-numOfThreads = 4
-availMem = 3e9
-blockNx = 8 8 8
-logToFile = false
-oneD = true
-priorityQueue = false
-cpStep = 20
-restart = flase
-restartStep = 200
-nupsStep = 10 10 100
+pathOut = d:/temp/mpib
+output = true
+numOfThreads = 4
+availMem = 3e9
+blockNx = 8 8 8
+logToFile = false
+oneD = true
+priorityQueue = false
+cpStep = 20
+restart = flase
+restartStep = 200
+nupsStep = 10 10 100
 endTime = 10
\ No newline at end of file
diff --git a/apps/cpu/mpi_benchmark/mpib.cpp b/apps/cpu/mpi_benchmark/mpib.cpp
index 118e51c975d544637497acf9fc2e0220ee7f142f..7874e2ea51a86663c29f9bc4d8847e832f6b139b 100644
--- a/apps/cpu/mpi_benchmark/mpib.cpp
+++ b/apps/cpu/mpi_benchmark/mpib.cpp
@@ -1,277 +1,277 @@
-#include <iostream>
-#include <string>
-
-#include "VirtualFluids.h"
-
-using namespace std;
-
-
-void run(string configname)
-{
-   SPtr<Communicator> comm = MPICommunicator::getInstance();
-   int myid = comm->getProcessID();
-
-   // Get the name of the processor
-   char machinename[MPI_MAX_PROCESSOR_NAME];
-   int name_len;
-   MPI_Get_processor_name(machinename, &name_len);
-
-   try
-   {
-      //UbLog::reportingLevel() = UbLog::logLevelFromString("DEBUG5");
-
-      ConfigurationFile   config;
-      config.load(configname);
-
-      string          pathOut = config.getString("pathOut");
-      double          endTime = config.getDouble("endTime");
-      int             numOfThreads = config.getInt("numOfThreads");
-      vector<int>     blockNx = config.getVector<int>("blockNx");
-      double          availMem = config.getDouble("availMem");
-      bool            logToFile = config.getBool("logToFile");
-      bool            oneD = config.getBool("oneD");
-      bool            output = config.getBool("output");
-      vector<double>  nupsStep = config.getVector<double>("nupsStep");
-      bool            priorityQueue = config.getBool("priorityQueue");
-      bool            restart = config.getBool("restart");
-      double          restartStep = config.getDouble("restartStep");
-      double          cpStep = config.getDouble("cpStep");
-
-      if (logToFile)
-      {
-#if defined(__unix__)
-         if (myid==0)
-         {
-            const char* str = pathOut.c_str();
-            mkdir(str, S_IRWXU|S_IRWXG|S_IROTH|S_IXOTH);
-         }
-#endif 
-
-         if (myid==0)
-         {
-            stringstream logFilename;
-            logFilename<<pathOut+"/logfile"+UbSystem::toString(UbSystem::getTimeStamp())+".txt";
-            UbLog::output_policy::setStream(logFilename.str());
-         }
-      }
-
-      if (myid==0)
-      {
-         UBLOG(logINFO, "MPI benchmark");
-         UBLOG(logINFO, "1. PID = "<<myid<<" host name: "<<machinename);
-         UBLOG(logINFO, "1. PID = "<<myid<<" Number of processes = "<<comm->getNumberOfProcesses());
-         UBLOG(logINFO, "1. PID = "<<myid<<" Number of threads = "<<numOfThreads);
-         UBLOG(logINFO, "1. PID = "<<myid<<" Total Physical Memory (RAM): "<<Utilities::getTotalPhysMem()/1073741824.0<<" GB");
-         UBLOG(logINFO, "1. PID = "<<myid<<" Physical Memory currently used: "<<Utilities::getPhysMemUsed()/1073741824.0<<" GB");
-         UBLOG(logINFO, "1. PID = "<<myid<<" Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB");
-
-      }
-
-      LBMReal uLB = 0.05;
-      LBMReal Re = 20.0;
-      LBMReal rhoLB = 0.0;
-      LBMReal nueLB = 0.05842;
-      
-      SPtr<Grid3D> grid(new Grid3D(comm));
-      
-      //////////////////////////////////////////////////////////////////////////
-      //restart
-      SPtr<UbScheduler> rSch(new UbScheduler(cpStep,cpStep));
-      MPIIORestartCoProcessor rcp(grid, rSch, pathOut, comm);
-
-      if (restart)
-      {
-         rcp.restart((int)restartStep);
-      }
-      else
-      {
-         double dx = 1;
-         double g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3;
-         double factor = 1.0;
-
-         if (oneD)
-         {
-            factor = comm->getNumberOfProcesses() * numOfThreads;
-            g_minX1 = 0;
-            g_minX2 = 0;
-            g_minX3 = 0;
-
-            g_maxX1 = blockNx[0]*2.0 * factor;
-            g_maxX2 = blockNx[1]*2.0;
-            g_maxX3 = blockNx[2]*2.0;
-         }
-         else
-         {
-            factor = pow(comm->getNumberOfProcesses() * numOfThreads, 1.0/3.0);
-            g_minX1 = 0;
-            g_minX2 = 0;
-            g_minX3 = 0;
-
-            g_maxX1 = blockNx[0]*2.0 * factor;
-            g_maxX2 = blockNx[1]*2.0 * factor;
-            g_maxX3 = blockNx[2]*2.0 * factor;
-         }
-
-         SPtr<LBMUnitConverter> conv = SPtr<LBMUnitConverter>(new LBMUnitConverter());
-
-         grid->setDeltaX(dx);
-         grid->setBlockNX(blockNx[0], blockNx[1], blockNx[2]);
-
-         SPtr<GbObject3D> gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
-         if (myid==0&&output) GbSystem3D::writeGeoObject(gridCube.get(), pathOut+"/geo/gridCube", WbWriterVtkXmlASCII::getInstance());
-         GenBlocksGridVisitor genBlocks(gridCube);
-         grid->accept(genBlocks);
-
-         //grid->setPeriodicX1(true);
-         //grid->setPeriodicX2(true);
-         //grid->setPeriodicX3(true);
-
-         if (myid==0)
-         {
-            UBLOG(logINFO, "//////////////////////////////////////////////////////////////////////////");
-            UBLOG(logINFO, "2. PID = "<<myid<<" Total Physical Memory (RAM): "<<Utilities::getTotalPhysMem()/1073741824.0<<" GB");
-            UBLOG(logINFO, "2. PID = "<<myid<<" Physical Memory currently used: "<<Utilities::getPhysMemUsed()/1073741824.0<<" GB");
-            UBLOG(logINFO, "2. PID = "<<myid<<" Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB");
-            UBLOG(logINFO, "//////////////////////////////////////////////////////////////////////////");
-         }
-
-         if (priorityQueue)
-         {
-            if (myid==0) UBLOG(logINFO, "MetisPartitioningGridVisitor:start");
-            MetisPartitioningGridVisitor metisVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::BSW);
-            grid->accept(metisVisitor);
-            if (myid==0) UBLOG(logINFO, "MetisPartitioningGridVisitor:end");
-
-            //domain decomposition for threads
-            if (myid==0) UBLOG(logINFO, "PQueuePartitioningGridVisitor:start");
-            PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
-            grid->accept(pqPartVisitor);
-            if (myid==0) UBLOG(logINFO, "PQueuePartitioningGridVisitor:end");
-         }
-         else
-         {
-            if (myid==0) UBLOG(logINFO, "MetisPartitioningGridVisitor:start");
-            MetisPartitioningGridVisitor metisVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::BSW, MetisPartitioner::KWAY, true, numOfThreads);
-            grid->accept(metisVisitor);
-            if (myid==0) UBLOG(logINFO, "MetisPartitioningGridVisitor:end");
-         }
-
-
-         if (output)
-         {
-            WriteBlocksCoProcessor ppblocks(grid, SPtr<UbScheduler>(new UbScheduler(1)), pathOut, WbWriterVtkXmlBinary::getInstance(), comm);
-            ppblocks.process(0);
-         }
-
-         unsigned long nob = grid->getNumberOfBlocks();
-         int gl = 3;
-         unsigned long nodb = (blockNx[0])* (blockNx[1])* (blockNx[2]);
-         unsigned long nod = nob * (blockNx[0])* (blockNx[1])* (blockNx[2]);
-         unsigned long nodg = nob * (blockNx[0]+gl) * (blockNx[1]+gl) * (blockNx[2]+gl);
-         double needMemAll = double(nodg*(27*sizeof(double)+sizeof(int)+sizeof(float)*4));
-         double needMem = needMemAll/double(comm->getNumberOfProcesses());
-
-         if (myid==0)
-         {
-            UBLOG(logINFO, "//////////////////////////////////////////////////////////////////////////");
-            UBLOG(logINFO, "Setup information:");
-            UBLOG(logINFO, "Size of block = "<<blockNx[0]<<" x "<<blockNx[1]<<" x "<<blockNx[2]<<" nodes");
-            UBLOG(logINFO, "Size of domain = "<<g_maxX1<<" x "<<g_maxX2<<" x "<<g_maxX3<<" dx ");
-            UBLOG(logINFO, "Number of blocks = "<<nob);
-            UBLOG(logINFO, "Number of nodes  = "<<nod);
-            int minInitLevel = grid->getCoarsestInitializedLevel();
-            int maxInitLevel = grid->getFinestInitializedLevel();
-            for (int level = minInitLevel; level<=maxInitLevel; level++)
-            {
-               int nobl = grid->getNumberOfBlocks(level);
-               UBLOG(logINFO, "Number of blocks for level "<<level<<" = "<<nob);
-               UBLOG(logINFO, "Number of nodes for level "<<level<<" = "<<nob*nodb);
-            }
-            UBLOG(logINFO, "//////////////////////////////////////////////////////////////////////////");
-            UBLOG(logINFO, "Necessary memory  = "<<needMemAll/1073741824.0<<" GB");
-            UBLOG(logINFO, "Necessary memory per process = "<<needMem/1073741824.0<<" GB");
-            UBLOG(logINFO, "Available memory per process = "<<availMem/1073741824.0<<" GB");
-            UBLOG(logINFO, "//////////////////////////////////////////////////////////////////////////");
-         }
-
-         SPtr<LBMKernel> kernel;
-         kernel = SPtr<LBMKernel>(new IncompressibleCumulantLBMKernel(blockNx[0], blockNx[1], blockNx[2], IncompressibleCumulantLBMKernel::NORMAL));
-
-         SPtr<BCProcessor> bcProc(new BCProcessor());
-         kernel->setBCProcessor(bcProc);
-
-         SetKernelBlockVisitor kernelVisitor(kernel, nueLB, availMem, needMem);
-         grid->accept(kernelVisitor);
-
-         //initialization of distributions
-         InitDistributionsBlockVisitor initVisitor(nueLB, rhoLB);
-         initVisitor.setVx1(uLB);
-         grid->accept(initVisitor);
-      }
-
-      //set connectors
-      if (myid==0) UBLOG(logINFO, "SetConnectorsBlockVisitor:start");
-      InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor());
-      SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
-      grid->accept(setConnsVisitor);
-      if (myid==0) UBLOG(logINFO, "SetConnectorsBlockVisitor:end");
-
-      SPtr<UbScheduler> nupsSch(new UbScheduler(nupsStep[0], nupsStep[1], nupsStep[2]));
-      NUPSCounterCoProcessor npr(grid, nupsSch, numOfThreads, comm);
-
-      SPtr<UbScheduler> visSch(new UbScheduler(500, 500));
-
-      if (myid==0)
-      {
-         UBLOG(logINFO, "//////////////////////////////////////////////////////////////////////////");
-         UBLOG(logINFO, "System information:");
-         UBLOG(logINFO, "Total Physical Memory (RAM): "<<Utilities::getTotalPhysMem()/1073741824.0<<" GB");
-         UBLOG(logINFO, "Physical Memory currently used: "<<Utilities::getPhysMemUsed()/1073741824.0<<" GB");
-         UBLOG(logINFO, "Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB");
-         UBLOG(logINFO, "//////////////////////////////////////////////////////////////////////////");
-      }
-
-      const SPtr<ConcreteCalculatorFactory> calculatorFactory = std::make_shared<ConcreteCalculatorFactory>(visSch);
-      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, calculatorFactory, CalculatorType::MPI));
-      if (myid==0) UBLOG(logINFO, "Simulation-start");
-      calculation->calculate();
-      if (myid==0) UBLOG(logINFO, "Simulation-end");
-   }
-   catch (std::exception& e)
-   {
-      cerr<<"PID = "<<myid<<" host name: "<<machinename<<endl<<flush;
-      cerr<<e.what()<<endl<<flush<<
-         boost::current_exception_diagnostic_information();
-   }
-   catch (std::string& s)
-   {
-      cerr<<s<<endl<<boost::current_exception_diagnostic_information();
-   }
-   catch (...)
-   {
-      cerr<<"unknown exception"<<endl<<
-         boost::current_exception_diagnostic_information();
-   }
-}
-
-int main(int argc, char* argv[])
-{
-
-   if (argv!=NULL)
-   {
-      if (argv[1]!=NULL)
-      {
-         run(string(argv[1]));
-         UBLOG(logINFO, "run end");
-      }
-      else
-      {
-         cout<<"Configuration file must be set!: "<<argv[0]<<" <config file>"<<endl<<std::flush;
-      }
-   }
-
-   return 0;
-}
-
-
-
+#include <iostream>
+#include <string>
+
+#include "VirtualFluids.h"
+
+using namespace std;
+
+
+void run(string configname)
+{
+   SPtr<Communicator> comm = MPICommunicator::getInstance();
+   int myid = comm->getProcessID();
+
+   // Get the name of the processor
+   char machinename[MPI_MAX_PROCESSOR_NAME];
+   int name_len;
+   MPI_Get_processor_name(machinename, &name_len);
+
+   try
+   {
+      //UbLog::reportingLevel() = UbLog::logLevelFromString("DEBUG5");
+
+      ConfigurationFile   config;
+      config.load(configname);
+
+      string          pathOut = config.getString("pathOut");
+      double          endTime = config.getDouble("endTime");
+      int             numOfThreads = config.getInt("numOfThreads");
+      vector<int>     blockNx = config.getVector<int>("blockNx");
+      double          availMem = config.getDouble("availMem");
+      bool            logToFile = config.getBool("logToFile");
+      bool            oneD = config.getBool("oneD");
+      bool            output = config.getBool("output");
+      vector<double>  nupsStep = config.getVector<double>("nupsStep");
+      bool            priorityQueue = config.getBool("priorityQueue");
+      bool            restart = config.getBool("restart");
+      double          restartStep = config.getDouble("restartStep");
+      double          cpStep = config.getDouble("cpStep");
+
+      if (logToFile)
+      {
+#if defined(__unix__)
+         if (myid==0)
+         {
+            const char* str = pathOut.c_str();
+            mkdir(str, S_IRWXU|S_IRWXG|S_IROTH|S_IXOTH);
+         }
+#endif 
+
+         if (myid==0)
+         {
+            stringstream logFilename;
+            logFilename<<pathOut+"/logfile"+UbSystem::toString(UbSystem::getTimeStamp())+".txt";
+            UbLog::output_policy::setStream(logFilename.str());
+         }
+      }
+
+      if (myid==0)
+      {
+         UBLOG(logINFO, "MPI benchmark");
+         UBLOG(logINFO, "1. PID = "<<myid<<" host name: "<<machinename);
+         UBLOG(logINFO, "1. PID = "<<myid<<" Number of processes = "<<comm->getNumberOfProcesses());
+         UBLOG(logINFO, "1. PID = "<<myid<<" Number of threads = "<<numOfThreads);
+         UBLOG(logINFO, "1. PID = "<<myid<<" Total Physical Memory (RAM): "<<Utilities::getTotalPhysMem()/1073741824.0<<" GB");
+         UBLOG(logINFO, "1. PID = "<<myid<<" Physical Memory currently used: "<<Utilities::getPhysMemUsed()/1073741824.0<<" GB");
+         UBLOG(logINFO, "1. PID = "<<myid<<" Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB");
+
+      }
+
+      LBMReal uLB = 0.05;
+      LBMReal Re = 20.0;
+      LBMReal rhoLB = 0.0;
+      LBMReal nueLB = 0.05842;
+      
+      SPtr<Grid3D> grid(new Grid3D(comm));
+      
+      //////////////////////////////////////////////////////////////////////////
+      //restart
+      SPtr<UbScheduler> rSch(new UbScheduler(cpStep,cpStep));
+      MPIIORestartCoProcessor rcp(grid, rSch, pathOut, comm);
+
+      if (restart)
+      {
+         rcp.restart((int)restartStep);
+      }
+      else
+      {
+         double dx = 1;
+         double g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3;
+         double factor = 1.0;
+
+         if (oneD)
+         {
+            factor = comm->getNumberOfProcesses() * numOfThreads;
+            g_minX1 = 0;
+            g_minX2 = 0;
+            g_minX3 = 0;
+
+            g_maxX1 = blockNx[0]*2.0 * factor;
+            g_maxX2 = blockNx[1]*2.0;
+            g_maxX3 = blockNx[2]*2.0;
+         }
+         else
+         {
+            factor = pow(comm->getNumberOfProcesses() * numOfThreads, 1.0/3.0);
+            g_minX1 = 0;
+            g_minX2 = 0;
+            g_minX3 = 0;
+
+            g_maxX1 = blockNx[0]*2.0 * factor;
+            g_maxX2 = blockNx[1]*2.0 * factor;
+            g_maxX3 = blockNx[2]*2.0 * factor;
+         }
+
+         SPtr<LBMUnitConverter> conv = SPtr<LBMUnitConverter>(new LBMUnitConverter());
+
+         grid->setDeltaX(dx);
+         grid->setBlockNX(blockNx[0], blockNx[1], blockNx[2]);
+
+         SPtr<GbObject3D> gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
+         if (myid==0&&output) GbSystem3D::writeGeoObject(gridCube.get(), pathOut+"/geo/gridCube", WbWriterVtkXmlASCII::getInstance());
+         GenBlocksGridVisitor genBlocks(gridCube);
+         grid->accept(genBlocks);
+
+         //grid->setPeriodicX1(true);
+         //grid->setPeriodicX2(true);
+         //grid->setPeriodicX3(true);
+
+         if (myid==0)
+         {
+            UBLOG(logINFO, "//////////////////////////////////////////////////////////////////////////");
+            UBLOG(logINFO, "2. PID = "<<myid<<" Total Physical Memory (RAM): "<<Utilities::getTotalPhysMem()/1073741824.0<<" GB");
+            UBLOG(logINFO, "2. PID = "<<myid<<" Physical Memory currently used: "<<Utilities::getPhysMemUsed()/1073741824.0<<" GB");
+            UBLOG(logINFO, "2. PID = "<<myid<<" Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB");
+            UBLOG(logINFO, "//////////////////////////////////////////////////////////////////////////");
+         }
+
+         if (priorityQueue)
+         {
+            if (myid==0) UBLOG(logINFO, "MetisPartitioningGridVisitor:start");
+            MetisPartitioningGridVisitor metisVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::BSW);
+            grid->accept(metisVisitor);
+            if (myid==0) UBLOG(logINFO, "MetisPartitioningGridVisitor:end");
+
+            //domain decomposition for threads
+            if (myid==0) UBLOG(logINFO, "PQueuePartitioningGridVisitor:start");
+            PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
+            grid->accept(pqPartVisitor);
+            if (myid==0) UBLOG(logINFO, "PQueuePartitioningGridVisitor:end");
+         }
+         else
+         {
+            if (myid==0) UBLOG(logINFO, "MetisPartitioningGridVisitor:start");
+            MetisPartitioningGridVisitor metisVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::BSW, MetisPartitioner::KWAY, true, numOfThreads);
+            grid->accept(metisVisitor);
+            if (myid==0) UBLOG(logINFO, "MetisPartitioningGridVisitor:end");
+         }
+
+
+         if (output)
+         {
+            WriteBlocksCoProcessor ppblocks(grid, SPtr<UbScheduler>(new UbScheduler(1)), pathOut, WbWriterVtkXmlBinary::getInstance(), comm);
+            ppblocks.process(0);
+         }
+
+         unsigned long nob = grid->getNumberOfBlocks();
+         int gl = 3;
+         unsigned long nodb = (blockNx[0])* (blockNx[1])* (blockNx[2]);
+         unsigned long nod = nob * (blockNx[0])* (blockNx[1])* (blockNx[2]);
+         unsigned long nodg = nob * (blockNx[0]+gl) * (blockNx[1]+gl) * (blockNx[2]+gl);
+         double needMemAll = double(nodg*(27*sizeof(double)+sizeof(int)+sizeof(float)*4));
+         double needMem = needMemAll/double(comm->getNumberOfProcesses());
+
+         if (myid==0)
+         {
+            UBLOG(logINFO, "//////////////////////////////////////////////////////////////////////////");
+            UBLOG(logINFO, "Setup information:");
+            UBLOG(logINFO, "Size of block = "<<blockNx[0]<<" x "<<blockNx[1]<<" x "<<blockNx[2]<<" nodes");
+            UBLOG(logINFO, "Size of domain = "<<g_maxX1<<" x "<<g_maxX2<<" x "<<g_maxX3<<" dx ");
+            UBLOG(logINFO, "Number of blocks = "<<nob);
+            UBLOG(logINFO, "Number of nodes  = "<<nod);
+            int minInitLevel = grid->getCoarsestInitializedLevel();
+            int maxInitLevel = grid->getFinestInitializedLevel();
+            for (int level = minInitLevel; level<=maxInitLevel; level++)
+            {
+               int nobl = grid->getNumberOfBlocks(level);
+               UBLOG(logINFO, "Number of blocks for level "<<level<<" = "<<nob);
+               UBLOG(logINFO, "Number of nodes for level "<<level<<" = "<<nob*nodb);
+            }
+            UBLOG(logINFO, "//////////////////////////////////////////////////////////////////////////");
+            UBLOG(logINFO, "Necessary memory  = "<<needMemAll/1073741824.0<<" GB");
+            UBLOG(logINFO, "Necessary memory per process = "<<needMem/1073741824.0<<" GB");
+            UBLOG(logINFO, "Available memory per process = "<<availMem/1073741824.0<<" GB");
+            UBLOG(logINFO, "//////////////////////////////////////////////////////////////////////////");
+         }
+
+         SPtr<LBMKernel> kernel;
+         kernel = SPtr<LBMKernel>(new IncompressibleCumulantLBMKernel(blockNx[0], blockNx[1], blockNx[2], IncompressibleCumulantLBMKernel::NORMAL));
+
+         SPtr<BCProcessor> bcProc(new BCProcessor());
+         kernel->setBCProcessor(bcProc);
+
+         SetKernelBlockVisitor kernelVisitor(kernel, nueLB, availMem, needMem);
+         grid->accept(kernelVisitor);
+
+         //initialization of distributions
+         InitDistributionsBlockVisitor initVisitor(nueLB, rhoLB);
+         initVisitor.setVx1(uLB);
+         grid->accept(initVisitor);
+      }
+
+      //set connectors
+      if (myid==0) UBLOG(logINFO, "SetConnectorsBlockVisitor:start");
+      InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor());
+      SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
+      grid->accept(setConnsVisitor);
+      if (myid==0) UBLOG(logINFO, "SetConnectorsBlockVisitor:end");
+
+      SPtr<UbScheduler> nupsSch(new UbScheduler(nupsStep[0], nupsStep[1], nupsStep[2]));
+      NUPSCounterCoProcessor npr(grid, nupsSch, numOfThreads, comm);
+
+      SPtr<UbScheduler> visSch(new UbScheduler(500, 500));
+
+      if (myid==0)
+      {
+         UBLOG(logINFO, "//////////////////////////////////////////////////////////////////////////");
+         UBLOG(logINFO, "System information:");
+         UBLOG(logINFO, "Total Physical Memory (RAM): "<<Utilities::getTotalPhysMem()/1073741824.0<<" GB");
+         UBLOG(logINFO, "Physical Memory currently used: "<<Utilities::getPhysMemUsed()/1073741824.0<<" GB");
+         UBLOG(logINFO, "Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB");
+         UBLOG(logINFO, "//////////////////////////////////////////////////////////////////////////");
+      }
+
+      const SPtr<ConcreteCalculatorFactory> calculatorFactory = std::make_shared<ConcreteCalculatorFactory>(visSch);
+      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, calculatorFactory, CalculatorType::MPI));
+      if (myid==0) UBLOG(logINFO, "Simulation-start");
+      calculation->calculate();
+      if (myid==0) UBLOG(logINFO, "Simulation-end");
+   }
+   catch (std::exception& e)
+   {
+      cerr<<"PID = "<<myid<<" host name: "<<machinename<<endl<<flush;
+      cerr<<e.what()<<endl<<flush<<
+         boost::current_exception_diagnostic_information();
+   }
+   catch (std::string& s)
+   {
+      cerr<<s<<endl<<boost::current_exception_diagnostic_information();
+   }
+   catch (...)
+   {
+      cerr<<"unknown exception"<<endl<<
+         boost::current_exception_diagnostic_information();
+   }
+}
+
+int main(int argc, char* argv[])
+{
+
+   if (argv!=NULL)
+   {
+      if (argv[1]!=NULL)
+      {
+         run(string(argv[1]));
+         UBLOG(logINFO, "run end");
+      }
+      else
+      {
+         cout<<"Configuration file must be set!: "<<argv[0]<<" <config file>"<<endl<<std::flush;
+      }
+   }
+
+   return 0;
+}
+
+
+
diff --git a/apps/cpu/musis/CMakeLists.txt b/apps/cpu/musis/CMakeLists.txt
index ed82e04c1f63994b4eaf6b18ba2964da0bfdf071..829e61a8a006ffb53e5c479224245bcc906b3175 100644
--- a/apps/cpu/musis/CMakeLists.txt
+++ b/apps/cpu/musis/CMakeLists.txt
@@ -1,25 +1,25 @@
-CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
-
-########################################################
-## C++ PROJECT                                       ###
-########################################################
-PROJECT(musis)
-
-INCLUDE(${SOURCE_ROOT}/lib/IncludsList.txt) 
-
-#################################################################
-###   LOCAL FILES                                             ###
-#################################################################
-FILE(GLOB SPECIFIC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.h
-                         ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
-                         ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp  )
- 
-SET(ALL_SOURCES ${ALL_SOURCES} ${SPECIFIC_FILES})
-SOURCE_GROUP(src FILES ${SPECIFIC_FILES})
-  
-SET(CAB_ADDITIONAL_LINK_LIBRARIES vfluids)
-
-#################################################################
-###   CREATE PROJECT                                          ###
-#################################################################
-CREATE_CAB_PROJECT(musis BINARY)
+CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
+
+########################################################
+## C++ PROJECT                                       ###
+########################################################
+PROJECT(musis)
+
+INCLUDE(${SOURCE_ROOT}/lib/IncludsList.txt) 
+
+#################################################################
+###   LOCAL FILES                                             ###
+#################################################################
+FILE(GLOB SPECIFIC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.h
+                         ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
+                         ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp  )
+ 
+SET(ALL_SOURCES ${ALL_SOURCES} ${SPECIFIC_FILES})
+SOURCE_GROUP(src FILES ${SPECIFIC_FILES})
+  
+SET(CAB_ADDITIONAL_LINK_LIBRARIES vfluids)
+
+#################################################################
+###   CREATE PROJECT                                          ###
+#################################################################
+CREATE_CAB_PROJECT(musis BINARY)
diff --git a/apps/cpu/musis/config.txt b/apps/cpu/musis/config.txt
index 023b077a150c7535b7afc3a9e09e359b87bea218..33d618aa626333c2dea4d22cd69dc50056eac6f4 100644
--- a/apps/cpu/musis/config.txt
+++ b/apps/cpu/musis/config.txt
@@ -1,46 +1,46 @@
-#number of threads
-numOfThreads = 1
-
-#block dimensions
-blocknx1 = 12
-blocknx2 = 12
-blocknx3 = 12
-
-#grid refinement
-refineLevel = 2
-numBaseBlock_L1 = 1
-
-#physical length
-L1 = 0.07
-L2 = 0.07
-L3 = 0.4169
-
-#material parameter
-nueLB = 0.0016666666667
-
-#Forcing
-ForcingX1 = 1.0e-7
-
-path = "J:/TBL/scratch/C100_DrySampleTest/"
-
-# musis sample
-geoFile = "J:/TBL/TBL_Sw_Geos/C100/C100MulTest.geo.00000000.raw"
-geoDimX1 = 78
-geoDimX2 = 78
-geoDimX3 = 45
-
-#paraview visualization
-outTime = 1.0
-endTime = 7.0
-
-#retart parameters
-restartDump = 3.0
-
-#data measurement
-calcBegin = 500.0
-calcEnd	 = 1000.0
-calcIntervall = 50.0
-
-
-#BGK=0, CLB=1, CCLB=2
+#number of threads
+numOfThreads = 1
+
+#block dimensions
+blocknx1 = 12
+blocknx2 = 12
+blocknx3 = 12
+
+#grid refinement
+refineLevel = 2
+numBaseBlock_L1 = 1
+
+#physical length
+L1 = 0.07
+L2 = 0.07
+L3 = 0.4169
+
+#material parameter
+nueLB = 0.0016666666667
+
+#Forcing
+ForcingX1 = 1.0e-7
+
+path = "J:/TBL/scratch/C100_DrySampleTest/"
+
+# musis sample
+geoFile = "J:/TBL/TBL_Sw_Geos/C100/C100MulTest.geo.00000000.raw"
+geoDimX1 = 78
+geoDimX2 = 78
+geoDimX3 = 45
+
+#paraview visualization
+outTime = 1.0
+endTime = 7.0
+
+#retart parameters
+restartDump = 3.0
+
+#data measurement
+calcBegin = 500.0
+calcEnd	 = 1000.0
+calcIntervall = 50.0
+
+
+#BGK=0, CLB=1, CCLB=2
 kernel = 2
\ No newline at end of file
diff --git a/apps/cpu/musis/musis.cpp b/apps/cpu/musis/musis.cpp
index 09bb95f862c8df85a389975838032fac417d7f0d..4ac78943b03b6f05a4ad172eea3820cd611c77b5 100644
--- a/apps/cpu/musis/musis.cpp
+++ b/apps/cpu/musis/musis.cpp
@@ -1,474 +1,474 @@
-#include <iostream>
-#include <string>
-
-#include <vfluids.h>
-
-using namespace std;
-
-
-void run(const char *cstr1, const char *cstr2)
-{
-   
-   try
-   {
-      ConfigFileReader cf(cstr1);
-      if ( !cf.read() )
-      {
-         std::string exceptionText = "Unable to read configuration file\n";
-         throw exceptionText;
-      }
-
-      string machine = QUOTEME(CAB_MACHINE);
-      string pathname = cf.getValue("path"); 
-      int numOfThreads = UbSystem::stringTo<int>(cf.getValue("numOfThreads"));
-      double availMem = 0;
-      string geoFile;
-
-      CommunicatorPtr comm(new MPICommunicator());
-      int myid = comm->getProcessID();
-
-      int d1, d2, d3; // for reading musis sample 
-
-      if(machine == "BOMBADIL") 
-      //if(machine == "YWANG")
-      {
-         //pathname = "J:/TBL/scratch/C100_DrySampleTest/";
-         //geoFile  = "J:/TBL/TBL_Sw_Geos/CS518/TBL_CS518_MulSim02.geo.00000000.raw";
-         pathname = cf.getValue("path"); 
-         geoFile  = cf.getValue("geoFile"); 
-         numOfThreads = UbSystem::stringTo<int>(cf.getValue("numOfThreads"));
-         
-         availMem = 3.0e9;
-         d1 = UbSystem::stringTo<int>(cf.getValue("geoDimX1"));;
-         d2 = UbSystem::stringTo<int>(cf.getValue("geoDimX2"));;
-         d3 = UbSystem::stringTo<int>(cf.getValue("geoDimX3"));;
-      }
-      else if(machine == "M01" || machine == "M02")      
-      {
-         //pathname = "/hpc3lustre/work/wang/TBL/scratch/CS518_DrySampleTest/";
-         //geoFile = "/hpc3lustre/work/wang/TBL/TBL_Sw_Geos/CS518.X2Y2Z1/TBL_CS518_MulSim02.geo.00030000.raw";
-         //numOfThreads = 1;
-         pathname = cf.getValue("path"); 
-         geoFile  = cf.getValue("geoFile"); 
-         numOfThreads = UbSystem::stringTo<int>(cf.getValue("numOfThreads"));
-         availMem = 12.0e9;
-
-         if(myid ==0)
-         {
-            stringstream logFilename;
-            logFilename <<  pathname + "/logfile"+UbSystem::toString(UbSystem::getTimeStamp())+".txt";
-            UbLog::output_policy::setStream(logFilename.str());
-         }
-         d1 = UbSystem::stringTo<int>(cf.getValue("geoDimX1"));;
-         d2 = UbSystem::stringTo<int>(cf.getValue("geoDimX2"));;
-         d3 = UbSystem::stringTo<int>(cf.getValue("geoDimX3"));;
-      }
-      else throw UbException(UB_EXARGS, "unknown CAB_MACHINE");
-      
-      const int baseLevel = 0;
-      const int refineLevel = UbSystem::stringTo<int>(cf.getValue("refineLevel"));//2;
-      const int blocknx1    = UbSystem::stringTo<int>(cf.getValue("blocknx1"));//12; 
-      const int blocknx2    = UbSystem::stringTo<int>(cf.getValue("blocknx1"));//12;
-      const int blocknx3    = UbSystem::stringTo<int>(cf.getValue("blocknx1"));//12;
-
-      const int numBaseBlockL1 = UbSystem::stringTo<int>(cf.getValue("numBaseBlock_L1"));//1;
-      ////////////////////////////////////////////////////////////////////////////
-      //// Geometrie
-      ////////////////////////////////////////////////////////////////////////////
-      double L1 = UbSystem::stringTo<double>(cf.getValue("L1"));//0.07; //m
-      double L2 = UbSystem::stringTo<double>(cf.getValue("L2"));//0.07; //m
-      double L3 = UbSystem::stringTo<double>(cf.getValue("L3"));//0.0379 + 0.379; //m
-      double dx = L1/(blocknx1*numBaseBlockL1)/(pow(2.0,refineLevel)); //0.0379/272.0; //m
-
-      LBMReal rhoReal = 1.0; //kg/m^3
-      LBMReal uReal = 5.0;  //m/s
-      LBMReal uLB = 0.1;
-      LBMReal nueLB = UbSystem::stringTo<double>(cf.getValue("nueLB"));//0.00166666666667;
-      LBMReal Re = 0.0;
-      LBMReal rhoLB = 0.0;
-
-      //LBMUnitConverterPtr conv = LBMUnitConverterPtr(new LBMUnitConverter(1.0, 1/sqrt(3.0)*(uReal/uLB), 1.0, 1.0/dx, dx*dx*dx));
-      LBMUnitConverterPtr conv = LBMUnitConverterPtr(new LBMUnitConverter());
-      
-      //bounding box
-      double d_minX1 = 0.0;
-      double d_minX2 = 0.0;
-      double d_minX3 = 0.0;
-
-      double d_maxX1 = L1;
-      double d_maxX2 = L2;
-      double d_maxX3 = L3;
-
-      double offs = 0.0;
-
-      double g_minX1 = d_minX1-offs;
-      double g_minX2 = d_minX2-offs;;
-      double g_minX3 = d_minX3-offs;
-
-      double g_maxX1 = d_maxX1+offs;
-      double g_maxX2 = d_maxX2+offs;
-      double g_maxX3 = d_maxX3+offs;
-
-      double blockLength = blocknx1 * dx;
-
-      Grid3DPtr grid(new Grid3D(comm));
-      grid->setPeriodicX1(true);
-      grid->setPeriodicX2(true);
-      grid->setPeriodicX3(false);
-      grid->setDeltaX(pow(2.0,refineLevel)*dx); // for coarse
-      grid->setBlockNX(blocknx1, blocknx2, blocknx3);
-
-      double restartDump = UbSystem::stringTo<double>(cf.getValue("restartDump"));
-      UbSchedulerPtr rSch(new UbScheduler(restartDump));
-      RestartPostprocessorPtr rp(new RestartPostprocessor(grid, rSch, comm, pathname+"/checkpoints", RestartPostprocessor::BINARY));
-      //UbSchedulerPtr emSch(new UbScheduler(1000, 1000));
-      //EmergencyExitPostprocessor em(grid, emSch, pathname+"/checkpoints/emex.txt", rp, comm);
-
-      std::string opt;
-      if(cstr2!= NULL)
-         opt = std::string(cstr2);
-
-      LBMKernel3DPtr kernel;
-      double ForcingX1 = UbSystem::stringTo<double>(cf.getValue("ForcingX1"));
-
-      mu::Parser fctForcingX1;
-      mu::Parser fctForcingX2;
-      mu::Parser fctForcingX3;
-
-      fctForcingX2.SetExpr("0.0");
-      fctForcingX3.SetExpr("0.0");
-      fctForcingX1.SetExpr("c3*(tanh(c1*(x3-c2))+c4)*Fx1*dx");
-      //fctForcingX1.SetExpr("Fx1*dx");
-      fctForcingX1.DefineConst("Fx1", ForcingX1);
-      fctForcingX1.DefineConst("c1", 0.5);       // incline
-      double ForcingLevel = 0.039/dx;
-      fctForcingX1.DefineConst("c2", ForcingLevel); // forcing switch level
-      fctForcingX1.DefineConst("c3", 0.5); // const always
-      fctForcingX1.DefineConst("c4", 1.0); // const always
-      if(myid == 0) UBLOG(logINFO,"Forcing Level = " << ForcingLevel );
-
-      if(cstr2!= NULL)
-      {
-         if(myid==0) UBLOG(logINFO,"Restart step: " << opt);
-         grid = rp->restart(UbSystem::stringTo<int>(opt));
-         //rp->reconnect(grid);
-
-         //Forcing setzen falls nötig
-         SetForcingBlockVisitor forcingVisitor(fctForcingX1,fctForcingX2,fctForcingX3);
-         grid->accept(forcingVisitor); 
-
-         //set connectors
-         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
-         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
-         grid->accept( setConnsVisitor );
-
-         ////domain decomposition //useful if pro mpi processor contains more than 1 thread 
-         //PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
-         //grid->accept(pqPartVisitor);
-
-         //int option = 0;
-         //LBMKernel3DPtr kernel(new LBMKernelETD3Q27CCLB(blocknx1, blocknx2, blocknx3, option));
-
-
-        
-      }
-      else
-      {
-         if(myid ==0)
-         {
-            UBLOG(logINFO,"L = " << L1/dx );
-            UBLOG(logINFO,"v = " << uLB );
-            UBLOG(logINFO,"rho = " << rhoLB );
-            UBLOG(logINFO,"nue = " << nueLB );
-            UBLOG(logINFO,"Re = " << Re );
-            UBLOG(logINFO,"dx = " << dx );
-            //UBLOG(logINFO,conv->toString() );
-            UBLOG(logINFO,"number of levels = " << refineLevel+1 );
-            UBLOG(logINFO,"numOfThreads = " << numOfThreads );
-            UBLOG(logINFO,"Preprozess - start");
-         }
-
-         // read musis geometry 
-         //if(myid ==0) UBLOG(logINFO,"Read geometry: start");
-         //GbVoxelMatrix3DPtr vmatrix(new GbVoxelMatrix3D(d1, d2, d3, float(GbVoxelMatrix3D::FLUID),8.0,8.0)); 
-
-         //vmatrix->readMatrixFromRawFile<char>(geoFile);
-         //if(myid ==0) UBLOG(logINFO,"Read geometry: end");
-
-         //vmatrix->setVoxelMatrixDelta(L1/(d1-1),L1/(d1-1),L1/(d1-1));
-
-         //if(myid ==0) UBLOG(logINFO,"Write geometry: start");
-         //if(myid == 0) vmatrix->writeToLegacyVTK(pathname+"/geo/geo");
-         //if(myid ==0) UBLOG(logINFO,"Write geometry: end");
-         
-         // domain
-         GbObject3DPtr gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
-         if(myid ==0) GbSystem3D::writeGeoObject(gridCube.get(),pathname + "/geo/gridCube", WbWriterVtkXmlBinary::getInstance());
-
-         //refinement area
-         GbObject3DPtr refineCube1(new  GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1+blockLength, g_maxX2+blockLength, g_minX3+8.0*0.0379));
-         if(myid ==0) GbSystem3D::writeGeoObject(refineCube1.get(),pathname + "/geo/refineCube1", WbWriterVtkXmlBinary::getInstance());
-         GbObject3DPtr refineCube2(new  GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1+blockLength, g_maxX2+blockLength, g_minX3+4.0*0.0379));
-         if(myid ==0) GbSystem3D::writeGeoObject(refineCube2.get(),pathname + "/geo/refineCube2", WbWriterVtkXmlBinary::getInstance());
-
-         // walls
-         GbCuboid3DPtr addWallZmin (new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_minX3));
-         if(myid == 0) GbSystem3D::writeGeoObject(addWallZmin.get(), pathname+"/geo/addWallZmin", WbWriterVtkXmlASCII::getInstance());
-         GbCuboid3DPtr addWallZmax (new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_maxX3, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength));
-         if(myid == 0) GbSystem3D::writeGeoObject(addWallZmax.get(), pathname+"/geo/addWallZmax", WbWriterVtkXmlASCII::getInstance());
-         
-         GenBlocksGridVisitor genBlocks;
-         genBlocks.addGeoObject(gridCube);
-         grid->accept(genBlocks);
-
-         BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname + "/grid/blocks", WbWriterVtkXmlBinary::getInstance(), comm));
-
-         if (refineLevel > 0)
-         {
-            if(myid == 0) UBLOG(logINFO,"Refinement - start");   
-            RefineCrossAndInsideGbObjectHelper refineHelper(grid, refineLevel);
-            refineHelper.addGbObject(refineCube1, refineLevel-1);
-            refineHelper.addGbObject(refineCube2, refineLevel);
-            refineHelper.refine();
-            if(myid == 0) UBLOG(logINFO,"Refinement - end");   
-         }
-         
-         MetisPartitioningGridVisitor metisVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B);
-         grid->accept( metisVisitor );
-
-         SolidBlocksHelper sd(grid, comm);
-
-         int bbOption = 1; //0=simple Bounce Back, 1=quadr. BB
-         D3Q27BoundaryConditionAdapterPtr bc_noslip(new D3Q27NoSlipBCAdapter(bbOption));
-         D3Q27BoundaryConditionAdapterPtr bc_slip(new D3Q27SlipBCAdapter(bbOption));
-         // porous geometry
-         //D3Q27InteractorPtr geoInt = D3Q27InteractorPtr ( new D3Q27Interactor(vmatrix, grid, bc_noslip,Interactor3D::SOLID));
-
-         //mu::Parser fct; 
-         //fct.DefineConst("U", uLB);//Vx
-         //fct.SetExpr("U"); 
-         
-         //D3Q27BoundaryConditionAdapterPtr velBCAdapter(new D3Q27VelocityBCAdapter (true, false ,false ,fct, 0, D3Q27BCFunction::INFCONST)); 
-
-         //walls
-         D3Q27InteractorPtr addWallZminInt(new D3Q27Interactor(addWallZmin, grid, bc_noslip,Interactor3D::SOLID));
-         ////up velocity
-         //D3Q27InteractorPtr addWallZmaxInt(new D3Q27Interactor(addWallZmax, grid, velBCAdapter,Interactor3D::SOLID)); 
-         //up slip
-         D3Q27InteractorPtr addWallZmaxInt(new D3Q27Interactor(addWallZmax, grid, bc_slip  ,Interactor3D::SOLID));
-         
-         //sd.addInteractor(geoInt);
-         sd.addInteractor(addWallZminInt);
-         sd.addInteractor(addWallZmaxInt);
-      
-         sd.deleteSolidBlocks();
-
-         grid->accept( metisVisitor );
-
-
-         ppblocks->update(0);
-         ppblocks.reset();
-
-         //set connectors
-         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
-         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
-         grid->accept( setConnsVisitor );
-
-         unsigned long nob = grid->getNumberOfBlocks();
-         int gl = 3;
-         unsigned long nodb = (blocknx1) * (blocknx2) * (blocknx3);
-         unsigned long nod = nob * (blocknx1) * (blocknx2) * (blocknx3);
-         unsigned long nodg = nob * (blocknx1+gl) * (blocknx2+gl) * (blocknx3+gl);
-         double needMemAll  = double(nod*(27*sizeof(double) + sizeof(int) + sizeof(float)*4));
-         double needMem  = needMemAll / double(comm->getNumberOfProcesses());
-
-         if(myid == 0)
-         {
-            UBLOG(logINFO,"Number of blocks = " << nob);
-            UBLOG(logINFO,"Number of nodes  = " << nod);
-            int minInitLevel = grid->getCoarsestInitializedLevel();
-            int maxInitLevel = grid->getFinestInitializedLevel();
-            for(int level = minInitLevel; level<=maxInitLevel; level++)
-            {
-               int nobl = grid->getNumberOfBlocks(level);
-               UBLOG(logINFO,"Number of blocks for level " << level <<" = " << nobl);
-               UBLOG(logINFO,"Number of nodes for level " << level <<" = " << nobl*nodb);
-            }
-            UBLOG(logINFO,"Necessary memory  = " << needMemAll  << " bytes");
-            UBLOG(logINFO,"Necessary memory per process = " << needMem  << " bytes");
-            UBLOG(logINFO,"Available memory per process = " << availMem << " bytes");
-
-         }            
-
-         //LBMKernel3DPtr kernel(new LBMKernelETD3Q27Cascaded(blocknx1, blocknx2, blocknx3));
-         //LBMKernel3DPtr kernel(new LBMKernelETD3Q27BGK(blocknx1, blocknx2, blocknx3, true));
-         //option = 0 - ohne param., option = 1 - mit param.
-         //int option = 0;
-         //LBMKernel3DPtr kernel(new LBMKernelETD3Q27CCLB(blocknx1, blocknx2, blocknx3, option));
-         
-
-         int kernelType = UbSystem::stringTo<int>(cf.getValue("kernel"));
-         LBMKernel3DPtr kernel;
-         if (kernelType == 0)
-         {
-            rhoLB = 1.0;
-            kernel = LBMKernel3DPtr(new LBMKernelETD3Q27BGK(blocknx1, blocknx2, blocknx3, true));
-         }
-         else if (kernelType == 1)
-         {
-            rhoLB = 1.0;
-            kernel = LBMKernel3DPtr(new LBMKernelETD3Q27Cascaded(blocknx1, blocknx2, blocknx3));
-         }
-         else if (kernelType == 2)
-         {
-            rhoLB = 0.0;
-            kernel = LBMKernel3DPtr(new LBMKernelETD3Q27CCLB(blocknx1, blocknx2, blocknx3, 0));
-            //kernel = LBMKernel3DPtr(new LBMKernelESD3Q27CCLB(blocknx1, blocknx2, blocknx3, grid));
-            //kernel = LBMKernel3DPtr(new LBMKernelETD3Q27CCLBex(blocknx1, blocknx2, blocknx3, 0, grid));
-         }
-         
-         kernel->setForcingX1(fctForcingX1);
-         kernel->setForcingX2(fctForcingX2);
-         kernel->setForcingX3(fctForcingX3);
-         kernel->setWithForcing(true);
-         
-
-         BCProcessorPtr bcProc(new D3Q27ETBCProcessor());
-         kernel->setBCProcessor(bcProc);
-
-         mu::Parser fctnueLB;
-
-         SetKernelBlockVisitor kernelVisitor(kernel, nueLB, availMem, needMem);
-         grid->accept(kernelVisitor);
-
-         if (refineLevel > 0)
-         {
-            D3Q27SetUndefinedNodesBlockVisitor undefNodesVisitor;
-            grid->accept(undefNodesVisitor);
-         }
-
-      //   //walls
-         grid->addAndInitInteractor(addWallZminInt);
-         grid->addAndInitInteractor(addWallZmaxInt);
-         // porous geometry
-         //grid->addAndInitInteractor(geoInt);
-
-         //initialization of distributions
-         D3Q27ETInitDistributionsBlockVisitor initVisitor(rhoLB);
-         //initVisitor.setVx1(0.0);
-         grid->accept(initVisitor);
-
-         ////Postrozess - Measurement
-         UbSchedulerPtr geoSch(new UbScheduler(1));
-         D3Q27MacroscopicQuantitiesPostprocessorPtr ppgeo(
-            new D3Q27MacroscopicQuantitiesPostprocessor(grid, geoSch, pathname + "/grid/nodes", WbWriterVtkXmlBinary::getInstance(), conv, comm, true));
-         ppgeo->update(0);
-         ppgeo.reset();
-
-         //if(myid == 0) UBLOG(logINFO,"Preprozess - end"); 
-      }
-      
-      UbSchedulerPtr nupsSch(new UbScheduler(10, 30, 100));
-      NUPSCounterPostprocessor npr(grid, nupsSch, pathname + "/results/nups.txt", comm);
-
-      double calcBegin = UbSystem::stringTo<double>(cf.getValue("calcBegin"));//0.07; //m
-      double calcEnd = UbSystem::stringTo<double>(cf.getValue("calcEnd"));//0.07; //m
-      double calcIntervall = UbSystem::stringTo<double>(cf.getValue("calcIntervall"));//0.0379 + 0.379; //m
-      
-      /*UbSchedulerPtr TBL_Sch(new UbScheduler(calcIntervall,calcBegin,calcEnd));
-      UbSchedulerPtr TBL_rSch(new UbScheduler(100000));
-      TurbulentStrengthSurfaceRoughnessPostprocessor TBLpp(grid,pathname +"/results/TBL", TBL_Sch,TBL_rSch,comm);
-      */
-
-      double outTime = UbSystem::stringTo<double>(cf.getValue("outTime"));
-      UbSchedulerPtr stepSch(new UbScheduler(outTime));
-      D3Q27MacroscopicQuantitiesPostprocessor pp(grid, stepSch, pathname + "/steps/step", WbWriterVtkXmlASCII::getInstance(), conv, comm);
-
-      double fdx = grid->getDeltaX(grid->getFinestInitializedLevel());
-
-      //D3Q27IntegrateValuesHelperPtr h1(new D3Q27IntegrateValuesHelper(grid, comm, 
-      //   g_minX1, g_minX2, g_minX3, 
-      //   g_minX1+1.0*fdx, g_maxX2, g_maxX3));
-      ////if(myid ==0) GbSystem3D::writeGeoObject(h1->getBoundingBox().get(),pathname + "/geo/iv1", WbWriterVtkXmlBinary::getInstance());
-      //D3Q27IntegrateValuesHelperPtr h2(new D3Q27IntegrateValuesHelper(grid, comm, 
-      //   g_maxX1-1.0*fdx, g_minX2, g_minX3, 
-      //   g_maxX1, g_maxX2, g_maxX3));
-      ////if(myid ==0) GbSystem3D::writeGeoObject(h2->getBoundingBox().get(),pathname + "/geo/iv2", WbWriterVtkXmlBinary::getInstance());
-      //LBMReal rhoReal = rhoLB;
-      //LBMReal uReal = uLB; 
-      //D3Q27PressureDifferencePostprocessor rhopp(grid, stepSch, pathname + "/results/rho_diff.txt", h1, h2, rhoReal, uReal, uLB, comm);
-
-      //UbSchedulerPtr resSch(new UbScheduler(1000,10000,10000));
-      //UbSchedulerPtr visSch(new UbScheduler(1,0,1));         
-      //AverageValuesPostprocessor TBLpp(grid, pathname + "/results/AvVelocity", WbWriterVtkXmlBinary::getInstance(), visSch, resSch, comm); 
-
-
-      double endTime = UbSystem::stringTo<double>(cf.getValue("endTime"));;//10001.0;
-
-      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, stepSch));
-      if(myid == 0) UBLOG(logINFO,"Simulation-start");
-      calculation->calculate();
-      if(myid == 0) UBLOG(logINFO,"Simulation-end");
-      //
-      //double point1[3] = {0.45, 0.20, 0.205};
-      //double point2[3] = {0.55, 0.20, 0.205};
-      //D3Q27IntegrateValuesHelperPtr h1(new D3Q27IntegrateValuesHelper(grid, comm, 
-      //   point1[0]-1.0*fdx, point1[1]-1.0*fdx, point1[2]-1.0*fdx, 
-      //   point1[0], point1[1], point1[2]));
-      //if(myid ==0) GbSystem3D::writeGeoObject(h1->getBoundingBox().get(),pathname + "/geo/iv1", WbWriterVtkXmlBinary::getInstance());
-      //D3Q27IntegrateValuesHelperPtr h2(new D3Q27IntegrateValuesHelper(grid, comm, 
-      //   point2[0], point2[1]-1.0*fdx, point2[2]-1.0*fdx, 
-      //   point2[0]+1.0*fdx, point2[1], point2[2]));
-      //if(myid ==0) GbSystem3D::writeGeoObject(h2->getBoundingBox().get(),pathname + "/geo/iv2", WbWriterVtkXmlBinary::getInstance());
-      ////D3Q27PressureDifferencePostprocessor rhopp(grid, visSch, pathname + "/results/rho_diff.txt", h1, h2, conv, comm);
-      //D3Q27PressureDifferencePostprocessor rhopp(grid, visSch, pathname + "/results/rho_diff.txt", h1, h2, rhoReal, uReal, uLB, comm);
-      //
-      //double area = 2.0*radius*H;
-      //double v    = 4.0*uLB/9.0;
-      //D3Q27ForcesPostprocessor fp(grid, visSch, pathname + "/results/forces.txt", comm, rhoLB, v, area, D3Q27ForcesPostprocessor::X, D3Q27ForcesPostprocessor::Y);
-      //fp.addInteractor(cylinderInt);
-      //
-      //UbSchedulerPtr nupsSch(new UbScheduler(10, 10, 40));
-      //NUPSCounterPostprocessor npr(grid, nupsSch, pathname + "/results/nups.txt", comm);
-
-      //double endTime = 40001.0;
-      //CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, visSch));
-      //if(myid == 0) UBLOG(logINFO,"Simulation-start");
-      //calculation->calculate();
-      //if(myid == 0) UBLOG(logINFO,"Simulation-end");
-   }
-   catch(std::exception& e)
-   {
-      cerr << e.what() << endl << flush;
-   }
-   catch(std::string& s)
-   {
-      cerr << s << endl;
-   }
-   catch(...)
-   {
-      cerr << "unknown exception" << endl;
-   }
-
-}
-int main(int argc, char* argv[])
-{
-   if ( argv != NULL )
-   {
-      if (argc > 1)
-      {
-         run(argv[1], argv[2]);
-      }
-      else
-      {
-         cout << "Configuration file must be set!: " <<  argv[0] << " <config file>" << endl << std::flush;
-      }
-   }
-
-   return 0;
- 
-}
-
-
-
-
+#include <iostream>
+#include <string>
+
+#include <vfluids.h>
+
+using namespace std;
+
+
+void run(const char *cstr1, const char *cstr2)
+{
+   
+   try
+   {
+      ConfigFileReader cf(cstr1);
+      if ( !cf.read() )
+      {
+         std::string exceptionText = "Unable to read configuration file\n";
+         throw exceptionText;
+      }
+
+      string machine = QUOTEME(CAB_MACHINE);
+      string pathname = cf.getValue("path"); 
+      int numOfThreads = UbSystem::stringTo<int>(cf.getValue("numOfThreads"));
+      double availMem = 0;
+      string geoFile;
+
+      CommunicatorPtr comm(new MPICommunicator());
+      int myid = comm->getProcessID();
+
+      int d1, d2, d3; // for reading musis sample 
+
+      if(machine == "BOMBADIL") 
+      //if(machine == "YWANG")
+      {
+         //pathname = "J:/TBL/scratch/C100_DrySampleTest/";
+         //geoFile  = "J:/TBL/TBL_Sw_Geos/CS518/TBL_CS518_MulSim02.geo.00000000.raw";
+         pathname = cf.getValue("path"); 
+         geoFile  = cf.getValue("geoFile"); 
+         numOfThreads = UbSystem::stringTo<int>(cf.getValue("numOfThreads"));
+         
+         availMem = 3.0e9;
+         d1 = UbSystem::stringTo<int>(cf.getValue("geoDimX1"));;
+         d2 = UbSystem::stringTo<int>(cf.getValue("geoDimX2"));;
+         d3 = UbSystem::stringTo<int>(cf.getValue("geoDimX3"));;
+      }
+      else if(machine == "M01" || machine == "M02")      
+      {
+         //pathname = "/hpc3lustre/work/wang/TBL/scratch/CS518_DrySampleTest/";
+         //geoFile = "/hpc3lustre/work/wang/TBL/TBL_Sw_Geos/CS518.X2Y2Z1/TBL_CS518_MulSim02.geo.00030000.raw";
+         //numOfThreads = 1;
+         pathname = cf.getValue("path"); 
+         geoFile  = cf.getValue("geoFile"); 
+         numOfThreads = UbSystem::stringTo<int>(cf.getValue("numOfThreads"));
+         availMem = 12.0e9;
+
+         if(myid ==0)
+         {
+            stringstream logFilename;
+            logFilename <<  pathname + "/logfile"+UbSystem::toString(UbSystem::getTimeStamp())+".txt";
+            UbLog::output_policy::setStream(logFilename.str());
+         }
+         d1 = UbSystem::stringTo<int>(cf.getValue("geoDimX1"));;
+         d2 = UbSystem::stringTo<int>(cf.getValue("geoDimX2"));;
+         d3 = UbSystem::stringTo<int>(cf.getValue("geoDimX3"));;
+      }
+      else throw UbException(UB_EXARGS, "unknown CAB_MACHINE");
+      
+      const int baseLevel = 0;
+      const int refineLevel = UbSystem::stringTo<int>(cf.getValue("refineLevel"));//2;
+      const int blocknx1    = UbSystem::stringTo<int>(cf.getValue("blocknx1"));//12; 
+      const int blocknx2    = UbSystem::stringTo<int>(cf.getValue("blocknx1"));//12;
+      const int blocknx3    = UbSystem::stringTo<int>(cf.getValue("blocknx1"));//12;
+
+      const int numBaseBlockL1 = UbSystem::stringTo<int>(cf.getValue("numBaseBlock_L1"));//1;
+      ////////////////////////////////////////////////////////////////////////////
+      //// Geometrie
+      ////////////////////////////////////////////////////////////////////////////
+      double L1 = UbSystem::stringTo<double>(cf.getValue("L1"));//0.07; //m
+      double L2 = UbSystem::stringTo<double>(cf.getValue("L2"));//0.07; //m
+      double L3 = UbSystem::stringTo<double>(cf.getValue("L3"));//0.0379 + 0.379; //m
+      double dx = L1/(blocknx1*numBaseBlockL1)/(pow(2.0,refineLevel)); //0.0379/272.0; //m
+
+      LBMReal rhoReal = 1.0; //kg/m^3
+      LBMReal uReal = 5.0;  //m/s
+      LBMReal uLB = 0.1;
+      LBMReal nueLB = UbSystem::stringTo<double>(cf.getValue("nueLB"));//0.00166666666667;
+      LBMReal Re = 0.0;
+      LBMReal rhoLB = 0.0;
+
+      //LBMUnitConverterPtr conv = LBMUnitConverterPtr(new LBMUnitConverter(1.0, 1/sqrt(3.0)*(uReal/uLB), 1.0, 1.0/dx, dx*dx*dx));
+      LBMUnitConverterPtr conv = LBMUnitConverterPtr(new LBMUnitConverter());
+      
+      //bounding box
+      double d_minX1 = 0.0;
+      double d_minX2 = 0.0;
+      double d_minX3 = 0.0;
+
+      double d_maxX1 = L1;
+      double d_maxX2 = L2;
+      double d_maxX3 = L3;
+
+      double offs = 0.0;
+
+      double g_minX1 = d_minX1-offs;
+      double g_minX2 = d_minX2-offs;;
+      double g_minX3 = d_minX3-offs;
+
+      double g_maxX1 = d_maxX1+offs;
+      double g_maxX2 = d_maxX2+offs;
+      double g_maxX3 = d_maxX3+offs;
+
+      double blockLength = blocknx1 * dx;
+
+      Grid3DPtr grid(new Grid3D(comm));
+      grid->setPeriodicX1(true);
+      grid->setPeriodicX2(true);
+      grid->setPeriodicX3(false);
+      grid->setDeltaX(pow(2.0,refineLevel)*dx); // for coarse
+      grid->setBlockNX(blocknx1, blocknx2, blocknx3);
+
+      double restartDump = UbSystem::stringTo<double>(cf.getValue("restartDump"));
+      UbSchedulerPtr rSch(new UbScheduler(restartDump));
+      RestartPostprocessorPtr rp(new RestartPostprocessor(grid, rSch, comm, pathname+"/checkpoints", RestartPostprocessor::BINARY));
+      //UbSchedulerPtr emSch(new UbScheduler(1000, 1000));
+      //EmergencyExitPostprocessor em(grid, emSch, pathname+"/checkpoints/emex.txt", rp, comm);
+
+      std::string opt;
+      if(cstr2!= NULL)
+         opt = std::string(cstr2);
+
+      LBMKernel3DPtr kernel;
+      double ForcingX1 = UbSystem::stringTo<double>(cf.getValue("ForcingX1"));
+
+      mu::Parser fctForcingX1;
+      mu::Parser fctForcingX2;
+      mu::Parser fctForcingX3;
+
+      fctForcingX2.SetExpr("0.0");
+      fctForcingX3.SetExpr("0.0");
+      fctForcingX1.SetExpr("c3*(tanh(c1*(x3-c2))+c4)*Fx1*dx");
+      //fctForcingX1.SetExpr("Fx1*dx");
+      fctForcingX1.DefineConst("Fx1", ForcingX1);
+      fctForcingX1.DefineConst("c1", 0.5);       // incline
+      double ForcingLevel = 0.039/dx;
+      fctForcingX1.DefineConst("c2", ForcingLevel); // forcing switch level
+      fctForcingX1.DefineConst("c3", 0.5); // const always
+      fctForcingX1.DefineConst("c4", 1.0); // const always
+      if(myid == 0) UBLOG(logINFO,"Forcing Level = " << ForcingLevel );
+
+      if(cstr2!= NULL)
+      {
+         if(myid==0) UBLOG(logINFO,"Restart step: " << opt);
+         grid = rp->restart(UbSystem::stringTo<int>(opt));
+         //rp->reconnect(grid);
+
+         //Forcing setzen falls nötig
+         SetForcingBlockVisitor forcingVisitor(fctForcingX1,fctForcingX2,fctForcingX3);
+         grid->accept(forcingVisitor); 
+
+         //set connectors
+         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
+         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
+         grid->accept( setConnsVisitor );
+
+         ////domain decomposition //useful if pro mpi processor contains more than 1 thread 
+         //PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
+         //grid->accept(pqPartVisitor);
+
+         //int option = 0;
+         //LBMKernel3DPtr kernel(new LBMKernelETD3Q27CCLB(blocknx1, blocknx2, blocknx3, option));
+
+
+        
+      }
+      else
+      {
+         if(myid ==0)
+         {
+            UBLOG(logINFO,"L = " << L1/dx );
+            UBLOG(logINFO,"v = " << uLB );
+            UBLOG(logINFO,"rho = " << rhoLB );
+            UBLOG(logINFO,"nue = " << nueLB );
+            UBLOG(logINFO,"Re = " << Re );
+            UBLOG(logINFO,"dx = " << dx );
+            //UBLOG(logINFO,conv->toString() );
+            UBLOG(logINFO,"number of levels = " << refineLevel+1 );
+            UBLOG(logINFO,"numOfThreads = " << numOfThreads );
+            UBLOG(logINFO,"Preprozess - start");
+         }
+
+         // read musis geometry 
+         //if(myid ==0) UBLOG(logINFO,"Read geometry: start");
+         //GbVoxelMatrix3DPtr vmatrix(new GbVoxelMatrix3D(d1, d2, d3, float(GbVoxelMatrix3D::FLUID),8.0,8.0)); 
+
+         //vmatrix->readMatrixFromRawFile<char>(geoFile);
+         //if(myid ==0) UBLOG(logINFO,"Read geometry: end");
+
+         //vmatrix->setVoxelMatrixDelta(L1/(d1-1),L1/(d1-1),L1/(d1-1));
+
+         //if(myid ==0) UBLOG(logINFO,"Write geometry: start");
+         //if(myid == 0) vmatrix->writeToLegacyVTK(pathname+"/geo/geo");
+         //if(myid ==0) UBLOG(logINFO,"Write geometry: end");
+         
+         // domain
+         GbObject3DPtr gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
+         if(myid ==0) GbSystem3D::writeGeoObject(gridCube.get(),pathname + "/geo/gridCube", WbWriterVtkXmlBinary::getInstance());
+
+         //refinement area
+         GbObject3DPtr refineCube1(new  GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1+blockLength, g_maxX2+blockLength, g_minX3+8.0*0.0379));
+         if(myid ==0) GbSystem3D::writeGeoObject(refineCube1.get(),pathname + "/geo/refineCube1", WbWriterVtkXmlBinary::getInstance());
+         GbObject3DPtr refineCube2(new  GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1+blockLength, g_maxX2+blockLength, g_minX3+4.0*0.0379));
+         if(myid ==0) GbSystem3D::writeGeoObject(refineCube2.get(),pathname + "/geo/refineCube2", WbWriterVtkXmlBinary::getInstance());
+
+         // walls
+         GbCuboid3DPtr addWallZmin (new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_minX3));
+         if(myid == 0) GbSystem3D::writeGeoObject(addWallZmin.get(), pathname+"/geo/addWallZmin", WbWriterVtkXmlASCII::getInstance());
+         GbCuboid3DPtr addWallZmax (new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_maxX3, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength));
+         if(myid == 0) GbSystem3D::writeGeoObject(addWallZmax.get(), pathname+"/geo/addWallZmax", WbWriterVtkXmlASCII::getInstance());
+         
+         GenBlocksGridVisitor genBlocks;
+         genBlocks.addGeoObject(gridCube);
+         grid->accept(genBlocks);
+
+         BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname + "/grid/blocks", WbWriterVtkXmlBinary::getInstance(), comm));
+
+         if (refineLevel > 0)
+         {
+            if(myid == 0) UBLOG(logINFO,"Refinement - start");   
+            RefineCrossAndInsideGbObjectHelper refineHelper(grid, refineLevel);
+            refineHelper.addGbObject(refineCube1, refineLevel-1);
+            refineHelper.addGbObject(refineCube2, refineLevel);
+            refineHelper.refine();
+            if(myid == 0) UBLOG(logINFO,"Refinement - end");   
+         }
+         
+         MetisPartitioningGridVisitor metisVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B);
+         grid->accept( metisVisitor );
+
+         SolidBlocksHelper sd(grid, comm);
+
+         int bbOption = 1; //0=simple Bounce Back, 1=quadr. BB
+         D3Q27BoundaryConditionAdapterPtr bc_noslip(new D3Q27NoSlipBCAdapter(bbOption));
+         D3Q27BoundaryConditionAdapterPtr bc_slip(new D3Q27SlipBCAdapter(bbOption));
+         // porous geometry
+         //D3Q27InteractorPtr geoInt = D3Q27InteractorPtr ( new D3Q27Interactor(vmatrix, grid, bc_noslip,Interactor3D::SOLID));
+
+         //mu::Parser fct; 
+         //fct.DefineConst("U", uLB);//Vx
+         //fct.SetExpr("U"); 
+         
+         //D3Q27BoundaryConditionAdapterPtr velBCAdapter(new D3Q27VelocityBCAdapter (true, false ,false ,fct, 0, D3Q27BCFunction::INFCONST)); 
+
+         //walls
+         D3Q27InteractorPtr addWallZminInt(new D3Q27Interactor(addWallZmin, grid, bc_noslip,Interactor3D::SOLID));
+         ////up velocity
+         //D3Q27InteractorPtr addWallZmaxInt(new D3Q27Interactor(addWallZmax, grid, velBCAdapter,Interactor3D::SOLID)); 
+         //up slip
+         D3Q27InteractorPtr addWallZmaxInt(new D3Q27Interactor(addWallZmax, grid, bc_slip  ,Interactor3D::SOLID));
+         
+         //sd.addInteractor(geoInt);
+         sd.addInteractor(addWallZminInt);
+         sd.addInteractor(addWallZmaxInt);
+      
+         sd.deleteSolidBlocks();
+
+         grid->accept( metisVisitor );
+
+
+         ppblocks->update(0);
+         ppblocks.reset();
+
+         //set connectors
+         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
+         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
+         grid->accept( setConnsVisitor );
+
+         unsigned long nob = grid->getNumberOfBlocks();
+         int gl = 3;
+         unsigned long nodb = (blocknx1) * (blocknx2) * (blocknx3);
+         unsigned long nod = nob * (blocknx1) * (blocknx2) * (blocknx3);
+         unsigned long nodg = nob * (blocknx1+gl) * (blocknx2+gl) * (blocknx3+gl);
+         double needMemAll  = double(nod*(27*sizeof(double) + sizeof(int) + sizeof(float)*4));
+         double needMem  = needMemAll / double(comm->getNumberOfProcesses());
+
+         if(myid == 0)
+         {
+            UBLOG(logINFO,"Number of blocks = " << nob);
+            UBLOG(logINFO,"Number of nodes  = " << nod);
+            int minInitLevel = grid->getCoarsestInitializedLevel();
+            int maxInitLevel = grid->getFinestInitializedLevel();
+            for(int level = minInitLevel; level<=maxInitLevel; level++)
+            {
+               int nobl = grid->getNumberOfBlocks(level);
+               UBLOG(logINFO,"Number of blocks for level " << level <<" = " << nobl);
+               UBLOG(logINFO,"Number of nodes for level " << level <<" = " << nobl*nodb);
+            }
+            UBLOG(logINFO,"Necessary memory  = " << needMemAll  << " bytes");
+            UBLOG(logINFO,"Necessary memory per process = " << needMem  << " bytes");
+            UBLOG(logINFO,"Available memory per process = " << availMem << " bytes");
+
+         }            
+
+         //LBMKernel3DPtr kernel(new LBMKernelETD3Q27Cascaded(blocknx1, blocknx2, blocknx3));
+         //LBMKernel3DPtr kernel(new LBMKernelETD3Q27BGK(blocknx1, blocknx2, blocknx3, true));
+         //option = 0 - ohne param., option = 1 - mit param.
+         //int option = 0;
+         //LBMKernel3DPtr kernel(new LBMKernelETD3Q27CCLB(blocknx1, blocknx2, blocknx3, option));
+         
+
+         int kernelType = UbSystem::stringTo<int>(cf.getValue("kernel"));
+         LBMKernel3DPtr kernel;
+         if (kernelType == 0)
+         {
+            rhoLB = 1.0;
+            kernel = LBMKernel3DPtr(new LBMKernelETD3Q27BGK(blocknx1, blocknx2, blocknx3, true));
+         }
+         else if (kernelType == 1)
+         {
+            rhoLB = 1.0;
+            kernel = LBMKernel3DPtr(new LBMKernelETD3Q27Cascaded(blocknx1, blocknx2, blocknx3));
+         }
+         else if (kernelType == 2)
+         {
+            rhoLB = 0.0;
+            kernel = LBMKernel3DPtr(new LBMKernelETD3Q27CCLB(blocknx1, blocknx2, blocknx3, 0));
+            //kernel = LBMKernel3DPtr(new LBMKernelESD3Q27CCLB(blocknx1, blocknx2, blocknx3, grid));
+            //kernel = LBMKernel3DPtr(new LBMKernelETD3Q27CCLBex(blocknx1, blocknx2, blocknx3, 0, grid));
+         }
+         
+         kernel->setForcingX1(fctForcingX1);
+         kernel->setForcingX2(fctForcingX2);
+         kernel->setForcingX3(fctForcingX3);
+         kernel->setWithForcing(true);
+         
+
+         BCProcessorPtr bcProc(new D3Q27ETBCProcessor());
+         kernel->setBCProcessor(bcProc);
+
+         mu::Parser fctnueLB;
+
+         SetKernelBlockVisitor kernelVisitor(kernel, nueLB, availMem, needMem);
+         grid->accept(kernelVisitor);
+
+         if (refineLevel > 0)
+         {
+            D3Q27SetUndefinedNodesBlockVisitor undefNodesVisitor;
+            grid->accept(undefNodesVisitor);
+         }
+
+      //   //walls
+         grid->addAndInitInteractor(addWallZminInt);
+         grid->addAndInitInteractor(addWallZmaxInt);
+         // porous geometry
+         //grid->addAndInitInteractor(geoInt);
+
+         //initialization of distributions
+         D3Q27ETInitDistributionsBlockVisitor initVisitor(rhoLB);
+         //initVisitor.setVx1(0.0);
+         grid->accept(initVisitor);
+
+         ////Postrozess - Measurement
+         UbSchedulerPtr geoSch(new UbScheduler(1));
+         D3Q27MacroscopicQuantitiesPostprocessorPtr ppgeo(
+            new D3Q27MacroscopicQuantitiesPostprocessor(grid, geoSch, pathname + "/grid/nodes", WbWriterVtkXmlBinary::getInstance(), conv, comm, true));
+         ppgeo->update(0);
+         ppgeo.reset();
+
+         //if(myid == 0) UBLOG(logINFO,"Preprozess - end"); 
+      }
+      
+      UbSchedulerPtr nupsSch(new UbScheduler(10, 30, 100));
+      NUPSCounterPostprocessor npr(grid, nupsSch, pathname + "/results/nups.txt", comm);
+
+      double calcBegin = UbSystem::stringTo<double>(cf.getValue("calcBegin"));//0.07; //m
+      double calcEnd = UbSystem::stringTo<double>(cf.getValue("calcEnd"));//0.07; //m
+      double calcIntervall = UbSystem::stringTo<double>(cf.getValue("calcIntervall"));//0.0379 + 0.379; //m
+      
+      /*UbSchedulerPtr TBL_Sch(new UbScheduler(calcIntervall,calcBegin,calcEnd));
+      UbSchedulerPtr TBL_rSch(new UbScheduler(100000));
+      TurbulentStrengthSurfaceRoughnessPostprocessor TBLpp(grid,pathname +"/results/TBL", TBL_Sch,TBL_rSch,comm);
+      */
+
+      double outTime = UbSystem::stringTo<double>(cf.getValue("outTime"));
+      UbSchedulerPtr stepSch(new UbScheduler(outTime));
+      D3Q27MacroscopicQuantitiesPostprocessor pp(grid, stepSch, pathname + "/steps/step", WbWriterVtkXmlASCII::getInstance(), conv, comm);
+
+      double fdx = grid->getDeltaX(grid->getFinestInitializedLevel());
+
+      //D3Q27IntegrateValuesHelperPtr h1(new D3Q27IntegrateValuesHelper(grid, comm, 
+      //   g_minX1, g_minX2, g_minX3, 
+      //   g_minX1+1.0*fdx, g_maxX2, g_maxX3));
+      ////if(myid ==0) GbSystem3D::writeGeoObject(h1->getBoundingBox().get(),pathname + "/geo/iv1", WbWriterVtkXmlBinary::getInstance());
+      //D3Q27IntegrateValuesHelperPtr h2(new D3Q27IntegrateValuesHelper(grid, comm, 
+      //   g_maxX1-1.0*fdx, g_minX2, g_minX3, 
+      //   g_maxX1, g_maxX2, g_maxX3));
+      ////if(myid ==0) GbSystem3D::writeGeoObject(h2->getBoundingBox().get(),pathname + "/geo/iv2", WbWriterVtkXmlBinary::getInstance());
+      //LBMReal rhoReal = rhoLB;
+      //LBMReal uReal = uLB; 
+      //D3Q27PressureDifferencePostprocessor rhopp(grid, stepSch, pathname + "/results/rho_diff.txt", h1, h2, rhoReal, uReal, uLB, comm);
+
+      //UbSchedulerPtr resSch(new UbScheduler(1000,10000,10000));
+      //UbSchedulerPtr visSch(new UbScheduler(1,0,1));         
+      //AverageValuesPostprocessor TBLpp(grid, pathname + "/results/AvVelocity", WbWriterVtkXmlBinary::getInstance(), visSch, resSch, comm); 
+
+
+      double endTime = UbSystem::stringTo<double>(cf.getValue("endTime"));;//10001.0;
+
+      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, stepSch));
+      if(myid == 0) UBLOG(logINFO,"Simulation-start");
+      calculation->calculate();
+      if(myid == 0) UBLOG(logINFO,"Simulation-end");
+      //
+      //double point1[3] = {0.45, 0.20, 0.205};
+      //double point2[3] = {0.55, 0.20, 0.205};
+      //D3Q27IntegrateValuesHelperPtr h1(new D3Q27IntegrateValuesHelper(grid, comm, 
+      //   point1[0]-1.0*fdx, point1[1]-1.0*fdx, point1[2]-1.0*fdx, 
+      //   point1[0], point1[1], point1[2]));
+      //if(myid ==0) GbSystem3D::writeGeoObject(h1->getBoundingBox().get(),pathname + "/geo/iv1", WbWriterVtkXmlBinary::getInstance());
+      //D3Q27IntegrateValuesHelperPtr h2(new D3Q27IntegrateValuesHelper(grid, comm, 
+      //   point2[0], point2[1]-1.0*fdx, point2[2]-1.0*fdx, 
+      //   point2[0]+1.0*fdx, point2[1], point2[2]));
+      //if(myid ==0) GbSystem3D::writeGeoObject(h2->getBoundingBox().get(),pathname + "/geo/iv2", WbWriterVtkXmlBinary::getInstance());
+      ////D3Q27PressureDifferencePostprocessor rhopp(grid, visSch, pathname + "/results/rho_diff.txt", h1, h2, conv, comm);
+      //D3Q27PressureDifferencePostprocessor rhopp(grid, visSch, pathname + "/results/rho_diff.txt", h1, h2, rhoReal, uReal, uLB, comm);
+      //
+      //double area = 2.0*radius*H;
+      //double v    = 4.0*uLB/9.0;
+      //D3Q27ForcesPostprocessor fp(grid, visSch, pathname + "/results/forces.txt", comm, rhoLB, v, area, D3Q27ForcesPostprocessor::X, D3Q27ForcesPostprocessor::Y);
+      //fp.addInteractor(cylinderInt);
+      //
+      //UbSchedulerPtr nupsSch(new UbScheduler(10, 10, 40));
+      //NUPSCounterPostprocessor npr(grid, nupsSch, pathname + "/results/nups.txt", comm);
+
+      //double endTime = 40001.0;
+      //CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, visSch));
+      //if(myid == 0) UBLOG(logINFO,"Simulation-start");
+      //calculation->calculate();
+      //if(myid == 0) UBLOG(logINFO,"Simulation-end");
+   }
+   catch(std::exception& e)
+   {
+      cerr << e.what() << endl << flush;
+   }
+   catch(std::string& s)
+   {
+      cerr << s << endl;
+   }
+   catch(...)
+   {
+      cerr << "unknown exception" << endl;
+   }
+
+}
+int main(int argc, char* argv[])
+{
+   if ( argv != NULL )
+   {
+      if (argc > 1)
+      {
+         run(argv[1], argv[2]);
+      }
+      else
+      {
+         cout << "Configuration file must be set!: " <<  argv[0] << " <config file>" << endl << std::flush;
+      }
+   }
+
+   return 0;
+ 
+}
+
+
+
+
diff --git a/apps/cpu/pChannel/CMakeLists.txt b/apps/cpu/pChannel/CMakeLists.txt
index 84eb9e9c25213997fdd43726549d99e442b7436f..e02916661b2575e68bed2b1a7e3c9566b46cb075 100644
--- a/apps/cpu/pChannel/CMakeLists.txt
+++ b/apps/cpu/pChannel/CMakeLists.txt
@@ -1,5 +1,5 @@
-PROJECT(PChannel)
-
-INCLUDE(${APPS_ROOT}/IncludsList.cmake) 
-
-vf_add_library(BUILDTYPE binary DEPENDS VirtualFluidsCore VirtualFluidsBasic FILES pChannel.cpp)
+PROJECT(PChannel)
+
+INCLUDE(${APPS_ROOT}/IncludsList.cmake) 
+
+vf_add_library(BUILDTYPE binary DEPENDS VirtualFluidsCore VirtualFluidsBasic FILES pChannel.cpp)
diff --git a/apps/cpu/pChannel/configBombadilpChannel.cfg b/apps/cpu/pChannel/configBombadilpChannel.cfg
index b71aea0f6299dcd0c12bcb2c1d181771a892c895..bdf03526079117aa448ab01cf92a990ce2c4f7c7 100644
--- a/apps/cpu/pChannel/configBombadilpChannel.cfg
+++ b/apps/cpu/pChannel/configBombadilpChannel.cfg
@@ -1,107 +1,107 @@
-#
-#Simulation parameters for porous channel
-#
-
-pathOut = d:/temp/ChannelFlow
-pathGeo = d:/Projects/SFB880/GeometrienPoroeseMedien/isotrop/PA80-110
-numOfThreads = 4
-availMem = 14e9
-logToFile = false
-
-#porous media
-#rawFile = false
-sampleFilename = PA80-110_275x267x254_1mm.vti  
-#sampleFilename = PA80-110_1096x1062x254_4x4x1mm.vti
-#sampleFilename = PA80-110_1096x1327x303.vti  
-#writeSample = true
-
-rawFile = false
-#sampleFilename = PA80-110_1096x1327x1265.raw
-#sampleFilename = PA80-110_1096x1327x423.vti
-#sampleFilename = PA80-110_1096x1327x216.vti  
-#sampleFilename = PA80-110_1096x1327x303.vti  
-writeSample = false
-
-#diminsions [voxel]
-pmNX = 275 267 254
-#pmNX = 1096  1327  1265
-#pmNX = 1096 1327 216
-#pmNX = 1096 1062 254
-
-#threshold
-lthreshold = 29041
-uthreshold = 65535
-
-#deltas
-voxelDeltaX = 3.6496350365e-6 3.76789751319e-6 3.95256916996e-6
-
-#diminsions [m]
-#pmL = 7.299270073e-4 7.53579502638e-4 7.90513833992e-4
-
-#grid
-# deltax = 0.0000144
-# blocknx = 32 20 20
-
-#diminsions [m]
-#pmL = 4e-3 5e-3 5e-3
-#pmL = 4e-3 5e-3 1.67e-3
-#pmL = 4e-3 5e-3 0.85e-3
-
-#letzte
-#pmL = 4e-3 5e-3 1.19e-3
-
-#pmL = 4e-3 0.5e-3 1e-3
-
-pmL = 1e-3 1e-3 1e-3
-#pmL = 4e-3 4e-3 1e-3
-
-#grid
-refineLevel = 0
-#deltaXfine  = 10e-6
-
-
-#deltaXfine  = 20e-6
-deltaXfine  = 80e-6 #level 2
-
-
-
-blocknx = 10 10 10
-
-thinWall = false
-changeQs = false
-
-#channelHigh = 0.002
-
-#DLR-F15
-#channelHigh = 0.017
-channelHigh = 0.008
-#NACA 0012
-#channelHigh = 0.008
-
-#channelHigh = 0.005
-
-boundingBox = 0 0 0 0.024 0.008 0.009 
- 
-#physic
-# for DLRF-15 Re = 102000/2
-Re = 25000
-#real velocity is 54.95 m/s
-u_LB = 0.1
-
-newStart = true
-restartStep = 230000
-
-cpStep = 100
-cpStart = 100
-
-averaging = false
-averagingReset = false
-timeAvStart = 21000000
-timeAvStop = 2100010000
-
-outTime = 100
-endTime = 230000
-
- 
-nupsStep = 10 10 10000000 
-
+#
+#Simulation parameters for porous channel
+#
+
+pathOut = d:/temp/ChannelFlow
+pathGeo = d:/Projects/SFB880/GeometrienPoroeseMedien/isotrop/PA80-110
+numOfThreads = 4
+availMem = 14e9
+logToFile = false
+
+#porous media
+#rawFile = false
+sampleFilename = PA80-110_275x267x254_1mm.vti  
+#sampleFilename = PA80-110_1096x1062x254_4x4x1mm.vti
+#sampleFilename = PA80-110_1096x1327x303.vti  
+#writeSample = true
+
+rawFile = false
+#sampleFilename = PA80-110_1096x1327x1265.raw
+#sampleFilename = PA80-110_1096x1327x423.vti
+#sampleFilename = PA80-110_1096x1327x216.vti  
+#sampleFilename = PA80-110_1096x1327x303.vti  
+writeSample = false
+
+#diminsions [voxel]
+pmNX = 275 267 254
+#pmNX = 1096  1327  1265
+#pmNX = 1096 1327 216
+#pmNX = 1096 1062 254
+
+#threshold
+lthreshold = 29041
+uthreshold = 65535
+
+#deltas
+voxelDeltaX = 3.6496350365e-6 3.76789751319e-6 3.95256916996e-6
+
+#diminsions [m]
+#pmL = 7.299270073e-4 7.53579502638e-4 7.90513833992e-4
+
+#grid
+# deltax = 0.0000144
+# blocknx = 32 20 20
+
+#diminsions [m]
+#pmL = 4e-3 5e-3 5e-3
+#pmL = 4e-3 5e-3 1.67e-3
+#pmL = 4e-3 5e-3 0.85e-3
+
+#letzte
+#pmL = 4e-3 5e-3 1.19e-3
+
+#pmL = 4e-3 0.5e-3 1e-3
+
+pmL = 1e-3 1e-3 1e-3
+#pmL = 4e-3 4e-3 1e-3
+
+#grid
+refineLevel = 0
+#deltaXfine  = 10e-6
+
+
+#deltaXfine  = 20e-6
+deltaXfine  = 80e-6 #level 2
+
+
+
+blocknx = 10 10 10
+
+thinWall = false
+changeQs = false
+
+#channelHigh = 0.002
+
+#DLR-F15
+#channelHigh = 0.017
+channelHigh = 0.008
+#NACA 0012
+#channelHigh = 0.008
+
+#channelHigh = 0.005
+
+boundingBox = 0 0 0 0.024 0.008 0.009 
+ 
+#physic
+# for DLRF-15 Re = 102000/2
+Re = 25000
+#real velocity is 54.95 m/s
+u_LB = 0.1
+
+newStart = true
+restartStep = 230000
+
+cpStep = 100
+cpStart = 100
+
+averaging = false
+averagingReset = false
+timeAvStart = 21000000
+timeAvStop = 2100010000
+
+outTime = 100
+endTime = 230000
+
+ 
+nupsStep = 10 10 10000000 
+
diff --git a/apps/cpu/pChannel/configHLRNpChannel.cfg b/apps/cpu/pChannel/configHLRNpChannel.cfg
index 03bcfb431c60b491c7ccf2c8da2dfd1536c3c4da..f7e90bceedaba9a756f14fba62bf15db29fbbfa4 100644
--- a/apps/cpu/pChannel/configHLRNpChannel.cfg
+++ b/apps/cpu/pChannel/configHLRNpChannel.cfg
@@ -1,54 +1,54 @@
-#
-#Simulation parameters for porous channel
-#
-
-pathname = /gfs2/work/niikonst/scratch/pChannel2
-pathGeo = /gfs1/work/niikonst/data/materials
-numOfThreads = 24
-availMem = 128e9
-logToFile = true
-
-#porous media
-rawFile = false
-#sampleFilename = /PA80-110_1096x1327x1265.raw  
-sampleFilename = PA80-110_1096x1327x303.vti  
-writeSample = false
-
-#diminsions [voxel]
-#pmNX = 1096  1327  1265
-pmNX = 1096  1327  303
-
-#threshold
-lthreshold = 29041
-uthreshold = 65535
-
-#deltas
-voxelDeltaX = 3.6496350365e-6 3.76789751319e-6 3.95256916996e-6
-
-#diminsions [m]
-#pmL = 4e-3 5e-3 5e-3
-pmL = 4e-3 5e-3 1.19e-3
-
-#grid
-refineLevel = 2
-deltaXfine = 8.0e-6
-blocknx = 32 40 20
-lengthFactor = 2
-thinWall = true
-
-#DLR-F15
-channelHigh = 0.017
-
-#physic
-# for DLRF-15 Re = 102000/2
-Re = 51000
-#real velocity is 54.95 m/s
-u_LB = 0.1
-
-restartStep = 10000
-restartStepStart=10000
-
-endTime = 80000
-outTime = 10000
-
-nupsStep = 1000 1000 10000000
+#
+#Simulation parameters for porous channel
+#
+
+pathname = /gfs2/work/niikonst/scratch/pChannel2
+pathGeo = /gfs1/work/niikonst/data/materials
+numOfThreads = 24
+availMem = 128e9
+logToFile = true
+
+#porous media
+rawFile = false
+#sampleFilename = /PA80-110_1096x1327x1265.raw  
+sampleFilename = PA80-110_1096x1327x303.vti  
+writeSample = false
+
+#diminsions [voxel]
+#pmNX = 1096  1327  1265
+pmNX = 1096  1327  303
+
+#threshold
+lthreshold = 29041
+uthreshold = 65535
+
+#deltas
+voxelDeltaX = 3.6496350365e-6 3.76789751319e-6 3.95256916996e-6
+
+#diminsions [m]
+#pmL = 4e-3 5e-3 5e-3
+pmL = 4e-3 5e-3 1.19e-3
+
+#grid
+refineLevel = 2
+deltaXfine = 8.0e-6
+blocknx = 32 40 20
+lengthFactor = 2
+thinWall = true
+
+#DLR-F15
+channelHigh = 0.017
+
+#physic
+# for DLRF-15 Re = 102000/2
+Re = 51000
+#real velocity is 54.95 m/s
+u_LB = 0.1
+
+restartStep = 10000
+restartStepStart=10000
+
+endTime = 80000
+outTime = 10000
+
+nupsStep = 1000 1000 10000000
diff --git a/apps/cpu/pChannel/configLudwigpChannel.cfg b/apps/cpu/pChannel/configLudwigpChannel.cfg
index 784c4a65cdf3e6c790aa989bfbc4f405292016b8..5500f300967d860ec6ab193d1d0b3dcbeccdfc5e 100644
--- a/apps/cpu/pChannel/configLudwigpChannel.cfg
+++ b/apps/cpu/pChannel/configLudwigpChannel.cfg
@@ -1,53 +1,53 @@
-#
-#Simulation parameters for porous channel
-#
-
-pathname = /hpc3lustre/work/koskuche/SFB880/pChannel
-pathGeo = /hpc3lustre/work/koskuche/SFB880/Materials/PA80-110
-numOfThreads = 8
-availMem = 11e9
-logToFile = true
-
-#porous media
-rawFile = false
-#sampleFilename = /PA80-110_1096x1327x1265.raw  
-sampleFilename = PA80-110_1096x1327x303.vti  
-writeSample = false
-
-#diminsions [voxel]
-#pmNX = 1096  1327  1265
-pmNX = 1096  1327  303
-
-#threshold
-lthreshold = 29041
-uthreshold = 65535
-
-#deltas
-voxelDeltaX = 3.6496350365e-6 3.76789751319e-6 3.95256916996e-6
-
-#diminsions [m]
-#pmL = 4e-3 5e-3 5e-3
-pmL = 4e-3 5e-3 1.19e-3
-
-#grid
-refineLevel = 2
-deltaXfine = 8.0e-6
-blocknx = 32 40 20
-lengthFactor = 2
-thinWall = true
-
-#DLR-F15
-channelHigh = 0.017
-
-#physic
-# for DLRF-15 Re = 102000/2
-Re = 51000
-#real velocity is 54.95 m/s
-u_LB = 0.1
-
-restartStep = 10000
-restartStepStart=10000
-
-endTime = 80000
-outTime = 10000
-
+#
+#Simulation parameters for porous channel
+#
+
+pathname = /hpc3lustre/work/koskuche/SFB880/pChannel
+pathGeo = /hpc3lustre/work/koskuche/SFB880/Materials/PA80-110
+numOfThreads = 8
+availMem = 11e9
+logToFile = true
+
+#porous media
+rawFile = false
+#sampleFilename = /PA80-110_1096x1327x1265.raw  
+sampleFilename = PA80-110_1096x1327x303.vti  
+writeSample = false
+
+#diminsions [voxel]
+#pmNX = 1096  1327  1265
+pmNX = 1096  1327  303
+
+#threshold
+lthreshold = 29041
+uthreshold = 65535
+
+#deltas
+voxelDeltaX = 3.6496350365e-6 3.76789751319e-6 3.95256916996e-6
+
+#diminsions [m]
+#pmL = 4e-3 5e-3 5e-3
+pmL = 4e-3 5e-3 1.19e-3
+
+#grid
+refineLevel = 2
+deltaXfine = 8.0e-6
+blocknx = 32 40 20
+lengthFactor = 2
+thinWall = true
+
+#DLR-F15
+channelHigh = 0.017
+
+#physic
+# for DLRF-15 Re = 102000/2
+Re = 51000
+#real velocity is 54.95 m/s
+u_LB = 0.1
+
+restartStep = 10000
+restartStepStart=10000
+
+endTime = 80000
+outTime = 10000
+
diff --git a/apps/cpu/pChannel/pChannel.cpp b/apps/cpu/pChannel/pChannel.cpp
index b7fb0b443c5cfbfb186300962258ece238b4feb7..85a34a51cd3712a679e380bbd014cfeeefb6e74d 100644
--- a/apps/cpu/pChannel/pChannel.cpp
+++ b/apps/cpu/pChannel/pChannel.cpp
@@ -1,706 +1,706 @@
-#include <iostream>
-#include <string>
-#include "VirtualFluids.h"
-#include <omp.h>
-double rangeRandom(double M, double N)
-{
-   return M + (rand() / (RAND_MAX / (N - M)));
-}
-
-double rangeRandom1()
-{
-   return (2.0*rand())/RAND_MAX - 1.0;
-}
-
-//double rangeRandom(double M, double N)
-//{
-//   return rand() % (int)N+(int)M;
-//}
-
-
-
-//#include <thread>
-
-using namespace std;
-
-std::vector<int> x1Nbr;
-std::vector<int> x2Nbr;
-std::vector<int> x3Nbr;
-
-std::vector<int> x1NbrTemp;
-std::vector<int> x2NbrTemp;
-std::vector<int> x3NbrTemp;
-
-//void findSolidNeighbor(SPtr<GbVoxelMatrix3D> voxelMatrix, int x1, int x2, int x3)
-//{
-//   for (int k3 = -1; k3<=1; k3++)
-//   {
-//      for (int k2 = -1; k2<=1; k2++)
-//      {
-//         for (int k1 = -1; k1<=1; k1++)
-//         {
-//            int j1 = x1+k1;
-//            int j2 = x2+k2;
-//            int j3 = x3+k3;
-//            if (j1>=0&&j1<nodesX1 && j2>=0&&j2<nodesX2 && j3>=0&&j3<nodesX3)
-//            {
-//               if ((*voxelMatrix)(j1, j2, j3)==GbVoxelMatrix3D::FLUID)
-//               {
-//                  if (flagMatrix(j1, j2, j3)==0)
-//                  {
-//                     voxelMatrixTemp(j1, j2, j3) = GbVoxelMatrix3D::SOLID;
-//                     flagMatrix(j1, j2, j3) = 1;
-//                     x1NbrTemp.push_back(j1);
-//                     x2NbrTemp.push_back(j2);
-//                     x3NbrTemp.push_back(j3);
-//                  }
-//               }
-//            }
-//         }
-//      }
-//   }
-//}
-
-void changePorosity(SPtr<GbVoxelMatrix3D> sample, vector<int> pmNX)
-{
-   int minX1 = 0;
-   int minX2 = 0;
-   int minX3 = 0;
-   int maxX1 = pmNX[0];
-   int maxX2 = pmNX[1];
-   int maxX3 = pmNX[2];
-   sample->calculateNumberOfSolidAndFluid();
-   double nSolid = sample->getNumberOfSolid();
-   double nFluid = sample->getNumberOfFluid();
-   double porosityStart = nFluid/(nSolid+nFluid);
-   double porosityEnd = 0.5;
-   double porosityStep = (porosityEnd-porosityStart)/(double)maxX3;
-   double totallSliceVoxel = maxX1*maxX2;
-   vector<int> fluidThreshold;
-
-   SPtr<GbVoxelMatrix3D> sampleTemp = SPtr<GbVoxelMatrix3D>(sample->clone());
-
-   int count=1;
-
-   for (int ix3=minX3; ix3<maxX3; ix3++)
-   {
-      int cFluid = 0;
-      for (int ix2=minX2; ix2<maxX2; ix2++)
-      {
-         for (int ix1=minX1; ix1<maxX1; ix1++)
-         {
-            if ((*sample)(ix1, ix2, ix3) == GbVoxelMatrix3D::FLUID)
-            {
-               cFluid++;
-            }
-         }
-      }
-      double slicePorosity = (double)cFluid/totallSliceVoxel;
-      double porosityPercent = (porosityStep*(double)count)/slicePorosity;
-      fluidThreshold.push_back((totallSliceVoxel-(double)cFluid)*porosityPercent);
-      count++;
-   }
-   int solidCount = 0;
-   count=0;
-
-   for (int ix3=minX3; ix3<maxX3; ix3++)
-   {
-      //while (fluidThreshold[count] > 0)
-      //{
-     // int fTh = fluidThreshold[count];
-
-         int solidCount = 0;
-         for (int ix2=minX2; ix2<maxX2; ix2++)
-         {
-            for (int ix1=minX1; ix1<maxX1; ix1++)
-            {
-               if ((*sample)(ix1, ix2, ix3) == GbVoxelMatrix3D::SOLID)
-               {
-                  bool flagSolid = true;
-                  for (int k3 = -1; k3<=1; k3++)
-                  {
-                     for (int k2 = -1; k2<=1; k2++)
-                     {
-                        for (int k1 = -1; k1<=1; k1++)
-                        {
-                           int j1 = ix1+k1;
-                           int j2 = ix2+k2;
-                           int j3 = ix3;//+k3;
-                           if (j1>=0&&j1<maxX1 && j2>=0&&j2<maxX2 && j3>=0&&j3<maxX3)
-                           {
-                              if ((*sample)(j1, j2, j3) == GbVoxelMatrix3D::FLUID)
-                              {
-                                 flagSolid = flagSolid && false;
-                              }
-                           }
-                        }
-                     }
-                  }
-                  if (!flagSolid)
-                  {
-                     (*sample)(ix1, ix2, ix3)=GbVoxelMatrix3D::FLUID;
-                      fluidThreshold[count]--;
-                     solidCount++;
-                  }
-                  if ( fluidThreshold[count] == 0)
-                  {
-                     ix1=maxX1;
-                     ix2=maxX2;
-                  }
-               }
-            }
-         }
-         UBLOG(logINFO, "count = " << count);
-         UBLOG(logINFO, "fTh = " <<  fluidThreshold[count]);
-         UBLOG(logINFO, "solidCount = " << solidCount);
-         //sample = sampleTemp;
-         //sampleTemp = SPtr<GbVoxelMatrix3D>(sample->clone());
-         
-        count++;     
-      
-       }
-      
-   //}
-   //sampleTemp->writeToLegacyVTKBinary("d:/temp/ChannelFlow/geo/sampleTemp.vtk");
-}
-
-//////////////////////////////////////////////////////////////////////////
-void run(string configname)
-{
-   try
-   {
-      ConfigurationFile   config;
-      config.load(configname);
-
-      string          pathOut           = config.getValue<string>("pathOut");
-      string          pathGeo           = config.getValue<string>("pathGeo");
-      int             numOfThreads      = config.getValue<int>("numOfThreads");
-      string          sampleFilename    = config.getValue<string>("sampleFilename");
-      vector<int>     pmNX              = config.getVector<int>("pmNX");
-      double          lthreshold        = config.getValue<double>("lthreshold");
-      double          uthreshold        = config.getValue<double>("uthreshold");
-      vector<float>   voxelDeltaX       = config.getVector<float>("voxelDeltaX");
-      vector<int>     blocknx           = config.getVector<int>("blocknx");
-      double          u_LB              = config.getValue<double>("u_LB");
-      double          restartStep       = config.getValue<double>("restartStep");
-      double          cpStep            = config.getValue<double>("cpStep");
-      double          cpStart           = config.getValue<double>("cpStart");
-      double          endTime           = config.getValue<double>("endTime");
-      double          outTime           = config.getValue<double>("outTime");
-      double          availMem          = config.getValue<double>("availMem");
-      bool            rawFile           = config.getValue<bool>("rawFile");
-      bool            logToFile         = config.getValue<bool>("logToFile");
-      bool            writeSample       = config.getValue<bool>("writeSample");
-      vector<double>  pmL               = config.getVector<double>("pmL");
-      double          deltaXfine        = config.getValue<double>("deltaXfine");
-      int             refineLevel       = config.getValue<int>("refineLevel");
-      bool            thinWall          = config.getValue<bool>("thinWall");
-      double          Re                = config.getValue<double>("Re");
-      double          channelHigh       = config.getValue<double>("channelHigh");
-      bool            changeQs          = config.getValue<bool>("changeQs");
-      double          timeAvStart       = config.getValue<double>("timeAvStart");
-      double          timeAvStop        = config.getValue<double>("timeAvStop");
-      bool            averaging         = config.getValue<bool>("averaging");
-      bool            averagingReset    = config.getValue<bool>("averagingReset");
-      bool            newStart          = config.getValue<bool>("newStart");
-      vector<double>  nupsStep          = config.getVector<double>("nupsStep");
-      vector<double>  boundingBox       = config.getVector<double>("boundingBox");
-
-      SPtr<Communicator> comm = MPICommunicator::getInstance();
-      int myid = comm->getProcessID();
-
-      if (logToFile)
-      {
-#if defined(__unix__)
-         if (myid == 0)
-         {
-            const char* str = pathOut.c_str();
-            mkdir(str, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
-         }
-#endif 
-
-         if (myid == 0)
-         {
-            stringstream logFilename;
-            logFilename << pathOut + "/logfile" + UbSystem::toString(UbSystem::getTimeStamp()) + ".txt";
-            UbLog::output_policy::setStream(logFilename.str());
-         }
-      }
-
-      //Sleep(30000);
-
-      if (myid == 0) UBLOG(logINFO, "Testcase porous channel");
-
-      SPtr<LBMUnitConverter> conv = SPtr<LBMUnitConverter>(new LBMUnitConverter());
-
-      const int baseLevel = 0;
-      double deltaXcoarse = deltaXfine*(double)(1<<refineLevel);
-
-      LBMReal rho_LB = 0.0;
-      double rhoReal = 1.2041; //(kg/m3)
-      double uReal = 48; //m/s
-      double lReal = 0.008;//m
-      double hLB = lReal / deltaXcoarse;
-      double Ma = 0.13;//Ma-Real!
-      double csReal = uReal / Ma;
-      LBMUnitConverter unitConverter(lReal, csReal, rhoReal, hLB);
-      if (myid==0) UBLOG(logINFO, unitConverter.toString());
-
-      //double coord[6];
-
-      vector<double> origin(3);
-      origin[0] = 0;
-      origin[1] = 0;
-      origin[2] = 0;
-
-      //real velocity is 49.63 m/s
-
-      SPtr<Grid3D> grid(new Grid3D(comm));
-
-      //BC adapters
-      SPtr<BCAdapter> noSlipBCAdapter(new NoSlipBCAdapter());
-      noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NoSlipBCAlgorithm()));
-
-      BoundaryConditionsBlockVisitor bcVisitor;
-      bcVisitor.addBC(noSlipBCAdapter);
-
-      SPtr<BCProcessor> bcProc;
-      bcProc = SPtr<BCProcessor>(new BCProcessor());
-
-      SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new IncompressibleCumulantLBMKernel());
-
-      mu::Parser fctForcingX1;
-      fctForcingX1.SetExpr("Fx1");
-      fctForcingX1.DefineConst("Fx1", 1.0e-6);
-      kernel->setWithForcing(true);
-
-      kernel->setBCProcessor(bcProc);
-
-      //////////////////////////////////////////////////////////////////////////
-      //restart
-      SPtr<UbScheduler> rSch(new UbScheduler(cpStep, cpStart));
-      SPtr<MPIIORestartCoProcessor> restartCoProcessor(new MPIIORestartCoProcessor(grid, rSch, pathOut, comm));
-      restartCoProcessor->setLBMKernel(kernel);
-      restartCoProcessor->setBCProcessor(bcProc);
-
-      SPtr<UbScheduler> mSch(new UbScheduler(cpStep, cpStart));
-      SPtr<MPIIOMigrationCoProcessor> migCoProcessor(new MPIIOMigrationCoProcessor(grid, mSch, pathOut+"/mig", comm));
-      migCoProcessor->setLBMKernel(kernel);
-      migCoProcessor->setBCProcessor(bcProc);
-      //////////////////////////////////////////////////////////////////////////
-
-      //bounding box
-      double g_minX1 = boundingBox[0];
-      double g_minX2 = boundingBox[1];
-      double g_minX3 = boundingBox[2];
-
-      double g_maxX1 = boundingBox[3];
-      double g_maxX2 = boundingBox[4];
-      double g_maxX3 = boundingBox[5];
-
-      double blockLength = (double)blocknx[0]*deltaXcoarse;
-
-      double channel_high = channelHigh; // g_maxX3-g_minX3;
-      double channel_high_LB = channel_high/deltaXcoarse;
-      //////////////////////////////////////////////////////////////////////////
-      double nu_LB = (u_LB*channel_high_LB)/Re;
-      //////////////////////////////////////////////////////////////////////////
-      if (myid == 0)
-      {
-         UBLOG(logINFO, "Parameters:");
-         UBLOG(logINFO, "Re                  = " << Re);
-         UBLOG(logINFO, "u_LB                = " << u_LB);
-         UBLOG(logINFO, "rho_LB              = " << rho_LB);
-         UBLOG(logINFO, "nu_LB               = " << nu_LB);
-         UBLOG(logINFO, "dx coarse           = " << deltaXcoarse << " m");
-         UBLOG(logINFO, "dx fine             = " << deltaXfine << " m");
-         UBLOG(logINFO, "channel_high        = " << channel_high << " m");
-         UBLOG(logINFO, "channel_high_LB     = " << channel_high_LB);
-         UBLOG(logINFO, "number of levels    = " << refineLevel + 1);
-         UBLOG(logINFO, "number of processes = " << comm->getNumberOfProcesses());
-         UBLOG(logINFO, "number of threads   = " << numOfThreads);
-         UBLOG(logINFO, "path = " << pathOut);
-         UBLOG(logINFO, "Preprocess - start");
-      }
-
-
-      if (newStart)
-      {
-         if (myid == 0) UBLOG(logINFO, "new start...");
-
-
-
-         grid->setPeriodicX1(true);
-         grid->setPeriodicX2(true);
-         grid->setPeriodicX3(false);
-         grid->setDeltaX(deltaXcoarse);
-         grid->setBlockNX(blocknx[0], blocknx[1], blocknx[2]);
-
-         SPtr<GbObject3D> gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
-         if (myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), pathOut + "/geo/gridCube", WbWriterVtkXmlBinary::getInstance());
-
-
-         GenBlocksGridVisitor genBlocks(gridCube);
-         grid->accept(genBlocks);
-
-
-         //////////////////////////////////////////////////////////////////////////
-         //refinement
-         double blockLengthX3Fine = grid->getDeltaX(refineLevel) * blocknx[2];
-         double refHight = 0.002;
-
-         GbCuboid3DPtr refineBoxTop(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_maxX3-refHight, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3));
-         if (myid == 0) GbSystem3D::writeGeoObject(refineBoxTop.get(), pathOut + "/geo/refineBoxTop", WbWriterVtkXmlASCII::getInstance());
-
-         //GbCuboid3DPtr refineBoxBottom(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3, g_maxX1+blockLength, g_maxX2+blockLength, g_minX3+offsetMinX3+blockLengthX3Fine));
-         GbCuboid3DPtr refineBoxBottom(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3, g_maxX1+blockLength, g_maxX2+blockLength, g_minX3+refHight));
-         if (myid == 0) GbSystem3D::writeGeoObject(refineBoxBottom.get(), pathOut + "/geo/refineBoxBottom", WbWriterVtkXmlASCII::getInstance());
-
-         if (refineLevel > 0)
-         {
-            if (myid == 0) UBLOG(logINFO, "Refinement - start");
-            RefineCrossAndInsideGbObjectHelper refineHelper(grid, refineLevel, comm);
-            refineHelper.addGbObject(refineBoxTop, refineLevel);
-            refineHelper.addGbObject(refineBoxBottom, refineLevel);
-            refineHelper.refine();
-            if (myid == 0) UBLOG(logINFO, "Refinement - end");
-         }
-         //////////////////////////////////////////////////////////////////////////
-
-         //walls
-         GbCuboid3DPtr addWallZmin(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_minX3));
-         if (myid == 0) GbSystem3D::writeGeoObject(addWallZmin.get(), pathOut+"/geo/addWallZmin", WbWriterVtkXmlASCII::getInstance());
-
-         GbCuboid3DPtr addWallZmax(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_maxX3, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength));
-         if (myid == 0) GbSystem3D::writeGeoObject(addWallZmax.get(), pathOut+"/geo/addWallZmax", WbWriterVtkXmlASCII::getInstance());
-
-
-         //wall interactors
-         SPtr<D3Q27Interactor> addWallZminInt(new D3Q27Interactor(addWallZmin, grid, noSlipBCAdapter, Interactor3D::SOLID));
-         SPtr<D3Q27Interactor> addWallZmaxInt(new D3Q27Interactor(addWallZmax, grid, noSlipBCAdapter, Interactor3D::SOLID));
-
-         ////////////////////////////////////////////
-         //METIS
-         SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::BSW, MetisPartitioner::KWAY));
-         ////////////////////////////////////////////
-         if (myid == 0) UBLOG(logINFO, "deleteSolidBlocks - start");
-         InteractorsHelper intHelper(grid, metisVisitor);
-         intHelper.addInteractor(addWallZminInt);
-         intHelper.addInteractor(addWallZmaxInt);
-         intHelper.selectBlocks();
-         if (myid == 0) UBLOG(logINFO, "deleteSolidBlocks - end");
-         //////////////////////////////////////
-
-         {
-            WriteBlocksCoProcessor ppblocks(grid, SPtr<UbScheduler>(new UbScheduler(1)), pathOut, WbWriterVtkXmlBinary::getInstance(), comm);
-            ppblocks.process(0);
-         }
-
-         unsigned long long numberOfBlocks = (unsigned long long)grid->getNumberOfBlocks();
-         int ghostLayer = 3;
-         unsigned long long numberOfNodesPerBlock = (unsigned long long)(blocknx[0])* (unsigned long long)(blocknx[1])* (unsigned long long)(blocknx[2]);
-         unsigned long long numberOfNodes = numberOfBlocks * numberOfNodesPerBlock;
-         unsigned long long numberOfNodesPerBlockWithGhostLayer = numberOfBlocks * (blocknx[0] + ghostLayer) * (blocknx[1] + ghostLayer) * (blocknx[2] + ghostLayer);
-         double needMemAll = double(numberOfNodesPerBlockWithGhostLayer*(27 * sizeof(double) + sizeof(int) + sizeof(float) * 4));
-         double needMem = needMemAll / double(comm->getNumberOfProcesses());
-
-         if (myid == 0)
-         {
-            UBLOG(logINFO, "Number of blocks = " << numberOfBlocks);
-            UBLOG(logINFO, "Number of nodes  = " << numberOfNodes);
-            int minInitLevel = grid->getCoarsestInitializedLevel();
-            int maxInitLevel = grid->getFinestInitializedLevel();
-            for (int level = minInitLevel; level <= maxInitLevel; level++)
-            {
-               int nobl = grid->getNumberOfBlocks(level);
-               UBLOG(logINFO, "Number of blocks for level " << level << " = " << nobl);
-               UBLOG(logINFO, "Number of nodes for level " << level << " = " << nobl*numberOfNodesPerBlock);
-            }
-            UBLOG(logINFO, "Necessary memory  = " << needMemAll << " bytes");
-            UBLOG(logINFO, "Necessary memory per process = " << needMem << " bytes");
-            UBLOG(logINFO, "Available memory per process = " << availMem << " bytes");
-         }
-
-
-         SetKernelBlockVisitor kernelVisitor(kernel, nu_LB, availMem, needMem);
-         grid->accept(kernelVisitor);
-
-         //////////////////////////////////
-         //undef nodes for refinement
-         if (refineLevel > 0)
-         {
-            SetUndefinedNodesBlockVisitor undefNodesVisitor;
-            grid->accept(undefNodesVisitor);
-         }
-
-
-         //BC
-         intHelper.setBC();
-
-         ////porous media
-         if (true)
-         {
-            string samplePathname = pathGeo + "/" + sampleFilename;
-
-            SPtr<GbVoxelMatrix3D> sample(new GbVoxelMatrix3D(pmNX[0], pmNX[1], pmNX[2], 0, lthreshold, uthreshold));
-            if (rawFile)
-            {
-               sample->readBufferedMatrixFromRawFile<unsigned short>(samplePathname, GbVoxelMatrix3D::BigEndian);
-            }
-            else
-            {
-               sample->readMatrixFromVtiASCIIFile(samplePathname);
-            }
-
-            sample->setVoxelMatrixDelta(voxelDeltaX[0], voxelDeltaX[1], voxelDeltaX[2]);
-            sample->setVoxelMatrixMininum(origin[0], origin[1], origin[2]);
-
-            changePorosity(sample, pmNX);
-
-            sample->writeToLegacyVTKBinary(pathOut+"/geo/sample.vtk");
-            return;
-
-            int bounceBackOption = 1;
-            bool vxFile = false;
-            int i = 0;
-            //for (int x = 0; x < lengthFactor; x+=2)
-            int lenX = (int)((g_maxX1-g_minX1)/(pmL[0]));
-            int lenY = (int)((g_maxX2-g_minX2)/(pmL[1]));
-
-            for (int y = 0; y < lenY; y+=2)
-               for (int x = 0; x < lenX; x+=2)
-               {
-                  double offsetX = pmL[0] * (double)x;
-                  double offsetY = pmL[1] * (double)y;
-                  //sample 0
-                  if (myid == 0) UBLOG(logINFO, "sample # " << i);
-                  sample->setVoxelMatrixMininum(origin[0]+offsetX, origin[1]+offsetY, origin[2]);
-                  Utilities::voxelMatrixDiscretisation(sample, pathOut, myid, i, grid, bounceBackOption, vxFile);
-                  i++;
-
-                  if (myid == 0)
-                  {
-                     UBLOG(logINFO, "PID = " << myid << " Total Physical Memory (RAM): " << Utilities::getTotalPhysMem()/1073741824.0<<" GB");
-                     UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used: " << Utilities::getPhysMemUsed()/1073741824.0<<" GB");
-                     UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB");
-                  }
-
-                  //sample 1
-                  if (myid == 0) UBLOG(logINFO, "sample # " << i);
-                  sample->setVoxelMatrixMininum(origin[0]+pmL[0]+offsetX, origin[1]+offsetY, origin[2]);
-                  sample->mirrorX();
-                  Utilities::voxelMatrixDiscretisation(sample, pathOut, myid, i, grid, bounceBackOption, vxFile);
-                  i++;
-
-                  if (myid == 0)
-                  {
-                     UBLOG(logINFO, "PID = " << myid << " Total Physical Memory (RAM): " << Utilities::getTotalPhysMem()/1073741824.0<<" GB");
-                     UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used: " << Utilities::getPhysMemUsed()/1073741824.0<<" GB");
-                     UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB");
-                  }
-
-                  //sample 2
-                  if (myid == 0) UBLOG(logINFO, "sample # " << i);
-                  sample->setVoxelMatrixMininum(origin[0]+pmL[0]+offsetX, origin[1]+pmL[1]+offsetY, origin[2]);
-                  sample->mirrorY();
-                  Utilities::voxelMatrixDiscretisation(sample, pathOut, myid, i, grid, bounceBackOption, vxFile);
-                  i++;
-
-                  if (myid == 0)
-                  {
-                     UBLOG(logINFO, "PID = " << myid << " Total Physical Memory (RAM): " << Utilities::getTotalPhysMem()/1073741824.0<<" GB");
-                     UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used: " << Utilities::getPhysMemUsed()/1073741824.0<<" GB");
-                     UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe());
-                  }
-
-                  //sample 3
-                  if (myid == 0) UBLOG(logINFO, "sample # " << i);
-                  sample->setVoxelMatrixMininum(origin[0]+offsetX, origin[1]+pmL[1]+offsetY, origin[2]);
-                  sample->mirrorX();
-                  Utilities::voxelMatrixDiscretisation(sample, pathOut, myid, i, grid, bounceBackOption, vxFile);
-                  sample->mirrorY();
-                  i++;
-               }
-
-         }
-
-         grid->accept(bcVisitor);
-
-         mu::Parser inflowProfileVx1, inflowProfileVx2, inflowProfileVx3, inflowProfileRho;
-         inflowProfileVx1.SetExpr("x3 < h ? 0.0 : uLB+1*x1");
-         inflowProfileVx1.DefineConst("uLB", u_LB);
-         inflowProfileVx1.DefineConst("h", pmL[2]);
-
-         InitDistributionsBlockVisitor initVisitor;
-         initVisitor.setVx1(inflowProfileVx1);
-         grid->accept(initVisitor);
-
-         ////set connectors
-         InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor());
-         SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nu_LB, iProcessor);
-         grid->accept(setConnsVisitor);
-
-         //domain decomposition for threads
-         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
-         grid->accept(pqPartVisitor);
-
-         //Postrozess
-         {
-            SPtr<UbScheduler> geoSch(new UbScheduler(1));
-            WriteBoundaryConditionsCoProcessor ppgeo(grid, geoSch, pathOut, WbWriterVtkXmlBinary::getInstance(), comm);
-            ppgeo.process(0);
-         }
-
-         if (myid == 0) UBLOG(logINFO, "Preprozess - end");
-      }
-      else
-      {
-         //restartCoProcessor->restart((int)restartStep);
-         migCoProcessor->restart((int)restartStep);
-         grid->setTimeStep(restartStep);
-         ////////////////////////////////////////////////////////////////////////////
-         InterpolationProcessorPtr iProcessor(new CompressibleOffsetInterpolationProcessor());
-         SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nu_LB, iProcessor);
-         grid->accept(setConnsVisitor);
-
-         grid->accept(bcVisitor);
-
-         if (myid == 0) UBLOG(logINFO, "Restart - end");
-      }
-
-      SPtr<UbScheduler> nupsSch(new UbScheduler(nupsStep[0], nupsStep[1], nupsStep[2]));
-      std::shared_ptr<NUPSCounterCoProcessor> nupsCoProcessor(new NUPSCounterCoProcessor(grid, nupsSch, numOfThreads, comm));
-
-      SPtr<UbScheduler> stepSch(new UbScheduler(outTime));
-
-      SPtr<WriteMacroscopicQuantitiesCoProcessor> writeMQCoProcessor(new WriteMacroscopicQuantitiesCoProcessor(grid, stepSch, pathOut, WbWriterVtkXmlBinary::getInstance(), conv, comm));
-
-      SPtr<GbObject3D> bbBox(new GbCuboid3D(g_minX1-blockLength, (g_maxX2-g_minX2)/2.0, g_minX3-blockLength, g_maxX1+blockLength, (g_maxX2-g_minX2)/2.0+deltaXcoarse, g_maxX3+blockLength));
-      if (myid==0) GbSystem3D::writeGeoObject(bbBox.get(), pathOut+"/geo/bbBox", WbWriterVtkXmlASCII::getInstance());
-      SPtr<WriteMQFromSelectionCoProcessor> writeMQSelectCoProcessor(new WriteMQFromSelectionCoProcessor(grid, stepSch, bbBox, pathOut, WbWriterVtkXmlBinary::getInstance(), conv, comm));
-
-
-      SPtr<UbScheduler> AdjForcSch(new UbScheduler());
-      AdjForcSch->addSchedule(10, 0, 10000000);
-      SPtr<IntegrateValuesHelper> intValHelp(new IntegrateValuesHelper(grid, comm, g_minX1, g_minX2, g_minX3+pmL[2], g_maxX1, g_maxX2, g_maxX3));
-      if (myid == 0) GbSystem3D::writeGeoObject(intValHelp->getBoundingBox().get(), pathOut + "/geo/IntValHelp", WbWriterVtkXmlBinary::getInstance());
-
-      double vxTarget=u_LB;
-      SPtr<AdjustForcingCoProcessor> AdjForcCoProcessor(new AdjustForcingCoProcessor(grid, AdjForcSch, pathOut, intValHelp, vxTarget, comm));
-
-      //mu::Parser decrViscFunc;
-      //decrViscFunc.SetExpr("nue0+c0/(t+1)/(t+1)");
-      //decrViscFunc.DefineConst("nue0", nu_LB*4.0);
-      //decrViscFunc.DefineConst("c0", 0.1);
-      //SPtr<UbScheduler> DecrViscSch(new UbScheduler());
-      //DecrViscSch->addSchedule(10, 0, 1000);
-      //DecreaseViscosityCoProcessor decrViscPPPtr(grid, DecrViscSch, &decrViscFunc, comm);
-
-     //if (changeQs)
-     //{
-       // double z1 = pmL[2];
-       // SPtr<IntegrateValuesHelper> intValHelp2(new IntegrateValuesHelper(grid, comm,
-         //  coord[0], coord[1], z1 - deltaXfine,
-         //  coord[3], coord[4], z1 + deltaXfine));
-       // if (myid == 0) GbSystem3D::writeGeoObject(intValHelp2->getBoundingBox().get(), pathOut + "/geo/intValHelp2", WbWriterVtkXmlBinary::getInstance());
-       // Utilities::ChangeRandomQs(intValHelp2);
-     //}
-
-      std::vector<double> levelCoords;
-      std::vector<int> levels;
-      std::vector<double> bounds;
-      //bounds.push_back(0);
-      //bounds.push_back(0);
-      //bounds.push_back(0);
-      //bounds.push_back(0.004);
-      //bounds.push_back(0.002);
-      //bounds.push_back(0.003);
-      //levels.push_back(1);
-      //levels.push_back(0);
-      //levels.push_back(1);
-      //levelCoords.push_back(0);
-      //levelCoords.push_back(0.0016);
-      //levelCoords.push_back(0.0024);
-      //levelCoords.push_back(0.003);
-      bounds.push_back(0);
-      bounds.push_back(0);
-      bounds.push_back(0);
-      bounds.push_back(0.004);
-      bounds.push_back(0.002);
-      bounds.push_back(0.002);
-      levels.push_back(0);
-      levelCoords.push_back(0);
-      levelCoords.push_back(0.002);
-      //SPtr<UbScheduler> tavSch(new UbScheduler(1, timeAvStart, timeAvStop));
-      //SPtr<CoProcessor> tav(new TimeAveragedValuesCoProcessor(grid, pathOut, WbWriterVtkXmlBinary::getInstance(), tavSch, comm,
-      //   TimeAveragedValuesCoProcessor::Velocity | TimeAveragedValuesCoProcessor::Fluctuations | TimeAveragedValuesCoProcessor::Triplecorrelations,
-      //   levels, levelCoords, bounds));
-
-
-      //create line time series
-      SPtr<UbScheduler> tpcSch(new UbScheduler(1, 1, 3));
-      //GbPoint3DPtr p1(new GbPoint3D(0.0,0.005,0.01));
-      //GbPoint3DPtr p2(new GbPoint3D(0.064,0.005,0.01));
-      //SPtr<GbLine3D> line(new GbLine3D(p1.get(),p2.get()));
-      SPtr<GbLine3D> line(new GbLine3D(new GbPoint3D(0.0, 0.005, 0.01), new GbPoint3D(0.064, 0.005, 0.01)));
-      LineTimeSeriesCoProcessor lineTs(grid, tpcSch, pathOut+"/TimeSeries/line1.csv", line, 0, comm);
-      if (myid==0) lineTs.writeLine(pathOut+"/geo/line1");
-
-      if (myid == 0)
-      {
-         UBLOG(logINFO, "PID = " << myid << " Total Physical Memory (RAM): " << Utilities::getTotalPhysMem());
-         UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used: " << Utilities::getPhysMemUsed());
-         UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe());
-      }
-
-      //omp_set_num_threads(numOfThreads);
-       numOfThreads = 4;
-      SPtr<UbScheduler> stepGhostLayer(new UbScheduler(1));
-      SPtr<Calculator> calculator(new BasicCalculator(grid, stepGhostLayer, (int)endTime));
-      calculator->addCoProcessor(nupsCoProcessor);
-      calculator->addCoProcessor(AdjForcCoProcessor);
-      calculator->addCoProcessor(migCoProcessor);
-      //calculator->addCoProcessor(restartCoProcessor);
-      calculator->addCoProcessor(writeMQSelectCoProcessor);
-      calculator->addCoProcessor(writeMQCoProcessor);
-
-      if (myid == 0) UBLOG(logINFO, "Simulation-start");
-      calculator->calculate();
-      if (myid == 0) UBLOG(logINFO, "Simulation-end");
-   }
-   catch (exception& e)
-   {
-      cerr << e.what() << endl << flush;
-   }
-   catch (string& s)
-   {
-      cerr << s << endl;
-   }
-   catch (mu::Parser::exception_type &e)
-   {
-      std::cout << e.GetMsg() << std::endl;
-   }
-   catch (...)
-   {
-      cerr << "unknown exception" << endl;
-   }
-
-}
-//////////////////////////////////////////////////////////////////////////
-int main(int argc, char* argv[])
-{
-
-   if (argv != NULL)
-   {
-      if (argv[1] != NULL)
-      {
-         run(string(argv[1]));
-      }
-      else
-      {
-         cout << "Configuration file is missing!" << endl;
-      }
-   }
-
-   return 0;
-}
+#include <iostream>
+#include <string>
+#include "VirtualFluids.h"
+#include <omp.h>
+double rangeRandom(double M, double N)
+{
+   return M + (rand() / (RAND_MAX / (N - M)));
+}
+
+double rangeRandom1()
+{
+   return (2.0*rand())/RAND_MAX - 1.0;
+}
+
+//double rangeRandom(double M, double N)
+//{
+//   return rand() % (int)N+(int)M;
+//}
+
+
+
+//#include <thread>
+
+using namespace std;
+
+std::vector<int> x1Nbr;
+std::vector<int> x2Nbr;
+std::vector<int> x3Nbr;
+
+std::vector<int> x1NbrTemp;
+std::vector<int> x2NbrTemp;
+std::vector<int> x3NbrTemp;
+
+//void findSolidNeighbor(SPtr<GbVoxelMatrix3D> voxelMatrix, int x1, int x2, int x3)
+//{
+//   for (int k3 = -1; k3<=1; k3++)
+//   {
+//      for (int k2 = -1; k2<=1; k2++)
+//      {
+//         for (int k1 = -1; k1<=1; k1++)
+//         {
+//            int j1 = x1+k1;
+//            int j2 = x2+k2;
+//            int j3 = x3+k3;
+//            if (j1>=0&&j1<nodesX1 && j2>=0&&j2<nodesX2 && j3>=0&&j3<nodesX3)
+//            {
+//               if ((*voxelMatrix)(j1, j2, j3)==GbVoxelMatrix3D::FLUID)
+//               {
+//                  if (flagMatrix(j1, j2, j3)==0)
+//                  {
+//                     voxelMatrixTemp(j1, j2, j3) = GbVoxelMatrix3D::SOLID;
+//                     flagMatrix(j1, j2, j3) = 1;
+//                     x1NbrTemp.push_back(j1);
+//                     x2NbrTemp.push_back(j2);
+//                     x3NbrTemp.push_back(j3);
+//                  }
+//               }
+//            }
+//         }
+//      }
+//   }
+//}
+
+void changePorosity(SPtr<GbVoxelMatrix3D> sample, vector<int> pmNX)
+{
+   int minX1 = 0;
+   int minX2 = 0;
+   int minX3 = 0;
+   int maxX1 = pmNX[0];
+   int maxX2 = pmNX[1];
+   int maxX3 = pmNX[2];
+   sample->calculateNumberOfSolidAndFluid();
+   double nSolid = sample->getNumberOfSolid();
+   double nFluid = sample->getNumberOfFluid();
+   double porosityStart = nFluid/(nSolid+nFluid);
+   double porosityEnd = 0.5;
+   double porosityStep = (porosityEnd-porosityStart)/(double)maxX3;
+   double totallSliceVoxel = maxX1*maxX2;
+   vector<int> fluidThreshold;
+
+   SPtr<GbVoxelMatrix3D> sampleTemp = SPtr<GbVoxelMatrix3D>(sample->clone());
+
+   int count=1;
+
+   for (int ix3=minX3; ix3<maxX3; ix3++)
+   {
+      int cFluid = 0;
+      for (int ix2=minX2; ix2<maxX2; ix2++)
+      {
+         for (int ix1=minX1; ix1<maxX1; ix1++)
+         {
+            if ((*sample)(ix1, ix2, ix3) == GbVoxelMatrix3D::FLUID)
+            {
+               cFluid++;
+            }
+         }
+      }
+      double slicePorosity = (double)cFluid/totallSliceVoxel;
+      double porosityPercent = (porosityStep*(double)count)/slicePorosity;
+      fluidThreshold.push_back((totallSliceVoxel-(double)cFluid)*porosityPercent);
+      count++;
+   }
+   int solidCount = 0;
+   count=0;
+
+   for (int ix3=minX3; ix3<maxX3; ix3++)
+   {
+      //while (fluidThreshold[count] > 0)
+      //{
+     // int fTh = fluidThreshold[count];
+
+         int solidCount = 0;
+         for (int ix2=minX2; ix2<maxX2; ix2++)
+         {
+            for (int ix1=minX1; ix1<maxX1; ix1++)
+            {
+               if ((*sample)(ix1, ix2, ix3) == GbVoxelMatrix3D::SOLID)
+               {
+                  bool flagSolid = true;
+                  for (int k3 = -1; k3<=1; k3++)
+                  {
+                     for (int k2 = -1; k2<=1; k2++)
+                     {
+                        for (int k1 = -1; k1<=1; k1++)
+                        {
+                           int j1 = ix1+k1;
+                           int j2 = ix2+k2;
+                           int j3 = ix3;//+k3;
+                           if (j1>=0&&j1<maxX1 && j2>=0&&j2<maxX2 && j3>=0&&j3<maxX3)
+                           {
+                              if ((*sample)(j1, j2, j3) == GbVoxelMatrix3D::FLUID)
+                              {
+                                 flagSolid = flagSolid && false;
+                              }
+                           }
+                        }
+                     }
+                  }
+                  if (!flagSolid)
+                  {
+                     (*sample)(ix1, ix2, ix3)=GbVoxelMatrix3D::FLUID;
+                      fluidThreshold[count]--;
+                     solidCount++;
+                  }
+                  if ( fluidThreshold[count] == 0)
+                  {
+                     ix1=maxX1;
+                     ix2=maxX2;
+                  }
+               }
+            }
+         }
+         UBLOG(logINFO, "count = " << count);
+         UBLOG(logINFO, "fTh = " <<  fluidThreshold[count]);
+         UBLOG(logINFO, "solidCount = " << solidCount);
+         //sample = sampleTemp;
+         //sampleTemp = SPtr<GbVoxelMatrix3D>(sample->clone());
+         
+        count++;     
+      
+       }
+      
+   //}
+   //sampleTemp->writeToLegacyVTKBinary("d:/temp/ChannelFlow/geo/sampleTemp.vtk");
+}
+
+//////////////////////////////////////////////////////////////////////////
+void run(string configname)
+{
+   try
+   {
+      ConfigurationFile   config;
+      config.load(configname);
+
+      string          pathOut           = config.getValue<string>("pathOut");
+      string          pathGeo           = config.getValue<string>("pathGeo");
+      int             numOfThreads      = config.getValue<int>("numOfThreads");
+      string          sampleFilename    = config.getValue<string>("sampleFilename");
+      vector<int>     pmNX              = config.getVector<int>("pmNX");
+      double          lthreshold        = config.getValue<double>("lthreshold");
+      double          uthreshold        = config.getValue<double>("uthreshold");
+      vector<float>   voxelDeltaX       = config.getVector<float>("voxelDeltaX");
+      vector<int>     blocknx           = config.getVector<int>("blocknx");
+      double          u_LB              = config.getValue<double>("u_LB");
+      double          restartStep       = config.getValue<double>("restartStep");
+      double          cpStep            = config.getValue<double>("cpStep");
+      double          cpStart           = config.getValue<double>("cpStart");
+      double          endTime           = config.getValue<double>("endTime");
+      double          outTime           = config.getValue<double>("outTime");
+      double          availMem          = config.getValue<double>("availMem");
+      bool            rawFile           = config.getValue<bool>("rawFile");
+      bool            logToFile         = config.getValue<bool>("logToFile");
+      bool            writeSample       = config.getValue<bool>("writeSample");
+      vector<double>  pmL               = config.getVector<double>("pmL");
+      double          deltaXfine        = config.getValue<double>("deltaXfine");
+      int             refineLevel       = config.getValue<int>("refineLevel");
+      bool            thinWall          = config.getValue<bool>("thinWall");
+      double          Re                = config.getValue<double>("Re");
+      double          channelHigh       = config.getValue<double>("channelHigh");
+      bool            changeQs          = config.getValue<bool>("changeQs");
+      double          timeAvStart       = config.getValue<double>("timeAvStart");
+      double          timeAvStop        = config.getValue<double>("timeAvStop");
+      bool            averaging         = config.getValue<bool>("averaging");
+      bool            averagingReset    = config.getValue<bool>("averagingReset");
+      bool            newStart          = config.getValue<bool>("newStart");
+      vector<double>  nupsStep          = config.getVector<double>("nupsStep");
+      vector<double>  boundingBox       = config.getVector<double>("boundingBox");
+
+      SPtr<Communicator> comm = MPICommunicator::getInstance();
+      int myid = comm->getProcessID();
+
+      if (logToFile)
+      {
+#if defined(__unix__)
+         if (myid == 0)
+         {
+            const char* str = pathOut.c_str();
+            mkdir(str, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
+         }
+#endif 
+
+         if (myid == 0)
+         {
+            stringstream logFilename;
+            logFilename << pathOut + "/logfile" + UbSystem::toString(UbSystem::getTimeStamp()) + ".txt";
+            UbLog::output_policy::setStream(logFilename.str());
+         }
+      }
+
+      //Sleep(30000);
+
+      if (myid == 0) UBLOG(logINFO, "Testcase porous channel");
+
+      SPtr<LBMUnitConverter> conv = SPtr<LBMUnitConverter>(new LBMUnitConverter());
+
+      const int baseLevel = 0;
+      double deltaXcoarse = deltaXfine*(double)(1<<refineLevel);
+
+      LBMReal rho_LB = 0.0;
+      double rhoReal = 1.2041; //(kg/m3)
+      double uReal = 48; //m/s
+      double lReal = 0.008;//m
+      double hLB = lReal / deltaXcoarse;
+      double Ma = 0.13;//Ma-Real!
+      double csReal = uReal / Ma;
+      LBMUnitConverter unitConverter(lReal, csReal, rhoReal, hLB);
+      if (myid==0) UBLOG(logINFO, unitConverter.toString());
+
+      //double coord[6];
+
+      vector<double> origin(3);
+      origin[0] = 0;
+      origin[1] = 0;
+      origin[2] = 0;
+
+      //real velocity is 49.63 m/s
+
+      SPtr<Grid3D> grid(new Grid3D(comm));
+
+      //BC adapters
+      SPtr<BCAdapter> noSlipBCAdapter(new NoSlipBCAdapter());
+      noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NoSlipBCAlgorithm()));
+
+      BoundaryConditionsBlockVisitor bcVisitor;
+      bcVisitor.addBC(noSlipBCAdapter);
+
+      SPtr<BCProcessor> bcProc;
+      bcProc = SPtr<BCProcessor>(new BCProcessor());
+
+      SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new IncompressibleCumulantLBMKernel());
+
+      mu::Parser fctForcingX1;
+      fctForcingX1.SetExpr("Fx1");
+      fctForcingX1.DefineConst("Fx1", 1.0e-6);
+      kernel->setWithForcing(true);
+
+      kernel->setBCProcessor(bcProc);
+
+      //////////////////////////////////////////////////////////////////////////
+      //restart
+      SPtr<UbScheduler> rSch(new UbScheduler(cpStep, cpStart));
+      SPtr<MPIIORestartCoProcessor> restartCoProcessor(new MPIIORestartCoProcessor(grid, rSch, pathOut, comm));
+      restartCoProcessor->setLBMKernel(kernel);
+      restartCoProcessor->setBCProcessor(bcProc);
+
+      SPtr<UbScheduler> mSch(new UbScheduler(cpStep, cpStart));
+      SPtr<MPIIOMigrationCoProcessor> migCoProcessor(new MPIIOMigrationCoProcessor(grid, mSch, pathOut+"/mig", comm));
+      migCoProcessor->setLBMKernel(kernel);
+      migCoProcessor->setBCProcessor(bcProc);
+      //////////////////////////////////////////////////////////////////////////
+
+      //bounding box
+      double g_minX1 = boundingBox[0];
+      double g_minX2 = boundingBox[1];
+      double g_minX3 = boundingBox[2];
+
+      double g_maxX1 = boundingBox[3];
+      double g_maxX2 = boundingBox[4];
+      double g_maxX3 = boundingBox[5];
+
+      double blockLength = (double)blocknx[0]*deltaXcoarse;
+
+      double channel_high = channelHigh; // g_maxX3-g_minX3;
+      double channel_high_LB = channel_high/deltaXcoarse;
+      //////////////////////////////////////////////////////////////////////////
+      double nu_LB = (u_LB*channel_high_LB)/Re;
+      //////////////////////////////////////////////////////////////////////////
+      if (myid == 0)
+      {
+         UBLOG(logINFO, "Parameters:");
+         UBLOG(logINFO, "Re                  = " << Re);
+         UBLOG(logINFO, "u_LB                = " << u_LB);
+         UBLOG(logINFO, "rho_LB              = " << rho_LB);
+         UBLOG(logINFO, "nu_LB               = " << nu_LB);
+         UBLOG(logINFO, "dx coarse           = " << deltaXcoarse << " m");
+         UBLOG(logINFO, "dx fine             = " << deltaXfine << " m");
+         UBLOG(logINFO, "channel_high        = " << channel_high << " m");
+         UBLOG(logINFO, "channel_high_LB     = " << channel_high_LB);
+         UBLOG(logINFO, "number of levels    = " << refineLevel + 1);
+         UBLOG(logINFO, "number of processes = " << comm->getNumberOfProcesses());
+         UBLOG(logINFO, "number of threads   = " << numOfThreads);
+         UBLOG(logINFO, "path = " << pathOut);
+         UBLOG(logINFO, "Preprocess - start");
+      }
+
+
+      if (newStart)
+      {
+         if (myid == 0) UBLOG(logINFO, "new start...");
+
+
+
+         grid->setPeriodicX1(true);
+         grid->setPeriodicX2(true);
+         grid->setPeriodicX3(false);
+         grid->setDeltaX(deltaXcoarse);
+         grid->setBlockNX(blocknx[0], blocknx[1], blocknx[2]);
+
+         SPtr<GbObject3D> gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
+         if (myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), pathOut + "/geo/gridCube", WbWriterVtkXmlBinary::getInstance());
+
+
+         GenBlocksGridVisitor genBlocks(gridCube);
+         grid->accept(genBlocks);
+
+
+         //////////////////////////////////////////////////////////////////////////
+         //refinement
+         double blockLengthX3Fine = grid->getDeltaX(refineLevel) * blocknx[2];
+         double refHight = 0.002;
+
+         GbCuboid3DPtr refineBoxTop(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_maxX3-refHight, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3));
+         if (myid == 0) GbSystem3D::writeGeoObject(refineBoxTop.get(), pathOut + "/geo/refineBoxTop", WbWriterVtkXmlASCII::getInstance());
+
+         //GbCuboid3DPtr refineBoxBottom(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3, g_maxX1+blockLength, g_maxX2+blockLength, g_minX3+offsetMinX3+blockLengthX3Fine));
+         GbCuboid3DPtr refineBoxBottom(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3, g_maxX1+blockLength, g_maxX2+blockLength, g_minX3+refHight));
+         if (myid == 0) GbSystem3D::writeGeoObject(refineBoxBottom.get(), pathOut + "/geo/refineBoxBottom", WbWriterVtkXmlASCII::getInstance());
+
+         if (refineLevel > 0)
+         {
+            if (myid == 0) UBLOG(logINFO, "Refinement - start");
+            RefineCrossAndInsideGbObjectHelper refineHelper(grid, refineLevel, comm);
+            refineHelper.addGbObject(refineBoxTop, refineLevel);
+            refineHelper.addGbObject(refineBoxBottom, refineLevel);
+            refineHelper.refine();
+            if (myid == 0) UBLOG(logINFO, "Refinement - end");
+         }
+         //////////////////////////////////////////////////////////////////////////
+
+         //walls
+         GbCuboid3DPtr addWallZmin(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_minX3));
+         if (myid == 0) GbSystem3D::writeGeoObject(addWallZmin.get(), pathOut+"/geo/addWallZmin", WbWriterVtkXmlASCII::getInstance());
+
+         GbCuboid3DPtr addWallZmax(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_maxX3, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength));
+         if (myid == 0) GbSystem3D::writeGeoObject(addWallZmax.get(), pathOut+"/geo/addWallZmax", WbWriterVtkXmlASCII::getInstance());
+
+
+         //wall interactors
+         SPtr<D3Q27Interactor> addWallZminInt(new D3Q27Interactor(addWallZmin, grid, noSlipBCAdapter, Interactor3D::SOLID));
+         SPtr<D3Q27Interactor> addWallZmaxInt(new D3Q27Interactor(addWallZmax, grid, noSlipBCAdapter, Interactor3D::SOLID));
+
+         ////////////////////////////////////////////
+         //METIS
+         SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::BSW, MetisPartitioner::KWAY));
+         ////////////////////////////////////////////
+         if (myid == 0) UBLOG(logINFO, "deleteSolidBlocks - start");
+         InteractorsHelper intHelper(grid, metisVisitor);
+         intHelper.addInteractor(addWallZminInt);
+         intHelper.addInteractor(addWallZmaxInt);
+         intHelper.selectBlocks();
+         if (myid == 0) UBLOG(logINFO, "deleteSolidBlocks - end");
+         //////////////////////////////////////
+
+         {
+            WriteBlocksCoProcessor ppblocks(grid, SPtr<UbScheduler>(new UbScheduler(1)), pathOut, WbWriterVtkXmlBinary::getInstance(), comm);
+            ppblocks.process(0);
+         }
+
+         unsigned long long numberOfBlocks = (unsigned long long)grid->getNumberOfBlocks();
+         int ghostLayer = 3;
+         unsigned long long numberOfNodesPerBlock = (unsigned long long)(blocknx[0])* (unsigned long long)(blocknx[1])* (unsigned long long)(blocknx[2]);
+         unsigned long long numberOfNodes = numberOfBlocks * numberOfNodesPerBlock;
+         unsigned long long numberOfNodesPerBlockWithGhostLayer = numberOfBlocks * (blocknx[0] + ghostLayer) * (blocknx[1] + ghostLayer) * (blocknx[2] + ghostLayer);
+         double needMemAll = double(numberOfNodesPerBlockWithGhostLayer*(27 * sizeof(double) + sizeof(int) + sizeof(float) * 4));
+         double needMem = needMemAll / double(comm->getNumberOfProcesses());
+
+         if (myid == 0)
+         {
+            UBLOG(logINFO, "Number of blocks = " << numberOfBlocks);
+            UBLOG(logINFO, "Number of nodes  = " << numberOfNodes);
+            int minInitLevel = grid->getCoarsestInitializedLevel();
+            int maxInitLevel = grid->getFinestInitializedLevel();
+            for (int level = minInitLevel; level <= maxInitLevel; level++)
+            {
+               int nobl = grid->getNumberOfBlocks(level);
+               UBLOG(logINFO, "Number of blocks for level " << level << " = " << nobl);
+               UBLOG(logINFO, "Number of nodes for level " << level << " = " << nobl*numberOfNodesPerBlock);
+            }
+            UBLOG(logINFO, "Necessary memory  = " << needMemAll << " bytes");
+            UBLOG(logINFO, "Necessary memory per process = " << needMem << " bytes");
+            UBLOG(logINFO, "Available memory per process = " << availMem << " bytes");
+         }
+
+
+         SetKernelBlockVisitor kernelVisitor(kernel, nu_LB, availMem, needMem);
+         grid->accept(kernelVisitor);
+
+         //////////////////////////////////
+         //undef nodes for refinement
+         if (refineLevel > 0)
+         {
+            SetUndefinedNodesBlockVisitor undefNodesVisitor;
+            grid->accept(undefNodesVisitor);
+         }
+
+
+         //BC
+         intHelper.setBC();
+
+         ////porous media
+         if (true)
+         {
+            string samplePathname = pathGeo + "/" + sampleFilename;
+
+            SPtr<GbVoxelMatrix3D> sample(new GbVoxelMatrix3D(pmNX[0], pmNX[1], pmNX[2], 0, lthreshold, uthreshold));
+            if (rawFile)
+            {
+               sample->readBufferedMatrixFromRawFile<unsigned short>(samplePathname, GbVoxelMatrix3D::BigEndian);
+            }
+            else
+            {
+               sample->readMatrixFromVtiASCIIFile(samplePathname);
+            }
+
+            sample->setVoxelMatrixDelta(voxelDeltaX[0], voxelDeltaX[1], voxelDeltaX[2]);
+            sample->setVoxelMatrixMininum(origin[0], origin[1], origin[2]);
+
+            changePorosity(sample, pmNX);
+
+            sample->writeToLegacyVTKBinary(pathOut+"/geo/sample.vtk");
+            return;
+
+            int bounceBackOption = 1;
+            bool vxFile = false;
+            int i = 0;
+            //for (int x = 0; x < lengthFactor; x+=2)
+            int lenX = (int)((g_maxX1-g_minX1)/(pmL[0]));
+            int lenY = (int)((g_maxX2-g_minX2)/(pmL[1]));
+
+            for (int y = 0; y < lenY; y+=2)
+               for (int x = 0; x < lenX; x+=2)
+               {
+                  double offsetX = pmL[0] * (double)x;
+                  double offsetY = pmL[1] * (double)y;
+                  //sample 0
+                  if (myid == 0) UBLOG(logINFO, "sample # " << i);
+                  sample->setVoxelMatrixMininum(origin[0]+offsetX, origin[1]+offsetY, origin[2]);
+                  Utilities::voxelMatrixDiscretisation(sample, pathOut, myid, i, grid, bounceBackOption, vxFile);
+                  i++;
+
+                  if (myid == 0)
+                  {
+                     UBLOG(logINFO, "PID = " << myid << " Total Physical Memory (RAM): " << Utilities::getTotalPhysMem()/1073741824.0<<" GB");
+                     UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used: " << Utilities::getPhysMemUsed()/1073741824.0<<" GB");
+                     UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB");
+                  }
+
+                  //sample 1
+                  if (myid == 0) UBLOG(logINFO, "sample # " << i);
+                  sample->setVoxelMatrixMininum(origin[0]+pmL[0]+offsetX, origin[1]+offsetY, origin[2]);
+                  sample->mirrorX();
+                  Utilities::voxelMatrixDiscretisation(sample, pathOut, myid, i, grid, bounceBackOption, vxFile);
+                  i++;
+
+                  if (myid == 0)
+                  {
+                     UBLOG(logINFO, "PID = " << myid << " Total Physical Memory (RAM): " << Utilities::getTotalPhysMem()/1073741824.0<<" GB");
+                     UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used: " << Utilities::getPhysMemUsed()/1073741824.0<<" GB");
+                     UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB");
+                  }
+
+                  //sample 2
+                  if (myid == 0) UBLOG(logINFO, "sample # " << i);
+                  sample->setVoxelMatrixMininum(origin[0]+pmL[0]+offsetX, origin[1]+pmL[1]+offsetY, origin[2]);
+                  sample->mirrorY();
+                  Utilities::voxelMatrixDiscretisation(sample, pathOut, myid, i, grid, bounceBackOption, vxFile);
+                  i++;
+
+                  if (myid == 0)
+                  {
+                     UBLOG(logINFO, "PID = " << myid << " Total Physical Memory (RAM): " << Utilities::getTotalPhysMem()/1073741824.0<<" GB");
+                     UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used: " << Utilities::getPhysMemUsed()/1073741824.0<<" GB");
+                     UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe());
+                  }
+
+                  //sample 3
+                  if (myid == 0) UBLOG(logINFO, "sample # " << i);
+                  sample->setVoxelMatrixMininum(origin[0]+offsetX, origin[1]+pmL[1]+offsetY, origin[2]);
+                  sample->mirrorX();
+                  Utilities::voxelMatrixDiscretisation(sample, pathOut, myid, i, grid, bounceBackOption, vxFile);
+                  sample->mirrorY();
+                  i++;
+               }
+
+         }
+
+         grid->accept(bcVisitor);
+
+         mu::Parser inflowProfileVx1, inflowProfileVx2, inflowProfileVx3, inflowProfileRho;
+         inflowProfileVx1.SetExpr("x3 < h ? 0.0 : uLB+1*x1");
+         inflowProfileVx1.DefineConst("uLB", u_LB);
+         inflowProfileVx1.DefineConst("h", pmL[2]);
+
+         InitDistributionsBlockVisitor initVisitor;
+         initVisitor.setVx1(inflowProfileVx1);
+         grid->accept(initVisitor);
+
+         ////set connectors
+         InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor());
+         SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nu_LB, iProcessor);
+         grid->accept(setConnsVisitor);
+
+         //domain decomposition for threads
+         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
+         grid->accept(pqPartVisitor);
+
+         //Postrozess
+         {
+            SPtr<UbScheduler> geoSch(new UbScheduler(1));
+            WriteBoundaryConditionsCoProcessor ppgeo(grid, geoSch, pathOut, WbWriterVtkXmlBinary::getInstance(), comm);
+            ppgeo.process(0);
+         }
+
+         if (myid == 0) UBLOG(logINFO, "Preprozess - end");
+      }
+      else
+      {
+         //restartCoProcessor->restart((int)restartStep);
+         migCoProcessor->restart((int)restartStep);
+         grid->setTimeStep(restartStep);
+         ////////////////////////////////////////////////////////////////////////////
+         InterpolationProcessorPtr iProcessor(new CompressibleOffsetInterpolationProcessor());
+         SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nu_LB, iProcessor);
+         grid->accept(setConnsVisitor);
+
+         grid->accept(bcVisitor);
+
+         if (myid == 0) UBLOG(logINFO, "Restart - end");
+      }
+
+      SPtr<UbScheduler> nupsSch(new UbScheduler(nupsStep[0], nupsStep[1], nupsStep[2]));
+      std::shared_ptr<NUPSCounterCoProcessor> nupsCoProcessor(new NUPSCounterCoProcessor(grid, nupsSch, numOfThreads, comm));
+
+      SPtr<UbScheduler> stepSch(new UbScheduler(outTime));
+
+      SPtr<WriteMacroscopicQuantitiesCoProcessor> writeMQCoProcessor(new WriteMacroscopicQuantitiesCoProcessor(grid, stepSch, pathOut, WbWriterVtkXmlBinary::getInstance(), conv, comm));
+
+      SPtr<GbObject3D> bbBox(new GbCuboid3D(g_minX1-blockLength, (g_maxX2-g_minX2)/2.0, g_minX3-blockLength, g_maxX1+blockLength, (g_maxX2-g_minX2)/2.0+deltaXcoarse, g_maxX3+blockLength));
+      if (myid==0) GbSystem3D::writeGeoObject(bbBox.get(), pathOut+"/geo/bbBox", WbWriterVtkXmlASCII::getInstance());
+      SPtr<WriteMQFromSelectionCoProcessor> writeMQSelectCoProcessor(new WriteMQFromSelectionCoProcessor(grid, stepSch, bbBox, pathOut, WbWriterVtkXmlBinary::getInstance(), conv, comm));
+
+
+      SPtr<UbScheduler> AdjForcSch(new UbScheduler());
+      AdjForcSch->addSchedule(10, 0, 10000000);
+      SPtr<IntegrateValuesHelper> intValHelp(new IntegrateValuesHelper(grid, comm, g_minX1, g_minX2, g_minX3+pmL[2], g_maxX1, g_maxX2, g_maxX3));
+      if (myid == 0) GbSystem3D::writeGeoObject(intValHelp->getBoundingBox().get(), pathOut + "/geo/IntValHelp", WbWriterVtkXmlBinary::getInstance());
+
+      double vxTarget=u_LB;
+      SPtr<AdjustForcingCoProcessor> AdjForcCoProcessor(new AdjustForcingCoProcessor(grid, AdjForcSch, pathOut, intValHelp, vxTarget, comm));
+
+      //mu::Parser decrViscFunc;
+      //decrViscFunc.SetExpr("nue0+c0/(t+1)/(t+1)");
+      //decrViscFunc.DefineConst("nue0", nu_LB*4.0);
+      //decrViscFunc.DefineConst("c0", 0.1);
+      //SPtr<UbScheduler> DecrViscSch(new UbScheduler());
+      //DecrViscSch->addSchedule(10, 0, 1000);
+      //DecreaseViscosityCoProcessor decrViscPPPtr(grid, DecrViscSch, &decrViscFunc, comm);
+
+     //if (changeQs)
+     //{
+       // double z1 = pmL[2];
+       // SPtr<IntegrateValuesHelper> intValHelp2(new IntegrateValuesHelper(grid, comm,
+         //  coord[0], coord[1], z1 - deltaXfine,
+         //  coord[3], coord[4], z1 + deltaXfine));
+       // if (myid == 0) GbSystem3D::writeGeoObject(intValHelp2->getBoundingBox().get(), pathOut + "/geo/intValHelp2", WbWriterVtkXmlBinary::getInstance());
+       // Utilities::ChangeRandomQs(intValHelp2);
+     //}
+
+      std::vector<double> levelCoords;
+      std::vector<int> levels;
+      std::vector<double> bounds;
+      //bounds.push_back(0);
+      //bounds.push_back(0);
+      //bounds.push_back(0);
+      //bounds.push_back(0.004);
+      //bounds.push_back(0.002);
+      //bounds.push_back(0.003);
+      //levels.push_back(1);
+      //levels.push_back(0);
+      //levels.push_back(1);
+      //levelCoords.push_back(0);
+      //levelCoords.push_back(0.0016);
+      //levelCoords.push_back(0.0024);
+      //levelCoords.push_back(0.003);
+      bounds.push_back(0);
+      bounds.push_back(0);
+      bounds.push_back(0);
+      bounds.push_back(0.004);
+      bounds.push_back(0.002);
+      bounds.push_back(0.002);
+      levels.push_back(0);
+      levelCoords.push_back(0);
+      levelCoords.push_back(0.002);
+      //SPtr<UbScheduler> tavSch(new UbScheduler(1, timeAvStart, timeAvStop));
+      //SPtr<CoProcessor> tav(new TimeAveragedValuesCoProcessor(grid, pathOut, WbWriterVtkXmlBinary::getInstance(), tavSch, comm,
+      //   TimeAveragedValuesCoProcessor::Velocity | TimeAveragedValuesCoProcessor::Fluctuations | TimeAveragedValuesCoProcessor::Triplecorrelations,
+      //   levels, levelCoords, bounds));
+
+
+      //create line time series
+      SPtr<UbScheduler> tpcSch(new UbScheduler(1, 1, 3));
+      //GbPoint3DPtr p1(new GbPoint3D(0.0,0.005,0.01));
+      //GbPoint3DPtr p2(new GbPoint3D(0.064,0.005,0.01));
+      //SPtr<GbLine3D> line(new GbLine3D(p1.get(),p2.get()));
+      SPtr<GbLine3D> line(new GbLine3D(new GbPoint3D(0.0, 0.005, 0.01), new GbPoint3D(0.064, 0.005, 0.01)));
+      LineTimeSeriesCoProcessor lineTs(grid, tpcSch, pathOut+"/TimeSeries/line1.csv", line, 0, comm);
+      if (myid==0) lineTs.writeLine(pathOut+"/geo/line1");
+
+      if (myid == 0)
+      {
+         UBLOG(logINFO, "PID = " << myid << " Total Physical Memory (RAM): " << Utilities::getTotalPhysMem());
+         UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used: " << Utilities::getPhysMemUsed());
+         UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe());
+      }
+
+      //omp_set_num_threads(numOfThreads);
+       numOfThreads = 4;
+      SPtr<UbScheduler> stepGhostLayer(new UbScheduler(1));
+      SPtr<Calculator> calculator(new BasicCalculator(grid, stepGhostLayer, (int)endTime));
+      calculator->addCoProcessor(nupsCoProcessor);
+      calculator->addCoProcessor(AdjForcCoProcessor);
+      calculator->addCoProcessor(migCoProcessor);
+      //calculator->addCoProcessor(restartCoProcessor);
+      calculator->addCoProcessor(writeMQSelectCoProcessor);
+      calculator->addCoProcessor(writeMQCoProcessor);
+
+      if (myid == 0) UBLOG(logINFO, "Simulation-start");
+      calculator->calculate();
+      if (myid == 0) UBLOG(logINFO, "Simulation-end");
+   }
+   catch (exception& e)
+   {
+      cerr << e.what() << endl << flush;
+   }
+   catch (string& s)
+   {
+      cerr << s << endl;
+   }
+   catch (mu::Parser::exception_type &e)
+   {
+      std::cout << e.GetMsg() << std::endl;
+   }
+   catch (...)
+   {
+      cerr << "unknown exception" << endl;
+   }
+
+}
+//////////////////////////////////////////////////////////////////////////
+int main(int argc, char* argv[])
+{
+
+   if (argv != NULL)
+   {
+      if (argv[1] != NULL)
+      {
+         run(string(argv[1]));
+      }
+      else
+      {
+         cout << "Configuration file is missing!" << endl;
+      }
+   }
+
+   return 0;
+}
diff --git a/apps/cpu/pChannel/pChannel.cpp.hlrn b/apps/cpu/pChannel/pChannel.cpp.hlrn
index 04274a4a24fdb42156d54e56baff7560a323df18..808b8cf49ec3c2f4c9c9fcaa725844ce08d9ca1f 100644
--- a/apps/cpu/pChannel/pChannel.cpp.hlrn
+++ b/apps/cpu/pChannel/pChannel.cpp.hlrn
@@ -1,729 +1,729 @@
-#include <iostream>
-#include <string>
-#include "VirtualFluids.h"
-
-
-
-//#include <thread>
-
-using namespace std;
-
-//////////////////////////////////////////////////////////////////////////
-void run(string configname)
-{
-   try
-   {
-      ConfigurationFile   config;
-      config.load(configname);
-
-      string          pathname          = config.getString("pathname");
-      string          pathGeo           = config.getString("pathGeo");
-      int             numOfThreads      = config.getInt("numOfThreads");
-      string          sampleFilename    = config.getString("sampleFilename");
-      vector<int>     pmNX              = config.getVector<int>("pmNX");
-      double          lthreshold        = config.getDouble("lthreshold");
-      double          uthreshold        = config.getDouble("uthreshold");
-      vector<float>   voxelDeltaX       = config.getVector<float>("voxelDeltaX");
-      vector<int>     blocknx           = config.getVector<int>("blocknx");
-      double          u_LB              = config.getDouble("u_LB");
-      double          restartStep       = config.getDouble("restartStep");
-      double          restartStepStart  = config.getDouble("restartStepStart");
-      double          endTime           = config.getDouble("endTime");
-      double          outTime           = config.getDouble("outTime");
-      double          availMem          = config.getDouble("availMem");
-      bool            rawFile           = config.getBool("rawFile");
-      bool            logToFile         = config.getBool("logToFile");
-      bool            writeSample       = config.getBool("writeSample");
-      vector<double>  pmL               = config.getVector<double>("pmL");
-      double          deltaXfine        = config.getDouble("deltaXfine");
-      int             refineLevel       = config.getInt("refineLevel");
-      bool            thinWall          = config.getBool("thinWall");
-      double          Re                = config.getDouble("Re");
-      double          channelHigh       = config.getDouble("channelHigh");
-      double          lengthFactor      = config.getDouble("lengthFactor");
-      double          forcing           = config.getDouble("forcing");
-      bool            changeQs          = config.getBool("changeQs"); 
-      double          timeAvStart       = config.getDouble("timeAvStart");
-      double          timeAvStop        = config.getDouble("timeAvStop");
-      bool            averaging         = config.getBool("averaging");
-      bool            averagingReset    = config.getBool("averagingReset");
-      double          nupsSteps         = config.getDouble("nupsSteps");
-      double          timeLineTsStart   = config.getDouble("timeLineTsStart");
-      double          timeLineTsStop    = config.getDouble("timeLineTsStop");
-
-
-      CommunicatorPtr comm = MPICommunicator::getInstance();
-      int myid = comm->getProcessID();
-
-      if (logToFile)
-      {
-#if defined(__unix__)
-         if (myid == 0)
-         {
-            const char* str = pathname.c_str();
-            mkdir(str, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
-         }
-#endif 
-
-         if (myid == 0)
-         {
-            stringstream logFilename;
-            logFilename << pathname + "/logfile" + UbSystem::toString(UbSystem::getTimeStamp()) + ".txt";
-            UbLog::output_policy::setStream(logFilename.str());
-         }
-      }
-
-      //Sleep(30000);
-
-      if (myid == 0) UBLOG(logINFO, "Testcase porous channel");
-
-      LBMReal rho_LB = 0.0;
-
-      LBMUnitConverterPtr conv = LBMUnitConverterPtr(new LBMUnitConverter());
-
-      const int baseLevel = 0;
-      double deltaXcoarse = deltaXfine*(double)(1<<refineLevel);
-
-      double coord[6];
-      bool restart;
-
-      vector<double> origin(3);
-      origin[0] = 0;
-      origin[1] = 0;
-      origin[2] = 0;
-
-      //real velocity is 49.63 m/s
-      double nu_LB;
-
-      Grid3DPtr grid(new Grid3D(comm));
-
-      //////////////////////////////////////////////////////////////////////////
-      //restart
-      UbSchedulerPtr rSch(new UbScheduler(restartStep, restartStepStart));
-      RestartCoProcessor rp(grid, rSch, comm, pathname, RestartCoProcessor::BINARY);
-      //////////////////////////////////////////////////////////////////////////
-
-      if (grid->getTimeStep() == 0)
-      {
-         if (myid == 0) UBLOG(logINFO, "new start...");
-         restart = false;
-
-         double offsetMinX3 = pmL[2];
-         
-         double offsetMaxX1 = pmL[0]*lengthFactor;
-         double offsetMaxX2 = pmL[1]*2.0;
-         double offsetMaxX3 = pmL[2] + channelHigh; //DLR-F15  //pmL[2]*2.0;
-
-         //bounding box
-         double g_minX1 = origin[0];
-         double g_minX2 = origin[1];
-         double g_minX3 = origin[2];
-
-         double g_maxX1 = origin[0] + offsetMaxX1;
-         double g_maxX2 = origin[1] + offsetMaxX2;
-         double g_maxX3 = origin[2] + offsetMaxX3;
-//////////////////////////////////////////////////////////////////////////
-         double nx1_temp = floor((g_maxX1-g_minX1) /(deltaXcoarse*(double)blocknx[0]));
-
-         deltaXcoarse = (g_maxX1-g_minX1) /(nx1_temp*(double)blocknx[0]);
-
-         g_maxX1 -= 0.5* deltaXcoarse;
-//////////////////////////////////////////////////////////////////////////
-         double blockLength = (double)blocknx[0]*deltaXcoarse;
-
-         grid->setPeriodicX1(true);
-         grid->setPeriodicX2(true);
-         grid->setPeriodicX3(false);
-         grid->setDeltaX(deltaXcoarse);
-         grid->setBlockNX(blocknx[0], blocknx[1], blocknx[2]);
-
-         GbObject3DPtr gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
-         if (myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), pathname + "/geo/gridCube", WbWriterVtkXmlBinary::getInstance());
-
-
-         GenBlocksGridVisitor genBlocks(gridCube);
-         grid->accept(genBlocks);
-         double channel_high = channelHigh; // g_maxX3-g_minX3;
-         double channel_high_LB = channel_high/deltaXcoarse;
-//////////////////////////////////////////////////////////////////////////
-         //nu_LB = 0.005;
-         nu_LB = (u_LB*channel_high_LB)/Re;
-//////////////////////////////////////////////////////////////////////////
-         if (myid == 0)
-         {
-            UBLOG(logINFO, "Parameters:");
-            UBLOG(logINFO, "Re = " << Re);
-            UBLOG(logINFO, "u_LB = " << u_LB);
-            UBLOG(logINFO, "rho_LB = " << rho_LB);
-            UBLOG(logINFO, "nu_LB = " << nu_LB);
-            UBLOG(logINFO, "dx coarse = " << deltaXcoarse << " m");
-            UBLOG(logINFO, "dx fine = " << grid->getDeltaX(refineLevel) << " m");
-            UBLOG(logINFO, "number of levels = " << refineLevel + 1);
-            UBLOG(logINFO, "number of processes = " << comm->getNumberOfProcesses());
-            UBLOG(logINFO, "number of threads = " << numOfThreads);
-            UBLOG(logINFO, "path = " << pathname);
-            UBLOG(logINFO, "Preprocess - start");
-         }
-
-         //////////////////////////////////////////////////////////////////////////
-         //refinement
-         double blockLengthX3Fine = grid->getDeltaX(refineLevel) * blocknx[2];
-
-         GbCuboid3DPtr refineBoxTop(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_maxX3-blockLengthX3Fine, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength));
-         if (myid == 0) GbSystem3D::writeGeoObject(refineBoxTop.get(), pathname + "/geo/refineBoxTop", WbWriterVtkXmlASCII::getInstance());
-
-         GbCuboid3DPtr refineBoxBottom(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3, g_maxX1+blockLength, g_maxX2+blockLength, g_minX3+offsetMinX3+blockLengthX3Fine));
-         //GbCuboid3DPtr refineBoxBottom(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3-blockLengthX3Fine, g_maxX1+blockLength, g_maxX2+blockLength, g_minX3+blockLengthX3Fine));
-         if (myid == 0) GbSystem3D::writeGeoObject(refineBoxBottom.get(), pathname + "/geo/refineBoxBottom", WbWriterVtkXmlASCII::getInstance());
-
-         if (refineLevel > 0)
-         {
-            if (myid == 0) UBLOG(logINFO, "Refinement - start");
-            RefineCrossAndInsideGbObjectHelper refineHelper(grid, refineLevel);
-            refineHelper.addGbObject(refineBoxTop, refineLevel);
-            refineHelper.addGbObject(refineBoxBottom, refineLevel);
-            refineHelper.refine();
-            if (myid == 0) UBLOG(logINFO, "Refinement - end");
-         }
-         //////////////////////////////////////////////////////////////////////////
-
-         //walls
-         GbCuboid3DPtr addWallZmin(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_minX3));
-         if (myid == 0) GbSystem3D::writeGeoObject(addWallZmin.get(), pathname+"/geo/addWallZmin", WbWriterVtkXmlASCII::getInstance());
-
-         GbCuboid3DPtr addWallZmax(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_maxX3, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength));
-         if (myid == 0) GbSystem3D::writeGeoObject(addWallZmax.get(), pathname+"/geo/addWallZmax", WbWriterVtkXmlASCII::getInstance());
-
-
-         //wall interactors
-         int bbOption = 1;
-         D3Q27BoundaryConditionAdapterPtr bcNoSlip(new D3Q27NoSlipBCAdapter(bbOption));
-         D3Q27InteractorPtr addWallZminInt(new D3Q27Interactor(addWallZmin, grid, bcNoSlip, Interactor3D::SOLID));
-         D3Q27InteractorPtr addWallZmaxInt(new D3Q27Interactor(addWallZmax, grid, bcNoSlip, Interactor3D::SOLID));
-
-		 ////////////////////////////////////////////////
-		 //TEST
-		 //GbObject3DPtr testCube(new GbCuboid3D(g_minX1 + 2.0 * blockLength, g_minX2 + 2.0 * blockLength, g_minX3 + 5.0 * blockLength, 
-			// g_minX1 + 3.0 * blockLength, g_minX2 + 3.0 * blockLength, g_minX3 + 6.0 * blockLength));
-		 //if (myid == 0) GbSystem3D::writeGeoObject(testCube.get(), pathname + "/geo/testCube", WbWriterVtkXmlBinary::getInstance());
-		 //D3Q27InteractorPtr testCubeInt(new D3Q27Interactor(testCube, grid, bcNoSlip, Interactor3D::SOLID));
-		 ///////////////////////////////////////////////
-
-         ////////////////////////////////////////////
-         //METIS
-         Grid3DVisitorPtr metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::BSW, MetisPartitioner::KWAY));
-         ////////////////////////////////////////////
-         //Zoltan
-         //Grid3DVisitorPtr zoltanVisitor(new ZoltanPartitioningGridVisitor(comm, D3Q27System::BSW, 1));
-         //grid->accept(zoltanVisitor);
-         /////delete solid blocks
-         if (myid == 0) UBLOG(logINFO, "deleteSolidBlocks - start");
-         InteractorsHelper intHelper(grid, metisVisitor);
-         intHelper.addInteractor(addWallZminInt);
-         intHelper.addInteractor(addWallZmaxInt);
-		 //////////////////////////////////////////////////////////////////////////
-		 //TEST
-		 //intHelper.addInteractor(testCubeInt);
-         //////////////////////////////////////////////////////////////////////////
-		 intHelper.selectBlocks();
-         if (myid == 0) UBLOG(logINFO, "deleteSolidBlocks - end");
-         //////////////////////////////////////
-
-         WriteBlocksCoProcessorPtr ppblocks(new WriteBlocksCoProcessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm));
-         ppblocks->process(0);
-         ppblocks.reset();
-
-         unsigned long long numberOfBlocks = (unsigned long long)grid->getNumberOfBlocks();
-         int ghostLayer = 3;
-         unsigned long long numberOfNodesPerBlock = (unsigned long long)(blocknx[0])* (unsigned long long)(blocknx[1])* (unsigned long long)(blocknx[2]);
-         unsigned long long numberOfNodes = numberOfBlocks * numberOfNodesPerBlock;
-         unsigned long long numberOfNodesPerBlockWithGhostLayer = numberOfBlocks * (blocknx[0] + ghostLayer) * (blocknx[1] + ghostLayer) * (blocknx[2] + ghostLayer);
-         double needMemAll = double(numberOfNodesPerBlockWithGhostLayer*(27 * sizeof(double) + sizeof(int) + sizeof(float) * 4));
-         double needMem = needMemAll / double(comm->getNumberOfProcesses());
-	 
-
-         if (myid == 0)
-         {
-            UBLOG(logINFO, "Number of blocks = " << numberOfBlocks);
-            UBLOG(logINFO, "Number of nodes  = " << numberOfNodes);
-            int minInitLevel = grid->getCoarsestInitializedLevel();
-            int maxInitLevel = grid->getFinestInitializedLevel();
-            for (int level = minInitLevel; level <= maxInitLevel; level++)
-            {
-               int nobl = grid->getNumberOfBlocks(level);
-               UBLOG(logINFO, "Number of blocks for level " << level << " = " << nobl);
-               UBLOG(logINFO, "Number of nodes for level " << level << " = " << nobl*numberOfNodesPerBlock);
-            }
-            UBLOG(logINFO, "Necessary memory  = " << needMemAll << " bytes");
-            UBLOG(logINFO, "Necessary memory per process = " << needMem << " bytes");
-            UBLOG(logINFO, "Available memory per process = " << availMem << " bytes");
-         }
-
-         LBMKernel3DPtr kernel = LBMKernel3DPtr(new LBMKernelETD3Q27CCLB(blocknx[0], blocknx[1], blocknx[2], LBMKernelETD3Q27CCLB::NORMAL));
-
-         mu::Parser fctForcingX1;
-         fctForcingX1.SetExpr("Fx1");
-         fctForcingX1.DefineConst("Fx1", 1.0e-6);
-
-         kernel->setWithForcing(true);
-
-         BCProcessorPtr bcProc;
-         BoundaryConditionPtr noSlipBC;
-
-         if (thinWall)
-         {
-            bcProc = BCProcessorPtr(new D3Q27ETForThinWallBCProcessor());
-            noSlipBC = BoundaryConditionPtr(new ThinWallNoSlipBoundaryCondition());
-         }
-         else
-         {
-            bcProc = BCProcessorPtr(new D3Q27ETBCProcessor());
-            noSlipBC = BoundaryConditionPtr(new NoSlipBoundaryCondition());
-         }
-
-         bcProc->addBC(noSlipBC);
-
-         kernel->setBCProcessor(bcProc);
-
-         SetKernelBlockVisitor kernelVisitor(kernel, nu_LB, availMem, needMem);
-         grid->accept(kernelVisitor);
-
-         //////////////////////////////////
-         //undef nodes for refinement
-         if (refineLevel > 0)
-         {
-            D3Q27SetUndefinedNodesBlockVisitor undefNodesVisitor;
-            grid->accept(undefNodesVisitor);
-         }
-
-
-         //BC
-         intHelper.setBC();
-
-         ////porous media
-         {
-            string samplePathname = pathGeo + "/" + sampleFilename;
-
-            GbVoxelMatrix3DPtr sample(new GbVoxelMatrix3D(pmNX[0], pmNX[1], pmNX[2], 0, lthreshold, uthreshold));
-            if (rawFile)
-            {
-               sample->readBufferedMatrixFromRawFile<unsigned short>(samplePathname, GbVoxelMatrix3D::BigEndian);
-            }
-            else
-            {
-               sample->readMatrixFromVtiASCIIFile(samplePathname);
-            }
-
-            sample->setVoxelMatrixDelta(voxelDeltaX[0], voxelDeltaX[1], voxelDeltaX[2]);
-            sample->setVoxelMatrixMininum(origin[0], origin[1], origin[2]);
-
-            int bounceBackOption = 1;
-            bool vxFile = false;
-            int i = 0;
-            for (int x = 0; x < lengthFactor; x+=2)
-            {
-               double offset = pmL[0] * (double)x;
-               //sample 0
-               if (myid == 0) UBLOG(logINFO, "sample # " << i);
-               sample->setVoxelMatrixMininum(origin[0]+offset, origin[1], origin[2]);
-               Utilities::voxelMatrixDiscretisation(sample, pathname, myid, i, grid, bounceBackOption, vxFile);
-               i++;
-
-               if (myid == 0)
-               {
-                  UBLOG(logINFO, "PID = " << myid << " Total Physical Memory (RAM): " << Utilities::getTotalPhysMem());
-                  UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used: " << Utilities::getPhysMemUsed());
-                  UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe());
-               }
-
-               //sample 1
-               if (myid == 0) UBLOG(logINFO, "sample # " << i);
-               sample->setVoxelMatrixMininum(origin[0]+pmL[0]+offset, origin[1], origin[2]);
-               sample->mirrorX();
-               Utilities::voxelMatrixDiscretisation(sample, pathname, myid, i, grid, bounceBackOption, vxFile);
-               i++;
-
-               if (myid == 0)
-               {
-                  UBLOG(logINFO, "PID = " << myid << " Total Physical Memory (RAM): " << Utilities::getTotalPhysMem());
-                  UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used: " << Utilities::getPhysMemUsed());
-                  UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe());
-               }
-
-               //sample 2
-               if (myid == 0) UBLOG(logINFO, "sample # " << i);
-               sample->setVoxelMatrixMininum(origin[0]+pmL[0]+offset, origin[1]+pmL[1], origin[2]);
-               sample->mirrorY();
-               Utilities::voxelMatrixDiscretisation(sample, pathname, myid, i, grid, bounceBackOption, vxFile);
-               i++;
-
-               if (myid == 0)
-               {
-                  UBLOG(logINFO, "PID = " << myid << " Total Physical Memory (RAM): " << Utilities::getTotalPhysMem());
-                  UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used: " << Utilities::getPhysMemUsed());
-                  UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe());
-               }
-
-               //sample 3
-               if (myid == 0) UBLOG(logINFO, "sample # " << i);
-               sample->setVoxelMatrixMininum(origin[0]+offset, origin[1]+pmL[1], origin[2]);
-               sample->mirrorX();
-               Utilities::voxelMatrixDiscretisation(sample, pathname, myid, i, grid, bounceBackOption, vxFile);
-               sample->mirrorY();
-               i++;
-            }
-
-         }
-         BoundaryConditionBlockVisitor bcVisitor;
-         grid->accept(bcVisitor);
-
-         mu::Parser inflowProfile;
-         inflowProfile.SetExpr("x3 < h ? 0.0 : uLB+1*x1-1*x2");
-		   //inflowProfile.SetExpr("uLB+1*x1-1*x2");
-         //inflowProfile.SetExpr("uLB");
-         inflowProfile.DefineConst("uLB", u_LB);
-         inflowProfile.DefineConst("h", pmL[2]);
-
-         D3Q27ETInitDistributionsBlockVisitor initVisitor(nu_LB, rho_LB);
-         initVisitor.setVx1(inflowProfile);
-         //initVisitor.setVx1(u_LB);
-         grid->accept(initVisitor);
-
-         ////set connectors
-         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
-         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nu_LB, iProcessor);
-         grid->accept(setConnsVisitor);
-
-         //domain decomposition for threads
-         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
-         grid->accept(pqPartVisitor);
-
-         //Postrozess
-         UbSchedulerPtr geoSch(new UbScheduler(1));
-         MacroscopicQuantitiesCoProcessorPtr ppgeo(
-            new MacroscopicQuantitiesCoProcessor(grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, true));
-         ppgeo->process(0);
-         ppgeo.reset();
-
-         coord[0] = g_minX1;
-         coord[1] = g_minX2;
-         coord[2] = g_minX3;
-         coord[3] = g_maxX1;
-         coord[4] = g_maxX2;
-         coord[5] = g_maxX3;
-
-         ////////////////////////////////////////////////////////
-         FILE * pFile;
-         string str = pathname + "/checkpoints/coord.txt";
-         pFile = fopen(str.c_str(), "w");
-         fprintf(pFile, "%g\n", deltaXcoarse);
-         fprintf(pFile, "%g\n", nu_LB);
-         fprintf(pFile, "%g\n", coord[0]);
-         fprintf(pFile, "%g\n", coord[1]);
-         fprintf(pFile, "%g\n", coord[2]);
-         fprintf(pFile, "%g\n", coord[3]);
-         fprintf(pFile, "%g\n", coord[4]);
-         fprintf(pFile, "%g\n", coord[5]);
-         fclose(pFile);
-         ////////////////////////////////////////////////////////
-
-         if (myid == 0) UBLOG(logINFO, "Preprozess - end");
-      }
-      else
-      {
-         ////////////////////////////////////////////////////////
-         FILE * pFile;
-         string str = pathname + "/checkpoints/coord.txt";
-         pFile = fopen(str.c_str(), "r");
-         fscanf(pFile, "%lg\n", &deltaXcoarse);
-         fscanf(pFile, "%lg\n", &nu_LB);
-         fscanf(pFile, "%lg\n", &coord[0]);
-         fscanf(pFile, "%lg\n", &coord[1]);
-         fscanf(pFile, "%lg\n", &coord[2]);
-         fscanf(pFile, "%lg\n", &coord[3]);
-         fscanf(pFile, "%lg\n", &coord[4]);
-         fscanf(pFile, "%lg\n", &coord[5]);
-         fclose(pFile);
-         ////////////////////////////////////////////////////////
-
-         if (myid == 0)
-         {
-            UBLOG(logINFO, "Parameters:");
-            UBLOG(logINFO, "Re = " << Re);
-            UBLOG(logINFO, "u_LB = " << u_LB);
-            UBLOG(logINFO, "rho_LB = " << rho_LB);
-            UBLOG(logINFO, "nu_LB = " << nu_LB);
-            UBLOG(logINFO, "dx coarse = " << deltaXcoarse << " m");
-            UBLOG(logINFO, "dx fine = " << grid->getDeltaX(refineLevel) << " m");
-            UBLOG(logINFO, "number of levels = " << refineLevel + 1);
-            UBLOG(logINFO, "numOfThreads = " << numOfThreads);
-            UBLOG(logINFO, "path = " << pathname);
-         }
-         
-         /////////////////////////////////////////////////////////////
-         /////////////////////////////////////////////////////////////
-         //bounding box
-//          double offsetMinX3 = pmL[2];
-// 
-//          double offsetMaxX1 = pmL[0]*lengthFactor;
-//          double offsetMaxX2 = pmL[1]*2.0;
-//          double offsetMaxX3 = channelHigh;
-// 
-//          double g_minX1 = origin[0];
-//          double g_minX2 = origin[1];
-//          double g_minX3 = origin[2];
-// 
-//          double g_maxX1 = origin[0]+offsetMaxX1;
-//          double g_maxX2 = origin[1]+offsetMaxX2;
-//          double g_maxX3 = origin[2]+offsetMaxX3;
-// 
-//          double blockLength = (double)blocknx[0]*deltaXcoarse;
-// 
-//          GbCuboid3DPtr addWallZmin(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_minX3+offsetMinX3));
-//          if (myid==0) GbSystem3D::writeGeoObject(addWallZmin.get(), pathname+"/geo/addWallZmin", WbWriterVtkXmlASCII::getInstance());
-//          int bbOption = 1;
-//          D3Q27BoundaryConditionAdapterPtr bcNoSlip(new D3Q27NoSlipBCAdapter(bbOption));
-//          D3Q27InteractorPtr addWallZminInt(new D3Q27Interactor(addWallZmin, grid, bcNoSlip, Interactor3D::SOLID));
-// 
-//          SetSolidOrTransBlockVisitor v1(addWallZminInt, SetSolidOrTransBlockVisitor::SOLID);
-//          grid->accept(v1);
-//          SetSolidOrTransBlockVisitor v2(addWallZminInt, SetSolidOrTransBlockVisitor::TRANS);
-//          grid->accept(v2);
-// 
-//          std::vector<Block3DPtr> blocks;
-//          std::vector<Block3DPtr>& sb = addWallZminInt->getSolidBlockSet();
-//          if (myid==0) UBLOG(logINFO, "number of solid blocks = "<<sb.size());
-//          blocks.insert(blocks.end(), sb.begin(), sb.end());
-//          std::vector<Block3DPtr>& tb = addWallZminInt->getTransBlockSet();
-//          if (myid==0) UBLOG(logINFO, "number of trans blocks = "<<tb.size());
-//          blocks.insert(blocks.end(), tb.begin(), tb.end());
-// 
-//          if (myid==0) UBLOG(logINFO, "number of blocks = "<<blocks.size());
-// 
-//          BOOST_FOREACH(Block3DPtr block, blocks)
-//          {
-//             block->setActive(true);
-//             addWallZminInt->setDifferencesToGbObject3D(block);
-//          }
-// 
-//          //////////////////////////////////////////////
-//          ////METIS
-//          //Grid3DVisitorPtr metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::BSW, MetisPartitioner::KWAY));
-//          //////////////////////////////////////////////
-//          ///////delete solid blocks
-//          //if (myid==0) UBLOG(logINFO, "deleteSolidBlocks - start");
-//          //InteractorsHelper intHelper(grid, metisVisitor);
-//          //intHelper.addInteractor(addWallZminInt);
-//          //intHelper.selectBlocks();
-//          //if (myid==0) UBLOG(logINFO, "deleteSolidBlocks - end");
-//          ////////////////////////////////////////
-//          //intHelper.setBC();
-//          //////////////////////////////////////////////////////////////
-// 
-//          BoundaryConditionBlockVisitor bcVisitor;
-//          grid->accept(bcVisitor);
-// 
-//          WriteBlocksCoProcessorPtr ppblocks(new WriteBlocksCoProcessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm));
-//          ppblocks->process(0);
-//          ppblocks.reset();
-// 
-//          UbSchedulerPtr geoSch(new UbScheduler(1));
-//          MacroscopicQuantitiesCoProcessorPtr ppgeo(
-//             new MacroscopicQuantitiesCoProcessor(grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, true));
-//          ppgeo->process(0);
-//          ppgeo.reset();
-         ////////////////////////////////////////////////////////////////
-
-         //set connectors
-         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
-         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nu_LB, iProcessor);
-         grid->accept(setConnsVisitor);
-
-         restart = true;
-
-         if (myid == 0) UBLOG(logINFO, "Restart - end");
-      }
-      UbSchedulerPtr nupsSch(new UbScheduler(nupsSteps));
-      NUPSCounterCoProcessor npr(grid, nupsSch, numOfThreads, comm);
-
-      UbSchedulerPtr stepSch(new UbScheduler(outTime));
-
-      MacroscopicQuantitiesCoProcessor pp(grid, stepSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv);
-
-      double startStep = grid->getTimeStep();
-
-      //UbSchedulerPtr visSch(new UbScheduler());
-      //visSch->addSchedule(40000,40000,40000000);
-      //UbSchedulerPtr resSchRMS(new UbScheduler());
-      //resSchRMS->addSchedule(40000, startStep, 40000000);
-      //UbSchedulerPtr resSchMeans(new UbScheduler());
-      //resSchMeans->addSchedule(40000, startStep, 40000000);
-      //UbSchedulerPtr stepAvSch(new UbScheduler());
-      //stepAvSch->addSchedule(100, 0, 10000000);
-      //AverageValuesPostprocessor Avpp(grid, pathname, WbWriterVtkXmlBinary::getInstance(),
-      //   stepSch/*wann wird rausgeschrieben*/, stepAvSch/*wann wird gemittelt*/, resSchMeans, resSchRMS/*wann wird resettet*/, restart);
-
-
-      UbSchedulerPtr AdjForcSch(new UbScheduler());
-      AdjForcSch->addSchedule(10, 0, 10000000);
-      D3Q27IntegrateValuesHelperPtr intValHelp(new D3Q27IntegrateValuesHelper(grid, comm,
-         coord[0], coord[1], coord[2],
-         coord[3], coord[4], coord[5]));
-      if (myid == 0) GbSystem3D::writeGeoObject(intValHelp->getBoundingBox().get(), pathname + "/geo/IntValHelp", WbWriterVtkXmlBinary::getInstance());
-
-      double vxTarget=u_LB;
-      AdjustForcingCoProcessor AdjForcPPPtr(grid, AdjForcSch, pathname, intValHelp, vxTarget, comm);
-
-      //mu::Parser decrViscFunc;
-      //decrViscFunc.SetExpr("nue0+c0/(t+1)/(t+1)");
-      //decrViscFunc.DefineConst("nue0", nu_LB*4.0);
-      //decrViscFunc.DefineConst("c0", 0.1);
-      //UbSchedulerPtr DecrViscSch(new UbScheduler());
-      //DecrViscSch->addSchedule(10, 0, 1000);
-      //DecreaseViscosityPostprocessor decrViscPPPtr(grid, DecrViscSch, &decrViscFunc, comm);
-
-	  //if (changeQs)
-	  //{
-		 // double z1 = pmL[2];
-		 // D3Q27IntegrateValuesHelperPtr intValHelp2(new D3Q27IntegrateValuesHelper(grid, comm,
-			//  coord[0], coord[1], z1 - deltaXfine,
-			//  coord[3], coord[4], z1 + deltaXfine));
-		 // if (myid == 0) GbSystem3D::writeGeoObject(intValHelp2->getBoundingBox().get(), pathname + "/geo/intValHelp2", WbWriterVtkXmlBinary::getInstance());
-		 // Utilities::ChangeRandomQs(intValHelp2);
-	  //}
-
-      std::vector<double> levelCoords;
-      std::vector<int> levels;
-      std::vector<double> bounds;
-      bounds.push_back(0);
-      bounds.push_back(0);
-      bounds.push_back(1e-3);
-      bounds.push_back(0.064);
-      bounds.push_back(0.008);
-      bounds.push_back(0.018);
-      levels.push_back(3);
-      levels.push_back(2);
-      levels.push_back(1);
-      levels.push_back(0);
-      levels.push_back(1);
-      levels.push_back(2);
-      levels.push_back(3);
-      levelCoords.push_back(0);
-      levelCoords.push_back(0.0016-6.0*deltaXfine);
-      levelCoords.push_back(0.0016);
-      levelCoords.push_back(0.0024-6.0*deltaXfine*2.0);
-      levelCoords.push_back(0.0024);
-      levelCoords.push_back(0.0048-6.0*deltaXfine*4.0);
-      levelCoords.push_back(0.0048);
-      levelCoords.push_back(0.0144);
-      levelCoords.push_back(0.0144+6.0*deltaXfine*4.0);
-      levelCoords.push_back(0.0168);
-      levelCoords.push_back(0.0168+6.0*deltaXfine*2.0);
-      levelCoords.push_back(0.0176);
-      levelCoords.push_back(0.0176+6.0*deltaXfine);
-      levelCoords.push_back(0.018);
-      UbSchedulerPtr tavSch(new UbScheduler(1, timeAvStart, timeAvStop));
-      TimeAveragedValuesCoProcessorPtr tav(new TimeAveragedValuesCoProcessor(grid, pathname, WbWriterVtkXmlBinary::getInstance(), tavSch, comm,
-         TimeAveragedValuesCoProcessor::Velocity | TimeAveragedValuesCoProcessor::Fluctuations | TimeAveragedValuesCoProcessor::Triplecorrelations//));
-         ,levels, levelCoords, bounds, false));
-      if (averagingReset)
-      {
-	     tav->reset();
-      }
-      //UbSchedulerPtr catalystSch(new UbScheduler(1));
-      //InSituCatalystCoProcessor catalyst(grid, catalystSch, "pchannel.py");
-      
-      UbSchedulerPtr exitSch(new UbScheduler(10));
-      EmergencyExitCoProcessor exitCoProc(grid, exitSch, pathname, RestartCoProcessorPtr(&rp), comm);
-      
-      //create line time series
-      UbSchedulerPtr tpcSch(new UbScheduler(1,timeLineTsStart,timeLineTsStop));
-      
-      GbLine3DPtr line1(new GbLine3D(new GbPoint3D(0.0,0.004,0.00078),new GbPoint3D(0.064,0.004,0.00078)));
-      LineTimeSeriesCoProcessor lineTs1(grid, tpcSch,pathname+"/TimeSeries/line1.csv",line1, 3,comm);
-      if (myid==0) lineTs1.writeLine(pathname+"/geo/line1");
-      
-      GbLine3DPtr line2(new GbLine3D(new GbPoint3D(0.0,0.004,0.001+deltaXfine*8.0),new GbPoint3D(0.064,0.004,0.001+deltaXfine*8.0)));
-      LineTimeSeriesCoProcessor lineTs2(grid, tpcSch,pathname+"/TimeSeries/line2.csv",line2, 3,comm);
-      if (myid==0) lineTs2.writeLine(pathname+"/geo/line2");
-      
-      GbLine3DPtr line3(new GbLine3D(new GbPoint3D(0.03,0.0,0.00078),new GbPoint3D(0.03,0.008,0.00078)));
-      LineTimeSeriesCoProcessor lineTs3(grid, tpcSch,pathname+"/TimeSeries/line3.csv",line3, 3,comm);
-      if (myid==0) lineTs3.writeLine(pathname+"/geo/line3");
-      
-      GbLine3DPtr line4(new GbLine3D(new GbPoint3D(0.03,0.0,0.001+deltaXfine*8.0),new GbPoint3D(0.03,0.008,0.001+deltaXfine*8.0)));
-      LineTimeSeriesCoProcessor lineTs4(grid, tpcSch,pathname+"/TimeSeries/line4.csv",line4, 3,comm);
-      if (myid==0) lineTs4.writeLine(pathname+"/geo/line4");
-      
-      GbLine3DPtr line5(new GbLine3D(new GbPoint3D(0.0,0.004,0.002),new GbPoint3D(0.064,0.004,0.002)));
-      LineTimeSeriesCoProcessor lineTs5(grid, tpcSch,pathname+"/TimeSeries/line5.csv",line5,2,comm);
-      if (myid==0) lineTs5.writeLine(pathname+"/geo/line5");
-      
-      GbLine3DPtr line6(new GbLine3D(new GbPoint3D(0.0,0.004,0.0035),new GbPoint3D(0.064,0.004,0.0035)));
-      LineTimeSeriesCoProcessor lineTs6(grid, tpcSch,pathname+"/TimeSeries/line6.csv",line6,1,comm);
-      if (myid==0) lineTs6.writeLine(pathname+"/geo/line6");
-      
-      GbLine3DPtr line7(new GbLine3D(new GbPoint3D(0.0,0.004,0.009),new GbPoint3D(0.064,0.004,0.009)));
-      LineTimeSeriesCoProcessor lineTs7(grid, tpcSch,pathname+"/TimeSeries/line7.csv",line7,0,comm);
-      if (myid==0) lineTs7.writeLine(pathname+"/geo/line7");
-      
-      GbLine3DPtr line8(new GbLine3D(new GbPoint3D(0.0,0.004,0.015),new GbPoint3D(0.064,0.004,0.015)));
-      LineTimeSeriesCoProcessor lineTs8(grid, tpcSch,pathname+"/TimeSeries/line8.csv",line8,1,comm);
-      if (myid==0) lineTs8.writeLine(pathname+"/geo/line8");
-      
-      GbLine3DPtr line9(new GbLine3D(new GbPoint3D(0.0,0.004,0.017),new GbPoint3D(0.064,0.004,0.017)));
-      LineTimeSeriesCoProcessor lineTs9(grid, tpcSch,pathname+"/TimeSeries/line9.csv",line9,2,comm);
-      if (myid==0) lineTs9.writeLine(pathname+"/geo/line9");    
-      
-      GbLine3DPtr line10(new GbLine3D(new GbPoint3D(0.0,0.004,0.018-deltaXfine*14.0),new GbPoint3D(0.064,0.004,0.018-deltaXfine*14.0)));
-      LineTimeSeriesCoProcessor lineTs10(grid, tpcSch,pathname+"/TimeSeries/line10.csv",line10,3,comm);
-      if (myid==0) lineTs10.writeLine(pathname+"/geo/line10");  
-
-      if (myid == 0)
-      {
-         UBLOG(logINFO, "PID = " << myid << " Total Physical Memory (RAM): " << Utilities::getTotalPhysMem());
-         UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used: " << Utilities::getPhysMemUsed());
-         UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe());
-      }
-
-      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, stepSch));
-      if (averaging)
-      {
-         calculation->setTimeAveragedValuesCoProcessor(tav);
-      }
-      if (myid == 0) UBLOG(logINFO, "Simulation-start");
-      calculation->calculate();
-      if (myid == 0) UBLOG(logINFO, "Simulation-end");
-   }
-   catch (exception& e)
-   {
-      cerr << e.what() << endl << flush;
-   }
-   catch (string& s)
-   {
-      cerr << s << endl;
-   }
-   catch (...)
-   {
-      cerr << "unknown exception" << endl;
-   }
-
-}
-//////////////////////////////////////////////////////////////////////////
-int main(int argc, char* argv[])
-{
-
-   if (argv != NULL)
-   {
-      if (argv[1] != NULL)
-      {
-         run(string(argv[1]));
-      }
-      else
-      {
-         cout << "Configuration file is missing!" << endl;
-      }
-   }
-
-   return 0;
-}
+#include <iostream>
+#include <string>
+#include "VirtualFluids.h"
+
+
+
+//#include <thread>
+
+using namespace std;
+
+//////////////////////////////////////////////////////////////////////////
+void run(string configname)
+{
+   try
+   {
+      ConfigurationFile   config;
+      config.load(configname);
+
+      string          pathname          = config.getString("pathname");
+      string          pathGeo           = config.getString("pathGeo");
+      int             numOfThreads      = config.getInt("numOfThreads");
+      string          sampleFilename    = config.getString("sampleFilename");
+      vector<int>     pmNX              = config.getVector<int>("pmNX");
+      double          lthreshold        = config.getDouble("lthreshold");
+      double          uthreshold        = config.getDouble("uthreshold");
+      vector<float>   voxelDeltaX       = config.getVector<float>("voxelDeltaX");
+      vector<int>     blocknx           = config.getVector<int>("blocknx");
+      double          u_LB              = config.getDouble("u_LB");
+      double          restartStep       = config.getDouble("restartStep");
+      double          restartStepStart  = config.getDouble("restartStepStart");
+      double          endTime           = config.getDouble("endTime");
+      double          outTime           = config.getDouble("outTime");
+      double          availMem          = config.getDouble("availMem");
+      bool            rawFile           = config.getBool("rawFile");
+      bool            logToFile         = config.getBool("logToFile");
+      bool            writeSample       = config.getBool("writeSample");
+      vector<double>  pmL               = config.getVector<double>("pmL");
+      double          deltaXfine        = config.getDouble("deltaXfine");
+      int             refineLevel       = config.getInt("refineLevel");
+      bool            thinWall          = config.getBool("thinWall");
+      double          Re                = config.getDouble("Re");
+      double          channelHigh       = config.getDouble("channelHigh");
+      double          lengthFactor      = config.getDouble("lengthFactor");
+      double          forcing           = config.getDouble("forcing");
+      bool            changeQs          = config.getBool("changeQs"); 
+      double          timeAvStart       = config.getDouble("timeAvStart");
+      double          timeAvStop        = config.getDouble("timeAvStop");
+      bool            averaging         = config.getBool("averaging");
+      bool            averagingReset    = config.getBool("averagingReset");
+      double          nupsSteps         = config.getDouble("nupsSteps");
+      double          timeLineTsStart   = config.getDouble("timeLineTsStart");
+      double          timeLineTsStop    = config.getDouble("timeLineTsStop");
+
+
+      CommunicatorPtr comm = MPICommunicator::getInstance();
+      int myid = comm->getProcessID();
+
+      if (logToFile)
+      {
+#if defined(__unix__)
+         if (myid == 0)
+         {
+            const char* str = pathname.c_str();
+            mkdir(str, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
+         }
+#endif 
+
+         if (myid == 0)
+         {
+            stringstream logFilename;
+            logFilename << pathname + "/logfile" + UbSystem::toString(UbSystem::getTimeStamp()) + ".txt";
+            UbLog::output_policy::setStream(logFilename.str());
+         }
+      }
+
+      //Sleep(30000);
+
+      if (myid == 0) UBLOG(logINFO, "Testcase porous channel");
+
+      LBMReal rho_LB = 0.0;
+
+      LBMUnitConverterPtr conv = LBMUnitConverterPtr(new LBMUnitConverter());
+
+      const int baseLevel = 0;
+      double deltaXcoarse = deltaXfine*(double)(1<<refineLevel);
+
+      double coord[6];
+      bool restart;
+
+      vector<double> origin(3);
+      origin[0] = 0;
+      origin[1] = 0;
+      origin[2] = 0;
+
+      //real velocity is 49.63 m/s
+      double nu_LB;
+
+      Grid3DPtr grid(new Grid3D(comm));
+
+      //////////////////////////////////////////////////////////////////////////
+      //restart
+      UbSchedulerPtr rSch(new UbScheduler(restartStep, restartStepStart));
+      RestartCoProcessor rp(grid, rSch, comm, pathname, RestartCoProcessor::BINARY);
+      //////////////////////////////////////////////////////////////////////////
+
+      if (grid->getTimeStep() == 0)
+      {
+         if (myid == 0) UBLOG(logINFO, "new start...");
+         restart = false;
+
+         double offsetMinX3 = pmL[2];
+         
+         double offsetMaxX1 = pmL[0]*lengthFactor;
+         double offsetMaxX2 = pmL[1]*2.0;
+         double offsetMaxX3 = pmL[2] + channelHigh; //DLR-F15  //pmL[2]*2.0;
+
+         //bounding box
+         double g_minX1 = origin[0];
+         double g_minX2 = origin[1];
+         double g_minX3 = origin[2];
+
+         double g_maxX1 = origin[0] + offsetMaxX1;
+         double g_maxX2 = origin[1] + offsetMaxX2;
+         double g_maxX3 = origin[2] + offsetMaxX3;
+//////////////////////////////////////////////////////////////////////////
+         double nx1_temp = floor((g_maxX1-g_minX1) /(deltaXcoarse*(double)blocknx[0]));
+
+         deltaXcoarse = (g_maxX1-g_minX1) /(nx1_temp*(double)blocknx[0]);
+
+         g_maxX1 -= 0.5* deltaXcoarse;
+//////////////////////////////////////////////////////////////////////////
+         double blockLength = (double)blocknx[0]*deltaXcoarse;
+
+         grid->setPeriodicX1(true);
+         grid->setPeriodicX2(true);
+         grid->setPeriodicX3(false);
+         grid->setDeltaX(deltaXcoarse);
+         grid->setBlockNX(blocknx[0], blocknx[1], blocknx[2]);
+
+         GbObject3DPtr gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
+         if (myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), pathname + "/geo/gridCube", WbWriterVtkXmlBinary::getInstance());
+
+
+         GenBlocksGridVisitor genBlocks(gridCube);
+         grid->accept(genBlocks);
+         double channel_high = channelHigh; // g_maxX3-g_minX3;
+         double channel_high_LB = channel_high/deltaXcoarse;
+//////////////////////////////////////////////////////////////////////////
+         //nu_LB = 0.005;
+         nu_LB = (u_LB*channel_high_LB)/Re;
+//////////////////////////////////////////////////////////////////////////
+         if (myid == 0)
+         {
+            UBLOG(logINFO, "Parameters:");
+            UBLOG(logINFO, "Re = " << Re);
+            UBLOG(logINFO, "u_LB = " << u_LB);
+            UBLOG(logINFO, "rho_LB = " << rho_LB);
+            UBLOG(logINFO, "nu_LB = " << nu_LB);
+            UBLOG(logINFO, "dx coarse = " << deltaXcoarse << " m");
+            UBLOG(logINFO, "dx fine = " << grid->getDeltaX(refineLevel) << " m");
+            UBLOG(logINFO, "number of levels = " << refineLevel + 1);
+            UBLOG(logINFO, "number of processes = " << comm->getNumberOfProcesses());
+            UBLOG(logINFO, "number of threads = " << numOfThreads);
+            UBLOG(logINFO, "path = " << pathname);
+            UBLOG(logINFO, "Preprocess - start");
+         }
+
+         //////////////////////////////////////////////////////////////////////////
+         //refinement
+         double blockLengthX3Fine = grid->getDeltaX(refineLevel) * blocknx[2];
+
+         GbCuboid3DPtr refineBoxTop(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_maxX3-blockLengthX3Fine, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength));
+         if (myid == 0) GbSystem3D::writeGeoObject(refineBoxTop.get(), pathname + "/geo/refineBoxTop", WbWriterVtkXmlASCII::getInstance());
+
+         GbCuboid3DPtr refineBoxBottom(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3, g_maxX1+blockLength, g_maxX2+blockLength, g_minX3+offsetMinX3+blockLengthX3Fine));
+         //GbCuboid3DPtr refineBoxBottom(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3-blockLengthX3Fine, g_maxX1+blockLength, g_maxX2+blockLength, g_minX3+blockLengthX3Fine));
+         if (myid == 0) GbSystem3D::writeGeoObject(refineBoxBottom.get(), pathname + "/geo/refineBoxBottom", WbWriterVtkXmlASCII::getInstance());
+
+         if (refineLevel > 0)
+         {
+            if (myid == 0) UBLOG(logINFO, "Refinement - start");
+            RefineCrossAndInsideGbObjectHelper refineHelper(grid, refineLevel);
+            refineHelper.addGbObject(refineBoxTop, refineLevel);
+            refineHelper.addGbObject(refineBoxBottom, refineLevel);
+            refineHelper.refine();
+            if (myid == 0) UBLOG(logINFO, "Refinement - end");
+         }
+         //////////////////////////////////////////////////////////////////////////
+
+         //walls
+         GbCuboid3DPtr addWallZmin(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_minX3));
+         if (myid == 0) GbSystem3D::writeGeoObject(addWallZmin.get(), pathname+"/geo/addWallZmin", WbWriterVtkXmlASCII::getInstance());
+
+         GbCuboid3DPtr addWallZmax(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_maxX3, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength));
+         if (myid == 0) GbSystem3D::writeGeoObject(addWallZmax.get(), pathname+"/geo/addWallZmax", WbWriterVtkXmlASCII::getInstance());
+
+
+         //wall interactors
+         int bbOption = 1;
+         D3Q27BoundaryConditionAdapterPtr bcNoSlip(new D3Q27NoSlipBCAdapter(bbOption));
+         D3Q27InteractorPtr addWallZminInt(new D3Q27Interactor(addWallZmin, grid, bcNoSlip, Interactor3D::SOLID));
+         D3Q27InteractorPtr addWallZmaxInt(new D3Q27Interactor(addWallZmax, grid, bcNoSlip, Interactor3D::SOLID));
+
+		 ////////////////////////////////////////////////
+		 //TEST
+		 //GbObject3DPtr testCube(new GbCuboid3D(g_minX1 + 2.0 * blockLength, g_minX2 + 2.0 * blockLength, g_minX3 + 5.0 * blockLength, 
+			// g_minX1 + 3.0 * blockLength, g_minX2 + 3.0 * blockLength, g_minX3 + 6.0 * blockLength));
+		 //if (myid == 0) GbSystem3D::writeGeoObject(testCube.get(), pathname + "/geo/testCube", WbWriterVtkXmlBinary::getInstance());
+		 //D3Q27InteractorPtr testCubeInt(new D3Q27Interactor(testCube, grid, bcNoSlip, Interactor3D::SOLID));
+		 ///////////////////////////////////////////////
+
+         ////////////////////////////////////////////
+         //METIS
+         Grid3DVisitorPtr metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::BSW, MetisPartitioner::KWAY));
+         ////////////////////////////////////////////
+         //Zoltan
+         //Grid3DVisitorPtr zoltanVisitor(new ZoltanPartitioningGridVisitor(comm, D3Q27System::BSW, 1));
+         //grid->accept(zoltanVisitor);
+         /////delete solid blocks
+         if (myid == 0) UBLOG(logINFO, "deleteSolidBlocks - start");
+         InteractorsHelper intHelper(grid, metisVisitor);
+         intHelper.addInteractor(addWallZminInt);
+         intHelper.addInteractor(addWallZmaxInt);
+		 //////////////////////////////////////////////////////////////////////////
+		 //TEST
+		 //intHelper.addInteractor(testCubeInt);
+         //////////////////////////////////////////////////////////////////////////
+		 intHelper.selectBlocks();
+         if (myid == 0) UBLOG(logINFO, "deleteSolidBlocks - end");
+         //////////////////////////////////////
+
+         WriteBlocksCoProcessorPtr ppblocks(new WriteBlocksCoProcessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm));
+         ppblocks->process(0);
+         ppblocks.reset();
+
+         unsigned long long numberOfBlocks = (unsigned long long)grid->getNumberOfBlocks();
+         int ghostLayer = 3;
+         unsigned long long numberOfNodesPerBlock = (unsigned long long)(blocknx[0])* (unsigned long long)(blocknx[1])* (unsigned long long)(blocknx[2]);
+         unsigned long long numberOfNodes = numberOfBlocks * numberOfNodesPerBlock;
+         unsigned long long numberOfNodesPerBlockWithGhostLayer = numberOfBlocks * (blocknx[0] + ghostLayer) * (blocknx[1] + ghostLayer) * (blocknx[2] + ghostLayer);
+         double needMemAll = double(numberOfNodesPerBlockWithGhostLayer*(27 * sizeof(double) + sizeof(int) + sizeof(float) * 4));
+         double needMem = needMemAll / double(comm->getNumberOfProcesses());
+	 
+
+         if (myid == 0)
+         {
+            UBLOG(logINFO, "Number of blocks = " << numberOfBlocks);
+            UBLOG(logINFO, "Number of nodes  = " << numberOfNodes);
+            int minInitLevel = grid->getCoarsestInitializedLevel();
+            int maxInitLevel = grid->getFinestInitializedLevel();
+            for (int level = minInitLevel; level <= maxInitLevel; level++)
+            {
+               int nobl = grid->getNumberOfBlocks(level);
+               UBLOG(logINFO, "Number of blocks for level " << level << " = " << nobl);
+               UBLOG(logINFO, "Number of nodes for level " << level << " = " << nobl*numberOfNodesPerBlock);
+            }
+            UBLOG(logINFO, "Necessary memory  = " << needMemAll << " bytes");
+            UBLOG(logINFO, "Necessary memory per process = " << needMem << " bytes");
+            UBLOG(logINFO, "Available memory per process = " << availMem << " bytes");
+         }
+
+         LBMKernel3DPtr kernel = LBMKernel3DPtr(new LBMKernelETD3Q27CCLB(blocknx[0], blocknx[1], blocknx[2], LBMKernelETD3Q27CCLB::NORMAL));
+
+         mu::Parser fctForcingX1;
+         fctForcingX1.SetExpr("Fx1");
+         fctForcingX1.DefineConst("Fx1", 1.0e-6);
+
+         kernel->setWithForcing(true);
+
+         BCProcessorPtr bcProc;
+         BoundaryConditionPtr noSlipBC;
+
+         if (thinWall)
+         {
+            bcProc = BCProcessorPtr(new D3Q27ETForThinWallBCProcessor());
+            noSlipBC = BoundaryConditionPtr(new ThinWallNoSlipBoundaryCondition());
+         }
+         else
+         {
+            bcProc = BCProcessorPtr(new D3Q27ETBCProcessor());
+            noSlipBC = BoundaryConditionPtr(new NoSlipBoundaryCondition());
+         }
+
+         bcProc->addBC(noSlipBC);
+
+         kernel->setBCProcessor(bcProc);
+
+         SetKernelBlockVisitor kernelVisitor(kernel, nu_LB, availMem, needMem);
+         grid->accept(kernelVisitor);
+
+         //////////////////////////////////
+         //undef nodes for refinement
+         if (refineLevel > 0)
+         {
+            D3Q27SetUndefinedNodesBlockVisitor undefNodesVisitor;
+            grid->accept(undefNodesVisitor);
+         }
+
+
+         //BC
+         intHelper.setBC();
+
+         ////porous media
+         {
+            string samplePathname = pathGeo + "/" + sampleFilename;
+
+            GbVoxelMatrix3DPtr sample(new GbVoxelMatrix3D(pmNX[0], pmNX[1], pmNX[2], 0, lthreshold, uthreshold));
+            if (rawFile)
+            {
+               sample->readBufferedMatrixFromRawFile<unsigned short>(samplePathname, GbVoxelMatrix3D::BigEndian);
+            }
+            else
+            {
+               sample->readMatrixFromVtiASCIIFile(samplePathname);
+            }
+
+            sample->setVoxelMatrixDelta(voxelDeltaX[0], voxelDeltaX[1], voxelDeltaX[2]);
+            sample->setVoxelMatrixMininum(origin[0], origin[1], origin[2]);
+
+            int bounceBackOption = 1;
+            bool vxFile = false;
+            int i = 0;
+            for (int x = 0; x < lengthFactor; x+=2)
+            {
+               double offset = pmL[0] * (double)x;
+               //sample 0
+               if (myid == 0) UBLOG(logINFO, "sample # " << i);
+               sample->setVoxelMatrixMininum(origin[0]+offset, origin[1], origin[2]);
+               Utilities::voxelMatrixDiscretisation(sample, pathname, myid, i, grid, bounceBackOption, vxFile);
+               i++;
+
+               if (myid == 0)
+               {
+                  UBLOG(logINFO, "PID = " << myid << " Total Physical Memory (RAM): " << Utilities::getTotalPhysMem());
+                  UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used: " << Utilities::getPhysMemUsed());
+                  UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe());
+               }
+
+               //sample 1
+               if (myid == 0) UBLOG(logINFO, "sample # " << i);
+               sample->setVoxelMatrixMininum(origin[0]+pmL[0]+offset, origin[1], origin[2]);
+               sample->mirrorX();
+               Utilities::voxelMatrixDiscretisation(sample, pathname, myid, i, grid, bounceBackOption, vxFile);
+               i++;
+
+               if (myid == 0)
+               {
+                  UBLOG(logINFO, "PID = " << myid << " Total Physical Memory (RAM): " << Utilities::getTotalPhysMem());
+                  UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used: " << Utilities::getPhysMemUsed());
+                  UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe());
+               }
+
+               //sample 2
+               if (myid == 0) UBLOG(logINFO, "sample # " << i);
+               sample->setVoxelMatrixMininum(origin[0]+pmL[0]+offset, origin[1]+pmL[1], origin[2]);
+               sample->mirrorY();
+               Utilities::voxelMatrixDiscretisation(sample, pathname, myid, i, grid, bounceBackOption, vxFile);
+               i++;
+
+               if (myid == 0)
+               {
+                  UBLOG(logINFO, "PID = " << myid << " Total Physical Memory (RAM): " << Utilities::getTotalPhysMem());
+                  UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used: " << Utilities::getPhysMemUsed());
+                  UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe());
+               }
+
+               //sample 3
+               if (myid == 0) UBLOG(logINFO, "sample # " << i);
+               sample->setVoxelMatrixMininum(origin[0]+offset, origin[1]+pmL[1], origin[2]);
+               sample->mirrorX();
+               Utilities::voxelMatrixDiscretisation(sample, pathname, myid, i, grid, bounceBackOption, vxFile);
+               sample->mirrorY();
+               i++;
+            }
+
+         }
+         BoundaryConditionBlockVisitor bcVisitor;
+         grid->accept(bcVisitor);
+
+         mu::Parser inflowProfile;
+         inflowProfile.SetExpr("x3 < h ? 0.0 : uLB+1*x1-1*x2");
+		   //inflowProfile.SetExpr("uLB+1*x1-1*x2");
+         //inflowProfile.SetExpr("uLB");
+         inflowProfile.DefineConst("uLB", u_LB);
+         inflowProfile.DefineConst("h", pmL[2]);
+
+         D3Q27ETInitDistributionsBlockVisitor initVisitor(nu_LB, rho_LB);
+         initVisitor.setVx1(inflowProfile);
+         //initVisitor.setVx1(u_LB);
+         grid->accept(initVisitor);
+
+         ////set connectors
+         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
+         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nu_LB, iProcessor);
+         grid->accept(setConnsVisitor);
+
+         //domain decomposition for threads
+         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
+         grid->accept(pqPartVisitor);
+
+         //Postrozess
+         UbSchedulerPtr geoSch(new UbScheduler(1));
+         MacroscopicQuantitiesCoProcessorPtr ppgeo(
+            new MacroscopicQuantitiesCoProcessor(grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, true));
+         ppgeo->process(0);
+         ppgeo.reset();
+
+         coord[0] = g_minX1;
+         coord[1] = g_minX2;
+         coord[2] = g_minX3;
+         coord[3] = g_maxX1;
+         coord[4] = g_maxX2;
+         coord[5] = g_maxX3;
+
+         ////////////////////////////////////////////////////////
+         FILE * pFile;
+         string str = pathname + "/checkpoints/coord.txt";
+         pFile = fopen(str.c_str(), "w");
+         fprintf(pFile, "%g\n", deltaXcoarse);
+         fprintf(pFile, "%g\n", nu_LB);
+         fprintf(pFile, "%g\n", coord[0]);
+         fprintf(pFile, "%g\n", coord[1]);
+         fprintf(pFile, "%g\n", coord[2]);
+         fprintf(pFile, "%g\n", coord[3]);
+         fprintf(pFile, "%g\n", coord[4]);
+         fprintf(pFile, "%g\n", coord[5]);
+         fclose(pFile);
+         ////////////////////////////////////////////////////////
+
+         if (myid == 0) UBLOG(logINFO, "Preprozess - end");
+      }
+      else
+      {
+         ////////////////////////////////////////////////////////
+         FILE * pFile;
+         string str = pathname + "/checkpoints/coord.txt";
+         pFile = fopen(str.c_str(), "r");
+         fscanf(pFile, "%lg\n", &deltaXcoarse);
+         fscanf(pFile, "%lg\n", &nu_LB);
+         fscanf(pFile, "%lg\n", &coord[0]);
+         fscanf(pFile, "%lg\n", &coord[1]);
+         fscanf(pFile, "%lg\n", &coord[2]);
+         fscanf(pFile, "%lg\n", &coord[3]);
+         fscanf(pFile, "%lg\n", &coord[4]);
+         fscanf(pFile, "%lg\n", &coord[5]);
+         fclose(pFile);
+         ////////////////////////////////////////////////////////
+
+         if (myid == 0)
+         {
+            UBLOG(logINFO, "Parameters:");
+            UBLOG(logINFO, "Re = " << Re);
+            UBLOG(logINFO, "u_LB = " << u_LB);
+            UBLOG(logINFO, "rho_LB = " << rho_LB);
+            UBLOG(logINFO, "nu_LB = " << nu_LB);
+            UBLOG(logINFO, "dx coarse = " << deltaXcoarse << " m");
+            UBLOG(logINFO, "dx fine = " << grid->getDeltaX(refineLevel) << " m");
+            UBLOG(logINFO, "number of levels = " << refineLevel + 1);
+            UBLOG(logINFO, "numOfThreads = " << numOfThreads);
+            UBLOG(logINFO, "path = " << pathname);
+         }
+         
+         /////////////////////////////////////////////////////////////
+         /////////////////////////////////////////////////////////////
+         //bounding box
+//          double offsetMinX3 = pmL[2];
+// 
+//          double offsetMaxX1 = pmL[0]*lengthFactor;
+//          double offsetMaxX2 = pmL[1]*2.0;
+//          double offsetMaxX3 = channelHigh;
+// 
+//          double g_minX1 = origin[0];
+//          double g_minX2 = origin[1];
+//          double g_minX3 = origin[2];
+// 
+//          double g_maxX1 = origin[0]+offsetMaxX1;
+//          double g_maxX2 = origin[1]+offsetMaxX2;
+//          double g_maxX3 = origin[2]+offsetMaxX3;
+// 
+//          double blockLength = (double)blocknx[0]*deltaXcoarse;
+// 
+//          GbCuboid3DPtr addWallZmin(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_minX3+offsetMinX3));
+//          if (myid==0) GbSystem3D::writeGeoObject(addWallZmin.get(), pathname+"/geo/addWallZmin", WbWriterVtkXmlASCII::getInstance());
+//          int bbOption = 1;
+//          D3Q27BoundaryConditionAdapterPtr bcNoSlip(new D3Q27NoSlipBCAdapter(bbOption));
+//          D3Q27InteractorPtr addWallZminInt(new D3Q27Interactor(addWallZmin, grid, bcNoSlip, Interactor3D::SOLID));
+// 
+//          SetSolidOrTransBlockVisitor v1(addWallZminInt, SetSolidOrTransBlockVisitor::SOLID);
+//          grid->accept(v1);
+//          SetSolidOrTransBlockVisitor v2(addWallZminInt, SetSolidOrTransBlockVisitor::TRANS);
+//          grid->accept(v2);
+// 
+//          std::vector<Block3DPtr> blocks;
+//          std::vector<Block3DPtr>& sb = addWallZminInt->getSolidBlockSet();
+//          if (myid==0) UBLOG(logINFO, "number of solid blocks = "<<sb.size());
+//          blocks.insert(blocks.end(), sb.begin(), sb.end());
+//          std::vector<Block3DPtr>& tb = addWallZminInt->getTransBlockSet();
+//          if (myid==0) UBLOG(logINFO, "number of trans blocks = "<<tb.size());
+//          blocks.insert(blocks.end(), tb.begin(), tb.end());
+// 
+//          if (myid==0) UBLOG(logINFO, "number of blocks = "<<blocks.size());
+// 
+//          BOOST_FOREACH(Block3DPtr block, blocks)
+//          {
+//             block->setActive(true);
+//             addWallZminInt->setDifferencesToGbObject3D(block);
+//          }
+// 
+//          //////////////////////////////////////////////
+//          ////METIS
+//          //Grid3DVisitorPtr metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::BSW, MetisPartitioner::KWAY));
+//          //////////////////////////////////////////////
+//          ///////delete solid blocks
+//          //if (myid==0) UBLOG(logINFO, "deleteSolidBlocks - start");
+//          //InteractorsHelper intHelper(grid, metisVisitor);
+//          //intHelper.addInteractor(addWallZminInt);
+//          //intHelper.selectBlocks();
+//          //if (myid==0) UBLOG(logINFO, "deleteSolidBlocks - end");
+//          ////////////////////////////////////////
+//          //intHelper.setBC();
+//          //////////////////////////////////////////////////////////////
+// 
+//          BoundaryConditionBlockVisitor bcVisitor;
+//          grid->accept(bcVisitor);
+// 
+//          WriteBlocksCoProcessorPtr ppblocks(new WriteBlocksCoProcessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm));
+//          ppblocks->process(0);
+//          ppblocks.reset();
+// 
+//          UbSchedulerPtr geoSch(new UbScheduler(1));
+//          MacroscopicQuantitiesCoProcessorPtr ppgeo(
+//             new MacroscopicQuantitiesCoProcessor(grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, true));
+//          ppgeo->process(0);
+//          ppgeo.reset();
+         ////////////////////////////////////////////////////////////////
+
+         //set connectors
+         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
+         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nu_LB, iProcessor);
+         grid->accept(setConnsVisitor);
+
+         restart = true;
+
+         if (myid == 0) UBLOG(logINFO, "Restart - end");
+      }
+      UbSchedulerPtr nupsSch(new UbScheduler(nupsSteps));
+      NUPSCounterCoProcessor npr(grid, nupsSch, numOfThreads, comm);
+
+      UbSchedulerPtr stepSch(new UbScheduler(outTime));
+
+      MacroscopicQuantitiesCoProcessor pp(grid, stepSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv);
+
+      double startStep = grid->getTimeStep();
+
+      //UbSchedulerPtr visSch(new UbScheduler());
+      //visSch->addSchedule(40000,40000,40000000);
+      //UbSchedulerPtr resSchRMS(new UbScheduler());
+      //resSchRMS->addSchedule(40000, startStep, 40000000);
+      //UbSchedulerPtr resSchMeans(new UbScheduler());
+      //resSchMeans->addSchedule(40000, startStep, 40000000);
+      //UbSchedulerPtr stepAvSch(new UbScheduler());
+      //stepAvSch->addSchedule(100, 0, 10000000);
+      //AverageValuesPostprocessor Avpp(grid, pathname, WbWriterVtkXmlBinary::getInstance(),
+      //   stepSch/*wann wird rausgeschrieben*/, stepAvSch/*wann wird gemittelt*/, resSchMeans, resSchRMS/*wann wird resettet*/, restart);
+
+
+      UbSchedulerPtr AdjForcSch(new UbScheduler());
+      AdjForcSch->addSchedule(10, 0, 10000000);
+      D3Q27IntegrateValuesHelperPtr intValHelp(new D3Q27IntegrateValuesHelper(grid, comm,
+         coord[0], coord[1], coord[2],
+         coord[3], coord[4], coord[5]));
+      if (myid == 0) GbSystem3D::writeGeoObject(intValHelp->getBoundingBox().get(), pathname + "/geo/IntValHelp", WbWriterVtkXmlBinary::getInstance());
+
+      double vxTarget=u_LB;
+      AdjustForcingCoProcessor AdjForcPPPtr(grid, AdjForcSch, pathname, intValHelp, vxTarget, comm);
+
+      //mu::Parser decrViscFunc;
+      //decrViscFunc.SetExpr("nue0+c0/(t+1)/(t+1)");
+      //decrViscFunc.DefineConst("nue0", nu_LB*4.0);
+      //decrViscFunc.DefineConst("c0", 0.1);
+      //UbSchedulerPtr DecrViscSch(new UbScheduler());
+      //DecrViscSch->addSchedule(10, 0, 1000);
+      //DecreaseViscosityPostprocessor decrViscPPPtr(grid, DecrViscSch, &decrViscFunc, comm);
+
+	  //if (changeQs)
+	  //{
+		 // double z1 = pmL[2];
+		 // D3Q27IntegrateValuesHelperPtr intValHelp2(new D3Q27IntegrateValuesHelper(grid, comm,
+			//  coord[0], coord[1], z1 - deltaXfine,
+			//  coord[3], coord[4], z1 + deltaXfine));
+		 // if (myid == 0) GbSystem3D::writeGeoObject(intValHelp2->getBoundingBox().get(), pathname + "/geo/intValHelp2", WbWriterVtkXmlBinary::getInstance());
+		 // Utilities::ChangeRandomQs(intValHelp2);
+	  //}
+
+      std::vector<double> levelCoords;
+      std::vector<int> levels;
+      std::vector<double> bounds;
+      bounds.push_back(0);
+      bounds.push_back(0);
+      bounds.push_back(1e-3);
+      bounds.push_back(0.064);
+      bounds.push_back(0.008);
+      bounds.push_back(0.018);
+      levels.push_back(3);
+      levels.push_back(2);
+      levels.push_back(1);
+      levels.push_back(0);
+      levels.push_back(1);
+      levels.push_back(2);
+      levels.push_back(3);
+      levelCoords.push_back(0);
+      levelCoords.push_back(0.0016-6.0*deltaXfine);
+      levelCoords.push_back(0.0016);
+      levelCoords.push_back(0.0024-6.0*deltaXfine*2.0);
+      levelCoords.push_back(0.0024);
+      levelCoords.push_back(0.0048-6.0*deltaXfine*4.0);
+      levelCoords.push_back(0.0048);
+      levelCoords.push_back(0.0144);
+      levelCoords.push_back(0.0144+6.0*deltaXfine*4.0);
+      levelCoords.push_back(0.0168);
+      levelCoords.push_back(0.0168+6.0*deltaXfine*2.0);
+      levelCoords.push_back(0.0176);
+      levelCoords.push_back(0.0176+6.0*deltaXfine);
+      levelCoords.push_back(0.018);
+      UbSchedulerPtr tavSch(new UbScheduler(1, timeAvStart, timeAvStop));
+      TimeAveragedValuesCoProcessorPtr tav(new TimeAveragedValuesCoProcessor(grid, pathname, WbWriterVtkXmlBinary::getInstance(), tavSch, comm,
+         TimeAveragedValuesCoProcessor::Velocity | TimeAveragedValuesCoProcessor::Fluctuations | TimeAveragedValuesCoProcessor::Triplecorrelations//));
+         ,levels, levelCoords, bounds, false));
+      if (averagingReset)
+      {
+	     tav->reset();
+      }
+      //UbSchedulerPtr catalystSch(new UbScheduler(1));
+      //InSituCatalystCoProcessor catalyst(grid, catalystSch, "pchannel.py");
+      
+      UbSchedulerPtr exitSch(new UbScheduler(10));
+      EmergencyExitCoProcessor exitCoProc(grid, exitSch, pathname, RestartCoProcessorPtr(&rp), comm);
+      
+      //create line time series
+      UbSchedulerPtr tpcSch(new UbScheduler(1,timeLineTsStart,timeLineTsStop));
+      
+      GbLine3DPtr line1(new GbLine3D(new GbPoint3D(0.0,0.004,0.00078),new GbPoint3D(0.064,0.004,0.00078)));
+      LineTimeSeriesCoProcessor lineTs1(grid, tpcSch,pathname+"/TimeSeries/line1.csv",line1, 3,comm);
+      if (myid==0) lineTs1.writeLine(pathname+"/geo/line1");
+      
+      GbLine3DPtr line2(new GbLine3D(new GbPoint3D(0.0,0.004,0.001+deltaXfine*8.0),new GbPoint3D(0.064,0.004,0.001+deltaXfine*8.0)));
+      LineTimeSeriesCoProcessor lineTs2(grid, tpcSch,pathname+"/TimeSeries/line2.csv",line2, 3,comm);
+      if (myid==0) lineTs2.writeLine(pathname+"/geo/line2");
+      
+      GbLine3DPtr line3(new GbLine3D(new GbPoint3D(0.03,0.0,0.00078),new GbPoint3D(0.03,0.008,0.00078)));
+      LineTimeSeriesCoProcessor lineTs3(grid, tpcSch,pathname+"/TimeSeries/line3.csv",line3, 3,comm);
+      if (myid==0) lineTs3.writeLine(pathname+"/geo/line3");
+      
+      GbLine3DPtr line4(new GbLine3D(new GbPoint3D(0.03,0.0,0.001+deltaXfine*8.0),new GbPoint3D(0.03,0.008,0.001+deltaXfine*8.0)));
+      LineTimeSeriesCoProcessor lineTs4(grid, tpcSch,pathname+"/TimeSeries/line4.csv",line4, 3,comm);
+      if (myid==0) lineTs4.writeLine(pathname+"/geo/line4");
+      
+      GbLine3DPtr line5(new GbLine3D(new GbPoint3D(0.0,0.004,0.002),new GbPoint3D(0.064,0.004,0.002)));
+      LineTimeSeriesCoProcessor lineTs5(grid, tpcSch,pathname+"/TimeSeries/line5.csv",line5,2,comm);
+      if (myid==0) lineTs5.writeLine(pathname+"/geo/line5");
+      
+      GbLine3DPtr line6(new GbLine3D(new GbPoint3D(0.0,0.004,0.0035),new GbPoint3D(0.064,0.004,0.0035)));
+      LineTimeSeriesCoProcessor lineTs6(grid, tpcSch,pathname+"/TimeSeries/line6.csv",line6,1,comm);
+      if (myid==0) lineTs6.writeLine(pathname+"/geo/line6");
+      
+      GbLine3DPtr line7(new GbLine3D(new GbPoint3D(0.0,0.004,0.009),new GbPoint3D(0.064,0.004,0.009)));
+      LineTimeSeriesCoProcessor lineTs7(grid, tpcSch,pathname+"/TimeSeries/line7.csv",line7,0,comm);
+      if (myid==0) lineTs7.writeLine(pathname+"/geo/line7");
+      
+      GbLine3DPtr line8(new GbLine3D(new GbPoint3D(0.0,0.004,0.015),new GbPoint3D(0.064,0.004,0.015)));
+      LineTimeSeriesCoProcessor lineTs8(grid, tpcSch,pathname+"/TimeSeries/line8.csv",line8,1,comm);
+      if (myid==0) lineTs8.writeLine(pathname+"/geo/line8");
+      
+      GbLine3DPtr line9(new GbLine3D(new GbPoint3D(0.0,0.004,0.017),new GbPoint3D(0.064,0.004,0.017)));
+      LineTimeSeriesCoProcessor lineTs9(grid, tpcSch,pathname+"/TimeSeries/line9.csv",line9,2,comm);
+      if (myid==0) lineTs9.writeLine(pathname+"/geo/line9");    
+      
+      GbLine3DPtr line10(new GbLine3D(new GbPoint3D(0.0,0.004,0.018-deltaXfine*14.0),new GbPoint3D(0.064,0.004,0.018-deltaXfine*14.0)));
+      LineTimeSeriesCoProcessor lineTs10(grid, tpcSch,pathname+"/TimeSeries/line10.csv",line10,3,comm);
+      if (myid==0) lineTs10.writeLine(pathname+"/geo/line10");  
+
+      if (myid == 0)
+      {
+         UBLOG(logINFO, "PID = " << myid << " Total Physical Memory (RAM): " << Utilities::getTotalPhysMem());
+         UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used: " << Utilities::getPhysMemUsed());
+         UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe());
+      }
+
+      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, stepSch));
+      if (averaging)
+      {
+         calculation->setTimeAveragedValuesCoProcessor(tav);
+      }
+      if (myid == 0) UBLOG(logINFO, "Simulation-start");
+      calculation->calculate();
+      if (myid == 0) UBLOG(logINFO, "Simulation-end");
+   }
+   catch (exception& e)
+   {
+      cerr << e.what() << endl << flush;
+   }
+   catch (string& s)
+   {
+      cerr << s << endl;
+   }
+   catch (...)
+   {
+      cerr << "unknown exception" << endl;
+   }
+
+}
+//////////////////////////////////////////////////////////////////////////
+int main(int argc, char* argv[])
+{
+
+   if (argv != NULL)
+   {
+      if (argv[1] != NULL)
+      {
+         run(string(argv[1]));
+      }
+      else
+      {
+         cout << "Configuration file is missing!" << endl;
+      }
+   }
+
+   return 0;
+}
diff --git a/apps/cpu/pChannel/pchannel.py b/apps/cpu/pChannel/pchannel.py
index 6a58fd005cdc695c6b016ccc1726cf187912ae2b..a32efd60f157bc13a5fa6351a910f42405ee546c 100644
--- a/apps/cpu/pChannel/pchannel.py
+++ b/apps/cpu/pChannel/pchannel.py
@@ -1,85 +1,85 @@
-try: paraview.simple
-except: from paraview.simple import *
-
-from paraview import coprocessing
-
-
-#--------------------------------------------------------------
-# Code generated from cpstate.py to create the CoProcessor.
-
-
-# ----------------------- CoProcessor definition -----------------------
-
-def CreateCoProcessor():
-  def _CreatePipeline(coprocessor, datadescription):
-    class Pipeline:
-      filename_3_pvtu = coprocessor.CreateProducer( datadescription, "input" )
-
-      #~ Slice1 = Slice( guiName="Slice1", Crinkleslice=0, SliceOffsetValues=[0.0], Triangulatetheslice=1, SliceType="Plane" )
-      #~ Slice1.SliceType.Offset = 0.0
-      #~ Slice1.SliceType.Origin = [34.5, 32.45, 27.95]
-      #~ Slice1.SliceType.Normal = [1.0, 0.0, 0.0]
-#~ 
-      #~ ParallelPolyDataWriter1 = coprocessor.CreateWriter( XMLPPolyDataWriter, "slice_%t.pvtp", 10 )
-
-      SetActiveSource(filename_3_pvtu)
-      #~ ParallelUnstructuredGridWriter1 = coprocessor.CreateWriter( XMLPUnstructuredGridWriter, "fullgrid_%t.pvtu", 100 )
-
-    return Pipeline()
-
-  class CoProcessor(coprocessing.CoProcessor):
-    def CreatePipeline(self, datadescription):
-      self.Pipeline = _CreatePipeline(self, datadescription)
-
-  coprocessor = CoProcessor()
-  freqs = {'input': [10, 100]}
-  coprocessor.SetUpdateFrequencies(freqs)
-  return coprocessor
-
-#--------------------------------------------------------------
-# Global variables that will hold the pipeline for each timestep
-# Creating the CoProcessor object, doesn't actually create the ParaView pipeline.
-# It will be automatically setup when coprocessor.UpdateProducers() is called the
-# first time.
-coprocessor = CreateCoProcessor()
-
-#--------------------------------------------------------------
-# Enable Live-Visualizaton with ParaView
-coprocessor.EnableLiveVisualization(True)
-
-
-# ---------------------- Data Selection method ----------------------
-
-def RequestDataDescription(datadescription):
-    "Callback to populate the request for current timestep"
-    global coprocessor
-    if datadescription.GetForceOutput() == True:
-        # We are just going to request all fields and meshes from the simulation
-        # code/adaptor.
-        for i in range(datadescription.GetNumberOfInputDescriptions()):
-            datadescription.GetInputDescription(i).AllFieldsOn()
-            datadescription.GetInputDescription(i).GenerateMeshOn()
-        return
-
-    # setup requests for all inputs based on the requirements of the
-    # pipeline.
-    coprocessor.LoadRequestedData(datadescription)
-
-# ------------------------ Processing method ------------------------
-
-def DoCoProcessing(datadescription):
-    "Callback to do co-processing for current timestep"
-    global coprocessor
-
-    # Update the coprocessor by providing it the newly generated simulation data.
-    # If the pipeline hasn't been setup yet, this will setup the pipeline.
-    coprocessor.UpdateProducers(datadescription)
-
-    # Write output data, if appropriate.
-    coprocessor.WriteData(datadescription);
-
-    # Write image capture (Last arg: rescale lookup table), if appropriate.
-    coprocessor.WriteImages(datadescription, rescale_lookuptable=False)
-
-    # Live Visualization, if enabled.
-    coprocessor.DoLiveVisualization(datadescription, "localhost", 22222)
+try: paraview.simple
+except: from paraview.simple import *
+
+from paraview import coprocessing
+
+
+#--------------------------------------------------------------
+# Code generated from cpstate.py to create the CoProcessor.
+
+
+# ----------------------- CoProcessor definition -----------------------
+
+def CreateCoProcessor():
+  def _CreatePipeline(coprocessor, datadescription):
+    class Pipeline:
+      filename_3_pvtu = coprocessor.CreateProducer( datadescription, "input" )
+
+      #~ Slice1 = Slice( guiName="Slice1", Crinkleslice=0, SliceOffsetValues=[0.0], Triangulatetheslice=1, SliceType="Plane" )
+      #~ Slice1.SliceType.Offset = 0.0
+      #~ Slice1.SliceType.Origin = [34.5, 32.45, 27.95]
+      #~ Slice1.SliceType.Normal = [1.0, 0.0, 0.0]
+#~ 
+      #~ ParallelPolyDataWriter1 = coprocessor.CreateWriter( XMLPPolyDataWriter, "slice_%t.pvtp", 10 )
+
+      SetActiveSource(filename_3_pvtu)
+      #~ ParallelUnstructuredGridWriter1 = coprocessor.CreateWriter( XMLPUnstructuredGridWriter, "fullgrid_%t.pvtu", 100 )
+
+    return Pipeline()
+
+  class CoProcessor(coprocessing.CoProcessor):
+    def CreatePipeline(self, datadescription):
+      self.Pipeline = _CreatePipeline(self, datadescription)
+
+  coprocessor = CoProcessor()
+  freqs = {'input': [10, 100]}
+  coprocessor.SetUpdateFrequencies(freqs)
+  return coprocessor
+
+#--------------------------------------------------------------
+# Global variables that will hold the pipeline for each timestep
+# Creating the CoProcessor object, doesn't actually create the ParaView pipeline.
+# It will be automatically setup when coprocessor.UpdateProducers() is called the
+# first time.
+coprocessor = CreateCoProcessor()
+
+#--------------------------------------------------------------
+# Enable Live-Visualizaton with ParaView
+coprocessor.EnableLiveVisualization(True)
+
+
+# ---------------------- Data Selection method ----------------------
+
+def RequestDataDescription(datadescription):
+    "Callback to populate the request for current timestep"
+    global coprocessor
+    if datadescription.GetForceOutput() == True:
+        # We are just going to request all fields and meshes from the simulation
+        # code/adaptor.
+        for i in range(datadescription.GetNumberOfInputDescriptions()):
+            datadescription.GetInputDescription(i).AllFieldsOn()
+            datadescription.GetInputDescription(i).GenerateMeshOn()
+        return
+
+    # setup requests for all inputs based on the requirements of the
+    # pipeline.
+    coprocessor.LoadRequestedData(datadescription)
+
+# ------------------------ Processing method ------------------------
+
+def DoCoProcessing(datadescription):
+    "Callback to do co-processing for current timestep"
+    global coprocessor
+
+    # Update the coprocessor by providing it the newly generated simulation data.
+    # If the pipeline hasn't been setup yet, this will setup the pipeline.
+    coprocessor.UpdateProducers(datadescription)
+
+    # Write output data, if appropriate.
+    coprocessor.WriteData(datadescription);
+
+    # Write image capture (Last arg: rescale lookup table), if appropriate.
+    coprocessor.WriteImages(datadescription, rescale_lookuptable=False)
+
+    # Live Visualization, if enabled.
+    coprocessor.DoLiveVisualization(datadescription, "localhost", 22222)
diff --git a/apps/cpu/pDisk/CMakeLists.txt b/apps/cpu/pDisk/CMakeLists.txt
index 75a6476e7d052d3d0a3ccc561a4d775395012cfb..96e8db4cf640ca05b12093e572e474a87cabf046 100644
--- a/apps/cpu/pDisk/CMakeLists.txt
+++ b/apps/cpu/pDisk/CMakeLists.txt
@@ -1,25 +1,25 @@
-CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
-
-########################################################
-## C++ PROJECT                                       ###
-########################################################
-PROJECT(pDisk)
-
-INCLUDE(${SOURCE_ROOT}/lib/IncludsList.txt) 
-
-#################################################################
-###   LOCAL FILES                                             ###
-#################################################################
-FILE(GLOB SPECIFIC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.h
-                         ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
-                         ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp  )
- 
-SET(ALL_SOURCES ${ALL_SOURCES} ${SPECIFIC_FILES})
-SOURCE_GROUP(src FILES ${SPECIFIC_FILES})
-  
-SET(CAB_ADDITIONAL_LINK_LIBRARIES vfluids)
-
-#################################################################
-###   CREATE PROJECT                                          ###
-#################################################################
-CREATE_CAB_PROJECT(pdisk BINARY)
+CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
+
+########################################################
+## C++ PROJECT                                       ###
+########################################################
+PROJECT(pDisk)
+
+INCLUDE(${SOURCE_ROOT}/lib/IncludsList.txt) 
+
+#################################################################
+###   LOCAL FILES                                             ###
+#################################################################
+FILE(GLOB SPECIFIC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.h
+                         ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
+                         ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp  )
+ 
+SET(ALL_SOURCES ${ALL_SOURCES} ${SPECIFIC_FILES})
+SOURCE_GROUP(src FILES ${SPECIFIC_FILES})
+  
+SET(CAB_ADDITIONAL_LINK_LIBRARIES vfluids)
+
+#################################################################
+###   CREATE PROJECT                                          ###
+#################################################################
+CREATE_CAB_PROJECT(pdisk BINARY)
diff --git a/apps/cpu/pDisk/configBombadilPdisk.cfg b/apps/cpu/pDisk/configBombadilPdisk.cfg
index a600e4cddd3e0f5375cc80be8fc8ac579c8e7900..95df549a4712d46c93b3d656b758c83dbff4fdc5 100644
--- a/apps/cpu/pDisk/configBombadilPdisk.cfg
+++ b/apps/cpu/pDisk/configBombadilPdisk.cfg
@@ -1,36 +1,36 @@
-#
-#Simulation parameters for porous disk
-#
-
-pathname = d:/temp/pDisk
-pathGeo = d:/Data/PorousDisk
-numOfThreads = 1
-availMem = 3e9
-logToFile = false
-
-#geometry
-diskFilename = PorousDiskDR.stl 
-mastFilename = Mast.stl
-
-#grid
-fineNodeDx = 10  # 0.3 / 0.2
-blocknx = 16 16 16
-refineLevel = 2
-geoLength = 5000 2000 2000
-
-#physic
-Re = 6.66e4
-u_LB = 0.01
-rho_LB = 0.0
-
-#averaging
-restart = false
-averaging = false
-
-restartStep = 20000
-restartStepStart=20000
-
-endTime = 60000
-outTime = 100
-
-
+#
+#Simulation parameters for porous disk
+#
+
+pathname = d:/temp/pDisk
+pathGeo = d:/Data/PorousDisk
+numOfThreads = 1
+availMem = 3e9
+logToFile = false
+
+#geometry
+diskFilename = PorousDiskDR.stl 
+mastFilename = Mast.stl
+
+#grid
+fineNodeDx = 10  # 0.3 / 0.2
+blocknx = 16 16 16
+refineLevel = 2
+geoLength = 5000 2000 2000
+
+#physic
+Re = 6.66e4
+u_LB = 0.01
+rho_LB = 0.0
+
+#averaging
+restart = false
+averaging = false
+
+restartStep = 20000
+restartStepStart=20000
+
+endTime = 60000
+outTime = 100
+
+
diff --git a/apps/cpu/pDisk/configHlrnPorousDisk.cfg b/apps/cpu/pDisk/configHlrnPorousDisk.cfg
index d3cfec356c0ed0adf157cf800678e02eed48e640..da50c9dac4ef4c61a782e57c7e941e7650a9fd3b 100644
--- a/apps/cpu/pDisk/configHlrnPorousDisk.cfg
+++ b/apps/cpu/pDisk/configHlrnPorousDisk.cfg
@@ -1,36 +1,36 @@
-#
-#Simulation parameters for porous disk
-#
-
-pathname = /gfs1/work/niikonst/scratch/pDisk
-pathGeo = /gfs1/work/niikonst/data/PorousDisk
-numOfThreads = 24
-availMem = 128e9
-logToFile = true
-
-#geometry
-diskFilename = PorousDiskD2.stl 
-mastFilename = Mast.stl
-
-#grid
-fineNodeDx = 1.9  
-blocknx = 16 16 16
-refineLevel = 4
-geoLength = 5000 2000 2000
-
-#physic
-Re = 6.66e4
-u_LB = 0.01
-rho_LB = 0.0
-
-#averaging
-restart = false
-averaging = false
-
-restartStep = 10000
-restartStepStart=10000
-
-outTime = 10000
-
-endTime = 100000
-
+#
+#Simulation parameters for porous disk
+#
+
+pathname = /gfs1/work/niikonst/scratch/pDisk
+pathGeo = /gfs1/work/niikonst/data/PorousDisk
+numOfThreads = 24
+availMem = 128e9
+logToFile = true
+
+#geometry
+diskFilename = PorousDiskD2.stl 
+mastFilename = Mast.stl
+
+#grid
+fineNodeDx = 1.9  
+blocknx = 16 16 16
+refineLevel = 4
+geoLength = 5000 2000 2000
+
+#physic
+Re = 6.66e4
+u_LB = 0.01
+rho_LB = 0.0
+
+#averaging
+restart = false
+averaging = false
+
+restartStep = 10000
+restartStepStart=10000
+
+outTime = 10000
+
+endTime = 100000
+
diff --git a/apps/cpu/pDisk/pdisk.cpp b/apps/cpu/pDisk/pdisk.cpp
index e86cab201d3043328e004af3f41b47cc7677cbf6..f24b6b0c185e7ddb45bef85caefb550828e2e998 100644
--- a/apps/cpu/pDisk/pdisk.cpp
+++ b/apps/cpu/pDisk/pdisk.cpp
@@ -1,427 +1,427 @@
-
-
-#include <iostream>
-#include <string>
-#include <math.h> 
-
-#include <vfluids.h>
-
-using namespace std;
-
-
-void run(string configname)
-{
-   try
-   {
-      Configuration   config;
-      config.load(configname);
-
-      string          pathname          = config.getString("pathname");
-      string          pathGeo           = config.getString("pathGeo");
-      int             numOfThreads      = config.getInt("numOfThreads");
-      string          diskFilename      = config.getString("diskFilename");
-      string          mastFilename      = config.getString("mastFilename");
-      vector<int>     blocknx           = config.getVector<int>("blocknx");
-      double          restartStep       = config.getDouble("restartStep");
-      double          restartStepStart  = config.getDouble("restartStepStart");
-      double          endTime           = config.getDouble("endTime");
-      double          outTime           = config.getDouble("outTime");
-      double          availMem          = config.getDouble("availMem");
-      bool            logToFile         = config.getBool("logToFile");
-      vector<double>  geoLength         = config.getVector<double>("geoLength");
-      int             refineLevel       = config.getInt("refineLevel");
-      double          Re                = config.getDouble("Re");
-      double          u_LB              = config.getDouble("u_LB");
-      double          rho_LB            = config.getDouble("rho_LB");
-      double          fineNodeDx        = config.getDouble("fineNodeDx");
-      bool            restart           = config.getBool("restart");
-      bool            averaging         = config.getBool("averaging");
-
-      //UbLog::reportingLevel() = logDEBUG5;
-
-      CommunicatorPtr comm = MPICommunicator::getInstance();
-      int myid = comm->getProcessID();
-
-
-#if defined(__unix__)
-      if (myid==0) 
-      {
-         const char* str = pathname.c_str();
-         int status=mkdir(str, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
-      }
-#endif 
-
-      if(myid == 0 && logToFile)
-      {
-         stringstream logFilename;
-         logFilename <<  pathname + "/logfile"+UbSystem::toString(UbSystem::getTimeStamp())+"_"+UbSystem::toString(myid)+".txt";
-         UbLog::output_policy::setStream(logFilename.str());
-      }
-
-      if(myid==0) UBLOG(logINFO,"Test case: porous disk");
-
-      int baseLevel = 0;
-
-      double coarseNodeDx = fineNodeDx * (double)(1<<refineLevel);//geowerte
-
-      double blockLengthx1 = blocknx[0]*coarseNodeDx; //geowerte
-      double blockLengthx2 = blockLengthx1;
-      double blockLengthx3 = blockLengthx1;
-
-      bool periodicx1 = false;
-      bool periodicx2 = true;
-      bool periodicx3 = false;
-
-      int sizeSP= (int)(500.0/coarseNodeDx); //500 mm sponge layer
-      mu::Parser spongeLayer;
-      spongeLayer.SetExpr("x1>=(sizeX-sizeSP)/dt ? (sizeX-x1)/sizeSP/2.0 + 0.5 : 1.0");
-      spongeLayer.DefineConst("sizeX", 5000.0/coarseNodeDx);
-      spongeLayer.DefineConst("sizeSP", sizeSP);
-
-      //##########################################################################
-      //## physical parameters
-      //##########################################################################
-      double nu_LB = (u_LB*(geoLength[2]/coarseNodeDx))/Re;
-
-      LBMUnitConverterPtr unitConverter = LBMUnitConverterPtr(new LBMUnitConverter());
-      
-      Grid3DPtr grid(new Grid3D(comm));
-
-      //////////////////////////////////////////////////////////////////////////
-      //restart
-      UbSchedulerPtr rSch(new UbScheduler(restartStep, restartStepStart));
-      RestartPostprocessor rp(grid, rSch, comm, pathname, RestartPostprocessor::BINARY);
-      //////////////////////////////////////////////////////////////////////////
-
-      
-
-      if (grid->getTimeStep() == 0)
-      {
-         if (myid==0) UBLOG(logINFO, "new start..");
-
-         if (myid==0) UBLOG(logINFO, "load geometry start");
-         GbTriFaceMesh3DPtr geoMast(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(pathGeo+"/"+mastFilename, "mast"));
-         if (myid == 0) GbSystem3D::writeGeoObject(geoMast.get(), pathname + "/geo/geoMast", WbWriterVtkXmlBinary::getInstance());
-
-         GbTriFaceMesh3DPtr geoDisk(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(pathGeo+"/"+diskFilename, "disk"));
-         if (myid == 0) GbSystem3D::writeGeoObject(geoDisk.get(), pathname + "/geo/geoDisk", WbWriterVtkXmlBinary::getInstance());
-         if (myid==0) UBLOG(logINFO, "load geometry end");
-
-         //bounding box
-         double g_minX1 = geoMast->getX1Centroid() - 2000.0;
-         double g_minX2 = geoMast->getX2Centroid() - 1000.0;
-         double g_minX3 = geoMast->getX3Minimum();
-
-         double g_maxX1 = g_minX1 + geoLength[0];
-         double g_maxX2 = g_minX2 + geoLength[1];
-         double g_maxX3 = g_minX3 + geoLength[2];
-
-         double nx1_temp = floor((g_maxX2-g_minX2) /(coarseNodeDx*(double)blocknx[1]));
-
-         coarseNodeDx = (g_maxX2-g_minX2) /(nx1_temp*(double)blocknx[1]);
-
-         fineNodeDx = coarseNodeDx / (double)(1<<refineLevel);
-
-         //set grid
-         grid->setDeltaX(coarseNodeDx);
-         grid->setBlockNX(blocknx[0], blocknx[1], blocknx[2]);
-         grid->setPeriodicX1(periodicx1);
-         grid->setPeriodicX2(periodicx2);
-         grid->setPeriodicX3(periodicx3);
-
-
-         GbObject3DPtr gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
-         if (myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), pathname+"/geo/gridCube", WbWriterVtkXmlASCII::getInstance());
-
-         GenBlocksGridVisitor genBlocks(gridCube);
-         grid->accept(genBlocks);
-
-         //////////////////////////////////////////////////////////////////////////
-         if (myid == 0)
-         {
-            UBLOG(logINFO, "*****************************************");
-            UBLOG(logINFO, "* Parameters                            *");
-            UBLOG(logINFO, "* Re                = "<<Re);
-            UBLOG(logINFO, "* nu_LB             = "<<nu_LB);
-            UBLOG(logINFO, "* u_LB              = "<<u_LB);
-            UBLOG(logINFO, "* cdx               = "<<coarseNodeDx<<" mm");
-            UBLOG(logINFO, "* fdx               = "<<fineNodeDx<<" mm");
-            UBLOG(logINFO, "* nx1/2/3           = "<<grid->getNX1()<<"/"<<grid->getNX2()<<"/"<<grid->getNX3());
-            UBLOG(logINFO, "* blocknx1/2/3      = "<<blocknx[0]<<"/"<<blocknx[1]<<"/"<<blocknx[2]);
-            UBLOG(logINFO, "* x1Periodic        = "<<periodicx1);
-            UBLOG(logINFO, "* x2Periodic        = "<<periodicx2);
-            UBLOG(logINFO, "* x3Periodic        = "<<periodicx3);
-            UBLOG(logINFO, "* number of levels  = "<<refineLevel+1);
-            UBLOG(logINFO, "* path              = "<<pathname);
-
-            UBLOG(logINFO, "*****************************************");
-            UBLOG(logINFO, "* number of threads    = "<<numOfThreads);
-            UBLOG(logINFO, "* number of processes  = "<<comm->getNumberOfProcesses());
-            UBLOG(logINFO, "*****************************************");
-            //UBLOGML(logINFO, "UnitConverter:"<<unitConverter->toString());
-            //UBLOG(logINFO, "*****************************************");     
-         }
-
-         ////walls
-         GbCuboid3DPtr addWallYmin(new GbCuboid3D(g_minX1-blockLengthx1, g_minX2-blockLengthx1, g_minX3-blockLengthx1, g_maxX1+blockLengthx1, g_minX2, g_maxX3+blockLengthx1));
-         if (myid == 0) GbSystem3D::writeGeoObject(addWallYmin.get(), pathname+"/geo/addWallYmin", WbWriterVtkXmlASCII::getInstance());
-
-         GbCuboid3DPtr addWallYmax(new GbCuboid3D(g_minX1-blockLengthx1, g_maxX2, g_minX3-blockLengthx1, g_maxX1+blockLengthx1, g_maxX2+blockLengthx1, g_maxX3+blockLengthx1));
-         if (myid == 0) GbSystem3D::writeGeoObject(addWallYmax.get(), pathname+"/geo/addWallYmax", WbWriterVtkXmlASCII::getInstance());
-
-         GbCuboid3DPtr addWallZmin(new GbCuboid3D(g_minX1 - blockLengthx1, g_minX2 - blockLengthx1, g_minX3 - blockLengthx1, g_maxX1 + blockLengthx1, g_maxX2 + blockLengthx1, g_minX3));
-         if (myid == 0) GbSystem3D::writeGeoObject(addWallZmin.get(), pathname + "/geo/addWallZmin", WbWriterVtkXmlASCII::getInstance());
-
-         GbCuboid3DPtr addWallZmax(new GbCuboid3D(g_minX1 - blockLengthx1, g_minX2 - blockLengthx1, g_maxX3, g_maxX1 + blockLengthx1, g_maxX2 + blockLengthx1, g_maxX3 + blockLengthx1));
-         if (myid == 0) GbSystem3D::writeGeoObject(addWallZmax.get(), pathname + "/geo/addWallZmax", WbWriterVtkXmlASCII::getInstance());
-
-         int bbOption = 1; //0=simple Bounce Back, 1=quadr. BB
-         D3Q27BoundaryConditionAdapterPtr bcNoSlip(new D3Q27NoSlipBCAdapter(bbOption));
-         D3Q27InteractorPtr addWallYminInt(new D3Q27Interactor(addWallYmin, grid, bcNoSlip, Interactor3D::SOLID));
-         D3Q27InteractorPtr addWallYmaxInt(new D3Q27Interactor(addWallYmax, grid, bcNoSlip, Interactor3D::SOLID));
-         D3Q27InteractorPtr addWallZminInt(new D3Q27Interactor(addWallZmin, grid, bcNoSlip, Interactor3D::SOLID));
-         D3Q27BoundaryConditionAdapterPtr bcSlip(new D3Q27SlipBCAdapter());
-         D3Q27InteractorPtr addWallZmaxInt(new D3Q27Interactor(addWallZmax, grid, bcSlip, Interactor3D::SOLID));
-
-         D3Q27TriFaceMeshInteractorPtr mastInt(new D3Q27TriFaceMeshInteractor(geoMast, grid, bcNoSlip, Interactor3D::SOLID, Interactor3D::POINTS));
-         D3Q27TriFaceMeshInteractorPtr diskInt(new D3Q27TriFaceMeshInteractor(geoDisk, grid, bcNoSlip, Interactor3D::SOLID, Interactor3D::POINTS));
-
-         //inflow
-         GbCuboid3DPtr geoInflow(new GbCuboid3D(g_minX1-blockLengthx1, g_minX2-blockLengthx1, g_minX3-blockLengthx1, g_minX1, g_maxX2+blockLengthx1, g_maxX3+blockLengthx1));
-         if (myid == 0) GbSystem3D::writeGeoObject(geoInflow.get(), pathname + "/geo/geoInflow", WbWriterVtkXmlASCII::getInstance());
-         D3Q27InteractorPtr inflowInt(new D3Q27Interactor(geoInflow, grid, Interactor3D::SOLID));
-
-         //inflow
-         mu::Parser inflowProfile;
-         //inflowProfile.SetExpr("u_ref*(((x3+Z_ref)/Z_ref)^a)");
-         inflowProfile.SetExpr("u_ref");
-         inflowProfile.DefineConst("u_ref", u_LB);
-         inflowProfile.DefineConst("Z_ref", 300.0);
-         inflowProfile.DefineConst("a", 0.143);
-
-         D3Q27BoundaryConditionAdapterPtr velBCAdapter = D3Q27BoundaryConditionAdapterPtr(new D3Q27VelocityBCAdapter(true, false, false, inflowProfile, 0, D3Q27BCFunction::INFCONST));
-         inflowInt->addBCAdapter(velBCAdapter);
-
-         //outflow
-         GbCuboid3DPtr geoOutflow(new GbCuboid3D(g_maxX1, g_minX2-blockLengthx1, g_minX3-blockLengthx1, g_maxX1+blockLengthx1, g_maxX2+blockLengthx1, g_maxX3+blockLengthx1));
-         if (myid == 0) GbSystem3D::writeGeoObject(geoOutflow.get(), pathname + "/geo/geoOutflow", WbWriterVtkXmlASCII::getInstance());
-         D3Q27BoundaryConditionAdapterPtr denBCAdapter(new D3Q27DensityBCAdapter(rho_LB));
-         D3Q27InteractorPtr outflowInt(new D3Q27Interactor(geoOutflow, grid, denBCAdapter, Interactor3D::SOLID));
-
-         {
-            if (myid == 0) UBLOG(logINFO, "Write blocks - start"); 
-            BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm));
-            if (myid == 0)
-               ppblocks->update(0);
-            if (myid == 0) UBLOG(logINFO, "Write blocks - end"); 
-         }
-         ////////////////////////////////////////////
-         //METIS
-         Grid3DVisitorPtr metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B));	
-        
-         //////////////////////////////////////////////////////////////////////////
-         //refinement
-         double diameter = geoDisk->getLengthX2();
-         GbCuboid3DPtr refineDiskBox(new GbCuboid3D(geoDisk->getX1Centroid()-0.2*diameter, geoDisk->getX2Centroid()-0.6*diameter, geoDisk->getX3Minimum()-diameter, 
-            geoDisk->getX1Centroid() + 1.0*diameter, geoDisk->getX2Centroid()+0.6*diameter, geoDisk->getX3Maximum() + 0.05*diameter));
-         if (myid == 0) GbSystem3D::writeGeoObject(refineDiskBox.get(), pathname + "/geo/refineDiskBox", WbWriterVtkXmlASCII::getInstance());
-
-         if (refineLevel > 0)
-         {
-            if(myid == 0) UBLOG(logINFO,"Refinement - start");	
-            RefineCrossAndInsideGbObjectHelper refineHelper(grid, refineLevel);
-            refineHelper.addGbObject(refineDiskBox, refineLevel);
-            refineHelper.refine();
-            if(myid == 0) UBLOG(logINFO,"Refinement - end");	
-         }
-
-         {
-            if (myid == 0) UBLOG(logINFO, "Write blocks - start");
-            BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm));
-            if (myid == 0)
-               ppblocks->update(1);
-            if (myid == 0) UBLOG(logINFO, "Write blocks - end");
-         }
-         ////////////////////////////////////////////
-         /////delete solid blocks
-         if(myid == 0) UBLOG(logINFO,"deleteSolidBlocks - start");
-         InteractorsHelper intHelper(grid, metisVisitor);
-         intHelper.addInteractor(mastInt);
-         intHelper.addInteractor(diskInt);
-         //intHelper.addInteractor(addWallYminInt);
-         //intHelper.addInteractor(addWallYmaxInt);
-         intHelper.addInteractor(addWallZminInt);
-         intHelper.addInteractor(addWallZmaxInt);
-         intHelper.addInteractor(outflowInt);
-         intHelper.addInteractor(inflowInt);
-         intHelper.selectBlocks();
-         if(myid == 0) UBLOG(logINFO,"deleteSolidBlocks - end");	 
-         //////////////////////////////////////
-
-         unsigned long nob = grid->getNumberOfBlocks();
-         int gl = 3;
-         unsigned long nodb = (blocknx[0])* (blocknx[1])* (blocknx[2]);
-         unsigned long nod = nob * (blocknx[0])* (blocknx[1])* (blocknx[2]);
-         unsigned long nodg = nob * (blocknx[0] + gl) * (blocknx[1] + gl) * (blocknx[2] + gl);
-         double needMemAll = double(nodg*(27 * sizeof(double) + sizeof(int) + sizeof(float) * 4));
-         double needMem = needMemAll / double(comm->getNumberOfProcesses());
-
-         if (myid == 0)
-         {
-            UBLOG(logINFO, "Number of blocks = " << nob);
-            UBLOG(logINFO, "Number of nodes  = " << nod);
-            int minInitLevel = grid->getCoarsestInitializedLevel();
-            int maxInitLevel = grid->getFinestInitializedLevel();
-            for (int level = minInitLevel; level <= maxInitLevel; level++)
-            {
-               int nobl = grid->getNumberOfBlocks(level);
-               UBLOG(logINFO, "Number of blocks for level " << level << " = " << nobl);
-               UBLOG(logINFO, "Number of nodes for level " << level << " = " << nobl*nodb);
-            }
-            UBLOG(logINFO, "Necessary memory  = " << needMemAll << " bytes");
-            UBLOG(logINFO, "Necessary memory per process = " << needMem << " bytes");
-            UBLOG(logINFO, "Available memory per process = " << availMem << " bytes");
-         }
-
-         ////////////////////////////
-         LBMKernel3DPtr kernel;
-         //kernel = LBMKernel3DPtr(new LBMKernelETD3Q27CCLB(blocknx[0], blocknx[1], blocknx[2], LBMKernelETD3Q27CCLB::NORMAL));
-         //with sponge layer
-         kernel = LBMKernel3DPtr(new LBMKernelETD3Q27CCLBWithSpongeLayer(blocknx[0], blocknx[1], blocknx[2], LBMKernelETD3Q27CCLB::NORMAL));
-         kernel->setWithSpongeLayer(true);
-         kernel->setSpongeLayer(spongeLayer);
-
-         BCProcessorPtr bcProc(new D3Q27ETBCProcessor());
-         BoundaryConditionPtr densityBC(new NonEqDensityBoundaryCondition());
-         BoundaryConditionPtr noSlipBC(new NoSlipBoundaryCondition());
-         BoundaryConditionPtr velocityBC(new VelocityBoundaryCondition());
-         BoundaryConditionPtr slipBC(new SlipBoundaryCondition());
-
-         bcProc->addBC(densityBC);
-         bcProc->addBC(noSlipBC);
-         bcProc->addBC(velocityBC);
-         bcProc->addBC(slipBC);
-         kernel->setBCProcessor(bcProc);
-         SetKernelBlockVisitor kernelVisitor(kernel, nu_LB, availMem, needMem);
-         grid->accept(kernelVisitor);
-         //////////////////////////////////
-         //undef nodes
-         if (refineLevel > 0)
-         {
-            D3Q27SetUndefinedNodesBlockVisitor undefNodesVisitor;
-            grid->accept(undefNodesVisitor);
-         }
-         //////////////////////////////////////////
-         //set connectors
-         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
-         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nu_LB, iProcessor);
-         grid->accept( setConnsVisitor );
-
-         //domain decomposition for threads
-         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
-         grid->accept(pqPartVisitor);
-
-         intHelper.setBC();
-
-         BoundaryConditionBlockVisitor bcVisitor;
-         grid->accept(bcVisitor);
-
-         //initialization of decompositions
-         D3Q27ETInitDistributionsBlockVisitor initVisitor( nu_LB,rho_LB);
-         //initVisitor.setVx1(inflowProfile);
-         initVisitor.setVx1(u_LB);
-         grid->accept(initVisitor);
-
-         //Postprozess
-         UbSchedulerPtr geoSch(new UbScheduler(1));
-         D3Q27MacroscopicQuantitiesPostprocessorPtr ppgeo(
-            new D3Q27MacroscopicQuantitiesPostprocessor(grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), 
-            unitConverter, true));
-         ppgeo->update(0);
-         ppgeo.reset();
-         geoSch.reset();
-
-         if(myid == 0) UBLOG(logINFO,"Preprozess - end");      
-      }
-      else
-      {
-         //set connectors
-         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
-         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nu_LB, iProcessor);
-         grid->accept( setConnsVisitor );
-         //domain decomposition for threads
-         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
-         grid->accept(pqPartVisitor);
-         //SetSpongeLayerBlockVisitor ssp(spongeLayer);
-         //grid->accept(ssp);
-         if(myid == 0) UBLOG(logINFO,"Restart - end"); 
-      }
-      UbSchedulerPtr visSch(new UbScheduler(outTime));
-
-      double startStep = 80000;
-
-      if (averaging)
-      {
-         UbSchedulerPtr resSchRMS(new UbScheduler());
-         resSchRMS->addSchedule(100000, 80000, 10000000);
-         UbSchedulerPtr resSchMeans(new UbScheduler());
-         resSchMeans->addSchedule(100000, 80000, 10000000);
-         UbSchedulerPtr stepAvSch(new UbScheduler());
-         int averageInterval=100;
-         stepAvSch->addSchedule(averageInterval, 0, 10000000);
-
-         AverageValuesPostprocessor Avpp(grid, pathname, WbWriterVtkXmlBinary::getInstance(),
-            visSch/*wann wird rausgeschrieben*/, stepAvSch/*wann wird gemittelt*/, resSchMeans, resSchRMS/*wann wird resettet*/, restart);
-      }
-
-      D3Q27MacroscopicQuantitiesPostprocessor pp(grid, visSch, pathname, WbWriterVtkXmlBinary::getInstance(), unitConverter);
-
-      UbSchedulerPtr nupsSch(new UbScheduler(10, 10, 30));
-      nupsSch->addSchedule(1000, 1000, 1000000000);
-      NUPSCounterPostprocessor npr(grid, nupsSch, numOfThreads, comm);
-
-      if(myid == 0)
-      {
-         UBLOG(logINFO,"PID = " << myid << " Total Physical Memory (RAM): " << Utilities::getTotalPhysMem());
-         UBLOG(logINFO,"PID = " << myid << " Physical Memory currently used: " << Utilities::getPhysMemUsed());
-         UBLOG(logINFO,"PID = " << myid << " Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe());
-      }
-
-      //double endTime = 80001;
-      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, visSch));
-      if(myid == 0) UBLOG(logINFO,"Simulation-start");
-      calculation->calculate();
-      if(myid == 0) UBLOG(logINFO,"Simulation-end");
-   }
-   catch(std::exception& e)
-   {
-      cerr << e.what() << endl << flush;
-   }
-   catch(std::string& s)
-   {
-      cerr << s << endl;
-   }
-   catch(...)
-   {
-      cerr << "unknown exception" << endl;
-   }
-
-}
-int main(int argc, char* argv[])
-{
-
-   if (argv != NULL)
-   {
-      if (argv[1] != NULL)
-      {
-         run(string(argv[1]));
-      }
-      else
-      {
-         cout << "Configuration file is missing!" << endl;
-      }
-   }
-
-   return 0;
-}
-
+
+
+#include <iostream>
+#include <string>
+#include <math.h> 
+
+#include <vfluids.h>
+
+using namespace std;
+
+
+void run(string configname)
+{
+   try
+   {
+      Configuration   config;
+      config.load(configname);
+
+      string          pathname          = config.getString("pathname");
+      string          pathGeo           = config.getString("pathGeo");
+      int             numOfThreads      = config.getInt("numOfThreads");
+      string          diskFilename      = config.getString("diskFilename");
+      string          mastFilename      = config.getString("mastFilename");
+      vector<int>     blocknx           = config.getVector<int>("blocknx");
+      double          restartStep       = config.getDouble("restartStep");
+      double          restartStepStart  = config.getDouble("restartStepStart");
+      double          endTime           = config.getDouble("endTime");
+      double          outTime           = config.getDouble("outTime");
+      double          availMem          = config.getDouble("availMem");
+      bool            logToFile         = config.getBool("logToFile");
+      vector<double>  geoLength         = config.getVector<double>("geoLength");
+      int             refineLevel       = config.getInt("refineLevel");
+      double          Re                = config.getDouble("Re");
+      double          u_LB              = config.getDouble("u_LB");
+      double          rho_LB            = config.getDouble("rho_LB");
+      double          fineNodeDx        = config.getDouble("fineNodeDx");
+      bool            restart           = config.getBool("restart");
+      bool            averaging         = config.getBool("averaging");
+
+      //UbLog::reportingLevel() = logDEBUG5;
+
+      CommunicatorPtr comm = MPICommunicator::getInstance();
+      int myid = comm->getProcessID();
+
+
+#if defined(__unix__)
+      if (myid==0) 
+      {
+         const char* str = pathname.c_str();
+         int status=mkdir(str, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
+      }
+#endif 
+
+      if(myid == 0 && logToFile)
+      {
+         stringstream logFilename;
+         logFilename <<  pathname + "/logfile"+UbSystem::toString(UbSystem::getTimeStamp())+"_"+UbSystem::toString(myid)+".txt";
+         UbLog::output_policy::setStream(logFilename.str());
+      }
+
+      if(myid==0) UBLOG(logINFO,"Test case: porous disk");
+
+      int baseLevel = 0;
+
+      double coarseNodeDx = fineNodeDx * (double)(1<<refineLevel);//geowerte
+
+      double blockLengthx1 = blocknx[0]*coarseNodeDx; //geowerte
+      double blockLengthx2 = blockLengthx1;
+      double blockLengthx3 = blockLengthx1;
+
+      bool periodicx1 = false;
+      bool periodicx2 = true;
+      bool periodicx3 = false;
+
+      int sizeSP= (int)(500.0/coarseNodeDx); //500 mm sponge layer
+      mu::Parser spongeLayer;
+      spongeLayer.SetExpr("x1>=(sizeX-sizeSP)/dt ? (sizeX-x1)/sizeSP/2.0 + 0.5 : 1.0");
+      spongeLayer.DefineConst("sizeX", 5000.0/coarseNodeDx);
+      spongeLayer.DefineConst("sizeSP", sizeSP);
+
+      //##########################################################################
+      //## physical parameters
+      //##########################################################################
+      double nu_LB = (u_LB*(geoLength[2]/coarseNodeDx))/Re;
+
+      LBMUnitConverterPtr unitConverter = LBMUnitConverterPtr(new LBMUnitConverter());
+      
+      Grid3DPtr grid(new Grid3D(comm));
+
+      //////////////////////////////////////////////////////////////////////////
+      //restart
+      UbSchedulerPtr rSch(new UbScheduler(restartStep, restartStepStart));
+      RestartPostprocessor rp(grid, rSch, comm, pathname, RestartPostprocessor::BINARY);
+      //////////////////////////////////////////////////////////////////////////
+
+      
+
+      if (grid->getTimeStep() == 0)
+      {
+         if (myid==0) UBLOG(logINFO, "new start..");
+
+         if (myid==0) UBLOG(logINFO, "load geometry start");
+         GbTriFaceMesh3DPtr geoMast(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(pathGeo+"/"+mastFilename, "mast"));
+         if (myid == 0) GbSystem3D::writeGeoObject(geoMast.get(), pathname + "/geo/geoMast", WbWriterVtkXmlBinary::getInstance());
+
+         GbTriFaceMesh3DPtr geoDisk(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(pathGeo+"/"+diskFilename, "disk"));
+         if (myid == 0) GbSystem3D::writeGeoObject(geoDisk.get(), pathname + "/geo/geoDisk", WbWriterVtkXmlBinary::getInstance());
+         if (myid==0) UBLOG(logINFO, "load geometry end");
+
+         //bounding box
+         double g_minX1 = geoMast->getX1Centroid() - 2000.0;
+         double g_minX2 = geoMast->getX2Centroid() - 1000.0;
+         double g_minX3 = geoMast->getX3Minimum();
+
+         double g_maxX1 = g_minX1 + geoLength[0];
+         double g_maxX2 = g_minX2 + geoLength[1];
+         double g_maxX3 = g_minX3 + geoLength[2];
+
+         double nx1_temp = floor((g_maxX2-g_minX2) /(coarseNodeDx*(double)blocknx[1]));
+
+         coarseNodeDx = (g_maxX2-g_minX2) /(nx1_temp*(double)blocknx[1]);
+
+         fineNodeDx = coarseNodeDx / (double)(1<<refineLevel);
+
+         //set grid
+         grid->setDeltaX(coarseNodeDx);
+         grid->setBlockNX(blocknx[0], blocknx[1], blocknx[2]);
+         grid->setPeriodicX1(periodicx1);
+         grid->setPeriodicX2(periodicx2);
+         grid->setPeriodicX3(periodicx3);
+
+
+         GbObject3DPtr gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
+         if (myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), pathname+"/geo/gridCube", WbWriterVtkXmlASCII::getInstance());
+
+         GenBlocksGridVisitor genBlocks(gridCube);
+         grid->accept(genBlocks);
+
+         //////////////////////////////////////////////////////////////////////////
+         if (myid == 0)
+         {
+            UBLOG(logINFO, "*****************************************");
+            UBLOG(logINFO, "* Parameters                            *");
+            UBLOG(logINFO, "* Re                = "<<Re);
+            UBLOG(logINFO, "* nu_LB             = "<<nu_LB);
+            UBLOG(logINFO, "* u_LB              = "<<u_LB);
+            UBLOG(logINFO, "* cdx               = "<<coarseNodeDx<<" mm");
+            UBLOG(logINFO, "* fdx               = "<<fineNodeDx<<" mm");
+            UBLOG(logINFO, "* nx1/2/3           = "<<grid->getNX1()<<"/"<<grid->getNX2()<<"/"<<grid->getNX3());
+            UBLOG(logINFO, "* blocknx1/2/3      = "<<blocknx[0]<<"/"<<blocknx[1]<<"/"<<blocknx[2]);
+            UBLOG(logINFO, "* x1Periodic        = "<<periodicx1);
+            UBLOG(logINFO, "* x2Periodic        = "<<periodicx2);
+            UBLOG(logINFO, "* x3Periodic        = "<<periodicx3);
+            UBLOG(logINFO, "* number of levels  = "<<refineLevel+1);
+            UBLOG(logINFO, "* path              = "<<pathname);
+
+            UBLOG(logINFO, "*****************************************");
+            UBLOG(logINFO, "* number of threads    = "<<numOfThreads);
+            UBLOG(logINFO, "* number of processes  = "<<comm->getNumberOfProcesses());
+            UBLOG(logINFO, "*****************************************");
+            //UBLOGML(logINFO, "UnitConverter:"<<unitConverter->toString());
+            //UBLOG(logINFO, "*****************************************");     
+         }
+
+         ////walls
+         GbCuboid3DPtr addWallYmin(new GbCuboid3D(g_minX1-blockLengthx1, g_minX2-blockLengthx1, g_minX3-blockLengthx1, g_maxX1+blockLengthx1, g_minX2, g_maxX3+blockLengthx1));
+         if (myid == 0) GbSystem3D::writeGeoObject(addWallYmin.get(), pathname+"/geo/addWallYmin", WbWriterVtkXmlASCII::getInstance());
+
+         GbCuboid3DPtr addWallYmax(new GbCuboid3D(g_minX1-blockLengthx1, g_maxX2, g_minX3-blockLengthx1, g_maxX1+blockLengthx1, g_maxX2+blockLengthx1, g_maxX3+blockLengthx1));
+         if (myid == 0) GbSystem3D::writeGeoObject(addWallYmax.get(), pathname+"/geo/addWallYmax", WbWriterVtkXmlASCII::getInstance());
+
+         GbCuboid3DPtr addWallZmin(new GbCuboid3D(g_minX1 - blockLengthx1, g_minX2 - blockLengthx1, g_minX3 - blockLengthx1, g_maxX1 + blockLengthx1, g_maxX2 + blockLengthx1, g_minX3));
+         if (myid == 0) GbSystem3D::writeGeoObject(addWallZmin.get(), pathname + "/geo/addWallZmin", WbWriterVtkXmlASCII::getInstance());
+
+         GbCuboid3DPtr addWallZmax(new GbCuboid3D(g_minX1 - blockLengthx1, g_minX2 - blockLengthx1, g_maxX3, g_maxX1 + blockLengthx1, g_maxX2 + blockLengthx1, g_maxX3 + blockLengthx1));
+         if (myid == 0) GbSystem3D::writeGeoObject(addWallZmax.get(), pathname + "/geo/addWallZmax", WbWriterVtkXmlASCII::getInstance());
+
+         int bbOption = 1; //0=simple Bounce Back, 1=quadr. BB
+         D3Q27BoundaryConditionAdapterPtr bcNoSlip(new D3Q27NoSlipBCAdapter(bbOption));
+         D3Q27InteractorPtr addWallYminInt(new D3Q27Interactor(addWallYmin, grid, bcNoSlip, Interactor3D::SOLID));
+         D3Q27InteractorPtr addWallYmaxInt(new D3Q27Interactor(addWallYmax, grid, bcNoSlip, Interactor3D::SOLID));
+         D3Q27InteractorPtr addWallZminInt(new D3Q27Interactor(addWallZmin, grid, bcNoSlip, Interactor3D::SOLID));
+         D3Q27BoundaryConditionAdapterPtr bcSlip(new D3Q27SlipBCAdapter());
+         D3Q27InteractorPtr addWallZmaxInt(new D3Q27Interactor(addWallZmax, grid, bcSlip, Interactor3D::SOLID));
+
+         D3Q27TriFaceMeshInteractorPtr mastInt(new D3Q27TriFaceMeshInteractor(geoMast, grid, bcNoSlip, Interactor3D::SOLID, Interactor3D::POINTS));
+         D3Q27TriFaceMeshInteractorPtr diskInt(new D3Q27TriFaceMeshInteractor(geoDisk, grid, bcNoSlip, Interactor3D::SOLID, Interactor3D::POINTS));
+
+         //inflow
+         GbCuboid3DPtr geoInflow(new GbCuboid3D(g_minX1-blockLengthx1, g_minX2-blockLengthx1, g_minX3-blockLengthx1, g_minX1, g_maxX2+blockLengthx1, g_maxX3+blockLengthx1));
+         if (myid == 0) GbSystem3D::writeGeoObject(geoInflow.get(), pathname + "/geo/geoInflow", WbWriterVtkXmlASCII::getInstance());
+         D3Q27InteractorPtr inflowInt(new D3Q27Interactor(geoInflow, grid, Interactor3D::SOLID));
+
+         //inflow
+         mu::Parser inflowProfile;
+         //inflowProfile.SetExpr("u_ref*(((x3+Z_ref)/Z_ref)^a)");
+         inflowProfile.SetExpr("u_ref");
+         inflowProfile.DefineConst("u_ref", u_LB);
+         inflowProfile.DefineConst("Z_ref", 300.0);
+         inflowProfile.DefineConst("a", 0.143);
+
+         D3Q27BoundaryConditionAdapterPtr velBCAdapter = D3Q27BoundaryConditionAdapterPtr(new D3Q27VelocityBCAdapter(true, false, false, inflowProfile, 0, D3Q27BCFunction::INFCONST));
+         inflowInt->addBCAdapter(velBCAdapter);
+
+         //outflow
+         GbCuboid3DPtr geoOutflow(new GbCuboid3D(g_maxX1, g_minX2-blockLengthx1, g_minX3-blockLengthx1, g_maxX1+blockLengthx1, g_maxX2+blockLengthx1, g_maxX3+blockLengthx1));
+         if (myid == 0) GbSystem3D::writeGeoObject(geoOutflow.get(), pathname + "/geo/geoOutflow", WbWriterVtkXmlASCII::getInstance());
+         D3Q27BoundaryConditionAdapterPtr denBCAdapter(new D3Q27DensityBCAdapter(rho_LB));
+         D3Q27InteractorPtr outflowInt(new D3Q27Interactor(geoOutflow, grid, denBCAdapter, Interactor3D::SOLID));
+
+         {
+            if (myid == 0) UBLOG(logINFO, "Write blocks - start"); 
+            BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm));
+            if (myid == 0)
+               ppblocks->update(0);
+            if (myid == 0) UBLOG(logINFO, "Write blocks - end"); 
+         }
+         ////////////////////////////////////////////
+         //METIS
+         Grid3DVisitorPtr metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B));	
+        
+         //////////////////////////////////////////////////////////////////////////
+         //refinement
+         double diameter = geoDisk->getLengthX2();
+         GbCuboid3DPtr refineDiskBox(new GbCuboid3D(geoDisk->getX1Centroid()-0.2*diameter, geoDisk->getX2Centroid()-0.6*diameter, geoDisk->getX3Minimum()-diameter, 
+            geoDisk->getX1Centroid() + 1.0*diameter, geoDisk->getX2Centroid()+0.6*diameter, geoDisk->getX3Maximum() + 0.05*diameter));
+         if (myid == 0) GbSystem3D::writeGeoObject(refineDiskBox.get(), pathname + "/geo/refineDiskBox", WbWriterVtkXmlASCII::getInstance());
+
+         if (refineLevel > 0)
+         {
+            if(myid == 0) UBLOG(logINFO,"Refinement - start");	
+            RefineCrossAndInsideGbObjectHelper refineHelper(grid, refineLevel);
+            refineHelper.addGbObject(refineDiskBox, refineLevel);
+            refineHelper.refine();
+            if(myid == 0) UBLOG(logINFO,"Refinement - end");	
+         }
+
+         {
+            if (myid == 0) UBLOG(logINFO, "Write blocks - start");
+            BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm));
+            if (myid == 0)
+               ppblocks->update(1);
+            if (myid == 0) UBLOG(logINFO, "Write blocks - end");
+         }
+         ////////////////////////////////////////////
+         /////delete solid blocks
+         if(myid == 0) UBLOG(logINFO,"deleteSolidBlocks - start");
+         InteractorsHelper intHelper(grid, metisVisitor);
+         intHelper.addInteractor(mastInt);
+         intHelper.addInteractor(diskInt);
+         //intHelper.addInteractor(addWallYminInt);
+         //intHelper.addInteractor(addWallYmaxInt);
+         intHelper.addInteractor(addWallZminInt);
+         intHelper.addInteractor(addWallZmaxInt);
+         intHelper.addInteractor(outflowInt);
+         intHelper.addInteractor(inflowInt);
+         intHelper.selectBlocks();
+         if(myid == 0) UBLOG(logINFO,"deleteSolidBlocks - end");	 
+         //////////////////////////////////////
+
+         unsigned long nob = grid->getNumberOfBlocks();
+         int gl = 3;
+         unsigned long nodb = (blocknx[0])* (blocknx[1])* (blocknx[2]);
+         unsigned long nod = nob * (blocknx[0])* (blocknx[1])* (blocknx[2]);
+         unsigned long nodg = nob * (blocknx[0] + gl) * (blocknx[1] + gl) * (blocknx[2] + gl);
+         double needMemAll = double(nodg*(27 * sizeof(double) + sizeof(int) + sizeof(float) * 4));
+         double needMem = needMemAll / double(comm->getNumberOfProcesses());
+
+         if (myid == 0)
+         {
+            UBLOG(logINFO, "Number of blocks = " << nob);
+            UBLOG(logINFO, "Number of nodes  = " << nod);
+            int minInitLevel = grid->getCoarsestInitializedLevel();
+            int maxInitLevel = grid->getFinestInitializedLevel();
+            for (int level = minInitLevel; level <= maxInitLevel; level++)
+            {
+               int nobl = grid->getNumberOfBlocks(level);
+               UBLOG(logINFO, "Number of blocks for level " << level << " = " << nobl);
+               UBLOG(logINFO, "Number of nodes for level " << level << " = " << nobl*nodb);
+            }
+            UBLOG(logINFO, "Necessary memory  = " << needMemAll << " bytes");
+            UBLOG(logINFO, "Necessary memory per process = " << needMem << " bytes");
+            UBLOG(logINFO, "Available memory per process = " << availMem << " bytes");
+         }
+
+         ////////////////////////////
+         LBMKernel3DPtr kernel;
+         //kernel = LBMKernel3DPtr(new LBMKernelETD3Q27CCLB(blocknx[0], blocknx[1], blocknx[2], LBMKernelETD3Q27CCLB::NORMAL));
+         //with sponge layer
+         kernel = LBMKernel3DPtr(new LBMKernelETD3Q27CCLBWithSpongeLayer(blocknx[0], blocknx[1], blocknx[2], LBMKernelETD3Q27CCLB::NORMAL));
+         kernel->setWithSpongeLayer(true);
+         kernel->setSpongeLayer(spongeLayer);
+
+         BCProcessorPtr bcProc(new D3Q27ETBCProcessor());
+         BoundaryConditionPtr densityBC(new NonEqDensityBoundaryCondition());
+         BoundaryConditionPtr noSlipBC(new NoSlipBoundaryCondition());
+         BoundaryConditionPtr velocityBC(new VelocityBoundaryCondition());
+         BoundaryConditionPtr slipBC(new SlipBoundaryCondition());
+
+         bcProc->addBC(densityBC);
+         bcProc->addBC(noSlipBC);
+         bcProc->addBC(velocityBC);
+         bcProc->addBC(slipBC);
+         kernel->setBCProcessor(bcProc);
+         SetKernelBlockVisitor kernelVisitor(kernel, nu_LB, availMem, needMem);
+         grid->accept(kernelVisitor);
+         //////////////////////////////////
+         //undef nodes
+         if (refineLevel > 0)
+         {
+            D3Q27SetUndefinedNodesBlockVisitor undefNodesVisitor;
+            grid->accept(undefNodesVisitor);
+         }
+         //////////////////////////////////////////
+         //set connectors
+         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
+         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nu_LB, iProcessor);
+         grid->accept( setConnsVisitor );
+
+         //domain decomposition for threads
+         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
+         grid->accept(pqPartVisitor);
+
+         intHelper.setBC();
+
+         BoundaryConditionBlockVisitor bcVisitor;
+         grid->accept(bcVisitor);
+
+         //initialization of decompositions
+         D3Q27ETInitDistributionsBlockVisitor initVisitor( nu_LB,rho_LB);
+         //initVisitor.setVx1(inflowProfile);
+         initVisitor.setVx1(u_LB);
+         grid->accept(initVisitor);
+
+         //Postprozess
+         UbSchedulerPtr geoSch(new UbScheduler(1));
+         D3Q27MacroscopicQuantitiesPostprocessorPtr ppgeo(
+            new D3Q27MacroscopicQuantitiesPostprocessor(grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), 
+            unitConverter, true));
+         ppgeo->update(0);
+         ppgeo.reset();
+         geoSch.reset();
+
+         if(myid == 0) UBLOG(logINFO,"Preprozess - end");      
+      }
+      else
+      {
+         //set connectors
+         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
+         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nu_LB, iProcessor);
+         grid->accept( setConnsVisitor );
+         //domain decomposition for threads
+         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
+         grid->accept(pqPartVisitor);
+         //SetSpongeLayerBlockVisitor ssp(spongeLayer);
+         //grid->accept(ssp);
+         if(myid == 0) UBLOG(logINFO,"Restart - end"); 
+      }
+      UbSchedulerPtr visSch(new UbScheduler(outTime));
+
+      double startStep = 80000;
+
+      if (averaging)
+      {
+         UbSchedulerPtr resSchRMS(new UbScheduler());
+         resSchRMS->addSchedule(100000, 80000, 10000000);
+         UbSchedulerPtr resSchMeans(new UbScheduler());
+         resSchMeans->addSchedule(100000, 80000, 10000000);
+         UbSchedulerPtr stepAvSch(new UbScheduler());
+         int averageInterval=100;
+         stepAvSch->addSchedule(averageInterval, 0, 10000000);
+
+         AverageValuesPostprocessor Avpp(grid, pathname, WbWriterVtkXmlBinary::getInstance(),
+            visSch/*wann wird rausgeschrieben*/, stepAvSch/*wann wird gemittelt*/, resSchMeans, resSchRMS/*wann wird resettet*/, restart);
+      }
+
+      D3Q27MacroscopicQuantitiesPostprocessor pp(grid, visSch, pathname, WbWriterVtkXmlBinary::getInstance(), unitConverter);
+
+      UbSchedulerPtr nupsSch(new UbScheduler(10, 10, 30));
+      nupsSch->addSchedule(1000, 1000, 1000000000);
+      NUPSCounterPostprocessor npr(grid, nupsSch, numOfThreads, comm);
+
+      if(myid == 0)
+      {
+         UBLOG(logINFO,"PID = " << myid << " Total Physical Memory (RAM): " << Utilities::getTotalPhysMem());
+         UBLOG(logINFO,"PID = " << myid << " Physical Memory currently used: " << Utilities::getPhysMemUsed());
+         UBLOG(logINFO,"PID = " << myid << " Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe());
+      }
+
+      //double endTime = 80001;
+      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, visSch));
+      if(myid == 0) UBLOG(logINFO,"Simulation-start");
+      calculation->calculate();
+      if(myid == 0) UBLOG(logINFO,"Simulation-end");
+   }
+   catch(std::exception& e)
+   {
+      cerr << e.what() << endl << flush;
+   }
+   catch(std::string& s)
+   {
+      cerr << s << endl;
+   }
+   catch(...)
+   {
+      cerr << "unknown exception" << endl;
+   }
+
+}
+int main(int argc, char* argv[])
+{
+
+   if (argv != NULL)
+   {
+      if (argv[1] != NULL)
+      {
+         run(string(argv[1]));
+      }
+      else
+      {
+         cout << "Configuration file is missing!" << endl;
+      }
+   }
+
+   return 0;
+}
+
diff --git a/apps/cpu/perm/CMakeLists.txt b/apps/cpu/perm/CMakeLists.txt
index 72266e07ef2e67c5009946d7707d03857dc44c8d..108fa0857c2482ab0fdecb3b250c9b1f66934706 100644
--- a/apps/cpu/perm/CMakeLists.txt
+++ b/apps/cpu/perm/CMakeLists.txt
@@ -1,25 +1,25 @@
-CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
-
-########################################################
-## C++ PROJECT                                       ###
-########################################################
-PROJECT(perm)
-
-INCLUDE(${APPS_ROOT}/IncludsList.cmake) 
-
-#################################################################
-###   LOCAL FILES                                             ###
-#################################################################
-FILE(GLOB SPECIFIC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.h
-                         ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
-                         ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp  )
- 
-SET(ALL_SOURCES ${ALL_SOURCES} ${SPECIFIC_FILES})
-SOURCE_GROUP(src FILES ${SPECIFIC_FILES})
-  
-SET(CAB_ADDITIONAL_LINK_LIBRARIES VirtualFluids)
-
-#################################################################
-###   CREATE PROJECT                                          ###
-#################################################################
-CREATE_CAB_PROJECT(perm BINARY)
+CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
+
+########################################################
+## C++ PROJECT                                       ###
+########################################################
+PROJECT(perm)
+
+INCLUDE(${APPS_ROOT}/IncludsList.cmake) 
+
+#################################################################
+###   LOCAL FILES                                             ###
+#################################################################
+FILE(GLOB SPECIFIC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.h
+                         ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
+                         ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp  )
+ 
+SET(ALL_SOURCES ${ALL_SOURCES} ${SPECIFIC_FILES})
+SOURCE_GROUP(src FILES ${SPECIFIC_FILES})
+  
+SET(CAB_ADDITIONAL_LINK_LIBRARIES VirtualFluids)
+
+#################################################################
+###   CREATE PROJECT                                          ###
+#################################################################
+CREATE_CAB_PROJECT(perm BINARY)
diff --git a/apps/cpu/perm/config.txt b/apps/cpu/perm/config.txt
index 30d0cb452adb24805fdabb7e24105ad1c029c8e4..01be8321c2dbd99bd6ab7cc578577ecd7c9bda9f 100644
--- a/apps/cpu/perm/config.txt
+++ b/apps/cpu/perm/config.txt
@@ -1,41 +1,41 @@
-pathname = /gfs1/work/niikonst/scratch/permAlu
-pathGeo = /gfs1/work/niikonst/data/materials
-numOfTreads = 24
-
-#poroeses Medium
-
-sampleFilename = alu_80-110.vti
-
-#Diminsion in Voxel
-pmNX1 = 1096
-pmNX2 = 1327
-pmNX3 = 1265
-
-#Threshold
-lthreshold = 29041
-uthreshold = 65535
-
-#Diminsion in m
-pmL1 = 4e-3
-pmL2 = 5e-3
-pmL3 = 5e-3
-
-dp_LB = 0.01
-
-#for Re=2
-nu_LB = 0.02
-
-#for Re=100
-#nu_LB = 0.0004
-
-#nu -= nuFactor*simNumber
-#coefficient for nu (0.02-0.0004)/10
-nuFactor = 0.00196
-#simulation number
-simNumber = 1
-
-restartStep = 20000
-#immer 40000 pro Job
-endTime = 140000
-outTime = 20000
+pathname = /gfs1/work/niikonst/scratch/permAlu
+pathGeo = /gfs1/work/niikonst/data/materials
+numOfTreads = 24
+
+#poroeses Medium
+
+sampleFilename = alu_80-110.vti
+
+#Diminsion in Voxel
+pmNX1 = 1096
+pmNX2 = 1327
+pmNX3 = 1265
+
+#Threshold
+lthreshold = 29041
+uthreshold = 65535
+
+#Diminsion in m
+pmL1 = 4e-3
+pmL2 = 5e-3
+pmL3 = 5e-3
+
+dp_LB = 0.01
+
+#for Re=2
+nu_LB = 0.02
+
+#for Re=100
+#nu_LB = 0.0004
+
+#nu -= nuFactor*simNumber
+#coefficient for nu (0.02-0.0004)/10
+nuFactor = 0.00196
+#simulation number
+simNumber = 1
+
+restartStep = 20000
+#immer 40000 pro Job
+endTime = 140000
+outTime = 20000
 nupsStep = 10 80010 80100
\ No newline at end of file
diff --git a/apps/cpu/perm/configBombadil.txt b/apps/cpu/perm/configBombadil.txt
index 4f5a8115b0c56f4dc6afc658192fb948d0c66a55..93229b8465de908ecdf62aa29c1d7433a11b3f76 100644
--- a/apps/cpu/perm/configBombadil.txt
+++ b/apps/cpu/perm/configBombadil.txt
@@ -1,34 +1,34 @@
-pathname = d:/temp/perm2
-pathGeo = d:/Projects/SFB880/GeometrienPoroeseMedien/Alu_80-110
-numOfTreads = 4
-
-#poroeses Medium
-
-sampleFilename = /alu_80-110.vti
-
-#Diminsion in Voxel
-pmNX1 = 200
-pmNX2 = 200
-pmNX3 = 200
-
-#Threshold
-lthreshold = 29041
-uthreshold = 65535
-
-#Diminsion in m
-pmL1 = 0.726e-3
-pmL2 = 0.75e-3
-pmL3 = 0.786e-3
-
-#dp_LB = 1e-9
-dp_LB = 1e-1
-nu_LB = 2e-5
-
-timeSeriesOut = /timeseries/simAlu80_5
-
-restartStep = 300
-restartStepStart = 300
-#immer 40000 pro Job
-endTime = 140000
-outTime = 10
+pathname = d:/temp/perm2
+pathGeo = d:/Projects/SFB880/GeometrienPoroeseMedien/Alu_80-110
+numOfTreads = 4
+
+#poroeses Medium
+
+sampleFilename = /alu_80-110.vti
+
+#Diminsion in Voxel
+pmNX1 = 200
+pmNX2 = 200
+pmNX3 = 200
+
+#Threshold
+lthreshold = 29041
+uthreshold = 65535
+
+#Diminsion in m
+pmL1 = 0.726e-3
+pmL2 = 0.75e-3
+pmL3 = 0.786e-3
+
+#dp_LB = 1e-9
+dp_LB = 1e-1
+nu_LB = 2e-5
+
+timeSeriesOut = /timeseries/simAlu80_5
+
+restartStep = 300
+restartStepStart = 300
+#immer 40000 pro Job
+endTime = 140000
+outTime = 10
 nupsStep = 10 80010 80100
\ No newline at end of file
diff --git a/apps/cpu/perm/configBombadil2.txt b/apps/cpu/perm/configBombadil2.txt
index 64bb2fb7f902d0849b478c41fa49f258fdc9995a..1d6cdc954f0a9f7965c3e2595a55d86759a10ac0 100644
--- a/apps/cpu/perm/configBombadil2.txt
+++ b/apps/cpu/perm/configBombadil2.txt
@@ -1,36 +1,36 @@
-pathname = d:/temp/perm
-pathGeo = d:/Projects/SFB880/GeometrienPoroeseMedien/Alu_80-110
-numOfTreads = 4
-
-#poroeses Medium
-
-sampleFilename = /alu_80-110.vti
-
-#Diminsion in Voxel
-pmNX1 = 200
-pmNX2 = 200
-pmNX3 = 200
-
-#Threshold
-lthreshold = 29041
-uthreshold = 65535
-
-#Diminsion in m
-pmL1 = 0.726e-3
-pmL2 = 0.75e-3
-pmL3 = 0.786e-3
-
-dp_LB = 0.001
-#nu_LB = 0.168666666667
-#nu_LB = 0.168666666667e-1
-#nu_LB = 0.168666666667e-2
-#nu_LB = 0.168666666667e-3
-nu_LB = 0.168666666667e-4
-
-timeSeriesOut = /timeseries/simAlu80_5
-
-restartStep = 20000
-#immer 40000 pro Job
-endTime = 140000
-outTime = 1000
+pathname = d:/temp/perm
+pathGeo = d:/Projects/SFB880/GeometrienPoroeseMedien/Alu_80-110
+numOfTreads = 4
+
+#poroeses Medium
+
+sampleFilename = /alu_80-110.vti
+
+#Diminsion in Voxel
+pmNX1 = 200
+pmNX2 = 200
+pmNX3 = 200
+
+#Threshold
+lthreshold = 29041
+uthreshold = 65535
+
+#Diminsion in m
+pmL1 = 0.726e-3
+pmL2 = 0.75e-3
+pmL3 = 0.786e-3
+
+dp_LB = 0.001
+#nu_LB = 0.168666666667
+#nu_LB = 0.168666666667e-1
+#nu_LB = 0.168666666667e-2
+#nu_LB = 0.168666666667e-3
+nu_LB = 0.168666666667e-4
+
+timeSeriesOut = /timeseries/simAlu80_5
+
+restartStep = 20000
+#immer 40000 pro Job
+endTime = 140000
+outTime = 1000
 nupsStep = 10 80010 80100
\ No newline at end of file
diff --git a/apps/cpu/perm/configBombadilSBP120s.txt b/apps/cpu/perm/configBombadilSBP120s.txt
index de8aa0694ea499ff23cb17048d5d4b47fa2c5202..adad95f0a7e50b7436801b1be21446afe72360be 100644
--- a/apps/cpu/perm/configBombadilSBP120s.txt
+++ b/apps/cpu/perm/configBombadilSBP120s.txt
@@ -1,42 +1,42 @@
-#
-#Simulation parameters for determitatoin of permeability
-#SBP120
-
-pathname = d:/temp/perm
-pathGeo = d:/Projects/SFB880/GeometrienPoroeseMedien/SBP120
-numOfThreads = 4
-availMem = 1.2e9
-
-#porous media
-rawFile = false
-sampleFilename = /SPB120s_center_closed.vti
-
-#diminsions [voxel]
-pmNX1 = 680
-pmNX2 = 689
-pmNX3 = 787
-
-#threshold
-lthreshold = 1
-uthreshold = 1
-
-#diminsions [m]
-pmL1 = 2.55e-3
-pmL2 = 2.55000278e-3
-pmL3 = 2.95125e-3
-
-#grid
-blocknx = 10
-nx3 = 10
-
-#physic
-dp_LB = 0.001
-nu_LB = 0.01
-
-timeSeriesOut = /timeseries/simSBP120_1
-
-restartStep = 20000
-restartStepStart=20000
-
-endTime = 140000
-outTime = 1000
+#
+#Simulation parameters for determitatoin of permeability
+#SBP120
+
+pathname = d:/temp/perm
+pathGeo = d:/Projects/SFB880/GeometrienPoroeseMedien/SBP120
+numOfThreads = 4
+availMem = 1.2e9
+
+#porous media
+rawFile = false
+sampleFilename = /SPB120s_center_closed.vti
+
+#diminsions [voxel]
+pmNX1 = 680
+pmNX2 = 689
+pmNX3 = 787
+
+#threshold
+lthreshold = 1
+uthreshold = 1
+
+#diminsions [m]
+pmL1 = 2.55e-3
+pmL2 = 2.55000278e-3
+pmL3 = 2.95125e-3
+
+#grid
+blocknx = 10
+nx3 = 10
+
+#physic
+dp_LB = 0.001
+nu_LB = 0.01
+
+timeSeriesOut = /timeseries/simSBP120_1
+
+restartStep = 20000
+restartStepStart=20000
+
+endTime = 140000
+outTime = 1000
diff --git a/apps/cpu/perm/configBombadilSBP120s500.txt b/apps/cpu/perm/configBombadilSBP120s500.txt
index 89e60d9a17fe690a17cccb1c7df8ec213fa795d4..9e8584b98ad7e3056a35b19976bdf9724b9f1571 100644
--- a/apps/cpu/perm/configBombadilSBP120s500.txt
+++ b/apps/cpu/perm/configBombadilSBP120s500.txt
@@ -1,50 +1,50 @@
-#
-#Simulation parameters for determitatoin of permeability
-#SBP120
-
-pathname = d:/temp/perm
-pathGeo = d:/Projects/SFB880/GeometrienPoroeseMedien/SBP120
-numOfThreads = 4
-availMem = 3e9
-logToFile = false
-
-#porous media
-rawFile = false
-sampleFilename = /SBP120s500_center_closed.vti
-
-#diminsions [voxel]
-pmNX1 = 500
-pmNX2 = 500
-pmNX3 = 500
-
-#threshold
-#lthreshold = 38370
-#uthreshold = 65535
-lthreshold = 1
-uthreshold = 1
-
-
-#diminsions [m]
-pmL1 = 1.87e-3
-pmL2 = 1.87e-3
-pmL3 = 1.87e-3
-
-#grid
-#blocknx = 30
-#nx3 = 5
-blocknx = 50
-nx3 = 10
-spongeLayer=true
-
-#physic
-dp_LB = 1e-7
-nu_LB = 0.01
-
-timeSeriesFile = /timeseries/simSBP120_1
-timeSeriesOutTime = 10
-
-restartStep = 20000
-restartStepStart=20000
-
-endTime = 60000
-outTime = 100
+#
+#Simulation parameters for determitatoin of permeability
+#SBP120
+
+pathname = d:/temp/perm
+pathGeo = d:/Projects/SFB880/GeometrienPoroeseMedien/SBP120
+numOfThreads = 4
+availMem = 3e9
+logToFile = false
+
+#porous media
+rawFile = false
+sampleFilename = /SBP120s500_center_closed.vti
+
+#diminsions [voxel]
+pmNX1 = 500
+pmNX2 = 500
+pmNX3 = 500
+
+#threshold
+#lthreshold = 38370
+#uthreshold = 65535
+lthreshold = 1
+uthreshold = 1
+
+
+#diminsions [m]
+pmL1 = 1.87e-3
+pmL2 = 1.87e-3
+pmL3 = 1.87e-3
+
+#grid
+#blocknx = 30
+#nx3 = 5
+blocknx = 50
+nx3 = 10
+spongeLayer=true
+
+#physic
+dp_LB = 1e-7
+nu_LB = 0.01
+
+timeSeriesFile = /timeseries/simSBP120_1
+timeSeriesOutTime = 10
+
+restartStep = 20000
+restartStepStart=20000
+
+endTime = 60000
+outTime = 100
diff --git a/apps/cpu/perm/configHlrnAlu.txt b/apps/cpu/perm/configHlrnAlu.txt
index 101c741be225b854e162c2b8f4b85f7f64885d56..55b9bd3f2275452b85c73f1cc2ed86d5ecf43377 100644
--- a/apps/cpu/perm/configHlrnAlu.txt
+++ b/apps/cpu/perm/configHlrnAlu.txt
@@ -1,34 +1,34 @@
-pathname = /gfs1/work/niikonst/scratch/permAlu80
-pathGeo = /gfs1/work/niikonst/data/materials
-
-numOfTreads = 1
-
-#poroeses Medium
-
-sampleFilename = /alu_80-110.vti
-
-#Diminsion in Voxel
-pmNX1 = 200
-pmNX2 = 200
-pmNX3 = 200
-
-#Threshold
-lthreshold = 29041
-uthreshold = 65535
-
-#Diminsion in m
-pmL1 = 0.726e-3
-pmL2 = 0.75e-3
-pmL3 = 0.786e-3
-
-dp_LB = 0.001
-nu_LB = 0.15
-
-timeSeriesOut = /timeseries/simAlu80_1
-
-restartStep = 20
-#immer 40000 pro Job
-#endTime = 140000
-endTime = 60
-outTime = 10
+pathname = /gfs1/work/niikonst/scratch/permAlu80
+pathGeo = /gfs1/work/niikonst/data/materials
+
+numOfTreads = 1
+
+#poroeses Medium
+
+sampleFilename = /alu_80-110.vti
+
+#Diminsion in Voxel
+pmNX1 = 200
+pmNX2 = 200
+pmNX3 = 200
+
+#Threshold
+lthreshold = 29041
+uthreshold = 65535
+
+#Diminsion in m
+pmL1 = 0.726e-3
+pmL2 = 0.75e-3
+pmL3 = 0.786e-3
+
+dp_LB = 0.001
+nu_LB = 0.15
+
+timeSeriesOut = /timeseries/simAlu80_1
+
+restartStep = 20
+#immer 40000 pro Job
+#endTime = 140000
+endTime = 60
+outTime = 10
 nupsStep = 10 80010 80100
\ No newline at end of file
diff --git a/apps/cpu/perm/config_HLRS_SBP120.cfg b/apps/cpu/perm/config_HLRS_SBP120.cfg
index 54ceee42016bd06904a472fedccb35c68bbb06be..720302622a33d7cb8119e66c82a0992383da511e 100644
--- a/apps/cpu/perm/config_HLRS_SBP120.cfg
+++ b/apps/cpu/perm/config_HLRS_SBP120.cfg
@@ -1,43 +1,43 @@
-#HLRS
-#Simulation parameters for determitatoin of permeability
-#SBP120
-
-pathname = /univ_1/ws1/ws/xrmkuchr-perm-0/SBP120
-pathGeo = /univ_1/ws1/ws/xrmkuchr-perm-0/SBP120/Data
-numOfThreads = 24
-availMem = 128e9
-logToFile = true
-#porous media
-rawFile = false
-sampleFilename = /Sinterbronze_SBP120_1358x1376x1572.raw
-
-#diminsions [voxel]
-pmNX1 = 1358
-pmNX2 = 1376
-pmNX3 = 1572
-
-#threshold
-lthreshold = 38370
-uthreshold = 65535
-
-#diminsions [m]
-pmL1 = 5092499.73e-9
-pmL2 = 5159999.85e-9
-pmL3 = 5894999.98e-9
-
-#grid
-blocknx = 64
-nx3 = 22
-
-#physic
-dp_LB = 1e-7
-nu_LB = 0.01
-
-timeSeriesFile = /timeseries/simSBP120_1
-timeSeriesOutTime = 100
-
-restartStep = 1000
-restartStepStart=1000
-
-endTime = 2000
-outTime = 1000
+#HLRS
+#Simulation parameters for determitatoin of permeability
+#SBP120
+
+pathname = /univ_1/ws1/ws/xrmkuchr-perm-0/SBP120
+pathGeo = /univ_1/ws1/ws/xrmkuchr-perm-0/SBP120/Data
+numOfThreads = 24
+availMem = 128e9
+logToFile = true
+#porous media
+rawFile = false
+sampleFilename = /Sinterbronze_SBP120_1358x1376x1572.raw
+
+#diminsions [voxel]
+pmNX1 = 1358
+pmNX2 = 1376
+pmNX3 = 1572
+
+#threshold
+lthreshold = 38370
+uthreshold = 65535
+
+#diminsions [m]
+pmL1 = 5092499.73e-9
+pmL2 = 5159999.85e-9
+pmL3 = 5894999.98e-9
+
+#grid
+blocknx = 64
+nx3 = 22
+
+#physic
+dp_LB = 1e-7
+nu_LB = 0.01
+
+timeSeriesFile = /timeseries/simSBP120_1
+timeSeriesOutTime = 100
+
+restartStep = 1000
+restartStepStart=1000
+
+endTime = 2000
+outTime = 1000
diff --git a/apps/cpu/perm/perm.cpp b/apps/cpu/perm/perm.cpp
index e979f9439bc38f727a90a8a98494d59e1e8f3700..4cb2b6eb111e814479cef87ae4799e4467939c19 100644
--- a/apps/cpu/perm/perm.cpp
+++ b/apps/cpu/perm/perm.cpp
@@ -1,513 +1,513 @@
-#include <iostream>
-#include <string>
-#include <VirtualFluids.h>
-
-using namespace std;
-
-//////////////////////////////////////////////////////////////////////////
-void perm(string configname)
-{
-   try
-   {
-      ConfigurationFile   config;
-      config.load(configname);
-
-      string          pathname = config.getValue<string>("pathname");
-      string          pathGeo = config.getValue<string>("pathGeo");
-      int             numOfThreads = config.getValue<int>("numOfThreads");
-      string          sampleFilename = config.getValue<string>("sampleFilename");
-      int             pmNX1 = config.getValue<int>("pmNX1");
-      int             pmNX2 = config.getValue<int>("pmNX2");
-      int             pmNX3 = config.getValue<int>("pmNX3");
-      double          lthreshold = config.getValue<double>("lthreshold");
-      double          uthreshold = config.getValue<double>("uthreshold");
-      double          pmL1 = config.getValue<double>("pmL1");
-      double          pmL2 = config.getValue<double>("pmL2");
-      double          pmL3 = config.getValue<double>("pmL3");
-      int             blocknx = config.getValue<int>("blocknx");
-      double          dpLB = config.getValue<double>("dpLB");
-      double          nuLB = config.getValue<double>("nuLB");
-      string          timeSeriesFile = config.getValue<string>("timeSeriesFile");
-      double          restartStep = config.getValue<double>("restartStep");
-      double          restartStepStart = config.getValue<double>("restartStepStart");
-      double          endTime = config.getValue<double>("endTime");
-      double          availMem = config.getValue<double>("availMem");
-      bool            rawFile = config.getValue<bool>("rawFile");
-      double          timeSeriesOutTime = config.getValue<double>("timeSeriesOutTime");
-      bool            logToFile = config.getValue<bool>("logToFile");
-      bool            newStart = config.getValue<bool>("newStart");
-      double          cpStart = config.getValue<double>("cpStart");
-      double          cpStep = config.getValue<double>("cpStep");
-      vector<double>  nupsStep = config.getVector<double>("nupsStep");
-      double          outTimeStep = config.getValue<double>("outTimeStep");
-      double          outTimeStart = config.getValue<double>("outTimeStart");
-      double          deltax = config.getValue<double>("deltax");
-      bool            writeSampleToFile = config.getValue<bool>("writeSampleToFile");
-
-      SPtr<Communicator> comm = MPICommunicator::getInstance();
-      int myid = comm->getProcessID();
-
-      if (logToFile)
-      {
-#if defined(__unix__)
-         if (myid == 0)
-         {
-            const char* str = pathname.c_str();
-            int status = mkdir(str, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
-         }
-#endif 
-
-         if (myid == 0)
-         {
-            stringstream logFilename;
-            logFilename << pathname + "/logfile" + UbSystem::toString(UbSystem::getTimeStamp()) + ".txt";
-            UbLog::output_policy::setStream(logFilename.str());
-         }
-      }
-
-      //Sleep(30000);
-
-      if (myid == 0) UBLOG(logINFO, "Testcase permeability");
-
-      if (myid == 0)
-      {
-         //string machinename = UbSystem::getMachineName();
-         //UBLOG(logINFO, "PID = " << myid << " Hostname: " << machinename);
-         UBLOG(logINFO, "PID = " << myid << " Total Physical Memory (RAM): " << Utilities::getTotalPhysMem());
-         UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used: " << Utilities::getPhysMemUsed());
-         UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe());
-      }
-
-      int blocknx1 = blocknx;
-      int blocknx2 = blocknx;
-      int blocknx3 = blocknx;
-
-      LBMReal rhoLB = 0.0;
-
-      double rhoLBinflow = dpLB*3.0;
-
-      SPtr<LBMUnitConverter> conv = SPtr<LBMUnitConverter>(new LBMUnitConverter());
-
-      const int baseLevel = 0;
-
-      double coord[6];
-
-
-
-      ///close void space
-      //////////////////////////////////////////////////////////////////////////
-      //{
-      //   string samplePathname = pathGeo + sampleFilename;
-
-      //   double deltaVoxelX1 = pmL1/(double)pmNX1;
-      //   double deltaVoxelX2 = pmL2/(double)pmNX2;
-      //   double deltaVoxelX3 = pmL3/(double)pmNX3;
-
-      //   GbVoxelMatrix3DPtr sample(new GbVoxelMatrix3D(pmNX1, pmNX2, pmNX3, 0, lthreshold, uthreshold));
-      //   if (rawFile)
-      //   {
-      //      sample->readMatrixFromRawFile<unsigned short>(samplePathname, GbVoxelMatrix3D::BigEndian);
-      //   }
-      //   else
-      //   {
-      //      sample->readMatrixFromVtiASCIIFile(samplePathname);
-      //   }
-
-      //   sample->setVoxelMatrixDelta((float)deltaVoxelX1, (float)deltaVoxelX2, (float)deltaVoxelX3);
-      //   sample->setVoxelMatrixMininum(0.0, 0.0, 0.0);
-
-      //   if (myid == 0) sample->writeToVTKImageDataASCII(pathname + "/geo/sampleOpen");
-      //   sample->calculateNumberOfSolidAndFluid();
-      //   if (myid == 0)  UBLOG(logINFO, "number of solid = "<<sample->getNumberOfSolid());
-      //   if (myid == 0)  UBLOG(logINFO, "number of fluid = "<<sample->getNumberOfFluid());
-
-      //   sample->setClosedVoidSpaceToSolid();
-
-      //   if (myid == 0) sample->writeToVTKImageDataASCII(pathname + "/geo/sampleClosed");
-
-      //   sample->calculateNumberOfSolidAndFluid();
-      //   if (myid == 0)  UBLOG(logINFO, "number of solid = "<<sample->getNumberOfSolid());
-      //   if (myid == 0)  UBLOG(logINFO, "number of fluid = "<<sample->getNumberOfFluid());
-
-      //   UBLOG(logINFO, "Finish!");
-      //   return;
-      //}
-      //////////////////////////////////////////////////////////////////////////
-
-      ////////////////////////////////////////////////////////////////////////
-      //Grid
-      //////////////////////////////////////////////////////////////////////////
-      SPtr<Grid3D> grid(new Grid3D(comm));
-
-      //BC adapters
-      SPtr<BCAdapter> noSlipBCAdapter(new NoSlipBCAdapter());
-      noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NoSlipBCAlgorithm()));
-
-      SPtr<BCAdapter> denBCAdapterInflow(new DensityBCAdapter(rhoLBinflow));
-      denBCAdapterInflow->setBcAlgorithm(SPtr<BCAlgorithm>(new NonEqDensityBCAlgorithm()));
-
-      SPtr<BCAdapter> denBCAdapterOutflow(new DensityBCAdapter(rhoLB));
-      denBCAdapterOutflow->setBcAlgorithm(SPtr<BCAlgorithm>(new NonEqDensityBCAlgorithm()));
-
-      //////////////////////////////////////////////////////////////////////////////////
-      //BS visitor
-      BoundaryConditionsBlockVisitor bcVisitor;
-      bcVisitor.addBC(noSlipBCAdapter);
-      bcVisitor.addBC(denBCAdapterInflow);
-      bcVisitor.addBC(denBCAdapterOutflow);;
-
-      SPtr<BCProcessor> bcProc;
-      bcProc = SPtr<BCProcessor>(new BCProcessor());
-
-      SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new CompressibleCumulant4thOrderViscosityLBMKernel());
-
-      kernel->setBCProcessor(bcProc);
-
-
-      //////////////////////////////////////////////////////////////////////////
-      //restart
-      SPtr<UbScheduler> mSch(new UbScheduler(cpStep, cpStart));
-      SPtr<MPIIOMigrationCoProcessor> migCoProcessor(new MPIIOMigrationCoProcessor(grid, mSch, pathname+"/mig", comm));
-      migCoProcessor->setLBMKernel(kernel);
-      migCoProcessor->setBCProcessor(bcProc);
-      //////////////////////////////////////////////////////////////////////////
-      
-	 if (myid == 0)
-	 {
-		UBLOG(logINFO, "Parameters:");
-		UBLOG(logINFO, "rhoLB = " << rhoLB);
-		UBLOG(logINFO, "nuLB = " << nuLB);
-		UBLOG(logINFO, "dpLB = " << dpLB);
-		UBLOG(logINFO, "dx = " << deltax << " m");
-
-		UBLOG(logINFO, "numOfThreads = " << numOfThreads);
-		UBLOG(logINFO, "path = " << pathname);
-		UBLOG(logINFO, "Preprozess - start");
-	 }      
-
-      if (newStart)
-      {
-         if (myid == 0) UBLOG(logINFO, "new start..");
-
-         if (myid == 0)
-         {
-            //UBLOG(logINFO, "new start PID = " << myid << " Hostname: " << machinename);
-            UBLOG(logINFO, "new start PID = " << myid << " Total Physical Memory (RAM): " << Utilities::getTotalPhysMem());
-            UBLOG(logINFO, "new start PID = " << myid << " Physical Memory currently used: " << Utilities::getPhysMemUsed());
-            UBLOG(logINFO, "new start PID = " << myid << " Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe());
-         }
-
-         string samplePathname = pathGeo + sampleFilename;
-
-         double deltaVoxelX1 = pmL1/(double)pmNX1;
-         double deltaVoxelX2 = pmL2/(double)pmNX2;
-         double deltaVoxelX3 = pmL3/(double)pmNX3;
-
-         SPtr<GbVoxelMatrix3D> sample(new GbVoxelMatrix3D(pmNX1, pmNX2, pmNX3, 0, lthreshold, uthreshold));
-         if (rawFile)
-         {
-            sample->readMatrixFromRawFile<unsigned short>(samplePathname, GbVoxelMatrix3D::BigEndian);
-         }
-         else
-         {
-            sample->readMatrixFromVtiASCIIFile(samplePathname);
-         }
-
-         sample->setVoxelMatrixDelta((float)deltaVoxelX1, (float)deltaVoxelX2, (float)deltaVoxelX3);
-         sample->setVoxelMatrixMininum(0.0, 0.0, 0.0);
-
-         if (myid == 0 && writeSampleToFile) sample->writeToVTKImageDataASCII(pathname + "/geo/sample");
-
-         ///////////////////////////////////////////////////////
-
-         ////////////////////////////////////////////////////////////////////////
-
-         double offset1 = sample->getLengthX1()/10.0;
-         double offset2 = 2.0*offset1;
-         //bounding box
-         double g_minX1 = sample->getX1Minimum() - offset1;
-         double g_minX2 = sample->getX2Minimum();
-         double g_minX3 = sample->getX3Minimum();
-
-         double g_maxX1 = sample->getX1Maximum() + offset2;
-         double g_maxX2 = sample->getX2Maximum();
-         double g_maxX3 = sample->getX3Maximum();
-
-         double blockLength = (double)blocknx1*deltax;
-
-         grid->setPeriodicX1(false);
-         grid->setPeriodicX2(false);
-         grid->setPeriodicX3(false);
-         grid->setDeltaX(deltax);
-         grid->setBlockNX(blocknx1, blocknx2, blocknx3);
-
-         SPtr<GbObject3D> gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
-         if (myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), pathname + "/geo/gridCube", WbWriterVtkXmlBinary::getInstance());
-
-         GenBlocksGridVisitor genBlocks(gridCube);
-         grid->accept(genBlocks);
-
-         //walls
-         GbCuboid3DPtr addWallYmin(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_minX2, g_maxX3+blockLength));
-         if (myid == 0) GbSystem3D::writeGeoObject(addWallYmin.get(), pathname+"/geo/addWallYmin", WbWriterVtkXmlASCII::getInstance());
-
-         GbCuboid3DPtr addWallZmin(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_minX3));
-         if (myid == 0) GbSystem3D::writeGeoObject(addWallZmin.get(), pathname+"/geo/addWallZmin", WbWriterVtkXmlASCII::getInstance());
-
-         GbCuboid3DPtr addWallYmax(new GbCuboid3D(g_minX1-blockLength, g_maxX2, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength));
-         if (myid == 0) GbSystem3D::writeGeoObject(addWallYmax.get(), pathname+"/geo/addWallYmax", WbWriterVtkXmlASCII::getInstance());
-
-         GbCuboid3DPtr addWallZmax(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_maxX3, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength));
-         if (myid == 0) GbSystem3D::writeGeoObject(addWallZmax.get(), pathname+"/geo/addWallZmax", WbWriterVtkXmlASCII::getInstance());
-
-
-         //inflow
-         GbCuboid3DPtr geoInflow(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3-blockLength, g_minX1, g_maxX2+blockLength, g_maxX3+blockLength));
-         if (myid == 0) GbSystem3D::writeGeoObject(geoInflow.get(), pathname + "/geo/geoInflow", WbWriterVtkXmlASCII::getInstance());
-
-         //outflow
-         GbCuboid3DPtr geoOutflow(new GbCuboid3D(g_maxX1, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength));
-         if (myid == 0) GbSystem3D::writeGeoObject(geoOutflow.get(), pathname + "/geo/geoOutflow", WbWriterVtkXmlASCII::getInstance());
-
-         //PM interactor
-         SPtr<D3Q27Interactor> sampleInt(new D3Q27Interactor(sample, grid, noSlipBCAdapter, Interactor3D::SOLID));
-
-         //wall interactors
-         SPtr<D3Q27Interactor> addWallYminInt(new D3Q27Interactor(addWallYmin, grid, noSlipBCAdapter, Interactor3D::SOLID));
-         SPtr<D3Q27Interactor> addWallZminInt(new D3Q27Interactor(addWallZmin, grid, noSlipBCAdapter, Interactor3D::SOLID));
-         SPtr<D3Q27Interactor> addWallYmaxInt(new D3Q27Interactor(addWallYmax, grid, noSlipBCAdapter, Interactor3D::SOLID));
-         SPtr<D3Q27Interactor> addWallZmaxInt(new D3Q27Interactor(addWallZmax, grid, noSlipBCAdapter, Interactor3D::SOLID));
-
-		 //inflow
-         SPtr<D3Q27Interactor> inflowInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoInflow, grid, denBCAdapterInflow, Interactor3D::SOLID));
-
-         //outflow
-         SPtr<D3Q27Interactor> outflowInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoOutflow, grid, denBCAdapterOutflow, Interactor3D::SOLID));;
-
-         if (myid == 0)
-         {
-            //UBLOG(logINFO, "PID = " << myid << " Hostname: " << machinename);
-            UBLOG(logINFO, "PID = " << myid << " Total Physical Memory (RAM): " << Utilities::getTotalPhysMem());
-            UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used: " << Utilities::getPhysMemUsed());
-            UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe());
-         }
-
-         ////////////////////////////////////////////
-         //METIS
-          SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B, MetisPartitioner::RECURSIVE));
-         ////////////////////////////////////////////
-
-         /////delete solid blocks
-         if (myid == 0) UBLOG(logINFO, "deleteSolidBlocks - start");
-         InteractorsHelper intHelper(grid, metisVisitor);
-         intHelper.addInteractor(addWallYminInt);
-         intHelper.addInteractor(addWallZminInt);
-         intHelper.addInteractor(addWallYmaxInt);
-         intHelper.addInteractor(addWallZmaxInt);
-         intHelper.addInteractor(inflowInt);
-         intHelper.addInteractor(outflowInt);
-         intHelper.addInteractor(sampleInt);
-         intHelper.selectBlocks();
-         if (myid == 0) UBLOG(logINFO, "deleteSolidBlocks - end");
-         //////////////////////////////////////
-
-         {
-            WriteBlocksCoProcessor ppblocks(grid, SPtr<UbScheduler>(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm);
-            ppblocks.process(1);
-         }
-
-         unsigned long nob = grid->getNumberOfBlocks();
-         int gl = 3;
-         unsigned long nodb = (blocknx1)* (blocknx2)* (blocknx3);
-         unsigned long nod = nob * (blocknx1)* (blocknx2)* (blocknx3);
-         unsigned long nodg = nob * (blocknx1 + gl) * (blocknx2 + gl) * (blocknx3 + gl);
-         double needMemAll = double(nodg*(27 * sizeof(double) + sizeof(int) + sizeof(float) * 4));
-         double needMem = needMemAll / double(comm->getNumberOfProcesses());
-
-         if (myid == 0)
-         {
-            UBLOG(logINFO, "Number of blocks = " << nob);
-            UBLOG(logINFO, "Number of nodes  = " << nod);
-            int minInitLevel = grid->getCoarsestInitializedLevel();
-            int maxInitLevel = grid->getFinestInitializedLevel();
-            for (int level = minInitLevel; level <= maxInitLevel; level++)
-            {
-               int nobl = grid->getNumberOfBlocks(level);
-               UBLOG(logINFO, "Number of blocks for level " << level << " = " << nobl);
-               UBLOG(logINFO, "Number of nodes for level " << level << " = " << nobl*nodb);
-            }
-            UBLOG(logINFO, "Necessary memory  = " << needMemAll << " bytes");
-            UBLOG(logINFO, "Necessary memory per process = " << needMem << " bytes");
-            UBLOG(logINFO, "Available memory per process = " << availMem << " bytes");
-         }
-
-
-         SetKernelBlockVisitor kernelVisitor(kernel, nuLB, availMem, needMem);
-         grid->accept(kernelVisitor);
-
-
-         //BC
-         intHelper.setBC();
-
-
-         //Press*1.6e8+(14.76-coordsX)/3.5*5000
-         //initialization of distributions
-         mu::Parser fct;
-         fct.SetExpr("(x1max-x1)/l*dp*3.0");
-         fct.DefineConst("dp", dpLB);
-         fct.DefineConst("x1max", g_maxX1);
-         fct.DefineConst("l", g_maxX1-g_minX1);
-
-         InitDistributionsBlockVisitor initVisitor;
-         initVisitor.setRho(fct);
-         grid->accept(initVisitor);
-
-         //Post process
-         {
-            SPtr<UbScheduler> geoSch(new UbScheduler(1));
-            WriteBoundaryConditionsCoProcessor ppgeo(grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), comm);
-            ppgeo.process(0);
-         }
-
-         coord[0] = sample->getX1Minimum();
-         coord[1] = sample->getX2Minimum();
-         coord[2] = sample->getX3Minimum();
-         coord[3] = sample->getX1Maximum();
-         coord[4] = sample->getX2Maximum();
-         coord[5] = sample->getX3Maximum();
-
-         ////////////////////////////////////////////////////////
-         FILE * pFile;
-         string str = pathname + "/checkpoints/coord.txt";
-         pFile = fopen(str.c_str(), "w");
-         fprintf(pFile, "%g\n", deltax);
-         fprintf(pFile, "%g\n", coord[0]);
-         fprintf(pFile, "%g\n", coord[1]);
-         fprintf(pFile, "%g\n", coord[2]);
-         fprintf(pFile, "%g\n", coord[3]);
-         fprintf(pFile, "%g\n", coord[4]);
-         fprintf(pFile, "%g\n", coord[5]);
-         fclose(pFile);
-         ////////////////////////////////////////////////////////
-
-         if (myid == 0) UBLOG(logINFO, "Preprozess - end");
-      }
-      else
-      {
-         ////////////////////////////////////////////////////////
-         FILE * pFile;
-         string str = pathname + "/checkpoints/coord.txt";
-         pFile = fopen(str.c_str(), "r");
-         fscanf(pFile, "%lg\n", &deltax);
-         fscanf(pFile, "%lg\n", &coord[0]);
-         fscanf(pFile, "%lg\n", &coord[1]);
-         fscanf(pFile, "%lg\n", &coord[2]);
-         fscanf(pFile, "%lg\n", &coord[3]);
-         fscanf(pFile, "%lg\n", &coord[4]);
-         fscanf(pFile, "%lg\n", &coord[5]);
-         fclose(pFile);
-         ////////////////////////////////////////////////////////
-
-         migCoProcessor->restart((int)restartStep);
-         grid->setTimeStep(restartStep);
-         
-         if (myid == 0) UBLOG(logINFO, "Restart - end");
-      }
-      
-      ////set connectors
-      SPtr<InterpolationProcessor> iProcessor(new CompressibleOffsetMomentsInterpolationProcessor());
-      SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
-      grid->accept(setConnsVisitor);
-
-      //bcVisitor should be accept after initialization!!!!
-      grid->accept(bcVisitor);
-      if (myid == 0) UBLOG(logINFO, "grid->accept(bcVisitor):end");
-      
-      SPtr<UbScheduler> nupsSch(new UbScheduler(nupsStep[0], nupsStep[1], nupsStep[2]));
-      std::shared_ptr<CoProcessor> nupsCoProcessor(new NUPSCounterCoProcessor(grid, nupsSch, numOfThreads, comm));
-
-      SPtr<UbScheduler> stepSch(new UbScheduler(outTimeStep, outTimeStart));
-
-      SPtr<CoProcessor> writeMQCoProcessor(new WriteMacroscopicQuantitiesCoProcessor(grid, stepSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, comm));
-
-      deltax = grid->getDeltaX(baseLevel);
-      double dxd2 = deltax / 2.0;
-
-      SPtr<IntegrateValuesHelper> ih1(new IntegrateValuesHelper(grid, comm, coord[0] - dxd2*10.0, coord[1] - dxd2, coord[2] - dxd2,
-         coord[0] - dxd2*10.0 - 2.0*dxd2, coord[4] + dxd2, coord[5] + dxd2));
-
-      //D3Q27IntegrateValuesHelperPtr ih2(new D3Q27IntegrateValuesHelper(grid, comm, coord[3]/2.0, coord[1] - dxd2, coord[2] - dxd2,
-      //   coord[3]/2.0 + 2.0*dxd2, coord[4] + dxd2, coord[5] + dxd2));
-      SPtr<IntegrateValuesHelper> ih2(new IntegrateValuesHelper(grid, comm, coord[0], coord[1], coord[2], coord[3], coord[4], coord[5]));
-
-      SPtr<IntegrateValuesHelper> ih3(new IntegrateValuesHelper(grid, comm, coord[3] + dxd2*10.0, coord[1] - dxd2, coord[2] - dxd2,
-         coord[3] + dxd2*10.0 + 2.0*dxd2, coord[4] + dxd2, coord[5] + dxd2));
-
-      //D3Q27IntegrateValuesHelperPtr ih1(new D3Q27IntegrateValuesHelper(grid, comm, coord[0], coord[1], coord[2], coord[3], coord[4], coord[5]));
-      if (myid == 0) GbSystem3D::writeGeoObject(ih1->getBoundingBox().get(), pathname + "/geo/ih1", WbWriterVtkXmlBinary::getInstance());
-      if (myid == 0) GbSystem3D::writeGeoObject(ih2->getBoundingBox().get(), pathname + "/geo/ih2", WbWriterVtkXmlBinary::getInstance());
-      if (myid == 0) GbSystem3D::writeGeoObject(ih3->getBoundingBox().get(), pathname + "/geo/ih3", WbWriterVtkXmlBinary::getInstance());
-
-      double factorp = 1; // dp_real / dpLB;
-      double factorv = 1;// dx / dt;
-      SPtr<UbScheduler> stepMV(new UbScheduler(timeSeriesOutTime));
-      
-      SPtr<CoProcessor> tsp1(new TimeseriesCoProcessor(grid, stepMV, ih1, pathname+timeSeriesFile+"_1", comm));
-      SPtr<CoProcessor> tsp2(new TimeseriesCoProcessor(grid, stepMV, ih2, pathname+timeSeriesFile+"_2", comm));
-      SPtr<CoProcessor> tsp3(new TimeseriesCoProcessor(grid, stepMV, ih3, pathname+timeSeriesFile+"_3", comm));
-
-      if (myid == 0)
-      {
-         UBLOG(logINFO, "PID = " << myid << " Total Physical Memory (RAM): " << Utilities::getTotalPhysMem());
-         UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used: " << Utilities::getPhysMemUsed());
-         UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe());
-      }
-
-      omp_set_num_threads(numOfThreads);
-      SPtr<UbScheduler> stepGhostLayer(new UbScheduler(1));
-      SPtr<Calculator> calculator(new BasicCalculator(grid, stepGhostLayer, endTime));
-      calculator->addCoProcessor(nupsCoProcessor);
-      calculator->addCoProcessor(tsp1);
-      calculator->addCoProcessor(tsp2);
-      calculator->addCoProcessor(tsp3);
-      calculator->addCoProcessor(writeMQCoProcessor);
-      calculator->addCoProcessor(migCoProcessor);
-      
-
-
-      if (myid==0) UBLOG(logINFO, "Simulation-start");
-      calculator->calculate();
-      if (myid==0) UBLOG(logINFO, "Simulation-end");
-   }
-   catch (exception& e)
-   {
-      cerr << e.what() << endl << flush;
-   }
-   catch (string& s)
-   {
-      cerr << s << endl;
-   }
-   catch (...)
-   {
-      cerr << "unknown exception" << endl;
-   }
-
-}
-//////////////////////////////////////////////////////////////////////////
-int main(int argc, char* argv[])
-{
-
-   if (argv != NULL)
-   {
-      if (argv[1] != NULL)
-      {
-         perm(string(argv[1]));
-      }
-      else
-      {
-         cout<<"Configuration file must be set!: "<<argv[0]<<" <config file>"<<endl<<std::flush;
-      }
-   }
-
-   return 0;
-}
+#include <iostream>
+#include <string>
+#include <VirtualFluids.h>
+
+using namespace std;
+
+//////////////////////////////////////////////////////////////////////////
+void perm(string configname)
+{
+   try
+   {
+      ConfigurationFile   config;
+      config.load(configname);
+
+      string          pathname = config.getValue<string>("pathname");
+      string          pathGeo = config.getValue<string>("pathGeo");
+      int             numOfThreads = config.getValue<int>("numOfThreads");
+      string          sampleFilename = config.getValue<string>("sampleFilename");
+      int             pmNX1 = config.getValue<int>("pmNX1");
+      int             pmNX2 = config.getValue<int>("pmNX2");
+      int             pmNX3 = config.getValue<int>("pmNX3");
+      double          lthreshold = config.getValue<double>("lthreshold");
+      double          uthreshold = config.getValue<double>("uthreshold");
+      double          pmL1 = config.getValue<double>("pmL1");
+      double          pmL2 = config.getValue<double>("pmL2");
+      double          pmL3 = config.getValue<double>("pmL3");
+      int             blocknx = config.getValue<int>("blocknx");
+      double          dpLB = config.getValue<double>("dpLB");
+      double          nuLB = config.getValue<double>("nuLB");
+      string          timeSeriesFile = config.getValue<string>("timeSeriesFile");
+      double          restartStep = config.getValue<double>("restartStep");
+      double          restartStepStart = config.getValue<double>("restartStepStart");
+      double          endTime = config.getValue<double>("endTime");
+      double          availMem = config.getValue<double>("availMem");
+      bool            rawFile = config.getValue<bool>("rawFile");
+      double          timeSeriesOutTime = config.getValue<double>("timeSeriesOutTime");
+      bool            logToFile = config.getValue<bool>("logToFile");
+      bool            newStart = config.getValue<bool>("newStart");
+      double          cpStart = config.getValue<double>("cpStart");
+      double          cpStep = config.getValue<double>("cpStep");
+      vector<double>  nupsStep = config.getVector<double>("nupsStep");
+      double          outTimeStep = config.getValue<double>("outTimeStep");
+      double          outTimeStart = config.getValue<double>("outTimeStart");
+      double          deltax = config.getValue<double>("deltax");
+      bool            writeSampleToFile = config.getValue<bool>("writeSampleToFile");
+
+      SPtr<Communicator> comm = MPICommunicator::getInstance();
+      int myid = comm->getProcessID();
+
+      if (logToFile)
+      {
+#if defined(__unix__)
+         if (myid == 0)
+         {
+            const char* str = pathname.c_str();
+            int status = mkdir(str, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
+         }
+#endif 
+
+         if (myid == 0)
+         {
+            stringstream logFilename;
+            logFilename << pathname + "/logfile" + UbSystem::toString(UbSystem::getTimeStamp()) + ".txt";
+            UbLog::output_policy::setStream(logFilename.str());
+         }
+      }
+
+      //Sleep(30000);
+
+      if (myid == 0) UBLOG(logINFO, "Testcase permeability");
+
+      if (myid == 0)
+      {
+         //string machinename = UbSystem::getMachineName();
+         //UBLOG(logINFO, "PID = " << myid << " Hostname: " << machinename);
+         UBLOG(logINFO, "PID = " << myid << " Total Physical Memory (RAM): " << Utilities::getTotalPhysMem());
+         UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used: " << Utilities::getPhysMemUsed());
+         UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe());
+      }
+
+      int blocknx1 = blocknx;
+      int blocknx2 = blocknx;
+      int blocknx3 = blocknx;
+
+      LBMReal rhoLB = 0.0;
+
+      double rhoLBinflow = dpLB*3.0;
+
+      SPtr<LBMUnitConverter> conv = SPtr<LBMUnitConverter>(new LBMUnitConverter());
+
+      const int baseLevel = 0;
+
+      double coord[6];
+
+
+
+      ///close void space
+      //////////////////////////////////////////////////////////////////////////
+      //{
+      //   string samplePathname = pathGeo + sampleFilename;
+
+      //   double deltaVoxelX1 = pmL1/(double)pmNX1;
+      //   double deltaVoxelX2 = pmL2/(double)pmNX2;
+      //   double deltaVoxelX3 = pmL3/(double)pmNX3;
+
+      //   GbVoxelMatrix3DPtr sample(new GbVoxelMatrix3D(pmNX1, pmNX2, pmNX3, 0, lthreshold, uthreshold));
+      //   if (rawFile)
+      //   {
+      //      sample->readMatrixFromRawFile<unsigned short>(samplePathname, GbVoxelMatrix3D::BigEndian);
+      //   }
+      //   else
+      //   {
+      //      sample->readMatrixFromVtiASCIIFile(samplePathname);
+      //   }
+
+      //   sample->setVoxelMatrixDelta((float)deltaVoxelX1, (float)deltaVoxelX2, (float)deltaVoxelX3);
+      //   sample->setVoxelMatrixMininum(0.0, 0.0, 0.0);
+
+      //   if (myid == 0) sample->writeToVTKImageDataASCII(pathname + "/geo/sampleOpen");
+      //   sample->calculateNumberOfSolidAndFluid();
+      //   if (myid == 0)  UBLOG(logINFO, "number of solid = "<<sample->getNumberOfSolid());
+      //   if (myid == 0)  UBLOG(logINFO, "number of fluid = "<<sample->getNumberOfFluid());
+
+      //   sample->setClosedVoidSpaceToSolid();
+
+      //   if (myid == 0) sample->writeToVTKImageDataASCII(pathname + "/geo/sampleClosed");
+
+      //   sample->calculateNumberOfSolidAndFluid();
+      //   if (myid == 0)  UBLOG(logINFO, "number of solid = "<<sample->getNumberOfSolid());
+      //   if (myid == 0)  UBLOG(logINFO, "number of fluid = "<<sample->getNumberOfFluid());
+
+      //   UBLOG(logINFO, "Finish!");
+      //   return;
+      //}
+      //////////////////////////////////////////////////////////////////////////
+
+      ////////////////////////////////////////////////////////////////////////
+      //Grid
+      //////////////////////////////////////////////////////////////////////////
+      SPtr<Grid3D> grid(new Grid3D(comm));
+
+      //BC adapters
+      SPtr<BCAdapter> noSlipBCAdapter(new NoSlipBCAdapter());
+      noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NoSlipBCAlgorithm()));
+
+      SPtr<BCAdapter> denBCAdapterInflow(new DensityBCAdapter(rhoLBinflow));
+      denBCAdapterInflow->setBcAlgorithm(SPtr<BCAlgorithm>(new NonEqDensityBCAlgorithm()));
+
+      SPtr<BCAdapter> denBCAdapterOutflow(new DensityBCAdapter(rhoLB));
+      denBCAdapterOutflow->setBcAlgorithm(SPtr<BCAlgorithm>(new NonEqDensityBCAlgorithm()));
+
+      //////////////////////////////////////////////////////////////////////////////////
+      //BS visitor
+      BoundaryConditionsBlockVisitor bcVisitor;
+      bcVisitor.addBC(noSlipBCAdapter);
+      bcVisitor.addBC(denBCAdapterInflow);
+      bcVisitor.addBC(denBCAdapterOutflow);;
+
+      SPtr<BCProcessor> bcProc;
+      bcProc = SPtr<BCProcessor>(new BCProcessor());
+
+      SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new CompressibleCumulant4thOrderViscosityLBMKernel());
+
+      kernel->setBCProcessor(bcProc);
+
+
+      //////////////////////////////////////////////////////////////////////////
+      //restart
+      SPtr<UbScheduler> mSch(new UbScheduler(cpStep, cpStart));
+      SPtr<MPIIOMigrationCoProcessor> migCoProcessor(new MPIIOMigrationCoProcessor(grid, mSch, pathname+"/mig", comm));
+      migCoProcessor->setLBMKernel(kernel);
+      migCoProcessor->setBCProcessor(bcProc);
+      //////////////////////////////////////////////////////////////////////////
+      
+	 if (myid == 0)
+	 {
+		UBLOG(logINFO, "Parameters:");
+		UBLOG(logINFO, "rhoLB = " << rhoLB);
+		UBLOG(logINFO, "nuLB = " << nuLB);
+		UBLOG(logINFO, "dpLB = " << dpLB);
+		UBLOG(logINFO, "dx = " << deltax << " m");
+
+		UBLOG(logINFO, "numOfThreads = " << numOfThreads);
+		UBLOG(logINFO, "path = " << pathname);
+		UBLOG(logINFO, "Preprozess - start");
+	 }      
+
+      if (newStart)
+      {
+         if (myid == 0) UBLOG(logINFO, "new start..");
+
+         if (myid == 0)
+         {
+            //UBLOG(logINFO, "new start PID = " << myid << " Hostname: " << machinename);
+            UBLOG(logINFO, "new start PID = " << myid << " Total Physical Memory (RAM): " << Utilities::getTotalPhysMem());
+            UBLOG(logINFO, "new start PID = " << myid << " Physical Memory currently used: " << Utilities::getPhysMemUsed());
+            UBLOG(logINFO, "new start PID = " << myid << " Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe());
+         }
+
+         string samplePathname = pathGeo + sampleFilename;
+
+         double deltaVoxelX1 = pmL1/(double)pmNX1;
+         double deltaVoxelX2 = pmL2/(double)pmNX2;
+         double deltaVoxelX3 = pmL3/(double)pmNX3;
+
+         SPtr<GbVoxelMatrix3D> sample(new GbVoxelMatrix3D(pmNX1, pmNX2, pmNX3, 0, lthreshold, uthreshold));
+         if (rawFile)
+         {
+            sample->readMatrixFromRawFile<unsigned short>(samplePathname, GbVoxelMatrix3D::BigEndian);
+         }
+         else
+         {
+            sample->readMatrixFromVtiASCIIFile(samplePathname);
+         }
+
+         sample->setVoxelMatrixDelta((float)deltaVoxelX1, (float)deltaVoxelX2, (float)deltaVoxelX3);
+         sample->setVoxelMatrixMininum(0.0, 0.0, 0.0);
+
+         if (myid == 0 && writeSampleToFile) sample->writeToVTKImageDataASCII(pathname + "/geo/sample");
+
+         ///////////////////////////////////////////////////////
+
+         ////////////////////////////////////////////////////////////////////////
+
+         double offset1 = sample->getLengthX1()/10.0;
+         double offset2 = 2.0*offset1;
+         //bounding box
+         double g_minX1 = sample->getX1Minimum() - offset1;
+         double g_minX2 = sample->getX2Minimum();
+         double g_minX3 = sample->getX3Minimum();
+
+         double g_maxX1 = sample->getX1Maximum() + offset2;
+         double g_maxX2 = sample->getX2Maximum();
+         double g_maxX3 = sample->getX3Maximum();
+
+         double blockLength = (double)blocknx1*deltax;
+
+         grid->setPeriodicX1(false);
+         grid->setPeriodicX2(false);
+         grid->setPeriodicX3(false);
+         grid->setDeltaX(deltax);
+         grid->setBlockNX(blocknx1, blocknx2, blocknx3);
+
+         SPtr<GbObject3D> gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
+         if (myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), pathname + "/geo/gridCube", WbWriterVtkXmlBinary::getInstance());
+
+         GenBlocksGridVisitor genBlocks(gridCube);
+         grid->accept(genBlocks);
+
+         //walls
+         GbCuboid3DPtr addWallYmin(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_minX2, g_maxX3+blockLength));
+         if (myid == 0) GbSystem3D::writeGeoObject(addWallYmin.get(), pathname+"/geo/addWallYmin", WbWriterVtkXmlASCII::getInstance());
+
+         GbCuboid3DPtr addWallZmin(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_minX3));
+         if (myid == 0) GbSystem3D::writeGeoObject(addWallZmin.get(), pathname+"/geo/addWallZmin", WbWriterVtkXmlASCII::getInstance());
+
+         GbCuboid3DPtr addWallYmax(new GbCuboid3D(g_minX1-blockLength, g_maxX2, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength));
+         if (myid == 0) GbSystem3D::writeGeoObject(addWallYmax.get(), pathname+"/geo/addWallYmax", WbWriterVtkXmlASCII::getInstance());
+
+         GbCuboid3DPtr addWallZmax(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_maxX3, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength));
+         if (myid == 0) GbSystem3D::writeGeoObject(addWallZmax.get(), pathname+"/geo/addWallZmax", WbWriterVtkXmlASCII::getInstance());
+
+
+         //inflow
+         GbCuboid3DPtr geoInflow(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3-blockLength, g_minX1, g_maxX2+blockLength, g_maxX3+blockLength));
+         if (myid == 0) GbSystem3D::writeGeoObject(geoInflow.get(), pathname + "/geo/geoInflow", WbWriterVtkXmlASCII::getInstance());
+
+         //outflow
+         GbCuboid3DPtr geoOutflow(new GbCuboid3D(g_maxX1, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength));
+         if (myid == 0) GbSystem3D::writeGeoObject(geoOutflow.get(), pathname + "/geo/geoOutflow", WbWriterVtkXmlASCII::getInstance());
+
+         //PM interactor
+         SPtr<D3Q27Interactor> sampleInt(new D3Q27Interactor(sample, grid, noSlipBCAdapter, Interactor3D::SOLID));
+
+         //wall interactors
+         SPtr<D3Q27Interactor> addWallYminInt(new D3Q27Interactor(addWallYmin, grid, noSlipBCAdapter, Interactor3D::SOLID));
+         SPtr<D3Q27Interactor> addWallZminInt(new D3Q27Interactor(addWallZmin, grid, noSlipBCAdapter, Interactor3D::SOLID));
+         SPtr<D3Q27Interactor> addWallYmaxInt(new D3Q27Interactor(addWallYmax, grid, noSlipBCAdapter, Interactor3D::SOLID));
+         SPtr<D3Q27Interactor> addWallZmaxInt(new D3Q27Interactor(addWallZmax, grid, noSlipBCAdapter, Interactor3D::SOLID));
+
+		 //inflow
+         SPtr<D3Q27Interactor> inflowInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoInflow, grid, denBCAdapterInflow, Interactor3D::SOLID));
+
+         //outflow
+         SPtr<D3Q27Interactor> outflowInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoOutflow, grid, denBCAdapterOutflow, Interactor3D::SOLID));;
+
+         if (myid == 0)
+         {
+            //UBLOG(logINFO, "PID = " << myid << " Hostname: " << machinename);
+            UBLOG(logINFO, "PID = " << myid << " Total Physical Memory (RAM): " << Utilities::getTotalPhysMem());
+            UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used: " << Utilities::getPhysMemUsed());
+            UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe());
+         }
+
+         ////////////////////////////////////////////
+         //METIS
+          SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B, MetisPartitioner::RECURSIVE));
+         ////////////////////////////////////////////
+
+         /////delete solid blocks
+         if (myid == 0) UBLOG(logINFO, "deleteSolidBlocks - start");
+         InteractorsHelper intHelper(grid, metisVisitor);
+         intHelper.addInteractor(addWallYminInt);
+         intHelper.addInteractor(addWallZminInt);
+         intHelper.addInteractor(addWallYmaxInt);
+         intHelper.addInteractor(addWallZmaxInt);
+         intHelper.addInteractor(inflowInt);
+         intHelper.addInteractor(outflowInt);
+         intHelper.addInteractor(sampleInt);
+         intHelper.selectBlocks();
+         if (myid == 0) UBLOG(logINFO, "deleteSolidBlocks - end");
+         //////////////////////////////////////
+
+         {
+            WriteBlocksCoProcessor ppblocks(grid, SPtr<UbScheduler>(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm);
+            ppblocks.process(1);
+         }
+
+         unsigned long nob = grid->getNumberOfBlocks();
+         int gl = 3;
+         unsigned long nodb = (blocknx1)* (blocknx2)* (blocknx3);
+         unsigned long nod = nob * (blocknx1)* (blocknx2)* (blocknx3);
+         unsigned long nodg = nob * (blocknx1 + gl) * (blocknx2 + gl) * (blocknx3 + gl);
+         double needMemAll = double(nodg*(27 * sizeof(double) + sizeof(int) + sizeof(float) * 4));
+         double needMem = needMemAll / double(comm->getNumberOfProcesses());
+
+         if (myid == 0)
+         {
+            UBLOG(logINFO, "Number of blocks = " << nob);
+            UBLOG(logINFO, "Number of nodes  = " << nod);
+            int minInitLevel = grid->getCoarsestInitializedLevel();
+            int maxInitLevel = grid->getFinestInitializedLevel();
+            for (int level = minInitLevel; level <= maxInitLevel; level++)
+            {
+               int nobl = grid->getNumberOfBlocks(level);
+               UBLOG(logINFO, "Number of blocks for level " << level << " = " << nobl);
+               UBLOG(logINFO, "Number of nodes for level " << level << " = " << nobl*nodb);
+            }
+            UBLOG(logINFO, "Necessary memory  = " << needMemAll << " bytes");
+            UBLOG(logINFO, "Necessary memory per process = " << needMem << " bytes");
+            UBLOG(logINFO, "Available memory per process = " << availMem << " bytes");
+         }
+
+
+         SetKernelBlockVisitor kernelVisitor(kernel, nuLB, availMem, needMem);
+         grid->accept(kernelVisitor);
+
+
+         //BC
+         intHelper.setBC();
+
+
+         //Press*1.6e8+(14.76-coordsX)/3.5*5000
+         //initialization of distributions
+         mu::Parser fct;
+         fct.SetExpr("(x1max-x1)/l*dp*3.0");
+         fct.DefineConst("dp", dpLB);
+         fct.DefineConst("x1max", g_maxX1);
+         fct.DefineConst("l", g_maxX1-g_minX1);
+
+         InitDistributionsBlockVisitor initVisitor;
+         initVisitor.setRho(fct);
+         grid->accept(initVisitor);
+
+         //Post process
+         {
+            SPtr<UbScheduler> geoSch(new UbScheduler(1));
+            WriteBoundaryConditionsCoProcessor ppgeo(grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), comm);
+            ppgeo.process(0);
+         }
+
+         coord[0] = sample->getX1Minimum();
+         coord[1] = sample->getX2Minimum();
+         coord[2] = sample->getX3Minimum();
+         coord[3] = sample->getX1Maximum();
+         coord[4] = sample->getX2Maximum();
+         coord[5] = sample->getX3Maximum();
+
+         ////////////////////////////////////////////////////////
+         FILE * pFile;
+         string str = pathname + "/checkpoints/coord.txt";
+         pFile = fopen(str.c_str(), "w");
+         fprintf(pFile, "%g\n", deltax);
+         fprintf(pFile, "%g\n", coord[0]);
+         fprintf(pFile, "%g\n", coord[1]);
+         fprintf(pFile, "%g\n", coord[2]);
+         fprintf(pFile, "%g\n", coord[3]);
+         fprintf(pFile, "%g\n", coord[4]);
+         fprintf(pFile, "%g\n", coord[5]);
+         fclose(pFile);
+         ////////////////////////////////////////////////////////
+
+         if (myid == 0) UBLOG(logINFO, "Preprozess - end");
+      }
+      else
+      {
+         ////////////////////////////////////////////////////////
+         FILE * pFile;
+         string str = pathname + "/checkpoints/coord.txt";
+         pFile = fopen(str.c_str(), "r");
+         fscanf(pFile, "%lg\n", &deltax);
+         fscanf(pFile, "%lg\n", &coord[0]);
+         fscanf(pFile, "%lg\n", &coord[1]);
+         fscanf(pFile, "%lg\n", &coord[2]);
+         fscanf(pFile, "%lg\n", &coord[3]);
+         fscanf(pFile, "%lg\n", &coord[4]);
+         fscanf(pFile, "%lg\n", &coord[5]);
+         fclose(pFile);
+         ////////////////////////////////////////////////////////
+
+         migCoProcessor->restart((int)restartStep);
+         grid->setTimeStep(restartStep);
+         
+         if (myid == 0) UBLOG(logINFO, "Restart - end");
+      }
+      
+      ////set connectors
+      SPtr<InterpolationProcessor> iProcessor(new CompressibleOffsetMomentsInterpolationProcessor());
+      SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
+      grid->accept(setConnsVisitor);
+
+      //bcVisitor should be accept after initialization!!!!
+      grid->accept(bcVisitor);
+      if (myid == 0) UBLOG(logINFO, "grid->accept(bcVisitor):end");
+      
+      SPtr<UbScheduler> nupsSch(new UbScheduler(nupsStep[0], nupsStep[1], nupsStep[2]));
+      std::shared_ptr<CoProcessor> nupsCoProcessor(new NUPSCounterCoProcessor(grid, nupsSch, numOfThreads, comm));
+
+      SPtr<UbScheduler> stepSch(new UbScheduler(outTimeStep, outTimeStart));
+
+      SPtr<CoProcessor> writeMQCoProcessor(new WriteMacroscopicQuantitiesCoProcessor(grid, stepSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, comm));
+
+      deltax = grid->getDeltaX(baseLevel);
+      double dxd2 = deltax / 2.0;
+
+      SPtr<IntegrateValuesHelper> ih1(new IntegrateValuesHelper(grid, comm, coord[0] - dxd2*10.0, coord[1] - dxd2, coord[2] - dxd2,
+         coord[0] - dxd2*10.0 - 2.0*dxd2, coord[4] + dxd2, coord[5] + dxd2));
+
+      //D3Q27IntegrateValuesHelperPtr ih2(new D3Q27IntegrateValuesHelper(grid, comm, coord[3]/2.0, coord[1] - dxd2, coord[2] - dxd2,
+      //   coord[3]/2.0 + 2.0*dxd2, coord[4] + dxd2, coord[5] + dxd2));
+      SPtr<IntegrateValuesHelper> ih2(new IntegrateValuesHelper(grid, comm, coord[0], coord[1], coord[2], coord[3], coord[4], coord[5]));
+
+      SPtr<IntegrateValuesHelper> ih3(new IntegrateValuesHelper(grid, comm, coord[3] + dxd2*10.0, coord[1] - dxd2, coord[2] - dxd2,
+         coord[3] + dxd2*10.0 + 2.0*dxd2, coord[4] + dxd2, coord[5] + dxd2));
+
+      //D3Q27IntegrateValuesHelperPtr ih1(new D3Q27IntegrateValuesHelper(grid, comm, coord[0], coord[1], coord[2], coord[3], coord[4], coord[5]));
+      if (myid == 0) GbSystem3D::writeGeoObject(ih1->getBoundingBox().get(), pathname + "/geo/ih1", WbWriterVtkXmlBinary::getInstance());
+      if (myid == 0) GbSystem3D::writeGeoObject(ih2->getBoundingBox().get(), pathname + "/geo/ih2", WbWriterVtkXmlBinary::getInstance());
+      if (myid == 0) GbSystem3D::writeGeoObject(ih3->getBoundingBox().get(), pathname + "/geo/ih3", WbWriterVtkXmlBinary::getInstance());
+
+      double factorp = 1; // dp_real / dpLB;
+      double factorv = 1;// dx / dt;
+      SPtr<UbScheduler> stepMV(new UbScheduler(timeSeriesOutTime));
+      
+      SPtr<CoProcessor> tsp1(new TimeseriesCoProcessor(grid, stepMV, ih1, pathname+timeSeriesFile+"_1", comm));
+      SPtr<CoProcessor> tsp2(new TimeseriesCoProcessor(grid, stepMV, ih2, pathname+timeSeriesFile+"_2", comm));
+      SPtr<CoProcessor> tsp3(new TimeseriesCoProcessor(grid, stepMV, ih3, pathname+timeSeriesFile+"_3", comm));
+
+      if (myid == 0)
+      {
+         UBLOG(logINFO, "PID = " << myid << " Total Physical Memory (RAM): " << Utilities::getTotalPhysMem());
+         UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used: " << Utilities::getPhysMemUsed());
+         UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe());
+      }
+
+      omp_set_num_threads(numOfThreads);
+      SPtr<UbScheduler> stepGhostLayer(new UbScheduler(1));
+      SPtr<Calculator> calculator(new BasicCalculator(grid, stepGhostLayer, endTime));
+      calculator->addCoProcessor(nupsCoProcessor);
+      calculator->addCoProcessor(tsp1);
+      calculator->addCoProcessor(tsp2);
+      calculator->addCoProcessor(tsp3);
+      calculator->addCoProcessor(writeMQCoProcessor);
+      calculator->addCoProcessor(migCoProcessor);
+      
+
+
+      if (myid==0) UBLOG(logINFO, "Simulation-start");
+      calculator->calculate();
+      if (myid==0) UBLOG(logINFO, "Simulation-end");
+   }
+   catch (exception& e)
+   {
+      cerr << e.what() << endl << flush;
+   }
+   catch (string& s)
+   {
+      cerr << s << endl;
+   }
+   catch (...)
+   {
+      cerr << "unknown exception" << endl;
+   }
+
+}
+//////////////////////////////////////////////////////////////////////////
+int main(int argc, char* argv[])
+{
+
+   if (argv != NULL)
+   {
+      if (argv[1] != NULL)
+      {
+         perm(string(argv[1]));
+      }
+      else
+      {
+         cout<<"Configuration file must be set!: "<<argv[0]<<" <config file>"<<endl<<std::flush;
+      }
+   }
+
+   return 0;
+}
diff --git a/apps/cpu/perm/perm.cpp_s b/apps/cpu/perm/perm.cpp_s
index 799c6d50c7d22b2c12347773da3144890f5049ec..3d6c8457f02a8e9063d1e8fd2758e284e769f1de 100644
--- a/apps/cpu/perm/perm.cpp_s
+++ b/apps/cpu/perm/perm.cpp_s
@@ -1,442 +1,442 @@
-#include <iostream>
-#include <string>
-
-#include <vfluids.h>
-
-using namespace std;
-
-
-void perm(const char *configname)
-{
-   try
-   {
-
-      string machine = QUOTEME(CAB_MACHINE);
-      string pathname, pathGeo;
-      int numOfThreads;
-      double availMem;
-
-      ConfigFileReader cf(configname);
-      if (!cf.read())
-      {
-         std::string exceptionText = "Unable to read configuration file\n";
-         throw exceptionText;
-      }
-
-      CommunicatorPtr comm = MPICommunicator::getInstance();
-      int myid = comm->getProcessID();
-
-      if (machine == "BOMBADIL")
-      {
-         numOfThreads = 4;
-         pathname = "d:/temp/perm";
-         pathGeo = "d:/Projects/SFB880/GeometrienPoroeseMedien/Allu_80-110";
-         availMem = 15.0e9;
-      }
-      else //if (machine == "M01" || machine == "M02")
-      {
-         numOfThreads = UbSystem::stringTo<int>(cf.getValue("numOfTreads"));
-         pathname = cf.getValue("pathname");
-         pathGeo = cf.getValue("pathGeo");
-         availMem = 12.0e9;
-
-#if defined(__unix__)
-         if (myid == 0)
-         {
-            const char* str = pathname.c_str();
-            int status = mkdir(str, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
-         }
-#endif 
-
-         if (myid == 0)
-         {
-            stringstream logFilename;
-            logFilename << pathname + "/logfile" + UbSystem::toString(UbSystem::getTimeStamp()) + ".txt";
-            UbLog::output_policy::setStream(logFilename.str());
-         }
-      }
-      //else throw UbException(UB_EXARGS, "unknown CAB_MACHINE");
-
-
-
-      if (myid == 0) UBLOG(logINFO, "Testcase permebility");
-
-      Grid3DPtr grid(new Grid3D(comm));
-  
-      const int blocknx1 = 64;
-      const int blocknx2 = 64;
-      const int blocknx3 = 64;
-
-      LBMReal rho_LB = 0.0;
-
-      //Re = (Lp*u)/nu, Lp - size of pore, u - volume-avaraged velocity, nu - viscositi
-      double Re = 1.0;
-      double u_LB = 0.01;
-
-      //dp/dx ~ u for laminar flow
-      double dp_LB = 0.0001;
-      double rhoLBinflow = dp_LB*3.0;
-
-      LBMUnitConverterPtr conv = LBMUnitConverterPtr(new LBMUnitConverter());
-
-      const int baseLevel = 0;
-      const int refineLevel = 0;
-
-      double nx3 = 3.0; //number of blocks for z
-      double deltax;
-      double coord[6];
-
-      //////////////////////////////////////////////////////////////////////////
-      //restart
-      UbSchedulerPtr rSch(new UbScheduler(50000, 50000, 10000000));
-      RestartPostprocessor rp(grid, rSch, comm, pathname, RestartPostprocessor::BINARY);
-      //////////////////////////////////////////////////////////////////////////
-
-      if (grid->getTimeStep() == 0)
-      {
-         if (myid == 0) UBLOG(logINFO, "Neustart..");
-
-         string sampleFilename = pathGeo + "/alu_80-110.vti";
-
-         int pmNX1 = 200;  //abmessung einzelbild in x-richtung
-         int pmNX2 = 200; //abmessung einzelbild in y richtung
-         int pmNX3 = 200; //anzahl der bilder
-
-         float lthreshold = 29041.0;
-         float uthreshold = 65535.0;
-         double deltaVoxelX1 = 4e-3/1096.0;
-         double deltaVoxelX2 = 5e-3/1327.0;
-         double deltaVoxelX3 = 5e-3/1265.0;
-
-
-         GbVoxelMatrix3DPtr sample(new GbVoxelMatrix3D(pmNX1, pmNX2, pmNX3, 0, lthreshold, uthreshold));
-         //sample->readMatrixFromRawFile<unsigned char>(sampleFilename, GbVoxelMatrix3D::BigEndian);
-         sample->readMatrixFromVtiASCIIFile(sampleFilename);
-         sample->setVoxelMatrixDelta(deltaVoxelX1, deltaVoxelX2, deltaVoxelX3);
-         sample->setVoxelMatrixMininum(0.0, 0.0, 0.0);
-
-         if (myid == 0) sample->writeToVTKImageDataASCII(pathname + "/geo/sample");
-
-         ///////////////////////////////////////////////////////
-
-         ////////////////////////////////////////////////////////////////////////
-
-         double offset = 0.2e-3; //0.5e-3;
-         //bounding box
-         double g_minX1 = sample->getX1Minimum() - offset;
-         double g_minX2 = sample->getX2Minimum();
-         double g_minX3 = sample->getX3Minimum();
-
-         double g_maxX1 = sample->getX1Maximum() + offset;
-         double g_maxX2 = sample->getX2Maximum();
-         double g_maxX3 = sample->getX3Maximum();
-
-         deltax = (g_maxX3-g_minX3) /(nx3*blocknx3);
-
-         double Lp = 90e-6/deltax;
-         double nu_LB = (Lp*u_LB)/Re;
-
-
-         double blockLength = (double)blocknx1*deltax;
-
-         grid->setPeriodicX1(false);
-         grid->setPeriodicX2(false);
-         grid->setPeriodicX3(false);
-         grid->setDeltaX(deltax);
-         grid->setBlockNX(blocknx1, blocknx2, blocknx3);
-
-         GbObject3DPtr gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
-         if (myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), pathname + "/geo/gridCube", WbWriterVtkXmlBinary::getInstance());
-
-
-         GenBlocksGridVisitor genBlocks(gridCube);
-         grid->accept(genBlocks);
-
-
-
-         if (myid == 0)
-         {
-            UBLOG(logINFO, "Parameters:");
-            //UBLOG(logINFO, "with forcing = " << with_forcing);
-            UBLOG(logINFO, "rho_LB = " << rho_LB);
-            UBLOG(logINFO, "nu_LB = " << nu_LB);
-            UBLOG(logINFO, "dp_LB = " << dp_LB);
-            UBLOG(logINFO, "u_LB = " << u_LB);
-            //UBLOG(logINFO, "forcing = " << forcing);
-            UBLOG(logINFO, "dx = " << deltax << " m");
-            //UBLOG(logINFO, "dt = " << dt << " s");
-            //UBLOG(logINFO, "rho_real = " << rho_real << " kg*m^-3");
-            //UBLOG(logINFO, "nu_real = " << nu_real << " m^2/s");
-            //UBLOG(logINFO, "dp_real = " << dp_real << " Pa");
-
-            UBLOG(logINFO, "number of levels = " << refineLevel + 1);
-            UBLOG(logINFO, "numOfThreads = " << numOfThreads);
-            UBLOG(logINFO, "path = " << pathname);
-            UBLOG(logINFO, "Preprozess - start");
-         }
-
-         //walls
-         GbCuboid3DPtr addWallYmin(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_minX2, g_maxX3+blockLength));
-         if (myid == 0) GbSystem3D::writeGeoObject(addWallYmin.get(), pathname+"/geo/addWallYmin", WbWriterVtkXmlASCII::getInstance());
-
-         GbCuboid3DPtr addWallZmin(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_minX3));
-         if (myid == 0) GbSystem3D::writeGeoObject(addWallZmin.get(), pathname+"/geo/addWallZmin", WbWriterVtkXmlASCII::getInstance());
-
-         GbCuboid3DPtr addWallYmax(new GbCuboid3D(g_minX1-blockLength, g_maxX2, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength));
-         if (myid == 0) GbSystem3D::writeGeoObject(addWallYmax.get(), pathname+"/geo/addWallYmax", WbWriterVtkXmlASCII::getInstance());
-
-         GbCuboid3DPtr addWallZmax(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_maxX3, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength));
-         if (myid == 0) GbSystem3D::writeGeoObject(addWallZmax.get(), pathname+"/geo/addWallZmax", WbWriterVtkXmlASCII::getInstance());
-
-
-         //inflow
-         GbCuboid3DPtr geoInflow(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3-blockLength, g_minX1, g_maxX2+blockLength, g_maxX3+blockLength));
-         if (myid == 0) GbSystem3D::writeGeoObject(geoInflow.get(), pathname + "/geo/geoInflow", WbWriterVtkXmlASCII::getInstance());
-
-         //outflow
-         GbCuboid3DPtr geoOutflow(new GbCuboid3D(g_maxX1, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength));
-         if (myid == 0) GbSystem3D::writeGeoObject(geoOutflow.get(), pathname + "/geo/geoOutflow", WbWriterVtkXmlASCII::getInstance());
-
-         BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm));
-
-         //bone interactor
-         int bcOptionNoSlip = 1; //0=simple Bounce Back, 1=quadr. BB, 2=thin wall
-         D3Q27BoundaryConditionAdapterPtr bcNoSlip(new D3Q27NoSlipBCAdapter(bcOptionNoSlip));
-         D3Q27InteractorPtr sampleInt(new D3Q27Interactor(sample, grid, bcNoSlip, Interactor3D::SOLID));
-
-         //wall interactors
-         D3Q27InteractorPtr addWallYminInt(new D3Q27Interactor(addWallYmin, grid, bcNoSlip, Interactor3D::SOLID));
-         D3Q27InteractorPtr addWallZminInt(new D3Q27Interactor(addWallZmin, grid, bcNoSlip, Interactor3D::SOLID));
-         D3Q27InteractorPtr addWallYmaxInt(new D3Q27Interactor(addWallYmax, grid, bcNoSlip, Interactor3D::SOLID));
-         D3Q27InteractorPtr addWallZmaxInt(new D3Q27Interactor(addWallZmax, grid, bcNoSlip, Interactor3D::SOLID));
-
-         D3Q27BoundaryConditionAdapterPtr denBCAdapterInflow(new D3Q27DensityBCAdapter(rhoLBinflow));
-         denBCAdapterInflow->setSecondaryBcOption(0);
-         D3Q27InteractorPtr inflowInt = D3Q27InteractorPtr(new D3Q27Interactor(geoInflow, grid, denBCAdapterInflow, Interactor3D::SOLID));
-
-         //outflow
-         D3Q27BoundaryConditionAdapterPtr denBCAdapterOutflow(new D3Q27DensityBCAdapter(rho_LB));
-         denBCAdapterOutflow->setSecondaryBcOption(0);
-         D3Q27InteractorPtr outflowInt = D3Q27InteractorPtr(new D3Q27Interactor(geoOutflow, grid, denBCAdapterOutflow, Interactor3D::SOLID));
-
-         ////////////////////////////////////////////
-         //METIS
-         Grid3DVisitorPtr metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::BSW));
-         ////////////////////////////////////////////
-         /////delete solid blocks
-         if (myid == 0) UBLOG(logINFO, "deleteSolidBlocks - start");
-         InteractorsHelper intHelper(grid, metisVisitor);
-         intHelper.addInteractor(sampleInt);
-         intHelper.addInteractor(addWallYminInt);
-         intHelper.addInteractor(addWallZminInt);
-         intHelper.addInteractor(addWallYmaxInt);
-         intHelper.addInteractor(addWallZmaxInt);
-         intHelper.addInteractor(inflowInt);
-         intHelper.addInteractor(outflowInt);
-         intHelper.selectBlocks();
-         if (myid == 0) UBLOG(logINFO, "deleteSolidBlocks - end");
-         //////////////////////////////////////
-
-         //set connectors
-         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
-         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nu_LB, iProcessor);
-         grid->accept(setConnsVisitor);
-
-         //domain decomposition for threads
-         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
-         grid->accept(pqPartVisitor);
-
-         ppblocks->update(0);
-         ppblocks.reset();
-
-         unsigned long nob = grid->getNumberOfBlocks();
-         int gl = 3;
-         unsigned long nodb = (blocknx1)* (blocknx2)* (blocknx3);
-         unsigned long nod = nob * (blocknx1)* (blocknx2)* (blocknx3);
-         unsigned long nodg = nob * (blocknx1 + gl) * (blocknx2 + gl) * (blocknx3 + gl);
-         double needMemAll = double(nodg*(27 * sizeof(double) + sizeof(int) + sizeof(float) * 4));
-         double needMem = needMemAll / double(comm->getNumberOfProcesses());
-
-         if (myid == 0)
-         {
-            UBLOG(logINFO, "Number of blocks = " << nob);
-            UBLOG(logINFO, "Number of nodes  = " << nod);
-            int minInitLevel = grid->getCoarsestInitializedLevel();
-            int maxInitLevel = grid->getFinestInitializedLevel();
-            for (int level = minInitLevel; level <= maxInitLevel; level++)
-            {
-               int nobl = grid->getNumberOfBlocks(level);
-               UBLOG(logINFO, "Number of blocks for level " << level << " = " << nobl);
-               UBLOG(logINFO, "Number of nodes for level " << level << " = " << nobl*nodb);
-            }
-            UBLOG(logINFO, "Necessary memory  = " << needMemAll << " bytes");
-            UBLOG(logINFO, "Necessary memory per process = " << needMem << " bytes");
-            UBLOG(logINFO, "Available memory per process = " << availMem << " bytes");
-         }
-
-         LBMKernel3DPtr kernel = LBMKernel3DPtr(new LBMKernelETD3Q27CCLB(blocknx1, blocknx2, blocknx3, LBMKernelETD3Q27CCLB::NORMAL));
-
-         //mu::Parser fctForcingX3;
-         //fctForcingX3.SetExpr("Fx3");
-         //fctForcingX3.DefineConst("Fx3", forcing);
-
-         //kernel->setForcingX3(fctForcingX3);
-         //kernel->setWithForcing(true);
-
-         //BCProcessorPtr bcProc(new D3Q27ETForThinWallBCProcessor());
-         BCProcessorPtr bcProc(new D3Q27ETBCProcessor());
-         kernel->setBCProcessor(bcProc);
-
-         SetKernelBlockVisitor kernelVisitor(kernel, nu_LB, availMem, needMem);
-         grid->accept(kernelVisitor);
-
-
-         //BC
-         intHelper.setBC();
-
-         //Press*1.6e8+(14.76-coordsX)/3.5*5000
-         //initialization of distributions
-         //mu::Parser fct;
-         //fct.SetExpr("(x1max-x1)/l*dp*3.0");
-         //fct.DefineConst("dp", dp_LB);
-         //fct.DefineConst("x3max", g_maxX3);
-         //fct.DefineConst("l", g_maxX3-g_minX3);
-
-         D3Q27ETInitDistributionsBlockVisitor initVisitor(nu_LB, rho_LB);
-         //initVisitor.setRho(fct);
-         //initVisitor.setVx1(fct);
-         initVisitor.setVx1(0);
-         grid->accept(initVisitor);
-
-         //Postrozess
-         UbSchedulerPtr geoSch(new UbScheduler(1));
-         D3Q27MacroscopicQuantitiesPostprocessorPtr ppgeo(
-            new D3Q27MacroscopicQuantitiesPostprocessor(grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, true));
-         ppgeo->update(0);
-         ppgeo.reset();
-
-         coord[0] = sample->getX1Minimum();
-         coord[1] = sample->getX2Minimum();
-         coord[2] = sample->getX3Minimum();
-         coord[3] = sample->getX1Maximum();
-         coord[4] = sample->getX2Maximum();
-         coord[5] = sample->getX3Maximum();
-
-         ////////////////////////////////////////////////////////
-         FILE * pFile;
-         string str = pathname + "/checkpoints/coord.txt";
-         pFile = fopen(str.c_str(), "w");
-         fprintf(pFile, "%f\n", deltax);
-         fprintf(pFile, "%f\n", coord[0]);
-         fprintf(pFile, "%f\n", coord[1]);
-         fprintf(pFile, "%f\n", coord[2]);
-         fprintf(pFile, "%f\n", coord[3]);
-         fprintf(pFile, "%f\n", coord[4]);
-         fprintf(pFile, "%f\n", coord[5]);
-         fclose(pFile);
-         ////////////////////////////////////////////////////////
-
-
-         if (myid == 0) UBLOG(logINFO, "Preprozess - end");
-      }
-      else
-      {
-         ////////////////////////////////////////////////////////
-         FILE * pFile;
-         string str = pathname + "/checkpoints/coord.txt";
-         pFile = fopen(str.c_str(), "r");
-         fscanf(pFile, "%f\n", &deltax);
-         fscanf(pFile, "%f\n", &coord[0]);
-         fscanf(pFile, "%f\n", &coord[1]);
-         fscanf(pFile, "%f\n", &coord[2]);
-         fscanf(pFile, "%f\n", &coord[3]);
-         fscanf(pFile, "%f\n", &coord[4]);
-         fscanf(pFile, "%f\n", &coord[5]);
-         fclose(pFile);
-         ////////////////////////////////////////////////////////
-
-         double Lp = 0.35e-3/deltax;
-         double nu_LB = (Lp*u_LB)/Re;
-
-         //set connectors
-         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
-         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nu_LB, iProcessor);
-         grid->accept(setConnsVisitor);
-
-
-
-         if (myid == 0) UBLOG(logINFO, "Restart - end");
-      }
-      UbSchedulerPtr nupsSch(new UbScheduler(10, 30, 100));
-      NUPSCounterPostprocessor npr(grid, nupsSch, numOfThreads, comm);
-
-      double outTime = 30000;
-      UbSchedulerPtr stepSch(new UbScheduler(outTime));
-      stepSch->addSchedule(10, 10, 10);
-      stepSch->addSchedule(100, 100, 100);
-      stepSch->addSchedule(1000, 1000, 1000);
-      stepSch->addSchedule(100, 1500, 2000);
-      stepSch->addSchedule(10000, 10000, 10000);
-
-      D3Q27MacroscopicQuantitiesPostprocessor pp(grid, stepSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv);
-
-      double dxd2 = deltax / 2.0;
-      //D3Q27IntegrateValuesHelperPtr ih1(new D3Q27IntegrateValuesHelper(grid, comm, coord[0] - dxd2, coord[1] - dxd2, coord[2] - dxd2,
-      //   coord[3] + dxd2, coord[4] + dxd2, coord[5] + dxd2));
-      //if (myid == 0) GbSystem3D::writeGeoObject(ih1->getBoundingBox().get(), pathname + "/geo/ih1", WbWriterVtkXmlBinary::getInstance());
-
-      D3Q27IntegrateValuesHelperPtr ih1(new D3Q27IntegrateValuesHelper(grid, comm, coord[3] + dxd2, coord[1] - dxd2, coord[2] - dxd2,
-         coord[3] + 2.0*dxd2, coord[4] + dxd2, coord[5] + dxd2));
-      if (myid == 0) GbSystem3D::writeGeoObject(ih1->getBoundingBox().get(), pathname + "/geo/ih1", WbWriterVtkXmlBinary::getInstance());
-
-      double factorp = 1; // dp_real / dp_LB;
-      double factorv = 1;// dx / dt;
-      UbSchedulerPtr stepMV(new UbScheduler(1));
-      D3Q27MeanValuesPostprocessor mvp1(grid, stepMV, pathname + "/mv/mv1.txt", comm, ih1, factorp, factorv);
-
-
-      //D3Q27IntegrateValuesHelperPtr ih2(new D3Q27IntegrateValuesHelper(grid, comm, g_maxX1-2.0*deltax, g_minX2, g_minX3,
-      //   g_maxX1 - deltax, g_maxX2, g_maxX3));
-      //if (myid == 0) GbSystem3D::writeGeoObject(ih2->getBoundingBox().get(), pathname + "/geo/ih2", WbWriterVtkXmlBinary::getInstance());
-
-      //D3Q27MeanValuesPostprocessor mvp2(grid, stepSch, pathname + "/mv/mv2.txt", comm, ih2, factorp, factorv);
-
-      if (myid == 0)
-      {
-         UBLOG(logINFO, "PID = " << myid << " Total Physical Memory (RAM): " << MemoryUtil::getTotalPhysMem());
-         UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used: " << MemoryUtil::getPhysMemUsed());
-         UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used by current process: " << MemoryUtil::getPhysMemUsedByMe());
-      }
-
-      double endTime = UbSystem::stringTo<double>(cf.getValue("endTime")); //100001;//10001.0;
-
-      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, stepMV));
-      if (myid == 0) UBLOG(logINFO, "Simulation-start");
-      calculation->calculate();
-      if (myid == 0) UBLOG(logINFO, "Simulation-end");
-   }
-   catch (exception& e)
-   {
-      cerr << e.what() << endl << flush;
-   }
-   catch (string& s)
-   {
-      cerr << s << endl;
-   }
-   catch (...)
-   {
-      cerr << "unknown exception" << endl;
-   }
-
-}
-//////////////////////////////////////////////////////////////////////////
-int main(int argc, char* argv[])
-{
-
-   if (argv != NULL)
-   {
-      perm(argv[1]);
-   }
-
-   return 0;
-}
+#include <iostream>
+#include <string>
+
+#include <vfluids.h>
+
+using namespace std;
+
+
+void perm(const char *configname)
+{
+   try
+   {
+
+      string machine = QUOTEME(CAB_MACHINE);
+      string pathname, pathGeo;
+      int numOfThreads;
+      double availMem;
+
+      ConfigFileReader cf(configname);
+      if (!cf.read())
+      {
+         std::string exceptionText = "Unable to read configuration file\n";
+         throw exceptionText;
+      }
+
+      CommunicatorPtr comm = MPICommunicator::getInstance();
+      int myid = comm->getProcessID();
+
+      if (machine == "BOMBADIL")
+      {
+         numOfThreads = 4;
+         pathname = "d:/temp/perm";
+         pathGeo = "d:/Projects/SFB880/GeometrienPoroeseMedien/Allu_80-110";
+         availMem = 15.0e9;
+      }
+      else //if (machine == "M01" || machine == "M02")
+      {
+         numOfThreads = UbSystem::stringTo<int>(cf.getValue("numOfTreads"));
+         pathname = cf.getValue("pathname");
+         pathGeo = cf.getValue("pathGeo");
+         availMem = 12.0e9;
+
+#if defined(__unix__)
+         if (myid == 0)
+         {
+            const char* str = pathname.c_str();
+            int status = mkdir(str, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
+         }
+#endif 
+
+         if (myid == 0)
+         {
+            stringstream logFilename;
+            logFilename << pathname + "/logfile" + UbSystem::toString(UbSystem::getTimeStamp()) + ".txt";
+            UbLog::output_policy::setStream(logFilename.str());
+         }
+      }
+      //else throw UbException(UB_EXARGS, "unknown CAB_MACHINE");
+
+
+
+      if (myid == 0) UBLOG(logINFO, "Testcase permebility");
+
+      Grid3DPtr grid(new Grid3D(comm));
+  
+      const int blocknx1 = 64;
+      const int blocknx2 = 64;
+      const int blocknx3 = 64;
+
+      LBMReal rho_LB = 0.0;
+
+      //Re = (Lp*u)/nu, Lp - size of pore, u - volume-avaraged velocity, nu - viscositi
+      double Re = 1.0;
+      double u_LB = 0.01;
+
+      //dp/dx ~ u for laminar flow
+      double dp_LB = 0.0001;
+      double rhoLBinflow = dp_LB*3.0;
+
+      LBMUnitConverterPtr conv = LBMUnitConverterPtr(new LBMUnitConverter());
+
+      const int baseLevel = 0;
+      const int refineLevel = 0;
+
+      double nx3 = 3.0; //number of blocks for z
+      double deltax;
+      double coord[6];
+
+      //////////////////////////////////////////////////////////////////////////
+      //restart
+      UbSchedulerPtr rSch(new UbScheduler(50000, 50000, 10000000));
+      RestartPostprocessor rp(grid, rSch, comm, pathname, RestartPostprocessor::BINARY);
+      //////////////////////////////////////////////////////////////////////////
+
+      if (grid->getTimeStep() == 0)
+      {
+         if (myid == 0) UBLOG(logINFO, "Neustart..");
+
+         string sampleFilename = pathGeo + "/alu_80-110.vti";
+
+         int pmNX1 = 200;  //abmessung einzelbild in x-richtung
+         int pmNX2 = 200; //abmessung einzelbild in y richtung
+         int pmNX3 = 200; //anzahl der bilder
+
+         float lthreshold = 29041.0;
+         float uthreshold = 65535.0;
+         double deltaVoxelX1 = 4e-3/1096.0;
+         double deltaVoxelX2 = 5e-3/1327.0;
+         double deltaVoxelX3 = 5e-3/1265.0;
+
+
+         GbVoxelMatrix3DPtr sample(new GbVoxelMatrix3D(pmNX1, pmNX2, pmNX3, 0, lthreshold, uthreshold));
+         //sample->readMatrixFromRawFile<unsigned char>(sampleFilename, GbVoxelMatrix3D::BigEndian);
+         sample->readMatrixFromVtiASCIIFile(sampleFilename);
+         sample->setVoxelMatrixDelta(deltaVoxelX1, deltaVoxelX2, deltaVoxelX3);
+         sample->setVoxelMatrixMininum(0.0, 0.0, 0.0);
+
+         if (myid == 0) sample->writeToVTKImageDataASCII(pathname + "/geo/sample");
+
+         ///////////////////////////////////////////////////////
+
+         ////////////////////////////////////////////////////////////////////////
+
+         double offset = 0.2e-3; //0.5e-3;
+         //bounding box
+         double g_minX1 = sample->getX1Minimum() - offset;
+         double g_minX2 = sample->getX2Minimum();
+         double g_minX3 = sample->getX3Minimum();
+
+         double g_maxX1 = sample->getX1Maximum() + offset;
+         double g_maxX2 = sample->getX2Maximum();
+         double g_maxX3 = sample->getX3Maximum();
+
+         deltax = (g_maxX3-g_minX3) /(nx3*blocknx3);
+
+         double Lp = 90e-6/deltax;
+         double nu_LB = (Lp*u_LB)/Re;
+
+
+         double blockLength = (double)blocknx1*deltax;
+
+         grid->setPeriodicX1(false);
+         grid->setPeriodicX2(false);
+         grid->setPeriodicX3(false);
+         grid->setDeltaX(deltax);
+         grid->setBlockNX(blocknx1, blocknx2, blocknx3);
+
+         GbObject3DPtr gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
+         if (myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), pathname + "/geo/gridCube", WbWriterVtkXmlBinary::getInstance());
+
+
+         GenBlocksGridVisitor genBlocks(gridCube);
+         grid->accept(genBlocks);
+
+
+
+         if (myid == 0)
+         {
+            UBLOG(logINFO, "Parameters:");
+            //UBLOG(logINFO, "with forcing = " << with_forcing);
+            UBLOG(logINFO, "rho_LB = " << rho_LB);
+            UBLOG(logINFO, "nu_LB = " << nu_LB);
+            UBLOG(logINFO, "dp_LB = " << dp_LB);
+            UBLOG(logINFO, "u_LB = " << u_LB);
+            //UBLOG(logINFO, "forcing = " << forcing);
+            UBLOG(logINFO, "dx = " << deltax << " m");
+            //UBLOG(logINFO, "dt = " << dt << " s");
+            //UBLOG(logINFO, "rho_real = " << rho_real << " kg*m^-3");
+            //UBLOG(logINFO, "nu_real = " << nu_real << " m^2/s");
+            //UBLOG(logINFO, "dp_real = " << dp_real << " Pa");
+
+            UBLOG(logINFO, "number of levels = " << refineLevel + 1);
+            UBLOG(logINFO, "numOfThreads = " << numOfThreads);
+            UBLOG(logINFO, "path = " << pathname);
+            UBLOG(logINFO, "Preprozess - start");
+         }
+
+         //walls
+         GbCuboid3DPtr addWallYmin(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_minX2, g_maxX3+blockLength));
+         if (myid == 0) GbSystem3D::writeGeoObject(addWallYmin.get(), pathname+"/geo/addWallYmin", WbWriterVtkXmlASCII::getInstance());
+
+         GbCuboid3DPtr addWallZmin(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_minX3));
+         if (myid == 0) GbSystem3D::writeGeoObject(addWallZmin.get(), pathname+"/geo/addWallZmin", WbWriterVtkXmlASCII::getInstance());
+
+         GbCuboid3DPtr addWallYmax(new GbCuboid3D(g_minX1-blockLength, g_maxX2, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength));
+         if (myid == 0) GbSystem3D::writeGeoObject(addWallYmax.get(), pathname+"/geo/addWallYmax", WbWriterVtkXmlASCII::getInstance());
+
+         GbCuboid3DPtr addWallZmax(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_maxX3, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength));
+         if (myid == 0) GbSystem3D::writeGeoObject(addWallZmax.get(), pathname+"/geo/addWallZmax", WbWriterVtkXmlASCII::getInstance());
+
+
+         //inflow
+         GbCuboid3DPtr geoInflow(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3-blockLength, g_minX1, g_maxX2+blockLength, g_maxX3+blockLength));
+         if (myid == 0) GbSystem3D::writeGeoObject(geoInflow.get(), pathname + "/geo/geoInflow", WbWriterVtkXmlASCII::getInstance());
+
+         //outflow
+         GbCuboid3DPtr geoOutflow(new GbCuboid3D(g_maxX1, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength));
+         if (myid == 0) GbSystem3D::writeGeoObject(geoOutflow.get(), pathname + "/geo/geoOutflow", WbWriterVtkXmlASCII::getInstance());
+
+         BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm));
+
+         //bone interactor
+         int bcOptionNoSlip = 1; //0=simple Bounce Back, 1=quadr. BB, 2=thin wall
+         D3Q27BoundaryConditionAdapterPtr bcNoSlip(new D3Q27NoSlipBCAdapter(bcOptionNoSlip));
+         D3Q27InteractorPtr sampleInt(new D3Q27Interactor(sample, grid, bcNoSlip, Interactor3D::SOLID));
+
+         //wall interactors
+         D3Q27InteractorPtr addWallYminInt(new D3Q27Interactor(addWallYmin, grid, bcNoSlip, Interactor3D::SOLID));
+         D3Q27InteractorPtr addWallZminInt(new D3Q27Interactor(addWallZmin, grid, bcNoSlip, Interactor3D::SOLID));
+         D3Q27InteractorPtr addWallYmaxInt(new D3Q27Interactor(addWallYmax, grid, bcNoSlip, Interactor3D::SOLID));
+         D3Q27InteractorPtr addWallZmaxInt(new D3Q27Interactor(addWallZmax, grid, bcNoSlip, Interactor3D::SOLID));
+
+         D3Q27BoundaryConditionAdapterPtr denBCAdapterInflow(new D3Q27DensityBCAdapter(rhoLBinflow));
+         denBCAdapterInflow->setSecondaryBcOption(0);
+         D3Q27InteractorPtr inflowInt = D3Q27InteractorPtr(new D3Q27Interactor(geoInflow, grid, denBCAdapterInflow, Interactor3D::SOLID));
+
+         //outflow
+         D3Q27BoundaryConditionAdapterPtr denBCAdapterOutflow(new D3Q27DensityBCAdapter(rho_LB));
+         denBCAdapterOutflow->setSecondaryBcOption(0);
+         D3Q27InteractorPtr outflowInt = D3Q27InteractorPtr(new D3Q27Interactor(geoOutflow, grid, denBCAdapterOutflow, Interactor3D::SOLID));
+
+         ////////////////////////////////////////////
+         //METIS
+         Grid3DVisitorPtr metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::BSW));
+         ////////////////////////////////////////////
+         /////delete solid blocks
+         if (myid == 0) UBLOG(logINFO, "deleteSolidBlocks - start");
+         InteractorsHelper intHelper(grid, metisVisitor);
+         intHelper.addInteractor(sampleInt);
+         intHelper.addInteractor(addWallYminInt);
+         intHelper.addInteractor(addWallZminInt);
+         intHelper.addInteractor(addWallYmaxInt);
+         intHelper.addInteractor(addWallZmaxInt);
+         intHelper.addInteractor(inflowInt);
+         intHelper.addInteractor(outflowInt);
+         intHelper.selectBlocks();
+         if (myid == 0) UBLOG(logINFO, "deleteSolidBlocks - end");
+         //////////////////////////////////////
+
+         //set connectors
+         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
+         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nu_LB, iProcessor);
+         grid->accept(setConnsVisitor);
+
+         //domain decomposition for threads
+         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
+         grid->accept(pqPartVisitor);
+
+         ppblocks->update(0);
+         ppblocks.reset();
+
+         unsigned long nob = grid->getNumberOfBlocks();
+         int gl = 3;
+         unsigned long nodb = (blocknx1)* (blocknx2)* (blocknx3);
+         unsigned long nod = nob * (blocknx1)* (blocknx2)* (blocknx3);
+         unsigned long nodg = nob * (blocknx1 + gl) * (blocknx2 + gl) * (blocknx3 + gl);
+         double needMemAll = double(nodg*(27 * sizeof(double) + sizeof(int) + sizeof(float) * 4));
+         double needMem = needMemAll / double(comm->getNumberOfProcesses());
+
+         if (myid == 0)
+         {
+            UBLOG(logINFO, "Number of blocks = " << nob);
+            UBLOG(logINFO, "Number of nodes  = " << nod);
+            int minInitLevel = grid->getCoarsestInitializedLevel();
+            int maxInitLevel = grid->getFinestInitializedLevel();
+            for (int level = minInitLevel; level <= maxInitLevel; level++)
+            {
+               int nobl = grid->getNumberOfBlocks(level);
+               UBLOG(logINFO, "Number of blocks for level " << level << " = " << nobl);
+               UBLOG(logINFO, "Number of nodes for level " << level << " = " << nobl*nodb);
+            }
+            UBLOG(logINFO, "Necessary memory  = " << needMemAll << " bytes");
+            UBLOG(logINFO, "Necessary memory per process = " << needMem << " bytes");
+            UBLOG(logINFO, "Available memory per process = " << availMem << " bytes");
+         }
+
+         LBMKernel3DPtr kernel = LBMKernel3DPtr(new LBMKernelETD3Q27CCLB(blocknx1, blocknx2, blocknx3, LBMKernelETD3Q27CCLB::NORMAL));
+
+         //mu::Parser fctForcingX3;
+         //fctForcingX3.SetExpr("Fx3");
+         //fctForcingX3.DefineConst("Fx3", forcing);
+
+         //kernel->setForcingX3(fctForcingX3);
+         //kernel->setWithForcing(true);
+
+         //BCProcessorPtr bcProc(new D3Q27ETForThinWallBCProcessor());
+         BCProcessorPtr bcProc(new D3Q27ETBCProcessor());
+         kernel->setBCProcessor(bcProc);
+
+         SetKernelBlockVisitor kernelVisitor(kernel, nu_LB, availMem, needMem);
+         grid->accept(kernelVisitor);
+
+
+         //BC
+         intHelper.setBC();
+
+         //Press*1.6e8+(14.76-coordsX)/3.5*5000
+         //initialization of distributions
+         //mu::Parser fct;
+         //fct.SetExpr("(x1max-x1)/l*dp*3.0");
+         //fct.DefineConst("dp", dp_LB);
+         //fct.DefineConst("x3max", g_maxX3);
+         //fct.DefineConst("l", g_maxX3-g_minX3);
+
+         D3Q27ETInitDistributionsBlockVisitor initVisitor(nu_LB, rho_LB);
+         //initVisitor.setRho(fct);
+         //initVisitor.setVx1(fct);
+         initVisitor.setVx1(0);
+         grid->accept(initVisitor);
+
+         //Postrozess
+         UbSchedulerPtr geoSch(new UbScheduler(1));
+         D3Q27MacroscopicQuantitiesPostprocessorPtr ppgeo(
+            new D3Q27MacroscopicQuantitiesPostprocessor(grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, true));
+         ppgeo->update(0);
+         ppgeo.reset();
+
+         coord[0] = sample->getX1Minimum();
+         coord[1] = sample->getX2Minimum();
+         coord[2] = sample->getX3Minimum();
+         coord[3] = sample->getX1Maximum();
+         coord[4] = sample->getX2Maximum();
+         coord[5] = sample->getX3Maximum();
+
+         ////////////////////////////////////////////////////////
+         FILE * pFile;
+         string str = pathname + "/checkpoints/coord.txt";
+         pFile = fopen(str.c_str(), "w");
+         fprintf(pFile, "%f\n", deltax);
+         fprintf(pFile, "%f\n", coord[0]);
+         fprintf(pFile, "%f\n", coord[1]);
+         fprintf(pFile, "%f\n", coord[2]);
+         fprintf(pFile, "%f\n", coord[3]);
+         fprintf(pFile, "%f\n", coord[4]);
+         fprintf(pFile, "%f\n", coord[5]);
+         fclose(pFile);
+         ////////////////////////////////////////////////////////
+
+
+         if (myid == 0) UBLOG(logINFO, "Preprozess - end");
+      }
+      else
+      {
+         ////////////////////////////////////////////////////////
+         FILE * pFile;
+         string str = pathname + "/checkpoints/coord.txt";
+         pFile = fopen(str.c_str(), "r");
+         fscanf(pFile, "%f\n", &deltax);
+         fscanf(pFile, "%f\n", &coord[0]);
+         fscanf(pFile, "%f\n", &coord[1]);
+         fscanf(pFile, "%f\n", &coord[2]);
+         fscanf(pFile, "%f\n", &coord[3]);
+         fscanf(pFile, "%f\n", &coord[4]);
+         fscanf(pFile, "%f\n", &coord[5]);
+         fclose(pFile);
+         ////////////////////////////////////////////////////////
+
+         double Lp = 0.35e-3/deltax;
+         double nu_LB = (Lp*u_LB)/Re;
+
+         //set connectors
+         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
+         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nu_LB, iProcessor);
+         grid->accept(setConnsVisitor);
+
+
+
+         if (myid == 0) UBLOG(logINFO, "Restart - end");
+      }
+      UbSchedulerPtr nupsSch(new UbScheduler(10, 30, 100));
+      NUPSCounterPostprocessor npr(grid, nupsSch, numOfThreads, comm);
+
+      double outTime = 30000;
+      UbSchedulerPtr stepSch(new UbScheduler(outTime));
+      stepSch->addSchedule(10, 10, 10);
+      stepSch->addSchedule(100, 100, 100);
+      stepSch->addSchedule(1000, 1000, 1000);
+      stepSch->addSchedule(100, 1500, 2000);
+      stepSch->addSchedule(10000, 10000, 10000);
+
+      D3Q27MacroscopicQuantitiesPostprocessor pp(grid, stepSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv);
+
+      double dxd2 = deltax / 2.0;
+      //D3Q27IntegrateValuesHelperPtr ih1(new D3Q27IntegrateValuesHelper(grid, comm, coord[0] - dxd2, coord[1] - dxd2, coord[2] - dxd2,
+      //   coord[3] + dxd2, coord[4] + dxd2, coord[5] + dxd2));
+      //if (myid == 0) GbSystem3D::writeGeoObject(ih1->getBoundingBox().get(), pathname + "/geo/ih1", WbWriterVtkXmlBinary::getInstance());
+
+      D3Q27IntegrateValuesHelperPtr ih1(new D3Q27IntegrateValuesHelper(grid, comm, coord[3] + dxd2, coord[1] - dxd2, coord[2] - dxd2,
+         coord[3] + 2.0*dxd2, coord[4] + dxd2, coord[5] + dxd2));
+      if (myid == 0) GbSystem3D::writeGeoObject(ih1->getBoundingBox().get(), pathname + "/geo/ih1", WbWriterVtkXmlBinary::getInstance());
+
+      double factorp = 1; // dp_real / dp_LB;
+      double factorv = 1;// dx / dt;
+      UbSchedulerPtr stepMV(new UbScheduler(1));
+      D3Q27MeanValuesPostprocessor mvp1(grid, stepMV, pathname + "/mv/mv1.txt", comm, ih1, factorp, factorv);
+
+
+      //D3Q27IntegrateValuesHelperPtr ih2(new D3Q27IntegrateValuesHelper(grid, comm, g_maxX1-2.0*deltax, g_minX2, g_minX3,
+      //   g_maxX1 - deltax, g_maxX2, g_maxX3));
+      //if (myid == 0) GbSystem3D::writeGeoObject(ih2->getBoundingBox().get(), pathname + "/geo/ih2", WbWriterVtkXmlBinary::getInstance());
+
+      //D3Q27MeanValuesPostprocessor mvp2(grid, stepSch, pathname + "/mv/mv2.txt", comm, ih2, factorp, factorv);
+
+      if (myid == 0)
+      {
+         UBLOG(logINFO, "PID = " << myid << " Total Physical Memory (RAM): " << MemoryUtil::getTotalPhysMem());
+         UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used: " << MemoryUtil::getPhysMemUsed());
+         UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used by current process: " << MemoryUtil::getPhysMemUsedByMe());
+      }
+
+      double endTime = UbSystem::stringTo<double>(cf.getValue("endTime")); //100001;//10001.0;
+
+      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, stepMV));
+      if (myid == 0) UBLOG(logINFO, "Simulation-start");
+      calculation->calculate();
+      if (myid == 0) UBLOG(logINFO, "Simulation-end");
+   }
+   catch (exception& e)
+   {
+      cerr << e.what() << endl << flush;
+   }
+   catch (string& s)
+   {
+      cerr << s << endl;
+   }
+   catch (...)
+   {
+      cerr << "unknown exception" << endl;
+   }
+
+}
+//////////////////////////////////////////////////////////////////////////
+int main(int argc, char* argv[])
+{
+
+   if (argv != NULL)
+   {
+      perm(argv[1]);
+   }
+
+   return 0;
+}
diff --git a/apps/cpu/plate/CMakeLists.txt b/apps/cpu/plate/CMakeLists.txt
index e239e51050d988321fbdd347bd1d89722c788d2a..cc2d6aea0a0a007395f1010facdd2880608ce895 100644
--- a/apps/cpu/plate/CMakeLists.txt
+++ b/apps/cpu/plate/CMakeLists.txt
@@ -1,25 +1,25 @@
-CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
-
-########################################################
-## C++ PROJECT                                       ###
-########################################################
-PROJECT(plate)
-
-INCLUDE(${SOURCE_ROOT}/lib/IncludsList.txt) 
-
-#################################################################
-###   LOCAL FILES                                             ###
-#################################################################
-FILE(GLOB SPECIFIC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.h
-                         ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
-                         ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp  )
- 
-SET(ALL_SOURCES ${ALL_SOURCES} ${SPECIFIC_FILES})
-SOURCE_GROUP(src FILES ${SPECIFIC_FILES})
-  
-SET(CAB_ADDITIONAL_LINK_LIBRARIES vfluids)
-
-#################################################################
-###   CREATE PROJECT                                          ###
-#################################################################
-CREATE_CAB_PROJECT(plate BINARY)
+CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
+
+########################################################
+## C++ PROJECT                                       ###
+########################################################
+PROJECT(plate)
+
+INCLUDE(${SOURCE_ROOT}/lib/IncludsList.txt) 
+
+#################################################################
+###   LOCAL FILES                                             ###
+#################################################################
+FILE(GLOB SPECIFIC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.h
+                         ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
+                         ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp  )
+ 
+SET(ALL_SOURCES ${ALL_SOURCES} ${SPECIFIC_FILES})
+SOURCE_GROUP(src FILES ${SPECIFIC_FILES})
+  
+SET(CAB_ADDITIONAL_LINK_LIBRARIES vfluids)
+
+#################################################################
+###   CREATE PROJECT                                          ###
+#################################################################
+CREATE_CAB_PROJECT(plate BINARY)
diff --git a/apps/cpu/plate/plate.cpp b/apps/cpu/plate/plate.cpp
index cb851e89625c1033fd58460070b5c35b5d923692..7322f5fc89e6c2729e5cf07b9e69894594b1c3d3 100644
--- a/apps/cpu/plate/plate.cpp
+++ b/apps/cpu/plate/plate.cpp
@@ -1,652 +1,652 @@
-
-
-#include <iostream>
-#include <string>
-#include <math.h> 
-
-#include <vfluids.h>
-
-using namespace std;
-
-
-void run(const char *cstr, double endTime)
-{
-   try
-   {
-      string pathname; 
-      string pathGeo;
-      string pathLog;
-      string PlatteFilename;
-      string ZckbndFilename;
-      int numOfThreads = 1;
-      bool logfile = false;
-      stringstream logFilename;
-      double availMem = 0;
-
-      //UbLog::reportingLevel() = logDEBUG5;
-
-      CommunicatorPtr comm = MPICommunicator::getInstance();
-      int myid = comm->getProcessID();
-
-      string machine = string(cstr);
-
-      if(machine == "my") 
-      {
-         pathname = "d:/temp/plate";
-         pathGeo = "d:/Data/plate";
-         pathLog = "d:/temp/plate";
-         numOfThreads = 6;
-         logfile = false;
-         availMem = 15.0e9;
-      }
-      else if(machine == "Ludwig")      
-      {
-         pathname = "/work/koskuche/SFB880/plateR1e06";
-         pathGeo = "/home/koskuche/data/plate";
-         pathLog = "/work/koskuche/SFB880/plateR1e06";
-         numOfThreads = 1;
-         availMem = 1.0e9;
-         logfile = true;
-      }
-      else if(machine == "Hermit")      
-      {
-         //Hermit
-         pathname = "/univ_1/ws1/ws/xrmkuchr-plate3-0";
-         pathGeo = "/zhome/academic/HLRS/xrm/xrmkuchr/data/plate";
-         pathLog = "/zhome/academic/HLRS/xrm/xrmkuchr/work/plate";
-         numOfThreads = 16;
-         availMem = 2.0e9;
-         logfile = true;
-      }
-      else if(machine == "HLRN")      
-      {
-         //Hermit
-         pathname = "/gfs1/work/niivfcpu/scratch/plate";
-         pathGeo = "/gfs1/work/niivfcpu/data/plate";
-         pathLog = "/gfs1/work/niivfcpu/scratch/plate";
-         numOfThreads = 24;
-         availMem = 12.0e9;
-         logfile = true;
-      }
-      else throw UbException(UB_EXARGS, "unknown CAB_MACHINE");
-
-#if defined(__unix__)
-      if (myid==0) 
-      {
-         const char* str = pathLog.c_str();
-         int status=mkdir(str, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
-      }
-#endif 
-
-      if(myid == 0 && logfile)
-      {
-         logFilename <<  pathLog + "/logfile"+UbSystem::toString(UbSystem::getTimeStamp())+"_"+UbSystem::toString(myid)+".txt";
-      }
-
-      if(myid ==0 && logfile)
-      {
-         UbLog::output_policy::setStream(logFilename.str());
-      }
-
-      if(myid==0) UBLOG(logINFO,"Testcase plate");
-
-      PlatteFilename = pathGeo + "/platte_raw.stl"; 
-      ZckbndFilename= pathGeo + "/2zackenbaender0.stl";
-
-      int baseLevel, refineLevel,nx[3],blocknx[3];
-      double Re,velocity,rhoInit,vx1Init;
-
-      //////////////////////////////////////////////////////////////////////////
-      //physik
-      //////////////////////////////////////////////////////////////////////////
-      Re            = 1e6; //11900;// 13286;//13286;//gemessen 18.98 m/s...*spaeter koorestur michael moessner 17m/s
-      velocity      = 0.1;  
-      vx1Init       = 0.1;  
-      rhoInit       = 0.0;
-
-      //int H=200;//200;//392;
-      ///////////////Knotenabmessungen:
-      nx[0]      = 50;//240;//120;//60;//86;//43;//65;//50;  //länge
-      nx[1]      = 1;//2;//6;///1;//5;// //breite
-      nx[2]      = 16;//64;//32;//18;//5;//15;//15; //höhe gebiet
-      blocknx[0] = 25;//10;//6;
-      blocknx[1] = 25;//10;//6;
-      blocknx[2] = 25;//10;//6;
-
-      baseLevel   = 0;
-      refineLevel = 4;
-
-      ///////////////Weltabmessungen:
-      double kanalhoeheSI  = 60.0/100.0;//60.0/100.0;//cm, Kanalhöhe
-      double kanalbreiteSI = kanalhoeheSI*((double)nx[1])/((double)nx[2]);//=kanalhöhe*nx1/nx2//1.65/100.0;//13.2/100.0;////40.0/100.0; //cm, Kanalbreite //13.2 zeilbreite
-      double kanallaengeSI = kanalhoeheSI*((double)nx[0])/((double)nx[2]);//80.0/100.0;//cm, Kanallänge, ist nicht angegeben
-
-      // double refinewidth1=kanalhoeheSI/10.0;
-
-
-      double fineNodeDx   = (kanalhoeheSI) / (double)( blocknx[2]*nx[2]*(1<<refineLevel)+1 ); //+1--> gitter liegt jeweils 0.5dx innerhalb
-      //double fineNodeDx   = hReal/100.0;
-      double coarseNodeDx = fineNodeDx * (double)(1<<refineLevel);//geowerte
-
-      double blockLengthx1 = blocknx[0]*coarseNodeDx; //geowerte
-      double blockLengthx2 = blockLengthx1;
-      double blockLengthx3 = blockLengthx1;
-
-      double originX1 = 0.0;//-50.0*propellerDurchmesser;  //geowerte
-      double originX2 = 0.0;//-0.5*blockLengthx2*nx2;
-      double originX3 = 0.0;// minX3 + 0.5*fineNodeDx;
-
-      double geoLength[]   = {  nx[0]*blockLengthx1, nx[1]*blockLengthx2, nx[2]*blockLengthx3}; 
-
-      //position vorderkante cube
-      double originBridgeX1 = 20.0/100.0; //cm, geraten
-      double originBridgeX2 = 0.0;//0.5*params.nx[1]*blockLengthx2-0.5*H-fineNodeDx;
-      double originBridgeX3 = kanalhoeheSI*0.5;//H*0.0-fineNodeDx; //boden
-
-      bool periodicx1 = false;
-      bool periodicx2 = true;
-      bool periodicx3 = true;
-
-      //##########################################################################
-      //## physical parameters
-      //##########################################################################
-      double rhoLB         = rhoInit;
-      double rhoReal       = 1.0;
-      double nuReal  = 0.000015;//0.015;
-
-      double hReal         = 0.0105;//<-m     1.05;//Plattendicke in cm(! cm nicht m !)
-      double uReal         = 15;//m/s   //Re*nueReal/hReal;
-      double lReal         = 1; //m Plattenlänge
-
-      //##Machzahl:
-      //#Ma     = uReal/csReal
-      double Ma      = 0.05;//0.0553;//Ma-Real!
-      double csReal  = 343; //uReal/Ma;
-      double hLB     = hReal/coarseNodeDx;
-
-      //LBMUnitConverterPtr unitConverter = LBMUnitConverterPtr(new LBMUnitConverter(hReal, csReal, rhoReal, hLB));
-      //LBMUnitConverterPtr unitConverter = LBMUnitConverterPtr(new LBMUnitConverter(hReal, LBMUnitConverter::AIR_20C, hLB));
-      
-
-      double uLB           = 0.1; //uReal   * unitConverter->getFactorVelocityWToLb();
-      //double nuLB         = nueReal * unitConverter->getFactorViscosityWToLb();
-      double nuLB         = (uLB*(lReal/coarseNodeDx))/Re;
-      //double timestep      = unitConverter->getFactorTimeLbToW(coarseNodeDx);
-
-      
-      //LBMUnitConverterPtr unitConverter = LBMUnitConverterPtr(new LBMUnitConverter(0, uReal, uLB, nuReal, nuLB));
-      LBMUnitConverterPtr unitConverter = LBMUnitConverterPtr(new LBMUnitConverter());
-      
-      velocity = uLB;
-      double viscosity = nuLB;
-
-      Grid3DPtr grid(new Grid3D(comm));
-
-      //////////////////////////////////////////////////////////////////////////
-      //restart
-      UbSchedulerPtr rSch(new UbScheduler(10000,10000,10000000));
-      RestartPostprocessor rp(grid, rSch, comm, pathname+"/checkpoints", RestartPostprocessor::BINARY);
-      //////////////////////////////////////////////////////////////////////////
-
-      int sizeSP=4;
-      mu::Parser spongeLayer;
-      //spongeLayer.SetExpr("x1>=(sizeX-sizeSP)/dx ? (sizeX-(x1+1))/sizeSP/2.0 + 0.5 : 1.0");
-      spongeLayer.SetExpr("x1>=(sizeX-sizeSP)/dx ? (sizeX-x1)/sizeSP/2.0 + 0.5 : 1.0");
-      spongeLayer.DefineConst("sizeX", nx[0]*blocknx[0]);
-      spongeLayer.DefineConst("sizeSP", sizeSP*blocknx[0]);
-
-      if (grid->getTimeStep() == 0)
-      {
-         if(myid==0) UBLOG(logINFO,"Neustart..");
-         //bounding box
-         double g_minX1 = originX1;
-         double g_minX2 = originX2;
-         double g_minX3 = originX3;
-
-         double g_maxX1 = originX1 + geoLength[0];
-         double g_maxX2 = originX2 + geoLength[1];
-         double g_maxX3 = originX3 + geoLength[2];
-
-         //set grid
-         grid->setDeltaX(coarseNodeDx);
-         grid->setBlockNX(blocknx[0], blocknx[1], blocknx[2]);
-         grid->setPeriodicX1(periodicx1);
-         grid->setPeriodicX2(periodicx2);
-         grid->setPeriodicX3(periodicx3);
-
-
-         GbObject3DPtr gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
-         if(myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), pathname+"/geo/gridCube", WbWriterVtkXmlASCII::getInstance());
-
-         GenBlocksGridVisitor genBlocks(gridCube);
-         grid->accept(genBlocks);
-
-         /////////////////////////////////////////////////
-         //interactoren definieren
-         double geoOverlap = 3.0*coarseNodeDx;
-
-         //inflow
-         GbCuboid3DPtr velBCCuboid(new GbCuboid3D(originX1-geoOverlap, originX2-geoOverlap, originX3-geoOverlap, 
-            originX1/*+coarseNodeDx*/, originX2+geoLength[1]+geoOverlap, originX3+geoLength[2]+geoOverlap));
-         if(myid == 0) GbSystem3D::writeGeoObject(velBCCuboid.get(), pathname+"/geo/velBCCuboid", WbWriterVtkXmlASCII::getInstance());
-         D3Q27InteractorPtr velBCInteractor(new D3Q27Interactor(velBCCuboid,grid,Interactor3D::SOLID)); 
-
-         //inflow
-         double uLB2=uLB*0.96*1.02;//*0.5;
-         double raiseVelSteps = 0;
-         vector<D3Q27BCFunction> velcX1BCs,dummy;
-
-         mu::Parser inflowProfile;
-         inflowProfile.SetExpr("uLB"); 
-
-         inflowProfile.DefineConst("uLB",uLB);
-         velcX1BCs.push_back(D3Q27BCFunction(inflowProfile,raiseVelSteps,D3Q27BCFunction::INFCONST));
-
-         D3Q27BoundaryConditionAdapterPtr velBCAdapter(new D3Q27VelocityBCAdapter (velcX1BCs,dummy,dummy));
-         velBCInteractor->addBCAdapter(velBCAdapter);
-
-         //outflow
-         GbCuboid3DPtr densCuboid(new GbCuboid3D(originX1+geoLength[0], originX2-geoOverlap, originX3-geoOverlap, 
-            originX1+geoLength[0]+geoOverlap, originX2+geoLength[1]+geoOverlap, originX3+geoLength[2]+geoOverlap ));
-         if(myid == 0) GbSystem3D::writeGeoObject(densCuboid.get(), pathname+"/geo/densCuboid", WbWriterVtkXmlASCII::getInstance());
-         D3Q27BoundaryConditionAdapterPtr denBCAdapter(new D3Q27DensityBCAdapter(rhoInit));
-         D3Q27InteractorPtr densInteractor( new D3Q27Interactor(densCuboid,grid,denBCAdapter,Interactor3D::SOLID) );
-
-         //////////////////////////////////////////////////////////////////////////
-         if(myid == 0)
-         {
-            UBLOG(logINFO, "*****************************************");
-            UBLOG(logINFO, "* Parameters                            *");
-            UBLOG(logINFO, "* Re            ="<<Re);
-            UBLOG(logINFO, "* Ma            ="<<Ma);
-            UBLOG(logINFO, "* uReal         ="<<uReal);
-            UBLOG(logINFO, "* nueReal       ="<<nuReal);
-            UBLOG(logINFO, "* nueLB         ="<<nuLB);
-            UBLOG(logINFO, "* uLB           ="<<uLB);
-            UBLOG(logINFO, "* LX3 (world/LB)="<<kanalhoeheSI<<"/"<<kanalhoeheSI/coarseNodeDx);
-            UBLOG(logINFO, "* cdx           ="<<coarseNodeDx);
-            UBLOG(logINFO, "* fdx           ="<<fineNodeDx);
-            UBLOG(logINFO, "* dx_base       ="<<coarseNodeDx<<" == "<<coarseNodeDx);
-            UBLOG(logINFO, "* dx_refine     ="<<fineNodeDx<<" == "<<fineNodeDx );
-            UBLOG(logINFO, "* nx1/2/3       ="<<nx[0]<<"/"<<nx[1]<<"/"<<nx[2]);
-            UBLOG(logINFO, "* blocknx1/2/3  ="<<blocknx[0]<<"/"<<blocknx[1]<<"/"<<blocknx[2]);
-            UBLOG(logINFO, "* x1Periodic    ="<<periodicx1);
-            UBLOG(logINFO, "* x2Periodic    ="<<periodicx2);
-            UBLOG(logINFO, "* x3Periodic    ="<<periodicx3);
-            UBLOG(logINFO, "* number of levels  ="<<refineLevel+1);
-            UBLOG(logINFO, "* path          ="<<pathname);
-
-            UBLOG(logINFO, "*****************************************");
-            UBLOG(logINFO, "* number of threads    ="<<numOfThreads);
-            UBLOG(logINFO, "* number of processes  ="<<comm->getNumberOfProcesses());
-            UBLOG(logINFO, "*****************************************");
-            //UBLOGML(logINFO, "UnitConverter:"<<unitConverter->toString());
-            UBLOG(logINFO, "*****************************************");     
-         }
-         //////////////////////////////////////////////////////////////////////////
-         //Platte
-         GbTriFaceMesh3DPtr mesh (GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(PlatteFilename,"Netz"));
-
-         double x1minMesh = mesh->getX1Minimum(); double x1maxMesh = mesh->getX1Maximum();
-         double x2minMesh = mesh->getX2Minimum(); double x2maxMesh = mesh->getX2Maximum();
-         double x3minMesh = mesh->getX3Minimum(); double x3maxMesh = mesh->getX3Maximum();
-
-         double drehpunktX=x1minMesh+(x1maxMesh-x1minMesh)*0.5;//triFaceMeshS->getX1Centroid();
-         double drehpunktZ=x3minMesh+(x3maxMesh-x3minMesh)*0.5;//triFaceMeshS->getX3Centroid();
-         double drehpunktY=x2minMesh+(x2maxMesh-x2minMesh)*0.5;// seedX2-0.5*nodeDelta;//+nx2*deltaX2+0.5*deltaX2;
-
-         mesh->rotate(90.0,0.0,0.0);  //TriFacMesh-KO-System anders als LB-KO-System
-
-         x1minMesh = mesh->getX1Minimum();  x1maxMesh = mesh->getX1Maximum();
-         x2minMesh = mesh->getX2Minimum();  x2maxMesh = mesh->getX2Maximum();
-         x3minMesh = mesh->getX3Minimum();  x3maxMesh = mesh->getX3Maximum();
-
-         drehpunktX=x1minMesh+(x1maxMesh-x1minMesh)*0.5;//triFaceMeshS->getX1Centroid();
-         drehpunktZ=x3minMesh+(x3maxMesh-x3minMesh)*0.5;//triFaceMeshS->getX3Centroid();
-         drehpunktY=x2minMesh+(x2maxMesh-x2minMesh)*0.5;// seedX2-0.5*nodeDelta;//+nx2*deltaX2+0.5*deltaX2;
-
-         double H3=1.05/100.0;//cm, Plattendicke
-         double scaleB=H3/(x3maxMesh-x3minMesh);
-         double scaleX2=(geoLength[2]+2.0*coarseNodeDx)/(x2minMesh-x2maxMesh);
-
-         mesh->scale(scaleB,scaleB,scaleB);
-         x1minMesh = mesh->getX1Minimum(); x1maxMesh = mesh->getX1Maximum();
-         x2minMesh = mesh->getX2Minimum(); x2maxMesh = mesh->getX2Maximum();
-         x3minMesh = mesh->getX3Minimum(); x3maxMesh = mesh->getX3Maximum();
-         double offsetXBridge=originBridgeX1;//originBridgeX1;
-         double offsetYBridge=originBridgeX2;//originBridgeX2;
-         double offsetZBridge=originBridgeX3;//originBridgeX3;//-0.5*(x3minMesh-x3maxMesh);
-         //mesh->translate(-x1minMesh+offsetXBridge, -x2minMesh-0.5*offsetYBridge-coarseNodeDx, -x3minMesh+offsetZBridge); 
-         mesh->translate(-x1minMesh+offsetXBridge, -x2minMesh+offsetYBridge-coarseNodeDx, -x3minMesh+offsetZBridge-(x3maxMesh-x3minMesh)*0.5/*-hReal*2.0*/); 
-
-         x1minMesh = mesh->getX1Minimum(); x1maxMesh = mesh->getX1Maximum();
-         x2minMesh = mesh->getX2Minimum(); x2maxMesh = mesh->getX2Maximum();
-         x3minMesh = mesh->getX3Minimum(); x3maxMesh = mesh->getX3Maximum();
-
-         if(myid == 0) GbSystem3D::writeGeoObject( mesh.get(), pathname+"/geo/platte", WbWriterVtkXmlBinary::getInstance() );
-
-         //////////////////////////////////////////////////////////////////////////
-         // Zackenband
-         //////////////////////////////////////////////////////////////////////////
-         GbTriFaceMesh3DPtr meshBand (GbTriFaceMesh3DCreator::readMeshFromFile(ZckbndFilename, "NetzBand"));
-         meshBand->deleteRedundantNodes();
-
-         double x1minMeshB = meshBand->getX1Minimum(); double x1maxMeshB = meshBand->getX1Maximum();
-         double x2minMeshB = meshBand->getX2Minimum(); double x2maxMeshB = meshBand->getX2Maximum();
-         double x3minMeshB = meshBand->getX3Minimum(); double x3maxMeshB = meshBand->getX3Maximum();
-
-         x1minMeshB = meshBand->getX1Minimum();  x1maxMeshB = meshBand->getX1Maximum();
-         x2minMeshB = meshBand->getX2Minimum();  x2maxMeshB = meshBand->getX2Maximum();
-         x3minMeshB = meshBand->getX3Minimum();  x3maxMeshB = meshBand->getX3Maximum();
-
-         double H1B=1.05/100.0;//*2.0;//0.05;//cm, Banddicke..nachschauen!!!
-         double scaleBand=H1B/(x1maxMeshB-x1minMeshB);//H3B/(x3maxMeshB-x3minMeshB);
-
-         meshBand->scale(scaleBand,scaleBand,scaleBand);
-         x1minMeshB = meshBand->getX1Minimum(); x1maxMeshB = meshBand->getX1Maximum();
-         x2minMeshB = meshBand->getX2Minimum(); x2maxMeshB = meshBand->getX2Maximum();
-         x3minMeshB = meshBand->getX3Minimum(); x3maxMeshB = meshBand->getX3Maximum();
-         double dBandX=0.5/100.0;//1.29; //15mm-2.1mm Absand von Bandvorderkante
-         double dBandY=0.0/100.0;
-         double dBandZ=0.223/100.0;//0.344;//....
-         double offsetXBridgeB=x1minMesh+dBandX;//originBridgeX1+dBandX;//originBridgeX1;
-         double offsetYBridgeB=originBridgeX2+dBandY;//originBridgeX2;
-         double offsetZBridgeB=originBridgeX3+dBandZ;//originBridgeX3;//-0.5*(x3minMesh-x3maxMesh);
-         meshBand->translate(-x1minMeshB+offsetXBridgeB, -x2minMeshB+offsetYBridgeB-coarseNodeDx, -x3minMeshB+offsetZBridgeB);//-(x3maxMeshB-x3minMeshB)*0.5); 
-
-         x1minMeshB = meshBand->getX1Minimum(); x1maxMeshB = meshBand->getX1Maximum();
-         x2minMeshB = meshBand->getX2Minimum(); x2maxMeshB = meshBand->getX2Maximum();
-         x3minMeshB = meshBand->getX3Minimum(); x3maxMeshB = meshBand->getX3Maximum();
-
-         GbSystem3D::writeGeoObject( meshBand.get(), pathname+"/geo/Band", WbWriterVtkXmlASCII::getInstance() );
-
-         /////////////////Band2
-         GbTriFaceMesh3DPtr meshBand2(GbTriFaceMesh3DCreator::readMeshFromFile(ZckbndFilename, "NetzBand2"));
-         meshBand->deleteRedundantNodes();
-
-         double x1minMeshB2 = meshBand2->getX1Minimum(); double x1maxMeshB2 = meshBand2->getX1Maximum();
-         double x2minMeshB2 = meshBand2->getX2Minimum(); double x2maxMeshB2 = meshBand2->getX2Maximum();
-         double x3minMeshB2 = meshBand2->getX3Minimum(); double x3maxMeshB2 = meshBand2->getX3Maximum();
-
-         x1minMeshB2 = meshBand2->getX1Minimum();  x1maxMeshB2 = meshBand2->getX1Maximum();
-         x2minMeshB2 = meshBand2->getX2Minimum();  x2maxMeshB2 = meshBand2->getX2Maximum();
-         x3minMeshB2 = meshBand2->getX3Minimum();  x3maxMeshB2 = meshBand2->getX3Maximum();
-
-         double H1B2=1.05/100.0;//0.05;//cm, Banddicke..nachschauen!!!
-         double scaleBand2=H1B2/(x1maxMeshB2-x1minMeshB2);//*3.0;//H3B/(x3maxMeshB-x3minMeshB);
-
-         meshBand2->scale(scaleBand2,scaleBand2,scaleBand2);
-         x1minMeshB2 = meshBand2->getX1Minimum(); x1maxMeshB2 = meshBand2->getX1Maximum();
-         x2minMeshB2 = meshBand2->getX2Minimum(); x2maxMeshB2 = meshBand2->getX2Maximum();
-         x3minMeshB2 = meshBand2->getX3Minimum(); x3maxMeshB2 = meshBand2->getX3Maximum();
-         double dBandX2=0.5/100.0;//1.29;
-         double dBandY2=0.5/100.0;
-         double dBandZ2=0.223/100.0;//0.344;//...
-         double offsetXBridgeB2=x1minMesh+dBandX2;//originBridgeX1;
-         double offsetYBridgeB2=originBridgeX2+dBandY2;//originBridgeX2;
-         double offsetZBridgeB2=originBridgeX3+dBandZ2;//originBridgeX3;//-0.5*(x3minMesh-x3maxMesh);
-         meshBand2->translate(-x1minMeshB2+offsetXBridgeB2, -x2minMeshB2+offsetYBridgeB2-coarseNodeDx, -x3minMeshB2+offsetZBridgeB2);//-(x3maxMeshB2-x3minMeshB2)*0.5); 
-
-         x1minMeshB2 = meshBand2->getX1Minimum(); x1maxMeshB2 = meshBand2->getX1Maximum();
-         x2minMeshB2 = meshBand2->getX2Minimum(); x2maxMeshB2 = meshBand2->getX2Maximum();
-         x3minMeshB2 = meshBand2->getX3Minimum(); x3maxMeshB2 = meshBand2->getX3Maximum();
-
-         if(myid == 0) GbSystem3D::writeGeoObject( meshBand2.get(), pathname+"/geo/Band2", WbWriterVtkXmlASCII::getInstance() );
-         //////////////////////////////////////////////////////////////////////////
-
-         //////////////////////////////////////////////////////////////////////////
-         // refine
-         //////////////////////////////////////////////////////////////////////////
-
-         ///////////platte ausmessen:
-         x1minMesh = mesh->getX1Minimum(); x1maxMesh = mesh->getX1Maximum();
-         x2minMesh = mesh->getX2Minimum(); x2maxMesh = mesh->getX2Maximum();
-         x3minMesh = mesh->getX3Minimum(); x3maxMesh = mesh->getX3Maximum();
-         double deltaX3Platte=(x3maxMesh-x3minMesh);
-
-         GbCuboid3DPtr refine2PlatteCube(new GbCuboid3D(  originX1-geoOverlap   , originX2-geoOverlap  , x3minMesh-H3*0.5
-            , x1maxMesh+H3*5.0, originX2+geoOverlap+geoLength[1], x3maxMesh+H3));
-         //if(myid == 0) GbSystem3D::writeGeoObject(refine2PlatteCube.get(), pathname+"/geo/refine2PlatteCube", WbWriterVtkXmlASCII::getInstance());
-         //RefineCrossAndInsideGbObjectBlockVisitor refineAdapterP2(refine2PlatteCube, baseLevel, refineLevel-5);
-         //grid->accept(refineAdapterP2);
-
-         GbCuboid3DPtr refine3PlatteCube(new GbCuboid3D(   x1minMesh+H3*2.0  , originX2-geoOverlap  , x3minMesh+H3*0.8
-            , x1maxMesh-H3*0.2, originX2+geoOverlap+geoLength[1], x3maxMesh+H3*0.1));
-         //RefineCrossAndInsideGbObjectBlockVisitor refineAdapterP3(refine3PlatteCube, baseLevel, refineLevel-4);
-         //grid->accept(refineAdapterP3);
-
-         GbCuboid3DPtr refine4PlatteCube(new GbCuboid3D(   x1minMesh-H3*2.0  , originX2-geoOverlap  , x3minMesh+deltaX3Platte*0.04
-            ,  x1maxMesh+H3*2.0, originX2+geoOverlap+geoLength[1], x3maxMesh+H3*0.25));
-         //if(myid == 0) GbSystem3D::writeGeoObject(refine4PlatteCube.get(), pathname+"/geo/refine4PlatteCube", WbWriterVtkXmlASCII::getInstance());
-         //RefineCrossAndInsideGbObjectBlockVisitor refineAdapterP4(refine4PlatteCube, baseLevel, refineLevel-3);
-         //grid->accept(refineAdapterP4);
-
-         GbCuboid3DPtr refine5PlatteCube(new GbCuboid3D(   originX1-geoOverlap , originX2-geoOverlap  ,x3minMesh-deltaX3Platte/*x3minMesh+deltaX3Platte*0.8*//* x3minMesh+deltaX3Platte*0.8*/
-            ,  x1maxMesh+H3*5.0, originX2+geoOverlap+geoLength[1], x3maxMesh+H3));
-         //if(myid == 0) GbSystem3D::writeGeoObject(refine5PlatteCube.get(), pathname+"/geo/refine5PlatteCube", WbWriterVtkXmlASCII::getInstance());
-         //RefineCrossAndInsideGbObjectBlockVisitor refineAdapterP5(refine5PlatteCube, baseLevel, refineLevel-2);
-         //grid->accept(refineAdapterP5);
-
-         GbCuboid3DPtr refine6PlatteCube(new GbCuboid3D(   originX1-geoOverlap   , originX2-geoOverlap  , x3minMesh-deltaX3Platte*3.0/*x3minMesh+deltaX3Platte*0.9*/
-            ,  x1maxMesh+H3*7.0, originX2+geoOverlap+geoLength[1], x3maxMesh+deltaX3Platte*3.0));
-         //if(myid == 0) GbSystem3D::writeGeoObject(refine6PlatteCube.get(), pathname+"/geo/refine6PlatteCube", WbWriterVtkXmlASCII::getInstance());
-         //RefineCrossAndInsideGbObjectBlockVisitor refineAdapterP6(refine6PlatteCube, baseLevel, refineLevel-1);
-         //grid->accept(refineAdapterP6);
-
-         //GbCuboid3DPtr wallsX1X2minRef4(new GbCuboid3D(  originX1-3.0*geoOverlap   , originX2-3.0*geoOverlap  , originX1-3.0*geoOverlap
-         //  , originX1+geoLength[0]+geoOverlap, originX2+geoOverlap+geoLength[1], kanalhoeheSI*0.1));
-
-
-         GbCuboid3DPtr refinePlatteBox(new GbCuboid3D(mesh->getX1Minimum(), mesh->getX2Minimum(), mesh->getX3Minimum()+(mesh->getX3Maximum()-mesh->getX3Minimum())/2.0, 
-                                                      mesh->getX1Maximum(), mesh->getX2Maximum(), mesh->getX3Maximum()));
-         if(myid == 0) GbSystem3D::writeGeoObject( refinePlatteBox.get(), pathname+"/geo/refinePlatteBox", WbWriterVtkXmlASCII::getInstance() );
-
-         /////////////////////////////////////////////////
-         ///interactoren
-         int bbOption1 = 1; //0=simple Bounce Back, 1=quadr. BB
-         D3Q27BoundaryConditionAdapterPtr bcObst(new D3Q27NoSlipBCAdapter(bbOption1));
-         D3Q27TriFaceMeshInteractorPtr triPlateInteractor( new D3Q27TriFaceMeshInteractor(mesh, grid, bcObst,Interactor3D::SOLID));
-         D3Q27TriFaceMeshInteractorPtr triBandInteractor( new D3Q27TriFaceMeshInteractor( meshBand, grid, bcObst,Interactor3D::SOLID) );
-         D3Q27TriFaceMeshInteractorPtr triBand2Interactor( new D3Q27TriFaceMeshInteractor( meshBand2, grid, bcObst,Interactor3D::SOLID) );
-
-         ////////////////////////////////////////////
-         //METIS
-         Grid3DVisitorPtr metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B));	
-        
-         //////////////////////////////////////////////////////////////////////////
-         //refinement
-         if (refineLevel > 0)
-         {
-            if(myid == 0) UBLOG(logINFO,"Refinement - start");	
-            RefineCrossAndInsideGbObjectHelper refineHelper(grid, refineLevel);
-            //refineHelper.addGbObject( refine6PlatteCube, refineLevel-3);
-            //refineHelper.addGbObject( refine5PlatteCube, refineLevel-2);
-            //refineHelper.addGbObject( refine4PlatteCube, refineLevel-1);
-            //refineHelper.addGbObject( refine3PlatteCube, refineLevel);
-            refineHelper.addGbObject(refinePlatteBox, refineLevel);
-            refineHelper.refine();
-
-            //RefineAroundGbObjectHelper refineHelper(grid, refineLevel, boost::dynamic_pointer_cast<D3Q27TriFaceMeshInteractor>(triPlateInteractor), 0.0, hReal/4.0);
-            //refineHelper.refine();
-            if(myid == 0) UBLOG(logINFO,"Refinement - end");	
-         }
-
-         //BlocksPostprocessorPtr ppblocks1(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname + "/grid/blocks", WbWriterVtkXmlBinary::getInstance(), comm));
-         ////if(myid == 0) 
-         //ppblocks1->update(0);
-
-         //return;
-
-         //GbCuboid3DPtr testBox(new GbCuboid3D(0.2, -1, 0.1, 1.6, 0.04, 0.5));
-         //if(myid == 0) GbSystem3D::writeGeoObject(testBox.get(), pathname+"/geo/testBox", WbWriterVtkXmlASCII::getInstance());
-         //D3Q27InteractorPtr testBoxInt(new D3Q27Interactor(testBox, grid, bcObst,Interactor3D::SOLID));
-
-         ////////////////////////////////////////////
-         /////delete solid blocks
-         if(myid == 0) UBLOG(logINFO,"deleteSolidBlocks - start");
-         InteractorsHelper intHelper(grid, metisVisitor);
-         intHelper.addInteractor(triPlateInteractor);
-         intHelper.addInteractor(triBandInteractor);
-         intHelper.addInteractor(triBand2Interactor);
-         //intHelper.addInteractor(testBoxInt);
-         intHelper.addInteractor(densInteractor);
-         intHelper.addInteractor(velBCInteractor);
-         intHelper.selectBlocks();
-         if(myid == 0) UBLOG(logINFO,"deleteSolidBlocks - end");	 
-         //////////////////////////////////////
-
-         //domain decomposition for threads
-         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
-         grid->accept(pqPartVisitor);
-
-
-         if(myid == 0) UBLOG(logINFO,"Write blocks - start");
-         BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname + "/grid/blocks", WbWriterVtkXmlBinary::getInstance(), comm));
-         if(myid == 0) 
-            ppblocks->update(0);
-         if(myid == 0) UBLOG(logINFO,"Write blocks - end");
-
-         
-
-         unsigned long nob = grid->getNumberOfBlocks();
-         unsigned long nod = nob * blocknx[0]*blocknx[1]*blocknx[2];
-         unsigned long nod_real = nob * (blocknx[0]+3)*(blocknx[1]+3)*(blocknx[2]+3);
-
-         double needMemAll  = double(nod_real*(27*sizeof(double) + sizeof(int)));
-         double needMem  = needMemAll / double(comm->getNumberOfProcesses());
-
-         if(myid == 0)
-         {
-            UBLOG(logINFO,"Number of blocks = " << nob);
-            UBLOG(logINFO,"Number of nodes  = " << nod);
-            UBLOG(logINFO,"Necessary memory  = " << needMemAll  << " bytes");
-            UBLOG(logINFO,"Necessary memory per process = " << needMem  << " bytes");
-            UBLOG(logINFO,"Available memory per process = " << availMem << " bytes");
-            UBLOG(logINFO,"Available memory per node/8.0 = " << (availMem/8.0) << " bytes");
-         }
-         ////////////////////////////
-         LBMKernel3DPtr kernel;
-         //kernel = LBMKernel3DPtr(new LBMKernelETD3Q27CCLB(blocknx[0], blocknx[1], blocknx[2], LBMKernelETD3Q27CCLB::NORMAL));
-
-         //with sponge layer
-         kernel = LBMKernel3DPtr(new LBMKernelETD3Q27CCLBWithSpongeLayer(blocknx[0], blocknx[1], blocknx[2], LBMKernelETD3Q27CCLB::NORMAL));
-         kernel->setWithSpongeLayer(true);
-         kernel->setSpongeLayer(spongeLayer);
-
-         BCProcessorPtr bcProc(new D3Q27ETBCProcessor());
-         kernel->setBCProcessor(bcProc);
-         SetKernelBlockVisitor kernelVisitor(kernel, nuLB, availMem, needMem);
-         grid->accept(kernelVisitor);
-         //////////////////////////////////
-         //undef nodes
-         if (refineLevel > 0)
-         {
-            D3Q27SetUndefinedNodesBlockVisitor undefNodesVisitor;
-            grid->accept(undefNodesVisitor);
-         }
-         //////////////////////////////////////////
-         //set connectors
-         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
-         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
-         grid->accept( setConnsVisitor );
-
-         intHelper.setBC();
-
-         //initialization of decompositions
-         D3Q27ETInitDistributionsBlockVisitor initVisitor( nuLB,rhoInit);
-         initVisitor.setVx1(vx1Init);
-         grid->accept(initVisitor);
-
-         //Postprozess
-         UbSchedulerPtr geoSch(new UbScheduler(1));
-         D3Q27MacroscopicQuantitiesPostprocessorPtr ppgeo(
-            new D3Q27MacroscopicQuantitiesPostprocessor(grid, geoSch, pathname + "/grid/nodes", WbWriterVtkXmlBinary::getInstance(), 
-            unitConverter, true));
-         ppgeo->update(0);
-         //grid->doPostProcess(0);
-         ppgeo.reset();
-         geoSch.reset();
-
-         if(myid == 0) UBLOG(logINFO,"Preprozess - end");      
-         
-         //return;
-      }
-      else
-      {
-         //set connectors
-         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
-         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
-         grid->accept( setConnsVisitor );
-         SetSpongeLayerBlockVisitor ssp(spongeLayer);
-         grid->accept(ssp);
-         if(myid == 0) UBLOG(logINFO,"Restart - end"); 
-      }
-      UbSchedulerPtr visSch(new UbScheduler());
-      //visSch->addSchedule(1,0,3);
-      //visSch->addSchedule(100,100,1000);
-      //visSch->addSchedule(1000,1000,5000);
-      //visSch->addSchedule(5000,5000,100000);
-      //visSch->addSchedule(100000,100000,10000000);
-
-      visSch->addSchedule(10000,10000,10000000);
-      //visSch->addSchedule(100,100,100000000);
-
-      //UbSchedulerPtr resSchRMS(new UbScheduler());
-      //resSchRMS->addSchedule(100000,0,10000000);
-      //UbSchedulerPtr resSchMeans(new UbScheduler());
-      //resSchMeans->addSchedule(100000,0,10000000);
-      //UbSchedulerPtr stepAvSch(new UbScheduler());
-      //int averageInterval=1000;
-      //stepAvSch->addSchedule(averageInterval,0,10000000);
-
-      //AverageValuesPostprocessor Avpp(grid, pathname + "/steps/stepAV", WbWriterVtkXmlBinary::getInstance(), visSch/*wann wird rausgeschrieben*/, stepAvSch/*wann wird gemittelt*/, resSchMeans,resSchRMS/*wann wird resettet*/);
-
-      D3Q27MacroscopicQuantitiesPostprocessor pp(grid, visSch, pathname + "/steps/step", WbWriterVtkXmlBinary::getInstance(), unitConverter);
-
-      UbSchedulerPtr nupsSch(new UbScheduler(10, 10, 30));
-      nupsSch->addSchedule(1000, 1000, 1000000000);
-      NUPSCounterPostprocessor npr(grid, nupsSch, comm);
-
-      //mu::Parser decrViscFunc;
-      //decrViscFunc.SetExpr("nue0+c0/(t+1)/(t+1)");
-      //decrViscFunc.DefineConst("nue0", nueLB);
-      //decrViscFunc.DefineConst("c0", 0.1);
-      //UbSchedulerPtr DecrViscSch(new UbScheduler());
-      //DecrViscSch->addSchedule(10,10,5000);
-      //DecreaseViscosityPostprocessor decrViscPPPtr(grid, DecrViscSch,&decrViscFunc, comm);
-
-      if(myid == 0)
-      {
-         UBLOG(logINFO,"PID = " << myid << " Total Physical Memory (RAM): " << Utilities::getTotalPhysMem());
-         UBLOG(logINFO,"PID = " << myid << " Physical Memory currently used: " << Utilities::getPhysMemUsed());
-         UBLOG(logINFO,"PID = " << myid << " Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe());
-      }
-
-      //double endTime = 80001;
-      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, visSch));
-      if(myid == 0) UBLOG(logINFO,"Simulation-start");
-      calculation->calculate();
-      if(myid == 0) UBLOG(logINFO,"Simulation-end");
-   }
-   catch(std::exception& e)
-   {
-      cerr << e.what() << endl << flush;
-   }
-   catch(std::string& s)
-   {
-      cerr << s << endl;
-   }
-   catch(...)
-   {
-      cerr << "unknown exception" << endl;
-   }
-
-}
-int main(int argc, char* argv[])
-{
-
-   run(argv[1], UbSystem::stringTo<double>(argv[2]));
-
-   return 0;
-}
-
+
+
+#include <iostream>
+#include <string>
+#include <math.h> 
+
+#include <vfluids.h>
+
+using namespace std;
+
+
+void run(const char *cstr, double endTime)
+{
+   try
+   {
+      string pathname; 
+      string pathGeo;
+      string pathLog;
+      string PlatteFilename;
+      string ZckbndFilename;
+      int numOfThreads = 1;
+      bool logfile = false;
+      stringstream logFilename;
+      double availMem = 0;
+
+      //UbLog::reportingLevel() = logDEBUG5;
+
+      CommunicatorPtr comm = MPICommunicator::getInstance();
+      int myid = comm->getProcessID();
+
+      string machine = string(cstr);
+
+      if(machine == "my") 
+      {
+         pathname = "d:/temp/plate";
+         pathGeo = "d:/Data/plate";
+         pathLog = "d:/temp/plate";
+         numOfThreads = 6;
+         logfile = false;
+         availMem = 15.0e9;
+      }
+      else if(machine == "Ludwig")      
+      {
+         pathname = "/work/koskuche/SFB880/plateR1e06";
+         pathGeo = "/home/koskuche/data/plate";
+         pathLog = "/work/koskuche/SFB880/plateR1e06";
+         numOfThreads = 1;
+         availMem = 1.0e9;
+         logfile = true;
+      }
+      else if(machine == "Hermit")      
+      {
+         //Hermit
+         pathname = "/univ_1/ws1/ws/xrmkuchr-plate3-0";
+         pathGeo = "/zhome/academic/HLRS/xrm/xrmkuchr/data/plate";
+         pathLog = "/zhome/academic/HLRS/xrm/xrmkuchr/work/plate";
+         numOfThreads = 16;
+         availMem = 2.0e9;
+         logfile = true;
+      }
+      else if(machine == "HLRN")      
+      {
+         //Hermit
+         pathname = "/gfs1/work/niivfcpu/scratch/plate";
+         pathGeo = "/gfs1/work/niivfcpu/data/plate";
+         pathLog = "/gfs1/work/niivfcpu/scratch/plate";
+         numOfThreads = 24;
+         availMem = 12.0e9;
+         logfile = true;
+      }
+      else throw UbException(UB_EXARGS, "unknown CAB_MACHINE");
+
+#if defined(__unix__)
+      if (myid==0) 
+      {
+         const char* str = pathLog.c_str();
+         int status=mkdir(str, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
+      }
+#endif 
+
+      if(myid == 0 && logfile)
+      {
+         logFilename <<  pathLog + "/logfile"+UbSystem::toString(UbSystem::getTimeStamp())+"_"+UbSystem::toString(myid)+".txt";
+      }
+
+      if(myid ==0 && logfile)
+      {
+         UbLog::output_policy::setStream(logFilename.str());
+      }
+
+      if(myid==0) UBLOG(logINFO,"Testcase plate");
+
+      PlatteFilename = pathGeo + "/platte_raw.stl"; 
+      ZckbndFilename= pathGeo + "/2zackenbaender0.stl";
+
+      int baseLevel, refineLevel,nx[3],blocknx[3];
+      double Re,velocity,rhoInit,vx1Init;
+
+      //////////////////////////////////////////////////////////////////////////
+      //physik
+      //////////////////////////////////////////////////////////////////////////
+      Re            = 1e6; //11900;// 13286;//13286;//gemessen 18.98 m/s...*spaeter koorestur michael moessner 17m/s
+      velocity      = 0.1;  
+      vx1Init       = 0.1;  
+      rhoInit       = 0.0;
+
+      //int H=200;//200;//392;
+      ///////////////Knotenabmessungen:
+      nx[0]      = 50;//240;//120;//60;//86;//43;//65;//50;  //länge
+      nx[1]      = 1;//2;//6;///1;//5;// //breite
+      nx[2]      = 16;//64;//32;//18;//5;//15;//15; //höhe gebiet
+      blocknx[0] = 25;//10;//6;
+      blocknx[1] = 25;//10;//6;
+      blocknx[2] = 25;//10;//6;
+
+      baseLevel   = 0;
+      refineLevel = 4;
+
+      ///////////////Weltabmessungen:
+      double kanalhoeheSI  = 60.0/100.0;//60.0/100.0;//cm, Kanalhöhe
+      double kanalbreiteSI = kanalhoeheSI*((double)nx[1])/((double)nx[2]);//=kanalhöhe*nx1/nx2//1.65/100.0;//13.2/100.0;////40.0/100.0; //cm, Kanalbreite //13.2 zeilbreite
+      double kanallaengeSI = kanalhoeheSI*((double)nx[0])/((double)nx[2]);//80.0/100.0;//cm, Kanallänge, ist nicht angegeben
+
+      // double refinewidth1=kanalhoeheSI/10.0;
+
+
+      double fineNodeDx   = (kanalhoeheSI) / (double)( blocknx[2]*nx[2]*(1<<refineLevel)+1 ); //+1--> gitter liegt jeweils 0.5dx innerhalb
+      //double fineNodeDx   = hReal/100.0;
+      double coarseNodeDx = fineNodeDx * (double)(1<<refineLevel);//geowerte
+
+      double blockLengthx1 = blocknx[0]*coarseNodeDx; //geowerte
+      double blockLengthx2 = blockLengthx1;
+      double blockLengthx3 = blockLengthx1;
+
+      double originX1 = 0.0;//-50.0*propellerDurchmesser;  //geowerte
+      double originX2 = 0.0;//-0.5*blockLengthx2*nx2;
+      double originX3 = 0.0;// minX3 + 0.5*fineNodeDx;
+
+      double geoLength[]   = {  nx[0]*blockLengthx1, nx[1]*blockLengthx2, nx[2]*blockLengthx3}; 
+
+      //position vorderkante cube
+      double originBridgeX1 = 20.0/100.0; //cm, geraten
+      double originBridgeX2 = 0.0;//0.5*params.nx[1]*blockLengthx2-0.5*H-fineNodeDx;
+      double originBridgeX3 = kanalhoeheSI*0.5;//H*0.0-fineNodeDx; //boden
+
+      bool periodicx1 = false;
+      bool periodicx2 = true;
+      bool periodicx3 = true;
+
+      //##########################################################################
+      //## physical parameters
+      //##########################################################################
+      double rhoLB         = rhoInit;
+      double rhoReal       = 1.0;
+      double nuReal  = 0.000015;//0.015;
+
+      double hReal         = 0.0105;//<-m     1.05;//Plattendicke in cm(! cm nicht m !)
+      double uReal         = 15;//m/s   //Re*nueReal/hReal;
+      double lReal         = 1; //m Plattenlänge
+
+      //##Machzahl:
+      //#Ma     = uReal/csReal
+      double Ma      = 0.05;//0.0553;//Ma-Real!
+      double csReal  = 343; //uReal/Ma;
+      double hLB     = hReal/coarseNodeDx;
+
+      //LBMUnitConverterPtr unitConverter = LBMUnitConverterPtr(new LBMUnitConverter(hReal, csReal, rhoReal, hLB));
+      //LBMUnitConverterPtr unitConverter = LBMUnitConverterPtr(new LBMUnitConverter(hReal, LBMUnitConverter::AIR_20C, hLB));
+      
+
+      double uLB           = 0.1; //uReal   * unitConverter->getFactorVelocityWToLb();
+      //double nuLB         = nueReal * unitConverter->getFactorViscosityWToLb();
+      double nuLB         = (uLB*(lReal/coarseNodeDx))/Re;
+      //double timestep      = unitConverter->getFactorTimeLbToW(coarseNodeDx);
+
+      
+      //LBMUnitConverterPtr unitConverter = LBMUnitConverterPtr(new LBMUnitConverter(0, uReal, uLB, nuReal, nuLB));
+      LBMUnitConverterPtr unitConverter = LBMUnitConverterPtr(new LBMUnitConverter());
+      
+      velocity = uLB;
+      double viscosity = nuLB;
+
+      Grid3DPtr grid(new Grid3D(comm));
+
+      //////////////////////////////////////////////////////////////////////////
+      //restart
+      UbSchedulerPtr rSch(new UbScheduler(10000,10000,10000000));
+      RestartPostprocessor rp(grid, rSch, comm, pathname+"/checkpoints", RestartPostprocessor::BINARY);
+      //////////////////////////////////////////////////////////////////////////
+
+      int sizeSP=4;
+      mu::Parser spongeLayer;
+      //spongeLayer.SetExpr("x1>=(sizeX-sizeSP)/dx ? (sizeX-(x1+1))/sizeSP/2.0 + 0.5 : 1.0");
+      spongeLayer.SetExpr("x1>=(sizeX-sizeSP)/dx ? (sizeX-x1)/sizeSP/2.0 + 0.5 : 1.0");
+      spongeLayer.DefineConst("sizeX", nx[0]*blocknx[0]);
+      spongeLayer.DefineConst("sizeSP", sizeSP*blocknx[0]);
+
+      if (grid->getTimeStep() == 0)
+      {
+         if(myid==0) UBLOG(logINFO,"Neustart..");
+         //bounding box
+         double g_minX1 = originX1;
+         double g_minX2 = originX2;
+         double g_minX3 = originX3;
+
+         double g_maxX1 = originX1 + geoLength[0];
+         double g_maxX2 = originX2 + geoLength[1];
+         double g_maxX3 = originX3 + geoLength[2];
+
+         //set grid
+         grid->setDeltaX(coarseNodeDx);
+         grid->setBlockNX(blocknx[0], blocknx[1], blocknx[2]);
+         grid->setPeriodicX1(periodicx1);
+         grid->setPeriodicX2(periodicx2);
+         grid->setPeriodicX3(periodicx3);
+
+
+         GbObject3DPtr gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
+         if(myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), pathname+"/geo/gridCube", WbWriterVtkXmlASCII::getInstance());
+
+         GenBlocksGridVisitor genBlocks(gridCube);
+         grid->accept(genBlocks);
+
+         /////////////////////////////////////////////////
+         //interactoren definieren
+         double geoOverlap = 3.0*coarseNodeDx;
+
+         //inflow
+         GbCuboid3DPtr velBCCuboid(new GbCuboid3D(originX1-geoOverlap, originX2-geoOverlap, originX3-geoOverlap, 
+            originX1/*+coarseNodeDx*/, originX2+geoLength[1]+geoOverlap, originX3+geoLength[2]+geoOverlap));
+         if(myid == 0) GbSystem3D::writeGeoObject(velBCCuboid.get(), pathname+"/geo/velBCCuboid", WbWriterVtkXmlASCII::getInstance());
+         D3Q27InteractorPtr velBCInteractor(new D3Q27Interactor(velBCCuboid,grid,Interactor3D::SOLID)); 
+
+         //inflow
+         double uLB2=uLB*0.96*1.02;//*0.5;
+         double raiseVelSteps = 0;
+         vector<D3Q27BCFunction> velcX1BCs,dummy;
+
+         mu::Parser inflowProfile;
+         inflowProfile.SetExpr("uLB"); 
+
+         inflowProfile.DefineConst("uLB",uLB);
+         velcX1BCs.push_back(D3Q27BCFunction(inflowProfile,raiseVelSteps,D3Q27BCFunction::INFCONST));
+
+         D3Q27BoundaryConditionAdapterPtr velBCAdapter(new D3Q27VelocityBCAdapter (velcX1BCs,dummy,dummy));
+         velBCInteractor->addBCAdapter(velBCAdapter);
+
+         //outflow
+         GbCuboid3DPtr densCuboid(new GbCuboid3D(originX1+geoLength[0], originX2-geoOverlap, originX3-geoOverlap, 
+            originX1+geoLength[0]+geoOverlap, originX2+geoLength[1]+geoOverlap, originX3+geoLength[2]+geoOverlap ));
+         if(myid == 0) GbSystem3D::writeGeoObject(densCuboid.get(), pathname+"/geo/densCuboid", WbWriterVtkXmlASCII::getInstance());
+         D3Q27BoundaryConditionAdapterPtr denBCAdapter(new D3Q27DensityBCAdapter(rhoInit));
+         D3Q27InteractorPtr densInteractor( new D3Q27Interactor(densCuboid,grid,denBCAdapter,Interactor3D::SOLID) );
+
+         //////////////////////////////////////////////////////////////////////////
+         if(myid == 0)
+         {
+            UBLOG(logINFO, "*****************************************");
+            UBLOG(logINFO, "* Parameters                            *");
+            UBLOG(logINFO, "* Re            ="<<Re);
+            UBLOG(logINFO, "* Ma            ="<<Ma);
+            UBLOG(logINFO, "* uReal         ="<<uReal);
+            UBLOG(logINFO, "* nueReal       ="<<nuReal);
+            UBLOG(logINFO, "* nueLB         ="<<nuLB);
+            UBLOG(logINFO, "* uLB           ="<<uLB);
+            UBLOG(logINFO, "* LX3 (world/LB)="<<kanalhoeheSI<<"/"<<kanalhoeheSI/coarseNodeDx);
+            UBLOG(logINFO, "* cdx           ="<<coarseNodeDx);
+            UBLOG(logINFO, "* fdx           ="<<fineNodeDx);
+            UBLOG(logINFO, "* dx_base       ="<<coarseNodeDx<<" == "<<coarseNodeDx);
+            UBLOG(logINFO, "* dx_refine     ="<<fineNodeDx<<" == "<<fineNodeDx );
+            UBLOG(logINFO, "* nx1/2/3       ="<<nx[0]<<"/"<<nx[1]<<"/"<<nx[2]);
+            UBLOG(logINFO, "* blocknx1/2/3  ="<<blocknx[0]<<"/"<<blocknx[1]<<"/"<<blocknx[2]);
+            UBLOG(logINFO, "* x1Periodic    ="<<periodicx1);
+            UBLOG(logINFO, "* x2Periodic    ="<<periodicx2);
+            UBLOG(logINFO, "* x3Periodic    ="<<periodicx3);
+            UBLOG(logINFO, "* number of levels  ="<<refineLevel+1);
+            UBLOG(logINFO, "* path          ="<<pathname);
+
+            UBLOG(logINFO, "*****************************************");
+            UBLOG(logINFO, "* number of threads    ="<<numOfThreads);
+            UBLOG(logINFO, "* number of processes  ="<<comm->getNumberOfProcesses());
+            UBLOG(logINFO, "*****************************************");
+            //UBLOGML(logINFO, "UnitConverter:"<<unitConverter->toString());
+            UBLOG(logINFO, "*****************************************");     
+         }
+         //////////////////////////////////////////////////////////////////////////
+         //Platte
+         GbTriFaceMesh3DPtr mesh (GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(PlatteFilename,"Netz"));
+
+         double x1minMesh = mesh->getX1Minimum(); double x1maxMesh = mesh->getX1Maximum();
+         double x2minMesh = mesh->getX2Minimum(); double x2maxMesh = mesh->getX2Maximum();
+         double x3minMesh = mesh->getX3Minimum(); double x3maxMesh = mesh->getX3Maximum();
+
+         double drehpunktX=x1minMesh+(x1maxMesh-x1minMesh)*0.5;//triFaceMeshS->getX1Centroid();
+         double drehpunktZ=x3minMesh+(x3maxMesh-x3minMesh)*0.5;//triFaceMeshS->getX3Centroid();
+         double drehpunktY=x2minMesh+(x2maxMesh-x2minMesh)*0.5;// seedX2-0.5*nodeDelta;//+nx2*deltaX2+0.5*deltaX2;
+
+         mesh->rotate(90.0,0.0,0.0);  //TriFacMesh-KO-System anders als LB-KO-System
+
+         x1minMesh = mesh->getX1Minimum();  x1maxMesh = mesh->getX1Maximum();
+         x2minMesh = mesh->getX2Minimum();  x2maxMesh = mesh->getX2Maximum();
+         x3minMesh = mesh->getX3Minimum();  x3maxMesh = mesh->getX3Maximum();
+
+         drehpunktX=x1minMesh+(x1maxMesh-x1minMesh)*0.5;//triFaceMeshS->getX1Centroid();
+         drehpunktZ=x3minMesh+(x3maxMesh-x3minMesh)*0.5;//triFaceMeshS->getX3Centroid();
+         drehpunktY=x2minMesh+(x2maxMesh-x2minMesh)*0.5;// seedX2-0.5*nodeDelta;//+nx2*deltaX2+0.5*deltaX2;
+
+         double H3=1.05/100.0;//cm, Plattendicke
+         double scaleB=H3/(x3maxMesh-x3minMesh);
+         double scaleX2=(geoLength[2]+2.0*coarseNodeDx)/(x2minMesh-x2maxMesh);
+
+         mesh->scale(scaleB,scaleB,scaleB);
+         x1minMesh = mesh->getX1Minimum(); x1maxMesh = mesh->getX1Maximum();
+         x2minMesh = mesh->getX2Minimum(); x2maxMesh = mesh->getX2Maximum();
+         x3minMesh = mesh->getX3Minimum(); x3maxMesh = mesh->getX3Maximum();
+         double offsetXBridge=originBridgeX1;//originBridgeX1;
+         double offsetYBridge=originBridgeX2;//originBridgeX2;
+         double offsetZBridge=originBridgeX3;//originBridgeX3;//-0.5*(x3minMesh-x3maxMesh);
+         //mesh->translate(-x1minMesh+offsetXBridge, -x2minMesh-0.5*offsetYBridge-coarseNodeDx, -x3minMesh+offsetZBridge); 
+         mesh->translate(-x1minMesh+offsetXBridge, -x2minMesh+offsetYBridge-coarseNodeDx, -x3minMesh+offsetZBridge-(x3maxMesh-x3minMesh)*0.5/*-hReal*2.0*/); 
+
+         x1minMesh = mesh->getX1Minimum(); x1maxMesh = mesh->getX1Maximum();
+         x2minMesh = mesh->getX2Minimum(); x2maxMesh = mesh->getX2Maximum();
+         x3minMesh = mesh->getX3Minimum(); x3maxMesh = mesh->getX3Maximum();
+
+         if(myid == 0) GbSystem3D::writeGeoObject( mesh.get(), pathname+"/geo/platte", WbWriterVtkXmlBinary::getInstance() );
+
+         //////////////////////////////////////////////////////////////////////////
+         // Zackenband
+         //////////////////////////////////////////////////////////////////////////
+         GbTriFaceMesh3DPtr meshBand (GbTriFaceMesh3DCreator::readMeshFromFile(ZckbndFilename, "NetzBand"));
+         meshBand->deleteRedundantNodes();
+
+         double x1minMeshB = meshBand->getX1Minimum(); double x1maxMeshB = meshBand->getX1Maximum();
+         double x2minMeshB = meshBand->getX2Minimum(); double x2maxMeshB = meshBand->getX2Maximum();
+         double x3minMeshB = meshBand->getX3Minimum(); double x3maxMeshB = meshBand->getX3Maximum();
+
+         x1minMeshB = meshBand->getX1Minimum();  x1maxMeshB = meshBand->getX1Maximum();
+         x2minMeshB = meshBand->getX2Minimum();  x2maxMeshB = meshBand->getX2Maximum();
+         x3minMeshB = meshBand->getX3Minimum();  x3maxMeshB = meshBand->getX3Maximum();
+
+         double H1B=1.05/100.0;//*2.0;//0.05;//cm, Banddicke..nachschauen!!!
+         double scaleBand=H1B/(x1maxMeshB-x1minMeshB);//H3B/(x3maxMeshB-x3minMeshB);
+
+         meshBand->scale(scaleBand,scaleBand,scaleBand);
+         x1minMeshB = meshBand->getX1Minimum(); x1maxMeshB = meshBand->getX1Maximum();
+         x2minMeshB = meshBand->getX2Minimum(); x2maxMeshB = meshBand->getX2Maximum();
+         x3minMeshB = meshBand->getX3Minimum(); x3maxMeshB = meshBand->getX3Maximum();
+         double dBandX=0.5/100.0;//1.29; //15mm-2.1mm Absand von Bandvorderkante
+         double dBandY=0.0/100.0;
+         double dBandZ=0.223/100.0;//0.344;//....
+         double offsetXBridgeB=x1minMesh+dBandX;//originBridgeX1+dBandX;//originBridgeX1;
+         double offsetYBridgeB=originBridgeX2+dBandY;//originBridgeX2;
+         double offsetZBridgeB=originBridgeX3+dBandZ;//originBridgeX3;//-0.5*(x3minMesh-x3maxMesh);
+         meshBand->translate(-x1minMeshB+offsetXBridgeB, -x2minMeshB+offsetYBridgeB-coarseNodeDx, -x3minMeshB+offsetZBridgeB);//-(x3maxMeshB-x3minMeshB)*0.5); 
+
+         x1minMeshB = meshBand->getX1Minimum(); x1maxMeshB = meshBand->getX1Maximum();
+         x2minMeshB = meshBand->getX2Minimum(); x2maxMeshB = meshBand->getX2Maximum();
+         x3minMeshB = meshBand->getX3Minimum(); x3maxMeshB = meshBand->getX3Maximum();
+
+         GbSystem3D::writeGeoObject( meshBand.get(), pathname+"/geo/Band", WbWriterVtkXmlASCII::getInstance() );
+
+         /////////////////Band2
+         GbTriFaceMesh3DPtr meshBand2(GbTriFaceMesh3DCreator::readMeshFromFile(ZckbndFilename, "NetzBand2"));
+         meshBand->deleteRedundantNodes();
+
+         double x1minMeshB2 = meshBand2->getX1Minimum(); double x1maxMeshB2 = meshBand2->getX1Maximum();
+         double x2minMeshB2 = meshBand2->getX2Minimum(); double x2maxMeshB2 = meshBand2->getX2Maximum();
+         double x3minMeshB2 = meshBand2->getX3Minimum(); double x3maxMeshB2 = meshBand2->getX3Maximum();
+
+         x1minMeshB2 = meshBand2->getX1Minimum();  x1maxMeshB2 = meshBand2->getX1Maximum();
+         x2minMeshB2 = meshBand2->getX2Minimum();  x2maxMeshB2 = meshBand2->getX2Maximum();
+         x3minMeshB2 = meshBand2->getX3Minimum();  x3maxMeshB2 = meshBand2->getX3Maximum();
+
+         double H1B2=1.05/100.0;//0.05;//cm, Banddicke..nachschauen!!!
+         double scaleBand2=H1B2/(x1maxMeshB2-x1minMeshB2);//*3.0;//H3B/(x3maxMeshB-x3minMeshB);
+
+         meshBand2->scale(scaleBand2,scaleBand2,scaleBand2);
+         x1minMeshB2 = meshBand2->getX1Minimum(); x1maxMeshB2 = meshBand2->getX1Maximum();
+         x2minMeshB2 = meshBand2->getX2Minimum(); x2maxMeshB2 = meshBand2->getX2Maximum();
+         x3minMeshB2 = meshBand2->getX3Minimum(); x3maxMeshB2 = meshBand2->getX3Maximum();
+         double dBandX2=0.5/100.0;//1.29;
+         double dBandY2=0.5/100.0;
+         double dBandZ2=0.223/100.0;//0.344;//...
+         double offsetXBridgeB2=x1minMesh+dBandX2;//originBridgeX1;
+         double offsetYBridgeB2=originBridgeX2+dBandY2;//originBridgeX2;
+         double offsetZBridgeB2=originBridgeX3+dBandZ2;//originBridgeX3;//-0.5*(x3minMesh-x3maxMesh);
+         meshBand2->translate(-x1minMeshB2+offsetXBridgeB2, -x2minMeshB2+offsetYBridgeB2-coarseNodeDx, -x3minMeshB2+offsetZBridgeB2);//-(x3maxMeshB2-x3minMeshB2)*0.5); 
+
+         x1minMeshB2 = meshBand2->getX1Minimum(); x1maxMeshB2 = meshBand2->getX1Maximum();
+         x2minMeshB2 = meshBand2->getX2Minimum(); x2maxMeshB2 = meshBand2->getX2Maximum();
+         x3minMeshB2 = meshBand2->getX3Minimum(); x3maxMeshB2 = meshBand2->getX3Maximum();
+
+         if(myid == 0) GbSystem3D::writeGeoObject( meshBand2.get(), pathname+"/geo/Band2", WbWriterVtkXmlASCII::getInstance() );
+         //////////////////////////////////////////////////////////////////////////
+
+         //////////////////////////////////////////////////////////////////////////
+         // refine
+         //////////////////////////////////////////////////////////////////////////
+
+         ///////////platte ausmessen:
+         x1minMesh = mesh->getX1Minimum(); x1maxMesh = mesh->getX1Maximum();
+         x2minMesh = mesh->getX2Minimum(); x2maxMesh = mesh->getX2Maximum();
+         x3minMesh = mesh->getX3Minimum(); x3maxMesh = mesh->getX3Maximum();
+         double deltaX3Platte=(x3maxMesh-x3minMesh);
+
+         GbCuboid3DPtr refine2PlatteCube(new GbCuboid3D(  originX1-geoOverlap   , originX2-geoOverlap  , x3minMesh-H3*0.5
+            , x1maxMesh+H3*5.0, originX2+geoOverlap+geoLength[1], x3maxMesh+H3));
+         //if(myid == 0) GbSystem3D::writeGeoObject(refine2PlatteCube.get(), pathname+"/geo/refine2PlatteCube", WbWriterVtkXmlASCII::getInstance());
+         //RefineCrossAndInsideGbObjectBlockVisitor refineAdapterP2(refine2PlatteCube, baseLevel, refineLevel-5);
+         //grid->accept(refineAdapterP2);
+
+         GbCuboid3DPtr refine3PlatteCube(new GbCuboid3D(   x1minMesh+H3*2.0  , originX2-geoOverlap  , x3minMesh+H3*0.8
+            , x1maxMesh-H3*0.2, originX2+geoOverlap+geoLength[1], x3maxMesh+H3*0.1));
+         //RefineCrossAndInsideGbObjectBlockVisitor refineAdapterP3(refine3PlatteCube, baseLevel, refineLevel-4);
+         //grid->accept(refineAdapterP3);
+
+         GbCuboid3DPtr refine4PlatteCube(new GbCuboid3D(   x1minMesh-H3*2.0  , originX2-geoOverlap  , x3minMesh+deltaX3Platte*0.04
+            ,  x1maxMesh+H3*2.0, originX2+geoOverlap+geoLength[1], x3maxMesh+H3*0.25));
+         //if(myid == 0) GbSystem3D::writeGeoObject(refine4PlatteCube.get(), pathname+"/geo/refine4PlatteCube", WbWriterVtkXmlASCII::getInstance());
+         //RefineCrossAndInsideGbObjectBlockVisitor refineAdapterP4(refine4PlatteCube, baseLevel, refineLevel-3);
+         //grid->accept(refineAdapterP4);
+
+         GbCuboid3DPtr refine5PlatteCube(new GbCuboid3D(   originX1-geoOverlap , originX2-geoOverlap  ,x3minMesh-deltaX3Platte/*x3minMesh+deltaX3Platte*0.8*//* x3minMesh+deltaX3Platte*0.8*/
+            ,  x1maxMesh+H3*5.0, originX2+geoOverlap+geoLength[1], x3maxMesh+H3));
+         //if(myid == 0) GbSystem3D::writeGeoObject(refine5PlatteCube.get(), pathname+"/geo/refine5PlatteCube", WbWriterVtkXmlASCII::getInstance());
+         //RefineCrossAndInsideGbObjectBlockVisitor refineAdapterP5(refine5PlatteCube, baseLevel, refineLevel-2);
+         //grid->accept(refineAdapterP5);
+
+         GbCuboid3DPtr refine6PlatteCube(new GbCuboid3D(   originX1-geoOverlap   , originX2-geoOverlap  , x3minMesh-deltaX3Platte*3.0/*x3minMesh+deltaX3Platte*0.9*/
+            ,  x1maxMesh+H3*7.0, originX2+geoOverlap+geoLength[1], x3maxMesh+deltaX3Platte*3.0));
+         //if(myid == 0) GbSystem3D::writeGeoObject(refine6PlatteCube.get(), pathname+"/geo/refine6PlatteCube", WbWriterVtkXmlASCII::getInstance());
+         //RefineCrossAndInsideGbObjectBlockVisitor refineAdapterP6(refine6PlatteCube, baseLevel, refineLevel-1);
+         //grid->accept(refineAdapterP6);
+
+         //GbCuboid3DPtr wallsX1X2minRef4(new GbCuboid3D(  originX1-3.0*geoOverlap   , originX2-3.0*geoOverlap  , originX1-3.0*geoOverlap
+         //  , originX1+geoLength[0]+geoOverlap, originX2+geoOverlap+geoLength[1], kanalhoeheSI*0.1));
+
+
+         GbCuboid3DPtr refinePlatteBox(new GbCuboid3D(mesh->getX1Minimum(), mesh->getX2Minimum(), mesh->getX3Minimum()+(mesh->getX3Maximum()-mesh->getX3Minimum())/2.0, 
+                                                      mesh->getX1Maximum(), mesh->getX2Maximum(), mesh->getX3Maximum()));
+         if(myid == 0) GbSystem3D::writeGeoObject( refinePlatteBox.get(), pathname+"/geo/refinePlatteBox", WbWriterVtkXmlASCII::getInstance() );
+
+         /////////////////////////////////////////////////
+         ///interactoren
+         int bbOption1 = 1; //0=simple Bounce Back, 1=quadr. BB
+         D3Q27BoundaryConditionAdapterPtr bcObst(new D3Q27NoSlipBCAdapter(bbOption1));
+         D3Q27TriFaceMeshInteractorPtr triPlateInteractor( new D3Q27TriFaceMeshInteractor(mesh, grid, bcObst,Interactor3D::SOLID));
+         D3Q27TriFaceMeshInteractorPtr triBandInteractor( new D3Q27TriFaceMeshInteractor( meshBand, grid, bcObst,Interactor3D::SOLID) );
+         D3Q27TriFaceMeshInteractorPtr triBand2Interactor( new D3Q27TriFaceMeshInteractor( meshBand2, grid, bcObst,Interactor3D::SOLID) );
+
+         ////////////////////////////////////////////
+         //METIS
+         Grid3DVisitorPtr metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B));	
+        
+         //////////////////////////////////////////////////////////////////////////
+         //refinement
+         if (refineLevel > 0)
+         {
+            if(myid == 0) UBLOG(logINFO,"Refinement - start");	
+            RefineCrossAndInsideGbObjectHelper refineHelper(grid, refineLevel);
+            //refineHelper.addGbObject( refine6PlatteCube, refineLevel-3);
+            //refineHelper.addGbObject( refine5PlatteCube, refineLevel-2);
+            //refineHelper.addGbObject( refine4PlatteCube, refineLevel-1);
+            //refineHelper.addGbObject( refine3PlatteCube, refineLevel);
+            refineHelper.addGbObject(refinePlatteBox, refineLevel);
+            refineHelper.refine();
+
+            //RefineAroundGbObjectHelper refineHelper(grid, refineLevel, boost::dynamic_pointer_cast<D3Q27TriFaceMeshInteractor>(triPlateInteractor), 0.0, hReal/4.0);
+            //refineHelper.refine();
+            if(myid == 0) UBLOG(logINFO,"Refinement - end");	
+         }
+
+         //BlocksPostprocessorPtr ppblocks1(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname + "/grid/blocks", WbWriterVtkXmlBinary::getInstance(), comm));
+         ////if(myid == 0) 
+         //ppblocks1->update(0);
+
+         //return;
+
+         //GbCuboid3DPtr testBox(new GbCuboid3D(0.2, -1, 0.1, 1.6, 0.04, 0.5));
+         //if(myid == 0) GbSystem3D::writeGeoObject(testBox.get(), pathname+"/geo/testBox", WbWriterVtkXmlASCII::getInstance());
+         //D3Q27InteractorPtr testBoxInt(new D3Q27Interactor(testBox, grid, bcObst,Interactor3D::SOLID));
+
+         ////////////////////////////////////////////
+         /////delete solid blocks
+         if(myid == 0) UBLOG(logINFO,"deleteSolidBlocks - start");
+         InteractorsHelper intHelper(grid, metisVisitor);
+         intHelper.addInteractor(triPlateInteractor);
+         intHelper.addInteractor(triBandInteractor);
+         intHelper.addInteractor(triBand2Interactor);
+         //intHelper.addInteractor(testBoxInt);
+         intHelper.addInteractor(densInteractor);
+         intHelper.addInteractor(velBCInteractor);
+         intHelper.selectBlocks();
+         if(myid == 0) UBLOG(logINFO,"deleteSolidBlocks - end");	 
+         //////////////////////////////////////
+
+         //domain decomposition for threads
+         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
+         grid->accept(pqPartVisitor);
+
+
+         if(myid == 0) UBLOG(logINFO,"Write blocks - start");
+         BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname + "/grid/blocks", WbWriterVtkXmlBinary::getInstance(), comm));
+         if(myid == 0) 
+            ppblocks->update(0);
+         if(myid == 0) UBLOG(logINFO,"Write blocks - end");
+
+         
+
+         unsigned long nob = grid->getNumberOfBlocks();
+         unsigned long nod = nob * blocknx[0]*blocknx[1]*blocknx[2];
+         unsigned long nod_real = nob * (blocknx[0]+3)*(blocknx[1]+3)*(blocknx[2]+3);
+
+         double needMemAll  = double(nod_real*(27*sizeof(double) + sizeof(int)));
+         double needMem  = needMemAll / double(comm->getNumberOfProcesses());
+
+         if(myid == 0)
+         {
+            UBLOG(logINFO,"Number of blocks = " << nob);
+            UBLOG(logINFO,"Number of nodes  = " << nod);
+            UBLOG(logINFO,"Necessary memory  = " << needMemAll  << " bytes");
+            UBLOG(logINFO,"Necessary memory per process = " << needMem  << " bytes");
+            UBLOG(logINFO,"Available memory per process = " << availMem << " bytes");
+            UBLOG(logINFO,"Available memory per node/8.0 = " << (availMem/8.0) << " bytes");
+         }
+         ////////////////////////////
+         LBMKernel3DPtr kernel;
+         //kernel = LBMKernel3DPtr(new LBMKernelETD3Q27CCLB(blocknx[0], blocknx[1], blocknx[2], LBMKernelETD3Q27CCLB::NORMAL));
+
+         //with sponge layer
+         kernel = LBMKernel3DPtr(new LBMKernelETD3Q27CCLBWithSpongeLayer(blocknx[0], blocknx[1], blocknx[2], LBMKernelETD3Q27CCLB::NORMAL));
+         kernel->setWithSpongeLayer(true);
+         kernel->setSpongeLayer(spongeLayer);
+
+         BCProcessorPtr bcProc(new D3Q27ETBCProcessor());
+         kernel->setBCProcessor(bcProc);
+         SetKernelBlockVisitor kernelVisitor(kernel, nuLB, availMem, needMem);
+         grid->accept(kernelVisitor);
+         //////////////////////////////////
+         //undef nodes
+         if (refineLevel > 0)
+         {
+            D3Q27SetUndefinedNodesBlockVisitor undefNodesVisitor;
+            grid->accept(undefNodesVisitor);
+         }
+         //////////////////////////////////////////
+         //set connectors
+         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
+         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
+         grid->accept( setConnsVisitor );
+
+         intHelper.setBC();
+
+         //initialization of decompositions
+         D3Q27ETInitDistributionsBlockVisitor initVisitor( nuLB,rhoInit);
+         initVisitor.setVx1(vx1Init);
+         grid->accept(initVisitor);
+
+         //Postprozess
+         UbSchedulerPtr geoSch(new UbScheduler(1));
+         D3Q27MacroscopicQuantitiesPostprocessorPtr ppgeo(
+            new D3Q27MacroscopicQuantitiesPostprocessor(grid, geoSch, pathname + "/grid/nodes", WbWriterVtkXmlBinary::getInstance(), 
+            unitConverter, true));
+         ppgeo->update(0);
+         //grid->doPostProcess(0);
+         ppgeo.reset();
+         geoSch.reset();
+
+         if(myid == 0) UBLOG(logINFO,"Preprozess - end");      
+         
+         //return;
+      }
+      else
+      {
+         //set connectors
+         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
+         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
+         grid->accept( setConnsVisitor );
+         SetSpongeLayerBlockVisitor ssp(spongeLayer);
+         grid->accept(ssp);
+         if(myid == 0) UBLOG(logINFO,"Restart - end"); 
+      }
+      UbSchedulerPtr visSch(new UbScheduler());
+      //visSch->addSchedule(1,0,3);
+      //visSch->addSchedule(100,100,1000);
+      //visSch->addSchedule(1000,1000,5000);
+      //visSch->addSchedule(5000,5000,100000);
+      //visSch->addSchedule(100000,100000,10000000);
+
+      visSch->addSchedule(10000,10000,10000000);
+      //visSch->addSchedule(100,100,100000000);
+
+      //UbSchedulerPtr resSchRMS(new UbScheduler());
+      //resSchRMS->addSchedule(100000,0,10000000);
+      //UbSchedulerPtr resSchMeans(new UbScheduler());
+      //resSchMeans->addSchedule(100000,0,10000000);
+      //UbSchedulerPtr stepAvSch(new UbScheduler());
+      //int averageInterval=1000;
+      //stepAvSch->addSchedule(averageInterval,0,10000000);
+
+      //AverageValuesPostprocessor Avpp(grid, pathname + "/steps/stepAV", WbWriterVtkXmlBinary::getInstance(), visSch/*wann wird rausgeschrieben*/, stepAvSch/*wann wird gemittelt*/, resSchMeans,resSchRMS/*wann wird resettet*/);
+
+      D3Q27MacroscopicQuantitiesPostprocessor pp(grid, visSch, pathname + "/steps/step", WbWriterVtkXmlBinary::getInstance(), unitConverter);
+
+      UbSchedulerPtr nupsSch(new UbScheduler(10, 10, 30));
+      nupsSch->addSchedule(1000, 1000, 1000000000);
+      NUPSCounterPostprocessor npr(grid, nupsSch, comm);
+
+      //mu::Parser decrViscFunc;
+      //decrViscFunc.SetExpr("nue0+c0/(t+1)/(t+1)");
+      //decrViscFunc.DefineConst("nue0", nueLB);
+      //decrViscFunc.DefineConst("c0", 0.1);
+      //UbSchedulerPtr DecrViscSch(new UbScheduler());
+      //DecrViscSch->addSchedule(10,10,5000);
+      //DecreaseViscosityPostprocessor decrViscPPPtr(grid, DecrViscSch,&decrViscFunc, comm);
+
+      if(myid == 0)
+      {
+         UBLOG(logINFO,"PID = " << myid << " Total Physical Memory (RAM): " << Utilities::getTotalPhysMem());
+         UBLOG(logINFO,"PID = " << myid << " Physical Memory currently used: " << Utilities::getPhysMemUsed());
+         UBLOG(logINFO,"PID = " << myid << " Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe());
+      }
+
+      //double endTime = 80001;
+      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, visSch));
+      if(myid == 0) UBLOG(logINFO,"Simulation-start");
+      calculation->calculate();
+      if(myid == 0) UBLOG(logINFO,"Simulation-end");
+   }
+   catch(std::exception& e)
+   {
+      cerr << e.what() << endl << flush;
+   }
+   catch(std::string& s)
+   {
+      cerr << s << endl;
+   }
+   catch(...)
+   {
+      cerr << "unknown exception" << endl;
+   }
+
+}
+int main(int argc, char* argv[])
+{
+
+   run(argv[1], UbSystem::stringTo<double>(argv[2]));
+
+   return 0;
+}
+
diff --git a/apps/cpu/plate/plate.cpp.ludwig10092013 b/apps/cpu/plate/plate.cpp.ludwig10092013
index 852eed72bc66eef1d56d70edea8ad5c7033e7b2c..00e1aed5a3414e48252a6e96536e13f76728b282 100644
--- a/apps/cpu/plate/plate.cpp.ludwig10092013
+++ b/apps/cpu/plate/plate.cpp.ludwig10092013
@@ -1,626 +1,626 @@
-
-
-#include <iostream>
-#include <string>
-#include <math.h> 
-
-#include <vfluids.h>
-
-using namespace std;
-
-
-void run(const char *cstr)
-{
-   try
-   {
-      string machine = QUOTEME(CAB_MACHINE);
-	  UBLOG(logINFO,"Testcase plate");
-      string pathname; 
-      string pathGeo;
-	  string BrueckeFilename;
-	  string ZckbndFilename;
-      int numOfThreads =1;
-      bool logfile = false;
-      stringstream logFilename;
-      double availMem = 0;
-
-      UbLog::reportingLevel() = logDEBUG;
-
-      CommunicatorPtr comm(new MPICommunicator());
-      int myid = comm->getProcessID();
-      
-      if(machine == "PIPPINNEU") 
-      {
-
-		  pathname = "f:/temp/plateBfluid";
-		  pathGeo = "e:/geometriedatenstls";
-         numOfThreads = 1;
-         logfile = false;
-         availMem = 3.0e9;
-      }
-      else if(machine == "M01" || machine == "M02")      
-      {
-		  pathname = "/work/sonjaOutputs/plateBfluidNeud";
-		  pathGeo = "/home/sonuphof/Stl-Zeichnungen";
-         numOfThreads = 1;
-         availMem = 12.0e9;
-         logfile = true;
-
-         //if(myid ==0)
-         //{
-            logFilename <<  pathname + "/logfile"+UbSystem::toString(UbSystem::getTimeStamp())+"_"+UbSystem::toString(myid)+".txt";
-         //}
-      }
-      else throw UbException(UB_EXARGS, "unknown CAB_MACHINE");
-
-	  BrueckeFilename = pathGeo + "/platte_raw.stl"; 
-	  ZckbndFilename= pathGeo + "/2zackenbaender0.stl";
-
-      //if(myid ==0 && logfile)
-      //{
-         UbLog::output_policy::setStream(logFilename.str());
-      //}
-
-      int baseLevel, refineLevel,nx[3],blocknx[3];
-      double Re,velocity,rhoInit,vx1Init;//,vx2Init,vx3Init;
-
-	  //////////////////////////////////////////////////////////////////////////
-	  //physik
-	  //////////////////////////////////////////////////////////////////////////
-	  Re            = 11900;// 13286;//13286;//gemessen 18.98 m/s...*5.0 zum  testen ob was passiert
-	  velocity      = 0.01;  
-	  vx1Init       = 0.01;  
-	  rhoInit       = 1.0;
-	  SimulationParametersPtr param = SimulationParameters::getInstanz();
-	  param->setCollisionModelType(SimulationParameters::COMPRESSIBLE);
-
-	  int H=200;//200;//392;
-	  ///////////////Knotenabmessungen:
-	  nx[0]      = 120;//60;//86;//43;//65;//50;  //länge
-	  nx[1]      = 3;//6;///1;//5;// //breite
-	  nx[2]      = 32;//18;//5;//15;//15; //höhe gebiet
-	  blocknx[0] = 9;
-	  blocknx[1] = 9;
-	  blocknx[2] = 9;
-
-	  baseLevel   = 0;
-	  refineLevel = 2;//1;//5;
-
-
-
-	  ///////////////Weltabmessungen:
-	  double kanalhoeheSI  = 60.0/100.0;//60.0/100.0;//cm, Kanalhöhe
-	  double kanalbreiteSI = kanalhoeheSI*120.0/2.0;//=kanalhöhe*nx1/nx2//1.65/100.0;//13.2/100.0;////40.0/100.0; //cm, Kanalbreite //13.2 zeilbreite
-	  double kanallaengeSI = kanalhoeheSI*120.0/32.0;//80.0/100.0;//cm, Kanallänge, ist nicht angegeben
-
-	  // double refinewidth1=kanalhoeheSI/10.0;
-
-	  double fineNodeDx   = (kanalhoeheSI) / (double)( blocknx[2]*nx[2]*(1<<refineLevel)+1 ); //+1--> gitter liegt jeweils 0.5dx innerhalb
-	  double coarseNodeDx = fineNodeDx * (double)(1<<refineLevel);//geowerte
-
-	  double blockLengthx1 = blocknx[0]*coarseNodeDx; //geowerte
-	  double blockLengthx2 = blockLengthx1;
-	  double blockLengthx3 = blockLengthx1;
-
-	  double originX1 = 0.0;//-50.0*propellerDurchmesser;  //geowerte
-	  double originX2 = 0.0;//-0.5*blockLengthx2*nx2;
-	  double originX3 = 0.0;// minX3 + 0.5*fineNodeDx;
-
-	  double geoLength[]   = {  nx[0]*blockLengthx1, nx[1]*blockLengthx2, nx[2]*blockLengthx3}; 
-
-	  //position vorderkante cube
-	  double originBridgeX1 = 20.0/100.0; //cm, geraten
-	  double originBridgeX2 = 0.0;//0.5*params.nx[1]*blockLengthx2-0.5*H-fineNodeDx;
-	  double originBridgeX3 = kanalhoeheSI*0.5;//H*0.0-fineNodeDx; //boden
-
-	  bool periodicx1 = false;
-	  bool periodicx2 = true;
-	  bool periodicx3 = true;
-
-	  //##########################################################################
-	  //## physical parameters
-	  //##########################################################################
-
-	  double smagorinskiConstant = 0.18;
-
-
-	  double rhoLB         = 1.0;
-	  double rhoReal       = 1.0;
-	  double nueReal  = 0.000015;//0.015;
-
-	  double hReal         = 0.0105;//<-m     1.05;//Plattendicke in cm(! cm nicht m !)
-	  double uReal         = Re*nueReal/hReal;
-
-	  //##Machzahl:
-	  //#Ma     = uReal/csReal
-	  double Ma      = 0.05;//0.0553;//Ma-Real!
-	  double csReal  = uReal/Ma;
-	  double hLB     = hReal/coarseNodeDx;
-
-	  LBMUnitConverterPtr unitConverter = LBMUnitConverterPtr(new LBMUnitConverter(hReal, csReal, rhoReal, hLB));
-
-	  double uLB           = uReal   * unitConverter->getFactorVelocityWToLb();
-	  double nueLB         = nueReal * unitConverter->getFactorViscosityWToLb();
-	  double timestep      = unitConverter->getFactorTimeLbToW(coarseNodeDx);
-
-	  velocity = uLB;
-	  double viscosity = nueLB;
-
-	  //////////////////////////////////////////////////////////////////////////
-	  Grid3DPtr grid(new Grid3D(comm));
-	  UbSchedulerPtr rSch(new UbScheduler(5000,5000,1000000));
-	  RestartPostprocessor rp(grid, rSch, comm, pathname+"/checkpoints", RestartPostprocessor::BINARY);
-
-      std::string opt;
-
-      if(cstr!= NULL)
-         opt = std::string(cstr);
-
-      if(/*(cstr== NULL)*/cstr!= NULL)
-      {
-         opt = std::string(cstr);
-
-         if(myid==0) UBLOG(logINFO,"Restart step: " << opt);
-
-         grid = rp.restart(UbSystem::stringTo<int>(opt));
-
-         //set connectors
-         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27OffsetInterpolationProcessor());
-         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
-         grid->accept( setConnsVisitor );
-
-         //domain decomposition
-         //PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
-         //grid->accept(pqPartVisitor);
-      }
-      else
-      {
-      //bounding box
-      double g_minX1 = originX1;
-      double g_minX2 = originX2;
-      double g_minX3 = originX3;
-
-      double g_maxX1 = originX1 + geoLength[0];
-      double g_maxX2 = originX2 + geoLength[1];
-      double g_maxX3 = originX3 + geoLength[2];
-
-      //set grid
-      grid->setDeltaX(coarseNodeDx);
-      grid->setBlockNX(blocknx[0], blocknx[1], blocknx[2]);
-      grid->setPeriodicX1(periodicx1);
-      grid->setPeriodicX2(periodicx2);
-      grid->setPeriodicX3(periodicx3);
-	  
-      
-      GbObject3DPtr gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
-      if(myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), pathname+"/geo/gridCube", WbWriterVtkXmlASCII::getInstance());
-
-      GenBlocksGridVisitor genBlocks;
-      genBlocks.addGeoObject(gridCube);
-      grid->accept(genBlocks);
-
-
-	  /////////////////////////////////////////////////7
-	  //interactoren definieren
-
-
-
-	  double geoOverlap = 3.0*coarseNodeDx;
-
-	  //inflow
-      GbCuboid3DPtr velBCCuboid(new GbCuboid3D(originX1-geoOverlap, originX2-geoOverlap, originX3-geoOverlap, 
-         originX1/*+coarseNodeDx*/, originX2+geoLength[1]+geoOverlap, originX3+geoLength[2]+geoOverlap));
-      if(myid == 0) GbSystem3D::writeGeoObject(velBCCuboid.get(), pathname+"/geo/velBCCuboid", WbWriterVtkXmlASCII::getInstance());
-      D3Q27InteractorPtr velBCInteractor(new D3Q27Interactor(velBCCuboid,grid,Interactor3D::SOLID)); 
-
-	   //inflow
-      double uLB2=uLB*0.96*1.02;//*0.5;
-      double raiseVelSteps = 0;
-      vector<D3Q27BCFunction> velcX1BCs,dummy;
-
-      mu::Parser inflowProfile;
-      inflowProfile.SetExpr("uLB"); 
-
-      inflowProfile.DefineConst("uLB",uLB2);
-      velcX1BCs.push_back(D3Q27BCFunction(inflowProfile,raiseVelSteps,D3Q27BCFunction::INFCONST));
-      
-      D3Q27BoundaryConditionAdapterPtr velBCAdapter(new D3Q27VelocityBCAdapter (velcX1BCs,dummy,dummy));
-      velBCInteractor->addBCAdapter(velBCAdapter);
-
-	  //outflow
-	  GbCuboid3DPtr densCuboid(new GbCuboid3D(originX1+geoLength[0]-coarseNodeDx, originX2-geoOverlap, originX3-geoOverlap, 
-		  originX1+geoLength[0]+geoOverlap, originX2+geoLength[1]+geoOverlap, originX3+geoLength[2]+geoOverlap ));
-	  if(myid == 0) GbSystem3D::writeGeoObject(densCuboid.get(), pathname+"/geo/densCuboid", WbWriterVtkXmlASCII::getInstance());
-	  D3Q27BoundaryConditionAdapterPtr denBCAdapter(new D3Q27DensityBCAdapter(rhoInit));
-	  D3Q27InteractorPtr densInteractor( new D3Q27Interactor(densCuboid,grid,denBCAdapter,Interactor3D::SOLID) );
-      
-      //////////////////////////////////////////////////////////////////////////
-      if(myid == 0)
-      {
-         UBLOG(logINFO, "*****************************************");
-         UBLOG(logINFO, "* Parameters                            *");
-         UBLOG(logINFO, "* Re            ="<<Re);
-         UBLOG(logINFO, "* Ma            ="<<Ma);
-         UBLOG(logINFO, "* uReal         ="<<uReal);
-         UBLOG(logINFO, "* nueReal       ="<<nueReal);
-         UBLOG(logINFO, "* nue           ="<<nueLB);
-         UBLOG(logINFO, "* velocity      ="<<uLB);
-        // UBLOG(logINFO, "* LX1 (world/LB)="<<kanallaengeSI<<"/"<<kanallaengeSI/coarseNodeDx);
-       //  UBLOG(logINFO, "* LX2 (world/LB)="<<kanalbreiteSI<<"/"<<kanalbreiteSI/coarseNodeDx);
-         UBLOG(logINFO, "* LX3 (world/LB)="<<kanalhoeheSI<<"/"<<kanalhoeheSI/coarseNodeDx);
-         UBLOG(logINFO, "* cdx           ="<<coarseNodeDx);
-         UBLOG(logINFO, "* fdx           ="<<fineNodeDx);
-         UBLOG(logINFO, "* dx_base       ="<<coarseNodeDx<<" == "<<coarseNodeDx);
-         UBLOG(logINFO, "* dx_refine     ="<<fineNodeDx<<" == "<<fineNodeDx );
-         UBLOG(logINFO, "* nx1/2/3       ="<<nx[0]<<"/"<<nx[1]<<"/"<<nx[2]);
-         UBLOG(logINFO, "* blocknx1/2/3  ="<<blocknx[0]<<"/"<<blocknx[1]<<"/"<<blocknx[2]);
-         UBLOG(logINFO, "* x2Periodic    ="<<periodicx2);
-         UBLOG(logINFO, "* x3Periodic    ="<<periodicx3);
-         UBLOG(logINFO, "*****************************************");
-         UBLOGML(logINFO, "UnitConverter:"<<unitConverter->toString());
-         UBLOG(logINFO, "*****************************************");     
-      }
-	  //////////////////////////////////////////////////////////////////////////
-	  //platte
-	  GbTriFaceMesh3DPtr mesh (GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(BrueckeFilename,"Netz"));
-
-	  double x1minMesh = mesh->getX1Minimum(); double x1maxMesh = mesh->getX1Maximum();
-	  double x2minMesh = mesh->getX2Minimum(); double x2maxMesh = mesh->getX2Maximum();
-	  double x3minMesh = mesh->getX3Minimum(); double x3maxMesh = mesh->getX3Maximum();
-
-	  double drehpunktX=x1minMesh+(x1maxMesh-x1minMesh)*0.5;//triFaceMeshS->getX1Centroid();
-	  double drehpunktZ=x3minMesh+(x3maxMesh-x3minMesh)*0.5;//triFaceMeshS->getX3Centroid();
-	  double drehpunktY=x2minMesh+(x2maxMesh-x2minMesh)*0.5;// seedX2-0.5*nodeDelta;//+nx2*deltaX2+0.5*deltaX2;
-
-	  mesh->rotate(90.0,0.0,0.0);  //TriFacMesh-KO-System anders als LB-KO-System
-
-	  x1minMesh = mesh->getX1Minimum();  x1maxMesh = mesh->getX1Maximum();
-	  x2minMesh = mesh->getX2Minimum();  x2maxMesh = mesh->getX2Maximum();
-	  x3minMesh = mesh->getX3Minimum();  x3maxMesh = mesh->getX3Maximum();
-
-	  drehpunktX=x1minMesh+(x1maxMesh-x1minMesh)*0.5;//triFaceMeshS->getX1Centroid();
-	  drehpunktZ=x3minMesh+(x3maxMesh-x3minMesh)*0.5;//triFaceMeshS->getX3Centroid();
-	  drehpunktY=x2minMesh+(x2maxMesh-x2minMesh)*0.5;// seedX2-0.5*nodeDelta;//+nx2*deltaX2+0.5*deltaX2;
-
-	  double H3=1.05/100.0;//cm, Plattendicke
-	  double scaleB=H3/(x3maxMesh-x3minMesh);
-	  double scaleX2=(geoLength[2]+2.0*coarseNodeDx)/(x2minMesh-x2maxMesh);
-
-	  mesh->scale(scaleB,scaleB,scaleB);
-	  x1minMesh = mesh->getX1Minimum(); x1maxMesh = mesh->getX1Maximum();
-	  x2minMesh = mesh->getX2Minimum(); x2maxMesh = mesh->getX2Maximum();
-	  x3minMesh = mesh->getX3Minimum(); x3maxMesh = mesh->getX3Maximum();
-	  double offsetXBridge=originBridgeX1;//originBridgeX1;
-	  double offsetYBridge=originBridgeX2;//originBridgeX2;
-	  double offsetZBridge=originBridgeX3;//originBridgeX3;//-0.5*(x3minMesh-x3maxMesh);
-	  //mesh->translate(-x1minMesh+offsetXBridge, -x2minMesh-0.5*offsetYBridge-coarseNodeDx, -x3minMesh+offsetZBridge); 
-	  mesh->translate(-x1minMesh+offsetXBridge, -x2minMesh+offsetYBridge-coarseNodeDx, -x3minMesh+offsetZBridge-(x3maxMesh-x3minMesh)*0.5); 
-
-	  x1minMesh = mesh->getX1Minimum(); x1maxMesh = mesh->getX1Maximum();
-	  x2minMesh = mesh->getX2Minimum(); x2maxMesh = mesh->getX2Maximum();
-	  x3minMesh = mesh->getX3Minimum(); x3maxMesh = mesh->getX3Maximum();
-
-	  if(myid == 0) GbSystem3D::writeGeoObject( mesh.get(), pathname+"/geo/platte", WbWriterVtkXmlBinary::getInstance() );
-
-	  //////////////////////////////////////////////////////////////////////////
-	  // Zackenband
-	  //////////////////////////////////////////////////////////////////////////
-	  GbTriFaceMesh3DPtr meshBand (GbTriFaceMesh3DCreator::readMeshFromFile(ZckbndFilename, "NetzBand"));
-	  meshBand->deleteRedundantNodes();
-
-	  double x1minMeshB = meshBand->getX1Minimum(); double x1maxMeshB = meshBand->getX1Maximum();
-	  double x2minMeshB = meshBand->getX2Minimum(); double x2maxMeshB = meshBand->getX2Maximum();
-	  double x3minMeshB = meshBand->getX3Minimum(); double x3maxMeshB = meshBand->getX3Maximum();
-
-	  x1minMeshB = meshBand->getX1Minimum();  x1maxMeshB = meshBand->getX1Maximum();
-	  x2minMeshB = meshBand->getX2Minimum();  x2maxMeshB = meshBand->getX2Maximum();
-	  x3minMeshB = meshBand->getX3Minimum();  x3maxMeshB = meshBand->getX3Maximum();
-
-	  double H1B=1.5/100.0;//0.05;//cm, Banddicke..nachschauen!!!
-	  double scaleBand=H1B/(x1maxMeshB-x1minMeshB);//H3B/(x3maxMeshB-x3minMeshB);
-
-	  meshBand->scale(scaleBand,scaleBand,scaleBand);
-	  x1minMeshB = meshBand->getX1Minimum(); x1maxMeshB = meshBand->getX1Maximum();
-	  x2minMeshB = meshBand->getX2Minimum(); x2maxMeshB = meshBand->getX2Maximum();
-	  x3minMeshB = meshBand->getX3Minimum(); x3maxMeshB = meshBand->getX3Maximum();
-	  double dBandX=0.5/100.0;//1.29; //15mm-2.1mm Absand von Bandvorderkante
-	  double dBandY=0.0/100.0;
-	  double dBandZ=0.223/100.0;//0.344;//....
-	  double offsetXBridgeB=x1minMesh+dBandX;//originBridgeX1+dBandX;//originBridgeX1;
-	  double offsetYBridgeB=originBridgeX2+dBandY;//originBridgeX2;
-	  double offsetZBridgeB=originBridgeX3+dBandZ;//originBridgeX3;//-0.5*(x3minMesh-x3maxMesh);
-	  meshBand->translate(-x1minMeshB+offsetXBridgeB, -x2minMeshB+offsetYBridgeB-coarseNodeDx, -x3minMeshB+offsetZBridgeB);//-(x3maxMeshB-x3minMeshB)*0.5); 
-
-	  x1minMeshB = meshBand->getX1Minimum(); x1maxMeshB = meshBand->getX1Maximum();
-	  x2minMeshB = meshBand->getX2Minimum(); x2maxMeshB = meshBand->getX2Maximum();
-	  x3minMeshB = meshBand->getX3Minimum(); x3maxMeshB = meshBand->getX3Maximum();
-
-	  GbSystem3D::writeGeoObject( meshBand.get(), pathname+"/geo/Band", WbWriterVtkXmlASCII::getInstance() );
-
-	  /////////////////Band2
-	  GbTriFaceMesh3DPtr meshBand2(GbTriFaceMesh3DCreator::readMeshFromFile(ZckbndFilename, "NetzBand2"));
-	  meshBand->deleteRedundantNodes();
-
-	  double x1minMeshB2 = meshBand2->getX1Minimum(); double x1maxMeshB2 = meshBand2->getX1Maximum();
-	  double x2minMeshB2 = meshBand2->getX2Minimum(); double x2maxMeshB2 = meshBand2->getX2Maximum();
-	  double x3minMeshB2 = meshBand2->getX3Minimum(); double x3maxMeshB2 = meshBand2->getX3Maximum();
-
-	  x1minMeshB2 = meshBand2->getX1Minimum();  x1maxMeshB2 = meshBand2->getX1Maximum();
-	  x2minMeshB2 = meshBand2->getX2Minimum();  x2maxMeshB2 = meshBand2->getX2Maximum();
-	  x3minMeshB2 = meshBand2->getX3Minimum();  x3maxMeshB2 = meshBand2->getX3Maximum();
-
-	  double H1B2=1.5/100.0;//0.05;//cm, Banddicke..nachschauen!!!
-	  double scaleBand2=H1B2/(x1maxMeshB2-x1minMeshB2);//H3B/(x3maxMeshB-x3minMeshB);
-
-	  meshBand2->scale(scaleBand2,scaleBand2,scaleBand2);
-	  x1minMeshB2 = meshBand2->getX1Minimum(); x1maxMeshB2 = meshBand2->getX1Maximum();
-	  x2minMeshB2 = meshBand2->getX2Minimum(); x2maxMeshB2 = meshBand2->getX2Maximum();
-	  x3minMeshB2 = meshBand2->getX3Minimum(); x3maxMeshB2 = meshBand2->getX3Maximum();
-	  double dBandX2=0.5/100.0;//1.29;
-	  double dBandY2=0.5/100.0;
-	  double dBandZ2=0.223/100.0;//0.344;//...
-	  double offsetXBridgeB2=x1minMesh+dBandX2;//originBridgeX1;
-	  double offsetYBridgeB2=originBridgeX2+dBandY2;//originBridgeX2;
-	  double offsetZBridgeB2=originBridgeX3+dBandZ2;//originBridgeX3;//-0.5*(x3minMesh-x3maxMesh);
-	  meshBand2->translate(-x1minMeshB2+offsetXBridgeB2, -x2minMeshB2+offsetYBridgeB2-coarseNodeDx, -x3minMeshB2+offsetZBridgeB2);//-(x3maxMeshB2-x3minMeshB2)*0.5); 
-
-	  x1minMeshB2 = meshBand2->getX1Minimum(); x1maxMeshB2 = meshBand2->getX1Maximum();
-	  x2minMeshB2 = meshBand2->getX2Minimum(); x2maxMeshB2 = meshBand2->getX2Maximum();
-	  x3minMeshB2 = meshBand2->getX3Minimum(); x3maxMeshB2 = meshBand2->getX3Maximum();
-
-	  if(myid == 0) GbSystem3D::writeGeoObject( meshBand2.get(), pathname+"/geo/Band2", WbWriterVtkXmlASCII::getInstance() );
-	  //////////////////////////////////////////////////////////////////////////
-      if(myid == 0) UBLOG(logINFO,"Refinement - start");	
-
-      //////////////////////////////////////////////////////////////////////////
-      // refine
-      //////////////////////////////////////////////////////////////////////////
-
-	  ///////////platte ausmessen:
-	  x1minMesh = mesh->getX1Minimum(); x1maxMesh = mesh->getX1Maximum();
-	  x2minMesh = mesh->getX2Minimum(); x2maxMesh = mesh->getX2Maximum();
-	  x3minMesh = mesh->getX3Minimum(); x3maxMesh = mesh->getX3Maximum();
-	  double deltaX3Platte=(x3maxMesh-x3minMesh);
-
-
-	 // GbObject3DPtr gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
-	 // if(myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), pathname+"/geo/gridCube", WbWriterVtkXmlASCII::getInstance());
-
-
-
-
-	  //GbCuboid3DPtr refine2PlatteCube(new GbCuboid3D(  originX1-geoOverlap   , originX2-geoOverlap  , x3minMesh-H3*0.5
-	  //  , x1maxMesh+H3*5.0, originX2+geoOverlap+geoLength[1], x3maxMesh+H3));
-	  //RefineCrossAndInsideGbObjectBlockVisitor refineAdapterP2(refine2PlatteCube, baseLevel, refineLevel-5);
-	  //grid->accept(refineAdapterP2);
-
-	  GbCuboid3DPtr refine3PlatteCube(new GbCuboid3D(   x1minMesh+H3*2.0  , originX2-geoOverlap  , x3minMesh+H3*0.8
-	     , x1maxMesh-H3*0.2, originX2+geoOverlap+geoLength[1], x3maxMesh+H3*0.1));
-	  //RefineCrossAndInsideGbObjectBlockVisitor refineAdapterP3(refine3PlatteCube, baseLevel, refineLevel-4);
-	  //grid->accept(refineAdapterP3);
-
-	  GbCuboid3DPtr refine4PlatteCube(new GbCuboid3D(   x1minMesh-H3*2.0  , originX2-geoOverlap  , x3minMesh+deltaX3Platte*0.04
-	     ,  x1maxMesh+H3*5.0, originX2+geoOverlap+geoLength[1], x3maxMesh+H3*0.25));
-	  //if(myid == 0) GbSystem3D::writeGeoObject(refine4PlatteCube.get(), pathname+"/geo/refine4PlatteCube", WbWriterVtkXmlASCII::getInstance());
-	  //RefineCrossAndInsideGbObjectBlockVisitor refineAdapterP4(refine4PlatteCube, baseLevel, refineLevel-3);
-	  //grid->accept(refineAdapterP4);
-
-	  GbCuboid3DPtr refine5PlatteCube(new GbCuboid3D(   originX1-geoOverlap , originX2-geoOverlap  ,x3minMesh-deltaX3Platte/*x3minMesh+deltaX3Platte*0.8*//* x3minMesh+deltaX3Platte*0.8*/
-	     ,  x1maxMesh+H3*5.0, originX2+geoOverlap+geoLength[1], x3maxMesh+H3));
-	  //if(myid == 0) GbSystem3D::writeGeoObject(refine5PlatteCube.get(), pathname+"/geo/refine5PlatteCube", WbWriterVtkXmlASCII::getInstance());
-	  //RefineCrossAndInsideGbObjectBlockVisitor refineAdapterP5(refine5PlatteCube, baseLevel, refineLevel-2);
-	  //grid->accept(refineAdapterP5);
-
-	  GbCuboid3DPtr refine6PlatteCube(new GbCuboid3D(   originX1-geoOverlap   , originX2-geoOverlap  , x3minMesh-deltaX3Platte*3.0/*x3minMesh+deltaX3Platte*0.9*/
-		  ,  x1maxMesh+H3*5.0, originX2+geoOverlap+geoLength[1], x3maxMesh+deltaX3Platte*3.0));
-	  if(myid == 0) GbSystem3D::writeGeoObject(refine6PlatteCube.get(), pathname+"/geo/refine6PlatteCube", WbWriterVtkXmlASCII::getInstance());
-	  //RefineCrossAndInsideGbObjectBlockVisitor refineAdapterP6(refine6PlatteCube, baseLevel, refineLevel-1);
-	  //grid->accept(refineAdapterP6);
-
-	  //GbCuboid3DPtr wallsX1X2minRef4(new GbCuboid3D(  originX1-3.0*geoOverlap   , originX2-3.0*geoOverlap  , originX1-3.0*geoOverlap
-		//  , originX1+geoLength[0]+geoOverlap, originX2+geoOverlap+geoLength[1], kanalhoeheSI*0.1));
-
-
-
-	  if (refineLevel > 0)
-	  {
-		 
-		  RefineCrossAndInsideGbObjectHelper refineHelper(grid, refineLevel);
-		  refineHelper.addGbObject( refine6PlatteCube, refineLevel-1);
-                refineHelper.addGbObject( refine5PlatteCube, refineLevel);
-                //refineHelper.addGbObject( refine4PlatteCube, refineLevel);
-		  //refineHelper.addGbObject( refine3PlatteCube, refineLevel);
-		  refineHelper.refine();
-		  if(myid == 0) UBLOG(logINFO,"Refinement - end");	
-	  }
-
-
-
-      if(myid == 0) UBLOG(logINFO,"Refinement - end");
-	  ////////////////////////////////////////////
-	  //METIS
-	  MetisPartitioningGridVisitor metisVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B);
-	  grid->accept( metisVisitor );
-	  /////////////////////////////////////////////////
-	  ///interactoren
-	  int bbOption1 = 0; //0=simple Bounce Back, 1=quadr. BB
-	  D3Q27BoundaryConditionAdapterPtr bcObst(new D3Q27NoSlipBCAdapter(bbOption1));
-
-	  D3Q27TriFaceMeshInteractorPtr triBridgeInteractor( new D3Q27TriFaceMeshInteractor(mesh, grid, bcObst,Interactor3D::SOLID));
-	  //sd.addInteractor(triBridgeInteractor);
-
-	  D3Q27TriFaceMeshInteractorPtr triBandInteractor( new D3Q27TriFaceMeshInteractor( meshBand, grid, bcObst,Interactor3D::SOLID) );
-
-	  D3Q27TriFaceMeshInteractorPtr triBand2Interactor( new D3Q27TriFaceMeshInteractor( meshBand2, grid, bcObst,Interactor3D::SOLID) );
-
-	
-	  ////////////////////////////////////////////
-	  /////delete solid blocks
-	  if(myid == 0) UBLOG(logINFO,"deleteSolidBlocks - start");
-	  SolidBlocksHelper sd(grid, comm);
-
-	  sd.addInteractor(triBridgeInteractor);
-	  sd.addInteractor(triBandInteractor);
-	  sd.addInteractor(triBand2Interactor);
-	  sd.addInteractor(densInteractor);
-	  sd.addInteractor(velBCInteractor);
-	  sd.deleteSolidBlocks();
-	  if(myid == 0) UBLOG(logINFO,"deleteSolidBlocks - end");	 
-
-
-
-	  //////////////////////////////////////
-
-     
-
-      unsigned long nob = grid->getNumberOfBlocks();
-      unsigned long nod = nob * blocknx[0]*blocknx[1]*blocknx[2];
-      unsigned long nod_real = nob * (blocknx[0]+3)*(blocknx[1]+3)*(blocknx[2]+3);
-      
-      double needMemAll  = double(nod_real*(27*sizeof(double) + sizeof(int)));
-      double needMem  = needMemAll / double(comm->getNumberOfProcesses());
-
-      if(myid == 0)
-      {
-         UBLOG(logINFO,"Number of blocks = " << nob);
-         UBLOG(logINFO,"Number of nodes  = " << nod);
-         UBLOG(logINFO,"Necessary memory  = " << needMemAll  << " bytes");
-         UBLOG(logINFO,"Necessary memory per process = " << needMem  << " bytes");
-         UBLOG(logINFO,"Available memory per process = " << availMem << " bytes");
-	  UBLOG(logINFO,"Available memory per node/8.0 = " << (availMem/8.0) << " bytes");
-      }
-	  ////////////////////////////
-	  grid->accept( metisVisitor );
-	  /////kernel
-      //LBMKernel3DPtr kernel(new LBMKernelETD3Q27CascadedTI(blocknx[0], blocknx[1], blocknx[2]));
-	LBMKernel3DPtr kernel(new LBMKernelETD3Q27CCLB(blocknx[0], blocknx[1], blocknx[2],0)); 
-//	LBMKernel3DPtr kernel(new LBMKernelETD3Q27BGK (blocknx[0], blocknx[1], blocknx[2],1));
-      BCProcessorPtr bcProc(new D3Q27ETBCProcessor());
-      kernel->setBCProcessor(bcProc);
-	 
-
-      SetKernelBlockVisitor kernelVisitor(kernel, nueLB, availMem, needMem);
-	  
-      grid->accept(kernelVisitor);
-	  //////////////////////////////////
-	  //undef nodes
-	  if (refineLevel > 0)
-	  {
-		  D3Q27SetUndefinedNodesBlockVisitor undefNodesVisitor;
-		  grid->accept(undefNodesVisitor);
-	  }
-	  //////////////////////////////////////////
-	  grid->addAndInitInteractor(triBridgeInteractor);
-	  grid->addAndInitInteractor(triBandInteractor);
-	  grid->addAndInitInteractor(triBand2Interactor);
-	  grid->addAndInitInteractor( densInteractor ); 
-	  grid->addAndInitInteractor( velBCInteractor );
-
-	    UbTimer timer;
-   timer.start();
- 
-   grid->accept( metisVisitor );
-
-   if(myid == 0) UBLOG(logINFO,"Write blocks - start");
-   BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname + "/grid/blocks", WbWriterVtkXmlBinary::getInstance(), comm));
-   if(myid == 0) ppblocks->update(0);
-   if(myid == 0) UBLOG(logINFO,"Write blocks - end");
-
-	      
-
-   if(myid == 0) UBLOG(logINFO,"Write blocks - start");
-   grid->accept( metisVisitor );
-   if(myid == 0) ppblocks->update(1);
-   ppblocks.reset();
-   if(myid == 0) UBLOG(logINFO,"Write blocks - end");
-  
-
-
-      //set connectors
-      D3Q27InterpolationProcessorPtr iProcessor(new D3Q27OffsetInterpolationProcessor());
-      D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
-      grid->accept( setConnsVisitor );
-
-      //domain decomposition
-      //PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
-      //grid->accept(pqPartVisitor);
-
-      //initialization of decompositions
-      D3Q27ETInitDistributionsBlockVisitor initVisitor(1.0);
-      initVisitor.setVx1(inflowProfile);
-      grid->accept(initVisitor);
-
-      //Postprozess
-	
-      
-      UbSchedulerPtr geoSch(new UbScheduler(1));
-      D3Q27MacroscopicQuantitiesPostprocessorPtr ppgeo(
-           new D3Q27MacroscopicQuantitiesPostprocessor(grid, geoSch, pathname + "/grid/nodes", WbWriterVtkXmlBinary::getInstance(), 
-                                                       unitConverter, comm, true));
-	  									
-
-      grid->doPostProcess(0);
-      ppgeo.reset();
-      geoSch.reset();
-
-      if(myid == 0) UBLOG(logINFO,"Preprozess - end");      
-
-}
-      
-
-
-      UbSchedulerPtr visSch(new UbScheduler());
-visSch->addSchedule(1,1,3);
-      visSch->addSchedule(100,100,1000);
- //     visSch->addSchedule(1000,1000,100000);
- //     visSch->addSchedule(100000,100000,1000000);
-	//  //TurbulenceIntensityPostprocessor tipp(grid,  pathname + "/steps/stepTI", WbWriterVtkXmlBinary::getInstance(), visSch, comm);
-	  UbSchedulerPtr resSch(new UbScheduler());
-      resSch->addSchedule(0,20,1000);
-	  AverageValuesPostprocessor       Avpp(grid,  pathname + "/steps/stepAV", WbWriterVtkXmlBinary::getInstance(), visSch/*wann wird rausgeschrieben*/,resSch/*wann wird resettet*/,comm);
-      D3Q27MacroscopicQuantitiesPostprocessor pp(grid, visSch, pathname + "/steps/step", WbWriterVtkXmlBinary::getInstance(), unitConverter, comm);// unitConverter, comm);
-
-      UbSchedulerPtr nupsSch(new UbScheduler(10, 10, 100));
-      NUPSCounterPostprocessor npr(grid, nupsSch, pathname + "/results/nups.txt", comm);
-
-	  //}
-	  mu::Parser decrViscFunc;
-      decrViscFunc.SetExpr("nue0+c0/(t+1)/(t+1)");
-      decrViscFunc.DefineConst("nue0", nueLB);
-	  decrViscFunc.DefineConst("c0", 0.1);
-	  UbSchedulerPtr DecrViscSch(new UbScheduler());
-      DecrViscSch->addSchedule(10,10,1000);
-	  DecreaseViscosityPostprocessor decrViscPPPtr(grid, DecrViscSch,&decrViscFunc, comm);
-
-      cout << "PID = " << myid << " Total Physical Memory (RAM): " << MemoryUtil::getTotalPhysMem()<<endl;
-      cout << "PID = " << myid << " Physical Memory currently used: " << MemoryUtil::getPhysMemUsed()<<endl;
-      cout << "PID = " << myid << " Physical Memory currently used by current process: " << MemoryUtil::getPhysMemUsedByMe()<<endl;
-
-      double endTime = 200001;
-      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, visSch));
-      if(myid == 0) UBLOG(logINFO,"Simulation-start");
-      calculation->calculate();
-      if(myid == 0) UBLOG(logINFO,"Simulation-end");
-   }
-   catch(std::exception& e)
-   {
-      cerr << e.what() << endl << flush;
-   }
-   catch(std::string& s)
-   {
-      cerr << s << endl;
-   }
-   catch(...)
-   {
-      cerr << "unknown exception" << endl;
-   }
-
-}
-int main(int argc, char* argv[])
-{
-
-   run(argv[1]);
-
-   return 0;
-}
-
+
+
+#include <iostream>
+#include <string>
+#include <math.h> 
+
+#include <vfluids.h>
+
+using namespace std;
+
+
+void run(const char *cstr)
+{
+   try
+   {
+      string machine = QUOTEME(CAB_MACHINE);
+	  UBLOG(logINFO,"Testcase plate");
+      string pathname; 
+      string pathGeo;
+	  string BrueckeFilename;
+	  string ZckbndFilename;
+      int numOfThreads =1;
+      bool logfile = false;
+      stringstream logFilename;
+      double availMem = 0;
+
+      UbLog::reportingLevel() = logDEBUG;
+
+      CommunicatorPtr comm(new MPICommunicator());
+      int myid = comm->getProcessID();
+      
+      if(machine == "PIPPINNEU") 
+      {
+
+		  pathname = "f:/temp/plateBfluid";
+		  pathGeo = "e:/geometriedatenstls";
+         numOfThreads = 1;
+         logfile = false;
+         availMem = 3.0e9;
+      }
+      else if(machine == "M01" || machine == "M02")      
+      {
+		  pathname = "/work/sonjaOutputs/plateBfluidNeud";
+		  pathGeo = "/home/sonuphof/Stl-Zeichnungen";
+         numOfThreads = 1;
+         availMem = 12.0e9;
+         logfile = true;
+
+         //if(myid ==0)
+         //{
+            logFilename <<  pathname + "/logfile"+UbSystem::toString(UbSystem::getTimeStamp())+"_"+UbSystem::toString(myid)+".txt";
+         //}
+      }
+      else throw UbException(UB_EXARGS, "unknown CAB_MACHINE");
+
+	  BrueckeFilename = pathGeo + "/platte_raw.stl"; 
+	  ZckbndFilename= pathGeo + "/2zackenbaender0.stl";
+
+      //if(myid ==0 && logfile)
+      //{
+         UbLog::output_policy::setStream(logFilename.str());
+      //}
+
+      int baseLevel, refineLevel,nx[3],blocknx[3];
+      double Re,velocity,rhoInit,vx1Init;//,vx2Init,vx3Init;
+
+	  //////////////////////////////////////////////////////////////////////////
+	  //physik
+	  //////////////////////////////////////////////////////////////////////////
+	  Re            = 11900;// 13286;//13286;//gemessen 18.98 m/s...*5.0 zum  testen ob was passiert
+	  velocity      = 0.01;  
+	  vx1Init       = 0.01;  
+	  rhoInit       = 1.0;
+	  SimulationParametersPtr param = SimulationParameters::getInstanz();
+	  param->setCollisionModelType(SimulationParameters::COMPRESSIBLE);
+
+	  int H=200;//200;//392;
+	  ///////////////Knotenabmessungen:
+	  nx[0]      = 120;//60;//86;//43;//65;//50;  //länge
+	  nx[1]      = 3;//6;///1;//5;// //breite
+	  nx[2]      = 32;//18;//5;//15;//15; //höhe gebiet
+	  blocknx[0] = 9;
+	  blocknx[1] = 9;
+	  blocknx[2] = 9;
+
+	  baseLevel   = 0;
+	  refineLevel = 2;//1;//5;
+
+
+
+	  ///////////////Weltabmessungen:
+	  double kanalhoeheSI  = 60.0/100.0;//60.0/100.0;//cm, Kanalhöhe
+	  double kanalbreiteSI = kanalhoeheSI*120.0/2.0;//=kanalhöhe*nx1/nx2//1.65/100.0;//13.2/100.0;////40.0/100.0; //cm, Kanalbreite //13.2 zeilbreite
+	  double kanallaengeSI = kanalhoeheSI*120.0/32.0;//80.0/100.0;//cm, Kanallänge, ist nicht angegeben
+
+	  // double refinewidth1=kanalhoeheSI/10.0;
+
+	  double fineNodeDx   = (kanalhoeheSI) / (double)( blocknx[2]*nx[2]*(1<<refineLevel)+1 ); //+1--> gitter liegt jeweils 0.5dx innerhalb
+	  double coarseNodeDx = fineNodeDx * (double)(1<<refineLevel);//geowerte
+
+	  double blockLengthx1 = blocknx[0]*coarseNodeDx; //geowerte
+	  double blockLengthx2 = blockLengthx1;
+	  double blockLengthx3 = blockLengthx1;
+
+	  double originX1 = 0.0;//-50.0*propellerDurchmesser;  //geowerte
+	  double originX2 = 0.0;//-0.5*blockLengthx2*nx2;
+	  double originX3 = 0.0;// minX3 + 0.5*fineNodeDx;
+
+	  double geoLength[]   = {  nx[0]*blockLengthx1, nx[1]*blockLengthx2, nx[2]*blockLengthx3}; 
+
+	  //position vorderkante cube
+	  double originBridgeX1 = 20.0/100.0; //cm, geraten
+	  double originBridgeX2 = 0.0;//0.5*params.nx[1]*blockLengthx2-0.5*H-fineNodeDx;
+	  double originBridgeX3 = kanalhoeheSI*0.5;//H*0.0-fineNodeDx; //boden
+
+	  bool periodicx1 = false;
+	  bool periodicx2 = true;
+	  bool periodicx3 = true;
+
+	  //##########################################################################
+	  //## physical parameters
+	  //##########################################################################
+
+	  double smagorinskiConstant = 0.18;
+
+
+	  double rhoLB         = 1.0;
+	  double rhoReal       = 1.0;
+	  double nueReal  = 0.000015;//0.015;
+
+	  double hReal         = 0.0105;//<-m     1.05;//Plattendicke in cm(! cm nicht m !)
+	  double uReal         = Re*nueReal/hReal;
+
+	  //##Machzahl:
+	  //#Ma     = uReal/csReal
+	  double Ma      = 0.05;//0.0553;//Ma-Real!
+	  double csReal  = uReal/Ma;
+	  double hLB     = hReal/coarseNodeDx;
+
+	  LBMUnitConverterPtr unitConverter = LBMUnitConverterPtr(new LBMUnitConverter(hReal, csReal, rhoReal, hLB));
+
+	  double uLB           = uReal   * unitConverter->getFactorVelocityWToLb();
+	  double nueLB         = nueReal * unitConverter->getFactorViscosityWToLb();
+	  double timestep      = unitConverter->getFactorTimeLbToW(coarseNodeDx);
+
+	  velocity = uLB;
+	  double viscosity = nueLB;
+
+	  //////////////////////////////////////////////////////////////////////////
+	  Grid3DPtr grid(new Grid3D(comm));
+	  UbSchedulerPtr rSch(new UbScheduler(5000,5000,1000000));
+	  RestartPostprocessor rp(grid, rSch, comm, pathname+"/checkpoints", RestartPostprocessor::BINARY);
+
+      std::string opt;
+
+      if(cstr!= NULL)
+         opt = std::string(cstr);
+
+      if(/*(cstr== NULL)*/cstr!= NULL)
+      {
+         opt = std::string(cstr);
+
+         if(myid==0) UBLOG(logINFO,"Restart step: " << opt);
+
+         grid = rp.restart(UbSystem::stringTo<int>(opt));
+
+         //set connectors
+         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27OffsetInterpolationProcessor());
+         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
+         grid->accept( setConnsVisitor );
+
+         //domain decomposition
+         //PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
+         //grid->accept(pqPartVisitor);
+      }
+      else
+      {
+      //bounding box
+      double g_minX1 = originX1;
+      double g_minX2 = originX2;
+      double g_minX3 = originX3;
+
+      double g_maxX1 = originX1 + geoLength[0];
+      double g_maxX2 = originX2 + geoLength[1];
+      double g_maxX3 = originX3 + geoLength[2];
+
+      //set grid
+      grid->setDeltaX(coarseNodeDx);
+      grid->setBlockNX(blocknx[0], blocknx[1], blocknx[2]);
+      grid->setPeriodicX1(periodicx1);
+      grid->setPeriodicX2(periodicx2);
+      grid->setPeriodicX3(periodicx3);
+	  
+      
+      GbObject3DPtr gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
+      if(myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), pathname+"/geo/gridCube", WbWriterVtkXmlASCII::getInstance());
+
+      GenBlocksGridVisitor genBlocks;
+      genBlocks.addGeoObject(gridCube);
+      grid->accept(genBlocks);
+
+
+	  /////////////////////////////////////////////////7
+	  //interactoren definieren
+
+
+
+	  double geoOverlap = 3.0*coarseNodeDx;
+
+	  //inflow
+      GbCuboid3DPtr velBCCuboid(new GbCuboid3D(originX1-geoOverlap, originX2-geoOverlap, originX3-geoOverlap, 
+         originX1/*+coarseNodeDx*/, originX2+geoLength[1]+geoOverlap, originX3+geoLength[2]+geoOverlap));
+      if(myid == 0) GbSystem3D::writeGeoObject(velBCCuboid.get(), pathname+"/geo/velBCCuboid", WbWriterVtkXmlASCII::getInstance());
+      D3Q27InteractorPtr velBCInteractor(new D3Q27Interactor(velBCCuboid,grid,Interactor3D::SOLID)); 
+
+	   //inflow
+      double uLB2=uLB*0.96*1.02;//*0.5;
+      double raiseVelSteps = 0;
+      vector<D3Q27BCFunction> velcX1BCs,dummy;
+
+      mu::Parser inflowProfile;
+      inflowProfile.SetExpr("uLB"); 
+
+      inflowProfile.DefineConst("uLB",uLB2);
+      velcX1BCs.push_back(D3Q27BCFunction(inflowProfile,raiseVelSteps,D3Q27BCFunction::INFCONST));
+      
+      D3Q27BoundaryConditionAdapterPtr velBCAdapter(new D3Q27VelocityBCAdapter (velcX1BCs,dummy,dummy));
+      velBCInteractor->addBCAdapter(velBCAdapter);
+
+	  //outflow
+	  GbCuboid3DPtr densCuboid(new GbCuboid3D(originX1+geoLength[0]-coarseNodeDx, originX2-geoOverlap, originX3-geoOverlap, 
+		  originX1+geoLength[0]+geoOverlap, originX2+geoLength[1]+geoOverlap, originX3+geoLength[2]+geoOverlap ));
+	  if(myid == 0) GbSystem3D::writeGeoObject(densCuboid.get(), pathname+"/geo/densCuboid", WbWriterVtkXmlASCII::getInstance());
+	  D3Q27BoundaryConditionAdapterPtr denBCAdapter(new D3Q27DensityBCAdapter(rhoInit));
+	  D3Q27InteractorPtr densInteractor( new D3Q27Interactor(densCuboid,grid,denBCAdapter,Interactor3D::SOLID) );
+      
+      //////////////////////////////////////////////////////////////////////////
+      if(myid == 0)
+      {
+         UBLOG(logINFO, "*****************************************");
+         UBLOG(logINFO, "* Parameters                            *");
+         UBLOG(logINFO, "* Re            ="<<Re);
+         UBLOG(logINFO, "* Ma            ="<<Ma);
+         UBLOG(logINFO, "* uReal         ="<<uReal);
+         UBLOG(logINFO, "* nueReal       ="<<nueReal);
+         UBLOG(logINFO, "* nue           ="<<nueLB);
+         UBLOG(logINFO, "* velocity      ="<<uLB);
+        // UBLOG(logINFO, "* LX1 (world/LB)="<<kanallaengeSI<<"/"<<kanallaengeSI/coarseNodeDx);
+       //  UBLOG(logINFO, "* LX2 (world/LB)="<<kanalbreiteSI<<"/"<<kanalbreiteSI/coarseNodeDx);
+         UBLOG(logINFO, "* LX3 (world/LB)="<<kanalhoeheSI<<"/"<<kanalhoeheSI/coarseNodeDx);
+         UBLOG(logINFO, "* cdx           ="<<coarseNodeDx);
+         UBLOG(logINFO, "* fdx           ="<<fineNodeDx);
+         UBLOG(logINFO, "* dx_base       ="<<coarseNodeDx<<" == "<<coarseNodeDx);
+         UBLOG(logINFO, "* dx_refine     ="<<fineNodeDx<<" == "<<fineNodeDx );
+         UBLOG(logINFO, "* nx1/2/3       ="<<nx[0]<<"/"<<nx[1]<<"/"<<nx[2]);
+         UBLOG(logINFO, "* blocknx1/2/3  ="<<blocknx[0]<<"/"<<blocknx[1]<<"/"<<blocknx[2]);
+         UBLOG(logINFO, "* x2Periodic    ="<<periodicx2);
+         UBLOG(logINFO, "* x3Periodic    ="<<periodicx3);
+         UBLOG(logINFO, "*****************************************");
+         UBLOGML(logINFO, "UnitConverter:"<<unitConverter->toString());
+         UBLOG(logINFO, "*****************************************");     
+      }
+	  //////////////////////////////////////////////////////////////////////////
+	  //platte
+	  GbTriFaceMesh3DPtr mesh (GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(BrueckeFilename,"Netz"));
+
+	  double x1minMesh = mesh->getX1Minimum(); double x1maxMesh = mesh->getX1Maximum();
+	  double x2minMesh = mesh->getX2Minimum(); double x2maxMesh = mesh->getX2Maximum();
+	  double x3minMesh = mesh->getX3Minimum(); double x3maxMesh = mesh->getX3Maximum();
+
+	  double drehpunktX=x1minMesh+(x1maxMesh-x1minMesh)*0.5;//triFaceMeshS->getX1Centroid();
+	  double drehpunktZ=x3minMesh+(x3maxMesh-x3minMesh)*0.5;//triFaceMeshS->getX3Centroid();
+	  double drehpunktY=x2minMesh+(x2maxMesh-x2minMesh)*0.5;// seedX2-0.5*nodeDelta;//+nx2*deltaX2+0.5*deltaX2;
+
+	  mesh->rotate(90.0,0.0,0.0);  //TriFacMesh-KO-System anders als LB-KO-System
+
+	  x1minMesh = mesh->getX1Minimum();  x1maxMesh = mesh->getX1Maximum();
+	  x2minMesh = mesh->getX2Minimum();  x2maxMesh = mesh->getX2Maximum();
+	  x3minMesh = mesh->getX3Minimum();  x3maxMesh = mesh->getX3Maximum();
+
+	  drehpunktX=x1minMesh+(x1maxMesh-x1minMesh)*0.5;//triFaceMeshS->getX1Centroid();
+	  drehpunktZ=x3minMesh+(x3maxMesh-x3minMesh)*0.5;//triFaceMeshS->getX3Centroid();
+	  drehpunktY=x2minMesh+(x2maxMesh-x2minMesh)*0.5;// seedX2-0.5*nodeDelta;//+nx2*deltaX2+0.5*deltaX2;
+
+	  double H3=1.05/100.0;//cm, Plattendicke
+	  double scaleB=H3/(x3maxMesh-x3minMesh);
+	  double scaleX2=(geoLength[2]+2.0*coarseNodeDx)/(x2minMesh-x2maxMesh);
+
+	  mesh->scale(scaleB,scaleB,scaleB);
+	  x1minMesh = mesh->getX1Minimum(); x1maxMesh = mesh->getX1Maximum();
+	  x2minMesh = mesh->getX2Minimum(); x2maxMesh = mesh->getX2Maximum();
+	  x3minMesh = mesh->getX3Minimum(); x3maxMesh = mesh->getX3Maximum();
+	  double offsetXBridge=originBridgeX1;//originBridgeX1;
+	  double offsetYBridge=originBridgeX2;//originBridgeX2;
+	  double offsetZBridge=originBridgeX3;//originBridgeX3;//-0.5*(x3minMesh-x3maxMesh);
+	  //mesh->translate(-x1minMesh+offsetXBridge, -x2minMesh-0.5*offsetYBridge-coarseNodeDx, -x3minMesh+offsetZBridge); 
+	  mesh->translate(-x1minMesh+offsetXBridge, -x2minMesh+offsetYBridge-coarseNodeDx, -x3minMesh+offsetZBridge-(x3maxMesh-x3minMesh)*0.5); 
+
+	  x1minMesh = mesh->getX1Minimum(); x1maxMesh = mesh->getX1Maximum();
+	  x2minMesh = mesh->getX2Minimum(); x2maxMesh = mesh->getX2Maximum();
+	  x3minMesh = mesh->getX3Minimum(); x3maxMesh = mesh->getX3Maximum();
+
+	  if(myid == 0) GbSystem3D::writeGeoObject( mesh.get(), pathname+"/geo/platte", WbWriterVtkXmlBinary::getInstance() );
+
+	  //////////////////////////////////////////////////////////////////////////
+	  // Zackenband
+	  //////////////////////////////////////////////////////////////////////////
+	  GbTriFaceMesh3DPtr meshBand (GbTriFaceMesh3DCreator::readMeshFromFile(ZckbndFilename, "NetzBand"));
+	  meshBand->deleteRedundantNodes();
+
+	  double x1minMeshB = meshBand->getX1Minimum(); double x1maxMeshB = meshBand->getX1Maximum();
+	  double x2minMeshB = meshBand->getX2Minimum(); double x2maxMeshB = meshBand->getX2Maximum();
+	  double x3minMeshB = meshBand->getX3Minimum(); double x3maxMeshB = meshBand->getX3Maximum();
+
+	  x1minMeshB = meshBand->getX1Minimum();  x1maxMeshB = meshBand->getX1Maximum();
+	  x2minMeshB = meshBand->getX2Minimum();  x2maxMeshB = meshBand->getX2Maximum();
+	  x3minMeshB = meshBand->getX3Minimum();  x3maxMeshB = meshBand->getX3Maximum();
+
+	  double H1B=1.5/100.0;//0.05;//cm, Banddicke..nachschauen!!!
+	  double scaleBand=H1B/(x1maxMeshB-x1minMeshB);//H3B/(x3maxMeshB-x3minMeshB);
+
+	  meshBand->scale(scaleBand,scaleBand,scaleBand);
+	  x1minMeshB = meshBand->getX1Minimum(); x1maxMeshB = meshBand->getX1Maximum();
+	  x2minMeshB = meshBand->getX2Minimum(); x2maxMeshB = meshBand->getX2Maximum();
+	  x3minMeshB = meshBand->getX3Minimum(); x3maxMeshB = meshBand->getX3Maximum();
+	  double dBandX=0.5/100.0;//1.29; //15mm-2.1mm Absand von Bandvorderkante
+	  double dBandY=0.0/100.0;
+	  double dBandZ=0.223/100.0;//0.344;//....
+	  double offsetXBridgeB=x1minMesh+dBandX;//originBridgeX1+dBandX;//originBridgeX1;
+	  double offsetYBridgeB=originBridgeX2+dBandY;//originBridgeX2;
+	  double offsetZBridgeB=originBridgeX3+dBandZ;//originBridgeX3;//-0.5*(x3minMesh-x3maxMesh);
+	  meshBand->translate(-x1minMeshB+offsetXBridgeB, -x2minMeshB+offsetYBridgeB-coarseNodeDx, -x3minMeshB+offsetZBridgeB);//-(x3maxMeshB-x3minMeshB)*0.5); 
+
+	  x1minMeshB = meshBand->getX1Minimum(); x1maxMeshB = meshBand->getX1Maximum();
+	  x2minMeshB = meshBand->getX2Minimum(); x2maxMeshB = meshBand->getX2Maximum();
+	  x3minMeshB = meshBand->getX3Minimum(); x3maxMeshB = meshBand->getX3Maximum();
+
+	  GbSystem3D::writeGeoObject( meshBand.get(), pathname+"/geo/Band", WbWriterVtkXmlASCII::getInstance() );
+
+	  /////////////////Band2
+	  GbTriFaceMesh3DPtr meshBand2(GbTriFaceMesh3DCreator::readMeshFromFile(ZckbndFilename, "NetzBand2"));
+	  meshBand->deleteRedundantNodes();
+
+	  double x1minMeshB2 = meshBand2->getX1Minimum(); double x1maxMeshB2 = meshBand2->getX1Maximum();
+	  double x2minMeshB2 = meshBand2->getX2Minimum(); double x2maxMeshB2 = meshBand2->getX2Maximum();
+	  double x3minMeshB2 = meshBand2->getX3Minimum(); double x3maxMeshB2 = meshBand2->getX3Maximum();
+
+	  x1minMeshB2 = meshBand2->getX1Minimum();  x1maxMeshB2 = meshBand2->getX1Maximum();
+	  x2minMeshB2 = meshBand2->getX2Minimum();  x2maxMeshB2 = meshBand2->getX2Maximum();
+	  x3minMeshB2 = meshBand2->getX3Minimum();  x3maxMeshB2 = meshBand2->getX3Maximum();
+
+	  double H1B2=1.5/100.0;//0.05;//cm, Banddicke..nachschauen!!!
+	  double scaleBand2=H1B2/(x1maxMeshB2-x1minMeshB2);//H3B/(x3maxMeshB-x3minMeshB);
+
+	  meshBand2->scale(scaleBand2,scaleBand2,scaleBand2);
+	  x1minMeshB2 = meshBand2->getX1Minimum(); x1maxMeshB2 = meshBand2->getX1Maximum();
+	  x2minMeshB2 = meshBand2->getX2Minimum(); x2maxMeshB2 = meshBand2->getX2Maximum();
+	  x3minMeshB2 = meshBand2->getX3Minimum(); x3maxMeshB2 = meshBand2->getX3Maximum();
+	  double dBandX2=0.5/100.0;//1.29;
+	  double dBandY2=0.5/100.0;
+	  double dBandZ2=0.223/100.0;//0.344;//...
+	  double offsetXBridgeB2=x1minMesh+dBandX2;//originBridgeX1;
+	  double offsetYBridgeB2=originBridgeX2+dBandY2;//originBridgeX2;
+	  double offsetZBridgeB2=originBridgeX3+dBandZ2;//originBridgeX3;//-0.5*(x3minMesh-x3maxMesh);
+	  meshBand2->translate(-x1minMeshB2+offsetXBridgeB2, -x2minMeshB2+offsetYBridgeB2-coarseNodeDx, -x3minMeshB2+offsetZBridgeB2);//-(x3maxMeshB2-x3minMeshB2)*0.5); 
+
+	  x1minMeshB2 = meshBand2->getX1Minimum(); x1maxMeshB2 = meshBand2->getX1Maximum();
+	  x2minMeshB2 = meshBand2->getX2Minimum(); x2maxMeshB2 = meshBand2->getX2Maximum();
+	  x3minMeshB2 = meshBand2->getX3Minimum(); x3maxMeshB2 = meshBand2->getX3Maximum();
+
+	  if(myid == 0) GbSystem3D::writeGeoObject( meshBand2.get(), pathname+"/geo/Band2", WbWriterVtkXmlASCII::getInstance() );
+	  //////////////////////////////////////////////////////////////////////////
+      if(myid == 0) UBLOG(logINFO,"Refinement - start");	
+
+      //////////////////////////////////////////////////////////////////////////
+      // refine
+      //////////////////////////////////////////////////////////////////////////
+
+	  ///////////platte ausmessen:
+	  x1minMesh = mesh->getX1Minimum(); x1maxMesh = mesh->getX1Maximum();
+	  x2minMesh = mesh->getX2Minimum(); x2maxMesh = mesh->getX2Maximum();
+	  x3minMesh = mesh->getX3Minimum(); x3maxMesh = mesh->getX3Maximum();
+	  double deltaX3Platte=(x3maxMesh-x3minMesh);
+
+
+	 // GbObject3DPtr gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
+	 // if(myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), pathname+"/geo/gridCube", WbWriterVtkXmlASCII::getInstance());
+
+
+
+
+	  //GbCuboid3DPtr refine2PlatteCube(new GbCuboid3D(  originX1-geoOverlap   , originX2-geoOverlap  , x3minMesh-H3*0.5
+	  //  , x1maxMesh+H3*5.0, originX2+geoOverlap+geoLength[1], x3maxMesh+H3));
+	  //RefineCrossAndInsideGbObjectBlockVisitor refineAdapterP2(refine2PlatteCube, baseLevel, refineLevel-5);
+	  //grid->accept(refineAdapterP2);
+
+	  GbCuboid3DPtr refine3PlatteCube(new GbCuboid3D(   x1minMesh+H3*2.0  , originX2-geoOverlap  , x3minMesh+H3*0.8
+	     , x1maxMesh-H3*0.2, originX2+geoOverlap+geoLength[1], x3maxMesh+H3*0.1));
+	  //RefineCrossAndInsideGbObjectBlockVisitor refineAdapterP3(refine3PlatteCube, baseLevel, refineLevel-4);
+	  //grid->accept(refineAdapterP3);
+
+	  GbCuboid3DPtr refine4PlatteCube(new GbCuboid3D(   x1minMesh-H3*2.0  , originX2-geoOverlap  , x3minMesh+deltaX3Platte*0.04
+	     ,  x1maxMesh+H3*5.0, originX2+geoOverlap+geoLength[1], x3maxMesh+H3*0.25));
+	  //if(myid == 0) GbSystem3D::writeGeoObject(refine4PlatteCube.get(), pathname+"/geo/refine4PlatteCube", WbWriterVtkXmlASCII::getInstance());
+	  //RefineCrossAndInsideGbObjectBlockVisitor refineAdapterP4(refine4PlatteCube, baseLevel, refineLevel-3);
+	  //grid->accept(refineAdapterP4);
+
+	  GbCuboid3DPtr refine5PlatteCube(new GbCuboid3D(   originX1-geoOverlap , originX2-geoOverlap  ,x3minMesh-deltaX3Platte/*x3minMesh+deltaX3Platte*0.8*//* x3minMesh+deltaX3Platte*0.8*/
+	     ,  x1maxMesh+H3*5.0, originX2+geoOverlap+geoLength[1], x3maxMesh+H3));
+	  //if(myid == 0) GbSystem3D::writeGeoObject(refine5PlatteCube.get(), pathname+"/geo/refine5PlatteCube", WbWriterVtkXmlASCII::getInstance());
+	  //RefineCrossAndInsideGbObjectBlockVisitor refineAdapterP5(refine5PlatteCube, baseLevel, refineLevel-2);
+	  //grid->accept(refineAdapterP5);
+
+	  GbCuboid3DPtr refine6PlatteCube(new GbCuboid3D(   originX1-geoOverlap   , originX2-geoOverlap  , x3minMesh-deltaX3Platte*3.0/*x3minMesh+deltaX3Platte*0.9*/
+		  ,  x1maxMesh+H3*5.0, originX2+geoOverlap+geoLength[1], x3maxMesh+deltaX3Platte*3.0));
+	  if(myid == 0) GbSystem3D::writeGeoObject(refine6PlatteCube.get(), pathname+"/geo/refine6PlatteCube", WbWriterVtkXmlASCII::getInstance());
+	  //RefineCrossAndInsideGbObjectBlockVisitor refineAdapterP6(refine6PlatteCube, baseLevel, refineLevel-1);
+	  //grid->accept(refineAdapterP6);
+
+	  //GbCuboid3DPtr wallsX1X2minRef4(new GbCuboid3D(  originX1-3.0*geoOverlap   , originX2-3.0*geoOverlap  , originX1-3.0*geoOverlap
+		//  , originX1+geoLength[0]+geoOverlap, originX2+geoOverlap+geoLength[1], kanalhoeheSI*0.1));
+
+
+
+	  if (refineLevel > 0)
+	  {
+		 
+		  RefineCrossAndInsideGbObjectHelper refineHelper(grid, refineLevel);
+		  refineHelper.addGbObject( refine6PlatteCube, refineLevel-1);
+                refineHelper.addGbObject( refine5PlatteCube, refineLevel);
+                //refineHelper.addGbObject( refine4PlatteCube, refineLevel);
+		  //refineHelper.addGbObject( refine3PlatteCube, refineLevel);
+		  refineHelper.refine();
+		  if(myid == 0) UBLOG(logINFO,"Refinement - end");	
+	  }
+
+
+
+      if(myid == 0) UBLOG(logINFO,"Refinement - end");
+	  ////////////////////////////////////////////
+	  //METIS
+	  MetisPartitioningGridVisitor metisVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B);
+	  grid->accept( metisVisitor );
+	  /////////////////////////////////////////////////
+	  ///interactoren
+	  int bbOption1 = 0; //0=simple Bounce Back, 1=quadr. BB
+	  D3Q27BoundaryConditionAdapterPtr bcObst(new D3Q27NoSlipBCAdapter(bbOption1));
+
+	  D3Q27TriFaceMeshInteractorPtr triBridgeInteractor( new D3Q27TriFaceMeshInteractor(mesh, grid, bcObst,Interactor3D::SOLID));
+	  //sd.addInteractor(triBridgeInteractor);
+
+	  D3Q27TriFaceMeshInteractorPtr triBandInteractor( new D3Q27TriFaceMeshInteractor( meshBand, grid, bcObst,Interactor3D::SOLID) );
+
+	  D3Q27TriFaceMeshInteractorPtr triBand2Interactor( new D3Q27TriFaceMeshInteractor( meshBand2, grid, bcObst,Interactor3D::SOLID) );
+
+	
+	  ////////////////////////////////////////////
+	  /////delete solid blocks
+	  if(myid == 0) UBLOG(logINFO,"deleteSolidBlocks - start");
+	  SolidBlocksHelper sd(grid, comm);
+
+	  sd.addInteractor(triBridgeInteractor);
+	  sd.addInteractor(triBandInteractor);
+	  sd.addInteractor(triBand2Interactor);
+	  sd.addInteractor(densInteractor);
+	  sd.addInteractor(velBCInteractor);
+	  sd.deleteSolidBlocks();
+	  if(myid == 0) UBLOG(logINFO,"deleteSolidBlocks - end");	 
+
+
+
+	  //////////////////////////////////////
+
+     
+
+      unsigned long nob = grid->getNumberOfBlocks();
+      unsigned long nod = nob * blocknx[0]*blocknx[1]*blocknx[2];
+      unsigned long nod_real = nob * (blocknx[0]+3)*(blocknx[1]+3)*(blocknx[2]+3);
+      
+      double needMemAll  = double(nod_real*(27*sizeof(double) + sizeof(int)));
+      double needMem  = needMemAll / double(comm->getNumberOfProcesses());
+
+      if(myid == 0)
+      {
+         UBLOG(logINFO,"Number of blocks = " << nob);
+         UBLOG(logINFO,"Number of nodes  = " << nod);
+         UBLOG(logINFO,"Necessary memory  = " << needMemAll  << " bytes");
+         UBLOG(logINFO,"Necessary memory per process = " << needMem  << " bytes");
+         UBLOG(logINFO,"Available memory per process = " << availMem << " bytes");
+	  UBLOG(logINFO,"Available memory per node/8.0 = " << (availMem/8.0) << " bytes");
+      }
+	  ////////////////////////////
+	  grid->accept( metisVisitor );
+	  /////kernel
+      //LBMKernel3DPtr kernel(new LBMKernelETD3Q27CascadedTI(blocknx[0], blocknx[1], blocknx[2]));
+	LBMKernel3DPtr kernel(new LBMKernelETD3Q27CCLB(blocknx[0], blocknx[1], blocknx[2],0)); 
+//	LBMKernel3DPtr kernel(new LBMKernelETD3Q27BGK (blocknx[0], blocknx[1], blocknx[2],1));
+      BCProcessorPtr bcProc(new D3Q27ETBCProcessor());
+      kernel->setBCProcessor(bcProc);
+	 
+
+      SetKernelBlockVisitor kernelVisitor(kernel, nueLB, availMem, needMem);
+	  
+      grid->accept(kernelVisitor);
+	  //////////////////////////////////
+	  //undef nodes
+	  if (refineLevel > 0)
+	  {
+		  D3Q27SetUndefinedNodesBlockVisitor undefNodesVisitor;
+		  grid->accept(undefNodesVisitor);
+	  }
+	  //////////////////////////////////////////
+	  grid->addAndInitInteractor(triBridgeInteractor);
+	  grid->addAndInitInteractor(triBandInteractor);
+	  grid->addAndInitInteractor(triBand2Interactor);
+	  grid->addAndInitInteractor( densInteractor ); 
+	  grid->addAndInitInteractor( velBCInteractor );
+
+	    UbTimer timer;
+   timer.start();
+ 
+   grid->accept( metisVisitor );
+
+   if(myid == 0) UBLOG(logINFO,"Write blocks - start");
+   BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname + "/grid/blocks", WbWriterVtkXmlBinary::getInstance(), comm));
+   if(myid == 0) ppblocks->update(0);
+   if(myid == 0) UBLOG(logINFO,"Write blocks - end");
+
+	      
+
+   if(myid == 0) UBLOG(logINFO,"Write blocks - start");
+   grid->accept( metisVisitor );
+   if(myid == 0) ppblocks->update(1);
+   ppblocks.reset();
+   if(myid == 0) UBLOG(logINFO,"Write blocks - end");
+  
+
+
+      //set connectors
+      D3Q27InterpolationProcessorPtr iProcessor(new D3Q27OffsetInterpolationProcessor());
+      D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
+      grid->accept( setConnsVisitor );
+
+      //domain decomposition
+      //PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
+      //grid->accept(pqPartVisitor);
+
+      //initialization of decompositions
+      D3Q27ETInitDistributionsBlockVisitor initVisitor(1.0);
+      initVisitor.setVx1(inflowProfile);
+      grid->accept(initVisitor);
+
+      //Postprozess
+	
+      
+      UbSchedulerPtr geoSch(new UbScheduler(1));
+      D3Q27MacroscopicQuantitiesPostprocessorPtr ppgeo(
+           new D3Q27MacroscopicQuantitiesPostprocessor(grid, geoSch, pathname + "/grid/nodes", WbWriterVtkXmlBinary::getInstance(), 
+                                                       unitConverter, comm, true));
+	  									
+
+      grid->doPostProcess(0);
+      ppgeo.reset();
+      geoSch.reset();
+
+      if(myid == 0) UBLOG(logINFO,"Preprozess - end");      
+
+}
+      
+
+
+      UbSchedulerPtr visSch(new UbScheduler());
+visSch->addSchedule(1,1,3);
+      visSch->addSchedule(100,100,1000);
+ //     visSch->addSchedule(1000,1000,100000);
+ //     visSch->addSchedule(100000,100000,1000000);
+	//  //TurbulenceIntensityPostprocessor tipp(grid,  pathname + "/steps/stepTI", WbWriterVtkXmlBinary::getInstance(), visSch, comm);
+	  UbSchedulerPtr resSch(new UbScheduler());
+      resSch->addSchedule(0,20,1000);
+	  AverageValuesPostprocessor       Avpp(grid,  pathname + "/steps/stepAV", WbWriterVtkXmlBinary::getInstance(), visSch/*wann wird rausgeschrieben*/,resSch/*wann wird resettet*/,comm);
+      D3Q27MacroscopicQuantitiesPostprocessor pp(grid, visSch, pathname + "/steps/step", WbWriterVtkXmlBinary::getInstance(), unitConverter, comm);// unitConverter, comm);
+
+      UbSchedulerPtr nupsSch(new UbScheduler(10, 10, 100));
+      NUPSCounterPostprocessor npr(grid, nupsSch, pathname + "/results/nups.txt", comm);
+
+	  //}
+	  mu::Parser decrViscFunc;
+      decrViscFunc.SetExpr("nue0+c0/(t+1)/(t+1)");
+      decrViscFunc.DefineConst("nue0", nueLB);
+	  decrViscFunc.DefineConst("c0", 0.1);
+	  UbSchedulerPtr DecrViscSch(new UbScheduler());
+      DecrViscSch->addSchedule(10,10,1000);
+	  DecreaseViscosityPostprocessor decrViscPPPtr(grid, DecrViscSch,&decrViscFunc, comm);
+
+      cout << "PID = " << myid << " Total Physical Memory (RAM): " << MemoryUtil::getTotalPhysMem()<<endl;
+      cout << "PID = " << myid << " Physical Memory currently used: " << MemoryUtil::getPhysMemUsed()<<endl;
+      cout << "PID = " << myid << " Physical Memory currently used by current process: " << MemoryUtil::getPhysMemUsedByMe()<<endl;
+
+      double endTime = 200001;
+      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, visSch));
+      if(myid == 0) UBLOG(logINFO,"Simulation-start");
+      calculation->calculate();
+      if(myid == 0) UBLOG(logINFO,"Simulation-end");
+   }
+   catch(std::exception& e)
+   {
+      cerr << e.what() << endl << flush;
+   }
+   catch(std::string& s)
+   {
+      cerr << s << endl;
+   }
+   catch(...)
+   {
+      cerr << "unknown exception" << endl;
+   }
+
+}
+int main(int argc, char* argv[])
+{
+
+   run(argv[1]);
+
+   return 0;
+}
+
diff --git a/apps/cpu/plate/plate.old b/apps/cpu/plate/plate.old
index f3d3be2d1db3823e4776da6bfcd410a11d8b9d95..4d7b2e06e1931eacdf860937e1db15fc33b2de6a 100644
--- a/apps/cpu/plate/plate.old
+++ b/apps/cpu/plate/plate.old
@@ -1,615 +1,615 @@
-#include <iostream>
-#include <string>
-
-#include "numerics/geometry3d/CoordinateTransformation3D.h"
-#include "Grid3D.h"
-#include "GenBlocksGridVisitor.h"
-#include "numerics/geometry3d/GbSystem3D.h"
-#include "numerics/geometry3d/GbCuboid3D.h"
-#include "numerics/geometry3d/GbCylinder3D.h"
-#include <numerics/geometry3d/GbSphere3D.h>
-#include "basics/writer/WbWriterVtkXmlASCII.h"
-#include "basics/writer/WbWriterVtkXmlBinary.h"
-#include "RefineCrossAndInsideGbObjectBlockVisitor.h"
-#include "RatioBlockVisitor.h"
-#include "RatioSmoothBlockVisitor.h"
-#include "OverlapBlockVisitor.h"
-#include "RefineInterGbObjectsVisitor.h"
-#include "RefineCrossAndInsideGbObjectBlockVisitor.h"
-#include "SetKernelBlockVisitor.h"
-#include "LBMKernelETD3Q27Cascaded.h"
-#include "D3Q27MacroscopicQuantitiesPostprocessor.h"
-#include "MPICommunicator.h"
-#include "D3Q27ETBCProcessor.h"
-#include "SimulationParameters.h"
-#include "D3Q27SetUndefinedNodesBlockVisitor.h"
-#include "SetInterpolationDirsBlockVisitor.h"
-#include "D3Q27SetConnectorsBlockVisitor.h"
-#include "NullCommunicator.h"
-#include "D3Q27ETInitDistributionsBlockVisitor.h"
-#include "CalculationManager.h"
-#include "PQueuePartitioningGridVisitor.h"
-#include "MetisPartitioningGridVisitor.h"
-#include "D3Q27Interactor.h"
-#include "D3Q27NoSlipBCAdapter.h"
-#include "D3Q27VelocityBCAdapter.h"
-#include "D3Q27DensityBCAdapter.h"
-#include "D3Q27BoundaryConditionAdapter.h"
-#include "StringUtil.hpp"
-#include "D3Q27OffsetInterpolationProcessor.h"
-#include "D3Q27CompactInterpolationProcessor.h"
-#include "SyncBcBlockVisitor.h"
-#include "numerics/geometry3d/creator/GbTriFaceMesh3DCreator.h"
-#include "numerics/geometry3d/GbTriFaceMesh3D.h"
-#include "D3Q27TriFaceMeshInteractor.h"
-#include "MathUtil.hpp"
-#include "SolidBlocksHelper.h"
-#include "LBMKernelETD3Q27CascadedTI.h"
-#include "TurbulenceIntensityPostprocessor.h"
-#include "RestartPostprocessor.h"
-#include "BlocksPostprocessor.h"
-#include "NUPSCounterPostprocessor.h"
-
-using namespace std;
-
-
-void run(const char *cstr)
-{
-   try
-   {
-      string machine = QUOTEME(CAB_MACHINE);
-      string BrueckeFilename;
-      string ZckbndFilename;
-      string pathname; 
-      string pathGeo;
-      int numOfThreads =1;
-      bool logfile = false;
-      double availMem = 0;
-
-      CommunicatorPtr comm(new MPICommunicator());
-      int myid = comm->getProcessID();
-      
-      if(machine == "BOMBADIL") 
-      {
-         pathname = "c:/temp/plate";
-         pathGeo = "c:/Data/plate";
-         numOfThreads = 1;
-         logfile = false;
-         availMem = 3.0e9;
-      }
-      else if(machine == "M01" || machine == "M02")      
-      {
-         pathname = "/work/koskuche/scratch/plate";
-         pathGeo = "/home/koskuche/data/plate";
-         numOfThreads = 8;
-         availMem = 12.0e9;
-
-         if(myid ==0)
-         {
-            stringstream logFilename;
-            logFilename <<  pathname + "/logfile"+UbSystem::toString(UbSystem::getTimeStamp())+".txt";
-            UbLog::output_policy::setStream(logFilename.str());
-         }
-      }
-      else throw UbException(UB_EXARGS, "unknown CAB_MACHINE");
-
-      BrueckeFilename = pathGeo + "/platte_raw.stl"; 
-      ZckbndFilename= pathGeo + "/2zackenbaender0.stl";
-      
-
-
-      if(myid ==0 && logfile)
-      {
-         stringstream logFilename;
-         logFilename <<  pathname + "/logfile.log";
-         UbLog::output_policy::setStream(logFilename.str());
-      }
-
-      int baseLevel, refineLevel,nx[3],blocknx[3];
-      double Re,velocity,rhoInit,vx1Init;//,vx2Init,vx3Init;
-
-      //////////////////////////////////////////////////////////////////////////
-      //physik
-      //////////////////////////////////////////////////////////////////////////
-      Re            = 11900;// 13286;//13286;//gemessen 18.98 m/s...*5.0 zum  testen ob was passiert
-      velocity      = 0.01;  
-      vx1Init       = 0.01;  
-      rhoInit       = 1.0;
-      SimulationParametersPtr param = SimulationParameters::getInstanz();
-      param->setCollisionModelType(SimulationParameters::COMPRESSIBLE);
-
-      ///////////////Knotenabmessungen:
-      //int KnotenCubeCoarse=40;
-      nx[0]      = 120;//60;//86;//43;//65;//50;  //länge
-      nx[1]      = 1;//6;///1;//5;// //breite
-      nx[2]      = 32;//18;//5;//15;//15; //höhe gebiet
-      blocknx[0] = 15;
-      blocknx[1] = 15;
-      blocknx[2] = 15;
-
-      baseLevel   = 0;
-      refineLevel = 4;
-
-      int inflowCubeLevel = 1;
-      int bottomLevel     = 1;
-
-      ///////////////Weltabmessungen:
-      double kanalhoeheSI  = 60.0/100.0;//60.0/100.0;//cm, Kanalhöhe
-      double kanalbreiteSI = 9.9/100.0;//1.65/100.0;//13.2/100.0;////40.0/100.0; //cm, Kanalbreite //13.2 zeilbreite
-      double kanallaengeSI = kanalhoeheSI*30.0/18.0;//80.0/100.0;//cm, Kanallänge, ist nicht angegeben
-
-      // double refinewidth1=kanalhoeheSI/10.0;
-
-      double fineNodeDx   = (kanalhoeheSI) / (double)( blocknx[2]*nx[2]*(1<<refineLevel)+1 ); //+1--> gitter liegt jeweils 0.5dx innerhalb
-      double coarseNodeDx = fineNodeDx * (double)(1<<refineLevel);//geowerte
-
-      double blockLengthx1 = blocknx[0]*coarseNodeDx; //geowerte
-      double blockLengthx2 = blockLengthx1;
-      double blockLengthx3 = blockLengthx1;
-
-      double originX1 = 0.0;//-50.0*propellerDurchmesser;  //geowerte
-      double originX2 = 0.0;//-0.5*blockLengthx2*nx2;
-      double originX3 = 0.0;// minX3 + 0.5*fineNodeDx;
-
-      double geoLength[]   = {  nx[0]*blockLengthx1, nx[1]*blockLengthx2, nx[2]*blockLengthx3}; 
-
-      //position vorderkante cube
-      double originBridgeX1 = 20.0/100.0; //cm, geraten
-      double originBridgeX2 = 0.0;//0.5*params.nx[1]*blockLengthx2-0.5*H-fineNodeDx;
-      double originBridgeX3 = kanalhoeheSI*0.5;//H*0.0-fineNodeDx; //boden
-
-      bool periodicx1 = false;
-      bool periodicx2 = true;
-      bool periodicx3 = true;
-
-      //##########################################################################
-      //## physical parameters
-      //##########################################################################
-      double smagorinskiConstant = 0.18;
-
-
-      double rhoLB         = 1.0;
-      double rhoReal       = 1.0;
-      double nueReal  = 0.000015;//0.015;
-
-      double hReal         = 0.0105;//<-m     1.05;//Plattendicke in cm(! cm nicht m !)
-      double uReal         = Re*nueReal/hReal;
-
-      //##Machzahl:
-      //#Ma     = uReal/csReal
-      double Ma      = 0.05;//0.0553;//Ma-Real!
-      double csReal  = uReal/Ma;
-      double hLB     = hReal/coarseNodeDx;
-
-      LBMUnitConverter unitConverter(hReal, csReal, rhoReal, hLB);
-
-      double uLB           = uReal   * unitConverter.getFactorVelocityWToLb();
-      double nueLB         = nueReal * unitConverter.getFactorViscosityWToLb();
-
-      velocity = uLB;
-      double viscosity = nueLB;
-
-      Grid3DPtr grid(new Grid3D());
-      UbSchedulerPtr rSch(new UbScheduler(5000,5000,1000000));
-      RestartPostprocessor rp(grid, rSch, comm, pathname+"/checkpoints", RestartPostprocessor::BINARY);
-
-      //////////////////////////////////////////////////////////////////////////
-
-      std::string opt;
-
-      if(cstr!= NULL)
-         opt = std::string(cstr);
-
-      if(/*(cstr== NULL)*/cstr!= NULL)
-      {
-         opt = std::string(cstr);
-
-         if(myid==0) UBLOG(logINFO,"Restart step: " << opt);
-
-         grid = rp.restart(UbSystem::stringTo<int>(opt));
-
-         //set connectors
-         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27OffsetInterpolationProcessor());
-         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
-         grid->accept( setConnsVisitor );
-
-         //domain decomposition
-         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
-         grid->accept(pqPartVisitor);
-      }
-      else
-      {
-      //bounding box
-      double g_minX1 = originX1;
-      double g_minX2 = originX2;
-      double g_minX3 = originX3;
-
-      double g_maxX1 = originX1 + geoLength[0];
-      double g_maxX2 = originX2 + geoLength[1];
-      double g_maxX3 = originX3 + geoLength[2];
-
-      //set grid
-      grid->setDeltaX(coarseNodeDx);
-      grid->setBlockNX(blocknx[0], blocknx[1], blocknx[2]);
-      grid->setPeriodicX1(periodicx1);
-      grid->setPeriodicX2(periodicx2);
-      grid->setPeriodicX3(periodicx3);
-
-      
-      GbObject3DPtr gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
-      if(myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), pathname+"/geo/gridCube", WbWriterVtkXmlASCII::getInstance());
-
-      GenBlocksGridVisitor genBlocks;
-      genBlocks.addGeoObject(gridCube);
-      grid->accept(genBlocks);
-
-      //////////////////////////////////////////////////////////////////////////
-      //platte
-      GbTriFaceMesh3DPtr mesh (GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(BrueckeFilename,"Netz"));
-
-      double x1minMesh = mesh->getX1Minimum(); double x1maxMesh = mesh->getX1Maximum();
-      double x2minMesh = mesh->getX2Minimum(); double x2maxMesh = mesh->getX2Maximum();
-      double x3minMesh = mesh->getX3Minimum(); double x3maxMesh = mesh->getX3Maximum();
-
-      double drehpunktX=x1minMesh+(x1maxMesh-x1minMesh)*0.5;//triFaceMeshS->getX1Centroid();
-      double drehpunktZ=x3minMesh+(x3maxMesh-x3minMesh)*0.5;//triFaceMeshS->getX3Centroid();
-      double drehpunktY=x2minMesh+(x2maxMesh-x2minMesh)*0.5;// seedX2-0.5*nodeDelta;//+nx2*deltaX2+0.5*deltaX2;
-
-      mesh->rotate(90.0,0.0,0.0);  //TriFacMesh-KO-System anders als LB-KO-System
-
-      x1minMesh = mesh->getX1Minimum();  x1maxMesh = mesh->getX1Maximum();
-      x2minMesh = mesh->getX2Minimum();  x2maxMesh = mesh->getX2Maximum();
-      x3minMesh = mesh->getX3Minimum();  x3maxMesh = mesh->getX3Maximum();
-
-      drehpunktX=x1minMesh+(x1maxMesh-x1minMesh)*0.5;//triFaceMeshS->getX1Centroid();
-      drehpunktZ=x3minMesh+(x3maxMesh-x3minMesh)*0.5;//triFaceMeshS->getX3Centroid();
-      drehpunktY=x2minMesh+(x2maxMesh-x2minMesh)*0.5;// seedX2-0.5*nodeDelta;//+nx2*deltaX2+0.5*deltaX2;
-
-      double H3=1.05/100.0;//cm, Plattendicke
-      double scaleB=H3/(x3maxMesh-x3minMesh);
-      double scaleX2=(geoLength[2]+2.0*coarseNodeDx)/(x2minMesh-x2maxMesh);
-
-      mesh->scale(scaleB,scaleB,scaleB);
-      x1minMesh = mesh->getX1Minimum(); x1maxMesh = mesh->getX1Maximum();
-      x2minMesh = mesh->getX2Minimum(); x2maxMesh = mesh->getX2Maximum();
-      x3minMesh = mesh->getX3Minimum(); x3maxMesh = mesh->getX3Maximum();
-      double offsetXBridge=originBridgeX1;//originBridgeX1;
-      double offsetYBridge=originBridgeX2;//originBridgeX2;
-      double offsetZBridge=originBridgeX3;//originBridgeX3;//-0.5*(x3minMesh-x3maxMesh);
-      //mesh->translate(-x1minMesh+offsetXBridge, -x2minMesh-0.5*offsetYBridge-coarseNodeDx, -x3minMesh+offsetZBridge); 
-      mesh->translate(-x1minMesh+offsetXBridge, -x2minMesh+offsetYBridge-coarseNodeDx, -x3minMesh+offsetZBridge-(x3maxMesh-x3minMesh)*0.5); 
-
-      x1minMesh = mesh->getX1Minimum(); x1maxMesh = mesh->getX1Maximum();
-      x2minMesh = mesh->getX2Minimum(); x2maxMesh = mesh->getX2Maximum();
-      x3minMesh = mesh->getX3Minimum(); x3maxMesh = mesh->getX3Maximum();
-
-      if(myid == 0) GbSystem3D::writeGeoObject( mesh.get(), pathname+"/geo/platte", WbWriterVtkXmlBinary::getInstance() );
-
-      //////////////////////////////////////////////////////////////////////////
-      // Zackenband
-      //////////////////////////////////////////////////////////////////////////
-      GbTriFaceMesh3DPtr meshBand (GbTriFaceMesh3DCreator::readMeshFromFile(ZckbndFilename, "NetzBand"));
-      meshBand->deleteRedundantNodes();
-
-      double x1minMeshB = meshBand->getX1Minimum(); double x1maxMeshB = meshBand->getX1Maximum();
-      double x2minMeshB = meshBand->getX2Minimum(); double x2maxMeshB = meshBand->getX2Maximum();
-      double x3minMeshB = meshBand->getX3Minimum(); double x3maxMeshB = meshBand->getX3Maximum();
-
-      x1minMeshB = meshBand->getX1Minimum();  x1maxMeshB = meshBand->getX1Maximum();
-      x2minMeshB = meshBand->getX2Minimum();  x2maxMeshB = meshBand->getX2Maximum();
-      x3minMeshB = meshBand->getX3Minimum();  x3maxMeshB = meshBand->getX3Maximum();
-
-      double H1B=1.5/100.0;//0.05;//cm, Banddicke..nachschauen!!!
-      double scaleBand=H1B/(x1maxMeshB-x1minMeshB);//H3B/(x3maxMeshB-x3minMeshB);
-
-      meshBand->scale(scaleBand,scaleBand,scaleBand);
-      x1minMeshB = meshBand->getX1Minimum(); x1maxMeshB = meshBand->getX1Maximum();
-      x2minMeshB = meshBand->getX2Minimum(); x2maxMeshB = meshBand->getX2Maximum();
-      x3minMeshB = meshBand->getX3Minimum(); x3maxMeshB = meshBand->getX3Maximum();
-      double dBandX=0.5/100.0;//1.29; //15mm-2.1mm Absand von Bandvorderkante
-      double dBandY=0.0/100.0;
-      double dBandZ=0.223/100.0;//0.344;//....
-      double offsetXBridgeB=x1minMesh+dBandX;//originBridgeX1+dBandX;//originBridgeX1;
-      double offsetYBridgeB=originBridgeX2+dBandY;//originBridgeX2;
-      double offsetZBridgeB=originBridgeX3+dBandZ;//originBridgeX3;//-0.5*(x3minMesh-x3maxMesh);
-      meshBand->translate(-x1minMeshB+offsetXBridgeB, -x2minMeshB+offsetYBridgeB-coarseNodeDx, -x3minMeshB+offsetZBridgeB);//-(x3maxMeshB-x3minMeshB)*0.5); 
-
-      x1minMeshB = meshBand->getX1Minimum(); x1maxMeshB = meshBand->getX1Maximum();
-      x2minMeshB = meshBand->getX2Minimum(); x2maxMeshB = meshBand->getX2Maximum();
-      x3minMeshB = meshBand->getX3Minimum(); x3maxMeshB = meshBand->getX3Maximum();
-
-      GbSystem3D::writeGeoObject( meshBand.get(), pathname+"/geo/Band", WbWriterVtkXmlASCII::getInstance() );
-
-      /////////////////Band2
-      GbTriFaceMesh3DPtr meshBand2(GbTriFaceMesh3DCreator::readMeshFromFile(ZckbndFilename, "NetzBand2"));
-      meshBand->deleteRedundantNodes();
-
-      double x1minMeshB2 = meshBand2->getX1Minimum(); double x1maxMeshB2 = meshBand2->getX1Maximum();
-      double x2minMeshB2 = meshBand2->getX2Minimum(); double x2maxMeshB2 = meshBand2->getX2Maximum();
-      double x3minMeshB2 = meshBand2->getX3Minimum(); double x3maxMeshB2 = meshBand2->getX3Maximum();
-
-      x1minMeshB2 = meshBand2->getX1Minimum();  x1maxMeshB2 = meshBand2->getX1Maximum();
-      x2minMeshB2 = meshBand2->getX2Minimum();  x2maxMeshB2 = meshBand2->getX2Maximum();
-      x3minMeshB2 = meshBand2->getX3Minimum();  x3maxMeshB2 = meshBand2->getX3Maximum();
-
-      double H1B2=1.5/100.0;//0.05;//cm, Banddicke..nachschauen!!!
-      double scaleBand2=H1B2/(x1maxMeshB2-x1minMeshB2);//H3B/(x3maxMeshB-x3minMeshB);
-
-      meshBand2->scale(scaleBand2,scaleBand2,scaleBand2);
-      x1minMeshB2 = meshBand2->getX1Minimum(); x1maxMeshB2 = meshBand2->getX1Maximum();
-      x2minMeshB2 = meshBand2->getX2Minimum(); x2maxMeshB2 = meshBand2->getX2Maximum();
-      x3minMeshB2 = meshBand2->getX3Minimum(); x3maxMeshB2 = meshBand2->getX3Maximum();
-      double dBandX2=0.5/100.0;//1.29;
-      double dBandY2=0.5/100.0;
-      double dBandZ2=0.223/100.0;//0.344;//...
-      double offsetXBridgeB2=x1minMesh+dBandX2;//originBridgeX1;
-      double offsetYBridgeB2=originBridgeX2+dBandY2;//originBridgeX2;
-      double offsetZBridgeB2=originBridgeX3+dBandZ2;//originBridgeX3;//-0.5*(x3minMesh-x3maxMesh);
-      meshBand2->translate(-x1minMeshB2+offsetXBridgeB2, -x2minMeshB2+offsetYBridgeB2-coarseNodeDx, -x3minMeshB2+offsetZBridgeB2);//-(x3maxMeshB2-x3minMeshB2)*0.5); 
-
-      x1minMeshB2 = meshBand2->getX1Minimum(); x1maxMeshB2 = meshBand2->getX1Maximum();
-      x2minMeshB2 = meshBand2->getX2Minimum(); x2maxMeshB2 = meshBand2->getX2Maximum();
-      x3minMeshB2 = meshBand2->getX3Minimum(); x3maxMeshB2 = meshBand2->getX3Maximum();
-
-      if(myid == 0) GbSystem3D::writeGeoObject( meshBand2.get(), pathname+"/geo/Band2", WbWriterVtkXmlASCII::getInstance() );
-      //////////////////////////////////////////////////////////////////////////
-      if(myid == 0) 
-      {
-         UBLOG(logINFO, "*****************************************");
-         UBLOG(logINFO, "* Parameters                            *");
-         UBLOG(logINFO, "* Re            ="<<Re);
-         UBLOG(logINFO, "* Ma            ="<<Ma);
-         UBLOG(logINFO, "* uReal         ="<<uReal);
-         UBLOG(logINFO, "* nueReal       ="<<nueReal);
-         UBLOG(logINFO, "* nue           ="<<nueLB);
-         UBLOG(logINFO, "* velocity      ="<<uLB);
-         UBLOG(logINFO, "* LX1 (world/LB)="<<kanallaengeSI<<"/"<<kanallaengeSI/coarseNodeDx);
-         UBLOG(logINFO, "* LX2 (world/LB)="<<kanalbreiteSI<<"/"<<kanalbreiteSI/coarseNodeDx);
-         UBLOG(logINFO, "* LX3 (world/LB)="<<kanalhoeheSI<<"/"<<kanalhoeheSI/coarseNodeDx);
-         //UBLOG(logINFO, "* dxInflow-Cube ="<<velBCCuboid->getX1Maximum()-mesh->getX1Minimum());
-         UBLOG(logINFO, "* cdx           ="<<coarseNodeDx);
-         UBLOG(logINFO, "* fdx           ="<<fineNodeDx);
-         //UBLOG(logINFO, "* inflowProfile ="<<inflowProfile.GetExpr());
-         UBLOG(logINFO, "* dx_base       ="<<coarseNodeDx<<" == "<<coarseNodeDx);
-         UBLOG(logINFO, "* dx_refine     ="<<fineNodeDx<<" == "<<fineNodeDx );
-         //UBLOG(logINFO, "* raiseVelSteps ="<<raiseVelSteps);
-         UBLOG(logINFO, "* nx1/2/3       ="<<nx[0]<<"/"<<nx[1]<<"/"<<nx[2]);
-         UBLOG(logINFO, "* blocknx1/2/3  ="<<blocknx[0]<<"/"<<blocknx[1]<<"/"<<blocknx[2]);
-         UBLOG(logINFO, "* x2Periodic    ="<<periodicx2);
-         UBLOG(logINFO, "* x3Periodic    ="<<periodicx3);
-         UBLOG(logINFO, "*****************************************");
-         UBLOGML(logINFO, "UnitConverter:"<<unitConverter.toString());
-         UBLOG(logINFO, "*****************************************");     
-      }
-      if(myid == 0) UBLOG(logINFO,"Refinement - start");	
-      double geoOverlap = 3.0*coarseNodeDx;
-      //////////////////////////////////////////////////////////////////////////
-      // refine
-      //////////////////////////////////////////////////////////////////////////
-      ///////////platte ausmessen:
-      x1minMesh = mesh->getX1Minimum(); x1maxMesh = mesh->getX1Maximum();
-      x2minMesh = mesh->getX2Minimum(); x2maxMesh = mesh->getX2Maximum();
-      x3minMesh = mesh->getX3Minimum(); x3maxMesh = mesh->getX3Maximum();
-      double deltaX3Platte=(x3maxMesh-x3minMesh);
-
-
-      //GbCuboid3DPtr refine1PlatteCube(new GbCuboid3D(  originX1-geoOverlap   , originX2-geoOverlap  , x3minMesh-H3
-      //   , x1maxMesh+H3*5.0, originX2+geoOverlap+geoLength[1], x3maxMesh+H3));
-      //RefineCrossAndInsideGbObjectBlockVisitor refineAdapterP1(refine1PlatteCube, baseLevel, refineLevel-6);
-      //grid->accept(refineAdapterP1);
-
-      // GbCuboid3DPtr refine2PlatteCube(new GbCuboid3D(  originX1-geoOverlap   , originX2-geoOverlap  , x3minMesh-H3*0.5
-        // , x1maxMesh+H3*5.0, originX2+geoOverlap+geoLength[1], x3maxMesh+H3));
-      // RefineCrossAndInsideGbObjectBlockVisitor refineAdapterP2(refine2PlatteCube, baseLevel, refineLevel-5);
-      // grid->accept(refineAdapterP2);
-
-      GbCuboid3DPtr refine3PlatteCube(new GbCuboid3D(  originX1-geoOverlap  , originX2-geoOverlap  , x3minMesh-H3*0.5
-         , x1maxMesh+H3*5.0, originX2+geoOverlap+geoLength[1], x3maxMesh+H3*0.5));
-      RefineCrossAndInsideGbObjectBlockVisitor refineAdapterP3(refine3PlatteCube, baseLevel, refineLevel-4);
-      grid->accept(refineAdapterP3);
-
-      GbCuboid3DPtr refine4PlatteCube(new GbCuboid3D(   originX1-geoOverlap  , originX2-geoOverlap  , x3minMesh+deltaX3Platte*0.0
-         ,  x1maxMesh+H3*5.0, originX2+geoOverlap+geoLength[1], x3maxMesh+H3*0.25));
-      if(myid == 0) GbSystem3D::writeGeoObject(refine4PlatteCube.get(), pathname+"/geo/refine4PlatteCube", WbWriterVtkXmlASCII::getInstance());
-      RefineCrossAndInsideGbObjectBlockVisitor refineAdapterP4(refine4PlatteCube, baseLevel, refineLevel-3);
-      grid->accept(refineAdapterP4);
-
-      GbCuboid3DPtr refine5PlatteCube(new GbCuboid3D(   originX1-geoOverlap , originX2-geoOverlap  ,x3minMesh+deltaX3Platte*0.1/* x3minMesh+deltaX3Platte*0.8*/
-         ,  x1maxMesh+H3*5.0, originX2+geoOverlap+geoLength[1], x3maxMesh+H3*0.00375));
-      if(myid == 0) GbSystem3D::writeGeoObject(refine5PlatteCube.get(), pathname+"/geo/refine5PlatteCube", WbWriterVtkXmlASCII::getInstance());
-      RefineCrossAndInsideGbObjectBlockVisitor refineAdapterP5(refine5PlatteCube, baseLevel, refineLevel-2);
-      grid->accept(refineAdapterP5);
-
-      GbCuboid3DPtr refine6PlatteCube(new GbCuboid3D(   originX1-geoOverlap   , originX2-geoOverlap  , x3minMesh-deltaX3Platte*0.1/*x3minMesh+deltaX3Platte*0.9*/
-         ,  x1maxMesh+H3*5.0, originX2+geoOverlap+geoLength[1], x3maxMesh+deltaX3Platte*0.9));
-      if(myid == 0) GbSystem3D::writeGeoObject(refine6PlatteCube.get(), pathname+"/geo/refine6PlatteCube", WbWriterVtkXmlASCII::getInstance());
-      RefineCrossAndInsideGbObjectBlockVisitor refineAdapterP6(refine6PlatteCube, baseLevel, refineLevel-1);
-      grid->accept(refineAdapterP6);
-
-      //GbCuboid3DPtr refine7PlatteCube(new GbCuboid3D(originX1-geoOverlap   , originX2-geoOverlap  , x3minMesh-deltaX3Platte*0.3, 
-      //                                               meshBand->getX1Maximum()+meshBand->getLengthX1()*3.0, originX2+geoOverlap+geoLength[1], x3maxMesh));
-      //if(myid == 0) GbSystem3D::writeGeoObject(refine7PlatteCube.get(), pathname+"/geo/refine7PlatteCube", WbWriterVtkXmlASCII::getInstance());
-      //RefineCrossAndInsideGbObjectBlockVisitor refineAdapterP7(refine7PlatteCube, baseLevel, refineLevel-1);
-      //grid->accept(refineAdapterP7);
-
-      RatioBlockVisitor ratioVisitor(refineLevel);
-      grid->accept(ratioVisitor);
-      RatioSmoothBlockVisitor ratioSmoothVisitor(refineLevel);
-      grid->accept(ratioSmoothVisitor);
-      OverlapBlockVisitor overlapVisitor(refineLevel);
-      grid->accept(overlapVisitor);
-      std::vector<int> dirs;
-      D3Q27System::getLBMDirections(dirs);
-      SetInterpolationDirsBlockVisitor interDirsVisitor(dirs);
-      grid->accept(interDirsVisitor);
-
-      if(myid == 0) UBLOG(logINFO,"Refinement - end");
-
-      if(myid == 0) UBLOG(logINFO,"Write blocks - start");
-      BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname + "/grid/blocks", WbWriterVtkXmlBinary::getInstance(), comm));
-      if(myid == 0) ppblocks->update(0);
-      //ppblocks.reset();
-      if(myid == 0) UBLOG(logINFO,"Write blocks - end");
-      
-      MetisPartitioningGridVisitor metisVisitor(numOfThreads, D3Q27System::B, comm, false);
-      grid->accept( metisVisitor );
-
-      if(myid == 0) UBLOG(logINFO,"deleteSolidBlocks - start");
-      SolidBlocksHelper sd(grid, comm);
-
-      //iteractors
-      int bbOption1 = 0; //0=simple Bounce Back, 1=quadr. BB
-      D3Q27BoundaryConditionAdapterPtr bcObst(new D3Q27NoSlipBCAdapter(bbOption1));
-
-      D3Q27TriFaceMeshInteractorPtr triBridgeInteractor( new D3Q27TriFaceMeshInteractor(mesh, grid, bcObst,Interactor3D::SOLID));
-      sd.addInteractor(triBridgeInteractor);
-
-      D3Q27TriFaceMeshInteractorPtr triBandInteractor( new D3Q27TriFaceMeshInteractor( meshBand, grid, bcObst,Interactor3D::SOLID) );
-
-      D3Q27TriFaceMeshInteractorPtr triBand2Interactor( new D3Q27TriFaceMeshInteractor( meshBand2, grid, bcObst,Interactor3D::SOLID) );
-
-      sd.deleteSolidBlocks();
-      if(myid == 0) UBLOG(logINFO,"deleteSolidBlocks - end");	      
-      
-      if(myid == 0) UBLOG(logINFO,"Write blocks - start");
-      grid->accept( metisVisitor );
-      //BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname + "/grid/blocks", WbWriterVtkXmlBinary::getInstance(), comm));
-      if(myid == 0) ppblocks->update(0);
-      ppblocks.reset();
-      if(myid == 0) UBLOG(logINFO,"Write blocks - end");
-
-      unsigned long nob = grid->getNumberOfBlocks();
-      unsigned long nod = nob * blocknx[0]*blocknx[1]*blocknx[2];
-      
-      double needMemAll  = double(nod*(27*sizeof(double) + sizeof(int))*2);
-      double needMem  = needMemAll / double(comm->getNumberOfProcesses());
-
-      if(myid == 0)
-      {
-         UBLOG(logINFO,"Number of blocks = " << nob);
-         UBLOG(logINFO,"Number of nodes  = " << nod);
-         UBLOG(logINFO,"Necessary memory  = " << needMemAll  << " bytes");
-         UBLOG(logINFO,"Necessary memory per process = " << needMem  << " bytes");
-         UBLOG(logINFO,"Available memory per process = " << availMem << " bytes");
-      }
-
-      LBMKernel3DPtr kernel(new LBMKernelETD3Q27Cascaded(blocknx[0], blocknx[1], blocknx[2]));
-      BCProcessorPtr bcProc(new D3Q27ETBCProcessor());
-      kernel->setBCProcessor(bcProc);
-
-      SetKernelBlockVisitor kernelVisitor(kernel, nueLB, availMem, needMem);
-      grid->accept(kernelVisitor);
-
-      if (refineLevel > 0)
-      {
-         D3Q27SetUndefinedNodesBlockVisitor undefNodesVisitor;
-         grid->accept(undefNodesVisitor);
-      }
-
-      //discretization
-      grid->addAndInitInteractor(triBridgeInteractor);
-      grid->addAndInitInteractor(triBandInteractor);
-      grid->addAndInitInteractor(triBand2Interactor);
-
-      //outflow
-      GbCuboid3DPtr densCuboid(new GbCuboid3D(originX1+geoLength[0]-coarseNodeDx, originX2-geoOverlap, originX3-geoOverlap, 
-                                              originX1+geoLength[0]+geoOverlap, originX2+geoLength[1]+geoOverlap, originX3+geoLength[2]+geoOverlap ));
-      if(myid == 0) GbSystem3D::writeGeoObject(densCuboid.get(), pathname+"/geo/densCuboid", WbWriterVtkXmlASCII::getInstance());
-      D3Q27BoundaryConditionAdapterPtr denBCAdapter(new D3Q27DensityBCAdapter(rhoInit));
-      D3Q27InteractorPtr densInteractor( new D3Q27Interactor(densCuboid,grid,denBCAdapter,Interactor3D::SOLID) );
-      grid->addAndInitInteractor( densInteractor ); 
-
-      //inflow
-      double uLB2=uLB*0.96*1.02;//*0.5;
-      double raiseVelSteps = 0;
-      vector<D3Q27BCFunction> velcX1BCs,dummy;
-
-      mu::Parser inflowProfile;
-      inflowProfile.SetExpr("uLB"); 
-
-      inflowProfile.DefineConst("uLB",uLB2);
-      velcX1BCs.push_back(D3Q27BCFunction(inflowProfile,raiseVelSteps,D3Q27BCFunction::INFCONST));
-
-      GbCuboid3DPtr velBCCuboid(new GbCuboid3D(originX1-geoOverlap, originX2-geoOverlap, originX3-geoOverlap, 
-                                               originX1+coarseNodeDx, originX2+geoLength[1]+geoOverlap, originX3+geoLength[2]+geoOverlap));
-      if(myid == 0) GbSystem3D::writeGeoObject(velBCCuboid.get(), pathname+"/geo/velBCCuboid", WbWriterVtkXmlASCII::getInstance());
-
-      D3Q27InteractorPtr velBCInteractor(new D3Q27Interactor(velBCCuboid,grid,Interactor3D::SOLID)); 
-      D3Q27BoundaryConditionAdapterPtr velBCAdapter(new D3Q27VelocityBCAdapter (velcX1BCs,dummy,dummy));
-      velBCInteractor->addBCAdapter(velBCAdapter);
-      grid->addAndInitInteractor( velBCInteractor ); 
-
-      //set connectors
-      D3Q27InterpolationProcessorPtr iProcessor(new D3Q27OffsetInterpolationProcessor());
-      D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
-      grid->accept( setConnsVisitor );
-
-      //domain decomposition
-      PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
-      grid->accept(pqPartVisitor);
-
-      //initialization of decompositions
-      D3Q27ETInitDistributionsBlockVisitor initVisitor(1.0);
-      initVisitor.setVx1(inflowProfile);
-      grid->accept(initVisitor);
-
-      //Postrozess
-      LBMUnitConverterPtr conv = LBMUnitConverterPtr(new LBMUnitConverter());
-      
-      UbSchedulerPtr geoSch(new UbScheduler(1));
-      D3Q27MacroscopicQuantitiesPostprocessorPtr ppgeo(
-           new D3Q27MacroscopicQuantitiesPostprocessor(grid, geoSch, pathname + "/grid/nodes", WbWriterVtkXmlBinary::getInstance(), 
-                                                       conv, comm, true));
-      grid->doPostProcess(0);
-      ppgeo.reset();
-      geoSch.reset();
-
-      if(myid == 0) UBLOG(logINFO,"Preprozess - end");    
-      
-      if(myid == 0) 
-      {
-         UBLOG(logINFO, "* dxInflow-Cube ="<<velBCCuboid->getX1Maximum()-mesh->getX1Minimum());
-         UBLOG(logINFO, "* inflowProfile ="<<inflowProfile.GetExpr());
-         UBLOG(logINFO, "* raiseVelSteps ="<<raiseVelSteps);
-      }
-}
-      
-      LBMUnitConverterPtr conv = LBMUnitConverterPtr(new LBMUnitConverter());
-      double outTime = 1000;
-      UbSchedulerPtr visSch(new UbScheduler(outTime));
-      visSch->addSchedule(1000,1000,10000);
-      visSch->addSchedule(10000,10000,100000);
-      visSch->addSchedule(100000,100000,1000000);
-      D3Q27MacroscopicQuantitiesPostprocessor pp(grid, visSch, pathname + "/steps/step", WbWriterVtkXmlBinary::getInstance(), conv, comm);
-
-      UbSchedulerPtr nupsSch(new UbScheduler(10, 30, 100));
-      NUPSCounterPostprocessor npr(grid, nupsSch, pathname + "/results/nups.txt", comm);
-
-      double endTime = 1000001;
-      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, visSch));
-      if(myid == 0) UBLOG(logINFO,"Simulation-start");
-      calculation->calculate();
-      if(myid == 0) UBLOG(logINFO,"Simulation-end");
-   }
-   catch(std::exception& e)
-   {
-      cerr << e.what() << endl << flush;
-   }
-   catch(std::string& s)
-   {
-      cerr << s << endl;
-   }
-   catch(...)
-   {
-      cerr << "unknown exception" << endl;
-   }
-
-}
-int main(int argc, char* argv[])
-{
-
-   run(argv[1]);
-
-   return 0;
-}
-
+#include <iostream>
+#include <string>
+
+#include "numerics/geometry3d/CoordinateTransformation3D.h"
+#include "Grid3D.h"
+#include "GenBlocksGridVisitor.h"
+#include "numerics/geometry3d/GbSystem3D.h"
+#include "numerics/geometry3d/GbCuboid3D.h"
+#include "numerics/geometry3d/GbCylinder3D.h"
+#include <numerics/geometry3d/GbSphere3D.h>
+#include "basics/writer/WbWriterVtkXmlASCII.h"
+#include "basics/writer/WbWriterVtkXmlBinary.h"
+#include "RefineCrossAndInsideGbObjectBlockVisitor.h"
+#include "RatioBlockVisitor.h"
+#include "RatioSmoothBlockVisitor.h"
+#include "OverlapBlockVisitor.h"
+#include "RefineInterGbObjectsVisitor.h"
+#include "RefineCrossAndInsideGbObjectBlockVisitor.h"
+#include "SetKernelBlockVisitor.h"
+#include "LBMKernelETD3Q27Cascaded.h"
+#include "D3Q27MacroscopicQuantitiesPostprocessor.h"
+#include "MPICommunicator.h"
+#include "D3Q27ETBCProcessor.h"
+#include "SimulationParameters.h"
+#include "D3Q27SetUndefinedNodesBlockVisitor.h"
+#include "SetInterpolationDirsBlockVisitor.h"
+#include "D3Q27SetConnectorsBlockVisitor.h"
+#include "NullCommunicator.h"
+#include "D3Q27ETInitDistributionsBlockVisitor.h"
+#include "CalculationManager.h"
+#include "PQueuePartitioningGridVisitor.h"
+#include "MetisPartitioningGridVisitor.h"
+#include "D3Q27Interactor.h"
+#include "D3Q27NoSlipBCAdapter.h"
+#include "D3Q27VelocityBCAdapter.h"
+#include "D3Q27DensityBCAdapter.h"
+#include "D3Q27BoundaryConditionAdapter.h"
+#include "StringUtil.hpp"
+#include "D3Q27OffsetInterpolationProcessor.h"
+#include "D3Q27CompactInterpolationProcessor.h"
+#include "SyncBcBlockVisitor.h"
+#include "numerics/geometry3d/creator/GbTriFaceMesh3DCreator.h"
+#include "numerics/geometry3d/GbTriFaceMesh3D.h"
+#include "D3Q27TriFaceMeshInteractor.h"
+#include "MathUtil.hpp"
+#include "SolidBlocksHelper.h"
+#include "LBMKernelETD3Q27CascadedTI.h"
+#include "TurbulenceIntensityPostprocessor.h"
+#include "RestartPostprocessor.h"
+#include "BlocksPostprocessor.h"
+#include "NUPSCounterPostprocessor.h"
+
+using namespace std;
+
+
+void run(const char *cstr)
+{
+   try
+   {
+      string machine = QUOTEME(CAB_MACHINE);
+      string BrueckeFilename;
+      string ZckbndFilename;
+      string pathname; 
+      string pathGeo;
+      int numOfThreads =1;
+      bool logfile = false;
+      double availMem = 0;
+
+      CommunicatorPtr comm(new MPICommunicator());
+      int myid = comm->getProcessID();
+      
+      if(machine == "BOMBADIL") 
+      {
+         pathname = "c:/temp/plate";
+         pathGeo = "c:/Data/plate";
+         numOfThreads = 1;
+         logfile = false;
+         availMem = 3.0e9;
+      }
+      else if(machine == "M01" || machine == "M02")      
+      {
+         pathname = "/work/koskuche/scratch/plate";
+         pathGeo = "/home/koskuche/data/plate";
+         numOfThreads = 8;
+         availMem = 12.0e9;
+
+         if(myid ==0)
+         {
+            stringstream logFilename;
+            logFilename <<  pathname + "/logfile"+UbSystem::toString(UbSystem::getTimeStamp())+".txt";
+            UbLog::output_policy::setStream(logFilename.str());
+         }
+      }
+      else throw UbException(UB_EXARGS, "unknown CAB_MACHINE");
+
+      BrueckeFilename = pathGeo + "/platte_raw.stl"; 
+      ZckbndFilename= pathGeo + "/2zackenbaender0.stl";
+      
+
+
+      if(myid ==0 && logfile)
+      {
+         stringstream logFilename;
+         logFilename <<  pathname + "/logfile.log";
+         UbLog::output_policy::setStream(logFilename.str());
+      }
+
+      int baseLevel, refineLevel,nx[3],blocknx[3];
+      double Re,velocity,rhoInit,vx1Init;//,vx2Init,vx3Init;
+
+      //////////////////////////////////////////////////////////////////////////
+      //physik
+      //////////////////////////////////////////////////////////////////////////
+      Re            = 11900;// 13286;//13286;//gemessen 18.98 m/s...*5.0 zum  testen ob was passiert
+      velocity      = 0.01;  
+      vx1Init       = 0.01;  
+      rhoInit       = 1.0;
+      SimulationParametersPtr param = SimulationParameters::getInstanz();
+      param->setCollisionModelType(SimulationParameters::COMPRESSIBLE);
+
+      ///////////////Knotenabmessungen:
+      //int KnotenCubeCoarse=40;
+      nx[0]      = 120;//60;//86;//43;//65;//50;  //länge
+      nx[1]      = 1;//6;///1;//5;// //breite
+      nx[2]      = 32;//18;//5;//15;//15; //höhe gebiet
+      blocknx[0] = 15;
+      blocknx[1] = 15;
+      blocknx[2] = 15;
+
+      baseLevel   = 0;
+      refineLevel = 4;
+
+      int inflowCubeLevel = 1;
+      int bottomLevel     = 1;
+
+      ///////////////Weltabmessungen:
+      double kanalhoeheSI  = 60.0/100.0;//60.0/100.0;//cm, Kanalhöhe
+      double kanalbreiteSI = 9.9/100.0;//1.65/100.0;//13.2/100.0;////40.0/100.0; //cm, Kanalbreite //13.2 zeilbreite
+      double kanallaengeSI = kanalhoeheSI*30.0/18.0;//80.0/100.0;//cm, Kanallänge, ist nicht angegeben
+
+      // double refinewidth1=kanalhoeheSI/10.0;
+
+      double fineNodeDx   = (kanalhoeheSI) / (double)( blocknx[2]*nx[2]*(1<<refineLevel)+1 ); //+1--> gitter liegt jeweils 0.5dx innerhalb
+      double coarseNodeDx = fineNodeDx * (double)(1<<refineLevel);//geowerte
+
+      double blockLengthx1 = blocknx[0]*coarseNodeDx; //geowerte
+      double blockLengthx2 = blockLengthx1;
+      double blockLengthx3 = blockLengthx1;
+
+      double originX1 = 0.0;//-50.0*propellerDurchmesser;  //geowerte
+      double originX2 = 0.0;//-0.5*blockLengthx2*nx2;
+      double originX3 = 0.0;// minX3 + 0.5*fineNodeDx;
+
+      double geoLength[]   = {  nx[0]*blockLengthx1, nx[1]*blockLengthx2, nx[2]*blockLengthx3}; 
+
+      //position vorderkante cube
+      double originBridgeX1 = 20.0/100.0; //cm, geraten
+      double originBridgeX2 = 0.0;//0.5*params.nx[1]*blockLengthx2-0.5*H-fineNodeDx;
+      double originBridgeX3 = kanalhoeheSI*0.5;//H*0.0-fineNodeDx; //boden
+
+      bool periodicx1 = false;
+      bool periodicx2 = true;
+      bool periodicx3 = true;
+
+      //##########################################################################
+      //## physical parameters
+      //##########################################################################
+      double smagorinskiConstant = 0.18;
+
+
+      double rhoLB         = 1.0;
+      double rhoReal       = 1.0;
+      double nueReal  = 0.000015;//0.015;
+
+      double hReal         = 0.0105;//<-m     1.05;//Plattendicke in cm(! cm nicht m !)
+      double uReal         = Re*nueReal/hReal;
+
+      //##Machzahl:
+      //#Ma     = uReal/csReal
+      double Ma      = 0.05;//0.0553;//Ma-Real!
+      double csReal  = uReal/Ma;
+      double hLB     = hReal/coarseNodeDx;
+
+      LBMUnitConverter unitConverter(hReal, csReal, rhoReal, hLB);
+
+      double uLB           = uReal   * unitConverter.getFactorVelocityWToLb();
+      double nueLB         = nueReal * unitConverter.getFactorViscosityWToLb();
+
+      velocity = uLB;
+      double viscosity = nueLB;
+
+      Grid3DPtr grid(new Grid3D());
+      UbSchedulerPtr rSch(new UbScheduler(5000,5000,1000000));
+      RestartPostprocessor rp(grid, rSch, comm, pathname+"/checkpoints", RestartPostprocessor::BINARY);
+
+      //////////////////////////////////////////////////////////////////////////
+
+      std::string opt;
+
+      if(cstr!= NULL)
+         opt = std::string(cstr);
+
+      if(/*(cstr== NULL)*/cstr!= NULL)
+      {
+         opt = std::string(cstr);
+
+         if(myid==0) UBLOG(logINFO,"Restart step: " << opt);
+
+         grid = rp.restart(UbSystem::stringTo<int>(opt));
+
+         //set connectors
+         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27OffsetInterpolationProcessor());
+         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
+         grid->accept( setConnsVisitor );
+
+         //domain decomposition
+         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
+         grid->accept(pqPartVisitor);
+      }
+      else
+      {
+      //bounding box
+      double g_minX1 = originX1;
+      double g_minX2 = originX2;
+      double g_minX3 = originX3;
+
+      double g_maxX1 = originX1 + geoLength[0];
+      double g_maxX2 = originX2 + geoLength[1];
+      double g_maxX3 = originX3 + geoLength[2];
+
+      //set grid
+      grid->setDeltaX(coarseNodeDx);
+      grid->setBlockNX(blocknx[0], blocknx[1], blocknx[2]);
+      grid->setPeriodicX1(periodicx1);
+      grid->setPeriodicX2(periodicx2);
+      grid->setPeriodicX3(periodicx3);
+
+      
+      GbObject3DPtr gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
+      if(myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), pathname+"/geo/gridCube", WbWriterVtkXmlASCII::getInstance());
+
+      GenBlocksGridVisitor genBlocks;
+      genBlocks.addGeoObject(gridCube);
+      grid->accept(genBlocks);
+
+      //////////////////////////////////////////////////////////////////////////
+      //platte
+      GbTriFaceMesh3DPtr mesh (GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(BrueckeFilename,"Netz"));
+
+      double x1minMesh = mesh->getX1Minimum(); double x1maxMesh = mesh->getX1Maximum();
+      double x2minMesh = mesh->getX2Minimum(); double x2maxMesh = mesh->getX2Maximum();
+      double x3minMesh = mesh->getX3Minimum(); double x3maxMesh = mesh->getX3Maximum();
+
+      double drehpunktX=x1minMesh+(x1maxMesh-x1minMesh)*0.5;//triFaceMeshS->getX1Centroid();
+      double drehpunktZ=x3minMesh+(x3maxMesh-x3minMesh)*0.5;//triFaceMeshS->getX3Centroid();
+      double drehpunktY=x2minMesh+(x2maxMesh-x2minMesh)*0.5;// seedX2-0.5*nodeDelta;//+nx2*deltaX2+0.5*deltaX2;
+
+      mesh->rotate(90.0,0.0,0.0);  //TriFacMesh-KO-System anders als LB-KO-System
+
+      x1minMesh = mesh->getX1Minimum();  x1maxMesh = mesh->getX1Maximum();
+      x2minMesh = mesh->getX2Minimum();  x2maxMesh = mesh->getX2Maximum();
+      x3minMesh = mesh->getX3Minimum();  x3maxMesh = mesh->getX3Maximum();
+
+      drehpunktX=x1minMesh+(x1maxMesh-x1minMesh)*0.5;//triFaceMeshS->getX1Centroid();
+      drehpunktZ=x3minMesh+(x3maxMesh-x3minMesh)*0.5;//triFaceMeshS->getX3Centroid();
+      drehpunktY=x2minMesh+(x2maxMesh-x2minMesh)*0.5;// seedX2-0.5*nodeDelta;//+nx2*deltaX2+0.5*deltaX2;
+
+      double H3=1.05/100.0;//cm, Plattendicke
+      double scaleB=H3/(x3maxMesh-x3minMesh);
+      double scaleX2=(geoLength[2]+2.0*coarseNodeDx)/(x2minMesh-x2maxMesh);
+
+      mesh->scale(scaleB,scaleB,scaleB);
+      x1minMesh = mesh->getX1Minimum(); x1maxMesh = mesh->getX1Maximum();
+      x2minMesh = mesh->getX2Minimum(); x2maxMesh = mesh->getX2Maximum();
+      x3minMesh = mesh->getX3Minimum(); x3maxMesh = mesh->getX3Maximum();
+      double offsetXBridge=originBridgeX1;//originBridgeX1;
+      double offsetYBridge=originBridgeX2;//originBridgeX2;
+      double offsetZBridge=originBridgeX3;//originBridgeX3;//-0.5*(x3minMesh-x3maxMesh);
+      //mesh->translate(-x1minMesh+offsetXBridge, -x2minMesh-0.5*offsetYBridge-coarseNodeDx, -x3minMesh+offsetZBridge); 
+      mesh->translate(-x1minMesh+offsetXBridge, -x2minMesh+offsetYBridge-coarseNodeDx, -x3minMesh+offsetZBridge-(x3maxMesh-x3minMesh)*0.5); 
+
+      x1minMesh = mesh->getX1Minimum(); x1maxMesh = mesh->getX1Maximum();
+      x2minMesh = mesh->getX2Minimum(); x2maxMesh = mesh->getX2Maximum();
+      x3minMesh = mesh->getX3Minimum(); x3maxMesh = mesh->getX3Maximum();
+
+      if(myid == 0) GbSystem3D::writeGeoObject( mesh.get(), pathname+"/geo/platte", WbWriterVtkXmlBinary::getInstance() );
+
+      //////////////////////////////////////////////////////////////////////////
+      // Zackenband
+      //////////////////////////////////////////////////////////////////////////
+      GbTriFaceMesh3DPtr meshBand (GbTriFaceMesh3DCreator::readMeshFromFile(ZckbndFilename, "NetzBand"));
+      meshBand->deleteRedundantNodes();
+
+      double x1minMeshB = meshBand->getX1Minimum(); double x1maxMeshB = meshBand->getX1Maximum();
+      double x2minMeshB = meshBand->getX2Minimum(); double x2maxMeshB = meshBand->getX2Maximum();
+      double x3minMeshB = meshBand->getX3Minimum(); double x3maxMeshB = meshBand->getX3Maximum();
+
+      x1minMeshB = meshBand->getX1Minimum();  x1maxMeshB = meshBand->getX1Maximum();
+      x2minMeshB = meshBand->getX2Minimum();  x2maxMeshB = meshBand->getX2Maximum();
+      x3minMeshB = meshBand->getX3Minimum();  x3maxMeshB = meshBand->getX3Maximum();
+
+      double H1B=1.5/100.0;//0.05;//cm, Banddicke..nachschauen!!!
+      double scaleBand=H1B/(x1maxMeshB-x1minMeshB);//H3B/(x3maxMeshB-x3minMeshB);
+
+      meshBand->scale(scaleBand,scaleBand,scaleBand);
+      x1minMeshB = meshBand->getX1Minimum(); x1maxMeshB = meshBand->getX1Maximum();
+      x2minMeshB = meshBand->getX2Minimum(); x2maxMeshB = meshBand->getX2Maximum();
+      x3minMeshB = meshBand->getX3Minimum(); x3maxMeshB = meshBand->getX3Maximum();
+      double dBandX=0.5/100.0;//1.29; //15mm-2.1mm Absand von Bandvorderkante
+      double dBandY=0.0/100.0;
+      double dBandZ=0.223/100.0;//0.344;//....
+      double offsetXBridgeB=x1minMesh+dBandX;//originBridgeX1+dBandX;//originBridgeX1;
+      double offsetYBridgeB=originBridgeX2+dBandY;//originBridgeX2;
+      double offsetZBridgeB=originBridgeX3+dBandZ;//originBridgeX3;//-0.5*(x3minMesh-x3maxMesh);
+      meshBand->translate(-x1minMeshB+offsetXBridgeB, -x2minMeshB+offsetYBridgeB-coarseNodeDx, -x3minMeshB+offsetZBridgeB);//-(x3maxMeshB-x3minMeshB)*0.5); 
+
+      x1minMeshB = meshBand->getX1Minimum(); x1maxMeshB = meshBand->getX1Maximum();
+      x2minMeshB = meshBand->getX2Minimum(); x2maxMeshB = meshBand->getX2Maximum();
+      x3minMeshB = meshBand->getX3Minimum(); x3maxMeshB = meshBand->getX3Maximum();
+
+      GbSystem3D::writeGeoObject( meshBand.get(), pathname+"/geo/Band", WbWriterVtkXmlASCII::getInstance() );
+
+      /////////////////Band2
+      GbTriFaceMesh3DPtr meshBand2(GbTriFaceMesh3DCreator::readMeshFromFile(ZckbndFilename, "NetzBand2"));
+      meshBand->deleteRedundantNodes();
+
+      double x1minMeshB2 = meshBand2->getX1Minimum(); double x1maxMeshB2 = meshBand2->getX1Maximum();
+      double x2minMeshB2 = meshBand2->getX2Minimum(); double x2maxMeshB2 = meshBand2->getX2Maximum();
+      double x3minMeshB2 = meshBand2->getX3Minimum(); double x3maxMeshB2 = meshBand2->getX3Maximum();
+
+      x1minMeshB2 = meshBand2->getX1Minimum();  x1maxMeshB2 = meshBand2->getX1Maximum();
+      x2minMeshB2 = meshBand2->getX2Minimum();  x2maxMeshB2 = meshBand2->getX2Maximum();
+      x3minMeshB2 = meshBand2->getX3Minimum();  x3maxMeshB2 = meshBand2->getX3Maximum();
+
+      double H1B2=1.5/100.0;//0.05;//cm, Banddicke..nachschauen!!!
+      double scaleBand2=H1B2/(x1maxMeshB2-x1minMeshB2);//H3B/(x3maxMeshB-x3minMeshB);
+
+      meshBand2->scale(scaleBand2,scaleBand2,scaleBand2);
+      x1minMeshB2 = meshBand2->getX1Minimum(); x1maxMeshB2 = meshBand2->getX1Maximum();
+      x2minMeshB2 = meshBand2->getX2Minimum(); x2maxMeshB2 = meshBand2->getX2Maximum();
+      x3minMeshB2 = meshBand2->getX3Minimum(); x3maxMeshB2 = meshBand2->getX3Maximum();
+      double dBandX2=0.5/100.0;//1.29;
+      double dBandY2=0.5/100.0;
+      double dBandZ2=0.223/100.0;//0.344;//...
+      double offsetXBridgeB2=x1minMesh+dBandX2;//originBridgeX1;
+      double offsetYBridgeB2=originBridgeX2+dBandY2;//originBridgeX2;
+      double offsetZBridgeB2=originBridgeX3+dBandZ2;//originBridgeX3;//-0.5*(x3minMesh-x3maxMesh);
+      meshBand2->translate(-x1minMeshB2+offsetXBridgeB2, -x2minMeshB2+offsetYBridgeB2-coarseNodeDx, -x3minMeshB2+offsetZBridgeB2);//-(x3maxMeshB2-x3minMeshB2)*0.5); 
+
+      x1minMeshB2 = meshBand2->getX1Minimum(); x1maxMeshB2 = meshBand2->getX1Maximum();
+      x2minMeshB2 = meshBand2->getX2Minimum(); x2maxMeshB2 = meshBand2->getX2Maximum();
+      x3minMeshB2 = meshBand2->getX3Minimum(); x3maxMeshB2 = meshBand2->getX3Maximum();
+
+      if(myid == 0) GbSystem3D::writeGeoObject( meshBand2.get(), pathname+"/geo/Band2", WbWriterVtkXmlASCII::getInstance() );
+      //////////////////////////////////////////////////////////////////////////
+      if(myid == 0) 
+      {
+         UBLOG(logINFO, "*****************************************");
+         UBLOG(logINFO, "* Parameters                            *");
+         UBLOG(logINFO, "* Re            ="<<Re);
+         UBLOG(logINFO, "* Ma            ="<<Ma);
+         UBLOG(logINFO, "* uReal         ="<<uReal);
+         UBLOG(logINFO, "* nueReal       ="<<nueReal);
+         UBLOG(logINFO, "* nue           ="<<nueLB);
+         UBLOG(logINFO, "* velocity      ="<<uLB);
+         UBLOG(logINFO, "* LX1 (world/LB)="<<kanallaengeSI<<"/"<<kanallaengeSI/coarseNodeDx);
+         UBLOG(logINFO, "* LX2 (world/LB)="<<kanalbreiteSI<<"/"<<kanalbreiteSI/coarseNodeDx);
+         UBLOG(logINFO, "* LX3 (world/LB)="<<kanalhoeheSI<<"/"<<kanalhoeheSI/coarseNodeDx);
+         //UBLOG(logINFO, "* dxInflow-Cube ="<<velBCCuboid->getX1Maximum()-mesh->getX1Minimum());
+         UBLOG(logINFO, "* cdx           ="<<coarseNodeDx);
+         UBLOG(logINFO, "* fdx           ="<<fineNodeDx);
+         //UBLOG(logINFO, "* inflowProfile ="<<inflowProfile.GetExpr());
+         UBLOG(logINFO, "* dx_base       ="<<coarseNodeDx<<" == "<<coarseNodeDx);
+         UBLOG(logINFO, "* dx_refine     ="<<fineNodeDx<<" == "<<fineNodeDx );
+         //UBLOG(logINFO, "* raiseVelSteps ="<<raiseVelSteps);
+         UBLOG(logINFO, "* nx1/2/3       ="<<nx[0]<<"/"<<nx[1]<<"/"<<nx[2]);
+         UBLOG(logINFO, "* blocknx1/2/3  ="<<blocknx[0]<<"/"<<blocknx[1]<<"/"<<blocknx[2]);
+         UBLOG(logINFO, "* x2Periodic    ="<<periodicx2);
+         UBLOG(logINFO, "* x3Periodic    ="<<periodicx3);
+         UBLOG(logINFO, "*****************************************");
+         UBLOGML(logINFO, "UnitConverter:"<<unitConverter.toString());
+         UBLOG(logINFO, "*****************************************");     
+      }
+      if(myid == 0) UBLOG(logINFO,"Refinement - start");	
+      double geoOverlap = 3.0*coarseNodeDx;
+      //////////////////////////////////////////////////////////////////////////
+      // refine
+      //////////////////////////////////////////////////////////////////////////
+      ///////////platte ausmessen:
+      x1minMesh = mesh->getX1Minimum(); x1maxMesh = mesh->getX1Maximum();
+      x2minMesh = mesh->getX2Minimum(); x2maxMesh = mesh->getX2Maximum();
+      x3minMesh = mesh->getX3Minimum(); x3maxMesh = mesh->getX3Maximum();
+      double deltaX3Platte=(x3maxMesh-x3minMesh);
+
+
+      //GbCuboid3DPtr refine1PlatteCube(new GbCuboid3D(  originX1-geoOverlap   , originX2-geoOverlap  , x3minMesh-H3
+      //   , x1maxMesh+H3*5.0, originX2+geoOverlap+geoLength[1], x3maxMesh+H3));
+      //RefineCrossAndInsideGbObjectBlockVisitor refineAdapterP1(refine1PlatteCube, baseLevel, refineLevel-6);
+      //grid->accept(refineAdapterP1);
+
+      // GbCuboid3DPtr refine2PlatteCube(new GbCuboid3D(  originX1-geoOverlap   , originX2-geoOverlap  , x3minMesh-H3*0.5
+        // , x1maxMesh+H3*5.0, originX2+geoOverlap+geoLength[1], x3maxMesh+H3));
+      // RefineCrossAndInsideGbObjectBlockVisitor refineAdapterP2(refine2PlatteCube, baseLevel, refineLevel-5);
+      // grid->accept(refineAdapterP2);
+
+      GbCuboid3DPtr refine3PlatteCube(new GbCuboid3D(  originX1-geoOverlap  , originX2-geoOverlap  , x3minMesh-H3*0.5
+         , x1maxMesh+H3*5.0, originX2+geoOverlap+geoLength[1], x3maxMesh+H3*0.5));
+      RefineCrossAndInsideGbObjectBlockVisitor refineAdapterP3(refine3PlatteCube, baseLevel, refineLevel-4);
+      grid->accept(refineAdapterP3);
+
+      GbCuboid3DPtr refine4PlatteCube(new GbCuboid3D(   originX1-geoOverlap  , originX2-geoOverlap  , x3minMesh+deltaX3Platte*0.0
+         ,  x1maxMesh+H3*5.0, originX2+geoOverlap+geoLength[1], x3maxMesh+H3*0.25));
+      if(myid == 0) GbSystem3D::writeGeoObject(refine4PlatteCube.get(), pathname+"/geo/refine4PlatteCube", WbWriterVtkXmlASCII::getInstance());
+      RefineCrossAndInsideGbObjectBlockVisitor refineAdapterP4(refine4PlatteCube, baseLevel, refineLevel-3);
+      grid->accept(refineAdapterP4);
+
+      GbCuboid3DPtr refine5PlatteCube(new GbCuboid3D(   originX1-geoOverlap , originX2-geoOverlap  ,x3minMesh+deltaX3Platte*0.1/* x3minMesh+deltaX3Platte*0.8*/
+         ,  x1maxMesh+H3*5.0, originX2+geoOverlap+geoLength[1], x3maxMesh+H3*0.00375));
+      if(myid == 0) GbSystem3D::writeGeoObject(refine5PlatteCube.get(), pathname+"/geo/refine5PlatteCube", WbWriterVtkXmlASCII::getInstance());
+      RefineCrossAndInsideGbObjectBlockVisitor refineAdapterP5(refine5PlatteCube, baseLevel, refineLevel-2);
+      grid->accept(refineAdapterP5);
+
+      GbCuboid3DPtr refine6PlatteCube(new GbCuboid3D(   originX1-geoOverlap   , originX2-geoOverlap  , x3minMesh-deltaX3Platte*0.1/*x3minMesh+deltaX3Platte*0.9*/
+         ,  x1maxMesh+H3*5.0, originX2+geoOverlap+geoLength[1], x3maxMesh+deltaX3Platte*0.9));
+      if(myid == 0) GbSystem3D::writeGeoObject(refine6PlatteCube.get(), pathname+"/geo/refine6PlatteCube", WbWriterVtkXmlASCII::getInstance());
+      RefineCrossAndInsideGbObjectBlockVisitor refineAdapterP6(refine6PlatteCube, baseLevel, refineLevel-1);
+      grid->accept(refineAdapterP6);
+
+      //GbCuboid3DPtr refine7PlatteCube(new GbCuboid3D(originX1-geoOverlap   , originX2-geoOverlap  , x3minMesh-deltaX3Platte*0.3, 
+      //                                               meshBand->getX1Maximum()+meshBand->getLengthX1()*3.0, originX2+geoOverlap+geoLength[1], x3maxMesh));
+      //if(myid == 0) GbSystem3D::writeGeoObject(refine7PlatteCube.get(), pathname+"/geo/refine7PlatteCube", WbWriterVtkXmlASCII::getInstance());
+      //RefineCrossAndInsideGbObjectBlockVisitor refineAdapterP7(refine7PlatteCube, baseLevel, refineLevel-1);
+      //grid->accept(refineAdapterP7);
+
+      RatioBlockVisitor ratioVisitor(refineLevel);
+      grid->accept(ratioVisitor);
+      RatioSmoothBlockVisitor ratioSmoothVisitor(refineLevel);
+      grid->accept(ratioSmoothVisitor);
+      OverlapBlockVisitor overlapVisitor(refineLevel);
+      grid->accept(overlapVisitor);
+      std::vector<int> dirs;
+      D3Q27System::getLBMDirections(dirs);
+      SetInterpolationDirsBlockVisitor interDirsVisitor(dirs);
+      grid->accept(interDirsVisitor);
+
+      if(myid == 0) UBLOG(logINFO,"Refinement - end");
+
+      if(myid == 0) UBLOG(logINFO,"Write blocks - start");
+      BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname + "/grid/blocks", WbWriterVtkXmlBinary::getInstance(), comm));
+      if(myid == 0) ppblocks->update(0);
+      //ppblocks.reset();
+      if(myid == 0) UBLOG(logINFO,"Write blocks - end");
+      
+      MetisPartitioningGridVisitor metisVisitor(numOfThreads, D3Q27System::B, comm, false);
+      grid->accept( metisVisitor );
+
+      if(myid == 0) UBLOG(logINFO,"deleteSolidBlocks - start");
+      SolidBlocksHelper sd(grid, comm);
+
+      //iteractors
+      int bbOption1 = 0; //0=simple Bounce Back, 1=quadr. BB
+      D3Q27BoundaryConditionAdapterPtr bcObst(new D3Q27NoSlipBCAdapter(bbOption1));
+
+      D3Q27TriFaceMeshInteractorPtr triBridgeInteractor( new D3Q27TriFaceMeshInteractor(mesh, grid, bcObst,Interactor3D::SOLID));
+      sd.addInteractor(triBridgeInteractor);
+
+      D3Q27TriFaceMeshInteractorPtr triBandInteractor( new D3Q27TriFaceMeshInteractor( meshBand, grid, bcObst,Interactor3D::SOLID) );
+
+      D3Q27TriFaceMeshInteractorPtr triBand2Interactor( new D3Q27TriFaceMeshInteractor( meshBand2, grid, bcObst,Interactor3D::SOLID) );
+
+      sd.deleteSolidBlocks();
+      if(myid == 0) UBLOG(logINFO,"deleteSolidBlocks - end");	      
+      
+      if(myid == 0) UBLOG(logINFO,"Write blocks - start");
+      grid->accept( metisVisitor );
+      //BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname + "/grid/blocks", WbWriterVtkXmlBinary::getInstance(), comm));
+      if(myid == 0) ppblocks->update(0);
+      ppblocks.reset();
+      if(myid == 0) UBLOG(logINFO,"Write blocks - end");
+
+      unsigned long nob = grid->getNumberOfBlocks();
+      unsigned long nod = nob * blocknx[0]*blocknx[1]*blocknx[2];
+      
+      double needMemAll  = double(nod*(27*sizeof(double) + sizeof(int))*2);
+      double needMem  = needMemAll / double(comm->getNumberOfProcesses());
+
+      if(myid == 0)
+      {
+         UBLOG(logINFO,"Number of blocks = " << nob);
+         UBLOG(logINFO,"Number of nodes  = " << nod);
+         UBLOG(logINFO,"Necessary memory  = " << needMemAll  << " bytes");
+         UBLOG(logINFO,"Necessary memory per process = " << needMem  << " bytes");
+         UBLOG(logINFO,"Available memory per process = " << availMem << " bytes");
+      }
+
+      LBMKernel3DPtr kernel(new LBMKernelETD3Q27Cascaded(blocknx[0], blocknx[1], blocknx[2]));
+      BCProcessorPtr bcProc(new D3Q27ETBCProcessor());
+      kernel->setBCProcessor(bcProc);
+
+      SetKernelBlockVisitor kernelVisitor(kernel, nueLB, availMem, needMem);
+      grid->accept(kernelVisitor);
+
+      if (refineLevel > 0)
+      {
+         D3Q27SetUndefinedNodesBlockVisitor undefNodesVisitor;
+         grid->accept(undefNodesVisitor);
+      }
+
+      //discretization
+      grid->addAndInitInteractor(triBridgeInteractor);
+      grid->addAndInitInteractor(triBandInteractor);
+      grid->addAndInitInteractor(triBand2Interactor);
+
+      //outflow
+      GbCuboid3DPtr densCuboid(new GbCuboid3D(originX1+geoLength[0]-coarseNodeDx, originX2-geoOverlap, originX3-geoOverlap, 
+                                              originX1+geoLength[0]+geoOverlap, originX2+geoLength[1]+geoOverlap, originX3+geoLength[2]+geoOverlap ));
+      if(myid == 0) GbSystem3D::writeGeoObject(densCuboid.get(), pathname+"/geo/densCuboid", WbWriterVtkXmlASCII::getInstance());
+      D3Q27BoundaryConditionAdapterPtr denBCAdapter(new D3Q27DensityBCAdapter(rhoInit));
+      D3Q27InteractorPtr densInteractor( new D3Q27Interactor(densCuboid,grid,denBCAdapter,Interactor3D::SOLID) );
+      grid->addAndInitInteractor( densInteractor ); 
+
+      //inflow
+      double uLB2=uLB*0.96*1.02;//*0.5;
+      double raiseVelSteps = 0;
+      vector<D3Q27BCFunction> velcX1BCs,dummy;
+
+      mu::Parser inflowProfile;
+      inflowProfile.SetExpr("uLB"); 
+
+      inflowProfile.DefineConst("uLB",uLB2);
+      velcX1BCs.push_back(D3Q27BCFunction(inflowProfile,raiseVelSteps,D3Q27BCFunction::INFCONST));
+
+      GbCuboid3DPtr velBCCuboid(new GbCuboid3D(originX1-geoOverlap, originX2-geoOverlap, originX3-geoOverlap, 
+                                               originX1+coarseNodeDx, originX2+geoLength[1]+geoOverlap, originX3+geoLength[2]+geoOverlap));
+      if(myid == 0) GbSystem3D::writeGeoObject(velBCCuboid.get(), pathname+"/geo/velBCCuboid", WbWriterVtkXmlASCII::getInstance());
+
+      D3Q27InteractorPtr velBCInteractor(new D3Q27Interactor(velBCCuboid,grid,Interactor3D::SOLID)); 
+      D3Q27BoundaryConditionAdapterPtr velBCAdapter(new D3Q27VelocityBCAdapter (velcX1BCs,dummy,dummy));
+      velBCInteractor->addBCAdapter(velBCAdapter);
+      grid->addAndInitInteractor( velBCInteractor ); 
+
+      //set connectors
+      D3Q27InterpolationProcessorPtr iProcessor(new D3Q27OffsetInterpolationProcessor());
+      D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
+      grid->accept( setConnsVisitor );
+
+      //domain decomposition
+      PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
+      grid->accept(pqPartVisitor);
+
+      //initialization of decompositions
+      D3Q27ETInitDistributionsBlockVisitor initVisitor(1.0);
+      initVisitor.setVx1(inflowProfile);
+      grid->accept(initVisitor);
+
+      //Postrozess
+      LBMUnitConverterPtr conv = LBMUnitConverterPtr(new LBMUnitConverter());
+      
+      UbSchedulerPtr geoSch(new UbScheduler(1));
+      D3Q27MacroscopicQuantitiesPostprocessorPtr ppgeo(
+           new D3Q27MacroscopicQuantitiesPostprocessor(grid, geoSch, pathname + "/grid/nodes", WbWriterVtkXmlBinary::getInstance(), 
+                                                       conv, comm, true));
+      grid->doPostProcess(0);
+      ppgeo.reset();
+      geoSch.reset();
+
+      if(myid == 0) UBLOG(logINFO,"Preprozess - end");    
+      
+      if(myid == 0) 
+      {
+         UBLOG(logINFO, "* dxInflow-Cube ="<<velBCCuboid->getX1Maximum()-mesh->getX1Minimum());
+         UBLOG(logINFO, "* inflowProfile ="<<inflowProfile.GetExpr());
+         UBLOG(logINFO, "* raiseVelSteps ="<<raiseVelSteps);
+      }
+}
+      
+      LBMUnitConverterPtr conv = LBMUnitConverterPtr(new LBMUnitConverter());
+      double outTime = 1000;
+      UbSchedulerPtr visSch(new UbScheduler(outTime));
+      visSch->addSchedule(1000,1000,10000);
+      visSch->addSchedule(10000,10000,100000);
+      visSch->addSchedule(100000,100000,1000000);
+      D3Q27MacroscopicQuantitiesPostprocessor pp(grid, visSch, pathname + "/steps/step", WbWriterVtkXmlBinary::getInstance(), conv, comm);
+
+      UbSchedulerPtr nupsSch(new UbScheduler(10, 30, 100));
+      NUPSCounterPostprocessor npr(grid, nupsSch, pathname + "/results/nups.txt", comm);
+
+      double endTime = 1000001;
+      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, visSch));
+      if(myid == 0) UBLOG(logINFO,"Simulation-start");
+      calculation->calculate();
+      if(myid == 0) UBLOG(logINFO,"Simulation-end");
+   }
+   catch(std::exception& e)
+   {
+      cerr << e.what() << endl << flush;
+   }
+   catch(std::string& s)
+   {
+      cerr << s << endl;
+   }
+   catch(...)
+   {
+      cerr << "unknown exception" << endl;
+   }
+
+}
+int main(int argc, char* argv[])
+{
+
+   run(argv[1]);
+
+   return 0;
+}
+
diff --git a/apps/cpu/plate/sonjas_org.cpp.vf b/apps/cpu/plate/sonjas_org.cpp.vf
index 8f590605aed93606c716ef4c9276b3c96b66e5c0..1c634bfed5cfd76fc74f4c3abfb11a61b179fe1b 100644
--- a/apps/cpu/plate/sonjas_org.cpp.vf
+++ b/apps/cpu/plate/sonjas_org.cpp.vf
@@ -1,678 +1,678 @@
-
-
-..damit wir gleich damit anfangen können. So sieht das Setup aus.
-Sonja
-
-
-SpD3Q19Plattenanstroemung.hpp
-
-#include <topology/amr3d/blockadaptation/AMR3DCrossAndInsideGbObject3DAdapter.h>
-//AMR3DCrossAndInsideGbObject3DAdapter
-#include <topology/amr3d/lbmd3q19/utils/D3Q19MetisTools.h>
-//#include <topology/amr3d/lbmd3q19/turbulenceWale/gridadaptation/TwD3Q19SpongeLayerAdapter.h>
-#include <topology/amr3d/lbmd3q19/gridadaptation/D3Q19GridInformationGridAdapter.h>
-#include <topology/amr3d/lbmd3q19/gridadaptation/D3Q19SetConnectorsGridAdapter.h>
-#include <topology/amr3d/lbmd3q19/gridadaptation/D3Q19InitDistributionsGridAdapter.h>
-#include <topology/amr3d/gridadaptation/AMR3DGridLevelPartitionMetisAdapter.h>
-#include <topology/amr3d/gridadaptation/AMR3DGridPartitionOneDirectionAdapter.h>
-#include <topology/amr3d/lbmd3q19/bcadapter/D3Q19DensityLodiBCAdapter.h>
-#include <topology/amr3d/lbmd3q19/singlephase/gridadaptation/SpD3Q19SpongeLayerAdapter.h>
-#include <topology/amr3d/lbmd3q19/gridadaptation/D3Q19InitDistributionsGridAdapter.h>
-
-#include <numerics/geometry3d/GbTriFaceMesh3D.h>
-#include <numerics/geometry3d/creator/GbTriFaceMesh3DCreator.h>
-#include <topology/amr3d/lbmd3q19/interactor/D3Q19AMRTriFaceMeshInteractor.h>
-#include <topology/amr3d/lbmd3q19/services/adapter/D3Q19ClientGridWriteInteractorNodeFiles.h>
-#include <topology/amr3d/lbmd3q19/gridadaptation/D3Q19ChangeSlipToNoSlipGridAdapter.h> 
-
-using namespace std;
-
-void SpD3Q19MasterTestcases::start( RcfClient<IRcfIpService>& ipService, 
-                                   RcfClient<IRcfD3Q19TopologyService>& topoService, 
-                                   RcfClient<IRcfD3Q19AMRInteractorService>& interactorService, 
-                                   RcfClient<IRcfD3Q19CalculationManager>& calculationManager,
-                                   std::vector< RcfClient<IRcfD3Q19CalcService> >& calcServices,
-                                   std::string inputfile )
-{
-   using namespace std;
-   UBLOG(logERROR,"Testcase GBBridge_Sonja "); 
-
-   string outpath = UbStaticPathMap::getPath(UbStaticPathMap::GLOBAL);
-
-   SpD3Q19TestCaseParameters params;
-   bool useLODI;
-   bool initWithLogProfile;
-   //////////////////////////////////////////////////////////////////////////
-   // Params
-   //////////////////////////////////////////////////////////////////////////
-   // if( inputfile.empty() )
-   // {
-   params.calcSteps          = 300000;
-   params.threadedClientCall = true;
-
-   //params.distributedDumpScheduler = UbScheduler(5000, 0);
-   params.distributedDumpScheduler.addSchedule(UbSchedule(100,0,100));
-   params.distributedDumpScheduler.addSchedule(UbSchedule(100,100,6000));
-   params.distributedDumpScheduler.addSchedule(UbSchedule(1000,6000,10000));
-   params.distributedDumpScheduler.addSchedule(UbSchedule(5000,10000,Ub::inf));
-
-   //params.schedulers.calcForces    = UbScheduler(10,0);
-   //params.schedulers.writeForces   = UbScheduler(500,500);
-   params.schedulers.resetAverage  = UbScheduler(50000,50000);
-   params.schedulers.serialization = UbScheduler(20000,20000);
-
-   //Schnickschnack(  so lassen, da geht es im Wesentlichen um Kommunikationsdetails)
-   params.connsTransAttr.setRemoteProtocol(D3Q19ConnectorTransmitterAttributes::MPI_PROTOCOL);
-   params.connsTransAttr.setOptionDirectConnectors(true);
-   params.connsTransAttr.setOptionTwoVectorsForLocalVectors(false);
-   params.connsTransAttr.setOptionConsForNotActiveBlocks(true);
-   params.connsTransAttr.setOptionRemoteBlockedSend(false);
-   params.connsTransAttr.setOptionRemoteBlockedReceive(true);
-   params.connsTransAttr.setOptionRemotePool(true);
-   params.connsTransAttr.setOptionStlVecForSameLevelCons(false);
-   params.connsTransAttr.setOptionStlVecForScaleCons(false);
-
-#ifndef CAB_MPI
-   if(params.connsTransAttr.getRemoteProtocol() == D3Q19ConnectorTransmitterAttributes::MPI_PROTOCOL) 
-      throw UbException(UB_EXARGS,"MPI Transmitter not available for this compilation without /DCAB_MPI");
-#endif
-
-   string machine = QUOTEME(CAB_MACHINE);
-   string BrueckeFilename;
-   string ZckbndFilename;
-   if(machine == "ARAGORN")     {  BrueckeFilename = "f:/data/bruecke/platte_raw.stl"; ZckbndFilename="f:/data/bruecke/zweiPlatten0.stl";}
-   else if(machine == "LUDWIG") {  BrueckeFilename = "/hpc3lustre/home/sonuphof/Stl-Zeichnungen/platte_raw.stl"; ZckbndFilename="/hpc3lustre/home/sonuphof/Stl-Zeichnungen/2zackenbaender0.stl";}
-   else if(machine == "PIPPIN") {  BrueckeFilename = "C:/platteD291009/sonja2/svn_uphoff/Daten/SFB880/platte-cad/platte_raw.stl"; ZckbndFilename="C:/platteD291009/sonja2/svn_uphoff/Daten/SFB880/platte-cad/2zackenbaender0.stl";}
-   else throw UbException(UB_EXARGS, "unknown CAB_MACHINE");
-
-
-   //////////////////////////////////////////////////////////////////////////
-   //physik
-   //////////////////////////////////////////////////////////////////////////
-   params.Re            = 11900;// 13286;//13286;//gemessen 18.98 m/s...*5.0 zum  testen ob was passiert
-   params.velocity      = 0.01;  
-   params.vx1Init       = 0.01;  
-   params.rhoInit       = 0.0;
-   initWithLogProfile   = true;
-   useLODI              = false;
-
-   params.collModel = D3Q19System::INCOMPGLBEJTLESMODEL;
-   ///////////////Knotenabmessungen:
-   //int KnotenCubeCoarse=40;
-   params.nx[0]      = 120;//60;//86;//43;//65;//50;  //länge
-   params.nx[1]      = 6;///1;//5;// //breite
-   params.nx[2]      = 32;//18;//5;//15;//15; //höhe gebiet
-   params.blocknx[0] = 10;
-   params.blocknx[1] = 10;
-   params.blocknx[2] = 10;
-
-   params.baseLevel   = 0;
-   params.refineLevel = 3;
-
-   int inflowCubeLevel = 1;
-   int bottomLevel     = 1;
-
-   ///////////////Weltabmessungen:
-   double kanalhoeheSI  = 60.0/100.0;//60.0/100.0;//cm, Kanalhöhe
-   double kanalbreiteSI = 9.9/100.0;//1.65/100.0;//13.2/100.0;////40.0/100.0; //cm, Kanalbreite //13.2 zeilbreite
-   double kanallaengeSI = kanalhoeheSI*30.0/18.0;//80.0/100.0;//cm, Kanallänge, ist nicht angegeben
-
-   // double refinewidth1=kanalhoeheSI/10.0;
-
-   double fineNodeDx   = (kanalhoeheSI) / (double)( params.blocknx[2]*params.nx[2]*(1<<params.refineLevel)+1 ); //+1--> gitter liegt jeweils 0.5dx innerhalb
-   double coarseNodeDx = fineNodeDx * (double)(1<<params.refineLevel);//geowerte
-
-   double blockLengthx1 = params.blocknx[0]*coarseNodeDx; //geowerte
-   double blockLengthx2 = blockLengthx1;
-   double blockLengthx3 = blockLengthx1;
-
-   double originX1 = 0.0;//-50.0*propellerDurchmesser;  //geowerte
-   double originX2 = 0.0;//-0.5*blockLengthx2*nx2;
-   double originX3 = 0.0;// minX3 + 0.5*fineNodeDx;
-
-   double geoLength[]   = {  params.nx[0]*blockLengthx1, params.nx[1]*blockLengthx2, params.nx[2]*blockLengthx3}; 
-
-   //position vorderkante cube
-   double originBridgeX1 = 20.0/100.0; //cm, geraten
-   double originBridgeX2 = 0.0;//0.5*params.nx[1]*blockLengthx2-0.5*H-fineNodeDx;
-   double originBridgeX3 = kanalhoeheSI*0.5;//H*0.0-fineNodeDx; //boden
-
-   bool periodicx1 = false;
-   bool periodicx2 = true;
-   bool periodicx3 = false;
-
-#ifndef CAB_MPI
-   if(params.connsTransAttr.getRemoteProtocol() == D3Q19ConnectorTransmitterAttributes::MPI_PROTOCOL) 
-      throw UbException("LbD3Q19MasterTestcases::startChannelFlow - MPI Transmitter not available for this compilation without /DCAB_MPI");
-#endif
-
-   //weitere parameter
-   double raiseVelSteps                  = 0;
-   double startViscosity                 = 1.0/3.0;
-   int    decreaseViscositySteps         = 6000;
-   int    decreaseViscosityStepForHalVis = (int)(1.0/8.0*decreaseViscositySteps);
-
-   if( D3Q19System::isCompModel(params.collModel) ) params.rhoInit = 1.0;
-   //////////////////////////////////////////////////////////////////////////
-   //grid initialization
-   //////////////////////////////////////////////////////////////////////////
-   UBLOG2(logINFO, std::cout, "grid initialization...");
-
-   CoordinateTransformation3D* trafo = new CoordinateTransformation3D(originX1,originX2, originX3, blockLengthx1, blockLengthx2, blockLengthx3);
-   vector< boost::shared_ptr<AMR3DGridAdaptationCriterion> > adapter;
-   UBLOG(logINFO,"set periodic")
-   adapter.push_back( boost::shared_ptr<AMR3DGridAdaptationCriterion>(new AMR3DSetPeriodicAdapter(periodicx1, params.nx[0], periodicx2, params.nx[1], periodicx3, params.nx[2])) );
-      UBLOG(logINFO,"construct block grid")
-   topoService.constructBlockGrid("MyGrid", UbTupleInt6(params.nx[0],params.nx[1],params.nx[2],params.blocknx[0],params.blocknx[1],params.blocknx[2]), params.baseLevel, UbPointerWrapper<CoordinateTransformation3D>(trafo),adapter );
-
-   UBLOG2(logINFO, std::cout, "grid initialization... done");
-
-   //##########################################################################
-
-   double geoOverlap = 3.0*coarseNodeDx;
-
-   //////////////////////////////////////////////////////////////////////////////
-
-   GbTriFaceMesh3D* mesh = GbTriFaceMesh3DCreator::readMeshFromFile(BrueckeFilename, "Netz");
-    mesh->deleteRedundantNodes();
-
-     double x1minMesh = mesh->getX1Minimum(); double x1maxMesh = mesh->getX1Maximum();
-   double x2minMesh = mesh->getX2Minimum(); double x2maxMesh = mesh->getX2Maximum();
-   double x3minMesh = mesh->getX3Minimum(); double x3maxMesh = mesh->getX3Maximum();
-
-   double drehpunktX=x1minMesh+(x1maxMesh-x1minMesh)*0.5;//triFaceMeshS->getX1Centroid();
-   double drehpunktZ=x3minMesh+(x3maxMesh-x3minMesh)*0.5;//triFaceMeshS->getX3Centroid();
-   double drehpunktY=x2minMesh+(x2maxMesh-x2minMesh)*0.5;// seedX2-0.5*nodeDelta;//+nx2*deltaX2+0.5*deltaX2;
-
-     mesh->rotateAroundPoint(drehpunktZ,drehpunktX,drehpunktY,90.0,0.0,0.0);  //TriFacMesh-KO-System anders als LB-KO-System
-
-   x1minMesh = mesh->getX1Minimum();  x1maxMesh = mesh->getX1Maximum();
-   x2minMesh = mesh->getX2Minimum();  x2maxMesh = mesh->getX2Maximum();
-   x3minMesh = mesh->getX3Minimum();  x3maxMesh = mesh->getX3Maximum();
-
-   drehpunktX=x1minMesh+(x1maxMesh-x1minMesh)*0.5;//triFaceMeshS->getX1Centroid();
-   drehpunktZ=x3minMesh+(x3maxMesh-x3minMesh)*0.5;//triFaceMeshS->getX3Centroid();
-   drehpunktY=x2minMesh+(x2maxMesh-x2minMesh)*0.5;// seedX2-0.5*nodeDelta;//+nx2*deltaX2+0.5*deltaX2;
-
-   double H3=1.05/100.0;//cm, Plattendicke
-   double scaleB=H3/(x3maxMesh-x3minMesh);
-   double scaleX2=(geoLength[2]+2.0*coarseNodeDx)/(x2minMesh-x2maxMesh);
-
-   mesh->scale(scaleB,scaleB,scaleB);
-   x1minMesh = mesh->getX1Minimum(); x1maxMesh = mesh->getX1Maximum();
-   x2minMesh = mesh->getX2Minimum(); x2maxMesh = mesh->getX2Maximum();
-   x3minMesh = mesh->getX3Minimum(); x3maxMesh = mesh->getX3Maximum();
-   double offsetXBridge=originBridgeX1;//originBridgeX1;
-   double offsetYBridge=originBridgeX2;//originBridgeX2;
-   double offsetZBridge=originBridgeX3;//originBridgeX3;//-0.5*(x3minMesh-x3maxMesh);
-   //mesh->translate(-x1minMesh+offsetXBridge, -x2minMesh-0.5*offsetYBridge-coarseNodeDx, -x3minMesh+offsetZBridge); 
-   mesh->translate(-x1minMesh+offsetXBridge, -x2minMesh+offsetYBridge-coarseNodeDx, -x3minMesh+offsetZBridge-(x3maxMesh-x3minMesh)*0.5); 
-
-   x1minMesh = mesh->getX1Minimum(); x1maxMesh = mesh->getX1Maximum();
-   x2minMesh = mesh->getX2Minimum(); x2maxMesh = mesh->getX2Maximum();
-   x3minMesh = mesh->getX3Minimum(); x3maxMesh = mesh->getX3Maximum();
-
-   GbSystem3D::writeGeoObject( mesh, UbStaticPathMap::getPath(UbStaticPathMap::GLOBAL)+"/platte", WbWriterVtkXmlBinary::getInstance() );
-
-   //GbTriFaceMesh3D* Bruecke = GbTriFaceMesh3DCreator::getInstance()->readMeshFromFile(BrueckeFilename         ,"Bruecke");
-   // Bruecke->setPointInObjectTest(GbTriFaceMesh3D::RAYCROSSING);//, HALFSPACE, MEGARAY, SEGURA, GELLER)
-   //D3Q19AMRTriFaceMeshInteractor* triInteractor = new D3Q19AMRTriFaceMeshInteractor(mesh, grid,new D3Q19NoSlipBCAdapter, AMR3DInteractor::SOLID);
-   boost::shared_ptr<D3Q19AMRTriFaceMeshInteractor> triBridgeInteractor( new D3Q19AMRTriFaceMeshInteractor( mesh,new D3Q19NoSlipBCAdapter,AMR3DInteractor::SOLID,"bridge") );
-
-   //grid->addAndInitInteractor(triInteractor);
-   interactorService.addInteractor(triBridgeInteractor);
-
-     //////////////////////////////////////////////////////////////////////////////
-
- //////////////////////////////////////////////////////////////////////////
-   // Zackenband
-   //////////////////////////////////////////////////////////////////////////
-     GbTriFaceMesh3D* meshBand = GbTriFaceMesh3DCreator::readMeshFromFile(ZckbndFilename, "NetzBand");
-    meshBand->deleteRedundantNodes();
-
-   double x1minMeshB = meshBand->getX1Minimum(); double x1maxMeshB = meshBand->getX1Maximum();
-   double x2minMeshB = meshBand->getX2Minimum(); double x2maxMeshB = meshBand->getX2Maximum();
-   double x3minMeshB = meshBand->getX3Minimum(); double x3maxMeshB = meshBand->getX3Maximum();
-
-   //double drehpunktXB=x1minMeshB+(x1maxMeshB-x1minMeshB)*0.5;//triFaceMeshS->getX1Centroid();
-   //double drehpunktZB=x3minMeshB+(x3maxMeshB-x3minMeshB)*0.5;//triFaceMeshS->getX3Centroid();
-   //double drehpunktYB=x2minMeshB+(x2maxMeshB-x2minMeshB)*0.5;// seedX2-0.5*nodeDelta;//+nx2*deltaX2+0.5*deltaX2;
-
-    // meshBand->rotateAroundPoint(drehpunktZB,drehpunktXB,drehpunktYB,90.0,0.0,0.0);  //TriFacMesh-KO-System anders als LB-KO-System
-
-   x1minMeshB = meshBand->getX1Minimum();  x1maxMeshB = meshBand->getX1Maximum();
-   x2minMeshB = meshBand->getX2Minimum();  x2maxMeshB = meshBand->getX2Maximum();
-   x3minMeshB = meshBand->getX3Minimum();  x3maxMeshB = meshBand->getX3Maximum();
-
-   //drehpunktXB=x1minMeshB+(x1maxMeshB-x1minMeshB)*0.5;//triFaceMeshS->getX1Centroid();
-   //drehpunktZB=x3minMeshB+(x3maxMeshB-x3minMeshB)*0.5;//triFaceMeshS->getX3Centroid();
-   //drehpunktYB=x2minMeshB+(x2maxMeshB-x2minMeshB)*0.5;// seedX2-0.5*nodeDelta;//+nx2*deltaX2+0.5*deltaX2;
-
-   double H1B=1.5/100.0;//0.05;//cm, Banddicke..nachschauen!!!
-   double scaleBand=H1B/(x1maxMeshB-x1minMeshB);//H3B/(x3maxMeshB-x3minMeshB);
- //  double scaleX2B=(geoLength[2]+2.0*coarseNodeDx)/(x2minMeshB-x2maxMeshB);
-
-   meshBand->scale(scaleBand,scaleBand,scaleBand);
-   x1minMeshB = meshBand->getX1Minimum(); x1maxMeshB = meshBand->getX1Maximum();
-   x2minMeshB = meshBand->getX2Minimum(); x2maxMeshB = meshBand->getX2Maximum();
-   x3minMeshB = meshBand->getX3Minimum(); x3maxMeshB = meshBand->getX3Maximum();
-   double dBandX=0.5/100.0;//1.29; //15mm-2.1mm Absand von Bandvorderkante
-   double dBandY=0.0/100.0;
-   double dBandZ=0.223/100.0;//0.344;//....
-   double offsetXBridgeB=x1minMesh+dBandX;//originBridgeX1+dBandX;//originBridgeX1;
-   double offsetYBridgeB=originBridgeX2+dBandY;//originBridgeX2;
-   double offsetZBridgeB=originBridgeX3+dBandZ;//originBridgeX3;//-0.5*(x3minMesh-x3maxMesh);
-   //mesh->translate(-x1minMesh+offsetXBridge, -x2minMesh-0.5*offsetYBridge-coarseNodeDx, -x3minMesh+offsetZBridge); 
-   meshBand->translate(-x1minMeshB+offsetXBridgeB, -x2minMeshB+offsetYBridgeB-coarseNodeDx, -x3minMeshB+offsetZBridgeB);//-(x3maxMeshB-x3minMeshB)*0.5); 
-
-   x1minMeshB = meshBand->getX1Minimum(); x1maxMeshB = meshBand->getX1Maximum();
-   x2minMeshB = meshBand->getX2Minimum(); x2maxMeshB = meshBand->getX2Maximum();
-   x3minMeshB = meshBand->getX3Minimum(); x3maxMeshB = meshBand->getX3Maximum();
-
-   GbSystem3D::writeGeoObject( meshBand, UbStaticPathMap::getPath(UbStaticPathMap::GLOBAL)+"/Band", WbWriterVtkXmlBinary::getInstance() );
-
-   //GbTriFaceMesh3D* Bruecke = GbTriFaceMesh3DCreator::getInstance()->readMeshFromFile(BrueckeFilename         ,"Bruecke");
-   // Bruecke->setPointInObjectTest(GbTriFaceMesh3D::RAYCROSSING);//, HALFSPACE, MEGARAY, SEGURA, GELLER)
-   //D3Q19AMRTriFaceMeshInteractor* triInteractor = new D3Q19AMRTriFaceMeshInteractor(mesh, grid,new D3Q19NoSlipBCAdapter, AMR3DInteractor::SOLID);
-   boost::shared_ptr<D3Q19AMRTriFaceMeshInteractor> triBandInteractor( new D3Q19AMRTriFaceMeshInteractor( meshBand,new D3Q19NoSlipBCAdapter,AMR3DInteractor::SOLID,"band") );
-   interactorService.addInteractor(triBandInteractor);
-    /////////////////Band2
-
-
-      GbTriFaceMesh3D* meshBand2 = GbTriFaceMesh3DCreator::readMeshFromFile(ZckbndFilename, "NetzBand2");
-    meshBand->deleteRedundantNodes();
-
-   double x1minMeshB2 = meshBand2->getX1Minimum(); double x1maxMeshB2 = meshBand2->getX1Maximum();
-   double x2minMeshB2 = meshBand2->getX2Minimum(); double x2maxMeshB2 = meshBand2->getX2Maximum();
-   double x3minMeshB2 = meshBand2->getX3Minimum(); double x3maxMeshB2 = meshBand2->getX3Maximum();
-
-   //double drehpunktXB2=x1minMeshB2+(x1maxMeshB2-x1minMeshB2)*0.5;//triFaceMeshS->getX1Centroid();
-   //double drehpunktZB2=x3minMeshB2+(x3maxMeshB2-x3minMeshB2)*0.5;//triFaceMeshS->getX3Centroid();
-   //double drehpunktYB2=x2minMeshB2+(x2maxMeshB2-x2minMeshB2)*0.5;// seedX2-0.5*nodeDelta;//+nx2*deltaX2+0.5*deltaX2;
-
-//     meshBand2->rotateAroundPoint(drehpunktZB2,drehpunktXB2,drehpunktYB2,90.0,0.0,0.0);  //TriFacMesh-KO-System anders als LB-KO-System
-
-   x1minMeshB2 = meshBand2->getX1Minimum();  x1maxMeshB2 = meshBand2->getX1Maximum();
-   x2minMeshB2 = meshBand2->getX2Minimum();  x2maxMeshB2 = meshBand2->getX2Maximum();
-   x3minMeshB2 = meshBand2->getX3Minimum();  x3maxMeshB2 = meshBand2->getX3Maximum();
-
-   //drehpunktXB2=x1minMeshB2+(x1maxMeshB2-x1minMeshB2)*0.5;//triFaceMeshS->getX1Centroid();
-   //drehpunktZB2=x3minMeshB2+(x3maxMeshB2-x3minMeshB2)*0.5;//triFaceMeshS->getX3Centroid();
-   //drehpunktYB2=x2minMeshB2+(x2maxMeshB2-x2minMeshB2)*0.5;// seedX2-0.5*nodeDelta;//+nx2*deltaX2+0.5*deltaX2;
-
-   double H1B2=1.5/100.0;//0.05;//cm, Banddicke..nachschauen!!!
-   double scaleBand2=H1B2/(x1maxMeshB2-x1minMeshB2);//H3B/(x3maxMeshB-x3minMeshB);
-
-   meshBand2->scale(scaleBand2,scaleBand2,scaleBand2);
-   x1minMeshB2 = meshBand2->getX1Minimum(); x1maxMeshB2 = meshBand2->getX1Maximum();
-   x2minMeshB2 = meshBand2->getX2Minimum(); x2maxMeshB2 = meshBand2->getX2Maximum();
-   x3minMeshB2 = meshBand2->getX3Minimum(); x3maxMeshB2 = meshBand2->getX3Maximum();
-   double dBandX2=0.5/100.0;//1.29;
-   double dBandY2=0.5/100.0;
-   double dBandZ2=0.223/100.0;//0.344;//...
-   double offsetXBridgeB2=x1minMesh+dBandX2;//originBridgeX1;
-   double offsetYBridgeB2=originBridgeX2+dBandY2;//originBridgeX2;
-   double offsetZBridgeB2=originBridgeX3+dBandZ2;//originBridgeX3;//-0.5*(x3minMesh-x3maxMesh);
-   //mesh->translate(-x1minMesh+offsetXBridge, -x2minMesh-0.5*offsetYBridge-coarseNodeDx, -x3minMesh+offsetZBridge); 
-   meshBand2->translate(-x1minMeshB2+offsetXBridgeB2, -x2minMeshB2+offsetYBridgeB2-coarseNodeDx, -x3minMeshB2+offsetZBridgeB2);//-(x3maxMeshB2-x3minMeshB2)*0.5); 
-
-   x1minMeshB2 = meshBand2->getX1Minimum(); x1maxMeshB2 = meshBand2->getX1Maximum();
-   x2minMeshB2 = meshBand2->getX2Minimum(); x2maxMeshB2 = meshBand2->getX2Maximum();
-   x3minMeshB2 = meshBand2->getX3Minimum(); x3maxMeshB2 = meshBand2->getX3Maximum();
-
-   GbSystem3D::writeGeoObject( meshBand2, UbStaticPathMap::getPath(UbStaticPathMap::GLOBAL)+"/Band2", WbWriterVtkXmlBinary::getInstance() );
-
-   //GbTriFaceMesh3D* Bruecke = GbTriFaceMesh3DCreator::getInstance()->readMeshFromFile(BrueckeFilename         ,"Bruecke");
-   // Bruecke->setPointInObjectTest(GbTriFaceMesh3D::RAYCROSSING);//, HALFSPACE, MEGARAY, SEGURA, GELLER)
-   //D3Q19AMRTriFaceMeshInteractor* triInteractor = new D3Q19AMRTriFaceMeshInteractor(mesh, grid,new D3Q19NoSlipBCAdapter, AMR3DInteractor::SOLID);
-   boost::shared_ptr<D3Q19AMRTriFaceMeshInteractor> triBand2Interactor( new D3Q19AMRTriFaceMeshInteractor( meshBand2,new D3Q19NoSlipBCAdapter,AMR3DInteractor::SOLID,"band2") );
-    interactorService.addInteractor(triBand2Interactor);
-   
-   //////////////////////////////////////////////////////////////////////////
-   // refine
-   //////////////////////////////////////////////////////////////////////////
-                        
-
-
-   
-
-
-
-   ///////////platte ausmessen:
-   x1minMesh = mesh->getX1Minimum(); x1maxMesh = mesh->getX1Maximum();
-   x2minMesh = mesh->getX2Minimum(); x2maxMesh = mesh->getX2Maximum();
-   x3minMesh = mesh->getX3Minimum(); x3maxMesh = mesh->getX3Maximum();
-  double deltaX3Platte=(x3maxMesh-x3minMesh);
-
-
-      GbCuboid3D* refine1PlatteCube = new GbCuboid3D(  originX1-geoOverlap   , originX2-geoOverlap  , x3minMesh-H3
-      , x1maxMesh+H3*5.0, originX2+geoOverlap+geoLength[1], x3maxMesh+H3);
-   boost::shared_ptr<AMR3DBlockAdaptationCriterion> refineAdapterP1(new AMR3DCrossAndInsideGbObject3DAdapter(refine1PlatteCube,0,params.refineLevel-6));
-   topoService.adaptGridByBlockCriterion(refineAdapterP1);
-
-        GbCuboid3D* refine2PlatteCube = new GbCuboid3D(  originX1-geoOverlap   , originX2-geoOverlap  , x3minMesh-H3*0.5
-      , x1maxMesh+H3*5.0, originX2+geoOverlap+geoLength[1], x3maxMesh+H3);
-   boost::shared_ptr<AMR3DBlockAdaptationCriterion> refineAdapterP2(new AMR3DCrossAndInsideGbObject3DAdapter(refine2PlatteCube,0,params.refineLevel-5));
-   topoService.adaptGridByBlockCriterion(refineAdapterP2);
-
-        GbCuboid3D* refine3PlatteCube = new GbCuboid3D(  originX1-geoOverlap  , originX2-geoOverlap  , x3minMesh-H3*0.5
-      , x1maxMesh+H3*5.0, originX2+geoOverlap+geoLength[1], x3maxMesh+H3*0.5);
-   boost::shared_ptr<AMR3DBlockAdaptationCriterion> refineAdapterP3(new AMR3DCrossAndInsideGbObject3DAdapter(refine3PlatteCube,0,params.refineLevel-4));   //dieser hier hat eine ecke 
-   topoService.adaptGridByBlockCriterion(refineAdapterP3);
-
-        GbCuboid3D* refine4PlatteCube = new GbCuboid3D(   originX1-geoOverlap  , originX2-geoOverlap  , x3minMesh+deltaX3Platte*0.6
-      ,  x1maxMesh+H3*5.0, originX2+geoOverlap+geoLength[1], x3maxMesh+H3*0.25);
-   boost::shared_ptr<AMR3DBlockAdaptationCriterion> refineAdapterP4(new AMR3DCrossAndInsideGbObject3DAdapter(refine4PlatteCube,0,params.refineLevel-3));   //weil der hier zu hoch ist
-   topoService.adaptGridByBlockCriterion(refineAdapterP4);
-
-           GbCuboid3D* refine5PlatteCube = new GbCuboid3D(   originX1-geoOverlap , originX2-geoOverlap  , x3minMesh+deltaX3Platte*0.8
-      ,  x1maxMesh+H3*5.0, originX2+geoOverlap+geoLength[1], x3maxMesh+H3*0.00375);
-   boost::shared_ptr<AMR3DBlockAdaptationCriterion> refineAdapterP5(new AMR3DCrossAndInsideGbObject3DAdapter(refine5PlatteCube,0,params.refineLevel-2));
-   topoService.adaptGridByBlockCriterion(refineAdapterP5);
-
-  //            GbCuboid3D* refine6PlatteCube = new GbCuboid3D(   x1minMeshB2+( x1maxMeshB2- x1minMeshB2)*0.8   , originX2-geoOverlap  , x3minMesh+deltaX3Platte*0.9
-  //    ,  x1maxMesh+H3*0.075, originX2+geoOverlap+geoLength[1], x3maxMesh+2.0*fineNodeDx);
-  // boost::shared_ptr<AMR3DBlockAdaptationCriterion> refineAdapterP6(new AMR3DCrossAndInsideGbObject3DAdapter(refine6PlatteCube,0,params.refineLevel-1));
-  // topoService.adaptGridByBlockCriterion(refineAdapterP6);
-
-           GbCuboid3D* refine6PlatteCube = new GbCuboid3D(   originX1-geoOverlap   , originX2-geoOverlap  , x3minMesh+deltaX3Platte*0.9
-      ,  x1maxMesh+H3*5.0, originX2+geoOverlap+geoLength[1], x3maxMesh+deltaX3Platte*0.9);
-   boost::shared_ptr<AMR3DBlockAdaptationCriterion> refineAdapterP6(new AMR3DCrossAndInsideGbObject3DAdapter(refine6PlatteCube,0,params.refineLevel-1));
-   topoService.adaptGridByBlockCriterion(refineAdapterP6);
-
-     UBLOG2(logINFO, std::cout, "Refinement..done");
-   //blockverhältnis von 2:1 herstellen:
-   UBLOG(logINFO,"ratio")
-      boost::shared_ptr<AMR3DBlockAdaptationCriterion> ratioAdapter(new AMR3DBlockRatioAdapter(params.refineLevel));
-   topoService.adaptGridByBlockCriterion(ratioAdapter);
-
-
-
-   //////////////////////////////////////////////////////////////////////////
-   //walls                                                                                                   
-   ////////////////////////////////////////////////////////////////////////// 
-   int noSlipSecOpt = 1; //0=2nd order BB 1=simple BB
-   int slipSecOpt   = 1; //0=2nd order BB 1=simple BB
-
-   ////x1x2-walls:                                                                                             
-   GbCuboid3D* wallsX1X2min = new GbCuboid3D(  originX1-geoOverlap   , originX2-geoOverlap  , originX3-geoOverlap
-      , originX1+geoLength[0]+geoOverlap, originX2+geoOverlap+geoLength[1], originX3-0.5*fineNodeDx);
-   boost::shared_ptr<D3Q19AMRInteractor> wallsX1X2minInteractor( new D3Q19AMRInteractor( wallsX1X2min,new D3Q19SlipBCAdapter(slipSecOpt),AMR3DInteractor::SOLID,"wallsX1X2min") );
-   if(!params.periodic[2]) interactorService.addInteractor( wallsX1X2minInteractor );
-
-   GbCuboid3D* wallsX1X2max = new GbCuboid3D(  originX1-geoOverlap , originX2-geoOverlap , originX3+geoLength[2]+0.5*fineNodeDx            
-      , originX1+geoLength[0]+geoOverlap, originX2+geoOverlap+geoLength[1], originX3+geoLength[2]+geoOverlap); 
-   boost::shared_ptr<D3Q19AMRInteractor> wallsX1X2maxInteractor( new D3Q19AMRInteractor( wallsX1X2max,new D3Q19SlipBCAdapter(slipSecOpt),AMR3DInteractor::SOLID,"wallsX1X2max") ) ;  
-   if(!params.periodic[2]) interactorService.addInteractor( wallsX1X2maxInteractor );
-
-
-  
-
-   //##########################################################################
-   //## physical parameters
-   //##########################################################################
-   double smagorinskiConstant = 0.18;
-
-
-   double rhoLB         = 1.0;
-   double rhoReal       = 1.0;
-   double nueReal  = 0.000015;//0.015;
-
-   double hReal         = 0.0105;//<-m     1.05;//Plattendicke in cm(! cm nicht m !)
-   double uReal         = params.Re*nueReal/hReal;
-
-   //##Machzahl:
-   //#Ma     = uReal/csReal
-   double Ma      = 0.05;//0.0553;//Ma-Real!
-   double csReal  = uReal/Ma;
-   double hLB     = hReal/coarseNodeDx;
-
-   D3Q19UnitConverter unitConverter(hReal, csReal, rhoReal, hLB );
-
-   double uLB           = uReal   * unitConverter.getFactorVelocityWToLb();
-   double nueLB         = nueReal * unitConverter.getFactorViscosityWToLb();
-
-   params.velocity = uLB;
-   double viscosity = nueLB;
-
-   //////////////////////////////////////////////////////////////////////////
-   // BCs
-   //////////////////////////////////////////////////////////////////////////
-   //////////////////////////////////////////////////////////////////////////
-   // inflow
-   //////////////////////////////////////////////////////////////////////////
-
-
-   double uLB2=uLB*0.96*1.02;//*0.5;
-
-   vector<D3Q19BCFunction> velcX1BCs,dummy;
-
-   if(raiseVelSteps>0)
-   {
-      mu::Parser inflowProfile1;
-         inflowProfile1.SetExpr("uLB"); 
-    
-          inflowProfile1.DefineConst("uLB",uLB2);
-   }
-   mu::Parser inflowProfile;
-   inflowProfile.SetExpr("uLB"); 
-
-   inflowProfile.DefineConst("uLB",uLB2);
-   //inflowProfile.DefineConst("xlbnachxworld",xlbnachxworld);
-   velcX1BCs.push_back(D3Q19BCFunction(inflowProfile,raiseVelSteps,D3Q19BCFunction::INFCONST));
-
-
-   GbCuboid3D* velBCCuboid = NULL;
-   velBCCuboid = new GbCuboid3D(  originX1-geoOverlap, originX2-geoOverlap, originX3-geoOverlap
-      , originX1-fineNodeDx, originX2+geoLength[1]+geoOverlap, originX3+geoLength[2]+geoOverlap);
-
-   boost::shared_ptr< D3Q19AMRInteractor> velBCInteractor(new D3Q19AMRInteractor(velBCCuboid,AMR3DInteractor::SOLID,"velBC")); 
-   velBCInteractor->addBCAdapter(new D3Q19VelocityBCAdapter(velcX1BCs,dummy,dummy) );
-   interactorService.addInteractor( velBCInteractor ); 
-
-
-
-   //////////////////////////////////////////////////////////////////////////
-   // outflow
-   //////////////////////////////////////////////////////////////////////////
-   GbCuboid3D* densCuboid = NULL;
-   densCuboid = new GbCuboid3D(  originX1+geoLength[0]+fineNodeDx, originX2-geoOverlap             , originX3-geoOverlap
-      , originX1+geoLength[0]+geoOverlap, originX2+geoLength[1]+geoOverlap, originX3+geoLength[2]+geoOverlap );
-
-   if(useLODI)
-   {
-      float LX1 = (float)((densCuboid->getX1Minimum()-velBCCuboid->getX1Maximum())/coarseNodeDx);
-      float LX2 = -1.0f;
-      float LX3 = -1.0f;
-
-      D3Q19DensityLodiBCAdapter* lodiBCadapter = new D3Q19DensityLodiBCAdapter(3,LX1,LX2,LX3,params.rhoInit,params.vx1Init,params.vx2Init,params.vx3Init,params.rhoInit);
-      boost::shared_ptr< D3Q19AMRInteractor> densInteractor(new D3Q19AMRInteractor(densCuboid,lodiBCadapter,AMR3DInteractor::SOLID,"lodiDensBC"));
-      interactorService.addInteractor( densInteractor ); 
-   }
-   else
-   {
-      boost::shared_ptr< D3Q19AMRInteractor> densInteractor( new D3Q19AMRInteractor(densCuboid,new D3Q19DensityBCAdapter(params.rhoInit),AMR3DInteractor::SOLID,"densBC") );
-      interactorService.addInteractor( densInteractor ); 
-   }
-
-   UBLOG(logINFO, "*****************************************");
-   UBLOG(logINFO, "* Parameters                            *");
-   UBLOG(logINFO, "* Re            ="<<params.Re);
-   UBLOG(logINFO, "* Ma            ="<<Ma);
-   UBLOG(logINFO, "* uReal         ="<<uReal);
-   UBLOG(logINFO, "* nueReal       ="<<nueReal);
-   UBLOG(logINFO, "* nue           ="<<nueLB);
-   UBLOG(logINFO, "* velocity      ="<<uLB);
-   UBLOG(logINFO, "* LX1 (world/LB)="<<kanallaengeSI<<"/"<<kanallaengeSI/coarseNodeDx);
-   UBLOG(logINFO, "* LX2 (world/LB)="<<kanalbreiteSI<<"/"<<kanalbreiteSI/coarseNodeDx);
-   UBLOG(logINFO, "* LX3 (world/LB)="<<kanalhoeheSI<<"/"<<kanalhoeheSI/coarseNodeDx);
-   UBLOG(logINFO, "* dxInflow-Cube ="<<velBCCuboid->getX1Maximum()-mesh->getX1Minimum());
-   UBLOG(logINFO, "* cdx           ="<<coarseNodeDx);
-   UBLOG(logINFO, "* fdx           ="<<fineNodeDx);
-  // UBLOG(logINFO, "* H_world       ="<<H);
-  // UBLOG(logINFO, "* H_LB          ="<<H/coarseNodeDx);
-   //UBLOG(logINFO, "* H_log_world   ="<<delta);
-   //UBLOG(logINFO, "* H_log_LB      ="<<delta/baseDX);
-   //UBLOG(logINFO, "* alpha         ="<<alpha);
-   UBLOG(logINFO, "* inflowProfile ="<<inflowProfile.GetExpr());
-   UBLOG(logINFO, "* dx_base       ="<<coarseNodeDx<<" == "<<coarseNodeDx);
-   UBLOG(logINFO, "* dx_refine     ="<<fineNodeDx<<" == "<<fineNodeDx );
-   UBLOG(logINFO, "* collModel     ="<<params.collModel);
-   UBLOG(logINFO, "* raiseVelSteps ="<<raiseVelSteps);
-   UBLOG(logINFO, "* startVis      ="<<startViscosity);
-   UBLOG(logINFO, "* raiseVisSteps ="<<decreaseViscositySteps);
-   UBLOG(logINFO, "* nx1/2/3       ="<<params.nx[0]<<"/"<<params.nx[1]<<"/"<<params.nx[2]);
-   UBLOG(logINFO, "* blocknx1/2/3  ="<<params.blocknx[0]<<"/"<<params.blocknx[1]<<"/"<<params.blocknx[2]);
-   UBLOG(logINFO, "* x3Periodic    ="<<params.periodic[2]);
-   UBLOG(logINFO, "* useDirectConnectors           "<< params.connsTransAttr.useDirectConnectors()        ); 
-   UBLOG(logINFO, "* useSTLVectorForSameLevelCons  "<< params.connsTransAttr.useStlVecForSameLevelCons()  ); 
-   UBLOG(logINFO, "* useSTLVectorForScaleCons      "<< params.connsTransAttr.useStlVecForScaleCons()      ); 
-   UBLOG(logINFO, "* useConsForNotActiveBlocks     "<< params.connsTransAttr.useConsForNotActiveBlocks() ); 
-   UBLOG(logINFO, "* LODI           ="<< (useLODI ? "ON" : "OFF") ); 
-   UBLOG(logINFO, "*****************************************");
-   UBLOGML(logINFO, "UnitConverter:"<<unitConverter.toString());
-   UBLOG(logINFO, "*****************************************");
-
-   //////////////////////////////////////////////////////////////////////////
-   //geo holen und setzen!!!
-   //////////////////////////////////////////////////////////////////////////
-   topoService.getAndAddAndInitInteractors();
-
-   //////////////////////////////////////////////////////////////////////////
-   UBLOG(logINFO, "//////////////////////////////////////////////////////////////////");
-   int nofBlocks = topoService.getNumberOfBlocks(true);
-   UBLOG(logINFO, "//active blocks after interactors: "<<nofBlocks);
-   int nofAllBlocks = topoService.getNumberOfBlocks(false);
-   UBLOG(logINFO, "//total blocks after interactors: "<<nofAllBlocks);
-   UBLOG(logINFO, " -> ~"<<nofBlocks*(params.blocknx[0]+1)*(params.blocknx[1]+1)*(params.blocknx[2]+1)<<" nodes");
-   UBLOG(logINFO, "//////////////////////////////////////////////////////////////////");
-
-   //partitionierung
-   UBLOG2(logINFO,cout, "levelweise METIS SEGMENTIERUNG!!!!")
-      boost::shared_ptr<AMR3DGridAdaptationCriterion> partioningAdapter(new AMR3DGridLevelPartitionMetisAdapter( (int)calcServices.size()
-      , D3Q19MetisAdapterTools::getMetisDirsAndWeights(  params.blocknx[0]
-   , params.blocknx[1]
-   , params.blocknx[2] )
-      , params.connsTransAttr.useConsForNotActiveBlocks()
-      , D3Q19MetisAdapterTools::getD3Q19GetBlockWeightFunctor(false) ) );   ///////hier false auf keine gewichtung - default:doppelte gewichtung für fine
-   //  boost::shared_ptr<AMR3DGridAdaptationCriterion> partioningAdapter(new AMR3DGridPartitionOneDirectionAdapter((int)calcServices.size()) );   
-  // UBLOG2(logINFO,"params.connsTransAttr.useConsForNotActiveBlocks():" ); 
-   //UBLOG2(logINFO,params.connsTransAttr.useConsForNotActiveBlocks() );         
-   topoService.adaptGridByGridCriterion(partioningAdapter);
-   topoService.writeBlocksToAVS(outpath+"/blocksSegments",false);
-   UBLOG2(logINFO,cout, "BlockSegmentsGeschriebe")
-      //clientgrids erzeugen
-      topoService.createClientGridsAndSendBlocksToClients("client",params.connsTransAttr,params.threadedClientCall);
-   UBLOG2(logINFO,cout, "createClientGrids usw")
-
-
-
-      boost::shared_ptr<D3Q19ClientGridWriteInteractorNodeFiles> writeInteractorTransNodesAdapter(new D3Q19ClientGridWriteInteractorNodeFiles("shared",D3Q19ClientGridWriteInteractorNodeFiles::ValueProjOnGeoVertex)); 
-   writeInteractorTransNodesAdapter->setScheduler(UbSchedule(10000));
-   writeInteractorTransNodesAdapter->addInteractorID( triBridgeInteractor ->getName() );
-
-      //physik-daten zuweisen
-      D3Q19GridPhysicsAdapter* physicsAdapter = new D3Q19GridPhysicsAdapter(params.collModel,viscosity,0.0,0.0,0.0);
-   physicsAdapter->setSmagorinskyConstant(smagorinskiConstant);
-   physicsAdapter->setUnitConverter( unitConverter );
-   boost::shared_ptr<AMR3DGridAdaptationCriterion>  physicsAdapterPtr(physicsAdapter);
-
-   //UbPointerWrapper<AMR3DGridAdaptationCriterion>   decreaseViscosityAdapter( new D3Q19GridPhysicsAdapter(decreaseViscositySteps, startViscosity, viscosity, decreaseViscosityStepForHalVis) );
-   boost::shared_ptr<AMR3DGridAdaptationCriterion>  decreaseViscosityAdapter( new D3Q19GridPhysicsAdapter(decreaseViscositySteps, startViscosity, viscosity, decreaseViscosityStepForHalVis) );
-   //boost::shared_ptr<AMR3DBlockAdaptationCriterion> initadapter(new D3Q19InitDistributionsAdapter(params.connsTransAttr.useConsForNotActiveBlocks(), params.collModel, params.rhoInit,(params.vx1Init*0.96),params.vx2Init,params.vx3Init, 0, AMR3DSystem::MAXLEVEL));
-
-   boost::shared_ptr<AMR3DGridAdaptationCriterion> initadapter(new D3Q19InitDistributionsGridAdapter(params.rhoInit,params.vx1Init,params.vx2Init,params.vx3Init));
-   if(initWithLogProfile) 
-   {
-    
-      boost::dynamic_pointer_cast<D3Q19InitDistributionsGridAdapter>(initadapter)->setVx1( inflowProfile );
-   }
-
-
-   boost::shared_ptr<D3Q19ClientGridPostProcessFileAdapter> writeDumpsAdapter(new D3Q19ClientGridPostProcessFileAdapter("shared",true,false));
-   writeDumpsAdapter->setScheduler(params.distributedDumpScheduler);
-   writeDumpsAdapter->setUseFileCounterInsteadTimestepForGlobalPVD(true);
-
-
-   UBLOG(logINFO, "put physicsAdapter to clients");
-   calculationManager.adaptGridByGridCriterionAtClients(physicsAdapterPtr,params.threadedClientCall);
-
-   boost::shared_ptr<AMR3DGridAdaptationCriterion>  hackAdapter(new D3Q19ChangeSlipToNoSlipGridAdapter());
-   UBLOG2(logINFO, std::cout, "add hackAdapter to clients");
-   calculationManager.addTimeDependentGridAdapterAtClients(hackAdapter,params.threadedClientCall);
-   UBLOG2(logINFO, std::cout, "## adapter stuff - start"); 
-
-   UBLOG(logINFO, "getAndAddInteractorsAtClients at clients");
-   calculationManager.getAndAddInteractorsAtClients(params.threadedClientCall);
-
-   UBLOG(logINFO, "put initadapter to clients");
-   calculationManager.adaptGridByGridCriterionAtClients(initadapter,params.threadedClientCall);
-   UBLOG(logINFO, "put setConnectorAdapter to clients");
-   boost::shared_ptr<AMR3DGridAdaptationCriterion>  setConnectorAdapter(new D3Q19SetConnectorsGridAdapter( ) );
-   calculationManager.adaptGridByGridCriterionAtClients(setConnectorAdapter,params.threadedClientCall);
-
-   if(decreaseViscositySteps) calculationManager.addTimeDependentGridAdapterAtClients(decreaseViscosityAdapter,params.threadedClientCall);
-
-   UBLOG(logINFO,"put writeAdapter to calc clients")
-      calculationManager.addClientGridAdapterAtClients(writeDumpsAdapter,params.threadedClientCall);
-   UBLOG(logINFO, "put writeInteractorTransNodesAdapter to clients" )
-      calculationManager.addClientGridAdapterAtClients(writeInteractorTransNodesAdapter, params.threadedClientCall); 
-
-   //remote connetoren
-   UBLOG(logINFO, "setRemoteConnectorsOnCalcServices at clients");
-   topoService.setRemoteConnectorsOnCalcServices(D3Q19System::getAMR3DDirsForD3Q19Dirs(),params.connsTransAttr,params.threadedClientCall);
-
-    UbFileOutputASCII out(UbStaticPathMap::getPath(UbStaticPathMap::GLOBAL)+"/params.txt");
-   if(out.isOpen())
-   {
-      UBLOG(logINFO, "save params to "<<out.getFileName());
-      params.write(&out);
-      out.writeLine();
-      out.writeString("useLodi                  "); out.writeBool(useLODI);             out.writeLine();
-      out.writeString("initWithLogProfile       "); out.writeBool(initWithLogProfile);  out.writeLine();
-      UBLOG(logINFO, " done" )
-   }
-
-
-   //##########################################################################
-   //## spongelayer
-   //##########################################################################
-   UBLOG2(logINFO, std::cout, "##################################################################");
-   UBLOG2(logINFO, std::cout, "## spongelayer - start");
-
-   GbCuboid3D* spongeCubeLeft = new GbCuboid3D( velBCCuboid->getX1Minimum() 
-      , velBCCuboid->getX2Minimum() 
-      , velBCCuboid->getX3Minimum() 
-      , velBCCuboid->getX1Maximum()+(velBCCuboid->getX1Maximum()-velBCCuboid->getX1Minimum() )*0.1-1.0*coarseNodeDx 
-      , velBCCuboid->getX2Maximum() 
-      , velBCCuboid->getX3Maximum() );
-
-   GbSystem3D::writeGeoObject( spongeCubeLeft, UbStaticPathMap::getPath(UbStaticPathMap::GLOBAL)+"/spongeIn", WbWriterVtkXmlBinary::getInstance() );
-   boost::shared_ptr<AMR3DGridAdaptationCriterion>  spongeAdapterLeft( new SpD3Q19SpongeLayerAdapter(spongeCubeLeft, 1./3., nueLB,  SpD3Q19SpongeLayerAdapter::ALTERNATIONX1) );
-   calculationManager.adaptGridByGridCriterionAtClients(spongeAdapterLeft ,params.threadedClientCall);
-
-
-
-   UBLOG2(logINFO, std::cout, "## spongelayerOutflow - start");
-                                                double H=kanallaengeSI/10.0;
-   GbCuboid3D* spongeCubeRight = new GbCuboid3D( originX1+geoLength[0]+fineNodeDx-H 
-      , originX2-geoOverlap             , originX3-geoOverlap
-      , originX1+geoLength[0]+geoOverlap, originX2+geoLength[1]+geoOverlap, originX3+geoLength[2]+geoOverlap   );   
-
-   GbSystem3D::writeGeoObject( spongeCubeRight, UbStaticPathMap::getPath(UbStaticPathMap::GLOBAL)+"/spongeOut", WbWriterVtkXmlBinary::getInstance() );
-   boost::shared_ptr<AMR3DGridAdaptationCriterion>  spongeAdapterRight( new SpD3Q19SpongeLayerAdapter(spongeCubeRight,  nueLB,1./3.,  SpD3Q19SpongeLayerAdapter::ALTERNATIONX1) );
-   calculationManager.adaptGridByGridCriterionAtClients(spongeAdapterRight ,params.threadedClientCall);
-   UBLOG2(logINFO, std::cout, "## spongelayer - end");
-   UBLOG2(logINFO, std::cout, "##################################################################");
-
-
-
-   //GbCuboid3D* densCuboid = NULL;
-   //##########################################################################
-
-   calculationManager.calculate(params.calcSteps, UbStaticPathMap::GLOBAL, params.schedulers);
-
-   UBLOG(logINFO, "warte nun auf ende!!");
-
-}
-
+
+
+..damit wir gleich damit anfangen können. So sieht das Setup aus.
+Sonja
+
+
+SpD3Q19Plattenanstroemung.hpp
+
+#include <topology/amr3d/blockadaptation/AMR3DCrossAndInsideGbObject3DAdapter.h>
+//AMR3DCrossAndInsideGbObject3DAdapter
+#include <topology/amr3d/lbmd3q19/utils/D3Q19MetisTools.h>
+//#include <topology/amr3d/lbmd3q19/turbulenceWale/gridadaptation/TwD3Q19SpongeLayerAdapter.h>
+#include <topology/amr3d/lbmd3q19/gridadaptation/D3Q19GridInformationGridAdapter.h>
+#include <topology/amr3d/lbmd3q19/gridadaptation/D3Q19SetConnectorsGridAdapter.h>
+#include <topology/amr3d/lbmd3q19/gridadaptation/D3Q19InitDistributionsGridAdapter.h>
+#include <topology/amr3d/gridadaptation/AMR3DGridLevelPartitionMetisAdapter.h>
+#include <topology/amr3d/gridadaptation/AMR3DGridPartitionOneDirectionAdapter.h>
+#include <topology/amr3d/lbmd3q19/bcadapter/D3Q19DensityLodiBCAdapter.h>
+#include <topology/amr3d/lbmd3q19/singlephase/gridadaptation/SpD3Q19SpongeLayerAdapter.h>
+#include <topology/amr3d/lbmd3q19/gridadaptation/D3Q19InitDistributionsGridAdapter.h>
+
+#include <numerics/geometry3d/GbTriFaceMesh3D.h>
+#include <numerics/geometry3d/creator/GbTriFaceMesh3DCreator.h>
+#include <topology/amr3d/lbmd3q19/interactor/D3Q19AMRTriFaceMeshInteractor.h>
+#include <topology/amr3d/lbmd3q19/services/adapter/D3Q19ClientGridWriteInteractorNodeFiles.h>
+#include <topology/amr3d/lbmd3q19/gridadaptation/D3Q19ChangeSlipToNoSlipGridAdapter.h> 
+
+using namespace std;
+
+void SpD3Q19MasterTestcases::start( RcfClient<IRcfIpService>& ipService, 
+                                   RcfClient<IRcfD3Q19TopologyService>& topoService, 
+                                   RcfClient<IRcfD3Q19AMRInteractorService>& interactorService, 
+                                   RcfClient<IRcfD3Q19CalculationManager>& calculationManager,
+                                   std::vector< RcfClient<IRcfD3Q19CalcService> >& calcServices,
+                                   std::string inputfile )
+{
+   using namespace std;
+   UBLOG(logERROR,"Testcase GBBridge_Sonja "); 
+
+   string outpath = UbStaticPathMap::getPath(UbStaticPathMap::GLOBAL);
+
+   SpD3Q19TestCaseParameters params;
+   bool useLODI;
+   bool initWithLogProfile;
+   //////////////////////////////////////////////////////////////////////////
+   // Params
+   //////////////////////////////////////////////////////////////////////////
+   // if( inputfile.empty() )
+   // {
+   params.calcSteps          = 300000;
+   params.threadedClientCall = true;
+
+   //params.distributedDumpScheduler = UbScheduler(5000, 0);
+   params.distributedDumpScheduler.addSchedule(UbSchedule(100,0,100));
+   params.distributedDumpScheduler.addSchedule(UbSchedule(100,100,6000));
+   params.distributedDumpScheduler.addSchedule(UbSchedule(1000,6000,10000));
+   params.distributedDumpScheduler.addSchedule(UbSchedule(5000,10000,Ub::inf));
+
+   //params.schedulers.calcForces    = UbScheduler(10,0);
+   //params.schedulers.writeForces   = UbScheduler(500,500);
+   params.schedulers.resetAverage  = UbScheduler(50000,50000);
+   params.schedulers.serialization = UbScheduler(20000,20000);
+
+   //Schnickschnack(  so lassen, da geht es im Wesentlichen um Kommunikationsdetails)
+   params.connsTransAttr.setRemoteProtocol(D3Q19ConnectorTransmitterAttributes::MPI_PROTOCOL);
+   params.connsTransAttr.setOptionDirectConnectors(true);
+   params.connsTransAttr.setOptionTwoVectorsForLocalVectors(false);
+   params.connsTransAttr.setOptionConsForNotActiveBlocks(true);
+   params.connsTransAttr.setOptionRemoteBlockedSend(false);
+   params.connsTransAttr.setOptionRemoteBlockedReceive(true);
+   params.connsTransAttr.setOptionRemotePool(true);
+   params.connsTransAttr.setOptionStlVecForSameLevelCons(false);
+   params.connsTransAttr.setOptionStlVecForScaleCons(false);
+
+#ifndef CAB_MPI
+   if(params.connsTransAttr.getRemoteProtocol() == D3Q19ConnectorTransmitterAttributes::MPI_PROTOCOL) 
+      throw UbException(UB_EXARGS,"MPI Transmitter not available for this compilation without /DCAB_MPI");
+#endif
+
+   string machine = QUOTEME(CAB_MACHINE);
+   string BrueckeFilename;
+   string ZckbndFilename;
+   if(machine == "ARAGORN")     {  BrueckeFilename = "f:/data/bruecke/platte_raw.stl"; ZckbndFilename="f:/data/bruecke/zweiPlatten0.stl";}
+   else if(machine == "LUDWIG") {  BrueckeFilename = "/hpc3lustre/home/sonuphof/Stl-Zeichnungen/platte_raw.stl"; ZckbndFilename="/hpc3lustre/home/sonuphof/Stl-Zeichnungen/2zackenbaender0.stl";}
+   else if(machine == "PIPPIN") {  BrueckeFilename = "C:/platteD291009/sonja2/svn_uphoff/Daten/SFB880/platte-cad/platte_raw.stl"; ZckbndFilename="C:/platteD291009/sonja2/svn_uphoff/Daten/SFB880/platte-cad/2zackenbaender0.stl";}
+   else throw UbException(UB_EXARGS, "unknown CAB_MACHINE");
+
+
+   //////////////////////////////////////////////////////////////////////////
+   //physik
+   //////////////////////////////////////////////////////////////////////////
+   params.Re            = 11900;// 13286;//13286;//gemessen 18.98 m/s...*5.0 zum  testen ob was passiert
+   params.velocity      = 0.01;  
+   params.vx1Init       = 0.01;  
+   params.rhoInit       = 0.0;
+   initWithLogProfile   = true;
+   useLODI              = false;
+
+   params.collModel = D3Q19System::INCOMPGLBEJTLESMODEL;
+   ///////////////Knotenabmessungen:
+   //int KnotenCubeCoarse=40;
+   params.nx[0]      = 120;//60;//86;//43;//65;//50;  //länge
+   params.nx[1]      = 6;///1;//5;// //breite
+   params.nx[2]      = 32;//18;//5;//15;//15; //höhe gebiet
+   params.blocknx[0] = 10;
+   params.blocknx[1] = 10;
+   params.blocknx[2] = 10;
+
+   params.baseLevel   = 0;
+   params.refineLevel = 3;
+
+   int inflowCubeLevel = 1;
+   int bottomLevel     = 1;
+
+   ///////////////Weltabmessungen:
+   double kanalhoeheSI  = 60.0/100.0;//60.0/100.0;//cm, Kanalhöhe
+   double kanalbreiteSI = 9.9/100.0;//1.65/100.0;//13.2/100.0;////40.0/100.0; //cm, Kanalbreite //13.2 zeilbreite
+   double kanallaengeSI = kanalhoeheSI*30.0/18.0;//80.0/100.0;//cm, Kanallänge, ist nicht angegeben
+
+   // double refinewidth1=kanalhoeheSI/10.0;
+
+   double fineNodeDx   = (kanalhoeheSI) / (double)( params.blocknx[2]*params.nx[2]*(1<<params.refineLevel)+1 ); //+1--> gitter liegt jeweils 0.5dx innerhalb
+   double coarseNodeDx = fineNodeDx * (double)(1<<params.refineLevel);//geowerte
+
+   double blockLengthx1 = params.blocknx[0]*coarseNodeDx; //geowerte
+   double blockLengthx2 = blockLengthx1;
+   double blockLengthx3 = blockLengthx1;
+
+   double originX1 = 0.0;//-50.0*propellerDurchmesser;  //geowerte
+   double originX2 = 0.0;//-0.5*blockLengthx2*nx2;
+   double originX3 = 0.0;// minX3 + 0.5*fineNodeDx;
+
+   double geoLength[]   = {  params.nx[0]*blockLengthx1, params.nx[1]*blockLengthx2, params.nx[2]*blockLengthx3}; 
+
+   //position vorderkante cube
+   double originBridgeX1 = 20.0/100.0; //cm, geraten
+   double originBridgeX2 = 0.0;//0.5*params.nx[1]*blockLengthx2-0.5*H-fineNodeDx;
+   double originBridgeX3 = kanalhoeheSI*0.5;//H*0.0-fineNodeDx; //boden
+
+   bool periodicx1 = false;
+   bool periodicx2 = true;
+   bool periodicx3 = false;
+
+#ifndef CAB_MPI
+   if(params.connsTransAttr.getRemoteProtocol() == D3Q19ConnectorTransmitterAttributes::MPI_PROTOCOL) 
+      throw UbException("LbD3Q19MasterTestcases::startChannelFlow - MPI Transmitter not available for this compilation without /DCAB_MPI");
+#endif
+
+   //weitere parameter
+   double raiseVelSteps                  = 0;
+   double startViscosity                 = 1.0/3.0;
+   int    decreaseViscositySteps         = 6000;
+   int    decreaseViscosityStepForHalVis = (int)(1.0/8.0*decreaseViscositySteps);
+
+   if( D3Q19System::isCompModel(params.collModel) ) params.rhoInit = 1.0;
+   //////////////////////////////////////////////////////////////////////////
+   //grid initialization
+   //////////////////////////////////////////////////////////////////////////
+   UBLOG2(logINFO, std::cout, "grid initialization...");
+
+   CoordinateTransformation3D* trafo = new CoordinateTransformation3D(originX1,originX2, originX3, blockLengthx1, blockLengthx2, blockLengthx3);
+   vector< boost::shared_ptr<AMR3DGridAdaptationCriterion> > adapter;
+   UBLOG(logINFO,"set periodic")
+   adapter.push_back( boost::shared_ptr<AMR3DGridAdaptationCriterion>(new AMR3DSetPeriodicAdapter(periodicx1, params.nx[0], periodicx2, params.nx[1], periodicx3, params.nx[2])) );
+      UBLOG(logINFO,"construct block grid")
+   topoService.constructBlockGrid("MyGrid", UbTupleInt6(params.nx[0],params.nx[1],params.nx[2],params.blocknx[0],params.blocknx[1],params.blocknx[2]), params.baseLevel, UbPointerWrapper<CoordinateTransformation3D>(trafo),adapter );
+
+   UBLOG2(logINFO, std::cout, "grid initialization... done");
+
+   //##########################################################################
+
+   double geoOverlap = 3.0*coarseNodeDx;
+
+   //////////////////////////////////////////////////////////////////////////////
+
+   GbTriFaceMesh3D* mesh = GbTriFaceMesh3DCreator::readMeshFromFile(BrueckeFilename, "Netz");
+    mesh->deleteRedundantNodes();
+
+     double x1minMesh = mesh->getX1Minimum(); double x1maxMesh = mesh->getX1Maximum();
+   double x2minMesh = mesh->getX2Minimum(); double x2maxMesh = mesh->getX2Maximum();
+   double x3minMesh = mesh->getX3Minimum(); double x3maxMesh = mesh->getX3Maximum();
+
+   double drehpunktX=x1minMesh+(x1maxMesh-x1minMesh)*0.5;//triFaceMeshS->getX1Centroid();
+   double drehpunktZ=x3minMesh+(x3maxMesh-x3minMesh)*0.5;//triFaceMeshS->getX3Centroid();
+   double drehpunktY=x2minMesh+(x2maxMesh-x2minMesh)*0.5;// seedX2-0.5*nodeDelta;//+nx2*deltaX2+0.5*deltaX2;
+
+     mesh->rotateAroundPoint(drehpunktZ,drehpunktX,drehpunktY,90.0,0.0,0.0);  //TriFacMesh-KO-System anders als LB-KO-System
+
+   x1minMesh = mesh->getX1Minimum();  x1maxMesh = mesh->getX1Maximum();
+   x2minMesh = mesh->getX2Minimum();  x2maxMesh = mesh->getX2Maximum();
+   x3minMesh = mesh->getX3Minimum();  x3maxMesh = mesh->getX3Maximum();
+
+   drehpunktX=x1minMesh+(x1maxMesh-x1minMesh)*0.5;//triFaceMeshS->getX1Centroid();
+   drehpunktZ=x3minMesh+(x3maxMesh-x3minMesh)*0.5;//triFaceMeshS->getX3Centroid();
+   drehpunktY=x2minMesh+(x2maxMesh-x2minMesh)*0.5;// seedX2-0.5*nodeDelta;//+nx2*deltaX2+0.5*deltaX2;
+
+   double H3=1.05/100.0;//cm, Plattendicke
+   double scaleB=H3/(x3maxMesh-x3minMesh);
+   double scaleX2=(geoLength[2]+2.0*coarseNodeDx)/(x2minMesh-x2maxMesh);
+
+   mesh->scale(scaleB,scaleB,scaleB);
+   x1minMesh = mesh->getX1Minimum(); x1maxMesh = mesh->getX1Maximum();
+   x2minMesh = mesh->getX2Minimum(); x2maxMesh = mesh->getX2Maximum();
+   x3minMesh = mesh->getX3Minimum(); x3maxMesh = mesh->getX3Maximum();
+   double offsetXBridge=originBridgeX1;//originBridgeX1;
+   double offsetYBridge=originBridgeX2;//originBridgeX2;
+   double offsetZBridge=originBridgeX3;//originBridgeX3;//-0.5*(x3minMesh-x3maxMesh);
+   //mesh->translate(-x1minMesh+offsetXBridge, -x2minMesh-0.5*offsetYBridge-coarseNodeDx, -x3minMesh+offsetZBridge); 
+   mesh->translate(-x1minMesh+offsetXBridge, -x2minMesh+offsetYBridge-coarseNodeDx, -x3minMesh+offsetZBridge-(x3maxMesh-x3minMesh)*0.5); 
+
+   x1minMesh = mesh->getX1Minimum(); x1maxMesh = mesh->getX1Maximum();
+   x2minMesh = mesh->getX2Minimum(); x2maxMesh = mesh->getX2Maximum();
+   x3minMesh = mesh->getX3Minimum(); x3maxMesh = mesh->getX3Maximum();
+
+   GbSystem3D::writeGeoObject( mesh, UbStaticPathMap::getPath(UbStaticPathMap::GLOBAL)+"/platte", WbWriterVtkXmlBinary::getInstance() );
+
+   //GbTriFaceMesh3D* Bruecke = GbTriFaceMesh3DCreator::getInstance()->readMeshFromFile(BrueckeFilename         ,"Bruecke");
+   // Bruecke->setPointInObjectTest(GbTriFaceMesh3D::RAYCROSSING);//, HALFSPACE, MEGARAY, SEGURA, GELLER)
+   //D3Q19AMRTriFaceMeshInteractor* triInteractor = new D3Q19AMRTriFaceMeshInteractor(mesh, grid,new D3Q19NoSlipBCAdapter, AMR3DInteractor::SOLID);
+   boost::shared_ptr<D3Q19AMRTriFaceMeshInteractor> triBridgeInteractor( new D3Q19AMRTriFaceMeshInteractor( mesh,new D3Q19NoSlipBCAdapter,AMR3DInteractor::SOLID,"bridge") );
+
+   //grid->addAndInitInteractor(triInteractor);
+   interactorService.addInteractor(triBridgeInteractor);
+
+     //////////////////////////////////////////////////////////////////////////////
+
+ //////////////////////////////////////////////////////////////////////////
+   // Zackenband
+   //////////////////////////////////////////////////////////////////////////
+     GbTriFaceMesh3D* meshBand = GbTriFaceMesh3DCreator::readMeshFromFile(ZckbndFilename, "NetzBand");
+    meshBand->deleteRedundantNodes();
+
+   double x1minMeshB = meshBand->getX1Minimum(); double x1maxMeshB = meshBand->getX1Maximum();
+   double x2minMeshB = meshBand->getX2Minimum(); double x2maxMeshB = meshBand->getX2Maximum();
+   double x3minMeshB = meshBand->getX3Minimum(); double x3maxMeshB = meshBand->getX3Maximum();
+
+   //double drehpunktXB=x1minMeshB+(x1maxMeshB-x1minMeshB)*0.5;//triFaceMeshS->getX1Centroid();
+   //double drehpunktZB=x3minMeshB+(x3maxMeshB-x3minMeshB)*0.5;//triFaceMeshS->getX3Centroid();
+   //double drehpunktYB=x2minMeshB+(x2maxMeshB-x2minMeshB)*0.5;// seedX2-0.5*nodeDelta;//+nx2*deltaX2+0.5*deltaX2;
+
+    // meshBand->rotateAroundPoint(drehpunktZB,drehpunktXB,drehpunktYB,90.0,0.0,0.0);  //TriFacMesh-KO-System anders als LB-KO-System
+
+   x1minMeshB = meshBand->getX1Minimum();  x1maxMeshB = meshBand->getX1Maximum();
+   x2minMeshB = meshBand->getX2Minimum();  x2maxMeshB = meshBand->getX2Maximum();
+   x3minMeshB = meshBand->getX3Minimum();  x3maxMeshB = meshBand->getX3Maximum();
+
+   //drehpunktXB=x1minMeshB+(x1maxMeshB-x1minMeshB)*0.5;//triFaceMeshS->getX1Centroid();
+   //drehpunktZB=x3minMeshB+(x3maxMeshB-x3minMeshB)*0.5;//triFaceMeshS->getX3Centroid();
+   //drehpunktYB=x2minMeshB+(x2maxMeshB-x2minMeshB)*0.5;// seedX2-0.5*nodeDelta;//+nx2*deltaX2+0.5*deltaX2;
+
+   double H1B=1.5/100.0;//0.05;//cm, Banddicke..nachschauen!!!
+   double scaleBand=H1B/(x1maxMeshB-x1minMeshB);//H3B/(x3maxMeshB-x3minMeshB);
+ //  double scaleX2B=(geoLength[2]+2.0*coarseNodeDx)/(x2minMeshB-x2maxMeshB);
+
+   meshBand->scale(scaleBand,scaleBand,scaleBand);
+   x1minMeshB = meshBand->getX1Minimum(); x1maxMeshB = meshBand->getX1Maximum();
+   x2minMeshB = meshBand->getX2Minimum(); x2maxMeshB = meshBand->getX2Maximum();
+   x3minMeshB = meshBand->getX3Minimum(); x3maxMeshB = meshBand->getX3Maximum();
+   double dBandX=0.5/100.0;//1.29; //15mm-2.1mm Absand von Bandvorderkante
+   double dBandY=0.0/100.0;
+   double dBandZ=0.223/100.0;//0.344;//....
+   double offsetXBridgeB=x1minMesh+dBandX;//originBridgeX1+dBandX;//originBridgeX1;
+   double offsetYBridgeB=originBridgeX2+dBandY;//originBridgeX2;
+   double offsetZBridgeB=originBridgeX3+dBandZ;//originBridgeX3;//-0.5*(x3minMesh-x3maxMesh);
+   //mesh->translate(-x1minMesh+offsetXBridge, -x2minMesh-0.5*offsetYBridge-coarseNodeDx, -x3minMesh+offsetZBridge); 
+   meshBand->translate(-x1minMeshB+offsetXBridgeB, -x2minMeshB+offsetYBridgeB-coarseNodeDx, -x3minMeshB+offsetZBridgeB);//-(x3maxMeshB-x3minMeshB)*0.5); 
+
+   x1minMeshB = meshBand->getX1Minimum(); x1maxMeshB = meshBand->getX1Maximum();
+   x2minMeshB = meshBand->getX2Minimum(); x2maxMeshB = meshBand->getX2Maximum();
+   x3minMeshB = meshBand->getX3Minimum(); x3maxMeshB = meshBand->getX3Maximum();
+
+   GbSystem3D::writeGeoObject( meshBand, UbStaticPathMap::getPath(UbStaticPathMap::GLOBAL)+"/Band", WbWriterVtkXmlBinary::getInstance() );
+
+   //GbTriFaceMesh3D* Bruecke = GbTriFaceMesh3DCreator::getInstance()->readMeshFromFile(BrueckeFilename         ,"Bruecke");
+   // Bruecke->setPointInObjectTest(GbTriFaceMesh3D::RAYCROSSING);//, HALFSPACE, MEGARAY, SEGURA, GELLER)
+   //D3Q19AMRTriFaceMeshInteractor* triInteractor = new D3Q19AMRTriFaceMeshInteractor(mesh, grid,new D3Q19NoSlipBCAdapter, AMR3DInteractor::SOLID);
+   boost::shared_ptr<D3Q19AMRTriFaceMeshInteractor> triBandInteractor( new D3Q19AMRTriFaceMeshInteractor( meshBand,new D3Q19NoSlipBCAdapter,AMR3DInteractor::SOLID,"band") );
+   interactorService.addInteractor(triBandInteractor);
+    /////////////////Band2
+
+
+      GbTriFaceMesh3D* meshBand2 = GbTriFaceMesh3DCreator::readMeshFromFile(ZckbndFilename, "NetzBand2");
+    meshBand->deleteRedundantNodes();
+
+   double x1minMeshB2 = meshBand2->getX1Minimum(); double x1maxMeshB2 = meshBand2->getX1Maximum();
+   double x2minMeshB2 = meshBand2->getX2Minimum(); double x2maxMeshB2 = meshBand2->getX2Maximum();
+   double x3minMeshB2 = meshBand2->getX3Minimum(); double x3maxMeshB2 = meshBand2->getX3Maximum();
+
+   //double drehpunktXB2=x1minMeshB2+(x1maxMeshB2-x1minMeshB2)*0.5;//triFaceMeshS->getX1Centroid();
+   //double drehpunktZB2=x3minMeshB2+(x3maxMeshB2-x3minMeshB2)*0.5;//triFaceMeshS->getX3Centroid();
+   //double drehpunktYB2=x2minMeshB2+(x2maxMeshB2-x2minMeshB2)*0.5;// seedX2-0.5*nodeDelta;//+nx2*deltaX2+0.5*deltaX2;
+
+//     meshBand2->rotateAroundPoint(drehpunktZB2,drehpunktXB2,drehpunktYB2,90.0,0.0,0.0);  //TriFacMesh-KO-System anders als LB-KO-System
+
+   x1minMeshB2 = meshBand2->getX1Minimum();  x1maxMeshB2 = meshBand2->getX1Maximum();
+   x2minMeshB2 = meshBand2->getX2Minimum();  x2maxMeshB2 = meshBand2->getX2Maximum();
+   x3minMeshB2 = meshBand2->getX3Minimum();  x3maxMeshB2 = meshBand2->getX3Maximum();
+
+   //drehpunktXB2=x1minMeshB2+(x1maxMeshB2-x1minMeshB2)*0.5;//triFaceMeshS->getX1Centroid();
+   //drehpunktZB2=x3minMeshB2+(x3maxMeshB2-x3minMeshB2)*0.5;//triFaceMeshS->getX3Centroid();
+   //drehpunktYB2=x2minMeshB2+(x2maxMeshB2-x2minMeshB2)*0.5;// seedX2-0.5*nodeDelta;//+nx2*deltaX2+0.5*deltaX2;
+
+   double H1B2=1.5/100.0;//0.05;//cm, Banddicke..nachschauen!!!
+   double scaleBand2=H1B2/(x1maxMeshB2-x1minMeshB2);//H3B/(x3maxMeshB-x3minMeshB);
+
+   meshBand2->scale(scaleBand2,scaleBand2,scaleBand2);
+   x1minMeshB2 = meshBand2->getX1Minimum(); x1maxMeshB2 = meshBand2->getX1Maximum();
+   x2minMeshB2 = meshBand2->getX2Minimum(); x2maxMeshB2 = meshBand2->getX2Maximum();
+   x3minMeshB2 = meshBand2->getX3Minimum(); x3maxMeshB2 = meshBand2->getX3Maximum();
+   double dBandX2=0.5/100.0;//1.29;
+   double dBandY2=0.5/100.0;
+   double dBandZ2=0.223/100.0;//0.344;//...
+   double offsetXBridgeB2=x1minMesh+dBandX2;//originBridgeX1;
+   double offsetYBridgeB2=originBridgeX2+dBandY2;//originBridgeX2;
+   double offsetZBridgeB2=originBridgeX3+dBandZ2;//originBridgeX3;//-0.5*(x3minMesh-x3maxMesh);
+   //mesh->translate(-x1minMesh+offsetXBridge, -x2minMesh-0.5*offsetYBridge-coarseNodeDx, -x3minMesh+offsetZBridge); 
+   meshBand2->translate(-x1minMeshB2+offsetXBridgeB2, -x2minMeshB2+offsetYBridgeB2-coarseNodeDx, -x3minMeshB2+offsetZBridgeB2);//-(x3maxMeshB2-x3minMeshB2)*0.5); 
+
+   x1minMeshB2 = meshBand2->getX1Minimum(); x1maxMeshB2 = meshBand2->getX1Maximum();
+   x2minMeshB2 = meshBand2->getX2Minimum(); x2maxMeshB2 = meshBand2->getX2Maximum();
+   x3minMeshB2 = meshBand2->getX3Minimum(); x3maxMeshB2 = meshBand2->getX3Maximum();
+
+   GbSystem3D::writeGeoObject( meshBand2, UbStaticPathMap::getPath(UbStaticPathMap::GLOBAL)+"/Band2", WbWriterVtkXmlBinary::getInstance() );
+
+   //GbTriFaceMesh3D* Bruecke = GbTriFaceMesh3DCreator::getInstance()->readMeshFromFile(BrueckeFilename         ,"Bruecke");
+   // Bruecke->setPointInObjectTest(GbTriFaceMesh3D::RAYCROSSING);//, HALFSPACE, MEGARAY, SEGURA, GELLER)
+   //D3Q19AMRTriFaceMeshInteractor* triInteractor = new D3Q19AMRTriFaceMeshInteractor(mesh, grid,new D3Q19NoSlipBCAdapter, AMR3DInteractor::SOLID);
+   boost::shared_ptr<D3Q19AMRTriFaceMeshInteractor> triBand2Interactor( new D3Q19AMRTriFaceMeshInteractor( meshBand2,new D3Q19NoSlipBCAdapter,AMR3DInteractor::SOLID,"band2") );
+    interactorService.addInteractor(triBand2Interactor);
+   
+   //////////////////////////////////////////////////////////////////////////
+   // refine
+   //////////////////////////////////////////////////////////////////////////
+                        
+
+
+   
+
+
+
+   ///////////platte ausmessen:
+   x1minMesh = mesh->getX1Minimum(); x1maxMesh = mesh->getX1Maximum();
+   x2minMesh = mesh->getX2Minimum(); x2maxMesh = mesh->getX2Maximum();
+   x3minMesh = mesh->getX3Minimum(); x3maxMesh = mesh->getX3Maximum();
+  double deltaX3Platte=(x3maxMesh-x3minMesh);
+
+
+      GbCuboid3D* refine1PlatteCube = new GbCuboid3D(  originX1-geoOverlap   , originX2-geoOverlap  , x3minMesh-H3
+      , x1maxMesh+H3*5.0, originX2+geoOverlap+geoLength[1], x3maxMesh+H3);
+   boost::shared_ptr<AMR3DBlockAdaptationCriterion> refineAdapterP1(new AMR3DCrossAndInsideGbObject3DAdapter(refine1PlatteCube,0,params.refineLevel-6));
+   topoService.adaptGridByBlockCriterion(refineAdapterP1);
+
+        GbCuboid3D* refine2PlatteCube = new GbCuboid3D(  originX1-geoOverlap   , originX2-geoOverlap  , x3minMesh-H3*0.5
+      , x1maxMesh+H3*5.0, originX2+geoOverlap+geoLength[1], x3maxMesh+H3);
+   boost::shared_ptr<AMR3DBlockAdaptationCriterion> refineAdapterP2(new AMR3DCrossAndInsideGbObject3DAdapter(refine2PlatteCube,0,params.refineLevel-5));
+   topoService.adaptGridByBlockCriterion(refineAdapterP2);
+
+        GbCuboid3D* refine3PlatteCube = new GbCuboid3D(  originX1-geoOverlap  , originX2-geoOverlap  , x3minMesh-H3*0.5
+      , x1maxMesh+H3*5.0, originX2+geoOverlap+geoLength[1], x3maxMesh+H3*0.5);
+   boost::shared_ptr<AMR3DBlockAdaptationCriterion> refineAdapterP3(new AMR3DCrossAndInsideGbObject3DAdapter(refine3PlatteCube,0,params.refineLevel-4));   //dieser hier hat eine ecke 
+   topoService.adaptGridByBlockCriterion(refineAdapterP3);
+
+        GbCuboid3D* refine4PlatteCube = new GbCuboid3D(   originX1-geoOverlap  , originX2-geoOverlap  , x3minMesh+deltaX3Platte*0.6
+      ,  x1maxMesh+H3*5.0, originX2+geoOverlap+geoLength[1], x3maxMesh+H3*0.25);
+   boost::shared_ptr<AMR3DBlockAdaptationCriterion> refineAdapterP4(new AMR3DCrossAndInsideGbObject3DAdapter(refine4PlatteCube,0,params.refineLevel-3));   //weil der hier zu hoch ist
+   topoService.adaptGridByBlockCriterion(refineAdapterP4);
+
+           GbCuboid3D* refine5PlatteCube = new GbCuboid3D(   originX1-geoOverlap , originX2-geoOverlap  , x3minMesh+deltaX3Platte*0.8
+      ,  x1maxMesh+H3*5.0, originX2+geoOverlap+geoLength[1], x3maxMesh+H3*0.00375);
+   boost::shared_ptr<AMR3DBlockAdaptationCriterion> refineAdapterP5(new AMR3DCrossAndInsideGbObject3DAdapter(refine5PlatteCube,0,params.refineLevel-2));
+   topoService.adaptGridByBlockCriterion(refineAdapterP5);
+
+  //            GbCuboid3D* refine6PlatteCube = new GbCuboid3D(   x1minMeshB2+( x1maxMeshB2- x1minMeshB2)*0.8   , originX2-geoOverlap  , x3minMesh+deltaX3Platte*0.9
+  //    ,  x1maxMesh+H3*0.075, originX2+geoOverlap+geoLength[1], x3maxMesh+2.0*fineNodeDx);
+  // boost::shared_ptr<AMR3DBlockAdaptationCriterion> refineAdapterP6(new AMR3DCrossAndInsideGbObject3DAdapter(refine6PlatteCube,0,params.refineLevel-1));
+  // topoService.adaptGridByBlockCriterion(refineAdapterP6);
+
+           GbCuboid3D* refine6PlatteCube = new GbCuboid3D(   originX1-geoOverlap   , originX2-geoOverlap  , x3minMesh+deltaX3Platte*0.9
+      ,  x1maxMesh+H3*5.0, originX2+geoOverlap+geoLength[1], x3maxMesh+deltaX3Platte*0.9);
+   boost::shared_ptr<AMR3DBlockAdaptationCriterion> refineAdapterP6(new AMR3DCrossAndInsideGbObject3DAdapter(refine6PlatteCube,0,params.refineLevel-1));
+   topoService.adaptGridByBlockCriterion(refineAdapterP6);
+
+     UBLOG2(logINFO, std::cout, "Refinement..done");
+   //blockverhältnis von 2:1 herstellen:
+   UBLOG(logINFO,"ratio")
+      boost::shared_ptr<AMR3DBlockAdaptationCriterion> ratioAdapter(new AMR3DBlockRatioAdapter(params.refineLevel));
+   topoService.adaptGridByBlockCriterion(ratioAdapter);
+
+
+
+   //////////////////////////////////////////////////////////////////////////
+   //walls                                                                                                   
+   ////////////////////////////////////////////////////////////////////////// 
+   int noSlipSecOpt = 1; //0=2nd order BB 1=simple BB
+   int slipSecOpt   = 1; //0=2nd order BB 1=simple BB
+
+   ////x1x2-walls:                                                                                             
+   GbCuboid3D* wallsX1X2min = new GbCuboid3D(  originX1-geoOverlap   , originX2-geoOverlap  , originX3-geoOverlap
+      , originX1+geoLength[0]+geoOverlap, originX2+geoOverlap+geoLength[1], originX3-0.5*fineNodeDx);
+   boost::shared_ptr<D3Q19AMRInteractor> wallsX1X2minInteractor( new D3Q19AMRInteractor( wallsX1X2min,new D3Q19SlipBCAdapter(slipSecOpt),AMR3DInteractor::SOLID,"wallsX1X2min") );
+   if(!params.periodic[2]) interactorService.addInteractor( wallsX1X2minInteractor );
+
+   GbCuboid3D* wallsX1X2max = new GbCuboid3D(  originX1-geoOverlap , originX2-geoOverlap , originX3+geoLength[2]+0.5*fineNodeDx            
+      , originX1+geoLength[0]+geoOverlap, originX2+geoOverlap+geoLength[1], originX3+geoLength[2]+geoOverlap); 
+   boost::shared_ptr<D3Q19AMRInteractor> wallsX1X2maxInteractor( new D3Q19AMRInteractor( wallsX1X2max,new D3Q19SlipBCAdapter(slipSecOpt),AMR3DInteractor::SOLID,"wallsX1X2max") ) ;  
+   if(!params.periodic[2]) interactorService.addInteractor( wallsX1X2maxInteractor );
+
+
+  
+
+   //##########################################################################
+   //## physical parameters
+   //##########################################################################
+   double smagorinskiConstant = 0.18;
+
+
+   double rhoLB         = 1.0;
+   double rhoReal       = 1.0;
+   double nueReal  = 0.000015;//0.015;
+
+   double hReal         = 0.0105;//<-m     1.05;//Plattendicke in cm(! cm nicht m !)
+   double uReal         = params.Re*nueReal/hReal;
+
+   //##Machzahl:
+   //#Ma     = uReal/csReal
+   double Ma      = 0.05;//0.0553;//Ma-Real!
+   double csReal  = uReal/Ma;
+   double hLB     = hReal/coarseNodeDx;
+
+   D3Q19UnitConverter unitConverter(hReal, csReal, rhoReal, hLB );
+
+   double uLB           = uReal   * unitConverter.getFactorVelocityWToLb();
+   double nueLB         = nueReal * unitConverter.getFactorViscosityWToLb();
+
+   params.velocity = uLB;
+   double viscosity = nueLB;
+
+   //////////////////////////////////////////////////////////////////////////
+   // BCs
+   //////////////////////////////////////////////////////////////////////////
+   //////////////////////////////////////////////////////////////////////////
+   // inflow
+   //////////////////////////////////////////////////////////////////////////
+
+
+   double uLB2=uLB*0.96*1.02;//*0.5;
+
+   vector<D3Q19BCFunction> velcX1BCs,dummy;
+
+   if(raiseVelSteps>0)
+   {
+      mu::Parser inflowProfile1;
+         inflowProfile1.SetExpr("uLB"); 
+    
+          inflowProfile1.DefineConst("uLB",uLB2);
+   }
+   mu::Parser inflowProfile;
+   inflowProfile.SetExpr("uLB"); 
+
+   inflowProfile.DefineConst("uLB",uLB2);
+   //inflowProfile.DefineConst("xlbnachxworld",xlbnachxworld);
+   velcX1BCs.push_back(D3Q19BCFunction(inflowProfile,raiseVelSteps,D3Q19BCFunction::INFCONST));
+
+
+   GbCuboid3D* velBCCuboid = NULL;
+   velBCCuboid = new GbCuboid3D(  originX1-geoOverlap, originX2-geoOverlap, originX3-geoOverlap
+      , originX1-fineNodeDx, originX2+geoLength[1]+geoOverlap, originX3+geoLength[2]+geoOverlap);
+
+   boost::shared_ptr< D3Q19AMRInteractor> velBCInteractor(new D3Q19AMRInteractor(velBCCuboid,AMR3DInteractor::SOLID,"velBC")); 
+   velBCInteractor->addBCAdapter(new D3Q19VelocityBCAdapter(velcX1BCs,dummy,dummy) );
+   interactorService.addInteractor( velBCInteractor ); 
+
+
+
+   //////////////////////////////////////////////////////////////////////////
+   // outflow
+   //////////////////////////////////////////////////////////////////////////
+   GbCuboid3D* densCuboid = NULL;
+   densCuboid = new GbCuboid3D(  originX1+geoLength[0]+fineNodeDx, originX2-geoOverlap             , originX3-geoOverlap
+      , originX1+geoLength[0]+geoOverlap, originX2+geoLength[1]+geoOverlap, originX3+geoLength[2]+geoOverlap );
+
+   if(useLODI)
+   {
+      float LX1 = (float)((densCuboid->getX1Minimum()-velBCCuboid->getX1Maximum())/coarseNodeDx);
+      float LX2 = -1.0f;
+      float LX3 = -1.0f;
+
+      D3Q19DensityLodiBCAdapter* lodiBCadapter = new D3Q19DensityLodiBCAdapter(3,LX1,LX2,LX3,params.rhoInit,params.vx1Init,params.vx2Init,params.vx3Init,params.rhoInit);
+      boost::shared_ptr< D3Q19AMRInteractor> densInteractor(new D3Q19AMRInteractor(densCuboid,lodiBCadapter,AMR3DInteractor::SOLID,"lodiDensBC"));
+      interactorService.addInteractor( densInteractor ); 
+   }
+   else
+   {
+      boost::shared_ptr< D3Q19AMRInteractor> densInteractor( new D3Q19AMRInteractor(densCuboid,new D3Q19DensityBCAdapter(params.rhoInit),AMR3DInteractor::SOLID,"densBC") );
+      interactorService.addInteractor( densInteractor ); 
+   }
+
+   UBLOG(logINFO, "*****************************************");
+   UBLOG(logINFO, "* Parameters                            *");
+   UBLOG(logINFO, "* Re            ="<<params.Re);
+   UBLOG(logINFO, "* Ma            ="<<Ma);
+   UBLOG(logINFO, "* uReal         ="<<uReal);
+   UBLOG(logINFO, "* nueReal       ="<<nueReal);
+   UBLOG(logINFO, "* nue           ="<<nueLB);
+   UBLOG(logINFO, "* velocity      ="<<uLB);
+   UBLOG(logINFO, "* LX1 (world/LB)="<<kanallaengeSI<<"/"<<kanallaengeSI/coarseNodeDx);
+   UBLOG(logINFO, "* LX2 (world/LB)="<<kanalbreiteSI<<"/"<<kanalbreiteSI/coarseNodeDx);
+   UBLOG(logINFO, "* LX3 (world/LB)="<<kanalhoeheSI<<"/"<<kanalhoeheSI/coarseNodeDx);
+   UBLOG(logINFO, "* dxInflow-Cube ="<<velBCCuboid->getX1Maximum()-mesh->getX1Minimum());
+   UBLOG(logINFO, "* cdx           ="<<coarseNodeDx);
+   UBLOG(logINFO, "* fdx           ="<<fineNodeDx);
+  // UBLOG(logINFO, "* H_world       ="<<H);
+  // UBLOG(logINFO, "* H_LB          ="<<H/coarseNodeDx);
+   //UBLOG(logINFO, "* H_log_world   ="<<delta);
+   //UBLOG(logINFO, "* H_log_LB      ="<<delta/baseDX);
+   //UBLOG(logINFO, "* alpha         ="<<alpha);
+   UBLOG(logINFO, "* inflowProfile ="<<inflowProfile.GetExpr());
+   UBLOG(logINFO, "* dx_base       ="<<coarseNodeDx<<" == "<<coarseNodeDx);
+   UBLOG(logINFO, "* dx_refine     ="<<fineNodeDx<<" == "<<fineNodeDx );
+   UBLOG(logINFO, "* collModel     ="<<params.collModel);
+   UBLOG(logINFO, "* raiseVelSteps ="<<raiseVelSteps);
+   UBLOG(logINFO, "* startVis      ="<<startViscosity);
+   UBLOG(logINFO, "* raiseVisSteps ="<<decreaseViscositySteps);
+   UBLOG(logINFO, "* nx1/2/3       ="<<params.nx[0]<<"/"<<params.nx[1]<<"/"<<params.nx[2]);
+   UBLOG(logINFO, "* blocknx1/2/3  ="<<params.blocknx[0]<<"/"<<params.blocknx[1]<<"/"<<params.blocknx[2]);
+   UBLOG(logINFO, "* x3Periodic    ="<<params.periodic[2]);
+   UBLOG(logINFO, "* useDirectConnectors           "<< params.connsTransAttr.useDirectConnectors()        ); 
+   UBLOG(logINFO, "* useSTLVectorForSameLevelCons  "<< params.connsTransAttr.useStlVecForSameLevelCons()  ); 
+   UBLOG(logINFO, "* useSTLVectorForScaleCons      "<< params.connsTransAttr.useStlVecForScaleCons()      ); 
+   UBLOG(logINFO, "* useConsForNotActiveBlocks     "<< params.connsTransAttr.useConsForNotActiveBlocks() ); 
+   UBLOG(logINFO, "* LODI           ="<< (useLODI ? "ON" : "OFF") ); 
+   UBLOG(logINFO, "*****************************************");
+   UBLOGML(logINFO, "UnitConverter:"<<unitConverter.toString());
+   UBLOG(logINFO, "*****************************************");
+
+   //////////////////////////////////////////////////////////////////////////
+   //geo holen und setzen!!!
+   //////////////////////////////////////////////////////////////////////////
+   topoService.getAndAddAndInitInteractors();
+
+   //////////////////////////////////////////////////////////////////////////
+   UBLOG(logINFO, "//////////////////////////////////////////////////////////////////");
+   int nofBlocks = topoService.getNumberOfBlocks(true);
+   UBLOG(logINFO, "//active blocks after interactors: "<<nofBlocks);
+   int nofAllBlocks = topoService.getNumberOfBlocks(false);
+   UBLOG(logINFO, "//total blocks after interactors: "<<nofAllBlocks);
+   UBLOG(logINFO, " -> ~"<<nofBlocks*(params.blocknx[0]+1)*(params.blocknx[1]+1)*(params.blocknx[2]+1)<<" nodes");
+   UBLOG(logINFO, "//////////////////////////////////////////////////////////////////");
+
+   //partitionierung
+   UBLOG2(logINFO,cout, "levelweise METIS SEGMENTIERUNG!!!!")
+      boost::shared_ptr<AMR3DGridAdaptationCriterion> partioningAdapter(new AMR3DGridLevelPartitionMetisAdapter( (int)calcServices.size()
+      , D3Q19MetisAdapterTools::getMetisDirsAndWeights(  params.blocknx[0]
+   , params.blocknx[1]
+   , params.blocknx[2] )
+      , params.connsTransAttr.useConsForNotActiveBlocks()
+      , D3Q19MetisAdapterTools::getD3Q19GetBlockWeightFunctor(false) ) );   ///////hier false auf keine gewichtung - default:doppelte gewichtung für fine
+   //  boost::shared_ptr<AMR3DGridAdaptationCriterion> partioningAdapter(new AMR3DGridPartitionOneDirectionAdapter((int)calcServices.size()) );   
+  // UBLOG2(logINFO,"params.connsTransAttr.useConsForNotActiveBlocks():" ); 
+   //UBLOG2(logINFO,params.connsTransAttr.useConsForNotActiveBlocks() );         
+   topoService.adaptGridByGridCriterion(partioningAdapter);
+   topoService.writeBlocksToAVS(outpath+"/blocksSegments",false);
+   UBLOG2(logINFO,cout, "BlockSegmentsGeschriebe")
+      //clientgrids erzeugen
+      topoService.createClientGridsAndSendBlocksToClients("client",params.connsTransAttr,params.threadedClientCall);
+   UBLOG2(logINFO,cout, "createClientGrids usw")
+
+
+
+      boost::shared_ptr<D3Q19ClientGridWriteInteractorNodeFiles> writeInteractorTransNodesAdapter(new D3Q19ClientGridWriteInteractorNodeFiles("shared",D3Q19ClientGridWriteInteractorNodeFiles::ValueProjOnGeoVertex)); 
+   writeInteractorTransNodesAdapter->setScheduler(UbSchedule(10000));
+   writeInteractorTransNodesAdapter->addInteractorID( triBridgeInteractor ->getName() );
+
+      //physik-daten zuweisen
+      D3Q19GridPhysicsAdapter* physicsAdapter = new D3Q19GridPhysicsAdapter(params.collModel,viscosity,0.0,0.0,0.0);
+   physicsAdapter->setSmagorinskyConstant(smagorinskiConstant);
+   physicsAdapter->setUnitConverter( unitConverter );
+   boost::shared_ptr<AMR3DGridAdaptationCriterion>  physicsAdapterPtr(physicsAdapter);
+
+   //UbPointerWrapper<AMR3DGridAdaptationCriterion>   decreaseViscosityAdapter( new D3Q19GridPhysicsAdapter(decreaseViscositySteps, startViscosity, viscosity, decreaseViscosityStepForHalVis) );
+   boost::shared_ptr<AMR3DGridAdaptationCriterion>  decreaseViscosityAdapter( new D3Q19GridPhysicsAdapter(decreaseViscositySteps, startViscosity, viscosity, decreaseViscosityStepForHalVis) );
+   //boost::shared_ptr<AMR3DBlockAdaptationCriterion> initadapter(new D3Q19InitDistributionsAdapter(params.connsTransAttr.useConsForNotActiveBlocks(), params.collModel, params.rhoInit,(params.vx1Init*0.96),params.vx2Init,params.vx3Init, 0, AMR3DSystem::MAXLEVEL));
+
+   boost::shared_ptr<AMR3DGridAdaptationCriterion> initadapter(new D3Q19InitDistributionsGridAdapter(params.rhoInit,params.vx1Init,params.vx2Init,params.vx3Init));
+   if(initWithLogProfile) 
+   {
+    
+      boost::dynamic_pointer_cast<D3Q19InitDistributionsGridAdapter>(initadapter)->setVx1( inflowProfile );
+   }
+
+
+   boost::shared_ptr<D3Q19ClientGridPostProcessFileAdapter> writeDumpsAdapter(new D3Q19ClientGridPostProcessFileAdapter("shared",true,false));
+   writeDumpsAdapter->setScheduler(params.distributedDumpScheduler);
+   writeDumpsAdapter->setUseFileCounterInsteadTimestepForGlobalPVD(true);
+
+
+   UBLOG(logINFO, "put physicsAdapter to clients");
+   calculationManager.adaptGridByGridCriterionAtClients(physicsAdapterPtr,params.threadedClientCall);
+
+   boost::shared_ptr<AMR3DGridAdaptationCriterion>  hackAdapter(new D3Q19ChangeSlipToNoSlipGridAdapter());
+   UBLOG2(logINFO, std::cout, "add hackAdapter to clients");
+   calculationManager.addTimeDependentGridAdapterAtClients(hackAdapter,params.threadedClientCall);
+   UBLOG2(logINFO, std::cout, "## adapter stuff - start"); 
+
+   UBLOG(logINFO, "getAndAddInteractorsAtClients at clients");
+   calculationManager.getAndAddInteractorsAtClients(params.threadedClientCall);
+
+   UBLOG(logINFO, "put initadapter to clients");
+   calculationManager.adaptGridByGridCriterionAtClients(initadapter,params.threadedClientCall);
+   UBLOG(logINFO, "put setConnectorAdapter to clients");
+   boost::shared_ptr<AMR3DGridAdaptationCriterion>  setConnectorAdapter(new D3Q19SetConnectorsGridAdapter( ) );
+   calculationManager.adaptGridByGridCriterionAtClients(setConnectorAdapter,params.threadedClientCall);
+
+   if(decreaseViscositySteps) calculationManager.addTimeDependentGridAdapterAtClients(decreaseViscosityAdapter,params.threadedClientCall);
+
+   UBLOG(logINFO,"put writeAdapter to calc clients")
+      calculationManager.addClientGridAdapterAtClients(writeDumpsAdapter,params.threadedClientCall);
+   UBLOG(logINFO, "put writeInteractorTransNodesAdapter to clients" )
+      calculationManager.addClientGridAdapterAtClients(writeInteractorTransNodesAdapter, params.threadedClientCall); 
+
+   //remote connetoren
+   UBLOG(logINFO, "setRemoteConnectorsOnCalcServices at clients");
+   topoService.setRemoteConnectorsOnCalcServices(D3Q19System::getAMR3DDirsForD3Q19Dirs(),params.connsTransAttr,params.threadedClientCall);
+
+    UbFileOutputASCII out(UbStaticPathMap::getPath(UbStaticPathMap::GLOBAL)+"/params.txt");
+   if(out.isOpen())
+   {
+      UBLOG(logINFO, "save params to "<<out.getFileName());
+      params.write(&out);
+      out.writeLine();
+      out.writeString("useLodi                  "); out.writeBool(useLODI);             out.writeLine();
+      out.writeString("initWithLogProfile       "); out.writeBool(initWithLogProfile);  out.writeLine();
+      UBLOG(logINFO, " done" )
+   }
+
+
+   //##########################################################################
+   //## spongelayer
+   //##########################################################################
+   UBLOG2(logINFO, std::cout, "##################################################################");
+   UBLOG2(logINFO, std::cout, "## spongelayer - start");
+
+   GbCuboid3D* spongeCubeLeft = new GbCuboid3D( velBCCuboid->getX1Minimum() 
+      , velBCCuboid->getX2Minimum() 
+      , velBCCuboid->getX3Minimum() 
+      , velBCCuboid->getX1Maximum()+(velBCCuboid->getX1Maximum()-velBCCuboid->getX1Minimum() )*0.1-1.0*coarseNodeDx 
+      , velBCCuboid->getX2Maximum() 
+      , velBCCuboid->getX3Maximum() );
+
+   GbSystem3D::writeGeoObject( spongeCubeLeft, UbStaticPathMap::getPath(UbStaticPathMap::GLOBAL)+"/spongeIn", WbWriterVtkXmlBinary::getInstance() );
+   boost::shared_ptr<AMR3DGridAdaptationCriterion>  spongeAdapterLeft( new SpD3Q19SpongeLayerAdapter(spongeCubeLeft, 1./3., nueLB,  SpD3Q19SpongeLayerAdapter::ALTERNATIONX1) );
+   calculationManager.adaptGridByGridCriterionAtClients(spongeAdapterLeft ,params.threadedClientCall);
+
+
+
+   UBLOG2(logINFO, std::cout, "## spongelayerOutflow - start");
+                                                double H=kanallaengeSI/10.0;
+   GbCuboid3D* spongeCubeRight = new GbCuboid3D( originX1+geoLength[0]+fineNodeDx-H 
+      , originX2-geoOverlap             , originX3-geoOverlap
+      , originX1+geoLength[0]+geoOverlap, originX2+geoLength[1]+geoOverlap, originX3+geoLength[2]+geoOverlap   );   
+
+   GbSystem3D::writeGeoObject( spongeCubeRight, UbStaticPathMap::getPath(UbStaticPathMap::GLOBAL)+"/spongeOut", WbWriterVtkXmlBinary::getInstance() );
+   boost::shared_ptr<AMR3DGridAdaptationCriterion>  spongeAdapterRight( new SpD3Q19SpongeLayerAdapter(spongeCubeRight,  nueLB,1./3.,  SpD3Q19SpongeLayerAdapter::ALTERNATIONX1) );
+   calculationManager.adaptGridByGridCriterionAtClients(spongeAdapterRight ,params.threadedClientCall);
+   UBLOG2(logINFO, std::cout, "## spongelayer - end");
+   UBLOG2(logINFO, std::cout, "##################################################################");
+
+
+
+   //GbCuboid3D* densCuboid = NULL;
+   //##########################################################################
+
+   calculationManager.calculate(params.calcSteps, UbStaticPathMap::GLOBAL, params.schedulers);
+
+   UBLOG(logINFO, "warte nun auf ende!!");
+
+}
+
diff --git a/apps/cpu/plate2/CMakeLists.txt b/apps/cpu/plate2/CMakeLists.txt
index 8bcfaf01f930a79e4b4bcef994fe79bd45830bb2..9b79ca447e13021658b721f7e869af549ffabf0e 100644
--- a/apps/cpu/plate2/CMakeLists.txt
+++ b/apps/cpu/plate2/CMakeLists.txt
@@ -1,25 +1,25 @@
-CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
-
-########################################################
-## C++ PROJECT                                       ###
-########################################################
-PROJECT(plate2)
-
-INCLUDE(${SOURCE_ROOT}/lib/IncludsList.txt) 
-
-#################################################################
-###   LOCAL FILES                                             ###
-#################################################################
-FILE(GLOB SPECIFIC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.h
-                         ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
-                         ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp  )
- 
-SET(ALL_SOURCES ${ALL_SOURCES} ${SPECIFIC_FILES})
-SOURCE_GROUP(src FILES ${SPECIFIC_FILES})
-  
-SET(CAB_ADDITIONAL_LINK_LIBRARIES vfluids)
-
-#################################################################
-###   CREATE PROJECT                                          ###
-#################################################################
-CREATE_CAB_PROJECT(plate2 BINARY)
+CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
+
+########################################################
+## C++ PROJECT                                       ###
+########################################################
+PROJECT(plate2)
+
+INCLUDE(${SOURCE_ROOT}/lib/IncludsList.txt) 
+
+#################################################################
+###   LOCAL FILES                                             ###
+#################################################################
+FILE(GLOB SPECIFIC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.h
+                         ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
+                         ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp  )
+ 
+SET(ALL_SOURCES ${ALL_SOURCES} ${SPECIFIC_FILES})
+SOURCE_GROUP(src FILES ${SPECIFIC_FILES})
+  
+SET(CAB_ADDITIONAL_LINK_LIBRARIES vfluids)
+
+#################################################################
+###   CREATE PROJECT                                          ###
+#################################################################
+CREATE_CAB_PROJECT(plate2 BINARY)
diff --git a/apps/cpu/plate2/plate2.cpp b/apps/cpu/plate2/plate2.cpp
index adce2d5a178f169b56a49deb4ed26e5939ff1c22..8fe2cd3dbbd7f9183927e5e09dd1d20ffc6769ea 100644
--- a/apps/cpu/plate2/plate2.cpp
+++ b/apps/cpu/plate2/plate2.cpp
@@ -1,557 +1,557 @@
-#include <iostream>
-#include <string>
-#include <math.h> 
-
-#include <vfluids.h>
-
-using namespace std;
-
-void run(const char *cstr1, const char *cstr2)
-{
-   try
-   {
-      string pathname; 
-      string pathGeo;
-      string pathLog;
-      int numOfThreads = 1;
-      bool logfile = false;
-      stringstream logFilename;
-      double availMem = 0;
-
-      CommunicatorPtr comm = MPICommunicator::getInstance();
-      int myid = comm->getProcessID();
-
-      string machine = string(cstr1);
-
-      if(machine == "my") 
-      {
-         pathname = "d:/temp/plate2R1e6";
-         pathGeo = "d:/Data/plate";
-         pathLog = "d:/temp/plate2R1e6";
-         numOfThreads = 4;
-         logfile = false;
-         availMem = 15.0e9;
-      }
-      else if(machine == "Ludwig")      
-      {
-         pathname = "/work/koskuche/SFB880/plate2Con";
-         pathGeo = "/home/koskuche/data/plate";
-         pathLog = pathname;
-         numOfThreads = 8;
-         availMem = 12.0e9;///8*numOfThreads;
-         logfile = true;
-      }
-      else if(machine == "HLRS")      
-      {
-         pathname = "/univ_1/ws1/ws/xrmkuchr-plate3-0";
-         pathGeo = "/zhome/academic/HLRS/xrm/xrmkuchr/data/plate";
-         pathLog = "/zhome/academic/HLRS/xrm/xrmkuchr/work/plate";
-         numOfThreads = 16;
-         availMem = 2.0e9;
-         logfile = true;
-      }
-      else if(machine == "HLRN")      
-      {
-         pathname = "/gfs1/work/niivfcpu/scratch/plateEx";
-         pathGeo = "/gfs1/work/niivfcpu/data/plate";
-         pathLog = pathname;
-         numOfThreads = 24;
-         availMem = 64.0e9/24.0*numOfThreads;
-         logfile = true;
-      }
-      else throw UbException(UB_EXARGS, "unknown CAB_MACHINE");
-
-#if defined(__unix__)
-      if (myid==0) 
-      {
-         const char* str = pathLog.c_str();
-         int status=mkdir(str, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
-      }
-#endif 
-
-      if(myid == 0 && logfile)
-      {
-         //UbLog::reportingLevel() = logDEBUG5;
-         logFilename <<  pathLog + "/logfile"+UbSystem::toString(UbSystem::getTimeStamp())+"_"+UbSystem::toString(myid)+".txt";
-         UbLog::output_policy::setStream(logFilename.str());
-      }
-
-      if(myid==0) UBLOG(logINFO,"Testcase plate");
-
-      //string PlatteFilename = pathGeo + "/Platte4mesh_1.8mmProbendicke.stl";
-      string PlatteFilename = pathGeo + "/platte_raw.stl";
-
-      string ZckbndFilename = pathGeo + "/2zackenbaender0.stl";
-
-      ///////////////Knotenabmessungen:
-      int nx[3], blocknx[3];
-      nx[0]      = 90;//240;//120;//60;//86;//43;//65;//50;  //länge
-      nx[1]      = 2;//2;//6;///1;//5;// //breite
-      nx[2]      = 30;//64;//32;//18;//5;//15;//15; //höhe gebiet
-      blocknx[0] = 16;//10;//6;
-      blocknx[1] = 16;//10;//6;
-      blocknx[2] = 16;//10;//6;
-
-      int baseLevel   = 0;
-      int refineLevel = 4;
-
-      double H = 600.0; // Kanalhöhe [mm]
-      double cdx = H/(double)(nx[2]*blocknx[2]);
-      double fdx = cdx/double(1<<refineLevel);
-
-      //double h = 200.0; // gewünschte Plattenhöhe in Gitterpunkten
-      //double fdx = plate->getLengthX3()/h;
-      //double cdx = fdx*double(1<<refineLevel);
-
-      LBMUnitConverterPtr unitConverter = LBMUnitConverterPtr(new LBMUnitConverter());
-
-      //////////////////////////////////////////////////////////////////////////
-      //physik
-      //////////////////////////////////////////////////////////////////////////
-      double Re            = 1133333.3333333335; 
-      double rhoLB         = 0.0;
-      double uLB           = 0.1; 
-      double lReal         = 1000; //Plattenlänge in mm
-      double nuLB          = (uLB*(lReal/cdx))/Re;
-
-      int sizeSP=4;
-      mu::Parser spongeLayer;
-      spongeLayer.SetExpr("x1>=(sizeX-sizeSP)/dx ? (sizeX-(x1+1))/sizeSP/2.0 + 0.5 : 1.0");
-      spongeLayer.DefineConst("sizeX", nx[0]*blocknx[0]);
-      spongeLayer.DefineConst("sizeSP", sizeSP*blocknx[0]);
-
-      Grid3DPtr grid(new Grid3D(comm));
-
-      //////////////////////////////////////////////////////////////////////////
-      //restart
-      UbSchedulerPtr rSch(new UbScheduler(1000,1000,10000000));
-      RestartPostprocessor rp(grid, rSch, comm, pathname, RestartPostprocessor::BINARY);
-      //////////////////////////////////////////////////////////////////////////
-      bool restart;
-
-      if (grid->getTimeStep() == 0)
-      {
-
-         if(myid==0) UBLOG(logINFO,"Neustart..");
-         restart = false;
-         //////////////////////////////////////////////////////////////////////////
-         //Platte
-         GbTriFaceMesh3DPtr plate (GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(PlatteFilename,"Netz"));
-         plate->rotate(90.0,0.0,0.0);  //TriFacMesh-KO-System anders als LB-KO-System
-         if(myid == 0) GbSystem3D::writeGeoObject( plate.get(), pathname+"/geo/platte", WbWriterVtkXmlBinary::getInstance() );
-         //////////////////////////////////////////////////////////////////////////
-         // Zackenband
-         //////////////////////////////////////////////////////////////////////////
-         GbTriFaceMesh3DPtr meshBand1 (GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "NetzBand"));
-         meshBand1->translate(-495, -700, -19.94);
-         if(myid == 0) GbSystem3D::writeGeoObject( meshBand1.get(), pathname+"/geo/Band1", WbWriterVtkXmlASCII::getInstance() );
-         // Zackenband2
-         GbTriFaceMesh3DPtr meshBand2(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "NetzBand2"));
-         meshBand2->translate(-495, -705, -19.94); 
-         if(myid == 0) GbSystem3D::writeGeoObject( meshBand2.get(), pathname+"/geo/Band2", WbWriterVtkXmlASCII::getInstance() );
-         // Zackenband3
-         GbTriFaceMesh3DPtr meshBand3(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "NetzBand3"));
-         meshBand3->translate(-495, -700, -19.64); 
-         if(myid == 0) GbSystem3D::writeGeoObject( meshBand3.get(), pathname+"/geo/Band3", WbWriterVtkXmlASCII::getInstance() );
-         // Zackenband4
-         GbTriFaceMesh3DPtr meshBand4(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "NetzBand4"));
-         meshBand4->translate(-495, -705, -19.64); 
-         if(myid == 0) GbSystem3D::writeGeoObject( meshBand4.get(), pathname+"/geo/Band4", WbWriterVtkXmlASCII::getInstance() );
-         //////////////////////////////////////////////////////////////////////////
-
-         double blockLengthx1 = blocknx[0]*cdx; //geowerte
-         double blockLengthx2 = blockLengthx1;
-         double blockLengthx3 = blockLengthx1;
-
-         double geoLength[]   = {  nx[0]*blockLengthx1, nx[1]*blockLengthx2, nx[2]*blockLengthx3}; 
-
-         double originX1 = plate->getX1Minimum()-plate->getLengthX1()/4.0;
-         double originX2 = plate->getX2Minimum();
-         double originX3 = plate->getX3Minimum()-299.5;
-
-
-         bool periodicx1 = false;
-         bool periodicx2 = true;
-         bool periodicx3 = true;
-
-         //bounding box
-         double g_minX1 = originX1;
-         double g_minX2 = originX2;
-         double g_minX3 = originX3;
-
-         double g_maxX1 = originX1 + geoLength[0];
-         double g_maxX2 = originX2 + geoLength[1];
-         double g_maxX3 = originX3 + geoLength[2];;
-
-
-         //set grid
-         grid->setDeltaX(cdx);
-         grid->setBlockNX(blocknx[0], blocknx[1], blocknx[2]);
-         grid->setPeriodicX1(periodicx1);
-         grid->setPeriodicX2(periodicx2);
-         grid->setPeriodicX3(periodicx3);
-
-         GbObject3DPtr gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
-         gridCube->setCenterCoordinates(gridCube->getX1Centroid(),meshBand1->getX2Centroid(),gridCube->getX3Centroid());
-         if(myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), pathname+"/geo/gridCube", WbWriterVtkXmlASCII::getInstance());
-
-         originX2 = gridCube->getX2Minimum();
-         g_minX2 = originX2;
-         g_maxX2 = originX2 + geoLength[1];
-
-         GenBlocksGridVisitor genBlocks(gridCube);
-         grid->accept(genBlocks);
-
-         //////////////////////////////////////////////////////////////////////////
-         if(myid == 0)
-         {
-            UBLOG(logINFO, "*****************************************");
-            UBLOG(logINFO, "* Parameters                            *");
-            UBLOG(logINFO, "* Re            ="<<Re);
-            UBLOG(logINFO, "* nuLB          ="<<nuLB);
-            UBLOG(logINFO, "* uLB           ="<<uLB);
-            UBLOG(logINFO, "* cdx           ="<<cdx);
-            UBLOG(logINFO, "* fdx           ="<<fdx);
-            double Hzb = 0.6/fdx;
-            UBLOG(logINFO, "* Height of Zackenband ="<<Hzb);
-            UBLOG(logINFO, "* Re on Zackenband ="<<(uLB*Hzb)/(nuLB*double(1<<refineLevel)));
-            UBLOG(logINFO, "* nx1/2/3       ="<<nx[0]<<"/"<<nx[1]<<"/"<<nx[2]);
-            UBLOG(logINFO, "* blocknx1/2/3  ="<<blocknx[0]<<"/"<<blocknx[1]<<"/"<<blocknx[2]);
-            UBLOG(logINFO, "* x1Periodic    ="<<periodicx1);
-            UBLOG(logINFO, "* x2Periodic    ="<<periodicx2);
-            UBLOG(logINFO, "* x3Periodic    ="<<periodicx3);
-            UBLOG(logINFO, "* number of levels  ="<<refineLevel+1);
-            UBLOG(logINFO, "* path          ="<<pathname);
-
-            UBLOG(logINFO, "*****************************************");
-            UBLOG(logINFO, "* number of threads    ="<<numOfThreads);
-            UBLOG(logINFO, "* number of processes  ="<<comm->getNumberOfProcesses());
-            UBLOG(logINFO, "*****************************************");
-            UBLOG(logINFO, "*****************************************");     
-         }
-         //////////////////////////////////////////////////////////////////////////
-
-
-         //////////////////////////////////////////////////////////////////////////
-         //refinement
-         GbCuboid3DPtr refinePlatteBox(new GbCuboid3D(plate->getX1Minimum(), plate->getX2Minimum(), plate->getX3Minimum()+(plate->getX3Maximum()-plate->getX3Minimum())/2.0, 
-            plate->getX1Maximum()+40.0, plate->getX2Maximum(), plate->getX3Maximum()));
-         if(myid == 0) GbSystem3D::writeGeoObject( refinePlatteBox.get(), pathname+"/geo/refinePlatteBox", WbWriterVtkXmlASCII::getInstance() );
-
-         if (refineLevel > 0)
-         {
-            if(myid == 0) UBLOG(logINFO,"Refinement - start");	
-            RefineCrossAndInsideGbObjectHelper refineHelper(grid, refineLevel);
-            refineHelper.addGbObject(refinePlatteBox, refineLevel);
-            refineHelper.refine();
-            if(myid == 0) UBLOG(logINFO,"Refinement - end");	
-         }
-
-         /////////////////////////////////////////////////
-         ///interactoren
-         int bbOption1 = 1; //0=simple Bounce Back, 1=quadr. BB
-         D3Q27BoundaryConditionAdapterPtr bcObst(new D3Q27NoSlipBCAdapter(bbOption1));
-         D3Q27TriFaceMeshInteractorPtr triPlateInteractor( new D3Q27TriFaceMeshInteractor(plate, grid, bcObst,Interactor3D::SOLID));
-         D3Q27TriFaceMeshInteractorPtr triBand1Interactor( new D3Q27TriFaceMeshInteractor( meshBand1, grid, bcObst,Interactor3D::SOLID, Interactor3D::EDGES) );
-         D3Q27TriFaceMeshInteractorPtr triBand2Interactor( new D3Q27TriFaceMeshInteractor( meshBand2, grid, bcObst,Interactor3D::SOLID, Interactor3D::EDGES) );
-         D3Q27TriFaceMeshInteractorPtr triBand3Interactor( new D3Q27TriFaceMeshInteractor( meshBand3, grid, bcObst,Interactor3D::SOLID, Interactor3D::EDGES) );
-         D3Q27TriFaceMeshInteractorPtr triBand4Interactor( new D3Q27TriFaceMeshInteractor( meshBand4, grid, bcObst,Interactor3D::SOLID, Interactor3D::EDGES) );
-
-         //inflow
-         GbCuboid3DPtr velBCCuboid(new GbCuboid3D(originX1-blockLengthx1, originX2-blockLengthx1, originX3-blockLengthx1, 
-            originX1, originX2+geoLength[1]+blockLengthx1, originX3+geoLength[2]+blockLengthx1));
-         if(myid == 0) GbSystem3D::writeGeoObject(velBCCuboid.get(), pathname+"/geo/velBCCuboid", WbWriterVtkXmlASCII::getInstance());
-         D3Q27InteractorPtr velBCInteractor(new D3Q27Interactor(velBCCuboid,grid,Interactor3D::SOLID)); 
-
-         //inflow
-         double raiseVelSteps = 0;
-         vector<D3Q27BCFunction> velcX1BCs,dummy;
-
-         mu::Parser inflowProfile;
-         inflowProfile.SetExpr("uLB"); 
-         inflowProfile.DefineConst("uLB",uLB);
-         velcX1BCs.push_back(D3Q27BCFunction(inflowProfile,raiseVelSteps,D3Q27BCFunction::INFCONST));
-
-         D3Q27BoundaryConditionAdapterPtr velBCAdapter(new D3Q27VelocityBCAdapter (velcX1BCs,dummy,dummy));
-         velBCInteractor->addBCAdapter(velBCAdapter);
-
-         //outflow
-         GbCuboid3DPtr densCuboid(new GbCuboid3D(originX1+geoLength[0], originX2-blockLengthx1, originX3-blockLengthx1, 
-            originX1+geoLength[0]+blockLengthx1, originX2+geoLength[1]+blockLengthx1, originX3+geoLength[2]+blockLengthx1 ));
-         if(myid == 0) GbSystem3D::writeGeoObject(densCuboid.get(), pathname+"/geo/densCuboid", WbWriterVtkXmlASCII::getInstance());
-         D3Q27BoundaryConditionAdapterPtr denBCAdapter(new D3Q27DensityBCAdapter(rhoLB));
-         D3Q27InteractorPtr densInteractor( new D3Q27Interactor(densCuboid,grid,denBCAdapter,Interactor3D::SOLID) );
-
-         ////////////////////////////////////////////
-         //METIS
-         Grid3DVisitorPtr metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B));	
-
-         ////////////////////////////////////////////
-         /////delete solid blocks
-         if(myid == 0) UBLOG(logINFO,"deleteSolidBlocks - start");
-         InteractorsHelper intHelper(grid, metisVisitor);
-         intHelper.addInteractor(triPlateInteractor);
-         intHelper.addInteractor(triBand1Interactor);
-         intHelper.addInteractor(triBand2Interactor);
-         intHelper.addInteractor(triBand3Interactor);
-         intHelper.addInteractor(triBand4Interactor);
-         intHelper.addInteractor(densInteractor);
-         intHelper.addInteractor(velBCInteractor);
-         intHelper.selectBlocks();
-         if(myid == 0) UBLOG(logINFO,"deleteSolidBlocks - end");	 
-         //////////////////////////////////////
-
-         //domain decomposition for threads
-         if(numOfThreads > 1)
-         {
-            PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
-            grid->accept(pqPartVisitor);
-         }
-
-         if(myid == 0)
-         {
-            UBLOG(logINFO,"Write blocks - start");
-            BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm));
-            ppblocks->update(0);
-            UBLOG(logINFO,"Write blocks - end");
-         }
-
-         unsigned long nob = grid->getNumberOfBlocks();
-         unsigned long nod = nob * blocknx[0]*blocknx[1]*blocknx[2];
-         unsigned long nod_real = nob * (blocknx[0]+3)*(blocknx[1]+3)*(blocknx[2]+3);
-         unsigned long nodb = (blocknx[0]) * (blocknx[1]) * (blocknx[2]);
-
-         double needMemAll  = double(nod_real*(27*sizeof(double) + sizeof(int)));
-         double needMem  = needMemAll / double(comm->getNumberOfProcesses());
-         
-         double nup = 0; 
-
-         if(myid == 0)
-         {
-            UBLOG(logINFO,"Number of blocks = " << nob);
-            UBLOG(logINFO,"Number of nodes  = " << nod);
-            int minInitLevel = grid->getCoarsestInitializedLevel();
-            int maxInitLevel = grid->getFinestInitializedLevel();
-            for(int level = minInitLevel; level<=maxInitLevel; level++)
-            {
-               int nobl = grid->getNumberOfBlocks(level);
-               UBLOG(logINFO,"Number of blocks for level " << level <<" = " << nobl);
-               UBLOG(logINFO,"Number of nodes for level " << level <<" = " << nobl*nodb);
-               nup += nobl*nodb*double(1<<level); 
-            }
-            UBLOG(logINFO,"Hypothetically time for calculation step for 120 nodes  = " << nup/6.0e5/(120*8)  << " s");
-            UBLOG(logINFO,"Necessary memory  = " << needMemAll  << " bytes");
-            UBLOG(logINFO,"Necessary memory per process = " << needMem  << " bytes");
-            UBLOG(logINFO,"Available memory per process = " << availMem << " bytes");
-            UBLOG(logINFO,"Available memory per node/8.0 = " << (availMem/8.0) << " bytes");
-         }
-
-         //////////////////////////////////////////
-         //set connectors
-         if(myid == 0) UBLOG(logINFO,"set connectors - start");
-         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
-         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
-         grid->accept( setConnsVisitor );
-         if(myid == 0) UBLOG(logINFO,"set connectors - end");
-
-         ////////////////////////////
-         LBMKernel3DPtr kernel;
-         //kernel = LBMKernel3DPtr(new LBMKernelETD3Q27CCLB(blocknx[0], blocknx[1], blocknx[2], LBMKernelETD3Q27CCLB::NORMAL));
-
-         //with sponge layer
-         kernel = LBMKernel3DPtr(new LBMKernelETD3Q27CCLBWithSpongeLayer(blocknx[0], blocknx[1], blocknx[2], LBMKernelETD3Q27CCLB::NORMAL));
-         kernel->setWithSpongeLayer(true);
-         kernel->setSpongeLayer(spongeLayer);
-
-         BCProcessorPtr bcProc(new D3Q27ETBCProcessor());
-         kernel->setBCProcessor(bcProc);
-         SetKernelBlockVisitor kernelVisitor(kernel, nuLB, availMem, needMem);
-         grid->accept(kernelVisitor);
-         //////////////////////////////////
-         //undef nodes
-         if (refineLevel > 0)
-         {
-            D3Q27SetUndefinedNodesBlockVisitor undefNodesVisitor;
-            grid->accept(undefNodesVisitor);
-         }
-
-
-         intHelper.setBC();
-
-         //initialization of decompositions
-         D3Q27ETInitDistributionsBlockVisitor initVisitor( nuLB,rhoLB);
-         initVisitor.setVx1(uLB);
-         grid->accept(initVisitor);
-
-         //Postprozess
-         UbSchedulerPtr geoSch(new UbScheduler(1));
-         D3Q27MacroscopicQuantitiesPostprocessorPtr ppgeo(
-            new D3Q27MacroscopicQuantitiesPostprocessor(grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), 
-            unitConverter, true));
-         ppgeo->update(0);
-         ppgeo.reset();
-         geoSch.reset();
-
-         if(myid == 0) UBLOG(logINFO,"Preprozess - end");      
-      }
-      else
-      {
-         restart = true;
-
-         //domain decomposition for threads
-         if(numOfThreads > 1)
-         {
-            PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
-            grid->accept(pqPartVisitor);
-         }
-         //set connectors
-         //grid->setPeriodicX3(false);
-         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
-         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
-         grid->accept( setConnsVisitor );
-         SetSpongeLayerBlockVisitor ssp(spongeLayer);
-         grid->accept(ssp);
-
-         //////////////////////////////////////////////////////////////////////////
-         //////////////////////////////////////////////////////////////////////////
-         //Platte
-         GbTriFaceMesh3DPtr plate (GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(PlatteFilename,"Netz"));
-         plate->rotate(90.0,0.0,0.0);  //TriFacMesh-KO-System anders als LB-KO-System
-         if(myid == 0) GbSystem3D::writeGeoObject( plate.get(), pathname+"/geo/platte", WbWriterVtkXmlBinary::getInstance() );
-         //////////////////////////////////////////////////////////////////////////
-         //////////////////////////////////////////////////////////////////////////
-         // Zackenband
-         //////////////////////////////////////////////////////////////////////////
-         GbTriFaceMesh3DPtr meshBand1 (GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "NetzBand"));
-         meshBand1->translate(-495, -700, -19.94);
-         if(myid == 0) GbSystem3D::writeGeoObject( meshBand1.get(), pathname+"/geo/Band1", WbWriterVtkXmlASCII::getInstance() );
-
-         double blockLengthx1 = blocknx[0]*cdx; //geowerte
-         double blockLengthx2 = blockLengthx1;
-         double blockLengthx3 = blockLengthx1;
-
-         double geoLength[]   = {  nx[0]*blockLengthx1, nx[1]*blockLengthx2, nx[2]*blockLengthx3}; 
-
-         double originX1 = plate->getX1Minimum()-plate->getLengthX1()/4.0;
-         double originX2 = plate->getX2Minimum();
-         double originX3 = plate->getX3Minimum()-299.5;
-
-         //bounding box
-         double g_minX1 = originX1;
-         double g_minX2 = originX2;
-         double g_minX3 = originX3;
-
-         double g_maxX1 = originX1 + geoLength[0];
-         double g_maxX2 = originX2 + geoLength[1];
-         double g_maxX3 = originX3 + geoLength[2];;
-
-         GbObject3DPtr gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
-         gridCube->setCenterCoordinates(gridCube->getX1Centroid(),meshBand1->getX2Centroid(),gridCube->getX3Centroid());
-         if(myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), pathname+"/geo/gridCube", WbWriterVtkXmlASCII::getInstance());
-
-         originX2 = gridCube->getX2Minimum();
-         g_minX2 = originX2;
-         g_maxX2 = originX2 + geoLength[1];
-         //walls
-         GbCuboid3DPtr addWallZmin (new GbCuboid3D(g_minX1-blockLengthx1, g_minX2-blockLengthx1, g_minX3-blockLengthx1, g_maxX1+blockLengthx1, g_maxX2+blockLengthx1, g_minX3));
-         if(myid == 0) GbSystem3D::writeGeoObject(addWallZmin.get(), pathname+"/geo/addWallZmin", WbWriterVtkXmlASCII::getInstance());
-
-         GbCuboid3DPtr addWallZmax (new GbCuboid3D(g_minX1-blockLengthx1, g_minX2-blockLengthx1, g_maxX3, g_maxX1+blockLengthx1, g_maxX2+blockLengthx1, g_maxX3+blockLengthx1));
-         if(myid == 0) GbSystem3D::writeGeoObject(addWallZmax.get(), pathname+"/geo/addWallZmax", WbWriterVtkXmlASCII::getInstance());
-
-         //walls
-         int bbOption = 1; //0=simple Bounce Back, 1=quadr. BB        
-         D3Q27BoundaryConditionAdapterPtr slip(new D3Q27SlipBCAdapter(bbOption));
-         D3Q27InteractorPtr addWallZminInt(new D3Q27Interactor(addWallZmin, grid, slip,Interactor3D::SOLID));
-         D3Q27InteractorPtr addWallZmaxInt(new D3Q27Interactor(addWallZmax, grid, slip,Interactor3D::SOLID));
-
-         SetSolidOrTransBlockVisitor v1(addWallZminInt, SetSolidOrTransBlockVisitor::TRANS);
-         grid->accept(v1);
-         addWallZminInt->initInteractor();
-         SetSolidOrTransBlockVisitor v2(addWallZmaxInt, SetSolidOrTransBlockVisitor::TRANS);
-         grid->accept(v2);        
-         addWallZmaxInt->initInteractor();
-
-         UbSchedulerPtr geoSch(new UbScheduler(1));
-         D3Q27MacroscopicQuantitiesPostprocessorPtr ppgeo(
-            new D3Q27MacroscopicQuantitiesPostprocessor(grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), 
-            unitConverter, true));
-         ppgeo->update(0);
-         ppgeo.reset();
-         geoSch.reset();
-         //////////////////////////////////////////////////////////////////////////
-
-         if(myid == 0) UBLOG(logINFO,"Restart - end"); 
-      }
-      UbSchedulerPtr visSch(new UbScheduler());
-      //visSch->addSchedule(1,0,3);
-      //visSch->addSchedule(100,100,1000);
-      //visSch->addSchedule(1000,1000,5000);
-      //visSch->addSchedule(5000,5000,100000);
-      //visSch->addSchedule(100000,100000,10000000);
-
-      visSch->addSchedule(1000,1000,10000000);
-
-      D3Q27MacroscopicQuantitiesPostprocessor pp(grid, visSch, pathname, WbWriterVtkXmlBinary::getInstance(), unitConverter);
-
-      double startStep = 88000;
-
-      UbSchedulerPtr resSchRMS(new UbScheduler());
-      resSchRMS->addSchedule(1000000, startStep, 10000000);
-      UbSchedulerPtr resSchMeans(new UbScheduler());
-      resSchMeans->addSchedule(1000000, startStep, 10000000);
-      UbSchedulerPtr stepAvSch(new UbScheduler());
-      int averageInterval=100;
-      stepAvSch->addSchedule(averageInterval,0,10000000);
-      AverageValuesPostprocessor Avpp(grid, pathname, WbWriterVtkXmlBinary::getInstance(), visSch/*wann wird rausgeschrieben*/, 
-         stepAvSch/*wann wird gemittelt*/, resSchMeans,resSchRMS/*wann wird resettet*/,restart);
-
-      UbSchedulerPtr nupsSch(new UbScheduler(10, 10, 30));
-      nupsSch->addSchedule(500,500,1e6);
-      NUPSCounterPostprocessor npr(grid, nupsSch, numOfThreads, comm);
-
-      UbSchedulerPtr emSch(new UbScheduler(10));
-      EmergencyExitPostprocessor empr(grid, emSch, pathname, RestartPostprocessorPtr(&rp), comm);
-
-      if(myid == 0)
-      {
-         UBLOG(logINFO,"PID = " << myid << " Total Physical Memory (RAM): " << Utilities::getTotalPhysMem());
-         UBLOG(logINFO,"PID = " << myid << " Physical Memory currently used: " << Utilities::getPhysMemUsed());
-         UBLOG(logINFO,"PID = " << myid << " Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe());
-      }
-
-      string lastStep = string(cstr2);
-      double endTime = UbSystem::stringTo<double>(lastStep);
-      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, visSch));
-      if(myid == 0) UBLOG(logINFO,"Simulation-start");
-      calculation->calculate();
-      if(myid == 0) UBLOG(logINFO,"Simulation-end");
-   }
-   catch(std::exception& e)
-   {
-      cerr << e.what() << endl << flush;
-   }
-   catch(std::string& s)
-   {
-      cerr << s << endl;
-   }
-   catch(...)
-   {
-      cerr << "unknown exception" << endl;
-   }
-
-}
-//////////////////////////////////////////////////////////////////////////
-int main(int argc, char* argv[])
-{
-   if (argc == 1)
-   {
-      cout<<"Command line argument isn't specified!"<<endl;
-      cout<<"plate2 <machine name>"<<endl;
-      return 1;
-   }
-   run(argv[1], argv[2]);
-
-   return 0;
-}
-
+#include <iostream>
+#include <string>
+#include <math.h> 
+
+#include <vfluids.h>
+
+using namespace std;
+
+void run(const char *cstr1, const char *cstr2)
+{
+   try
+   {
+      string pathname; 
+      string pathGeo;
+      string pathLog;
+      int numOfThreads = 1;
+      bool logfile = false;
+      stringstream logFilename;
+      double availMem = 0;
+
+      CommunicatorPtr comm = MPICommunicator::getInstance();
+      int myid = comm->getProcessID();
+
+      string machine = string(cstr1);
+
+      if(machine == "my") 
+      {
+         pathname = "d:/temp/plate2R1e6";
+         pathGeo = "d:/Data/plate";
+         pathLog = "d:/temp/plate2R1e6";
+         numOfThreads = 4;
+         logfile = false;
+         availMem = 15.0e9;
+      }
+      else if(machine == "Ludwig")      
+      {
+         pathname = "/work/koskuche/SFB880/plate2Con";
+         pathGeo = "/home/koskuche/data/plate";
+         pathLog = pathname;
+         numOfThreads = 8;
+         availMem = 12.0e9;///8*numOfThreads;
+         logfile = true;
+      }
+      else if(machine == "HLRS")      
+      {
+         pathname = "/univ_1/ws1/ws/xrmkuchr-plate3-0";
+         pathGeo = "/zhome/academic/HLRS/xrm/xrmkuchr/data/plate";
+         pathLog = "/zhome/academic/HLRS/xrm/xrmkuchr/work/plate";
+         numOfThreads = 16;
+         availMem = 2.0e9;
+         logfile = true;
+      }
+      else if(machine == "HLRN")      
+      {
+         pathname = "/gfs1/work/niivfcpu/scratch/plateEx";
+         pathGeo = "/gfs1/work/niivfcpu/data/plate";
+         pathLog = pathname;
+         numOfThreads = 24;
+         availMem = 64.0e9/24.0*numOfThreads;
+         logfile = true;
+      }
+      else throw UbException(UB_EXARGS, "unknown CAB_MACHINE");
+
+#if defined(__unix__)
+      if (myid==0) 
+      {
+         const char* str = pathLog.c_str();
+         int status=mkdir(str, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
+      }
+#endif 
+
+      if(myid == 0 && logfile)
+      {
+         //UbLog::reportingLevel() = logDEBUG5;
+         logFilename <<  pathLog + "/logfile"+UbSystem::toString(UbSystem::getTimeStamp())+"_"+UbSystem::toString(myid)+".txt";
+         UbLog::output_policy::setStream(logFilename.str());
+      }
+
+      if(myid==0) UBLOG(logINFO,"Testcase plate");
+
+      //string PlatteFilename = pathGeo + "/Platte4mesh_1.8mmProbendicke.stl";
+      string PlatteFilename = pathGeo + "/platte_raw.stl";
+
+      string ZckbndFilename = pathGeo + "/2zackenbaender0.stl";
+
+      ///////////////Knotenabmessungen:
+      int nx[3], blocknx[3];
+      nx[0]      = 90;//240;//120;//60;//86;//43;//65;//50;  //länge
+      nx[1]      = 2;//2;//6;///1;//5;// //breite
+      nx[2]      = 30;//64;//32;//18;//5;//15;//15; //höhe gebiet
+      blocknx[0] = 16;//10;//6;
+      blocknx[1] = 16;//10;//6;
+      blocknx[2] = 16;//10;//6;
+
+      int baseLevel   = 0;
+      int refineLevel = 4;
+
+      double H = 600.0; // Kanalhöhe [mm]
+      double cdx = H/(double)(nx[2]*blocknx[2]);
+      double fdx = cdx/double(1<<refineLevel);
+
+      //double h = 200.0; // gewünschte Plattenhöhe in Gitterpunkten
+      //double fdx = plate->getLengthX3()/h;
+      //double cdx = fdx*double(1<<refineLevel);
+
+      LBMUnitConverterPtr unitConverter = LBMUnitConverterPtr(new LBMUnitConverter());
+
+      //////////////////////////////////////////////////////////////////////////
+      //physik
+      //////////////////////////////////////////////////////////////////////////
+      double Re            = 1133333.3333333335; 
+      double rhoLB         = 0.0;
+      double uLB           = 0.1; 
+      double lReal         = 1000; //Plattenlänge in mm
+      double nuLB          = (uLB*(lReal/cdx))/Re;
+
+      int sizeSP=4;
+      mu::Parser spongeLayer;
+      spongeLayer.SetExpr("x1>=(sizeX-sizeSP)/dx ? (sizeX-(x1+1))/sizeSP/2.0 + 0.5 : 1.0");
+      spongeLayer.DefineConst("sizeX", nx[0]*blocknx[0]);
+      spongeLayer.DefineConst("sizeSP", sizeSP*blocknx[0]);
+
+      Grid3DPtr grid(new Grid3D(comm));
+
+      //////////////////////////////////////////////////////////////////////////
+      //restart
+      UbSchedulerPtr rSch(new UbScheduler(1000,1000,10000000));
+      RestartPostprocessor rp(grid, rSch, comm, pathname, RestartPostprocessor::BINARY);
+      //////////////////////////////////////////////////////////////////////////
+      bool restart;
+
+      if (grid->getTimeStep() == 0)
+      {
+
+         if(myid==0) UBLOG(logINFO,"Neustart..");
+         restart = false;
+         //////////////////////////////////////////////////////////////////////////
+         //Platte
+         GbTriFaceMesh3DPtr plate (GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(PlatteFilename,"Netz"));
+         plate->rotate(90.0,0.0,0.0);  //TriFacMesh-KO-System anders als LB-KO-System
+         if(myid == 0) GbSystem3D::writeGeoObject( plate.get(), pathname+"/geo/platte", WbWriterVtkXmlBinary::getInstance() );
+         //////////////////////////////////////////////////////////////////////////
+         // Zackenband
+         //////////////////////////////////////////////////////////////////////////
+         GbTriFaceMesh3DPtr meshBand1 (GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "NetzBand"));
+         meshBand1->translate(-495, -700, -19.94);
+         if(myid == 0) GbSystem3D::writeGeoObject( meshBand1.get(), pathname+"/geo/Band1", WbWriterVtkXmlASCII::getInstance() );
+         // Zackenband2
+         GbTriFaceMesh3DPtr meshBand2(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "NetzBand2"));
+         meshBand2->translate(-495, -705, -19.94); 
+         if(myid == 0) GbSystem3D::writeGeoObject( meshBand2.get(), pathname+"/geo/Band2", WbWriterVtkXmlASCII::getInstance() );
+         // Zackenband3
+         GbTriFaceMesh3DPtr meshBand3(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "NetzBand3"));
+         meshBand3->translate(-495, -700, -19.64); 
+         if(myid == 0) GbSystem3D::writeGeoObject( meshBand3.get(), pathname+"/geo/Band3", WbWriterVtkXmlASCII::getInstance() );
+         // Zackenband4
+         GbTriFaceMesh3DPtr meshBand4(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "NetzBand4"));
+         meshBand4->translate(-495, -705, -19.64); 
+         if(myid == 0) GbSystem3D::writeGeoObject( meshBand4.get(), pathname+"/geo/Band4", WbWriterVtkXmlASCII::getInstance() );
+         //////////////////////////////////////////////////////////////////////////
+
+         double blockLengthx1 = blocknx[0]*cdx; //geowerte
+         double blockLengthx2 = blockLengthx1;
+         double blockLengthx3 = blockLengthx1;
+
+         double geoLength[]   = {  nx[0]*blockLengthx1, nx[1]*blockLengthx2, nx[2]*blockLengthx3}; 
+
+         double originX1 = plate->getX1Minimum()-plate->getLengthX1()/4.0;
+         double originX2 = plate->getX2Minimum();
+         double originX3 = plate->getX3Minimum()-299.5;
+
+
+         bool periodicx1 = false;
+         bool periodicx2 = true;
+         bool periodicx3 = true;
+
+         //bounding box
+         double g_minX1 = originX1;
+         double g_minX2 = originX2;
+         double g_minX3 = originX3;
+
+         double g_maxX1 = originX1 + geoLength[0];
+         double g_maxX2 = originX2 + geoLength[1];
+         double g_maxX3 = originX3 + geoLength[2];;
+
+
+         //set grid
+         grid->setDeltaX(cdx);
+         grid->setBlockNX(blocknx[0], blocknx[1], blocknx[2]);
+         grid->setPeriodicX1(periodicx1);
+         grid->setPeriodicX2(periodicx2);
+         grid->setPeriodicX3(periodicx3);
+
+         GbObject3DPtr gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
+         gridCube->setCenterCoordinates(gridCube->getX1Centroid(),meshBand1->getX2Centroid(),gridCube->getX3Centroid());
+         if(myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), pathname+"/geo/gridCube", WbWriterVtkXmlASCII::getInstance());
+
+         originX2 = gridCube->getX2Minimum();
+         g_minX2 = originX2;
+         g_maxX2 = originX2 + geoLength[1];
+
+         GenBlocksGridVisitor genBlocks(gridCube);
+         grid->accept(genBlocks);
+
+         //////////////////////////////////////////////////////////////////////////
+         if(myid == 0)
+         {
+            UBLOG(logINFO, "*****************************************");
+            UBLOG(logINFO, "* Parameters                            *");
+            UBLOG(logINFO, "* Re            ="<<Re);
+            UBLOG(logINFO, "* nuLB          ="<<nuLB);
+            UBLOG(logINFO, "* uLB           ="<<uLB);
+            UBLOG(logINFO, "* cdx           ="<<cdx);
+            UBLOG(logINFO, "* fdx           ="<<fdx);
+            double Hzb = 0.6/fdx;
+            UBLOG(logINFO, "* Height of Zackenband ="<<Hzb);
+            UBLOG(logINFO, "* Re on Zackenband ="<<(uLB*Hzb)/(nuLB*double(1<<refineLevel)));
+            UBLOG(logINFO, "* nx1/2/3       ="<<nx[0]<<"/"<<nx[1]<<"/"<<nx[2]);
+            UBLOG(logINFO, "* blocknx1/2/3  ="<<blocknx[0]<<"/"<<blocknx[1]<<"/"<<blocknx[2]);
+            UBLOG(logINFO, "* x1Periodic    ="<<periodicx1);
+            UBLOG(logINFO, "* x2Periodic    ="<<periodicx2);
+            UBLOG(logINFO, "* x3Periodic    ="<<periodicx3);
+            UBLOG(logINFO, "* number of levels  ="<<refineLevel+1);
+            UBLOG(logINFO, "* path          ="<<pathname);
+
+            UBLOG(logINFO, "*****************************************");
+            UBLOG(logINFO, "* number of threads    ="<<numOfThreads);
+            UBLOG(logINFO, "* number of processes  ="<<comm->getNumberOfProcesses());
+            UBLOG(logINFO, "*****************************************");
+            UBLOG(logINFO, "*****************************************");     
+         }
+         //////////////////////////////////////////////////////////////////////////
+
+
+         //////////////////////////////////////////////////////////////////////////
+         //refinement
+         GbCuboid3DPtr refinePlatteBox(new GbCuboid3D(plate->getX1Minimum(), plate->getX2Minimum(), plate->getX3Minimum()+(plate->getX3Maximum()-plate->getX3Minimum())/2.0, 
+            plate->getX1Maximum()+40.0, plate->getX2Maximum(), plate->getX3Maximum()));
+         if(myid == 0) GbSystem3D::writeGeoObject( refinePlatteBox.get(), pathname+"/geo/refinePlatteBox", WbWriterVtkXmlASCII::getInstance() );
+
+         if (refineLevel > 0)
+         {
+            if(myid == 0) UBLOG(logINFO,"Refinement - start");	
+            RefineCrossAndInsideGbObjectHelper refineHelper(grid, refineLevel);
+            refineHelper.addGbObject(refinePlatteBox, refineLevel);
+            refineHelper.refine();
+            if(myid == 0) UBLOG(logINFO,"Refinement - end");	
+         }
+
+         /////////////////////////////////////////////////
+         ///interactoren
+         int bbOption1 = 1; //0=simple Bounce Back, 1=quadr. BB
+         D3Q27BoundaryConditionAdapterPtr bcObst(new D3Q27NoSlipBCAdapter(bbOption1));
+         D3Q27TriFaceMeshInteractorPtr triPlateInteractor( new D3Q27TriFaceMeshInteractor(plate, grid, bcObst,Interactor3D::SOLID));
+         D3Q27TriFaceMeshInteractorPtr triBand1Interactor( new D3Q27TriFaceMeshInteractor( meshBand1, grid, bcObst,Interactor3D::SOLID, Interactor3D::EDGES) );
+         D3Q27TriFaceMeshInteractorPtr triBand2Interactor( new D3Q27TriFaceMeshInteractor( meshBand2, grid, bcObst,Interactor3D::SOLID, Interactor3D::EDGES) );
+         D3Q27TriFaceMeshInteractorPtr triBand3Interactor( new D3Q27TriFaceMeshInteractor( meshBand3, grid, bcObst,Interactor3D::SOLID, Interactor3D::EDGES) );
+         D3Q27TriFaceMeshInteractorPtr triBand4Interactor( new D3Q27TriFaceMeshInteractor( meshBand4, grid, bcObst,Interactor3D::SOLID, Interactor3D::EDGES) );
+
+         //inflow
+         GbCuboid3DPtr velBCCuboid(new GbCuboid3D(originX1-blockLengthx1, originX2-blockLengthx1, originX3-blockLengthx1, 
+            originX1, originX2+geoLength[1]+blockLengthx1, originX3+geoLength[2]+blockLengthx1));
+         if(myid == 0) GbSystem3D::writeGeoObject(velBCCuboid.get(), pathname+"/geo/velBCCuboid", WbWriterVtkXmlASCII::getInstance());
+         D3Q27InteractorPtr velBCInteractor(new D3Q27Interactor(velBCCuboid,grid,Interactor3D::SOLID)); 
+
+         //inflow
+         double raiseVelSteps = 0;
+         vector<D3Q27BCFunction> velcX1BCs,dummy;
+
+         mu::Parser inflowProfile;
+         inflowProfile.SetExpr("uLB"); 
+         inflowProfile.DefineConst("uLB",uLB);
+         velcX1BCs.push_back(D3Q27BCFunction(inflowProfile,raiseVelSteps,D3Q27BCFunction::INFCONST));
+
+         D3Q27BoundaryConditionAdapterPtr velBCAdapter(new D3Q27VelocityBCAdapter (velcX1BCs,dummy,dummy));
+         velBCInteractor->addBCAdapter(velBCAdapter);
+
+         //outflow
+         GbCuboid3DPtr densCuboid(new GbCuboid3D(originX1+geoLength[0], originX2-blockLengthx1, originX3-blockLengthx1, 
+            originX1+geoLength[0]+blockLengthx1, originX2+geoLength[1]+blockLengthx1, originX3+geoLength[2]+blockLengthx1 ));
+         if(myid == 0) GbSystem3D::writeGeoObject(densCuboid.get(), pathname+"/geo/densCuboid", WbWriterVtkXmlASCII::getInstance());
+         D3Q27BoundaryConditionAdapterPtr denBCAdapter(new D3Q27DensityBCAdapter(rhoLB));
+         D3Q27InteractorPtr densInteractor( new D3Q27Interactor(densCuboid,grid,denBCAdapter,Interactor3D::SOLID) );
+
+         ////////////////////////////////////////////
+         //METIS
+         Grid3DVisitorPtr metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B));	
+
+         ////////////////////////////////////////////
+         /////delete solid blocks
+         if(myid == 0) UBLOG(logINFO,"deleteSolidBlocks - start");
+         InteractorsHelper intHelper(grid, metisVisitor);
+         intHelper.addInteractor(triPlateInteractor);
+         intHelper.addInteractor(triBand1Interactor);
+         intHelper.addInteractor(triBand2Interactor);
+         intHelper.addInteractor(triBand3Interactor);
+         intHelper.addInteractor(triBand4Interactor);
+         intHelper.addInteractor(densInteractor);
+         intHelper.addInteractor(velBCInteractor);
+         intHelper.selectBlocks();
+         if(myid == 0) UBLOG(logINFO,"deleteSolidBlocks - end");	 
+         //////////////////////////////////////
+
+         //domain decomposition for threads
+         if(numOfThreads > 1)
+         {
+            PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
+            grid->accept(pqPartVisitor);
+         }
+
+         if(myid == 0)
+         {
+            UBLOG(logINFO,"Write blocks - start");
+            BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm));
+            ppblocks->update(0);
+            UBLOG(logINFO,"Write blocks - end");
+         }
+
+         unsigned long nob = grid->getNumberOfBlocks();
+         unsigned long nod = nob * blocknx[0]*blocknx[1]*blocknx[2];
+         unsigned long nod_real = nob * (blocknx[0]+3)*(blocknx[1]+3)*(blocknx[2]+3);
+         unsigned long nodb = (blocknx[0]) * (blocknx[1]) * (blocknx[2]);
+
+         double needMemAll  = double(nod_real*(27*sizeof(double) + sizeof(int)));
+         double needMem  = needMemAll / double(comm->getNumberOfProcesses());
+         
+         double nup = 0; 
+
+         if(myid == 0)
+         {
+            UBLOG(logINFO,"Number of blocks = " << nob);
+            UBLOG(logINFO,"Number of nodes  = " << nod);
+            int minInitLevel = grid->getCoarsestInitializedLevel();
+            int maxInitLevel = grid->getFinestInitializedLevel();
+            for(int level = minInitLevel; level<=maxInitLevel; level++)
+            {
+               int nobl = grid->getNumberOfBlocks(level);
+               UBLOG(logINFO,"Number of blocks for level " << level <<" = " << nobl);
+               UBLOG(logINFO,"Number of nodes for level " << level <<" = " << nobl*nodb);
+               nup += nobl*nodb*double(1<<level); 
+            }
+            UBLOG(logINFO,"Hypothetically time for calculation step for 120 nodes  = " << nup/6.0e5/(120*8)  << " s");
+            UBLOG(logINFO,"Necessary memory  = " << needMemAll  << " bytes");
+            UBLOG(logINFO,"Necessary memory per process = " << needMem  << " bytes");
+            UBLOG(logINFO,"Available memory per process = " << availMem << " bytes");
+            UBLOG(logINFO,"Available memory per node/8.0 = " << (availMem/8.0) << " bytes");
+         }
+
+         //////////////////////////////////////////
+         //set connectors
+         if(myid == 0) UBLOG(logINFO,"set connectors - start");
+         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
+         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
+         grid->accept( setConnsVisitor );
+         if(myid == 0) UBLOG(logINFO,"set connectors - end");
+
+         ////////////////////////////
+         LBMKernel3DPtr kernel;
+         //kernel = LBMKernel3DPtr(new LBMKernelETD3Q27CCLB(blocknx[0], blocknx[1], blocknx[2], LBMKernelETD3Q27CCLB::NORMAL));
+
+         //with sponge layer
+         kernel = LBMKernel3DPtr(new LBMKernelETD3Q27CCLBWithSpongeLayer(blocknx[0], blocknx[1], blocknx[2], LBMKernelETD3Q27CCLB::NORMAL));
+         kernel->setWithSpongeLayer(true);
+         kernel->setSpongeLayer(spongeLayer);
+
+         BCProcessorPtr bcProc(new D3Q27ETBCProcessor());
+         kernel->setBCProcessor(bcProc);
+         SetKernelBlockVisitor kernelVisitor(kernel, nuLB, availMem, needMem);
+         grid->accept(kernelVisitor);
+         //////////////////////////////////
+         //undef nodes
+         if (refineLevel > 0)
+         {
+            D3Q27SetUndefinedNodesBlockVisitor undefNodesVisitor;
+            grid->accept(undefNodesVisitor);
+         }
+
+
+         intHelper.setBC();
+
+         //initialization of decompositions
+         D3Q27ETInitDistributionsBlockVisitor initVisitor( nuLB,rhoLB);
+         initVisitor.setVx1(uLB);
+         grid->accept(initVisitor);
+
+         //Postprozess
+         UbSchedulerPtr geoSch(new UbScheduler(1));
+         D3Q27MacroscopicQuantitiesPostprocessorPtr ppgeo(
+            new D3Q27MacroscopicQuantitiesPostprocessor(grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), 
+            unitConverter, true));
+         ppgeo->update(0);
+         ppgeo.reset();
+         geoSch.reset();
+
+         if(myid == 0) UBLOG(logINFO,"Preprozess - end");      
+      }
+      else
+      {
+         restart = true;
+
+         //domain decomposition for threads
+         if(numOfThreads > 1)
+         {
+            PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
+            grid->accept(pqPartVisitor);
+         }
+         //set connectors
+         //grid->setPeriodicX3(false);
+         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
+         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
+         grid->accept( setConnsVisitor );
+         SetSpongeLayerBlockVisitor ssp(spongeLayer);
+         grid->accept(ssp);
+
+         //////////////////////////////////////////////////////////////////////////
+         //////////////////////////////////////////////////////////////////////////
+         //Platte
+         GbTriFaceMesh3DPtr plate (GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(PlatteFilename,"Netz"));
+         plate->rotate(90.0,0.0,0.0);  //TriFacMesh-KO-System anders als LB-KO-System
+         if(myid == 0) GbSystem3D::writeGeoObject( plate.get(), pathname+"/geo/platte", WbWriterVtkXmlBinary::getInstance() );
+         //////////////////////////////////////////////////////////////////////////
+         //////////////////////////////////////////////////////////////////////////
+         // Zackenband
+         //////////////////////////////////////////////////////////////////////////
+         GbTriFaceMesh3DPtr meshBand1 (GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "NetzBand"));
+         meshBand1->translate(-495, -700, -19.94);
+         if(myid == 0) GbSystem3D::writeGeoObject( meshBand1.get(), pathname+"/geo/Band1", WbWriterVtkXmlASCII::getInstance() );
+
+         double blockLengthx1 = blocknx[0]*cdx; //geowerte
+         double blockLengthx2 = blockLengthx1;
+         double blockLengthx3 = blockLengthx1;
+
+         double geoLength[]   = {  nx[0]*blockLengthx1, nx[1]*blockLengthx2, nx[2]*blockLengthx3}; 
+
+         double originX1 = plate->getX1Minimum()-plate->getLengthX1()/4.0;
+         double originX2 = plate->getX2Minimum();
+         double originX3 = plate->getX3Minimum()-299.5;
+
+         //bounding box
+         double g_minX1 = originX1;
+         double g_minX2 = originX2;
+         double g_minX3 = originX3;
+
+         double g_maxX1 = originX1 + geoLength[0];
+         double g_maxX2 = originX2 + geoLength[1];
+         double g_maxX3 = originX3 + geoLength[2];;
+
+         GbObject3DPtr gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
+         gridCube->setCenterCoordinates(gridCube->getX1Centroid(),meshBand1->getX2Centroid(),gridCube->getX3Centroid());
+         if(myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), pathname+"/geo/gridCube", WbWriterVtkXmlASCII::getInstance());
+
+         originX2 = gridCube->getX2Minimum();
+         g_minX2 = originX2;
+         g_maxX2 = originX2 + geoLength[1];
+         //walls
+         GbCuboid3DPtr addWallZmin (new GbCuboid3D(g_minX1-blockLengthx1, g_minX2-blockLengthx1, g_minX3-blockLengthx1, g_maxX1+blockLengthx1, g_maxX2+blockLengthx1, g_minX3));
+         if(myid == 0) GbSystem3D::writeGeoObject(addWallZmin.get(), pathname+"/geo/addWallZmin", WbWriterVtkXmlASCII::getInstance());
+
+         GbCuboid3DPtr addWallZmax (new GbCuboid3D(g_minX1-blockLengthx1, g_minX2-blockLengthx1, g_maxX3, g_maxX1+blockLengthx1, g_maxX2+blockLengthx1, g_maxX3+blockLengthx1));
+         if(myid == 0) GbSystem3D::writeGeoObject(addWallZmax.get(), pathname+"/geo/addWallZmax", WbWriterVtkXmlASCII::getInstance());
+
+         //walls
+         int bbOption = 1; //0=simple Bounce Back, 1=quadr. BB        
+         D3Q27BoundaryConditionAdapterPtr slip(new D3Q27SlipBCAdapter(bbOption));
+         D3Q27InteractorPtr addWallZminInt(new D3Q27Interactor(addWallZmin, grid, slip,Interactor3D::SOLID));
+         D3Q27InteractorPtr addWallZmaxInt(new D3Q27Interactor(addWallZmax, grid, slip,Interactor3D::SOLID));
+
+         SetSolidOrTransBlockVisitor v1(addWallZminInt, SetSolidOrTransBlockVisitor::TRANS);
+         grid->accept(v1);
+         addWallZminInt->initInteractor();
+         SetSolidOrTransBlockVisitor v2(addWallZmaxInt, SetSolidOrTransBlockVisitor::TRANS);
+         grid->accept(v2);        
+         addWallZmaxInt->initInteractor();
+
+         UbSchedulerPtr geoSch(new UbScheduler(1));
+         D3Q27MacroscopicQuantitiesPostprocessorPtr ppgeo(
+            new D3Q27MacroscopicQuantitiesPostprocessor(grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), 
+            unitConverter, true));
+         ppgeo->update(0);
+         ppgeo.reset();
+         geoSch.reset();
+         //////////////////////////////////////////////////////////////////////////
+
+         if(myid == 0) UBLOG(logINFO,"Restart - end"); 
+      }
+      UbSchedulerPtr visSch(new UbScheduler());
+      //visSch->addSchedule(1,0,3);
+      //visSch->addSchedule(100,100,1000);
+      //visSch->addSchedule(1000,1000,5000);
+      //visSch->addSchedule(5000,5000,100000);
+      //visSch->addSchedule(100000,100000,10000000);
+
+      visSch->addSchedule(1000,1000,10000000);
+
+      D3Q27MacroscopicQuantitiesPostprocessor pp(grid, visSch, pathname, WbWriterVtkXmlBinary::getInstance(), unitConverter);
+
+      double startStep = 88000;
+
+      UbSchedulerPtr resSchRMS(new UbScheduler());
+      resSchRMS->addSchedule(1000000, startStep, 10000000);
+      UbSchedulerPtr resSchMeans(new UbScheduler());
+      resSchMeans->addSchedule(1000000, startStep, 10000000);
+      UbSchedulerPtr stepAvSch(new UbScheduler());
+      int averageInterval=100;
+      stepAvSch->addSchedule(averageInterval,0,10000000);
+      AverageValuesPostprocessor Avpp(grid, pathname, WbWriterVtkXmlBinary::getInstance(), visSch/*wann wird rausgeschrieben*/, 
+         stepAvSch/*wann wird gemittelt*/, resSchMeans,resSchRMS/*wann wird resettet*/,restart);
+
+      UbSchedulerPtr nupsSch(new UbScheduler(10, 10, 30));
+      nupsSch->addSchedule(500,500,1e6);
+      NUPSCounterPostprocessor npr(grid, nupsSch, numOfThreads, comm);
+
+      UbSchedulerPtr emSch(new UbScheduler(10));
+      EmergencyExitPostprocessor empr(grid, emSch, pathname, RestartPostprocessorPtr(&rp), comm);
+
+      if(myid == 0)
+      {
+         UBLOG(logINFO,"PID = " << myid << " Total Physical Memory (RAM): " << Utilities::getTotalPhysMem());
+         UBLOG(logINFO,"PID = " << myid << " Physical Memory currently used: " << Utilities::getPhysMemUsed());
+         UBLOG(logINFO,"PID = " << myid << " Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe());
+      }
+
+      string lastStep = string(cstr2);
+      double endTime = UbSystem::stringTo<double>(lastStep);
+      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, visSch));
+      if(myid == 0) UBLOG(logINFO,"Simulation-start");
+      calculation->calculate();
+      if(myid == 0) UBLOG(logINFO,"Simulation-end");
+   }
+   catch(std::exception& e)
+   {
+      cerr << e.what() << endl << flush;
+   }
+   catch(std::string& s)
+   {
+      cerr << s << endl;
+   }
+   catch(...)
+   {
+      cerr << "unknown exception" << endl;
+   }
+
+}
+//////////////////////////////////////////////////////////////////////////
+int main(int argc, char* argv[])
+{
+   if (argc == 1)
+   {
+      cout<<"Command line argument isn't specified!"<<endl;
+      cout<<"plate2 <machine name>"<<endl;
+      return 1;
+   }
+   run(argv[1], argv[2]);
+
+   return 0;
+}
+
diff --git a/apps/cpu/pmTortu/CMakeLists.txt b/apps/cpu/pmTortu/CMakeLists.txt
index 000cf49662caf85298e49d5e4d1ca493984a035e..6f53609f0734e369f9954b581ec211aef8e2957d 100644
--- a/apps/cpu/pmTortu/CMakeLists.txt
+++ b/apps/cpu/pmTortu/CMakeLists.txt
@@ -1,25 +1,25 @@
-CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
-
-########################################################
-## C++ PROJECT                                       ###
-########################################################
-PROJECT(plate)
-
-INCLUDE(${SOURCE_ROOT}/lib/IncludsList.txt) 
-
-#################################################################
-###   LOCAL FILES                                             ###
-#################################################################
-FILE(GLOB SPECIFIC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.h
-                         ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
-                         ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp  )
- 
-SET(ALL_SOURCES ${ALL_SOURCES} ${SPECIFIC_FILES})
-SOURCE_GROUP(src FILES ${SPECIFIC_FILES})
-  
-SET(CAB_ADDITIONAL_LINK_LIBRARIES vfluids)
-
-#################################################################
-###   CREATE PROJECT                                          ###
-#################################################################
-CREATE_CAB_PROJECT(pmTortu BINARY)
+CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
+
+########################################################
+## C++ PROJECT                                       ###
+########################################################
+PROJECT(plate)
+
+INCLUDE(${SOURCE_ROOT}/lib/IncludsList.txt) 
+
+#################################################################
+###   LOCAL FILES                                             ###
+#################################################################
+FILE(GLOB SPECIFIC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.h
+                         ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
+                         ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp  )
+ 
+SET(ALL_SOURCES ${ALL_SOURCES} ${SPECIFIC_FILES})
+SOURCE_GROUP(src FILES ${SPECIFIC_FILES})
+  
+SET(CAB_ADDITIONAL_LINK_LIBRARIES vfluids)
+
+#################################################################
+###   CREATE PROJECT                                          ###
+#################################################################
+CREATE_CAB_PROJECT(pmTortu BINARY)
diff --git a/apps/cpu/pmTortu/pmTortu.cpp b/apps/cpu/pmTortu/pmTortu.cpp
index ddd039ec87f973720cf6191c23d08b4217658bde..491e2b003ce9e03b128b6d24ea4a6884a9d6dcf6 100644
--- a/apps/cpu/pmTortu/pmTortu.cpp
+++ b/apps/cpu/pmTortu/pmTortu.cpp
@@ -1,511 +1,511 @@
-#include <iostream>
-#include <string>
-
-#include <vfluids.h>
-
-using namespace std;
-
-//! \brief  Computes Flow thorugh a porous medium and writespathlines
-//! \details Aim: determine tortuosity. pathlines are later integrated using python-script streamlinesMean.py (needs scipy,numpy)
-//! \details If PM-data is large run on single visulalization node.
-//! \details Created on: 01.07.2013
-//! \author  Sonja Uphoff
-
-void run(const char *cstr)
-{
-   try
-   {
-     string machine = QUOTEME(CAB_MACHINE);
-      UBLOG(logINFO,"Testcase PMTortuosity");
-      string pathname;
-      string stlPath;
-      int numOfThreads =1;
-      bool logfile = false;
-      stringstream logFilename;
-      double availMem = 0;
-
-      UbLog::reportingLevel() = logDEBUG5; //logINFO;
-
-      CommunicatorPtr comm(new MPICommunicator());
-      int myid = comm->getProcessID();
-
-      if(machine == "PIPPINNEU")
-      {
-
-         pathname = "f:/temp/PMtortu";
-         stlPath = "f:/GeometrienVliese";
-         numOfThreads = 3;
-         logfile = false;
-         availMem = 3.0e9;
-      }
-      else if(machine == "M01" || machine == "M02")
-      {
-         pathname = "/work/sonjaOutputs/PMTortu2metall450";
-         stlPath = "/work/sonjaOutputs";
-         numOfThreads = 4;
-         availMem = 12.0e9;
-         logfile = true;
-
-         //if(myid ==0)
-         //{
-            logFilename <<  pathname + "/logfile"+UbSystem::toString(UbSystem::getTimeStamp())+"_"+UbSystem::toString(myid)+".txt";
-         //}
-      }
-      else throw UbException(UB_EXARGS, "unknown CAB_MACHINE");
-
-
-
-      //if(myid ==0 && logfile)
-      //{
-         UbLog::output_policy::setStream(logFilename.str());
-      //}
-
-      int baseLevel, refineLevel,nx[3],blocknx[3];
-      double Re,velocity,rhoInit,vx1Init;//,vx2Init,vx3Init;
-
-//////////////////////////////////////////////////////////////////////////
-      //physik
-//////////////////////////////////////////////////////////////////////////
-      Re            = 1;// 13286;//13286;//gemessen 18.98 m/s...*5.0 zum  testen ob was passiert
-      velocity      = 0.01;
-      vx1Init       = 0.01;
-      rhoInit       = 1.0;
-      SimulationParametersPtr param = SimulationParameters::getInstanz();
-param->setCollisionModelType(SimulationParameters::COMPRESSIBLE);
-
-      ///////////////Knotenabmessungen:
-
-    nx[0]=28;
-    nx[1]=27;
-       nx[2]=27;
-    blocknx[0]=10;
-    blocknx[1]=10;
-    blocknx[2]=10;
-
-   baseLevel   = 0;
-   refineLevel = 0;
-
-      bool periodicx1 = false;
-      bool periodicx2 = false;
-      bool periodicx3 = false;
-
-
-
-   double minX1 = 0.0;
-   double maxX1 = 280;
-   double minX2 = 0.0;
-   double maxX2 = 270;
-   double minX3 = 0.0;
-   double maxX3 = 270;
-   double centerX1 = 0.5*(maxX1-minX1);
-   double centerX2 = 0.5*(maxX2-minX2);
-   //double scaleAsphalt = 0.0000625; //10/1600
-   double scalepixeltomm=0.5;
-   double scaleAsphalt = 1.0;
-   minX1 = minX1*scaleAsphalt;
-   minX2 = minX2*scaleAsphalt;
-   minX3 = minX3*scaleAsphalt;
-   maxX1 = maxX1*scaleAsphalt;
-   maxX2 = maxX2*scaleAsphalt;
-   maxX3 = maxX3*scaleAsphalt;
-
-   //vorgabe geom. dx im feinsten = 1 -> abstand der voxel = 1
-   double coarseNodeDx = (maxX2 - minX2) / (double)( blocknx[1]*nx[1] );
-   double fineNodeDx   = coarseNodeDx / (double)(1<<refineLevel);
-
-   double blockLengthx1 = blocknx[0]*coarseNodeDx;
-   double blockLengthx2 = blocknx[1]*coarseNodeDx;
-   double blockLengthx3 = blocknx[2]*coarseNodeDx;
-
-   double originX1 = minX1;
-   double originX2 = minX2;
-   double originX3 = minX3;
-
-   int nx1 = nx[0];
-   int nx2 = nx[1];
-   int nx3 = nx[2];
-   int blocknx1      = blocknx[0];
-   int blocknx2      = blocknx[1];
-   int blocknx3      = blocknx[2];
-
-   double gridOrigin[3] = { originX1, originX2, originX3 };
-
-   //geom. GROBE Blocklaenge
-   double coarseBlockLength[3];
-   coarseBlockLength[0] = blockLengthx1;
-   coarseBlockLength[1] = blockLengthx2;
-   coarseBlockLength[2] = blockLengthx3;
-   double geoLength[]   = {  nx[0]*blockLengthx1, nx[1]*blockLengthx2, nx[2]*blockLengthx3};
-
-//////////////////////////////////////////////////////////////////////////
-   // PM File
-//////////////////////////////////////////////////////////////////////////
-   string pmFilename;
-   pmFilename = stlPath+"/metallrgbx271y271z270.vti";//
-   int pmNX1=270;
-   int pmNX2=271;
-   int pmNX3=270;
-   float threshold = 120.0;
-
-         GbVoxelMatrix3DPtr pmMesh(GbVoxelMatrix3DCreator::getInstance()->createFromVtiASCIIFloatFile(pmFilename,pmNX1,pmNX2,pmNX3,threshold));
-
-pmMesh->translate((maxX1-minX1)*0.05,-(maxX2-minX2)*0.01,-(maxX3-minX3)*0.01);
-   pmMesh->setTransferViaFilename(true, pmFilename);
-
-//##########################################################################
-      //## physical parameters
-//##########################################################################
-
-      double rhoLB         = 1.0;
-      double rhoReal       = 1.0;
-      double nueReal  = 0.16;//0.015;
-
-      double hReal         = maxX1;
-      double uReal         = Re*nueReal/hReal;
-
-      //##Machzahl:
-      //#Ma     = uReal/csReal
-
-      double csReal  = 1.0/sqrt(3.0);
-      double cs_LB=1.0/sqrt(3.0);
-      double Ma      = uReal/csReal;//0.0553;//Ma-Real!
-      double hLB     = hReal;
-
-      //LBMUnitConverter unitConverter(hReal, csReal, rhoReal, hLB);
-      LBMUnitConverterPtr unitConverter = LBMUnitConverterPtr(new LBMUnitConverter(hReal, csReal, rhoReal, blocknx[0]*nx[0] ));
-
-      double uLB           = uReal   * unitConverter->getFactorVelocityWToLb();
-      double nueLB         = nueReal * unitConverter->getFactorViscosityWToLb();
-
-      double realDeltaT     = (nueLB * hReal *hReal) / (nueReal * blocknx[0]*nx[0] *blocknx[0]*nx[0]);
-
-
-
-      Grid3DPtr grid(new Grid3D());
-      UbSchedulerPtr rSch(new UbScheduler(5000,5000,1000000));
-      RestartPostprocessor rp(grid, rSch, comm, pathname+"/checkpoints", RestartPostprocessor::BINARY);
-
-//////////////////////////////////////////////////////////////////////////
-
-     std::string opt;
-
-      if(cstr!= NULL)
-         opt = std::string(cstr);
-
-      //bounding box
-      double g_minX1 = originX1;
-      double g_minX2 = originX2;
-      double g_minX3 = originX3;
-
-      double g_maxX1 = originX1 + geoLength[0];
-      double g_maxX2 = originX2 + geoLength[1];
-      double g_maxX3 = originX3 + geoLength[2];
-
-      //set grid
-      grid->setDeltaX(coarseNodeDx);
-      grid->setBlockNX(blocknx[0], blocknx[1], blocknx[2]);
-      grid->setPeriodicX1(periodicx1);
-      grid->setPeriodicX2(periodicx2);
-      grid->setPeriodicX3(periodicx3);
-
-
-      GbObject3DPtr gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
-      if(myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), pathname+"/geo/gridCube", WbWriterVtkXmlASCII::getInstance());
-
-      GenBlocksGridVisitor genBlocks;
-      genBlocks.addGeoObject(gridCube);
-      grid->accept(genBlocks);
-
-
-//////////////////////////////////////////////////////////////////////////
-      if(myid == 0)
-      {
-         UBLOG(logINFO, "*****************************************");
-         UBLOG(logINFO, "* Parameters *");
-         UBLOG(logINFO, "* Re            ="<<Re);
-         UBLOG(logINFO, "* Ma            ="<<Ma);
-         UBLOG(logINFO, "* uReal         ="<<uReal);
-         UBLOG(logINFO, "* nueReal       ="<<nueReal);
-         UBLOG(logINFO, "* nue           ="<<nueLB);
-         UBLOG(logINFO, "* velocity      ="<<uLB);
-         UBLOG(logINFO, "* LX1 (world/LB)="<<hReal<<"/"<<hReal/coarseNodeDx);
-      //   UBLOG(logINFO, "* LX2 (world/LB)="<<kanalbreiteSI<<"/"<<kanalbreiteSI/coarseNodeDx);
-      //   UBLOG(logINFO, "* LX3 (world/LB)="<<kanalhoeheSI<<"/"<<kanalhoeheSI/coarseNodeDx);
-         UBLOG(logINFO, "* cdx           ="<<coarseNodeDx);
-         UBLOG(logINFO, "* fdx           ="<<fineNodeDx);
-         UBLOG(logINFO, "* dx_base ="<<coarseNodeDx<<" == "<<coarseNodeDx);
-         UBLOG(logINFO, "* dx_refine ="<<fineNodeDx<<" == "<<fineNodeDx );
-         UBLOG(logINFO, "* nx1/2/3 ="<<nx[0]<<"/"<<nx[1]<<"/"<<nx[2]);
-         UBLOG(logINFO, "* blocknx1/2/3 ="<<blocknx[0]<<"/"<<blocknx[1]<<"/"<<blocknx[2]);
-         UBLOG(logINFO, "* x2Periodic    ="<<periodicx2);
-         UBLOG(logINFO, "* x3Periodic    ="<<periodicx3);
-         UBLOG(logINFO, "*****************************************");
-         UBLOGML(logINFO, "UnitConverter:"<<unitConverter->toString());
-         UBLOG(logINFO, "*****************************************");
-      }
-
-
-      RatioBlockVisitor ratioVisitor(refineLevel);
-      grid->accept(ratioVisitor);
-      RatioSmoothBlockVisitor ratioSmoothVisitor(refineLevel);
-      grid->accept(ratioSmoothVisitor);
-      OverlapBlockVisitor overlapVisitor(refineLevel);
-      grid->accept(overlapVisitor);
-      std::vector<int> dirs;
-      D3Q27System::getLBMDirections(dirs);
-      SetInterpolationDirsBlockVisitor interDirsVisitor(dirs);
-      grid->accept(interDirsVisitor);
-
-      if(myid == 0) UBLOG(logINFO,"Refinement - end");
-
-      MetisPartitioningGridVisitor metisVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B);
-      grid->accept( metisVisitor );
-
-      if(myid == 0) UBLOG(logINFO,"Write blocks - start");
-      BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname + "/grid/blocks", WbWriterVtkXmlBinary::getInstance(), comm));
-      if(myid == 0) ppblocks->update(0);
-      if(myid == 0) UBLOG(logINFO,"Write blocks - end");
-
-      if(myid == 0) UBLOG(logINFO,"deleteSolidBlocks - start");
-      SolidBlocksHelper sd(grid, comm);
-
-
-      sd.deleteSolidBlocks();
-      if(myid == 0) UBLOG(logINFO,"deleteSolidBlocks - end");
-
-      if(myid == 0) UBLOG(logINFO,"Write blocks - start");
-      grid->accept( metisVisitor );
-      if(myid == 0) ppblocks->update(1);
-      ppblocks.reset();
-      if(myid == 0) UBLOG(logINFO,"Write blocks - end");
-
-      unsigned long nob = grid->getNumberOfBlocks();
-      unsigned long nod = nob * blocknx[0]*blocknx[1]*blocknx[2];
-      unsigned long nod_real = nob * (blocknx[0]+3)*(blocknx[1]+3)*(blocknx[2]+3);
-
-      double needMemAll  = double(nod_real*(27*sizeof(double) + sizeof(int)));
-      double needMem  = needMemAll / double(comm->getNumberOfProcesses());
-
-      if(myid == 0)
-      {
-         UBLOG(logINFO,"Number of blocks = " << nob);
-         UBLOG(logINFO,"Number of nodes  = " << nod);
-         UBLOG(logINFO,"Necessary memory  = " << needMemAll << " bytes");
-         UBLOG(logINFO,"Necessary memory per process = " << needMem  << " bytes");
-         UBLOG(logINFO,"Available memory per process = " << availMem << " bytes");
-      }
-
-      LBMKernel3DPtr kernel(new LBMKernelETD3Q27Cascaded(blocknx[0], blocknx[1], blocknx[2]));
-
-  //    LBMKernel3DPtr kernel(new LBMKernelETD3Q27BGK(blocknx[0], blocknx[1], blocknx[2],1));
-      BCProcessorPtr bcProc(new D3Q27ETBCProcessor());
-      kernel->setBCProcessor(bcProc);
-
-
-      SetKernelBlockVisitor kernelVisitor(kernel, nueLB, availMem, needMem);
-
-      grid->accept(kernelVisitor);
-
-
-
-//////////////////////////////////////////////////////////////////////////
-    double geoOverlap = 5*coarseNodeDx;
-
-
-//////////////////////////////////////////////////////////////////////////
-   // Interactoren
-//////////////////////////////////////////////////////////////////////////
-//##########################################################################
-   int noSlipSecOpt = 0; // #0=2nd order BB 1=simple BB
-//##########################################################################
-   int noSlipSecOptAsphalt = 1; // #0=2nd order BB 1=simple BB
-//##########################################################################
-     int bbOption1 = 0; //0=simple Bounce Back, 1=quadr. BB
-     D3Q27BoundaryConditionAdapterPtr bcObst(new D3Q27NoSlipBCAdapter(bbOption1));
-   D3Q27InteractorPtr PM1Interactor = D3Q27InteractorPtr ( new D3Q27Interactor(pmMesh, grid, bcObst,Interactor3D::SOLID)); //wo ist bc obst definiert?
- grid->addAndInitInteractor( PM1Interactor);
-   //UBLOG(logINFO,"SpD3Q19Asphalt - send porous media to D3Q19InteractorService");
-   //UBLOG(logINFO,"SpD3Q19Asphalt - send porous media = "<<pmInteractor->getName()<<" with "<<typeid(*pmInteractor->getGbObject3D()).name()<<" node("<<pmNX1<<"/"<<pmNX2<<"/"<<pmNX3<<")");
-   UbTimer timer;
-   timer.start();
-
-
-   UBLOG(logINFO,"SpD3Q19Asphalt - send porous media to D3Q19InteractorService done in "<<timer.stop());
-
-
-      if (refineLevel > 0)
-      {
-         D3Q27SetUndefinedNodesBlockVisitor undefNodesVisitor;
-         grid->accept(undefNodesVisitor);
-      }
-
-
-      //set connectors
-      D3Q27InterpolationProcessorPtr iProcessor(new D3Q27OffsetInterpolationProcessor());
-      D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
-      grid->accept( setConnsVisitor );
-
-      //domain decomposition
-      PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
-      grid->accept(pqPartVisitor);
-
-      //initialization of decompositions
-      D3Q27ETInitDistributionsBlockVisitor initVisitor(1.0);
-      initVisitor.setVx1(0.0);
-      grid->accept(initVisitor);
-
-
- //////////////////////////////////////////////////////////////////////////
-   // BCs
-//////////////////////////////////////////////////////////////////////////
-      //Reparatur an den Seiten:
-       UBLOG(logINFO,"inflow")
-           double x3minMesh=0.000;  double x3maxMesh=originX3 + blockLengthx3*nx3 + geoOverlap;
-   GbCuboid3DPtr leftCuboid(new GbCuboid3D( originX1 + blockLengthx1*nx1 - coarseNodeDx,
-                                           originX2 - geoOverlap,
-                                           x3minMesh,
-                                           originX1 + blockLengthx1*nx1 + geoOverlap,
-                                           originX2 + blockLengthx2*nx2 + geoOverlap,
-                                           x3maxMesh));
-   GbCuboid3DPtr rightCuboid(new GbCuboid3D( originX1 - geoOverlap,
-                                           originX2 - geoOverlap,
-                                           x3minMesh,
-                                           originX1 + geoOverlap,
-                                           originX2 + blockLengthx2*nx2 + geoOverlap,
-                                           x3maxMesh));
-   GbCuboid3DPtr northCuboid(new GbCuboid3D( originX1- geoOverlap,
-                                           originX2 + blockLengthx2*nx2 - 0.5*coarseNodeDx,
-                                           x3minMesh,
-                                           originX1 + blockLengthx1*nx1 + geoOverlap,
-                                           originX2 + blockLengthx2*nx2 + geoOverlap,
-                                           x3maxMesh));
-   GbCuboid3DPtr southCuboid(new GbCuboid3D( originX1 - geoOverlap,
-                                           originX2 - geoOverlap,
-                                           x3minMesh,
-                                           originX1 + blockLengthx1*nx1 + geoOverlap,
-                                           originX2 + geoOverlap,
-                                           x3maxMesh));
-
-//////////////////////////////////////////////////////////////////////////
-   // inflow
-//////////////////////////////////////////////////////////////////////////
-   UBLOG(logINFO,"inflow")
-
-   GbCuboid3DPtr densCuboid(new GbCuboid3D(
-                                           originX1 - geoOverlap,
-                                           originX2 - geoOverlap,
-                                           originX3 + blockLengthx3*nx3 - coarseNodeDx,
-                                           originX1 + blockLengthx1*nx1 + geoOverlap,
-                                           originX2 + blockLengthx2*nx2 + geoOverlap,
-                                           originX3 + blockLengthx3*nx3 + geoOverlap));
-
-
-//////////////////////////////////////////////////////////////////////////
-   // bottom/outflow
-//////////////////////////////////////////////////////////////////////////
-      double dRho=0.05;
-      GbCuboid3DPtr densCuboid2(new GbCuboid3D(
-                                                 originX1 - geoOverlap,
-                                                 originX2 - geoOverlap,
-                                                 originX3 - geoOverlap,
-                                                 originX1 + blockLengthx1*nx1 + geoOverlap,
-                                                 originX2 + blockLengthx2*nx2 + geoOverlap,
-minX3+0.5*fineNodeDx   ));
-
-      if(myid == 0) GbSystem3D::writeGeoObject(densCuboid2.get(), pathname+"/geo/densCuboid2", WbWriterVtkXmlASCII::getInstance());
-      D3Q27BoundaryConditionAdapterPtr denBCAdapter2(new D3Q27DensityBCAdapter(rhoInit-dRho));
-      D3Q27InteractorPtr densInteractor2( new D3Q27Interactor(leftCuboid,grid,denBCAdapter2,Interactor3D::SOLID) );
-      grid->addAndInitInteractor( densInteractor2 );
-
-            if(myid == 0) GbSystem3D::writeGeoObject(densCuboid.get(), pathname+"/geo/densCuboid", WbWriterVtkXmlASCII::getInstance());
-      D3Q27BoundaryConditionAdapterPtr denBCAdapter(new D3Q27DensityBCAdapter(rhoInit+dRho));
-      D3Q27InteractorPtr densInteractor( new D3Q27Interactor(rightCuboid,grid,denBCAdapter,Interactor3D::SOLID) );
-      grid->addAndInitInteractor( densInteractor );
-
-   D3Q27InteractorPtr leftInteractor = D3Q27InteractorPtr ( new D3Q27Interactor(densCuboid2, grid, bcObst,Interactor3D::SOLID));
-   grid->addAndInitInteractor( leftInteractor);
-   D3Q27InteractorPtr rightInteractor = D3Q27InteractorPtr ( new D3Q27Interactor(densCuboid, grid, bcObst,Interactor3D::SOLID));
-  grid->addAndInitInteractor(rightInteractor);
-   D3Q27InteractorPtr northInteractor = D3Q27InteractorPtr ( new D3Q27Interactor(northCuboid, grid, bcObst,Interactor3D::SOLID));
-   grid->addAndInitInteractor(northInteractor);
-   D3Q27InteractorPtr southInteractor = D3Q27InteractorPtr ( new D3Q27Interactor(southCuboid, grid, bcObst,Interactor3D::SOLID));
-  grid->addAndInitInteractor(southInteractor);
-
-  if(myid == 0) GbSystem3D::writeGeoObject(northCuboid.get(), pathname+"/geo/north", WbWriterVtkXmlASCII::getInstance());
-if(myid == 0) GbSystem3D::writeGeoObject(southCuboid.get(), pathname+"/geo/south", WbWriterVtkXmlASCII::getInstance());
-if(myid == 0) GbSystem3D::writeGeoObject(rightCuboid.get(), pathname+"/geo/right", WbWriterVtkXmlASCII::getInstance());
-if(myid == 0) GbSystem3D::writeGeoObject(leftCuboid.get(), pathname+"/geo/left", WbWriterVtkXmlASCII::getInstance());
-
-
-      UbSchedulerPtr geoSch(new UbScheduler(1));
-      D3Q27MacroscopicQuantitiesPostprocessorPtr ppgeo(
-           new D3Q27MacroscopicQuantitiesPostprocessor(grid, geoSch, pathname + "/grid/nodes", WbWriterVtkXmlBinary::getInstance(),
-unitConverter, comm, true));
-
-              double raiseVelSteps = 0;
-
-      grid->doPostProcess(0);
-      ppgeo.reset();
-      geoSch.reset();
-
-     UbSchedulerPtr plSch(new UbScheduler(10, 2));
-      vector<D3Q27PathLinePostprocessorPtr> pathlinepostPParray;
-
- for (int ppz=0; ppz<27; ppz++)
-      {
-      for (int ppy=0; ppy<27; ppy++)
-      {
-          char numstr[21];
-          sprintf(numstr, "%d", ppy+20*ppz);
-          std::string pathPL = pathname+"/pathline" + numstr+".dat";
-         D3Q27PathLinePostprocessorPtr plptr1( new D3Q27PathLinePostprocessor(grid, pathPL, WbWriterVtkXmlASCII::getInstance(), unitConverter, plSch, comm, 8.0, 6.0+8.0*(double)ppy,5.0+8.0*(double)ppz, nueLB, iProcessor));
-              pathlinepostPParray.push_back(plptr1);//new D3Q27PathLinePostprocessor(grid, pathname + "/pathLine", WbWriterVtkXmlASCII::getInstance(), conv, plSch, comm, 0.01+(double)ppx*0.0001, 0.00001,0.00001, nueLB, iProcessor));
-
-          }
-      }
-
- UbSchedulerPtr visSch(new UbScheduler());
-      visSch->addSchedule(1,1,10);
-      visSch->addSchedule(10,10,100);
-      visSch->addSchedule(100,100,1000);
-      visSch->addSchedule(1000,1000,100000);
-      visSch->addSchedule(100000,100000,1000000);
-      D3Q27MacroscopicQuantitiesPostprocessor pp(grid, visSch, pathname + "/steps/step", WbWriterVtkXmlBinary::getInstance(), unitConverter, comm);
-
-      UbSchedulerPtr nupsSch(new UbScheduler(10, 10, 100));
-      NUPSCounterPostprocessor npr(grid, nupsSch, pathname + "/results/nups.txt", comm);
-
-//////////////////////////////////////////////////////////////////////////
-
-      cout << "PID = " << myid << " Total Physical Memory (RAM): " << MemoryUtil::getTotalPhysMem()<<endl;
-      cout << "PID = " << myid << " Physical Memory currently used: " << MemoryUtil::getPhysMemUsed()<<endl;
-      cout << "PID = " << myid << " Physical Memory currently used by current process: " << MemoryUtil::getPhysMemUsedByMe()<<endl;
-
-      double endTime = 40001;
-      UbSchedulerPtr ghostLSch(new UbScheduler());
-      ghostLSch->addSchedule(1,1,endTime);
-      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, ghostLSch));
-      if(myid == 0) UBLOG(logINFO,"Simulation-start");
-      calculation->calculate();
-      if(myid == 0) UBLOG(logINFO,"Simulation-end");
-   }
-   catch(std::exception& e)
-   {
-      cerr << e.what() << endl << flush;
-   }
-   catch(std::string& s)
-   {
-      cerr << s << endl;
-   }
-   catch(...)
-   {
-      cerr << "unknown exception" << endl;
-   }
-}
-int main(int argc, char* argv[])
-{
-
-   run(argv[1]);
-
-   return 0;
-} 
+#include <iostream>
+#include <string>
+
+#include <vfluids.h>
+
+using namespace std;
+
+//! \brief  Computes Flow thorugh a porous medium and writespathlines
+//! \details Aim: determine tortuosity. pathlines are later integrated using python-script streamlinesMean.py (needs scipy,numpy)
+//! \details If PM-data is large run on single visulalization node.
+//! \details Created on: 01.07.2013
+//! \author  Sonja Uphoff
+
+void run(const char *cstr)
+{
+   try
+   {
+     string machine = QUOTEME(CAB_MACHINE);
+      UBLOG(logINFO,"Testcase PMTortuosity");
+      string pathname;
+      string stlPath;
+      int numOfThreads =1;
+      bool logfile = false;
+      stringstream logFilename;
+      double availMem = 0;
+
+      UbLog::reportingLevel() = logDEBUG5; //logINFO;
+
+      CommunicatorPtr comm(new MPICommunicator());
+      int myid = comm->getProcessID();
+
+      if(machine == "PIPPINNEU")
+      {
+
+         pathname = "f:/temp/PMtortu";
+         stlPath = "f:/GeometrienVliese";
+         numOfThreads = 3;
+         logfile = false;
+         availMem = 3.0e9;
+      }
+      else if(machine == "M01" || machine == "M02")
+      {
+         pathname = "/work/sonjaOutputs/PMTortu2metall450";
+         stlPath = "/work/sonjaOutputs";
+         numOfThreads = 4;
+         availMem = 12.0e9;
+         logfile = true;
+
+         //if(myid ==0)
+         //{
+            logFilename <<  pathname + "/logfile"+UbSystem::toString(UbSystem::getTimeStamp())+"_"+UbSystem::toString(myid)+".txt";
+         //}
+      }
+      else throw UbException(UB_EXARGS, "unknown CAB_MACHINE");
+
+
+
+      //if(myid ==0 && logfile)
+      //{
+         UbLog::output_policy::setStream(logFilename.str());
+      //}
+
+      int baseLevel, refineLevel,nx[3],blocknx[3];
+      double Re,velocity,rhoInit,vx1Init;//,vx2Init,vx3Init;
+
+//////////////////////////////////////////////////////////////////////////
+      //physik
+//////////////////////////////////////////////////////////////////////////
+      Re            = 1;// 13286;//13286;//gemessen 18.98 m/s...*5.0 zum  testen ob was passiert
+      velocity      = 0.01;
+      vx1Init       = 0.01;
+      rhoInit       = 1.0;
+      SimulationParametersPtr param = SimulationParameters::getInstanz();
+param->setCollisionModelType(SimulationParameters::COMPRESSIBLE);
+
+      ///////////////Knotenabmessungen:
+
+    nx[0]=28;
+    nx[1]=27;
+       nx[2]=27;
+    blocknx[0]=10;
+    blocknx[1]=10;
+    blocknx[2]=10;
+
+   baseLevel   = 0;
+   refineLevel = 0;
+
+      bool periodicx1 = false;
+      bool periodicx2 = false;
+      bool periodicx3 = false;
+
+
+
+   double minX1 = 0.0;
+   double maxX1 = 280;
+   double minX2 = 0.0;
+   double maxX2 = 270;
+   double minX3 = 0.0;
+   double maxX3 = 270;
+   double centerX1 = 0.5*(maxX1-minX1);
+   double centerX2 = 0.5*(maxX2-minX2);
+   //double scaleAsphalt = 0.0000625; //10/1600
+   double scalepixeltomm=0.5;
+   double scaleAsphalt = 1.0;
+   minX1 = minX1*scaleAsphalt;
+   minX2 = minX2*scaleAsphalt;
+   minX3 = minX3*scaleAsphalt;
+   maxX1 = maxX1*scaleAsphalt;
+   maxX2 = maxX2*scaleAsphalt;
+   maxX3 = maxX3*scaleAsphalt;
+
+   //vorgabe geom. dx im feinsten = 1 -> abstand der voxel = 1
+   double coarseNodeDx = (maxX2 - minX2) / (double)( blocknx[1]*nx[1] );
+   double fineNodeDx   = coarseNodeDx / (double)(1<<refineLevel);
+
+   double blockLengthx1 = blocknx[0]*coarseNodeDx;
+   double blockLengthx2 = blocknx[1]*coarseNodeDx;
+   double blockLengthx3 = blocknx[2]*coarseNodeDx;
+
+   double originX1 = minX1;
+   double originX2 = minX2;
+   double originX3 = minX3;
+
+   int nx1 = nx[0];
+   int nx2 = nx[1];
+   int nx3 = nx[2];
+   int blocknx1      = blocknx[0];
+   int blocknx2      = blocknx[1];
+   int blocknx3      = blocknx[2];
+
+   double gridOrigin[3] = { originX1, originX2, originX3 };
+
+   //geom. GROBE Blocklaenge
+   double coarseBlockLength[3];
+   coarseBlockLength[0] = blockLengthx1;
+   coarseBlockLength[1] = blockLengthx2;
+   coarseBlockLength[2] = blockLengthx3;
+   double geoLength[]   = {  nx[0]*blockLengthx1, nx[1]*blockLengthx2, nx[2]*blockLengthx3};
+
+//////////////////////////////////////////////////////////////////////////
+   // PM File
+//////////////////////////////////////////////////////////////////////////
+   string pmFilename;
+   pmFilename = stlPath+"/metallrgbx271y271z270.vti";//
+   int pmNX1=270;
+   int pmNX2=271;
+   int pmNX3=270;
+   float threshold = 120.0;
+
+         GbVoxelMatrix3DPtr pmMesh(GbVoxelMatrix3DCreator::getInstance()->createFromVtiASCIIFloatFile(pmFilename,pmNX1,pmNX2,pmNX3,threshold));
+
+pmMesh->translate((maxX1-minX1)*0.05,-(maxX2-minX2)*0.01,-(maxX3-minX3)*0.01);
+   pmMesh->setTransferViaFilename(true, pmFilename);
+
+//##########################################################################
+      //## physical parameters
+//##########################################################################
+
+      double rhoLB         = 1.0;
+      double rhoReal       = 1.0;
+      double nueReal  = 0.16;//0.015;
+
+      double hReal         = maxX1;
+      double uReal         = Re*nueReal/hReal;
+
+      //##Machzahl:
+      //#Ma     = uReal/csReal
+
+      double csReal  = 1.0/sqrt(3.0);
+      double cs_LB=1.0/sqrt(3.0);
+      double Ma      = uReal/csReal;//0.0553;//Ma-Real!
+      double hLB     = hReal;
+
+      //LBMUnitConverter unitConverter(hReal, csReal, rhoReal, hLB);
+      LBMUnitConverterPtr unitConverter = LBMUnitConverterPtr(new LBMUnitConverter(hReal, csReal, rhoReal, blocknx[0]*nx[0] ));
+
+      double uLB           = uReal   * unitConverter->getFactorVelocityWToLb();
+      double nueLB         = nueReal * unitConverter->getFactorViscosityWToLb();
+
+      double realDeltaT     = (nueLB * hReal *hReal) / (nueReal * blocknx[0]*nx[0] *blocknx[0]*nx[0]);
+
+
+
+      Grid3DPtr grid(new Grid3D());
+      UbSchedulerPtr rSch(new UbScheduler(5000,5000,1000000));
+      RestartPostprocessor rp(grid, rSch, comm, pathname+"/checkpoints", RestartPostprocessor::BINARY);
+
+//////////////////////////////////////////////////////////////////////////
+
+     std::string opt;
+
+      if(cstr!= NULL)
+         opt = std::string(cstr);
+
+      //bounding box
+      double g_minX1 = originX1;
+      double g_minX2 = originX2;
+      double g_minX3 = originX3;
+
+      double g_maxX1 = originX1 + geoLength[0];
+      double g_maxX2 = originX2 + geoLength[1];
+      double g_maxX3 = originX3 + geoLength[2];
+
+      //set grid
+      grid->setDeltaX(coarseNodeDx);
+      grid->setBlockNX(blocknx[0], blocknx[1], blocknx[2]);
+      grid->setPeriodicX1(periodicx1);
+      grid->setPeriodicX2(periodicx2);
+      grid->setPeriodicX3(periodicx3);
+
+
+      GbObject3DPtr gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
+      if(myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), pathname+"/geo/gridCube", WbWriterVtkXmlASCII::getInstance());
+
+      GenBlocksGridVisitor genBlocks;
+      genBlocks.addGeoObject(gridCube);
+      grid->accept(genBlocks);
+
+
+//////////////////////////////////////////////////////////////////////////
+      if(myid == 0)
+      {
+         UBLOG(logINFO, "*****************************************");
+         UBLOG(logINFO, "* Parameters *");
+         UBLOG(logINFO, "* Re            ="<<Re);
+         UBLOG(logINFO, "* Ma            ="<<Ma);
+         UBLOG(logINFO, "* uReal         ="<<uReal);
+         UBLOG(logINFO, "* nueReal       ="<<nueReal);
+         UBLOG(logINFO, "* nue           ="<<nueLB);
+         UBLOG(logINFO, "* velocity      ="<<uLB);
+         UBLOG(logINFO, "* LX1 (world/LB)="<<hReal<<"/"<<hReal/coarseNodeDx);
+      //   UBLOG(logINFO, "* LX2 (world/LB)="<<kanalbreiteSI<<"/"<<kanalbreiteSI/coarseNodeDx);
+      //   UBLOG(logINFO, "* LX3 (world/LB)="<<kanalhoeheSI<<"/"<<kanalhoeheSI/coarseNodeDx);
+         UBLOG(logINFO, "* cdx           ="<<coarseNodeDx);
+         UBLOG(logINFO, "* fdx           ="<<fineNodeDx);
+         UBLOG(logINFO, "* dx_base ="<<coarseNodeDx<<" == "<<coarseNodeDx);
+         UBLOG(logINFO, "* dx_refine ="<<fineNodeDx<<" == "<<fineNodeDx );
+         UBLOG(logINFO, "* nx1/2/3 ="<<nx[0]<<"/"<<nx[1]<<"/"<<nx[2]);
+         UBLOG(logINFO, "* blocknx1/2/3 ="<<blocknx[0]<<"/"<<blocknx[1]<<"/"<<blocknx[2]);
+         UBLOG(logINFO, "* x2Periodic    ="<<periodicx2);
+         UBLOG(logINFO, "* x3Periodic    ="<<periodicx3);
+         UBLOG(logINFO, "*****************************************");
+         UBLOGML(logINFO, "UnitConverter:"<<unitConverter->toString());
+         UBLOG(logINFO, "*****************************************");
+      }
+
+
+      RatioBlockVisitor ratioVisitor(refineLevel);
+      grid->accept(ratioVisitor);
+      RatioSmoothBlockVisitor ratioSmoothVisitor(refineLevel);
+      grid->accept(ratioSmoothVisitor);
+      OverlapBlockVisitor overlapVisitor(refineLevel);
+      grid->accept(overlapVisitor);
+      std::vector<int> dirs;
+      D3Q27System::getLBMDirections(dirs);
+      SetInterpolationDirsBlockVisitor interDirsVisitor(dirs);
+      grid->accept(interDirsVisitor);
+
+      if(myid == 0) UBLOG(logINFO,"Refinement - end");
+
+      MetisPartitioningGridVisitor metisVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B);
+      grid->accept( metisVisitor );
+
+      if(myid == 0) UBLOG(logINFO,"Write blocks - start");
+      BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname + "/grid/blocks", WbWriterVtkXmlBinary::getInstance(), comm));
+      if(myid == 0) ppblocks->update(0);
+      if(myid == 0) UBLOG(logINFO,"Write blocks - end");
+
+      if(myid == 0) UBLOG(logINFO,"deleteSolidBlocks - start");
+      SolidBlocksHelper sd(grid, comm);
+
+
+      sd.deleteSolidBlocks();
+      if(myid == 0) UBLOG(logINFO,"deleteSolidBlocks - end");
+
+      if(myid == 0) UBLOG(logINFO,"Write blocks - start");
+      grid->accept( metisVisitor );
+      if(myid == 0) ppblocks->update(1);
+      ppblocks.reset();
+      if(myid == 0) UBLOG(logINFO,"Write blocks - end");
+
+      unsigned long nob = grid->getNumberOfBlocks();
+      unsigned long nod = nob * blocknx[0]*blocknx[1]*blocknx[2];
+      unsigned long nod_real = nob * (blocknx[0]+3)*(blocknx[1]+3)*(blocknx[2]+3);
+
+      double needMemAll  = double(nod_real*(27*sizeof(double) + sizeof(int)));
+      double needMem  = needMemAll / double(comm->getNumberOfProcesses());
+
+      if(myid == 0)
+      {
+         UBLOG(logINFO,"Number of blocks = " << nob);
+         UBLOG(logINFO,"Number of nodes  = " << nod);
+         UBLOG(logINFO,"Necessary memory  = " << needMemAll << " bytes");
+         UBLOG(logINFO,"Necessary memory per process = " << needMem  << " bytes");
+         UBLOG(logINFO,"Available memory per process = " << availMem << " bytes");
+      }
+
+      LBMKernel3DPtr kernel(new LBMKernelETD3Q27Cascaded(blocknx[0], blocknx[1], blocknx[2]));
+
+  //    LBMKernel3DPtr kernel(new LBMKernelETD3Q27BGK(blocknx[0], blocknx[1], blocknx[2],1));
+      BCProcessorPtr bcProc(new D3Q27ETBCProcessor());
+      kernel->setBCProcessor(bcProc);
+
+
+      SetKernelBlockVisitor kernelVisitor(kernel, nueLB, availMem, needMem);
+
+      grid->accept(kernelVisitor);
+
+
+
+//////////////////////////////////////////////////////////////////////////
+    double geoOverlap = 5*coarseNodeDx;
+
+
+//////////////////////////////////////////////////////////////////////////
+   // Interactoren
+//////////////////////////////////////////////////////////////////////////
+//##########################################################################
+   int noSlipSecOpt = 0; // #0=2nd order BB 1=simple BB
+//##########################################################################
+   int noSlipSecOptAsphalt = 1; // #0=2nd order BB 1=simple BB
+//##########################################################################
+     int bbOption1 = 0; //0=simple Bounce Back, 1=quadr. BB
+     D3Q27BoundaryConditionAdapterPtr bcObst(new D3Q27NoSlipBCAdapter(bbOption1));
+   D3Q27InteractorPtr PM1Interactor = D3Q27InteractorPtr ( new D3Q27Interactor(pmMesh, grid, bcObst,Interactor3D::SOLID)); //wo ist bc obst definiert?
+ grid->addAndInitInteractor( PM1Interactor);
+   //UBLOG(logINFO,"SpD3Q19Asphalt - send porous media to D3Q19InteractorService");
+   //UBLOG(logINFO,"SpD3Q19Asphalt - send porous media = "<<pmInteractor->getName()<<" with "<<typeid(*pmInteractor->getGbObject3D()).name()<<" node("<<pmNX1<<"/"<<pmNX2<<"/"<<pmNX3<<")");
+   UbTimer timer;
+   timer.start();
+
+
+   UBLOG(logINFO,"SpD3Q19Asphalt - send porous media to D3Q19InteractorService done in "<<timer.stop());
+
+
+      if (refineLevel > 0)
+      {
+         D3Q27SetUndefinedNodesBlockVisitor undefNodesVisitor;
+         grid->accept(undefNodesVisitor);
+      }
+
+
+      //set connectors
+      D3Q27InterpolationProcessorPtr iProcessor(new D3Q27OffsetInterpolationProcessor());
+      D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
+      grid->accept( setConnsVisitor );
+
+      //domain decomposition
+      PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
+      grid->accept(pqPartVisitor);
+
+      //initialization of decompositions
+      D3Q27ETInitDistributionsBlockVisitor initVisitor(1.0);
+      initVisitor.setVx1(0.0);
+      grid->accept(initVisitor);
+
+
+ //////////////////////////////////////////////////////////////////////////
+   // BCs
+//////////////////////////////////////////////////////////////////////////
+      //Reparatur an den Seiten:
+       UBLOG(logINFO,"inflow")
+           double x3minMesh=0.000;  double x3maxMesh=originX3 + blockLengthx3*nx3 + geoOverlap;
+   GbCuboid3DPtr leftCuboid(new GbCuboid3D( originX1 + blockLengthx1*nx1 - coarseNodeDx,
+                                           originX2 - geoOverlap,
+                                           x3minMesh,
+                                           originX1 + blockLengthx1*nx1 + geoOverlap,
+                                           originX2 + blockLengthx2*nx2 + geoOverlap,
+                                           x3maxMesh));
+   GbCuboid3DPtr rightCuboid(new GbCuboid3D( originX1 - geoOverlap,
+                                           originX2 - geoOverlap,
+                                           x3minMesh,
+                                           originX1 + geoOverlap,
+                                           originX2 + blockLengthx2*nx2 + geoOverlap,
+                                           x3maxMesh));
+   GbCuboid3DPtr northCuboid(new GbCuboid3D( originX1- geoOverlap,
+                                           originX2 + blockLengthx2*nx2 - 0.5*coarseNodeDx,
+                                           x3minMesh,
+                                           originX1 + blockLengthx1*nx1 + geoOverlap,
+                                           originX2 + blockLengthx2*nx2 + geoOverlap,
+                                           x3maxMesh));
+   GbCuboid3DPtr southCuboid(new GbCuboid3D( originX1 - geoOverlap,
+                                           originX2 - geoOverlap,
+                                           x3minMesh,
+                                           originX1 + blockLengthx1*nx1 + geoOverlap,
+                                           originX2 + geoOverlap,
+                                           x3maxMesh));
+
+//////////////////////////////////////////////////////////////////////////
+   // inflow
+//////////////////////////////////////////////////////////////////////////
+   UBLOG(logINFO,"inflow")
+
+   GbCuboid3DPtr densCuboid(new GbCuboid3D(
+                                           originX1 - geoOverlap,
+                                           originX2 - geoOverlap,
+                                           originX3 + blockLengthx3*nx3 - coarseNodeDx,
+                                           originX1 + blockLengthx1*nx1 + geoOverlap,
+                                           originX2 + blockLengthx2*nx2 + geoOverlap,
+                                           originX3 + blockLengthx3*nx3 + geoOverlap));
+
+
+//////////////////////////////////////////////////////////////////////////
+   // bottom/outflow
+//////////////////////////////////////////////////////////////////////////
+      double dRho=0.05;
+      GbCuboid3DPtr densCuboid2(new GbCuboid3D(
+                                                 originX1 - geoOverlap,
+                                                 originX2 - geoOverlap,
+                                                 originX3 - geoOverlap,
+                                                 originX1 + blockLengthx1*nx1 + geoOverlap,
+                                                 originX2 + blockLengthx2*nx2 + geoOverlap,
+minX3+0.5*fineNodeDx   ));
+
+      if(myid == 0) GbSystem3D::writeGeoObject(densCuboid2.get(), pathname+"/geo/densCuboid2", WbWriterVtkXmlASCII::getInstance());
+      D3Q27BoundaryConditionAdapterPtr denBCAdapter2(new D3Q27DensityBCAdapter(rhoInit-dRho));
+      D3Q27InteractorPtr densInteractor2( new D3Q27Interactor(leftCuboid,grid,denBCAdapter2,Interactor3D::SOLID) );
+      grid->addAndInitInteractor( densInteractor2 );
+
+            if(myid == 0) GbSystem3D::writeGeoObject(densCuboid.get(), pathname+"/geo/densCuboid", WbWriterVtkXmlASCII::getInstance());
+      D3Q27BoundaryConditionAdapterPtr denBCAdapter(new D3Q27DensityBCAdapter(rhoInit+dRho));
+      D3Q27InteractorPtr densInteractor( new D3Q27Interactor(rightCuboid,grid,denBCAdapter,Interactor3D::SOLID) );
+      grid->addAndInitInteractor( densInteractor );
+
+   D3Q27InteractorPtr leftInteractor = D3Q27InteractorPtr ( new D3Q27Interactor(densCuboid2, grid, bcObst,Interactor3D::SOLID));
+   grid->addAndInitInteractor( leftInteractor);
+   D3Q27InteractorPtr rightInteractor = D3Q27InteractorPtr ( new D3Q27Interactor(densCuboid, grid, bcObst,Interactor3D::SOLID));
+  grid->addAndInitInteractor(rightInteractor);
+   D3Q27InteractorPtr northInteractor = D3Q27InteractorPtr ( new D3Q27Interactor(northCuboid, grid, bcObst,Interactor3D::SOLID));
+   grid->addAndInitInteractor(northInteractor);
+   D3Q27InteractorPtr southInteractor = D3Q27InteractorPtr ( new D3Q27Interactor(southCuboid, grid, bcObst,Interactor3D::SOLID));
+  grid->addAndInitInteractor(southInteractor);
+
+  if(myid == 0) GbSystem3D::writeGeoObject(northCuboid.get(), pathname+"/geo/north", WbWriterVtkXmlASCII::getInstance());
+if(myid == 0) GbSystem3D::writeGeoObject(southCuboid.get(), pathname+"/geo/south", WbWriterVtkXmlASCII::getInstance());
+if(myid == 0) GbSystem3D::writeGeoObject(rightCuboid.get(), pathname+"/geo/right", WbWriterVtkXmlASCII::getInstance());
+if(myid == 0) GbSystem3D::writeGeoObject(leftCuboid.get(), pathname+"/geo/left", WbWriterVtkXmlASCII::getInstance());
+
+
+      UbSchedulerPtr geoSch(new UbScheduler(1));
+      D3Q27MacroscopicQuantitiesPostprocessorPtr ppgeo(
+           new D3Q27MacroscopicQuantitiesPostprocessor(grid, geoSch, pathname + "/grid/nodes", WbWriterVtkXmlBinary::getInstance(),
+unitConverter, comm, true));
+
+              double raiseVelSteps = 0;
+
+      grid->doPostProcess(0);
+      ppgeo.reset();
+      geoSch.reset();
+
+     UbSchedulerPtr plSch(new UbScheduler(10, 2));
+      vector<D3Q27PathLinePostprocessorPtr> pathlinepostPParray;
+
+ for (int ppz=0; ppz<27; ppz++)
+      {
+      for (int ppy=0; ppy<27; ppy++)
+      {
+          char numstr[21];
+          sprintf(numstr, "%d", ppy+20*ppz);
+          std::string pathPL = pathname+"/pathline" + numstr+".dat";
+         D3Q27PathLinePostprocessorPtr plptr1( new D3Q27PathLinePostprocessor(grid, pathPL, WbWriterVtkXmlASCII::getInstance(), unitConverter, plSch, comm, 8.0, 6.0+8.0*(double)ppy,5.0+8.0*(double)ppz, nueLB, iProcessor));
+              pathlinepostPParray.push_back(plptr1);//new D3Q27PathLinePostprocessor(grid, pathname + "/pathLine", WbWriterVtkXmlASCII::getInstance(), conv, plSch, comm, 0.01+(double)ppx*0.0001, 0.00001,0.00001, nueLB, iProcessor));
+
+          }
+      }
+
+ UbSchedulerPtr visSch(new UbScheduler());
+      visSch->addSchedule(1,1,10);
+      visSch->addSchedule(10,10,100);
+      visSch->addSchedule(100,100,1000);
+      visSch->addSchedule(1000,1000,100000);
+      visSch->addSchedule(100000,100000,1000000);
+      D3Q27MacroscopicQuantitiesPostprocessor pp(grid, visSch, pathname + "/steps/step", WbWriterVtkXmlBinary::getInstance(), unitConverter, comm);
+
+      UbSchedulerPtr nupsSch(new UbScheduler(10, 10, 100));
+      NUPSCounterPostprocessor npr(grid, nupsSch, pathname + "/results/nups.txt", comm);
+
+//////////////////////////////////////////////////////////////////////////
+
+      cout << "PID = " << myid << " Total Physical Memory (RAM): " << MemoryUtil::getTotalPhysMem()<<endl;
+      cout << "PID = " << myid << " Physical Memory currently used: " << MemoryUtil::getPhysMemUsed()<<endl;
+      cout << "PID = " << myid << " Physical Memory currently used by current process: " << MemoryUtil::getPhysMemUsedByMe()<<endl;
+
+      double endTime = 40001;
+      UbSchedulerPtr ghostLSch(new UbScheduler());
+      ghostLSch->addSchedule(1,1,endTime);
+      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, ghostLSch));
+      if(myid == 0) UBLOG(logINFO,"Simulation-start");
+      calculation->calculate();
+      if(myid == 0) UBLOG(logINFO,"Simulation-end");
+   }
+   catch(std::exception& e)
+   {
+      cerr << e.what() << endl << flush;
+   }
+   catch(std::string& s)
+   {
+      cerr << s << endl;
+   }
+   catch(...)
+   {
+      cerr << "unknown exception" << endl;
+   }
+}
+int main(int argc, char* argv[])
+{
+
+   run(argv[1]);
+
+   return 0;
+} 
diff --git a/apps/cpu/pmTortu/streamlinesMean.py b/apps/cpu/pmTortu/streamlinesMean.py
index 47d39b94575168d514e53a282bb068d6eaa6d787..6fa77ce21f76214151848c150bae96563a3c344d 100644
--- a/apps/cpu/pmTortu/streamlinesMean.py
+++ b/apps/cpu/pmTortu/streamlinesMean.py
@@ -1,162 +1,162 @@
-import os
-import scipy
-import numpy
-import math
-
-#li=[[5,0.005]]
-
-n=409;
-i=0;
-j=0;
-k=0;
-length=[0];
-lengthx=[0];
-lengthT=[0,0,0,0,0];
-lengthxT=[0,0,0,0,0];
-ItortuList=[0];
-outKOx=78.0;#0.105;
-try:
- for i in range(1,n):
-  length.append(0);
-  lengthx.append(0);
-  #if (i<10):
-  # dateiIn="C:/Users/Sonja/Documents/pathlines3/pathline30"+str(i)+".dat.ascii.vtu"
-  #else:
-  dateiIn="C:/Users/Sonja/Documents/blech2c/pathline"+str(i)+".dat.ascii.vtu"
-  print dateiIn
-  datei = open(dateiIn,"r")
-  j=0; k=0;
-  for line in datei:
-     j=j+1
-     #print line
- ##   if ((i>6568) and (i<17261)  ):
-     #zuordnung = line.split("  ")
-     #if (j==1): print line
-     if (k==1): ##marker der anfang der koordinaten bezeichnet
-         zuordnung = line.split("  ")
-         #print zuordnung
-         #pointsxyz=zuordnung[7].split(" ")
-         #print pointsxyz
-         t=0;
-         for entry in zuordnung:
-             pointsxyz=entry.split(" ")
-             #print pointsxyz
-             t=t+1;
-             #if (i==1 | i==2):
-             lengthT.append(0);
-             lengthxT.append(0);
-             if (t>7):
-              if (pointsxyz[1]!="\n"):
-               if(float(pointsxyz[1])<outKOx): ##ende messbereich
-                 #print pointsxyz
-                 if (t==8):
-                     xalt=float(pointsxyz[1]);
-                     yalt=float(pointsxyz[2]);
-                     zalt=float(pointsxyz[3]);
-                 xneu=float(pointsxyz[1]);
-                 yneu=float(pointsxyz[2]);
-                 zneu=float(pointsxyz[3]);
-                 if (xalt>20.0):              ##beginn messbereicht
-                  length[i]=length[i]+math.sqrt((xneu-xalt)*(xneu-xalt)+(yneu-yalt)*(yneu-yalt)+(zneu-zalt)*(zneu-zalt));
-                  lengthx[i]=lengthx[i]+(xneu-xalt);
-                  lengthT[t]=lengthT[t]+length[i];
-                  lengthxT[t]=lengthxT[t]+lengthx[i];
-                  #print lengthT[t]
-                  #print xneu
-                  #print lengthx[i]
-                 xalt=xneu; yalt=yneu; zalt=zneu;
-                 
- 
-         k=2;
-     #if (str(line)=="""            <DataArray type="Float64" NumberOfComponents="3" format="ascii">"""):
- 
-     if(j==5):
-       print line
-       k=1;
-     #print zuordnung
-     #print zuordnung[0]
-     #print zuordnung[1]
-     #test0=float(zuordnung[0])
-     #test1=float(zuordnung[1])
-     #li.append([test0,test1])
- ##print float(li[10])/20
- #print li
-  datei.close();
- i=0;
- j=0;
- length.pop(0);
- lengthx.pop(0);
- #print length
- #print lengthx
- tortuGes=0;
- LGes=0.0;
- LxGes=0.0;
- fFile = open("f:/temp/pathlinesb2cLength.dat", "w")
- for entry in length:
-     #print entry;
-     #print lengthx[i];
-     LGes=LGes+length[i];
-     LxGes=LxGes+lengthx[i];
-     ItortuList.append(entry/max(lengthx[i],0.00000001));
-     if (length[i]>2.0):
-      Itortu=entry/lengthx[i]
-      print Itortu
-      j=j+1;
-      tortuGes=tortuGes+Itortu;
-     i=i+1
-     fFile.write(str(i))
-     fFile.write(" ")
-     fFile.write(str(entry))
-     fFile.write(" ")
-     #fFile.write(str(lengthx[i]))
-     #fFile.write(" ")
-     #fFile.write(str(entry/max(lengthx[i],0.00000001)))   
-     fFile.write("\n")
- tortuGes=tortuGes/j;
- print "berücksichtigte Stromlinien:" 
- print j
- fFile.close();
- ItortuList.pop(0);
- print "TortuGes:"
- print tortuGes;
- print "Lges:"
- print LGes;
- print "Lxges:"
- print LxGes;
- print "Lges/LxGes:"
- print LGes/LxGes;
- erg=[lengthx,length,ItortuList];
- #print erg
- erg=numpy.asarray(erg).T.tolist() #does a list-transpose
- #print erg
- erg=sorted(erg);
- fFile = open("f:/temp/pathlinesb2cLengthSortt1000.dat", "w")
- i=0;
- #print erg[1][1]
- #print erg[0][1]
- for entry in erg:
-     i=i+1;
-     #print i
-     fFile.write(str(entry[0]))
-     fFile.write(" ")
-     fFile.write(str(entry[1]))
-     fFile.write(" ")
-     fFile.write(" ")
-     fFile.write(str(entry[2]))
-     fFile.write("\n")
- fFile.close();
- fFile = open("f:/temp/pathlinesbcbwithTime.dat", "w")
- i=0;
- for entry in lengthxT:
-     i=i+1;
-     #print i
-     fFile.write(str(entry))
-     fFile.write(" ")
-     fFile.write(str(lengthT[i]))
-     fFile.write(" ")
-     fFile.write("\n")
- fFile.close();
-except IOError:
- datei.close()
- print "caught error couldnt process datafile"
- print i
+import os
+import scipy
+import numpy
+import math
+
+#li=[[5,0.005]]
+
+n=409;
+i=0;
+j=0;
+k=0;
+length=[0];
+lengthx=[0];
+lengthT=[0,0,0,0,0];
+lengthxT=[0,0,0,0,0];
+ItortuList=[0];
+outKOx=78.0;#0.105;
+try:
+ for i in range(1,n):
+  length.append(0);
+  lengthx.append(0);
+  #if (i<10):
+  # dateiIn="C:/Users/Sonja/Documents/pathlines3/pathline30"+str(i)+".dat.ascii.vtu"
+  #else:
+  dateiIn="C:/Users/Sonja/Documents/blech2c/pathline"+str(i)+".dat.ascii.vtu"
+  print dateiIn
+  datei = open(dateiIn,"r")
+  j=0; k=0;
+  for line in datei:
+     j=j+1
+     #print line
+ ##   if ((i>6568) and (i<17261)  ):
+     #zuordnung = line.split("  ")
+     #if (j==1): print line
+     if (k==1): ##marker der anfang der koordinaten bezeichnet
+         zuordnung = line.split("  ")
+         #print zuordnung
+         #pointsxyz=zuordnung[7].split(" ")
+         #print pointsxyz
+         t=0;
+         for entry in zuordnung:
+             pointsxyz=entry.split(" ")
+             #print pointsxyz
+             t=t+1;
+             #if (i==1 | i==2):
+             lengthT.append(0);
+             lengthxT.append(0);
+             if (t>7):
+              if (pointsxyz[1]!="\n"):
+               if(float(pointsxyz[1])<outKOx): ##ende messbereich
+                 #print pointsxyz
+                 if (t==8):
+                     xalt=float(pointsxyz[1]);
+                     yalt=float(pointsxyz[2]);
+                     zalt=float(pointsxyz[3]);
+                 xneu=float(pointsxyz[1]);
+                 yneu=float(pointsxyz[2]);
+                 zneu=float(pointsxyz[3]);
+                 if (xalt>20.0):              ##beginn messbereicht
+                  length[i]=length[i]+math.sqrt((xneu-xalt)*(xneu-xalt)+(yneu-yalt)*(yneu-yalt)+(zneu-zalt)*(zneu-zalt));
+                  lengthx[i]=lengthx[i]+(xneu-xalt);
+                  lengthT[t]=lengthT[t]+length[i];
+                  lengthxT[t]=lengthxT[t]+lengthx[i];
+                  #print lengthT[t]
+                  #print xneu
+                  #print lengthx[i]
+                 xalt=xneu; yalt=yneu; zalt=zneu;
+                 
+ 
+         k=2;
+     #if (str(line)=="""            <DataArray type="Float64" NumberOfComponents="3" format="ascii">"""):
+ 
+     if(j==5):
+       print line
+       k=1;
+     #print zuordnung
+     #print zuordnung[0]
+     #print zuordnung[1]
+     #test0=float(zuordnung[0])
+     #test1=float(zuordnung[1])
+     #li.append([test0,test1])
+ ##print float(li[10])/20
+ #print li
+  datei.close();
+ i=0;
+ j=0;
+ length.pop(0);
+ lengthx.pop(0);
+ #print length
+ #print lengthx
+ tortuGes=0;
+ LGes=0.0;
+ LxGes=0.0;
+ fFile = open("f:/temp/pathlinesb2cLength.dat", "w")
+ for entry in length:
+     #print entry;
+     #print lengthx[i];
+     LGes=LGes+length[i];
+     LxGes=LxGes+lengthx[i];
+     ItortuList.append(entry/max(lengthx[i],0.00000001));
+     if (length[i]>2.0):
+      Itortu=entry/lengthx[i]
+      print Itortu
+      j=j+1;
+      tortuGes=tortuGes+Itortu;
+     i=i+1
+     fFile.write(str(i))
+     fFile.write(" ")
+     fFile.write(str(entry))
+     fFile.write(" ")
+     #fFile.write(str(lengthx[i]))
+     #fFile.write(" ")
+     #fFile.write(str(entry/max(lengthx[i],0.00000001)))   
+     fFile.write("\n")
+ tortuGes=tortuGes/j;
+ print "berücksichtigte Stromlinien:" 
+ print j
+ fFile.close();
+ ItortuList.pop(0);
+ print "TortuGes:"
+ print tortuGes;
+ print "Lges:"
+ print LGes;
+ print "Lxges:"
+ print LxGes;
+ print "Lges/LxGes:"
+ print LGes/LxGes;
+ erg=[lengthx,length,ItortuList];
+ #print erg
+ erg=numpy.asarray(erg).T.tolist() #does a list-transpose
+ #print erg
+ erg=sorted(erg);
+ fFile = open("f:/temp/pathlinesb2cLengthSortt1000.dat", "w")
+ i=0;
+ #print erg[1][1]
+ #print erg[0][1]
+ for entry in erg:
+     i=i+1;
+     #print i
+     fFile.write(str(entry[0]))
+     fFile.write(" ")
+     fFile.write(str(entry[1]))
+     fFile.write(" ")
+     fFile.write(" ")
+     fFile.write(str(entry[2]))
+     fFile.write("\n")
+ fFile.close();
+ fFile = open("f:/temp/pathlinesbcbwithTime.dat", "w")
+ i=0;
+ for entry in lengthxT:
+     i=i+1;
+     #print i
+     fFile.write(str(entry))
+     fFile.write(" ")
+     fFile.write(str(lengthT[i]))
+     fFile.write(" ")
+     fFile.write("\n")
+ fFile.close();
+except IOError:
+ datei.close()
+ print "caught error couldnt process datafile"
+ print i
diff --git a/apps/cpu/porplate2/CMakeLists.txt b/apps/cpu/porplate2/CMakeLists.txt
index 0c5ab0a066a5d953ca26e58bef628e2d56333454..a1a8d917d96667de38c2e014313341303cee4810 100644
--- a/apps/cpu/porplate2/CMakeLists.txt
+++ b/apps/cpu/porplate2/CMakeLists.txt
@@ -1,25 +1,25 @@
-CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
-
-########################################################
-## C++ PROJECT                                       ###
-########################################################
-PROJECT(porplate2)
-
-INCLUDE(${SOURCE_ROOT}/lib/IncludsList.txt) 
-
-#################################################################
-###   LOCAL FILES                                             ###
-#################################################################
-FILE(GLOB SPECIFIC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.h
-                         ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
-                         ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp  )
- 
-SET(ALL_SOURCES ${ALL_SOURCES} ${SPECIFIC_FILES})
-SOURCE_GROUP(src FILES ${SPECIFIC_FILES})
-  
-SET(CAB_ADDITIONAL_LINK_LIBRARIES vfluids)
-
-#################################################################
-###   CREATE PROJECT                                          ###
-#################################################################
-CREATE_CAB_PROJECT(porplate2 BINARY)
+CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
+
+########################################################
+## C++ PROJECT                                       ###
+########################################################
+PROJECT(porplate2)
+
+INCLUDE(${SOURCE_ROOT}/lib/IncludsList.txt) 
+
+#################################################################
+###   LOCAL FILES                                             ###
+#################################################################
+FILE(GLOB SPECIFIC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.h
+                         ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
+                         ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp  )
+ 
+SET(ALL_SOURCES ${ALL_SOURCES} ${SPECIFIC_FILES})
+SOURCE_GROUP(src FILES ${SPECIFIC_FILES})
+  
+SET(CAB_ADDITIONAL_LINK_LIBRARIES vfluids)
+
+#################################################################
+###   CREATE PROJECT                                          ###
+#################################################################
+CREATE_CAB_PROJECT(porplate2 BINARY)
diff --git a/apps/cpu/porplate2/porplate.cpp b/apps/cpu/porplate2/porplate.cpp
index 639dfff35e6ef0aa994c9cece1dab3d32d3dcb45..109f0b3f75396dcf2d3d410f22fb5da76016344d 100644
--- a/apps/cpu/porplate2/porplate.cpp
+++ b/apps/cpu/porplate2/porplate.cpp
@@ -1,1060 +1,1060 @@
-
-
-#include <iostream>
-#include <string>
-#include <math.h> 
-
-#include <vfluids.h>
-
-using namespace std;
-
-//////////////////////////////////////////////////////////////////////////
-void inlay(GbVoxelMatrix3DPtr pmMesh, string& pathname, int myid, int i, Grid3DPtr grid)
-{
-   int bbOptionPM = 2; //quadratic bounce back with for thin walls
-   D3Q27BoundaryConditionAdapterPtr noSlipPM(new D3Q27NoSlipBCAdapter(bbOptionPM));
-   D3Q27InteractorPtr inlayInt = D3Q27InteractorPtr(new D3Q27Interactor(pmMesh, grid, noSlipPM, Interactor3D::SOLID));
-
-   GbCuboid3DPtr inlayBox(new GbCuboid3D(pmMesh->getX1Minimum(), pmMesh->getX2Minimum(), pmMesh->getX3Minimum(), pmMesh->getX1Maximum(), pmMesh->getX2Maximum(), pmMesh->getX3Maximum()));
-   if (myid == 0) GbSystem3D::writeGeoObject(inlayBox.get(), pathname + "/geo/inlay" + UbSystem::toString(i), WbWriterVtkXmlASCII::getInstance());
-   D3Q27InteractorPtr inlayBoxInt = D3Q27InteractorPtr(new D3Q27Interactor(inlayBox, grid, noSlipPM, Interactor3D::SOLID));
-   SetSolidOrTransBlockVisitor v1(inlayBoxInt, SetSolidOrTransBlockVisitor::SOLID);
-   grid->accept(v1);
-   SetSolidOrTransBlockVisitor v2(inlayBoxInt, SetSolidOrTransBlockVisitor::TRANS);
-   grid->accept(v2);
-
-   vector<Block3DPtr> inlayBlocks;
-   vector<Block3DPtr>& sb = inlayBoxInt->getSolidBlockSet();
-   if (myid == 0) UBLOG(logINFO, "sb.size = " << sb.size());
-   inlayBlocks.insert(inlayBlocks.end(), sb.begin(), sb.end());
-   vector<Block3DPtr>& tb = inlayBoxInt->getTransBlockSet();
-   if (myid == 0) UBLOG(logINFO, "tb.size = " << tb.size());
-   inlayBlocks.insert(inlayBlocks.end(), tb.begin(), tb.end());
-
-   if (myid == 0) UBLOG(logINFO, "inlayBlocks.size = " << inlayBlocks.size());
-
-   BOOST_FOREACH(Block3DPtr block, inlayBlocks)
-   {
-      block->setActive(true);
-      inlayInt->setDifferencesToGbObject3D(block);
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-void deleteExistBlocks(Grid3DPtr ngrid, Grid3DPtr ogrid)
-{
-   int minInitLevel = ogrid->getCoarsestInitializedLevel();
-   int maxInitLevel = ogrid->getFinestInitializedLevel();
-
-   std::vector<std::vector<Block3DPtr> > blockVector;
-   blockVector.resize(maxInitLevel + 1);
-
-   std::vector<int> ids;
-
-   for (int level = minInitLevel; level <= maxInitLevel; level++)
-   {
-      ogrid->getBlocks(level, blockVector[level]);
-
-      BOOST_FOREACH(Block3DPtr block, blockVector[level])
-      {
-         int x1 = block->getX1();
-         int x2 = block->getX2();
-         int x3 = block->getX3();
-         Block3DPtr nblock = ngrid->getBlock(x1, x2, x3, level);
-         if (nblock)
-         {
-            ngrid->deleteBlock(x1, x2, x3, level);
-         }
-         else
-         {
-            ids.push_back(block->getGlobalID());
-         }
-      }
-   }
-
-   ogrid->deleteBlocks(ids);
-}
-//////////////////////////////////////////////////////////////////////////
-void reindexBlocks(Grid3DPtr ngrid)
-{
-   int minInitLevel = ngrid->getCoarsestInitializedLevel();
-   int maxInitLevel = ngrid->getFinestInitializedLevel();
-
-   std::vector<std::vector<Block3DPtr> > blockVector;
-   blockVector.resize(maxInitLevel + 1);
-
-   int maxID = Block3D::getMaxGlobalID();
-
-   for (int level = minInitLevel; level <= maxInitLevel; level++)
-   {
-      ngrid->getBlocks(level, blockVector[level]);
-
-      BOOST_FOREACH(Block3DPtr block, blockVector[level])
-      {
-         block->setGlobalID(++maxID);
-      }
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-void setInterpolationFlag(Grid3DPtr grid)
-{
-   int minInitLevel = grid->getCoarsestInitializedLevel();
-   int maxInitLevel = grid->getFinestInitializedLevel();
-
-   std::vector<std::vector<Block3DPtr> > blockVector;
-   blockVector.resize(maxInitLevel + 1);
-
-   int maxID = Block3D::getMaxGlobalID();
-
-   for (int level = minInitLevel; level <= maxInitLevel; level++)
-   {
-      grid->getBlocks(level, blockVector[level]);
-
-      BOOST_FOREACH(Block3DPtr block, blockVector[level])
-      {
-         block->deleteInterpolationFlag();
-      }
-   }
-
-   std::vector<int> dirs;
-
-   for (int i = D3Q27System::E; i <= D3Q27System::TS; i++)
-   {
-      dirs.push_back(i);
-   }
-   SetInterpolationDirsBlockVisitor interDirsVisitor(dirs);
-   grid->accept(interDirsVisitor);
-}
-//////////////////////////////////////////////////////////////////////////
-void addExistBlocks(Grid3DPtr ngrid, Grid3DPtr ogrid, Grid3DPtr hgrid)
-{
-   int minInitLevel = ngrid->getCoarsestInitializedLevel();
-   int maxInitLevel = ngrid->getFinestInitializedLevel();
-
-   std::vector<std::vector<Block3DPtr> > blockVector;
-   blockVector.resize(maxInitLevel + 1);
-
-   std::vector<Block3DPtr> db;
-
-   //int gridRank = ogrid->getRank();
-
-   for (int level = minInitLevel; level <= maxInitLevel; level++)
-   {
-      ngrid->getBlocks(level, blockVector[level]);
-
-      BOOST_FOREACH(Block3DPtr block, blockVector[level])
-      {
-         int x1 = block->getX1();
-         int x2 = block->getX2();
-         int x3 = block->getX3();
-         Block3DPtr oblock = ogrid->getBlock(x1, x2, x3, level);
-         if (oblock)
-         {
-            hgrid->addBlock(oblock);
-         }
-
-      }
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-void moveBlocks(Grid3DPtr ngrid, Grid3DPtr ogrid)
-{
-   int minInitLevel = ngrid->getCoarsestInitializedLevel();
-   int maxInitLevel = ngrid->getFinestInitializedLevel();
-
-   std::vector<std::vector<Block3DPtr> > blockVector;
-   blockVector.resize(maxInitLevel + 1);
-
-   for (int level = minInitLevel; level <= maxInitLevel; level++)
-   {
-      ngrid->getBlocks(level, blockVector[level]);
-
-      BOOST_FOREACH(Block3DPtr block, blockVector[level])
-      {
-         ogrid->addBlock(block);
-      }
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-void removeUndefNodes(Grid3DPtr grid)
-{
-   int minInitLevel = grid->getCoarsestInitializedLevel();
-   int maxInitLevel = grid->getFinestInitializedLevel();
-
-   std::vector<std::vector<Block3DPtr> > blockVector;
-   blockVector.resize(maxInitLevel + 1);
-
-   int gridRank = grid->getRank();
-
-   for (int level = minInitLevel; level <= maxInitLevel; level++)
-   {
-      grid->getBlocks(level, gridRank, true, blockVector[level]);
-
-      BOOST_FOREACH(Block3DPtr block, blockVector[level])
-      {
-         int gl = 0;
-
-         LBMKernel3DPtr kernel = block->getKernel();
-         BCArray3D<D3Q27BoundaryCondition>& bcMatrix = boost::dynamic_pointer_cast<D3Q27ETBCProcessor>(kernel->getBCProcessor())->getBCArray();
-
-         int minX1 = gl;
-         int minX2 = gl;
-         int minX3 = gl;
-
-         int maxX1 = static_cast<int>(bcMatrix.getNX1()) - 1 - gl;
-         int maxX2 = static_cast<int>(bcMatrix.getNX2()) - 1 - gl;
-         int maxX3 = static_cast<int>(bcMatrix.getNX3()) - 1 - gl;
-
-         minX1 = gl;
-         minX2 = gl;
-         minX3 = gl;
-
-         maxX1 = static_cast<int>(bcMatrix.getNX1()) - 1 - gl;
-         maxX2 = static_cast<int>(bcMatrix.getNX2()) - 1 - gl;
-         maxX3 = static_cast<int>(bcMatrix.getNX3()) - 1 - gl;
-
-         for (int ix3 = minX3; ix3 <= maxX3; ix3++)
-            for (int ix2 = minX2; ix2 <= maxX2; ix2++)
-               for (int ix1 = minX1; ix1 <= maxX3; ix1++)
-               {
-                  if (bcMatrix.isUndefined(ix1, ix2, ix3)) bcMatrix.setFluid(ix1, ix2, ix3);
-               }
-      }
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-void removeBCInformation(Grid3DPtr grid)
-{
-   int minInitLevel = grid->getCoarsestInitializedLevel();
-   int maxInitLevel = grid->getFinestInitializedLevel();
-
-   std::vector<std::vector<Block3DPtr> > blockVector;
-   blockVector.resize(maxInitLevel + 1);
-
-   int gridRank = grid->getRank();
-
-   for (int level = minInitLevel; level <= maxInitLevel; level++)
-   {
-      grid->getBlocks(level, gridRank, true, blockVector[level]);
-
-      BOOST_FOREACH(Block3DPtr block, blockVector[level])
-      {
-         int gl = 0;
-
-         LBMKernel3DPtr kernel = block->getKernel();
-         BCArray3D<D3Q27BoundaryCondition>& bcMatrix = boost::dynamic_pointer_cast<D3Q27ETBCProcessor>(kernel->getBCProcessor())->getBCArray();
-
-         int minX1 = gl;
-         int minX2 = gl;
-         int minX3 = gl;
-
-         int maxX1 = static_cast<int>(bcMatrix.getNX1()) - 1 - gl;
-         int maxX2 = static_cast<int>(bcMatrix.getNX2()) - 1 - gl;
-         int maxX3 = static_cast<int>(bcMatrix.getNX3()) - 1 - gl;
-
-         for (int ix3 = minX3; ix3 <= maxX3; ix3++)
-            for (int ix2 = minX2; ix2 <= maxX2; ix2++)
-               for (int ix1 = minX1; ix1 <= maxX3; ix1++)
-               {
-                  bcMatrix.setFluid(ix1, ix2, ix3);
-                  //bcMatrix.setBC(ix1, ix2, ix3, D3Q27BoundaryConditionPtr());
-               }
-
-   //      if (!block->getKernel())
-   //      {
-   //         if (block->getRank() == grid->getRank())
-   //         {
-   //            BCProcessorPtr bcProc(new D3Q27ETForThinWallBCProcessor());
-   //            block->getKernel()->setBCProcessor(bcProc);
-   //         }
-   //      }
-      }
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-void setKernel(Grid3DPtr grid, LBMKernel3DPtr kernel, double nu)
-{
-   int minInitLevel = grid->getCoarsestInitializedLevel();
-   int maxInitLevel = grid->getFinestInitializedLevel();
-
-   std::vector<std::vector<Block3DPtr> > blockVector;
-   blockVector.resize(maxInitLevel + 1);
-
-   int gridRank = grid->getRank();
-
-   for (int level = minInitLevel; level <= maxInitLevel; level++)
-   {
-      grid->getBlocks(level, gridRank, true, blockVector[level]);
-
-      BOOST_FOREACH(Block3DPtr block, blockVector[level])
-      {
-         if (!block->getKernel())
-         {
-            if (block->getRank() == grid->getRank())
-            {
-               LBMReal collFactor = LBMSystem::calcCollisionFactor(nu, block->getLevel());
-               kernel->setCollisionFactor(collFactor);
-               kernel->setIndex(block->getX1(), block->getX2(), block->getX3());
-               kernel->setDeltaT(LBMSystem::getDeltaT(block->getLevel()));
-               kernel->setBlock(block);
-               LBMKernel3DPtr newKernel = kernel->clone();
-               block->setKernel(newKernel);
-            }
-         }
-      }
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-void run(const char *cstr, bool firststart)
-{
-   try
-   {
-      string pathname;
-      string pathGeo;
-      string pathLog;
-      int numOfThreads = 1;
-      bool logfile = false;
-      stringstream logFilename;
-      double availMem = 0;
-
-      CommunicatorPtr comm = MPICommunicator::getInstance();
-      int myid = comm->getProcessID();
-
-      string machine = string(cstr);
-
-      if (machine == "my")
-      {
-         pathname = "d:/temp/porplate2";
-         pathGeo = "d:/Data/plate";
-         pathLog = pathname;
-         numOfThreads = 1;
-         logfile = false;
-         availMem = 15.0e9;
-      }
-      else if (machine == "Ludwig")
-      {
-         pathname = "/work/koskuche/SFB880/porplate2";
-         pathGeo = "/home/koskuche/data/plate";
-         pathLog = pathname;
-         numOfThreads = 8;
-         availMem = 12.0e9;///8*numOfThreads;
-         logfile = true;
-      }
-      else if (machine == "HLRS")
-      {
-         pathname = "/univ_1/ws1/ws/xrmkuchr-plate3-0";
-         pathGeo = "/zhome/academic/HLRS/xrm/xrmkuchr/data/plate";
-         pathLog = "/zhome/academic/HLRS/xrm/xrmkuchr/work/plate";
-         numOfThreads = 16;
-         availMem = 2.0e9;
-         logfile = true;
-      }
-      else if (machine == "HLRN")
-      {
-         pathname = "/gfs1/work/niivfcpu/scratch/plateEx";
-         pathGeo = "/gfs1/work/niivfcpu/data/plate";
-         pathLog = pathname;
-         numOfThreads = 24;
-         availMem = 64.0e9 / 24.0*numOfThreads;
-         logfile = true;
-      }
-      else throw UbException(UB_EXARGS, "unknown CAB_MACHINE");
-
-#if defined(__unix__)
-      if (myid==0) 
-      {
-         const char* str = pathLog.c_str();
-         int status=mkdir(str, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
-      }
-#endif 
-
-      if (myid == 0 && logfile)
-      {
-         //UbLog::reportingLevel() = logDEBUG5;
-         logFilename << pathLog + "/logfile" + UbSystem::toString(UbSystem::getTimeStamp()) + "_" + UbSystem::toString(myid) + ".txt";
-         UbLog::output_policy::setStream(logFilename.str());
-      }
-
-      if (myid == 0) UBLOG(logINFO, "Testcase plate");
-
-      string PlatteFilename = pathGeo + "/Platte_bearbeitet2_10cmA.stl";
-
-      string ZckbndFilename = pathGeo + "/2zackenbaender0.stl";
-
-      int ppblockc = 0;
-
-      ///////////////Knotenabmessungen:
-      int nx[3], blocknx[3];
-      nx[0] = 90;//240;//120;//60;//86;//43;//65;//50;  //länge
-      nx[1] = 2;//2;//6;///1;//5;// //breite
-      nx[2] = 30;//64;//32;//18;//5;//15;//15; //höhe gebiet
-      blocknx[0] = 16;//10;//6;
-      blocknx[1] = 16;//10;//6;
-      blocknx[2] = 16;//10;//6;
-
-      int baseLevel = 0;
-      int refineLevel = 5;
-
-      double H = 600.0; // Kanalhöhe [mm]
-      double cdx = H / (double)(nx[2] * blocknx[2]);
-      double fdx = cdx / double(1 << refineLevel);
-
-      //double h = 200.0; // gewünschte Plattenhöhe in Gitterpunkten
-      //double fdx = plate->getLengthX3()/h;
-      //double cdx = fdx*double(1<<refineLevel);
-
-      LBMUnitConverterPtr unitConverter = LBMUnitConverterPtr(new LBMUnitConverter());
-
-      //////////////////////////////////////////////////////////////////////////
-      // physik
-      //////////////////////////////////////////////////////////////////////////
-
-      //////////////////////////////////////////////////////////////////////////
-      // Experiment Parametr
-      // Re = 1000000
-      // V = 16.05  # m / s
-      // p = 994.7  #hPa(manuell abgelesen von MUB)
-      // T = 21.78  #°C
-      // Luftfeuchte = 50.5   # %
-      //////////////////////////////////////////////////////////////////////////
-      // Simulation Parametr
-      //////////////////////////////////////////////////////////////////////////
-      double Re = 1e6; // 1133333.3333333335;
-      double rhoLB = 0.0;
-      double uLB = 0.1;
-      double lReal = 1000; //Plattenlänge in mm
-      double nuLB = (uLB*(lReal / cdx)) / Re;
-
-      int sizeSP = 4;
-      mu::Parser spongeLayer;
-      spongeLayer.SetExpr("x1>=(sizeX-sizeSP)/dx ? (sizeX-(x1+1))/sizeSP/2.0 + 0.5 : 1.0");
-      spongeLayer.DefineConst("sizeX", nx[0] * blocknx[0]);
-      spongeLayer.DefineConst("sizeSP", sizeSP*blocknx[0]);
-
-      Grid3DPtr ogrid(new Grid3D(comm));
-
-      //////////////////////////////////////////////////////////////////////////
-      //restart
-      UbSchedulerPtr rSch(new UbScheduler(1000, 1000, 10000000));
-      rSch->addSchedule(100, 47000, 47100);
-      RestartPostprocessor rp(ogrid, rSch, comm, pathname, RestartPostprocessor::BINARY);
-      //////////////////////////////////////////////////////////////////////////
-      bool restart;
-
-      if (firststart)
-      {
-
-         if (myid == 0) UBLOG(logINFO, "Neustart..");
-         restart = false;
-       
-         Grid3DPtr ngrid(new Grid3D(comm));
-         //////////////////////////////////////////////////////////////////////////
-         //Platte
-         GbTriFaceMesh3DPtr plate(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(PlatteFilename, "Netz"));
-         if (myid == 0) GbSystem3D::writeGeoObject(plate.get(), pathname + "/geo/platte", WbWriterVtkXmlBinary::getInstance());
-         //////////////////////////////////////////////////////////////////////////
-         // Zackenband
-         //////////////////////////////////////////////////////////////////////////
-         GbTriFaceMesh3DPtr meshBand1(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "NetzBand"));
-         meshBand1->translate(5.0, -2.86, -14.717);
-         meshBand1->rotate(0.0, -0.5, 0.0);
-         if (myid == 0) GbSystem3D::writeGeoObject(meshBand1.get(), pathname + "/geo/Band1", WbWriterVtkXmlASCII::getInstance());
-         // Zackenband2
-         GbTriFaceMesh3DPtr meshBand2(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "NetzBand2"));
-         meshBand2->translate(5.0, -7.86, -14.717);
-         meshBand2->rotate(0.0, -0.5, 0.0);
-         if (myid == 0) GbSystem3D::writeGeoObject(meshBand2.get(), pathname + "/geo/Band2", WbWriterVtkXmlASCII::getInstance());
-         // Zackenband3
-         GbTriFaceMesh3DPtr meshBand3(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "NetzBand3"));
-         meshBand3->translate(5.0, -2.86, -14.417); //+0.3
-         meshBand3->rotate(0.0, -0.5, 0.0);
-         if (myid == 0) GbSystem3D::writeGeoObject(meshBand3.get(), pathname + "/geo/Band3", WbWriterVtkXmlASCII::getInstance());
-         // Zackenband4
-         GbTriFaceMesh3DPtr meshBand4(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "NetzBand4"));
-         meshBand4->translate(5.0, -7.86, -14.417);
-         meshBand4->rotate(0.0, -0.5, 0.0);
-         if (myid == 0) GbSystem3D::writeGeoObject(meshBand4.get(), pathname + "/geo/Band4", WbWriterVtkXmlASCII::getInstance());
-         //////////////////////////////////////////////////////////////////////////
-
-         double blockLengthx1 = blocknx[0] * cdx; //geowerte
-         double blockLengthx2 = blockLengthx1;
-         double blockLengthx3 = blockLengthx1;
-
-         double geoLength[] = { nx[0] * blockLengthx1, nx[1] * blockLengthx2, nx[2] * blockLengthx3 };
-
-         double originX1 = plate->getX1Minimum() - plate->getLengthX1() / 4.0;
-         double originX2 = plate->getX2Minimum();
-         double originX3 = plate->getX3Minimum() - 299.5;
-
-
-         bool periodicx1 = false;
-         bool periodicx2 = true;
-         bool periodicx3 = false;
-
-         //bounding box
-         double g_minX1 = originX1;
-         double g_minX2 = originX2;
-         double g_minX3 = originX3;
-
-         double g_maxX1 = originX1 + geoLength[0];
-         double g_maxX2 = originX2 + geoLength[1];
-         double g_maxX3 = originX3 + geoLength[2];;
-
-
-         //set grid
-         ngrid->setDeltaX(cdx);
-         ngrid->setBlockNX(blocknx[0], blocknx[1], blocknx[2]);
-         ngrid->setPeriodicX1(periodicx1);
-         ngrid->setPeriodicX2(periodicx2);
-         ngrid->setPeriodicX3(periodicx3);
-
-         GbObject3DPtr gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
-         gridCube->setCenterCoordinates(gridCube->getX1Centroid(), meshBand1->getX2Centroid(), gridCube->getX3Centroid());
-         if (myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), pathname + "/geo/gridCube", WbWriterVtkXmlASCII::getInstance());
-
-         originX2 = gridCube->getX2Minimum();
-         g_minX2 = originX2;
-         g_maxX2 = originX2 + geoLength[1];
-
-         //Grid3DPtr hgrid(ngrid);
-
-         GenBlocksGridVisitor genBlocks(gridCube);
-         ngrid->accept(genBlocks);
-
-         //hgrid->setCoordinateTransformator(ngrid->getCoordinateTransformator());
-
-
-         //////////////////////////////////////////////////////////////////////////
-         if (myid == 0)
-         {
-            UBLOG(logINFO, "*****************************************");
-            UBLOG(logINFO, "* Parameters                            *");
-            UBLOG(logINFO, "* Re            =" << Re);
-            UBLOG(logINFO, "* nuLB          =" << nuLB);
-            UBLOG(logINFO, "* uLB           =" << uLB);
-            UBLOG(logINFO, "* cdx           =" << cdx);
-            UBLOG(logINFO, "* fdx           =" << fdx);
-            double Hzb = 0.6 / fdx;
-            UBLOG(logINFO, "* Height of Zackenband =" << Hzb);
-            UBLOG(logINFO, "* Re on Zackenband =" << (uLB*Hzb) / (nuLB*double(1 << refineLevel)));
-            UBLOG(logINFO, "* nx1/2/3       =" << nx[0] << "/" << nx[1] << "/" << nx[2]);
-            UBLOG(logINFO, "* blocknx1/2/3  =" << blocknx[0] << "/" << blocknx[1] << "/" << blocknx[2]);
-            UBLOG(logINFO, "* x1Periodic    =" << periodicx1);
-            UBLOG(logINFO, "* x2Periodic    =" << periodicx2);
-            UBLOG(logINFO, "* x3Periodic    =" << periodicx3);
-            UBLOG(logINFO, "* number of levels  =" << refineLevel + 1);
-            UBLOG(logINFO, "* path          =" << pathname);
-
-            UBLOG(logINFO, "*****************************************");
-            UBLOG(logINFO, "* number of threads    =" << numOfThreads);
-            UBLOG(logINFO, "* number of processes  =" << comm->getNumberOfProcesses());
-            UBLOG(logINFO, "*****************************************");
-            UBLOG(logINFO, "*****************************************");
-         }
-         //////////////////////////////////////////////////////////////////////////
-
-
-         //////////////////////////////////////////////////////////////////////////
-         //refinement
-         GbCuboid3DPtr refinePlatteBox(new GbCuboid3D(plate->getX1Minimum() - 1.0, plate->getX2Minimum(), plate->getX3Minimum() + (plate->getX3Maximum() - plate->getX3Minimum()) / 2.0,
-            plate->getX1Maximum() + 40.0, plate->getX2Maximum(), plate->getX3Maximum() + 2.0));
-         if (myid == 0) GbSystem3D::writeGeoObject(refinePlatteBox.get(), pathname + "/geo/refinePlatteBox", WbWriterVtkXmlASCII::getInstance());
-
-         //inlay patch
-         GbCuboid3DPtr refineInlayBox(new GbCuboid3D(plate->getX1Maximum() - 104.0, plate->getX2Minimum(), plate->getX3Minimum() + (plate->getX3Maximum() - plate->getX3Minimum()) / 2.0,
-            plate->getX1Maximum() + 1.0, plate->getX2Maximum(), plate->getX3Maximum() + 1.0));
-         if (myid == 0) GbSystem3D::writeGeoObject(refineInlayBox.get(), pathname + "/geo/refineInlayBox", WbWriterVtkXmlASCII::getInstance());
-
-         if (refineLevel > 0)
-         {
-            if (myid == 0) UBLOG(logINFO, "Refinement - start");
-            RefineCrossAndInsideGbObjectHelper refineHelper(ngrid, refineLevel);
-            refineHelper.addGbObject(refinePlatteBox, refineLevel - 1);
-            refineHelper.addGbObject(refineInlayBox, refineLevel);
-
-            refineHelper.refine();
-            if (myid == 0) UBLOG(logINFO, "Refinement - end");
-         }
-
-         if (myid == 0)
-         {
-            UBLOG(logINFO, "Write blocks - start");
-            BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(ngrid, UbSchedulerPtr(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm));
-            ppblocks->update(ppblockc++);
-            UBLOG(logINFO, "Write blocks - end");
-         }
-
-
-
-         {
-
-            ////walls
-            GbCuboid3DPtr addWallZmin(new GbCuboid3D(g_minX1 - blockLengthx1, g_minX2 - blockLengthx1, g_minX3 - blockLengthx1, g_maxX1 + blockLengthx1, g_maxX2 + blockLengthx1, g_minX3));
-            if (myid == 0) GbSystem3D::writeGeoObject(addWallZmin.get(), pathname + "/geo/addWallZmin", WbWriterVtkXmlASCII::getInstance());
-
-            GbCuboid3DPtr addWallZmax(new GbCuboid3D(g_minX1 - blockLengthx1, g_minX2 - blockLengthx1, g_maxX3, g_maxX1 + blockLengthx1, g_maxX2 + blockLengthx1, g_maxX3 + blockLengthx1));
-            if (myid == 0) GbSystem3D::writeGeoObject(addWallZmax.get(), pathname + "/geo/addWallZmax", WbWriterVtkXmlASCII::getInstance());
-
-            //walls
-            int bbOption = 1; //0=simple Bounce Back, 1=quadr. BB
-            D3Q27BoundaryConditionAdapterPtr slip(new D3Q27SlipBCAdapter(bbOption));
-            D3Q27InteractorPtr addWallZminInt(new D3Q27Interactor(addWallZmin, ngrid, slip, Interactor3D::SOLID));
-            D3Q27InteractorPtr addWallZmaxInt(new D3Q27Interactor(addWallZmax, ngrid, slip, Interactor3D::SOLID));
-
-            /////////////////////////////////////////////////
-            ///interactoren
-            int bbOption1 = 1; //0=simple Bounce Back, 1=quadr. BB
-            D3Q27BoundaryConditionAdapterPtr noSlip(new D3Q27NoSlipBCAdapter(bbOption1));
-            //D3Q27TriFaceMeshInteractorPtr triPlateInteractor(new D3Q27TriFaceMeshInteractor(plate, ngrid, noSlip, Interactor3D::SOLID, Interactor3D::POINTS));
-            D3Q27TriFaceMeshInteractorPtr triPlateInteractor(new D3Q27TriFaceMeshInteractor(plate, ngrid, noSlip, Interactor3D::SOLID, Interactor3D::SIMPLE));
-            D3Q27TriFaceMeshInteractorPtr triBand1Interactor(new D3Q27TriFaceMeshInteractor(meshBand1, ngrid, noSlip, Interactor3D::SOLID, Interactor3D::EDGES));
-            D3Q27TriFaceMeshInteractorPtr triBand2Interactor(new D3Q27TriFaceMeshInteractor(meshBand2, ngrid, noSlip, Interactor3D::SOLID, Interactor3D::EDGES));
-            D3Q27TriFaceMeshInteractorPtr triBand3Interactor(new D3Q27TriFaceMeshInteractor(meshBand3, ngrid, noSlip, Interactor3D::SOLID, Interactor3D::EDGES));
-            D3Q27TriFaceMeshInteractorPtr triBand4Interactor(new D3Q27TriFaceMeshInteractor(meshBand4, ngrid, noSlip, Interactor3D::SOLID, Interactor3D::EDGES));
-
-            //inflow
-            GbCuboid3DPtr velBCCuboid(new GbCuboid3D(originX1 - blockLengthx1, originX2 - blockLengthx1, originX3 - blockLengthx1,
-               originX1, originX2 + geoLength[1] + blockLengthx1, originX3 + geoLength[2] + blockLengthx1));
-            if (myid == 0) GbSystem3D::writeGeoObject(velBCCuboid.get(), pathname + "/geo/velBCCuboid", WbWriterVtkXmlASCII::getInstance());
-            D3Q27InteractorPtr velBCInteractor(new D3Q27Interactor(velBCCuboid, ngrid, Interactor3D::SOLID));
-
-            //inflow
-            double raiseVelSteps = 0;
-            vector<D3Q27BCFunction> velcX1BCs, dummy;
-
-            mu::Parser inflowProfile;
-            inflowProfile.SetExpr("uLB");
-            inflowProfile.DefineConst("uLB", uLB);
-            velcX1BCs.push_back(D3Q27BCFunction(inflowProfile, raiseVelSteps, D3Q27BCFunction::INFCONST));
-
-            D3Q27BoundaryConditionAdapterPtr velBCAdapter(new D3Q27VelocityBCAdapter(velcX1BCs, dummy, dummy));
-            velBCInteractor->addBCAdapter(velBCAdapter);
-
-            //outflow
-            GbCuboid3DPtr densCuboid(new GbCuboid3D(originX1 + geoLength[0], originX2 - blockLengthx1, originX3 - blockLengthx1,
-               originX1 + geoLength[0] + blockLengthx1, originX2 + geoLength[1] + blockLengthx1, originX3 + geoLength[2] + blockLengthx1));
-            if (myid == 0) GbSystem3D::writeGeoObject(densCuboid.get(), pathname + "/geo/densCuboid", WbWriterVtkXmlASCII::getInstance());
-            D3Q27BoundaryConditionAdapterPtr denBCAdapter(new D3Q27DensityBCAdapter(rhoLB));
-            D3Q27InteractorPtr densInteractor(new D3Q27Interactor(densCuboid, ngrid, denBCAdapter, Interactor3D::SOLID));
-
- 
-            ///////////////////////////////////////////////////
-            if (myid == 0) UBLOG(logINFO, "deleteExistBlocks - start");
-            deleteExistBlocks(ngrid, ogrid);
-            if (myid == 0) UBLOG(logINFO, "deleteExistBlocks - end");
-
-            if (myid == 0)
-            {
-               UBLOG(logINFO, "Write blocks - start");
-               BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(ngrid, UbSchedulerPtr(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm));
-               ppblocks->update(ppblockc++);
-               UBLOG(logINFO, "Write blocks - end");
-            }
-
-            ////////////////////////////////////////////
-            //METIS
-            Grid3DVisitorPtr metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B));
-
-            ////////////////////////////////////////////
-            /////delete solid blocks
-            if (myid == 0) UBLOG(logINFO, "deleteSolidBlocks - start");
-            InteractorsHelper intHelper(ngrid, metisVisitor);
-            intHelper.addInteractor(triPlateInteractor);
-            intHelper.addInteractor(triBand1Interactor);
-            intHelper.addInteractor(triBand2Interactor);
-            intHelper.addInteractor(triBand3Interactor);
-            intHelper.addInteractor(triBand4Interactor);
-            intHelper.addInteractor(addWallZminInt);
-            intHelper.addInteractor(addWallZmaxInt);
-            intHelper.addInteractor(densInteractor);
-            intHelper.addInteractor(velBCInteractor);
-            intHelper.selectBlocks();
-            if (myid == 0) UBLOG(logINFO, "deleteSolidBlocks - end");
-            //////////////////////////////////////
-            if (myid == 0)
-            {
-               UBLOG(logINFO, "Write blocks - start");
-               BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(ngrid, UbSchedulerPtr(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm));
-               ppblocks->update(ppblockc++);
-               UBLOG(logINFO, "Write blocks - end");
-            }
-            ////////////////////////////////////////////////////////
-
-            //addExistBlocks(ngrid, ogrid, hgrid);
-
-            ////////////////////////////////////////////////////////
-            unsigned long nob = ogrid->getNumberOfBlocks();
-            unsigned long nod = nob * blocknx[0] * blocknx[1] * blocknx[2];
-            unsigned long nod_real = nob * (blocknx[0] + 3)*(blocknx[1] + 3)*(blocknx[2] + 3);
-            unsigned long nodb = (blocknx[0]) * (blocknx[1]) * (blocknx[2]);
-
-            double needMemAll = double(nod_real*(27 * sizeof(double) + sizeof(int)));
-            double needMem = needMemAll / double(comm->getNumberOfProcesses());
-
-            double nup = 0;
-
-            if (myid == 0)
-            {
-               UBLOG(logINFO, "Number of blocks = " << nob);
-               UBLOG(logINFO, "Number of nodes  = " << nod);
-               int minInitLevel = ngrid->getCoarsestInitializedLevel();
-               int maxInitLevel = ngrid->getFinestInitializedLevel();
-               for (int level = minInitLevel; level <= maxInitLevel; level++)
-               {
-                  int nobl = ngrid->getNumberOfBlocks(level);
-                  UBLOG(logINFO, "Number of blocks for level " << level << " = " << nobl);
-                  UBLOG(logINFO, "Number of nodes for level " << level << " = " << nobl*nodb);
-                  nup += nobl*nodb*double(1 << level);
-               }
-               UBLOG(logINFO, "Hypothetically time for calculation step for 120 nodes  = " << nup / 6.0e5 / (120 * 8) << " s");
-               UBLOG(logINFO, "Necessary memory  = " << needMemAll << " bytes");
-               UBLOG(logINFO, "Necessary memory per process = " << needMem << " bytes");
-               UBLOG(logINFO, "Available memory per process = " << availMem << " bytes");
-               UBLOG(logINFO, "Available memory per node/8.0 = " << (availMem / 8.0) << " bytes");
-            }
-
-
-            //deleteNotExistBlocks(ngrid, ogrid);
-
-            //deleteExistBlocks(ngrid, ogrid);
-
-            //set kernel for new blocks
-            //////////////////////////////
-            LBMKernel3DPtr kernel;
-            //with sponge layer
-            kernel = LBMKernel3DPtr(new LBMKernelETD3Q27CCLBWithSpongeLayer(blocknx[0], blocknx[1], blocknx[2], LBMKernelETD3Q27CCLB::NORMAL));
-            kernel->setWithSpongeLayer(true);
-            kernel->setSpongeLayer(spongeLayer);
-
-            BCProcessorPtr bcProc(new D3Q27ETForThinWallBCProcessor());
-            kernel->setBCProcessor(bcProc);
-
-            //setKernel(ogrid, kernel, nuLB);
-
-            SetKernelBlockVisitor kernelVisitor(kernel, nuLB, availMem, needMem);
-            ngrid->accept(kernelVisitor);
-            //////////////////////////////////
-
-            //initialization of decompositions
-            D3Q27ETInitDistributionsBlockVisitor initVisitor(nuLB, rhoLB);
-            //double aVuLB = 0.1;
-            initVisitor.setVx1(uLB);
-            ngrid->accept(initVisitor);
-
-            int maxblock = Block3D::getMaxGlobalID();
-            if (myid == 0) UBLOG(logINFO, "maxblock = " << maxblock);
-
-            reindexBlocks(ngrid);
-
-            moveBlocks(ngrid, ogrid);
-
-            setInterpolationFlag(ogrid);
-
-            removeBCInformation(ogrid);
-
-            //set connectors
-            D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
-            D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
-            ogrid->accept(setConnsVisitor);
-
-            ////////////////////////////////////
-            ////undef nodes
-            if (refineLevel > 0)
-            {
-               D3Q27SetUndefinedNodesBlockVisitor undefNodesVisitor;
-               ogrid->accept(undefNodesVisitor);
-            }
-
-
-            D3Q27InteractorPtr addWallZminInt1(new D3Q27Interactor(addWallZmin, ogrid, slip, Interactor3D::SOLID));
-            D3Q27InteractorPtr addWallZmaxInt1(new D3Q27Interactor(addWallZmax, ogrid, slip, Interactor3D::SOLID));
-            D3Q27TriFaceMeshInteractorPtr triPlateInteractor1(new D3Q27TriFaceMeshInteractor(plate, ogrid, noSlip, Interactor3D::SOLID, Interactor3D::SIMPLE));
-            D3Q27TriFaceMeshInteractorPtr triBand1Interactor1(new D3Q27TriFaceMeshInteractor(meshBand1, ogrid, noSlip, Interactor3D::SOLID, Interactor3D::EDGES));
-            D3Q27TriFaceMeshInteractorPtr triBand2Interactor1(new D3Q27TriFaceMeshInteractor(meshBand2, ogrid, noSlip, Interactor3D::SOLID, Interactor3D::EDGES));
-            D3Q27TriFaceMeshInteractorPtr triBand3Interactor1(new D3Q27TriFaceMeshInteractor(meshBand3, ogrid, noSlip, Interactor3D::SOLID, Interactor3D::EDGES));
-            D3Q27TriFaceMeshInteractorPtr triBand4Interactor1(new D3Q27TriFaceMeshInteractor(meshBand4, ogrid, noSlip, Interactor3D::SOLID, Interactor3D::EDGES));
-            D3Q27InteractorPtr velBCInteractor1(new D3Q27Interactor(velBCCuboid, ogrid, Interactor3D::SOLID));
-            velBCInteractor1->addBCAdapter(velBCAdapter);
-            D3Q27InteractorPtr densInteractor1(new D3Q27Interactor(densCuboid, ogrid, denBCAdapter, Interactor3D::SOLID));
-
-            {SetSolidOrTransBlockVisitor v2(addWallZminInt1, SetSolidOrTransBlockVisitor::TRANS);
-            ogrid->accept(v2); }
-            {SetSolidOrTransBlockVisitor v2(addWallZmaxInt1, SetSolidOrTransBlockVisitor::TRANS);
-            ogrid->accept(v2); }
-            {SetSolidOrTransBlockVisitor v2(triPlateInteractor1, SetSolidOrTransBlockVisitor::TRANS);
-            ogrid->accept(v2); }
-            {SetSolidOrTransBlockVisitor v2(triBand1Interactor1, SetSolidOrTransBlockVisitor::TRANS);
-            ogrid->accept(v2); }
-            {SetSolidOrTransBlockVisitor v2(triBand2Interactor1, SetSolidOrTransBlockVisitor::TRANS);
-            ogrid->accept(v2); }
-            {SetSolidOrTransBlockVisitor v2(triBand3Interactor1, SetSolidOrTransBlockVisitor::TRANS);
-            ogrid->accept(v2); }
-            {SetSolidOrTransBlockVisitor v2(triBand4Interactor1, SetSolidOrTransBlockVisitor::TRANS);
-            ogrid->accept(v2); }
-            {SetSolidOrTransBlockVisitor v2(velBCInteractor1, SetSolidOrTransBlockVisitor::TRANS);
-            ogrid->accept(v2); }
-            {SetSolidOrTransBlockVisitor v2(densInteractor1, SetSolidOrTransBlockVisitor::TRANS);
-            ogrid->accept(v2); }
-
-            addWallZminInt1->initInteractor();
-            addWallZmaxInt1->initInteractor();
-            triPlateInteractor1->initInteractor();
-            triBand1Interactor1->initInteractor();
-            triBand2Interactor1->initInteractor();
-            triBand3Interactor1->initInteractor();
-            triBand4Interactor1->initInteractor();
-            velBCInteractor1->initInteractor();
-            densInteractor1->initInteractor();
-
-
-            //intHelper.setBC();
-         }
-         if (myid == 0)
-         {
-            UBLOG(logINFO, "Write blocks - start");
-            BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(ogrid, UbSchedulerPtr(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm));
-            ppblocks->update(ppblockc++);
-            UBLOG(logINFO, "Write blocks - end");
-         }
-
-         {
-            UbSchedulerPtr geoSch(new UbScheduler(1));
-            D3Q27MacroscopicQuantitiesPostprocessorPtr ppgeo(
-               new D3Q27MacroscopicQuantitiesPostprocessor(ogrid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(),
-               unitConverter, true));
-            ppgeo->update(0);
-            ppgeo.reset();
-            geoSch.reset();
-         }
-
-         //////////////////////////////////////////////////////////////////////////
-         //porous inlay
-         {
-            string pmFilename = pathGeo + "/CT-2014-039.raw";
-            int pmNX1 = 1333;  //abmessung einzelbild in x-richtung
-            int pmNX2 = 463; //abmessung einzelbild in y richtung
-            int pmNX3 = 1333; //anzahl der bilder
-            float lthreshold = 27686.97;
-            float uthreshold = 65535.0;
-
-            GbVoxelMatrix3DPtr pmMesh(new GbVoxelMatrix3D(pmNX1, pmNX2, pmNX3, 0, lthreshold, uthreshold));
-            pmMesh->readMatrixFromRawFile<unsigned short>(pmFilename, GbVoxelMatrix3D::LittleEndian);
-
-            double scaleFactor = 0.001;
-            double delta = 3.75*scaleFactor;
-            pmMesh->setVoxelMatrixDelta(delta, delta, delta);
-            pmMesh->rotate90aroundX();
-            pmMesh->rotate90aroundX();
-            pmMesh->rotate90aroundX();
-
-            double inlayXmin = plate->getX1Maximum() - 5.0;//995.0;
-            double inlayYmin = gridCube->getX2Minimum();//180.0;
-            double inlayZmin = 8.84 + fdx;//8.73;
-
-            //pmMesh->setVoxelMatrixMininum(inlayXmin, inlayYmin, inlayZmin);
-            //if(myid == 0) pmMesh->writeToLegacyVTKBinary(pathname+"/geo/pmMesh");
-
-            int i = 0;
-            for (int y = 0; y < 40; y += 10)
-               for (int x = 0; x < 100; x += 10)
-               {
-                  if (myid == 0) UBLOG(logINFO, "inlay # " << i);
-                  pmMesh->setVoxelMatrixMininum(inlayXmin - (double)x, inlayYmin + (double)y, inlayZmin);
-                  inlay(pmMesh, pathname, myid, i, ogrid);
-                  i++;
-
-                  if (myid == 0) UBLOG(logINFO, "inlay # " << i);
-                  pmMesh->setVoxelMatrixMininum(inlayXmin - (double)(x + 5), inlayYmin + (double)y, inlayZmin);
-                  pmMesh->mirrorX();
-                  inlay(pmMesh, pathname, myid, i, ogrid);
-                  i++;
-
-                  if (myid == 0) UBLOG(logINFO, "inlay # " << i);
-                  pmMesh->setVoxelMatrixMininum(inlayXmin - (double)(x + 5), inlayYmin + (double)(y + 5), inlayZmin);
-                  pmMesh->mirrorY();
-                  inlay(pmMesh, pathname, myid, i, ogrid);
-                  i++;
-
-                  if (myid == 0) UBLOG(logINFO, "inlay # " << i);
-                  pmMesh->setVoxelMatrixMininum(inlayXmin - (double)x, inlayYmin + (double)(y + 5), inlayZmin);
-                  pmMesh->mirrorX();
-                  inlay(pmMesh, pathname, myid, i, ogrid);
-                  pmMesh->mirrorY();
-                  i++;
-               }
-
-            if (myid == 0)
-            {
-               UBLOG(logINFO, "mit VoxelMatrix");
-               UBLOG(logINFO, "PID = " << myid << " Total Physical Memory (RAM): " << Utilities::getTotalPhysMem());
-               UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used: " << Utilities::getPhysMemUsed());
-               UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe());
-            }
-         }
-         //////////////////////////////////////////////////////////////////////////
-
-         if (myid == 0)
-         {
-            UBLOG(logINFO, "Write blocks - start");
-            BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(ogrid, UbSchedulerPtr(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm));
-            ppblocks->update(ppblockc++);
-            UBLOG(logINFO, "Write blocks - end");
-         }
-
-         ////initialization of decompositions
-         //D3Q27ETInitDistributionsBlockVisitor initVisitor(nuLB, rhoLB);
-         ////initVisitor.setVx1(uLB);
-         //hgrid->accept(initVisitor);
-
-         
-         //Postprozess
-         UbSchedulerPtr geoSch(new UbScheduler(1));
-         D3Q27MacroscopicQuantitiesPostprocessorPtr ppgeo(
-            new D3Q27MacroscopicQuantitiesPostprocessor(ogrid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(),
-            unitConverter, true));
-         ppgeo->update(1);
-         ppgeo.reset();
-         geoSch.reset();
-
-         if (myid == 0)
-         {
-            UBLOG(logINFO, "Write blocks - start");
-            BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(ogrid, UbSchedulerPtr(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm));
-            ppblocks->update(ppblockc++);
-            UBLOG(logINFO, "Write blocks - end");
-         }
-
-
-         //domain decomposition for threads
-         if (numOfThreads > 1)
-         {
-            PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
-            ogrid->accept(pqPartVisitor);
-         }
-
-         SetSpongeLayerBlockVisitor ssp(spongeLayer);
-         ogrid->accept(ssp);
-         if (myid == 0) UBLOG(logINFO, "Restart - end");
-
-         if (myid == 0) UBLOG(logINFO, "Preprozess - end");
-      }
-      else
-      {
-         restart = true;
-
-         ////////////////////////////////////////////////////////////////////////////
-         //change viscosity
-         //Re = 1e6;
-         //nuLB = (uLB*(lReal / cdx)) / Re;
-         //if (myid == 0) UBLOG(logINFO, "nuLB =" << nuLB);
-
-         //int gridRank = grid->getRank();
-         //int minInitLevel = grid->getCoarsestInitializedLevel();
-         //int maxInitLevel = grid->getFinestInitializedLevel();
-
-         //std::vector<std::vector<Block3DPtr> > blockVector;
-         //blockVector.resize(maxInitLevel + 1);
-
-         //for (int level = minInitLevel; level <= maxInitLevel; level++)
-         //{
-         //   grid->getBlocks(level, gridRank, true, blockVector[level]);
-
-         //   BOOST_FOREACH(Block3DPtr block, blockVector[level])
-         //   {
-         //      LBMReal collFactor = LBMSystem::calcCollisionFactor(nuLB, block->getLevel());
-         //      block->getKernel()->setCollisionFactor(collFactor);
-         //   }
-         //}
-         ////////////////////////////////////////////////////////////////////////////
-
-         //domain decomposition for threads
-         if (numOfThreads > 1)
-         {
-            PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
-            ogrid->accept(pqPartVisitor);
-         }
-         //set connectors
-         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
-         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
-         ogrid->accept(setConnsVisitor);
-         SetSpongeLayerBlockVisitor ssp(spongeLayer);
-         ogrid->accept(ssp);
-         if (myid == 0) UBLOG(logINFO, "Restart - end");
-      }
-      UbSchedulerPtr visSch(new UbScheduler());
-      //visSch->addSchedule(1,0,10);
-      visSch->addSchedule(100, 100, 1000);
-      //visSch->addSchedule(1000,1000,5000);
-      //visSch->addSchedule(5000,5000,100000);
-      //visSch->addSchedule(100000,100000,10000000);
-
-      visSch->addSchedule(1000, 1000, 10000000);
-      visSch->addSchedule(1, 47100, 47100);
-
-      D3Q27MacroscopicQuantitiesPostprocessor pp(ogrid, visSch, pathname, WbWriterVtkXmlBinary::getInstance(), unitConverter);
-
-      double startStep = 47000;
-      double startStep2= 47500;
-
-      if(ogrid->getTimeStep() >= startStep2) startStep = startStep2;
-
-      UbSchedulerPtr resSchRMS(new UbScheduler());
-      resSchRMS->addSchedule(1000000, startStep, 10000000);
-      resSchRMS->addSchedule(1000000, startStep2, 10000000);
-      UbSchedulerPtr resSchMeans(new UbScheduler());
-      resSchMeans->addSchedule(1000000, startStep, 10000000);
-      resSchMeans->addSchedule(1000000, startStep2, 10000000);
-      UbSchedulerPtr stepAvSch(new UbScheduler());
-      int averageInterval = 100;
-
-      stepAvSch->addSchedule(averageInterval, 0, 10000000);
-      AverageValuesPostprocessor Avpp(ogrid, pathname, WbWriterVtkXmlBinary::getInstance(), visSch/*wann wird rausgeschrieben*/,
-         stepAvSch/*wann wird gemittelt*/, resSchMeans, resSchRMS/*wann wird resettet*/, restart);
-
-      UbSchedulerPtr nupsSch(new UbScheduler(10, 10, 30));
-      nupsSch->addSchedule(500, 500, 1e6);
-      NUPSCounterPostprocessor npr(ogrid, nupsSch, numOfThreads, comm);
-
-      UbSchedulerPtr emSch(new UbScheduler(10));
-      EmergencyExitPostprocessor empr(ogrid, emSch, pathname, RestartPostprocessorPtr(&rp), comm);
-
-      if (myid == 0)
-      {
-         UBLOG(logINFO, "PID = " << myid << " Total Physical Memory (RAM): " << Utilities::getTotalPhysMem());
-         UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used: " << Utilities::getPhysMemUsed());
-         UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe());
-      }
-
-      double endTime = 100000001;
-      CalculationManagerPtr calculation(new CalculationManager(ogrid, numOfThreads, endTime, visSch));
-      if (myid == 0) UBLOG(logINFO, "Simulation-start");
-      calculation->calculate();
-      if (myid == 0) UBLOG(logINFO, "Simulation-end");
-   }
-   catch (std::exception& e)
-   {
-      cerr << e.what() << endl << flush;
-   }
-   catch (std::string& s)
-   {
-      cerr << s << endl;
-   }
-   catch (...)
-   {
-      cerr << "unknown exception" << endl;
-   }
-
-}
-//////////////////////////////////////////////////////////////////////////
-int main(int argc, char* argv[])
-{
-   if (argc == 1)
-   {
-      cout << "Command line argument isn't specified!" << endl;
-      cout << "plate2 <machine name>" << endl;
-      return 1;
-   }
-   run(argv[1], true);
-
-   return 0;
-}
-
+
+
+#include <iostream>
+#include <string>
+#include <math.h> 
+
+#include <vfluids.h>
+
+using namespace std;
+
+//////////////////////////////////////////////////////////////////////////
+void inlay(GbVoxelMatrix3DPtr pmMesh, string& pathname, int myid, int i, Grid3DPtr grid)
+{
+   int bbOptionPM = 2; //quadratic bounce back with for thin walls
+   D3Q27BoundaryConditionAdapterPtr noSlipPM(new D3Q27NoSlipBCAdapter(bbOptionPM));
+   D3Q27InteractorPtr inlayInt = D3Q27InteractorPtr(new D3Q27Interactor(pmMesh, grid, noSlipPM, Interactor3D::SOLID));
+
+   GbCuboid3DPtr inlayBox(new GbCuboid3D(pmMesh->getX1Minimum(), pmMesh->getX2Minimum(), pmMesh->getX3Minimum(), pmMesh->getX1Maximum(), pmMesh->getX2Maximum(), pmMesh->getX3Maximum()));
+   if (myid == 0) GbSystem3D::writeGeoObject(inlayBox.get(), pathname + "/geo/inlay" + UbSystem::toString(i), WbWriterVtkXmlASCII::getInstance());
+   D3Q27InteractorPtr inlayBoxInt = D3Q27InteractorPtr(new D3Q27Interactor(inlayBox, grid, noSlipPM, Interactor3D::SOLID));
+   SetSolidOrTransBlockVisitor v1(inlayBoxInt, SetSolidOrTransBlockVisitor::SOLID);
+   grid->accept(v1);
+   SetSolidOrTransBlockVisitor v2(inlayBoxInt, SetSolidOrTransBlockVisitor::TRANS);
+   grid->accept(v2);
+
+   vector<Block3DPtr> inlayBlocks;
+   vector<Block3DPtr>& sb = inlayBoxInt->getSolidBlockSet();
+   if (myid == 0) UBLOG(logINFO, "sb.size = " << sb.size());
+   inlayBlocks.insert(inlayBlocks.end(), sb.begin(), sb.end());
+   vector<Block3DPtr>& tb = inlayBoxInt->getTransBlockSet();
+   if (myid == 0) UBLOG(logINFO, "tb.size = " << tb.size());
+   inlayBlocks.insert(inlayBlocks.end(), tb.begin(), tb.end());
+
+   if (myid == 0) UBLOG(logINFO, "inlayBlocks.size = " << inlayBlocks.size());
+
+   BOOST_FOREACH(Block3DPtr block, inlayBlocks)
+   {
+      block->setActive(true);
+      inlayInt->setDifferencesToGbObject3D(block);
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+void deleteExistBlocks(Grid3DPtr ngrid, Grid3DPtr ogrid)
+{
+   int minInitLevel = ogrid->getCoarsestInitializedLevel();
+   int maxInitLevel = ogrid->getFinestInitializedLevel();
+
+   std::vector<std::vector<Block3DPtr> > blockVector;
+   blockVector.resize(maxInitLevel + 1);
+
+   std::vector<int> ids;
+
+   for (int level = minInitLevel; level <= maxInitLevel; level++)
+   {
+      ogrid->getBlocks(level, blockVector[level]);
+
+      BOOST_FOREACH(Block3DPtr block, blockVector[level])
+      {
+         int x1 = block->getX1();
+         int x2 = block->getX2();
+         int x3 = block->getX3();
+         Block3DPtr nblock = ngrid->getBlock(x1, x2, x3, level);
+         if (nblock)
+         {
+            ngrid->deleteBlock(x1, x2, x3, level);
+         }
+         else
+         {
+            ids.push_back(block->getGlobalID());
+         }
+      }
+   }
+
+   ogrid->deleteBlocks(ids);
+}
+//////////////////////////////////////////////////////////////////////////
+void reindexBlocks(Grid3DPtr ngrid)
+{
+   int minInitLevel = ngrid->getCoarsestInitializedLevel();
+   int maxInitLevel = ngrid->getFinestInitializedLevel();
+
+   std::vector<std::vector<Block3DPtr> > blockVector;
+   blockVector.resize(maxInitLevel + 1);
+
+   int maxID = Block3D::getMaxGlobalID();
+
+   for (int level = minInitLevel; level <= maxInitLevel; level++)
+   {
+      ngrid->getBlocks(level, blockVector[level]);
+
+      BOOST_FOREACH(Block3DPtr block, blockVector[level])
+      {
+         block->setGlobalID(++maxID);
+      }
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+void setInterpolationFlag(Grid3DPtr grid)
+{
+   int minInitLevel = grid->getCoarsestInitializedLevel();
+   int maxInitLevel = grid->getFinestInitializedLevel();
+
+   std::vector<std::vector<Block3DPtr> > blockVector;
+   blockVector.resize(maxInitLevel + 1);
+
+   int maxID = Block3D::getMaxGlobalID();
+
+   for (int level = minInitLevel; level <= maxInitLevel; level++)
+   {
+      grid->getBlocks(level, blockVector[level]);
+
+      BOOST_FOREACH(Block3DPtr block, blockVector[level])
+      {
+         block->deleteInterpolationFlag();
+      }
+   }
+
+   std::vector<int> dirs;
+
+   for (int i = D3Q27System::E; i <= D3Q27System::TS; i++)
+   {
+      dirs.push_back(i);
+   }
+   SetInterpolationDirsBlockVisitor interDirsVisitor(dirs);
+   grid->accept(interDirsVisitor);
+}
+//////////////////////////////////////////////////////////////////////////
+void addExistBlocks(Grid3DPtr ngrid, Grid3DPtr ogrid, Grid3DPtr hgrid)
+{
+   int minInitLevel = ngrid->getCoarsestInitializedLevel();
+   int maxInitLevel = ngrid->getFinestInitializedLevel();
+
+   std::vector<std::vector<Block3DPtr> > blockVector;
+   blockVector.resize(maxInitLevel + 1);
+
+   std::vector<Block3DPtr> db;
+
+   //int gridRank = ogrid->getRank();
+
+   for (int level = minInitLevel; level <= maxInitLevel; level++)
+   {
+      ngrid->getBlocks(level, blockVector[level]);
+
+      BOOST_FOREACH(Block3DPtr block, blockVector[level])
+      {
+         int x1 = block->getX1();
+         int x2 = block->getX2();
+         int x3 = block->getX3();
+         Block3DPtr oblock = ogrid->getBlock(x1, x2, x3, level);
+         if (oblock)
+         {
+            hgrid->addBlock(oblock);
+         }
+
+      }
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+void moveBlocks(Grid3DPtr ngrid, Grid3DPtr ogrid)
+{
+   int minInitLevel = ngrid->getCoarsestInitializedLevel();
+   int maxInitLevel = ngrid->getFinestInitializedLevel();
+
+   std::vector<std::vector<Block3DPtr> > blockVector;
+   blockVector.resize(maxInitLevel + 1);
+
+   for (int level = minInitLevel; level <= maxInitLevel; level++)
+   {
+      ngrid->getBlocks(level, blockVector[level]);
+
+      BOOST_FOREACH(Block3DPtr block, blockVector[level])
+      {
+         ogrid->addBlock(block);
+      }
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+void removeUndefNodes(Grid3DPtr grid)
+{
+   int minInitLevel = grid->getCoarsestInitializedLevel();
+   int maxInitLevel = grid->getFinestInitializedLevel();
+
+   std::vector<std::vector<Block3DPtr> > blockVector;
+   blockVector.resize(maxInitLevel + 1);
+
+   int gridRank = grid->getRank();
+
+   for (int level = minInitLevel; level <= maxInitLevel; level++)
+   {
+      grid->getBlocks(level, gridRank, true, blockVector[level]);
+
+      BOOST_FOREACH(Block3DPtr block, blockVector[level])
+      {
+         int gl = 0;
+
+         LBMKernel3DPtr kernel = block->getKernel();
+         BCArray3D<D3Q27BoundaryCondition>& bcMatrix = boost::dynamic_pointer_cast<D3Q27ETBCProcessor>(kernel->getBCProcessor())->getBCArray();
+
+         int minX1 = gl;
+         int minX2 = gl;
+         int minX3 = gl;
+
+         int maxX1 = static_cast<int>(bcMatrix.getNX1()) - 1 - gl;
+         int maxX2 = static_cast<int>(bcMatrix.getNX2()) - 1 - gl;
+         int maxX3 = static_cast<int>(bcMatrix.getNX3()) - 1 - gl;
+
+         minX1 = gl;
+         minX2 = gl;
+         minX3 = gl;
+
+         maxX1 = static_cast<int>(bcMatrix.getNX1()) - 1 - gl;
+         maxX2 = static_cast<int>(bcMatrix.getNX2()) - 1 - gl;
+         maxX3 = static_cast<int>(bcMatrix.getNX3()) - 1 - gl;
+
+         for (int ix3 = minX3; ix3 <= maxX3; ix3++)
+            for (int ix2 = minX2; ix2 <= maxX2; ix2++)
+               for (int ix1 = minX1; ix1 <= maxX3; ix1++)
+               {
+                  if (bcMatrix.isUndefined(ix1, ix2, ix3)) bcMatrix.setFluid(ix1, ix2, ix3);
+               }
+      }
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+void removeBCInformation(Grid3DPtr grid)
+{
+   int minInitLevel = grid->getCoarsestInitializedLevel();
+   int maxInitLevel = grid->getFinestInitializedLevel();
+
+   std::vector<std::vector<Block3DPtr> > blockVector;
+   blockVector.resize(maxInitLevel + 1);
+
+   int gridRank = grid->getRank();
+
+   for (int level = minInitLevel; level <= maxInitLevel; level++)
+   {
+      grid->getBlocks(level, gridRank, true, blockVector[level]);
+
+      BOOST_FOREACH(Block3DPtr block, blockVector[level])
+      {
+         int gl = 0;
+
+         LBMKernel3DPtr kernel = block->getKernel();
+         BCArray3D<D3Q27BoundaryCondition>& bcMatrix = boost::dynamic_pointer_cast<D3Q27ETBCProcessor>(kernel->getBCProcessor())->getBCArray();
+
+         int minX1 = gl;
+         int minX2 = gl;
+         int minX3 = gl;
+
+         int maxX1 = static_cast<int>(bcMatrix.getNX1()) - 1 - gl;
+         int maxX2 = static_cast<int>(bcMatrix.getNX2()) - 1 - gl;
+         int maxX3 = static_cast<int>(bcMatrix.getNX3()) - 1 - gl;
+
+         for (int ix3 = minX3; ix3 <= maxX3; ix3++)
+            for (int ix2 = minX2; ix2 <= maxX2; ix2++)
+               for (int ix1 = minX1; ix1 <= maxX3; ix1++)
+               {
+                  bcMatrix.setFluid(ix1, ix2, ix3);
+                  //bcMatrix.setBC(ix1, ix2, ix3, D3Q27BoundaryConditionPtr());
+               }
+
+   //      if (!block->getKernel())
+   //      {
+   //         if (block->getRank() == grid->getRank())
+   //         {
+   //            BCProcessorPtr bcProc(new D3Q27ETForThinWallBCProcessor());
+   //            block->getKernel()->setBCProcessor(bcProc);
+   //         }
+   //      }
+      }
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+void setKernel(Grid3DPtr grid, LBMKernel3DPtr kernel, double nu)
+{
+   int minInitLevel = grid->getCoarsestInitializedLevel();
+   int maxInitLevel = grid->getFinestInitializedLevel();
+
+   std::vector<std::vector<Block3DPtr> > blockVector;
+   blockVector.resize(maxInitLevel + 1);
+
+   int gridRank = grid->getRank();
+
+   for (int level = minInitLevel; level <= maxInitLevel; level++)
+   {
+      grid->getBlocks(level, gridRank, true, blockVector[level]);
+
+      BOOST_FOREACH(Block3DPtr block, blockVector[level])
+      {
+         if (!block->getKernel())
+         {
+            if (block->getRank() == grid->getRank())
+            {
+               LBMReal collFactor = LBMSystem::calcCollisionFactor(nu, block->getLevel());
+               kernel->setCollisionFactor(collFactor);
+               kernel->setIndex(block->getX1(), block->getX2(), block->getX3());
+               kernel->setDeltaT(LBMSystem::getDeltaT(block->getLevel()));
+               kernel->setBlock(block);
+               LBMKernel3DPtr newKernel = kernel->clone();
+               block->setKernel(newKernel);
+            }
+         }
+      }
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+void run(const char *cstr, bool firststart)
+{
+   try
+   {
+      string pathname;
+      string pathGeo;
+      string pathLog;
+      int numOfThreads = 1;
+      bool logfile = false;
+      stringstream logFilename;
+      double availMem = 0;
+
+      CommunicatorPtr comm = MPICommunicator::getInstance();
+      int myid = comm->getProcessID();
+
+      string machine = string(cstr);
+
+      if (machine == "my")
+      {
+         pathname = "d:/temp/porplate2";
+         pathGeo = "d:/Data/plate";
+         pathLog = pathname;
+         numOfThreads = 1;
+         logfile = false;
+         availMem = 15.0e9;
+      }
+      else if (machine == "Ludwig")
+      {
+         pathname = "/work/koskuche/SFB880/porplate2";
+         pathGeo = "/home/koskuche/data/plate";
+         pathLog = pathname;
+         numOfThreads = 8;
+         availMem = 12.0e9;///8*numOfThreads;
+         logfile = true;
+      }
+      else if (machine == "HLRS")
+      {
+         pathname = "/univ_1/ws1/ws/xrmkuchr-plate3-0";
+         pathGeo = "/zhome/academic/HLRS/xrm/xrmkuchr/data/plate";
+         pathLog = "/zhome/academic/HLRS/xrm/xrmkuchr/work/plate";
+         numOfThreads = 16;
+         availMem = 2.0e9;
+         logfile = true;
+      }
+      else if (machine == "HLRN")
+      {
+         pathname = "/gfs1/work/niivfcpu/scratch/plateEx";
+         pathGeo = "/gfs1/work/niivfcpu/data/plate";
+         pathLog = pathname;
+         numOfThreads = 24;
+         availMem = 64.0e9 / 24.0*numOfThreads;
+         logfile = true;
+      }
+      else throw UbException(UB_EXARGS, "unknown CAB_MACHINE");
+
+#if defined(__unix__)
+      if (myid==0) 
+      {
+         const char* str = pathLog.c_str();
+         int status=mkdir(str, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
+      }
+#endif 
+
+      if (myid == 0 && logfile)
+      {
+         //UbLog::reportingLevel() = logDEBUG5;
+         logFilename << pathLog + "/logfile" + UbSystem::toString(UbSystem::getTimeStamp()) + "_" + UbSystem::toString(myid) + ".txt";
+         UbLog::output_policy::setStream(logFilename.str());
+      }
+
+      if (myid == 0) UBLOG(logINFO, "Testcase plate");
+
+      string PlatteFilename = pathGeo + "/Platte_bearbeitet2_10cmA.stl";
+
+      string ZckbndFilename = pathGeo + "/2zackenbaender0.stl";
+
+      int ppblockc = 0;
+
+      ///////////////Knotenabmessungen:
+      int nx[3], blocknx[3];
+      nx[0] = 90;//240;//120;//60;//86;//43;//65;//50;  //länge
+      nx[1] = 2;//2;//6;///1;//5;// //breite
+      nx[2] = 30;//64;//32;//18;//5;//15;//15; //höhe gebiet
+      blocknx[0] = 16;//10;//6;
+      blocknx[1] = 16;//10;//6;
+      blocknx[2] = 16;//10;//6;
+
+      int baseLevel = 0;
+      int refineLevel = 5;
+
+      double H = 600.0; // Kanalhöhe [mm]
+      double cdx = H / (double)(nx[2] * blocknx[2]);
+      double fdx = cdx / double(1 << refineLevel);
+
+      //double h = 200.0; // gewünschte Plattenhöhe in Gitterpunkten
+      //double fdx = plate->getLengthX3()/h;
+      //double cdx = fdx*double(1<<refineLevel);
+
+      LBMUnitConverterPtr unitConverter = LBMUnitConverterPtr(new LBMUnitConverter());
+
+      //////////////////////////////////////////////////////////////////////////
+      // physik
+      //////////////////////////////////////////////////////////////////////////
+
+      //////////////////////////////////////////////////////////////////////////
+      // Experiment Parametr
+      // Re = 1000000
+      // V = 16.05  # m / s
+      // p = 994.7  #hPa(manuell abgelesen von MUB)
+      // T = 21.78  #°C
+      // Luftfeuchte = 50.5   # %
+      //////////////////////////////////////////////////////////////////////////
+      // Simulation Parametr
+      //////////////////////////////////////////////////////////////////////////
+      double Re = 1e6; // 1133333.3333333335;
+      double rhoLB = 0.0;
+      double uLB = 0.1;
+      double lReal = 1000; //Plattenlänge in mm
+      double nuLB = (uLB*(lReal / cdx)) / Re;
+
+      int sizeSP = 4;
+      mu::Parser spongeLayer;
+      spongeLayer.SetExpr("x1>=(sizeX-sizeSP)/dx ? (sizeX-(x1+1))/sizeSP/2.0 + 0.5 : 1.0");
+      spongeLayer.DefineConst("sizeX", nx[0] * blocknx[0]);
+      spongeLayer.DefineConst("sizeSP", sizeSP*blocknx[0]);
+
+      Grid3DPtr ogrid(new Grid3D(comm));
+
+      //////////////////////////////////////////////////////////////////////////
+      //restart
+      UbSchedulerPtr rSch(new UbScheduler(1000, 1000, 10000000));
+      rSch->addSchedule(100, 47000, 47100);
+      RestartPostprocessor rp(ogrid, rSch, comm, pathname, RestartPostprocessor::BINARY);
+      //////////////////////////////////////////////////////////////////////////
+      bool restart;
+
+      if (firststart)
+      {
+
+         if (myid == 0) UBLOG(logINFO, "Neustart..");
+         restart = false;
+       
+         Grid3DPtr ngrid(new Grid3D(comm));
+         //////////////////////////////////////////////////////////////////////////
+         //Platte
+         GbTriFaceMesh3DPtr plate(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(PlatteFilename, "Netz"));
+         if (myid == 0) GbSystem3D::writeGeoObject(plate.get(), pathname + "/geo/platte", WbWriterVtkXmlBinary::getInstance());
+         //////////////////////////////////////////////////////////////////////////
+         // Zackenband
+         //////////////////////////////////////////////////////////////////////////
+         GbTriFaceMesh3DPtr meshBand1(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "NetzBand"));
+         meshBand1->translate(5.0, -2.86, -14.717);
+         meshBand1->rotate(0.0, -0.5, 0.0);
+         if (myid == 0) GbSystem3D::writeGeoObject(meshBand1.get(), pathname + "/geo/Band1", WbWriterVtkXmlASCII::getInstance());
+         // Zackenband2
+         GbTriFaceMesh3DPtr meshBand2(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "NetzBand2"));
+         meshBand2->translate(5.0, -7.86, -14.717);
+         meshBand2->rotate(0.0, -0.5, 0.0);
+         if (myid == 0) GbSystem3D::writeGeoObject(meshBand2.get(), pathname + "/geo/Band2", WbWriterVtkXmlASCII::getInstance());
+         // Zackenband3
+         GbTriFaceMesh3DPtr meshBand3(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "NetzBand3"));
+         meshBand3->translate(5.0, -2.86, -14.417); //+0.3
+         meshBand3->rotate(0.0, -0.5, 0.0);
+         if (myid == 0) GbSystem3D::writeGeoObject(meshBand3.get(), pathname + "/geo/Band3", WbWriterVtkXmlASCII::getInstance());
+         // Zackenband4
+         GbTriFaceMesh3DPtr meshBand4(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "NetzBand4"));
+         meshBand4->translate(5.0, -7.86, -14.417);
+         meshBand4->rotate(0.0, -0.5, 0.0);
+         if (myid == 0) GbSystem3D::writeGeoObject(meshBand4.get(), pathname + "/geo/Band4", WbWriterVtkXmlASCII::getInstance());
+         //////////////////////////////////////////////////////////////////////////
+
+         double blockLengthx1 = blocknx[0] * cdx; //geowerte
+         double blockLengthx2 = blockLengthx1;
+         double blockLengthx3 = blockLengthx1;
+
+         double geoLength[] = { nx[0] * blockLengthx1, nx[1] * blockLengthx2, nx[2] * blockLengthx3 };
+
+         double originX1 = plate->getX1Minimum() - plate->getLengthX1() / 4.0;
+         double originX2 = plate->getX2Minimum();
+         double originX3 = plate->getX3Minimum() - 299.5;
+
+
+         bool periodicx1 = false;
+         bool periodicx2 = true;
+         bool periodicx3 = false;
+
+         //bounding box
+         double g_minX1 = originX1;
+         double g_minX2 = originX2;
+         double g_minX3 = originX3;
+
+         double g_maxX1 = originX1 + geoLength[0];
+         double g_maxX2 = originX2 + geoLength[1];
+         double g_maxX3 = originX3 + geoLength[2];;
+
+
+         //set grid
+         ngrid->setDeltaX(cdx);
+         ngrid->setBlockNX(blocknx[0], blocknx[1], blocknx[2]);
+         ngrid->setPeriodicX1(periodicx1);
+         ngrid->setPeriodicX2(periodicx2);
+         ngrid->setPeriodicX3(periodicx3);
+
+         GbObject3DPtr gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
+         gridCube->setCenterCoordinates(gridCube->getX1Centroid(), meshBand1->getX2Centroid(), gridCube->getX3Centroid());
+         if (myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), pathname + "/geo/gridCube", WbWriterVtkXmlASCII::getInstance());
+
+         originX2 = gridCube->getX2Minimum();
+         g_minX2 = originX2;
+         g_maxX2 = originX2 + geoLength[1];
+
+         //Grid3DPtr hgrid(ngrid);
+
+         GenBlocksGridVisitor genBlocks(gridCube);
+         ngrid->accept(genBlocks);
+
+         //hgrid->setCoordinateTransformator(ngrid->getCoordinateTransformator());
+
+
+         //////////////////////////////////////////////////////////////////////////
+         if (myid == 0)
+         {
+            UBLOG(logINFO, "*****************************************");
+            UBLOG(logINFO, "* Parameters                            *");
+            UBLOG(logINFO, "* Re            =" << Re);
+            UBLOG(logINFO, "* nuLB          =" << nuLB);
+            UBLOG(logINFO, "* uLB           =" << uLB);
+            UBLOG(logINFO, "* cdx           =" << cdx);
+            UBLOG(logINFO, "* fdx           =" << fdx);
+            double Hzb = 0.6 / fdx;
+            UBLOG(logINFO, "* Height of Zackenband =" << Hzb);
+            UBLOG(logINFO, "* Re on Zackenband =" << (uLB*Hzb) / (nuLB*double(1 << refineLevel)));
+            UBLOG(logINFO, "* nx1/2/3       =" << nx[0] << "/" << nx[1] << "/" << nx[2]);
+            UBLOG(logINFO, "* blocknx1/2/3  =" << blocknx[0] << "/" << blocknx[1] << "/" << blocknx[2]);
+            UBLOG(logINFO, "* x1Periodic    =" << periodicx1);
+            UBLOG(logINFO, "* x2Periodic    =" << periodicx2);
+            UBLOG(logINFO, "* x3Periodic    =" << periodicx3);
+            UBLOG(logINFO, "* number of levels  =" << refineLevel + 1);
+            UBLOG(logINFO, "* path          =" << pathname);
+
+            UBLOG(logINFO, "*****************************************");
+            UBLOG(logINFO, "* number of threads    =" << numOfThreads);
+            UBLOG(logINFO, "* number of processes  =" << comm->getNumberOfProcesses());
+            UBLOG(logINFO, "*****************************************");
+            UBLOG(logINFO, "*****************************************");
+         }
+         //////////////////////////////////////////////////////////////////////////
+
+
+         //////////////////////////////////////////////////////////////////////////
+         //refinement
+         GbCuboid3DPtr refinePlatteBox(new GbCuboid3D(plate->getX1Minimum() - 1.0, plate->getX2Minimum(), plate->getX3Minimum() + (plate->getX3Maximum() - plate->getX3Minimum()) / 2.0,
+            plate->getX1Maximum() + 40.0, plate->getX2Maximum(), plate->getX3Maximum() + 2.0));
+         if (myid == 0) GbSystem3D::writeGeoObject(refinePlatteBox.get(), pathname + "/geo/refinePlatteBox", WbWriterVtkXmlASCII::getInstance());
+
+         //inlay patch
+         GbCuboid3DPtr refineInlayBox(new GbCuboid3D(plate->getX1Maximum() - 104.0, plate->getX2Minimum(), plate->getX3Minimum() + (plate->getX3Maximum() - plate->getX3Minimum()) / 2.0,
+            plate->getX1Maximum() + 1.0, plate->getX2Maximum(), plate->getX3Maximum() + 1.0));
+         if (myid == 0) GbSystem3D::writeGeoObject(refineInlayBox.get(), pathname + "/geo/refineInlayBox", WbWriterVtkXmlASCII::getInstance());
+
+         if (refineLevel > 0)
+         {
+            if (myid == 0) UBLOG(logINFO, "Refinement - start");
+            RefineCrossAndInsideGbObjectHelper refineHelper(ngrid, refineLevel);
+            refineHelper.addGbObject(refinePlatteBox, refineLevel - 1);
+            refineHelper.addGbObject(refineInlayBox, refineLevel);
+
+            refineHelper.refine();
+            if (myid == 0) UBLOG(logINFO, "Refinement - end");
+         }
+
+         if (myid == 0)
+         {
+            UBLOG(logINFO, "Write blocks - start");
+            BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(ngrid, UbSchedulerPtr(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm));
+            ppblocks->update(ppblockc++);
+            UBLOG(logINFO, "Write blocks - end");
+         }
+
+
+
+         {
+
+            ////walls
+            GbCuboid3DPtr addWallZmin(new GbCuboid3D(g_minX1 - blockLengthx1, g_minX2 - blockLengthx1, g_minX3 - blockLengthx1, g_maxX1 + blockLengthx1, g_maxX2 + blockLengthx1, g_minX3));
+            if (myid == 0) GbSystem3D::writeGeoObject(addWallZmin.get(), pathname + "/geo/addWallZmin", WbWriterVtkXmlASCII::getInstance());
+
+            GbCuboid3DPtr addWallZmax(new GbCuboid3D(g_minX1 - blockLengthx1, g_minX2 - blockLengthx1, g_maxX3, g_maxX1 + blockLengthx1, g_maxX2 + blockLengthx1, g_maxX3 + blockLengthx1));
+            if (myid == 0) GbSystem3D::writeGeoObject(addWallZmax.get(), pathname + "/geo/addWallZmax", WbWriterVtkXmlASCII::getInstance());
+
+            //walls
+            int bbOption = 1; //0=simple Bounce Back, 1=quadr. BB
+            D3Q27BoundaryConditionAdapterPtr slip(new D3Q27SlipBCAdapter(bbOption));
+            D3Q27InteractorPtr addWallZminInt(new D3Q27Interactor(addWallZmin, ngrid, slip, Interactor3D::SOLID));
+            D3Q27InteractorPtr addWallZmaxInt(new D3Q27Interactor(addWallZmax, ngrid, slip, Interactor3D::SOLID));
+
+            /////////////////////////////////////////////////
+            ///interactoren
+            int bbOption1 = 1; //0=simple Bounce Back, 1=quadr. BB
+            D3Q27BoundaryConditionAdapterPtr noSlip(new D3Q27NoSlipBCAdapter(bbOption1));
+            //D3Q27TriFaceMeshInteractorPtr triPlateInteractor(new D3Q27TriFaceMeshInteractor(plate, ngrid, noSlip, Interactor3D::SOLID, Interactor3D::POINTS));
+            D3Q27TriFaceMeshInteractorPtr triPlateInteractor(new D3Q27TriFaceMeshInteractor(plate, ngrid, noSlip, Interactor3D::SOLID, Interactor3D::SIMPLE));
+            D3Q27TriFaceMeshInteractorPtr triBand1Interactor(new D3Q27TriFaceMeshInteractor(meshBand1, ngrid, noSlip, Interactor3D::SOLID, Interactor3D::EDGES));
+            D3Q27TriFaceMeshInteractorPtr triBand2Interactor(new D3Q27TriFaceMeshInteractor(meshBand2, ngrid, noSlip, Interactor3D::SOLID, Interactor3D::EDGES));
+            D3Q27TriFaceMeshInteractorPtr triBand3Interactor(new D3Q27TriFaceMeshInteractor(meshBand3, ngrid, noSlip, Interactor3D::SOLID, Interactor3D::EDGES));
+            D3Q27TriFaceMeshInteractorPtr triBand4Interactor(new D3Q27TriFaceMeshInteractor(meshBand4, ngrid, noSlip, Interactor3D::SOLID, Interactor3D::EDGES));
+
+            //inflow
+            GbCuboid3DPtr velBCCuboid(new GbCuboid3D(originX1 - blockLengthx1, originX2 - blockLengthx1, originX3 - blockLengthx1,
+               originX1, originX2 + geoLength[1] + blockLengthx1, originX3 + geoLength[2] + blockLengthx1));
+            if (myid == 0) GbSystem3D::writeGeoObject(velBCCuboid.get(), pathname + "/geo/velBCCuboid", WbWriterVtkXmlASCII::getInstance());
+            D3Q27InteractorPtr velBCInteractor(new D3Q27Interactor(velBCCuboid, ngrid, Interactor3D::SOLID));
+
+            //inflow
+            double raiseVelSteps = 0;
+            vector<D3Q27BCFunction> velcX1BCs, dummy;
+
+            mu::Parser inflowProfile;
+            inflowProfile.SetExpr("uLB");
+            inflowProfile.DefineConst("uLB", uLB);
+            velcX1BCs.push_back(D3Q27BCFunction(inflowProfile, raiseVelSteps, D3Q27BCFunction::INFCONST));
+
+            D3Q27BoundaryConditionAdapterPtr velBCAdapter(new D3Q27VelocityBCAdapter(velcX1BCs, dummy, dummy));
+            velBCInteractor->addBCAdapter(velBCAdapter);
+
+            //outflow
+            GbCuboid3DPtr densCuboid(new GbCuboid3D(originX1 + geoLength[0], originX2 - blockLengthx1, originX3 - blockLengthx1,
+               originX1 + geoLength[0] + blockLengthx1, originX2 + geoLength[1] + blockLengthx1, originX3 + geoLength[2] + blockLengthx1));
+            if (myid == 0) GbSystem3D::writeGeoObject(densCuboid.get(), pathname + "/geo/densCuboid", WbWriterVtkXmlASCII::getInstance());
+            D3Q27BoundaryConditionAdapterPtr denBCAdapter(new D3Q27DensityBCAdapter(rhoLB));
+            D3Q27InteractorPtr densInteractor(new D3Q27Interactor(densCuboid, ngrid, denBCAdapter, Interactor3D::SOLID));
+
+ 
+            ///////////////////////////////////////////////////
+            if (myid == 0) UBLOG(logINFO, "deleteExistBlocks - start");
+            deleteExistBlocks(ngrid, ogrid);
+            if (myid == 0) UBLOG(logINFO, "deleteExistBlocks - end");
+
+            if (myid == 0)
+            {
+               UBLOG(logINFO, "Write blocks - start");
+               BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(ngrid, UbSchedulerPtr(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm));
+               ppblocks->update(ppblockc++);
+               UBLOG(logINFO, "Write blocks - end");
+            }
+
+            ////////////////////////////////////////////
+            //METIS
+            Grid3DVisitorPtr metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B));
+
+            ////////////////////////////////////////////
+            /////delete solid blocks
+            if (myid == 0) UBLOG(logINFO, "deleteSolidBlocks - start");
+            InteractorsHelper intHelper(ngrid, metisVisitor);
+            intHelper.addInteractor(triPlateInteractor);
+            intHelper.addInteractor(triBand1Interactor);
+            intHelper.addInteractor(triBand2Interactor);
+            intHelper.addInteractor(triBand3Interactor);
+            intHelper.addInteractor(triBand4Interactor);
+            intHelper.addInteractor(addWallZminInt);
+            intHelper.addInteractor(addWallZmaxInt);
+            intHelper.addInteractor(densInteractor);
+            intHelper.addInteractor(velBCInteractor);
+            intHelper.selectBlocks();
+            if (myid == 0) UBLOG(logINFO, "deleteSolidBlocks - end");
+            //////////////////////////////////////
+            if (myid == 0)
+            {
+               UBLOG(logINFO, "Write blocks - start");
+               BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(ngrid, UbSchedulerPtr(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm));
+               ppblocks->update(ppblockc++);
+               UBLOG(logINFO, "Write blocks - end");
+            }
+            ////////////////////////////////////////////////////////
+
+            //addExistBlocks(ngrid, ogrid, hgrid);
+
+            ////////////////////////////////////////////////////////
+            unsigned long nob = ogrid->getNumberOfBlocks();
+            unsigned long nod = nob * blocknx[0] * blocknx[1] * blocknx[2];
+            unsigned long nod_real = nob * (blocknx[0] + 3)*(blocknx[1] + 3)*(blocknx[2] + 3);
+            unsigned long nodb = (blocknx[0]) * (blocknx[1]) * (blocknx[2]);
+
+            double needMemAll = double(nod_real*(27 * sizeof(double) + sizeof(int)));
+            double needMem = needMemAll / double(comm->getNumberOfProcesses());
+
+            double nup = 0;
+
+            if (myid == 0)
+            {
+               UBLOG(logINFO, "Number of blocks = " << nob);
+               UBLOG(logINFO, "Number of nodes  = " << nod);
+               int minInitLevel = ngrid->getCoarsestInitializedLevel();
+               int maxInitLevel = ngrid->getFinestInitializedLevel();
+               for (int level = minInitLevel; level <= maxInitLevel; level++)
+               {
+                  int nobl = ngrid->getNumberOfBlocks(level);
+                  UBLOG(logINFO, "Number of blocks for level " << level << " = " << nobl);
+                  UBLOG(logINFO, "Number of nodes for level " << level << " = " << nobl*nodb);
+                  nup += nobl*nodb*double(1 << level);
+               }
+               UBLOG(logINFO, "Hypothetically time for calculation step for 120 nodes  = " << nup / 6.0e5 / (120 * 8) << " s");
+               UBLOG(logINFO, "Necessary memory  = " << needMemAll << " bytes");
+               UBLOG(logINFO, "Necessary memory per process = " << needMem << " bytes");
+               UBLOG(logINFO, "Available memory per process = " << availMem << " bytes");
+               UBLOG(logINFO, "Available memory per node/8.0 = " << (availMem / 8.0) << " bytes");
+            }
+
+
+            //deleteNotExistBlocks(ngrid, ogrid);
+
+            //deleteExistBlocks(ngrid, ogrid);
+
+            //set kernel for new blocks
+            //////////////////////////////
+            LBMKernel3DPtr kernel;
+            //with sponge layer
+            kernel = LBMKernel3DPtr(new LBMKernelETD3Q27CCLBWithSpongeLayer(blocknx[0], blocknx[1], blocknx[2], LBMKernelETD3Q27CCLB::NORMAL));
+            kernel->setWithSpongeLayer(true);
+            kernel->setSpongeLayer(spongeLayer);
+
+            BCProcessorPtr bcProc(new D3Q27ETForThinWallBCProcessor());
+            kernel->setBCProcessor(bcProc);
+
+            //setKernel(ogrid, kernel, nuLB);
+
+            SetKernelBlockVisitor kernelVisitor(kernel, nuLB, availMem, needMem);
+            ngrid->accept(kernelVisitor);
+            //////////////////////////////////
+
+            //initialization of decompositions
+            D3Q27ETInitDistributionsBlockVisitor initVisitor(nuLB, rhoLB);
+            //double aVuLB = 0.1;
+            initVisitor.setVx1(uLB);
+            ngrid->accept(initVisitor);
+
+            int maxblock = Block3D::getMaxGlobalID();
+            if (myid == 0) UBLOG(logINFO, "maxblock = " << maxblock);
+
+            reindexBlocks(ngrid);
+
+            moveBlocks(ngrid, ogrid);
+
+            setInterpolationFlag(ogrid);
+
+            removeBCInformation(ogrid);
+
+            //set connectors
+            D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
+            D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
+            ogrid->accept(setConnsVisitor);
+
+            ////////////////////////////////////
+            ////undef nodes
+            if (refineLevel > 0)
+            {
+               D3Q27SetUndefinedNodesBlockVisitor undefNodesVisitor;
+               ogrid->accept(undefNodesVisitor);
+            }
+
+
+            D3Q27InteractorPtr addWallZminInt1(new D3Q27Interactor(addWallZmin, ogrid, slip, Interactor3D::SOLID));
+            D3Q27InteractorPtr addWallZmaxInt1(new D3Q27Interactor(addWallZmax, ogrid, slip, Interactor3D::SOLID));
+            D3Q27TriFaceMeshInteractorPtr triPlateInteractor1(new D3Q27TriFaceMeshInteractor(plate, ogrid, noSlip, Interactor3D::SOLID, Interactor3D::SIMPLE));
+            D3Q27TriFaceMeshInteractorPtr triBand1Interactor1(new D3Q27TriFaceMeshInteractor(meshBand1, ogrid, noSlip, Interactor3D::SOLID, Interactor3D::EDGES));
+            D3Q27TriFaceMeshInteractorPtr triBand2Interactor1(new D3Q27TriFaceMeshInteractor(meshBand2, ogrid, noSlip, Interactor3D::SOLID, Interactor3D::EDGES));
+            D3Q27TriFaceMeshInteractorPtr triBand3Interactor1(new D3Q27TriFaceMeshInteractor(meshBand3, ogrid, noSlip, Interactor3D::SOLID, Interactor3D::EDGES));
+            D3Q27TriFaceMeshInteractorPtr triBand4Interactor1(new D3Q27TriFaceMeshInteractor(meshBand4, ogrid, noSlip, Interactor3D::SOLID, Interactor3D::EDGES));
+            D3Q27InteractorPtr velBCInteractor1(new D3Q27Interactor(velBCCuboid, ogrid, Interactor3D::SOLID));
+            velBCInteractor1->addBCAdapter(velBCAdapter);
+            D3Q27InteractorPtr densInteractor1(new D3Q27Interactor(densCuboid, ogrid, denBCAdapter, Interactor3D::SOLID));
+
+            {SetSolidOrTransBlockVisitor v2(addWallZminInt1, SetSolidOrTransBlockVisitor::TRANS);
+            ogrid->accept(v2); }
+            {SetSolidOrTransBlockVisitor v2(addWallZmaxInt1, SetSolidOrTransBlockVisitor::TRANS);
+            ogrid->accept(v2); }
+            {SetSolidOrTransBlockVisitor v2(triPlateInteractor1, SetSolidOrTransBlockVisitor::TRANS);
+            ogrid->accept(v2); }
+            {SetSolidOrTransBlockVisitor v2(triBand1Interactor1, SetSolidOrTransBlockVisitor::TRANS);
+            ogrid->accept(v2); }
+            {SetSolidOrTransBlockVisitor v2(triBand2Interactor1, SetSolidOrTransBlockVisitor::TRANS);
+            ogrid->accept(v2); }
+            {SetSolidOrTransBlockVisitor v2(triBand3Interactor1, SetSolidOrTransBlockVisitor::TRANS);
+            ogrid->accept(v2); }
+            {SetSolidOrTransBlockVisitor v2(triBand4Interactor1, SetSolidOrTransBlockVisitor::TRANS);
+            ogrid->accept(v2); }
+            {SetSolidOrTransBlockVisitor v2(velBCInteractor1, SetSolidOrTransBlockVisitor::TRANS);
+            ogrid->accept(v2); }
+            {SetSolidOrTransBlockVisitor v2(densInteractor1, SetSolidOrTransBlockVisitor::TRANS);
+            ogrid->accept(v2); }
+
+            addWallZminInt1->initInteractor();
+            addWallZmaxInt1->initInteractor();
+            triPlateInteractor1->initInteractor();
+            triBand1Interactor1->initInteractor();
+            triBand2Interactor1->initInteractor();
+            triBand3Interactor1->initInteractor();
+            triBand4Interactor1->initInteractor();
+            velBCInteractor1->initInteractor();
+            densInteractor1->initInteractor();
+
+
+            //intHelper.setBC();
+         }
+         if (myid == 0)
+         {
+            UBLOG(logINFO, "Write blocks - start");
+            BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(ogrid, UbSchedulerPtr(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm));
+            ppblocks->update(ppblockc++);
+            UBLOG(logINFO, "Write blocks - end");
+         }
+
+         {
+            UbSchedulerPtr geoSch(new UbScheduler(1));
+            D3Q27MacroscopicQuantitiesPostprocessorPtr ppgeo(
+               new D3Q27MacroscopicQuantitiesPostprocessor(ogrid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(),
+               unitConverter, true));
+            ppgeo->update(0);
+            ppgeo.reset();
+            geoSch.reset();
+         }
+
+         //////////////////////////////////////////////////////////////////////////
+         //porous inlay
+         {
+            string pmFilename = pathGeo + "/CT-2014-039.raw";
+            int pmNX1 = 1333;  //abmessung einzelbild in x-richtung
+            int pmNX2 = 463; //abmessung einzelbild in y richtung
+            int pmNX3 = 1333; //anzahl der bilder
+            float lthreshold = 27686.97;
+            float uthreshold = 65535.0;
+
+            GbVoxelMatrix3DPtr pmMesh(new GbVoxelMatrix3D(pmNX1, pmNX2, pmNX3, 0, lthreshold, uthreshold));
+            pmMesh->readMatrixFromRawFile<unsigned short>(pmFilename, GbVoxelMatrix3D::LittleEndian);
+
+            double scaleFactor = 0.001;
+            double delta = 3.75*scaleFactor;
+            pmMesh->setVoxelMatrixDelta(delta, delta, delta);
+            pmMesh->rotate90aroundX();
+            pmMesh->rotate90aroundX();
+            pmMesh->rotate90aroundX();
+
+            double inlayXmin = plate->getX1Maximum() - 5.0;//995.0;
+            double inlayYmin = gridCube->getX2Minimum();//180.0;
+            double inlayZmin = 8.84 + fdx;//8.73;
+
+            //pmMesh->setVoxelMatrixMininum(inlayXmin, inlayYmin, inlayZmin);
+            //if(myid == 0) pmMesh->writeToLegacyVTKBinary(pathname+"/geo/pmMesh");
+
+            int i = 0;
+            for (int y = 0; y < 40; y += 10)
+               for (int x = 0; x < 100; x += 10)
+               {
+                  if (myid == 0) UBLOG(logINFO, "inlay # " << i);
+                  pmMesh->setVoxelMatrixMininum(inlayXmin - (double)x, inlayYmin + (double)y, inlayZmin);
+                  inlay(pmMesh, pathname, myid, i, ogrid);
+                  i++;
+
+                  if (myid == 0) UBLOG(logINFO, "inlay # " << i);
+                  pmMesh->setVoxelMatrixMininum(inlayXmin - (double)(x + 5), inlayYmin + (double)y, inlayZmin);
+                  pmMesh->mirrorX();
+                  inlay(pmMesh, pathname, myid, i, ogrid);
+                  i++;
+
+                  if (myid == 0) UBLOG(logINFO, "inlay # " << i);
+                  pmMesh->setVoxelMatrixMininum(inlayXmin - (double)(x + 5), inlayYmin + (double)(y + 5), inlayZmin);
+                  pmMesh->mirrorY();
+                  inlay(pmMesh, pathname, myid, i, ogrid);
+                  i++;
+
+                  if (myid == 0) UBLOG(logINFO, "inlay # " << i);
+                  pmMesh->setVoxelMatrixMininum(inlayXmin - (double)x, inlayYmin + (double)(y + 5), inlayZmin);
+                  pmMesh->mirrorX();
+                  inlay(pmMesh, pathname, myid, i, ogrid);
+                  pmMesh->mirrorY();
+                  i++;
+               }
+
+            if (myid == 0)
+            {
+               UBLOG(logINFO, "mit VoxelMatrix");
+               UBLOG(logINFO, "PID = " << myid << " Total Physical Memory (RAM): " << Utilities::getTotalPhysMem());
+               UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used: " << Utilities::getPhysMemUsed());
+               UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe());
+            }
+         }
+         //////////////////////////////////////////////////////////////////////////
+
+         if (myid == 0)
+         {
+            UBLOG(logINFO, "Write blocks - start");
+            BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(ogrid, UbSchedulerPtr(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm));
+            ppblocks->update(ppblockc++);
+            UBLOG(logINFO, "Write blocks - end");
+         }
+
+         ////initialization of decompositions
+         //D3Q27ETInitDistributionsBlockVisitor initVisitor(nuLB, rhoLB);
+         ////initVisitor.setVx1(uLB);
+         //hgrid->accept(initVisitor);
+
+         
+         //Postprozess
+         UbSchedulerPtr geoSch(new UbScheduler(1));
+         D3Q27MacroscopicQuantitiesPostprocessorPtr ppgeo(
+            new D3Q27MacroscopicQuantitiesPostprocessor(ogrid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(),
+            unitConverter, true));
+         ppgeo->update(1);
+         ppgeo.reset();
+         geoSch.reset();
+
+         if (myid == 0)
+         {
+            UBLOG(logINFO, "Write blocks - start");
+            BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(ogrid, UbSchedulerPtr(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm));
+            ppblocks->update(ppblockc++);
+            UBLOG(logINFO, "Write blocks - end");
+         }
+
+
+         //domain decomposition for threads
+         if (numOfThreads > 1)
+         {
+            PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
+            ogrid->accept(pqPartVisitor);
+         }
+
+         SetSpongeLayerBlockVisitor ssp(spongeLayer);
+         ogrid->accept(ssp);
+         if (myid == 0) UBLOG(logINFO, "Restart - end");
+
+         if (myid == 0) UBLOG(logINFO, "Preprozess - end");
+      }
+      else
+      {
+         restart = true;
+
+         ////////////////////////////////////////////////////////////////////////////
+         //change viscosity
+         //Re = 1e6;
+         //nuLB = (uLB*(lReal / cdx)) / Re;
+         //if (myid == 0) UBLOG(logINFO, "nuLB =" << nuLB);
+
+         //int gridRank = grid->getRank();
+         //int minInitLevel = grid->getCoarsestInitializedLevel();
+         //int maxInitLevel = grid->getFinestInitializedLevel();
+
+         //std::vector<std::vector<Block3DPtr> > blockVector;
+         //blockVector.resize(maxInitLevel + 1);
+
+         //for (int level = minInitLevel; level <= maxInitLevel; level++)
+         //{
+         //   grid->getBlocks(level, gridRank, true, blockVector[level]);
+
+         //   BOOST_FOREACH(Block3DPtr block, blockVector[level])
+         //   {
+         //      LBMReal collFactor = LBMSystem::calcCollisionFactor(nuLB, block->getLevel());
+         //      block->getKernel()->setCollisionFactor(collFactor);
+         //   }
+         //}
+         ////////////////////////////////////////////////////////////////////////////
+
+         //domain decomposition for threads
+         if (numOfThreads > 1)
+         {
+            PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
+            ogrid->accept(pqPartVisitor);
+         }
+         //set connectors
+         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
+         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
+         ogrid->accept(setConnsVisitor);
+         SetSpongeLayerBlockVisitor ssp(spongeLayer);
+         ogrid->accept(ssp);
+         if (myid == 0) UBLOG(logINFO, "Restart - end");
+      }
+      UbSchedulerPtr visSch(new UbScheduler());
+      //visSch->addSchedule(1,0,10);
+      visSch->addSchedule(100, 100, 1000);
+      //visSch->addSchedule(1000,1000,5000);
+      //visSch->addSchedule(5000,5000,100000);
+      //visSch->addSchedule(100000,100000,10000000);
+
+      visSch->addSchedule(1000, 1000, 10000000);
+      visSch->addSchedule(1, 47100, 47100);
+
+      D3Q27MacroscopicQuantitiesPostprocessor pp(ogrid, visSch, pathname, WbWriterVtkXmlBinary::getInstance(), unitConverter);
+
+      double startStep = 47000;
+      double startStep2= 47500;
+
+      if(ogrid->getTimeStep() >= startStep2) startStep = startStep2;
+
+      UbSchedulerPtr resSchRMS(new UbScheduler());
+      resSchRMS->addSchedule(1000000, startStep, 10000000);
+      resSchRMS->addSchedule(1000000, startStep2, 10000000);
+      UbSchedulerPtr resSchMeans(new UbScheduler());
+      resSchMeans->addSchedule(1000000, startStep, 10000000);
+      resSchMeans->addSchedule(1000000, startStep2, 10000000);
+      UbSchedulerPtr stepAvSch(new UbScheduler());
+      int averageInterval = 100;
+
+      stepAvSch->addSchedule(averageInterval, 0, 10000000);
+      AverageValuesPostprocessor Avpp(ogrid, pathname, WbWriterVtkXmlBinary::getInstance(), visSch/*wann wird rausgeschrieben*/,
+         stepAvSch/*wann wird gemittelt*/, resSchMeans, resSchRMS/*wann wird resettet*/, restart);
+
+      UbSchedulerPtr nupsSch(new UbScheduler(10, 10, 30));
+      nupsSch->addSchedule(500, 500, 1e6);
+      NUPSCounterPostprocessor npr(ogrid, nupsSch, numOfThreads, comm);
+
+      UbSchedulerPtr emSch(new UbScheduler(10));
+      EmergencyExitPostprocessor empr(ogrid, emSch, pathname, RestartPostprocessorPtr(&rp), comm);
+
+      if (myid == 0)
+      {
+         UBLOG(logINFO, "PID = " << myid << " Total Physical Memory (RAM): " << Utilities::getTotalPhysMem());
+         UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used: " << Utilities::getPhysMemUsed());
+         UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe());
+      }
+
+      double endTime = 100000001;
+      CalculationManagerPtr calculation(new CalculationManager(ogrid, numOfThreads, endTime, visSch));
+      if (myid == 0) UBLOG(logINFO, "Simulation-start");
+      calculation->calculate();
+      if (myid == 0) UBLOG(logINFO, "Simulation-end");
+   }
+   catch (std::exception& e)
+   {
+      cerr << e.what() << endl << flush;
+   }
+   catch (std::string& s)
+   {
+      cerr << s << endl;
+   }
+   catch (...)
+   {
+      cerr << "unknown exception" << endl;
+   }
+
+}
+//////////////////////////////////////////////////////////////////////////
+int main(int argc, char* argv[])
+{
+   if (argc == 1)
+   {
+      cout << "Command line argument isn't specified!" << endl;
+      cout << "plate2 <machine name>" << endl;
+      return 1;
+   }
+   run(argv[1], true);
+
+   return 0;
+}
+
diff --git a/apps/cpu/reefer/CMakeLists.txt b/apps/cpu/reefer/CMakeLists.txt
index 116a067c86dfc847d74034b01ee30ccfff55225f..8c76ca7ed7678275d5d3f72d353b9ddce7c7ea44 100644
--- a/apps/cpu/reefer/CMakeLists.txt
+++ b/apps/cpu/reefer/CMakeLists.txt
@@ -1,25 +1,25 @@
-CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
-
-########################################################
-## C++ PROJECT                                       ###
-########################################################
-PROJECT(reefer)
-
-INCLUDE(${SOURCE_ROOT}/core/IncludsList.txt) 
-
-#################################################################
-###   LOCAL FILES                                             ###
-#################################################################
-FILE(GLOB SPECIFIC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.h
-                         ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
-                         ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp  )
- 
-SET(ALL_SOURCES ${ALL_SOURCES} ${SPECIFIC_FILES})
-SOURCE_GROUP(src FILES ${SPECIFIC_FILES})
-  
-SET(CAB_ADDITIONAL_LINK_LIBRARIES core)
-
-#################################################################
-###   CREATE PROJECT                                          ###
-#################################################################
-CREATE_CAB_PROJECT(reefer BINARY)
+CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
+
+########################################################
+## C++ PROJECT                                       ###
+########################################################
+PROJECT(reefer)
+
+INCLUDE(${SOURCE_ROOT}/core/IncludsList.txt) 
+
+#################################################################
+###   LOCAL FILES                                             ###
+#################################################################
+FILE(GLOB SPECIFIC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.h
+                         ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
+                         ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp  )
+ 
+SET(ALL_SOURCES ${ALL_SOURCES} ${SPECIFIC_FILES})
+SOURCE_GROUP(src FILES ${SPECIFIC_FILES})
+  
+SET(CAB_ADDITIONAL_LINK_LIBRARIES core)
+
+#################################################################
+###   CREATE PROJECT                                          ###
+#################################################################
+CREATE_CAB_PROJECT(reefer BINARY)
diff --git a/apps/cpu/reefer/reefer.cpp b/apps/cpu/reefer/reefer.cpp
index d66cf9705570f3ba40c619ac6638e6b782bd8ecb..6590b35c58696b773f11075ec3e631ab1fda5c05 100644
--- a/apps/cpu/reefer/reefer.cpp
+++ b/apps/cpu/reefer/reefer.cpp
@@ -1,489 +1,489 @@
-#include <iostream>
-#include <string>
-
-#include "geometry3d/CoordinateTransformation3D.h"
-#include "Grid3D.h"
-#include "GenBlocksGridVisitor.h"
-#include "geometry3d/GbSystem3D.h"
-#include "geometry3d/GbCuboid3D.h"
-#include "geometry3d/GbCylinder3D.h"
-#include <geometry3d/GbSphere3D.h>
-#include "basics/writer/WbWriterVtkXmlASCII.h"
-#include "basics/writer/WbWriterVtkXmlBinary.h"
-#include "RefineCrossAndInsideGbObjectBlockVisitor.h"
-#include "RatioBlockVisitor.h"
-#include "RatioSmoothBlockVisitor.h"
-#include "OverlapBlockVisitor.h"
-#include "RefineInterGbObjectsVisitor.h"
-#include "RefineCrossAndInsideGbObjectBlockVisitor.h"
-#include "SetKernelBlockVisitor.h"
-#include "LBMKernelETD3Q27Cascaded.h"
-#include "D3Q27MacroscopicQuantitiesPostprocessor.h"
-#include "MPICommunicator.h"
-#include "D3Q27ETBCProcessor.h"
-#include "SimulationParameters.h"
-#include "D3Q27SetUndefinedNodesBlockVisitor.h"
-#include "SetInterpolationDirsBlockVisitor.h"
-#include "D3Q27SetConnectorsBlockVisitor.h"
-#include "NullCommunicator.h"
-#include "D3Q27ETInitDistributionsBlockVisitor.h"
-#include "CalculationManager.h"
-#include "PQueuePartitioningGridVisitor.h"
-#include "MetisPartitioningGridVisitor.h"
-#include "D3Q27Interactor.h"
-#include "D3Q27NoSlipBCAdapter.h"
-#include "D3Q27VelocityBCAdapter.h"
-#include "D3Q27DensityBCAdapter.h"
-#include "D3Q27BoundaryConditionAdapter.h"
-#include "StringUtil.hpp"
-#include "D3Q27OffsetInterpolationProcessor.h"
-#include "D3Q27CompactInterpolationProcessor.h"
-#include "SyncBcBlockVisitor.h"
-#include "geometry3d/creator/GbTriFaceMesh3DCreator.h"
-#include "geometry3d/GbTriFaceMesh3D.h"
-#include "D3Q27TriFaceMeshInteractor.h"
-#include "MathUtil.hpp"
-#include "SolidBlocksHelper.h"
-#include "LBMKernelETD3Q27CascadedTI.h"
-#include "TurbulenceIntensityPostprocessor.h"
-#include "RestartPostprocessor.h"
-
-using namespace std;
-
-
-void run(const char *cstr)
-{
-   try
-   {
-      string pathname = "c:/temp/reefer/out";
-      string pathGeo = "c:/Data/reefer";
-
-      //string pathname = "/work/koskuche/scratch/reefer2/out";
-      //string pathGeo = "/home/koskuche/data/reefer/new";
-
-      //string pathname = "/home/kucher/temp/reefer/out";
-      //string pathGeo = "/home/kucher/data/reefer/new";
-
-      int numOfThreads = 2;
-      
-      CommunicatorPtr comm(new MPICommunicator());
-      int myid = comm->getProcessID();
-
-      //if(myid ==0)
-      //{
-      //   stringstream logFilename;
-      //   logFilename <<  "/work/koskuche/scratch/reefer2/logfile.log";
-      //   UbLog::output_policy::setStream(logFilename.str());
-      //}
-
-      //const double dx = 13.6;
-      const double dx = 2.0;
-      double refLentgthWorld = dx/1000.0; //from mm to m
-      double refLentgthLB = 1.0;
-      LBMUnitConverterPtr uconv = LBMUnitConverterPtr(new LBMUnitConverter(refLentgthWorld, LBMUnitConverter::AIR_20C, refLentgthLB));
-      LBMReal uSI = 10;//m/s
-      LBMReal uLB = uSI * uconv->getFactorVelocityWToLb();
-      LBMReal rhoLB = 1.0;
-      LBMReal nueSI = 1.5e-5;
-      LBMReal nueLB = nueSI * uconv->getFactorViscosityWToLb();//(uLB*l)/Re;
-
-      Grid3DPtr grid(new Grid3D());
-      UbSchedulerPtr rSch(new UbScheduler(1500,5000));
-      RestartPostprocessor rp(grid, rSch, comm, pathname+"/checkpoints", RestartPostprocessor::BINARY);
-
-      std::string opt;
-
-      if(cstr!= NULL)
-         opt = std::string(cstr);
-
-      if(cstr!= NULL)
-      {
-         opt = std::string(cstr);
-
-         if(myid==0) UBLOG(logINFO,"Restart step: " << opt);
-
-         grid = rp.restart(UbSystem::stringTo<int>(opt));
-
-         LBMReal nueLB = 1.5e-3;
-         
-         SimulationParametersPtr param = SimulationParameters::getInstanz();
-         param->setCollisionModelType(SimulationParameters::COMPRESSIBLE);
-
-         //set connectors
-         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27OffsetInterpolationProcessor());
-         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
-         grid->accept( setConnsVisitor );
-
-         //domain decomposition
-         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
-         grid->accept(pqPartVisitor);
-      }
-      else
-      {
-      const int baseLevel = 0;
-      const int refineLevel = 0;
-      //////////////////////////////////////////////////////////////////////////
-      // Geometries
-      //////////////////////////////////////////////////////////////////////////
-      //container
-      GbTriFaceMesh3DPtr geoContainer (GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(pathGeo +"/Containerascii.stl","geoContainer"));
-      if(myid == 0) GbSystem3D::writeGeoObject(geoContainer.get(), pathname+"/geo/geoContainer", WbWriterVtkXmlASCII::getInstance());
-      //cargo
-      //GbTriFaceMesh3DPtr geoCargo (GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(pathGeo + "/Kisten_fuer_Palettenascii.stl","geoCargo"));
-      GbTriFaceMesh3DPtr geoCargo (GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(pathGeo + "/Kistenascii.stl","geoCargo"));
-      if(myid == 0) GbSystem3D::writeGeoObject(geoCargo.get(), pathname+"/geo/geoCargo", WbWriterVtkXmlASCII::getInstance());
-      //palette
-      //GbTriFaceMesh3DPtr geoPalette (GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(pathGeo + "/Palettenascii.stl","geoPalette"));
-      //if(myid == 0) GbSystem3D::writeGeoObject(geoPalette.get(), pathname+"/geoPalette", WbWriterVtkXmlASCII::getInstance());
-      //reefer
-      GbTriFaceMesh3DPtr geoBlower (GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(pathGeo + "/Solidblockascii.stl","geoReefer"));
-      if(myid == 0) GbSystem3D::writeGeoObject(geoBlower.get(), pathname+"/geo/geoBlower", WbWriterVtkXmlASCII::getInstance());
-      //T floor
-      GbTriFaceMesh3DPtr geoTFloor (GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(pathGeo + "/T-Floorascii.stl","geoTFloor"));
-      if(myid == 0) GbSystem3D::writeGeoObject(geoTFloor.get(), pathname+"/geo/geoTFloor", WbWriterVtkXmlASCII::getInstance());
-
-      //bounding box
-      double g_minX1 = geoContainer->getX1Minimum();
-      double g_minX2 = geoContainer->getX2Minimum();
-      double g_minX3 = geoContainer->getX3Minimum();
-
-      double g_maxX1 = geoContainer->getX1Maximum();
-      double g_maxX2 = geoContainer->getX2Maximum();
-      double g_maxX3 = geoContainer->getX3Maximum();
-
-      const int nodesPerBlock = 10;
-      //const double dx = 1.7;
-      //const double dx = 13.6;
-      const double blockLength = double(nodesPerBlock)*dx;
-
-      const double gridOriginX1 = g_minX1;
-      const double gridOriginX2 = g_minX2;
-      const double gridOriginX3 = g_minX3;
-
-      //add wall X
-      GbCuboid3DPtr addWallXmax (new GbCuboid3D(g_maxX1, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength));
-      //GbCuboid3DPtr addWallXmax (new GbCuboid3D(geoBlower->getX1Maximum()+geoBlower->getLengthX1(), g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength));
-      if(myid == 0) GbSystem3D::writeGeoObject(addWallXmax.get(), pathname+"/geo/addWallXmax", WbWriterVtkXmlASCII::getInstance());
-      //add wall Y
-      GbCuboid3DPtr addWallYmax (new GbCuboid3D(g_minX1-blockLength, geoBlower->getX2Maximum(), g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength));
-      if(myid == 0) GbSystem3D::writeGeoObject(addWallYmax.get(), pathname+"/geo/addWallYmax", WbWriterVtkXmlASCII::getInstance());
-      //add wall Z
-      GbCuboid3DPtr addWallZmax (new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_maxX3, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength));
-      if(myid == 0) GbSystem3D::writeGeoObject(addWallZmax.get(), pathname+"/geo/addWallZmax", WbWriterVtkXmlASCII::getInstance());
-      //add wall X
-      GbCuboid3DPtr addWallXmin (new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3-blockLength, geoBlower->getX1Minimum(), g_maxX2+blockLength, g_maxX3+blockLength));
-      if(myid == 0) GbSystem3D::writeGeoObject(addWallXmin.get(), pathname+"/geo/addWallXmin", WbWriterVtkXmlASCII::getInstance());
-      //add wall Y
-      GbCuboid3DPtr addWallYmin (new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, geoBlower->getX2Minimum(), g_maxX3+blockLength));
-      if(myid == 0) GbSystem3D::writeGeoObject(addWallYmin.get(), pathname+"/geo/addWallYmin", WbWriterVtkXmlASCII::getInstance());
-      //add wall Z
-      GbCuboid3DPtr addWallZmin (new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, geoTFloor->getX3Minimum()));
-      if(myid == 0) GbSystem3D::writeGeoObject(addWallZmin.get(), pathname+"/geo/addWallZmin", WbWriterVtkXmlASCII::getInstance());
-      //add wall for blower
-      GbCuboid3DPtr addWallBlower (new GbCuboid3D(geoBlower->getX1Minimum()-3.0*blockLength, geoBlower->getX2Minimum()-3.0*blockLength, geoBlower->getX3Minimum()+4.0*dx, 
-                                                  geoBlower->getX1Maximum(), geoBlower->getX2Maximum()+3.0*blockLength, geoBlower->getX3Maximum()-4.0*dx));
-      if(myid == 0) GbSystem3D::writeGeoObject(addWallBlower.get(), pathname+"/geo/addWallBlower", WbWriterVtkXmlASCII::getInstance());
-
-      GbCuboid3DPtr addWallBlowerXmin (new GbCuboid3D(geoBlower->getX1Minimum(), geoBlower->getX2Minimum(), geoBlower->getX3Minimum(), 
-                                       geoBlower->getX1Minimum()+2.0*dx, geoBlower->getX2Maximum(), geoBlower->getX3Maximum()));
-      if(myid == 0) GbSystem3D::writeGeoObject(addWallBlowerXmin.get(), pathname+"/geo/addWallBlowerXmin", WbWriterVtkXmlASCII::getInstance());
-
-      GbCuboid3DPtr addWallBlowerXmax (new GbCuboid3D(geoBlower->getX1Maximum()-2.0*dx, geoBlower->getX2Minimum(), geoBlower->getX3Minimum(), 
-                                                      geoBlower->getX1Maximum(), geoBlower->getX2Maximum(), geoBlower->getX3Maximum()));
-      if(myid == 0) GbSystem3D::writeGeoObject(addWallBlowerXmax.get(), pathname+"/geo/addWallBlowerXmax", WbWriterVtkXmlASCII::getInstance());
-
-      GbCuboid3DPtr addWallBlowerYmin (new GbCuboid3D(geoBlower->getX1Minimum(), geoBlower->getX2Minimum(), geoBlower->getX3Minimum(), 
-                                                      geoBlower->getX1Maximum(), geoBlower->getX2Minimum()+2.0*dx, geoBlower->getX3Maximum()));
-      if(myid == 0) GbSystem3D::writeGeoObject(addWallBlowerYmin.get(), pathname+"/geo/addWallBlowerYmin", WbWriterVtkXmlASCII::getInstance());
-
-      GbCuboid3DPtr addWallBlowerYmax (new GbCuboid3D(geoBlower->getX1Minimum()-2.0*dx, geoBlower->getX2Maximum()-2.0*dx, geoBlower->getX3Minimum(), 
-                                                      geoBlower->getX1Maximum(), geoBlower->getX2Maximum(), geoBlower->getX3Maximum()));
-      if(myid == 0) GbSystem3D::writeGeoObject(addWallBlowerYmax.get(), pathname+"/geo/addWallBlowerYmax", WbWriterVtkXmlASCII::getInstance());
-
-      //inflow
-      GbCuboid3DPtr geoInflow (new GbCuboid3D(geoBlower->getX1Minimum()+dx, geoBlower->getX2Minimum()+dx, geoBlower->getX3Minimum()+2.0*dx, 
-                                              geoBlower->getX1Maximum()-dx, geoBlower->getX2Maximum()-dx, geoBlower->getX3Minimum()+4.0*dx));
-      if(myid == 0) GbSystem3D::writeGeoObject(geoInflow.get(), pathname+"/geo/geoInflow", WbWriterVtkXmlASCII::getInstance());
-
-      //outflow
-      GbCuboid3DPtr geoOutflow (new GbCuboid3D(geoBlower->getX1Minimum()+2.0*dx, geoBlower->getX2Minimum()+2.0*dx, geoBlower->getX3Maximum()-4.0*dx, 
-                                               geoBlower->getX1Maximum()-2.0*dx, geoBlower->getX2Maximum()-2.0*dx, geoBlower->getX3Maximum()-2.0*dx));
-      if(myid == 0) GbSystem3D::writeGeoObject(geoOutflow.get(), pathname+"/geo/geoOutflow", WbWriterVtkXmlASCII::getInstance());
-
-      //simulation parameters
-      double lSI = g_maxX2 - g_minX2;
-      double lLB = lSI / dx;
-      //double refLentgthWorld = blockLength/1000.0; //from mm to m
-      //double refLentgthLB = double(nodesPerBlock);
-      //LBMUnitConverterPtr uconv = LBMUnitConverterPtr(new LBMUnitConverter(refLentgthWorld, LBMUnitConverter::AIR_20C, refLentgthLB));
-      //LBMReal uSI = 10;//m/s
-      //LBMReal uLB = uSI * uconv->getFactorVelocityWToLb();
-      //LBMReal rhoLB = 1.0;
-      //LBMReal nueSI = 1.5e-5;
-      //LBMReal nueLB = nueSI * uconv->getFactorViscosityWToLb();//(uLB*l)/Re;
-      //LBMReal nueLB = 1.5e-3;
-      LBMReal Re = (uLB*(420/dx))/nueLB;
-
-      if(myid ==0)
-      {
-         UBLOG(logINFO,"grid = " <<int((g_maxX1 - g_minX1)/dx)<<"x"<<int((g_maxX2 - g_minX2)/dx) << "x"<<int((g_maxX3 - g_minX3)/dx));
-         UBLOG(logINFO,"dx = " << dx);
-         UBLOG(logINFO,"nodes per block = " << nodesPerBlock);
-         UBLOG(logINFO,"block length = " << blockLength << "mm");
-         UBLOG(logINFO,"v = " << uLB );
-         UBLOG(logINFO,"rho = " << rhoLB );
-         UBLOG(logINFO,"nue = " << nueLB );
-         UBLOG(logINFO,"Re = " << Re );
-         UBLOG(logINFO,"Preprozess - start");
-      }
-
-      SimulationParametersPtr param = SimulationParameters::getInstanz();
-      param->setCollisionModelType(SimulationParameters::COMPRESSIBLE);
-      param->setRho(rhoLB);
-      param->setVelocityX(uLB);
-      param->setViscosity(nueLB);
-      
-      //set grid
-      //Grid3DPtr grid(new Grid3D());
-      grid->setDeltaX(dx);
-      grid->setBlockNX(nodesPerBlock, nodesPerBlock, nodesPerBlock);
-      
-      GbObject3DPtr gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
-      if(myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), pathname+"/gridCube", WbWriterVtkXmlASCII::getInstance());
-
-      GenBlocksGridVisitor genBlocks;
-      genBlocks.addGeoObject(gridCube);
-      grid->accept(genBlocks);
-
-      MetisPartitioningGridVisitor metisVisitor(numOfThreads, D3Q27System::B, comm, false);
-      grid->accept( metisVisitor );
-
-      SolidBlocksHelper sd(grid, comm);
-
-      //iteractors
-      int bbOption1 = 0; //0=simple Bounce Back, 1=quadr. BB
-      D3Q27BoundaryConditionAdapterPtr bcObst(new D3Q27NoSlipBCAdapter(bbOption1));
-
-      D3Q27TriFaceMeshInteractorPtr cargoInt( new D3Q27TriFaceMeshInteractor(geoCargo, grid, bcObst,Interactor3D::SOLID));
-      sd.addInteractor(cargoInt);
-
-      D3Q27InteractorPtr addWallBlowerInt(new D3Q27Interactor(addWallBlower, grid, bcObst,Interactor3D::SOLID));
-
-      sd.addInteractor(addWallBlowerInt);
-
-      //D3Q27TriFaceMeshInteractorPtr paletteInt( new D3Q27TriFaceMeshInteractor(geoPalette, grid, bcObst,Interactor3D::SOLID));
-      //sd.addInteractor(paletteInt);
-
-      D3Q27InteractorPtr addWallXmaxInt(new D3Q27Interactor(addWallXmax, grid, bcObst,Interactor3D::SOLID));
-      sd.addInteractor(addWallXmaxInt);
-
-      D3Q27InteractorPtr addWallYmaxInt(new D3Q27Interactor(addWallYmax, grid, bcObst,Interactor3D::SOLID));
-      sd.addInteractor(addWallYmaxInt);
-
-      D3Q27InteractorPtr addWallZmaxInt(new D3Q27Interactor(addWallZmax, grid, bcObst,Interactor3D::SOLID));
-      sd.addInteractor(addWallZmaxInt);
-
-      D3Q27InteractorPtr addWallXminInt(new D3Q27Interactor(addWallXmin, grid, bcObst,Interactor3D::SOLID));
-      sd.addInteractor(addWallXminInt);
-
-      D3Q27InteractorPtr addWallYminInt(new D3Q27Interactor(addWallYmin, grid, bcObst,Interactor3D::SOLID));
-      sd.addInteractor(addWallYminInt);
-
-      D3Q27InteractorPtr addWallZminInt(new D3Q27Interactor(addWallZmin, grid, bcObst,Interactor3D::SOLID));
-      sd.addInteractor(addWallZminInt);
-
-      sd.deleteSolidBlocks();
-      if(myid == 0) UBLOG(logINFO,"deleteSolidBlocks - end");	      
-      
-      if (refineLevel > 0)
-      {
-         GbObject3DPtr refineCube1(new  GbCuboid3D(geoTFloor->getX1Minimum(), geoTFloor->getX2Minimum(), geoTFloor->getX3Minimum(), 
-            geoTFloor->getX1Maximum(), geoTFloor->getX2Maximum(), geoTFloor->getX3Maximum()));
-         GbSystem3D::writeGeoObject(refineCube1.get(),pathname + "/refineCube", WbWriterVtkXmlASCII::getInstance());
-
-         RefineCrossAndInsideGbObjectBlockVisitor refVisitor(refineCube1, baseLevel, refineLevel-1);
-         grid->accept(refVisitor);
-
-         RatioBlockVisitor ratioVisitor(refineLevel);
-         grid->accept(ratioVisitor);
-
-         RatioSmoothBlockVisitor ratioSmoothVisitor(refineLevel);
-         grid->accept(ratioSmoothVisitor);
-
-         OverlapBlockVisitor overlapVisitor(refineLevel);
-         grid->accept(overlapVisitor);
-      }
-
-      if(myid == 0) UBLOG(logINFO,"Write blocks - start");
-      grid->accept( metisVisitor );
-      if(myid == 0) grid->writeBlocks(pathname + "/blocks" + StringUtil::toString(myid), 0, WbWriterVtkXmlASCII::getInstance(), false);
-      if(myid == 0) UBLOG(logINFO,"Write blocks - end");
-
-      unsigned long nob = grid->getNumberOfBlocks();
-      unsigned long nod = nob * nodesPerBlock * nodesPerBlock *nodesPerBlock;
-      double availMem = 6.0e9;
-      double needMemAll  = double(nod*(27*sizeof(double) + sizeof(int))*2);
-      double needMem  = needMemAll / double(comm->getNumberOfProcesses());
-
-      if(myid == 0)
-      {
-         UBLOG(logINFO,"Number of blocks = " << nob);
-         UBLOG(logINFO,"Number of nodes  = " << nod);
-         UBLOG(logINFO,"Necessary memory  = " << needMemAll  << " bytes");
-         UBLOG(logINFO,"Necessary memory per process = " << needMem  << " bytes");
-         UBLOG(logINFO,"Available memory per process = " << availMem << " bytes");
-      }
-
-      //LBMKernel3DPtr kernel(new LBMKernelETD3Q27Cascaded(nodesPerBlock, nodesPerBlock, nodesPerBlock));
-      LBMKernel3DPtr kernel(new LBMKernelETD3Q27CascadedTI(nodesPerBlock, nodesPerBlock, nodesPerBlock));
-      BCProcessorPtr bcProc(new D3Q27ETBCProcessor());
-      kernel->setBCProcessor(bcProc);
-
-      SetKernelBlockVisitor kernelVisitor(kernel, nueLB, availMem, needMem);
-      //SetKernelBlockVisitor kernelVisitor(kernel, nueLB);
-      grid->accept(kernelVisitor);
-
-      if (refineLevel > 0)
-      {
-         std::vector<int> dirs;
-         D3Q27System::getLBMDirections(dirs);
-         SetInterpolationDirsBlockVisitor interDirsVisitor(dirs);
-         grid->accept(interDirsVisitor);
-
-         D3Q27SetUndefinedNodesBlockVisitor undefNodesVisitor;
-         grid->accept(undefNodesVisitor);
-      }
-
-      //discretization
-      //D3Q27TriFaceMeshInteractorPtr containerInt( new D3Q27TriFaceMeshInteractor(geoContainer, grid, bcObst,Interactor3D::SOLID));
-      //grid->addAndInitInteractor(containerInt);
-
-      D3Q27TriFaceMeshInteractorPtr tFloorInt( new D3Q27TriFaceMeshInteractor(geoTFloor, grid, bcObst,Interactor3D::SOLID));
-      grid->addAndInitInteractor(tFloorInt);
-
-      grid->addAndInitInteractor(addWallBlowerInt);
-      //grid->addAndInitInteractor(blowerInt);
-      grid->addAndInitInteractor(cargoInt);
-      //grid->addAndInitInteractor(paletteInt);
-      grid->addAndInitInteractor(addWallXmaxInt);
-      grid->addAndInitInteractor(addWallYmaxInt);
-      grid->addAndInitInteractor(addWallZmaxInt);
-      grid->addAndInitInteractor(addWallXminInt);
-      grid->addAndInitInteractor(addWallYminInt);
-      grid->addAndInitInteractor(addWallZminInt);
-
-      D3Q27InteractorPtr addWallBlowerXminInt(new D3Q27Interactor(addWallBlowerXmin, grid, bcObst,Interactor3D::SOLID));
-      grid->addAndInitInteractor(addWallBlowerXminInt);
-      
-      D3Q27InteractorPtr addWallBlowerXmaxInt(new D3Q27Interactor(addWallBlowerXmax, grid, bcObst,Interactor3D::SOLID));
-      grid->addAndInitInteractor(addWallBlowerXmaxInt);
-      
-      D3Q27InteractorPtr addWallBlowerYminInt(new D3Q27Interactor(addWallBlowerYmin, grid, bcObst,Interactor3D::SOLID));
-      grid->addAndInitInteractor(addWallBlowerYminInt);
-      
-      D3Q27InteractorPtr addWallBlowerYmaxInt(new D3Q27Interactor(addWallBlowerYmax, grid, bcObst,Interactor3D::SOLID));
-      grid->addAndInitInteractor(addWallBlowerYmaxInt);
-
-      //outflow
-      D3Q27BoundaryConditionAdapterPtr denBCAdapter(new D3Q27DensityBCAdapter(rhoLB));
-      D3Q27InteractorPtr outflowInt = D3Q27InteractorPtr( new D3Q27Interactor(geoOutflow, grid, denBCAdapter,Interactor3D::SOLID));
-      grid->addAndInitInteractor(outflowInt);
-
-      //inflow
-      double Cx = geoInflow->getX1Centroid();
-      double Hx = geoInflow->getLengthX1();
-      double Cy = geoInflow->getX2Centroid();
-      double Hy = geoInflow->getLengthX2();
-      mu::Parser fct = MathUtil::getDuctParaboloidZ(Cx,Hx,Cy,Hy,-uLB);
-      //mu::Parser fct;
-      //fct.SetExpr("vx3");
-      //fct.DefineConst("vx3", uLB);
-
-      D3Q27BoundaryConditionAdapterPtr velBCAdapter(new D3Q27VelocityBCAdapter (false, false ,true ,fct, 0, D3Q27BCFunction::INFCONST));
-      velBCAdapter->setSecondaryBcOption(2);
-      D3Q27InteractorPtr inflowInt  = D3Q27InteractorPtr( new D3Q27Interactor(geoInflow, grid, velBCAdapter, Interactor3D::SOLID));
-      grid->addAndInitInteractor(inflowInt);
-
-      //set connectors
-      D3Q27InterpolationProcessorPtr iProcessor(new D3Q27OffsetInterpolationProcessor());
-      D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
-      grid->accept( setConnsVisitor );
-
-      //domain decomposition
-      PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
-      grid->accept(pqPartVisitor);
-
-      //initialization of decompositions
-      D3Q27ETInitDistributionsBlockVisitor initVisitor(1.0);
-      grid->accept(initVisitor);
-
-
-      //Postrozess
-      //if(myid == 0) grid->writeBlocks(pathname + "/blocks" + StringUtil::toString(myid), 0, WbWriterVtkXmlASCII::getInstance(), false);
-
-      //std::vector< UbTupleFloat3 > nodes;
-      //std::vector< UbTupleInt2 >   lines;
-      //sphereInt->addQsLineSet(nodes, lines);
-      //WbWriterVtkXmlBinary::getInstance()->writeLines(pathname+"/qs",nodes,lines);
-
-      LBMUnitConverterPtr conv = LBMUnitConverterPtr(new LBMUnitConverter());
-      
-      UbSchedulerPtr geoSch(new UbScheduler(1));
-      D3Q27MacroscopicQuantitiesPostprocessorPtr ppgeo(
-           new D3Q27MacroscopicQuantitiesPostprocessor(grid, pathname + "/geo/nodes_geo", WbWriterVtkXmlBinary::getInstance(), 
-                                                       conv, geoSch, comm, true));
-      grid->doPostProcess(0);
-      ppgeo.reset();
-      geoSch.reset();
-      
-
-      if(myid == 0) UBLOG(logINFO,"Preprozess - end");      
-
-}
-      
-      LBMUnitConverterPtr conv = LBMUnitConverterPtr(new LBMUnitConverter());
-      //double outTime = 50000;
-      double outTime = 500;
-      UbSchedulerPtr visSch(new UbScheduler());
-      visSch->addSchedule(1000,1000,10000);
-      visSch->addSchedule(10000,10000,100000);
-      visSch->addSchedule(100000,100000,1000000);
-      D3Q27MacroscopicQuantitiesPostprocessor pp(grid, pathname + "/mq/nodes", WbWriterVtkXmlBinary::getInstance(), conv, visSch, comm);
-
-      //turbulence intensity postprocessor
-      UbSchedulerPtr tiSch(new UbScheduler());
-      tiSch->addSchedule(1000, 5000, 5000);
-      tiSch->addSchedule(10000, 50000, 50000);
-      tiSch->addSchedule(100000, 500000, 500000);
-      TurbulenceIntensityPostprocessor vp(grid, pathname + "/ti/TI", WbWriterVtkXmlBinary::getInstance(), tiSch, comm);
-
-      double endTime = 1000001;
-      //double endTime = 1001.0;
-      UbSchedulerPtr upSch(new UbScheduler(1));
-      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, upSch));
-      if(myid == 0) UBLOG(logINFO,"Simulation-start");
-      calculation->calculate();
-      if(myid == 0) UBLOG(logINFO,"Simulation-end");
-   }
-   catch(std::exception& e)
-   {
-      cerr << e.what() << endl << flush;
-   }
-   catch(std::string& s)
-   {
-      cerr << s << endl;
-   }
-   catch(...)
-   {
-      cerr << "unknown exception" << endl;
-   }
-
-}
-int main(int argc, char* argv[])
-{
-
-   run(argv[1]);
-
-   return 0;
-}
-
+#include <iostream>
+#include <string>
+
+#include "geometry3d/CoordinateTransformation3D.h"
+#include "Grid3D.h"
+#include "GenBlocksGridVisitor.h"
+#include "geometry3d/GbSystem3D.h"
+#include "geometry3d/GbCuboid3D.h"
+#include "geometry3d/GbCylinder3D.h"
+#include <geometry3d/GbSphere3D.h>
+#include "basics/writer/WbWriterVtkXmlASCII.h"
+#include "basics/writer/WbWriterVtkXmlBinary.h"
+#include "RefineCrossAndInsideGbObjectBlockVisitor.h"
+#include "RatioBlockVisitor.h"
+#include "RatioSmoothBlockVisitor.h"
+#include "OverlapBlockVisitor.h"
+#include "RefineInterGbObjectsVisitor.h"
+#include "RefineCrossAndInsideGbObjectBlockVisitor.h"
+#include "SetKernelBlockVisitor.h"
+#include "LBMKernelETD3Q27Cascaded.h"
+#include "D3Q27MacroscopicQuantitiesPostprocessor.h"
+#include "MPICommunicator.h"
+#include "D3Q27ETBCProcessor.h"
+#include "SimulationParameters.h"
+#include "D3Q27SetUndefinedNodesBlockVisitor.h"
+#include "SetInterpolationDirsBlockVisitor.h"
+#include "D3Q27SetConnectorsBlockVisitor.h"
+#include "NullCommunicator.h"
+#include "D3Q27ETInitDistributionsBlockVisitor.h"
+#include "CalculationManager.h"
+#include "PQueuePartitioningGridVisitor.h"
+#include "MetisPartitioningGridVisitor.h"
+#include "D3Q27Interactor.h"
+#include "D3Q27NoSlipBCAdapter.h"
+#include "D3Q27VelocityBCAdapter.h"
+#include "D3Q27DensityBCAdapter.h"
+#include "D3Q27BoundaryConditionAdapter.h"
+#include "StringUtil.hpp"
+#include "D3Q27OffsetInterpolationProcessor.h"
+#include "D3Q27CompactInterpolationProcessor.h"
+#include "SyncBcBlockVisitor.h"
+#include "geometry3d/creator/GbTriFaceMesh3DCreator.h"
+#include "geometry3d/GbTriFaceMesh3D.h"
+#include "D3Q27TriFaceMeshInteractor.h"
+#include "MathUtil.hpp"
+#include "SolidBlocksHelper.h"
+#include "LBMKernelETD3Q27CascadedTI.h"
+#include "TurbulenceIntensityPostprocessor.h"
+#include "RestartPostprocessor.h"
+
+using namespace std;
+
+
+void run(const char *cstr)
+{
+   try
+   {
+      string pathname = "c:/temp/reefer/out";
+      string pathGeo = "c:/Data/reefer";
+
+      //string pathname = "/work/koskuche/scratch/reefer2/out";
+      //string pathGeo = "/home/koskuche/data/reefer/new";
+
+      //string pathname = "/home/kucher/temp/reefer/out";
+      //string pathGeo = "/home/kucher/data/reefer/new";
+
+      int numOfThreads = 2;
+      
+      CommunicatorPtr comm(new MPICommunicator());
+      int myid = comm->getProcessID();
+
+      //if(myid ==0)
+      //{
+      //   stringstream logFilename;
+      //   logFilename <<  "/work/koskuche/scratch/reefer2/logfile.log";
+      //   UbLog::output_policy::setStream(logFilename.str());
+      //}
+
+      //const double dx = 13.6;
+      const double dx = 2.0;
+      double refLentgthWorld = dx/1000.0; //from mm to m
+      double refLentgthLB = 1.0;
+      LBMUnitConverterPtr uconv = LBMUnitConverterPtr(new LBMUnitConverter(refLentgthWorld, LBMUnitConverter::AIR_20C, refLentgthLB));
+      LBMReal uSI = 10;//m/s
+      LBMReal uLB = uSI * uconv->getFactorVelocityWToLb();
+      LBMReal rhoLB = 1.0;
+      LBMReal nueSI = 1.5e-5;
+      LBMReal nueLB = nueSI * uconv->getFactorViscosityWToLb();//(uLB*l)/Re;
+
+      Grid3DPtr grid(new Grid3D());
+      UbSchedulerPtr rSch(new UbScheduler(1500,5000));
+      RestartPostprocessor rp(grid, rSch, comm, pathname+"/checkpoints", RestartPostprocessor::BINARY);
+
+      std::string opt;
+
+      if(cstr!= NULL)
+         opt = std::string(cstr);
+
+      if(cstr!= NULL)
+      {
+         opt = std::string(cstr);
+
+         if(myid==0) UBLOG(logINFO,"Restart step: " << opt);
+
+         grid = rp.restart(UbSystem::stringTo<int>(opt));
+
+         LBMReal nueLB = 1.5e-3;
+         
+         SimulationParametersPtr param = SimulationParameters::getInstanz();
+         param->setCollisionModelType(SimulationParameters::COMPRESSIBLE);
+
+         //set connectors
+         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27OffsetInterpolationProcessor());
+         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
+         grid->accept( setConnsVisitor );
+
+         //domain decomposition
+         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
+         grid->accept(pqPartVisitor);
+      }
+      else
+      {
+      const int baseLevel = 0;
+      const int refineLevel = 0;
+      //////////////////////////////////////////////////////////////////////////
+      // Geometries
+      //////////////////////////////////////////////////////////////////////////
+      //container
+      GbTriFaceMesh3DPtr geoContainer (GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(pathGeo +"/Containerascii.stl","geoContainer"));
+      if(myid == 0) GbSystem3D::writeGeoObject(geoContainer.get(), pathname+"/geo/geoContainer", WbWriterVtkXmlASCII::getInstance());
+      //cargo
+      //GbTriFaceMesh3DPtr geoCargo (GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(pathGeo + "/Kisten_fuer_Palettenascii.stl","geoCargo"));
+      GbTriFaceMesh3DPtr geoCargo (GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(pathGeo + "/Kistenascii.stl","geoCargo"));
+      if(myid == 0) GbSystem3D::writeGeoObject(geoCargo.get(), pathname+"/geo/geoCargo", WbWriterVtkXmlASCII::getInstance());
+      //palette
+      //GbTriFaceMesh3DPtr geoPalette (GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(pathGeo + "/Palettenascii.stl","geoPalette"));
+      //if(myid == 0) GbSystem3D::writeGeoObject(geoPalette.get(), pathname+"/geoPalette", WbWriterVtkXmlASCII::getInstance());
+      //reefer
+      GbTriFaceMesh3DPtr geoBlower (GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(pathGeo + "/Solidblockascii.stl","geoReefer"));
+      if(myid == 0) GbSystem3D::writeGeoObject(geoBlower.get(), pathname+"/geo/geoBlower", WbWriterVtkXmlASCII::getInstance());
+      //T floor
+      GbTriFaceMesh3DPtr geoTFloor (GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(pathGeo + "/T-Floorascii.stl","geoTFloor"));
+      if(myid == 0) GbSystem3D::writeGeoObject(geoTFloor.get(), pathname+"/geo/geoTFloor", WbWriterVtkXmlASCII::getInstance());
+
+      //bounding box
+      double g_minX1 = geoContainer->getX1Minimum();
+      double g_minX2 = geoContainer->getX2Minimum();
+      double g_minX3 = geoContainer->getX3Minimum();
+
+      double g_maxX1 = geoContainer->getX1Maximum();
+      double g_maxX2 = geoContainer->getX2Maximum();
+      double g_maxX3 = geoContainer->getX3Maximum();
+
+      const int nodesPerBlock = 10;
+      //const double dx = 1.7;
+      //const double dx = 13.6;
+      const double blockLength = double(nodesPerBlock)*dx;
+
+      const double gridOriginX1 = g_minX1;
+      const double gridOriginX2 = g_minX2;
+      const double gridOriginX3 = g_minX3;
+
+      //add wall X
+      GbCuboid3DPtr addWallXmax (new GbCuboid3D(g_maxX1, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength));
+      //GbCuboid3DPtr addWallXmax (new GbCuboid3D(geoBlower->getX1Maximum()+geoBlower->getLengthX1(), g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength));
+      if(myid == 0) GbSystem3D::writeGeoObject(addWallXmax.get(), pathname+"/geo/addWallXmax", WbWriterVtkXmlASCII::getInstance());
+      //add wall Y
+      GbCuboid3DPtr addWallYmax (new GbCuboid3D(g_minX1-blockLength, geoBlower->getX2Maximum(), g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength));
+      if(myid == 0) GbSystem3D::writeGeoObject(addWallYmax.get(), pathname+"/geo/addWallYmax", WbWriterVtkXmlASCII::getInstance());
+      //add wall Z
+      GbCuboid3DPtr addWallZmax (new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_maxX3, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength));
+      if(myid == 0) GbSystem3D::writeGeoObject(addWallZmax.get(), pathname+"/geo/addWallZmax", WbWriterVtkXmlASCII::getInstance());
+      //add wall X
+      GbCuboid3DPtr addWallXmin (new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3-blockLength, geoBlower->getX1Minimum(), g_maxX2+blockLength, g_maxX3+blockLength));
+      if(myid == 0) GbSystem3D::writeGeoObject(addWallXmin.get(), pathname+"/geo/addWallXmin", WbWriterVtkXmlASCII::getInstance());
+      //add wall Y
+      GbCuboid3DPtr addWallYmin (new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, geoBlower->getX2Minimum(), g_maxX3+blockLength));
+      if(myid == 0) GbSystem3D::writeGeoObject(addWallYmin.get(), pathname+"/geo/addWallYmin", WbWriterVtkXmlASCII::getInstance());
+      //add wall Z
+      GbCuboid3DPtr addWallZmin (new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, geoTFloor->getX3Minimum()));
+      if(myid == 0) GbSystem3D::writeGeoObject(addWallZmin.get(), pathname+"/geo/addWallZmin", WbWriterVtkXmlASCII::getInstance());
+      //add wall for blower
+      GbCuboid3DPtr addWallBlower (new GbCuboid3D(geoBlower->getX1Minimum()-3.0*blockLength, geoBlower->getX2Minimum()-3.0*blockLength, geoBlower->getX3Minimum()+4.0*dx, 
+                                                  geoBlower->getX1Maximum(), geoBlower->getX2Maximum()+3.0*blockLength, geoBlower->getX3Maximum()-4.0*dx));
+      if(myid == 0) GbSystem3D::writeGeoObject(addWallBlower.get(), pathname+"/geo/addWallBlower", WbWriterVtkXmlASCII::getInstance());
+
+      GbCuboid3DPtr addWallBlowerXmin (new GbCuboid3D(geoBlower->getX1Minimum(), geoBlower->getX2Minimum(), geoBlower->getX3Minimum(), 
+                                       geoBlower->getX1Minimum()+2.0*dx, geoBlower->getX2Maximum(), geoBlower->getX3Maximum()));
+      if(myid == 0) GbSystem3D::writeGeoObject(addWallBlowerXmin.get(), pathname+"/geo/addWallBlowerXmin", WbWriterVtkXmlASCII::getInstance());
+
+      GbCuboid3DPtr addWallBlowerXmax (new GbCuboid3D(geoBlower->getX1Maximum()-2.0*dx, geoBlower->getX2Minimum(), geoBlower->getX3Minimum(), 
+                                                      geoBlower->getX1Maximum(), geoBlower->getX2Maximum(), geoBlower->getX3Maximum()));
+      if(myid == 0) GbSystem3D::writeGeoObject(addWallBlowerXmax.get(), pathname+"/geo/addWallBlowerXmax", WbWriterVtkXmlASCII::getInstance());
+
+      GbCuboid3DPtr addWallBlowerYmin (new GbCuboid3D(geoBlower->getX1Minimum(), geoBlower->getX2Minimum(), geoBlower->getX3Minimum(), 
+                                                      geoBlower->getX1Maximum(), geoBlower->getX2Minimum()+2.0*dx, geoBlower->getX3Maximum()));
+      if(myid == 0) GbSystem3D::writeGeoObject(addWallBlowerYmin.get(), pathname+"/geo/addWallBlowerYmin", WbWriterVtkXmlASCII::getInstance());
+
+      GbCuboid3DPtr addWallBlowerYmax (new GbCuboid3D(geoBlower->getX1Minimum()-2.0*dx, geoBlower->getX2Maximum()-2.0*dx, geoBlower->getX3Minimum(), 
+                                                      geoBlower->getX1Maximum(), geoBlower->getX2Maximum(), geoBlower->getX3Maximum()));
+      if(myid == 0) GbSystem3D::writeGeoObject(addWallBlowerYmax.get(), pathname+"/geo/addWallBlowerYmax", WbWriterVtkXmlASCII::getInstance());
+
+      //inflow
+      GbCuboid3DPtr geoInflow (new GbCuboid3D(geoBlower->getX1Minimum()+dx, geoBlower->getX2Minimum()+dx, geoBlower->getX3Minimum()+2.0*dx, 
+                                              geoBlower->getX1Maximum()-dx, geoBlower->getX2Maximum()-dx, geoBlower->getX3Minimum()+4.0*dx));
+      if(myid == 0) GbSystem3D::writeGeoObject(geoInflow.get(), pathname+"/geo/geoInflow", WbWriterVtkXmlASCII::getInstance());
+
+      //outflow
+      GbCuboid3DPtr geoOutflow (new GbCuboid3D(geoBlower->getX1Minimum()+2.0*dx, geoBlower->getX2Minimum()+2.0*dx, geoBlower->getX3Maximum()-4.0*dx, 
+                                               geoBlower->getX1Maximum()-2.0*dx, geoBlower->getX2Maximum()-2.0*dx, geoBlower->getX3Maximum()-2.0*dx));
+      if(myid == 0) GbSystem3D::writeGeoObject(geoOutflow.get(), pathname+"/geo/geoOutflow", WbWriterVtkXmlASCII::getInstance());
+
+      //simulation parameters
+      double lSI = g_maxX2 - g_minX2;
+      double lLB = lSI / dx;
+      //double refLentgthWorld = blockLength/1000.0; //from mm to m
+      //double refLentgthLB = double(nodesPerBlock);
+      //LBMUnitConverterPtr uconv = LBMUnitConverterPtr(new LBMUnitConverter(refLentgthWorld, LBMUnitConverter::AIR_20C, refLentgthLB));
+      //LBMReal uSI = 10;//m/s
+      //LBMReal uLB = uSI * uconv->getFactorVelocityWToLb();
+      //LBMReal rhoLB = 1.0;
+      //LBMReal nueSI = 1.5e-5;
+      //LBMReal nueLB = nueSI * uconv->getFactorViscosityWToLb();//(uLB*l)/Re;
+      //LBMReal nueLB = 1.5e-3;
+      LBMReal Re = (uLB*(420/dx))/nueLB;
+
+      if(myid ==0)
+      {
+         UBLOG(logINFO,"grid = " <<int((g_maxX1 - g_minX1)/dx)<<"x"<<int((g_maxX2 - g_minX2)/dx) << "x"<<int((g_maxX3 - g_minX3)/dx));
+         UBLOG(logINFO,"dx = " << dx);
+         UBLOG(logINFO,"nodes per block = " << nodesPerBlock);
+         UBLOG(logINFO,"block length = " << blockLength << "mm");
+         UBLOG(logINFO,"v = " << uLB );
+         UBLOG(logINFO,"rho = " << rhoLB );
+         UBLOG(logINFO,"nue = " << nueLB );
+         UBLOG(logINFO,"Re = " << Re );
+         UBLOG(logINFO,"Preprozess - start");
+      }
+
+      SimulationParametersPtr param = SimulationParameters::getInstanz();
+      param->setCollisionModelType(SimulationParameters::COMPRESSIBLE);
+      param->setRho(rhoLB);
+      param->setVelocityX(uLB);
+      param->setViscosity(nueLB);
+      
+      //set grid
+      //Grid3DPtr grid(new Grid3D());
+      grid->setDeltaX(dx);
+      grid->setBlockNX(nodesPerBlock, nodesPerBlock, nodesPerBlock);
+      
+      GbObject3DPtr gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
+      if(myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), pathname+"/gridCube", WbWriterVtkXmlASCII::getInstance());
+
+      GenBlocksGridVisitor genBlocks;
+      genBlocks.addGeoObject(gridCube);
+      grid->accept(genBlocks);
+
+      MetisPartitioningGridVisitor metisVisitor(numOfThreads, D3Q27System::B, comm, false);
+      grid->accept( metisVisitor );
+
+      SolidBlocksHelper sd(grid, comm);
+
+      //iteractors
+      int bbOption1 = 0; //0=simple Bounce Back, 1=quadr. BB
+      D3Q27BoundaryConditionAdapterPtr bcObst(new D3Q27NoSlipBCAdapter(bbOption1));
+
+      D3Q27TriFaceMeshInteractorPtr cargoInt( new D3Q27TriFaceMeshInteractor(geoCargo, grid, bcObst,Interactor3D::SOLID));
+      sd.addInteractor(cargoInt);
+
+      D3Q27InteractorPtr addWallBlowerInt(new D3Q27Interactor(addWallBlower, grid, bcObst,Interactor3D::SOLID));
+
+      sd.addInteractor(addWallBlowerInt);
+
+      //D3Q27TriFaceMeshInteractorPtr paletteInt( new D3Q27TriFaceMeshInteractor(geoPalette, grid, bcObst,Interactor3D::SOLID));
+      //sd.addInteractor(paletteInt);
+
+      D3Q27InteractorPtr addWallXmaxInt(new D3Q27Interactor(addWallXmax, grid, bcObst,Interactor3D::SOLID));
+      sd.addInteractor(addWallXmaxInt);
+
+      D3Q27InteractorPtr addWallYmaxInt(new D3Q27Interactor(addWallYmax, grid, bcObst,Interactor3D::SOLID));
+      sd.addInteractor(addWallYmaxInt);
+
+      D3Q27InteractorPtr addWallZmaxInt(new D3Q27Interactor(addWallZmax, grid, bcObst,Interactor3D::SOLID));
+      sd.addInteractor(addWallZmaxInt);
+
+      D3Q27InteractorPtr addWallXminInt(new D3Q27Interactor(addWallXmin, grid, bcObst,Interactor3D::SOLID));
+      sd.addInteractor(addWallXminInt);
+
+      D3Q27InteractorPtr addWallYminInt(new D3Q27Interactor(addWallYmin, grid, bcObst,Interactor3D::SOLID));
+      sd.addInteractor(addWallYminInt);
+
+      D3Q27InteractorPtr addWallZminInt(new D3Q27Interactor(addWallZmin, grid, bcObst,Interactor3D::SOLID));
+      sd.addInteractor(addWallZminInt);
+
+      sd.deleteSolidBlocks();
+      if(myid == 0) UBLOG(logINFO,"deleteSolidBlocks - end");	      
+      
+      if (refineLevel > 0)
+      {
+         GbObject3DPtr refineCube1(new  GbCuboid3D(geoTFloor->getX1Minimum(), geoTFloor->getX2Minimum(), geoTFloor->getX3Minimum(), 
+            geoTFloor->getX1Maximum(), geoTFloor->getX2Maximum(), geoTFloor->getX3Maximum()));
+         GbSystem3D::writeGeoObject(refineCube1.get(),pathname + "/refineCube", WbWriterVtkXmlASCII::getInstance());
+
+         RefineCrossAndInsideGbObjectBlockVisitor refVisitor(refineCube1, baseLevel, refineLevel-1);
+         grid->accept(refVisitor);
+
+         RatioBlockVisitor ratioVisitor(refineLevel);
+         grid->accept(ratioVisitor);
+
+         RatioSmoothBlockVisitor ratioSmoothVisitor(refineLevel);
+         grid->accept(ratioSmoothVisitor);
+
+         OverlapBlockVisitor overlapVisitor(refineLevel);
+         grid->accept(overlapVisitor);
+      }
+
+      if(myid == 0) UBLOG(logINFO,"Write blocks - start");
+      grid->accept( metisVisitor );
+      if(myid == 0) grid->writeBlocks(pathname + "/blocks" + StringUtil::toString(myid), 0, WbWriterVtkXmlASCII::getInstance(), false);
+      if(myid == 0) UBLOG(logINFO,"Write blocks - end");
+
+      unsigned long nob = grid->getNumberOfBlocks();
+      unsigned long nod = nob * nodesPerBlock * nodesPerBlock *nodesPerBlock;
+      double availMem = 6.0e9;
+      double needMemAll  = double(nod*(27*sizeof(double) + sizeof(int))*2);
+      double needMem  = needMemAll / double(comm->getNumberOfProcesses());
+
+      if(myid == 0)
+      {
+         UBLOG(logINFO,"Number of blocks = " << nob);
+         UBLOG(logINFO,"Number of nodes  = " << nod);
+         UBLOG(logINFO,"Necessary memory  = " << needMemAll  << " bytes");
+         UBLOG(logINFO,"Necessary memory per process = " << needMem  << " bytes");
+         UBLOG(logINFO,"Available memory per process = " << availMem << " bytes");
+      }
+
+      //LBMKernel3DPtr kernel(new LBMKernelETD3Q27Cascaded(nodesPerBlock, nodesPerBlock, nodesPerBlock));
+      LBMKernel3DPtr kernel(new LBMKernelETD3Q27CascadedTI(nodesPerBlock, nodesPerBlock, nodesPerBlock));
+      BCProcessorPtr bcProc(new D3Q27ETBCProcessor());
+      kernel->setBCProcessor(bcProc);
+
+      SetKernelBlockVisitor kernelVisitor(kernel, nueLB, availMem, needMem);
+      //SetKernelBlockVisitor kernelVisitor(kernel, nueLB);
+      grid->accept(kernelVisitor);
+
+      if (refineLevel > 0)
+      {
+         std::vector<int> dirs;
+         D3Q27System::getLBMDirections(dirs);
+         SetInterpolationDirsBlockVisitor interDirsVisitor(dirs);
+         grid->accept(interDirsVisitor);
+
+         D3Q27SetUndefinedNodesBlockVisitor undefNodesVisitor;
+         grid->accept(undefNodesVisitor);
+      }
+
+      //discretization
+      //D3Q27TriFaceMeshInteractorPtr containerInt( new D3Q27TriFaceMeshInteractor(geoContainer, grid, bcObst,Interactor3D::SOLID));
+      //grid->addAndInitInteractor(containerInt);
+
+      D3Q27TriFaceMeshInteractorPtr tFloorInt( new D3Q27TriFaceMeshInteractor(geoTFloor, grid, bcObst,Interactor3D::SOLID));
+      grid->addAndInitInteractor(tFloorInt);
+
+      grid->addAndInitInteractor(addWallBlowerInt);
+      //grid->addAndInitInteractor(blowerInt);
+      grid->addAndInitInteractor(cargoInt);
+      //grid->addAndInitInteractor(paletteInt);
+      grid->addAndInitInteractor(addWallXmaxInt);
+      grid->addAndInitInteractor(addWallYmaxInt);
+      grid->addAndInitInteractor(addWallZmaxInt);
+      grid->addAndInitInteractor(addWallXminInt);
+      grid->addAndInitInteractor(addWallYminInt);
+      grid->addAndInitInteractor(addWallZminInt);
+
+      D3Q27InteractorPtr addWallBlowerXminInt(new D3Q27Interactor(addWallBlowerXmin, grid, bcObst,Interactor3D::SOLID));
+      grid->addAndInitInteractor(addWallBlowerXminInt);
+      
+      D3Q27InteractorPtr addWallBlowerXmaxInt(new D3Q27Interactor(addWallBlowerXmax, grid, bcObst,Interactor3D::SOLID));
+      grid->addAndInitInteractor(addWallBlowerXmaxInt);
+      
+      D3Q27InteractorPtr addWallBlowerYminInt(new D3Q27Interactor(addWallBlowerYmin, grid, bcObst,Interactor3D::SOLID));
+      grid->addAndInitInteractor(addWallBlowerYminInt);
+      
+      D3Q27InteractorPtr addWallBlowerYmaxInt(new D3Q27Interactor(addWallBlowerYmax, grid, bcObst,Interactor3D::SOLID));
+      grid->addAndInitInteractor(addWallBlowerYmaxInt);
+
+      //outflow
+      D3Q27BoundaryConditionAdapterPtr denBCAdapter(new D3Q27DensityBCAdapter(rhoLB));
+      D3Q27InteractorPtr outflowInt = D3Q27InteractorPtr( new D3Q27Interactor(geoOutflow, grid, denBCAdapter,Interactor3D::SOLID));
+      grid->addAndInitInteractor(outflowInt);
+
+      //inflow
+      double Cx = geoInflow->getX1Centroid();
+      double Hx = geoInflow->getLengthX1();
+      double Cy = geoInflow->getX2Centroid();
+      double Hy = geoInflow->getLengthX2();
+      mu::Parser fct = MathUtil::getDuctParaboloidZ(Cx,Hx,Cy,Hy,-uLB);
+      //mu::Parser fct;
+      //fct.SetExpr("vx3");
+      //fct.DefineConst("vx3", uLB);
+
+      D3Q27BoundaryConditionAdapterPtr velBCAdapter(new D3Q27VelocityBCAdapter (false, false ,true ,fct, 0, D3Q27BCFunction::INFCONST));
+      velBCAdapter->setSecondaryBcOption(2);
+      D3Q27InteractorPtr inflowInt  = D3Q27InteractorPtr( new D3Q27Interactor(geoInflow, grid, velBCAdapter, Interactor3D::SOLID));
+      grid->addAndInitInteractor(inflowInt);
+
+      //set connectors
+      D3Q27InterpolationProcessorPtr iProcessor(new D3Q27OffsetInterpolationProcessor());
+      D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
+      grid->accept( setConnsVisitor );
+
+      //domain decomposition
+      PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
+      grid->accept(pqPartVisitor);
+
+      //initialization of decompositions
+      D3Q27ETInitDistributionsBlockVisitor initVisitor(1.0);
+      grid->accept(initVisitor);
+
+
+      //Postrozess
+      //if(myid == 0) grid->writeBlocks(pathname + "/blocks" + StringUtil::toString(myid), 0, WbWriterVtkXmlASCII::getInstance(), false);
+
+      //std::vector< UbTupleFloat3 > nodes;
+      //std::vector< UbTupleInt2 >   lines;
+      //sphereInt->addQsLineSet(nodes, lines);
+      //WbWriterVtkXmlBinary::getInstance()->writeLines(pathname+"/qs",nodes,lines);
+
+      LBMUnitConverterPtr conv = LBMUnitConverterPtr(new LBMUnitConverter());
+      
+      UbSchedulerPtr geoSch(new UbScheduler(1));
+      D3Q27MacroscopicQuantitiesPostprocessorPtr ppgeo(
+           new D3Q27MacroscopicQuantitiesPostprocessor(grid, pathname + "/geo/nodes_geo", WbWriterVtkXmlBinary::getInstance(), 
+                                                       conv, geoSch, comm, true));
+      grid->doPostProcess(0);
+      ppgeo.reset();
+      geoSch.reset();
+      
+
+      if(myid == 0) UBLOG(logINFO,"Preprozess - end");      
+
+}
+      
+      LBMUnitConverterPtr conv = LBMUnitConverterPtr(new LBMUnitConverter());
+      //double outTime = 50000;
+      double outTime = 500;
+      UbSchedulerPtr visSch(new UbScheduler());
+      visSch->addSchedule(1000,1000,10000);
+      visSch->addSchedule(10000,10000,100000);
+      visSch->addSchedule(100000,100000,1000000);
+      D3Q27MacroscopicQuantitiesPostprocessor pp(grid, pathname + "/mq/nodes", WbWriterVtkXmlBinary::getInstance(), conv, visSch, comm);
+
+      //turbulence intensity postprocessor
+      UbSchedulerPtr tiSch(new UbScheduler());
+      tiSch->addSchedule(1000, 5000, 5000);
+      tiSch->addSchedule(10000, 50000, 50000);
+      tiSch->addSchedule(100000, 500000, 500000);
+      TurbulenceIntensityPostprocessor vp(grid, pathname + "/ti/TI", WbWriterVtkXmlBinary::getInstance(), tiSch, comm);
+
+      double endTime = 1000001;
+      //double endTime = 1001.0;
+      UbSchedulerPtr upSch(new UbScheduler(1));
+      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, upSch));
+      if(myid == 0) UBLOG(logINFO,"Simulation-start");
+      calculation->calculate();
+      if(myid == 0) UBLOG(logINFO,"Simulation-end");
+   }
+   catch(std::exception& e)
+   {
+      cerr << e.what() << endl << flush;
+   }
+   catch(std::string& s)
+   {
+      cerr << s << endl;
+   }
+   catch(...)
+   {
+      cerr << "unknown exception" << endl;
+   }
+
+}
+int main(int argc, char* argv[])
+{
+
+   run(argv[1]);
+
+   return 0;
+}
+
diff --git a/apps/cpu/sbone/CMakeLists.txt b/apps/cpu/sbone/CMakeLists.txt
index 883dab362fb5313d52af2ed81c0e9f15e6580a0c..42b4cbee942142b119ff4892a78894e0211c9feb 100644
--- a/apps/cpu/sbone/CMakeLists.txt
+++ b/apps/cpu/sbone/CMakeLists.txt
@@ -1,25 +1,25 @@
-CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
-
-########################################################
-## C++ PROJECT                                       ###
-########################################################
-PROJECT(sbone)
-
-INCLUDE(${SOURCE_ROOT}/lib/IncludsList.txt) 
-
-#################################################################
-###   LOCAL FILES                                             ###
-#################################################################
-FILE(GLOB SPECIFIC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.h
-                         ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
-                         ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp  )
- 
-SET(ALL_SOURCES ${ALL_SOURCES} ${SPECIFIC_FILES})
-SOURCE_GROUP(src FILES ${SPECIFIC_FILES})
-  
-SET(CAB_ADDITIONAL_LINK_LIBRARIES vfluids)
-
-#################################################################
-###   CREATE PROJECT                                          ###
-#################################################################
-CREATE_CAB_PROJECT(sbone BINARY)
+CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
+
+########################################################
+## C++ PROJECT                                       ###
+########################################################
+PROJECT(sbone)
+
+INCLUDE(${SOURCE_ROOT}/lib/IncludsList.txt) 
+
+#################################################################
+###   LOCAL FILES                                             ###
+#################################################################
+FILE(GLOB SPECIFIC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.h
+                         ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
+                         ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp  )
+ 
+SET(ALL_SOURCES ${ALL_SOURCES} ${SPECIFIC_FILES})
+SOURCE_GROUP(src FILES ${SPECIFIC_FILES})
+  
+SET(CAB_ADDITIONAL_LINK_LIBRARIES vfluids)
+
+#################################################################
+###   CREATE PROJECT                                          ###
+#################################################################
+CREATE_CAB_PROJECT(sbone BINARY)
diff --git a/apps/cpu/sbone/sbone.cpp b/apps/cpu/sbone/sbone.cpp
index 2d404cee86f0e2dd895655c3c82397ad52a4ab33..845994925ff18b01189898ad59ebdaab9d851f65 100644
--- a/apps/cpu/sbone/sbone.cpp
+++ b/apps/cpu/sbone/sbone.cpp
@@ -1,421 +1,421 @@
-#include <iostream>
-#include <string>
-
-#include <vfluids.h>
-
-using namespace std;
-
-
-void sbonepd(const char *configname)
-{
-   try
-   {
-
-      string machine = QUOTEME(CAB_MACHINE);
-      string pathname, pathGeo; 
-      int numOfThreads;
-      double availMem;
-
-      ConfigFileReader cf(configname);
-      if (!cf.read())
-      {
-         std::string exceptionText = "Unable to read configuration file\n";
-         throw exceptionText;
-      }
-
-      CommunicatorPtr comm = MPICommunicator::getInstance();
-      int myid = comm->getProcessID();
-
-      if(machine == "BOMBADIL") 
-      {
-         numOfThreads = 4;
-         pathname = "d:/temp/sbone2";
-         pathGeo = "d:/Data/Bone/SmallBone";
-         availMem = 3.0e9;
-      }
-      else if(machine == "M01" || machine == "M02")      
-      {
-         numOfThreads = 8;
-         pathname = cf.getValue("pathname"); //"/work/koskuche/Bone/SmallBone";
-         pathGeo = cf.getValue("pathGeo"); //"/home/koskuche/data/Bone/SmallBone/vti";
-         availMem = 1.0e9;
-
-#if defined(__unix__)
-         if (myid == 0)
-         {
-            const char* str = pathname.c_str();
-            int status = mkdir(str, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
-         }
-#endif 
-
-         if(myid ==0)
-         {
-            stringstream logFilename;
-            logFilename <<  pathname + "/logfile"+UbSystem::toString(UbSystem::getTimeStamp())+".txt";
-            UbLog::output_policy::setStream(logFilename.str());
-         }
-      }
-      else throw UbException(UB_EXARGS, "unknown CAB_MACHINE");
-
-      if(myid==0) UBLOG(logINFO,"Testcase small bone");
-
-      //string boneFileName = pathGeo + "/sbone.stl";
-      string boneFileName = pathGeo + "/boneimage.vti";
-
-      double dx = 3.5e-3/175.0;
-
-      const int blocknx1 = 16;
-      const int blocknx2 = 16;
-      const int blocknx3 = 16;
-
-      LBMReal rho_LB = 0.0;
-      //nueWasser = 1e-6 m^2/s
-      double nu_real = 1e-6;
-      LBMReal dt = 5e-8; // s (frei gewählt)
-      //dx - frei gewählt
-      //
-      LBMReal nu_LB = nu_real/(dx*dx/dt);
-
-
-      //dp = 50000 Pa - 0 Pa = 50000 Pa
-      double dp_real = UbSystem::stringTo<double>(cf.getValue("pressure")); //5000;
-      //rho wasser = 1000 kg*m^-3
-      double rho_real = 1000;
-      //dp/rho = 50000/1000 = 50 m^2/s^2
-      double dp_div_rho_real = dp_real/rho_real;
-
-      double dp_LB = dp_div_rho_real/((dx/dt)*(dx/dt));
-
-      bool with_forcing = false;
-
-      double rhoLBinflow;
-      if (with_forcing)
-      {
-         rhoLBinflow = 0.0;
-      } 
-      else
-      {
-         rhoLBinflow = dp_LB*3.0;
-      }
-
-      LBMUnitConverterPtr conv = LBMUnitConverterPtr(new LBMUnitConverter());
-
-      const int baseLevel = 0;
-      const int refineLevel = 0;
-
-
-      //////////////////////////////////////////////////////////////////////////
-      //bone STL
-      //GbTriFaceMesh3DPtr bone (GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(boneFileName,"Netz"));
-      //if(myid == 0) GbSystem3D::writeGeoObject( bone.get(), pathname+"/geo/bone", WbWriterVtkXmlBinary::getInstance() );
-
-      string boneFilename = pathGeo + "/boneimage.vti";
-
-      int pmNX1=151;  //abmessung einzelbild in x-richtung
-      int pmNX2=101; //abmessung einzelbild in y richtung
-      int pmNX3=101; //anzahl der bilder
-      float lthreshold = 1.0;
-      float uthreshold = 255.0;
-
-      GbVoxelMatrix3DPtr bone(new GbVoxelMatrix3D(pmNX1,pmNX2,pmNX3,0,lthreshold,uthreshold));
-      bone->readMatrixFromVtiASCIIFile(boneFilename);
-      bone->setVoxelMatrixMininum(11.5, 8.01, 5.01);
-
-      double deltax = dx*1e3;
-      double deltaVoxel = 11e-3;
-      bone->setVoxelMatrixDelta(deltaVoxel, deltaVoxel, deltaVoxel);
-      bone->setLbGridDx(deltax);
-
-      if(myid == 0) bone->writeToLegacyVTKBinary(pathname+"/geo/bone");
-
-      //bounding box
-      double g_minX1 = bone->getX1Minimum()-0.25;
-      double g_minX2 = bone->getX2Minimum()-0.25;
-      double g_minX3 = bone->getX3Minimum()-0.25;
-
-      double g_maxX1 = bone->getX1Maximum()+0.25;
-      double g_maxX2 = bone->getX2Maximum()+0.25;
-      double g_maxX3 = bone->getX3Maximum()+0.25;
-
-      double blockLength = (double)blocknx1*deltax;
-
-      //double h = g_maxX2/2.0;
-      //double dpLB = (rhoLBinflow - rhoLB)/3.0;
-
-      //
-      //double dex = g_maxX1+1.0;
-      //double Umax = (1.0/(2.0*nueLB))*(dpLB/dex)*(h*h);
-
-      //double Re = (4*h*Umax)/(3*nueLB);
-
-      Grid3DPtr grid(new Grid3D(comm));
-      grid->setPeriodicX1(false);
-      grid->setPeriodicX2(false);
-      grid->setPeriodicX3(false);
-      grid->setDeltaX(deltax);
-      grid->setBlockNX(blocknx1, blocknx2, blocknx3);
-
-      GbObject3DPtr gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
-      if(myid ==0) GbSystem3D::writeGeoObject(gridCube.get(),pathname + "/geo/gridCube", WbWriterVtkXmlBinary::getInstance());      
-
-
-      GenBlocksGridVisitor genBlocks(gridCube);
-      grid->accept(genBlocks);
-
-      double forcing = 0;
-      if (with_forcing)
-      {
-         forcing = dp_LB/(blocknx1*grid->getNX1());
-      }
-
-      if(myid ==0)
-      {
-         UBLOG(logINFO,"Parameters:");
-         UBLOG(logINFO,"with forcing = " << with_forcing );
-         UBLOG(logINFO,"rho_LB = " << rho_LB );
-         UBLOG(logINFO,"nu_LB = " << nu_LB );
-         UBLOG(logINFO,"dp_LB = " << dp_LB );
-         UBLOG(logINFO,"forcing = " << forcing );
-         UBLOG(logINFO,"dx = " << dx << " m");
-         UBLOG(logINFO,"dt = " << dt << " s");
-         UBLOG(logINFO,"rho_real = " << rho_real << " kg*m^-3" );
-         UBLOG(logINFO,"nu_real = " << nu_real << " m^2/s" );
-         UBLOG(logINFO,"dp_real = " << dp_real << " Pa" );
-
-         UBLOG(logINFO,"number of levels = " << refineLevel+1 );
-         UBLOG(logINFO,"numOfThreads = " << numOfThreads );
-         UBLOG(logINFO,"path = " << pathname );
-         UBLOG(logINFO,"Preprozess - start");
-      }
-
-      //walls
-      GbCuboid3DPtr addWallYmin (new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_minX2, g_maxX3+blockLength));
-      if(myid == 0) GbSystem3D::writeGeoObject(addWallYmin.get(), pathname+"/geo/addWallYmin", WbWriterVtkXmlASCII::getInstance());
-
-      GbCuboid3DPtr addWallYmax (new GbCuboid3D(g_minX1-blockLength, g_maxX2, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength));
-      if(myid == 0) GbSystem3D::writeGeoObject(addWallYmax.get(), pathname+"/geo/addWallYmax", WbWriterVtkXmlASCII::getInstance());
-
-      GbCuboid3DPtr addWallZmin (new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_minX3));
-      if(myid == 0) GbSystem3D::writeGeoObject(addWallZmin.get(), pathname+"/geo/addWallZmin", WbWriterVtkXmlASCII::getInstance());
-
-      GbCuboid3DPtr addWallZmax (new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_maxX3, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength));
-      if(myid == 0) GbSystem3D::writeGeoObject(addWallYmax.get(), pathname+"/geo/addWallYmax", WbWriterVtkXmlASCII::getInstance());
-
-      //inflow
-      GbCuboid3DPtr geoInflow (new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3-blockLength, g_minX1, g_maxX2+blockLength, g_maxX3+blockLength));
-      if(myid == 0) GbSystem3D::writeGeoObject(geoInflow.get(), pathname+"/geo/geoInflow", WbWriterVtkXmlASCII::getInstance());
-
-      //outflow
-      GbCuboid3DPtr geoOutflow (new GbCuboid3D(g_maxX1, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength));
-      if(myid == 0) GbSystem3D::writeGeoObject(geoOutflow.get(), pathname+"/geo/geoOutflow", WbWriterVtkXmlASCII::getInstance());
-
-      BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm));
-
-
-      //   if (refineLevel > 0)
-      //   {
-      //      if(myid == 0) UBLOG(logINFO,"Refinement - start");	
-      //      RefineCrossAndInsideGbObjectHelper refineHelper(grid, refineLevel);
-      //      refineHelper.refine();
-      //      if(myid == 0) UBLOG(logINFO,"Refinement - end");	
-      //   }
-
-
-
-      //bone interactor
-      int bcOptionBone = 2; //0=simple Bounce Back, 1=quadr. BB, 2=thin wall
-      D3Q27BoundaryConditionAdapterPtr bcBone(new D3Q27NoSlipBCAdapter(bcOptionBone));
-
-      D3Q27InteractorPtr boneInt(new D3Q27Interactor(bone, grid, bcBone,Interactor3D::SOLID));
-
-      //wall interactors
-      int bcOptionWall = 1; //0=simple Bounce Back, 1=quadr. BB, 2=thin wall
-      D3Q27BoundaryConditionAdapterPtr bcWall(new D3Q27NoSlipBCAdapter(bcOptionWall));
-      D3Q27InteractorPtr addWallYminInt(new D3Q27Interactor(addWallYmin, grid, bcWall,Interactor3D::SOLID));
-      D3Q27InteractorPtr addWallYmaxInt(new D3Q27Interactor(addWallYmax, grid, bcWall,Interactor3D::SOLID));
-      D3Q27InteractorPtr addWallZminInt(new D3Q27Interactor(addWallZmin, grid, bcWall,Interactor3D::SOLID));
-      D3Q27InteractorPtr addWallZmaxInt(new D3Q27Interactor(addWallZmax, grid, bcWall,Interactor3D::SOLID));
-
-      //   //inflow
-      //   //double dp_Ph=0.1*10000.0;//dp in Bar
-      //   //double dp_lb=dp_Ph*0.001*(nueLB*dx)*(nueLB*dx);//nue_ph=10e-6
-      //   //if(myid == 0) UBLOG(logINFO,"dp_lb = " << dp_lb );
-      //   //double rhoLBinflow = 3.0*(dp_lb-rhoLB);
-
-      D3Q27BoundaryConditionAdapterPtr denBCAdapterInflow(new D3Q27DensityBCAdapter(rhoLBinflow));
-      denBCAdapterInflow->setSecondaryBcOption(0);
-      D3Q27InteractorPtr inflowInt  = D3Q27InteractorPtr( new D3Q27Interactor(geoInflow, grid, denBCAdapterInflow, Interactor3D::SOLID));
-
-      //outflow
-      D3Q27BoundaryConditionAdapterPtr denBCAdapterOutflow(new D3Q27DensityBCAdapter(rho_LB));
-      denBCAdapterOutflow->setSecondaryBcOption(0);
-      D3Q27InteractorPtr outflowInt = D3Q27InteractorPtr( new D3Q27Interactor(geoOutflow, grid, denBCAdapterOutflow,Interactor3D::SOLID));
-
-      ////////////////////////////////////////////
-      //METIS
-      Grid3DVisitorPtr metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B));   
-      ////////////////////////////////////////////
-      /////delete solid blocks
-      if(myid == 0) UBLOG(logINFO,"deleteSolidBlocks - start");
-      InteractorsHelper intHelper(grid, metisVisitor);
-      intHelper.addInteractor(boneInt);
-      intHelper.addInteractor(addWallYminInt);
-      intHelper.addInteractor(addWallYmaxInt);
-      intHelper.addInteractor(addWallZminInt);
-      intHelper.addInteractor(addWallZmaxInt);
-      intHelper.addInteractor(inflowInt);
-      intHelper.addInteractor(outflowInt);
-      intHelper.selectBlocks();
-      if(myid == 0) UBLOG(logINFO,"deleteSolidBlocks - end");	 
-      //////////////////////////////////////
-
-      //set connectors
-      D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
-      D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nu_LB, iProcessor);
-      grid->accept( setConnsVisitor );
-
-      //domain decomposition for threads
-      PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
-      grid->accept(pqPartVisitor);
-
-      ppblocks->update(0);
-      ppblocks.reset();
-
-      unsigned long nob = grid->getNumberOfBlocks();
-      int gl = 3;
-      unsigned long nodb = (blocknx1) * (blocknx2) * (blocknx3);
-      unsigned long nod = nob * (blocknx1) * (blocknx2) * (blocknx3);
-      unsigned long nodg = nob * (blocknx1+gl) * (blocknx2+gl) * (blocknx3+gl);
-      double needMemAll  = double(nodg*(27*sizeof(double) + sizeof(int) + sizeof(float)*4));
-      double needMem  = needMemAll / double(comm->getNumberOfProcesses());
-
-      if(myid == 0)
-      {
-         UBLOG(logINFO,"Number of blocks = " << nob);
-         UBLOG(logINFO,"Number of nodes  = " << nod);
-         int minInitLevel = grid->getCoarsestInitializedLevel();
-         int maxInitLevel = grid->getFinestInitializedLevel();
-         for(int level = minInitLevel; level<=maxInitLevel; level++)
-         {
-            int nobl = grid->getNumberOfBlocks(level);
-            UBLOG(logINFO,"Number of blocks for level " << level <<" = " << nobl);
-            UBLOG(logINFO,"Number of nodes for level " << level <<" = " << nobl*nodb);
-         }
-         UBLOG(logINFO,"Necessary memory  = " << needMemAll  << " bytes");
-         UBLOG(logINFO,"Necessary memory per process = " << needMem  << " bytes");
-         UBLOG(logINFO,"Available memory per process = " << availMem << " bytes");
-      }            
-
-      LBMKernel3DPtr kernel = LBMKernel3DPtr(new LBMKernelETD3Q27CCLB(blocknx1, blocknx2, blocknx3, LBMKernelETD3Q27CCLB::NORMAL));
-
-      //mu::Parser fctForcingX1;
-      //fctForcingX1.SetExpr("Fx1");
-      //fctForcingX1.DefineConst("Fx1", forcing);
-
-      //kernel->setForcingX1(fctForcingX1);
-      //kernel->setWithForcing(true);
-
-      BCProcessorPtr bcProc(new D3Q27ETForThinWallBCProcessor());
-      kernel->setBCProcessor(bcProc);
-
-      SetKernelBlockVisitor kernelVisitor(kernel, nu_LB, availMem, needMem);
-      grid->accept(kernelVisitor);
-
-
-      //if (refineLevel > 0)
-      //{
-      //   D3Q27SetUndefinedNodesBlockVisitor undefNodesVisitor;
-      //   grid->accept(undefNodesVisitor);
-      //}
-
-      //BC
-      intHelper.setBC();
-
-      //Press*1.6e8+(14.76-coordsX)/3.5*5000
-      //initialization of distributions
-      mu::Parser fct;
-      fct.SetExpr("(x1max-x1)/l*dp*3.0");
-      fct.DefineConst("dp", dp_LB);
-      fct.DefineConst("x1max", g_maxX1);
-      fct.DefineConst("l", g_maxX1-g_minX1);
-
-      D3Q27ETInitDistributionsBlockVisitor initVisitor(nu_LB, rho_LB);
-      initVisitor.setRho(fct);
-      //initVisitor.setVx1(fct);
-      initVisitor.setVx1(0.0);
-      grid->accept(initVisitor);
-
-      //Postrozess
-      UbSchedulerPtr geoSch(new UbScheduler(1));
-      D3Q27MacroscopicQuantitiesPostprocessorPtr ppgeo(
-         new D3Q27MacroscopicQuantitiesPostprocessor(grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, true));
-      ppgeo->update(0);
-      ppgeo.reset();
-
-      if(myid == 0) UBLOG(logINFO,"Preprozess - end"); 
-
-      UbSchedulerPtr nupsSch(new UbScheduler(10, 30, 100));
-      NUPSCounterPostprocessor npr(grid, nupsSch, numOfThreads, comm);
-
-      double outTime = 1000;
-      UbSchedulerPtr stepSch(new UbScheduler(outTime));
-      stepSch->addSchedule(10,10,100);
-
-      D3Q27MacroscopicQuantitiesPostprocessor pp(grid, stepSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv);
-
-
-      double dxd2 = deltax / 2.0;
-      D3Q27IntegrateValuesHelperPtr ih1(new D3Q27IntegrateValuesHelper(grid, comm, bone->getX1Minimum() - dxd2, bone->getX2Minimum() - dxd2, bone->getX3Minimum() - dxd2,
-         bone->getX1Maximum() + dxd2, bone->getX2Maximum() + dxd2, bone->getX3Maximum() + dxd2));
-      if (myid == 0) GbSystem3D::writeGeoObject(ih1->getBoundingBox().get(), pathname + "/geo/ih1", WbWriterVtkXmlBinary::getInstance());
-
-      double factorp = dp_real/dp_LB;
-      double factorv = dx/dt;
-      D3Q27MeanValuesPostprocessor mvp1(grid, stepSch, pathname + "/mv/mv1.txt", comm, ih1, factorp, factorv);
-
-
-      D3Q27IntegrateValuesHelperPtr ih2(new D3Q27IntegrateValuesHelper(grid, comm, g_maxX1-2.0*deltax, g_minX2, g_minX3,
-         g_maxX1 - deltax, g_maxX2, g_maxX3));
-      if (myid == 0) GbSystem3D::writeGeoObject(ih2->getBoundingBox().get(), pathname + "/geo/ih2", WbWriterVtkXmlBinary::getInstance());
-
-      D3Q27MeanValuesPostprocessor mvp2(grid, stepSch, pathname + "/mv/mv2.txt", comm, ih2, factorp, factorv);
-
-      if(myid == 0)
-      {
-         UBLOG(logINFO,"PID = " << myid << " Total Physical Memory (RAM): " << Utilities::getTotalPhysMem());
-         UBLOG(logINFO,"PID = " << myid << " Physical Memory currently used: " << Utilities::getPhysMemUsed());
-         UBLOG(logINFO,"PID = " << myid << " Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe());
-      }
-
-      double endTime = UbSystem::stringTo<double>(cf.getValue("endTime")); //100001;//10001.0;
-
-      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, stepSch));
-      if(myid == 0) UBLOG(logINFO,"Simulation-start");
-      calculation->calculate();
-      if(myid == 0) UBLOG(logINFO,"Simulation-end");
-   }
-   catch(exception& e)
-   {
-      cerr << e.what() << endl << flush;
-   }
-   catch(string& s)
-   {
-      cerr << s << endl;
-   }
-   catch(...)
-   {
-      cerr << "unknown exception" << endl;
-   }
-
-}
-//////////////////////////////////////////////////////////////////////////
-int main(int argc, char* argv[])
-{
-
-   if ( argv != NULL )
-   {
-      sbonepd(argv[1]);
-   }
-
-   return 0;
-}
+#include <iostream>
+#include <string>
+
+#include <vfluids.h>
+
+using namespace std;
+
+
+void sbonepd(const char *configname)
+{
+   try
+   {
+
+      string machine = QUOTEME(CAB_MACHINE);
+      string pathname, pathGeo; 
+      int numOfThreads;
+      double availMem;
+
+      ConfigFileReader cf(configname);
+      if (!cf.read())
+      {
+         std::string exceptionText = "Unable to read configuration file\n";
+         throw exceptionText;
+      }
+
+      CommunicatorPtr comm = MPICommunicator::getInstance();
+      int myid = comm->getProcessID();
+
+      if(machine == "BOMBADIL") 
+      {
+         numOfThreads = 4;
+         pathname = "d:/temp/sbone2";
+         pathGeo = "d:/Data/Bone/SmallBone";
+         availMem = 3.0e9;
+      }
+      else if(machine == "M01" || machine == "M02")      
+      {
+         numOfThreads = 8;
+         pathname = cf.getValue("pathname"); //"/work/koskuche/Bone/SmallBone";
+         pathGeo = cf.getValue("pathGeo"); //"/home/koskuche/data/Bone/SmallBone/vti";
+         availMem = 1.0e9;
+
+#if defined(__unix__)
+         if (myid == 0)
+         {
+            const char* str = pathname.c_str();
+            int status = mkdir(str, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
+         }
+#endif 
+
+         if(myid ==0)
+         {
+            stringstream logFilename;
+            logFilename <<  pathname + "/logfile"+UbSystem::toString(UbSystem::getTimeStamp())+".txt";
+            UbLog::output_policy::setStream(logFilename.str());
+         }
+      }
+      else throw UbException(UB_EXARGS, "unknown CAB_MACHINE");
+
+      if(myid==0) UBLOG(logINFO,"Testcase small bone");
+
+      //string boneFileName = pathGeo + "/sbone.stl";
+      string boneFileName = pathGeo + "/boneimage.vti";
+
+      double dx = 3.5e-3/175.0;
+
+      const int blocknx1 = 16;
+      const int blocknx2 = 16;
+      const int blocknx3 = 16;
+
+      LBMReal rho_LB = 0.0;
+      //nueWasser = 1e-6 m^2/s
+      double nu_real = 1e-6;
+      LBMReal dt = 5e-8; // s (frei gewählt)
+      //dx - frei gewählt
+      //
+      LBMReal nu_LB = nu_real/(dx*dx/dt);
+
+
+      //dp = 50000 Pa - 0 Pa = 50000 Pa
+      double dp_real = UbSystem::stringTo<double>(cf.getValue("pressure")); //5000;
+      //rho wasser = 1000 kg*m^-3
+      double rho_real = 1000;
+      //dp/rho = 50000/1000 = 50 m^2/s^2
+      double dp_div_rho_real = dp_real/rho_real;
+
+      double dp_LB = dp_div_rho_real/((dx/dt)*(dx/dt));
+
+      bool with_forcing = false;
+
+      double rhoLBinflow;
+      if (with_forcing)
+      {
+         rhoLBinflow = 0.0;
+      } 
+      else
+      {
+         rhoLBinflow = dp_LB*3.0;
+      }
+
+      LBMUnitConverterPtr conv = LBMUnitConverterPtr(new LBMUnitConverter());
+
+      const int baseLevel = 0;
+      const int refineLevel = 0;
+
+
+      //////////////////////////////////////////////////////////////////////////
+      //bone STL
+      //GbTriFaceMesh3DPtr bone (GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(boneFileName,"Netz"));
+      //if(myid == 0) GbSystem3D::writeGeoObject( bone.get(), pathname+"/geo/bone", WbWriterVtkXmlBinary::getInstance() );
+
+      string boneFilename = pathGeo + "/boneimage.vti";
+
+      int pmNX1=151;  //abmessung einzelbild in x-richtung
+      int pmNX2=101; //abmessung einzelbild in y richtung
+      int pmNX3=101; //anzahl der bilder
+      float lthreshold = 1.0;
+      float uthreshold = 255.0;
+
+      GbVoxelMatrix3DPtr bone(new GbVoxelMatrix3D(pmNX1,pmNX2,pmNX3,0,lthreshold,uthreshold));
+      bone->readMatrixFromVtiASCIIFile(boneFilename);
+      bone->setVoxelMatrixMininum(11.5, 8.01, 5.01);
+
+      double deltax = dx*1e3;
+      double deltaVoxel = 11e-3;
+      bone->setVoxelMatrixDelta(deltaVoxel, deltaVoxel, deltaVoxel);
+      bone->setLbGridDx(deltax);
+
+      if(myid == 0) bone->writeToLegacyVTKBinary(pathname+"/geo/bone");
+
+      //bounding box
+      double g_minX1 = bone->getX1Minimum()-0.25;
+      double g_minX2 = bone->getX2Minimum()-0.25;
+      double g_minX3 = bone->getX3Minimum()-0.25;
+
+      double g_maxX1 = bone->getX1Maximum()+0.25;
+      double g_maxX2 = bone->getX2Maximum()+0.25;
+      double g_maxX3 = bone->getX3Maximum()+0.25;
+
+      double blockLength = (double)blocknx1*deltax;
+
+      //double h = g_maxX2/2.0;
+      //double dpLB = (rhoLBinflow - rhoLB)/3.0;
+
+      //
+      //double dex = g_maxX1+1.0;
+      //double Umax = (1.0/(2.0*nueLB))*(dpLB/dex)*(h*h);
+
+      //double Re = (4*h*Umax)/(3*nueLB);
+
+      Grid3DPtr grid(new Grid3D(comm));
+      grid->setPeriodicX1(false);
+      grid->setPeriodicX2(false);
+      grid->setPeriodicX3(false);
+      grid->setDeltaX(deltax);
+      grid->setBlockNX(blocknx1, blocknx2, blocknx3);
+
+      GbObject3DPtr gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
+      if(myid ==0) GbSystem3D::writeGeoObject(gridCube.get(),pathname + "/geo/gridCube", WbWriterVtkXmlBinary::getInstance());      
+
+
+      GenBlocksGridVisitor genBlocks(gridCube);
+      grid->accept(genBlocks);
+
+      double forcing = 0;
+      if (with_forcing)
+      {
+         forcing = dp_LB/(blocknx1*grid->getNX1());
+      }
+
+      if(myid ==0)
+      {
+         UBLOG(logINFO,"Parameters:");
+         UBLOG(logINFO,"with forcing = " << with_forcing );
+         UBLOG(logINFO,"rho_LB = " << rho_LB );
+         UBLOG(logINFO,"nu_LB = " << nu_LB );
+         UBLOG(logINFO,"dp_LB = " << dp_LB );
+         UBLOG(logINFO,"forcing = " << forcing );
+         UBLOG(logINFO,"dx = " << dx << " m");
+         UBLOG(logINFO,"dt = " << dt << " s");
+         UBLOG(logINFO,"rho_real = " << rho_real << " kg*m^-3" );
+         UBLOG(logINFO,"nu_real = " << nu_real << " m^2/s" );
+         UBLOG(logINFO,"dp_real = " << dp_real << " Pa" );
+
+         UBLOG(logINFO,"number of levels = " << refineLevel+1 );
+         UBLOG(logINFO,"numOfThreads = " << numOfThreads );
+         UBLOG(logINFO,"path = " << pathname );
+         UBLOG(logINFO,"Preprozess - start");
+      }
+
+      //walls
+      GbCuboid3DPtr addWallYmin (new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_minX2, g_maxX3+blockLength));
+      if(myid == 0) GbSystem3D::writeGeoObject(addWallYmin.get(), pathname+"/geo/addWallYmin", WbWriterVtkXmlASCII::getInstance());
+
+      GbCuboid3DPtr addWallYmax (new GbCuboid3D(g_minX1-blockLength, g_maxX2, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength));
+      if(myid == 0) GbSystem3D::writeGeoObject(addWallYmax.get(), pathname+"/geo/addWallYmax", WbWriterVtkXmlASCII::getInstance());
+
+      GbCuboid3DPtr addWallZmin (new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_minX3));
+      if(myid == 0) GbSystem3D::writeGeoObject(addWallZmin.get(), pathname+"/geo/addWallZmin", WbWriterVtkXmlASCII::getInstance());
+
+      GbCuboid3DPtr addWallZmax (new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_maxX3, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength));
+      if(myid == 0) GbSystem3D::writeGeoObject(addWallYmax.get(), pathname+"/geo/addWallYmax", WbWriterVtkXmlASCII::getInstance());
+
+      //inflow
+      GbCuboid3DPtr geoInflow (new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3-blockLength, g_minX1, g_maxX2+blockLength, g_maxX3+blockLength));
+      if(myid == 0) GbSystem3D::writeGeoObject(geoInflow.get(), pathname+"/geo/geoInflow", WbWriterVtkXmlASCII::getInstance());
+
+      //outflow
+      GbCuboid3DPtr geoOutflow (new GbCuboid3D(g_maxX1, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength));
+      if(myid == 0) GbSystem3D::writeGeoObject(geoOutflow.get(), pathname+"/geo/geoOutflow", WbWriterVtkXmlASCII::getInstance());
+
+      BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm));
+
+
+      //   if (refineLevel > 0)
+      //   {
+      //      if(myid == 0) UBLOG(logINFO,"Refinement - start");	
+      //      RefineCrossAndInsideGbObjectHelper refineHelper(grid, refineLevel);
+      //      refineHelper.refine();
+      //      if(myid == 0) UBLOG(logINFO,"Refinement - end");	
+      //   }
+
+
+
+      //bone interactor
+      int bcOptionBone = 2; //0=simple Bounce Back, 1=quadr. BB, 2=thin wall
+      D3Q27BoundaryConditionAdapterPtr bcBone(new D3Q27NoSlipBCAdapter(bcOptionBone));
+
+      D3Q27InteractorPtr boneInt(new D3Q27Interactor(bone, grid, bcBone,Interactor3D::SOLID));
+
+      //wall interactors
+      int bcOptionWall = 1; //0=simple Bounce Back, 1=quadr. BB, 2=thin wall
+      D3Q27BoundaryConditionAdapterPtr bcWall(new D3Q27NoSlipBCAdapter(bcOptionWall));
+      D3Q27InteractorPtr addWallYminInt(new D3Q27Interactor(addWallYmin, grid, bcWall,Interactor3D::SOLID));
+      D3Q27InteractorPtr addWallYmaxInt(new D3Q27Interactor(addWallYmax, grid, bcWall,Interactor3D::SOLID));
+      D3Q27InteractorPtr addWallZminInt(new D3Q27Interactor(addWallZmin, grid, bcWall,Interactor3D::SOLID));
+      D3Q27InteractorPtr addWallZmaxInt(new D3Q27Interactor(addWallZmax, grid, bcWall,Interactor3D::SOLID));
+
+      //   //inflow
+      //   //double dp_Ph=0.1*10000.0;//dp in Bar
+      //   //double dp_lb=dp_Ph*0.001*(nueLB*dx)*(nueLB*dx);//nue_ph=10e-6
+      //   //if(myid == 0) UBLOG(logINFO,"dp_lb = " << dp_lb );
+      //   //double rhoLBinflow = 3.0*(dp_lb-rhoLB);
+
+      D3Q27BoundaryConditionAdapterPtr denBCAdapterInflow(new D3Q27DensityBCAdapter(rhoLBinflow));
+      denBCAdapterInflow->setSecondaryBcOption(0);
+      D3Q27InteractorPtr inflowInt  = D3Q27InteractorPtr( new D3Q27Interactor(geoInflow, grid, denBCAdapterInflow, Interactor3D::SOLID));
+
+      //outflow
+      D3Q27BoundaryConditionAdapterPtr denBCAdapterOutflow(new D3Q27DensityBCAdapter(rho_LB));
+      denBCAdapterOutflow->setSecondaryBcOption(0);
+      D3Q27InteractorPtr outflowInt = D3Q27InteractorPtr( new D3Q27Interactor(geoOutflow, grid, denBCAdapterOutflow,Interactor3D::SOLID));
+
+      ////////////////////////////////////////////
+      //METIS
+      Grid3DVisitorPtr metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B));   
+      ////////////////////////////////////////////
+      /////delete solid blocks
+      if(myid == 0) UBLOG(logINFO,"deleteSolidBlocks - start");
+      InteractorsHelper intHelper(grid, metisVisitor);
+      intHelper.addInteractor(boneInt);
+      intHelper.addInteractor(addWallYminInt);
+      intHelper.addInteractor(addWallYmaxInt);
+      intHelper.addInteractor(addWallZminInt);
+      intHelper.addInteractor(addWallZmaxInt);
+      intHelper.addInteractor(inflowInt);
+      intHelper.addInteractor(outflowInt);
+      intHelper.selectBlocks();
+      if(myid == 0) UBLOG(logINFO,"deleteSolidBlocks - end");	 
+      //////////////////////////////////////
+
+      //set connectors
+      D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
+      D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nu_LB, iProcessor);
+      grid->accept( setConnsVisitor );
+
+      //domain decomposition for threads
+      PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
+      grid->accept(pqPartVisitor);
+
+      ppblocks->update(0);
+      ppblocks.reset();
+
+      unsigned long nob = grid->getNumberOfBlocks();
+      int gl = 3;
+      unsigned long nodb = (blocknx1) * (blocknx2) * (blocknx3);
+      unsigned long nod = nob * (blocknx1) * (blocknx2) * (blocknx3);
+      unsigned long nodg = nob * (blocknx1+gl) * (blocknx2+gl) * (blocknx3+gl);
+      double needMemAll  = double(nodg*(27*sizeof(double) + sizeof(int) + sizeof(float)*4));
+      double needMem  = needMemAll / double(comm->getNumberOfProcesses());
+
+      if(myid == 0)
+      {
+         UBLOG(logINFO,"Number of blocks = " << nob);
+         UBLOG(logINFO,"Number of nodes  = " << nod);
+         int minInitLevel = grid->getCoarsestInitializedLevel();
+         int maxInitLevel = grid->getFinestInitializedLevel();
+         for(int level = minInitLevel; level<=maxInitLevel; level++)
+         {
+            int nobl = grid->getNumberOfBlocks(level);
+            UBLOG(logINFO,"Number of blocks for level " << level <<" = " << nobl);
+            UBLOG(logINFO,"Number of nodes for level " << level <<" = " << nobl*nodb);
+         }
+         UBLOG(logINFO,"Necessary memory  = " << needMemAll  << " bytes");
+         UBLOG(logINFO,"Necessary memory per process = " << needMem  << " bytes");
+         UBLOG(logINFO,"Available memory per process = " << availMem << " bytes");
+      }            
+
+      LBMKernel3DPtr kernel = LBMKernel3DPtr(new LBMKernelETD3Q27CCLB(blocknx1, blocknx2, blocknx3, LBMKernelETD3Q27CCLB::NORMAL));
+
+      //mu::Parser fctForcingX1;
+      //fctForcingX1.SetExpr("Fx1");
+      //fctForcingX1.DefineConst("Fx1", forcing);
+
+      //kernel->setForcingX1(fctForcingX1);
+      //kernel->setWithForcing(true);
+
+      BCProcessorPtr bcProc(new D3Q27ETForThinWallBCProcessor());
+      kernel->setBCProcessor(bcProc);
+
+      SetKernelBlockVisitor kernelVisitor(kernel, nu_LB, availMem, needMem);
+      grid->accept(kernelVisitor);
+
+
+      //if (refineLevel > 0)
+      //{
+      //   D3Q27SetUndefinedNodesBlockVisitor undefNodesVisitor;
+      //   grid->accept(undefNodesVisitor);
+      //}
+
+      //BC
+      intHelper.setBC();
+
+      //Press*1.6e8+(14.76-coordsX)/3.5*5000
+      //initialization of distributions
+      mu::Parser fct;
+      fct.SetExpr("(x1max-x1)/l*dp*3.0");
+      fct.DefineConst("dp", dp_LB);
+      fct.DefineConst("x1max", g_maxX1);
+      fct.DefineConst("l", g_maxX1-g_minX1);
+
+      D3Q27ETInitDistributionsBlockVisitor initVisitor(nu_LB, rho_LB);
+      initVisitor.setRho(fct);
+      //initVisitor.setVx1(fct);
+      initVisitor.setVx1(0.0);
+      grid->accept(initVisitor);
+
+      //Postrozess
+      UbSchedulerPtr geoSch(new UbScheduler(1));
+      D3Q27MacroscopicQuantitiesPostprocessorPtr ppgeo(
+         new D3Q27MacroscopicQuantitiesPostprocessor(grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, true));
+      ppgeo->update(0);
+      ppgeo.reset();
+
+      if(myid == 0) UBLOG(logINFO,"Preprozess - end"); 
+
+      UbSchedulerPtr nupsSch(new UbScheduler(10, 30, 100));
+      NUPSCounterPostprocessor npr(grid, nupsSch, numOfThreads, comm);
+
+      double outTime = 1000;
+      UbSchedulerPtr stepSch(new UbScheduler(outTime));
+      stepSch->addSchedule(10,10,100);
+
+      D3Q27MacroscopicQuantitiesPostprocessor pp(grid, stepSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv);
+
+
+      double dxd2 = deltax / 2.0;
+      D3Q27IntegrateValuesHelperPtr ih1(new D3Q27IntegrateValuesHelper(grid, comm, bone->getX1Minimum() - dxd2, bone->getX2Minimum() - dxd2, bone->getX3Minimum() - dxd2,
+         bone->getX1Maximum() + dxd2, bone->getX2Maximum() + dxd2, bone->getX3Maximum() + dxd2));
+      if (myid == 0) GbSystem3D::writeGeoObject(ih1->getBoundingBox().get(), pathname + "/geo/ih1", WbWriterVtkXmlBinary::getInstance());
+
+      double factorp = dp_real/dp_LB;
+      double factorv = dx/dt;
+      D3Q27MeanValuesPostprocessor mvp1(grid, stepSch, pathname + "/mv/mv1.txt", comm, ih1, factorp, factorv);
+
+
+      D3Q27IntegrateValuesHelperPtr ih2(new D3Q27IntegrateValuesHelper(grid, comm, g_maxX1-2.0*deltax, g_minX2, g_minX3,
+         g_maxX1 - deltax, g_maxX2, g_maxX3));
+      if (myid == 0) GbSystem3D::writeGeoObject(ih2->getBoundingBox().get(), pathname + "/geo/ih2", WbWriterVtkXmlBinary::getInstance());
+
+      D3Q27MeanValuesPostprocessor mvp2(grid, stepSch, pathname + "/mv/mv2.txt", comm, ih2, factorp, factorv);
+
+      if(myid == 0)
+      {
+         UBLOG(logINFO,"PID = " << myid << " Total Physical Memory (RAM): " << Utilities::getTotalPhysMem());
+         UBLOG(logINFO,"PID = " << myid << " Physical Memory currently used: " << Utilities::getPhysMemUsed());
+         UBLOG(logINFO,"PID = " << myid << " Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe());
+      }
+
+      double endTime = UbSystem::stringTo<double>(cf.getValue("endTime")); //100001;//10001.0;
+
+      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, stepSch));
+      if(myid == 0) UBLOG(logINFO,"Simulation-start");
+      calculation->calculate();
+      if(myid == 0) UBLOG(logINFO,"Simulation-end");
+   }
+   catch(exception& e)
+   {
+      cerr << e.what() << endl << flush;
+   }
+   catch(string& s)
+   {
+      cerr << s << endl;
+   }
+   catch(...)
+   {
+      cerr << "unknown exception" << endl;
+   }
+
+}
+//////////////////////////////////////////////////////////////////////////
+int main(int argc, char* argv[])
+{
+
+   if ( argv != NULL )
+   {
+      sbonepd(argv[1]);
+   }
+
+   return 0;
+}
diff --git a/apps/cpu/shear/CMakeLists.txt b/apps/cpu/shear/CMakeLists.txt
index ce43e1f71988432bb9aadcf64408d6bb942e2037..5cf6013b9f40e71b05d69672b5d56bb5aef5ad2b 100644
--- a/apps/cpu/shear/CMakeLists.txt
+++ b/apps/cpu/shear/CMakeLists.txt
@@ -1,25 +1,25 @@
-CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
-
-########################################################
-## C++ PROJECT                                       ###
-########################################################
-PROJECT(shear)
-
-INCLUDE(${SOURCE_ROOT}/lib/IncludsList.txt) 
-
-#################################################################
-###   LOCAL FILES                                             ###
-#################################################################
-FILE(GLOB SPECIFIC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.h
-                         ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
-                         ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp  )
- 
-SET(ALL_SOURCES ${ALL_SOURCES} ${SPECIFIC_FILES})
-SOURCE_GROUP(src FILES ${SPECIFIC_FILES})
-  
-SET(CAB_ADDITIONAL_LINK_LIBRARIES vfluids)
-
-#################################################################
-###   CREATE PROJECT                                          ###
-#################################################################
-CREATE_CAB_PROJECT(shear BINARY)
+CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
+
+########################################################
+## C++ PROJECT                                       ###
+########################################################
+PROJECT(shear)
+
+INCLUDE(${SOURCE_ROOT}/lib/IncludsList.txt) 
+
+#################################################################
+###   LOCAL FILES                                             ###
+#################################################################
+FILE(GLOB SPECIFIC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.h
+                         ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
+                         ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp  )
+ 
+SET(ALL_SOURCES ${ALL_SOURCES} ${SPECIFIC_FILES})
+SOURCE_GROUP(src FILES ${SPECIFIC_FILES})
+  
+SET(CAB_ADDITIONAL_LINK_LIBRARIES vfluids)
+
+#################################################################
+###   CREATE PROJECT                                          ###
+#################################################################
+CREATE_CAB_PROJECT(shear BINARY)
diff --git a/apps/cpu/shear/shear.cpp b/apps/cpu/shear/shear.cpp
index 8026d17f5cf136fa28a797119d1852a0ef01bc56..6a154c57d62a99130934fd5d6f7ab747689ef35f 100644
--- a/apps/cpu/shear/shear.cpp
+++ b/apps/cpu/shear/shear.cpp
@@ -1,514 +1,514 @@
-#include <iostream>
-#include <string>
-
-#include <vfluids.h>
-using namespace std;
-
-
-void run(const char *cstr)
-{
-   CommunicatorPtr comm(new MPICommunicator());
-   try
-   {
-      //Sleep(30000);
-      string machine = QUOTEME(CAB_MACHINE);
-      string pathname; 
-	  string geosphere;	  
-      int numOfThreads = 1;
-      double availMem = 0;
-
-      
-      int myid = comm->getProcessID();
-
-      if(machine == "BOMBADIL") 
-      {
-         pathname = "d:/temp/shear";
-         numOfThreads = 1;
-         availMem = 3.0e9;
-         geosphere = "d:/Data/Ehsan/Agglomerat_n_00020_fd_1.882437_r_0033.930997.txt";
-      }
-       else if(machine == "M01" || machine == "M02")      
-      {
-         pathname = "/work/koskuche/scratch/smallAgg80";
-		// geosphere = "/work/ehsan/data/Agglomerat4.txt";
-	   // geosphere = "/work/ehsan/data/Agglomerat_n_00060_fd_1.858514_r_0061.500327.txt";
-		// geosphere = "/work/ehsan/data/Agglomerat_n_00080_fd_1.855984_r_0071.870085.txt";
-		//geosphere = "/work/ehsan/data/Agglomerat_n_00040_fd_1.864231_r_0049.358563.txt";
-		//geosphere = "/work/ehsan/data/Agglomerat_n_00020_fd_1.882437_r_0033.930997.txt";
-		geosphere = "/work/ehsan/data/Agglomerat_n_00500_fd_1.850643_r_0193.702967.txt";
-      
-		
-		
-		
-         numOfThreads = 1;
-         availMem =1.0e10;// 12.0e9;
-
-         if(myid ==0)
-         {
-            stringstream logFilename;
-            logFilename <<  pathname + "/logfile"+UbSystem::toString(UbSystem::getTimeStamp())+".txt";
-            UbLog::output_policy::setStream(logFilename.str());
-         }
-	   }
-      else throw UbException(UB_EXARGS, "unknown CAB_MACHINE");
-
-      double dx =0.1*4.0;
-
-	  double eq_Diameter=2.0*38.0;//55.3586;//61.5003;//80;//71.8701;//61.5003;
-      double L1 =35.0*eq_Diameter;
-      double L2, L3, H;
-      L2 = L3 = H =35.0*eq_Diameter;//1.0;//0.42*3.9;
-
-      LBMReal radius = 6.0;
-      LBMReal rhoReal = 1.0; //kg/m^3
-      //LBMReal uReal = 0.45;//m/s
-   //   LBMReal uLB = 0.05;
-      LBMReal Re = 0.1;
-      LBMReal rhoLB = 0.0;
-      LBMReal l = L2 / dx;
-
-      //LBMUnitConverterPtr conv = LBMUnitConverterPtr(new LBMUnitConverter(1.0, 1/sqrt(3.0)*(uReal/uLB), 1.0, 1.0/dx, dx*dx*dx));
-      LBMUnitConverterPtr conv = LBMUnitConverterPtr(new LBMUnitConverter());
-
-      const int baseLevel = 0;
-      const int refineLevel = 5;  
-  
-     
-
-      //bounding box
-      double d_minX1 = 0.0;
-      double d_minX2 = 0.0;
-      double d_minX3 = 0.0;
-
-      double d_maxX1 = L1;
-      double d_maxX2 = L2;
-      double d_maxX3 = L3;
-
-	  const int blocknx1 = 8;
-      const int blocknx2 = 8;
-      const int blocknx3 = 8;
-
-      dx =14.4*2.0;// ( 0.9) *(double)(1<<refineLevel);
-
-	  double area =/* radius/dx;*/radius*radius*PI/(dx/(double)(1<<refineLevel))/(dx/(double)(1<<refineLevel));//2.0*radius*H;
-	  double nueReal=1e-6;//water
-	  double uReal=Re*nueReal/(2.0*radius);//real velocity
-	  double F_stokss=6*PI*.001/*water*/*radius*uReal;
-      //LBMReal nueLB = (((4.0/9.0)*uLB)*2.0*(radius/dx))/Re;
-      LBMReal nueLB =.75/((double)(1<<refineLevel));// ((uLB)*2.0*(radius/dx))/Re;
-	//  LBMReal uLB  = ((nueLB)*Re)/ ( 2.0*(radius/dx));//base on the coarsest level
-	  LBMReal uLB  = ((0.75)*Re)/ ( 2.0*(radius/(dx/((double)(1<<refineLevel)))));//base on the coarsest level if nueLB =.75/((double)(1<<refineLevel)) and  dx = ( 0.9) *(double)(1<<refineLevel)
-  //     LBMReal uLB  = ((0.75)*Re)/ ((eq_Diameter/(dx/((double)(1<<refineLevel)))));//base on the coarsest level if nueLB =.75/((double)(1<<refineLevel)) and  dx = ( 0.9) *(double)(1<<refineLevel)
-	 double blockLength = blocknx1*dx;
-	
-
-		double xsphere=1.0*L1/2.0;//0.5;
-		double ysphere=L2/2.0;//0.75;
-		double zsphere=L3/2.0;//0.75;
- //obstacle
-    	 //////////////////////////////////////////////////////////////////////////
-	  UbFileInputASCII file;
-	  file.open(geosphere);
-	  //file.skipLine();file.skipLine();//2line skiped
-	  std::string NOP=file.readString();
-	  std::string NOP2=file.readString();
-	  const int numberOfParticles=file.readDouble();
-	  if(myid == 0){UBLOG(logINFO,__FILE__<<" " <<__LINE__<<" number of particles="<<numberOfParticles);}	
-	  //std::string Dia=file.readString();
-	  double diameter=2.0*radius;//12;//file.readDouble();
-	  file.skipLine();file.skipLine();file.skipLine();file.skipLine();file.skipLine();file.skipLine();file.skipLine();//7 line skiped
-			GbSphere3DPtr *sphereP=new GbSphere3DPtr[numberOfParticles];
-			  
-			for (int i=0;i<numberOfParticles;i++)
-			{
-			double x=file.readDouble();
-			double y=file.readDouble();
-			double z=file.readDouble();
-		///0degree in x direction		
-			    double x_rotation= x;
-			    double y_rotation= y;
-			    double z_rotation= z;
-///180degree in x direction		
-			   // double x_rotation= x;
-			   // double y_rotation= -y;
-			   // double z_rotation= -z;			   
-		///90degree in y direction	
-			  // double x_rotation=-z;
-			  // double y_rotation= y;
-			  // double z_rotation=x;			
-	   // ///90degree in z axis	
-			   // double x_rotation=-y;
-			   // double y_rotation=x;
-			   // double z_rotation=z;
-		//transfer	
-			double x_final=x_rotation/*/1450*/  +xsphere;
-			double y_final=y_rotation/*/1450*/  +ysphere;
-			double z_final=z_rotation/*/1450*/  +zsphere;
-				sphereP[i]=GbSphere3DPtr(new GbSphere3D(x_final, y_final, z_final, diameter/2.0/*/1450*/));
-				if(myid == 0)GbSystem3D::writeGeoObject(sphereP[i].get(),pathname + "/sphere/sphere"+ "_" + UbSystem::toString(i), WbWriterVtkXmlASCII::getInstance());
-			}
-			file.close();
-///////////////////////////////	
-       D3Q27InteractorPtr *spherePInt=new D3Q27InteractorPtr[numberOfParticles];	
-      double offs = dx;
-
-      //double g_minX1 = d_minX1-offs-0.499999*dx;
-      double g_minX1 = d_minX1-offs;
-      double g_minX2 = d_minX2-offs;
-      double g_minX3 = d_minX3-offs;
-
-      double g_maxX1 = d_maxX1+offs;
-      double g_maxX2 = d_maxX2+offs;
-      double g_maxX3 = d_maxX3+offs;
-			if(myid == 0){UBLOG(logINFO,__FILE__<<" " <<__LINE__);}	  
-      GbObject3DPtr gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
-			if(myid == 0){UBLOG(logINFO,__FILE__<<" " <<__LINE__);}	  
-      
-
-      //refinement area
-      double rf = 0.50*blockLength;
-      // GbObject3DPtr refineCube(new  GbCuboid3D(sphereP[0]->getX1Minimum()-rf*3.0/4.0, sphereP[3]->getX2Minimum()-rf*3.0/4.0, sphereP[5]->getX3Minimum()-rf*1.0/2.0, 
-         // sphereP[2]->getX1Maximum()+rf*3.0/4.0, sphereP[4]->getX2Maximum()+rf*3.0/4.0, sphereP[6]->getX3Maximum()+rf*1.0/2.0));
-		 
-		 //////////
-	   double level5=xsphere-(xsphere-eq_Diameter/2-0.50*(blocknx1*dx/pow(2.0,5)));//0.065;//.085;
-	   double level4=level5+.1*(blocknx1*dx/pow(2.0,4));//0.015;//0.1;
-	   double level3=level4+0.50*(blocknx1*dx/pow(2.0,3));//0.015;//0.115;
-	   double level2=level3+1.0*(blocknx1*dx/pow(2.0,2));//.035;//0.15;
-	   double level1=level2+1.0*(blocknx1*dx/pow(2.0,1));//.05;//0.2;
-	   
-	    GbCuboid3DPtr refineCube1(new GbCuboid3D(  xsphere-level1,ysphere-level1, zsphere-level1,xsphere+level1,ysphere+level1, zsphere+level1));
-	    GbCuboid3DPtr refineCube2(new GbCuboid3D(  xsphere-level2,ysphere-level2, zsphere-level2,xsphere+level2,ysphere+level2, zsphere+level2));
-		GbCuboid3DPtr refineCube3(new GbCuboid3D(  xsphere-level3,ysphere-level3, zsphere-level3,xsphere+level3,ysphere+level3, zsphere+level3));
-		GbCuboid3DPtr refineCube4(new GbCuboid3D(  xsphere-level4,ysphere-level4, zsphere-level4,xsphere+level4,ysphere+level4, zsphere+level4));
-		GbCuboid3DPtr refineCube5(new GbCuboid3D(  xsphere-level5,ysphere-level5, zsphere-level5,xsphere+level5,ysphere+level5, zsphere+level5));
-		 ///////////
-
-      Grid3DPtr grid(new Grid3D(comm));
-
-      UbSchedulerPtr rSch(new UbScheduler(100000, 100000));
-      //RestartPostprocessorPtr rp(new RestartPostprocessor(grid, rSch, comm, pathname+"/checkpoints", RestartPostprocessor::BINARY));
-
-      //UbSchedulerPtr emSch(new UbScheduler(1000, 1000));
-      //EmergencyExitPostprocessor em(grid, emSch, pathname+"/checkpoints/emex.txt", rp, comm);
-
-      std::string opt;
-
-      if(cstr!= NULL)
-         opt = std::string(cstr);
-
-      if/*(cstr== NULL)*/(cstr!= NULL)
-      {
-         opt = std::string(cstr);
-
-         if(myid==0) UBLOG(logINFO,"Restart step: " << opt);
-
-         //grid = rp->restart(UbSystem::stringTo<int>(opt));
-         //rp->reconnect();
-
-         //cylinderInt = 
-
-         //set connectors
-         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27OffsetInterpolationProcessor());
-         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
-         grid->accept( setConnsVisitor );
-
-         //domain decomposition
-         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
-         grid->accept(pqPartVisitor);
-      }
-      else
-      {
-         if(myid ==0)
-         {
-            UBLOG(logINFO,"L = " << L2/dx );
-            UBLOG(logINFO,"v = " << uLB );
-            UBLOG(logINFO,"rho = " << rhoLB );
-            UBLOG(logINFO,"nue = " << nueLB );
-            UBLOG(logINFO,"Re = " << Re );
-			UBLOG(logINFO,"F_stokss = " << F_stokss );
-			UBLOG(logINFO,"dx = " << dx );
-            UBLOG(logINFO,conv->toString() );
-            UBLOG(logINFO,"Preprozess - start");
-         }
-
-         grid->setDeltaX(dx);
-         grid->setBlockNX(blocknx1, blocknx2, blocknx3);
-		 grid->setPeriodicX1(false);
-         grid->setPeriodicX2(true);
-         grid->setPeriodicX3(true);
-
-         // UbTupleDouble6 bouningBox(gridCube->getX1Minimum(),gridCube->getX2Minimum(),gridCube->getX3Minimum(),
-         // gridCube->getX1Maximum(),gridCube->getX2Maximum(),gridCube->getX3Maximum());
-         // UbTupleInt3 blockNx(blocknx1, blocknx2, blocknx3);
-         // UbTupleInt3 gridNx(8, 16, 16);
-         // grid = Grid3DPtr(new Grid3D(bouningBox, blockNx, gridNx));
-
-         if(myid ==0) GbSystem3D::writeGeoObject(gridCube.get(),pathname + "/geo/gridCube", WbWriterVtkXmlBinary::getInstance());
- //        if(myid ==0) GbSystem3D::writeGeoObject(refineCube.get(),pathname + "/geo/refineCube", WbWriterVtkXmlBinary::getInstance());
- 
-         ////
-         if(myid ==0) GbSystem3D::writeGeoObject(gridCube.get(),pathname + "/geo/gridCube", WbWriterVtkXmlBinary::getInstance());
-         if(myid ==0) GbSystem3D::writeGeoObject(refineCube1.get(), pathname + "/geo/refineCube1", WbWriterVtkXmlBinary::getInstance());
-		 if(myid ==0) GbSystem3D::writeGeoObject(refineCube2.get(),pathname + "/geo/refineCube2", WbWriterVtkXmlBinary::getInstance());
-         if(myid ==0) GbSystem3D::writeGeoObject(refineCube3.get(),pathname + "/geo/refineCube3", WbWriterVtkXmlBinary::getInstance());
-		 if(myid ==0) GbSystem3D::writeGeoObject(refineCube4.get(),pathname + "/geo/refineCube4", WbWriterVtkXmlBinary::getInstance());
-		 if(myid ==0) GbSystem3D::writeGeoObject(refineCube5.get(),pathname + "/geo/refineCube5", WbWriterVtkXmlBinary::getInstance());
-		 ////
-		 
-         GenBlocksGridVisitor genBlocks;
-         genBlocks.addGeoObject(gridCube);
-         grid->accept(genBlocks);
-
-         //walls
-         GbCuboid3DPtr addWallYmin (new GbCuboid3D(d_minX1-4.0*blockLength, d_minX2-4.0*blockLength, d_minX3-4.0*blockLength, d_maxX1+4.0*blockLength, d_minX2, d_maxX3+4.0*blockLength));
-         if(myid == 0) GbSystem3D::writeGeoObject(addWallYmin.get(), pathname+"/geo/addWallYmin", WbWriterVtkXmlASCII::getInstance());
-
-         GbCuboid3DPtr addWallZmin (new GbCuboid3D(d_minX1-4.0*blockLength, d_minX2-4.0*blockLength, d_minX3-4.0*blockLength, d_maxX1+4.0*blockLength, d_maxX2+4.0*blockLength, d_minX3));
-         if(myid == 0) GbSystem3D::writeGeoObject(addWallZmin.get(), pathname+"/geo/addWallZmin", WbWriterVtkXmlASCII::getInstance());
-
-         GbCuboid3DPtr addWallYmax (new GbCuboid3D(d_minX1-4.0*blockLength, d_maxX2, d_minX3-4.0*blockLength, d_maxX1+4.0*blockLength, d_maxX2+4.0*blockLength, d_maxX3+4.0*blockLength));
-         if(myid == 0) GbSystem3D::writeGeoObject(addWallYmax.get(), pathname+"/geo/addWallYmax", WbWriterVtkXmlASCII::getInstance());
-
-         GbCuboid3DPtr addWallZmax (new GbCuboid3D(d_minX1-4.0*blockLength, d_minX2-4.0*blockLength, d_maxX3, d_maxX1+4.0*blockLength, d_maxX2+4.0*blockLength, d_maxX3+4.0*blockLength));
-         if(myid == 0) GbSystem3D::writeGeoObject(addWallZmax.get(), pathname+"/geo/addWallZmax", WbWriterVtkXmlASCII::getInstance());
-
-         //inflow
-         GbCuboid3DPtr geoInflow (new GbCuboid3D(d_minX1-4.0*blockLength, d_minX2-4.0*blockLength, d_minX3-4.0*blockLength, d_minX1, d_maxX2+4.0*blockLength, d_maxX3+4.0*blockLength));
-         if(myid == 0) GbSystem3D::writeGeoObject(geoInflow.get(), pathname+"/geo/geoInflow", WbWriterVtkXmlASCII::getInstance());
-
-         //outflow
-         GbCuboid3DPtr geoOutflow (new GbCuboid3D(d_maxX1, d_minX2-4.0*blockLength, d_minX3-4.0*blockLength, d_maxX1+4.0*blockLength, d_maxX2+4.0*blockLength, d_maxX3+4.0*blockLength));
-         if(myid == 0) GbSystem3D::writeGeoObject(geoOutflow.get(), pathname+"/geo/geoOutflow", WbWriterVtkXmlASCII::getInstance());
-
-         BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname + "/grid/blocks", WbWriterVtkXmlBinary::getInstance(), comm));
-
-        if (refineLevel > 0)
-         {
-            if(myid == 0) UBLOG(logINFO,"Refinement - start");	
-			RefineCrossAndInsideGbObjectHelper refineHelper(grid, refineLevel);
-			refineHelper.addGbObject(refineCube5, refineLevel);
-			
-		//	refineHelper.addGbObject(refineCube1, refineLevel);
-			// refineHelper.addGbObject(refineCube2, refineLevel-1);
-			// refineHelper.addGbObject(refineCube3, refineLevel-2);
-			// refineHelper.addGbObject(refineCube4, refineLevel-3);
-			//refineHelper.addGbObject(refineCube5, refineLevel-4);
-			
-
-            refineHelper.refine();
-            if(myid == 0) UBLOG(logINFO,"Refinement - end");   
-		 
-         }
-
-         MetisPartitioningGridVisitor metisVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B);
-         grid->accept( metisVisitor );
-
-         SolidBlocksHelper sd(grid, comm);
-
-         int bbOption = 1; //0=simple Bounce Back, 1=quadr. BB
-         D3Q27BoundaryConditionAdapterPtr bcObst(new D3Q27NoSlipBCAdapter(bbOption));
-		 D3Q27BoundaryConditionAdapterPtr bcObst2(new D3Q27SlipBCAdapter(bbOption));
-        // cylinderInt = D3Q27InteractorPtr ( new D3Q27Interactor(cylinder, grid, bcObst,Interactor3D::SOLID));
-		
-			for (int i=0;i<numberOfParticles;i++)
-			{      
-				spherePInt[i]= D3Q27InteractorPtr( new D3Q27Interactor(sphereP[i], grid, bcObst,Interactor3D::SOLID));
-			}
-         //walls
-         D3Q27InteractorPtr addWallYminInt(new D3Q27Interactor(addWallYmin, grid, bcObst2,Interactor3D::SOLID));
-         D3Q27InteractorPtr addWallZminInt(new D3Q27Interactor(addWallZmin, grid, bcObst2,Interactor3D::SOLID));
-         D3Q27InteractorPtr addWallYmaxInt(new D3Q27Interactor(addWallYmax, grid, bcObst2,Interactor3D::SOLID));
-         D3Q27InteractorPtr addWallZmaxInt(new D3Q27Interactor(addWallZmax, grid, bcObst2,Interactor3D::SOLID));
-
-		  //for shear strees =0
-		 // D3Q27BoundaryConditionAdapterPtr velBCAdapter2(new D3Q27VelocityBCAdapter ());
-         // velBCAdapter2->setSecondaryBcOption(1);
-         // D3Q27InteractorPtr addWallYminInt  = D3Q27InteractorPtr( new D3Q27Interactor(addWallYmin, grid, velBCAdapter2, Interactor3D::SOLID));
-		 // D3Q27InteractorPtr addWallZminInt  = D3Q27InteractorPtr( new D3Q27Interactor(addWallZmin, grid, velBCAdapter2, Interactor3D::SOLID));
-		 // D3Q27InteractorPtr addWallYmaxInt  = D3Q27InteractorPtr( new D3Q27Interactor(addWallYmax, grid, velBCAdapter2, Interactor3D::SOLID));
-		 // D3Q27InteractorPtr addWallZmaxInt  = D3Q27InteractorPtr( new D3Q27Interactor(addWallZmax, grid, velBCAdapter2, Interactor3D::SOLID));
-
-		
-		 
-         mu::Parser fct;
-         //fct.SetExpr("16*U*x2*x3*(H-x2)*(H-x3)/H^4");
-         //fct.DefineConst("U", uLB);
-         //fct.DefineConst("H", H);
-
-		 fct.SetExpr("U");
-         fct.DefineConst("U", uLB);
-         
-         //inflow
-         D3Q27BoundaryConditionAdapterPtr velBCAdapter(new D3Q27VelocityBCAdapter (true, false ,false ,fct, 0, D3Q27BCFunction::INFCONST));
-         velBCAdapter->setSecondaryBcOption(0);
-         D3Q27InteractorPtr inflowInt  = D3Q27InteractorPtr( new D3Q27Interactor(geoInflow, grid, velBCAdapter, Interactor3D::SOLID));
- 
-         //outflow
-         D3Q27BoundaryConditionAdapterPtr denBCAdapter(new D3Q27DensityBCAdapter(rhoLB));
-         D3Q27InteractorPtr outflowInt = D3Q27InteractorPtr( new D3Q27Interactor(geoOutflow, grid, denBCAdapter,Interactor3D::SOLID));
-
-	for (int i=0;i<numberOfParticles;i++)
-			{      
-				sd.addInteractor(spherePInt[i]  );
-			}
-         //sd.addInteractor(cylinderInt);
-         // sd.addInteractor(addWallYminInt);
-         // sd.addInteractor(addWallZminInt);
-         // sd.addInteractor(addWallYmaxInt);
-         // sd.addInteractor(addWallZmaxInt);
-         sd.addInteractor(inflowInt);
-         sd.addInteractor(outflowInt);
-if(myid == 0) UBLOG(logINFO,"delete - start"); 
-         sd.deleteSolidBlocks();
-if(myid == 0) UBLOG(logINFO,"delete - end"); 
-
-         grid->accept( metisVisitor );
-
-         sd.setTransBlocks();
-
-         ppblocks->update(0);
-         ppblocks.reset();
-
-         //set connectors
-         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
-         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
-         grid->accept( setConnsVisitor );
-
-         unsigned long nob = grid->getNumberOfBlocks();
-         int gl = 3;
-         unsigned long nod = nob * (blocknx1+gl) * (blocknx2+gl) * (blocknx3+gl);
-
-         double needMemAll  = double(nod*(27*sizeof(double) + sizeof(int) + sizeof(float)*4));
-         double needMem  = needMemAll / double(comm->getNumberOfProcesses());
-
-         if(myid == 0)
-         {
-            UBLOG(logINFO,"Number of blocks = " << nob);
-            UBLOG(logINFO,"Number of nodes  = " << nod);
-            UBLOG(logINFO,"Necessary memory  = " << needMemAll  << " bytes");
-            UBLOG(logINFO,"Necessary memory per process = " << needMem  << " bytes");
-            UBLOG(logINFO,"Available memory per process = " << availMem << " bytes");
-         }            
-
-         //LBMKernel3DPtr kernel(new LBMKernelETD3Q27Cascaded(blocknx1, blocknx2, blocknx3));
-         //LBMKernel3DPtr kernel(new LBMKernelETD3Q27BGK(blocknx1, blocknx2, blocknx3, true));
-         //option = 0 - ohne param., option = 1 - mit param.
-         int option = 0;
-       LBMKernel3DPtr kernel(new LBMKernelETD3Q27CCLB(blocknx1, blocknx2, blocknx3, option));
-      //   LBMKernel3DPtr kernel(new LBMKernelETD3Q27CCLB_Geier(blocknx1, blocknx2, blocknx3, option));
-	 
-//	     LBMKernel3DPtr kernel(new  LBMKernelETD3Q27Cascaded(blocknx1, blocknx2, blocknx3, option));
-         BCProcessorPtr bcProc(new D3Q27ETBCProcessor());
-         kernel->setBCProcessor(bcProc);
-
-         SetKernelBlockVisitor kernelVisitor(kernel, nueLB, availMem, needMem);
-         grid->accept(kernelVisitor);
-
-         if (refineLevel > 0)
-         {
-            D3Q27SetUndefinedNodesBlockVisitor undefNodesVisitor;
-            grid->accept(undefNodesVisitor);
-         }
-
-         //walls
-        // grid->addAndInitInteractor(addWallYminInt);
-        // grid->addAndInitInteractor(addWallZminInt);
-        // grid->addAndInitInteractor(addWallYmaxInt);
-        // grid->addAndInitInteractor(addWallZmaxInt);
-
-         //obstacle
-         //grid->addAndInitInteractor(cylinderInt);
-			for (int i=0;i<numberOfParticles;i++)
-			{      
-				grid->addAndInitInteractor(spherePInt[i]  );
-			}
-
-         //inflow
-         grid->addAndInitInteractor(inflowInt);
-
-         //outflow
-         grid->addAndInitInteractor(outflowInt);
-
-         //domain decomposition
-         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
-         grid->accept(pqPartVisitor);
-
-         //initialization of distributions
-         D3Q27ETInitDistributionsBlockVisitor initVisitor(rhoLB);
-         initVisitor.setVx1(fct);
-         grid->accept(initVisitor);
-
-         //Postrozess
-         UbSchedulerPtr geoSch(new UbScheduler(1));
-         D3Q27MacroscopicQuantitiesPostprocessorPtr ppgeo(
-            new D3Q27MacroscopicQuantitiesPostprocessor(grid, geoSch, pathname + "/grid/nodes", WbWriterVtkXmlBinary::getInstance(), conv, comm, true));
- if(myid == 0) UBLOG(logINFO,"/grid/nodes");         
-		ppgeo->update(0);
-		 if(myid == 0) UBLOG(logINFO,"line"<<__LINE__); 
-         ppgeo.reset();
-
-         if(myid == 0) UBLOG(logINFO,"Preprozess - end"); 
-      }  
-      double outTime = 5000.0;
-      UbSchedulerPtr visSch(new UbScheduler(outTime));
-      visSch->addSchedule(1000, 1000, 10000);
-      visSch->addSchedule(10000, 10000, 50000);
-      visSch->addSchedule(1000, 1000, 100000);
-
-      D3Q27MacroscopicQuantitiesPostprocessor pp(grid, visSch, pathname + "/steps/step", WbWriterVtkXmlBinary::getInstance(), conv, comm);
-
-      double fdx = grid->getDeltaX(grid->getFinestInitializedLevel());
-      double point1[3] = {0.45, 0.20, 0.205};
-      double point2[3] = {0.55, 0.20, 0.205};
-
-      D3Q27IntegrateValuesHelperPtr h1(new D3Q27IntegrateValuesHelper(grid, comm, 
-         point1[0]-1.0*fdx, point1[1]-1.0*fdx, point1[2]-1.0*fdx, 
-         point1[0], point1[1], point1[2]));
-      if(myid ==0) GbSystem3D::writeGeoObject(h1->getBoundingBox().get(),pathname + "/geo/iv1", WbWriterVtkXmlBinary::getInstance());
-      D3Q27IntegrateValuesHelperPtr h2(new D3Q27IntegrateValuesHelper(grid, comm, 
-         point2[0], point2[1]-1.0*fdx, point2[2]-1.0*fdx, 
-         point2[0]+1.0*fdx, point2[1], point2[2]));
-      if(myid ==0) GbSystem3D::writeGeoObject(h2->getBoundingBox().get(),pathname + "/geo/iv2", WbWriterVtkXmlBinary::getInstance());
-      //D3Q27PressureDifferencePostprocessor rhopp(grid, visSch, pathname + "/results/rho_diff.txt", h1, h2, conv, comm);
-      D3Q27PressureDifferencePostprocessor rhopp(grid, visSch, pathname + "/results/rho_diff.txt", h1, h2, rhoReal, uReal, uLB, comm);
-    
-      
-      double v    = uLB;//4.0*uLB/9.0;
-    //  D3Q27ForcesPostprocessor fp(grid, visSch, pathname + "/results/forces.txt", comm, rhoLB, v, area, D3Q27ForcesPostprocessor::X, D3Q27ForcesPostprocessor::Y, D3Q27ForcesPostprocessor::Z);
-    //      for (int i=0;i<numberOfParticles;i++)
-			 //{      
-				// fp.addInteractor(spherePInt[i]  );
-			 //}
-	  
-      UbSchedulerPtr nupsSch(new UbScheduler(10, 10, 40));
-      NUPSCounterPostprocessor npr(grid, nupsSch, pathname + "/results/nups.txt", comm);
-
-      double endTime = 65001.0;
-      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, visSch));
-      if(myid == 0) UBLOG(logINFO,"Simulation-start");
-      calculation->calculate();
-      if(myid == 0) UBLOG(logINFO,"Simulation-end");
-   }
-   catch(std::exception& e)
-   {
-      cerr << e.what() << endl << flush;
-   }
-   catch(std::string& s)
-   {
-      cerr << s << endl;
-   }
-   catch(...)
-   {
-      cerr << "unknown exception" << endl;
-   }
-
-}
-int main(int argc, char* argv[])
-{
-
-   run(argv[1]);
-
-   return 0;
-}
-
+#include <iostream>
+#include <string>
+
+#include <vfluids.h>
+using namespace std;
+
+
+void run(const char *cstr)
+{
+   CommunicatorPtr comm(new MPICommunicator());
+   try
+   {
+      //Sleep(30000);
+      string machine = QUOTEME(CAB_MACHINE);
+      string pathname; 
+	  string geosphere;	  
+      int numOfThreads = 1;
+      double availMem = 0;
+
+      
+      int myid = comm->getProcessID();
+
+      if(machine == "BOMBADIL") 
+      {
+         pathname = "d:/temp/shear";
+         numOfThreads = 1;
+         availMem = 3.0e9;
+         geosphere = "d:/Data/Ehsan/Agglomerat_n_00020_fd_1.882437_r_0033.930997.txt";
+      }
+       else if(machine == "M01" || machine == "M02")      
+      {
+         pathname = "/work/koskuche/scratch/smallAgg80";
+		// geosphere = "/work/ehsan/data/Agglomerat4.txt";
+	   // geosphere = "/work/ehsan/data/Agglomerat_n_00060_fd_1.858514_r_0061.500327.txt";
+		// geosphere = "/work/ehsan/data/Agglomerat_n_00080_fd_1.855984_r_0071.870085.txt";
+		//geosphere = "/work/ehsan/data/Agglomerat_n_00040_fd_1.864231_r_0049.358563.txt";
+		//geosphere = "/work/ehsan/data/Agglomerat_n_00020_fd_1.882437_r_0033.930997.txt";
+		geosphere = "/work/ehsan/data/Agglomerat_n_00500_fd_1.850643_r_0193.702967.txt";
+      
+		
+		
+		
+         numOfThreads = 1;
+         availMem =1.0e10;// 12.0e9;
+
+         if(myid ==0)
+         {
+            stringstream logFilename;
+            logFilename <<  pathname + "/logfile"+UbSystem::toString(UbSystem::getTimeStamp())+".txt";
+            UbLog::output_policy::setStream(logFilename.str());
+         }
+	   }
+      else throw UbException(UB_EXARGS, "unknown CAB_MACHINE");
+
+      double dx =0.1*4.0;
+
+	  double eq_Diameter=2.0*38.0;//55.3586;//61.5003;//80;//71.8701;//61.5003;
+      double L1 =35.0*eq_Diameter;
+      double L2, L3, H;
+      L2 = L3 = H =35.0*eq_Diameter;//1.0;//0.42*3.9;
+
+      LBMReal radius = 6.0;
+      LBMReal rhoReal = 1.0; //kg/m^3
+      //LBMReal uReal = 0.45;//m/s
+   //   LBMReal uLB = 0.05;
+      LBMReal Re = 0.1;
+      LBMReal rhoLB = 0.0;
+      LBMReal l = L2 / dx;
+
+      //LBMUnitConverterPtr conv = LBMUnitConverterPtr(new LBMUnitConverter(1.0, 1/sqrt(3.0)*(uReal/uLB), 1.0, 1.0/dx, dx*dx*dx));
+      LBMUnitConverterPtr conv = LBMUnitConverterPtr(new LBMUnitConverter());
+
+      const int baseLevel = 0;
+      const int refineLevel = 5;  
+  
+     
+
+      //bounding box
+      double d_minX1 = 0.0;
+      double d_minX2 = 0.0;
+      double d_minX3 = 0.0;
+
+      double d_maxX1 = L1;
+      double d_maxX2 = L2;
+      double d_maxX3 = L3;
+
+	  const int blocknx1 = 8;
+      const int blocknx2 = 8;
+      const int blocknx3 = 8;
+
+      dx =14.4*2.0;// ( 0.9) *(double)(1<<refineLevel);
+
+	  double area =/* radius/dx;*/radius*radius*PI/(dx/(double)(1<<refineLevel))/(dx/(double)(1<<refineLevel));//2.0*radius*H;
+	  double nueReal=1e-6;//water
+	  double uReal=Re*nueReal/(2.0*radius);//real velocity
+	  double F_stokss=6*PI*.001/*water*/*radius*uReal;
+      //LBMReal nueLB = (((4.0/9.0)*uLB)*2.0*(radius/dx))/Re;
+      LBMReal nueLB =.75/((double)(1<<refineLevel));// ((uLB)*2.0*(radius/dx))/Re;
+	//  LBMReal uLB  = ((nueLB)*Re)/ ( 2.0*(radius/dx));//base on the coarsest level
+	  LBMReal uLB  = ((0.75)*Re)/ ( 2.0*(radius/(dx/((double)(1<<refineLevel)))));//base on the coarsest level if nueLB =.75/((double)(1<<refineLevel)) and  dx = ( 0.9) *(double)(1<<refineLevel)
+  //     LBMReal uLB  = ((0.75)*Re)/ ((eq_Diameter/(dx/((double)(1<<refineLevel)))));//base on the coarsest level if nueLB =.75/((double)(1<<refineLevel)) and  dx = ( 0.9) *(double)(1<<refineLevel)
+	 double blockLength = blocknx1*dx;
+	
+
+		double xsphere=1.0*L1/2.0;//0.5;
+		double ysphere=L2/2.0;//0.75;
+		double zsphere=L3/2.0;//0.75;
+ //obstacle
+    	 //////////////////////////////////////////////////////////////////////////
+	  UbFileInputASCII file;
+	  file.open(geosphere);
+	  //file.skipLine();file.skipLine();//2line skiped
+	  std::string NOP=file.readString();
+	  std::string NOP2=file.readString();
+	  const int numberOfParticles=file.readDouble();
+	  if(myid == 0){UBLOG(logINFO,__FILE__<<" " <<__LINE__<<" number of particles="<<numberOfParticles);}	
+	  //std::string Dia=file.readString();
+	  double diameter=2.0*radius;//12;//file.readDouble();
+	  file.skipLine();file.skipLine();file.skipLine();file.skipLine();file.skipLine();file.skipLine();file.skipLine();//7 line skiped
+			GbSphere3DPtr *sphereP=new GbSphere3DPtr[numberOfParticles];
+			  
+			for (int i=0;i<numberOfParticles;i++)
+			{
+			double x=file.readDouble();
+			double y=file.readDouble();
+			double z=file.readDouble();
+		///0degree in x direction		
+			    double x_rotation= x;
+			    double y_rotation= y;
+			    double z_rotation= z;
+///180degree in x direction		
+			   // double x_rotation= x;
+			   // double y_rotation= -y;
+			   // double z_rotation= -z;			   
+		///90degree in y direction	
+			  // double x_rotation=-z;
+			  // double y_rotation= y;
+			  // double z_rotation=x;			
+	   // ///90degree in z axis	
+			   // double x_rotation=-y;
+			   // double y_rotation=x;
+			   // double z_rotation=z;
+		//transfer	
+			double x_final=x_rotation/*/1450*/  +xsphere;
+			double y_final=y_rotation/*/1450*/  +ysphere;
+			double z_final=z_rotation/*/1450*/  +zsphere;
+				sphereP[i]=GbSphere3DPtr(new GbSphere3D(x_final, y_final, z_final, diameter/2.0/*/1450*/));
+				if(myid == 0)GbSystem3D::writeGeoObject(sphereP[i].get(),pathname + "/sphere/sphere"+ "_" + UbSystem::toString(i), WbWriterVtkXmlASCII::getInstance());
+			}
+			file.close();
+///////////////////////////////	
+       D3Q27InteractorPtr *spherePInt=new D3Q27InteractorPtr[numberOfParticles];	
+      double offs = dx;
+
+      //double g_minX1 = d_minX1-offs-0.499999*dx;
+      double g_minX1 = d_minX1-offs;
+      double g_minX2 = d_minX2-offs;
+      double g_minX3 = d_minX3-offs;
+
+      double g_maxX1 = d_maxX1+offs;
+      double g_maxX2 = d_maxX2+offs;
+      double g_maxX3 = d_maxX3+offs;
+			if(myid == 0){UBLOG(logINFO,__FILE__<<" " <<__LINE__);}	  
+      GbObject3DPtr gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
+			if(myid == 0){UBLOG(logINFO,__FILE__<<" " <<__LINE__);}	  
+      
+
+      //refinement area
+      double rf = 0.50*blockLength;
+      // GbObject3DPtr refineCube(new  GbCuboid3D(sphereP[0]->getX1Minimum()-rf*3.0/4.0, sphereP[3]->getX2Minimum()-rf*3.0/4.0, sphereP[5]->getX3Minimum()-rf*1.0/2.0, 
+         // sphereP[2]->getX1Maximum()+rf*3.0/4.0, sphereP[4]->getX2Maximum()+rf*3.0/4.0, sphereP[6]->getX3Maximum()+rf*1.0/2.0));
+		 
+		 //////////
+	   double level5=xsphere-(xsphere-eq_Diameter/2-0.50*(blocknx1*dx/pow(2.0,5)));//0.065;//.085;
+	   double level4=level5+.1*(blocknx1*dx/pow(2.0,4));//0.015;//0.1;
+	   double level3=level4+0.50*(blocknx1*dx/pow(2.0,3));//0.015;//0.115;
+	   double level2=level3+1.0*(blocknx1*dx/pow(2.0,2));//.035;//0.15;
+	   double level1=level2+1.0*(blocknx1*dx/pow(2.0,1));//.05;//0.2;
+	   
+	    GbCuboid3DPtr refineCube1(new GbCuboid3D(  xsphere-level1,ysphere-level1, zsphere-level1,xsphere+level1,ysphere+level1, zsphere+level1));
+	    GbCuboid3DPtr refineCube2(new GbCuboid3D(  xsphere-level2,ysphere-level2, zsphere-level2,xsphere+level2,ysphere+level2, zsphere+level2));
+		GbCuboid3DPtr refineCube3(new GbCuboid3D(  xsphere-level3,ysphere-level3, zsphere-level3,xsphere+level3,ysphere+level3, zsphere+level3));
+		GbCuboid3DPtr refineCube4(new GbCuboid3D(  xsphere-level4,ysphere-level4, zsphere-level4,xsphere+level4,ysphere+level4, zsphere+level4));
+		GbCuboid3DPtr refineCube5(new GbCuboid3D(  xsphere-level5,ysphere-level5, zsphere-level5,xsphere+level5,ysphere+level5, zsphere+level5));
+		 ///////////
+
+      Grid3DPtr grid(new Grid3D(comm));
+
+      UbSchedulerPtr rSch(new UbScheduler(100000, 100000));
+      //RestartPostprocessorPtr rp(new RestartPostprocessor(grid, rSch, comm, pathname+"/checkpoints", RestartPostprocessor::BINARY));
+
+      //UbSchedulerPtr emSch(new UbScheduler(1000, 1000));
+      //EmergencyExitPostprocessor em(grid, emSch, pathname+"/checkpoints/emex.txt", rp, comm);
+
+      std::string opt;
+
+      if(cstr!= NULL)
+         opt = std::string(cstr);
+
+      if/*(cstr== NULL)*/(cstr!= NULL)
+      {
+         opt = std::string(cstr);
+
+         if(myid==0) UBLOG(logINFO,"Restart step: " << opt);
+
+         //grid = rp->restart(UbSystem::stringTo<int>(opt));
+         //rp->reconnect();
+
+         //cylinderInt = 
+
+         //set connectors
+         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27OffsetInterpolationProcessor());
+         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
+         grid->accept( setConnsVisitor );
+
+         //domain decomposition
+         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
+         grid->accept(pqPartVisitor);
+      }
+      else
+      {
+         if(myid ==0)
+         {
+            UBLOG(logINFO,"L = " << L2/dx );
+            UBLOG(logINFO,"v = " << uLB );
+            UBLOG(logINFO,"rho = " << rhoLB );
+            UBLOG(logINFO,"nue = " << nueLB );
+            UBLOG(logINFO,"Re = " << Re );
+			UBLOG(logINFO,"F_stokss = " << F_stokss );
+			UBLOG(logINFO,"dx = " << dx );
+            UBLOG(logINFO,conv->toString() );
+            UBLOG(logINFO,"Preprozess - start");
+         }
+
+         grid->setDeltaX(dx);
+         grid->setBlockNX(blocknx1, blocknx2, blocknx3);
+		 grid->setPeriodicX1(false);
+         grid->setPeriodicX2(true);
+         grid->setPeriodicX3(true);
+
+         // UbTupleDouble6 bouningBox(gridCube->getX1Minimum(),gridCube->getX2Minimum(),gridCube->getX3Minimum(),
+         // gridCube->getX1Maximum(),gridCube->getX2Maximum(),gridCube->getX3Maximum());
+         // UbTupleInt3 blockNx(blocknx1, blocknx2, blocknx3);
+         // UbTupleInt3 gridNx(8, 16, 16);
+         // grid = Grid3DPtr(new Grid3D(bouningBox, blockNx, gridNx));
+
+         if(myid ==0) GbSystem3D::writeGeoObject(gridCube.get(),pathname + "/geo/gridCube", WbWriterVtkXmlBinary::getInstance());
+ //        if(myid ==0) GbSystem3D::writeGeoObject(refineCube.get(),pathname + "/geo/refineCube", WbWriterVtkXmlBinary::getInstance());
+ 
+         ////
+         if(myid ==0) GbSystem3D::writeGeoObject(gridCube.get(),pathname + "/geo/gridCube", WbWriterVtkXmlBinary::getInstance());
+         if(myid ==0) GbSystem3D::writeGeoObject(refineCube1.get(), pathname + "/geo/refineCube1", WbWriterVtkXmlBinary::getInstance());
+		 if(myid ==0) GbSystem3D::writeGeoObject(refineCube2.get(),pathname + "/geo/refineCube2", WbWriterVtkXmlBinary::getInstance());
+         if(myid ==0) GbSystem3D::writeGeoObject(refineCube3.get(),pathname + "/geo/refineCube3", WbWriterVtkXmlBinary::getInstance());
+		 if(myid ==0) GbSystem3D::writeGeoObject(refineCube4.get(),pathname + "/geo/refineCube4", WbWriterVtkXmlBinary::getInstance());
+		 if(myid ==0) GbSystem3D::writeGeoObject(refineCube5.get(),pathname + "/geo/refineCube5", WbWriterVtkXmlBinary::getInstance());
+		 ////
+		 
+         GenBlocksGridVisitor genBlocks;
+         genBlocks.addGeoObject(gridCube);
+         grid->accept(genBlocks);
+
+         //walls
+         GbCuboid3DPtr addWallYmin (new GbCuboid3D(d_minX1-4.0*blockLength, d_minX2-4.0*blockLength, d_minX3-4.0*blockLength, d_maxX1+4.0*blockLength, d_minX2, d_maxX3+4.0*blockLength));
+         if(myid == 0) GbSystem3D::writeGeoObject(addWallYmin.get(), pathname+"/geo/addWallYmin", WbWriterVtkXmlASCII::getInstance());
+
+         GbCuboid3DPtr addWallZmin (new GbCuboid3D(d_minX1-4.0*blockLength, d_minX2-4.0*blockLength, d_minX3-4.0*blockLength, d_maxX1+4.0*blockLength, d_maxX2+4.0*blockLength, d_minX3));
+         if(myid == 0) GbSystem3D::writeGeoObject(addWallZmin.get(), pathname+"/geo/addWallZmin", WbWriterVtkXmlASCII::getInstance());
+
+         GbCuboid3DPtr addWallYmax (new GbCuboid3D(d_minX1-4.0*blockLength, d_maxX2, d_minX3-4.0*blockLength, d_maxX1+4.0*blockLength, d_maxX2+4.0*blockLength, d_maxX3+4.0*blockLength));
+         if(myid == 0) GbSystem3D::writeGeoObject(addWallYmax.get(), pathname+"/geo/addWallYmax", WbWriterVtkXmlASCII::getInstance());
+
+         GbCuboid3DPtr addWallZmax (new GbCuboid3D(d_minX1-4.0*blockLength, d_minX2-4.0*blockLength, d_maxX3, d_maxX1+4.0*blockLength, d_maxX2+4.0*blockLength, d_maxX3+4.0*blockLength));
+         if(myid == 0) GbSystem3D::writeGeoObject(addWallZmax.get(), pathname+"/geo/addWallZmax", WbWriterVtkXmlASCII::getInstance());
+
+         //inflow
+         GbCuboid3DPtr geoInflow (new GbCuboid3D(d_minX1-4.0*blockLength, d_minX2-4.0*blockLength, d_minX3-4.0*blockLength, d_minX1, d_maxX2+4.0*blockLength, d_maxX3+4.0*blockLength));
+         if(myid == 0) GbSystem3D::writeGeoObject(geoInflow.get(), pathname+"/geo/geoInflow", WbWriterVtkXmlASCII::getInstance());
+
+         //outflow
+         GbCuboid3DPtr geoOutflow (new GbCuboid3D(d_maxX1, d_minX2-4.0*blockLength, d_minX3-4.0*blockLength, d_maxX1+4.0*blockLength, d_maxX2+4.0*blockLength, d_maxX3+4.0*blockLength));
+         if(myid == 0) GbSystem3D::writeGeoObject(geoOutflow.get(), pathname+"/geo/geoOutflow", WbWriterVtkXmlASCII::getInstance());
+
+         BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname + "/grid/blocks", WbWriterVtkXmlBinary::getInstance(), comm));
+
+        if (refineLevel > 0)
+         {
+            if(myid == 0) UBLOG(logINFO,"Refinement - start");	
+			RefineCrossAndInsideGbObjectHelper refineHelper(grid, refineLevel);
+			refineHelper.addGbObject(refineCube5, refineLevel);
+			
+		//	refineHelper.addGbObject(refineCube1, refineLevel);
+			// refineHelper.addGbObject(refineCube2, refineLevel-1);
+			// refineHelper.addGbObject(refineCube3, refineLevel-2);
+			// refineHelper.addGbObject(refineCube4, refineLevel-3);
+			//refineHelper.addGbObject(refineCube5, refineLevel-4);
+			
+
+            refineHelper.refine();
+            if(myid == 0) UBLOG(logINFO,"Refinement - end");   
+		 
+         }
+
+         MetisPartitioningGridVisitor metisVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B);
+         grid->accept( metisVisitor );
+
+         SolidBlocksHelper sd(grid, comm);
+
+         int bbOption = 1; //0=simple Bounce Back, 1=quadr. BB
+         D3Q27BoundaryConditionAdapterPtr bcObst(new D3Q27NoSlipBCAdapter(bbOption));
+		 D3Q27BoundaryConditionAdapterPtr bcObst2(new D3Q27SlipBCAdapter(bbOption));
+        // cylinderInt = D3Q27InteractorPtr ( new D3Q27Interactor(cylinder, grid, bcObst,Interactor3D::SOLID));
+		
+			for (int i=0;i<numberOfParticles;i++)
+			{      
+				spherePInt[i]= D3Q27InteractorPtr( new D3Q27Interactor(sphereP[i], grid, bcObst,Interactor3D::SOLID));
+			}
+         //walls
+         D3Q27InteractorPtr addWallYminInt(new D3Q27Interactor(addWallYmin, grid, bcObst2,Interactor3D::SOLID));
+         D3Q27InteractorPtr addWallZminInt(new D3Q27Interactor(addWallZmin, grid, bcObst2,Interactor3D::SOLID));
+         D3Q27InteractorPtr addWallYmaxInt(new D3Q27Interactor(addWallYmax, grid, bcObst2,Interactor3D::SOLID));
+         D3Q27InteractorPtr addWallZmaxInt(new D3Q27Interactor(addWallZmax, grid, bcObst2,Interactor3D::SOLID));
+
+		  //for shear strees =0
+		 // D3Q27BoundaryConditionAdapterPtr velBCAdapter2(new D3Q27VelocityBCAdapter ());
+         // velBCAdapter2->setSecondaryBcOption(1);
+         // D3Q27InteractorPtr addWallYminInt  = D3Q27InteractorPtr( new D3Q27Interactor(addWallYmin, grid, velBCAdapter2, Interactor3D::SOLID));
+		 // D3Q27InteractorPtr addWallZminInt  = D3Q27InteractorPtr( new D3Q27Interactor(addWallZmin, grid, velBCAdapter2, Interactor3D::SOLID));
+		 // D3Q27InteractorPtr addWallYmaxInt  = D3Q27InteractorPtr( new D3Q27Interactor(addWallYmax, grid, velBCAdapter2, Interactor3D::SOLID));
+		 // D3Q27InteractorPtr addWallZmaxInt  = D3Q27InteractorPtr( new D3Q27Interactor(addWallZmax, grid, velBCAdapter2, Interactor3D::SOLID));
+
+		
+		 
+         mu::Parser fct;
+         //fct.SetExpr("16*U*x2*x3*(H-x2)*(H-x3)/H^4");
+         //fct.DefineConst("U", uLB);
+         //fct.DefineConst("H", H);
+
+		 fct.SetExpr("U");
+         fct.DefineConst("U", uLB);
+         
+         //inflow
+         D3Q27BoundaryConditionAdapterPtr velBCAdapter(new D3Q27VelocityBCAdapter (true, false ,false ,fct, 0, D3Q27BCFunction::INFCONST));
+         velBCAdapter->setSecondaryBcOption(0);
+         D3Q27InteractorPtr inflowInt  = D3Q27InteractorPtr( new D3Q27Interactor(geoInflow, grid, velBCAdapter, Interactor3D::SOLID));
+ 
+         //outflow
+         D3Q27BoundaryConditionAdapterPtr denBCAdapter(new D3Q27DensityBCAdapter(rhoLB));
+         D3Q27InteractorPtr outflowInt = D3Q27InteractorPtr( new D3Q27Interactor(geoOutflow, grid, denBCAdapter,Interactor3D::SOLID));
+
+	for (int i=0;i<numberOfParticles;i++)
+			{      
+				sd.addInteractor(spherePInt[i]  );
+			}
+         //sd.addInteractor(cylinderInt);
+         // sd.addInteractor(addWallYminInt);
+         // sd.addInteractor(addWallZminInt);
+         // sd.addInteractor(addWallYmaxInt);
+         // sd.addInteractor(addWallZmaxInt);
+         sd.addInteractor(inflowInt);
+         sd.addInteractor(outflowInt);
+if(myid == 0) UBLOG(logINFO,"delete - start"); 
+         sd.deleteSolidBlocks();
+if(myid == 0) UBLOG(logINFO,"delete - end"); 
+
+         grid->accept( metisVisitor );
+
+         sd.setTransBlocks();
+
+         ppblocks->update(0);
+         ppblocks.reset();
+
+         //set connectors
+         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
+         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
+         grid->accept( setConnsVisitor );
+
+         unsigned long nob = grid->getNumberOfBlocks();
+         int gl = 3;
+         unsigned long nod = nob * (blocknx1+gl) * (blocknx2+gl) * (blocknx3+gl);
+
+         double needMemAll  = double(nod*(27*sizeof(double) + sizeof(int) + sizeof(float)*4));
+         double needMem  = needMemAll / double(comm->getNumberOfProcesses());
+
+         if(myid == 0)
+         {
+            UBLOG(logINFO,"Number of blocks = " << nob);
+            UBLOG(logINFO,"Number of nodes  = " << nod);
+            UBLOG(logINFO,"Necessary memory  = " << needMemAll  << " bytes");
+            UBLOG(logINFO,"Necessary memory per process = " << needMem  << " bytes");
+            UBLOG(logINFO,"Available memory per process = " << availMem << " bytes");
+         }            
+
+         //LBMKernel3DPtr kernel(new LBMKernelETD3Q27Cascaded(blocknx1, blocknx2, blocknx3));
+         //LBMKernel3DPtr kernel(new LBMKernelETD3Q27BGK(blocknx1, blocknx2, blocknx3, true));
+         //option = 0 - ohne param., option = 1 - mit param.
+         int option = 0;
+       LBMKernel3DPtr kernel(new LBMKernelETD3Q27CCLB(blocknx1, blocknx2, blocknx3, option));
+      //   LBMKernel3DPtr kernel(new LBMKernelETD3Q27CCLB_Geier(blocknx1, blocknx2, blocknx3, option));
+	 
+//	     LBMKernel3DPtr kernel(new  LBMKernelETD3Q27Cascaded(blocknx1, blocknx2, blocknx3, option));
+         BCProcessorPtr bcProc(new D3Q27ETBCProcessor());
+         kernel->setBCProcessor(bcProc);
+
+         SetKernelBlockVisitor kernelVisitor(kernel, nueLB, availMem, needMem);
+         grid->accept(kernelVisitor);
+
+         if (refineLevel > 0)
+         {
+            D3Q27SetUndefinedNodesBlockVisitor undefNodesVisitor;
+            grid->accept(undefNodesVisitor);
+         }
+
+         //walls
+        // grid->addAndInitInteractor(addWallYminInt);
+        // grid->addAndInitInteractor(addWallZminInt);
+        // grid->addAndInitInteractor(addWallYmaxInt);
+        // grid->addAndInitInteractor(addWallZmaxInt);
+
+         //obstacle
+         //grid->addAndInitInteractor(cylinderInt);
+			for (int i=0;i<numberOfParticles;i++)
+			{      
+				grid->addAndInitInteractor(spherePInt[i]  );
+			}
+
+         //inflow
+         grid->addAndInitInteractor(inflowInt);
+
+         //outflow
+         grid->addAndInitInteractor(outflowInt);
+
+         //domain decomposition
+         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
+         grid->accept(pqPartVisitor);
+
+         //initialization of distributions
+         D3Q27ETInitDistributionsBlockVisitor initVisitor(rhoLB);
+         initVisitor.setVx1(fct);
+         grid->accept(initVisitor);
+
+         //Postrozess
+         UbSchedulerPtr geoSch(new UbScheduler(1));
+         D3Q27MacroscopicQuantitiesPostprocessorPtr ppgeo(
+            new D3Q27MacroscopicQuantitiesPostprocessor(grid, geoSch, pathname + "/grid/nodes", WbWriterVtkXmlBinary::getInstance(), conv, comm, true));
+ if(myid == 0) UBLOG(logINFO,"/grid/nodes");         
+		ppgeo->update(0);
+		 if(myid == 0) UBLOG(logINFO,"line"<<__LINE__); 
+         ppgeo.reset();
+
+         if(myid == 0) UBLOG(logINFO,"Preprozess - end"); 
+      }  
+      double outTime = 5000.0;
+      UbSchedulerPtr visSch(new UbScheduler(outTime));
+      visSch->addSchedule(1000, 1000, 10000);
+      visSch->addSchedule(10000, 10000, 50000);
+      visSch->addSchedule(1000, 1000, 100000);
+
+      D3Q27MacroscopicQuantitiesPostprocessor pp(grid, visSch, pathname + "/steps/step", WbWriterVtkXmlBinary::getInstance(), conv, comm);
+
+      double fdx = grid->getDeltaX(grid->getFinestInitializedLevel());
+      double point1[3] = {0.45, 0.20, 0.205};
+      double point2[3] = {0.55, 0.20, 0.205};
+
+      D3Q27IntegrateValuesHelperPtr h1(new D3Q27IntegrateValuesHelper(grid, comm, 
+         point1[0]-1.0*fdx, point1[1]-1.0*fdx, point1[2]-1.0*fdx, 
+         point1[0], point1[1], point1[2]));
+      if(myid ==0) GbSystem3D::writeGeoObject(h1->getBoundingBox().get(),pathname + "/geo/iv1", WbWriterVtkXmlBinary::getInstance());
+      D3Q27IntegrateValuesHelperPtr h2(new D3Q27IntegrateValuesHelper(grid, comm, 
+         point2[0], point2[1]-1.0*fdx, point2[2]-1.0*fdx, 
+         point2[0]+1.0*fdx, point2[1], point2[2]));
+      if(myid ==0) GbSystem3D::writeGeoObject(h2->getBoundingBox().get(),pathname + "/geo/iv2", WbWriterVtkXmlBinary::getInstance());
+      //D3Q27PressureDifferencePostprocessor rhopp(grid, visSch, pathname + "/results/rho_diff.txt", h1, h2, conv, comm);
+      D3Q27PressureDifferencePostprocessor rhopp(grid, visSch, pathname + "/results/rho_diff.txt", h1, h2, rhoReal, uReal, uLB, comm);
+    
+      
+      double v    = uLB;//4.0*uLB/9.0;
+    //  D3Q27ForcesPostprocessor fp(grid, visSch, pathname + "/results/forces.txt", comm, rhoLB, v, area, D3Q27ForcesPostprocessor::X, D3Q27ForcesPostprocessor::Y, D3Q27ForcesPostprocessor::Z);
+    //      for (int i=0;i<numberOfParticles;i++)
+			 //{      
+				// fp.addInteractor(spherePInt[i]  );
+			 //}
+	  
+      UbSchedulerPtr nupsSch(new UbScheduler(10, 10, 40));
+      NUPSCounterPostprocessor npr(grid, nupsSch, pathname + "/results/nups.txt", comm);
+
+      double endTime = 65001.0;
+      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, visSch));
+      if(myid == 0) UBLOG(logINFO,"Simulation-start");
+      calculation->calculate();
+      if(myid == 0) UBLOG(logINFO,"Simulation-end");
+   }
+   catch(std::exception& e)
+   {
+      cerr << e.what() << endl << flush;
+   }
+   catch(std::string& s)
+   {
+      cerr << s << endl;
+   }
+   catch(...)
+   {
+      cerr << "unknown exception" << endl;
+   }
+
+}
+int main(int argc, char* argv[])
+{
+
+   run(argv[1]);
+
+   return 0;
+}
+
diff --git a/apps/cpu/sphere/config.txt b/apps/cpu/sphere/config.txt
index 53bd75458a4bda12585ffc5f5f070fe759f037ec..cbd03fd4bb66449608a1ea07a79295b3bf340acb 100644
--- a/apps/cpu/sphere/config.txt
+++ b/apps/cpu/sphere/config.txt
@@ -1,22 +1,22 @@
-#Ordner für Simulationsergebnisse
-path=d:/temp/sphere
-
-#Verfügbare Arbeitsspeicher in Byte
-memory=3e9
-
-#Pfad zum Metafile
-metafile=d:/Data/insituDemo/metafile.csv
-
-#Ausgabezeitschritt
-outstep=1
-
-#maximale Anzahl Simulationszeitschritte
-endstep=100000
-
-#Anzahl von Threads
-threads=1
-
-#max refierment level (1 - 5)
-level=4
-
+#Ordner für Simulationsergebnisse
+path=d:/temp/sphere
+
+#Verfügbare Arbeitsspeicher in Byte
+memory=3e9
+
+#Pfad zum Metafile
+metafile=d:/Data/insituDemo/metafile.csv
+
+#Ausgabezeitschritt
+outstep=1
+
+#maximale Anzahl Simulationszeitschritte
+endstep=100000
+
+#Anzahl von Threads
+threads=1
+
+#max refierment level (1 - 5)
+level=4
+
 test = true
\ No newline at end of file
diff --git a/apps/cpu/sphere/sphere.cpp b/apps/cpu/sphere/sphere.cpp
index 604d9e744b7c1821c048b163e53f4ec040fc8168..872e7b81f402f5288eaf8b0f56678d7dfb4c34d9 100644
--- a/apps/cpu/sphere/sphere.cpp
+++ b/apps/cpu/sphere/sphere.cpp
@@ -1,372 +1,372 @@
-#include <VirtualFluids.h>
-#include <set>
-#include <map>
-using namespace std;
-
-
-////////////////////////////////////////////////////////////////////////
-void run(string configname)
-{
-   try
-   {
-
-      //Sleep(30000);
-
-      string machine = QUOTEME(CAB_MACHINE);
-
-      SPtr<Communicator> comm = MPICommunicator::getInstance();
-
-      int myid = comm->getProcessID();
-      int mybundle = comm->getBundleID();
-      int root = comm->getRoot();
-
-      //ConfigFileReader cf(cstr);
-      //if ( !cf.read() )
-      //{
-      //   std::string exceptionText = "Unable to read configuration file\n";
-      //   throw exceptionText;
-      //}
-
-      //pathname = cf.getValue("path");
-      //availMem = UbSystem::stringTo<double>(cf.getValue("memory"));
-      //string metafile = cf.getValue("metafile");
-      //double outstep = UbSystem::stringTo<double>(cf.getValue("outstep"));
-      //double endstep = UbSystem::stringTo<double>(cf.getValue("endstep"));
-      //int numOfThreads = UbSystem::stringTo<int>(cf.getValue("threads"));
-
-      ConfigurationFile   config;
-      config.load(configname);
-
-      string pathname = config.getValue<string>("path");
-      double availMem = config.getValue<double>("memory");
-      string metafile = config.getValue<string>("metafile");
-      double outstep  = config.getValue<double>("outstep");
-      double endstep        = config.getValue<double>("endstep");
-      int numOfThreads      = config.getValue<int>("threads");
-      const int refineLevel = config.getValue<int>("level");
-
-      bool test = config.getValue<bool>("test");
-
-      LBMReal radius = 4;
-      LBMReal uLB = 0.1;
-      LBMReal Re = 1;
-      LBMReal rhoLB = 0.0;
-      //LBMReal nuLB = (uLB*2.0*radius)/Re;
-      //LBMReal nuLB = (uLB*L2)/Re;
-      LBMReal nuLB = 0.168666666667/100;
-
-      double dp_LB = 1e-6;
-      double rhoLBinflow = dp_LB*3.0;
-
-      SPtr<BCAdapter> noSlipBCAdapter(new NoSlipBCAdapter());
-      noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NoSlipBCAlgorithm()));
-      
-      mu::Parser fct;
-      fct.SetExpr("U");
-      fct.DefineConst("U", uLB);
-      SPtr<BCAdapter> velBCAdapter(new VelocityBCAdapter(true, false, false, fct, 0, BCFunction::INFCONST));
-      velBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new VelocityBCAlgorithm()));
-
-      SPtr<BCAdapter> denBCAdapter(new DensityBCAdapter(rhoLB));
-      denBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NonEqDensityBCAlgorithm()));
-
-      BoundaryConditionsBlockVisitor bcVisitor;
-      bcVisitor.addBC(noSlipBCAdapter);
-      bcVisitor.addBC(velBCAdapter);
-      bcVisitor.addBC(denBCAdapter);
-
-      SPtr<LBMUnitConverter> conv = SPtr<LBMUnitConverter>(new LBMUnitConverter());
-
-      double dx = 1;
-
-      const int blocknx1 = 8;
-      const int blocknx2 = 8;
-      const int blocknx3 = 8;
-
-      const int gridNx1 = 4;//18;
-      const int gridNx2 = 4;// 11;
-      const int gridNx3 = 4;// 11;
-
-      //const int blocknx1 = 40;
-      //const int blocknx2 = 40;
-      //const int blocknx3 = 40;
-
-      //const int gridNx1 = 2;
-      //const int gridNx2 = 2;
-      //const int gridNx3 = 2;
-
-      double L1 = gridNx1*blocknx1;
-      double L2, L3;
-      L2 = gridNx2*blocknx1;
-      L3 = gridNx3*blocknx1;
-
-
-
-      SPtr<Grid3D> grid(new Grid3D(comm));
-      grid->setDeltaX(dx);
-      grid->setBlockNX(blocknx1, blocknx2, blocknx3);
-
-      //////////////////////////////////////////////////////////////////////////
-      //restart
-      SPtr<UbScheduler> restartSch(new UbScheduler(100000, 100000, 100000));
-      RestartCoProcessor rp(grid, restartSch, comm, pathname, RestartCoProcessor::BINARY);
-      //////////////////////////////////////////////////////////////////////////
-
-      if (grid->getTimeStep() == 0)
-      {
-
-         const int baseLevel = 0;
-
-         //bounding box
-         double d_minX1 = 0.0;
-         double d_minX2 = 0.0;
-         double d_minX3 = 0.0;
-
-         double d_maxX1 = L1;
-         double d_maxX2 = L2;
-         double d_maxX3 = L3;
-
-         double blockLength = blocknx1*dx;
-
-         if (myid == 0)
-         {
-            UBLOG(logINFO, "Parameters:");
-            UBLOG(logINFO, "uLB = " << uLB);
-            UBLOG(logINFO, "rhoLB = " << rhoLB);
-            UBLOG(logINFO, "nueLB = " << nuLB);
-            UBLOG(logINFO, "Re = " << Re);
-            UBLOG(logINFO, "dx = " << dx);
-            UBLOG(logINFO, "number of levels = " << refineLevel + 1);
-            UBLOG(logINFO, "numOfThreads = " << numOfThreads);
-            UBLOG(logINFO, "Preprozess - start");
-         }
-
-         SPtr<GbObject3D> gridCube(new GbCuboid3D(d_minX1, d_minX2, d_minX3, d_maxX1, d_maxX2, d_maxX3));
-         if (myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), pathname + "/geo/gridCube", WbWriterVtkXmlBinary::getInstance());
-
-         GenBlocksGridVisitor genBlocks(gridCube);
-         grid->accept(genBlocks);
-
-         //sphere
-         //SPtr<GbObject3D> sphereRef(new GbSphere3D(L1/4.0, L2*0.5, L3*0.5, radius+1.0));
-         //GbSystem3D::writeGeoObject(sphereRef.get(),pathname + "/geo/sphereRef", WbWriterVtkXmlBinary::getInstance());
-
-         
-         //sphere
-         SPtr<GbObject3D> sphere(new GbSphere3D(L1 / 2.0, L2*0.5, L3*0.5, radius));
-         //SPtr<GbObject3D> sphere(new GbSphere3D(L1/2.0-4.0, L2*0.5+4.0, L3*0.5+4.0, radius));
-         //SPtr<GbObject3D> sphere(new GbCuboid3D(L1/4.0-radius, L2/2.0-radius, L3/2.0-radius, L1/4.0+radius, L2/2.0+radius, L3/2.0+radius));
-         GbSystem3D::writeGeoObject(sphere.get(), pathname + "/geo/sphere", WbWriterVtkXmlBinary::getInstance());
-
-         double off = 0.0;
-         SPtr<GbObject3D> refCube(new GbCuboid3D(sphere->getX1Minimum() - off, sphere->getX2Minimum() - off, sphere->getX3Minimum(),
-            sphere->getX1Maximum() + off, sphere->getX2Maximum() + off, sphere->getX3Maximum()));
-         if (myid == 0) GbSystem3D::writeGeoObject(refCube.get(), pathname + "/geo/refCube", WbWriterVtkXmlBinary::getInstance());
-
-         if (refineLevel > 0)
-         {
-            if (myid == 0) UBLOG(logINFO, "Refinement - start");
-            RefineCrossAndInsideGbObjectHelper refineHelper(grid, refineLevel, comm);
-            refineHelper.addGbObject(sphere, refineLevel);
-            //refineHelper.addGbObject(refCube, refineLevel);
-            refineHelper.refine();
-            if (myid == 0) UBLOG(logINFO, "Refinement - end");
-         }
-
-         //walls
-         GbCuboid3DPtr addWallYmin(new GbCuboid3D(d_minX1 - 4.0*blockLength, d_minX2 - 4.0*blockLength, d_minX3 - 4.0*blockLength, d_maxX1 + 4.0*blockLength, d_minX2, d_maxX3 + 4.0*blockLength));
-         if (myid == 0) GbSystem3D::writeGeoObject(addWallYmin.get(), pathname + "/geo/addWallYmin", WbWriterVtkXmlASCII::getInstance());
-
-         GbCuboid3DPtr addWallZmin(new GbCuboid3D(d_minX1 - 4.0*blockLength, d_minX2 - 4.0*blockLength, d_minX3 - 4.0*blockLength, d_maxX1 + 4.0*blockLength, d_maxX2 + 4.0*blockLength, d_minX3));
-         if (myid == 0) GbSystem3D::writeGeoObject(addWallZmin.get(), pathname + "/geo/addWallZmin", WbWriterVtkXmlASCII::getInstance());
-
-         GbCuboid3DPtr addWallYmax(new GbCuboid3D(d_minX1 - 4.0*blockLength, d_maxX2, d_minX3 - 4.0*blockLength, d_maxX1 + 4.0*blockLength, d_maxX2 + 4.0*blockLength, d_maxX3 + 4.0*blockLength));
-         if (myid == 0) GbSystem3D::writeGeoObject(addWallYmax.get(), pathname + "/geo/addWallYmax", WbWriterVtkXmlASCII::getInstance());
-
-         GbCuboid3DPtr addWallZmax(new GbCuboid3D(d_minX1 - 4.0*blockLength, d_minX2 - 4.0*blockLength, d_maxX3, d_maxX1 + 4.0*blockLength, d_maxX2 + 4.0*blockLength, d_maxX3 + 4.0*blockLength));
-         if (myid == 0) GbSystem3D::writeGeoObject(addWallZmax.get(), pathname + "/geo/addWallZmax", WbWriterVtkXmlASCII::getInstance());
-
-         //inflow
-         GbCuboid3DPtr geoInflow(new GbCuboid3D(d_minX1 - 4.0*blockLength, d_minX2 - 4.0*blockLength, d_minX3 - 4.0*blockLength, d_minX1, d_maxX2 + 4.0*blockLength, d_maxX3 + 4.0*blockLength));
-         if (myid == 0) GbSystem3D::writeGeoObject(geoInflow.get(), pathname + "/geo/geoInflow", WbWriterVtkXmlASCII::getInstance());
-
-         //outflow
-         GbCuboid3DPtr geoOutflow(new GbCuboid3D(d_maxX1, d_minX2 - 4.0*blockLength, d_minX3 - 4.0*blockLength, d_maxX1 + 4.0*blockLength, d_maxX2 + 4.0*blockLength, d_maxX3 + 4.0*blockLength));
-         if (myid == 0) GbSystem3D::writeGeoObject(geoOutflow.get(), pathname + "/geo/geoOutflow", WbWriterVtkXmlASCII::getInstance());
-
-         WriteBlocksSPtr<CoProcessor> ppblocks(new WriteBlocksCoProcessor(grid, SPtr<UbScheduler>(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm));
-
-
-
-         //sphere
-         SPtr<D3Q27Interactor> sphereInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(sphere, grid, noSlipBCAdapter, Interactor3D::SOLID));
-
-         //walls
-         SPtr<D3Q27Interactor> addWallYminInt(new D3Q27Interactor(addWallYmin, grid, noSlipBCAdapter, Interactor3D::SOLID));
-         SPtr<D3Q27Interactor> addWallZminInt(new D3Q27Interactor(addWallZmin, grid, noSlipBCAdapter, Interactor3D::SOLID));
-         SPtr<D3Q27Interactor> addWallYmaxInt(new D3Q27Interactor(addWallYmax, grid, noSlipBCAdapter, Interactor3D::SOLID));
-         SPtr<D3Q27Interactor> addWallZmaxInt(new D3Q27Interactor(addWallZmax, grid, noSlipBCAdapter, Interactor3D::SOLID));
-
-         mu::Parser fct;
-         fct.SetExpr("U");
-         fct.DefineConst("U", uLB);
-
-         //inflow
-         SPtr<D3Q27Interactor> inflowInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoInflow, grid, velBCAdapter, Interactor3D::SOLID));
-
-         //D3Q27BoundaryConditionAdapterPtr denBCAdapterInflow(new D3Q27DensityBCAdapter(rhoLBinflow));
-         //denBCAdapterInflow->setSecondaryBcOption(0);
-         //SPtr<D3Q27Interactor> inflowInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoInflow, grid, denBCAdapterInflow, Interactor3D::SOLID));
-
-         //outflow
-         SPtr<D3Q27Interactor> outflowInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoOutflow, grid, denBCAdapter, Interactor3D::SOLID));
-
-         SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B));
-         InteractorsHelper intHelper(grid, metisVisitor);
-         //intHelper.addInteractor(sphereInt);
-         intHelper.addInteractor(addWallYminInt);
-         intHelper.addInteractor(addWallZminInt);
-         intHelper.addInteractor(addWallYmaxInt);
-         intHelper.addInteractor(addWallZmaxInt);
-         intHelper.addInteractor(inflowInt);
-         intHelper.addInteractor(outflowInt);
-         intHelper.selectBlocks();
-
-         //domain decomposition for threads
-         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
-         grid->accept(pqPartVisitor);
-
-
-         //set connectors
-         InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor());
-         SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
-         grid->accept(setConnsVisitor);
-
-         //Block3DSPtr<ConnectorFactory> factory(new Block3DConnectorFactory());
-         //ConnectorBlockVisitor setConnsVisitor(comm, nuLB, iProcessor, factory);
-         //grid->accept(setConnsVisitor);
-
-         ppblocks->process(0);
-         ppblocks.reset();
-
-         unsigned long nob = grid->getNumberOfBlocks();
-         int gl = 3;
-         unsigned long nod = nob * (blocknx1 + gl) * (blocknx2 + gl) * (blocknx3 + gl);
-
-         double needMemAll = double(nod*(27 * sizeof(double) + sizeof(int) + sizeof(float) * 4));
-         double needMem = needMemAll / double(comm->getNumberOfProcesses());
-
-         if (myid == 0)
-         {
-            UBLOG(logINFO, "Number of blocks = " << nob);
-            UBLOG(logINFO, "Number of nodes  = " << nod);
-            UBLOG(logINFO, "Necessary memory  = " << needMemAll << " bytes");
-            UBLOG(logINFO, "Necessary memory per process = " << needMem << " bytes");
-            UBLOG(logINFO, "Available memory per process = " << availMem << " bytes");
-         }
-
-         SPtr<LBMKernel> kernel(new IncompressibleCumulantLBMKernel(blocknx1, blocknx2, blocknx3, IncompressibleCumulantLBMKernel::NORMAL));
-
-         SPtr<BCProcessor> bcProcessor(new BCProcessor());
-
-
-         kernel->setBCProcessor(bcProcessor);
-
-         SetKernelBlockVisitor kernelVisitor(kernel, nuLB, availMem, needMem);
-         grid->accept(kernelVisitor);
-
-         if (refineLevel > 0)
-         {
-            SetUndefinedNodesBlockVisitor undefNodesVisitor;
-            grid->accept(undefNodesVisitor);
-         }
-
-         intHelper.setBC();
-
-         grid->accept(bcVisitor);
-
-         mu::Parser fctRoh;
-         fctRoh.SetExpr("(x1max-x1)/l*dp*3.0");
-         fctRoh.DefineConst("dp", dp_LB);
-         fctRoh.DefineConst("x1max", d_maxX1);
-         fctRoh.DefineConst("l", d_maxX1 - d_minX1);
-
-         //initialization of distributions
-         InitDistributionsBlockVisitor initVisitor(nuLB, rhoLB);
-         initVisitor.setVx1(fct);
-         //initVisitor.setRho(fctRoh);
-         grid->accept(initVisitor);
-
-         //Postrozess
-         SPtr<UbScheduler> geoSch(new UbScheduler(1));
-         WriteBoundaryConditionsSPtr<CoProcessor> ppgeo(
-            new WriteBoundaryConditionsCoProcessor(grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, comm));
-         ppgeo->process(0);
-         ppgeo.reset();;
-
-         if (myid == 0) UBLOG(logINFO, "Preprozess - end");
-      }
-      else
-      {
-         UBLOG(logINFO, "SetConnectors - start, id=" << myid);
-
-         //set connectors
-         InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor());
-         //D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
-         SPtr<ConnectorFactory> cFactory(new Block3DConnectorFactory());
-         ConnectorBlockVisitor setConnsVisitor(comm, nuLB, iProcessor, cFactory);
-         grid->accept(setConnsVisitor);
-
-         UBLOG(logINFO, "SetConnectors - end, id=" << myid);
-      }
-
-      SPtr<UbScheduler> stepSch(new UbScheduler(outstep));
-      //stepSch->addSchedule(10000, 0, 1000000);
-      WriteMacroscopicQuantitiesCoProcessor pp(grid, stepSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv,comm);
-
-      SPtr<UbScheduler> nupsSch(new UbScheduler(10, 30, 100));
-      NUPSCounterCoProcessor npr(grid, nupsSch, numOfThreads, comm);
-
-      const SPtr<ConcreteCalculatorFactory> calculatorFactory = std::make_shared<ConcreteCalculatorFactory>(stepSch);
-      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endstep, calculatorFactory, CalculatorType::HYBRID));
-
-      if (myid == 0)
-         UBLOG(logINFO, "Simulation-start");
-
-      calculation->calculate();
-
-      if (myid == 0)
-         UBLOG(logINFO, "Simulation-end");
-
-   }
-   catch (std::exception& e)
-   {
-      cerr << e.what() << endl << flush;
-   }
-   catch (std::string& s)
-   {
-      cerr << s << endl;
-   }
-   catch (...)
-   {
-      cerr << "unknown exception" << endl;
-   }
-
-}
-
-//////////////////////////////////////////////////////////////////////////
-int main(int argc, char* argv[])
-{
-   if (argv != NULL)
-   {
-      if (argv[1] != NULL)
-      {
-         run(string(argv[1]));
-      }
-      else
-      {
-         cout << "Configuration file is missing!" << endl;
-      }
-   }
-}
-
+#include <VirtualFluids.h>
+#include <set>
+#include <map>
+using namespace std;
+
+
+////////////////////////////////////////////////////////////////////////
+void run(string configname)
+{
+   try
+   {
+
+      //Sleep(30000);
+
+      string machine = QUOTEME(CAB_MACHINE);
+
+      SPtr<Communicator> comm = MPICommunicator::getInstance();
+
+      int myid = comm->getProcessID();
+      int mybundle = comm->getBundleID();
+      int root = comm->getRoot();
+
+      //ConfigFileReader cf(cstr);
+      //if ( !cf.read() )
+      //{
+      //   std::string exceptionText = "Unable to read configuration file\n";
+      //   throw exceptionText;
+      //}
+
+      //pathname = cf.getValue("path");
+      //availMem = UbSystem::stringTo<double>(cf.getValue("memory"));
+      //string metafile = cf.getValue("metafile");
+      //double outstep = UbSystem::stringTo<double>(cf.getValue("outstep"));
+      //double endstep = UbSystem::stringTo<double>(cf.getValue("endstep"));
+      //int numOfThreads = UbSystem::stringTo<int>(cf.getValue("threads"));
+
+      ConfigurationFile   config;
+      config.load(configname);
+
+      string pathname = config.getValue<string>("path");
+      double availMem = config.getValue<double>("memory");
+      string metafile = config.getValue<string>("metafile");
+      double outstep  = config.getValue<double>("outstep");
+      double endstep        = config.getValue<double>("endstep");
+      int numOfThreads      = config.getValue<int>("threads");
+      const int refineLevel = config.getValue<int>("level");
+
+      bool test = config.getValue<bool>("test");
+
+      LBMReal radius = 4;
+      LBMReal uLB = 0.1;
+      LBMReal Re = 1;
+      LBMReal rhoLB = 0.0;
+      //LBMReal nuLB = (uLB*2.0*radius)/Re;
+      //LBMReal nuLB = (uLB*L2)/Re;
+      LBMReal nuLB = 0.168666666667/100;
+
+      double dp_LB = 1e-6;
+      double rhoLBinflow = dp_LB*3.0;
+
+      SPtr<BCAdapter> noSlipBCAdapter(new NoSlipBCAdapter());
+      noSlipBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NoSlipBCAlgorithm()));
+      
+      mu::Parser fct;
+      fct.SetExpr("U");
+      fct.DefineConst("U", uLB);
+      SPtr<BCAdapter> velBCAdapter(new VelocityBCAdapter(true, false, false, fct, 0, BCFunction::INFCONST));
+      velBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new VelocityBCAlgorithm()));
+
+      SPtr<BCAdapter> denBCAdapter(new DensityBCAdapter(rhoLB));
+      denBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NonEqDensityBCAlgorithm()));
+
+      BoundaryConditionsBlockVisitor bcVisitor;
+      bcVisitor.addBC(noSlipBCAdapter);
+      bcVisitor.addBC(velBCAdapter);
+      bcVisitor.addBC(denBCAdapter);
+
+      SPtr<LBMUnitConverter> conv = SPtr<LBMUnitConverter>(new LBMUnitConverter());
+
+      double dx = 1;
+
+      const int blocknx1 = 8;
+      const int blocknx2 = 8;
+      const int blocknx3 = 8;
+
+      const int gridNx1 = 4;//18;
+      const int gridNx2 = 4;// 11;
+      const int gridNx3 = 4;// 11;
+
+      //const int blocknx1 = 40;
+      //const int blocknx2 = 40;
+      //const int blocknx3 = 40;
+
+      //const int gridNx1 = 2;
+      //const int gridNx2 = 2;
+      //const int gridNx3 = 2;
+
+      double L1 = gridNx1*blocknx1;
+      double L2, L3;
+      L2 = gridNx2*blocknx1;
+      L3 = gridNx3*blocknx1;
+
+
+
+      SPtr<Grid3D> grid(new Grid3D(comm));
+      grid->setDeltaX(dx);
+      grid->setBlockNX(blocknx1, blocknx2, blocknx3);
+
+      //////////////////////////////////////////////////////////////////////////
+      //restart
+      SPtr<UbScheduler> restartSch(new UbScheduler(100000, 100000, 100000));
+      RestartCoProcessor rp(grid, restartSch, comm, pathname, RestartCoProcessor::BINARY);
+      //////////////////////////////////////////////////////////////////////////
+
+      if (grid->getTimeStep() == 0)
+      {
+
+         const int baseLevel = 0;
+
+         //bounding box
+         double d_minX1 = 0.0;
+         double d_minX2 = 0.0;
+         double d_minX3 = 0.0;
+
+         double d_maxX1 = L1;
+         double d_maxX2 = L2;
+         double d_maxX3 = L3;
+
+         double blockLength = blocknx1*dx;
+
+         if (myid == 0)
+         {
+            UBLOG(logINFO, "Parameters:");
+            UBLOG(logINFO, "uLB = " << uLB);
+            UBLOG(logINFO, "rhoLB = " << rhoLB);
+            UBLOG(logINFO, "nueLB = " << nuLB);
+            UBLOG(logINFO, "Re = " << Re);
+            UBLOG(logINFO, "dx = " << dx);
+            UBLOG(logINFO, "number of levels = " << refineLevel + 1);
+            UBLOG(logINFO, "numOfThreads = " << numOfThreads);
+            UBLOG(logINFO, "Preprozess - start");
+         }
+
+         SPtr<GbObject3D> gridCube(new GbCuboid3D(d_minX1, d_minX2, d_minX3, d_maxX1, d_maxX2, d_maxX3));
+         if (myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), pathname + "/geo/gridCube", WbWriterVtkXmlBinary::getInstance());
+
+         GenBlocksGridVisitor genBlocks(gridCube);
+         grid->accept(genBlocks);
+
+         //sphere
+         //SPtr<GbObject3D> sphereRef(new GbSphere3D(L1/4.0, L2*0.5, L3*0.5, radius+1.0));
+         //GbSystem3D::writeGeoObject(sphereRef.get(),pathname + "/geo/sphereRef", WbWriterVtkXmlBinary::getInstance());
+
+         
+         //sphere
+         SPtr<GbObject3D> sphere(new GbSphere3D(L1 / 2.0, L2*0.5, L3*0.5, radius));
+         //SPtr<GbObject3D> sphere(new GbSphere3D(L1/2.0-4.0, L2*0.5+4.0, L3*0.5+4.0, radius));
+         //SPtr<GbObject3D> sphere(new GbCuboid3D(L1/4.0-radius, L2/2.0-radius, L3/2.0-radius, L1/4.0+radius, L2/2.0+radius, L3/2.0+radius));
+         GbSystem3D::writeGeoObject(sphere.get(), pathname + "/geo/sphere", WbWriterVtkXmlBinary::getInstance());
+
+         double off = 0.0;
+         SPtr<GbObject3D> refCube(new GbCuboid3D(sphere->getX1Minimum() - off, sphere->getX2Minimum() - off, sphere->getX3Minimum(),
+            sphere->getX1Maximum() + off, sphere->getX2Maximum() + off, sphere->getX3Maximum()));
+         if (myid == 0) GbSystem3D::writeGeoObject(refCube.get(), pathname + "/geo/refCube", WbWriterVtkXmlBinary::getInstance());
+
+         if (refineLevel > 0)
+         {
+            if (myid == 0) UBLOG(logINFO, "Refinement - start");
+            RefineCrossAndInsideGbObjectHelper refineHelper(grid, refineLevel, comm);
+            refineHelper.addGbObject(sphere, refineLevel);
+            //refineHelper.addGbObject(refCube, refineLevel);
+            refineHelper.refine();
+            if (myid == 0) UBLOG(logINFO, "Refinement - end");
+         }
+
+         //walls
+         GbCuboid3DPtr addWallYmin(new GbCuboid3D(d_minX1 - 4.0*blockLength, d_minX2 - 4.0*blockLength, d_minX3 - 4.0*blockLength, d_maxX1 + 4.0*blockLength, d_minX2, d_maxX3 + 4.0*blockLength));
+         if (myid == 0) GbSystem3D::writeGeoObject(addWallYmin.get(), pathname + "/geo/addWallYmin", WbWriterVtkXmlASCII::getInstance());
+
+         GbCuboid3DPtr addWallZmin(new GbCuboid3D(d_minX1 - 4.0*blockLength, d_minX2 - 4.0*blockLength, d_minX3 - 4.0*blockLength, d_maxX1 + 4.0*blockLength, d_maxX2 + 4.0*blockLength, d_minX3));
+         if (myid == 0) GbSystem3D::writeGeoObject(addWallZmin.get(), pathname + "/geo/addWallZmin", WbWriterVtkXmlASCII::getInstance());
+
+         GbCuboid3DPtr addWallYmax(new GbCuboid3D(d_minX1 - 4.0*blockLength, d_maxX2, d_minX3 - 4.0*blockLength, d_maxX1 + 4.0*blockLength, d_maxX2 + 4.0*blockLength, d_maxX3 + 4.0*blockLength));
+         if (myid == 0) GbSystem3D::writeGeoObject(addWallYmax.get(), pathname + "/geo/addWallYmax", WbWriterVtkXmlASCII::getInstance());
+
+         GbCuboid3DPtr addWallZmax(new GbCuboid3D(d_minX1 - 4.0*blockLength, d_minX2 - 4.0*blockLength, d_maxX3, d_maxX1 + 4.0*blockLength, d_maxX2 + 4.0*blockLength, d_maxX3 + 4.0*blockLength));
+         if (myid == 0) GbSystem3D::writeGeoObject(addWallZmax.get(), pathname + "/geo/addWallZmax", WbWriterVtkXmlASCII::getInstance());
+
+         //inflow
+         GbCuboid3DPtr geoInflow(new GbCuboid3D(d_minX1 - 4.0*blockLength, d_minX2 - 4.0*blockLength, d_minX3 - 4.0*blockLength, d_minX1, d_maxX2 + 4.0*blockLength, d_maxX3 + 4.0*blockLength));
+         if (myid == 0) GbSystem3D::writeGeoObject(geoInflow.get(), pathname + "/geo/geoInflow", WbWriterVtkXmlASCII::getInstance());
+
+         //outflow
+         GbCuboid3DPtr geoOutflow(new GbCuboid3D(d_maxX1, d_minX2 - 4.0*blockLength, d_minX3 - 4.0*blockLength, d_maxX1 + 4.0*blockLength, d_maxX2 + 4.0*blockLength, d_maxX3 + 4.0*blockLength));
+         if (myid == 0) GbSystem3D::writeGeoObject(geoOutflow.get(), pathname + "/geo/geoOutflow", WbWriterVtkXmlASCII::getInstance());
+
+         WriteBlocksSPtr<CoProcessor> ppblocks(new WriteBlocksCoProcessor(grid, SPtr<UbScheduler>(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm));
+
+
+
+         //sphere
+         SPtr<D3Q27Interactor> sphereInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(sphere, grid, noSlipBCAdapter, Interactor3D::SOLID));
+
+         //walls
+         SPtr<D3Q27Interactor> addWallYminInt(new D3Q27Interactor(addWallYmin, grid, noSlipBCAdapter, Interactor3D::SOLID));
+         SPtr<D3Q27Interactor> addWallZminInt(new D3Q27Interactor(addWallZmin, grid, noSlipBCAdapter, Interactor3D::SOLID));
+         SPtr<D3Q27Interactor> addWallYmaxInt(new D3Q27Interactor(addWallYmax, grid, noSlipBCAdapter, Interactor3D::SOLID));
+         SPtr<D3Q27Interactor> addWallZmaxInt(new D3Q27Interactor(addWallZmax, grid, noSlipBCAdapter, Interactor3D::SOLID));
+
+         mu::Parser fct;
+         fct.SetExpr("U");
+         fct.DefineConst("U", uLB);
+
+         //inflow
+         SPtr<D3Q27Interactor> inflowInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoInflow, grid, velBCAdapter, Interactor3D::SOLID));
+
+         //D3Q27BoundaryConditionAdapterPtr denBCAdapterInflow(new D3Q27DensityBCAdapter(rhoLBinflow));
+         //denBCAdapterInflow->setSecondaryBcOption(0);
+         //SPtr<D3Q27Interactor> inflowInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoInflow, grid, denBCAdapterInflow, Interactor3D::SOLID));
+
+         //outflow
+         SPtr<D3Q27Interactor> outflowInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoOutflow, grid, denBCAdapter, Interactor3D::SOLID));
+
+         SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B));
+         InteractorsHelper intHelper(grid, metisVisitor);
+         //intHelper.addInteractor(sphereInt);
+         intHelper.addInteractor(addWallYminInt);
+         intHelper.addInteractor(addWallZminInt);
+         intHelper.addInteractor(addWallYmaxInt);
+         intHelper.addInteractor(addWallZmaxInt);
+         intHelper.addInteractor(inflowInt);
+         intHelper.addInteractor(outflowInt);
+         intHelper.selectBlocks();
+
+         //domain decomposition for threads
+         PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
+         grid->accept(pqPartVisitor);
+
+
+         //set connectors
+         InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor());
+         SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
+         grid->accept(setConnsVisitor);
+
+         //Block3DSPtr<ConnectorFactory> factory(new Block3DConnectorFactory());
+         //ConnectorBlockVisitor setConnsVisitor(comm, nuLB, iProcessor, factory);
+         //grid->accept(setConnsVisitor);
+
+         ppblocks->process(0);
+         ppblocks.reset();
+
+         unsigned long nob = grid->getNumberOfBlocks();
+         int gl = 3;
+         unsigned long nod = nob * (blocknx1 + gl) * (blocknx2 + gl) * (blocknx3 + gl);
+
+         double needMemAll = double(nod*(27 * sizeof(double) + sizeof(int) + sizeof(float) * 4));
+         double needMem = needMemAll / double(comm->getNumberOfProcesses());
+
+         if (myid == 0)
+         {
+            UBLOG(logINFO, "Number of blocks = " << nob);
+            UBLOG(logINFO, "Number of nodes  = " << nod);
+            UBLOG(logINFO, "Necessary memory  = " << needMemAll << " bytes");
+            UBLOG(logINFO, "Necessary memory per process = " << needMem << " bytes");
+            UBLOG(logINFO, "Available memory per process = " << availMem << " bytes");
+         }
+
+         SPtr<LBMKernel> kernel(new IncompressibleCumulantLBMKernel(blocknx1, blocknx2, blocknx3, IncompressibleCumulantLBMKernel::NORMAL));
+
+         SPtr<BCProcessor> bcProcessor(new BCProcessor());
+
+
+         kernel->setBCProcessor(bcProcessor);
+
+         SetKernelBlockVisitor kernelVisitor(kernel, nuLB, availMem, needMem);
+         grid->accept(kernelVisitor);
+
+         if (refineLevel > 0)
+         {
+            SetUndefinedNodesBlockVisitor undefNodesVisitor;
+            grid->accept(undefNodesVisitor);
+         }
+
+         intHelper.setBC();
+
+         grid->accept(bcVisitor);
+
+         mu::Parser fctRoh;
+         fctRoh.SetExpr("(x1max-x1)/l*dp*3.0");
+         fctRoh.DefineConst("dp", dp_LB);
+         fctRoh.DefineConst("x1max", d_maxX1);
+         fctRoh.DefineConst("l", d_maxX1 - d_minX1);
+
+         //initialization of distributions
+         InitDistributionsBlockVisitor initVisitor(nuLB, rhoLB);
+         initVisitor.setVx1(fct);
+         //initVisitor.setRho(fctRoh);
+         grid->accept(initVisitor);
+
+         //Postrozess
+         SPtr<UbScheduler> geoSch(new UbScheduler(1));
+         WriteBoundaryConditionsSPtr<CoProcessor> ppgeo(
+            new WriteBoundaryConditionsCoProcessor(grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, comm));
+         ppgeo->process(0);
+         ppgeo.reset();;
+
+         if (myid == 0) UBLOG(logINFO, "Preprozess - end");
+      }
+      else
+      {
+         UBLOG(logINFO, "SetConnectors - start, id=" << myid);
+
+         //set connectors
+         InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor());
+         //D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
+         SPtr<ConnectorFactory> cFactory(new Block3DConnectorFactory());
+         ConnectorBlockVisitor setConnsVisitor(comm, nuLB, iProcessor, cFactory);
+         grid->accept(setConnsVisitor);
+
+         UBLOG(logINFO, "SetConnectors - end, id=" << myid);
+      }
+
+      SPtr<UbScheduler> stepSch(new UbScheduler(outstep));
+      //stepSch->addSchedule(10000, 0, 1000000);
+      WriteMacroscopicQuantitiesCoProcessor pp(grid, stepSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv,comm);
+
+      SPtr<UbScheduler> nupsSch(new UbScheduler(10, 30, 100));
+      NUPSCounterCoProcessor npr(grid, nupsSch, numOfThreads, comm);
+
+      const SPtr<ConcreteCalculatorFactory> calculatorFactory = std::make_shared<ConcreteCalculatorFactory>(stepSch);
+      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endstep, calculatorFactory, CalculatorType::HYBRID));
+
+      if (myid == 0)
+         UBLOG(logINFO, "Simulation-start");
+
+      calculation->calculate();
+
+      if (myid == 0)
+         UBLOG(logINFO, "Simulation-end");
+
+   }
+   catch (std::exception& e)
+   {
+      cerr << e.what() << endl << flush;
+   }
+   catch (std::string& s)
+   {
+      cerr << s << endl;
+   }
+   catch (...)
+   {
+      cerr << "unknown exception" << endl;
+   }
+
+}
+
+//////////////////////////////////////////////////////////////////////////
+int main(int argc, char* argv[])
+{
+   if (argv != NULL)
+   {
+      if (argv[1] != NULL)
+      {
+         run(string(argv[1]));
+      }
+      else
+      {
+         cout << "Configuration file is missing!" << endl;
+      }
+   }
+}
+
diff --git a/apps/cpu/stick/stick.cpp b/apps/cpu/stick/stick.cpp
index 108b9aa91940d9f4de8ce7500a961d3a3e3fb57f..058b767fcae53286428dad0858b42158b1113ae0 100644
--- a/apps/cpu/stick/stick.cpp
+++ b/apps/cpu/stick/stick.cpp
@@ -1,232 +1,232 @@
-#include <iostream>
-#include <string>
-
-#include <boost/pointer_cast.hpp>
-
-#include "vfluids.h"
-
-using namespace std;
-
-
-
-void main()
-{
-
-   try
-   {
-      string machine = QUOTEME(CAB_MACHINE);
-      string pathname = "d:/temp/stick"; 
-      int numOfThreads = 4;
-      double availMem = 10e9;
-
-      CommunicatorPtr comm = MPICommunicator::getInstance();
-      int myid = comm->getProcessID();
-
-      double dx = 1;
-
-      const int blocknx1 = 10;
-      const int blocknx2 = 10;
-      const int blocknx3 = 10;
-
-      const int gridNx1 = 60;
-      const int gridNx2 = 1;
-      const int gridNx3 = 8;
-
-      double L1 = gridNx1*blocknx1;
-      double L2, L3;
-      L2 = gridNx2*blocknx1;
-      L3 = gridNx3*blocknx1;
-
-      LBMReal radius = 1.0*dx;
-      LBMReal uLB = 0.07;
-      LBMReal Re = 1000.0;
-      LBMReal rhoLB = 0.0;
-      LBMReal nueLB = (uLB*1.0*radius)/Re;
-
-      LBMUnitConverterPtr conv = LBMUnitConverterPtr(new LBMUnitConverter());
-
-      Grid3DPtr grid(new Grid3D(comm));
-      grid->setDeltaX(dx);
-      grid->setBlockNX(blocknx1, blocknx2, blocknx3);
-      grid->setPeriodicX1(false);
-      grid->setPeriodicX2(true);
-      grid->setPeriodicX3(false);
-
-      const int baseLevel = 0;
-      const int refineLevel = 0;
-
-      //bounding box
-      double d_minX1 = 0.0;
-      double d_minX2 = 0.0;
-      double d_minX3 = 0.0;
-
-      double d_maxX1 = L1;
-      double d_maxX2 = L2;
-      double d_maxX3 = L3;
-
-      double blockLength = blocknx1*dx;
-
-      if(myid ==0)
-      {
-         UBLOG(logINFO,"Parameters:");
-         UBLOG(logINFO,"uLB = " << uLB );
-         UBLOG(logINFO,"rhoLB = " << rhoLB );
-         UBLOG(logINFO,"nueLB = " << nueLB );
-         UBLOG(logINFO,"Re = " << Re );
-         UBLOG(logINFO,"dx = " << dx );
-         UBLOG(logINFO,"number of levels = " << refineLevel+1 );
-         UBLOG(logINFO,"numOfThreads = " << numOfThreads );
-         UBLOG(logINFO,"Preprozess - start");
-      }
-
-      GbObject3DPtr gridCube(new GbCuboid3D(d_minX1, d_minX2, d_minX3, d_maxX1, d_maxX2, d_maxX3));
-      if(myid ==0) GbSystem3D::writeGeoObject(gridCube.get(),pathname + "/geo/gridCube", WbWriterVtkXmlBinary::getInstance()); 
-
-      GenBlocksGridVisitor genBlocks(gridCube);
-      grid->accept(genBlocks);
-
-      //cylinder
-      //GbObject3DPtr cylinder(new GbCylinder3D(L1/4.0, -2.0, radius, L1/4.0, L2+2.0, radius, radius));
-      //GbSystem3D::writeGeoObject(cylinder.get(),pathname + "/geo/cylinder", WbWriterVtkXmlBinary::getInstance());
-
-      GbCuboid3DPtr stick (new GbCuboid3D(L1/4.0, -2.0, 0.0, L1/4.0+150.0, L2+2.0, radius*3.0));
-      if(myid == 0) GbSystem3D::writeGeoObject(stick.get(), pathname+"/geo/stick", WbWriterVtkXmlASCII::getInstance());
-
-      //walls
-      GbCuboid3DPtr addWallZmin (new GbCuboid3D(d_minX1-4.0*blockLength, d_minX2-4.0*blockLength, d_minX3-4.0*blockLength, d_maxX1+4.0*blockLength, d_maxX2+4.0*blockLength, d_minX3));
-      if(myid == 0) GbSystem3D::writeGeoObject(addWallZmin.get(), pathname+"/geo/addWallZmin", WbWriterVtkXmlASCII::getInstance());
-
-      GbCuboid3DPtr addWallZmax (new GbCuboid3D(d_minX1-4.0*blockLength, d_minX2-4.0*blockLength, d_maxX3, d_maxX1+4.0*blockLength, d_maxX2+4.0*blockLength, d_maxX3+4.0*blockLength));
-      if(myid == 0) GbSystem3D::writeGeoObject(addWallZmax.get(), pathname+"/geo/addWallZmax", WbWriterVtkXmlASCII::getInstance());
-
-      //inflow
-      GbCuboid3DPtr geoInflow (new GbCuboid3D(d_minX1-4.0*blockLength, d_minX2-4.0*blockLength, d_minX3-4.0*blockLength, d_minX1, d_maxX2+4.0*blockLength, d_maxX3+4.0*blockLength));
-      if(myid == 0) GbSystem3D::writeGeoObject(geoInflow.get(), pathname+"/geo/geoInflow", WbWriterVtkXmlASCII::getInstance());
-
-      //outflow
-      GbCuboid3DPtr geoOutflow (new GbCuboid3D(d_maxX1, d_minX2-4.0*blockLength, d_minX3-4.0*blockLength, d_maxX1+4.0*blockLength, d_maxX2+4.0*blockLength, d_maxX3+4.0*blockLength));
-      if(myid == 0) GbSystem3D::writeGeoObject(geoOutflow.get(), pathname+"/geo/geoOutflow", WbWriterVtkXmlASCII::getInstance());
-
-      BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname + "/grid/blocks", WbWriterVtkXmlBinary::getInstance(), comm));
-
-
-      //cylinder
-      int bbOption = 1; //0=simple Bounce Back, 1=quadr. BB
-      D3Q27BoundaryConditionAdapterPtr noSlip(new D3Q27NoSlipBCAdapter(bbOption));
-      D3Q27InteractorPtr cylinderInt = D3Q27InteractorPtr ( new D3Q27Interactor(stick, grid, noSlip,Interactor3D::SOLID));
-
-      //walls
-      D3Q27InteractorPtr addWallZminInt(new D3Q27Interactor(addWallZmin, grid, noSlip,Interactor3D::SOLID));
-      D3Q27InteractorPtr addWallZmaxInt(new D3Q27Interactor(addWallZmax, grid, noSlip,Interactor3D::SOLID));
-
-      mu::Parser fct;
-      fct.SetExpr("U");
-      fct.DefineConst("U", uLB);
-
-      //inflow
-      D3Q27BoundaryConditionAdapterPtr velBCAdapter(new D3Q27VelocityBCAdapter (true, false ,false ,fct, 0, D3Q27BCFunction::INFCONST));
-      velBCAdapter->setSecondaryBcOption(2);
-      D3Q27InteractorPtr inflowInt  = D3Q27InteractorPtr( new D3Q27Interactor(geoInflow, grid, velBCAdapter, Interactor3D::SOLID));
-
-      //outflow
-      D3Q27BoundaryConditionAdapterPtr denBCAdapter(new D3Q27DensityBCAdapter(rhoLB));
-      D3Q27InteractorPtr outflowInt = D3Q27InteractorPtr( new D3Q27Interactor(geoOutflow, grid, denBCAdapter,Interactor3D::SOLID));
-
-      Grid3DVisitorPtr metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B));
-      InteractorsHelper intHelper(grid, metisVisitor);
-      intHelper.addInteractor(cylinderInt);
-      intHelper.addInteractor(addWallZminInt);
-      intHelper.addInteractor(addWallZmaxInt);
-      intHelper.addInteractor(inflowInt);
-      intHelper.addInteractor(outflowInt);
-      intHelper.selectBlocks();
-
-      //domain decomposition for threads
-      PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
-      grid->accept(pqPartVisitor);
-
-      ppblocks->update(0);
-      ppblocks.reset();
-
-      //set connectors
-      D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
-      D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
-      grid->accept( setConnsVisitor );
-
-      unsigned long nob = grid->getNumberOfBlocks();
-      int gl = 3;
-      unsigned long nod = nob * (blocknx1+gl) * (blocknx2+gl) * (blocknx3+gl);
-
-      double needMemAll  = double(nod*(27*sizeof(double) + sizeof(int) + sizeof(float)*4));
-      double needMem  = needMemAll / double(comm->getNumberOfProcesses());
-
-      if(myid == 0)
-      {
-         UBLOG(logINFO,"Number of blocks = " << nob);
-         UBLOG(logINFO,"Number of nodes  = " << nod);
-         UBLOG(logINFO,"Necessary memory  = " << needMemAll  << " bytes");
-         UBLOG(logINFO,"Necessary memory per process = " << needMem  << " bytes");
-         UBLOG(logINFO,"Available memory per process = " << availMem << " bytes");
-      }            
-
-      LBMKernel3DPtr kernel(new LBMKernelETD3Q27CCLB(blocknx1, blocknx2, blocknx3, LBMKernelETD3Q27CCLB::NORMAL));
-
-      BCProcessorPtr bcProc(new D3Q27ETBCProcessor());
-      kernel->setBCProcessor(bcProc);
-
-      SetKernelBlockVisitor kernelVisitor(kernel, nueLB, availMem, needMem);
-      grid->accept(kernelVisitor);
-
-      intHelper.setBC();
-
-      //initialization of distributions
-      D3Q27ETInitDistributionsBlockVisitor initVisitor(nueLB, rhoLB);
-      initVisitor.setVx1(fct);
-      grid->accept(initVisitor);
-
-      //Postrozess
-      UbSchedulerPtr geoSch(new UbScheduler(1));
-      D3Q27MacroscopicQuantitiesPostprocessorPtr ppgeo(
-         new D3Q27MacroscopicQuantitiesPostprocessor(grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, true));
-      ppgeo->update(0);
-      ppgeo.reset();
-
-      if(myid == 0) UBLOG(logINFO,"Preprozess - end"); 
-
-      UbSchedulerPtr stepSch(new UbScheduler(10000));
-      //stepSch->addSchedule(1000, 0, 1000000);
-      D3Q27MacroscopicQuantitiesPostprocessor pp(grid, stepSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv);
-
-      //InSituVTKPostprocessor isp(grid, stepSch, "d:/Data/insituDemo/metafile.csv", conv);
-
-      UbSchedulerPtr nupsSch(new UbScheduler(10, 30, 100));
-      NUPSCounterPostprocessor npr(grid, nupsSch, pathname + "/results/nups.txt", comm);
-
-
-      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, 1000000, stepSch));
-
-      if(myid == 0) 
-         UBLOG(logINFO,"Simulation-start");
-
-      calculation->calculate();
-
-      if(myid == 0) 
-         UBLOG(logINFO,"Simulation-end");
-
-   }
-   catch(std::exception& e)
-   {
-      cerr << e.what() << endl << flush;
-   }
-   catch(std::string& s)
-   {
-      cerr << s << endl;
-   }
-   catch(...)
-   {
-      cerr << "unknown exception" << endl;
-   }
-
-}
-
-
+#include <iostream>
+#include <string>
+
+#include <boost/pointer_cast.hpp>
+
+#include "vfluids.h"
+
+using namespace std;
+
+
+
+void main()
+{
+
+   try
+   {
+      string machine = QUOTEME(CAB_MACHINE);
+      string pathname = "d:/temp/stick"; 
+      int numOfThreads = 4;
+      double availMem = 10e9;
+
+      CommunicatorPtr comm = MPICommunicator::getInstance();
+      int myid = comm->getProcessID();
+
+      double dx = 1;
+
+      const int blocknx1 = 10;
+      const int blocknx2 = 10;
+      const int blocknx3 = 10;
+
+      const int gridNx1 = 60;
+      const int gridNx2 = 1;
+      const int gridNx3 = 8;
+
+      double L1 = gridNx1*blocknx1;
+      double L2, L3;
+      L2 = gridNx2*blocknx1;
+      L3 = gridNx3*blocknx1;
+
+      LBMReal radius = 1.0*dx;
+      LBMReal uLB = 0.07;
+      LBMReal Re = 1000.0;
+      LBMReal rhoLB = 0.0;
+      LBMReal nueLB = (uLB*1.0*radius)/Re;
+
+      LBMUnitConverterPtr conv = LBMUnitConverterPtr(new LBMUnitConverter());
+
+      Grid3DPtr grid(new Grid3D(comm));
+      grid->setDeltaX(dx);
+      grid->setBlockNX(blocknx1, blocknx2, blocknx3);
+      grid->setPeriodicX1(false);
+      grid->setPeriodicX2(true);
+      grid->setPeriodicX3(false);
+
+      const int baseLevel = 0;
+      const int refineLevel = 0;
+
+      //bounding box
+      double d_minX1 = 0.0;
+      double d_minX2 = 0.0;
+      double d_minX3 = 0.0;
+
+      double d_maxX1 = L1;
+      double d_maxX2 = L2;
+      double d_maxX3 = L3;
+
+      double blockLength = blocknx1*dx;
+
+      if(myid ==0)
+      {
+         UBLOG(logINFO,"Parameters:");
+         UBLOG(logINFO,"uLB = " << uLB );
+         UBLOG(logINFO,"rhoLB = " << rhoLB );
+         UBLOG(logINFO,"nueLB = " << nueLB );
+         UBLOG(logINFO,"Re = " << Re );
+         UBLOG(logINFO,"dx = " << dx );
+         UBLOG(logINFO,"number of levels = " << refineLevel+1 );
+         UBLOG(logINFO,"numOfThreads = " << numOfThreads );
+         UBLOG(logINFO,"Preprozess - start");
+      }
+
+      GbObject3DPtr gridCube(new GbCuboid3D(d_minX1, d_minX2, d_minX3, d_maxX1, d_maxX2, d_maxX3));
+      if(myid ==0) GbSystem3D::writeGeoObject(gridCube.get(),pathname + "/geo/gridCube", WbWriterVtkXmlBinary::getInstance()); 
+
+      GenBlocksGridVisitor genBlocks(gridCube);
+      grid->accept(genBlocks);
+
+      //cylinder
+      //GbObject3DPtr cylinder(new GbCylinder3D(L1/4.0, -2.0, radius, L1/4.0, L2+2.0, radius, radius));
+      //GbSystem3D::writeGeoObject(cylinder.get(),pathname + "/geo/cylinder", WbWriterVtkXmlBinary::getInstance());
+
+      GbCuboid3DPtr stick (new GbCuboid3D(L1/4.0, -2.0, 0.0, L1/4.0+150.0, L2+2.0, radius*3.0));
+      if(myid == 0) GbSystem3D::writeGeoObject(stick.get(), pathname+"/geo/stick", WbWriterVtkXmlASCII::getInstance());
+
+      //walls
+      GbCuboid3DPtr addWallZmin (new GbCuboid3D(d_minX1-4.0*blockLength, d_minX2-4.0*blockLength, d_minX3-4.0*blockLength, d_maxX1+4.0*blockLength, d_maxX2+4.0*blockLength, d_minX3));
+      if(myid == 0) GbSystem3D::writeGeoObject(addWallZmin.get(), pathname+"/geo/addWallZmin", WbWriterVtkXmlASCII::getInstance());
+
+      GbCuboid3DPtr addWallZmax (new GbCuboid3D(d_minX1-4.0*blockLength, d_minX2-4.0*blockLength, d_maxX3, d_maxX1+4.0*blockLength, d_maxX2+4.0*blockLength, d_maxX3+4.0*blockLength));
+      if(myid == 0) GbSystem3D::writeGeoObject(addWallZmax.get(), pathname+"/geo/addWallZmax", WbWriterVtkXmlASCII::getInstance());
+
+      //inflow
+      GbCuboid3DPtr geoInflow (new GbCuboid3D(d_minX1-4.0*blockLength, d_minX2-4.0*blockLength, d_minX3-4.0*blockLength, d_minX1, d_maxX2+4.0*blockLength, d_maxX3+4.0*blockLength));
+      if(myid == 0) GbSystem3D::writeGeoObject(geoInflow.get(), pathname+"/geo/geoInflow", WbWriterVtkXmlASCII::getInstance());
+
+      //outflow
+      GbCuboid3DPtr geoOutflow (new GbCuboid3D(d_maxX1, d_minX2-4.0*blockLength, d_minX3-4.0*blockLength, d_maxX1+4.0*blockLength, d_maxX2+4.0*blockLength, d_maxX3+4.0*blockLength));
+      if(myid == 0) GbSystem3D::writeGeoObject(geoOutflow.get(), pathname+"/geo/geoOutflow", WbWriterVtkXmlASCII::getInstance());
+
+      BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname + "/grid/blocks", WbWriterVtkXmlBinary::getInstance(), comm));
+
+
+      //cylinder
+      int bbOption = 1; //0=simple Bounce Back, 1=quadr. BB
+      D3Q27BoundaryConditionAdapterPtr noSlip(new D3Q27NoSlipBCAdapter(bbOption));
+      D3Q27InteractorPtr cylinderInt = D3Q27InteractorPtr ( new D3Q27Interactor(stick, grid, noSlip,Interactor3D::SOLID));
+
+      //walls
+      D3Q27InteractorPtr addWallZminInt(new D3Q27Interactor(addWallZmin, grid, noSlip,Interactor3D::SOLID));
+      D3Q27InteractorPtr addWallZmaxInt(new D3Q27Interactor(addWallZmax, grid, noSlip,Interactor3D::SOLID));
+
+      mu::Parser fct;
+      fct.SetExpr("U");
+      fct.DefineConst("U", uLB);
+
+      //inflow
+      D3Q27BoundaryConditionAdapterPtr velBCAdapter(new D3Q27VelocityBCAdapter (true, false ,false ,fct, 0, D3Q27BCFunction::INFCONST));
+      velBCAdapter->setSecondaryBcOption(2);
+      D3Q27InteractorPtr inflowInt  = D3Q27InteractorPtr( new D3Q27Interactor(geoInflow, grid, velBCAdapter, Interactor3D::SOLID));
+
+      //outflow
+      D3Q27BoundaryConditionAdapterPtr denBCAdapter(new D3Q27DensityBCAdapter(rhoLB));
+      D3Q27InteractorPtr outflowInt = D3Q27InteractorPtr( new D3Q27Interactor(geoOutflow, grid, denBCAdapter,Interactor3D::SOLID));
+
+      Grid3DVisitorPtr metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B));
+      InteractorsHelper intHelper(grid, metisVisitor);
+      intHelper.addInteractor(cylinderInt);
+      intHelper.addInteractor(addWallZminInt);
+      intHelper.addInteractor(addWallZmaxInt);
+      intHelper.addInteractor(inflowInt);
+      intHelper.addInteractor(outflowInt);
+      intHelper.selectBlocks();
+
+      //domain decomposition for threads
+      PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
+      grid->accept(pqPartVisitor);
+
+      ppblocks->update(0);
+      ppblocks.reset();
+
+      //set connectors
+      D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
+      D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor);
+      grid->accept( setConnsVisitor );
+
+      unsigned long nob = grid->getNumberOfBlocks();
+      int gl = 3;
+      unsigned long nod = nob * (blocknx1+gl) * (blocknx2+gl) * (blocknx3+gl);
+
+      double needMemAll  = double(nod*(27*sizeof(double) + sizeof(int) + sizeof(float)*4));
+      double needMem  = needMemAll / double(comm->getNumberOfProcesses());
+
+      if(myid == 0)
+      {
+         UBLOG(logINFO,"Number of blocks = " << nob);
+         UBLOG(logINFO,"Number of nodes  = " << nod);
+         UBLOG(logINFO,"Necessary memory  = " << needMemAll  << " bytes");
+         UBLOG(logINFO,"Necessary memory per process = " << needMem  << " bytes");
+         UBLOG(logINFO,"Available memory per process = " << availMem << " bytes");
+      }            
+
+      LBMKernel3DPtr kernel(new LBMKernelETD3Q27CCLB(blocknx1, blocknx2, blocknx3, LBMKernelETD3Q27CCLB::NORMAL));
+
+      BCProcessorPtr bcProc(new D3Q27ETBCProcessor());
+      kernel->setBCProcessor(bcProc);
+
+      SetKernelBlockVisitor kernelVisitor(kernel, nueLB, availMem, needMem);
+      grid->accept(kernelVisitor);
+
+      intHelper.setBC();
+
+      //initialization of distributions
+      D3Q27ETInitDistributionsBlockVisitor initVisitor(nueLB, rhoLB);
+      initVisitor.setVx1(fct);
+      grid->accept(initVisitor);
+
+      //Postrozess
+      UbSchedulerPtr geoSch(new UbScheduler(1));
+      D3Q27MacroscopicQuantitiesPostprocessorPtr ppgeo(
+         new D3Q27MacroscopicQuantitiesPostprocessor(grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, true));
+      ppgeo->update(0);
+      ppgeo.reset();
+
+      if(myid == 0) UBLOG(logINFO,"Preprozess - end"); 
+
+      UbSchedulerPtr stepSch(new UbScheduler(10000));
+      //stepSch->addSchedule(1000, 0, 1000000);
+      D3Q27MacroscopicQuantitiesPostprocessor pp(grid, stepSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv);
+
+      //InSituVTKPostprocessor isp(grid, stepSch, "d:/Data/insituDemo/metafile.csv", conv);
+
+      UbSchedulerPtr nupsSch(new UbScheduler(10, 30, 100));
+      NUPSCounterPostprocessor npr(grid, nupsSch, pathname + "/results/nups.txt", comm);
+
+
+      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, 1000000, stepSch));
+
+      if(myid == 0) 
+         UBLOG(logINFO,"Simulation-start");
+
+      calculation->calculate();
+
+      if(myid == 0) 
+         UBLOG(logINFO,"Simulation-end");
+
+   }
+   catch(std::exception& e)
+   {
+      cerr << e.what() << endl << flush;
+   }
+   catch(std::string& s)
+   {
+      cerr << s << endl;
+   }
+   catch(...)
+   {
+      cerr << "unknown exception" << endl;
+   }
+
+}
+
+
diff --git a/apps/cpu/town/CMakeLists.txt b/apps/cpu/town/CMakeLists.txt
index 8cb7da8a658ce538b6f7edc8d83183d0912b811b..af95da2b793379871b33d6f7aefcb9fd2c08663c 100644
--- a/apps/cpu/town/CMakeLists.txt
+++ b/apps/cpu/town/CMakeLists.txt
@@ -1,25 +1,25 @@
-CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
-
-########################################################
-## C++ PROJECT                                       ###
-########################################################
-PROJECT(town)
-
-INCLUDE(${SOURCE_ROOT}/lib/IncludsList.txt) 
-
-#################################################################
-###   LOCAL FILES                                             ###
-#################################################################
-FILE(GLOB SPECIFIC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.h
-                         ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
-                         ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp  )
- 
-SET(ALL_SOURCES ${ALL_SOURCES} ${SPECIFIC_FILES})
-SOURCE_GROUP(src FILES ${SPECIFIC_FILES})
-  
-SET(CAB_ADDITIONAL_LINK_LIBRARIES vfluids)
-
-#################################################################
-###   CREATE PROJECT                                          ###
-#################################################################
-CREATE_CAB_PROJECT(town BINARY)
+CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
+
+########################################################
+## C++ PROJECT                                       ###
+########################################################
+PROJECT(town)
+
+INCLUDE(${SOURCE_ROOT}/lib/IncludsList.txt) 
+
+#################################################################
+###   LOCAL FILES                                             ###
+#################################################################
+FILE(GLOB SPECIFIC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.h
+                         ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
+                         ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp  )
+ 
+SET(ALL_SOURCES ${ALL_SOURCES} ${SPECIFIC_FILES})
+SOURCE_GROUP(src FILES ${SPECIFIC_FILES})
+  
+SET(CAB_ADDITIONAL_LINK_LIBRARIES vfluids)
+
+#################################################################
+###   CREATE PROJECT                                          ###
+#################################################################
+CREATE_CAB_PROJECT(town BINARY)
diff --git a/apps/cpu/town/town.cpp b/apps/cpu/town/town.cpp
index 0aa0f289ccb6a229ab29d7b76fb5ba15b8656062..8f9b97857625939606874b1d539a01e8b54bb52e 100644
--- a/apps/cpu/town/town.cpp
+++ b/apps/cpu/town/town.cpp
@@ -1,464 +1,464 @@
-#include <iostream>
-#include <string>
-#include <math.h> 
-
-#include <vfluids.h>
-
-using namespace std;
-
-void run(const char *cstr1, const char *cstr2)
-{
-   try
-   {
-      string pathname; 
-      string pathGeo;
-      string pathLog;
-      int numOfThreads = 1;
-      bool logfile = false;
-      stringstream logFilename;
-      double availMem = 0;
-
-      CommunicatorPtr comm = MPICommunicator::getInstance();
-      int myid = comm->getProcessID();
-
-      string machine = string(cstr1);
-
-      if(machine == "my") 
-      {
-         //Sleep(30000);
-         pathname = "d:/temp/town";
-         pathGeo = "d:/Data/town";
-         pathLog = "d:/temp/town";
-         numOfThreads = 1;
-         logfile = false;
-         availMem = 15.0e9;
-      }
-      else if(machine == "Ludwig")      
-      {
-         pathname = "/work/koskuche/town";
-         pathGeo = "/home/koskuche/data/town";
-         pathLog = pathname;
-         numOfThreads = 8;
-         availMem = 12.0e9;///8*numOfThreads;
-         logfile = true;
-      }
-      else if(machine == "HLRS")      
-      {
-         pathname = "/univ_1/ws1/ws/xrmkuchr-plate3-0";
-         pathGeo = "/zhome/academic/HLRS/xrm/xrmkuchr/data/plate";
-         pathLog = "/zhome/academic/HLRS/xrm/xrmkuchr/work/plate";
-         numOfThreads = 16;
-         availMem = 2.0e9;
-         logfile = true;
-      }
-      else if(machine == "HLRN")      
-      {
-         pathname = "/gfs1/work/niivfcpu/scratch/plateEx";
-         pathGeo = "/gfs1/work/niivfcpu/data/plate";
-         pathLog = pathname;
-         numOfThreads = 24;
-         availMem = 64.0e9/24.0*numOfThreads;
-         logfile = true;
-      }
-      else throw UbException(UB_EXARGS, "unknown CAB_MACHINE");
-
-#if defined(__unix__)
-      if (myid==0) 
-      {
-         const char* str = pathLog.c_str();
-         int status=mkdir(str, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
-      }
-#endif 
-
-      if(myid == 0 && logfile)
-      {
-         //UbLog::reportingLevel() = logDEBUG5;
-         logFilename <<  pathLog + "/logfile"+UbSystem::toString(UbSystem::getTimeStamp())+"_"+UbSystem::toString(myid)+".txt";
-         UbLog::output_policy::setStream(logFilename.str());
-      }
-
-      if(myid==0) UBLOG(logINFO,"Testcase town");
-
-      //string townFilename = pathGeo + "/Manhattan.stl";
-      string townFilename = pathGeo + "/town.stl"; 
-
-
-      ///////////////Knotenabmessungen:
-      int blocknx[3], nx[3];
-      blocknx[0] = 8;
-      blocknx[1] = 8;
-      blocknx[2] = 8;
-
-      nx[0] = 12;
-      nx[1] = 12;
-      nx[2] = 3;
-
-      int baseLevel   = 0;
-      int refineLevel = 2;
-
-      LBMUnitConverterPtr unitConverter = LBMUnitConverterPtr(new LBMUnitConverter());
-
-      //////////////////////////////////////////////////////////////////////////
-      //physik
-      //////////////////////////////////////////////////////////////////////////
-      LBMReal uLB = 0.05;
-      LBMReal rhoLB = 0.0;
-      LBMReal nuLB = 1e-5;
-
-      Grid3DPtr grid(new Grid3D(comm));
-
-      //////////////////////////////////////////////////////////////////////////
-      //restart
-      UbSchedulerPtr rSch(new UbScheduler(1000,1000,10000000));
-      RestartPostprocessor rp(grid, rSch, comm, pathname, RestartPostprocessor::BINARY);
-      //////////////////////////////////////////////////////////////////////////
-
-      if (grid->getTimeStep() == 0)
-      {
-
-         if(myid==0) UBLOG(logINFO,"Neustart..");
-
-         //////////////////////////////////////////////////////////////////////////
-         //town
-         GbTriFaceMesh3DPtr town(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(townFilename, "Netz"));
-         if(myid == 0) GbSystem3D::writeGeoObject( town.get(), pathname+"/geo/town", WbWriterVtkXmlBinary::getInstance() );
-         //////////////////////////////////////////////////////////////////////////
-
-         //double cdx = 0.8;
-         double cdx = town->getX3Maximum() / (double)(nx[2] * blocknx[2]);
-         double fdx = cdx/double(1<<refineLevel);
- 
-         double blockLengthx = blocknx[0]*cdx; //geowerte
-
-         double geoLength[] = { nx[0] * blockLengthx, nx[1] * blockLengthx, nx[2] * blockLengthx };
-
-         double originX1 = town->getX1Minimum();
-         double originX2 = town->getX2Minimum();
-         double originX3 = town->getX3Minimum();
-
-
-         bool periodicx1 = true;
-         bool periodicx2 = true;
-         bool periodicx3 = false;
-
-         //bounding box
-         double g_minX1 = originX1-3.0*blockLengthx;
-         double g_minX2 = originX2-3.0*blockLengthx;
-         double g_minX3 = originX3;
-
-         double g_maxX1 = originX1 + geoLength[0]+3.0*blockLengthx;
-         double g_maxX2 = originX2 + geoLength[1]+1.0*blockLengthx;
-         double g_maxX3 = originX3 + geoLength[2]+2.0*blockLengthx;
-
-         //double g_maxX1 = town->getX1Maximum()+blockLengthx;
-         //double g_maxX2 = town->getX2Maximum()+2.0*blockLengthx;
-         //double g_maxX3 = town->getX3Maximum()+2.0*blockLengthx;
-
-
-         //set grid
-         grid->setDeltaX(cdx);
-         grid->setBlockNX(blocknx[0], blocknx[1], blocknx[2]);
-         grid->setPeriodicX1(periodicx1);
-         grid->setPeriodicX2(periodicx2);
-         grid->setPeriodicX3(periodicx3);
-
-         GbObject3DPtr gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
-         if(myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), pathname+"/geo/gridCube", WbWriterVtkXmlASCII::getInstance());
-
-         GenBlocksGridVisitor genBlocks(gridCube);
-         grid->accept(genBlocks);
-
-
-         //////////////////////////////////////////////////////////////////////////
-         if(myid == 0)
-         {
-            UBLOG(logINFO, "*****************************************");
-            UBLOG(logINFO, "* Parameters                            *");
-            //UBLOG(logINFO, "* Re            ="<<Re);
-            UBLOG(logINFO, "* nuLB          ="<<nuLB);
-            UBLOG(logINFO, "* uLB           ="<<uLB);
-            UBLOG(logINFO, "* cdx           ="<<cdx);
-            UBLOG(logINFO, "* fdx           ="<<fdx);
-            UBLOG(logINFO, "* blocknx1/2/3  ="<<blocknx[0]<<"/"<<blocknx[1]<<"/"<<blocknx[2]);
-            UBLOG(logINFO, "* x1Periodic    ="<<periodicx1);
-            UBLOG(logINFO, "* x2Periodic    ="<<periodicx2);
-            UBLOG(logINFO, "* x3Periodic    ="<<periodicx3);
-            UBLOG(logINFO, "* number of levels  ="<<refineLevel+1);
-            UBLOG(logINFO, "* path          ="<<pathname);
-
-            UBLOG(logINFO, "*****************************************");
-            UBLOG(logINFO, "* number of threads    ="<<numOfThreads);
-            UBLOG(logINFO, "* number of processes  ="<<comm->getNumberOfProcesses());
-            UBLOG(logINFO, "*****************************************");
-            UBLOG(logINFO, "*****************************************");     
-         }
-         //////////////////////////////////////////////////////////////////////////
-
-
-         //////////////////////////////////////////////////////////////////////////
-         //refinement
-
-         /////////////////////////////////////////////////
-         ///interactor
-         int bbOption1 = 1; //0=simple Bounce Back, 1=quadr. BB
-         D3Q27BoundaryConditionAdapterPtr bcNoSlip(new D3Q27NoSlipBCAdapter(bbOption1));
-         D3Q27TriFaceMeshInteractorPtr triTownInteractor(new D3Q27TriFaceMeshInteractor(town, grid, bcNoSlip, Interactor3D::SOLID));
-
-         GbCuboid3DPtr addWallZmax(new GbCuboid3D(g_minX1-blockLengthx, g_minX2-blockLengthx, g_maxX3, g_maxX1+blockLengthx, g_maxX2+blockLengthx, g_maxX3+blockLengthx));
-         if (myid == 0) GbSystem3D::writeGeoObject(addWallZmax.get(), pathname+"/geo/addWallZmax", WbWriterVtkXmlASCII::getInstance());
-         D3Q27InteractorPtr velBCInteractor(new D3Q27Interactor(addWallZmax, grid, Interactor3D::SOLID));
-
-         double raiseVelSteps = 0;
-         vector<D3Q27BCFunction> velcX2BCs, dummy;
-
-         mu::Parser inflowProfile;
-         inflowProfile.SetExpr("uLB");
-         inflowProfile.DefineConst("uLB", uLB);
-         velcX2BCs.push_back(D3Q27BCFunction(inflowProfile, raiseVelSteps, D3Q27BCFunction::INFCONST));
-
-         D3Q27BoundaryConditionAdapterPtr velBCAdapter(new D3Q27VelocityBCAdapter(dummy, velcX2BCs, dummy));
-         velBCInteractor->addBCAdapter(velBCAdapter);
-
-         GbCuboid3DPtr addWallZmin(new GbCuboid3D(g_minX1-blockLengthx, g_minX2-blockLengthx, g_minX3-blockLengthx, g_maxX1+blockLengthx, g_maxX2+blockLengthx, g_minX3));
-         if (myid == 0) GbSystem3D::writeGeoObject(addWallZmin.get(), pathname+"/geo/addWallZmin", WbWriterVtkXmlASCII::getInstance());
-         D3Q27InteractorPtr addWallZminInt(new D3Q27Interactor(addWallZmin, grid, bcNoSlip, Interactor3D::SOLID));
-
-         //GbCuboid3DPtr addWallZmax(new GbCuboid3D(g_minX1-blockLengthx, g_minX2-blockLengthx, g_maxX3, g_maxX1+blockLengthx, g_maxX2+blockLengthx, g_maxX3+blockLengthx));
-         //if (myid == 0) GbSystem3D::writeGeoObject(addWallZmax.get(), pathname+"/geo/addWallZmax", WbWriterVtkXmlASCII::getInstance());
-         //D3Q27InteractorPtr addWallZmaxInt(new D3Q27Interactor(addWallZmax, grid, bcNoSlip, Interactor3D::SOLID));
-
-         GbCuboid3DPtr addWallYmin(new GbCuboid3D(g_minX1-blockLengthx, g_minX2-blockLengthx, g_minX3-blockLengthx, g_maxX1+blockLengthx, g_minX2, g_maxX3+blockLengthx));
-         if (myid == 0) GbSystem3D::writeGeoObject(addWallYmin.get(), pathname+"/geo/addWallYmin", WbWriterVtkXmlASCII::getInstance());
-         D3Q27InteractorPtr addWallYminInt(new D3Q27Interactor(addWallYmin, grid, bcNoSlip, Interactor3D::SOLID));
-
-         GbCuboid3DPtr addWallYmax(new GbCuboid3D(g_minX1-blockLengthx, g_minX2-blockLengthx, g_maxX3, g_maxX1+blockLengthx, g_maxX2+blockLengthx, g_maxX3+blockLengthx));
-         if (myid == 0) GbSystem3D::writeGeoObject(addWallYmax.get(), pathname+"/geo/addWallYmax", WbWriterVtkXmlASCII::getInstance());
-         D3Q27InteractorPtr addWallYmaxInt(new D3Q27Interactor(addWallYmax, grid, bcNoSlip, Interactor3D::SOLID));
-
-         GbCuboid3DPtr addWallXmin(new GbCuboid3D(g_minX1-blockLengthx, g_minX2-blockLengthx, g_minX3-blockLengthx, g_minX1, g_maxX2+blockLengthx, g_maxX3+blockLengthx));
-         if (myid == 0) GbSystem3D::writeGeoObject(addWallXmin.get(), pathname+"/geo/addWallXmin", WbWriterVtkXmlASCII::getInstance());
-         D3Q27InteractorPtr addWallXminInt(new D3Q27Interactor(addWallXmin, grid, bcNoSlip, Interactor3D::SOLID));
-
-         GbCuboid3DPtr addWallXmax(new GbCuboid3D(g_maxX1, g_minX2-blockLengthx, g_minX3-blockLengthx, g_maxX1+blockLengthx, g_maxX2+blockLengthx, g_maxX3+blockLengthx));
-         if (myid == 0) GbSystem3D::writeGeoObject(addWallXmax.get(), pathname+"/geo/addWallXmax", WbWriterVtkXmlASCII::getInstance());
-         D3Q27InteractorPtr addWallXmaxInt(new D3Q27Interactor(addWallXmax, grid, bcNoSlip, Interactor3D::SOLID));
-
-         GbCuboid3DPtr refineTownBox(new GbCuboid3D(town->getX1Minimum(), town->getX2Minimum(), town->getX3Minimum(), town->getX1Maximum(), town->getX2Maximum(), town->getX3Maximum()));
-         if (myid == 0) GbSystem3D::writeGeoObject(refineTownBox.get(), pathname + "/geo/refineTownBox", WbWriterVtkXmlASCII::getInstance());
-
-         if (refineLevel > 0)
-         {
-            if(myid == 0) UBLOG(logINFO,"Refinement - start");	
-            //RefineAroundGbObjectHelper refineHelper(grid, refineLevel, boost::dynamic_pointer_cast<D3Q27TriFaceMeshInteractor>(triTownInteractor), 0.0, 3.0, comm);
-            RefineCrossAndInsideGbObjectHelper refineHelper(grid, refineLevel);
-            //refineHelper.addGbObject(refineTownBox, refineLevel);
-            refineHelper.addGbObject(town, refineLevel);
-            refineHelper.refine();
-            if(myid == 0) UBLOG(logINFO,"Refinement - end");	
-         }
-
-         //Grid3D::BlockIDMap bmap = grid->getBlockIDs();
-         //bmap.clear();
-         //(grid->getBlockIDs()).clear();
-         //grid->deleteBlockIDs();
-
-         //RenumberBlockVisitor renumber;
-         //grid->accept(renumber);
-
-
-         ////////////////////////////////////////////
-         //METIS
-         Grid3DVisitorPtr metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B));	
-
-         ////////////////////////////////////////////
-         /////delete solid blocks
-         if(myid == 0) UBLOG(logINFO,"deleteSolidBlocks - start");
-         InteractorsHelper intHelper(grid, metisVisitor);
-         //intHelper.addInteractor(triTownInteractor);
-         intHelper.addInteractor(velBCInteractor);
-         intHelper.addInteractor(addWallZminInt);
-         //intHelper.addInteractor(addWallZmaxInt);
-         //intHelper.addInteractor(addWallYminInt);
-         //intHelper.addInteractor(addWallYmaxInt);
-         //intHelper.addInteractor(addWallXminInt);
-         //intHelper.addInteractor(addWallXmaxInt);
-         intHelper.selectBlocks();
-         if(myid == 0) UBLOG(logINFO,"deleteSolidBlocks - end");	 
-         //////////////////////////////////////
-
-         //grid->accept(renumber);
-
-         //if (myid == 0)
-         {
-            UBLOG(logINFO, "Write blocks - start");
-            BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm));
-            ppblocks->update(0);
-            UBLOG(logINFO, "Write blocks - end");
-         }
-
-         
-
-
-         //domain decomposition for threads
-         if(numOfThreads > 1)
-         {
-            PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
-            grid->accept(pqPartVisitor);
-         }
-
-
-         unsigned long nob = grid->getNumberOfBlocks();
-         unsigned long nod = nob * blocknx[0]*blocknx[1]*blocknx[2];
-         unsigned long nod_real = nob * (blocknx[0]+3)*(blocknx[1]+3)*(blocknx[2]+3);
-         unsigned long nodb = (blocknx[0]) * (blocknx[1]) * (blocknx[2]);
-
-         double needMemAll  = double(nod_real*(27*sizeof(double) + sizeof(int)));
-         double needMem  = needMemAll / double(comm->getNumberOfProcesses());
-         
-         double nup = 0; 
-
-         if(myid == 0)
-         {
-            UBLOG(logINFO,"Number of blocks = " << nob);
-            UBLOG(logINFO,"Number of nodes  = " << nod);
-            int minInitLevel = grid->getCoarsestInitializedLevel();
-            int maxInitLevel = grid->getFinestInitializedLevel();
-            for(int level = minInitLevel; level<=maxInitLevel; level++)
-            {
-               int nobl = grid->getNumberOfBlocks(level);
-               UBLOG(logINFO,"Number of blocks for level " << level <<" = " << nobl);
-               UBLOG(logINFO,"Number of nodes for level " << level <<" = " << nobl*nodb);
-               nup += nobl*nodb*double(1<<level); 
-            }
-            UBLOG(logINFO,"Hypothetically time for calculation step for 120 nodes  = " << nup/6.0e5/(120*8)  << " s");
-            UBLOG(logINFO,"Necessary memory  = " << needMemAll  << " bytes");
-            UBLOG(logINFO,"Necessary memory per process = " << needMem  << " bytes");
-            UBLOG(logINFO,"Available memory per process = " << availMem << " bytes");
-            UBLOG(logINFO,"Available memory per node/8.0 = " << (availMem/8.0) << " bytes");
-         }
-         //////////////////////////////////////////
-         //set connectors
-         if(myid == 0) UBLOG(logINFO,"set connectors - start");
-         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
-         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
-         grid->accept( setConnsVisitor );
-         if(myid == 0) UBLOG(logINFO,"set connectors - end");
-
-         ////////////////////////////
-         LBMKernel3DPtr kernel;
-         kernel = LBMKernel3DPtr(new LBMKernelETD3Q27CCLB(blocknx[0], blocknx[1], blocknx[2], LBMKernelETD3Q27CCLB::NORMAL));
-
-         //mu::Parser fctForcingX2;
-         //fctForcingX2.SetExpr("Fx2*dx");
-         //fctForcingX2.DefineConst("Fx2", 5e-6);
-
-         //kernel->setForcingX2(fctForcingX2);
-         //kernel->setWithForcing(true);
-
-         BCProcessorPtr bcProc(new D3Q27ETBCProcessor());
-         //BCProcessorPtr bcProc(new D3Q27ETForThinWallBCProcessor());
-         kernel->setBCProcessor(bcProc);
-         SetKernelBlockVisitor kernelVisitor(kernel, nuLB, availMem, needMem);
-         grid->accept(kernelVisitor);
-         //////////////////////////////////
-         //undef nodes
-         if (refineLevel > 0)
-         {
-            D3Q27SetUndefinedNodesBlockVisitor undefNodesVisitor;
-            grid->accept(undefNodesVisitor);
-         }
-
-
-         intHelper.setBC();
-
-         //initialization of decompositions
-         D3Q27ETInitDistributionsBlockVisitor initVisitor( nuLB,rhoLB);
-         initVisitor.setVx2(uLB);
-         grid->accept(initVisitor);
-
-         //Postprozess
-         UbSchedulerPtr geoSch(new UbScheduler(1));
-         D3Q27MacroscopicQuantitiesPostprocessorPtr ppgeo(
-            new D3Q27MacroscopicQuantitiesPostprocessor(grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), 
-            unitConverter, true));
-         ppgeo->update(0);
-         ppgeo.reset();
-         geoSch.reset();
-
-         if(myid == 0) UBLOG(logINFO,"Preprozess - end");      
-      }
-      else
-      {
-         //domain decomposition for threads
-         if(numOfThreads > 1)
-         {
-            PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
-            grid->accept(pqPartVisitor);
-         }
-         //set connectors
-         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
-         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
-         grid->accept( setConnsVisitor );
-
-         if(myid == 0) UBLOG(logINFO,"Restart - end"); 
-      }
-      UbSchedulerPtr visSch(new UbScheduler());
-      visSch->addSchedule(1,0,3);
-      //visSch->addSchedule(100,100,1000);
-      //visSch->addSchedule(1000,1000,5000);
-      //visSch->addSchedule(5000,5000,100000);
-      //visSch->addSchedule(100000,100000,10000000);
-
-      visSch->addSchedule(1000,1000,10000000);
-
-      D3Q27MacroscopicQuantitiesPostprocessor pp(grid, visSch, pathname, WbWriterVtkXmlBinary::getInstance(), unitConverter);
-
-      UbSchedulerPtr nupsSch(new UbScheduler(10, 10, 30));
-      nupsSch->addSchedule(500,500,1e6);
-      NUPSCounterPostprocessor npr(grid, nupsSch, numOfThreads, comm);
-
-      //UbSchedulerPtr emSch(new UbScheduler(100));
-      //EmergencyExitPostprocessor empr(grid, emSch, pathname, RestartPostprocessorPtr(&rp), comm);
-
-      if(myid == 0)
-      {
-         UBLOG(logINFO,"PID = " << myid << " Total Physical Memory (RAM): " << Utilities::getTotalPhysMem());
-         UBLOG(logINFO,"PID = " << myid << " Physical Memory currently used: " << Utilities::getPhysMemUsed());
-         UBLOG(logINFO,"PID = " << myid << " Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe());
-      }
-
-      string lastStep = "1000000";// string(cstr2);
-      double endTime = UbSystem::stringTo<double>(lastStep);
-      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, visSch));
-      if(myid == 0) UBLOG(logINFO,"Simulation-start");
-      calculation->calculate();
-      if(myid == 0) UBLOG(logINFO,"Simulation-end");
-   }
-   catch(std::exception& e)
-   {
-      cerr << e.what() << endl << flush;
-   }
-   catch(std::string& s)
-   {
-      cerr << s << endl;
-   }
-   catch(...)
-   {
-      cerr << "unknown exception" << endl;
-   }
-
-}
-//////////////////////////////////////////////////////////////////////////
-int main(int argc, char* argv[])
-{
-   if (argc == 1)
-   {
-      cout<<"Command line argument isn't specified!"<<endl;
-      cout<<"plate2 <machine name>"<<endl;
-      return 1;
-   }
-   run(argv[1], argv[2]);
-
-   return 0;
-}
-
+#include <iostream>
+#include <string>
+#include <math.h> 
+
+#include <vfluids.h>
+
+using namespace std;
+
+void run(const char *cstr1, const char *cstr2)
+{
+   try
+   {
+      string pathname; 
+      string pathGeo;
+      string pathLog;
+      int numOfThreads = 1;
+      bool logfile = false;
+      stringstream logFilename;
+      double availMem = 0;
+
+      CommunicatorPtr comm = MPICommunicator::getInstance();
+      int myid = comm->getProcessID();
+
+      string machine = string(cstr1);
+
+      if(machine == "my") 
+      {
+         //Sleep(30000);
+         pathname = "d:/temp/town";
+         pathGeo = "d:/Data/town";
+         pathLog = "d:/temp/town";
+         numOfThreads = 1;
+         logfile = false;
+         availMem = 15.0e9;
+      }
+      else if(machine == "Ludwig")      
+      {
+         pathname = "/work/koskuche/town";
+         pathGeo = "/home/koskuche/data/town";
+         pathLog = pathname;
+         numOfThreads = 8;
+         availMem = 12.0e9;///8*numOfThreads;
+         logfile = true;
+      }
+      else if(machine == "HLRS")      
+      {
+         pathname = "/univ_1/ws1/ws/xrmkuchr-plate3-0";
+         pathGeo = "/zhome/academic/HLRS/xrm/xrmkuchr/data/plate";
+         pathLog = "/zhome/academic/HLRS/xrm/xrmkuchr/work/plate";
+         numOfThreads = 16;
+         availMem = 2.0e9;
+         logfile = true;
+      }
+      else if(machine == "HLRN")      
+      {
+         pathname = "/gfs1/work/niivfcpu/scratch/plateEx";
+         pathGeo = "/gfs1/work/niivfcpu/data/plate";
+         pathLog = pathname;
+         numOfThreads = 24;
+         availMem = 64.0e9/24.0*numOfThreads;
+         logfile = true;
+      }
+      else throw UbException(UB_EXARGS, "unknown CAB_MACHINE");
+
+#if defined(__unix__)
+      if (myid==0) 
+      {
+         const char* str = pathLog.c_str();
+         int status=mkdir(str, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
+      }
+#endif 
+
+      if(myid == 0 && logfile)
+      {
+         //UbLog::reportingLevel() = logDEBUG5;
+         logFilename <<  pathLog + "/logfile"+UbSystem::toString(UbSystem::getTimeStamp())+"_"+UbSystem::toString(myid)+".txt";
+         UbLog::output_policy::setStream(logFilename.str());
+      }
+
+      if(myid==0) UBLOG(logINFO,"Testcase town");
+
+      //string townFilename = pathGeo + "/Manhattan.stl";
+      string townFilename = pathGeo + "/town.stl"; 
+
+
+      ///////////////Knotenabmessungen:
+      int blocknx[3], nx[3];
+      blocknx[0] = 8;
+      blocknx[1] = 8;
+      blocknx[2] = 8;
+
+      nx[0] = 12;
+      nx[1] = 12;
+      nx[2] = 3;
+
+      int baseLevel   = 0;
+      int refineLevel = 2;
+
+      LBMUnitConverterPtr unitConverter = LBMUnitConverterPtr(new LBMUnitConverter());
+
+      //////////////////////////////////////////////////////////////////////////
+      //physik
+      //////////////////////////////////////////////////////////////////////////
+      LBMReal uLB = 0.05;
+      LBMReal rhoLB = 0.0;
+      LBMReal nuLB = 1e-5;
+
+      Grid3DPtr grid(new Grid3D(comm));
+
+      //////////////////////////////////////////////////////////////////////////
+      //restart
+      UbSchedulerPtr rSch(new UbScheduler(1000,1000,10000000));
+      RestartPostprocessor rp(grid, rSch, comm, pathname, RestartPostprocessor::BINARY);
+      //////////////////////////////////////////////////////////////////////////
+
+      if (grid->getTimeStep() == 0)
+      {
+
+         if(myid==0) UBLOG(logINFO,"Neustart..");
+
+         //////////////////////////////////////////////////////////////////////////
+         //town
+         GbTriFaceMesh3DPtr town(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(townFilename, "Netz"));
+         if(myid == 0) GbSystem3D::writeGeoObject( town.get(), pathname+"/geo/town", WbWriterVtkXmlBinary::getInstance() );
+         //////////////////////////////////////////////////////////////////////////
+
+         //double cdx = 0.8;
+         double cdx = town->getX3Maximum() / (double)(nx[2] * blocknx[2]);
+         double fdx = cdx/double(1<<refineLevel);
+ 
+         double blockLengthx = blocknx[0]*cdx; //geowerte
+
+         double geoLength[] = { nx[0] * blockLengthx, nx[1] * blockLengthx, nx[2] * blockLengthx };
+
+         double originX1 = town->getX1Minimum();
+         double originX2 = town->getX2Minimum();
+         double originX3 = town->getX3Minimum();
+
+
+         bool periodicx1 = true;
+         bool periodicx2 = true;
+         bool periodicx3 = false;
+
+         //bounding box
+         double g_minX1 = originX1-3.0*blockLengthx;
+         double g_minX2 = originX2-3.0*blockLengthx;
+         double g_minX3 = originX3;
+
+         double g_maxX1 = originX1 + geoLength[0]+3.0*blockLengthx;
+         double g_maxX2 = originX2 + geoLength[1]+1.0*blockLengthx;
+         double g_maxX3 = originX3 + geoLength[2]+2.0*blockLengthx;
+
+         //double g_maxX1 = town->getX1Maximum()+blockLengthx;
+         //double g_maxX2 = town->getX2Maximum()+2.0*blockLengthx;
+         //double g_maxX3 = town->getX3Maximum()+2.0*blockLengthx;
+
+
+         //set grid
+         grid->setDeltaX(cdx);
+         grid->setBlockNX(blocknx[0], blocknx[1], blocknx[2]);
+         grid->setPeriodicX1(periodicx1);
+         grid->setPeriodicX2(periodicx2);
+         grid->setPeriodicX3(periodicx3);
+
+         GbObject3DPtr gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
+         if(myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), pathname+"/geo/gridCube", WbWriterVtkXmlASCII::getInstance());
+
+         GenBlocksGridVisitor genBlocks(gridCube);
+         grid->accept(genBlocks);
+
+
+         //////////////////////////////////////////////////////////////////////////
+         if(myid == 0)
+         {
+            UBLOG(logINFO, "*****************************************");
+            UBLOG(logINFO, "* Parameters                            *");
+            //UBLOG(logINFO, "* Re            ="<<Re);
+            UBLOG(logINFO, "* nuLB          ="<<nuLB);
+            UBLOG(logINFO, "* uLB           ="<<uLB);
+            UBLOG(logINFO, "* cdx           ="<<cdx);
+            UBLOG(logINFO, "* fdx           ="<<fdx);
+            UBLOG(logINFO, "* blocknx1/2/3  ="<<blocknx[0]<<"/"<<blocknx[1]<<"/"<<blocknx[2]);
+            UBLOG(logINFO, "* x1Periodic    ="<<periodicx1);
+            UBLOG(logINFO, "* x2Periodic    ="<<periodicx2);
+            UBLOG(logINFO, "* x3Periodic    ="<<periodicx3);
+            UBLOG(logINFO, "* number of levels  ="<<refineLevel+1);
+            UBLOG(logINFO, "* path          ="<<pathname);
+
+            UBLOG(logINFO, "*****************************************");
+            UBLOG(logINFO, "* number of threads    ="<<numOfThreads);
+            UBLOG(logINFO, "* number of processes  ="<<comm->getNumberOfProcesses());
+            UBLOG(logINFO, "*****************************************");
+            UBLOG(logINFO, "*****************************************");     
+         }
+         //////////////////////////////////////////////////////////////////////////
+
+
+         //////////////////////////////////////////////////////////////////////////
+         //refinement
+
+         /////////////////////////////////////////////////
+         ///interactor
+         int bbOption1 = 1; //0=simple Bounce Back, 1=quadr. BB
+         D3Q27BoundaryConditionAdapterPtr bcNoSlip(new D3Q27NoSlipBCAdapter(bbOption1));
+         D3Q27TriFaceMeshInteractorPtr triTownInteractor(new D3Q27TriFaceMeshInteractor(town, grid, bcNoSlip, Interactor3D::SOLID));
+
+         GbCuboid3DPtr addWallZmax(new GbCuboid3D(g_minX1-blockLengthx, g_minX2-blockLengthx, g_maxX3, g_maxX1+blockLengthx, g_maxX2+blockLengthx, g_maxX3+blockLengthx));
+         if (myid == 0) GbSystem3D::writeGeoObject(addWallZmax.get(), pathname+"/geo/addWallZmax", WbWriterVtkXmlASCII::getInstance());
+         D3Q27InteractorPtr velBCInteractor(new D3Q27Interactor(addWallZmax, grid, Interactor3D::SOLID));
+
+         double raiseVelSteps = 0;
+         vector<D3Q27BCFunction> velcX2BCs, dummy;
+
+         mu::Parser inflowProfile;
+         inflowProfile.SetExpr("uLB");
+         inflowProfile.DefineConst("uLB", uLB);
+         velcX2BCs.push_back(D3Q27BCFunction(inflowProfile, raiseVelSteps, D3Q27BCFunction::INFCONST));
+
+         D3Q27BoundaryConditionAdapterPtr velBCAdapter(new D3Q27VelocityBCAdapter(dummy, velcX2BCs, dummy));
+         velBCInteractor->addBCAdapter(velBCAdapter);
+
+         GbCuboid3DPtr addWallZmin(new GbCuboid3D(g_minX1-blockLengthx, g_minX2-blockLengthx, g_minX3-blockLengthx, g_maxX1+blockLengthx, g_maxX2+blockLengthx, g_minX3));
+         if (myid == 0) GbSystem3D::writeGeoObject(addWallZmin.get(), pathname+"/geo/addWallZmin", WbWriterVtkXmlASCII::getInstance());
+         D3Q27InteractorPtr addWallZminInt(new D3Q27Interactor(addWallZmin, grid, bcNoSlip, Interactor3D::SOLID));
+
+         //GbCuboid3DPtr addWallZmax(new GbCuboid3D(g_minX1-blockLengthx, g_minX2-blockLengthx, g_maxX3, g_maxX1+blockLengthx, g_maxX2+blockLengthx, g_maxX3+blockLengthx));
+         //if (myid == 0) GbSystem3D::writeGeoObject(addWallZmax.get(), pathname+"/geo/addWallZmax", WbWriterVtkXmlASCII::getInstance());
+         //D3Q27InteractorPtr addWallZmaxInt(new D3Q27Interactor(addWallZmax, grid, bcNoSlip, Interactor3D::SOLID));
+
+         GbCuboid3DPtr addWallYmin(new GbCuboid3D(g_minX1-blockLengthx, g_minX2-blockLengthx, g_minX3-blockLengthx, g_maxX1+blockLengthx, g_minX2, g_maxX3+blockLengthx));
+         if (myid == 0) GbSystem3D::writeGeoObject(addWallYmin.get(), pathname+"/geo/addWallYmin", WbWriterVtkXmlASCII::getInstance());
+         D3Q27InteractorPtr addWallYminInt(new D3Q27Interactor(addWallYmin, grid, bcNoSlip, Interactor3D::SOLID));
+
+         GbCuboid3DPtr addWallYmax(new GbCuboid3D(g_minX1-blockLengthx, g_minX2-blockLengthx, g_maxX3, g_maxX1+blockLengthx, g_maxX2+blockLengthx, g_maxX3+blockLengthx));
+         if (myid == 0) GbSystem3D::writeGeoObject(addWallYmax.get(), pathname+"/geo/addWallYmax", WbWriterVtkXmlASCII::getInstance());
+         D3Q27InteractorPtr addWallYmaxInt(new D3Q27Interactor(addWallYmax, grid, bcNoSlip, Interactor3D::SOLID));
+
+         GbCuboid3DPtr addWallXmin(new GbCuboid3D(g_minX1-blockLengthx, g_minX2-blockLengthx, g_minX3-blockLengthx, g_minX1, g_maxX2+blockLengthx, g_maxX3+blockLengthx));
+         if (myid == 0) GbSystem3D::writeGeoObject(addWallXmin.get(), pathname+"/geo/addWallXmin", WbWriterVtkXmlASCII::getInstance());
+         D3Q27InteractorPtr addWallXminInt(new D3Q27Interactor(addWallXmin, grid, bcNoSlip, Interactor3D::SOLID));
+
+         GbCuboid3DPtr addWallXmax(new GbCuboid3D(g_maxX1, g_minX2-blockLengthx, g_minX3-blockLengthx, g_maxX1+blockLengthx, g_maxX2+blockLengthx, g_maxX3+blockLengthx));
+         if (myid == 0) GbSystem3D::writeGeoObject(addWallXmax.get(), pathname+"/geo/addWallXmax", WbWriterVtkXmlASCII::getInstance());
+         D3Q27InteractorPtr addWallXmaxInt(new D3Q27Interactor(addWallXmax, grid, bcNoSlip, Interactor3D::SOLID));
+
+         GbCuboid3DPtr refineTownBox(new GbCuboid3D(town->getX1Minimum(), town->getX2Minimum(), town->getX3Minimum(), town->getX1Maximum(), town->getX2Maximum(), town->getX3Maximum()));
+         if (myid == 0) GbSystem3D::writeGeoObject(refineTownBox.get(), pathname + "/geo/refineTownBox", WbWriterVtkXmlASCII::getInstance());
+
+         if (refineLevel > 0)
+         {
+            if(myid == 0) UBLOG(logINFO,"Refinement - start");	
+            //RefineAroundGbObjectHelper refineHelper(grid, refineLevel, boost::dynamic_pointer_cast<D3Q27TriFaceMeshInteractor>(triTownInteractor), 0.0, 3.0, comm);
+            RefineCrossAndInsideGbObjectHelper refineHelper(grid, refineLevel);
+            //refineHelper.addGbObject(refineTownBox, refineLevel);
+            refineHelper.addGbObject(town, refineLevel);
+            refineHelper.refine();
+            if(myid == 0) UBLOG(logINFO,"Refinement - end");	
+         }
+
+         //Grid3D::BlockIDMap bmap = grid->getBlockIDs();
+         //bmap.clear();
+         //(grid->getBlockIDs()).clear();
+         //grid->deleteBlockIDs();
+
+         //RenumberBlockVisitor renumber;
+         //grid->accept(renumber);
+
+
+         ////////////////////////////////////////////
+         //METIS
+         Grid3DVisitorPtr metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B));	
+
+         ////////////////////////////////////////////
+         /////delete solid blocks
+         if(myid == 0) UBLOG(logINFO,"deleteSolidBlocks - start");
+         InteractorsHelper intHelper(grid, metisVisitor);
+         //intHelper.addInteractor(triTownInteractor);
+         intHelper.addInteractor(velBCInteractor);
+         intHelper.addInteractor(addWallZminInt);
+         //intHelper.addInteractor(addWallZmaxInt);
+         //intHelper.addInteractor(addWallYminInt);
+         //intHelper.addInteractor(addWallYmaxInt);
+         //intHelper.addInteractor(addWallXminInt);
+         //intHelper.addInteractor(addWallXmaxInt);
+         intHelper.selectBlocks();
+         if(myid == 0) UBLOG(logINFO,"deleteSolidBlocks - end");	 
+         //////////////////////////////////////
+
+         //grid->accept(renumber);
+
+         //if (myid == 0)
+         {
+            UBLOG(logINFO, "Write blocks - start");
+            BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm));
+            ppblocks->update(0);
+            UBLOG(logINFO, "Write blocks - end");
+         }
+
+         
+
+
+         //domain decomposition for threads
+         if(numOfThreads > 1)
+         {
+            PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
+            grid->accept(pqPartVisitor);
+         }
+
+
+         unsigned long nob = grid->getNumberOfBlocks();
+         unsigned long nod = nob * blocknx[0]*blocknx[1]*blocknx[2];
+         unsigned long nod_real = nob * (blocknx[0]+3)*(blocknx[1]+3)*(blocknx[2]+3);
+         unsigned long nodb = (blocknx[0]) * (blocknx[1]) * (blocknx[2]);
+
+         double needMemAll  = double(nod_real*(27*sizeof(double) + sizeof(int)));
+         double needMem  = needMemAll / double(comm->getNumberOfProcesses());
+         
+         double nup = 0; 
+
+         if(myid == 0)
+         {
+            UBLOG(logINFO,"Number of blocks = " << nob);
+            UBLOG(logINFO,"Number of nodes  = " << nod);
+            int minInitLevel = grid->getCoarsestInitializedLevel();
+            int maxInitLevel = grid->getFinestInitializedLevel();
+            for(int level = minInitLevel; level<=maxInitLevel; level++)
+            {
+               int nobl = grid->getNumberOfBlocks(level);
+               UBLOG(logINFO,"Number of blocks for level " << level <<" = " << nobl);
+               UBLOG(logINFO,"Number of nodes for level " << level <<" = " << nobl*nodb);
+               nup += nobl*nodb*double(1<<level); 
+            }
+            UBLOG(logINFO,"Hypothetically time for calculation step for 120 nodes  = " << nup/6.0e5/(120*8)  << " s");
+            UBLOG(logINFO,"Necessary memory  = " << needMemAll  << " bytes");
+            UBLOG(logINFO,"Necessary memory per process = " << needMem  << " bytes");
+            UBLOG(logINFO,"Available memory per process = " << availMem << " bytes");
+            UBLOG(logINFO,"Available memory per node/8.0 = " << (availMem/8.0) << " bytes");
+         }
+         //////////////////////////////////////////
+         //set connectors
+         if(myid == 0) UBLOG(logINFO,"set connectors - start");
+         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
+         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
+         grid->accept( setConnsVisitor );
+         if(myid == 0) UBLOG(logINFO,"set connectors - end");
+
+         ////////////////////////////
+         LBMKernel3DPtr kernel;
+         kernel = LBMKernel3DPtr(new LBMKernelETD3Q27CCLB(blocknx[0], blocknx[1], blocknx[2], LBMKernelETD3Q27CCLB::NORMAL));
+
+         //mu::Parser fctForcingX2;
+         //fctForcingX2.SetExpr("Fx2*dx");
+         //fctForcingX2.DefineConst("Fx2", 5e-6);
+
+         //kernel->setForcingX2(fctForcingX2);
+         //kernel->setWithForcing(true);
+
+         BCProcessorPtr bcProc(new D3Q27ETBCProcessor());
+         //BCProcessorPtr bcProc(new D3Q27ETForThinWallBCProcessor());
+         kernel->setBCProcessor(bcProc);
+         SetKernelBlockVisitor kernelVisitor(kernel, nuLB, availMem, needMem);
+         grid->accept(kernelVisitor);
+         //////////////////////////////////
+         //undef nodes
+         if (refineLevel > 0)
+         {
+            D3Q27SetUndefinedNodesBlockVisitor undefNodesVisitor;
+            grid->accept(undefNodesVisitor);
+         }
+
+
+         intHelper.setBC();
+
+         //initialization of decompositions
+         D3Q27ETInitDistributionsBlockVisitor initVisitor( nuLB,rhoLB);
+         initVisitor.setVx2(uLB);
+         grid->accept(initVisitor);
+
+         //Postprozess
+         UbSchedulerPtr geoSch(new UbScheduler(1));
+         D3Q27MacroscopicQuantitiesPostprocessorPtr ppgeo(
+            new D3Q27MacroscopicQuantitiesPostprocessor(grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), 
+            unitConverter, true));
+         ppgeo->update(0);
+         ppgeo.reset();
+         geoSch.reset();
+
+         if(myid == 0) UBLOG(logINFO,"Preprozess - end");      
+      }
+      else
+      {
+         //domain decomposition for threads
+         if(numOfThreads > 1)
+         {
+            PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
+            grid->accept(pqPartVisitor);
+         }
+         //set connectors
+         D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
+         D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
+         grid->accept( setConnsVisitor );
+
+         if(myid == 0) UBLOG(logINFO,"Restart - end"); 
+      }
+      UbSchedulerPtr visSch(new UbScheduler());
+      visSch->addSchedule(1,0,3);
+      //visSch->addSchedule(100,100,1000);
+      //visSch->addSchedule(1000,1000,5000);
+      //visSch->addSchedule(5000,5000,100000);
+      //visSch->addSchedule(100000,100000,10000000);
+
+      visSch->addSchedule(1000,1000,10000000);
+
+      D3Q27MacroscopicQuantitiesPostprocessor pp(grid, visSch, pathname, WbWriterVtkXmlBinary::getInstance(), unitConverter);
+
+      UbSchedulerPtr nupsSch(new UbScheduler(10, 10, 30));
+      nupsSch->addSchedule(500,500,1e6);
+      NUPSCounterPostprocessor npr(grid, nupsSch, numOfThreads, comm);
+
+      //UbSchedulerPtr emSch(new UbScheduler(100));
+      //EmergencyExitPostprocessor empr(grid, emSch, pathname, RestartPostprocessorPtr(&rp), comm);
+
+      if(myid == 0)
+      {
+         UBLOG(logINFO,"PID = " << myid << " Total Physical Memory (RAM): " << Utilities::getTotalPhysMem());
+         UBLOG(logINFO,"PID = " << myid << " Physical Memory currently used: " << Utilities::getPhysMemUsed());
+         UBLOG(logINFO,"PID = " << myid << " Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe());
+      }
+
+      string lastStep = "1000000";// string(cstr2);
+      double endTime = UbSystem::stringTo<double>(lastStep);
+      CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, visSch));
+      if(myid == 0) UBLOG(logINFO,"Simulation-start");
+      calculation->calculate();
+      if(myid == 0) UBLOG(logINFO,"Simulation-end");
+   }
+   catch(std::exception& e)
+   {
+      cerr << e.what() << endl << flush;
+   }
+   catch(std::string& s)
+   {
+      cerr << s << endl;
+   }
+   catch(...)
+   {
+      cerr << "unknown exception" << endl;
+   }
+
+}
+//////////////////////////////////////////////////////////////////////////
+int main(int argc, char* argv[])
+{
+   if (argc == 1)
+   {
+      cout<<"Command line argument isn't specified!"<<endl;
+      cout<<"plate2 <machine name>"<<endl;
+      return 1;
+   }
+   run(argv[1], argv[2]);
+
+   return 0;
+}
+
diff --git a/apps/cpu/vfscript/CMakeLists.txt b/apps/cpu/vfscript/CMakeLists.txt
index f7a0bf1d28fc8d54d02fe8717598806733a77110..264a306a98ca5a36bb76f4a907e9664fe9aa70ef 100644
--- a/apps/cpu/vfscript/CMakeLists.txt
+++ b/apps/cpu/vfscript/CMakeLists.txt
@@ -1,29 +1,29 @@
-CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
-
-########################################################
-## C++ PROJECT                                       ###
-########################################################
-PROJECT(vfscript)
-
-INCLUDE(${SOURCE_ROOT}/core/IncludsList.txt) 
-
-#################################################################
-###   LOCAL FILES                                             ###
-#################################################################
-FILE(GLOB SPECIFIC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.h
-                         ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
-                         ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp  )
- 
-SET(ALL_SOURCES ${ALL_SOURCES} ${SPECIFIC_FILES})
-SOURCE_GROUP(src FILES ${SPECIFIC_FILES})
-  
-SET(CAB_ADDITIONAL_LINK_LIBRARIES core)
-
-#YAML support
-SET(LINK_LIBRARY optimized ${YAML_RELEASE_LIBRARY} debug ${YAML_DEBUG_LIBRARY})
-SET(CAB_ADDITIONAL_LINK_LIBRARIES ${CAB_ADDITIONAL_LINK_LIBRARIES} ${LINK_LIBRARY})
-
-#################################################################
-###   CREATE PROJECT                                          ###
-#################################################################
-CREATE_CAB_PROJECT(vfscript BINARY)
+CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
+
+########################################################
+## C++ PROJECT                                       ###
+########################################################
+PROJECT(vfscript)
+
+INCLUDE(${SOURCE_ROOT}/core/IncludsList.txt) 
+
+#################################################################
+###   LOCAL FILES                                             ###
+#################################################################
+FILE(GLOB SPECIFIC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.h
+                         ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
+                         ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp  )
+ 
+SET(ALL_SOURCES ${ALL_SOURCES} ${SPECIFIC_FILES})
+SOURCE_GROUP(src FILES ${SPECIFIC_FILES})
+  
+SET(CAB_ADDITIONAL_LINK_LIBRARIES core)
+
+#YAML support
+SET(LINK_LIBRARY optimized ${YAML_RELEASE_LIBRARY} debug ${YAML_DEBUG_LIBRARY})
+SET(CAB_ADDITIONAL_LINK_LIBRARIES ${CAB_ADDITIONAL_LINK_LIBRARIES} ${LINK_LIBRARY})
+
+#################################################################
+###   CREATE PROJECT                                          ###
+#################################################################
+CREATE_CAB_PROJECT(vfscript BINARY)
diff --git a/apps/cpu/vfscript/input.json b/apps/cpu/vfscript/input.json
index 28aa5a4ba256493db73ed7bf707e5b1c1c4259bf..0b4c9c5bd612a8c2e33c6711dec257f4c8afe21c 100644
--- a/apps/cpu/vfscript/input.json
+++ b/apps/cpu/vfscript/input.json
@@ -1,35 +1,35 @@
-{"Simulation": {
-   "GeoObjectList":
-   ["GeoObject" : { 
-      "ID": "channel",
-      "GeoType": "GbCuboid3D",
-      "Point1": [0.0, 0.0, 0.0],
-      "Point2": [5.0, 5.0, 5.0],
-      "Properties": {
-         "Physics": {
-            "Rho": 1.0,
-            "Vx1": 0.001
-         },
-         "Numerical":{
-            "BC": {
-               "Type": "NoSlip",
-               "State": "Fluid",
-               "SecondaryBcOptions": "SimpleBounceBack"
-            }
-         }
-      }
-    "GeoObject" : { 
-      "ID": "sphere",
-      "GeoType": "GbSphere3D",
-      "Center": [2.5, 2.5, 2.5], 
-      "Radius": 1.5,
-       "Properties": {
-         "Numerical":{
-            "BC": {
-               "Type": "NoSlip",
-               "State": "Solid",
-               "SecondaryBcOptions": "SimpleBounceBack"
-            }
-         }
-      }]      
+{"Simulation": {
+   "GeoObjectList":
+   ["GeoObject" : { 
+      "ID": "channel",
+      "GeoType": "GbCuboid3D",
+      "Point1": [0.0, 0.0, 0.0],
+      "Point2": [5.0, 5.0, 5.0],
+      "Properties": {
+         "Physics": {
+            "Rho": 1.0,
+            "Vx1": 0.001
+         },
+         "Numerical":{
+            "BC": {
+               "Type": "NoSlip",
+               "State": "Fluid",
+               "SecondaryBcOptions": "SimpleBounceBack"
+            }
+         }
+      }
+    "GeoObject" : { 
+      "ID": "sphere",
+      "GeoType": "GbSphere3D",
+      "Center": [2.5, 2.5, 2.5], 
+      "Radius": 1.5,
+       "Properties": {
+         "Numerical":{
+            "BC": {
+               "Type": "NoSlip",
+               "State": "Solid",
+               "SecondaryBcOptions": "SimpleBounceBack"
+            }
+         }
+      }]      
 }}
\ No newline at end of file
diff --git a/apps/cpu/vfscript/sphere.yaml b/apps/cpu/vfscript/sphere.yaml
index 436cd633fe3b7143c96718c93c97d1cb84690d73..5a2d91a284128f8f70bc2c0c636c2a0847f4f183 100644
--- a/apps/cpu/vfscript/sphere.yaml
+++ b/apps/cpu/vfscript/sphere.yaml
@@ -1,37 +1,37 @@
-#flow around sphere
-
-SimulationParametrs:
-   OutputPath: c:\temp\sphere\out
-   Steps: 1000
-   Output: 100
-
-Grid:
- NumberOfThreads: 4
- Block: [10, 10, 10]
- BlockSize: [1.0, 1.0, 1.0]
- RefineLevel: 1
- 
-GeoObjects: 
- - ID: channel
-   GeoType: GbCuboid3D,
-   Point1: [0.0, 0.0, 0.0]
-   Point2: [5.0, 5.0, 5.0]
-   Properties: 
-    Physics: 
-     Rho: 1.0
-     Vx1: 0.001
-    Numerical:
-     BC: 
-      Type: NoSlip
-      State: Fluid
-      SecondaryBcOptions: SimpleBounceBack
- - ID: sphere
-   GeoType: GbSphere3D
-   Center: [2.5, 2.5, 2.5] 
-   Radius: 1.5
-   Properties:
-    Numerical:
-     BC:
-      Type: NoSlip
-      State: Solid
-      SecondaryBcOptions: SecondOrderBounceBack           
+#flow around sphere
+
+SimulationParametrs:
+   OutputPath: c:\temp\sphere\out
+   Steps: 1000
+   Output: 100
+
+Grid:
+ NumberOfThreads: 4
+ Block: [10, 10, 10]
+ BlockSize: [1.0, 1.0, 1.0]
+ RefineLevel: 1
+ 
+GeoObjects: 
+ - ID: channel
+   GeoType: GbCuboid3D,
+   Point1: [0.0, 0.0, 0.0]
+   Point2: [5.0, 5.0, 5.0]
+   Properties: 
+    Physics: 
+     Rho: 1.0
+     Vx1: 0.001
+    Numerical:
+     BC: 
+      Type: NoSlip
+      State: Fluid
+      SecondaryBcOptions: SimpleBounceBack
+ - ID: sphere
+   GeoType: GbSphere3D
+   Center: [2.5, 2.5, 2.5] 
+   Radius: 1.5
+   Properties:
+    Numerical:
+     BC:
+      Type: NoSlip
+      State: Solid
+      SecondaryBcOptions: SecondOrderBounceBack           
diff --git a/apps/cpu/vfscript/vfscript.cpp b/apps/cpu/vfscript/vfscript.cpp
index 2d915b69247787edfe8dfcf8f4d295672d9a8a2a..13e26d36719045997cc738c250089484f34051cc 100644
--- a/apps/cpu/vfscript/vfscript.cpp
+++ b/apps/cpu/vfscript/vfscript.cpp
@@ -1,120 +1,120 @@
-#include <iostream>
-#include <string>
-
-#include "geometry3d/CoordinateTransformation3D.h"
-#include "Grid3D.h"
-#include "GenBlocksGridVisitor.h"
-#include "geometry3d/GbSystem3D.h"
-#include "geometry3d/GbCuboid3D.h"
-#include "geometry3d/GbCylinder3D.h"
-#include <geometry3d/GbSphere3D.h>
-#include "basics/writer/WbWriterVtkXmlASCII.h"
-#include "basics/writer/WbWriterVtkXmlBinary.h"
-#include "RefineCrossAndInsideGbObjectBlockVisitor.h"
-#include "RatioBlockVisitor.h"
-#include "RatioSmoothBlockVisitor.h"
-#include "OverlapBlockVisitor.h"
-#include "RefineInterGbObjectsVisitor.h"
-#include "RefineCrossAndInsideGbObjectBlockVisitor.h"
-#include "SetKernelBlockVisitor.h"
-#include "LBMKernelETD3Q27Cascaded.h"
-#include "D3Q27MacroscopicQuantitiesPostprocessor.h"
-#include "MPICommunicator.h"
-#include "D3Q27ETBCProcessor.h"
-#include "SimulationParameters.h"
-#include "D3Q27SetUndefinedNodesBlockVisitor.h"
-#include "SetInterpolationDirsBlockVisitor.h"
-#include "D3Q27SetConnectorsBlockVisitor.h"
-#include "NullCommunicator.h"
-#include "D3Q27ETInitDistributionsBlockVisitor.h"
-#include "CalculationManager.h"
-#include "PQueuePartitioningGridVisitor.h"
-#include "MetisPartitioningGridVisitor.h"
-#include "D3Q27Interactor.h"
-#include "D3Q27NoSlipBCAdapter.h"
-#include "D3Q27VelocityBCAdapter.h"
-#include "D3Q27DensityBCAdapter.h"
-#include "D3Q27BoundaryConditionAdapter.h"
-#include "StringUtil.hpp"
-//#include "rapidjson/document.h"		// rapidjson's DOM-style API
-//#include "rapidjson/filestream.h"
-
-#include <fstream>
-#include "yaml-cpp/yaml.h"
-
-using namespace std;
-
-
-void run(const char *istr)
-{
-   try
-   {
-      //// Prepare reader and input stream.
-      //rapidjson::Reader reader;
-      ////rapidjson::Document reader;
-      //FILE* fp;
-      //fp = fopen(istr, "r");
-      //rapidjson::FileStream is(fp);
-
-      //rapidjson::Document document;	// Default template parameter uses UTF8 and MemoryPoolAllocator.
-
-      //if (document.ParseStream<0>(is).HasParseError())
-      //{
-      //   //UBLOG(logINFO,"JSON parcing is fail" );
-      //   fprintf(stderr, "\nError(%u): %s\n", (unsigned)document.GetErrorOffset(), document.GetParseError());
-      //   return;
-      //}
-
-      //fclose(fp);
-
-      std::ifstream fin(istr);
-      YAML::Parser parser(fin);
-      YAML::Node doc;
-      parser.GetNextDocument(doc);
-
-      if(doc.FindValue("GeoObjects"))
-      {
-         const YAML::Node& geoObjects = doc["GeoObjects"];
-         string id;
-         for(unsigned i=0;i<geoObjects.size();i++)
-         {
-            geoObjects[i]["ID"] >> id;
-            std::cout << id << "\n";
-         }
-      }
-
-   }
-   catch(YAML::ParserException& e) {
-      std::cout << e.what() << "\n";
-   }
-   catch(std::exception& e)
-   {
-      cerr << e.what() << endl << flush;
-   }
-   catch(std::string& s)
-   {
-      cerr << s << endl;
-   }
-   catch(...)
-   {
-      cerr << "unknown exception" << endl;
-   }
-
-}
-int main(int argc, char* argv[])
-{
-   if ( argv != NULL )
-   {
-      if (argc > 1)
-      {
-         run(argv[1]);
-      }
-      else
-      {
-         cout << "Input file must be set!: " <<  argv[0] << " <input file>" << endl << std::flush;
-      }
-   }
-
-   return 0;
-}
-
+#include <iostream>
+#include <string>
+
+#include "geometry3d/CoordinateTransformation3D.h"
+#include "Grid3D.h"
+#include "GenBlocksGridVisitor.h"
+#include "geometry3d/GbSystem3D.h"
+#include "geometry3d/GbCuboid3D.h"
+#include "geometry3d/GbCylinder3D.h"
+#include <geometry3d/GbSphere3D.h>
+#include "basics/writer/WbWriterVtkXmlASCII.h"
+#include "basics/writer/WbWriterVtkXmlBinary.h"
+#include "RefineCrossAndInsideGbObjectBlockVisitor.h"
+#include "RatioBlockVisitor.h"
+#include "RatioSmoothBlockVisitor.h"
+#include "OverlapBlockVisitor.h"
+#include "RefineInterGbObjectsVisitor.h"
+#include "RefineCrossAndInsideGbObjectBlockVisitor.h"
+#include "SetKernelBlockVisitor.h"
+#include "LBMKernelETD3Q27Cascaded.h"
+#include "D3Q27MacroscopicQuantitiesPostprocessor.h"
+#include "MPICommunicator.h"
+#include "D3Q27ETBCProcessor.h"
+#include "SimulationParameters.h"
+#include "D3Q27SetUndefinedNodesBlockVisitor.h"
+#include "SetInterpolationDirsBlockVisitor.h"
+#include "D3Q27SetConnectorsBlockVisitor.h"
+#include "NullCommunicator.h"
+#include "D3Q27ETInitDistributionsBlockVisitor.h"
+#include "CalculationManager.h"
+#include "PQueuePartitioningGridVisitor.h"
+#include "MetisPartitioningGridVisitor.h"
+#include "D3Q27Interactor.h"
+#include "D3Q27NoSlipBCAdapter.h"
+#include "D3Q27VelocityBCAdapter.h"
+#include "D3Q27DensityBCAdapter.h"
+#include "D3Q27BoundaryConditionAdapter.h"
+#include "StringUtil.hpp"
+//#include "rapidjson/document.h"		// rapidjson's DOM-style API
+//#include "rapidjson/filestream.h"
+
+#include <fstream>
+#include "yaml-cpp/yaml.h"
+
+using namespace std;
+
+
+void run(const char *istr)
+{
+   try
+   {
+      //// Prepare reader and input stream.
+      //rapidjson::Reader reader;
+      ////rapidjson::Document reader;
+      //FILE* fp;
+      //fp = fopen(istr, "r");
+      //rapidjson::FileStream is(fp);
+
+      //rapidjson::Document document;	// Default template parameter uses UTF8 and MemoryPoolAllocator.
+
+      //if (document.ParseStream<0>(is).HasParseError())
+      //{
+      //   //UBLOG(logINFO,"JSON parcing is fail" );
+      //   fprintf(stderr, "\nError(%u): %s\n", (unsigned)document.GetErrorOffset(), document.GetParseError());
+      //   return;
+      //}
+
+      //fclose(fp);
+
+      std::ifstream fin(istr);
+      YAML::Parser parser(fin);
+      YAML::Node doc;
+      parser.GetNextDocument(doc);
+
+      if(doc.FindValue("GeoObjects"))
+      {
+         const YAML::Node& geoObjects = doc["GeoObjects"];
+         string id;
+         for(unsigned i=0;i<geoObjects.size();i++)
+         {
+            geoObjects[i]["ID"] >> id;
+            std::cout << id << "\n";
+         }
+      }
+
+   }
+   catch(YAML::ParserException& e) {
+      std::cout << e.what() << "\n";
+   }
+   catch(std::exception& e)
+   {
+      cerr << e.what() << endl << flush;
+   }
+   catch(std::string& s)
+   {
+      cerr << s << endl;
+   }
+   catch(...)
+   {
+      cerr << "unknown exception" << endl;
+   }
+
+}
+int main(int argc, char* argv[])
+{
+   if ( argv != NULL )
+   {
+      if (argc > 1)
+      {
+         run(argv[1]);
+      }
+      else
+      {
+         cout << "Input file must be set!: " <<  argv[0] << " <input file>" << endl << std::flush;
+      }
+   }
+
+   return 0;
+}
+
diff --git a/docs/cpu/Documentation/doc.h b/docs/cpu/Documentation/doc.h
index bdac8f8c3e0922cff1b31fead26d3c324a8647fe..0c6c4c6c30e7bc1a8691b52fa1555f2ea3d4d16b 100644
--- a/docs/cpu/Documentation/doc.h
+++ b/docs/cpu/Documentation/doc.h
@@ -1,31 +1,31 @@
-//index page for doxygen
-
-/*! \mainpage
- *
- *  \section intro_sec Introduction
- *  <i>VirtualFluids</i> is an adaptive, parallel Lattice-Boltzmann flow solver 
- *  which is comprised of various cores 
- *  and use second order accurate compact interpolation at the interfaces, 
- *  coupling grids of different resolutions. 
- *  The software framework is based on object-oriented technology and uses tree-like data structures. 
- *  These data structures are also suitable for hierarchical parallelization using a combination of PThreads and MPI and dynamic load balancing. 
- *   
- *  \section install_sec Installation
- *
- *  \subsection step1 Step 1: CMake
- *  Download and install <a href="http://www.cmake.org/">CMake</a>. 
- *  If you have Windows OS oder X-Windows for Linux/Unix start <i>cmake-gui</i>.
- *  If you work in terminal start <i>ccmake</i>.
- *  \subsection step2 Step 2: project configuration
- *  You need set a path for <i>VirtualFluids</i> source code. It is allays <i>source</i> directory at the end of path.
- *  E.g. c:/vf/source. You need also set a path to build binaries. If you click <b>Configure</b> button start a project wizard and you can choose a compiler.
- *  Set <b>Grouped</b> and <b>Advanced</b> check boxes in CMake. In the group <i>USE</i> you have follow important options:
- *  \li USE_BOND    - using an agent based communication framework for fault tolerance BOND
- *  \li USE_METIS   - using a domain decomposition tool METIS    
- *  \li USE_MPI       - using MPI for distributed memory parallelization   
- *  \li USE_YAML     - using YAML
- *  \li USE_ZOLTAN - using domain decomposition tool ZOLTAN 
- *  There are externals library and you need additionally compile them.    
- *  \subsection step3 Step 4: project compilation
- *  Compile you project with suitable compiler.  
+//index page for doxygen
+
+/*! \mainpage
+ *
+ *  \section intro_sec Introduction
+ *  <i>VirtualFluids</i> is an adaptive, parallel Lattice-Boltzmann flow solver 
+ *  which is comprised of various cores 
+ *  and use second order accurate compact interpolation at the interfaces, 
+ *  coupling grids of different resolutions. 
+ *  The software framework is based on object-oriented technology and uses tree-like data structures. 
+ *  These data structures are also suitable for hierarchical parallelization using a combination of PThreads and MPI and dynamic load balancing. 
+ *   
+ *  \section install_sec Installation
+ *
+ *  \subsection step1 Step 1: CMake
+ *  Download and install <a href="http://www.cmake.org/">CMake</a>. 
+ *  If you have Windows OS oder X-Windows for Linux/Unix start <i>cmake-gui</i>.
+ *  If you work in terminal start <i>ccmake</i>.
+ *  \subsection step2 Step 2: project configuration
+ *  You need set a path for <i>VirtualFluids</i> source code. It is allays <i>source</i> directory at the end of path.
+ *  E.g. c:/vf/source. You need also set a path to build binaries. If you click <b>Configure</b> button start a project wizard and you can choose a compiler.
+ *  Set <b>Grouped</b> and <b>Advanced</b> check boxes in CMake. In the group <i>USE</i> you have follow important options:
+ *  \li USE_BOND    - using an agent based communication framework for fault tolerance BOND
+ *  \li USE_METIS   - using a domain decomposition tool METIS    
+ *  \li USE_MPI       - using MPI for distributed memory parallelization   
+ *  \li USE_YAML     - using YAML
+ *  \li USE_ZOLTAN - using domain decomposition tool ZOLTAN 
+ *  There are externals library and you need additionally compile them.    
+ *  \subsection step3 Step 4: project compilation
+ *  Compile you project with suitable compiler.  
  */
\ No newline at end of file
diff --git a/docs/cpu/Documentation/doc/install.html b/docs/cpu/Documentation/doc/install.html
index 06eaea91eb71b0c33cee25b215ffc53b17f66727..0c4cfd3b3a94a47d2bd7c0de756def3f6501ff1a 100644
--- a/docs/cpu/Documentation/doc/install.html
+++ b/docs/cpu/Documentation/doc/install.html
@@ -1,18 +1,18 @@
-\section install_sec Installation
-
-\subsection step1 Step 1: CMake
-Download and install <a href="http://www.cmake.org/">CMake</a>. 
-If you have Windows OS oder X-Windows for Linux/Unix start <i>cmake-gui</i>.
-If you work in terminal start <i>ccmake</i>.
-\subsection step2 Step 2: project configuration
-You need set a path for <i>VirtualFluids</i> source code. It is allays <i>source</i> directory at the end of path.
-E.g. c:/vf/source. You need also set a path to build binaries. If you click <b>Configure</b> button start a project wizard and you can choose a compiler.
-Set <b>Grouped</b> and <b>Advanced</b> check boxes in CMake. In the group <i>USE</i> you have follow important options:
-\li USE_BOND    - using an agent based communication framework for fault tolerance BOND
-\li USE_METIS   - using a domain decomposition tool METIS    
-\li USE_MPI       - using MPI for distributed memory parallelization   
-\li USE_YAML     - using YAML
-\li USE_ZOLTAN - using domain decomposition tool ZOLTAN 
-There are externals library and you need additionally compile them.    
-\subsection step3 Step 4: project compilation
-Compile you project with suitable compiler.  
+\section install_sec Installation
+
+\subsection step1 Step 1: CMake
+Download and install <a href="http://www.cmake.org/">CMake</a>. 
+If you have Windows OS oder X-Windows for Linux/Unix start <i>cmake-gui</i>.
+If you work in terminal start <i>ccmake</i>.
+\subsection step2 Step 2: project configuration
+You need set a path for <i>VirtualFluids</i> source code. It is allays <i>source</i> directory at the end of path.
+E.g. c:/vf/source. You need also set a path to build binaries. If you click <b>Configure</b> button start a project wizard and you can choose a compiler.
+Set <b>Grouped</b> and <b>Advanced</b> check boxes in CMake. In the group <i>USE</i> you have follow important options:
+\li USE_BOND    - using an agent based communication framework for fault tolerance BOND
+\li USE_METIS   - using a domain decomposition tool METIS    
+\li USE_MPI       - using MPI for distributed memory parallelization   
+\li USE_YAML     - using YAML
+\li USE_ZOLTAN - using domain decomposition tool ZOLTAN 
+There are externals library and you need additionally compile them.    
+\subsection step3 Step 4: project compilation
+Compile you project with suitable compiler.  
diff --git a/docs/cpu/Documentation/doc/intstall.md b/docs/cpu/Documentation/doc/intstall.md
index fdf6a0069f431e72ee1df584c99becfe2b497bc8..912aea1bb142486445049dd3a1ae08b151ca344f 100644
--- a/docs/cpu/Documentation/doc/intstall.md
+++ b/docs/cpu/Documentation/doc/intstall.md
@@ -1,18 +1,18 @@
-# Installation    {#installation}
-## Step 1: CMake  
-Download and install [CMake](http://www.cmake.org). 
-If you have Windows OS oder X-Windows for Linux/Unix start *cmake-gui*.
-If you work in terminal start *ccmake*.
-## Step 2: project configuration
-You need set a path for *VirtualFluids* source code. It is allays *source* directory at the end of path.
-E.g. *c:/vf/source*. You need also set a path to build binaries. E.g. *c:/vf/bin*. If you click **Configure** button start a project wizard and you can choose a compiler.
-Set **Grouped** and **Advanced** check boxes in CMake. In the group *USE* you have follow important options:
-* USE_BOND    - using an agent based communication framework for fault tolerance BOND
-* USE_METIS   - using a domain decomposition tool METIS    
-* USE_MPI       - using MPI for distributed memory parallelization   
-* USE_YAML     - using YAML
-* USE_ZOLTAN - using domain decomposition tool ZOLTAN  
-
-There are externals library and you need additionally compile them.    
-## Step 4: project compilation
+# Installation    {#installation}
+## Step 1: CMake  
+Download and install [CMake](http://www.cmake.org). 
+If you have Windows OS oder X-Windows for Linux/Unix start *cmake-gui*.
+If you work in terminal start *ccmake*.
+## Step 2: project configuration
+You need set a path for *VirtualFluids* source code. It is allays *source* directory at the end of path.
+E.g. *c:/vf/source*. You need also set a path to build binaries. E.g. *c:/vf/bin*. If you click **Configure** button start a project wizard and you can choose a compiler.
+Set **Grouped** and **Advanced** check boxes in CMake. In the group *USE* you have follow important options:
+* USE_BOND    - using an agent based communication framework for fault tolerance BOND
+* USE_METIS   - using a domain decomposition tool METIS    
+* USE_MPI       - using MPI for distributed memory parallelization   
+* USE_YAML     - using YAML
+* USE_ZOLTAN - using domain decomposition tool ZOLTAN  
+
+There are externals library and you need additionally compile them.    
+## Step 4: project compilation
 Compile you project with suitable compiler
\ No newline at end of file
diff --git a/docs/cpu/Documentation/doc/main.md b/docs/cpu/Documentation/doc/main.md
index 367fce7da0589346658c389a9717161594286275..1b04aeb7f44f4c80bbe71e6f839b90850dfca222 100644
--- a/docs/cpu/Documentation/doc/main.md
+++ b/docs/cpu/Documentation/doc/main.md
@@ -1,11 +1,11 @@
-# Introduction {#mainpage}
-
-## Introduction
-*VirtualFluids* is an adaptive, parallel Lattice-Boltzmann flow solver 
-which is comprised of various cores 
-and use second order accurate compact interpolation at the interfaces, 
-coupling grids of different resolutions. 
-The software framework is based on object-oriented technology and uses tree-like data structures. 
-These data structures are also suitable for hierarchical parallelization using a combination of PThreads and MPI and dynamic load balancing. 
-
-[Installation](md__d_1__projects__virtual_fluids_source__documentation_doc_intstall.html)
+# Introduction {#mainpage}
+
+## Introduction
+*VirtualFluids* is an adaptive, parallel Lattice-Boltzmann flow solver 
+which is comprised of various cores 
+and use second order accurate compact interpolation at the interfaces, 
+coupling grids of different resolutions. 
+The software framework is based on object-oriented technology and uses tree-like data structures. 
+These data structures are also suitable for hierarchical parallelization using a combination of PThreads and MPI and dynamic load balancing. 
+
+[Installation](md__d_1__projects__virtual_fluids_source__documentation_doc_intstall.html)
diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/BCAdapter.h b/src/cpu/VirtualFluidsCore/BoundaryConditions/BCAdapter.h
index f1eef89477f4446e0e658ac00923f1fd0f1ed78d..a34f899ae53df3fe4f48cd9b252a9c63bc4ff9a7 100644
--- a/src/cpu/VirtualFluidsCore/BoundaryConditions/BCAdapter.h
+++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/BCAdapter.h
@@ -1,92 +1,92 @@
-//=======================================================================================
-// ____          ____    __    ______     __________   __      __       __        __         
-// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
-//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
-//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
-//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
-//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
-//      \    \  |    |   ________________________________________________________________    
-//       \    \ |    |  |  ______________________________________________________________|   
-//        \    \|    |  |  |         __          __     __     __     ______      _______    
-//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
-//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
-//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
-//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
-//
-//  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 BCAdapter.h
-//! \ingroup BoundarConditions
-//! \author Sören Freudiger
-//=======================================================================================
-#ifndef BCAdapter_H
-#define BCAdapter_H
-
-#include <PointerDefinitions.h>
-
-#include "BoundaryConditions.h"
-#include "BCAlgorithm.h"
-
-class D3Q27Interactor;
-
-//! \brief Abstract class of baundary conditions adapter
-//! \details  BCAdapter supports the definition of boundary conditions in grid generation
-class BCAdapter
-{
-public:
-   BCAdapter() 
-      :  secondaryBcOption(0)
-       , type(0)
-       , algorithmType(-1)
-   {
-   }
-   //! \param secondaryBcOption additional option of boundary conditions
-   BCAdapter(const short& secondaryBcOption) 
-      :  secondaryBcOption(secondaryBcOption) 
-       , type(0)
-       , algorithmType(-1)
-   {
-   }
-   virtual ~BCAdapter() {}
-
-   //methods
-   bool isTimeDependent() { return((this->type & TIMEDEPENDENT) ==  TIMEDEPENDENT); }
-
-   virtual short getSecondaryBcOption() { return this->secondaryBcOption; }
-   virtual void  setSecondaryBcOption(const short& val) { this->secondaryBcOption=val; }
-
-   virtual void init(const D3Q27Interactor* const& interactor, const double& time=0) = 0;
-   virtual void update(const D3Q27Interactor* const& interactor, const double& time=0) = 0;
-
-   virtual void adaptBC( const D3Q27Interactor& interactor, SPtr<BoundaryConditions> bc, const double& worldX1, const double& worldX2, const double& worldX3, const double& time=0 ) = 0;
-   virtual void adaptBCForDirection( const D3Q27Interactor& interactor, SPtr<BoundaryConditions> bc, const double& worldX1, const double& worldX2, const double& worldX3, const double& q, const int& fdirection, const double& time=0 ) = 0;
-
-   void setBcAlgorithm(SPtr<BCAlgorithm> alg) {algorithmType = alg->getType(); algorithm = alg;}
-   SPtr<BCAlgorithm> getAlgorithm() {return algorithm;} 
-   char getBcAlgorithmType() {return algorithmType;}
-
-protected:
-   short secondaryBcOption;
-
-   char  type;
-
-   SPtr<BCAlgorithm> algorithm;
-   char algorithmType;
-
-   static const char   TIMEDEPENDENT = 1<<0;//'1';
-   static const char   TIMEPERIODIC  = 1<<1;//'2';
-};
-
-
-#endif //D3Q27BOUNDARYCONDITIONADAPTER_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 BCAdapter.h
+//! \ingroup BoundarConditions
+//! \author Sören Freudiger
+//=======================================================================================
+#ifndef BCAdapter_H
+#define BCAdapter_H
+
+#include <PointerDefinitions.h>
+
+#include "BoundaryConditions.h"
+#include "BCAlgorithm.h"
+
+class D3Q27Interactor;
+
+//! \brief Abstract class of baundary conditions adapter
+//! \details  BCAdapter supports the definition of boundary conditions in grid generation
+class BCAdapter
+{
+public:
+   BCAdapter() 
+      :  secondaryBcOption(0)
+       , type(0)
+       , algorithmType(-1)
+   {
+   }
+   //! \param secondaryBcOption additional option of boundary conditions
+   BCAdapter(const short& secondaryBcOption) 
+      :  secondaryBcOption(secondaryBcOption) 
+       , type(0)
+       , algorithmType(-1)
+   {
+   }
+   virtual ~BCAdapter() {}
+
+   //methods
+   bool isTimeDependent() { return((this->type & TIMEDEPENDENT) ==  TIMEDEPENDENT); }
+
+   virtual short getSecondaryBcOption() { return this->secondaryBcOption; }
+   virtual void  setSecondaryBcOption(const short& val) { this->secondaryBcOption=val; }
+
+   virtual void init(const D3Q27Interactor* const& interactor, const double& time=0) = 0;
+   virtual void update(const D3Q27Interactor* const& interactor, const double& time=0) = 0;
+
+   virtual void adaptBC( const D3Q27Interactor& interactor, SPtr<BoundaryConditions> bc, const double& worldX1, const double& worldX2, const double& worldX3, const double& time=0 ) = 0;
+   virtual void adaptBCForDirection( const D3Q27Interactor& interactor, SPtr<BoundaryConditions> bc, const double& worldX1, const double& worldX2, const double& worldX3, const double& q, const int& fdirection, const double& time=0 ) = 0;
+
+   void setBcAlgorithm(SPtr<BCAlgorithm> alg) {algorithmType = alg->getType(); algorithm = alg;}
+   SPtr<BCAlgorithm> getAlgorithm() {return algorithm;} 
+   char getBcAlgorithmType() {return algorithmType;}
+
+protected:
+   short secondaryBcOption;
+
+   char  type;
+
+   SPtr<BCAlgorithm> algorithm;
+   char algorithmType;
+
+   static const char   TIMEDEPENDENT = 1<<0;//'1';
+   static const char   TIMEPERIODIC  = 1<<1;//'2';
+};
+
+
+#endif //D3Q27BOUNDARYCONDITIONADAPTER_H
diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/BCArray3D.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/BCArray3D.cpp
index 69de4c349dce851032d45b9136c6b6e768e2ddc1..76094ba5bbc4c1abc1c6d602eedd5acaf55ae88c 100644
--- a/src/cpu/VirtualFluidsCore/BoundaryConditions/BCArray3D.cpp
+++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/BCArray3D.cpp
@@ -1,236 +1,236 @@
-//=======================================================================================
-// ____          ____    __    ______     __________   __      __       __        __         
-// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
-//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
-//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
-//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
-//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
-//      \    \  |    |   ________________________________________________________________    
-//       \    \ |    |  |  ______________________________________________________________|   
-//        \    \|    |  |  |         __          __     __     __     ______      _______    
-//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
-//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
-//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
-//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
-//
-//  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 BCArray3D.cpp
-//! \ingroup BoundarConditions
-//! \author Sören Freudiger
-//=======================================================================================
-
-#include "BCArray3D.h"
-
-const int BCArray3D::SOLID = -1;
-const int BCArray3D::FLUID = -2;
-const int BCArray3D::INTERFACECF = -3;
-const int BCArray3D::INTERFACEFC = -4;
-const int BCArray3D::UNDEFINED = -5;
-
-//////////////////////////////////////////////////////////////////////////
-BCArray3D::BCArray3D() {}
-//////////////////////////////////////////////////////////////////////////
-BCArray3D::BCArray3D(std::size_t nx1, std::size_t nx2, std::size_t nx3)
-{
-   bcindexmatrix.resize(nx1, nx2, nx3, UNDEFINED);
-}
-//////////////////////////////////////////////////////////////////////////
-BCArray3D::BCArray3D(std::size_t nx1, std::size_t nx2, std::size_t nx3, int val)
-{
-   bcindexmatrix.resize(nx1, nx2, nx3, val);
-}
-//////////////////////////////////////////////////////////////////////////
-BCArray3D::~BCArray3D() {}
-//////////////////////////////////////////////////////////////////////////
-void BCArray3D::resize(std::size_t nx1, std::size_t nx2, std::size_t nx3)
-{
-   bcindexmatrix.resize(nx1, nx2, nx3);
-}
-//////////////////////////////////////////////////////////////////////////
-void BCArray3D::resize(std::size_t nx1, std::size_t nx2, std::size_t nx3, int val)
-{
-   bcindexmatrix.resize(nx1, nx2, nx3, val);
-}
-//////////////////////////////////////////////////////////////////////////
-bool BCArray3D::validIndices(std::size_t x1, std::size_t x2, std::size_t x3)  const
-{
-   if (x1 < 0 || x1 >= this->bcindexmatrix.getNX1()) return false;
-   if (x2 < 0 || x2 >= this->bcindexmatrix.getNX2()) return false;
-   if (x3 < 0 || x3 >= this->bcindexmatrix.getNX3()) return false;
-   return true;
-}
-//////////////////////////////////////////////////////////////////////////
-void BCArray3D::setBC(std::size_t x1, std::size_t x2, std::size_t x3, SPtr<BoundaryConditions> const& bc)
-{
-   if (this->hasBC(x1, x2, x3))
-   {
-      if (this->getBC(x1, x2, x3) == bc) return;
-      else                            this->deleteBC(x1, x2, x3);
-   }
-
-   //if no vacant BCs available
-   if (indexContainer.empty())
-   {
-      bcvector.push_back(bc);
-      bcindexmatrix(x1, x2, x3) = (int)bcvector.size() - 1;
-   }
-   else
-   {
-      int index = indexContainer.back();
-      bcindexmatrix(x1, x2, x3) = index;
-      bcvector[index] = bc;
-      indexContainer.pop_back();
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-void BCArray3D::setSolid(std::size_t x1, std::size_t x2, std::size_t x3)
-{
-   if (this->hasBC(x1, x2, x3)) this->deleteBC(x1, x2, x3);
-   bcindexmatrix(x1, x2, x3) = SOLID;
-}
-//////////////////////////////////////////////////////////////////////////
-void BCArray3D::setFluid(std::size_t x1, std::size_t x2, std::size_t x3)
-{
-   if (this->hasBC(x1, x2, x3)) this->deleteBC(x1, x2, x3);
-   bcindexmatrix(x1, x2, x3) = FLUID;
-}
-//////////////////////////////////////////////////////////////////////////
-void BCArray3D::setUndefined(std::size_t x1, std::size_t x2, std::size_t x3)
-{
-   if (this->hasBC(x1, x2, x3)) this->deleteBC(x1, x2, x3);
-   bcindexmatrix(x1, x2, x3) = UNDEFINED;
-}
-//////////////////////////////////////////////////////////////////////////
-std::size_t BCArray3D::getNumberOfSolidEntries() const
-{
-   const std::vector<int>& data = bcindexmatrix.getDataVector();
-   std::size_t counter = 0;
-   for (std::size_t i = 0; i < data.size(); i++)
-      if (data[i] == SOLID) counter++;
-   return counter;
-}
-//////////////////////////////////////////////////////////////////////////
-std::size_t BCArray3D::getNumberOfFluidEntries() const
-{
-   const std::vector<int>& data = bcindexmatrix.getDataVector();
-   std::size_t counter = 0;
-   for (std::size_t i = 0; i < data.size(); i++)
-   {
-      int tmp = data[i];
-      if (tmp == FLUID || tmp >= 0) counter++;
-   }
-   return counter;
-}
-//////////////////////////////////////////////////////////////////////////
-std::size_t BCArray3D::getNumberOfFluidWithoutBCEntries() const
-{
-   const std::vector<int>& data = bcindexmatrix.getDataVector();
-   std::size_t counter = 0;
-   for (std::size_t i = 0; i < data.size(); i++)
-      if (data[i] == FLUID) counter++;
-   return counter;
-}
-//////////////////////////////////////////////////////////////////////////
-std::size_t BCArray3D::getNumberOfBCEntries() const
-{
-   const std::vector<int>& data = bcindexmatrix.getDataVector();
-   std::size_t counter = 0;
-   for (std::size_t i = 0; i < data.size(); i++)
-      if (data[i] >= 0) counter++;
-   return counter;
-}
-//////////////////////////////////////////////////////////////////////////
-std::size_t BCArray3D::getNumberOfUndefinedEntries() const
-{
-   const std::vector<int>& data = bcindexmatrix.getDataVector();
-   std::size_t counter = 0;
-   for (std::size_t i = 0; i < data.size(); i++)
-      if (data[i] == UNDEFINED) counter++;
-   return counter;
-}
-//////////////////////////////////////////////////////////////////////////
-std::size_t BCArray3D::getBCVectorSize() const
-{
-   return this->bcvector.size();
-}
-//////////////////////////////////////////////////////////////////////////
-std::string BCArray3D::toString() const
-{
-   std::size_t solidCounter = 0;
-   std::size_t fluidCounter = 0;
-   std::size_t bcCounter = 0;
-   std::size_t undefCounter = 0;
-
-   for (int x1 = 0; x1 < bcindexmatrix.getNX1(); x1++)
-   {
-      for (int x2 = 0; x2 < bcindexmatrix.getNX2(); x2++)
-      {
-         for (int x3 = 0; x3 < bcindexmatrix.getNX3(); x3++)
-         {
-            if (bcindexmatrix(x1, x2, x3) >= 0) bcCounter++;
-            else if (bcindexmatrix(x1, x2, x3) == FLUID) fluidCounter++;
-            else if (bcindexmatrix(x1, x2, x3) == SOLID) solidCounter++;
-            else if (bcindexmatrix(x1, x2, x3) == UNDEFINED) undefCounter++;
-            else throw UbException(UB_EXARGS, "invalid matrixEntry");
-         }
-      }
-   }
-
-   std::size_t unrefEntriesInBcVector = 0;
-   for (std::size_t i = 0; i < bcvector.size(); i++) if (!bcvector[i]) unrefEntriesInBcVector++;
-
-   std::stringstream text;
-   text << "BCArray<" << typeid(SPtr<BoundaryConditions>).name() << "," << typeid(int).name() << ">";
-   text << "[ entries: " << bcindexmatrix.getNX1() << "x" << bcindexmatrix.getNX2();
-   text << "x" << bcindexmatrix.getNX3() << "=";
-   text << bcindexmatrix.getNX1()*bcindexmatrix.getNX2()*bcindexmatrix.getNX3() << " ]:\n";
-   text << " - #fluid entries : " << fluidCounter << std::endl;
-   text << " - #bc    entries : " << bcCounter << std::endl;
-   text << " - #solid entries : " << solidCounter << std::endl;
-   text << " - #undef entries : " << undefCounter << std::endl;
-   text << " - bcvector-entries      : " << bcvector.size() << " (empty ones: " << unrefEntriesInBcVector << ")\n";
-   text << " - indexContainer-entries: " << indexContainer.size() << std::endl;
-
-   return text.str();
-}
-//////////////////////////////////////////////////////////////////////////
-std::vector< int >& BCArray3D::getBcindexmatrixDataVector()
-{
-   return bcindexmatrix.getDataVector();
-}
-
-
-//////////////////////////////////////////////////////////////////////////
-void BCArray3D::deleteBCAndSetType(std::size_t x1, std::size_t x2, std::size_t x3, int type)
-   {
-      this->deleteBC(x1, x2, x3);
-
-      //Assign matrix to new type
-      bcindexmatrix(x1, x2, x3) = type;
-   }
-//////////////////////////////////////////////////////////////////////////
-void BCArray3D::deleteBC(std::size_t x1, std::size_t x2, std::size_t x3)
-   {
-      //check if BC exists at all
-      int index = bcindexmatrix(x1, x2, x3);
-      if (index < 0) return;
-
-      //slide the released index into the index container
-      indexContainer.push_back(index);
-
-      //"delete" element
-      bcvector[index] = SPtr<BoundaryConditions>();
-   }
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 BCArray3D.cpp
+//! \ingroup BoundarConditions
+//! \author Sören Freudiger
+//=======================================================================================
+
+#include "BCArray3D.h"
+
+const int BCArray3D::SOLID = -1;
+const int BCArray3D::FLUID = -2;
+const int BCArray3D::INTERFACECF = -3;
+const int BCArray3D::INTERFACEFC = -4;
+const int BCArray3D::UNDEFINED = -5;
+
+//////////////////////////////////////////////////////////////////////////
+BCArray3D::BCArray3D() {}
+//////////////////////////////////////////////////////////////////////////
+BCArray3D::BCArray3D(std::size_t nx1, std::size_t nx2, std::size_t nx3)
+{
+   bcindexmatrix.resize(nx1, nx2, nx3, UNDEFINED);
+}
+//////////////////////////////////////////////////////////////////////////
+BCArray3D::BCArray3D(std::size_t nx1, std::size_t nx2, std::size_t nx3, int val)
+{
+   bcindexmatrix.resize(nx1, nx2, nx3, val);
+}
+//////////////////////////////////////////////////////////////////////////
+BCArray3D::~BCArray3D() {}
+//////////////////////////////////////////////////////////////////////////
+void BCArray3D::resize(std::size_t nx1, std::size_t nx2, std::size_t nx3)
+{
+   bcindexmatrix.resize(nx1, nx2, nx3);
+}
+//////////////////////////////////////////////////////////////////////////
+void BCArray3D::resize(std::size_t nx1, std::size_t nx2, std::size_t nx3, int val)
+{
+   bcindexmatrix.resize(nx1, nx2, nx3, val);
+}
+//////////////////////////////////////////////////////////////////////////
+bool BCArray3D::validIndices(std::size_t x1, std::size_t x2, std::size_t x3)  const
+{
+   if (x1 < 0 || x1 >= this->bcindexmatrix.getNX1()) return false;
+   if (x2 < 0 || x2 >= this->bcindexmatrix.getNX2()) return false;
+   if (x3 < 0 || x3 >= this->bcindexmatrix.getNX3()) return false;
+   return true;
+}
+//////////////////////////////////////////////////////////////////////////
+void BCArray3D::setBC(std::size_t x1, std::size_t x2, std::size_t x3, SPtr<BoundaryConditions> const& bc)
+{
+   if (this->hasBC(x1, x2, x3))
+   {
+      if (this->getBC(x1, x2, x3) == bc) return;
+      else                            this->deleteBC(x1, x2, x3);
+   }
+
+   //if no vacant BCs available
+   if (indexContainer.empty())
+   {
+      bcvector.push_back(bc);
+      bcindexmatrix(x1, x2, x3) = (int)bcvector.size() - 1;
+   }
+   else
+   {
+      int index = indexContainer.back();
+      bcindexmatrix(x1, x2, x3) = index;
+      bcvector[index] = bc;
+      indexContainer.pop_back();
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+void BCArray3D::setSolid(std::size_t x1, std::size_t x2, std::size_t x3)
+{
+   if (this->hasBC(x1, x2, x3)) this->deleteBC(x1, x2, x3);
+   bcindexmatrix(x1, x2, x3) = SOLID;
+}
+//////////////////////////////////////////////////////////////////////////
+void BCArray3D::setFluid(std::size_t x1, std::size_t x2, std::size_t x3)
+{
+   if (this->hasBC(x1, x2, x3)) this->deleteBC(x1, x2, x3);
+   bcindexmatrix(x1, x2, x3) = FLUID;
+}
+//////////////////////////////////////////////////////////////////////////
+void BCArray3D::setUndefined(std::size_t x1, std::size_t x2, std::size_t x3)
+{
+   if (this->hasBC(x1, x2, x3)) this->deleteBC(x1, x2, x3);
+   bcindexmatrix(x1, x2, x3) = UNDEFINED;
+}
+//////////////////////////////////////////////////////////////////////////
+std::size_t BCArray3D::getNumberOfSolidEntries() const
+{
+   const std::vector<int>& data = bcindexmatrix.getDataVector();
+   std::size_t counter = 0;
+   for (std::size_t i = 0; i < data.size(); i++)
+      if (data[i] == SOLID) counter++;
+   return counter;
+}
+//////////////////////////////////////////////////////////////////////////
+std::size_t BCArray3D::getNumberOfFluidEntries() const
+{
+   const std::vector<int>& data = bcindexmatrix.getDataVector();
+   std::size_t counter = 0;
+   for (std::size_t i = 0; i < data.size(); i++)
+   {
+      int tmp = data[i];
+      if (tmp == FLUID || tmp >= 0) counter++;
+   }
+   return counter;
+}
+//////////////////////////////////////////////////////////////////////////
+std::size_t BCArray3D::getNumberOfFluidWithoutBCEntries() const
+{
+   const std::vector<int>& data = bcindexmatrix.getDataVector();
+   std::size_t counter = 0;
+   for (std::size_t i = 0; i < data.size(); i++)
+      if (data[i] == FLUID) counter++;
+   return counter;
+}
+//////////////////////////////////////////////////////////////////////////
+std::size_t BCArray3D::getNumberOfBCEntries() const
+{
+   const std::vector<int>& data = bcindexmatrix.getDataVector();
+   std::size_t counter = 0;
+   for (std::size_t i = 0; i < data.size(); i++)
+      if (data[i] >= 0) counter++;
+   return counter;
+}
+//////////////////////////////////////////////////////////////////////////
+std::size_t BCArray3D::getNumberOfUndefinedEntries() const
+{
+   const std::vector<int>& data = bcindexmatrix.getDataVector();
+   std::size_t counter = 0;
+   for (std::size_t i = 0; i < data.size(); i++)
+      if (data[i] == UNDEFINED) counter++;
+   return counter;
+}
+//////////////////////////////////////////////////////////////////////////
+std::size_t BCArray3D::getBCVectorSize() const
+{
+   return this->bcvector.size();
+}
+//////////////////////////////////////////////////////////////////////////
+std::string BCArray3D::toString() const
+{
+   std::size_t solidCounter = 0;
+   std::size_t fluidCounter = 0;
+   std::size_t bcCounter = 0;
+   std::size_t undefCounter = 0;
+
+   for (int x1 = 0; x1 < bcindexmatrix.getNX1(); x1++)
+   {
+      for (int x2 = 0; x2 < bcindexmatrix.getNX2(); x2++)
+      {
+         for (int x3 = 0; x3 < bcindexmatrix.getNX3(); x3++)
+         {
+            if (bcindexmatrix(x1, x2, x3) >= 0) bcCounter++;
+            else if (bcindexmatrix(x1, x2, x3) == FLUID) fluidCounter++;
+            else if (bcindexmatrix(x1, x2, x3) == SOLID) solidCounter++;
+            else if (bcindexmatrix(x1, x2, x3) == UNDEFINED) undefCounter++;
+            else throw UbException(UB_EXARGS, "invalid matrixEntry");
+         }
+      }
+   }
+
+   std::size_t unrefEntriesInBcVector = 0;
+   for (std::size_t i = 0; i < bcvector.size(); i++) if (!bcvector[i]) unrefEntriesInBcVector++;
+
+   std::stringstream text;
+   text << "BCArray<" << typeid(SPtr<BoundaryConditions>).name() << "," << typeid(int).name() << ">";
+   text << "[ entries: " << bcindexmatrix.getNX1() << "x" << bcindexmatrix.getNX2();
+   text << "x" << bcindexmatrix.getNX3() << "=";
+   text << bcindexmatrix.getNX1()*bcindexmatrix.getNX2()*bcindexmatrix.getNX3() << " ]:\n";
+   text << " - #fluid entries : " << fluidCounter << std::endl;
+   text << " - #bc    entries : " << bcCounter << std::endl;
+   text << " - #solid entries : " << solidCounter << std::endl;
+   text << " - #undef entries : " << undefCounter << std::endl;
+   text << " - bcvector-entries      : " << bcvector.size() << " (empty ones: " << unrefEntriesInBcVector << ")\n";
+   text << " - indexContainer-entries: " << indexContainer.size() << std::endl;
+
+   return text.str();
+}
+//////////////////////////////////////////////////////////////////////////
+std::vector< int >& BCArray3D::getBcindexmatrixDataVector()
+{
+   return bcindexmatrix.getDataVector();
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+void BCArray3D::deleteBCAndSetType(std::size_t x1, std::size_t x2, std::size_t x3, int type)
+   {
+      this->deleteBC(x1, x2, x3);
+
+      //Assign matrix to new type
+      bcindexmatrix(x1, x2, x3) = type;
+   }
+//////////////////////////////////////////////////////////////////////////
+void BCArray3D::deleteBC(std::size_t x1, std::size_t x2, std::size_t x3)
+   {
+      //check if BC exists at all
+      int index = bcindexmatrix(x1, x2, x3);
+      if (index < 0) return;
+
+      //slide the released index into the index container
+      indexContainer.push_back(index);
+
+      //"delete" element
+      bcvector[index] = SPtr<BoundaryConditions>();
+   }
    
\ No newline at end of file
diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/BCFunction.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/BCFunction.cpp
index 3bb9ebe406b18a01ede578c34b9f3d794f89751a..34c536c8ea588c7e42c208a1f4bfdec2ce98c67a 100644
--- a/src/cpu/VirtualFluidsCore/BoundaryConditions/BCFunction.cpp
+++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/BCFunction.cpp
@@ -1,38 +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 BCFunction.cpp
-//! \ingroup BoundarConditions
-//! \author Sören Freudiger
-//=======================================================================================
-
-#include "BCFunction.h"
-
-const double BCFunction::INFTIMEDEPENDENT = -1.0;
-const double BCFunction::INFCONST         = -10.0;
-
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 BCFunction.cpp
+//! \ingroup BoundarConditions
+//! \author Sören Freudiger
+//=======================================================================================
+
+#include "BCFunction.h"
+
+const double BCFunction::INFTIMEDEPENDENT = -1.0;
+const double BCFunction::INFCONST         = -10.0;
+
diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/BCFunction.h b/src/cpu/VirtualFluidsCore/BoundaryConditions/BCFunction.h
index ca2671178cdcd1239329ab0bca574d2570f876f5..96102f82a3a9c426b9ad669058b5b8ec75058032 100644
--- a/src/cpu/VirtualFluidsCore/BoundaryConditions/BCFunction.h
+++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/BCFunction.h
@@ -1,113 +1,113 @@
-//=======================================================================================
-// ____          ____    __    ______     __________   __      __       __        __         
-// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
-//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
-//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
-//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
-//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
-//      \    \  |    |   ________________________________________________________________    
-//       \    \ |    |  |  ______________________________________________________________|   
-//        \    \|    |  |  |         __          __     __     __     ______      _______    
-//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
-//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
-//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
-//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
-//
-//  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 BCFunction.h
-//! \ingroup BoundarConditions
-//! \author Sören Freudiger
-//=======================================================================================
-
-#ifndef D3Q27BCFUNCTION_H
-#define D3Q27BCFUNCTION_H
-
-#include <basics/utilities/UbInfinity.h>
-
-#include <muParser.h>
-
-//! A class implements function parcer for boundary conditions  
-class BCFunction
-{
-public:
-   static const double INFTIMEDEPENDENT;
-   static const double INFCONST;
-
-public:
-   BCFunction() 
-      : starttime(-Ub::inf ), endtime(-Ub::inf ) 
-   {
-
-   }
-   BCFunction( const mu::Parser& function, const double& starttime, const double& endtime )
-      : function(function), starttime(starttime), endtime(endtime)
-   {
-
-   }
-   BCFunction( const std::string& functionstring, const double& starttime, const double& endtime )
-      : starttime(starttime), endtime(endtime)
-   {
-      this->setFunction(functionstring); 
-   }
-   BCFunction( const double& velocity, const double& starttime, const double& endtime )
-      : starttime(starttime), endtime(endtime)
-   {
-      this->setFunction(velocity); 
-   }
-
-   void setFunction(const mu::Parser& function) { this->function = function; }
-   void setFunction(const std::string& functionstring) { this->function.SetExpr(functionstring); }
-   void setFunction(const double& constVelocity) { std::stringstream dummy; dummy<<constVelocity; function.SetExpr(dummy.str());  }
-   void setStartTime(const double& starttime) {this->starttime = starttime; }
-   void setEndTime(const double& endtime) {this->endtime = endtime; }
-
-   mu::Parser&        getFunction()        { return function;  }
-   const mu::Parser&  getFunction()  const { return function;  }
-   const double&      getStartTime() const { return starttime; }
-   const double&      getEndTime()   const { return endtime;   }
-
-   std::string toString() const
-   {
-      std::stringstream info;
-      if     (starttime==INFTIMEDEPENDENT) info<<"start=inf. timedep., ";
-      else if(starttime==INFCONST        ) info<<"start=inf. const., ";
-      else                                 info<<"start="<<starttime<<", ";
-      if     (endtime==INFTIMEDEPENDENT) info<<"end=inf. timedep."<<std::endl;
-      else if(endtime==INFCONST        ) info<<"end=inf. const."<<std::endl;
-      else                               info<<"end="<<endtime<<std::endl;
-      info<<"expr="<<function.GetExpr()<<std::endl;
-      info<<"with constants: ";
-      mu::valmap_type cmap = function.GetConst();
-      for(mu::valmap_type::const_iterator item = cmap.begin(); item!=cmap.end(); ++item)
-         info<<item->first<<"="<<item->second<<", ";
-      return info.str();
-   }
-   /*==========================================================*/
-   friend inline std::ostream& operator << (std::ostream& os, const BCFunction& bc) 
-   {
-      os<<bc.toString();
-      return os;
-   }
-
-protected:
-   mu::Parser function;
-   double starttime;
-   double endtime;
-
-private:
-
-};
-
-#endif //D3Q27BCFUNCTION_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 BCFunction.h
+//! \ingroup BoundarConditions
+//! \author Sören Freudiger
+//=======================================================================================
+
+#ifndef D3Q27BCFUNCTION_H
+#define D3Q27BCFUNCTION_H
+
+#include <basics/utilities/UbInfinity.h>
+
+#include <muParser.h>
+
+//! A class implements function parcer for boundary conditions  
+class BCFunction
+{
+public:
+   static const double INFTIMEDEPENDENT;
+   static const double INFCONST;
+
+public:
+   BCFunction() 
+      : starttime(-Ub::inf ), endtime(-Ub::inf ) 
+   {
+
+   }
+   BCFunction( const mu::Parser& function, const double& starttime, const double& endtime )
+      : function(function), starttime(starttime), endtime(endtime)
+   {
+
+   }
+   BCFunction( const std::string& functionstring, const double& starttime, const double& endtime )
+      : starttime(starttime), endtime(endtime)
+   {
+      this->setFunction(functionstring); 
+   }
+   BCFunction( const double& velocity, const double& starttime, const double& endtime )
+      : starttime(starttime), endtime(endtime)
+   {
+      this->setFunction(velocity); 
+   }
+
+   void setFunction(const mu::Parser& function) { this->function = function; }
+   void setFunction(const std::string& functionstring) { this->function.SetExpr(functionstring); }
+   void setFunction(const double& constVelocity) { std::stringstream dummy; dummy<<constVelocity; function.SetExpr(dummy.str());  }
+   void setStartTime(const double& starttime) {this->starttime = starttime; }
+   void setEndTime(const double& endtime) {this->endtime = endtime; }
+
+   mu::Parser&        getFunction()        { return function;  }
+   const mu::Parser&  getFunction()  const { return function;  }
+   const double&      getStartTime() const { return starttime; }
+   const double&      getEndTime()   const { return endtime;   }
+
+   std::string toString() const
+   {
+      std::stringstream info;
+      if     (starttime==INFTIMEDEPENDENT) info<<"start=inf. timedep., ";
+      else if(starttime==INFCONST        ) info<<"start=inf. const., ";
+      else                                 info<<"start="<<starttime<<", ";
+      if     (endtime==INFTIMEDEPENDENT) info<<"end=inf. timedep."<<std::endl;
+      else if(endtime==INFCONST        ) info<<"end=inf. const."<<std::endl;
+      else                               info<<"end="<<endtime<<std::endl;
+      info<<"expr="<<function.GetExpr()<<std::endl;
+      info<<"with constants: ";
+      mu::valmap_type cmap = function.GetConst();
+      for(mu::valmap_type::const_iterator item = cmap.begin(); item!=cmap.end(); ++item)
+         info<<item->first<<"="<<item->second<<", ";
+      return info.str();
+   }
+   /*==========================================================*/
+   friend inline std::ostream& operator << (std::ostream& os, const BCFunction& bc) 
+   {
+      os<<bc.toString();
+      return os;
+   }
+
+protected:
+   mu::Parser function;
+   double starttime;
+   double endtime;
+
+private:
+
+};
+
+#endif //D3Q27BCFUNCTION_H
diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/BCProcessor.h b/src/cpu/VirtualFluidsCore/BoundaryConditions/BCProcessor.h
index 91537e74cc3d2488c952221ac66ba5ef595a5228..4c3f66ac2365bed782f3622c28694382da8d4bc0 100644
--- a/src/cpu/VirtualFluidsCore/BoundaryConditions/BCProcessor.h
+++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/BCProcessor.h
@@ -1,68 +1,68 @@
-//=======================================================================================
-// ____          ____    __    ______     __________   __      __       __        __         
-// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
-//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
-//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
-//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
-//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
-//      \    \  |    |   ________________________________________________________________    
-//       \    \ |    |  |  ______________________________________________________________|   
-//        \    \|    |  |  |         __          __     __     __     ______      _______    
-//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
-//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
-//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
-//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
-//
-//  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 BCProcessor.h
-//! \ingroup BoundarConditions
-//! \author Konstantin Kutscher
-//=======================================================================================
-
-#ifndef BC_PROCESSSOR_H
-#define BC_PROCESSSOR_H
-
-#include <PointerDefinitions.h>
-#include <vector>
-
-class BCArray3D;
-class BCAlgorithm;
-class ILBMKernel;
-
-//! A class provides an interface for boundary conditions in the calculation loop.  
-class BCProcessor
-{
-public:
-   BCProcessor();
-   BCProcessor(SPtr<ILBMKernel> kernel);
-   virtual ~BCProcessor();
-   virtual SPtr<BCArray3D> getBCArray();
-   virtual void setBCArray(SPtr<BCArray3D> bcarray);
-   virtual SPtr<BCProcessor> clone(SPtr<ILBMKernel> kernel);
-
-   void addBC(SPtr<BCAlgorithm> bc);
-   void applyPreCollisionBC();
-   void applyPostCollisionBC();
-   void clearBC();
-protected:
-   std::vector<SPtr<BCAlgorithm> > preBC;
-   std::vector<SPtr<BCAlgorithm> > postBC;
-   SPtr<BCArray3D> bcArray;
-
-private:
-
-};
-
-#endif
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 BCProcessor.h
+//! \ingroup BoundarConditions
+//! \author Konstantin Kutscher
+//=======================================================================================
+
+#ifndef BC_PROCESSSOR_H
+#define BC_PROCESSSOR_H
+
+#include <PointerDefinitions.h>
+#include <vector>
+
+class BCArray3D;
+class BCAlgorithm;
+class ILBMKernel;
+
+//! A class provides an interface for boundary conditions in the calculation loop.  
+class BCProcessor
+{
+public:
+   BCProcessor();
+   BCProcessor(SPtr<ILBMKernel> kernel);
+   virtual ~BCProcessor();
+   virtual SPtr<BCArray3D> getBCArray();
+   virtual void setBCArray(SPtr<BCArray3D> bcarray);
+   virtual SPtr<BCProcessor> clone(SPtr<ILBMKernel> kernel);
+
+   void addBC(SPtr<BCAlgorithm> bc);
+   void applyPreCollisionBC();
+   void applyPostCollisionBC();
+   void clearBC();
+protected:
+   std::vector<SPtr<BCAlgorithm> > preBC;
+   std::vector<SPtr<BCAlgorithm> > postBC;
+   SPtr<BCArray3D> bcArray;
+
+private:
+
+};
+
+#endif
diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/BoundaryConditions.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/BoundaryConditions.cpp
index 0f209e0a24cdd19dec1c30d5b4231bc27518e7ac..23ffad85e6cf0454e6f1927f22ee3ad94828d23f 100644
--- a/src/cpu/VirtualFluidsCore/BoundaryConditions/BoundaryConditions.cpp
+++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/BoundaryConditions.cpp
@@ -1,37 +1,37 @@
-//=======================================================================================
-// ____          ____    __    ______     __________   __      __       __        __         
-// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
-//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
-//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
-//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
-//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
-//      \    \  |    |   ________________________________________________________________    
-//       \    \ |    |  |  ______________________________________________________________|   
-//        \    \|    |  |  |         __          __     __     __     ______      _______    
-//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
-//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
-//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
-//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
-//
-//  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 BoundaryConditions.h
-//! \ingroup BoundarConditions
-//! \author Sören Freudiger
-//=======================================================================================
-
-#include "BoundaryConditions.h"
-
-const long long BoundaryConditions::maxOptionVal = ( 1<<optionDigits ) - 1; //2^3-1 -> 7 
-
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 BoundaryConditions.h
+//! \ingroup BoundarConditions
+//! \author Sören Freudiger
+//=======================================================================================
+
+#include "BoundaryConditions.h"
+
+const long long BoundaryConditions::maxOptionVal = ( 1<<optionDigits ) - 1; //2^3-1 -> 7 
+
diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/DensityBCAdapter.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/DensityBCAdapter.cpp
index 24adb6cba5cedbe3fc4110f77ec6a55dd92b90aa..4d510601c4053b7f5cffccddb59785e3e226cae6 100644
--- a/src/cpu/VirtualFluidsCore/BoundaryConditions/DensityBCAdapter.cpp
+++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/DensityBCAdapter.cpp
@@ -1,157 +1,157 @@
-#include "DensityBCAdapter.h"
-#include "basics/utilities/UbLogger.h"
-#include "basics/utilities/UbInfinity.h"
-
-using namespace std;
-/*==========================================================*/
-DensityBCAdapter::DensityBCAdapter(const double& dens, const double& startTime, const double& endTime )
-{
-   this->densBCs.push_back( BCFunction(dens,startTime,endTime) );
-   this->init();
-}
-/*==========================================================*/
-DensityBCAdapter::DensityBCAdapter(const BCFunction& densBC )
-{
-   this->densBCs.push_back(densBC);
-   this->init();
-}
-/*==========================================================*/
-DensityBCAdapter::DensityBCAdapter(const std::vector< BCFunction >& densBCs)
-{
-   this->densBCs = densBCs;
-   this->init();
-}
-/*==========================================================*/
-DensityBCAdapter::DensityBCAdapter(const mu::Parser& function, const double& startTime, const double& endTime )
-{
-   this->densBCs.push_back(BCFunction(function,startTime,endTime));
-   this->init();
-}
-/*==========================================================*/
-void DensityBCAdapter::init()
-{
-   this->timeStep = 0.0;
-
-   this->x1 = 0.0;
-   this->x2 = 0.0;
-   this->x3 = 0.0;
-
-   this->tmpDensityFunction = NULL;
-
-   try //initilialization and validation of functions
-   {
-      for(size_t pos=0; pos<densBCs.size(); ++pos)
-      {
-         if( !(    UbMath::equal( BCFunction::INFCONST, densBCs[pos].getEndTime() )
-                && UbMath::greaterEqual( this->timeStep,  densBCs[pos].getStartTime()  ) ) )
-         { 
-            this->setTimeDependent();
-         }
-
-         densBCs[pos].getFunction().DefineVar("t" , &this->timeStep);
-         densBCs[pos].getFunction().DefineVar("x1", &this->x1      );
-         densBCs[pos].getFunction().DefineVar("x2", &this->x2      );
-         densBCs[pos].getFunction().DefineVar("x3", &this->x3      );
-
-         densBCs[pos].getFunction().Eval(); //<-- validation
-      }
-   }
-   catch(mu::Parser::exception_type& e){ stringstream error; error<<"mu::parser exception occurs, message("<<e.GetMsg()<<"), formula("<<e.GetExpr()+"), token("+e.GetToken()<<")"
-                                         <<", pos("<<e.GetPos()<<"), error code("<<e.GetCode(); throw UbException(error.str()); }
-   catch(...)                          { throw UbException(UB_EXARGS,"unknown exception" );                       }
-}
-/*==========================================================*/
-void DensityBCAdapter::init(const D3Q27Interactor* const& interactor, const double& time)
-{
-   this->timeStep           = time;
-   this->tmpDensityFunction = NULL;
-   double maxEndtime        = -Ub::inf;
-
-   //aktuelle Densityfunction bestimmen
-   for(size_t pos=0; pos<densBCs.size(); ++pos)
-   {
-      if( UbMath::equal(densBCs[pos].getEndTime(),BCFunction::INFTIMEDEPENDENT)) maxEndtime=Ub::inf;
-      maxEndtime = UbMath::max(maxEndtime,densBCs[pos].getStartTime(),densBCs[pos].getEndTime()); //startTime abfragen, da  INFCONST=-10
-
-      if( UbMath::greaterEqual(this->timeStep,densBCs[pos].getStartTime()) ) 
-      {
-         if(   UbMath::lessEqual(this->timeStep,densBCs[pos].getEndTime())
-            || UbMath::equal(densBCs[pos].getEndTime(),(double)BCFunction::INFCONST)
-            || UbMath::equal(densBCs[pos].getEndTime(),(double)BCFunction::INFTIMEDEPENDENT) )
-         {
-            tmpDensityFunction = &densBCs[pos].getFunction();
-            break;
-         }
-      }
-   }
-
-   //wenn funktionen zweitlich konstant sind und bis t=unendlich gelten
-   //kann man zeitabhaengigkeit deaktivieren
-   if( UbMath::greaterEqual(time,maxEndtime) ) this->unsetTimeDependent();
-
-   UBLOG(logDEBUG4,"D3Q27DensityBCAdapter::init(time="<<time<<") "
-                    <<", rho= \""<<(tmpDensityFunction ? tmpDensityFunction->GetExpr() : "-")
-                    <<"\", timedependant="<<(this->isTimeDependent() ? "true" : "false") );
-}
-/*==========================================================*/
-void DensityBCAdapter::update( const D3Q27Interactor* const& interactor, const double& time ) 
-{
-   this->init(interactor,time);
-}
-/*==========================================================*/
-void DensityBCAdapter::adaptBCForDirection( const D3Q27Interactor& interactor, SPtr<BoundaryConditions> bc, const double& worldX1, const double& worldX2, const double& worldX3, const double& q, const int& fdirection, const double& time )
-{
-   bc->setDensityBoundaryFlag(D3Q27System::INVDIR[fdirection],secondaryBcOption);
-   bc->setQ((float)q,fdirection);
-}
-/*==========================================================*/
-void DensityBCAdapter::adaptBC( const D3Q27Interactor& interactor, SPtr<BoundaryConditions> bc, const double& worldX1, const double& worldX2, const double& worldX3, const double& time )
-{
-   this->setNodeDensity(interactor,bc,worldX1,worldX2,worldX3,time);
-   bc->setBcAlgorithmType(algorithmType);
-}
-/*==========================================================*/
-void DensityBCAdapter::setNodeDensity( const D3Q27Interactor& interactor, SPtr<BoundaryConditions> bc, const double& worldX1, const double& worldX2, const double& worldX3, const double& timestep) 
-{
-   //Geschwindigkeiten setzen
-   try
-   {
-      //PunktKoordinaten bestimmen
-      this->x1 = worldX1;
-      this->x2 = worldX2;
-      this->x3 = worldX3;
-      this->timeStep = timestep;
-
-      if(tmpDensityFunction) bc->setBoundaryDensity((float)tmpDensityFunction->Eval());  
-   }
-   catch(mu::Parser::exception_type& e){ stringstream error; error<<"mu::parser exception occurs, message("<<e.GetMsg()<<"), formula("<<e.GetExpr()+"), token("+e.GetToken()<<")"
-                                          <<", pos("<<e.GetPos()<<"), error code("<<e.GetCode(); throw UbException(error.str()); }
-   catch(...)                          { throw UbException(UB_EXARGS,"unknown exception" ); }
-}
-/*==========================================================*/
-double DensityBCAdapter::getDensity(const double& x1, const double& x2, const double& x3, const double& timeStep)
-{
-   this->x1 = x1;
-   this->x2 = x2;
-   this->x3 = x3;
-   this->timeStep = timeStep;
-
-   if(!tmpDensityFunction) return 0.0;
-
-   return tmpDensityFunction->Eval();  
-}
-/*==========================================================*/
-string DensityBCAdapter::toString()
-{
-   stringstream info;
-   info<<"D3Q27DensityBCAdapter:\n";
-   info<<" #dens-functions = "<<(int)densBCs.size()<<endl;
-   info<<" protected variables: x1, x2, x3, t"<<endl;
-
-   for(size_t i=0; i<densBCs.size(); ++i)
-   {
-      info<<"\n   dens-function nr."<<i<<":"<<endl;
-      info<<densBCs[i].toString()<<endl;
-   }
-   return info.str();
-}
+#include "DensityBCAdapter.h"
+#include "basics/utilities/UbLogger.h"
+#include "basics/utilities/UbInfinity.h"
+
+using namespace std;
+/*==========================================================*/
+DensityBCAdapter::DensityBCAdapter(const double& dens, const double& startTime, const double& endTime )
+{
+   this->densBCs.push_back( BCFunction(dens,startTime,endTime) );
+   this->init();
+}
+/*==========================================================*/
+DensityBCAdapter::DensityBCAdapter(const BCFunction& densBC )
+{
+   this->densBCs.push_back(densBC);
+   this->init();
+}
+/*==========================================================*/
+DensityBCAdapter::DensityBCAdapter(const std::vector< BCFunction >& densBCs)
+{
+   this->densBCs = densBCs;
+   this->init();
+}
+/*==========================================================*/
+DensityBCAdapter::DensityBCAdapter(const mu::Parser& function, const double& startTime, const double& endTime )
+{
+   this->densBCs.push_back(BCFunction(function,startTime,endTime));
+   this->init();
+}
+/*==========================================================*/
+void DensityBCAdapter::init()
+{
+   this->timeStep = 0.0;
+
+   this->x1 = 0.0;
+   this->x2 = 0.0;
+   this->x3 = 0.0;
+
+   this->tmpDensityFunction = NULL;
+
+   try //initilialization and validation of functions
+   {
+      for(size_t pos=0; pos<densBCs.size(); ++pos)
+      {
+         if( !(    UbMath::equal( BCFunction::INFCONST, densBCs[pos].getEndTime() )
+                && UbMath::greaterEqual( this->timeStep,  densBCs[pos].getStartTime()  ) ) )
+         { 
+            this->setTimeDependent();
+         }
+
+         densBCs[pos].getFunction().DefineVar("t" , &this->timeStep);
+         densBCs[pos].getFunction().DefineVar("x1", &this->x1      );
+         densBCs[pos].getFunction().DefineVar("x2", &this->x2      );
+         densBCs[pos].getFunction().DefineVar("x3", &this->x3      );
+
+         densBCs[pos].getFunction().Eval(); //<-- validation
+      }
+   }
+   catch(mu::Parser::exception_type& e){ stringstream error; error<<"mu::parser exception occurs, message("<<e.GetMsg()<<"), formula("<<e.GetExpr()+"), token("+e.GetToken()<<")"
+                                         <<", pos("<<e.GetPos()<<"), error code("<<e.GetCode(); throw UbException(error.str()); }
+   catch(...)                          { throw UbException(UB_EXARGS,"unknown exception" );                       }
+}
+/*==========================================================*/
+void DensityBCAdapter::init(const D3Q27Interactor* const& interactor, const double& time)
+{
+   this->timeStep           = time;
+   this->tmpDensityFunction = NULL;
+   double maxEndtime        = -Ub::inf;
+
+   //aktuelle Densityfunction bestimmen
+   for(size_t pos=0; pos<densBCs.size(); ++pos)
+   {
+      if( UbMath::equal(densBCs[pos].getEndTime(),BCFunction::INFTIMEDEPENDENT)) maxEndtime=Ub::inf;
+      maxEndtime = UbMath::max(maxEndtime,densBCs[pos].getStartTime(),densBCs[pos].getEndTime()); //startTime abfragen, da  INFCONST=-10
+
+      if( UbMath::greaterEqual(this->timeStep,densBCs[pos].getStartTime()) ) 
+      {
+         if(   UbMath::lessEqual(this->timeStep,densBCs[pos].getEndTime())
+            || UbMath::equal(densBCs[pos].getEndTime(),(double)BCFunction::INFCONST)
+            || UbMath::equal(densBCs[pos].getEndTime(),(double)BCFunction::INFTIMEDEPENDENT) )
+         {
+            tmpDensityFunction = &densBCs[pos].getFunction();
+            break;
+         }
+      }
+   }
+
+   //wenn funktionen zweitlich konstant sind und bis t=unendlich gelten
+   //kann man zeitabhaengigkeit deaktivieren
+   if( UbMath::greaterEqual(time,maxEndtime) ) this->unsetTimeDependent();
+
+   UBLOG(logDEBUG4,"D3Q27DensityBCAdapter::init(time="<<time<<") "
+                    <<", rho= \""<<(tmpDensityFunction ? tmpDensityFunction->GetExpr() : "-")
+                    <<"\", timedependant="<<(this->isTimeDependent() ? "true" : "false") );
+}
+/*==========================================================*/
+void DensityBCAdapter::update( const D3Q27Interactor* const& interactor, const double& time ) 
+{
+   this->init(interactor,time);
+}
+/*==========================================================*/
+void DensityBCAdapter::adaptBCForDirection( const D3Q27Interactor& interactor, SPtr<BoundaryConditions> bc, const double& worldX1, const double& worldX2, const double& worldX3, const double& q, const int& fdirection, const double& time )
+{
+   bc->setDensityBoundaryFlag(D3Q27System::INVDIR[fdirection],secondaryBcOption);
+   bc->setQ((float)q,fdirection);
+}
+/*==========================================================*/
+void DensityBCAdapter::adaptBC( const D3Q27Interactor& interactor, SPtr<BoundaryConditions> bc, const double& worldX1, const double& worldX2, const double& worldX3, const double& time )
+{
+   this->setNodeDensity(interactor,bc,worldX1,worldX2,worldX3,time);
+   bc->setBcAlgorithmType(algorithmType);
+}
+/*==========================================================*/
+void DensityBCAdapter::setNodeDensity( const D3Q27Interactor& interactor, SPtr<BoundaryConditions> bc, const double& worldX1, const double& worldX2, const double& worldX3, const double& timestep) 
+{
+   //Geschwindigkeiten setzen
+   try
+   {
+      //PunktKoordinaten bestimmen
+      this->x1 = worldX1;
+      this->x2 = worldX2;
+      this->x3 = worldX3;
+      this->timeStep = timestep;
+
+      if(tmpDensityFunction) bc->setBoundaryDensity((float)tmpDensityFunction->Eval());  
+   }
+   catch(mu::Parser::exception_type& e){ stringstream error; error<<"mu::parser exception occurs, message("<<e.GetMsg()<<"), formula("<<e.GetExpr()+"), token("+e.GetToken()<<")"
+                                          <<", pos("<<e.GetPos()<<"), error code("<<e.GetCode(); throw UbException(error.str()); }
+   catch(...)                          { throw UbException(UB_EXARGS,"unknown exception" ); }
+}
+/*==========================================================*/
+double DensityBCAdapter::getDensity(const double& x1, const double& x2, const double& x3, const double& timeStep)
+{
+   this->x1 = x1;
+   this->x2 = x2;
+   this->x3 = x3;
+   this->timeStep = timeStep;
+
+   if(!tmpDensityFunction) return 0.0;
+
+   return tmpDensityFunction->Eval();  
+}
+/*==========================================================*/
+string DensityBCAdapter::toString()
+{
+   stringstream info;
+   info<<"D3Q27DensityBCAdapter:\n";
+   info<<" #dens-functions = "<<(int)densBCs.size()<<endl;
+   info<<" protected variables: x1, x2, x3, t"<<endl;
+
+   for(size_t i=0; i<densBCs.size(); ++i)
+   {
+      info<<"\n   dens-function nr."<<i<<":"<<endl;
+      info<<densBCs[i].toString()<<endl;
+   }
+   return info.str();
+}
diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/DensityBCAdapter.h b/src/cpu/VirtualFluidsCore/BoundaryConditions/DensityBCAdapter.h
index 64caced01d891d6b41241beec8a6caf0497b8dbc..0dce4863e94f53e7086f331dca85a985c426b323 100644
--- a/src/cpu/VirtualFluidsCore/BoundaryConditions/DensityBCAdapter.h
+++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/DensityBCAdapter.h
@@ -1,74 +1,74 @@
-#ifndef DensityBCAdapter_H
-#define DensityBCAdapter_H
-        
-#include <iostream>
-#include <string>
-#include <sstream>
-#include <vector>
-
-#include "basics/utilities/UbMath.h"
-#include "basics/utilities/UbTuple.h"
-
-#include "BCAdapter.h"
-#include "BCFunction.h"
-
-//*  DensityBCAdapter                                                            */
-//*                                                                         */
-//**
-//<BR><BR>
-//@author <A HREF="mailto:muffmolch@gmx.de">S. Freudiger</A>
-//@version 1.0 - 06.09.06
-//*/ 
-//
-//*
-//usage: ...
-//*/
-
-
-class DensityBCAdapter : public BCAdapter
-{
-public:
-   //constructors
-   DensityBCAdapter() { this->init(); }
-   DensityBCAdapter(const double& dens, const double& startTime=0.0, const double& endTime = BCFunction::INFCONST );
-   DensityBCAdapter(const BCFunction& densBC );
-   DensityBCAdapter(const std::vector< BCFunction >& densBCs);
-   DensityBCAdapter(const mu::Parser& function, const double& startTime=0.0, const double& endTime = BCFunction::INFCONST  );
-
-   //------------- implements D3Q27BoundaryConditionAdapter ----- start
-   std::string toString();
-
-   void init(const D3Q27Interactor* const& interactor, const double& time=0);
-   void update(const D3Q27Interactor* const& interactor, const double& time=0);
-
-   void adaptBCForDirection( const D3Q27Interactor& interactor, SPtr<BoundaryConditions> bc, const double& worldX1, const double& worldX2, const double& worldX3, const double& q, const int& fdirection, const double& time=0 );
-   void adaptBC( const D3Q27Interactor& interactor, SPtr<BoundaryConditions> bc, const double& worldX1, const double& worldX2, const double& worldX3, const double& time=0 );
-
-   double getDensity(const double& x1, const double& x2, const double& x3, const double& timeStep);
-
-   //------------- implements D3Q27BoundaryConditionAdapter ----- end
-
-
-protected:
-   void init();
-   
-   //time dependency wird automatisch ueber D3Q27BCFunction Intervalle ermittelt!
-   void setTimeDependent()   { (this->type |=   TIMEDEPENDENT);}
-   void unsetTimeDependent() { (this->type &=  ~TIMEDEPENDENT);}
-   
-   void clear() { densBCs.clear(); }
-   void setNodeDensity(const D3Q27Interactor& interactor, SPtr<BoundaryConditions> bc, const double& worldX1, const double& worldX2, const double& worldX3, const double& timestep);
-
-private:
-   mu::value_type x1, x2, x3; //brauch man nicht serialisieren!
-   mu::value_type timeStep;   //brauch man nicht serialisieren!
-
-   mu::Parser* tmpDensityFunction; //brauch man nicht serialisieren!
-   
-   std::vector<BCFunction> densBCs;
-
-private:
-
-};
-
-#endif 
+#ifndef DensityBCAdapter_H
+#define DensityBCAdapter_H
+        
+#include <iostream>
+#include <string>
+#include <sstream>
+#include <vector>
+
+#include "basics/utilities/UbMath.h"
+#include "basics/utilities/UbTuple.h"
+
+#include "BCAdapter.h"
+#include "BCFunction.h"
+
+//*  DensityBCAdapter                                                            */
+//*                                                                         */
+//**
+//<BR><BR>
+//@author <A HREF="mailto:muffmolch@gmx.de">S. Freudiger</A>
+//@version 1.0 - 06.09.06
+//*/ 
+//
+//*
+//usage: ...
+//*/
+
+
+class DensityBCAdapter : public BCAdapter
+{
+public:
+   //constructors
+   DensityBCAdapter() { this->init(); }
+   DensityBCAdapter(const double& dens, const double& startTime=0.0, const double& endTime = BCFunction::INFCONST );
+   DensityBCAdapter(const BCFunction& densBC );
+   DensityBCAdapter(const std::vector< BCFunction >& densBCs);
+   DensityBCAdapter(const mu::Parser& function, const double& startTime=0.0, const double& endTime = BCFunction::INFCONST  );
+
+   //------------- implements D3Q27BoundaryConditionAdapter ----- start
+   std::string toString();
+
+   void init(const D3Q27Interactor* const& interactor, const double& time=0);
+   void update(const D3Q27Interactor* const& interactor, const double& time=0);
+
+   void adaptBCForDirection( const D3Q27Interactor& interactor, SPtr<BoundaryConditions> bc, const double& worldX1, const double& worldX2, const double& worldX3, const double& q, const int& fdirection, const double& time=0 );
+   void adaptBC( const D3Q27Interactor& interactor, SPtr<BoundaryConditions> bc, const double& worldX1, const double& worldX2, const double& worldX3, const double& time=0 );
+
+   double getDensity(const double& x1, const double& x2, const double& x3, const double& timeStep);
+
+   //------------- implements D3Q27BoundaryConditionAdapter ----- end
+
+
+protected:
+   void init();
+   
+   //time dependency wird automatisch ueber D3Q27BCFunction Intervalle ermittelt!
+   void setTimeDependent()   { (this->type |=   TIMEDEPENDENT);}
+   void unsetTimeDependent() { (this->type &=  ~TIMEDEPENDENT);}
+   
+   void clear() { densBCs.clear(); }
+   void setNodeDensity(const D3Q27Interactor& interactor, SPtr<BoundaryConditions> bc, const double& worldX1, const double& worldX2, const double& worldX3, const double& timestep);
+
+private:
+   mu::value_type x1, x2, x3; //brauch man nicht serialisieren!
+   mu::value_type timeStep;   //brauch man nicht serialisieren!
+
+   mu::Parser* tmpDensityFunction; //brauch man nicht serialisieren!
+   
+   std::vector<BCFunction> densBCs;
+
+private:
+
+};
+
+#endif 
diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/NoSlipBCAdapter.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/NoSlipBCAdapter.cpp
index a69f38d0dcfa5f35b8f996254a8724b65294be16..335583be25941634504a243856b10231fa07f633 100644
--- a/src/cpu/VirtualFluidsCore/BoundaryConditions/NoSlipBCAdapter.cpp
+++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/NoSlipBCAdapter.cpp
@@ -1,33 +1,33 @@
-//=======================================================================================
-// ____          ____    __    ______     __________   __      __       __        __         
-// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
-//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
-//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
-//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
-//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
-//      \    \  |    |   ________________________________________________________________    
-//       \    \ |    |  |  ______________________________________________________________|   
-//        \    \|    |  |  |         __          __     __     __     ______      _______    
-//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
-//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
-//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
-//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
-//
-//  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 NoSlipBCAdapter.cpp
-//! \ingroup BoundarConditions
-//! \author Sören Freudiger
-//=======================================================================================
-#include "NoSlipBCAdapter.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 NoSlipBCAdapter.cpp
+//! \ingroup BoundarConditions
+//! \author Sören Freudiger
+//=======================================================================================
+#include "NoSlipBCAdapter.h"
diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/NoSlipBCAdapter.h b/src/cpu/VirtualFluidsCore/BoundaryConditions/NoSlipBCAdapter.h
index accf430cae4d798119afb67ca7d9ea731d082b49..34ea8751f4bf60966527ec82f77a2e75fe945c01 100644
--- a/src/cpu/VirtualFluidsCore/BoundaryConditions/NoSlipBCAdapter.h
+++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/NoSlipBCAdapter.h
@@ -1,68 +1,68 @@
-//=======================================================================================
-// ____          ____    __    ______     __________   __      __       __        __         
-// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
-//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
-//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
-//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
-//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
-//      \    \  |    |   ________________________________________________________________    
-//       \    \ |    |  |  ______________________________________________________________|   
-//        \    \|    |  |  |         __          __     __     __     ______      _______    
-//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
-//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
-//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
-//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
-//
-//  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 NoSlipBCAdapter.cpp
-//! \ingroup BoundarConditions
-//! \author Sören Freudiger
-//=======================================================================================
-
-#ifndef NoSlipBCAdapter_H
-#define NoSlipBCAdapter_H
-
-#include "BCAdapter.h"
-
-//! A class provides an interface for no-slip boundary condition in grid generator
-class NoSlipBCAdapter : public BCAdapter
-{
-public:
-   NoSlipBCAdapter()
-    : BCAdapter()
-   {
-   }
-   NoSlipBCAdapter(const short& secondaryBcOption)
-      : BCAdapter(secondaryBcOption)
-   {
-   }
-
-   void init(const D3Q27Interactor* const& interactor, const double& time=0) {}
-   void update(const D3Q27Interactor* const& interactor, const double& time=0) {}
-
-   void adaptBCForDirection( const D3Q27Interactor& interactor, SPtr<BoundaryConditions> bc, const double& worldX1, const double& worldX2, const double& worldX3, const double& q, const int& fdirection, const double& time=0 )
-   {
-      bc->setNoSlipBoundaryFlag(D3Q27System::INVDIR[fdirection],secondaryBcOption);
-      bc->setQ((float)q,fdirection);
-   }
-   void adaptBC( const D3Q27Interactor& interactor, SPtr<BoundaryConditions> bc, const double& worldX1, const double& worldX2, const double& worldX3, const double& time=0 ) 
-   {
-      bc->setBcAlgorithmType(algorithmType);
-   }
-
-private:
-
-};
-#endif //NoSlipBCAdapter_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 NoSlipBCAdapter.cpp
+//! \ingroup BoundarConditions
+//! \author Sören Freudiger
+//=======================================================================================
+
+#ifndef NoSlipBCAdapter_H
+#define NoSlipBCAdapter_H
+
+#include "BCAdapter.h"
+
+//! A class provides an interface for no-slip boundary condition in grid generator
+class NoSlipBCAdapter : public BCAdapter
+{
+public:
+   NoSlipBCAdapter()
+    : BCAdapter()
+   {
+   }
+   NoSlipBCAdapter(const short& secondaryBcOption)
+      : BCAdapter(secondaryBcOption)
+   {
+   }
+
+   void init(const D3Q27Interactor* const& interactor, const double& time=0) {}
+   void update(const D3Q27Interactor* const& interactor, const double& time=0) {}
+
+   void adaptBCForDirection( const D3Q27Interactor& interactor, SPtr<BoundaryConditions> bc, const double& worldX1, const double& worldX2, const double& worldX3, const double& q, const int& fdirection, const double& time=0 )
+   {
+      bc->setNoSlipBoundaryFlag(D3Q27System::INVDIR[fdirection],secondaryBcOption);
+      bc->setQ((float)q,fdirection);
+   }
+   void adaptBC( const D3Q27Interactor& interactor, SPtr<BoundaryConditions> bc, const double& worldX1, const double& worldX2, const double& worldX3, const double& time=0 ) 
+   {
+      bc->setBcAlgorithmType(algorithmType);
+   }
+
+private:
+
+};
+#endif //NoSlipBCAdapter_H
diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/SlipBCAdapter.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/SlipBCAdapter.cpp
index 2dbfba24283d2319a2163bb0f5afe9aa1264c93f..53e462f67822b82f8a303b65ed54f24d1715974e 100644
--- a/src/cpu/VirtualFluidsCore/BoundaryConditions/SlipBCAdapter.cpp
+++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/SlipBCAdapter.cpp
@@ -1,35 +1,35 @@
-#include "SlipBCAdapter.h"
-#include "D3Q27System.h"
-#include "D3Q27Interactor.h"
-#include "geometry3d/GbCuboid3D.h"
-
-
-//*==========================================================*/
-//ObObject* D3Q27SlipBCAdapterCreator::createObObject()
-//{
-//   return new D3Q27SlipBCAdapter; 
-//}
-//*==========================================================*/
-//ObObjectCreator* D3Q27SlipBCAdapter::getCreator()
-//{
-//   return D3Q27SlipBCAdapterCreator::getInstance();
-//}
-//*==========================================================*/
-void SlipBCAdapter::adaptBC(const D3Q27Interactor& interactor, SPtr<BoundaryConditions> bc, const double& worldX1, const double& worldX2, const double& worldX3, const double& time)
-{
-   //////////////////////////////////////////////////////////////////////////
-   //>>> nur workaround! -> Hendrick nach normalen berechnung aus qs fragen
-   
-   GbCuboid3DPtr geo = dynamicPointerCast<GbCuboid3D>(interactor.getGbObject3D());
-   if(!geo) throw UbException(UB_EXARGS,"derzeit nur fuer Cubes valide");
-
-   if     ( bc->hasSlipBoundaryFlag(D3Q27System::E) ) bc->setNormalVector( 1.0, 0.0, 0.0);  
-   else if( bc->hasSlipBoundaryFlag(D3Q27System::W) ) bc->setNormalVector(-1.0, 0.0, 0.0);  
-   else if( bc->hasSlipBoundaryFlag(D3Q27System::N) ) bc->setNormalVector( 0.0, 1.0, 0.0);  
-   else if( bc->hasSlipBoundaryFlag(D3Q27System::S) ) bc->setNormalVector( 0.0,-1.0, 0.0);  
-   else if( bc->hasSlipBoundaryFlag(D3Q27System::T) ) bc->setNormalVector( 0.0, 0.0, 1.0);  
-   else if( bc->hasSlipBoundaryFlag(D3Q27System::B) ) bc->setNormalVector( 0.0, 0.0,-1.0);  
-
-   bc->setBcAlgorithmType(algorithmType);
-}
-
+#include "SlipBCAdapter.h"
+#include "D3Q27System.h"
+#include "D3Q27Interactor.h"
+#include "geometry3d/GbCuboid3D.h"
+
+
+//*==========================================================*/
+//ObObject* D3Q27SlipBCAdapterCreator::createObObject()
+//{
+//   return new D3Q27SlipBCAdapter; 
+//}
+//*==========================================================*/
+//ObObjectCreator* D3Q27SlipBCAdapter::getCreator()
+//{
+//   return D3Q27SlipBCAdapterCreator::getInstance();
+//}
+//*==========================================================*/
+void SlipBCAdapter::adaptBC(const D3Q27Interactor& interactor, SPtr<BoundaryConditions> bc, const double& worldX1, const double& worldX2, const double& worldX3, const double& time)
+{
+   //////////////////////////////////////////////////////////////////////////
+   //>>> nur workaround! -> Hendrick nach normalen berechnung aus qs fragen
+   
+   GbCuboid3DPtr geo = dynamicPointerCast<GbCuboid3D>(interactor.getGbObject3D());
+   if(!geo) throw UbException(UB_EXARGS,"derzeit nur fuer Cubes valide");
+
+   if     ( bc->hasSlipBoundaryFlag(D3Q27System::E) ) bc->setNormalVector( 1.0, 0.0, 0.0);  
+   else if( bc->hasSlipBoundaryFlag(D3Q27System::W) ) bc->setNormalVector(-1.0, 0.0, 0.0);  
+   else if( bc->hasSlipBoundaryFlag(D3Q27System::N) ) bc->setNormalVector( 0.0, 1.0, 0.0);  
+   else if( bc->hasSlipBoundaryFlag(D3Q27System::S) ) bc->setNormalVector( 0.0,-1.0, 0.0);  
+   else if( bc->hasSlipBoundaryFlag(D3Q27System::T) ) bc->setNormalVector( 0.0, 0.0, 1.0);  
+   else if( bc->hasSlipBoundaryFlag(D3Q27System::B) ) bc->setNormalVector( 0.0, 0.0,-1.0);  
+
+   bc->setBcAlgorithmType(algorithmType);
+}
+
diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/SlipBCAdapter.h b/src/cpu/VirtualFluidsCore/BoundaryConditions/SlipBCAdapter.h
index 462cf564a2995cbdc8fa8b0e0ab96a24ad1c16ea..2112e8e445d47dfac60fb9d2f4458d35e14d56ca 100644
--- a/src/cpu/VirtualFluidsCore/BoundaryConditions/SlipBCAdapter.h
+++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/SlipBCAdapter.h
@@ -1,88 +1,88 @@
-//  _    ___      __              __________      _     __
-// | |  / (_)____/ /___  ______ _/ / ____/ /_  __(_)___/ /____
-// | | / / / ___/ __/ / / / __ `/ / /_  / / / / / / __  / ___/
-// | |/ / / /  / /_/ /_/ / /_/ / / __/ / / /_/ / / /_/ (__  )
-// |___/_/_/   \__/\__,_/\__,_/_/_/   /_/\__,_/_/\__,_/____/
-//
-#ifndef SlipBCAdapter_H
-#define SlipBCAdapter_H
-
-#ifdef CAB_RCF
-   #include <3rdParty/rcf/RcfSerializationIncludes.h>
-#endif
-
-#include "BCAdapter.h"
-
-
-/*=======================================================*/
-//D3Q27SlipBCAdapterCreator
-//class D3Q27SlipBCAdapterCreator : public ObObjectCreator
-//{
-//public: 
-//   static D3Q27SlipBCAdapterCreator* getInstance()
-//   {
-//      static D3Q27SlipBCAdapterCreator instance;
-//      return &instance;
-//   }
-//   
-//   ObObject* createObObject();  
-//
-//   std::string getTypeID() { return "D3Q27SlipBCAdapter";}        
-//   std::string toString()  { return "D3Q27SlipBCAdapterCreator"; }
-//
-//private:
-//   D3Q27SlipBCAdapterCreator( const D3Q27SlipBCAdapterCreator& );                  //no copy allowed 
-//   const D3Q27SlipBCAdapterCreator& operator=( const D3Q27SlipBCAdapterCreator& ); //no copy allowed
-//   D3Q27SlipBCAdapterCreator() : ObObjectCreator() {}
-//};
-//
-//#ifndef SWIG
-//UB_AUTO_RUN_NAMED( D3Q27BCAdapterFactory::getInstance()->addObObjectCreator(D3Q27SlipBCAdapterCreator::getInstance()), CAB_D3Q27SlipBCAdapterCreator);
-//#endif
-
-/*=========================================================================*/
-/*  D3Q27SlipBCAdapter                                                     */
-/*                                                                         */
-/**
-<BR><BR>
-@author <A HREF="mailto:muffmolch@gmx.de">S. Freudiger</A>
-@version 1.0 - 06.09.06
-*/ 
-
-/*
-usage: ...
-*/
-
-class SlipBCAdapter : public BCAdapter
-{
-public:
-   SlipBCAdapter() 
-      : BCAdapter()
-   {
-   }
-   SlipBCAdapter(const short& secondaryBcOption)
-      : BCAdapter(secondaryBcOption)
-   {
-   }
-
-   //------------- implements D3Q27BoundaryConditionAdapter ----- start
-
-   void init(const D3Q27Interactor* const& interactor, const double& timestep=0) {}
-   void update(const D3Q27Interactor* const& interactor, const double& timestep=0) {}
-
-   void adaptBCForDirection( const D3Q27Interactor& interactor, SPtr<BoundaryConditions> bc, const double& worldX1, const double& worldX2, const double& worldX3, const double& q, const int& fdirection, const double& time=0 )
-   {
-      bc->setSlipBoundaryFlag(D3Q27System::INVDIR[fdirection],secondaryBcOption);
-      bc->setQ((float)q,fdirection);
-   }
-   void adaptBC(const D3Q27Interactor& interactor, SPtr<BoundaryConditions> bc, const double& worldX1, const double& worldX2, const double& worldX3, const double& time=0);
-   
-   //------------- implements D3Q27BoundaryConditionAdapter ----- end
-
-private:
-
-
-};
-
-#endif
-
+//  _    ___      __              __________      _     __
+// | |  / (_)____/ /___  ______ _/ / ____/ /_  __(_)___/ /____
+// | | / / / ___/ __/ / / / __ `/ / /_  / / / / / / __  / ___/
+// | |/ / / /  / /_/ /_/ / /_/ / / __/ / / /_/ / / /_/ (__  )
+// |___/_/_/   \__/\__,_/\__,_/_/_/   /_/\__,_/_/\__,_/____/
+//
+#ifndef SlipBCAdapter_H
+#define SlipBCAdapter_H
+
+#ifdef CAB_RCF
+   #include <3rdParty/rcf/RcfSerializationIncludes.h>
+#endif
+
+#include "BCAdapter.h"
+
+
+/*=======================================================*/
+//D3Q27SlipBCAdapterCreator
+//class D3Q27SlipBCAdapterCreator : public ObObjectCreator
+//{
+//public: 
+//   static D3Q27SlipBCAdapterCreator* getInstance()
+//   {
+//      static D3Q27SlipBCAdapterCreator instance;
+//      return &instance;
+//   }
+//   
+//   ObObject* createObObject();  
+//
+//   std::string getTypeID() { return "D3Q27SlipBCAdapter";}        
+//   std::string toString()  { return "D3Q27SlipBCAdapterCreator"; }
+//
+//private:
+//   D3Q27SlipBCAdapterCreator( const D3Q27SlipBCAdapterCreator& );                  //no copy allowed 
+//   const D3Q27SlipBCAdapterCreator& operator=( const D3Q27SlipBCAdapterCreator& ); //no copy allowed
+//   D3Q27SlipBCAdapterCreator() : ObObjectCreator() {}
+//};
+//
+//#ifndef SWIG
+//UB_AUTO_RUN_NAMED( D3Q27BCAdapterFactory::getInstance()->addObObjectCreator(D3Q27SlipBCAdapterCreator::getInstance()), CAB_D3Q27SlipBCAdapterCreator);
+//#endif
+
+/*=========================================================================*/
+/*  D3Q27SlipBCAdapter                                                     */
+/*                                                                         */
+/**
+<BR><BR>
+@author <A HREF="mailto:muffmolch@gmx.de">S. Freudiger</A>
+@version 1.0 - 06.09.06
+*/ 
+
+/*
+usage: ...
+*/
+
+class SlipBCAdapter : public BCAdapter
+{
+public:
+   SlipBCAdapter() 
+      : BCAdapter()
+   {
+   }
+   SlipBCAdapter(const short& secondaryBcOption)
+      : BCAdapter(secondaryBcOption)
+   {
+   }
+
+   //------------- implements D3Q27BoundaryConditionAdapter ----- start
+
+   void init(const D3Q27Interactor* const& interactor, const double& timestep=0) {}
+   void update(const D3Q27Interactor* const& interactor, const double& timestep=0) {}
+
+   void adaptBCForDirection( const D3Q27Interactor& interactor, SPtr<BoundaryConditions> bc, const double& worldX1, const double& worldX2, const double& worldX3, const double& q, const int& fdirection, const double& time=0 )
+   {
+      bc->setSlipBoundaryFlag(D3Q27System::INVDIR[fdirection],secondaryBcOption);
+      bc->setQ((float)q,fdirection);
+   }
+   void adaptBC(const D3Q27Interactor& interactor, SPtr<BoundaryConditions> bc, const double& worldX1, const double& worldX2, const double& worldX3, const double& time=0);
+   
+   //------------- implements D3Q27BoundaryConditionAdapter ----- end
+
+private:
+
+
+};
+
+#endif
+
diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/ThinWallBCProcessor.h b/src/cpu/VirtualFluidsCore/BoundaryConditions/ThinWallBCProcessor.h
index 63ff19dee78b8457544e17f203a72b57e293ee39..a3e9915f29fa006e51c593052016fc698fbe1e2b 100644
--- a/src/cpu/VirtualFluidsCore/BoundaryConditions/ThinWallBCProcessor.h
+++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/ThinWallBCProcessor.h
@@ -1,23 +1,23 @@
-#ifndef ThinWallBCProcessor_H
-#define ThinWallBCProcessor_H
-
-#include <PointerDefinitions.h>
-
-#include "BCProcessor.h"
-
-class LBMKernel;
-
-class ThinWallBCProcessor : public BCProcessor
-{
-public:
-   ThinWallBCProcessor();
-   ThinWallBCProcessor(SPtr<LBMKernel> kernel);
-   ~ThinWallBCProcessor();
-   SPtr<BCProcessor> clone(SPtr<LBMKernel> kernel);
-   void applyPostCollisionBC();
-protected:
-private:
-
-};
-
-#endif
+#ifndef ThinWallBCProcessor_H
+#define ThinWallBCProcessor_H
+
+#include <PointerDefinitions.h>
+
+#include "BCProcessor.h"
+
+class LBMKernel;
+
+class ThinWallBCProcessor : public BCProcessor
+{
+public:
+   ThinWallBCProcessor();
+   ThinWallBCProcessor(SPtr<LBMKernel> kernel);
+   ~ThinWallBCProcessor();
+   SPtr<BCProcessor> clone(SPtr<LBMKernel> kernel);
+   void applyPostCollisionBC();
+protected:
+private:
+
+};
+
+#endif
diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityBCAdapter.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityBCAdapter.cpp
index 96dd5e78d294d720f63d03ee50768cdcbba12eb7..9284a71aee058c294abb9879710d673757c9fbd1 100644
--- a/src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityBCAdapter.cpp
+++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityBCAdapter.cpp
@@ -1,339 +1,339 @@
-//=======================================================================================
-// ____          ____    __    ______     __________   __      __       __        __         
-// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
-//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
-//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
-//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
-//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
-//      \    \  |    |   ________________________________________________________________    
-//       \    \ |    |  |  ______________________________________________________________|   
-//        \    \|    |  |  |         __          __     __     __     ______      _______    
-//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
-//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
-//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
-//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
-//
-//  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 VelocityBCAdapter.cpp
-//! \ingroup BoundarConditions
-//! \author Sören Freudiger
-//=======================================================================================
-
-#include "VelocityBCAdapter.h"
-#include "basics/utilities/UbLogger.h"
-#include "basics/utilities/UbMath.h"
-#include "basics/utilities/UbTuple.h"
-
-using namespace std;
-
-
-VelocityBCAdapter::VelocityBCAdapter(const bool& vx1, const bool& vx2, const bool& vx3, const BCFunction& velVxBC)
-{
-   if(vx1) this->vx1BCs.push_back(velVxBC);
-   if(vx2) this->vx2BCs.push_back(velVxBC);
-   if(vx3) this->vx3BCs.push_back(velVxBC);
-   this->init();
-}
-/*==========================================================*/
-VelocityBCAdapter::VelocityBCAdapter(const bool& vx1, const bool& vx2, const bool& vx3, const mu::Parser& function, const double& startTime, const double& endTime )
-{
-   if(vx1) this->vx1BCs.push_back(BCFunction(function,startTime,endTime));
-   if(vx2) this->vx2BCs.push_back(BCFunction(function,startTime,endTime));
-   if(vx3) this->vx3BCs.push_back(BCFunction(function,startTime,endTime));
-   this->init();
-}
-/*==========================================================*/
-VelocityBCAdapter::VelocityBCAdapter(const bool& vx1, const bool& vx2, const bool& vx3, const mu::Parser& function1, const mu::Parser& function2, const mu::Parser& function3, const double& startTime, const double& endTime )
-{
-   if(vx1) this->vx1BCs.push_back(BCFunction(function1,startTime,endTime));
-   if(vx2) this->vx2BCs.push_back(BCFunction(function2,startTime,endTime));
-   if(vx3) this->vx3BCs.push_back(BCFunction(function3,startTime,endTime));
-   this->init();
-}
-/*==========================================================*/
-VelocityBCAdapter::VelocityBCAdapter(const bool& vx1, const bool& vx2, const bool& vx3, const string& functionstring, const double& startTime, const double& endTime )
-{
-   if(vx1) this->vx1BCs.push_back(BCFunction(functionstring,startTime,endTime));
-   if(vx2) this->vx2BCs.push_back(BCFunction(functionstring,startTime,endTime));
-   if(vx3) this->vx3BCs.push_back(BCFunction(functionstring,startTime,endTime));
-   this->init();
-}
-/*==========================================================*/
-VelocityBCAdapter::VelocityBCAdapter(const BCFunction& velBC, bool x1Dir, bool x2Dir, bool x3Dir)
-{
-   if(x1Dir) this->vx1BCs.push_back(velBC);
-   if(x2Dir) this->vx2BCs.push_back(velBC);
-   if(x3Dir) this->vx3BCs.push_back(velBC);
-   this->init();
-}
-/*==========================================================*/
-VelocityBCAdapter::VelocityBCAdapter(const BCFunction& velVx1BC, const BCFunction& velVx2BC, const BCFunction& velVx3BC)
-{
-   if( velVx1BC.getEndTime()!=-Ub::inf ) this->vx1BCs.push_back(velVx1BC);
-   if( velVx2BC.getEndTime()!=-Ub::inf ) this->vx2BCs.push_back(velVx2BC);
-   if( velVx3BC.getEndTime()!=-Ub::inf ) this->vx3BCs.push_back(velVx3BC);
-   this->init();
-}
-/*==========================================================*/
-VelocityBCAdapter::VelocityBCAdapter(const vector< BCFunction >& velVx1BCs, const vector< BCFunction >& velVx2BCs, const vector< BCFunction >& velVx3BCs)
-{
-   this->vx1BCs = velVx1BCs;
-   this->vx2BCs = velVx2BCs;
-   this->vx3BCs = velVx3BCs;
-   this->init();
-}
-/*==========================================================*/
-VelocityBCAdapter::VelocityBCAdapter(const double& vx1, const double& vx1StartTime, const double& vx1EndTime,
-                                               const double& vx2, const double& vx2StartTime, const double& vx2EndTime,
-                                               const double& vx3, const double& vx3StartTime, const double& vx3EndTime )
-{
-   this->vx1BCs.push_back(BCFunction(vx1,vx1StartTime,vx1EndTime));
-   this->vx2BCs.push_back(BCFunction(vx2,vx2StartTime,vx2EndTime));
-   this->vx3BCs.push_back(BCFunction(vx3,vx3StartTime,vx3EndTime));
-   this->init();
-}
-/*==========================================================*/
-VelocityBCAdapter::VelocityBCAdapter(const string& vx1Function, const double& vx1StartTime, const double& vx1EndTime,
-                                               const string& vx2Function, const double& vx2StartTime, const double& vx2EndTime,
-                                               const string& vx3Function, const double& vx3StartTime, const double& vx3EndTime ) 
-{
-   if(vx1Function.size()) this->vx1BCs.push_back(BCFunction(vx1Function,vx1StartTime,vx1EndTime));
-   if(vx2Function.size()) this->vx2BCs.push_back(BCFunction(vx2Function,vx2StartTime,vx2EndTime));
-   if(vx3Function.size()) this->vx3BCs.push_back(BCFunction(vx3Function,vx3StartTime,vx3EndTime));
-   this->init();
-}
-/*==========================================================*/
-void VelocityBCAdapter::setNewVelocities(const double& vx1, const double& vx1StartTime, const double& vx1EndTime,
-                                              const double& vx2, const double& vx2StartTime, const double& vx2EndTime,
-                                              const double& vx3, const double& vx3StartTime, const double& vx3EndTime )
-{
-   this->clear();
-   this->vx1BCs.push_back(BCFunction(vx1,vx1StartTime,vx1EndTime));
-   this->vx2BCs.push_back(BCFunction(vx2,vx2StartTime,vx2EndTime));
-   this->vx3BCs.push_back(BCFunction(vx3,vx3StartTime,vx3EndTime));
-   this->init();
-}
-/*==========================================================*/
-void VelocityBCAdapter::init()
-{
-   this->unsetTimeDependent();
-   
-   this->timeStep = 0.0;
-
-   this->x1 = 0.0;
-   this->x2 = 0.0;
-   this->x3 = 0.0;
-
-   this->tmpVx1Function = NULL;
-   this->tmpVx2Function = NULL;
-   this->tmpVx3Function = NULL;
-
-   try //initilialization and validation of functions
-   {
-      this->init(vx1BCs);
-      this->init(vx2BCs);
-      this->init(vx3BCs);
-   }
-   catch(mu::Parser::exception_type& e){ stringstream error; error<<"mu::parser exception occurs, message("<<e.GetMsg()<<"), formula("<<e.GetExpr()+"), token("+e.GetToken()<<")"
-                                          <<", pos("<<e.GetPos()<<"), error code("<<e.GetCode(); throw UbException(error.str()); }
-   catch(...)                          { throw UbException(UB_EXARGS,"unknown exception" ); }
-}
-/*==========================================================*/
-void VelocityBCAdapter::init(std::vector<BCFunction>& vxBCs)
-{
-   for(size_t pos=0; pos<vxBCs.size(); ++pos)
-   {
-      if( !(    UbMath::equal( BCFunction::INFCONST, vxBCs[pos].getEndTime() )
-             && UbMath::greaterEqual( this->timeStep,  vxBCs[pos].getStartTime()  ) ) )
-      {
-         this->setTimeDependent();
-      }
-
-      vxBCs[pos].getFunction().DefineVar("t" , &this->timeStep);
-      vxBCs[pos].getFunction().DefineVar("x1", &this->x1      );
-      vxBCs[pos].getFunction().DefineVar("x2", &this->x2      );
-      vxBCs[pos].getFunction().DefineVar("x3", &this->x3      );
-
-      vxBCs[pos].getFunction().Eval(); //<-- validation
-   }
-}
-/*==========================================================*/
-void VelocityBCAdapter::init(const D3Q27Interactor* const& interactor, const double& time)
-{
-   this->timeStep       = time;
-   this->tmpVx1Function = this->tmpVx2Function = this->tmpVx3Function = NULL;
-
-   //aktuelle velocityfunction bestimmen
-   double maxEndtime = -Ub::inf;
-   
-   for(size_t pos=0; pos<vx1BCs.size(); ++pos)
-   {
-      if( UbMath::equal(vx1BCs[pos].getEndTime(),BCFunction::INFTIMEDEPENDENT) ) maxEndtime=Ub::inf;
-      maxEndtime = UbMath::max(maxEndtime,vx1BCs[pos].getStartTime(),vx1BCs[pos].getEndTime()); //startTime abfragen, da  INFCONST=-10
-      
-      if( UbMath::greaterEqual(this->timeStep,vx1BCs[pos].getStartTime()) ) 
-      {
-          if(   UbMath::lessEqual( this->timeStep     , vx1BCs[pos].getEndTime()     )
-             || UbMath::equal(     vx1BCs[pos].getEndTime(), (double)BCFunction::INFCONST        )
-             || UbMath::equal(     vx1BCs[pos].getEndTime(), (double)BCFunction::INFTIMEDEPENDENT)  )
-         {
-            tmpVx1Function = &vx1BCs[pos].getFunction();
-            break;
-         }
-      }
-   }
-   for(size_t pos=0; pos<vx2BCs.size(); ++pos)
-   {
-      if( UbMath::equal(vx2BCs[pos].getEndTime(),BCFunction::INFTIMEDEPENDENT)) maxEndtime=Ub::inf;
-      maxEndtime = UbMath::max(maxEndtime,vx2BCs[pos].getStartTime(),vx2BCs[pos].getEndTime()); //startTime abfragen, da  INFCONST=-10
-
-      if( UbMath::greaterEqual(this->timeStep,vx2BCs[pos].getStartTime()) ) 
-      {
-         if(   UbMath::lessEqual( this->timeStep     , vx2BCs[pos].getEndTime()      )
-            || UbMath::equal(     vx2BCs[pos].getEndTime(), (double)BCFunction::INFCONST         )
-            || UbMath::equal(     vx2BCs[pos].getEndTime(), (double)BCFunction::INFTIMEDEPENDENT )  )
-         {
-            tmpVx2Function = &vx2BCs[pos].getFunction();
-            break;
-         }
-      }
-   }
-   for(size_t pos=0; pos<vx3BCs.size(); ++pos)
-   {
-      if( UbMath::equal(vx3BCs[pos].getEndTime(),BCFunction::INFTIMEDEPENDENT)) maxEndtime=Ub::inf;
-      maxEndtime = UbMath::max(maxEndtime,vx3BCs[pos].getStartTime(),vx3BCs[pos].getEndTime()); //startTime abfragen, da  INFCONST=-10
-
-      if( UbMath::greaterEqual(this->timeStep,vx3BCs[pos].getStartTime()) ) 
-      {
-         if(   UbMath::lessEqual( this->timeStep     , vx3BCs[pos].getEndTime()      )
-            || UbMath::equal(     vx3BCs[pos].getEndTime(), (double)BCFunction::INFCONST         )
-            || UbMath::equal(     vx3BCs[pos].getEndTime(), (double)BCFunction::INFTIMEDEPENDENT )  )
-         {
-            tmpVx3Function = &vx3BCs[pos].getFunction();
-            break;
-         }
-      }
-   }
-
-   if( UbMath::greaterEqual(time,maxEndtime) ) 
-   {
-      if( !this->isTimePeriodic() ) this->unsetTimeDependent();
-      else //bei peridoic die interavalle neu setzen:
-      {
-         if( UbMath::equal(maxEndtime,BCFunction::INFCONST) )
-            for(size_t pos=0; pos<vx1BCs.size(); ++pos)
-            {
-               vx1BCs[pos].setStartTime( vx1BCs[pos].getStartTime() + timeStep );
-               vx1BCs[pos].setEndTime( vx1BCs[pos].getEndTime() + timeStep );
-            }
-            if( UbMath::equal(maxEndtime,BCFunction::INFCONST) )
-            for(size_t pos=0; pos<vx2BCs.size(); ++pos)
-            {
-               vx2BCs[pos].setStartTime( vx2BCs[pos].getStartTime() + timeStep );
-               vx2BCs[pos].setEndTime( vx2BCs[pos].getEndTime() + timeStep );
-            }
-         if( UbMath::equal(maxEndtime,BCFunction::INFCONST) )
-            for(size_t pos=0; pos<vx3BCs.size(); ++pos)
-            {
-               vx3BCs[pos].setStartTime( vx3BCs[pos].getStartTime() + timeStep );
-               vx3BCs[pos].setEndTime( vx3BCs[pos].getEndTime() + timeStep );
-            }
-        this->init(interactor,time);
-      }
-   }
-
-   UBLOG(logDEBUG4,"D3Q27VelocityBCAdapter::init(time="<<time<<") "
-                   <<", vx1= \""<<(tmpVx1Function ? tmpVx1Function->GetExpr() : "-")<<"\""
-                   <<", vx2= \""<<(tmpVx2Function ? tmpVx2Function->GetExpr() : "-")<<"\""
-                   <<", vx3= \""<<(tmpVx3Function ? tmpVx3Function->GetExpr() : "-")<<"\""
-                   <<", timedependent="<<boolalpha<<this->isTimeDependent()   );
-}
-/*==========================================================*/
-void VelocityBCAdapter::update( const D3Q27Interactor* const& interactor, const double& time ) 
-{
-   this->init(interactor,time);
-}
-/*==========================================================*/
-void VelocityBCAdapter::adaptBCForDirection( const D3Q27Interactor& interactor, SPtr<BoundaryConditions> bc, const double& worldX1, const double& worldX2, const double& worldX3, const double& q, const int& fdirection, const double& time )
-{
-   bc->setVelocityBoundaryFlag(D3Q27System::INVDIR[fdirection],secondaryBcOption);
-   bc->setQ((float)q,fdirection);
-}
-/*==========================================================*/
-void VelocityBCAdapter::adaptBC( const D3Q27Interactor& interactor, SPtr<BoundaryConditions> bc, const double& worldX1, const double& worldX2, const double& worldX3, const double& time ) 
-{
-   this->setNodeVelocity(interactor,bc,worldX1,worldX2,worldX3,time);
-   bc->setBcAlgorithmType(algorithmType);
-}
-/*==========================================================*/
-void VelocityBCAdapter::setNodeVelocity( const D3Q27Interactor& interactor, SPtr<BoundaryConditions> bc, const double& worldX1, const double& worldX2, const double& worldX3, const double& timestep) 
-{
-   //Geschwindigkeiten setzen
-   try
-   {
-      //PunktKoordinaten bestimmen
-      this->x1 = worldX1;
-      this->x2 = worldX2;
-      this->x3 = worldX3;
-      this->timeStep = timestep;
-
-      if(tmpVx1Function) bc->setBoundaryVelocityX1((LBMReal)tmpVx1Function->Eval());  
-      if(tmpVx2Function) bc->setBoundaryVelocityX2((LBMReal)tmpVx2Function->Eval());
-      if(tmpVx3Function) bc->setBoundaryVelocityX3((LBMReal)tmpVx3Function->Eval());
-   }
-   catch(mu::Parser::exception_type& e){ stringstream error; error<<"mu::parser exception occurs, message("<<e.GetMsg()<<"), formula("<<e.GetExpr()+"), token("+e.GetToken()<<")"
-                                         <<", pos("<<e.GetPos()<<"), error code("<<e.GetCode(); throw UbException(error.str()); }
-   catch(...)                          { throw UbException(UB_EXARGS,"unknown exception" ); }
-}
-/*==========================================================*/
-UbTupleDouble3 VelocityBCAdapter::getVelocity(const double& x1, const double& x2, const double& x3, const double& timeStep) const
-{
-	double vx1 = 0.0;
-	double vx2 = 0.0;
-	double vx3 = 0.0;
-   this->x1 = x1;
-   this->x2 = x2;
-   this->x3 = x3;
-   this->timeStep = timeStep;
-	
-	if(tmpVx1Function) vx1 = tmpVx1Function->Eval();  
-   if(tmpVx2Function) vx2 = tmpVx2Function->Eval();
-   if(tmpVx3Function) vx3 = tmpVx3Function->Eval();
-    
-   return UbTupleDouble3(vx1,vx2,vx3);
-}
-/*==========================================================*/
-string VelocityBCAdapter::toString()
-{
-   stringstream info;
-   info<<"D3Q27VelocityBCAdapter:\n";
-   info<<" #vx1-functions = "<<(int)vx1BCs.size()<<endl;
-   info<<" #vx2-functions = "<<(int)vx2BCs.size()<<endl;
-   info<<" #vx3-functions = "<<(int)vx3BCs.size()<<endl;
-   info<<" protected variables: x1, x2, x3, t"<<endl;
-   
-   const vector<BCFunction>* bcvecs[3] = { &vx1BCs, &vx2BCs, &vx3BCs };
-   for(int i=0; i<3; i++)
-   {
-      for(size_t pos=0; pos<bcvecs[i]->size(); ++pos)
-      {
-         info<<"\n   vx"<<(i+1)<<"-function nr."<<pos<<":"<<endl;
-         info<<(*bcvecs[i])[pos]<<endl;
-      }
-   }
-   return info.str();
-}
-
-
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 VelocityBCAdapter.cpp
+//! \ingroup BoundarConditions
+//! \author Sören Freudiger
+//=======================================================================================
+
+#include "VelocityBCAdapter.h"
+#include "basics/utilities/UbLogger.h"
+#include "basics/utilities/UbMath.h"
+#include "basics/utilities/UbTuple.h"
+
+using namespace std;
+
+
+VelocityBCAdapter::VelocityBCAdapter(const bool& vx1, const bool& vx2, const bool& vx3, const BCFunction& velVxBC)
+{
+   if(vx1) this->vx1BCs.push_back(velVxBC);
+   if(vx2) this->vx2BCs.push_back(velVxBC);
+   if(vx3) this->vx3BCs.push_back(velVxBC);
+   this->init();
+}
+/*==========================================================*/
+VelocityBCAdapter::VelocityBCAdapter(const bool& vx1, const bool& vx2, const bool& vx3, const mu::Parser& function, const double& startTime, const double& endTime )
+{
+   if(vx1) this->vx1BCs.push_back(BCFunction(function,startTime,endTime));
+   if(vx2) this->vx2BCs.push_back(BCFunction(function,startTime,endTime));
+   if(vx3) this->vx3BCs.push_back(BCFunction(function,startTime,endTime));
+   this->init();
+}
+/*==========================================================*/
+VelocityBCAdapter::VelocityBCAdapter(const bool& vx1, const bool& vx2, const bool& vx3, const mu::Parser& function1, const mu::Parser& function2, const mu::Parser& function3, const double& startTime, const double& endTime )
+{
+   if(vx1) this->vx1BCs.push_back(BCFunction(function1,startTime,endTime));
+   if(vx2) this->vx2BCs.push_back(BCFunction(function2,startTime,endTime));
+   if(vx3) this->vx3BCs.push_back(BCFunction(function3,startTime,endTime));
+   this->init();
+}
+/*==========================================================*/
+VelocityBCAdapter::VelocityBCAdapter(const bool& vx1, const bool& vx2, const bool& vx3, const string& functionstring, const double& startTime, const double& endTime )
+{
+   if(vx1) this->vx1BCs.push_back(BCFunction(functionstring,startTime,endTime));
+   if(vx2) this->vx2BCs.push_back(BCFunction(functionstring,startTime,endTime));
+   if(vx3) this->vx3BCs.push_back(BCFunction(functionstring,startTime,endTime));
+   this->init();
+}
+/*==========================================================*/
+VelocityBCAdapter::VelocityBCAdapter(const BCFunction& velBC, bool x1Dir, bool x2Dir, bool x3Dir)
+{
+   if(x1Dir) this->vx1BCs.push_back(velBC);
+   if(x2Dir) this->vx2BCs.push_back(velBC);
+   if(x3Dir) this->vx3BCs.push_back(velBC);
+   this->init();
+}
+/*==========================================================*/
+VelocityBCAdapter::VelocityBCAdapter(const BCFunction& velVx1BC, const BCFunction& velVx2BC, const BCFunction& velVx3BC)
+{
+   if( velVx1BC.getEndTime()!=-Ub::inf ) this->vx1BCs.push_back(velVx1BC);
+   if( velVx2BC.getEndTime()!=-Ub::inf ) this->vx2BCs.push_back(velVx2BC);
+   if( velVx3BC.getEndTime()!=-Ub::inf ) this->vx3BCs.push_back(velVx3BC);
+   this->init();
+}
+/*==========================================================*/
+VelocityBCAdapter::VelocityBCAdapter(const vector< BCFunction >& velVx1BCs, const vector< BCFunction >& velVx2BCs, const vector< BCFunction >& velVx3BCs)
+{
+   this->vx1BCs = velVx1BCs;
+   this->vx2BCs = velVx2BCs;
+   this->vx3BCs = velVx3BCs;
+   this->init();
+}
+/*==========================================================*/
+VelocityBCAdapter::VelocityBCAdapter(const double& vx1, const double& vx1StartTime, const double& vx1EndTime,
+                                               const double& vx2, const double& vx2StartTime, const double& vx2EndTime,
+                                               const double& vx3, const double& vx3StartTime, const double& vx3EndTime )
+{
+   this->vx1BCs.push_back(BCFunction(vx1,vx1StartTime,vx1EndTime));
+   this->vx2BCs.push_back(BCFunction(vx2,vx2StartTime,vx2EndTime));
+   this->vx3BCs.push_back(BCFunction(vx3,vx3StartTime,vx3EndTime));
+   this->init();
+}
+/*==========================================================*/
+VelocityBCAdapter::VelocityBCAdapter(const string& vx1Function, const double& vx1StartTime, const double& vx1EndTime,
+                                               const string& vx2Function, const double& vx2StartTime, const double& vx2EndTime,
+                                               const string& vx3Function, const double& vx3StartTime, const double& vx3EndTime ) 
+{
+   if(vx1Function.size()) this->vx1BCs.push_back(BCFunction(vx1Function,vx1StartTime,vx1EndTime));
+   if(vx2Function.size()) this->vx2BCs.push_back(BCFunction(vx2Function,vx2StartTime,vx2EndTime));
+   if(vx3Function.size()) this->vx3BCs.push_back(BCFunction(vx3Function,vx3StartTime,vx3EndTime));
+   this->init();
+}
+/*==========================================================*/
+void VelocityBCAdapter::setNewVelocities(const double& vx1, const double& vx1StartTime, const double& vx1EndTime,
+                                              const double& vx2, const double& vx2StartTime, const double& vx2EndTime,
+                                              const double& vx3, const double& vx3StartTime, const double& vx3EndTime )
+{
+   this->clear();
+   this->vx1BCs.push_back(BCFunction(vx1,vx1StartTime,vx1EndTime));
+   this->vx2BCs.push_back(BCFunction(vx2,vx2StartTime,vx2EndTime));
+   this->vx3BCs.push_back(BCFunction(vx3,vx3StartTime,vx3EndTime));
+   this->init();
+}
+/*==========================================================*/
+void VelocityBCAdapter::init()
+{
+   this->unsetTimeDependent();
+   
+   this->timeStep = 0.0;
+
+   this->x1 = 0.0;
+   this->x2 = 0.0;
+   this->x3 = 0.0;
+
+   this->tmpVx1Function = NULL;
+   this->tmpVx2Function = NULL;
+   this->tmpVx3Function = NULL;
+
+   try //initilialization and validation of functions
+   {
+      this->init(vx1BCs);
+      this->init(vx2BCs);
+      this->init(vx3BCs);
+   }
+   catch(mu::Parser::exception_type& e){ stringstream error; error<<"mu::parser exception occurs, message("<<e.GetMsg()<<"), formula("<<e.GetExpr()+"), token("+e.GetToken()<<")"
+                                          <<", pos("<<e.GetPos()<<"), error code("<<e.GetCode(); throw UbException(error.str()); }
+   catch(...)                          { throw UbException(UB_EXARGS,"unknown exception" ); }
+}
+/*==========================================================*/
+void VelocityBCAdapter::init(std::vector<BCFunction>& vxBCs)
+{
+   for(size_t pos=0; pos<vxBCs.size(); ++pos)
+   {
+      if( !(    UbMath::equal( BCFunction::INFCONST, vxBCs[pos].getEndTime() )
+             && UbMath::greaterEqual( this->timeStep,  vxBCs[pos].getStartTime()  ) ) )
+      {
+         this->setTimeDependent();
+      }
+
+      vxBCs[pos].getFunction().DefineVar("t" , &this->timeStep);
+      vxBCs[pos].getFunction().DefineVar("x1", &this->x1      );
+      vxBCs[pos].getFunction().DefineVar("x2", &this->x2      );
+      vxBCs[pos].getFunction().DefineVar("x3", &this->x3      );
+
+      vxBCs[pos].getFunction().Eval(); //<-- validation
+   }
+}
+/*==========================================================*/
+void VelocityBCAdapter::init(const D3Q27Interactor* const& interactor, const double& time)
+{
+   this->timeStep       = time;
+   this->tmpVx1Function = this->tmpVx2Function = this->tmpVx3Function = NULL;
+
+   //aktuelle velocityfunction bestimmen
+   double maxEndtime = -Ub::inf;
+   
+   for(size_t pos=0; pos<vx1BCs.size(); ++pos)
+   {
+      if( UbMath::equal(vx1BCs[pos].getEndTime(),BCFunction::INFTIMEDEPENDENT) ) maxEndtime=Ub::inf;
+      maxEndtime = UbMath::max(maxEndtime,vx1BCs[pos].getStartTime(),vx1BCs[pos].getEndTime()); //startTime abfragen, da  INFCONST=-10
+      
+      if( UbMath::greaterEqual(this->timeStep,vx1BCs[pos].getStartTime()) ) 
+      {
+          if(   UbMath::lessEqual( this->timeStep     , vx1BCs[pos].getEndTime()     )
+             || UbMath::equal(     vx1BCs[pos].getEndTime(), (double)BCFunction::INFCONST        )
+             || UbMath::equal(     vx1BCs[pos].getEndTime(), (double)BCFunction::INFTIMEDEPENDENT)  )
+         {
+            tmpVx1Function = &vx1BCs[pos].getFunction();
+            break;
+         }
+      }
+   }
+   for(size_t pos=0; pos<vx2BCs.size(); ++pos)
+   {
+      if( UbMath::equal(vx2BCs[pos].getEndTime(),BCFunction::INFTIMEDEPENDENT)) maxEndtime=Ub::inf;
+      maxEndtime = UbMath::max(maxEndtime,vx2BCs[pos].getStartTime(),vx2BCs[pos].getEndTime()); //startTime abfragen, da  INFCONST=-10
+
+      if( UbMath::greaterEqual(this->timeStep,vx2BCs[pos].getStartTime()) ) 
+      {
+         if(   UbMath::lessEqual( this->timeStep     , vx2BCs[pos].getEndTime()      )
+            || UbMath::equal(     vx2BCs[pos].getEndTime(), (double)BCFunction::INFCONST         )
+            || UbMath::equal(     vx2BCs[pos].getEndTime(), (double)BCFunction::INFTIMEDEPENDENT )  )
+         {
+            tmpVx2Function = &vx2BCs[pos].getFunction();
+            break;
+         }
+      }
+   }
+   for(size_t pos=0; pos<vx3BCs.size(); ++pos)
+   {
+      if( UbMath::equal(vx3BCs[pos].getEndTime(),BCFunction::INFTIMEDEPENDENT)) maxEndtime=Ub::inf;
+      maxEndtime = UbMath::max(maxEndtime,vx3BCs[pos].getStartTime(),vx3BCs[pos].getEndTime()); //startTime abfragen, da  INFCONST=-10
+
+      if( UbMath::greaterEqual(this->timeStep,vx3BCs[pos].getStartTime()) ) 
+      {
+         if(   UbMath::lessEqual( this->timeStep     , vx3BCs[pos].getEndTime()      )
+            || UbMath::equal(     vx3BCs[pos].getEndTime(), (double)BCFunction::INFCONST         )
+            || UbMath::equal(     vx3BCs[pos].getEndTime(), (double)BCFunction::INFTIMEDEPENDENT )  )
+         {
+            tmpVx3Function = &vx3BCs[pos].getFunction();
+            break;
+         }
+      }
+   }
+
+   if( UbMath::greaterEqual(time,maxEndtime) ) 
+   {
+      if( !this->isTimePeriodic() ) this->unsetTimeDependent();
+      else //bei peridoic die interavalle neu setzen:
+      {
+         if( UbMath::equal(maxEndtime,BCFunction::INFCONST) )
+            for(size_t pos=0; pos<vx1BCs.size(); ++pos)
+            {
+               vx1BCs[pos].setStartTime( vx1BCs[pos].getStartTime() + timeStep );
+               vx1BCs[pos].setEndTime( vx1BCs[pos].getEndTime() + timeStep );
+            }
+            if( UbMath::equal(maxEndtime,BCFunction::INFCONST) )
+            for(size_t pos=0; pos<vx2BCs.size(); ++pos)
+            {
+               vx2BCs[pos].setStartTime( vx2BCs[pos].getStartTime() + timeStep );
+               vx2BCs[pos].setEndTime( vx2BCs[pos].getEndTime() + timeStep );
+            }
+         if( UbMath::equal(maxEndtime,BCFunction::INFCONST) )
+            for(size_t pos=0; pos<vx3BCs.size(); ++pos)
+            {
+               vx3BCs[pos].setStartTime( vx3BCs[pos].getStartTime() + timeStep );
+               vx3BCs[pos].setEndTime( vx3BCs[pos].getEndTime() + timeStep );
+            }
+        this->init(interactor,time);
+      }
+   }
+
+   UBLOG(logDEBUG4,"D3Q27VelocityBCAdapter::init(time="<<time<<") "
+                   <<", vx1= \""<<(tmpVx1Function ? tmpVx1Function->GetExpr() : "-")<<"\""
+                   <<", vx2= \""<<(tmpVx2Function ? tmpVx2Function->GetExpr() : "-")<<"\""
+                   <<", vx3= \""<<(tmpVx3Function ? tmpVx3Function->GetExpr() : "-")<<"\""
+                   <<", timedependent="<<boolalpha<<this->isTimeDependent()   );
+}
+/*==========================================================*/
+void VelocityBCAdapter::update( const D3Q27Interactor* const& interactor, const double& time ) 
+{
+   this->init(interactor,time);
+}
+/*==========================================================*/
+void VelocityBCAdapter::adaptBCForDirection( const D3Q27Interactor& interactor, SPtr<BoundaryConditions> bc, const double& worldX1, const double& worldX2, const double& worldX3, const double& q, const int& fdirection, const double& time )
+{
+   bc->setVelocityBoundaryFlag(D3Q27System::INVDIR[fdirection],secondaryBcOption);
+   bc->setQ((float)q,fdirection);
+}
+/*==========================================================*/
+void VelocityBCAdapter::adaptBC( const D3Q27Interactor& interactor, SPtr<BoundaryConditions> bc, const double& worldX1, const double& worldX2, const double& worldX3, const double& time ) 
+{
+   this->setNodeVelocity(interactor,bc,worldX1,worldX2,worldX3,time);
+   bc->setBcAlgorithmType(algorithmType);
+}
+/*==========================================================*/
+void VelocityBCAdapter::setNodeVelocity( const D3Q27Interactor& interactor, SPtr<BoundaryConditions> bc, const double& worldX1, const double& worldX2, const double& worldX3, const double& timestep) 
+{
+   //Geschwindigkeiten setzen
+   try
+   {
+      //PunktKoordinaten bestimmen
+      this->x1 = worldX1;
+      this->x2 = worldX2;
+      this->x3 = worldX3;
+      this->timeStep = timestep;
+
+      if(tmpVx1Function) bc->setBoundaryVelocityX1((LBMReal)tmpVx1Function->Eval());  
+      if(tmpVx2Function) bc->setBoundaryVelocityX2((LBMReal)tmpVx2Function->Eval());
+      if(tmpVx3Function) bc->setBoundaryVelocityX3((LBMReal)tmpVx3Function->Eval());
+   }
+   catch(mu::Parser::exception_type& e){ stringstream error; error<<"mu::parser exception occurs, message("<<e.GetMsg()<<"), formula("<<e.GetExpr()+"), token("+e.GetToken()<<")"
+                                         <<", pos("<<e.GetPos()<<"), error code("<<e.GetCode(); throw UbException(error.str()); }
+   catch(...)                          { throw UbException(UB_EXARGS,"unknown exception" ); }
+}
+/*==========================================================*/
+UbTupleDouble3 VelocityBCAdapter::getVelocity(const double& x1, const double& x2, const double& x3, const double& timeStep) const
+{
+	double vx1 = 0.0;
+	double vx2 = 0.0;
+	double vx3 = 0.0;
+   this->x1 = x1;
+   this->x2 = x2;
+   this->x3 = x3;
+   this->timeStep = timeStep;
+	
+	if(tmpVx1Function) vx1 = tmpVx1Function->Eval();  
+   if(tmpVx2Function) vx2 = tmpVx2Function->Eval();
+   if(tmpVx3Function) vx3 = tmpVx3Function->Eval();
+    
+   return UbTupleDouble3(vx1,vx2,vx3);
+}
+/*==========================================================*/
+string VelocityBCAdapter::toString()
+{
+   stringstream info;
+   info<<"D3Q27VelocityBCAdapter:\n";
+   info<<" #vx1-functions = "<<(int)vx1BCs.size()<<endl;
+   info<<" #vx2-functions = "<<(int)vx2BCs.size()<<endl;
+   info<<" #vx3-functions = "<<(int)vx3BCs.size()<<endl;
+   info<<" protected variables: x1, x2, x3, t"<<endl;
+   
+   const vector<BCFunction>* bcvecs[3] = { &vx1BCs, &vx2BCs, &vx3BCs };
+   for(int i=0; i<3; i++)
+   {
+      for(size_t pos=0; pos<bcvecs[i]->size(); ++pos)
+      {
+         info<<"\n   vx"<<(i+1)<<"-function nr."<<pos<<":"<<endl;
+         info<<(*bcvecs[i])[pos]<<endl;
+      }
+   }
+   return info.str();
+}
+
+
diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityBCAdapter.h b/src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityBCAdapter.h
index 133779e8a06a9a989cace57e13b1da3de34eadc2..723b9de387e4f9a6869fc64a0e2ce7e2d2df5435 100644
--- a/src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityBCAdapter.h
+++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityBCAdapter.h
@@ -1,162 +1,162 @@
-//=======================================================================================
-// ____          ____    __    ______     __________   __      __       __        __         
-// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
-//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
-//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
-//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
-//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
-//      \    \  |    |   ________________________________________________________________    
-//       \    \ |    |  |  ______________________________________________________________|   
-//        \    \|    |  |  |         __          __     __     __     ______      _______    
-//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
-//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
-//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
-//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
-//
-//  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 VelocityBCAdapter.h
-//! \ingroup BoundarConditions
-//! \author Sören Freudiger
-//=======================================================================================
-#ifndef VelocityBCAdapter_H
-#define VelocityBCAdapter_H
-
-#include <iostream>
-#include <string>
-#include <sstream>
-#include <vector>
-
-#include <basics/utilities/UbInfinity.h>
-
-#include <BCAdapter.h>
-#include <BCFunction.h>
-
-//! \brief A class provides an interface for velocity boundary condition in grid generator.
-
-//! \details 
-//! Example:
-//! \code{.cpp}  vector<BCFunction> vx1BCs,vx2BCs,vx3BCs;
-//!        vx1BCs.push_back(BCFunction(0.01 , 0  , 100) );   //t=[0  ..100[ -> vx1 = 0.01
-//!        vx1BCs.push_back(BCFunction(0.004, 100, 200) );   //t=[100..200[ -> vx1 = 0.004
-//!        vx1BCs.push_back(BCFunction(0.03 , 200, 400) );   //t=[200..400] -> vx1 = 0.03
-//! 
-//!        vx2BCs.push_back(BCFunction(0.02 , 0  , 200) );   //t=[0  ..200[ -> vx2 = 0.02
-//!        vx2BCs.push_back(BCFunction(0.002, 200, 300) );   //t=[200..300[ -> vx2 = 0.002
-//!        vx2BCs.push_back(BCFunction(0.043, 300, 600) );   //t=[300..600] -> vx2 = 0.043
-//!        
-//!        VelocityBCAdapter bcAdapter(vx1BCs,vx2BCs,vx3BCs);
-//!        bcAdapter.setTimePeriodic(); //->  t=[0  ..100[ -> vx1 = 0.01
-//!                                     //    t=[100..200[ -> vx1 = 0.004
-//!                                     //    t=[200..400[ -> vx1 = 0.03
-//!                                     //    t=[400..500[ -> vx1 = 0.01
-//!                                     //    t=[500..600[ -> vx1 = 0.004
-//!                                     //    t=[600..800[ -> vx1 = 0.03  ...
-//!                                     //    t=[0  ..200[ -> vx2 = 0.02
-//!                                     //    t=[200..300[ -> vx2 = 0.002
-//!                                     //    t=[300..600] -> vx2 = 0.043
-//!                                     //    t=[600..800[ -> vx2 = 0.02
-//!                                     //    t=[800..900[ -> vx2 = 0.002
-//!                                     //    t=[900..1200]-> vx2 = 0.043  ...
-//! \endcode
-//! Example of parabolic inflow:
-//! \code{.cpp}
-//!    mu::Parser fct;
-//!    fct.SetExpr("max(vmax*(1.0-4.0*((x2-x2_vmax)^2+(x3-x3_vmax)^2)/H^2),0.0)"); //paraboloid (with vmax for (0/x2_vmax/x3_vmax) 
-//!    fct.DefineConst("x2Vmax", 0.0            ); //x2-Pos für vmax
-//!    fct.DefineConst("x3Vmax", 0.0            ); //x3-Pos für vmax
-//!    fct.DefineConst("H"     , diameterOfPipe);
-//!    fct.DefineConst("vmax"  , vmax           );
-//!    VelocityBCAdapter velBC(true, false ,false ,fct, 0, BCFunction::INFCONST);
-//! \endcode
-
-class VelocityBCAdapter : public BCAdapter
-{
-public:
-   //constructors
-   VelocityBCAdapter() { this->init(); }
-   
-   VelocityBCAdapter(const bool& vx1, const bool& vx2, const bool& vx3, const BCFunction& velVxBC );
-
-   VelocityBCAdapter(const bool& vx1, const bool& vx2, const bool& vx3, const mu::Parser& function, const double& startTime, const double& endTime  );
-
-   VelocityBCAdapter(const bool& vx1, const bool& vx2, const bool& vx3, const mu::Parser& function1, const mu::Parser& function2, const mu::Parser& function3, const double& startTime, const double& endTime );
-   
-   VelocityBCAdapter(const bool& vx1, const bool& vx2, const bool& vx3, const std::string& functionstring, const double& startTime, const double& endTime );
-
-   VelocityBCAdapter(const BCFunction& velBC, bool x1Dir, bool x2Dir, bool x3Dir);
-
-   VelocityBCAdapter(const BCFunction& velVx1BC, const BCFunction& velVx2BC, const BCFunction& velVx3BC);
-
-   VelocityBCAdapter(const std::vector< BCFunction >& velVx1BCs, const std::vector< BCFunction >& velVx2BCs, const std::vector< BCFunction >& velVx3BCs);
-
-   VelocityBCAdapter(const double& vx1, const double& vx1StartTime, const double& vx1EndTime,
-                          const double& vx2, const double& vx2StartTime, const double& vx2EndTime,
-                          const double& vx3, const double& vx3StartTime, const double& vx3EndTime);
-
-   VelocityBCAdapter(const std::string& vx1Function, const double& vx1StartTime, const double& vx1EndTime,
-                          const std::string& vx2Function, const double& vx2StartTime, const double& vx2EndTime,
-                          const std::string& vx3Function, const double& vx3StartTime, const double& vx3EndTime ); 
-
-   //methods
-   void setTimePeriodic()    { (this->type |=   TIMEPERIODIC); }
-   void unsetTimePeriodic()  { (this->type &=  ~TIMEPERIODIC); }
-   bool isTimePeriodic()     { return ((this->type & TIMEPERIODIC) ==  TIMEPERIODIC); }
-
-   //The following is meant for moving objects... 
-   void setNewVelocities(const double& vx1, const double& vx1StartTime, const double& vx1EndTime,
-                         const double& vx2, const double& vx2StartTime, const double& vx2EndTime,
-                         const double& vx3, const double& vx3StartTime, const double& vx3EndTime);
-
-      
-   //------------- implements BCAdapter ----- start
-   std::string toString();
-   
-   void init(const D3Q27Interactor* const& interactor, const double& time=0);
-   void update(const D3Q27Interactor* const& interactor, const double& time=0);
-
-   void adaptBCForDirection( const D3Q27Interactor& interactor, SPtr<BoundaryConditions> bc, const double& worldX1, const double& worldX2, const double& worldX3, const double& q, const int& fdirection, const double& time=0 );
-   void adaptBC( const D3Q27Interactor& interactor, SPtr<BoundaryConditions> bc, const double& worldX1, const double& worldX2, const double& worldX3, const double& time=0 );
-
-   //------------- implements BCAdapter ----- end
-
-   UbTupleDouble3 getVelocity(const double& x1, const double& x2, const double& x3, const double& timeStep) const;
-
-
-protected:
-   void init();
-   void init(std::vector<BCFunction>& vxBCs);
-
-   //time dependency is determined automatically via BCFunction intervals!
-   void setTimeDependent()   { (this->type |=   TIMEDEPENDENT); }
-   void unsetTimeDependent() { (this->type &=  ~TIMEDEPENDENT); }
-
-   void clear() { vx1BCs.clear(); vx2BCs.clear();  vx3BCs.clear(); this->init(); }
-   void setNodeVelocity(const D3Q27Interactor& interactor, SPtr<BoundaryConditions> bc, const double& worldX1, const double& worldX2, const double& worldX3, const double& timestep);
-
-private:
-   mutable mu::value_type x1, x2, x3;
-   mutable mu::value_type timeStep;
-
-   mu::Parser* tmpVx1Function;
-   mu::Parser* tmpVx2Function;
-   mu::Parser* tmpVx3Function;
-
-   std::vector<BCFunction> vx1BCs;
-   std::vector<BCFunction> vx2BCs;
-   std::vector<BCFunction> vx3BCs;
-
-};
-
-#endif
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 VelocityBCAdapter.h
+//! \ingroup BoundarConditions
+//! \author Sören Freudiger
+//=======================================================================================
+#ifndef VelocityBCAdapter_H
+#define VelocityBCAdapter_H
+
+#include <iostream>
+#include <string>
+#include <sstream>
+#include <vector>
+
+#include <basics/utilities/UbInfinity.h>
+
+#include <BCAdapter.h>
+#include <BCFunction.h>
+
+//! \brief A class provides an interface for velocity boundary condition in grid generator.
+
+//! \details 
+//! Example:
+//! \code{.cpp}  vector<BCFunction> vx1BCs,vx2BCs,vx3BCs;
+//!        vx1BCs.push_back(BCFunction(0.01 , 0  , 100) );   //t=[0  ..100[ -> vx1 = 0.01
+//!        vx1BCs.push_back(BCFunction(0.004, 100, 200) );   //t=[100..200[ -> vx1 = 0.004
+//!        vx1BCs.push_back(BCFunction(0.03 , 200, 400) );   //t=[200..400] -> vx1 = 0.03
+//! 
+//!        vx2BCs.push_back(BCFunction(0.02 , 0  , 200) );   //t=[0  ..200[ -> vx2 = 0.02
+//!        vx2BCs.push_back(BCFunction(0.002, 200, 300) );   //t=[200..300[ -> vx2 = 0.002
+//!        vx2BCs.push_back(BCFunction(0.043, 300, 600) );   //t=[300..600] -> vx2 = 0.043
+//!        
+//!        VelocityBCAdapter bcAdapter(vx1BCs,vx2BCs,vx3BCs);
+//!        bcAdapter.setTimePeriodic(); //->  t=[0  ..100[ -> vx1 = 0.01
+//!                                     //    t=[100..200[ -> vx1 = 0.004
+//!                                     //    t=[200..400[ -> vx1 = 0.03
+//!                                     //    t=[400..500[ -> vx1 = 0.01
+//!                                     //    t=[500..600[ -> vx1 = 0.004
+//!                                     //    t=[600..800[ -> vx1 = 0.03  ...
+//!                                     //    t=[0  ..200[ -> vx2 = 0.02
+//!                                     //    t=[200..300[ -> vx2 = 0.002
+//!                                     //    t=[300..600] -> vx2 = 0.043
+//!                                     //    t=[600..800[ -> vx2 = 0.02
+//!                                     //    t=[800..900[ -> vx2 = 0.002
+//!                                     //    t=[900..1200]-> vx2 = 0.043  ...
+//! \endcode
+//! Example of parabolic inflow:
+//! \code{.cpp}
+//!    mu::Parser fct;
+//!    fct.SetExpr("max(vmax*(1.0-4.0*((x2-x2_vmax)^2+(x3-x3_vmax)^2)/H^2),0.0)"); //paraboloid (with vmax for (0/x2_vmax/x3_vmax) 
+//!    fct.DefineConst("x2Vmax", 0.0            ); //x2-Pos für vmax
+//!    fct.DefineConst("x3Vmax", 0.0            ); //x3-Pos für vmax
+//!    fct.DefineConst("H"     , diameterOfPipe);
+//!    fct.DefineConst("vmax"  , vmax           );
+//!    VelocityBCAdapter velBC(true, false ,false ,fct, 0, BCFunction::INFCONST);
+//! \endcode
+
+class VelocityBCAdapter : public BCAdapter
+{
+public:
+   //constructors
+   VelocityBCAdapter() { this->init(); }
+   
+   VelocityBCAdapter(const bool& vx1, const bool& vx2, const bool& vx3, const BCFunction& velVxBC );
+
+   VelocityBCAdapter(const bool& vx1, const bool& vx2, const bool& vx3, const mu::Parser& function, const double& startTime, const double& endTime  );
+
+   VelocityBCAdapter(const bool& vx1, const bool& vx2, const bool& vx3, const mu::Parser& function1, const mu::Parser& function2, const mu::Parser& function3, const double& startTime, const double& endTime );
+   
+   VelocityBCAdapter(const bool& vx1, const bool& vx2, const bool& vx3, const std::string& functionstring, const double& startTime, const double& endTime );
+
+   VelocityBCAdapter(const BCFunction& velBC, bool x1Dir, bool x2Dir, bool x3Dir);
+
+   VelocityBCAdapter(const BCFunction& velVx1BC, const BCFunction& velVx2BC, const BCFunction& velVx3BC);
+
+   VelocityBCAdapter(const std::vector< BCFunction >& velVx1BCs, const std::vector< BCFunction >& velVx2BCs, const std::vector< BCFunction >& velVx3BCs);
+
+   VelocityBCAdapter(const double& vx1, const double& vx1StartTime, const double& vx1EndTime,
+                          const double& vx2, const double& vx2StartTime, const double& vx2EndTime,
+                          const double& vx3, const double& vx3StartTime, const double& vx3EndTime);
+
+   VelocityBCAdapter(const std::string& vx1Function, const double& vx1StartTime, const double& vx1EndTime,
+                          const std::string& vx2Function, const double& vx2StartTime, const double& vx2EndTime,
+                          const std::string& vx3Function, const double& vx3StartTime, const double& vx3EndTime ); 
+
+   //methods
+   void setTimePeriodic()    { (this->type |=   TIMEPERIODIC); }
+   void unsetTimePeriodic()  { (this->type &=  ~TIMEPERIODIC); }
+   bool isTimePeriodic()     { return ((this->type & TIMEPERIODIC) ==  TIMEPERIODIC); }
+
+   //The following is meant for moving objects... 
+   void setNewVelocities(const double& vx1, const double& vx1StartTime, const double& vx1EndTime,
+                         const double& vx2, const double& vx2StartTime, const double& vx2EndTime,
+                         const double& vx3, const double& vx3StartTime, const double& vx3EndTime);
+
+      
+   //------------- implements BCAdapter ----- start
+   std::string toString();
+   
+   void init(const D3Q27Interactor* const& interactor, const double& time=0);
+   void update(const D3Q27Interactor* const& interactor, const double& time=0);
+
+   void adaptBCForDirection( const D3Q27Interactor& interactor, SPtr<BoundaryConditions> bc, const double& worldX1, const double& worldX2, const double& worldX3, const double& q, const int& fdirection, const double& time=0 );
+   void adaptBC( const D3Q27Interactor& interactor, SPtr<BoundaryConditions> bc, const double& worldX1, const double& worldX2, const double& worldX3, const double& time=0 );
+
+   //------------- implements BCAdapter ----- end
+
+   UbTupleDouble3 getVelocity(const double& x1, const double& x2, const double& x3, const double& timeStep) const;
+
+
+protected:
+   void init();
+   void init(std::vector<BCFunction>& vxBCs);
+
+   //time dependency is determined automatically via BCFunction intervals!
+   void setTimeDependent()   { (this->type |=   TIMEDEPENDENT); }
+   void unsetTimeDependent() { (this->type &=  ~TIMEDEPENDENT); }
+
+   void clear() { vx1BCs.clear(); vx2BCs.clear();  vx3BCs.clear(); this->init(); }
+   void setNodeVelocity(const D3Q27Interactor& interactor, SPtr<BoundaryConditions> bc, const double& worldX1, const double& worldX2, const double& worldX3, const double& timestep);
+
+private:
+   mutable mu::value_type x1, x2, x3;
+   mutable mu::value_type timeStep;
+
+   mu::Parser* tmpVx1Function;
+   mu::Parser* tmpVx2Function;
+   mu::Parser* tmpVx3Function;
+
+   std::vector<BCFunction> vx1BCs;
+   std::vector<BCFunction> vx2BCs;
+   std::vector<BCFunction> vx3BCs;
+
+};
+
+#endif
diff --git a/src/cpu/VirtualFluidsCore/CMakeLists.txt b/src/cpu/VirtualFluidsCore/CMakeLists.txt
index 13fea30bbda58f102768c85d22cdaf0b55a6b199..a051433245a3c65dc899522738016ce79260105a 100644
--- a/src/cpu/VirtualFluidsCore/CMakeLists.txt
+++ b/src/cpu/VirtualFluidsCore/CMakeLists.txt
@@ -1,51 +1,51 @@
-
-IF(${USE_METIS})
-   SET(LINK_LIBRARY optimized ${METIS_RELEASE_LIBRARY} debug ${METIS_DEBUG_LIBRARY})
-   SET(CAB_ADDITIONAL_LINK_LIBRARIES ${CAB_ADDITIONAL_LINK_LIBRARIES} ${LINK_LIBRARY})
-ENDIF()
-
-IF(${USE_VTK})
-   SET(LINK_LIBRARY optimized ${VTK_LIBRARIES} debug ${VTK_LIBRARIES})
-   SET(CAB_ADDITIONAL_LINK_LIBRARIES ${CAB_ADDITIONAL_LINK_LIBRARIES} ${LINK_LIBRARY})
-ENDIF()
-
-IF(${USE_CATALYST})
-   SET(LINK_LIBRARY optimized vtkPVPythonCatalyst debug vtkPVPythonCatalyst )
-   SET(CAB_ADDITIONAL_LINK_LIBRARIES ${CAB_ADDITIONAL_LINK_LIBRARIES} ${LINK_LIBRARY})
-   SET(LINK_LIBRARY optimized vtkParallelMPI debug vtkParallelMPI )
-   SET(CAB_ADDITIONAL_LINK_LIBRARIES ${CAB_ADDITIONAL_LINK_LIBRARIES} ${LINK_LIBRARY})
-ENDIF()
-
-
-IF(${USE_DEM_COUPLING})
-   INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/../DemCoupling/DemCoupling.cmake)
-ENDIF()
-
-vf_add_library(BUILDTYPE static DEPENDS basics muparser ${MPI_LIBRARY} ${CAB_ADDITIONAL_LINK_LIBRARIES})
-
-vf_get_library_name(library_name)
-
-target_include_directories(${library_name} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/BoundaryConditions)
-target_include_directories(${library_name} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/Connectors)
-target_include_directories(${library_name} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/Data)
-target_include_directories(${library_name} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/Interactors)
-target_include_directories(${library_name} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/LBM)
-target_include_directories(${library_name} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/Parallel)
-target_include_directories(${library_name} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/Grid)
-target_include_directories(${library_name} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/Visitors)
-target_include_directories(${library_name} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/CoProcessors)
-target_include_directories(${library_name} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/Utilities)
-
-
-target_include_directories(${library_name} PUBLIC ${METIS_INCLUDEDIR})
-
-
-IF(${USE_BOOST})
-   target_include_directories(${library_name} PRIVATE ${Boost_INCLUDE_DIR})
-ENDIF()
-
-
-target_include_directories(${library_name} PRIVATE ${ZOLTAN_INCLUDEDIR})
-IF(${USE_VTK})
-   target_include_directories(${library_name} PRIVATE ${VTK_INCLUDE_DIRS})
-ENDIF()
+
+IF(${USE_METIS})
+   SET(LINK_LIBRARY optimized ${METIS_RELEASE_LIBRARY} debug ${METIS_DEBUG_LIBRARY})
+   SET(CAB_ADDITIONAL_LINK_LIBRARIES ${CAB_ADDITIONAL_LINK_LIBRARIES} ${LINK_LIBRARY})
+ENDIF()
+
+IF(${USE_VTK})
+   SET(LINK_LIBRARY optimized ${VTK_LIBRARIES} debug ${VTK_LIBRARIES})
+   SET(CAB_ADDITIONAL_LINK_LIBRARIES ${CAB_ADDITIONAL_LINK_LIBRARIES} ${LINK_LIBRARY})
+ENDIF()
+
+IF(${USE_CATALYST})
+   SET(LINK_LIBRARY optimized vtkPVPythonCatalyst debug vtkPVPythonCatalyst )
+   SET(CAB_ADDITIONAL_LINK_LIBRARIES ${CAB_ADDITIONAL_LINK_LIBRARIES} ${LINK_LIBRARY})
+   SET(LINK_LIBRARY optimized vtkParallelMPI debug vtkParallelMPI )
+   SET(CAB_ADDITIONAL_LINK_LIBRARIES ${CAB_ADDITIONAL_LINK_LIBRARIES} ${LINK_LIBRARY})
+ENDIF()
+
+
+IF(${USE_DEM_COUPLING})
+   INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/../DemCoupling/DemCoupling.cmake)
+ENDIF()
+
+vf_add_library(BUILDTYPE static DEPENDS basics muparser ${MPI_LIBRARY} ${CAB_ADDITIONAL_LINK_LIBRARIES})
+
+vf_get_library_name(library_name)
+
+target_include_directories(${library_name} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/BoundaryConditions)
+target_include_directories(${library_name} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/Connectors)
+target_include_directories(${library_name} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/Data)
+target_include_directories(${library_name} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/Interactors)
+target_include_directories(${library_name} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/LBM)
+target_include_directories(${library_name} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/Parallel)
+target_include_directories(${library_name} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/Grid)
+target_include_directories(${library_name} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/Visitors)
+target_include_directories(${library_name} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/CoProcessors)
+target_include_directories(${library_name} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/Utilities)
+
+
+target_include_directories(${library_name} PUBLIC ${METIS_INCLUDEDIR})
+
+
+IF(${USE_BOOST})
+   target_include_directories(${library_name} PRIVATE ${Boost_INCLUDE_DIR})
+ENDIF()
+
+
+target_include_directories(${library_name} PRIVATE ${ZOLTAN_INCLUDEDIR})
+IF(${USE_VTK})
+   target_include_directories(${library_name} PRIVATE ${VTK_INCLUDE_DIRS})
+ENDIF()
diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/AdjustForcingCoProcessor.cpp b/src/cpu/VirtualFluidsCore/CoProcessors/AdjustForcingCoProcessor.cpp
index acf38b3fbd9940346a7450111eac6189ecdad555..775c03b76750248a4d695d1bff5e02f0468f69bb 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/AdjustForcingCoProcessor.cpp
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/AdjustForcingCoProcessor.cpp
@@ -1,172 +1,172 @@
-/*
-* D3Q27AdjustForcingCoProcessor.cpp
-*  Author: Konstantin Kutscher
-*/
-#include "AdjustForcingCoProcessor.h"
-
-#include <fstream>
-
-#include <SetForcingBlockVisitor.h>
-#include "IntegrateValuesHelper.h"
-#include "Communicator.h"
-#include "UbScheduler.h"
-#include "Grid3D.h"
-
-AdjustForcingCoProcessor::AdjustForcingCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s,
-   const std::string& path,
-   SPtr<IntegrateValuesHelper> integrateValues,
-   double vTarged,
-   SPtr<Communicator> comm)
-
-   : CoProcessor(grid, s),
-   path(path),
-   integrateValues(integrateValues),
-   comm(comm),
-   vx1Targed(vTarged),
-   forcing(forcing)
-{
-   //cnodes = integrateValues->getCNodes();
-   root = comm->isRoot();
-
-   Ta = scheduler->getMaxStep();
-
-   Kpcrit = 3.0 / Ta;// 0.3;
-   Tcrit = 3.0 * Ta; // 30.0;
-   Tn = 0.5 * Tcrit;
-   Tv = 0.12 * Tcrit;
-
-   Kp = 0.6 * Kpcrit;
-   Ki = Kp / Tn;
-   Kd = Kp * Tv;
-
-   y = 0;
-   e = 0;
-   esum = 0;
-   eold = 0;
-   forcing = 0;
-
-   if (root)
-   {
-      std::string fname = path + "/forcing/forcing.csv";
-      std::ofstream ostr;
-      ostr.open(fname.c_str(), std::ios_base::out | std::ios_base::app);
-      if (!ostr)
-      {
-         ostr.clear();
-         std::string path = UbSystem::getPathFromString(fname);
-         if (path.size() > 0) { UbSystem::makeDirectory(path); ostr.open(fname.c_str(), std::ios_base::out | std::ios_base::app); }
-         if (!ostr) throw UbException(UB_EXARGS, "couldn't open file " + fname);
-      }
-      ostr << "step;volume;vx1average;forcing\n";
-      ostr.close();
-
-      //////////////////////////////////////////////////////////////////////////////////////////////////
-      //temporary solution
-      std::string fNameCfg = path + "/forcing/forcing.cfg";
-      std::ifstream istr2;
-      istr2.open(fNameCfg.c_str(), std::ios_base::in);
-      if (istr2)
-      {
-         istr2 >> forcing;
-         //istr2 >> esum;
-         //istr2 >> eold;
-      }
-      istr2.close();
-   }
-   ////////////////////////////////////////////////////////////////////////////////////////////////////////
-}
-//////////////////////////////////////////////////////////////////////////
-AdjustForcingCoProcessor::~AdjustForcingCoProcessor()
-{
-}
-//////////////////////////////////////////////////////////////////////////
-void AdjustForcingCoProcessor::process(double step)
-{
-   if (scheduler->isDue(step))
-      collectData(step);
-}
-//////////////////////////////////////////////////////////////////////////
-void AdjustForcingCoProcessor::collectData(double step)
-{
-   //////////////////////////////////////////////////////////////////////////////////////////////////
-   //temporary solution
-   if (root)
-   {
-      std::string fNameCfg = path + "/forcing/forcing.cfg";
-      std::ofstream ostr2;
-      ostr2.open(fNameCfg.c_str(), std::ios_base::out);
-      if (!ostr2)
-      {
-         ostr2.clear();
-         std::string path = UbSystem::getPathFromString(fNameCfg);
-         if (path.size() > 0) { UbSystem::makeDirectory(path); ostr2.open(fNameCfg.c_str(), std::ios_base::out); }
-         if (!ostr2) throw UbException(UB_EXARGS, "couldn't open file " + fNameCfg);
-      }
-      ostr2 << forcing << " " << esum << " " << eold;
-      ostr2.close();
-   }
-   ////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-   integrateValues->calculateMQ();
-
-   if (root)
-   {
-      cellsVolume = integrateValues->getCellsVolume();
-      double vx1 = integrateValues->getVx1();
-      vx1Average = (vx1 / cellsVolume);
-
-      //////////////////////////////////////////////////////////////////////////
-      //PID-Controller (PID-Regler)
-      e = vx1Targed - vx1Average;
-      esum = esum + e;
-      y = Kp * e + Ki * Ta * esum + Kd * (e - eold) / Ta;
-      eold = e;
-
-      forcing = forcing + y;
-      //////////////////////////////////////////////////////////////////////////
-   }
-   //////////////////////////////////////////////////////////////////////////
-   comm->broadcast(forcing);
-
-   mu::Parser fctForcingX1, fctForcingX2, fctForcingX3;
-   fctForcingX1.SetExpr("Fx1");
-   fctForcingX1.DefineConst("Fx1", forcing);
-   fctForcingX2.SetExpr("0.0");
-   fctForcingX3.SetExpr("0.0");
-   SetForcingBlockVisitor forcingVisitor(fctForcingX1, fctForcingX2, fctForcingX3);
-   grid->accept(forcingVisitor);
-
-   //for(CalcNodes cn : cnodes)
-   //{
-   //   LBMKernel3DPtr kernel = cn.block->getKernel();
-   //   if (kernel)
-   //   {
-   //      kernel->setForcingX1(fctForcingX1);
-   //      kernel->setWithForcing(true);
-   //   }
-   //      
-   //}
-
-   if (root)
-   {
-      //UBLOG(logINFO, "D3Q27AdjustForcingCoProcessor step: " << static_cast<int>(step));
-      //UBLOG(logINFO, "new forcing is: " << forcing);
-      std::string fname = path + "/forcing/forcing.csv";
-      //std::string fname = path + "/forcing/forcing_"+UbSystem::toString(comm->getProcessID())+".csv";
-      std::ofstream ostr;
-      ostr.open(fname.c_str(), std::ios_base::out | std::ios_base::app);
-      if (!ostr)
-      {
-         ostr.clear();
-         std::string path = UbSystem::getPathFromString(fname);
-         if (path.size() > 0) { UbSystem::makeDirectory(path); ostr.open(fname.c_str(), std::ios_base::out | std::ios_base::app); }
-         if (!ostr) throw UbException(UB_EXARGS, "couldn't open file " + fname);
-      }
-      int istep = static_cast<int>(step);
-
-      //ostr << istep << ";" << cellsVolume << ";" << vx1Average << "; " << forcing << "\n";
-      ostr << istep << ";" << cellsVolume << ";" << vx1Average << "; " << forcing << "; " << e << "; " << esum << "; " << y <<"\n";
-      ostr.close();
-
-   }
-}
+/*
+* D3Q27AdjustForcingCoProcessor.cpp
+*  Author: Konstantin Kutscher
+*/
+#include "AdjustForcingCoProcessor.h"
+
+#include <fstream>
+
+#include <SetForcingBlockVisitor.h>
+#include "IntegrateValuesHelper.h"
+#include "Communicator.h"
+#include "UbScheduler.h"
+#include "Grid3D.h"
+
+AdjustForcingCoProcessor::AdjustForcingCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s,
+   const std::string& path,
+   SPtr<IntegrateValuesHelper> integrateValues,
+   double vTarged,
+   SPtr<Communicator> comm)
+
+   : CoProcessor(grid, s),
+   path(path),
+   integrateValues(integrateValues),
+   comm(comm),
+   vx1Targed(vTarged),
+   forcing(forcing)
+{
+   //cnodes = integrateValues->getCNodes();
+   root = comm->isRoot();
+
+   Ta = scheduler->getMaxStep();
+
+   Kpcrit = 3.0 / Ta;// 0.3;
+   Tcrit = 3.0 * Ta; // 30.0;
+   Tn = 0.5 * Tcrit;
+   Tv = 0.12 * Tcrit;
+
+   Kp = 0.6 * Kpcrit;
+   Ki = Kp / Tn;
+   Kd = Kp * Tv;
+
+   y = 0;
+   e = 0;
+   esum = 0;
+   eold = 0;
+   forcing = 0;
+
+   if (root)
+   {
+      std::string fname = path + "/forcing/forcing.csv";
+      std::ofstream ostr;
+      ostr.open(fname.c_str(), std::ios_base::out | std::ios_base::app);
+      if (!ostr)
+      {
+         ostr.clear();
+         std::string path = UbSystem::getPathFromString(fname);
+         if (path.size() > 0) { UbSystem::makeDirectory(path); ostr.open(fname.c_str(), std::ios_base::out | std::ios_base::app); }
+         if (!ostr) throw UbException(UB_EXARGS, "couldn't open file " + fname);
+      }
+      ostr << "step;volume;vx1average;forcing\n";
+      ostr.close();
+
+      //////////////////////////////////////////////////////////////////////////////////////////////////
+      //temporary solution
+      std::string fNameCfg = path + "/forcing/forcing.cfg";
+      std::ifstream istr2;
+      istr2.open(fNameCfg.c_str(), std::ios_base::in);
+      if (istr2)
+      {
+         istr2 >> forcing;
+         //istr2 >> esum;
+         //istr2 >> eold;
+      }
+      istr2.close();
+   }
+   ////////////////////////////////////////////////////////////////////////////////////////////////////////
+}
+//////////////////////////////////////////////////////////////////////////
+AdjustForcingCoProcessor::~AdjustForcingCoProcessor()
+{
+}
+//////////////////////////////////////////////////////////////////////////
+void AdjustForcingCoProcessor::process(double step)
+{
+   if (scheduler->isDue(step))
+      collectData(step);
+}
+//////////////////////////////////////////////////////////////////////////
+void AdjustForcingCoProcessor::collectData(double step)
+{
+   //////////////////////////////////////////////////////////////////////////////////////////////////
+   //temporary solution
+   if (root)
+   {
+      std::string fNameCfg = path + "/forcing/forcing.cfg";
+      std::ofstream ostr2;
+      ostr2.open(fNameCfg.c_str(), std::ios_base::out);
+      if (!ostr2)
+      {
+         ostr2.clear();
+         std::string path = UbSystem::getPathFromString(fNameCfg);
+         if (path.size() > 0) { UbSystem::makeDirectory(path); ostr2.open(fNameCfg.c_str(), std::ios_base::out); }
+         if (!ostr2) throw UbException(UB_EXARGS, "couldn't open file " + fNameCfg);
+      }
+      ostr2 << forcing << " " << esum << " " << eold;
+      ostr2.close();
+   }
+   ////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+   integrateValues->calculateMQ();
+
+   if (root)
+   {
+      cellsVolume = integrateValues->getCellsVolume();
+      double vx1 = integrateValues->getVx1();
+      vx1Average = (vx1 / cellsVolume);
+
+      //////////////////////////////////////////////////////////////////////////
+      //PID-Controller (PID-Regler)
+      e = vx1Targed - vx1Average;
+      esum = esum + e;
+      y = Kp * e + Ki * Ta * esum + Kd * (e - eold) / Ta;
+      eold = e;
+
+      forcing = forcing + y;
+      //////////////////////////////////////////////////////////////////////////
+   }
+   //////////////////////////////////////////////////////////////////////////
+   comm->broadcast(forcing);
+
+   mu::Parser fctForcingX1, fctForcingX2, fctForcingX3;
+   fctForcingX1.SetExpr("Fx1");
+   fctForcingX1.DefineConst("Fx1", forcing);
+   fctForcingX2.SetExpr("0.0");
+   fctForcingX3.SetExpr("0.0");
+   SetForcingBlockVisitor forcingVisitor(fctForcingX1, fctForcingX2, fctForcingX3);
+   grid->accept(forcingVisitor);
+
+   //for(CalcNodes cn : cnodes)
+   //{
+   //   LBMKernel3DPtr kernel = cn.block->getKernel();
+   //   if (kernel)
+   //   {
+   //      kernel->setForcingX1(fctForcingX1);
+   //      kernel->setWithForcing(true);
+   //   }
+   //      
+   //}
+
+   if (root)
+   {
+      //UBLOG(logINFO, "D3Q27AdjustForcingCoProcessor step: " << static_cast<int>(step));
+      //UBLOG(logINFO, "new forcing is: " << forcing);
+      std::string fname = path + "/forcing/forcing.csv";
+      //std::string fname = path + "/forcing/forcing_"+UbSystem::toString(comm->getProcessID())+".csv";
+      std::ofstream ostr;
+      ostr.open(fname.c_str(), std::ios_base::out | std::ios_base::app);
+      if (!ostr)
+      {
+         ostr.clear();
+         std::string path = UbSystem::getPathFromString(fname);
+         if (path.size() > 0) { UbSystem::makeDirectory(path); ostr.open(fname.c_str(), std::ios_base::out | std::ios_base::app); }
+         if (!ostr) throw UbException(UB_EXARGS, "couldn't open file " + fname);
+      }
+      int istep = static_cast<int>(step);
+
+      //ostr << istep << ";" << cellsVolume << ";" << vx1Average << "; " << forcing << "\n";
+      ostr << istep << ";" << cellsVolume << ";" << vx1Average << "; " << forcing << "; " << e << "; " << esum << "; " << y <<"\n";
+      ostr.close();
+
+   }
+}
diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/AdjustForcingCoProcessor.h b/src/cpu/VirtualFluidsCore/CoProcessors/AdjustForcingCoProcessor.h
index aa625291a250e7ff0af1a04c2d1810e473ce75aa..eaa57ebc0a889bddd1e31d0aab77e90538075804 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/AdjustForcingCoProcessor.h
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/AdjustForcingCoProcessor.h
@@ -1,58 +1,58 @@
-#ifndef D3Q27ADJUSTFORCINGCoProcessor_H
-#define D3Q27ADJUSTFORCINGCoProcessor_H
-
-#include <PointerDefinitions.h>
-#include <string>
-
-#include "CoProcessor.h"
-
-
-class Communicator;
-class UbScheduler;
-class Grid3D;
-class IntegrateValuesHelper;
-
-//! \brief   Computes forcing such that a given velocity (vx1Targed) is reached inside an averaging domain (h1). 
-//! \details Algorithm based on PID controller (proportional–integral–derivative controller). The parameters of PID controller estimation based on Ziegler–Nichols method. 
-//!          Integrate values helper, scheduler must be set in test case.
-//! \author: Konstantin Kutscher
-
-class AdjustForcingCoProcessor: public CoProcessor {
-public:
-	AdjustForcingCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s,
-                                   const std::string& path,
-                                   SPtr<IntegrateValuesHelper> integrateValues,
-                                   double vTarged, SPtr<Communicator> comm);
-	virtual ~AdjustForcingCoProcessor();
-	 //!< calls collect PostprocessData
-   void process(double step) override;
-protected:
-   //!< object that can compute spacial average values in 3D-subdomain.
-    SPtr<IntegrateValuesHelper> integrateValues;
-   //!< compares velocity in integrateValues with target velocity and adjusts forcing accordingly.
-	void collectData(double step);  
-    SPtr<Communicator> comm;
-private:
-   double vx1Targed; //!< target velocity.
-   double forcing; //!< forcing at previous update step. 
-   double cellsVolume;
-   double vx1Average;
-   bool root;
-   double Kpcrit; //Kp critical
-   double Tcrit;  //the oscillation period 
-   double Tn;
-   double Tv;
-   double e;
-   double Ta;
-   double Kp;
-   double Ki;
-   double Kd;
-   double y;
-   double esum;
-   double eold;
-   //std::vector<CalcNodes> cnodes;
-   std::string path;
-};
-
-
-#endif /* D3Q27RHODIFFERENCECoProcessor_H_ */
+#ifndef D3Q27ADJUSTFORCINGCoProcessor_H
+#define D3Q27ADJUSTFORCINGCoProcessor_H
+
+#include <PointerDefinitions.h>
+#include <string>
+
+#include "CoProcessor.h"
+
+
+class Communicator;
+class UbScheduler;
+class Grid3D;
+class IntegrateValuesHelper;
+
+//! \brief   Computes forcing such that a given velocity (vx1Targed) is reached inside an averaging domain (h1). 
+//! \details Algorithm based on PID controller (proportional–integral–derivative controller). The parameters of PID controller estimation based on Ziegler–Nichols method. 
+//!          Integrate values helper, scheduler must be set in test case.
+//! \author: Konstantin Kutscher
+
+class AdjustForcingCoProcessor: public CoProcessor {
+public:
+	AdjustForcingCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s,
+                                   const std::string& path,
+                                   SPtr<IntegrateValuesHelper> integrateValues,
+                                   double vTarged, SPtr<Communicator> comm);
+	virtual ~AdjustForcingCoProcessor();
+	 //!< calls collect PostprocessData
+   void process(double step) override;
+protected:
+   //!< object that can compute spacial average values in 3D-subdomain.
+    SPtr<IntegrateValuesHelper> integrateValues;
+   //!< compares velocity in integrateValues with target velocity and adjusts forcing accordingly.
+	void collectData(double step);  
+    SPtr<Communicator> comm;
+private:
+   double vx1Targed; //!< target velocity.
+   double forcing; //!< forcing at previous update step. 
+   double cellsVolume;
+   double vx1Average;
+   bool root;
+   double Kpcrit; //Kp critical
+   double Tcrit;  //the oscillation period 
+   double Tn;
+   double Tv;
+   double e;
+   double Ta;
+   double Kp;
+   double Ki;
+   double Kd;
+   double y;
+   double esum;
+   double eold;
+   //std::vector<CalcNodes> cnodes;
+   std::string path;
+};
+
+
+#endif /* D3Q27RHODIFFERENCECoProcessor_H_ */
diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/AverageValuesCoProcessor.h b/src/cpu/VirtualFluidsCore/CoProcessors/AverageValuesCoProcessor.h
index f3931c4be90997784816303889bfa6efa317c0b6..e45a52202d78c7798d64eb48305f70d60011c541 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/AverageValuesCoProcessor.h
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/AverageValuesCoProcessor.h
@@ -1,74 +1,74 @@
-#ifndef AverageValuesCoProcessor_H
-#define AverageValuesCoProcessor_H
-
-#include <PointerDefinitions.h>
-#include <vector>
-#include <string>
-
-#include "CoProcessor.h"
-#include "LBMSystem.h"
-#include "UbTuple.h"
-
-class UbScheduler;
-class WbWriter;
-class Grid3D;
-class Block3D;
-
-//! \brief  Computes the time averaged mean velocity and RMS values and writes to parallel .vtk
-//! \details writes at given time intervals specified in scheduler (s), does averaging according to scheduler (Avs) and resets according to scheduler (rs).  <br>
-//!  Computes  the time averaged mean velocity  \f$ u_{mean}=\frac{1}{N}\sum\limits_{i=1}^n u_{i} \f$  and RMS of fluctuations. You need to calculate a square root before plotting RMS. <br>
-//           
-//! \author  Sonja Uphoff, Kostyantyn Kucher 
-// \f$ u_{mean}=\frac{1}{N}\sum\limits_{i=1}^n u_{i} \f$
-class AverageValuesCoProcessor : public CoProcessor
-{
-public:
-   AverageValuesCoProcessor();
-   AverageValuesCoProcessor(SPtr<Grid3D> grid, const std::string& path, WbWriter* const writer,
-       SPtr<UbScheduler> s, SPtr<UbScheduler> Avs, SPtr<UbScheduler> rsMeans, SPtr<UbScheduler> rsRMS, bool restart);
-	//! Make update
-	void process(double step); 
-	//! Resets averaged velocity and RMS-values according to ResetSceduler
-	void reset(double step); 
-protected:
-	//! Prepare data and write in .vtk file
-	void collectData(double step);
-	//! Reset data
-	void resetDataRMS(double step);
-	void resetDataMeans(double step);
-	//! prepare data
-	void addData(const SPtr<Block3D> block);
-	void clearData();
-	//! Computes average and RMS values of macroscopic quantities 
-	void calculateAverageValues(double timeStep);
-	////! write .txt file spatial intergrated averaged value, fluctuation, porous features
-	//void collectPlotDataZ(double step);
-	////! create txt file and write head line 
-	//void initPlotDataZ(double step);
-
-private:
-	std::vector<UbTupleFloat3> nodes;
-	std::vector<UbTupleUInt8> cells;
-	std::vector<std::string> datanames;
-	std::vector<std::vector<double> > data; 
-	std::vector<std::vector<SPtr<Block3D>> > blockVector;
-	int minInitLevel; //min init level
-	int maxInitLevel;
-	int gridRank;
-	int resetStepRMS;
-	int resetStepMeans;
-	double averageInterval;
-	std::string path;
-	WbWriter* writer;
-   bool restart, compressible;
-   SPtr<UbScheduler> averageScheduler;  //additional scheduler to averaging after a given interval
-   SPtr<UbScheduler> resetSchedulerRMS;  //additional scheduler to restart averaging after a given interval
-   SPtr<UbScheduler> resetSchedulerMeans;  //additional scheduler to restart averaging after a given interval
-	//labels for the different components, e.g. AvVxx for time averaged RMS: 1/n SUM((U-Umean)^2)
-   //you need to calculate a square root before plotting RMS
-	enum Values{AvVx = 0, AvVy = 1, AvVz = 2, AvVxx = 3, AvVyy = 4, AvVzz = 5, AvVxy = 6, AvVxz = 7, AvVyz = 8, AvP = 9, AvPrms = 10}; 
-
-   typedef void (*CalcMacrosFct)(const LBMReal* const& /*feq[27]*/,LBMReal& /*(d)rho*/, LBMReal& /*vx1*/, LBMReal& /*vx2*/, LBMReal& /*vx3*/);
-   CalcMacrosFct calcMacros;
-};
-#endif
+#ifndef AverageValuesCoProcessor_H
+#define AverageValuesCoProcessor_H
+
+#include <PointerDefinitions.h>
+#include <vector>
+#include <string>
+
+#include "CoProcessor.h"
+#include "LBMSystem.h"
+#include "UbTuple.h"
+
+class UbScheduler;
+class WbWriter;
+class Grid3D;
+class Block3D;
+
+//! \brief  Computes the time averaged mean velocity and RMS values and writes to parallel .vtk
+//! \details writes at given time intervals specified in scheduler (s), does averaging according to scheduler (Avs) and resets according to scheduler (rs).  <br>
+//!  Computes  the time averaged mean velocity  \f$ u_{mean}=\frac{1}{N}\sum\limits_{i=1}^n u_{i} \f$  and RMS of fluctuations. You need to calculate a square root before plotting RMS. <br>
+//           
+//! \author  Sonja Uphoff, Kostyantyn Kucher 
+// \f$ u_{mean}=\frac{1}{N}\sum\limits_{i=1}^n u_{i} \f$
+class AverageValuesCoProcessor : public CoProcessor
+{
+public:
+   AverageValuesCoProcessor();
+   AverageValuesCoProcessor(SPtr<Grid3D> grid, const std::string& path, WbWriter* const writer,
+       SPtr<UbScheduler> s, SPtr<UbScheduler> Avs, SPtr<UbScheduler> rsMeans, SPtr<UbScheduler> rsRMS, bool restart);
+	//! Make update
+	void process(double step); 
+	//! Resets averaged velocity and RMS-values according to ResetSceduler
+	void reset(double step); 
+protected:
+	//! Prepare data and write in .vtk file
+	void collectData(double step);
+	//! Reset data
+	void resetDataRMS(double step);
+	void resetDataMeans(double step);
+	//! prepare data
+	void addData(const SPtr<Block3D> block);
+	void clearData();
+	//! Computes average and RMS values of macroscopic quantities 
+	void calculateAverageValues(double timeStep);
+	////! write .txt file spatial intergrated averaged value, fluctuation, porous features
+	//void collectPlotDataZ(double step);
+	////! create txt file and write head line 
+	//void initPlotDataZ(double step);
+
+private:
+	std::vector<UbTupleFloat3> nodes;
+	std::vector<UbTupleUInt8> cells;
+	std::vector<std::string> datanames;
+	std::vector<std::vector<double> > data; 
+	std::vector<std::vector<SPtr<Block3D>> > blockVector;
+	int minInitLevel; //min init level
+	int maxInitLevel;
+	int gridRank;
+	int resetStepRMS;
+	int resetStepMeans;
+	double averageInterval;
+	std::string path;
+	WbWriter* writer;
+   bool restart, compressible;
+   SPtr<UbScheduler> averageScheduler;  //additional scheduler to averaging after a given interval
+   SPtr<UbScheduler> resetSchedulerRMS;  //additional scheduler to restart averaging after a given interval
+   SPtr<UbScheduler> resetSchedulerMeans;  //additional scheduler to restart averaging after a given interval
+	//labels for the different components, e.g. AvVxx for time averaged RMS: 1/n SUM((U-Umean)^2)
+   //you need to calculate a square root before plotting RMS
+	enum Values{AvVx = 0, AvVy = 1, AvVz = 2, AvVxx = 3, AvVyy = 4, AvVzz = 5, AvVxy = 6, AvVxz = 7, AvVyz = 8, AvP = 9, AvPrms = 10}; 
+
+   typedef void (*CalcMacrosFct)(const LBMReal* const& /*feq[27]*/,LBMReal& /*(d)rho*/, LBMReal& /*vx1*/, LBMReal& /*vx2*/, LBMReal& /*vx3*/);
+   CalcMacrosFct calcMacros;
+};
+#endif
diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/CalculateForcesCoProcessor.cpp b/src/cpu/VirtualFluidsCore/CoProcessors/CalculateForcesCoProcessor.cpp
index 23cb672be37923238ba9fdabd9f610add6bef9f0..7ed5957b805a7e4cf60d5f0888034b06d5822302 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/CalculateForcesCoProcessor.cpp
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/CalculateForcesCoProcessor.cpp
@@ -1,243 +1,243 @@
-#include "CalculateForcesCoProcessor.h"
-#include "BCProcessor.h"
-
-#include "Communicator.h"
-#include "D3Q27Interactor.h"
-#include "UbScheduler.h"
-#include "Grid3D.h"
-#include "BoundaryConditions.h"
-#include "DataSet3D.h"
-#include "Block3D.h"
-#include "LBMKernel.h"
-#include "BCArray3D.h"
-#include "EsoTwist3D.h"
-#include "DistributionArray3D.h"
-
-CalculateForcesCoProcessor::CalculateForcesCoProcessor( SPtr<Grid3D> grid, SPtr<UbScheduler> s, 
-                                                    const std::string &path,
-                                                    SPtr<Communicator> comm ,
-                                                    double v, double a) : 
-                                                    CoProcessor(grid, s),
-                                                    path(path), comm(comm),
-                                                    v(v), a(a),
-                                                    forceX1global(0), forceX2global(0), forceX3global(0)
-{
-   if (comm->getProcessID() == comm->getRoot())
-   {
-      std::ofstream ostr;
-      std::string fname = path;
-      ostr.open(fname.c_str(), std::ios_base::out | std::ios_base::app);
-      if(!ostr)
-      { 
-         ostr.clear();
-         std::string path = UbSystem::getPathFromString(fname);
-         if(path.size()>0){ UbSystem::makeDirectory(path); ostr.open(fname.c_str(), std::ios_base::out | std::ios_base::app);}
-         if(!ostr) throw UbException(UB_EXARGS,"couldn't open file "+fname);
-      }
-      ostr.width(12);
-      ostr << "step" << "\t";
-      ostr.width(12);
-      ostr << "Cx" << "\t";
-      ostr.width(12);
-      ostr << "Cy"  << "\t"; 
-      ostr.width(12);   
-      ostr << "Cz" << "\t";
-      ostr.width(12); 
-      ostr << "Fx" << "\t";
-      ostr.width(12); 
-      ostr << "Fy" << "\t";
-      ostr.width(12);
-      ostr << "Fz" << std::endl;
-      ostr.close();
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-CalculateForcesCoProcessor::~CalculateForcesCoProcessor()
-{
-
-}
-//////////////////////////////////////////////////////////////////////////
-void CalculateForcesCoProcessor::process( double step )
-{
-   if(scheduler->isDue(step) )
-      collectData(step);
-
-   UBLOG(logDEBUG3, "D3Q27ForcesCoProcessor::update:" << step);
-}
-//////////////////////////////////////////////////////////////////////////
-void CalculateForcesCoProcessor::collectData( double step )
-{
-   calculateForces();
-
-   if (comm->getProcessID() == comm->getRoot())
-   {
-      int istep = static_cast<int>(step);
-      std::ofstream ostr;
-      std::string fname = path;
-      ostr.open(fname.c_str(), std::ios_base::out | std::ios_base::app);
-      if(!ostr)
-      { 
-         ostr.clear();
-         std::string path = UbSystem::getPathFromString(fname);
-         if(path.size()>0){ UbSystem::makeDirectory(path); ostr.open(fname.c_str(), std::ios_base::out | std::ios_base::app);}
-         if(!ostr) throw UbException(UB_EXARGS,"couldn't open file "+fname);
-      }
-
-      calculateCoefficients();
-
-      ostr.width(12); 
-      ostr.setf(std::ios::fixed); 
-      ostr << istep << "\t";
-      write(&ostr, C1, (char*)"\t");
-      write(&ostr, C2, (char*)"\t");
-      write(&ostr, C3, (char*)"\t");
-      write(&ostr, forceX1global, (char*)"\t");
-      write(&ostr, forceX2global, (char*)"\t");
-      write(&ostr, forceX3global, (char*)"\t");
-      ostr << std::endl;
-      ostr.close();
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-void CalculateForcesCoProcessor::calculateForces()
-{
-   forceX1global = 0.0;
-   forceX2global = 0.0;
-   forceX3global = 0.0;
-
-   for(SPtr<D3Q27Interactor> interactor : interactors)
-   {
-      for(BcNodeIndicesMap::value_type t : interactor->getBcNodeIndicesMap())
-      {
-         double forceX1 = 0.0;
-         double forceX2 = 0.0;
-         double forceX3 = 0.0;
-
-         SPtr<Block3D> block = t.first;
-         std::set< std::vector<int> >& transNodeIndicesSet = t.second;
-
-         SPtr<ILBMKernel> kernel = block->getKernel();
-         SPtr<BCArray3D> bcArray = kernel->getBCProcessor()->getBCArray();          
-         SPtr<DistributionArray3D> distributions = kernel->getDataSet()->getFdistributions(); 
-         distributions->swap();
-
-         int ghostLayerWidth = kernel->getGhostLayerWidth();
-         int minX1 = ghostLayerWidth;
-         int maxX1 = (int)bcArray->getNX1() - 1 - ghostLayerWidth;
-         int minX2 = ghostLayerWidth;
-         int maxX2 = (int)bcArray->getNX2() - 1 - ghostLayerWidth;
-         int minX3 = ghostLayerWidth;
-         int maxX3 = (int)bcArray->getNX3() - 1 - ghostLayerWidth;
-
-         for(std::vector<int> node : transNodeIndicesSet)
-         {
-            int x1 = node[0];
-            int x2 = node[1];
-            int x3 = node[2];
-
-            //without ghost nodes
-            if (x1 < minX1 || x1 > maxX1 || x2 < minX2 || x2 > maxX2 ||x3 < minX3 || x3 > maxX3 ) continue;
-
-            if(bcArray->isFluid(x1,x2,x3)) //es kann sein, dass der node von einem anderen interactor z.B. als solid gemarkt wurde!!!
-            {
-               SPtr<BoundaryConditions> bc = bcArray->getBC(x1,x2,x3);
-               UbTupleDouble3 forceVec = getForces(x1,x2,x3,distributions,bc);
-               forceX1 += val<1>(forceVec);
-               forceX2 += val<2>(forceVec);
-               forceX3 += val<3>(forceVec);
-            }
-         }
-         //if we have got discretization with more level
-         // deltaX is LBM deltaX and equal LBM deltaT 
-         double deltaX = LBMSystem::getDeltaT(block->getLevel()); //grid->getDeltaT(block);
-         double deltaXquadrat = deltaX*deltaX;
-         forceX1 *= deltaXquadrat;
-         forceX2 *= deltaXquadrat;
-         forceX3 *= deltaXquadrat;
-
-         distributions->swap();
-
-         forceX1global += forceX1;
-         forceX2global += forceX2;
-         forceX3global += forceX3;
-      }
-   }
-   std::vector<double> values;
-   std::vector<double> rvalues;
-   values.push_back(forceX1global);
-   values.push_back(forceX2global);
-   values.push_back(forceX3global);
-
-   rvalues = comm->gather(values);
-   if (comm->getProcessID() == comm->getRoot())
-   {
-      forceX1global = 0.0;
-      forceX2global = 0.0;
-      forceX3global = 0.0;
-      
-      for (int i = 0; i < (int)rvalues.size(); i+=3)
-      {
-         forceX1global += rvalues[i];
-         forceX2global += rvalues[i+1];
-         forceX3global += rvalues[i+2];
-      }
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-UbTupleDouble3 CalculateForcesCoProcessor::getForces(int x1, int x2, int x3,  SPtr<DistributionArray3D> distributions, SPtr<BoundaryConditions> bc)
-{
-   UbTupleDouble3 force(0.0,0.0,0.0);
-   
-   if(bc)
-   {
-      //references to tuple "force"
-      double& forceX1 = val<1>(force);
-      double& forceX2 = val<2>(force);
-      double& forceX3 = val<3>(force);
-      double f,  fnbr;
-
-      for(int fdir=D3Q27System::FSTARTDIR; fdir<=D3Q27System::FENDDIR; fdir++)
-      {
-         if(bc->hasNoSlipBoundaryFlag(fdir))
-         {
-            const int invDir = D3Q27System::INVDIR[fdir];
-            f = dynamicPointerCast<EsoTwist3D>(distributions)->getDistributionInvForDirection(x1, x2, x3, invDir);
-            fnbr = dynamicPointerCast<EsoTwist3D>(distributions)->getDistributionInvForDirection(x1+D3Q27System::DX1[invDir], x2+D3Q27System::DX2[invDir], x3+D3Q27System::DX3[invDir], fdir);
-
-            forceX1 += (f + fnbr)*D3Q27System::DX1[invDir];
-            forceX2 += (f + fnbr)*D3Q27System::DX2[invDir];
-            forceX3 += (f + fnbr)*D3Q27System::DX3[invDir];
-         }
-      }
-   }
-   
-   return force;
-}
-//////////////////////////////////////////////////////////////////////////
-void CalculateForcesCoProcessor::calculateCoefficients()
-{
-   double F1 = forceX1global;
-   double F2 = forceX2global;
-   double F3 = forceX3global;
-   
-   //return 2*F/(rho*v*v*a); 
-   C1 = 2.0*F1/(v*v*a);
-   C2 = 2.0*F2/(v*v*a);
-   C3 = 2.0*F3/(v*v*a);
-}
-//////////////////////////////////////////////////////////////////////////
-void CalculateForcesCoProcessor::addInteractor( SPtr<D3Q27Interactor> interactor )
-{
-   interactors.push_back(interactor);
-}
-//////////////////////////////////////////////////////////////////////////
-void CalculateForcesCoProcessor::write(std::ofstream *fileObject, double value, char *separator) 
-{ 
-   (*fileObject).width(12); 
-   //(*fileObject).precision(2); 
-   (*fileObject).setf(std::ios::fixed); 
-   (*fileObject) << value; 
-   (*fileObject) << separator; 
-} 
-
-
+#include "CalculateForcesCoProcessor.h"
+#include "BCProcessor.h"
+
+#include "Communicator.h"
+#include "D3Q27Interactor.h"
+#include "UbScheduler.h"
+#include "Grid3D.h"
+#include "BoundaryConditions.h"
+#include "DataSet3D.h"
+#include "Block3D.h"
+#include "LBMKernel.h"
+#include "BCArray3D.h"
+#include "EsoTwist3D.h"
+#include "DistributionArray3D.h"
+
+CalculateForcesCoProcessor::CalculateForcesCoProcessor( SPtr<Grid3D> grid, SPtr<UbScheduler> s, 
+                                                    const std::string &path,
+                                                    SPtr<Communicator> comm ,
+                                                    double v, double a) : 
+                                                    CoProcessor(grid, s),
+                                                    path(path), comm(comm),
+                                                    v(v), a(a),
+                                                    forceX1global(0), forceX2global(0), forceX3global(0)
+{
+   if (comm->getProcessID() == comm->getRoot())
+   {
+      std::ofstream ostr;
+      std::string fname = path;
+      ostr.open(fname.c_str(), std::ios_base::out | std::ios_base::app);
+      if(!ostr)
+      { 
+         ostr.clear();
+         std::string path = UbSystem::getPathFromString(fname);
+         if(path.size()>0){ UbSystem::makeDirectory(path); ostr.open(fname.c_str(), std::ios_base::out | std::ios_base::app);}
+         if(!ostr) throw UbException(UB_EXARGS,"couldn't open file "+fname);
+      }
+      ostr.width(12);
+      ostr << "step" << "\t";
+      ostr.width(12);
+      ostr << "Cx" << "\t";
+      ostr.width(12);
+      ostr << "Cy"  << "\t"; 
+      ostr.width(12);   
+      ostr << "Cz" << "\t";
+      ostr.width(12); 
+      ostr << "Fx" << "\t";
+      ostr.width(12); 
+      ostr << "Fy" << "\t";
+      ostr.width(12);
+      ostr << "Fz" << std::endl;
+      ostr.close();
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+CalculateForcesCoProcessor::~CalculateForcesCoProcessor()
+{
+
+}
+//////////////////////////////////////////////////////////////////////////
+void CalculateForcesCoProcessor::process( double step )
+{
+   if(scheduler->isDue(step) )
+      collectData(step);
+
+   UBLOG(logDEBUG3, "D3Q27ForcesCoProcessor::update:" << step);
+}
+//////////////////////////////////////////////////////////////////////////
+void CalculateForcesCoProcessor::collectData( double step )
+{
+   calculateForces();
+
+   if (comm->getProcessID() == comm->getRoot())
+   {
+      int istep = static_cast<int>(step);
+      std::ofstream ostr;
+      std::string fname = path;
+      ostr.open(fname.c_str(), std::ios_base::out | std::ios_base::app);
+      if(!ostr)
+      { 
+         ostr.clear();
+         std::string path = UbSystem::getPathFromString(fname);
+         if(path.size()>0){ UbSystem::makeDirectory(path); ostr.open(fname.c_str(), std::ios_base::out | std::ios_base::app);}
+         if(!ostr) throw UbException(UB_EXARGS,"couldn't open file "+fname);
+      }
+
+      calculateCoefficients();
+
+      ostr.width(12); 
+      ostr.setf(std::ios::fixed); 
+      ostr << istep << "\t";
+      write(&ostr, C1, (char*)"\t");
+      write(&ostr, C2, (char*)"\t");
+      write(&ostr, C3, (char*)"\t");
+      write(&ostr, forceX1global, (char*)"\t");
+      write(&ostr, forceX2global, (char*)"\t");
+      write(&ostr, forceX3global, (char*)"\t");
+      ostr << std::endl;
+      ostr.close();
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+void CalculateForcesCoProcessor::calculateForces()
+{
+   forceX1global = 0.0;
+   forceX2global = 0.0;
+   forceX3global = 0.0;
+
+   for(SPtr<D3Q27Interactor> interactor : interactors)
+   {
+      for(BcNodeIndicesMap::value_type t : interactor->getBcNodeIndicesMap())
+      {
+         double forceX1 = 0.0;
+         double forceX2 = 0.0;
+         double forceX3 = 0.0;
+
+         SPtr<Block3D> block = t.first;
+         std::set< std::vector<int> >& transNodeIndicesSet = t.second;
+
+         SPtr<ILBMKernel> kernel = block->getKernel();
+         SPtr<BCArray3D> bcArray = kernel->getBCProcessor()->getBCArray();          
+         SPtr<DistributionArray3D> distributions = kernel->getDataSet()->getFdistributions(); 
+         distributions->swap();
+
+         int ghostLayerWidth = kernel->getGhostLayerWidth();
+         int minX1 = ghostLayerWidth;
+         int maxX1 = (int)bcArray->getNX1() - 1 - ghostLayerWidth;
+         int minX2 = ghostLayerWidth;
+         int maxX2 = (int)bcArray->getNX2() - 1 - ghostLayerWidth;
+         int minX3 = ghostLayerWidth;
+         int maxX3 = (int)bcArray->getNX3() - 1 - ghostLayerWidth;
+
+         for(std::vector<int> node : transNodeIndicesSet)
+         {
+            int x1 = node[0];
+            int x2 = node[1];
+            int x3 = node[2];
+
+            //without ghost nodes
+            if (x1 < minX1 || x1 > maxX1 || x2 < minX2 || x2 > maxX2 ||x3 < minX3 || x3 > maxX3 ) continue;
+
+            if(bcArray->isFluid(x1,x2,x3)) //es kann sein, dass der node von einem anderen interactor z.B. als solid gemarkt wurde!!!
+            {
+               SPtr<BoundaryConditions> bc = bcArray->getBC(x1,x2,x3);
+               UbTupleDouble3 forceVec = getForces(x1,x2,x3,distributions,bc);
+               forceX1 += val<1>(forceVec);
+               forceX2 += val<2>(forceVec);
+               forceX3 += val<3>(forceVec);
+            }
+         }
+         //if we have got discretization with more level
+         // deltaX is LBM deltaX and equal LBM deltaT 
+         double deltaX = LBMSystem::getDeltaT(block->getLevel()); //grid->getDeltaT(block);
+         double deltaXquadrat = deltaX*deltaX;
+         forceX1 *= deltaXquadrat;
+         forceX2 *= deltaXquadrat;
+         forceX3 *= deltaXquadrat;
+
+         distributions->swap();
+
+         forceX1global += forceX1;
+         forceX2global += forceX2;
+         forceX3global += forceX3;
+      }
+   }
+   std::vector<double> values;
+   std::vector<double> rvalues;
+   values.push_back(forceX1global);
+   values.push_back(forceX2global);
+   values.push_back(forceX3global);
+
+   rvalues = comm->gather(values);
+   if (comm->getProcessID() == comm->getRoot())
+   {
+      forceX1global = 0.0;
+      forceX2global = 0.0;
+      forceX3global = 0.0;
+      
+      for (int i = 0; i < (int)rvalues.size(); i+=3)
+      {
+         forceX1global += rvalues[i];
+         forceX2global += rvalues[i+1];
+         forceX3global += rvalues[i+2];
+      }
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+UbTupleDouble3 CalculateForcesCoProcessor::getForces(int x1, int x2, int x3,  SPtr<DistributionArray3D> distributions, SPtr<BoundaryConditions> bc)
+{
+   UbTupleDouble3 force(0.0,0.0,0.0);
+   
+   if(bc)
+   {
+      //references to tuple "force"
+      double& forceX1 = val<1>(force);
+      double& forceX2 = val<2>(force);
+      double& forceX3 = val<3>(force);
+      double f,  fnbr;
+
+      for(int fdir=D3Q27System::FSTARTDIR; fdir<=D3Q27System::FENDDIR; fdir++)
+      {
+         if(bc->hasNoSlipBoundaryFlag(fdir))
+         {
+            const int invDir = D3Q27System::INVDIR[fdir];
+            f = dynamicPointerCast<EsoTwist3D>(distributions)->getDistributionInvForDirection(x1, x2, x3, invDir);
+            fnbr = dynamicPointerCast<EsoTwist3D>(distributions)->getDistributionInvForDirection(x1+D3Q27System::DX1[invDir], x2+D3Q27System::DX2[invDir], x3+D3Q27System::DX3[invDir], fdir);
+
+            forceX1 += (f + fnbr)*D3Q27System::DX1[invDir];
+            forceX2 += (f + fnbr)*D3Q27System::DX2[invDir];
+            forceX3 += (f + fnbr)*D3Q27System::DX3[invDir];
+         }
+      }
+   }
+   
+   return force;
+}
+//////////////////////////////////////////////////////////////////////////
+void CalculateForcesCoProcessor::calculateCoefficients()
+{
+   double F1 = forceX1global;
+   double F2 = forceX2global;
+   double F3 = forceX3global;
+   
+   //return 2*F/(rho*v*v*a); 
+   C1 = 2.0*F1/(v*v*a);
+   C2 = 2.0*F2/(v*v*a);
+   C3 = 2.0*F3/(v*v*a);
+}
+//////////////////////////////////////////////////////////////////////////
+void CalculateForcesCoProcessor::addInteractor( SPtr<D3Q27Interactor> interactor )
+{
+   interactors.push_back(interactor);
+}
+//////////////////////////////////////////////////////////////////////////
+void CalculateForcesCoProcessor::write(std::ofstream *fileObject, double value, char *separator) 
+{ 
+   (*fileObject).width(12); 
+   //(*fileObject).precision(2); 
+   (*fileObject).setf(std::ios::fixed); 
+   (*fileObject) << value; 
+   (*fileObject) << separator; 
+} 
+
+
diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/CalculateForcesCoProcessor.h b/src/cpu/VirtualFluidsCore/CoProcessors/CalculateForcesCoProcessor.h
index 47727f9322d51843c7f87633fff9085963bc6a53..165f42402a2bad234d2c0d98ed40d4bfc64c787a 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/CalculateForcesCoProcessor.h
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/CalculateForcesCoProcessor.h
@@ -1,58 +1,58 @@
-/*
- *  D3Q27ForcesCoProcessor.h
- *
- *  Created on: 29.09.2012
- *  Author: K. Kucher
- */
-
-#ifndef D3Q27ForcesCoProcessor_H
-#define D3Q27ForcesCoProcessor_H
-
-#include <PointerDefinitions.h>
-#include <string>
-#include <vector>
-
-#include "CoProcessor.h"
-#include "UbTuple.h"
-
-class ForceCalculator;
-class Communicator;
-class Grid3D;
-class UbScheduler;
-class D3Q27Interactor;
-class DistributionArray3D;
-class BoundaryConditions;
-
-class CalculateForcesCoProcessor: public CoProcessor 
-{
-public:
-   //! Constructor
-   //! \param v - velocity of fluid in LB units
-   //! \param a - area of object in LB units
-   CalculateForcesCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path,
-       SPtr<Communicator> comm, double v, double a);
-	virtual ~CalculateForcesCoProcessor();             
-	void process(double step); 
-   void addInteractor(SPtr<D3Q27Interactor> interactor);
-protected:
-	void collectData(double step);
-   void calculateForces();
-   UbTupleDouble3 getForces(int x1, int x2, int x3, SPtr<DistributionArray3D> distributions, SPtr<BoundaryConditions> bc);
-   void calculateCoefficients();
-   void write(std::ofstream *fileObject, double value, char *separator);
-private:
-   std::string path;
-   SPtr<Communicator> comm;
-   std::vector<SPtr<D3Q27Interactor> > interactors;
-   double forceX1global;
-   double forceX2global;
-   double forceX3global;
-   double v;     //!< is the speed of the object relative to the fluid
-   double a;     //!< is the reference area
-   double C1;
-   double C2;
-   double C3;
-};
-
-
-#endif /* D3Q27ForcesCoProcessor_H */
+/*
+ *  D3Q27ForcesCoProcessor.h
+ *
+ *  Created on: 29.09.2012
+ *  Author: K. Kucher
+ */
+
+#ifndef D3Q27ForcesCoProcessor_H
+#define D3Q27ForcesCoProcessor_H
+
+#include <PointerDefinitions.h>
+#include <string>
+#include <vector>
+
+#include "CoProcessor.h"
+#include "UbTuple.h"
+
+class ForceCalculator;
+class Communicator;
+class Grid3D;
+class UbScheduler;
+class D3Q27Interactor;
+class DistributionArray3D;
+class BoundaryConditions;
+
+class CalculateForcesCoProcessor: public CoProcessor 
+{
+public:
+   //! Constructor
+   //! \param v - velocity of fluid in LB units
+   //! \param a - area of object in LB units
+   CalculateForcesCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path,
+       SPtr<Communicator> comm, double v, double a);
+	virtual ~CalculateForcesCoProcessor();             
+	void process(double step); 
+   void addInteractor(SPtr<D3Q27Interactor> interactor);
+protected:
+	void collectData(double step);
+   void calculateForces();
+   UbTupleDouble3 getForces(int x1, int x2, int x3, SPtr<DistributionArray3D> distributions, SPtr<BoundaryConditions> bc);
+   void calculateCoefficients();
+   void write(std::ofstream *fileObject, double value, char *separator);
+private:
+   std::string path;
+   SPtr<Communicator> comm;
+   std::vector<SPtr<D3Q27Interactor> > interactors;
+   double forceX1global;
+   double forceX2global;
+   double forceX3global;
+   double v;     //!< is the speed of the object relative to the fluid
+   double a;     //!< is the reference area
+   double C1;
+   double C2;
+   double C3;
+};
+
+
+#endif /* D3Q27ForcesCoProcessor_H */
diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/DecreaseViscosityCoProcessor.cpp b/src/cpu/VirtualFluidsCore/CoProcessors/DecreaseViscosityCoProcessor.cpp
index 754c756df54418cd964061f572b6a3fbf7e6f1ef..c06dccb3ef008c9247e298e06ad4792a18197cb5 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/DecreaseViscosityCoProcessor.cpp
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/DecreaseViscosityCoProcessor.cpp
@@ -1,83 +1,83 @@
-/*
-*  DecreaseViscosityCoProcessor
-*
-*  Created on: 10.05.2013
-*  Author: uphoff
-*/
-
-#include "DecreaseViscosityCoProcessor.h"
-
-#include <vector>
-
-#include "LBMKernel.h"
-#include "Communicator.h"
-#include "UbScheduler.h"
-#include "Grid3D.h"
-#include "Block3D.h"
-
-DecreaseViscosityCoProcessor::DecreaseViscosityCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s,
-                                                               mu::Parser* nueFunc, SPtr<Communicator> comm)
-
-                                                               : CoProcessor(grid, s)
-                                                               ,nueFunc(nueFunc)
-                                                               ,comm(comm)
-{
-   if (comm->getProcessID() == comm->getRoot())
-   {
-
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-DecreaseViscosityCoProcessor::~DecreaseViscosityCoProcessor() 
-{
-}
-//////////////////////////////////////////////////////////////////////////
-void DecreaseViscosityCoProcessor::process(double step)
-{
-   if(scheduler->isDue(step) )
-      setViscosity(step);
-}
-//////////////////////////////////////////////////////////////////////////
-void DecreaseViscosityCoProcessor::setViscosity(double step)
-{
-
-   UBLOG(logDEBUG3, "DecreaseViscosityCoProcessor::update:" << step);
-   int gridRank = grid->getRank();
-   int minInitLevel = this->grid->getCoarsestInitializedLevel();
-   int maxInitLevel = this->grid->getFinestInitializedLevel();
-
-   if (comm->getProcessID() == comm->getRoot())
-   {
-
-      for(int level = minInitLevel; level<=maxInitLevel;level++)
-      {
-         std::vector<SPtr<Block3D>> blockVector;
-         grid->getBlocks(level, gridRank, blockVector);
-         for(SPtr<Block3D> block : blockVector)
-         {
-            SPtr<ILBMKernel> kernel = block->getKernel();
-         }
-      }
-
-      int istep = static_cast<int>(step);
-      this->timeStep       = istep;
-      nueFunc->DefineVar("t" , &this->timeStep);
-      double nue=nueFunc->Eval();
-
-      for(int level = minInitLevel; level<=maxInitLevel;level++)
-      {
-          std::vector<SPtr<Block3D>> blockVector;
-         grid->getBlocks(level, gridRank, blockVector);
-         for(SPtr<Block3D> block : blockVector)
-         {
-            SPtr<ILBMKernel> kernel =block->getKernel();
-            if(kernel)      
-            {
-               LBMReal collFactor = LBMSystem::calcCollisionFactor(nue, block->getLevel());
-               kernel->setCollisionFactor(collFactor);
-            }
-         }
-      }
-
-   }
-}
+/*
+*  DecreaseViscosityCoProcessor
+*
+*  Created on: 10.05.2013
+*  Author: uphoff
+*/
+
+#include "DecreaseViscosityCoProcessor.h"
+
+#include <vector>
+
+#include "LBMKernel.h"
+#include "Communicator.h"
+#include "UbScheduler.h"
+#include "Grid3D.h"
+#include "Block3D.h"
+
+DecreaseViscosityCoProcessor::DecreaseViscosityCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s,
+                                                               mu::Parser* nueFunc, SPtr<Communicator> comm)
+
+                                                               : CoProcessor(grid, s)
+                                                               ,nueFunc(nueFunc)
+                                                               ,comm(comm)
+{
+   if (comm->getProcessID() == comm->getRoot())
+   {
+
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+DecreaseViscosityCoProcessor::~DecreaseViscosityCoProcessor() 
+{
+}
+//////////////////////////////////////////////////////////////////////////
+void DecreaseViscosityCoProcessor::process(double step)
+{
+   if(scheduler->isDue(step) )
+      setViscosity(step);
+}
+//////////////////////////////////////////////////////////////////////////
+void DecreaseViscosityCoProcessor::setViscosity(double step)
+{
+
+   UBLOG(logDEBUG3, "DecreaseViscosityCoProcessor::update:" << step);
+   int gridRank = grid->getRank();
+   int minInitLevel = this->grid->getCoarsestInitializedLevel();
+   int maxInitLevel = this->grid->getFinestInitializedLevel();
+
+   if (comm->getProcessID() == comm->getRoot())
+   {
+
+      for(int level = minInitLevel; level<=maxInitLevel;level++)
+      {
+         std::vector<SPtr<Block3D>> blockVector;
+         grid->getBlocks(level, gridRank, blockVector);
+         for(SPtr<Block3D> block : blockVector)
+         {
+            SPtr<ILBMKernel> kernel = block->getKernel();
+         }
+      }
+
+      int istep = static_cast<int>(step);
+      this->timeStep       = istep;
+      nueFunc->DefineVar("t" , &this->timeStep);
+      double nue=nueFunc->Eval();
+
+      for(int level = minInitLevel; level<=maxInitLevel;level++)
+      {
+          std::vector<SPtr<Block3D>> blockVector;
+         grid->getBlocks(level, gridRank, blockVector);
+         for(SPtr<Block3D> block : blockVector)
+         {
+            SPtr<ILBMKernel> kernel =block->getKernel();
+            if(kernel)      
+            {
+               LBMReal collFactor = LBMSystem::calcCollisionFactor(nue, block->getLevel());
+               kernel->setCollisionFactor(collFactor);
+            }
+         }
+      }
+
+   }
+}
diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/DecreaseViscosityCoProcessor.h b/src/cpu/VirtualFluidsCore/CoProcessors/DecreaseViscosityCoProcessor.h
index e43122da46238665bb9c0123a480ec5f0ed71d1f..75551388a852656af24043cb5b2ef16edb9477db 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/DecreaseViscosityCoProcessor.h
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/DecreaseViscosityCoProcessor.h
@@ -1,48 +1,48 @@
-#ifndef DecreaseViscosityCoProcessor_H
-#define DecreaseViscosityCoProcessor_H
-
-#include <PointerDefinitions.h>
-
-#include "CoProcessor.h"
-#include "IntegrateValuesHelper.h"
-#include "LBMUnitConverter.h"
-
-#include "muParser.h"
-
-
-class UbScheduler;
-class Grid3D;
-class Communicator;
-
-//! \brief The class sets viscosity/collision factor according to a previously defined function in time. 
-//! \details initialization in test case (example): 
-//! \code{.cpp}
-//! mu::Parser decrViscFunc;                       //define a mu-parser function 
-//! decrViscFunc.SetExpr("nue0+c0/(t+1)/(t+1)");   //this function is time-dependent, the viscosity decreases a 1/t^2 
-//! decrViscFunc.DefineConst("nue0", nueLB);       
-//! decrViscFunc.DefineConst("c0", 0.1);           //constants such as c0 controll how fast the viscosity decreasis 
-//! SPtr<UbScheduler> DecrViscSch(new UbScheduler()); //the CoProcessor is called according to a Scheduler
-//! DecrViscSch->addSchedule(10,10,1000);          //in this case the viscosity is reset every 10 timesteps for the first 1000 timesteps 
-//! DecreaseViscosityCoProcessor decrViscPPPtr(grid, DecrViscSch,&decrViscFunc, comm); 
-//! \endcode
-//! \author Sonja Uphoff
-
-class DecreaseViscosityCoProcessor: public CoProcessor 
-{ 
-public:
-   DecreaseViscosityCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s,
-      mu::Parser* nueFunc, SPtr<Communicator> comm);
-   virtual ~DecreaseViscosityCoProcessor();
-   //! calls collect PostprocessData.
-   void process(double step); 
-protected:
-   //! resets the collision factor depending on the current timestep.
-   void setViscosity(double step);  
-   SPtr<Communicator>  comm;
-private:
-   mutable mu::value_type timeStep;
-   mu::Parser* nueFunc;
-};
-
-
-#endif /* DecreaseViscosityCoProcessor_H_ */
+#ifndef DecreaseViscosityCoProcessor_H
+#define DecreaseViscosityCoProcessor_H
+
+#include <PointerDefinitions.h>
+
+#include "CoProcessor.h"
+#include "IntegrateValuesHelper.h"
+#include "LBMUnitConverter.h"
+
+#include "muParser.h"
+
+
+class UbScheduler;
+class Grid3D;
+class Communicator;
+
+//! \brief The class sets viscosity/collision factor according to a previously defined function in time. 
+//! \details initialization in test case (example): 
+//! \code{.cpp}
+//! mu::Parser decrViscFunc;                       //define a mu-parser function 
+//! decrViscFunc.SetExpr("nue0+c0/(t+1)/(t+1)");   //this function is time-dependent, the viscosity decreases a 1/t^2 
+//! decrViscFunc.DefineConst("nue0", nueLB);       
+//! decrViscFunc.DefineConst("c0", 0.1);           //constants such as c0 controll how fast the viscosity decreasis 
+//! SPtr<UbScheduler> DecrViscSch(new UbScheduler()); //the CoProcessor is called according to a Scheduler
+//! DecrViscSch->addSchedule(10,10,1000);          //in this case the viscosity is reset every 10 timesteps for the first 1000 timesteps 
+//! DecreaseViscosityCoProcessor decrViscPPPtr(grid, DecrViscSch,&decrViscFunc, comm); 
+//! \endcode
+//! \author Sonja Uphoff
+
+class DecreaseViscosityCoProcessor: public CoProcessor 
+{ 
+public:
+   DecreaseViscosityCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s,
+      mu::Parser* nueFunc, SPtr<Communicator> comm);
+   virtual ~DecreaseViscosityCoProcessor();
+   //! calls collect PostprocessData.
+   void process(double step); 
+protected:
+   //! resets the collision factor depending on the current timestep.
+   void setViscosity(double step);  
+   SPtr<Communicator>  comm;
+private:
+   mutable mu::value_type timeStep;
+   mu::Parser* nueFunc;
+};
+
+
+#endif /* DecreaseViscosityCoProcessor_H_ */
diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/EmergencyExitCoProcessor.cpp b/src/cpu/VirtualFluidsCore/CoProcessors/EmergencyExitCoProcessor.cpp
index 990285d99eee578e59e1eeef0ac9d315e71d97e1..a287ada4c6193522737fe9fb147a45ef04190268 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/EmergencyExitCoProcessor.cpp
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/EmergencyExitCoProcessor.cpp
@@ -1,75 +1,75 @@
-#include "EmergencyExitCoProcessor.h"
-#include <basics/utilities/UbFileOutputASCII.h>
-#include <basics/utilities/UbFileInputASCII.h>
-#include "UbLogger.h"
-#include "UbScheduler.h"
-#include "Communicator.h"
-#include "MPIIORestartCoProcessor.h"
-#include "Grid3D.h"
-
-EmergencyExitCoProcessor::EmergencyExitCoProcessor( SPtr<Grid3D> grid, SPtr<UbScheduler> s, 
-                                                        const std::string& path, 
-                                                        SPtr<MPIIORestartCoProcessor> rp, SPtr<Communicator> comm) :
-                                                        CoProcessor(grid, s),
-                                                        path(path),
-                                                        rp(rp),
-                                                        comm(comm)
-{
-   this->path = path + "/exit";
-   metafile = this->path + "/stop.txt";
-   if (comm->getProcessID() == comm->getRoot())
-   {
-      //checkMetafile();
-      writeMetafile(false);
-   }
-   comm->barrier();
-}
-//////////////////////////////////////////////////////////////////////////
-EmergencyExitCoProcessor::~EmergencyExitCoProcessor()
-{
-
-}
-//////////////////////////////////////////////////////////////////////////
-void EmergencyExitCoProcessor::process( double step )
-{
-   if(scheduler->isDue(step) )
-      collectData(step);
-
-   UBLOG(logDEBUG3, "EmergencyExitCoProcessor::update:" << step);
-}
-
-void EmergencyExitCoProcessor::collectData( double step )
-{
-   if(readMetafile())
-   {
-      rp->process((int)step);
-      if(comm->getProcessID() == comm->getRoot()) UBLOG(logINFO,"EmergencyExitCoProcessor save step: " << step);
-      comm->barrier();
-      exit(EXIT_SUCCESS);
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-void EmergencyExitCoProcessor::writeMetafile(int status )
-{
-   UbFileOutputASCII out(metafile);
-   out.writeBool(false);
-}
-//////////////////////////////////////////////////////////////////////////
-bool EmergencyExitCoProcessor::readMetafile()
-{
-   UbFileInputASCII in(metafile);
-   return in.readBool();
-}
-//////////////////////////////////////////////////////////////////////////
-void EmergencyExitCoProcessor::checkMetafile()
-{
-   std::ifstream file(metafile.c_str()); 
-   if (!file.is_open()) 
-   {
-      writeMetafile(false);
-      return;
-   }
-   file.close();
-}
-                                                       
-
+#include "EmergencyExitCoProcessor.h"
+#include <basics/utilities/UbFileOutputASCII.h>
+#include <basics/utilities/UbFileInputASCII.h>
+#include "UbLogger.h"
+#include "UbScheduler.h"
+#include "Communicator.h"
+#include "MPIIORestartCoProcessor.h"
+#include "Grid3D.h"
+
+EmergencyExitCoProcessor::EmergencyExitCoProcessor( SPtr<Grid3D> grid, SPtr<UbScheduler> s, 
+                                                        const std::string& path, 
+                                                        SPtr<MPIIORestartCoProcessor> rp, SPtr<Communicator> comm) :
+                                                        CoProcessor(grid, s),
+                                                        path(path),
+                                                        rp(rp),
+                                                        comm(comm)
+{
+   this->path = path + "/exit";
+   metafile = this->path + "/stop.txt";
+   if (comm->getProcessID() == comm->getRoot())
+   {
+      //checkMetafile();
+      writeMetafile(false);
+   }
+   comm->barrier();
+}
+//////////////////////////////////////////////////////////////////////////
+EmergencyExitCoProcessor::~EmergencyExitCoProcessor()
+{
+
+}
+//////////////////////////////////////////////////////////////////////////
+void EmergencyExitCoProcessor::process( double step )
+{
+   if(scheduler->isDue(step) )
+      collectData(step);
+
+   UBLOG(logDEBUG3, "EmergencyExitCoProcessor::update:" << step);
+}
+
+void EmergencyExitCoProcessor::collectData( double step )
+{
+   if(readMetafile())
+   {
+      rp->process((int)step);
+      if(comm->getProcessID() == comm->getRoot()) UBLOG(logINFO,"EmergencyExitCoProcessor save step: " << step);
+      comm->barrier();
+      exit(EXIT_SUCCESS);
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+void EmergencyExitCoProcessor::writeMetafile(int status )
+{
+   UbFileOutputASCII out(metafile);
+   out.writeBool(false);
+}
+//////////////////////////////////////////////////////////////////////////
+bool EmergencyExitCoProcessor::readMetafile()
+{
+   UbFileInputASCII in(metafile);
+   return in.readBool();
+}
+//////////////////////////////////////////////////////////////////////////
+void EmergencyExitCoProcessor::checkMetafile()
+{
+   std::ifstream file(metafile.c_str()); 
+   if (!file.is_open()) 
+   {
+      writeMetafile(false);
+      return;
+   }
+   file.close();
+}
+                                                       
+
diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/EmergencyExitCoProcessor.h b/src/cpu/VirtualFluidsCore/CoProcessors/EmergencyExitCoProcessor.h
index ff1cee853c073f2854fca489eb7b823d212b7642..8d7dfd1698a552fc9f1aa5b9b6c09eee0b569bbf 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/EmergencyExitCoProcessor.h
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/EmergencyExitCoProcessor.h
@@ -1,43 +1,43 @@
-/*
- *  EmergencyExitCoProcessor.h
- *
- *  Created on: 05.10.2012
- *  Author: K. Kucher
- */
-
-#ifndef EmergencyExitCoProcessor_H
-#define EmergencyExitCoProcessor_H
-
-#include <PointerDefinitions.h>
-#include <string>
-
-#include "CoProcessor.h"
-
-class MPIIORestartCoProcessor;
-class Communicator;
-class Grid3D;
-class UbScheduler;
-
-class EmergencyExitCoProcessor : public CoProcessor
-{
-public:
-    EmergencyExitCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string& path, SPtr<MPIIORestartCoProcessor> rp, SPtr<Communicator> comm);
-    virtual ~EmergencyExitCoProcessor();
-
-    void process(double step) override;
-
-protected:
-    void collectData(double step);
-    void writeMetafile(int status);
-    bool readMetafile();
-    void checkMetafile();
-
-private:
-    std::string path;
-    SPtr<Communicator> comm;
-    SPtr<MPIIORestartCoProcessor> rp;
-    std::string metafile;
-};
-
-
-#endif /* EmergencyExitCoProcessor_H */
+/*
+ *  EmergencyExitCoProcessor.h
+ *
+ *  Created on: 05.10.2012
+ *  Author: K. Kucher
+ */
+
+#ifndef EmergencyExitCoProcessor_H
+#define EmergencyExitCoProcessor_H
+
+#include <PointerDefinitions.h>
+#include <string>
+
+#include "CoProcessor.h"
+
+class MPIIORestartCoProcessor;
+class Communicator;
+class Grid3D;
+class UbScheduler;
+
+class EmergencyExitCoProcessor : public CoProcessor
+{
+public:
+    EmergencyExitCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string& path, SPtr<MPIIORestartCoProcessor> rp, SPtr<Communicator> comm);
+    virtual ~EmergencyExitCoProcessor();
+
+    void process(double step) override;
+
+protected:
+    void collectData(double step);
+    void writeMetafile(int status);
+    bool readMetafile();
+    void checkMetafile();
+
+private:
+    std::string path;
+    SPtr<Communicator> comm;
+    SPtr<MPIIORestartCoProcessor> rp;
+    std::string metafile;
+};
+
+
+#endif /* EmergencyExitCoProcessor_H */
diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/InSituCatalystCoProcessor.cpp b/src/cpu/VirtualFluidsCore/CoProcessors/InSituCatalystCoProcessor.cpp
index 7e7ec271ad72a799a0f220d51b5cb41e75c9c32e..53916a56ee3698b4b0548b2d1bc84a00bca249df 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/InSituCatalystCoProcessor.cpp
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/InSituCatalystCoProcessor.cpp
@@ -1,349 +1,349 @@
-#ifdef VF_CATALYST
-
-#include "InSituCatalystCoProcessor.h"
-#include <LBMKernel.h>
-#include <D3Q27ETBCProcessor.h>
-#include <vector>
-#include <string>
-
-#include <vtkCellType.h>
-#include <vtkPointData.h>
-#include <vtkXMLUnstructuredGridWriter.h>
-
-#include <iostream>
-#include <fstream>
-
-using namespace std;
-
-InSituCatalystCoProcessor::InSituCatalystCoProcessor()
-{
-
-}
-//////////////////////////////////////////////////////////////////////////
-InSituCatalystCoProcessor::InSituCatalystCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, std::string script) : CoProcessor(grid, s)
-{
-   gridRank = Communicator::getInstance()->getProcessID();
-   minInitLevel = this->grid->getCoarsestInitializedLevel();
-   maxInitLevel = this->grid->getFinestInitializedLevel();
-
-   blockVector.resize(maxInitLevel + 1);
-
-   for (int level = minInitLevel; level <= maxInitLevel; level++)
-   {
-      grid->getBlocks(level, gridRank, true, blockVector[level]);
-   }
-
-   Processor = vtkSmartPointer<vtkCPProcessor>::New();
-   Processor->Initialize();
-
-   vtkNew<vtkCPPythonScriptPipeline> pipeline;
-   pipeline->Initialize(script.c_str());
-   Processor->AddPipeline(pipeline.GetPointer());
-
-   buildVTKGrid();
-}
-//////////////////////////////////////////////////////////////////////////
-InSituCatalystCoProcessor::~InSituCatalystCoProcessor()
-{
-
-}
-//////////////////////////////////////////////////////////////////////////
-void InSituCatalystCoProcessor::process(double step)
-{
-   if (scheduler->isDue(step))
-      collectData(step);
-
-   UBLOG(logDEBUG3, "InSituCatalystCoProcessor::update:" << step);
-}
-//////////////////////////////////////////////////////////////////////////
-void InSituCatalystCoProcessor::collectData(double step)
-{
-   unsigned int istep = static_cast<int>(step);
-
-   vtkNew<vtkCPDataDescription> dataDescription;
-   dataDescription->AddInput("input");
-   dataDescription->SetTimeData(step, istep);
-
-   if (Processor->RequestDataDescription(dataDescription.GetPointer()) != 0)
-   {
-      
-      index = 0;
-
-      for (int level = minInitLevel; level <= maxInitLevel; level++)
-      {
-         for(SPtr<Block3D> block : blockVector[level])
-         {
-            if (block)
-            {
-               addData(block);
-            }
-         }
-      }
-
-      vtkDoubleArray* rho = vtkDoubleArray::SafeDownCast(unstructuredGrid->GetPointData()->GetArray("Rho"));
-      rho->SetArray(&rhoArray[0], static_cast<vtkIdType>(rhoArray.size()), 1);
-
-      vtkDoubleArray* vx1 = vtkDoubleArray::SafeDownCast(unstructuredGrid->GetPointData()->GetArray("Vx"));
-      vx1->SetArray(&vx1Array[0], static_cast<vtkIdType>(vx1Array.size()), 1);
-
-      vtkDoubleArray* vx2 = vtkDoubleArray::SafeDownCast(unstructuredGrid->GetPointData()->GetArray("Vy"));
-      vx2->SetArray(&vx2Array[0], static_cast<vtkIdType>(vx2Array.size()), 1);
-
-      vtkDoubleArray* vx3 = vtkDoubleArray::SafeDownCast(unstructuredGrid->GetPointData()->GetArray("Vz"));
-      vx3->SetArray(&vx3Array[0], static_cast<vtkIdType>(vx3Array.size()), 1);
-
-      dataDescription->GetInputDescriptionByName("input")->SetGrid(unstructuredGrid);
-      Processor->CoProcess(dataDescription.GetPointer());
-   }
-
-   UBLOG(logINFO, "InSituCatalystCoProcessor step: " << istep);
-}
-//////////////////////////////////////////////////////////////////////////
-void InSituCatalystCoProcessor::addData(SPtr<Block3D> block)
-{
-   UbTupleDouble3 org = grid->getBlockWorldCoordinates(block);
-   UbTupleDouble3 blockLengths = grid->getBlockLengths(block);
-   UbTupleDouble3 nodeOffset = grid->getNodeOffset(block);
-   double         dx = grid->getDeltaX(block);
-
-   SPtr<LBMKernel> kernel = block->getKernel();
-   SPtr<BCArray3D> bcArray = kernel->getBCProcessor()->getBCArray();
-   SPtr<DistributionArray3D> distributions = kernel->getDataSet()->getFdistributions();
-   LBMReal f[D3Q27System::ENDF + 1];
-   LBMReal vx1, vx2, vx3, rho;
-
-   int minX1 = 0;
-   int minX2 = 0;
-   int minX3 = 0;
-
-   int maxX1 = (int)(distributions->getNX1());
-   int maxX2 = (int)(distributions->getNX2());
-   int maxX3 = (int)(distributions->getNX3());
-
-   //nummern vergeben und node vector erstellen + daten sammeln
-   CbArray3D<int> nodeNumbers((int)maxX1, (int)maxX2, (int)maxX3, -1);
-   maxX1 -= 2;
-   maxX2 -= 2;
-   maxX3 -= 2;
-
-   
-
-   for (size_t ix3 = minX3; ix3 <= maxX3; ix3++)
-   {
-      for (size_t ix2 = minX2; ix2 <= maxX2; ix2++)
-      {
-         for (size_t ix1 = minX1; ix1 <= maxX1; ix1++)
-         {
-            if (!bcArray->isUndefined(ix1, ix2, ix3) && !bcArray->isSolid(ix1, ix2, ix3))
-            {
-               distributions->getDistribution(f, ix1, ix2, ix3);
-               calcMacros(f, rho, vx1, vx2, vx3);
-               double press = D3Q27System::calcPress(f, rho, vx1, vx2, vx3);
-
-               if (UbMath::isNaN(rho) || UbMath::isInfinity(rho))
-                  UB_THROW(UbException(UB_EXARGS, "rho is not a number (nan or -1.#IND) or infinity number -1.#INF in block=" + block->toString() +
-                  ", node=" + UbSystem::toString(ix1) + "," + UbSystem::toString(ix2) + "," + UbSystem::toString(ix3)));
-               //rho=999.0;
-               if (UbMath::isNaN(press) || UbMath::isInfinity(press))
-                  UB_THROW(UbException(UB_EXARGS, "press is not a number (nan or -1.#IND) or infinity number -1.#INF in block=" + block->toString() +
-                  ", node=" + UbSystem::toString(ix1) + "," + UbSystem::toString(ix2) + "," + UbSystem::toString(ix3)));
-               //press=999.0;
-               if (UbMath::isNaN(vx1) || UbMath::isInfinity(vx1))
-                  UB_THROW(UbException(UB_EXARGS, "vx1 is not a number (nan or -1.#IND) or infinity number -1.#INF in block=" + block->toString() +
-                  ", node=" + UbSystem::toString(ix1) + "," + UbSystem::toString(ix2) + "," + UbSystem::toString(ix3)));
-               //vx1=999.0;
-               if (UbMath::isNaN(vx2) || UbMath::isInfinity(vx2))
-                  UB_THROW(UbException(UB_EXARGS, "vx2 is not a number (nan or -1.#IND) or infinity number -1.#INF in block=" + block->toString() +
-                  ", node=" + UbSystem::toString(ix1) + "," + UbSystem::toString(ix2) + "," + UbSystem::toString(ix3)));
-               //vx2=999.0;
-               if (UbMath::isNaN(vx3) || UbMath::isInfinity(vx3))
-                  UB_THROW(UbException(UB_EXARGS, "vx3 is not a number (nan or -1.#IND) or infinity number -1.#INF in block=" + block->toString() +
-                  ", node=" + UbSystem::toString(ix1) + "," + UbSystem::toString(ix2) + "," + UbSystem::toString(ix3)));
-               //vx3=999.0;
-
-               rhoArray[index] = rho;
-               vx1Array[index] = vx1;
-               vx2Array[index] = vx2;
-               vx3Array[index] = vx3;
-               index++;
-            }
-         }
-      }
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-void InSituCatalystCoProcessor::buildVTKGrid()
-{
-   unstructuredGrid = vtkSmartPointer<vtkUnstructuredGrid>::New();
-   points = vtkPoints::New();
-   unstructuredGrid->SetPoints(points);
-   arrays[0] = vtkSmartPointer<vtkDoubleArray>::New();
-   arrays[0]->SetNumberOfComponents(1);
-   arrays[0]->SetName("Rho");
-   arrays[1] = vtkSmartPointer<vtkDoubleArray>::New();
-   arrays[1]->SetNumberOfComponents(1);
-   arrays[1]->SetName("Vx");
-   arrays[2] = vtkSmartPointer<vtkDoubleArray>::New();
-   arrays[2]->SetNumberOfComponents(1);
-   arrays[2]->SetName("Vy");
-   arrays[3] = vtkSmartPointer<vtkDoubleArray>::New();
-   arrays[3]->SetNumberOfComponents(1);
-   arrays[3]->SetName("Vz");
-
-   numOfPoints = 0;
-
-   for (int level = minInitLevel; level <= maxInitLevel; level++)
-   {
-      for(SPtr<Block3D> block : blockVector[level])
-      {
-         if (block)
-         {
-            addVTKGridData(block);
-         }
-      }
-   }
-
-   unstructuredGrid->GetPointData()->AddArray(arrays[0]);
-   unstructuredGrid->GetPointData()->AddArray(arrays[1]);
-   unstructuredGrid->GetPointData()->AddArray(arrays[2]);
-   unstructuredGrid->GetPointData()->AddArray(arrays[3]);
-   unstructuredGrid->GetPointData()->SetScalars(arrays[1]);
-
-   rhoArray.resize(numOfPoints);
-   vx1Array.resize(numOfPoints);
-   vx2Array.resize(numOfPoints);
-   vx3Array.resize(numOfPoints);
-}
-//////////////////////////////////////////////////////////////////////////
-void InSituCatalystCoProcessor::addVTKGridData(SPtr<Block3D> block)
-{
-   UbTupleDouble3 org = grid->getBlockWorldCoordinates(block);
-   UbTupleDouble3 blockLengths = grid->getBlockLengths(block);
-   UbTupleDouble3 nodeOffset = grid->getNodeOffset(block);
-   double         dx = grid->getDeltaX(block);
-
-   SPtr<LBMKernel> kernel = block->getKernel();
-   SPtr<BCArray3D> bcArray = kernel->getBCProcessor()->getBCArray();
-   SPtr<DistributionArray3D> distributions = kernel->getDataSet()->getFdistributions();
-   LBMReal f[D3Q27System::ENDF + 1];
-   LBMReal vx1, vx2, vx3, rho;
-
-   //knotennummerierung faengt immer bei 0 an!
-   int SWB, SEB, NEB, NWB, SWT, SET, NET, NWT;
-
-   //Funktionszeiger
-   //typedef void(*CalcMacrosFct)(const LBMReal* const& /*feq[27]*/, LBMReal& /*(d)rho*/, LBMReal& /*vx1*/, LBMReal& /*vx2*/, LBMReal& /*vx3*/);
-
-   //CalcMacrosFct calcMacros = NULL;
-
-   if (block->getKernel()->getCompressible())
-   {
-      calcMacros = &D3Q27System::calcCompMacroscopicValues;
-   }
-   else
-   {
-      calcMacros = &D3Q27System::calcIncompMacroscopicValues;
-   }
-
-   int minX1 = 0;
-   int minX2 = 0;
-   int minX3 = 0;
-
-   int maxX1 = (int)(distributions->getNX1());
-   int maxX2 = (int)(distributions->getNX2());
-   int maxX3 = (int)(distributions->getNX3());
-
-   //nummern vergeben und node vector erstellen + daten sammeln
-   CbArray3D<int> nodeNumbers((int)maxX1, (int)maxX2, (int)maxX3, -1);
-   maxX1 -= 2;
-   maxX2 -= 2;
-   maxX3 -= 2;
-
-   SPtr<BoundaryConditions> bcPtr;
-   int nr = points->GetNumberOfPoints();
-
-   double x[3];
-
-   for (size_t ix3 = minX3; ix3 <= maxX3; ix3++)
-   {
-      for (size_t ix2 = minX2; ix2 <= maxX2; ix2++)
-      {
-         for (size_t ix1 = minX1; ix1 <= maxX1; ix1++)
-         {
-            if (!bcArray->isUndefined(ix1, ix2, ix3) && !bcArray->isSolid(ix1, ix2, ix3))
-            {
-               x[0] = double(val<1>(org) -val<1>(nodeOffset) +ix1*dx);
-               x[1] = double(val<2>(org) -val<2>(nodeOffset) +ix2*dx);
-               x[2] = double(val<3>(org) -val<3>(nodeOffset) +ix3*dx);
-
-               points->InsertPoint((vtkIdType)nr, x);
-
-               nodeNumbers(ix1, ix2, ix3) = nr++;
-
-               distributions->getDistribution(f, ix1, ix2, ix3);
-               calcMacros(f, rho, vx1, vx2, vx3);
-               double press = D3Q27System::calcPress(f, rho, vx1, vx2, vx3);
-
-               if (UbMath::isNaN(rho) || UbMath::isInfinity(rho))
-                  UB_THROW(UbException(UB_EXARGS, "rho is not a number (nan or -1.#IND) or infinity number -1.#INF in block=" + block->toString() +
-                  ", node=" + UbSystem::toString(ix1) + "," + UbSystem::toString(ix2) + "," + UbSystem::toString(ix3)));
-               //rho=999.0;
-               if (UbMath::isNaN(press) || UbMath::isInfinity(press))
-                  UB_THROW(UbException(UB_EXARGS, "press is not a number (nan or -1.#IND) or infinity number -1.#INF in block=" + block->toString() +
-                  ", node=" + UbSystem::toString(ix1) + "," + UbSystem::toString(ix2) + "," + UbSystem::toString(ix3)));
-               //press=999.0;
-               if (UbMath::isNaN(vx1) || UbMath::isInfinity(vx1))
-                  UB_THROW(UbException(UB_EXARGS, "vx1 is not a number (nan or -1.#IND) or infinity number -1.#INF in block=" + block->toString() +
-                  ", node=" + UbSystem::toString(ix1) + "," + UbSystem::toString(ix2) + "," + UbSystem::toString(ix3)));
-               //vx1=999.0;
-               if (UbMath::isNaN(vx2) || UbMath::isInfinity(vx2))
-                  UB_THROW(UbException(UB_EXARGS, "vx2 is not a number (nan or -1.#IND) or infinity number -1.#INF in block=" + block->toString() +
-                  ", node=" + UbSystem::toString(ix1) + "," + UbSystem::toString(ix2) + "," + UbSystem::toString(ix3)));
-               //vx2=999.0;
-               if (UbMath::isNaN(vx3) || UbMath::isInfinity(vx3))
-                  UB_THROW(UbException(UB_EXARGS, "vx3 is not a number (nan or -1.#IND) or infinity number -1.#INF in block=" + block->toString() +
-                  ", node=" + UbSystem::toString(ix1) + "," + UbSystem::toString(ix2) + "," + UbSystem::toString(ix3)));
-               //vx3=999.0;
-
-               arrays[0]->InsertNextValue(rho);
-               arrays[1]->InsertNextValue(vx1);
-               arrays[2]->InsertNextValue(vx2);
-               arrays[3]->InsertNextValue(vx3);
-               numOfPoints++;
-            }
-         }
-      }
-   }
-   maxX1 -= 1;
-   maxX2 -= 1;
-   maxX3 -= 1;
-
-   vtkIdType ptIds[8];
-   //cell vector erstellen
-   for (int ix3 = minX3; ix3 <= maxX3; ix3++)
-   {
-      for (int ix2 = minX2; ix2 <= maxX2; ix2++)
-      {
-         for (int ix1 = minX1; ix1 <= maxX1; ix1++)
-         {
-            if ((ptIds[0] = SWB = nodeNumbers(ix1, ix2, ix3)) >= 0
-               && (ptIds[1] = SEB = nodeNumbers(ix1 + 1, ix2, ix3)) >= 0
-               && (ptIds[2] = NWB = nodeNumbers(ix1, ix2 + 1, ix3)) >= 0
-               && (ptIds[3] = NEB = nodeNumbers(ix1 + 1, ix2 + 1, ix3)) >= 0
-               && (ptIds[4] = SWT = nodeNumbers(ix1, ix2, ix3 + 1)) >= 0
-               && (ptIds[5] = SET = nodeNumbers(ix1 + 1, ix2, ix3 + 1)) >= 0
-               && (ptIds[6] = NWT = nodeNumbers(ix1, ix2 + 1, ix3 + 1)) >= 0
-               && (ptIds[7] = NET = nodeNumbers(ix1 + 1, ix2 + 1, ix3 + 1)) >= 0
-               )
-            {
-               unstructuredGrid->InsertNextCell((int)VTK_VOXEL, (vtkIdType)8, ptIds);
-            }
-         }
-      }
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-
-
-#endif
-
+#ifdef VF_CATALYST
+
+#include "InSituCatalystCoProcessor.h"
+#include <LBMKernel.h>
+#include <D3Q27ETBCProcessor.h>
+#include <vector>
+#include <string>
+
+#include <vtkCellType.h>
+#include <vtkPointData.h>
+#include <vtkXMLUnstructuredGridWriter.h>
+
+#include <iostream>
+#include <fstream>
+
+using namespace std;
+
+InSituCatalystCoProcessor::InSituCatalystCoProcessor()
+{
+
+}
+//////////////////////////////////////////////////////////////////////////
+InSituCatalystCoProcessor::InSituCatalystCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, std::string script) : CoProcessor(grid, s)
+{
+   gridRank = Communicator::getInstance()->getProcessID();
+   minInitLevel = this->grid->getCoarsestInitializedLevel();
+   maxInitLevel = this->grid->getFinestInitializedLevel();
+
+   blockVector.resize(maxInitLevel + 1);
+
+   for (int level = minInitLevel; level <= maxInitLevel; level++)
+   {
+      grid->getBlocks(level, gridRank, true, blockVector[level]);
+   }
+
+   Processor = vtkSmartPointer<vtkCPProcessor>::New();
+   Processor->Initialize();
+
+   vtkNew<vtkCPPythonScriptPipeline> pipeline;
+   pipeline->Initialize(script.c_str());
+   Processor->AddPipeline(pipeline.GetPointer());
+
+   buildVTKGrid();
+}
+//////////////////////////////////////////////////////////////////////////
+InSituCatalystCoProcessor::~InSituCatalystCoProcessor()
+{
+
+}
+//////////////////////////////////////////////////////////////////////////
+void InSituCatalystCoProcessor::process(double step)
+{
+   if (scheduler->isDue(step))
+      collectData(step);
+
+   UBLOG(logDEBUG3, "InSituCatalystCoProcessor::update:" << step);
+}
+//////////////////////////////////////////////////////////////////////////
+void InSituCatalystCoProcessor::collectData(double step)
+{
+   unsigned int istep = static_cast<int>(step);
+
+   vtkNew<vtkCPDataDescription> dataDescription;
+   dataDescription->AddInput("input");
+   dataDescription->SetTimeData(step, istep);
+
+   if (Processor->RequestDataDescription(dataDescription.GetPointer()) != 0)
+   {
+      
+      index = 0;
+
+      for (int level = minInitLevel; level <= maxInitLevel; level++)
+      {
+         for(SPtr<Block3D> block : blockVector[level])
+         {
+            if (block)
+            {
+               addData(block);
+            }
+         }
+      }
+
+      vtkDoubleArray* rho = vtkDoubleArray::SafeDownCast(unstructuredGrid->GetPointData()->GetArray("Rho"));
+      rho->SetArray(&rhoArray[0], static_cast<vtkIdType>(rhoArray.size()), 1);
+
+      vtkDoubleArray* vx1 = vtkDoubleArray::SafeDownCast(unstructuredGrid->GetPointData()->GetArray("Vx"));
+      vx1->SetArray(&vx1Array[0], static_cast<vtkIdType>(vx1Array.size()), 1);
+
+      vtkDoubleArray* vx2 = vtkDoubleArray::SafeDownCast(unstructuredGrid->GetPointData()->GetArray("Vy"));
+      vx2->SetArray(&vx2Array[0], static_cast<vtkIdType>(vx2Array.size()), 1);
+
+      vtkDoubleArray* vx3 = vtkDoubleArray::SafeDownCast(unstructuredGrid->GetPointData()->GetArray("Vz"));
+      vx3->SetArray(&vx3Array[0], static_cast<vtkIdType>(vx3Array.size()), 1);
+
+      dataDescription->GetInputDescriptionByName("input")->SetGrid(unstructuredGrid);
+      Processor->CoProcess(dataDescription.GetPointer());
+   }
+
+   UBLOG(logINFO, "InSituCatalystCoProcessor step: " << istep);
+}
+//////////////////////////////////////////////////////////////////////////
+void InSituCatalystCoProcessor::addData(SPtr<Block3D> block)
+{
+   UbTupleDouble3 org = grid->getBlockWorldCoordinates(block);
+   UbTupleDouble3 blockLengths = grid->getBlockLengths(block);
+   UbTupleDouble3 nodeOffset = grid->getNodeOffset(block);
+   double         dx = grid->getDeltaX(block);
+
+   SPtr<LBMKernel> kernel = block->getKernel();
+   SPtr<BCArray3D> bcArray = kernel->getBCProcessor()->getBCArray();
+   SPtr<DistributionArray3D> distributions = kernel->getDataSet()->getFdistributions();
+   LBMReal f[D3Q27System::ENDF + 1];
+   LBMReal vx1, vx2, vx3, rho;
+
+   int minX1 = 0;
+   int minX2 = 0;
+   int minX3 = 0;
+
+   int maxX1 = (int)(distributions->getNX1());
+   int maxX2 = (int)(distributions->getNX2());
+   int maxX3 = (int)(distributions->getNX3());
+
+   //nummern vergeben und node vector erstellen + daten sammeln
+   CbArray3D<int> nodeNumbers((int)maxX1, (int)maxX2, (int)maxX3, -1);
+   maxX1 -= 2;
+   maxX2 -= 2;
+   maxX3 -= 2;
+
+   
+
+   for (size_t ix3 = minX3; ix3 <= maxX3; ix3++)
+   {
+      for (size_t ix2 = minX2; ix2 <= maxX2; ix2++)
+      {
+         for (size_t ix1 = minX1; ix1 <= maxX1; ix1++)
+         {
+            if (!bcArray->isUndefined(ix1, ix2, ix3) && !bcArray->isSolid(ix1, ix2, ix3))
+            {
+               distributions->getDistribution(f, ix1, ix2, ix3);
+               calcMacros(f, rho, vx1, vx2, vx3);
+               double press = D3Q27System::calcPress(f, rho, vx1, vx2, vx3);
+
+               if (UbMath::isNaN(rho) || UbMath::isInfinity(rho))
+                  UB_THROW(UbException(UB_EXARGS, "rho is not a number (nan or -1.#IND) or infinity number -1.#INF in block=" + block->toString() +
+                  ", node=" + UbSystem::toString(ix1) + "," + UbSystem::toString(ix2) + "," + UbSystem::toString(ix3)));
+               //rho=999.0;
+               if (UbMath::isNaN(press) || UbMath::isInfinity(press))
+                  UB_THROW(UbException(UB_EXARGS, "press is not a number (nan or -1.#IND) or infinity number -1.#INF in block=" + block->toString() +
+                  ", node=" + UbSystem::toString(ix1) + "," + UbSystem::toString(ix2) + "," + UbSystem::toString(ix3)));
+               //press=999.0;
+               if (UbMath::isNaN(vx1) || UbMath::isInfinity(vx1))
+                  UB_THROW(UbException(UB_EXARGS, "vx1 is not a number (nan or -1.#IND) or infinity number -1.#INF in block=" + block->toString() +
+                  ", node=" + UbSystem::toString(ix1) + "," + UbSystem::toString(ix2) + "," + UbSystem::toString(ix3)));
+               //vx1=999.0;
+               if (UbMath::isNaN(vx2) || UbMath::isInfinity(vx2))
+                  UB_THROW(UbException(UB_EXARGS, "vx2 is not a number (nan or -1.#IND) or infinity number -1.#INF in block=" + block->toString() +
+                  ", node=" + UbSystem::toString(ix1) + "," + UbSystem::toString(ix2) + "," + UbSystem::toString(ix3)));
+               //vx2=999.0;
+               if (UbMath::isNaN(vx3) || UbMath::isInfinity(vx3))
+                  UB_THROW(UbException(UB_EXARGS, "vx3 is not a number (nan or -1.#IND) or infinity number -1.#INF in block=" + block->toString() +
+                  ", node=" + UbSystem::toString(ix1) + "," + UbSystem::toString(ix2) + "," + UbSystem::toString(ix3)));
+               //vx3=999.0;
+
+               rhoArray[index] = rho;
+               vx1Array[index] = vx1;
+               vx2Array[index] = vx2;
+               vx3Array[index] = vx3;
+               index++;
+            }
+         }
+      }
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+void InSituCatalystCoProcessor::buildVTKGrid()
+{
+   unstructuredGrid = vtkSmartPointer<vtkUnstructuredGrid>::New();
+   points = vtkPoints::New();
+   unstructuredGrid->SetPoints(points);
+   arrays[0] = vtkSmartPointer<vtkDoubleArray>::New();
+   arrays[0]->SetNumberOfComponents(1);
+   arrays[0]->SetName("Rho");
+   arrays[1] = vtkSmartPointer<vtkDoubleArray>::New();
+   arrays[1]->SetNumberOfComponents(1);
+   arrays[1]->SetName("Vx");
+   arrays[2] = vtkSmartPointer<vtkDoubleArray>::New();
+   arrays[2]->SetNumberOfComponents(1);
+   arrays[2]->SetName("Vy");
+   arrays[3] = vtkSmartPointer<vtkDoubleArray>::New();
+   arrays[3]->SetNumberOfComponents(1);
+   arrays[3]->SetName("Vz");
+
+   numOfPoints = 0;
+
+   for (int level = minInitLevel; level <= maxInitLevel; level++)
+   {
+      for(SPtr<Block3D> block : blockVector[level])
+      {
+         if (block)
+         {
+            addVTKGridData(block);
+         }
+      }
+   }
+
+   unstructuredGrid->GetPointData()->AddArray(arrays[0]);
+   unstructuredGrid->GetPointData()->AddArray(arrays[1]);
+   unstructuredGrid->GetPointData()->AddArray(arrays[2]);
+   unstructuredGrid->GetPointData()->AddArray(arrays[3]);
+   unstructuredGrid->GetPointData()->SetScalars(arrays[1]);
+
+   rhoArray.resize(numOfPoints);
+   vx1Array.resize(numOfPoints);
+   vx2Array.resize(numOfPoints);
+   vx3Array.resize(numOfPoints);
+}
+//////////////////////////////////////////////////////////////////////////
+void InSituCatalystCoProcessor::addVTKGridData(SPtr<Block3D> block)
+{
+   UbTupleDouble3 org = grid->getBlockWorldCoordinates(block);
+   UbTupleDouble3 blockLengths = grid->getBlockLengths(block);
+   UbTupleDouble3 nodeOffset = grid->getNodeOffset(block);
+   double         dx = grid->getDeltaX(block);
+
+   SPtr<LBMKernel> kernel = block->getKernel();
+   SPtr<BCArray3D> bcArray = kernel->getBCProcessor()->getBCArray();
+   SPtr<DistributionArray3D> distributions = kernel->getDataSet()->getFdistributions();
+   LBMReal f[D3Q27System::ENDF + 1];
+   LBMReal vx1, vx2, vx3, rho;
+
+   //knotennummerierung faengt immer bei 0 an!
+   int SWB, SEB, NEB, NWB, SWT, SET, NET, NWT;
+
+   //Funktionszeiger
+   //typedef void(*CalcMacrosFct)(const LBMReal* const& /*feq[27]*/, LBMReal& /*(d)rho*/, LBMReal& /*vx1*/, LBMReal& /*vx2*/, LBMReal& /*vx3*/);
+
+   //CalcMacrosFct calcMacros = NULL;
+
+   if (block->getKernel()->getCompressible())
+   {
+      calcMacros = &D3Q27System::calcCompMacroscopicValues;
+   }
+   else
+   {
+      calcMacros = &D3Q27System::calcIncompMacroscopicValues;
+   }
+
+   int minX1 = 0;
+   int minX2 = 0;
+   int minX3 = 0;
+
+   int maxX1 = (int)(distributions->getNX1());
+   int maxX2 = (int)(distributions->getNX2());
+   int maxX3 = (int)(distributions->getNX3());
+
+   //nummern vergeben und node vector erstellen + daten sammeln
+   CbArray3D<int> nodeNumbers((int)maxX1, (int)maxX2, (int)maxX3, -1);
+   maxX1 -= 2;
+   maxX2 -= 2;
+   maxX3 -= 2;
+
+   SPtr<BoundaryConditions> bcPtr;
+   int nr = points->GetNumberOfPoints();
+
+   double x[3];
+
+   for (size_t ix3 = minX3; ix3 <= maxX3; ix3++)
+   {
+      for (size_t ix2 = minX2; ix2 <= maxX2; ix2++)
+      {
+         for (size_t ix1 = minX1; ix1 <= maxX1; ix1++)
+         {
+            if (!bcArray->isUndefined(ix1, ix2, ix3) && !bcArray->isSolid(ix1, ix2, ix3))
+            {
+               x[0] = double(val<1>(org) -val<1>(nodeOffset) +ix1*dx);
+               x[1] = double(val<2>(org) -val<2>(nodeOffset) +ix2*dx);
+               x[2] = double(val<3>(org) -val<3>(nodeOffset) +ix3*dx);
+
+               points->InsertPoint((vtkIdType)nr, x);
+
+               nodeNumbers(ix1, ix2, ix3) = nr++;
+
+               distributions->getDistribution(f, ix1, ix2, ix3);
+               calcMacros(f, rho, vx1, vx2, vx3);
+               double press = D3Q27System::calcPress(f, rho, vx1, vx2, vx3);
+
+               if (UbMath::isNaN(rho) || UbMath::isInfinity(rho))
+                  UB_THROW(UbException(UB_EXARGS, "rho is not a number (nan or -1.#IND) or infinity number -1.#INF in block=" + block->toString() +
+                  ", node=" + UbSystem::toString(ix1) + "," + UbSystem::toString(ix2) + "," + UbSystem::toString(ix3)));
+               //rho=999.0;
+               if (UbMath::isNaN(press) || UbMath::isInfinity(press))
+                  UB_THROW(UbException(UB_EXARGS, "press is not a number (nan or -1.#IND) or infinity number -1.#INF in block=" + block->toString() +
+                  ", node=" + UbSystem::toString(ix1) + "," + UbSystem::toString(ix2) + "," + UbSystem::toString(ix3)));
+               //press=999.0;
+               if (UbMath::isNaN(vx1) || UbMath::isInfinity(vx1))
+                  UB_THROW(UbException(UB_EXARGS, "vx1 is not a number (nan or -1.#IND) or infinity number -1.#INF in block=" + block->toString() +
+                  ", node=" + UbSystem::toString(ix1) + "," + UbSystem::toString(ix2) + "," + UbSystem::toString(ix3)));
+               //vx1=999.0;
+               if (UbMath::isNaN(vx2) || UbMath::isInfinity(vx2))
+                  UB_THROW(UbException(UB_EXARGS, "vx2 is not a number (nan or -1.#IND) or infinity number -1.#INF in block=" + block->toString() +
+                  ", node=" + UbSystem::toString(ix1) + "," + UbSystem::toString(ix2) + "," + UbSystem::toString(ix3)));
+               //vx2=999.0;
+               if (UbMath::isNaN(vx3) || UbMath::isInfinity(vx3))
+                  UB_THROW(UbException(UB_EXARGS, "vx3 is not a number (nan or -1.#IND) or infinity number -1.#INF in block=" + block->toString() +
+                  ", node=" + UbSystem::toString(ix1) + "," + UbSystem::toString(ix2) + "," + UbSystem::toString(ix3)));
+               //vx3=999.0;
+
+               arrays[0]->InsertNextValue(rho);
+               arrays[1]->InsertNextValue(vx1);
+               arrays[2]->InsertNextValue(vx2);
+               arrays[3]->InsertNextValue(vx3);
+               numOfPoints++;
+            }
+         }
+      }
+   }
+   maxX1 -= 1;
+   maxX2 -= 1;
+   maxX3 -= 1;
+
+   vtkIdType ptIds[8];
+   //cell vector erstellen
+   for (int ix3 = minX3; ix3 <= maxX3; ix3++)
+   {
+      for (int ix2 = minX2; ix2 <= maxX2; ix2++)
+      {
+         for (int ix1 = minX1; ix1 <= maxX1; ix1++)
+         {
+            if ((ptIds[0] = SWB = nodeNumbers(ix1, ix2, ix3)) >= 0
+               && (ptIds[1] = SEB = nodeNumbers(ix1 + 1, ix2, ix3)) >= 0
+               && (ptIds[2] = NWB = nodeNumbers(ix1, ix2 + 1, ix3)) >= 0
+               && (ptIds[3] = NEB = nodeNumbers(ix1 + 1, ix2 + 1, ix3)) >= 0
+               && (ptIds[4] = SWT = nodeNumbers(ix1, ix2, ix3 + 1)) >= 0
+               && (ptIds[5] = SET = nodeNumbers(ix1 + 1, ix2, ix3 + 1)) >= 0
+               && (ptIds[6] = NWT = nodeNumbers(ix1, ix2 + 1, ix3 + 1)) >= 0
+               && (ptIds[7] = NET = nodeNumbers(ix1 + 1, ix2 + 1, ix3 + 1)) >= 0
+               )
+            {
+               unstructuredGrid->InsertNextCell((int)VTK_VOXEL, (vtkIdType)8, ptIds);
+            }
+         }
+      }
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+
+
+#endif
+
diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/InSituCatalystCoProcessor.h b/src/cpu/VirtualFluidsCore/CoProcessors/InSituCatalystCoProcessor.h
index b8e89c462b06b1ba61f7cd724c9e2886c63266c8..3d4bb25c62f12ce765cb751175f5ef9cff1374ed 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/InSituCatalystCoProcessor.h
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/InSituCatalystCoProcessor.h
@@ -1,54 +1,54 @@
-#ifdef VF_CATALYST
-
-#ifndef InSituCatalystCoProcessor_h__
-#define InSituCatalystCoProcessor_h__
-
-
-#include <CoProcessor.h>
-#include <Grid3D.h>
-#include <LBMUnitConverter.h>
-
-#include <string>
-
-#include <vtkSmartPointer.h>
-#include <vtkUnstructuredGrid.h>
-#include <vtkDoubleArray.h>
-#include <vtkCPDataDescription.h>
-#include <vtkCPInputDataDescription.h>
-#include <vtkCPProcessor.h>
-#include <vtkCPPythonScriptPipeline.h>
-#include <vtkNew.h>
-
-class InSituCatalystCoProcessor : public CoProcessor
-{
-public:
-   InSituCatalystCoProcessor();
-   InSituCatalystCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, std::string script);
-   virtual ~InSituCatalystCoProcessor(); 
-   void process(double step);
-protected:
-   void collectData(double step);
-   void addData(SPtr<Block3D> block);
-   void buildVTKGrid();
-   void addVTKGridData(SPtr<Block3D> block);
-private:
-   std::vector<std::vector<SPtr<Block3D>> > blockVector;
-   int minInitLevel;
-   int maxInitLevel;
-   int gridRank;
-   vtkSmartPointer<vtkCPProcessor> Processor;
-   vtkSmartPointer<vtkUnstructuredGrid> unstructuredGrid;
-   vtkSmartPointer<vtkPoints> points;
-   vtkSmartPointer<vtkDoubleArray> arrays[4];
-   std::vector<double> vx1Array;
-   std::vector<double> vx2Array;
-   std::vector<double> vx3Array;
-   std::vector<double> rhoArray;
-   int index;
-   int numOfPoints;
-   typedef void(*CalcMacrosFct)(const LBMReal* const& /*feq[27]*/, LBMReal& /*(d)rho*/, LBMReal& /*vx1*/, LBMReal& /*vx2*/, LBMReal& /*vx3*/);
-   CalcMacrosFct calcMacros;
-};
-#endif // InSituCatalystCoProcessor_h__
-
-#endif
+#ifdef VF_CATALYST
+
+#ifndef InSituCatalystCoProcessor_h__
+#define InSituCatalystCoProcessor_h__
+
+
+#include <CoProcessor.h>
+#include <Grid3D.h>
+#include <LBMUnitConverter.h>
+
+#include <string>
+
+#include <vtkSmartPointer.h>
+#include <vtkUnstructuredGrid.h>
+#include <vtkDoubleArray.h>
+#include <vtkCPDataDescription.h>
+#include <vtkCPInputDataDescription.h>
+#include <vtkCPProcessor.h>
+#include <vtkCPPythonScriptPipeline.h>
+#include <vtkNew.h>
+
+class InSituCatalystCoProcessor : public CoProcessor
+{
+public:
+   InSituCatalystCoProcessor();
+   InSituCatalystCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, std::string script);
+   virtual ~InSituCatalystCoProcessor(); 
+   void process(double step);
+protected:
+   void collectData(double step);
+   void addData(SPtr<Block3D> block);
+   void buildVTKGrid();
+   void addVTKGridData(SPtr<Block3D> block);
+private:
+   std::vector<std::vector<SPtr<Block3D>> > blockVector;
+   int minInitLevel;
+   int maxInitLevel;
+   int gridRank;
+   vtkSmartPointer<vtkCPProcessor> Processor;
+   vtkSmartPointer<vtkUnstructuredGrid> unstructuredGrid;
+   vtkSmartPointer<vtkPoints> points;
+   vtkSmartPointer<vtkDoubleArray> arrays[4];
+   std::vector<double> vx1Array;
+   std::vector<double> vx2Array;
+   std::vector<double> vx3Array;
+   std::vector<double> rhoArray;
+   int index;
+   int numOfPoints;
+   typedef void(*CalcMacrosFct)(const LBMReal* const& /*feq[27]*/, LBMReal& /*(d)rho*/, LBMReal& /*vx1*/, LBMReal& /*vx2*/, LBMReal& /*vx3*/);
+   CalcMacrosFct calcMacros;
+};
+#endif // InSituCatalystCoProcessor_h__
+
+#endif
diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/InSituVTKCoProcessor.cpp b/src/cpu/VirtualFluidsCore/CoProcessors/InSituVTKCoProcessor.cpp
index f413955ef07c4dea96888d1a967ac48c4ff41247..600488d5865c388292358c779d2ae6b09c32a576 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/InSituVTKCoProcessor.cpp
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/InSituVTKCoProcessor.cpp
@@ -1,304 +1,304 @@
-#ifdef VF_VTK
-
-#include "InSituVTKCoProcessor.h"
-#include <LBMKernel.h>
-#include <BCProcessor.h>
-#include <Communicator.h>
-#include <UbScheduler.h>
-#include <DistributionArray3D.h>
-#include <D3Q27System.h>
-#include <BoundaryConditions.h>
-#include <Block3D.h>
-#include <LBMKernel.h>
-#include <DataSet3D.h>
-#include <BCArray3D.h>
-
-#include <vector>
-#include <string>
-
-#include <vtkCellType.h>
-#include <vtkPointData.h>
-#include <vtkXMLUnstructuredGridWriter.h>
-
-#include <iostream>
-#include <fstream>
-
-using namespace std;
-
-InSituVTKCoProcessor::InSituVTKCoProcessor()
-{
-
-}
-//////////////////////////////////////////////////////////////////////////
-InSituVTKCoProcessor::InSituVTKCoProcessor( SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string& configFile, SPtr<LBMUnitConverter> conv ) : CoProcessor(grid, s), conv(conv)
-{
-   gridRank  = Communicator::getInstance()->getProcessID(); 
-   minInitLevel = this->grid->getCoarsestInitializedLevel();
-   maxInitLevel = this->grid->getFinestInitializedLevel();
-
-   readConfigFile(configFile);
-
-   blockVector.resize(maxInitLevel+1);
-
-   for(int level = minInitLevel; level<=maxInitLevel;level++)
-   {
-      grid->getBlocks(level, gridRank, true, blockVector[level]);
-   }
-
-   //initialization of communicator
-   contr = vtkSmartPointer<vtkSocketController>::New();
-   contr->Initialize();
-
-   comm = vtkSmartPointer<vtkSocketCommunicator>::New();
-
-   // Establish connection
-   if (!comm->ConnectTo(wHostname.c_str(), wPort))
-   {
-      cerr << "Client error: Could not connect to the server."<< endl;
-      return;
-   }
- 
-}
-//////////////////////////////////////////////////////////////////////////
-InSituVTKCoProcessor::~InSituVTKCoProcessor()
-{
-   comm->CloseConnection();
-}
-//////////////////////////////////////////////////////////////////////////
-void InSituVTKCoProcessor::process( double step )
-{
-   if(scheduler->isDue(step) )
-      collectData(step);
-
-   UBLOG(logDEBUG3, "InSituVTKCoProcessor::update:" << step);
-}
-//////////////////////////////////////////////////////////////////////////
-void InSituVTKCoProcessor::collectData( double step )
-{
-   int istep = static_cast<int>(step);
-
-   unstructuredGrid = vtkSmartPointer<vtkUnstructuredGrid>::New();
-   points = vtkPoints::New();
-   unstructuredGrid->SetPoints(points);
-   arrays[0] = vtkSmartPointer<vtkDoubleArray>::New();
-   arrays[0]->SetNumberOfComponents(1);
-   arrays[0]->SetName( "Rho" );
-   arrays[1] = vtkSmartPointer<vtkDoubleArray>::New();
-   arrays[1]->SetNumberOfComponents(1);
-   arrays[1]->SetName( "Vx" );
-   arrays[2] = vtkSmartPointer<vtkDoubleArray>::New();
-   arrays[2]->SetNumberOfComponents(1);
-   arrays[2]->SetName( "Vy" );
-   arrays[3] = vtkSmartPointer<vtkDoubleArray>::New();
-   arrays[3]->SetNumberOfComponents(1);
-   arrays[3]->SetName( "Vz" );
-   arrays[4] = vtkSmartPointer<vtkDoubleArray>::New();
-   arrays[4]->SetNumberOfComponents(1);
-   arrays[4]->SetName( "Press" );
-
-   for(int level = minInitLevel; level<=maxInitLevel;level++)
-   {
-      for(SPtr<Block3D> block : blockVector[level])
-      {
-         if (block)
-         {
-            addData(block);
-         }
-      }
-   }
-
-   unstructuredGrid->GetPointData()->AddArray(arrays[0]);
-   unstructuredGrid->GetPointData()->AddArray(arrays[1]);
-   unstructuredGrid->GetPointData()->AddArray(arrays[2]);
-   unstructuredGrid->GetPointData()->AddArray(arrays[3]);
-   unstructuredGrid->GetPointData()->AddArray(arrays[4]);
-   unstructuredGrid->GetPointData()->SetScalars(arrays[1]);
-
-   if (!comm->Send(&istep, 1, 1, 11))
-   {
-      cerr << "Client error: Error sending data." << endl;
-      return;
-   }
-
-   if (!comm->Send(unstructuredGrid, 1, 9))
-   {
-      cerr << "Server error: Error sending data." << endl;
-      return;
-   }
-
-   //vtkSmartPointer<vtkXMLUnstructuredGridWriter> writer = vtkSmartPointer<vtkXMLUnstructuredGridWriter>::New();
-   //writer->SetInput(unstructuredGrid);
-   //writer->SetFileName("test.vtu");
-   //writer->SetDataModeToAscii();
-   //writer->Update();
-
-   UBLOG(logINFO,"InSituVTKCoProcessor step: " << istep);
-}
-//////////////////////////////////////////////////////////////////////////
-void InSituVTKCoProcessor::addData( SPtr<Block3D> block )
-{
-   UbTupleDouble3 org          = grid->getBlockWorldCoordinates(block);
-   UbTupleDouble3 blockLengths = grid->getBlockLengths(block);
-   UbTupleDouble3 nodeOffset   = grid->getNodeOffset(block);
-   double         dx           = grid->getDeltaX(block);
-
-   SPtr<ILBMKernel> kernel = block->getKernel();
-   SPtr<BCArray3D> bcArray = kernel->getBCProcessor()->getBCArray();          
-   SPtr<DistributionArray3D> distributions = kernel->getDataSet()->getFdistributions();     
-   LBMReal f[D3Q27System::ENDF+1];
-   LBMReal vx1,vx2,vx3,rho;
-
-   //knotennummerierung faengt immer bei 0 an!
-   int SWB,SEB,NEB,NWB,SWT,SET,NET,NWT;
-
-   //Funktionszeiger
-   typedef void (*CalcMacrosFct)(const LBMReal* const& /*feq[27]*/,LBMReal& /*(d)rho*/, LBMReal& /*vx1*/, LBMReal& /*vx2*/, LBMReal& /*vx3*/);
-
-   CalcMacrosFct calcMacros = NULL;
-
-   if(block->getKernel()->getCompressible())
-   {
-      calcMacros = &D3Q27System::calcCompMacroscopicValues;
-   }
-   else
-   {
-      calcMacros = &D3Q27System::calcIncompMacroscopicValues;
-   }
-
-   int minX1 = 0;
-   int minX2 = 0;
-   int minX3 = 0;
-
-   int maxX1 = (int)(distributions->getNX1());
-   int maxX2 = (int)(distributions->getNX2());
-   int maxX3 = (int)(distributions->getNX3());
-
-   //int minX1 = 1;
-   //int minX2 = 1;
-   //int minX3 = 1;
-
-   //int maxX1 = (int)(distributions->getNX1());
-   //int maxX2 = (int)(distributions->getNX2());
-   //int maxX3 = (int)(distributions->getNX3());
-
-   //nummern vergeben und node vector erstellen + daten sammeln
-   CbArray3D<int> nodeNumbers((int)maxX1, (int)maxX2, (int)maxX3,-1);
-   maxX1 -= 2;
-   maxX2 -= 2;
-   maxX3 -= 2;
-
-   SPtr<BoundaryConditions> bcPtr;
-   int nr = points->GetNumberOfPoints();
-
-   double x[3];
-
-   for(size_t ix3=minX3; ix3<=maxX3; ix3++)
-   {
-      for(size_t ix2=minX2; ix2<=maxX2; ix2++)
-      {
-         for(size_t ix1=minX1; ix1<=maxX1; ix1++)
-         {
-            if(!bcArray->isUndefined(ix1,ix2,ix3) && !bcArray->isSolid(ix1,ix2,ix3))
-            {
-               int index = 0;
-
-               x[0] = double(val<1>(org) - val<1>(nodeOffset) + ix1*dx);
-               x[1] = double(val<2>(org) - val<2>(nodeOffset) + ix2*dx);
-               x[2] = double(val<3>(org) - val<3>(nodeOffset) + ix3*dx);
-
-               points->InsertPoint((vtkIdType)nr, x);
-
-               nodeNumbers(ix1,ix2,ix3) = nr++;
-               
-               distributions->getDistribution(f, ix1, ix2, ix3);
-               calcMacros(f,rho,vx1,vx2,vx3);
-               double press = D3Q27System::calcPress(f,rho,vx1,vx2,vx3);
-
-               if (UbMath::isNaN(rho) || UbMath::isInfinity(rho)) 
-                  UB_THROW( UbException(UB_EXARGS,"rho is not a number (nan or -1.#IND) or infinity number -1.#INF in block="+block->toString()+
-                  ", node="+UbSystem::toString(ix1)+","+UbSystem::toString(ix2)+","+UbSystem::toString(ix3)));
-               //rho=999.0;
-               if (UbMath::isNaN(press) || UbMath::isInfinity(press)) 
-                  UB_THROW( UbException(UB_EXARGS,"press is not a number (nan or -1.#IND) or infinity number -1.#INF in block="+block->toString()+
-                  ", node="+UbSystem::toString(ix1)+","+UbSystem::toString(ix2)+","+UbSystem::toString(ix3)));
-               //press=999.0;
-               if (UbMath::isNaN(vx1) || UbMath::isInfinity(vx1)) 
-                  UB_THROW( UbException(UB_EXARGS,"vx1 is not a number (nan or -1.#IND) or infinity number -1.#INF in block="+block->toString()+
-                  ", node="+UbSystem::toString(ix1)+","+UbSystem::toString(ix2)+","+UbSystem::toString(ix3)));
-               //vx1=999.0;
-               if (UbMath::isNaN(vx2) || UbMath::isInfinity(vx2)) 
-                  UB_THROW( UbException(UB_EXARGS,"vx2 is not a number (nan or -1.#IND) or infinity number -1.#INF in block="+block->toString()+
-                  ", node="+UbSystem::toString(ix1)+","+UbSystem::toString(ix2)+","+UbSystem::toString(ix3)));
-               //vx2=999.0;
-               if (UbMath::isNaN(vx3) || UbMath::isInfinity(vx3)) 
-                  UB_THROW( UbException(UB_EXARGS,"vx3 is not a number (nan or -1.#IND) or infinity number -1.#INF in block="+block->toString()+
-                  ", node="+UbSystem::toString(ix1)+","+UbSystem::toString(ix2)+","+UbSystem::toString(ix3)));
-               //vx3=999.0;
-
-               arrays[0]->InsertNextValue(rho * conv->getFactorDensityLbToW2());
-               arrays[1]->InsertNextValue(vx1 * conv->getFactorVelocityLbToW2());
-               arrays[2]->InsertNextValue(vx2 * conv->getFactorVelocityLbToW2());
-               arrays[3]->InsertNextValue(vx3 * conv->getFactorVelocityLbToW2());
-               arrays[4]->InsertNextValue(press * conv->getFactorPressureLbToW2());
-            }
-         }
-      }
-   }
-   maxX1 -= 1;
-   maxX2 -= 1;
-   maxX3 -= 1;
-
-   vtkIdType ptIds[8];
-   //cell vector erstellen
-   for(int ix3=minX3; ix3<=maxX3; ix3++)
-   {
-      for(int ix2=minX2; ix2<=maxX2; ix2++)
-      {
-         for(int ix1=minX1; ix1<=maxX1; ix1++)
-         {
-            if(   (ptIds[0]=SWB=nodeNumbers( ix1  , ix2,   ix3   )) >= 0
-               && (ptIds[1]=SEB=nodeNumbers( ix1+1, ix2,   ix3   )) >= 0
-               && (ptIds[2]=NWB=nodeNumbers( ix1  , ix2+1, ix3   )) >= 0
-               && (ptIds[3]=NEB=nodeNumbers( ix1+1, ix2+1, ix3   )) >= 0
-               && (ptIds[4]=SWT=nodeNumbers( ix1  , ix2,   ix3+1 )) >= 0
-               && (ptIds[5]=SET=nodeNumbers( ix1+1, ix2,   ix3+1 )) >= 0
-               && (ptIds[6]=NWT=nodeNumbers( ix1  , ix2+1, ix3+1 )) >= 0 
-               && (ptIds[7]=NET=nodeNumbers( ix1+1, ix2+1, ix3+1 )) >= 0
-               )
-            {
-               unstructuredGrid->InsertNextCell((int)VTK_VOXEL, (vtkIdType)8, ptIds);
-            }
-         }
-      }
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-void InSituVTKCoProcessor::readConfigFile( const std::string& configFile )
-{
-   ifstream ifs;
-   ifs.open (configFile, ifstream::in);
-   if(!ifs) throw UbException(UB_EXARGS,"can not open "+configFile);
- 
-   string dummy;
-   int wRank = 0;
-   getline(ifs, dummy);
-   int np = Communicator::getInstance()->getNumberOfProcesses();
-
-   while (ifs.good())
-   {
-      getline(ifs, dummy, ';');
-      getline(ifs, wIP, ';');
-      getline(ifs, wHostname, ';');
-      getline(ifs, dummy);
-      wPort = stoi(dummy);
-      if(wRank == gridRank) break;
-      wRank++;
-   }
-   ifs.close();
-}
-
-//////////////////////////////////////////////////////////////////////////
-
-#endif
-
-
+#ifdef VF_VTK
+
+#include "InSituVTKCoProcessor.h"
+#include <LBMKernel.h>
+#include <BCProcessor.h>
+#include <Communicator.h>
+#include <UbScheduler.h>
+#include <DistributionArray3D.h>
+#include <D3Q27System.h>
+#include <BoundaryConditions.h>
+#include <Block3D.h>
+#include <LBMKernel.h>
+#include <DataSet3D.h>
+#include <BCArray3D.h>
+
+#include <vector>
+#include <string>
+
+#include <vtkCellType.h>
+#include <vtkPointData.h>
+#include <vtkXMLUnstructuredGridWriter.h>
+
+#include <iostream>
+#include <fstream>
+
+using namespace std;
+
+InSituVTKCoProcessor::InSituVTKCoProcessor()
+{
+
+}
+//////////////////////////////////////////////////////////////////////////
+InSituVTKCoProcessor::InSituVTKCoProcessor( SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string& configFile, SPtr<LBMUnitConverter> conv ) : CoProcessor(grid, s), conv(conv)
+{
+   gridRank  = Communicator::getInstance()->getProcessID(); 
+   minInitLevel = this->grid->getCoarsestInitializedLevel();
+   maxInitLevel = this->grid->getFinestInitializedLevel();
+
+   readConfigFile(configFile);
+
+   blockVector.resize(maxInitLevel+1);
+
+   for(int level = minInitLevel; level<=maxInitLevel;level++)
+   {
+      grid->getBlocks(level, gridRank, true, blockVector[level]);
+   }
+
+   //initialization of communicator
+   contr = vtkSmartPointer<vtkSocketController>::New();
+   contr->Initialize();
+
+   comm = vtkSmartPointer<vtkSocketCommunicator>::New();
+
+   // Establish connection
+   if (!comm->ConnectTo(wHostname.c_str(), wPort))
+   {
+      cerr << "Client error: Could not connect to the server."<< endl;
+      return;
+   }
+ 
+}
+//////////////////////////////////////////////////////////////////////////
+InSituVTKCoProcessor::~InSituVTKCoProcessor()
+{
+   comm->CloseConnection();
+}
+//////////////////////////////////////////////////////////////////////////
+void InSituVTKCoProcessor::process( double step )
+{
+   if(scheduler->isDue(step) )
+      collectData(step);
+
+   UBLOG(logDEBUG3, "InSituVTKCoProcessor::update:" << step);
+}
+//////////////////////////////////////////////////////////////////////////
+void InSituVTKCoProcessor::collectData( double step )
+{
+   int istep = static_cast<int>(step);
+
+   unstructuredGrid = vtkSmartPointer<vtkUnstructuredGrid>::New();
+   points = vtkPoints::New();
+   unstructuredGrid->SetPoints(points);
+   arrays[0] = vtkSmartPointer<vtkDoubleArray>::New();
+   arrays[0]->SetNumberOfComponents(1);
+   arrays[0]->SetName( "Rho" );
+   arrays[1] = vtkSmartPointer<vtkDoubleArray>::New();
+   arrays[1]->SetNumberOfComponents(1);
+   arrays[1]->SetName( "Vx" );
+   arrays[2] = vtkSmartPointer<vtkDoubleArray>::New();
+   arrays[2]->SetNumberOfComponents(1);
+   arrays[2]->SetName( "Vy" );
+   arrays[3] = vtkSmartPointer<vtkDoubleArray>::New();
+   arrays[3]->SetNumberOfComponents(1);
+   arrays[3]->SetName( "Vz" );
+   arrays[4] = vtkSmartPointer<vtkDoubleArray>::New();
+   arrays[4]->SetNumberOfComponents(1);
+   arrays[4]->SetName( "Press" );
+
+   for(int level = minInitLevel; level<=maxInitLevel;level++)
+   {
+      for(SPtr<Block3D> block : blockVector[level])
+      {
+         if (block)
+         {
+            addData(block);
+         }
+      }
+   }
+
+   unstructuredGrid->GetPointData()->AddArray(arrays[0]);
+   unstructuredGrid->GetPointData()->AddArray(arrays[1]);
+   unstructuredGrid->GetPointData()->AddArray(arrays[2]);
+   unstructuredGrid->GetPointData()->AddArray(arrays[3]);
+   unstructuredGrid->GetPointData()->AddArray(arrays[4]);
+   unstructuredGrid->GetPointData()->SetScalars(arrays[1]);
+
+   if (!comm->Send(&istep, 1, 1, 11))
+   {
+      cerr << "Client error: Error sending data." << endl;
+      return;
+   }
+
+   if (!comm->Send(unstructuredGrid, 1, 9))
+   {
+      cerr << "Server error: Error sending data." << endl;
+      return;
+   }
+
+   //vtkSmartPointer<vtkXMLUnstructuredGridWriter> writer = vtkSmartPointer<vtkXMLUnstructuredGridWriter>::New();
+   //writer->SetInput(unstructuredGrid);
+   //writer->SetFileName("test.vtu");
+   //writer->SetDataModeToAscii();
+   //writer->Update();
+
+   UBLOG(logINFO,"InSituVTKCoProcessor step: " << istep);
+}
+//////////////////////////////////////////////////////////////////////////
+void InSituVTKCoProcessor::addData( SPtr<Block3D> block )
+{
+   UbTupleDouble3 org          = grid->getBlockWorldCoordinates(block);
+   UbTupleDouble3 blockLengths = grid->getBlockLengths(block);
+   UbTupleDouble3 nodeOffset   = grid->getNodeOffset(block);
+   double         dx           = grid->getDeltaX(block);
+
+   SPtr<ILBMKernel> kernel = block->getKernel();
+   SPtr<BCArray3D> bcArray = kernel->getBCProcessor()->getBCArray();          
+   SPtr<DistributionArray3D> distributions = kernel->getDataSet()->getFdistributions();     
+   LBMReal f[D3Q27System::ENDF+1];
+   LBMReal vx1,vx2,vx3,rho;
+
+   //knotennummerierung faengt immer bei 0 an!
+   int SWB,SEB,NEB,NWB,SWT,SET,NET,NWT;
+
+   //Funktionszeiger
+   typedef void (*CalcMacrosFct)(const LBMReal* const& /*feq[27]*/,LBMReal& /*(d)rho*/, LBMReal& /*vx1*/, LBMReal& /*vx2*/, LBMReal& /*vx3*/);
+
+   CalcMacrosFct calcMacros = NULL;
+
+   if(block->getKernel()->getCompressible())
+   {
+      calcMacros = &D3Q27System::calcCompMacroscopicValues;
+   }
+   else
+   {
+      calcMacros = &D3Q27System::calcIncompMacroscopicValues;
+   }
+
+   int minX1 = 0;
+   int minX2 = 0;
+   int minX3 = 0;
+
+   int maxX1 = (int)(distributions->getNX1());
+   int maxX2 = (int)(distributions->getNX2());
+   int maxX3 = (int)(distributions->getNX3());
+
+   //int minX1 = 1;
+   //int minX2 = 1;
+   //int minX3 = 1;
+
+   //int maxX1 = (int)(distributions->getNX1());
+   //int maxX2 = (int)(distributions->getNX2());
+   //int maxX3 = (int)(distributions->getNX3());
+
+   //nummern vergeben und node vector erstellen + daten sammeln
+   CbArray3D<int> nodeNumbers((int)maxX1, (int)maxX2, (int)maxX3,-1);
+   maxX1 -= 2;
+   maxX2 -= 2;
+   maxX3 -= 2;
+
+   SPtr<BoundaryConditions> bcPtr;
+   int nr = points->GetNumberOfPoints();
+
+   double x[3];
+
+   for(size_t ix3=minX3; ix3<=maxX3; ix3++)
+   {
+      for(size_t ix2=minX2; ix2<=maxX2; ix2++)
+      {
+         for(size_t ix1=minX1; ix1<=maxX1; ix1++)
+         {
+            if(!bcArray->isUndefined(ix1,ix2,ix3) && !bcArray->isSolid(ix1,ix2,ix3))
+            {
+               int index = 0;
+
+               x[0] = double(val<1>(org) - val<1>(nodeOffset) + ix1*dx);
+               x[1] = double(val<2>(org) - val<2>(nodeOffset) + ix2*dx);
+               x[2] = double(val<3>(org) - val<3>(nodeOffset) + ix3*dx);
+
+               points->InsertPoint((vtkIdType)nr, x);
+
+               nodeNumbers(ix1,ix2,ix3) = nr++;
+               
+               distributions->getDistribution(f, ix1, ix2, ix3);
+               calcMacros(f,rho,vx1,vx2,vx3);
+               double press = D3Q27System::calcPress(f,rho,vx1,vx2,vx3);
+
+               if (UbMath::isNaN(rho) || UbMath::isInfinity(rho)) 
+                  UB_THROW( UbException(UB_EXARGS,"rho is not a number (nan or -1.#IND) or infinity number -1.#INF in block="+block->toString()+
+                  ", node="+UbSystem::toString(ix1)+","+UbSystem::toString(ix2)+","+UbSystem::toString(ix3)));
+               //rho=999.0;
+               if (UbMath::isNaN(press) || UbMath::isInfinity(press)) 
+                  UB_THROW( UbException(UB_EXARGS,"press is not a number (nan or -1.#IND) or infinity number -1.#INF in block="+block->toString()+
+                  ", node="+UbSystem::toString(ix1)+","+UbSystem::toString(ix2)+","+UbSystem::toString(ix3)));
+               //press=999.0;
+               if (UbMath::isNaN(vx1) || UbMath::isInfinity(vx1)) 
+                  UB_THROW( UbException(UB_EXARGS,"vx1 is not a number (nan or -1.#IND) or infinity number -1.#INF in block="+block->toString()+
+                  ", node="+UbSystem::toString(ix1)+","+UbSystem::toString(ix2)+","+UbSystem::toString(ix3)));
+               //vx1=999.0;
+               if (UbMath::isNaN(vx2) || UbMath::isInfinity(vx2)) 
+                  UB_THROW( UbException(UB_EXARGS,"vx2 is not a number (nan or -1.#IND) or infinity number -1.#INF in block="+block->toString()+
+                  ", node="+UbSystem::toString(ix1)+","+UbSystem::toString(ix2)+","+UbSystem::toString(ix3)));
+               //vx2=999.0;
+               if (UbMath::isNaN(vx3) || UbMath::isInfinity(vx3)) 
+                  UB_THROW( UbException(UB_EXARGS,"vx3 is not a number (nan or -1.#IND) or infinity number -1.#INF in block="+block->toString()+
+                  ", node="+UbSystem::toString(ix1)+","+UbSystem::toString(ix2)+","+UbSystem::toString(ix3)));
+               //vx3=999.0;
+
+               arrays[0]->InsertNextValue(rho * conv->getFactorDensityLbToW2());
+               arrays[1]->InsertNextValue(vx1 * conv->getFactorVelocityLbToW2());
+               arrays[2]->InsertNextValue(vx2 * conv->getFactorVelocityLbToW2());
+               arrays[3]->InsertNextValue(vx3 * conv->getFactorVelocityLbToW2());
+               arrays[4]->InsertNextValue(press * conv->getFactorPressureLbToW2());
+            }
+         }
+      }
+   }
+   maxX1 -= 1;
+   maxX2 -= 1;
+   maxX3 -= 1;
+
+   vtkIdType ptIds[8];
+   //cell vector erstellen
+   for(int ix3=minX3; ix3<=maxX3; ix3++)
+   {
+      for(int ix2=minX2; ix2<=maxX2; ix2++)
+      {
+         for(int ix1=minX1; ix1<=maxX1; ix1++)
+         {
+            if(   (ptIds[0]=SWB=nodeNumbers( ix1  , ix2,   ix3   )) >= 0
+               && (ptIds[1]=SEB=nodeNumbers( ix1+1, ix2,   ix3   )) >= 0
+               && (ptIds[2]=NWB=nodeNumbers( ix1  , ix2+1, ix3   )) >= 0
+               && (ptIds[3]=NEB=nodeNumbers( ix1+1, ix2+1, ix3   )) >= 0
+               && (ptIds[4]=SWT=nodeNumbers( ix1  , ix2,   ix3+1 )) >= 0
+               && (ptIds[5]=SET=nodeNumbers( ix1+1, ix2,   ix3+1 )) >= 0
+               && (ptIds[6]=NWT=nodeNumbers( ix1  , ix2+1, ix3+1 )) >= 0 
+               && (ptIds[7]=NET=nodeNumbers( ix1+1, ix2+1, ix3+1 )) >= 0
+               )
+            {
+               unstructuredGrid->InsertNextCell((int)VTK_VOXEL, (vtkIdType)8, ptIds);
+            }
+         }
+      }
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+void InSituVTKCoProcessor::readConfigFile( const std::string& configFile )
+{
+   ifstream ifs;
+   ifs.open (configFile, ifstream::in);
+   if(!ifs) throw UbException(UB_EXARGS,"can not open "+configFile);
+ 
+   string dummy;
+   int wRank = 0;
+   getline(ifs, dummy);
+   int np = Communicator::getInstance()->getNumberOfProcesses();
+
+   while (ifs.good())
+   {
+      getline(ifs, dummy, ';');
+      getline(ifs, wIP, ';');
+      getline(ifs, wHostname, ';');
+      getline(ifs, dummy);
+      wPort = stoi(dummy);
+      if(wRank == gridRank) break;
+      wRank++;
+   }
+   ifs.close();
+}
+
+//////////////////////////////////////////////////////////////////////////
+
+#endif
+
+
diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/InSituVTKCoProcessor.h b/src/cpu/VirtualFluidsCore/CoProcessors/InSituVTKCoProcessor.h
index 12959df68e741ae15bb173c19698c761b3ac38c1..0b3b440c488e4012da4f15555ffef5d4a8edeb1a 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/InSituVTKCoProcessor.h
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/InSituVTKCoProcessor.h
@@ -1,52 +1,52 @@
-#ifdef VF_VTK
-
-#ifndef InSituVTKCoProcessor_h__
-#define InSituVTKCoProcessor_h__
-
-#include <CoProcessor.h>
-#include <Grid3D.h>
-#include <LBMUnitConverter.h>
-
-#include <string>
-
-//VTK headers
-#include <vtkSocketCommunicator.h>
-#include <vtkSocketController.h>
-#include <vtkSmartPointer.h>
-#include <vtkUnstructuredGrid.h>
-#include <vtkDoubleArray.h>
-
-class InSituVTKCoProcessor : public CoProcessor
-{
-public:
-   InSituVTKCoProcessor();
-   InSituVTKCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string& configFile, SPtr<LBMUnitConverter> conv);
-   virtual ~InSituVTKCoProcessor(); 
-   void process(double step);
-protected:
-   void collectData(double step);
-   void addData(SPtr<Block3D> block);
-   void readConfigFile(const std::string& configFile);
-
-   //void clearData();
-private:
-   std::string path;
-   SPtr<LBMUnitConverter> conv;
-   std::vector<std::vector<SPtr<Block3D>> > blockVector;
-   int minInitLevel;
-   int maxInitLevel;
-   int gridRank;
-   vtkSmartPointer<vtkSocketCommunicator> comm;
-   vtkSmartPointer<vtkSocketController>   contr;
-   vtkSmartPointer<vtkUnstructuredGrid> unstructuredGrid;
-   vtkSmartPointer<vtkPoints> points;
-   vtkSmartPointer<vtkDoubleArray> arrays[5];
-   int wPort;
-   std::string wHostname;
-   std::string wIP;
-};
-
-#endif // InSituVTKCoProcessor_h__
-
-#endif
-
+#ifdef VF_VTK
+
+#ifndef InSituVTKCoProcessor_h__
+#define InSituVTKCoProcessor_h__
+
+#include <CoProcessor.h>
+#include <Grid3D.h>
+#include <LBMUnitConverter.h>
+
+#include <string>
+
+//VTK headers
+#include <vtkSocketCommunicator.h>
+#include <vtkSocketController.h>
+#include <vtkSmartPointer.h>
+#include <vtkUnstructuredGrid.h>
+#include <vtkDoubleArray.h>
+
+class InSituVTKCoProcessor : public CoProcessor
+{
+public:
+   InSituVTKCoProcessor();
+   InSituVTKCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string& configFile, SPtr<LBMUnitConverter> conv);
+   virtual ~InSituVTKCoProcessor(); 
+   void process(double step);
+protected:
+   void collectData(double step);
+   void addData(SPtr<Block3D> block);
+   void readConfigFile(const std::string& configFile);
+
+   //void clearData();
+private:
+   std::string path;
+   SPtr<LBMUnitConverter> conv;
+   std::vector<std::vector<SPtr<Block3D>> > blockVector;
+   int minInitLevel;
+   int maxInitLevel;
+   int gridRank;
+   vtkSmartPointer<vtkSocketCommunicator> comm;
+   vtkSmartPointer<vtkSocketController>   contr;
+   vtkSmartPointer<vtkUnstructuredGrid> unstructuredGrid;
+   vtkSmartPointer<vtkPoints> points;
+   vtkSmartPointer<vtkDoubleArray> arrays[5];
+   int wPort;
+   std::string wHostname;
+   std::string wIP;
+};
+
+#endif // InSituVTKCoProcessor_h__
+
+#endif
+
diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/IntegrateValuesHelper.h b/src/cpu/VirtualFluidsCore/CoProcessors/IntegrateValuesHelper.h
index 49ec3b1567f3c502a44bbdc678797c531844cfc0..457d24ef527045fad27e1cc5b8229d053197315f 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/IntegrateValuesHelper.h
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/IntegrateValuesHelper.h
@@ -1,89 +1,89 @@
-#ifndef INTEGRATEVALUESHELPER_H
-#define INTEGRATEVALUESHELPER_H
-
-#include <PointerDefinitions.h>
-
-#include "Grid3D.h"
-#include "D3Q27System.h"
-#include "Communicator.h"
-#include "GbCuboid3D.h"
-#include "CbArray2D.h"
-#include "Block3D.h"
-
-//struct CalcNodes 
-//{
-//	SPtr<Block3D> block;
-//	std::vector<UbTupleInt3> nodes;
-//};
-//
-//struct Nodes
-//{
-//   SPtr<Block3D> block;
-//   UbTupleInt3 nodes;
-//};
-
-
-class IntegrateValuesHelper
-{
-public:
-   struct CalcNodes
-   {
-      SPtr<Block3D> block;
-      std::vector<UbTupleInt3> nodes;
-   };
-
-   struct Node
-   {
-      SPtr<Block3D> block;
-      UbTupleInt3 node;
-   };
-public:
-	IntegrateValuesHelper(SPtr<Grid3D> grid, SPtr<Communicator> comm, 
-		double minX1, double minX2, double minX3, 
-		double  maxX1, double maxX2, double maxX3);
-   IntegrateValuesHelper(SPtr<Grid3D> grid, SPtr<Communicator> comm,
-      double minX1, double minX2, double minX3,
-      double  maxX1, double maxX2, double maxX3, int level);
-	virtual ~IntegrateValuesHelper();
-
-	void calculateMQ();
-	void calculateAV();
-	void clearData();
-
-	double getRho() {return sRho;}
-	double getVx1() {return sVx1;} 
-	double getVx2() {return sVx2;}
-	double getVx3() {return sVx3;}
-   double getCellsVolume() { return sCellVolume; }
- //  LBMReal getVm() { return sVm; }
-	//LBMReal getPress() {return sPress;}
-	double getAvVx1(){return sAvVx1;}
-	double getAvVx2(){return sAvVx2;}
-	double getAvVx3(){return sAvVx3;}
-	double getTSx1(){return sTSx1;}
-	double getTSx2(){return sTSx2;}
-	double getTSx3(){return sTSx3;}
-	double getTSx1x3(){return sTSx1x3;}
-
-	LBMReal getNumberOfFluidsNodes();
-	LBMReal getNumberOfSolidNodes();
-	GbCuboid3DPtr getBoundingBox();
-   std::vector<CalcNodes> getCNodes();
-
-protected:
-private:
-	void init(int level);
-
-   bool root;
-	SPtr<Grid3D> grid;
-   double sVx1, sVx2, sVx3, sRho, sCellVolume;// sPress, sVm;
-   double numberOfFluidsNodes, numberOfSolidNodes;
-   double sAvVx1, sAvVx2, sAvVx3, sTSx1, sTSx2, sTSx3, sTSx1x3;
-	std::vector<CalcNodes> cnodes;
-	GbCuboid3DPtr boundingBox;
-	SPtr<Communicator> comm;
-   CbArray2D<Node> cnodes2DMatrix;
-	enum Values{AvVx = 0, AvVy = 1, AvVz = 2, AvVxx = 3, AvVyy = 4, AvVzz = 5, AvVxy = 6, AvVyz = 7, AvVxz = 8};
-};
-
-#endif
+#ifndef INTEGRATEVALUESHELPER_H
+#define INTEGRATEVALUESHELPER_H
+
+#include <PointerDefinitions.h>
+
+#include "Grid3D.h"
+#include "D3Q27System.h"
+#include "Communicator.h"
+#include "GbCuboid3D.h"
+#include "CbArray2D.h"
+#include "Block3D.h"
+
+//struct CalcNodes 
+//{
+//	SPtr<Block3D> block;
+//	std::vector<UbTupleInt3> nodes;
+//};
+//
+//struct Nodes
+//{
+//   SPtr<Block3D> block;
+//   UbTupleInt3 nodes;
+//};
+
+
+class IntegrateValuesHelper
+{
+public:
+   struct CalcNodes
+   {
+      SPtr<Block3D> block;
+      std::vector<UbTupleInt3> nodes;
+   };
+
+   struct Node
+   {
+      SPtr<Block3D> block;
+      UbTupleInt3 node;
+   };
+public:
+	IntegrateValuesHelper(SPtr<Grid3D> grid, SPtr<Communicator> comm, 
+		double minX1, double minX2, double minX3, 
+		double  maxX1, double maxX2, double maxX3);
+   IntegrateValuesHelper(SPtr<Grid3D> grid, SPtr<Communicator> comm,
+      double minX1, double minX2, double minX3,
+      double  maxX1, double maxX2, double maxX3, int level);
+	virtual ~IntegrateValuesHelper();
+
+	void calculateMQ();
+	void calculateAV();
+	void clearData();
+
+	double getRho() {return sRho;}
+	double getVx1() {return sVx1;} 
+	double getVx2() {return sVx2;}
+	double getVx3() {return sVx3;}
+   double getCellsVolume() { return sCellVolume; }
+ //  LBMReal getVm() { return sVm; }
+	//LBMReal getPress() {return sPress;}
+	double getAvVx1(){return sAvVx1;}
+	double getAvVx2(){return sAvVx2;}
+	double getAvVx3(){return sAvVx3;}
+	double getTSx1(){return sTSx1;}
+	double getTSx2(){return sTSx2;}
+	double getTSx3(){return sTSx3;}
+	double getTSx1x3(){return sTSx1x3;}
+
+	LBMReal getNumberOfFluidsNodes();
+	LBMReal getNumberOfSolidNodes();
+	GbCuboid3DPtr getBoundingBox();
+   std::vector<CalcNodes> getCNodes();
+
+protected:
+private:
+	void init(int level);
+
+   bool root;
+	SPtr<Grid3D> grid;
+   double sVx1, sVx2, sVx3, sRho, sCellVolume;// sPress, sVm;
+   double numberOfFluidsNodes, numberOfSolidNodes;
+   double sAvVx1, sAvVx2, sAvVx3, sTSx1, sTSx2, sTSx3, sTSx1x3;
+	std::vector<CalcNodes> cnodes;
+	GbCuboid3DPtr boundingBox;
+	SPtr<Communicator> comm;
+   CbArray2D<Node> cnodes2DMatrix;
+	enum Values{AvVx = 0, AvVy = 1, AvVz = 2, AvVxx = 3, AvVyy = 4, AvVzz = 5, AvVxy = 6, AvVyz = 7, AvVxz = 8};
+};
+
+#endif
diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/LineTimeSeriesCoProcessor.h b/src/cpu/VirtualFluidsCore/CoProcessors/LineTimeSeriesCoProcessor.h
index b3d821110bf705851ed5d26c7aa225046597eb43..74514779245381fc640a93ee62f65e03ffee1def 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/LineTimeSeriesCoProcessor.h
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/LineTimeSeriesCoProcessor.h
@@ -1,58 +1,58 @@
-#ifndef LineTimeSeriesCoProcessor_h__
-#define LineTimeSeriesCoProcessor_h__
-
-#include <PointerDefinitions.h>
-#include <string>
-
-#include <mpi.h>
-
-#include "CoProcessor.h"
-#include "LBMSystem.h"
-
-class Communicator;
-class Grid3D;
-class UbScheduler;
-class GbLine3D;
-
-//! \brief  Writes to .csv file time series for a line in x1 direction.
-//! \details It can be used to compute for given time range  the time averaged two-point correlations for a line. <br>
-//!  \f$ R_{ij}(x_{a},x{b},t) = <u_{i}(x_{a},t)u_{j}(x_{a}+r,t)> \f$   <br>
-//           
-//! \author  Konstantin Kutscher 
-
-class LineTimeSeriesCoProcessor : public CoProcessor
-{
-public:
-enum Direction {X1, X2, X3};
-public:
-   LineTimeSeriesCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string& path, SPtr<GbLine3D> line, int level,SPtr<Communicator> comm);
-   ~LineTimeSeriesCoProcessor(){}
-
-   void process(double step) override;
-   void writeLine(const std::string& path);
-
-protected:
-   void collectData();
-private:
-   std::string path;
-   std::string fname;
-   bool root;
-   SPtr<GbLine3D> line;
-   //function pointer
-   typedef void(*CalcMacrosFct)(const LBMReal* const& /*feq[27]*/, LBMReal& /*(d)rho*/, LBMReal& /*vx1*/, LBMReal& /*vx2*/, LBMReal& /*vx3*/);
-   CalcMacrosFct calcMacros;
-   int blocknx;
-   int blockix1;
-   int blockix2;
-   int blockix3;
-   int level;
-   int ix1;
-   int ix2;
-   int ix3;
-   int length;
-   MPI_Comm mpi_comm;
-   int numOfProc;
-   int gridRank;
-   Direction dir;
-};
-#endif // LineTimeSeriesCoProcessor_h__
+#ifndef LineTimeSeriesCoProcessor_h__
+#define LineTimeSeriesCoProcessor_h__
+
+#include <PointerDefinitions.h>
+#include <string>
+
+#include <mpi.h>
+
+#include "CoProcessor.h"
+#include "LBMSystem.h"
+
+class Communicator;
+class Grid3D;
+class UbScheduler;
+class GbLine3D;
+
+//! \brief  Writes to .csv file time series for a line in x1 direction.
+//! \details It can be used to compute for given time range  the time averaged two-point correlations for a line. <br>
+//!  \f$ R_{ij}(x_{a},x{b},t) = <u_{i}(x_{a},t)u_{j}(x_{a}+r,t)> \f$   <br>
+//           
+//! \author  Konstantin Kutscher 
+
+class LineTimeSeriesCoProcessor : public CoProcessor
+{
+public:
+enum Direction {X1, X2, X3};
+public:
+   LineTimeSeriesCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string& path, SPtr<GbLine3D> line, int level,SPtr<Communicator> comm);
+   ~LineTimeSeriesCoProcessor(){}
+
+   void process(double step) override;
+   void writeLine(const std::string& path);
+
+protected:
+   void collectData();
+private:
+   std::string path;
+   std::string fname;
+   bool root;
+   SPtr<GbLine3D> line;
+   //function pointer
+   typedef void(*CalcMacrosFct)(const LBMReal* const& /*feq[27]*/, LBMReal& /*(d)rho*/, LBMReal& /*vx1*/, LBMReal& /*vx2*/, LBMReal& /*vx3*/);
+   CalcMacrosFct calcMacros;
+   int blocknx;
+   int blockix1;
+   int blockix2;
+   int blockix3;
+   int level;
+   int ix1;
+   int ix2;
+   int ix3;
+   int length;
+   MPI_Comm mpi_comm;
+   int numOfProc;
+   int gridRank;
+   Direction dir;
+};
+#endif // LineTimeSeriesCoProcessor_h__
diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/NUPSCounterCoProcessor.cpp b/src/cpu/VirtualFluidsCore/CoProcessors/NUPSCounterCoProcessor.cpp
index 482d9a05d20874a21fac04328e916b109538722c..69f1562e66a90f009dbeb9fd8179db0517a8cebe 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/NUPSCounterCoProcessor.cpp
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/NUPSCounterCoProcessor.cpp
@@ -1,94 +1,94 @@
-//=======================================================================================
-// ____          ____    __    ______     __________   __      __       __        __         
-// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
-//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
-//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
-//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
-//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
-//      \    \  |    |   ________________________________________________________________    
-//       \    \ |    |  |  ______________________________________________________________|   
-//        \    \|    |  |  |         __          __     __     __     ______      _______    
-//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
-//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
-//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
-//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
-//
-//  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 NUPSCounterCoProcessor.cpp
-//! \ingroup CoProcessors
-//! \author Konstantin Kutscher
-//=======================================================================================
-
-#include "NUPSCounterCoProcessor.h"
-
-#include "Communicator.h"
-#include "UbScheduler.h"
-#include "Grid3D.h"
-
-NUPSCounterCoProcessor::NUPSCounterCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, int numOfThreads, SPtr<Communicator> comm)
-                                                   : CoProcessor(grid, s),
-                                                     numOfThreads(numOfThreads),
-                                                     comm(comm),
-                                                     nup(0),
-                                                     nup_t(0),
-                                                     nupsStep(0.0)
-{
-   if (comm->getProcessID() == comm->getRoot())
-   {
-      timer.resetAndStart();
-
-      double nop = comm->getNumberOfProcesses();
-      int minInitLevel = grid->getCoarsestInitializedLevel();
-      int maxInitLevel = grid->getFinestInitializedLevel();
-      UbTupleInt3 blocknx = grid->getBlockNX();
-      double nod = (double)(val<1>(blocknx)) * (double)(val<2>(blocknx)) * (double)(val<3>(blocknx));
-      nup = 0;
-
-      for(int level = minInitLevel; level<=maxInitLevel; level++)
-      {
-         int nob = grid->getNumberOfBlocks(level);
-         nup_t += (double)(1<<level) * nob * nod;
-      }
-      nup = nup_t / nop;
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-NUPSCounterCoProcessor::~NUPSCounterCoProcessor() 
-{
-}
-//////////////////////////////////////////////////////////////////////////
-void NUPSCounterCoProcessor::process(double step)
-{
-   if(scheduler->isDue(step) )
-      collectData(step);
-}
-//////////////////////////////////////////////////////////////////////////
-void NUPSCounterCoProcessor::collectData(double step)
-{
-   if (comm->getProcessID() == comm->getRoot())
-   {
-      double time = timer.stop();
-      double nups_t = nup_t*(step-nupsStep)/time;
-      double nups = nup*(step-nupsStep)/time;
-      double tnups = nups/(double)numOfThreads;
-      UBLOG(logINFO, "Calculation step = "<<step);
-      UBLOG(logINFO, "Total performance = "<<nups_t<<" NUPS");
-      UBLOG(logINFO, "Performance per process = "<<nups<<" NUPS");
-      UBLOG(logINFO, "Performance per thread = "<<tnups<<" NUPS");
-      UBLOG(logINFO, "Time for " << step-nupsStep <<" steps = "<< time <<" s");
-      nupsStep = step;
-      timer.resetAndStart();
-   }
-}
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 NUPSCounterCoProcessor.cpp
+//! \ingroup CoProcessors
+//! \author Konstantin Kutscher
+//=======================================================================================
+
+#include "NUPSCounterCoProcessor.h"
+
+#include "Communicator.h"
+#include "UbScheduler.h"
+#include "Grid3D.h"
+
+NUPSCounterCoProcessor::NUPSCounterCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, int numOfThreads, SPtr<Communicator> comm)
+                                                   : CoProcessor(grid, s),
+                                                     numOfThreads(numOfThreads),
+                                                     comm(comm),
+                                                     nup(0),
+                                                     nup_t(0),
+                                                     nupsStep(0.0)
+{
+   if (comm->getProcessID() == comm->getRoot())
+   {
+      timer.resetAndStart();
+
+      double nop = comm->getNumberOfProcesses();
+      int minInitLevel = grid->getCoarsestInitializedLevel();
+      int maxInitLevel = grid->getFinestInitializedLevel();
+      UbTupleInt3 blocknx = grid->getBlockNX();
+      double nod = (double)(val<1>(blocknx)) * (double)(val<2>(blocknx)) * (double)(val<3>(blocknx));
+      nup = 0;
+
+      for(int level = minInitLevel; level<=maxInitLevel; level++)
+      {
+         int nob = grid->getNumberOfBlocks(level);
+         nup_t += (double)(1<<level) * nob * nod;
+      }
+      nup = nup_t / nop;
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+NUPSCounterCoProcessor::~NUPSCounterCoProcessor() 
+{
+}
+//////////////////////////////////////////////////////////////////////////
+void NUPSCounterCoProcessor::process(double step)
+{
+   if(scheduler->isDue(step) )
+      collectData(step);
+}
+//////////////////////////////////////////////////////////////////////////
+void NUPSCounterCoProcessor::collectData(double step)
+{
+   if (comm->getProcessID() == comm->getRoot())
+   {
+      double time = timer.stop();
+      double nups_t = nup_t*(step-nupsStep)/time;
+      double nups = nup*(step-nupsStep)/time;
+      double tnups = nups/(double)numOfThreads;
+      UBLOG(logINFO, "Calculation step = "<<step);
+      UBLOG(logINFO, "Total performance = "<<nups_t<<" NUPS");
+      UBLOG(logINFO, "Performance per process = "<<nups<<" NUPS");
+      UBLOG(logINFO, "Performance per thread = "<<tnups<<" NUPS");
+      UBLOG(logINFO, "Time for " << step-nupsStep <<" steps = "<< time <<" s");
+      nupsStep = step;
+      timer.resetAndStart();
+   }
+}
diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/NUPSCounterCoProcessor.h b/src/cpu/VirtualFluidsCore/CoProcessors/NUPSCounterCoProcessor.h
index 6c68025212f9e119eaa55ae4e89d10da4df2647a..6d929fc25404aa53564598ac31d1bc18ee5acc98 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/NUPSCounterCoProcessor.h
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/NUPSCounterCoProcessor.h
@@ -1,77 +1,77 @@
-//=======================================================================================
-// ____          ____    __    ______     __________   __      __       __        __         
-// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
-//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
-//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
-//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
-//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
-//      \    \  |    |   ________________________________________________________________    
-//       \    \ |    |  |  ______________________________________________________________|   
-//        \    \|    |  |  |         __          __     __     __     ______      _______    
-//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
-//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
-//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
-//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
-//
-//  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 NUPSCounterCoProcessor.h
-//! \ingroup CoProcessors
-//! \author Konstantin Kutscher
-//=======================================================================================
-
-#ifndef NUPSCOUNTERCoProcessor_H_
-#define NUPSCOUNTERCoProcessor_H_
-
-#include <PointerDefinitions.h>
-
-#include "CoProcessor.h"
-#include "basics/utilities/UbTiming.h"
-
-class Communicator;
-class Grid3D;
-class UbScheduler;
-
-//! \class NUPSCounterCoProcessor
-//! \brief A class calculates Nodal Updates Per Second (NUPS)
-class NUPSCounterCoProcessor: public CoProcessor
-{
-public:
-   //! \brief Construct NUPSCounterCoProcessor object for grid object and scheduler object.
-   //! \pre The Grid3D and UbScheduler objects must exist.
-   //! \param grid is observable Grid3D object
-   //! \param s is UbScheduler object for scheduling of observer
-   //! \param numOfThreads is number of threads
-   //! \param comm is Communicator object
-   NUPSCounterCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, int numOfThreads, SPtr<Communicator> comm);
-   virtual ~NUPSCounterCoProcessor();
-
-   void process(double step)override;
-
-protected:
-   //! Collect data for calculation of NUPS
-   //! \param step is a time step
-   void collectData(double step);
-   UbTimer timer;
-   int numOfThreads;
-   double numberOfNodes;
-   double numberOfBlocks;
-   double nup;
-   double nup_t;
-   double nupsStep;
-   SPtr<Communicator> comm;
-};
-
-
-#endif 
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 NUPSCounterCoProcessor.h
+//! \ingroup CoProcessors
+//! \author Konstantin Kutscher
+//=======================================================================================
+
+#ifndef NUPSCOUNTERCoProcessor_H_
+#define NUPSCOUNTERCoProcessor_H_
+
+#include <PointerDefinitions.h>
+
+#include "CoProcessor.h"
+#include "basics/utilities/UbTiming.h"
+
+class Communicator;
+class Grid3D;
+class UbScheduler;
+
+//! \class NUPSCounterCoProcessor
+//! \brief A class calculates Nodal Updates Per Second (NUPS)
+class NUPSCounterCoProcessor: public CoProcessor
+{
+public:
+   //! \brief Construct NUPSCounterCoProcessor object for grid object and scheduler object.
+   //! \pre The Grid3D and UbScheduler objects must exist.
+   //! \param grid is observable Grid3D object
+   //! \param s is UbScheduler object for scheduling of observer
+   //! \param numOfThreads is number of threads
+   //! \param comm is Communicator object
+   NUPSCounterCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, int numOfThreads, SPtr<Communicator> comm);
+   virtual ~NUPSCounterCoProcessor();
+
+   void process(double step)override;
+
+protected:
+   //! Collect data for calculation of NUPS
+   //! \param step is a time step
+   void collectData(double step);
+   UbTimer timer;
+   int numOfThreads;
+   double numberOfNodes;
+   double numberOfBlocks;
+   double nup;
+   double nup_t;
+   double nupsStep;
+   SPtr<Communicator> comm;
+};
+
+
+#endif 
diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/PressureDifferenceCoProcessor.cpp b/src/cpu/VirtualFluidsCore/CoProcessors/PressureDifferenceCoProcessor.cpp
index 65aa528690f6b57449c17a77a8962f67b1d5e7a6..3d2b918655818d90a7ff09e4275d49c6b172559d 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/PressureDifferenceCoProcessor.cpp
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/PressureDifferenceCoProcessor.cpp
@@ -1,102 +1,102 @@
-/*
- * D3Q27RhoCoProcessor.cpp
- *
- *  Created on: 28.12.2010
- *      Author: kucher
- */
-
-#include "PressureDifferenceCoProcessor.h"
-
-#include <fstream>
-
-#include "IntegrateValuesHelper.h"
-#include "LBMUnitConverter.h"
-#include "Communicator.h"
-#include "UbScheduler.h"
-#include "Grid3D.h"
-
-
-PressureDifferenceCoProcessor::PressureDifferenceCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string& path,
-                                                                 SPtr<IntegrateValuesHelper> h1, SPtr<IntegrateValuesHelper> h2, 
-                                                                 LBMReal rhoReal, LBMReal uReal, LBMReal uLB,
-                                                                 SPtr<Communicator> comm)
-
-                                                : CoProcessor(grid, s)
-                                                , path(path)
-																, h1(h1)
-																, h2(h2)
-                                                ,comm(comm)
-{
-   if (comm->getProcessID() == comm->getRoot())
-   {
-      std::ofstream ostr;
-      std::string fname = path;
-      ostr.open(fname.c_str(), std::ios_base::out);
-      if(!ostr)
-      { 
-         ostr.clear();
-         std::string path = UbSystem::getPathFromString(fname);
-         if(path.size()>0){ UbSystem::makeDirectory(path); ostr.open(fname.c_str(), std::ios_base::out);}
-         if(!ostr) throw UbException(UB_EXARGS,"couldn't open file "+fname);
-      }
-      ostr << "step" << "\t" << "nodes1" << "\t" << "nodes2" << "\t";
-      ostr << "sRho1" << "\t" << "p1_1"  << "\t" << "sRho2" << "\t" << "p1_2" << "\t" << "deltaP1"<< "\t";
-      ostr << "sPress1" << "\t" << "p2_1" << "\t" << "sPress2" << "\t" << "p2_2" << "\t" << "deltaP2";
-      ostr << std::endl;
-      ostr.close();
-
-      factor1 = (1.0/3.0)*rhoReal*(uReal/uLB)*(uReal/uLB);
-      factor2 = rhoReal*(uReal/uLB)*(uReal/uLB);
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-PressureDifferenceCoProcessor::~PressureDifferenceCoProcessor() 
-{
-}
-//////////////////////////////////////////////////////////////////////////
-void PressureDifferenceCoProcessor::process(double step)
-{
-   if(scheduler->isDue(step) )
-      collectData(step);
-}
-//////////////////////////////////////////////////////////////////////////
-void PressureDifferenceCoProcessor::collectData(double step)
-{
-   h1->calculateMQ();
-   h2->calculateMQ();
-   
-   if (comm->getProcessID() == comm->getRoot())
-   {
-      int istep = static_cast<int>(step);
-      std::ofstream ostr;
-      double nn1 = h1->getNumberOfFluidsNodes();
-      double nn2 = h2->getNumberOfFluidsNodes();
-      double rho1 = h1->getRho();
-      double rho2 = h2->getRho();
-      double p1_1 = (rho1/nn1) * factor1;
-      double p1_2 = (rho2/nn2) * factor1;
-      double dp1 = p1_1 - p1_2;
-
-      //double press1 = h1->getPress();
-      //double press2 = h2->getPress();
-      //double p2_1 = (press1/nn1) * factor2;
-      //double p2_2 = (press2/nn2) * factor2;
-      //double dp2 = p2_1 - p2_2;
-
-      std::string fname = path;
-      ostr.open(fname.c_str(), std::ios_base::out | std::ios_base::app);
-      if(!ostr)
-      { 
-         ostr.clear();
-         std::string path = UbSystem::getPathFromString(fname);
-         if(path.size()>0){ UbSystem::makeDirectory(path); ostr.open(fname.c_str(), std::ios_base::out | std::ios_base::app);}
-         if(!ostr) throw UbException(UB_EXARGS,"couldn't open file "+fname);
-      }
-
-      ostr << istep << "\t" << nn1 << "\t"  << nn2 << "\t"; 
-      ostr << rho1 << "\t" << p1_1 << "\t" << rho2 << "\t" << p1_2 << "\t" << dp1 << "\t";
-      //ostr << press1 << "\t" << p2_1 << "\t" << press2 << "\t" << p2_2 << "\t" << dp2;
-      ostr << std::endl;
-      ostr.close();
-   }
-}
+/*
+ * D3Q27RhoCoProcessor.cpp
+ *
+ *  Created on: 28.12.2010
+ *      Author: kucher
+ */
+
+#include "PressureDifferenceCoProcessor.h"
+
+#include <fstream>
+
+#include "IntegrateValuesHelper.h"
+#include "LBMUnitConverter.h"
+#include "Communicator.h"
+#include "UbScheduler.h"
+#include "Grid3D.h"
+
+
+PressureDifferenceCoProcessor::PressureDifferenceCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string& path,
+                                                                 SPtr<IntegrateValuesHelper> h1, SPtr<IntegrateValuesHelper> h2, 
+                                                                 LBMReal rhoReal, LBMReal uReal, LBMReal uLB,
+                                                                 SPtr<Communicator> comm)
+
+                                                : CoProcessor(grid, s)
+                                                , path(path)
+																, h1(h1)
+																, h2(h2)
+                                                ,comm(comm)
+{
+   if (comm->getProcessID() == comm->getRoot())
+   {
+      std::ofstream ostr;
+      std::string fname = path;
+      ostr.open(fname.c_str(), std::ios_base::out);
+      if(!ostr)
+      { 
+         ostr.clear();
+         std::string path = UbSystem::getPathFromString(fname);
+         if(path.size()>0){ UbSystem::makeDirectory(path); ostr.open(fname.c_str(), std::ios_base::out);}
+         if(!ostr) throw UbException(UB_EXARGS,"couldn't open file "+fname);
+      }
+      ostr << "step" << "\t" << "nodes1" << "\t" << "nodes2" << "\t";
+      ostr << "sRho1" << "\t" << "p1_1"  << "\t" << "sRho2" << "\t" << "p1_2" << "\t" << "deltaP1"<< "\t";
+      ostr << "sPress1" << "\t" << "p2_1" << "\t" << "sPress2" << "\t" << "p2_2" << "\t" << "deltaP2";
+      ostr << std::endl;
+      ostr.close();
+
+      factor1 = (1.0/3.0)*rhoReal*(uReal/uLB)*(uReal/uLB);
+      factor2 = rhoReal*(uReal/uLB)*(uReal/uLB);
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+PressureDifferenceCoProcessor::~PressureDifferenceCoProcessor() 
+{
+}
+//////////////////////////////////////////////////////////////////////////
+void PressureDifferenceCoProcessor::process(double step)
+{
+   if(scheduler->isDue(step) )
+      collectData(step);
+}
+//////////////////////////////////////////////////////////////////////////
+void PressureDifferenceCoProcessor::collectData(double step)
+{
+   h1->calculateMQ();
+   h2->calculateMQ();
+   
+   if (comm->getProcessID() == comm->getRoot())
+   {
+      int istep = static_cast<int>(step);
+      std::ofstream ostr;
+      double nn1 = h1->getNumberOfFluidsNodes();
+      double nn2 = h2->getNumberOfFluidsNodes();
+      double rho1 = h1->getRho();
+      double rho2 = h2->getRho();
+      double p1_1 = (rho1/nn1) * factor1;
+      double p1_2 = (rho2/nn2) * factor1;
+      double dp1 = p1_1 - p1_2;
+
+      //double press1 = h1->getPress();
+      //double press2 = h2->getPress();
+      //double p2_1 = (press1/nn1) * factor2;
+      //double p2_2 = (press2/nn2) * factor2;
+      //double dp2 = p2_1 - p2_2;
+
+      std::string fname = path;
+      ostr.open(fname.c_str(), std::ios_base::out | std::ios_base::app);
+      if(!ostr)
+      { 
+         ostr.clear();
+         std::string path = UbSystem::getPathFromString(fname);
+         if(path.size()>0){ UbSystem::makeDirectory(path); ostr.open(fname.c_str(), std::ios_base::out | std::ios_base::app);}
+         if(!ostr) throw UbException(UB_EXARGS,"couldn't open file "+fname);
+      }
+
+      ostr << istep << "\t" << nn1 << "\t"  << nn2 << "\t"; 
+      ostr << rho1 << "\t" << p1_1 << "\t" << rho2 << "\t" << p1_2 << "\t" << dp1 << "\t";
+      //ostr << press1 << "\t" << p2_1 << "\t" << press2 << "\t" << p2_2 << "\t" << dp2;
+      ostr << std::endl;
+      ostr.close();
+   }
+}
diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/PressureDifferenceCoProcessor.h b/src/cpu/VirtualFluidsCore/CoProcessors/PressureDifferenceCoProcessor.h
index e844be41b871f74224d31621ef59e5ab0c4bd49c..2503bbd188cceed14d8bb0c0e0a55e91e2b8e37b 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/PressureDifferenceCoProcessor.h
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/PressureDifferenceCoProcessor.h
@@ -1,44 +1,44 @@
-/*
- *  D3Q27PressureDifferenceCoProcessor.h
- *
- *  Created on: 28.12.2010
- *  Author: kucher
- */
-
-#ifndef D3Q27PRESSUREDIFFERENCECoProcessor_H
-#define D3Q27PRESSUREDIFFERENCECoProcessor_H
-
-#include <PointerDefinitions.h>
-#include <string>
-
-#include "CoProcessor.h"
-#include "LBMSystem.h"
-
-class Communicator;
-class Grid3D;
-class UbScheduler;
-class LBMUnitConverter;
-class IntegrateValuesHelper;
-
-class PressureDifferenceCoProcessor: public CoProcessor {
-public:
-	PressureDifferenceCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string& path,
-        SPtr<IntegrateValuesHelper> h1, SPtr<IntegrateValuesHelper> h2,
-                                   LBMReal rhoReal, LBMReal uReal, LBMReal uLB,
-                                   /*const SPtr<LBMUnitConverter> conv,*/ SPtr<Communicator> comm);
-	virtual ~PressureDifferenceCoProcessor();
-
-	void process(double step) override;
-
-protected:
-    SPtr<IntegrateValuesHelper> h1, h2;
-   std::string path;
-   SPtr<LBMUnitConverter> conv;
-	void collectData(double step);
-    SPtr<Communicator> comm;
-   LBMReal factor1; //= (1/3)*rhoReal*(uReal/uLB)^2 for calculation pReal = rhoLB * (1/3)*rhoReal*(uReal/uLB)^2, rhoReal and uReal in SI
-   LBMReal factor2; //= rhoReal*(uReal/uLB)^2       for calculation pReal = press * rhoReal*(uReal/uLB)^2,       rhoReal and uReal in SI
-};
-
-
-#endif /* D3Q27RHODIFFERENCECoProcessor_H_ */
+/*
+ *  D3Q27PressureDifferenceCoProcessor.h
+ *
+ *  Created on: 28.12.2010
+ *  Author: kucher
+ */
+
+#ifndef D3Q27PRESSUREDIFFERENCECoProcessor_H
+#define D3Q27PRESSUREDIFFERENCECoProcessor_H
+
+#include <PointerDefinitions.h>
+#include <string>
+
+#include "CoProcessor.h"
+#include "LBMSystem.h"
+
+class Communicator;
+class Grid3D;
+class UbScheduler;
+class LBMUnitConverter;
+class IntegrateValuesHelper;
+
+class PressureDifferenceCoProcessor: public CoProcessor {
+public:
+	PressureDifferenceCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string& path,
+        SPtr<IntegrateValuesHelper> h1, SPtr<IntegrateValuesHelper> h2,
+                                   LBMReal rhoReal, LBMReal uReal, LBMReal uLB,
+                                   /*const SPtr<LBMUnitConverter> conv,*/ SPtr<Communicator> comm);
+	virtual ~PressureDifferenceCoProcessor();
+
+	void process(double step) override;
+
+protected:
+    SPtr<IntegrateValuesHelper> h1, h2;
+   std::string path;
+   SPtr<LBMUnitConverter> conv;
+	void collectData(double step);
+    SPtr<Communicator> comm;
+   LBMReal factor1; //= (1/3)*rhoReal*(uReal/uLB)^2 for calculation pReal = rhoLB * (1/3)*rhoReal*(uReal/uLB)^2, rhoReal and uReal in SI
+   LBMReal factor2; //= rhoReal*(uReal/uLB)^2       for calculation pReal = press * rhoReal*(uReal/uLB)^2,       rhoReal and uReal in SI
+};
+
+
+#endif /* D3Q27RHODIFFERENCECoProcessor_H_ */
diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/QCriterionCoProcessor.h b/src/cpu/VirtualFluidsCore/CoProcessors/QCriterionCoProcessor.h
index 1a817601c6269189bffba1855ed5907542b3489c..506922db8e58c934b4144f561caed96a0dda2af4 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/QCriterionCoProcessor.h
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/QCriterionCoProcessor.h
@@ -1,67 +1,67 @@
-//! \file QCriterionCoProcessor.h
-//!  \brief Created on: 25.08.2013
-//!  \author: Sonja Uphoff
-
-
-#ifndef QCriterionCoProcessor_H
-#define QCriterionCoProcessor_H
-
-#include <PointerDefinitions.h>
-#include <string>
-#include <vector>
-
-#include "CoProcessor.h"
-#include "LBMSystem.h"
-#include "UbTuple.h"
-
-class Communicator;
-class Grid3D;
-class UbScheduler;
-class WbWriter;
-class Block3D;
-
-//! \brief  Computes the value Q with which vortices can be visualized as isocontours to Q=0, writes to .vtk, For uniform, serial setups only!
-//! \details writes at given time intervals specified in scheduler (s)  
-//!          Processing: paraview, take isolines of entry for Q-criterion vortex detection 
-//!			 Q-Criterion: Visualize Vorteces as regions where Vorticity is larger than strain rate (Hunt, 1988)
-//! \author  Sonja Uphoff 
-
-class QCriterionCoProcessor : public CoProcessor
-{
-public:
-	QCriterionCoProcessor(SPtr<Grid3D> grid, const std::string& path, WbWriter* const writer,
-        SPtr<UbScheduler> s, SPtr<Communicator> comm);
-	//! Make update if timestep is write-timestep specified in SPtr<UbScheduler> s
-	void process(double step) override; 
-
-protected:
-	//! Prepare data and write in .vtk file
-	void collectData(double step);
-	//! Q is computed for all points in a block. Data for writing is added to data and cell vectors. 
-	void addData(const SPtr<Block3D> block);
-	//! After writing to .vtk-file, all vectors are reset 
-	void clearData();
-	//! Computes macroscopic velocities 
-	void computeVelocity(LBMReal* f, LBMReal* v, bool compressible);
-	//! Computes average and RMS values of macroscopic quantities 
-	void getNeighborVelocities(int offx, int offy, int offz, int ix1, int ix2, int ix3,const SPtr<Block3D> block, LBMReal* vE,LBMReal* vW);
-
-private:
-	void init();
-	std::vector<UbTupleFloat3> nodes;
-	std::vector<UbTupleUInt8> cells;
-	std::vector<std::string> datanames; //only one entry for QKrit-CoProcessor: Q
-	std::vector<std::vector<double> > data; 
-	std::vector<std::vector<SPtr<Block3D> > > blockVector;
-	int minInitLevel; //go through all levels for block vector of current process from minInitLevel to maxInitLevel
-	int maxInitLevel;
-	int gridRank;     //comm-Rank des aktuellen prozesses
-	std::string path;
-	WbWriter* writer;
-    SPtr<Communicator> comm;
-	enum Values{xdir = 0, ydir = 1, zdir = 2};  	//labels for the different components
-};
-
-#endif
-
-
+//! \file QCriterionCoProcessor.h
+//!  \brief Created on: 25.08.2013
+//!  \author: Sonja Uphoff
+
+
+#ifndef QCriterionCoProcessor_H
+#define QCriterionCoProcessor_H
+
+#include <PointerDefinitions.h>
+#include <string>
+#include <vector>
+
+#include "CoProcessor.h"
+#include "LBMSystem.h"
+#include "UbTuple.h"
+
+class Communicator;
+class Grid3D;
+class UbScheduler;
+class WbWriter;
+class Block3D;
+
+//! \brief  Computes the value Q with which vortices can be visualized as isocontours to Q=0, writes to .vtk, For uniform, serial setups only!
+//! \details writes at given time intervals specified in scheduler (s)  
+//!          Processing: paraview, take isolines of entry for Q-criterion vortex detection 
+//!			 Q-Criterion: Visualize Vorteces as regions where Vorticity is larger than strain rate (Hunt, 1988)
+//! \author  Sonja Uphoff 
+
+class QCriterionCoProcessor : public CoProcessor
+{
+public:
+	QCriterionCoProcessor(SPtr<Grid3D> grid, const std::string& path, WbWriter* const writer,
+        SPtr<UbScheduler> s, SPtr<Communicator> comm);
+	//! Make update if timestep is write-timestep specified in SPtr<UbScheduler> s
+	void process(double step) override; 
+
+protected:
+	//! Prepare data and write in .vtk file
+	void collectData(double step);
+	//! Q is computed for all points in a block. Data for writing is added to data and cell vectors. 
+	void addData(const SPtr<Block3D> block);
+	//! After writing to .vtk-file, all vectors are reset 
+	void clearData();
+	//! Computes macroscopic velocities 
+	void computeVelocity(LBMReal* f, LBMReal* v, bool compressible);
+	//! Computes average and RMS values of macroscopic quantities 
+	void getNeighborVelocities(int offx, int offy, int offz, int ix1, int ix2, int ix3,const SPtr<Block3D> block, LBMReal* vE,LBMReal* vW);
+
+private:
+	void init();
+	std::vector<UbTupleFloat3> nodes;
+	std::vector<UbTupleUInt8> cells;
+	std::vector<std::string> datanames; //only one entry for QKrit-CoProcessor: Q
+	std::vector<std::vector<double> > data; 
+	std::vector<std::vector<SPtr<Block3D> > > blockVector;
+	int minInitLevel; //go through all levels for block vector of current process from minInitLevel to maxInitLevel
+	int maxInitLevel;
+	int gridRank;     //comm-Rank des aktuellen prozesses
+	std::string path;
+	WbWriter* writer;
+    SPtr<Communicator> comm;
+	enum Values{xdir = 0, ydir = 1, zdir = 2};  	//labels for the different components
+};
+
+#endif
+
+
diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/ShearStressCoProcessor.h b/src/cpu/VirtualFluidsCore/CoProcessors/ShearStressCoProcessor.h
index 3ab85f3aeaa8b3a5f02d5cf48fc0f6140d256835..4be491635fddad878b47b4780d5505c561e3dd3c 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/ShearStressCoProcessor.h
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/ShearStressCoProcessor.h
@@ -1,69 +1,69 @@
-#ifndef D3Q27ShearStressCoProcessor_H
-#define D3Q27ShearStressCoProcessor_H
-
-#include <PointerDefinitions.h>
-#include <vector>
-#include <string>
-
-#include <basics/utilities/UbTuple.h>
-
-#include "CoProcessor.h"
-
-class Block3D;
-class Grid3D;
-class UbScheduler;
-class D3Q27Interactor;
-class BCArray3D;
-class WbWriter;
-
-//! \brief  Computes the shear stress and y plus values and writes to parallel .vtk
-//! \details writes at given time intervals specified in scheduler (s) and resets according to scheduler (rs).  
-//!          Take root to obtain  during post processing (paraview).   
-//! \author  K. Kucher, S. Uphoff, M. Geier, E. Goraki Fard  
-
-class ShearStressCoProcessor: public CoProcessor 
-{
-public:
-   //! Default constructor
-   ShearStressCoProcessor(){}
-   //! Constructor
-   ShearStressCoProcessor(SPtr<Grid3D> grid, const std::string& path, WbWriter* const writer,
-       SPtr<UbScheduler> s, SPtr<UbScheduler> rs);
-   virtual ~ShearStressCoProcessor(); 
-    
-   void process(double step) override; 
-
-   void addInteractor(SPtr<D3Q27Interactor> interactor);
-protected:
-   //! Computes average and shear stress values of macroscopic quantities 
-   void calculateShearStress(double timeStep);
-   //! Prepare data and write in .vtk file
-   void collectData(double step);
-   //! Reset data
-   void resetData(double step);
-   //! prepare data
-   void addData();
-   void clearData();
-   void reset(double step);
-   void findPlane(int ix1,int ix2,int ix3, SPtr<Grid3D> grid, SPtr<Block3D> block,double &A,double &B,double &C,double &D,double &ii);
-   bool checkUndefindedNodes(SPtr<BCArray3D> bcArray,int ix1,int ix2,int ix3);
-   void initDistance();
-
-private:
-   std::vector<UbTupleFloat3> nodes;
-   std::vector<std::string> datanames;
-   std::vector<std::vector<double> > data;
-   std::string path;
-   std::vector<SPtr<D3Q27Interactor> > interactors;
-   std::vector<double> normals;
-   int gridRank;
-   WbWriter* writer;
-   SPtr<UbScheduler> Resetscheduler;  //additional scheduler to restart averaging after a given interval
-   int minInitLevel; //min init level
-   int maxInitLevel;
-   std::vector<std::vector<SPtr<Block3D> > > blockVector;
-   enum Values{AvVx = 0, AvVy = 1, AvVz = 2, AvSxx = 3, AvSyy = 4, AvSzz = 5, AvSxy = 6, AvSyz = 7, AvSxz = 8, normalX1 = 9, normalX2 = 10, normalX3 = 11, normalq = 12,numberOfPoint=13}; 
-};
-
-
-#endif /* D3Q27ShearStressCoProcessor_H */
+#ifndef D3Q27ShearStressCoProcessor_H
+#define D3Q27ShearStressCoProcessor_H
+
+#include <PointerDefinitions.h>
+#include <vector>
+#include <string>
+
+#include <basics/utilities/UbTuple.h>
+
+#include "CoProcessor.h"
+
+class Block3D;
+class Grid3D;
+class UbScheduler;
+class D3Q27Interactor;
+class BCArray3D;
+class WbWriter;
+
+//! \brief  Computes the shear stress and y plus values and writes to parallel .vtk
+//! \details writes at given time intervals specified in scheduler (s) and resets according to scheduler (rs).  
+//!          Take root to obtain  during post processing (paraview).   
+//! \author  K. Kucher, S. Uphoff, M. Geier, E. Goraki Fard  
+
+class ShearStressCoProcessor: public CoProcessor 
+{
+public:
+   //! Default constructor
+   ShearStressCoProcessor(){}
+   //! Constructor
+   ShearStressCoProcessor(SPtr<Grid3D> grid, const std::string& path, WbWriter* const writer,
+       SPtr<UbScheduler> s, SPtr<UbScheduler> rs);
+   virtual ~ShearStressCoProcessor(); 
+    
+   void process(double step) override; 
+
+   void addInteractor(SPtr<D3Q27Interactor> interactor);
+protected:
+   //! Computes average and shear stress values of macroscopic quantities 
+   void calculateShearStress(double timeStep);
+   //! Prepare data and write in .vtk file
+   void collectData(double step);
+   //! Reset data
+   void resetData(double step);
+   //! prepare data
+   void addData();
+   void clearData();
+   void reset(double step);
+   void findPlane(int ix1,int ix2,int ix3, SPtr<Grid3D> grid, SPtr<Block3D> block,double &A,double &B,double &C,double &D,double &ii);
+   bool checkUndefindedNodes(SPtr<BCArray3D> bcArray,int ix1,int ix2,int ix3);
+   void initDistance();
+
+private:
+   std::vector<UbTupleFloat3> nodes;
+   std::vector<std::string> datanames;
+   std::vector<std::vector<double> > data;
+   std::string path;
+   std::vector<SPtr<D3Q27Interactor> > interactors;
+   std::vector<double> normals;
+   int gridRank;
+   WbWriter* writer;
+   SPtr<UbScheduler> Resetscheduler;  //additional scheduler to restart averaging after a given interval
+   int minInitLevel; //min init level
+   int maxInitLevel;
+   std::vector<std::vector<SPtr<Block3D> > > blockVector;
+   enum Values{AvVx = 0, AvVy = 1, AvVz = 2, AvSxx = 3, AvSyy = 4, AvSzz = 5, AvSxy = 6, AvSyz = 7, AvSxz = 8, normalX1 = 9, normalX2 = 10, normalX3 = 11, normalq = 12,numberOfPoint=13}; 
+};
+
+
+#endif /* D3Q27ShearStressCoProcessor_H */
diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/TimeAveragedValuesCoProcessor.h b/src/cpu/VirtualFluidsCore/CoProcessors/TimeAveragedValuesCoProcessor.h
index 9a9df0f8041647918d9bf51fbf3b1f3543faf66c..9465167dc04e8b466883b9ff42952cefcb614ba9 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/TimeAveragedValuesCoProcessor.h
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/TimeAveragedValuesCoProcessor.h
@@ -1,123 +1,123 @@
-#ifndef TimeAveragedValuesCoProcessor_H
-#define TimeAveragedValuesCoProcessor_H
-
-#include <PointerDefinitions.h>
-#include <string>
-#include <vector>
-
-#include "CoProcessor.h"
-#include "LBMSystem.h"
-#include "IntegrateValuesHelper.h"
-
-class Communicator;
-class Grid3D;
-class UbScheduler;
-class WbWriter;
-class Block3D;
-
-//! \brief  Computes the time averaged mean velocity and RMS values and writes to parallel .vtk
-//! \details writes at given time intervals specified in scheduler (s), does averaging according to scheduler (Avs) and resets according to scheduler (rs).  <br>
-//!  Computes  the time averaged mean velocity  \f$ u_{mean}=\frac{1}{N}\sum\limits_{i=1}^n u_{i} \f$  and RMS of fluctuations. You need to calculate a square root before plotting RMS. <br>
-//           
-//! \author  Konstantin Kutscher 
-// \f$ u_{mean}=\frac{1}{N}\sum\limits_{i=1}^n u_{i} \f$
-
-
-class TimeAveragedValuesCoProcessor : public CoProcessor
-{
-public:
-   enum Options
-   {
-      Density            = 1,
-      Velocity           = 2,
-      Fluctuations       = 4,
-      Triplecorrelations = 8,
-
-      //Velocity           = 1,
-      //Fluctuations       = 2,
-      //Triplecorrelations = 4,
-   };
-public:
-   TimeAveragedValuesCoProcessor();
-   TimeAveragedValuesCoProcessor(SPtr<Grid3D> grid, const std::string& path, WbWriter* const writer,
-       SPtr<UbScheduler> s, SPtr<Communicator> comm, int options);
-   TimeAveragedValuesCoProcessor(SPtr<Grid3D> grid, const std::string& path, WbWriter* const writer,
-       SPtr<UbScheduler> s, SPtr<Communicator> comm, int options, std::vector<int> levels, std::vector<double>& levelCoords, std::vector<double>& bounds, bool timeAveraging = true);
-   //! Make update
-   void process(double step);
-   //! Computes subtotal of velocity , fluctuations and triple correlations
-   void calculateSubtotal(double step);
-   void addLevelCoordinate(double c);
-   void reset();
-   void setWithGhostLayer(bool val);
-   bool getWithGhostLayer();
-
-protected:
-   //! Prepare data and write in .vtk file
-   void collectData(double step);
-   //! prepare data
-   void addData(const SPtr<Block3D> block);
-   void clearData();
-   //! Computes average values of velocity , fluctuations and triple correlations 
-   void calculateAverageValues(double timeStep);
-
-   void init();
-   void initData();
-   void planarAverage(double step);
-   void calculateAverageValuesForPlane(std::vector<IntegrateValuesHelper::CalcNodes>& cnodes);
-
-private:
-    SPtr<Communicator> comm;
-   std::vector<UbTupleFloat3> nodes;
-   std::vector<UbTupleUInt8> cells;
-   std::vector<std::string> datanames;
-   std::vector<std::vector<double> > data;
-   std::vector<std::vector<SPtr<Block3D> > > blockVector;
-   bool root;
-   int minInitLevel; //min init level
-   int maxInitLevel;
-   int gridRank;
-   int resetStepRMS;
-   int resetStepMeans;
-   double averageInterval;
-   std::string path;
-   WbWriter* writer;
-   bool restart, compressible;
-   SPtr<UbScheduler> averageScheduler;  //additional scheduler to averaging after a given interval
-   SPtr<UbScheduler> resetSchedulerRMS;  //additional scheduler to restart averaging after a given interval
-   SPtr<UbScheduler> resetSchedulerMeans;  //additional scheduler to restart averaging after a given interval
-   //labels for the different components, e.g. AvVxx for time averaged RMS: 1/n SUM((U-Umean)^2)
-   //you need to calculate a square root before plotting RMS
-   enum Density { Rho, RhoF };
-   enum Velocity { Vx, Vy, Vz };
-   enum Fluctuations { Vxx, Vyy, Vzz, Vxy, Vxz, Vyz };
-   enum Triplecorrelations { Vxxx, Vxxy, Vxxz, Vyyy, Vyyx, Vyyz, Vzzz, Vzzx, Vzzy, Vxyz };
-
-   double saRho, saRhoF;
-   double saVx, saVy, saVz;
-   double saVxx, saVyy, saVzz, saVxy, saVxz, saVyz;
-   double saVxxx, saVxxy, saVxxz, saVyyy, saVyyx, saVyyz, saVzzz, saVzzx, saVzzy, saVxyz;
-
-   int options;
-   double numberOfSteps;
-   double minStep;
-   double maxStep;
-
-   int iMinX1, iMinX2, iMinX3;
-   //int iMaxX1, iMaxX2, iMaxX3;
-   int iMinC;
-   int iMaxC;
-
-   typedef void(*CalcMacrosFct)(const LBMReal* const& /*feq[27]*/, LBMReal& /*(d)rho*/, LBMReal& /*vx1*/, LBMReal& /*vx2*/, LBMReal& /*vx3*/);
-   CalcMacrosFct calcMacros;
-
-   bool planarAveraging;
-   bool timeAveraging;
-   std::vector<double> levelCoords;
-   std::vector<int> levels;
-   std::vector<double> bounds;
-
-   bool withGhostLayer;
-
-};
-#endif
+#ifndef TimeAveragedValuesCoProcessor_H
+#define TimeAveragedValuesCoProcessor_H
+
+#include <PointerDefinitions.h>
+#include <string>
+#include <vector>
+
+#include "CoProcessor.h"
+#include "LBMSystem.h"
+#include "IntegrateValuesHelper.h"
+
+class Communicator;
+class Grid3D;
+class UbScheduler;
+class WbWriter;
+class Block3D;
+
+//! \brief  Computes the time averaged mean velocity and RMS values and writes to parallel .vtk
+//! \details writes at given time intervals specified in scheduler (s), does averaging according to scheduler (Avs) and resets according to scheduler (rs).  <br>
+//!  Computes  the time averaged mean velocity  \f$ u_{mean}=\frac{1}{N}\sum\limits_{i=1}^n u_{i} \f$  and RMS of fluctuations. You need to calculate a square root before plotting RMS. <br>
+//           
+//! \author  Konstantin Kutscher 
+// \f$ u_{mean}=\frac{1}{N}\sum\limits_{i=1}^n u_{i} \f$
+
+
+class TimeAveragedValuesCoProcessor : public CoProcessor
+{
+public:
+   enum Options
+   {
+      Density            = 1,
+      Velocity           = 2,
+      Fluctuations       = 4,
+      Triplecorrelations = 8,
+
+      //Velocity           = 1,
+      //Fluctuations       = 2,
+      //Triplecorrelations = 4,
+   };
+public:
+   TimeAveragedValuesCoProcessor();
+   TimeAveragedValuesCoProcessor(SPtr<Grid3D> grid, const std::string& path, WbWriter* const writer,
+       SPtr<UbScheduler> s, SPtr<Communicator> comm, int options);
+   TimeAveragedValuesCoProcessor(SPtr<Grid3D> grid, const std::string& path, WbWriter* const writer,
+       SPtr<UbScheduler> s, SPtr<Communicator> comm, int options, std::vector<int> levels, std::vector<double>& levelCoords, std::vector<double>& bounds, bool timeAveraging = true);
+   //! Make update
+   void process(double step);
+   //! Computes subtotal of velocity , fluctuations and triple correlations
+   void calculateSubtotal(double step);
+   void addLevelCoordinate(double c);
+   void reset();
+   void setWithGhostLayer(bool val);
+   bool getWithGhostLayer();
+
+protected:
+   //! Prepare data and write in .vtk file
+   void collectData(double step);
+   //! prepare data
+   void addData(const SPtr<Block3D> block);
+   void clearData();
+   //! Computes average values of velocity , fluctuations and triple correlations 
+   void calculateAverageValues(double timeStep);
+
+   void init();
+   void initData();
+   void planarAverage(double step);
+   void calculateAverageValuesForPlane(std::vector<IntegrateValuesHelper::CalcNodes>& cnodes);
+
+private:
+    SPtr<Communicator> comm;
+   std::vector<UbTupleFloat3> nodes;
+   std::vector<UbTupleUInt8> cells;
+   std::vector<std::string> datanames;
+   std::vector<std::vector<double> > data;
+   std::vector<std::vector<SPtr<Block3D> > > blockVector;
+   bool root;
+   int minInitLevel; //min init level
+   int maxInitLevel;
+   int gridRank;
+   int resetStepRMS;
+   int resetStepMeans;
+   double averageInterval;
+   std::string path;
+   WbWriter* writer;
+   bool restart, compressible;
+   SPtr<UbScheduler> averageScheduler;  //additional scheduler to averaging after a given interval
+   SPtr<UbScheduler> resetSchedulerRMS;  //additional scheduler to restart averaging after a given interval
+   SPtr<UbScheduler> resetSchedulerMeans;  //additional scheduler to restart averaging after a given interval
+   //labels for the different components, e.g. AvVxx for time averaged RMS: 1/n SUM((U-Umean)^2)
+   //you need to calculate a square root before plotting RMS
+   enum Density { Rho, RhoF };
+   enum Velocity { Vx, Vy, Vz };
+   enum Fluctuations { Vxx, Vyy, Vzz, Vxy, Vxz, Vyz };
+   enum Triplecorrelations { Vxxx, Vxxy, Vxxz, Vyyy, Vyyx, Vyyz, Vzzz, Vzzx, Vzzy, Vxyz };
+
+   double saRho, saRhoF;
+   double saVx, saVy, saVz;
+   double saVxx, saVyy, saVzz, saVxy, saVxz, saVyz;
+   double saVxxx, saVxxy, saVxxz, saVyyy, saVyyx, saVyyz, saVzzz, saVzzx, saVzzy, saVxyz;
+
+   int options;
+   double numberOfSteps;
+   double minStep;
+   double maxStep;
+
+   int iMinX1, iMinX2, iMinX3;
+   //int iMaxX1, iMaxX2, iMaxX3;
+   int iMinC;
+   int iMaxC;
+
+   typedef void(*CalcMacrosFct)(const LBMReal* const& /*feq[27]*/, LBMReal& /*(d)rho*/, LBMReal& /*vx1*/, LBMReal& /*vx2*/, LBMReal& /*vx3*/);
+   CalcMacrosFct calcMacros;
+
+   bool planarAveraging;
+   bool timeAveraging;
+   std::vector<double> levelCoords;
+   std::vector<int> levels;
+   std::vector<double> bounds;
+
+   bool withGhostLayer;
+
+};
+#endif
diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/TimeDependentBCCoProcessor.cpp b/src/cpu/VirtualFluidsCore/CoProcessors/TimeDependentBCCoProcessor.cpp
index 9e97fee3835839a8307ed64d2a0bb55d78d3f12e..ea687cfba6770d06f35539bc43407f317d6623e0 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/TimeDependentBCCoProcessor.cpp
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/TimeDependentBCCoProcessor.cpp
@@ -1,34 +1,34 @@
-#include "TimeDependentBCCoProcessor.h"
-
-#include "Interactor3D.h"
-#include "UbScheduler.h"
-#include "Grid3D.h"
-
-TimeDependentBCCoProcessor::TimeDependentBCCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s) : CoProcessor(grid, s)
-{
-
-}
-//////////////////////////////////////////////////////////////////////////
-TimeDependentBCCoProcessor::~TimeDependentBCCoProcessor() 
-{
-	
-}
-//////////////////////////////////////////////////////////////////////////
-void TimeDependentBCCoProcessor::process(double step)
-{
-   if(scheduler->isDue(step) )
-   {
-      for (SPtr<Interactor3D> inter : interactors)
-         inter->updateInteractor(step);
-      UBLOG(logDEBUG3, "TimeDependentBCCoProcessor::update:" << step);
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-void TimeDependentBCCoProcessor::addInteractor( SPtr<Interactor3D> interactor )
-{
-   interactors.push_back(interactor);
-}
-
-//////////////////////////////////////////////////////////////////////////
-
-
+#include "TimeDependentBCCoProcessor.h"
+
+#include "Interactor3D.h"
+#include "UbScheduler.h"
+#include "Grid3D.h"
+
+TimeDependentBCCoProcessor::TimeDependentBCCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s) : CoProcessor(grid, s)
+{
+
+}
+//////////////////////////////////////////////////////////////////////////
+TimeDependentBCCoProcessor::~TimeDependentBCCoProcessor() 
+{
+	
+}
+//////////////////////////////////////////////////////////////////////////
+void TimeDependentBCCoProcessor::process(double step)
+{
+   if(scheduler->isDue(step) )
+   {
+      for (SPtr<Interactor3D> inter : interactors)
+         inter->updateInteractor(step);
+      UBLOG(logDEBUG3, "TimeDependentBCCoProcessor::update:" << step);
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+void TimeDependentBCCoProcessor::addInteractor( SPtr<Interactor3D> interactor )
+{
+   interactors.push_back(interactor);
+}
+
+//////////////////////////////////////////////////////////////////////////
+
+
diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/TimeDependentBCCoProcessor.h b/src/cpu/VirtualFluidsCore/CoProcessors/TimeDependentBCCoProcessor.h
index 3e3795d6a0be7f42a2652b4a9854b06d704b7a16..e3d03e7a6b100b57d10346daa38cc2bb6e0f72b1 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/TimeDependentBCCoProcessor.h
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/TimeDependentBCCoProcessor.h
@@ -1,31 +1,31 @@
-#ifndef TimeDependentBCCoProcessor_H
-#define TimeDependentBCCoProcessor_H
-
-#include <vector>
-#include <PointerDefinitions.h>
-
-#include "CoProcessor.h"
-
-class Interactor3D;
-class Grid3D;
-
-//! \brief The class update interactors depend of time step. 
-//! \details TimeDependentBCCoProcessor update every time step information in BCAdapters throw Interactors
-//! \author Sonja Uphoff, Kostyantyn Kucher
-class TimeDependentBCCoProcessor : public CoProcessor
-{
-public:
-	TimeDependentBCCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s);
-	virtual ~TimeDependentBCCoProcessor();
-
-	void process(double step) override;
-
-   //! add interactors to CoProcessor
-   void addInteractor(SPtr<Interactor3D> interactor);
-
-private:
-   std::vector<SPtr<Interactor3D> > interactors;
-};
-
-
-#endif /* TimeDependentBCCoProcessor_H */
+#ifndef TimeDependentBCCoProcessor_H
+#define TimeDependentBCCoProcessor_H
+
+#include <vector>
+#include <PointerDefinitions.h>
+
+#include "CoProcessor.h"
+
+class Interactor3D;
+class Grid3D;
+
+//! \brief The class update interactors depend of time step. 
+//! \details TimeDependentBCCoProcessor update every time step information in BCAdapters throw Interactors
+//! \author Sonja Uphoff, Kostyantyn Kucher
+class TimeDependentBCCoProcessor : public CoProcessor
+{
+public:
+	TimeDependentBCCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s);
+	virtual ~TimeDependentBCCoProcessor();
+
+	void process(double step) override;
+
+   //! add interactors to CoProcessor
+   void addInteractor(SPtr<Interactor3D> interactor);
+
+private:
+   std::vector<SPtr<Interactor3D> > interactors;
+};
+
+
+#endif /* TimeDependentBCCoProcessor_H */
diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/TimeseriesCoProcessor.cpp b/src/cpu/VirtualFluidsCore/CoProcessors/TimeseriesCoProcessor.cpp
index e0a1ab6a193eee85e6dc6bbef635694880632bda..62ca723e8e4fb83aa5ae1ef1c6c86840492efce4 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/TimeseriesCoProcessor.cpp
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/TimeseriesCoProcessor.cpp
@@ -1,87 +1,87 @@
-/*
-*  TimeseriesWriterCoProcessor.h
-*
-*  Created on: 08.05.2013
-*  Author: uphoff
-*/
-
-#include "TimeseriesCoProcessor.h"
-
-#include <fstream>
-
-#include "IntegrateValuesHelper.h"
-#include "LBMUnitConverter.h"
-#include "Communicator.h"
-#include "UbScheduler.h"
-#include "Grid3D.h"
-
-
-TimeseriesCoProcessor::TimeseriesCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s,
-                                                             SPtr<IntegrateValuesHelper> h1,
-                                                             const std::string& path, SPtr<Communicator> comm)
-                                                             : CoProcessor(grid, s),                                                
-                                                               h1(h1),
-                                                               path(path),
-                                                               comm(comm)
-{
-   if (comm->getProcessID() == comm->getRoot())
-   {
-      std::ofstream ostr;
-      //fname = path+"/timeseries/timeseries"+UbSystem::toString(grid->getTimeStep())+".csv";
-      fname = path+".csv";
-      UBLOG(logINFO, "TimeseriesWriterCoProcessor::fname:" << fname);
-      ostr.open(fname.c_str(), std::ios_base::out | std::ios_base::app);
-      if(!ostr)
-      { 
-         ostr.clear();
-         std::string path = UbSystem::getPathFromString(fname);
-         if (path.size()>0) { UbSystem::makeDirectory(path); ostr.open(fname.c_str(), std::ios_base::out | std::ios_base::app); }
-         if(!ostr) throw UbException(UB_EXARGS,"couldn't open file "+fname);
-      }
-      ostr << "step;rho;vx;vy;vz;volume\n";
-      ostr.close();
-      UBLOG(logINFO, "TimeseriesWriterCoProcessor::Constructor:end");
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-TimeseriesCoProcessor::~TimeseriesCoProcessor() 
-{
-}
-//////////////////////////////////////////////////////////////////////////
-void TimeseriesCoProcessor::process(double step)
-{
-   if(scheduler->isDue(step) )
-      collectData(step);
-}
-//////////////////////////////////////////////////////////////////////////
-void TimeseriesCoProcessor::collectData(double step)
-{
-   h1->calculateMQ();
-
-   UBLOG(logDEBUG3, "TimeseriesWriterCoProcessor::update:" << step);
-
-   if (comm->getProcessID() == comm->getRoot())
-   {
-      int istep = static_cast<int>(step);
-      std::ofstream ostr;
-      double cellsVolume = h1->getCellsVolume();
-
-      double rho=(h1->getRho())/cellsVolume;
-      double vx= (h1->getVx1())/cellsVolume;
-      double vy= (h1->getVx2())/cellsVolume;
-      double vz= (h1->getVx3())/cellsVolume;
-      double volume = cellsVolume;
-
-      ostr.open(fname.c_str(), std::ios_base::out | std::ios_base::app);
-      if(!ostr)
-      { 
-         ostr.clear();
-         std::string path = UbSystem::getPathFromString(fname);
-         if(path.size()>0){ UbSystem::makeDirectory(path); ostr.open(fname.c_str(), std::ios_base::out | std::ios_base::app);}
-         if(!ostr) throw UbException(UB_EXARGS,"couldn't open file "+fname);
-      }
-
-      ostr << istep << ";" << rho <<";" << vx << ";" << vy << ";" << vz << ";" << volume << "\n";
-      ostr.close();
-   }
-}
+/*
+*  TimeseriesWriterCoProcessor.h
+*
+*  Created on: 08.05.2013
+*  Author: uphoff
+*/
+
+#include "TimeseriesCoProcessor.h"
+
+#include <fstream>
+
+#include "IntegrateValuesHelper.h"
+#include "LBMUnitConverter.h"
+#include "Communicator.h"
+#include "UbScheduler.h"
+#include "Grid3D.h"
+
+
+TimeseriesCoProcessor::TimeseriesCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s,
+                                                             SPtr<IntegrateValuesHelper> h1,
+                                                             const std::string& path, SPtr<Communicator> comm)
+                                                             : CoProcessor(grid, s),                                                
+                                                               h1(h1),
+                                                               path(path),
+                                                               comm(comm)
+{
+   if (comm->getProcessID() == comm->getRoot())
+   {
+      std::ofstream ostr;
+      //fname = path+"/timeseries/timeseries"+UbSystem::toString(grid->getTimeStep())+".csv";
+      fname = path+".csv";
+      UBLOG(logINFO, "TimeseriesWriterCoProcessor::fname:" << fname);
+      ostr.open(fname.c_str(), std::ios_base::out | std::ios_base::app);
+      if(!ostr)
+      { 
+         ostr.clear();
+         std::string path = UbSystem::getPathFromString(fname);
+         if (path.size()>0) { UbSystem::makeDirectory(path); ostr.open(fname.c_str(), std::ios_base::out | std::ios_base::app); }
+         if(!ostr) throw UbException(UB_EXARGS,"couldn't open file "+fname);
+      }
+      ostr << "step;rho;vx;vy;vz;volume\n";
+      ostr.close();
+      UBLOG(logINFO, "TimeseriesWriterCoProcessor::Constructor:end");
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+TimeseriesCoProcessor::~TimeseriesCoProcessor() 
+{
+}
+//////////////////////////////////////////////////////////////////////////
+void TimeseriesCoProcessor::process(double step)
+{
+   if(scheduler->isDue(step) )
+      collectData(step);
+}
+//////////////////////////////////////////////////////////////////////////
+void TimeseriesCoProcessor::collectData(double step)
+{
+   h1->calculateMQ();
+
+   UBLOG(logDEBUG3, "TimeseriesWriterCoProcessor::update:" << step);
+
+   if (comm->getProcessID() == comm->getRoot())
+   {
+      int istep = static_cast<int>(step);
+      std::ofstream ostr;
+      double cellsVolume = h1->getCellsVolume();
+
+      double rho=(h1->getRho())/cellsVolume;
+      double vx= (h1->getVx1())/cellsVolume;
+      double vy= (h1->getVx2())/cellsVolume;
+      double vz= (h1->getVx3())/cellsVolume;
+      double volume = cellsVolume;
+
+      ostr.open(fname.c_str(), std::ios_base::out | std::ios_base::app);
+      if(!ostr)
+      { 
+         ostr.clear();
+         std::string path = UbSystem::getPathFromString(fname);
+         if(path.size()>0){ UbSystem::makeDirectory(path); ostr.open(fname.c_str(), std::ios_base::out | std::ios_base::app);}
+         if(!ostr) throw UbException(UB_EXARGS,"couldn't open file "+fname);
+      }
+
+      ostr << istep << ";" << rho <<";" << vx << ";" << vy << ";" << vz << ";" << volume << "\n";
+      ostr.close();
+   }
+}
diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/TimeseriesCoProcessor.h b/src/cpu/VirtualFluidsCore/CoProcessors/TimeseriesCoProcessor.h
index f455065cbe58c713ab2ddd27ed3fffc8b9d590c5..b6ca9e903c74073ad5df463cc9f74ef8b07e8a15 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/TimeseriesCoProcessor.h
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/TimeseriesCoProcessor.h
@@ -1,48 +1,48 @@
-/*
- *  TimeseriesCoProcessor.h
- *
- *  Created on: 08.05.2013
- *  Author: uphoff
- */
-
-#ifndef TimeseriesCoProcessor_H
-#define TimeseriesCoProcessor_H
-
-#include <PointerDefinitions.h>
-#include <string>
-
-#include "CoProcessor.h"
-
-class Communicator;
-class Grid3D;
-class UbScheduler;
-class IntegrateValuesHelper;
-
-//! \brief     Writes timeseries of density and velocity to a file.
-//! \details   Uses Integrate values helper, scheduler must be set in testcase.
-//! \author    Sonja Uphoff
-//! \date      May 2013
-
-class TimeseriesCoProcessor : public CoProcessor
-{
-public:
-    TimeseriesCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, SPtr<IntegrateValuesHelper> h1, const std::string& path, SPtr<Communicator> comm);
-    virtual ~TimeseriesCoProcessor();
-
-    //! calls collectData.
-    void process(double step) override;
-
-protected:
-    void collectData(double step);
-
-    //! object that can compute spacial average values in 3D-subdomain.
-    SPtr<IntegrateValuesHelper> h1;
-    SPtr<Communicator> comm;
-
-private:
-    std::string path; //! output filename, e.g.  pathname + "/steps/timeseries"
-    std::string fname;
-};
-
-
-#endif /* TimeseriesCoProcessor_H */
+/*
+ *  TimeseriesCoProcessor.h
+ *
+ *  Created on: 08.05.2013
+ *  Author: uphoff
+ */
+
+#ifndef TimeseriesCoProcessor_H
+#define TimeseriesCoProcessor_H
+
+#include <PointerDefinitions.h>
+#include <string>
+
+#include "CoProcessor.h"
+
+class Communicator;
+class Grid3D;
+class UbScheduler;
+class IntegrateValuesHelper;
+
+//! \brief     Writes timeseries of density and velocity to a file.
+//! \details   Uses Integrate values helper, scheduler must be set in testcase.
+//! \author    Sonja Uphoff
+//! \date      May 2013
+
+class TimeseriesCoProcessor : public CoProcessor
+{
+public:
+    TimeseriesCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, SPtr<IntegrateValuesHelper> h1, const std::string& path, SPtr<Communicator> comm);
+    virtual ~TimeseriesCoProcessor();
+
+    //! calls collectData.
+    void process(double step) override;
+
+protected:
+    void collectData(double step);
+
+    //! object that can compute spacial average values in 3D-subdomain.
+    SPtr<IntegrateValuesHelper> h1;
+    SPtr<Communicator> comm;
+
+private:
+    std::string path; //! output filename, e.g.  pathname + "/steps/timeseries"
+    std::string fname;
+};
+
+
+#endif /* TimeseriesCoProcessor_H */
diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/TurbulenceIntensityCoProcessor.h b/src/cpu/VirtualFluidsCore/CoProcessors/TurbulenceIntensityCoProcessor.h
index 2fd39b030af0ae36e9e2d935cf1dca1d5ede8480..7ea876d4e1bed3527f99262c087f286d24de909b 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/TurbulenceIntensityCoProcessor.h
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/TurbulenceIntensityCoProcessor.h
@@ -1,43 +1,43 @@
-#ifndef TurbulenceIntensityCoProcessor_H
-#define TurbulenceIntensityCoProcessor_H
-
-#include <PointerDefinitions.h>
-#include <string>
-#include <vector>
-
-#include "CoProcessor.h"
-#include "UbTuple.h"
-
-class Communicator;
-class Grid3D;
-class UbScheduler;
-class WbWriter;
-class Block3D;
-
-class TurbulenceIntensityCoProcessor : public CoProcessor
-{
-public:
-   TurbulenceIntensityCoProcessor(SPtr<Grid3D> grid, const std::string& path, WbWriter* const writer,
-       SPtr<UbScheduler> s, SPtr<Communicator> comm);
-   void process(double step);
-protected:
-   void collectData(double step);
-   void addData(const SPtr<Block3D> block);
-   void clearData();
-   void calculateAverageValues(double timeStep);
-private:
-   void init();
-   std::vector<UbTupleFloat3> nodes;
-   std::vector<UbTupleUInt8> cells;
-   std::vector<std::string> datanames;
-   std::vector<std::vector<double> > data; 
-   std::vector<std::vector<SPtr<Block3D> > > blockVector;
-   int minInitLevel;
-   int maxInitLevel;
-   int gridRank;
-   std::string path;
-   WbWriter* writer;
-   SPtr<Communicator> comm;
-   enum Values{AvVx = 0, AvVy = 1, AvVz = 2, AvVxxyyzz = 3};
-};
-#endif
+#ifndef TurbulenceIntensityCoProcessor_H
+#define TurbulenceIntensityCoProcessor_H
+
+#include <PointerDefinitions.h>
+#include <string>
+#include <vector>
+
+#include "CoProcessor.h"
+#include "UbTuple.h"
+
+class Communicator;
+class Grid3D;
+class UbScheduler;
+class WbWriter;
+class Block3D;
+
+class TurbulenceIntensityCoProcessor : public CoProcessor
+{
+public:
+   TurbulenceIntensityCoProcessor(SPtr<Grid3D> grid, const std::string& path, WbWriter* const writer,
+       SPtr<UbScheduler> s, SPtr<Communicator> comm);
+   void process(double step);
+protected:
+   void collectData(double step);
+   void addData(const SPtr<Block3D> block);
+   void clearData();
+   void calculateAverageValues(double timeStep);
+private:
+   void init();
+   std::vector<UbTupleFloat3> nodes;
+   std::vector<UbTupleUInt8> cells;
+   std::vector<std::string> datanames;
+   std::vector<std::vector<double> > data; 
+   std::vector<std::vector<SPtr<Block3D> > > blockVector;
+   int minInitLevel;
+   int maxInitLevel;
+   int gridRank;
+   std::string path;
+   WbWriter* writer;
+   SPtr<Communicator> comm;
+   enum Values{AvVx = 0, AvVy = 1, AvVz = 2, AvVxxyyzz = 3};
+};
+#endif
diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/WriteBlocksCoProcessor.cpp b/src/cpu/VirtualFluidsCore/CoProcessors/WriteBlocksCoProcessor.cpp
index 57a23c176d32093befeeddbc9b366d61db70cc13..f2843380f8bd0ccb386f9c5cdf745fdd8ab219dc 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/WriteBlocksCoProcessor.cpp
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/WriteBlocksCoProcessor.cpp
@@ -1,186 +1,186 @@
-//=======================================================================================
-// ____          ____    __    ______     __________   __      __       __        __         
-// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
-//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
-//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
-//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
-//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
-//      \    \  |    |   ________________________________________________________________    
-//       \    \ |    |  |  ______________________________________________________________|   
-//        \    \|    |  |  |         __          __     __     __     ______      _______    
-//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
-//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
-//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
-//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
-//
-//  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 WriteBlocksCoProcessor.cpp
-//! \ingroup CoProcessors
-//! \author Konstantin Kutscher
-//=======================================================================================
-
-#include "WriteBlocksCoProcessor.h"
-#include "basics/writer/WbWriterVtkXmlASCII.h"
-
-#include "D3Q27System.h"
-#include "Block3D.h"
-#include "UbScheduler.h"
-#include "Communicator.h"
-#include "Grid3D.h"
-
-WriteBlocksCoProcessor::WriteBlocksCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, 
-                                         const std::string& path, WbWriter* const writer, 
-                                         SPtr<Communicator> comm) :
-                                         CoProcessor(grid, s),
-                                         path(path),
-                                         writer(writer),
-                                         comm(comm)
-{
-
-}
-//////////////////////////////////////////////////////////////////////////
-WriteBlocksCoProcessor::~WriteBlocksCoProcessor() 
-{
-}
-//////////////////////////////////////////////////////////////////////////
-void WriteBlocksCoProcessor::process(double step)
-{
-   if(scheduler->isDue(step) )
-      collectData(step);
-}
-//////////////////////////////////////////////////////////////////////////
-void WriteBlocksCoProcessor::collectData(double step)
-{
-   if (comm->getProcessID() == comm->getRoot())
-   {
-      int istep = int(step);
-      std::vector<std::string> filenames;
-      std::vector< UbTupleFloat3 > nodes;
-      std::vector< UbTupleInt8 > cells;
-      std::vector<std::string> celldatanames;
-
-      celldatanames.push_back("isActive");
-      celldatanames.push_back("rank");
-      celldatanames.push_back("interface");
-      celldatanames.push_back("ID");
-      celldatanames.push_back("part");
-      celldatanames.push_back("level");
-      //celldatanames.push_back("connectorCF");
-      //celldatanames.push_back("connectorFC");
-#if defined VF_FETOL
-      celldatanames.push_back("bundle");
-#endif
-
-      std::vector< std::vector< double > > celldata(celldatanames.size());
-
-      int nr=0;
-      int minInitLevel = this->grid->getCoarsestInitializedLevel();
-      int maxInitLevel = this->grid->getFinestInitializedLevel();
-
-      for(int level = minInitLevel; level<=maxInitLevel;level++)
-      {
-         std::vector<SPtr<Block3D>> blockVector;
-         grid->getBlocks(level, blockVector);
-         for(SPtr<Block3D> block : blockVector)
-         {
-            UbTupleDouble3 org = grid->getBlockWorldCoordinates(block);
-            UbTupleDouble3 blockLength = grid->getBlockLengths(block);
-
-            nodes.push_back(makeUbTuple((float)(val<1>(org)), (float)(val<2>(org)), (float)(val<3>(org))));
-            nodes.push_back(makeUbTuple((float)(val<1>(org)+val<1>(blockLength)), (float)(val<2>(org)), (float)(val<3>(org))));
-            nodes.push_back(makeUbTuple((float)(val<1>(org)+val<1>(blockLength)), (float)(val<2>(org)+val<2>(blockLength)), (float)(val<3>(org))));
-            nodes.push_back(makeUbTuple((float)(val<1>(org)), (float)(val<2>(org)+val<2>(blockLength)), (float)(val<3>(org))));
-            nodes.push_back(makeUbTuple((float)(val<1>(org)), (float)(val<2>(org)), (float)(val<3>(org)+val<3>(blockLength))));
-            nodes.push_back(makeUbTuple((float)(val<1>(org)+val<1>(blockLength)), (float)(val<2>(org)), (float)(val<3>(org)+val<3>(blockLength))));
-            nodes.push_back(makeUbTuple((float)(val<1>(org)+val<1>(blockLength)), (float)(val<2>(org)+val<2>(blockLength)), (float)(val<3>(org)+val<3>(blockLength))));
-            nodes.push_back(makeUbTuple((float)(val<1>(org)), (float)(val<2>(org)+val<2>(blockLength)), (float)(val<3>(org)+val<3>(blockLength))));
-            cells.push_back(makeUbTuple(nr, nr+1, nr+2, nr+3, nr+4, nr+5, nr+6, nr+7));
-            nr += 8;
-
-            //data
-            celldata[0].push_back((double)block->isActive());
-            celldata[1].push_back((double)block->getRank());
-            celldata[2].push_back((double)block->hasInterpolationFlag());
-            celldata[3].push_back((double)block->getGlobalID());
-            celldata[4].push_back((double)block->getPart());
-            celldata[5].push_back((double)block->getLevel());
-
-            //bool flag = false;
-            //std::vector<SPtr<Block3DConnector>> connectors;
-
-            //block->pushBackLocalInterpolationConnectorsCF(connectors);
-            //for (std::size_t i = 0; i<connectors.size(); i++)
-            //   if (connectors[i])
-            //   {
-            //      if (connectors[i]->getSendDir() == D3Q27System::BS)
-            //      {
-
-            //         flag = true;
-            //      }
-            //   }
-
-            //if (flag)
-            //{
-            //   celldata[6].push_back(1);
-            //   UBLOG(logINFO, "CF: "+block->toString());
-            //}
-            //else
-            //{
-            //   celldata[6].push_back(0);
-            //}
-
-            //flag = false;
-            //connectors.resize(0);
-            //block->pushBackLocalInterpolationConnectorsFC(connectors);
-            //for (std::size_t i = 0; i<connectors.size(); i++)
-            //   if (connectors[i])
-            //   {
-            //      if (connectors[i]->getSendDir() == D3Q27System::BS)
-            //      {
-
-            //         flag = true;
-            //      }
-            //   }
-
-            //if (flag)
-            //{
-            //   celldata[7].push_back(1);
-            //   UBLOG(logINFO, "FC: "+block->toString());
-            //}
-            //else
-            //{
-            //   celldata[7].push_back(0);
-            //}
-
-#ifdef VF_FETOL            
-            celldata[6].push_back( (double)block->getBundle());
-#endif
-         }
-      }
-
-      filenames.push_back(writer->writeOctsWithCellData(path+"/blocks/blocks_" + UbSystem::toString(grid->getRank()) + "_" + UbSystem::toString(istep),nodes,cells,celldatanames,celldata));
-
-      if (istep == CoProcessor::scheduler->getMinBegin())
-      {
-         WbWriterVtkXmlASCII::getInstance()->writeCollection(path+"/blocks/blocks_collection",filenames,istep,false);
-      } 
-      else
-      {
-         WbWriterVtkXmlASCII::getInstance()->addFilesToCollection(path + "/blocks/blocks_collection", filenames, istep, false);
-      }
-
-      UBLOG(logINFO,"WriteBlocksCoProcessor step: " << istep);
-   }
-}
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 WriteBlocksCoProcessor.cpp
+//! \ingroup CoProcessors
+//! \author Konstantin Kutscher
+//=======================================================================================
+
+#include "WriteBlocksCoProcessor.h"
+#include "basics/writer/WbWriterVtkXmlASCII.h"
+
+#include "D3Q27System.h"
+#include "Block3D.h"
+#include "UbScheduler.h"
+#include "Communicator.h"
+#include "Grid3D.h"
+
+WriteBlocksCoProcessor::WriteBlocksCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, 
+                                         const std::string& path, WbWriter* const writer, 
+                                         SPtr<Communicator> comm) :
+                                         CoProcessor(grid, s),
+                                         path(path),
+                                         writer(writer),
+                                         comm(comm)
+{
+
+}
+//////////////////////////////////////////////////////////////////////////
+WriteBlocksCoProcessor::~WriteBlocksCoProcessor() 
+{
+}
+//////////////////////////////////////////////////////////////////////////
+void WriteBlocksCoProcessor::process(double step)
+{
+   if(scheduler->isDue(step) )
+      collectData(step);
+}
+//////////////////////////////////////////////////////////////////////////
+void WriteBlocksCoProcessor::collectData(double step)
+{
+   if (comm->getProcessID() == comm->getRoot())
+   {
+      int istep = int(step);
+      std::vector<std::string> filenames;
+      std::vector< UbTupleFloat3 > nodes;
+      std::vector< UbTupleInt8 > cells;
+      std::vector<std::string> celldatanames;
+
+      celldatanames.push_back("isActive");
+      celldatanames.push_back("rank");
+      celldatanames.push_back("interface");
+      celldatanames.push_back("ID");
+      celldatanames.push_back("part");
+      celldatanames.push_back("level");
+      //celldatanames.push_back("connectorCF");
+      //celldatanames.push_back("connectorFC");
+#if defined VF_FETOL
+      celldatanames.push_back("bundle");
+#endif
+
+      std::vector< std::vector< double > > celldata(celldatanames.size());
+
+      int nr=0;
+      int minInitLevel = this->grid->getCoarsestInitializedLevel();
+      int maxInitLevel = this->grid->getFinestInitializedLevel();
+
+      for(int level = minInitLevel; level<=maxInitLevel;level++)
+      {
+         std::vector<SPtr<Block3D>> blockVector;
+         grid->getBlocks(level, blockVector);
+         for(SPtr<Block3D> block : blockVector)
+         {
+            UbTupleDouble3 org = grid->getBlockWorldCoordinates(block);
+            UbTupleDouble3 blockLength = grid->getBlockLengths(block);
+
+            nodes.push_back(makeUbTuple((float)(val<1>(org)), (float)(val<2>(org)), (float)(val<3>(org))));
+            nodes.push_back(makeUbTuple((float)(val<1>(org)+val<1>(blockLength)), (float)(val<2>(org)), (float)(val<3>(org))));
+            nodes.push_back(makeUbTuple((float)(val<1>(org)+val<1>(blockLength)), (float)(val<2>(org)+val<2>(blockLength)), (float)(val<3>(org))));
+            nodes.push_back(makeUbTuple((float)(val<1>(org)), (float)(val<2>(org)+val<2>(blockLength)), (float)(val<3>(org))));
+            nodes.push_back(makeUbTuple((float)(val<1>(org)), (float)(val<2>(org)), (float)(val<3>(org)+val<3>(blockLength))));
+            nodes.push_back(makeUbTuple((float)(val<1>(org)+val<1>(blockLength)), (float)(val<2>(org)), (float)(val<3>(org)+val<3>(blockLength))));
+            nodes.push_back(makeUbTuple((float)(val<1>(org)+val<1>(blockLength)), (float)(val<2>(org)+val<2>(blockLength)), (float)(val<3>(org)+val<3>(blockLength))));
+            nodes.push_back(makeUbTuple((float)(val<1>(org)), (float)(val<2>(org)+val<2>(blockLength)), (float)(val<3>(org)+val<3>(blockLength))));
+            cells.push_back(makeUbTuple(nr, nr+1, nr+2, nr+3, nr+4, nr+5, nr+6, nr+7));
+            nr += 8;
+
+            //data
+            celldata[0].push_back((double)block->isActive());
+            celldata[1].push_back((double)block->getRank());
+            celldata[2].push_back((double)block->hasInterpolationFlag());
+            celldata[3].push_back((double)block->getGlobalID());
+            celldata[4].push_back((double)block->getPart());
+            celldata[5].push_back((double)block->getLevel());
+
+            //bool flag = false;
+            //std::vector<SPtr<Block3DConnector>> connectors;
+
+            //block->pushBackLocalInterpolationConnectorsCF(connectors);
+            //for (std::size_t i = 0; i<connectors.size(); i++)
+            //   if (connectors[i])
+            //   {
+            //      if (connectors[i]->getSendDir() == D3Q27System::BS)
+            //      {
+
+            //         flag = true;
+            //      }
+            //   }
+
+            //if (flag)
+            //{
+            //   celldata[6].push_back(1);
+            //   UBLOG(logINFO, "CF: "+block->toString());
+            //}
+            //else
+            //{
+            //   celldata[6].push_back(0);
+            //}
+
+            //flag = false;
+            //connectors.resize(0);
+            //block->pushBackLocalInterpolationConnectorsFC(connectors);
+            //for (std::size_t i = 0; i<connectors.size(); i++)
+            //   if (connectors[i])
+            //   {
+            //      if (connectors[i]->getSendDir() == D3Q27System::BS)
+            //      {
+
+            //         flag = true;
+            //      }
+            //   }
+
+            //if (flag)
+            //{
+            //   celldata[7].push_back(1);
+            //   UBLOG(logINFO, "FC: "+block->toString());
+            //}
+            //else
+            //{
+            //   celldata[7].push_back(0);
+            //}
+
+#ifdef VF_FETOL            
+            celldata[6].push_back( (double)block->getBundle());
+#endif
+         }
+      }
+
+      filenames.push_back(writer->writeOctsWithCellData(path+"/blocks/blocks_" + UbSystem::toString(grid->getRank()) + "_" + UbSystem::toString(istep),nodes,cells,celldatanames,celldata));
+
+      if (istep == CoProcessor::scheduler->getMinBegin())
+      {
+         WbWriterVtkXmlASCII::getInstance()->writeCollection(path+"/blocks/blocks_collection",filenames,istep,false);
+      } 
+      else
+      {
+         WbWriterVtkXmlASCII::getInstance()->addFilesToCollection(path + "/blocks/blocks_collection", filenames, istep, false);
+      }
+
+      UBLOG(logINFO,"WriteBlocksCoProcessor step: " << istep);
+   }
+}
diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/WriteBlocksCoProcessor.h b/src/cpu/VirtualFluidsCore/CoProcessors/WriteBlocksCoProcessor.h
index 352029cd10ffd390f8f5c55f34f7dbaac9d01aa7..8127c9a4653d00e81802bcaa8bb34f9d6fc09563 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/WriteBlocksCoProcessor.h
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/WriteBlocksCoProcessor.h
@@ -1,75 +1,75 @@
-//=======================================================================================
-// ____          ____    __    ______     __________   __      __       __        __         
-// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
-//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
-//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
-//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
-//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
-//      \    \  |    |   ________________________________________________________________    
-//       \    \ |    |  |  ______________________________________________________________|   
-//        \    \|    |  |  |         __          __     __     __     ______      _______    
-//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
-//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
-//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
-//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
-//
-//  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 WriteBlocksCoProcessor.h
-//! \ingroup CoProcessors
-//! \author Konstantin Kutscher
-//=======================================================================================
-
-#ifndef WriteBlocksCoProcessor_H_
-#define WriteBlocksCoProcessor_H_
-
-#include <PointerDefinitions.h>
-#include <string>
-
-#include "CoProcessor.h"
-
-class Communicator;
-class Grid3D;
-class UbScheduler;
-class WbWriter;
-
-//! \class WriteBlocksCoProcessor
-//! \brief A class writes a block grid to a VTK-file
-class WriteBlocksCoProcessor: public CoProcessor 
-{
-public:
-   //! \brief Construct WriteBlocksCoProcessor object.
-   //! \pre The Grid3D and UbScheduler objects must exist.
-   //! \param grid is observable Grid3D object
-   //! \param s is UbScheduler object for scheduling of observer
-   //! \param path is path of folder for output
-   //! \param writer is WbWriter object
-   //! \param comm is Communicator object
-   WriteBlocksCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string& path, WbWriter* const writer, SPtr<Communicator> comm);
-   virtual ~WriteBlocksCoProcessor();
-
-   void process(double step) override;
-
-protected:
-   //! Collect data for VTK-file
-   //! \param step is a time step
-   void collectData(double step);
-
-   std::string path;
-   WbWriter* writer;
-   SPtr<Communicator>  comm;
-};
-
-
-#endif 
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 WriteBlocksCoProcessor.h
+//! \ingroup CoProcessors
+//! \author Konstantin Kutscher
+//=======================================================================================
+
+#ifndef WriteBlocksCoProcessor_H_
+#define WriteBlocksCoProcessor_H_
+
+#include <PointerDefinitions.h>
+#include <string>
+
+#include "CoProcessor.h"
+
+class Communicator;
+class Grid3D;
+class UbScheduler;
+class WbWriter;
+
+//! \class WriteBlocksCoProcessor
+//! \brief A class writes a block grid to a VTK-file
+class WriteBlocksCoProcessor: public CoProcessor 
+{
+public:
+   //! \brief Construct WriteBlocksCoProcessor object.
+   //! \pre The Grid3D and UbScheduler objects must exist.
+   //! \param grid is observable Grid3D object
+   //! \param s is UbScheduler object for scheduling of observer
+   //! \param path is path of folder for output
+   //! \param writer is WbWriter object
+   //! \param comm is Communicator object
+   WriteBlocksCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string& path, WbWriter* const writer, SPtr<Communicator> comm);
+   virtual ~WriteBlocksCoProcessor();
+
+   void process(double step) override;
+
+protected:
+   //! Collect data for VTK-file
+   //! \param step is a time step
+   void collectData(double step);
+
+   std::string path;
+   WbWriter* writer;
+   SPtr<Communicator>  comm;
+};
+
+
+#endif 
diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/WriteBoundaryConditionsCoProcessor.h b/src/cpu/VirtualFluidsCore/CoProcessors/WriteBoundaryConditionsCoProcessor.h
index ff73768abf9e70b150689c1a05dedc8b9481439a..5786f038989f455236ff79b075219bea66fcd1e2 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/WriteBoundaryConditionsCoProcessor.h
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/WriteBoundaryConditionsCoProcessor.h
@@ -1,89 +1,89 @@
-//=======================================================================================
-// ____          ____    __    ______     __________   __      __       __        __         
-// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
-//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
-//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
-//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
-//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
-//      \    \  |    |   ________________________________________________________________    
-//       \    \ |    |  |  ______________________________________________________________|   
-//        \    \|    |  |  |         __          __     __     __     ______      _______    
-//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
-//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
-//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
-//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
-//
-//  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 WriteBoundaryConditionsCoProcessor.h
-//! \ingroup CoProcessors
-//! \author Konstantin Kutscher
-//=======================================================================================
-
-#ifndef WriteBoundaryConditionsCoProcessor_H
-#define WriteBoundaryConditionsCoProcessor_H
-
-#include <PointerDefinitions.h>
-#include <string>
-#include <vector>
-
-#include "CoProcessor.h"
-#include "UbTuple.h"
-
-class Communicator;
-class Grid3D;
-class UbScheduler;
-class WbWriter;
-class Block3D;
-class LBMUnitConverter;
-
-//! \brief A class writes boundary conditions information to a VTK-file
-class WriteBoundaryConditionsCoProcessor : public  CoProcessor
-{
-public:
-   WriteBoundaryConditionsCoProcessor();
-   //! \brief Construct WriteBoundaryConditionsCoProcessor object
-   //! \pre The Grid3D and UbScheduler objects must exist
-   //! \param grid is observable Grid3D object
-   //! \param s is UbScheduler object for scheduling of observer
-   //! \param path is path of folder for output
-   //! \param writer is WbWriter object
-   //! \param comm is Communicator object
-   WriteBoundaryConditionsCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string& path, WbWriter* const writer, SPtr<Communicator> comm);
-   ~WriteBoundaryConditionsCoProcessor() {}
-
-   void process(double step) override;
-
-protected:
-   //! Collect data for VTK-file
-   //! \param step is a time step
-   void collectData(double step);
-   void addDataGeo(SPtr<Block3D> block);
-   void clearData();
-
-private:
-   std::vector<UbTupleFloat3> nodes;
-   std::vector<UbTupleUInt8> cells;
-   std::vector<std::string> datanames;
-   std::vector<std::vector<double> > data;
-   std::string path;
-   WbWriter* writer;
-   bool bcInformation;
-   std::vector<std::vector<SPtr<Block3D> > > blockVector;
-   int minInitLevel;
-   int maxInitLevel;
-   int gridRank;
-   SPtr<Communicator> comm;
-};
-#endif
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 WriteBoundaryConditionsCoProcessor.h
+//! \ingroup CoProcessors
+//! \author Konstantin Kutscher
+//=======================================================================================
+
+#ifndef WriteBoundaryConditionsCoProcessor_H
+#define WriteBoundaryConditionsCoProcessor_H
+
+#include <PointerDefinitions.h>
+#include <string>
+#include <vector>
+
+#include "CoProcessor.h"
+#include "UbTuple.h"
+
+class Communicator;
+class Grid3D;
+class UbScheduler;
+class WbWriter;
+class Block3D;
+class LBMUnitConverter;
+
+//! \brief A class writes boundary conditions information to a VTK-file
+class WriteBoundaryConditionsCoProcessor : public  CoProcessor
+{
+public:
+   WriteBoundaryConditionsCoProcessor();
+   //! \brief Construct WriteBoundaryConditionsCoProcessor object
+   //! \pre The Grid3D and UbScheduler objects must exist
+   //! \param grid is observable Grid3D object
+   //! \param s is UbScheduler object for scheduling of observer
+   //! \param path is path of folder for output
+   //! \param writer is WbWriter object
+   //! \param comm is Communicator object
+   WriteBoundaryConditionsCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string& path, WbWriter* const writer, SPtr<Communicator> comm);
+   ~WriteBoundaryConditionsCoProcessor() {}
+
+   void process(double step) override;
+
+protected:
+   //! Collect data for VTK-file
+   //! \param step is a time step
+   void collectData(double step);
+   void addDataGeo(SPtr<Block3D> block);
+   void clearData();
+
+private:
+   std::vector<UbTupleFloat3> nodes;
+   std::vector<UbTupleUInt8> cells;
+   std::vector<std::string> datanames;
+   std::vector<std::vector<double> > data;
+   std::string path;
+   WbWriter* writer;
+   bool bcInformation;
+   std::vector<std::vector<SPtr<Block3D> > > blockVector;
+   int minInitLevel;
+   int maxInitLevel;
+   int gridRank;
+   SPtr<Communicator> comm;
+};
+#endif
diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/WriteMacroscopicQuantitiesCoProcessor.h b/src/cpu/VirtualFluidsCore/CoProcessors/WriteMacroscopicQuantitiesCoProcessor.h
index d650bc881e0053f139b802c3819335815abde38f..67a1c61f3be38a91d2feb01657492508d523aa83 100644
--- a/src/cpu/VirtualFluidsCore/CoProcessors/WriteMacroscopicQuantitiesCoProcessor.h
+++ b/src/cpu/VirtualFluidsCore/CoProcessors/WriteMacroscopicQuantitiesCoProcessor.h
@@ -1,102 +1,102 @@
-//=======================================================================================
-// ____          ____    __    ______     __________   __      __       __        __         
-// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
-//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
-//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
-//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
-//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
-//      \    \  |    |   ________________________________________________________________    
-//       \    \ |    |  |  ______________________________________________________________|   
-//        \    \|    |  |  |         __          __     __     __     ______      _______    
-//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
-//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
-//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
-//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
-//
-//  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 WriteMacroscopicQuantitiesCoProcessor.h
-//! \ingroup CoProcessors
-//! \author Konstantin Kutscher
-//=======================================================================================
-
-#ifndef WriteMacroscopicQuantitiesCoProcessor_H
-#define WriteMacroscopicQuantitiesCoProcessor_H
-
-#include <PointerDefinitions.h>
-#include <string>
-#include <vector>
-
-#include "CoProcessor.h"
-#include "UbTuple.h"
-#include "LBMSystem.h"
-
-class Communicator;
-class Grid3D;
-class UbScheduler;
-class LBMUnitConverter;
-class WbWriter;
-class Block3D;
-
-
-//! \brief A class writes macroscopic quantities information to a VTK-file
-class WriteMacroscopicQuantitiesCoProcessor : public CoProcessor 
-{
-public:
-   WriteMacroscopicQuantitiesCoProcessor();
-   //! \brief Construct WriteMacroscopicQuantitiesCoProcessor object
-   //! \pre The Grid3D and UbScheduler objects must exist
-   //! \param grid is observable Grid3D object
-   //! \param s is UbScheduler object for scheduling of observer
-   //! \param path is path of folder for output
-   //! \param writer is WbWriter object
-   //! \param conv is LBMUnitConverter object
-   //! \param comm is Communicator object
-   WriteMacroscopicQuantitiesCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s,
-                                           const std::string& path, WbWriter* const writer, 
-                                           SPtr<LBMUnitConverter> conv, SPtr<Communicator> comm);
-   ~WriteMacroscopicQuantitiesCoProcessor(){}
-
-   void process(double step) override;
-
-protected:
-   //! Collect data for VTK-file
-   //! \param step is a time step
-   void collectData(double step);
-   //! Collect data for VTK-file
-   //! \param block is a time step
-   void addDataMQ(SPtr<Block3D> block);
-   void clearData();
-
-private:
-   void init();
-   std::vector<UbTupleFloat3> nodes;
-   std::vector<UbTupleUInt8> cells;
-   std::vector<std::string> datanames;
-   std::vector<std::vector<double> > data; 
-   std::string path;
-   WbWriter* writer;
-   SPtr<LBMUnitConverter> conv;
-   bool bcInformation;
-   std::vector<std::vector<SPtr<Block3D> > > blockVector;
-   int minInitLevel;
-   int maxInitLevel;
-   int gridRank;
-   SPtr<Communicator> comm;
-
-   typedef void(*CalcMacrosFct)(const LBMReal* const& /*feq[27]*/, LBMReal& /*(d)rho*/, LBMReal& /*vx1*/, LBMReal& /*vx2*/, LBMReal& /*vx3*/);
-   CalcMacrosFct calcMacros;
-};
-
-#endif
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 WriteMacroscopicQuantitiesCoProcessor.h
+//! \ingroup CoProcessors
+//! \author Konstantin Kutscher
+//=======================================================================================
+
+#ifndef WriteMacroscopicQuantitiesCoProcessor_H
+#define WriteMacroscopicQuantitiesCoProcessor_H
+
+#include <PointerDefinitions.h>
+#include <string>
+#include <vector>
+
+#include "CoProcessor.h"
+#include "UbTuple.h"
+#include "LBMSystem.h"
+
+class Communicator;
+class Grid3D;
+class UbScheduler;
+class LBMUnitConverter;
+class WbWriter;
+class Block3D;
+
+
+//! \brief A class writes macroscopic quantities information to a VTK-file
+class WriteMacroscopicQuantitiesCoProcessor : public CoProcessor 
+{
+public:
+   WriteMacroscopicQuantitiesCoProcessor();
+   //! \brief Construct WriteMacroscopicQuantitiesCoProcessor object
+   //! \pre The Grid3D and UbScheduler objects must exist
+   //! \param grid is observable Grid3D object
+   //! \param s is UbScheduler object for scheduling of observer
+   //! \param path is path of folder for output
+   //! \param writer is WbWriter object
+   //! \param conv is LBMUnitConverter object
+   //! \param comm is Communicator object
+   WriteMacroscopicQuantitiesCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s,
+                                           const std::string& path, WbWriter* const writer, 
+                                           SPtr<LBMUnitConverter> conv, SPtr<Communicator> comm);
+   ~WriteMacroscopicQuantitiesCoProcessor(){}
+
+   void process(double step) override;
+
+protected:
+   //! Collect data for VTK-file
+   //! \param step is a time step
+   void collectData(double step);
+   //! Collect data for VTK-file
+   //! \param block is a time step
+   void addDataMQ(SPtr<Block3D> block);
+   void clearData();
+
+private:
+   void init();
+   std::vector<UbTupleFloat3> nodes;
+   std::vector<UbTupleUInt8> cells;
+   std::vector<std::string> datanames;
+   std::vector<std::vector<double> > data; 
+   std::string path;
+   WbWriter* writer;
+   SPtr<LBMUnitConverter> conv;
+   bool bcInformation;
+   std::vector<std::vector<SPtr<Block3D> > > blockVector;
+   int minInitLevel;
+   int maxInitLevel;
+   int gridRank;
+   SPtr<Communicator> comm;
+
+   typedef void(*CalcMacrosFct)(const LBMReal* const& /*feq[27]*/, LBMReal& /*(d)rho*/, LBMReal& /*vx1*/, LBMReal& /*vx2*/, LBMReal& /*vx3*/);
+   CalcMacrosFct calcMacros;
+};
+
+#endif
diff --git a/src/cpu/VirtualFluidsCore/Connectors/Block3DConnector.h b/src/cpu/VirtualFluidsCore/Connectors/Block3DConnector.h
index 1e95c026ffcd72196d15d5c6af794c9c71bd8787..527c42d3e3f43d9e3d9b3cdef8bf666b0c3d5450 100644
--- a/src/cpu/VirtualFluidsCore/Connectors/Block3DConnector.h
+++ b/src/cpu/VirtualFluidsCore/Connectors/Block3DConnector.h
@@ -1,100 +1,100 @@
-//=======================================================================================
-// ____          ____    __    ______     __________   __      __       __        __         
-// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
-//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
-//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
-//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
-//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
-//      \    \  |    |   ________________________________________________________________    
-//       \    \ |    |  |  ______________________________________________________________|   
-//        \    \|    |  |  |         __          __     __     __     ______      _______    
-//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
-//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
-//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
-//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
-//
-//  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 Block3DConnector.h
-//! \ingroup Connectors
-//! \author Konstantin Kutscher
-//=======================================================================================
-
-#ifndef BLOCK2DCONNECTOR_H
-#define BLOCK2DCONNECTOR_H
-
-#include <vector>
-#include <string>
-
-#include <basics/utilities/UbTuple.h>
-
-#include <PointerDefinitions.h>
-
-//! \brief   Abstract class of connectors  
-//! \details Connector send and receive full distributions between two blocks in shared memory.
-class Block3DConnector
-{
-public:
-   Block3DConnector() : sendDir(-1) {}
-   Block3DConnector(const int& sendDir) : sendDir(sendDir) {}
-   virtual ~Block3DConnector() {}
-   //!Iniitializes connector
-   virtual void init()=0;
-   //!Synchronizes the send-buffer length
-   virtual void sendTransmitterDataSize()=0;  
-   //!Synchronizes the receive-buffer length
-   virtual void receiveTransmitterDataSize()=0;
-
-   //Send (should be called in given order!!!)
-   virtual void prepareForSend()=0;
-   virtual void fillSendVectors()=0;
-   virtual void sendVectors()=0;
-   
-   //Receive (should be called in given order!!!)
-   virtual void prepareForReceive()=0;
-   virtual void receiveVectors()=0;
-   virtual void distributeReceiveVectors()=0;
-
-   //info section
-   virtual bool isLocalConnector()  = 0;
-   virtual bool isRemoteConnector() = 0;
-   virtual bool isInterpolationConnectorCF() = 0;
-   virtual bool isInterpolationConnectorFC() = 0;
-
-   //grid refinement
-   virtual int getSendDir() const { return sendDir; } 
-
-   //virtual double getSendRecieveTime() = 0;
-   
-   virtual void prepareForSendX1() = 0;
-   virtual void prepareForSendX2() = 0;
-   virtual void prepareForSendX3() = 0;
-
-   virtual void sendVectorsX1() = 0;
-   virtual void sendVectorsX2() = 0;
-   virtual void sendVectorsX3() = 0;
-
-   virtual void prepareForReceiveX1() = 0;
-   virtual void prepareForReceiveX2() = 0;
-   virtual void prepareForReceiveX3() = 0;
-
-   virtual void receiveVectorsX1() = 0;
-   virtual void receiveVectorsX2() = 0;
-   virtual void receiveVectorsX3() = 0;
-
-protected:
-   int  sendDir;
-};
-
-#endif //BLOCK3DCONNECTOR_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 Block3DConnector.h
+//! \ingroup Connectors
+//! \author Konstantin Kutscher
+//=======================================================================================
+
+#ifndef BLOCK2DCONNECTOR_H
+#define BLOCK2DCONNECTOR_H
+
+#include <vector>
+#include <string>
+
+#include <basics/utilities/UbTuple.h>
+
+#include <PointerDefinitions.h>
+
+//! \brief   Abstract class of connectors  
+//! \details Connector send and receive full distributions between two blocks in shared memory.
+class Block3DConnector
+{
+public:
+   Block3DConnector() : sendDir(-1) {}
+   Block3DConnector(const int& sendDir) : sendDir(sendDir) {}
+   virtual ~Block3DConnector() {}
+   //!Iniitializes connector
+   virtual void init()=0;
+   //!Synchronizes the send-buffer length
+   virtual void sendTransmitterDataSize()=0;  
+   //!Synchronizes the receive-buffer length
+   virtual void receiveTransmitterDataSize()=0;
+
+   //Send (should be called in given order!!!)
+   virtual void prepareForSend()=0;
+   virtual void fillSendVectors()=0;
+   virtual void sendVectors()=0;
+   
+   //Receive (should be called in given order!!!)
+   virtual void prepareForReceive()=0;
+   virtual void receiveVectors()=0;
+   virtual void distributeReceiveVectors()=0;
+
+   //info section
+   virtual bool isLocalConnector()  = 0;
+   virtual bool isRemoteConnector() = 0;
+   virtual bool isInterpolationConnectorCF() = 0;
+   virtual bool isInterpolationConnectorFC() = 0;
+
+   //grid refinement
+   virtual int getSendDir() const { return sendDir; } 
+
+   //virtual double getSendRecieveTime() = 0;
+   
+   virtual void prepareForSendX1() = 0;
+   virtual void prepareForSendX2() = 0;
+   virtual void prepareForSendX3() = 0;
+
+   virtual void sendVectorsX1() = 0;
+   virtual void sendVectorsX2() = 0;
+   virtual void sendVectorsX3() = 0;
+
+   virtual void prepareForReceiveX1() = 0;
+   virtual void prepareForReceiveX2() = 0;
+   virtual void prepareForReceiveX3() = 0;
+
+   virtual void receiveVectorsX1() = 0;
+   virtual void receiveVectorsX2() = 0;
+   virtual void receiveVectorsX3() = 0;
+
+protected:
+   int  sendDir;
+};
+
+#endif //BLOCK3DCONNECTOR_H
diff --git a/src/cpu/VirtualFluidsCore/Connectors/Block3DConnectorFactory.cpp b/src/cpu/VirtualFluidsCore/Connectors/Block3DConnectorFactory.cpp
index 37ac8351456fc97003868ddf0d8531e2a97d7bce..b8889d537afdf2152c2dea7c3bfc9668a004fd9d 100644
--- a/src/cpu/VirtualFluidsCore/Connectors/Block3DConnectorFactory.cpp
+++ b/src/cpu/VirtualFluidsCore/Connectors/Block3DConnectorFactory.cpp
@@ -1,50 +1,50 @@
-#include "Block3DConnectorFactory.h"
-#include "D3Q27ETFullDirectConnector.h"
-#include "D3Q27ETFullVectorConnector.h"
-#include "CoarseToFineNodeSetBlock3DConnector.h"
-#include "FineToCoarseNodeSetBlock3DConnector.h"
-
-Block3DConnectorFactory::Block3DConnectorFactory()
-{
-}
-//////////////////////////////////////////////////////////////////////////
-Block3DConnectorFactory::~Block3DConnectorFactory()
-{
-}
-//////////////////////////////////////////////////////////////////////////
-SPtr<Block3DConnector> Block3DConnectorFactory::createSameLevelDirectConnector(SPtr<Block3D> from, SPtr<Block3D> to, int sendDir)
-{
-   return SPtr<Block3DConnector>(new D3Q27ETFullDirectConnector(from, to, sendDir)); 
-}
-//////////////////////////////////////////////////////////////////////////
-SPtr<Block3DConnector> Block3DConnectorFactory::createSameLevelVectorConnector(SPtr<Block3D> block,
-   VectorTransmitterPtr sender,
-   VectorTransmitterPtr receiver,
-   int sendDir)
-{
-   return SPtr<Block3DConnector>(new D3Q27ETFullVectorConnector(block, sender, receiver, sendDir));
-}
-//////////////////////////////////////////////////////////////////////////
-SPtr<Block3DConnector> Block3DConnectorFactory::createCoarseToFineConnector(SPtr<Block3D> block,
-   VectorTransmitterPtr sender00, VectorTransmitterPtr receiver00,
-   VectorTransmitterPtr sender01, VectorTransmitterPtr receiver01,
-   VectorTransmitterPtr sender10, VectorTransmitterPtr receiver10,
-   VectorTransmitterPtr sender11, VectorTransmitterPtr receiver11,
-   int sendDir, InterpolationProcessorPtr iprocessor)
-{
-   return SPtr<Block3DConnector> (new CoarseToFineNodeSetBlock3DConnector(block,
-      sender00, receiver00, sender01, receiver01,
-      sender10, receiver10, sender11, receiver11,
-      sendDir, iprocessor));
-}
-//////////////////////////////////////////////////////////////////////////
-SPtr<Block3DConnector> Block3DConnectorFactory::createFineToCoarseConnector(SPtr<Block3D> block,
-   VectorTransmitterPtr sender,
-   VectorTransmitterPtr receiver,
-   int sendDir,
-   InterpolationProcessorPtr iprocessor,
-   FineToCoarseBlock3DConnector::CFconnectorType connType)
-{
-   return  SPtr<Block3DConnector>(new FineToCoarseNodeSetBlock3DConnector(block,
-      sender, receiver, sendDir, iprocessor, connType));
-}
+#include "Block3DConnectorFactory.h"
+#include "D3Q27ETFullDirectConnector.h"
+#include "D3Q27ETFullVectorConnector.h"
+#include "CoarseToFineNodeSetBlock3DConnector.h"
+#include "FineToCoarseNodeSetBlock3DConnector.h"
+
+Block3DConnectorFactory::Block3DConnectorFactory()
+{
+}
+//////////////////////////////////////////////////////////////////////////
+Block3DConnectorFactory::~Block3DConnectorFactory()
+{
+}
+//////////////////////////////////////////////////////////////////////////
+SPtr<Block3DConnector> Block3DConnectorFactory::createSameLevelDirectConnector(SPtr<Block3D> from, SPtr<Block3D> to, int sendDir)
+{
+   return SPtr<Block3DConnector>(new D3Q27ETFullDirectConnector(from, to, sendDir)); 
+}
+//////////////////////////////////////////////////////////////////////////
+SPtr<Block3DConnector> Block3DConnectorFactory::createSameLevelVectorConnector(SPtr<Block3D> block,
+   VectorTransmitterPtr sender,
+   VectorTransmitterPtr receiver,
+   int sendDir)
+{
+   return SPtr<Block3DConnector>(new D3Q27ETFullVectorConnector(block, sender, receiver, sendDir));
+}
+//////////////////////////////////////////////////////////////////////////
+SPtr<Block3DConnector> Block3DConnectorFactory::createCoarseToFineConnector(SPtr<Block3D> block,
+   VectorTransmitterPtr sender00, VectorTransmitterPtr receiver00,
+   VectorTransmitterPtr sender01, VectorTransmitterPtr receiver01,
+   VectorTransmitterPtr sender10, VectorTransmitterPtr receiver10,
+   VectorTransmitterPtr sender11, VectorTransmitterPtr receiver11,
+   int sendDir, InterpolationProcessorPtr iprocessor)
+{
+   return SPtr<Block3DConnector> (new CoarseToFineNodeSetBlock3DConnector(block,
+      sender00, receiver00, sender01, receiver01,
+      sender10, receiver10, sender11, receiver11,
+      sendDir, iprocessor));
+}
+//////////////////////////////////////////////////////////////////////////
+SPtr<Block3DConnector> Block3DConnectorFactory::createFineToCoarseConnector(SPtr<Block3D> block,
+   VectorTransmitterPtr sender,
+   VectorTransmitterPtr receiver,
+   int sendDir,
+   InterpolationProcessorPtr iprocessor,
+   FineToCoarseBlock3DConnector::CFconnectorType connType)
+{
+   return  SPtr<Block3DConnector>(new FineToCoarseNodeSetBlock3DConnector(block,
+      sender, receiver, sendDir, iprocessor, connType));
+}
diff --git a/src/cpu/VirtualFluidsCore/Connectors/Block3DConnectorFactory.h b/src/cpu/VirtualFluidsCore/Connectors/Block3DConnectorFactory.h
index b90f9775f50dd21011aad999cbed4cde002863ed..e753f32cacefe9e6c037ac1b2a9bf8551e5ed1cc 100644
--- a/src/cpu/VirtualFluidsCore/Connectors/Block3DConnectorFactory.h
+++ b/src/cpu/VirtualFluidsCore/Connectors/Block3DConnectorFactory.h
@@ -1,39 +1,39 @@
-#ifndef Block3DConnectorFactory_h__
-#define Block3DConnectorFactory_h__
-
-#include "ConnectorFactory.h"
-
-#include <PointerDefinitions.h>
-
-class Block3DConnectorFactory : public ConnectorFactory
-{
-public:
-   Block3DConnectorFactory();
-   virtual ~Block3DConnectorFactory();
-
-   virtual SPtr<Block3DConnector> createSameLevelDirectConnector(SPtr<Block3D> from, SPtr<Block3D> to, int sendDir);
-
-   virtual SPtr<Block3DConnector> createSameLevelVectorConnector(SPtr<Block3D> block,
-      VectorTransmitterPtr sender,
-      VectorTransmitterPtr receiver,
-      int sendDir);
-
-   virtual SPtr<Block3DConnector> createCoarseToFineConnector(SPtr<Block3D> block,
-      VectorTransmitterPtr sender00, VectorTransmitterPtr receiver00,
-      VectorTransmitterPtr sender01, VectorTransmitterPtr receiver01,
-      VectorTransmitterPtr sender10, VectorTransmitterPtr receiver10,
-      VectorTransmitterPtr sender11, VectorTransmitterPtr receiver11,
-      int sendDir, InterpolationProcessorPtr iprocessor);
-
-   virtual SPtr<Block3DConnector> createFineToCoarseConnector(SPtr<Block3D> block,
-      VectorTransmitterPtr sender,
-      VectorTransmitterPtr receiver,
-      int sendDir,
-      InterpolationProcessorPtr iprocessor,
-      FineToCoarseBlock3DConnector::CFconnectorType connType);
-
-private:
-
-};
-#endif // Block3DConnectorFactory_h__
-
+#ifndef Block3DConnectorFactory_h__
+#define Block3DConnectorFactory_h__
+
+#include "ConnectorFactory.h"
+
+#include <PointerDefinitions.h>
+
+class Block3DConnectorFactory : public ConnectorFactory
+{
+public:
+   Block3DConnectorFactory();
+   virtual ~Block3DConnectorFactory();
+
+   virtual SPtr<Block3DConnector> createSameLevelDirectConnector(SPtr<Block3D> from, SPtr<Block3D> to, int sendDir);
+
+   virtual SPtr<Block3DConnector> createSameLevelVectorConnector(SPtr<Block3D> block,
+      VectorTransmitterPtr sender,
+      VectorTransmitterPtr receiver,
+      int sendDir);
+
+   virtual SPtr<Block3DConnector> createCoarseToFineConnector(SPtr<Block3D> block,
+      VectorTransmitterPtr sender00, VectorTransmitterPtr receiver00,
+      VectorTransmitterPtr sender01, VectorTransmitterPtr receiver01,
+      VectorTransmitterPtr sender10, VectorTransmitterPtr receiver10,
+      VectorTransmitterPtr sender11, VectorTransmitterPtr receiver11,
+      int sendDir, InterpolationProcessorPtr iprocessor);
+
+   virtual SPtr<Block3DConnector> createFineToCoarseConnector(SPtr<Block3D> block,
+      VectorTransmitterPtr sender,
+      VectorTransmitterPtr receiver,
+      int sendDir,
+      InterpolationProcessorPtr iprocessor,
+      FineToCoarseBlock3DConnector::CFconnectorType connType);
+
+private:
+
+};
+#endif // Block3DConnectorFactory_h__
+
diff --git a/src/cpu/VirtualFluidsCore/Connectors/CoarseToFineBlock3DConnector.cpp b/src/cpu/VirtualFluidsCore/Connectors/CoarseToFineBlock3DConnector.cpp
index c33623d7eb0e88033be401cca83220dcd7e9a8e3..dadbd0c9677105204c52f3ae976b4f4611082c8f 100644
--- a/src/cpu/VirtualFluidsCore/Connectors/CoarseToFineBlock3DConnector.cpp
+++ b/src/cpu/VirtualFluidsCore/Connectors/CoarseToFineBlock3DConnector.cpp
@@ -1,135 +1,135 @@
-#include "CoarseToFineBlock3DConnector.h"
-
-
-
-////////////////////////////////////////////////////////////////////////////
-
-CoarseToFineBlock3DConnector::CoarseToFineBlock3DConnector(SPtr<Block3D> block,
-   VectorTransmitterPtr sender00, VectorTransmitterPtr receiver00,
-   VectorTransmitterPtr sender01, VectorTransmitterPtr receiver01,
-   VectorTransmitterPtr sender10, VectorTransmitterPtr receiver10,
-   VectorTransmitterPtr sender11, VectorTransmitterPtr receiver11,
-   int sendDir, InterpolationProcessorPtr iprocessor) : Block3DConnector(sendDir)
-   , block(block)
-   , sender00(sender00)
-   , sender01(sender01)
-   , sender10(sender10)
-   , sender11(sender11)
-   , receiver00(receiver00)
-   , receiver01(receiver01)
-   , receiver10(receiver10)
-   , receiver11(receiver11)
-   , iprocessor(iprocessor)
-{
-   if (!(sendDir==D3Q27System::E  || sendDir==D3Q27System::W  || sendDir==D3Q27System::N  || sendDir==D3Q27System::S  || sendDir==D3Q27System::T || sendDir==D3Q27System::B
-      ||  sendDir==D3Q27System::NE || sendDir==D3Q27System::SW || sendDir==D3Q27System::SE || sendDir==D3Q27System::NW
-      ||  sendDir==D3Q27System::TE || sendDir==D3Q27System::BW || sendDir==D3Q27System::BE || sendDir==D3Q27System::TW
-      ||  sendDir==D3Q27System::TN || sendDir==D3Q27System::BS || sendDir==D3Q27System::BN || sendDir==D3Q27System::TS
-      ||  sendDir==D3Q27System::TNE || sendDir==D3Q27System::TNW || sendDir==D3Q27System::TSE || sendDir==D3Q27System::TSW
-      ||  sendDir==D3Q27System::BNE || sendDir==D3Q27System::BNW || sendDir==D3Q27System::BSE || sendDir==D3Q27System::BSW
-      ))
-   {
-      throw UbException(UB_EXARGS, "invalid constructor for this direction");
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-
-bool CoarseToFineBlock3DConnector::isLocalConnector()
-{
-   return !this->isRemoteConnector();
-}
-//////////////////////////////////////////////////////////////////////////
-
-bool CoarseToFineBlock3DConnector::isRemoteConnector()
-{
-   return ((sender11 && sender11->isRemoteTransmitter()) || (receiver11 && receiver11->isRemoteTransmitter())
-      || (sender00 && sender00->isRemoteTransmitter()) || (receiver00 && receiver00->isRemoteTransmitter())
-      || (sender01 && sender01->isRemoteTransmitter()) || (receiver01 && receiver01->isRemoteTransmitter())
-      || (sender10 && sender10->isRemoteTransmitter()) || (receiver10 && receiver10->isRemoteTransmitter()));
-}
-//////////////////////////////////////////////////////////////////////////
-
-void CoarseToFineBlock3DConnector::sendTransmitterDataSize()
-{
-   if (sender00)
-   {
-      UBLOG(logDEBUG5, "CoarseToFineBlock3DConnector<VectorTransmitter>::sendTransmitterDataSize()-sender00 "<<block.lock()->toString()<<" sendDir="<<sendDir);
-      sender00->sendDataSize();
-   }
-   if (sender01)
-   {
-      UBLOG(logDEBUG5, "CoarseToFineBlock3DConnector<VectorTransmitter>::sendTransmitterDataSize()-sender01 "<<block.lock()->toString()<<"sendDir="<<sendDir);
-      sender01->sendDataSize();
-   }
-   if (sender10)
-   {
-      UBLOG(logDEBUG5, "CoarseToFineBlock3DConnector<VectorTransmitter>::sendTransmitterDataSize()-sender10 "<<block.lock()->toString()+"sendDir="<<sendDir);
-      sender10->sendDataSize();
-   }
-   if (sender11)
-   {
-      UBLOG(logDEBUG5, "CoarseToFineBlock3DConnector<VectorTransmitter>::sendTransmitterDataSize()-sender11 "<<block.lock()->toString()<<"sendDir="<<sendDir);
-      sender11->sendDataSize();
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-
-void CoarseToFineBlock3DConnector::receiveTransmitterDataSize()
-{
-   if (receiver00)
-   {
-      UBLOG(logDEBUG5, "CoarseToFineBlock3DConnector<VectorTransmitter>::receiveTransmitterDataSize()-receiver00 "<<block.lock()->toString()<<"sendDir="<<sendDir);
-      receiver00->receiveDataSize();
-   }
-   if (receiver01)
-   {
-      UBLOG(logDEBUG5, "CoarseToFineBlock3DConnector<VectorTransmitter>::receiveTransmitterDataSize()-receiver01 "<<block.lock()->toString()<<"sendDir="<<sendDir);
-      receiver01->receiveDataSize();
-   }
-   if (receiver10)
-   {
-      UBLOG(logDEBUG5, "CoarseToFineBlock3DConnector<VectorTransmitter>::receiveTransmitterDataSize()-receiver10 "<<block.lock()->toString()<<"sendDir="<<sendDir);
-      receiver10->receiveDataSize();
-   }
-   if (receiver11)
-   {
-      UBLOG(logDEBUG5, "CoarseToFineBlock3DConnector<VectorTransmitter>::receiveTransmitterDataSize()-receiver11 "<<block.lock()->toString()<<"sendDir="<<sendDir);
-      receiver11->receiveDataSize();
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-
-void CoarseToFineBlock3DConnector::prepareForSend()
-{
-   if (sender00) sender00->prepareForSend();
-   if (sender01) sender01->prepareForSend();
-   if (sender10) sender10->prepareForSend();
-   if (sender11) sender11->prepareForSend();
-}
-//////////////////////////////////////////////////////////////////////////
-
-void CoarseToFineBlock3DConnector::sendVectors()
-{
-   if (sender00) sender00->sendData();
-   if (sender01) sender01->sendData();
-   if (sender10) sender10->sendData();
-   if (sender11) sender11->sendData();
-}
-//////////////////////////////////////////////////////////////////////////
-
-void CoarseToFineBlock3DConnector::prepareForReceive()
-{
-   if (receiver00) receiver00->prepareForReceive();
-   if (receiver01) receiver01->prepareForReceive();
-   if (receiver10) receiver10->prepareForReceive();
-   if (receiver11) receiver11->prepareForReceive();
-}
-//////////////////////////////////////////////////////////////////////////
-
-void CoarseToFineBlock3DConnector::receiveVectors()
-{
-   if (receiver00) receiver00->receiveData();
-   if (receiver01) receiver01->receiveData();
-   if (receiver10) receiver10->receiveData();
-   if (receiver11) receiver11->receiveData();
-}
+#include "CoarseToFineBlock3DConnector.h"
+
+
+
+////////////////////////////////////////////////////////////////////////////
+
+CoarseToFineBlock3DConnector::CoarseToFineBlock3DConnector(SPtr<Block3D> block,
+   VectorTransmitterPtr sender00, VectorTransmitterPtr receiver00,
+   VectorTransmitterPtr sender01, VectorTransmitterPtr receiver01,
+   VectorTransmitterPtr sender10, VectorTransmitterPtr receiver10,
+   VectorTransmitterPtr sender11, VectorTransmitterPtr receiver11,
+   int sendDir, InterpolationProcessorPtr iprocessor) : Block3DConnector(sendDir)
+   , block(block)
+   , sender00(sender00)
+   , sender01(sender01)
+   , sender10(sender10)
+   , sender11(sender11)
+   , receiver00(receiver00)
+   , receiver01(receiver01)
+   , receiver10(receiver10)
+   , receiver11(receiver11)
+   , iprocessor(iprocessor)
+{
+   if (!(sendDir==D3Q27System::E  || sendDir==D3Q27System::W  || sendDir==D3Q27System::N  || sendDir==D3Q27System::S  || sendDir==D3Q27System::T || sendDir==D3Q27System::B
+      ||  sendDir==D3Q27System::NE || sendDir==D3Q27System::SW || sendDir==D3Q27System::SE || sendDir==D3Q27System::NW
+      ||  sendDir==D3Q27System::TE || sendDir==D3Q27System::BW || sendDir==D3Q27System::BE || sendDir==D3Q27System::TW
+      ||  sendDir==D3Q27System::TN || sendDir==D3Q27System::BS || sendDir==D3Q27System::BN || sendDir==D3Q27System::TS
+      ||  sendDir==D3Q27System::TNE || sendDir==D3Q27System::TNW || sendDir==D3Q27System::TSE || sendDir==D3Q27System::TSW
+      ||  sendDir==D3Q27System::BNE || sendDir==D3Q27System::BNW || sendDir==D3Q27System::BSE || sendDir==D3Q27System::BSW
+      ))
+   {
+      throw UbException(UB_EXARGS, "invalid constructor for this direction");
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+
+bool CoarseToFineBlock3DConnector::isLocalConnector()
+{
+   return !this->isRemoteConnector();
+}
+//////////////////////////////////////////////////////////////////////////
+
+bool CoarseToFineBlock3DConnector::isRemoteConnector()
+{
+   return ((sender11 && sender11->isRemoteTransmitter()) || (receiver11 && receiver11->isRemoteTransmitter())
+      || (sender00 && sender00->isRemoteTransmitter()) || (receiver00 && receiver00->isRemoteTransmitter())
+      || (sender01 && sender01->isRemoteTransmitter()) || (receiver01 && receiver01->isRemoteTransmitter())
+      || (sender10 && sender10->isRemoteTransmitter()) || (receiver10 && receiver10->isRemoteTransmitter()));
+}
+//////////////////////////////////////////////////////////////////////////
+
+void CoarseToFineBlock3DConnector::sendTransmitterDataSize()
+{
+   if (sender00)
+   {
+      UBLOG(logDEBUG5, "CoarseToFineBlock3DConnector<VectorTransmitter>::sendTransmitterDataSize()-sender00 "<<block.lock()->toString()<<" sendDir="<<sendDir);
+      sender00->sendDataSize();
+   }
+   if (sender01)
+   {
+      UBLOG(logDEBUG5, "CoarseToFineBlock3DConnector<VectorTransmitter>::sendTransmitterDataSize()-sender01 "<<block.lock()->toString()<<"sendDir="<<sendDir);
+      sender01->sendDataSize();
+   }
+   if (sender10)
+   {
+      UBLOG(logDEBUG5, "CoarseToFineBlock3DConnector<VectorTransmitter>::sendTransmitterDataSize()-sender10 "<<block.lock()->toString()+"sendDir="<<sendDir);
+      sender10->sendDataSize();
+   }
+   if (sender11)
+   {
+      UBLOG(logDEBUG5, "CoarseToFineBlock3DConnector<VectorTransmitter>::sendTransmitterDataSize()-sender11 "<<block.lock()->toString()<<"sendDir="<<sendDir);
+      sender11->sendDataSize();
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+
+void CoarseToFineBlock3DConnector::receiveTransmitterDataSize()
+{
+   if (receiver00)
+   {
+      UBLOG(logDEBUG5, "CoarseToFineBlock3DConnector<VectorTransmitter>::receiveTransmitterDataSize()-receiver00 "<<block.lock()->toString()<<"sendDir="<<sendDir);
+      receiver00->receiveDataSize();
+   }
+   if (receiver01)
+   {
+      UBLOG(logDEBUG5, "CoarseToFineBlock3DConnector<VectorTransmitter>::receiveTransmitterDataSize()-receiver01 "<<block.lock()->toString()<<"sendDir="<<sendDir);
+      receiver01->receiveDataSize();
+   }
+   if (receiver10)
+   {
+      UBLOG(logDEBUG5, "CoarseToFineBlock3DConnector<VectorTransmitter>::receiveTransmitterDataSize()-receiver10 "<<block.lock()->toString()<<"sendDir="<<sendDir);
+      receiver10->receiveDataSize();
+   }
+   if (receiver11)
+   {
+      UBLOG(logDEBUG5, "CoarseToFineBlock3DConnector<VectorTransmitter>::receiveTransmitterDataSize()-receiver11 "<<block.lock()->toString()<<"sendDir="<<sendDir);
+      receiver11->receiveDataSize();
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+
+void CoarseToFineBlock3DConnector::prepareForSend()
+{
+   if (sender00) sender00->prepareForSend();
+   if (sender01) sender01->prepareForSend();
+   if (sender10) sender10->prepareForSend();
+   if (sender11) sender11->prepareForSend();
+}
+//////////////////////////////////////////////////////////////////////////
+
+void CoarseToFineBlock3DConnector::sendVectors()
+{
+   if (sender00) sender00->sendData();
+   if (sender01) sender01->sendData();
+   if (sender10) sender10->sendData();
+   if (sender11) sender11->sendData();
+}
+//////////////////////////////////////////////////////////////////////////
+
+void CoarseToFineBlock3DConnector::prepareForReceive()
+{
+   if (receiver00) receiver00->prepareForReceive();
+   if (receiver01) receiver01->prepareForReceive();
+   if (receiver10) receiver10->prepareForReceive();
+   if (receiver11) receiver11->prepareForReceive();
+}
+//////////////////////////////////////////////////////////////////////////
+
+void CoarseToFineBlock3DConnector::receiveVectors()
+{
+   if (receiver00) receiver00->receiveData();
+   if (receiver01) receiver01->receiveData();
+   if (receiver10) receiver10->receiveData();
+   if (receiver11) receiver11->receiveData();
+}
diff --git a/src/cpu/VirtualFluidsCore/Connectors/CoarseToFineBlock3DConnector.h b/src/cpu/VirtualFluidsCore/Connectors/CoarseToFineBlock3DConnector.h
index dcca4323050b53c4be96f8cb7e2084488ab79ea8..8a04f0ca485aa0811c8387ec99abcc582e4bf6db 100644
--- a/src/cpu/VirtualFluidsCore/Connectors/CoarseToFineBlock3DConnector.h
+++ b/src/cpu/VirtualFluidsCore/Connectors/CoarseToFineBlock3DConnector.h
@@ -1,105 +1,105 @@
-//! \file CoarseToFineBlock3DConnector.h
-//! \brief Base class for connectors that interpolates and sends data from coarse level to fine.  
-//! \author Konstantin Kutscher
-//! \date 18.05.2015
-
-#ifndef CoarseToFineBlock3DConnector_H
-#define CoarseToFineBlock3DConnector_H
-
-#include "TransmitterType.h"
-#include "Block3DConnector.h"
-#include "D3Q27System.h"
-#include "Block3D.h"
-#include "InterpolationProcessor.h"
-#include <PointerDefinitions.h>
-
-
-class Block3D;
-
-//! \class CoarseToFineBlock3DConnector
-//! \brief Base class for connectors that interpolates and sends data from coarse level to fine. 
-//! \details The data is copied in a vector (this is located in the transmitter). 
-//! The vector is transmitted via transmitter. 
-//! The transmitter can be a local, MPI, RCG, CTL or whatever 
-//! which a transmitter that is derived from transmitter base class.
-//!
-//! four fine blocks inside a coarse block:
-//!
-//! |    |    |
-//! |:--:|:---| 
-//! | 01 | 11 | 
-//! | 00 | 10 | 
-//!
-//! send direction:    
-//!
-//! |E<->W   |  N<->S  |  T<->B |
-//! |--------|---------|--------|
-//! |  x3    |   x3    |    x2  |
-//! |  ^     |   ^     |    ^   |
-//! |  +->x2 |  +->x1  |   +->x1|
-
-
-class CoarseToFineBlock3DConnector : public Block3DConnector
-{
-public:
-   CoarseToFineBlock3DConnector(SPtr<Block3D> block,
-      VectorTransmitterPtr sender00, VectorTransmitterPtr receiver00,
-      VectorTransmitterPtr sender01, VectorTransmitterPtr receiver01,
-      VectorTransmitterPtr sender10, VectorTransmitterPtr receiver10,
-      VectorTransmitterPtr sender11, VectorTransmitterPtr receiver11,
-      int sendDir, InterpolationProcessorPtr iprocessor);
-
-   virtual ~CoarseToFineBlock3DConnector() {}
-
-   bool isLocalConnector();
-   bool isRemoteConnector();
-
-   virtual void init()=0;
-
-   void sendTransmitterDataSize();
-   void receiveTransmitterDataSize();
-
-   void prepareForSend();
-   void sendVectors();
-
-   void prepareForReceive();
-   void receiveVectors();
-
-   virtual void fillSendVectors()=0;
-   virtual void distributeReceiveVectors() = 0;
-
-   bool isInterpolationConnectorCF() { return true; }
-   bool isInterpolationConnectorFC() { return false; }
-
-   void prepareForSendX1() {}
-   void prepareForSendX2() {}
-   void prepareForSendX3() {}
-
-   void sendVectorsX1() {}
-   void sendVectorsX2() {}
-   void sendVectorsX3() {}
-
-   void prepareForReceiveX1() {}
-   void prepareForReceiveX2() {}
-   void prepareForReceiveX3() {}
-
-   void receiveVectorsX1() {}
-   void receiveVectorsX2() {}
-   void receiveVectorsX3() {}
-
-protected:
-   WPtr<Block3D> block; //dieser nvd sendet daten und die empfangenen werden diesem nvd zugeordnet
-   VectorTransmitterPtr sender00, receiver00,
-                        sender01, receiver01,
-                        sender10, receiver10,
-                        sender11, receiver11;
-
-   InterpolationProcessorPtr iprocessor;
-
-};
-
-
-
-
-#endif 
-
+//! \file CoarseToFineBlock3DConnector.h
+//! \brief Base class for connectors that interpolates and sends data from coarse level to fine.  
+//! \author Konstantin Kutscher
+//! \date 18.05.2015
+
+#ifndef CoarseToFineBlock3DConnector_H
+#define CoarseToFineBlock3DConnector_H
+
+#include "TransmitterType.h"
+#include "Block3DConnector.h"
+#include "D3Q27System.h"
+#include "Block3D.h"
+#include "InterpolationProcessor.h"
+#include <PointerDefinitions.h>
+
+
+class Block3D;
+
+//! \class CoarseToFineBlock3DConnector
+//! \brief Base class for connectors that interpolates and sends data from coarse level to fine. 
+//! \details The data is copied in a vector (this is located in the transmitter). 
+//! The vector is transmitted via transmitter. 
+//! The transmitter can be a local, MPI, RCG, CTL or whatever 
+//! which a transmitter that is derived from transmitter base class.
+//!
+//! four fine blocks inside a coarse block:
+//!
+//! |    |    |
+//! |:--:|:---| 
+//! | 01 | 11 | 
+//! | 00 | 10 | 
+//!
+//! send direction:    
+//!
+//! |E<->W   |  N<->S  |  T<->B |
+//! |--------|---------|--------|
+//! |  x3    |   x3    |    x2  |
+//! |  ^     |   ^     |    ^   |
+//! |  +->x2 |  +->x1  |   +->x1|
+
+
+class CoarseToFineBlock3DConnector : public Block3DConnector
+{
+public:
+   CoarseToFineBlock3DConnector(SPtr<Block3D> block,
+      VectorTransmitterPtr sender00, VectorTransmitterPtr receiver00,
+      VectorTransmitterPtr sender01, VectorTransmitterPtr receiver01,
+      VectorTransmitterPtr sender10, VectorTransmitterPtr receiver10,
+      VectorTransmitterPtr sender11, VectorTransmitterPtr receiver11,
+      int sendDir, InterpolationProcessorPtr iprocessor);
+
+   virtual ~CoarseToFineBlock3DConnector() {}
+
+   bool isLocalConnector();
+   bool isRemoteConnector();
+
+   virtual void init()=0;
+
+   void sendTransmitterDataSize();
+   void receiveTransmitterDataSize();
+
+   void prepareForSend();
+   void sendVectors();
+
+   void prepareForReceive();
+   void receiveVectors();
+
+   virtual void fillSendVectors()=0;
+   virtual void distributeReceiveVectors() = 0;
+
+   bool isInterpolationConnectorCF() { return true; }
+   bool isInterpolationConnectorFC() { return false; }
+
+   void prepareForSendX1() {}
+   void prepareForSendX2() {}
+   void prepareForSendX3() {}
+
+   void sendVectorsX1() {}
+   void sendVectorsX2() {}
+   void sendVectorsX3() {}
+
+   void prepareForReceiveX1() {}
+   void prepareForReceiveX2() {}
+   void prepareForReceiveX3() {}
+
+   void receiveVectorsX1() {}
+   void receiveVectorsX2() {}
+   void receiveVectorsX3() {}
+
+protected:
+   WPtr<Block3D> block; //dieser nvd sendet daten und die empfangenen werden diesem nvd zugeordnet
+   VectorTransmitterPtr sender00, receiver00,
+                        sender01, receiver01,
+                        sender10, receiver10,
+                        sender11, receiver11;
+
+   InterpolationProcessorPtr iprocessor;
+
+};
+
+
+
+
+#endif 
+
diff --git a/src/cpu/VirtualFluidsCore/Connectors/CoarseToFineNodeSetBlock3DConnector.cpp b/src/cpu/VirtualFluidsCore/Connectors/CoarseToFineNodeSetBlock3DConnector.cpp
index 09deeee47a53e2265f0dfa34146c2b969f523c5d..117aa6a44bebdf1468ac419a8ebe5a8ac528428f 100644
--- a/src/cpu/VirtualFluidsCore/Connectors/CoarseToFineNodeSetBlock3DConnector.cpp
+++ b/src/cpu/VirtualFluidsCore/Connectors/CoarseToFineNodeSetBlock3DConnector.cpp
@@ -1,1384 +1,1384 @@
-#include "CoarseToFineNodeSetBlock3DConnector.h"
-#include "DataSet3D.h"
-
-
-////////////////////////////////////////////////////////////////////////////
-CoarseToFineNodeSetBlock3DConnector::CoarseToFineNodeSetBlock3DConnector(SPtr<Block3D> block,
-   VectorTransmitterPtr sender00, VectorTransmitterPtr receiver00,
-   VectorTransmitterPtr sender01, VectorTransmitterPtr receiver01,
-   VectorTransmitterPtr sender10, VectorTransmitterPtr receiver10,
-   VectorTransmitterPtr sender11, VectorTransmitterPtr receiver11,
-   int sendDir, InterpolationProcessorPtr iprocessor) : CoarseToFineBlock3DConnector(block, sender00, receiver00,
-   sender01, receiver01,
-   sender10, receiver10,
-   sender11, receiver11,
-   sendDir, iprocessor)
-{
-}
-//////////////////////////////////////////////////////////////////////////
-void CoarseToFineNodeSetBlock3DConnector::init()
-{
-   bMaxX1 = (int)block.lock()->getKernel()->getDataSet()->getFdistributions()->getNX1();
-   bMaxX2 = (int)block.lock()->getKernel()->getDataSet()->getFdistributions()->getNX2();
-   bMaxX3 = (int)block.lock()->getKernel()->getDataSet()->getFdistributions()->getNX3();
-
-   minX1 = 0;
-   minX2 = 0;
-   minX3 = 0;
-   maxX1 = bMaxX1 - 1;
-   maxX2 = bMaxX2 - 1;
-   maxX3 = bMaxX3 - 1;
-
-   minHalfX1 = 0;
-   minHalfX2 = 0;
-   minHalfX3 = 0;
-
-   maxHalfX1 = 0;
-   maxHalfX2 = 0;
-   maxHalfX3 = 0;
-
-   if (Utilities::isEven(bMaxX1))
-   {
-      minHalfX1 = bMaxX1 / 2 - 1;
-      maxHalfX1 = bMaxX1 / 2 - 1;
-   }
-   else if (Utilities::isOdd(bMaxX1))
-   {
-      minHalfX1 = bMaxX1 / 2;
-      maxHalfX1 = bMaxX1 / 2 - 1;
-   }
-
-   if (Utilities::isEven(bMaxX2))
-   {
-      minHalfX2 = bMaxX2 / 2 - 1;
-      maxHalfX2 = bMaxX2 / 2 - 1;
-   }
-   else if (Utilities::isOdd(bMaxX2))
-   {
-      minHalfX2 = bMaxX2 / 2;
-      maxHalfX2 = bMaxX2 / 2 - 1;
-   }
-
-   if (Utilities::isEven(bMaxX3))
-   {
-      minHalfX3 = bMaxX3 / 2 - 1;
-      maxHalfX3 = bMaxX3 / 2 - 1;
-   }
-   else if (Utilities::isOdd(bMaxX3))
-   {
-      minHalfX3 = bMaxX3 / 2;
-      maxHalfX3 = bMaxX3 / 2 - 1;
-   }
-
-   //int       sendSize = 0;
-   LBMReal initValue = -999.0;
-
-   int sendDataPerNode = 27/*f*/;
-   int iCellSize = 8; //size of interpolation cell
-
-   findCFCells();
-   findFCCells();
-
-   //////////////////////////////////////////////////////
-   //Debug
-   //////////////////////////////////////////////////////
-   if (block.lock()->getGlobalID() == 2234)
-   {
-      int test = 0;
-   }
-
-   if (sender00) sender00->getData().resize(iNodeSetSender00.size()*iCellSize*sendDataPerNode, initValue);
-   else sender00 = VectorTransmitterPtr(new TbLocalTransmitter< CbVector< LBMReal > >());
-   if (sender01)  sender01->getData().resize(iNodeSetSender01.size()*iCellSize*sendDataPerNode, initValue);
-   else sender01 = VectorTransmitterPtr(new TbLocalTransmitter< CbVector< LBMReal > >());
-   if (sender10)  sender10->getData().resize(iNodeSetSender10.size()*iCellSize*sendDataPerNode, initValue);
-   else sender10 = VectorTransmitterPtr(new TbLocalTransmitter< CbVector< LBMReal > >());
-   if (sender11)   sender11->getData().resize(iNodeSetSender11.size()*iCellSize*sendDataPerNode, initValue);
-   else sender11 = VectorTransmitterPtr(new TbLocalTransmitter< CbVector< LBMReal > >());
-
-   if (!receiver00) receiver00 = VectorTransmitterPtr(new TbLocalTransmitter< CbVector< LBMReal > >());
-   if (!receiver01)  receiver01 = VectorTransmitterPtr(new TbLocalTransmitter< CbVector< LBMReal > >());
-   if (!receiver10)  receiver10 = VectorTransmitterPtr(new TbLocalTransmitter< CbVector< LBMReal > >());
-   if (!receiver11)   receiver11 = VectorTransmitterPtr(new TbLocalTransmitter< CbVector< LBMReal > >());
-}
-//////////////////////////////////////////////////////////////////////////
-
-void CoarseToFineNodeSetBlock3DConnector::findCFCells(int lMinX1, int lMinX2, int lMinX3, int lMaxX1, int lMaxX2, int lMaxX3, INodeSet &inodes)
-{
-   int ix1, ix2, ix3;
-   LBMReal x1off, x2off, x3off;
-
-   SPtr<DistributionArray3D>  fFrom = block.lock()->getKernel()->getDataSet()->getFdistributions();
-   SPtr<BCArray3D> bcArray = block.lock()->getKernel()->getBCProcessor()->getBCArray();
-
-   for (ix3 = lMinX3; ix3<=lMaxX3; ix3++)
-   {
-      for (ix2 = lMinX2; ix2<=lMaxX2; ix2++)
-      {
-         for (ix1 = lMinX1; ix1<=lMaxX1; ix1++)
-         {
-            D3Q27ICell icellC;
-
-            int howManySolids = iprocessor->iCellHowManySolids(bcArray, ix1, ix2, ix3);
-
-            if (howManySolids == 0 || howManySolids == 8)
-            {
-               x1off = 0.0;
-               x2off = 0.0;
-               x3off = 0.0;
-            }
-            else
-            {
-               if (!iprocessor->findNeighborICell(bcArray, fFrom, icellC, bMaxX1, bMaxX2, bMaxX3, ix1, ix2, ix3, x1off, x2off, x3off))
-               {
-                  std::string err = "For "+block.lock()->toString()+" x1="+UbSystem::toString(ix1)+", x2=" + UbSystem::toString(ix2)+", x3=" + UbSystem::toString(ix3)+
-                     " interpolation is not implemented for other direction"+
-                     " by using in: "+(std::string)typeid(*this).name()+
-                     " or maybe you have a solid on the block boundary";
-                  UB_THROW(UbException(UB_EXARGS, err));
-               }
-            }
-
-            INodeVector inv;
-            inv.push_back(ix1 + (int)x1off);
-            inv.push_back(ix2 + (int)x2off);
-            inv.push_back(ix3 + (int)x3off);
-            inv.push_back((int)x1off);
-            inv.push_back((int)x2off);
-            inv.push_back((int)x3off);
-            //inodes.insert(inv);
-            inodes.push_back(inv);
-         }
-      }
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-//template< typename VectorTransmitter >
-void CoarseToFineNodeSetBlock3DConnector::findCFCells()
-{
-   using namespace D3Q27System;
-
-   int lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3;
-
-   switch (sendDir)
-   {
-      //faces
-   case E: case W:
-      if (sendDir == E)
-      {
-         lMinX1 = maxX1 - 2;
-         lMaxX1 = lMinX1;
-      }
-      else if (sendDir == W)
-      {
-         lMinX1 = 1;
-         lMaxX1 = lMinX1;
-      }
-
-      if (sender00)
-      {
-         lMinX2 = minX2;
-         lMaxX2 = maxHalfX2;
-         lMinX3 = minX3;
-         lMaxX3 = maxHalfX3;
-         findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetSender00);
-      }
-      if (sender10)
-      {
-         lMinX2 = minHalfX2;
-         lMaxX2 = maxX2 - 1;
-         lMinX3 = minX3;
-         lMaxX3 = maxHalfX3;
-         findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetSender10);
-      }
-      if (sender01)
-      {
-         lMinX2 = minX2;
-         lMaxX2 = maxHalfX2;
-         lMinX3 = minHalfX3;
-         lMaxX3 = maxX3 - 1;
-         findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetSender01);
-      }
-      if (sender11)
-      {
-         lMinX2 = minHalfX2;
-         lMaxX2 = maxX2 - 1;
-         lMinX3 = minHalfX3;
-         lMaxX3 = maxX3 - 1;
-         findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetSender11);
-      }
-      break;
-   case N: case S:
-      if (sendDir == N)
-      {
-         lMinX2 = maxX2 - 2;
-         lMaxX2 = lMinX2;
-      }
-      else if (sendDir == S)
-      {
-         lMinX2 = 1;
-         lMaxX2 = lMinX2;
-      }
-
-      if (sender00)
-      {
-         lMinX1 = minX1;
-         lMaxX1 = maxHalfX1;
-         lMinX3 = minX3;
-         lMaxX3 = maxHalfX3;
-         findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetSender00);
-      }
-      if (sender10)
-      {
-         lMinX1 = minHalfX1;
-         lMaxX1 = maxX1 - 1;
-         lMinX3 = minX3;
-         lMaxX3 = maxHalfX3;
-         findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetSender10);
-      }
-      if (sender01)
-      {
-         lMinX1 = minX1;
-         lMaxX1 = maxHalfX1;
-         lMinX3 = minHalfX3;
-         lMaxX3 = maxX3 - 1;
-         findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetSender01);
-      }
-      if (sender11)
-      {
-         lMinX1 = minHalfX1;
-         lMaxX1 = maxX1 - 1;
-         lMinX3 = minHalfX3;
-         lMaxX3 = maxX3 - 1;
-         findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetSender11);
-      }
-      break;
-   case T: case B:
-      if (sendDir == T)
-      {
-         lMinX3 = maxX3 - 2;
-         lMaxX3 = lMinX3;
-      }
-      else if (sendDir == B)
-      {
-         lMinX3 = 1;
-         lMaxX3 = lMinX3;
-      }
-
-      if (sender00)
-      {
-         lMinX1 = minX1;
-         lMaxX1 = maxHalfX1;
-         lMinX2 = minX2;
-         lMaxX2 = maxHalfX2;
-         findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetSender00);
-      }
-      if (sender10)
-      {
-         lMinX1 = minHalfX1;
-         lMaxX1 = maxX1 - 1;
-         lMinX2 = minX2;
-         lMaxX2 = maxHalfX2;
-         findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetSender10);
-      }
-      if (sender01)
-      {
-         lMinX1 = minX1;
-         lMaxX1 = maxHalfX1;
-         lMinX2 = minHalfX2;
-         lMaxX2 = maxX2 - 1;
-         findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetSender01);
-      }
-      if (sender11)
-      {
-         lMinX1 = minHalfX1;
-         lMaxX1 = maxX1 - 1;
-         lMinX2 = minHalfX2;
-         lMaxX2 = maxX2 - 1;
-         findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetSender11);
-      }
-      break;
-      //edges
-      //N-S-E-W
-   case NE: case SW: case SE: case NW:
-      if (sendDir == NE)
-      {
-         lMinX1 = maxX1 - 2;
-         lMaxX1 = lMinX1 + 1;
-         lMinX2 = maxX2 - 2;
-         lMaxX2 = lMinX2 + 1;
-      }
-      else if (sendDir == SW)
-      {
-         lMinX1 = 0;
-         lMaxX1 = lMinX1 + 1;
-         lMinX2 = 0;
-         lMaxX2 = lMinX2 + 1;
-      }
-      else if (sendDir == SE)
-      {
-         lMinX1 = maxX1 - 2;
-         lMaxX1 = lMinX1 + 1;
-         lMinX2 = 0;
-         lMaxX2 = lMinX2 + 1;
-      }
-      else if (sendDir == NW)
-      {
-         lMinX1 = 0;
-         lMaxX1 = lMinX1 + 1;
-         lMinX2 = maxX2 - 2;
-         lMaxX2 = lMinX2 + 1;
-      }
-
-      if (sender00)
-      {
-         lMinX3 = minX3;
-         lMaxX3 = maxHalfX3;
-         findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetSender00);
-      }
-      if (sender10)
-      {
-         lMinX3 = minHalfX3;
-         lMaxX3 = maxX3 - 1;
-         findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetSender10);
-      }
-      break;
-      //T-B-E-W
-   case TE: case BW: case BE: case TW:
-      if (sendDir == TE)
-      {
-         lMinX1 = maxX1 - 2;
-         lMaxX1 = lMinX1 + 1;
-         lMinX3 = maxX3 - 2;
-         lMaxX3 = lMinX3 + 1;
-      }
-      else if (sendDir == BW)
-      {
-         lMinX1 = 0;
-         lMaxX1 = lMinX1 + 2;
-         lMinX3 = 0;
-         lMaxX3 = lMinX3 + 2;
-      }
-      else if (sendDir == BE)
-      {
-         lMinX1 = maxX1 - 2;
-         lMaxX1 = lMinX1 + 1;
-         lMinX3 = 0;
-         lMaxX3 = lMinX3 + 1;
-      }
-      else if (sendDir == TW)
-      {
-         lMinX1 = 0;
-         lMaxX1 = lMinX1 + 1;
-         lMinX3 = maxX3 - 2;
-         lMaxX3 = lMinX3 + 1;
-      }
-
-      if (sender00)
-      {
-         lMinX2 = minX2;
-         lMaxX2 = maxHalfX2;
-         findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetSender00);
-      }
-      if (sender10)
-      {
-         lMinX2 = minHalfX2;
-         lMaxX2 = maxX2 - 1;
-         findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetSender10);
-      }
-      break;
-      //T-B-N-S
-   case TN: case BS: case BN: case TS:
-      if (sendDir == TN)
-      {
-         lMinX2 = maxX2 - 2;
-         lMaxX2 = lMinX2 + 1;
-         lMinX3 = maxX3 - 3;
-         lMaxX3 = lMinX3 + 1;
-      }
-      else if (sendDir == BS)
-      {
-         lMinX2 = 0;
-         lMaxX2 = lMinX2 + 1;
-         lMinX3 = 0;
-         lMaxX3 = lMinX3 + 1;
-      }
-      else if (sendDir == BN)
-      {
-         lMinX2 = maxX2 - 2;
-         lMaxX2 = lMinX2 + 1;
-         lMinX3 = 0;
-         lMaxX3 = lMinX3 + 1;
-      }
-      else if (sendDir == TS)
-      {
-         lMinX2 = 0;
-         lMaxX2 = lMinX2 + 1;
-         lMinX3 = maxX3 - 2;
-         lMaxX3 = lMinX3 + 1;
-      }
-
-      if (sender00)
-      {
-         lMinX1 = minX1;
-         lMaxX1 = maxHalfX1;
-         findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetSender00);
-      }
-      if (sender10)
-      {
-         lMinX1 = minHalfX1;
-         lMaxX1 = maxX1 - 1;
-         findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetSender10);
-      }
-      break;
-      //corners
-   case TNE: case TNW: case TSE: case TSW: case BNE: case BNW: case BSE: case BSW:
-      if (sendDir == TNE)
-      {
-         lMinX1 = maxX1-2;
-         lMaxX1 = maxX1-1;
-         lMinX2 = maxX2-2;
-         lMaxX2 = maxX2-1;
-         lMinX3 = maxX3-2;
-         lMaxX3 = maxX3-1;
-      }
-      else if (sendDir == TNW)
-      {
-         lMinX1 = 0;
-         lMaxX1 = 1;
-         lMinX2 = maxX2-2;
-         lMaxX2 = maxX2-1;
-         lMinX3 = maxX3-2;
-         lMaxX3 = maxX3-1;
-      }
-      else if (sendDir == TSE)
-      {
-         lMinX1 = maxX1-2;
-         lMaxX1 = maxX1-1;
-         lMinX2 = 0;
-         lMaxX2 = 1;
-         lMinX3 = maxX3-2;
-         lMaxX3 = maxX3-1;
-      }
-      else if (sendDir == TSW)
-      {
-         lMinX1 = 0;
-         lMaxX1 = 1;
-         lMinX2 = 0;
-         lMaxX2 = 1;
-         lMinX3 = maxX3-2;
-         lMaxX3 = maxX3-1;
-      }
-      else if (sendDir == BNE)
-      {
-         lMinX1 = maxX1-2;
-         lMaxX1 = maxX1-1;
-         lMinX2 = maxX2-2;
-         lMaxX2 = maxX2-1;
-         lMinX3 = 0;
-         lMaxX3 = 1;
-      }
-      else if (sendDir == BNW)
-      {
-         lMinX1 = 0;
-         lMaxX1 = 1;
-         lMinX2 = maxX2-2;
-         lMaxX2 = maxX2-1;
-         lMinX3 = 0;
-         lMaxX3 = 1;
-      }
-      else if (sendDir == BSE)
-      {
-         lMinX1 = maxX1-2;
-         lMaxX1 = maxX1-1;
-         lMinX2 = 0;
-         lMaxX2 = 1;
-         lMinX3 = 0;
-         lMaxX3 = 1;
-      }
-      else if (sendDir == BSW)
-      {
-         lMinX1 = 0;
-         lMaxX1 = 1;
-         lMinX2 = 0;
-         lMaxX2 = 1;
-         lMinX3 = 0;
-         lMaxX3 = 1;
-      }
-      if (sender00)
-      {
-         findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetSender00);
-      }
-      break;
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-//template< typename VectorTransmitter >
-void CoarseToFineNodeSetBlock3DConnector::fillSendVectors()
-{
-   using namespace D3Q27System;
-
-   SPtr<DistributionArray3D>  fFrom = block.lock()->getKernel()->getDataSet()->getFdistributions();
-
-   int index00 = 0;
-   int index01 = 0;
-   int index10 = 0;
-   int index11 = 0;
-
-   vector_type& data00 = this->sender00->getData();
-   vector_type& data01 = this->sender01->getData();
-   vector_type& data10 = this->sender10->getData();
-   vector_type& data11 = this->sender11->getData();
-
-   for(INodeVector inode : iNodeSetSender00)
-   {
-      D3Q27ICell icellC;
-      D3Q27ICell icellF;
-      iprocessor->readICell(fFrom, icellC, inode[0], inode[1], inode[2]);
-      iprocessor->interpolateCoarseToFine(icellC, icellF, inode[3], inode[4], inode[5]);
-      writeICellFtoData(data00, index00, icellF);
-   }
-   for(INodeVector inode : iNodeSetSender01)
-   {
-      D3Q27ICell icellC;
-      D3Q27ICell icellF;
-      iprocessor->readICell(fFrom, icellC, inode[0], inode[1], inode[2]);
-      iprocessor->interpolateCoarseToFine(icellC, icellF, inode[3], inode[4], inode[5]);
-      writeICellFtoData(data01, index01, icellF);
-   }
-   for(INodeVector inode : iNodeSetSender10)
-   {
-      D3Q27ICell icellC;
-      D3Q27ICell icellF;
-      iprocessor->readICell(fFrom, icellC, inode[0], inode[1], inode[2]);
-      iprocessor->interpolateCoarseToFine(icellC, icellF, inode[3], inode[4], inode[5]);
-      writeICellFtoData(data10, index10, icellF);
-   }
-   for(INodeVector inode : iNodeSetSender11)
-   {
-      D3Q27ICell icellC;
-      D3Q27ICell icellF;
-      iprocessor->readICell(fFrom, icellC, inode[0], inode[1], inode[2]);
-      iprocessor->interpolateCoarseToFine(icellC, icellF, inode[3], inode[4], inode[5]);
-      writeICellFtoData(data11, index11, icellF);
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-
-void CoarseToFineNodeSetBlock3DConnector::writeICellFtoData(vector_type& data, int& index, D3Q27ICell& icellF)
-{
-   writeNodeToVector(data, index, icellF.BSW);
-   writeNodeToVector(data, index, icellF.BSE);
-   writeNodeToVector(data, index, icellF.BNW);
-   writeNodeToVector(data, index, icellF.BNE);
-   writeNodeToVector(data, index, icellF.TSW);
-   writeNodeToVector(data, index, icellF.TSE);
-   writeNodeToVector(data, index, icellF.TNW);
-   writeNodeToVector(data, index, icellF.TNE);
-}
-//////////////////////////////////////////////////////////////////////////
-
-void CoarseToFineNodeSetBlock3DConnector::writeNodeToVector(vector_type& data, int& index, LBMReal* inode)
-{
-   for (int i = D3Q27System::STARTF; i < D3Q27System::ENDF+1; i++)
-   {
-      data[index++] = inode[i];
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-
-void CoarseToFineNodeSetBlock3DConnector::findFCCells(int lMinX1, int lMinX2, int lMinX3, int lMaxX1, int lMaxX2, int lMaxX3, INodeSet &inodes)
-{
-   int ix1, ix2, ix3;
-
-   for (ix3 = lMinX3; ix3<=lMaxX3; ix3++)
-   {
-      for (ix2 = lMinX2; ix2<=lMaxX2; ix2++)
-      {
-         for (ix1 = lMinX1; ix1<=lMaxX1; ix1++)
-         {
-            INodeVector inv;
-            inv.push_back(ix1);
-            inv.push_back(ix2);
-            inv.push_back(ix3);
-            //inodes.insert(inv);
-            inodes.push_back(inv);
-         }
-      }
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-//template< typename VectorTransmitter >
-void CoarseToFineNodeSetBlock3DConnector::findFCCells()
-{
-   using namespace D3Q27System;
-
-   int lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3;
-   int lMin2X1, lMin2X2, lMin2X3, lMax2X1, lMax2X2, lMax2X3;
-   int lMin3X1, lMin3X2, lMin3X3, lMax3X1, lMax3X2, lMax3X3;
-   int dummy;
-
-   switch (sendDir)
-   {
-
-      //////////////////////////////////////////////////////
-      //Debug
-      //////////////////////////////////////////////////////
-      // if (block.lock()->getGlobalID() == 2234)
-      // {
-      //    int test = 0;
-      // }
-
-      //faces
-   case E: case W:
-      if (sendDir == E)
-      {
-         lMin1X1 = maxX1 - 3;
-         lMax1X1 = lMin1X1;
-      }
-      else if (sendDir == W)
-      {
-         lMin1X1 = 3;
-         lMax1X1 = lMin1X1;
-      }
-
-      //int TminX1 = lMinX1; int TminX2 = lMinX2; int TminX3 = lMinX3; int TmaxX1 = lMaxX1; int TmaxX2 = lMaxX2; int TmaxX3 = lMaxX3;
-
-      //if (block.lock()->hasInterpolationFlagCF(E))
-      //{
-      //   if (maxX1==TmaxX1) maxX1 -= 2;
-      //}
-      //if (block.lock()->hasInterpolationFlagCF(W))
-      //{
-      //   if (minX1==TminX1) minX1 += 2;
-      //}
-      //if (block.lock()->hasInterpolationFlagCF(N))
-      //{
-      //   if (maxX2==TmaxX2)  maxX2 -= 2;
-      //}
-      //if (block.lock()->hasInterpolationFlagCF(S))
-      //{
-      //   if (minX2==TminX2)  minX2 += 2;
-      //}
-      //if (block.lock()->hasInterpolationFlagCF(T))
-      //{
-      //   if (maxX3==TmaxX3)  maxX3 -= 2;
-      //}
-      //if (block.lock()->hasInterpolationFlagCF(B))
-      //{
-      //   if (minX3==TminX3)  minX3 += 2;
-      //}
-      if (receiver00)
-      {
-         lMin1X2 = minX2;
-         lMax1X2 = maxHalfX2;
-         lMin1X3 = minX3;
-         lMax1X3 = maxHalfX3;
-         getLocalMinMax(dummy, lMin1X2, lMin1X3, dummy, dummy, dummy);
-         findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetReceiver00);
-      }
-      if (receiver10)
-      {
-         lMin1X2 = minHalfX2;
-         lMax1X2 = maxX2 - 1;
-         lMin1X3 = minX3;
-         lMax1X3 = maxHalfX3;
-         getLocalMinMax(dummy, dummy, lMin1X3, dummy, lMax1X2, dummy);
-         findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetReceiver10);
-      }
-      if (receiver01)
-      {
-         lMin1X2 = minX2;
-         lMax1X2 = maxHalfX2;
-         lMin1X3 = minHalfX3;
-         lMax1X3 = maxX3 - 1;
-         getLocalMinMax(dummy, lMin1X2, dummy, dummy, dummy, lMax1X3);
-         findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetReceiver01);
-      }
-      if (receiver11)
-      {
-         lMin1X2 = minHalfX2;
-         lMax1X2 = maxX2 - 1;
-         lMin1X3 = minHalfX3;
-         lMax1X3 = maxX3 - 1;
-         getLocalMinMax(dummy, dummy, dummy, dummy, lMax1X2, lMax1X3);
-         findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetReceiver11);
-      }
-      break;
-   case N: case S:
-      if (sendDir == N)
-      {
-         lMin1X2 = maxX2 - 3;
-         lMax1X2 = lMin1X2;
-      }
-      else if (sendDir == S)
-      {
-         lMin1X2 = 3;
-         lMax1X2 = lMin1X2;
-      }
-
-      if (receiver00)
-      {
-         lMin1X1 = minX1;
-         lMax1X1 = maxHalfX1;
-         lMin1X3 = minX3;
-         lMax1X3 = maxHalfX3;
-         findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetReceiver00);
-      }
-      if (receiver10)
-      {
-         lMin1X1 = minHalfX1;
-         lMax1X1 = maxX1 - 1;
-         lMin1X3 = minX3;
-         lMax1X3 = maxHalfX3;
-         findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetReceiver10);
-      }
-      if (receiver01)
-      {
-         lMin1X1 = minX1;
-         lMax1X1 = maxHalfX1;
-         lMin1X3 = minHalfX3;
-         lMax1X3 = maxX3 - 1;
-         findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetReceiver01);
-      }
-      if (receiver11)
-      {
-         lMin1X1 = minHalfX1;
-         lMax1X1 = maxX1 - 1;
-         lMin1X3 = minHalfX3;
-         lMax1X3 = maxX3 - 1;
-         findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetReceiver11);
-      }
-      break;
-   case T: case B:
-      if (sendDir == T)
-      {
-         lMin1X3 = maxX3 - 3;
-         lMax1X3 = lMin1X3;
-      }
-      else if (sendDir == B)
-      {
-         lMin1X3 = 3;
-         lMax1X3 = lMin1X3;
-      }
-
-      if (receiver00)
-      {
-         lMin1X1 = minX1;
-         lMax1X1 = maxHalfX1;
-         lMin1X2 = minX2;
-         lMax1X2 = maxHalfX2;
-         findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetReceiver00);
-      }
-      if (receiver10)
-      {
-         lMin1X1 = minHalfX1;
-         lMax1X1 = maxX1 - 1;
-         lMin1X2 = minX2;
-         lMax1X2 = maxHalfX2;
-         findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetReceiver10);
-      }
-      if (receiver01)
-      {
-         lMin1X1 = minX1;
-         lMax1X1 = maxHalfX1;
-         lMin1X2 = minHalfX2;
-         lMax1X2 = maxX2 - 1;
-         findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetReceiver01);
-      }
-      if (receiver11)
-      {
-         lMin1X1 = minHalfX1;
-         lMax1X1 = maxX1 - 1;
-         lMin1X2 = minHalfX2;
-         lMax1X2 = maxX2 - 1;
-         findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetReceiver11);
-      }
-      break;
-      //edges
-      //N-S-E-W
-   case NE: case SW: case SE: case NW:
-      if (sendDir == NE)
-      {
-         lMin1X1 = maxX1 - 3;
-         lMax1X1 = lMin1X1 + 2;
-         lMin1X2 = maxX2 - 3;
-         lMax1X2 = lMin1X2;
-
-         lMin2X1 = maxX1 - 3;
-         lMax2X1 = lMin2X1;
-         lMin2X2 = maxX2 - 3;
-         lMax2X2 = lMin2X2 + 2;
-      }
-      else if (sendDir == SW)
-      {
-         lMin1X1 = 1;
-         lMax1X1 = lMin1X1 + 2;
-         lMin1X2 = 3;
-         lMax1X2 = lMin1X2;
-
-         lMin2X1 = 3;
-         lMax2X1 = lMin2X1;
-         lMin2X2 = 1;
-         lMax2X2 = lMin2X2 + 2;
-      }
-      else if (sendDir == SE)
-      {
-         lMin1X1 = maxX1 - 3;
-         lMax1X1 = lMin1X1 + 2;
-         lMin1X2 = 3;
-         lMax1X2 = lMin1X2;
-
-         lMin2X1 = maxX1 - 3;
-         lMax2X1 = lMin2X1;
-         lMin2X2 = 1;
-         lMax2X2 = lMin2X2 + 2;
-      }
-      else if (sendDir == NW)
-      {
-         lMin1X1 = 1;
-         lMax1X1 = lMin1X1 + 2;
-         lMin1X2 = maxX2 - 3;
-         lMax1X2 = lMin1X2;
-
-         lMin2X1 = 3;
-         lMax2X1 = lMin2X1;
-         lMin2X2 = maxX2 - 3;
-         lMax2X2 = lMin2X2 + 2;
-      }
-
-      if (receiver00)
-      {
-         lMin1X3 = minX3;
-         lMax1X3 = maxHalfX3;
-         findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetReceiver00);
-      }
-      if (receiver10)
-      {
-         lMin1X3 = minHalfX3;
-         lMax1X3 = maxX3 - 1;
-         findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetReceiver10);
-      }
-
-      if (receiver00)
-      {
-         lMin2X3 = minX3;
-         lMax2X3 = maxHalfX3;
-         findFCCells(lMin2X1, lMin2X2, lMin2X3, lMax2X1, lMax2X2, lMax2X3, iNodeSetReceiver00);
-      }
-      if (receiver10)
-      {
-         lMin2X3 = minHalfX3;
-         lMax2X3 = maxX3 - 1;
-         findFCCells(lMin2X1, lMin2X2, lMin2X3, lMax2X1, lMax2X2, lMax2X3, iNodeSetReceiver10);
-      }
-      break;
-      //T-B-E-W
-   case TE: case BW: case BE: case TW:
-      if (sendDir == TE)
-      {
-         lMin1X1 = maxX1 - 3;
-         lMax1X1 = lMin1X1 + 2;
-         lMin1X3 = maxX3 - 3;
-         lMax1X3 = lMin1X3;
-
-         lMin2X1 = maxX1 - 3;
-         lMax2X1 = lMin2X1;
-         lMin2X3 = maxX3 - 3;
-         lMax2X3 = lMin2X3 + 2;
-      }
-      else if (sendDir == BW)
-      {
-         lMin1X1 = 1;
-         lMax1X1 = lMin1X1 + 2;
-         lMin1X3 = 3;
-         lMax1X3 = lMin1X3;
-
-         lMin2X1 = 3;
-         lMax2X1 = lMin2X1;
-         lMin2X3 = 1;
-         lMax2X3 = lMin2X3 + 2;
-      }
-      else if (sendDir == BE)
-      {
-         lMin1X1 = maxX1 - 3;
-         lMax1X1 = lMin1X1 + 2;
-         lMin1X3 = 3;
-         lMax1X3 = lMin1X3;
-
-
-         lMin2X1 = maxX1 - 3;
-         lMax2X1 = lMin2X1;
-         lMin2X3 = 1;
-         lMax2X3 = lMin2X3 + 2;
-      }
-      else if (sendDir == TW)
-      {
-         lMin1X1 = 1;
-         lMax1X1 = lMin1X1 + 2;
-         lMin1X3 = maxX3 - 3;
-         lMax1X3 = lMin1X3;
-
-         lMin2X1 = 3;
-         lMax2X1 = lMin2X1;
-         lMin2X3 = maxX3 - 3;
-         lMax2X3 = lMin2X3 + 2;
-      }
-
-      if (receiver00)
-      {
-         lMin1X2 = minX2;
-         lMax1X2 = maxHalfX2;
-         findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetReceiver00);
-      }
-      if (receiver10)
-      {
-         lMin1X2 = minHalfX2;
-         lMax1X2 = maxX2 - 1;
-         findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetReceiver10);
-      }
-
-      if (receiver00)
-      {
-         lMin2X2 = minX2;
-         lMax2X2 = maxHalfX2;
-         findFCCells(lMin2X1, lMin2X2, lMin2X3, lMax2X1, lMax2X2, lMax2X3, iNodeSetReceiver00);
-      }
-      if (receiver10)
-      {
-         lMin2X2 = minHalfX2;
-         lMax2X2 = maxX2 - 1;
-         findFCCells(lMin2X1, lMin2X2, lMin2X3, lMax2X1, lMax2X2, lMax2X3, iNodeSetReceiver10);
-      }
-      break;
-      //T-B-N-S
-   case TN: case BS: case BN: case TS:
-      if (sendDir == TN)
-      {
-         lMin1X2 = maxX2 - 3;
-         lMax1X2 = lMin1X2 + 2;
-         lMin1X3 = maxX3 - 3;
-         lMax1X3 = lMin1X3;
-
-         lMin2X2 = maxX2 - 3;
-         lMax2X2 = lMin2X2;
-         lMin2X3 = maxX3 - 3;
-         lMax2X3 = lMin2X3 + 2;
-      }
-      else if (sendDir == BS)
-      {
-         lMin1X2 = 1;
-         lMax1X2 = lMin1X2 + 2;
-         lMin1X3 = 3;
-         lMax1X3 = lMin1X3;
-
-         lMin2X2 = 3;
-         lMax2X2 = lMin2X2;
-         lMin2X3 = 1;
-         lMax2X3 = lMin2X3 + 2;
-      }
-      else if (sendDir == BN)
-      {
-         lMin1X2 = maxX2 - 3;
-         lMax1X2 = lMin1X2 + 2;
-         lMin1X3 = 3;
-         lMax1X3 = lMin1X3;
-
-         lMin2X2 = maxX2 - 3;
-         lMax2X2 = lMin2X2;
-         lMin2X3 = 1;
-         lMax2X3 = lMin2X3 + 2;
-      }
-      else if (sendDir == TS)
-      {
-         lMin1X2 = 1;
-         lMax1X2 = lMin1X2 + 2;
-         lMin1X3 = maxX3 - 3;
-         lMax1X3 = lMin1X3;
-
-         lMin2X2 = 3;
-         lMax2X2 = lMin2X2;
-         lMin2X3 = maxX3 - 3;
-         lMax2X3 = lMin2X3 + 2;
-      }
-
-      if (receiver00)
-      {
-         lMin1X1 = minX1;
-         lMax1X1 = maxHalfX1;
-         findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetReceiver00);
-      }
-      if (receiver10)
-      {
-         lMin1X1 = minHalfX1;
-         lMax1X1 = maxX1 - 1;
-         findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetReceiver10);
-      }
-
-      if (receiver00)
-      {
-         lMin2X1 = minX1;
-         lMax2X1 = maxHalfX1;
-         findFCCells(lMin2X1, lMin2X2, lMin2X3, lMax2X1, lMax2X2, lMax2X3, iNodeSetReceiver00);
-      }
-      if (receiver10)
-      {
-         lMin2X1 = minHalfX1;
-         lMax2X1 = maxX1 - 1;
-         findFCCells(lMin2X1, lMin2X2, lMin2X3, lMax2X1, lMax2X2, lMax2X3, iNodeSetReceiver10);
-      }
-      break;
-      //corners
-   case TNE: case TNW: case TSE: case TSW: case BNE: case BNW: case BSE: case BSW:
-      if (sendDir == TNE)
-      {
-         lMin1X1 = maxX1 - 3;
-         lMax1X1 = maxX1 - 2;
-         lMin1X2 = maxX2 - 3;
-         lMax1X2 = maxX2 - 1;
-         lMin1X3 = maxX3 - 3;
-         lMax1X3 = maxX3 - 1;
-
-         lMin2X1 = maxX1 - 3;
-         lMax2X1 = maxX1 - 1;
-         lMin2X2 = maxX2 - 3;
-         lMax2X2 = maxX2 - 2;
-         lMin2X3 = maxX3 - 3;
-         lMax2X3 = maxX3 - 1;
-
-         lMin3X1 = maxX1 - 3;
-         lMax3X1 = maxX1 - 1;
-         lMin3X2 = maxX2 - 3;
-         lMax3X2 = maxX2 - 1;
-         lMin3X3 = maxX3 - 3;
-         lMax3X3 = maxX3 - 2;
-      }
-      else if (sendDir == TNW)
-      {
-         lMin1X1 = 3;
-         lMax1X1 = 3;
-         lMin1X2 = maxX2 - 3;
-         lMax1X2 = maxX2 - 1;
-         lMin1X3 = maxX3 - 3;
-         lMax1X3 = maxX3 - 1;
-
-         lMin2X1 = 1;
-         lMax2X1 = 3;
-         lMin2X2 = maxX2 - 3;
-         lMax2X2 = maxX2 - 2;
-         lMin2X3 = maxX3 - 3;
-         lMax2X3 = maxX3;
-
-         lMin3X1 = 1;
-         lMax3X1 = 3;
-         lMin3X2 = maxX2 - 3;
-         lMax3X2 = maxX2 - 1;
-         lMin3X3 = maxX3 - 3;
-         lMax3X3 = maxX3 - 2;
-      }
-      else if (sendDir == TSE)
-      {
-         lMin1X1 = maxX1 - 3;
-         lMax1X1 = maxX1 - 2;
-         lMin1X2 = 1;
-         lMax1X2 = 3;
-         lMin1X3 = maxX3 - 3;
-         lMax1X3 = maxX3;
-
-         lMin2X1 = maxX1 - 3;
-         lMax2X1 = maxX1 - 1;
-         lMin2X2 = 3;
-         lMax2X2 = 3;
-         lMin2X3 = maxX3 - 3;
-         lMax2X3 = maxX3;
-
-         lMin3X1 = maxX1 - 3;
-         lMax3X1 = maxX1 - 1;
-         lMin3X2 = 1;
-         lMax3X2 = 3;
-         lMin3X3 = maxX3 - 3;
-         lMax3X3 = maxX3 - 2;
-      }
-      else if (sendDir == TSW)
-      {
-         lMin1X1 = 3;
-         lMax1X1 = 3;
-         lMin1X2 = 1;
-         lMax1X2 = 3;
-         lMin1X3 = maxX3 - 3;
-         lMax1X3 = maxX3 - 1;
-
-         lMin2X1 = 1;
-         lMax2X1 = 3;
-         lMin2X2 = 3;
-         lMax2X2 = 3;
-         lMin2X3 = maxX3 - 3;
-         lMax2X3 = maxX3 - 1;
-
-         lMin3X1 = 1;
-         lMax3X1 = 3;
-         lMin3X2 = 1;
-         lMax3X2 = 3;
-         lMin3X3 = maxX3 - 3;
-         lMax3X3 = maxX3 - 2;
-      }
-      else if (sendDir == BNE)
-      {
-         lMin1X1 = maxX1 - 3;
-         lMax1X1 = maxX1 - 2;
-         lMin1X2 = maxX2 - 3;
-         lMax1X2 = maxX2 - 1;
-         lMin1X3 = 1;
-         lMax1X3 = 3;
-
-         lMin2X1 = maxX1 - 3;
-         lMax2X1 = maxX1 - 1;
-         lMin2X2 = maxX2 - 3;
-         lMax2X2 = maxX2 - 2;
-         lMin2X3 = 1;
-         lMax2X3 = 3;
-
-         lMin3X1 = maxX1 - 3;
-         lMax3X1 = maxX1 - 1;
-         lMin3X2 = maxX2 - 3;
-         lMax3X2 = maxX2 - 1;
-         lMin3X3 = 3;
-         lMax3X3 = 3;
-      }
-      else if (sendDir == BNW)
-      {
-         lMin1X1 = 3;
-         lMax1X1 = 3;
-         lMin1X2 = maxX2 - 3;
-         lMax1X2 = maxX2 - 1;
-         lMin1X3 = 1;
-         lMax1X3 = 3;
-
-         lMin2X1 = 1;
-         lMax2X1 = 3;
-         lMin2X2 = maxX2 - 3;
-         lMax2X2 = maxX2 - 2;
-         lMin2X3 = 1;
-         lMax2X3 = 3;
-
-         lMin3X1 = 1;
-         lMax3X1 = 3;
-         lMin3X2 = maxX2 - 3;
-         lMax3X2 = maxX2 - 1;
-         lMin3X3 = 3;
-         lMax3X3 = 3;
-      }
-      else if (sendDir == BSE)
-      {
-         lMin1X1 = maxX1 - 3;
-         lMax1X1 = maxX1 - 2;
-         lMin1X2 = 1;
-         lMax1X2 = 3;
-         lMin1X3 = 1;
-         lMax1X3 = 3;
-
-         lMin2X1 = maxX1 - 3;
-         lMax2X1 = maxX1 - 1;
-         lMin2X2 = 3;
-         lMax2X2 = 3;
-         lMin2X3 = 1;
-         lMax2X3 = 3;
-
-         lMin3X1 = maxX1 - 3;
-         lMax3X1 = maxX1 - 1;
-         lMin3X2 = 1;
-         lMax3X2 = 3;
-         lMin3X3 = 3;
-         lMax3X3 = 3;
-      }
-      else if (sendDir == BSW)
-      {
-         lMin1X1 = 3;
-         lMax1X1 = 3;
-         lMin1X2 = 1;
-         lMax1X2 = 3;
-         lMin1X3 = 1;
-         lMax1X3 = 3;
-
-         lMin2X1 = 1;
-         lMax2X1 = 3;
-         lMin2X2 = 3;
-         lMax2X2 = 3;
-         lMin2X3 = 1;
-         lMax2X3 = 3;
-
-         lMin3X1 = 1;
-         lMax3X1 = 3;
-         lMin3X2 = 1;
-         lMax3X2 = 3;
-         lMin3X3 = 3;
-         lMax3X3 = 3;
-      }
-      if (receiver00)
-      {
-         findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetReceiver00);
-      }
-      if (receiver00)
-      {
-         findFCCells(lMin2X1, lMin2X2, lMin2X3, lMax2X1, lMax2X2, lMax2X3, iNodeSetReceiver00);
-      }
-      if (receiver00)
-      {
-         findFCCells(lMin3X1, lMin3X2, lMin3X3, lMax3X1, lMax3X2, lMax3X3, iNodeSetReceiver00);
-      }
-      break;
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-//template< typename VectorTransmitter >
-void CoarseToFineNodeSetBlock3DConnector::distributeReceiveVectors()
-{
-   using namespace D3Q27System;
-
-   SPtr<DistributionArray3D>  fTo = block.lock()->getKernel()->getDataSet()->getFdistributions();
-
-   int index00 = 0;
-   int index01 = 0;
-   int index10 = 0;
-   int index11 = 0;
-
-   vector_type& data00 = this->receiver00->getData();
-   vector_type& data01 = this->receiver01->getData();
-   vector_type& data10 = this->receiver10->getData();
-   vector_type& data11 = this->receiver11->getData();
-
-   for(INodeVector inode : iNodeSetReceiver00)
-   {
-      LBMReal icellC[27];
-      this->readICellCfromData(data00, index00, icellC);
-      iprocessor->writeINodeInv(fTo, icellC, inode[0], inode[1], inode[2]);
-   }
-   for(INodeVector inode : iNodeSetReceiver01)
-   {
-      LBMReal icellC[27];
-      this->readICellCfromData(data01, index01, icellC);
-      iprocessor->writeINodeInv(fTo, icellC, inode[0], inode[1], inode[2]);
-   }
-   for(INodeVector inode : iNodeSetReceiver10)
-   {
-      LBMReal icellC[27];
-      this->readICellCfromData(data10, index10, icellC);
-      iprocessor->writeINodeInv(fTo, icellC, inode[0], inode[1], inode[2]);
-   }
-   for(INodeVector inode : iNodeSetReceiver11)
-   {
-      LBMReal icellC[27];
-      this->readICellCfromData(data11, index11, icellC);
-      iprocessor->writeINodeInv(fTo, icellC, inode[0], inode[1], inode[2]);
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-
-void CoarseToFineNodeSetBlock3DConnector::readICellCfromData(vector_type& data, int& index, LBMReal* icellC)
-{
-   for (int i = D3Q27System::STARTF; i < D3Q27System::ENDF+1; i++)
-   {
-      icellC[i] = data[index++];
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-
-void CoarseToFineNodeSetBlock3DConnector::getLocalMinMax(int& minX1, int& minX2, int& minX3, int& maxX1, int& maxX2, int& maxX3)
-{
-   using namespace D3Q27System;
-   int TminX1 = minX1; int TminX2 = minX2; int TminX3 = minX3; int TmaxX1 = maxX1; int TmaxX2 = maxX2; int TmaxX3 = maxX3;
-
-   if (block.lock()->hasInterpolationFlagCF(E))
-   {
-      if (maxX1==TmaxX1) maxX1 -= 2;
-   }
-   if (block.lock()->hasInterpolationFlagCF(W))
-   {
-      if (minX1==TminX1) minX1 += 2;
-   }
-   if (block.lock()->hasInterpolationFlagCF(N))
-   {
-      if (maxX2==TmaxX2)  maxX2 -= 2;
-   }
-   if (block.lock()->hasInterpolationFlagCF(S))
-   {
-      if (minX2==TminX2)  minX2 += 2;
-   }
-   if (block.lock()->hasInterpolationFlagCF(T))
-   {
-      if (maxX3==TmaxX3)  maxX3 -= 2;
-   }
-   if (block.lock()->hasInterpolationFlagCF(B))
-   {
-      if (minX3==TminX3)  minX3 += 2;
-   }
-
-   //E-W-N-S
-   if (block.lock()->hasInterpolationFlagCF(NE) && !block.lock()->hasInterpolationFlagCF(N) && !block.lock()->hasInterpolationFlagCF(E))
-   {
-      if (maxX1==TmaxX1) maxX1 -= 2;
-      if (maxX2==TmaxX2) maxX2 -= 2;
-   }
-   if (block.lock()->hasInterpolationFlagCF(SW) && !block.lock()->hasInterpolationFlagCF(W) && !block.lock()->hasInterpolationFlagCF(S))
-   {
-      if (minX1==TminX1) minX1 += 2;
-      if (minX2==TminX2) minX2 += 2;
-   }
-   if (block.lock()->hasInterpolationFlagCF(SE) && !block.lock()->hasInterpolationFlagCF(E) && !block.lock()->hasInterpolationFlagCF(S))
-   {
-      if (maxX1==TmaxX1) maxX1 -= 2;
-      if (minX2==TminX2) minX2 += 2;
-   }
-   if (block.lock()->hasInterpolationFlagCF(NW) && !block.lock()->hasInterpolationFlagCF(N) && !block.lock()->hasInterpolationFlagCF(W))
-   {
-      if (minX1==TminX1) minX1 += 2;
-      if (maxX2==TmaxX2) maxX2 -= 2;
-   }
-
-   //	////T-B-E-W
-   if (block.lock()->hasInterpolationFlagCF(TE) && !block.lock()->hasInterpolationFlagCF(E) && !block.lock()->hasInterpolationFlagCF(T))
-   {
-      if (maxX1==TmaxX1) maxX1 -= 2;
-      if (maxX3==TmaxX3) maxX3 -= 2;
-   }
-   if (block.lock()->hasInterpolationFlagCF(BW) && !block.lock()->hasInterpolationFlagCF(W) && !block.lock()->hasInterpolationFlagCF(B))
-   {
-      if (minX1==TminX1) minX1 += 2;
-      if (minX3==TminX3) minX3 += 2;
-   }
-   if (block.lock()->hasInterpolationFlagCF(BE) && !block.lock()->hasInterpolationFlagCF(E) && !block.lock()->hasInterpolationFlagCF(B))
-   {
-      if (maxX1==TmaxX1) maxX1 -= 2;
-      if (minX3==TminX3) minX3 += 2;
-   }
-   if (block.lock()->hasInterpolationFlagCF(TW) && !block.lock()->hasInterpolationFlagCF(W) && !block.lock()->hasInterpolationFlagCF(T))
-   {
-      if (minX1==TminX1) minX1 += 2;
-      if (maxX3==TmaxX3) maxX3 -= 2;
-   }
-
-
-   ////T-B-N-S
-   if (block.lock()->hasInterpolationFlagCF(TN) && !block.lock()->hasInterpolationFlagCF(N) && !block.lock()->hasInterpolationFlagCF(T))
-   {
-      if (maxX2==TmaxX2) maxX2 -= 2;
-      if (maxX3==TmaxX3) maxX3 -= 2;
-   }
-   if (block.lock()->hasInterpolationFlagCF(BS) && !block.lock()->hasInterpolationFlagCF(S) && !block.lock()->hasInterpolationFlagCF(B))
-   {
-      if (minX2==TminX2) minX2 += 2;
-      if (minX3==TminX3) minX3 += 2;
-   }
-   if (block.lock()->hasInterpolationFlagCF(BN) && !block.lock()->hasInterpolationFlagCF(N) && !block.lock()->hasInterpolationFlagCF(B))
-   {
-      if (maxX2==TmaxX2) maxX2 -= 2;
-      if (minX3==TminX3) minX3 += 2;
-   }
-   if (block.lock()->hasInterpolationFlagCF(TS) && !block.lock()->hasInterpolationFlagCF(S) && !block.lock()->hasInterpolationFlagCF(T))
-   {
-      if (minX2==TminX2) minX2 += 2;
-      if (maxX3==TmaxX3) maxX3 -= 2;
-   }
-}
-
-
+#include "CoarseToFineNodeSetBlock3DConnector.h"
+#include "DataSet3D.h"
+
+
+////////////////////////////////////////////////////////////////////////////
+CoarseToFineNodeSetBlock3DConnector::CoarseToFineNodeSetBlock3DConnector(SPtr<Block3D> block,
+   VectorTransmitterPtr sender00, VectorTransmitterPtr receiver00,
+   VectorTransmitterPtr sender01, VectorTransmitterPtr receiver01,
+   VectorTransmitterPtr sender10, VectorTransmitterPtr receiver10,
+   VectorTransmitterPtr sender11, VectorTransmitterPtr receiver11,
+   int sendDir, InterpolationProcessorPtr iprocessor) : CoarseToFineBlock3DConnector(block, sender00, receiver00,
+   sender01, receiver01,
+   sender10, receiver10,
+   sender11, receiver11,
+   sendDir, iprocessor)
+{
+}
+//////////////////////////////////////////////////////////////////////////
+void CoarseToFineNodeSetBlock3DConnector::init()
+{
+   bMaxX1 = (int)block.lock()->getKernel()->getDataSet()->getFdistributions()->getNX1();
+   bMaxX2 = (int)block.lock()->getKernel()->getDataSet()->getFdistributions()->getNX2();
+   bMaxX3 = (int)block.lock()->getKernel()->getDataSet()->getFdistributions()->getNX3();
+
+   minX1 = 0;
+   minX2 = 0;
+   minX3 = 0;
+   maxX1 = bMaxX1 - 1;
+   maxX2 = bMaxX2 - 1;
+   maxX3 = bMaxX3 - 1;
+
+   minHalfX1 = 0;
+   minHalfX2 = 0;
+   minHalfX3 = 0;
+
+   maxHalfX1 = 0;
+   maxHalfX2 = 0;
+   maxHalfX3 = 0;
+
+   if (Utilities::isEven(bMaxX1))
+   {
+      minHalfX1 = bMaxX1 / 2 - 1;
+      maxHalfX1 = bMaxX1 / 2 - 1;
+   }
+   else if (Utilities::isOdd(bMaxX1))
+   {
+      minHalfX1 = bMaxX1 / 2;
+      maxHalfX1 = bMaxX1 / 2 - 1;
+   }
+
+   if (Utilities::isEven(bMaxX2))
+   {
+      minHalfX2 = bMaxX2 / 2 - 1;
+      maxHalfX2 = bMaxX2 / 2 - 1;
+   }
+   else if (Utilities::isOdd(bMaxX2))
+   {
+      minHalfX2 = bMaxX2 / 2;
+      maxHalfX2 = bMaxX2 / 2 - 1;
+   }
+
+   if (Utilities::isEven(bMaxX3))
+   {
+      minHalfX3 = bMaxX3 / 2 - 1;
+      maxHalfX3 = bMaxX3 / 2 - 1;
+   }
+   else if (Utilities::isOdd(bMaxX3))
+   {
+      minHalfX3 = bMaxX3 / 2;
+      maxHalfX3 = bMaxX3 / 2 - 1;
+   }
+
+   //int       sendSize = 0;
+   LBMReal initValue = -999.0;
+
+   int sendDataPerNode = 27/*f*/;
+   int iCellSize = 8; //size of interpolation cell
+
+   findCFCells();
+   findFCCells();
+
+   //////////////////////////////////////////////////////
+   //Debug
+   //////////////////////////////////////////////////////
+   if (block.lock()->getGlobalID() == 2234)
+   {
+      int test = 0;
+   }
+
+   if (sender00) sender00->getData().resize(iNodeSetSender00.size()*iCellSize*sendDataPerNode, initValue);
+   else sender00 = VectorTransmitterPtr(new TbLocalTransmitter< CbVector< LBMReal > >());
+   if (sender01)  sender01->getData().resize(iNodeSetSender01.size()*iCellSize*sendDataPerNode, initValue);
+   else sender01 = VectorTransmitterPtr(new TbLocalTransmitter< CbVector< LBMReal > >());
+   if (sender10)  sender10->getData().resize(iNodeSetSender10.size()*iCellSize*sendDataPerNode, initValue);
+   else sender10 = VectorTransmitterPtr(new TbLocalTransmitter< CbVector< LBMReal > >());
+   if (sender11)   sender11->getData().resize(iNodeSetSender11.size()*iCellSize*sendDataPerNode, initValue);
+   else sender11 = VectorTransmitterPtr(new TbLocalTransmitter< CbVector< LBMReal > >());
+
+   if (!receiver00) receiver00 = VectorTransmitterPtr(new TbLocalTransmitter< CbVector< LBMReal > >());
+   if (!receiver01)  receiver01 = VectorTransmitterPtr(new TbLocalTransmitter< CbVector< LBMReal > >());
+   if (!receiver10)  receiver10 = VectorTransmitterPtr(new TbLocalTransmitter< CbVector< LBMReal > >());
+   if (!receiver11)   receiver11 = VectorTransmitterPtr(new TbLocalTransmitter< CbVector< LBMReal > >());
+}
+//////////////////////////////////////////////////////////////////////////
+
+void CoarseToFineNodeSetBlock3DConnector::findCFCells(int lMinX1, int lMinX2, int lMinX3, int lMaxX1, int lMaxX2, int lMaxX3, INodeSet &inodes)
+{
+   int ix1, ix2, ix3;
+   LBMReal x1off, x2off, x3off;
+
+   SPtr<DistributionArray3D>  fFrom = block.lock()->getKernel()->getDataSet()->getFdistributions();
+   SPtr<BCArray3D> bcArray = block.lock()->getKernel()->getBCProcessor()->getBCArray();
+
+   for (ix3 = lMinX3; ix3<=lMaxX3; ix3++)
+   {
+      for (ix2 = lMinX2; ix2<=lMaxX2; ix2++)
+      {
+         for (ix1 = lMinX1; ix1<=lMaxX1; ix1++)
+         {
+            D3Q27ICell icellC;
+
+            int howManySolids = iprocessor->iCellHowManySolids(bcArray, ix1, ix2, ix3);
+
+            if (howManySolids == 0 || howManySolids == 8)
+            {
+               x1off = 0.0;
+               x2off = 0.0;
+               x3off = 0.0;
+            }
+            else
+            {
+               if (!iprocessor->findNeighborICell(bcArray, fFrom, icellC, bMaxX1, bMaxX2, bMaxX3, ix1, ix2, ix3, x1off, x2off, x3off))
+               {
+                  std::string err = "For "+block.lock()->toString()+" x1="+UbSystem::toString(ix1)+", x2=" + UbSystem::toString(ix2)+", x3=" + UbSystem::toString(ix3)+
+                     " interpolation is not implemented for other direction"+
+                     " by using in: "+(std::string)typeid(*this).name()+
+                     " or maybe you have a solid on the block boundary";
+                  UB_THROW(UbException(UB_EXARGS, err));
+               }
+            }
+
+            INodeVector inv;
+            inv.push_back(ix1 + (int)x1off);
+            inv.push_back(ix2 + (int)x2off);
+            inv.push_back(ix3 + (int)x3off);
+            inv.push_back((int)x1off);
+            inv.push_back((int)x2off);
+            inv.push_back((int)x3off);
+            //inodes.insert(inv);
+            inodes.push_back(inv);
+         }
+      }
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+//template< typename VectorTransmitter >
+void CoarseToFineNodeSetBlock3DConnector::findCFCells()
+{
+   using namespace D3Q27System;
+
+   int lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3;
+
+   switch (sendDir)
+   {
+      //faces
+   case E: case W:
+      if (sendDir == E)
+      {
+         lMinX1 = maxX1 - 2;
+         lMaxX1 = lMinX1;
+      }
+      else if (sendDir == W)
+      {
+         lMinX1 = 1;
+         lMaxX1 = lMinX1;
+      }
+
+      if (sender00)
+      {
+         lMinX2 = minX2;
+         lMaxX2 = maxHalfX2;
+         lMinX3 = minX3;
+         lMaxX3 = maxHalfX3;
+         findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetSender00);
+      }
+      if (sender10)
+      {
+         lMinX2 = minHalfX2;
+         lMaxX2 = maxX2 - 1;
+         lMinX3 = minX3;
+         lMaxX3 = maxHalfX3;
+         findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetSender10);
+      }
+      if (sender01)
+      {
+         lMinX2 = minX2;
+         lMaxX2 = maxHalfX2;
+         lMinX3 = minHalfX3;
+         lMaxX3 = maxX3 - 1;
+         findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetSender01);
+      }
+      if (sender11)
+      {
+         lMinX2 = minHalfX2;
+         lMaxX2 = maxX2 - 1;
+         lMinX3 = minHalfX3;
+         lMaxX3 = maxX3 - 1;
+         findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetSender11);
+      }
+      break;
+   case N: case S:
+      if (sendDir == N)
+      {
+         lMinX2 = maxX2 - 2;
+         lMaxX2 = lMinX2;
+      }
+      else if (sendDir == S)
+      {
+         lMinX2 = 1;
+         lMaxX2 = lMinX2;
+      }
+
+      if (sender00)
+      {
+         lMinX1 = minX1;
+         lMaxX1 = maxHalfX1;
+         lMinX3 = minX3;
+         lMaxX3 = maxHalfX3;
+         findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetSender00);
+      }
+      if (sender10)
+      {
+         lMinX1 = minHalfX1;
+         lMaxX1 = maxX1 - 1;
+         lMinX3 = minX3;
+         lMaxX3 = maxHalfX3;
+         findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetSender10);
+      }
+      if (sender01)
+      {
+         lMinX1 = minX1;
+         lMaxX1 = maxHalfX1;
+         lMinX3 = minHalfX3;
+         lMaxX3 = maxX3 - 1;
+         findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetSender01);
+      }
+      if (sender11)
+      {
+         lMinX1 = minHalfX1;
+         lMaxX1 = maxX1 - 1;
+         lMinX3 = minHalfX3;
+         lMaxX3 = maxX3 - 1;
+         findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetSender11);
+      }
+      break;
+   case T: case B:
+      if (sendDir == T)
+      {
+         lMinX3 = maxX3 - 2;
+         lMaxX3 = lMinX3;
+      }
+      else if (sendDir == B)
+      {
+         lMinX3 = 1;
+         lMaxX3 = lMinX3;
+      }
+
+      if (sender00)
+      {
+         lMinX1 = minX1;
+         lMaxX1 = maxHalfX1;
+         lMinX2 = minX2;
+         lMaxX2 = maxHalfX2;
+         findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetSender00);
+      }
+      if (sender10)
+      {
+         lMinX1 = minHalfX1;
+         lMaxX1 = maxX1 - 1;
+         lMinX2 = minX2;
+         lMaxX2 = maxHalfX2;
+         findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetSender10);
+      }
+      if (sender01)
+      {
+         lMinX1 = minX1;
+         lMaxX1 = maxHalfX1;
+         lMinX2 = minHalfX2;
+         lMaxX2 = maxX2 - 1;
+         findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetSender01);
+      }
+      if (sender11)
+      {
+         lMinX1 = minHalfX1;
+         lMaxX1 = maxX1 - 1;
+         lMinX2 = minHalfX2;
+         lMaxX2 = maxX2 - 1;
+         findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetSender11);
+      }
+      break;
+      //edges
+      //N-S-E-W
+   case NE: case SW: case SE: case NW:
+      if (sendDir == NE)
+      {
+         lMinX1 = maxX1 - 2;
+         lMaxX1 = lMinX1 + 1;
+         lMinX2 = maxX2 - 2;
+         lMaxX2 = lMinX2 + 1;
+      }
+      else if (sendDir == SW)
+      {
+         lMinX1 = 0;
+         lMaxX1 = lMinX1 + 1;
+         lMinX2 = 0;
+         lMaxX2 = lMinX2 + 1;
+      }
+      else if (sendDir == SE)
+      {
+         lMinX1 = maxX1 - 2;
+         lMaxX1 = lMinX1 + 1;
+         lMinX2 = 0;
+         lMaxX2 = lMinX2 + 1;
+      }
+      else if (sendDir == NW)
+      {
+         lMinX1 = 0;
+         lMaxX1 = lMinX1 + 1;
+         lMinX2 = maxX2 - 2;
+         lMaxX2 = lMinX2 + 1;
+      }
+
+      if (sender00)
+      {
+         lMinX3 = minX3;
+         lMaxX3 = maxHalfX3;
+         findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetSender00);
+      }
+      if (sender10)
+      {
+         lMinX3 = minHalfX3;
+         lMaxX3 = maxX3 - 1;
+         findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetSender10);
+      }
+      break;
+      //T-B-E-W
+   case TE: case BW: case BE: case TW:
+      if (sendDir == TE)
+      {
+         lMinX1 = maxX1 - 2;
+         lMaxX1 = lMinX1 + 1;
+         lMinX3 = maxX3 - 2;
+         lMaxX3 = lMinX3 + 1;
+      }
+      else if (sendDir == BW)
+      {
+         lMinX1 = 0;
+         lMaxX1 = lMinX1 + 2;
+         lMinX3 = 0;
+         lMaxX3 = lMinX3 + 2;
+      }
+      else if (sendDir == BE)
+      {
+         lMinX1 = maxX1 - 2;
+         lMaxX1 = lMinX1 + 1;
+         lMinX3 = 0;
+         lMaxX3 = lMinX3 + 1;
+      }
+      else if (sendDir == TW)
+      {
+         lMinX1 = 0;
+         lMaxX1 = lMinX1 + 1;
+         lMinX3 = maxX3 - 2;
+         lMaxX3 = lMinX3 + 1;
+      }
+
+      if (sender00)
+      {
+         lMinX2 = minX2;
+         lMaxX2 = maxHalfX2;
+         findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetSender00);
+      }
+      if (sender10)
+      {
+         lMinX2 = minHalfX2;
+         lMaxX2 = maxX2 - 1;
+         findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetSender10);
+      }
+      break;
+      //T-B-N-S
+   case TN: case BS: case BN: case TS:
+      if (sendDir == TN)
+      {
+         lMinX2 = maxX2 - 2;
+         lMaxX2 = lMinX2 + 1;
+         lMinX3 = maxX3 - 3;
+         lMaxX3 = lMinX3 + 1;
+      }
+      else if (sendDir == BS)
+      {
+         lMinX2 = 0;
+         lMaxX2 = lMinX2 + 1;
+         lMinX3 = 0;
+         lMaxX3 = lMinX3 + 1;
+      }
+      else if (sendDir == BN)
+      {
+         lMinX2 = maxX2 - 2;
+         lMaxX2 = lMinX2 + 1;
+         lMinX3 = 0;
+         lMaxX3 = lMinX3 + 1;
+      }
+      else if (sendDir == TS)
+      {
+         lMinX2 = 0;
+         lMaxX2 = lMinX2 + 1;
+         lMinX3 = maxX3 - 2;
+         lMaxX3 = lMinX3 + 1;
+      }
+
+      if (sender00)
+      {
+         lMinX1 = minX1;
+         lMaxX1 = maxHalfX1;
+         findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetSender00);
+      }
+      if (sender10)
+      {
+         lMinX1 = minHalfX1;
+         lMaxX1 = maxX1 - 1;
+         findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetSender10);
+      }
+      break;
+      //corners
+   case TNE: case TNW: case TSE: case TSW: case BNE: case BNW: case BSE: case BSW:
+      if (sendDir == TNE)
+      {
+         lMinX1 = maxX1-2;
+         lMaxX1 = maxX1-1;
+         lMinX2 = maxX2-2;
+         lMaxX2 = maxX2-1;
+         lMinX3 = maxX3-2;
+         lMaxX3 = maxX3-1;
+      }
+      else if (sendDir == TNW)
+      {
+         lMinX1 = 0;
+         lMaxX1 = 1;
+         lMinX2 = maxX2-2;
+         lMaxX2 = maxX2-1;
+         lMinX3 = maxX3-2;
+         lMaxX3 = maxX3-1;
+      }
+      else if (sendDir == TSE)
+      {
+         lMinX1 = maxX1-2;
+         lMaxX1 = maxX1-1;
+         lMinX2 = 0;
+         lMaxX2 = 1;
+         lMinX3 = maxX3-2;
+         lMaxX3 = maxX3-1;
+      }
+      else if (sendDir == TSW)
+      {
+         lMinX1 = 0;
+         lMaxX1 = 1;
+         lMinX2 = 0;
+         lMaxX2 = 1;
+         lMinX3 = maxX3-2;
+         lMaxX3 = maxX3-1;
+      }
+      else if (sendDir == BNE)
+      {
+         lMinX1 = maxX1-2;
+         lMaxX1 = maxX1-1;
+         lMinX2 = maxX2-2;
+         lMaxX2 = maxX2-1;
+         lMinX3 = 0;
+         lMaxX3 = 1;
+      }
+      else if (sendDir == BNW)
+      {
+         lMinX1 = 0;
+         lMaxX1 = 1;
+         lMinX2 = maxX2-2;
+         lMaxX2 = maxX2-1;
+         lMinX3 = 0;
+         lMaxX3 = 1;
+      }
+      else if (sendDir == BSE)
+      {
+         lMinX1 = maxX1-2;
+         lMaxX1 = maxX1-1;
+         lMinX2 = 0;
+         lMaxX2 = 1;
+         lMinX3 = 0;
+         lMaxX3 = 1;
+      }
+      else if (sendDir == BSW)
+      {
+         lMinX1 = 0;
+         lMaxX1 = 1;
+         lMinX2 = 0;
+         lMaxX2 = 1;
+         lMinX3 = 0;
+         lMaxX3 = 1;
+      }
+      if (sender00)
+      {
+         findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetSender00);
+      }
+      break;
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+//template< typename VectorTransmitter >
+void CoarseToFineNodeSetBlock3DConnector::fillSendVectors()
+{
+   using namespace D3Q27System;
+
+   SPtr<DistributionArray3D>  fFrom = block.lock()->getKernel()->getDataSet()->getFdistributions();
+
+   int index00 = 0;
+   int index01 = 0;
+   int index10 = 0;
+   int index11 = 0;
+
+   vector_type& data00 = this->sender00->getData();
+   vector_type& data01 = this->sender01->getData();
+   vector_type& data10 = this->sender10->getData();
+   vector_type& data11 = this->sender11->getData();
+
+   for(INodeVector inode : iNodeSetSender00)
+   {
+      D3Q27ICell icellC;
+      D3Q27ICell icellF;
+      iprocessor->readICell(fFrom, icellC, inode[0], inode[1], inode[2]);
+      iprocessor->interpolateCoarseToFine(icellC, icellF, inode[3], inode[4], inode[5]);
+      writeICellFtoData(data00, index00, icellF);
+   }
+   for(INodeVector inode : iNodeSetSender01)
+   {
+      D3Q27ICell icellC;
+      D3Q27ICell icellF;
+      iprocessor->readICell(fFrom, icellC, inode[0], inode[1], inode[2]);
+      iprocessor->interpolateCoarseToFine(icellC, icellF, inode[3], inode[4], inode[5]);
+      writeICellFtoData(data01, index01, icellF);
+   }
+   for(INodeVector inode : iNodeSetSender10)
+   {
+      D3Q27ICell icellC;
+      D3Q27ICell icellF;
+      iprocessor->readICell(fFrom, icellC, inode[0], inode[1], inode[2]);
+      iprocessor->interpolateCoarseToFine(icellC, icellF, inode[3], inode[4], inode[5]);
+      writeICellFtoData(data10, index10, icellF);
+   }
+   for(INodeVector inode : iNodeSetSender11)
+   {
+      D3Q27ICell icellC;
+      D3Q27ICell icellF;
+      iprocessor->readICell(fFrom, icellC, inode[0], inode[1], inode[2]);
+      iprocessor->interpolateCoarseToFine(icellC, icellF, inode[3], inode[4], inode[5]);
+      writeICellFtoData(data11, index11, icellF);
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+
+void CoarseToFineNodeSetBlock3DConnector::writeICellFtoData(vector_type& data, int& index, D3Q27ICell& icellF)
+{
+   writeNodeToVector(data, index, icellF.BSW);
+   writeNodeToVector(data, index, icellF.BSE);
+   writeNodeToVector(data, index, icellF.BNW);
+   writeNodeToVector(data, index, icellF.BNE);
+   writeNodeToVector(data, index, icellF.TSW);
+   writeNodeToVector(data, index, icellF.TSE);
+   writeNodeToVector(data, index, icellF.TNW);
+   writeNodeToVector(data, index, icellF.TNE);
+}
+//////////////////////////////////////////////////////////////////////////
+
+void CoarseToFineNodeSetBlock3DConnector::writeNodeToVector(vector_type& data, int& index, LBMReal* inode)
+{
+   for (int i = D3Q27System::STARTF; i < D3Q27System::ENDF+1; i++)
+   {
+      data[index++] = inode[i];
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+
+void CoarseToFineNodeSetBlock3DConnector::findFCCells(int lMinX1, int lMinX2, int lMinX3, int lMaxX1, int lMaxX2, int lMaxX3, INodeSet &inodes)
+{
+   int ix1, ix2, ix3;
+
+   for (ix3 = lMinX3; ix3<=lMaxX3; ix3++)
+   {
+      for (ix2 = lMinX2; ix2<=lMaxX2; ix2++)
+      {
+         for (ix1 = lMinX1; ix1<=lMaxX1; ix1++)
+         {
+            INodeVector inv;
+            inv.push_back(ix1);
+            inv.push_back(ix2);
+            inv.push_back(ix3);
+            //inodes.insert(inv);
+            inodes.push_back(inv);
+         }
+      }
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+//template< typename VectorTransmitter >
+void CoarseToFineNodeSetBlock3DConnector::findFCCells()
+{
+   using namespace D3Q27System;
+
+   int lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3;
+   int lMin2X1, lMin2X2, lMin2X3, lMax2X1, lMax2X2, lMax2X3;
+   int lMin3X1, lMin3X2, lMin3X3, lMax3X1, lMax3X2, lMax3X3;
+   int dummy;
+
+   switch (sendDir)
+   {
+
+      //////////////////////////////////////////////////////
+      //Debug
+      //////////////////////////////////////////////////////
+      // if (block.lock()->getGlobalID() == 2234)
+      // {
+      //    int test = 0;
+      // }
+
+      //faces
+   case E: case W:
+      if (sendDir == E)
+      {
+         lMin1X1 = maxX1 - 3;
+         lMax1X1 = lMin1X1;
+      }
+      else if (sendDir == W)
+      {
+         lMin1X1 = 3;
+         lMax1X1 = lMin1X1;
+      }
+
+      //int TminX1 = lMinX1; int TminX2 = lMinX2; int TminX3 = lMinX3; int TmaxX1 = lMaxX1; int TmaxX2 = lMaxX2; int TmaxX3 = lMaxX3;
+
+      //if (block.lock()->hasInterpolationFlagCF(E))
+      //{
+      //   if (maxX1==TmaxX1) maxX1 -= 2;
+      //}
+      //if (block.lock()->hasInterpolationFlagCF(W))
+      //{
+      //   if (minX1==TminX1) minX1 += 2;
+      //}
+      //if (block.lock()->hasInterpolationFlagCF(N))
+      //{
+      //   if (maxX2==TmaxX2)  maxX2 -= 2;
+      //}
+      //if (block.lock()->hasInterpolationFlagCF(S))
+      //{
+      //   if (minX2==TminX2)  minX2 += 2;
+      //}
+      //if (block.lock()->hasInterpolationFlagCF(T))
+      //{
+      //   if (maxX3==TmaxX3)  maxX3 -= 2;
+      //}
+      //if (block.lock()->hasInterpolationFlagCF(B))
+      //{
+      //   if (minX3==TminX3)  minX3 += 2;
+      //}
+      if (receiver00)
+      {
+         lMin1X2 = minX2;
+         lMax1X2 = maxHalfX2;
+         lMin1X3 = minX3;
+         lMax1X3 = maxHalfX3;
+         getLocalMinMax(dummy, lMin1X2, lMin1X3, dummy, dummy, dummy);
+         findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetReceiver00);
+      }
+      if (receiver10)
+      {
+         lMin1X2 = minHalfX2;
+         lMax1X2 = maxX2 - 1;
+         lMin1X3 = minX3;
+         lMax1X3 = maxHalfX3;
+         getLocalMinMax(dummy, dummy, lMin1X3, dummy, lMax1X2, dummy);
+         findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetReceiver10);
+      }
+      if (receiver01)
+      {
+         lMin1X2 = minX2;
+         lMax1X2 = maxHalfX2;
+         lMin1X3 = minHalfX3;
+         lMax1X3 = maxX3 - 1;
+         getLocalMinMax(dummy, lMin1X2, dummy, dummy, dummy, lMax1X3);
+         findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetReceiver01);
+      }
+      if (receiver11)
+      {
+         lMin1X2 = minHalfX2;
+         lMax1X2 = maxX2 - 1;
+         lMin1X3 = minHalfX3;
+         lMax1X3 = maxX3 - 1;
+         getLocalMinMax(dummy, dummy, dummy, dummy, lMax1X2, lMax1X3);
+         findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetReceiver11);
+      }
+      break;
+   case N: case S:
+      if (sendDir == N)
+      {
+         lMin1X2 = maxX2 - 3;
+         lMax1X2 = lMin1X2;
+      }
+      else if (sendDir == S)
+      {
+         lMin1X2 = 3;
+         lMax1X2 = lMin1X2;
+      }
+
+      if (receiver00)
+      {
+         lMin1X1 = minX1;
+         lMax1X1 = maxHalfX1;
+         lMin1X3 = minX3;
+         lMax1X3 = maxHalfX3;
+         findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetReceiver00);
+      }
+      if (receiver10)
+      {
+         lMin1X1 = minHalfX1;
+         lMax1X1 = maxX1 - 1;
+         lMin1X3 = minX3;
+         lMax1X3 = maxHalfX3;
+         findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetReceiver10);
+      }
+      if (receiver01)
+      {
+         lMin1X1 = minX1;
+         lMax1X1 = maxHalfX1;
+         lMin1X3 = minHalfX3;
+         lMax1X3 = maxX3 - 1;
+         findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetReceiver01);
+      }
+      if (receiver11)
+      {
+         lMin1X1 = minHalfX1;
+         lMax1X1 = maxX1 - 1;
+         lMin1X3 = minHalfX3;
+         lMax1X3 = maxX3 - 1;
+         findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetReceiver11);
+      }
+      break;
+   case T: case B:
+      if (sendDir == T)
+      {
+         lMin1X3 = maxX3 - 3;
+         lMax1X3 = lMin1X3;
+      }
+      else if (sendDir == B)
+      {
+         lMin1X3 = 3;
+         lMax1X3 = lMin1X3;
+      }
+
+      if (receiver00)
+      {
+         lMin1X1 = minX1;
+         lMax1X1 = maxHalfX1;
+         lMin1X2 = minX2;
+         lMax1X2 = maxHalfX2;
+         findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetReceiver00);
+      }
+      if (receiver10)
+      {
+         lMin1X1 = minHalfX1;
+         lMax1X1 = maxX1 - 1;
+         lMin1X2 = minX2;
+         lMax1X2 = maxHalfX2;
+         findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetReceiver10);
+      }
+      if (receiver01)
+      {
+         lMin1X1 = minX1;
+         lMax1X1 = maxHalfX1;
+         lMin1X2 = minHalfX2;
+         lMax1X2 = maxX2 - 1;
+         findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetReceiver01);
+      }
+      if (receiver11)
+      {
+         lMin1X1 = minHalfX1;
+         lMax1X1 = maxX1 - 1;
+         lMin1X2 = minHalfX2;
+         lMax1X2 = maxX2 - 1;
+         findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetReceiver11);
+      }
+      break;
+      //edges
+      //N-S-E-W
+   case NE: case SW: case SE: case NW:
+      if (sendDir == NE)
+      {
+         lMin1X1 = maxX1 - 3;
+         lMax1X1 = lMin1X1 + 2;
+         lMin1X2 = maxX2 - 3;
+         lMax1X2 = lMin1X2;
+
+         lMin2X1 = maxX1 - 3;
+         lMax2X1 = lMin2X1;
+         lMin2X2 = maxX2 - 3;
+         lMax2X2 = lMin2X2 + 2;
+      }
+      else if (sendDir == SW)
+      {
+         lMin1X1 = 1;
+         lMax1X1 = lMin1X1 + 2;
+         lMin1X2 = 3;
+         lMax1X2 = lMin1X2;
+
+         lMin2X1 = 3;
+         lMax2X1 = lMin2X1;
+         lMin2X2 = 1;
+         lMax2X2 = lMin2X2 + 2;
+      }
+      else if (sendDir == SE)
+      {
+         lMin1X1 = maxX1 - 3;
+         lMax1X1 = lMin1X1 + 2;
+         lMin1X2 = 3;
+         lMax1X2 = lMin1X2;
+
+         lMin2X1 = maxX1 - 3;
+         lMax2X1 = lMin2X1;
+         lMin2X2 = 1;
+         lMax2X2 = lMin2X2 + 2;
+      }
+      else if (sendDir == NW)
+      {
+         lMin1X1 = 1;
+         lMax1X1 = lMin1X1 + 2;
+         lMin1X2 = maxX2 - 3;
+         lMax1X2 = lMin1X2;
+
+         lMin2X1 = 3;
+         lMax2X1 = lMin2X1;
+         lMin2X2 = maxX2 - 3;
+         lMax2X2 = lMin2X2 + 2;
+      }
+
+      if (receiver00)
+      {
+         lMin1X3 = minX3;
+         lMax1X3 = maxHalfX3;
+         findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetReceiver00);
+      }
+      if (receiver10)
+      {
+         lMin1X3 = minHalfX3;
+         lMax1X3 = maxX3 - 1;
+         findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetReceiver10);
+      }
+
+      if (receiver00)
+      {
+         lMin2X3 = minX3;
+         lMax2X3 = maxHalfX3;
+         findFCCells(lMin2X1, lMin2X2, lMin2X3, lMax2X1, lMax2X2, lMax2X3, iNodeSetReceiver00);
+      }
+      if (receiver10)
+      {
+         lMin2X3 = minHalfX3;
+         lMax2X3 = maxX3 - 1;
+         findFCCells(lMin2X1, lMin2X2, lMin2X3, lMax2X1, lMax2X2, lMax2X3, iNodeSetReceiver10);
+      }
+      break;
+      //T-B-E-W
+   case TE: case BW: case BE: case TW:
+      if (sendDir == TE)
+      {
+         lMin1X1 = maxX1 - 3;
+         lMax1X1 = lMin1X1 + 2;
+         lMin1X3 = maxX3 - 3;
+         lMax1X3 = lMin1X3;
+
+         lMin2X1 = maxX1 - 3;
+         lMax2X1 = lMin2X1;
+         lMin2X3 = maxX3 - 3;
+         lMax2X3 = lMin2X3 + 2;
+      }
+      else if (sendDir == BW)
+      {
+         lMin1X1 = 1;
+         lMax1X1 = lMin1X1 + 2;
+         lMin1X3 = 3;
+         lMax1X3 = lMin1X3;
+
+         lMin2X1 = 3;
+         lMax2X1 = lMin2X1;
+         lMin2X3 = 1;
+         lMax2X3 = lMin2X3 + 2;
+      }
+      else if (sendDir == BE)
+      {
+         lMin1X1 = maxX1 - 3;
+         lMax1X1 = lMin1X1 + 2;
+         lMin1X3 = 3;
+         lMax1X3 = lMin1X3;
+
+
+         lMin2X1 = maxX1 - 3;
+         lMax2X1 = lMin2X1;
+         lMin2X3 = 1;
+         lMax2X3 = lMin2X3 + 2;
+      }
+      else if (sendDir == TW)
+      {
+         lMin1X1 = 1;
+         lMax1X1 = lMin1X1 + 2;
+         lMin1X3 = maxX3 - 3;
+         lMax1X3 = lMin1X3;
+
+         lMin2X1 = 3;
+         lMax2X1 = lMin2X1;
+         lMin2X3 = maxX3 - 3;
+         lMax2X3 = lMin2X3 + 2;
+      }
+
+      if (receiver00)
+      {
+         lMin1X2 = minX2;
+         lMax1X2 = maxHalfX2;
+         findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetReceiver00);
+      }
+      if (receiver10)
+      {
+         lMin1X2 = minHalfX2;
+         lMax1X2 = maxX2 - 1;
+         findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetReceiver10);
+      }
+
+      if (receiver00)
+      {
+         lMin2X2 = minX2;
+         lMax2X2 = maxHalfX2;
+         findFCCells(lMin2X1, lMin2X2, lMin2X3, lMax2X1, lMax2X2, lMax2X3, iNodeSetReceiver00);
+      }
+      if (receiver10)
+      {
+         lMin2X2 = minHalfX2;
+         lMax2X2 = maxX2 - 1;
+         findFCCells(lMin2X1, lMin2X2, lMin2X3, lMax2X1, lMax2X2, lMax2X3, iNodeSetReceiver10);
+      }
+      break;
+      //T-B-N-S
+   case TN: case BS: case BN: case TS:
+      if (sendDir == TN)
+      {
+         lMin1X2 = maxX2 - 3;
+         lMax1X2 = lMin1X2 + 2;
+         lMin1X3 = maxX3 - 3;
+         lMax1X3 = lMin1X3;
+
+         lMin2X2 = maxX2 - 3;
+         lMax2X2 = lMin2X2;
+         lMin2X3 = maxX3 - 3;
+         lMax2X3 = lMin2X3 + 2;
+      }
+      else if (sendDir == BS)
+      {
+         lMin1X2 = 1;
+         lMax1X2 = lMin1X2 + 2;
+         lMin1X3 = 3;
+         lMax1X3 = lMin1X3;
+
+         lMin2X2 = 3;
+         lMax2X2 = lMin2X2;
+         lMin2X3 = 1;
+         lMax2X3 = lMin2X3 + 2;
+      }
+      else if (sendDir == BN)
+      {
+         lMin1X2 = maxX2 - 3;
+         lMax1X2 = lMin1X2 + 2;
+         lMin1X3 = 3;
+         lMax1X3 = lMin1X3;
+
+         lMin2X2 = maxX2 - 3;
+         lMax2X2 = lMin2X2;
+         lMin2X3 = 1;
+         lMax2X3 = lMin2X3 + 2;
+      }
+      else if (sendDir == TS)
+      {
+         lMin1X2 = 1;
+         lMax1X2 = lMin1X2 + 2;
+         lMin1X3 = maxX3 - 3;
+         lMax1X3 = lMin1X3;
+
+         lMin2X2 = 3;
+         lMax2X2 = lMin2X2;
+         lMin2X3 = maxX3 - 3;
+         lMax2X3 = lMin2X3 + 2;
+      }
+
+      if (receiver00)
+      {
+         lMin1X1 = minX1;
+         lMax1X1 = maxHalfX1;
+         findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetReceiver00);
+      }
+      if (receiver10)
+      {
+         lMin1X1 = minHalfX1;
+         lMax1X1 = maxX1 - 1;
+         findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetReceiver10);
+      }
+
+      if (receiver00)
+      {
+         lMin2X1 = minX1;
+         lMax2X1 = maxHalfX1;
+         findFCCells(lMin2X1, lMin2X2, lMin2X3, lMax2X1, lMax2X2, lMax2X3, iNodeSetReceiver00);
+      }
+      if (receiver10)
+      {
+         lMin2X1 = minHalfX1;
+         lMax2X1 = maxX1 - 1;
+         findFCCells(lMin2X1, lMin2X2, lMin2X3, lMax2X1, lMax2X2, lMax2X3, iNodeSetReceiver10);
+      }
+      break;
+      //corners
+   case TNE: case TNW: case TSE: case TSW: case BNE: case BNW: case BSE: case BSW:
+      if (sendDir == TNE)
+      {
+         lMin1X1 = maxX1 - 3;
+         lMax1X1 = maxX1 - 2;
+         lMin1X2 = maxX2 - 3;
+         lMax1X2 = maxX2 - 1;
+         lMin1X3 = maxX3 - 3;
+         lMax1X3 = maxX3 - 1;
+
+         lMin2X1 = maxX1 - 3;
+         lMax2X1 = maxX1 - 1;
+         lMin2X2 = maxX2 - 3;
+         lMax2X2 = maxX2 - 2;
+         lMin2X3 = maxX3 - 3;
+         lMax2X3 = maxX3 - 1;
+
+         lMin3X1 = maxX1 - 3;
+         lMax3X1 = maxX1 - 1;
+         lMin3X2 = maxX2 - 3;
+         lMax3X2 = maxX2 - 1;
+         lMin3X3 = maxX3 - 3;
+         lMax3X3 = maxX3 - 2;
+      }
+      else if (sendDir == TNW)
+      {
+         lMin1X1 = 3;
+         lMax1X1 = 3;
+         lMin1X2 = maxX2 - 3;
+         lMax1X2 = maxX2 - 1;
+         lMin1X3 = maxX3 - 3;
+         lMax1X3 = maxX3 - 1;
+
+         lMin2X1 = 1;
+         lMax2X1 = 3;
+         lMin2X2 = maxX2 - 3;
+         lMax2X2 = maxX2 - 2;
+         lMin2X3 = maxX3 - 3;
+         lMax2X3 = maxX3;
+
+         lMin3X1 = 1;
+         lMax3X1 = 3;
+         lMin3X2 = maxX2 - 3;
+         lMax3X2 = maxX2 - 1;
+         lMin3X3 = maxX3 - 3;
+         lMax3X3 = maxX3 - 2;
+      }
+      else if (sendDir == TSE)
+      {
+         lMin1X1 = maxX1 - 3;
+         lMax1X1 = maxX1 - 2;
+         lMin1X2 = 1;
+         lMax1X2 = 3;
+         lMin1X3 = maxX3 - 3;
+         lMax1X3 = maxX3;
+
+         lMin2X1 = maxX1 - 3;
+         lMax2X1 = maxX1 - 1;
+         lMin2X2 = 3;
+         lMax2X2 = 3;
+         lMin2X3 = maxX3 - 3;
+         lMax2X3 = maxX3;
+
+         lMin3X1 = maxX1 - 3;
+         lMax3X1 = maxX1 - 1;
+         lMin3X2 = 1;
+         lMax3X2 = 3;
+         lMin3X3 = maxX3 - 3;
+         lMax3X3 = maxX3 - 2;
+      }
+      else if (sendDir == TSW)
+      {
+         lMin1X1 = 3;
+         lMax1X1 = 3;
+         lMin1X2 = 1;
+         lMax1X2 = 3;
+         lMin1X3 = maxX3 - 3;
+         lMax1X3 = maxX3 - 1;
+
+         lMin2X1 = 1;
+         lMax2X1 = 3;
+         lMin2X2 = 3;
+         lMax2X2 = 3;
+         lMin2X3 = maxX3 - 3;
+         lMax2X3 = maxX3 - 1;
+
+         lMin3X1 = 1;
+         lMax3X1 = 3;
+         lMin3X2 = 1;
+         lMax3X2 = 3;
+         lMin3X3 = maxX3 - 3;
+         lMax3X3 = maxX3 - 2;
+      }
+      else if (sendDir == BNE)
+      {
+         lMin1X1 = maxX1 - 3;
+         lMax1X1 = maxX1 - 2;
+         lMin1X2 = maxX2 - 3;
+         lMax1X2 = maxX2 - 1;
+         lMin1X3 = 1;
+         lMax1X3 = 3;
+
+         lMin2X1 = maxX1 - 3;
+         lMax2X1 = maxX1 - 1;
+         lMin2X2 = maxX2 - 3;
+         lMax2X2 = maxX2 - 2;
+         lMin2X3 = 1;
+         lMax2X3 = 3;
+
+         lMin3X1 = maxX1 - 3;
+         lMax3X1 = maxX1 - 1;
+         lMin3X2 = maxX2 - 3;
+         lMax3X2 = maxX2 - 1;
+         lMin3X3 = 3;
+         lMax3X3 = 3;
+      }
+      else if (sendDir == BNW)
+      {
+         lMin1X1 = 3;
+         lMax1X1 = 3;
+         lMin1X2 = maxX2 - 3;
+         lMax1X2 = maxX2 - 1;
+         lMin1X3 = 1;
+         lMax1X3 = 3;
+
+         lMin2X1 = 1;
+         lMax2X1 = 3;
+         lMin2X2 = maxX2 - 3;
+         lMax2X2 = maxX2 - 2;
+         lMin2X3 = 1;
+         lMax2X3 = 3;
+
+         lMin3X1 = 1;
+         lMax3X1 = 3;
+         lMin3X2 = maxX2 - 3;
+         lMax3X2 = maxX2 - 1;
+         lMin3X3 = 3;
+         lMax3X3 = 3;
+      }
+      else if (sendDir == BSE)
+      {
+         lMin1X1 = maxX1 - 3;
+         lMax1X1 = maxX1 - 2;
+         lMin1X2 = 1;
+         lMax1X2 = 3;
+         lMin1X3 = 1;
+         lMax1X3 = 3;
+
+         lMin2X1 = maxX1 - 3;
+         lMax2X1 = maxX1 - 1;
+         lMin2X2 = 3;
+         lMax2X2 = 3;
+         lMin2X3 = 1;
+         lMax2X3 = 3;
+
+         lMin3X1 = maxX1 - 3;
+         lMax3X1 = maxX1 - 1;
+         lMin3X2 = 1;
+         lMax3X2 = 3;
+         lMin3X3 = 3;
+         lMax3X3 = 3;
+      }
+      else if (sendDir == BSW)
+      {
+         lMin1X1 = 3;
+         lMax1X1 = 3;
+         lMin1X2 = 1;
+         lMax1X2 = 3;
+         lMin1X3 = 1;
+         lMax1X3 = 3;
+
+         lMin2X1 = 1;
+         lMax2X1 = 3;
+         lMin2X2 = 3;
+         lMax2X2 = 3;
+         lMin2X3 = 1;
+         lMax2X3 = 3;
+
+         lMin3X1 = 1;
+         lMax3X1 = 3;
+         lMin3X2 = 1;
+         lMax3X2 = 3;
+         lMin3X3 = 3;
+         lMax3X3 = 3;
+      }
+      if (receiver00)
+      {
+         findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetReceiver00);
+      }
+      if (receiver00)
+      {
+         findFCCells(lMin2X1, lMin2X2, lMin2X3, lMax2X1, lMax2X2, lMax2X3, iNodeSetReceiver00);
+      }
+      if (receiver00)
+      {
+         findFCCells(lMin3X1, lMin3X2, lMin3X3, lMax3X1, lMax3X2, lMax3X3, iNodeSetReceiver00);
+      }
+      break;
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+//template< typename VectorTransmitter >
+void CoarseToFineNodeSetBlock3DConnector::distributeReceiveVectors()
+{
+   using namespace D3Q27System;
+
+   SPtr<DistributionArray3D>  fTo = block.lock()->getKernel()->getDataSet()->getFdistributions();
+
+   int index00 = 0;
+   int index01 = 0;
+   int index10 = 0;
+   int index11 = 0;
+
+   vector_type& data00 = this->receiver00->getData();
+   vector_type& data01 = this->receiver01->getData();
+   vector_type& data10 = this->receiver10->getData();
+   vector_type& data11 = this->receiver11->getData();
+
+   for(INodeVector inode : iNodeSetReceiver00)
+   {
+      LBMReal icellC[27];
+      this->readICellCfromData(data00, index00, icellC);
+      iprocessor->writeINodeInv(fTo, icellC, inode[0], inode[1], inode[2]);
+   }
+   for(INodeVector inode : iNodeSetReceiver01)
+   {
+      LBMReal icellC[27];
+      this->readICellCfromData(data01, index01, icellC);
+      iprocessor->writeINodeInv(fTo, icellC, inode[0], inode[1], inode[2]);
+   }
+   for(INodeVector inode : iNodeSetReceiver10)
+   {
+      LBMReal icellC[27];
+      this->readICellCfromData(data10, index10, icellC);
+      iprocessor->writeINodeInv(fTo, icellC, inode[0], inode[1], inode[2]);
+   }
+   for(INodeVector inode : iNodeSetReceiver11)
+   {
+      LBMReal icellC[27];
+      this->readICellCfromData(data11, index11, icellC);
+      iprocessor->writeINodeInv(fTo, icellC, inode[0], inode[1], inode[2]);
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+
+void CoarseToFineNodeSetBlock3DConnector::readICellCfromData(vector_type& data, int& index, LBMReal* icellC)
+{
+   for (int i = D3Q27System::STARTF; i < D3Q27System::ENDF+1; i++)
+   {
+      icellC[i] = data[index++];
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+
+void CoarseToFineNodeSetBlock3DConnector::getLocalMinMax(int& minX1, int& minX2, int& minX3, int& maxX1, int& maxX2, int& maxX3)
+{
+   using namespace D3Q27System;
+   int TminX1 = minX1; int TminX2 = minX2; int TminX3 = minX3; int TmaxX1 = maxX1; int TmaxX2 = maxX2; int TmaxX3 = maxX3;
+
+   if (block.lock()->hasInterpolationFlagCF(E))
+   {
+      if (maxX1==TmaxX1) maxX1 -= 2;
+   }
+   if (block.lock()->hasInterpolationFlagCF(W))
+   {
+      if (minX1==TminX1) minX1 += 2;
+   }
+   if (block.lock()->hasInterpolationFlagCF(N))
+   {
+      if (maxX2==TmaxX2)  maxX2 -= 2;
+   }
+   if (block.lock()->hasInterpolationFlagCF(S))
+   {
+      if (minX2==TminX2)  minX2 += 2;
+   }
+   if (block.lock()->hasInterpolationFlagCF(T))
+   {
+      if (maxX3==TmaxX3)  maxX3 -= 2;
+   }
+   if (block.lock()->hasInterpolationFlagCF(B))
+   {
+      if (minX3==TminX3)  minX3 += 2;
+   }
+
+   //E-W-N-S
+   if (block.lock()->hasInterpolationFlagCF(NE) && !block.lock()->hasInterpolationFlagCF(N) && !block.lock()->hasInterpolationFlagCF(E))
+   {
+      if (maxX1==TmaxX1) maxX1 -= 2;
+      if (maxX2==TmaxX2) maxX2 -= 2;
+   }
+   if (block.lock()->hasInterpolationFlagCF(SW) && !block.lock()->hasInterpolationFlagCF(W) && !block.lock()->hasInterpolationFlagCF(S))
+   {
+      if (minX1==TminX1) minX1 += 2;
+      if (minX2==TminX2) minX2 += 2;
+   }
+   if (block.lock()->hasInterpolationFlagCF(SE) && !block.lock()->hasInterpolationFlagCF(E) && !block.lock()->hasInterpolationFlagCF(S))
+   {
+      if (maxX1==TmaxX1) maxX1 -= 2;
+      if (minX2==TminX2) minX2 += 2;
+   }
+   if (block.lock()->hasInterpolationFlagCF(NW) && !block.lock()->hasInterpolationFlagCF(N) && !block.lock()->hasInterpolationFlagCF(W))
+   {
+      if (minX1==TminX1) minX1 += 2;
+      if (maxX2==TmaxX2) maxX2 -= 2;
+   }
+
+   //	////T-B-E-W
+   if (block.lock()->hasInterpolationFlagCF(TE) && !block.lock()->hasInterpolationFlagCF(E) && !block.lock()->hasInterpolationFlagCF(T))
+   {
+      if (maxX1==TmaxX1) maxX1 -= 2;
+      if (maxX3==TmaxX3) maxX3 -= 2;
+   }
+   if (block.lock()->hasInterpolationFlagCF(BW) && !block.lock()->hasInterpolationFlagCF(W) && !block.lock()->hasInterpolationFlagCF(B))
+   {
+      if (minX1==TminX1) minX1 += 2;
+      if (minX3==TminX3) minX3 += 2;
+   }
+   if (block.lock()->hasInterpolationFlagCF(BE) && !block.lock()->hasInterpolationFlagCF(E) && !block.lock()->hasInterpolationFlagCF(B))
+   {
+      if (maxX1==TmaxX1) maxX1 -= 2;
+      if (minX3==TminX3) minX3 += 2;
+   }
+   if (block.lock()->hasInterpolationFlagCF(TW) && !block.lock()->hasInterpolationFlagCF(W) && !block.lock()->hasInterpolationFlagCF(T))
+   {
+      if (minX1==TminX1) minX1 += 2;
+      if (maxX3==TmaxX3) maxX3 -= 2;
+   }
+
+
+   ////T-B-N-S
+   if (block.lock()->hasInterpolationFlagCF(TN) && !block.lock()->hasInterpolationFlagCF(N) && !block.lock()->hasInterpolationFlagCF(T))
+   {
+      if (maxX2==TmaxX2) maxX2 -= 2;
+      if (maxX3==TmaxX3) maxX3 -= 2;
+   }
+   if (block.lock()->hasInterpolationFlagCF(BS) && !block.lock()->hasInterpolationFlagCF(S) && !block.lock()->hasInterpolationFlagCF(B))
+   {
+      if (minX2==TminX2) minX2 += 2;
+      if (minX3==TminX3) minX3 += 2;
+   }
+   if (block.lock()->hasInterpolationFlagCF(BN) && !block.lock()->hasInterpolationFlagCF(N) && !block.lock()->hasInterpolationFlagCF(B))
+   {
+      if (maxX2==TmaxX2) maxX2 -= 2;
+      if (minX3==TminX3) minX3 += 2;
+   }
+   if (block.lock()->hasInterpolationFlagCF(TS) && !block.lock()->hasInterpolationFlagCF(S) && !block.lock()->hasInterpolationFlagCF(T))
+   {
+      if (minX2==TminX2) minX2 += 2;
+      if (maxX3==TmaxX3) maxX3 -= 2;
+   }
+}
+
+
diff --git a/src/cpu/VirtualFluidsCore/Connectors/CoarseToFineNodeSetBlock3DConnector.h b/src/cpu/VirtualFluidsCore/Connectors/CoarseToFineNodeSetBlock3DConnector.h
index ffa1740a760030c8dbd8f5b5871ff65ae22916d3..a1834c336adb048a20fc9e907b3ebeb957ed1135 100644
--- a/src/cpu/VirtualFluidsCore/Connectors/CoarseToFineNodeSetBlock3DConnector.h
+++ b/src/cpu/VirtualFluidsCore/Connectors/CoarseToFineNodeSetBlock3DConnector.h
@@ -1,103 +1,103 @@
-//! \file CoarseToFineNodeSetBlock3DConnector.h
-//! \class CoarseToFineNodeSetBlock3DConnector
-//! \brief Connector interpolates and sends data from coarse level to fine.  
-//! \author Konstantin Kutscher
-//! \date 18.05.2015
-
-#ifndef CoarseToFineNodeSetBlock3DConnector_H
-#define CoarseToFineNodeSetBlock3DConnector_H
-
-#include <vector>
-#include <set>
-
-//#include "basics/transmitter/TbTransmitter.h"
-//#include "basics/transmitter/TbTransmitterLocal.h"
-//#include "basics/container/CbVector.h"
-#include "CoarseToFineBlock3DConnector.h"
-#include "D3Q27System.h"
-#include "Block3D.h"
-#include "LBMKernel.h"
-#include "BCProcessor.h"
-#include "InterpolationProcessor.h"
-#include "MathUtil.hpp"
-#include "Grid3D.h"
-#include <PointerDefinitions.h>
-
-
-class Block3D;
-
-//daten werden in einen vector (dieser befindet sich im transmitter) kopiert
-//der vector wird via transmitter uebertragen
-//transmitter kann ein lokal, MPI, RCG, CTL oder was auch immer fuer ein
-//transmitter sein, der von Transmitter abgeleitet ist ;-)
-
-
-// send direction:    E<->W     N<->S    T<->B  
-//  ---------          x3       x3        x2    
-// | 01 | 11 |         ^        ^         ^     
-// |----+----|         +-> x2   +->x1     +->x1 
-// | 00 | 10 |                                  
-//  ---------                                   
-
-
-class CoarseToFineNodeSetBlock3DConnector : public CoarseToFineBlock3DConnector
-{
-public:
-   CoarseToFineNodeSetBlock3DConnector(SPtr<Block3D> block,
-      VectorTransmitterPtr sender00, VectorTransmitterPtr receiver00,
-      VectorTransmitterPtr sender01, VectorTransmitterPtr receiver01,
-      VectorTransmitterPtr sender10, VectorTransmitterPtr receiver10,
-      VectorTransmitterPtr sender11, VectorTransmitterPtr receiver11,
-      int sendDir, InterpolationProcessorPtr iprocessor);
-
-   void init();
-
-   void fillSendVectors();
-   void distributeReceiveVectors();
-
-protected:
-   typedef std::vector< int > INodeVector;
-   typedef std::vector < INodeVector > INodeSet;
-   INodeSet  iNodeSetSender00;
-   INodeSet  iNodeSetSender01;
-   INodeSet  iNodeSetSender10;
-   INodeSet  iNodeSetSender11;
-   INodeSet  iNodeSetReceiver00;
-   INodeSet  iNodeSetReceiver01;
-   INodeSet  iNodeSetReceiver10;
-   INodeSet  iNodeSetReceiver11;
-
-   void writeICellFtoData(vector_type& data, int& index, D3Q27ICell& icellF);
-   void writeNodeToVector(vector_type& data, int& index, LBMReal* inode);
-   void readICellCfromData(vector_type& data, int& index, LBMReal* icellC);
-
-   void findCFCells();
-   void findCFCells(int lMinX1, int lMinX2, int lMinX3, int lMaxX1, int lMaxX2, int lMaxX3, INodeSet &inodes);
-
-   void findFCCells();
-   void findFCCells(int lMinX1, int lMinX2, int lMinX3, int lMaxX1, int lMaxX2, int lMaxX3, INodeSet &inodes);
-
-   void getLocalMinMax(int& minX1, int& minX2, int& minX3, int& maxX1, int& maxX2, int& maxX3);
-
-   int bMaxX1, bMaxX2, bMaxX3;
-
-   int minX1;
-   int minX2;
-   int minX3;
-
-   int maxX1;
-   int maxX2;
-   int maxX3;
-
-   int minHalfX1;
-   int minHalfX2;
-   int minHalfX3;
-
-   int maxHalfX1;
-   int maxHalfX2;
-   int maxHalfX3;
-};
-
-
-
-#endif 
+//! \file CoarseToFineNodeSetBlock3DConnector.h
+//! \class CoarseToFineNodeSetBlock3DConnector
+//! \brief Connector interpolates and sends data from coarse level to fine.  
+//! \author Konstantin Kutscher
+//! \date 18.05.2015
+
+#ifndef CoarseToFineNodeSetBlock3DConnector_H
+#define CoarseToFineNodeSetBlock3DConnector_H
+
+#include <vector>
+#include <set>
+
+//#include "basics/transmitter/TbTransmitter.h"
+//#include "basics/transmitter/TbTransmitterLocal.h"
+//#include "basics/container/CbVector.h"
+#include "CoarseToFineBlock3DConnector.h"
+#include "D3Q27System.h"
+#include "Block3D.h"
+#include "LBMKernel.h"
+#include "BCProcessor.h"
+#include "InterpolationProcessor.h"
+#include "MathUtil.hpp"
+#include "Grid3D.h"
+#include <PointerDefinitions.h>
+
+
+class Block3D;
+
+//daten werden in einen vector (dieser befindet sich im transmitter) kopiert
+//der vector wird via transmitter uebertragen
+//transmitter kann ein lokal, MPI, RCG, CTL oder was auch immer fuer ein
+//transmitter sein, der von Transmitter abgeleitet ist ;-)
+
+
+// send direction:    E<->W     N<->S    T<->B  
+//  ---------          x3       x3        x2    
+// | 01 | 11 |         ^        ^         ^     
+// |----+----|         +-> x2   +->x1     +->x1 
+// | 00 | 10 |                                  
+//  ---------                                   
+
+
+class CoarseToFineNodeSetBlock3DConnector : public CoarseToFineBlock3DConnector
+{
+public:
+   CoarseToFineNodeSetBlock3DConnector(SPtr<Block3D> block,
+      VectorTransmitterPtr sender00, VectorTransmitterPtr receiver00,
+      VectorTransmitterPtr sender01, VectorTransmitterPtr receiver01,
+      VectorTransmitterPtr sender10, VectorTransmitterPtr receiver10,
+      VectorTransmitterPtr sender11, VectorTransmitterPtr receiver11,
+      int sendDir, InterpolationProcessorPtr iprocessor);
+
+   void init();
+
+   void fillSendVectors();
+   void distributeReceiveVectors();
+
+protected:
+   typedef std::vector< int > INodeVector;
+   typedef std::vector < INodeVector > INodeSet;
+   INodeSet  iNodeSetSender00;
+   INodeSet  iNodeSetSender01;
+   INodeSet  iNodeSetSender10;
+   INodeSet  iNodeSetSender11;
+   INodeSet  iNodeSetReceiver00;
+   INodeSet  iNodeSetReceiver01;
+   INodeSet  iNodeSetReceiver10;
+   INodeSet  iNodeSetReceiver11;
+
+   void writeICellFtoData(vector_type& data, int& index, D3Q27ICell& icellF);
+   void writeNodeToVector(vector_type& data, int& index, LBMReal* inode);
+   void readICellCfromData(vector_type& data, int& index, LBMReal* icellC);
+
+   void findCFCells();
+   void findCFCells(int lMinX1, int lMinX2, int lMinX3, int lMaxX1, int lMaxX2, int lMaxX3, INodeSet &inodes);
+
+   void findFCCells();
+   void findFCCells(int lMinX1, int lMinX2, int lMinX3, int lMaxX1, int lMaxX2, int lMaxX3, INodeSet &inodes);
+
+   void getLocalMinMax(int& minX1, int& minX2, int& minX3, int& maxX1, int& maxX2, int& maxX3);
+
+   int bMaxX1, bMaxX2, bMaxX3;
+
+   int minX1;
+   int minX2;
+   int minX3;
+
+   int maxX1;
+   int maxX2;
+   int maxX3;
+
+   int minHalfX1;
+   int minHalfX2;
+   int minHalfX3;
+
+   int maxHalfX1;
+   int maxHalfX2;
+   int maxHalfX3;
+};
+
+
+
+#endif 
diff --git a/src/cpu/VirtualFluidsCore/Connectors/ConnectorFactory.h b/src/cpu/VirtualFluidsCore/Connectors/ConnectorFactory.h
index 0e4cf6a3ac066da5cebe63c82fbb50d25a408ae2..cd7bd1a41b0c44fc46118d147c6947098556c7c9 100644
--- a/src/cpu/VirtualFluidsCore/Connectors/ConnectorFactory.h
+++ b/src/cpu/VirtualFluidsCore/Connectors/ConnectorFactory.h
@@ -1,38 +1,38 @@
-#ifndef ConnectorFactory_h__
-#define ConnectorFactory_h__
-
-#include "Block3DConnector.h"
-#include "TransmitterType.h"
-#include "InterpolationProcessor.h"
-#include "FineToCoarseBlock3DConnector.h"
-
-#include <PointerDefinitions.h>
-
-class ConnectorFactory
-{
-public:
-   ConnectorFactory() {};
-   virtual ~ConnectorFactory() {};
-
-   virtual SPtr<Block3DConnector> createSameLevelDirectConnector(SPtr<Block3D> from, SPtr<Block3D> to, int sendDir) = 0;
-   virtual SPtr<Block3DConnector> createSameLevelVectorConnector(SPtr<Block3D> block,
-                                                              VectorTransmitterPtr sender, 
-                                                              VectorTransmitterPtr receiver, 
-                                                              int sendDir) = 0;
-   virtual SPtr<Block3DConnector> createCoarseToFineConnector(SPtr<Block3D> block,
-                                                            VectorTransmitterPtr sender00, VectorTransmitterPtr receiver00,
-                                                            VectorTransmitterPtr sender01, VectorTransmitterPtr receiver01,
-                                                            VectorTransmitterPtr sender10, VectorTransmitterPtr receiver10,
-                                                            VectorTransmitterPtr sender11, VectorTransmitterPtr receiver11,
-                                                            int sendDir, InterpolationProcessorPtr iprocessor) = 0;
-   virtual SPtr<Block3DConnector> createFineToCoarseConnector(SPtr<Block3D> block, 
-                                                           VectorTransmitterPtr sender, 
-                                                           VectorTransmitterPtr receiver, 
-                                                           int sendDir, 
-                                                           InterpolationProcessorPtr iprocessor, 
-                                                           FineToCoarseBlock3DConnector::CFconnectorType connType) = 0;
-
-protected:
-private:
-};
-#endif // ConnectorFactory_h__
+#ifndef ConnectorFactory_h__
+#define ConnectorFactory_h__
+
+#include "Block3DConnector.h"
+#include "TransmitterType.h"
+#include "InterpolationProcessor.h"
+#include "FineToCoarseBlock3DConnector.h"
+
+#include <PointerDefinitions.h>
+
+class ConnectorFactory
+{
+public:
+   ConnectorFactory() {};
+   virtual ~ConnectorFactory() {};
+
+   virtual SPtr<Block3DConnector> createSameLevelDirectConnector(SPtr<Block3D> from, SPtr<Block3D> to, int sendDir) = 0;
+   virtual SPtr<Block3DConnector> createSameLevelVectorConnector(SPtr<Block3D> block,
+                                                              VectorTransmitterPtr sender, 
+                                                              VectorTransmitterPtr receiver, 
+                                                              int sendDir) = 0;
+   virtual SPtr<Block3DConnector> createCoarseToFineConnector(SPtr<Block3D> block,
+                                                            VectorTransmitterPtr sender00, VectorTransmitterPtr receiver00,
+                                                            VectorTransmitterPtr sender01, VectorTransmitterPtr receiver01,
+                                                            VectorTransmitterPtr sender10, VectorTransmitterPtr receiver10,
+                                                            VectorTransmitterPtr sender11, VectorTransmitterPtr receiver11,
+                                                            int sendDir, InterpolationProcessorPtr iprocessor) = 0;
+   virtual SPtr<Block3DConnector> createFineToCoarseConnector(SPtr<Block3D> block, 
+                                                           VectorTransmitterPtr sender, 
+                                                           VectorTransmitterPtr receiver, 
+                                                           int sendDir, 
+                                                           InterpolationProcessorPtr iprocessor, 
+                                                           FineToCoarseBlock3DConnector::CFconnectorType connType) = 0;
+
+protected:
+private:
+};
+#endif // ConnectorFactory_h__
diff --git a/src/cpu/VirtualFluidsCore/Connectors/D3Q27ETCFOffVectorConnector.cpp b/src/cpu/VirtualFluidsCore/Connectors/D3Q27ETCFOffVectorConnector.cpp
index 73c14fb6905a5e2b52e993f6e93e0922bd085ce1..710a8c14b42b88b95b847f9c6e217630655fd875 100644
--- a/src/cpu/VirtualFluidsCore/Connectors/D3Q27ETCFOffVectorConnector.cpp
+++ b/src/cpu/VirtualFluidsCore/Connectors/D3Q27ETCFOffVectorConnector.cpp
@@ -1 +1 @@
-#include "D3Q27ETCFOffVectorConnector.h"
+#include "D3Q27ETCFOffVectorConnector.h"
diff --git a/src/cpu/VirtualFluidsCore/Connectors/D3Q27ETCFOffVectorConnector.h b/src/cpu/VirtualFluidsCore/Connectors/D3Q27ETCFOffVectorConnector.h
index f4a3571ae57563793287eda3e96b224cd4d603bc..a793a47a543fe411f79d584f5db062810aa160eb 100644
--- a/src/cpu/VirtualFluidsCore/Connectors/D3Q27ETCFOffVectorConnector.h
+++ b/src/cpu/VirtualFluidsCore/Connectors/D3Q27ETCFOffVectorConnector.h
@@ -1,1940 +1,1940 @@
-/**
-* @file D3Q27ETCFOffVectorConnector.h
-* @class D3Q27ETCFOffVectorConnector
-* @brief Interpolation from coarse level to fine.
-* @author Kostyantyn Kucher and Ehsan Fard
-* @date 08.06.2011
-*/
-#ifndef D3Q27ETCFOffVectorConnector_H
-#define D3Q27ETCFOffVectorConnector_H
-
-#include <vector>
-
-#include "basics/transmitter/TbTransmitter.h"
-#include "basics/transmitter/TbTransmitterLocal.h"
-#include "basics/container/CbVector.h"
-#include "Block3DConnector.h"
-#include "D3Q27System.h"
-#include "Block3D.h"
-#include "LBMKernel.h"
-#include "InterpolationProcessor.h"
-#include "MathUtil.hpp"
-#include "Grid3D.h"
-#include <PointerDefinitions.h>
-
-#include "D3Q27ETFCOffVectorConnector.h"
-#include "BCProcessor.h"
-
-class Block3D;
-
-//daten werden in einen vector (dieser befindet sich im transmitter) kopiert
-//der vector wird via transmitter uebertragen
-//transmitter kann ein lokal, MPI, RCG, CTL oder was auch immer fuer ein
-//transmitter sein, der von Transmitter abgeleitet ist ;-)
-
-//sendrichtung:    E<->W     N<->S    T<->B
-//  ---------       x3       x3        x2
-// | NW | NE |      ^        ^         ^
-// |----+----|      +-> x2   +->x1     +->x1
-// | SW | SE |     
-//  ---------
-// NW==even-odd, SW==even-even, SE==odd-even, NE==odd-odd
-
-template< typename VectorTransmitter >
-class D3Q27ETCFOffVectorConnector : public Block3DConnector
-{
-public:
-   typedef typename VectorTransmitter::value_type  vector_type;
-   typedef SPtr< VectorTransmitter > VectorTransmitterPtr;
-public:
-   D3Q27ETCFOffVectorConnector(SPtr<Block3D> block,
-      VectorTransmitterPtr senderEvenEvenSW, VectorTransmitterPtr receiverEvenEvenSW,
-      VectorTransmitterPtr senderEvenOddNW, VectorTransmitterPtr receiverEvenOddNW,
-      VectorTransmitterPtr senderOddEvenSE, VectorTransmitterPtr receiverOddEvenSE,
-      VectorTransmitterPtr senderOddOddNE, VectorTransmitterPtr receiverOddOddNE,
-      int sendDir, InterpolationProcessorPtr iprocessor);
-
-   bool isLocalConnector();
-   bool isRemoteConnector();
-   void init();
-
-   void sendTransmitterDataSize();
-   void receiveTransmitterDataSize();
-
-   void prepareForSend();
-   void sendVectors();
-
-   void prepareForReceive();
-   void receiveVectors();
-
-   void fillSendVectors();
-   void distributeReceiveVectors();
-
-   bool isInterpolationConnectorCF() { return true; }
-   bool isInterpolationConnectorFC() { return false; }
-
-   double getSendRecieveTime();
-
-   void prepareForSendX1() {}
-   void prepareForSendX2() {}
-   void prepareForSendX3() {}
-
-   void sendVectorsX1() {}
-   void sendVectorsX2() {}
-   void sendVectorsX3() {}
-
-   void prepareForReceiveX1() {}
-   void prepareForReceiveX2() {}
-   void prepareForReceiveX3() {}
-
-   void receiveVectorsX1() {}
-   void receiveVectorsX2() {}
-   void receiveVectorsX3() {}
-
-protected:
-   WPtr<Block3D> block; //dieser nvd sendet daten und die empfangenen werden diesem nvd zugeordnet
-   VectorTransmitterPtr senderEvenEvenSW, receiverEvenEvenSW,
-      senderEvenOddNW, receiverEvenOddNW,
-      senderOddEvenSE, receiverOddEvenSE,
-      senderOddOddNE, receiverOddOddNE;
-
-   InterpolationProcessorPtr iprocessor;
-
-   void writeICellFtoData(vector_type& data, int& index, D3Q27ICell& icellF);
-   void writeNodeToVector(vector_type& data, int& index, LBMReal* inode);
-   void getLocalMinMax(const int& gMin, const int& gMax, const bool& even, int& lMin, int& lMax, const bool& dataDistribution);
-   void getLocalMinMax(int& minX1, int& minX2, int& minX3, int& maxX1, int& maxX2, int& maxX3);
-   void getLocalMinMax(int& minX1, int& minX2, int& minX3, int& maxX1, int& maxX2, int& maxX3, CFconnectorType connType);
-   void fillSendVectorExt(SPtr<DistributionArray3D> fFrom, const int& lMinX1, const int& lMinX2, const int& lMinX3, const int& lMaxX1, const int& lMaxX2, const int& lMaxX3, vector_type& data, int& index);
-
-   void distributeReceiveVector(SPtr<DistributionArray3D> fTo, const int& lMinX1, const int& lMinX2, const int& lMinX3, const int& lMaxX1, const int& lMaxX2, const int& lMaxX3, vector_type& data, int& index);
-   void readICellCfromData(vector_type& data, int& index, LBMReal* icellC);
-
-   void findCFnodes();
-   void findCFnodes(SPtr<DistributionArray3D> fFrom, const int& lMinX1, const int& lMinX2, const int& lMinX3, const int& lMaxX1, const int& lMaxX2, const int& lMaxX3, vector_type& data, int& index);
-
-   int bMaxX1, bMaxX2, bMaxX3;
-};
-
-////////////////////////////////////////////////////////////////////////////
-template< typename VectorTransmitter >
-D3Q27ETCFOffVectorConnector<VectorTransmitter>::D3Q27ETCFOffVectorConnector(SPtr<Block3D> block,
-   VectorTransmitterPtr senderEvenEvenSW, VectorTransmitterPtr receiverEvenEvenSW,
-   VectorTransmitterPtr senderEvenOddNW, VectorTransmitterPtr receiverEvenOddNW,
-   VectorTransmitterPtr senderOddEvenSE, VectorTransmitterPtr receiverOddEvenSE,
-   VectorTransmitterPtr senderOddOddNE, VectorTransmitterPtr receiverOddOddNE,
-   int sendDir, InterpolationProcessorPtr iprocessor) : Block3DConnector(sendDir)
-   , block(block)
-   , senderEvenEvenSW(senderEvenEvenSW)
-   , senderEvenOddNW(senderEvenOddNW)
-   , senderOddEvenSE(senderOddEvenSE)
-   , senderOddOddNE(senderOddOddNE)
-   , receiverEvenEvenSW(receiverEvenEvenSW)
-   , receiverEvenOddNW(receiverEvenOddNW)
-   , receiverOddEvenSE(receiverOddEvenSE)
-   , receiverOddOddNE(receiverOddOddNE)
-   , iprocessor(iprocessor)
-{
-   if (!(sendDir == D3Q27System::E || sendDir == D3Q27System::W || sendDir == D3Q27System::N || sendDir == D3Q27System::S || sendDir == D3Q27System::T || sendDir == D3Q27System::B
-      || sendDir == D3Q27System::NE || sendDir == D3Q27System::SW || sendDir == D3Q27System::SE || sendDir == D3Q27System::NW
-      || sendDir == D3Q27System::TE || sendDir == D3Q27System::BW || sendDir == D3Q27System::BE || sendDir == D3Q27System::TW
-      || sendDir == D3Q27System::TN || sendDir == D3Q27System::BS || sendDir == D3Q27System::BN || sendDir == D3Q27System::TS
-      || sendDir == D3Q27System::TNE || sendDir == D3Q27System::TNW || sendDir == D3Q27System::TSE || sendDir == D3Q27System::TSW
-      || sendDir == D3Q27System::BNE || sendDir == D3Q27System::BNW || sendDir == D3Q27System::BSE || sendDir == D3Q27System::BSW
-      ))
-   {
-      throw UbException(UB_EXARGS, "invalid constructor for this direction");
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-template< typename VectorTransmitter >
-bool D3Q27ETCFOffVectorConnector<VectorTransmitter>::isLocalConnector()
-{
-   return !this->isRemoteConnector();
-}
-//////////////////////////////////////////////////////////////////////////
-template< typename VectorTransmitter >
-bool D3Q27ETCFOffVectorConnector<VectorTransmitter>::isRemoteConnector()
-{
-   return ((senderOddOddNE && senderOddOddNE->isRemoteTransmitter()) || (receiverOddOddNE && receiverOddOddNE->isRemoteTransmitter())
-      || (senderEvenEvenSW && senderEvenEvenSW->isRemoteTransmitter()) || (receiverEvenEvenSW && receiverEvenEvenSW->isRemoteTransmitter())
-      || (senderEvenOddNW && senderEvenOddNW->isRemoteTransmitter()) || (receiverEvenOddNW && receiverEvenOddNW->isRemoteTransmitter())
-      || (senderOddEvenSE && senderOddEvenSE->isRemoteTransmitter()) || (receiverOddEvenSE && receiverOddEvenSE->isRemoteTransmitter()));
-}
-//////////////////////////////////////////////////////////////////////////
-template< typename VectorTransmitter >
-void D3Q27ETCFOffVectorConnector<VectorTransmitter>::sendTransmitterDataSize()
-{
-   if (senderEvenEvenSW)
-   {
-      UBLOG(logDEBUG5, "D3Q27ETCFOffVectorConnector<VectorTransmitter>::sendTransmitterDataSize()-senderEvenEvenSW " << block.lock()->toString() << " sendDir=" << sendDir);
-      senderEvenEvenSW->sendDataSize();
-   }
-   if (senderEvenOddNW)
-   {
-      UBLOG(logDEBUG5, "D3Q27ETCFOffVectorConnector<VectorTransmitter>::sendTransmitterDataSize()-senderEvenOddNW " << block.lock()->toString() << "sendDir=" << sendDir);
-      senderEvenOddNW->sendDataSize();
-   }
-   if (senderOddEvenSE)
-   {
-      UBLOG(logDEBUG5, "D3Q27ETCFOffVectorConnector<VectorTransmitter>::sendTransmitterDataSize()-senderOddEvenSE " << block.lock()->toString() + "sendDir=" << sendDir);
-      senderOddEvenSE->sendDataSize();
-   }
-   if (senderOddOddNE)
-   {
-      UBLOG(logDEBUG5, "D3Q27ETCFOffVectorConnector<VectorTransmitter>::sendTransmitterDataSize()-senderOddOddNE " << block.lock()->toString() << "sendDir=" << sendDir);
-      senderOddOddNE->sendDataSize();
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-template< typename VectorTransmitter >
-void D3Q27ETCFOffVectorConnector<VectorTransmitter>::receiveTransmitterDataSize()
-{
-   if (receiverEvenEvenSW)
-   {
-      UBLOG(logDEBUG5, "D3Q27ETCFOffVectorConnector<VectorTransmitter>::receiveTransmitterDataSize()-receiverEvenEvenSW " << block.lock()->toString() << "sendDir=" << sendDir);
-      receiverEvenEvenSW->receiveDataSize();
-   }
-   if (receiverEvenOddNW)
-   {
-      UBLOG(logDEBUG5, "D3Q27ETCFOffVectorConnector<VectorTransmitter>::receiveTransmitterDataSize()-receiverEvenOddNW " << block.lock()->toString() << "sendDir=" << sendDir);
-      receiverEvenOddNW->receiveDataSize();
-   }
-   if (receiverOddEvenSE)
-   {
-      UBLOG(logDEBUG5, "D3Q27ETCFOffVectorConnector<VectorTransmitter>::receiveTransmitterDataSize()-receiverOddEvenSE " << block.lock()->toString() << "sendDir=" << sendDir);
-      receiverOddEvenSE->receiveDataSize();
-   }
-   if (receiverOddOddNE)
-   {
-      UBLOG(logDEBUG5, "D3Q27ETCFOffVectorConnector<VectorTransmitter>::receiveTransmitterDataSize()-receiverOddOddNE " << block.lock()->toString() << "sendDir=" << sendDir);
-      receiverOddOddNE->receiveDataSize();
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-template< typename VectorTransmitter >
-void D3Q27ETCFOffVectorConnector<VectorTransmitter>::prepareForSend()
-{
-   if (senderEvenEvenSW) senderEvenEvenSW->prepareForSend();
-   if (senderEvenOddNW) senderEvenOddNW->prepareForSend();
-   if (senderOddEvenSE) senderOddEvenSE->prepareForSend();
-   if (senderOddOddNE) senderOddOddNE->prepareForSend();
-}
-//////////////////////////////////////////////////////////////////////////
-template< typename VectorTransmitter >
-void D3Q27ETCFOffVectorConnector<VectorTransmitter>::sendVectors()
-{
-   if (senderEvenEvenSW) senderEvenEvenSW->sendData();
-   if (senderEvenOddNW) senderEvenOddNW->sendData();
-   if (senderOddEvenSE) senderOddEvenSE->sendData();
-   if (senderOddOddNE) senderOddOddNE->sendData();
-}
-//////////////////////////////////////////////////////////////////////////
-template< typename VectorTransmitter >
-void D3Q27ETCFOffVectorConnector<VectorTransmitter>::prepareForReceive()
-{
-   if (receiverEvenEvenSW) receiverEvenEvenSW->prepareForReceive();
-   if (receiverEvenOddNW) receiverEvenOddNW->prepareForReceive();
-   if (receiverOddEvenSE) receiverOddEvenSE->prepareForReceive();
-   if (receiverOddOddNE) receiverOddOddNE->prepareForReceive();
-}
-//////////////////////////////////////////////////////////////////////////
-template< typename VectorTransmitter >
-void D3Q27ETCFOffVectorConnector<VectorTransmitter>::receiveVectors()
-{
-   if (receiverEvenEvenSW) receiverEvenEvenSW->receiveData();
-   if (receiverEvenOddNW) receiverEvenOddNW->receiveData();
-   if (receiverOddEvenSE) receiverOddEvenSE->receiveData();
-   if (receiverOddOddNE) receiverOddOddNE->receiveData();
-}
-//////////////////////////////////////////////////////////////////////////
-template< typename VectorTransmitter >
-void D3Q27ETCFOffVectorConnector<VectorTransmitter>::init()
-{
-   using namespace D3Q27System;
-
-   bMaxX1 = (int)block.lock()->getKernel()->getDataSet()->getFdistributions()->getNX1();
-   bMaxX2 = (int)block.lock()->getKernel()->getDataSet()->getFdistributions()->getNX2();
-   bMaxX3 = (int)block.lock()->getKernel()->getDataSet()->getFdistributions()->getNX3();
-
-   int       sendSize = 0;
-   LBMReal initValue = -999.0;
-
-   int sendDataPerNode = 27/*f*/;
-   int iCellSize = 8; //size of interpolation cell
-
-   switch (this->sendDir)
-   {
-   case E: case W: sendSize = bMaxX2*bMaxX3*sendDataPerNode*iCellSize; break;
-   case N: case S: sendSize = bMaxX1*bMaxX3*sendDataPerNode*iCellSize; break;
-   case T: case B: sendSize = bMaxX1*bMaxX2*sendDataPerNode*iCellSize; break;
-   case NE: case SW:case SE: case NW: sendSize = 2 * bMaxX3*sendDataPerNode*iCellSize; break;
-   case TE: case BW:case BE: case TW: sendSize = 2 * bMaxX2*sendDataPerNode*iCellSize; break;
-   case TN: case BS:case BN: case TS: sendSize = 2 * bMaxX1*sendDataPerNode*iCellSize; break;
-   case TNE: case TNW:case TSE: case TSW:case BNE: case BNW:case BSE: case BSW: sendSize = 6 * bMaxX1*sendDataPerNode*iCellSize; break;
-   default: throw UbException(UB_EXARGS, "direction not allowed in this constructor");
-   }
-   if (senderEvenEvenSW) senderEvenEvenSW->getData().resize(sendSize, initValue);
-   else senderEvenEvenSW = VectorTransmitterPtr(new TbLocalTransmitter< CbVector< LBMReal > >());
-   if (senderEvenOddNW)  senderEvenOddNW->getData().resize(sendSize, initValue);
-   else senderEvenOddNW = VectorTransmitterPtr(new TbLocalTransmitter< CbVector< LBMReal > >());
-   if (senderOddEvenSE)  senderOddEvenSE->getData().resize(sendSize, initValue);
-   else senderOddEvenSE = VectorTransmitterPtr(new TbLocalTransmitter< CbVector< LBMReal > >());
-   if (senderOddOddNE)   senderOddOddNE->getData().resize(sendSize, initValue);
-   else senderOddOddNE = VectorTransmitterPtr(new TbLocalTransmitter< CbVector< LBMReal > >());
-
-   if (!receiverEvenEvenSW) receiverEvenEvenSW = VectorTransmitterPtr(new TbLocalTransmitter< CbVector< LBMReal > >());
-   if (!receiverEvenOddNW)  receiverEvenOddNW = VectorTransmitterPtr(new TbLocalTransmitter< CbVector< LBMReal > >());
-   if (!receiverOddEvenSE)  receiverOddEvenSE = VectorTransmitterPtr(new TbLocalTransmitter< CbVector< LBMReal > >());
-   if (!receiverOddOddNE)   receiverOddOddNE = VectorTransmitterPtr(new TbLocalTransmitter< CbVector< LBMReal > >());
-
-   //findCFnodes();
-}
-//////////////////////////////////////////////////////////////////////////
-template< typename VectorTransmitter >
-void D3Q27ETCFOffVectorConnector< VectorTransmitter>::fillSendVectors()
-{
-   using namespace D3Q27System;
-
-   SPtr<DistributionArray3D>  fFrom = block.lock()->getKernel()->getDataSet()->getFdistributions();
-   int maxX1 = (int)fFrom->getNX1();
-   int maxX2 = (int)fFrom->getNX2();
-   int maxX3 = (int)fFrom->getNX3();
-   int minX1 = 0;
-   int minX2 = 0;
-   int minX3 = 0;
-
-   int indexEvEv = 0;
-   int indexEvOd = 0;
-   int indexOdEv = 0;
-   int indexOdOd = 0;
-
-   vector_type& dataEvEv = this->senderEvenEvenSW->getData();
-   vector_type& dataEvOd = this->senderEvenOddNW->getData();
-   vector_type& dataOdEv = this->senderOddEvenSE->getData();
-   vector_type& dataOdOd = this->senderOddOddNE->getData();
-
-   int lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3;
-   //int lMinX1_2, lMinX2_2, lMinX3_2, lMaxX1_2, lMaxX2_2, lMaxX3_2;
-
-   //for coners
-   int lMinX1W = 1;
-   int lMaxX1W = 2;
-
-   int lMinX1E = maxX1 - 3;
-   int lMaxX1E = maxX1 - 2;
-
-   int lMinX2S = 1;
-   int lMaxX2S = 2;
-
-   int lMinX2N = maxX2 - 3;
-   int lMaxX2N = maxX2 - 2;
-
-   int lMinX3B = 1;
-   int lMaxX3B = 2;
-
-   int lMinX3T = maxX3 - 3;
-   int lMaxX3T = maxX3 - 2;
-
-
-   switch (sendDir)
-   {
-   case E:
-      lMinX1 = maxX1 - 3;
-      lMaxX1 = lMinX1 + 1;
-
-      getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, false);
-      getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, false);
-      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
-
-      getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, false);
-      getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, false);
-      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvOd, indexEvOd);
-
-      getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, false);
-      getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, false);
-      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
-
-      getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, false);
-      getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, false);
-      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdOd, indexOdOd);
-      break;
-   case W:
-      ///////////////////////////////////////
-      ///DEBUG
-      //if (block.lock()->getGlobalID() == 5780)
-      //{
-      //   int test = 0;
-      //}
-      //////////////
-      lMinX1 = 1;
-      lMaxX1 = lMinX1 + 1;
-
-      getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, false);
-      getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, false);
-      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
-
-      getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, false);
-      getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, false);
-      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvOd, indexEvOd);
-
-      getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, false);
-      getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, false);
-      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
-
-      getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, false);
-      getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, false);
-      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdOd, indexOdOd);
-      break;
-   case N:
-      lMinX2 = maxX2 - 3;
-      lMaxX2 = lMinX2 + 1;
-
-      getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, false);
-      getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, false);
-      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
-
-      getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, false);
-      getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, false);
-      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvOd, indexEvOd);
-
-      getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, false);
-      getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, false);
-      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
-
-      getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, false);
-      getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, false);
-      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdOd, indexOdOd);
-      break;
-   case S:
-      lMinX2 = 1;
-      lMaxX2 = lMinX2 + 1;
-
-      getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, false);
-      getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, false);
-      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
-
-      getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, false);
-      getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, false);
-      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvOd, indexEvOd);
-
-      getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, false);
-      getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, false);
-      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
-
-      getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, false);
-      getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, false);
-      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdOd, indexOdOd);
-      break;
-   case T:
-      lMinX3 = maxX3 - 3;
-      lMaxX3 = lMinX3 + 1;
-
-      getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, false);
-      getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, false);
-      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
-
-      getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, false);
-      getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, false);
-      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvOd, indexEvOd);
-
-      getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, false);
-      getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, false);
-      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
-
-      getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, false);
-      getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, false);
-      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdOd, indexOdOd);
-      break;
-   case B:
-      lMinX3 = 1;
-      lMaxX3 = lMinX3 + 1;
-
-      getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, false);
-      getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, false);
-      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
-
-      getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, false);
-      getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, false);
-      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvOd, indexEvOd);
-
-      getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, false);
-      getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, false);
-      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
-
-      getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, false);
-      getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, false);
-      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdOd, indexOdOd);
-      break;
-      ///N-S-E-W
-   case NE:
-      lMinX1 = maxX1 - 3;
-      lMaxX1 = lMinX1 + 2;
-      lMinX2 = maxX2 - 3;
-      lMaxX2 = lMinX2 + 2;
-
-      getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, false);
-      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
-
-      getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, false);
-      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
-
-      break;
-
-   case SW:
-      lMinX1 = 0;
-      lMaxX1 = lMinX1 + 2;
-      lMinX2 = 0;
-      lMaxX2 = lMinX2 + 2;
-
-      getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, false);
-      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
-
-      getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, false);
-      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
-
-      break;
-
-   case SE:
-      lMinX1 = maxX1 - 3;
-      lMaxX1 = lMinX1 + 2;
-      lMinX2 = 0;
-      lMaxX2 = lMinX2 + 2;
-
-      getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, false);
-      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
-
-      getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, false);
-      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
-
-      break;
-
-   case NW:
-      lMinX1 = 0;
-      lMaxX1 = lMinX1 + 2;
-      lMinX2 = maxX2 - 3;
-      lMaxX2 = lMinX2 + 2;
-
-      getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, false);
-      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
-
-      getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, false);
-      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
-
-      break;
-      /////T-B-E-W
-   case TE:
-      lMinX1 = maxX1 - 3;
-      lMaxX1 = lMinX1 + 2;
-      lMinX3 = maxX3 - 3;
-      lMaxX3 = lMinX3 + 2;
-
-      getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, false);
-      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
-
-      getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, false);
-      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
-
-      break;
-
-   case BW:
-      lMinX1 = 0;
-      lMaxX1 = lMinX1 + 2;
-      lMinX3 = 0;
-      lMaxX3 = lMinX3 + 2;
-
-      getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, false);
-      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
-
-      getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, false);
-      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
-
-      break;
-
-   case BE:
-      lMinX1 = maxX1 - 3;
-      lMaxX1 = lMinX1 + 2;
-      lMinX3 = 0;
-      lMaxX3 = lMinX3 + 2;
-
-      getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, false);
-      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
-
-      getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, false);
-      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
-
-      break;
-
-   case TW:
-      lMinX1 = 0;
-      lMaxX1 = lMinX1 + 2;
-      lMinX3 = maxX3 - 3;
-      lMaxX3 = lMinX3 + 2;
-
-      getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, false);
-      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
-
-      getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, false);
-      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
-
-      break;
-      ////
-      /////T-B-N-S
-   case TN:
-      lMinX2 = maxX2 - 3;
-      lMaxX2 = lMinX2 + 2;
-      lMinX3 = maxX3 - 3;
-      lMaxX3 = lMinX3 + 2;
-
-      getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, false);
-      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
-
-      getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, false);
-      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
-
-      break;
-
-   case BS:
-      lMinX2 = 0;
-      lMaxX2 = lMinX2 + 2;
-      lMinX3 = 0;
-      lMaxX3 = lMinX3 + 2;
-
-      getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, false);
-      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
-
-      getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, false);
-      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
-
-      break;
-
-   case BN:
-      lMinX2 = maxX2 - 3;
-      lMaxX2 = lMinX2 + 2;
-      lMinX3 = 0;
-      lMaxX3 = lMinX3 + 2;
-
-      getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, false);
-      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
-
-      getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, false);
-      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
-
-      break;
-
-   case TS:
-      lMinX2 = 0;
-      lMaxX2 = lMinX2 + 2;
-      lMinX3 = maxX3 - 3;
-      lMaxX3 = lMinX3 + 2;
-
-      getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, false);
-      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
-
-      getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, false);
-      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
-
-      break;
-
-
-      //TNE
-   case TNE:
-      lMinX1 = maxX1 - 3;
-      lMaxX1 = maxX1 - 1;
-      lMinX2 = maxX2 - 3;
-      lMaxX2 = maxX2 - 1;
-      lMinX3 = maxX3 - 3;
-      lMaxX3 = maxX3 - 1;
-
-      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
-      break;
-      //   TNW
-   case TNW:
-      lMinX1 = 0;
-      lMaxX1 = 2;
-      lMinX2 = maxX2 - 3;
-      lMaxX2 = maxX2 - 1;
-      lMinX3 = maxX3 - 3;
-      lMaxX3 = maxX3 - 1;
-
-      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
-      break;
-      //   TSE
-   case TSE:
-      lMinX1 = maxX1 - 3;
-      lMaxX1 = maxX1 - 1;
-      lMinX2 = 0;
-      lMaxX2 = 2;
-      lMinX3 = maxX3 - 3;
-      lMaxX3 = maxX3 - 1;
-
-      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
-      break;
-      //   TSW
-   case TSW:
-      lMinX1 = 0;
-      lMaxX1 = 2;
-      lMinX2 = 0;
-      lMaxX2 = 2;
-      lMinX3 = maxX3 - 3;
-      lMaxX3 = maxX3 - 1;
-
-      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
-      break;
-      //   BNE
-   case BNE:
-      lMinX1 = maxX1 - 3;
-      lMaxX1 = maxX1 - 1;
-      lMinX2 = maxX2 - 3;
-      lMaxX2 = maxX2 - 1;
-      lMinX3 = 0;
-      lMaxX3 = 2;
-
-      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
-      break;
-      //   BNW
-   case BNW:
-      lMinX1 = 0;
-      lMaxX1 = 2;
-      lMinX2 = maxX2 - 3;
-      lMaxX2 = maxX2 - 1;
-      lMinX3 = 0;
-      lMaxX3 = 2;
-
-      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
-      break;
-      //   BSE
-   case BSE:
-      lMinX1 = maxX1 - 3;
-      lMaxX1 = maxX1 - 1;
-      lMinX2 = 0;
-      lMaxX2 = 2;
-      lMinX3 = 0;
-      lMaxX3 = 2;
-
-      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
-      break;
-      //   BSW
-   case BSW:
-      lMinX1 = 0;
-      lMaxX1 = 2;
-      lMinX2 = 0;
-      lMaxX2 = 2;
-      lMinX3 = 0;
-      lMaxX3 = 2;
-
-      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
-      break;
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-template<  typename VectorTransmitter  >
-void D3Q27ETCFOffVectorConnector< VectorTransmitter>::getLocalMinMax(const int& gMin, const int& gMax, const bool& even, int& lMin, int& lMax, const bool& dataDistribution)
-{
-   int halfEven = 0;
-   int halfOdd = 0;
-   int dCoef = 0;
-
-   if (dataDistribution)
-      dCoef = 1;
-
-   if (Utilities::isOdd(gMax))
-   {
-      halfEven = gMax / 2;
-      halfOdd = gMax / 2;
-   }
-   if (Utilities::isEven(gMax))
-   {
-      halfEven = gMax / 2;
-      halfOdd = gMax / 2 - 1 + dCoef;
-   }
-
-   switch (even)
-   {
-   case true:
-      lMin = gMin + dCoef;
-      lMax = lMin + halfEven - dCoef;
-      break;
-   case false:
-      lMin = gMin + halfOdd;
-      lMax = gMax - 1;
-      break;
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-template<  typename VectorTransmitter  >
-void D3Q27ETCFOffVectorConnector< VectorTransmitter>::fillSendVectorExt(SPtr<DistributionArray3D> fFrom, const int& lMinX1, const int& lMinX2, const int& lMinX3, const int& lMaxX1, const int& lMaxX2, const int& lMaxX3, vector_type& data, int& index)
-{
-   if (data.size() == 0) return;
-   int ix1, ix2, ix3;
-   LBMReal xoff, yoff, zoff;
-   SPtr<BCArray3D> bcArray = block.lock()->getKernel()->getBCProcessor()->getBCArray();
-
-   for (ix3 = lMinX3; ix3 < lMaxX3; ix3++)
-   {
-      for (ix2 = lMinX2; ix2 < lMaxX2; ix2++)
-      {
-         for (ix1 = lMinX1; ix1 < lMaxX1; ix1++)
-         {
-            D3Q27ICell icellC;
-            D3Q27ICell icellF;
-
-            int howManySolids = iprocessor->iCellHowManySolids(bcArray, ix1, ix2, ix3);
-
-            if (howManySolids == 0 || howManySolids == 8)
-            {
-               iprocessor->readICell(fFrom, icellC, ix1, ix2, ix3);
-               xoff = 0.0;
-               yoff = 0.0;
-               zoff = 0.0;
-            }
-            else
-            {
-               if (!iprocessor->findNeighborICell(bcArray, fFrom, icellC, bMaxX1, bMaxX2, bMaxX3, ix1, ix2, ix3, xoff, yoff, zoff))
-               {
-                  std::string err = "For " + block.lock()->toString() + " x1=" + UbSystem::toString(ix1) + ", x2=" + UbSystem::toString(ix2) + ", x3=" + UbSystem::toString(ix3) +
-                     " interpolation is not implemented for other direction" +
-                     " by using in: " + (std::string)typeid(*this).name() +
-                     " or maybe you have a solid on the block boundary";
-                  UB_THROW(UbException(UB_EXARGS, err));
-               }
-            }
-
-            iprocessor->interpolateCoarseToFine(icellC, icellF, xoff, yoff, zoff);
-            this->writeICellFtoData(data, index, icellF);
-         }
-      }
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-template<  typename VectorTransmitter  >
-void D3Q27ETCFOffVectorConnector< VectorTransmitter>::writeICellFtoData(vector_type& data, int& index, D3Q27ICell& icellF)
-{
-   writeNodeToVector(data, index, icellF.BSW);
-   writeNodeToVector(data, index, icellF.BSE);
-   writeNodeToVector(data, index, icellF.BNW);
-   writeNodeToVector(data, index, icellF.BNE);
-   writeNodeToVector(data, index, icellF.TSW);
-   writeNodeToVector(data, index, icellF.TSE);
-   writeNodeToVector(data, index, icellF.TNW);
-   writeNodeToVector(data, index, icellF.TNE);
-}
-//////////////////////////////////////////////////////////////////////////
-template<  typename VectorTransmitter  >
-void D3Q27ETCFOffVectorConnector< VectorTransmitter>::writeNodeToVector(vector_type& data, int& index, LBMReal* inode)
-{
-   for (int i = D3Q27System::STARTF; i < D3Q27System::ENDF + 1; i++)
-   {
-      data[index++] = inode[i];
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-template<  typename VectorTransmitter  >
-void D3Q27ETCFOffVectorConnector< VectorTransmitter>::distributeReceiveVectors()
-{
-   using namespace D3Q27System;
-
-   SPtr<DistributionArray3D>  fTo = block.lock()->getKernel()->getDataSet()->getFdistributions();
-   int maxX1 = (int)fTo->getNX1();
-   int maxX2 = (int)fTo->getNX2();
-   int maxX3 = (int)fTo->getNX3();
-   int minX1 = 0;
-   int minX2 = 0;
-   int minX3 = 0;
-
-   int indexEvEv = 0;
-   int indexEvOd = 0;
-   int indexOdEv = 0;
-   int indexOdOd = 0;
-
-   vector_type& dataEvEv = this->receiverEvenEvenSW->getData();
-   vector_type& dataEvOd = this->receiverEvenOddNW->getData();
-   vector_type& dataOdEv = this->receiverOddEvenSE->getData();
-   vector_type& dataOdOd = this->receiverOddOddNE->getData();
-
-   int lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3;
-   int dummy;
-
-   //for coners
-   int lMinX1W = 3;
-   int lMaxX1W = 3;
-
-   int lMinX1E = maxX1 - 3;
-   int lMaxX1E = maxX1 - 2;
-
-   int lMinX2S = 1;
-   int lMaxX2S = 3;
-
-   int lMinX2N = maxX2 - 3;
-   int lMaxX2N = maxX2 - 2;
-
-   int lMinX3B = 1;
-   int lMaxX3B = 3;
-
-   int lMinX3T = maxX3 - 3;
-   int lMaxX3T = maxX3 - 2;
-
-   ///////////////////////////////////////
-   ///DEBUG
-   //if (block.lock()->getGlobalID() == 5780)
-   //{
-   //   int test = 0;
-   //}
-   //////////////
-
-   switch (sendDir)
-   {
-   case E:
-      lMinX1 = maxX1 - 4;
-      lMaxX1 = lMinX1 + 1;
-      getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, true);
-      getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, true);
-      getLocalMinMax(dummy, lMinX2, lMinX3, dummy, dummy, dummy);
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
-
-      getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, true);
-      getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, true);
-      getLocalMinMax(dummy, lMinX2, dummy, dummy, dummy, lMaxX3);
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvOd, indexEvOd);
-
-      getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, true);
-      getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, true);
-      getLocalMinMax(dummy, dummy, lMinX3, dummy, lMaxX2, dummy);
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
-
-      getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, true);
-      getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, true);
-      getLocalMinMax(dummy, dummy, dummy, dummy, lMaxX2, lMaxX3);
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdOd, indexOdOd);
-      break;
-   case W:
-      ///////////////////////////////////////
-      ///DEBUG
-      //if (block.lock()->getGlobalID() == 5780)
-      //{
-      //   int test = 0;
-      //}
-      //////////////
-      lMinX1 = 3;
-      lMaxX1 = lMinX1 + 1;
-      getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, true);
-      getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, true);
-      getLocalMinMax(dummy, lMinX2, lMinX3, dummy, dummy, dummy);
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
-
-      getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, true);
-      getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, true);
-      getLocalMinMax(dummy, lMinX2, dummy, dummy, dummy, lMaxX3);
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvOd, indexEvOd);
-
-      getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, true);
-      getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, true);
-      getLocalMinMax(dummy, dummy, lMinX3, dummy, lMaxX2, dummy);
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
-
-      getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, true);
-      getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, true);
-      getLocalMinMax(dummy, dummy, dummy, dummy, lMaxX2, lMaxX3);
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdOd, indexOdOd);
-      break;
-   case N:
-      lMinX2 = maxX2 - 4;
-      lMaxX2 = lMinX2 + 1;
-      getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, true);
-      getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, true);
-      getLocalMinMax(lMinX1, dummy, lMinX3, dummy, dummy, dummy);
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
-
-      getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, true);
-      getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, true);
-      getLocalMinMax(lMinX1, dummy, dummy, dummy, dummy, lMaxX3);
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvOd, indexEvOd);
-
-      getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, true);
-      getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, true);
-      getLocalMinMax(dummy, dummy, lMinX3, lMaxX1, dummy, dummy);
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
-
-      getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, true);
-      getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, true);
-      getLocalMinMax(dummy, dummy, dummy, lMaxX1, dummy, lMaxX3);
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdOd, indexOdOd);
-      break;
-   case S:
-      lMinX2 = 3;
-      lMaxX2 = lMinX2 + 1;
-      getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, true);
-      getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, true);
-      getLocalMinMax(lMinX1, dummy, lMinX3, dummy, dummy, dummy);
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
-
-      getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, true);
-      getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, true);
-      getLocalMinMax(lMinX1, dummy, dummy, dummy, dummy, lMaxX3);
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvOd, indexEvOd);
-
-      getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, true);
-      getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, true);
-      getLocalMinMax(dummy, dummy, lMinX3, lMaxX1, dummy, dummy);
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
-
-      getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, true);
-      getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, true);
-      getLocalMinMax(dummy, dummy, dummy, lMaxX1, dummy, lMaxX3);
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdOd, indexOdOd);
-      break;
-   case T:
-      lMinX3 = maxX3 - 4;
-      lMaxX3 = lMinX3 + 1;
-      getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, true);
-      getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, true);
-      getLocalMinMax(lMinX1, lMinX2, dummy, dummy, dummy, dummy);
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
-
-      getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, true);
-      getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, true);
-      getLocalMinMax(lMinX1, dummy, dummy, dummy, lMaxX2, dummy);
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvOd, indexEvOd);
-
-      getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, true);
-      getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, true);
-      getLocalMinMax(dummy, lMinX2, dummy, lMaxX1, dummy, dummy);
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
-
-      getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, true);
-      getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, true);
-      getLocalMinMax(dummy, dummy, dummy, lMaxX1, lMaxX2, dummy);
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdOd, indexOdOd);
-      break;
-   case B:
-      lMinX3 = 3;
-      lMaxX3 = lMinX3 + 1;
-      getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, true);
-      getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, true);
-      getLocalMinMax(lMinX1, lMinX2, dummy, dummy, dummy, dummy);
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
-
-      getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, true);
-      getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, true);
-      getLocalMinMax(lMinX1, dummy, dummy, dummy, lMaxX2, dummy);
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvOd, indexEvOd);
-
-      getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, true);
-      getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, true);
-      getLocalMinMax(dummy, lMinX2, dummy, lMaxX1, dummy, dummy);
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
-
-      getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, true);
-      getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, true);
-      getLocalMinMax(dummy, dummy, dummy, lMaxX1, lMaxX2, dummy);
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdOd, indexOdOd);
-      break;
-
-      //	/////E-W-N-S
-   case NE:
-      lMinX1 = maxX1 - 4;
-      lMaxX1 = lMinX1 + 3;
-      lMinX2 = maxX2 - 4;
-      lMaxX2 = lMinX2 + 1;
-      getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, true);
-      getLocalMinMax(dummy, dummy, lMinX3, dummy, dummy, dummy);
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
-
-      getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, true);
-      getLocalMinMax(dummy, dummy, dummy, dummy, dummy, lMaxX3);
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
-
-      lMinX1 = maxX1 - 4;
-      lMaxX1 = lMinX1 + 1;
-      lMinX2 = maxX2 - 4;
-      lMaxX2 = lMinX2 + 3;
-      getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, true);
-      getLocalMinMax(dummy, dummy, lMinX3, dummy, dummy, dummy);
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
-
-      getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, true);
-      getLocalMinMax(dummy, dummy, dummy, dummy, dummy, lMaxX3);
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
-
-      break;
-
-   case SW:
-      lMinX1 = 1;
-      lMaxX1 = lMinX1 + 3;
-      lMinX2 = 3;
-      lMaxX2 = lMinX2 + 1;
-      getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, true);
-      getLocalMinMax(dummy, dummy, lMinX3, dummy, dummy, dummy);
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
-
-      getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, true);
-      getLocalMinMax(dummy, dummy, dummy, dummy, dummy, lMaxX3);
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
-
-      lMinX1 = 3;
-      lMaxX1 = lMinX1 + 1;
-      lMinX2 = 1;
-      lMaxX2 = lMinX2 + 3;
-      getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, true);
-      getLocalMinMax(dummy, dummy, lMinX3, dummy, dummy, dummy);
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
-
-      getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, true);
-      getLocalMinMax(dummy, dummy, dummy, dummy, dummy, lMaxX3);
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
-
-      break;
-
-   case SE:
-      lMinX1 = maxX1 - 4;
-      lMaxX1 = lMinX1 + 3;
-      lMinX2 = 3;
-      lMaxX2 = lMinX2 + 1;
-      getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, true);
-      getLocalMinMax(dummy, dummy, lMinX3, dummy, dummy, dummy);
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
-
-      getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, true);
-      getLocalMinMax(dummy, dummy, dummy, dummy, dummy, lMaxX3);
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
-
-      lMinX1 = maxX1 - 4;
-      lMaxX1 = lMinX1 + 1;
-      lMinX2 = 1;
-      lMaxX2 = lMinX2 + 3;
-      getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, true);
-      getLocalMinMax(dummy, dummy, lMinX3, dummy, dummy, dummy);
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
-
-      getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, true);
-      getLocalMinMax(dummy, dummy, dummy, dummy, dummy, lMaxX3);
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
-
-      break;
-
-   case NW:
-      lMinX1 = 1;
-      lMaxX1 = lMinX1 + 3;
-      lMinX2 = maxX2 - 4;
-      lMaxX2 = lMinX2 + 1;
-      getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, true);
-      getLocalMinMax(dummy, dummy, lMinX3, dummy, dummy, dummy);
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
-
-      getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, true);
-      getLocalMinMax(dummy, dummy, dummy, dummy, dummy, lMaxX3);
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
-
-      lMinX1 = 3;
-      lMaxX1 = lMinX1 + 1;
-      lMinX2 = maxX2 - 4;
-      lMaxX2 = lMinX2 + 3;
-      getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, true);
-      getLocalMinMax(dummy, dummy, lMinX3, dummy, dummy, dummy);
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
-
-      getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, true);
-      getLocalMinMax(dummy, dummy, dummy, dummy, dummy, lMaxX3);
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
-
-      break;
-      //		/////T-B-E-W
-   case TE:
-      lMinX1 = maxX1 - 4;
-      lMaxX1 = lMinX1 + 3;
-      lMinX3 = maxX3 - 4;
-      lMaxX3 = lMinX3 + 1;
-      getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, true);
-      getLocalMinMax(dummy, lMinX2, dummy, dummy, dummy, dummy);
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
-
-      getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, true);
-      getLocalMinMax(dummy, dummy, dummy, dummy, lMaxX2, dummy);
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
-
-      lMinX1 = maxX1 - 4;
-      lMaxX1 = lMinX1 + 1;
-      lMinX3 = maxX3 - 4;
-      lMaxX3 = lMinX3 + 3;
-      getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, true);
-      getLocalMinMax(dummy, lMinX2, dummy, dummy, dummy, dummy);
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
-
-      getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, true);
-      getLocalMinMax(dummy, dummy, dummy, dummy, lMaxX2, dummy);
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
-
-      break;
-
-   case BW:
-      lMinX1 = 1;
-      lMaxX1 = lMinX1 + 3;
-      lMinX3 = 3;
-      lMaxX3 = lMinX3 + 1;
-      getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, true);
-      getLocalMinMax(dummy, lMinX2, dummy, dummy, dummy, dummy);
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
-
-      getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, true);
-      getLocalMinMax(dummy, dummy, dummy, dummy, lMaxX2, dummy);
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
-
-      lMinX1 = 3;
-      lMaxX1 = lMinX1 + 1;
-      lMinX3 = 1;
-      lMaxX3 = lMinX3 + 3;
-      getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, true);
-      getLocalMinMax(dummy, lMinX2, dummy, dummy, dummy, dummy);
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
-
-      getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, true);
-      getLocalMinMax(dummy, dummy, dummy, dummy, lMaxX2, dummy);
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
-
-      break;
-
-   case BE:
-      lMinX1 = maxX1 - 4;
-      lMaxX1 = lMinX1 + 3;
-      lMinX3 = 3;
-      lMaxX3 = lMinX3 + 1;
-      getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, true);
-      getLocalMinMax(dummy, lMinX2, dummy, dummy, dummy, dummy);
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
-
-      getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, true);
-      getLocalMinMax(dummy, dummy, dummy, dummy, lMaxX2, dummy);
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
-
-      lMinX1 = maxX1 - 4;
-      lMaxX1 = lMinX1 + 1;
-      lMinX3 = 1;
-      lMaxX3 = lMinX3 + 3;
-      getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, true);
-      getLocalMinMax(dummy, lMinX2, dummy, dummy, dummy, dummy);
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
-
-      getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, true);
-      getLocalMinMax(dummy, dummy, dummy, dummy, lMaxX2, dummy);
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
-
-      break;
-
-   case TW:
-      lMinX1 = 1;
-      lMaxX1 = lMinX1 + 3;
-      lMinX3 = maxX3 - 4;
-      lMaxX3 = lMinX3 + 1;
-      getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, true);
-      getLocalMinMax(dummy, lMinX2, dummy, dummy, dummy, dummy);
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
-
-      getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, true);
-      getLocalMinMax(dummy, dummy, dummy, dummy, lMaxX2, dummy);
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
-
-      lMinX1 = 3;
-      lMaxX1 = lMinX1 + 1;
-      lMinX3 = maxX3 - 4;
-      lMaxX3 = lMinX3 + 3;
-      getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, true);
-      getLocalMinMax(dummy, lMinX2, dummy, dummy, dummy, dummy);
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
-
-      getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, true);
-      getLocalMinMax(dummy, dummy, dummy, dummy, lMaxX2, dummy);
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
-
-      break;
-
-      /////////////////////////T-N-B-S
-   case TN:
-      lMinX2 = maxX2 - 4;
-      lMaxX2 = lMinX2 + 3;
-      lMinX3 = maxX3 - 4;
-      lMaxX3 = lMinX3 + 1;
-      getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, true);
-      getLocalMinMax(lMinX1, dummy, dummy, dummy, dummy, dummy);
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
-
-      getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, true);
-      getLocalMinMax(dummy, dummy, dummy, lMaxX1, dummy, dummy);
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
-
-      lMinX2 = maxX2 - 4;
-      lMaxX2 = lMinX2 + 1;
-      lMinX3 = maxX3 - 4;
-      lMaxX3 = lMinX3 + 3;
-      getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, true);
-      getLocalMinMax(lMinX1, dummy, dummy, dummy, dummy, dummy);
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
-
-      getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, true);
-      getLocalMinMax(dummy, dummy, dummy, lMaxX1, dummy, dummy);
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
-
-      break;
-
-   case BS:
-      lMinX2 = 1;
-      lMaxX2 = lMinX2 + 3;
-      lMinX3 = 3;
-      lMaxX3 = lMinX3 + 1;
-      getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, true);
-      getLocalMinMax(lMinX1, dummy, dummy, dummy, dummy, dummy);
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
-
-      getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, true);
-      getLocalMinMax(dummy, dummy, dummy, lMaxX1, dummy, dummy);
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
-
-      lMinX2 = 3;
-      lMaxX2 = lMinX2 + 1;
-      lMinX3 = 1;
-      lMaxX3 = lMinX3 + 3;
-      getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, true);
-      getLocalMinMax(lMinX1, dummy, dummy, dummy, dummy, dummy);
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
-
-      getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, true);
-      getLocalMinMax(dummy, dummy, dummy, lMaxX1, dummy, dummy);
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
-
-      break;
-
-
-   case BN:
-      lMinX2 = maxX2 - 4;
-      lMaxX2 = lMinX2 + 3;
-      lMinX3 = 3;
-      lMaxX3 = lMinX3 + 1;
-      getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, true);
-      getLocalMinMax(lMinX1, dummy, dummy, dummy, dummy, dummy);
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
-
-      getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, true);
-      getLocalMinMax(dummy, dummy, dummy, lMaxX1, dummy, dummy);
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
-
-      lMinX2 = maxX2 - 4;
-      lMaxX2 = lMinX2 + 1;
-      lMinX3 = 1;
-      lMaxX3 = lMinX3 + 3;
-      getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, true);
-      getLocalMinMax(lMinX1, dummy, dummy, dummy, dummy, dummy);
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
-
-      getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, true);
-      getLocalMinMax(dummy, dummy, dummy, lMaxX1, dummy, dummy);
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
-
-      break;
-
-   case TS:
-      lMinX2 = 1;
-      lMaxX2 = lMinX2 + 3;
-      lMinX3 = maxX3 - 4;
-      lMaxX3 = lMinX3 + 1;
-      getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, true);
-      getLocalMinMax(lMinX1, dummy, dummy, dummy, dummy, dummy);
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
-
-      getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, true);
-      getLocalMinMax(dummy, dummy, dummy, lMaxX1, dummy, dummy);
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
-
-      lMinX2 = 3;
-      lMaxX2 = lMinX2 + 1;
-      lMinX3 = maxX3 - 4;
-      lMaxX3 = lMinX3 + 3;
-      getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, true);
-      getLocalMinMax(lMinX1, dummy, dummy, dummy, dummy, dummy);
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
-
-      getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, true);
-      getLocalMinMax(dummy, dummy, dummy, lMaxX1, dummy, dummy);
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
-
-      break;
-
-      //TNE
-   case TNE:
-      lMinX1 = maxX1 - 4;
-      lMaxX1 = maxX1 - 3;
-      lMinX2 = maxX2 - 4;
-      lMaxX2 = maxX2 - 1;
-      lMinX3 = maxX3 - 4;
-      lMaxX3 = maxX3 - 1;
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
-
-      lMinX1 = maxX1 - 4;
-      lMaxX1 = maxX1 - 1;
-      lMinX2 = maxX2 - 4;
-      lMaxX2 = maxX2 - 3;
-      lMinX3 = maxX3 - 4;
-      lMaxX3 = maxX3 - 1;
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
-
-      lMinX1 = maxX1 - 4;
-      lMaxX1 = maxX1 - 1;
-      lMinX2 = maxX2 - 4;
-      lMaxX2 = maxX2 - 1;
-      lMinX3 = maxX3 - 4;
-      lMaxX3 = maxX3 - 3;
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
-
-      break;
-      //   TNW
-   case TNW:
-      lMinX1 = 3;
-      lMaxX1 = 4;
-      lMinX2 = maxX2 - 4;
-      lMaxX2 = maxX2 - 1;
-      lMinX3 = maxX3 - 4;
-      lMaxX3 = maxX3 - 1;
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
-
-      lMinX1 = 1;
-      lMaxX1 = 4;
-      lMinX2 = maxX2 - 4;
-      lMaxX2 = maxX2 - 3;
-      lMinX3 = maxX3 - 4;
-      lMaxX3 = maxX3 - 1;
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
-
-      lMinX1 = 1;
-      lMaxX1 = 4;
-      lMinX2 = maxX2 - 4;
-      lMaxX2 = maxX2 - 1;
-      lMinX3 = maxX3 - 4;
-      lMaxX3 = maxX3 - 3;
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
-
-      break;
-      //   TSE
-   case TSE:
-      lMinX1 = maxX1 - 4;
-      lMaxX1 = maxX1 - 3;
-      lMinX2 = 1;
-      lMaxX2 = 4;
-      lMinX3 = maxX3 - 4;
-      lMaxX3 = maxX3 - 1;
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
-
-      lMinX1 = maxX1 - 4;
-      lMaxX1 = maxX1 - 1;
-      lMinX2 = 3;
-      lMaxX2 = 4;
-      lMinX3 = maxX3 - 4;
-      lMaxX3 = maxX3 - 1;
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
-
-      lMinX1 = maxX1 - 4;
-      lMaxX1 = maxX1 - 1;
-      lMinX2 = 1;
-      lMaxX2 = 4;
-      lMinX3 = maxX3 - 4;
-      lMaxX3 = maxX3 - 3;
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
-      break;
-      //   TSW
-   case TSW:
-      lMinX1 = 3;
-      lMaxX1 = 4;
-      lMinX2 = 1;
-      lMaxX2 = 4;
-      lMinX3 = maxX3 - 4;
-      lMaxX3 = maxX3 - 1;
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
-
-      lMinX1 = 1;
-      lMaxX1 = 4;
-      lMinX2 = 3;
-      lMaxX2 = 4;
-      lMinX3 = maxX3 - 4;
-      lMaxX3 = maxX3 - 1;
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
-
-      lMinX1 = 1;
-      lMaxX1 = 4;
-      lMinX2 = 1;
-      lMaxX2 = 4;
-      lMinX3 = maxX3 - 4;
-      lMaxX3 = maxX3 - 3;
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
-      break;
-      //   BNE
-   case BNE:
-      lMinX1 = maxX1 - 4;
-      lMaxX1 = maxX1 - 3;
-      lMinX2 = maxX2 - 4;
-      lMaxX2 = maxX2 - 1;
-      lMinX3 = 1;
-      lMaxX3 = 4;
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
-
-      lMinX1 = maxX1 - 4;
-      lMaxX1 = maxX1 - 1;
-      lMinX2 = maxX2 - 4;
-      lMaxX2 = maxX2 - 3;
-      lMinX3 = 1;
-      lMaxX3 = 4;
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
-
-      lMinX1 = maxX1 - 4;
-      lMaxX1 = maxX1 - 1;
-      lMinX2 = maxX2 - 4;
-      lMaxX2 = maxX2 - 1;
-      lMinX3 = 3;
-      lMaxX3 = 4;
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
-
-      break;
-      //   BNW
-   case BNW:
-      lMinX1 = 3;
-      lMaxX1 = 4;
-      lMinX2 = maxX2 - 4;
-      lMaxX2 = maxX2 - 1;
-      lMinX3 = 1;
-      lMaxX3 = 4;
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
-
-      lMinX1 = 1;
-      lMaxX1 = 4;
-      lMinX2 = maxX2 - 4;
-      lMaxX2 = maxX2 - 3;
-      lMinX3 = 1;
-      lMaxX3 = 4;
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
-
-      lMinX1 = 1;
-      lMaxX1 = 4;
-      lMinX2 = maxX2 - 4;
-      lMaxX2 = maxX2 - 1;
-      lMinX3 = 3;
-      lMaxX3 = 4;
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
-      break;
-      //   BSE
-   case BSE:
-      lMinX1 = maxX1 - 4;
-      lMaxX1 = maxX1 - 3;
-      lMinX2 = 1;
-      lMaxX2 = 4;
-      lMinX3 = 1;
-      lMaxX3 = 4;
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
-
-      lMinX1 = maxX1 - 4;
-      lMaxX1 = maxX1 - 1;
-      lMinX2 = 3;
-      lMaxX2 = 4;
-      lMinX3 = 1;
-      lMaxX3 = 4;
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
-
-      lMinX1 = maxX1 - 4;
-      lMaxX1 = maxX1 - 1;
-      lMinX2 = 1;
-      lMaxX2 = 4;
-      lMinX3 = 3;
-      lMaxX3 = 4;
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
-      break;
-      //   BSW
-   case BSW:
-      lMinX1 = 3;
-      lMaxX1 = 4;
-      lMinX2 = 1;
-      lMaxX2 = 4;
-      lMinX3 = 1;
-      lMaxX3 = 4;
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
-
-      lMinX1 = 1;
-      lMaxX1 = 4;
-      lMinX2 = 3;
-      lMaxX2 = 4;
-      lMinX3 = 1;
-      lMaxX3 = 4;
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
-
-      lMinX1 = 1;
-      lMaxX1 = 4;
-      lMinX2 = 1;
-      lMaxX2 = 4;
-      lMinX3 = 3;
-      lMaxX3 = 4;
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
-
-      break;
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-template<  typename VectorTransmitter  >
-void D3Q27ETCFOffVectorConnector< VectorTransmitter>::distributeReceiveVector(SPtr<DistributionArray3D> fTo, const int& lMinX1, const int& lMinX2, const int& lMinX3, const int& lMaxX1, const int& lMaxX2, const int& lMaxX3, vector_type& data, int& index)
-{
-   if (data.size() == 0) return;
-
-   int ix1, ix2, ix3;
-   for (ix3 = lMinX3; ix3 < lMaxX3; ix3++)
-   {
-      for (ix2 = lMinX2; ix2 < lMaxX2; ix2++)
-      {
-         for (ix1 = lMinX1; ix1 < lMaxX1; ix1++)
-         {
-            LBMReal icellC[27];
-            this->readICellCfromData(data, index, icellC);
-            iprocessor->writeINodeInv(fTo, icellC, ix1, ix2, ix3);
-         }
-      }
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-template<  typename VectorTransmitter  >
-void D3Q27ETCFOffVectorConnector< VectorTransmitter>::readICellCfromData(vector_type& data, int& index, LBMReal* icellC)
-{
-   for (int i = D3Q27System::STARTF; i < D3Q27System::ENDF + 1; i++)
-   {
-      icellC[i] = data[index++];
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-template<  typename VectorTransmitter  >
-void D3Q27ETCFOffVectorConnector< VectorTransmitter>::getLocalMinMax(int& minX1, int& minX2, int& minX3, int& maxX1, int& maxX2, int& maxX3)
-{
-   using namespace D3Q27System;
-   int TminX1 = minX1; int TminX2 = minX2; int TminX3 = minX3; int TmaxX1 = maxX1; int TmaxX2 = maxX2; int TmaxX3 = maxX3;
-
-   if (block.lock()->hasInterpolationFlagCF(E))
-   {
-      if (maxX1 == TmaxX1) maxX1 -= 2;
-   }
-   if (block.lock()->hasInterpolationFlagCF(W))
-   {
-      if (minX1 == TminX1) minX1 += 2;
-   }
-   if (block.lock()->hasInterpolationFlagCF(N))
-   {
-      if (maxX2 == TmaxX2)  maxX2 -= 2;
-   }
-   if (block.lock()->hasInterpolationFlagCF(S))
-   {
-      if (minX2 == TminX2)  minX2 += 2;
-   }
-   if (block.lock()->hasInterpolationFlagCF(T))
-   {
-      if (maxX3 == TmaxX3)  maxX3 -= 2;
-   }
-   if (block.lock()->hasInterpolationFlagCF(B))
-   {
-      if (minX3 == TminX3)  minX3 += 2;
-   }
-
-   //E-W-N-S
-   if (block.lock()->hasInterpolationFlagCF(NE) && !block.lock()->hasInterpolationFlagCF(N) && !block.lock()->hasInterpolationFlagCF(E))
-   {
-      if (maxX1 == TmaxX1) maxX1 -= 2;
-      if (maxX2 == TmaxX2) maxX2 -= 2;
-   }
-   if (block.lock()->hasInterpolationFlagCF(SW) && !block.lock()->hasInterpolationFlagCF(W) && !block.lock()->hasInterpolationFlagCF(S))
-   {
-      if (minX1 == TminX1) minX1 += 2;
-      if (minX2 == TminX2) minX2 += 2;
-   }
-   if (block.lock()->hasInterpolationFlagCF(SE) && !block.lock()->hasInterpolationFlagCF(E) && !block.lock()->hasInterpolationFlagCF(S))
-   {
-      if (maxX1 == TmaxX1) maxX1 -= 2;
-      if (minX2 == TminX2) minX2 += 2;
-   }
-   if (block.lock()->hasInterpolationFlagCF(NW) && !block.lock()->hasInterpolationFlagCF(N) && !block.lock()->hasInterpolationFlagCF(W))
-   {
-      if (minX1 == TminX1) minX1 += 2;
-      if (maxX2 == TmaxX2) maxX2 -= 2;
-   }
-
-   //	////T-B-E-W
-   if (block.lock()->hasInterpolationFlagCF(TE) && !block.lock()->hasInterpolationFlagCF(E) && !block.lock()->hasInterpolationFlagCF(T))
-   {
-      if (maxX1 == TmaxX1) maxX1 -= 2;
-      if (maxX3 == TmaxX3) maxX3 -= 2;
-   }
-   if (block.lock()->hasInterpolationFlagCF(BW) && !block.lock()->hasInterpolationFlagCF(W) && !block.lock()->hasInterpolationFlagCF(B))
-   {
-      if (minX1 == TminX1) minX1 += 2;
-      if (minX3 == TminX3) minX3 += 2;
-   }
-   if (block.lock()->hasInterpolationFlagCF(BE) && !block.lock()->hasInterpolationFlagCF(E) && !block.lock()->hasInterpolationFlagCF(B))
-   {
-      if (maxX1 == TmaxX1) maxX1 -= 2;
-      if (minX3 == TminX3) minX3 += 2;
-   }
-   if (block.lock()->hasInterpolationFlagCF(TW) && !block.lock()->hasInterpolationFlagCF(W) && !block.lock()->hasInterpolationFlagCF(T))
-   {
-      if (minX1 == TminX1) minX1 += 2;
-      if (maxX3 == TmaxX3) maxX3 -= 2;
-   }
-
-
-   ////T-B-N-S
-   if (block.lock()->hasInterpolationFlagCF(TN) && !block.lock()->hasInterpolationFlagCF(N) && !block.lock()->hasInterpolationFlagCF(T))
-   {
-      if (maxX2 == TmaxX2) maxX2 -= 2;
-      if (maxX3 == TmaxX3) maxX3 -= 2;
-   }
-   if (block.lock()->hasInterpolationFlagCF(BS) && !block.lock()->hasInterpolationFlagCF(S) && !block.lock()->hasInterpolationFlagCF(B))
-   {
-      if (minX2 == TminX2) minX2 += 2;
-      if (minX3 == TminX3) minX3 += 2;
-   }
-   if (block.lock()->hasInterpolationFlagCF(BN) && !block.lock()->hasInterpolationFlagCF(N) && !block.lock()->hasInterpolationFlagCF(B))
-   {
-      if (maxX2 == TmaxX2) maxX2 -= 2;
-      if (minX3 == TminX3) minX3 += 2;
-   }
-   if (block.lock()->hasInterpolationFlagCF(TS) && !block.lock()->hasInterpolationFlagCF(S) && !block.lock()->hasInterpolationFlagCF(T))
-   {
-      if (minX2 == TminX2) minX2 += 2;
-      if (maxX3 == TmaxX3) maxX3 -= 2;
-   }
-
-   //if (block.lock()->hasInterpolationFlagCF(D3Q27System::TNE)&&!block.lock()->hasInterpolationFlagCF(D3Q27System::TE)&&!block.lock()->hasInterpolationFlagCF(D3Q27System::TN)&&!block.lock()->hasInterpolationFlagCF(D3Q27System::NE)&&!block.lock()->hasInterpolationFlagCF(D3Q27System::T)&&!block.lock()->hasInterpolationFlagCF(D3Q27System::N) && !block.lock()->hasInterpolationFlagCF(D3Q27System::E))
-   //if (!block.lock()->hasInterpolationFlagCF(D3Q27System::TE)&&!block.lock()->hasInterpolationFlagCF(D3Q27System::T)&& !block.lock()->hasInterpolationFlagCF(D3Q27System::E))
-   //{
-   //   if (maxX1==TmaxX1) maxX1 -= 2;
-   //   if (maxX2==TmaxX2) maxX2 -= 2;
-   //   if (maxX3==TmaxX3) maxX3 -= 2;
-   //}
-}
-//////////////////////////////////////////////////////////////////////////
-template< typename VectorTransmitter >
-void D3Q27ETCFOffVectorConnector< VectorTransmitter>::getLocalMinMax(int& minX1, int& minX2, int& minX3, int& maxX1, int& maxX2, int& maxX3, CFconnectorType connType)
-{
-   using namespace D3Q27System;
-   int TminX1 = minX1; int TminX2 = minX2; int TminX3 = minX3; int TmaxX1 = maxX1; int TmaxX2 = maxX2; int TmaxX3 = maxX3;
-
-   if (block.lock()->hasInterpolationFlagCF(E))
-   {
-      if (maxX1 == TmaxX1) maxX1 -= 2;
-   }
-   if (block.lock()->hasInterpolationFlagCF(W))
-   {
-      if (minX1 == TminX1) minX1 += 2;
-   }
-   if (block.lock()->hasInterpolationFlagCF(N))
-   {
-      if (maxX2 == TmaxX2)  maxX2 -= 2;
-   }
-   if (block.lock()->hasInterpolationFlagCF(S))
-   {
-      if (minX2 == TminX2)  minX2 += 2;
-   }
-   if (block.lock()->hasInterpolationFlagCF(T))
-   {
-      if (maxX3 == TmaxX3)  maxX3 -= 2;
-   }
-   if (block.lock()->hasInterpolationFlagCF(B))
-   {
-      if (minX3 == TminX3)  minX3 += 2;
-   }
-
-   //E-W-N-S
-   if (block.lock()->hasInterpolationFlagCF(NE) && !block.lock()->hasInterpolationFlagCF(N) && !block.lock()->hasInterpolationFlagCF(E))
-   {
-      if (maxX1 == TmaxX1) maxX1 -= 2;
-      if (maxX2 == TmaxX2) maxX2 -= 2;
-   }
-   if (block.lock()->hasInterpolationFlagCF(SW) && !block.lock()->hasInterpolationFlagCF(W) && !block.lock()->hasInterpolationFlagCF(S))
-   {
-      if (minX1 == TminX1) minX1 += 2;
-      if (minX2 == TminX2) minX2 += 2;
-   }
-   if (block.lock()->hasInterpolationFlagCF(SE) && !block.lock()->hasInterpolationFlagCF(E) && !block.lock()->hasInterpolationFlagCF(S))
-   {
-      if (maxX1 == TmaxX1) maxX1 -= 2;
-      if (minX2 == TminX2) minX2 += 2;
-   }
-   if (block.lock()->hasInterpolationFlagCF(NW) && !block.lock()->hasInterpolationFlagCF(N) && !block.lock()->hasInterpolationFlagCF(W))
-   {
-      if (minX1 == TminX1) minX1 += 2;
-      if (maxX2 == TmaxX2) maxX2 -= 2;
-   }
-
-   //	////T-B-E-W
-   if (block.lock()->hasInterpolationFlagCF(TE) && !block.lock()->hasInterpolationFlagCF(E) && !block.lock()->hasInterpolationFlagCF(T))
-   {
-      if (maxX1 == TmaxX1) maxX1 -= 2;
-      if (maxX3 == TmaxX3) maxX3 -= 2;
-   }
-   if (block.lock()->hasInterpolationFlagCF(BW) && !block.lock()->hasInterpolationFlagCF(W) && !block.lock()->hasInterpolationFlagCF(B))
-   {
-      if (minX1 == TminX1) minX1 += 2;
-      if (minX3 == TminX3) minX3 += 2;
-   }
-   if (block.lock()->hasInterpolationFlagCF(BE) && !block.lock()->hasInterpolationFlagCF(E) && !block.lock()->hasInterpolationFlagCF(B))
-   {
-      if (maxX1 == TmaxX1) maxX1 -= 2;
-      if (minX3 == TminX3) minX3 += 2;
-   }
-   if (block.lock()->hasInterpolationFlagCF(TW) && !block.lock()->hasInterpolationFlagCF(W) && !block.lock()->hasInterpolationFlagCF(T))
-   {
-      if (minX1 == TminX1) minX1 += 2;
-      if (maxX3 == TmaxX3) maxX3 -= 2;
-   }
-
-
-   ////T-B-N-S
-   if (block.lock()->hasInterpolationFlagCF(TN) && !block.lock()->hasInterpolationFlagCF(N) && !block.lock()->hasInterpolationFlagCF(T))
-   {
-      if (maxX2 == TmaxX2) maxX2 -= 2;
-      if (maxX3 == TmaxX3) maxX3 -= 2;
-   }
-   if (block.lock()->hasInterpolationFlagCF(BS) && !block.lock()->hasInterpolationFlagCF(S) && !block.lock()->hasInterpolationFlagCF(B))
-   {
-      if (minX2 == TminX2) minX2 += 2;
-      if (minX3 == TminX3) minX3 += 2;
-   }
-   if (block.lock()->hasInterpolationFlagCF(BN) && !block.lock()->hasInterpolationFlagCF(N) && !block.lock()->hasInterpolationFlagCF(B))
-   {
-      if (maxX2 == TmaxX2) maxX2 -= 2;
-      if (minX3 == TminX3) minX3 += 2;
-   }
-   if (block.lock()->hasInterpolationFlagCF(TS) && !block.lock()->hasInterpolationFlagCF(S) && !block.lock()->hasInterpolationFlagCF(T))
-   {
-      if (minX2 == TminX2) minX2 += 2;
-      if (maxX3 == TmaxX3) maxX3 -= 2;
-   }
-
-   //if (block.lock()->hasInterpolationFlagCF(D3Q27System::TNE)&&!block.lock()->hasInterpolationFlagCF(D3Q27System::TE)&&!block.lock()->hasInterpolationFlagCF(D3Q27System::TN)&&!block.lock()->hasInterpolationFlagCF(D3Q27System::NE)&&!block.lock()->hasInterpolationFlagCF(D3Q27System::T)&&!block.lock()->hasInterpolationFlagCF(D3Q27System::N) && !block.lock()->hasInterpolationFlagCF(D3Q27System::E))
-   //{
-   //   if (maxX1==TmaxX1) maxX1 -= 2;
-   //   if (maxX2==TmaxX2) maxX2 -= 2;
-   //   if (maxX3==TmaxX3) maxX3 -= 2;
-   //}
-}
-//////////////////////////////////////////////////////////////////////////
-template< typename VectorTransmitter >
-void D3Q27ETCFOffVectorConnector< VectorTransmitter>::findCFnodes()
-{
-   SPtr<DistributionArray3D>  fFrom = block.lock()->getKernel()->getDataSet()->getFdistributions();
-   int maxX1 = (int)fFrom->getNX1();
-   int maxX2 = (int)fFrom->getNX2();
-   int maxX3 = (int)fFrom->getNX3();
-   int minX1 = 0;
-   int minX2 = 0;
-   int minX3 = 0;
-
-   int indexEvEv = 0;
-   int indexEvOd = 0;
-   int indexOdEv = 0;
-   int indexOdOd = 0;
-
-   vector_type& dataEvEv = this->senderEvenEvenSW->getData();
-   vector_type& dataEvOd = this->senderEvenOddNW->getData();
-   vector_type& dataOdEv = this->senderOddEvenSE->getData();
-   vector_type& dataOdOd = this->senderOddOddNE->getData();
-
-   int lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3;
-
-   using namespace D3Q27System;
-   if (block.lock()->hasInterpolationFlagCF(W))
-   {
-      lMinX1 = 1;
-      lMaxX1 = lMinX1 + 1;
-
-      getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, false);
-      getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, false);
-      findCFnodes(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
-
-      getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, false);
-      getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, false);
-      findCFnodes(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvOd, indexEvOd);
-
-      getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, false);
-      getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, false);
-      findCFnodes(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
-
-      getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, false);
-      getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, false);
-      findCFnodes(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdOd, indexOdOd);
-   }
-   if (block.lock()->hasInterpolationFlagCF(TN) && !block.lock()->hasInterpolationFlagCF(N) && !block.lock()->hasInterpolationFlagCF(T))
-   {
-      lMinX2 = maxX2 - 3;
-      lMaxX2 = lMinX2 + 1;
-      lMinX3 = maxX3 - 3;
-      lMaxX3 = lMinX3 + 1;
-
-      getLocalMinMax(minX1 + 1, maxX1, true, lMinX1, lMaxX1, false);
-      findCFnodes(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
-
-      getLocalMinMax(minX1 + 1, maxX1, false, lMinX1, lMaxX1, false);
-      findCFnodes(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-template<  typename VectorTransmitter  >
-void D3Q27ETCFOffVectorConnector< VectorTransmitter>::findCFnodes(SPtr<DistributionArray3D> fFrom, const int& lMinX1, const int& lMinX2, const int& lMinX3, const int& lMaxX1, const int& lMaxX2, const int& lMaxX3, vector_type& data, int& index)
-{
-   if (data.size() == 0) return;
-   int ix1, ix2, ix3;
-   LBMReal xoff, yoff, zoff;
-   SPtr<BCArray3D> bcArray = block.lock()->getKernel()->getBCProcessor()->getBCArray();
-
-   for (ix3 = lMinX3; ix3 < lMaxX3; ix3++)
-   {
-      for (ix2 = lMinX2; ix2 < lMaxX2; ix2++)
-      {
-         for (ix1 = lMinX1; ix1 < lMaxX1; ix1++)
-         {
-            D3Q27ICell icellC;
-            D3Q27ICell icellF;
-
-            int howManySolids = iprocessor->iCellHowManySolids(bcArray, ix1, ix2, ix3);
-
-            if (howManySolids == 0 || howManySolids == 8)
-            {
-               iprocessor->readICell(fFrom, icellC, ix1, ix2, ix3);
-               xoff = 0.0;
-               yoff = 0.0;
-               zoff = 0.0;
-            }
-            else
-            {
-               if (!iprocessor->findNeighborICell(bcArray, fFrom, icellC, bMaxX1, bMaxX2, bMaxX3, ix1, ix2, ix3, xoff, yoff, zoff))
-               {
-                  std::string err = "For " + block.lock()->toString() + " x1=" + UbSystem::toString(ix1) + ", x2=" + UbSystem::toString(ix2) + ", x3=" + UbSystem::toString(ix3) +
-                     " interpolation is not implemented for other direction" +
-                     " by using in: " + (std::string)typeid(*this).name() +
-                     " or maybe you have a solid on the block boundary";
-                  //UBLOG(logINFO, err);
-                  UB_THROW(UbException(UB_EXARGS, err));
-               }
-            }
-
-            iprocessor->interpolateCoarseToFine(icellC, icellF, xoff, yoff, zoff);
-            this->writeICellFtoData(data, index, icellF);
-            //for (int iix3 = ix3; iix3<=ix3+1; iix3++)
-            //{
-            //   for (int iix2 = ix2; iix2<=ix2+1; iix2++)
-            //   {
-            //      for (int iix1 = ix1; iix1<=ix1+1; iix1++)
-            //      {
-            //         bcArray->setInterfaceCF(iix1, iix2, iix3);
-            //      }
-            //   }
-            //}
-
-         }
-      }
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-template< typename VectorTransmitter >
-double D3Q27ETCFOffVectorConnector<VectorTransmitter>::getSendRecieveTime()
-{
-   return 0;
-}
-
-#endif 
+/**
+* @file D3Q27ETCFOffVectorConnector.h
+* @class D3Q27ETCFOffVectorConnector
+* @brief Interpolation from coarse level to fine.
+* @author Kostyantyn Kucher and Ehsan Fard
+* @date 08.06.2011
+*/
+#ifndef D3Q27ETCFOffVectorConnector_H
+#define D3Q27ETCFOffVectorConnector_H
+
+#include <vector>
+
+#include "basics/transmitter/TbTransmitter.h"
+#include "basics/transmitter/TbTransmitterLocal.h"
+#include "basics/container/CbVector.h"
+#include "Block3DConnector.h"
+#include "D3Q27System.h"
+#include "Block3D.h"
+#include "LBMKernel.h"
+#include "InterpolationProcessor.h"
+#include "MathUtil.hpp"
+#include "Grid3D.h"
+#include <PointerDefinitions.h>
+
+#include "D3Q27ETFCOffVectorConnector.h"
+#include "BCProcessor.h"
+
+class Block3D;
+
+//daten werden in einen vector (dieser befindet sich im transmitter) kopiert
+//der vector wird via transmitter uebertragen
+//transmitter kann ein lokal, MPI, RCG, CTL oder was auch immer fuer ein
+//transmitter sein, der von Transmitter abgeleitet ist ;-)
+
+//sendrichtung:    E<->W     N<->S    T<->B
+//  ---------       x3       x3        x2
+// | NW | NE |      ^        ^         ^
+// |----+----|      +-> x2   +->x1     +->x1
+// | SW | SE |     
+//  ---------
+// NW==even-odd, SW==even-even, SE==odd-even, NE==odd-odd
+
+template< typename VectorTransmitter >
+class D3Q27ETCFOffVectorConnector : public Block3DConnector
+{
+public:
+   typedef typename VectorTransmitter::value_type  vector_type;
+   typedef SPtr< VectorTransmitter > VectorTransmitterPtr;
+public:
+   D3Q27ETCFOffVectorConnector(SPtr<Block3D> block,
+      VectorTransmitterPtr senderEvenEvenSW, VectorTransmitterPtr receiverEvenEvenSW,
+      VectorTransmitterPtr senderEvenOddNW, VectorTransmitterPtr receiverEvenOddNW,
+      VectorTransmitterPtr senderOddEvenSE, VectorTransmitterPtr receiverOddEvenSE,
+      VectorTransmitterPtr senderOddOddNE, VectorTransmitterPtr receiverOddOddNE,
+      int sendDir, InterpolationProcessorPtr iprocessor);
+
+   bool isLocalConnector();
+   bool isRemoteConnector();
+   void init();
+
+   void sendTransmitterDataSize();
+   void receiveTransmitterDataSize();
+
+   void prepareForSend();
+   void sendVectors();
+
+   void prepareForReceive();
+   void receiveVectors();
+
+   void fillSendVectors();
+   void distributeReceiveVectors();
+
+   bool isInterpolationConnectorCF() { return true; }
+   bool isInterpolationConnectorFC() { return false; }
+
+   double getSendRecieveTime();
+
+   void prepareForSendX1() {}
+   void prepareForSendX2() {}
+   void prepareForSendX3() {}
+
+   void sendVectorsX1() {}
+   void sendVectorsX2() {}
+   void sendVectorsX3() {}
+
+   void prepareForReceiveX1() {}
+   void prepareForReceiveX2() {}
+   void prepareForReceiveX3() {}
+
+   void receiveVectorsX1() {}
+   void receiveVectorsX2() {}
+   void receiveVectorsX3() {}
+
+protected:
+   WPtr<Block3D> block; //dieser nvd sendet daten und die empfangenen werden diesem nvd zugeordnet
+   VectorTransmitterPtr senderEvenEvenSW, receiverEvenEvenSW,
+      senderEvenOddNW, receiverEvenOddNW,
+      senderOddEvenSE, receiverOddEvenSE,
+      senderOddOddNE, receiverOddOddNE;
+
+   InterpolationProcessorPtr iprocessor;
+
+   void writeICellFtoData(vector_type& data, int& index, D3Q27ICell& icellF);
+   void writeNodeToVector(vector_type& data, int& index, LBMReal* inode);
+   void getLocalMinMax(const int& gMin, const int& gMax, const bool& even, int& lMin, int& lMax, const bool& dataDistribution);
+   void getLocalMinMax(int& minX1, int& minX2, int& minX3, int& maxX1, int& maxX2, int& maxX3);
+   void getLocalMinMax(int& minX1, int& minX2, int& minX3, int& maxX1, int& maxX2, int& maxX3, CFconnectorType connType);
+   void fillSendVectorExt(SPtr<DistributionArray3D> fFrom, const int& lMinX1, const int& lMinX2, const int& lMinX3, const int& lMaxX1, const int& lMaxX2, const int& lMaxX3, vector_type& data, int& index);
+
+   void distributeReceiveVector(SPtr<DistributionArray3D> fTo, const int& lMinX1, const int& lMinX2, const int& lMinX3, const int& lMaxX1, const int& lMaxX2, const int& lMaxX3, vector_type& data, int& index);
+   void readICellCfromData(vector_type& data, int& index, LBMReal* icellC);
+
+   void findCFnodes();
+   void findCFnodes(SPtr<DistributionArray3D> fFrom, const int& lMinX1, const int& lMinX2, const int& lMinX3, const int& lMaxX1, const int& lMaxX2, const int& lMaxX3, vector_type& data, int& index);
+
+   int bMaxX1, bMaxX2, bMaxX3;
+};
+
+////////////////////////////////////////////////////////////////////////////
+template< typename VectorTransmitter >
+D3Q27ETCFOffVectorConnector<VectorTransmitter>::D3Q27ETCFOffVectorConnector(SPtr<Block3D> block,
+   VectorTransmitterPtr senderEvenEvenSW, VectorTransmitterPtr receiverEvenEvenSW,
+   VectorTransmitterPtr senderEvenOddNW, VectorTransmitterPtr receiverEvenOddNW,
+   VectorTransmitterPtr senderOddEvenSE, VectorTransmitterPtr receiverOddEvenSE,
+   VectorTransmitterPtr senderOddOddNE, VectorTransmitterPtr receiverOddOddNE,
+   int sendDir, InterpolationProcessorPtr iprocessor) : Block3DConnector(sendDir)
+   , block(block)
+   , senderEvenEvenSW(senderEvenEvenSW)
+   , senderEvenOddNW(senderEvenOddNW)
+   , senderOddEvenSE(senderOddEvenSE)
+   , senderOddOddNE(senderOddOddNE)
+   , receiverEvenEvenSW(receiverEvenEvenSW)
+   , receiverEvenOddNW(receiverEvenOddNW)
+   , receiverOddEvenSE(receiverOddEvenSE)
+   , receiverOddOddNE(receiverOddOddNE)
+   , iprocessor(iprocessor)
+{
+   if (!(sendDir == D3Q27System::E || sendDir == D3Q27System::W || sendDir == D3Q27System::N || sendDir == D3Q27System::S || sendDir == D3Q27System::T || sendDir == D3Q27System::B
+      || sendDir == D3Q27System::NE || sendDir == D3Q27System::SW || sendDir == D3Q27System::SE || sendDir == D3Q27System::NW
+      || sendDir == D3Q27System::TE || sendDir == D3Q27System::BW || sendDir == D3Q27System::BE || sendDir == D3Q27System::TW
+      || sendDir == D3Q27System::TN || sendDir == D3Q27System::BS || sendDir == D3Q27System::BN || sendDir == D3Q27System::TS
+      || sendDir == D3Q27System::TNE || sendDir == D3Q27System::TNW || sendDir == D3Q27System::TSE || sendDir == D3Q27System::TSW
+      || sendDir == D3Q27System::BNE || sendDir == D3Q27System::BNW || sendDir == D3Q27System::BSE || sendDir == D3Q27System::BSW
+      ))
+   {
+      throw UbException(UB_EXARGS, "invalid constructor for this direction");
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+template< typename VectorTransmitter >
+bool D3Q27ETCFOffVectorConnector<VectorTransmitter>::isLocalConnector()
+{
+   return !this->isRemoteConnector();
+}
+//////////////////////////////////////////////////////////////////////////
+template< typename VectorTransmitter >
+bool D3Q27ETCFOffVectorConnector<VectorTransmitter>::isRemoteConnector()
+{
+   return ((senderOddOddNE && senderOddOddNE->isRemoteTransmitter()) || (receiverOddOddNE && receiverOddOddNE->isRemoteTransmitter())
+      || (senderEvenEvenSW && senderEvenEvenSW->isRemoteTransmitter()) || (receiverEvenEvenSW && receiverEvenEvenSW->isRemoteTransmitter())
+      || (senderEvenOddNW && senderEvenOddNW->isRemoteTransmitter()) || (receiverEvenOddNW && receiverEvenOddNW->isRemoteTransmitter())
+      || (senderOddEvenSE && senderOddEvenSE->isRemoteTransmitter()) || (receiverOddEvenSE && receiverOddEvenSE->isRemoteTransmitter()));
+}
+//////////////////////////////////////////////////////////////////////////
+template< typename VectorTransmitter >
+void D3Q27ETCFOffVectorConnector<VectorTransmitter>::sendTransmitterDataSize()
+{
+   if (senderEvenEvenSW)
+   {
+      UBLOG(logDEBUG5, "D3Q27ETCFOffVectorConnector<VectorTransmitter>::sendTransmitterDataSize()-senderEvenEvenSW " << block.lock()->toString() << " sendDir=" << sendDir);
+      senderEvenEvenSW->sendDataSize();
+   }
+   if (senderEvenOddNW)
+   {
+      UBLOG(logDEBUG5, "D3Q27ETCFOffVectorConnector<VectorTransmitter>::sendTransmitterDataSize()-senderEvenOddNW " << block.lock()->toString() << "sendDir=" << sendDir);
+      senderEvenOddNW->sendDataSize();
+   }
+   if (senderOddEvenSE)
+   {
+      UBLOG(logDEBUG5, "D3Q27ETCFOffVectorConnector<VectorTransmitter>::sendTransmitterDataSize()-senderOddEvenSE " << block.lock()->toString() + "sendDir=" << sendDir);
+      senderOddEvenSE->sendDataSize();
+   }
+   if (senderOddOddNE)
+   {
+      UBLOG(logDEBUG5, "D3Q27ETCFOffVectorConnector<VectorTransmitter>::sendTransmitterDataSize()-senderOddOddNE " << block.lock()->toString() << "sendDir=" << sendDir);
+      senderOddOddNE->sendDataSize();
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+template< typename VectorTransmitter >
+void D3Q27ETCFOffVectorConnector<VectorTransmitter>::receiveTransmitterDataSize()
+{
+   if (receiverEvenEvenSW)
+   {
+      UBLOG(logDEBUG5, "D3Q27ETCFOffVectorConnector<VectorTransmitter>::receiveTransmitterDataSize()-receiverEvenEvenSW " << block.lock()->toString() << "sendDir=" << sendDir);
+      receiverEvenEvenSW->receiveDataSize();
+   }
+   if (receiverEvenOddNW)
+   {
+      UBLOG(logDEBUG5, "D3Q27ETCFOffVectorConnector<VectorTransmitter>::receiveTransmitterDataSize()-receiverEvenOddNW " << block.lock()->toString() << "sendDir=" << sendDir);
+      receiverEvenOddNW->receiveDataSize();
+   }
+   if (receiverOddEvenSE)
+   {
+      UBLOG(logDEBUG5, "D3Q27ETCFOffVectorConnector<VectorTransmitter>::receiveTransmitterDataSize()-receiverOddEvenSE " << block.lock()->toString() << "sendDir=" << sendDir);
+      receiverOddEvenSE->receiveDataSize();
+   }
+   if (receiverOddOddNE)
+   {
+      UBLOG(logDEBUG5, "D3Q27ETCFOffVectorConnector<VectorTransmitter>::receiveTransmitterDataSize()-receiverOddOddNE " << block.lock()->toString() << "sendDir=" << sendDir);
+      receiverOddOddNE->receiveDataSize();
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+template< typename VectorTransmitter >
+void D3Q27ETCFOffVectorConnector<VectorTransmitter>::prepareForSend()
+{
+   if (senderEvenEvenSW) senderEvenEvenSW->prepareForSend();
+   if (senderEvenOddNW) senderEvenOddNW->prepareForSend();
+   if (senderOddEvenSE) senderOddEvenSE->prepareForSend();
+   if (senderOddOddNE) senderOddOddNE->prepareForSend();
+}
+//////////////////////////////////////////////////////////////////////////
+template< typename VectorTransmitter >
+void D3Q27ETCFOffVectorConnector<VectorTransmitter>::sendVectors()
+{
+   if (senderEvenEvenSW) senderEvenEvenSW->sendData();
+   if (senderEvenOddNW) senderEvenOddNW->sendData();
+   if (senderOddEvenSE) senderOddEvenSE->sendData();
+   if (senderOddOddNE) senderOddOddNE->sendData();
+}
+//////////////////////////////////////////////////////////////////////////
+template< typename VectorTransmitter >
+void D3Q27ETCFOffVectorConnector<VectorTransmitter>::prepareForReceive()
+{
+   if (receiverEvenEvenSW) receiverEvenEvenSW->prepareForReceive();
+   if (receiverEvenOddNW) receiverEvenOddNW->prepareForReceive();
+   if (receiverOddEvenSE) receiverOddEvenSE->prepareForReceive();
+   if (receiverOddOddNE) receiverOddOddNE->prepareForReceive();
+}
+//////////////////////////////////////////////////////////////////////////
+template< typename VectorTransmitter >
+void D3Q27ETCFOffVectorConnector<VectorTransmitter>::receiveVectors()
+{
+   if (receiverEvenEvenSW) receiverEvenEvenSW->receiveData();
+   if (receiverEvenOddNW) receiverEvenOddNW->receiveData();
+   if (receiverOddEvenSE) receiverOddEvenSE->receiveData();
+   if (receiverOddOddNE) receiverOddOddNE->receiveData();
+}
+//////////////////////////////////////////////////////////////////////////
+template< typename VectorTransmitter >
+void D3Q27ETCFOffVectorConnector<VectorTransmitter>::init()
+{
+   using namespace D3Q27System;
+
+   bMaxX1 = (int)block.lock()->getKernel()->getDataSet()->getFdistributions()->getNX1();
+   bMaxX2 = (int)block.lock()->getKernel()->getDataSet()->getFdistributions()->getNX2();
+   bMaxX3 = (int)block.lock()->getKernel()->getDataSet()->getFdistributions()->getNX3();
+
+   int       sendSize = 0;
+   LBMReal initValue = -999.0;
+
+   int sendDataPerNode = 27/*f*/;
+   int iCellSize = 8; //size of interpolation cell
+
+   switch (this->sendDir)
+   {
+   case E: case W: sendSize = bMaxX2*bMaxX3*sendDataPerNode*iCellSize; break;
+   case N: case S: sendSize = bMaxX1*bMaxX3*sendDataPerNode*iCellSize; break;
+   case T: case B: sendSize = bMaxX1*bMaxX2*sendDataPerNode*iCellSize; break;
+   case NE: case SW:case SE: case NW: sendSize = 2 * bMaxX3*sendDataPerNode*iCellSize; break;
+   case TE: case BW:case BE: case TW: sendSize = 2 * bMaxX2*sendDataPerNode*iCellSize; break;
+   case TN: case BS:case BN: case TS: sendSize = 2 * bMaxX1*sendDataPerNode*iCellSize; break;
+   case TNE: case TNW:case TSE: case TSW:case BNE: case BNW:case BSE: case BSW: sendSize = 6 * bMaxX1*sendDataPerNode*iCellSize; break;
+   default: throw UbException(UB_EXARGS, "direction not allowed in this constructor");
+   }
+   if (senderEvenEvenSW) senderEvenEvenSW->getData().resize(sendSize, initValue);
+   else senderEvenEvenSW = VectorTransmitterPtr(new TbLocalTransmitter< CbVector< LBMReal > >());
+   if (senderEvenOddNW)  senderEvenOddNW->getData().resize(sendSize, initValue);
+   else senderEvenOddNW = VectorTransmitterPtr(new TbLocalTransmitter< CbVector< LBMReal > >());
+   if (senderOddEvenSE)  senderOddEvenSE->getData().resize(sendSize, initValue);
+   else senderOddEvenSE = VectorTransmitterPtr(new TbLocalTransmitter< CbVector< LBMReal > >());
+   if (senderOddOddNE)   senderOddOddNE->getData().resize(sendSize, initValue);
+   else senderOddOddNE = VectorTransmitterPtr(new TbLocalTransmitter< CbVector< LBMReal > >());
+
+   if (!receiverEvenEvenSW) receiverEvenEvenSW = VectorTransmitterPtr(new TbLocalTransmitter< CbVector< LBMReal > >());
+   if (!receiverEvenOddNW)  receiverEvenOddNW = VectorTransmitterPtr(new TbLocalTransmitter< CbVector< LBMReal > >());
+   if (!receiverOddEvenSE)  receiverOddEvenSE = VectorTransmitterPtr(new TbLocalTransmitter< CbVector< LBMReal > >());
+   if (!receiverOddOddNE)   receiverOddOddNE = VectorTransmitterPtr(new TbLocalTransmitter< CbVector< LBMReal > >());
+
+   //findCFnodes();
+}
+//////////////////////////////////////////////////////////////////////////
+template< typename VectorTransmitter >
+void D3Q27ETCFOffVectorConnector< VectorTransmitter>::fillSendVectors()
+{
+   using namespace D3Q27System;
+
+   SPtr<DistributionArray3D>  fFrom = block.lock()->getKernel()->getDataSet()->getFdistributions();
+   int maxX1 = (int)fFrom->getNX1();
+   int maxX2 = (int)fFrom->getNX2();
+   int maxX3 = (int)fFrom->getNX3();
+   int minX1 = 0;
+   int minX2 = 0;
+   int minX3 = 0;
+
+   int indexEvEv = 0;
+   int indexEvOd = 0;
+   int indexOdEv = 0;
+   int indexOdOd = 0;
+
+   vector_type& dataEvEv = this->senderEvenEvenSW->getData();
+   vector_type& dataEvOd = this->senderEvenOddNW->getData();
+   vector_type& dataOdEv = this->senderOddEvenSE->getData();
+   vector_type& dataOdOd = this->senderOddOddNE->getData();
+
+   int lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3;
+   //int lMinX1_2, lMinX2_2, lMinX3_2, lMaxX1_2, lMaxX2_2, lMaxX3_2;
+
+   //for coners
+   int lMinX1W = 1;
+   int lMaxX1W = 2;
+
+   int lMinX1E = maxX1 - 3;
+   int lMaxX1E = maxX1 - 2;
+
+   int lMinX2S = 1;
+   int lMaxX2S = 2;
+
+   int lMinX2N = maxX2 - 3;
+   int lMaxX2N = maxX2 - 2;
+
+   int lMinX3B = 1;
+   int lMaxX3B = 2;
+
+   int lMinX3T = maxX3 - 3;
+   int lMaxX3T = maxX3 - 2;
+
+
+   switch (sendDir)
+   {
+   case E:
+      lMinX1 = maxX1 - 3;
+      lMaxX1 = lMinX1 + 1;
+
+      getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, false);
+      getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, false);
+      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
+
+      getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, false);
+      getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, false);
+      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvOd, indexEvOd);
+
+      getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, false);
+      getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, false);
+      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
+
+      getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, false);
+      getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, false);
+      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdOd, indexOdOd);
+      break;
+   case W:
+      ///////////////////////////////////////
+      ///DEBUG
+      //if (block.lock()->getGlobalID() == 5780)
+      //{
+      //   int test = 0;
+      //}
+      //////////////
+      lMinX1 = 1;
+      lMaxX1 = lMinX1 + 1;
+
+      getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, false);
+      getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, false);
+      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
+
+      getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, false);
+      getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, false);
+      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvOd, indexEvOd);
+
+      getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, false);
+      getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, false);
+      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
+
+      getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, false);
+      getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, false);
+      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdOd, indexOdOd);
+      break;
+   case N:
+      lMinX2 = maxX2 - 3;
+      lMaxX2 = lMinX2 + 1;
+
+      getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, false);
+      getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, false);
+      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
+
+      getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, false);
+      getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, false);
+      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvOd, indexEvOd);
+
+      getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, false);
+      getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, false);
+      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
+
+      getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, false);
+      getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, false);
+      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdOd, indexOdOd);
+      break;
+   case S:
+      lMinX2 = 1;
+      lMaxX2 = lMinX2 + 1;
+
+      getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, false);
+      getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, false);
+      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
+
+      getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, false);
+      getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, false);
+      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvOd, indexEvOd);
+
+      getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, false);
+      getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, false);
+      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
+
+      getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, false);
+      getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, false);
+      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdOd, indexOdOd);
+      break;
+   case T:
+      lMinX3 = maxX3 - 3;
+      lMaxX3 = lMinX3 + 1;
+
+      getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, false);
+      getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, false);
+      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
+
+      getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, false);
+      getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, false);
+      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvOd, indexEvOd);
+
+      getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, false);
+      getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, false);
+      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
+
+      getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, false);
+      getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, false);
+      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdOd, indexOdOd);
+      break;
+   case B:
+      lMinX3 = 1;
+      lMaxX3 = lMinX3 + 1;
+
+      getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, false);
+      getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, false);
+      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
+
+      getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, false);
+      getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, false);
+      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvOd, indexEvOd);
+
+      getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, false);
+      getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, false);
+      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
+
+      getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, false);
+      getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, false);
+      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdOd, indexOdOd);
+      break;
+      ///N-S-E-W
+   case NE:
+      lMinX1 = maxX1 - 3;
+      lMaxX1 = lMinX1 + 2;
+      lMinX2 = maxX2 - 3;
+      lMaxX2 = lMinX2 + 2;
+
+      getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, false);
+      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
+
+      getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, false);
+      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
+
+      break;
+
+   case SW:
+      lMinX1 = 0;
+      lMaxX1 = lMinX1 + 2;
+      lMinX2 = 0;
+      lMaxX2 = lMinX2 + 2;
+
+      getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, false);
+      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
+
+      getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, false);
+      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
+
+      break;
+
+   case SE:
+      lMinX1 = maxX1 - 3;
+      lMaxX1 = lMinX1 + 2;
+      lMinX2 = 0;
+      lMaxX2 = lMinX2 + 2;
+
+      getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, false);
+      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
+
+      getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, false);
+      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
+
+      break;
+
+   case NW:
+      lMinX1 = 0;
+      lMaxX1 = lMinX1 + 2;
+      lMinX2 = maxX2 - 3;
+      lMaxX2 = lMinX2 + 2;
+
+      getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, false);
+      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
+
+      getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, false);
+      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
+
+      break;
+      /////T-B-E-W
+   case TE:
+      lMinX1 = maxX1 - 3;
+      lMaxX1 = lMinX1 + 2;
+      lMinX3 = maxX3 - 3;
+      lMaxX3 = lMinX3 + 2;
+
+      getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, false);
+      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
+
+      getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, false);
+      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
+
+      break;
+
+   case BW:
+      lMinX1 = 0;
+      lMaxX1 = lMinX1 + 2;
+      lMinX3 = 0;
+      lMaxX3 = lMinX3 + 2;
+
+      getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, false);
+      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
+
+      getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, false);
+      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
+
+      break;
+
+   case BE:
+      lMinX1 = maxX1 - 3;
+      lMaxX1 = lMinX1 + 2;
+      lMinX3 = 0;
+      lMaxX3 = lMinX3 + 2;
+
+      getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, false);
+      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
+
+      getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, false);
+      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
+
+      break;
+
+   case TW:
+      lMinX1 = 0;
+      lMaxX1 = lMinX1 + 2;
+      lMinX3 = maxX3 - 3;
+      lMaxX3 = lMinX3 + 2;
+
+      getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, false);
+      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
+
+      getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, false);
+      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
+
+      break;
+      ////
+      /////T-B-N-S
+   case TN:
+      lMinX2 = maxX2 - 3;
+      lMaxX2 = lMinX2 + 2;
+      lMinX3 = maxX3 - 3;
+      lMaxX3 = lMinX3 + 2;
+
+      getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, false);
+      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
+
+      getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, false);
+      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
+
+      break;
+
+   case BS:
+      lMinX2 = 0;
+      lMaxX2 = lMinX2 + 2;
+      lMinX3 = 0;
+      lMaxX3 = lMinX3 + 2;
+
+      getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, false);
+      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
+
+      getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, false);
+      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
+
+      break;
+
+   case BN:
+      lMinX2 = maxX2 - 3;
+      lMaxX2 = lMinX2 + 2;
+      lMinX3 = 0;
+      lMaxX3 = lMinX3 + 2;
+
+      getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, false);
+      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
+
+      getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, false);
+      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
+
+      break;
+
+   case TS:
+      lMinX2 = 0;
+      lMaxX2 = lMinX2 + 2;
+      lMinX3 = maxX3 - 3;
+      lMaxX3 = lMinX3 + 2;
+
+      getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, false);
+      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
+
+      getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, false);
+      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
+
+      break;
+
+
+      //TNE
+   case TNE:
+      lMinX1 = maxX1 - 3;
+      lMaxX1 = maxX1 - 1;
+      lMinX2 = maxX2 - 3;
+      lMaxX2 = maxX2 - 1;
+      lMinX3 = maxX3 - 3;
+      lMaxX3 = maxX3 - 1;
+
+      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
+      break;
+      //   TNW
+   case TNW:
+      lMinX1 = 0;
+      lMaxX1 = 2;
+      lMinX2 = maxX2 - 3;
+      lMaxX2 = maxX2 - 1;
+      lMinX3 = maxX3 - 3;
+      lMaxX3 = maxX3 - 1;
+
+      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
+      break;
+      //   TSE
+   case TSE:
+      lMinX1 = maxX1 - 3;
+      lMaxX1 = maxX1 - 1;
+      lMinX2 = 0;
+      lMaxX2 = 2;
+      lMinX3 = maxX3 - 3;
+      lMaxX3 = maxX3 - 1;
+
+      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
+      break;
+      //   TSW
+   case TSW:
+      lMinX1 = 0;
+      lMaxX1 = 2;
+      lMinX2 = 0;
+      lMaxX2 = 2;
+      lMinX3 = maxX3 - 3;
+      lMaxX3 = maxX3 - 1;
+
+      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
+      break;
+      //   BNE
+   case BNE:
+      lMinX1 = maxX1 - 3;
+      lMaxX1 = maxX1 - 1;
+      lMinX2 = maxX2 - 3;
+      lMaxX2 = maxX2 - 1;
+      lMinX3 = 0;
+      lMaxX3 = 2;
+
+      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
+      break;
+      //   BNW
+   case BNW:
+      lMinX1 = 0;
+      lMaxX1 = 2;
+      lMinX2 = maxX2 - 3;
+      lMaxX2 = maxX2 - 1;
+      lMinX3 = 0;
+      lMaxX3 = 2;
+
+      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
+      break;
+      //   BSE
+   case BSE:
+      lMinX1 = maxX1 - 3;
+      lMaxX1 = maxX1 - 1;
+      lMinX2 = 0;
+      lMaxX2 = 2;
+      lMinX3 = 0;
+      lMaxX3 = 2;
+
+      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
+      break;
+      //   BSW
+   case BSW:
+      lMinX1 = 0;
+      lMaxX1 = 2;
+      lMinX2 = 0;
+      lMaxX2 = 2;
+      lMinX3 = 0;
+      lMaxX3 = 2;
+
+      fillSendVectorExt(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
+      break;
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+template<  typename VectorTransmitter  >
+void D3Q27ETCFOffVectorConnector< VectorTransmitter>::getLocalMinMax(const int& gMin, const int& gMax, const bool& even, int& lMin, int& lMax, const bool& dataDistribution)
+{
+   int halfEven = 0;
+   int halfOdd = 0;
+   int dCoef = 0;
+
+   if (dataDistribution)
+      dCoef = 1;
+
+   if (Utilities::isOdd(gMax))
+   {
+      halfEven = gMax / 2;
+      halfOdd = gMax / 2;
+   }
+   if (Utilities::isEven(gMax))
+   {
+      halfEven = gMax / 2;
+      halfOdd = gMax / 2 - 1 + dCoef;
+   }
+
+   switch (even)
+   {
+   case true:
+      lMin = gMin + dCoef;
+      lMax = lMin + halfEven - dCoef;
+      break;
+   case false:
+      lMin = gMin + halfOdd;
+      lMax = gMax - 1;
+      break;
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+template<  typename VectorTransmitter  >
+void D3Q27ETCFOffVectorConnector< VectorTransmitter>::fillSendVectorExt(SPtr<DistributionArray3D> fFrom, const int& lMinX1, const int& lMinX2, const int& lMinX3, const int& lMaxX1, const int& lMaxX2, const int& lMaxX3, vector_type& data, int& index)
+{
+   if (data.size() == 0) return;
+   int ix1, ix2, ix3;
+   LBMReal xoff, yoff, zoff;
+   SPtr<BCArray3D> bcArray = block.lock()->getKernel()->getBCProcessor()->getBCArray();
+
+   for (ix3 = lMinX3; ix3 < lMaxX3; ix3++)
+   {
+      for (ix2 = lMinX2; ix2 < lMaxX2; ix2++)
+      {
+         for (ix1 = lMinX1; ix1 < lMaxX1; ix1++)
+         {
+            D3Q27ICell icellC;
+            D3Q27ICell icellF;
+
+            int howManySolids = iprocessor->iCellHowManySolids(bcArray, ix1, ix2, ix3);
+
+            if (howManySolids == 0 || howManySolids == 8)
+            {
+               iprocessor->readICell(fFrom, icellC, ix1, ix2, ix3);
+               xoff = 0.0;
+               yoff = 0.0;
+               zoff = 0.0;
+            }
+            else
+            {
+               if (!iprocessor->findNeighborICell(bcArray, fFrom, icellC, bMaxX1, bMaxX2, bMaxX3, ix1, ix2, ix3, xoff, yoff, zoff))
+               {
+                  std::string err = "For " + block.lock()->toString() + " x1=" + UbSystem::toString(ix1) + ", x2=" + UbSystem::toString(ix2) + ", x3=" + UbSystem::toString(ix3) +
+                     " interpolation is not implemented for other direction" +
+                     " by using in: " + (std::string)typeid(*this).name() +
+                     " or maybe you have a solid on the block boundary";
+                  UB_THROW(UbException(UB_EXARGS, err));
+               }
+            }
+
+            iprocessor->interpolateCoarseToFine(icellC, icellF, xoff, yoff, zoff);
+            this->writeICellFtoData(data, index, icellF);
+         }
+      }
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+template<  typename VectorTransmitter  >
+void D3Q27ETCFOffVectorConnector< VectorTransmitter>::writeICellFtoData(vector_type& data, int& index, D3Q27ICell& icellF)
+{
+   writeNodeToVector(data, index, icellF.BSW);
+   writeNodeToVector(data, index, icellF.BSE);
+   writeNodeToVector(data, index, icellF.BNW);
+   writeNodeToVector(data, index, icellF.BNE);
+   writeNodeToVector(data, index, icellF.TSW);
+   writeNodeToVector(data, index, icellF.TSE);
+   writeNodeToVector(data, index, icellF.TNW);
+   writeNodeToVector(data, index, icellF.TNE);
+}
+//////////////////////////////////////////////////////////////////////////
+template<  typename VectorTransmitter  >
+void D3Q27ETCFOffVectorConnector< VectorTransmitter>::writeNodeToVector(vector_type& data, int& index, LBMReal* inode)
+{
+   for (int i = D3Q27System::STARTF; i < D3Q27System::ENDF + 1; i++)
+   {
+      data[index++] = inode[i];
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+template<  typename VectorTransmitter  >
+void D3Q27ETCFOffVectorConnector< VectorTransmitter>::distributeReceiveVectors()
+{
+   using namespace D3Q27System;
+
+   SPtr<DistributionArray3D>  fTo = block.lock()->getKernel()->getDataSet()->getFdistributions();
+   int maxX1 = (int)fTo->getNX1();
+   int maxX2 = (int)fTo->getNX2();
+   int maxX3 = (int)fTo->getNX3();
+   int minX1 = 0;
+   int minX2 = 0;
+   int minX3 = 0;
+
+   int indexEvEv = 0;
+   int indexEvOd = 0;
+   int indexOdEv = 0;
+   int indexOdOd = 0;
+
+   vector_type& dataEvEv = this->receiverEvenEvenSW->getData();
+   vector_type& dataEvOd = this->receiverEvenOddNW->getData();
+   vector_type& dataOdEv = this->receiverOddEvenSE->getData();
+   vector_type& dataOdOd = this->receiverOddOddNE->getData();
+
+   int lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3;
+   int dummy;
+
+   //for coners
+   int lMinX1W = 3;
+   int lMaxX1W = 3;
+
+   int lMinX1E = maxX1 - 3;
+   int lMaxX1E = maxX1 - 2;
+
+   int lMinX2S = 1;
+   int lMaxX2S = 3;
+
+   int lMinX2N = maxX2 - 3;
+   int lMaxX2N = maxX2 - 2;
+
+   int lMinX3B = 1;
+   int lMaxX3B = 3;
+
+   int lMinX3T = maxX3 - 3;
+   int lMaxX3T = maxX3 - 2;
+
+   ///////////////////////////////////////
+   ///DEBUG
+   //if (block.lock()->getGlobalID() == 5780)
+   //{
+   //   int test = 0;
+   //}
+   //////////////
+
+   switch (sendDir)
+   {
+   case E:
+      lMinX1 = maxX1 - 4;
+      lMaxX1 = lMinX1 + 1;
+      getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, true);
+      getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, true);
+      getLocalMinMax(dummy, lMinX2, lMinX3, dummy, dummy, dummy);
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
+
+      getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, true);
+      getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, true);
+      getLocalMinMax(dummy, lMinX2, dummy, dummy, dummy, lMaxX3);
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvOd, indexEvOd);
+
+      getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, true);
+      getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, true);
+      getLocalMinMax(dummy, dummy, lMinX3, dummy, lMaxX2, dummy);
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
+
+      getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, true);
+      getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, true);
+      getLocalMinMax(dummy, dummy, dummy, dummy, lMaxX2, lMaxX3);
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdOd, indexOdOd);
+      break;
+   case W:
+      ///////////////////////////////////////
+      ///DEBUG
+      //if (block.lock()->getGlobalID() == 5780)
+      //{
+      //   int test = 0;
+      //}
+      //////////////
+      lMinX1 = 3;
+      lMaxX1 = lMinX1 + 1;
+      getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, true);
+      getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, true);
+      getLocalMinMax(dummy, lMinX2, lMinX3, dummy, dummy, dummy);
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
+
+      getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, true);
+      getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, true);
+      getLocalMinMax(dummy, lMinX2, dummy, dummy, dummy, lMaxX3);
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvOd, indexEvOd);
+
+      getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, true);
+      getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, true);
+      getLocalMinMax(dummy, dummy, lMinX3, dummy, lMaxX2, dummy);
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
+
+      getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, true);
+      getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, true);
+      getLocalMinMax(dummy, dummy, dummy, dummy, lMaxX2, lMaxX3);
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdOd, indexOdOd);
+      break;
+   case N:
+      lMinX2 = maxX2 - 4;
+      lMaxX2 = lMinX2 + 1;
+      getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, true);
+      getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, true);
+      getLocalMinMax(lMinX1, dummy, lMinX3, dummy, dummy, dummy);
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
+
+      getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, true);
+      getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, true);
+      getLocalMinMax(lMinX1, dummy, dummy, dummy, dummy, lMaxX3);
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvOd, indexEvOd);
+
+      getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, true);
+      getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, true);
+      getLocalMinMax(dummy, dummy, lMinX3, lMaxX1, dummy, dummy);
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
+
+      getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, true);
+      getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, true);
+      getLocalMinMax(dummy, dummy, dummy, lMaxX1, dummy, lMaxX3);
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdOd, indexOdOd);
+      break;
+   case S:
+      lMinX2 = 3;
+      lMaxX2 = lMinX2 + 1;
+      getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, true);
+      getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, true);
+      getLocalMinMax(lMinX1, dummy, lMinX3, dummy, dummy, dummy);
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
+
+      getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, true);
+      getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, true);
+      getLocalMinMax(lMinX1, dummy, dummy, dummy, dummy, lMaxX3);
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvOd, indexEvOd);
+
+      getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, true);
+      getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, true);
+      getLocalMinMax(dummy, dummy, lMinX3, lMaxX1, dummy, dummy);
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
+
+      getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, true);
+      getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, true);
+      getLocalMinMax(dummy, dummy, dummy, lMaxX1, dummy, lMaxX3);
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdOd, indexOdOd);
+      break;
+   case T:
+      lMinX3 = maxX3 - 4;
+      lMaxX3 = lMinX3 + 1;
+      getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, true);
+      getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, true);
+      getLocalMinMax(lMinX1, lMinX2, dummy, dummy, dummy, dummy);
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
+
+      getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, true);
+      getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, true);
+      getLocalMinMax(lMinX1, dummy, dummy, dummy, lMaxX2, dummy);
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvOd, indexEvOd);
+
+      getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, true);
+      getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, true);
+      getLocalMinMax(dummy, lMinX2, dummy, lMaxX1, dummy, dummy);
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
+
+      getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, true);
+      getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, true);
+      getLocalMinMax(dummy, dummy, dummy, lMaxX1, lMaxX2, dummy);
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdOd, indexOdOd);
+      break;
+   case B:
+      lMinX3 = 3;
+      lMaxX3 = lMinX3 + 1;
+      getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, true);
+      getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, true);
+      getLocalMinMax(lMinX1, lMinX2, dummy, dummy, dummy, dummy);
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
+
+      getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, true);
+      getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, true);
+      getLocalMinMax(lMinX1, dummy, dummy, dummy, lMaxX2, dummy);
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvOd, indexEvOd);
+
+      getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, true);
+      getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, true);
+      getLocalMinMax(dummy, lMinX2, dummy, lMaxX1, dummy, dummy);
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
+
+      getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, true);
+      getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, true);
+      getLocalMinMax(dummy, dummy, dummy, lMaxX1, lMaxX2, dummy);
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdOd, indexOdOd);
+      break;
+
+      //	/////E-W-N-S
+   case NE:
+      lMinX1 = maxX1 - 4;
+      lMaxX1 = lMinX1 + 3;
+      lMinX2 = maxX2 - 4;
+      lMaxX2 = lMinX2 + 1;
+      getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, true);
+      getLocalMinMax(dummy, dummy, lMinX3, dummy, dummy, dummy);
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
+
+      getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, true);
+      getLocalMinMax(dummy, dummy, dummy, dummy, dummy, lMaxX3);
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
+
+      lMinX1 = maxX1 - 4;
+      lMaxX1 = lMinX1 + 1;
+      lMinX2 = maxX2 - 4;
+      lMaxX2 = lMinX2 + 3;
+      getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, true);
+      getLocalMinMax(dummy, dummy, lMinX3, dummy, dummy, dummy);
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
+
+      getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, true);
+      getLocalMinMax(dummy, dummy, dummy, dummy, dummy, lMaxX3);
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
+
+      break;
+
+   case SW:
+      lMinX1 = 1;
+      lMaxX1 = lMinX1 + 3;
+      lMinX2 = 3;
+      lMaxX2 = lMinX2 + 1;
+      getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, true);
+      getLocalMinMax(dummy, dummy, lMinX3, dummy, dummy, dummy);
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
+
+      getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, true);
+      getLocalMinMax(dummy, dummy, dummy, dummy, dummy, lMaxX3);
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
+
+      lMinX1 = 3;
+      lMaxX1 = lMinX1 + 1;
+      lMinX2 = 1;
+      lMaxX2 = lMinX2 + 3;
+      getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, true);
+      getLocalMinMax(dummy, dummy, lMinX3, dummy, dummy, dummy);
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
+
+      getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, true);
+      getLocalMinMax(dummy, dummy, dummy, dummy, dummy, lMaxX3);
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
+
+      break;
+
+   case SE:
+      lMinX1 = maxX1 - 4;
+      lMaxX1 = lMinX1 + 3;
+      lMinX2 = 3;
+      lMaxX2 = lMinX2 + 1;
+      getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, true);
+      getLocalMinMax(dummy, dummy, lMinX3, dummy, dummy, dummy);
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
+
+      getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, true);
+      getLocalMinMax(dummy, dummy, dummy, dummy, dummy, lMaxX3);
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
+
+      lMinX1 = maxX1 - 4;
+      lMaxX1 = lMinX1 + 1;
+      lMinX2 = 1;
+      lMaxX2 = lMinX2 + 3;
+      getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, true);
+      getLocalMinMax(dummy, dummy, lMinX3, dummy, dummy, dummy);
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
+
+      getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, true);
+      getLocalMinMax(dummy, dummy, dummy, dummy, dummy, lMaxX3);
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
+
+      break;
+
+   case NW:
+      lMinX1 = 1;
+      lMaxX1 = lMinX1 + 3;
+      lMinX2 = maxX2 - 4;
+      lMaxX2 = lMinX2 + 1;
+      getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, true);
+      getLocalMinMax(dummy, dummy, lMinX3, dummy, dummy, dummy);
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
+
+      getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, true);
+      getLocalMinMax(dummy, dummy, dummy, dummy, dummy, lMaxX3);
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
+
+      lMinX1 = 3;
+      lMaxX1 = lMinX1 + 1;
+      lMinX2 = maxX2 - 4;
+      lMaxX2 = lMinX2 + 3;
+      getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, true);
+      getLocalMinMax(dummy, dummy, lMinX3, dummy, dummy, dummy);
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
+
+      getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, true);
+      getLocalMinMax(dummy, dummy, dummy, dummy, dummy, lMaxX3);
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
+
+      break;
+      //		/////T-B-E-W
+   case TE:
+      lMinX1 = maxX1 - 4;
+      lMaxX1 = lMinX1 + 3;
+      lMinX3 = maxX3 - 4;
+      lMaxX3 = lMinX3 + 1;
+      getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, true);
+      getLocalMinMax(dummy, lMinX2, dummy, dummy, dummy, dummy);
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
+
+      getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, true);
+      getLocalMinMax(dummy, dummy, dummy, dummy, lMaxX2, dummy);
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
+
+      lMinX1 = maxX1 - 4;
+      lMaxX1 = lMinX1 + 1;
+      lMinX3 = maxX3 - 4;
+      lMaxX3 = lMinX3 + 3;
+      getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, true);
+      getLocalMinMax(dummy, lMinX2, dummy, dummy, dummy, dummy);
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
+
+      getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, true);
+      getLocalMinMax(dummy, dummy, dummy, dummy, lMaxX2, dummy);
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
+
+      break;
+
+   case BW:
+      lMinX1 = 1;
+      lMaxX1 = lMinX1 + 3;
+      lMinX3 = 3;
+      lMaxX3 = lMinX3 + 1;
+      getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, true);
+      getLocalMinMax(dummy, lMinX2, dummy, dummy, dummy, dummy);
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
+
+      getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, true);
+      getLocalMinMax(dummy, dummy, dummy, dummy, lMaxX2, dummy);
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
+
+      lMinX1 = 3;
+      lMaxX1 = lMinX1 + 1;
+      lMinX3 = 1;
+      lMaxX3 = lMinX3 + 3;
+      getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, true);
+      getLocalMinMax(dummy, lMinX2, dummy, dummy, dummy, dummy);
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
+
+      getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, true);
+      getLocalMinMax(dummy, dummy, dummy, dummy, lMaxX2, dummy);
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
+
+      break;
+
+   case BE:
+      lMinX1 = maxX1 - 4;
+      lMaxX1 = lMinX1 + 3;
+      lMinX3 = 3;
+      lMaxX3 = lMinX3 + 1;
+      getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, true);
+      getLocalMinMax(dummy, lMinX2, dummy, dummy, dummy, dummy);
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
+
+      getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, true);
+      getLocalMinMax(dummy, dummy, dummy, dummy, lMaxX2, dummy);
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
+
+      lMinX1 = maxX1 - 4;
+      lMaxX1 = lMinX1 + 1;
+      lMinX3 = 1;
+      lMaxX3 = lMinX3 + 3;
+      getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, true);
+      getLocalMinMax(dummy, lMinX2, dummy, dummy, dummy, dummy);
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
+
+      getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, true);
+      getLocalMinMax(dummy, dummy, dummy, dummy, lMaxX2, dummy);
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
+
+      break;
+
+   case TW:
+      lMinX1 = 1;
+      lMaxX1 = lMinX1 + 3;
+      lMinX3 = maxX3 - 4;
+      lMaxX3 = lMinX3 + 1;
+      getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, true);
+      getLocalMinMax(dummy, lMinX2, dummy, dummy, dummy, dummy);
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
+
+      getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, true);
+      getLocalMinMax(dummy, dummy, dummy, dummy, lMaxX2, dummy);
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
+
+      lMinX1 = 3;
+      lMaxX1 = lMinX1 + 1;
+      lMinX3 = maxX3 - 4;
+      lMaxX3 = lMinX3 + 3;
+      getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, true);
+      getLocalMinMax(dummy, lMinX2, dummy, dummy, dummy, dummy);
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
+
+      getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, true);
+      getLocalMinMax(dummy, dummy, dummy, dummy, lMaxX2, dummy);
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
+
+      break;
+
+      /////////////////////////T-N-B-S
+   case TN:
+      lMinX2 = maxX2 - 4;
+      lMaxX2 = lMinX2 + 3;
+      lMinX3 = maxX3 - 4;
+      lMaxX3 = lMinX3 + 1;
+      getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, true);
+      getLocalMinMax(lMinX1, dummy, dummy, dummy, dummy, dummy);
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
+
+      getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, true);
+      getLocalMinMax(dummy, dummy, dummy, lMaxX1, dummy, dummy);
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
+
+      lMinX2 = maxX2 - 4;
+      lMaxX2 = lMinX2 + 1;
+      lMinX3 = maxX3 - 4;
+      lMaxX3 = lMinX3 + 3;
+      getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, true);
+      getLocalMinMax(lMinX1, dummy, dummy, dummy, dummy, dummy);
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
+
+      getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, true);
+      getLocalMinMax(dummy, dummy, dummy, lMaxX1, dummy, dummy);
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
+
+      break;
+
+   case BS:
+      lMinX2 = 1;
+      lMaxX2 = lMinX2 + 3;
+      lMinX3 = 3;
+      lMaxX3 = lMinX3 + 1;
+      getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, true);
+      getLocalMinMax(lMinX1, dummy, dummy, dummy, dummy, dummy);
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
+
+      getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, true);
+      getLocalMinMax(dummy, dummy, dummy, lMaxX1, dummy, dummy);
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
+
+      lMinX2 = 3;
+      lMaxX2 = lMinX2 + 1;
+      lMinX3 = 1;
+      lMaxX3 = lMinX3 + 3;
+      getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, true);
+      getLocalMinMax(lMinX1, dummy, dummy, dummy, dummy, dummy);
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
+
+      getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, true);
+      getLocalMinMax(dummy, dummy, dummy, lMaxX1, dummy, dummy);
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
+
+      break;
+
+
+   case BN:
+      lMinX2 = maxX2 - 4;
+      lMaxX2 = lMinX2 + 3;
+      lMinX3 = 3;
+      lMaxX3 = lMinX3 + 1;
+      getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, true);
+      getLocalMinMax(lMinX1, dummy, dummy, dummy, dummy, dummy);
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
+
+      getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, true);
+      getLocalMinMax(dummy, dummy, dummy, lMaxX1, dummy, dummy);
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
+
+      lMinX2 = maxX2 - 4;
+      lMaxX2 = lMinX2 + 1;
+      lMinX3 = 1;
+      lMaxX3 = lMinX3 + 3;
+      getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, true);
+      getLocalMinMax(lMinX1, dummy, dummy, dummy, dummy, dummy);
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
+
+      getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, true);
+      getLocalMinMax(dummy, dummy, dummy, lMaxX1, dummy, dummy);
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
+
+      break;
+
+   case TS:
+      lMinX2 = 1;
+      lMaxX2 = lMinX2 + 3;
+      lMinX3 = maxX3 - 4;
+      lMaxX3 = lMinX3 + 1;
+      getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, true);
+      getLocalMinMax(lMinX1, dummy, dummy, dummy, dummy, dummy);
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
+
+      getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, true);
+      getLocalMinMax(dummy, dummy, dummy, lMaxX1, dummy, dummy);
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
+
+      lMinX2 = 3;
+      lMaxX2 = lMinX2 + 1;
+      lMinX3 = maxX3 - 4;
+      lMaxX3 = lMinX3 + 3;
+      getLocalMinMax(minX1, maxX1, true, lMinX1, lMaxX1, true);
+      getLocalMinMax(lMinX1, dummy, dummy, dummy, dummy, dummy);
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
+
+      getLocalMinMax(minX1, maxX1, false, lMinX1, lMaxX1, true);
+      getLocalMinMax(dummy, dummy, dummy, lMaxX1, dummy, dummy);
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
+
+      break;
+
+      //TNE
+   case TNE:
+      lMinX1 = maxX1 - 4;
+      lMaxX1 = maxX1 - 3;
+      lMinX2 = maxX2 - 4;
+      lMaxX2 = maxX2 - 1;
+      lMinX3 = maxX3 - 4;
+      lMaxX3 = maxX3 - 1;
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
+
+      lMinX1 = maxX1 - 4;
+      lMaxX1 = maxX1 - 1;
+      lMinX2 = maxX2 - 4;
+      lMaxX2 = maxX2 - 3;
+      lMinX3 = maxX3 - 4;
+      lMaxX3 = maxX3 - 1;
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
+
+      lMinX1 = maxX1 - 4;
+      lMaxX1 = maxX1 - 1;
+      lMinX2 = maxX2 - 4;
+      lMaxX2 = maxX2 - 1;
+      lMinX3 = maxX3 - 4;
+      lMaxX3 = maxX3 - 3;
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
+
+      break;
+      //   TNW
+   case TNW:
+      lMinX1 = 3;
+      lMaxX1 = 4;
+      lMinX2 = maxX2 - 4;
+      lMaxX2 = maxX2 - 1;
+      lMinX3 = maxX3 - 4;
+      lMaxX3 = maxX3 - 1;
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
+
+      lMinX1 = 1;
+      lMaxX1 = 4;
+      lMinX2 = maxX2 - 4;
+      lMaxX2 = maxX2 - 3;
+      lMinX3 = maxX3 - 4;
+      lMaxX3 = maxX3 - 1;
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
+
+      lMinX1 = 1;
+      lMaxX1 = 4;
+      lMinX2 = maxX2 - 4;
+      lMaxX2 = maxX2 - 1;
+      lMinX3 = maxX3 - 4;
+      lMaxX3 = maxX3 - 3;
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
+
+      break;
+      //   TSE
+   case TSE:
+      lMinX1 = maxX1 - 4;
+      lMaxX1 = maxX1 - 3;
+      lMinX2 = 1;
+      lMaxX2 = 4;
+      lMinX3 = maxX3 - 4;
+      lMaxX3 = maxX3 - 1;
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
+
+      lMinX1 = maxX1 - 4;
+      lMaxX1 = maxX1 - 1;
+      lMinX2 = 3;
+      lMaxX2 = 4;
+      lMinX3 = maxX3 - 4;
+      lMaxX3 = maxX3 - 1;
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
+
+      lMinX1 = maxX1 - 4;
+      lMaxX1 = maxX1 - 1;
+      lMinX2 = 1;
+      lMaxX2 = 4;
+      lMinX3 = maxX3 - 4;
+      lMaxX3 = maxX3 - 3;
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
+      break;
+      //   TSW
+   case TSW:
+      lMinX1 = 3;
+      lMaxX1 = 4;
+      lMinX2 = 1;
+      lMaxX2 = 4;
+      lMinX3 = maxX3 - 4;
+      lMaxX3 = maxX3 - 1;
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
+
+      lMinX1 = 1;
+      lMaxX1 = 4;
+      lMinX2 = 3;
+      lMaxX2 = 4;
+      lMinX3 = maxX3 - 4;
+      lMaxX3 = maxX3 - 1;
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
+
+      lMinX1 = 1;
+      lMaxX1 = 4;
+      lMinX2 = 1;
+      lMaxX2 = 4;
+      lMinX3 = maxX3 - 4;
+      lMaxX3 = maxX3 - 3;
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
+      break;
+      //   BNE
+   case BNE:
+      lMinX1 = maxX1 - 4;
+      lMaxX1 = maxX1 - 3;
+      lMinX2 = maxX2 - 4;
+      lMaxX2 = maxX2 - 1;
+      lMinX3 = 1;
+      lMaxX3 = 4;
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
+
+      lMinX1 = maxX1 - 4;
+      lMaxX1 = maxX1 - 1;
+      lMinX2 = maxX2 - 4;
+      lMaxX2 = maxX2 - 3;
+      lMinX3 = 1;
+      lMaxX3 = 4;
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
+
+      lMinX1 = maxX1 - 4;
+      lMaxX1 = maxX1 - 1;
+      lMinX2 = maxX2 - 4;
+      lMaxX2 = maxX2 - 1;
+      lMinX3 = 3;
+      lMaxX3 = 4;
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
+
+      break;
+      //   BNW
+   case BNW:
+      lMinX1 = 3;
+      lMaxX1 = 4;
+      lMinX2 = maxX2 - 4;
+      lMaxX2 = maxX2 - 1;
+      lMinX3 = 1;
+      lMaxX3 = 4;
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
+
+      lMinX1 = 1;
+      lMaxX1 = 4;
+      lMinX2 = maxX2 - 4;
+      lMaxX2 = maxX2 - 3;
+      lMinX3 = 1;
+      lMaxX3 = 4;
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
+
+      lMinX1 = 1;
+      lMaxX1 = 4;
+      lMinX2 = maxX2 - 4;
+      lMaxX2 = maxX2 - 1;
+      lMinX3 = 3;
+      lMaxX3 = 4;
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
+      break;
+      //   BSE
+   case BSE:
+      lMinX1 = maxX1 - 4;
+      lMaxX1 = maxX1 - 3;
+      lMinX2 = 1;
+      lMaxX2 = 4;
+      lMinX3 = 1;
+      lMaxX3 = 4;
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
+
+      lMinX1 = maxX1 - 4;
+      lMaxX1 = maxX1 - 1;
+      lMinX2 = 3;
+      lMaxX2 = 4;
+      lMinX3 = 1;
+      lMaxX3 = 4;
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
+
+      lMinX1 = maxX1 - 4;
+      lMaxX1 = maxX1 - 1;
+      lMinX2 = 1;
+      lMaxX2 = 4;
+      lMinX3 = 3;
+      lMaxX3 = 4;
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
+      break;
+      //   BSW
+   case BSW:
+      lMinX1 = 3;
+      lMaxX1 = 4;
+      lMinX2 = 1;
+      lMaxX2 = 4;
+      lMinX3 = 1;
+      lMaxX3 = 4;
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
+
+      lMinX1 = 1;
+      lMaxX1 = 4;
+      lMinX2 = 3;
+      lMaxX2 = 4;
+      lMinX3 = 1;
+      lMaxX3 = 4;
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
+
+      lMinX1 = 1;
+      lMaxX1 = 4;
+      lMinX2 = 1;
+      lMaxX2 = 4;
+      lMinX3 = 3;
+      lMaxX3 = 4;
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
+
+      break;
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+template<  typename VectorTransmitter  >
+void D3Q27ETCFOffVectorConnector< VectorTransmitter>::distributeReceiveVector(SPtr<DistributionArray3D> fTo, const int& lMinX1, const int& lMinX2, const int& lMinX3, const int& lMaxX1, const int& lMaxX2, const int& lMaxX3, vector_type& data, int& index)
+{
+   if (data.size() == 0) return;
+
+   int ix1, ix2, ix3;
+   for (ix3 = lMinX3; ix3 < lMaxX3; ix3++)
+   {
+      for (ix2 = lMinX2; ix2 < lMaxX2; ix2++)
+      {
+         for (ix1 = lMinX1; ix1 < lMaxX1; ix1++)
+         {
+            LBMReal icellC[27];
+            this->readICellCfromData(data, index, icellC);
+            iprocessor->writeINodeInv(fTo, icellC, ix1, ix2, ix3);
+         }
+      }
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+template<  typename VectorTransmitter  >
+void D3Q27ETCFOffVectorConnector< VectorTransmitter>::readICellCfromData(vector_type& data, int& index, LBMReal* icellC)
+{
+   for (int i = D3Q27System::STARTF; i < D3Q27System::ENDF + 1; i++)
+   {
+      icellC[i] = data[index++];
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+template<  typename VectorTransmitter  >
+void D3Q27ETCFOffVectorConnector< VectorTransmitter>::getLocalMinMax(int& minX1, int& minX2, int& minX3, int& maxX1, int& maxX2, int& maxX3)
+{
+   using namespace D3Q27System;
+   int TminX1 = minX1; int TminX2 = minX2; int TminX3 = minX3; int TmaxX1 = maxX1; int TmaxX2 = maxX2; int TmaxX3 = maxX3;
+
+   if (block.lock()->hasInterpolationFlagCF(E))
+   {
+      if (maxX1 == TmaxX1) maxX1 -= 2;
+   }
+   if (block.lock()->hasInterpolationFlagCF(W))
+   {
+      if (minX1 == TminX1) minX1 += 2;
+   }
+   if (block.lock()->hasInterpolationFlagCF(N))
+   {
+      if (maxX2 == TmaxX2)  maxX2 -= 2;
+   }
+   if (block.lock()->hasInterpolationFlagCF(S))
+   {
+      if (minX2 == TminX2)  minX2 += 2;
+   }
+   if (block.lock()->hasInterpolationFlagCF(T))
+   {
+      if (maxX3 == TmaxX3)  maxX3 -= 2;
+   }
+   if (block.lock()->hasInterpolationFlagCF(B))
+   {
+      if (minX3 == TminX3)  minX3 += 2;
+   }
+
+   //E-W-N-S
+   if (block.lock()->hasInterpolationFlagCF(NE) && !block.lock()->hasInterpolationFlagCF(N) && !block.lock()->hasInterpolationFlagCF(E))
+   {
+      if (maxX1 == TmaxX1) maxX1 -= 2;
+      if (maxX2 == TmaxX2) maxX2 -= 2;
+   }
+   if (block.lock()->hasInterpolationFlagCF(SW) && !block.lock()->hasInterpolationFlagCF(W) && !block.lock()->hasInterpolationFlagCF(S))
+   {
+      if (minX1 == TminX1) minX1 += 2;
+      if (minX2 == TminX2) minX2 += 2;
+   }
+   if (block.lock()->hasInterpolationFlagCF(SE) && !block.lock()->hasInterpolationFlagCF(E) && !block.lock()->hasInterpolationFlagCF(S))
+   {
+      if (maxX1 == TmaxX1) maxX1 -= 2;
+      if (minX2 == TminX2) minX2 += 2;
+   }
+   if (block.lock()->hasInterpolationFlagCF(NW) && !block.lock()->hasInterpolationFlagCF(N) && !block.lock()->hasInterpolationFlagCF(W))
+   {
+      if (minX1 == TminX1) minX1 += 2;
+      if (maxX2 == TmaxX2) maxX2 -= 2;
+   }
+
+   //	////T-B-E-W
+   if (block.lock()->hasInterpolationFlagCF(TE) && !block.lock()->hasInterpolationFlagCF(E) && !block.lock()->hasInterpolationFlagCF(T))
+   {
+      if (maxX1 == TmaxX1) maxX1 -= 2;
+      if (maxX3 == TmaxX3) maxX3 -= 2;
+   }
+   if (block.lock()->hasInterpolationFlagCF(BW) && !block.lock()->hasInterpolationFlagCF(W) && !block.lock()->hasInterpolationFlagCF(B))
+   {
+      if (minX1 == TminX1) minX1 += 2;
+      if (minX3 == TminX3) minX3 += 2;
+   }
+   if (block.lock()->hasInterpolationFlagCF(BE) && !block.lock()->hasInterpolationFlagCF(E) && !block.lock()->hasInterpolationFlagCF(B))
+   {
+      if (maxX1 == TmaxX1) maxX1 -= 2;
+      if (minX3 == TminX3) minX3 += 2;
+   }
+   if (block.lock()->hasInterpolationFlagCF(TW) && !block.lock()->hasInterpolationFlagCF(W) && !block.lock()->hasInterpolationFlagCF(T))
+   {
+      if (minX1 == TminX1) minX1 += 2;
+      if (maxX3 == TmaxX3) maxX3 -= 2;
+   }
+
+
+   ////T-B-N-S
+   if (block.lock()->hasInterpolationFlagCF(TN) && !block.lock()->hasInterpolationFlagCF(N) && !block.lock()->hasInterpolationFlagCF(T))
+   {
+      if (maxX2 == TmaxX2) maxX2 -= 2;
+      if (maxX3 == TmaxX3) maxX3 -= 2;
+   }
+   if (block.lock()->hasInterpolationFlagCF(BS) && !block.lock()->hasInterpolationFlagCF(S) && !block.lock()->hasInterpolationFlagCF(B))
+   {
+      if (minX2 == TminX2) minX2 += 2;
+      if (minX3 == TminX3) minX3 += 2;
+   }
+   if (block.lock()->hasInterpolationFlagCF(BN) && !block.lock()->hasInterpolationFlagCF(N) && !block.lock()->hasInterpolationFlagCF(B))
+   {
+      if (maxX2 == TmaxX2) maxX2 -= 2;
+      if (minX3 == TminX3) minX3 += 2;
+   }
+   if (block.lock()->hasInterpolationFlagCF(TS) && !block.lock()->hasInterpolationFlagCF(S) && !block.lock()->hasInterpolationFlagCF(T))
+   {
+      if (minX2 == TminX2) minX2 += 2;
+      if (maxX3 == TmaxX3) maxX3 -= 2;
+   }
+
+   //if (block.lock()->hasInterpolationFlagCF(D3Q27System::TNE)&&!block.lock()->hasInterpolationFlagCF(D3Q27System::TE)&&!block.lock()->hasInterpolationFlagCF(D3Q27System::TN)&&!block.lock()->hasInterpolationFlagCF(D3Q27System::NE)&&!block.lock()->hasInterpolationFlagCF(D3Q27System::T)&&!block.lock()->hasInterpolationFlagCF(D3Q27System::N) && !block.lock()->hasInterpolationFlagCF(D3Q27System::E))
+   //if (!block.lock()->hasInterpolationFlagCF(D3Q27System::TE)&&!block.lock()->hasInterpolationFlagCF(D3Q27System::T)&& !block.lock()->hasInterpolationFlagCF(D3Q27System::E))
+   //{
+   //   if (maxX1==TmaxX1) maxX1 -= 2;
+   //   if (maxX2==TmaxX2) maxX2 -= 2;
+   //   if (maxX3==TmaxX3) maxX3 -= 2;
+   //}
+}
+//////////////////////////////////////////////////////////////////////////
+template< typename VectorTransmitter >
+void D3Q27ETCFOffVectorConnector< VectorTransmitter>::getLocalMinMax(int& minX1, int& minX2, int& minX3, int& maxX1, int& maxX2, int& maxX3, CFconnectorType connType)
+{
+   using namespace D3Q27System;
+   int TminX1 = minX1; int TminX2 = minX2; int TminX3 = minX3; int TmaxX1 = maxX1; int TmaxX2 = maxX2; int TmaxX3 = maxX3;
+
+   if (block.lock()->hasInterpolationFlagCF(E))
+   {
+      if (maxX1 == TmaxX1) maxX1 -= 2;
+   }
+   if (block.lock()->hasInterpolationFlagCF(W))
+   {
+      if (minX1 == TminX1) minX1 += 2;
+   }
+   if (block.lock()->hasInterpolationFlagCF(N))
+   {
+      if (maxX2 == TmaxX2)  maxX2 -= 2;
+   }
+   if (block.lock()->hasInterpolationFlagCF(S))
+   {
+      if (minX2 == TminX2)  minX2 += 2;
+   }
+   if (block.lock()->hasInterpolationFlagCF(T))
+   {
+      if (maxX3 == TmaxX3)  maxX3 -= 2;
+   }
+   if (block.lock()->hasInterpolationFlagCF(B))
+   {
+      if (minX3 == TminX3)  minX3 += 2;
+   }
+
+   //E-W-N-S
+   if (block.lock()->hasInterpolationFlagCF(NE) && !block.lock()->hasInterpolationFlagCF(N) && !block.lock()->hasInterpolationFlagCF(E))
+   {
+      if (maxX1 == TmaxX1) maxX1 -= 2;
+      if (maxX2 == TmaxX2) maxX2 -= 2;
+   }
+   if (block.lock()->hasInterpolationFlagCF(SW) && !block.lock()->hasInterpolationFlagCF(W) && !block.lock()->hasInterpolationFlagCF(S))
+   {
+      if (minX1 == TminX1) minX1 += 2;
+      if (minX2 == TminX2) minX2 += 2;
+   }
+   if (block.lock()->hasInterpolationFlagCF(SE) && !block.lock()->hasInterpolationFlagCF(E) && !block.lock()->hasInterpolationFlagCF(S))
+   {
+      if (maxX1 == TmaxX1) maxX1 -= 2;
+      if (minX2 == TminX2) minX2 += 2;
+   }
+   if (block.lock()->hasInterpolationFlagCF(NW) && !block.lock()->hasInterpolationFlagCF(N) && !block.lock()->hasInterpolationFlagCF(W))
+   {
+      if (minX1 == TminX1) minX1 += 2;
+      if (maxX2 == TmaxX2) maxX2 -= 2;
+   }
+
+   //	////T-B-E-W
+   if (block.lock()->hasInterpolationFlagCF(TE) && !block.lock()->hasInterpolationFlagCF(E) && !block.lock()->hasInterpolationFlagCF(T))
+   {
+      if (maxX1 == TmaxX1) maxX1 -= 2;
+      if (maxX3 == TmaxX3) maxX3 -= 2;
+   }
+   if (block.lock()->hasInterpolationFlagCF(BW) && !block.lock()->hasInterpolationFlagCF(W) && !block.lock()->hasInterpolationFlagCF(B))
+   {
+      if (minX1 == TminX1) minX1 += 2;
+      if (minX3 == TminX3) minX3 += 2;
+   }
+   if (block.lock()->hasInterpolationFlagCF(BE) && !block.lock()->hasInterpolationFlagCF(E) && !block.lock()->hasInterpolationFlagCF(B))
+   {
+      if (maxX1 == TmaxX1) maxX1 -= 2;
+      if (minX3 == TminX3) minX3 += 2;
+   }
+   if (block.lock()->hasInterpolationFlagCF(TW) && !block.lock()->hasInterpolationFlagCF(W) && !block.lock()->hasInterpolationFlagCF(T))
+   {
+      if (minX1 == TminX1) minX1 += 2;
+      if (maxX3 == TmaxX3) maxX3 -= 2;
+   }
+
+
+   ////T-B-N-S
+   if (block.lock()->hasInterpolationFlagCF(TN) && !block.lock()->hasInterpolationFlagCF(N) && !block.lock()->hasInterpolationFlagCF(T))
+   {
+      if (maxX2 == TmaxX2) maxX2 -= 2;
+      if (maxX3 == TmaxX3) maxX3 -= 2;
+   }
+   if (block.lock()->hasInterpolationFlagCF(BS) && !block.lock()->hasInterpolationFlagCF(S) && !block.lock()->hasInterpolationFlagCF(B))
+   {
+      if (minX2 == TminX2) minX2 += 2;
+      if (minX3 == TminX3) minX3 += 2;
+   }
+   if (block.lock()->hasInterpolationFlagCF(BN) && !block.lock()->hasInterpolationFlagCF(N) && !block.lock()->hasInterpolationFlagCF(B))
+   {
+      if (maxX2 == TmaxX2) maxX2 -= 2;
+      if (minX3 == TminX3) minX3 += 2;
+   }
+   if (block.lock()->hasInterpolationFlagCF(TS) && !block.lock()->hasInterpolationFlagCF(S) && !block.lock()->hasInterpolationFlagCF(T))
+   {
+      if (minX2 == TminX2) minX2 += 2;
+      if (maxX3 == TmaxX3) maxX3 -= 2;
+   }
+
+   //if (block.lock()->hasInterpolationFlagCF(D3Q27System::TNE)&&!block.lock()->hasInterpolationFlagCF(D3Q27System::TE)&&!block.lock()->hasInterpolationFlagCF(D3Q27System::TN)&&!block.lock()->hasInterpolationFlagCF(D3Q27System::NE)&&!block.lock()->hasInterpolationFlagCF(D3Q27System::T)&&!block.lock()->hasInterpolationFlagCF(D3Q27System::N) && !block.lock()->hasInterpolationFlagCF(D3Q27System::E))
+   //{
+   //   if (maxX1==TmaxX1) maxX1 -= 2;
+   //   if (maxX2==TmaxX2) maxX2 -= 2;
+   //   if (maxX3==TmaxX3) maxX3 -= 2;
+   //}
+}
+//////////////////////////////////////////////////////////////////////////
+template< typename VectorTransmitter >
+void D3Q27ETCFOffVectorConnector< VectorTransmitter>::findCFnodes()
+{
+   SPtr<DistributionArray3D>  fFrom = block.lock()->getKernel()->getDataSet()->getFdistributions();
+   int maxX1 = (int)fFrom->getNX1();
+   int maxX2 = (int)fFrom->getNX2();
+   int maxX3 = (int)fFrom->getNX3();
+   int minX1 = 0;
+   int minX2 = 0;
+   int minX3 = 0;
+
+   int indexEvEv = 0;
+   int indexEvOd = 0;
+   int indexOdEv = 0;
+   int indexOdOd = 0;
+
+   vector_type& dataEvEv = this->senderEvenEvenSW->getData();
+   vector_type& dataEvOd = this->senderEvenOddNW->getData();
+   vector_type& dataOdEv = this->senderOddEvenSE->getData();
+   vector_type& dataOdOd = this->senderOddOddNE->getData();
+
+   int lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3;
+
+   using namespace D3Q27System;
+   if (block.lock()->hasInterpolationFlagCF(W))
+   {
+      lMinX1 = 1;
+      lMaxX1 = lMinX1 + 1;
+
+      getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, false);
+      getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, false);
+      findCFnodes(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
+
+      getLocalMinMax(minX2, maxX2, true, lMinX2, lMaxX2, false);
+      getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, false);
+      findCFnodes(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvOd, indexEvOd);
+
+      getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, false);
+      getLocalMinMax(minX3, maxX3, true, lMinX3, lMaxX3, false);
+      findCFnodes(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
+
+      getLocalMinMax(minX2, maxX2, false, lMinX2, lMaxX2, false);
+      getLocalMinMax(minX3, maxX3, false, lMinX3, lMaxX3, false);
+      findCFnodes(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdOd, indexOdOd);
+   }
+   if (block.lock()->hasInterpolationFlagCF(TN) && !block.lock()->hasInterpolationFlagCF(N) && !block.lock()->hasInterpolationFlagCF(T))
+   {
+      lMinX2 = maxX2 - 3;
+      lMaxX2 = lMinX2 + 1;
+      lMinX3 = maxX3 - 3;
+      lMaxX3 = lMinX3 + 1;
+
+      getLocalMinMax(minX1 + 1, maxX1, true, lMinX1, lMaxX1, false);
+      findCFnodes(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataEvEv, indexEvEv);
+
+      getLocalMinMax(minX1 + 1, maxX1, false, lMinX1, lMaxX1, false);
+      findCFnodes(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, dataOdEv, indexOdEv);
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+template<  typename VectorTransmitter  >
+void D3Q27ETCFOffVectorConnector< VectorTransmitter>::findCFnodes(SPtr<DistributionArray3D> fFrom, const int& lMinX1, const int& lMinX2, const int& lMinX3, const int& lMaxX1, const int& lMaxX2, const int& lMaxX3, vector_type& data, int& index)
+{
+   if (data.size() == 0) return;
+   int ix1, ix2, ix3;
+   LBMReal xoff, yoff, zoff;
+   SPtr<BCArray3D> bcArray = block.lock()->getKernel()->getBCProcessor()->getBCArray();
+
+   for (ix3 = lMinX3; ix3 < lMaxX3; ix3++)
+   {
+      for (ix2 = lMinX2; ix2 < lMaxX2; ix2++)
+      {
+         for (ix1 = lMinX1; ix1 < lMaxX1; ix1++)
+         {
+            D3Q27ICell icellC;
+            D3Q27ICell icellF;
+
+            int howManySolids = iprocessor->iCellHowManySolids(bcArray, ix1, ix2, ix3);
+
+            if (howManySolids == 0 || howManySolids == 8)
+            {
+               iprocessor->readICell(fFrom, icellC, ix1, ix2, ix3);
+               xoff = 0.0;
+               yoff = 0.0;
+               zoff = 0.0;
+            }
+            else
+            {
+               if (!iprocessor->findNeighborICell(bcArray, fFrom, icellC, bMaxX1, bMaxX2, bMaxX3, ix1, ix2, ix3, xoff, yoff, zoff))
+               {
+                  std::string err = "For " + block.lock()->toString() + " x1=" + UbSystem::toString(ix1) + ", x2=" + UbSystem::toString(ix2) + ", x3=" + UbSystem::toString(ix3) +
+                     " interpolation is not implemented for other direction" +
+                     " by using in: " + (std::string)typeid(*this).name() +
+                     " or maybe you have a solid on the block boundary";
+                  //UBLOG(logINFO, err);
+                  UB_THROW(UbException(UB_EXARGS, err));
+               }
+            }
+
+            iprocessor->interpolateCoarseToFine(icellC, icellF, xoff, yoff, zoff);
+            this->writeICellFtoData(data, index, icellF);
+            //for (int iix3 = ix3; iix3<=ix3+1; iix3++)
+            //{
+            //   for (int iix2 = ix2; iix2<=ix2+1; iix2++)
+            //   {
+            //      for (int iix1 = ix1; iix1<=ix1+1; iix1++)
+            //      {
+            //         bcArray->setInterfaceCF(iix1, iix2, iix3);
+            //      }
+            //   }
+            //}
+
+         }
+      }
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+template< typename VectorTransmitter >
+double D3Q27ETCFOffVectorConnector<VectorTransmitter>::getSendRecieveTime()
+{
+   return 0;
+}
+
+#endif 
diff --git a/src/cpu/VirtualFluidsCore/Connectors/D3Q27ETFCOffVectorConnector.cpp b/src/cpu/VirtualFluidsCore/Connectors/D3Q27ETFCOffVectorConnector.cpp
index 41e9f74caf2663a9e78d20ff26002faf5548f4f3..f745d7597cc79bad851450d1751b0935d535621c 100644
--- a/src/cpu/VirtualFluidsCore/Connectors/D3Q27ETFCOffVectorConnector.cpp
+++ b/src/cpu/VirtualFluidsCore/Connectors/D3Q27ETFCOffVectorConnector.cpp
@@ -1,3 +1,3 @@
-#include "D3Q27ETFCOffVectorConnector.h"
-
-
+#include "D3Q27ETFCOffVectorConnector.h"
+
+
diff --git a/src/cpu/VirtualFluidsCore/Connectors/D3Q27ETFCOffVectorConnector.h b/src/cpu/VirtualFluidsCore/Connectors/D3Q27ETFCOffVectorConnector.h
index 59c6539a1619d7637ffd3c5dab36b9d079835fbc..a82f13c046c99b0712d53b5440efcf856c1bc905 100644
--- a/src/cpu/VirtualFluidsCore/Connectors/D3Q27ETFCOffVectorConnector.h
+++ b/src/cpu/VirtualFluidsCore/Connectors/D3Q27ETFCOffVectorConnector.h
@@ -1,1437 +1,1437 @@
-/**
-* @file D3Q27ETFCOffVectorConnector.h
-* @class D3Q27ETFCVectorConnector
-* @brief Interpolation from fine level to coarse.
-* @author Kostyantyn Kucher and Ehsan Fard
-* @date 08.06.2011
-*/
-#ifndef D3Q27ETFCOffVectorConnector_H
-#define D3Q27ETFCOffVectorConnector_H
-
-#include <vector>
-
-#include "basics/transmitter/TbTransmitter.h"
-#include "Block3DConnector.h"
-#include "D3Q27System.h"
-#include "Block3D.h"
-#include "Grid3D.h"
-#include "LBMKernel.h"
-#include "InterpolationProcessor.h"
-#include "MathUtil.hpp"
-#include <PointerDefinitions.h>
-
-#include "BCProcessor.h"
-#include "DataSet3D.h"
-
-class Block3D;
-
-enum CFconnectorType {EvenOddNW, EvenEvenSW, OddEvenSE, OddOddNE};
-
-//daten werden in einen vector (dieser befindet sich im transmitter) kopiert
-//der vector wird via transmitter uebertragen
-//transmitter kann ein lokal, MPI, RCG, CTL oder was auch immer fuer ein
-//transmitter sein, der von Transmitter abgeleitet ist ;-)
-
-template< typename VectorTransmitter >
-class D3Q27ETFCOffVectorConnector : public Block3DConnector
-{
-public:
-
-protected:
-	typedef typename VectorTransmitter::value_type  vector_type;
-	typedef SPtr< VectorTransmitter > VectorTransmitterPtr;
-public:
-   D3Q27ETFCOffVectorConnector(SPtr<Block3D> block, VectorTransmitterPtr sender, VectorTransmitterPtr receiver, int sendDir, 
-      InterpolationProcessorPtr iprocessor, CFconnectorType connType);
-
-	bool isLocalConnector();
-	bool isRemoteConnector();
-	void init();
-
-	void sendTransmitterDataSize();
-	void receiveTransmitterDataSize();
-
-	void prepareForSend();
-	void sendVectors();
-
-	void prepareForReceive();
-	void receiveVectors();
-
-	void fillSendVectors();
-	void distributeReceiveVectors();
-
-	bool isInterpolationConnectorCF() { return false; }
-	bool isInterpolationConnectorFC() { return true; }
-
-	double getSendRecieveTime();
-
-	void prepareForSendX1() {}
-	void prepareForSendX2() {}
-	void prepareForSendX3() {}
-
-	void sendVectorsX1(){}
-	void sendVectorsX2(){}
-	void sendVectorsX3(){}
-
-	void prepareForReceiveX1() {}
-	void prepareForReceiveX2() {}
-	void prepareForReceiveX3() {}
-
-	void receiveVectorsX1() {}
-	void receiveVectorsX2() {}
-	void receiveVectorsX3() {}
-
-protected:
-	WPtr<Block3D> block; //dieser nvd sendet daten und die empfangenen werden diesem nvd zugeordnet
-	//gegenstelle muss "inversen" connector besitzen
-	VectorTransmitterPtr sender, receiver;
-
-	InterpolationProcessorPtr iprocessor;
-
-   CFconnectorType connType;
-
-	void writeICellCtoData(vector_type& data, int& index, LBMReal* icellC);
-	void writeNodeToVector(vector_type& data, int& index, LBMReal* inode);
-	void getLocalMinMax(int& minX1, int& minX2, int& minX3, int& maxX1, int& maxX2, int& maxX3);
-   void getLocalMinMax(int& minX1, int& minX2, int& minX3, int& maxX1, int& maxX2, int& maxX3, CFconnectorType connType);
-	void getLocalMinMaxCF(int gMax, int& lMin, int& lMax);
-	void fillSendVector(SPtr<DistributionArray3D> fFrom, const int& lMinX1, const int& lMinX2, const int& lMinX3, const int& lMaxX1, const int& lMaxX2, const int& lMaxX3, vector_type& data, int& index);
-
-	void distributeReceiveVector(SPtr<DistributionArray3D> fTo, const int& lMinX1, const int& lMinX2, const int& lMinX3, const int& lMaxX1, const int& lMaxX2, const int& lMaxX3, vector_type& data, int& index);
-	void readICellFfromData(vector_type& data, int& index, D3Q27ICell& icellF);
-	void readNodeFromVector(vector_type& data, int& index, LBMReal* inode);
-	void getLocalOffsets(const int& gMax, int& oMin);
-	void getLocalMins(int& minX1, int& minX2, int& minX3, const int& oMinX1, const int& oMinX2, const int& oMinX3);
-
-	int bMaxX1, bMaxX2, bMaxX3;
-};
-////////////////////////////////////////////////////////////////////////////
-template< typename VectorTransmitter >
-D3Q27ETFCOffVectorConnector<VectorTransmitter>::D3Q27ETFCOffVectorConnector(SPtr<Block3D> block, VectorTransmitterPtr sender, 
-																			VectorTransmitterPtr receiver, int sendDir, 
-																			InterpolationProcessorPtr iprocessor,
-                                                         CFconnectorType connType)
-																			: Block3DConnector(sendDir)
-																			, block(block)
-																			, sender(sender)
-																			, receiver(receiver)
-																			, iprocessor(iprocessor)
-																			, connType(connType)
-{
-	if( !(   sendDir==D3Q27System::E  || sendDir==D3Q27System::W  || sendDir==D3Q27System::N  || sendDir==D3Q27System::S  || sendDir==D3Q27System::T || sendDir==D3Q27System::B 
-		||  sendDir==D3Q27System::NE || sendDir==D3Q27System::SW || sendDir==D3Q27System::SE || sendDir==D3Q27System::NW
-		||  sendDir==D3Q27System::TE || sendDir==D3Q27System::BW ||  sendDir==D3Q27System::BE || sendDir==D3Q27System::TW
-		||  sendDir==D3Q27System::TN || sendDir==D3Q27System::BS ||  sendDir==D3Q27System::BN || sendDir==D3Q27System::TS 
-
-		||  sendDir==D3Q27System::TNE || sendDir==D3Q27System::TNW ||  sendDir==D3Q27System::TSE || sendDir==D3Q27System::TSW
-		||  sendDir==D3Q27System::BNE || sendDir==D3Q27System::BNW ||  sendDir==D3Q27System::BSE || sendDir==D3Q27System::BSW 
-		
-		) )
-	{
-		throw UbException(UB_EXARGS,"invalid constructor for this direction");
-	}
-}
-//////////////////////////////////////////////////////////////////////////
-template< typename VectorTransmitter >
-bool D3Q27ETFCOffVectorConnector<VectorTransmitter>::isLocalConnector()
-{ 
-	return !this->isRemoteConnector(); 
-}
-//////////////////////////////////////////////////////////////////////////
-template< typename VectorTransmitter >
-bool D3Q27ETFCOffVectorConnector<VectorTransmitter>::isRemoteConnector() 
-{ 
-	return sender->isRemoteTransmitter()  ||  receiver->isRemoteTransmitter();
-}
-//////////////////////////////////////////////////////////////////////////
-template< typename VectorTransmitter >
-void D3Q27ETFCOffVectorConnector<VectorTransmitter>::sendTransmitterDataSize()  
-{ 
-	if(sender)
-	{
-		UBLOG(logDEBUG5, "D3Q27ETFCOffVectorConnector<VectorTransmitter>::sendTransmitterDataSize()"<<block.lock()->toString()+"sendDir="<<sendDir);
-		sender->sendDataSize(); 
-	}
-}
-//////////////////////////////////////////////////////////////////////////
-template< typename VectorTransmitter >
-void D3Q27ETFCOffVectorConnector<VectorTransmitter>::receiveTransmitterDataSize()
-{ 
-	if(receiver)
-	{
-		UBLOG(logDEBUG5, "D3Q27ETFCOffVectorConnector<VectorTransmitter>::receiveTransmitterDataSize()"<<block.lock()->toString()<<"sendDir="<<sendDir);
-		receiver->receiveDataSize();
-	}
-}
-//////////////////////////////////////////////////////////////////////////
-template< typename VectorTransmitter >
-void D3Q27ETFCOffVectorConnector<VectorTransmitter>::prepareForSend()
-{ 
-	if(sender) sender->prepareForSend(); 
-}
-//////////////////////////////////////////////////////////////////////////
-template< typename VectorTransmitter >
-void D3Q27ETFCOffVectorConnector<VectorTransmitter>::sendVectors()     
-{ 
-	if(sender) sender->sendData();
-}
-//////////////////////////////////////////////////////////////////////////
-template< typename VectorTransmitter >
-void D3Q27ETFCOffVectorConnector<VectorTransmitter>::prepareForReceive()     
-{ 
-	if(receiver) receiver->prepareForReceive(); 
-}
-//////////////////////////////////////////////////////////////////////////
-template< typename VectorTransmitter >
-void D3Q27ETFCOffVectorConnector<VectorTransmitter>::receiveVectors() 
-{ 
-	if(receiver) receiver->receiveData(); 
-}
-//////////////////////////////////////////////////////////////////////////
-template< typename VectorTransmitter >
-void D3Q27ETFCOffVectorConnector<VectorTransmitter>::init()
-{
-	using namespace D3Q27System;
-
-	bMaxX1 = (int)block.lock()->getKernel()->getDataSet()->getFdistributions()->getNX1();
-	bMaxX2 = (int)block.lock()->getKernel()->getDataSet()->getFdistributions()->getNX2();
-	bMaxX3 = (int)block.lock()->getKernel()->getDataSet()->getFdistributions()->getNX3();
-
-	int       sendSize  = 0;
-	LBMReal initValue = -999.0;
-
-	int sendDataPerNode = 27/*f*/;
-	int iCellSize = 1; //size of interpolation cell
-
-	switch(this->sendDir)
-	{		                  
-	case E : case W : sendSize = (bMaxX2-1)/2*(bMaxX3-1)/2*sendDataPerNode*iCellSize; break; 
-	case N : case S : sendSize = (bMaxX1-1)/2*(bMaxX3-1)/2*sendDataPerNode*iCellSize; break; 
-	case T : case B : sendSize = (bMaxX1-1)/2*(bMaxX2-1)/2*sendDataPerNode*iCellSize; break; 		  
-	case NE : case SW :case SE : case NW : sendSize = (3*bMaxX3-3)*sendDataPerNode*iCellSize; break; // buffer overhead, should be (3*bMaxX3-6) for even bMax3		
-	case TE : case BW :case BE : case TW : sendSize = (3*bMaxX2-3)*sendDataPerNode*iCellSize; break; 
-	case TN : case BS :case BN : case TS : sendSize = (3*bMaxX1-3)*sendDataPerNode*iCellSize; break;	
-   case TNE: case TNW:case TSE: case TSW:case BNE: case BNW:case BSE: case BSW: sendSize = 3*(3*bMaxX1-3)*sendDataPerNode*iCellSize; break;
-	default: throw UbException(UB_EXARGS,"direction not allowed in this constructor");
-	}
-	sender->getData().resize(sendSize, initValue);
-}
-//////////////////////////////////////////////////////////////////////////
-template< typename VectorTransmitter >
-void D3Q27ETFCOffVectorConnector< VectorTransmitter>::fillSendVectors() 
-{ 
-	using namespace D3Q27System;
-
-	SPtr<DistributionArray3D>  fFrom = block.lock()->getKernel()->getDataSet()->getFdistributions();
-	int maxX1 = (int)fFrom->getNX1();
-	int maxX2 = (int)fFrom->getNX2();
-	int maxX3 = (int)fFrom->getNX3();
-	int minX1 = 0;
-	int minX2 = 0;
-	int minX3 = 0;
-
-	int oMinX1, oMinX2, oMinX3; 
-	getLocalOffsets(maxX1, oMinX1);
-	getLocalOffsets(maxX2, oMinX2);
-	getLocalOffsets(maxX3, oMinX3);
-
-	int lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3;
-	int index = 0;
-	vector_type& data = sender->getData();
-
-	lMinX1 = minX1+1; lMinX2 = minX2+1; lMinX3 = minX3+1;
-	lMaxX1 = maxX1-2; lMaxX2 = maxX2-2; lMaxX3 = maxX3-2;
-
-   ///////////////////////////////////////
-   ///DEBUG
-#ifdef _DEBUG
-   if (block.lock()->getGlobalID() == 2558)
-   {
-      int test = 0;
-   }
-#endif
-   //////////////
-
-	switch(sendDir)
-	{
-	case E: 
-		getLocalMinMax(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3);
-		getLocalMins(lMinX1, lMinX2, lMinX3, oMinX1, oMinX2, oMinX3);
-		lMinX1 = maxX1-7;
-		lMaxX1 = lMinX1 + 1;
-		fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
-		break;
-	case W: 
-      ///////////////////////////////////////
-      ///DEBUG
-#ifdef _DEBUG
-      if (block.lock()->getGlobalID() == 2516)
-      {
-         int test = 0;
-      }
-#endif
-      //////////////
-		//getLocalMinMax(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, none);
-      getLocalMinMax(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3);
-		getLocalMins(lMinX1, lMinX2, lMinX3, oMinX1, oMinX2, oMinX3);
-		lMinX1 = 5;
-		lMaxX1 = lMinX1 + 1;
-		fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
-		break;  
-	case N:
-		getLocalMinMax(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3);
-		getLocalMins(lMinX1, lMinX2, lMinX3, oMinX1, oMinX2, oMinX3);
-		lMinX2 = maxX2-7;
-		lMaxX2 = lMinX2 + 1;
-		fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
-		break;
-	case S:
-		getLocalMinMax(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3);
-		getLocalMins(lMinX1, lMinX2, lMinX3, oMinX1, oMinX2, oMinX3);
-		lMinX2 = 5;
-		lMaxX2 = lMinX2 + 1;
-		fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
-		break;
-	case T:
-		getLocalMinMax(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3);
-		getLocalMins(lMinX1, lMinX2, lMinX3, oMinX1, oMinX2, oMinX3);
-		lMinX3 = maxX3-7;
-		lMaxX3 = lMinX3 + 1;
-		fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
-		break;
-	case B:
-		getLocalMinMax(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3);
-		getLocalMins(lMinX1, lMinX2, lMinX3, oMinX1, oMinX2, oMinX3);
-		lMinX3 = 5;
-		lMaxX3 = lMinX3 + 1;
-		fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
-		break;
-
-	//	////N-S-E-W
-	case NE: 
-		getLocalMinMax(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3);
-		getLocalMins(lMinX1, lMinX2, lMinX3, oMinX1, oMinX2, oMinX3);
-		lMinX1 = maxX1-7;
-		lMaxX1 = lMinX1 +5;
-		lMinX2 = maxX2-7;
-		lMaxX2 = lMinX2 + 1;
-		fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
-		
-		lMinX1 = maxX1-7;
-		lMaxX1 = lMinX1 + 1;
-		lMinX2 = maxX2-7;
-		lMaxX2 = lMinX2 + 5;
-		fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
-		break;
-	case SW: 
-		
-		getLocalMinMax(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3);
-		getLocalMins(lMinX1, lMinX2, lMinX3, oMinX1, oMinX2, oMinX3);
-		lMinX1 = 1;
-		lMaxX1 = lMinX1 + 5;
-		lMinX2 = 5;
-		lMaxX2 = lMinX2 + 1;
-		fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
-
-		lMinX1 = 5;
-		lMaxX1 = lMinX1 + 1;
-		lMinX2 = 1;
-		lMaxX2 = lMinX2 + 5;
-		fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
-		break;
-
-	case SE: 
-		getLocalMinMax(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3);
-		getLocalMins(lMinX1, lMinX2, lMinX3, oMinX1, oMinX2, oMinX3);
-		lMinX1 = maxX1-7;
-		lMaxX1 = lMinX1 +5;
-		lMinX2 = 5;
-		lMaxX2 = lMinX2 + 1;
-		fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
-		
-		lMinX1 = maxX1-7;
-		lMaxX1 = lMinX1 + 1;
-		lMinX2 = 1;
-		lMaxX2 = lMinX2 + 5;
-		fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
-
-		break;
-
-	case NW: 
-		getLocalMinMax(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3);
-		getLocalMins(lMinX1, lMinX2, lMinX3, oMinX1, oMinX2, oMinX3);
-		lMinX1 = 1;
-		lMaxX1 = lMinX1 + 5;
-		lMinX2 = maxX2-7;
-		lMaxX2 = lMinX2 + 1;
-		fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
-
-		lMinX1 = 5;
-		lMaxX1 = lMinX1 + 1;
-		lMinX2 = maxX2-7;
-		lMaxX2 = lMinX2 + 5;
-		fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
-		break;
-//////T-B-E-W
-	case TE: 
-		getLocalMinMax(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3);
-		getLocalMins(lMinX1, lMinX2, lMinX3, oMinX1, oMinX2, oMinX3);
-		lMinX1 = maxX1-7;
-		lMaxX1 = lMinX1 +5;
-		lMinX3 = maxX3-7;
-		lMaxX3 = lMinX3 + 1;
-		fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
-
-		lMinX1 = maxX1-7;
-		lMaxX1 = lMinX1 + 1;
-		lMinX3 = maxX3-7;
-		lMaxX3 = lMinX3 + 5;
-		fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
-		break;
-
-	case BW: 
-		getLocalMinMax(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3);
-		getLocalMins(lMinX1, lMinX2, lMinX3, oMinX1, oMinX2, oMinX3);
-		lMinX1 = 1;
-		lMaxX1 = lMinX1 + 5;
-		lMinX3 = 5;
-		lMaxX3 = lMinX3 + 1;
-		fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
-
-		lMinX1 = 5;
-		lMaxX1 = lMinX1 + 1;
-		lMinX3 = 1;
-		lMaxX3 = lMinX3 + 5;
-		fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
-		break;
-
-	case BE: 
-		getLocalMinMax(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3);
-		getLocalMins(lMinX1, lMinX2, lMinX3, oMinX1, oMinX2, oMinX3);
-		lMinX1 = maxX1-7;
-		lMaxX1 = lMinX1 +5;
-		lMinX3 = 5;
-		lMaxX3 = lMinX3 + 1;
-		fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
-
-		lMinX1 = maxX1-7;
-		lMaxX1 = lMinX1 + 1;
-		lMinX3 = 1;
-		lMaxX3 = lMinX3 + 5;
-		fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
-		break;
-
-	case TW: 
-		getLocalMinMax(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3);
-		getLocalMins(lMinX1, lMinX2, lMinX3, oMinX1, oMinX2, oMinX3);
-		lMinX1 = 1;
-		lMaxX1 = lMinX1 + 5;
-		lMinX3 = maxX3-7;
-		lMaxX3 = lMinX3 + 1;
-		fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
-
-		lMinX1 = 5;
-		lMaxX1 = lMinX1 + 1;
-		lMinX3 = maxX3-7;
-		lMaxX3 = lMinX3 + 5;
-		fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
-		break;
-///////////////T-B-N-S
-//
-	case TN: 
-		getLocalMinMax(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3);
-		getLocalMins(lMinX1, lMinX2, lMinX3, oMinX1, oMinX2, oMinX3);
-		lMinX2 = maxX2-7;
-		lMaxX2 = lMinX2 + 5;
-		lMinX3 = maxX3-7;
-		lMaxX3 = lMinX3 + 1;
-		fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
-
-		lMinX2 = maxX2-7;
-		lMaxX2 = lMinX2 + 1;
-		lMinX3 = maxX3-7;
-		lMaxX3 = lMinX3 + 5;
-		fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
-		break;
-
-	case BS: 
-		getLocalMinMax(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3);
-		getLocalMins(lMinX1, lMinX2, lMinX3, oMinX1, oMinX2, oMinX3);
-		lMinX2 = 1;
-		lMaxX2 = lMinX2 + 5;
-		lMinX3 = 5;
-		lMaxX3 = lMinX3 + 1;
-		fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
-
-		lMinX2 = 5;
-		lMaxX2 = lMinX2 + 1;
-		lMinX3 = 1;
-		lMaxX3 = lMinX3 + 5;
-		fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
-		break;
-
-	case BN: 
-		getLocalMinMax(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3);
-		getLocalMins(lMinX1, lMinX2, lMinX3, oMinX1, oMinX2, oMinX3);
-		lMinX2 = maxX2-7;
-		lMaxX2 = lMinX2 + 5;
-		lMinX3 = 5;
-		lMaxX3 = lMinX3 + 1;
-		fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
-
-		lMinX2 = maxX2-7;
-		lMaxX2 = lMinX2 + 1;
-		lMinX3 = 1;
-		lMaxX3 = lMinX3 + 5;
-		fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
-		break;
-
-	case TS: 
-		getLocalMinMax(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3);
-		getLocalMins(lMinX1, lMinX2, lMinX3, oMinX1, oMinX2, oMinX3);
-		lMinX2 = 1;
-		lMaxX2 = lMinX2 + 5;
-		lMinX3 = maxX3-7;
-		lMaxX3 = lMinX3 + 1;
-		fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
-
-		lMinX2 = 5;
-		lMaxX2 = lMinX2 + 1;
-		lMinX3 = maxX3-7;
-		lMaxX3 = lMinX3 + 5;
-		fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
-		break;
-   
-   //TNE
-   case TNE:
-      lMinX1 = maxX1-7;
-      lMaxX1 = maxX1-6;
-      lMinX2 = maxX2-7;
-      lMaxX2 = maxX2-2;
-      lMinX3 = maxX3-7;
-      lMaxX3 = maxX3-2;
-      fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
-
-      lMinX1 = maxX1-7;
-      lMaxX1 = maxX1-2;
-      lMinX2 = maxX2-7;
-      lMaxX2 = maxX2-6;
-      lMinX3 = maxX3-7;
-      lMaxX3 = maxX3-2;
-      fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
-
-      lMinX1 = maxX1-7;
-      lMaxX1 = maxX1-2;
-      lMinX2 = maxX2-7;
-      lMaxX2 = maxX2-2;
-      lMinX3 = maxX3-7;
-      lMaxX3 = maxX3-6;
-      fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
-      break;
-
-
-   //TNW
-   case TNW:
-      lMinX1 = 5;
-      lMaxX1 = 6;
-      lMinX2 = maxX2-7;
-      lMaxX2 = maxX2-2;
-      lMinX3 = maxX3-7;
-      lMaxX3 = maxX3-2;
-      fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
-
-      lMinX1 = 1;
-      lMaxX1 = 6;
-      lMinX2 = maxX2-7;
-      lMaxX2 = maxX2-6;
-      lMinX3 = maxX3-7;
-      lMaxX3 = maxX3-2;
-      fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
-
-      lMinX1 = 1;
-      lMaxX1 = 6;
-      lMinX2 = maxX2-7;
-      lMaxX2 = maxX2-2;
-      lMinX3 = maxX3-7;
-      lMaxX3 = maxX3-6;
-      fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
-      break;
-
-      break;
-   
-   //      TSE
-   case TSE:
-      lMinX1 = maxX1-7;
-      lMaxX1 = maxX1-6;
-      lMinX2 = 1;
-      lMaxX2 = 6;
-      lMinX3 = maxX3-7;
-      lMaxX3 = maxX3-2;
-      fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
-
-      lMinX1 = maxX1-7;
-      lMaxX1 = maxX1-2;
-      lMinX2 = 5;
-      lMaxX2 = 6;
-      lMinX3 = maxX3-7;
-      lMaxX3 = maxX3-2;
-      fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
-
-      lMinX1 = maxX1-7;
-      lMaxX1 = maxX1-2;
-      lMinX2 = 1;
-      lMaxX2 = 6;
-      lMinX3 = maxX3-7;
-      lMaxX3 = maxX3-6;
-      fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
-
-      break;
-   //      TSW
-   case TSW:
-      lMinX1 = 5;
-      lMaxX1 = 6;
-      lMinX2 = 1;
-      lMaxX2 = 6;
-      lMinX3 = maxX3-7;
-      lMaxX3 = maxX3-2;
-      fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
-
-      lMinX1 = 1;
-      lMaxX1 = 6;
-      lMinX2 = 5;
-      lMaxX2 = 6;
-      lMinX3 = maxX3-7;
-      lMaxX3 = maxX3-2;
-      fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
-
-      lMinX1 = 1;
-      lMaxX1 = 6;
-      lMinX2 = 1;
-      lMaxX2 = 6;
-      lMinX3 = maxX3-7;
-      lMaxX3 = maxX3-6;
-      fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
-
-      break;
-   //      BNE
-   case BNE:
-      lMinX1 = maxX1-7;
-      lMaxX1 = maxX1-6;
-      lMinX2 = maxX2-7;
-      lMaxX2 = maxX2-2;
-      lMinX3 = 1;
-      lMaxX3 = 6;
-      fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
-
-      lMinX1 = maxX1-7;
-      lMaxX1 = maxX1-2;
-      lMinX2 = maxX2-7;
-      lMaxX2 = maxX2-6;
-      lMinX3 = 1;
-      lMaxX3 = 6;
-      fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
-
-      lMinX1 = maxX1-7;
-      lMaxX1 = maxX1-2;
-      lMinX2 = maxX2-7;
-      lMaxX2 = maxX2-2;
-      lMinX3 = 5;
-      lMaxX3 = 6;
-      fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
-
-      break;
-   //      BNW
-   case BNW:
-      lMinX1 = 5;
-      lMaxX1 = 6;
-      lMinX2 = maxX2-7;
-      lMaxX2 = maxX2-2;
-      lMinX3 = 1;
-      lMaxX3 = 6;
-      fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
-
-      lMinX1 = 1;
-      lMaxX1 = 6;
-      lMinX2 = maxX2-7;
-      lMaxX2 = maxX2-6;
-      lMinX3 = 1;
-      lMaxX3 = 6;
-      fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
-
-      lMinX1 = 1;
-      lMaxX1 = 6;
-      lMinX2 = maxX2-7;
-      lMaxX2 = maxX2-2;
-      lMinX3 = 5;
-      lMaxX3 = 6;
-      fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
-
-      break;
-
-
-   //      BSE
-   case BSE:
-      lMinX1 = maxX1-7;
-      lMaxX1 = maxX1-6;
-      lMinX2 = 1;
-      lMaxX2 = 6;
-      lMinX3 = 1;
-      lMaxX3 = 6;
-      fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
-
-      lMinX1 = maxX1-7;
-      lMaxX1 = maxX1-2;
-      lMinX2 = 5;
-      lMaxX2 = 6;
-      lMinX3 = 1;
-      lMaxX3 = 6;
-      fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
-
-      lMinX1 = maxX1-7;
-      lMaxX1 = maxX1-2;
-      lMinX2 = 1;
-      lMaxX2 = 6;
-      lMinX3 = 5;
-      lMaxX3 = 6;
-      fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
-
-      break;
-
-   //BSW
-   case BSW:
-      lMinX1 = 5;
-      lMaxX1 = 6;
-      lMinX2 = 1;
-      lMaxX2 = 6;
-      lMinX3 = 1;
-      lMaxX3 = 6;
-      fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
-      
-      lMinX1 = 1;
-      lMaxX1 = 6;
-      lMinX2 = 5;
-      lMaxX2 = 6;
-      lMinX3 = 1;
-      lMaxX3 = 6;
-      fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
-
-      lMinX1 = 1;
-      lMaxX1 = 6;
-      lMinX2 = 1;
-      lMaxX2 = 6;
-      lMinX3 = 5;
-      lMaxX3 = 6;
-      fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
-
-      break;
-	}
-}
-//////////////////////////////////////////////////////////////////////////
-template<  typename VectorTransmitter  > 
-void D3Q27ETFCOffVectorConnector< VectorTransmitter>::fillSendVector(SPtr<DistributionArray3D> fFrom, const int& lMinX1, const int& lMinX2, const int& lMinX3, const int& lMaxX1, const int& lMaxX2, const int& lMaxX3, vector_type& data, int& index)
-{
-	int ix1, ix2, ix3;
-	LBMReal xoff, yoff, zoff;
-	SPtr<BCArray3D> bcArray = block.lock()->getKernel()->getBCProcessor()->getBCArray();
-
-	for (ix3=lMinX3; ix3<lMaxX3; ix3+=2)
-	{
-		for (ix2=lMinX2; ix2<lMaxX2; ix2+=2)
-		{
-			for (ix1=lMinX1; ix1<lMaxX1; ix1+=2)
-			{
-				LBMReal icellC[27];
-				D3Q27ICell icellF;
-
-				int howManySolids= iprocessor->iCellHowManySolids(bcArray, ix1, ix2, ix3);
-
-				if(howManySolids == 0 || howManySolids == 8)
-				{
-					iprocessor->readICell(fFrom, icellF, ix1, ix2, ix3);
-					xoff=0.0; 
-					yoff=0.0;
-					zoff=0.0;
-				}
-				else
-				{
-					if(!iprocessor->findNeighborICell(bcArray, fFrom, icellF, bMaxX1, bMaxX2, bMaxX3, ix1, ix2, ix3, xoff, yoff, zoff))
-					{
-						std::string err = "For "+block.lock()->toString()+" x1="+UbSystem::toString(ix1)+", x2=" + UbSystem::toString(ix2)+", x3=" + UbSystem::toString(ix3)+
-							" interpolation is not implemented for other direction"+
-							" by using in: "+(std::string)typeid(*this).name()+ 
-							" or maybe you have a solid on the block boundary";
-                  //UBLOG(logINFO, err);
-						UB_THROW(UbException(UB_EXARGS, err));
-					}
-				}
-
-				iprocessor->interpolateFineToCoarse(icellF, icellC, xoff, yoff, zoff);
-				this->writeICellCtoData(data, index, icellC);
-			}
-		}
-	}
-}
-//////////////////////////////////////////////////////////////////////////
-template<  typename VectorTransmitter  > 
-void D3Q27ETFCOffVectorConnector< VectorTransmitter>::writeICellCtoData(vector_type& data, int& index, LBMReal* icellC) 
-{
-	for (int i = D3Q27System::STARTF; i < D3Q27System::ENDF+1; i++)
-	{
-		data[index++] = icellC[i];
-	}
-}
-//////////////////////////////////////////////////////////////////////////
-template<  typename VectorTransmitter  > 
-void D3Q27ETFCOffVectorConnector< VectorTransmitter>::getLocalMinMaxCF(int gMax, int& lMin, int& lMax)
-{
-	if (Utilities::isOdd(gMax))
-	{
-		if(connType == OddEvenSE || connType == OddOddNE)
-		{
-			lMin = 1;
-			lMax = gMax;
-		}
-	}
-}
-//////////////////////////////////////////////////////////////////////////
-template<  typename VectorTransmitter  > 
-void D3Q27ETFCOffVectorConnector< VectorTransmitter>::distributeReceiveVectors() 
-{
-	using namespace D3Q27System;
-
-	SPtr<DistributionArray3D>  fTo = block.lock()->getKernel()->getDataSet()->getFdistributions();
-	int maxX1 = (int)fTo->getNX1();
-	int maxX2 = (int)fTo->getNX2();
-	int maxX3 = (int)fTo->getNX3();
-	int minX1 = 0;
-	int minX2 = 0;
-	int minX3 = 0;
-
-	int lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3;
-	int index = 0;
-	vector_type& data = receiver->getData();
-
-	lMinX1 = minX1; lMinX2 = minX2; lMinX3 = minX3;
-	lMaxX1 = maxX1-1; lMaxX2 = maxX2-1; lMaxX3 = maxX3-1;
-
-	switch(sendDir)
-	{
-	case E: 
-		lMinX1 = maxX1-4;
-		lMaxX1 = lMinX1 + 1;
-		getLocalMinMaxCF(maxX2, lMinX2, lMaxX2);
-		getLocalMinMaxCF(maxX3, lMinX3, lMaxX3);
-		distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
-		break;
-	case W: 
-      ///////////////////////////////////////
-      ///DEBUG
-      //if (block.lock()->getGlobalID() == 2554)
-      //{
-      //   int test = 0;
-      //}
-      //////////////
-		lMinX1 = 2;
-		lMaxX1 = lMinX1 + 1;
-		getLocalMinMaxCF(maxX2, lMinX2, lMaxX2);
-		getLocalMinMaxCF(maxX3, lMinX3, lMaxX3);
-		distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
-		break;  
-	case N:
-		lMinX2 = maxX2-4;
-		lMaxX2 = lMinX2 + 1;
-		getLocalMinMaxCF(maxX1, lMinX1, lMaxX1);
-		getLocalMinMaxCF(maxX3, lMinX3, lMaxX3);
-		distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
-		break;
-	case S:
-		lMinX2 = 2;
-		lMaxX2 = lMinX2 + 1;
-		getLocalMinMaxCF(maxX1, lMinX1, lMaxX1);
-		getLocalMinMaxCF(maxX3, lMinX3, lMaxX3);
-		distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
-		break;
-	case T:
-		lMinX3 = maxX3-4;
-		lMaxX3 = lMinX3 + 1;
-		getLocalMinMaxCF(maxX1, lMinX1, lMaxX1);
-		getLocalMinMaxCF(maxX2, lMinX2, lMaxX2);
-		distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
-		break;
-	case B:
-		lMinX3 = 2;
-		lMaxX3 = lMinX3 + 1;
-		getLocalMinMaxCF(maxX1, lMinX1, lMaxX1);
-		getLocalMinMaxCF(maxX2, lMinX2, lMaxX2);
-		distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
-		break;
-
-		/////E-W-N-S
-	case NE: 
-		lMinX1 = maxX1-4;
-		lMaxX1 = lMinX1 + 3;
-		lMinX2 = maxX2-4;
-		lMaxX2 = lMinX2 + 3;
-		getLocalMinMaxCF(maxX3, lMinX3, lMaxX3);
-		distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
-		break;
-
-	case SW: 
-		lMinX1 = 0;
-		lMaxX1 = lMinX1 + 3;
-		lMinX2 = 0;
-		lMaxX2 = lMinX2 + 3;
-		getLocalMinMaxCF(maxX3, lMinX3, lMaxX3);
-		distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
-		break;
-
-	case SE: 
-		lMinX1 = maxX1-4;
-		lMaxX1 = lMinX1 + 3;
-		lMinX2 = 0;
-		lMaxX2 = lMinX2 + 3;
-		getLocalMinMaxCF(maxX3, lMinX3, lMaxX3);
-		distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
-		break;
-
-	case NW: 
-		lMinX1 = 0;
-		lMaxX1 = lMinX1 + 3;
-		lMinX2 = maxX2-4;
-		lMaxX2 = lMinX2 + 3;
-		getLocalMinMaxCF(maxX3, lMinX3, lMaxX3);
-		distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
-		break;
-	//	
-	//	/////T-B-E-W
-	case TE:
-		lMinX1 = maxX1-4;
-		lMaxX1 = lMinX1 + 3;
-		lMinX3 = maxX3-4;
-		lMaxX3 = lMinX3 + 3;
-		getLocalMinMaxCF(maxX2, lMinX2, lMaxX2);
-		distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
-		break;
-	
-	case BW:
-		lMinX1 = 0;
-		lMaxX1 = lMinX1 + 3;
-		lMinX3 = 0;
-		lMaxX3 = lMinX3 + 3;
-		getLocalMinMaxCF(maxX2, lMinX2, lMaxX2);
-		distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
-		break;
-	
-	case BE:
-		lMinX1 = maxX1-4;
-		lMaxX1 = lMinX1 + 3;
-		lMinX3 = 0;
-		lMaxX3 = lMinX3 + 3;
-		getLocalMinMaxCF(maxX2, lMinX2, lMaxX2);
-		distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
-		break;
-
-	case TW:
-		lMinX1 = 0;
-		lMaxX1 = lMinX1 + 3;
-		lMinX3 = maxX3-4;
-		lMaxX3 = lMinX3 + 3;
-		getLocalMinMaxCF(maxX2, lMinX2, lMaxX2);
-		distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
-		break;
-
-	//	////////////////T-B-N-S
-	//	
-	case TN:
-		lMinX2 = maxX2-4;
-		lMaxX2 = lMinX2 + 3;
-		lMinX3 = maxX3-4;
-		lMaxX3 = lMinX3 + 3;
-		getLocalMinMaxCF(maxX1, lMinX1, lMaxX1);
-		distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
-		break;
-
-	case BS:
-		lMinX2 = 0;
-		lMaxX2 = lMinX2 + 3;
-		lMinX3 = 0;
-		lMaxX3 = lMinX3 + 3;
-		getLocalMinMaxCF(maxX1, lMinX1, lMaxX1);
-		distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
-		break;
-
-	case BN:
-		lMinX2 = maxX2-4;
-		lMaxX2 = lMinX2 + 3;
-		lMinX3 = 0;
-		lMaxX3 = lMinX3 + 3;
-		getLocalMinMaxCF(maxX1, lMinX1, lMaxX1);
-		distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
-		break;
-
-	case TS:
-		lMinX2 = 0;
-		lMaxX2 = lMinX2 + 3;
-		lMinX3 = maxX3-4;
-		lMaxX3 = lMinX3 + 3;
-		getLocalMinMaxCF(maxX1, lMinX1, lMaxX1);
-		distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
-		break;
-
-   //   //TNE
-   case TNE:
-      lMinX1 = maxX1-4;
-      lMaxX1 = maxX1-1;
-      lMinX2 = maxX2-4;
-      lMaxX2 = maxX2-1;
-      lMinX3 = maxX3-4;
-      lMaxX3 = maxX3-1;
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
-      break;
-      //   TNW
-   case TNW:
-      lMinX1 = 0;
-      lMaxX1 = 3;
-      lMinX2 = maxX2-4;
-      lMaxX2 = maxX2-1;
-      lMinX3 = maxX3-4;
-      lMaxX3 = maxX3-1;
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
-      break;
-      //   TSE
-   case TSE:
-      lMinX1 = maxX1-4;
-      lMaxX1 = maxX1-1;
-      lMinX2 = 0;
-      lMaxX2 = 3;
-      lMinX3 = maxX3-4;
-      lMaxX3 = maxX3-1;
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
-      break;
-      //   TSW
-   case TSW:
-      lMinX1 = 0;
-      lMaxX1 = 3;
-      lMinX2 = 0;
-      lMaxX2 = 3;
-      lMinX3 = maxX3-4;
-      lMaxX3 = maxX3-1;
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
-      break;
-      //   BNE
-   case BNE:
-      lMinX1 = maxX1-4;
-      lMaxX1 = maxX1-1;
-      lMinX2 = maxX2-4;
-      lMaxX2 = maxX2-1;
-      lMinX3 = 0;
-      lMaxX3 = 3;
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
-      break;
-      //   BNW
-   case BNW:
-      lMinX1 = 0;
-      lMaxX1 = 3;
-      lMinX2 = maxX2-4;
-      lMaxX2 = maxX2-1;
-      lMinX3 = 0;
-      lMaxX3 = 3;
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
-      break;
-      //   BSE
-   case BSE:
-      lMinX1 = maxX1-4;
-      lMaxX1 = maxX1-1;
-      lMinX2 = 0;
-      lMaxX2 = 3;
-      lMinX3 = 0;
-      lMaxX3 = 3;
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
-      break;
-         //BSW
-   case BSW:
-      lMinX1 = 0;
-      lMaxX1 = 3;
-      lMinX2 = 0;
-      lMaxX2 = 3;
-      lMinX3 = 0;
-      lMaxX3 = 3;
-      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
-      break;
-	}
-}
-//////////////////////////////////////////////////////////////////////////
-template<  typename VectorTransmitter  > 
-void D3Q27ETFCOffVectorConnector< VectorTransmitter>::distributeReceiveVector(SPtr<DistributionArray3D> fTo, const int& lMinX1, const int& lMinX2, const int& lMinX3, const int& lMaxX1, const int& lMaxX2, const int& lMaxX3, vector_type& data, int& index)
-{
-	if(data.size() == 0) return; 
-
-	int ix1, ix2, ix3;
-	for (ix3=lMinX3; ix3<lMaxX3; ix3+=2)
-	{
-		for (ix2=lMinX2; ix2<lMaxX2; ix2+=2)
-		{
-			for (ix1=lMinX1; ix1<lMaxX1; ix1+=2)
-			{
-				D3Q27ICell icellF;
-				this->readICellFfromData(data, index, icellF);
-				iprocessor->writeICellInv(fTo, icellF, ix1, ix2, ix3);
-			}
-		}
-	}
-}
-//////////////////////////////////////////////////////////////////////////
-template<  typename VectorTransmitter  > 
-void D3Q27ETFCOffVectorConnector< VectorTransmitter>::readICellFfromData(vector_type& data, int& index, D3Q27ICell& icellF) 
-{
-	readNodeFromVector(data, index, icellF.BSW);
-	readNodeFromVector(data, index, icellF.BSE);
-	readNodeFromVector(data, index, icellF.BNW);
-	readNodeFromVector(data, index, icellF.BNE);
-	readNodeFromVector(data, index, icellF.TSW);
-	readNodeFromVector(data, index, icellF.TSE);
-	readNodeFromVector(data, index, icellF.TNW);
-	readNodeFromVector(data, index, icellF.TNE);
-}
-//////////////////////////////////////////////////////////////////////////
-template<  typename VectorTransmitter  > 
-void D3Q27ETFCOffVectorConnector< VectorTransmitter>::readNodeFromVector(vector_type& data, int& index, LBMReal* inode)
-{
-	for (int i = D3Q27System::STARTF; i < D3Q27System::ENDF+1; i++)
-	{
-		inode[i] = data[index++];
-	}
-}
-//////////////////////////////////////////////////////////////////////////
-template<  typename VectorTransmitter  > 
-void D3Q27ETFCOffVectorConnector< VectorTransmitter>::getLocalMinMax(int& minX1, int& minX2, int& minX3, int& maxX1, int& maxX2, int& maxX3)
-{
-	using namespace D3Q27System;
-    int TminX1=minX1; int TminX2=minX2; int TminX3=minX3; int TmaxX1=maxX1; int TmaxX2=maxX2; int TmaxX3=maxX3;
-
-	if(block.lock()->hasInterpolationFlagFC(E))
-	{
-		if (maxX1==TmaxX1) maxX1 -= 3;
-	}
-	if(block.lock()->hasInterpolationFlagFC(W))
-	{
-		if (minX1==TminX1) minX1 += 4;
-	}
-	if(block.lock()->hasInterpolationFlagFC(N))
-	{
-		if (maxX2==TmaxX2) maxX2 -= 3;
-	}
-	if(block.lock()->hasInterpolationFlagFC(S))
-	{
-		if (minX2==TminX2) minX2 += 4;
-	}
-	if(block.lock()->hasInterpolationFlagFC(T))
-	{
-		if (maxX3==TmaxX3) maxX3 -= 3;
-	}
-	if(block.lock()->hasInterpolationFlagFC(B))
-	{
-		if (minX3==TminX3) minX3 += 4;
-	}
-
-	////////////
-	/////E-W-N-S
-	if(block.lock()->hasInterpolationFlagFC(NE)&& !block.lock()->hasInterpolationFlagFC(N) && !block.lock()->hasInterpolationFlagFC(E))
-	{
-		if (maxX1==TmaxX1) maxX1 -= 3;
-		if (maxX2==TmaxX2) maxX2 -= 3;
-	}
-	if(block.lock()->hasInterpolationFlagFC(SW)&& !block.lock()->hasInterpolationFlagFC(W) && !block.lock()->hasInterpolationFlagFC(S))
-	{
-		if (minX1==TminX1) minX1 += 4;
-		if (minX2==TminX2) minX2 += 4;
-	}
-	if(block.lock()->hasInterpolationFlagFC(SE)&& !block.lock()->hasInterpolationFlagFC(E) && !block.lock()->hasInterpolationFlagFC(S))
-	{
-		if (maxX1==TmaxX1) maxX1 -= 3;
-		if (minX2==TminX2) minX2 += 4;
-	}
-	if(block.lock()->hasInterpolationFlagFC(NW)&& !block.lock()->hasInterpolationFlagFC(N) && !block.lock()->hasInterpolationFlagFC(W))
-	{
-		if (minX1==TminX1) minX1 += 4;
-		if (maxX2==TmaxX2) maxX2 -= 3;
-	}
-
-	//////T-B-E-W
-	if(block.lock()->hasInterpolationFlagFC(TE) && !block.lock()->hasInterpolationFlagFC(E) && !block.lock()->hasInterpolationFlagFC(T))
-	{
-		if (maxX1==TmaxX1) maxX1 -= 3;
-		if (maxX3==TmaxX3) maxX3 -= 3;
-	}
-	if(block.lock()->hasInterpolationFlagFC(BW)&& !block.lock()->hasInterpolationFlagFC(W) && !block.lock()->hasInterpolationFlagFC(B))
-	{
-		if (minX1==TminX1) minX1 += 4;
-		if (minX3==TminX3) minX3 += 4;
-	}
-	if(block.lock()->hasInterpolationFlagFC(BE)&& !block.lock()->hasInterpolationFlagFC(E) && !block.lock()->hasInterpolationFlagFC(B))
-	{
-		if (maxX1==TmaxX1) maxX1 -= 3;
-		if (minX3==TminX3) minX3 += 4;
-	}
-	if(block.lock()->hasInterpolationFlagFC(TW)&& !block.lock()->hasInterpolationFlagFC(W) && !block.lock()->hasInterpolationFlagFC(T))
-	{
-		if (minX1==TminX1) minX1 += 4;
-		if (maxX3==TmaxX3) maxX3 -= 3;
-	}
-
-
-	////T-B-N-S
-	if(block.lock()->hasInterpolationFlagFC(TN)&& !block.lock()->hasInterpolationFlagFC(N) && !block.lock()->hasInterpolationFlagFC(T))
-	{
-		if (maxX2==TmaxX2) maxX2 -= 3; 
-		if (maxX3==TmaxX3) maxX3 -= 3;
-	}
-	if(block.lock()->hasInterpolationFlagFC(BS)&& !block.lock()->hasInterpolationFlagFC(S) && !block.lock()->hasInterpolationFlagFC(B))
-	{
-		if (minX2==TminX2) minX2 += 4;
-		if (minX3==TminX3) minX3 += 4;
-	}
-	if(block.lock()->hasInterpolationFlagFC(BN)&& !block.lock()->hasInterpolationFlagFC(N) && !block.lock()->hasInterpolationFlagFC(B))
-	{
-		if (maxX2==TmaxX2) maxX2 -= 3; 
-		if (minX3==TminX3) minX3 += 4;
-	}
-	if(block.lock()->hasInterpolationFlagFC(TS) && !block.lock()->hasInterpolationFlagFC(S) && !block.lock()->hasInterpolationFlagFC(T))
-	{
-		if (minX2==TminX2) minX2 += 4;
-		if (maxX3==TmaxX3) maxX3 -= 3;
-	}
-
-   //if (block.lock()->hasInterpolationFlagFC(D3Q27System::TNE)&&!block.lock()->hasInterpolationFlagFC(D3Q27System::TE)&&!block.lock()->hasInterpolationFlagFC(D3Q27System::TN)&&!block.lock()->hasInterpolationFlagFC(D3Q27System::NE)&&!block.lock()->hasInterpolationFlagFC(D3Q27System::T)&&!block.lock()->hasInterpolationFlagFC(D3Q27System::N) && !block.lock()->hasInterpolationFlagFC(D3Q27System::E))
-   //if (!block.lock()->hasInterpolationFlagFC(D3Q27System::TE)&&!block.lock()->hasInterpolationFlagFC(D3Q27System::T) && !block.lock()->hasInterpolationFlagFC(D3Q27System::E))
-   //{
-   //   if (maxX1==TmaxX1) maxX1 -= 3;
-   //   if (maxX2==TmaxX2) maxX2 -= 3;
-   //   if (maxX3==TmaxX3) maxX3 -= 3;
-   //}
-}
-//////////////////////////////////////////////////////////////////////////
-template<  typename VectorTransmitter  >
-void D3Q27ETFCOffVectorConnector< VectorTransmitter>::getLocalMinMax(int& minX1, int& minX2, int& minX3, int& maxX1, int& maxX2, int& maxX3, CFconnectorType connType)
-{
-   using namespace D3Q27System;
-   int TminX1 = minX1; int TminX2 = minX2; int TminX3 = minX3; int TmaxX1 = maxX1; int TmaxX2 = maxX2; int TmaxX3 = maxX3;
-
-   if (block.lock()->hasInterpolationFlagFC(E))
-   {
-      if (maxX1==TmaxX1) maxX1 -= 3;
-   }
-   if (block.lock()->hasInterpolationFlagFC(W))
-   {
-      if (minX1==TminX1) minX1 += 4;
-   }
-   if (block.lock()->hasInterpolationFlagFC(N))
-   {
-      if (maxX2==TmaxX2) maxX2 -= 3;
-   }
-   if (block.lock()->hasInterpolationFlagFC(S))
-   {
-      if (minX2==TminX2) minX2 += 4;
-   }
-   if (block.lock()->hasInterpolationFlagFC(T))
-   {
-      if (maxX3==TmaxX3) maxX3 -= 3;
-   }
-   if (block.lock()->hasInterpolationFlagFC(B))
-   {
-      if (minX3==TminX3) minX3 += 4;
-   }
-
-   ////////////
-   /////E-W-N-S
-   if (block.lock()->hasInterpolationFlagFC(NE)&& !block.lock()->hasInterpolationFlagFC(N) && !block.lock()->hasInterpolationFlagFC(E))
-   {
-      if (maxX1==TmaxX1) maxX1 -= 3;
-      if (maxX2==TmaxX2) maxX2 -= 3;
-   }
-   if (block.lock()->hasInterpolationFlagFC(SW)&& !block.lock()->hasInterpolationFlagFC(W) && !block.lock()->hasInterpolationFlagFC(S))
-   {
-      if (minX1==TminX1) minX1 += 4;
-      if (minX2==TminX2) minX2 += 4;
-   }
-   if (block.lock()->hasInterpolationFlagFC(SE)&& !block.lock()->hasInterpolationFlagFC(E) && !block.lock()->hasInterpolationFlagFC(S))
-   {
-      if (maxX1==TmaxX1) maxX1 -= 3;
-      if (minX2==TminX2) minX2 += 4;
-   }
-   if (block.lock()->hasInterpolationFlagFC(NW)&& !block.lock()->hasInterpolationFlagFC(N) && !block.lock()->hasInterpolationFlagFC(W))
-   {
-      if (minX1==TminX1) minX1 += 4;
-      if (maxX2==TmaxX2) maxX2 -= 3;
-   }
-
-   //////T-B-E-W
-   if (block.lock()->hasInterpolationFlagFC(TE) && !block.lock()->hasInterpolationFlagFC(E) && !block.lock()->hasInterpolationFlagFC(T))
-   {
-      if (maxX1==TmaxX1) maxX1 -= 3;
-      if (maxX3==TmaxX3) maxX3 -= 3;
-   }
-   if (block.lock()->hasInterpolationFlagFC(BW)&& !block.lock()->hasInterpolationFlagFC(W) && !block.lock()->hasInterpolationFlagFC(B))
-   {
-      if (minX1==TminX1) minX1 += 4;
-      if (minX3==TminX3) minX3 += 4;
-   }
-   if (block.lock()->hasInterpolationFlagFC(BE)&& !block.lock()->hasInterpolationFlagFC(E) && !block.lock()->hasInterpolationFlagFC(B))
-   {
-      if (maxX1==TmaxX1) maxX1 -= 3;
-      if (minX3==TminX3) minX3 += 4;
-   }
-   if (block.lock()->hasInterpolationFlagFC(TW)&& !block.lock()->hasInterpolationFlagFC(W) && !block.lock()->hasInterpolationFlagFC(T))
-   {
-      if (minX1==TminX1) minX1 += 4;
-      if (maxX3==TmaxX3) maxX3 -= 3;
-   }
-
-
-   ////T-B-N-S
-   if (block.lock()->hasInterpolationFlagFC(TN)&& !block.lock()->hasInterpolationFlagFC(N) && !block.lock()->hasInterpolationFlagFC(T))
-   {
-      if (maxX2==TmaxX2) maxX2 -= 3;
-      if (maxX3==TmaxX3) maxX3 -= 3;
-   }
-   if (block.lock()->hasInterpolationFlagFC(BS)&& !block.lock()->hasInterpolationFlagFC(S) && !block.lock()->hasInterpolationFlagFC(B))
-   {
-      if (minX2==TminX2) minX2 += 4;
-      if (minX3==TminX3) minX3 += 4;
-   }
-   if (block.lock()->hasInterpolationFlagFC(BN)&& !block.lock()->hasInterpolationFlagFC(N) && !block.lock()->hasInterpolationFlagFC(B))
-   {
-      if (maxX2==TmaxX2) maxX2 -= 3;
-      if (minX3==TminX3) minX3 += 4;
-   }
-   if (block.lock()->hasInterpolationFlagFC(TS) && !block.lock()->hasInterpolationFlagFC(S) && !block.lock()->hasInterpolationFlagFC(T))
-   {
-      if (minX2==TminX2) minX2 += 4;
-      if (maxX3==TmaxX3) maxX3 -= 3;
-   }
-
-   //if (block.lock()->hasInterpolationFlagFC(D3Q27System::TNE)&&!block.lock()->hasInterpolationFlagFC(D3Q27System::TE)&&!block.lock()->hasInterpolationFlagFC(D3Q27System::TN)&&!block.lock()->hasInterpolationFlagFC(D3Q27System::NE)&&!block.lock()->hasInterpolationFlagFC(D3Q27System::T)&&!block.lock()->hasInterpolationFlagFC(D3Q27System::N) && !block.lock()->hasInterpolationFlagFC(D3Q27System::E))
-   //{
-   //   if (maxX1==TmaxX1) maxX1 -= 3;
-   //   if (maxX2==TmaxX2) maxX2 -= 3;
-   //   if (maxX3==TmaxX3) maxX3 -= 3;
-   //}
-}
-//////////////////////////////////////////////////////////////////////////
-template<  typename VectorTransmitter  > 
-void D3Q27ETFCOffVectorConnector< VectorTransmitter>::getLocalOffsets(const int& gMax, int& oMin)
-{
-	if (Utilities::isEven(gMax))
-	{
-		oMin = 0;
-	}
-	if (Utilities::isOdd(gMax))
-	{
-		oMin = -1;
-	}
-
-}
-//////////////////////////////////////////////////////////////////////////
-template<  typename VectorTransmitter  > 
-void D3Q27ETFCOffVectorConnector< VectorTransmitter>::getLocalMins(int& minX1, int& minX2, int& minX3, const int& oMinX1, const int& oMinX2, const int& oMinX3)
-{
-	using namespace D3Q27System;
-
-	switch(sendDir)
-	{
-	case E: case W:
-		if(connType == OddEvenSE)
-			minX2 += oMinX2;
-		if(connType == OddOddNE)
-		{
-			minX2 += oMinX2;
-			minX3 += oMinX3;
-		}
-		if(connType == EvenOddNW)
-			minX3 += oMinX3;
-		break;
-	case N: case S:
-		if(connType == OddEvenSE)
-			minX1 += oMinX1;
-		if(connType == OddOddNE)
-		{
-			minX1 += oMinX1;
-			minX3 += oMinX3;
-		}
-		if(connType == EvenOddNW)
-			minX3 += oMinX3;
-		break;
-	case T: case B:
-		if(connType == OddEvenSE)
-			minX1 += oMinX1;
-		if(connType == OddOddNE)
-		{
-			minX1 += oMinX1;
-			minX2 += oMinX2;
-		}
-		if(connType == EvenOddNW)
-			minX2 += oMinX2;
-		break;
-
-		/////
-	case NE: case SW: case SE: case NW:
-		//case SW:
-		if(connType == OddEvenSE)
-			//minX2 += oMinX2;
-		if(connType == OddOddNE)
-		{
-			//minX2 += oMinX2;
-			minX3 += oMinX3;
-		}
-		if(connType == EvenOddNW)
-			minX3 += oMinX3;
-		break;
-
-		//////
-	case TE: case BW: case BE: case TW:
-		if(connType == OddEvenSE)
-	//		minX1 += oMinX1;
-		if(connType == OddOddNE)
-		{
-	//		minX1 += oMinX1;
-			minX2 += oMinX2;
-		}
-		if(connType == EvenOddNW)
-			minX2 += oMinX2;
-		break;
-
-	//	//////
-	case TN: case BS: case BN: case TS:
-		if(connType == OddEvenSE)
-			minX1 += oMinX1;
-		if(connType == OddOddNE)
-		{
-			minX1 += oMinX1;
-			//minX3 += oMinX3;
-		}
-		if(connType == EvenOddNW)
-			//minX3 += oMinX3;
-		break;
-
-	//	/////
-	//	case TNE: case TNW: case TSE: case TSW: case BNE: case BNW: case BSE: case BSW:
-	//	if(connType == OddEvenSE)
-	//	//	minX1 += oMinX1;
-	//	if(connType == OddOddNE)
-	//	{
-	//		//minX1 += oMinX1;
-	//		//minX3 += oMinX3;
-	//	}
-	//	if(connType == EvenOddNW)
-	//		//minX3 += oMinX3;
-	//	break;
-	}
-}
-//////////////////////////////////////////////////////////////////////////
-template< typename VectorTransmitter >
-double D3Q27ETFCOffVectorConnector<VectorTransmitter>::getSendRecieveTime()
-{
-	return 0;
-}
-
-#endif
+/**
+* @file D3Q27ETFCOffVectorConnector.h
+* @class D3Q27ETFCVectorConnector
+* @brief Interpolation from fine level to coarse.
+* @author Kostyantyn Kucher and Ehsan Fard
+* @date 08.06.2011
+*/
+#ifndef D3Q27ETFCOffVectorConnector_H
+#define D3Q27ETFCOffVectorConnector_H
+
+#include <vector>
+
+#include "basics/transmitter/TbTransmitter.h"
+#include "Block3DConnector.h"
+#include "D3Q27System.h"
+#include "Block3D.h"
+#include "Grid3D.h"
+#include "LBMKernel.h"
+#include "InterpolationProcessor.h"
+#include "MathUtil.hpp"
+#include <PointerDefinitions.h>
+
+#include "BCProcessor.h"
+#include "DataSet3D.h"
+
+class Block3D;
+
+enum CFconnectorType {EvenOddNW, EvenEvenSW, OddEvenSE, OddOddNE};
+
+//daten werden in einen vector (dieser befindet sich im transmitter) kopiert
+//der vector wird via transmitter uebertragen
+//transmitter kann ein lokal, MPI, RCG, CTL oder was auch immer fuer ein
+//transmitter sein, der von Transmitter abgeleitet ist ;-)
+
+template< typename VectorTransmitter >
+class D3Q27ETFCOffVectorConnector : public Block3DConnector
+{
+public:
+
+protected:
+	typedef typename VectorTransmitter::value_type  vector_type;
+	typedef SPtr< VectorTransmitter > VectorTransmitterPtr;
+public:
+   D3Q27ETFCOffVectorConnector(SPtr<Block3D> block, VectorTransmitterPtr sender, VectorTransmitterPtr receiver, int sendDir, 
+      InterpolationProcessorPtr iprocessor, CFconnectorType connType);
+
+	bool isLocalConnector();
+	bool isRemoteConnector();
+	void init();
+
+	void sendTransmitterDataSize();
+	void receiveTransmitterDataSize();
+
+	void prepareForSend();
+	void sendVectors();
+
+	void prepareForReceive();
+	void receiveVectors();
+
+	void fillSendVectors();
+	void distributeReceiveVectors();
+
+	bool isInterpolationConnectorCF() { return false; }
+	bool isInterpolationConnectorFC() { return true; }
+
+	double getSendRecieveTime();
+
+	void prepareForSendX1() {}
+	void prepareForSendX2() {}
+	void prepareForSendX3() {}
+
+	void sendVectorsX1(){}
+	void sendVectorsX2(){}
+	void sendVectorsX3(){}
+
+	void prepareForReceiveX1() {}
+	void prepareForReceiveX2() {}
+	void prepareForReceiveX3() {}
+
+	void receiveVectorsX1() {}
+	void receiveVectorsX2() {}
+	void receiveVectorsX3() {}
+
+protected:
+	WPtr<Block3D> block; //dieser nvd sendet daten und die empfangenen werden diesem nvd zugeordnet
+	//gegenstelle muss "inversen" connector besitzen
+	VectorTransmitterPtr sender, receiver;
+
+	InterpolationProcessorPtr iprocessor;
+
+   CFconnectorType connType;
+
+	void writeICellCtoData(vector_type& data, int& index, LBMReal* icellC);
+	void writeNodeToVector(vector_type& data, int& index, LBMReal* inode);
+	void getLocalMinMax(int& minX1, int& minX2, int& minX3, int& maxX1, int& maxX2, int& maxX3);
+   void getLocalMinMax(int& minX1, int& minX2, int& minX3, int& maxX1, int& maxX2, int& maxX3, CFconnectorType connType);
+	void getLocalMinMaxCF(int gMax, int& lMin, int& lMax);
+	void fillSendVector(SPtr<DistributionArray3D> fFrom, const int& lMinX1, const int& lMinX2, const int& lMinX3, const int& lMaxX1, const int& lMaxX2, const int& lMaxX3, vector_type& data, int& index);
+
+	void distributeReceiveVector(SPtr<DistributionArray3D> fTo, const int& lMinX1, const int& lMinX2, const int& lMinX3, const int& lMaxX1, const int& lMaxX2, const int& lMaxX3, vector_type& data, int& index);
+	void readICellFfromData(vector_type& data, int& index, D3Q27ICell& icellF);
+	void readNodeFromVector(vector_type& data, int& index, LBMReal* inode);
+	void getLocalOffsets(const int& gMax, int& oMin);
+	void getLocalMins(int& minX1, int& minX2, int& minX3, const int& oMinX1, const int& oMinX2, const int& oMinX3);
+
+	int bMaxX1, bMaxX2, bMaxX3;
+};
+////////////////////////////////////////////////////////////////////////////
+template< typename VectorTransmitter >
+D3Q27ETFCOffVectorConnector<VectorTransmitter>::D3Q27ETFCOffVectorConnector(SPtr<Block3D> block, VectorTransmitterPtr sender, 
+																			VectorTransmitterPtr receiver, int sendDir, 
+																			InterpolationProcessorPtr iprocessor,
+                                                         CFconnectorType connType)
+																			: Block3DConnector(sendDir)
+																			, block(block)
+																			, sender(sender)
+																			, receiver(receiver)
+																			, iprocessor(iprocessor)
+																			, connType(connType)
+{
+	if( !(   sendDir==D3Q27System::E  || sendDir==D3Q27System::W  || sendDir==D3Q27System::N  || sendDir==D3Q27System::S  || sendDir==D3Q27System::T || sendDir==D3Q27System::B 
+		||  sendDir==D3Q27System::NE || sendDir==D3Q27System::SW || sendDir==D3Q27System::SE || sendDir==D3Q27System::NW
+		||  sendDir==D3Q27System::TE || sendDir==D3Q27System::BW ||  sendDir==D3Q27System::BE || sendDir==D3Q27System::TW
+		||  sendDir==D3Q27System::TN || sendDir==D3Q27System::BS ||  sendDir==D3Q27System::BN || sendDir==D3Q27System::TS 
+
+		||  sendDir==D3Q27System::TNE || sendDir==D3Q27System::TNW ||  sendDir==D3Q27System::TSE || sendDir==D3Q27System::TSW
+		||  sendDir==D3Q27System::BNE || sendDir==D3Q27System::BNW ||  sendDir==D3Q27System::BSE || sendDir==D3Q27System::BSW 
+		
+		) )
+	{
+		throw UbException(UB_EXARGS,"invalid constructor for this direction");
+	}
+}
+//////////////////////////////////////////////////////////////////////////
+template< typename VectorTransmitter >
+bool D3Q27ETFCOffVectorConnector<VectorTransmitter>::isLocalConnector()
+{ 
+	return !this->isRemoteConnector(); 
+}
+//////////////////////////////////////////////////////////////////////////
+template< typename VectorTransmitter >
+bool D3Q27ETFCOffVectorConnector<VectorTransmitter>::isRemoteConnector() 
+{ 
+	return sender->isRemoteTransmitter()  ||  receiver->isRemoteTransmitter();
+}
+//////////////////////////////////////////////////////////////////////////
+template< typename VectorTransmitter >
+void D3Q27ETFCOffVectorConnector<VectorTransmitter>::sendTransmitterDataSize()  
+{ 
+	if(sender)
+	{
+		UBLOG(logDEBUG5, "D3Q27ETFCOffVectorConnector<VectorTransmitter>::sendTransmitterDataSize()"<<block.lock()->toString()+"sendDir="<<sendDir);
+		sender->sendDataSize(); 
+	}
+}
+//////////////////////////////////////////////////////////////////////////
+template< typename VectorTransmitter >
+void D3Q27ETFCOffVectorConnector<VectorTransmitter>::receiveTransmitterDataSize()
+{ 
+	if(receiver)
+	{
+		UBLOG(logDEBUG5, "D3Q27ETFCOffVectorConnector<VectorTransmitter>::receiveTransmitterDataSize()"<<block.lock()->toString()<<"sendDir="<<sendDir);
+		receiver->receiveDataSize();
+	}
+}
+//////////////////////////////////////////////////////////////////////////
+template< typename VectorTransmitter >
+void D3Q27ETFCOffVectorConnector<VectorTransmitter>::prepareForSend()
+{ 
+	if(sender) sender->prepareForSend(); 
+}
+//////////////////////////////////////////////////////////////////////////
+template< typename VectorTransmitter >
+void D3Q27ETFCOffVectorConnector<VectorTransmitter>::sendVectors()     
+{ 
+	if(sender) sender->sendData();
+}
+//////////////////////////////////////////////////////////////////////////
+template< typename VectorTransmitter >
+void D3Q27ETFCOffVectorConnector<VectorTransmitter>::prepareForReceive()     
+{ 
+	if(receiver) receiver->prepareForReceive(); 
+}
+//////////////////////////////////////////////////////////////////////////
+template< typename VectorTransmitter >
+void D3Q27ETFCOffVectorConnector<VectorTransmitter>::receiveVectors() 
+{ 
+	if(receiver) receiver->receiveData(); 
+}
+//////////////////////////////////////////////////////////////////////////
+template< typename VectorTransmitter >
+void D3Q27ETFCOffVectorConnector<VectorTransmitter>::init()
+{
+	using namespace D3Q27System;
+
+	bMaxX1 = (int)block.lock()->getKernel()->getDataSet()->getFdistributions()->getNX1();
+	bMaxX2 = (int)block.lock()->getKernel()->getDataSet()->getFdistributions()->getNX2();
+	bMaxX3 = (int)block.lock()->getKernel()->getDataSet()->getFdistributions()->getNX3();
+
+	int       sendSize  = 0;
+	LBMReal initValue = -999.0;
+
+	int sendDataPerNode = 27/*f*/;
+	int iCellSize = 1; //size of interpolation cell
+
+	switch(this->sendDir)
+	{		                  
+	case E : case W : sendSize = (bMaxX2-1)/2*(bMaxX3-1)/2*sendDataPerNode*iCellSize; break; 
+	case N : case S : sendSize = (bMaxX1-1)/2*(bMaxX3-1)/2*sendDataPerNode*iCellSize; break; 
+	case T : case B : sendSize = (bMaxX1-1)/2*(bMaxX2-1)/2*sendDataPerNode*iCellSize; break; 		  
+	case NE : case SW :case SE : case NW : sendSize = (3*bMaxX3-3)*sendDataPerNode*iCellSize; break; // buffer overhead, should be (3*bMaxX3-6) for even bMax3		
+	case TE : case BW :case BE : case TW : sendSize = (3*bMaxX2-3)*sendDataPerNode*iCellSize; break; 
+	case TN : case BS :case BN : case TS : sendSize = (3*bMaxX1-3)*sendDataPerNode*iCellSize; break;	
+   case TNE: case TNW:case TSE: case TSW:case BNE: case BNW:case BSE: case BSW: sendSize = 3*(3*bMaxX1-3)*sendDataPerNode*iCellSize; break;
+	default: throw UbException(UB_EXARGS,"direction not allowed in this constructor");
+	}
+	sender->getData().resize(sendSize, initValue);
+}
+//////////////////////////////////////////////////////////////////////////
+template< typename VectorTransmitter >
+void D3Q27ETFCOffVectorConnector< VectorTransmitter>::fillSendVectors() 
+{ 
+	using namespace D3Q27System;
+
+	SPtr<DistributionArray3D>  fFrom = block.lock()->getKernel()->getDataSet()->getFdistributions();
+	int maxX1 = (int)fFrom->getNX1();
+	int maxX2 = (int)fFrom->getNX2();
+	int maxX3 = (int)fFrom->getNX3();
+	int minX1 = 0;
+	int minX2 = 0;
+	int minX3 = 0;
+
+	int oMinX1, oMinX2, oMinX3; 
+	getLocalOffsets(maxX1, oMinX1);
+	getLocalOffsets(maxX2, oMinX2);
+	getLocalOffsets(maxX3, oMinX3);
+
+	int lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3;
+	int index = 0;
+	vector_type& data = sender->getData();
+
+	lMinX1 = minX1+1; lMinX2 = minX2+1; lMinX3 = minX3+1;
+	lMaxX1 = maxX1-2; lMaxX2 = maxX2-2; lMaxX3 = maxX3-2;
+
+   ///////////////////////////////////////
+   ///DEBUG
+#ifdef _DEBUG
+   if (block.lock()->getGlobalID() == 2558)
+   {
+      int test = 0;
+   }
+#endif
+   //////////////
+
+	switch(sendDir)
+	{
+	case E: 
+		getLocalMinMax(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3);
+		getLocalMins(lMinX1, lMinX2, lMinX3, oMinX1, oMinX2, oMinX3);
+		lMinX1 = maxX1-7;
+		lMaxX1 = lMinX1 + 1;
+		fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
+		break;
+	case W: 
+      ///////////////////////////////////////
+      ///DEBUG
+#ifdef _DEBUG
+      if (block.lock()->getGlobalID() == 2516)
+      {
+         int test = 0;
+      }
+#endif
+      //////////////
+		//getLocalMinMax(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, none);
+      getLocalMinMax(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3);
+		getLocalMins(lMinX1, lMinX2, lMinX3, oMinX1, oMinX2, oMinX3);
+		lMinX1 = 5;
+		lMaxX1 = lMinX1 + 1;
+		fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
+		break;  
+	case N:
+		getLocalMinMax(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3);
+		getLocalMins(lMinX1, lMinX2, lMinX3, oMinX1, oMinX2, oMinX3);
+		lMinX2 = maxX2-7;
+		lMaxX2 = lMinX2 + 1;
+		fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
+		break;
+	case S:
+		getLocalMinMax(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3);
+		getLocalMins(lMinX1, lMinX2, lMinX3, oMinX1, oMinX2, oMinX3);
+		lMinX2 = 5;
+		lMaxX2 = lMinX2 + 1;
+		fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
+		break;
+	case T:
+		getLocalMinMax(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3);
+		getLocalMins(lMinX1, lMinX2, lMinX3, oMinX1, oMinX2, oMinX3);
+		lMinX3 = maxX3-7;
+		lMaxX3 = lMinX3 + 1;
+		fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
+		break;
+	case B:
+		getLocalMinMax(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3);
+		getLocalMins(lMinX1, lMinX2, lMinX3, oMinX1, oMinX2, oMinX3);
+		lMinX3 = 5;
+		lMaxX3 = lMinX3 + 1;
+		fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
+		break;
+
+	//	////N-S-E-W
+	case NE: 
+		getLocalMinMax(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3);
+		getLocalMins(lMinX1, lMinX2, lMinX3, oMinX1, oMinX2, oMinX3);
+		lMinX1 = maxX1-7;
+		lMaxX1 = lMinX1 +5;
+		lMinX2 = maxX2-7;
+		lMaxX2 = lMinX2 + 1;
+		fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
+		
+		lMinX1 = maxX1-7;
+		lMaxX1 = lMinX1 + 1;
+		lMinX2 = maxX2-7;
+		lMaxX2 = lMinX2 + 5;
+		fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
+		break;
+	case SW: 
+		
+		getLocalMinMax(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3);
+		getLocalMins(lMinX1, lMinX2, lMinX3, oMinX1, oMinX2, oMinX3);
+		lMinX1 = 1;
+		lMaxX1 = lMinX1 + 5;
+		lMinX2 = 5;
+		lMaxX2 = lMinX2 + 1;
+		fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
+
+		lMinX1 = 5;
+		lMaxX1 = lMinX1 + 1;
+		lMinX2 = 1;
+		lMaxX2 = lMinX2 + 5;
+		fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
+		break;
+
+	case SE: 
+		getLocalMinMax(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3);
+		getLocalMins(lMinX1, lMinX2, lMinX3, oMinX1, oMinX2, oMinX3);
+		lMinX1 = maxX1-7;
+		lMaxX1 = lMinX1 +5;
+		lMinX2 = 5;
+		lMaxX2 = lMinX2 + 1;
+		fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
+		
+		lMinX1 = maxX1-7;
+		lMaxX1 = lMinX1 + 1;
+		lMinX2 = 1;
+		lMaxX2 = lMinX2 + 5;
+		fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
+
+		break;
+
+	case NW: 
+		getLocalMinMax(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3);
+		getLocalMins(lMinX1, lMinX2, lMinX3, oMinX1, oMinX2, oMinX3);
+		lMinX1 = 1;
+		lMaxX1 = lMinX1 + 5;
+		lMinX2 = maxX2-7;
+		lMaxX2 = lMinX2 + 1;
+		fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
+
+		lMinX1 = 5;
+		lMaxX1 = lMinX1 + 1;
+		lMinX2 = maxX2-7;
+		lMaxX2 = lMinX2 + 5;
+		fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
+		break;
+//////T-B-E-W
+	case TE: 
+		getLocalMinMax(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3);
+		getLocalMins(lMinX1, lMinX2, lMinX3, oMinX1, oMinX2, oMinX3);
+		lMinX1 = maxX1-7;
+		lMaxX1 = lMinX1 +5;
+		lMinX3 = maxX3-7;
+		lMaxX3 = lMinX3 + 1;
+		fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
+
+		lMinX1 = maxX1-7;
+		lMaxX1 = lMinX1 + 1;
+		lMinX3 = maxX3-7;
+		lMaxX3 = lMinX3 + 5;
+		fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
+		break;
+
+	case BW: 
+		getLocalMinMax(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3);
+		getLocalMins(lMinX1, lMinX2, lMinX3, oMinX1, oMinX2, oMinX3);
+		lMinX1 = 1;
+		lMaxX1 = lMinX1 + 5;
+		lMinX3 = 5;
+		lMaxX3 = lMinX3 + 1;
+		fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
+
+		lMinX1 = 5;
+		lMaxX1 = lMinX1 + 1;
+		lMinX3 = 1;
+		lMaxX3 = lMinX3 + 5;
+		fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
+		break;
+
+	case BE: 
+		getLocalMinMax(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3);
+		getLocalMins(lMinX1, lMinX2, lMinX3, oMinX1, oMinX2, oMinX3);
+		lMinX1 = maxX1-7;
+		lMaxX1 = lMinX1 +5;
+		lMinX3 = 5;
+		lMaxX3 = lMinX3 + 1;
+		fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
+
+		lMinX1 = maxX1-7;
+		lMaxX1 = lMinX1 + 1;
+		lMinX3 = 1;
+		lMaxX3 = lMinX3 + 5;
+		fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
+		break;
+
+	case TW: 
+		getLocalMinMax(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3);
+		getLocalMins(lMinX1, lMinX2, lMinX3, oMinX1, oMinX2, oMinX3);
+		lMinX1 = 1;
+		lMaxX1 = lMinX1 + 5;
+		lMinX3 = maxX3-7;
+		lMaxX3 = lMinX3 + 1;
+		fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
+
+		lMinX1 = 5;
+		lMaxX1 = lMinX1 + 1;
+		lMinX3 = maxX3-7;
+		lMaxX3 = lMinX3 + 5;
+		fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
+		break;
+///////////////T-B-N-S
+//
+	case TN: 
+		getLocalMinMax(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3);
+		getLocalMins(lMinX1, lMinX2, lMinX3, oMinX1, oMinX2, oMinX3);
+		lMinX2 = maxX2-7;
+		lMaxX2 = lMinX2 + 5;
+		lMinX3 = maxX3-7;
+		lMaxX3 = lMinX3 + 1;
+		fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
+
+		lMinX2 = maxX2-7;
+		lMaxX2 = lMinX2 + 1;
+		lMinX3 = maxX3-7;
+		lMaxX3 = lMinX3 + 5;
+		fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
+		break;
+
+	case BS: 
+		getLocalMinMax(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3);
+		getLocalMins(lMinX1, lMinX2, lMinX3, oMinX1, oMinX2, oMinX3);
+		lMinX2 = 1;
+		lMaxX2 = lMinX2 + 5;
+		lMinX3 = 5;
+		lMaxX3 = lMinX3 + 1;
+		fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
+
+		lMinX2 = 5;
+		lMaxX2 = lMinX2 + 1;
+		lMinX3 = 1;
+		lMaxX3 = lMinX3 + 5;
+		fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
+		break;
+
+	case BN: 
+		getLocalMinMax(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3);
+		getLocalMins(lMinX1, lMinX2, lMinX3, oMinX1, oMinX2, oMinX3);
+		lMinX2 = maxX2-7;
+		lMaxX2 = lMinX2 + 5;
+		lMinX3 = 5;
+		lMaxX3 = lMinX3 + 1;
+		fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
+
+		lMinX2 = maxX2-7;
+		lMaxX2 = lMinX2 + 1;
+		lMinX3 = 1;
+		lMaxX3 = lMinX3 + 5;
+		fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
+		break;
+
+	case TS: 
+		getLocalMinMax(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3);
+		getLocalMins(lMinX1, lMinX2, lMinX3, oMinX1, oMinX2, oMinX3);
+		lMinX2 = 1;
+		lMaxX2 = lMinX2 + 5;
+		lMinX3 = maxX3-7;
+		lMaxX3 = lMinX3 + 1;
+		fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
+
+		lMinX2 = 5;
+		lMaxX2 = lMinX2 + 1;
+		lMinX3 = maxX3-7;
+		lMaxX3 = lMinX3 + 5;
+		fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
+		break;
+   
+   //TNE
+   case TNE:
+      lMinX1 = maxX1-7;
+      lMaxX1 = maxX1-6;
+      lMinX2 = maxX2-7;
+      lMaxX2 = maxX2-2;
+      lMinX3 = maxX3-7;
+      lMaxX3 = maxX3-2;
+      fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
+
+      lMinX1 = maxX1-7;
+      lMaxX1 = maxX1-2;
+      lMinX2 = maxX2-7;
+      lMaxX2 = maxX2-6;
+      lMinX3 = maxX3-7;
+      lMaxX3 = maxX3-2;
+      fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
+
+      lMinX1 = maxX1-7;
+      lMaxX1 = maxX1-2;
+      lMinX2 = maxX2-7;
+      lMaxX2 = maxX2-2;
+      lMinX3 = maxX3-7;
+      lMaxX3 = maxX3-6;
+      fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
+      break;
+
+
+   //TNW
+   case TNW:
+      lMinX1 = 5;
+      lMaxX1 = 6;
+      lMinX2 = maxX2-7;
+      lMaxX2 = maxX2-2;
+      lMinX3 = maxX3-7;
+      lMaxX3 = maxX3-2;
+      fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
+
+      lMinX1 = 1;
+      lMaxX1 = 6;
+      lMinX2 = maxX2-7;
+      lMaxX2 = maxX2-6;
+      lMinX3 = maxX3-7;
+      lMaxX3 = maxX3-2;
+      fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
+
+      lMinX1 = 1;
+      lMaxX1 = 6;
+      lMinX2 = maxX2-7;
+      lMaxX2 = maxX2-2;
+      lMinX3 = maxX3-7;
+      lMaxX3 = maxX3-6;
+      fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
+      break;
+
+      break;
+   
+   //      TSE
+   case TSE:
+      lMinX1 = maxX1-7;
+      lMaxX1 = maxX1-6;
+      lMinX2 = 1;
+      lMaxX2 = 6;
+      lMinX3 = maxX3-7;
+      lMaxX3 = maxX3-2;
+      fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
+
+      lMinX1 = maxX1-7;
+      lMaxX1 = maxX1-2;
+      lMinX2 = 5;
+      lMaxX2 = 6;
+      lMinX3 = maxX3-7;
+      lMaxX3 = maxX3-2;
+      fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
+
+      lMinX1 = maxX1-7;
+      lMaxX1 = maxX1-2;
+      lMinX2 = 1;
+      lMaxX2 = 6;
+      lMinX3 = maxX3-7;
+      lMaxX3 = maxX3-6;
+      fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
+
+      break;
+   //      TSW
+   case TSW:
+      lMinX1 = 5;
+      lMaxX1 = 6;
+      lMinX2 = 1;
+      lMaxX2 = 6;
+      lMinX3 = maxX3-7;
+      lMaxX3 = maxX3-2;
+      fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
+
+      lMinX1 = 1;
+      lMaxX1 = 6;
+      lMinX2 = 5;
+      lMaxX2 = 6;
+      lMinX3 = maxX3-7;
+      lMaxX3 = maxX3-2;
+      fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
+
+      lMinX1 = 1;
+      lMaxX1 = 6;
+      lMinX2 = 1;
+      lMaxX2 = 6;
+      lMinX3 = maxX3-7;
+      lMaxX3 = maxX3-6;
+      fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
+
+      break;
+   //      BNE
+   case BNE:
+      lMinX1 = maxX1-7;
+      lMaxX1 = maxX1-6;
+      lMinX2 = maxX2-7;
+      lMaxX2 = maxX2-2;
+      lMinX3 = 1;
+      lMaxX3 = 6;
+      fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
+
+      lMinX1 = maxX1-7;
+      lMaxX1 = maxX1-2;
+      lMinX2 = maxX2-7;
+      lMaxX2 = maxX2-6;
+      lMinX3 = 1;
+      lMaxX3 = 6;
+      fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
+
+      lMinX1 = maxX1-7;
+      lMaxX1 = maxX1-2;
+      lMinX2 = maxX2-7;
+      lMaxX2 = maxX2-2;
+      lMinX3 = 5;
+      lMaxX3 = 6;
+      fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
+
+      break;
+   //      BNW
+   case BNW:
+      lMinX1 = 5;
+      lMaxX1 = 6;
+      lMinX2 = maxX2-7;
+      lMaxX2 = maxX2-2;
+      lMinX3 = 1;
+      lMaxX3 = 6;
+      fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
+
+      lMinX1 = 1;
+      lMaxX1 = 6;
+      lMinX2 = maxX2-7;
+      lMaxX2 = maxX2-6;
+      lMinX3 = 1;
+      lMaxX3 = 6;
+      fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
+
+      lMinX1 = 1;
+      lMaxX1 = 6;
+      lMinX2 = maxX2-7;
+      lMaxX2 = maxX2-2;
+      lMinX3 = 5;
+      lMaxX3 = 6;
+      fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
+
+      break;
+
+
+   //      BSE
+   case BSE:
+      lMinX1 = maxX1-7;
+      lMaxX1 = maxX1-6;
+      lMinX2 = 1;
+      lMaxX2 = 6;
+      lMinX3 = 1;
+      lMaxX3 = 6;
+      fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
+
+      lMinX1 = maxX1-7;
+      lMaxX1 = maxX1-2;
+      lMinX2 = 5;
+      lMaxX2 = 6;
+      lMinX3 = 1;
+      lMaxX3 = 6;
+      fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
+
+      lMinX1 = maxX1-7;
+      lMaxX1 = maxX1-2;
+      lMinX2 = 1;
+      lMaxX2 = 6;
+      lMinX3 = 5;
+      lMaxX3 = 6;
+      fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
+
+      break;
+
+   //BSW
+   case BSW:
+      lMinX1 = 5;
+      lMaxX1 = 6;
+      lMinX2 = 1;
+      lMaxX2 = 6;
+      lMinX3 = 1;
+      lMaxX3 = 6;
+      fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
+      
+      lMinX1 = 1;
+      lMaxX1 = 6;
+      lMinX2 = 5;
+      lMaxX2 = 6;
+      lMinX3 = 1;
+      lMaxX3 = 6;
+      fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
+
+      lMinX1 = 1;
+      lMaxX1 = 6;
+      lMinX2 = 1;
+      lMaxX2 = 6;
+      lMinX3 = 5;
+      lMaxX3 = 6;
+      fillSendVector(fFrom, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
+
+      break;
+	}
+}
+//////////////////////////////////////////////////////////////////////////
+template<  typename VectorTransmitter  > 
+void D3Q27ETFCOffVectorConnector< VectorTransmitter>::fillSendVector(SPtr<DistributionArray3D> fFrom, const int& lMinX1, const int& lMinX2, const int& lMinX3, const int& lMaxX1, const int& lMaxX2, const int& lMaxX3, vector_type& data, int& index)
+{
+	int ix1, ix2, ix3;
+	LBMReal xoff, yoff, zoff;
+	SPtr<BCArray3D> bcArray = block.lock()->getKernel()->getBCProcessor()->getBCArray();
+
+	for (ix3=lMinX3; ix3<lMaxX3; ix3+=2)
+	{
+		for (ix2=lMinX2; ix2<lMaxX2; ix2+=2)
+		{
+			for (ix1=lMinX1; ix1<lMaxX1; ix1+=2)
+			{
+				LBMReal icellC[27];
+				D3Q27ICell icellF;
+
+				int howManySolids= iprocessor->iCellHowManySolids(bcArray, ix1, ix2, ix3);
+
+				if(howManySolids == 0 || howManySolids == 8)
+				{
+					iprocessor->readICell(fFrom, icellF, ix1, ix2, ix3);
+					xoff=0.0; 
+					yoff=0.0;
+					zoff=0.0;
+				}
+				else
+				{
+					if(!iprocessor->findNeighborICell(bcArray, fFrom, icellF, bMaxX1, bMaxX2, bMaxX3, ix1, ix2, ix3, xoff, yoff, zoff))
+					{
+						std::string err = "For "+block.lock()->toString()+" x1="+UbSystem::toString(ix1)+", x2=" + UbSystem::toString(ix2)+", x3=" + UbSystem::toString(ix3)+
+							" interpolation is not implemented for other direction"+
+							" by using in: "+(std::string)typeid(*this).name()+ 
+							" or maybe you have a solid on the block boundary";
+                  //UBLOG(logINFO, err);
+						UB_THROW(UbException(UB_EXARGS, err));
+					}
+				}
+
+				iprocessor->interpolateFineToCoarse(icellF, icellC, xoff, yoff, zoff);
+				this->writeICellCtoData(data, index, icellC);
+			}
+		}
+	}
+}
+//////////////////////////////////////////////////////////////////////////
+template<  typename VectorTransmitter  > 
+void D3Q27ETFCOffVectorConnector< VectorTransmitter>::writeICellCtoData(vector_type& data, int& index, LBMReal* icellC) 
+{
+	for (int i = D3Q27System::STARTF; i < D3Q27System::ENDF+1; i++)
+	{
+		data[index++] = icellC[i];
+	}
+}
+//////////////////////////////////////////////////////////////////////////
+template<  typename VectorTransmitter  > 
+void D3Q27ETFCOffVectorConnector< VectorTransmitter>::getLocalMinMaxCF(int gMax, int& lMin, int& lMax)
+{
+	if (Utilities::isOdd(gMax))
+	{
+		if(connType == OddEvenSE || connType == OddOddNE)
+		{
+			lMin = 1;
+			lMax = gMax;
+		}
+	}
+}
+//////////////////////////////////////////////////////////////////////////
+template<  typename VectorTransmitter  > 
+void D3Q27ETFCOffVectorConnector< VectorTransmitter>::distributeReceiveVectors() 
+{
+	using namespace D3Q27System;
+
+	SPtr<DistributionArray3D>  fTo = block.lock()->getKernel()->getDataSet()->getFdistributions();
+	int maxX1 = (int)fTo->getNX1();
+	int maxX2 = (int)fTo->getNX2();
+	int maxX3 = (int)fTo->getNX3();
+	int minX1 = 0;
+	int minX2 = 0;
+	int minX3 = 0;
+
+	int lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3;
+	int index = 0;
+	vector_type& data = receiver->getData();
+
+	lMinX1 = minX1; lMinX2 = minX2; lMinX3 = minX3;
+	lMaxX1 = maxX1-1; lMaxX2 = maxX2-1; lMaxX3 = maxX3-1;
+
+	switch(sendDir)
+	{
+	case E: 
+		lMinX1 = maxX1-4;
+		lMaxX1 = lMinX1 + 1;
+		getLocalMinMaxCF(maxX2, lMinX2, lMaxX2);
+		getLocalMinMaxCF(maxX3, lMinX3, lMaxX3);
+		distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
+		break;
+	case W: 
+      ///////////////////////////////////////
+      ///DEBUG
+      //if (block.lock()->getGlobalID() == 2554)
+      //{
+      //   int test = 0;
+      //}
+      //////////////
+		lMinX1 = 2;
+		lMaxX1 = lMinX1 + 1;
+		getLocalMinMaxCF(maxX2, lMinX2, lMaxX2);
+		getLocalMinMaxCF(maxX3, lMinX3, lMaxX3);
+		distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
+		break;  
+	case N:
+		lMinX2 = maxX2-4;
+		lMaxX2 = lMinX2 + 1;
+		getLocalMinMaxCF(maxX1, lMinX1, lMaxX1);
+		getLocalMinMaxCF(maxX3, lMinX3, lMaxX3);
+		distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
+		break;
+	case S:
+		lMinX2 = 2;
+		lMaxX2 = lMinX2 + 1;
+		getLocalMinMaxCF(maxX1, lMinX1, lMaxX1);
+		getLocalMinMaxCF(maxX3, lMinX3, lMaxX3);
+		distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
+		break;
+	case T:
+		lMinX3 = maxX3-4;
+		lMaxX3 = lMinX3 + 1;
+		getLocalMinMaxCF(maxX1, lMinX1, lMaxX1);
+		getLocalMinMaxCF(maxX2, lMinX2, lMaxX2);
+		distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
+		break;
+	case B:
+		lMinX3 = 2;
+		lMaxX3 = lMinX3 + 1;
+		getLocalMinMaxCF(maxX1, lMinX1, lMaxX1);
+		getLocalMinMaxCF(maxX2, lMinX2, lMaxX2);
+		distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
+		break;
+
+		/////E-W-N-S
+	case NE: 
+		lMinX1 = maxX1-4;
+		lMaxX1 = lMinX1 + 3;
+		lMinX2 = maxX2-4;
+		lMaxX2 = lMinX2 + 3;
+		getLocalMinMaxCF(maxX3, lMinX3, lMaxX3);
+		distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
+		break;
+
+	case SW: 
+		lMinX1 = 0;
+		lMaxX1 = lMinX1 + 3;
+		lMinX2 = 0;
+		lMaxX2 = lMinX2 + 3;
+		getLocalMinMaxCF(maxX3, lMinX3, lMaxX3);
+		distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
+		break;
+
+	case SE: 
+		lMinX1 = maxX1-4;
+		lMaxX1 = lMinX1 + 3;
+		lMinX2 = 0;
+		lMaxX2 = lMinX2 + 3;
+		getLocalMinMaxCF(maxX3, lMinX3, lMaxX3);
+		distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
+		break;
+
+	case NW: 
+		lMinX1 = 0;
+		lMaxX1 = lMinX1 + 3;
+		lMinX2 = maxX2-4;
+		lMaxX2 = lMinX2 + 3;
+		getLocalMinMaxCF(maxX3, lMinX3, lMaxX3);
+		distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
+		break;
+	//	
+	//	/////T-B-E-W
+	case TE:
+		lMinX1 = maxX1-4;
+		lMaxX1 = lMinX1 + 3;
+		lMinX3 = maxX3-4;
+		lMaxX3 = lMinX3 + 3;
+		getLocalMinMaxCF(maxX2, lMinX2, lMaxX2);
+		distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
+		break;
+	
+	case BW:
+		lMinX1 = 0;
+		lMaxX1 = lMinX1 + 3;
+		lMinX3 = 0;
+		lMaxX3 = lMinX3 + 3;
+		getLocalMinMaxCF(maxX2, lMinX2, lMaxX2);
+		distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
+		break;
+	
+	case BE:
+		lMinX1 = maxX1-4;
+		lMaxX1 = lMinX1 + 3;
+		lMinX3 = 0;
+		lMaxX3 = lMinX3 + 3;
+		getLocalMinMaxCF(maxX2, lMinX2, lMaxX2);
+		distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
+		break;
+
+	case TW:
+		lMinX1 = 0;
+		lMaxX1 = lMinX1 + 3;
+		lMinX3 = maxX3-4;
+		lMaxX3 = lMinX3 + 3;
+		getLocalMinMaxCF(maxX2, lMinX2, lMaxX2);
+		distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
+		break;
+
+	//	////////////////T-B-N-S
+	//	
+	case TN:
+		lMinX2 = maxX2-4;
+		lMaxX2 = lMinX2 + 3;
+		lMinX3 = maxX3-4;
+		lMaxX3 = lMinX3 + 3;
+		getLocalMinMaxCF(maxX1, lMinX1, lMaxX1);
+		distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
+		break;
+
+	case BS:
+		lMinX2 = 0;
+		lMaxX2 = lMinX2 + 3;
+		lMinX3 = 0;
+		lMaxX3 = lMinX3 + 3;
+		getLocalMinMaxCF(maxX1, lMinX1, lMaxX1);
+		distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
+		break;
+
+	case BN:
+		lMinX2 = maxX2-4;
+		lMaxX2 = lMinX2 + 3;
+		lMinX3 = 0;
+		lMaxX3 = lMinX3 + 3;
+		getLocalMinMaxCF(maxX1, lMinX1, lMaxX1);
+		distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
+		break;
+
+	case TS:
+		lMinX2 = 0;
+		lMaxX2 = lMinX2 + 3;
+		lMinX3 = maxX3-4;
+		lMaxX3 = lMinX3 + 3;
+		getLocalMinMaxCF(maxX1, lMinX1, lMaxX1);
+		distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
+		break;
+
+   //   //TNE
+   case TNE:
+      lMinX1 = maxX1-4;
+      lMaxX1 = maxX1-1;
+      lMinX2 = maxX2-4;
+      lMaxX2 = maxX2-1;
+      lMinX3 = maxX3-4;
+      lMaxX3 = maxX3-1;
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
+      break;
+      //   TNW
+   case TNW:
+      lMinX1 = 0;
+      lMaxX1 = 3;
+      lMinX2 = maxX2-4;
+      lMaxX2 = maxX2-1;
+      lMinX3 = maxX3-4;
+      lMaxX3 = maxX3-1;
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
+      break;
+      //   TSE
+   case TSE:
+      lMinX1 = maxX1-4;
+      lMaxX1 = maxX1-1;
+      lMinX2 = 0;
+      lMaxX2 = 3;
+      lMinX3 = maxX3-4;
+      lMaxX3 = maxX3-1;
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
+      break;
+      //   TSW
+   case TSW:
+      lMinX1 = 0;
+      lMaxX1 = 3;
+      lMinX2 = 0;
+      lMaxX2 = 3;
+      lMinX3 = maxX3-4;
+      lMaxX3 = maxX3-1;
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
+      break;
+      //   BNE
+   case BNE:
+      lMinX1 = maxX1-4;
+      lMaxX1 = maxX1-1;
+      lMinX2 = maxX2-4;
+      lMaxX2 = maxX2-1;
+      lMinX3 = 0;
+      lMaxX3 = 3;
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
+      break;
+      //   BNW
+   case BNW:
+      lMinX1 = 0;
+      lMaxX1 = 3;
+      lMinX2 = maxX2-4;
+      lMaxX2 = maxX2-1;
+      lMinX3 = 0;
+      lMaxX3 = 3;
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
+      break;
+      //   BSE
+   case BSE:
+      lMinX1 = maxX1-4;
+      lMaxX1 = maxX1-1;
+      lMinX2 = 0;
+      lMaxX2 = 3;
+      lMinX3 = 0;
+      lMaxX3 = 3;
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
+      break;
+         //BSW
+   case BSW:
+      lMinX1 = 0;
+      lMaxX1 = 3;
+      lMinX2 = 0;
+      lMaxX2 = 3;
+      lMinX3 = 0;
+      lMaxX3 = 3;
+      distributeReceiveVector(fTo, lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, data, index);
+      break;
+	}
+}
+//////////////////////////////////////////////////////////////////////////
+template<  typename VectorTransmitter  > 
+void D3Q27ETFCOffVectorConnector< VectorTransmitter>::distributeReceiveVector(SPtr<DistributionArray3D> fTo, const int& lMinX1, const int& lMinX2, const int& lMinX3, const int& lMaxX1, const int& lMaxX2, const int& lMaxX3, vector_type& data, int& index)
+{
+	if(data.size() == 0) return; 
+
+	int ix1, ix2, ix3;
+	for (ix3=lMinX3; ix3<lMaxX3; ix3+=2)
+	{
+		for (ix2=lMinX2; ix2<lMaxX2; ix2+=2)
+		{
+			for (ix1=lMinX1; ix1<lMaxX1; ix1+=2)
+			{
+				D3Q27ICell icellF;
+				this->readICellFfromData(data, index, icellF);
+				iprocessor->writeICellInv(fTo, icellF, ix1, ix2, ix3);
+			}
+		}
+	}
+}
+//////////////////////////////////////////////////////////////////////////
+template<  typename VectorTransmitter  > 
+void D3Q27ETFCOffVectorConnector< VectorTransmitter>::readICellFfromData(vector_type& data, int& index, D3Q27ICell& icellF) 
+{
+	readNodeFromVector(data, index, icellF.BSW);
+	readNodeFromVector(data, index, icellF.BSE);
+	readNodeFromVector(data, index, icellF.BNW);
+	readNodeFromVector(data, index, icellF.BNE);
+	readNodeFromVector(data, index, icellF.TSW);
+	readNodeFromVector(data, index, icellF.TSE);
+	readNodeFromVector(data, index, icellF.TNW);
+	readNodeFromVector(data, index, icellF.TNE);
+}
+//////////////////////////////////////////////////////////////////////////
+template<  typename VectorTransmitter  > 
+void D3Q27ETFCOffVectorConnector< VectorTransmitter>::readNodeFromVector(vector_type& data, int& index, LBMReal* inode)
+{
+	for (int i = D3Q27System::STARTF; i < D3Q27System::ENDF+1; i++)
+	{
+		inode[i] = data[index++];
+	}
+}
+//////////////////////////////////////////////////////////////////////////
+template<  typename VectorTransmitter  > 
+void D3Q27ETFCOffVectorConnector< VectorTransmitter>::getLocalMinMax(int& minX1, int& minX2, int& minX3, int& maxX1, int& maxX2, int& maxX3)
+{
+	using namespace D3Q27System;
+    int TminX1=minX1; int TminX2=minX2; int TminX3=minX3; int TmaxX1=maxX1; int TmaxX2=maxX2; int TmaxX3=maxX3;
+
+	if(block.lock()->hasInterpolationFlagFC(E))
+	{
+		if (maxX1==TmaxX1) maxX1 -= 3;
+	}
+	if(block.lock()->hasInterpolationFlagFC(W))
+	{
+		if (minX1==TminX1) minX1 += 4;
+	}
+	if(block.lock()->hasInterpolationFlagFC(N))
+	{
+		if (maxX2==TmaxX2) maxX2 -= 3;
+	}
+	if(block.lock()->hasInterpolationFlagFC(S))
+	{
+		if (minX2==TminX2) minX2 += 4;
+	}
+	if(block.lock()->hasInterpolationFlagFC(T))
+	{
+		if (maxX3==TmaxX3) maxX3 -= 3;
+	}
+	if(block.lock()->hasInterpolationFlagFC(B))
+	{
+		if (minX3==TminX3) minX3 += 4;
+	}
+
+	////////////
+	/////E-W-N-S
+	if(block.lock()->hasInterpolationFlagFC(NE)&& !block.lock()->hasInterpolationFlagFC(N) && !block.lock()->hasInterpolationFlagFC(E))
+	{
+		if (maxX1==TmaxX1) maxX1 -= 3;
+		if (maxX2==TmaxX2) maxX2 -= 3;
+	}
+	if(block.lock()->hasInterpolationFlagFC(SW)&& !block.lock()->hasInterpolationFlagFC(W) && !block.lock()->hasInterpolationFlagFC(S))
+	{
+		if (minX1==TminX1) minX1 += 4;
+		if (minX2==TminX2) minX2 += 4;
+	}
+	if(block.lock()->hasInterpolationFlagFC(SE)&& !block.lock()->hasInterpolationFlagFC(E) && !block.lock()->hasInterpolationFlagFC(S))
+	{
+		if (maxX1==TmaxX1) maxX1 -= 3;
+		if (minX2==TminX2) minX2 += 4;
+	}
+	if(block.lock()->hasInterpolationFlagFC(NW)&& !block.lock()->hasInterpolationFlagFC(N) && !block.lock()->hasInterpolationFlagFC(W))
+	{
+		if (minX1==TminX1) minX1 += 4;
+		if (maxX2==TmaxX2) maxX2 -= 3;
+	}
+
+	//////T-B-E-W
+	if(block.lock()->hasInterpolationFlagFC(TE) && !block.lock()->hasInterpolationFlagFC(E) && !block.lock()->hasInterpolationFlagFC(T))
+	{
+		if (maxX1==TmaxX1) maxX1 -= 3;
+		if (maxX3==TmaxX3) maxX3 -= 3;
+	}
+	if(block.lock()->hasInterpolationFlagFC(BW)&& !block.lock()->hasInterpolationFlagFC(W) && !block.lock()->hasInterpolationFlagFC(B))
+	{
+		if (minX1==TminX1) minX1 += 4;
+		if (minX3==TminX3) minX3 += 4;
+	}
+	if(block.lock()->hasInterpolationFlagFC(BE)&& !block.lock()->hasInterpolationFlagFC(E) && !block.lock()->hasInterpolationFlagFC(B))
+	{
+		if (maxX1==TmaxX1) maxX1 -= 3;
+		if (minX3==TminX3) minX3 += 4;
+	}
+	if(block.lock()->hasInterpolationFlagFC(TW)&& !block.lock()->hasInterpolationFlagFC(W) && !block.lock()->hasInterpolationFlagFC(T))
+	{
+		if (minX1==TminX1) minX1 += 4;
+		if (maxX3==TmaxX3) maxX3 -= 3;
+	}
+
+
+	////T-B-N-S
+	if(block.lock()->hasInterpolationFlagFC(TN)&& !block.lock()->hasInterpolationFlagFC(N) && !block.lock()->hasInterpolationFlagFC(T))
+	{
+		if (maxX2==TmaxX2) maxX2 -= 3; 
+		if (maxX3==TmaxX3) maxX3 -= 3;
+	}
+	if(block.lock()->hasInterpolationFlagFC(BS)&& !block.lock()->hasInterpolationFlagFC(S) && !block.lock()->hasInterpolationFlagFC(B))
+	{
+		if (minX2==TminX2) minX2 += 4;
+		if (minX3==TminX3) minX3 += 4;
+	}
+	if(block.lock()->hasInterpolationFlagFC(BN)&& !block.lock()->hasInterpolationFlagFC(N) && !block.lock()->hasInterpolationFlagFC(B))
+	{
+		if (maxX2==TmaxX2) maxX2 -= 3; 
+		if (minX3==TminX3) minX3 += 4;
+	}
+	if(block.lock()->hasInterpolationFlagFC(TS) && !block.lock()->hasInterpolationFlagFC(S) && !block.lock()->hasInterpolationFlagFC(T))
+	{
+		if (minX2==TminX2) minX2 += 4;
+		if (maxX3==TmaxX3) maxX3 -= 3;
+	}
+
+   //if (block.lock()->hasInterpolationFlagFC(D3Q27System::TNE)&&!block.lock()->hasInterpolationFlagFC(D3Q27System::TE)&&!block.lock()->hasInterpolationFlagFC(D3Q27System::TN)&&!block.lock()->hasInterpolationFlagFC(D3Q27System::NE)&&!block.lock()->hasInterpolationFlagFC(D3Q27System::T)&&!block.lock()->hasInterpolationFlagFC(D3Q27System::N) && !block.lock()->hasInterpolationFlagFC(D3Q27System::E))
+   //if (!block.lock()->hasInterpolationFlagFC(D3Q27System::TE)&&!block.lock()->hasInterpolationFlagFC(D3Q27System::T) && !block.lock()->hasInterpolationFlagFC(D3Q27System::E))
+   //{
+   //   if (maxX1==TmaxX1) maxX1 -= 3;
+   //   if (maxX2==TmaxX2) maxX2 -= 3;
+   //   if (maxX3==TmaxX3) maxX3 -= 3;
+   //}
+}
+//////////////////////////////////////////////////////////////////////////
+template<  typename VectorTransmitter  >
+void D3Q27ETFCOffVectorConnector< VectorTransmitter>::getLocalMinMax(int& minX1, int& minX2, int& minX3, int& maxX1, int& maxX2, int& maxX3, CFconnectorType connType)
+{
+   using namespace D3Q27System;
+   int TminX1 = minX1; int TminX2 = minX2; int TminX3 = minX3; int TmaxX1 = maxX1; int TmaxX2 = maxX2; int TmaxX3 = maxX3;
+
+   if (block.lock()->hasInterpolationFlagFC(E))
+   {
+      if (maxX1==TmaxX1) maxX1 -= 3;
+   }
+   if (block.lock()->hasInterpolationFlagFC(W))
+   {
+      if (minX1==TminX1) minX1 += 4;
+   }
+   if (block.lock()->hasInterpolationFlagFC(N))
+   {
+      if (maxX2==TmaxX2) maxX2 -= 3;
+   }
+   if (block.lock()->hasInterpolationFlagFC(S))
+   {
+      if (minX2==TminX2) minX2 += 4;
+   }
+   if (block.lock()->hasInterpolationFlagFC(T))
+   {
+      if (maxX3==TmaxX3) maxX3 -= 3;
+   }
+   if (block.lock()->hasInterpolationFlagFC(B))
+   {
+      if (minX3==TminX3) minX3 += 4;
+   }
+
+   ////////////
+   /////E-W-N-S
+   if (block.lock()->hasInterpolationFlagFC(NE)&& !block.lock()->hasInterpolationFlagFC(N) && !block.lock()->hasInterpolationFlagFC(E))
+   {
+      if (maxX1==TmaxX1) maxX1 -= 3;
+      if (maxX2==TmaxX2) maxX2 -= 3;
+   }
+   if (block.lock()->hasInterpolationFlagFC(SW)&& !block.lock()->hasInterpolationFlagFC(W) && !block.lock()->hasInterpolationFlagFC(S))
+   {
+      if (minX1==TminX1) minX1 += 4;
+      if (minX2==TminX2) minX2 += 4;
+   }
+   if (block.lock()->hasInterpolationFlagFC(SE)&& !block.lock()->hasInterpolationFlagFC(E) && !block.lock()->hasInterpolationFlagFC(S))
+   {
+      if (maxX1==TmaxX1) maxX1 -= 3;
+      if (minX2==TminX2) minX2 += 4;
+   }
+   if (block.lock()->hasInterpolationFlagFC(NW)&& !block.lock()->hasInterpolationFlagFC(N) && !block.lock()->hasInterpolationFlagFC(W))
+   {
+      if (minX1==TminX1) minX1 += 4;
+      if (maxX2==TmaxX2) maxX2 -= 3;
+   }
+
+   //////T-B-E-W
+   if (block.lock()->hasInterpolationFlagFC(TE) && !block.lock()->hasInterpolationFlagFC(E) && !block.lock()->hasInterpolationFlagFC(T))
+   {
+      if (maxX1==TmaxX1) maxX1 -= 3;
+      if (maxX3==TmaxX3) maxX3 -= 3;
+   }
+   if (block.lock()->hasInterpolationFlagFC(BW)&& !block.lock()->hasInterpolationFlagFC(W) && !block.lock()->hasInterpolationFlagFC(B))
+   {
+      if (minX1==TminX1) minX1 += 4;
+      if (minX3==TminX3) minX3 += 4;
+   }
+   if (block.lock()->hasInterpolationFlagFC(BE)&& !block.lock()->hasInterpolationFlagFC(E) && !block.lock()->hasInterpolationFlagFC(B))
+   {
+      if (maxX1==TmaxX1) maxX1 -= 3;
+      if (minX3==TminX3) minX3 += 4;
+   }
+   if (block.lock()->hasInterpolationFlagFC(TW)&& !block.lock()->hasInterpolationFlagFC(W) && !block.lock()->hasInterpolationFlagFC(T))
+   {
+      if (minX1==TminX1) minX1 += 4;
+      if (maxX3==TmaxX3) maxX3 -= 3;
+   }
+
+
+   ////T-B-N-S
+   if (block.lock()->hasInterpolationFlagFC(TN)&& !block.lock()->hasInterpolationFlagFC(N) && !block.lock()->hasInterpolationFlagFC(T))
+   {
+      if (maxX2==TmaxX2) maxX2 -= 3;
+      if (maxX3==TmaxX3) maxX3 -= 3;
+   }
+   if (block.lock()->hasInterpolationFlagFC(BS)&& !block.lock()->hasInterpolationFlagFC(S) && !block.lock()->hasInterpolationFlagFC(B))
+   {
+      if (minX2==TminX2) minX2 += 4;
+      if (minX3==TminX3) minX3 += 4;
+   }
+   if (block.lock()->hasInterpolationFlagFC(BN)&& !block.lock()->hasInterpolationFlagFC(N) && !block.lock()->hasInterpolationFlagFC(B))
+   {
+      if (maxX2==TmaxX2) maxX2 -= 3;
+      if (minX3==TminX3) minX3 += 4;
+   }
+   if (block.lock()->hasInterpolationFlagFC(TS) && !block.lock()->hasInterpolationFlagFC(S) && !block.lock()->hasInterpolationFlagFC(T))
+   {
+      if (minX2==TminX2) minX2 += 4;
+      if (maxX3==TmaxX3) maxX3 -= 3;
+   }
+
+   //if (block.lock()->hasInterpolationFlagFC(D3Q27System::TNE)&&!block.lock()->hasInterpolationFlagFC(D3Q27System::TE)&&!block.lock()->hasInterpolationFlagFC(D3Q27System::TN)&&!block.lock()->hasInterpolationFlagFC(D3Q27System::NE)&&!block.lock()->hasInterpolationFlagFC(D3Q27System::T)&&!block.lock()->hasInterpolationFlagFC(D3Q27System::N) && !block.lock()->hasInterpolationFlagFC(D3Q27System::E))
+   //{
+   //   if (maxX1==TmaxX1) maxX1 -= 3;
+   //   if (maxX2==TmaxX2) maxX2 -= 3;
+   //   if (maxX3==TmaxX3) maxX3 -= 3;
+   //}
+}
+//////////////////////////////////////////////////////////////////////////
+template<  typename VectorTransmitter  > 
+void D3Q27ETFCOffVectorConnector< VectorTransmitter>::getLocalOffsets(const int& gMax, int& oMin)
+{
+	if (Utilities::isEven(gMax))
+	{
+		oMin = 0;
+	}
+	if (Utilities::isOdd(gMax))
+	{
+		oMin = -1;
+	}
+
+}
+//////////////////////////////////////////////////////////////////////////
+template<  typename VectorTransmitter  > 
+void D3Q27ETFCOffVectorConnector< VectorTransmitter>::getLocalMins(int& minX1, int& minX2, int& minX3, const int& oMinX1, const int& oMinX2, const int& oMinX3)
+{
+	using namespace D3Q27System;
+
+	switch(sendDir)
+	{
+	case E: case W:
+		if(connType == OddEvenSE)
+			minX2 += oMinX2;
+		if(connType == OddOddNE)
+		{
+			minX2 += oMinX2;
+			minX3 += oMinX3;
+		}
+		if(connType == EvenOddNW)
+			minX3 += oMinX3;
+		break;
+	case N: case S:
+		if(connType == OddEvenSE)
+			minX1 += oMinX1;
+		if(connType == OddOddNE)
+		{
+			minX1 += oMinX1;
+			minX3 += oMinX3;
+		}
+		if(connType == EvenOddNW)
+			minX3 += oMinX3;
+		break;
+	case T: case B:
+		if(connType == OddEvenSE)
+			minX1 += oMinX1;
+		if(connType == OddOddNE)
+		{
+			minX1 += oMinX1;
+			minX2 += oMinX2;
+		}
+		if(connType == EvenOddNW)
+			minX2 += oMinX2;
+		break;
+
+		/////
+	case NE: case SW: case SE: case NW:
+		//case SW:
+		if(connType == OddEvenSE)
+			//minX2 += oMinX2;
+		if(connType == OddOddNE)
+		{
+			//minX2 += oMinX2;
+			minX3 += oMinX3;
+		}
+		if(connType == EvenOddNW)
+			minX3 += oMinX3;
+		break;
+
+		//////
+	case TE: case BW: case BE: case TW:
+		if(connType == OddEvenSE)
+	//		minX1 += oMinX1;
+		if(connType == OddOddNE)
+		{
+	//		minX1 += oMinX1;
+			minX2 += oMinX2;
+		}
+		if(connType == EvenOddNW)
+			minX2 += oMinX2;
+		break;
+
+	//	//////
+	case TN: case BS: case BN: case TS:
+		if(connType == OddEvenSE)
+			minX1 += oMinX1;
+		if(connType == OddOddNE)
+		{
+			minX1 += oMinX1;
+			//minX3 += oMinX3;
+		}
+		if(connType == EvenOddNW)
+			//minX3 += oMinX3;
+		break;
+
+	//	/////
+	//	case TNE: case TNW: case TSE: case TSW: case BNE: case BNW: case BSE: case BSW:
+	//	if(connType == OddEvenSE)
+	//	//	minX1 += oMinX1;
+	//	if(connType == OddOddNE)
+	//	{
+	//		//minX1 += oMinX1;
+	//		//minX3 += oMinX3;
+	//	}
+	//	if(connType == EvenOddNW)
+	//		//minX3 += oMinX3;
+	//	break;
+	}
+}
+//////////////////////////////////////////////////////////////////////////
+template< typename VectorTransmitter >
+double D3Q27ETFCOffVectorConnector<VectorTransmitter>::getSendRecieveTime()
+{
+	return 0;
+}
+
+#endif
diff --git a/src/cpu/VirtualFluidsCore/Connectors/D3Q27ETFullDirectConnector.cpp b/src/cpu/VirtualFluidsCore/Connectors/D3Q27ETFullDirectConnector.cpp
index e47bee86ad69ad7dd9dca7f855eeda3275015729..8519b39d0b2963cd6248d3c3a266d9e84b60e772 100644
--- a/src/cpu/VirtualFluidsCore/Connectors/D3Q27ETFullDirectConnector.cpp
+++ b/src/cpu/VirtualFluidsCore/Connectors/D3Q27ETFullDirectConnector.cpp
@@ -1,243 +1,243 @@
-//=======================================================================================
-// ____          ____    __    ______     __________   __      __       __        __         
-// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
-//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
-//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
-//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
-//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
-//      \    \  |    |   ________________________________________________________________    
-//       \    \ |    |  |  ______________________________________________________________|   
-//        \    \|    |  |  |         __          __     __     __     ______      _______    
-//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
-//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
-//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
-//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
-//
-//  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 D3Q27ETFullDirectConnector.cpp
-//! \ingroup Connectors
-//! \author Konstantin Kutscher
-//=======================================================================================
-
-#include "D3Q27ETFullDirectConnector.h"
-#include "LBMKernel.h"
-#include "D3Q27EsoTwist3DSplittedVector.h"
-#include "DataSet3D.h"
-
-using namespace std;
-
-D3Q27ETFullDirectConnector::D3Q27ETFullDirectConnector(SPtr<Block3D> from, SPtr<Block3D> to, int sendDir)
-   : LocalBlock3DConnector(from, to, sendDir)
-
-{
-
-}
-//////////////////////////////////////////////////////////////////////////
-void D3Q27ETFullDirectConnector::init()
-{
-   maxX1 = (int)this->from.lock()->getKernel()->getDataSet()->getFdistributions()->getNX1() - 1;
-   maxX2 = (int)this->from.lock()->getKernel()->getDataSet()->getFdistributions()->getNX2() - 1;
-   maxX3 = (int)this->from.lock()->getKernel()->getDataSet()->getFdistributions()->getNX3() - 1;
-
-   fFrom = dynamic_pointer_cast<EsoTwist3D>(from.lock()->getKernel()->getDataSet()->getFdistributions());
-   fTo = dynamic_pointer_cast<EsoTwist3D>(to.lock()->getKernel()->getDataSet()->getFdistributions());
-}
-//////////////////////////////////////////////////////////////////////////
-void D3Q27ETFullDirectConnector::sendVectors()
-{
-   localDistributionsFrom = dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(this->fFrom)->getLocalDistributions();
-   nonLocalDistributionsFrom = dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(this->fFrom)->getNonLocalDistributions();
-   zeroDistributionsFrom = dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(this->fFrom)->getZeroDistributions();
-
-   localDistributionsTo = dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(this->fTo)->getLocalDistributions();
-   nonLocalDistributionsTo = dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(this->fTo)->getNonLocalDistributions();
-   zeroDistributionsTo = dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(this->fTo)->getZeroDistributions();
-
-   //EAST
-   if (sendDir == D3Q27System::E)
-   {
-      for (int x3 = 1; x3 < maxX3; x3++)
-      {
-         for (int x2 = 1; x2 < maxX2; x2++)
-         {
-            exchangeData(maxX1 - 1, x2, x3, 0, x2, x3);
-         }
-      }
-   }
-   //WEST
-   else if (sendDir == D3Q27System::W)
-   {
-      for (int x3 = 1; x3 < maxX3; x3++)
-      {
-         for (int x2 = 1; x2 < maxX2; x2++)
-         {
-            exchangeData(1, x2, x3, maxX1, x2, x3);
-         }
-      }
-   }
-   //NORTH
-   else if (sendDir == D3Q27System::N)
-   {
-      for (int x3 = 1; x3 < maxX3; x3++)
-      {
-         for (int x1 = 1; x1 < maxX1; x1++)
-         {
-            exchangeData(x1, maxX2 - 1, x3, x1, 0, x3);
-         }
-      }
-   }
-   //SOUTH
-   else if (sendDir == D3Q27System::S)
-   {
-      for (int x3 = 1; x3 < maxX3; x3++)
-      {
-         for (int x1 = 1; x1 < maxX1; x1++)
-         {
-            exchangeData(x1, 1, x3, x1, maxX2, x3);
-         }
-      }
-   }
-
-   //TOP
-   else if (sendDir == D3Q27System::T)
-   {
-      for (int x2 = 1; x2 < maxX2; x2++)
-      {
-         for (int x1 = 1; x1 < maxX1; x1++)
-         {
-            exchangeData(x1, x2, maxX3 - 1, x1, x2, 0);
-         }
-      }
-   }
-   //BOTTOM
-   else if (sendDir == D3Q27System::B)
-   {
-      for (int x2 = 1; x2 < maxX2; x2++)
-      {
-         for (int x1 = 1; x1 < maxX1; x1++)
-         {
-            exchangeData(x1, x2, 1, x1, x2, maxX3);
-         }
-      }
-   }
-   //NORTHEAST
-   else if (sendDir == D3Q27System::NE)
-   {
-      for (int x3 = 1; x3 < maxX3; x3++)
-      {
-         exchangeData(maxX1 - 1, maxX2 - 1, x3, 0, 0, x3);
-      }
-   }
-   //NORTHWEST
-   else if (sendDir == D3Q27System::NW)
-   {
-      for (int x3 = 1; x3 < maxX3; x3++)
-      {
-         exchangeData(1, maxX2 - 1, x3, maxX1, 0, x3);
-      }
-   }
-   //SOUTHWEST
-   else if (sendDir == D3Q27System::SW)
-   {
-      for (int x3 = 1; x3 < maxX3; x3++)
-      {
-         exchangeData(1, 1, x3, maxX1, maxX2, x3);
-      }
-   }
-   //SOUTHEAST
-   else if (sendDir == D3Q27System::SE)
-   {
-      for (int x3 = 1; x3 < maxX3; x3++)
-      {
-         exchangeData(maxX1 - 1, 1, x3, 0, maxX2, x3);
-      }
-   }
-   else if (sendDir == D3Q27System::TE)
-      for (int x2 = 1; x2 < maxX2; x2++)
-      {
-         exchangeData(maxX1 - 1, x2, maxX3 - 1, 0, x2, 0);
-      }
-   else if (sendDir == D3Q27System::BW)
-      for (int x2 = 1; x2 < maxX2; x2++)
-      {
-         exchangeData(1, x2, 1, maxX1, x2, maxX3);
-      }
-   else if (sendDir == D3Q27System::BE)
-      for (int x2 = 1; x2 < maxX2; x2++)
-      {
-         exchangeData(maxX1 - 1, x2, 1, 0, x2, maxX3);
-      }
-   else if (sendDir == D3Q27System::TW)
-      for (int x2 = 1; x2 < maxX2; x2++)
-      {
-         exchangeData(1, x2, maxX3 - 1, maxX1, x2, 0);
-      }
-   else if (sendDir == D3Q27System::TN)
-      for (int x1 = 1; x1 < maxX1; x1++)
-      {
-         exchangeData(x1, maxX2 - 1, maxX3 - 1, x1, 0, 0);
-      }
-   else if (sendDir == D3Q27System::BS)
-      for (int x1 = 1; x1 < maxX1; x1++)
-      {
-         exchangeData(x1, 1, 1, x1, maxX2, maxX3);
-      }
-   else if (sendDir == D3Q27System::BN)
-      for (int x1 = 1; x1 < maxX1; x1++)
-      {
-         exchangeData(x1, maxX2 - 1, 1, x1, 0, maxX3);
-      }
-
-   else if (sendDir == D3Q27System::TS)
-      for (int x1 = 1; x1 < maxX1; x1++)
-      {
-         exchangeData(x1, 1, maxX3 - 1, x1, maxX2, 0);
-      }
-
-   else if (sendDir == D3Q27System::TSW)
-   {
-      exchangeData(1, 1, maxX3 - 1, maxX1, maxX2, 0);
-   }
-   else if (sendDir == D3Q27System::TSE)
-   {
-      exchangeData(maxX1 - 1, 1, maxX3 - 1, 0, maxX2, 0);
-   }
-   else if (sendDir == D3Q27System::TNW)
-   {
-      exchangeData(1, maxX2 - 1, maxX3 - 1, maxX1, 0, 0);
-   }
-   else if (sendDir == D3Q27System::TNE)
-   {
-      exchangeData(maxX1 - 1, maxX2 - 1, maxX3 - 1, 0, 0, 0);
-   }
-   else if (sendDir == D3Q27System::BSW)
-   {
-      exchangeData(1, 1, 1, maxX1, maxX2, maxX3);
-   }
-   else if (sendDir == D3Q27System::BSE)
-   {
-      exchangeData(maxX1 - 1, 1, 1, 0, maxX2, maxX3);
-   }
-   else if (sendDir == D3Q27System::BNW)
-   {
-      exchangeData(1, maxX2 - 1, 1, maxX1, 0, maxX3);
-   }
-   else if (sendDir == D3Q27System::BNE)
-   {
-      exchangeData(maxX1 - 1, maxX2 - 1, 1, 0, 0, maxX3);
-   }
-   else UB_THROW(UbException(UB_EXARGS, "unknown dir"));
-}
-
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 D3Q27ETFullDirectConnector.cpp
+//! \ingroup Connectors
+//! \author Konstantin Kutscher
+//=======================================================================================
+
+#include "D3Q27ETFullDirectConnector.h"
+#include "LBMKernel.h"
+#include "D3Q27EsoTwist3DSplittedVector.h"
+#include "DataSet3D.h"
+
+using namespace std;
+
+D3Q27ETFullDirectConnector::D3Q27ETFullDirectConnector(SPtr<Block3D> from, SPtr<Block3D> to, int sendDir)
+   : LocalBlock3DConnector(from, to, sendDir)
+
+{
+
+}
+//////////////////////////////////////////////////////////////////////////
+void D3Q27ETFullDirectConnector::init()
+{
+   maxX1 = (int)this->from.lock()->getKernel()->getDataSet()->getFdistributions()->getNX1() - 1;
+   maxX2 = (int)this->from.lock()->getKernel()->getDataSet()->getFdistributions()->getNX2() - 1;
+   maxX3 = (int)this->from.lock()->getKernel()->getDataSet()->getFdistributions()->getNX3() - 1;
+
+   fFrom = dynamic_pointer_cast<EsoTwist3D>(from.lock()->getKernel()->getDataSet()->getFdistributions());
+   fTo = dynamic_pointer_cast<EsoTwist3D>(to.lock()->getKernel()->getDataSet()->getFdistributions());
+}
+//////////////////////////////////////////////////////////////////////////
+void D3Q27ETFullDirectConnector::sendVectors()
+{
+   localDistributionsFrom = dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(this->fFrom)->getLocalDistributions();
+   nonLocalDistributionsFrom = dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(this->fFrom)->getNonLocalDistributions();
+   zeroDistributionsFrom = dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(this->fFrom)->getZeroDistributions();
+
+   localDistributionsTo = dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(this->fTo)->getLocalDistributions();
+   nonLocalDistributionsTo = dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(this->fTo)->getNonLocalDistributions();
+   zeroDistributionsTo = dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(this->fTo)->getZeroDistributions();
+
+   //EAST
+   if (sendDir == D3Q27System::E)
+   {
+      for (int x3 = 1; x3 < maxX3; x3++)
+      {
+         for (int x2 = 1; x2 < maxX2; x2++)
+         {
+            exchangeData(maxX1 - 1, x2, x3, 0, x2, x3);
+         }
+      }
+   }
+   //WEST
+   else if (sendDir == D3Q27System::W)
+   {
+      for (int x3 = 1; x3 < maxX3; x3++)
+      {
+         for (int x2 = 1; x2 < maxX2; x2++)
+         {
+            exchangeData(1, x2, x3, maxX1, x2, x3);
+         }
+      }
+   }
+   //NORTH
+   else if (sendDir == D3Q27System::N)
+   {
+      for (int x3 = 1; x3 < maxX3; x3++)
+      {
+         for (int x1 = 1; x1 < maxX1; x1++)
+         {
+            exchangeData(x1, maxX2 - 1, x3, x1, 0, x3);
+         }
+      }
+   }
+   //SOUTH
+   else if (sendDir == D3Q27System::S)
+   {
+      for (int x3 = 1; x3 < maxX3; x3++)
+      {
+         for (int x1 = 1; x1 < maxX1; x1++)
+         {
+            exchangeData(x1, 1, x3, x1, maxX2, x3);
+         }
+      }
+   }
+
+   //TOP
+   else if (sendDir == D3Q27System::T)
+   {
+      for (int x2 = 1; x2 < maxX2; x2++)
+      {
+         for (int x1 = 1; x1 < maxX1; x1++)
+         {
+            exchangeData(x1, x2, maxX3 - 1, x1, x2, 0);
+         }
+      }
+   }
+   //BOTTOM
+   else if (sendDir == D3Q27System::B)
+   {
+      for (int x2 = 1; x2 < maxX2; x2++)
+      {
+         for (int x1 = 1; x1 < maxX1; x1++)
+         {
+            exchangeData(x1, x2, 1, x1, x2, maxX3);
+         }
+      }
+   }
+   //NORTHEAST
+   else if (sendDir == D3Q27System::NE)
+   {
+      for (int x3 = 1; x3 < maxX3; x3++)
+      {
+         exchangeData(maxX1 - 1, maxX2 - 1, x3, 0, 0, x3);
+      }
+   }
+   //NORTHWEST
+   else if (sendDir == D3Q27System::NW)
+   {
+      for (int x3 = 1; x3 < maxX3; x3++)
+      {
+         exchangeData(1, maxX2 - 1, x3, maxX1, 0, x3);
+      }
+   }
+   //SOUTHWEST
+   else if (sendDir == D3Q27System::SW)
+   {
+      for (int x3 = 1; x3 < maxX3; x3++)
+      {
+         exchangeData(1, 1, x3, maxX1, maxX2, x3);
+      }
+   }
+   //SOUTHEAST
+   else if (sendDir == D3Q27System::SE)
+   {
+      for (int x3 = 1; x3 < maxX3; x3++)
+      {
+         exchangeData(maxX1 - 1, 1, x3, 0, maxX2, x3);
+      }
+   }
+   else if (sendDir == D3Q27System::TE)
+      for (int x2 = 1; x2 < maxX2; x2++)
+      {
+         exchangeData(maxX1 - 1, x2, maxX3 - 1, 0, x2, 0);
+      }
+   else if (sendDir == D3Q27System::BW)
+      for (int x2 = 1; x2 < maxX2; x2++)
+      {
+         exchangeData(1, x2, 1, maxX1, x2, maxX3);
+      }
+   else if (sendDir == D3Q27System::BE)
+      for (int x2 = 1; x2 < maxX2; x2++)
+      {
+         exchangeData(maxX1 - 1, x2, 1, 0, x2, maxX3);
+      }
+   else if (sendDir == D3Q27System::TW)
+      for (int x2 = 1; x2 < maxX2; x2++)
+      {
+         exchangeData(1, x2, maxX3 - 1, maxX1, x2, 0);
+      }
+   else if (sendDir == D3Q27System::TN)
+      for (int x1 = 1; x1 < maxX1; x1++)
+      {
+         exchangeData(x1, maxX2 - 1, maxX3 - 1, x1, 0, 0);
+      }
+   else if (sendDir == D3Q27System::BS)
+      for (int x1 = 1; x1 < maxX1; x1++)
+      {
+         exchangeData(x1, 1, 1, x1, maxX2, maxX3);
+      }
+   else if (sendDir == D3Q27System::BN)
+      for (int x1 = 1; x1 < maxX1; x1++)
+      {
+         exchangeData(x1, maxX2 - 1, 1, x1, 0, maxX3);
+      }
+
+   else if (sendDir == D3Q27System::TS)
+      for (int x1 = 1; x1 < maxX1; x1++)
+      {
+         exchangeData(x1, 1, maxX3 - 1, x1, maxX2, 0);
+      }
+
+   else if (sendDir == D3Q27System::TSW)
+   {
+      exchangeData(1, 1, maxX3 - 1, maxX1, maxX2, 0);
+   }
+   else if (sendDir == D3Q27System::TSE)
+   {
+      exchangeData(maxX1 - 1, 1, maxX3 - 1, 0, maxX2, 0);
+   }
+   else if (sendDir == D3Q27System::TNW)
+   {
+      exchangeData(1, maxX2 - 1, maxX3 - 1, maxX1, 0, 0);
+   }
+   else if (sendDir == D3Q27System::TNE)
+   {
+      exchangeData(maxX1 - 1, maxX2 - 1, maxX3 - 1, 0, 0, 0);
+   }
+   else if (sendDir == D3Q27System::BSW)
+   {
+      exchangeData(1, 1, 1, maxX1, maxX2, maxX3);
+   }
+   else if (sendDir == D3Q27System::BSE)
+   {
+      exchangeData(maxX1 - 1, 1, 1, 0, maxX2, maxX3);
+   }
+   else if (sendDir == D3Q27System::BNW)
+   {
+      exchangeData(1, maxX2 - 1, 1, maxX1, 0, maxX3);
+   }
+   else if (sendDir == D3Q27System::BNE)
+   {
+      exchangeData(maxX1 - 1, maxX2 - 1, 1, 0, 0, maxX3);
+   }
+   else UB_THROW(UbException(UB_EXARGS, "unknown dir"));
+}
+
diff --git a/src/cpu/VirtualFluidsCore/Connectors/D3Q27ETFullDirectConnector.h b/src/cpu/VirtualFluidsCore/Connectors/D3Q27ETFullDirectConnector.h
index 1d290effc0f93348a9e4e7feaedf1e949b61cad2..b9f2d1c24e1df8651c7d5c8e1b6a3aad4d1ddbb1 100644
--- a/src/cpu/VirtualFluidsCore/Connectors/D3Q27ETFullDirectConnector.h
+++ b/src/cpu/VirtualFluidsCore/Connectors/D3Q27ETFullDirectConnector.h
@@ -1,107 +1,107 @@
-//=======================================================================================
-// ____          ____    __    ______     __________   __      __       __        __         
-// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
-//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
-//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
-//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
-//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
-//      \    \  |    |   ________________________________________________________________    
-//       \    \ |    |  |  ______________________________________________________________|   
-//        \    \|    |  |  |         __          __     __     __     ______      _______    
-//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
-//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
-//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
-//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
-//
-//  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 D3Q27ETFullDirectConnector.h
-//! \ingroup Connectors
-//! \author Konstantin Kutscher
-//=======================================================================================
-
-#ifndef D3Q27ETFULLDIRECTCONNECTOR_H
-#define D3Q27ETFULLDIRECTCONNECTOR_H
-
-#include "LocalBlock3DConnector.h"
-#include "Block3D.h"
-#include "D3Q27System.h"
-#include "basics/container/CbArray3D.h"
-#include "basics/container/CbArray4D.h"
-#include "EsoTwist3D.h"
-
-//! \brief   Exchange data between blocks. 
-//! \details Connector send and receive full distributions between two blocks in shared memory.
-class D3Q27ETFullDirectConnector : public LocalBlock3DConnector
-{
-public:
-   D3Q27ETFullDirectConnector(SPtr<Block3D> from, SPtr<Block3D> to, int sendDir);
-   void init();
-   void sendVectors();
-
-protected:
-   inline void exchangeData(int x1From, int x2From, int x3From, int x1To, int x2To, int x3To);
-private:
-   int maxX1;
-   int maxX2;
-   int maxX3;
-
-   CbArray4D <LBMReal, IndexerX4X3X2X1>::CbArray4DPtr localDistributionsFrom;
-   CbArray4D <LBMReal, IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributionsFrom;
-   CbArray3D <LBMReal, IndexerX3X2X1>::CbArray3DPtr   zeroDistributionsFrom;
-
-   CbArray4D <LBMReal, IndexerX4X3X2X1>::CbArray4DPtr localDistributionsTo;
-   CbArray4D <LBMReal, IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributionsTo;
-   CbArray3D <LBMReal, IndexerX3X2X1>::CbArray3DPtr   zeroDistributionsTo;
-
-   SPtr<EsoTwist3D>  fFrom;
-   SPtr<EsoTwist3D>  fTo;
-};
-
-
-//////////////////////////////////////////////////////////////////////////
-inline void D3Q27ETFullDirectConnector::exchangeData(int x1From, int x2From, int x3From, int x1To, int x2To, int x3To)
-{
-   (*this->localDistributionsTo)(D3Q27System::ET_E, x1To, x2To, x3To) = (*this->localDistributionsFrom)(D3Q27System::ET_E, x1From, x2From, x3From);
-   (*this->localDistributionsTo)(D3Q27System::ET_N, x1To, x2To, x3To) = (*this->localDistributionsFrom)(D3Q27System::ET_N, x1From, x2From, x3From);
-   (*this->localDistributionsTo)(D3Q27System::ET_T, x1To, x2To, x3To) = (*this->localDistributionsFrom)(D3Q27System::ET_T, x1From, x2From, x3From);
-   (*this->localDistributionsTo)(D3Q27System::ET_NE, x1To, x2To, x3To) = (*this->localDistributionsFrom)(D3Q27System::ET_NE, x1From, x2From, x3From);
-   (*this->localDistributionsTo)(D3Q27System::ET_NW, x1To + 1, x2To, x3To) = (*this->localDistributionsFrom)(D3Q27System::ET_NW, x1From + 1, x2From, x3From);
-   (*this->localDistributionsTo)(D3Q27System::ET_TE, x1To, x2To, x3To) = (*this->localDistributionsFrom)(D3Q27System::ET_TE, x1From, x2From, x3From);
-   (*this->localDistributionsTo)(D3Q27System::ET_TW, x1To + 1, x2To, x3To) = (*this->localDistributionsFrom)(D3Q27System::ET_TW, x1From + 1, x2From, x3From);
-   (*this->localDistributionsTo)(D3Q27System::ET_TN, x1To, x2To, x3To) = (*this->localDistributionsFrom)(D3Q27System::ET_TN, x1From, x2From, x3From);
-   (*this->localDistributionsTo)(D3Q27System::ET_TS, x1To, x2To + 1, x3To) = (*this->localDistributionsFrom)(D3Q27System::ET_TS, x1From, x2From + 1, x3From);
-   (*this->localDistributionsTo)(D3Q27System::ET_TNE, x1To, x2To, x3To) = (*this->localDistributionsFrom)(D3Q27System::ET_TNE, x1From, x2From, x3From);
-   (*this->localDistributionsTo)(D3Q27System::ET_TNW, x1To + 1, x2To, x3To) = (*this->localDistributionsFrom)(D3Q27System::ET_TNW, x1From + 1, x2From, x3From);
-   (*this->localDistributionsTo)(D3Q27System::ET_TSE, x1To, x2To + 1, x3To) = (*this->localDistributionsFrom)(D3Q27System::ET_TSE, x1From, x2From + 1, x3From);
-   (*this->localDistributionsTo)(D3Q27System::ET_TSW, x1To + 1, x2To + 1, x3To) = (*this->localDistributionsFrom)(D3Q27System::ET_TSW, x1From + 1, x2From + 1, x3From);
-
-   (*this->nonLocalDistributionsTo)(D3Q27System::ET_W, x1To + 1, x2To, x3To) = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_W, x1From + 1, x2From, x3From);
-   (*this->nonLocalDistributionsTo)(D3Q27System::ET_S, x1To, x2To + 1, x3To) = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_S, x1From, x2From + 1, x3From);
-   (*this->nonLocalDistributionsTo)(D3Q27System::ET_B, x1To, x2To, x3To + 1) = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_B, x1From, x2From, x3From + 1);
-   (*this->nonLocalDistributionsTo)(D3Q27System::ET_SW, x1To + 1, x2To + 1, x3To) = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_SW, x1From + 1, x2From + 1, x3From);
-   (*this->nonLocalDistributionsTo)(D3Q27System::ET_SE, x1To, x2To + 1, x3To) = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_SE, x1From, x2From + 1, x3From);
-   (*this->nonLocalDistributionsTo)(D3Q27System::ET_BW, x1To + 1, x2To, x3To + 1) = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_BW, x1From + 1, x2From, x3From + 1);
-   (*this->nonLocalDistributionsTo)(D3Q27System::ET_BE, x1To, x2To, x3To + 1) = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_BE, x1From, x2From, x3From + 1);
-   (*this->nonLocalDistributionsTo)(D3Q27System::ET_BS, x1To, x2To + 1, x3To + 1) = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_BS, x1From, x2From + 1, x3From + 1);
-   (*this->nonLocalDistributionsTo)(D3Q27System::ET_BN, x1To, x2To, x3To + 1) = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_BN, x1From, x2From, x3From + 1);
-   (*this->nonLocalDistributionsTo)(D3Q27System::ET_BSW, x1To + 1, x2To + 1, x3To + 1) = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_BSW, x1From + 1, x2From + 1, x3From + 1);
-   (*this->nonLocalDistributionsTo)(D3Q27System::ET_BSE, x1To, x2To + 1, x3To + 1) = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_BSE, x1From, x2From + 1, x3From + 1);
-   (*this->nonLocalDistributionsTo)(D3Q27System::ET_BNW, x1To + 1, x2To, x3To + 1) = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_BNW, x1From + 1, x2From, x3From + 1);
-   (*this->nonLocalDistributionsTo)(D3Q27System::ET_BNE, x1To, x2To, x3To + 1) = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_BNE, x1From, x2From, x3From + 1);
-
-   (*this->zeroDistributionsTo)(x1To, x2To, x3To) = (*this->zeroDistributionsFrom)(x1From, x2From, x3From);
-}
-#endif 
-
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 D3Q27ETFullDirectConnector.h
+//! \ingroup Connectors
+//! \author Konstantin Kutscher
+//=======================================================================================
+
+#ifndef D3Q27ETFULLDIRECTCONNECTOR_H
+#define D3Q27ETFULLDIRECTCONNECTOR_H
+
+#include "LocalBlock3DConnector.h"
+#include "Block3D.h"
+#include "D3Q27System.h"
+#include "basics/container/CbArray3D.h"
+#include "basics/container/CbArray4D.h"
+#include "EsoTwist3D.h"
+
+//! \brief   Exchange data between blocks. 
+//! \details Connector send and receive full distributions between two blocks in shared memory.
+class D3Q27ETFullDirectConnector : public LocalBlock3DConnector
+{
+public:
+   D3Q27ETFullDirectConnector(SPtr<Block3D> from, SPtr<Block3D> to, int sendDir);
+   void init();
+   void sendVectors();
+
+protected:
+   inline void exchangeData(int x1From, int x2From, int x3From, int x1To, int x2To, int x3To);
+private:
+   int maxX1;
+   int maxX2;
+   int maxX3;
+
+   CbArray4D <LBMReal, IndexerX4X3X2X1>::CbArray4DPtr localDistributionsFrom;
+   CbArray4D <LBMReal, IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributionsFrom;
+   CbArray3D <LBMReal, IndexerX3X2X1>::CbArray3DPtr   zeroDistributionsFrom;
+
+   CbArray4D <LBMReal, IndexerX4X3X2X1>::CbArray4DPtr localDistributionsTo;
+   CbArray4D <LBMReal, IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributionsTo;
+   CbArray3D <LBMReal, IndexerX3X2X1>::CbArray3DPtr   zeroDistributionsTo;
+
+   SPtr<EsoTwist3D>  fFrom;
+   SPtr<EsoTwist3D>  fTo;
+};
+
+
+//////////////////////////////////////////////////////////////////////////
+inline void D3Q27ETFullDirectConnector::exchangeData(int x1From, int x2From, int x3From, int x1To, int x2To, int x3To)
+{
+   (*this->localDistributionsTo)(D3Q27System::ET_E, x1To, x2To, x3To) = (*this->localDistributionsFrom)(D3Q27System::ET_E, x1From, x2From, x3From);
+   (*this->localDistributionsTo)(D3Q27System::ET_N, x1To, x2To, x3To) = (*this->localDistributionsFrom)(D3Q27System::ET_N, x1From, x2From, x3From);
+   (*this->localDistributionsTo)(D3Q27System::ET_T, x1To, x2To, x3To) = (*this->localDistributionsFrom)(D3Q27System::ET_T, x1From, x2From, x3From);
+   (*this->localDistributionsTo)(D3Q27System::ET_NE, x1To, x2To, x3To) = (*this->localDistributionsFrom)(D3Q27System::ET_NE, x1From, x2From, x3From);
+   (*this->localDistributionsTo)(D3Q27System::ET_NW, x1To + 1, x2To, x3To) = (*this->localDistributionsFrom)(D3Q27System::ET_NW, x1From + 1, x2From, x3From);
+   (*this->localDistributionsTo)(D3Q27System::ET_TE, x1To, x2To, x3To) = (*this->localDistributionsFrom)(D3Q27System::ET_TE, x1From, x2From, x3From);
+   (*this->localDistributionsTo)(D3Q27System::ET_TW, x1To + 1, x2To, x3To) = (*this->localDistributionsFrom)(D3Q27System::ET_TW, x1From + 1, x2From, x3From);
+   (*this->localDistributionsTo)(D3Q27System::ET_TN, x1To, x2To, x3To) = (*this->localDistributionsFrom)(D3Q27System::ET_TN, x1From, x2From, x3From);
+   (*this->localDistributionsTo)(D3Q27System::ET_TS, x1To, x2To + 1, x3To) = (*this->localDistributionsFrom)(D3Q27System::ET_TS, x1From, x2From + 1, x3From);
+   (*this->localDistributionsTo)(D3Q27System::ET_TNE, x1To, x2To, x3To) = (*this->localDistributionsFrom)(D3Q27System::ET_TNE, x1From, x2From, x3From);
+   (*this->localDistributionsTo)(D3Q27System::ET_TNW, x1To + 1, x2To, x3To) = (*this->localDistributionsFrom)(D3Q27System::ET_TNW, x1From + 1, x2From, x3From);
+   (*this->localDistributionsTo)(D3Q27System::ET_TSE, x1To, x2To + 1, x3To) = (*this->localDistributionsFrom)(D3Q27System::ET_TSE, x1From, x2From + 1, x3From);
+   (*this->localDistributionsTo)(D3Q27System::ET_TSW, x1To + 1, x2To + 1, x3To) = (*this->localDistributionsFrom)(D3Q27System::ET_TSW, x1From + 1, x2From + 1, x3From);
+
+   (*this->nonLocalDistributionsTo)(D3Q27System::ET_W, x1To + 1, x2To, x3To) = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_W, x1From + 1, x2From, x3From);
+   (*this->nonLocalDistributionsTo)(D3Q27System::ET_S, x1To, x2To + 1, x3To) = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_S, x1From, x2From + 1, x3From);
+   (*this->nonLocalDistributionsTo)(D3Q27System::ET_B, x1To, x2To, x3To + 1) = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_B, x1From, x2From, x3From + 1);
+   (*this->nonLocalDistributionsTo)(D3Q27System::ET_SW, x1To + 1, x2To + 1, x3To) = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_SW, x1From + 1, x2From + 1, x3From);
+   (*this->nonLocalDistributionsTo)(D3Q27System::ET_SE, x1To, x2To + 1, x3To) = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_SE, x1From, x2From + 1, x3From);
+   (*this->nonLocalDistributionsTo)(D3Q27System::ET_BW, x1To + 1, x2To, x3To + 1) = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_BW, x1From + 1, x2From, x3From + 1);
+   (*this->nonLocalDistributionsTo)(D3Q27System::ET_BE, x1To, x2To, x3To + 1) = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_BE, x1From, x2From, x3From + 1);
+   (*this->nonLocalDistributionsTo)(D3Q27System::ET_BS, x1To, x2To + 1, x3To + 1) = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_BS, x1From, x2From + 1, x3From + 1);
+   (*this->nonLocalDistributionsTo)(D3Q27System::ET_BN, x1To, x2To, x3To + 1) = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_BN, x1From, x2From, x3From + 1);
+   (*this->nonLocalDistributionsTo)(D3Q27System::ET_BSW, x1To + 1, x2To + 1, x3To + 1) = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_BSW, x1From + 1, x2From + 1, x3From + 1);
+   (*this->nonLocalDistributionsTo)(D3Q27System::ET_BSE, x1To, x2To + 1, x3To + 1) = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_BSE, x1From, x2From + 1, x3From + 1);
+   (*this->nonLocalDistributionsTo)(D3Q27System::ET_BNW, x1To + 1, x2To, x3To + 1) = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_BNW, x1From + 1, x2From, x3From + 1);
+   (*this->nonLocalDistributionsTo)(D3Q27System::ET_BNE, x1To, x2To, x3To + 1) = (*this->nonLocalDistributionsFrom)(D3Q27System::ET_BNE, x1From, x2From, x3From + 1);
+
+   (*this->zeroDistributionsTo)(x1To, x2To, x3To) = (*this->zeroDistributionsFrom)(x1From, x2From, x3From);
+}
+#endif 
+
diff --git a/src/cpu/VirtualFluidsCore/Connectors/D3Q27ETFullVectorConnector.cpp b/src/cpu/VirtualFluidsCore/Connectors/D3Q27ETFullVectorConnector.cpp
index 13594fd55fc2ff072e023be0f1f39a15145b5fdd..e85d1409875df221849375faa9a9ce087c05bf95 100644
--- a/src/cpu/VirtualFluidsCore/Connectors/D3Q27ETFullVectorConnector.cpp
+++ b/src/cpu/VirtualFluidsCore/Connectors/D3Q27ETFullVectorConnector.cpp
@@ -1,468 +1,468 @@
-#include "D3Q27ETFullVectorConnector.h"
-#include "D3Q27EsoTwist3DSplittedVector.h"
-#include "LBMKernel.h"
-#include "DataSet3D.h"
-//////////////////////////////////////////////////////////////////////////
-D3Q27ETFullVectorConnector::D3Q27ETFullVectorConnector(SPtr<Block3D> block
-   , VectorTransmitterPtr sender
-   , VectorTransmitterPtr receiver
-   , int sendDir)
-   : RemoteBlock3DConnector(block, sender, receiver, sendDir)
-{
-   if (!block || !sender || !receiver)
-      UB_THROW(UbException(UB_EXARGS, "sender or receiver == NULL!!"));
-
-}
-//////////////////////////////////////////////////////////////////////////
-void D3Q27ETFullVectorConnector::init()
-{
-   maxX1 = (int)block.lock()->getKernel()->getDataSet()->getFdistributions()->getNX1() - 1;
-   maxX2 = (int)block.lock()->getKernel()->getDataSet()->getFdistributions()->getNX2() - 1;
-   maxX3 = (int)block.lock()->getKernel()->getDataSet()->getFdistributions()->getNX3() - 1;
-
-   fDis = dynamicPointerCast<EsoTwist3D>(block.lock()->getKernel()->getDataSet()->getFdistributions());
-
-   int anz = 27;
-   switch (sendDir)
-   {
-   case D3Q27System::ZERO: UB_THROW(UbException(UB_EXARGS, "ZERO not allowed")); break;
-   case D3Q27System::E:
-   case D3Q27System::W: sender->getData().resize(maxX2*maxX3*anz, 0.0);   break;
-   case D3Q27System::N:
-   case D3Q27System::S: sender->getData().resize(maxX1*maxX3*anz, 0.0);   break;
-   case D3Q27System::T:
-   case D3Q27System::B: sender->getData().resize(maxX1*maxX2*anz, 0.0);   break;
-
-   case D3Q27System::NE:
-   case D3Q27System::SW:
-   case D3Q27System::SE:
-   case D3Q27System::NW:  sender->getData().resize(maxX3*anz, 0.0);   break;
-
-   case D3Q27System::TE:
-   case D3Q27System::BW:
-   case D3Q27System::BE:
-   case D3Q27System::TW:  sender->getData().resize(maxX2*anz, 0.0);   break;
-
-   case D3Q27System::TN:
-   case D3Q27System::BS:
-   case D3Q27System::BN:
-   case D3Q27System::TS:  sender->getData().resize(maxX1*anz, 0.0);   break;
-
-   case D3Q27System::TNE:
-   case D3Q27System::BSW:
-   case D3Q27System::BNE:
-   case D3Q27System::TSW:
-   case D3Q27System::TSE:
-   case D3Q27System::BNW:
-   case D3Q27System::BSE:
-   case D3Q27System::TNW:  sender->getData().resize(anz, 0.0);   break;
-
-   default: UB_THROW(UbException(UB_EXARGS, "unknown sendDir"));
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-void D3Q27ETFullVectorConnector::fillSendVectors()
-{
-   localDistributions = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(this->fDis)->getLocalDistributions();
-   nonLocalDistributions = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(this->fDis)->getNonLocalDistributions();
-   zeroDistributions = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(this->fDis)->getZeroDistributions();
-
-   vector_type& sdata = sender->getData();
-
-   int index = 0;
-   //EAST
-   if (sendDir == D3Q27System::E)
-   {
-      for (int x3 = 1; x3 < maxX3; x3++)
-      {
-         for (int x2 = 1; x2 < maxX2; x2++)
-         {
-            fillData(sdata, index, maxX1 - 1, x2, x3);
-         }
-      }
-   }
-   //WEST
-   else if (sendDir == D3Q27System::W)
-   {
-      for (int x3 = 1; x3 < maxX3; x3++)
-      {
-         for (int x2 = 1; x2 < maxX2; x2++)
-         {
-            fillData(sdata, index, 1, x2, x3);
-         }
-      }
-   }
-   //NORTH
-   else if (sendDir == D3Q27System::N)
-   {
-      for (int x3 = 1; x3 < maxX3; x3++)
-      {
-         for (int x1 = 1; x1 < maxX1; x1++)
-         {
-            fillData(sdata, index, x1, maxX2 - 1, x3);
-         }
-      }
-   }
-   //SOUTH
-   else if (sendDir == D3Q27System::S)
-   {
-      for (int x3 = 1; x3 < maxX3; x3++)
-      {
-         for (int x1 = 1; x1 < maxX1; x1++)
-         {
-            fillData(sdata, index, x1, 1, x3);
-         }
-      }
-   }
-   //TOP
-   else if (sendDir == D3Q27System::T)
-   {
-      for (int x2 = 1; x2 < maxX2; x2++)
-      {
-         for (int x1 = 1; x1 < maxX1; x1++)
-         {
-            fillData(sdata, index, x1, x2, maxX3 - 1);
-         }
-      }
-   }
-   //BOTTOM
-   else if (sendDir == D3Q27System::B)
-   {
-      for (int x2 = 1; x2 < maxX2; x2++)
-      {
-         for (int x1 = 1; x1 < maxX1; x1++)
-         {
-            fillData(sdata, index, x1, x2, 1);
-         }
-      }
-   }
-   //NE NW SW SE
-   else if (sendDir == D3Q27System::NE || sendDir == D3Q27System::NW || sendDir == D3Q27System::SW || sendDir == D3Q27System::SE)
-   {
-      int x1 = 0;
-      int x2 = 0;
-      switch (sendDir)
-      {
-      case D3Q27System::NE:
-         x1 = maxX1 - 1;
-         x2 = maxX2 - 1;
-         break;
-      case D3Q27System::NW:
-         x1 = 1;
-         x2 = maxX2 - 1;
-         break;
-      case D3Q27System::SW:
-         x1 = 1;
-         x2 = 1;
-         break;
-      case D3Q27System::SE:
-         x1 = maxX1 - 1;
-         x2 = 1;
-         break;
-      }
-      for (int x3 = 1; x3 < maxX3; x3++)
-      {
-         fillData(sdata, index, x1, x2, x3);
-      }
-   }
-   //TE TW BW BE
-   else if (sendDir == D3Q27System::TE || sendDir == D3Q27System::TW || sendDir == D3Q27System::BW || sendDir == D3Q27System::BE)
-   {
-      int x1 = 0;
-      int x3 = 0;
-      switch (sendDir)
-      {
-      case D3Q27System::TE:
-         x1 = maxX1 - 1;
-         x3 = maxX3 - 1;
-         break;
-      case D3Q27System::TW:
-         x1 = 1;
-         x3 = maxX3 - 1;
-         break;
-      case D3Q27System::BW:
-         x1 = 1;
-         x3 = 1;
-         break;
-      case D3Q27System::BE:
-         x1 = maxX1 - 1;
-         x3 = 1;
-         break;
-      }
-      for (int x2 = 1; x2 < maxX2; x2++)
-      {
-         fillData(sdata, index, x1, x2, x3);
-      }
-   }
-   //TN BN BS TS
-   else if (sendDir == D3Q27System::TN || sendDir == D3Q27System::BN || sendDir == D3Q27System::BS || sendDir == D3Q27System::TS)
-   {
-      int x2 = 0;
-      int x3 = 0;
-      switch (sendDir)
-      {
-      case D3Q27System::TN:
-         x3 = maxX3 - 1;
-         x2 = maxX2 - 1;
-         break;
-      case D3Q27System::BN:
-         x3 = 1;
-         x2 = maxX2 - 1;
-         break;
-      case D3Q27System::BS:
-         x3 = 1;
-         x2 = 1;
-         break;
-      case D3Q27System::TS:
-         x3 = maxX3 - 1;
-         x2 = 1;
-         break;
-      }
-      for (int x1 = 1; x1 < maxX1; x1++)
-      {
-         fillData(sdata, index, x1, x2, x3);
-      }
-   }
-   //TNE TNW TSW TSE BNE BNW BSW BSE
-   else if (sendDir == D3Q27System::TNE || sendDir == D3Q27System::TNW || sendDir == D3Q27System::TSW || sendDir == D3Q27System::TSE
-      || sendDir == D3Q27System::BNE || sendDir == D3Q27System::BNW || sendDir == D3Q27System::BSW || sendDir == D3Q27System::BSE)
-   {
-      int x1 = 0;
-      int x2 = 0;
-      int x3 = 0;
-      switch (sendDir)
-      {
-      case D3Q27System::TNE:   x1 = maxX1 - 1; x2 = maxX2 - 1; x3 = maxX3 - 1; break;
-      case D3Q27System::TNW:   x1 = 1;       x2 = maxX2 - 1; x3 = maxX3 - 1; break;
-      case D3Q27System::TSW:   x1 = 1;       x2 = 1;       x3 = maxX3 - 1; break;
-      case D3Q27System::TSE:   x1 = maxX1 - 1; x2 = 1;       x3 = maxX3 - 1; break;
-      case D3Q27System::BNE:   x1 = maxX1 - 1; x2 = maxX2 - 1; x3 = 1;       break;
-      case D3Q27System::BNW:   x1 = 1;       x2 = maxX2 - 1; x3 = 1;       break;
-      case D3Q27System::BSW:   x1 = 1;       x2 = 1;       x3 = 1;       break;
-      case D3Q27System::BSE:   x1 = maxX1 - 1; x2 = 1;       x3 = 1;       break;
-      }
-      fillData(sdata, index, x1, x2, x3);
-   }
-   else UB_THROW(UbException(UB_EXARGS, "unknown dir"));
-}
-////////////////////////////////////////////////////////////////////////
-void D3Q27ETFullVectorConnector::distributeReceiveVectors()
-{
-   /*e.g. connector sendet nach EAST --> empfaengt daten aus WEST ;-)*/
-
-   localDistributions = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(this->fDis)->getLocalDistributions();
-   nonLocalDistributions = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(this->fDis)->getNonLocalDistributions();
-   zeroDistributions = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(this->fDis)->getZeroDistributions();
-
-   vector_type& rdata = receiver->getData();
-
-   int index = 0;
-
-   if (sendDir == D3Q27System::W)
-   {
-      for (int x3 = 1; x3 < maxX3; x3++)
-      {
-         for (int x2 = 1; x2 < maxX2; x2++)
-         {
-            distributeData(rdata, index, 0, x2, x3);
-         }
-      }
-   }
-   else if (sendDir == D3Q27System::E)
-   {
-      for (int x3 = 1; x3 < maxX3; x3++)
-      {
-         for (int x2 = 1; x2 < maxX2; x2++)
-         {
-            distributeData(rdata, index, maxX1, x2, x3);
-         }
-      }
-   }
-   else if (sendDir == D3Q27System::S)
-   {
-      for (int x3 = 1; x3 < maxX3; x3++)
-      {
-         for (int x1 = 1; x1 < maxX1; x1++)
-         {
-            distributeData(rdata, index, x1, 0, x3);
-         }
-      }
-   }
-   else if (sendDir == D3Q27System::N)
-   {
-      for (int x3 = 1; x3 < maxX3; x3++)
-      {
-         for (int x1 = 1; x1 < maxX1; x1++)
-         {
-            distributeData(rdata, index, x1, maxX2, x3);
-         }
-      }
-   }
-   else if (sendDir == D3Q27System::B)
-   {
-      for (int x2 = 1; x2 < maxX2; x2++)
-      {
-         for (int x1 = 1; x1 < maxX1; x1++)
-         {
-            distributeData(rdata, index, x1, x2, 0);
-         }
-      }
-   }
-   else if (sendDir == D3Q27System::T)
-   {
-      for (int x2 = 1; x2 < maxX2; x2++)
-      {
-         for (int x1 = 1; x1 < maxX1; x1++)
-         {
-            distributeData(rdata, index, x1, x2, maxX3);
-         }
-      }
-   }
-   //NE NW SW SE
-   else if (sendDir == D3Q27System::NE || sendDir == D3Q27System::NW || sendDir == D3Q27System::SW || sendDir == D3Q27System::SE)
-   {
-      int x1 = 0;
-      int x2 = 0;
-      switch (sendDir)  //wenn sendir NE dann kommen werte von SW
-      {
-      case D3Q27System::NE:
-         x1 = maxX1;
-         x2 = maxX2;
-         break;
-      case D3Q27System::NW:
-         x1 = 0;
-         x2 = maxX2;
-         break;
-      case D3Q27System::SW:
-         x1 = 0;
-         x2 = 0;
-         break;
-      case D3Q27System::SE:
-         x1 = maxX1;
-         x2 = 0;
-         break;
-      }
-      for (int x3 = 1; x3 < maxX3; x3++)
-      {
-         distributeData(rdata, index, x1, x2, x3);
-      }
-
-   }
-   //TE TW BW BE
-   else if (sendDir == D3Q27System::TE || sendDir == D3Q27System::TW || sendDir == D3Q27System::BW || sendDir == D3Q27System::BE)
-
-   {
-      int x1 = 0;
-      int x3 = 0;
-      switch (sendDir)  //wenn sendir NE dann kommen werte von SW
-      {
-      case D3Q27System::TE:
-         x1 = maxX1;
-         x3 = maxX3;
-         break;
-      case D3Q27System::TW:
-         x1 = 0;
-         x3 = maxX3;
-         break;
-      case D3Q27System::BW:
-         x1 = 0;
-         x3 = 0;
-         break;
-      case D3Q27System::BE:
-         x1 = maxX1;
-         x3 = 0;
-         break;
-      }
-      for (int x2 = 1; x2 < maxX2; x2++)
-      {
-         distributeData(rdata, index, x1, x2, x3);
-      }
-   }
-   //TN BN BS TS
-   else if (sendDir == D3Q27System::TN || sendDir == D3Q27System::BN || sendDir == D3Q27System::BS || sendDir == D3Q27System::TS)
-   {
-      int x2 = 0;
-      int x3 = 0;
-      switch (sendDir)
-      {
-      case D3Q27System::TN:
-         x3 = maxX3;
-         x2 = maxX2;
-         break;
-      case D3Q27System::BN:
-         x3 = 0;
-         x2 = maxX2;
-         break;
-      case D3Q27System::BS:
-         x3 = 0;
-         x2 = 0;
-         break;
-      case D3Q27System::TS:
-         x3 = maxX3;
-         x2 = 0;
-         break;
-
-      }
-      for (int x1 = 1; x1 < maxX1; x1++)
-      {
-         distributeData(rdata, index, x1, x2, x3);
-      }
-   }
-   //TNE TNW TSW TSE BNE BNW BSW BSE
-   else if (sendDir == D3Q27System::TNE || sendDir == D3Q27System::TNW || sendDir == D3Q27System::TSW || sendDir == D3Q27System::TSE
-      || sendDir == D3Q27System::BNE || sendDir == D3Q27System::BNW || sendDir == D3Q27System::BSW || sendDir == D3Q27System::BSE)
-   {
-      int x1 = 0;
-      int x2 = 0;
-      int x3 = 0;
-
-      switch (sendDir)
-      {
-      case D3Q27System::TNE:
-         x1 = maxX1;
-         x2 = maxX2;
-         x3 = maxX3;
-         break;
-      case D3Q27System::TNW:
-         x1 = 0;
-         x2 = maxX2;
-         x3 = maxX3;
-         break;
-      case D3Q27System::TSW:
-         x1 = 0;
-         x2 = 0;
-         x3 = maxX3;
-         break;
-      case D3Q27System::TSE:
-         x1 = maxX1;
-         x2 = 0;
-         x3 = maxX3;
-         break;
-      case D3Q27System::BNE:
-         x1 = maxX1;
-         x2 = maxX2;
-         x3 = 0;
-         break;
-      case D3Q27System::BNW:
-         x1 = 0;
-         x2 = maxX2;
-         x3 = 0;
-         break;
-      case D3Q27System::BSW:
-         x1 = 0;
-         x2 = 0;
-         x3 = 0;
-         break;
-      case D3Q27System::BSE:
-         x1 = maxX1;
-         x2 = 0;
-         x3 = 0;
-         break;
-      }
-      distributeData(rdata, index, x1, x2, x3);
-   }
-   else UB_THROW(UbException(UB_EXARGS, "unknown dir"));
-}
-//////////////////////////////////////////////////////////////////////////
-
-
+#include "D3Q27ETFullVectorConnector.h"
+#include "D3Q27EsoTwist3DSplittedVector.h"
+#include "LBMKernel.h"
+#include "DataSet3D.h"
+//////////////////////////////////////////////////////////////////////////
+D3Q27ETFullVectorConnector::D3Q27ETFullVectorConnector(SPtr<Block3D> block
+   , VectorTransmitterPtr sender
+   , VectorTransmitterPtr receiver
+   , int sendDir)
+   : RemoteBlock3DConnector(block, sender, receiver, sendDir)
+{
+   if (!block || !sender || !receiver)
+      UB_THROW(UbException(UB_EXARGS, "sender or receiver == NULL!!"));
+
+}
+//////////////////////////////////////////////////////////////////////////
+void D3Q27ETFullVectorConnector::init()
+{
+   maxX1 = (int)block.lock()->getKernel()->getDataSet()->getFdistributions()->getNX1() - 1;
+   maxX2 = (int)block.lock()->getKernel()->getDataSet()->getFdistributions()->getNX2() - 1;
+   maxX3 = (int)block.lock()->getKernel()->getDataSet()->getFdistributions()->getNX3() - 1;
+
+   fDis = dynamicPointerCast<EsoTwist3D>(block.lock()->getKernel()->getDataSet()->getFdistributions());
+
+   int anz = 27;
+   switch (sendDir)
+   {
+   case D3Q27System::ZERO: UB_THROW(UbException(UB_EXARGS, "ZERO not allowed")); break;
+   case D3Q27System::E:
+   case D3Q27System::W: sender->getData().resize(maxX2*maxX3*anz, 0.0);   break;
+   case D3Q27System::N:
+   case D3Q27System::S: sender->getData().resize(maxX1*maxX3*anz, 0.0);   break;
+   case D3Q27System::T:
+   case D3Q27System::B: sender->getData().resize(maxX1*maxX2*anz, 0.0);   break;
+
+   case D3Q27System::NE:
+   case D3Q27System::SW:
+   case D3Q27System::SE:
+   case D3Q27System::NW:  sender->getData().resize(maxX3*anz, 0.0);   break;
+
+   case D3Q27System::TE:
+   case D3Q27System::BW:
+   case D3Q27System::BE:
+   case D3Q27System::TW:  sender->getData().resize(maxX2*anz, 0.0);   break;
+
+   case D3Q27System::TN:
+   case D3Q27System::BS:
+   case D3Q27System::BN:
+   case D3Q27System::TS:  sender->getData().resize(maxX1*anz, 0.0);   break;
+
+   case D3Q27System::TNE:
+   case D3Q27System::BSW:
+   case D3Q27System::BNE:
+   case D3Q27System::TSW:
+   case D3Q27System::TSE:
+   case D3Q27System::BNW:
+   case D3Q27System::BSE:
+   case D3Q27System::TNW:  sender->getData().resize(anz, 0.0);   break;
+
+   default: UB_THROW(UbException(UB_EXARGS, "unknown sendDir"));
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+void D3Q27ETFullVectorConnector::fillSendVectors()
+{
+   localDistributions = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(this->fDis)->getLocalDistributions();
+   nonLocalDistributions = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(this->fDis)->getNonLocalDistributions();
+   zeroDistributions = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(this->fDis)->getZeroDistributions();
+
+   vector_type& sdata = sender->getData();
+
+   int index = 0;
+   //EAST
+   if (sendDir == D3Q27System::E)
+   {
+      for (int x3 = 1; x3 < maxX3; x3++)
+      {
+         for (int x2 = 1; x2 < maxX2; x2++)
+         {
+            fillData(sdata, index, maxX1 - 1, x2, x3);
+         }
+      }
+   }
+   //WEST
+   else if (sendDir == D3Q27System::W)
+   {
+      for (int x3 = 1; x3 < maxX3; x3++)
+      {
+         for (int x2 = 1; x2 < maxX2; x2++)
+         {
+            fillData(sdata, index, 1, x2, x3);
+         }
+      }
+   }
+   //NORTH
+   else if (sendDir == D3Q27System::N)
+   {
+      for (int x3 = 1; x3 < maxX3; x3++)
+      {
+         for (int x1 = 1; x1 < maxX1; x1++)
+         {
+            fillData(sdata, index, x1, maxX2 - 1, x3);
+         }
+      }
+   }
+   //SOUTH
+   else if (sendDir == D3Q27System::S)
+   {
+      for (int x3 = 1; x3 < maxX3; x3++)
+      {
+         for (int x1 = 1; x1 < maxX1; x1++)
+         {
+            fillData(sdata, index, x1, 1, x3);
+         }
+      }
+   }
+   //TOP
+   else if (sendDir == D3Q27System::T)
+   {
+      for (int x2 = 1; x2 < maxX2; x2++)
+      {
+         for (int x1 = 1; x1 < maxX1; x1++)
+         {
+            fillData(sdata, index, x1, x2, maxX3 - 1);
+         }
+      }
+   }
+   //BOTTOM
+   else if (sendDir == D3Q27System::B)
+   {
+      for (int x2 = 1; x2 < maxX2; x2++)
+      {
+         for (int x1 = 1; x1 < maxX1; x1++)
+         {
+            fillData(sdata, index, x1, x2, 1);
+         }
+      }
+   }
+   //NE NW SW SE
+   else if (sendDir == D3Q27System::NE || sendDir == D3Q27System::NW || sendDir == D3Q27System::SW || sendDir == D3Q27System::SE)
+   {
+      int x1 = 0;
+      int x2 = 0;
+      switch (sendDir)
+      {
+      case D3Q27System::NE:
+         x1 = maxX1 - 1;
+         x2 = maxX2 - 1;
+         break;
+      case D3Q27System::NW:
+         x1 = 1;
+         x2 = maxX2 - 1;
+         break;
+      case D3Q27System::SW:
+         x1 = 1;
+         x2 = 1;
+         break;
+      case D3Q27System::SE:
+         x1 = maxX1 - 1;
+         x2 = 1;
+         break;
+      }
+      for (int x3 = 1; x3 < maxX3; x3++)
+      {
+         fillData(sdata, index, x1, x2, x3);
+      }
+   }
+   //TE TW BW BE
+   else if (sendDir == D3Q27System::TE || sendDir == D3Q27System::TW || sendDir == D3Q27System::BW || sendDir == D3Q27System::BE)
+   {
+      int x1 = 0;
+      int x3 = 0;
+      switch (sendDir)
+      {
+      case D3Q27System::TE:
+         x1 = maxX1 - 1;
+         x3 = maxX3 - 1;
+         break;
+      case D3Q27System::TW:
+         x1 = 1;
+         x3 = maxX3 - 1;
+         break;
+      case D3Q27System::BW:
+         x1 = 1;
+         x3 = 1;
+         break;
+      case D3Q27System::BE:
+         x1 = maxX1 - 1;
+         x3 = 1;
+         break;
+      }
+      for (int x2 = 1; x2 < maxX2; x2++)
+      {
+         fillData(sdata, index, x1, x2, x3);
+      }
+   }
+   //TN BN BS TS
+   else if (sendDir == D3Q27System::TN || sendDir == D3Q27System::BN || sendDir == D3Q27System::BS || sendDir == D3Q27System::TS)
+   {
+      int x2 = 0;
+      int x3 = 0;
+      switch (sendDir)
+      {
+      case D3Q27System::TN:
+         x3 = maxX3 - 1;
+         x2 = maxX2 - 1;
+         break;
+      case D3Q27System::BN:
+         x3 = 1;
+         x2 = maxX2 - 1;
+         break;
+      case D3Q27System::BS:
+         x3 = 1;
+         x2 = 1;
+         break;
+      case D3Q27System::TS:
+         x3 = maxX3 - 1;
+         x2 = 1;
+         break;
+      }
+      for (int x1 = 1; x1 < maxX1; x1++)
+      {
+         fillData(sdata, index, x1, x2, x3);
+      }
+   }
+   //TNE TNW TSW TSE BNE BNW BSW BSE
+   else if (sendDir == D3Q27System::TNE || sendDir == D3Q27System::TNW || sendDir == D3Q27System::TSW || sendDir == D3Q27System::TSE
+      || sendDir == D3Q27System::BNE || sendDir == D3Q27System::BNW || sendDir == D3Q27System::BSW || sendDir == D3Q27System::BSE)
+   {
+      int x1 = 0;
+      int x2 = 0;
+      int x3 = 0;
+      switch (sendDir)
+      {
+      case D3Q27System::TNE:   x1 = maxX1 - 1; x2 = maxX2 - 1; x3 = maxX3 - 1; break;
+      case D3Q27System::TNW:   x1 = 1;       x2 = maxX2 - 1; x3 = maxX3 - 1; break;
+      case D3Q27System::TSW:   x1 = 1;       x2 = 1;       x3 = maxX3 - 1; break;
+      case D3Q27System::TSE:   x1 = maxX1 - 1; x2 = 1;       x3 = maxX3 - 1; break;
+      case D3Q27System::BNE:   x1 = maxX1 - 1; x2 = maxX2 - 1; x3 = 1;       break;
+      case D3Q27System::BNW:   x1 = 1;       x2 = maxX2 - 1; x3 = 1;       break;
+      case D3Q27System::BSW:   x1 = 1;       x2 = 1;       x3 = 1;       break;
+      case D3Q27System::BSE:   x1 = maxX1 - 1; x2 = 1;       x3 = 1;       break;
+      }
+      fillData(sdata, index, x1, x2, x3);
+   }
+   else UB_THROW(UbException(UB_EXARGS, "unknown dir"));
+}
+////////////////////////////////////////////////////////////////////////
+void D3Q27ETFullVectorConnector::distributeReceiveVectors()
+{
+   /*e.g. connector sendet nach EAST --> empfaengt daten aus WEST ;-)*/
+
+   localDistributions = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(this->fDis)->getLocalDistributions();
+   nonLocalDistributions = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(this->fDis)->getNonLocalDistributions();
+   zeroDistributions = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(this->fDis)->getZeroDistributions();
+
+   vector_type& rdata = receiver->getData();
+
+   int index = 0;
+
+   if (sendDir == D3Q27System::W)
+   {
+      for (int x3 = 1; x3 < maxX3; x3++)
+      {
+         for (int x2 = 1; x2 < maxX2; x2++)
+         {
+            distributeData(rdata, index, 0, x2, x3);
+         }
+      }
+   }
+   else if (sendDir == D3Q27System::E)
+   {
+      for (int x3 = 1; x3 < maxX3; x3++)
+      {
+         for (int x2 = 1; x2 < maxX2; x2++)
+         {
+            distributeData(rdata, index, maxX1, x2, x3);
+         }
+      }
+   }
+   else if (sendDir == D3Q27System::S)
+   {
+      for (int x3 = 1; x3 < maxX3; x3++)
+      {
+         for (int x1 = 1; x1 < maxX1; x1++)
+         {
+            distributeData(rdata, index, x1, 0, x3);
+         }
+      }
+   }
+   else if (sendDir == D3Q27System::N)
+   {
+      for (int x3 = 1; x3 < maxX3; x3++)
+      {
+         for (int x1 = 1; x1 < maxX1; x1++)
+         {
+            distributeData(rdata, index, x1, maxX2, x3);
+         }
+      }
+   }
+   else if (sendDir == D3Q27System::B)
+   {
+      for (int x2 = 1; x2 < maxX2; x2++)
+      {
+         for (int x1 = 1; x1 < maxX1; x1++)
+         {
+            distributeData(rdata, index, x1, x2, 0);
+         }
+      }
+   }
+   else if (sendDir == D3Q27System::T)
+   {
+      for (int x2 = 1; x2 < maxX2; x2++)
+      {
+         for (int x1 = 1; x1 < maxX1; x1++)
+         {
+            distributeData(rdata, index, x1, x2, maxX3);
+         }
+      }
+   }
+   //NE NW SW SE
+   else if (sendDir == D3Q27System::NE || sendDir == D3Q27System::NW || sendDir == D3Q27System::SW || sendDir == D3Q27System::SE)
+   {
+      int x1 = 0;
+      int x2 = 0;
+      switch (sendDir)  //wenn sendir NE dann kommen werte von SW
+      {
+      case D3Q27System::NE:
+         x1 = maxX1;
+         x2 = maxX2;
+         break;
+      case D3Q27System::NW:
+         x1 = 0;
+         x2 = maxX2;
+         break;
+      case D3Q27System::SW:
+         x1 = 0;
+         x2 = 0;
+         break;
+      case D3Q27System::SE:
+         x1 = maxX1;
+         x2 = 0;
+         break;
+      }
+      for (int x3 = 1; x3 < maxX3; x3++)
+      {
+         distributeData(rdata, index, x1, x2, x3);
+      }
+
+   }
+   //TE TW BW BE
+   else if (sendDir == D3Q27System::TE || sendDir == D3Q27System::TW || sendDir == D3Q27System::BW || sendDir == D3Q27System::BE)
+
+   {
+      int x1 = 0;
+      int x3 = 0;
+      switch (sendDir)  //wenn sendir NE dann kommen werte von SW
+      {
+      case D3Q27System::TE:
+         x1 = maxX1;
+         x3 = maxX3;
+         break;
+      case D3Q27System::TW:
+         x1 = 0;
+         x3 = maxX3;
+         break;
+      case D3Q27System::BW:
+         x1 = 0;
+         x3 = 0;
+         break;
+      case D3Q27System::BE:
+         x1 = maxX1;
+         x3 = 0;
+         break;
+      }
+      for (int x2 = 1; x2 < maxX2; x2++)
+      {
+         distributeData(rdata, index, x1, x2, x3);
+      }
+   }
+   //TN BN BS TS
+   else if (sendDir == D3Q27System::TN || sendDir == D3Q27System::BN || sendDir == D3Q27System::BS || sendDir == D3Q27System::TS)
+   {
+      int x2 = 0;
+      int x3 = 0;
+      switch (sendDir)
+      {
+      case D3Q27System::TN:
+         x3 = maxX3;
+         x2 = maxX2;
+         break;
+      case D3Q27System::BN:
+         x3 = 0;
+         x2 = maxX2;
+         break;
+      case D3Q27System::BS:
+         x3 = 0;
+         x2 = 0;
+         break;
+      case D3Q27System::TS:
+         x3 = maxX3;
+         x2 = 0;
+         break;
+
+      }
+      for (int x1 = 1; x1 < maxX1; x1++)
+      {
+         distributeData(rdata, index, x1, x2, x3);
+      }
+   }
+   //TNE TNW TSW TSE BNE BNW BSW BSE
+   else if (sendDir == D3Q27System::TNE || sendDir == D3Q27System::TNW || sendDir == D3Q27System::TSW || sendDir == D3Q27System::TSE
+      || sendDir == D3Q27System::BNE || sendDir == D3Q27System::BNW || sendDir == D3Q27System::BSW || sendDir == D3Q27System::BSE)
+   {
+      int x1 = 0;
+      int x2 = 0;
+      int x3 = 0;
+
+      switch (sendDir)
+      {
+      case D3Q27System::TNE:
+         x1 = maxX1;
+         x2 = maxX2;
+         x3 = maxX3;
+         break;
+      case D3Q27System::TNW:
+         x1 = 0;
+         x2 = maxX2;
+         x3 = maxX3;
+         break;
+      case D3Q27System::TSW:
+         x1 = 0;
+         x2 = 0;
+         x3 = maxX3;
+         break;
+      case D3Q27System::TSE:
+         x1 = maxX1;
+         x2 = 0;
+         x3 = maxX3;
+         break;
+      case D3Q27System::BNE:
+         x1 = maxX1;
+         x2 = maxX2;
+         x3 = 0;
+         break;
+      case D3Q27System::BNW:
+         x1 = 0;
+         x2 = maxX2;
+         x3 = 0;
+         break;
+      case D3Q27System::BSW:
+         x1 = 0;
+         x2 = 0;
+         x3 = 0;
+         break;
+      case D3Q27System::BSE:
+         x1 = maxX1;
+         x2 = 0;
+         x3 = 0;
+         break;
+      }
+      distributeData(rdata, index, x1, x2, x3);
+   }
+   else UB_THROW(UbException(UB_EXARGS, "unknown dir"));
+}
+//////////////////////////////////////////////////////////////////////////
+
+
diff --git a/src/cpu/VirtualFluidsCore/Connectors/D3Q27ETFullVectorConnector.h b/src/cpu/VirtualFluidsCore/Connectors/D3Q27ETFullVectorConnector.h
index b0ecb0ee66d95e1f9e2f7cd7492b7295829b607c..149e53d6242aef86a27d9f4478bfa2499b069a50 100644
--- a/src/cpu/VirtualFluidsCore/Connectors/D3Q27ETFullVectorConnector.h
+++ b/src/cpu/VirtualFluidsCore/Connectors/D3Q27ETFullVectorConnector.h
@@ -1,118 +1,118 @@
-#ifndef D3Q27ETFULLVECTORCONNECTOR_H
-#define D3Q27ETFULLVECTORCONNECTOR_H
-
-#include <vector>
-
-#include "RemoteBlock3DConnector.h"
-#include "D3Q27System.h"
-#include "Block3D.h"
-#include "LBMKernel.h"
-#include "EsoTwistD3Q27System.h"
-#include "basics/container/CbArray3D.h"
-#include "basics/container/CbArray4D.h"
-#include "EsoTwist3D.h"
-
-
-//daten werden in einen vector (dieser befindet sich im transmitter) kopiert
-//der vector wird via transmitter uebertragen
-//transmitter kann ein lokal, MPI, RCG, CTL oder was auch immer fuer ein
-//transmitter sein, der von Transmitter abgeleitet ist ;-)
-class D3Q27ETFullVectorConnector : public RemoteBlock3DConnector
-{
-public:
-   D3Q27ETFullVectorConnector(SPtr<Block3D> block
-      , VectorTransmitterPtr sender
-      , VectorTransmitterPtr receiver
-      , int sendDir);
-
-   void init();
-
-   void fillSendVectors();
-   void distributeReceiveVectors();
-
-protected:
-   inline void fillData(vector_type& sdata, int& index, int x1, int x2, int x3);
-   inline void distributeData(vector_type& rdata, int& index, int x1, int x2, int x3);
-private:
-   int maxX1;
-   int maxX2;
-   int maxX3;
-
-   CbArray4D <LBMReal, IndexerX4X3X2X1>::CbArray4DPtr localDistributions;
-   CbArray4D <LBMReal, IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributions;
-   CbArray3D <LBMReal, IndexerX3X2X1>::CbArray3DPtr   zeroDistributions;
-
-   SPtr<EsoTwist3D>  fDis;
-
-};
-
-//////////////////////////////////////////////////////////////////////////
-inline void D3Q27ETFullVectorConnector::fillData(vector_type& sdata, int& index, int x1, int x2, int x3)
-{
-   sdata[index++] = (*this->localDistributions)(D3Q27System::ET_E, x1, x2, x3);
-   sdata[index++] = (*this->localDistributions)(D3Q27System::ET_N, x1, x2, x3);
-   sdata[index++] = (*this->localDistributions)(D3Q27System::ET_T, x1, x2, x3);
-   sdata[index++] = (*this->localDistributions)(D3Q27System::ET_NE, x1, x2, x3);
-   sdata[index++] = (*this->localDistributions)(D3Q27System::ET_NW, x1 + 1, x2, x3);
-   sdata[index++] = (*this->localDistributions)(D3Q27System::ET_TE, x1, x2, x3);
-   sdata[index++] = (*this->localDistributions)(D3Q27System::ET_TW, x1 + 1, x2, x3);
-   sdata[index++] = (*this->localDistributions)(D3Q27System::ET_TN, x1, x2, x3);
-   sdata[index++] = (*this->localDistributions)(D3Q27System::ET_TS, x1, x2 + 1, x3);
-   sdata[index++] = (*this->localDistributions)(D3Q27System::ET_TNE, x1, x2, x3);
-   sdata[index++] = (*this->localDistributions)(D3Q27System::ET_TNW, x1 + 1, x2, x3);
-   sdata[index++] = (*this->localDistributions)(D3Q27System::ET_TSE, x1, x2 + 1, x3);
-   sdata[index++] = (*this->localDistributions)(D3Q27System::ET_TSW, x1 + 1, x2 + 1, x3);
-
-   sdata[index++] = (*this->nonLocalDistributions)(D3Q27System::ET_W, x1 + 1, x2, x3);
-   sdata[index++] = (*this->nonLocalDistributions)(D3Q27System::ET_S, x1, x2 + 1, x3);
-   sdata[index++] = (*this->nonLocalDistributions)(D3Q27System::ET_B, x1, x2, x3 + 1);
-   sdata[index++] = (*this->nonLocalDistributions)(D3Q27System::ET_SW, x1 + 1, x2 + 1, x3);
-   sdata[index++] = (*this->nonLocalDistributions)(D3Q27System::ET_SE, x1, x2 + 1, x3);
-   sdata[index++] = (*this->nonLocalDistributions)(D3Q27System::ET_BW, x1 + 1, x2, x3 + 1);
-   sdata[index++] = (*this->nonLocalDistributions)(D3Q27System::ET_BE, x1, x2, x3 + 1);
-   sdata[index++] = (*this->nonLocalDistributions)(D3Q27System::ET_BS, x1, x2 + 1, x3 + 1);
-   sdata[index++] = (*this->nonLocalDistributions)(D3Q27System::ET_BN, x1, x2, x3 + 1);
-   sdata[index++] = (*this->nonLocalDistributions)(D3Q27System::ET_BSW, x1 + 1, x2 + 1, x3 + 1);
-   sdata[index++] = (*this->nonLocalDistributions)(D3Q27System::ET_BSE, x1, x2 + 1, x3 + 1);
-   sdata[index++] = (*this->nonLocalDistributions)(D3Q27System::ET_BNW, x1 + 1, x2, x3 + 1);
-   sdata[index++] = (*this->nonLocalDistributions)(D3Q27System::ET_BNE, x1, x2, x3 + 1);
-
-   sdata[index++] = (*this->zeroDistributions)(x1, x2, x3);
-}
-//////////////////////////////////////////////////////////////////////////
-inline void D3Q27ETFullVectorConnector::distributeData(vector_type& rdata, int& index, int x1, int x2, int x3)
-{
-   (*this->localDistributions)(D3Q27System::ET_E, x1, x2, x3) = rdata[index++];
-   (*this->localDistributions)(D3Q27System::ET_N, x1, x2, x3) = rdata[index++];
-   (*this->localDistributions)(D3Q27System::ET_T, x1, x2, x3) = rdata[index++];
-   (*this->localDistributions)(D3Q27System::ET_NE, x1, x2, x3) = rdata[index++];
-   (*this->localDistributions)(D3Q27System::ET_NW, x1 + 1, x2, x3) = rdata[index++];
-   (*this->localDistributions)(D3Q27System::ET_TE, x1, x2, x3) = rdata[index++];
-   (*this->localDistributions)(D3Q27System::ET_TW, x1 + 1, x2, x3) = rdata[index++];
-   (*this->localDistributions)(D3Q27System::ET_TN, x1, x2, x3) = rdata[index++];
-   (*this->localDistributions)(D3Q27System::ET_TS, x1, x2 + 1, x3) = rdata[index++];
-   (*this->localDistributions)(D3Q27System::ET_TNE, x1, x2, x3) = rdata[index++];
-   (*this->localDistributions)(D3Q27System::ET_TNW, x1 + 1, x2, x3) = rdata[index++];
-   (*this->localDistributions)(D3Q27System::ET_TSE, x1, x2 + 1, x3) = rdata[index++];
-   (*this->localDistributions)(D3Q27System::ET_TSW, x1 + 1, x2 + 1, x3) = rdata[index++];
-
-   (*this->nonLocalDistributions)(D3Q27System::ET_W, x1 + 1, x2, x3) = rdata[index++];
-   (*this->nonLocalDistributions)(D3Q27System::ET_S, x1, x2 + 1, x3) = rdata[index++];
-   (*this->nonLocalDistributions)(D3Q27System::ET_B, x1, x2, x3 + 1) = rdata[index++];
-   (*this->nonLocalDistributions)(D3Q27System::ET_SW, x1 + 1, x2 + 1, x3) = rdata[index++];
-   (*this->nonLocalDistributions)(D3Q27System::ET_SE, x1, x2 + 1, x3) = rdata[index++];
-   (*this->nonLocalDistributions)(D3Q27System::ET_BW, x1 + 1, x2, x3 + 1) = rdata[index++];
-   (*this->nonLocalDistributions)(D3Q27System::ET_BE, x1, x2, x3 + 1) = rdata[index++];
-   (*this->nonLocalDistributions)(D3Q27System::ET_BS, x1, x2 + 1, x3 + 1) = rdata[index++];
-   (*this->nonLocalDistributions)(D3Q27System::ET_BN, x1, x2, x3 + 1) = rdata[index++];
-   (*this->nonLocalDistributions)(D3Q27System::ET_BSW, x1 + 1, x2 + 1, x3 + 1) = rdata[index++];
-   (*this->nonLocalDistributions)(D3Q27System::ET_BSE, x1, x2 + 1, x3 + 1) = rdata[index++];
-   (*this->nonLocalDistributions)(D3Q27System::ET_BNW, x1 + 1, x2, x3 + 1) = rdata[index++];
-   (*this->nonLocalDistributions)(D3Q27System::ET_BNE, x1, x2, x3 + 1) = rdata[index++];
-
-   (*this->zeroDistributions)(x1, x2, x3) = rdata[index++];
-}
-
-
-#endif //D3Q27VECTORCONNECTOR_H
-
+#ifndef D3Q27ETFULLVECTORCONNECTOR_H
+#define D3Q27ETFULLVECTORCONNECTOR_H
+
+#include <vector>
+
+#include "RemoteBlock3DConnector.h"
+#include "D3Q27System.h"
+#include "Block3D.h"
+#include "LBMKernel.h"
+#include "EsoTwistD3Q27System.h"
+#include "basics/container/CbArray3D.h"
+#include "basics/container/CbArray4D.h"
+#include "EsoTwist3D.h"
+
+
+//daten werden in einen vector (dieser befindet sich im transmitter) kopiert
+//der vector wird via transmitter uebertragen
+//transmitter kann ein lokal, MPI, RCG, CTL oder was auch immer fuer ein
+//transmitter sein, der von Transmitter abgeleitet ist ;-)
+class D3Q27ETFullVectorConnector : public RemoteBlock3DConnector
+{
+public:
+   D3Q27ETFullVectorConnector(SPtr<Block3D> block
+      , VectorTransmitterPtr sender
+      , VectorTransmitterPtr receiver
+      , int sendDir);
+
+   void init();
+
+   void fillSendVectors();
+   void distributeReceiveVectors();
+
+protected:
+   inline void fillData(vector_type& sdata, int& index, int x1, int x2, int x3);
+   inline void distributeData(vector_type& rdata, int& index, int x1, int x2, int x3);
+private:
+   int maxX1;
+   int maxX2;
+   int maxX3;
+
+   CbArray4D <LBMReal, IndexerX4X3X2X1>::CbArray4DPtr localDistributions;
+   CbArray4D <LBMReal, IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributions;
+   CbArray3D <LBMReal, IndexerX3X2X1>::CbArray3DPtr   zeroDistributions;
+
+   SPtr<EsoTwist3D>  fDis;
+
+};
+
+//////////////////////////////////////////////////////////////////////////
+inline void D3Q27ETFullVectorConnector::fillData(vector_type& sdata, int& index, int x1, int x2, int x3)
+{
+   sdata[index++] = (*this->localDistributions)(D3Q27System::ET_E, x1, x2, x3);
+   sdata[index++] = (*this->localDistributions)(D3Q27System::ET_N, x1, x2, x3);
+   sdata[index++] = (*this->localDistributions)(D3Q27System::ET_T, x1, x2, x3);
+   sdata[index++] = (*this->localDistributions)(D3Q27System::ET_NE, x1, x2, x3);
+   sdata[index++] = (*this->localDistributions)(D3Q27System::ET_NW, x1 + 1, x2, x3);
+   sdata[index++] = (*this->localDistributions)(D3Q27System::ET_TE, x1, x2, x3);
+   sdata[index++] = (*this->localDistributions)(D3Q27System::ET_TW, x1 + 1, x2, x3);
+   sdata[index++] = (*this->localDistributions)(D3Q27System::ET_TN, x1, x2, x3);
+   sdata[index++] = (*this->localDistributions)(D3Q27System::ET_TS, x1, x2 + 1, x3);
+   sdata[index++] = (*this->localDistributions)(D3Q27System::ET_TNE, x1, x2, x3);
+   sdata[index++] = (*this->localDistributions)(D3Q27System::ET_TNW, x1 + 1, x2, x3);
+   sdata[index++] = (*this->localDistributions)(D3Q27System::ET_TSE, x1, x2 + 1, x3);
+   sdata[index++] = (*this->localDistributions)(D3Q27System::ET_TSW, x1 + 1, x2 + 1, x3);
+
+   sdata[index++] = (*this->nonLocalDistributions)(D3Q27System::ET_W, x1 + 1, x2, x3);
+   sdata[index++] = (*this->nonLocalDistributions)(D3Q27System::ET_S, x1, x2 + 1, x3);
+   sdata[index++] = (*this->nonLocalDistributions)(D3Q27System::ET_B, x1, x2, x3 + 1);
+   sdata[index++] = (*this->nonLocalDistributions)(D3Q27System::ET_SW, x1 + 1, x2 + 1, x3);
+   sdata[index++] = (*this->nonLocalDistributions)(D3Q27System::ET_SE, x1, x2 + 1, x3);
+   sdata[index++] = (*this->nonLocalDistributions)(D3Q27System::ET_BW, x1 + 1, x2, x3 + 1);
+   sdata[index++] = (*this->nonLocalDistributions)(D3Q27System::ET_BE, x1, x2, x3 + 1);
+   sdata[index++] = (*this->nonLocalDistributions)(D3Q27System::ET_BS, x1, x2 + 1, x3 + 1);
+   sdata[index++] = (*this->nonLocalDistributions)(D3Q27System::ET_BN, x1, x2, x3 + 1);
+   sdata[index++] = (*this->nonLocalDistributions)(D3Q27System::ET_BSW, x1 + 1, x2 + 1, x3 + 1);
+   sdata[index++] = (*this->nonLocalDistributions)(D3Q27System::ET_BSE, x1, x2 + 1, x3 + 1);
+   sdata[index++] = (*this->nonLocalDistributions)(D3Q27System::ET_BNW, x1 + 1, x2, x3 + 1);
+   sdata[index++] = (*this->nonLocalDistributions)(D3Q27System::ET_BNE, x1, x2, x3 + 1);
+
+   sdata[index++] = (*this->zeroDistributions)(x1, x2, x3);
+}
+//////////////////////////////////////////////////////////////////////////
+inline void D3Q27ETFullVectorConnector::distributeData(vector_type& rdata, int& index, int x1, int x2, int x3)
+{
+   (*this->localDistributions)(D3Q27System::ET_E, x1, x2, x3) = rdata[index++];
+   (*this->localDistributions)(D3Q27System::ET_N, x1, x2, x3) = rdata[index++];
+   (*this->localDistributions)(D3Q27System::ET_T, x1, x2, x3) = rdata[index++];
+   (*this->localDistributions)(D3Q27System::ET_NE, x1, x2, x3) = rdata[index++];
+   (*this->localDistributions)(D3Q27System::ET_NW, x1 + 1, x2, x3) = rdata[index++];
+   (*this->localDistributions)(D3Q27System::ET_TE, x1, x2, x3) = rdata[index++];
+   (*this->localDistributions)(D3Q27System::ET_TW, x1 + 1, x2, x3) = rdata[index++];
+   (*this->localDistributions)(D3Q27System::ET_TN, x1, x2, x3) = rdata[index++];
+   (*this->localDistributions)(D3Q27System::ET_TS, x1, x2 + 1, x3) = rdata[index++];
+   (*this->localDistributions)(D3Q27System::ET_TNE, x1, x2, x3) = rdata[index++];
+   (*this->localDistributions)(D3Q27System::ET_TNW, x1 + 1, x2, x3) = rdata[index++];
+   (*this->localDistributions)(D3Q27System::ET_TSE, x1, x2 + 1, x3) = rdata[index++];
+   (*this->localDistributions)(D3Q27System::ET_TSW, x1 + 1, x2 + 1, x3) = rdata[index++];
+
+   (*this->nonLocalDistributions)(D3Q27System::ET_W, x1 + 1, x2, x3) = rdata[index++];
+   (*this->nonLocalDistributions)(D3Q27System::ET_S, x1, x2 + 1, x3) = rdata[index++];
+   (*this->nonLocalDistributions)(D3Q27System::ET_B, x1, x2, x3 + 1) = rdata[index++];
+   (*this->nonLocalDistributions)(D3Q27System::ET_SW, x1 + 1, x2 + 1, x3) = rdata[index++];
+   (*this->nonLocalDistributions)(D3Q27System::ET_SE, x1, x2 + 1, x3) = rdata[index++];
+   (*this->nonLocalDistributions)(D3Q27System::ET_BW, x1 + 1, x2, x3 + 1) = rdata[index++];
+   (*this->nonLocalDistributions)(D3Q27System::ET_BE, x1, x2, x3 + 1) = rdata[index++];
+   (*this->nonLocalDistributions)(D3Q27System::ET_BS, x1, x2 + 1, x3 + 1) = rdata[index++];
+   (*this->nonLocalDistributions)(D3Q27System::ET_BN, x1, x2, x3 + 1) = rdata[index++];
+   (*this->nonLocalDistributions)(D3Q27System::ET_BSW, x1 + 1, x2 + 1, x3 + 1) = rdata[index++];
+   (*this->nonLocalDistributions)(D3Q27System::ET_BSE, x1, x2 + 1, x3 + 1) = rdata[index++];
+   (*this->nonLocalDistributions)(D3Q27System::ET_BNW, x1 + 1, x2, x3 + 1) = rdata[index++];
+   (*this->nonLocalDistributions)(D3Q27System::ET_BNE, x1, x2, x3 + 1) = rdata[index++];
+
+   (*this->zeroDistributions)(x1, x2, x3) = rdata[index++];
+}
+
+
+#endif //D3Q27VECTORCONNECTOR_H
+
diff --git a/src/cpu/VirtualFluidsCore/Connectors/D3Q27ETOffConnectorFactory.cpp b/src/cpu/VirtualFluidsCore/Connectors/D3Q27ETOffConnectorFactory.cpp
index afdcb3bdfa310817c762140e1063dc69cbfc3d9c..4d01e21e5c6c88cd43b3fd7d6a3a66cc1dbb08c7 100644
--- a/src/cpu/VirtualFluidsCore/Connectors/D3Q27ETOffConnectorFactory.cpp
+++ b/src/cpu/VirtualFluidsCore/Connectors/D3Q27ETOffConnectorFactory.cpp
@@ -1,38 +1,38 @@
-//#include "D3Q27ETOffConnectorFactory.h"
-//#include "TransmitterType.h"
-//#include "D3Q27ETCFOffVectorConnector.h"
-//#include "D3Q27ETFCOffVectorConnector.h"
-//#include "D3Q27ETFCVectorConnector.h"
-//#include "FineToCoarseBlock3DConnector.h"
-//
-//D3Q27ETOffConnectorFactory::D3Q27ETOffConnectorFactory()
-//{
-//}
-////////////////////////////////////////////////////////////////////////////
-//D3Q27ETOffConnectorFactory::~D3Q27ETOffConnectorFactory()
-//{
-//}
-////////////////////////////////////////////////////////////////////////////
-//SPtr<Block3DConnector> D3Q27ETOffConnectorFactory::createCoarseToFineConnector(SPtr<Block3D> block,
-//   VectorTransmitterPtr sender00, VectorTransmitterPtr receiver00,
-//   VectorTransmitterPtr sender01, VectorTransmitterPtr receiver01,
-//   VectorTransmitterPtr sender10, VectorTransmitterPtr receiver10,
-//   VectorTransmitterPtr sender11, VectorTransmitterPtr receiver11,
-//   int sendDir, D3Q27InterpolationProcessorPtr iprocessor)
-//{
-//   return SPtr<Block3DConnector>(new D3Q27ETCFOffVectorConnector<VectorTransmitter>(block,
-//      sender00, receiver00, sender01, receiver01,
-//      sender10, receiver10, sender11, receiver11,
-//      sendDir, iprocessor));
-//}
-////////////////////////////////////////////////////////////////////////////
-//SPtr<Block3DConnector> D3Q27ETOffConnectorFactory::createFineToCoarseConnector(SPtr<Block3D> block,
-//   VectorTransmitterPtr sender,
-//   VectorTransmitterPtr receiver,
-//   int sendDir,
-//   D3Q27InterpolationProcessorPtr iprocessor,
-//   FineToCoarseBlock3DConnector::CFconnectorType connType)
-//{
-//   return  SPtr<Block3DConnector>(new D3Q27ETFCOffVectorConnector<VectorTransmitter>(block,
-//      sender, receiver, sendDir, iprocessor, connType));
-//}
+//#include "D3Q27ETOffConnectorFactory.h"
+//#include "TransmitterType.h"
+//#include "D3Q27ETCFOffVectorConnector.h"
+//#include "D3Q27ETFCOffVectorConnector.h"
+//#include "D3Q27ETFCVectorConnector.h"
+//#include "FineToCoarseBlock3DConnector.h"
+//
+//D3Q27ETOffConnectorFactory::D3Q27ETOffConnectorFactory()
+//{
+//}
+////////////////////////////////////////////////////////////////////////////
+//D3Q27ETOffConnectorFactory::~D3Q27ETOffConnectorFactory()
+//{
+//}
+////////////////////////////////////////////////////////////////////////////
+//SPtr<Block3DConnector> D3Q27ETOffConnectorFactory::createCoarseToFineConnector(SPtr<Block3D> block,
+//   VectorTransmitterPtr sender00, VectorTransmitterPtr receiver00,
+//   VectorTransmitterPtr sender01, VectorTransmitterPtr receiver01,
+//   VectorTransmitterPtr sender10, VectorTransmitterPtr receiver10,
+//   VectorTransmitterPtr sender11, VectorTransmitterPtr receiver11,
+//   int sendDir, D3Q27InterpolationProcessorPtr iprocessor)
+//{
+//   return SPtr<Block3DConnector>(new D3Q27ETCFOffVectorConnector<VectorTransmitter>(block,
+//      sender00, receiver00, sender01, receiver01,
+//      sender10, receiver10, sender11, receiver11,
+//      sendDir, iprocessor));
+//}
+////////////////////////////////////////////////////////////////////////////
+//SPtr<Block3DConnector> D3Q27ETOffConnectorFactory::createFineToCoarseConnector(SPtr<Block3D> block,
+//   VectorTransmitterPtr sender,
+//   VectorTransmitterPtr receiver,
+//   int sendDir,
+//   D3Q27InterpolationProcessorPtr iprocessor,
+//   FineToCoarseBlock3DConnector::CFconnectorType connType)
+//{
+//   return  SPtr<Block3DConnector>(new D3Q27ETFCOffVectorConnector<VectorTransmitter>(block,
+//      sender, receiver, sendDir, iprocessor, connType));
+//}
diff --git a/src/cpu/VirtualFluidsCore/Connectors/D3Q27ETOffConnectorFactory.h b/src/cpu/VirtualFluidsCore/Connectors/D3Q27ETOffConnectorFactory.h
index 1db2868f4f8203873364c4e4cf1d09371511f638..4879a1930c1e4e66be9668eb2ccd938493beb05e 100644
--- a/src/cpu/VirtualFluidsCore/Connectors/D3Q27ETOffConnectorFactory.h
+++ b/src/cpu/VirtualFluidsCore/Connectors/D3Q27ETOffConnectorFactory.h
@@ -1,34 +1,34 @@
-//#ifndef D3Q27ETOffConnectorFactory_h__
-//#define D3Q27ETOffConnectorFactory_h__
-//
-//#include "Block3DConnectorFactory.h"
-//
-//#include <PointerDefinitions.h>
-//class D3Q27ETOffConnectorFactory;
-//typedef SPtr<D3Q27ETOffConnectorFactory> D3Q27ETOffSPtr<ConnectorFactory>;
-//
-//class D3Q27ETOffConnectorFactory : public Block3DConnectorFactory
-//{
-//public:
-//   D3Q27ETOffConnectorFactory();
-//   virtual ~D3Q27ETOffConnectorFactory();
-//
-//   virtual SPtr<Block3DConnector> createCoarseToFineConnector(SPtr<Block3D> block,
-//      VectorTransmitterPtr sender00, VectorTransmitterPtr receiver00,
-//      VectorTransmitterPtr sender01, VectorTransmitterPtr receiver01,
-//      VectorTransmitterPtr sender10, VectorTransmitterPtr receiver10,
-//      VectorTransmitterPtr sender11, VectorTransmitterPtr receiver11,
-//      int sendDir, D3Q27InterpolationProcessorPtr iprocessor);
-//
-//   virtual SPtr<Block3DConnector> createFineToCoarseConnector(SPtr<Block3D> block,
-//      VectorTransmitterPtr sender,
-//      VectorTransmitterPtr receiver,
-//      int sendDir,
-//      D3Q27InterpolationProcessorPtr iprocessor,
-//      FineToCoarseBlock3DConnector::CFconnectorType connType);
-//
-//private:
-//
-//};
-//#endif // D3Q27ETOffConnectorFactory_h__
-
+//#ifndef D3Q27ETOffConnectorFactory_h__
+//#define D3Q27ETOffConnectorFactory_h__
+//
+//#include "Block3DConnectorFactory.h"
+//
+//#include <PointerDefinitions.h>
+//class D3Q27ETOffConnectorFactory;
+//typedef SPtr<D3Q27ETOffConnectorFactory> D3Q27ETOffSPtr<ConnectorFactory>;
+//
+//class D3Q27ETOffConnectorFactory : public Block3DConnectorFactory
+//{
+//public:
+//   D3Q27ETOffConnectorFactory();
+//   virtual ~D3Q27ETOffConnectorFactory();
+//
+//   virtual SPtr<Block3DConnector> createCoarseToFineConnector(SPtr<Block3D> block,
+//      VectorTransmitterPtr sender00, VectorTransmitterPtr receiver00,
+//      VectorTransmitterPtr sender01, VectorTransmitterPtr receiver01,
+//      VectorTransmitterPtr sender10, VectorTransmitterPtr receiver10,
+//      VectorTransmitterPtr sender11, VectorTransmitterPtr receiver11,
+//      int sendDir, D3Q27InterpolationProcessorPtr iprocessor);
+//
+//   virtual SPtr<Block3DConnector> createFineToCoarseConnector(SPtr<Block3D> block,
+//      VectorTransmitterPtr sender,
+//      VectorTransmitterPtr receiver,
+//      int sendDir,
+//      D3Q27InterpolationProcessorPtr iprocessor,
+//      FineToCoarseBlock3DConnector::CFconnectorType connType);
+//
+//private:
+//
+//};
+//#endif // D3Q27ETOffConnectorFactory_h__
+
diff --git a/src/cpu/VirtualFluidsCore/Connectors/FineToCoarseBlock3DConnector.cpp b/src/cpu/VirtualFluidsCore/Connectors/FineToCoarseBlock3DConnector.cpp
index ff8f85aa5e2cf18bbd260aeccb5c1311f85318c8..faaaca492e20f97f75b9faa560753d59ad7a5ae9 100644
--- a/src/cpu/VirtualFluidsCore/Connectors/FineToCoarseBlock3DConnector.cpp
+++ b/src/cpu/VirtualFluidsCore/Connectors/FineToCoarseBlock3DConnector.cpp
@@ -1,77 +1,77 @@
-#include "FineToCoarseBlock3DConnector.h"
-
-////////////////////////////////////////////////////////////////////////////
-FineToCoarseBlock3DConnector::FineToCoarseBlock3DConnector(SPtr<Block3D> block, VectorTransmitterPtr sender,
-   VectorTransmitterPtr receiver, int sendDir,
-   InterpolationProcessorPtr iprocessor,
-   CFconnectorType connType)
-   : Block3DConnector(sendDir)
-   , block(block)
-   , sender(sender)
-   , receiver(receiver)
-   , iprocessor(iprocessor)
-   , connType(connType)
-{
-   if (!(sendDir==D3Q27System::E  || sendDir==D3Q27System::W  || sendDir==D3Q27System::N  || sendDir==D3Q27System::S  || sendDir==D3Q27System::T || sendDir==D3Q27System::B
-      ||  sendDir==D3Q27System::NE || sendDir==D3Q27System::SW || sendDir==D3Q27System::SE || sendDir==D3Q27System::NW
-      ||  sendDir==D3Q27System::TE || sendDir==D3Q27System::BW ||  sendDir==D3Q27System::BE || sendDir==D3Q27System::TW
-      ||  sendDir==D3Q27System::TN || sendDir==D3Q27System::BS ||  sendDir==D3Q27System::BN || sendDir==D3Q27System::TS
-
-      ||  sendDir==D3Q27System::TNE || sendDir==D3Q27System::TNW ||  sendDir==D3Q27System::TSE || sendDir==D3Q27System::TSW
-      ||  sendDir==D3Q27System::BNE || sendDir==D3Q27System::BNW ||  sendDir==D3Q27System::BSE || sendDir==D3Q27System::BSW
-
-      ))
-   {
-      throw UbException(UB_EXARGS, "invalid constructor for this direction");
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-bool FineToCoarseBlock3DConnector::isLocalConnector()
-{
-   return !this->isRemoteConnector();
-}
-//////////////////////////////////////////////////////////////////////////
-bool FineToCoarseBlock3DConnector::isRemoteConnector()
-{
-   return sender->isRemoteTransmitter()  ||  receiver->isRemoteTransmitter();
-}
-//////////////////////////////////////////////////////////////////////////
-void FineToCoarseBlock3DConnector::sendTransmitterDataSize()
-{
-   if (sender)
-   {
-      UBLOG(logDEBUG5, "FineToCoarseBlock3DConnector<VectorTransmitter>::sendTransmitterDataSize()"<<block.lock()->toString()+"sendDir="<<sendDir);
-      sender->sendDataSize();
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-void FineToCoarseBlock3DConnector::receiveTransmitterDataSize()
-{
-   if (receiver)
-   {
-      UBLOG(logDEBUG5, "FineToCoarseBlock3DConnector<VectorTransmitter>::receiveTransmitterDataSize()"<<block.lock()->toString()<<"sendDir="<<sendDir);
-      receiver->receiveDataSize();
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-void FineToCoarseBlock3DConnector::prepareForSend()
-{
-   if (sender) sender->prepareForSend();
-}
-//////////////////////////////////////////////////////////////////////////
-void FineToCoarseBlock3DConnector::sendVectors()
-{
-   if (sender) sender->sendData();
-}
-//////////////////////////////////////////////////////////////////////////
-void FineToCoarseBlock3DConnector::prepareForReceive()
-{
-   if (receiver) receiver->prepareForReceive();
-}
-//////////////////////////////////////////////////////////////////////////
-void FineToCoarseBlock3DConnector::receiveVectors()
-{
-   if (receiver) receiver->receiveData();
-}
-
-
+#include "FineToCoarseBlock3DConnector.h"
+
+////////////////////////////////////////////////////////////////////////////
+FineToCoarseBlock3DConnector::FineToCoarseBlock3DConnector(SPtr<Block3D> block, VectorTransmitterPtr sender,
+   VectorTransmitterPtr receiver, int sendDir,
+   InterpolationProcessorPtr iprocessor,
+   CFconnectorType connType)
+   : Block3DConnector(sendDir)
+   , block(block)
+   , sender(sender)
+   , receiver(receiver)
+   , iprocessor(iprocessor)
+   , connType(connType)
+{
+   if (!(sendDir==D3Q27System::E  || sendDir==D3Q27System::W  || sendDir==D3Q27System::N  || sendDir==D3Q27System::S  || sendDir==D3Q27System::T || sendDir==D3Q27System::B
+      ||  sendDir==D3Q27System::NE || sendDir==D3Q27System::SW || sendDir==D3Q27System::SE || sendDir==D3Q27System::NW
+      ||  sendDir==D3Q27System::TE || sendDir==D3Q27System::BW ||  sendDir==D3Q27System::BE || sendDir==D3Q27System::TW
+      ||  sendDir==D3Q27System::TN || sendDir==D3Q27System::BS ||  sendDir==D3Q27System::BN || sendDir==D3Q27System::TS
+
+      ||  sendDir==D3Q27System::TNE || sendDir==D3Q27System::TNW ||  sendDir==D3Q27System::TSE || sendDir==D3Q27System::TSW
+      ||  sendDir==D3Q27System::BNE || sendDir==D3Q27System::BNW ||  sendDir==D3Q27System::BSE || sendDir==D3Q27System::BSW
+
+      ))
+   {
+      throw UbException(UB_EXARGS, "invalid constructor for this direction");
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+bool FineToCoarseBlock3DConnector::isLocalConnector()
+{
+   return !this->isRemoteConnector();
+}
+//////////////////////////////////////////////////////////////////////////
+bool FineToCoarseBlock3DConnector::isRemoteConnector()
+{
+   return sender->isRemoteTransmitter()  ||  receiver->isRemoteTransmitter();
+}
+//////////////////////////////////////////////////////////////////////////
+void FineToCoarseBlock3DConnector::sendTransmitterDataSize()
+{
+   if (sender)
+   {
+      UBLOG(logDEBUG5, "FineToCoarseBlock3DConnector<VectorTransmitter>::sendTransmitterDataSize()"<<block.lock()->toString()+"sendDir="<<sendDir);
+      sender->sendDataSize();
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+void FineToCoarseBlock3DConnector::receiveTransmitterDataSize()
+{
+   if (receiver)
+   {
+      UBLOG(logDEBUG5, "FineToCoarseBlock3DConnector<VectorTransmitter>::receiveTransmitterDataSize()"<<block.lock()->toString()<<"sendDir="<<sendDir);
+      receiver->receiveDataSize();
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+void FineToCoarseBlock3DConnector::prepareForSend()
+{
+   if (sender) sender->prepareForSend();
+}
+//////////////////////////////////////////////////////////////////////////
+void FineToCoarseBlock3DConnector::sendVectors()
+{
+   if (sender) sender->sendData();
+}
+//////////////////////////////////////////////////////////////////////////
+void FineToCoarseBlock3DConnector::prepareForReceive()
+{
+   if (receiver) receiver->prepareForReceive();
+}
+//////////////////////////////////////////////////////////////////////////
+void FineToCoarseBlock3DConnector::receiveVectors()
+{
+   if (receiver) receiver->receiveData();
+}
+
+
diff --git a/src/cpu/VirtualFluidsCore/Connectors/FineToCoarseBlock3DConnector.h b/src/cpu/VirtualFluidsCore/Connectors/FineToCoarseBlock3DConnector.h
index f90c5340b084cd0a87fc10fbbc88c15bebf96cef..cb1f1e1c935a70fff9c3bc72827c483ab55cc081 100644
--- a/src/cpu/VirtualFluidsCore/Connectors/FineToCoarseBlock3DConnector.h
+++ b/src/cpu/VirtualFluidsCore/Connectors/FineToCoarseBlock3DConnector.h
@@ -1,95 +1,95 @@
-//! \file FineToCoarseBlock3DConnector.h
-//! \brief Base class for connectors that interpolates and sends data from fine level to coarse.  
-//! \author Konstantin Kutscher
-//! \date 21.05.2015
-
-#ifndef FineToCoarseBlock3DConnector_H
-#define FineToCoarseBlock3DConnector_H
-
-#include "TransmitterType.h"
-#include "Block3DConnector.h"
-#include "D3Q27System.h"
-#include "Block3D.h"
-#include "LBMKernel.h"
-#include "InterpolationProcessor.h"
-
-#include <PointerDefinitions.h>
-
-
-class Block3D;
-
-//! \class FineToCoarseBlock3DConnector
-//! \brief Base class for connectors that interpolates and sends data from fine level to coarse.  
-//! \details The data is copied in a vector (this is located in the transmitter). 
-//! The vector is transmitted via transmitter. 
-//! The transmitter can be a local, MPI, RCG, CTL or whatever 
-//! which a transmitter that is derived from transmitter base class.
-//!
-//! four fine blocks inside a coarse block:
-//!
-//! |    |    |
-//! |:--:|:---| 
-//! | 01 | 11 | 
-//! | 00 | 10 | 
-//!
-//! send direction:    
-//!
-//! |E<->W   |  N<->S  |  T<->B |
-//! |--------|---------|--------|
-//! |  x3    |   x3    |    x2  |
-//! |  ^     |   ^     |    ^   |
-//! |  +->x2 |  +->x1  |   +->x1|
-
-class FineToCoarseBlock3DConnector : public Block3DConnector
-{
-public:
-   enum CFconnectorType { Type00, Type10, Type01, Type11 };
-public:
-   FineToCoarseBlock3DConnector(SPtr<Block3D> block, VectorTransmitterPtr sender, VectorTransmitterPtr receiver, int sendDir, InterpolationProcessorPtr iprocessor, CFconnectorType connType);
-
-   bool isLocalConnector();
-   bool isRemoteConnector();
-   
-   void sendTransmitterDataSize();
-   void receiveTransmitterDataSize();
-
-   void prepareForSend();
-   void sendVectors();
-
-   void prepareForReceive();
-   void receiveVectors();
-
-   virtual void init()=0;
-   virtual void fillSendVectors()=0;
-   virtual void distributeReceiveVectors()=0;
-
-   bool isInterpolationConnectorCF() { return false; }
-   bool isInterpolationConnectorFC() { return true; }
-
-   void prepareForSendX1() {}
-   void prepareForSendX2() {}
-   void prepareForSendX3() {}
-
-   void sendVectorsX1() {}
-   void sendVectorsX2() {}
-   void sendVectorsX3() {}
-
-   void prepareForReceiveX1() {}
-   void prepareForReceiveX2() {}
-   void prepareForReceiveX3() {}
-
-   void receiveVectorsX1() {}
-   void receiveVectorsX2() {}
-   void receiveVectorsX3() {}
-
-protected:
-   WPtr<Block3D> block; 
-   VectorTransmitterPtr sender, receiver;
-   InterpolationProcessorPtr iprocessor;
-   CFconnectorType connType;
-};
-
-
-
-#endif 
-
+//! \file FineToCoarseBlock3DConnector.h
+//! \brief Base class for connectors that interpolates and sends data from fine level to coarse.  
+//! \author Konstantin Kutscher
+//! \date 21.05.2015
+
+#ifndef FineToCoarseBlock3DConnector_H
+#define FineToCoarseBlock3DConnector_H
+
+#include "TransmitterType.h"
+#include "Block3DConnector.h"
+#include "D3Q27System.h"
+#include "Block3D.h"
+#include "LBMKernel.h"
+#include "InterpolationProcessor.h"
+
+#include <PointerDefinitions.h>
+
+
+class Block3D;
+
+//! \class FineToCoarseBlock3DConnector
+//! \brief Base class for connectors that interpolates and sends data from fine level to coarse.  
+//! \details The data is copied in a vector (this is located in the transmitter). 
+//! The vector is transmitted via transmitter. 
+//! The transmitter can be a local, MPI, RCG, CTL or whatever 
+//! which a transmitter that is derived from transmitter base class.
+//!
+//! four fine blocks inside a coarse block:
+//!
+//! |    |    |
+//! |:--:|:---| 
+//! | 01 | 11 | 
+//! | 00 | 10 | 
+//!
+//! send direction:    
+//!
+//! |E<->W   |  N<->S  |  T<->B |
+//! |--------|---------|--------|
+//! |  x3    |   x3    |    x2  |
+//! |  ^     |   ^     |    ^   |
+//! |  +->x2 |  +->x1  |   +->x1|
+
+class FineToCoarseBlock3DConnector : public Block3DConnector
+{
+public:
+   enum CFconnectorType { Type00, Type10, Type01, Type11 };
+public:
+   FineToCoarseBlock3DConnector(SPtr<Block3D> block, VectorTransmitterPtr sender, VectorTransmitterPtr receiver, int sendDir, InterpolationProcessorPtr iprocessor, CFconnectorType connType);
+
+   bool isLocalConnector();
+   bool isRemoteConnector();
+   
+   void sendTransmitterDataSize();
+   void receiveTransmitterDataSize();
+
+   void prepareForSend();
+   void sendVectors();
+
+   void prepareForReceive();
+   void receiveVectors();
+
+   virtual void init()=0;
+   virtual void fillSendVectors()=0;
+   virtual void distributeReceiveVectors()=0;
+
+   bool isInterpolationConnectorCF() { return false; }
+   bool isInterpolationConnectorFC() { return true; }
+
+   void prepareForSendX1() {}
+   void prepareForSendX2() {}
+   void prepareForSendX3() {}
+
+   void sendVectorsX1() {}
+   void sendVectorsX2() {}
+   void sendVectorsX3() {}
+
+   void prepareForReceiveX1() {}
+   void prepareForReceiveX2() {}
+   void prepareForReceiveX3() {}
+
+   void receiveVectorsX1() {}
+   void receiveVectorsX2() {}
+   void receiveVectorsX3() {}
+
+protected:
+   WPtr<Block3D> block; 
+   VectorTransmitterPtr sender, receiver;
+   InterpolationProcessorPtr iprocessor;
+   CFconnectorType connType;
+};
+
+
+
+#endif 
+
diff --git a/src/cpu/VirtualFluidsCore/Connectors/FineToCoarseNodeSetBlock3DConnector.cpp b/src/cpu/VirtualFluidsCore/Connectors/FineToCoarseNodeSetBlock3DConnector.cpp
index d589c6e5ce95a2bd8ef40c8c9b789645c32dcb68..31e30fe340d3e792d23435c49a8d88c787ab2bf3 100644
--- a/src/cpu/VirtualFluidsCore/Connectors/FineToCoarseNodeSetBlock3DConnector.cpp
+++ b/src/cpu/VirtualFluidsCore/Connectors/FineToCoarseNodeSetBlock3DConnector.cpp
@@ -1,1235 +1,1235 @@
-#include "FineToCoarseNodeSetBlock3DConnector.h"
-#include "BCProcessor.h"
-#include "DataSet3D.h"
-
-
-//////////////////////////////////////////////////////////////////////////
-FineToCoarseNodeSetBlock3DConnector::FineToCoarseNodeSetBlock3DConnector(SPtr<Block3D> block, VectorTransmitterPtr sender, VectorTransmitterPtr receiver,
-   int sendDir, InterpolationProcessorPtr iprocessor, CFconnectorType connType) : FineToCoarseBlock3DConnector(block, sender, receiver, sendDir, iprocessor, connType)
-{
-
-}
-//////////////////////////////////////////////////////////////////////////
-void FineToCoarseNodeSetBlock3DConnector::init()
-{
-   bMaxX1 = (int)FineToCoarseBlock3DConnector::block.lock()->getKernel()->getDataSet()->getFdistributions()->getNX1();
-   bMaxX2 = (int)FineToCoarseBlock3DConnector::block.lock()->getKernel()->getDataSet()->getFdistributions()->getNX2();
-   bMaxX3 = (int)FineToCoarseBlock3DConnector::block.lock()->getKernel()->getDataSet()->getFdistributions()->getNX3();
-
-   minX1 = 0;
-   minX2 = 0;
-   minX3 = 0;
-   maxX1 = bMaxX1 - 1;
-   maxX2 = bMaxX2 - 1;
-   maxX3 = bMaxX3 - 1;
-
-   minOffX1 = 0;
-   minOffX2 = 0;
-   minOffX3 = 0;
-
-   maxOffX1 = 0;
-   maxOffX2 = 0;
-   maxOffX3 = 0;
-
-   if (Utilities::isEven(bMaxX1))
-   {
-      minOffX1 = 0;
-      maxOffX1 = 0;
-   }
-   else if (Utilities::isOdd(bMaxX1))
-   {
-      minOffX1 = 1;
-      maxOffX1 = -1;
-   }
-
-   if (Utilities::isEven(bMaxX2))
-   {
-      minOffX2 = 0;
-      maxOffX2 = 0;
-   }
-   else if (Utilities::isOdd(bMaxX2))
-   {
-      minOffX2 = 1;
-      maxOffX2 = -1;
-   }
-
-   if (Utilities::isEven(bMaxX3))
-   {
-      minOffX3 = 0;
-      maxOffX3 = 0;
-   }
-   else if (Utilities::isOdd(bMaxX3))
-   {
-      minOffX3 = 1;
-      maxOffX3 = -1;
-   }
-
-   //int       sendSize = 0;
-   LBMReal initValue = -999.0;
-
-   int sendDataPerNode = 27/*f*/;
-   int iCellSize = 1; //size of interpolation cell
-
-   findFCCells();
-   findCFCells();
-
-   //////////////////////////////////////////////////////
-   //Debug
-   //////////////////////////////////////////////////////
-   if (FineToCoarseBlock3DConnector::block.lock()->getGlobalID() == 2183)
-   {
-      int test = 0;
-   }
-
-
-   if (FineToCoarseBlock3DConnector::sender) FineToCoarseBlock3DConnector::sender->getData().resize(iNodeSetSender.size()*iCellSize*sendDataPerNode, initValue);
-   else FineToCoarseBlock3DConnector::sender = VectorTransmitterPtr(new TbLocalTransmitter< CbVector< LBMReal > >());
-
-   if (!FineToCoarseBlock3DConnector::receiver) FineToCoarseBlock3DConnector::receiver = VectorTransmitterPtr(new TbLocalTransmitter< CbVector< LBMReal > >());
-}
-//////////////////////////////////////////////////////////////////////////
-void FineToCoarseNodeSetBlock3DConnector::findFCCells(int lMinX1, int lMinX2, int lMinX3, int lMaxX1, int lMaxX2, int lMaxX3, INodeSet &inodes)
-{
-   //////////////////////////////////////////////////////
-   //Debug
-   //////////////////////////////////////////////////////
-   if (FineToCoarseBlock3DConnector::block.lock()->getGlobalID() == 2183)
-   {
-      int test = 0;
-   }
-
-
-   int ix1, ix2, ix3;
-   LBMReal x1off, x2off, x3off;
-
-   SPtr<DistributionArray3D>  fFrom = FineToCoarseBlock3DConnector::block.lock()->getKernel()->getDataSet()->getFdistributions();
-   SPtr<BCArray3D> bcArray = FineToCoarseBlock3DConnector::block.lock()->getKernel()->getBCProcessor()->getBCArray();
-
-   for (ix3 = lMinX3; ix3<=lMaxX3; ix3 += 2)
-   {
-      for (ix2 = lMinX2; ix2<=lMaxX2; ix2 += 2)
-      {
-         for (ix1 = lMinX1; ix1<=lMaxX1; ix1 += 2)
-         {
-            D3Q27ICell icellC;
-
-            int howManySolids = FineToCoarseBlock3DConnector::iprocessor->iCellHowManySolids(bcArray, ix1, ix2, ix3);
-
-            if (howManySolids == 0 || howManySolids == 8)
-            {
-               x1off = 0.0;
-               x2off = 0.0;
-               x3off = 0.0;
-            }
-            else
-            {
-               if (!iprocessor->findNeighborICell(bcArray, fFrom, icellC, bMaxX1, bMaxX2, bMaxX3, ix1, ix2, ix3, x1off, x2off, x3off))
-               {
-                  std::string err = "For "+FineToCoarseBlock3DConnector::block.lock()->toString()+" x1="+UbSystem::toString(ix1)+", x2=" + UbSystem::toString(ix2)+", x3=" + UbSystem::toString(ix3)+
-                     " interpolation is not implemented for other direction"+
-                     " by using in: "+(std::string)typeid(*this).name()+
-                     " or maybe you have a solid on the block boundary";
-                  UB_THROW(UbException(UB_EXARGS, err));
-               }
-            }
-
-            INodeVector inv;
-            inv.push_back(ix1 + (int)x1off);
-            inv.push_back(ix2 + (int)x2off);
-            inv.push_back(ix3 + (int)x3off);
-            inv.push_back((int)x1off);
-            inv.push_back((int)x2off);
-            inv.push_back((int)x3off);
-            //inodes.insert(inv);
-            inodes.push_back(inv);
-         }
-      }
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-
-void FineToCoarseNodeSetBlock3DConnector::findFCCells()
-{
-   using namespace D3Q27System;
-
-   int lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3;
-   int lMin2X1, lMin2X2, lMin2X3, lMax2X1, lMax2X2, lMax2X3;
-   int lMin3X1, lMin3X2, lMin3X3, lMax3X1, lMax3X2, lMax3X3;
-
-   //lMin1X1 = minX1+1; lMin1X2 = minX2+1; lMin1X3 = minX3+1;
-   //lMax1X1 = maxX1-1; lMax1X2 = maxX2-1; lMax1X3 = maxX3-1;
-   //getLocalMinMax(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3);
-
-   //lMin2X1 = minX1+1; lMin2X2 = minX2+1; lMin2X3 = minX3+1;
-   //lMax2X1 = maxX1-1; lMax2X2 = maxX2-1; lMax2X3 = maxX3-1;
-   //getLocalMinMax(lMin2X1, lMin2X2, lMin2X3, lMax2X1, lMax2X2, lMax2X3);
-
-   //lMin3X1 = minX1+1; lMin3X2 = minX2+1; lMin3X3 = minX3+1;
-   //lMax3X1 = maxX1-1; lMax3X2 = maxX2-1; lMax3X3 = maxX3-1;
-   //getLocalMinMax(lMin3X1, lMin3X2, lMin3X3, lMax3X1, lMax3X2, lMax3X3);
-
-   switch (sendDir)
-   {
-      //faces
-   case E: case W:
-      if (sendDir == E)
-      {
-         lMin1X1 = maxX1 - 6;
-         lMax1X1 = lMin1X1;
-      }
-      else if (sendDir == W)
-      {
-         lMin1X1 = 5;
-         lMax1X1 = lMin1X1;
-      }
-
-      if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type00)
-      {
-         lMin1X2 = minX2;
-         lMax1X2 = maxX2 + maxOffX2 - 1;
-         lMin1X3 = minX3;
-         lMax1X3 = maxX3 + maxOffX3 - 1;
-      }
-      else if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type10)
-      {
-         lMin1X2 = minX2 + minOffX2;
-         lMax1X2 = maxX2 - 1;
-         lMin1X3 = minX3;
-         lMax1X3 = maxX3 + maxOffX3 - 1;
-      }
-      else if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type01)
-      {
-         lMin1X2 = minX2;
-         lMax1X2 = maxX2 + maxOffX2 - 1;
-         lMin1X3 = minX3 + minOffX3;
-         lMax1X3 = maxX3 - 1;
-      }
-      else if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type11)
-      {
-         lMin1X2 = minX2 + minOffX2;
-         lMax1X2 = maxX2 - 1;
-         lMin1X3 = minX3 + minOffX3;
-         lMax1X3 = maxX3 - 1;
-      }
-      findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetSender);
-      break;
-   case N: case S:
-      if (sendDir == N)
-      {
-         lMin1X2 = maxX2 - 6;
-         lMax1X2 = lMin1X2;
-      }
-      else if (sendDir == S)
-      {
-         lMin1X2 = 5;
-         lMax1X2 = lMin1X2;
-      }
-
-      if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type00)
-      {
-         lMin1X1 = minX1;
-         lMax1X1 = maxX1 + maxOffX1 - 1;
-         lMin1X3 = minX3;
-         lMax1X3 = maxX3 + maxOffX3 - 1;
-      }
-      else if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type10)
-      {
-         lMin1X1 = minX1 + minOffX1;
-         lMax1X1 = maxX1 - 1;
-         lMin1X3 = minX3;
-         lMax1X3 = maxX3 + maxOffX3 - 1;
-      }
-      else if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type01)
-      {
-         lMin1X1 = minX1;
-         lMax1X1 = maxX1 + maxOffX1 - 1;
-         lMin1X3 = minX3 + minOffX3;
-         lMax1X3 = maxX3;
-      }
-      else if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type11)
-      {
-         lMin1X1 = minX1 + minOffX1;
-         lMax1X1 = maxX1 - 1;
-         lMin1X3 = minX3 + minOffX3;
-         lMax1X3 = maxX3 - 1;
-      }
-      findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetSender);
-      break;
-   case T: case B:
-      if (sendDir == T)
-      {
-         lMin1X3 = maxX3 - 6;
-         lMax1X3 = lMin1X3;
-      }
-      else if (sendDir == B)
-      {
-         lMin1X3 = 5;
-         lMax1X3 = lMin1X3;
-      }
-
-      if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type00)
-      {
-         lMin1X1 = minX1;
-         lMax1X1 = maxX1 + maxOffX1 - 1;
-         lMin1X2 = minX2;
-         lMax1X2 = maxX2 + maxOffX2 - 1;
-      }
-      else if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type10)
-      {
-         lMin1X1 = minX1 + minOffX1;
-         lMax1X1 = maxX1 - 1;
-         lMin1X2 = minX2;
-         lMax1X2 = maxX2 + maxOffX2 - 1;
-      }
-      else if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type01)
-      {
-         lMin1X1 = minX1;
-         lMax1X1 = maxX1 + maxOffX1 - 1;
-         lMin1X2 = minX2 + minOffX2;
-         lMax1X2 = maxX2 - 1;
-      }
-      else if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type11)
-      {
-         lMin1X1 = minX1 + minOffX1;
-         lMax1X1 = maxX1 - 1;
-         lMin1X2 = minX2 + minOffX2;
-         lMax1X2 = maxX2 - 1;
-      }
-      findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetSender);
-      break;
-      //edges
-      //N-S-E-W
-   case NE: case SW: case SE: case NW:
-      if (sendDir == NE)
-      {
-         lMin1X1 = maxX1 - 6;
-         lMax1X1 = lMin1X1 + 4;
-         lMin1X2 = maxX2 - 6;
-         lMax1X2 = lMin1X2;
-
-         lMin2X1 = maxX1 - 6;
-         lMax2X1 = lMin2X1;
-         lMin2X2 = maxX2 - 6;
-         lMax2X2 = lMin2X2 + 4;
-      }
-      else if (sendDir == SW)
-      {
-         lMin1X1 = 1;
-         lMax1X1 = lMin1X1 + 4;
-         lMin1X2 = 5;
-         lMax1X2 = lMin1X2;
-
-         lMin2X1 = 5;
-         lMax2X1 = lMin2X1;
-         lMin2X2 = 1;
-         lMax2X2 = lMin2X2 + 4;
-      }
-      else if (sendDir == SE)
-      {
-         lMin1X1 = maxX1 - 6;
-         lMax1X1 = lMin1X1 + 4;
-         lMin1X2 = 5;
-         lMax1X2 = lMin1X2;
-
-         lMin2X1 = maxX1 - 6;
-         lMax2X1 = lMin2X1;
-         lMin2X2 = 1;
-         lMax2X2 = lMin2X2 + 4;
-      }
-      else if (sendDir == NW)
-      {
-         lMin1X1 = 1;
-         lMax1X1 = lMin1X1 + 4;
-         lMin1X2 = maxX2 - 6;
-         lMax1X2 = lMin1X2;
-
-         lMin2X1 = 5;
-         lMax2X1 = lMin2X1;
-         lMin2X2 = maxX2 - 6;
-         lMax2X2 = lMin2X2 + 4;
-      }
-
-      if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type00)
-      {
-         lMin1X3 = minX3;
-         lMax1X3 = maxX3 + maxOffX3 - 1;
-      }
-      else if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type10)
-      {
-         lMin1X3 = minX3 + minOffX3;
-         lMax1X3 = maxX3 - 1;
-      }
-
-      findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetSender);
-      findFCCells(lMin2X1, lMin2X2, lMin1X3, lMax2X1, lMax2X2, lMax1X3, iNodeSetSender);
-
-      break;
-      //T-B-E-W
-   case TE: case BW: case BE: case TW:
-      if (sendDir == TE)
-      {
-         lMin1X1 = maxX1 - 6;
-         lMax1X1 = lMin1X1 + 4;
-         lMin1X3 = maxX3 - 6;
-         lMax1X3 = lMin1X3;
-
-         lMin2X1 = maxX1 - 6;
-         lMax2X1 = lMin2X1;
-         lMin2X3 = maxX3 - 6;
-         lMax2X3 = lMin2X3 + 4;
-      }
-      else if (sendDir == BW)
-      {
-         lMin1X1 = 1;
-         lMax1X1 = lMin1X1 + 4;
-         lMin1X3 = 5;
-         lMax1X3 = lMin1X3;
-
-         lMin2X1 = 5;
-         lMax2X1 = lMin2X1;
-         lMin2X3 = 1;
-         lMax2X3 = lMin2X3 + 4;
-      }
-      else if (sendDir == BE)
-      {
-         lMin1X1 = maxX1 - 6;
-         lMax1X1 = lMin1X1 + 4;
-         lMin1X3 = 5;
-         lMax1X3 = lMin1X3;
-
-
-         lMin2X1 = maxX1 - 6;
-         lMax2X1 = lMin2X1;
-         lMin2X3 = 1;
-         lMax2X3 = lMin2X3 + 4;
-      }
-      else if (sendDir == TW)
-      {
-         lMin1X1 = 1;
-         lMax1X1 = lMin1X1 + 5;
-         lMin1X3 = maxX3 - 6;
-         lMax1X3 = lMin1X3;
-
-         lMin2X1 = 5;
-         lMax2X1 = lMin2X1;
-         lMin2X3 = maxX3 - 6;
-         lMax2X3 = lMin2X3 + 4;
-      }
-
-      if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type00)
-      {
-         lMin1X2 = minX2;
-         lMax1X2 = maxX2 + maxOffX2 - 1;
-      }
-      else if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type10)
-      {
-         lMin1X2 = minX2 + minOffX2;
-         lMax1X2 = maxX2 - 1;
-      }
-
-      findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetSender);
-      findFCCells(lMin2X1, lMin1X2, lMin2X3, lMax2X1, lMax1X2, lMax2X3, iNodeSetSender);
-      break;
-      //T-B-N-S
-   case TN: case BS: case BN: case TS:
-      if (sendDir == TN)
-      {
-         lMin1X2 = maxX2 - 6;
-         lMax1X2 = lMin1X2 + 4;
-         lMin1X3 = maxX3 - 6;
-         lMax1X3 = lMin1X3;
-
-         lMin2X2 = maxX2 - 6;
-         lMax2X2 = lMin2X2;
-         lMin2X3 = maxX3 - 6;
-         lMax2X3 = lMin2X3 + 4;
-      }
-      else if (sendDir == BS)
-      {
-         lMin1X2 = 1;
-         lMax1X2 = lMin1X2 + 4;
-         lMin1X3 = 5;
-         lMax1X3 = lMin1X3;
-
-         lMin2X2 = 5;
-         lMax2X2 = lMin2X2;
-         lMin2X3 = 1;
-         lMax2X3 = lMin2X3 + 4;
-      }
-      else if (sendDir == BN)
-      {
-         lMin1X2 = maxX2 - 6;
-         lMax1X2 = lMin1X2 + 4;
-         lMin1X3 = 5;
-         lMax1X3 = lMin1X3;
-
-         lMin2X2 = maxX2 - 6;
-         lMax2X2 = lMin2X2;
-         lMin2X3 = 1;
-         lMax2X3 = lMin2X3 + 4;
-      }
-      else if (sendDir == TS)
-      {
-         lMin1X2 = 1;
-         lMax1X2 = lMin1X2 + 4;
-         lMin1X3 = maxX3 - 6;
-         lMax1X3 = lMin1X3;
-
-         lMin2X2 = 5;
-         lMax2X2 = lMin2X2;
-         lMin2X3 = maxX3 - 6;
-         lMax2X3 = lMin2X3 + 4;
-      }
-
-      if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type00)
-      {
-         lMin1X1 = minX1;
-         lMax1X1 = maxX1 + maxOffX1 - 1;
-      }
-      else if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type10)
-      {
-         lMin1X1 = minX1 + minOffX1;
-         lMax1X1 = maxX1 - 1;
-      }
-
-      findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetSender);
-      findFCCells(lMin1X1, lMin2X2, lMin2X3, lMax1X1, lMax2X2, lMax2X3, iNodeSetSender);
-      break;
-      //corners
-   case TNE: case TNW: case TSE: case TSW: case BNE: case BNW: case BSE: case BSW:
-      if (sendDir == TNE)
-      {
-         lMin1X1 = maxX1-6;
-         lMax1X1 = maxX1-6;
-         lMin1X2 = maxX2-6;
-         lMax1X2 = maxX2-2;
-         lMin1X3 = maxX3-6;
-         lMax1X3 = maxX3-2;
-
-         lMin2X1 = maxX1-6;
-         lMax2X1 = maxX1-2;
-         lMin2X2 = maxX2-6;
-         lMax2X2 = maxX2-6;
-         lMin2X3 = maxX3-6;
-         lMax2X3 = maxX3-1;
-
-         lMin3X1 = maxX1-6;
-         lMax3X1 = maxX1-2;
-         lMin3X2 = maxX2-6;
-         lMax3X2 = maxX2-2;
-         lMin3X3 = maxX3-6;
-         lMax3X3 = maxX3-5;
-      }
-      else if (sendDir == TNW)
-      {
-         lMin1X1 = 5;
-         lMax1X1 = 5;
-         lMin1X2 = maxX2-6;
-         lMax1X2 = maxX2-2;
-         lMin1X3 = maxX3-6;
-         lMax1X3 = maxX3-2;
-
-         lMin2X1 = 1;
-         lMax2X1 = 5;
-         lMin2X2 = maxX2-6;
-         lMax2X2 = maxX2-6;
-         lMin2X3 = maxX3-6;
-         lMax2X3 = maxX3-2;
-
-         lMin3X1 = 1;
-         lMax3X1 = 5;
-         lMin3X2 = maxX2-6;
-         lMax3X2 = maxX2-2;
-         lMin3X3 = maxX3-6;
-         lMax3X3 = maxX3-6;
-      }
-      else if (sendDir == TSE)
-      {
-         lMin1X1 = maxX1-6;
-         lMax1X1 = maxX1-6;
-         lMin1X2 = 1;
-         lMax1X2 = 5;
-         lMin1X3 = maxX3-6;
-         lMax1X3 = maxX3-2;
-
-         lMin2X1 = maxX1-6;
-         lMax2X1 = maxX1-2;
-         lMin2X2 = 5;
-         lMax2X2 = 5;
-         lMin2X3 = maxX3-6;
-         lMax2X3 = maxX3-2;
-
-         lMin3X1 = maxX1-6;
-         lMax3X1 = maxX1-2;
-         lMin3X2 = 1;
-         lMax3X2 = 5;
-         lMin3X3 = maxX3-6;
-         lMax3X3 = maxX3-6;
-      }
-      else if (sendDir == TSW)
-      {
-         lMin1X1 = 5;
-         lMax1X1 = 5;
-         lMin1X2 = 1;
-         lMax1X2 = 5;
-         lMin1X3 = maxX3-6;
-         lMax1X3 = maxX3-2;
-
-         lMin2X1 = 1;
-         lMax2X1 = 5;
-         lMin2X2 = 5;
-         lMax2X2 = 5;
-         lMin2X3 = maxX3-6;
-         lMax2X3 = maxX3-2;
-
-         lMin3X1 = 1;
-         lMax3X1 = 5;
-         lMin3X2 = 1;
-         lMax3X2 = 5;
-         lMin3X3 = maxX3-6;
-         lMax3X3 = maxX3-6;
-      }
-      else if (sendDir == BNE)
-      {
-         lMin1X1 = maxX1-6;
-         lMax1X1 = maxX1-6;
-         lMin1X2 = maxX2-6;
-         lMax1X2 = maxX2-2;
-         lMin1X3 = 1;
-         lMax1X3 = 5;
-
-         lMin2X1 = maxX1-6;
-         lMax2X1 = maxX1-2;
-         lMin2X2 = maxX2-6;
-         lMax2X2 = maxX2-6;
-         lMin2X3 = 1;
-         lMax2X3 = 5;
-
-         lMin3X1 = maxX1-6;
-         lMax3X1 = maxX1-2;
-         lMin3X2 = maxX2-6;
-         lMax3X2 = maxX2-2;
-         lMin3X3 = 5;
-         lMax3X3 = 5;
-      }
-      else if (sendDir == BNW)
-      {
-         lMin1X1 = 5;
-         lMax1X1 = 5;
-         lMin1X2 = maxX2-6;
-         lMax1X2 = maxX2-2;
-         lMin1X3 = 1;
-         lMax1X3 = 5;
-
-         lMin2X1 = 1;
-         lMax2X1 = 5;
-         lMin2X2 = maxX2-6;
-         lMax2X2 = maxX2-6;
-         lMin2X3 = 1;
-         lMax2X3 = 5;
-
-         lMin3X1 = 1;
-         lMax3X1 = 5;
-         lMin3X2 = maxX2-6;
-         lMax3X2 = maxX2-2;
-         lMin3X3 = 5;
-         lMax3X3 = 5;
-      }
-      else if (sendDir == BSE)
-      {
-         lMin1X1 = maxX1-6;
-         lMax1X1 = maxX1-6;
-         lMin1X2 = 1;
-         lMax1X2 = 5;
-         lMin1X3 = 1;
-         lMax1X3 = 5;
-
-         lMin2X1 = maxX1-6;
-         lMax2X1 = maxX1-2;
-         lMin2X2 = 5;
-         lMax2X2 = 5;
-         lMin2X3 = 1;
-         lMax2X3 = 5;
-
-         lMin3X1 = maxX1-5;
-         lMax3X1 = maxX1-2;
-         lMin3X2 = 1;
-         lMax3X2 = 5;
-         lMin3X3 = 5;
-         lMax3X3 = 5;
-      }
-      else if (sendDir == BSW)
-      {
-         lMin1X1 = 5;
-         lMax1X1 = 5;
-         lMin1X2 = 1;
-         lMax1X2 = 5;
-         lMin1X3 = 1;
-         lMax1X3 = 5;
-
-         lMin2X1 = 1;
-         lMax2X1 = 5;
-         lMin2X2 = 5;
-         lMax2X2 = 5;
-         lMin2X3 = 1;
-         lMax2X3 = 5;
-
-         lMin3X1 = 1;
-         lMax3X1 = 5;
-         lMin3X2 = 1;
-         lMax3X2 = 5;
-         lMin3X3 = 5;
-         lMax3X3 = 5;
-      }
-      findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetSender);
-      findFCCells(lMin2X1, lMin2X2, lMin2X3, lMax2X1, lMax2X2, lMax2X3, iNodeSetSender);
-      findFCCells(lMin3X1, lMin3X2, lMin3X3, lMax3X1, lMax3X2, lMax3X3, iNodeSetSender);
-      break;
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-void FineToCoarseNodeSetBlock3DConnector::fillSendVectors()
-{
-   using namespace D3Q27System;
-
-   SPtr<DistributionArray3D>  fFrom = block.lock()->getKernel()->getDataSet()->getFdistributions();
-
-   int index = 0;
-
-   vector_type& data = this->sender->getData();
-
-   for(INodeVector  inode : iNodeSetSender)
-   {
-      LBMReal icellC[27];
-      D3Q27ICell icellF;
-      iprocessor->readICell(fFrom, icellF, inode[0], inode[1], inode[2]);
-      iprocessor->interpolateFineToCoarse(icellF, icellC, inode[3], inode[4], inode[5]);
-      writeICellCtoData(data, index, icellC);
-   }
-
-}
-//////////////////////////////////////////////////////////////////////////
-void FineToCoarseNodeSetBlock3DConnector::readICellFfromData(vector_type& data, int& index, D3Q27ICell& icellF)
-{
-   readNodeFromVector(data, index, icellF.BSW);
-   readNodeFromVector(data, index, icellF.BSE);
-   readNodeFromVector(data, index, icellF.BNW);
-   readNodeFromVector(data, index, icellF.BNE);
-   readNodeFromVector(data, index, icellF.TSW);
-   readNodeFromVector(data, index, icellF.TSE);
-   readNodeFromVector(data, index, icellF.TNW);
-   readNodeFromVector(data, index, icellF.TNE);
-}
-//////////////////////////////////////////////////////////////////////////
-void FineToCoarseNodeSetBlock3DConnector::readNodeFromVector(vector_type& data, int& index, LBMReal* inode)
-{
-   for (int i = D3Q27System::STARTF; i < D3Q27System::ENDF+1; i++)
-   {
-      inode[i] = data[index++];
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-void FineToCoarseNodeSetBlock3DConnector::writeICellCtoData(vector_type& data, int& index, LBMReal* icellC)
-{
-   for (int i = D3Q27System::STARTF; i < D3Q27System::ENDF+1; i++)
-   {
-      data[index++] = icellC[i];
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-void FineToCoarseNodeSetBlock3DConnector::findCFCells(int lMinX1, int lMinX2, int lMinX3, int lMaxX1, int lMaxX2, int lMaxX3, INodeSet &inodes)
-{
-   int ix1, ix2, ix3;
-
-   for (ix3 = lMinX3; ix3<=lMaxX3; ix3 += 2)
-   {
-      for (ix2 = lMinX2; ix2<=lMaxX2; ix2 += 2)
-      {
-         for (ix1 = lMinX1; ix1<=lMaxX1; ix1 += 2)
-         {
-            INodeVector inv;
-            inv.push_back(ix1);
-            inv.push_back(ix2);
-            inv.push_back(ix3);
-            //inodes.insert(inv);
-            inodes.push_back(inv);
-         }
-      }
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-void FineToCoarseNodeSetBlock3DConnector::findCFCells()
-{
-   using namespace D3Q27System;
-
-   int lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3;
-
-   //////////////////////////////////////////////////////
-   //Debug
-   //////////////////////////////////////////////////////
-   if (block.lock()->getGlobalID() == 2183)
-   {
-      int test = 0;
-   }
-
-   switch (sendDir)
-   {
-      //faces
-   case E: case W:
-      if (sendDir == E)
-      {
-         lMinX1 = maxX1 - 3;
-         lMaxX1 = lMinX1;
-      }
-      else if (sendDir == W)
-      {
-         lMinX1 = 2;
-         lMaxX1 = lMinX1;
-      }
-
-      if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type00)
-      {
-         lMinX2 = minX2;
-         lMaxX2 = maxX2 + maxOffX2 - 1;
-         lMinX3 = minX3;
-         lMaxX3 = maxX3 + maxOffX3 - 1;
-      }
-      else if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type10)
-      {
-         lMinX2 = minX2 + minOffX2;
-         lMaxX2 = maxX2 - 1;
-         lMinX3 = minX3;
-         lMaxX3 = maxX3 + maxOffX3 - 1;
-      }
-      else if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type01)
-      {
-         lMinX2 = minX2;
-         lMaxX2 = maxX2 + maxOffX2 - 1;
-         lMinX3 = minX3 + minOffX3;
-         lMaxX3 = maxX3 - 1;
-      }
-      else if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type11)
-      {
-         lMinX2 = minX2 + minOffX2;
-         lMaxX2 = maxX2 - 1;
-         lMinX3 = minX3 + minOffX3;
-         lMaxX3 = maxX3 - 1;
-      }
-      findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetReceiver);
-      break;
-   case N: case S:
-      if (sendDir == N)
-      {
-         lMinX2 = maxX2 - 3;
-         lMaxX2 = lMinX2;
-      }
-      else if (sendDir == S)
-      {
-         lMinX2 = 2;
-         lMaxX2 = lMinX2;
-      }
-
-      if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type00)
-      {
-         lMinX1 = minX1;
-         lMaxX1 = maxX1 + maxOffX1 - 1;
-         lMinX3 = minX3;
-         lMaxX3 = maxX3 + maxOffX3 - 1;
-      }
-      else if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type10)
-      {
-         lMinX1 = minX1 + minOffX1;
-         lMaxX1 = maxX1;
-         lMinX3 = minX3;
-         lMaxX3 = maxX3 + maxOffX3 - 1;
-      }
-      else if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type01)
-      {
-         lMinX1 = minX1;
-         lMaxX1 = maxX1 + maxOffX1 - 1;
-         lMinX3 = minX3 + minOffX3;
-         lMaxX3 = maxX3 - 1;
-      }
-      else if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type11)
-      {
-         lMinX1 = minX1 + minOffX1;
-         lMaxX1 = maxX1 - 1;
-         lMinX3 = minX3 + minOffX3;
-         lMaxX3 = maxX3 - 1;
-      }
-      findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetReceiver);
-      break;
-   case T: case B:
-      if (sendDir == T)
-      {
-         lMinX3 = maxX3 - 3;
-         lMaxX3 = lMinX3;
-      }
-      else if (sendDir == B)
-      {
-         lMinX3 = 2;
-         lMaxX3 = lMinX3;
-      }
-
-      if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type00)
-      {
-         lMinX1 = minX1;
-         lMaxX1 = maxX1 + maxOffX1 - 1;
-         lMinX2 = minX2;
-         lMaxX2 = maxX2 + maxOffX2 - 1;
-      }
-      else if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type10)
-      {
-         lMinX1 = minX1 + minOffX1;
-         lMaxX1 = maxX1 - 1;
-         lMinX2 = minX2;
-         lMaxX2 = maxX2 + maxOffX2 - 1;
-      }
-      else if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type01)
-      {
-         lMinX1 = minX1;
-         lMaxX1 = maxX1 + maxOffX1 - 1;
-         lMinX2 = minX2 + minOffX2;
-         lMaxX2 = maxX2 - 1;
-      }
-      else if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type11)
-      {
-         lMinX1 = minX1 + minOffX1;
-         lMaxX1 = maxX1 - 1;
-         lMinX2 = minX2 + minOffX2;
-         lMaxX2 = maxX2 - 1;
-      }
-      findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetReceiver);
-      break;
-
-      //edges
-      //N-S-E-W
-   case NE: case SW: case SE: case NW:
-      if (sendDir == NE)
-      {
-         lMinX1 = maxX1 - 3;
-         lMaxX1 = lMinX1 + 2;
-         lMinX2 = maxX2 - 3;
-         lMaxX2 = lMinX2 + 2;
-      }
-      else if (sendDir == SW)
-      {
-         lMinX1 = 0;
-         lMaxX1 = lMinX1 + 3;
-         lMinX2 = 0;
-         lMaxX2 = lMinX2 + 3;
-      }
-      else if (sendDir == SE)
-      {
-         lMinX1 = maxX1 - 3;
-         lMaxX1 = lMinX1 + 2;
-         lMinX2 = 0;
-         lMaxX2 = lMinX2 + 2;
-      }
-      else if (sendDir == NW)
-      {
-         lMinX1 = 0;
-         lMaxX1 = lMinX1 + 2;
-         lMinX2 = maxX2 - 3;
-         lMaxX2 = lMinX2 + 2;
-      }
-
-      if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type00)
-      {
-         lMinX3 = minX3;
-         lMaxX3 = maxX3 + maxOffX3 - 1;
-      }
-      else if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type10)
-      {
-         lMinX3 = minX3 + minOffX3;
-         lMaxX3 = maxX3 - 1;
-      }
-
-      findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetReceiver);
-      break;
-      //T-B-E-W
-   case TE: case BW: case BE: case TW:
-      if (sendDir == TE)
-      {
-         lMinX1 = maxX1 - 3;
-         lMaxX1 = lMinX1 + 2;
-         lMinX3 = maxX3 - 3;
-         lMaxX3 = lMinX3 + 2;
-      }
-      else if (sendDir == BW)
-      {
-         lMinX1 = 0;
-         lMaxX1 = lMinX1 + 2;
-         lMinX3 = 0;
-         lMaxX3 = lMinX3 + 2;
-      }
-      else if (sendDir == BE)
-      {
-         lMinX1 = maxX1 - 3;
-         lMaxX1 = lMinX1 + 2;
-         lMinX3 = 0;
-         lMaxX3 = lMinX3 + 2;
-      }
-      else if (sendDir == TW)
-      {
-         lMinX1 = 0;
-         lMaxX1 = lMinX1 + 2;
-         lMinX3 = maxX3 - 3;
-         lMaxX3 = lMinX3 + 2;
-      }
-
-      if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type00)
-      {
-         lMinX2 = minX2;
-         lMaxX2 = maxX2 + maxOffX2 - 1;
-      }
-      else if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type10)
-      {
-         lMinX2 = minX2 + minOffX2;
-         lMaxX2 = maxX2 - 1;
-      }
-
-      findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetReceiver);
-      break;
-      //T-B-N-S
-   case TN: case BS: case BN: case TS:
-      if (sendDir == TN)
-      {
-         lMinX2 = maxX2 - 3;
-         lMaxX2 = lMinX2 + 2;
-         lMinX3 = maxX3 - 3;
-         lMaxX3 = lMinX3 + 2;
-      }
-      else if (sendDir == BS)
-      {
-         lMinX2 = 0;
-         lMaxX2 = lMinX2 + 2;
-         lMinX3 = 0;
-         lMaxX3 = lMinX3 + 2;
-      }
-      else if (sendDir == BN)
-      {
-         lMinX2 = maxX2 - 3;
-         lMaxX2 = lMinX2 + 2;
-         lMinX3 = 0;
-         lMaxX3 = lMinX3 + 2;
-      }
-      else if (sendDir == TS)
-      {
-         lMinX2 = 0;
-         lMaxX2 = lMinX2 + 2;
-         lMinX3 = maxX3 - 3;
-         lMaxX3 = lMinX3 + 2;
-      }
-
-      if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type00)
-      {
-         lMinX1 = minX1;
-         lMaxX1 = maxX1 + maxOffX1 - 1;
-      }
-      else if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type10)
-      {
-         lMinX1 = minX1 + minOffX1;
-         lMaxX1 = maxX1 - 1;
-      }
-
-      findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetReceiver);
-      break;
-      //corners
-   case TNE: case TNW: case TSE: case TSW: case BNE: case BNW: case BSE: case BSW:
-      if (sendDir == TNE)
-      {
-         lMinX1 = maxX1 - 3;
-         lMaxX1 = maxX1 - 1;
-         lMinX2 = maxX2 - 3;
-         lMaxX2 = maxX2 - 1;
-         lMinX3 = maxX3 - 3;
-         lMaxX3 = maxX3 - 1;
-      }
-      else if (sendDir == TNW)
-      {
-         lMinX1 = 0;
-         lMaxX1 = 2;
-         lMinX2 = maxX2 - 3;
-         lMaxX2 = maxX2 - 1;
-         lMinX3 = maxX3 - 3;
-         lMaxX3 = maxX3 - 1;
-      }
-      else if (sendDir == TSE)
-      {
-         lMinX1 = maxX1 - 3;
-         lMaxX1 = maxX1 - 1;
-         lMinX2 = 0;
-         lMaxX2 = 2;
-         lMinX3 = maxX3 - 3;
-         lMaxX3 = maxX3 - 1;
-      }
-      else if (sendDir == TSW)
-      {
-         lMinX1 = 0;
-         lMaxX1 = 2;
-         lMinX2 = 0;
-         lMaxX2 = 2;
-         lMinX3 = maxX3 - 3;
-         lMaxX3 = maxX3 - 1;
-      }
-      else if (sendDir == BNE)
-      {
-         lMinX1 = maxX1 - 3;
-         lMaxX1 = maxX1 - 1;
-         lMinX2 = maxX2 - 3;
-         lMaxX2 = maxX2 - 1;
-         lMinX3 = 0;
-         lMaxX3 = 2;
-      }
-      else if (sendDir == BNW)
-      {
-         lMinX1 = 0;
-         lMaxX1 = 2;
-         lMinX2 = maxX2 - 3;
-         lMaxX2 = maxX2 - 1;
-         lMinX3 = 0;
-         lMaxX3 = 2;
-      }
-      else if (sendDir == BSE)
-      {
-         lMinX1 = maxX1 - 3;
-         lMaxX1 = maxX1 - 1;
-         lMinX2 = 0;
-         lMaxX2 = 2;
-         lMinX3 = 0;
-         lMaxX3 = 2;
-      }
-      else if (sendDir == BSW)
-      {
-         lMinX1 = 0;
-         lMaxX1 = 2;
-         lMinX2 = 0;
-         lMaxX2 = 2;
-         lMinX3 = 0;
-         lMaxX3 = 2;
-      }
-      findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetReceiver);
-      break;
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-void FineToCoarseNodeSetBlock3DConnector::distributeReceiveVectors()
-{
-   using namespace D3Q27System;
-
-   SPtr<DistributionArray3D>  fTo = FineToCoarseBlock3DConnector::block.lock()->getKernel()->getDataSet()->getFdistributions();
-
-   int index = 0;
-
-   vector_type& data = this->receiver->getData();
-
-   for(INodeVector  inode : iNodeSetReceiver)
-   {
-      D3Q27ICell icellF;
-      this->readICellFfromData(data, index, icellF);
-      iprocessor->writeICellInv(fTo, icellF, inode[0], inode[1], inode[2]);
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-//
-//void FineToCoarseNodeSetBlock3DConnector::getLocalMinMax(int& minX1, int& minX2, int& minX3, int& maxX1, int& maxX2, int& maxX3)
-//{
-//   using namespace D3Q27System;
-//   int TminX1 = minX1; int TminX2 = minX2; int TminX3 = minX3; int TmaxX1 = maxX1; int TmaxX2 = maxX2; int TmaxX3 = maxX3;
-//
-//   if (block.lock()->hasInterpolationFlagFC(E))
-//   {
-//      if (maxX1==TmaxX1) maxX1 -= 2;
-//   }
-//   if (block.lock()->hasInterpolationFlagFC(W))
-//   {
-//      if (minX1==TminX1) minX1 += 4;
-//   }
-//   if (block.lock()->hasInterpolationFlagFC(N))
-//   {
-//      if (maxX2==TmaxX2) maxX2 -= 2;
-//   }
-//   if (block.lock()->hasInterpolationFlagFC(S))
-//   {
-//      if (minX2==TminX2) minX2 += 4;
-//   }
-//   if (block.lock()->hasInterpolationFlagFC(T))
-//   {
-//      if (maxX3==TmaxX3) maxX3 -= 2;
-//   }
-//   if (block.lock()->hasInterpolationFlagFC(B))
-//   {
-//      if (minX3==TminX3) minX3 += 4;
-//   }
-//
-//   ////////////
-//   /////E-W-N-S
-//   if (block.lock()->hasInterpolationFlagFC(NE)&& !block.lock()->hasInterpolationFlagFC(N) && !block.lock()->hasInterpolationFlagFC(E))
-//   {
-//      if (maxX1==TmaxX1) maxX1 -= 2;
-//      if (maxX2==TmaxX2) maxX2 -= 2;
-//   }
-//   if (block.lock()->hasInterpolationFlagFC(SW)&& !block.lock()->hasInterpolationFlagFC(W) && !block.lock()->hasInterpolationFlagFC(S))
-//   {
-//      if (minX1==TminX1) minX1 += 4;
-//      if (minX2==TminX2) minX2 += 4;
-//   }
-//   if (block.lock()->hasInterpolationFlagFC(SE)&& !block.lock()->hasInterpolationFlagFC(E) && !block.lock()->hasInterpolationFlagFC(S))
-//   {
-//      if (maxX1==TmaxX1) maxX1 -= 2;
-//      if (minX2==TminX2) minX2 += 4;
-//   }
-//   if (block.lock()->hasInterpolationFlagFC(NW)&& !block.lock()->hasInterpolationFlagFC(N) && !block.lock()->hasInterpolationFlagFC(W))
-//   {
-//      if (minX1==TminX1) minX1 += 4;
-//      if (maxX2==TmaxX2) maxX2 -= 2;
-//   }
-//
-//   //////T-B-E-W
-//   if (block.lock()->hasInterpolationFlagFC(TE) && !block.lock()->hasInterpolationFlagFC(E) && !block.lock()->hasInterpolationFlagFC(T))
-//   {
-//      if (maxX1==TmaxX1) maxX1 -= 2;
-//      if (maxX3==TmaxX3) maxX3 -= 2;
-//   }
-//   if (block.lock()->hasInterpolationFlagFC(BW)&& !block.lock()->hasInterpolationFlagFC(W) && !block.lock()->hasInterpolationFlagFC(B))
-//   {
-//      if (minX1==TminX1) minX1 += 4;
-//      if (minX3==TminX3) minX3 += 4;
-//   }
-//   if (block.lock()->hasInterpolationFlagFC(BE)&& !block.lock()->hasInterpolationFlagFC(E) && !block.lock()->hasInterpolationFlagFC(B))
-//   {
-//      if (maxX1==TmaxX1) maxX1 -= 2;
-//      if (minX3==TminX3) minX3 += 4;
-//   }
-//   if (block.lock()->hasInterpolationFlagFC(TW)&& !block.lock()->hasInterpolationFlagFC(W) && !block.lock()->hasInterpolationFlagFC(T))
-//   {
-//      if (minX1==TminX1) minX1 += 4;
-//      if (maxX3==TmaxX3) maxX3 -= 2;
-//   }
-//
-//
-//   ////T-B-N-S
-//   if (block.lock()->hasInterpolationFlagFC(TN)&& !block.lock()->hasInterpolationFlagFC(N) && !block.lock()->hasInterpolationFlagFC(T))
-//   {
-//      if (maxX2==TmaxX2) maxX2 -= 2;
-//      if (maxX3==TmaxX3) maxX3 -= 2;
-//   }
-//   if (block.lock()->hasInterpolationFlagFC(BS)&& !block.lock()->hasInterpolationFlagFC(S) && !block.lock()->hasInterpolationFlagFC(B))
-//   {
-//      if (minX2==TminX2) minX2 += 4;
-//      if (minX3==TminX3) minX3 += 4;
-//   }
-//   if (block.lock()->hasInterpolationFlagFC(BN)&& !block.lock()->hasInterpolationFlagFC(N) && !block.lock()->hasInterpolationFlagFC(B))
-//   {
-//      if (maxX2==TmaxX2) maxX2 -= 2;
-//      if (minX3==TminX3) minX3 += 4;
-//   }
-//   if (block.lock()->hasInterpolationFlagFC(TS) && !block.lock()->hasInterpolationFlagFC(S) && !block.lock()->hasInterpolationFlagFC(T))
-//   {
-//      if (minX2==TminX2) minX2 += 4;
-//      if (maxX3==TmaxX3) maxX3 -= 2;
-//   }
-//}
-//////////////////////////////////////////////////////////////////////////
-
+#include "FineToCoarseNodeSetBlock3DConnector.h"
+#include "BCProcessor.h"
+#include "DataSet3D.h"
+
+
+//////////////////////////////////////////////////////////////////////////
+FineToCoarseNodeSetBlock3DConnector::FineToCoarseNodeSetBlock3DConnector(SPtr<Block3D> block, VectorTransmitterPtr sender, VectorTransmitterPtr receiver,
+   int sendDir, InterpolationProcessorPtr iprocessor, CFconnectorType connType) : FineToCoarseBlock3DConnector(block, sender, receiver, sendDir, iprocessor, connType)
+{
+
+}
+//////////////////////////////////////////////////////////////////////////
+void FineToCoarseNodeSetBlock3DConnector::init()
+{
+   bMaxX1 = (int)FineToCoarseBlock3DConnector::block.lock()->getKernel()->getDataSet()->getFdistributions()->getNX1();
+   bMaxX2 = (int)FineToCoarseBlock3DConnector::block.lock()->getKernel()->getDataSet()->getFdistributions()->getNX2();
+   bMaxX3 = (int)FineToCoarseBlock3DConnector::block.lock()->getKernel()->getDataSet()->getFdistributions()->getNX3();
+
+   minX1 = 0;
+   minX2 = 0;
+   minX3 = 0;
+   maxX1 = bMaxX1 - 1;
+   maxX2 = bMaxX2 - 1;
+   maxX3 = bMaxX3 - 1;
+
+   minOffX1 = 0;
+   minOffX2 = 0;
+   minOffX3 = 0;
+
+   maxOffX1 = 0;
+   maxOffX2 = 0;
+   maxOffX3 = 0;
+
+   if (Utilities::isEven(bMaxX1))
+   {
+      minOffX1 = 0;
+      maxOffX1 = 0;
+   }
+   else if (Utilities::isOdd(bMaxX1))
+   {
+      minOffX1 = 1;
+      maxOffX1 = -1;
+   }
+
+   if (Utilities::isEven(bMaxX2))
+   {
+      minOffX2 = 0;
+      maxOffX2 = 0;
+   }
+   else if (Utilities::isOdd(bMaxX2))
+   {
+      minOffX2 = 1;
+      maxOffX2 = -1;
+   }
+
+   if (Utilities::isEven(bMaxX3))
+   {
+      minOffX3 = 0;
+      maxOffX3 = 0;
+   }
+   else if (Utilities::isOdd(bMaxX3))
+   {
+      minOffX3 = 1;
+      maxOffX3 = -1;
+   }
+
+   //int       sendSize = 0;
+   LBMReal initValue = -999.0;
+
+   int sendDataPerNode = 27/*f*/;
+   int iCellSize = 1; //size of interpolation cell
+
+   findFCCells();
+   findCFCells();
+
+   //////////////////////////////////////////////////////
+   //Debug
+   //////////////////////////////////////////////////////
+   if (FineToCoarseBlock3DConnector::block.lock()->getGlobalID() == 2183)
+   {
+      int test = 0;
+   }
+
+
+   if (FineToCoarseBlock3DConnector::sender) FineToCoarseBlock3DConnector::sender->getData().resize(iNodeSetSender.size()*iCellSize*sendDataPerNode, initValue);
+   else FineToCoarseBlock3DConnector::sender = VectorTransmitterPtr(new TbLocalTransmitter< CbVector< LBMReal > >());
+
+   if (!FineToCoarseBlock3DConnector::receiver) FineToCoarseBlock3DConnector::receiver = VectorTransmitterPtr(new TbLocalTransmitter< CbVector< LBMReal > >());
+}
+//////////////////////////////////////////////////////////////////////////
+void FineToCoarseNodeSetBlock3DConnector::findFCCells(int lMinX1, int lMinX2, int lMinX3, int lMaxX1, int lMaxX2, int lMaxX3, INodeSet &inodes)
+{
+   //////////////////////////////////////////////////////
+   //Debug
+   //////////////////////////////////////////////////////
+   if (FineToCoarseBlock3DConnector::block.lock()->getGlobalID() == 2183)
+   {
+      int test = 0;
+   }
+
+
+   int ix1, ix2, ix3;
+   LBMReal x1off, x2off, x3off;
+
+   SPtr<DistributionArray3D>  fFrom = FineToCoarseBlock3DConnector::block.lock()->getKernel()->getDataSet()->getFdistributions();
+   SPtr<BCArray3D> bcArray = FineToCoarseBlock3DConnector::block.lock()->getKernel()->getBCProcessor()->getBCArray();
+
+   for (ix3 = lMinX3; ix3<=lMaxX3; ix3 += 2)
+   {
+      for (ix2 = lMinX2; ix2<=lMaxX2; ix2 += 2)
+      {
+         for (ix1 = lMinX1; ix1<=lMaxX1; ix1 += 2)
+         {
+            D3Q27ICell icellC;
+
+            int howManySolids = FineToCoarseBlock3DConnector::iprocessor->iCellHowManySolids(bcArray, ix1, ix2, ix3);
+
+            if (howManySolids == 0 || howManySolids == 8)
+            {
+               x1off = 0.0;
+               x2off = 0.0;
+               x3off = 0.0;
+            }
+            else
+            {
+               if (!iprocessor->findNeighborICell(bcArray, fFrom, icellC, bMaxX1, bMaxX2, bMaxX3, ix1, ix2, ix3, x1off, x2off, x3off))
+               {
+                  std::string err = "For "+FineToCoarseBlock3DConnector::block.lock()->toString()+" x1="+UbSystem::toString(ix1)+", x2=" + UbSystem::toString(ix2)+", x3=" + UbSystem::toString(ix3)+
+                     " interpolation is not implemented for other direction"+
+                     " by using in: "+(std::string)typeid(*this).name()+
+                     " or maybe you have a solid on the block boundary";
+                  UB_THROW(UbException(UB_EXARGS, err));
+               }
+            }
+
+            INodeVector inv;
+            inv.push_back(ix1 + (int)x1off);
+            inv.push_back(ix2 + (int)x2off);
+            inv.push_back(ix3 + (int)x3off);
+            inv.push_back((int)x1off);
+            inv.push_back((int)x2off);
+            inv.push_back((int)x3off);
+            //inodes.insert(inv);
+            inodes.push_back(inv);
+         }
+      }
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+
+void FineToCoarseNodeSetBlock3DConnector::findFCCells()
+{
+   using namespace D3Q27System;
+
+   int lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3;
+   int lMin2X1, lMin2X2, lMin2X3, lMax2X1, lMax2X2, lMax2X3;
+   int lMin3X1, lMin3X2, lMin3X3, lMax3X1, lMax3X2, lMax3X3;
+
+   //lMin1X1 = minX1+1; lMin1X2 = minX2+1; lMin1X3 = minX3+1;
+   //lMax1X1 = maxX1-1; lMax1X2 = maxX2-1; lMax1X3 = maxX3-1;
+   //getLocalMinMax(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3);
+
+   //lMin2X1 = minX1+1; lMin2X2 = minX2+1; lMin2X3 = minX3+1;
+   //lMax2X1 = maxX1-1; lMax2X2 = maxX2-1; lMax2X3 = maxX3-1;
+   //getLocalMinMax(lMin2X1, lMin2X2, lMin2X3, lMax2X1, lMax2X2, lMax2X3);
+
+   //lMin3X1 = minX1+1; lMin3X2 = minX2+1; lMin3X3 = minX3+1;
+   //lMax3X1 = maxX1-1; lMax3X2 = maxX2-1; lMax3X3 = maxX3-1;
+   //getLocalMinMax(lMin3X1, lMin3X2, lMin3X3, lMax3X1, lMax3X2, lMax3X3);
+
+   switch (sendDir)
+   {
+      //faces
+   case E: case W:
+      if (sendDir == E)
+      {
+         lMin1X1 = maxX1 - 6;
+         lMax1X1 = lMin1X1;
+      }
+      else if (sendDir == W)
+      {
+         lMin1X1 = 5;
+         lMax1X1 = lMin1X1;
+      }
+
+      if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type00)
+      {
+         lMin1X2 = minX2;
+         lMax1X2 = maxX2 + maxOffX2 - 1;
+         lMin1X3 = minX3;
+         lMax1X3 = maxX3 + maxOffX3 - 1;
+      }
+      else if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type10)
+      {
+         lMin1X2 = minX2 + minOffX2;
+         lMax1X2 = maxX2 - 1;
+         lMin1X3 = minX3;
+         lMax1X3 = maxX3 + maxOffX3 - 1;
+      }
+      else if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type01)
+      {
+         lMin1X2 = minX2;
+         lMax1X2 = maxX2 + maxOffX2 - 1;
+         lMin1X3 = minX3 + minOffX3;
+         lMax1X3 = maxX3 - 1;
+      }
+      else if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type11)
+      {
+         lMin1X2 = minX2 + minOffX2;
+         lMax1X2 = maxX2 - 1;
+         lMin1X3 = minX3 + minOffX3;
+         lMax1X3 = maxX3 - 1;
+      }
+      findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetSender);
+      break;
+   case N: case S:
+      if (sendDir == N)
+      {
+         lMin1X2 = maxX2 - 6;
+         lMax1X2 = lMin1X2;
+      }
+      else if (sendDir == S)
+      {
+         lMin1X2 = 5;
+         lMax1X2 = lMin1X2;
+      }
+
+      if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type00)
+      {
+         lMin1X1 = minX1;
+         lMax1X1 = maxX1 + maxOffX1 - 1;
+         lMin1X3 = minX3;
+         lMax1X3 = maxX3 + maxOffX3 - 1;
+      }
+      else if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type10)
+      {
+         lMin1X1 = minX1 + minOffX1;
+         lMax1X1 = maxX1 - 1;
+         lMin1X3 = minX3;
+         lMax1X3 = maxX3 + maxOffX3 - 1;
+      }
+      else if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type01)
+      {
+         lMin1X1 = minX1;
+         lMax1X1 = maxX1 + maxOffX1 - 1;
+         lMin1X3 = minX3 + minOffX3;
+         lMax1X3 = maxX3;
+      }
+      else if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type11)
+      {
+         lMin1X1 = minX1 + minOffX1;
+         lMax1X1 = maxX1 - 1;
+         lMin1X3 = minX3 + minOffX3;
+         lMax1X3 = maxX3 - 1;
+      }
+      findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetSender);
+      break;
+   case T: case B:
+      if (sendDir == T)
+      {
+         lMin1X3 = maxX3 - 6;
+         lMax1X3 = lMin1X3;
+      }
+      else if (sendDir == B)
+      {
+         lMin1X3 = 5;
+         lMax1X3 = lMin1X3;
+      }
+
+      if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type00)
+      {
+         lMin1X1 = minX1;
+         lMax1X1 = maxX1 + maxOffX1 - 1;
+         lMin1X2 = minX2;
+         lMax1X2 = maxX2 + maxOffX2 - 1;
+      }
+      else if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type10)
+      {
+         lMin1X1 = minX1 + minOffX1;
+         lMax1X1 = maxX1 - 1;
+         lMin1X2 = minX2;
+         lMax1X2 = maxX2 + maxOffX2 - 1;
+      }
+      else if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type01)
+      {
+         lMin1X1 = minX1;
+         lMax1X1 = maxX1 + maxOffX1 - 1;
+         lMin1X2 = minX2 + minOffX2;
+         lMax1X2 = maxX2 - 1;
+      }
+      else if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type11)
+      {
+         lMin1X1 = minX1 + minOffX1;
+         lMax1X1 = maxX1 - 1;
+         lMin1X2 = minX2 + minOffX2;
+         lMax1X2 = maxX2 - 1;
+      }
+      findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetSender);
+      break;
+      //edges
+      //N-S-E-W
+   case NE: case SW: case SE: case NW:
+      if (sendDir == NE)
+      {
+         lMin1X1 = maxX1 - 6;
+         lMax1X1 = lMin1X1 + 4;
+         lMin1X2 = maxX2 - 6;
+         lMax1X2 = lMin1X2;
+
+         lMin2X1 = maxX1 - 6;
+         lMax2X1 = lMin2X1;
+         lMin2X2 = maxX2 - 6;
+         lMax2X2 = lMin2X2 + 4;
+      }
+      else if (sendDir == SW)
+      {
+         lMin1X1 = 1;
+         lMax1X1 = lMin1X1 + 4;
+         lMin1X2 = 5;
+         lMax1X2 = lMin1X2;
+
+         lMin2X1 = 5;
+         lMax2X1 = lMin2X1;
+         lMin2X2 = 1;
+         lMax2X2 = lMin2X2 + 4;
+      }
+      else if (sendDir == SE)
+      {
+         lMin1X1 = maxX1 - 6;
+         lMax1X1 = lMin1X1 + 4;
+         lMin1X2 = 5;
+         lMax1X2 = lMin1X2;
+
+         lMin2X1 = maxX1 - 6;
+         lMax2X1 = lMin2X1;
+         lMin2X2 = 1;
+         lMax2X2 = lMin2X2 + 4;
+      }
+      else if (sendDir == NW)
+      {
+         lMin1X1 = 1;
+         lMax1X1 = lMin1X1 + 4;
+         lMin1X2 = maxX2 - 6;
+         lMax1X2 = lMin1X2;
+
+         lMin2X1 = 5;
+         lMax2X1 = lMin2X1;
+         lMin2X2 = maxX2 - 6;
+         lMax2X2 = lMin2X2 + 4;
+      }
+
+      if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type00)
+      {
+         lMin1X3 = minX3;
+         lMax1X3 = maxX3 + maxOffX3 - 1;
+      }
+      else if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type10)
+      {
+         lMin1X3 = minX3 + minOffX3;
+         lMax1X3 = maxX3 - 1;
+      }
+
+      findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetSender);
+      findFCCells(lMin2X1, lMin2X2, lMin1X3, lMax2X1, lMax2X2, lMax1X3, iNodeSetSender);
+
+      break;
+      //T-B-E-W
+   case TE: case BW: case BE: case TW:
+      if (sendDir == TE)
+      {
+         lMin1X1 = maxX1 - 6;
+         lMax1X1 = lMin1X1 + 4;
+         lMin1X3 = maxX3 - 6;
+         lMax1X3 = lMin1X3;
+
+         lMin2X1 = maxX1 - 6;
+         lMax2X1 = lMin2X1;
+         lMin2X3 = maxX3 - 6;
+         lMax2X3 = lMin2X3 + 4;
+      }
+      else if (sendDir == BW)
+      {
+         lMin1X1 = 1;
+         lMax1X1 = lMin1X1 + 4;
+         lMin1X3 = 5;
+         lMax1X3 = lMin1X3;
+
+         lMin2X1 = 5;
+         lMax2X1 = lMin2X1;
+         lMin2X3 = 1;
+         lMax2X3 = lMin2X3 + 4;
+      }
+      else if (sendDir == BE)
+      {
+         lMin1X1 = maxX1 - 6;
+         lMax1X1 = lMin1X1 + 4;
+         lMin1X3 = 5;
+         lMax1X3 = lMin1X3;
+
+
+         lMin2X1 = maxX1 - 6;
+         lMax2X1 = lMin2X1;
+         lMin2X3 = 1;
+         lMax2X3 = lMin2X3 + 4;
+      }
+      else if (sendDir == TW)
+      {
+         lMin1X1 = 1;
+         lMax1X1 = lMin1X1 + 5;
+         lMin1X3 = maxX3 - 6;
+         lMax1X3 = lMin1X3;
+
+         lMin2X1 = 5;
+         lMax2X1 = lMin2X1;
+         lMin2X3 = maxX3 - 6;
+         lMax2X3 = lMin2X3 + 4;
+      }
+
+      if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type00)
+      {
+         lMin1X2 = minX2;
+         lMax1X2 = maxX2 + maxOffX2 - 1;
+      }
+      else if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type10)
+      {
+         lMin1X2 = minX2 + minOffX2;
+         lMax1X2 = maxX2 - 1;
+      }
+
+      findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetSender);
+      findFCCells(lMin2X1, lMin1X2, lMin2X3, lMax2X1, lMax1X2, lMax2X3, iNodeSetSender);
+      break;
+      //T-B-N-S
+   case TN: case BS: case BN: case TS:
+      if (sendDir == TN)
+      {
+         lMin1X2 = maxX2 - 6;
+         lMax1X2 = lMin1X2 + 4;
+         lMin1X3 = maxX3 - 6;
+         lMax1X3 = lMin1X3;
+
+         lMin2X2 = maxX2 - 6;
+         lMax2X2 = lMin2X2;
+         lMin2X3 = maxX3 - 6;
+         lMax2X3 = lMin2X3 + 4;
+      }
+      else if (sendDir == BS)
+      {
+         lMin1X2 = 1;
+         lMax1X2 = lMin1X2 + 4;
+         lMin1X3 = 5;
+         lMax1X3 = lMin1X3;
+
+         lMin2X2 = 5;
+         lMax2X2 = lMin2X2;
+         lMin2X3 = 1;
+         lMax2X3 = lMin2X3 + 4;
+      }
+      else if (sendDir == BN)
+      {
+         lMin1X2 = maxX2 - 6;
+         lMax1X2 = lMin1X2 + 4;
+         lMin1X3 = 5;
+         lMax1X3 = lMin1X3;
+
+         lMin2X2 = maxX2 - 6;
+         lMax2X2 = lMin2X2;
+         lMin2X3 = 1;
+         lMax2X3 = lMin2X3 + 4;
+      }
+      else if (sendDir == TS)
+      {
+         lMin1X2 = 1;
+         lMax1X2 = lMin1X2 + 4;
+         lMin1X3 = maxX3 - 6;
+         lMax1X3 = lMin1X3;
+
+         lMin2X2 = 5;
+         lMax2X2 = lMin2X2;
+         lMin2X3 = maxX3 - 6;
+         lMax2X3 = lMin2X3 + 4;
+      }
+
+      if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type00)
+      {
+         lMin1X1 = minX1;
+         lMax1X1 = maxX1 + maxOffX1 - 1;
+      }
+      else if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type10)
+      {
+         lMin1X1 = minX1 + minOffX1;
+         lMax1X1 = maxX1 - 1;
+      }
+
+      findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetSender);
+      findFCCells(lMin1X1, lMin2X2, lMin2X3, lMax1X1, lMax2X2, lMax2X3, iNodeSetSender);
+      break;
+      //corners
+   case TNE: case TNW: case TSE: case TSW: case BNE: case BNW: case BSE: case BSW:
+      if (sendDir == TNE)
+      {
+         lMin1X1 = maxX1-6;
+         lMax1X1 = maxX1-6;
+         lMin1X2 = maxX2-6;
+         lMax1X2 = maxX2-2;
+         lMin1X3 = maxX3-6;
+         lMax1X3 = maxX3-2;
+
+         lMin2X1 = maxX1-6;
+         lMax2X1 = maxX1-2;
+         lMin2X2 = maxX2-6;
+         lMax2X2 = maxX2-6;
+         lMin2X3 = maxX3-6;
+         lMax2X3 = maxX3-1;
+
+         lMin3X1 = maxX1-6;
+         lMax3X1 = maxX1-2;
+         lMin3X2 = maxX2-6;
+         lMax3X2 = maxX2-2;
+         lMin3X3 = maxX3-6;
+         lMax3X3 = maxX3-5;
+      }
+      else if (sendDir == TNW)
+      {
+         lMin1X1 = 5;
+         lMax1X1 = 5;
+         lMin1X2 = maxX2-6;
+         lMax1X2 = maxX2-2;
+         lMin1X3 = maxX3-6;
+         lMax1X3 = maxX3-2;
+
+         lMin2X1 = 1;
+         lMax2X1 = 5;
+         lMin2X2 = maxX2-6;
+         lMax2X2 = maxX2-6;
+         lMin2X3 = maxX3-6;
+         lMax2X3 = maxX3-2;
+
+         lMin3X1 = 1;
+         lMax3X1 = 5;
+         lMin3X2 = maxX2-6;
+         lMax3X2 = maxX2-2;
+         lMin3X3 = maxX3-6;
+         lMax3X3 = maxX3-6;
+      }
+      else if (sendDir == TSE)
+      {
+         lMin1X1 = maxX1-6;
+         lMax1X1 = maxX1-6;
+         lMin1X2 = 1;
+         lMax1X2 = 5;
+         lMin1X3 = maxX3-6;
+         lMax1X3 = maxX3-2;
+
+         lMin2X1 = maxX1-6;
+         lMax2X1 = maxX1-2;
+         lMin2X2 = 5;
+         lMax2X2 = 5;
+         lMin2X3 = maxX3-6;
+         lMax2X3 = maxX3-2;
+
+         lMin3X1 = maxX1-6;
+         lMax3X1 = maxX1-2;
+         lMin3X2 = 1;
+         lMax3X2 = 5;
+         lMin3X3 = maxX3-6;
+         lMax3X3 = maxX3-6;
+      }
+      else if (sendDir == TSW)
+      {
+         lMin1X1 = 5;
+         lMax1X1 = 5;
+         lMin1X2 = 1;
+         lMax1X2 = 5;
+         lMin1X3 = maxX3-6;
+         lMax1X3 = maxX3-2;
+
+         lMin2X1 = 1;
+         lMax2X1 = 5;
+         lMin2X2 = 5;
+         lMax2X2 = 5;
+         lMin2X3 = maxX3-6;
+         lMax2X3 = maxX3-2;
+
+         lMin3X1 = 1;
+         lMax3X1 = 5;
+         lMin3X2 = 1;
+         lMax3X2 = 5;
+         lMin3X3 = maxX3-6;
+         lMax3X3 = maxX3-6;
+      }
+      else if (sendDir == BNE)
+      {
+         lMin1X1 = maxX1-6;
+         lMax1X1 = maxX1-6;
+         lMin1X2 = maxX2-6;
+         lMax1X2 = maxX2-2;
+         lMin1X3 = 1;
+         lMax1X3 = 5;
+
+         lMin2X1 = maxX1-6;
+         lMax2X1 = maxX1-2;
+         lMin2X2 = maxX2-6;
+         lMax2X2 = maxX2-6;
+         lMin2X3 = 1;
+         lMax2X3 = 5;
+
+         lMin3X1 = maxX1-6;
+         lMax3X1 = maxX1-2;
+         lMin3X2 = maxX2-6;
+         lMax3X2 = maxX2-2;
+         lMin3X3 = 5;
+         lMax3X3 = 5;
+      }
+      else if (sendDir == BNW)
+      {
+         lMin1X1 = 5;
+         lMax1X1 = 5;
+         lMin1X2 = maxX2-6;
+         lMax1X2 = maxX2-2;
+         lMin1X3 = 1;
+         lMax1X3 = 5;
+
+         lMin2X1 = 1;
+         lMax2X1 = 5;
+         lMin2X2 = maxX2-6;
+         lMax2X2 = maxX2-6;
+         lMin2X3 = 1;
+         lMax2X3 = 5;
+
+         lMin3X1 = 1;
+         lMax3X1 = 5;
+         lMin3X2 = maxX2-6;
+         lMax3X2 = maxX2-2;
+         lMin3X3 = 5;
+         lMax3X3 = 5;
+      }
+      else if (sendDir == BSE)
+      {
+         lMin1X1 = maxX1-6;
+         lMax1X1 = maxX1-6;
+         lMin1X2 = 1;
+         lMax1X2 = 5;
+         lMin1X3 = 1;
+         lMax1X3 = 5;
+
+         lMin2X1 = maxX1-6;
+         lMax2X1 = maxX1-2;
+         lMin2X2 = 5;
+         lMax2X2 = 5;
+         lMin2X3 = 1;
+         lMax2X3 = 5;
+
+         lMin3X1 = maxX1-5;
+         lMax3X1 = maxX1-2;
+         lMin3X2 = 1;
+         lMax3X2 = 5;
+         lMin3X3 = 5;
+         lMax3X3 = 5;
+      }
+      else if (sendDir == BSW)
+      {
+         lMin1X1 = 5;
+         lMax1X1 = 5;
+         lMin1X2 = 1;
+         lMax1X2 = 5;
+         lMin1X3 = 1;
+         lMax1X3 = 5;
+
+         lMin2X1 = 1;
+         lMax2X1 = 5;
+         lMin2X2 = 5;
+         lMax2X2 = 5;
+         lMin2X3 = 1;
+         lMax2X3 = 5;
+
+         lMin3X1 = 1;
+         lMax3X1 = 5;
+         lMin3X2 = 1;
+         lMax3X2 = 5;
+         lMin3X3 = 5;
+         lMax3X3 = 5;
+      }
+      findFCCells(lMin1X1, lMin1X2, lMin1X3, lMax1X1, lMax1X2, lMax1X3, iNodeSetSender);
+      findFCCells(lMin2X1, lMin2X2, lMin2X3, lMax2X1, lMax2X2, lMax2X3, iNodeSetSender);
+      findFCCells(lMin3X1, lMin3X2, lMin3X3, lMax3X1, lMax3X2, lMax3X3, iNodeSetSender);
+      break;
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+void FineToCoarseNodeSetBlock3DConnector::fillSendVectors()
+{
+   using namespace D3Q27System;
+
+   SPtr<DistributionArray3D>  fFrom = block.lock()->getKernel()->getDataSet()->getFdistributions();
+
+   int index = 0;
+
+   vector_type& data = this->sender->getData();
+
+   for(INodeVector  inode : iNodeSetSender)
+   {
+      LBMReal icellC[27];
+      D3Q27ICell icellF;
+      iprocessor->readICell(fFrom, icellF, inode[0], inode[1], inode[2]);
+      iprocessor->interpolateFineToCoarse(icellF, icellC, inode[3], inode[4], inode[5]);
+      writeICellCtoData(data, index, icellC);
+   }
+
+}
+//////////////////////////////////////////////////////////////////////////
+void FineToCoarseNodeSetBlock3DConnector::readICellFfromData(vector_type& data, int& index, D3Q27ICell& icellF)
+{
+   readNodeFromVector(data, index, icellF.BSW);
+   readNodeFromVector(data, index, icellF.BSE);
+   readNodeFromVector(data, index, icellF.BNW);
+   readNodeFromVector(data, index, icellF.BNE);
+   readNodeFromVector(data, index, icellF.TSW);
+   readNodeFromVector(data, index, icellF.TSE);
+   readNodeFromVector(data, index, icellF.TNW);
+   readNodeFromVector(data, index, icellF.TNE);
+}
+//////////////////////////////////////////////////////////////////////////
+void FineToCoarseNodeSetBlock3DConnector::readNodeFromVector(vector_type& data, int& index, LBMReal* inode)
+{
+   for (int i = D3Q27System::STARTF; i < D3Q27System::ENDF+1; i++)
+   {
+      inode[i] = data[index++];
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+void FineToCoarseNodeSetBlock3DConnector::writeICellCtoData(vector_type& data, int& index, LBMReal* icellC)
+{
+   for (int i = D3Q27System::STARTF; i < D3Q27System::ENDF+1; i++)
+   {
+      data[index++] = icellC[i];
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+void FineToCoarseNodeSetBlock3DConnector::findCFCells(int lMinX1, int lMinX2, int lMinX3, int lMaxX1, int lMaxX2, int lMaxX3, INodeSet &inodes)
+{
+   int ix1, ix2, ix3;
+
+   for (ix3 = lMinX3; ix3<=lMaxX3; ix3 += 2)
+   {
+      for (ix2 = lMinX2; ix2<=lMaxX2; ix2 += 2)
+      {
+         for (ix1 = lMinX1; ix1<=lMaxX1; ix1 += 2)
+         {
+            INodeVector inv;
+            inv.push_back(ix1);
+            inv.push_back(ix2);
+            inv.push_back(ix3);
+            //inodes.insert(inv);
+            inodes.push_back(inv);
+         }
+      }
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+void FineToCoarseNodeSetBlock3DConnector::findCFCells()
+{
+   using namespace D3Q27System;
+
+   int lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3;
+
+   //////////////////////////////////////////////////////
+   //Debug
+   //////////////////////////////////////////////////////
+   if (block.lock()->getGlobalID() == 2183)
+   {
+      int test = 0;
+   }
+
+   switch (sendDir)
+   {
+      //faces
+   case E: case W:
+      if (sendDir == E)
+      {
+         lMinX1 = maxX1 - 3;
+         lMaxX1 = lMinX1;
+      }
+      else if (sendDir == W)
+      {
+         lMinX1 = 2;
+         lMaxX1 = lMinX1;
+      }
+
+      if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type00)
+      {
+         lMinX2 = minX2;
+         lMaxX2 = maxX2 + maxOffX2 - 1;
+         lMinX3 = minX3;
+         lMaxX3 = maxX3 + maxOffX3 - 1;
+      }
+      else if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type10)
+      {
+         lMinX2 = minX2 + minOffX2;
+         lMaxX2 = maxX2 - 1;
+         lMinX3 = minX3;
+         lMaxX3 = maxX3 + maxOffX3 - 1;
+      }
+      else if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type01)
+      {
+         lMinX2 = minX2;
+         lMaxX2 = maxX2 + maxOffX2 - 1;
+         lMinX3 = minX3 + minOffX3;
+         lMaxX3 = maxX3 - 1;
+      }
+      else if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type11)
+      {
+         lMinX2 = minX2 + minOffX2;
+         lMaxX2 = maxX2 - 1;
+         lMinX3 = minX3 + minOffX3;
+         lMaxX3 = maxX3 - 1;
+      }
+      findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetReceiver);
+      break;
+   case N: case S:
+      if (sendDir == N)
+      {
+         lMinX2 = maxX2 - 3;
+         lMaxX2 = lMinX2;
+      }
+      else if (sendDir == S)
+      {
+         lMinX2 = 2;
+         lMaxX2 = lMinX2;
+      }
+
+      if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type00)
+      {
+         lMinX1 = minX1;
+         lMaxX1 = maxX1 + maxOffX1 - 1;
+         lMinX3 = minX3;
+         lMaxX3 = maxX3 + maxOffX3 - 1;
+      }
+      else if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type10)
+      {
+         lMinX1 = minX1 + minOffX1;
+         lMaxX1 = maxX1;
+         lMinX3 = minX3;
+         lMaxX3 = maxX3 + maxOffX3 - 1;
+      }
+      else if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type01)
+      {
+         lMinX1 = minX1;
+         lMaxX1 = maxX1 + maxOffX1 - 1;
+         lMinX3 = minX3 + minOffX3;
+         lMaxX3 = maxX3 - 1;
+      }
+      else if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type11)
+      {
+         lMinX1 = minX1 + minOffX1;
+         lMaxX1 = maxX1 - 1;
+         lMinX3 = minX3 + minOffX3;
+         lMaxX3 = maxX3 - 1;
+      }
+      findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetReceiver);
+      break;
+   case T: case B:
+      if (sendDir == T)
+      {
+         lMinX3 = maxX3 - 3;
+         lMaxX3 = lMinX3;
+      }
+      else if (sendDir == B)
+      {
+         lMinX3 = 2;
+         lMaxX3 = lMinX3;
+      }
+
+      if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type00)
+      {
+         lMinX1 = minX1;
+         lMaxX1 = maxX1 + maxOffX1 - 1;
+         lMinX2 = minX2;
+         lMaxX2 = maxX2 + maxOffX2 - 1;
+      }
+      else if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type10)
+      {
+         lMinX1 = minX1 + minOffX1;
+         lMaxX1 = maxX1 - 1;
+         lMinX2 = minX2;
+         lMaxX2 = maxX2 + maxOffX2 - 1;
+      }
+      else if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type01)
+      {
+         lMinX1 = minX1;
+         lMaxX1 = maxX1 + maxOffX1 - 1;
+         lMinX2 = minX2 + minOffX2;
+         lMaxX2 = maxX2 - 1;
+      }
+      else if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type11)
+      {
+         lMinX1 = minX1 + minOffX1;
+         lMaxX1 = maxX1 - 1;
+         lMinX2 = minX2 + minOffX2;
+         lMaxX2 = maxX2 - 1;
+      }
+      findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetReceiver);
+      break;
+
+      //edges
+      //N-S-E-W
+   case NE: case SW: case SE: case NW:
+      if (sendDir == NE)
+      {
+         lMinX1 = maxX1 - 3;
+         lMaxX1 = lMinX1 + 2;
+         lMinX2 = maxX2 - 3;
+         lMaxX2 = lMinX2 + 2;
+      }
+      else if (sendDir == SW)
+      {
+         lMinX1 = 0;
+         lMaxX1 = lMinX1 + 3;
+         lMinX2 = 0;
+         lMaxX2 = lMinX2 + 3;
+      }
+      else if (sendDir == SE)
+      {
+         lMinX1 = maxX1 - 3;
+         lMaxX1 = lMinX1 + 2;
+         lMinX2 = 0;
+         lMaxX2 = lMinX2 + 2;
+      }
+      else if (sendDir == NW)
+      {
+         lMinX1 = 0;
+         lMaxX1 = lMinX1 + 2;
+         lMinX2 = maxX2 - 3;
+         lMaxX2 = lMinX2 + 2;
+      }
+
+      if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type00)
+      {
+         lMinX3 = minX3;
+         lMaxX3 = maxX3 + maxOffX3 - 1;
+      }
+      else if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type10)
+      {
+         lMinX3 = minX3 + minOffX3;
+         lMaxX3 = maxX3 - 1;
+      }
+
+      findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetReceiver);
+      break;
+      //T-B-E-W
+   case TE: case BW: case BE: case TW:
+      if (sendDir == TE)
+      {
+         lMinX1 = maxX1 - 3;
+         lMaxX1 = lMinX1 + 2;
+         lMinX3 = maxX3 - 3;
+         lMaxX3 = lMinX3 + 2;
+      }
+      else if (sendDir == BW)
+      {
+         lMinX1 = 0;
+         lMaxX1 = lMinX1 + 2;
+         lMinX3 = 0;
+         lMaxX3 = lMinX3 + 2;
+      }
+      else if (sendDir == BE)
+      {
+         lMinX1 = maxX1 - 3;
+         lMaxX1 = lMinX1 + 2;
+         lMinX3 = 0;
+         lMaxX3 = lMinX3 + 2;
+      }
+      else if (sendDir == TW)
+      {
+         lMinX1 = 0;
+         lMaxX1 = lMinX1 + 2;
+         lMinX3 = maxX3 - 3;
+         lMaxX3 = lMinX3 + 2;
+      }
+
+      if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type00)
+      {
+         lMinX2 = minX2;
+         lMaxX2 = maxX2 + maxOffX2 - 1;
+      }
+      else if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type10)
+      {
+         lMinX2 = minX2 + minOffX2;
+         lMaxX2 = maxX2 - 1;
+      }
+
+      findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetReceiver);
+      break;
+      //T-B-N-S
+   case TN: case BS: case BN: case TS:
+      if (sendDir == TN)
+      {
+         lMinX2 = maxX2 - 3;
+         lMaxX2 = lMinX2 + 2;
+         lMinX3 = maxX3 - 3;
+         lMaxX3 = lMinX3 + 2;
+      }
+      else if (sendDir == BS)
+      {
+         lMinX2 = 0;
+         lMaxX2 = lMinX2 + 2;
+         lMinX3 = 0;
+         lMaxX3 = lMinX3 + 2;
+      }
+      else if (sendDir == BN)
+      {
+         lMinX2 = maxX2 - 3;
+         lMaxX2 = lMinX2 + 2;
+         lMinX3 = 0;
+         lMaxX3 = lMinX3 + 2;
+      }
+      else if (sendDir == TS)
+      {
+         lMinX2 = 0;
+         lMaxX2 = lMinX2 + 2;
+         lMinX3 = maxX3 - 3;
+         lMaxX3 = lMinX3 + 2;
+      }
+
+      if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type00)
+      {
+         lMinX1 = minX1;
+         lMaxX1 = maxX1 + maxOffX1 - 1;
+      }
+      else if (FineToCoarseBlock3DConnector::connType ==FineToCoarseBlock3DConnector::Type10)
+      {
+         lMinX1 = minX1 + minOffX1;
+         lMaxX1 = maxX1 - 1;
+      }
+
+      findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetReceiver);
+      break;
+      //corners
+   case TNE: case TNW: case TSE: case TSW: case BNE: case BNW: case BSE: case BSW:
+      if (sendDir == TNE)
+      {
+         lMinX1 = maxX1 - 3;
+         lMaxX1 = maxX1 - 1;
+         lMinX2 = maxX2 - 3;
+         lMaxX2 = maxX2 - 1;
+         lMinX3 = maxX3 - 3;
+         lMaxX3 = maxX3 - 1;
+      }
+      else if (sendDir == TNW)
+      {
+         lMinX1 = 0;
+         lMaxX1 = 2;
+         lMinX2 = maxX2 - 3;
+         lMaxX2 = maxX2 - 1;
+         lMinX3 = maxX3 - 3;
+         lMaxX3 = maxX3 - 1;
+      }
+      else if (sendDir == TSE)
+      {
+         lMinX1 = maxX1 - 3;
+         lMaxX1 = maxX1 - 1;
+         lMinX2 = 0;
+         lMaxX2 = 2;
+         lMinX3 = maxX3 - 3;
+         lMaxX3 = maxX3 - 1;
+      }
+      else if (sendDir == TSW)
+      {
+         lMinX1 = 0;
+         lMaxX1 = 2;
+         lMinX2 = 0;
+         lMaxX2 = 2;
+         lMinX3 = maxX3 - 3;
+         lMaxX3 = maxX3 - 1;
+      }
+      else if (sendDir == BNE)
+      {
+         lMinX1 = maxX1 - 3;
+         lMaxX1 = maxX1 - 1;
+         lMinX2 = maxX2 - 3;
+         lMaxX2 = maxX2 - 1;
+         lMinX3 = 0;
+         lMaxX3 = 2;
+      }
+      else if (sendDir == BNW)
+      {
+         lMinX1 = 0;
+         lMaxX1 = 2;
+         lMinX2 = maxX2 - 3;
+         lMaxX2 = maxX2 - 1;
+         lMinX3 = 0;
+         lMaxX3 = 2;
+      }
+      else if (sendDir == BSE)
+      {
+         lMinX1 = maxX1 - 3;
+         lMaxX1 = maxX1 - 1;
+         lMinX2 = 0;
+         lMaxX2 = 2;
+         lMinX3 = 0;
+         lMaxX3 = 2;
+      }
+      else if (sendDir == BSW)
+      {
+         lMinX1 = 0;
+         lMaxX1 = 2;
+         lMinX2 = 0;
+         lMaxX2 = 2;
+         lMinX3 = 0;
+         lMaxX3 = 2;
+      }
+      findCFCells(lMinX1, lMinX2, lMinX3, lMaxX1, lMaxX2, lMaxX3, iNodeSetReceiver);
+      break;
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+void FineToCoarseNodeSetBlock3DConnector::distributeReceiveVectors()
+{
+   using namespace D3Q27System;
+
+   SPtr<DistributionArray3D>  fTo = FineToCoarseBlock3DConnector::block.lock()->getKernel()->getDataSet()->getFdistributions();
+
+   int index = 0;
+
+   vector_type& data = this->receiver->getData();
+
+   for(INodeVector  inode : iNodeSetReceiver)
+   {
+      D3Q27ICell icellF;
+      this->readICellFfromData(data, index, icellF);
+      iprocessor->writeICellInv(fTo, icellF, inode[0], inode[1], inode[2]);
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+//
+//void FineToCoarseNodeSetBlock3DConnector::getLocalMinMax(int& minX1, int& minX2, int& minX3, int& maxX1, int& maxX2, int& maxX3)
+//{
+//   using namespace D3Q27System;
+//   int TminX1 = minX1; int TminX2 = minX2; int TminX3 = minX3; int TmaxX1 = maxX1; int TmaxX2 = maxX2; int TmaxX3 = maxX3;
+//
+//   if (block.lock()->hasInterpolationFlagFC(E))
+//   {
+//      if (maxX1==TmaxX1) maxX1 -= 2;
+//   }
+//   if (block.lock()->hasInterpolationFlagFC(W))
+//   {
+//      if (minX1==TminX1) minX1 += 4;
+//   }
+//   if (block.lock()->hasInterpolationFlagFC(N))
+//   {
+//      if (maxX2==TmaxX2) maxX2 -= 2;
+//   }
+//   if (block.lock()->hasInterpolationFlagFC(S))
+//   {
+//      if (minX2==TminX2) minX2 += 4;
+//   }
+//   if (block.lock()->hasInterpolationFlagFC(T))
+//   {
+//      if (maxX3==TmaxX3) maxX3 -= 2;
+//   }
+//   if (block.lock()->hasInterpolationFlagFC(B))
+//   {
+//      if (minX3==TminX3) minX3 += 4;
+//   }
+//
+//   ////////////
+//   /////E-W-N-S
+//   if (block.lock()->hasInterpolationFlagFC(NE)&& !block.lock()->hasInterpolationFlagFC(N) && !block.lock()->hasInterpolationFlagFC(E))
+//   {
+//      if (maxX1==TmaxX1) maxX1 -= 2;
+//      if (maxX2==TmaxX2) maxX2 -= 2;
+//   }
+//   if (block.lock()->hasInterpolationFlagFC(SW)&& !block.lock()->hasInterpolationFlagFC(W) && !block.lock()->hasInterpolationFlagFC(S))
+//   {
+//      if (minX1==TminX1) minX1 += 4;
+//      if (minX2==TminX2) minX2 += 4;
+//   }
+//   if (block.lock()->hasInterpolationFlagFC(SE)&& !block.lock()->hasInterpolationFlagFC(E) && !block.lock()->hasInterpolationFlagFC(S))
+//   {
+//      if (maxX1==TmaxX1) maxX1 -= 2;
+//      if (minX2==TminX2) minX2 += 4;
+//   }
+//   if (block.lock()->hasInterpolationFlagFC(NW)&& !block.lock()->hasInterpolationFlagFC(N) && !block.lock()->hasInterpolationFlagFC(W))
+//   {
+//      if (minX1==TminX1) minX1 += 4;
+//      if (maxX2==TmaxX2) maxX2 -= 2;
+//   }
+//
+//   //////T-B-E-W
+//   if (block.lock()->hasInterpolationFlagFC(TE) && !block.lock()->hasInterpolationFlagFC(E) && !block.lock()->hasInterpolationFlagFC(T))
+//   {
+//      if (maxX1==TmaxX1) maxX1 -= 2;
+//      if (maxX3==TmaxX3) maxX3 -= 2;
+//   }
+//   if (block.lock()->hasInterpolationFlagFC(BW)&& !block.lock()->hasInterpolationFlagFC(W) && !block.lock()->hasInterpolationFlagFC(B))
+//   {
+//      if (minX1==TminX1) minX1 += 4;
+//      if (minX3==TminX3) minX3 += 4;
+//   }
+//   if (block.lock()->hasInterpolationFlagFC(BE)&& !block.lock()->hasInterpolationFlagFC(E) && !block.lock()->hasInterpolationFlagFC(B))
+//   {
+//      if (maxX1==TmaxX1) maxX1 -= 2;
+//      if (minX3==TminX3) minX3 += 4;
+//   }
+//   if (block.lock()->hasInterpolationFlagFC(TW)&& !block.lock()->hasInterpolationFlagFC(W) && !block.lock()->hasInterpolationFlagFC(T))
+//   {
+//      if (minX1==TminX1) minX1 += 4;
+//      if (maxX3==TmaxX3) maxX3 -= 2;
+//   }
+//
+//
+//   ////T-B-N-S
+//   if (block.lock()->hasInterpolationFlagFC(TN)&& !block.lock()->hasInterpolationFlagFC(N) && !block.lock()->hasInterpolationFlagFC(T))
+//   {
+//      if (maxX2==TmaxX2) maxX2 -= 2;
+//      if (maxX3==TmaxX3) maxX3 -= 2;
+//   }
+//   if (block.lock()->hasInterpolationFlagFC(BS)&& !block.lock()->hasInterpolationFlagFC(S) && !block.lock()->hasInterpolationFlagFC(B))
+//   {
+//      if (minX2==TminX2) minX2 += 4;
+//      if (minX3==TminX3) minX3 += 4;
+//   }
+//   if (block.lock()->hasInterpolationFlagFC(BN)&& !block.lock()->hasInterpolationFlagFC(N) && !block.lock()->hasInterpolationFlagFC(B))
+//   {
+//      if (maxX2==TmaxX2) maxX2 -= 2;
+//      if (minX3==TminX3) minX3 += 4;
+//   }
+//   if (block.lock()->hasInterpolationFlagFC(TS) && !block.lock()->hasInterpolationFlagFC(S) && !block.lock()->hasInterpolationFlagFC(T))
+//   {
+//      if (minX2==TminX2) minX2 += 4;
+//      if (maxX3==TmaxX3) maxX3 -= 2;
+//   }
+//}
+//////////////////////////////////////////////////////////////////////////
+
diff --git a/src/cpu/VirtualFluidsCore/Connectors/FineToCoarseNodeSetBlock3DConnector.h b/src/cpu/VirtualFluidsCore/Connectors/FineToCoarseNodeSetBlock3DConnector.h
index 1f4051a668b682e2cce41274fd25818fdfba5d40..899f91e2cda6d74064ef1cf5999771e7c54816f9 100644
--- a/src/cpu/VirtualFluidsCore/Connectors/FineToCoarseNodeSetBlock3DConnector.h
+++ b/src/cpu/VirtualFluidsCore/Connectors/FineToCoarseNodeSetBlock3DConnector.h
@@ -1,78 +1,78 @@
-/// \file CoarseToFineNodeSetBlock3DConnector.h
-/// \class CoarseToFineNodeSetBlock3DConnector
-/// \brief Connector interpolates and sends data from coarse level to fine.  
-/// \author Konstantin Kutscher
-/// \date 21.05.2015
-
-#ifndef FineToCoarseNodeSetBlock3DConnector_H
-#define FineToCoarseNodeSetBlock3DConnector_H
-
-#include <vector>
-#include "FineToCoarseBlock3DConnector.h"
-#include "D3Q27System.h"
-#include "Block3D.h"
-#include "Grid3D.h"
-#include "LBMKernel.h"
-#include "InterpolationProcessor.h"
-#include "MathUtil.hpp"
-#include <PointerDefinitions.h>
-
-
-class Block3D;
-
-//daten werden in einen vector (dieser befindet sich im transmitter) kopiert
-//der vector wird via transmitter uebertragen
-//transmitter kann ein lokal, MPI, RCG, CTL oder was auch immer fuer ein
-//transmitter sein, der von Transmitter abgeleitet ist ;-)
-
-class FineToCoarseNodeSetBlock3DConnector : public FineToCoarseBlock3DConnector
-{
-public:
-   FineToCoarseNodeSetBlock3DConnector(SPtr<Block3D> block, VectorTransmitterPtr sender, VectorTransmitterPtr receiver, int sendDir, InterpolationProcessorPtr iprocessor, CFconnectorType connType);
-   void init();
-   void fillSendVectors();
-   void distributeReceiveVectors();
-protected:
-   typedef std::vector< int > INodeVector;
-   typedef std::vector < INodeVector > INodeSet;
-   INodeSet  iNodeSetSender;
-   INodeSet  iNodeSetReceiver;
-
-   void readICellFfromData(vector_type& data, int& index, D3Q27ICell& icellF);
-   void readNodeFromVector(vector_type& data, int& index, LBMReal* inode);
-
-   void writeICellCtoData(vector_type& data, int& index, LBMReal* icellC);
-
-   void findFCCells();
-   void findFCCells(int lMinX1, int lMinX2, int lMinX3, int lMaxX1, int lMaxX2, int lMaxX3, INodeSet &inodes);
-
-   void findCFCells();
-   void findCFCells(int lMinX1, int lMinX2, int lMinX3, int lMaxX1, int lMaxX2, int lMaxX3, INodeSet &inodes);
-
-   //void getLocalMinMax(int& minX1, int& minX2, int& minX3, int& maxX1, int& maxX2, int& maxX3);
-
-
-   int bMaxX1, bMaxX2, bMaxX3;
-   
-   int minX1;
-   int minX2;
-   int minX3;
-
-   int maxX1;
-   int maxX2;
-   int maxX3;
-
-   int minOffX1;
-   int minOffX2;
-   int minOffX3;
-
-   int maxOffX1;
-   int maxOffX2;
-   int maxOffX3;
-};
-
-
-
-
-
-#endif
+/// \file CoarseToFineNodeSetBlock3DConnector.h
+/// \class CoarseToFineNodeSetBlock3DConnector
+/// \brief Connector interpolates and sends data from coarse level to fine.  
+/// \author Konstantin Kutscher
+/// \date 21.05.2015
+
+#ifndef FineToCoarseNodeSetBlock3DConnector_H
+#define FineToCoarseNodeSetBlock3DConnector_H
+
+#include <vector>
+#include "FineToCoarseBlock3DConnector.h"
+#include "D3Q27System.h"
+#include "Block3D.h"
+#include "Grid3D.h"
+#include "LBMKernel.h"
+#include "InterpolationProcessor.h"
+#include "MathUtil.hpp"
+#include <PointerDefinitions.h>
+
+
+class Block3D;
+
+//daten werden in einen vector (dieser befindet sich im transmitter) kopiert
+//der vector wird via transmitter uebertragen
+//transmitter kann ein lokal, MPI, RCG, CTL oder was auch immer fuer ein
+//transmitter sein, der von Transmitter abgeleitet ist ;-)
+
+class FineToCoarseNodeSetBlock3DConnector : public FineToCoarseBlock3DConnector
+{
+public:
+   FineToCoarseNodeSetBlock3DConnector(SPtr<Block3D> block, VectorTransmitterPtr sender, VectorTransmitterPtr receiver, int sendDir, InterpolationProcessorPtr iprocessor, CFconnectorType connType);
+   void init();
+   void fillSendVectors();
+   void distributeReceiveVectors();
+protected:
+   typedef std::vector< int > INodeVector;
+   typedef std::vector < INodeVector > INodeSet;
+   INodeSet  iNodeSetSender;
+   INodeSet  iNodeSetReceiver;
+
+   void readICellFfromData(vector_type& data, int& index, D3Q27ICell& icellF);
+   void readNodeFromVector(vector_type& data, int& index, LBMReal* inode);
+
+   void writeICellCtoData(vector_type& data, int& index, LBMReal* icellC);
+
+   void findFCCells();
+   void findFCCells(int lMinX1, int lMinX2, int lMinX3, int lMaxX1, int lMaxX2, int lMaxX3, INodeSet &inodes);
+
+   void findCFCells();
+   void findCFCells(int lMinX1, int lMinX2, int lMinX3, int lMaxX1, int lMaxX2, int lMaxX3, INodeSet &inodes);
+
+   //void getLocalMinMax(int& minX1, int& minX2, int& minX3, int& maxX1, int& maxX2, int& maxX3);
+
+
+   int bMaxX1, bMaxX2, bMaxX3;
+   
+   int minX1;
+   int minX2;
+   int minX3;
+
+   int maxX1;
+   int maxX2;
+   int maxX3;
+
+   int minOffX1;
+   int minOffX2;
+   int minOffX3;
+
+   int maxOffX1;
+   int maxOffX2;
+   int maxOffX3;
+};
+
+
+
+
+
+#endif
diff --git a/src/cpu/VirtualFluidsCore/Connectors/LocalBlock3DConnector.h b/src/cpu/VirtualFluidsCore/Connectors/LocalBlock3DConnector.h
index efa1ce73e772e848928fcd322371d4ffcb1795f8..93bb6536d26020a55ad93ad379820ca0266e816d 100644
--- a/src/cpu/VirtualFluidsCore/Connectors/LocalBlock3DConnector.h
+++ b/src/cpu/VirtualFluidsCore/Connectors/LocalBlock3DConnector.h
@@ -1,92 +1,92 @@
-//=======================================================================================
-// ____          ____    __    ______     __________   __      __       __        __         
-// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
-//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
-//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
-//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
-//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
-//      \    \  |    |   ________________________________________________________________    
-//       \    \ |    |  |  ______________________________________________________________|   
-//        \    \|    |  |  |         __          __     __     __     ______      _______    
-//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
-//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
-//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
-//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
-//
-//  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 LocalBlock3DConnector.h
-//! \ingroup Connectors
-//! \author Konstantin Kutscher
-//=======================================================================================
-
-#ifndef LocalBlock3DConnector_H
-#define LocalBlock3DConnector_H
-
-#include "Block3DConnector.h"
-#include "Block3D.h"
-#include "PointerDefinitions.h"
-
-//! A class provides an interface for connectors in shared memory
-class LocalBlock3DConnector : public Block3DConnector
-{
-public:
-   LocalBlock3DConnector(SPtr<Block3D> from, SPtr<Block3D> to, int sendDir)
-      : Block3DConnector(sendDir)
-      , from(from)
-      , to(to)
-   {
-
-   }
-   virtual ~LocalBlock3DConnector() {}
-   void sendTransmitterDataSize() {}
-   void receiveTransmitterDataSize() {}
-   virtual void init() = 0;
-   void prepareForReceive() {}
-   void prepareForSend() {}
-   void fillSendVectors() {}
-   virtual void sendVectors()=0;
-   void receiveVectors() {}
-
-   void distributeReceiveVectors() {}
-
-   bool isLocalConnector() { return true; }
-   bool isRemoteConnector() { return false; }
-   bool isInterpolationConnectorCF() { return false; }
-   bool isInterpolationConnectorFC() { return false; }
-
-   double getSendRecieveTime();
-
-   void prepareForSendX1() {}
-   void prepareForSendX2() {}
-   void prepareForSendX3() {}
-
-   void sendVectorsX1() {}
-   void sendVectorsX2() {}
-   void sendVectorsX3() {}
-
-   void prepareForReceiveX1() {}
-   void prepareForReceiveX2() {}
-   void prepareForReceiveX3() {}
-
-   void receiveVectorsX1() {}
-   void receiveVectorsX2() {}
-   void receiveVectorsX3() {}
-
-protected:
-   WPtr<Block3D> from;
-   WPtr<Block3D> to;
-};
-
-#endif //LocalBlock3DConnector_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 LocalBlock3DConnector.h
+//! \ingroup Connectors
+//! \author Konstantin Kutscher
+//=======================================================================================
+
+#ifndef LocalBlock3DConnector_H
+#define LocalBlock3DConnector_H
+
+#include "Block3DConnector.h"
+#include "Block3D.h"
+#include "PointerDefinitions.h"
+
+//! A class provides an interface for connectors in shared memory
+class LocalBlock3DConnector : public Block3DConnector
+{
+public:
+   LocalBlock3DConnector(SPtr<Block3D> from, SPtr<Block3D> to, int sendDir)
+      : Block3DConnector(sendDir)
+      , from(from)
+      , to(to)
+   {
+
+   }
+   virtual ~LocalBlock3DConnector() {}
+   void sendTransmitterDataSize() {}
+   void receiveTransmitterDataSize() {}
+   virtual void init() = 0;
+   void prepareForReceive() {}
+   void prepareForSend() {}
+   void fillSendVectors() {}
+   virtual void sendVectors()=0;
+   void receiveVectors() {}
+
+   void distributeReceiveVectors() {}
+
+   bool isLocalConnector() { return true; }
+   bool isRemoteConnector() { return false; }
+   bool isInterpolationConnectorCF() { return false; }
+   bool isInterpolationConnectorFC() { return false; }
+
+   double getSendRecieveTime();
+
+   void prepareForSendX1() {}
+   void prepareForSendX2() {}
+   void prepareForSendX3() {}
+
+   void sendVectorsX1() {}
+   void sendVectorsX2() {}
+   void sendVectorsX3() {}
+
+   void prepareForReceiveX1() {}
+   void prepareForReceiveX2() {}
+   void prepareForReceiveX3() {}
+
+   void receiveVectorsX1() {}
+   void receiveVectorsX2() {}
+   void receiveVectorsX3() {}
+
+protected:
+   WPtr<Block3D> from;
+   WPtr<Block3D> to;
+};
+
+#endif //LocalBlock3DConnector_H
diff --git a/src/cpu/VirtualFluidsCore/Connectors/RemoteBlock3DConnector.cpp b/src/cpu/VirtualFluidsCore/Connectors/RemoteBlock3DConnector.cpp
index 388df6c2aa3ce4af3018e923d5560ece9cd8b9c2..e7adf6a63f95407ebf7f7617920131c2f3d63fa3 100644
--- a/src/cpu/VirtualFluidsCore/Connectors/RemoteBlock3DConnector.cpp
+++ b/src/cpu/VirtualFluidsCore/Connectors/RemoteBlock3DConnector.cpp
@@ -1,64 +1,64 @@
-#include "RemoteBlock3DConnector.h"
-
-//////////////////////////////////////////////////////////////////////////
-RemoteBlock3DConnector::RemoteBlock3DConnector(SPtr<Block3D> block
-   , VectorTransmitterPtr sender
-   , VectorTransmitterPtr receiver
-   , int sendDir)
-   : Block3DConnector(sendDir)
-   , block(block)
-   , sender(sender)
-   , receiver(receiver)
-{
-   if (!block || !sender || !receiver)
-      UB_THROW(UbException(UB_EXARGS, "sender or receiver == NULL!!"));
-}
-//////////////////////////////////////////////////////////////////////////
-
-bool RemoteBlock3DConnector::isLocalConnector()
-{
-   return !this->isRemoteConnector();
-}
-//////////////////////////////////////////////////////////////////////////
-
-bool RemoteBlock3DConnector::isRemoteConnector()
-{
-   return ((sender && sender->isRemoteTransmitter())
-      || (receiver && receiver->isRemoteTransmitter()));
-}
-//////////////////////////////////////////////////////////////////////////
-
-void RemoteBlock3DConnector::sendTransmitterDataSize()
-{
-   assert(sender  !=NULL); sender->sendDataSize();
-}
-//////////////////////////////////////////////////////////////////////////
-
-void RemoteBlock3DConnector::receiveTransmitterDataSize()
-{
-   assert(receiver!=NULL); receiver->receiveDataSize();
-}
-//////////////////////////////////////////////////////////////////////////
-
-void RemoteBlock3DConnector::prepareForSend()
-{
-   assert(sender  !=NULL); sender->prepareForSend();
-}
-//////////////////////////////////////////////////////////////////////////
-
-void RemoteBlock3DConnector::sendVectors()
-{
-   assert(sender  !=NULL); sender->sendData();
-}
-//////////////////////////////////////////////////////////////////////////
-
-void RemoteBlock3DConnector::prepareForReceive()
-{
-   assert(receiver!=NULL); receiver->prepareForReceive();
-}
-//////////////////////////////////////////////////////////////////////////
-
-void RemoteBlock3DConnector::receiveVectors()
-{
-   assert(receiver!=NULL); receiver->receiveData();
-}
+#include "RemoteBlock3DConnector.h"
+
+//////////////////////////////////////////////////////////////////////////
+RemoteBlock3DConnector::RemoteBlock3DConnector(SPtr<Block3D> block
+   , VectorTransmitterPtr sender
+   , VectorTransmitterPtr receiver
+   , int sendDir)
+   : Block3DConnector(sendDir)
+   , block(block)
+   , sender(sender)
+   , receiver(receiver)
+{
+   if (!block || !sender || !receiver)
+      UB_THROW(UbException(UB_EXARGS, "sender or receiver == NULL!!"));
+}
+//////////////////////////////////////////////////////////////////////////
+
+bool RemoteBlock3DConnector::isLocalConnector()
+{
+   return !this->isRemoteConnector();
+}
+//////////////////////////////////////////////////////////////////////////
+
+bool RemoteBlock3DConnector::isRemoteConnector()
+{
+   return ((sender && sender->isRemoteTransmitter())
+      || (receiver && receiver->isRemoteTransmitter()));
+}
+//////////////////////////////////////////////////////////////////////////
+
+void RemoteBlock3DConnector::sendTransmitterDataSize()
+{
+   assert(sender  !=NULL); sender->sendDataSize();
+}
+//////////////////////////////////////////////////////////////////////////
+
+void RemoteBlock3DConnector::receiveTransmitterDataSize()
+{
+   assert(receiver!=NULL); receiver->receiveDataSize();
+}
+//////////////////////////////////////////////////////////////////////////
+
+void RemoteBlock3DConnector::prepareForSend()
+{
+   assert(sender  !=NULL); sender->prepareForSend();
+}
+//////////////////////////////////////////////////////////////////////////
+
+void RemoteBlock3DConnector::sendVectors()
+{
+   assert(sender  !=NULL); sender->sendData();
+}
+//////////////////////////////////////////////////////////////////////////
+
+void RemoteBlock3DConnector::prepareForReceive()
+{
+   assert(receiver!=NULL); receiver->prepareForReceive();
+}
+//////////////////////////////////////////////////////////////////////////
+
+void RemoteBlock3DConnector::receiveVectors()
+{
+   assert(receiver!=NULL); receiver->receiveData();
+}
diff --git a/src/cpu/VirtualFluidsCore/Connectors/RemoteBlock3DConnector.h b/src/cpu/VirtualFluidsCore/Connectors/RemoteBlock3DConnector.h
index 8db7d5ee760a33ab899b3dc5929e62e30d3e3bf7..0956604accf41cc089ec034c27ae10120768847f 100644
--- a/src/cpu/VirtualFluidsCore/Connectors/RemoteBlock3DConnector.h
+++ b/src/cpu/VirtualFluidsCore/Connectors/RemoteBlock3DConnector.h
@@ -1,72 +1,72 @@
-#ifndef RemoteBlock3DConnector_H
-#define RemoteBlock3DConnector_H
-
-#include <vector>
-
-#include "TransmitterType.h"
-#include "Block3DConnector.h"
-#include "D3Q27System.h"
-#include "Block3D.h"
-#include "LBMKernel.h"
-#include "EsoTwistD3Q27System.h"
-
-
-//daten werden in einen vector (dieser befindet sich im transmitter) kopiert
-//der vector wird via transmitter uebertragen
-//transmitter kann ein lokal, MPI, RCG, CTL oder was auch immer fuer ein
-//transmitter sein, der von Transmitter abgeleitet ist ;-)
-class RemoteBlock3DConnector : public Block3DConnector
-{
-public:
-   RemoteBlock3DConnector(SPtr<Block3D> block
-      , VectorTransmitterPtr sender
-      , VectorTransmitterPtr receiver
-      , int sendDir);
-
-   bool isLocalConnector();
-   bool isRemoteConnector();
-
-   virtual void init() = 0;
-
-   void sendTransmitterDataSize();
-   void receiveTransmitterDataSize();
-
-   void prepareForSend();
-   void sendVectors();
-
-   void prepareForReceive();
-   void receiveVectors();
-
-   virtual void fillSendVectors() = 0;
-   virtual void distributeReceiveVectors() = 0;
-
-   bool isInterpolationConnectorCF() { return false; }
-   bool isInterpolationConnectorFC() { return false; }
-
-   double getSendRecieveTime() { return 0; }
-
-   void prepareForSendX1() {}
-   void prepareForSendX2() {}
-   void prepareForSendX3() {}
-
-   void sendVectorsX1() {}
-   void sendVectorsX2() {}
-   void sendVectorsX3() {}
-
-   void prepareForReceiveX1() {}
-   void prepareForReceiveX2() {}
-   void prepareForReceiveX3() {}
-
-   void receiveVectorsX1() {}
-   void receiveVectorsX2() {}
-   void receiveVectorsX3() {}
-
-protected:
-   WPtr<Block3D> block; 
-   VectorTransmitterPtr sender;
-   VectorTransmitterPtr receiver;
-};
-
-
-#endif //RemoteBlock3DConnector_H
-
+#ifndef RemoteBlock3DConnector_H
+#define RemoteBlock3DConnector_H
+
+#include <vector>
+
+#include "TransmitterType.h"
+#include "Block3DConnector.h"
+#include "D3Q27System.h"
+#include "Block3D.h"
+#include "LBMKernel.h"
+#include "EsoTwistD3Q27System.h"
+
+
+//daten werden in einen vector (dieser befindet sich im transmitter) kopiert
+//der vector wird via transmitter uebertragen
+//transmitter kann ein lokal, MPI, RCG, CTL oder was auch immer fuer ein
+//transmitter sein, der von Transmitter abgeleitet ist ;-)
+class RemoteBlock3DConnector : public Block3DConnector
+{
+public:
+   RemoteBlock3DConnector(SPtr<Block3D> block
+      , VectorTransmitterPtr sender
+      , VectorTransmitterPtr receiver
+      , int sendDir);
+
+   bool isLocalConnector();
+   bool isRemoteConnector();
+
+   virtual void init() = 0;
+
+   void sendTransmitterDataSize();
+   void receiveTransmitterDataSize();
+
+   void prepareForSend();
+   void sendVectors();
+
+   void prepareForReceive();
+   void receiveVectors();
+
+   virtual void fillSendVectors() = 0;
+   virtual void distributeReceiveVectors() = 0;
+
+   bool isInterpolationConnectorCF() { return false; }
+   bool isInterpolationConnectorFC() { return false; }
+
+   double getSendRecieveTime() { return 0; }
+
+   void prepareForSendX1() {}
+   void prepareForSendX2() {}
+   void prepareForSendX3() {}
+
+   void sendVectorsX1() {}
+   void sendVectorsX2() {}
+   void sendVectorsX3() {}
+
+   void prepareForReceiveX1() {}
+   void prepareForReceiveX2() {}
+   void prepareForReceiveX3() {}
+
+   void receiveVectorsX1() {}
+   void receiveVectorsX2() {}
+   void receiveVectorsX3() {}
+
+protected:
+   WPtr<Block3D> block; 
+   VectorTransmitterPtr sender;
+   VectorTransmitterPtr receiver;
+};
+
+
+#endif //RemoteBlock3DConnector_H
+
diff --git a/src/cpu/VirtualFluidsCore/Connectors/TransmitterType.h b/src/cpu/VirtualFluidsCore/Connectors/TransmitterType.h
index a68d3c5fadf5e9ca5ebafba39ddd863242a4a516..851854dffa54f074c8c2a303841b1139589b84c3 100644
--- a/src/cpu/VirtualFluidsCore/Connectors/TransmitterType.h
+++ b/src/cpu/VirtualFluidsCore/Connectors/TransmitterType.h
@@ -1,16 +1,16 @@
-#ifndef TransmitterType_h__
-#define TransmitterType_h__
-
-#include "basics/transmitter/TbTransmitter.h"
-#include "basics/transmitter/TbTransmitterLocal.h"
-#include "basics/container/CbVector.h"
-#include "D3Q27System.h"
-#include <PointerDefinitions.h>
-
-
-typedef TbTransmitter< CbVector< LBMReal > > VectorTransmitter;
-typedef VectorTransmitter::value_type  vector_type;
-typedef SPtr< TbTransmitter< CbVector< LBMReal > > > VectorTransmitterPtr;
-
-#endif // TransmitterType_h__
-
+#ifndef TransmitterType_h__
+#define TransmitterType_h__
+
+#include "basics/transmitter/TbTransmitter.h"
+#include "basics/transmitter/TbTransmitterLocal.h"
+#include "basics/container/CbVector.h"
+#include "D3Q27System.h"
+#include <PointerDefinitions.h>
+
+
+typedef TbTransmitter< CbVector< LBMReal > > VectorTransmitter;
+typedef VectorTransmitter::value_type  vector_type;
+typedef SPtr< TbTransmitter< CbVector< LBMReal > > > VectorTransmitterPtr;
+
+#endif // TransmitterType_h__
+
diff --git a/src/cpu/VirtualFluidsCore/Data/D3Q27EsoTwist3DSoA.cpp b/src/cpu/VirtualFluidsCore/Data/D3Q27EsoTwist3DSoA.cpp
index a1053e787bac627681efadf1157631275148e98b..a27563d9be2a0ee18b47ca331d93191d939e0440 100644
--- a/src/cpu/VirtualFluidsCore/Data/D3Q27EsoTwist3DSoA.cpp
+++ b/src/cpu/VirtualFluidsCore/Data/D3Q27EsoTwist3DSoA.cpp
@@ -1,594 +1,594 @@
-#include "D3Q27EsoTwist3DSoA.h"
-#include <D3Q27System.h>
-#include "EsoTwistD3Q27System.h"
-
-D3Q27EsoTwist3DSoA::D3Q27EsoTwist3DSoA()
-{
-}
-//////////////////////////////////////////////////////////////////////////
-D3Q27EsoTwist3DSoA::D3Q27EsoTwist3DSoA( const size_t& nx1, const size_t& nx2, const size_t& nx3, LBMReal value )
-{
-   this->NX1 = nx1;
-   this->NX2 = nx2;
-   this->NX3 = nx3;
-
-   d.E   = CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal,IndexerX3X2X1>(nx1+1, nx2+1, nx3+1, value));
-   d.W   = CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal,IndexerX3X2X1>(nx1+1, nx2+1, nx3+1, value));
-   d.N   = CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal,IndexerX3X2X1>(nx1+1, nx2+1, nx3+1, value));
-   d.S   = CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal,IndexerX3X2X1>(nx1+1, nx2+1, nx3+1, value));
-   d.T   = CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal,IndexerX3X2X1>(nx1+1, nx2+1, nx3+1, value));
-   d.B   = CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal,IndexerX3X2X1>(nx1+1, nx2+1, nx3+1, value));
-   d.NE  = CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal,IndexerX3X2X1>(nx1+1, nx2+1, nx3+1, value));
-   d.SW  = CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal,IndexerX3X2X1>(nx1+1, nx2+1, nx3+1, value));
-   d.SE  = CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal,IndexerX3X2X1>(nx1+1, nx2+1, nx3+1, value));
-   d.NW  = CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal,IndexerX3X2X1>(nx1+1, nx2+1, nx3+1, value));
-   d.TE  = CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal,IndexerX3X2X1>(nx1+1, nx2+1, nx3+1, value));
-   d.BW  = CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal,IndexerX3X2X1>(nx1+1, nx2+1, nx3+1, value));
-   d.BE  = CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal,IndexerX3X2X1>(nx1+1, nx2+1, nx3+1, value));
-   d.TW  = CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal,IndexerX3X2X1>(nx1+1, nx2+1, nx3+1, value));
-   d.TN  = CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal,IndexerX3X2X1>(nx1+1, nx2+1, nx3+1, value));
-   d.BS  = CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal,IndexerX3X2X1>(nx1+1, nx2+1, nx3+1, value));
-   d.BN  = CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal,IndexerX3X2X1>(nx1+1, nx2+1, nx3+1, value));
-   d.TS  = CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal,IndexerX3X2X1>(nx1+1, nx2+1, nx3+1, value));
-   d.TNE = CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal,IndexerX3X2X1>(nx1+1, nx2+1, nx3+1, value));
-   d.TNW = CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal,IndexerX3X2X1>(nx1+1, nx2+1, nx3+1, value));
-   d.TSE = CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal,IndexerX3X2X1>(nx1+1, nx2+1, nx3+1, value));
-   d.TSW = CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal,IndexerX3X2X1>(nx1+1, nx2+1, nx3+1, value));
-   d.BNE = CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal,IndexerX3X2X1>(nx1+1, nx2+1, nx3+1, value));
-   d.BNW = CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal,IndexerX3X2X1>(nx1+1, nx2+1, nx3+1, value));
-   d.BSE = CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal,IndexerX3X2X1>(nx1+1, nx2+1, nx3+1, value));
-   d.BSW = CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal,IndexerX3X2X1>(nx1+1, nx2+1, nx3+1, value));
-   d.ZERO= CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal,IndexerX3X2X1>(nx1, nx2, nx3, value));
-}
-//////////////////////////////////////////////////////////////////////////
-D3Q27EsoTwist3DSoA::~D3Q27EsoTwist3DSoA()
-{
-
-}
-//////////////////////////////////////////////////////////////////////////
-void D3Q27EsoTwist3DSoA::swap()
-{
-   std::swap(d.E  , d.W  );
-   std::swap(d.N  , d.S  );
-   std::swap(d.T  , d.B  );
-   std::swap(d.NE , d.SW );
-   std::swap(d.NW , d.SE );
-   std::swap(d.TE , d.BW );
-   std::swap(d.TW , d.BE );
-   std::swap(d.TN , d.BS );
-   std::swap(d.TS , d.BN );
-   std::swap(d.TNE, d.BSW);
-   std::swap(d.TNW, d.BSE);
-   std::swap(d.TSE, d.BNW);
-   std::swap(d.TSW, d.BNE);
-}
-//////////////////////////////////////////////////////////////////////////
-void D3Q27EsoTwist3DSoA::getDistribution(LBMReal* const f, size_t x1, size_t x2, size_t x3)
-{
-   size_t x1p = x1 + 1;
-   size_t x2p = x2 + 1;
-   size_t x3p = x3 + 1;
-
-   f[D3Q27System::E]   = (*d.E)(x1,x2,x3);
-   f[D3Q27System::N]   = (*d.N)(x1,x2,x3);  
-   f[D3Q27System::T]   = (*d.T)(x1,x2,x3);
-   f[D3Q27System::NE]  = (*d.NE)(x1,x2,x3);
-   f[D3Q27System::NW]  = (*d.NW)(x1p,x2,x3);
-   f[D3Q27System::TE]  = (*d.TE)(x1,x2,x3);
-   f[D3Q27System::TW]  = (*d.TW)(x1p,x2,x3);
-   f[D3Q27System::TN]  = (*d.TN)(x1,x2,x3);
-   f[D3Q27System::TS]  = (*d.TS)(x1,x2p,x3);
-   f[D3Q27System::TNE] = (*d.TNE)(x1,x2,x3);
-   f[D3Q27System::TNW] = (*d.TNW)(x1p,x2,x3);
-   f[D3Q27System::TSE] = (*d.TSE)(x1,x2p,x3);
-   f[D3Q27System::TSW] = (*d.TSW)(x1p,x2p,x3);
-
-   f[D3Q27System::W ]  = (*d.W)(x1p,x2,x3);
-   f[D3Q27System::S ]  = (*d.S)(x1,x2p,x3);
-   f[D3Q27System::B ]  = (*d.B)(x1,x2,x3p);
-   f[D3Q27System::SW]  = (*d.SW)(x1p,x2p,x3);
-   f[D3Q27System::SE]  = (*d.SE)(x1,x2p,x3);
-   f[D3Q27System::BW]  = (*d.BW)(x1p,x2,x3p);
-   f[D3Q27System::BE]  = (*d.BE)(x1,x2,x3p);
-   f[D3Q27System::BS]  = (*d.BS)(x1,x2p,x3p);
-   f[D3Q27System::BN]  = (*d.BN)(x1,x2,x3p);
-   f[D3Q27System::BSW] = (*d.BSW)(x1p,x2p,x3p);
-   f[D3Q27System::BSE] = (*d.BSE)(x1,x2p,x3p);
-   f[D3Q27System::BNW] = (*d.BNW)(x1p,x2,x3p);
-   f[D3Q27System::BNE] = (*d.BNE)(x1,x2,x3p);
-
-   f[D3Q27System::ZERO] = (*d.ZERO)(x1,x2,x3);
-}
-//////////////////////////////////////////////////////////////////////////
-void D3Q27EsoTwist3DSoA::setDistribution(const LBMReal* const f, size_t x1, size_t x2, size_t x3)
-{
-   size_t x1p = x1 + 1;
-   size_t x2p = x2 + 1;
-   size_t x3p = x3 + 1;
-
-   (*d.E)(x1,x2,x3)     = f[D3Q27System::INV_E];
-   (*d.N)(x1,x2,x3)     = f[D3Q27System::INV_N];
-   (*d.T)(x1,x2,x3)     = f[D3Q27System::INV_T];
-   (*d.NE)(x1,x2,x3)    = f[D3Q27System::INV_NE];
-   (*d.NW)(x1p,x2,x3)   = f[D3Q27System::INV_NW];
-   (*d.TE)(x1,x2,x3)    = f[D3Q27System::INV_TE];
-   (*d.TW)(x1p,x2,x3)   = f[D3Q27System::INV_TW];
-   (*d.TN)(x1,x2,x3)    = f[D3Q27System::INV_TN];
-   (*d.TS)(x1,x2p,x3)   = f[D3Q27System::INV_TS];
-   (*d.TNE)(x1,x2,x3)   = f[D3Q27System::INV_TNE];
-   (*d.TNW)(x1p,x2,x3)  = f[D3Q27System::INV_TNW];
-   (*d.TSE)(x1,x2p,x3)  = f[D3Q27System::INV_TSE];
-   (*d.TSW)(x1p,x2p,x3) = f[D3Q27System::INV_TSW];
-
-   (*d.W)(x1p,x2,x3)     = f[D3Q27System::INV_W ];
-   (*d.S)(x1,x2p,x3)     = f[D3Q27System::INV_S ];
-   (*d.B)(x1,x2,x3p)     = f[D3Q27System::INV_B ];
-   (*d.SW)(x1p,x2p,x3)   = f[D3Q27System::INV_SW];
-   (*d.SE)(x1,x2p,x3)    = f[D3Q27System::INV_SE];
-   (*d.BW)(x1p,x2,x3p)   = f[D3Q27System::INV_BW];
-   (*d.BE)(x1,x2,x3p)    = f[D3Q27System::INV_BE];
-   (*d.BS)(x1,x2p,x3p)   = f[D3Q27System::INV_BS];
-   (*d.BN)(x1,x2,x3p)    = f[D3Q27System::INV_BN];
-   (*d.BSW)(x1p,x2p,x3p) = f[D3Q27System::INV_BSW];
-   (*d.BSE)(x1,x2p,x3p)  = f[D3Q27System::INV_BSE];
-   (*d.BNW)(x1p,x2,x3p)  = f[D3Q27System::INV_BNW];
-   (*d.BNE)(x1,x2,x3p)   = f[D3Q27System::INV_BNE];
-
-   (*d.ZERO)(x1,x2,x3) = f[D3Q27System::ZERO];
-}
-//////////////////////////////////////////////////////////////////////////
-void D3Q27EsoTwist3DSoA::getDistributionInv(LBMReal* const f, size_t x1, size_t x2, size_t x3)
-{
-   f[D3Q27System::INV_E] = (*d.E)(x1,x2,x3);
-   f[D3Q27System::INV_N] = (*d.N)(x1,x2,x3);  
-   f[D3Q27System::INV_T] = (*d.T)(x1,x2,x3);
-   f[D3Q27System::INV_NE] = (*d.NE)(x1,x2,x3);
-   f[D3Q27System::INV_NW] = (*d.NW)(x1+1,x2,x3);
-   f[D3Q27System::INV_TE] = (*d.TE)(x1,x2,x3);
-   f[D3Q27System::INV_TW] = (*d.TW)(x1+1,x2,x3);
-   f[D3Q27System::INV_TN] = (*d.TN)(x1,x2,x3);
-   f[D3Q27System::INV_TS] = (*d.TS)(x1,x2+1,x3);
-   f[D3Q27System::INV_TNE] = (*d.TNE)(x1,x2,x3);
-   f[D3Q27System::INV_TNW] = (*d.TNW)(x1+1,x2,x3);
-   f[D3Q27System::INV_TSE] = (*d.TSE)(x1,x2+1,x3);
-   f[D3Q27System::INV_TSW] = (*d.TSW)(x1+1,x2+1,x3);
-
-   f[D3Q27System::INV_W ] = (*d.W)(x1+1,x2,x3  );
-   f[D3Q27System::INV_S ] = (*d.S)(x1,x2+1,x3  );
-   f[D3Q27System::INV_B ] = (*d.B)(x1,x2,x3+1  );
-   f[D3Q27System::INV_SW] = (*d.SW)(x1+1,x2+1,x3 );
-   f[D3Q27System::INV_SE] = (*d.SE)(x1,x2+1,x3 );
-   f[D3Q27System::INV_BW] = (*d.BW)(x1+1,x2,x3+1 );
-   f[D3Q27System::INV_BE] = (*d.BE)(x1,x2,x3+1 );
-   f[D3Q27System::INV_BS] = (*d.BS)(x1,x2+1,x3+1 );
-   f[D3Q27System::INV_BN] = (*d.BN)(x1,x2,x3+1 );
-   f[D3Q27System::INV_BSW] = (*d.BSW)(x1+1,x2+1,x3+1);
-   f[D3Q27System::INV_BSE] = (*d.BSE)(x1,x2+1,x3+1);
-   f[D3Q27System::INV_BNW] = (*d.BNW)(x1+1,x2,x3+1);
-   f[D3Q27System::INV_BNE] = (*d.BNE)(x1,x2,x3+1);
-
-   f[D3Q27System::ZERO] = (*d.ZERO)(x1,x2,x3);
-}
-//////////////////////////////////////////////////////////////////////////
-void D3Q27EsoTwist3DSoA::setDistributionInv(const LBMReal* const f, size_t x1, size_t x2, size_t x3)
-{
-   //(*this->localDistributions)(D3Q27System::ET_E,x1,  x2,  x3) = f[D3Q27System::E];
-   //(*this->localDistributions)(D3Q27System::ET_N,x1,  x2,  x3) = f[D3Q27System::N];
-   //(*this->localDistributions)(D3Q27System::ET_T,x1,  x2,  x3) = f[D3Q27System::T];
-   //(*this->localDistributions)(D3Q27System::ET_NE,x1,  x2,  x3) = f[D3Q27System::NE];
-   //(*this->localDistributions)(D3Q27System::ET_NW,x1+1,x2,  x3) = f[D3Q27System::NW];
-   //(*this->localDistributions)(D3Q27System::ET_TE,x1,  x2,  x3) = f[D3Q27System::TE];
-   //(*this->localDistributions)(D3Q27System::ET_TW,x1+1,x2,  x3) = f[D3Q27System::TW];
-   //(*this->localDistributions)(D3Q27System::ET_TN,x1,  x2,  x3) = f[D3Q27System::TN];
-   //(*this->localDistributions)(D3Q27System::ET_TS,x1,  x2+1,x3) = f[D3Q27System::TS];
-   //(*this->localDistributions)(D3Q27System::ET_TNE,x1,  x2,  x3) = f[D3Q27System::TNE];
-   //(*this->localDistributions)(D3Q27System::ET_TNW,x1+1,x2,  x3) = f[D3Q27System::TNW];
-   //(*this->localDistributions)(D3Q27System::ET_TSE,x1,  x2+1,x3) = f[D3Q27System::TSE];
-   //(*this->localDistributions)(D3Q27System::ET_TSW,x1+1,x2+1,x3) = f[D3Q27System::TSW];
-
-   //(*this->nonLocalDistributions)(D3Q27System::ET_W,x1+1,x2,  x3    ) = f[D3Q27System::W ];
-   //(*this->nonLocalDistributions)(D3Q27System::ET_S,x1,  x2+1,x3    ) = f[D3Q27System::S ];
-   //(*this->nonLocalDistributions)(D3Q27System::ET_B,x1,  x2,  x3+1  ) = f[D3Q27System::B ];
-   //(*this->nonLocalDistributions)(D3Q27System::ET_SW,x1+1,x2+1,x3   ) = f[D3Q27System::SW];
-   //(*this->nonLocalDistributions)(D3Q27System::ET_SE,x1,  x2+1,x3   ) = f[D3Q27System::SE];
-   //(*this->nonLocalDistributions)(D3Q27System::ET_BW,x1+1,x2,  x3+1 ) = f[D3Q27System::BW];
-   //(*this->nonLocalDistributions)(D3Q27System::ET_BE,x1,  x2,  x3+1 ) = f[D3Q27System::BE];
-   //(*this->nonLocalDistributions)(D3Q27System::ET_BS,x1,  x2+1,x3+1 ) = f[D3Q27System::BS];
-   //(*this->nonLocalDistributions)(D3Q27System::ET_BN,x1,  x2,  x3+1 ) = f[D3Q27System::BN];
-   //(*this->nonLocalDistributions)(D3Q27System::ET_BSW,x1+1,x2+1,x3+1) = f[D3Q27System::BSW];
-   //(*this->nonLocalDistributions)(D3Q27System::ET_BSE,x1,  x2+1,x3+1) = f[D3Q27System::BSE];
-   //(*this->nonLocalDistributions)(D3Q27System::ET_BNW,x1+1,x2,  x3+1) = f[D3Q27System::BNW];
-   //(*this->nonLocalDistributions)(D3Q27System::ET_BNE,x1,  x2,  x3+1) = f[D3Q27System::BNE];
-
-   //(*this->zeroDistributions)(x1,x2,x3) = f[D3Q27System::ZERO];
-}
-//////////////////////////////////////////////////////////////////////////
-void D3Q27EsoTwist3DSoA::setDistributionForDirection(const LBMReal* const f, size_t x1, size_t x2, size_t x3, unsigned long int direction)
-{
-   //bool directionFlag = false;
-   //if ((direction & EsoTwistD3Q27System::etE) == EsoTwistD3Q27System::etE)
-   //   (*this->nonLocalDistributions)(D3Q27System::ET_W,x1+1,x2,  x3    ) = f[D3Q27System::E]; directionFlag=true;
-   //if ((direction & EsoTwistD3Q27System::etW) == EsoTwistD3Q27System::etW)
-   //   (*this->localDistributions)(D3Q27System::ET_E,x1,  x2,  x3) = f[D3Q27System::W]; directionFlag=true;
-   //if ((direction & EsoTwistD3Q27System::etS) == EsoTwistD3Q27System::etS)
-   //   (*this->localDistributions)(D3Q27System::ET_N,x1,  x2,  x3) = f[D3Q27System::S]; directionFlag=true;
-   //if ((direction & EsoTwistD3Q27System::etN) == EsoTwistD3Q27System::etN)
-   //   (*this->nonLocalDistributions)(D3Q27System::ET_S,x1,  x2+1,x3    ) = f[D3Q27System::N]; directionFlag=true;
-   //if ((direction & EsoTwistD3Q27System::etB) == EsoTwistD3Q27System::etB)
-   //   (*this->localDistributions)(D3Q27System::ET_T,x1,  x2,  x3) = f[D3Q27System::B]; directionFlag=true;
-   //if ((direction & EsoTwistD3Q27System::etT) == EsoTwistD3Q27System::etT)
-   //   (*this->nonLocalDistributions)(D3Q27System::ET_B,x1,  x2,  x3+1  ) = f[D3Q27System::T]; directionFlag=true;
-   //if ((direction & EsoTwistD3Q27System::etSW) == EsoTwistD3Q27System::etSW)
-   //   (*this->localDistributions)(D3Q27System::ET_NE,x1,  x2,  x3) = f[D3Q27System::SW]; directionFlag=true;
-   //if ((direction & EsoTwistD3Q27System::etNE) == EsoTwistD3Q27System::etNE)
-   //   (*this->nonLocalDistributions)(D3Q27System::ET_SW,x1+1,x2+1,x3   ) = f[D3Q27System::NE]; directionFlag=true;
-   //if ((direction & EsoTwistD3Q27System::etNW) == EsoTwistD3Q27System::etNW)
-   //   (*this->nonLocalDistributions)(D3Q27System::ET_SE,x1,  x2+1,x3   ) = f[D3Q27System::NW]; directionFlag=true;
-   //if ((direction & EsoTwistD3Q27System::etSE) == EsoTwistD3Q27System::etSE)
-   //   (*this->localDistributions)(D3Q27System::ET_NW,x1+1,x2,  x3) = f[D3Q27System::SE]; directionFlag=true;
-   //if ((direction & EsoTwistD3Q27System::etBW) == EsoTwistD3Q27System::etBW)
-   //   (*this->localDistributions)(D3Q27System::ET_TE,x1,  x2,  x3) = f[D3Q27System::BW]; directionFlag=true;
-   //if ((direction & EsoTwistD3Q27System::etTE) == EsoTwistD3Q27System::etTE)
-   //   (*this->nonLocalDistributions)(D3Q27System::ET_BW,x1+1,x2,  x3+1 ) = f[D3Q27System::TE]; directionFlag=true;
-   //if ((direction & EsoTwistD3Q27System::etTW) == EsoTwistD3Q27System::etTW)
-   //   (*this->nonLocalDistributions)(D3Q27System::ET_BE,x1,  x2,  x3+1 ) = f[D3Q27System::TW]; directionFlag=true;
-   //if ((direction & EsoTwistD3Q27System::etBE) == EsoTwistD3Q27System::etBE)
-   //   (*this->localDistributions)(D3Q27System::ET_TW,x1+1,x2,  x3) = f[D3Q27System::BE]; directionFlag=true;
-   //if ((direction & EsoTwistD3Q27System::etBS) == EsoTwistD3Q27System::etBS)
-   //   (*this->localDistributions)(D3Q27System::ET_TN,x1,  x2,  x3) = f[D3Q27System::BS]; directionFlag=true;
-   //if ((direction & EsoTwistD3Q27System::etTN) == EsoTwistD3Q27System::etTN)
-   //   (*this->nonLocalDistributions)(D3Q27System::ET_BS,x1,  x2+1,x3+1 ) = f[D3Q27System::TN]; directionFlag=true;
-   //if ((direction & EsoTwistD3Q27System::etTS) == EsoTwistD3Q27System::etTS)
-   //   (*this->nonLocalDistributions)(D3Q27System::ET_BN,x1,  x2,  x3+1 ) = f[D3Q27System::TS]; directionFlag=true;
-   //if ((direction & EsoTwistD3Q27System::etBN) == EsoTwistD3Q27System::etBN)
-   //   (*this->localDistributions)(D3Q27System::ET_TS,x1,  x2+1,x3) = f[D3Q27System::BN]; directionFlag=true;
-   //if ((direction & EsoTwistD3Q27System::etBSW) == EsoTwistD3Q27System::etBSW)
-   //   (*this->localDistributions)(D3Q27System::ET_TNE,x1,  x2,  x3) = f[D3Q27System::BSW]; directionFlag=true;
-   //if ((direction & EsoTwistD3Q27System::etTNE) == EsoTwistD3Q27System::etTNE)
-   //   (*this->nonLocalDistributions)(D3Q27System::ET_BSW,x1+1,x2+1,x3+1) = f[D3Q27System::TNE]; directionFlag=true;
-   //if ((direction & EsoTwistD3Q27System::etBSE) == EsoTwistD3Q27System::etBSE)
-   //   (*this->localDistributions)(D3Q27System::ET_TNW,x1+1,x2,  x3) = f[D3Q27System::BSE]; directionFlag=true;
-   //if ((direction & EsoTwistD3Q27System::etTNW) == EsoTwistD3Q27System::etTNW)
-   //   (*this->nonLocalDistributions)(D3Q27System::ET_BSE,x1,  x2+1,x3+1) = f[D3Q27System::TNW]; directionFlag=true;
-   //if ((direction & EsoTwistD3Q27System::etBNW) == EsoTwistD3Q27System::etBNW)
-   //   (*this->localDistributions)(D3Q27System::ET_TSE,x1,  x2+1,x3) = f[D3Q27System::BNW]; directionFlag=true;
-   //if ((direction & EsoTwistD3Q27System::etTSE) == EsoTwistD3Q27System::etTSE)
-   //   (*this->nonLocalDistributions)(D3Q27System::ET_BNW,x1+1,x2,  x3+1) = f[D3Q27System::TSE]; directionFlag=true;
-   //if ((direction & EsoTwistD3Q27System::etBNE) == EsoTwistD3Q27System::etBNE)
-   //   (*this->localDistributions)(D3Q27System::ET_TSW,x1+1,x2+1,x3) = f[D3Q27System::BNE]; directionFlag=true;
-   //if ((direction & EsoTwistD3Q27System::etTSW) == EsoTwistD3Q27System::etTSW)
-   //   (*this->nonLocalDistributions)(D3Q27System::ET_BNE,x1,  x2,  x3+1) = f[D3Q27System::TSW]; directionFlag=true;
-   //if ((direction & EsoTwistD3Q27System::ZERO) == EsoTwistD3Q27System::ZERO)
-   //   (*this->zeroDistributions)(x1,x2,x3) = f[D3Q27System::ZERO]; directionFlag=true;
-//#ifdef _DEBUG
-//   if(!directionFlag)UB_THROW( UbException(UB_EXARGS, "Direction didn't find") );
-//#endif //DEBUG
-}
-//////////////////////////////////////////////////////////////////////////
-void D3Q27EsoTwist3DSoA::setDistributionForDirection(LBMReal f, size_t x1, size_t x2, size_t x3, int direction)
-{
-   //switch (direction)
-   //{
-   //case D3Q27System::E :
-   //   (*this->nonLocalDistributions)(D3Q27System::ET_W,x1+1,x2,  x3    ) = f;
-   //   break;
-   //case D3Q27System::W :
-   //   (*this->localDistributions)(D3Q27System::ET_E,x1,  x2,  x3) = f;
-   //   break;
-   //case D3Q27System::S :
-   //   (*this->localDistributions)(D3Q27System::ET_N,x1,  x2,  x3) = f;
-   //   break;
-   //case D3Q27System::N :
-   //   (*this->nonLocalDistributions)(D3Q27System::ET_S,x1,  x2+1,x3    ) = f;
-   //   break;
-   //case D3Q27System::B :
-   //   (*this->localDistributions)(D3Q27System::ET_T,x1,  x2,  x3) = f;
-   //   break;
-   //case D3Q27System::T :
-   //   (*this->nonLocalDistributions)(D3Q27System::ET_B,x1,  x2,  x3+1  ) = f;
-   //   break;
-   //case D3Q27System::SW :
-   //   (*this->localDistributions)(D3Q27System::ET_NE,x1,  x2,  x3) = f;
-   //   break;
-   //case D3Q27System::NE :
-   //   (*this->nonLocalDistributions)(D3Q27System::ET_SW,x1+1,x2+1,x3   ) = f;
-   //   break;
-   //case D3Q27System::NW :
-   //   (*this->nonLocalDistributions)(D3Q27System::ET_SE,x1,  x2+1,x3   ) = f;
-   //   break;
-   //case D3Q27System::SE :
-   //   (*this->localDistributions)(D3Q27System::ET_NW,x1+1,x2,  x3) = f;
-   //   break;
-   //case D3Q27System::BW :
-   //   (*this->localDistributions)(D3Q27System::ET_TE,x1,  x2,  x3) = f;
-   //   break;
-   //case D3Q27System::TE :
-   //   (*this->nonLocalDistributions)(D3Q27System::ET_BW,x1+1,x2,  x3+1 ) = f;
-   //   break;
-   //case D3Q27System::TW :
-   //   (*this->nonLocalDistributions)(D3Q27System::ET_BE,x1,  x2,  x3+1 ) = f;
-   //   break;
-   //case D3Q27System::BE :
-   //   (*this->localDistributions)(D3Q27System::ET_TW,x1+1,x2,  x3) = f;
-   //   break;
-   //case D3Q27System::BS :
-   //   (*this->localDistributions)(D3Q27System::ET_TN,x1,  x2,  x3) = f;
-   //   break;
-   //case D3Q27System::TN :
-   //   (*this->nonLocalDistributions)(D3Q27System::ET_BS,x1,  x2+1,x3+1 ) = f;
-   //   break;
-   //case D3Q27System::TS :
-   //   (*this->nonLocalDistributions)(D3Q27System::ET_BN,x1,  x2,  x3+1 ) = f;
-   //   break;
-   //case D3Q27System::BN :
-   //   (*this->localDistributions)(D3Q27System::ET_TS,x1,  x2+1,x3) = f;
-   //   break;
-   //case D3Q27System::BSW :
-   //   (*this->localDistributions)(D3Q27System::ET_TNE,x1,  x2,  x3) = f;
-   //   break;
-   //case D3Q27System::TNE :
-   //   (*this->nonLocalDistributions)(D3Q27System::ET_BSW,x1+1,x2+1,x3+1) = f;
-   //   break;
-   //case D3Q27System::BSE :
-   //   (*this->localDistributions)(D3Q27System::ET_TNW,x1+1,x2,  x3) = f;
-   //   break;
-   //case D3Q27System::TNW :
-   //   (*this->nonLocalDistributions)(D3Q27System::ET_BSE,x1,  x2+1,x3+1) = f;
-   //   break;
-   //case D3Q27System::BNW :
-   //   (*this->localDistributions)(D3Q27System::ET_TSE,x1,  x2+1,x3) = f;
-   //   break;
-   //case D3Q27System::TSE :
-   //   (*this->nonLocalDistributions)(D3Q27System::ET_BNW,x1+1,x2,  x3+1) = f;
-   //   break;
-   //case D3Q27System::BNE :
-   //   (*this->localDistributions)(D3Q27System::ET_TSW,x1+1,x2+1,x3) = f;
-   //   break;
-   //case D3Q27System::TSW :
-   //   (*this->nonLocalDistributions)(D3Q27System::ET_BNE,x1,  x2,  x3+1) = f;
-   //   break;
-   //case D3Q27System::ZERO :
-   //   (*this->zeroDistributions)(x1,x2,x3) = f;
-   //   break;
-   //default:
-   //   UB_THROW( UbException(UB_EXARGS, "Direction didn't find") );     
-   //}
-}
-//////////////////////////////////////////////////////////////////////////
-void D3Q27EsoTwist3DSoA::setDistributionInvForDirection(const LBMReal* const f, size_t x1, size_t x2, size_t x3, unsigned long int direction)
-{
-//   bool directionFlag = false;
-//   if ((direction & EsoTwistD3Q27System::etE) == EsoTwistD3Q27System::etE)
-//      (*this->localDistributions)(D3Q27System::ET_E,x1,  x2,  x3) = f[D3Q27System::E]; directionFlag=true;
-//   if ((direction & EsoTwistD3Q27System::etW) == EsoTwistD3Q27System::etW)
-//      (*this->nonLocalDistributions)(D3Q27System::ET_W,x1+1,x2,  x3    ) = f[D3Q27System::W]; directionFlag=true;
-//   if ((direction & EsoTwistD3Q27System::etS) == EsoTwistD3Q27System::etS)
-//      (*this->nonLocalDistributions)(D3Q27System::ET_S,x1,  x2+1,x3    ) = f[D3Q27System::S]; directionFlag=true;
-//   if ((direction & EsoTwistD3Q27System::etN) == EsoTwistD3Q27System::etN)
-//      (*this->localDistributions)(D3Q27System::ET_N,x1,  x2,  x3) = f[D3Q27System::N]; directionFlag=true;
-//   if ((direction & EsoTwistD3Q27System::etB) == EsoTwistD3Q27System::etB)
-//      (*this->nonLocalDistributions)(D3Q27System::ET_B,x1,  x2,  x3+1  ) = f[D3Q27System::B]; directionFlag=true;
-//   if ((direction & EsoTwistD3Q27System::etT) == EsoTwistD3Q27System::etT)
-//      (*this->localDistributions)(D3Q27System::ET_T,x1,  x2,  x3) = f[D3Q27System::T]; directionFlag=true;
-//   if ((direction & EsoTwistD3Q27System::etSW) == EsoTwistD3Q27System::etSW)
-//      (*this->nonLocalDistributions)(D3Q27System::ET_SW,x1+1,x2+1,x3   ) = f[D3Q27System::SW]; directionFlag=true;
-//   if ((direction & EsoTwistD3Q27System::etNE) == EsoTwistD3Q27System::etNE)
-//      (*this->localDistributions)(D3Q27System::ET_NE,x1,  x2,  x3) = f[D3Q27System::NE]; directionFlag=true;
-//   if ((direction & EsoTwistD3Q27System::etNW) == EsoTwistD3Q27System::etNW)
-//      (*this->localDistributions)(D3Q27System::ET_NW,x1+1,x2,  x3) = f[D3Q27System::NW]; directionFlag=true;
-//   if ((direction & EsoTwistD3Q27System::etSE) == EsoTwistD3Q27System::etSE)
-//      (*this->nonLocalDistributions)(D3Q27System::ET_SE,x1,  x2+1,x3   ) = f[D3Q27System::SE]; directionFlag=true;
-//   if ((direction & EsoTwistD3Q27System::etBW) == EsoTwistD3Q27System::etBW)
-//      (*this->nonLocalDistributions)(D3Q27System::ET_BW,x1+1,x2,  x3+1 ) = f[D3Q27System::BW]; directionFlag=true;
-//   if ((direction & EsoTwistD3Q27System::etTE) == EsoTwistD3Q27System::etTE)
-//      (*this->localDistributions)(D3Q27System::ET_TE,x1,  x2,  x3) = f[D3Q27System::TE]; directionFlag=true;
-//   if ((direction & EsoTwistD3Q27System::etTW) == EsoTwistD3Q27System::etTW)
-//      (*this->localDistributions)(D3Q27System::ET_TW,x1+1,x2,  x3) = f[D3Q27System::TW]; directionFlag=true;
-//   if ((direction & EsoTwistD3Q27System::etBE) == EsoTwistD3Q27System::etBE)
-//      (*this->nonLocalDistributions)(D3Q27System::ET_BE,x1,  x2,  x3+1 ) = f[D3Q27System::BE]; directionFlag=true;
-//   if ((direction & EsoTwistD3Q27System::etBS) == EsoTwistD3Q27System::etBS)
-//      (*this->nonLocalDistributions)(D3Q27System::ET_BS,x1,  x2+1,x3+1 ) = f[D3Q27System::BS]; directionFlag=true;
-//   if ((direction & EsoTwistD3Q27System::etTN) == EsoTwistD3Q27System::etTN)
-//      (*this->localDistributions)(D3Q27System::ET_TN,x1,  x2,  x3) = f[D3Q27System::TN]; directionFlag=true;
-//   if ((direction & EsoTwistD3Q27System::etTS) == EsoTwistD3Q27System::etTS)
-//      (*this->localDistributions)(D3Q27System::ET_TS,x1,  x2+1,x3) = f[D3Q27System::TS]; directionFlag=true;
-//   if ((direction & EsoTwistD3Q27System::etBN) == EsoTwistD3Q27System::etBN)
-//      (*this->nonLocalDistributions)(D3Q27System::ET_BN,x1,  x2,  x3+1 ) = f[D3Q27System::BN]; directionFlag=true;
-//   if ((direction & EsoTwistD3Q27System::etBSW) == EsoTwistD3Q27System::etBSW)
-//      (*this->nonLocalDistributions)(D3Q27System::ET_BSW,x1+1,x2+1,x3+1) = f[D3Q27System::BSW]; directionFlag=true;
-//   if ((direction & EsoTwistD3Q27System::etTNE) == EsoTwistD3Q27System::etTNE)
-//      (*this->localDistributions)(D3Q27System::ET_TNE,x1,  x2,  x3) = f[D3Q27System::TNE]; directionFlag=true;
-//   if ((direction & EsoTwistD3Q27System::etBSE) == EsoTwistD3Q27System::etBSE)
-//      (*this->nonLocalDistributions)(D3Q27System::ET_BSE,x1,  x2+1,x3+1) = f[D3Q27System::BSE]; directionFlag=true;
-//   if ((direction & EsoTwistD3Q27System::etTNW) == EsoTwistD3Q27System::etTNW)
-//      (*this->localDistributions)(D3Q27System::ET_TNW,x1+1,x2,  x3) = f[D3Q27System::TNW]; directionFlag=true;
-//   if ((direction & EsoTwistD3Q27System::etBNW) == EsoTwistD3Q27System::etBNW)
-//      (*this->nonLocalDistributions)(D3Q27System::ET_BNW,x1+1,x2,  x3+1) = f[D3Q27System::BNW]; directionFlag=true;
-//   if ((direction & EsoTwistD3Q27System::etTSE) == EsoTwistD3Q27System::etTSE)
-//      (*this->localDistributions)(D3Q27System::ET_TSE,x1,  x2+1,x3) = f[D3Q27System::TSE]; directionFlag=true;
-//   if ((direction & EsoTwistD3Q27System::etBNE) == EsoTwistD3Q27System::etBNE)
-//      (*this->nonLocalDistributions)(D3Q27System::ET_BNE,x1,  x2,  x3+1)= f[D3Q27System::BNE]; directionFlag=true;
-//   if ((direction & EsoTwistD3Q27System::etTSW) == EsoTwistD3Q27System::etTSW)
-//      (*this->localDistributions)(D3Q27System::ET_TSW,x1+1,x2+1,x3) = f[D3Q27System::TSW]; directionFlag=true;
-//   if ((direction & EsoTwistD3Q27System::ZERO) == EsoTwistD3Q27System::ZERO)
-//      (*this->zeroDistributions)(x1,x2,x3) = f[D3Q27System::ZERO]; directionFlag=true;
-//#ifdef _DEBUG
-//   if(!directionFlag)UB_THROW( UbException(UB_EXARGS, "Direction didn't find") );
-//#endif //DEBUG
-}
-//////////////////////////////////////////////////////////////////////////
-void D3Q27EsoTwist3DSoA::setDistributionInvForDirection(LBMReal f, size_t x1, size_t x2, size_t x3, unsigned long int direction)
-{
-   //switch (direction)
-   //{
-   //case D3Q27System::E :
-   //   (*this->localDistributions)(D3Q27System::ET_E,x1,  x2,  x3) = f;
-   //   break;
-   //case D3Q27System::W :
-   //   (*this->nonLocalDistributions)(D3Q27System::ET_W,x1+1,x2,  x3    ) = f;
-   //   break;
-   //case D3Q27System::S :
-   //   (*this->nonLocalDistributions)(D3Q27System::ET_S,x1,  x2+1,x3    ) = f;
-   //   break;
-   //case D3Q27System::N :
-   //   (*this->localDistributions)(D3Q27System::ET_N,x1,  x2,  x3) = f;
-   //   break;
-   //case D3Q27System::B :
-   //   (*this->nonLocalDistributions)(D3Q27System::ET_B,x1,  x2,  x3+1  ) = f;
-   //   break;
-   //case D3Q27System::T :
-   //   (*this->localDistributions)(D3Q27System::ET_T,x1,  x2,  x3) = f;
-   //   break;
-   //case D3Q27System::SW :
-   //   (*this->nonLocalDistributions)(D3Q27System::ET_SW,x1+1,x2+1,x3   ) = f;
-   //   break;
-   //case D3Q27System::NE :
-   //   (*this->localDistributions)(D3Q27System::ET_NE,x1,  x2,  x3) = f;
-   //   break;
-   //case D3Q27System::NW :
-   //   (*this->localDistributions)(D3Q27System::ET_NW,x1+1,x2,  x3) = f;
-   //   break;
-   //case D3Q27System::SE :
-   //   (*this->nonLocalDistributions)(D3Q27System::ET_SE,x1,  x2+1,x3   ) = f;
-   //   break;
-   //case D3Q27System::BW :
-   //   (*this->nonLocalDistributions)(D3Q27System::ET_BW,x1+1,x2,  x3+1 ) = f;
-   //   break;
-   //case D3Q27System::TE :
-   //   (*this->localDistributions)(D3Q27System::ET_TE,x1,  x2,  x3) = f;
-   //   break;
-   //case D3Q27System::TW :
-   //   (*this->localDistributions)(D3Q27System::ET_TW,x1+1,x2,  x3) = f;
-   //   break;
-   //case D3Q27System::BE :
-   //   (*this->nonLocalDistributions)(D3Q27System::ET_BE,x1,  x2,  x3+1 ) = f;
-   //   break;
-   //case D3Q27System::BS :
-   //   (*this->nonLocalDistributions)(D3Q27System::ET_BS,x1,  x2+1,x3+1 ) = f;
-   //   break;
-   //case D3Q27System::TN :
-   //   (*this->localDistributions)(D3Q27System::ET_TN,x1,  x2,  x3) = f;
-   //   break;
-   //case D3Q27System::TS :
-   //   (*this->localDistributions)(D3Q27System::ET_TS,x1,  x2+1,x3) = f;
-   //   break;
-   //case D3Q27System::BN :
-   //   (*this->nonLocalDistributions)(D3Q27System::ET_BN,x1,  x2,  x3+1 ) = f;
-   //   break;
-   //case D3Q27System::BSW :
-   //   (*this->nonLocalDistributions)(D3Q27System::ET_BSW,x1+1,x2+1,x3+1) = f;
-   //   break;
-   //case D3Q27System::TNE :
-   //   (*this->localDistributions)(D3Q27System::ET_TNE,x1,  x2,  x3) = f;
-   //   break;
-   //case D3Q27System::BSE :
-   //   (*this->nonLocalDistributions)(D3Q27System::ET_BSE,x1,  x2+1,x3+1) = f;
-   //   break;
-   //case D3Q27System::TNW :
-   //   (*this->localDistributions)(D3Q27System::ET_TNW,x1+1,x2,  x3) = f;
-   //   break;
-   //case D3Q27System::BNW :
-   //   (*this->nonLocalDistributions)(D3Q27System::ET_BNW,x1+1,x2,  x3+1) = f;
-   //   break;
-   //case D3Q27System::TSE :
-   //   (*this->localDistributions)(D3Q27System::ET_TSE,x1,  x2+1,x3) = f;
-   //   break;
-   //case D3Q27System::BNE :
-   //   (*this->nonLocalDistributions)(D3Q27System::ET_BNE,x1,  x2,  x3+1) = f;
-   //   break;
-   //case D3Q27System::TSW :
-   //   (*this->localDistributions)(D3Q27System::ET_TSW,x1+1,x2+1,x3) = f;
-   //   break;
-   //case D3Q27System::ZERO :
-   //   (*this->zeroDistributions)(x1,x2,x3) = f;
-   //   break;
-   //default:
-   //   UB_THROW( UbException(UB_EXARGS, "Direction didn't find") );     
-   //}
-}
-//////////////////////////////////////////////////////////////////////////
-LBMReal D3Q27EsoTwist3DSoA::getDistributionInvForDirection(size_t x1, size_t x2, size_t x3, int direction)
-{
-   //switch (direction)
-   //{
-   //case D3Q27System::E :
-   //   return (*this->nonLocalDistributions)(D3Q27System::ET_W,x1+1,x2,  x3    );
-   //case D3Q27System::W :
-   //   return (*this->localDistributions)(D3Q27System::ET_E,x1,  x2,  x3);
-   //case D3Q27System::S :
-   //   return (*this->localDistributions)(D3Q27System::ET_N,x1,  x2,  x3);
-   //case D3Q27System::N :
-   //   return (*this->nonLocalDistributions)(D3Q27System::ET_S,x1,  x2+1,x3    );
-   //case D3Q27System::B :
-   //   return (*this->localDistributions)(D3Q27System::ET_T,x1,  x2,  x3);
-   //case D3Q27System::T :
-   //   return (*this->nonLocalDistributions)(D3Q27System::ET_B,x1,  x2,  x3+1  );
-   //case D3Q27System::SW :
-   //   return (*this->localDistributions)(D3Q27System::ET_NE,x1,  x2,  x3);
-   //case D3Q27System::NE :
-   //   return (*this->nonLocalDistributions)(D3Q27System::ET_SW,x1+1,x2+1,x3   );
-   //case D3Q27System::NW :
-   //   return (*this->nonLocalDistributions)(D3Q27System::ET_SE,x1,  x2+1,x3   );
-   //case D3Q27System::SE :
-   //   return (*this->localDistributions)(D3Q27System::ET_NW,x1+1,x2,  x3);
-   //case D3Q27System::BW :
-   //   return (*this->localDistributions)(D3Q27System::ET_TE,x1,  x2,  x3);
-   //case D3Q27System::TE :
-   //   return (*this->nonLocalDistributions)(D3Q27System::ET_BW,x1+1,x2,  x3+1 );
-   //case D3Q27System::TW :
-   //   return (*this->nonLocalDistributions)(D3Q27System::ET_BE,x1,  x2,  x3+1 );
-   //case D3Q27System::BE :
-   //   return (*this->localDistributions)(D3Q27System::ET_TW,x1+1,x2,  x3);
-   //case D3Q27System::BS :
-   //   return (*this->localDistributions)(D3Q27System::ET_TN,x1,  x2,  x3);
-   //case D3Q27System::TN :
-   //   return (*this->nonLocalDistributions)(D3Q27System::ET_BS,x1,  x2+1,x3+1 );
-   //case D3Q27System::TS :
-   //   return (*this->nonLocalDistributions)(D3Q27System::ET_BN,x1,  x2,  x3+1 );
-   //case D3Q27System::BN :
-   //   return (*this->localDistributions)(D3Q27System::ET_TS,x1,  x2+1,x3);
-   //case D3Q27System::BSW :
-   //   return (*this->localDistributions)(D3Q27System::ET_TNE,x1,  x2,  x3);
-   //case D3Q27System::TNE :
-   //   return (*this->nonLocalDistributions)(D3Q27System::ET_BSW,x1+1,x2+1,x3+1);
-   //case D3Q27System::BSE :
-   //   return (*this->localDistributions)(D3Q27System::ET_TNW,x1+1,x2,  x3);
-   //case D3Q27System::TNW :
-   //   return (*this->nonLocalDistributions)(D3Q27System::ET_BSE,x1,  x2+1,x3+1);
-   //case D3Q27System::BNW :
-   //   return (*this->localDistributions)(D3Q27System::ET_TSE,x1,  x2+1,x3);
-   //case D3Q27System::TSE :
-   //   return (*this->nonLocalDistributions)(D3Q27System::ET_BNW,x1+1,x2,  x3+1);
-   //case D3Q27System::BNE :
-   //   return (*this->localDistributions)(D3Q27System::ET_TSW,x1+1,x2+1,x3);
-   //case D3Q27System::TSW :
-   //   return (*this->nonLocalDistributions)(D3Q27System::ET_BNE,x1,  x2,  x3+1);
-   //case D3Q27System::ZERO :
-   //   return (*this->zeroDistributions)(x1,x2,x3);
-   //default:
-   //   UB_THROW( UbException(UB_EXARGS, "Direction didn't find") );     
-   //}
-   return 0;
-}
-//////////////////////////////////////////////////////////////////////////
-size_t D3Q27EsoTwist3DSoA::getNX1() const
-{
-   return NX1;
-}
-//////////////////////////////////////////////////////////////////////////
-size_t D3Q27EsoTwist3DSoA::getNX2() const
-{
-   return NX2;
-}
-//////////////////////////////////////////////////////////////////////////
-size_t D3Q27EsoTwist3DSoA::getNX3() const
-{
-   return NX3;
-}
-//////////////////////////////////////////////////////////////////////////
-Distributions D3Q27EsoTwist3DSoA::getDistributions()
-{
-   return d;
-}
-//////////////////////////////////////////////////////////////////////////
-
+#include "D3Q27EsoTwist3DSoA.h"
+#include <D3Q27System.h>
+#include "EsoTwistD3Q27System.h"
+
+D3Q27EsoTwist3DSoA::D3Q27EsoTwist3DSoA()
+{
+}
+//////////////////////////////////////////////////////////////////////////
+D3Q27EsoTwist3DSoA::D3Q27EsoTwist3DSoA( const size_t& nx1, const size_t& nx2, const size_t& nx3, LBMReal value )
+{
+   this->NX1 = nx1;
+   this->NX2 = nx2;
+   this->NX3 = nx3;
+
+   d.E   = CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal,IndexerX3X2X1>(nx1+1, nx2+1, nx3+1, value));
+   d.W   = CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal,IndexerX3X2X1>(nx1+1, nx2+1, nx3+1, value));
+   d.N   = CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal,IndexerX3X2X1>(nx1+1, nx2+1, nx3+1, value));
+   d.S   = CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal,IndexerX3X2X1>(nx1+1, nx2+1, nx3+1, value));
+   d.T   = CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal,IndexerX3X2X1>(nx1+1, nx2+1, nx3+1, value));
+   d.B   = CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal,IndexerX3X2X1>(nx1+1, nx2+1, nx3+1, value));
+   d.NE  = CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal,IndexerX3X2X1>(nx1+1, nx2+1, nx3+1, value));
+   d.SW  = CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal,IndexerX3X2X1>(nx1+1, nx2+1, nx3+1, value));
+   d.SE  = CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal,IndexerX3X2X1>(nx1+1, nx2+1, nx3+1, value));
+   d.NW  = CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal,IndexerX3X2X1>(nx1+1, nx2+1, nx3+1, value));
+   d.TE  = CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal,IndexerX3X2X1>(nx1+1, nx2+1, nx3+1, value));
+   d.BW  = CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal,IndexerX3X2X1>(nx1+1, nx2+1, nx3+1, value));
+   d.BE  = CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal,IndexerX3X2X1>(nx1+1, nx2+1, nx3+1, value));
+   d.TW  = CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal,IndexerX3X2X1>(nx1+1, nx2+1, nx3+1, value));
+   d.TN  = CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal,IndexerX3X2X1>(nx1+1, nx2+1, nx3+1, value));
+   d.BS  = CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal,IndexerX3X2X1>(nx1+1, nx2+1, nx3+1, value));
+   d.BN  = CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal,IndexerX3X2X1>(nx1+1, nx2+1, nx3+1, value));
+   d.TS  = CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal,IndexerX3X2X1>(nx1+1, nx2+1, nx3+1, value));
+   d.TNE = CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal,IndexerX3X2X1>(nx1+1, nx2+1, nx3+1, value));
+   d.TNW = CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal,IndexerX3X2X1>(nx1+1, nx2+1, nx3+1, value));
+   d.TSE = CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal,IndexerX3X2X1>(nx1+1, nx2+1, nx3+1, value));
+   d.TSW = CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal,IndexerX3X2X1>(nx1+1, nx2+1, nx3+1, value));
+   d.BNE = CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal,IndexerX3X2X1>(nx1+1, nx2+1, nx3+1, value));
+   d.BNW = CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal,IndexerX3X2X1>(nx1+1, nx2+1, nx3+1, value));
+   d.BSE = CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal,IndexerX3X2X1>(nx1+1, nx2+1, nx3+1, value));
+   d.BSW = CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal,IndexerX3X2X1>(nx1+1, nx2+1, nx3+1, value));
+   d.ZERO= CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal,IndexerX3X2X1>(nx1, nx2, nx3, value));
+}
+//////////////////////////////////////////////////////////////////////////
+D3Q27EsoTwist3DSoA::~D3Q27EsoTwist3DSoA()
+{
+
+}
+//////////////////////////////////////////////////////////////////////////
+void D3Q27EsoTwist3DSoA::swap()
+{
+   std::swap(d.E  , d.W  );
+   std::swap(d.N  , d.S  );
+   std::swap(d.T  , d.B  );
+   std::swap(d.NE , d.SW );
+   std::swap(d.NW , d.SE );
+   std::swap(d.TE , d.BW );
+   std::swap(d.TW , d.BE );
+   std::swap(d.TN , d.BS );
+   std::swap(d.TS , d.BN );
+   std::swap(d.TNE, d.BSW);
+   std::swap(d.TNW, d.BSE);
+   std::swap(d.TSE, d.BNW);
+   std::swap(d.TSW, d.BNE);
+}
+//////////////////////////////////////////////////////////////////////////
+void D3Q27EsoTwist3DSoA::getDistribution(LBMReal* const f, size_t x1, size_t x2, size_t x3)
+{
+   size_t x1p = x1 + 1;
+   size_t x2p = x2 + 1;
+   size_t x3p = x3 + 1;
+
+   f[D3Q27System::E]   = (*d.E)(x1,x2,x3);
+   f[D3Q27System::N]   = (*d.N)(x1,x2,x3);  
+   f[D3Q27System::T]   = (*d.T)(x1,x2,x3);
+   f[D3Q27System::NE]  = (*d.NE)(x1,x2,x3);
+   f[D3Q27System::NW]  = (*d.NW)(x1p,x2,x3);
+   f[D3Q27System::TE]  = (*d.TE)(x1,x2,x3);
+   f[D3Q27System::TW]  = (*d.TW)(x1p,x2,x3);
+   f[D3Q27System::TN]  = (*d.TN)(x1,x2,x3);
+   f[D3Q27System::TS]  = (*d.TS)(x1,x2p,x3);
+   f[D3Q27System::TNE] = (*d.TNE)(x1,x2,x3);
+   f[D3Q27System::TNW] = (*d.TNW)(x1p,x2,x3);
+   f[D3Q27System::TSE] = (*d.TSE)(x1,x2p,x3);
+   f[D3Q27System::TSW] = (*d.TSW)(x1p,x2p,x3);
+
+   f[D3Q27System::W ]  = (*d.W)(x1p,x2,x3);
+   f[D3Q27System::S ]  = (*d.S)(x1,x2p,x3);
+   f[D3Q27System::B ]  = (*d.B)(x1,x2,x3p);
+   f[D3Q27System::SW]  = (*d.SW)(x1p,x2p,x3);
+   f[D3Q27System::SE]  = (*d.SE)(x1,x2p,x3);
+   f[D3Q27System::BW]  = (*d.BW)(x1p,x2,x3p);
+   f[D3Q27System::BE]  = (*d.BE)(x1,x2,x3p);
+   f[D3Q27System::BS]  = (*d.BS)(x1,x2p,x3p);
+   f[D3Q27System::BN]  = (*d.BN)(x1,x2,x3p);
+   f[D3Q27System::BSW] = (*d.BSW)(x1p,x2p,x3p);
+   f[D3Q27System::BSE] = (*d.BSE)(x1,x2p,x3p);
+   f[D3Q27System::BNW] = (*d.BNW)(x1p,x2,x3p);
+   f[D3Q27System::BNE] = (*d.BNE)(x1,x2,x3p);
+
+   f[D3Q27System::ZERO] = (*d.ZERO)(x1,x2,x3);
+}
+//////////////////////////////////////////////////////////////////////////
+void D3Q27EsoTwist3DSoA::setDistribution(const LBMReal* const f, size_t x1, size_t x2, size_t x3)
+{
+   size_t x1p = x1 + 1;
+   size_t x2p = x2 + 1;
+   size_t x3p = x3 + 1;
+
+   (*d.E)(x1,x2,x3)     = f[D3Q27System::INV_E];
+   (*d.N)(x1,x2,x3)     = f[D3Q27System::INV_N];
+   (*d.T)(x1,x2,x3)     = f[D3Q27System::INV_T];
+   (*d.NE)(x1,x2,x3)    = f[D3Q27System::INV_NE];
+   (*d.NW)(x1p,x2,x3)   = f[D3Q27System::INV_NW];
+   (*d.TE)(x1,x2,x3)    = f[D3Q27System::INV_TE];
+   (*d.TW)(x1p,x2,x3)   = f[D3Q27System::INV_TW];
+   (*d.TN)(x1,x2,x3)    = f[D3Q27System::INV_TN];
+   (*d.TS)(x1,x2p,x3)   = f[D3Q27System::INV_TS];
+   (*d.TNE)(x1,x2,x3)   = f[D3Q27System::INV_TNE];
+   (*d.TNW)(x1p,x2,x3)  = f[D3Q27System::INV_TNW];
+   (*d.TSE)(x1,x2p,x3)  = f[D3Q27System::INV_TSE];
+   (*d.TSW)(x1p,x2p,x3) = f[D3Q27System::INV_TSW];
+
+   (*d.W)(x1p,x2,x3)     = f[D3Q27System::INV_W ];
+   (*d.S)(x1,x2p,x3)     = f[D3Q27System::INV_S ];
+   (*d.B)(x1,x2,x3p)     = f[D3Q27System::INV_B ];
+   (*d.SW)(x1p,x2p,x3)   = f[D3Q27System::INV_SW];
+   (*d.SE)(x1,x2p,x3)    = f[D3Q27System::INV_SE];
+   (*d.BW)(x1p,x2,x3p)   = f[D3Q27System::INV_BW];
+   (*d.BE)(x1,x2,x3p)    = f[D3Q27System::INV_BE];
+   (*d.BS)(x1,x2p,x3p)   = f[D3Q27System::INV_BS];
+   (*d.BN)(x1,x2,x3p)    = f[D3Q27System::INV_BN];
+   (*d.BSW)(x1p,x2p,x3p) = f[D3Q27System::INV_BSW];
+   (*d.BSE)(x1,x2p,x3p)  = f[D3Q27System::INV_BSE];
+   (*d.BNW)(x1p,x2,x3p)  = f[D3Q27System::INV_BNW];
+   (*d.BNE)(x1,x2,x3p)   = f[D3Q27System::INV_BNE];
+
+   (*d.ZERO)(x1,x2,x3) = f[D3Q27System::ZERO];
+}
+//////////////////////////////////////////////////////////////////////////
+void D3Q27EsoTwist3DSoA::getDistributionInv(LBMReal* const f, size_t x1, size_t x2, size_t x3)
+{
+   f[D3Q27System::INV_E] = (*d.E)(x1,x2,x3);
+   f[D3Q27System::INV_N] = (*d.N)(x1,x2,x3);  
+   f[D3Q27System::INV_T] = (*d.T)(x1,x2,x3);
+   f[D3Q27System::INV_NE] = (*d.NE)(x1,x2,x3);
+   f[D3Q27System::INV_NW] = (*d.NW)(x1+1,x2,x3);
+   f[D3Q27System::INV_TE] = (*d.TE)(x1,x2,x3);
+   f[D3Q27System::INV_TW] = (*d.TW)(x1+1,x2,x3);
+   f[D3Q27System::INV_TN] = (*d.TN)(x1,x2,x3);
+   f[D3Q27System::INV_TS] = (*d.TS)(x1,x2+1,x3);
+   f[D3Q27System::INV_TNE] = (*d.TNE)(x1,x2,x3);
+   f[D3Q27System::INV_TNW] = (*d.TNW)(x1+1,x2,x3);
+   f[D3Q27System::INV_TSE] = (*d.TSE)(x1,x2+1,x3);
+   f[D3Q27System::INV_TSW] = (*d.TSW)(x1+1,x2+1,x3);
+
+   f[D3Q27System::INV_W ] = (*d.W)(x1+1,x2,x3  );
+   f[D3Q27System::INV_S ] = (*d.S)(x1,x2+1,x3  );
+   f[D3Q27System::INV_B ] = (*d.B)(x1,x2,x3+1  );
+   f[D3Q27System::INV_SW] = (*d.SW)(x1+1,x2+1,x3 );
+   f[D3Q27System::INV_SE] = (*d.SE)(x1,x2+1,x3 );
+   f[D3Q27System::INV_BW] = (*d.BW)(x1+1,x2,x3+1 );
+   f[D3Q27System::INV_BE] = (*d.BE)(x1,x2,x3+1 );
+   f[D3Q27System::INV_BS] = (*d.BS)(x1,x2+1,x3+1 );
+   f[D3Q27System::INV_BN] = (*d.BN)(x1,x2,x3+1 );
+   f[D3Q27System::INV_BSW] = (*d.BSW)(x1+1,x2+1,x3+1);
+   f[D3Q27System::INV_BSE] = (*d.BSE)(x1,x2+1,x3+1);
+   f[D3Q27System::INV_BNW] = (*d.BNW)(x1+1,x2,x3+1);
+   f[D3Q27System::INV_BNE] = (*d.BNE)(x1,x2,x3+1);
+
+   f[D3Q27System::ZERO] = (*d.ZERO)(x1,x2,x3);
+}
+//////////////////////////////////////////////////////////////////////////
+void D3Q27EsoTwist3DSoA::setDistributionInv(const LBMReal* const f, size_t x1, size_t x2, size_t x3)
+{
+   //(*this->localDistributions)(D3Q27System::ET_E,x1,  x2,  x3) = f[D3Q27System::E];
+   //(*this->localDistributions)(D3Q27System::ET_N,x1,  x2,  x3) = f[D3Q27System::N];
+   //(*this->localDistributions)(D3Q27System::ET_T,x1,  x2,  x3) = f[D3Q27System::T];
+   //(*this->localDistributions)(D3Q27System::ET_NE,x1,  x2,  x3) = f[D3Q27System::NE];
+   //(*this->localDistributions)(D3Q27System::ET_NW,x1+1,x2,  x3) = f[D3Q27System::NW];
+   //(*this->localDistributions)(D3Q27System::ET_TE,x1,  x2,  x3) = f[D3Q27System::TE];
+   //(*this->localDistributions)(D3Q27System::ET_TW,x1+1,x2,  x3) = f[D3Q27System::TW];
+   //(*this->localDistributions)(D3Q27System::ET_TN,x1,  x2,  x3) = f[D3Q27System::TN];
+   //(*this->localDistributions)(D3Q27System::ET_TS,x1,  x2+1,x3) = f[D3Q27System::TS];
+   //(*this->localDistributions)(D3Q27System::ET_TNE,x1,  x2,  x3) = f[D3Q27System::TNE];
+   //(*this->localDistributions)(D3Q27System::ET_TNW,x1+1,x2,  x3) = f[D3Q27System::TNW];
+   //(*this->localDistributions)(D3Q27System::ET_TSE,x1,  x2+1,x3) = f[D3Q27System::TSE];
+   //(*this->localDistributions)(D3Q27System::ET_TSW,x1+1,x2+1,x3) = f[D3Q27System::TSW];
+
+   //(*this->nonLocalDistributions)(D3Q27System::ET_W,x1+1,x2,  x3    ) = f[D3Q27System::W ];
+   //(*this->nonLocalDistributions)(D3Q27System::ET_S,x1,  x2+1,x3    ) = f[D3Q27System::S ];
+   //(*this->nonLocalDistributions)(D3Q27System::ET_B,x1,  x2,  x3+1  ) = f[D3Q27System::B ];
+   //(*this->nonLocalDistributions)(D3Q27System::ET_SW,x1+1,x2+1,x3   ) = f[D3Q27System::SW];
+   //(*this->nonLocalDistributions)(D3Q27System::ET_SE,x1,  x2+1,x3   ) = f[D3Q27System::SE];
+   //(*this->nonLocalDistributions)(D3Q27System::ET_BW,x1+1,x2,  x3+1 ) = f[D3Q27System::BW];
+   //(*this->nonLocalDistributions)(D3Q27System::ET_BE,x1,  x2,  x3+1 ) = f[D3Q27System::BE];
+   //(*this->nonLocalDistributions)(D3Q27System::ET_BS,x1,  x2+1,x3+1 ) = f[D3Q27System::BS];
+   //(*this->nonLocalDistributions)(D3Q27System::ET_BN,x1,  x2,  x3+1 ) = f[D3Q27System::BN];
+   //(*this->nonLocalDistributions)(D3Q27System::ET_BSW,x1+1,x2+1,x3+1) = f[D3Q27System::BSW];
+   //(*this->nonLocalDistributions)(D3Q27System::ET_BSE,x1,  x2+1,x3+1) = f[D3Q27System::BSE];
+   //(*this->nonLocalDistributions)(D3Q27System::ET_BNW,x1+1,x2,  x3+1) = f[D3Q27System::BNW];
+   //(*this->nonLocalDistributions)(D3Q27System::ET_BNE,x1,  x2,  x3+1) = f[D3Q27System::BNE];
+
+   //(*this->zeroDistributions)(x1,x2,x3) = f[D3Q27System::ZERO];
+}
+//////////////////////////////////////////////////////////////////////////
+void D3Q27EsoTwist3DSoA::setDistributionForDirection(const LBMReal* const f, size_t x1, size_t x2, size_t x3, unsigned long int direction)
+{
+   //bool directionFlag = false;
+   //if ((direction & EsoTwistD3Q27System::etE) == EsoTwistD3Q27System::etE)
+   //   (*this->nonLocalDistributions)(D3Q27System::ET_W,x1+1,x2,  x3    ) = f[D3Q27System::E]; directionFlag=true;
+   //if ((direction & EsoTwistD3Q27System::etW) == EsoTwistD3Q27System::etW)
+   //   (*this->localDistributions)(D3Q27System::ET_E,x1,  x2,  x3) = f[D3Q27System::W]; directionFlag=true;
+   //if ((direction & EsoTwistD3Q27System::etS) == EsoTwistD3Q27System::etS)
+   //   (*this->localDistributions)(D3Q27System::ET_N,x1,  x2,  x3) = f[D3Q27System::S]; directionFlag=true;
+   //if ((direction & EsoTwistD3Q27System::etN) == EsoTwistD3Q27System::etN)
+   //   (*this->nonLocalDistributions)(D3Q27System::ET_S,x1,  x2+1,x3    ) = f[D3Q27System::N]; directionFlag=true;
+   //if ((direction & EsoTwistD3Q27System::etB) == EsoTwistD3Q27System::etB)
+   //   (*this->localDistributions)(D3Q27System::ET_T,x1,  x2,  x3) = f[D3Q27System::B]; directionFlag=true;
+   //if ((direction & EsoTwistD3Q27System::etT) == EsoTwistD3Q27System::etT)
+   //   (*this->nonLocalDistributions)(D3Q27System::ET_B,x1,  x2,  x3+1  ) = f[D3Q27System::T]; directionFlag=true;
+   //if ((direction & EsoTwistD3Q27System::etSW) == EsoTwistD3Q27System::etSW)
+   //   (*this->localDistributions)(D3Q27System::ET_NE,x1,  x2,  x3) = f[D3Q27System::SW]; directionFlag=true;
+   //if ((direction & EsoTwistD3Q27System::etNE) == EsoTwistD3Q27System::etNE)
+   //   (*this->nonLocalDistributions)(D3Q27System::ET_SW,x1+1,x2+1,x3   ) = f[D3Q27System::NE]; directionFlag=true;
+   //if ((direction & EsoTwistD3Q27System::etNW) == EsoTwistD3Q27System::etNW)
+   //   (*this->nonLocalDistributions)(D3Q27System::ET_SE,x1,  x2+1,x3   ) = f[D3Q27System::NW]; directionFlag=true;
+   //if ((direction & EsoTwistD3Q27System::etSE) == EsoTwistD3Q27System::etSE)
+   //   (*this->localDistributions)(D3Q27System::ET_NW,x1+1,x2,  x3) = f[D3Q27System::SE]; directionFlag=true;
+   //if ((direction & EsoTwistD3Q27System::etBW) == EsoTwistD3Q27System::etBW)
+   //   (*this->localDistributions)(D3Q27System::ET_TE,x1,  x2,  x3) = f[D3Q27System::BW]; directionFlag=true;
+   //if ((direction & EsoTwistD3Q27System::etTE) == EsoTwistD3Q27System::etTE)
+   //   (*this->nonLocalDistributions)(D3Q27System::ET_BW,x1+1,x2,  x3+1 ) = f[D3Q27System::TE]; directionFlag=true;
+   //if ((direction & EsoTwistD3Q27System::etTW) == EsoTwistD3Q27System::etTW)
+   //   (*this->nonLocalDistributions)(D3Q27System::ET_BE,x1,  x2,  x3+1 ) = f[D3Q27System::TW]; directionFlag=true;
+   //if ((direction & EsoTwistD3Q27System::etBE) == EsoTwistD3Q27System::etBE)
+   //   (*this->localDistributions)(D3Q27System::ET_TW,x1+1,x2,  x3) = f[D3Q27System::BE]; directionFlag=true;
+   //if ((direction & EsoTwistD3Q27System::etBS) == EsoTwistD3Q27System::etBS)
+   //   (*this->localDistributions)(D3Q27System::ET_TN,x1,  x2,  x3) = f[D3Q27System::BS]; directionFlag=true;
+   //if ((direction & EsoTwistD3Q27System::etTN) == EsoTwistD3Q27System::etTN)
+   //   (*this->nonLocalDistributions)(D3Q27System::ET_BS,x1,  x2+1,x3+1 ) = f[D3Q27System::TN]; directionFlag=true;
+   //if ((direction & EsoTwistD3Q27System::etTS) == EsoTwistD3Q27System::etTS)
+   //   (*this->nonLocalDistributions)(D3Q27System::ET_BN,x1,  x2,  x3+1 ) = f[D3Q27System::TS]; directionFlag=true;
+   //if ((direction & EsoTwistD3Q27System::etBN) == EsoTwistD3Q27System::etBN)
+   //   (*this->localDistributions)(D3Q27System::ET_TS,x1,  x2+1,x3) = f[D3Q27System::BN]; directionFlag=true;
+   //if ((direction & EsoTwistD3Q27System::etBSW) == EsoTwistD3Q27System::etBSW)
+   //   (*this->localDistributions)(D3Q27System::ET_TNE,x1,  x2,  x3) = f[D3Q27System::BSW]; directionFlag=true;
+   //if ((direction & EsoTwistD3Q27System::etTNE) == EsoTwistD3Q27System::etTNE)
+   //   (*this->nonLocalDistributions)(D3Q27System::ET_BSW,x1+1,x2+1,x3+1) = f[D3Q27System::TNE]; directionFlag=true;
+   //if ((direction & EsoTwistD3Q27System::etBSE) == EsoTwistD3Q27System::etBSE)
+   //   (*this->localDistributions)(D3Q27System::ET_TNW,x1+1,x2,  x3) = f[D3Q27System::BSE]; directionFlag=true;
+   //if ((direction & EsoTwistD3Q27System::etTNW) == EsoTwistD3Q27System::etTNW)
+   //   (*this->nonLocalDistributions)(D3Q27System::ET_BSE,x1,  x2+1,x3+1) = f[D3Q27System::TNW]; directionFlag=true;
+   //if ((direction & EsoTwistD3Q27System::etBNW) == EsoTwistD3Q27System::etBNW)
+   //   (*this->localDistributions)(D3Q27System::ET_TSE,x1,  x2+1,x3) = f[D3Q27System::BNW]; directionFlag=true;
+   //if ((direction & EsoTwistD3Q27System::etTSE) == EsoTwistD3Q27System::etTSE)
+   //   (*this->nonLocalDistributions)(D3Q27System::ET_BNW,x1+1,x2,  x3+1) = f[D3Q27System::TSE]; directionFlag=true;
+   //if ((direction & EsoTwistD3Q27System::etBNE) == EsoTwistD3Q27System::etBNE)
+   //   (*this->localDistributions)(D3Q27System::ET_TSW,x1+1,x2+1,x3) = f[D3Q27System::BNE]; directionFlag=true;
+   //if ((direction & EsoTwistD3Q27System::etTSW) == EsoTwistD3Q27System::etTSW)
+   //   (*this->nonLocalDistributions)(D3Q27System::ET_BNE,x1,  x2,  x3+1) = f[D3Q27System::TSW]; directionFlag=true;
+   //if ((direction & EsoTwistD3Q27System::ZERO) == EsoTwistD3Q27System::ZERO)
+   //   (*this->zeroDistributions)(x1,x2,x3) = f[D3Q27System::ZERO]; directionFlag=true;
+//#ifdef _DEBUG
+//   if(!directionFlag)UB_THROW( UbException(UB_EXARGS, "Direction didn't find") );
+//#endif //DEBUG
+}
+//////////////////////////////////////////////////////////////////////////
+void D3Q27EsoTwist3DSoA::setDistributionForDirection(LBMReal f, size_t x1, size_t x2, size_t x3, int direction)
+{
+   //switch (direction)
+   //{
+   //case D3Q27System::E :
+   //   (*this->nonLocalDistributions)(D3Q27System::ET_W,x1+1,x2,  x3    ) = f;
+   //   break;
+   //case D3Q27System::W :
+   //   (*this->localDistributions)(D3Q27System::ET_E,x1,  x2,  x3) = f;
+   //   break;
+   //case D3Q27System::S :
+   //   (*this->localDistributions)(D3Q27System::ET_N,x1,  x2,  x3) = f;
+   //   break;
+   //case D3Q27System::N :
+   //   (*this->nonLocalDistributions)(D3Q27System::ET_S,x1,  x2+1,x3    ) = f;
+   //   break;
+   //case D3Q27System::B :
+   //   (*this->localDistributions)(D3Q27System::ET_T,x1,  x2,  x3) = f;
+   //   break;
+   //case D3Q27System::T :
+   //   (*this->nonLocalDistributions)(D3Q27System::ET_B,x1,  x2,  x3+1  ) = f;
+   //   break;
+   //case D3Q27System::SW :
+   //   (*this->localDistributions)(D3Q27System::ET_NE,x1,  x2,  x3) = f;
+   //   break;
+   //case D3Q27System::NE :
+   //   (*this->nonLocalDistributions)(D3Q27System::ET_SW,x1+1,x2+1,x3   ) = f;
+   //   break;
+   //case D3Q27System::NW :
+   //   (*this->nonLocalDistributions)(D3Q27System::ET_SE,x1,  x2+1,x3   ) = f;
+   //   break;
+   //case D3Q27System::SE :
+   //   (*this->localDistributions)(D3Q27System::ET_NW,x1+1,x2,  x3) = f;
+   //   break;
+   //case D3Q27System::BW :
+   //   (*this->localDistributions)(D3Q27System::ET_TE,x1,  x2,  x3) = f;
+   //   break;
+   //case D3Q27System::TE :
+   //   (*this->nonLocalDistributions)(D3Q27System::ET_BW,x1+1,x2,  x3+1 ) = f;
+   //   break;
+   //case D3Q27System::TW :
+   //   (*this->nonLocalDistributions)(D3Q27System::ET_BE,x1,  x2,  x3+1 ) = f;
+   //   break;
+   //case D3Q27System::BE :
+   //   (*this->localDistributions)(D3Q27System::ET_TW,x1+1,x2,  x3) = f;
+   //   break;
+   //case D3Q27System::BS :
+   //   (*this->localDistributions)(D3Q27System::ET_TN,x1,  x2,  x3) = f;
+   //   break;
+   //case D3Q27System::TN :
+   //   (*this->nonLocalDistributions)(D3Q27System::ET_BS,x1,  x2+1,x3+1 ) = f;
+   //   break;
+   //case D3Q27System::TS :
+   //   (*this->nonLocalDistributions)(D3Q27System::ET_BN,x1,  x2,  x3+1 ) = f;
+   //   break;
+   //case D3Q27System::BN :
+   //   (*this->localDistributions)(D3Q27System::ET_TS,x1,  x2+1,x3) = f;
+   //   break;
+   //case D3Q27System::BSW :
+   //   (*this->localDistributions)(D3Q27System::ET_TNE,x1,  x2,  x3) = f;
+   //   break;
+   //case D3Q27System::TNE :
+   //   (*this->nonLocalDistributions)(D3Q27System::ET_BSW,x1+1,x2+1,x3+1) = f;
+   //   break;
+   //case D3Q27System::BSE :
+   //   (*this->localDistributions)(D3Q27System::ET_TNW,x1+1,x2,  x3) = f;
+   //   break;
+   //case D3Q27System::TNW :
+   //   (*this->nonLocalDistributions)(D3Q27System::ET_BSE,x1,  x2+1,x3+1) = f;
+   //   break;
+   //case D3Q27System::BNW :
+   //   (*this->localDistributions)(D3Q27System::ET_TSE,x1,  x2+1,x3) = f;
+   //   break;
+   //case D3Q27System::TSE :
+   //   (*this->nonLocalDistributions)(D3Q27System::ET_BNW,x1+1,x2,  x3+1) = f;
+   //   break;
+   //case D3Q27System::BNE :
+   //   (*this->localDistributions)(D3Q27System::ET_TSW,x1+1,x2+1,x3) = f;
+   //   break;
+   //case D3Q27System::TSW :
+   //   (*this->nonLocalDistributions)(D3Q27System::ET_BNE,x1,  x2,  x3+1) = f;
+   //   break;
+   //case D3Q27System::ZERO :
+   //   (*this->zeroDistributions)(x1,x2,x3) = f;
+   //   break;
+   //default:
+   //   UB_THROW( UbException(UB_EXARGS, "Direction didn't find") );     
+   //}
+}
+//////////////////////////////////////////////////////////////////////////
+void D3Q27EsoTwist3DSoA::setDistributionInvForDirection(const LBMReal* const f, size_t x1, size_t x2, size_t x3, unsigned long int direction)
+{
+//   bool directionFlag = false;
+//   if ((direction & EsoTwistD3Q27System::etE) == EsoTwistD3Q27System::etE)
+//      (*this->localDistributions)(D3Q27System::ET_E,x1,  x2,  x3) = f[D3Q27System::E]; directionFlag=true;
+//   if ((direction & EsoTwistD3Q27System::etW) == EsoTwistD3Q27System::etW)
+//      (*this->nonLocalDistributions)(D3Q27System::ET_W,x1+1,x2,  x3    ) = f[D3Q27System::W]; directionFlag=true;
+//   if ((direction & EsoTwistD3Q27System::etS) == EsoTwistD3Q27System::etS)
+//      (*this->nonLocalDistributions)(D3Q27System::ET_S,x1,  x2+1,x3    ) = f[D3Q27System::S]; directionFlag=true;
+//   if ((direction & EsoTwistD3Q27System::etN) == EsoTwistD3Q27System::etN)
+//      (*this->localDistributions)(D3Q27System::ET_N,x1,  x2,  x3) = f[D3Q27System::N]; directionFlag=true;
+//   if ((direction & EsoTwistD3Q27System::etB) == EsoTwistD3Q27System::etB)
+//      (*this->nonLocalDistributions)(D3Q27System::ET_B,x1,  x2,  x3+1  ) = f[D3Q27System::B]; directionFlag=true;
+//   if ((direction & EsoTwistD3Q27System::etT) == EsoTwistD3Q27System::etT)
+//      (*this->localDistributions)(D3Q27System::ET_T,x1,  x2,  x3) = f[D3Q27System::T]; directionFlag=true;
+//   if ((direction & EsoTwistD3Q27System::etSW) == EsoTwistD3Q27System::etSW)
+//      (*this->nonLocalDistributions)(D3Q27System::ET_SW,x1+1,x2+1,x3   ) = f[D3Q27System::SW]; directionFlag=true;
+//   if ((direction & EsoTwistD3Q27System::etNE) == EsoTwistD3Q27System::etNE)
+//      (*this->localDistributions)(D3Q27System::ET_NE,x1,  x2,  x3) = f[D3Q27System::NE]; directionFlag=true;
+//   if ((direction & EsoTwistD3Q27System::etNW) == EsoTwistD3Q27System::etNW)
+//      (*this->localDistributions)(D3Q27System::ET_NW,x1+1,x2,  x3) = f[D3Q27System::NW]; directionFlag=true;
+//   if ((direction & EsoTwistD3Q27System::etSE) == EsoTwistD3Q27System::etSE)
+//      (*this->nonLocalDistributions)(D3Q27System::ET_SE,x1,  x2+1,x3   ) = f[D3Q27System::SE]; directionFlag=true;
+//   if ((direction & EsoTwistD3Q27System::etBW) == EsoTwistD3Q27System::etBW)
+//      (*this->nonLocalDistributions)(D3Q27System::ET_BW,x1+1,x2,  x3+1 ) = f[D3Q27System::BW]; directionFlag=true;
+//   if ((direction & EsoTwistD3Q27System::etTE) == EsoTwistD3Q27System::etTE)
+//      (*this->localDistributions)(D3Q27System::ET_TE,x1,  x2,  x3) = f[D3Q27System::TE]; directionFlag=true;
+//   if ((direction & EsoTwistD3Q27System::etTW) == EsoTwistD3Q27System::etTW)
+//      (*this->localDistributions)(D3Q27System::ET_TW,x1+1,x2,  x3) = f[D3Q27System::TW]; directionFlag=true;
+//   if ((direction & EsoTwistD3Q27System::etBE) == EsoTwistD3Q27System::etBE)
+//      (*this->nonLocalDistributions)(D3Q27System::ET_BE,x1,  x2,  x3+1 ) = f[D3Q27System::BE]; directionFlag=true;
+//   if ((direction & EsoTwistD3Q27System::etBS) == EsoTwistD3Q27System::etBS)
+//      (*this->nonLocalDistributions)(D3Q27System::ET_BS,x1,  x2+1,x3+1 ) = f[D3Q27System::BS]; directionFlag=true;
+//   if ((direction & EsoTwistD3Q27System::etTN) == EsoTwistD3Q27System::etTN)
+//      (*this->localDistributions)(D3Q27System::ET_TN,x1,  x2,  x3) = f[D3Q27System::TN]; directionFlag=true;
+//   if ((direction & EsoTwistD3Q27System::etTS) == EsoTwistD3Q27System::etTS)
+//      (*this->localDistributions)(D3Q27System::ET_TS,x1,  x2+1,x3) = f[D3Q27System::TS]; directionFlag=true;
+//   if ((direction & EsoTwistD3Q27System::etBN) == EsoTwistD3Q27System::etBN)
+//      (*this->nonLocalDistributions)(D3Q27System::ET_BN,x1,  x2,  x3+1 ) = f[D3Q27System::BN]; directionFlag=true;
+//   if ((direction & EsoTwistD3Q27System::etBSW) == EsoTwistD3Q27System::etBSW)
+//      (*this->nonLocalDistributions)(D3Q27System::ET_BSW,x1+1,x2+1,x3+1) = f[D3Q27System::BSW]; directionFlag=true;
+//   if ((direction & EsoTwistD3Q27System::etTNE) == EsoTwistD3Q27System::etTNE)
+//      (*this->localDistributions)(D3Q27System::ET_TNE,x1,  x2,  x3) = f[D3Q27System::TNE]; directionFlag=true;
+//   if ((direction & EsoTwistD3Q27System::etBSE) == EsoTwistD3Q27System::etBSE)
+//      (*this->nonLocalDistributions)(D3Q27System::ET_BSE,x1,  x2+1,x3+1) = f[D3Q27System::BSE]; directionFlag=true;
+//   if ((direction & EsoTwistD3Q27System::etTNW) == EsoTwistD3Q27System::etTNW)
+//      (*this->localDistributions)(D3Q27System::ET_TNW,x1+1,x2,  x3) = f[D3Q27System::TNW]; directionFlag=true;
+//   if ((direction & EsoTwistD3Q27System::etBNW) == EsoTwistD3Q27System::etBNW)
+//      (*this->nonLocalDistributions)(D3Q27System::ET_BNW,x1+1,x2,  x3+1) = f[D3Q27System::BNW]; directionFlag=true;
+//   if ((direction & EsoTwistD3Q27System::etTSE) == EsoTwistD3Q27System::etTSE)
+//      (*this->localDistributions)(D3Q27System::ET_TSE,x1,  x2+1,x3) = f[D3Q27System::TSE]; directionFlag=true;
+//   if ((direction & EsoTwistD3Q27System::etBNE) == EsoTwistD3Q27System::etBNE)
+//      (*this->nonLocalDistributions)(D3Q27System::ET_BNE,x1,  x2,  x3+1)= f[D3Q27System::BNE]; directionFlag=true;
+//   if ((direction & EsoTwistD3Q27System::etTSW) == EsoTwistD3Q27System::etTSW)
+//      (*this->localDistributions)(D3Q27System::ET_TSW,x1+1,x2+1,x3) = f[D3Q27System::TSW]; directionFlag=true;
+//   if ((direction & EsoTwistD3Q27System::ZERO) == EsoTwistD3Q27System::ZERO)
+//      (*this->zeroDistributions)(x1,x2,x3) = f[D3Q27System::ZERO]; directionFlag=true;
+//#ifdef _DEBUG
+//   if(!directionFlag)UB_THROW( UbException(UB_EXARGS, "Direction didn't find") );
+//#endif //DEBUG
+}
+//////////////////////////////////////////////////////////////////////////
+void D3Q27EsoTwist3DSoA::setDistributionInvForDirection(LBMReal f, size_t x1, size_t x2, size_t x3, unsigned long int direction)
+{
+   //switch (direction)
+   //{
+   //case D3Q27System::E :
+   //   (*this->localDistributions)(D3Q27System::ET_E,x1,  x2,  x3) = f;
+   //   break;
+   //case D3Q27System::W :
+   //   (*this->nonLocalDistributions)(D3Q27System::ET_W,x1+1,x2,  x3    ) = f;
+   //   break;
+   //case D3Q27System::S :
+   //   (*this->nonLocalDistributions)(D3Q27System::ET_S,x1,  x2+1,x3    ) = f;
+   //   break;
+   //case D3Q27System::N :
+   //   (*this->localDistributions)(D3Q27System::ET_N,x1,  x2,  x3) = f;
+   //   break;
+   //case D3Q27System::B :
+   //   (*this->nonLocalDistributions)(D3Q27System::ET_B,x1,  x2,  x3+1  ) = f;
+   //   break;
+   //case D3Q27System::T :
+   //   (*this->localDistributions)(D3Q27System::ET_T,x1,  x2,  x3) = f;
+   //   break;
+   //case D3Q27System::SW :
+   //   (*this->nonLocalDistributions)(D3Q27System::ET_SW,x1+1,x2+1,x3   ) = f;
+   //   break;
+   //case D3Q27System::NE :
+   //   (*this->localDistributions)(D3Q27System::ET_NE,x1,  x2,  x3) = f;
+   //   break;
+   //case D3Q27System::NW :
+   //   (*this->localDistributions)(D3Q27System::ET_NW,x1+1,x2,  x3) = f;
+   //   break;
+   //case D3Q27System::SE :
+   //   (*this->nonLocalDistributions)(D3Q27System::ET_SE,x1,  x2+1,x3   ) = f;
+   //   break;
+   //case D3Q27System::BW :
+   //   (*this->nonLocalDistributions)(D3Q27System::ET_BW,x1+1,x2,  x3+1 ) = f;
+   //   break;
+   //case D3Q27System::TE :
+   //   (*this->localDistributions)(D3Q27System::ET_TE,x1,  x2,  x3) = f;
+   //   break;
+   //case D3Q27System::TW :
+   //   (*this->localDistributions)(D3Q27System::ET_TW,x1+1,x2,  x3) = f;
+   //   break;
+   //case D3Q27System::BE :
+   //   (*this->nonLocalDistributions)(D3Q27System::ET_BE,x1,  x2,  x3+1 ) = f;
+   //   break;
+   //case D3Q27System::BS :
+   //   (*this->nonLocalDistributions)(D3Q27System::ET_BS,x1,  x2+1,x3+1 ) = f;
+   //   break;
+   //case D3Q27System::TN :
+   //   (*this->localDistributions)(D3Q27System::ET_TN,x1,  x2,  x3) = f;
+   //   break;
+   //case D3Q27System::TS :
+   //   (*this->localDistributions)(D3Q27System::ET_TS,x1,  x2+1,x3) = f;
+   //   break;
+   //case D3Q27System::BN :
+   //   (*this->nonLocalDistributions)(D3Q27System::ET_BN,x1,  x2,  x3+1 ) = f;
+   //   break;
+   //case D3Q27System::BSW :
+   //   (*this->nonLocalDistributions)(D3Q27System::ET_BSW,x1+1,x2+1,x3+1) = f;
+   //   break;
+   //case D3Q27System::TNE :
+   //   (*this->localDistributions)(D3Q27System::ET_TNE,x1,  x2,  x3) = f;
+   //   break;
+   //case D3Q27System::BSE :
+   //   (*this->nonLocalDistributions)(D3Q27System::ET_BSE,x1,  x2+1,x3+1) = f;
+   //   break;
+   //case D3Q27System::TNW :
+   //   (*this->localDistributions)(D3Q27System::ET_TNW,x1+1,x2,  x3) = f;
+   //   break;
+   //case D3Q27System::BNW :
+   //   (*this->nonLocalDistributions)(D3Q27System::ET_BNW,x1+1,x2,  x3+1) = f;
+   //   break;
+   //case D3Q27System::TSE :
+   //   (*this->localDistributions)(D3Q27System::ET_TSE,x1,  x2+1,x3) = f;
+   //   break;
+   //case D3Q27System::BNE :
+   //   (*this->nonLocalDistributions)(D3Q27System::ET_BNE,x1,  x2,  x3+1) = f;
+   //   break;
+   //case D3Q27System::TSW :
+   //   (*this->localDistributions)(D3Q27System::ET_TSW,x1+1,x2+1,x3) = f;
+   //   break;
+   //case D3Q27System::ZERO :
+   //   (*this->zeroDistributions)(x1,x2,x3) = f;
+   //   break;
+   //default:
+   //   UB_THROW( UbException(UB_EXARGS, "Direction didn't find") );     
+   //}
+}
+//////////////////////////////////////////////////////////////////////////
+LBMReal D3Q27EsoTwist3DSoA::getDistributionInvForDirection(size_t x1, size_t x2, size_t x3, int direction)
+{
+   //switch (direction)
+   //{
+   //case D3Q27System::E :
+   //   return (*this->nonLocalDistributions)(D3Q27System::ET_W,x1+1,x2,  x3    );
+   //case D3Q27System::W :
+   //   return (*this->localDistributions)(D3Q27System::ET_E,x1,  x2,  x3);
+   //case D3Q27System::S :
+   //   return (*this->localDistributions)(D3Q27System::ET_N,x1,  x2,  x3);
+   //case D3Q27System::N :
+   //   return (*this->nonLocalDistributions)(D3Q27System::ET_S,x1,  x2+1,x3    );
+   //case D3Q27System::B :
+   //   return (*this->localDistributions)(D3Q27System::ET_T,x1,  x2,  x3);
+   //case D3Q27System::T :
+   //   return (*this->nonLocalDistributions)(D3Q27System::ET_B,x1,  x2,  x3+1  );
+   //case D3Q27System::SW :
+   //   return (*this->localDistributions)(D3Q27System::ET_NE,x1,  x2,  x3);
+   //case D3Q27System::NE :
+   //   return (*this->nonLocalDistributions)(D3Q27System::ET_SW,x1+1,x2+1,x3   );
+   //case D3Q27System::NW :
+   //   return (*this->nonLocalDistributions)(D3Q27System::ET_SE,x1,  x2+1,x3   );
+   //case D3Q27System::SE :
+   //   return (*this->localDistributions)(D3Q27System::ET_NW,x1+1,x2,  x3);
+   //case D3Q27System::BW :
+   //   return (*this->localDistributions)(D3Q27System::ET_TE,x1,  x2,  x3);
+   //case D3Q27System::TE :
+   //   return (*this->nonLocalDistributions)(D3Q27System::ET_BW,x1+1,x2,  x3+1 );
+   //case D3Q27System::TW :
+   //   return (*this->nonLocalDistributions)(D3Q27System::ET_BE,x1,  x2,  x3+1 );
+   //case D3Q27System::BE :
+   //   return (*this->localDistributions)(D3Q27System::ET_TW,x1+1,x2,  x3);
+   //case D3Q27System::BS :
+   //   return (*this->localDistributions)(D3Q27System::ET_TN,x1,  x2,  x3);
+   //case D3Q27System::TN :
+   //   return (*this->nonLocalDistributions)(D3Q27System::ET_BS,x1,  x2+1,x3+1 );
+   //case D3Q27System::TS :
+   //   return (*this->nonLocalDistributions)(D3Q27System::ET_BN,x1,  x2,  x3+1 );
+   //case D3Q27System::BN :
+   //   return (*this->localDistributions)(D3Q27System::ET_TS,x1,  x2+1,x3);
+   //case D3Q27System::BSW :
+   //   return (*this->localDistributions)(D3Q27System::ET_TNE,x1,  x2,  x3);
+   //case D3Q27System::TNE :
+   //   return (*this->nonLocalDistributions)(D3Q27System::ET_BSW,x1+1,x2+1,x3+1);
+   //case D3Q27System::BSE :
+   //   return (*this->localDistributions)(D3Q27System::ET_TNW,x1+1,x2,  x3);
+   //case D3Q27System::TNW :
+   //   return (*this->nonLocalDistributions)(D3Q27System::ET_BSE,x1,  x2+1,x3+1);
+   //case D3Q27System::BNW :
+   //   return (*this->localDistributions)(D3Q27System::ET_TSE,x1,  x2+1,x3);
+   //case D3Q27System::TSE :
+   //   return (*this->nonLocalDistributions)(D3Q27System::ET_BNW,x1+1,x2,  x3+1);
+   //case D3Q27System::BNE :
+   //   return (*this->localDistributions)(D3Q27System::ET_TSW,x1+1,x2+1,x3);
+   //case D3Q27System::TSW :
+   //   return (*this->nonLocalDistributions)(D3Q27System::ET_BNE,x1,  x2,  x3+1);
+   //case D3Q27System::ZERO :
+   //   return (*this->zeroDistributions)(x1,x2,x3);
+   //default:
+   //   UB_THROW( UbException(UB_EXARGS, "Direction didn't find") );     
+   //}
+   return 0;
+}
+//////////////////////////////////////////////////////////////////////////
+size_t D3Q27EsoTwist3DSoA::getNX1() const
+{
+   return NX1;
+}
+//////////////////////////////////////////////////////////////////////////
+size_t D3Q27EsoTwist3DSoA::getNX2() const
+{
+   return NX2;
+}
+//////////////////////////////////////////////////////////////////////////
+size_t D3Q27EsoTwist3DSoA::getNX3() const
+{
+   return NX3;
+}
+//////////////////////////////////////////////////////////////////////////
+Distributions D3Q27EsoTwist3DSoA::getDistributions()
+{
+   return d;
+}
+//////////////////////////////////////////////////////////////////////////
+
diff --git a/src/cpu/VirtualFluidsCore/Data/D3Q27EsoTwist3DSoA.h b/src/cpu/VirtualFluidsCore/Data/D3Q27EsoTwist3DSoA.h
index 94e362c2b3d3af0bcc1b6035493d9c0c93b1fa29..252311bffb7bf1779822c2d911e9d456c4b85e6d 100644
--- a/src/cpu/VirtualFluidsCore/Data/D3Q27EsoTwist3DSoA.h
+++ b/src/cpu/VirtualFluidsCore/Data/D3Q27EsoTwist3DSoA.h
@@ -1,91 +1,91 @@
-#ifndef D3Q27EsoTwist3DSoA_h
-#define D3Q27EsoTwist3DSoA_h
-
-#include "EsoTwist3D.h"
-//#include "D3Q27System.h"
-//#include "basics/container/CbArray4D.h"
-#include <basics/container/CbArray3D.h>
-//#include <boost/serialization/serialization.hpp>
-//#include <boost/serialization/base_object.hpp>
-
-
-struct Distributions
-{
-   CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr E;
-   CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr W;
-   CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr N;
-   CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr S;
-   CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr T;
-   CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr B;
-   CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr NE;
-   CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr SW;
-   CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr SE;
-   CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr NW;
-   CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr TE;
-   CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr BW;
-   CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr BE;
-   CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr TW;
-   CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr TN;
-   CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr BS;
-   CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr BN;
-   CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr TS;
-   CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr TNE;
-   CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr TNW;
-   CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr TSE;
-   CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr TSW;
-   CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr BNE;
-   CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr BNW;
-   CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr BSE;
-   CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr BSW;
-   CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr ZERO;
-};
-
-
-class D3Q27EsoTwist3DSoA : public EsoTwist3D
-{
-public:
-   D3Q27EsoTwist3DSoA();
-   D3Q27EsoTwist3DSoA(const size_t& nx1, const size_t& nx2, const size_t& nx3, LBMReal value);
-   //////////////////////////////////////////////////////////////////////////
-   ~D3Q27EsoTwist3DSoA();
-   //////////////////////////////////////////////////////////////////////////
-   void swap();
-   //////////////////////////////////////////////////////////////////////////
-   virtual void getDistribution( LBMReal* const f, size_t x1, size_t x2, size_t x3);
-   //////////////////////////////////////////////////////////////////////////
-   virtual void setDistribution(const LBMReal* const f, size_t x1, size_t x2, size_t x3);
-   ////////////////////////////////////////////////////////////////////////
-   virtual void getDistributionInv( LBMReal* const f, size_t x1, size_t x2, size_t x3);
-   //////////////////////////////////////////////////////////////////////////
-   virtual void setDistributionInv(const LBMReal* const f, size_t x1, size_t x2, size_t x3);
-   //////////////////////////////////////////////////////////////////////////
-   virtual void setDistributionForDirection(const LBMReal* const f, size_t x1, size_t x2, size_t x3, unsigned long int direction);
-   //////////////////////////////////////////////////////////////////////////
-   virtual void setDistributionForDirection(LBMReal f, size_t x1, size_t x2, size_t x3, int direction);
-   //////////////////////////////////////////////////////////////////////////
-   virtual LBMReal getDistributionInvForDirection(size_t x1, size_t x2, size_t x3, int direction);
-   //////////////////////////////////////////////////////////////////////////
-   virtual void setDistributionInvForDirection(const LBMReal* const f, size_t x1, size_t x2, size_t x3, unsigned long int direction);
-   //////////////////////////////////////////////////////////////////////////
-   virtual void setDistributionInvForDirection(LBMReal f, size_t x1, size_t x2, size_t x3, unsigned long int direction);
-   //////////////////////////////////////////////////////////////////////////
-   virtual LBMReal getDistributionForDirection(size_t x1, size_t x2, size_t x3, int direction);
-   //////////////////////////////////////////////////////////////////////////
-   size_t getNX1() const;
-   //////////////////////////////////////////////////////////////////////////
-   size_t getNX2() const;
-   //////////////////////////////////////////////////////////////////////////
-   size_t getNX3() const;
-   //////////////////////////////////////////////////////////////////////////
-   Distributions getDistributions();
-   //////////////////////////////////////////////////////////////////////////
-   void getDistributionAfterLastStep(LBMReal* const f, size_t x1, size_t x2, size_t x3);
-
-protected:
-   Distributions d;
-   size_t NX1, NX2, NX3;
-
-};
-
-#endif
-
+#ifndef D3Q27EsoTwist3DSoA_h
+#define D3Q27EsoTwist3DSoA_h
+
+#include "EsoTwist3D.h"
+//#include "D3Q27System.h"
+//#include "basics/container/CbArray4D.h"
+#include <basics/container/CbArray3D.h>
+//#include <boost/serialization/serialization.hpp>
+//#include <boost/serialization/base_object.hpp>
+
+
+struct Distributions
+{
+   CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr E;
+   CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr W;
+   CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr N;
+   CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr S;
+   CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr T;
+   CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr B;
+   CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr NE;
+   CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr SW;
+   CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr SE;
+   CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr NW;
+   CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr TE;
+   CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr BW;
+   CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr BE;
+   CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr TW;
+   CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr TN;
+   CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr BS;
+   CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr BN;
+   CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr TS;
+   CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr TNE;
+   CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr TNW;
+   CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr TSE;
+   CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr TSW;
+   CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr BNE;
+   CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr BNW;
+   CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr BSE;
+   CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr BSW;
+   CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr ZERO;
+};
+
+
+class D3Q27EsoTwist3DSoA : public EsoTwist3D
+{
+public:
+   D3Q27EsoTwist3DSoA();
+   D3Q27EsoTwist3DSoA(const size_t& nx1, const size_t& nx2, const size_t& nx3, LBMReal value);
+   //////////////////////////////////////////////////////////////////////////
+   ~D3Q27EsoTwist3DSoA();
+   //////////////////////////////////////////////////////////////////////////
+   void swap();
+   //////////////////////////////////////////////////////////////////////////
+   virtual void getDistribution( LBMReal* const f, size_t x1, size_t x2, size_t x3);
+   //////////////////////////////////////////////////////////////////////////
+   virtual void setDistribution(const LBMReal* const f, size_t x1, size_t x2, size_t x3);
+   ////////////////////////////////////////////////////////////////////////
+   virtual void getDistributionInv( LBMReal* const f, size_t x1, size_t x2, size_t x3);
+   //////////////////////////////////////////////////////////////////////////
+   virtual void setDistributionInv(const LBMReal* const f, size_t x1, size_t x2, size_t x3);
+   //////////////////////////////////////////////////////////////////////////
+   virtual void setDistributionForDirection(const LBMReal* const f, size_t x1, size_t x2, size_t x3, unsigned long int direction);
+   //////////////////////////////////////////////////////////////////////////
+   virtual void setDistributionForDirection(LBMReal f, size_t x1, size_t x2, size_t x3, int direction);
+   //////////////////////////////////////////////////////////////////////////
+   virtual LBMReal getDistributionInvForDirection(size_t x1, size_t x2, size_t x3, int direction);
+   //////////////////////////////////////////////////////////////////////////
+   virtual void setDistributionInvForDirection(const LBMReal* const f, size_t x1, size_t x2, size_t x3, unsigned long int direction);
+   //////////////////////////////////////////////////////////////////////////
+   virtual void setDistributionInvForDirection(LBMReal f, size_t x1, size_t x2, size_t x3, unsigned long int direction);
+   //////////////////////////////////////////////////////////////////////////
+   virtual LBMReal getDistributionForDirection(size_t x1, size_t x2, size_t x3, int direction);
+   //////////////////////////////////////////////////////////////////////////
+   size_t getNX1() const;
+   //////////////////////////////////////////////////////////////////////////
+   size_t getNX2() const;
+   //////////////////////////////////////////////////////////////////////////
+   size_t getNX3() const;
+   //////////////////////////////////////////////////////////////////////////
+   Distributions getDistributions();
+   //////////////////////////////////////////////////////////////////////////
+   void getDistributionAfterLastStep(LBMReal* const f, size_t x1, size_t x2, size_t x3);
+
+protected:
+   Distributions d;
+   size_t NX1, NX2, NX3;
+
+};
+
+#endif
+
diff --git a/src/cpu/VirtualFluidsCore/Data/D3Q27EsoTwist3DSplittedVector.cpp b/src/cpu/VirtualFluidsCore/Data/D3Q27EsoTwist3DSplittedVector.cpp
index 975749bd468dd2ae72ce896884d727163fdfb4a8..b3af9a475afd0ba12f512173d8ef0c8115389ea1 100644
--- a/src/cpu/VirtualFluidsCore/Data/D3Q27EsoTwist3DSplittedVector.cpp
+++ b/src/cpu/VirtualFluidsCore/Data/D3Q27EsoTwist3DSplittedVector.cpp
@@ -1,686 +1,686 @@
-//=======================================================================================
-// ____          ____    __    ______     __________   __      __       __        __         
-// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
-//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
-//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
-//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
-//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
-//      \    \  |    |   ________________________________________________________________    
-//       \    \ |    |  |  ______________________________________________________________|   
-//        \    \|    |  |  |         __          __     __     __     ______      _______    
-//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
-//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
-//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
-//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
-//
-//  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"
-
-D3Q27EsoTwist3DSplittedVector::D3Q27EsoTwist3DSplittedVector()
-{
-}
-//////////////////////////////////////////////////////////////////////////
-D3Q27EsoTwist3DSplittedVector::D3Q27EsoTwist3DSplittedVector( size_t nx1, size_t nx2, size_t nx3, LBMReal value )
-{
-   this->NX1 = nx1;
-   this->NX2 = nx2;
-   this->NX3 = nx3;
-
-   this->localDistributions    = CbArray4D<LBMReal,IndexerX4X3X2X1>::CbArray4DPtr(new CbArray4D<LBMReal,IndexerX4X3X2X1>(13, nx1+1, nx2+1, nx3+1, value));
-   this->nonLocalDistributions = CbArray4D<LBMReal,IndexerX4X3X2X1>::CbArray4DPtr(new CbArray4D<LBMReal,IndexerX4X3X2X1>(13, nx1+1, nx2+1, nx3+1, value));
-
-   this->zeroDistributions     = CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal,IndexerX3X2X1>(nx1, nx2, nx3, value));
-}
-//////////////////////////////////////////////////////////////////////////
-D3Q27EsoTwist3DSplittedVector::~D3Q27EsoTwist3DSplittedVector()
-{
-
-}
-//////////////////////////////////////////////////////////////////////////
-void D3Q27EsoTwist3DSplittedVector::swap()
-{
-   std::swap( this->localDistributions, this->nonLocalDistributions );
-}
-//////////////////////////////////////////////////////////////////////////
-void D3Q27EsoTwist3DSplittedVector::getDistribution(LBMReal* const f, size_t x1, size_t x2, size_t x3)
-{
-   f[D3Q27System::E] = (*this->localDistributions)(D3Q27System::ET_E, x1,x2,x3);
-   f[D3Q27System::N] = (*this->localDistributions)(D3Q27System::ET_N,x1,x2,x3);  
-   f[D3Q27System::T] = (*this->localDistributions)(D3Q27System::ET_T,x1,x2,x3);
-   f[D3Q27System::NE] = (*this->localDistributions)(D3Q27System::ET_NE,x1,x2,x3);
-   f[D3Q27System::NW] = (*this->localDistributions)(D3Q27System::ET_NW,x1+1,x2,x3);
-   f[D3Q27System::TE] = (*this->localDistributions)(D3Q27System::ET_TE,x1,x2,x3);
-   f[D3Q27System::TW] = (*this->localDistributions)(D3Q27System::ET_TW, x1+1,x2,x3);
-   f[D3Q27System::TN] = (*this->localDistributions)(D3Q27System::ET_TN,x1,x2,x3);
-   f[D3Q27System::TS] = (*this->localDistributions)(D3Q27System::ET_TS,x1,x2+1,x3);
-   f[D3Q27System::TNE] = (*this->localDistributions)(D3Q27System::ET_TNE,x1,x2,x3);
-   f[D3Q27System::TNW] = (*this->localDistributions)(D3Q27System::ET_TNW,x1+1,x2,x3);
-   f[D3Q27System::TSE] = (*this->localDistributions)(D3Q27System::ET_TSE,x1,x2+1,x3);
-   f[D3Q27System::TSW] = (*this->localDistributions)(D3Q27System::ET_TSW,x1+1,x2+1,x3);
-
-   f[D3Q27System::W ] = (*this->nonLocalDistributions)(D3Q27System::ET_W,x1+1,x2,x3  );
-   f[D3Q27System::S ] = (*this->nonLocalDistributions)(D3Q27System::ET_S,x1,x2+1,x3  );
-   f[D3Q27System::B ] = (*this->nonLocalDistributions)(D3Q27System::ET_B,x1,x2,x3+1  );
-   f[D3Q27System::SW] = (*this->nonLocalDistributions)(D3Q27System::ET_SW,x1+1,x2+1,x3 );
-   f[D3Q27System::SE] = (*this->nonLocalDistributions)(D3Q27System::ET_SE,x1,x2+1,x3 );
-   f[D3Q27System::BW] = (*this->nonLocalDistributions)(D3Q27System::ET_BW,x1+1,x2,x3+1 );
-   f[D3Q27System::BE] = (*this->nonLocalDistributions)(D3Q27System::ET_BE,x1,x2,x3+1 );
-   f[D3Q27System::BS] = (*this->nonLocalDistributions)(D3Q27System::ET_BS,x1,x2+1,x3+1 );
-   f[D3Q27System::BN] = (*this->nonLocalDistributions)(D3Q27System::ET_BN,x1,x2,x3+1 );
-   f[D3Q27System::BSW] = (*this->nonLocalDistributions)(D3Q27System::ET_BSW,x1+1,x2+1,x3+1);
-   f[D3Q27System::BSE] = (*this->nonLocalDistributions)(D3Q27System::ET_BSE,x1,x2+1,x3+1);
-   f[D3Q27System::BNW] = (*this->nonLocalDistributions)(D3Q27System::ET_BNW,x1+1,x2,x3+1);
-   f[D3Q27System::BNE] = (*this->nonLocalDistributions)(D3Q27System::ET_BNE,x1,x2,x3+1);
-
-   f[D3Q27System::ZERO] = (*this->zeroDistributions)(x1,x2,x3);
-}
-//////////////////////////////////////////////////////////////////////////
-void D3Q27EsoTwist3DSplittedVector::setDistribution(const LBMReal* const f, size_t x1, size_t x2, size_t x3)
-{
-   (*this->localDistributions)(D3Q27System::ET_E,x1,  x2,  x3)   = f[D3Q27System::INV_E];
-   (*this->localDistributions)(D3Q27System::ET_N,x1,  x2,  x3)   = f[D3Q27System::INV_N];
-   (*this->localDistributions)(D3Q27System::ET_T,x1,  x2,  x3)   = f[D3Q27System::INV_T];
-   (*this->localDistributions)(D3Q27System::ET_NE,x1,  x2,  x3)  = f[D3Q27System::INV_NE];
-   (*this->localDistributions)(D3Q27System::ET_NW,x1+1,x2,  x3)  = f[D3Q27System::INV_NW];
-   (*this->localDistributions)(D3Q27System::ET_TE,x1,  x2,  x3)  = f[D3Q27System::INV_TE];
-   (*this->localDistributions)(D3Q27System::ET_TW,x1+1,x2,  x3)  = f[D3Q27System::INV_TW];
-   (*this->localDistributions)(D3Q27System::ET_TN,x1,  x2,  x3)  = f[D3Q27System::INV_TN];
-   (*this->localDistributions)(D3Q27System::ET_TS,x1,  x2+1,x3)  = f[D3Q27System::INV_TS];
-   (*this->localDistributions)(D3Q27System::ET_TNE,x1,  x2,  x3) = f[D3Q27System::INV_TNE];
-   (*this->localDistributions)(D3Q27System::ET_TNW,x1+1,x2,  x3) = f[D3Q27System::INV_TNW];
-   (*this->localDistributions)(D3Q27System::ET_TSE,x1,  x2+1,x3) = f[D3Q27System::INV_TSE];
-   (*this->localDistributions)(D3Q27System::ET_TSW,x1+1,x2+1,x3) = f[D3Q27System::INV_TSW];
-
-   (*this->nonLocalDistributions)(D3Q27System::ET_W,x1+1,x2,  x3    ) = f[D3Q27System::INV_W ];
-   (*this->nonLocalDistributions)(D3Q27System::ET_S,x1,  x2+1,x3    ) = f[D3Q27System::INV_S ];
-   (*this->nonLocalDistributions)(D3Q27System::ET_B,x1,  x2,  x3+1  ) = f[D3Q27System::INV_B ];
-   (*this->nonLocalDistributions)(D3Q27System::ET_SW,x1+1,x2+1,x3   ) = f[D3Q27System::INV_SW];
-   (*this->nonLocalDistributions)(D3Q27System::ET_SE,x1,  x2+1,x3   ) = f[D3Q27System::INV_SE];
-   (*this->nonLocalDistributions)(D3Q27System::ET_BW,x1+1,x2,  x3+1 ) = f[D3Q27System::INV_BW];
-   (*this->nonLocalDistributions)(D3Q27System::ET_BE,x1,  x2,  x3+1 ) = f[D3Q27System::INV_BE];
-   (*this->nonLocalDistributions)(D3Q27System::ET_BS,x1,  x2+1,x3+1 ) = f[D3Q27System::INV_BS];
-   (*this->nonLocalDistributions)(D3Q27System::ET_BN,x1,  x2,  x3+1 ) = f[D3Q27System::INV_BN];
-   (*this->nonLocalDistributions)(D3Q27System::ET_BSW,x1+1,x2+1,x3+1) = f[D3Q27System::INV_BSW];
-   (*this->nonLocalDistributions)(D3Q27System::ET_BSE,x1,  x2+1,x3+1) = f[D3Q27System::INV_BSE];
-   (*this->nonLocalDistributions)(D3Q27System::ET_BNW,x1+1,x2,  x3+1) = f[D3Q27System::INV_BNW];
-   (*this->nonLocalDistributions)(D3Q27System::ET_BNE,x1,  x2,  x3+1) = f[D3Q27System::INV_BNE];
-
-   (*this->zeroDistributions)(x1,x2,x3) = f[D3Q27System::ZERO];
-}
-//////////////////////////////////////////////////////////////////////////
-void D3Q27EsoTwist3DSplittedVector::getDistributionInv(LBMReal* const f, size_t x1, size_t x2, size_t x3)
-{
-   f[D3Q27System::INV_E] = (*this->localDistributions)(D3Q27System::ET_E, x1,x2,x3);
-   f[D3Q27System::INV_N] = (*this->localDistributions)(D3Q27System::ET_N,x1,x2,x3);  
-   f[D3Q27System::INV_T] = (*this->localDistributions)(D3Q27System::ET_T,x1,x2,x3);
-   f[D3Q27System::INV_NE] = (*this->localDistributions)(D3Q27System::ET_NE,x1,x2,x3);
-   f[D3Q27System::INV_NW] = (*this->localDistributions)(D3Q27System::ET_NW,x1+1,x2,x3);
-   f[D3Q27System::INV_TE] = (*this->localDistributions)(D3Q27System::ET_TE,x1,x2,x3);
-   f[D3Q27System::INV_TW] = (*this->localDistributions)(D3Q27System::ET_TW, x1+1,x2,x3);
-   f[D3Q27System::INV_TN] = (*this->localDistributions)(D3Q27System::ET_TN,x1,x2,x3);
-   f[D3Q27System::INV_TS] = (*this->localDistributions)(D3Q27System::ET_TS,x1,x2+1,x3);
-   f[D3Q27System::INV_TNE] = (*this->localDistributions)(D3Q27System::ET_TNE,x1,x2,x3);
-   f[D3Q27System::INV_TNW] = (*this->localDistributions)(D3Q27System::ET_TNW,x1+1,x2,x3);
-   f[D3Q27System::INV_TSE] = (*this->localDistributions)(D3Q27System::ET_TSE,x1,x2+1,x3);
-   f[D3Q27System::INV_TSW] = (*this->localDistributions)(D3Q27System::ET_TSW,x1+1,x2+1,x3);
-
-   f[D3Q27System::INV_W ] = (*this->nonLocalDistributions)(D3Q27System::ET_W,x1+1,x2,x3  );
-   f[D3Q27System::INV_S ] = (*this->nonLocalDistributions)(D3Q27System::ET_S,x1,x2+1,x3  );
-   f[D3Q27System::INV_B ] = (*this->nonLocalDistributions)(D3Q27System::ET_B,x1,x2,x3+1  );
-   f[D3Q27System::INV_SW] = (*this->nonLocalDistributions)(D3Q27System::ET_SW,x1+1,x2+1,x3 );
-   f[D3Q27System::INV_SE] = (*this->nonLocalDistributions)(D3Q27System::ET_SE,x1,x2+1,x3 );
-   f[D3Q27System::INV_BW] = (*this->nonLocalDistributions)(D3Q27System::ET_BW,x1+1,x2,x3+1 );
-   f[D3Q27System::INV_BE] = (*this->nonLocalDistributions)(D3Q27System::ET_BE,x1,x2,x3+1 );
-   f[D3Q27System::INV_BS] = (*this->nonLocalDistributions)(D3Q27System::ET_BS,x1,x2+1,x3+1 );
-   f[D3Q27System::INV_BN] = (*this->nonLocalDistributions)(D3Q27System::ET_BN,x1,x2,x3+1 );
-   f[D3Q27System::INV_BSW] = (*this->nonLocalDistributions)(D3Q27System::ET_BSW,x1+1,x2+1,x3+1);
-   f[D3Q27System::INV_BSE] = (*this->nonLocalDistributions)(D3Q27System::ET_BSE,x1,x2+1,x3+1);
-   f[D3Q27System::INV_BNW] = (*this->nonLocalDistributions)(D3Q27System::ET_BNW,x1+1,x2,x3+1);
-   f[D3Q27System::INV_BNE] = (*this->nonLocalDistributions)(D3Q27System::ET_BNE,x1,x2,x3+1);
-
-   f[D3Q27System::ZERO] = (*this->zeroDistributions)(x1,x2,x3);
-}
-//////////////////////////////////////////////////////////////////////////
-void D3Q27EsoTwist3DSplittedVector::setDistributionInv(const LBMReal* const f, size_t x1, size_t x2, size_t x3)
-{
-   (*this->localDistributions)(D3Q27System::ET_E,x1,  x2,  x3) = f[D3Q27System::E];
-   (*this->localDistributions)(D3Q27System::ET_N,x1,  x2,  x3) = f[D3Q27System::N];
-   (*this->localDistributions)(D3Q27System::ET_T,x1,  x2,  x3) = f[D3Q27System::T];
-   (*this->localDistributions)(D3Q27System::ET_NE,x1,  x2,  x3) = f[D3Q27System::NE];
-   (*this->localDistributions)(D3Q27System::ET_NW,x1+1,x2,  x3) = f[D3Q27System::NW];
-   (*this->localDistributions)(D3Q27System::ET_TE,x1,  x2,  x3) = f[D3Q27System::TE];
-   (*this->localDistributions)(D3Q27System::ET_TW,x1+1,x2,  x3) = f[D3Q27System::TW];
-   (*this->localDistributions)(D3Q27System::ET_TN,x1,  x2,  x3) = f[D3Q27System::TN];
-   (*this->localDistributions)(D3Q27System::ET_TS,x1,  x2+1,x3) = f[D3Q27System::TS];
-   (*this->localDistributions)(D3Q27System::ET_TNE,x1,  x2,  x3) = f[D3Q27System::TNE];
-   (*this->localDistributions)(D3Q27System::ET_TNW,x1+1,x2,  x3) = f[D3Q27System::TNW];
-   (*this->localDistributions)(D3Q27System::ET_TSE,x1,  x2+1,x3) = f[D3Q27System::TSE];
-   (*this->localDistributions)(D3Q27System::ET_TSW,x1+1,x2+1,x3) = f[D3Q27System::TSW];
-
-   (*this->nonLocalDistributions)(D3Q27System::ET_W,x1+1,x2,  x3    ) = f[D3Q27System::W ];
-   (*this->nonLocalDistributions)(D3Q27System::ET_S,x1,  x2+1,x3    ) = f[D3Q27System::S ];
-   (*this->nonLocalDistributions)(D3Q27System::ET_B,x1,  x2,  x3+1  ) = f[D3Q27System::B ];
-   (*this->nonLocalDistributions)(D3Q27System::ET_SW,x1+1,x2+1,x3   ) = f[D3Q27System::SW];
-   (*this->nonLocalDistributions)(D3Q27System::ET_SE,x1,  x2+1,x3   ) = f[D3Q27System::SE];
-   (*this->nonLocalDistributions)(D3Q27System::ET_BW,x1+1,x2,  x3+1 ) = f[D3Q27System::BW];
-   (*this->nonLocalDistributions)(D3Q27System::ET_BE,x1,  x2,  x3+1 ) = f[D3Q27System::BE];
-   (*this->nonLocalDistributions)(D3Q27System::ET_BS,x1,  x2+1,x3+1 ) = f[D3Q27System::BS];
-   (*this->nonLocalDistributions)(D3Q27System::ET_BN,x1,  x2,  x3+1 ) = f[D3Q27System::BN];
-   (*this->nonLocalDistributions)(D3Q27System::ET_BSW,x1+1,x2+1,x3+1) = f[D3Q27System::BSW];
-   (*this->nonLocalDistributions)(D3Q27System::ET_BSE,x1,  x2+1,x3+1) = f[D3Q27System::BSE];
-   (*this->nonLocalDistributions)(D3Q27System::ET_BNW,x1+1,x2,  x3+1) = f[D3Q27System::BNW];
-   (*this->nonLocalDistributions)(D3Q27System::ET_BNE,x1,  x2,  x3+1) = f[D3Q27System::BNE];
-
-   (*this->zeroDistributions)(x1,x2,x3) = f[D3Q27System::ZERO];
-}
-//////////////////////////////////////////////////////////////////////////
-void D3Q27EsoTwist3DSplittedVector::setDistributionForDirection(const LBMReal* const f, size_t x1, size_t x2, size_t x3, unsigned long int direction)
-{
-   bool directionFlag = false;
-   if ((direction & EsoTwistD3Q27System::etE) == EsoTwistD3Q27System::etE)
-      (*this->nonLocalDistributions)(D3Q27System::ET_W,x1+1,x2,  x3    ) = f[D3Q27System::E]; directionFlag=true;
-   if ((direction & EsoTwistD3Q27System::etW) == EsoTwistD3Q27System::etW)
-      (*this->localDistributions)(D3Q27System::ET_E,x1,  x2,  x3) = f[D3Q27System::W]; directionFlag=true;
-   if ((direction & EsoTwistD3Q27System::etS) == EsoTwistD3Q27System::etS)
-      (*this->localDistributions)(D3Q27System::ET_N,x1,  x2,  x3) = f[D3Q27System::S]; directionFlag=true;
-   if ((direction & EsoTwistD3Q27System::etN) == EsoTwistD3Q27System::etN)
-      (*this->nonLocalDistributions)(D3Q27System::ET_S,x1,  x2+1,x3    ) = f[D3Q27System::N]; directionFlag=true;
-   if ((direction & EsoTwistD3Q27System::etB) == EsoTwistD3Q27System::etB)
-      (*this->localDistributions)(D3Q27System::ET_T,x1,  x2,  x3) = f[D3Q27System::B]; directionFlag=true;
-   if ((direction & EsoTwistD3Q27System::etT) == EsoTwistD3Q27System::etT)
-      (*this->nonLocalDistributions)(D3Q27System::ET_B,x1,  x2,  x3+1  ) = f[D3Q27System::T]; directionFlag=true;
-   if ((direction & EsoTwistD3Q27System::etSW) == EsoTwistD3Q27System::etSW)
-      (*this->localDistributions)(D3Q27System::ET_NE,x1,  x2,  x3) = f[D3Q27System::SW]; directionFlag=true;
-   if ((direction & EsoTwistD3Q27System::etNE) == EsoTwistD3Q27System::etNE)
-      (*this->nonLocalDistributions)(D3Q27System::ET_SW,x1+1,x2+1,x3   ) = f[D3Q27System::NE]; directionFlag=true;
-   if ((direction & EsoTwistD3Q27System::etNW) == EsoTwistD3Q27System::etNW)
-      (*this->nonLocalDistributions)(D3Q27System::ET_SE,x1,  x2+1,x3   ) = f[D3Q27System::NW]; directionFlag=true;
-   if ((direction & EsoTwistD3Q27System::etSE) == EsoTwistD3Q27System::etSE)
-      (*this->localDistributions)(D3Q27System::ET_NW,x1+1,x2,  x3) = f[D3Q27System::SE]; directionFlag=true;
-   if ((direction & EsoTwistD3Q27System::etBW) == EsoTwistD3Q27System::etBW)
-      (*this->localDistributions)(D3Q27System::ET_TE,x1,  x2,  x3) = f[D3Q27System::BW]; directionFlag=true;
-   if ((direction & EsoTwistD3Q27System::etTE) == EsoTwistD3Q27System::etTE)
-      (*this->nonLocalDistributions)(D3Q27System::ET_BW,x1+1,x2,  x3+1 ) = f[D3Q27System::TE]; directionFlag=true;
-   if ((direction & EsoTwistD3Q27System::etTW) == EsoTwistD3Q27System::etTW)
-      (*this->nonLocalDistributions)(D3Q27System::ET_BE,x1,  x2,  x3+1 ) = f[D3Q27System::TW]; directionFlag=true;
-   if ((direction & EsoTwistD3Q27System::etBE) == EsoTwistD3Q27System::etBE)
-      (*this->localDistributions)(D3Q27System::ET_TW,x1+1,x2,  x3) = f[D3Q27System::BE]; directionFlag=true;
-   if ((direction & EsoTwistD3Q27System::etBS) == EsoTwistD3Q27System::etBS)
-      (*this->localDistributions)(D3Q27System::ET_TN,x1,  x2,  x3) = f[D3Q27System::BS]; directionFlag=true;
-   if ((direction & EsoTwistD3Q27System::etTN) == EsoTwistD3Q27System::etTN)
-      (*this->nonLocalDistributions)(D3Q27System::ET_BS,x1,  x2+1,x3+1 ) = f[D3Q27System::TN]; directionFlag=true;
-   if ((direction & EsoTwistD3Q27System::etTS) == EsoTwistD3Q27System::etTS)
-      (*this->nonLocalDistributions)(D3Q27System::ET_BN,x1,  x2,  x3+1 ) = f[D3Q27System::TS]; directionFlag=true;
-   if ((direction & EsoTwistD3Q27System::etBN) == EsoTwistD3Q27System::etBN)
-      (*this->localDistributions)(D3Q27System::ET_TS,x1,  x2+1,x3) = f[D3Q27System::BN]; directionFlag=true;
-   if ((direction & EsoTwistD3Q27System::etBSW) == EsoTwistD3Q27System::etBSW)
-      (*this->localDistributions)(D3Q27System::ET_TNE,x1,  x2,  x3) = f[D3Q27System::BSW]; directionFlag=true;
-   if ((direction & EsoTwistD3Q27System::etTNE) == EsoTwistD3Q27System::etTNE)
-      (*this->nonLocalDistributions)(D3Q27System::ET_BSW,x1+1,x2+1,x3+1) = f[D3Q27System::TNE]; directionFlag=true;
-   if ((direction & EsoTwistD3Q27System::etBSE) == EsoTwistD3Q27System::etBSE)
-      (*this->localDistributions)(D3Q27System::ET_TNW,x1+1,x2,  x3) = f[D3Q27System::BSE]; directionFlag=true;
-   if ((direction & EsoTwistD3Q27System::etTNW) == EsoTwistD3Q27System::etTNW)
-      (*this->nonLocalDistributions)(D3Q27System::ET_BSE,x1,  x2+1,x3+1) = f[D3Q27System::TNW]; directionFlag=true;
-   if ((direction & EsoTwistD3Q27System::etBNW) == EsoTwistD3Q27System::etBNW)
-      (*this->localDistributions)(D3Q27System::ET_TSE,x1,  x2+1,x3) = f[D3Q27System::BNW]; directionFlag=true;
-   if ((direction & EsoTwistD3Q27System::etTSE) == EsoTwistD3Q27System::etTSE)
-      (*this->nonLocalDistributions)(D3Q27System::ET_BNW,x1+1,x2,  x3+1) = f[D3Q27System::TSE]; directionFlag=true;
-   if ((direction & EsoTwistD3Q27System::etBNE) == EsoTwistD3Q27System::etBNE)
-      (*this->localDistributions)(D3Q27System::ET_TSW,x1+1,x2+1,x3) = f[D3Q27System::BNE]; directionFlag=true;
-   if ((direction & EsoTwistD3Q27System::etTSW) == EsoTwistD3Q27System::etTSW)
-      (*this->nonLocalDistributions)(D3Q27System::ET_BNE,x1,  x2,  x3+1) = f[D3Q27System::TSW]; directionFlag=true;
-   if ((direction & EsoTwistD3Q27System::ZERO) == EsoTwistD3Q27System::ZERO)
-      (*this->zeroDistributions)(x1,x2,x3) = f[D3Q27System::ZERO]; directionFlag=true;
-#ifdef _DEBUG
-   if(!directionFlag)UB_THROW( UbException(UB_EXARGS, "Direction didn't find") );
-#endif //DEBUG
-}
-//////////////////////////////////////////////////////////////////////////
-void D3Q27EsoTwist3DSplittedVector::setDistributionForDirection(LBMReal f, size_t x1, size_t x2, size_t x3, int direction)
-{
-   switch (direction)
-   {
-   case D3Q27System::E :
-      (*this->nonLocalDistributions)(D3Q27System::ET_W,x1+1,x2,  x3    ) = f;
-      break;
-   case D3Q27System::W :
-      (*this->localDistributions)(D3Q27System::ET_E,x1,  x2,  x3) = f;
-      break;
-   case D3Q27System::S :
-      (*this->localDistributions)(D3Q27System::ET_N,x1,  x2,  x3) = f;
-      break;
-   case D3Q27System::N :
-      (*this->nonLocalDistributions)(D3Q27System::ET_S,x1,  x2+1,x3    ) = f;
-      break;
-   case D3Q27System::B :
-      (*this->localDistributions)(D3Q27System::ET_T,x1,  x2,  x3) = f;
-      break;
-   case D3Q27System::T :
-      (*this->nonLocalDistributions)(D3Q27System::ET_B,x1,  x2,  x3+1  ) = f;
-      break;
-   case D3Q27System::SW :
-      (*this->localDistributions)(D3Q27System::ET_NE,x1,  x2,  x3) = f;
-      break;
-   case D3Q27System::NE :
-      (*this->nonLocalDistributions)(D3Q27System::ET_SW,x1+1,x2+1,x3   ) = f;
-      break;
-   case D3Q27System::NW :
-      (*this->nonLocalDistributions)(D3Q27System::ET_SE,x1,  x2+1,x3   ) = f;
-      break;
-   case D3Q27System::SE :
-      (*this->localDistributions)(D3Q27System::ET_NW,x1+1,x2,  x3) = f;
-      break;
-   case D3Q27System::BW :
-      (*this->localDistributions)(D3Q27System::ET_TE,x1,  x2,  x3) = f;
-      break;
-   case D3Q27System::TE :
-      (*this->nonLocalDistributions)(D3Q27System::ET_BW,x1+1,x2,  x3+1 ) = f;
-      break;
-   case D3Q27System::TW :
-      (*this->nonLocalDistributions)(D3Q27System::ET_BE,x1,  x2,  x3+1 ) = f;
-      break;
-   case D3Q27System::BE :
-      (*this->localDistributions)(D3Q27System::ET_TW,x1+1,x2,  x3) = f;
-      break;
-   case D3Q27System::BS :
-      (*this->localDistributions)(D3Q27System::ET_TN,x1,  x2,  x3) = f;
-      break;
-   case D3Q27System::TN :
-      (*this->nonLocalDistributions)(D3Q27System::ET_BS,x1,  x2+1,x3+1 ) = f;
-      break;
-   case D3Q27System::TS :
-      (*this->nonLocalDistributions)(D3Q27System::ET_BN,x1,  x2,  x3+1 ) = f;
-      break;
-   case D3Q27System::BN :
-      (*this->localDistributions)(D3Q27System::ET_TS,x1,  x2+1,x3) = f;
-      break;
-   case D3Q27System::BSW :
-      (*this->localDistributions)(D3Q27System::ET_TNE,x1,  x2,  x3) = f;
-      break;
-   case D3Q27System::TNE :
-      (*this->nonLocalDistributions)(D3Q27System::ET_BSW,x1+1,x2+1,x3+1) = f;
-      break;
-   case D3Q27System::BSE :
-      (*this->localDistributions)(D3Q27System::ET_TNW,x1+1,x2,  x3) = f;
-      break;
-   case D3Q27System::TNW :
-      (*this->nonLocalDistributions)(D3Q27System::ET_BSE,x1,  x2+1,x3+1) = f;
-      break;
-   case D3Q27System::BNW :
-      (*this->localDistributions)(D3Q27System::ET_TSE,x1,  x2+1,x3) = f;
-      break;
-   case D3Q27System::TSE :
-      (*this->nonLocalDistributions)(D3Q27System::ET_BNW,x1+1,x2,  x3+1) = f;
-      break;
-   case D3Q27System::BNE :
-      (*this->localDistributions)(D3Q27System::ET_TSW,x1+1,x2+1,x3) = f;
-      break;
-   case D3Q27System::TSW :
-      (*this->nonLocalDistributions)(D3Q27System::ET_BNE,x1,  x2,  x3+1) = f;
-      break;
-   case D3Q27System::ZERO :
-      (*this->zeroDistributions)(x1,x2,x3) = f;
-      break;
-   default:
-      UB_THROW( UbException(UB_EXARGS, "Direction didn't find") );     
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-void D3Q27EsoTwist3DSplittedVector::setDistributionInvForDirection(const LBMReal* const f, size_t x1, size_t x2, size_t x3, unsigned long int direction)
-{
-   bool directionFlag = false;
-   if ((direction & EsoTwistD3Q27System::etE) == EsoTwistD3Q27System::etE)
-       (*this->localDistributions)(D3Q27System::ET_E,x1,  x2,  x3) = f[D3Q27System::E]; directionFlag=true;
-   if ((direction & EsoTwistD3Q27System::etW) == EsoTwistD3Q27System::etW)
-      (*this->nonLocalDistributions)(D3Q27System::ET_W,x1+1,x2,  x3    ) = f[D3Q27System::W]; directionFlag=true;
-   if ((direction & EsoTwistD3Q27System::etS) == EsoTwistD3Q27System::etS)
-       (*this->nonLocalDistributions)(D3Q27System::ET_S,x1,  x2+1,x3    ) = f[D3Q27System::S]; directionFlag=true;
-   if ((direction & EsoTwistD3Q27System::etN) == EsoTwistD3Q27System::etN)
-      (*this->localDistributions)(D3Q27System::ET_N,x1,  x2,  x3) = f[D3Q27System::N]; directionFlag=true;
-   if ((direction & EsoTwistD3Q27System::etB) == EsoTwistD3Q27System::etB)
-       (*this->nonLocalDistributions)(D3Q27System::ET_B,x1,  x2,  x3+1  ) = f[D3Q27System::B]; directionFlag=true;
-   if ((direction & EsoTwistD3Q27System::etT) == EsoTwistD3Q27System::etT)
-      (*this->localDistributions)(D3Q27System::ET_T,x1,  x2,  x3) = f[D3Q27System::T]; directionFlag=true;
-   if ((direction & EsoTwistD3Q27System::etSW) == EsoTwistD3Q27System::etSW)
-       (*this->nonLocalDistributions)(D3Q27System::ET_SW,x1+1,x2+1,x3   ) = f[D3Q27System::SW]; directionFlag=true;
-   if ((direction & EsoTwistD3Q27System::etNE) == EsoTwistD3Q27System::etNE)
-      (*this->localDistributions)(D3Q27System::ET_NE,x1,  x2,  x3) = f[D3Q27System::NE]; directionFlag=true;
-   if ((direction & EsoTwistD3Q27System::etNW) == EsoTwistD3Q27System::etNW)
-       (*this->localDistributions)(D3Q27System::ET_NW,x1+1,x2,  x3) = f[D3Q27System::NW]; directionFlag=true;
-   if ((direction & EsoTwistD3Q27System::etSE) == EsoTwistD3Q27System::etSE)
-      (*this->nonLocalDistributions)(D3Q27System::ET_SE,x1,  x2+1,x3   ) = f[D3Q27System::SE]; directionFlag=true;
-   if ((direction & EsoTwistD3Q27System::etBW) == EsoTwistD3Q27System::etBW)
-       (*this->nonLocalDistributions)(D3Q27System::ET_BW,x1+1,x2,  x3+1 ) = f[D3Q27System::BW]; directionFlag=true;
-   if ((direction & EsoTwistD3Q27System::etTE) == EsoTwistD3Q27System::etTE)
-      (*this->localDistributions)(D3Q27System::ET_TE,x1,  x2,  x3) = f[D3Q27System::TE]; directionFlag=true;
-   if ((direction & EsoTwistD3Q27System::etTW) == EsoTwistD3Q27System::etTW)
-       (*this->localDistributions)(D3Q27System::ET_TW,x1+1,x2,  x3) = f[D3Q27System::TW]; directionFlag=true;
-   if ((direction & EsoTwistD3Q27System::etBE) == EsoTwistD3Q27System::etBE)
-      (*this->nonLocalDistributions)(D3Q27System::ET_BE,x1,  x2,  x3+1 ) = f[D3Q27System::BE]; directionFlag=true;
-   if ((direction & EsoTwistD3Q27System::etBS) == EsoTwistD3Q27System::etBS)
-       (*this->nonLocalDistributions)(D3Q27System::ET_BS,x1,  x2+1,x3+1 ) = f[D3Q27System::BS]; directionFlag=true;
-   if ((direction & EsoTwistD3Q27System::etTN) == EsoTwistD3Q27System::etTN)
-      (*this->localDistributions)(D3Q27System::ET_TN,x1,  x2,  x3) = f[D3Q27System::TN]; directionFlag=true;
-   if ((direction & EsoTwistD3Q27System::etTS) == EsoTwistD3Q27System::etTS)
-       (*this->localDistributions)(D3Q27System::ET_TS,x1,  x2+1,x3) = f[D3Q27System::TS]; directionFlag=true;
-   if ((direction & EsoTwistD3Q27System::etBN) == EsoTwistD3Q27System::etBN)
-      (*this->nonLocalDistributions)(D3Q27System::ET_BN,x1,  x2,  x3+1 ) = f[D3Q27System::BN]; directionFlag=true;
-   if ((direction & EsoTwistD3Q27System::etBSW) == EsoTwistD3Q27System::etBSW)
-       (*this->nonLocalDistributions)(D3Q27System::ET_BSW,x1+1,x2+1,x3+1) = f[D3Q27System::BSW]; directionFlag=true;
-   if ((direction & EsoTwistD3Q27System::etTNE) == EsoTwistD3Q27System::etTNE)
-      (*this->localDistributions)(D3Q27System::ET_TNE,x1,  x2,  x3) = f[D3Q27System::TNE]; directionFlag=true;
-   if ((direction & EsoTwistD3Q27System::etBSE) == EsoTwistD3Q27System::etBSE)
-       (*this->nonLocalDistributions)(D3Q27System::ET_BSE,x1,  x2+1,x3+1) = f[D3Q27System::BSE]; directionFlag=true;
-   if ((direction & EsoTwistD3Q27System::etTNW) == EsoTwistD3Q27System::etTNW)
-      (*this->localDistributions)(D3Q27System::ET_TNW,x1+1,x2,  x3) = f[D3Q27System::TNW]; directionFlag=true;
-   if ((direction & EsoTwistD3Q27System::etBNW) == EsoTwistD3Q27System::etBNW)
-       (*this->nonLocalDistributions)(D3Q27System::ET_BNW,x1+1,x2,  x3+1) = f[D3Q27System::BNW]; directionFlag=true;
-   if ((direction & EsoTwistD3Q27System::etTSE) == EsoTwistD3Q27System::etTSE)
-      (*this->localDistributions)(D3Q27System::ET_TSE,x1,  x2+1,x3) = f[D3Q27System::TSE]; directionFlag=true;
-   if ((direction & EsoTwistD3Q27System::etBNE) == EsoTwistD3Q27System::etBNE)
-       (*this->nonLocalDistributions)(D3Q27System::ET_BNE,x1,  x2,  x3+1)= f[D3Q27System::BNE]; directionFlag=true;
-   if ((direction & EsoTwistD3Q27System::etTSW) == EsoTwistD3Q27System::etTSW)
-      (*this->localDistributions)(D3Q27System::ET_TSW,x1+1,x2+1,x3) = f[D3Q27System::TSW]; directionFlag=true;
-   if ((direction & EsoTwistD3Q27System::ZERO) == EsoTwistD3Q27System::ZERO)
-      (*this->zeroDistributions)(x1,x2,x3) = f[D3Q27System::ZERO]; directionFlag=true;
-#ifdef _DEBUG
-   if(!directionFlag)UB_THROW( UbException(UB_EXARGS, "Direction didn't find") );
-#endif //DEBUG
-}
-//////////////////////////////////////////////////////////////////////////
-void D3Q27EsoTwist3DSplittedVector::setDistributionInvForDirection(LBMReal f, size_t x1, size_t x2, size_t x3, unsigned long int direction)
-{
-   switch (direction)
-   {
-   case D3Q27System::E :
-      (*this->localDistributions)(D3Q27System::ET_E,x1,  x2,  x3) = f;
-      break;
-   case D3Q27System::W :
-      (*this->nonLocalDistributions)(D3Q27System::ET_W,x1+1,x2,  x3    ) = f;
-      break;
-   case D3Q27System::S :
-      (*this->nonLocalDistributions)(D3Q27System::ET_S,x1,  x2+1,x3    ) = f;
-      break;
-   case D3Q27System::N :
-      (*this->localDistributions)(D3Q27System::ET_N,x1,  x2,  x3) = f;
-      break;
-   case D3Q27System::B :
-      (*this->nonLocalDistributions)(D3Q27System::ET_B,x1,  x2,  x3+1  ) = f;
-      break;
-   case D3Q27System::T :
-      (*this->localDistributions)(D3Q27System::ET_T,x1,  x2,  x3) = f;
-      break;
-   case D3Q27System::SW :
-      (*this->nonLocalDistributions)(D3Q27System::ET_SW,x1+1,x2+1,x3   ) = f;
-      break;
-   case D3Q27System::NE :
-      (*this->localDistributions)(D3Q27System::ET_NE,x1,  x2,  x3) = f;
-      break;
-   case D3Q27System::NW :
-      (*this->localDistributions)(D3Q27System::ET_NW,x1+1,x2,  x3) = f;
-      break;
-   case D3Q27System::SE :
-      (*this->nonLocalDistributions)(D3Q27System::ET_SE,x1,  x2+1,x3   ) = f;
-      break;
-   case D3Q27System::BW :
-      (*this->nonLocalDistributions)(D3Q27System::ET_BW,x1+1,x2,  x3+1 ) = f;
-      break;
-   case D3Q27System::TE :
-      (*this->localDistributions)(D3Q27System::ET_TE,x1,  x2,  x3) = f;
-      break;
-   case D3Q27System::TW :
-      (*this->localDistributions)(D3Q27System::ET_TW,x1+1,x2,  x3) = f;
-      break;
-   case D3Q27System::BE :
-      (*this->nonLocalDistributions)(D3Q27System::ET_BE,x1,  x2,  x3+1 ) = f;
-      break;
-   case D3Q27System::BS :
-      (*this->nonLocalDistributions)(D3Q27System::ET_BS,x1,  x2+1,x3+1 ) = f;
-      break;
-   case D3Q27System::TN :
-      (*this->localDistributions)(D3Q27System::ET_TN,x1,  x2,  x3) = f;
-      break;
-   case D3Q27System::TS :
-      (*this->localDistributions)(D3Q27System::ET_TS,x1,  x2+1,x3) = f;
-      break;
-   case D3Q27System::BN :
-      (*this->nonLocalDistributions)(D3Q27System::ET_BN,x1,  x2,  x3+1 ) = f;
-      break;
-   case D3Q27System::BSW :
-      (*this->nonLocalDistributions)(D3Q27System::ET_BSW,x1+1,x2+1,x3+1) = f;
-      break;
-   case D3Q27System::TNE :
-      (*this->localDistributions)(D3Q27System::ET_TNE,x1,  x2,  x3) = f;
-      break;
-   case D3Q27System::BSE :
-      (*this->nonLocalDistributions)(D3Q27System::ET_BSE,x1,  x2+1,x3+1) = f;
-      break;
-   case D3Q27System::TNW :
-      (*this->localDistributions)(D3Q27System::ET_TNW,x1+1,x2,  x3) = f;
-      break;
-   case D3Q27System::BNW :
-      (*this->nonLocalDistributions)(D3Q27System::ET_BNW,x1+1,x2,  x3+1) = f;
-      break;
-   case D3Q27System::TSE :
-      (*this->localDistributions)(D3Q27System::ET_TSE,x1,  x2+1,x3) = f;
-      break;
-   case D3Q27System::BNE :
-      (*this->nonLocalDistributions)(D3Q27System::ET_BNE,x1,  x2,  x3+1) = f;
-      break;
-   case D3Q27System::TSW :
-      (*this->localDistributions)(D3Q27System::ET_TSW,x1+1,x2+1,x3) = f;
-      break;
-   case D3Q27System::ZERO :
-      (*this->zeroDistributions)(x1,x2,x3) = f;
-      break;
-   default:
-      UB_THROW( UbException(UB_EXARGS, "Direction didn't find") );     
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-LBMReal D3Q27EsoTwist3DSplittedVector::getDistributionForDirection(size_t x1, size_t x2, size_t x3, int direction)
-{
-   switch (direction)
-   {
-   case D3Q27System::W :
-      return (*this->nonLocalDistributions)(D3Q27System::ET_W,x1+1,x2,  x3    );
-   case D3Q27System::E :
-      return (*this->localDistributions)(D3Q27System::ET_E,x1,  x2,  x3);
-   case D3Q27System::N :
-      return (*this->localDistributions)(D3Q27System::ET_N,x1,  x2,  x3);
-   case D3Q27System::S :
-      return (*this->nonLocalDistributions)(D3Q27System::ET_S,x1,  x2+1,x3    );
-   case D3Q27System::T :
-      return (*this->localDistributions)(D3Q27System::ET_T,x1,  x2,  x3);
-   case D3Q27System::B :
-      return (*this->nonLocalDistributions)(D3Q27System::ET_B,x1,  x2,  x3+1  );
-   case D3Q27System::NE :
-      return (*this->localDistributions)(D3Q27System::ET_NE,x1,  x2,  x3);
-   case D3Q27System::SW :
-      return (*this->nonLocalDistributions)(D3Q27System::ET_SW,x1+1,x2+1,x3   );
-   case D3Q27System::SE :
-      return (*this->nonLocalDistributions)(D3Q27System::ET_SE,x1,  x2+1,x3   );
-   case D3Q27System::NW :
-      return (*this->localDistributions)(D3Q27System::ET_NW,x1+1,x2,  x3);
-   case D3Q27System::TE :
-      return (*this->localDistributions)(D3Q27System::ET_TE,x1,  x2,  x3);
-   case D3Q27System::BW :
-      return (*this->nonLocalDistributions)(D3Q27System::ET_BW,x1+1,x2,  x3+1 );
-   case D3Q27System::BE :
-      return (*this->nonLocalDistributions)(D3Q27System::ET_BE,x1,  x2,  x3+1 );
-   case D3Q27System::TW :
-      return (*this->localDistributions)(D3Q27System::ET_TW,x1+1,x2,  x3);
-   case D3Q27System::TN :
-      return (*this->localDistributions)(D3Q27System::ET_TN,x1,  x2,  x3);
-   case D3Q27System::BS :
-      return (*this->nonLocalDistributions)(D3Q27System::ET_BS,x1,  x2+1,x3+1 );
-   case D3Q27System::BN :
-      return (*this->nonLocalDistributions)(D3Q27System::ET_BN,x1,  x2,  x3+1 );
-   case D3Q27System::TS :
-      return (*this->localDistributions)(D3Q27System::ET_TS,x1,  x2+1,x3);
-   case D3Q27System::TNE :
-      return (*this->localDistributions)(D3Q27System::ET_TNE,x1,  x2,  x3);
-   case D3Q27System::BSW :
-      return (*this->nonLocalDistributions)(D3Q27System::ET_BSW,x1+1,x2+1,x3+1);
-   case D3Q27System::TNW :
-      return (*this->localDistributions)(D3Q27System::ET_TNW,x1+1,x2,  x3);
-   case D3Q27System::BSE :
-      return (*this->nonLocalDistributions)(D3Q27System::ET_BSE,x1,  x2+1,x3+1);
-   case D3Q27System::TSE :
-      return (*this->localDistributions)(D3Q27System::ET_TSE,x1,  x2+1,x3);
-   case D3Q27System::BNW :
-      return (*this->nonLocalDistributions)(D3Q27System::ET_BNW,x1+1,x2,  x3+1);
-   case D3Q27System::TSW :
-      return (*this->localDistributions)(D3Q27System::ET_TSW,x1+1,x2+1,x3);
-   case D3Q27System::BNE :
-      return (*this->nonLocalDistributions)(D3Q27System::ET_BNE,x1,  x2,  x3+1);
-   case D3Q27System::ZERO :
-      return (*this->zeroDistributions)(x1,x2,x3);
-   default:
-      UB_THROW( UbException(UB_EXARGS, "Direction didn't find") );     
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-LBMReal D3Q27EsoTwist3DSplittedVector::getDistributionInvForDirection(size_t x1, size_t x2, size_t x3, int direction)
-{
-   switch (direction)
-   {
-   case D3Q27System::E :
-      return (*this->nonLocalDistributions)(D3Q27System::ET_W,x1+1,x2,  x3    );
-   case D3Q27System::W :
-      return (*this->localDistributions)(D3Q27System::ET_E,x1,  x2,  x3);
-   case D3Q27System::S :
-      return (*this->localDistributions)(D3Q27System::ET_N,x1,  x2,  x3);
-   case D3Q27System::N :
-      return (*this->nonLocalDistributions)(D3Q27System::ET_S,x1,  x2+1,x3    );
-   case D3Q27System::B :
-      return (*this->localDistributions)(D3Q27System::ET_T,x1,  x2,  x3);
-   case D3Q27System::T :
-      return (*this->nonLocalDistributions)(D3Q27System::ET_B,x1,  x2,  x3+1  );
-   case D3Q27System::SW :
-      return (*this->localDistributions)(D3Q27System::ET_NE,x1,  x2,  x3);
-   case D3Q27System::NE :
-      return (*this->nonLocalDistributions)(D3Q27System::ET_SW,x1+1,x2+1,x3   );
-   case D3Q27System::NW :
-      return (*this->nonLocalDistributions)(D3Q27System::ET_SE,x1,  x2+1,x3   );
-   case D3Q27System::SE :
-      return (*this->localDistributions)(D3Q27System::ET_NW,x1+1,x2,  x3);
-   case D3Q27System::BW :
-      return (*this->localDistributions)(D3Q27System::ET_TE,x1,  x2,  x3);
-   case D3Q27System::TE :
-      return (*this->nonLocalDistributions)(D3Q27System::ET_BW,x1+1,x2,  x3+1 );
-   case D3Q27System::TW :
-      return (*this->nonLocalDistributions)(D3Q27System::ET_BE,x1,  x2,  x3+1 );
-   case D3Q27System::BE :
-      return (*this->localDistributions)(D3Q27System::ET_TW,x1+1,x2,  x3);
-   case D3Q27System::BS :
-      return (*this->localDistributions)(D3Q27System::ET_TN,x1,  x2,  x3);
-   case D3Q27System::TN :
-      return (*this->nonLocalDistributions)(D3Q27System::ET_BS,x1,  x2+1,x3+1 );
-   case D3Q27System::TS :
-      return (*this->nonLocalDistributions)(D3Q27System::ET_BN,x1,  x2,  x3+1 );
-   case D3Q27System::BN :
-      return (*this->localDistributions)(D3Q27System::ET_TS,x1,  x2+1,x3);
-   case D3Q27System::BSW :
-      return (*this->localDistributions)(D3Q27System::ET_TNE,x1,  x2,  x3);
-   case D3Q27System::TNE :
-      return (*this->nonLocalDistributions)(D3Q27System::ET_BSW,x1+1,x2+1,x3+1);
-   case D3Q27System::BSE :
-      return (*this->localDistributions)(D3Q27System::ET_TNW,x1+1,x2,  x3);
-   case D3Q27System::TNW :
-      return (*this->nonLocalDistributions)(D3Q27System::ET_BSE,x1,  x2+1,x3+1);
-   case D3Q27System::BNW :
-      return (*this->localDistributions)(D3Q27System::ET_TSE,x1,  x2+1,x3);
-   case D3Q27System::TSE :
-      return (*this->nonLocalDistributions)(D3Q27System::ET_BNW,x1+1,x2,  x3+1);
-   case D3Q27System::BNE :
-      return (*this->localDistributions)(D3Q27System::ET_TSW,x1+1,x2+1,x3);
-   case D3Q27System::TSW :
-      return (*this->nonLocalDistributions)(D3Q27System::ET_BNE,x1,  x2,  x3+1);
-   case D3Q27System::ZERO :
-      return (*this->zeroDistributions)(x1,x2,x3);
-   default:
-      UB_THROW( UbException(UB_EXARGS, "Direction didn't find") );     
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-size_t D3Q27EsoTwist3DSplittedVector::getNX1() const
-{
-   return NX1;
-}
-//////////////////////////////////////////////////////////////////////////
-size_t D3Q27EsoTwist3DSplittedVector::getNX2() const
-{
-   return NX2;
-}
-//////////////////////////////////////////////////////////////////////////
-size_t D3Q27EsoTwist3DSplittedVector::getNX3() const
-{
-   return NX3;
-}
-//////////////////////////////////////////////////////////////////////////
-CbArray4D<LBMReal,IndexerX4X3X2X1>::CbArray4DPtr D3Q27EsoTwist3DSplittedVector::getLocalDistributions()
-{
-   return this->localDistributions;
-}
-//////////////////////////////////////////////////////////////////////////
-CbArray4D<LBMReal,IndexerX4X3X2X1>::CbArray4DPtr D3Q27EsoTwist3DSplittedVector::getNonLocalDistributions()
-{
-   return this->nonLocalDistributions;
-}
-//////////////////////////////////////////////////////////////////////////
-CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr D3Q27EsoTwist3DSplittedVector::getZeroDistributions()
-{
-   return this->zeroDistributions;
-}
-//////////////////////////////////////////////////////////////////////////
-void D3Q27EsoTwist3DSplittedVector::setNX1(size_t newNX1)
-{
-   NX1 = newNX1;
-}
-//////////////////////////////////////////////////////////////////////////
-void D3Q27EsoTwist3DSplittedVector::setNX2(size_t newNX2)
-{
-   NX2 = newNX2;
-}
-//////////////////////////////////////////////////////////////////////////
-void D3Q27EsoTwist3DSplittedVector::setNX3(size_t newNX3)
-{
-   NX3 = newNX3;
-}
-//////////////////////////////////////////////////////////////////////////
-void D3Q27EsoTwist3DSplittedVector::setLocalDistributions(CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr array)
-{
-   localDistributions = array;
-}
-//////////////////////////////////////////////////////////////////////////
-void D3Q27EsoTwist3DSplittedVector::setNonLocalDistributions(CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr array)
-{
-   nonLocalDistributions = array;
-}
-//////////////////////////////////////////////////////////////////////////
-void D3Q27EsoTwist3DSplittedVector::setZeroDistributions(CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr array)
-{
-   zeroDistributions = array;
-}
-
-//////////////////////////////////////////////////////////////////////////
-
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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"
+
+D3Q27EsoTwist3DSplittedVector::D3Q27EsoTwist3DSplittedVector()
+{
+}
+//////////////////////////////////////////////////////////////////////////
+D3Q27EsoTwist3DSplittedVector::D3Q27EsoTwist3DSplittedVector( size_t nx1, size_t nx2, size_t nx3, LBMReal value )
+{
+   this->NX1 = nx1;
+   this->NX2 = nx2;
+   this->NX3 = nx3;
+
+   this->localDistributions    = CbArray4D<LBMReal,IndexerX4X3X2X1>::CbArray4DPtr(new CbArray4D<LBMReal,IndexerX4X3X2X1>(13, nx1+1, nx2+1, nx3+1, value));
+   this->nonLocalDistributions = CbArray4D<LBMReal,IndexerX4X3X2X1>::CbArray4DPtr(new CbArray4D<LBMReal,IndexerX4X3X2X1>(13, nx1+1, nx2+1, nx3+1, value));
+
+   this->zeroDistributions     = CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal,IndexerX3X2X1>(nx1, nx2, nx3, value));
+}
+//////////////////////////////////////////////////////////////////////////
+D3Q27EsoTwist3DSplittedVector::~D3Q27EsoTwist3DSplittedVector()
+{
+
+}
+//////////////////////////////////////////////////////////////////////////
+void D3Q27EsoTwist3DSplittedVector::swap()
+{
+   std::swap( this->localDistributions, this->nonLocalDistributions );
+}
+//////////////////////////////////////////////////////////////////////////
+void D3Q27EsoTwist3DSplittedVector::getDistribution(LBMReal* const f, size_t x1, size_t x2, size_t x3)
+{
+   f[D3Q27System::E] = (*this->localDistributions)(D3Q27System::ET_E, x1,x2,x3);
+   f[D3Q27System::N] = (*this->localDistributions)(D3Q27System::ET_N,x1,x2,x3);  
+   f[D3Q27System::T] = (*this->localDistributions)(D3Q27System::ET_T,x1,x2,x3);
+   f[D3Q27System::NE] = (*this->localDistributions)(D3Q27System::ET_NE,x1,x2,x3);
+   f[D3Q27System::NW] = (*this->localDistributions)(D3Q27System::ET_NW,x1+1,x2,x3);
+   f[D3Q27System::TE] = (*this->localDistributions)(D3Q27System::ET_TE,x1,x2,x3);
+   f[D3Q27System::TW] = (*this->localDistributions)(D3Q27System::ET_TW, x1+1,x2,x3);
+   f[D3Q27System::TN] = (*this->localDistributions)(D3Q27System::ET_TN,x1,x2,x3);
+   f[D3Q27System::TS] = (*this->localDistributions)(D3Q27System::ET_TS,x1,x2+1,x3);
+   f[D3Q27System::TNE] = (*this->localDistributions)(D3Q27System::ET_TNE,x1,x2,x3);
+   f[D3Q27System::TNW] = (*this->localDistributions)(D3Q27System::ET_TNW,x1+1,x2,x3);
+   f[D3Q27System::TSE] = (*this->localDistributions)(D3Q27System::ET_TSE,x1,x2+1,x3);
+   f[D3Q27System::TSW] = (*this->localDistributions)(D3Q27System::ET_TSW,x1+1,x2+1,x3);
+
+   f[D3Q27System::W ] = (*this->nonLocalDistributions)(D3Q27System::ET_W,x1+1,x2,x3  );
+   f[D3Q27System::S ] = (*this->nonLocalDistributions)(D3Q27System::ET_S,x1,x2+1,x3  );
+   f[D3Q27System::B ] = (*this->nonLocalDistributions)(D3Q27System::ET_B,x1,x2,x3+1  );
+   f[D3Q27System::SW] = (*this->nonLocalDistributions)(D3Q27System::ET_SW,x1+1,x2+1,x3 );
+   f[D3Q27System::SE] = (*this->nonLocalDistributions)(D3Q27System::ET_SE,x1,x2+1,x3 );
+   f[D3Q27System::BW] = (*this->nonLocalDistributions)(D3Q27System::ET_BW,x1+1,x2,x3+1 );
+   f[D3Q27System::BE] = (*this->nonLocalDistributions)(D3Q27System::ET_BE,x1,x2,x3+1 );
+   f[D3Q27System::BS] = (*this->nonLocalDistributions)(D3Q27System::ET_BS,x1,x2+1,x3+1 );
+   f[D3Q27System::BN] = (*this->nonLocalDistributions)(D3Q27System::ET_BN,x1,x2,x3+1 );
+   f[D3Q27System::BSW] = (*this->nonLocalDistributions)(D3Q27System::ET_BSW,x1+1,x2+1,x3+1);
+   f[D3Q27System::BSE] = (*this->nonLocalDistributions)(D3Q27System::ET_BSE,x1,x2+1,x3+1);
+   f[D3Q27System::BNW] = (*this->nonLocalDistributions)(D3Q27System::ET_BNW,x1+1,x2,x3+1);
+   f[D3Q27System::BNE] = (*this->nonLocalDistributions)(D3Q27System::ET_BNE,x1,x2,x3+1);
+
+   f[D3Q27System::ZERO] = (*this->zeroDistributions)(x1,x2,x3);
+}
+//////////////////////////////////////////////////////////////////////////
+void D3Q27EsoTwist3DSplittedVector::setDistribution(const LBMReal* const f, size_t x1, size_t x2, size_t x3)
+{
+   (*this->localDistributions)(D3Q27System::ET_E,x1,  x2,  x3)   = f[D3Q27System::INV_E];
+   (*this->localDistributions)(D3Q27System::ET_N,x1,  x2,  x3)   = f[D3Q27System::INV_N];
+   (*this->localDistributions)(D3Q27System::ET_T,x1,  x2,  x3)   = f[D3Q27System::INV_T];
+   (*this->localDistributions)(D3Q27System::ET_NE,x1,  x2,  x3)  = f[D3Q27System::INV_NE];
+   (*this->localDistributions)(D3Q27System::ET_NW,x1+1,x2,  x3)  = f[D3Q27System::INV_NW];
+   (*this->localDistributions)(D3Q27System::ET_TE,x1,  x2,  x3)  = f[D3Q27System::INV_TE];
+   (*this->localDistributions)(D3Q27System::ET_TW,x1+1,x2,  x3)  = f[D3Q27System::INV_TW];
+   (*this->localDistributions)(D3Q27System::ET_TN,x1,  x2,  x3)  = f[D3Q27System::INV_TN];
+   (*this->localDistributions)(D3Q27System::ET_TS,x1,  x2+1,x3)  = f[D3Q27System::INV_TS];
+   (*this->localDistributions)(D3Q27System::ET_TNE,x1,  x2,  x3) = f[D3Q27System::INV_TNE];
+   (*this->localDistributions)(D3Q27System::ET_TNW,x1+1,x2,  x3) = f[D3Q27System::INV_TNW];
+   (*this->localDistributions)(D3Q27System::ET_TSE,x1,  x2+1,x3) = f[D3Q27System::INV_TSE];
+   (*this->localDistributions)(D3Q27System::ET_TSW,x1+1,x2+1,x3) = f[D3Q27System::INV_TSW];
+
+   (*this->nonLocalDistributions)(D3Q27System::ET_W,x1+1,x2,  x3    ) = f[D3Q27System::INV_W ];
+   (*this->nonLocalDistributions)(D3Q27System::ET_S,x1,  x2+1,x3    ) = f[D3Q27System::INV_S ];
+   (*this->nonLocalDistributions)(D3Q27System::ET_B,x1,  x2,  x3+1  ) = f[D3Q27System::INV_B ];
+   (*this->nonLocalDistributions)(D3Q27System::ET_SW,x1+1,x2+1,x3   ) = f[D3Q27System::INV_SW];
+   (*this->nonLocalDistributions)(D3Q27System::ET_SE,x1,  x2+1,x3   ) = f[D3Q27System::INV_SE];
+   (*this->nonLocalDistributions)(D3Q27System::ET_BW,x1+1,x2,  x3+1 ) = f[D3Q27System::INV_BW];
+   (*this->nonLocalDistributions)(D3Q27System::ET_BE,x1,  x2,  x3+1 ) = f[D3Q27System::INV_BE];
+   (*this->nonLocalDistributions)(D3Q27System::ET_BS,x1,  x2+1,x3+1 ) = f[D3Q27System::INV_BS];
+   (*this->nonLocalDistributions)(D3Q27System::ET_BN,x1,  x2,  x3+1 ) = f[D3Q27System::INV_BN];
+   (*this->nonLocalDistributions)(D3Q27System::ET_BSW,x1+1,x2+1,x3+1) = f[D3Q27System::INV_BSW];
+   (*this->nonLocalDistributions)(D3Q27System::ET_BSE,x1,  x2+1,x3+1) = f[D3Q27System::INV_BSE];
+   (*this->nonLocalDistributions)(D3Q27System::ET_BNW,x1+1,x2,  x3+1) = f[D3Q27System::INV_BNW];
+   (*this->nonLocalDistributions)(D3Q27System::ET_BNE,x1,  x2,  x3+1) = f[D3Q27System::INV_BNE];
+
+   (*this->zeroDistributions)(x1,x2,x3) = f[D3Q27System::ZERO];
+}
+//////////////////////////////////////////////////////////////////////////
+void D3Q27EsoTwist3DSplittedVector::getDistributionInv(LBMReal* const f, size_t x1, size_t x2, size_t x3)
+{
+   f[D3Q27System::INV_E] = (*this->localDistributions)(D3Q27System::ET_E, x1,x2,x3);
+   f[D3Q27System::INV_N] = (*this->localDistributions)(D3Q27System::ET_N,x1,x2,x3);  
+   f[D3Q27System::INV_T] = (*this->localDistributions)(D3Q27System::ET_T,x1,x2,x3);
+   f[D3Q27System::INV_NE] = (*this->localDistributions)(D3Q27System::ET_NE,x1,x2,x3);
+   f[D3Q27System::INV_NW] = (*this->localDistributions)(D3Q27System::ET_NW,x1+1,x2,x3);
+   f[D3Q27System::INV_TE] = (*this->localDistributions)(D3Q27System::ET_TE,x1,x2,x3);
+   f[D3Q27System::INV_TW] = (*this->localDistributions)(D3Q27System::ET_TW, x1+1,x2,x3);
+   f[D3Q27System::INV_TN] = (*this->localDistributions)(D3Q27System::ET_TN,x1,x2,x3);
+   f[D3Q27System::INV_TS] = (*this->localDistributions)(D3Q27System::ET_TS,x1,x2+1,x3);
+   f[D3Q27System::INV_TNE] = (*this->localDistributions)(D3Q27System::ET_TNE,x1,x2,x3);
+   f[D3Q27System::INV_TNW] = (*this->localDistributions)(D3Q27System::ET_TNW,x1+1,x2,x3);
+   f[D3Q27System::INV_TSE] = (*this->localDistributions)(D3Q27System::ET_TSE,x1,x2+1,x3);
+   f[D3Q27System::INV_TSW] = (*this->localDistributions)(D3Q27System::ET_TSW,x1+1,x2+1,x3);
+
+   f[D3Q27System::INV_W ] = (*this->nonLocalDistributions)(D3Q27System::ET_W,x1+1,x2,x3  );
+   f[D3Q27System::INV_S ] = (*this->nonLocalDistributions)(D3Q27System::ET_S,x1,x2+1,x3  );
+   f[D3Q27System::INV_B ] = (*this->nonLocalDistributions)(D3Q27System::ET_B,x1,x2,x3+1  );
+   f[D3Q27System::INV_SW] = (*this->nonLocalDistributions)(D3Q27System::ET_SW,x1+1,x2+1,x3 );
+   f[D3Q27System::INV_SE] = (*this->nonLocalDistributions)(D3Q27System::ET_SE,x1,x2+1,x3 );
+   f[D3Q27System::INV_BW] = (*this->nonLocalDistributions)(D3Q27System::ET_BW,x1+1,x2,x3+1 );
+   f[D3Q27System::INV_BE] = (*this->nonLocalDistributions)(D3Q27System::ET_BE,x1,x2,x3+1 );
+   f[D3Q27System::INV_BS] = (*this->nonLocalDistributions)(D3Q27System::ET_BS,x1,x2+1,x3+1 );
+   f[D3Q27System::INV_BN] = (*this->nonLocalDistributions)(D3Q27System::ET_BN,x1,x2,x3+1 );
+   f[D3Q27System::INV_BSW] = (*this->nonLocalDistributions)(D3Q27System::ET_BSW,x1+1,x2+1,x3+1);
+   f[D3Q27System::INV_BSE] = (*this->nonLocalDistributions)(D3Q27System::ET_BSE,x1,x2+1,x3+1);
+   f[D3Q27System::INV_BNW] = (*this->nonLocalDistributions)(D3Q27System::ET_BNW,x1+1,x2,x3+1);
+   f[D3Q27System::INV_BNE] = (*this->nonLocalDistributions)(D3Q27System::ET_BNE,x1,x2,x3+1);
+
+   f[D3Q27System::ZERO] = (*this->zeroDistributions)(x1,x2,x3);
+}
+//////////////////////////////////////////////////////////////////////////
+void D3Q27EsoTwist3DSplittedVector::setDistributionInv(const LBMReal* const f, size_t x1, size_t x2, size_t x3)
+{
+   (*this->localDistributions)(D3Q27System::ET_E,x1,  x2,  x3) = f[D3Q27System::E];
+   (*this->localDistributions)(D3Q27System::ET_N,x1,  x2,  x3) = f[D3Q27System::N];
+   (*this->localDistributions)(D3Q27System::ET_T,x1,  x2,  x3) = f[D3Q27System::T];
+   (*this->localDistributions)(D3Q27System::ET_NE,x1,  x2,  x3) = f[D3Q27System::NE];
+   (*this->localDistributions)(D3Q27System::ET_NW,x1+1,x2,  x3) = f[D3Q27System::NW];
+   (*this->localDistributions)(D3Q27System::ET_TE,x1,  x2,  x3) = f[D3Q27System::TE];
+   (*this->localDistributions)(D3Q27System::ET_TW,x1+1,x2,  x3) = f[D3Q27System::TW];
+   (*this->localDistributions)(D3Q27System::ET_TN,x1,  x2,  x3) = f[D3Q27System::TN];
+   (*this->localDistributions)(D3Q27System::ET_TS,x1,  x2+1,x3) = f[D3Q27System::TS];
+   (*this->localDistributions)(D3Q27System::ET_TNE,x1,  x2,  x3) = f[D3Q27System::TNE];
+   (*this->localDistributions)(D3Q27System::ET_TNW,x1+1,x2,  x3) = f[D3Q27System::TNW];
+   (*this->localDistributions)(D3Q27System::ET_TSE,x1,  x2+1,x3) = f[D3Q27System::TSE];
+   (*this->localDistributions)(D3Q27System::ET_TSW,x1+1,x2+1,x3) = f[D3Q27System::TSW];
+
+   (*this->nonLocalDistributions)(D3Q27System::ET_W,x1+1,x2,  x3    ) = f[D3Q27System::W ];
+   (*this->nonLocalDistributions)(D3Q27System::ET_S,x1,  x2+1,x3    ) = f[D3Q27System::S ];
+   (*this->nonLocalDistributions)(D3Q27System::ET_B,x1,  x2,  x3+1  ) = f[D3Q27System::B ];
+   (*this->nonLocalDistributions)(D3Q27System::ET_SW,x1+1,x2+1,x3   ) = f[D3Q27System::SW];
+   (*this->nonLocalDistributions)(D3Q27System::ET_SE,x1,  x2+1,x3   ) = f[D3Q27System::SE];
+   (*this->nonLocalDistributions)(D3Q27System::ET_BW,x1+1,x2,  x3+1 ) = f[D3Q27System::BW];
+   (*this->nonLocalDistributions)(D3Q27System::ET_BE,x1,  x2,  x3+1 ) = f[D3Q27System::BE];
+   (*this->nonLocalDistributions)(D3Q27System::ET_BS,x1,  x2+1,x3+1 ) = f[D3Q27System::BS];
+   (*this->nonLocalDistributions)(D3Q27System::ET_BN,x1,  x2,  x3+1 ) = f[D3Q27System::BN];
+   (*this->nonLocalDistributions)(D3Q27System::ET_BSW,x1+1,x2+1,x3+1) = f[D3Q27System::BSW];
+   (*this->nonLocalDistributions)(D3Q27System::ET_BSE,x1,  x2+1,x3+1) = f[D3Q27System::BSE];
+   (*this->nonLocalDistributions)(D3Q27System::ET_BNW,x1+1,x2,  x3+1) = f[D3Q27System::BNW];
+   (*this->nonLocalDistributions)(D3Q27System::ET_BNE,x1,  x2,  x3+1) = f[D3Q27System::BNE];
+
+   (*this->zeroDistributions)(x1,x2,x3) = f[D3Q27System::ZERO];
+}
+//////////////////////////////////////////////////////////////////////////
+void D3Q27EsoTwist3DSplittedVector::setDistributionForDirection(const LBMReal* const f, size_t x1, size_t x2, size_t x3, unsigned long int direction)
+{
+   bool directionFlag = false;
+   if ((direction & EsoTwistD3Q27System::etE) == EsoTwistD3Q27System::etE)
+      (*this->nonLocalDistributions)(D3Q27System::ET_W,x1+1,x2,  x3    ) = f[D3Q27System::E]; directionFlag=true;
+   if ((direction & EsoTwistD3Q27System::etW) == EsoTwistD3Q27System::etW)
+      (*this->localDistributions)(D3Q27System::ET_E,x1,  x2,  x3) = f[D3Q27System::W]; directionFlag=true;
+   if ((direction & EsoTwistD3Q27System::etS) == EsoTwistD3Q27System::etS)
+      (*this->localDistributions)(D3Q27System::ET_N,x1,  x2,  x3) = f[D3Q27System::S]; directionFlag=true;
+   if ((direction & EsoTwistD3Q27System::etN) == EsoTwistD3Q27System::etN)
+      (*this->nonLocalDistributions)(D3Q27System::ET_S,x1,  x2+1,x3    ) = f[D3Q27System::N]; directionFlag=true;
+   if ((direction & EsoTwistD3Q27System::etB) == EsoTwistD3Q27System::etB)
+      (*this->localDistributions)(D3Q27System::ET_T,x1,  x2,  x3) = f[D3Q27System::B]; directionFlag=true;
+   if ((direction & EsoTwistD3Q27System::etT) == EsoTwistD3Q27System::etT)
+      (*this->nonLocalDistributions)(D3Q27System::ET_B,x1,  x2,  x3+1  ) = f[D3Q27System::T]; directionFlag=true;
+   if ((direction & EsoTwistD3Q27System::etSW) == EsoTwistD3Q27System::etSW)
+      (*this->localDistributions)(D3Q27System::ET_NE,x1,  x2,  x3) = f[D3Q27System::SW]; directionFlag=true;
+   if ((direction & EsoTwistD3Q27System::etNE) == EsoTwistD3Q27System::etNE)
+      (*this->nonLocalDistributions)(D3Q27System::ET_SW,x1+1,x2+1,x3   ) = f[D3Q27System::NE]; directionFlag=true;
+   if ((direction & EsoTwistD3Q27System::etNW) == EsoTwistD3Q27System::etNW)
+      (*this->nonLocalDistributions)(D3Q27System::ET_SE,x1,  x2+1,x3   ) = f[D3Q27System::NW]; directionFlag=true;
+   if ((direction & EsoTwistD3Q27System::etSE) == EsoTwistD3Q27System::etSE)
+      (*this->localDistributions)(D3Q27System::ET_NW,x1+1,x2,  x3) = f[D3Q27System::SE]; directionFlag=true;
+   if ((direction & EsoTwistD3Q27System::etBW) == EsoTwistD3Q27System::etBW)
+      (*this->localDistributions)(D3Q27System::ET_TE,x1,  x2,  x3) = f[D3Q27System::BW]; directionFlag=true;
+   if ((direction & EsoTwistD3Q27System::etTE) == EsoTwistD3Q27System::etTE)
+      (*this->nonLocalDistributions)(D3Q27System::ET_BW,x1+1,x2,  x3+1 ) = f[D3Q27System::TE]; directionFlag=true;
+   if ((direction & EsoTwistD3Q27System::etTW) == EsoTwistD3Q27System::etTW)
+      (*this->nonLocalDistributions)(D3Q27System::ET_BE,x1,  x2,  x3+1 ) = f[D3Q27System::TW]; directionFlag=true;
+   if ((direction & EsoTwistD3Q27System::etBE) == EsoTwistD3Q27System::etBE)
+      (*this->localDistributions)(D3Q27System::ET_TW,x1+1,x2,  x3) = f[D3Q27System::BE]; directionFlag=true;
+   if ((direction & EsoTwistD3Q27System::etBS) == EsoTwistD3Q27System::etBS)
+      (*this->localDistributions)(D3Q27System::ET_TN,x1,  x2,  x3) = f[D3Q27System::BS]; directionFlag=true;
+   if ((direction & EsoTwistD3Q27System::etTN) == EsoTwistD3Q27System::etTN)
+      (*this->nonLocalDistributions)(D3Q27System::ET_BS,x1,  x2+1,x3+1 ) = f[D3Q27System::TN]; directionFlag=true;
+   if ((direction & EsoTwistD3Q27System::etTS) == EsoTwistD3Q27System::etTS)
+      (*this->nonLocalDistributions)(D3Q27System::ET_BN,x1,  x2,  x3+1 ) = f[D3Q27System::TS]; directionFlag=true;
+   if ((direction & EsoTwistD3Q27System::etBN) == EsoTwistD3Q27System::etBN)
+      (*this->localDistributions)(D3Q27System::ET_TS,x1,  x2+1,x3) = f[D3Q27System::BN]; directionFlag=true;
+   if ((direction & EsoTwistD3Q27System::etBSW) == EsoTwistD3Q27System::etBSW)
+      (*this->localDistributions)(D3Q27System::ET_TNE,x1,  x2,  x3) = f[D3Q27System::BSW]; directionFlag=true;
+   if ((direction & EsoTwistD3Q27System::etTNE) == EsoTwistD3Q27System::etTNE)
+      (*this->nonLocalDistributions)(D3Q27System::ET_BSW,x1+1,x2+1,x3+1) = f[D3Q27System::TNE]; directionFlag=true;
+   if ((direction & EsoTwistD3Q27System::etBSE) == EsoTwistD3Q27System::etBSE)
+      (*this->localDistributions)(D3Q27System::ET_TNW,x1+1,x2,  x3) = f[D3Q27System::BSE]; directionFlag=true;
+   if ((direction & EsoTwistD3Q27System::etTNW) == EsoTwistD3Q27System::etTNW)
+      (*this->nonLocalDistributions)(D3Q27System::ET_BSE,x1,  x2+1,x3+1) = f[D3Q27System::TNW]; directionFlag=true;
+   if ((direction & EsoTwistD3Q27System::etBNW) == EsoTwistD3Q27System::etBNW)
+      (*this->localDistributions)(D3Q27System::ET_TSE,x1,  x2+1,x3) = f[D3Q27System::BNW]; directionFlag=true;
+   if ((direction & EsoTwistD3Q27System::etTSE) == EsoTwistD3Q27System::etTSE)
+      (*this->nonLocalDistributions)(D3Q27System::ET_BNW,x1+1,x2,  x3+1) = f[D3Q27System::TSE]; directionFlag=true;
+   if ((direction & EsoTwistD3Q27System::etBNE) == EsoTwistD3Q27System::etBNE)
+      (*this->localDistributions)(D3Q27System::ET_TSW,x1+1,x2+1,x3) = f[D3Q27System::BNE]; directionFlag=true;
+   if ((direction & EsoTwistD3Q27System::etTSW) == EsoTwistD3Q27System::etTSW)
+      (*this->nonLocalDistributions)(D3Q27System::ET_BNE,x1,  x2,  x3+1) = f[D3Q27System::TSW]; directionFlag=true;
+   if ((direction & EsoTwistD3Q27System::ZERO) == EsoTwistD3Q27System::ZERO)
+      (*this->zeroDistributions)(x1,x2,x3) = f[D3Q27System::ZERO]; directionFlag=true;
+#ifdef _DEBUG
+   if(!directionFlag)UB_THROW( UbException(UB_EXARGS, "Direction didn't find") );
+#endif //DEBUG
+}
+//////////////////////////////////////////////////////////////////////////
+void D3Q27EsoTwist3DSplittedVector::setDistributionForDirection(LBMReal f, size_t x1, size_t x2, size_t x3, int direction)
+{
+   switch (direction)
+   {
+   case D3Q27System::E :
+      (*this->nonLocalDistributions)(D3Q27System::ET_W,x1+1,x2,  x3    ) = f;
+      break;
+   case D3Q27System::W :
+      (*this->localDistributions)(D3Q27System::ET_E,x1,  x2,  x3) = f;
+      break;
+   case D3Q27System::S :
+      (*this->localDistributions)(D3Q27System::ET_N,x1,  x2,  x3) = f;
+      break;
+   case D3Q27System::N :
+      (*this->nonLocalDistributions)(D3Q27System::ET_S,x1,  x2+1,x3    ) = f;
+      break;
+   case D3Q27System::B :
+      (*this->localDistributions)(D3Q27System::ET_T,x1,  x2,  x3) = f;
+      break;
+   case D3Q27System::T :
+      (*this->nonLocalDistributions)(D3Q27System::ET_B,x1,  x2,  x3+1  ) = f;
+      break;
+   case D3Q27System::SW :
+      (*this->localDistributions)(D3Q27System::ET_NE,x1,  x2,  x3) = f;
+      break;
+   case D3Q27System::NE :
+      (*this->nonLocalDistributions)(D3Q27System::ET_SW,x1+1,x2+1,x3   ) = f;
+      break;
+   case D3Q27System::NW :
+      (*this->nonLocalDistributions)(D3Q27System::ET_SE,x1,  x2+1,x3   ) = f;
+      break;
+   case D3Q27System::SE :
+      (*this->localDistributions)(D3Q27System::ET_NW,x1+1,x2,  x3) = f;
+      break;
+   case D3Q27System::BW :
+      (*this->localDistributions)(D3Q27System::ET_TE,x1,  x2,  x3) = f;
+      break;
+   case D3Q27System::TE :
+      (*this->nonLocalDistributions)(D3Q27System::ET_BW,x1+1,x2,  x3+1 ) = f;
+      break;
+   case D3Q27System::TW :
+      (*this->nonLocalDistributions)(D3Q27System::ET_BE,x1,  x2,  x3+1 ) = f;
+      break;
+   case D3Q27System::BE :
+      (*this->localDistributions)(D3Q27System::ET_TW,x1+1,x2,  x3) = f;
+      break;
+   case D3Q27System::BS :
+      (*this->localDistributions)(D3Q27System::ET_TN,x1,  x2,  x3) = f;
+      break;
+   case D3Q27System::TN :
+      (*this->nonLocalDistributions)(D3Q27System::ET_BS,x1,  x2+1,x3+1 ) = f;
+      break;
+   case D3Q27System::TS :
+      (*this->nonLocalDistributions)(D3Q27System::ET_BN,x1,  x2,  x3+1 ) = f;
+      break;
+   case D3Q27System::BN :
+      (*this->localDistributions)(D3Q27System::ET_TS,x1,  x2+1,x3) = f;
+      break;
+   case D3Q27System::BSW :
+      (*this->localDistributions)(D3Q27System::ET_TNE,x1,  x2,  x3) = f;
+      break;
+   case D3Q27System::TNE :
+      (*this->nonLocalDistributions)(D3Q27System::ET_BSW,x1+1,x2+1,x3+1) = f;
+      break;
+   case D3Q27System::BSE :
+      (*this->localDistributions)(D3Q27System::ET_TNW,x1+1,x2,  x3) = f;
+      break;
+   case D3Q27System::TNW :
+      (*this->nonLocalDistributions)(D3Q27System::ET_BSE,x1,  x2+1,x3+1) = f;
+      break;
+   case D3Q27System::BNW :
+      (*this->localDistributions)(D3Q27System::ET_TSE,x1,  x2+1,x3) = f;
+      break;
+   case D3Q27System::TSE :
+      (*this->nonLocalDistributions)(D3Q27System::ET_BNW,x1+1,x2,  x3+1) = f;
+      break;
+   case D3Q27System::BNE :
+      (*this->localDistributions)(D3Q27System::ET_TSW,x1+1,x2+1,x3) = f;
+      break;
+   case D3Q27System::TSW :
+      (*this->nonLocalDistributions)(D3Q27System::ET_BNE,x1,  x2,  x3+1) = f;
+      break;
+   case D3Q27System::ZERO :
+      (*this->zeroDistributions)(x1,x2,x3) = f;
+      break;
+   default:
+      UB_THROW( UbException(UB_EXARGS, "Direction didn't find") );     
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+void D3Q27EsoTwist3DSplittedVector::setDistributionInvForDirection(const LBMReal* const f, size_t x1, size_t x2, size_t x3, unsigned long int direction)
+{
+   bool directionFlag = false;
+   if ((direction & EsoTwistD3Q27System::etE) == EsoTwistD3Q27System::etE)
+       (*this->localDistributions)(D3Q27System::ET_E,x1,  x2,  x3) = f[D3Q27System::E]; directionFlag=true;
+   if ((direction & EsoTwistD3Q27System::etW) == EsoTwistD3Q27System::etW)
+      (*this->nonLocalDistributions)(D3Q27System::ET_W,x1+1,x2,  x3    ) = f[D3Q27System::W]; directionFlag=true;
+   if ((direction & EsoTwistD3Q27System::etS) == EsoTwistD3Q27System::etS)
+       (*this->nonLocalDistributions)(D3Q27System::ET_S,x1,  x2+1,x3    ) = f[D3Q27System::S]; directionFlag=true;
+   if ((direction & EsoTwistD3Q27System::etN) == EsoTwistD3Q27System::etN)
+      (*this->localDistributions)(D3Q27System::ET_N,x1,  x2,  x3) = f[D3Q27System::N]; directionFlag=true;
+   if ((direction & EsoTwistD3Q27System::etB) == EsoTwistD3Q27System::etB)
+       (*this->nonLocalDistributions)(D3Q27System::ET_B,x1,  x2,  x3+1  ) = f[D3Q27System::B]; directionFlag=true;
+   if ((direction & EsoTwistD3Q27System::etT) == EsoTwistD3Q27System::etT)
+      (*this->localDistributions)(D3Q27System::ET_T,x1,  x2,  x3) = f[D3Q27System::T]; directionFlag=true;
+   if ((direction & EsoTwistD3Q27System::etSW) == EsoTwistD3Q27System::etSW)
+       (*this->nonLocalDistributions)(D3Q27System::ET_SW,x1+1,x2+1,x3   ) = f[D3Q27System::SW]; directionFlag=true;
+   if ((direction & EsoTwistD3Q27System::etNE) == EsoTwistD3Q27System::etNE)
+      (*this->localDistributions)(D3Q27System::ET_NE,x1,  x2,  x3) = f[D3Q27System::NE]; directionFlag=true;
+   if ((direction & EsoTwistD3Q27System::etNW) == EsoTwistD3Q27System::etNW)
+       (*this->localDistributions)(D3Q27System::ET_NW,x1+1,x2,  x3) = f[D3Q27System::NW]; directionFlag=true;
+   if ((direction & EsoTwistD3Q27System::etSE) == EsoTwistD3Q27System::etSE)
+      (*this->nonLocalDistributions)(D3Q27System::ET_SE,x1,  x2+1,x3   ) = f[D3Q27System::SE]; directionFlag=true;
+   if ((direction & EsoTwistD3Q27System::etBW) == EsoTwistD3Q27System::etBW)
+       (*this->nonLocalDistributions)(D3Q27System::ET_BW,x1+1,x2,  x3+1 ) = f[D3Q27System::BW]; directionFlag=true;
+   if ((direction & EsoTwistD3Q27System::etTE) == EsoTwistD3Q27System::etTE)
+      (*this->localDistributions)(D3Q27System::ET_TE,x1,  x2,  x3) = f[D3Q27System::TE]; directionFlag=true;
+   if ((direction & EsoTwistD3Q27System::etTW) == EsoTwistD3Q27System::etTW)
+       (*this->localDistributions)(D3Q27System::ET_TW,x1+1,x2,  x3) = f[D3Q27System::TW]; directionFlag=true;
+   if ((direction & EsoTwistD3Q27System::etBE) == EsoTwistD3Q27System::etBE)
+      (*this->nonLocalDistributions)(D3Q27System::ET_BE,x1,  x2,  x3+1 ) = f[D3Q27System::BE]; directionFlag=true;
+   if ((direction & EsoTwistD3Q27System::etBS) == EsoTwistD3Q27System::etBS)
+       (*this->nonLocalDistributions)(D3Q27System::ET_BS,x1,  x2+1,x3+1 ) = f[D3Q27System::BS]; directionFlag=true;
+   if ((direction & EsoTwistD3Q27System::etTN) == EsoTwistD3Q27System::etTN)
+      (*this->localDistributions)(D3Q27System::ET_TN,x1,  x2,  x3) = f[D3Q27System::TN]; directionFlag=true;
+   if ((direction & EsoTwistD3Q27System::etTS) == EsoTwistD3Q27System::etTS)
+       (*this->localDistributions)(D3Q27System::ET_TS,x1,  x2+1,x3) = f[D3Q27System::TS]; directionFlag=true;
+   if ((direction & EsoTwistD3Q27System::etBN) == EsoTwistD3Q27System::etBN)
+      (*this->nonLocalDistributions)(D3Q27System::ET_BN,x1,  x2,  x3+1 ) = f[D3Q27System::BN]; directionFlag=true;
+   if ((direction & EsoTwistD3Q27System::etBSW) == EsoTwistD3Q27System::etBSW)
+       (*this->nonLocalDistributions)(D3Q27System::ET_BSW,x1+1,x2+1,x3+1) = f[D3Q27System::BSW]; directionFlag=true;
+   if ((direction & EsoTwistD3Q27System::etTNE) == EsoTwistD3Q27System::etTNE)
+      (*this->localDistributions)(D3Q27System::ET_TNE,x1,  x2,  x3) = f[D3Q27System::TNE]; directionFlag=true;
+   if ((direction & EsoTwistD3Q27System::etBSE) == EsoTwistD3Q27System::etBSE)
+       (*this->nonLocalDistributions)(D3Q27System::ET_BSE,x1,  x2+1,x3+1) = f[D3Q27System::BSE]; directionFlag=true;
+   if ((direction & EsoTwistD3Q27System::etTNW) == EsoTwistD3Q27System::etTNW)
+      (*this->localDistributions)(D3Q27System::ET_TNW,x1+1,x2,  x3) = f[D3Q27System::TNW]; directionFlag=true;
+   if ((direction & EsoTwistD3Q27System::etBNW) == EsoTwistD3Q27System::etBNW)
+       (*this->nonLocalDistributions)(D3Q27System::ET_BNW,x1+1,x2,  x3+1) = f[D3Q27System::BNW]; directionFlag=true;
+   if ((direction & EsoTwistD3Q27System::etTSE) == EsoTwistD3Q27System::etTSE)
+      (*this->localDistributions)(D3Q27System::ET_TSE,x1,  x2+1,x3) = f[D3Q27System::TSE]; directionFlag=true;
+   if ((direction & EsoTwistD3Q27System::etBNE) == EsoTwistD3Q27System::etBNE)
+       (*this->nonLocalDistributions)(D3Q27System::ET_BNE,x1,  x2,  x3+1)= f[D3Q27System::BNE]; directionFlag=true;
+   if ((direction & EsoTwistD3Q27System::etTSW) == EsoTwistD3Q27System::etTSW)
+      (*this->localDistributions)(D3Q27System::ET_TSW,x1+1,x2+1,x3) = f[D3Q27System::TSW]; directionFlag=true;
+   if ((direction & EsoTwistD3Q27System::ZERO) == EsoTwistD3Q27System::ZERO)
+      (*this->zeroDistributions)(x1,x2,x3) = f[D3Q27System::ZERO]; directionFlag=true;
+#ifdef _DEBUG
+   if(!directionFlag)UB_THROW( UbException(UB_EXARGS, "Direction didn't find") );
+#endif //DEBUG
+}
+//////////////////////////////////////////////////////////////////////////
+void D3Q27EsoTwist3DSplittedVector::setDistributionInvForDirection(LBMReal f, size_t x1, size_t x2, size_t x3, unsigned long int direction)
+{
+   switch (direction)
+   {
+   case D3Q27System::E :
+      (*this->localDistributions)(D3Q27System::ET_E,x1,  x2,  x3) = f;
+      break;
+   case D3Q27System::W :
+      (*this->nonLocalDistributions)(D3Q27System::ET_W,x1+1,x2,  x3    ) = f;
+      break;
+   case D3Q27System::S :
+      (*this->nonLocalDistributions)(D3Q27System::ET_S,x1,  x2+1,x3    ) = f;
+      break;
+   case D3Q27System::N :
+      (*this->localDistributions)(D3Q27System::ET_N,x1,  x2,  x3) = f;
+      break;
+   case D3Q27System::B :
+      (*this->nonLocalDistributions)(D3Q27System::ET_B,x1,  x2,  x3+1  ) = f;
+      break;
+   case D3Q27System::T :
+      (*this->localDistributions)(D3Q27System::ET_T,x1,  x2,  x3) = f;
+      break;
+   case D3Q27System::SW :
+      (*this->nonLocalDistributions)(D3Q27System::ET_SW,x1+1,x2+1,x3   ) = f;
+      break;
+   case D3Q27System::NE :
+      (*this->localDistributions)(D3Q27System::ET_NE,x1,  x2,  x3) = f;
+      break;
+   case D3Q27System::NW :
+      (*this->localDistributions)(D3Q27System::ET_NW,x1+1,x2,  x3) = f;
+      break;
+   case D3Q27System::SE :
+      (*this->nonLocalDistributions)(D3Q27System::ET_SE,x1,  x2+1,x3   ) = f;
+      break;
+   case D3Q27System::BW :
+      (*this->nonLocalDistributions)(D3Q27System::ET_BW,x1+1,x2,  x3+1 ) = f;
+      break;
+   case D3Q27System::TE :
+      (*this->localDistributions)(D3Q27System::ET_TE,x1,  x2,  x3) = f;
+      break;
+   case D3Q27System::TW :
+      (*this->localDistributions)(D3Q27System::ET_TW,x1+1,x2,  x3) = f;
+      break;
+   case D3Q27System::BE :
+      (*this->nonLocalDistributions)(D3Q27System::ET_BE,x1,  x2,  x3+1 ) = f;
+      break;
+   case D3Q27System::BS :
+      (*this->nonLocalDistributions)(D3Q27System::ET_BS,x1,  x2+1,x3+1 ) = f;
+      break;
+   case D3Q27System::TN :
+      (*this->localDistributions)(D3Q27System::ET_TN,x1,  x2,  x3) = f;
+      break;
+   case D3Q27System::TS :
+      (*this->localDistributions)(D3Q27System::ET_TS,x1,  x2+1,x3) = f;
+      break;
+   case D3Q27System::BN :
+      (*this->nonLocalDistributions)(D3Q27System::ET_BN,x1,  x2,  x3+1 ) = f;
+      break;
+   case D3Q27System::BSW :
+      (*this->nonLocalDistributions)(D3Q27System::ET_BSW,x1+1,x2+1,x3+1) = f;
+      break;
+   case D3Q27System::TNE :
+      (*this->localDistributions)(D3Q27System::ET_TNE,x1,  x2,  x3) = f;
+      break;
+   case D3Q27System::BSE :
+      (*this->nonLocalDistributions)(D3Q27System::ET_BSE,x1,  x2+1,x3+1) = f;
+      break;
+   case D3Q27System::TNW :
+      (*this->localDistributions)(D3Q27System::ET_TNW,x1+1,x2,  x3) = f;
+      break;
+   case D3Q27System::BNW :
+      (*this->nonLocalDistributions)(D3Q27System::ET_BNW,x1+1,x2,  x3+1) = f;
+      break;
+   case D3Q27System::TSE :
+      (*this->localDistributions)(D3Q27System::ET_TSE,x1,  x2+1,x3) = f;
+      break;
+   case D3Q27System::BNE :
+      (*this->nonLocalDistributions)(D3Q27System::ET_BNE,x1,  x2,  x3+1) = f;
+      break;
+   case D3Q27System::TSW :
+      (*this->localDistributions)(D3Q27System::ET_TSW,x1+1,x2+1,x3) = f;
+      break;
+   case D3Q27System::ZERO :
+      (*this->zeroDistributions)(x1,x2,x3) = f;
+      break;
+   default:
+      UB_THROW( UbException(UB_EXARGS, "Direction didn't find") );     
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+LBMReal D3Q27EsoTwist3DSplittedVector::getDistributionForDirection(size_t x1, size_t x2, size_t x3, int direction)
+{
+   switch (direction)
+   {
+   case D3Q27System::W :
+      return (*this->nonLocalDistributions)(D3Q27System::ET_W,x1+1,x2,  x3    );
+   case D3Q27System::E :
+      return (*this->localDistributions)(D3Q27System::ET_E,x1,  x2,  x3);
+   case D3Q27System::N :
+      return (*this->localDistributions)(D3Q27System::ET_N,x1,  x2,  x3);
+   case D3Q27System::S :
+      return (*this->nonLocalDistributions)(D3Q27System::ET_S,x1,  x2+1,x3    );
+   case D3Q27System::T :
+      return (*this->localDistributions)(D3Q27System::ET_T,x1,  x2,  x3);
+   case D3Q27System::B :
+      return (*this->nonLocalDistributions)(D3Q27System::ET_B,x1,  x2,  x3+1  );
+   case D3Q27System::NE :
+      return (*this->localDistributions)(D3Q27System::ET_NE,x1,  x2,  x3);
+   case D3Q27System::SW :
+      return (*this->nonLocalDistributions)(D3Q27System::ET_SW,x1+1,x2+1,x3   );
+   case D3Q27System::SE :
+      return (*this->nonLocalDistributions)(D3Q27System::ET_SE,x1,  x2+1,x3   );
+   case D3Q27System::NW :
+      return (*this->localDistributions)(D3Q27System::ET_NW,x1+1,x2,  x3);
+   case D3Q27System::TE :
+      return (*this->localDistributions)(D3Q27System::ET_TE,x1,  x2,  x3);
+   case D3Q27System::BW :
+      return (*this->nonLocalDistributions)(D3Q27System::ET_BW,x1+1,x2,  x3+1 );
+   case D3Q27System::BE :
+      return (*this->nonLocalDistributions)(D3Q27System::ET_BE,x1,  x2,  x3+1 );
+   case D3Q27System::TW :
+      return (*this->localDistributions)(D3Q27System::ET_TW,x1+1,x2,  x3);
+   case D3Q27System::TN :
+      return (*this->localDistributions)(D3Q27System::ET_TN,x1,  x2,  x3);
+   case D3Q27System::BS :
+      return (*this->nonLocalDistributions)(D3Q27System::ET_BS,x1,  x2+1,x3+1 );
+   case D3Q27System::BN :
+      return (*this->nonLocalDistributions)(D3Q27System::ET_BN,x1,  x2,  x3+1 );
+   case D3Q27System::TS :
+      return (*this->localDistributions)(D3Q27System::ET_TS,x1,  x2+1,x3);
+   case D3Q27System::TNE :
+      return (*this->localDistributions)(D3Q27System::ET_TNE,x1,  x2,  x3);
+   case D3Q27System::BSW :
+      return (*this->nonLocalDistributions)(D3Q27System::ET_BSW,x1+1,x2+1,x3+1);
+   case D3Q27System::TNW :
+      return (*this->localDistributions)(D3Q27System::ET_TNW,x1+1,x2,  x3);
+   case D3Q27System::BSE :
+      return (*this->nonLocalDistributions)(D3Q27System::ET_BSE,x1,  x2+1,x3+1);
+   case D3Q27System::TSE :
+      return (*this->localDistributions)(D3Q27System::ET_TSE,x1,  x2+1,x3);
+   case D3Q27System::BNW :
+      return (*this->nonLocalDistributions)(D3Q27System::ET_BNW,x1+1,x2,  x3+1);
+   case D3Q27System::TSW :
+      return (*this->localDistributions)(D3Q27System::ET_TSW,x1+1,x2+1,x3);
+   case D3Q27System::BNE :
+      return (*this->nonLocalDistributions)(D3Q27System::ET_BNE,x1,  x2,  x3+1);
+   case D3Q27System::ZERO :
+      return (*this->zeroDistributions)(x1,x2,x3);
+   default:
+      UB_THROW( UbException(UB_EXARGS, "Direction didn't find") );     
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+LBMReal D3Q27EsoTwist3DSplittedVector::getDistributionInvForDirection(size_t x1, size_t x2, size_t x3, int direction)
+{
+   switch (direction)
+   {
+   case D3Q27System::E :
+      return (*this->nonLocalDistributions)(D3Q27System::ET_W,x1+1,x2,  x3    );
+   case D3Q27System::W :
+      return (*this->localDistributions)(D3Q27System::ET_E,x1,  x2,  x3);
+   case D3Q27System::S :
+      return (*this->localDistributions)(D3Q27System::ET_N,x1,  x2,  x3);
+   case D3Q27System::N :
+      return (*this->nonLocalDistributions)(D3Q27System::ET_S,x1,  x2+1,x3    );
+   case D3Q27System::B :
+      return (*this->localDistributions)(D3Q27System::ET_T,x1,  x2,  x3);
+   case D3Q27System::T :
+      return (*this->nonLocalDistributions)(D3Q27System::ET_B,x1,  x2,  x3+1  );
+   case D3Q27System::SW :
+      return (*this->localDistributions)(D3Q27System::ET_NE,x1,  x2,  x3);
+   case D3Q27System::NE :
+      return (*this->nonLocalDistributions)(D3Q27System::ET_SW,x1+1,x2+1,x3   );
+   case D3Q27System::NW :
+      return (*this->nonLocalDistributions)(D3Q27System::ET_SE,x1,  x2+1,x3   );
+   case D3Q27System::SE :
+      return (*this->localDistributions)(D3Q27System::ET_NW,x1+1,x2,  x3);
+   case D3Q27System::BW :
+      return (*this->localDistributions)(D3Q27System::ET_TE,x1,  x2,  x3);
+   case D3Q27System::TE :
+      return (*this->nonLocalDistributions)(D3Q27System::ET_BW,x1+1,x2,  x3+1 );
+   case D3Q27System::TW :
+      return (*this->nonLocalDistributions)(D3Q27System::ET_BE,x1,  x2,  x3+1 );
+   case D3Q27System::BE :
+      return (*this->localDistributions)(D3Q27System::ET_TW,x1+1,x2,  x3);
+   case D3Q27System::BS :
+      return (*this->localDistributions)(D3Q27System::ET_TN,x1,  x2,  x3);
+   case D3Q27System::TN :
+      return (*this->nonLocalDistributions)(D3Q27System::ET_BS,x1,  x2+1,x3+1 );
+   case D3Q27System::TS :
+      return (*this->nonLocalDistributions)(D3Q27System::ET_BN,x1,  x2,  x3+1 );
+   case D3Q27System::BN :
+      return (*this->localDistributions)(D3Q27System::ET_TS,x1,  x2+1,x3);
+   case D3Q27System::BSW :
+      return (*this->localDistributions)(D3Q27System::ET_TNE,x1,  x2,  x3);
+   case D3Q27System::TNE :
+      return (*this->nonLocalDistributions)(D3Q27System::ET_BSW,x1+1,x2+1,x3+1);
+   case D3Q27System::BSE :
+      return (*this->localDistributions)(D3Q27System::ET_TNW,x1+1,x2,  x3);
+   case D3Q27System::TNW :
+      return (*this->nonLocalDistributions)(D3Q27System::ET_BSE,x1,  x2+1,x3+1);
+   case D3Q27System::BNW :
+      return (*this->localDistributions)(D3Q27System::ET_TSE,x1,  x2+1,x3);
+   case D3Q27System::TSE :
+      return (*this->nonLocalDistributions)(D3Q27System::ET_BNW,x1+1,x2,  x3+1);
+   case D3Q27System::BNE :
+      return (*this->localDistributions)(D3Q27System::ET_TSW,x1+1,x2+1,x3);
+   case D3Q27System::TSW :
+      return (*this->nonLocalDistributions)(D3Q27System::ET_BNE,x1,  x2,  x3+1);
+   case D3Q27System::ZERO :
+      return (*this->zeroDistributions)(x1,x2,x3);
+   default:
+      UB_THROW( UbException(UB_EXARGS, "Direction didn't find") );     
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+size_t D3Q27EsoTwist3DSplittedVector::getNX1() const
+{
+   return NX1;
+}
+//////////////////////////////////////////////////////////////////////////
+size_t D3Q27EsoTwist3DSplittedVector::getNX2() const
+{
+   return NX2;
+}
+//////////////////////////////////////////////////////////////////////////
+size_t D3Q27EsoTwist3DSplittedVector::getNX3() const
+{
+   return NX3;
+}
+//////////////////////////////////////////////////////////////////////////
+CbArray4D<LBMReal,IndexerX4X3X2X1>::CbArray4DPtr D3Q27EsoTwist3DSplittedVector::getLocalDistributions()
+{
+   return this->localDistributions;
+}
+//////////////////////////////////////////////////////////////////////////
+CbArray4D<LBMReal,IndexerX4X3X2X1>::CbArray4DPtr D3Q27EsoTwist3DSplittedVector::getNonLocalDistributions()
+{
+   return this->nonLocalDistributions;
+}
+//////////////////////////////////////////////////////////////////////////
+CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr D3Q27EsoTwist3DSplittedVector::getZeroDistributions()
+{
+   return this->zeroDistributions;
+}
+//////////////////////////////////////////////////////////////////////////
+void D3Q27EsoTwist3DSplittedVector::setNX1(size_t newNX1)
+{
+   NX1 = newNX1;
+}
+//////////////////////////////////////////////////////////////////////////
+void D3Q27EsoTwist3DSplittedVector::setNX2(size_t newNX2)
+{
+   NX2 = newNX2;
+}
+//////////////////////////////////////////////////////////////////////////
+void D3Q27EsoTwist3DSplittedVector::setNX3(size_t newNX3)
+{
+   NX3 = newNX3;
+}
+//////////////////////////////////////////////////////////////////////////
+void D3Q27EsoTwist3DSplittedVector::setLocalDistributions(CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr array)
+{
+   localDistributions = array;
+}
+//////////////////////////////////////////////////////////////////////////
+void D3Q27EsoTwist3DSplittedVector::setNonLocalDistributions(CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr array)
+{
+   nonLocalDistributions = array;
+}
+//////////////////////////////////////////////////////////////////////////
+void D3Q27EsoTwist3DSplittedVector::setZeroDistributions(CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr array)
+{
+   zeroDistributions = array;
+}
+
+//////////////////////////////////////////////////////////////////////////
+
diff --git a/src/cpu/VirtualFluidsCore/Data/D3Q27EsoTwist3DSplittedVectorEx.cpp b/src/cpu/VirtualFluidsCore/Data/D3Q27EsoTwist3DSplittedVectorEx.cpp
index e4dab25180b0b817f12bdf33fae5ccc91f58f494..6a8ccc1492fe6880183ab8b750a0e68a534a7099 100644
--- a/src/cpu/VirtualFluidsCore/Data/D3Q27EsoTwist3DSplittedVectorEx.cpp
+++ b/src/cpu/VirtualFluidsCore/Data/D3Q27EsoTwist3DSplittedVectorEx.cpp
@@ -1,13 +1,13 @@
-#include "D3Q27EsoTwist3DSplittedVectorEx.h"
-
-D3Q27EsoTwist3DSplittedVectorEx::D3Q27EsoTwist3DSplittedVectorEx( int nx1, int nx2, int nx3, LBMReal value )
-{
-   this->NX1 = nx1;
-   this->NX2 = nx2;
-   this->NX3 = nx3;
-
-   this->localDistributions    = CbArray4D<LBMReal,IndexerX4X3X2X1>::CbArray4DPtr(new CbArray4D<LBMReal,IndexerX4X3X2X1>(13, nx1, nx2, nx3, value));
-   this->nonLocalDistributions = CbArray4D<LBMReal,IndexerX4X3X2X1>::CbArray4DPtr(new CbArray4D<LBMReal,IndexerX4X3X2X1>(13, nx1, nx2, nx3, value));
-
-   this->zeroDistributions     = CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal,IndexerX3X2X1>(nx1, nx2, nx3, value));
-}
+#include "D3Q27EsoTwist3DSplittedVectorEx.h"
+
+D3Q27EsoTwist3DSplittedVectorEx::D3Q27EsoTwist3DSplittedVectorEx( int nx1, int nx2, int nx3, LBMReal value )
+{
+   this->NX1 = nx1;
+   this->NX2 = nx2;
+   this->NX3 = nx3;
+
+   this->localDistributions    = CbArray4D<LBMReal,IndexerX4X3X2X1>::CbArray4DPtr(new CbArray4D<LBMReal,IndexerX4X3X2X1>(13, nx1, nx2, nx3, value));
+   this->nonLocalDistributions = CbArray4D<LBMReal,IndexerX4X3X2X1>::CbArray4DPtr(new CbArray4D<LBMReal,IndexerX4X3X2X1>(13, nx1, nx2, nx3, value));
+
+   this->zeroDistributions     = CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<LBMReal,IndexerX3X2X1>(nx1, nx2, nx3, value));
+}
diff --git a/src/cpu/VirtualFluidsCore/Data/D3Q27EsoTwist3DSplittedVectorEx.h b/src/cpu/VirtualFluidsCore/Data/D3Q27EsoTwist3DSplittedVectorEx.h
index 72344f4a8ad6e3f98512d7d3eae8482aa2659d6f..9e41d877b40231c06f6f94f67b51c836b209dd4b 100644
--- a/src/cpu/VirtualFluidsCore/Data/D3Q27EsoTwist3DSplittedVectorEx.h
+++ b/src/cpu/VirtualFluidsCore/Data/D3Q27EsoTwist3DSplittedVectorEx.h
@@ -1,15 +1,15 @@
-#ifndef D3Q27EsoTwist3DSplittedVectorEx_h
-#define D3Q27EsoTwist3DSplittedVectorEx_h
-
-#include "D3Q27EsoTwist3DSplittedVector.h"
-
-class D3Q27EsoTwist3DSplittedVectorEx : public D3Q27EsoTwist3DSplittedVector
-{
-public:
-   D3Q27EsoTwist3DSplittedVectorEx(int nx1, int nx2, int nx3, LBMReal value);
-protected:
-private:
-};
-
-#endif
-
+#ifndef D3Q27EsoTwist3DSplittedVectorEx_h
+#define D3Q27EsoTwist3DSplittedVectorEx_h
+
+#include "D3Q27EsoTwist3DSplittedVector.h"
+
+class D3Q27EsoTwist3DSplittedVectorEx : public D3Q27EsoTwist3DSplittedVector
+{
+public:
+   D3Q27EsoTwist3DSplittedVectorEx(int nx1, int nx2, int nx3, LBMReal value);
+protected:
+private:
+};
+
+#endif
+
diff --git a/src/cpu/VirtualFluidsCore/Data/DataSet3D.h b/src/cpu/VirtualFluidsCore/Data/DataSet3D.h
index 5ed896ef471dcda6d3c6e51c9e49374d7fe4a5d5..095708b4aeddc3a411af077261e9c0872299343f 100644
--- a/src/cpu/VirtualFluidsCore/Data/DataSet3D.h
+++ b/src/cpu/VirtualFluidsCore/Data/DataSet3D.h
@@ -1,169 +1,169 @@
-//=======================================================================================
-// ____          ____    __    ______     __________   __      __       __        __         
-// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
-//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
-//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
-//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
-//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
-//      \    \  |    |   ________________________________________________________________    
-//       \    \ |    |  |  ______________________________________________________________|   
-//        \    \|    |  |  |         __          __     __     __     ______      _______    
-//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
-//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
-//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
-//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
-//
-//  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 DataSet3D.h
-//! \ingroup Data
-//! \author Konstantin Kutscher
-//=======================================================================================
-
-#ifndef DataSet3D_h
-#define DataSet3D_h
-
-#include <PointerDefinitions.h>
-
-#include "basics/container/CbArray4D.h"
-#include "basics/container/CbArray3D.h"
-#include "DistributionArray3D.h"
-
-typedef CbArray4D<LBMReal,IndexerX4X3X2X1> AverageValuesArray3D;
-typedef CbArray4D<LBMReal,IndexerX4X3X2X1> ShearStressValuesArray3D;
-typedef CbArray3D<LBMReal, IndexerX3X2X1> RelaxationFactorArray3D;
-
-//! A class provides an interface for data structures in the kernel.
-class DataSet3D
-{
-public:
-   SPtr<DistributionArray3D> getFdistributions() const;
-   void setFdistributions(SPtr<DistributionArray3D> distributions);
-
-   SPtr<AverageValuesArray3D> getAverageDensity() const;
-   void setAverageDensity(SPtr<AverageValuesArray3D> values);
-
-   SPtr<AverageValuesArray3D> getAverageVelocity() const;
-   void setAverageVelocity(SPtr<AverageValuesArray3D> values);
-
-   SPtr<AverageValuesArray3D> getAverageFluctuations() const;
-   void setAverageFluctuations(SPtr<AverageValuesArray3D> values);
-
-   SPtr<AverageValuesArray3D> getAverageTriplecorrelations() const;
-   void setAverageTriplecorrelations(SPtr<AverageValuesArray3D> values);
-   
-   SPtr<AverageValuesArray3D> getAverageValues() const;
-   void setAverageValues(SPtr<AverageValuesArray3D> values);
-   
-   SPtr<ShearStressValuesArray3D> getShearStressValues() const;
-   void setShearStressValues(SPtr<ShearStressValuesArray3D> values);
-
-   SPtr<RelaxationFactorArray3D> getRelaxationFactor() const;
-   void setRelaxationFactor(SPtr<RelaxationFactorArray3D> values);
-protected:
-private:
-   SPtr<DistributionArray3D> fdistributions;
-   SPtr<AverageValuesArray3D> averageValues;
-
-   SPtr<AverageValuesArray3D> averageDensity;
-   SPtr<AverageValuesArray3D> averageVelocity;
-   SPtr<AverageValuesArray3D> averageFluktuations;
-   SPtr<AverageValuesArray3D> averageTriplecorrelations;
-
-   SPtr<ShearStressValuesArray3D> shearStressValues;
-
-   SPtr<RelaxationFactorArray3D> relaxationFactor;
-
-};
-
-inline SPtr<DistributionArray3D> DataSet3D::getFdistributions() const
-{ 
-   return fdistributions; 
-}
-
-inline void DataSet3D::setFdistributions(SPtr<DistributionArray3D> distributions)
-{ 
-   fdistributions = distributions; 
-}
-
-inline SPtr<AverageValuesArray3D> DataSet3D::getAverageValues() const
-{ 
-   return averageValues; 
-}
-
-inline void DataSet3D::setAverageValues(SPtr<AverageValuesArray3D> values)
-{ 
-   averageValues = values; 
-}
-
-inline SPtr<AverageValuesArray3D> DataSet3D::getAverageDensity() const
-{
-   return averageDensity;
-}
-
-inline void DataSet3D::setAverageDensity(SPtr<AverageValuesArray3D> values)
-{
-   averageDensity = values;
-}
-
-inline SPtr<AverageValuesArray3D> DataSet3D::getAverageVelocity() const
-{
-   return averageVelocity;
-}
-
-inline void DataSet3D::setAverageVelocity(SPtr<AverageValuesArray3D> values)
-{
-   averageVelocity = values;
-}
-
-inline SPtr<AverageValuesArray3D> DataSet3D::getAverageFluctuations() const
-{
-   return averageFluktuations;
-}
-
-inline void DataSet3D::setAverageFluctuations(SPtr<AverageValuesArray3D> values)
-{
-   averageFluktuations = values;
-}
-
-inline SPtr<AverageValuesArray3D> DataSet3D::getAverageTriplecorrelations() const
-{
-   return averageTriplecorrelations;
-}
-
-inline void DataSet3D::setAverageTriplecorrelations(SPtr<AverageValuesArray3D> values)
-{
-   averageTriplecorrelations = values;
-}
-
-inline SPtr<ShearStressValuesArray3D> DataSet3D::getShearStressValues() const
-{ 
-   return shearStressValues; 
-}
-
-inline void DataSet3D::setShearStressValues(SPtr<ShearStressValuesArray3D> values)
-{ 
-   shearStressValues = values; 
-}
-
-inline SPtr<RelaxationFactorArray3D> DataSet3D::getRelaxationFactor() const
-{
-   return relaxationFactor;
-}
-
-inline void DataSet3D::setRelaxationFactor(SPtr<RelaxationFactorArray3D> values)
-{
-   relaxationFactor = values;
-}
-#endif
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 DataSet3D.h
+//! \ingroup Data
+//! \author Konstantin Kutscher
+//=======================================================================================
+
+#ifndef DataSet3D_h
+#define DataSet3D_h
+
+#include <PointerDefinitions.h>
+
+#include "basics/container/CbArray4D.h"
+#include "basics/container/CbArray3D.h"
+#include "DistributionArray3D.h"
+
+typedef CbArray4D<LBMReal,IndexerX4X3X2X1> AverageValuesArray3D;
+typedef CbArray4D<LBMReal,IndexerX4X3X2X1> ShearStressValuesArray3D;
+typedef CbArray3D<LBMReal, IndexerX3X2X1> RelaxationFactorArray3D;
+
+//! A class provides an interface for data structures in the kernel.
+class DataSet3D
+{
+public:
+   SPtr<DistributionArray3D> getFdistributions() const;
+   void setFdistributions(SPtr<DistributionArray3D> distributions);
+
+   SPtr<AverageValuesArray3D> getAverageDensity() const;
+   void setAverageDensity(SPtr<AverageValuesArray3D> values);
+
+   SPtr<AverageValuesArray3D> getAverageVelocity() const;
+   void setAverageVelocity(SPtr<AverageValuesArray3D> values);
+
+   SPtr<AverageValuesArray3D> getAverageFluctuations() const;
+   void setAverageFluctuations(SPtr<AverageValuesArray3D> values);
+
+   SPtr<AverageValuesArray3D> getAverageTriplecorrelations() const;
+   void setAverageTriplecorrelations(SPtr<AverageValuesArray3D> values);
+   
+   SPtr<AverageValuesArray3D> getAverageValues() const;
+   void setAverageValues(SPtr<AverageValuesArray3D> values);
+   
+   SPtr<ShearStressValuesArray3D> getShearStressValues() const;
+   void setShearStressValues(SPtr<ShearStressValuesArray3D> values);
+
+   SPtr<RelaxationFactorArray3D> getRelaxationFactor() const;
+   void setRelaxationFactor(SPtr<RelaxationFactorArray3D> values);
+protected:
+private:
+   SPtr<DistributionArray3D> fdistributions;
+   SPtr<AverageValuesArray3D> averageValues;
+
+   SPtr<AverageValuesArray3D> averageDensity;
+   SPtr<AverageValuesArray3D> averageVelocity;
+   SPtr<AverageValuesArray3D> averageFluktuations;
+   SPtr<AverageValuesArray3D> averageTriplecorrelations;
+
+   SPtr<ShearStressValuesArray3D> shearStressValues;
+
+   SPtr<RelaxationFactorArray3D> relaxationFactor;
+
+};
+
+inline SPtr<DistributionArray3D> DataSet3D::getFdistributions() const
+{ 
+   return fdistributions; 
+}
+
+inline void DataSet3D::setFdistributions(SPtr<DistributionArray3D> distributions)
+{ 
+   fdistributions = distributions; 
+}
+
+inline SPtr<AverageValuesArray3D> DataSet3D::getAverageValues() const
+{ 
+   return averageValues; 
+}
+
+inline void DataSet3D::setAverageValues(SPtr<AverageValuesArray3D> values)
+{ 
+   averageValues = values; 
+}
+
+inline SPtr<AverageValuesArray3D> DataSet3D::getAverageDensity() const
+{
+   return averageDensity;
+}
+
+inline void DataSet3D::setAverageDensity(SPtr<AverageValuesArray3D> values)
+{
+   averageDensity = values;
+}
+
+inline SPtr<AverageValuesArray3D> DataSet3D::getAverageVelocity() const
+{
+   return averageVelocity;
+}
+
+inline void DataSet3D::setAverageVelocity(SPtr<AverageValuesArray3D> values)
+{
+   averageVelocity = values;
+}
+
+inline SPtr<AverageValuesArray3D> DataSet3D::getAverageFluctuations() const
+{
+   return averageFluktuations;
+}
+
+inline void DataSet3D::setAverageFluctuations(SPtr<AverageValuesArray3D> values)
+{
+   averageFluktuations = values;
+}
+
+inline SPtr<AverageValuesArray3D> DataSet3D::getAverageTriplecorrelations() const
+{
+   return averageTriplecorrelations;
+}
+
+inline void DataSet3D::setAverageTriplecorrelations(SPtr<AverageValuesArray3D> values)
+{
+   averageTriplecorrelations = values;
+}
+
+inline SPtr<ShearStressValuesArray3D> DataSet3D::getShearStressValues() const
+{ 
+   return shearStressValues; 
+}
+
+inline void DataSet3D::setShearStressValues(SPtr<ShearStressValuesArray3D> values)
+{ 
+   shearStressValues = values; 
+}
+
+inline SPtr<RelaxationFactorArray3D> DataSet3D::getRelaxationFactor() const
+{
+   return relaxationFactor;
+}
+
+inline void DataSet3D::setRelaxationFactor(SPtr<RelaxationFactorArray3D> values)
+{
+   relaxationFactor = values;
+}
+#endif
diff --git a/src/cpu/VirtualFluidsCore/Data/DistributionArray3D.h b/src/cpu/VirtualFluidsCore/Data/DistributionArray3D.h
index a49b18feea58ceb1626257c51700b5598b382062..c72f358cddf6fd36b92e4b7f681ef438f37b1f72 100644
--- a/src/cpu/VirtualFluidsCore/Data/DistributionArray3D.h
+++ b/src/cpu/VirtualFluidsCore/Data/DistributionArray3D.h
@@ -1,30 +1,30 @@
-#ifndef DistributionArray3D_H
-#define DistributionArray3D_H
-
-#include <LBMSystem.h>
-
-class DistributionArray3D
-{
-public:
-   DistributionArray3D() {};
-   virtual ~DistributionArray3D(){};
-   virtual size_t getNX1() const = 0;
-   virtual size_t getNX2() const = 0;
-   virtual size_t getNX3() const = 0;
-   virtual void getDistribution(LBMReal* const f, size_t x1, size_t x2, size_t x3) = 0;
-   virtual void setDistribution(const LBMReal* const f, size_t x1, size_t x2, size_t x3) = 0;
-   virtual void getDistributionInv( LBMReal* const f, size_t x1, size_t x2, size_t x3) = 0;
-   virtual void setDistributionInv(const LBMReal* const f, size_t x1, size_t x2, size_t x3) = 0;
-   virtual void setDistributionForDirection(const LBMReal* const f, size_t x1, size_t x2, size_t x3, unsigned long int direction) = 0;
-   virtual void setDistributionForDirection(LBMReal f, size_t x1, size_t x2, size_t x3, int direction) = 0;
-   virtual LBMReal getDistributionInvForDirection(size_t x1, size_t x2, size_t x3, int direction) = 0;
-   virtual void setDistributionInvForDirection(const LBMReal* const f, size_t x1, size_t x2, size_t x3, unsigned long int direction) = 0;
-   virtual void setDistributionInvForDirection(LBMReal f, size_t x1, size_t x2, size_t x3, unsigned long int direction) = 0;
-   virtual LBMReal getDistributionForDirection(size_t x1, size_t x2, size_t x3, int direction) = 0;
-   virtual void swap() = 0;
-protected:
-private:
-
-};
-
-#endif
+#ifndef DistributionArray3D_H
+#define DistributionArray3D_H
+
+#include <LBMSystem.h>
+
+class DistributionArray3D
+{
+public:
+   DistributionArray3D() {};
+   virtual ~DistributionArray3D(){};
+   virtual size_t getNX1() const = 0;
+   virtual size_t getNX2() const = 0;
+   virtual size_t getNX3() const = 0;
+   virtual void getDistribution(LBMReal* const f, size_t x1, size_t x2, size_t x3) = 0;
+   virtual void setDistribution(const LBMReal* const f, size_t x1, size_t x2, size_t x3) = 0;
+   virtual void getDistributionInv( LBMReal* const f, size_t x1, size_t x2, size_t x3) = 0;
+   virtual void setDistributionInv(const LBMReal* const f, size_t x1, size_t x2, size_t x3) = 0;
+   virtual void setDistributionForDirection(const LBMReal* const f, size_t x1, size_t x2, size_t x3, unsigned long int direction) = 0;
+   virtual void setDistributionForDirection(LBMReal f, size_t x1, size_t x2, size_t x3, int direction) = 0;
+   virtual LBMReal getDistributionInvForDirection(size_t x1, size_t x2, size_t x3, int direction) = 0;
+   virtual void setDistributionInvForDirection(const LBMReal* const f, size_t x1, size_t x2, size_t x3, unsigned long int direction) = 0;
+   virtual void setDistributionInvForDirection(LBMReal f, size_t x1, size_t x2, size_t x3, unsigned long int direction) = 0;
+   virtual LBMReal getDistributionForDirection(size_t x1, size_t x2, size_t x3, int direction) = 0;
+   virtual void swap() = 0;
+protected:
+private:
+
+};
+
+#endif
diff --git a/src/cpu/VirtualFluidsCore/Data/EsoTwist3D.h b/src/cpu/VirtualFluidsCore/Data/EsoTwist3D.h
index d076b88e5b6cf7575f203c74e9cc8cc36917d158..87c1639bf85a9b9e12f2787280f98375050bc6b4 100644
--- a/src/cpu/VirtualFluidsCore/Data/EsoTwist3D.h
+++ b/src/cpu/VirtualFluidsCore/Data/EsoTwist3D.h
@@ -1,89 +1,89 @@
-//=======================================================================================
-// ____          ____    __    ______     __________   __      __       __        __         
-// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
-//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
-//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
-//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
-//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
-//      \    \  |    |   ________________________________________________________________    
-//       \    \ |    |  |  ______________________________________________________________|   
-//        \    \|    |  |  |         __          __     __     __     ______      _______    
-//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
-//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
-//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
-//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
-//
-//  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 EsoTwist3D.h
-//! \ingroup Data
-//! \author Konstantin Kutscher
-//=======================================================================================
-
-#ifndef ESOTWIST3D_H
-#define ESOTWIST3D_H
-
-#include "DistributionArray3D.h"
-#include <LBMSystem.h>
-
-//! \brief Abstract class for implementation of Esoteric Twist method
-//! \details EsoTwist3D provide an interface for different implementations of Esoteric Twist method 
-//! <a href="https://doi.org/10.3390/computation5020019"><b>[ Geier et al., (2017), 10.3390/computation5020019]</b></a> 
-// Geier, M., & Schönherr, M. (2017). Esoteric twist: an efficient in-place streaming algorithmus for the lattice Boltzmann method on massively parallel hardware. Computation, 5(2), 19.
-
-
-class EsoTwistD3Q27UnrollArray{};
-class EsoTwistPlusD3Q27UnrollArray{};
-class EsoTwistPlusD3Q19UnrollArray{};
-
-class EsoTwist3D : public DistributionArray3D
-{
-public:
-   EsoTwist3D(){};
-   virtual ~EsoTwist3D(){};
-   //////////////////////////////////////////////////////////////////////////
-   virtual void swap() = 0;
-   //////////////////////////////////////////////////////////////////////////
-   virtual void getDistribution(LBMReal* const f, size_t x1, size_t x2, size_t x3) = 0;
-   //////////////////////////////////////////////////////////////////////////
-   virtual void setDistribution(const LBMReal* const f, size_t x1, size_t x2, size_t x3) = 0;
-   ////////////////////////////////////////////////////////////////////////
-   virtual void getDistributionInv( LBMReal* const f, size_t x1, size_t x2, size_t x3) = 0;
-   //////////////////////////////////////////////////////////////////////////
-   virtual void setDistributionInv(const LBMReal* const f, size_t x1, size_t x2, size_t x3) = 0;
-   //////////////////////////////////////////////////////////////////////////
-   virtual void setDistributionForDirection(const LBMReal* const f, size_t x1, size_t x2, size_t x3, unsigned long int direction) = 0;
-   //////////////////////////////////////////////////////////////////////////
-   virtual void setDistributionForDirection(LBMReal f, size_t x1, size_t x2, size_t x3, int direction) = 0;
-   //////////////////////////////////////////////////////////////////////////
-   //virtual void getDistributionInvForDirection(LBMReal* const& f, const size_t& x1, const size_t& x2, const size_t& x3, const unsigned long int& direction) = 0;
-   //////////////////////////////////////////////////////////////////////////
-   virtual LBMReal getDistributionInvForDirection(size_t x1, size_t x2, size_t x3, int direction) = 0;
-   //////////////////////////////////////////////////////////////////////////
-   virtual void setDistributionInvForDirection(const LBMReal* const f, size_t x1, size_t x2, size_t x3, unsigned long int direction) = 0;
-   //////////////////////////////////////////////////////////////////////////
-   virtual void setDistributionInvForDirection(LBMReal f, size_t x1, size_t x2, size_t x3, unsigned long int direction) = 0;
-   //////////////////////////////////////////////////////////////////////////
-   virtual LBMReal getDistributionForDirection(size_t x1, size_t x2, size_t x3, int direction) = 0;
-   //////////////////////////////////////////////////////////////////////////
-   virtual size_t getNX1() const = 0;
-   //////////////////////////////////////////////////////////////////////////
-   virtual size_t getNX2() const = 0;
-   //////////////////////////////////////////////////////////////////////////
-   virtual size_t getNX3() const = 0;
-   //////////////////////////////////////////////////////////////////////////
-  
-};
-
-#endif
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 EsoTwist3D.h
+//! \ingroup Data
+//! \author Konstantin Kutscher
+//=======================================================================================
+
+#ifndef ESOTWIST3D_H
+#define ESOTWIST3D_H
+
+#include "DistributionArray3D.h"
+#include <LBMSystem.h>
+
+//! \brief Abstract class for implementation of Esoteric Twist method
+//! \details EsoTwist3D provide an interface for different implementations of Esoteric Twist method 
+//! <a href="https://doi.org/10.3390/computation5020019"><b>[ Geier et al., (2017), 10.3390/computation5020019]</b></a> 
+// Geier, M., & Schönherr, M. (2017). Esoteric twist: an efficient in-place streaming algorithmus for the lattice Boltzmann method on massively parallel hardware. Computation, 5(2), 19.
+
+
+class EsoTwistD3Q27UnrollArray{};
+class EsoTwistPlusD3Q27UnrollArray{};
+class EsoTwistPlusD3Q19UnrollArray{};
+
+class EsoTwist3D : public DistributionArray3D
+{
+public:
+   EsoTwist3D(){};
+   virtual ~EsoTwist3D(){};
+   //////////////////////////////////////////////////////////////////////////
+   virtual void swap() = 0;
+   //////////////////////////////////////////////////////////////////////////
+   virtual void getDistribution(LBMReal* const f, size_t x1, size_t x2, size_t x3) = 0;
+   //////////////////////////////////////////////////////////////////////////
+   virtual void setDistribution(const LBMReal* const f, size_t x1, size_t x2, size_t x3) = 0;
+   ////////////////////////////////////////////////////////////////////////
+   virtual void getDistributionInv( LBMReal* const f, size_t x1, size_t x2, size_t x3) = 0;
+   //////////////////////////////////////////////////////////////////////////
+   virtual void setDistributionInv(const LBMReal* const f, size_t x1, size_t x2, size_t x3) = 0;
+   //////////////////////////////////////////////////////////////////////////
+   virtual void setDistributionForDirection(const LBMReal* const f, size_t x1, size_t x2, size_t x3, unsigned long int direction) = 0;
+   //////////////////////////////////////////////////////////////////////////
+   virtual void setDistributionForDirection(LBMReal f, size_t x1, size_t x2, size_t x3, int direction) = 0;
+   //////////////////////////////////////////////////////////////////////////
+   //virtual void getDistributionInvForDirection(LBMReal* const& f, const size_t& x1, const size_t& x2, const size_t& x3, const unsigned long int& direction) = 0;
+   //////////////////////////////////////////////////////////////////////////
+   virtual LBMReal getDistributionInvForDirection(size_t x1, size_t x2, size_t x3, int direction) = 0;
+   //////////////////////////////////////////////////////////////////////////
+   virtual void setDistributionInvForDirection(const LBMReal* const f, size_t x1, size_t x2, size_t x3, unsigned long int direction) = 0;
+   //////////////////////////////////////////////////////////////////////////
+   virtual void setDistributionInvForDirection(LBMReal f, size_t x1, size_t x2, size_t x3, unsigned long int direction) = 0;
+   //////////////////////////////////////////////////////////////////////////
+   virtual LBMReal getDistributionForDirection(size_t x1, size_t x2, size_t x3, int direction) = 0;
+   //////////////////////////////////////////////////////////////////////////
+   virtual size_t getNX1() const = 0;
+   //////////////////////////////////////////////////////////////////////////
+   virtual size_t getNX2() const = 0;
+   //////////////////////////////////////////////////////////////////////////
+   virtual size_t getNX3() const = 0;
+   //////////////////////////////////////////////////////////////////////////
+  
+};
+
+#endif
diff --git a/src/cpu/VirtualFluidsCore/Data/EsoTwistD3Q27System.cpp b/src/cpu/VirtualFluidsCore/Data/EsoTwistD3Q27System.cpp
index 752412f78e97884895962e9db5641dd93342970f..64fa72bd09570cf41a25f18feaab108a73cd78f3 100644
--- a/src/cpu/VirtualFluidsCore/Data/EsoTwistD3Q27System.cpp
+++ b/src/cpu/VirtualFluidsCore/Data/EsoTwistD3Q27System.cpp
@@ -1,125 +1,125 @@
-//=======================================================================================
-// ____          ____    __    ______     __________   __      __       __        __         
-// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
-//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
-//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
-//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
-//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
-//      \    \  |    |   ________________________________________________________________    
-//       \    \ |    |  |  ______________________________________________________________|   
-//        \    \|    |  |  |         __          __     __     __     ______      _______    
-//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
-//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
-//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
-//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
-//
-//  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 EsoTwistD3Q27System.cpp
-//! \ingroup Data
-//! \author Konstantin Kutscher
-//=======================================================================================
-
-#include "EsoTwistD3Q27System.h"
-
-//index                                                              0   1   2   3   4   5  6   7   8    9  10  11  12  13  14  15  16  17  18  19  20  21  22  23  24  25  26  
-//f:                                                                 E,  W,  N,  S,  T,  B, NE, SW, SE, NW, TE, BW, BE, TW, TN, BS, BN, TS, TNE TNW TSE TSW BNE BNW BSE BSW ZERO
-const int EsoTwistD3Q27System::ETX1[EsoTwistD3Q27System::ENDF+1] = { 0,  1,  0,  0,  0,  0,  0,  1,  0,  1,  0,  1,  0,  1,  0,  0,  0,  0,  0,  1,  0,  1,  0,  1,  0,  1,  0 };
-const int EsoTwistD3Q27System::ETX2[EsoTwistD3Q27System::ENDF+1] = { 0,  0,  0,  1,  0,  0,  0,  1,  0, -1,  0,  0,  0,  0,  0,  1, -1,  0,  0, -1,  0,  1,  0, -1,  0,  1,  0 };
-const int EsoTwistD3Q27System::ETX3[EsoTwistD3Q27System::ENDF+1] = { 0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  1,  0, -1,  0,  1,  1,  0,  0, -1,  0, -1,  0,  1,  0,  1,  0 };
-
-const int EsoTwistD3Q27System::etINVDIR[EsoTwistD3Q27System::ENDF+1] = { D3Q27System::INV_E,   
-                                                                           D3Q27System::INV_W,  
-                                                                           D3Q27System::INV_N,  
-                                                                           D3Q27System::INV_S,  
-                                                                           D3Q27System::INV_T,  
-                                                                           D3Q27System::INV_B,  
-                                                                           D3Q27System::INV_NE, 
-                                                                           D3Q27System::INV_SW, 
-                                                                           D3Q27System::INV_SE, 
-                                                                           D3Q27System::INV_NW,
-                                                                           D3Q27System::INV_TE, 
-                                                                           D3Q27System::INV_BW, 
-                                                                           D3Q27System::INV_BE, 
-                                                                           D3Q27System::INV_TW, 
-                                                                           D3Q27System::INV_TN, 
-                                                                           D3Q27System::INV_BS, 
-                                                                           D3Q27System::INV_BN, 
-                                                                           D3Q27System::INV_TS, 
-                                                                           D3Q27System::INV_TNE,
-                                                                           D3Q27System::INV_TNW,
-                                                                           D3Q27System::INV_TSE,
-                                                                           D3Q27System::INV_TSW,
-                                                                           D3Q27System::INV_BNE,
-                                                                           D3Q27System::INV_BNW,
-                                                                           D3Q27System::INV_BSE,
-                                                                           D3Q27System::INV_BSW,
-                                                                           D3Q27System::ZERO};
-
-const unsigned long int EsoTwistD3Q27System::etDIR[EsoTwistD3Q27System::ENDF+1] = { etE,   
-                                                                                    etW,  
-                                                                                    etN,  
-                                                                                    etS,  
-                                                                                    etT,  
-                                                                                    etB,  
-                                                                                    etNE, 
-                                                                                    etSW, 
-                                                                                    etSE, 
-                                                                                    etNW,
-                                                                                    etTE, 
-                                                                                    etBW, 
-                                                                                    etBE, 
-                                                                                    etTW, 
-                                                                                    etTN, 
-                                                                                    etBS, 
-                                                                                    etBN, 
-                                                                                    etTS,
-                                                                                    etTNE,
-                                                                                    etTNW,
-                                                                                    etTSE,
-                                                                                    etTSW,
-                                                                                    etBNE,
-                                                                                    etBNW,
-                                                                                    etBSE,
-                                                                                    etBSW,
-                                                                                    etZERO};
-
- const unsigned long int EsoTwistD3Q27System::etZERO = 1;/*f0 */
- const unsigned long int EsoTwistD3Q27System::etE =  2;    /*f1 */
- const unsigned long int EsoTwistD3Q27System::etW =  4;    /*f2 */
- const unsigned long int EsoTwistD3Q27System::etN =  8;    /*f3 */
- const unsigned long int EsoTwistD3Q27System::etS =  16;   /*f4 */
- const unsigned long int EsoTwistD3Q27System::etT =  32;    /*f5 */
- const unsigned long int EsoTwistD3Q27System::etB =  64;   /*f6 */
- const unsigned long int EsoTwistD3Q27System::etNE = 128;  /*f7 */
- const unsigned long int EsoTwistD3Q27System::etSW = 256;  /*f8 */
- const unsigned long int EsoTwistD3Q27System::etSE = 512;  /*f9 */
- const unsigned long int EsoTwistD3Q27System::etNW = 1024;  /*f10*/
- const unsigned long int EsoTwistD3Q27System::etTE = 2048;  /*f11*/
- const unsigned long int EsoTwistD3Q27System::etBW = 4096;  /*f12*/
- const unsigned long int EsoTwistD3Q27System::etBE = 8192;  /*f13*/
- const unsigned long int EsoTwistD3Q27System::etTW = 16384;  /*f14*/
- const unsigned long int EsoTwistD3Q27System::etTN = 32768;  /*f15*/
- const unsigned long int EsoTwistD3Q27System::etBS = 65536;  /*f16*/
- const unsigned long int EsoTwistD3Q27System::etBN = 131072;  /*f17*/
- const unsigned long int EsoTwistD3Q27System::etTS = 262144;  /*f18*/
- const unsigned long int EsoTwistD3Q27System::etTNE = 524288;
- const unsigned long int EsoTwistD3Q27System::etTNW = 1048576;
- const unsigned long int EsoTwistD3Q27System::etTSE = 2097152;
- const unsigned long int EsoTwistD3Q27System::etTSW = 4194304;
- const unsigned long int EsoTwistD3Q27System::etBNE = 8388608;
- const unsigned long int EsoTwistD3Q27System::etBNW = 16777216;
- const unsigned long int EsoTwistD3Q27System::etBSE = 33554432;
-const unsigned long int EsoTwistD3Q27System::etBSW = 67108864;
-
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 EsoTwistD3Q27System.cpp
+//! \ingroup Data
+//! \author Konstantin Kutscher
+//=======================================================================================
+
+#include "EsoTwistD3Q27System.h"
+
+//index                                                              0   1   2   3   4   5  6   7   8    9  10  11  12  13  14  15  16  17  18  19  20  21  22  23  24  25  26  
+//f:                                                                 E,  W,  N,  S,  T,  B, NE, SW, SE, NW, TE, BW, BE, TW, TN, BS, BN, TS, TNE TNW TSE TSW BNE BNW BSE BSW ZERO
+const int EsoTwistD3Q27System::ETX1[EsoTwistD3Q27System::ENDF+1] = { 0,  1,  0,  0,  0,  0,  0,  1,  0,  1,  0,  1,  0,  1,  0,  0,  0,  0,  0,  1,  0,  1,  0,  1,  0,  1,  0 };
+const int EsoTwistD3Q27System::ETX2[EsoTwistD3Q27System::ENDF+1] = { 0,  0,  0,  1,  0,  0,  0,  1,  0, -1,  0,  0,  0,  0,  0,  1, -1,  0,  0, -1,  0,  1,  0, -1,  0,  1,  0 };
+const int EsoTwistD3Q27System::ETX3[EsoTwistD3Q27System::ENDF+1] = { 0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  1,  0, -1,  0,  1,  1,  0,  0, -1,  0, -1,  0,  1,  0,  1,  0 };
+
+const int EsoTwistD3Q27System::etINVDIR[EsoTwistD3Q27System::ENDF+1] = { D3Q27System::INV_E,   
+                                                                           D3Q27System::INV_W,  
+                                                                           D3Q27System::INV_N,  
+                                                                           D3Q27System::INV_S,  
+                                                                           D3Q27System::INV_T,  
+                                                                           D3Q27System::INV_B,  
+                                                                           D3Q27System::INV_NE, 
+                                                                           D3Q27System::INV_SW, 
+                                                                           D3Q27System::INV_SE, 
+                                                                           D3Q27System::INV_NW,
+                                                                           D3Q27System::INV_TE, 
+                                                                           D3Q27System::INV_BW, 
+                                                                           D3Q27System::INV_BE, 
+                                                                           D3Q27System::INV_TW, 
+                                                                           D3Q27System::INV_TN, 
+                                                                           D3Q27System::INV_BS, 
+                                                                           D3Q27System::INV_BN, 
+                                                                           D3Q27System::INV_TS, 
+                                                                           D3Q27System::INV_TNE,
+                                                                           D3Q27System::INV_TNW,
+                                                                           D3Q27System::INV_TSE,
+                                                                           D3Q27System::INV_TSW,
+                                                                           D3Q27System::INV_BNE,
+                                                                           D3Q27System::INV_BNW,
+                                                                           D3Q27System::INV_BSE,
+                                                                           D3Q27System::INV_BSW,
+                                                                           D3Q27System::ZERO};
+
+const unsigned long int EsoTwistD3Q27System::etDIR[EsoTwistD3Q27System::ENDF+1] = { etE,   
+                                                                                    etW,  
+                                                                                    etN,  
+                                                                                    etS,  
+                                                                                    etT,  
+                                                                                    etB,  
+                                                                                    etNE, 
+                                                                                    etSW, 
+                                                                                    etSE, 
+                                                                                    etNW,
+                                                                                    etTE, 
+                                                                                    etBW, 
+                                                                                    etBE, 
+                                                                                    etTW, 
+                                                                                    etTN, 
+                                                                                    etBS, 
+                                                                                    etBN, 
+                                                                                    etTS,
+                                                                                    etTNE,
+                                                                                    etTNW,
+                                                                                    etTSE,
+                                                                                    etTSW,
+                                                                                    etBNE,
+                                                                                    etBNW,
+                                                                                    etBSE,
+                                                                                    etBSW,
+                                                                                    etZERO};
+
+ const unsigned long int EsoTwistD3Q27System::etZERO = 1;/*f0 */
+ const unsigned long int EsoTwistD3Q27System::etE =  2;    /*f1 */
+ const unsigned long int EsoTwistD3Q27System::etW =  4;    /*f2 */
+ const unsigned long int EsoTwistD3Q27System::etN =  8;    /*f3 */
+ const unsigned long int EsoTwistD3Q27System::etS =  16;   /*f4 */
+ const unsigned long int EsoTwistD3Q27System::etT =  32;    /*f5 */
+ const unsigned long int EsoTwistD3Q27System::etB =  64;   /*f6 */
+ const unsigned long int EsoTwistD3Q27System::etNE = 128;  /*f7 */
+ const unsigned long int EsoTwistD3Q27System::etSW = 256;  /*f8 */
+ const unsigned long int EsoTwistD3Q27System::etSE = 512;  /*f9 */
+ const unsigned long int EsoTwistD3Q27System::etNW = 1024;  /*f10*/
+ const unsigned long int EsoTwistD3Q27System::etTE = 2048;  /*f11*/
+ const unsigned long int EsoTwistD3Q27System::etBW = 4096;  /*f12*/
+ const unsigned long int EsoTwistD3Q27System::etBE = 8192;  /*f13*/
+ const unsigned long int EsoTwistD3Q27System::etTW = 16384;  /*f14*/
+ const unsigned long int EsoTwistD3Q27System::etTN = 32768;  /*f15*/
+ const unsigned long int EsoTwistD3Q27System::etBS = 65536;  /*f16*/
+ const unsigned long int EsoTwistD3Q27System::etBN = 131072;  /*f17*/
+ const unsigned long int EsoTwistD3Q27System::etTS = 262144;  /*f18*/
+ const unsigned long int EsoTwistD3Q27System::etTNE = 524288;
+ const unsigned long int EsoTwistD3Q27System::etTNW = 1048576;
+ const unsigned long int EsoTwistD3Q27System::etTSE = 2097152;
+ const unsigned long int EsoTwistD3Q27System::etTSW = 4194304;
+ const unsigned long int EsoTwistD3Q27System::etBNE = 8388608;
+ const unsigned long int EsoTwistD3Q27System::etBNW = 16777216;
+ const unsigned long int EsoTwistD3Q27System::etBSE = 33554432;
+const unsigned long int EsoTwistD3Q27System::etBSW = 67108864;
+
diff --git a/src/cpu/VirtualFluidsCore/Data/EsoTwistD3Q27System.h b/src/cpu/VirtualFluidsCore/Data/EsoTwistD3Q27System.h
index bf5c1bf6989ec585f3db57c48b9db5fc7bf71ff6..2c21e65ac3f39d85661f53062d42132c6667cc05 100644
--- a/src/cpu/VirtualFluidsCore/Data/EsoTwistD3Q27System.h
+++ b/src/cpu/VirtualFluidsCore/Data/EsoTwistD3Q27System.h
@@ -1,142 +1,142 @@
-//=======================================================================================
-// ____          ____    __    ______     __________   __      __       __        __         
-// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
-//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
-//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
-//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
-//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
-//      \    \  |    |   ________________________________________________________________    
-//       \    \ |    |  |  ______________________________________________________________|   
-//        \    \|    |  |  |         __          __     __     __     ______      _______    
-//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
-//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
-//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
-//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
-//
-//  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 EsoTwistD3Q27System.h
-//! \ingroup Data
-//! \author Konstantin Kutscher
-//=======================================================================================
-
-#ifndef ESOTWISTD3Q27SYSTEM_H
-#define ESOTWISTD3Q27SYSTEM_H
-
-#include "D3Q27System.h"
-
-//! 
-struct EsoTwistD3Q27System
-{
-   const static int FSTARTDIR = D3Q27System::FSTARTDIR;
-   const static int FENDDIR   = D3Q27System::FENDDIR;   //gellerstyle: meint alle frichtungen OHNE f0
-
-   const static int STARTF    = D3Q27System::STARTF;
-   const static int ENDF  		= D3Q27System::ENDF;
-
-   const static int STARTDIR  = D3Q27System::STARTDIR;
-   const static int ENDDIR		= D3Q27System::ENDDIR;
-
-   static const int ZERO = D3Q27System::ZERO;/*f0 */
-   static const int E =  D3Q27System::E;    /*f1 */ 
-   static const int W =  D3Q27System::W;    /*f2 */ 
-   static const int N =  D3Q27System::N;    /*f3 */ 
-   static const int S =  D3Q27System::S;   /*f4 */ 
-   static const int T =  D3Q27System::T;    /*f5 */ 
-   static const int B =  D3Q27System::B;   /*f6 */ 
-   static const int NE = D3Q27System::NE;  /*f7 */ 
-   static const int SW = D3Q27System::SW;  /*f8 */ 
-   static const int SE = D3Q27System::SE;  /*f9 */ 
-   static const int NW = D3Q27System::NW;  /*f10*/ 
-   static const int TE = D3Q27System::TE;  /*f11*/ 
-   static const int BW = D3Q27System::BW;  /*f12*/ 
-   static const int BE = D3Q27System::BE;  /*f13*/ 
-   static const int TW = D3Q27System::TW;  /*f14*/ 
-   static const int TN = D3Q27System::TN;  /*f15*/ 
-   static const int BS = D3Q27System::BS;  /*f16*/ 
-   static const int BN = D3Q27System::BN;  /*f17*/ 
-   static const int TS = D3Q27System::TS;  /*f18*/ 
-   static const int TNE = D3Q27System::TNE;
-   static const int TNW = D3Q27System::TNW;
-   static const int TSE = D3Q27System::TSE;
-   static const int TSW = D3Q27System::TSW;
-   static const int BNE = D3Q27System::BNE;
-   static const int BNW = D3Q27System::BNW;
-   static const int BSE = D3Q27System::BSE;
-   static const int BSW = D3Q27System::BSW;
- 
-
-   static const int INV_E   = D3Q27System::W;  
-   static const int INV_W   = D3Q27System::E;  
-   static const int INV_N   = D3Q27System::S;  
-   static const int INV_S   = D3Q27System::N;  
-   static const int INV_T   = D3Q27System::B;  
-   static const int INV_B   = D3Q27System::T;  
-   static const int INV_NE  = D3Q27System::SW; 
-   static const int INV_SW  = D3Q27System::NE; 
-   static const int INV_SE  = D3Q27System::NW; 
-   static const int INV_NW  = D3Q27System::SE; 
-   static const int INV_TE  = D3Q27System::BW; 
-   static const int INV_BW  = D3Q27System::TE; 
-   static const int INV_BE  = D3Q27System::TW; 
-   static const int INV_TW  = D3Q27System::BE; 
-   static const int INV_TN  = D3Q27System::BS; 
-   static const int INV_BS  = D3Q27System::TN; 
-   static const int INV_BN  = D3Q27System::TS; 
-   static const int INV_TS  = D3Q27System::BN; 
-   static const int INV_TNE = D3Q27System::BSW;
-   static const int INV_TNW = D3Q27System::BSE;
-   static const int INV_TSE = D3Q27System::BNW;
-   static const int INV_TSW = D3Q27System::BNE;
-   static const int INV_BNE = D3Q27System::TSW;
-   static const int INV_BNW = D3Q27System::TSE;
-   static const int INV_BSE = D3Q27System::TNW;
-   static const int INV_BSW = D3Q27System::TNE;
-
-   static const unsigned long int etZERO;// 1;/*f0 */
-   static const unsigned long int etE;//  2;    /*f1 */
-   static const unsigned long int etW;//  4;    /*f2 */
-   static const unsigned long int etN;//  8;    /*f3 */
-   static const unsigned long int etS;//  16;   /*f4 */
-   static const unsigned long int etT;//  32;    /*f5 */
-   static const unsigned long int etB;//  64;   /*f6 */
-   static const unsigned long int etNE;// 128;  /*f7 */
-   static const unsigned long int etSW;// 256;  /*f8 */
-   static const unsigned long int etSE;// 512;  /*f9 */
-   static const unsigned long int etNW;// 1024;  /*f10*/
-   static const unsigned long int etTE;// 2048;  /*f11*/
-   static const unsigned long int etBW;// 4096;  /*f12*/
-   static const unsigned long int etBE;// 8192;  /*f13*/
-   static const unsigned long int etTW;// 16384;  /*f14*/
-   static const unsigned long int etTN;// 32768;  /*f15*/
-   static const unsigned long int etBS;// 65536;  /*f16*/
-   static const unsigned long int etBN;// 131072;  /*f17*/
-   static const unsigned long int etTS;// 262144;  /*f18*/
-   static const unsigned long int etTNE;// 524288;
-   static const unsigned long int etTNW;// 1048576;
-   static const unsigned long int etTSE;// 2097152;
-   static const unsigned long int etTSW;// 4194304;
-   static const unsigned long int etBNE;// 8388608;
-   static const unsigned long int etBNW;// 16777216;
-   static const unsigned long int etBSE;// 33554432;
-   static const unsigned long int etBSW;// = 67108864;
-
-   const static int ETX1[ENDF+1];
-   const static int ETX2[ENDF+1];
-   const static int ETX3[ENDF+1];
-   const static int etINVDIR[ENDF+1]; 
-   const static unsigned long int etDIR[ENDF+1]; 
-};
-
-#endif
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 EsoTwistD3Q27System.h
+//! \ingroup Data
+//! \author Konstantin Kutscher
+//=======================================================================================
+
+#ifndef ESOTWISTD3Q27SYSTEM_H
+#define ESOTWISTD3Q27SYSTEM_H
+
+#include "D3Q27System.h"
+
+//! 
+struct EsoTwistD3Q27System
+{
+   const static int FSTARTDIR = D3Q27System::FSTARTDIR;
+   const static int FENDDIR   = D3Q27System::FENDDIR;   //gellerstyle: meint alle frichtungen OHNE f0
+
+   const static int STARTF    = D3Q27System::STARTF;
+   const static int ENDF  		= D3Q27System::ENDF;
+
+   const static int STARTDIR  = D3Q27System::STARTDIR;
+   const static int ENDDIR		= D3Q27System::ENDDIR;
+
+   static const int ZERO = D3Q27System::ZERO;/*f0 */
+   static const int E =  D3Q27System::E;    /*f1 */ 
+   static const int W =  D3Q27System::W;    /*f2 */ 
+   static const int N =  D3Q27System::N;    /*f3 */ 
+   static const int S =  D3Q27System::S;   /*f4 */ 
+   static const int T =  D3Q27System::T;    /*f5 */ 
+   static const int B =  D3Q27System::B;   /*f6 */ 
+   static const int NE = D3Q27System::NE;  /*f7 */ 
+   static const int SW = D3Q27System::SW;  /*f8 */ 
+   static const int SE = D3Q27System::SE;  /*f9 */ 
+   static const int NW = D3Q27System::NW;  /*f10*/ 
+   static const int TE = D3Q27System::TE;  /*f11*/ 
+   static const int BW = D3Q27System::BW;  /*f12*/ 
+   static const int BE = D3Q27System::BE;  /*f13*/ 
+   static const int TW = D3Q27System::TW;  /*f14*/ 
+   static const int TN = D3Q27System::TN;  /*f15*/ 
+   static const int BS = D3Q27System::BS;  /*f16*/ 
+   static const int BN = D3Q27System::BN;  /*f17*/ 
+   static const int TS = D3Q27System::TS;  /*f18*/ 
+   static const int TNE = D3Q27System::TNE;
+   static const int TNW = D3Q27System::TNW;
+   static const int TSE = D3Q27System::TSE;
+   static const int TSW = D3Q27System::TSW;
+   static const int BNE = D3Q27System::BNE;
+   static const int BNW = D3Q27System::BNW;
+   static const int BSE = D3Q27System::BSE;
+   static const int BSW = D3Q27System::BSW;
+ 
+
+   static const int INV_E   = D3Q27System::W;  
+   static const int INV_W   = D3Q27System::E;  
+   static const int INV_N   = D3Q27System::S;  
+   static const int INV_S   = D3Q27System::N;  
+   static const int INV_T   = D3Q27System::B;  
+   static const int INV_B   = D3Q27System::T;  
+   static const int INV_NE  = D3Q27System::SW; 
+   static const int INV_SW  = D3Q27System::NE; 
+   static const int INV_SE  = D3Q27System::NW; 
+   static const int INV_NW  = D3Q27System::SE; 
+   static const int INV_TE  = D3Q27System::BW; 
+   static const int INV_BW  = D3Q27System::TE; 
+   static const int INV_BE  = D3Q27System::TW; 
+   static const int INV_TW  = D3Q27System::BE; 
+   static const int INV_TN  = D3Q27System::BS; 
+   static const int INV_BS  = D3Q27System::TN; 
+   static const int INV_BN  = D3Q27System::TS; 
+   static const int INV_TS  = D3Q27System::BN; 
+   static const int INV_TNE = D3Q27System::BSW;
+   static const int INV_TNW = D3Q27System::BSE;
+   static const int INV_TSE = D3Q27System::BNW;
+   static const int INV_TSW = D3Q27System::BNE;
+   static const int INV_BNE = D3Q27System::TSW;
+   static const int INV_BNW = D3Q27System::TSE;
+   static const int INV_BSE = D3Q27System::TNW;
+   static const int INV_BSW = D3Q27System::TNE;
+
+   static const unsigned long int etZERO;// 1;/*f0 */
+   static const unsigned long int etE;//  2;    /*f1 */
+   static const unsigned long int etW;//  4;    /*f2 */
+   static const unsigned long int etN;//  8;    /*f3 */
+   static const unsigned long int etS;//  16;   /*f4 */
+   static const unsigned long int etT;//  32;    /*f5 */
+   static const unsigned long int etB;//  64;   /*f6 */
+   static const unsigned long int etNE;// 128;  /*f7 */
+   static const unsigned long int etSW;// 256;  /*f8 */
+   static const unsigned long int etSE;// 512;  /*f9 */
+   static const unsigned long int etNW;// 1024;  /*f10*/
+   static const unsigned long int etTE;// 2048;  /*f11*/
+   static const unsigned long int etBW;// 4096;  /*f12*/
+   static const unsigned long int etBE;// 8192;  /*f13*/
+   static const unsigned long int etTW;// 16384;  /*f14*/
+   static const unsigned long int etTN;// 32768;  /*f15*/
+   static const unsigned long int etBS;// 65536;  /*f16*/
+   static const unsigned long int etBN;// 131072;  /*f17*/
+   static const unsigned long int etTS;// 262144;  /*f18*/
+   static const unsigned long int etTNE;// 524288;
+   static const unsigned long int etTNW;// 1048576;
+   static const unsigned long int etTSE;// 2097152;
+   static const unsigned long int etTSW;// 4194304;
+   static const unsigned long int etBNE;// 8388608;
+   static const unsigned long int etBNW;// 16777216;
+   static const unsigned long int etBSE;// 33554432;
+   static const unsigned long int etBSW;// = 67108864;
+
+   const static int ETX1[ENDF+1];
+   const static int ETX2[ENDF+1];
+   const static int ETX3[ENDF+1];
+   const static int etINVDIR[ENDF+1]; 
+   const static unsigned long int etDIR[ENDF+1]; 
+};
+
+#endif
diff --git a/src/cpu/VirtualFluidsCore/Data/VoidData3D.h b/src/cpu/VirtualFluidsCore/Data/VoidData3D.h
index d0fd781700bdcf8ccd30f9a3859e6d9fdcd2e057..d1f22710167f0b23f3dfd816b0147833cbd113a0 100644
--- a/src/cpu/VirtualFluidsCore/Data/VoidData3D.h
+++ b/src/cpu/VirtualFluidsCore/Data/VoidData3D.h
@@ -1,37 +1,37 @@
-#ifndef VoidData3D_H
-#define VoidData3D_H
-
-#include "EsoTwist3D.h"
-
-
-class VoidData3D : public EsoTwist3D
-{
-public:
-   VoidData3D() {};
-   VoidData3D (size_t nx1, size_t nx2, size_t nx3, LBMReal value) 
-   {
-      this->NX1 = nx1;
-      this->NX2 = nx2;
-      this->NX3 = nx3;
-   }
-    ~VoidData3D() {};
-    size_t getNX1() const { return NX1;}
-    size_t getNX2() const { return NX2;}
-    size_t getNX3() const { return NX3;}
-    void getDistribution(LBMReal* const f, size_t x1, size_t x2, size_t x3) {}
-    void setDistribution(const LBMReal* const f, size_t x1, size_t x2, size_t x3){}
-    void getDistributionInv(LBMReal* const f, size_t x1, size_t x2, size_t x3) {}
-    void setDistributionInv(const LBMReal* const f, size_t x1, size_t x2, size_t x3) {}
-    void setDistributionForDirection(const LBMReal* const f, size_t x1, size_t x2, size_t x3, unsigned long int direction) {}
-    void setDistributionForDirection(LBMReal f, size_t x1, size_t x2, size_t x3, int direction) {}
-    LBMReal getDistributionInvForDirection(size_t x1, size_t x2, size_t x3, int direction) {return 0.0;}
-    void setDistributionInvForDirection(const LBMReal* const f, size_t x1, size_t x2, size_t x3, unsigned long int direction) {}
-    void setDistributionInvForDirection(LBMReal f, size_t x1, size_t x2, size_t x3, unsigned long int direction) {}
-    LBMReal getDistributionForDirection(size_t x1, size_t x2, size_t x3, int direction) {return 0.0;}
-    void swap() {}
-protected:
-private:
-   size_t NX1, NX2, NX3;
-};
-
-#endif
+#ifndef VoidData3D_H
+#define VoidData3D_H
+
+#include "EsoTwist3D.h"
+
+
+class VoidData3D : public EsoTwist3D
+{
+public:
+   VoidData3D() {};
+   VoidData3D (size_t nx1, size_t nx2, size_t nx3, LBMReal value) 
+   {
+      this->NX1 = nx1;
+      this->NX2 = nx2;
+      this->NX3 = nx3;
+   }
+    ~VoidData3D() {};
+    size_t getNX1() const { return NX1;}
+    size_t getNX2() const { return NX2;}
+    size_t getNX3() const { return NX3;}
+    void getDistribution(LBMReal* const f, size_t x1, size_t x2, size_t x3) {}
+    void setDistribution(const LBMReal* const f, size_t x1, size_t x2, size_t x3){}
+    void getDistributionInv(LBMReal* const f, size_t x1, size_t x2, size_t x3) {}
+    void setDistributionInv(const LBMReal* const f, size_t x1, size_t x2, size_t x3) {}
+    void setDistributionForDirection(const LBMReal* const f, size_t x1, size_t x2, size_t x3, unsigned long int direction) {}
+    void setDistributionForDirection(LBMReal f, size_t x1, size_t x2, size_t x3, int direction) {}
+    LBMReal getDistributionInvForDirection(size_t x1, size_t x2, size_t x3, int direction) {return 0.0;}
+    void setDistributionInvForDirection(const LBMReal* const f, size_t x1, size_t x2, size_t x3, unsigned long int direction) {}
+    void setDistributionInvForDirection(LBMReal f, size_t x1, size_t x2, size_t x3, unsigned long int direction) {}
+    LBMReal getDistributionForDirection(size_t x1, size_t x2, size_t x3, int direction) {return 0.0;}
+    void swap() {}
+protected:
+private:
+   size_t NX1, NX2, NX3;
+};
+
+#endif
diff --git a/src/cpu/VirtualFluidsCore/Grid/BasicCalculator.cpp b/src/cpu/VirtualFluidsCore/Grid/BasicCalculator.cpp
index 5da7a3b272c56611a771ba0830278b6493b67374..4f58b73968ba1c8b57b0255c118b98db64648f44 100644
--- a/src/cpu/VirtualFluidsCore/Grid/BasicCalculator.cpp
+++ b/src/cpu/VirtualFluidsCore/Grid/BasicCalculator.cpp
@@ -1,432 +1,432 @@
-//=======================================================================================
-// ____          ____    __    ______     __________   __      __       __        __         
-// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
-//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
-//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
-//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
-//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
-//      \    \  |    |   ________________________________________________________________    
-//       \    \ |    |  |  ______________________________________________________________|   
-//        \    \|    |  |  |         __          __     __     __     ______      _______    
-//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
-//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
-//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
-//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
-//
-//  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 BasicCalculator.cpp
-//! \ingroup Grid
-//! \author Konstantin Kutscher
-//=======================================================================================
-
-#include "BasicCalculator.h"
-
-#include "Block3D.h"
-#include "BCProcessor.h"
-#include "LBMKernel.h"
-#include "Block3DConnector.h"
-#include "UbScheduler.h"
-#include "UbLogger.h"
-
-#ifdef _OPENMP
-#include <omp.h>
-#endif
-#define OMP_SCHEDULE guided
-
-//#define TIMING
-//#include "UbTiming.h"
-
-BasicCalculator::BasicCalculator(SPtr<Grid3D> grid, SPtr<UbScheduler> additionalGhostLayerUpdateScheduler, int numberOfTimeSteps) :
-   Calculator(grid, additionalGhostLayerUpdateScheduler, numberOfTimeSteps)
-{
-
-}
-//////////////////////////////////////////////////////////////////////////
-BasicCalculator::~BasicCalculator()
-{
-
-}
-//////////////////////////////////////////////////////////////////////////
-void BasicCalculator::calculate()
-{
-   UBLOG(logDEBUG1, "OMPCalculator::calculate() - started");
-   int calcStep = 0;
-   try
-   {
-      int minInitLevel = minLevel;
-      int maxInitLevel = maxLevel - minLevel;
-      int straightStartLevel = minInitLevel;
-      int internalIterations = 1 << (maxInitLevel - minInitLevel);
-      int forwardStartLevel;
-      int threshold;
-
-#ifdef TIMING
-      UbTimer timer;
-      double time[6];
-#endif
-
-      for (calcStep = startTimeStep; calcStep <= numberOfTimeSteps; calcStep++)
-      {
-         //////////////////////////////////////////////////////////////////////////
-#ifdef TIMING
-         UBLOG(logINFO, "calcStep = " << calcStep);
-#endif
-         //////////////////////////////////////////////////////////////////////////
-
-         for (int staggeredStep = 1; staggeredStep <= internalIterations; staggeredStep++)
-         {
-            forwardStartLevel = straightStartLevel;
-            if (staggeredStep == internalIterations) straightStartLevel = minInitLevel;
-            else
-            {
-               for (straightStartLevel = maxInitLevel, threshold = 1;
-                  (staggeredStep & threshold) != threshold; straightStartLevel--, threshold <<= 1);
-            }
-            //////////////////////////////////////////////////////////////////////////
-#ifdef TIMING
-            timer.resetAndStart();
-#endif
-            //////////////////////////////////////////////////////////////////////////
-            applyPreCollisionBC(straightStartLevel, maxInitLevel);
-
-            //do collision for all blocks
-            calculateBlocks(straightStartLevel, maxInitLevel, calcStep);
-            //////////////////////////////////////////////////////////////////////////
-#ifdef TIMING
-            time[0] = timer.stop();
-            UBLOG(logINFO, "calculateBlocks time = " << time[0]);
-#endif
-            //////////////////////////////////////////////////////////////////////////
-                        //////////////////////////////////////////////////////////////////////////
-                        //exchange data between blocks
-            exchangeBlockData(straightStartLevel, maxInitLevel);
-            //////////////////////////////////////////////////////////////////////////
-#ifdef TIMING
-            time[1] = timer.stop();
-            UBLOG(logINFO, "exchangeBlockData time = " << time[1]);
-#endif
-            //////////////////////////////////////////////////////////////////////////
-            applyPostCollisionBC(straightStartLevel, maxInitLevel);
-            //////////////////////////////////////////////////////////////////////////
-#ifdef TIMING
-            time[2] = timer.stop();
-            UBLOG(logINFO, "applyBCs time = " << time[2]);
-#endif
-            //////////////////////////////////////////////////////////////////////////
-            //swap distributions in kernel
-            swapDistributions(straightStartLevel, maxInitLevel);
-            //////////////////////////////////////////////////////////////////////////
-#ifdef TIMING
-            time[3] = timer.stop();
-            UBLOG(logINFO, "swapDistributions time = " << time[3]);
-#endif
-            //////////////////////////////////////////////////////////////////////////
-            if (refinement)
-            {
-               if (straightStartLevel < maxInitLevel)
-                  exchangeBlockData(straightStartLevel, maxInitLevel);
-               //////////////////////////////////////////////////////////////////////////
-#ifdef TIMING
-               time[4] = timer.stop();
-               UBLOG(logINFO, "refinement exchangeBlockData time = " << time[4]);
-#endif
-               //////////////////////////////////////////////////////////////////////////
-               //now ghost nodes have actual values
-               //interpolation of interface nodes between grid levels
-               interpolation(straightStartLevel, maxInitLevel);
-               //////////////////////////////////////////////////////////////////////////
-#ifdef TIMING
-               time[5] = timer.stop();
-               UBLOG(logINFO, "refinement interpolation time = " << time[5]);
-#endif
-               //////////////////////////////////////////////////////////////////////////
-            }
-         }
-         //exchange data between blocks for visualization
-         if (additionalGhostLayerUpdateScheduler->isDue(calcStep))
-         {
-            exchangeBlockData(straightStartLevel, maxInitLevel);
-         }
-         coProcess((double)(calcStep));
-         //now ghost nodes have actual values
-      }
-      UBLOG(logDEBUG1, "OMPCalculator::calculate() - stoped");
-   }
-   catch (std::exception & e)
-   {
-      UBLOG(logERROR, e.what());
-      UBLOG(logERROR, " step = " << calcStep);
-      //throw e;
-      //exit(EXIT_FAILURE);
-   }
-   catch (std::string & s)
-   {
-      UBLOG(logERROR, s);
-      //exit(EXIT_FAILURE);
-      //throw s;
-   }
-   catch (...)
-   {
-      UBLOG(logERROR, "unknown exception");
-      //exit(EXIT_FAILURE);
-      //throw;
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-void BasicCalculator::calculateBlocks(int startLevel, int maxInitLevel, int calcStep)
-{
-#ifdef _OPENMP
-#pragma omp parallel
-#endif
-   {
-      SPtr<Block3D> blockTemp;
-      //startLevel bis maxInitLevel
-      for (int level = startLevel; level <= maxInitLevel; level++)
-      {
-         //timer.resetAndStart();
-         //call LBM kernel
-         int size = (int)blocks[level].size();
-#ifdef _OPENMP
-#pragma omp for schedule(OMP_SCHEDULE)
-#endif
-         for (int i = 0; i < size; i++)
-         {
-            try
-            {
-               blockTemp = blocks[level][i];
-               blockTemp->getKernel()->calculate(calcStep);
-            }
-            catch (std::exception & e)
-            {
-               UBLOG(logERROR, e.what());
-               UBLOG(logERROR, blockTemp->toString() << " step = " << calcStep);
-               std::exit(EXIT_FAILURE);
-            }
-         }
-         //timer.stop();
-         //UBLOG(logINFO, "level = " << level << " blocks = " << blocks[level].size() << " collision time = " << timer.getTotalTime());
-      }
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-void BasicCalculator::exchangeBlockData(int startLevel, int maxInitLevel)
-{
-   //startLevel bis maxInitLevel
-   for (int level = startLevel; level <= maxInitLevel; level++)
-   {
-      //connectorsPrepareLocal(localConns[level]);
-      connectorsSendLocal(localConns[level]);
-      //connectorsReceiveLocal(localConns[level]);
-
-      connectorsPrepareRemote(remoteConns[level]);
-      connectorsSendRemote(remoteConns[level]);
-      connectorsReceiveRemote(remoteConns[level]);
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-void BasicCalculator::swapDistributions(int startLevel, int maxInitLevel)
-{
-#ifdef _OPENMP
-#pragma omp parallel
-#endif
-   {
-      //startLevel bis maxInitLevel
-      for (int level = startLevel; level <= maxInitLevel; level++)
-      {
-         int size = (int)blocks[level].size();
-#ifdef _OPENMP
-#pragma omp for schedule(OMP_SCHEDULE)
-#endif
-         for (int i = 0; i < size; i++)
-         {
-            blocks[level][i]->getKernel()->swapDistributions();
-         }
-      }
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-void BasicCalculator::connectorsPrepareLocal(std::vector< SPtr<Block3DConnector> >& connectors)
-{
-   int size = (int)connectors.size();
-#ifdef _OPENMP
-#pragma omp parallel for schedule(OMP_SCHEDULE)
-#endif
-   for (int i = 0; i < size; i++)
-   {
-      try
-      {
-         connectors[i]->prepareForReceive();
-         connectors[i]->prepareForSend();
-      }
-      catch (std::exception & e)
-      {
-         UBLOG(logERROR, e.what());
-         std::exit(EXIT_FAILURE);
-      }
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-void BasicCalculator::connectorsSendLocal(std::vector< SPtr<Block3DConnector> >& connectors)
-{
-   int size = (int)connectors.size();
-#ifdef _OPENMP
-#pragma omp parallel for schedule(OMP_SCHEDULE)
-#endif
-   for (int i = 0; i < size; i++)
-   {
-      try
-      {
-         connectors[i]->fillSendVectors();
-         connectors[i]->sendVectors();
-      }
-      catch (std::exception & e)
-      {
-         UBLOG(logERROR, e.what());
-         std::exit(EXIT_FAILURE);
-      }
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-void BasicCalculator::connectorsReceiveLocal(std::vector< SPtr<Block3DConnector> >& connectors)
-{
-   int size = (int)connectors.size();
-#ifdef _OPENMP
-#pragma omp parallel for schedule(OMP_SCHEDULE)
-#endif
-   for (int i = 0; i < size; i++)
-   {
-      connectors[i]->receiveVectors();
-      connectors[i]->distributeReceiveVectors();
-   }
-}
-void BasicCalculator::connectorsPrepareRemote(std::vector< SPtr<Block3DConnector> >& connectors)
-{
-   int size = (int)connectors.size();
-   for (int i = 0; i < size; i++)
-   {
-      connectors[i]->prepareForReceive();
-      connectors[i]->prepareForSend();
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-void BasicCalculator::connectorsSendRemote(std::vector< SPtr<Block3DConnector> >& connectors)
-{
-   int size = (int)connectors.size();
-   for (int i = 0; i < size; i++)
-   {
-      connectors[i]->fillSendVectors();
-      connectors[i]->sendVectors();
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-void BasicCalculator::connectorsReceiveRemote(std::vector< SPtr<Block3DConnector> >& connectors)
-{
-   int size = (int)connectors.size();
-   for (int i = 0; i < size; i++)
-   {
-      connectors[i]->receiveVectors();
-      connectors[i]->distributeReceiveVectors();
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-void BasicCalculator::interpolation(int startLevel, int maxInitLevel)
-{
-   for (int level = startLevel; level < maxInitLevel; level++)
-   {
-      connectorsPrepareLocal(localInterConns[level]);
-      connectorsPrepareRemote(remoteInterConns[level]);
-   }
-
-   for (int level = startLevel; level < maxInitLevel; level++)
-   {
-      connectorsSendLocal(localInterConns[level]);
-      connectorsSendRemote(remoteInterConns[level]);
-   }
-
-   for (int level = startLevel; level < maxInitLevel; level++)
-   {
-      connectorsReceiveLocal(localInterConns[level]);
-      connectorsReceiveRemote(remoteInterConns[level]);
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-void BasicCalculator::applyPreCollisionBC(int startLevel, int maxInitLevel)
-{
-   //startLevel bis maxInitLevel
-   for (int level = startLevel; level <= maxInitLevel; level++)
-   {
-      int size = (int)blocks[level].size();
-#ifdef _OPENMP
-#pragma omp parallel for schedule(OMP_SCHEDULE)
-#endif
-      for (int i = 0; i < size; i++)
-      {
-         try 
-         {
-            blocks[level][i]->getKernel()->getBCProcessor()->applyPreCollisionBC();
-         }
-         catch (std::exception & e)
-         {
-            UBLOG(logERROR, e.what());
-            exit(EXIT_FAILURE);
-         }
-         catch (std::string & s)
-         {
-            UBLOG(logERROR, s);
-            exit(EXIT_FAILURE);
-         }
-         catch (...)
-         {
-            UBLOG(logERROR, "unknown exception");
-            exit(EXIT_FAILURE);
-         }
-      }
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-void BasicCalculator::applyPostCollisionBC(int startLevel, int maxInitLevel)
-{
-   //startLevel bis maxInitLevel
-   for (int level = startLevel; level <= maxInitLevel; level++)
-   {
-      int size = (int)blocks[level].size();
-#ifdef _OPENMP
-#pragma omp parallel for schedule(OMP_SCHEDULE)
-#endif
-      for (int i = 0; i < size; i++)
-      {
-         try 
-         {
-            blocks[level][i]->getKernel()->getBCProcessor()->applyPostCollisionBC();
-         }
-         catch (std::exception & e)
-         {
-            UBLOG(logERROR, e.what());
-            exit(EXIT_FAILURE);
-         }
-         catch (std::string & s)
-         {
-            UBLOG(logERROR, s);
-            exit(EXIT_FAILURE);
-         }
-         catch (...)
-         {
-            UBLOG(logERROR, "unknown exception");
-            exit(EXIT_FAILURE);
-         }
-      }
-   }
-}
-
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 BasicCalculator.cpp
+//! \ingroup Grid
+//! \author Konstantin Kutscher
+//=======================================================================================
+
+#include "BasicCalculator.h"
+
+#include "Block3D.h"
+#include "BCProcessor.h"
+#include "LBMKernel.h"
+#include "Block3DConnector.h"
+#include "UbScheduler.h"
+#include "UbLogger.h"
+
+#ifdef _OPENMP
+#include <omp.h>
+#endif
+#define OMP_SCHEDULE guided
+
+//#define TIMING
+//#include "UbTiming.h"
+
+BasicCalculator::BasicCalculator(SPtr<Grid3D> grid, SPtr<UbScheduler> additionalGhostLayerUpdateScheduler, int numberOfTimeSteps) :
+   Calculator(grid, additionalGhostLayerUpdateScheduler, numberOfTimeSteps)
+{
+
+}
+//////////////////////////////////////////////////////////////////////////
+BasicCalculator::~BasicCalculator()
+{
+
+}
+//////////////////////////////////////////////////////////////////////////
+void BasicCalculator::calculate()
+{
+   UBLOG(logDEBUG1, "OMPCalculator::calculate() - started");
+   int calcStep = 0;
+   try
+   {
+      int minInitLevel = minLevel;
+      int maxInitLevel = maxLevel - minLevel;
+      int straightStartLevel = minInitLevel;
+      int internalIterations = 1 << (maxInitLevel - minInitLevel);
+      int forwardStartLevel;
+      int threshold;
+
+#ifdef TIMING
+      UbTimer timer;
+      double time[6];
+#endif
+
+      for (calcStep = startTimeStep; calcStep <= numberOfTimeSteps; calcStep++)
+      {
+         //////////////////////////////////////////////////////////////////////////
+#ifdef TIMING
+         UBLOG(logINFO, "calcStep = " << calcStep);
+#endif
+         //////////////////////////////////////////////////////////////////////////
+
+         for (int staggeredStep = 1; staggeredStep <= internalIterations; staggeredStep++)
+         {
+            forwardStartLevel = straightStartLevel;
+            if (staggeredStep == internalIterations) straightStartLevel = minInitLevel;
+            else
+            {
+               for (straightStartLevel = maxInitLevel, threshold = 1;
+                  (staggeredStep & threshold) != threshold; straightStartLevel--, threshold <<= 1);
+            }
+            //////////////////////////////////////////////////////////////////////////
+#ifdef TIMING
+            timer.resetAndStart();
+#endif
+            //////////////////////////////////////////////////////////////////////////
+            applyPreCollisionBC(straightStartLevel, maxInitLevel);
+
+            //do collision for all blocks
+            calculateBlocks(straightStartLevel, maxInitLevel, calcStep);
+            //////////////////////////////////////////////////////////////////////////
+#ifdef TIMING
+            time[0] = timer.stop();
+            UBLOG(logINFO, "calculateBlocks time = " << time[0]);
+#endif
+            //////////////////////////////////////////////////////////////////////////
+                        //////////////////////////////////////////////////////////////////////////
+                        //exchange data between blocks
+            exchangeBlockData(straightStartLevel, maxInitLevel);
+            //////////////////////////////////////////////////////////////////////////
+#ifdef TIMING
+            time[1] = timer.stop();
+            UBLOG(logINFO, "exchangeBlockData time = " << time[1]);
+#endif
+            //////////////////////////////////////////////////////////////////////////
+            applyPostCollisionBC(straightStartLevel, maxInitLevel);
+            //////////////////////////////////////////////////////////////////////////
+#ifdef TIMING
+            time[2] = timer.stop();
+            UBLOG(logINFO, "applyBCs time = " << time[2]);
+#endif
+            //////////////////////////////////////////////////////////////////////////
+            //swap distributions in kernel
+            swapDistributions(straightStartLevel, maxInitLevel);
+            //////////////////////////////////////////////////////////////////////////
+#ifdef TIMING
+            time[3] = timer.stop();
+            UBLOG(logINFO, "swapDistributions time = " << time[3]);
+#endif
+            //////////////////////////////////////////////////////////////////////////
+            if (refinement)
+            {
+               if (straightStartLevel < maxInitLevel)
+                  exchangeBlockData(straightStartLevel, maxInitLevel);
+               //////////////////////////////////////////////////////////////////////////
+#ifdef TIMING
+               time[4] = timer.stop();
+               UBLOG(logINFO, "refinement exchangeBlockData time = " << time[4]);
+#endif
+               //////////////////////////////////////////////////////////////////////////
+               //now ghost nodes have actual values
+               //interpolation of interface nodes between grid levels
+               interpolation(straightStartLevel, maxInitLevel);
+               //////////////////////////////////////////////////////////////////////////
+#ifdef TIMING
+               time[5] = timer.stop();
+               UBLOG(logINFO, "refinement interpolation time = " << time[5]);
+#endif
+               //////////////////////////////////////////////////////////////////////////
+            }
+         }
+         //exchange data between blocks for visualization
+         if (additionalGhostLayerUpdateScheduler->isDue(calcStep))
+         {
+            exchangeBlockData(straightStartLevel, maxInitLevel);
+         }
+         coProcess((double)(calcStep));
+         //now ghost nodes have actual values
+      }
+      UBLOG(logDEBUG1, "OMPCalculator::calculate() - stoped");
+   }
+   catch (std::exception & e)
+   {
+      UBLOG(logERROR, e.what());
+      UBLOG(logERROR, " step = " << calcStep);
+      //throw e;
+      //exit(EXIT_FAILURE);
+   }
+   catch (std::string & s)
+   {
+      UBLOG(logERROR, s);
+      //exit(EXIT_FAILURE);
+      //throw s;
+   }
+   catch (...)
+   {
+      UBLOG(logERROR, "unknown exception");
+      //exit(EXIT_FAILURE);
+      //throw;
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+void BasicCalculator::calculateBlocks(int startLevel, int maxInitLevel, int calcStep)
+{
+#ifdef _OPENMP
+#pragma omp parallel
+#endif
+   {
+      SPtr<Block3D> blockTemp;
+      //startLevel bis maxInitLevel
+      for (int level = startLevel; level <= maxInitLevel; level++)
+      {
+         //timer.resetAndStart();
+         //call LBM kernel
+         int size = (int)blocks[level].size();
+#ifdef _OPENMP
+#pragma omp for schedule(OMP_SCHEDULE)
+#endif
+         for (int i = 0; i < size; i++)
+         {
+            try
+            {
+               blockTemp = blocks[level][i];
+               blockTemp->getKernel()->calculate(calcStep);
+            }
+            catch (std::exception & e)
+            {
+               UBLOG(logERROR, e.what());
+               UBLOG(logERROR, blockTemp->toString() << " step = " << calcStep);
+               std::exit(EXIT_FAILURE);
+            }
+         }
+         //timer.stop();
+         //UBLOG(logINFO, "level = " << level << " blocks = " << blocks[level].size() << " collision time = " << timer.getTotalTime());
+      }
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+void BasicCalculator::exchangeBlockData(int startLevel, int maxInitLevel)
+{
+   //startLevel bis maxInitLevel
+   for (int level = startLevel; level <= maxInitLevel; level++)
+   {
+      //connectorsPrepareLocal(localConns[level]);
+      connectorsSendLocal(localConns[level]);
+      //connectorsReceiveLocal(localConns[level]);
+
+      connectorsPrepareRemote(remoteConns[level]);
+      connectorsSendRemote(remoteConns[level]);
+      connectorsReceiveRemote(remoteConns[level]);
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+void BasicCalculator::swapDistributions(int startLevel, int maxInitLevel)
+{
+#ifdef _OPENMP
+#pragma omp parallel
+#endif
+   {
+      //startLevel bis maxInitLevel
+      for (int level = startLevel; level <= maxInitLevel; level++)
+      {
+         int size = (int)blocks[level].size();
+#ifdef _OPENMP
+#pragma omp for schedule(OMP_SCHEDULE)
+#endif
+         for (int i = 0; i < size; i++)
+         {
+            blocks[level][i]->getKernel()->swapDistributions();
+         }
+      }
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+void BasicCalculator::connectorsPrepareLocal(std::vector< SPtr<Block3DConnector> >& connectors)
+{
+   int size = (int)connectors.size();
+#ifdef _OPENMP
+#pragma omp parallel for schedule(OMP_SCHEDULE)
+#endif
+   for (int i = 0; i < size; i++)
+   {
+      try
+      {
+         connectors[i]->prepareForReceive();
+         connectors[i]->prepareForSend();
+      }
+      catch (std::exception & e)
+      {
+         UBLOG(logERROR, e.what());
+         std::exit(EXIT_FAILURE);
+      }
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+void BasicCalculator::connectorsSendLocal(std::vector< SPtr<Block3DConnector> >& connectors)
+{
+   int size = (int)connectors.size();
+#ifdef _OPENMP
+#pragma omp parallel for schedule(OMP_SCHEDULE)
+#endif
+   for (int i = 0; i < size; i++)
+   {
+      try
+      {
+         connectors[i]->fillSendVectors();
+         connectors[i]->sendVectors();
+      }
+      catch (std::exception & e)
+      {
+         UBLOG(logERROR, e.what());
+         std::exit(EXIT_FAILURE);
+      }
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+void BasicCalculator::connectorsReceiveLocal(std::vector< SPtr<Block3DConnector> >& connectors)
+{
+   int size = (int)connectors.size();
+#ifdef _OPENMP
+#pragma omp parallel for schedule(OMP_SCHEDULE)
+#endif
+   for (int i = 0; i < size; i++)
+   {
+      connectors[i]->receiveVectors();
+      connectors[i]->distributeReceiveVectors();
+   }
+}
+void BasicCalculator::connectorsPrepareRemote(std::vector< SPtr<Block3DConnector> >& connectors)
+{
+   int size = (int)connectors.size();
+   for (int i = 0; i < size; i++)
+   {
+      connectors[i]->prepareForReceive();
+      connectors[i]->prepareForSend();
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+void BasicCalculator::connectorsSendRemote(std::vector< SPtr<Block3DConnector> >& connectors)
+{
+   int size = (int)connectors.size();
+   for (int i = 0; i < size; i++)
+   {
+      connectors[i]->fillSendVectors();
+      connectors[i]->sendVectors();
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+void BasicCalculator::connectorsReceiveRemote(std::vector< SPtr<Block3DConnector> >& connectors)
+{
+   int size = (int)connectors.size();
+   for (int i = 0; i < size; i++)
+   {
+      connectors[i]->receiveVectors();
+      connectors[i]->distributeReceiveVectors();
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+void BasicCalculator::interpolation(int startLevel, int maxInitLevel)
+{
+   for (int level = startLevel; level < maxInitLevel; level++)
+   {
+      connectorsPrepareLocal(localInterConns[level]);
+      connectorsPrepareRemote(remoteInterConns[level]);
+   }
+
+   for (int level = startLevel; level < maxInitLevel; level++)
+   {
+      connectorsSendLocal(localInterConns[level]);
+      connectorsSendRemote(remoteInterConns[level]);
+   }
+
+   for (int level = startLevel; level < maxInitLevel; level++)
+   {
+      connectorsReceiveLocal(localInterConns[level]);
+      connectorsReceiveRemote(remoteInterConns[level]);
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+void BasicCalculator::applyPreCollisionBC(int startLevel, int maxInitLevel)
+{
+   //startLevel bis maxInitLevel
+   for (int level = startLevel; level <= maxInitLevel; level++)
+   {
+      int size = (int)blocks[level].size();
+#ifdef _OPENMP
+#pragma omp parallel for schedule(OMP_SCHEDULE)
+#endif
+      for (int i = 0; i < size; i++)
+      {
+         try 
+         {
+            blocks[level][i]->getKernel()->getBCProcessor()->applyPreCollisionBC();
+         }
+         catch (std::exception & e)
+         {
+            UBLOG(logERROR, e.what());
+            exit(EXIT_FAILURE);
+         }
+         catch (std::string & s)
+         {
+            UBLOG(logERROR, s);
+            exit(EXIT_FAILURE);
+         }
+         catch (...)
+         {
+            UBLOG(logERROR, "unknown exception");
+            exit(EXIT_FAILURE);
+         }
+      }
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+void BasicCalculator::applyPostCollisionBC(int startLevel, int maxInitLevel)
+{
+   //startLevel bis maxInitLevel
+   for (int level = startLevel; level <= maxInitLevel; level++)
+   {
+      int size = (int)blocks[level].size();
+#ifdef _OPENMP
+#pragma omp parallel for schedule(OMP_SCHEDULE)
+#endif
+      for (int i = 0; i < size; i++)
+      {
+         try 
+         {
+            blocks[level][i]->getKernel()->getBCProcessor()->applyPostCollisionBC();
+         }
+         catch (std::exception & e)
+         {
+            UBLOG(logERROR, e.what());
+            exit(EXIT_FAILURE);
+         }
+         catch (std::string & s)
+         {
+            UBLOG(logERROR, s);
+            exit(EXIT_FAILURE);
+         }
+         catch (...)
+         {
+            UBLOG(logERROR, "unknown exception");
+            exit(EXIT_FAILURE);
+         }
+      }
+   }
+}
+
diff --git a/src/cpu/VirtualFluidsCore/Grid/Block3D.cpp b/src/cpu/VirtualFluidsCore/Grid/Block3D.cpp
index b9381a93575ab60a016f01bfbf596a32829fb7fd..f11cfde0d0b69cc60862ab43d9afdf21d4dc5dae 100644
--- a/src/cpu/VirtualFluidsCore/Grid/Block3D.cpp
+++ b/src/cpu/VirtualFluidsCore/Grid/Block3D.cpp
@@ -1,539 +1,539 @@
-//=======================================================================================
-// ____          ____    __    ______     __________   __      __       __        __         
-// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
-//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
-//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
-//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
-//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
-//      \    \  |    |   ________________________________________________________________    
-//       \    \ |    |  |  ______________________________________________________________|   
-//        \    \|    |  |  |         __          __     __     __     ______      _______    
-//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
-//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
-//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
-//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
-//
-//  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 Block3D.cpp
-//! \ingroup Grid
-//! \author Konstantin Kutscher
-//=======================================================================================
-
-#include "Block3D.h"
-
-#include "Grid3DSystem.h"
-#include "Block3DConnector.h"
-#include "LBMKernel.h"
-
-
-int Block3D::counter = 0;
-//////////////////////////////////////////////////////////////////////////
-Block3D::Block3D() : x1(0),x2(0),x3(0)
-                     ,active(true)
-                     ,globalID(-1)
-                     ,rank(-1),part(-1)
-                     ,interpolationFlagCF(0)
-                     ,interpolationFlagFC(0)
-                     ,level(-1)
-                     ,bundle(-1)
-                     ,lrank(-1)
-                     ,localID(-1)
-{
-}
-//////////////////////////////////////////////////////////////////////////
-Block3D::Block3D(int x1, int x2, int x3, int level)
-               : x1(x1), x2(x2), x3(x3)
-               ,active(true)
-               ,globalID(-1)
-               ,rank(0),part(0)
-               ,interpolationFlagCF(0)
-               ,interpolationFlagFC(0)
-               ,level(level)
-               ,bundle(0)
-               ,lrank(-1)
-               ,localID(-1)
-{
-   globalID = counter++;
-}
-//////////////////////////////////////////////////////////////////////////
-Block3D::~Block3D()
-{
-}
-//////////////////////////////////////////////////////////////////////////
-bool Block3D::operator==(const Block3D& src) const
-{
-   return (x1==src.x1 && x2==src.x2 && x3==src.x3); 
-}
-//////////////////////////////////////////////////////////////////////////
-bool Block3D::operator!=(const Block3D& src) const
-{
-   return !(*this==src);
-}
-//////////////////////////////////////////////////////////////////////////
-int Block3D::getX1() const 
-{ 
-   return this->x1; 
-}
-//////////////////////////////////////////////////////////////////////////
-int Block3D::getX2() const 
-{ 
-   return this->x2; 
-}
-//////////////////////////////////////////////////////////////////////////
-int Block3D::getX3() const 
-{ 
-   return this->x3; 
-}
-//////////////////////////////////////////////////////////////////////////
-void Block3D::setActive(bool active) 
-{ 
-   this->active = active; 
-}
-//////////////////////////////////////////////////////////////////////////
-bool Block3D::isActive()    const           
-{ 
-   return this->active;   
-}
-//////////////////////////////////////////////////////////////////////////
-bool Block3D::isNotActive() const           
-{ 
-   return(!this->active); 
-}
-//////////////////////////////////////////////////////////////////////////
-void  Block3D::setKernel(SPtr<LBMKernel> kernel) 
-{  
-   this->kernel = kernel; 
-}
-//////////////////////////////////////////////////////////////////////////
-SPtr<ILBMKernel> Block3D::getKernel() const              
-{  
-   return this->kernel; 
-}
-//////////////////////////////////////////////////////////////////////////
-void Block3D::deleteKernel()             
-{  
-   this->kernel = SPtr<LBMKernel>(); 
-}
-//////////////////////////////////////////////////////////////////////////
-int  Block3D::getBundle() const          
-{ 
-   return bundle;       
-}
-//////////////////////////////////////////////////////////////////////////
-void Block3D::setBundle(int bundle) 
-{ 
-   this->bundle = bundle; 
-} 
-//////////////////////////////////////////////////////////////////////////
-void  Block3D::setRank(int rank) 
-{  
-   this->rank = rank; 
-}
-//////////////////////////////////////////////////////////////////////////
-int Block3D::getRank() const            
-{  
-   return this->rank; 
-}
-//////////////////////////////////////////////////////////////////////////
-void  Block3D::setLocalRank(int rank) 
-{  
-   this->lrank = rank; 
-}
-//////////////////////////////////////////////////////////////////////////
-int Block3D::getLocalRank() const            
-{  
-   return this->lrank; 
-}
-//////////////////////////////////////////////////////////////////////////
-int  Block3D::getGlobalID() const        
-{ 
-   return this->globalID; 
-}
-//////////////////////////////////////////////////////////////////////////
-void Block3D::setGlobalID(int id) 
-{ 
-   this->globalID = id; 
-}
-//////////////////////////////////////////////////////////////////////////
-int  Block3D::getLocalID() const        
-{ 
-   return this->localID; 
-}
-//////////////////////////////////////////////////////////////////////////
-void Block3D::setLocalID(int id) 
-{ 
-   this->localID = id; 
-}
-//////////////////////////////////////////////////////////////////////////
-int  Block3D::getPart() const        
-{ 
-   return this->part; 
-}
-//////////////////////////////////////////////////////////////////////////
-void Block3D::setPart(int part) 
-{ 
-   this->part = part; 
-}
-//////////////////////////////////////////////////////////////////////////
-int  Block3D::getLevel() const        
-{ 
-   return this->level; 
-}
-//////////////////////////////////////////////////////////////////////////
-void Block3D::setLevel(int level) 
-{ 
-   this->level = level; 
-}
-//////////////////////////////////////////////////////////////////////////
-SPtr<Block3DConnector> Block3D::getConnector(int dir) const
-{ 
-   for(SPtr<Block3DConnector> c : connectors)
-   {
-      if( c ) 
-      {
-            if(c->getSendDir() == dir) return c;
-      }
-   }
-  return SPtr<Block3DConnector>();     
-}
-//////////////////////////////////////////////////////////////////////////
-void Block3D::setConnector(SPtr<Block3DConnector> connector)
-{
-   connectors.push_back(connector);
-}
-//////////////////////////////////////////////////////////////////////////
-void Block3D::deleteConnectors()
-{
-   connectors.clear();
-}
-//////////////////////////////////////////////////////////////////////////
-bool Block3D::hasConnectors()
-{
-   for(SPtr<Block3DConnector> c : connectors)
-      if( c ) return true;
-   
-   return false;
-}
-//////////////////////////////////////////////////////////////////////////
-void Block3D::pushBackSameLevelConnectors(  std::vector<SPtr<Block3DConnector>>& localSameLevelConnectors
-                                            , std::vector<SPtr<Block3DConnector>>& remoteSameLevelConnectors )
-{
-   for(int i=0; i<(int)connectors.size(); i++)
-   {
-      SPtr<Block3DConnector> connector = this->connectors[i];
-      if( this->connectors[i] )
-      {
-         if( connector->isLocalConnector() && !connector->isInterpolationConnectorCF() && !connector->isInterpolationConnectorFC() ) 
-            localSameLevelConnectors.push_back(this->connectors[i]);
-         else                                
-            remoteSameLevelConnectors.push_back(this->connectors[i]);
-      }
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-void Block3D::pushBackLocalSameLevelConnectors( std::vector<SPtr<Block3DConnector>>& localSameLevelConnectors )
-{
-   for(int i=0; i<(int)connectors.size(); i++)
-   {
-      SPtr<Block3DConnector> connector = this->connectors[i];
-      if( this->connectors[i] )
-      {
-         if( connector->isLocalConnector() && !connector->isInterpolationConnectorCF() && !connector->isInterpolationConnectorFC() ) 
-            localSameLevelConnectors.push_back(this->connectors[i]);
-      }
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-void Block3D::pushBackLocalSameLevelConnectors( std::vector<SPtr<Block3DConnector>>& localSameLevelConnectors, const int& dir)
-{
-   SPtr<Block3DConnector> connector = this->connectors[dir];
-   if( this->connectors[dir] )
-   {
-      if( connector->isLocalConnector() && !connector->isInterpolationConnectorCF() && !connector->isInterpolationConnectorFC() ) 
-         localSameLevelConnectors.push_back(this->connectors[dir]);
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-void Block3D::pushBackRemoteSameLevelConnectors( std::vector<SPtr<Block3DConnector>>& remoteSameLevelConnectors )
-{
-   for(int i=0; i<(int)connectors.size(); i++)
-   {
-      SPtr<Block3DConnector> connector = this->connectors[i];
-      if( this->connectors[i] )
-      {
-         if( connector->isRemoteConnector() && !connector->isInterpolationConnectorCF() && !connector->isInterpolationConnectorFC() ) 
-            remoteSameLevelConnectors.push_back(this->connectors[i]);
-      }
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-void Block3D::pushBackRemoteSameLevelConnectors( std::vector<SPtr<Block3DConnector>>& remoteSameLevelConnectors, const int& dir )
-{
-   SPtr<Block3DConnector> connector = this->connectors[dir];
-   if( this->connectors[dir] )
-   {
-      if( connector->isRemoteConnector() && !connector->isInterpolationConnectorCF() && !connector->isInterpolationConnectorFC() ) 
-         remoteSameLevelConnectors.push_back(this->connectors[dir]);
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-void Block3D::pushBackLocalInterpolationConnectorsCF( std::vector<SPtr<Block3DConnector>>& localInterpolationConnectors )
-{
-   for(int i=0; i<(int)connectors.size(); i++)
-   {
-      SPtr<Block3DConnector> connector = this->connectors[i];
-      if( this->connectors[i] )
-      {
-         if( connector->isLocalConnector() && connector->isInterpolationConnectorCF() )
-            localInterpolationConnectors.push_back(this->connectors[i]);
-      }
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-void Block3D::pushBackRemoteInterpolationConnectorsCF( std::vector<SPtr<Block3DConnector>>& remoteInterpolationConnectors )
-{
-   for(int i=0; i<(int)connectors.size(); i++)
-   {
-      SPtr<Block3DConnector> connector = this->connectors[i];
-      if( this->connectors[i] )
-      {
-         if( connector->isRemoteConnector() && connector->isInterpolationConnectorCF() )
-            remoteInterpolationConnectors.push_back(this->connectors[i]);
-      }
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-void Block3D::pushBackLocalInterpolationConnectorsFC( std::vector<SPtr<Block3DConnector>>& localInterpolationConnectors )
-{
-   for(int i=0; i<(int)connectors.size(); i++)
-   {
-      SPtr<Block3DConnector> connector = this->connectors[i];
-      if( this->connectors[i] )
-      {
-         if( connector->isLocalConnector() && connector->isInterpolationConnectorFC() )
-            localInterpolationConnectors.push_back(this->connectors[i]);
-      }
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-void Block3D::pushBackRemoteInterpolationConnectorsFC( std::vector<SPtr<Block3DConnector>>& remoteInterpolationConnectors )
-{
-   for(int i=0; i<(int)connectors.size(); i++)
-   {
-      SPtr<Block3DConnector> connector = this->connectors[i];
-      if( this->connectors[i] )
-      {
-         if( connector->isRemoteConnector() && connector->isInterpolationConnectorFC() )
-            remoteInterpolationConnectors.push_back(this->connectors[i]);
-      }
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-int Block3D::getNumberOfLocalConnectors()
-{
-   int count = 0;
-   for(int i=0; i<(int)connectors.size(); i++)
-   {
-      SPtr<Block3DConnector> connector = this->connectors[i];
-      if( this->connectors[i] )
-      {
-         if( connector->isLocalConnector() ) count++;
-      }
-   }
-   return count;
-}
-//////////////////////////////////////////////////////////////////////////
-int Block3D::getNumberOfRemoteConnectors()
-{
-   int count = 0;
-   for(int i=0; i<(int)connectors.size(); i++)
-   {
-      SPtr<Block3DConnector> connector = this->connectors[i];
-      if( this->connectors[i] )
-      {
-         if( connector->isRemoteConnector() ) count++;
-      }
-   }
-   return count;
-}
-//////////////////////////////////////////////////////////////////////////
-int Block3D::getNumberOfLocalConnectorsForSurfaces()
-{
-   int count = 0;
-   
-   if(connectors.size() < 6)
-      return count;
-
-   for(int dir=0; dir<=5; dir++) //Hard coding. It works if you have 0...5 for E, N ... B 
-   {
-      SPtr<Block3DConnector> connector = this->connectors[dir];
-      if( this->connectors[dir] )
-      {
-         if( connector->isLocalConnector() ) count++;
-      }
-   }
-   return count;
-}
-//////////////////////////////////////////////////////////////////////////
-int Block3D::getNumberOfRemoteConnectorsForSurfaces()
-{
-   int count = 0;
-   for(int dir=0; dir<=5; dir++) //Hard coding. It works if you have 0...5 for E, N ... B 
-   {
-      SPtr<Block3DConnector> connector = this->connectors[dir];
-      if( this->connectors[dir] )
-      {
-         if( connector->isRemoteConnector() ) count++;
-      }
-   }
-   return count;
-}
-void Block3D::setCollectionOfInterpolationFlagCF(int flags)
-{
-   interpolationFlagCF = flags;
-}
-//////////////////////////////////////////////////////////////////////////
-void Block3D::setInterpolationFlagCF(int dir)
-{
-   UbSystem::setBit(interpolationFlagCF, 1<<dir);
-}
-//////////////////////////////////////////////////////////////////////////
-int Block3D::getCollectionOfInterpolationFlagCF()
-{
-   return interpolationFlagCF;
-}
-//////////////////////////////////////////////////////////////////////////
-bool Block3D::hasInterpolationFlagCF(int dir)
-{
-   return UbSystem::bitCheck( interpolationFlagCF, 1<<dir );
-}
-void Block3D::setCollectionOfInterpolationFlagFC(int flags)
-{
-   interpolationFlagFC = flags;
-}
-//////////////////////////////////////////////////////////////////////////
-void Block3D::setInterpolationFlagFC(int dir)
-{
-   UbSystem::setBit(interpolationFlagFC, 1<<dir);
-}
-//////////////////////////////////////////////////////////////////////////
-int Block3D::getCollectionOfInterpolationFlagFC()
-{
-   return interpolationFlagFC;
-}
-//////////////////////////////////////////////////////////////////////////
-bool Block3D::hasInterpolationFlagFC(int dir)
-{
-   return UbSystem::bitCheck( interpolationFlagFC, 1<<dir );
-}
-//////////////////////////////////////////////////////////////////////////
-bool Block3D::hasInterpolationFlag()
-{ 
-   return(interpolationFlagCF!=0 || interpolationFlagFC!=0); 
-}
-//////////////////////////////////////////////////////////////////////////
-bool Block3D::hasInterpolationFlag(int direction)     
-{ 
-   return(hasInterpolationFlagCF(direction) || hasInterpolationFlagFC(direction)); 
-}
-//////////////////////////////////////////////////////////////////////////
-bool Block3D::hasInterpolationFlagCF()
-{
-   return(interpolationFlagCF!=0);
-}
-//////////////////////////////////////////////////////////////////////////
-bool Block3D::hasInterpolationFlagFC()
-{
-   return(interpolationFlagFC!=0);
-}
-//////////////////////////////////////////////////////////////////////////
-void Block3D::deleteInterpolationFlag()
-{
-   interpolationFlagFC = 0;
-   interpolationFlagCF = 0;
-}
-//////////////////////////////////////////////////////////////////////////
-double Block3D::getWorkLoad()
-{
-   double l = kernel->getCalculationTime();
-   l *= static_cast<double>(1<<level);
-   return l;
-}
-//////////////////////////////////////////////////////////////////////////
-std::string Block3D::toString() 
-{
-   std::stringstream ss;
-   ss<<"Block3D[(x1,x2,x3,level),";
-   ss<<" ("<<this->x1<<", "<<this->x2<<", "<<this->x3<<", "<<this->level<<"), id=" << globalID; 
-   ss<< ", active="<<this->active<< ", bundle="<<this->bundle<< ", rank="<<this->rank<<"]";
-   ss<<" connectors:";
-   for(std::size_t i=0; i<connectors.size(); i++)
-      if( connectors[i] )
-      {
-         if(connectors[i]->isLocalConnector())
-            ss <<"l."<< Grid3DSystem::getDirectionString(connectors[i]->getSendDir()) << ", ";
-         if(connectors[i]->isRemoteConnector())
-            ss <<"r."<< Grid3DSystem::getDirectionString(connectors[i]->getSendDir()) << ", ";
-         if(connectors[i]->isInterpolationConnectorCF())
-            ss <<"cf."<< Grid3DSystem::getDirectionString(connectors[i]->getSendDir()) << ", ";
-         if(connectors[i]->isInterpolationConnectorFC())
-            ss <<"fc."<< Grid3DSystem::getDirectionString(connectors[i]->getSendDir()) << ", ";
-      }
-   return ss.str();
-}
-//////////////////////////////////////////////////////////////////////////
-void Block3D::setWeight( int rank, int weight )
-{
-   std::map<int, int>::iterator it;
-   if((it = this->weight.find(rank)) != this->weight.end())
-       it->second = weight;
-   else
-      this->weight.insert(std::make_pair(rank, weight));
-}
-//////////////////////////////////////////////////////////////////////////
-int Block3D::getWeight( int rank )
-{
-   std::map<int, int>::iterator it;
-   if((it = this->weight.find(rank)) != this->weight.end())
-      return it->second;
-   else
-      return 0;
-}
-//////////////////////////////////////////////////////////////////////////
-void Block3D::addWeight( int rank, int weight )
-{
-   int weight_old = getWeight(rank);
-   weight += weight_old;
-   setWeight(rank, weight);
-}
-//////////////////////////////////////////////////////////////////////////
-void Block3D::addWeightForAll( int weight )
-{
-   typedef std::map<int, int> wMap;
-   for (wMap::value_type &w : this->weight)
-   {
-      w.second += weight;
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-void Block3D::clearWeight()
-{
-   this->weight.clear();
-}
-//////////////////////////////////////////////////////////////////////////
-int Block3D::getWeightSize()
-{
-   return static_cast<int>(this->weight.size());
-}
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 Block3D.cpp
+//! \ingroup Grid
+//! \author Konstantin Kutscher
+//=======================================================================================
+
+#include "Block3D.h"
+
+#include "Grid3DSystem.h"
+#include "Block3DConnector.h"
+#include "LBMKernel.h"
+
+
+int Block3D::counter = 0;
+//////////////////////////////////////////////////////////////////////////
+Block3D::Block3D() : x1(0),x2(0),x3(0)
+                     ,active(true)
+                     ,globalID(-1)
+                     ,rank(-1),part(-1)
+                     ,interpolationFlagCF(0)
+                     ,interpolationFlagFC(0)
+                     ,level(-1)
+                     ,bundle(-1)
+                     ,lrank(-1)
+                     ,localID(-1)
+{
+}
+//////////////////////////////////////////////////////////////////////////
+Block3D::Block3D(int x1, int x2, int x3, int level)
+               : x1(x1), x2(x2), x3(x3)
+               ,active(true)
+               ,globalID(-1)
+               ,rank(0),part(0)
+               ,interpolationFlagCF(0)
+               ,interpolationFlagFC(0)
+               ,level(level)
+               ,bundle(0)
+               ,lrank(-1)
+               ,localID(-1)
+{
+   globalID = counter++;
+}
+//////////////////////////////////////////////////////////////////////////
+Block3D::~Block3D()
+{
+}
+//////////////////////////////////////////////////////////////////////////
+bool Block3D::operator==(const Block3D& src) const
+{
+   return (x1==src.x1 && x2==src.x2 && x3==src.x3); 
+}
+//////////////////////////////////////////////////////////////////////////
+bool Block3D::operator!=(const Block3D& src) const
+{
+   return !(*this==src);
+}
+//////////////////////////////////////////////////////////////////////////
+int Block3D::getX1() const 
+{ 
+   return this->x1; 
+}
+//////////////////////////////////////////////////////////////////////////
+int Block3D::getX2() const 
+{ 
+   return this->x2; 
+}
+//////////////////////////////////////////////////////////////////////////
+int Block3D::getX3() const 
+{ 
+   return this->x3; 
+}
+//////////////////////////////////////////////////////////////////////////
+void Block3D::setActive(bool active) 
+{ 
+   this->active = active; 
+}
+//////////////////////////////////////////////////////////////////////////
+bool Block3D::isActive()    const           
+{ 
+   return this->active;   
+}
+//////////////////////////////////////////////////////////////////////////
+bool Block3D::isNotActive() const           
+{ 
+   return(!this->active); 
+}
+//////////////////////////////////////////////////////////////////////////
+void  Block3D::setKernel(SPtr<LBMKernel> kernel) 
+{  
+   this->kernel = kernel; 
+}
+//////////////////////////////////////////////////////////////////////////
+SPtr<ILBMKernel> Block3D::getKernel() const              
+{  
+   return this->kernel; 
+}
+//////////////////////////////////////////////////////////////////////////
+void Block3D::deleteKernel()             
+{  
+   this->kernel = SPtr<LBMKernel>(); 
+}
+//////////////////////////////////////////////////////////////////////////
+int  Block3D::getBundle() const          
+{ 
+   return bundle;       
+}
+//////////////////////////////////////////////////////////////////////////
+void Block3D::setBundle(int bundle) 
+{ 
+   this->bundle = bundle; 
+} 
+//////////////////////////////////////////////////////////////////////////
+void  Block3D::setRank(int rank) 
+{  
+   this->rank = rank; 
+}
+//////////////////////////////////////////////////////////////////////////
+int Block3D::getRank() const            
+{  
+   return this->rank; 
+}
+//////////////////////////////////////////////////////////////////////////
+void  Block3D::setLocalRank(int rank) 
+{  
+   this->lrank = rank; 
+}
+//////////////////////////////////////////////////////////////////////////
+int Block3D::getLocalRank() const            
+{  
+   return this->lrank; 
+}
+//////////////////////////////////////////////////////////////////////////
+int  Block3D::getGlobalID() const        
+{ 
+   return this->globalID; 
+}
+//////////////////////////////////////////////////////////////////////////
+void Block3D::setGlobalID(int id) 
+{ 
+   this->globalID = id; 
+}
+//////////////////////////////////////////////////////////////////////////
+int  Block3D::getLocalID() const        
+{ 
+   return this->localID; 
+}
+//////////////////////////////////////////////////////////////////////////
+void Block3D::setLocalID(int id) 
+{ 
+   this->localID = id; 
+}
+//////////////////////////////////////////////////////////////////////////
+int  Block3D::getPart() const        
+{ 
+   return this->part; 
+}
+//////////////////////////////////////////////////////////////////////////
+void Block3D::setPart(int part) 
+{ 
+   this->part = part; 
+}
+//////////////////////////////////////////////////////////////////////////
+int  Block3D::getLevel() const        
+{ 
+   return this->level; 
+}
+//////////////////////////////////////////////////////////////////////////
+void Block3D::setLevel(int level) 
+{ 
+   this->level = level; 
+}
+//////////////////////////////////////////////////////////////////////////
+SPtr<Block3DConnector> Block3D::getConnector(int dir) const
+{ 
+   for(SPtr<Block3DConnector> c : connectors)
+   {
+      if( c ) 
+      {
+            if(c->getSendDir() == dir) return c;
+      }
+   }
+  return SPtr<Block3DConnector>();     
+}
+//////////////////////////////////////////////////////////////////////////
+void Block3D::setConnector(SPtr<Block3DConnector> connector)
+{
+   connectors.push_back(connector);
+}
+//////////////////////////////////////////////////////////////////////////
+void Block3D::deleteConnectors()
+{
+   connectors.clear();
+}
+//////////////////////////////////////////////////////////////////////////
+bool Block3D::hasConnectors()
+{
+   for(SPtr<Block3DConnector> c : connectors)
+      if( c ) return true;
+   
+   return false;
+}
+//////////////////////////////////////////////////////////////////////////
+void Block3D::pushBackSameLevelConnectors(  std::vector<SPtr<Block3DConnector>>& localSameLevelConnectors
+                                            , std::vector<SPtr<Block3DConnector>>& remoteSameLevelConnectors )
+{
+   for(int i=0; i<(int)connectors.size(); i++)
+   {
+      SPtr<Block3DConnector> connector = this->connectors[i];
+      if( this->connectors[i] )
+      {
+         if( connector->isLocalConnector() && !connector->isInterpolationConnectorCF() && !connector->isInterpolationConnectorFC() ) 
+            localSameLevelConnectors.push_back(this->connectors[i]);
+         else                                
+            remoteSameLevelConnectors.push_back(this->connectors[i]);
+      }
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+void Block3D::pushBackLocalSameLevelConnectors( std::vector<SPtr<Block3DConnector>>& localSameLevelConnectors )
+{
+   for(int i=0; i<(int)connectors.size(); i++)
+   {
+      SPtr<Block3DConnector> connector = this->connectors[i];
+      if( this->connectors[i] )
+      {
+         if( connector->isLocalConnector() && !connector->isInterpolationConnectorCF() && !connector->isInterpolationConnectorFC() ) 
+            localSameLevelConnectors.push_back(this->connectors[i]);
+      }
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+void Block3D::pushBackLocalSameLevelConnectors( std::vector<SPtr<Block3DConnector>>& localSameLevelConnectors, const int& dir)
+{
+   SPtr<Block3DConnector> connector = this->connectors[dir];
+   if( this->connectors[dir] )
+   {
+      if( connector->isLocalConnector() && !connector->isInterpolationConnectorCF() && !connector->isInterpolationConnectorFC() ) 
+         localSameLevelConnectors.push_back(this->connectors[dir]);
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+void Block3D::pushBackRemoteSameLevelConnectors( std::vector<SPtr<Block3DConnector>>& remoteSameLevelConnectors )
+{
+   for(int i=0; i<(int)connectors.size(); i++)
+   {
+      SPtr<Block3DConnector> connector = this->connectors[i];
+      if( this->connectors[i] )
+      {
+         if( connector->isRemoteConnector() && !connector->isInterpolationConnectorCF() && !connector->isInterpolationConnectorFC() ) 
+            remoteSameLevelConnectors.push_back(this->connectors[i]);
+      }
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+void Block3D::pushBackRemoteSameLevelConnectors( std::vector<SPtr<Block3DConnector>>& remoteSameLevelConnectors, const int& dir )
+{
+   SPtr<Block3DConnector> connector = this->connectors[dir];
+   if( this->connectors[dir] )
+   {
+      if( connector->isRemoteConnector() && !connector->isInterpolationConnectorCF() && !connector->isInterpolationConnectorFC() ) 
+         remoteSameLevelConnectors.push_back(this->connectors[dir]);
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+void Block3D::pushBackLocalInterpolationConnectorsCF( std::vector<SPtr<Block3DConnector>>& localInterpolationConnectors )
+{
+   for(int i=0; i<(int)connectors.size(); i++)
+   {
+      SPtr<Block3DConnector> connector = this->connectors[i];
+      if( this->connectors[i] )
+      {
+         if( connector->isLocalConnector() && connector->isInterpolationConnectorCF() )
+            localInterpolationConnectors.push_back(this->connectors[i]);
+      }
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+void Block3D::pushBackRemoteInterpolationConnectorsCF( std::vector<SPtr<Block3DConnector>>& remoteInterpolationConnectors )
+{
+   for(int i=0; i<(int)connectors.size(); i++)
+   {
+      SPtr<Block3DConnector> connector = this->connectors[i];
+      if( this->connectors[i] )
+      {
+         if( connector->isRemoteConnector() && connector->isInterpolationConnectorCF() )
+            remoteInterpolationConnectors.push_back(this->connectors[i]);
+      }
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+void Block3D::pushBackLocalInterpolationConnectorsFC( std::vector<SPtr<Block3DConnector>>& localInterpolationConnectors )
+{
+   for(int i=0; i<(int)connectors.size(); i++)
+   {
+      SPtr<Block3DConnector> connector = this->connectors[i];
+      if( this->connectors[i] )
+      {
+         if( connector->isLocalConnector() && connector->isInterpolationConnectorFC() )
+            localInterpolationConnectors.push_back(this->connectors[i]);
+      }
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+void Block3D::pushBackRemoteInterpolationConnectorsFC( std::vector<SPtr<Block3DConnector>>& remoteInterpolationConnectors )
+{
+   for(int i=0; i<(int)connectors.size(); i++)
+   {
+      SPtr<Block3DConnector> connector = this->connectors[i];
+      if( this->connectors[i] )
+      {
+         if( connector->isRemoteConnector() && connector->isInterpolationConnectorFC() )
+            remoteInterpolationConnectors.push_back(this->connectors[i]);
+      }
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+int Block3D::getNumberOfLocalConnectors()
+{
+   int count = 0;
+   for(int i=0; i<(int)connectors.size(); i++)
+   {
+      SPtr<Block3DConnector> connector = this->connectors[i];
+      if( this->connectors[i] )
+      {
+         if( connector->isLocalConnector() ) count++;
+      }
+   }
+   return count;
+}
+//////////////////////////////////////////////////////////////////////////
+int Block3D::getNumberOfRemoteConnectors()
+{
+   int count = 0;
+   for(int i=0; i<(int)connectors.size(); i++)
+   {
+      SPtr<Block3DConnector> connector = this->connectors[i];
+      if( this->connectors[i] )
+      {
+         if( connector->isRemoteConnector() ) count++;
+      }
+   }
+   return count;
+}
+//////////////////////////////////////////////////////////////////////////
+int Block3D::getNumberOfLocalConnectorsForSurfaces()
+{
+   int count = 0;
+   
+   if(connectors.size() < 6)
+      return count;
+
+   for(int dir=0; dir<=5; dir++) //Hard coding. It works if you have 0...5 for E, N ... B 
+   {
+      SPtr<Block3DConnector> connector = this->connectors[dir];
+      if( this->connectors[dir] )
+      {
+         if( connector->isLocalConnector() ) count++;
+      }
+   }
+   return count;
+}
+//////////////////////////////////////////////////////////////////////////
+int Block3D::getNumberOfRemoteConnectorsForSurfaces()
+{
+   int count = 0;
+   for(int dir=0; dir<=5; dir++) //Hard coding. It works if you have 0...5 for E, N ... B 
+   {
+      SPtr<Block3DConnector> connector = this->connectors[dir];
+      if( this->connectors[dir] )
+      {
+         if( connector->isRemoteConnector() ) count++;
+      }
+   }
+   return count;
+}
+void Block3D::setCollectionOfInterpolationFlagCF(int flags)
+{
+   interpolationFlagCF = flags;
+}
+//////////////////////////////////////////////////////////////////////////
+void Block3D::setInterpolationFlagCF(int dir)
+{
+   UbSystem::setBit(interpolationFlagCF, 1<<dir);
+}
+//////////////////////////////////////////////////////////////////////////
+int Block3D::getCollectionOfInterpolationFlagCF()
+{
+   return interpolationFlagCF;
+}
+//////////////////////////////////////////////////////////////////////////
+bool Block3D::hasInterpolationFlagCF(int dir)
+{
+   return UbSystem::bitCheck( interpolationFlagCF, 1<<dir );
+}
+void Block3D::setCollectionOfInterpolationFlagFC(int flags)
+{
+   interpolationFlagFC = flags;
+}
+//////////////////////////////////////////////////////////////////////////
+void Block3D::setInterpolationFlagFC(int dir)
+{
+   UbSystem::setBit(interpolationFlagFC, 1<<dir);
+}
+//////////////////////////////////////////////////////////////////////////
+int Block3D::getCollectionOfInterpolationFlagFC()
+{
+   return interpolationFlagFC;
+}
+//////////////////////////////////////////////////////////////////////////
+bool Block3D::hasInterpolationFlagFC(int dir)
+{
+   return UbSystem::bitCheck( interpolationFlagFC, 1<<dir );
+}
+//////////////////////////////////////////////////////////////////////////
+bool Block3D::hasInterpolationFlag()
+{ 
+   return(interpolationFlagCF!=0 || interpolationFlagFC!=0); 
+}
+//////////////////////////////////////////////////////////////////////////
+bool Block3D::hasInterpolationFlag(int direction)     
+{ 
+   return(hasInterpolationFlagCF(direction) || hasInterpolationFlagFC(direction)); 
+}
+//////////////////////////////////////////////////////////////////////////
+bool Block3D::hasInterpolationFlagCF()
+{
+   return(interpolationFlagCF!=0);
+}
+//////////////////////////////////////////////////////////////////////////
+bool Block3D::hasInterpolationFlagFC()
+{
+   return(interpolationFlagFC!=0);
+}
+//////////////////////////////////////////////////////////////////////////
+void Block3D::deleteInterpolationFlag()
+{
+   interpolationFlagFC = 0;
+   interpolationFlagCF = 0;
+}
+//////////////////////////////////////////////////////////////////////////
+double Block3D::getWorkLoad()
+{
+   double l = kernel->getCalculationTime();
+   l *= static_cast<double>(1<<level);
+   return l;
+}
+//////////////////////////////////////////////////////////////////////////
+std::string Block3D::toString() 
+{
+   std::stringstream ss;
+   ss<<"Block3D[(x1,x2,x3,level),";
+   ss<<" ("<<this->x1<<", "<<this->x2<<", "<<this->x3<<", "<<this->level<<"), id=" << globalID; 
+   ss<< ", active="<<this->active<< ", bundle="<<this->bundle<< ", rank="<<this->rank<<"]";
+   ss<<" connectors:";
+   for(std::size_t i=0; i<connectors.size(); i++)
+      if( connectors[i] )
+      {
+         if(connectors[i]->isLocalConnector())
+            ss <<"l."<< Grid3DSystem::getDirectionString(connectors[i]->getSendDir()) << ", ";
+         if(connectors[i]->isRemoteConnector())
+            ss <<"r."<< Grid3DSystem::getDirectionString(connectors[i]->getSendDir()) << ", ";
+         if(connectors[i]->isInterpolationConnectorCF())
+            ss <<"cf."<< Grid3DSystem::getDirectionString(connectors[i]->getSendDir()) << ", ";
+         if(connectors[i]->isInterpolationConnectorFC())
+            ss <<"fc."<< Grid3DSystem::getDirectionString(connectors[i]->getSendDir()) << ", ";
+      }
+   return ss.str();
+}
+//////////////////////////////////////////////////////////////////////////
+void Block3D::setWeight( int rank, int weight )
+{
+   std::map<int, int>::iterator it;
+   if((it = this->weight.find(rank)) != this->weight.end())
+       it->second = weight;
+   else
+      this->weight.insert(std::make_pair(rank, weight));
+}
+//////////////////////////////////////////////////////////////////////////
+int Block3D::getWeight( int rank )
+{
+   std::map<int, int>::iterator it;
+   if((it = this->weight.find(rank)) != this->weight.end())
+      return it->second;
+   else
+      return 0;
+}
+//////////////////////////////////////////////////////////////////////////
+void Block3D::addWeight( int rank, int weight )
+{
+   int weight_old = getWeight(rank);
+   weight += weight_old;
+   setWeight(rank, weight);
+}
+//////////////////////////////////////////////////////////////////////////
+void Block3D::addWeightForAll( int weight )
+{
+   typedef std::map<int, int> wMap;
+   for (wMap::value_type &w : this->weight)
+   {
+      w.second += weight;
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+void Block3D::clearWeight()
+{
+   this->weight.clear();
+}
+//////////////////////////////////////////////////////////////////////////
+int Block3D::getWeightSize()
+{
+   return static_cast<int>(this->weight.size());
+}
diff --git a/src/cpu/VirtualFluidsCore/Grid/Grid3DSystem.cpp b/src/cpu/VirtualFluidsCore/Grid/Grid3DSystem.cpp
index 0eb9f995ee11492ac3eb4edacdb37c56564b255c..b3c711a73b5f99a922a04e05e95289cd83d5ba5f 100644
--- a/src/cpu/VirtualFluidsCore/Grid/Grid3DSystem.cpp
+++ b/src/cpu/VirtualFluidsCore/Grid/Grid3DSystem.cpp
@@ -1,81 +1,81 @@
-//=======================================================================================
-// ____          ____    __    ______     __________   __      __       __        __         
-// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
-//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
-//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
-//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
-//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
-//      \    \  |    |   ________________________________________________________________    
-//       \    \ |    |  |  ______________________________________________________________|   
-//        \    \|    |  |  |         __          __     __     __     ______      _______    
-//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
-//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
-//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
-//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
-//
-//  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 Grid3DSystem.cpp
-//! \ingroup Grid
-//! \author Konstantin Kutscher
-//=======================================================================================
-
-#include <Grid3DSystem.h>
-
-namespace Grid3DSystem
-{
-   const int INVDIR[] = { INV_E  ,   
-                          INV_W  ,  
-                          INV_N  ,  
-                          INV_S  ,  
-                          INV_T  ,  
-                          INV_B  ,  
-                          INV_NE , 
-                          INV_NW , 
-                          INV_SE , 
-                          INV_SW ,
-                          INV_TE , 
-                          INV_TW , 
-                          INV_BE , 
-                          INV_BW , 
-                          INV_TN , 
-                          INV_TS , 
-                          INV_BN , 
-                          INV_BS , 
-                          INV_TNE,
-                          INV_TNW,
-                          INV_TSE,
-                          INV_TSW,
-                          INV_BNE,
-                          INV_BNW,
-                          INV_BSE,
-                          INV_BSW    };
-
-   //index             0   1   2   3   4   5  6   7   8    9  10  11  12  13  14  15  16  17  18
-   //direction:        E,  W,  N,  S,  T,  B, NE, SW, SE, NW, TE, BW, BE, TW, TN, BS, BN, TS, TNE TNW TSE TSW BNE BNW BSE BSW
-   const int EX1[] = { 1, -1, 0, 0, 0, 0, 1, -1, 1, -1, 1, -1, 1, -1, 0, 0, 0, 0, 1, -1, 1, -1, 1, -1, 1, -1 };
-   const int EX2[] = { 0, 0, 1, -1, 0, 0, 1, -1, -1, 1, 0, 0, 0, 0, 1, -1, 1, -1, 1, 1, -1, -1, 1, 1, -1, -1 };
-   const int EX3[] = { 0, 0, 0, 0, 1, -1, 0, 0, 0, 0, 1, -1, -1, 1, 1, -1, -1, 1, 1, 1, 1, 1, -1, -1, -1, -1 };
-}
-
-//////////////////////////////////////////////////////////////////////////
-const int& Grid3DSystem::getInvertDirection(const int& direction)
-{  
-#ifdef _DEBUG
-   if(direction<STARTDIR || direction>ENDDIR) 
-      throw UbException(UB_EXARGS,"unknown direction");
-#endif
-   return INVDIR[direction];
-}
-
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 Grid3DSystem.cpp
+//! \ingroup Grid
+//! \author Konstantin Kutscher
+//=======================================================================================
+
+#include <Grid3DSystem.h>
+
+namespace Grid3DSystem
+{
+   const int INVDIR[] = { INV_E  ,   
+                          INV_W  ,  
+                          INV_N  ,  
+                          INV_S  ,  
+                          INV_T  ,  
+                          INV_B  ,  
+                          INV_NE , 
+                          INV_NW , 
+                          INV_SE , 
+                          INV_SW ,
+                          INV_TE , 
+                          INV_TW , 
+                          INV_BE , 
+                          INV_BW , 
+                          INV_TN , 
+                          INV_TS , 
+                          INV_BN , 
+                          INV_BS , 
+                          INV_TNE,
+                          INV_TNW,
+                          INV_TSE,
+                          INV_TSW,
+                          INV_BNE,
+                          INV_BNW,
+                          INV_BSE,
+                          INV_BSW    };
+
+   //index             0   1   2   3   4   5  6   7   8    9  10  11  12  13  14  15  16  17  18
+   //direction:        E,  W,  N,  S,  T,  B, NE, SW, SE, NW, TE, BW, BE, TW, TN, BS, BN, TS, TNE TNW TSE TSW BNE BNW BSE BSW
+   const int EX1[] = { 1, -1, 0, 0, 0, 0, 1, -1, 1, -1, 1, -1, 1, -1, 0, 0, 0, 0, 1, -1, 1, -1, 1, -1, 1, -1 };
+   const int EX2[] = { 0, 0, 1, -1, 0, 0, 1, -1, -1, 1, 0, 0, 0, 0, 1, -1, 1, -1, 1, 1, -1, -1, 1, 1, -1, -1 };
+   const int EX3[] = { 0, 0, 0, 0, 1, -1, 0, 0, 0, 0, 1, -1, -1, 1, 1, -1, -1, 1, 1, 1, 1, 1, -1, -1, -1, -1 };
+}
+
+//////////////////////////////////////////////////////////////////////////
+const int& Grid3DSystem::getInvertDirection(const int& direction)
+{  
+#ifdef _DEBUG
+   if(direction<STARTDIR || direction>ENDDIR) 
+      throw UbException(UB_EXARGS,"unknown direction");
+#endif
+   return INVDIR[direction];
+}
+
diff --git a/src/cpu/VirtualFluidsCore/Grid/Grid3DSystem.h b/src/cpu/VirtualFluidsCore/Grid/Grid3DSystem.h
index 5eb883d0edeb8933599117f2f6bad017e6ddb56a..02dab4ff1dcaf721dd759f89520e1c1251bf3289 100644
--- a/src/cpu/VirtualFluidsCore/Grid/Grid3DSystem.h
+++ b/src/cpu/VirtualFluidsCore/Grid/Grid3DSystem.h
@@ -1,186 +1,186 @@
-//=======================================================================================
-// ____          ____    __    ______     __________   __      __       __        __         
-// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
-//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
-//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
-//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
-//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
-//      \    \  |    |   ________________________________________________________________    
-//       \    \ |    |  |  ______________________________________________________________|   
-//        \    \|    |  |  |         __          __     __     __     ______      _______    
-//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
-//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
-//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
-//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
-//
-//  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 Grid3DSystem.h
-//! \ingroup Grid
-//! \author Konstantin Kutscher
-//=======================================================================================
-
-#ifndef Grid3DSystem_H
-#define Grid3DSystem_H
-
-#include <cmath>
-#include <iostream>
-#include <string>
-
-#include <basics/utilities/UbMath.h>
-#include <basics/utilities/UbException.h>
-
-
-namespace Grid3DSystem
-{
-   static const int STARTDIR = 0;
-
-   static const int E    /*f1 */ = 0;
-   static const int W    /*f2 */ = 1;
-   static const int N    /*f3 */ = 2;
-   static const int S    /*f4 */ = 3;
-   static const int T    /*f5 */ = 4;
-   static const int B    /*f6 */ = 5;
-   static const int NE   /*f7 */ = 6;
-   static const int SW   /*f8 */ = 7;
-   static const int SE   /*f9 */ = 8;
-   static const int NW   /*f10*/ = 9;
-   static const int TE   /*f11*/ = 10;
-   static const int BW   /*f12*/ = 11;
-   static const int BE   /*f13*/ = 12;
-   static const int TW   /*f14*/ = 13;
-   static const int TN   /*f15*/ = 14;
-   static const int BS   /*f16*/ = 15;
-   static const int BN   /*f17*/ = 16;
-   static const int TS   /*f18*/ = 17;
-   static const int TNE          = 18;
-   static const int TNW          = 19;
-   static const int TSE          = 20;
-   static const int TSW          = 21;
-   static const int BNE          = 22;
-   static const int BNW          = 23;
-   static const int BSE          = 24;
-   static const int BSW          = 25;
-   static const int ZERO /*f0 */ = 26;
-
-   static const int ENDDIR = 25; 
-
-   static const int INV_E   = W;  
-   static const int INV_W   = E;  
-   static const int INV_N   = S;  
-   static const int INV_S   = N;  
-   static const int INV_T   = B;  
-   static const int INV_B   = T;  
-   static const int INV_NE  = SW; 
-   static const int INV_NW  = SE; 
-   static const int INV_SE  = NW; 
-   static const int INV_SW  = NE; 
-   static const int INV_TE  = BW; 
-   static const int INV_TW  = BE; 
-   static const int INV_BE  = TW; 
-   static const int INV_BW  = TE; 
-   static const int INV_TN  = BS; 
-   static const int INV_TS  = BN; 
-   static const int INV_BN  = TS; 
-   static const int INV_BS  = TN; 
-   static const int INV_TNE = BSW;
-   static const int INV_TNW = BSE;
-   static const int INV_TSE = BNW;
-   static const int INV_TSW = BNE;
-   static const int INV_BNE = TSW;
-   static const int INV_BNW = TSE;
-   static const int INV_BSE = TNW;
-   static const int INV_BSW = TNE;
-
-   extern const int INVDIR[ENDDIR+1];
-
-   static const int MINLEVEL = 0;
-   static const int MAXLEVEL = 25;
-
-   extern const int EX1[ENDDIR+1];
-   extern const int EX2[ENDDIR+1];
-   extern const int EX3[ENDDIR+1];
-
-   inline std::string getDirectionString(int direction)
-   {
-      switch(direction)
-      {
-      case E   : return "E"; 
-      case W   : return "W"; 
-      case N   : return "N"; 
-      case S   : return "S"; 
-      case T   : return "T";
-      case B   : return "B"; 
-      case NE  : return "NE";
-      case NW  : return "NW";
-      case SE  : return "SE";
-      case SW  : return "SW";
-      case TE  : return "TE";
-      case TW  : return "TW";
-      case BE  : return "BE";
-      case BW  : return "BW";
-      case TN  : return "TN";
-      case TS  : return "TS";
-      case BN  : return "BN";
-      case BS  : return "BS";
-      case TNE : return "TNE";
-      case TNW : return "TNW";
-      case TSE : return "TSE";
-      case TSW : return "TSW";
-      case BNE : return "BNE";
-      case BNW : return "BNW";
-      case BSE : return "BSE";
-      case BSW : return "BSW";
-      default  : return "Cell3DSystem::getDrectionString(...) - unknown dir";
-      }
-   }
-   static const int&       getInvertDirection(const int& direction);
-
-//////////////////////////////////////////////////////////////////////////
-   static inline void setNeighborCoordinatesForDirection(int &x1, int &x2,int &x3, const int& direction)
-   {
-      switch(direction)
-      {
-      case Grid3DSystem::E  :  x1++;             break;
-      case Grid3DSystem::N  :  x2++;             break;
-      case Grid3DSystem::T  :  x3++;             break;
-      case Grid3DSystem::W  :  x1--;             break;
-      case Grid3DSystem::S  :  x2--;             break;
-      case Grid3DSystem::B  :  x3--;             break;
-      case Grid3DSystem::NE :  x1++; x2++;       break;
-      case Grid3DSystem::NW :  x1--; x2++;       break;
-      case Grid3DSystem::SW :  x1--; x2--;       break;
-      case Grid3DSystem::SE :  x1++; x2--;       break;
-      case Grid3DSystem::TE :  x1++; x3++;       break;
-      case Grid3DSystem::BW :  x1--; x3--;       break;
-      case Grid3DSystem::BE :  x1++; x3--;       break;
-      case Grid3DSystem::TW :  x1--; x3++;       break;
-      case Grid3DSystem::TN :  x2++; x3++;       break;
-      case Grid3DSystem::BS :  x2--; x3--;       break;
-      case Grid3DSystem::BN :  x2++; x3--;       break;
-      case Grid3DSystem::TS :  x2--; x3++;       break;
-      case Grid3DSystem::TNE:  x1++; x2++; x3++; break;
-      case Grid3DSystem::TNW:  x1--; x2++; x3++; break;
-      case Grid3DSystem::TSE:  x1++; x2--; x3++; break;
-      case Grid3DSystem::TSW:  x1--; x2--; x3++; break;
-      case Grid3DSystem::BNE:  x1++; x2++; x3--; break;
-      case Grid3DSystem::BNW:  x1--; x2++; x3--; break;
-      case Grid3DSystem::BSE:  x1++; x2--; x3--; break;
-      case Grid3DSystem::BSW:  x1--; x2--; x3--; break;
-      default: throw UbException(UB_EXARGS,"no direction ...");
-      }
-   }
-}
-
-#endif 
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 Grid3DSystem.h
+//! \ingroup Grid
+//! \author Konstantin Kutscher
+//=======================================================================================
+
+#ifndef Grid3DSystem_H
+#define Grid3DSystem_H
+
+#include <cmath>
+#include <iostream>
+#include <string>
+
+#include <basics/utilities/UbMath.h>
+#include <basics/utilities/UbException.h>
+
+
+namespace Grid3DSystem
+{
+   static const int STARTDIR = 0;
+
+   static const int E    /*f1 */ = 0;
+   static const int W    /*f2 */ = 1;
+   static const int N    /*f3 */ = 2;
+   static const int S    /*f4 */ = 3;
+   static const int T    /*f5 */ = 4;
+   static const int B    /*f6 */ = 5;
+   static const int NE   /*f7 */ = 6;
+   static const int SW   /*f8 */ = 7;
+   static const int SE   /*f9 */ = 8;
+   static const int NW   /*f10*/ = 9;
+   static const int TE   /*f11*/ = 10;
+   static const int BW   /*f12*/ = 11;
+   static const int BE   /*f13*/ = 12;
+   static const int TW   /*f14*/ = 13;
+   static const int TN   /*f15*/ = 14;
+   static const int BS   /*f16*/ = 15;
+   static const int BN   /*f17*/ = 16;
+   static const int TS   /*f18*/ = 17;
+   static const int TNE          = 18;
+   static const int TNW          = 19;
+   static const int TSE          = 20;
+   static const int TSW          = 21;
+   static const int BNE          = 22;
+   static const int BNW          = 23;
+   static const int BSE          = 24;
+   static const int BSW          = 25;
+   static const int ZERO /*f0 */ = 26;
+
+   static const int ENDDIR = 25; 
+
+   static const int INV_E   = W;  
+   static const int INV_W   = E;  
+   static const int INV_N   = S;  
+   static const int INV_S   = N;  
+   static const int INV_T   = B;  
+   static const int INV_B   = T;  
+   static const int INV_NE  = SW; 
+   static const int INV_NW  = SE; 
+   static const int INV_SE  = NW; 
+   static const int INV_SW  = NE; 
+   static const int INV_TE  = BW; 
+   static const int INV_TW  = BE; 
+   static const int INV_BE  = TW; 
+   static const int INV_BW  = TE; 
+   static const int INV_TN  = BS; 
+   static const int INV_TS  = BN; 
+   static const int INV_BN  = TS; 
+   static const int INV_BS  = TN; 
+   static const int INV_TNE = BSW;
+   static const int INV_TNW = BSE;
+   static const int INV_TSE = BNW;
+   static const int INV_TSW = BNE;
+   static const int INV_BNE = TSW;
+   static const int INV_BNW = TSE;
+   static const int INV_BSE = TNW;
+   static const int INV_BSW = TNE;
+
+   extern const int INVDIR[ENDDIR+1];
+
+   static const int MINLEVEL = 0;
+   static const int MAXLEVEL = 25;
+
+   extern const int EX1[ENDDIR+1];
+   extern const int EX2[ENDDIR+1];
+   extern const int EX3[ENDDIR+1];
+
+   inline std::string getDirectionString(int direction)
+   {
+      switch(direction)
+      {
+      case E   : return "E"; 
+      case W   : return "W"; 
+      case N   : return "N"; 
+      case S   : return "S"; 
+      case T   : return "T";
+      case B   : return "B"; 
+      case NE  : return "NE";
+      case NW  : return "NW";
+      case SE  : return "SE";
+      case SW  : return "SW";
+      case TE  : return "TE";
+      case TW  : return "TW";
+      case BE  : return "BE";
+      case BW  : return "BW";
+      case TN  : return "TN";
+      case TS  : return "TS";
+      case BN  : return "BN";
+      case BS  : return "BS";
+      case TNE : return "TNE";
+      case TNW : return "TNW";
+      case TSE : return "TSE";
+      case TSW : return "TSW";
+      case BNE : return "BNE";
+      case BNW : return "BNW";
+      case BSE : return "BSE";
+      case BSW : return "BSW";
+      default  : return "Cell3DSystem::getDrectionString(...) - unknown dir";
+      }
+   }
+   static const int&       getInvertDirection(const int& direction);
+
+//////////////////////////////////////////////////////////////////////////
+   static inline void setNeighborCoordinatesForDirection(int &x1, int &x2,int &x3, const int& direction)
+   {
+      switch(direction)
+      {
+      case Grid3DSystem::E  :  x1++;             break;
+      case Grid3DSystem::N  :  x2++;             break;
+      case Grid3DSystem::T  :  x3++;             break;
+      case Grid3DSystem::W  :  x1--;             break;
+      case Grid3DSystem::S  :  x2--;             break;
+      case Grid3DSystem::B  :  x3--;             break;
+      case Grid3DSystem::NE :  x1++; x2++;       break;
+      case Grid3DSystem::NW :  x1--; x2++;       break;
+      case Grid3DSystem::SW :  x1--; x2--;       break;
+      case Grid3DSystem::SE :  x1++; x2--;       break;
+      case Grid3DSystem::TE :  x1++; x3++;       break;
+      case Grid3DSystem::BW :  x1--; x3--;       break;
+      case Grid3DSystem::BE :  x1++; x3--;       break;
+      case Grid3DSystem::TW :  x1--; x3++;       break;
+      case Grid3DSystem::TN :  x2++; x3++;       break;
+      case Grid3DSystem::BS :  x2--; x3--;       break;
+      case Grid3DSystem::BN :  x2++; x3--;       break;
+      case Grid3DSystem::TS :  x2--; x3++;       break;
+      case Grid3DSystem::TNE:  x1++; x2++; x3++; break;
+      case Grid3DSystem::TNW:  x1--; x2++; x3++; break;
+      case Grid3DSystem::TSE:  x1++; x2--; x3++; break;
+      case Grid3DSystem::TSW:  x1--; x2--; x3++; break;
+      case Grid3DSystem::BNE:  x1++; x2++; x3--; break;
+      case Grid3DSystem::BNW:  x1--; x2++; x3--; break;
+      case Grid3DSystem::BSE:  x1++; x2--; x3--; break;
+      case Grid3DSystem::BSW:  x1--; x2--; x3--; break;
+      default: throw UbException(UB_EXARGS,"no direction ...");
+      }
+   }
+}
+
+#endif 
diff --git a/src/cpu/VirtualFluidsCore/Interactors/D3Q27Interactor.h b/src/cpu/VirtualFluidsCore/Interactors/D3Q27Interactor.h
index 0ea9aef353301bd7540e853ad083c55f7d29eca2..6ecb10f02c86af013d6102e5a698486084bb8e67 100644
--- a/src/cpu/VirtualFluidsCore/Interactors/D3Q27Interactor.h
+++ b/src/cpu/VirtualFluidsCore/Interactors/D3Q27Interactor.h
@@ -1,114 +1,114 @@
-//=======================================================================================
-// ____          ____    __    ______     __________   __      __       __        __         
-// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
-//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
-//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
-//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
-//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
-//      \    \  |    |   ________________________________________________________________    
-//       \    \ |    |  |  ______________________________________________________________|   
-//        \    \|    |  |  |         __          __     __     __     ______      _______    
-//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
-//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
-//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
-//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
-//
-//  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
-
-#include <string>
-#include <vector>
-#include <map>
-#include <set>
-#include <PointerDefinitions.h>
-
-#include "UbException.h"
-#include "UbTuple.h"
-#include "GbPoint3D.h"
-#include "Interactor3D.h"
-#include "D3Q27System.h"
-
-class BCAdapter;
-class Block3D;
-class Grid3D;
-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:
-   D3Q27Interactor();
-   D3Q27Interactor(SPtr<GbObject3D> geoObject3D, SPtr<Grid3D> grid, int type);
-   D3Q27Interactor(SPtr<GbObject3D> geoObject3D, SPtr<Grid3D> grid, SPtr<BCAdapter> bcAdapter,  int type);
-   D3Q27Interactor(SPtr<GbObject3D> geoObject3D, SPtr<Grid3D> grid, SPtr<BCAdapter> bcAdapter,  int type, Interactor3D::Accuracy a);
-
-   virtual ~D3Q27Interactor();
-
-   void setRelevantForForces(const bool& value) {  this->relevantForForces = value; }
-   bool isRelevantForForces() { return this->relevantForForces; }
-
-   virtual void addBCAdapter(const SPtr<BCAdapter> bcAdapter) { bcAdapters.push_back(bcAdapter); }
-   void deleteBCAdapter() { bcAdapters.clear(); }
-
- 
-   virtual void initInteractor(const double& timeStep=0);
-   void updateInteractor(const double& timestep=0); 
-
-   void setReinitWithStoredQs(bool reinitWithStoredQsFlag) { this->reinitWithStoredQsFlag = reinitWithStoredQsFlag; }
-   
-   void removeSolidBlocks() { Interactor3D::removeSolidBlocks(); solidNodeIndicesMap.clear(); }
-   void removeBcBlocks() { Interactor3D::removeBcBlocks(); bcNodeIndicesMap.clear(); }
-
-   bool setDifferencesToGbObject3D(const SPtr<Block3D> block);
-
-   ObObject* clone() { throw UbException(UB_EXARGS,"not implemented");	}
-
-   void writeValidationAVSFile(std::string filename);  
-   virtual std::vector< std::pair<GbPoint3D,GbPoint3D> >  getQsLineSet();
-
-   void addQsLineSet(std::vector<UbTupleFloat3 >& nodes, std::vector<UbTupleInt2 >& lines);
-
-   const BcNodeIndicesMap& getBcNodeIndicesMap() const { return bcNodeIndicesMap; }
-
-protected:
-   bool relevantForForces;
-   bool reinitWithStoredQsFlag;
-
-   std::vector<SPtr<BCAdapter> > bcAdapters;
-
-   SolidNodeIndicesMap solidNodeIndicesMap;
-   BcNodeIndicesMap bcNodeIndicesMap;
-   
-   void   initRayVectors();
-   double rayX1[D3Q27System::FENDDIR+1];
-   double rayX2[D3Q27System::FENDDIR+1];
-   double rayX3[D3Q27System::FENDDIR+1];
-
-};
-
-
-#endif
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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
+
+#include <string>
+#include <vector>
+#include <map>
+#include <set>
+#include <PointerDefinitions.h>
+
+#include "UbException.h"
+#include "UbTuple.h"
+#include "GbPoint3D.h"
+#include "Interactor3D.h"
+#include "D3Q27System.h"
+
+class BCAdapter;
+class Block3D;
+class Grid3D;
+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:
+   D3Q27Interactor();
+   D3Q27Interactor(SPtr<GbObject3D> geoObject3D, SPtr<Grid3D> grid, int type);
+   D3Q27Interactor(SPtr<GbObject3D> geoObject3D, SPtr<Grid3D> grid, SPtr<BCAdapter> bcAdapter,  int type);
+   D3Q27Interactor(SPtr<GbObject3D> geoObject3D, SPtr<Grid3D> grid, SPtr<BCAdapter> bcAdapter,  int type, Interactor3D::Accuracy a);
+
+   virtual ~D3Q27Interactor();
+
+   void setRelevantForForces(const bool& value) {  this->relevantForForces = value; }
+   bool isRelevantForForces() { return this->relevantForForces; }
+
+   virtual void addBCAdapter(const SPtr<BCAdapter> bcAdapter) { bcAdapters.push_back(bcAdapter); }
+   void deleteBCAdapter() { bcAdapters.clear(); }
+
+ 
+   virtual void initInteractor(const double& timeStep=0);
+   void updateInteractor(const double& timestep=0); 
+
+   void setReinitWithStoredQs(bool reinitWithStoredQsFlag) { this->reinitWithStoredQsFlag = reinitWithStoredQsFlag; }
+   
+   void removeSolidBlocks() { Interactor3D::removeSolidBlocks(); solidNodeIndicesMap.clear(); }
+   void removeBcBlocks() { Interactor3D::removeBcBlocks(); bcNodeIndicesMap.clear(); }
+
+   bool setDifferencesToGbObject3D(const SPtr<Block3D> block);
+
+   ObObject* clone() { throw UbException(UB_EXARGS,"not implemented");	}
+
+   void writeValidationAVSFile(std::string filename);  
+   virtual std::vector< std::pair<GbPoint3D,GbPoint3D> >  getQsLineSet();
+
+   void addQsLineSet(std::vector<UbTupleFloat3 >& nodes, std::vector<UbTupleInt2 >& lines);
+
+   const BcNodeIndicesMap& getBcNodeIndicesMap() const { return bcNodeIndicesMap; }
+
+protected:
+   bool relevantForForces;
+   bool reinitWithStoredQsFlag;
+
+   std::vector<SPtr<BCAdapter> > bcAdapters;
+
+   SolidNodeIndicesMap solidNodeIndicesMap;
+   BcNodeIndicesMap bcNodeIndicesMap;
+   
+   void   initRayVectors();
+   double rayX1[D3Q27System::FENDDIR+1];
+   double rayX2[D3Q27System::FENDDIR+1];
+   double rayX3[D3Q27System::FENDDIR+1];
+
+};
+
+
+#endif
diff --git a/src/cpu/VirtualFluidsCore/Interactors/D3Q27TriFaceMeshInteractor.h b/src/cpu/VirtualFluidsCore/Interactors/D3Q27TriFaceMeshInteractor.h
index c462b34cef388acc3eab1887791d6c26837cfac4..bd3f127200fcb9e265d4876d982ef92500b1d47b 100644
--- a/src/cpu/VirtualFluidsCore/Interactors/D3Q27TriFaceMeshInteractor.h
+++ b/src/cpu/VirtualFluidsCore/Interactors/D3Q27TriFaceMeshInteractor.h
@@ -1,105 +1,105 @@
-#ifndef D3Q19AMRTRIFACEMESHINTERACTOR_H
-#define D3Q19AMRTRIFACEMESHINTERACTOR_H
-
-#include <string>
-#include <vector>
-#include <map>
-#include <PointerDefinitions.h>
-
-#include "D3Q27Interactor.h"
-#include "CbArray3D.h"
-
-class GbObject3D;
-class Grid3D;
-class BCAdapter;
-class GbTriFaceMesh3D;
-class Block3D;
-
-class D3Q27TriFaceMeshInteractor : public D3Q27Interactor 
-{
-public:
-   static const int STRESSNORMAL=0;
-   static const int STRESSALTERNATIV=1;
-
-   D3Q27TriFaceMeshInteractor();
-   D3Q27TriFaceMeshInteractor(SPtr<Grid3D> grid, std::string name="D3Q27TriFaceMeshInteractor");
-   D3Q27TriFaceMeshInteractor(SPtr<GbObject3D> geoObject3D, SPtr<Grid3D> grid, int type);
-   D3Q27TriFaceMeshInteractor(SPtr<GbTriFaceMesh3D> triFaceMesh, SPtr<Grid3D> grid, SPtr<BCAdapter> bcAdapter, int type);
-   D3Q27TriFaceMeshInteractor(SPtr<GbTriFaceMesh3D> triFaceMesh, SPtr<Grid3D> grid, SPtr<BCAdapter> bcAdapter, int type, Interactor3D::Accuracy a);
-   //D3Q27TriFaceMeshInteractor(SPtr<GbTriFaceMesh3D> triFaceMesh, D3Q27BoundaryConditionAdapterPtr bcAdapter, int type, std::string name="D3Q27TriFaceMeshInteractor");
-
-   ~D3Q27TriFaceMeshInteractor();
-
-   virtual void initInteractor(const double& timeStep=0);
-   virtual void initInteractor2(const double& timeStep=0);
-
-   void updateInteractor(const double& timestep=0);
-
-   void updateMovedGeometry(const double& timeStep=0);
-   void setQs(const double& timeStep);
-   void refineBlockGridToLevel(int level, double startDistance, double stopDistance);
-
-   bool 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=0*/);
-
-   void setRegardPointInObjectTest( bool opt ) { this->regardPIOTest = opt; }
-
-   ObObject*        clone() { throw UbException(UB_EXARGS,"not implemented");	}
-
-   UbTupleDouble3 getForces();
-   UbTupleDouble3 getForcesTriangle();
-
-   void setStressMode(int stressMode)                      { this->stressMode = stressMode;                         }
-   void setUseHalfSpaceCheck(bool useHalfSpace )           { this->useHalfSpace = useHalfSpace;                     }
-   //void setReinitWithStoredQs(bool reinitWithStoredQsFlag) { this->reinitWithStoredQsFlag = reinitWithStoredQsFlag; }
-
-   void calculateForces();
-   void calculateStresses(); 
-   void calculateStressesAlternativ();            
-
-   void calcStressesLine(UbTupleDouble6& stresses, const double& weight, const UbTupleDouble6& stvW, const UbTupleDouble6& stvE );
-   void calcStressesFace(UbTupleDouble6& stresses, const double& weightX, const double& weightY, const UbTupleDouble6& stvSW, const UbTupleDouble6& stvSE, const UbTupleDouble6& stvNE, const UbTupleDouble6& stvNW );
-   void calcStressesCube(UbTupleDouble6& stresses, const double& weightX, const double& weightY, const double& weightZ, const UbTupleDouble6& stvBSW, const UbTupleDouble6& stvBSE, const UbTupleDouble6& stvBNE, const UbTupleDouble6& stvBNW, const UbTupleDouble6& stvTSW, const UbTupleDouble6& stvTSE, const UbTupleDouble6& stvTNE, const UbTupleDouble6& stvTNW  );
-
-   void calculatePressure(); 
-   void calcPressureLine(double &p, const double& weight, const double& pW, const double& pE );
-   void calcPressureFace(double &p, const double& weightX, const double& weightY, const double& pSW, const double& pSE, const double& pNE, const double& pNW );
-   void calcPressureCube(double &p, const double& weightX, const double& weightY, const double& weightZ, const double& pBSW, const double& pBSE, const double& pBNE, const double& pBNW, const double& pTSW, const double& pTSE, const double& pTNE, const double& pTNW  );
-
-   void   setForceShift(double forceshift)   { this->forceshift = forceshift; this->forceshiftpolicy = true; }
-   void   setVelocityShift(double velocityshift)   { this->velocityshift = velocityshift; this->velocityshiftpolicy = true; }
-   double getForceShift()     { return this->forceshift; }
-   double getVelocityShift()  { return this->velocityshift; }
-   bool   getForceShiftPolicy() { return forceshiftpolicy;}
-   bool   getVelocityShiftPolicy() { return velocityshiftpolicy;}
-
-   void clearBcNodeIndicesAndQsMap() { this->bcNodeIndicesAndQsMap.clear();}
-
-   virtual std::string toString();
-
-
-protected:
-   int    stressMode;
-
-   double forceshift;       
-   double velocityshift;
-   bool   forceshiftpolicy;
-   bool   velocityshiftpolicy;
-   bool   useHalfSpace;
-   bool   regardPIOTest;
-
-   void reinitWithStoredQs(const double& timeStep);
-   //   bool reinitWithStoredQsFlag;
-   std::map< SPtr<Block3D>, std::map < UbTupleInt3, std::vector< float > > > bcNodeIndicesAndQsMap;    //!!! 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!
-
-   enum SolidCheckMethod { ScanLine, PointInObject };
-
-   enum FLAGS { BC_FLAG, UNDEF_FLAG, FLUID_FLAG, SOLID_FLAG, OLDSOLID_FLAG };
-   void recursiveGridFill(CbArray3D<FLAGS>& flagfield, const short& xs, const short& ys, const short& zs, const FLAGS& type);
-   void iterativeGridFill(CbArray3D<FLAGS>& flagfield, const short& xs, const short& ys, const short& zs, const FLAGS& type); 
-};
-
-
-#endif 
+#ifndef D3Q19AMRTRIFACEMESHINTERACTOR_H
+#define D3Q19AMRTRIFACEMESHINTERACTOR_H
+
+#include <string>
+#include <vector>
+#include <map>
+#include <PointerDefinitions.h>
+
+#include "D3Q27Interactor.h"
+#include "CbArray3D.h"
+
+class GbObject3D;
+class Grid3D;
+class BCAdapter;
+class GbTriFaceMesh3D;
+class Block3D;
+
+class D3Q27TriFaceMeshInteractor : public D3Q27Interactor 
+{
+public:
+   static const int STRESSNORMAL=0;
+   static const int STRESSALTERNATIV=1;
+
+   D3Q27TriFaceMeshInteractor();
+   D3Q27TriFaceMeshInteractor(SPtr<Grid3D> grid, std::string name="D3Q27TriFaceMeshInteractor");
+   D3Q27TriFaceMeshInteractor(SPtr<GbObject3D> geoObject3D, SPtr<Grid3D> grid, int type);
+   D3Q27TriFaceMeshInteractor(SPtr<GbTriFaceMesh3D> triFaceMesh, SPtr<Grid3D> grid, SPtr<BCAdapter> bcAdapter, int type);
+   D3Q27TriFaceMeshInteractor(SPtr<GbTriFaceMesh3D> triFaceMesh, SPtr<Grid3D> grid, SPtr<BCAdapter> bcAdapter, int type, Interactor3D::Accuracy a);
+   //D3Q27TriFaceMeshInteractor(SPtr<GbTriFaceMesh3D> triFaceMesh, D3Q27BoundaryConditionAdapterPtr bcAdapter, int type, std::string name="D3Q27TriFaceMeshInteractor");
+
+   ~D3Q27TriFaceMeshInteractor();
+
+   virtual void initInteractor(const double& timeStep=0);
+   virtual void initInteractor2(const double& timeStep=0);
+
+   void updateInteractor(const double& timestep=0);
+
+   void updateMovedGeometry(const double& timeStep=0);
+   void setQs(const double& timeStep);
+   void refineBlockGridToLevel(int level, double startDistance, double stopDistance);
+
+   bool 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=0*/);
+
+   void setRegardPointInObjectTest( bool opt ) { this->regardPIOTest = opt; }
+
+   ObObject*        clone() { throw UbException(UB_EXARGS,"not implemented");	}
+
+   UbTupleDouble3 getForces();
+   UbTupleDouble3 getForcesTriangle();
+
+   void setStressMode(int stressMode)                      { this->stressMode = stressMode;                         }
+   void setUseHalfSpaceCheck(bool useHalfSpace )           { this->useHalfSpace = useHalfSpace;                     }
+   //void setReinitWithStoredQs(bool reinitWithStoredQsFlag) { this->reinitWithStoredQsFlag = reinitWithStoredQsFlag; }
+
+   void calculateForces();
+   void calculateStresses(); 
+   void calculateStressesAlternativ();            
+
+   void calcStressesLine(UbTupleDouble6& stresses, const double& weight, const UbTupleDouble6& stvW, const UbTupleDouble6& stvE );
+   void calcStressesFace(UbTupleDouble6& stresses, const double& weightX, const double& weightY, const UbTupleDouble6& stvSW, const UbTupleDouble6& stvSE, const UbTupleDouble6& stvNE, const UbTupleDouble6& stvNW );
+   void calcStressesCube(UbTupleDouble6& stresses, const double& weightX, const double& weightY, const double& weightZ, const UbTupleDouble6& stvBSW, const UbTupleDouble6& stvBSE, const UbTupleDouble6& stvBNE, const UbTupleDouble6& stvBNW, const UbTupleDouble6& stvTSW, const UbTupleDouble6& stvTSE, const UbTupleDouble6& stvTNE, const UbTupleDouble6& stvTNW  );
+
+   void calculatePressure(); 
+   void calcPressureLine(double &p, const double& weight, const double& pW, const double& pE );
+   void calcPressureFace(double &p, const double& weightX, const double& weightY, const double& pSW, const double& pSE, const double& pNE, const double& pNW );
+   void calcPressureCube(double &p, const double& weightX, const double& weightY, const double& weightZ, const double& pBSW, const double& pBSE, const double& pBNE, const double& pBNW, const double& pTSW, const double& pTSE, const double& pTNE, const double& pTNW  );
+
+   void   setForceShift(double forceshift)   { this->forceshift = forceshift; this->forceshiftpolicy = true; }
+   void   setVelocityShift(double velocityshift)   { this->velocityshift = velocityshift; this->velocityshiftpolicy = true; }
+   double getForceShift()     { return this->forceshift; }
+   double getVelocityShift()  { return this->velocityshift; }
+   bool   getForceShiftPolicy() { return forceshiftpolicy;}
+   bool   getVelocityShiftPolicy() { return velocityshiftpolicy;}
+
+   void clearBcNodeIndicesAndQsMap() { this->bcNodeIndicesAndQsMap.clear();}
+
+   virtual std::string toString();
+
+
+protected:
+   int    stressMode;
+
+   double forceshift;       
+   double velocityshift;
+   bool   forceshiftpolicy;
+   bool   velocityshiftpolicy;
+   bool   useHalfSpace;
+   bool   regardPIOTest;
+
+   void reinitWithStoredQs(const double& timeStep);
+   //   bool reinitWithStoredQsFlag;
+   std::map< SPtr<Block3D>, std::map < UbTupleInt3, std::vector< float > > > bcNodeIndicesAndQsMap;    //!!! 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!
+
+   enum SolidCheckMethod { ScanLine, PointInObject };
+
+   enum FLAGS { BC_FLAG, UNDEF_FLAG, FLUID_FLAG, SOLID_FLAG, OLDSOLID_FLAG };
+   void recursiveGridFill(CbArray3D<FLAGS>& flagfield, const short& xs, const short& ys, const short& zs, const FLAGS& type);
+   void iterativeGridFill(CbArray3D<FLAGS>& flagfield, const short& xs, const short& ys, const short& zs, const FLAGS& type); 
+};
+
+
+#endif 
diff --git a/src/cpu/VirtualFluidsCore/Interactors/Interactor3D.cpp b/src/cpu/VirtualFluidsCore/Interactors/Interactor3D.cpp
index 9c1d16b18b55575ebc749534ad13d71436ade464..307a34f727408e1ed9bc6bd5bb421170fd710b10 100644
--- a/src/cpu/VirtualFluidsCore/Interactors/Interactor3D.cpp
+++ b/src/cpu/VirtualFluidsCore/Interactors/Interactor3D.cpp
@@ -1,346 +1,346 @@
-//=======================================================================================
-// ____          ____    __    ______     __________   __      __       __        __         
-// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
-//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
-//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
-//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
-//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
-//      \    \  |    |   ________________________________________________________________    
-//       \    \ |    |  |  ______________________________________________________________|   
-//        \    \|    |  |  |         __          __     __     __     ______      _______    
-//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
-//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
-//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
-//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
-//
-//  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 "UbException.h"
-
-#include "Grid3D.h"
-#include "Block3D.h"
-#include "GbObject3D.h"
-
-
-using namespace std;
-
-const int Interactor3D::SOLID	           = (1<<0); //1
-const int Interactor3D::INVERSESOLID       = (1<<1); //2
-const int Interactor3D::TIMEDEPENDENT      = (1<<2); //4   //zeitlich
-const int Interactor3D::FLUID              = (1<<3); //8
-const int Interactor3D::MOVEABLE           = (1<<4); //16  // geometrisch
-const int Interactor3D::CHANGENOTNECESSARY = (1<<5); //32
-
-
-
-//////////////////////////////////////////////////////////////////////////
-Interactor3D::Interactor3D()
-  : type(SOLID)
-{
-
-}
-//////////////////////////////////////////////////////////////////////////
-Interactor3D::Interactor3D(SPtr<Grid3D> grid, int type)
-   :   type(type)
-     , grid(grid)
-{
-
-}
-//////////////////////////////////////////////////////////////////////////
-Interactor3D::Interactor3D(SPtr<GbObject3D> geoObject3D, SPtr<Grid3D> grid, int type)
-   :   geoObject3D(geoObject3D)
-     , grid(grid)
-     , type(type)
-     , accuracy(SIMPLE)
-{
-
-}
-//////////////////////////////////////////////////////////////////////////
-Interactor3D::Interactor3D(SPtr<GbObject3D> geoObject3D, SPtr<Grid3D> grid, int type, Interactor3D::Accuracy a)
-   :   geoObject3D(geoObject3D)
-   , grid(grid)
-   , type(type)
-   , accuracy(a)
-{
-
-}
-//////////////////////////////////////////////////////////////////////////
-Interactor3D::~Interactor3D()
-{
-}
-//////////////////////////////////////////////////////////////////////////
-bool Interactor3D::arePointsInsideGeoObject(double minX1, double minX2, double minX3, double maxX1, double maxX2, double maxX3, double delta)
-{
-   bool result = true;
-   for (double ix3=minX3; ix3<=maxX3; ix3+=delta)
-      for (double ix2=minX2; ix2<=maxX2; ix2+=delta)
-         for (double ix1=minX1; ix1<=maxX1; ix1+=delta)
-            result = result && this->geoObject3D->isPointInGbObject3D(ix1, ix2, ix3);
-
-   return result;
-}
-//////////////////////////////////////////////////////////////////////////
-bool Interactor3D::arePointsOutsideGeoObject(double minX1, double minX2, double minX3, double maxX1, double maxX2, double maxX3, double delta)
-{
-   bool result = true;
-   for (double ix3=minX3; ix3<=maxX3; ix3+=delta)
-      for (double ix2=minX2; ix2<=maxX2; ix2+=delta)
-         for (double ix1=minX1; ix1<=maxX1; ix1+=delta)
-            result = result && (!this->geoObject3D->isPointInGbObject3D(ix1, ix2, ix3));
-
-   return result;
-}
-//////////////////////////////////////////////////////////////////////////
-bool Interactor3D::arePointsCuttingGeoObject(double minX1, double minX2, double minX3, double maxX1, double maxX2, double maxX3, double delta)
-{
-   bool result = true;
-   for (double ix3=minX3; ix3<=maxX3; ix3+=delta)
-      for (double ix2=minX2; ix2<=maxX2; ix2+=delta)
-         for (double ix1=minX1; ix1<=maxX1; ix1+=delta)
-            result = result || this->geoObject3D->isPointInGbObject3D(ix1, ix2, ix3);
-
-   return result;
-}
-//////////////////////////////////////////////////////////////////////////
-bool Interactor3D::isBlockOutsideGeoObject(double minX1, double minX2, double minX3, double maxX1, double maxX2, double maxX3, double delta)
-{
-   switch (accuracy)
-   {
-      //simple duff
-   case SIMPLE:
-      return !this->geoObject3D->isCellInsideOrCuttingGbObject3D(minX1,minX2,minX3,maxX1,maxX2,maxX3);
-      //test only edges
-   case EDGES:
-      return arePointsOutsideGeoObject(minX1, minX2, minX3, maxX1, minX2, minX3, delta) &&
-             arePointsOutsideGeoObject(minX1, maxX2, minX3, maxX1, maxX2, minX3, delta) &&
-             arePointsOutsideGeoObject(minX1, minX2, maxX3, maxX1, minX2, maxX3, delta) &&
-             arePointsOutsideGeoObject(minX1, maxX2, maxX3, maxX1, maxX2, maxX3, delta) &&
-             
-             arePointsOutsideGeoObject(minX1, minX2, minX3, minX1, maxX2, minX3, delta) &&
-             arePointsOutsideGeoObject(maxX1, minX2, minX3, maxX1, maxX2, minX3, delta) &&
-             arePointsOutsideGeoObject(minX1, minX2, maxX3, maxX1, minX2, maxX3, delta) &&
-             arePointsOutsideGeoObject(maxX1, minX2, maxX3, maxX1, maxX2, maxX3, delta) &&
-             
-             arePointsOutsideGeoObject(minX1, minX2, minX3, minX1, maxX2, maxX3, delta) &&
-             arePointsOutsideGeoObject(maxX1, minX2, minX3, maxX1, maxX2, maxX3, delta) &&
-             arePointsOutsideGeoObject(minX1, maxX2, minX3, maxX1, minX2, maxX3, delta) &&
-             arePointsOutsideGeoObject(maxX1, maxX2, minX3, maxX1, maxX2, maxX3, delta);   
-      //test only faces
-   case FACES:
-      return arePointsOutsideGeoObject(minX1, minX2, minX3, minX1, maxX2, maxX3, delta) &&
-             arePointsOutsideGeoObject(maxX1, minX2, minX3, maxX1, maxX2, maxX3, delta) &&
-             arePointsOutsideGeoObject(minX1, minX2, minX3, maxX1, minX2, maxX3, delta) &&
-             arePointsOutsideGeoObject(minX1, maxX2, minX3, maxX1, maxX2, maxX3, delta) &&
-             arePointsOutsideGeoObject(minX1, minX2, minX3, maxX1, maxX2, minX3, delta) &&
-             arePointsOutsideGeoObject(minX1, minX2, maxX3, maxX1, maxX2, maxX3, delta);
-      //test all points
-   case POINTS:
-      return arePointsOutsideGeoObject(minX1, minX2, minX3, maxX1, maxX2, maxX3, delta);
-   default:
-      UB_THROW( UbException(UB_EXARGS, "Accuracy isn't correct") );
-      break;
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-bool Interactor3D::isBlockInsideGeoObject(double minX1, double minX2, double minX3, double maxX1, double maxX2, double maxX3, double delta)
-{
-   switch (accuracy)
-   {
-      //simple duff
-   case SIMPLE:
-      return this->geoObject3D->isCellInsideGbObject3D(minX1,minX2,minX3,maxX1,maxX2,maxX3);
-      //test only edges
-   case EDGES:
-      return arePointsInsideGeoObject(minX1, minX2, minX3, maxX1, minX2, minX3, delta) &&
-             arePointsInsideGeoObject(minX1, maxX2, minX3, maxX1, maxX2, minX3, delta) &&
-             arePointsInsideGeoObject(minX1, minX2, maxX3, maxX1, minX2, maxX3, delta) &&
-             arePointsInsideGeoObject(minX1, maxX2, maxX3, maxX1, maxX2, maxX3, delta) &&
-             
-             arePointsInsideGeoObject(minX1, minX2, minX3, minX1, maxX2, minX3, delta) &&
-             arePointsInsideGeoObject(maxX1, minX2, minX3, maxX1, maxX2, minX3, delta) &&
-             arePointsInsideGeoObject(minX1, minX2, maxX3, maxX1, minX2, maxX3, delta) &&
-             arePointsInsideGeoObject(maxX1, minX2, maxX3, maxX1, maxX2, maxX3, delta) &&
-             
-             arePointsInsideGeoObject(minX1, minX2, minX3, minX1, maxX2, maxX3, delta) &&
-             arePointsInsideGeoObject(maxX1, minX2, minX3, maxX1, maxX2, maxX3, delta) &&
-             arePointsInsideGeoObject(minX1, maxX2, minX3, maxX1, minX2, maxX3, delta) &&
-             arePointsInsideGeoObject(maxX1, maxX2, minX3, maxX1, maxX2, maxX3, delta);   
-      //test only faces
-   case FACES:
-      return arePointsInsideGeoObject(minX1, minX2, minX3, minX1, maxX2, maxX3, delta) &&
-             arePointsInsideGeoObject(maxX1, minX2, minX3, maxX1, maxX2, maxX3, delta) &&
-             arePointsInsideGeoObject(minX1, minX2, minX3, maxX1, minX2, maxX3, delta) &&
-             arePointsInsideGeoObject(minX1, maxX2, minX3, maxX1, maxX2, maxX3, delta) &&
-             arePointsInsideGeoObject(minX1, minX2, minX3, maxX1, maxX2, minX3, delta) &&
-             arePointsInsideGeoObject(minX1, minX2, maxX3, maxX1, maxX2, maxX3, delta);
-      //test all points
-   case POINTS:
-      return arePointsInsideGeoObject(minX1, minX2, minX3, maxX1, maxX2, maxX3, delta);
-   default:
-      UB_THROW( UbException(UB_EXARGS, "Accuracy isn't correct") );
-      break;
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-bool Interactor3D::isBlockCuttingGeoObject(double minX1, double minX2, double minX3, double maxX1, double maxX2, double maxX3, double delta)
-{
-   switch (accuracy)
-   {
-      //simple duff
-   case SIMPLE:
-      return this->geoObject3D->isCellCuttingGbObject3D(minX1,minX2,minX3,maxX1,maxX2,maxX3);
-      //test only edges
-   case EDGES:
-      return arePointsCuttingGeoObject(minX1, minX2, minX3, maxX1, minX2, minX3, delta) ||
-             arePointsCuttingGeoObject(minX1, maxX2, minX3, maxX1, maxX2, minX3, delta) ||
-             arePointsCuttingGeoObject(minX1, minX2, maxX3, maxX1, minX2, maxX3, delta) ||
-             arePointsCuttingGeoObject(minX1, maxX2, maxX3, maxX1, maxX2, maxX3, delta) ||
-                                                                             
-             arePointsCuttingGeoObject(minX1, minX2, minX3, minX1, maxX2, minX3, delta) ||
-             arePointsCuttingGeoObject(maxX1, minX2, minX3, maxX1, maxX2, minX3, delta) ||
-             arePointsCuttingGeoObject(minX1, minX2, maxX3, maxX1, minX2, maxX3, delta) ||
-             arePointsCuttingGeoObject(maxX1, minX2, maxX3, maxX1, maxX2, maxX3, delta) ||
-                                                                             
-             arePointsCuttingGeoObject(minX1, minX2, minX3, minX1, maxX2, maxX3, delta) ||
-             arePointsCuttingGeoObject(maxX1, minX2, minX3, maxX1, maxX2, maxX3, delta) ||
-             arePointsCuttingGeoObject(minX1, maxX2, minX3, maxX1, minX2, maxX3, delta) ||
-             arePointsCuttingGeoObject(maxX1, maxX2, minX3, maxX1, maxX2, maxX3, delta);   
-      //test only faceCutting
-   case FACES:        
-      return arePointsCuttingGeoObject(minX1, minX2, minX3, minX1, maxX2, maxX3, delta) ||
-             arePointsCuttingGeoObject(maxX1, minX2, minX3, maxX1, maxX2, maxX3, delta) ||
-             arePointsCuttingGeoObject(minX1, minX2, minX3, maxX1, minX2, maxX3, delta) ||
-             arePointsCuttingGeoObject(minX1, maxX2, minX3, maxX1, maxX2, maxX3, delta) ||
-             arePointsCuttingGeoObject(minX1, minX2, minX3, maxX1, maxX2, minX3, delta) ||
-             arePointsCuttingGeoObject(minX1, minX2, maxX3, maxX1, maxX2, maxX3, delta);
-      //test all pointCutting
-   case POINTS:       
-      return arePointsCuttingGeoObject(minX1, minX2, minX3, maxX1, maxX2, maxX3, delta);
-   default:
-      UB_THROW( UbException(UB_EXARGS, "Accuracy isn't correct") );
-      break;
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-void Interactor3D::setSolidBlock(SPtr<Block3D> block)
-{
-   double minX1,minX2,minX3,maxX1,maxX2,maxX3;
-
-   double deltaX = grid.lock()->getDeltaX(block);
-   UbTupleDouble3 blockLengths  = grid.lock()->getBlockLengths(block);
-   UbTupleDouble3 org = grid.lock()->getBlockWorldCoordinates(block);
-   UbTupleDouble3 nodeOffset = grid.lock()->getNodeOffset(block);
-
-   //coordinates of block without ghost layer
-   minX1 = val<1>(org) + val<1>(nodeOffset);
-   minX2 = val<2>(org) + val<2>(nodeOffset);
-   minX3 = val<3>(org) + val<3>(nodeOffset);
-   maxX1 = val<1>(org) + val<1>(blockLengths) - val<1>(nodeOffset);
-   maxX2 = val<2>(org) + val<2>(blockLengths) - val<2>(nodeOffset);
-   maxX3 = val<3>(org) + val<3>(blockLengths) - val<3>(nodeOffset);
-
-   if(this->isInverseSolid())
-   {
-      if(isBlockOutsideGeoObject(minX1, minX2, minX3, maxX1, maxX2, maxX3, deltaX))
-      {
-         block->setActive(false);
-         this->solidBlocks.push_back(block);
-      }
-   }
-   else //solid 
-   {
-      if(isBlockInsideGeoObject(minX1, minX2, minX3, maxX1, maxX2, maxX3, deltaX))
-      {
-         block->setActive(false);
-         this->solidBlocks.push_back(block);
-      }
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-void Interactor3D::setBCBlock(SPtr<Block3D> block)
-{
-   double minX1,minX2,minX3,maxX1,maxX2,maxX3;
-
-   double deltaX = grid.lock()->getDeltaX(block);
-   UbTupleDouble3 blockLengths  = grid.lock()->getBlockLengths(block);
-   UbTupleDouble3 org = grid.lock()->getBlockWorldCoordinates(block);
-   UbTupleDouble3 nodeOffset = grid.lock()->getNodeOffset(block);
-
-   //coordinates of block with ghost layer
-   minX1 = val<1>(org) - val<1>(nodeOffset);
-   minX2 = val<2>(org) - val<2>(nodeOffset);
-   minX3 = val<3>(org) - val<3>(nodeOffset);
-   maxX1 = val<1>(org) + val<1>(blockLengths) + val<1>(nodeOffset);
-   maxX2 = val<2>(org) + val<2>(blockLengths) + val<2>(nodeOffset);
-   maxX3 = val<3>(org) + val<3>(blockLengths) + val<3>(nodeOffset);
-
-   if(isBlockCuttingGeoObject(minX1, minX2, minX3, maxX1, maxX2, maxX3, deltaX))
-      this->bcBlocks.push_back(block);
-}
-
-UbTupleDouble3 Interactor3D::getForces()
-{
-    UB_THROW( UbException("UbTupleDouble3 getForces() - gehoert in die abgeleitete klasse") );
-}
-void Interactor3D::setID(int id)
-{
-   this->id = id;
-}
-//////////////////////////////////////////////////////////////////////////
-int Interactor3D::getID()
-{
-   return id;
-}
-//////////////////////////////////////////////////////////////////////////
-void Interactor3D::setActive()
-{
-   active = true;
-}
-//////////////////////////////////////////////////////////////////////////
-void Interactor3D::setInactive()
-{
-   active = false;
-}
-//////////////////////////////////////////////////////////////////////////
-bool Interactor3D::isActive()
-{
-   return active;
-}
-//////////////////////////////////////////////////////////////////////////
-void Interactor3D::initInteractor(const double& timeStep)
-{
-   //UBLOG(logINFO, "transBlocks.size = "<<transBlocks.size());
-
-   for(SPtr<Block3D> block : bcBlocks)
-   {
-      this->setDifferencesToGbObject3D(block);
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-void Interactor3D::updateInteractor(const double& timeStep)
-{
-   UB_THROW( UbException("Interactor3D::updateInteractor - toDo") );
-}
-//////////////////////////////////////////////////////////////////////////
-
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 "UbException.h"
+
+#include "Grid3D.h"
+#include "Block3D.h"
+#include "GbObject3D.h"
+
+
+using namespace std;
+
+const int Interactor3D::SOLID	           = (1<<0); //1
+const int Interactor3D::INVERSESOLID       = (1<<1); //2
+const int Interactor3D::TIMEDEPENDENT      = (1<<2); //4   //zeitlich
+const int Interactor3D::FLUID              = (1<<3); //8
+const int Interactor3D::MOVEABLE           = (1<<4); //16  // geometrisch
+const int Interactor3D::CHANGENOTNECESSARY = (1<<5); //32
+
+
+
+//////////////////////////////////////////////////////////////////////////
+Interactor3D::Interactor3D()
+  : type(SOLID)
+{
+
+}
+//////////////////////////////////////////////////////////////////////////
+Interactor3D::Interactor3D(SPtr<Grid3D> grid, int type)
+   :   type(type)
+     , grid(grid)
+{
+
+}
+//////////////////////////////////////////////////////////////////////////
+Interactor3D::Interactor3D(SPtr<GbObject3D> geoObject3D, SPtr<Grid3D> grid, int type)
+   :   geoObject3D(geoObject3D)
+     , grid(grid)
+     , type(type)
+     , accuracy(SIMPLE)
+{
+
+}
+//////////////////////////////////////////////////////////////////////////
+Interactor3D::Interactor3D(SPtr<GbObject3D> geoObject3D, SPtr<Grid3D> grid, int type, Interactor3D::Accuracy a)
+   :   geoObject3D(geoObject3D)
+   , grid(grid)
+   , type(type)
+   , accuracy(a)
+{
+
+}
+//////////////////////////////////////////////////////////////////////////
+Interactor3D::~Interactor3D()
+{
+}
+//////////////////////////////////////////////////////////////////////////
+bool Interactor3D::arePointsInsideGeoObject(double minX1, double minX2, double minX3, double maxX1, double maxX2, double maxX3, double delta)
+{
+   bool result = true;
+   for (double ix3=minX3; ix3<=maxX3; ix3+=delta)
+      for (double ix2=minX2; ix2<=maxX2; ix2+=delta)
+         for (double ix1=minX1; ix1<=maxX1; ix1+=delta)
+            result = result && this->geoObject3D->isPointInGbObject3D(ix1, ix2, ix3);
+
+   return result;
+}
+//////////////////////////////////////////////////////////////////////////
+bool Interactor3D::arePointsOutsideGeoObject(double minX1, double minX2, double minX3, double maxX1, double maxX2, double maxX3, double delta)
+{
+   bool result = true;
+   for (double ix3=minX3; ix3<=maxX3; ix3+=delta)
+      for (double ix2=minX2; ix2<=maxX2; ix2+=delta)
+         for (double ix1=minX1; ix1<=maxX1; ix1+=delta)
+            result = result && (!this->geoObject3D->isPointInGbObject3D(ix1, ix2, ix3));
+
+   return result;
+}
+//////////////////////////////////////////////////////////////////////////
+bool Interactor3D::arePointsCuttingGeoObject(double minX1, double minX2, double minX3, double maxX1, double maxX2, double maxX3, double delta)
+{
+   bool result = true;
+   for (double ix3=minX3; ix3<=maxX3; ix3+=delta)
+      for (double ix2=minX2; ix2<=maxX2; ix2+=delta)
+         for (double ix1=minX1; ix1<=maxX1; ix1+=delta)
+            result = result || this->geoObject3D->isPointInGbObject3D(ix1, ix2, ix3);
+
+   return result;
+}
+//////////////////////////////////////////////////////////////////////////
+bool Interactor3D::isBlockOutsideGeoObject(double minX1, double minX2, double minX3, double maxX1, double maxX2, double maxX3, double delta)
+{
+   switch (accuracy)
+   {
+      //simple duff
+   case SIMPLE:
+      return !this->geoObject3D->isCellInsideOrCuttingGbObject3D(minX1,minX2,minX3,maxX1,maxX2,maxX3);
+      //test only edges
+   case EDGES:
+      return arePointsOutsideGeoObject(minX1, minX2, minX3, maxX1, minX2, minX3, delta) &&
+             arePointsOutsideGeoObject(minX1, maxX2, minX3, maxX1, maxX2, minX3, delta) &&
+             arePointsOutsideGeoObject(minX1, minX2, maxX3, maxX1, minX2, maxX3, delta) &&
+             arePointsOutsideGeoObject(minX1, maxX2, maxX3, maxX1, maxX2, maxX3, delta) &&
+             
+             arePointsOutsideGeoObject(minX1, minX2, minX3, minX1, maxX2, minX3, delta) &&
+             arePointsOutsideGeoObject(maxX1, minX2, minX3, maxX1, maxX2, minX3, delta) &&
+             arePointsOutsideGeoObject(minX1, minX2, maxX3, maxX1, minX2, maxX3, delta) &&
+             arePointsOutsideGeoObject(maxX1, minX2, maxX3, maxX1, maxX2, maxX3, delta) &&
+             
+             arePointsOutsideGeoObject(minX1, minX2, minX3, minX1, maxX2, maxX3, delta) &&
+             arePointsOutsideGeoObject(maxX1, minX2, minX3, maxX1, maxX2, maxX3, delta) &&
+             arePointsOutsideGeoObject(minX1, maxX2, minX3, maxX1, minX2, maxX3, delta) &&
+             arePointsOutsideGeoObject(maxX1, maxX2, minX3, maxX1, maxX2, maxX3, delta);   
+      //test only faces
+   case FACES:
+      return arePointsOutsideGeoObject(minX1, minX2, minX3, minX1, maxX2, maxX3, delta) &&
+             arePointsOutsideGeoObject(maxX1, minX2, minX3, maxX1, maxX2, maxX3, delta) &&
+             arePointsOutsideGeoObject(minX1, minX2, minX3, maxX1, minX2, maxX3, delta) &&
+             arePointsOutsideGeoObject(minX1, maxX2, minX3, maxX1, maxX2, maxX3, delta) &&
+             arePointsOutsideGeoObject(minX1, minX2, minX3, maxX1, maxX2, minX3, delta) &&
+             arePointsOutsideGeoObject(minX1, minX2, maxX3, maxX1, maxX2, maxX3, delta);
+      //test all points
+   case POINTS:
+      return arePointsOutsideGeoObject(minX1, minX2, minX3, maxX1, maxX2, maxX3, delta);
+   default:
+      UB_THROW( UbException(UB_EXARGS, "Accuracy isn't correct") );
+      break;
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+bool Interactor3D::isBlockInsideGeoObject(double minX1, double minX2, double minX3, double maxX1, double maxX2, double maxX3, double delta)
+{
+   switch (accuracy)
+   {
+      //simple duff
+   case SIMPLE:
+      return this->geoObject3D->isCellInsideGbObject3D(minX1,minX2,minX3,maxX1,maxX2,maxX3);
+      //test only edges
+   case EDGES:
+      return arePointsInsideGeoObject(minX1, minX2, minX3, maxX1, minX2, minX3, delta) &&
+             arePointsInsideGeoObject(minX1, maxX2, minX3, maxX1, maxX2, minX3, delta) &&
+             arePointsInsideGeoObject(minX1, minX2, maxX3, maxX1, minX2, maxX3, delta) &&
+             arePointsInsideGeoObject(minX1, maxX2, maxX3, maxX1, maxX2, maxX3, delta) &&
+             
+             arePointsInsideGeoObject(minX1, minX2, minX3, minX1, maxX2, minX3, delta) &&
+             arePointsInsideGeoObject(maxX1, minX2, minX3, maxX1, maxX2, minX3, delta) &&
+             arePointsInsideGeoObject(minX1, minX2, maxX3, maxX1, minX2, maxX3, delta) &&
+             arePointsInsideGeoObject(maxX1, minX2, maxX3, maxX1, maxX2, maxX3, delta) &&
+             
+             arePointsInsideGeoObject(minX1, minX2, minX3, minX1, maxX2, maxX3, delta) &&
+             arePointsInsideGeoObject(maxX1, minX2, minX3, maxX1, maxX2, maxX3, delta) &&
+             arePointsInsideGeoObject(minX1, maxX2, minX3, maxX1, minX2, maxX3, delta) &&
+             arePointsInsideGeoObject(maxX1, maxX2, minX3, maxX1, maxX2, maxX3, delta);   
+      //test only faces
+   case FACES:
+      return arePointsInsideGeoObject(minX1, minX2, minX3, minX1, maxX2, maxX3, delta) &&
+             arePointsInsideGeoObject(maxX1, minX2, minX3, maxX1, maxX2, maxX3, delta) &&
+             arePointsInsideGeoObject(minX1, minX2, minX3, maxX1, minX2, maxX3, delta) &&
+             arePointsInsideGeoObject(minX1, maxX2, minX3, maxX1, maxX2, maxX3, delta) &&
+             arePointsInsideGeoObject(minX1, minX2, minX3, maxX1, maxX2, minX3, delta) &&
+             arePointsInsideGeoObject(minX1, minX2, maxX3, maxX1, maxX2, maxX3, delta);
+      //test all points
+   case POINTS:
+      return arePointsInsideGeoObject(minX1, minX2, minX3, maxX1, maxX2, maxX3, delta);
+   default:
+      UB_THROW( UbException(UB_EXARGS, "Accuracy isn't correct") );
+      break;
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+bool Interactor3D::isBlockCuttingGeoObject(double minX1, double minX2, double minX3, double maxX1, double maxX2, double maxX3, double delta)
+{
+   switch (accuracy)
+   {
+      //simple duff
+   case SIMPLE:
+      return this->geoObject3D->isCellCuttingGbObject3D(minX1,minX2,minX3,maxX1,maxX2,maxX3);
+      //test only edges
+   case EDGES:
+      return arePointsCuttingGeoObject(minX1, minX2, minX3, maxX1, minX2, minX3, delta) ||
+             arePointsCuttingGeoObject(minX1, maxX2, minX3, maxX1, maxX2, minX3, delta) ||
+             arePointsCuttingGeoObject(minX1, minX2, maxX3, maxX1, minX2, maxX3, delta) ||
+             arePointsCuttingGeoObject(minX1, maxX2, maxX3, maxX1, maxX2, maxX3, delta) ||
+                                                                             
+             arePointsCuttingGeoObject(minX1, minX2, minX3, minX1, maxX2, minX3, delta) ||
+             arePointsCuttingGeoObject(maxX1, minX2, minX3, maxX1, maxX2, minX3, delta) ||
+             arePointsCuttingGeoObject(minX1, minX2, maxX3, maxX1, minX2, maxX3, delta) ||
+             arePointsCuttingGeoObject(maxX1, minX2, maxX3, maxX1, maxX2, maxX3, delta) ||
+                                                                             
+             arePointsCuttingGeoObject(minX1, minX2, minX3, minX1, maxX2, maxX3, delta) ||
+             arePointsCuttingGeoObject(maxX1, minX2, minX3, maxX1, maxX2, maxX3, delta) ||
+             arePointsCuttingGeoObject(minX1, maxX2, minX3, maxX1, minX2, maxX3, delta) ||
+             arePointsCuttingGeoObject(maxX1, maxX2, minX3, maxX1, maxX2, maxX3, delta);   
+      //test only faceCutting
+   case FACES:        
+      return arePointsCuttingGeoObject(minX1, minX2, minX3, minX1, maxX2, maxX3, delta) ||
+             arePointsCuttingGeoObject(maxX1, minX2, minX3, maxX1, maxX2, maxX3, delta) ||
+             arePointsCuttingGeoObject(minX1, minX2, minX3, maxX1, minX2, maxX3, delta) ||
+             arePointsCuttingGeoObject(minX1, maxX2, minX3, maxX1, maxX2, maxX3, delta) ||
+             arePointsCuttingGeoObject(minX1, minX2, minX3, maxX1, maxX2, minX3, delta) ||
+             arePointsCuttingGeoObject(minX1, minX2, maxX3, maxX1, maxX2, maxX3, delta);
+      //test all pointCutting
+   case POINTS:       
+      return arePointsCuttingGeoObject(minX1, minX2, minX3, maxX1, maxX2, maxX3, delta);
+   default:
+      UB_THROW( UbException(UB_EXARGS, "Accuracy isn't correct") );
+      break;
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+void Interactor3D::setSolidBlock(SPtr<Block3D> block)
+{
+   double minX1,minX2,minX3,maxX1,maxX2,maxX3;
+
+   double deltaX = grid.lock()->getDeltaX(block);
+   UbTupleDouble3 blockLengths  = grid.lock()->getBlockLengths(block);
+   UbTupleDouble3 org = grid.lock()->getBlockWorldCoordinates(block);
+   UbTupleDouble3 nodeOffset = grid.lock()->getNodeOffset(block);
+
+   //coordinates of block without ghost layer
+   minX1 = val<1>(org) + val<1>(nodeOffset);
+   minX2 = val<2>(org) + val<2>(nodeOffset);
+   minX3 = val<3>(org) + val<3>(nodeOffset);
+   maxX1 = val<1>(org) + val<1>(blockLengths) - val<1>(nodeOffset);
+   maxX2 = val<2>(org) + val<2>(blockLengths) - val<2>(nodeOffset);
+   maxX3 = val<3>(org) + val<3>(blockLengths) - val<3>(nodeOffset);
+
+   if(this->isInverseSolid())
+   {
+      if(isBlockOutsideGeoObject(minX1, minX2, minX3, maxX1, maxX2, maxX3, deltaX))
+      {
+         block->setActive(false);
+         this->solidBlocks.push_back(block);
+      }
+   }
+   else //solid 
+   {
+      if(isBlockInsideGeoObject(minX1, minX2, minX3, maxX1, maxX2, maxX3, deltaX))
+      {
+         block->setActive(false);
+         this->solidBlocks.push_back(block);
+      }
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+void Interactor3D::setBCBlock(SPtr<Block3D> block)
+{
+   double minX1,minX2,minX3,maxX1,maxX2,maxX3;
+
+   double deltaX = grid.lock()->getDeltaX(block);
+   UbTupleDouble3 blockLengths  = grid.lock()->getBlockLengths(block);
+   UbTupleDouble3 org = grid.lock()->getBlockWorldCoordinates(block);
+   UbTupleDouble3 nodeOffset = grid.lock()->getNodeOffset(block);
+
+   //coordinates of block with ghost layer
+   minX1 = val<1>(org) - val<1>(nodeOffset);
+   minX2 = val<2>(org) - val<2>(nodeOffset);
+   minX3 = val<3>(org) - val<3>(nodeOffset);
+   maxX1 = val<1>(org) + val<1>(blockLengths) + val<1>(nodeOffset);
+   maxX2 = val<2>(org) + val<2>(blockLengths) + val<2>(nodeOffset);
+   maxX3 = val<3>(org) + val<3>(blockLengths) + val<3>(nodeOffset);
+
+   if(isBlockCuttingGeoObject(minX1, minX2, minX3, maxX1, maxX2, maxX3, deltaX))
+      this->bcBlocks.push_back(block);
+}
+
+UbTupleDouble3 Interactor3D::getForces()
+{
+    UB_THROW( UbException("UbTupleDouble3 getForces() - gehoert in die abgeleitete klasse") );
+}
+void Interactor3D::setID(int id)
+{
+   this->id = id;
+}
+//////////////////////////////////////////////////////////////////////////
+int Interactor3D::getID()
+{
+   return id;
+}
+//////////////////////////////////////////////////////////////////////////
+void Interactor3D::setActive()
+{
+   active = true;
+}
+//////////////////////////////////////////////////////////////////////////
+void Interactor3D::setInactive()
+{
+   active = false;
+}
+//////////////////////////////////////////////////////////////////////////
+bool Interactor3D::isActive()
+{
+   return active;
+}
+//////////////////////////////////////////////////////////////////////////
+void Interactor3D::initInteractor(const double& timeStep)
+{
+   //UBLOG(logINFO, "transBlocks.size = "<<transBlocks.size());
+
+   for(SPtr<Block3D> block : bcBlocks)
+   {
+      this->setDifferencesToGbObject3D(block);
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+void Interactor3D::updateInteractor(const double& timeStep)
+{
+   UB_THROW( UbException("Interactor3D::updateInteractor - toDo") );
+}
+//////////////////////////////////////////////////////////////////////////
+
diff --git a/src/cpu/VirtualFluidsCore/Interactors/Interactor3D.h b/src/cpu/VirtualFluidsCore/Interactors/Interactor3D.h
index 452e62d8c73fc12d81193dfb278ec77af2a25be1..9ff168bf80681547de91aac0f870cc306c78ad65 100644
--- a/src/cpu/VirtualFluidsCore/Interactors/Interactor3D.h
+++ b/src/cpu/VirtualFluidsCore/Interactors/Interactor3D.h
@@ -1,146 +1,146 @@
-//=======================================================================================
-// ____          ____    __    ______     __________   __      __       __        __         
-// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
-//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
-//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
-//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
-//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
-//      \    \  |    |   ________________________________________________________________    
-//       \    \ |    |  |  ______________________________________________________________|   
-//        \    \|    |  |  |         __          __     __     __     ______      _______    
-//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
-//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
-//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
-//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
-//
-//  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
-
-#include <vector>
-#include <PointerDefinitions.h>
-
-#include "UbSystem.h"
-#include "UbTuple.h"
-
-class Block3D;
-class Grid3D;
-class GbObject3D;
-
-//! A base class for grid generation.
-class Interactor3D : public enableSharedFromThis<Interactor3D>
-{
-public:
-   enum Accuracy{SIMPLE, EDGES, FACES, POINTS};
-   Interactor3D();
-   Interactor3D(SPtr<Grid3D> grid, int type=Interactor3D::SOLID);
-   Interactor3D(SPtr<GbObject3D> geoObject3D, SPtr<Grid3D> grid, int type);
-   //! constructor
-   //! \param a set accuracy for arePointsInObject() and arePointsNotInObject()
-   Interactor3D(SPtr<GbObject3D> geoObject3D, SPtr<Grid3D> grid, int type, Interactor3D::Accuracy a);
-   
-   virtual ~Interactor3D();
-   virtual void initInteractor(const double& timestep=0); 
-   virtual void updateInteractor(const double& timestep=0)=0;
-
-   void setSolidBlock(SPtr<Block3D> block);
-   void setBCBlock(SPtr<Block3D> block);
-
-    virtual UbTupleDouble3 getForces();
-
-   void setSolid()        { UbSystem::setBit(this->type, SOLID   ); }
-   void setMoveable()     { UbSystem::setBit(this->type, MOVEABLE); }
-   
-   bool isSolid()         { return UbSystem::bitCheck(this->type, SOLID        ); }
-   bool isInverseSolid()  { return UbSystem::bitCheck(this->type, INVERSESOLID ); }
-   bool isTimeDependent() { return UbSystem::bitCheck(this->type, TIMEDEPENDENT); }
-   bool isMoveable()      { return UbSystem::bitCheck(this->type, MOVEABLE     ); }
-   
-   SPtr<Grid3D> getGrid3D()  const { return grid.lock();   }
-   void setGrid3D(SPtr<Grid3D> grid) { this->grid = grid; }
-   virtual SPtr<GbObject3D>  getGbObject3D() const { return geoObject3D; }
-   virtual 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*/)
-   {
-      //UBLOG(logINFO, "Interactor3D::setDifferencesToGbObject3D()");
-      return false;  
-   }
-
-   virtual std::vector<SPtr<Block3D> >& getBcBlocks() { return this->bcBlocks; }
-   virtual void removeBcBlocks() { this->bcBlocks.clear(); }
-   virtual std::vector<SPtr<Block3D> >& getSolidBlockSet() { return this->solidBlocks; }
-   virtual void removeSolidBlocks() { this->solidBlocks.clear(); }
-
-   void setID(int id);
-   int getID();
-
-   void setActive();
-   void setInactive();
-   bool isActive();
-
-protected:
-   void setTimeDependent()   { UbSystem::setBit(this->type  , TIMEDEPENDENT); }
-   void unsetTimeDependent() { UbSystem::unsetBit(this->type, TIMEDEPENDENT); }
-   
-   //! detect that points are inside object
-   //! \param min/max coordinates of bounding box
-   //! \param delta is delta x
-   bool arePointsInsideGeoObject(double minX1, double minX2, double minX3, double maxX1, double maxX2, double maxX3, double delta);
-   
-   //! detect that points aren't inside object
-   //! \param min/max coordinates of bounding box
-   //! \param delta is delta x
-   bool arePointsOutsideGeoObject(double minX1, double minX2, double minX3, double maxX1, double maxX2, double maxX3, double delta);
-
-   //! detect that points are cutting object
-   //! \param min/max coordinates of bounding box
-   //! \param delta is delta x
-   bool arePointsCuttingGeoObject(double minX1, double minX2, double minX3, double maxX1, double maxX2, double maxX3, double delta);
-   
-   bool isBlockOutsideGeoObject(double minX1, double minX2, double minX3, double maxX1, double maxX2, double maxX3, double delta);
-   bool isBlockInsideGeoObject(double minX1, double minX2, double minX3, double maxX1, double maxX2, double maxX3, double delta);
-   bool isBlockCuttingGeoObject(double minX1, double minX2, double minX3, double maxX1, double maxX2, double maxX3, double delta);
-
-   int type;
-   
-   WPtr<Grid3D> grid;
-   SPtr<GbObject3D> geoObject3D;
-
-   std::vector<SPtr<Block3D> > bcBlocks;
-   std::vector<SPtr<Block3D> > solidBlocks;
-   int accuracy;
-   
-   bool active;
-   int id;
-
-public:
-   static const int SOLID	            ;//= (1<<0); //1
-   static const int INVERSESOLID       ;//= (1<<1); //2
-   static const int TIMEDEPENDENT      ;//= (1<<2); //4   //zeitlich
-   static const int FLUID              ;//= (1<<3); //8
-   static const int MOVEABLE           ;//= (1<<4); //16  // geometrisch
-   static const int CHANGENOTNECESSARY ;//= (1<<5); //32
-
-private:
-
-};
-
-
-
-#endif
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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
+
+#include <vector>
+#include <PointerDefinitions.h>
+
+#include "UbSystem.h"
+#include "UbTuple.h"
+
+class Block3D;
+class Grid3D;
+class GbObject3D;
+
+//! A base class for grid generation.
+class Interactor3D : public enableSharedFromThis<Interactor3D>
+{
+public:
+   enum Accuracy{SIMPLE, EDGES, FACES, POINTS};
+   Interactor3D();
+   Interactor3D(SPtr<Grid3D> grid, int type=Interactor3D::SOLID);
+   Interactor3D(SPtr<GbObject3D> geoObject3D, SPtr<Grid3D> grid, int type);
+   //! constructor
+   //! \param a set accuracy for arePointsInObject() and arePointsNotInObject()
+   Interactor3D(SPtr<GbObject3D> geoObject3D, SPtr<Grid3D> grid, int type, Interactor3D::Accuracy a);
+   
+   virtual ~Interactor3D();
+   virtual void initInteractor(const double& timestep=0); 
+   virtual void updateInteractor(const double& timestep=0)=0;
+
+   void setSolidBlock(SPtr<Block3D> block);
+   void setBCBlock(SPtr<Block3D> block);
+
+    virtual UbTupleDouble3 getForces();
+
+   void setSolid()        { UbSystem::setBit(this->type, SOLID   ); }
+   void setMoveable()     { UbSystem::setBit(this->type, MOVEABLE); }
+   
+   bool isSolid()         { return UbSystem::bitCheck(this->type, SOLID        ); }
+   bool isInverseSolid()  { return UbSystem::bitCheck(this->type, INVERSESOLID ); }
+   bool isTimeDependent() { return UbSystem::bitCheck(this->type, TIMEDEPENDENT); }
+   bool isMoveable()      { return UbSystem::bitCheck(this->type, MOVEABLE     ); }
+   
+   SPtr<Grid3D> getGrid3D()  const { return grid.lock();   }
+   void setGrid3D(SPtr<Grid3D> grid) { this->grid = grid; }
+   virtual SPtr<GbObject3D>  getGbObject3D() const { return geoObject3D; }
+   virtual 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*/)
+   {
+      //UBLOG(logINFO, "Interactor3D::setDifferencesToGbObject3D()");
+      return false;  
+   }
+
+   virtual std::vector<SPtr<Block3D> >& getBcBlocks() { return this->bcBlocks; }
+   virtual void removeBcBlocks() { this->bcBlocks.clear(); }
+   virtual std::vector<SPtr<Block3D> >& getSolidBlockSet() { return this->solidBlocks; }
+   virtual void removeSolidBlocks() { this->solidBlocks.clear(); }
+
+   void setID(int id);
+   int getID();
+
+   void setActive();
+   void setInactive();
+   bool isActive();
+
+protected:
+   void setTimeDependent()   { UbSystem::setBit(this->type  , TIMEDEPENDENT); }
+   void unsetTimeDependent() { UbSystem::unsetBit(this->type, TIMEDEPENDENT); }
+   
+   //! detect that points are inside object
+   //! \param min/max coordinates of bounding box
+   //! \param delta is delta x
+   bool arePointsInsideGeoObject(double minX1, double minX2, double minX3, double maxX1, double maxX2, double maxX3, double delta);
+   
+   //! detect that points aren't inside object
+   //! \param min/max coordinates of bounding box
+   //! \param delta is delta x
+   bool arePointsOutsideGeoObject(double minX1, double minX2, double minX3, double maxX1, double maxX2, double maxX3, double delta);
+
+   //! detect that points are cutting object
+   //! \param min/max coordinates of bounding box
+   //! \param delta is delta x
+   bool arePointsCuttingGeoObject(double minX1, double minX2, double minX3, double maxX1, double maxX2, double maxX3, double delta);
+   
+   bool isBlockOutsideGeoObject(double minX1, double minX2, double minX3, double maxX1, double maxX2, double maxX3, double delta);
+   bool isBlockInsideGeoObject(double minX1, double minX2, double minX3, double maxX1, double maxX2, double maxX3, double delta);
+   bool isBlockCuttingGeoObject(double minX1, double minX2, double minX3, double maxX1, double maxX2, double maxX3, double delta);
+
+   int type;
+   
+   WPtr<Grid3D> grid;
+   SPtr<GbObject3D> geoObject3D;
+
+   std::vector<SPtr<Block3D> > bcBlocks;
+   std::vector<SPtr<Block3D> > solidBlocks;
+   int accuracy;
+   
+   bool active;
+   int id;
+
+public:
+   static const int SOLID	            ;//= (1<<0); //1
+   static const int INVERSESOLID       ;//= (1<<1); //2
+   static const int TIMEDEPENDENT      ;//= (1<<2); //4   //zeitlich
+   static const int FLUID              ;//= (1<<3); //8
+   static const int MOVEABLE           ;//= (1<<4); //16  // geometrisch
+   static const int CHANGENOTNECESSARY ;//= (1<<5); //32
+
+private:
+
+};
+
+
+
+#endif
diff --git a/src/cpu/VirtualFluidsCore/Interactors/InteractorsHelper.cpp b/src/cpu/VirtualFluidsCore/Interactors/InteractorsHelper.cpp
index 62340a47e0c3a3d7504a8a029fcc81f66af653a7..67e3a9b3fef68e48ae4e5379176edd2cdcd770d9 100644
--- a/src/cpu/VirtualFluidsCore/Interactors/InteractorsHelper.cpp
+++ b/src/cpu/VirtualFluidsCore/Interactors/InteractorsHelper.cpp
@@ -1,119 +1,119 @@
-//=======================================================================================
-// ____          ____    __    ______     __________   __      __       __        __         
-// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
-//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
-//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
-//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
-//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
-//      \    \  |    |   ________________________________________________________________    
-//       \    \ |    |  |  ______________________________________________________________|   
-//        \    \|    |  |  |         __          __     __     __     ______      _______    
-//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
-//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
-//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
-//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
-//
-//  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>
-#include <Grid3D.h>
-#include <Interactor3D.h>
-#include "Block3D.h"
-#include "Communicator.h"
-#include "SetSolidBlocksBlockVisitor.h"
-#include "SetBcBlocksBlockVisitor.h"
-
-
-InteractorsHelper::InteractorsHelper(SPtr<Grid3D> grid, SPtr<Grid3DVisitor> visitor, bool deleteBlocks) :
-                                     grid(grid), visitor(visitor), deleteBlocks(deleteBlocks)
-{
-
-}
-//////////////////////////////////////////////////////////////////////////
-InteractorsHelper::~InteractorsHelper()
-{
-
-}
-//////////////////////////////////////////////////////////////////////////
-void InteractorsHelper::addInteractor( SPtr<Interactor3D> interactor )
-{
-   interactors.push_back(interactor);
-}
-//////////////////////////////////////////////////////////////////////////
-void InteractorsHelper::setBC()
-{
-    for(SPtr<Interactor3D> i : interactors)
-        i->initInteractor();
-}
-
-void InteractorsHelper::sendDomainDecompositionVisitor() const
-{
-    grid->accept( visitor );
-}
-
-//////////////////////////////////////////////////////////////////////////
-void InteractorsHelper::selectBlocks()
-{
-   sendDomainDecompositionVisitor();
-   deleteSolidBlocks();
-
-   sendDomainDecompositionVisitor();
-   setBcBlocks();
-}
-//////////////////////////////////////////////////////////////////////////
-void InteractorsHelper::deleteSolidBlocks()
-{
-    for(SPtr<Interactor3D> interactor : interactors)
-    {
-        SetSolidBlocksBlockVisitor v(interactor);
-        grid->accept(v);
-        if (deleteBlocks)
-        {
-           std::vector<SPtr<Block3D>>& sb = interactor->getSolidBlockSet();
-           solidBlocks.insert(solidBlocks.end(), sb.begin(), sb.end());
-           interactor->removeSolidBlocks();
-        }
-    }
-
-   if (deleteBlocks) updateGrid();
-}
-//////////////////////////////////////////////////////////////////////////
-void InteractorsHelper::setBcBlocks()
-{
-    for(const SPtr<Interactor3D> interactor : interactors)
-    {
-       SetBcBlocksBlockVisitor v(interactor);
-       grid->accept(v);
-    }
-}
-//////////////////////////////////////////////////////////////////////////
-void InteractorsHelper::updateGrid()
-{
-    std::vector<int> ids;
-
-    for(const SPtr<Block3D> block : solidBlocks)
-        ids.push_back(block->getGlobalID());
-
-    std::vector<int> rids;
-    Communicator::getInstance()->allGather(ids, rids);
-    grid->deleteBlocks(rids);
-}
-
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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>
+#include <Grid3D.h>
+#include <Interactor3D.h>
+#include "Block3D.h"
+#include "Communicator.h"
+#include "SetSolidBlocksBlockVisitor.h"
+#include "SetBcBlocksBlockVisitor.h"
+
+
+InteractorsHelper::InteractorsHelper(SPtr<Grid3D> grid, SPtr<Grid3DVisitor> visitor, bool deleteBlocks) :
+                                     grid(grid), visitor(visitor), deleteBlocks(deleteBlocks)
+{
+
+}
+//////////////////////////////////////////////////////////////////////////
+InteractorsHelper::~InteractorsHelper()
+{
+
+}
+//////////////////////////////////////////////////////////////////////////
+void InteractorsHelper::addInteractor( SPtr<Interactor3D> interactor )
+{
+   interactors.push_back(interactor);
+}
+//////////////////////////////////////////////////////////////////////////
+void InteractorsHelper::setBC()
+{
+    for(SPtr<Interactor3D> i : interactors)
+        i->initInteractor();
+}
+
+void InteractorsHelper::sendDomainDecompositionVisitor() const
+{
+    grid->accept( visitor );
+}
+
+//////////////////////////////////////////////////////////////////////////
+void InteractorsHelper::selectBlocks()
+{
+   sendDomainDecompositionVisitor();
+   deleteSolidBlocks();
+
+   sendDomainDecompositionVisitor();
+   setBcBlocks();
+}
+//////////////////////////////////////////////////////////////////////////
+void InteractorsHelper::deleteSolidBlocks()
+{
+    for(SPtr<Interactor3D> interactor : interactors)
+    {
+        SetSolidBlocksBlockVisitor v(interactor);
+        grid->accept(v);
+        if (deleteBlocks)
+        {
+           std::vector<SPtr<Block3D>>& sb = interactor->getSolidBlockSet();
+           solidBlocks.insert(solidBlocks.end(), sb.begin(), sb.end());
+           interactor->removeSolidBlocks();
+        }
+    }
+
+   if (deleteBlocks) updateGrid();
+}
+//////////////////////////////////////////////////////////////////////////
+void InteractorsHelper::setBcBlocks()
+{
+    for(const SPtr<Interactor3D> interactor : interactors)
+    {
+       SetBcBlocksBlockVisitor v(interactor);
+       grid->accept(v);
+    }
+}
+//////////////////////////////////////////////////////////////////////////
+void InteractorsHelper::updateGrid()
+{
+    std::vector<int> ids;
+
+    for(const SPtr<Block3D> block : solidBlocks)
+        ids.push_back(block->getGlobalID());
+
+    std::vector<int> rids;
+    Communicator::getInstance()->allGather(ids, rids);
+    grid->deleteBlocks(rids);
+}
+
diff --git a/src/cpu/VirtualFluidsCore/Interactors/InteractorsHelper.h b/src/cpu/VirtualFluidsCore/Interactors/InteractorsHelper.h
index 87aad25747e77b5c68a35f24f85586dba71caf24..3d6d30f0cbe95e4b52ca26403e049ecb52c3ead8 100644
--- a/src/cpu/VirtualFluidsCore/Interactors/InteractorsHelper.h
+++ b/src/cpu/VirtualFluidsCore/Interactors/InteractorsHelper.h
@@ -1,72 +1,72 @@
-//=======================================================================================
-// ____          ____    __    ______     __________   __      __       __        __         
-// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
-//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
-//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
-//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
-//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
-//      \    \  |    |   ________________________________________________________________    
-//       \    \ |    |  |  ______________________________________________________________|   
-//        \    \|    |  |  |         __          __     __     __     ______      _______    
-//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
-//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
-//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
-//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
-//
-//  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>
-
-
-class Interactor3D;
-class Block3D;
-class Grid3D;
-class Grid3DVisitor;
-
-//! A helper class for grid generation.
-class InteractorsHelper
-{
-public:
-   InteractorsHelper(SPtr<Grid3D> grid, SPtr<Grid3DVisitor> visitor, bool deleteBlocks=true);
-   ~InteractorsHelper();
-
-   void addInteractor(SPtr<Interactor3D> interactor);
-   void selectBlocks();
-   void setBC();
-   void sendDomainDecompositionVisitor() const;
-
-protected:
-   void deleteSolidBlocks();
-   void setBcBlocks();
-
-private:
-   void updateGrid();
-
-   std::vector<SPtr<Interactor3D> > interactors;
-   SPtr<Grid3D> grid;
-   std::vector<SPtr<Block3D> > solidBlocks;
-   SPtr<Grid3DVisitor> visitor;
-   bool deleteBlocks;
-};
-
-#endif
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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>
+
+
+class Interactor3D;
+class Block3D;
+class Grid3D;
+class Grid3DVisitor;
+
+//! A helper class for grid generation.
+class InteractorsHelper
+{
+public:
+   InteractorsHelper(SPtr<Grid3D> grid, SPtr<Grid3DVisitor> visitor, bool deleteBlocks=true);
+   ~InteractorsHelper();
+
+   void addInteractor(SPtr<Interactor3D> interactor);
+   void selectBlocks();
+   void setBC();
+   void sendDomainDecompositionVisitor() const;
+
+protected:
+   void deleteSolidBlocks();
+   void setBcBlocks();
+
+private:
+   void updateGrid();
+
+   std::vector<SPtr<Interactor3D> > interactors;
+   SPtr<Grid3D> grid;
+   std::vector<SPtr<Block3D> > solidBlocks;
+   SPtr<Grid3DVisitor> visitor;
+   bool deleteBlocks;
+};
+
+#endif
diff --git a/src/cpu/VirtualFluidsCore/LBM/CompressibleCumulantLBMKernel.h b/src/cpu/VirtualFluidsCore/LBM/CompressibleCumulantLBMKernel.h
index bfededbe6747073723f229cce4e54127c298a4c2..353fc4b539b1f3f4fe05c1e814bc3bc1c7efe0c2 100644
--- a/src/cpu/VirtualFluidsCore/LBM/CompressibleCumulantLBMKernel.h
+++ b/src/cpu/VirtualFluidsCore/LBM/CompressibleCumulantLBMKernel.h
@@ -1,53 +1,53 @@
-#ifndef CompressibleCumulantLBMKernel_h__
-#define CompressibleCumulantLBMKernel_h__
-
-#include "LBMKernel.h"
-#include "BCProcessor.h"
-#include "D3Q27System.h"
-#include "basics/utilities/UbTiming.h"
-#include "basics/container/CbArray4D.h"
-#include "basics/container/CbArray3D.h"
-
-//! \brief   compressible cumulant LBM kernel. 
-//! \details CFD solver that use Cascaded Cumulant Lattice Boltzmann method for D3Q27 model
-//! \author  K. Kutscher, M. Geier
-class CompressibleCumulantLBMKernel :  public LBMKernel
-{
-public:
-   //! This option set relaxation parameter: NORMAL  
-   enum Parameter{NORMAL, MAGIC};
-public:
-   CompressibleCumulantLBMKernel();
-   virtual ~CompressibleCumulantLBMKernel(void);
-   virtual void calculate(int step);
-   virtual SPtr<LBMKernel> clone();
-   double getCalculationTime();
-   void setBulkOmegaToOmega(bool value);
-   void setRelaxationParameter(Parameter p);
-protected:
-   virtual void initDataSet();
-   LBMReal f[D3Q27System::ENDF+1];
-
-   UbTimer timer;
-
-   LBMReal OxyyMxzz;
-   Parameter parameter;
-
-   CbArray4D<LBMReal,IndexerX4X3X2X1>::CbArray4DPtr localDistributions;
-   CbArray4D<LBMReal,IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributions;
-   CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr   zeroDistributions;
-
-   mu::value_type muX1,muX2,muX3;
-   mu::value_type muDeltaT;
-   mu::value_type muNu;
-   LBMReal forcingX1;
-   LBMReal forcingX2;
-   LBMReal forcingX3;
-   
-   // bulk viscosity
-   bool bulkOmegaToOmega;
-   LBMReal OxxPyyPzz; 
-};
-#endif // CompressibleCumulantLBMKernel_h__
-
-
+#ifndef CompressibleCumulantLBMKernel_h__
+#define CompressibleCumulantLBMKernel_h__
+
+#include "LBMKernel.h"
+#include "BCProcessor.h"
+#include "D3Q27System.h"
+#include "basics/utilities/UbTiming.h"
+#include "basics/container/CbArray4D.h"
+#include "basics/container/CbArray3D.h"
+
+//! \brief   compressible cumulant LBM kernel. 
+//! \details CFD solver that use Cascaded Cumulant Lattice Boltzmann method for D3Q27 model
+//! \author  K. Kutscher, M. Geier
+class CompressibleCumulantLBMKernel :  public LBMKernel
+{
+public:
+   //! This option set relaxation parameter: NORMAL  
+   enum Parameter{NORMAL, MAGIC};
+public:
+   CompressibleCumulantLBMKernel();
+   virtual ~CompressibleCumulantLBMKernel(void);
+   virtual void calculate(int step);
+   virtual SPtr<LBMKernel> clone();
+   double getCalculationTime();
+   void setBulkOmegaToOmega(bool value);
+   void setRelaxationParameter(Parameter p);
+protected:
+   virtual void initDataSet();
+   LBMReal f[D3Q27System::ENDF+1];
+
+   UbTimer timer;
+
+   LBMReal OxyyMxzz;
+   Parameter parameter;
+
+   CbArray4D<LBMReal,IndexerX4X3X2X1>::CbArray4DPtr localDistributions;
+   CbArray4D<LBMReal,IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributions;
+   CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr   zeroDistributions;
+
+   mu::value_type muX1,muX2,muX3;
+   mu::value_type muDeltaT;
+   mu::value_type muNu;
+   LBMReal forcingX1;
+   LBMReal forcingX2;
+   LBMReal forcingX3;
+   
+   // bulk viscosity
+   bool bulkOmegaToOmega;
+   LBMReal OxxPyyPzz; 
+};
+#endif // CompressibleCumulantLBMKernel_h__
+
+
diff --git a/src/cpu/VirtualFluidsCore/LBM/CompressibleOffsetInterpolationProcessor.cpp b/src/cpu/VirtualFluidsCore/LBM/CompressibleOffsetInterpolationProcessor.cpp
index 7716a246eb7998df47c35666f46a61bd86293082..971e0e8bc13fc67050671c5ac2d3e2971827b648 100644
--- a/src/cpu/VirtualFluidsCore/LBM/CompressibleOffsetInterpolationProcessor.cpp
+++ b/src/cpu/VirtualFluidsCore/LBM/CompressibleOffsetInterpolationProcessor.cpp
@@ -1,722 +1,722 @@
-#include "CompressibleOffsetInterpolationProcessor.h"
-#include "D3Q27System.h"
-
-using namespace UbMath;
-
-CompressibleOffsetInterpolationProcessor::CompressibleOffsetInterpolationProcessor()
-   : omegaC(0.0), omegaF(0.0)
-{
-   //forcingC = 0; //9.99685e-7;
-   //forcingF = 0; //forcingC*0.5;
-}
-//////////////////////////////////////////////////////////////////////////
-CompressibleOffsetInterpolationProcessor::CompressibleOffsetInterpolationProcessor(LBMReal omegaC, LBMReal omegaF)
-   : omegaC(omegaC), omegaF(omegaF)
-{
-
-}
-//////////////////////////////////////////////////////////////////////////
-CompressibleOffsetInterpolationProcessor::~CompressibleOffsetInterpolationProcessor()
-{
-
-}
-//////////////////////////////////////////////////////////////////////////
-InterpolationProcessorPtr CompressibleOffsetInterpolationProcessor::clone()
-{
-   InterpolationProcessorPtr iproc = InterpolationProcessorPtr (new CompressibleOffsetInterpolationProcessor(this->omegaC, this->omegaF));
-   //dynamicPointerCast<D3Q27IncompressibleOffsetInterpolationProcessor>(iproc)->forcingC = forcingC;
-   //dynamicPointerCast<D3Q27IncompressibleOffsetInterpolationProcessor>(iproc)->forcingF = forcingF;
-   return iproc;
-}
-//////////////////////////////////////////////////////////////////////////
-void CompressibleOffsetInterpolationProcessor::setOmegas( LBMReal omegaC, LBMReal omegaF )
-{
-   this->omegaC = omegaC;
-   this->omegaF = omegaF;
-}
-//////////////////////////////////////////////////////////////////////////
-void CompressibleOffsetInterpolationProcessor::setOffsets(LBMReal xoff, LBMReal yoff, LBMReal zoff)
-{
-   this->xoff = xoff;
-   this->yoff = yoff;
-   this->zoff = zoff;     
-   this->xoff_sq = xoff * xoff;
-   this->yoff_sq = yoff * yoff;
-   this->zoff_sq = zoff * zoff;
-}
-//////////////////////////////////////////////////////////////////////////
-void CompressibleOffsetInterpolationProcessor::interpolateCoarseToFine(D3Q27ICell& icellC, D3Q27ICell& icellF, LBMReal xoff, LBMReal yoff, LBMReal zoff)
-{
-   setOffsets(xoff, yoff, zoff);
-   calcInterpolatedCoefficiets(icellC, omegaC, 0.5);
-   calcInterpolatedNodeCF(icellF.BSW, omegaF, -0.25, -0.25, -0.25, calcPressBSW(), -1, -1, -1);
-   calcInterpolatedNodeCF(icellF.BNE, omegaF,  0.25,  0.25, -0.25, calcPressBNE(),  1,  1, -1);
-   calcInterpolatedNodeCF(icellF.TNW, omegaF, -0.25,  0.25,  0.25, calcPressTNW(), -1,  1,  1);
-   calcInterpolatedNodeCF(icellF.TSE, omegaF,  0.25, -0.25,  0.25, calcPressTSE(),  1, -1,  1);
-   calcInterpolatedNodeCF(icellF.BNW, omegaF, -0.25,  0.25, -0.25, calcPressBNW(), -1,  1, -1);
-   calcInterpolatedNodeCF(icellF.BSE, omegaF,  0.25, -0.25, -0.25, calcPressBSE(),  1, -1, -1);
-   calcInterpolatedNodeCF(icellF.TSW, omegaF, -0.25, -0.25,  0.25, calcPressTSW(), -1, -1,  1);
-   calcInterpolatedNodeCF(icellF.TNE, omegaF,  0.25,  0.25,  0.25, calcPressTNE(),  1,  1,  1);
-}
-//////////////////////////////////////////////////////////////////////////
-void CompressibleOffsetInterpolationProcessor::interpolateFineToCoarse(D3Q27ICell& icellF, LBMReal* icellC, LBMReal xoff, LBMReal yoff, LBMReal zoff)
-{
-   setOffsets(xoff, yoff, zoff);
-   calcInterpolatedCoefficiets(icellF, omegaF, 2.0);
-   calcInterpolatedNodeFC(icellC, omegaC);
-}
-//////////////////////////////////////////////////////////////////////////
-void CompressibleOffsetInterpolationProcessor::calcMoments(const LBMReal* const f, LBMReal omega, LBMReal& press, LBMReal& vx1, LBMReal& vx2, LBMReal& vx3, 
-                                                    LBMReal& kxy, LBMReal& kyz, LBMReal& kxz, LBMReal& kxxMyy, LBMReal& kxxMzz)
-{
-   using namespace D3Q27System;
-
-   LBMReal drho = 0.0;
-   D3Q27System::calcCompMacroscopicValues(f,drho,vx1,vx2,vx3);
-   
-   press = drho; //interpolate rho!
-
-   kxy   = -3.*omega*((((f[TSW]+f[BNE])-(f[TNW]+f[BSE]))+((f[BSW]+f[TNE])-(f[BNW]+f[TSE])))+((f[SW]+f[NE])-(f[NW]+f[SE]))/(one + drho)-(vx1*vx2));// might not be optimal MG 25.2.13
-   kyz   = -3.*omega*((((f[BSW]+f[TNE])-(f[TSE]+f[BNW]))+((f[BSE]+f[TNW])-(f[TSW]+f[BNE])))+((f[BS]+f[TN])-(f[TS]+f[BN]))/(one + drho)-(vx2*vx3));
-   kxz   = -3.*omega*((((f[BNW]+f[TSE])-(f[TSW]+f[BNE]))+((f[BSW]+f[TNE])-(f[BSE]+f[TNW])))+((f[BW]+f[TE])-(f[TW]+f[BE]))/(one + drho)-(vx1*vx3));
-   kxxMyy = -3./2.*omega*((((f[BW]+f[TE])-(f[BS]+f[TN]))+((f[TW]+f[BE])-(f[TS]+f[BN])))+((f[W]+f[E])-(f[S]+f[N]))/(one + drho)-(vx1*vx1-vx2*vx2));
-   kxxMzz = -3./2.*omega*((((f[NW]+f[SE])-(f[BS]+f[TN]))+((f[SW]+f[NE])-(f[TS]+f[BN])))+((f[W]+f[E])-(f[B]+f[T]))/(one + drho)-(vx1*vx1-vx3*vx3));
-}
-//////////////////////////////////////////////////////////////////////////
-void CompressibleOffsetInterpolationProcessor::calcInterpolatedCoefficiets(const D3Q27ICell& icell, LBMReal omega, LBMReal eps_new)
-{
-   LBMReal        vx1_SWT,vx2_SWT,vx3_SWT;
-   LBMReal        vx1_NWT,vx2_NWT,vx3_NWT;
-   LBMReal        vx1_NET,vx2_NET,vx3_NET;
-   LBMReal        vx1_SET,vx2_SET,vx3_SET;
-   LBMReal        vx1_SWB,vx2_SWB,vx3_SWB;
-   LBMReal        vx1_NWB,vx2_NWB,vx3_NWB;
-   LBMReal        vx1_NEB,vx2_NEB,vx3_NEB;
-   LBMReal        vx1_SEB,vx2_SEB,vx3_SEB;
-
-   LBMReal        kxyFromfcNEQ_SWT, kyzFromfcNEQ_SWT, kxzFromfcNEQ_SWT, kxxMyyFromfcNEQ_SWT, kxxMzzFromfcNEQ_SWT;
-   LBMReal        kxyFromfcNEQ_NWT, kyzFromfcNEQ_NWT, kxzFromfcNEQ_NWT, kxxMyyFromfcNEQ_NWT, kxxMzzFromfcNEQ_NWT;
-   LBMReal        kxyFromfcNEQ_NET, kyzFromfcNEQ_NET, kxzFromfcNEQ_NET, kxxMyyFromfcNEQ_NET, kxxMzzFromfcNEQ_NET;
-   LBMReal        kxyFromfcNEQ_SET, kyzFromfcNEQ_SET, kxzFromfcNEQ_SET, kxxMyyFromfcNEQ_SET, kxxMzzFromfcNEQ_SET;
-   LBMReal        kxyFromfcNEQ_SWB, kyzFromfcNEQ_SWB, kxzFromfcNEQ_SWB, kxxMyyFromfcNEQ_SWB, kxxMzzFromfcNEQ_SWB;
-   LBMReal        kxyFromfcNEQ_NWB, kyzFromfcNEQ_NWB, kxzFromfcNEQ_NWB, kxxMyyFromfcNEQ_NWB, kxxMzzFromfcNEQ_NWB;
-   LBMReal        kxyFromfcNEQ_NEB, kyzFromfcNEQ_NEB, kxzFromfcNEQ_NEB, kxxMyyFromfcNEQ_NEB, kxxMzzFromfcNEQ_NEB;
-   LBMReal        kxyFromfcNEQ_SEB, kyzFromfcNEQ_SEB, kxzFromfcNEQ_SEB, kxxMyyFromfcNEQ_SEB, kxxMzzFromfcNEQ_SEB;
-
-   calcMoments(icell.TSW,omega,press_SWT,vx1_SWT,vx2_SWT,vx3_SWT, kxyFromfcNEQ_SWT, kyzFromfcNEQ_SWT, kxzFromfcNEQ_SWT, kxxMyyFromfcNEQ_SWT, kxxMzzFromfcNEQ_SWT);
-   calcMoments(icell.TNW,omega,press_NWT,vx1_NWT,vx2_NWT,vx3_NWT, kxyFromfcNEQ_NWT, kyzFromfcNEQ_NWT, kxzFromfcNEQ_NWT, kxxMyyFromfcNEQ_NWT, kxxMzzFromfcNEQ_NWT);
-   calcMoments(icell.TNE,omega,press_NET,vx1_NET,vx2_NET,vx3_NET, kxyFromfcNEQ_NET, kyzFromfcNEQ_NET, kxzFromfcNEQ_NET, kxxMyyFromfcNEQ_NET, kxxMzzFromfcNEQ_NET);
-   calcMoments(icell.TSE,omega,press_SET,vx1_SET,vx2_SET,vx3_SET, kxyFromfcNEQ_SET, kyzFromfcNEQ_SET, kxzFromfcNEQ_SET, kxxMyyFromfcNEQ_SET, kxxMzzFromfcNEQ_SET);
-   calcMoments(icell.BSW,omega,press_SWB,vx1_SWB,vx2_SWB,vx3_SWB, kxyFromfcNEQ_SWB, kyzFromfcNEQ_SWB, kxzFromfcNEQ_SWB, kxxMyyFromfcNEQ_SWB, kxxMzzFromfcNEQ_SWB);
-   calcMoments(icell.BNW,omega,press_NWB,vx1_NWB,vx2_NWB,vx3_NWB, kxyFromfcNEQ_NWB, kyzFromfcNEQ_NWB, kxzFromfcNEQ_NWB, kxxMyyFromfcNEQ_NWB, kxxMzzFromfcNEQ_NWB);
-   calcMoments(icell.BNE,omega,press_NEB,vx1_NEB,vx2_NEB,vx3_NEB, kxyFromfcNEQ_NEB, kyzFromfcNEQ_NEB, kxzFromfcNEQ_NEB, kxxMyyFromfcNEQ_NEB, kxxMzzFromfcNEQ_NEB);
-   calcMoments(icell.BSE,omega,press_SEB,vx1_SEB,vx2_SEB,vx3_SEB, kxyFromfcNEQ_SEB, kyzFromfcNEQ_SEB, kxzFromfcNEQ_SEB, kxxMyyFromfcNEQ_SEB, kxxMzzFromfcNEQ_SEB);
-
-   //LBMReal dxRho=c1o4*((press_NET-press_SWB)+(press_SET-press_NWB)+(press_NEB-press_SWT)+(press_SEB-press_NWT));
-   //LBMReal dyRho=c1o4*((press_NET-press_SWB)-(press_SET-press_NWB)+(press_NEB-press_SWT)-(press_SEB-press_NWT));
-   //LBMReal dzRho=c1o4*((press_NET-press_SWB)+(press_SET-press_NWB)-(press_NEB-press_SWT)-(press_SEB-press_NWT));
-
-   //   kxyFromfcNEQ_SWT+=vx1_SWT*dyRho+vx2_SWT*dxRho;
-   //   kxyFromfcNEQ_NWT+=vx1_NWT*dyRho+vx2_NWT*dxRho;
-   //   kxyFromfcNEQ_NET+=vx1_NET*dyRho+vx2_NET*dxRho;
-   //   kxyFromfcNEQ_SET+=vx1_SET*dyRho+vx2_SET*dxRho;
-   //   kxyFromfcNEQ_SWB+=vx1_SWB*dyRho+vx2_SWB*dxRho;
-   //   kxyFromfcNEQ_NWB+=vx1_NWB*dyRho+vx2_NWB*dxRho;
-   //   kxyFromfcNEQ_NEB+=vx1_NEB*dyRho+vx2_NEB*dxRho;
-   //   kxyFromfcNEQ_SEB+=vx1_SEB*dyRho+vx2_SEB*dxRho;
-
-   //   kyzFromfcNEQ_SWT+=vx3_SWT*dyRho+vx2_SWT*dzRho;
-   //   kyzFromfcNEQ_NWT+=vx3_NWT*dyRho+vx2_NWT*dzRho;
-   //   kyzFromfcNEQ_NET+=vx3_NET*dyRho+vx2_NET*dzRho;
-   //   kyzFromfcNEQ_SET+=vx3_SET*dyRho+vx2_SET*dzRho;
-   //   kyzFromfcNEQ_SWB+=vx3_SWB*dyRho+vx2_SWB*dzRho;
-   //   kyzFromfcNEQ_NWB+=vx3_NWB*dyRho+vx2_NWB*dzRho;
-   //   kyzFromfcNEQ_NEB+=vx3_NEB*dyRho+vx2_NEB*dzRho;
-   //   kyzFromfcNEQ_SEB+=vx3_SEB*dyRho+vx2_SEB*dzRho;
-
-   //   kxzFromfcNEQ_SWT+=vx1_SWT*dzRho+vx3_SWT*dxRho;
-   //   kxzFromfcNEQ_NWT+=vx1_NWT*dzRho+vx3_NWT*dxRho;
-   //   kxzFromfcNEQ_NET+=vx1_NET*dzRho+vx3_NET*dxRho;
-   //   kxzFromfcNEQ_SET+=vx1_SET*dzRho+vx3_SET*dxRho;
-   //   kxzFromfcNEQ_SWB+=vx1_SWB*dzRho+vx3_SWB*dxRho;
-   //   kxzFromfcNEQ_NWB+=vx1_NWB*dzRho+vx3_NWB*dxRho;
-   //   kxzFromfcNEQ_NEB+=vx1_NEB*dzRho+vx3_NEB*dxRho;
-   //   kxzFromfcNEQ_SEB+=vx1_SEB*dzRho+vx3_SEB*dxRho;
-
-   //   kxxMyyFromfcNEQ_SWT+=vx1_SWT*dxRho-vx2_SWT*dyRho;
-   //   kxxMyyFromfcNEQ_NWT+=vx1_NWT*dxRho-vx2_NWT*dyRho;
-   //   kxxMyyFromfcNEQ_NET+=vx1_NET*dxRho-vx2_NET*dyRho;
-   //   kxxMyyFromfcNEQ_SET+=vx1_SET*dxRho-vx2_SET*dyRho;
-   //   kxxMyyFromfcNEQ_SWB+=vx1_SWB*dxRho-vx2_SWB*dyRho;
-   //   kxxMyyFromfcNEQ_NWB+=vx1_NWB*dxRho-vx2_NWB*dyRho;
-   //   kxxMyyFromfcNEQ_NEB+=vx1_NEB*dxRho-vx2_NEB*dyRho;
-   //   kxxMyyFromfcNEQ_SEB+=vx1_SEB*dxRho-vx2_SEB*dyRho;
-
-   //   kxxMzzFromfcNEQ_SWT+=vx1_SWT*dxRho-vx3_SWT*dzRho;
-   //   kxxMzzFromfcNEQ_NWT+=vx1_NWT*dxRho-vx3_NWT*dzRho;
-   //   kxxMzzFromfcNEQ_NET+=vx1_NET*dxRho-vx3_NET*dzRho;
-   //   kxxMzzFromfcNEQ_SET+=vx1_SET*dxRho-vx3_SET*dzRho;
-   //   kxxMzzFromfcNEQ_SWB+=vx1_SWB*dxRho-vx3_SWB*dzRho;
-   //   kxxMzzFromfcNEQ_NWB+=vx1_NWB*dxRho-vx3_NWB*dzRho;
-   //   kxxMzzFromfcNEQ_NEB+=vx1_NEB*dxRho-vx3_NEB*dzRho;
-   //   kxxMzzFromfcNEQ_SEB+=vx1_SEB*dxRho-vx3_SEB*dzRho;
-
-
-      //kxxMzzFromfcNEQ_SWT=0.0;
-      //kxxMzzFromfcNEQ_NWT=0.0;
-      //kxxMzzFromfcNEQ_NET=0.0;
-      //kxxMzzFromfcNEQ_SET=0.0;
-      //kxxMzzFromfcNEQ_SWB=0.0;
-      //kxxMzzFromfcNEQ_NWB=0.0;
-      //kxxMzzFromfcNEQ_NEB=0.0;
-      //kxxMzzFromfcNEQ_SEB=0.0;
-
-
-
-
-
-   a0 = (-kxxMyyFromfcNEQ_NEB - kxxMyyFromfcNEQ_NET + kxxMyyFromfcNEQ_NWB + kxxMyyFromfcNEQ_NWT -
-      kxxMyyFromfcNEQ_SEB - kxxMyyFromfcNEQ_SET + kxxMyyFromfcNEQ_SWB + kxxMyyFromfcNEQ_SWT -
-      kxxMzzFromfcNEQ_NEB - kxxMzzFromfcNEQ_NET + kxxMzzFromfcNEQ_NWB + kxxMzzFromfcNEQ_NWT -
-      kxxMzzFromfcNEQ_SEB - kxxMzzFromfcNEQ_SET + kxxMzzFromfcNEQ_SWB + kxxMzzFromfcNEQ_SWT -
-      2.*kxyFromfcNEQ_NEB - 2.*kxyFromfcNEQ_NET - 2.*kxyFromfcNEQ_NWB - 2.*kxyFromfcNEQ_NWT +
-      2.*kxyFromfcNEQ_SEB + 2.*kxyFromfcNEQ_SET + 2.*kxyFromfcNEQ_SWB + 2.*kxyFromfcNEQ_SWT +
-      2.*kxzFromfcNEQ_NEB - 2.*kxzFromfcNEQ_NET + 2.*kxzFromfcNEQ_NWB - 2.*kxzFromfcNEQ_NWT +
-      2.*kxzFromfcNEQ_SEB - 2.*kxzFromfcNEQ_SET + 2.*kxzFromfcNEQ_SWB - 2.*kxzFromfcNEQ_SWT +
-      8.*vx1_NEB + 8.*vx1_NET + 8.*vx1_NWB + 8.*vx1_NWT + 8.*vx1_SEB +
-      8.*vx1_SET + 8.*vx1_SWB + 8.*vx1_SWT + 2.*vx2_NEB + 2.*vx2_NET -
-      2.*vx2_NWB - 2.*vx2_NWT - 2.*vx2_SEB - 2.*vx2_SET + 2.*vx2_SWB +
-      2.*vx2_SWT - 2.*vx3_NEB + 2.*vx3_NET + 2.*vx3_NWB - 2.*vx3_NWT -
-      2.*vx3_SEB + 2.*vx3_SET + 2.*vx3_SWB - 2.*vx3_SWT)/64.;
-   b0 = (2.*kxxMyyFromfcNEQ_NEB + 2.*kxxMyyFromfcNEQ_NET + 2.*kxxMyyFromfcNEQ_NWB + 2.*kxxMyyFromfcNEQ_NWT -
-      2.*kxxMyyFromfcNEQ_SEB - 2.*kxxMyyFromfcNEQ_SET - 2.*kxxMyyFromfcNEQ_SWB - 2.*kxxMyyFromfcNEQ_SWT -
-      kxxMzzFromfcNEQ_NEB - kxxMzzFromfcNEQ_NET - kxxMzzFromfcNEQ_NWB - kxxMzzFromfcNEQ_NWT +
-      kxxMzzFromfcNEQ_SEB + kxxMzzFromfcNEQ_SET + kxxMzzFromfcNEQ_SWB + kxxMzzFromfcNEQ_SWT -
-      2.*kxyFromfcNEQ_NEB - 2.*kxyFromfcNEQ_NET + 2.*kxyFromfcNEQ_NWB + 2.*kxyFromfcNEQ_NWT -
-      2.*kxyFromfcNEQ_SEB - 2.*kxyFromfcNEQ_SET + 2.*kxyFromfcNEQ_SWB + 2.*kxyFromfcNEQ_SWT +
-      2.*kyzFromfcNEQ_NEB - 2.*kyzFromfcNEQ_NET + 2.*kyzFromfcNEQ_NWB - 2.*kyzFromfcNEQ_NWT +
-      2.*kyzFromfcNEQ_SEB - 2.*kyzFromfcNEQ_SET + 2.*kyzFromfcNEQ_SWB - 2.*kyzFromfcNEQ_SWT +
-      2.*vx1_NEB + 2.*vx1_NET - 2.*vx1_NWB - 2.*vx1_NWT -
-      2.*vx1_SEB - 2.*vx1_SET + 2.*vx1_SWB + 2.*vx1_SWT +
-      8.*vx2_NEB + 8.*vx2_NET + 8.*vx2_NWB + 8.*vx2_NWT +
-      8.*vx2_SEB + 8.*vx2_SET + 8.*vx2_SWB + 8.*vx2_SWT -
-      2.*vx3_NEB + 2.*vx3_NET - 2.*vx3_NWB + 2.*vx3_NWT +
-      2.*vx3_SEB - 2.*vx3_SET + 2.*vx3_SWB - 2.*vx3_SWT)/64.;
-   c0 = (kxxMyyFromfcNEQ_NEB - kxxMyyFromfcNEQ_NET + kxxMyyFromfcNEQ_NWB - kxxMyyFromfcNEQ_NWT +
-      kxxMyyFromfcNEQ_SEB - kxxMyyFromfcNEQ_SET + kxxMyyFromfcNEQ_SWB - kxxMyyFromfcNEQ_SWT -
-      2.*kxxMzzFromfcNEQ_NEB + 2.*kxxMzzFromfcNEQ_NET - 2.*kxxMzzFromfcNEQ_NWB + 2.*kxxMzzFromfcNEQ_NWT -
-      2.*kxxMzzFromfcNEQ_SEB + 2.*kxxMzzFromfcNEQ_SET - 2.*kxxMzzFromfcNEQ_SWB + 2.*kxxMzzFromfcNEQ_SWT -
-      2.*kxzFromfcNEQ_NEB - 2.*kxzFromfcNEQ_NET + 2.*kxzFromfcNEQ_NWB + 2.*kxzFromfcNEQ_NWT -
-      2.*kxzFromfcNEQ_SEB - 2.*kxzFromfcNEQ_SET + 2.*kxzFromfcNEQ_SWB + 2.*kxzFromfcNEQ_SWT -
-      2.*kyzFromfcNEQ_NEB - 2.*kyzFromfcNEQ_NET - 2.*kyzFromfcNEQ_NWB - 2.*kyzFromfcNEQ_NWT +
-      2.*kyzFromfcNEQ_SEB + 2.*kyzFromfcNEQ_SET + 2.*kyzFromfcNEQ_SWB + 2.*kyzFromfcNEQ_SWT -
-      2.*vx1_NEB + 2.*vx1_NET + 2.*vx1_NWB - 2.*vx1_NWT -
-      2.*vx1_SEB + 2.*vx1_SET + 2.*vx1_SWB - 2.*vx1_SWT -
-      2.*vx2_NEB + 2.*vx2_NET - 2.*vx2_NWB + 2.*vx2_NWT +
-      2.*vx2_SEB - 2.*vx2_SET + 2.*vx2_SWB - 2.*vx2_SWT +
-      8.*vx3_NEB + 8.*vx3_NET + 8.*vx3_NWB + 8.*vx3_NWT +
-      8.*vx3_SEB + 8.*vx3_SET + 8.*vx3_SWB + 8.*vx3_SWT)/64.;
-   ax = (vx1_NEB + vx1_NET - vx1_NWB - vx1_NWT + vx1_SEB + vx1_SET - vx1_SWB - vx1_SWT)/4.;
-   bx = (vx2_NEB + vx2_NET - vx2_NWB - vx2_NWT + vx2_SEB + vx2_SET - vx2_SWB - vx2_SWT)/4.;
-   cx = (vx3_NEB + vx3_NET - vx3_NWB - vx3_NWT + vx3_SEB + vx3_SET - vx3_SWB - vx3_SWT)/4.;
-   axx= (kxxMyyFromfcNEQ_NEB + kxxMyyFromfcNEQ_NET - kxxMyyFromfcNEQ_NWB - kxxMyyFromfcNEQ_NWT +
-      kxxMyyFromfcNEQ_SEB + kxxMyyFromfcNEQ_SET - kxxMyyFromfcNEQ_SWB - kxxMyyFromfcNEQ_SWT +
-      kxxMzzFromfcNEQ_NEB + kxxMzzFromfcNEQ_NET - kxxMzzFromfcNEQ_NWB - kxxMzzFromfcNEQ_NWT +
-      kxxMzzFromfcNEQ_SEB + kxxMzzFromfcNEQ_SET - kxxMzzFromfcNEQ_SWB - kxxMzzFromfcNEQ_SWT +
-      2.*vx2_NEB + 2.*vx2_NET - 2.*vx2_NWB - 2.*vx2_NWT -
-      2.*vx2_SEB - 2.*vx2_SET + 2.*vx2_SWB + 2.*vx2_SWT -
-      2.*vx3_NEB + 2.*vx3_NET + 2.*vx3_NWB - 2.*vx3_NWT -
-      2.*vx3_SEB + 2.*vx3_SET + 2.*vx3_SWB - 2.*vx3_SWT)/16.;
-   bxx= (kxyFromfcNEQ_NEB + kxyFromfcNEQ_NET - kxyFromfcNEQ_NWB - kxyFromfcNEQ_NWT +
-      kxyFromfcNEQ_SEB + kxyFromfcNEQ_SET - kxyFromfcNEQ_SWB - kxyFromfcNEQ_SWT -
-      2.*vx1_NEB - 2.*vx1_NET + 2.*vx1_NWB + 2.*vx1_NWT +
-      2.*vx1_SEB + 2.*vx1_SET - 2.*vx1_SWB - 2.*vx1_SWT)/8.;
-   cxx= (kxzFromfcNEQ_NEB + kxzFromfcNEQ_NET - kxzFromfcNEQ_NWB - kxzFromfcNEQ_NWT +
-      kxzFromfcNEQ_SEB + kxzFromfcNEQ_SET - kxzFromfcNEQ_SWB - kxzFromfcNEQ_SWT +
-      2.*vx1_NEB - 2.*vx1_NET - 2.*vx1_NWB + 2.*vx1_NWT +
-      2.*vx1_SEB - 2.*vx1_SET - 2.*vx1_SWB + 2.*vx1_SWT)/8.;
-   ay = (vx1_NEB + vx1_NET + vx1_NWB + vx1_NWT - vx1_SEB - vx1_SET - vx1_SWB - vx1_SWT)/4.;
-   by = (vx2_NEB + vx2_NET + vx2_NWB + vx2_NWT - vx2_SEB - vx2_SET - vx2_SWB - vx2_SWT)/4.;
-   cy = (vx3_NEB + vx3_NET + vx3_NWB + vx3_NWT - vx3_SEB - vx3_SET - vx3_SWB - vx3_SWT)/4.;
-   ayy= (kxyFromfcNEQ_NEB + kxyFromfcNEQ_NET + kxyFromfcNEQ_NWB + kxyFromfcNEQ_NWT -
-      kxyFromfcNEQ_SEB - kxyFromfcNEQ_SET - kxyFromfcNEQ_SWB - kxyFromfcNEQ_SWT -
-      2.*vx2_NEB - 2.*vx2_NET + 2.*vx2_NWB + 2.*vx2_NWT +
-      2.*vx2_SEB + 2.*vx2_SET - 2.*vx2_SWB - 2.*vx2_SWT)/8.;
-   byy= (-2.*kxxMyyFromfcNEQ_NEB - 2.*kxxMyyFromfcNEQ_NET - 2.*kxxMyyFromfcNEQ_NWB - 2.*kxxMyyFromfcNEQ_NWT +
-      2.*kxxMyyFromfcNEQ_SEB + 2.*kxxMyyFromfcNEQ_SET + 2.*kxxMyyFromfcNEQ_SWB + 2.*kxxMyyFromfcNEQ_SWT +
-      kxxMzzFromfcNEQ_NEB + kxxMzzFromfcNEQ_NET + kxxMzzFromfcNEQ_NWB + kxxMzzFromfcNEQ_NWT -
-      kxxMzzFromfcNEQ_SEB - kxxMzzFromfcNEQ_SET - kxxMzzFromfcNEQ_SWB - kxxMzzFromfcNEQ_SWT +
-      2.*vx1_NEB + 2.*vx1_NET - 2.*vx1_NWB - 2.*vx1_NWT -
-      2.*vx1_SEB - 2.*vx1_SET + 2.*vx1_SWB + 2.*vx1_SWT -
-      2.*vx3_NEB + 2.*vx3_NET - 2.*vx3_NWB + 2.*vx3_NWT +
-      2.*vx3_SEB - 2.*vx3_SET + 2.*vx3_SWB - 2.*vx3_SWT)/16.;
-   cyy= (kyzFromfcNEQ_NEB + kyzFromfcNEQ_NET + kyzFromfcNEQ_NWB + kyzFromfcNEQ_NWT -
-      kyzFromfcNEQ_SEB - kyzFromfcNEQ_SET - kyzFromfcNEQ_SWB - kyzFromfcNEQ_SWT +
-      2.*vx2_NEB - 2.*vx2_NET + 2.*vx2_NWB - 2.*vx2_NWT -
-      2.*vx2_SEB + 2.*vx2_SET - 2.*vx2_SWB + 2.*vx2_SWT)/8.;
-   az = (-vx1_NEB + vx1_NET - vx1_NWB + vx1_NWT - vx1_SEB + vx1_SET - vx1_SWB + vx1_SWT)/4.;
-   bz = (-vx2_NEB + vx2_NET - vx2_NWB + vx2_NWT - vx2_SEB + vx2_SET - vx2_SWB + vx2_SWT)/4.;
-   cz = (-vx3_NEB + vx3_NET - vx3_NWB + vx3_NWT - vx3_SEB + vx3_SET - vx3_SWB + vx3_SWT)/4.;
-   azz= (-kxzFromfcNEQ_NEB + kxzFromfcNEQ_NET - kxzFromfcNEQ_NWB + kxzFromfcNEQ_NWT -
-      kxzFromfcNEQ_SEB + kxzFromfcNEQ_SET - kxzFromfcNEQ_SWB + kxzFromfcNEQ_SWT +
-      2.*vx3_NEB - 2.*vx3_NET - 2.*vx3_NWB + 2.*vx3_NWT +
-      2.*vx3_SEB - 2.*vx3_SET - 2.*vx3_SWB + 2.*vx3_SWT)/8.;
-   bzz= (-kyzFromfcNEQ_NEB + kyzFromfcNEQ_NET - kyzFromfcNEQ_NWB + kyzFromfcNEQ_NWT -
-      kyzFromfcNEQ_SEB + kyzFromfcNEQ_SET - kyzFromfcNEQ_SWB + kyzFromfcNEQ_SWT +
-      2.*vx3_NEB - 2.*vx3_NET + 2.*vx3_NWB - 2.*vx3_NWT -
-      2.*vx3_SEB + 2.*vx3_SET - 2.*vx3_SWB + 2.*vx3_SWT)/8.;
-   czz= (-kxxMyyFromfcNEQ_NEB + kxxMyyFromfcNEQ_NET - kxxMyyFromfcNEQ_NWB + kxxMyyFromfcNEQ_NWT -
-      kxxMyyFromfcNEQ_SEB + kxxMyyFromfcNEQ_SET - kxxMyyFromfcNEQ_SWB + kxxMyyFromfcNEQ_SWT +
-      2.*kxxMzzFromfcNEQ_NEB - 2.*kxxMzzFromfcNEQ_NET + 2.*kxxMzzFromfcNEQ_NWB - 2.*kxxMzzFromfcNEQ_NWT +
-      2.*kxxMzzFromfcNEQ_SEB - 2.*kxxMzzFromfcNEQ_SET + 2.*kxxMzzFromfcNEQ_SWB - 2.*kxxMzzFromfcNEQ_SWT -
-      2.*vx1_NEB + 2.*vx1_NET + 2.*vx1_NWB - 2.*vx1_NWT -
-      2.*vx1_SEB + 2.*vx1_SET + 2.*vx1_SWB - 2.*vx1_SWT -
-      2.*vx2_NEB + 2.*vx2_NET - 2.*vx2_NWB + 2.*vx2_NWT +
-      2.*vx2_SEB - 2.*vx2_SET + 2.*vx2_SWB - 2.*vx2_SWT)/16.;
-   axy= (vx1_NEB + vx1_NET - vx1_NWB - vx1_NWT - vx1_SEB - vx1_SET + vx1_SWB + vx1_SWT)/2.;
-   bxy= (vx2_NEB + vx2_NET - vx2_NWB - vx2_NWT - vx2_SEB - vx2_SET + vx2_SWB + vx2_SWT)/2.;
-   cxy= (vx3_NEB + vx3_NET - vx3_NWB - vx3_NWT - vx3_SEB - vx3_SET + vx3_SWB + vx3_SWT)/2.;
-   axz= (-vx1_NEB + vx1_NET + vx1_NWB - vx1_NWT - vx1_SEB + vx1_SET + vx1_SWB - vx1_SWT)/2.;
-   bxz= (-vx2_NEB + vx2_NET + vx2_NWB - vx2_NWT - vx2_SEB + vx2_SET + vx2_SWB - vx2_SWT)/2.;
-   cxz= (-vx3_NEB + vx3_NET + vx3_NWB - vx3_NWT - vx3_SEB + vx3_SET + vx3_SWB - vx3_SWT)/2.;
-   ayz= (-vx1_NEB + vx1_NET - vx1_NWB + vx1_NWT + vx1_SEB - vx1_SET + vx1_SWB - vx1_SWT)/2.;
-   byz= (-vx2_NEB + vx2_NET - vx2_NWB + vx2_NWT + vx2_SEB - vx2_SET + vx2_SWB - vx2_SWT)/2.;
-   cyz= (-vx3_NEB + vx3_NET - vx3_NWB + vx3_NWT + vx3_SEB - vx3_SET + vx3_SWB - vx3_SWT)/2.;
-   axyz=-vx1_NEB + vx1_NET + vx1_NWB - vx1_NWT + vx1_SEB - vx1_SET - vx1_SWB + vx1_SWT;
-   bxyz=-vx2_NEB + vx2_NET + vx2_NWB - vx2_NWT + vx2_SEB - vx2_SET - vx2_SWB + vx2_SWT;
-   cxyz=-vx3_NEB + vx3_NET + vx3_NWB - vx3_NWT + vx3_SEB - vx3_SET - vx3_SWB + vx3_SWT;
-
-
-   //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-   kxyAverage       =0;//(kxyFromfcNEQ_SWB+
-                       //kxyFromfcNEQ_SWT+
-                       //kxyFromfcNEQ_SET+
-                       //kxyFromfcNEQ_SEB+
-                       //kxyFromfcNEQ_NWB+
-                       //kxyFromfcNEQ_NWT+
-                       //kxyFromfcNEQ_NET+
-                       //kxyFromfcNEQ_NEB)*c1o8-(ay+bx);
-   kyzAverage       =0;//(kyzFromfcNEQ_SWB+
-                       //kyzFromfcNEQ_SWT+
-                       //kyzFromfcNEQ_SET+
-                       //kyzFromfcNEQ_SEB+
-                       //kyzFromfcNEQ_NWB+
-                       //kyzFromfcNEQ_NWT+
-                       //kyzFromfcNEQ_NET+
-                       //kyzFromfcNEQ_NEB)*c1o8-(bz+cy);
-   kxzAverage       =0;//(kxzFromfcNEQ_SWB+
-                       //kxzFromfcNEQ_SWT+
-                       //kxzFromfcNEQ_SET+
-                       //kxzFromfcNEQ_SEB+
-                       //kxzFromfcNEQ_NWB+
-                       //kxzFromfcNEQ_NWT+
-                       //kxzFromfcNEQ_NET+
-                       //kxzFromfcNEQ_NEB)*c1o8-(az+cx);
-   kxxMyyAverage    =0;//(kxxMyyFromfcNEQ_SWB+
-                       //kxxMyyFromfcNEQ_SWT+
-                       //kxxMyyFromfcNEQ_SET+
-                       //kxxMyyFromfcNEQ_SEB+
-                       //kxxMyyFromfcNEQ_NWB+
-                       //kxxMyyFromfcNEQ_NWT+
-                       //kxxMyyFromfcNEQ_NET+
-                       //kxxMyyFromfcNEQ_NEB)*c1o8-(ax-by);
-   kxxMzzAverage    =0;//(kxxMzzFromfcNEQ_SWB+
-                       //kxxMzzFromfcNEQ_SWT+
-                       //kxxMzzFromfcNEQ_SET+
-                       //kxxMzzFromfcNEQ_SEB+
-                       //kxxMzzFromfcNEQ_NWB+
-                       //kxxMzzFromfcNEQ_NWT+
-                       //kxxMzzFromfcNEQ_NET+
-                       //kxxMzzFromfcNEQ_NEB)*c1o8-(ax-cz);
-   ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-   //
-   // Bernd das Brot
-   //
-   ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-   a0 = a0 + xoff * ax + yoff * ay + zoff * az + xoff_sq * axx + yoff_sq * ayy + zoff_sq * azz + xoff*yoff*axy + xoff*zoff*axz + yoff*zoff*ayz + xoff*yoff*zoff*axyz ;
-   ax = ax + 2. * xoff * axx + yoff * axy + zoff * axz + yoff*zoff*axyz;
-   ay = ay + 2. * yoff * ayy + xoff * axy + zoff * ayz + xoff*zoff*axyz;
-   az = az + 2. * zoff * azz + xoff * axz + yoff * ayz + xoff*yoff*axyz;
-   b0 = b0 + xoff * bx + yoff * by + zoff * bz + xoff_sq * bxx + yoff_sq * byy + zoff_sq * bzz + xoff*yoff*bxy + xoff*zoff*bxz + yoff*zoff*byz + xoff*yoff*zoff*bxyz;
-   bx = bx + 2. * xoff * bxx + yoff * bxy + zoff * bxz + yoff*zoff*bxyz;
-   by = by + 2. * yoff * byy + xoff * bxy + zoff * byz + xoff*zoff*bxyz;
-   bz = bz + 2. * zoff * bzz + xoff * bxz + yoff * byz + xoff*yoff*bxyz;
-   c0 = c0 + xoff * cx + yoff * cy + zoff * cz + xoff_sq * cxx + yoff_sq * cyy + zoff_sq * czz + xoff*yoff*cxy + xoff*zoff*cxz + yoff*zoff*cyz + xoff*yoff*zoff*cxyz;
-   cx = cx + 2. * xoff * cxx + yoff * cxy + zoff * cxz + yoff*zoff*cxyz;
-   cy = cy + 2. * yoff * cyy + xoff * cxy + zoff * cyz + xoff*zoff*cxyz;
-   cz = cz + 2. * zoff * czz + xoff * cxz + yoff * cyz + xoff*yoff*cxyz;
-   axy= axy + zoff*axyz;
-   axz= axz + yoff*axyz;
-   ayz= ayz + xoff*axyz;
-   bxy= bxy + zoff*bxyz;
-   bxz= bxz + yoff*bxyz;
-   byz= byz + xoff*bxyz;
-   cxy= cxy + zoff*cxyz;
-   cxz= cxz + yoff*cxyz;
-   cyz= cyz + xoff*cxyz;
-   ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-   const LBMReal o = omega;
-
-   f_E = eps_new*((2*(-2*ax + by + cz-kxxMzzAverage-kxxMyyAverage))/(27.*o));
-   f_N = eps_new*((2*(ax - 2*by + cz+2*kxxMyyAverage-kxxMzzAverage))/(27.*o));
-   f_T = eps_new*((2*(ax + by - 2*cz-kxxMyyAverage+2*kxxMzzAverage))/(27.*o));
-   f_NE = eps_new*(-(ax + 3*ay + 3*bx + by - 2*cz+2*kxxMyyAverage-kxxMyyAverage+3*kxyAverage)/(54.*o));
-   f_SE = eps_new*(-(ax - 3*ay - 3*bx + by - 2*cz+2*kxxMyyAverage-kxxMyyAverage-3*kxyAverage)/(54.*o));
-   f_TE = eps_new*(-(ax + 3*az - 2*by + 3*cx + cz+2*kxxMyyAverage-kxxMzzAverage+3*kxzAverage)/(54.*o));
-   f_BE = eps_new*(-(ax - 3*az - 2*by - 3*cx + cz+2*kxxMyyAverage-kxxMzzAverage-3*kxzAverage)/(54.*o));
-   f_TN = eps_new*(-(-2*ax + by + 3*bz + 3*cy + cz-kxxMyyAverage-kxxMzzAverage+3*kyzAverage)/(54.*o));
-   f_BN = eps_new*(-(-2*ax + by - 3*bz - 3*cy + cz-kxxMyyAverage-kxxMzzAverage-3*kyzAverage)/(54.*o));
-   f_ZERO = 0.;
-   f_TNE = eps_new*(-(ay + az + bx + bz + cx + cy+kxyAverage+kxzAverage+kyzAverage)/(72.*o));
-   f_TSW = eps_new*((-ay + az - bx + bz + cx + cy-kxyAverage+kxzAverage+kyzAverage)/(72.*o));
-   f_TSE = eps_new*((ay - az + bx + bz - cx + cy+kxyAverage-kxzAverage+kyzAverage)/(72.*o));
-   f_TNW = eps_new*((ay + az + bx - bz + cx - cy+kxyAverage+kxzAverage-kyzAverage)/(72.*o));
-
-   x_E = 0.25*eps_new*((2*(-4*axx + bxy + cxz))/(27.*o));
-   x_N = 0.25*eps_new*((2*(2*axx - 2*bxy + cxz))/(27.*o));
-   x_T = 0.25*eps_new*((2*(2*axx + bxy - 2*cxz))/(27.*o));
-   x_NE = 0.25*eps_new*(-((2*axx + 3*axy + 6*bxx + bxy - 2*cxz))/(54.*o));
-   x_SE = 0.25*eps_new*(-((2*axx - 3*axy - 6*bxx + bxy - 2*cxz))/(54.*o));
-   x_TE = 0.25*eps_new*(-((2*axx + 3*axz - 2*bxy + 6*cxx + cxz))/(54.*o));
-   x_BE = 0.25*eps_new*(-((2*axx - 3*axz - 2*bxy - 6*cxx + cxz))/(54.*o));
-   x_TN = 0.25*eps_new*(-((-4*axx + bxy + 3*bxz + 3*cxy + cxz))/(54.*o));
-   x_BN = 0.25*eps_new*(-((-4*axx + bxy - 3*bxz - 3*cxy + cxz))/(54.*o));
-   x_ZERO = 0.;
-   x_TNE = 0.25*eps_new*(-((axy + axz + 2*bxx + bxz + 2*cxx + cxy))/(72.*o));
-   x_TSW = 0.25*eps_new*(((-axy + axz - 2*bxx + bxz + 2*cxx + cxy))/(72.*o));
-   x_TSE = 0.25*eps_new*(((axy - axz + 2*bxx + bxz - 2*cxx + cxy))/(72.*o));
-   x_TNW = 0.25*eps_new*(((axy + axz + 2*bxx - bxz + 2*cxx - cxy))/(72.*o));
-
-   y_E = 0.25*eps_new*(2*(-2*axy + 2*byy + cyz))/(27.*o);
-   y_N = 0.25*eps_new*(2*(axy - 4*byy + cyz))/(27.*o);
-   y_T = 0.25*eps_new*(2*(axy + 2*byy - 2*cyz))/(27.*o);
-   y_NE = 0.25*eps_new*(-((axy + 6*ayy + 3*bxy + 2*byy - 2*cyz))/(54.*o));
-   y_SE = 0.25*eps_new*(-((axy - 6*ayy - 3*bxy + 2*byy - 2*cyz))/(54.*o));
-   y_TE = 0.25*eps_new*(-((axy + 3*ayz - 4*byy + 3*cxy + cyz))/(54.*o));
-   y_BE = 0.25*eps_new*(-((axy - 3*ayz - 4*byy - 3*cxy + cyz))/(54.*o));
-   y_TN = 0.25*eps_new*(-((-2*axy + 2*byy + 3*byz + 6*cyy + cyz))/(54.*o));
-   y_BN = 0.25*eps_new*(-((-2*axy + 2*byy - 3*byz - 6*cyy + cyz))/(54.*o));
-   y_ZERO = 0.;
-   y_TNE = 0.25*eps_new*(-((2*ayy + ayz + bxy + byz + cxy + 2*cyy))/(72.*o));
-   y_TSW = 0.25*eps_new*(((-2*ayy + ayz - bxy + byz + cxy + 2*cyy))/(72.*o));
-   y_TSE = 0.25*eps_new*(((2*ayy - ayz + bxy + byz - cxy + 2*cyy))/(72.*o));
-   y_TNW = 0.25*eps_new*(((2*ayy + ayz + bxy - byz + cxy - 2*cyy))/(72.*o));
-
-   z_E = 0.25*eps_new*((2*(-2*axz + byz + 2*czz))/(27.*o));
-   z_N = 0.25*eps_new*((2*(axz - 2*byz + 2*czz))/(27.*o));
-   z_T = 0.25*eps_new*((2*(axz + byz - 4*czz))/(27.*o));
-   z_NE = 0.25*eps_new*(-((axz + 3*ayz + 3*bxz + byz - 4*czz))/(54.*o));
-   z_SE = 0.25*eps_new*(-((axz - 3*ayz - 3*bxz + byz - 4*czz))/(54.*o));
-   z_TE = 0.25*eps_new*(-((axz + 6*azz - 2*byz + 3*cxz + 2*czz))/(54.*o));
-   z_BE = 0.25*eps_new*(-((axz - 6*azz - 2*byz - 3*cxz + 2*czz))/(54.*o));
-   z_TN = 0.25*eps_new*(-((-2*axz + byz + 6*bzz + 3*cyz + 2*czz))/(54.*o));
-   z_BN = 0.25*eps_new*(-((-2*axz + byz - 6*bzz - 3*cyz + 2*czz))/(54.*o));
-   z_ZERO = 0.;
-   z_TNE = 0.25*eps_new*(-((ayz + 2*azz + bxz + 2*bzz + cxz + cyz))/(72.*o));
-   z_TSW = 0.25*eps_new*(((-ayz + 2*azz - bxz + 2*bzz + cxz + cyz))/(72.*o));
-   z_TSE = 0.25*eps_new*(((ayz - 2*azz + bxz + 2*bzz - cxz + cyz))/(72.*o));
-   z_TNW = 0.25*eps_new*(((ayz + 2*azz + bxz - 2*bzz + cxz - cyz))/(72.*o));
-
-   xy_E   =   0.0625*eps_new *((                       2.*cxyz)/(27.*o));
-   xy_N   =   0.0625*eps_new *((                       2.*cxyz)/(27.*o));
-   xy_T   = -(0.0625*eps_new *((                       4.*cxyz)/(27.*o)));
-   xy_NE  =   0.0625*eps_new *(                            cxyz /(27.*o));
-   xy_SE  =   0.0625*eps_new *(                            cxyz /(27.*o));
-   xy_TE  = -(0.0625*eps_new *(( 3.*axyz            +     cxyz)/(54.*o)));
-   xy_BE  = -(0.0625*eps_new *((-3.*axyz            +     cxyz)/(54.*o)));
-   xy_TN  = -(0.0625*eps_new *((            3.*bxyz +     cxyz)/(54.*o)));
-   xy_BN  = -(0.0625*eps_new *((          - 3.*bxyz +     cxyz)/(54.*o)));
-   //xy_ZERO=   0.0625*eps_new;
-   xy_TNE = -(0.0625*eps_new *((     axyz +     bxyz           )/(72.*o)));
-   xy_TSW =   0.0625*eps_new *((     axyz +     bxyz           )/(72.*o));
-   xy_TSE =   0.0625*eps_new *((-    axyz +     bxyz           )/(72.*o));
-   xy_TNW =   0.0625*eps_new *((     axyz -     bxyz           )/(72.*o));
-
-   xz_E   =   0.0625*eps_new *((            2.*bxyz           )/(27.*o));
-   xz_N   = -(0.0625*eps_new *((            4.*bxyz           )/(27.*o)));
-   xz_T   =   0.0625*eps_new *((            2.*bxyz           )/(27.*o));
-   xz_NE  = -(0.0625*eps_new *(( 3.*axyz +     bxyz           )/(54.*o)));
-   xz_SE  = -(0.0625*eps_new *((-3.*axyz +     bxyz           )/(54.*o)));
-   xz_TE  =   0.0625*eps_new *((                bxyz           )/(27.*o));
-   xz_BE  =   0.0625*eps_new *((                bxyz           )/(27.*o));
-   xz_TN  = -(0.0625*eps_new *((                bxyz + 3.*cxyz)/(54.*o)));
-   xz_BN  = -(0.0625*eps_new *((                bxyz - 3.*cxyz)/(54.*o)));
-   //xz_ZERO=   0.0625*eps_new;
-   xz_TNE = -(0.0625*eps_new *((     axyz            +     cxyz)/(72.*o)));
-   xz_TSW =   0.0625*eps_new *((-    axyz            +     cxyz)/(72.*o));
-   xz_TSE =   0.0625*eps_new *((     axyz            +     cxyz)/(72.*o));
-   xz_TNW =   0.0625*eps_new *((     axyz            -     cxyz)/(72.*o));
-
-   yz_E   = -(0.0625*eps_new *(( 4.*axyz                      )/(27.*o)));
-   yz_N   =   0.0625*eps_new *(( 2.*axyz                      )/(27.*o));
-   yz_T   =   0.0625*eps_new *(( 2.*axyz                      )/(27.*o));
-   yz_NE  = -(0.0625*eps_new *((     axyz + 3.*bxyz           )/(54.*o)));
-   yz_SE  = -(0.0625*eps_new *((     axyz - 3.*bxyz           )/(54.*o)));
-   yz_TE  = -(0.0625*eps_new *((     axyz            + 3.*cxyz)/(54.*o)));
-   yz_BE  = -(0.0625*eps_new *((     axyz            - 3.*cxyz)/(54.*o)));
-   yz_TN  =   0.0625*eps_new *((     axyz                      )/(27.*o));
-   yz_BN  =   0.0625*eps_new *((     axyz                      )/(27.*o));
-   //yz_ZERO=   0.0625*eps_new;
-   yz_TNE = -(0.0625*eps_new *((                bxyz +     cxyz)/(72.*o)));
-   yz_TSW =   0.0625*eps_new *((          -     bxyz +     cxyz)/(72.*o));
-   yz_TSE =   0.0625*eps_new *((                bxyz -     cxyz)/(72.*o));
-   yz_TNW =   0.0625*eps_new *((                bxyz +     cxyz)/(72.*o));
-}
-//////////////////////////////////////////////////////////////////////////
-void CompressibleOffsetInterpolationProcessor::calcInterpolatedNodeCF(LBMReal* f, LBMReal omega, LBMReal x, LBMReal y, LBMReal z, LBMReal press, LBMReal xs, LBMReal ys, LBMReal zs)
-{
-   using namespace D3Q27System;
-
-   LBMReal rho  = press ;//+ (2.*axx*x+axy*y+axz*z+axyz*y*z+ax + 2.*byy*y+bxy*x+byz*z+bxyz*x*z+by + 2.*czz*z+cxz*x+cyz*y+cxyz*x*y+cz)/3.;
-   LBMReal vx1  = a0 + 0.25*( xs*ax + ys*ay + zs*az) + 0.0625*(axx + xs*ys*axy + xs*zs*axz + ayy + ys*zs*ayz + azz) + 0.015625*(xs*ys*zs*axyz);
-   LBMReal vx2  = b0 + 0.25*( xs*bx + ys*by + zs*bz) + 0.0625*(bxx + xs*ys*bxy + xs*zs*bxz + byy + ys*zs*byz + bzz) + 0.015625*(xs*ys*zs*bxyz);
-   LBMReal vx3  = c0 + 0.25*( xs*cx + ys*cy + zs*cz) + 0.0625*(cxx + xs*ys*cxy + xs*zs*cxz + cyy + ys*zs*cyz + czz) + 0.015625*(xs*ys*zs*cxyz);
-
-   //////////////////////////////////////////////////////////////////////////
-   //DRAFT
-   //vx1 -= forcingF*0.5;
-   //////////////////////////////////////////////////////////////////////////
-
-   LBMReal feq[ENDF+1];
-   D3Q27System::calcCompFeq(feq,rho,vx1,vx2,vx3);
-
-   f[E]    = f_E    + xs*x_E    + ys*y_E    + zs*z_E    + xs*ys*xy_E    + xs*zs*xz_E    + ys*zs*yz_E    + feq[E];
-   f[W]    = f_E    + xs*x_E    + ys*y_E    + zs*z_E    + xs*ys*xy_E    + xs*zs*xz_E    + ys*zs*yz_E    + feq[W];
-   f[N]    = f_N    + xs*x_N    + ys*y_N    + zs*z_N    + xs*ys*xy_N    + xs*zs*xz_N    + ys*zs*yz_N    + feq[N];
-   f[S]    = f_N    + xs*x_N    + ys*y_N    + zs*z_N    + xs*ys*xy_N    + xs*zs*xz_N    + ys*zs*yz_N    + feq[S];
-   f[T]    = f_T    + xs*x_T    + ys*y_T    + zs*z_T    + xs*ys*xy_T    + xs*zs*xz_T    + ys*zs*yz_T    + feq[T];
-   f[B]    = f_T    + xs*x_T    + ys*y_T    + zs*z_T    + xs*ys*xy_T    + xs*zs*xz_T    + ys*zs*yz_T    + feq[B];
-   f[NE]   = f_NE   + xs*x_NE   + ys*y_NE   + zs*z_NE   + xs*ys*xy_NE   + xs*zs*xz_NE   + ys*zs*yz_NE   + feq[NE];
-   f[SW]   = f_NE   + xs*x_NE   + ys*y_NE   + zs*z_NE   + xs*ys*xy_NE   + xs*zs*xz_NE   + ys*zs*yz_NE   + feq[SW];
-   f[SE]   = f_SE   + xs*x_SE   + ys*y_SE   + zs*z_SE   + xs*ys*xy_SE   + xs*zs*xz_SE   + ys*zs*yz_SE   + feq[SE];
-   f[NW]   = f_SE   + xs*x_SE   + ys*y_SE   + zs*z_SE   + xs*ys*xy_SE   + xs*zs*xz_SE   + ys*zs*yz_SE   + feq[NW];
-   f[TE]   = f_TE   + xs*x_TE   + ys*y_TE   + zs*z_TE   + xs*ys*xy_TE   + xs*zs*xz_TE   + ys*zs*yz_TE   + feq[TE];
-   f[BW]   = f_TE   + xs*x_TE   + ys*y_TE   + zs*z_TE   + xs*ys*xy_TE   + xs*zs*xz_TE   + ys*zs*yz_TE   + feq[BW];
-   f[BE]   = f_BE   + xs*x_BE   + ys*y_BE   + zs*z_BE   + xs*ys*xy_BE   + xs*zs*xz_BE   + ys*zs*yz_BE   + feq[BE];
-   f[TW]   = f_BE   + xs*x_BE   + ys*y_BE   + zs*z_BE   + xs*ys*xy_BE   + xs*zs*xz_BE   + ys*zs*yz_BE   + feq[TW];
-   f[TN]   = f_TN   + xs*x_TN   + ys*y_TN   + zs*z_TN   + xs*ys*xy_TN   + xs*zs*xz_TN   + ys*zs*yz_TN   + feq[TN];
-   f[BS]   = f_TN   + xs*x_TN   + ys*y_TN   + zs*z_TN   + xs*ys*xy_TN   + xs*zs*xz_TN   + ys*zs*yz_TN   + feq[BS];
-   f[BN]   = f_BN   + xs*x_BN   + ys*y_BN   + zs*z_BN   + xs*ys*xy_BN   + xs*zs*xz_BN   + ys*zs*yz_BN   + feq[BN];
-   f[TS]   = f_BN   + xs*x_BN   + ys*y_BN   + zs*z_BN   + xs*ys*xy_BN   + xs*zs*xz_BN   + ys*zs*yz_BN   + feq[TS];
-   f[TNE]  = f_TNE  + xs*x_TNE  + ys*y_TNE  + zs*z_TNE  + xs*ys*xy_TNE  + xs*zs*xz_TNE  + ys*zs*yz_TNE  + feq[TNE];
-   f[TSW]  = f_TSW  + xs*x_TSW  + ys*y_TSW  + zs*z_TSW  + xs*ys*xy_TSW  + xs*zs*xz_TSW  + ys*zs*yz_TSW  + feq[TSW];
-   f[TSE]  = f_TSE  + xs*x_TSE  + ys*y_TSE  + zs*z_TSE  + xs*ys*xy_TSE  + xs*zs*xz_TSE  + ys*zs*yz_TSE  + feq[TSE];
-   f[TNW]  = f_TNW  + xs*x_TNW  + ys*y_TNW  + zs*z_TNW  + xs*ys*xy_TNW  + xs*zs*xz_TNW  + ys*zs*yz_TNW  + feq[TNW];
-   f[BNE]  = f_TSW  + xs*x_TSW  + ys*y_TSW  + zs*z_TSW  + xs*ys*xy_TSW  + xs*zs*xz_TSW  + ys*zs*yz_TSW  + feq[BNE];
-   f[BSW]  = f_TNE  + xs*x_TNE  + ys*y_TNE  + zs*z_TNE  + xs*ys*xy_TNE  + xs*zs*xz_TNE  + ys*zs*yz_TNE  + feq[BSW];
-   f[BSE]  = f_TNW  + xs*x_TNW  + ys*y_TNW  + zs*z_TNW  + xs*ys*xy_TNW  + xs*zs*xz_TNW  + ys*zs*yz_TNW  + feq[BSE];
-   f[BNW]  = f_TSE  + xs*x_TSE  + ys*y_TSE  + zs*z_TSE  + xs*ys*xy_TSE  + xs*zs*xz_TSE  + ys*zs*yz_TSE  + feq[BNW];
-   f[ZERO] = f_ZERO + xs*x_ZERO + ys*y_ZERO + zs*z_ZERO                                                 + feq[ZERO];
-}
-//////////////////////////////////////////////////////////////////////////
-//Position SWB -0.25, -0.25, -0.25
-LBMReal CompressibleOffsetInterpolationProcessor::calcPressBSW()
-{
-   return   press_SWT * (0.140625 + 0.1875 * xoff + 0.1875 * yoff - 0.5625 * zoff) +
-      press_NWT * (0.046875 + 0.0625 * xoff - 0.1875 * yoff - 0.1875 * zoff) +
-      press_SET * (0.046875 - 0.1875 * xoff + 0.0625 * yoff - 0.1875 * zoff) +
-      press_NET * (0.015625 - 0.0625 * xoff - 0.0625 * yoff - 0.0625 * zoff) +
-      press_NEB * (0.046875 - 0.1875 * xoff - 0.1875 * yoff + 0.0625 * zoff) +
-      press_NWB * (0.140625 + 0.1875 * xoff - 0.5625 * yoff + 0.1875 * zoff) +
-      press_SEB * (0.140625 - 0.5625 * xoff + 0.1875 * yoff + 0.1875 * zoff) +
-      press_SWB * (0.421875 + 0.5625 * xoff + 0.5625 * yoff + 0.5625 * zoff);
-}
-//////////////////////////////////////////////////////////////////////////
-//Position SWT -0.25, -0.25, 0.25
-LBMReal CompressibleOffsetInterpolationProcessor::calcPressTSW()
-{
-   return   press_SWT * (0.421875 + 0.5625 * xoff + 0.5625 * yoff - 0.5625 * zoff) +
-      press_NWT * (0.140625 + 0.1875 * xoff - 0.5625 * yoff - 0.1875 * zoff) +
-      press_SET * (0.140625 - 0.5625 * xoff + 0.1875 * yoff - 0.1875 * zoff) +
-      press_NET * (0.046875 - 0.1875 * xoff - 0.1875 * yoff - 0.0625 * zoff) +
-      press_NEB * (0.015625 - 0.0625 * xoff - 0.0625 * yoff + 0.0625 * zoff) +
-      press_NWB * (0.046875 + 0.0625 * xoff - 0.1875 * yoff + 0.1875 * zoff) +
-      press_SEB * (0.046875 - 0.1875 * xoff + 0.0625 * yoff + 0.1875 * zoff) +
-      press_SWB * (0.140625 + 0.1875 * xoff + 0.1875 * yoff + 0.5625 * zoff);
-}
-//////////////////////////////////////////////////////////////////////////
-//Position SET 0.25, -0.25, 0.25
-LBMReal CompressibleOffsetInterpolationProcessor::calcPressTSE()
-{
-   return   press_SET * (0.421875 - 0.5625 * xoff + 0.5625 * yoff - 0.5625 * zoff) +
-      press_NET * (0.140625 - 0.1875 * xoff - 0.5625 * yoff - 0.1875 * zoff) +
-      press_SWT * (0.140625 + 0.5625 * xoff + 0.1875 * yoff - 0.1875 * zoff) +
-      press_NWT * (0.046875 + 0.1875 * xoff - 0.1875 * yoff - 0.0625 * zoff) +
-      press_NWB * (0.015625 + 0.0625 * xoff - 0.0625 * yoff + 0.0625 * zoff) +
-      press_NEB * (0.046875 - 0.0625 * xoff - 0.1875 * yoff + 0.1875 * zoff) +
-      press_SWB * (0.046875 + 0.1875 * xoff + 0.0625 * yoff + 0.1875 * zoff) +
-      press_SEB * (0.140625 - 0.1875 * xoff + 0.1875 * yoff + 0.5625 * zoff);
-}
-//////////////////////////////////////////////////////////////////////////
-//Position SEB 0.25, -0.25, -0.25
-LBMReal CompressibleOffsetInterpolationProcessor::calcPressBSE()
-{
-   return   press_SET * (0.140625 - 0.1875 * xoff + 0.1875 * yoff - 0.5625 * zoff) +
-      press_NET * (0.046875 - 0.0625 * xoff - 0.1875 * yoff - 0.1875 * zoff) +
-      press_SWT * (0.046875 + 0.1875 * xoff + 0.0625 * yoff - 0.1875 * zoff) +
-      press_NWT * (0.015625 + 0.0625 * xoff - 0.0625 * yoff - 0.0625 * zoff) +
-      press_NWB * (0.046875 + 0.1875 * xoff - 0.1875 * yoff + 0.0625 * zoff) +
-      press_NEB * (0.140625 - 0.1875 * xoff - 0.5625 * yoff + 0.1875 * zoff) +
-      press_SWB * (0.140625 + 0.5625 * xoff + 0.1875 * yoff + 0.1875 * zoff) +
-      press_SEB * (0.421875 - 0.5625 * xoff + 0.5625 * yoff + 0.5625 * zoff);
-}
-//////////////////////////////////////////////////////////////////////////
-//Position NWB -0.25, 0.25, -0.25
-LBMReal CompressibleOffsetInterpolationProcessor::calcPressBNW()
-{
-   return   press_NWT * (0.140625 + 0.1875 * xoff - 0.1875 * yoff - 0.5625 * zoff) +
-      press_NET * (0.046875 - 0.1875 * xoff - 0.0625 * yoff - 0.1875 * zoff) +
-      press_SWT * (0.046875 + 0.0625 * xoff + 0.1875 * yoff - 0.1875 * zoff) +
-      press_SET * (0.015625 - 0.0625 * xoff + 0.0625 * yoff - 0.0625 * zoff) +
-      press_SEB * (0.046875 - 0.1875 * xoff + 0.1875 * yoff + 0.0625 * zoff) +
-      press_NEB * (0.140625 - 0.5625 * xoff - 0.1875 * yoff + 0.1875 * zoff) +
-      press_SWB * (0.140625 + 0.1875 * xoff + 0.5625 * yoff + 0.1875 * zoff) +
-      press_NWB * (0.421875 + 0.5625 * xoff - 0.5625 * yoff + 0.5625 * zoff);
-}
-//////////////////////////////////////////////////////////////////////////
-//Position NWT -0.25, 0.25, 0.25
-LBMReal CompressibleOffsetInterpolationProcessor::calcPressTNW()
-{
-   return   press_NWT * (0.421875 + 0.5625 * xoff - 0.5625 * yoff - 0.5625 * zoff) +
-      press_NET * (0.140625 - 0.5625 * xoff - 0.1875 * yoff - 0.1875 * zoff) +
-      press_SWT * (0.140625 + 0.1875 * xoff + 0.5625 * yoff - 0.1875 * zoff) +
-      press_SET * (0.046875 - 0.1875 * xoff + 0.1875 * yoff - 0.0625 * zoff) +
-      press_SEB * (0.015625 - 0.0625 * xoff + 0.0625 * yoff + 0.0625 * zoff) +
-      press_NEB * (0.046875 - 0.1875 * xoff - 0.0625 * yoff + 0.1875 * zoff) +
-      press_SWB * (0.046875 + 0.0625 * xoff + 0.1875 * yoff + 0.1875 * zoff) +
-      press_NWB * (0.140625 + 0.1875 * xoff - 0.1875 * yoff + 0.5625 * zoff);
-}
-//////////////////////////////////////////////////////////////////////////
-//Position NET 0.25, 0.25, 0.25
-LBMReal CompressibleOffsetInterpolationProcessor::calcPressTNE()
-{
-   return   press_NET * (0.421875 - 0.5625 * xoff - 0.5625 * yoff - 0.5625 * zoff) +
-      press_NWT * (0.140625 + 0.5625 * xoff - 0.1875 * yoff - 0.1875 * zoff) +
-      press_SET * (0.140625 - 0.1875 * xoff + 0.5625 * yoff - 0.1875 * zoff) +
-      press_SWT * (0.046875 + 0.1875 * xoff + 0.1875 * yoff - 0.0625 * zoff) +
-      press_SWB * (0.015625 + 0.0625 * xoff + 0.0625 * yoff + 0.0625 * zoff) +
-      press_NWB * (0.046875 + 0.1875 * xoff - 0.0625 * yoff + 0.1875 * zoff) +
-      press_SEB * (0.046875 - 0.0625 * xoff + 0.1875 * yoff + 0.1875 * zoff) +
-      press_NEB * (0.140625 - 0.1875 * xoff - 0.1875 * yoff + 0.5625 * zoff);
-}
-//////////////////////////////////////////////////////////////////////////
-//Position NEB 0.25, 0.25, -0.25
-LBMReal CompressibleOffsetInterpolationProcessor::calcPressBNE()
-{
-   return   press_NET * (0.140625 - 0.1875 * xoff - 0.1875 * yoff - 0.5625 * zoff) +
-      press_NWT * (0.046875 + 0.1875 * xoff - 0.0625 * yoff - 0.1875 * zoff) +
-      press_SET * (0.046875 - 0.0625 * xoff + 0.1875 * yoff - 0.1875 * zoff) +
-      press_SWT * (0.015625 + 0.0625 * xoff + 0.0625 * yoff - 0.0625 * zoff) +
-      press_SWB * (0.046875 + 0.1875 * xoff + 0.1875 * yoff + 0.0625 * zoff) +
-      press_NWB * (0.140625 + 0.5625 * xoff - 0.1875 * yoff + 0.1875 * zoff) +
-      press_SEB * (0.140625 - 0.1875 * xoff + 0.5625 * yoff + 0.1875 * zoff) +
-      press_NEB * (0.421875 - 0.5625 * xoff - 0.5625 * yoff + 0.5625 * zoff);
-}
-//////////////////////////////////////////////////////////////////////////
-//Position C 0.0, 0.0, 0.0
-void CompressibleOffsetInterpolationProcessor::calcInterpolatedNodeFC(LBMReal* f, LBMReal omega)
-{
-   using namespace D3Q27System;
-
-   LBMReal press  =  press_NET * (0.125 - 0.25 * xoff - 0.25 * yoff - 0.25 * zoff) +
-      press_NWT * (0.125 + 0.25 * xoff - 0.25 * yoff - 0.25 * zoff) +
-      press_SET * (0.125 - 0.25 * xoff + 0.25 * yoff - 0.25 * zoff) +
-      press_SWT * (0.125 + 0.25 * xoff + 0.25 * yoff - 0.25 * zoff) +
-      press_NEB * (0.125 - 0.25 * xoff - 0.25 * yoff + 0.25 * zoff) +
-      press_NWB * (0.125 + 0.25 * xoff - 0.25 * yoff + 0.25 * zoff) +
-      press_SEB * (0.125 - 0.25 * xoff + 0.25 * yoff + 0.25 * zoff) +
-      press_SWB * (0.125 + 0.25 * xoff + 0.25 * yoff + 0.25 * zoff);
-   LBMReal vx1  = a0;
-   LBMReal vx2  = b0;
-   LBMReal vx3  = c0;
-
-   LBMReal rho = press ;//+ (ax+by+cz)/3.;
-
-   //////////////////////////////////////////////////////////////////////////
-   //DRAFT
-   //vx1 -= forcingC*0.5;
-   //////////////////////////////////////////////////////////////////////////
-
-   LBMReal feq[ENDF+1];
-   D3Q27System::calcCompFeq(feq,rho,vx1,vx2,vx3);
-
-   LBMReal eps_new = 2.;
-   LBMReal o  = omega;
-   LBMReal op = 1.;
-
-   //f_E    = eps_new *((5.*ax*o + 5.*by*o + 5.*cz*o - 8.*ax*op + 4.*by*op + 4.*cz*op)/(54.*o*op));
-   //f_N    = f_E + eps_new *((2.*(ax - by))/(9.*o));
-   //f_T    = f_E + eps_new *((2.*(ax - cz))/(9.*o));
-   //f_NE   = eps_new *(-(5.*cz*o + 3.*(ay + bx)*op - 2.*cz*op + ax*(5.*o + op) + by*(5.*o + op))/(54.*o*op));
-   //f_SE   = f_NE + eps_new *((  ay + bx )/(9.*o));
-   //f_TE   = eps_new *(-(5.*cz*o + by*(5.*o - 2.*op) + 3.*(az + cx)*op + cz*op + ax*(5.*o + op))/(54.*o*op));
-   //f_BE   = f_TE + eps_new *((  az + cx )/(9.*o));
-   //f_TN   = eps_new *(-(5.*ax*o + 5.*by*o + 5.*cz*o - 2.*ax*op + by*op + 3.*bz*op + 3.*cy*op + cz*op)/(54.*o*op));
-   //f_BN   = f_TN + eps_new *((  bz + cy )/(9.*o));
-   //f_ZERO = eps_new *((5.*(ax + by + cz))/(9.*op));
-   //f_TNE  = eps_new *(-(ay + az + bx + bz + cx + cy)/(72.*o));
-   //f_TSW  = - eps_new *((ay + bx)/(36.*o)) - f_TNE;
-   //f_TSE  = - eps_new *((az + cx)/(36.*o)) - f_TNE;
-   //f_TNW  = - eps_new *((bz + cy)/(36.*o)) - f_TNE;
-
-   f_E = eps_new*((2*(-2*ax + by + cz-kxxMzzAverage-kxxMyyAverage))/(27.*o));
-   f_N = eps_new*((2*(ax - 2*by + cz+2*kxxMyyAverage-kxxMzzAverage))/(27.*o));
-   f_T = eps_new*((2*(ax + by - 2*cz-kxxMyyAverage+2*kxxMzzAverage))/(27.*o));
-   f_NE = eps_new*(-(ax + 3*ay + 3*bx + by - 2*cz+2*kxxMyyAverage-kxxMyyAverage+3*kxyAverage)/(54.*o));
-   f_SE = eps_new*(-(ax - 3*ay - 3*bx + by - 2*cz+2*kxxMyyAverage-kxxMyyAverage-3*kxyAverage)/(54.*o));
-   f_TE = eps_new*(-(ax + 3*az - 2*by + 3*cx + cz+2*kxxMyyAverage-kxxMzzAverage+3*kxzAverage)/(54.*o));
-   f_BE = eps_new*(-(ax - 3*az - 2*by - 3*cx + cz+2*kxxMyyAverage-kxxMzzAverage-3*kxzAverage)/(54.*o));
-   f_TN = eps_new*(-(-2*ax + by + 3*bz + 3*cy + cz-kxxMyyAverage-kxxMzzAverage+3*kyzAverage)/(54.*o));
-   f_BN = eps_new*(-(-2*ax + by - 3*bz - 3*cy + cz-kxxMyyAverage-kxxMzzAverage-3*kyzAverage)/(54.*o));
-   f_ZERO = 0.;
-   f_TNE = eps_new*(-(ay + az + bx + bz + cx + cy+kxyAverage+kxzAverage+kyzAverage)/(72.*o));
-   f_TSW = eps_new*((-ay + az - bx + bz + cx + cy-kxyAverage+kxzAverage+kyzAverage)/(72.*o));
-   f_TSE = eps_new*((ay - az + bx + bz - cx + cy+kxyAverage-kxzAverage+kyzAverage)/(72.*o));
-   f_TNW = eps_new*((ay + az + bx - bz + cx - cy+kxyAverage+kxzAverage-kyzAverage)/(72.*o));
-
-   f[E]    = f_E    + feq[E];
-   f[W]    = f_E    + feq[W];
-   f[N]    = f_N    + feq[N];
-   f[S]    = f_N    + feq[S];
-   f[T]    = f_T    + feq[T];
-   f[B]    = f_T    + feq[B];
-   f[NE]   = f_NE   + feq[NE];
-   f[SW]   = f_NE   + feq[SW];
-   f[SE]   = f_SE   + feq[SE];
-   f[NW]   = f_SE   + feq[NW];
-   f[TE]   = f_TE   + feq[TE];
-   f[BW]   = f_TE   + feq[BW];
-   f[BE]   = f_BE   + feq[BE];
-   f[TW]   = f_BE   + feq[TW];
-   f[TN]   = f_TN   + feq[TN];
-   f[BS]   = f_TN   + feq[BS];
-   f[BN]   = f_BN   + feq[BN];
-   f[TS]   = f_BN   + feq[TS];
-   f[TNE]  = f_TNE  + feq[TNE];
-   f[TNW]  = f_TNW  + feq[TNW];
-   f[TSE]  = f_TSE  + feq[TSE];
-   f[TSW]  = f_TSW  + feq[TSW];
-   f[BNE]  = f_TSW  + feq[BNE];
-   f[BNW]  = f_TSE  + feq[BNW];
-   f[BSE]  = f_TNW  + feq[BSE];
-   f[BSW]  = f_TNE  + feq[BSW];
-   f[ZERO] = f_ZERO + feq[ZERO];
-}
-//////////////////////////////////////////////////////////////////////////
-void CompressibleOffsetInterpolationProcessor::calcInterpolatedVelocity(LBMReal x, LBMReal y, LBMReal z, LBMReal& vx1, LBMReal& vx2, LBMReal& vx3)
-{
-	vx1  = a0 + ax*x + ay*y + az*z + axx*x*x + ayy*y*y + azz*z*z + axy*x*y + axz*x*z + ayz*y*z+axyz*x*y*z;
-	vx2  = b0 + bx*x + by*y + bz*z + bxx*x*x + byy*y*y + bzz*z*z + bxy*x*y + bxz*x*z + byz*y*z+bxyz*x*y*z;
-	vx3  = c0 + cx*x + cy*y + cz*z + cxx*x*x + cyy*y*y + czz*z*z + cxy*x*y + cxz*x*z + cyz*y*z+cxyz*x*y*z;
-}
-//////////////////////////////////////////////////////////////////////////
-void CompressibleOffsetInterpolationProcessor::calcInterpolatedShearStress(LBMReal x, LBMReal y, LBMReal z,LBMReal& tauxx, LBMReal& tauyy, LBMReal& tauzz,LBMReal& tauxy, LBMReal& tauxz, LBMReal& tauyz)
-{
-	tauxx=ax+2*axx*x+axy*y+axz*z+axyz*y*z;
-	tauyy=by+2*byy*y+bxy*x+byz*z+bxyz*x*z;
-	tauzz=cz+2*czz*z+cxz*x+cyz*y+cxyz*x*y;
-	tauxy=0.5*((ay+2.0*ayy*y+axy*x+ayz*z+axyz*x*z)+(bx+2.0*bxx*x+bxy*y+bxz*z+bxyz*y*z));
-	tauxz=0.5*((az+2.0*azz*z+axz*x+ayz*y+axyz*x*y)+(cx+2.0*cxx*x+cxy*y+cxz*z+cxyz*y*z));
-	tauyz=0.5*((bz+2.0*bzz*z+bxz*x+byz*y+bxyz*x*y)+(cy+2.0*cyy*y+cxy*x+cyz*z+cxyz*x*z));
-}
+#include "CompressibleOffsetInterpolationProcessor.h"
+#include "D3Q27System.h"
+
+using namespace UbMath;
+
+CompressibleOffsetInterpolationProcessor::CompressibleOffsetInterpolationProcessor()
+   : omegaC(0.0), omegaF(0.0)
+{
+   //forcingC = 0; //9.99685e-7;
+   //forcingF = 0; //forcingC*0.5;
+}
+//////////////////////////////////////////////////////////////////////////
+CompressibleOffsetInterpolationProcessor::CompressibleOffsetInterpolationProcessor(LBMReal omegaC, LBMReal omegaF)
+   : omegaC(omegaC), omegaF(omegaF)
+{
+
+}
+//////////////////////////////////////////////////////////////////////////
+CompressibleOffsetInterpolationProcessor::~CompressibleOffsetInterpolationProcessor()
+{
+
+}
+//////////////////////////////////////////////////////////////////////////
+InterpolationProcessorPtr CompressibleOffsetInterpolationProcessor::clone()
+{
+   InterpolationProcessorPtr iproc = InterpolationProcessorPtr (new CompressibleOffsetInterpolationProcessor(this->omegaC, this->omegaF));
+   //dynamicPointerCast<D3Q27IncompressibleOffsetInterpolationProcessor>(iproc)->forcingC = forcingC;
+   //dynamicPointerCast<D3Q27IncompressibleOffsetInterpolationProcessor>(iproc)->forcingF = forcingF;
+   return iproc;
+}
+//////////////////////////////////////////////////////////////////////////
+void CompressibleOffsetInterpolationProcessor::setOmegas( LBMReal omegaC, LBMReal omegaF )
+{
+   this->omegaC = omegaC;
+   this->omegaF = omegaF;
+}
+//////////////////////////////////////////////////////////////////////////
+void CompressibleOffsetInterpolationProcessor::setOffsets(LBMReal xoff, LBMReal yoff, LBMReal zoff)
+{
+   this->xoff = xoff;
+   this->yoff = yoff;
+   this->zoff = zoff;     
+   this->xoff_sq = xoff * xoff;
+   this->yoff_sq = yoff * yoff;
+   this->zoff_sq = zoff * zoff;
+}
+//////////////////////////////////////////////////////////////////////////
+void CompressibleOffsetInterpolationProcessor::interpolateCoarseToFine(D3Q27ICell& icellC, D3Q27ICell& icellF, LBMReal xoff, LBMReal yoff, LBMReal zoff)
+{
+   setOffsets(xoff, yoff, zoff);
+   calcInterpolatedCoefficiets(icellC, omegaC, 0.5);
+   calcInterpolatedNodeCF(icellF.BSW, omegaF, -0.25, -0.25, -0.25, calcPressBSW(), -1, -1, -1);
+   calcInterpolatedNodeCF(icellF.BNE, omegaF,  0.25,  0.25, -0.25, calcPressBNE(),  1,  1, -1);
+   calcInterpolatedNodeCF(icellF.TNW, omegaF, -0.25,  0.25,  0.25, calcPressTNW(), -1,  1,  1);
+   calcInterpolatedNodeCF(icellF.TSE, omegaF,  0.25, -0.25,  0.25, calcPressTSE(),  1, -1,  1);
+   calcInterpolatedNodeCF(icellF.BNW, omegaF, -0.25,  0.25, -0.25, calcPressBNW(), -1,  1, -1);
+   calcInterpolatedNodeCF(icellF.BSE, omegaF,  0.25, -0.25, -0.25, calcPressBSE(),  1, -1, -1);
+   calcInterpolatedNodeCF(icellF.TSW, omegaF, -0.25, -0.25,  0.25, calcPressTSW(), -1, -1,  1);
+   calcInterpolatedNodeCF(icellF.TNE, omegaF,  0.25,  0.25,  0.25, calcPressTNE(),  1,  1,  1);
+}
+//////////////////////////////////////////////////////////////////////////
+void CompressibleOffsetInterpolationProcessor::interpolateFineToCoarse(D3Q27ICell& icellF, LBMReal* icellC, LBMReal xoff, LBMReal yoff, LBMReal zoff)
+{
+   setOffsets(xoff, yoff, zoff);
+   calcInterpolatedCoefficiets(icellF, omegaF, 2.0);
+   calcInterpolatedNodeFC(icellC, omegaC);
+}
+//////////////////////////////////////////////////////////////////////////
+void CompressibleOffsetInterpolationProcessor::calcMoments(const LBMReal* const f, LBMReal omega, LBMReal& press, LBMReal& vx1, LBMReal& vx2, LBMReal& vx3, 
+                                                    LBMReal& kxy, LBMReal& kyz, LBMReal& kxz, LBMReal& kxxMyy, LBMReal& kxxMzz)
+{
+   using namespace D3Q27System;
+
+   LBMReal drho = 0.0;
+   D3Q27System::calcCompMacroscopicValues(f,drho,vx1,vx2,vx3);
+   
+   press = drho; //interpolate rho!
+
+   kxy   = -3.*omega*((((f[TSW]+f[BNE])-(f[TNW]+f[BSE]))+((f[BSW]+f[TNE])-(f[BNW]+f[TSE])))+((f[SW]+f[NE])-(f[NW]+f[SE]))/(one + drho)-(vx1*vx2));// might not be optimal MG 25.2.13
+   kyz   = -3.*omega*((((f[BSW]+f[TNE])-(f[TSE]+f[BNW]))+((f[BSE]+f[TNW])-(f[TSW]+f[BNE])))+((f[BS]+f[TN])-(f[TS]+f[BN]))/(one + drho)-(vx2*vx3));
+   kxz   = -3.*omega*((((f[BNW]+f[TSE])-(f[TSW]+f[BNE]))+((f[BSW]+f[TNE])-(f[BSE]+f[TNW])))+((f[BW]+f[TE])-(f[TW]+f[BE]))/(one + drho)-(vx1*vx3));
+   kxxMyy = -3./2.*omega*((((f[BW]+f[TE])-(f[BS]+f[TN]))+((f[TW]+f[BE])-(f[TS]+f[BN])))+((f[W]+f[E])-(f[S]+f[N]))/(one + drho)-(vx1*vx1-vx2*vx2));
+   kxxMzz = -3./2.*omega*((((f[NW]+f[SE])-(f[BS]+f[TN]))+((f[SW]+f[NE])-(f[TS]+f[BN])))+((f[W]+f[E])-(f[B]+f[T]))/(one + drho)-(vx1*vx1-vx3*vx3));
+}
+//////////////////////////////////////////////////////////////////////////
+void CompressibleOffsetInterpolationProcessor::calcInterpolatedCoefficiets(const D3Q27ICell& icell, LBMReal omega, LBMReal eps_new)
+{
+   LBMReal        vx1_SWT,vx2_SWT,vx3_SWT;
+   LBMReal        vx1_NWT,vx2_NWT,vx3_NWT;
+   LBMReal        vx1_NET,vx2_NET,vx3_NET;
+   LBMReal        vx1_SET,vx2_SET,vx3_SET;
+   LBMReal        vx1_SWB,vx2_SWB,vx3_SWB;
+   LBMReal        vx1_NWB,vx2_NWB,vx3_NWB;
+   LBMReal        vx1_NEB,vx2_NEB,vx3_NEB;
+   LBMReal        vx1_SEB,vx2_SEB,vx3_SEB;
+
+   LBMReal        kxyFromfcNEQ_SWT, kyzFromfcNEQ_SWT, kxzFromfcNEQ_SWT, kxxMyyFromfcNEQ_SWT, kxxMzzFromfcNEQ_SWT;
+   LBMReal        kxyFromfcNEQ_NWT, kyzFromfcNEQ_NWT, kxzFromfcNEQ_NWT, kxxMyyFromfcNEQ_NWT, kxxMzzFromfcNEQ_NWT;
+   LBMReal        kxyFromfcNEQ_NET, kyzFromfcNEQ_NET, kxzFromfcNEQ_NET, kxxMyyFromfcNEQ_NET, kxxMzzFromfcNEQ_NET;
+   LBMReal        kxyFromfcNEQ_SET, kyzFromfcNEQ_SET, kxzFromfcNEQ_SET, kxxMyyFromfcNEQ_SET, kxxMzzFromfcNEQ_SET;
+   LBMReal        kxyFromfcNEQ_SWB, kyzFromfcNEQ_SWB, kxzFromfcNEQ_SWB, kxxMyyFromfcNEQ_SWB, kxxMzzFromfcNEQ_SWB;
+   LBMReal        kxyFromfcNEQ_NWB, kyzFromfcNEQ_NWB, kxzFromfcNEQ_NWB, kxxMyyFromfcNEQ_NWB, kxxMzzFromfcNEQ_NWB;
+   LBMReal        kxyFromfcNEQ_NEB, kyzFromfcNEQ_NEB, kxzFromfcNEQ_NEB, kxxMyyFromfcNEQ_NEB, kxxMzzFromfcNEQ_NEB;
+   LBMReal        kxyFromfcNEQ_SEB, kyzFromfcNEQ_SEB, kxzFromfcNEQ_SEB, kxxMyyFromfcNEQ_SEB, kxxMzzFromfcNEQ_SEB;
+
+   calcMoments(icell.TSW,omega,press_SWT,vx1_SWT,vx2_SWT,vx3_SWT, kxyFromfcNEQ_SWT, kyzFromfcNEQ_SWT, kxzFromfcNEQ_SWT, kxxMyyFromfcNEQ_SWT, kxxMzzFromfcNEQ_SWT);
+   calcMoments(icell.TNW,omega,press_NWT,vx1_NWT,vx2_NWT,vx3_NWT, kxyFromfcNEQ_NWT, kyzFromfcNEQ_NWT, kxzFromfcNEQ_NWT, kxxMyyFromfcNEQ_NWT, kxxMzzFromfcNEQ_NWT);
+   calcMoments(icell.TNE,omega,press_NET,vx1_NET,vx2_NET,vx3_NET, kxyFromfcNEQ_NET, kyzFromfcNEQ_NET, kxzFromfcNEQ_NET, kxxMyyFromfcNEQ_NET, kxxMzzFromfcNEQ_NET);
+   calcMoments(icell.TSE,omega,press_SET,vx1_SET,vx2_SET,vx3_SET, kxyFromfcNEQ_SET, kyzFromfcNEQ_SET, kxzFromfcNEQ_SET, kxxMyyFromfcNEQ_SET, kxxMzzFromfcNEQ_SET);
+   calcMoments(icell.BSW,omega,press_SWB,vx1_SWB,vx2_SWB,vx3_SWB, kxyFromfcNEQ_SWB, kyzFromfcNEQ_SWB, kxzFromfcNEQ_SWB, kxxMyyFromfcNEQ_SWB, kxxMzzFromfcNEQ_SWB);
+   calcMoments(icell.BNW,omega,press_NWB,vx1_NWB,vx2_NWB,vx3_NWB, kxyFromfcNEQ_NWB, kyzFromfcNEQ_NWB, kxzFromfcNEQ_NWB, kxxMyyFromfcNEQ_NWB, kxxMzzFromfcNEQ_NWB);
+   calcMoments(icell.BNE,omega,press_NEB,vx1_NEB,vx2_NEB,vx3_NEB, kxyFromfcNEQ_NEB, kyzFromfcNEQ_NEB, kxzFromfcNEQ_NEB, kxxMyyFromfcNEQ_NEB, kxxMzzFromfcNEQ_NEB);
+   calcMoments(icell.BSE,omega,press_SEB,vx1_SEB,vx2_SEB,vx3_SEB, kxyFromfcNEQ_SEB, kyzFromfcNEQ_SEB, kxzFromfcNEQ_SEB, kxxMyyFromfcNEQ_SEB, kxxMzzFromfcNEQ_SEB);
+
+   //LBMReal dxRho=c1o4*((press_NET-press_SWB)+(press_SET-press_NWB)+(press_NEB-press_SWT)+(press_SEB-press_NWT));
+   //LBMReal dyRho=c1o4*((press_NET-press_SWB)-(press_SET-press_NWB)+(press_NEB-press_SWT)-(press_SEB-press_NWT));
+   //LBMReal dzRho=c1o4*((press_NET-press_SWB)+(press_SET-press_NWB)-(press_NEB-press_SWT)-(press_SEB-press_NWT));
+
+   //   kxyFromfcNEQ_SWT+=vx1_SWT*dyRho+vx2_SWT*dxRho;
+   //   kxyFromfcNEQ_NWT+=vx1_NWT*dyRho+vx2_NWT*dxRho;
+   //   kxyFromfcNEQ_NET+=vx1_NET*dyRho+vx2_NET*dxRho;
+   //   kxyFromfcNEQ_SET+=vx1_SET*dyRho+vx2_SET*dxRho;
+   //   kxyFromfcNEQ_SWB+=vx1_SWB*dyRho+vx2_SWB*dxRho;
+   //   kxyFromfcNEQ_NWB+=vx1_NWB*dyRho+vx2_NWB*dxRho;
+   //   kxyFromfcNEQ_NEB+=vx1_NEB*dyRho+vx2_NEB*dxRho;
+   //   kxyFromfcNEQ_SEB+=vx1_SEB*dyRho+vx2_SEB*dxRho;
+
+   //   kyzFromfcNEQ_SWT+=vx3_SWT*dyRho+vx2_SWT*dzRho;
+   //   kyzFromfcNEQ_NWT+=vx3_NWT*dyRho+vx2_NWT*dzRho;
+   //   kyzFromfcNEQ_NET+=vx3_NET*dyRho+vx2_NET*dzRho;
+   //   kyzFromfcNEQ_SET+=vx3_SET*dyRho+vx2_SET*dzRho;
+   //   kyzFromfcNEQ_SWB+=vx3_SWB*dyRho+vx2_SWB*dzRho;
+   //   kyzFromfcNEQ_NWB+=vx3_NWB*dyRho+vx2_NWB*dzRho;
+   //   kyzFromfcNEQ_NEB+=vx3_NEB*dyRho+vx2_NEB*dzRho;
+   //   kyzFromfcNEQ_SEB+=vx3_SEB*dyRho+vx2_SEB*dzRho;
+
+   //   kxzFromfcNEQ_SWT+=vx1_SWT*dzRho+vx3_SWT*dxRho;
+   //   kxzFromfcNEQ_NWT+=vx1_NWT*dzRho+vx3_NWT*dxRho;
+   //   kxzFromfcNEQ_NET+=vx1_NET*dzRho+vx3_NET*dxRho;
+   //   kxzFromfcNEQ_SET+=vx1_SET*dzRho+vx3_SET*dxRho;
+   //   kxzFromfcNEQ_SWB+=vx1_SWB*dzRho+vx3_SWB*dxRho;
+   //   kxzFromfcNEQ_NWB+=vx1_NWB*dzRho+vx3_NWB*dxRho;
+   //   kxzFromfcNEQ_NEB+=vx1_NEB*dzRho+vx3_NEB*dxRho;
+   //   kxzFromfcNEQ_SEB+=vx1_SEB*dzRho+vx3_SEB*dxRho;
+
+   //   kxxMyyFromfcNEQ_SWT+=vx1_SWT*dxRho-vx2_SWT*dyRho;
+   //   kxxMyyFromfcNEQ_NWT+=vx1_NWT*dxRho-vx2_NWT*dyRho;
+   //   kxxMyyFromfcNEQ_NET+=vx1_NET*dxRho-vx2_NET*dyRho;
+   //   kxxMyyFromfcNEQ_SET+=vx1_SET*dxRho-vx2_SET*dyRho;
+   //   kxxMyyFromfcNEQ_SWB+=vx1_SWB*dxRho-vx2_SWB*dyRho;
+   //   kxxMyyFromfcNEQ_NWB+=vx1_NWB*dxRho-vx2_NWB*dyRho;
+   //   kxxMyyFromfcNEQ_NEB+=vx1_NEB*dxRho-vx2_NEB*dyRho;
+   //   kxxMyyFromfcNEQ_SEB+=vx1_SEB*dxRho-vx2_SEB*dyRho;
+
+   //   kxxMzzFromfcNEQ_SWT+=vx1_SWT*dxRho-vx3_SWT*dzRho;
+   //   kxxMzzFromfcNEQ_NWT+=vx1_NWT*dxRho-vx3_NWT*dzRho;
+   //   kxxMzzFromfcNEQ_NET+=vx1_NET*dxRho-vx3_NET*dzRho;
+   //   kxxMzzFromfcNEQ_SET+=vx1_SET*dxRho-vx3_SET*dzRho;
+   //   kxxMzzFromfcNEQ_SWB+=vx1_SWB*dxRho-vx3_SWB*dzRho;
+   //   kxxMzzFromfcNEQ_NWB+=vx1_NWB*dxRho-vx3_NWB*dzRho;
+   //   kxxMzzFromfcNEQ_NEB+=vx1_NEB*dxRho-vx3_NEB*dzRho;
+   //   kxxMzzFromfcNEQ_SEB+=vx1_SEB*dxRho-vx3_SEB*dzRho;
+
+
+      //kxxMzzFromfcNEQ_SWT=0.0;
+      //kxxMzzFromfcNEQ_NWT=0.0;
+      //kxxMzzFromfcNEQ_NET=0.0;
+      //kxxMzzFromfcNEQ_SET=0.0;
+      //kxxMzzFromfcNEQ_SWB=0.0;
+      //kxxMzzFromfcNEQ_NWB=0.0;
+      //kxxMzzFromfcNEQ_NEB=0.0;
+      //kxxMzzFromfcNEQ_SEB=0.0;
+
+
+
+
+
+   a0 = (-kxxMyyFromfcNEQ_NEB - kxxMyyFromfcNEQ_NET + kxxMyyFromfcNEQ_NWB + kxxMyyFromfcNEQ_NWT -
+      kxxMyyFromfcNEQ_SEB - kxxMyyFromfcNEQ_SET + kxxMyyFromfcNEQ_SWB + kxxMyyFromfcNEQ_SWT -
+      kxxMzzFromfcNEQ_NEB - kxxMzzFromfcNEQ_NET + kxxMzzFromfcNEQ_NWB + kxxMzzFromfcNEQ_NWT -
+      kxxMzzFromfcNEQ_SEB - kxxMzzFromfcNEQ_SET + kxxMzzFromfcNEQ_SWB + kxxMzzFromfcNEQ_SWT -
+      2.*kxyFromfcNEQ_NEB - 2.*kxyFromfcNEQ_NET - 2.*kxyFromfcNEQ_NWB - 2.*kxyFromfcNEQ_NWT +
+      2.*kxyFromfcNEQ_SEB + 2.*kxyFromfcNEQ_SET + 2.*kxyFromfcNEQ_SWB + 2.*kxyFromfcNEQ_SWT +
+      2.*kxzFromfcNEQ_NEB - 2.*kxzFromfcNEQ_NET + 2.*kxzFromfcNEQ_NWB - 2.*kxzFromfcNEQ_NWT +
+      2.*kxzFromfcNEQ_SEB - 2.*kxzFromfcNEQ_SET + 2.*kxzFromfcNEQ_SWB - 2.*kxzFromfcNEQ_SWT +
+      8.*vx1_NEB + 8.*vx1_NET + 8.*vx1_NWB + 8.*vx1_NWT + 8.*vx1_SEB +
+      8.*vx1_SET + 8.*vx1_SWB + 8.*vx1_SWT + 2.*vx2_NEB + 2.*vx2_NET -
+      2.*vx2_NWB - 2.*vx2_NWT - 2.*vx2_SEB - 2.*vx2_SET + 2.*vx2_SWB +
+      2.*vx2_SWT - 2.*vx3_NEB + 2.*vx3_NET + 2.*vx3_NWB - 2.*vx3_NWT -
+      2.*vx3_SEB + 2.*vx3_SET + 2.*vx3_SWB - 2.*vx3_SWT)/64.;
+   b0 = (2.*kxxMyyFromfcNEQ_NEB + 2.*kxxMyyFromfcNEQ_NET + 2.*kxxMyyFromfcNEQ_NWB + 2.*kxxMyyFromfcNEQ_NWT -
+      2.*kxxMyyFromfcNEQ_SEB - 2.*kxxMyyFromfcNEQ_SET - 2.*kxxMyyFromfcNEQ_SWB - 2.*kxxMyyFromfcNEQ_SWT -
+      kxxMzzFromfcNEQ_NEB - kxxMzzFromfcNEQ_NET - kxxMzzFromfcNEQ_NWB - kxxMzzFromfcNEQ_NWT +
+      kxxMzzFromfcNEQ_SEB + kxxMzzFromfcNEQ_SET + kxxMzzFromfcNEQ_SWB + kxxMzzFromfcNEQ_SWT -
+      2.*kxyFromfcNEQ_NEB - 2.*kxyFromfcNEQ_NET + 2.*kxyFromfcNEQ_NWB + 2.*kxyFromfcNEQ_NWT -
+      2.*kxyFromfcNEQ_SEB - 2.*kxyFromfcNEQ_SET + 2.*kxyFromfcNEQ_SWB + 2.*kxyFromfcNEQ_SWT +
+      2.*kyzFromfcNEQ_NEB - 2.*kyzFromfcNEQ_NET + 2.*kyzFromfcNEQ_NWB - 2.*kyzFromfcNEQ_NWT +
+      2.*kyzFromfcNEQ_SEB - 2.*kyzFromfcNEQ_SET + 2.*kyzFromfcNEQ_SWB - 2.*kyzFromfcNEQ_SWT +
+      2.*vx1_NEB + 2.*vx1_NET - 2.*vx1_NWB - 2.*vx1_NWT -
+      2.*vx1_SEB - 2.*vx1_SET + 2.*vx1_SWB + 2.*vx1_SWT +
+      8.*vx2_NEB + 8.*vx2_NET + 8.*vx2_NWB + 8.*vx2_NWT +
+      8.*vx2_SEB + 8.*vx2_SET + 8.*vx2_SWB + 8.*vx2_SWT -
+      2.*vx3_NEB + 2.*vx3_NET - 2.*vx3_NWB + 2.*vx3_NWT +
+      2.*vx3_SEB - 2.*vx3_SET + 2.*vx3_SWB - 2.*vx3_SWT)/64.;
+   c0 = (kxxMyyFromfcNEQ_NEB - kxxMyyFromfcNEQ_NET + kxxMyyFromfcNEQ_NWB - kxxMyyFromfcNEQ_NWT +
+      kxxMyyFromfcNEQ_SEB - kxxMyyFromfcNEQ_SET + kxxMyyFromfcNEQ_SWB - kxxMyyFromfcNEQ_SWT -
+      2.*kxxMzzFromfcNEQ_NEB + 2.*kxxMzzFromfcNEQ_NET - 2.*kxxMzzFromfcNEQ_NWB + 2.*kxxMzzFromfcNEQ_NWT -
+      2.*kxxMzzFromfcNEQ_SEB + 2.*kxxMzzFromfcNEQ_SET - 2.*kxxMzzFromfcNEQ_SWB + 2.*kxxMzzFromfcNEQ_SWT -
+      2.*kxzFromfcNEQ_NEB - 2.*kxzFromfcNEQ_NET + 2.*kxzFromfcNEQ_NWB + 2.*kxzFromfcNEQ_NWT -
+      2.*kxzFromfcNEQ_SEB - 2.*kxzFromfcNEQ_SET + 2.*kxzFromfcNEQ_SWB + 2.*kxzFromfcNEQ_SWT -
+      2.*kyzFromfcNEQ_NEB - 2.*kyzFromfcNEQ_NET - 2.*kyzFromfcNEQ_NWB - 2.*kyzFromfcNEQ_NWT +
+      2.*kyzFromfcNEQ_SEB + 2.*kyzFromfcNEQ_SET + 2.*kyzFromfcNEQ_SWB + 2.*kyzFromfcNEQ_SWT -
+      2.*vx1_NEB + 2.*vx1_NET + 2.*vx1_NWB - 2.*vx1_NWT -
+      2.*vx1_SEB + 2.*vx1_SET + 2.*vx1_SWB - 2.*vx1_SWT -
+      2.*vx2_NEB + 2.*vx2_NET - 2.*vx2_NWB + 2.*vx2_NWT +
+      2.*vx2_SEB - 2.*vx2_SET + 2.*vx2_SWB - 2.*vx2_SWT +
+      8.*vx3_NEB + 8.*vx3_NET + 8.*vx3_NWB + 8.*vx3_NWT +
+      8.*vx3_SEB + 8.*vx3_SET + 8.*vx3_SWB + 8.*vx3_SWT)/64.;
+   ax = (vx1_NEB + vx1_NET - vx1_NWB - vx1_NWT + vx1_SEB + vx1_SET - vx1_SWB - vx1_SWT)/4.;
+   bx = (vx2_NEB + vx2_NET - vx2_NWB - vx2_NWT + vx2_SEB + vx2_SET - vx2_SWB - vx2_SWT)/4.;
+   cx = (vx3_NEB + vx3_NET - vx3_NWB - vx3_NWT + vx3_SEB + vx3_SET - vx3_SWB - vx3_SWT)/4.;
+   axx= (kxxMyyFromfcNEQ_NEB + kxxMyyFromfcNEQ_NET - kxxMyyFromfcNEQ_NWB - kxxMyyFromfcNEQ_NWT +
+      kxxMyyFromfcNEQ_SEB + kxxMyyFromfcNEQ_SET - kxxMyyFromfcNEQ_SWB - kxxMyyFromfcNEQ_SWT +
+      kxxMzzFromfcNEQ_NEB + kxxMzzFromfcNEQ_NET - kxxMzzFromfcNEQ_NWB - kxxMzzFromfcNEQ_NWT +
+      kxxMzzFromfcNEQ_SEB + kxxMzzFromfcNEQ_SET - kxxMzzFromfcNEQ_SWB - kxxMzzFromfcNEQ_SWT +
+      2.*vx2_NEB + 2.*vx2_NET - 2.*vx2_NWB - 2.*vx2_NWT -
+      2.*vx2_SEB - 2.*vx2_SET + 2.*vx2_SWB + 2.*vx2_SWT -
+      2.*vx3_NEB + 2.*vx3_NET + 2.*vx3_NWB - 2.*vx3_NWT -
+      2.*vx3_SEB + 2.*vx3_SET + 2.*vx3_SWB - 2.*vx3_SWT)/16.;
+   bxx= (kxyFromfcNEQ_NEB + kxyFromfcNEQ_NET - kxyFromfcNEQ_NWB - kxyFromfcNEQ_NWT +
+      kxyFromfcNEQ_SEB + kxyFromfcNEQ_SET - kxyFromfcNEQ_SWB - kxyFromfcNEQ_SWT -
+      2.*vx1_NEB - 2.*vx1_NET + 2.*vx1_NWB + 2.*vx1_NWT +
+      2.*vx1_SEB + 2.*vx1_SET - 2.*vx1_SWB - 2.*vx1_SWT)/8.;
+   cxx= (kxzFromfcNEQ_NEB + kxzFromfcNEQ_NET - kxzFromfcNEQ_NWB - kxzFromfcNEQ_NWT +
+      kxzFromfcNEQ_SEB + kxzFromfcNEQ_SET - kxzFromfcNEQ_SWB - kxzFromfcNEQ_SWT +
+      2.*vx1_NEB - 2.*vx1_NET - 2.*vx1_NWB + 2.*vx1_NWT +
+      2.*vx1_SEB - 2.*vx1_SET - 2.*vx1_SWB + 2.*vx1_SWT)/8.;
+   ay = (vx1_NEB + vx1_NET + vx1_NWB + vx1_NWT - vx1_SEB - vx1_SET - vx1_SWB - vx1_SWT)/4.;
+   by = (vx2_NEB + vx2_NET + vx2_NWB + vx2_NWT - vx2_SEB - vx2_SET - vx2_SWB - vx2_SWT)/4.;
+   cy = (vx3_NEB + vx3_NET + vx3_NWB + vx3_NWT - vx3_SEB - vx3_SET - vx3_SWB - vx3_SWT)/4.;
+   ayy= (kxyFromfcNEQ_NEB + kxyFromfcNEQ_NET + kxyFromfcNEQ_NWB + kxyFromfcNEQ_NWT -
+      kxyFromfcNEQ_SEB - kxyFromfcNEQ_SET - kxyFromfcNEQ_SWB - kxyFromfcNEQ_SWT -
+      2.*vx2_NEB - 2.*vx2_NET + 2.*vx2_NWB + 2.*vx2_NWT +
+      2.*vx2_SEB + 2.*vx2_SET - 2.*vx2_SWB - 2.*vx2_SWT)/8.;
+   byy= (-2.*kxxMyyFromfcNEQ_NEB - 2.*kxxMyyFromfcNEQ_NET - 2.*kxxMyyFromfcNEQ_NWB - 2.*kxxMyyFromfcNEQ_NWT +
+      2.*kxxMyyFromfcNEQ_SEB + 2.*kxxMyyFromfcNEQ_SET + 2.*kxxMyyFromfcNEQ_SWB + 2.*kxxMyyFromfcNEQ_SWT +
+      kxxMzzFromfcNEQ_NEB + kxxMzzFromfcNEQ_NET + kxxMzzFromfcNEQ_NWB + kxxMzzFromfcNEQ_NWT -
+      kxxMzzFromfcNEQ_SEB - kxxMzzFromfcNEQ_SET - kxxMzzFromfcNEQ_SWB - kxxMzzFromfcNEQ_SWT +
+      2.*vx1_NEB + 2.*vx1_NET - 2.*vx1_NWB - 2.*vx1_NWT -
+      2.*vx1_SEB - 2.*vx1_SET + 2.*vx1_SWB + 2.*vx1_SWT -
+      2.*vx3_NEB + 2.*vx3_NET - 2.*vx3_NWB + 2.*vx3_NWT +
+      2.*vx3_SEB - 2.*vx3_SET + 2.*vx3_SWB - 2.*vx3_SWT)/16.;
+   cyy= (kyzFromfcNEQ_NEB + kyzFromfcNEQ_NET + kyzFromfcNEQ_NWB + kyzFromfcNEQ_NWT -
+      kyzFromfcNEQ_SEB - kyzFromfcNEQ_SET - kyzFromfcNEQ_SWB - kyzFromfcNEQ_SWT +
+      2.*vx2_NEB - 2.*vx2_NET + 2.*vx2_NWB - 2.*vx2_NWT -
+      2.*vx2_SEB + 2.*vx2_SET - 2.*vx2_SWB + 2.*vx2_SWT)/8.;
+   az = (-vx1_NEB + vx1_NET - vx1_NWB + vx1_NWT - vx1_SEB + vx1_SET - vx1_SWB + vx1_SWT)/4.;
+   bz = (-vx2_NEB + vx2_NET - vx2_NWB + vx2_NWT - vx2_SEB + vx2_SET - vx2_SWB + vx2_SWT)/4.;
+   cz = (-vx3_NEB + vx3_NET - vx3_NWB + vx3_NWT - vx3_SEB + vx3_SET - vx3_SWB + vx3_SWT)/4.;
+   azz= (-kxzFromfcNEQ_NEB + kxzFromfcNEQ_NET - kxzFromfcNEQ_NWB + kxzFromfcNEQ_NWT -
+      kxzFromfcNEQ_SEB + kxzFromfcNEQ_SET - kxzFromfcNEQ_SWB + kxzFromfcNEQ_SWT +
+      2.*vx3_NEB - 2.*vx3_NET - 2.*vx3_NWB + 2.*vx3_NWT +
+      2.*vx3_SEB - 2.*vx3_SET - 2.*vx3_SWB + 2.*vx3_SWT)/8.;
+   bzz= (-kyzFromfcNEQ_NEB + kyzFromfcNEQ_NET - kyzFromfcNEQ_NWB + kyzFromfcNEQ_NWT -
+      kyzFromfcNEQ_SEB + kyzFromfcNEQ_SET - kyzFromfcNEQ_SWB + kyzFromfcNEQ_SWT +
+      2.*vx3_NEB - 2.*vx3_NET + 2.*vx3_NWB - 2.*vx3_NWT -
+      2.*vx3_SEB + 2.*vx3_SET - 2.*vx3_SWB + 2.*vx3_SWT)/8.;
+   czz= (-kxxMyyFromfcNEQ_NEB + kxxMyyFromfcNEQ_NET - kxxMyyFromfcNEQ_NWB + kxxMyyFromfcNEQ_NWT -
+      kxxMyyFromfcNEQ_SEB + kxxMyyFromfcNEQ_SET - kxxMyyFromfcNEQ_SWB + kxxMyyFromfcNEQ_SWT +
+      2.*kxxMzzFromfcNEQ_NEB - 2.*kxxMzzFromfcNEQ_NET + 2.*kxxMzzFromfcNEQ_NWB - 2.*kxxMzzFromfcNEQ_NWT +
+      2.*kxxMzzFromfcNEQ_SEB - 2.*kxxMzzFromfcNEQ_SET + 2.*kxxMzzFromfcNEQ_SWB - 2.*kxxMzzFromfcNEQ_SWT -
+      2.*vx1_NEB + 2.*vx1_NET + 2.*vx1_NWB - 2.*vx1_NWT -
+      2.*vx1_SEB + 2.*vx1_SET + 2.*vx1_SWB - 2.*vx1_SWT -
+      2.*vx2_NEB + 2.*vx2_NET - 2.*vx2_NWB + 2.*vx2_NWT +
+      2.*vx2_SEB - 2.*vx2_SET + 2.*vx2_SWB - 2.*vx2_SWT)/16.;
+   axy= (vx1_NEB + vx1_NET - vx1_NWB - vx1_NWT - vx1_SEB - vx1_SET + vx1_SWB + vx1_SWT)/2.;
+   bxy= (vx2_NEB + vx2_NET - vx2_NWB - vx2_NWT - vx2_SEB - vx2_SET + vx2_SWB + vx2_SWT)/2.;
+   cxy= (vx3_NEB + vx3_NET - vx3_NWB - vx3_NWT - vx3_SEB - vx3_SET + vx3_SWB + vx3_SWT)/2.;
+   axz= (-vx1_NEB + vx1_NET + vx1_NWB - vx1_NWT - vx1_SEB + vx1_SET + vx1_SWB - vx1_SWT)/2.;
+   bxz= (-vx2_NEB + vx2_NET + vx2_NWB - vx2_NWT - vx2_SEB + vx2_SET + vx2_SWB - vx2_SWT)/2.;
+   cxz= (-vx3_NEB + vx3_NET + vx3_NWB - vx3_NWT - vx3_SEB + vx3_SET + vx3_SWB - vx3_SWT)/2.;
+   ayz= (-vx1_NEB + vx1_NET - vx1_NWB + vx1_NWT + vx1_SEB - vx1_SET + vx1_SWB - vx1_SWT)/2.;
+   byz= (-vx2_NEB + vx2_NET - vx2_NWB + vx2_NWT + vx2_SEB - vx2_SET + vx2_SWB - vx2_SWT)/2.;
+   cyz= (-vx3_NEB + vx3_NET - vx3_NWB + vx3_NWT + vx3_SEB - vx3_SET + vx3_SWB - vx3_SWT)/2.;
+   axyz=-vx1_NEB + vx1_NET + vx1_NWB - vx1_NWT + vx1_SEB - vx1_SET - vx1_SWB + vx1_SWT;
+   bxyz=-vx2_NEB + vx2_NET + vx2_NWB - vx2_NWT + vx2_SEB - vx2_SET - vx2_SWB + vx2_SWT;
+   cxyz=-vx3_NEB + vx3_NET + vx3_NWB - vx3_NWT + vx3_SEB - vx3_SET - vx3_SWB + vx3_SWT;
+
+
+   //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+   kxyAverage       =0;//(kxyFromfcNEQ_SWB+
+                       //kxyFromfcNEQ_SWT+
+                       //kxyFromfcNEQ_SET+
+                       //kxyFromfcNEQ_SEB+
+                       //kxyFromfcNEQ_NWB+
+                       //kxyFromfcNEQ_NWT+
+                       //kxyFromfcNEQ_NET+
+                       //kxyFromfcNEQ_NEB)*c1o8-(ay+bx);
+   kyzAverage       =0;//(kyzFromfcNEQ_SWB+
+                       //kyzFromfcNEQ_SWT+
+                       //kyzFromfcNEQ_SET+
+                       //kyzFromfcNEQ_SEB+
+                       //kyzFromfcNEQ_NWB+
+                       //kyzFromfcNEQ_NWT+
+                       //kyzFromfcNEQ_NET+
+                       //kyzFromfcNEQ_NEB)*c1o8-(bz+cy);
+   kxzAverage       =0;//(kxzFromfcNEQ_SWB+
+                       //kxzFromfcNEQ_SWT+
+                       //kxzFromfcNEQ_SET+
+                       //kxzFromfcNEQ_SEB+
+                       //kxzFromfcNEQ_NWB+
+                       //kxzFromfcNEQ_NWT+
+                       //kxzFromfcNEQ_NET+
+                       //kxzFromfcNEQ_NEB)*c1o8-(az+cx);
+   kxxMyyAverage    =0;//(kxxMyyFromfcNEQ_SWB+
+                       //kxxMyyFromfcNEQ_SWT+
+                       //kxxMyyFromfcNEQ_SET+
+                       //kxxMyyFromfcNEQ_SEB+
+                       //kxxMyyFromfcNEQ_NWB+
+                       //kxxMyyFromfcNEQ_NWT+
+                       //kxxMyyFromfcNEQ_NET+
+                       //kxxMyyFromfcNEQ_NEB)*c1o8-(ax-by);
+   kxxMzzAverage    =0;//(kxxMzzFromfcNEQ_SWB+
+                       //kxxMzzFromfcNEQ_SWT+
+                       //kxxMzzFromfcNEQ_SET+
+                       //kxxMzzFromfcNEQ_SEB+
+                       //kxxMzzFromfcNEQ_NWB+
+                       //kxxMzzFromfcNEQ_NWT+
+                       //kxxMzzFromfcNEQ_NET+
+                       //kxxMzzFromfcNEQ_NEB)*c1o8-(ax-cz);
+   ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+   //
+   // Bernd das Brot
+   //
+   ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+   a0 = a0 + xoff * ax + yoff * ay + zoff * az + xoff_sq * axx + yoff_sq * ayy + zoff_sq * azz + xoff*yoff*axy + xoff*zoff*axz + yoff*zoff*ayz + xoff*yoff*zoff*axyz ;
+   ax = ax + 2. * xoff * axx + yoff * axy + zoff * axz + yoff*zoff*axyz;
+   ay = ay + 2. * yoff * ayy + xoff * axy + zoff * ayz + xoff*zoff*axyz;
+   az = az + 2. * zoff * azz + xoff * axz + yoff * ayz + xoff*yoff*axyz;
+   b0 = b0 + xoff * bx + yoff * by + zoff * bz + xoff_sq * bxx + yoff_sq * byy + zoff_sq * bzz + xoff*yoff*bxy + xoff*zoff*bxz + yoff*zoff*byz + xoff*yoff*zoff*bxyz;
+   bx = bx + 2. * xoff * bxx + yoff * bxy + zoff * bxz + yoff*zoff*bxyz;
+   by = by + 2. * yoff * byy + xoff * bxy + zoff * byz + xoff*zoff*bxyz;
+   bz = bz + 2. * zoff * bzz + xoff * bxz + yoff * byz + xoff*yoff*bxyz;
+   c0 = c0 + xoff * cx + yoff * cy + zoff * cz + xoff_sq * cxx + yoff_sq * cyy + zoff_sq * czz + xoff*yoff*cxy + xoff*zoff*cxz + yoff*zoff*cyz + xoff*yoff*zoff*cxyz;
+   cx = cx + 2. * xoff * cxx + yoff * cxy + zoff * cxz + yoff*zoff*cxyz;
+   cy = cy + 2. * yoff * cyy + xoff * cxy + zoff * cyz + xoff*zoff*cxyz;
+   cz = cz + 2. * zoff * czz + xoff * cxz + yoff * cyz + xoff*yoff*cxyz;
+   axy= axy + zoff*axyz;
+   axz= axz + yoff*axyz;
+   ayz= ayz + xoff*axyz;
+   bxy= bxy + zoff*bxyz;
+   bxz= bxz + yoff*bxyz;
+   byz= byz + xoff*bxyz;
+   cxy= cxy + zoff*cxyz;
+   cxz= cxz + yoff*cxyz;
+   cyz= cyz + xoff*cxyz;
+   ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+   const LBMReal o = omega;
+
+   f_E = eps_new*((2*(-2*ax + by + cz-kxxMzzAverage-kxxMyyAverage))/(27.*o));
+   f_N = eps_new*((2*(ax - 2*by + cz+2*kxxMyyAverage-kxxMzzAverage))/(27.*o));
+   f_T = eps_new*((2*(ax + by - 2*cz-kxxMyyAverage+2*kxxMzzAverage))/(27.*o));
+   f_NE = eps_new*(-(ax + 3*ay + 3*bx + by - 2*cz+2*kxxMyyAverage-kxxMyyAverage+3*kxyAverage)/(54.*o));
+   f_SE = eps_new*(-(ax - 3*ay - 3*bx + by - 2*cz+2*kxxMyyAverage-kxxMyyAverage-3*kxyAverage)/(54.*o));
+   f_TE = eps_new*(-(ax + 3*az - 2*by + 3*cx + cz+2*kxxMyyAverage-kxxMzzAverage+3*kxzAverage)/(54.*o));
+   f_BE = eps_new*(-(ax - 3*az - 2*by - 3*cx + cz+2*kxxMyyAverage-kxxMzzAverage-3*kxzAverage)/(54.*o));
+   f_TN = eps_new*(-(-2*ax + by + 3*bz + 3*cy + cz-kxxMyyAverage-kxxMzzAverage+3*kyzAverage)/(54.*o));
+   f_BN = eps_new*(-(-2*ax + by - 3*bz - 3*cy + cz-kxxMyyAverage-kxxMzzAverage-3*kyzAverage)/(54.*o));
+   f_ZERO = 0.;
+   f_TNE = eps_new*(-(ay + az + bx + bz + cx + cy+kxyAverage+kxzAverage+kyzAverage)/(72.*o));
+   f_TSW = eps_new*((-ay + az - bx + bz + cx + cy-kxyAverage+kxzAverage+kyzAverage)/(72.*o));
+   f_TSE = eps_new*((ay - az + bx + bz - cx + cy+kxyAverage-kxzAverage+kyzAverage)/(72.*o));
+   f_TNW = eps_new*((ay + az + bx - bz + cx - cy+kxyAverage+kxzAverage-kyzAverage)/(72.*o));
+
+   x_E = 0.25*eps_new*((2*(-4*axx + bxy + cxz))/(27.*o));
+   x_N = 0.25*eps_new*((2*(2*axx - 2*bxy + cxz))/(27.*o));
+   x_T = 0.25*eps_new*((2*(2*axx + bxy - 2*cxz))/(27.*o));
+   x_NE = 0.25*eps_new*(-((2*axx + 3*axy + 6*bxx + bxy - 2*cxz))/(54.*o));
+   x_SE = 0.25*eps_new*(-((2*axx - 3*axy - 6*bxx + bxy - 2*cxz))/(54.*o));
+   x_TE = 0.25*eps_new*(-((2*axx + 3*axz - 2*bxy + 6*cxx + cxz))/(54.*o));
+   x_BE = 0.25*eps_new*(-((2*axx - 3*axz - 2*bxy - 6*cxx + cxz))/(54.*o));
+   x_TN = 0.25*eps_new*(-((-4*axx + bxy + 3*bxz + 3*cxy + cxz))/(54.*o));
+   x_BN = 0.25*eps_new*(-((-4*axx + bxy - 3*bxz - 3*cxy + cxz))/(54.*o));
+   x_ZERO = 0.;
+   x_TNE = 0.25*eps_new*(-((axy + axz + 2*bxx + bxz + 2*cxx + cxy))/(72.*o));
+   x_TSW = 0.25*eps_new*(((-axy + axz - 2*bxx + bxz + 2*cxx + cxy))/(72.*o));
+   x_TSE = 0.25*eps_new*(((axy - axz + 2*bxx + bxz - 2*cxx + cxy))/(72.*o));
+   x_TNW = 0.25*eps_new*(((axy + axz + 2*bxx - bxz + 2*cxx - cxy))/(72.*o));
+
+   y_E = 0.25*eps_new*(2*(-2*axy + 2*byy + cyz))/(27.*o);
+   y_N = 0.25*eps_new*(2*(axy - 4*byy + cyz))/(27.*o);
+   y_T = 0.25*eps_new*(2*(axy + 2*byy - 2*cyz))/(27.*o);
+   y_NE = 0.25*eps_new*(-((axy + 6*ayy + 3*bxy + 2*byy - 2*cyz))/(54.*o));
+   y_SE = 0.25*eps_new*(-((axy - 6*ayy - 3*bxy + 2*byy - 2*cyz))/(54.*o));
+   y_TE = 0.25*eps_new*(-((axy + 3*ayz - 4*byy + 3*cxy + cyz))/(54.*o));
+   y_BE = 0.25*eps_new*(-((axy - 3*ayz - 4*byy - 3*cxy + cyz))/(54.*o));
+   y_TN = 0.25*eps_new*(-((-2*axy + 2*byy + 3*byz + 6*cyy + cyz))/(54.*o));
+   y_BN = 0.25*eps_new*(-((-2*axy + 2*byy - 3*byz - 6*cyy + cyz))/(54.*o));
+   y_ZERO = 0.;
+   y_TNE = 0.25*eps_new*(-((2*ayy + ayz + bxy + byz + cxy + 2*cyy))/(72.*o));
+   y_TSW = 0.25*eps_new*(((-2*ayy + ayz - bxy + byz + cxy + 2*cyy))/(72.*o));
+   y_TSE = 0.25*eps_new*(((2*ayy - ayz + bxy + byz - cxy + 2*cyy))/(72.*o));
+   y_TNW = 0.25*eps_new*(((2*ayy + ayz + bxy - byz + cxy - 2*cyy))/(72.*o));
+
+   z_E = 0.25*eps_new*((2*(-2*axz + byz + 2*czz))/(27.*o));
+   z_N = 0.25*eps_new*((2*(axz - 2*byz + 2*czz))/(27.*o));
+   z_T = 0.25*eps_new*((2*(axz + byz - 4*czz))/(27.*o));
+   z_NE = 0.25*eps_new*(-((axz + 3*ayz + 3*bxz + byz - 4*czz))/(54.*o));
+   z_SE = 0.25*eps_new*(-((axz - 3*ayz - 3*bxz + byz - 4*czz))/(54.*o));
+   z_TE = 0.25*eps_new*(-((axz + 6*azz - 2*byz + 3*cxz + 2*czz))/(54.*o));
+   z_BE = 0.25*eps_new*(-((axz - 6*azz - 2*byz - 3*cxz + 2*czz))/(54.*o));
+   z_TN = 0.25*eps_new*(-((-2*axz + byz + 6*bzz + 3*cyz + 2*czz))/(54.*o));
+   z_BN = 0.25*eps_new*(-((-2*axz + byz - 6*bzz - 3*cyz + 2*czz))/(54.*o));
+   z_ZERO = 0.;
+   z_TNE = 0.25*eps_new*(-((ayz + 2*azz + bxz + 2*bzz + cxz + cyz))/(72.*o));
+   z_TSW = 0.25*eps_new*(((-ayz + 2*azz - bxz + 2*bzz + cxz + cyz))/(72.*o));
+   z_TSE = 0.25*eps_new*(((ayz - 2*azz + bxz + 2*bzz - cxz + cyz))/(72.*o));
+   z_TNW = 0.25*eps_new*(((ayz + 2*azz + bxz - 2*bzz + cxz - cyz))/(72.*o));
+
+   xy_E   =   0.0625*eps_new *((                       2.*cxyz)/(27.*o));
+   xy_N   =   0.0625*eps_new *((                       2.*cxyz)/(27.*o));
+   xy_T   = -(0.0625*eps_new *((                       4.*cxyz)/(27.*o)));
+   xy_NE  =   0.0625*eps_new *(                            cxyz /(27.*o));
+   xy_SE  =   0.0625*eps_new *(                            cxyz /(27.*o));
+   xy_TE  = -(0.0625*eps_new *(( 3.*axyz            +     cxyz)/(54.*o)));
+   xy_BE  = -(0.0625*eps_new *((-3.*axyz            +     cxyz)/(54.*o)));
+   xy_TN  = -(0.0625*eps_new *((            3.*bxyz +     cxyz)/(54.*o)));
+   xy_BN  = -(0.0625*eps_new *((          - 3.*bxyz +     cxyz)/(54.*o)));
+   //xy_ZERO=   0.0625*eps_new;
+   xy_TNE = -(0.0625*eps_new *((     axyz +     bxyz           )/(72.*o)));
+   xy_TSW =   0.0625*eps_new *((     axyz +     bxyz           )/(72.*o));
+   xy_TSE =   0.0625*eps_new *((-    axyz +     bxyz           )/(72.*o));
+   xy_TNW =   0.0625*eps_new *((     axyz -     bxyz           )/(72.*o));
+
+   xz_E   =   0.0625*eps_new *((            2.*bxyz           )/(27.*o));
+   xz_N   = -(0.0625*eps_new *((            4.*bxyz           )/(27.*o)));
+   xz_T   =   0.0625*eps_new *((            2.*bxyz           )/(27.*o));
+   xz_NE  = -(0.0625*eps_new *(( 3.*axyz +     bxyz           )/(54.*o)));
+   xz_SE  = -(0.0625*eps_new *((-3.*axyz +     bxyz           )/(54.*o)));
+   xz_TE  =   0.0625*eps_new *((                bxyz           )/(27.*o));
+   xz_BE  =   0.0625*eps_new *((                bxyz           )/(27.*o));
+   xz_TN  = -(0.0625*eps_new *((                bxyz + 3.*cxyz)/(54.*o)));
+   xz_BN  = -(0.0625*eps_new *((                bxyz - 3.*cxyz)/(54.*o)));
+   //xz_ZERO=   0.0625*eps_new;
+   xz_TNE = -(0.0625*eps_new *((     axyz            +     cxyz)/(72.*o)));
+   xz_TSW =   0.0625*eps_new *((-    axyz            +     cxyz)/(72.*o));
+   xz_TSE =   0.0625*eps_new *((     axyz            +     cxyz)/(72.*o));
+   xz_TNW =   0.0625*eps_new *((     axyz            -     cxyz)/(72.*o));
+
+   yz_E   = -(0.0625*eps_new *(( 4.*axyz                      )/(27.*o)));
+   yz_N   =   0.0625*eps_new *(( 2.*axyz                      )/(27.*o));
+   yz_T   =   0.0625*eps_new *(( 2.*axyz                      )/(27.*o));
+   yz_NE  = -(0.0625*eps_new *((     axyz + 3.*bxyz           )/(54.*o)));
+   yz_SE  = -(0.0625*eps_new *((     axyz - 3.*bxyz           )/(54.*o)));
+   yz_TE  = -(0.0625*eps_new *((     axyz            + 3.*cxyz)/(54.*o)));
+   yz_BE  = -(0.0625*eps_new *((     axyz            - 3.*cxyz)/(54.*o)));
+   yz_TN  =   0.0625*eps_new *((     axyz                      )/(27.*o));
+   yz_BN  =   0.0625*eps_new *((     axyz                      )/(27.*o));
+   //yz_ZERO=   0.0625*eps_new;
+   yz_TNE = -(0.0625*eps_new *((                bxyz +     cxyz)/(72.*o)));
+   yz_TSW =   0.0625*eps_new *((          -     bxyz +     cxyz)/(72.*o));
+   yz_TSE =   0.0625*eps_new *((                bxyz -     cxyz)/(72.*o));
+   yz_TNW =   0.0625*eps_new *((                bxyz +     cxyz)/(72.*o));
+}
+//////////////////////////////////////////////////////////////////////////
+void CompressibleOffsetInterpolationProcessor::calcInterpolatedNodeCF(LBMReal* f, LBMReal omega, LBMReal x, LBMReal y, LBMReal z, LBMReal press, LBMReal xs, LBMReal ys, LBMReal zs)
+{
+   using namespace D3Q27System;
+
+   LBMReal rho  = press ;//+ (2.*axx*x+axy*y+axz*z+axyz*y*z+ax + 2.*byy*y+bxy*x+byz*z+bxyz*x*z+by + 2.*czz*z+cxz*x+cyz*y+cxyz*x*y+cz)/3.;
+   LBMReal vx1  = a0 + 0.25*( xs*ax + ys*ay + zs*az) + 0.0625*(axx + xs*ys*axy + xs*zs*axz + ayy + ys*zs*ayz + azz) + 0.015625*(xs*ys*zs*axyz);
+   LBMReal vx2  = b0 + 0.25*( xs*bx + ys*by + zs*bz) + 0.0625*(bxx + xs*ys*bxy + xs*zs*bxz + byy + ys*zs*byz + bzz) + 0.015625*(xs*ys*zs*bxyz);
+   LBMReal vx3  = c0 + 0.25*( xs*cx + ys*cy + zs*cz) + 0.0625*(cxx + xs*ys*cxy + xs*zs*cxz + cyy + ys*zs*cyz + czz) + 0.015625*(xs*ys*zs*cxyz);
+
+   //////////////////////////////////////////////////////////////////////////
+   //DRAFT
+   //vx1 -= forcingF*0.5;
+   //////////////////////////////////////////////////////////////////////////
+
+   LBMReal feq[ENDF+1];
+   D3Q27System::calcCompFeq(feq,rho,vx1,vx2,vx3);
+
+   f[E]    = f_E    + xs*x_E    + ys*y_E    + zs*z_E    + xs*ys*xy_E    + xs*zs*xz_E    + ys*zs*yz_E    + feq[E];
+   f[W]    = f_E    + xs*x_E    + ys*y_E    + zs*z_E    + xs*ys*xy_E    + xs*zs*xz_E    + ys*zs*yz_E    + feq[W];
+   f[N]    = f_N    + xs*x_N    + ys*y_N    + zs*z_N    + xs*ys*xy_N    + xs*zs*xz_N    + ys*zs*yz_N    + feq[N];
+   f[S]    = f_N    + xs*x_N    + ys*y_N    + zs*z_N    + xs*ys*xy_N    + xs*zs*xz_N    + ys*zs*yz_N    + feq[S];
+   f[T]    = f_T    + xs*x_T    + ys*y_T    + zs*z_T    + xs*ys*xy_T    + xs*zs*xz_T    + ys*zs*yz_T    + feq[T];
+   f[B]    = f_T    + xs*x_T    + ys*y_T    + zs*z_T    + xs*ys*xy_T    + xs*zs*xz_T    + ys*zs*yz_T    + feq[B];
+   f[NE]   = f_NE   + xs*x_NE   + ys*y_NE   + zs*z_NE   + xs*ys*xy_NE   + xs*zs*xz_NE   + ys*zs*yz_NE   + feq[NE];
+   f[SW]   = f_NE   + xs*x_NE   + ys*y_NE   + zs*z_NE   + xs*ys*xy_NE   + xs*zs*xz_NE   + ys*zs*yz_NE   + feq[SW];
+   f[SE]   = f_SE   + xs*x_SE   + ys*y_SE   + zs*z_SE   + xs*ys*xy_SE   + xs*zs*xz_SE   + ys*zs*yz_SE   + feq[SE];
+   f[NW]   = f_SE   + xs*x_SE   + ys*y_SE   + zs*z_SE   + xs*ys*xy_SE   + xs*zs*xz_SE   + ys*zs*yz_SE   + feq[NW];
+   f[TE]   = f_TE   + xs*x_TE   + ys*y_TE   + zs*z_TE   + xs*ys*xy_TE   + xs*zs*xz_TE   + ys*zs*yz_TE   + feq[TE];
+   f[BW]   = f_TE   + xs*x_TE   + ys*y_TE   + zs*z_TE   + xs*ys*xy_TE   + xs*zs*xz_TE   + ys*zs*yz_TE   + feq[BW];
+   f[BE]   = f_BE   + xs*x_BE   + ys*y_BE   + zs*z_BE   + xs*ys*xy_BE   + xs*zs*xz_BE   + ys*zs*yz_BE   + feq[BE];
+   f[TW]   = f_BE   + xs*x_BE   + ys*y_BE   + zs*z_BE   + xs*ys*xy_BE   + xs*zs*xz_BE   + ys*zs*yz_BE   + feq[TW];
+   f[TN]   = f_TN   + xs*x_TN   + ys*y_TN   + zs*z_TN   + xs*ys*xy_TN   + xs*zs*xz_TN   + ys*zs*yz_TN   + feq[TN];
+   f[BS]   = f_TN   + xs*x_TN   + ys*y_TN   + zs*z_TN   + xs*ys*xy_TN   + xs*zs*xz_TN   + ys*zs*yz_TN   + feq[BS];
+   f[BN]   = f_BN   + xs*x_BN   + ys*y_BN   + zs*z_BN   + xs*ys*xy_BN   + xs*zs*xz_BN   + ys*zs*yz_BN   + feq[BN];
+   f[TS]   = f_BN   + xs*x_BN   + ys*y_BN   + zs*z_BN   + xs*ys*xy_BN   + xs*zs*xz_BN   + ys*zs*yz_BN   + feq[TS];
+   f[TNE]  = f_TNE  + xs*x_TNE  + ys*y_TNE  + zs*z_TNE  + xs*ys*xy_TNE  + xs*zs*xz_TNE  + ys*zs*yz_TNE  + feq[TNE];
+   f[TSW]  = f_TSW  + xs*x_TSW  + ys*y_TSW  + zs*z_TSW  + xs*ys*xy_TSW  + xs*zs*xz_TSW  + ys*zs*yz_TSW  + feq[TSW];
+   f[TSE]  = f_TSE  + xs*x_TSE  + ys*y_TSE  + zs*z_TSE  + xs*ys*xy_TSE  + xs*zs*xz_TSE  + ys*zs*yz_TSE  + feq[TSE];
+   f[TNW]  = f_TNW  + xs*x_TNW  + ys*y_TNW  + zs*z_TNW  + xs*ys*xy_TNW  + xs*zs*xz_TNW  + ys*zs*yz_TNW  + feq[TNW];
+   f[BNE]  = f_TSW  + xs*x_TSW  + ys*y_TSW  + zs*z_TSW  + xs*ys*xy_TSW  + xs*zs*xz_TSW  + ys*zs*yz_TSW  + feq[BNE];
+   f[BSW]  = f_TNE  + xs*x_TNE  + ys*y_TNE  + zs*z_TNE  + xs*ys*xy_TNE  + xs*zs*xz_TNE  + ys*zs*yz_TNE  + feq[BSW];
+   f[BSE]  = f_TNW  + xs*x_TNW  + ys*y_TNW  + zs*z_TNW  + xs*ys*xy_TNW  + xs*zs*xz_TNW  + ys*zs*yz_TNW  + feq[BSE];
+   f[BNW]  = f_TSE  + xs*x_TSE  + ys*y_TSE  + zs*z_TSE  + xs*ys*xy_TSE  + xs*zs*xz_TSE  + ys*zs*yz_TSE  + feq[BNW];
+   f[ZERO] = f_ZERO + xs*x_ZERO + ys*y_ZERO + zs*z_ZERO                                                 + feq[ZERO];
+}
+//////////////////////////////////////////////////////////////////////////
+//Position SWB -0.25, -0.25, -0.25
+LBMReal CompressibleOffsetInterpolationProcessor::calcPressBSW()
+{
+   return   press_SWT * (0.140625 + 0.1875 * xoff + 0.1875 * yoff - 0.5625 * zoff) +
+      press_NWT * (0.046875 + 0.0625 * xoff - 0.1875 * yoff - 0.1875 * zoff) +
+      press_SET * (0.046875 - 0.1875 * xoff + 0.0625 * yoff - 0.1875 * zoff) +
+      press_NET * (0.015625 - 0.0625 * xoff - 0.0625 * yoff - 0.0625 * zoff) +
+      press_NEB * (0.046875 - 0.1875 * xoff - 0.1875 * yoff + 0.0625 * zoff) +
+      press_NWB * (0.140625 + 0.1875 * xoff - 0.5625 * yoff + 0.1875 * zoff) +
+      press_SEB * (0.140625 - 0.5625 * xoff + 0.1875 * yoff + 0.1875 * zoff) +
+      press_SWB * (0.421875 + 0.5625 * xoff + 0.5625 * yoff + 0.5625 * zoff);
+}
+//////////////////////////////////////////////////////////////////////////
+//Position SWT -0.25, -0.25, 0.25
+LBMReal CompressibleOffsetInterpolationProcessor::calcPressTSW()
+{
+   return   press_SWT * (0.421875 + 0.5625 * xoff + 0.5625 * yoff - 0.5625 * zoff) +
+      press_NWT * (0.140625 + 0.1875 * xoff - 0.5625 * yoff - 0.1875 * zoff) +
+      press_SET * (0.140625 - 0.5625 * xoff + 0.1875 * yoff - 0.1875 * zoff) +
+      press_NET * (0.046875 - 0.1875 * xoff - 0.1875 * yoff - 0.0625 * zoff) +
+      press_NEB * (0.015625 - 0.0625 * xoff - 0.0625 * yoff + 0.0625 * zoff) +
+      press_NWB * (0.046875 + 0.0625 * xoff - 0.1875 * yoff + 0.1875 * zoff) +
+      press_SEB * (0.046875 - 0.1875 * xoff + 0.0625 * yoff + 0.1875 * zoff) +
+      press_SWB * (0.140625 + 0.1875 * xoff + 0.1875 * yoff + 0.5625 * zoff);
+}
+//////////////////////////////////////////////////////////////////////////
+//Position SET 0.25, -0.25, 0.25
+LBMReal CompressibleOffsetInterpolationProcessor::calcPressTSE()
+{
+   return   press_SET * (0.421875 - 0.5625 * xoff + 0.5625 * yoff - 0.5625 * zoff) +
+      press_NET * (0.140625 - 0.1875 * xoff - 0.5625 * yoff - 0.1875 * zoff) +
+      press_SWT * (0.140625 + 0.5625 * xoff + 0.1875 * yoff - 0.1875 * zoff) +
+      press_NWT * (0.046875 + 0.1875 * xoff - 0.1875 * yoff - 0.0625 * zoff) +
+      press_NWB * (0.015625 + 0.0625 * xoff - 0.0625 * yoff + 0.0625 * zoff) +
+      press_NEB * (0.046875 - 0.0625 * xoff - 0.1875 * yoff + 0.1875 * zoff) +
+      press_SWB * (0.046875 + 0.1875 * xoff + 0.0625 * yoff + 0.1875 * zoff) +
+      press_SEB * (0.140625 - 0.1875 * xoff + 0.1875 * yoff + 0.5625 * zoff);
+}
+//////////////////////////////////////////////////////////////////////////
+//Position SEB 0.25, -0.25, -0.25
+LBMReal CompressibleOffsetInterpolationProcessor::calcPressBSE()
+{
+   return   press_SET * (0.140625 - 0.1875 * xoff + 0.1875 * yoff - 0.5625 * zoff) +
+      press_NET * (0.046875 - 0.0625 * xoff - 0.1875 * yoff - 0.1875 * zoff) +
+      press_SWT * (0.046875 + 0.1875 * xoff + 0.0625 * yoff - 0.1875 * zoff) +
+      press_NWT * (0.015625 + 0.0625 * xoff - 0.0625 * yoff - 0.0625 * zoff) +
+      press_NWB * (0.046875 + 0.1875 * xoff - 0.1875 * yoff + 0.0625 * zoff) +
+      press_NEB * (0.140625 - 0.1875 * xoff - 0.5625 * yoff + 0.1875 * zoff) +
+      press_SWB * (0.140625 + 0.5625 * xoff + 0.1875 * yoff + 0.1875 * zoff) +
+      press_SEB * (0.421875 - 0.5625 * xoff + 0.5625 * yoff + 0.5625 * zoff);
+}
+//////////////////////////////////////////////////////////////////////////
+//Position NWB -0.25, 0.25, -0.25
+LBMReal CompressibleOffsetInterpolationProcessor::calcPressBNW()
+{
+   return   press_NWT * (0.140625 + 0.1875 * xoff - 0.1875 * yoff - 0.5625 * zoff) +
+      press_NET * (0.046875 - 0.1875 * xoff - 0.0625 * yoff - 0.1875 * zoff) +
+      press_SWT * (0.046875 + 0.0625 * xoff + 0.1875 * yoff - 0.1875 * zoff) +
+      press_SET * (0.015625 - 0.0625 * xoff + 0.0625 * yoff - 0.0625 * zoff) +
+      press_SEB * (0.046875 - 0.1875 * xoff + 0.1875 * yoff + 0.0625 * zoff) +
+      press_NEB * (0.140625 - 0.5625 * xoff - 0.1875 * yoff + 0.1875 * zoff) +
+      press_SWB * (0.140625 + 0.1875 * xoff + 0.5625 * yoff + 0.1875 * zoff) +
+      press_NWB * (0.421875 + 0.5625 * xoff - 0.5625 * yoff + 0.5625 * zoff);
+}
+//////////////////////////////////////////////////////////////////////////
+//Position NWT -0.25, 0.25, 0.25
+LBMReal CompressibleOffsetInterpolationProcessor::calcPressTNW()
+{
+   return   press_NWT * (0.421875 + 0.5625 * xoff - 0.5625 * yoff - 0.5625 * zoff) +
+      press_NET * (0.140625 - 0.5625 * xoff - 0.1875 * yoff - 0.1875 * zoff) +
+      press_SWT * (0.140625 + 0.1875 * xoff + 0.5625 * yoff - 0.1875 * zoff) +
+      press_SET * (0.046875 - 0.1875 * xoff + 0.1875 * yoff - 0.0625 * zoff) +
+      press_SEB * (0.015625 - 0.0625 * xoff + 0.0625 * yoff + 0.0625 * zoff) +
+      press_NEB * (0.046875 - 0.1875 * xoff - 0.0625 * yoff + 0.1875 * zoff) +
+      press_SWB * (0.046875 + 0.0625 * xoff + 0.1875 * yoff + 0.1875 * zoff) +
+      press_NWB * (0.140625 + 0.1875 * xoff - 0.1875 * yoff + 0.5625 * zoff);
+}
+//////////////////////////////////////////////////////////////////////////
+//Position NET 0.25, 0.25, 0.25
+LBMReal CompressibleOffsetInterpolationProcessor::calcPressTNE()
+{
+   return   press_NET * (0.421875 - 0.5625 * xoff - 0.5625 * yoff - 0.5625 * zoff) +
+      press_NWT * (0.140625 + 0.5625 * xoff - 0.1875 * yoff - 0.1875 * zoff) +
+      press_SET * (0.140625 - 0.1875 * xoff + 0.5625 * yoff - 0.1875 * zoff) +
+      press_SWT * (0.046875 + 0.1875 * xoff + 0.1875 * yoff - 0.0625 * zoff) +
+      press_SWB * (0.015625 + 0.0625 * xoff + 0.0625 * yoff + 0.0625 * zoff) +
+      press_NWB * (0.046875 + 0.1875 * xoff - 0.0625 * yoff + 0.1875 * zoff) +
+      press_SEB * (0.046875 - 0.0625 * xoff + 0.1875 * yoff + 0.1875 * zoff) +
+      press_NEB * (0.140625 - 0.1875 * xoff - 0.1875 * yoff + 0.5625 * zoff);
+}
+//////////////////////////////////////////////////////////////////////////
+//Position NEB 0.25, 0.25, -0.25
+LBMReal CompressibleOffsetInterpolationProcessor::calcPressBNE()
+{
+   return   press_NET * (0.140625 - 0.1875 * xoff - 0.1875 * yoff - 0.5625 * zoff) +
+      press_NWT * (0.046875 + 0.1875 * xoff - 0.0625 * yoff - 0.1875 * zoff) +
+      press_SET * (0.046875 - 0.0625 * xoff + 0.1875 * yoff - 0.1875 * zoff) +
+      press_SWT * (0.015625 + 0.0625 * xoff + 0.0625 * yoff - 0.0625 * zoff) +
+      press_SWB * (0.046875 + 0.1875 * xoff + 0.1875 * yoff + 0.0625 * zoff) +
+      press_NWB * (0.140625 + 0.5625 * xoff - 0.1875 * yoff + 0.1875 * zoff) +
+      press_SEB * (0.140625 - 0.1875 * xoff + 0.5625 * yoff + 0.1875 * zoff) +
+      press_NEB * (0.421875 - 0.5625 * xoff - 0.5625 * yoff + 0.5625 * zoff);
+}
+//////////////////////////////////////////////////////////////////////////
+//Position C 0.0, 0.0, 0.0
+void CompressibleOffsetInterpolationProcessor::calcInterpolatedNodeFC(LBMReal* f, LBMReal omega)
+{
+   using namespace D3Q27System;
+
+   LBMReal press  =  press_NET * (0.125 - 0.25 * xoff - 0.25 * yoff - 0.25 * zoff) +
+      press_NWT * (0.125 + 0.25 * xoff - 0.25 * yoff - 0.25 * zoff) +
+      press_SET * (0.125 - 0.25 * xoff + 0.25 * yoff - 0.25 * zoff) +
+      press_SWT * (0.125 + 0.25 * xoff + 0.25 * yoff - 0.25 * zoff) +
+      press_NEB * (0.125 - 0.25 * xoff - 0.25 * yoff + 0.25 * zoff) +
+      press_NWB * (0.125 + 0.25 * xoff - 0.25 * yoff + 0.25 * zoff) +
+      press_SEB * (0.125 - 0.25 * xoff + 0.25 * yoff + 0.25 * zoff) +
+      press_SWB * (0.125 + 0.25 * xoff + 0.25 * yoff + 0.25 * zoff);
+   LBMReal vx1  = a0;
+   LBMReal vx2  = b0;
+   LBMReal vx3  = c0;
+
+   LBMReal rho = press ;//+ (ax+by+cz)/3.;
+
+   //////////////////////////////////////////////////////////////////////////
+   //DRAFT
+   //vx1 -= forcingC*0.5;
+   //////////////////////////////////////////////////////////////////////////
+
+   LBMReal feq[ENDF+1];
+   D3Q27System::calcCompFeq(feq,rho,vx1,vx2,vx3);
+
+   LBMReal eps_new = 2.;
+   LBMReal o  = omega;
+   LBMReal op = 1.;
+
+   //f_E    = eps_new *((5.*ax*o + 5.*by*o + 5.*cz*o - 8.*ax*op + 4.*by*op + 4.*cz*op)/(54.*o*op));
+   //f_N    = f_E + eps_new *((2.*(ax - by))/(9.*o));
+   //f_T    = f_E + eps_new *((2.*(ax - cz))/(9.*o));
+   //f_NE   = eps_new *(-(5.*cz*o + 3.*(ay + bx)*op - 2.*cz*op + ax*(5.*o + op) + by*(5.*o + op))/(54.*o*op));
+   //f_SE   = f_NE + eps_new *((  ay + bx )/(9.*o));
+   //f_TE   = eps_new *(-(5.*cz*o + by*(5.*o - 2.*op) + 3.*(az + cx)*op + cz*op + ax*(5.*o + op))/(54.*o*op));
+   //f_BE   = f_TE + eps_new *((  az + cx )/(9.*o));
+   //f_TN   = eps_new *(-(5.*ax*o + 5.*by*o + 5.*cz*o - 2.*ax*op + by*op + 3.*bz*op + 3.*cy*op + cz*op)/(54.*o*op));
+   //f_BN   = f_TN + eps_new *((  bz + cy )/(9.*o));
+   //f_ZERO = eps_new *((5.*(ax + by + cz))/(9.*op));
+   //f_TNE  = eps_new *(-(ay + az + bx + bz + cx + cy)/(72.*o));
+   //f_TSW  = - eps_new *((ay + bx)/(36.*o)) - f_TNE;
+   //f_TSE  = - eps_new *((az + cx)/(36.*o)) - f_TNE;
+   //f_TNW  = - eps_new *((bz + cy)/(36.*o)) - f_TNE;
+
+   f_E = eps_new*((2*(-2*ax + by + cz-kxxMzzAverage-kxxMyyAverage))/(27.*o));
+   f_N = eps_new*((2*(ax - 2*by + cz+2*kxxMyyAverage-kxxMzzAverage))/(27.*o));
+   f_T = eps_new*((2*(ax + by - 2*cz-kxxMyyAverage+2*kxxMzzAverage))/(27.*o));
+   f_NE = eps_new*(-(ax + 3*ay + 3*bx + by - 2*cz+2*kxxMyyAverage-kxxMyyAverage+3*kxyAverage)/(54.*o));
+   f_SE = eps_new*(-(ax - 3*ay - 3*bx + by - 2*cz+2*kxxMyyAverage-kxxMyyAverage-3*kxyAverage)/(54.*o));
+   f_TE = eps_new*(-(ax + 3*az - 2*by + 3*cx + cz+2*kxxMyyAverage-kxxMzzAverage+3*kxzAverage)/(54.*o));
+   f_BE = eps_new*(-(ax - 3*az - 2*by - 3*cx + cz+2*kxxMyyAverage-kxxMzzAverage-3*kxzAverage)/(54.*o));
+   f_TN = eps_new*(-(-2*ax + by + 3*bz + 3*cy + cz-kxxMyyAverage-kxxMzzAverage+3*kyzAverage)/(54.*o));
+   f_BN = eps_new*(-(-2*ax + by - 3*bz - 3*cy + cz-kxxMyyAverage-kxxMzzAverage-3*kyzAverage)/(54.*o));
+   f_ZERO = 0.;
+   f_TNE = eps_new*(-(ay + az + bx + bz + cx + cy+kxyAverage+kxzAverage+kyzAverage)/(72.*o));
+   f_TSW = eps_new*((-ay + az - bx + bz + cx + cy-kxyAverage+kxzAverage+kyzAverage)/(72.*o));
+   f_TSE = eps_new*((ay - az + bx + bz - cx + cy+kxyAverage-kxzAverage+kyzAverage)/(72.*o));
+   f_TNW = eps_new*((ay + az + bx - bz + cx - cy+kxyAverage+kxzAverage-kyzAverage)/(72.*o));
+
+   f[E]    = f_E    + feq[E];
+   f[W]    = f_E    + feq[W];
+   f[N]    = f_N    + feq[N];
+   f[S]    = f_N    + feq[S];
+   f[T]    = f_T    + feq[T];
+   f[B]    = f_T    + feq[B];
+   f[NE]   = f_NE   + feq[NE];
+   f[SW]   = f_NE   + feq[SW];
+   f[SE]   = f_SE   + feq[SE];
+   f[NW]   = f_SE   + feq[NW];
+   f[TE]   = f_TE   + feq[TE];
+   f[BW]   = f_TE   + feq[BW];
+   f[BE]   = f_BE   + feq[BE];
+   f[TW]   = f_BE   + feq[TW];
+   f[TN]   = f_TN   + feq[TN];
+   f[BS]   = f_TN   + feq[BS];
+   f[BN]   = f_BN   + feq[BN];
+   f[TS]   = f_BN   + feq[TS];
+   f[TNE]  = f_TNE  + feq[TNE];
+   f[TNW]  = f_TNW  + feq[TNW];
+   f[TSE]  = f_TSE  + feq[TSE];
+   f[TSW]  = f_TSW  + feq[TSW];
+   f[BNE]  = f_TSW  + feq[BNE];
+   f[BNW]  = f_TSE  + feq[BNW];
+   f[BSE]  = f_TNW  + feq[BSE];
+   f[BSW]  = f_TNE  + feq[BSW];
+   f[ZERO] = f_ZERO + feq[ZERO];
+}
+//////////////////////////////////////////////////////////////////////////
+void CompressibleOffsetInterpolationProcessor::calcInterpolatedVelocity(LBMReal x, LBMReal y, LBMReal z, LBMReal& vx1, LBMReal& vx2, LBMReal& vx3)
+{
+	vx1  = a0 + ax*x + ay*y + az*z + axx*x*x + ayy*y*y + azz*z*z + axy*x*y + axz*x*z + ayz*y*z+axyz*x*y*z;
+	vx2  = b0 + bx*x + by*y + bz*z + bxx*x*x + byy*y*y + bzz*z*z + bxy*x*y + bxz*x*z + byz*y*z+bxyz*x*y*z;
+	vx3  = c0 + cx*x + cy*y + cz*z + cxx*x*x + cyy*y*y + czz*z*z + cxy*x*y + cxz*x*z + cyz*y*z+cxyz*x*y*z;
+}
+//////////////////////////////////////////////////////////////////////////
+void CompressibleOffsetInterpolationProcessor::calcInterpolatedShearStress(LBMReal x, LBMReal y, LBMReal z,LBMReal& tauxx, LBMReal& tauyy, LBMReal& tauzz,LBMReal& tauxy, LBMReal& tauxz, LBMReal& tauyz)
+{
+	tauxx=ax+2*axx*x+axy*y+axz*z+axyz*y*z;
+	tauyy=by+2*byy*y+bxy*x+byz*z+bxyz*x*z;
+	tauzz=cz+2*czz*z+cxz*x+cyz*y+cxyz*x*y;
+	tauxy=0.5*((ay+2.0*ayy*y+axy*x+ayz*z+axyz*x*z)+(bx+2.0*bxx*x+bxy*y+bxz*z+bxyz*y*z));
+	tauxz=0.5*((az+2.0*azz*z+axz*x+ayz*y+axyz*x*y)+(cx+2.0*cxx*x+cxy*y+cxz*z+cxyz*y*z));
+	tauyz=0.5*((bz+2.0*bzz*z+bxz*x+byz*y+bxyz*x*y)+(cy+2.0*cyy*y+cxy*x+cyz*z+cxyz*x*z));
+}
diff --git a/src/cpu/VirtualFluidsCore/LBM/CompressibleOffsetInterpolationProcessor.h b/src/cpu/VirtualFluidsCore/LBM/CompressibleOffsetInterpolationProcessor.h
index 2f3da5f03ab1891256e326c8a84b1d7cc891c6fa..d4b6608bae870091c3509bad088827540ad3a5f0 100644
--- a/src/cpu/VirtualFluidsCore/LBM/CompressibleOffsetInterpolationProcessor.h
+++ b/src/cpu/VirtualFluidsCore/LBM/CompressibleOffsetInterpolationProcessor.h
@@ -1,76 +1,76 @@
-#ifndef CompressibleOffsetInterpolationProcessor_H_
-#define CompressibleOffsetInterpolationProcessor_H_
-
-#include "InterpolationProcessor.h"
-#include "D3Q27System.h"
-
-//////////////////////////////////////////////////////////////////////////
-//it works only for cascaded LBM
-//super compact interpolation method by Martin Geier
-//////////////////////////////////////////////////////////////////////////
-
-class CompressibleOffsetInterpolationProcessor;
-
-class CompressibleOffsetInterpolationProcessor : public InterpolationProcessor
-{
-public:
-   CompressibleOffsetInterpolationProcessor();
-   CompressibleOffsetInterpolationProcessor(LBMReal omegaC, LBMReal omegaF);
-   virtual ~CompressibleOffsetInterpolationProcessor();
-   InterpolationProcessorPtr clone();
-   void setOmegas(LBMReal omegaC, LBMReal omegaF);
-   void interpolateCoarseToFine(D3Q27ICell& icellC, D3Q27ICell& icellF);
-   void interpolateCoarseToFine(D3Q27ICell& icellC, D3Q27ICell& icellF, LBMReal xoff, LBMReal yoff, LBMReal zoff);
-   void interpolateFineToCoarse(D3Q27ICell& icellF, LBMReal* icellC); 
-   void interpolateFineToCoarse(D3Q27ICell& icellF, LBMReal* icellC, LBMReal xoff, LBMReal yoff, LBMReal zoff); 
-   //LBMReal forcingC, forcingF;
-protected:   
-private:
-   LBMReal omegaC, omegaF;
-   LBMReal a0, ax, ay, az, axx, ayy, azz, axy, axz, ayz, b0, bx, by, bz, bxx, byy, bzz, bxy, bxz, byz, c0, cx, cy, cz, cxx, cyy, czz, cxy, cxz, cyz, axyz, bxyz, cxyz;
-   LBMReal xoff,    yoff,    zoff;
-   LBMReal xoff_sq, yoff_sq, zoff_sq;
-   LBMReal press_SWT, press_NWT, press_NET, press_SET, press_SWB, press_NWB, press_NEB, press_SEB;
-
-   LBMReal  f_E,  f_N,  f_T,  f_NE,  f_SE,  f_BE,  f_TE,  f_TN,  f_BN,  f_TNE,  f_TNW,  f_TSE,  f_TSW,  f_ZERO;
-   LBMReal  x_E,  x_N,  x_T,  x_NE,  x_SE,  x_BE,  x_TE,  x_TN,  x_BN,  x_TNE,  x_TNW,  x_TSE,  x_TSW,  x_ZERO;
-   LBMReal  y_E,  y_N,  y_T,  y_NE,  y_SE,  y_BE,  y_TE,  y_TN,  y_BN,  y_TNE,  y_TNW,  y_TSE,  y_TSW,  y_ZERO;
-   LBMReal  z_E,  z_N,  z_T,  z_NE,  z_SE,  z_BE,  z_TE,  z_TN,  z_BN,  z_TNE,  z_TNW,  z_TSE,  z_TSW,  z_ZERO;
-   LBMReal xy_E, xy_N, xy_T, xy_NE, xy_SE, xy_BE, xy_TE, xy_TN, xy_BN, xy_TNE, xy_TNW, xy_TSE, xy_TSW/*, xy_ZERO*/;
-   LBMReal xz_E, xz_N, xz_T, xz_NE, xz_SE, xz_BE, xz_TE, xz_TN, xz_BN, xz_TNE, xz_TNW, xz_TSE, xz_TSW/*, xz_ZERO*/;
-   LBMReal yz_E, yz_N, yz_T, yz_NE, yz_SE, yz_BE, yz_TE, yz_TN, yz_BN, yz_TNE, yz_TNW, yz_TSE, yz_TSW/*, yz_ZERO*/;
-
-   LBMReal kxyAverage, kyzAverage, kxzAverage, kxxMyyAverage, kxxMzzAverage; 
-
-   LBMReal a,b,c;
-
-   void setOffsets(LBMReal xoff, LBMReal yoff, LBMReal zoff);
-   void calcMoments(const LBMReal* const f, LBMReal omega, LBMReal& rho, LBMReal& vx1, LBMReal& vx2, LBMReal& vx3, 
-      LBMReal& kxy, LBMReal& kyz, LBMReal& kxz, LBMReal& kxxMyy, LBMReal& kxxMzz);
-   void calcInterpolatedCoefficiets(const D3Q27ICell& icell, LBMReal omega, LBMReal eps_new);
-   void calcInterpolatedNodeCF(LBMReal* f, LBMReal omega, LBMReal x, LBMReal y, LBMReal z, LBMReal press, LBMReal xs, LBMReal ys, LBMReal zs);
-   LBMReal calcPressBSW();
-   LBMReal calcPressTSW();
-   LBMReal calcPressTSE();
-   LBMReal calcPressBSE();
-   LBMReal calcPressBNW();
-   LBMReal calcPressTNW();
-   LBMReal calcPressTNE();
-   LBMReal calcPressBNE();
-   void calcInterpolatedNodeFC(LBMReal* f, LBMReal omega);
-   void calcInterpolatedVelocity(LBMReal x, LBMReal y, LBMReal z,LBMReal& vx1, LBMReal& vx2, LBMReal& vx3);
-   void calcInterpolatedShearStress(LBMReal x, LBMReal y, LBMReal z,LBMReal& tauxx, LBMReal& tauyy, LBMReal& tauzz,LBMReal& tauxy, LBMReal& tauxz, LBMReal& tauyz);
-};
-
-//////////////////////////////////////////////////////////////////////////
-inline void CompressibleOffsetInterpolationProcessor::interpolateCoarseToFine(D3Q27ICell& icellC, D3Q27ICell& icellF)
-{
-   this->interpolateCoarseToFine(icellC, icellF, 0.0, 0.0, 0.0);
-}
-//////////////////////////////////////////////////////////////////////////
-inline void CompressibleOffsetInterpolationProcessor::interpolateFineToCoarse(D3Q27ICell& icellF, LBMReal* icellC)
-{
-   this->interpolateFineToCoarse(icellF, icellC, 0.0, 0.0, 0.0);
-}
-
-#endif
+#ifndef CompressibleOffsetInterpolationProcessor_H_
+#define CompressibleOffsetInterpolationProcessor_H_
+
+#include "InterpolationProcessor.h"
+#include "D3Q27System.h"
+
+//////////////////////////////////////////////////////////////////////////
+//it works only for cascaded LBM
+//super compact interpolation method by Martin Geier
+//////////////////////////////////////////////////////////////////////////
+
+class CompressibleOffsetInterpolationProcessor;
+
+class CompressibleOffsetInterpolationProcessor : public InterpolationProcessor
+{
+public:
+   CompressibleOffsetInterpolationProcessor();
+   CompressibleOffsetInterpolationProcessor(LBMReal omegaC, LBMReal omegaF);
+   virtual ~CompressibleOffsetInterpolationProcessor();
+   InterpolationProcessorPtr clone();
+   void setOmegas(LBMReal omegaC, LBMReal omegaF);
+   void interpolateCoarseToFine(D3Q27ICell& icellC, D3Q27ICell& icellF);
+   void interpolateCoarseToFine(D3Q27ICell& icellC, D3Q27ICell& icellF, LBMReal xoff, LBMReal yoff, LBMReal zoff);
+   void interpolateFineToCoarse(D3Q27ICell& icellF, LBMReal* icellC); 
+   void interpolateFineToCoarse(D3Q27ICell& icellF, LBMReal* icellC, LBMReal xoff, LBMReal yoff, LBMReal zoff); 
+   //LBMReal forcingC, forcingF;
+protected:   
+private:
+   LBMReal omegaC, omegaF;
+   LBMReal a0, ax, ay, az, axx, ayy, azz, axy, axz, ayz, b0, bx, by, bz, bxx, byy, bzz, bxy, bxz, byz, c0, cx, cy, cz, cxx, cyy, czz, cxy, cxz, cyz, axyz, bxyz, cxyz;
+   LBMReal xoff,    yoff,    zoff;
+   LBMReal xoff_sq, yoff_sq, zoff_sq;
+   LBMReal press_SWT, press_NWT, press_NET, press_SET, press_SWB, press_NWB, press_NEB, press_SEB;
+
+   LBMReal  f_E,  f_N,  f_T,  f_NE,  f_SE,  f_BE,  f_TE,  f_TN,  f_BN,  f_TNE,  f_TNW,  f_TSE,  f_TSW,  f_ZERO;
+   LBMReal  x_E,  x_N,  x_T,  x_NE,  x_SE,  x_BE,  x_TE,  x_TN,  x_BN,  x_TNE,  x_TNW,  x_TSE,  x_TSW,  x_ZERO;
+   LBMReal  y_E,  y_N,  y_T,  y_NE,  y_SE,  y_BE,  y_TE,  y_TN,  y_BN,  y_TNE,  y_TNW,  y_TSE,  y_TSW,  y_ZERO;
+   LBMReal  z_E,  z_N,  z_T,  z_NE,  z_SE,  z_BE,  z_TE,  z_TN,  z_BN,  z_TNE,  z_TNW,  z_TSE,  z_TSW,  z_ZERO;
+   LBMReal xy_E, xy_N, xy_T, xy_NE, xy_SE, xy_BE, xy_TE, xy_TN, xy_BN, xy_TNE, xy_TNW, xy_TSE, xy_TSW/*, xy_ZERO*/;
+   LBMReal xz_E, xz_N, xz_T, xz_NE, xz_SE, xz_BE, xz_TE, xz_TN, xz_BN, xz_TNE, xz_TNW, xz_TSE, xz_TSW/*, xz_ZERO*/;
+   LBMReal yz_E, yz_N, yz_T, yz_NE, yz_SE, yz_BE, yz_TE, yz_TN, yz_BN, yz_TNE, yz_TNW, yz_TSE, yz_TSW/*, yz_ZERO*/;
+
+   LBMReal kxyAverage, kyzAverage, kxzAverage, kxxMyyAverage, kxxMzzAverage; 
+
+   LBMReal a,b,c;
+
+   void setOffsets(LBMReal xoff, LBMReal yoff, LBMReal zoff);
+   void calcMoments(const LBMReal* const f, LBMReal omega, LBMReal& rho, LBMReal& vx1, LBMReal& vx2, LBMReal& vx3, 
+      LBMReal& kxy, LBMReal& kyz, LBMReal& kxz, LBMReal& kxxMyy, LBMReal& kxxMzz);
+   void calcInterpolatedCoefficiets(const D3Q27ICell& icell, LBMReal omega, LBMReal eps_new);
+   void calcInterpolatedNodeCF(LBMReal* f, LBMReal omega, LBMReal x, LBMReal y, LBMReal z, LBMReal press, LBMReal xs, LBMReal ys, LBMReal zs);
+   LBMReal calcPressBSW();
+   LBMReal calcPressTSW();
+   LBMReal calcPressTSE();
+   LBMReal calcPressBSE();
+   LBMReal calcPressBNW();
+   LBMReal calcPressTNW();
+   LBMReal calcPressTNE();
+   LBMReal calcPressBNE();
+   void calcInterpolatedNodeFC(LBMReal* f, LBMReal omega);
+   void calcInterpolatedVelocity(LBMReal x, LBMReal y, LBMReal z,LBMReal& vx1, LBMReal& vx2, LBMReal& vx3);
+   void calcInterpolatedShearStress(LBMReal x, LBMReal y, LBMReal z,LBMReal& tauxx, LBMReal& tauyy, LBMReal& tauzz,LBMReal& tauxy, LBMReal& tauxz, LBMReal& tauyz);
+};
+
+//////////////////////////////////////////////////////////////////////////
+inline void CompressibleOffsetInterpolationProcessor::interpolateCoarseToFine(D3Q27ICell& icellC, D3Q27ICell& icellF)
+{
+   this->interpolateCoarseToFine(icellC, icellF, 0.0, 0.0, 0.0);
+}
+//////////////////////////////////////////////////////////////////////////
+inline void CompressibleOffsetInterpolationProcessor::interpolateFineToCoarse(D3Q27ICell& icellF, LBMReal* icellC)
+{
+   this->interpolateFineToCoarse(icellF, icellC, 0.0, 0.0, 0.0);
+}
+
+#endif
diff --git a/src/cpu/VirtualFluidsCore/LBM/CompressibleOffsetMomentsInterpolationProcessor.cpp b/src/cpu/VirtualFluidsCore/LBM/CompressibleOffsetMomentsInterpolationProcessor.cpp
index a6823042e25bc635176d5105670a9884aee7a3f2..a985afe2f01275439b18011546096796b9cac464 100644
--- a/src/cpu/VirtualFluidsCore/LBM/CompressibleOffsetMomentsInterpolationProcessor.cpp
+++ b/src/cpu/VirtualFluidsCore/LBM/CompressibleOffsetMomentsInterpolationProcessor.cpp
@@ -1,1289 +1,1289 @@
-#include "CompressibleOffsetMomentsInterpolationProcessor.h"
-#include "D3Q27System.h"
-
-using namespace UbMath;
-
-CompressibleOffsetMomentsInterpolationProcessor::CompressibleOffsetMomentsInterpolationProcessor()
-   : omegaC(0.0), omegaF(0.0)
-{
-   this->bulkViscosity = 0.0;
-   this->shearViscosity = 0.0;
-   this->OxxPyyPzzC = one;
-   this->OxxPyyPzzF = one;
-}
-//////////////////////////////////////////////////////////////////////////
-CompressibleOffsetMomentsInterpolationProcessor::CompressibleOffsetMomentsInterpolationProcessor(LBMReal omegaC, LBMReal omegaF)
-   : omegaC(omegaC), omegaF(omegaF)
-{
-   this->bulkViscosity = 0.0;
-   this->shearViscosity = 0.0;
-   this->OxxPyyPzzC = one;
-   this->OxxPyyPzzF = one;
-}
-//////////////////////////////////////////////////////////////////////////
-CompressibleOffsetMomentsInterpolationProcessor::~CompressibleOffsetMomentsInterpolationProcessor()
-{
-
-}
-//////////////////////////////////////////////////////////////////////////
-InterpolationProcessorPtr CompressibleOffsetMomentsInterpolationProcessor::clone()
-{
-   InterpolationProcessorPtr iproc = InterpolationProcessorPtr (new CompressibleOffsetMomentsInterpolationProcessor(this->omegaC, this->omegaF));
-
-   dynamicPointerCast<CompressibleOffsetMomentsInterpolationProcessor>(iproc)->OxxPyyPzzC = this->OxxPyyPzzC;
-   dynamicPointerCast<CompressibleOffsetMomentsInterpolationProcessor>(iproc)->OxxPyyPzzF = this->OxxPyyPzzF;
-
-   return iproc;
-}
-//////////////////////////////////////////////////////////////////////////
-void CompressibleOffsetMomentsInterpolationProcessor::setOmegas( LBMReal omegaC, LBMReal omegaF )
-{
-   this->omegaC = omegaC;
-   this->omegaF = omegaF;
-
-   LBMReal dtC = (3.0*shearViscosity)/((1/omegaC)-0.5);
-   LBMReal dtF = (3.0*shearViscosity)/((1/omegaF)-0.5);
-
-   if (bulkViscosity != 0)
-   {
-      this->OxxPyyPzzC = LBMSystem::calcOmega2(bulkViscosity, dtC);
-      this->OxxPyyPzzF = LBMSystem::calcOmega2(bulkViscosity, dtF);
-   }
-   else
-   {
-      this->OxxPyyPzzC = one;
-      this->OxxPyyPzzF = one;
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-void CompressibleOffsetMomentsInterpolationProcessor::setOffsets(LBMReal xoff, LBMReal yoff, LBMReal zoff)
-{
-   this->xoff = xoff;
-   this->yoff = yoff;
-   this->zoff = zoff;     
-   this->xoff_sq = xoff * xoff;
-   this->yoff_sq = yoff * yoff;
-   this->zoff_sq = zoff * zoff;
-}
-//////////////////////////////////////////////////////////////////////////
-void CompressibleOffsetMomentsInterpolationProcessor::interpolateCoarseToFine(D3Q27ICell& icellC, D3Q27ICell& icellF, LBMReal xoff, LBMReal yoff, LBMReal zoff)
-{
-   setOffsets(xoff, yoff, zoff);
-   calcInterpolatedCoefficiets(icellC, omegaC, 0.5);
-   calcInterpolatedNodeCF(icellF.BSW, omegaF, -0.25, -0.25, -0.25, calcPressBSW(), -1, -1, -1);
-   calcInterpolatedNodeCF(icellF.BNE, omegaF,  0.25,  0.25, -0.25, calcPressBNE(),  1,  1, -1);
-   calcInterpolatedNodeCF(icellF.TNW, omegaF, -0.25,  0.25,  0.25, calcPressTNW(), -1,  1,  1);
-   calcInterpolatedNodeCF(icellF.TSE, omegaF,  0.25, -0.25,  0.25, calcPressTSE(),  1, -1,  1);
-   calcInterpolatedNodeCF(icellF.BNW, omegaF, -0.25,  0.25, -0.25, calcPressBNW(), -1,  1, -1);
-   calcInterpolatedNodeCF(icellF.BSE, omegaF,  0.25, -0.25, -0.25, calcPressBSE(),  1, -1, -1);
-   calcInterpolatedNodeCF(icellF.TSW, omegaF, -0.25, -0.25,  0.25, calcPressTSW(), -1, -1,  1);
-   calcInterpolatedNodeCF(icellF.TNE, omegaF,  0.25,  0.25,  0.25, calcPressTNE(),  1,  1,  1);
-}
-//////////////////////////////////////////////////////////////////////////
-void CompressibleOffsetMomentsInterpolationProcessor::interpolateFineToCoarse(D3Q27ICell& icellF, LBMReal* icellC, LBMReal xoff, LBMReal yoff, LBMReal zoff)
-{
-   setOffsets(xoff, yoff, zoff);
-   calcInterpolatedCoefficiets(icellF, omegaF, 2.0);
-   calcInterpolatedNodeFC(icellC, omegaC);
-}
-//////////////////////////////////////////////////////////////////////////
-void CompressibleOffsetMomentsInterpolationProcessor::calcMoments(const LBMReal* const f, LBMReal omega, LBMReal& press, LBMReal& vx1, LBMReal& vx2, LBMReal& vx3, 
-                                                    LBMReal& kxy, LBMReal& kyz, LBMReal& kxz, LBMReal& kxxMyy, LBMReal& kxxMzz)
-{
-   using namespace D3Q27System;
-
-   LBMReal drho = 0.0;
-   D3Q27System::calcCompMacroscopicValues(f,drho,vx1,vx2,vx3);
-   
-   press = drho; //interpolate rho!
-
-   kxy   = -3.*omega*((((f[TSW]+f[BNE])-(f[TNW]+f[BSE]))+((f[BSW]+f[TNE])-(f[BNW]+f[TSE])))+((f[SW]+f[NE])-(f[NW]+f[SE]))/(one + drho)-(vx1*vx2));// might not be optimal MG 25.2.13
-   kyz   = -3.*omega*((((f[BSW]+f[TNE])-(f[TSE]+f[BNW]))+((f[BSE]+f[TNW])-(f[TSW]+f[BNE])))+((f[BS]+f[TN])-(f[TS]+f[BN]))/(one + drho)-(vx2*vx3));
-   kxz   = -3.*omega*((((f[BNW]+f[TSE])-(f[TSW]+f[BNE]))+((f[BSW]+f[TNE])-(f[BSE]+f[TNW])))+((f[BW]+f[TE])-(f[TW]+f[BE]))/(one + drho)-(vx1*vx3));
-   kxxMyy = -3./2.*omega*((((f[BW]+f[TE])-(f[BS]+f[TN]))+((f[TW]+f[BE])-(f[TS]+f[BN])))+((f[W]+f[E])-(f[S]+f[N]))/(one + drho)-(vx1*vx1-vx2*vx2));
-   kxxMzz = -3./2.*omega*((((f[NW]+f[SE])-(f[BS]+f[TN]))+((f[SW]+f[NE])-(f[TS]+f[BN])))+((f[W]+f[E])-(f[B]+f[T]))/(one + drho)-(vx1*vx1-vx3*vx3));
-}
-//////////////////////////////////////////////////////////////////////////
-void CompressibleOffsetMomentsInterpolationProcessor::calcInterpolatedCoefficiets(const D3Q27ICell& icell, LBMReal omega, LBMReal eps_new)
-{
-   LBMReal        vx1_SWT,vx2_SWT,vx3_SWT;
-   LBMReal        vx1_NWT,vx2_NWT,vx3_NWT;
-   LBMReal        vx1_NET,vx2_NET,vx3_NET;
-   LBMReal        vx1_SET,vx2_SET,vx3_SET;
-   LBMReal        vx1_SWB,vx2_SWB,vx3_SWB;
-   LBMReal        vx1_NWB,vx2_NWB,vx3_NWB;
-   LBMReal        vx1_NEB,vx2_NEB,vx3_NEB;
-   LBMReal        vx1_SEB,vx2_SEB,vx3_SEB;
-
-   LBMReal        kxyFromfcNEQ_SWT, kyzFromfcNEQ_SWT, kxzFromfcNEQ_SWT, kxxMyyFromfcNEQ_SWT, kxxMzzFromfcNEQ_SWT;
-   LBMReal        kxyFromfcNEQ_NWT, kyzFromfcNEQ_NWT, kxzFromfcNEQ_NWT, kxxMyyFromfcNEQ_NWT, kxxMzzFromfcNEQ_NWT;
-   LBMReal        kxyFromfcNEQ_NET, kyzFromfcNEQ_NET, kxzFromfcNEQ_NET, kxxMyyFromfcNEQ_NET, kxxMzzFromfcNEQ_NET;
-   LBMReal        kxyFromfcNEQ_SET, kyzFromfcNEQ_SET, kxzFromfcNEQ_SET, kxxMyyFromfcNEQ_SET, kxxMzzFromfcNEQ_SET;
-   LBMReal        kxyFromfcNEQ_SWB, kyzFromfcNEQ_SWB, kxzFromfcNEQ_SWB, kxxMyyFromfcNEQ_SWB, kxxMzzFromfcNEQ_SWB;
-   LBMReal        kxyFromfcNEQ_NWB, kyzFromfcNEQ_NWB, kxzFromfcNEQ_NWB, kxxMyyFromfcNEQ_NWB, kxxMzzFromfcNEQ_NWB;
-   LBMReal        kxyFromfcNEQ_NEB, kyzFromfcNEQ_NEB, kxzFromfcNEQ_NEB, kxxMyyFromfcNEQ_NEB, kxxMzzFromfcNEQ_NEB;
-   LBMReal        kxyFromfcNEQ_SEB, kyzFromfcNEQ_SEB, kxzFromfcNEQ_SEB, kxxMyyFromfcNEQ_SEB, kxxMzzFromfcNEQ_SEB;
-
-   calcMoments(icell.TSW,omega,press_SWT,vx1_SWT,vx2_SWT,vx3_SWT, kxyFromfcNEQ_SWT, kyzFromfcNEQ_SWT, kxzFromfcNEQ_SWT, kxxMyyFromfcNEQ_SWT, kxxMzzFromfcNEQ_SWT);
-   calcMoments(icell.TNW,omega,press_NWT,vx1_NWT,vx2_NWT,vx3_NWT, kxyFromfcNEQ_NWT, kyzFromfcNEQ_NWT, kxzFromfcNEQ_NWT, kxxMyyFromfcNEQ_NWT, kxxMzzFromfcNEQ_NWT);
-   calcMoments(icell.TNE,omega,press_NET,vx1_NET,vx2_NET,vx3_NET, kxyFromfcNEQ_NET, kyzFromfcNEQ_NET, kxzFromfcNEQ_NET, kxxMyyFromfcNEQ_NET, kxxMzzFromfcNEQ_NET);
-   calcMoments(icell.TSE,omega,press_SET,vx1_SET,vx2_SET,vx3_SET, kxyFromfcNEQ_SET, kyzFromfcNEQ_SET, kxzFromfcNEQ_SET, kxxMyyFromfcNEQ_SET, kxxMzzFromfcNEQ_SET);
-   calcMoments(icell.BSW,omega,press_SWB,vx1_SWB,vx2_SWB,vx3_SWB, kxyFromfcNEQ_SWB, kyzFromfcNEQ_SWB, kxzFromfcNEQ_SWB, kxxMyyFromfcNEQ_SWB, kxxMzzFromfcNEQ_SWB);
-   calcMoments(icell.BNW,omega,press_NWB,vx1_NWB,vx2_NWB,vx3_NWB, kxyFromfcNEQ_NWB, kyzFromfcNEQ_NWB, kxzFromfcNEQ_NWB, kxxMyyFromfcNEQ_NWB, kxxMzzFromfcNEQ_NWB);
-   calcMoments(icell.BNE,omega,press_NEB,vx1_NEB,vx2_NEB,vx3_NEB, kxyFromfcNEQ_NEB, kyzFromfcNEQ_NEB, kxzFromfcNEQ_NEB, kxxMyyFromfcNEQ_NEB, kxxMzzFromfcNEQ_NEB);
-   calcMoments(icell.BSE,omega,press_SEB,vx1_SEB,vx2_SEB,vx3_SEB, kxyFromfcNEQ_SEB, kyzFromfcNEQ_SEB, kxzFromfcNEQ_SEB, kxxMyyFromfcNEQ_SEB, kxxMzzFromfcNEQ_SEB);
-
-   //LBMReal dxRho=c1o4*((press_NET-press_SWB)+(press_SET-press_NWB)+(press_NEB-press_SWT)+(press_SEB-press_NWT));
-   //LBMReal dyRho=c1o4*((press_NET-press_SWB)-(press_SET-press_NWB)+(press_NEB-press_SWT)-(press_SEB-press_NWT));
-   //LBMReal dzRho=c1o4*((press_NET-press_SWB)+(press_SET-press_NWB)-(press_NEB-press_SWT)-(press_SEB-press_NWT));
-
-   //   kxyFromfcNEQ_SWT+=vx1_SWT*dyRho+vx2_SWT*dxRho;
-   //   kxyFromfcNEQ_NWT+=vx1_NWT*dyRho+vx2_NWT*dxRho;
-   //   kxyFromfcNEQ_NET+=vx1_NET*dyRho+vx2_NET*dxRho;
-   //   kxyFromfcNEQ_SET+=vx1_SET*dyRho+vx2_SET*dxRho;
-   //   kxyFromfcNEQ_SWB+=vx1_SWB*dyRho+vx2_SWB*dxRho;
-   //   kxyFromfcNEQ_NWB+=vx1_NWB*dyRho+vx2_NWB*dxRho;
-   //   kxyFromfcNEQ_NEB+=vx1_NEB*dyRho+vx2_NEB*dxRho;
-   //   kxyFromfcNEQ_SEB+=vx1_SEB*dyRho+vx2_SEB*dxRho;
-
-   //   kyzFromfcNEQ_SWT+=vx3_SWT*dyRho+vx2_SWT*dzRho;
-   //   kyzFromfcNEQ_NWT+=vx3_NWT*dyRho+vx2_NWT*dzRho;
-   //   kyzFromfcNEQ_NET+=vx3_NET*dyRho+vx2_NET*dzRho;
-   //   kyzFromfcNEQ_SET+=vx3_SET*dyRho+vx2_SET*dzRho;
-   //   kyzFromfcNEQ_SWB+=vx3_SWB*dyRho+vx2_SWB*dzRho;
-   //   kyzFromfcNEQ_NWB+=vx3_NWB*dyRho+vx2_NWB*dzRho;
-   //   kyzFromfcNEQ_NEB+=vx3_NEB*dyRho+vx2_NEB*dzRho;
-   //   kyzFromfcNEQ_SEB+=vx3_SEB*dyRho+vx2_SEB*dzRho;
-
-   //   kxzFromfcNEQ_SWT+=vx1_SWT*dzRho+vx3_SWT*dxRho;
-   //   kxzFromfcNEQ_NWT+=vx1_NWT*dzRho+vx3_NWT*dxRho;
-   //   kxzFromfcNEQ_NET+=vx1_NET*dzRho+vx3_NET*dxRho;
-   //   kxzFromfcNEQ_SET+=vx1_SET*dzRho+vx3_SET*dxRho;
-   //   kxzFromfcNEQ_SWB+=vx1_SWB*dzRho+vx3_SWB*dxRho;
-   //   kxzFromfcNEQ_NWB+=vx1_NWB*dzRho+vx3_NWB*dxRho;
-   //   kxzFromfcNEQ_NEB+=vx1_NEB*dzRho+vx3_NEB*dxRho;
-   //   kxzFromfcNEQ_SEB+=vx1_SEB*dzRho+vx3_SEB*dxRho;
-
-   //   kxxMyyFromfcNEQ_SWT+=vx1_SWT*dxRho-vx2_SWT*dyRho;
-   //   kxxMyyFromfcNEQ_NWT+=vx1_NWT*dxRho-vx2_NWT*dyRho;
-   //   kxxMyyFromfcNEQ_NET+=vx1_NET*dxRho-vx2_NET*dyRho;
-   //   kxxMyyFromfcNEQ_SET+=vx1_SET*dxRho-vx2_SET*dyRho;
-   //   kxxMyyFromfcNEQ_SWB+=vx1_SWB*dxRho-vx2_SWB*dyRho;
-   //   kxxMyyFromfcNEQ_NWB+=vx1_NWB*dxRho-vx2_NWB*dyRho;
-   //   kxxMyyFromfcNEQ_NEB+=vx1_NEB*dxRho-vx2_NEB*dyRho;
-   //   kxxMyyFromfcNEQ_SEB+=vx1_SEB*dxRho-vx2_SEB*dyRho;
-
-   //   kxxMzzFromfcNEQ_SWT+=vx1_SWT*dxRho-vx3_SWT*dzRho;
-   //   kxxMzzFromfcNEQ_NWT+=vx1_NWT*dxRho-vx3_NWT*dzRho;
-   //   kxxMzzFromfcNEQ_NET+=vx1_NET*dxRho-vx3_NET*dzRho;
-   //   kxxMzzFromfcNEQ_SET+=vx1_SET*dxRho-vx3_SET*dzRho;
-   //   kxxMzzFromfcNEQ_SWB+=vx1_SWB*dxRho-vx3_SWB*dzRho;
-   //   kxxMzzFromfcNEQ_NWB+=vx1_NWB*dxRho-vx3_NWB*dzRho;
-   //   kxxMzzFromfcNEQ_NEB+=vx1_NEB*dxRho-vx3_NEB*dzRho;
-   //   kxxMzzFromfcNEQ_SEB+=vx1_SEB*dxRho-vx3_SEB*dzRho;
-
-
-      //kxxMzzFromfcNEQ_SWT=0.0;
-      //kxxMzzFromfcNEQ_NWT=0.0;
-      //kxxMzzFromfcNEQ_NET=0.0;
-      //kxxMzzFromfcNEQ_SET=0.0;
-      //kxxMzzFromfcNEQ_SWB=0.0;
-      //kxxMzzFromfcNEQ_NWB=0.0;
-      //kxxMzzFromfcNEQ_NEB=0.0;
-      //kxxMzzFromfcNEQ_SEB=0.0;
-
-
-
-
-
-   a0 = (-kxxMyyFromfcNEQ_NEB - kxxMyyFromfcNEQ_NET + kxxMyyFromfcNEQ_NWB + kxxMyyFromfcNEQ_NWT -
-      kxxMyyFromfcNEQ_SEB - kxxMyyFromfcNEQ_SET + kxxMyyFromfcNEQ_SWB + kxxMyyFromfcNEQ_SWT -
-      kxxMzzFromfcNEQ_NEB - kxxMzzFromfcNEQ_NET + kxxMzzFromfcNEQ_NWB + kxxMzzFromfcNEQ_NWT -
-      kxxMzzFromfcNEQ_SEB - kxxMzzFromfcNEQ_SET + kxxMzzFromfcNEQ_SWB + kxxMzzFromfcNEQ_SWT -
-      2.*kxyFromfcNEQ_NEB - 2.*kxyFromfcNEQ_NET - 2.*kxyFromfcNEQ_NWB - 2.*kxyFromfcNEQ_NWT +
-      2.*kxyFromfcNEQ_SEB + 2.*kxyFromfcNEQ_SET + 2.*kxyFromfcNEQ_SWB + 2.*kxyFromfcNEQ_SWT +
-      2.*kxzFromfcNEQ_NEB - 2.*kxzFromfcNEQ_NET + 2.*kxzFromfcNEQ_NWB - 2.*kxzFromfcNEQ_NWT +
-      2.*kxzFromfcNEQ_SEB - 2.*kxzFromfcNEQ_SET + 2.*kxzFromfcNEQ_SWB - 2.*kxzFromfcNEQ_SWT +
-      8.*vx1_NEB + 8.*vx1_NET + 8.*vx1_NWB + 8.*vx1_NWT + 8.*vx1_SEB +
-      8.*vx1_SET + 8.*vx1_SWB + 8.*vx1_SWT + 2.*vx2_NEB + 2.*vx2_NET -
-      2.*vx2_NWB - 2.*vx2_NWT - 2.*vx2_SEB - 2.*vx2_SET + 2.*vx2_SWB +
-      2.*vx2_SWT - 2.*vx3_NEB + 2.*vx3_NET + 2.*vx3_NWB - 2.*vx3_NWT -
-      2.*vx3_SEB + 2.*vx3_SET + 2.*vx3_SWB - 2.*vx3_SWT)/64.;
-   b0 = (2.*kxxMyyFromfcNEQ_NEB + 2.*kxxMyyFromfcNEQ_NET + 2.*kxxMyyFromfcNEQ_NWB + 2.*kxxMyyFromfcNEQ_NWT -
-      2.*kxxMyyFromfcNEQ_SEB - 2.*kxxMyyFromfcNEQ_SET - 2.*kxxMyyFromfcNEQ_SWB - 2.*kxxMyyFromfcNEQ_SWT -
-      kxxMzzFromfcNEQ_NEB - kxxMzzFromfcNEQ_NET - kxxMzzFromfcNEQ_NWB - kxxMzzFromfcNEQ_NWT +
-      kxxMzzFromfcNEQ_SEB + kxxMzzFromfcNEQ_SET + kxxMzzFromfcNEQ_SWB + kxxMzzFromfcNEQ_SWT -
-      2.*kxyFromfcNEQ_NEB - 2.*kxyFromfcNEQ_NET + 2.*kxyFromfcNEQ_NWB + 2.*kxyFromfcNEQ_NWT -
-      2.*kxyFromfcNEQ_SEB - 2.*kxyFromfcNEQ_SET + 2.*kxyFromfcNEQ_SWB + 2.*kxyFromfcNEQ_SWT +
-      2.*kyzFromfcNEQ_NEB - 2.*kyzFromfcNEQ_NET + 2.*kyzFromfcNEQ_NWB - 2.*kyzFromfcNEQ_NWT +
-      2.*kyzFromfcNEQ_SEB - 2.*kyzFromfcNEQ_SET + 2.*kyzFromfcNEQ_SWB - 2.*kyzFromfcNEQ_SWT +
-      2.*vx1_NEB + 2.*vx1_NET - 2.*vx1_NWB - 2.*vx1_NWT -
-      2.*vx1_SEB - 2.*vx1_SET + 2.*vx1_SWB + 2.*vx1_SWT +
-      8.*vx2_NEB + 8.*vx2_NET + 8.*vx2_NWB + 8.*vx2_NWT +
-      8.*vx2_SEB + 8.*vx2_SET + 8.*vx2_SWB + 8.*vx2_SWT -
-      2.*vx3_NEB + 2.*vx3_NET - 2.*vx3_NWB + 2.*vx3_NWT +
-      2.*vx3_SEB - 2.*vx3_SET + 2.*vx3_SWB - 2.*vx3_SWT)/64.;
-   c0 = (kxxMyyFromfcNEQ_NEB - kxxMyyFromfcNEQ_NET + kxxMyyFromfcNEQ_NWB - kxxMyyFromfcNEQ_NWT +
-      kxxMyyFromfcNEQ_SEB - kxxMyyFromfcNEQ_SET + kxxMyyFromfcNEQ_SWB - kxxMyyFromfcNEQ_SWT -
-      2.*kxxMzzFromfcNEQ_NEB + 2.*kxxMzzFromfcNEQ_NET - 2.*kxxMzzFromfcNEQ_NWB + 2.*kxxMzzFromfcNEQ_NWT -
-      2.*kxxMzzFromfcNEQ_SEB + 2.*kxxMzzFromfcNEQ_SET - 2.*kxxMzzFromfcNEQ_SWB + 2.*kxxMzzFromfcNEQ_SWT -
-      2.*kxzFromfcNEQ_NEB - 2.*kxzFromfcNEQ_NET + 2.*kxzFromfcNEQ_NWB + 2.*kxzFromfcNEQ_NWT -
-      2.*kxzFromfcNEQ_SEB - 2.*kxzFromfcNEQ_SET + 2.*kxzFromfcNEQ_SWB + 2.*kxzFromfcNEQ_SWT -
-      2.*kyzFromfcNEQ_NEB - 2.*kyzFromfcNEQ_NET - 2.*kyzFromfcNEQ_NWB - 2.*kyzFromfcNEQ_NWT +
-      2.*kyzFromfcNEQ_SEB + 2.*kyzFromfcNEQ_SET + 2.*kyzFromfcNEQ_SWB + 2.*kyzFromfcNEQ_SWT -
-      2.*vx1_NEB + 2.*vx1_NET + 2.*vx1_NWB - 2.*vx1_NWT -
-      2.*vx1_SEB + 2.*vx1_SET + 2.*vx1_SWB - 2.*vx1_SWT -
-      2.*vx2_NEB + 2.*vx2_NET - 2.*vx2_NWB + 2.*vx2_NWT +
-      2.*vx2_SEB - 2.*vx2_SET + 2.*vx2_SWB - 2.*vx2_SWT +
-      8.*vx3_NEB + 8.*vx3_NET + 8.*vx3_NWB + 8.*vx3_NWT +
-      8.*vx3_SEB + 8.*vx3_SET + 8.*vx3_SWB + 8.*vx3_SWT)/64.;
-   ax = (vx1_NEB + vx1_NET - vx1_NWB - vx1_NWT + vx1_SEB + vx1_SET - vx1_SWB - vx1_SWT)/4.;
-   bx = (vx2_NEB + vx2_NET - vx2_NWB - vx2_NWT + vx2_SEB + vx2_SET - vx2_SWB - vx2_SWT)/4.;
-   cx = (vx3_NEB + vx3_NET - vx3_NWB - vx3_NWT + vx3_SEB + vx3_SET - vx3_SWB - vx3_SWT)/4.;
-   axx= (kxxMyyFromfcNEQ_NEB + kxxMyyFromfcNEQ_NET - kxxMyyFromfcNEQ_NWB - kxxMyyFromfcNEQ_NWT +
-      kxxMyyFromfcNEQ_SEB + kxxMyyFromfcNEQ_SET - kxxMyyFromfcNEQ_SWB - kxxMyyFromfcNEQ_SWT +
-      kxxMzzFromfcNEQ_NEB + kxxMzzFromfcNEQ_NET - kxxMzzFromfcNEQ_NWB - kxxMzzFromfcNEQ_NWT +
-      kxxMzzFromfcNEQ_SEB + kxxMzzFromfcNEQ_SET - kxxMzzFromfcNEQ_SWB - kxxMzzFromfcNEQ_SWT +
-      2.*vx2_NEB + 2.*vx2_NET - 2.*vx2_NWB - 2.*vx2_NWT -
-      2.*vx2_SEB - 2.*vx2_SET + 2.*vx2_SWB + 2.*vx2_SWT -
-      2.*vx3_NEB + 2.*vx3_NET + 2.*vx3_NWB - 2.*vx3_NWT -
-      2.*vx3_SEB + 2.*vx3_SET + 2.*vx3_SWB - 2.*vx3_SWT)/16.;
-   bxx= (kxyFromfcNEQ_NEB + kxyFromfcNEQ_NET - kxyFromfcNEQ_NWB - kxyFromfcNEQ_NWT +
-      kxyFromfcNEQ_SEB + kxyFromfcNEQ_SET - kxyFromfcNEQ_SWB - kxyFromfcNEQ_SWT -
-      2.*vx1_NEB - 2.*vx1_NET + 2.*vx1_NWB + 2.*vx1_NWT +
-      2.*vx1_SEB + 2.*vx1_SET - 2.*vx1_SWB - 2.*vx1_SWT)/8.;
-   cxx= (kxzFromfcNEQ_NEB + kxzFromfcNEQ_NET - kxzFromfcNEQ_NWB - kxzFromfcNEQ_NWT +
-      kxzFromfcNEQ_SEB + kxzFromfcNEQ_SET - kxzFromfcNEQ_SWB - kxzFromfcNEQ_SWT +
-      2.*vx1_NEB - 2.*vx1_NET - 2.*vx1_NWB + 2.*vx1_NWT +
-      2.*vx1_SEB - 2.*vx1_SET - 2.*vx1_SWB + 2.*vx1_SWT)/8.;
-   ay = (vx1_NEB + vx1_NET + vx1_NWB + vx1_NWT - vx1_SEB - vx1_SET - vx1_SWB - vx1_SWT)/4.;
-   by = (vx2_NEB + vx2_NET + vx2_NWB + vx2_NWT - vx2_SEB - vx2_SET - vx2_SWB - vx2_SWT)/4.;
-   cy = (vx3_NEB + vx3_NET + vx3_NWB + vx3_NWT - vx3_SEB - vx3_SET - vx3_SWB - vx3_SWT)/4.;
-   ayy= (kxyFromfcNEQ_NEB + kxyFromfcNEQ_NET + kxyFromfcNEQ_NWB + kxyFromfcNEQ_NWT -
-      kxyFromfcNEQ_SEB - kxyFromfcNEQ_SET - kxyFromfcNEQ_SWB - kxyFromfcNEQ_SWT -
-      2.*vx2_NEB - 2.*vx2_NET + 2.*vx2_NWB + 2.*vx2_NWT +
-      2.*vx2_SEB + 2.*vx2_SET - 2.*vx2_SWB - 2.*vx2_SWT)/8.;
-   byy= (-2.*kxxMyyFromfcNEQ_NEB - 2.*kxxMyyFromfcNEQ_NET - 2.*kxxMyyFromfcNEQ_NWB - 2.*kxxMyyFromfcNEQ_NWT +
-      2.*kxxMyyFromfcNEQ_SEB + 2.*kxxMyyFromfcNEQ_SET + 2.*kxxMyyFromfcNEQ_SWB + 2.*kxxMyyFromfcNEQ_SWT +
-      kxxMzzFromfcNEQ_NEB + kxxMzzFromfcNEQ_NET + kxxMzzFromfcNEQ_NWB + kxxMzzFromfcNEQ_NWT -
-      kxxMzzFromfcNEQ_SEB - kxxMzzFromfcNEQ_SET - kxxMzzFromfcNEQ_SWB - kxxMzzFromfcNEQ_SWT +
-      2.*vx1_NEB + 2.*vx1_NET - 2.*vx1_NWB - 2.*vx1_NWT -
-      2.*vx1_SEB - 2.*vx1_SET + 2.*vx1_SWB + 2.*vx1_SWT -
-      2.*vx3_NEB + 2.*vx3_NET - 2.*vx3_NWB + 2.*vx3_NWT +
-      2.*vx3_SEB - 2.*vx3_SET + 2.*vx3_SWB - 2.*vx3_SWT)/16.;
-   cyy= (kyzFromfcNEQ_NEB + kyzFromfcNEQ_NET + kyzFromfcNEQ_NWB + kyzFromfcNEQ_NWT -
-      kyzFromfcNEQ_SEB - kyzFromfcNEQ_SET - kyzFromfcNEQ_SWB - kyzFromfcNEQ_SWT +
-      2.*vx2_NEB - 2.*vx2_NET + 2.*vx2_NWB - 2.*vx2_NWT -
-      2.*vx2_SEB + 2.*vx2_SET - 2.*vx2_SWB + 2.*vx2_SWT)/8.;
-   az = (-vx1_NEB + vx1_NET - vx1_NWB + vx1_NWT - vx1_SEB + vx1_SET - vx1_SWB + vx1_SWT)/4.;
-   bz = (-vx2_NEB + vx2_NET - vx2_NWB + vx2_NWT - vx2_SEB + vx2_SET - vx2_SWB + vx2_SWT)/4.;
-   cz = (-vx3_NEB + vx3_NET - vx3_NWB + vx3_NWT - vx3_SEB + vx3_SET - vx3_SWB + vx3_SWT)/4.;
-   azz= (-kxzFromfcNEQ_NEB + kxzFromfcNEQ_NET - kxzFromfcNEQ_NWB + kxzFromfcNEQ_NWT -
-      kxzFromfcNEQ_SEB + kxzFromfcNEQ_SET - kxzFromfcNEQ_SWB + kxzFromfcNEQ_SWT +
-      2.*vx3_NEB - 2.*vx3_NET - 2.*vx3_NWB + 2.*vx3_NWT +
-      2.*vx3_SEB - 2.*vx3_SET - 2.*vx3_SWB + 2.*vx3_SWT)/8.;
-   bzz= (-kyzFromfcNEQ_NEB + kyzFromfcNEQ_NET - kyzFromfcNEQ_NWB + kyzFromfcNEQ_NWT -
-      kyzFromfcNEQ_SEB + kyzFromfcNEQ_SET - kyzFromfcNEQ_SWB + kyzFromfcNEQ_SWT +
-      2.*vx3_NEB - 2.*vx3_NET + 2.*vx3_NWB - 2.*vx3_NWT -
-      2.*vx3_SEB + 2.*vx3_SET - 2.*vx3_SWB + 2.*vx3_SWT)/8.;
-   czz= (-kxxMyyFromfcNEQ_NEB + kxxMyyFromfcNEQ_NET - kxxMyyFromfcNEQ_NWB + kxxMyyFromfcNEQ_NWT -
-      kxxMyyFromfcNEQ_SEB + kxxMyyFromfcNEQ_SET - kxxMyyFromfcNEQ_SWB + kxxMyyFromfcNEQ_SWT +
-      2.*kxxMzzFromfcNEQ_NEB - 2.*kxxMzzFromfcNEQ_NET + 2.*kxxMzzFromfcNEQ_NWB - 2.*kxxMzzFromfcNEQ_NWT +
-      2.*kxxMzzFromfcNEQ_SEB - 2.*kxxMzzFromfcNEQ_SET + 2.*kxxMzzFromfcNEQ_SWB - 2.*kxxMzzFromfcNEQ_SWT -
-      2.*vx1_NEB + 2.*vx1_NET + 2.*vx1_NWB - 2.*vx1_NWT -
-      2.*vx1_SEB + 2.*vx1_SET + 2.*vx1_SWB - 2.*vx1_SWT -
-      2.*vx2_NEB + 2.*vx2_NET - 2.*vx2_NWB + 2.*vx2_NWT +
-      2.*vx2_SEB - 2.*vx2_SET + 2.*vx2_SWB - 2.*vx2_SWT)/16.;
-   axy= (vx1_NEB + vx1_NET - vx1_NWB - vx1_NWT - vx1_SEB - vx1_SET + vx1_SWB + vx1_SWT)/2.;
-   bxy= (vx2_NEB + vx2_NET - vx2_NWB - vx2_NWT - vx2_SEB - vx2_SET + vx2_SWB + vx2_SWT)/2.;
-   cxy= (vx3_NEB + vx3_NET - vx3_NWB - vx3_NWT - vx3_SEB - vx3_SET + vx3_SWB + vx3_SWT)/2.;
-   axz= (-vx1_NEB + vx1_NET + vx1_NWB - vx1_NWT - vx1_SEB + vx1_SET + vx1_SWB - vx1_SWT)/2.;
-   bxz= (-vx2_NEB + vx2_NET + vx2_NWB - vx2_NWT - vx2_SEB + vx2_SET + vx2_SWB - vx2_SWT)/2.;
-   cxz= (-vx3_NEB + vx3_NET + vx3_NWB - vx3_NWT - vx3_SEB + vx3_SET + vx3_SWB - vx3_SWT)/2.;
-   ayz= (-vx1_NEB + vx1_NET - vx1_NWB + vx1_NWT + vx1_SEB - vx1_SET + vx1_SWB - vx1_SWT)/2.;
-   byz= (-vx2_NEB + vx2_NET - vx2_NWB + vx2_NWT + vx2_SEB - vx2_SET + vx2_SWB - vx2_SWT)/2.;
-   cyz= (-vx3_NEB + vx3_NET - vx3_NWB + vx3_NWT + vx3_SEB - vx3_SET + vx3_SWB - vx3_SWT)/2.;
-   axyz=-vx1_NEB + vx1_NET + vx1_NWB - vx1_NWT + vx1_SEB - vx1_SET - vx1_SWB + vx1_SWT;
-   bxyz=-vx2_NEB + vx2_NET + vx2_NWB - vx2_NWT + vx2_SEB - vx2_SET - vx2_SWB + vx2_SWT;
-   cxyz=-vx3_NEB + vx3_NET + vx3_NWB - vx3_NWT + vx3_SEB - vx3_SET - vx3_SWB + vx3_SWT;
-
-
-   //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-   kxyAverage       =0;//(kxyFromfcNEQ_SWB+
-                       //kxyFromfcNEQ_SWT+
-                       //kxyFromfcNEQ_SET+
-                       //kxyFromfcNEQ_SEB+
-                       //kxyFromfcNEQ_NWB+
-                       //kxyFromfcNEQ_NWT+
-                       //kxyFromfcNEQ_NET+
-                       //kxyFromfcNEQ_NEB)*c1o8-(ay+bx);
-   kyzAverage       =0;//(kyzFromfcNEQ_SWB+
-                       //kyzFromfcNEQ_SWT+
-                       //kyzFromfcNEQ_SET+
-                       //kyzFromfcNEQ_SEB+
-                       //kyzFromfcNEQ_NWB+
-                       //kyzFromfcNEQ_NWT+
-                       //kyzFromfcNEQ_NET+
-                       //kyzFromfcNEQ_NEB)*c1o8-(bz+cy);
-   kxzAverage       =0;//(kxzFromfcNEQ_SWB+
-                       //kxzFromfcNEQ_SWT+
-                       //kxzFromfcNEQ_SET+
-                       //kxzFromfcNEQ_SEB+
-                       //kxzFromfcNEQ_NWB+
-                       //kxzFromfcNEQ_NWT+
-                       //kxzFromfcNEQ_NET+
-                       //kxzFromfcNEQ_NEB)*c1o8-(az+cx);
-   kxxMyyAverage    =0;//(kxxMyyFromfcNEQ_SWB+
-                       //kxxMyyFromfcNEQ_SWT+
-                       //kxxMyyFromfcNEQ_SET+
-                       //kxxMyyFromfcNEQ_SEB+
-                       //kxxMyyFromfcNEQ_NWB+
-                       //kxxMyyFromfcNEQ_NWT+
-                       //kxxMyyFromfcNEQ_NET+
-                       //kxxMyyFromfcNEQ_NEB)*c1o8-(ax-by);
-   kxxMzzAverage    =0;//(kxxMzzFromfcNEQ_SWB+
-                       //kxxMzzFromfcNEQ_SWT+
-                       //kxxMzzFromfcNEQ_SET+
-                       //kxxMzzFromfcNEQ_SEB+
-                       //kxxMzzFromfcNEQ_NWB+
-                       //kxxMzzFromfcNEQ_NWT+
-                       //kxxMzzFromfcNEQ_NET+
-                       //kxxMzzFromfcNEQ_NEB)*c1o8-(ax-cz);
-   ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-   //
-   // Bernd das Brot
-   //
-   ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-   a0 = a0 + xoff * ax + yoff * ay + zoff * az + xoff_sq * axx + yoff_sq * ayy + zoff_sq * azz + xoff*yoff*axy + xoff*zoff*axz + yoff*zoff*ayz + xoff*yoff*zoff*axyz ;
-   ax = ax + 2. * xoff * axx + yoff * axy + zoff * axz + yoff*zoff*axyz;
-   ay = ay + 2. * yoff * ayy + xoff * axy + zoff * ayz + xoff*zoff*axyz;
-   az = az + 2. * zoff * azz + xoff * axz + yoff * ayz + xoff*yoff*axyz;
-   b0 = b0 + xoff * bx + yoff * by + zoff * bz + xoff_sq * bxx + yoff_sq * byy + zoff_sq * bzz + xoff*yoff*bxy + xoff*zoff*bxz + yoff*zoff*byz + xoff*yoff*zoff*bxyz;
-   bx = bx + 2. * xoff * bxx + yoff * bxy + zoff * bxz + yoff*zoff*bxyz;
-   by = by + 2. * yoff * byy + xoff * bxy + zoff * byz + xoff*zoff*bxyz;
-   bz = bz + 2. * zoff * bzz + xoff * bxz + yoff * byz + xoff*yoff*bxyz;
-   c0 = c0 + xoff * cx + yoff * cy + zoff * cz + xoff_sq * cxx + yoff_sq * cyy + zoff_sq * czz + xoff*yoff*cxy + xoff*zoff*cxz + yoff*zoff*cyz + xoff*yoff*zoff*cxyz;
-   cx = cx + 2. * xoff * cxx + yoff * cxy + zoff * cxz + yoff*zoff*cxyz;
-   cy = cy + 2. * yoff * cyy + xoff * cxy + zoff * cyz + xoff*zoff*cxyz;
-   cz = cz + 2. * zoff * czz + xoff * cxz + yoff * cyz + xoff*yoff*cxyz;
-   axy= axy + zoff*axyz;
-   axz= axz + yoff*axyz;
-   ayz= ayz + xoff*axyz;
-   bxy= bxy + zoff*bxyz;
-   bxz= bxz + yoff*bxyz;
-   byz= byz + xoff*bxyz;
-   cxy= cxy + zoff*cxyz;
-   cxz= cxz + yoff*cxyz;
-   cyz= cyz + xoff*cxyz;
-   ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-   const LBMReal o = omega;
-
-   f_E = eps_new*((2*(-2*ax + by + cz-kxxMzzAverage-kxxMyyAverage))/(27.*o));
-   f_N = eps_new*((2*(ax - 2*by + cz+2*kxxMyyAverage-kxxMzzAverage))/(27.*o));
-   f_T = eps_new*((2*(ax + by - 2*cz-kxxMyyAverage+2*kxxMzzAverage))/(27.*o));
-   f_NE = eps_new*(-(ax + 3*ay + 3*bx + by - 2*cz+2*kxxMyyAverage-kxxMyyAverage+3*kxyAverage)/(54.*o));
-   f_SE = eps_new*(-(ax - 3*ay - 3*bx + by - 2*cz+2*kxxMyyAverage-kxxMyyAverage-3*kxyAverage)/(54.*o));
-   f_TE = eps_new*(-(ax + 3*az - 2*by + 3*cx + cz+2*kxxMyyAverage-kxxMzzAverage+3*kxzAverage)/(54.*o));
-   f_BE = eps_new*(-(ax - 3*az - 2*by - 3*cx + cz+2*kxxMyyAverage-kxxMzzAverage-3*kxzAverage)/(54.*o));
-   f_TN = eps_new*(-(-2*ax + by + 3*bz + 3*cy + cz-kxxMyyAverage-kxxMzzAverage+3*kyzAverage)/(54.*o));
-   f_BN = eps_new*(-(-2*ax + by - 3*bz - 3*cy + cz-kxxMyyAverage-kxxMzzAverage-3*kyzAverage)/(54.*o));
-   f_ZERO = 0.;
-   f_TNE = eps_new*(-(ay + az + bx + bz + cx + cy+kxyAverage+kxzAverage+kyzAverage)/(72.*o));
-   f_TSW = eps_new*((-ay + az - bx + bz + cx + cy-kxyAverage+kxzAverage+kyzAverage)/(72.*o));
-   f_TSE = eps_new*((ay - az + bx + bz - cx + cy+kxyAverage-kxzAverage+kyzAverage)/(72.*o));
-   f_TNW = eps_new*((ay + az + bx - bz + cx - cy+kxyAverage+kxzAverage-kyzAverage)/(72.*o));
-
-   x_E = 0.25*eps_new*((2*(-4*axx + bxy + cxz))/(27.*o));
-   x_N = 0.25*eps_new*((2*(2*axx - 2*bxy + cxz))/(27.*o));
-   x_T = 0.25*eps_new*((2*(2*axx + bxy - 2*cxz))/(27.*o));
-   x_NE = 0.25*eps_new*(-((2*axx + 3*axy + 6*bxx + bxy - 2*cxz))/(54.*o));
-   x_SE = 0.25*eps_new*(-((2*axx - 3*axy - 6*bxx + bxy - 2*cxz))/(54.*o));
-   x_TE = 0.25*eps_new*(-((2*axx + 3*axz - 2*bxy + 6*cxx + cxz))/(54.*o));
-   x_BE = 0.25*eps_new*(-((2*axx - 3*axz - 2*bxy - 6*cxx + cxz))/(54.*o));
-   x_TN = 0.25*eps_new*(-((-4*axx + bxy + 3*bxz + 3*cxy + cxz))/(54.*o));
-   x_BN = 0.25*eps_new*(-((-4*axx + bxy - 3*bxz - 3*cxy + cxz))/(54.*o));
-   x_ZERO = 0.;
-   x_TNE = 0.25*eps_new*(-((axy + axz + 2*bxx + bxz + 2*cxx + cxy))/(72.*o));
-   x_TSW = 0.25*eps_new*(((-axy + axz - 2*bxx + bxz + 2*cxx + cxy))/(72.*o));
-   x_TSE = 0.25*eps_new*(((axy - axz + 2*bxx + bxz - 2*cxx + cxy))/(72.*o));
-   x_TNW = 0.25*eps_new*(((axy + axz + 2*bxx - bxz + 2*cxx - cxy))/(72.*o));
-
-   y_E = 0.25*eps_new*(2*(-2*axy + 2*byy + cyz))/(27.*o);
-   y_N = 0.25*eps_new*(2*(axy - 4*byy + cyz))/(27.*o);
-   y_T = 0.25*eps_new*(2*(axy + 2*byy - 2*cyz))/(27.*o);
-   y_NE = 0.25*eps_new*(-((axy + 6*ayy + 3*bxy + 2*byy - 2*cyz))/(54.*o));
-   y_SE = 0.25*eps_new*(-((axy - 6*ayy - 3*bxy + 2*byy - 2*cyz))/(54.*o));
-   y_TE = 0.25*eps_new*(-((axy + 3*ayz - 4*byy + 3*cxy + cyz))/(54.*o));
-   y_BE = 0.25*eps_new*(-((axy - 3*ayz - 4*byy - 3*cxy + cyz))/(54.*o));
-   y_TN = 0.25*eps_new*(-((-2*axy + 2*byy + 3*byz + 6*cyy + cyz))/(54.*o));
-   y_BN = 0.25*eps_new*(-((-2*axy + 2*byy - 3*byz - 6*cyy + cyz))/(54.*o));
-   y_ZERO = 0.;
-   y_TNE = 0.25*eps_new*(-((2*ayy + ayz + bxy + byz + cxy + 2*cyy))/(72.*o));
-   y_TSW = 0.25*eps_new*(((-2*ayy + ayz - bxy + byz + cxy + 2*cyy))/(72.*o));
-   y_TSE = 0.25*eps_new*(((2*ayy - ayz + bxy + byz - cxy + 2*cyy))/(72.*o));
-   y_TNW = 0.25*eps_new*(((2*ayy + ayz + bxy - byz + cxy - 2*cyy))/(72.*o));
-
-   z_E = 0.25*eps_new*((2*(-2*axz + byz + 2*czz))/(27.*o));
-   z_N = 0.25*eps_new*((2*(axz - 2*byz + 2*czz))/(27.*o));
-   z_T = 0.25*eps_new*((2*(axz + byz - 4*czz))/(27.*o));
-   z_NE = 0.25*eps_new*(-((axz + 3*ayz + 3*bxz + byz - 4*czz))/(54.*o));
-   z_SE = 0.25*eps_new*(-((axz - 3*ayz - 3*bxz + byz - 4*czz))/(54.*o));
-   z_TE = 0.25*eps_new*(-((axz + 6*azz - 2*byz + 3*cxz + 2*czz))/(54.*o));
-   z_BE = 0.25*eps_new*(-((axz - 6*azz - 2*byz - 3*cxz + 2*czz))/(54.*o));
-   z_TN = 0.25*eps_new*(-((-2*axz + byz + 6*bzz + 3*cyz + 2*czz))/(54.*o));
-   z_BN = 0.25*eps_new*(-((-2*axz + byz - 6*bzz - 3*cyz + 2*czz))/(54.*o));
-   z_ZERO = 0.;
-   z_TNE = 0.25*eps_new*(-((ayz + 2*azz + bxz + 2*bzz + cxz + cyz))/(72.*o));
-   z_TSW = 0.25*eps_new*(((-ayz + 2*azz - bxz + 2*bzz + cxz + cyz))/(72.*o));
-   z_TSE = 0.25*eps_new*(((ayz - 2*azz + bxz + 2*bzz - cxz + cyz))/(72.*o));
-   z_TNW = 0.25*eps_new*(((ayz + 2*azz + bxz - 2*bzz + cxz - cyz))/(72.*o));
-
-   xy_E   =   0.0625*eps_new *((                       2.*cxyz)/(27.*o));
-   xy_N   =   0.0625*eps_new *((                       2.*cxyz)/(27.*o));
-   xy_T   = -(0.0625*eps_new *((                       4.*cxyz)/(27.*o)));
-   xy_NE  =   0.0625*eps_new *(                            cxyz /(27.*o));
-   xy_SE  =   0.0625*eps_new *(                            cxyz /(27.*o));
-   xy_TE  = -(0.0625*eps_new *(( 3.*axyz            +     cxyz)/(54.*o)));
-   xy_BE  = -(0.0625*eps_new *((-3.*axyz            +     cxyz)/(54.*o)));
-   xy_TN  = -(0.0625*eps_new *((            3.*bxyz +     cxyz)/(54.*o)));
-   xy_BN  = -(0.0625*eps_new *((          - 3.*bxyz +     cxyz)/(54.*o)));
-   //xy_ZERO=   0.0625*eps_new;
-   xy_TNE = -(0.0625*eps_new *((     axyz +     bxyz           )/(72.*o)));
-   xy_TSW =   0.0625*eps_new *((     axyz +     bxyz           )/(72.*o));
-   xy_TSE =   0.0625*eps_new *((-    axyz +     bxyz           )/(72.*o));
-   xy_TNW =   0.0625*eps_new *((     axyz -     bxyz           )/(72.*o));
-
-   xz_E   =   0.0625*eps_new *((            2.*bxyz           )/(27.*o));
-   xz_N   = -(0.0625*eps_new *((            4.*bxyz           )/(27.*o)));
-   xz_T   =   0.0625*eps_new *((            2.*bxyz           )/(27.*o));
-   xz_NE  = -(0.0625*eps_new *(( 3.*axyz +     bxyz           )/(54.*o)));
-   xz_SE  = -(0.0625*eps_new *((-3.*axyz +     bxyz           )/(54.*o)));
-   xz_TE  =   0.0625*eps_new *((                bxyz           )/(27.*o));
-   xz_BE  =   0.0625*eps_new *((                bxyz           )/(27.*o));
-   xz_TN  = -(0.0625*eps_new *((                bxyz + 3.*cxyz)/(54.*o)));
-   xz_BN  = -(0.0625*eps_new *((                bxyz - 3.*cxyz)/(54.*o)));
-   //xz_ZERO=   0.0625*eps_new;
-   xz_TNE = -(0.0625*eps_new *((     axyz            +     cxyz)/(72.*o)));
-   xz_TSW =   0.0625*eps_new *((-    axyz            +     cxyz)/(72.*o));
-   xz_TSE =   0.0625*eps_new *((     axyz            +     cxyz)/(72.*o));
-   xz_TNW =   0.0625*eps_new *((     axyz            -     cxyz)/(72.*o));
-
-   yz_E   = -(0.0625*eps_new *(( 4.*axyz                      )/(27.*o)));
-   yz_N   =   0.0625*eps_new *(( 2.*axyz                      )/(27.*o));
-   yz_T   =   0.0625*eps_new *(( 2.*axyz                      )/(27.*o));
-   yz_NE  = -(0.0625*eps_new *((     axyz + 3.*bxyz           )/(54.*o)));
-   yz_SE  = -(0.0625*eps_new *((     axyz - 3.*bxyz           )/(54.*o)));
-   yz_TE  = -(0.0625*eps_new *((     axyz            + 3.*cxyz)/(54.*o)));
-   yz_BE  = -(0.0625*eps_new *((     axyz            - 3.*cxyz)/(54.*o)));
-   yz_TN  =   0.0625*eps_new *((     axyz                      )/(27.*o));
-   yz_BN  =   0.0625*eps_new *((     axyz                      )/(27.*o));
-   //yz_ZERO=   0.0625*eps_new;
-   yz_TNE = -(0.0625*eps_new *((                bxyz +     cxyz)/(72.*o)));
-   yz_TSW =   0.0625*eps_new *((          -     bxyz +     cxyz)/(72.*o));
-   yz_TSE =   0.0625*eps_new *((                bxyz -     cxyz)/(72.*o));
-   yz_TNW =   0.0625*eps_new *((                bxyz +     cxyz)/(72.*o));
-}
-//////////////////////////////////////////////////////////////////////////
-void CompressibleOffsetMomentsInterpolationProcessor::calcInterpolatedNodeCF(LBMReal* f, LBMReal omega, LBMReal x, LBMReal y, LBMReal z, LBMReal press, LBMReal xs, LBMReal ys, LBMReal zs)
-{
-   using namespace D3Q27System;
-
-   LBMReal eps_new = 0.5;
-   LBMReal o = omega;
-   //bulk viscosity
-   LBMReal oP = OxxPyyPzzF;
-
-   LBMReal rho  = press ;//+ (2.*axx*x+axy*y+axz*z+axyz*y*z+ax + 2.*byy*y+bxy*x+byz*z+bxyz*x*z+by + 2.*czz*z+cxz*x+cyz*y+cxyz*x*y+cz)/3.;
-   LBMReal vx1  = a0 + 0.25*( xs*ax + ys*ay + zs*az) + 0.0625*(axx + xs*ys*axy + xs*zs*axz + ayy + ys*zs*ayz + azz) + 0.015625*(xs*ys*zs*axyz);
-   LBMReal vx2  = b0 + 0.25*( xs*bx + ys*by + zs*bz) + 0.0625*(bxx + xs*ys*bxy + xs*zs*bxz + byy + ys*zs*byz + bzz) + 0.015625*(xs*ys*zs*bxyz);
-   LBMReal vx3  = c0 + 0.25*( xs*cx + ys*cy + zs*cz) + 0.0625*(cxx + xs*ys*cxy + xs*zs*cxz + cyy + ys*zs*cyz + czz) + 0.015625*(xs*ys*zs*cxyz);
-
-   LBMReal mfcbb = zeroReal;
-   LBMReal mfabb = zeroReal;
-   LBMReal mfbcb = zeroReal;
-   LBMReal mfbab = zeroReal;
-   LBMReal mfbbc = zeroReal;
-   LBMReal mfbba = zeroReal;
-   LBMReal mfccb = zeroReal;
-   LBMReal mfaab = zeroReal;
-   LBMReal mfcab = zeroReal;
-   LBMReal mfacb = zeroReal;
-   LBMReal mfcbc = zeroReal;
-   LBMReal mfaba = zeroReal;
-   LBMReal mfcba = zeroReal;
-   LBMReal mfabc = zeroReal;
-   LBMReal mfbcc = zeroReal;
-   LBMReal mfbaa = zeroReal;
-   LBMReal mfbca = zeroReal;
-   LBMReal mfbac = zeroReal;
-   LBMReal mfbbb = zeroReal;
-   LBMReal mfccc = zeroReal;
-   LBMReal mfaac = zeroReal;
-   LBMReal mfcac = zeroReal;
-   LBMReal mfacc = zeroReal;
-   LBMReal mfcca = zeroReal;
-   LBMReal mfaaa = zeroReal;
-   LBMReal mfcaa = zeroReal;
-   LBMReal mfaca = zeroReal;
-
-   mfaaa = press; // if drho is interpolated directly
-
-   LBMReal vx1Sq = vx1*vx1;
-   LBMReal vx2Sq = vx2*vx2;
-   LBMReal vx3Sq = vx3*vx3;
-   LBMReal oMdrho = one;
-
-   //2.f
-
-   // linear combinations
-   LBMReal mxxPyyPzz = mfaaa - c2o3*(ax + by + two*axx*x + bxy*x + axy*y + two*byy*y + axz*z + byz*z + bxyz*x*z + axyz*y*z + cz - cxz*x + cyz*y + cxyz*x*y + two*czz*z)*eps_new / oP* (one + press);
-   LBMReal mxxMyy    = -c2o3*(ax - by + kxxMyyAverage + two*axx*x - bxy*x + axy*y - two*byy*y + axz*z - byz*z - bxyz*x*z + axyz*y*z)*eps_new/o * (one + press);
-   LBMReal mxxMzz    = -c2o3*(ax - cz + kxxMzzAverage + two*axx*x - cxz*x + axy*y - cyz*y - cxyz*x*y + axz*z - two*czz*z + axyz*y*z)*eps_new/o * (one + press);
-
-   mfabb     = -c1o3 * (bz + cy + kyzAverage + bxz*x + cxy*x + byz*y + two*cyy*y + bxyz*x*y + two*bzz*z + cyz*z + cxyz*x*z)*eps_new/o * (one + press);
-   mfbab     = -c1o3 * (az + cx + kxzAverage + axz*x + two*cxx*x + ayz*y + cxy*y + axyz*x*y + two*azz*z + cxz*z + cxyz*y*z)*eps_new/o * (one + press);
-   mfbba     = -c1o3 * (ay + bx + kxyAverage + axy*x + two*bxx*x + two*ayy*y + bxy*y + ayz*z + bxz*z + axyz*x*z + bxyz*y*z)*eps_new/o * (one + press);
-
-   // linear combinations back
-   mfcaa = c1o3 * (mxxMyy +       mxxMzz + mxxPyyPzz) ;
-   mfaca = c1o3 * (-two * mxxMyy +       mxxMzz + mxxPyyPzz) ;
-   mfaac = c1o3 * (mxxMyy - two * mxxMzz + mxxPyyPzz) ;
-
-   //three
-   mfbbb = zeroReal;
-   LBMReal mxxyPyzz = zeroReal;
-   LBMReal mxxyMyzz = zeroReal;
-   LBMReal mxxzPyyz = zeroReal;
-   LBMReal mxxzMyyz = zeroReal;
-   LBMReal mxyyPxzz =  zeroReal;
-   LBMReal mxyyMxzz = zeroReal;
-
-   // linear combinations back
-   mfcba = (mxxyMyzz + mxxyPyzz) * c1o2;
-   mfabc = (-mxxyMyzz + mxxyPyzz) * c1o2;
-   mfcab = (mxxzMyyz + mxxzPyyz) * c1o2;
-   mfacb = (-mxxzMyyz + mxxzPyyz) * c1o2;
-   mfbca = (mxyyMxzz + mxyyPxzz) * c1o2;
-   mfbac = (-mxyyMxzz + mxyyPxzz) * c1o2;
-
-   //4.f
-   mfacc = mfaaa*c1o9;
-   mfcac = mfacc;
-   mfcca = mfacc;
-
-   //5.
-
-   //6.
-
-   mfccc = mfaaa*c1o27;
-   ////////////////////////////////////////////////////////////////////////////////////
-   //back
-   ////////////////////////////////////////////////////////////////////////////////////
-   //mit 1, 0, 1/3, 0, 0, 0, 1/3, 0, 1/9   Konditionieren
-   ////////////////////////////////////////////////////////////////////////////////////
-   // Z - Dir
-   LBMReal m0 =  mfaac * c1o2 +      mfaab * (vx3 - c1o2) + (mfaaa + one * oMdrho) * (vx3Sq - vx3) * c1o2;
-   LBMReal m1 = -mfaac        - two * mfaab *  vx3         +  mfaaa                * (one - vx3Sq)              - one * oMdrho * vx3Sq;
-   LBMReal m2 =  mfaac * c1o2 +      mfaab * (vx3 + c1o2) + (mfaaa + one * oMdrho) * (vx3Sq + vx3) * c1o2;
-   mfaaa = m0;
-   mfaab = m1;
-   mfaac = m2;
-   ////////////////////////////////////////////////////////////////////////////////////
-   m0 =  mfabc * c1o2 +      mfabb * (vx3 - c1o2) + mfaba * (vx3Sq - vx3) * c1o2;
-   m1 = -mfabc        - two * mfabb *  vx3         + mfaba * (one - vx3Sq);
-   m2 =  mfabc * c1o2 +      mfabb * (vx3 + c1o2) + mfaba * (vx3Sq + vx3) * c1o2;
-   mfaba = m0;
-   mfabb = m1;
-   mfabc = m2;
-   ////////////////////////////////////////////////////////////////////////////////////
-   m0 =  mfacc * c1o2 +      mfacb * (vx3 - c1o2) + (mfaca + c1o3 * oMdrho) * (vx3Sq - vx3) * c1o2;
-   m1 = -mfacc        - two * mfacb *  vx3         +  mfaca                  * (one - vx3Sq)              - c1o3 * oMdrho * vx3Sq;
-   m2 =  mfacc * c1o2 +      mfacb * (vx3 + c1o2) + (mfaca + c1o3 * oMdrho) * (vx3Sq + vx3) * c1o2;
-   mfaca = m0;
-   mfacb = m1;
-   mfacc = m2;
-   ////////////////////////////////////////////////////////////////////////////////////
-   ////////////////////////////////////////////////////////////////////////////////////
-   m0 =  mfbac * c1o2 +      mfbab * (vx3 - c1o2) + mfbaa * (vx3Sq - vx3) * c1o2;
-   m1 = -mfbac        - two * mfbab *  vx3         + mfbaa * (one - vx3Sq);
-   m2 =  mfbac * c1o2 +      mfbab * (vx3 + c1o2) + mfbaa * (vx3Sq + vx3) * c1o2;
-   mfbaa = m0;
-   mfbab = m1;
-   mfbac = m2;
-   /////////b//////////////////////////////////////////////////////////////////////////
-   m0 =  mfbbc * c1o2 +      mfbbb * (vx3 - c1o2) + mfbba * (vx3Sq - vx3) * c1o2;
-   m1 = -mfbbc        - two * mfbbb *  vx3         + mfbba * (one - vx3Sq);
-   m2 =  mfbbc * c1o2 +      mfbbb * (vx3 + c1o2) + mfbba * (vx3Sq + vx3) * c1o2;
-   mfbba = m0;
-   mfbbb = m1;
-   mfbbc = m2;
-   /////////b//////////////////////////////////////////////////////////////////////////
-   m0 =  mfbcc * c1o2 +      mfbcb * (vx3 - c1o2) + mfbca * (vx3Sq - vx3) * c1o2;
-   m1 = -mfbcc        - two * mfbcb *  vx3         + mfbca * (one - vx3Sq);
-   m2 =  mfbcc * c1o2 +      mfbcb * (vx3 + c1o2) + mfbca * (vx3Sq + vx3) * c1o2;
-   mfbca = m0;
-   mfbcb = m1;
-   mfbcc = m2;
-   ////////////////////////////////////////////////////////////////////////////////////
-   ////////////////////////////////////////////////////////////////////////////////////
-   m0 =  mfcac * c1o2 +      mfcab * (vx3 - c1o2) + (mfcaa + c1o3 * oMdrho) * (vx3Sq - vx3) * c1o2;
-   m1 = -mfcac        - two * mfcab *  vx3         +  mfcaa                  * (one - vx3Sq)              - c1o3 * oMdrho * vx3Sq;
-   m2 =  mfcac * c1o2 +      mfcab * (vx3 + c1o2) + (mfcaa + c1o3 * oMdrho) * (vx3Sq + vx3) * c1o2;
-   mfcaa = m0;
-   mfcab = m1;
-   mfcac = m2;
-   /////////c//////////////////////////////////////////////////////////////////////////
-   m0 =  mfcbc * c1o2 +      mfcbb * (vx3 - c1o2) + mfcba * (vx3Sq - vx3) * c1o2;
-   m1 = -mfcbc        - two * mfcbb *  vx3         + mfcba * (one - vx3Sq);
-   m2 =  mfcbc * c1o2 +      mfcbb * (vx3 + c1o2) + mfcba * (vx3Sq + vx3) * c1o2;
-   mfcba = m0;
-   mfcbb = m1;
-   mfcbc = m2;
-   /////////c//////////////////////////////////////////////////////////////////////////
-   m0 =  mfccc * c1o2 +      mfccb * (vx3 - c1o2) + (mfcca + c1o9 * oMdrho) * (vx3Sq - vx3) * c1o2;
-   m1 = -mfccc        - two * mfccb *  vx3         +  mfcca                  * (one - vx3Sq)              - c1o9 * oMdrho * vx3Sq;
-   m2 =  mfccc * c1o2 +      mfccb * (vx3 + c1o2) + (mfcca + c1o9 * oMdrho) * (vx3Sq + vx3) * c1o2;
-   mfcca = m0;
-   mfccb = m1;
-   mfccc = m2;
-   ////////////////////////////////////////////////////////////////////////////////////
-   ////////////////////////////////////////////////////////////////////////////////////
-   //mit 1/6, 2/3, 1/6, 0, 0, 0, 1/18, 2/9, 1/18   Konditionieren
-   ////////////////////////////////////////////////////////////////////////////////////
-   // Y - Dir
-   m0 =  mfaca * c1o2 +      mfaba * (vx2 - c1o2) + (mfaaa + c1o6 * oMdrho) * (vx2Sq - vx2) * c1o2;
-   m1 = -mfaca        - two * mfaba *  vx2         +  mfaaa                  * (one - vx2Sq)              - c1o6 * oMdrho * vx2Sq;
-   m2 =  mfaca * c1o2 +      mfaba * (vx2 + c1o2) + (mfaaa + c1o6 * oMdrho) * (vx2Sq + vx2) * c1o2;
-   mfaaa = m0;
-   mfaba = m1;
-   mfaca = m2;
-   ////////////////////////////////////////////////////////////////////////////////////
-   m0 =  mfacb * c1o2 +      mfabb * (vx2 - c1o2) + (mfaab + c2o3 * oMdrho) * (vx2Sq - vx2) * c1o2;
-   m1 = -mfacb        - two * mfabb *  vx2         +  mfaab                  * (one - vx2Sq)              - c2o3 * oMdrho * vx2Sq;
-   m2 =  mfacb * c1o2 +      mfabb * (vx2 + c1o2) + (mfaab + c2o3 * oMdrho) * (vx2Sq + vx2) * c1o2;
-   mfaab = m0;
-   mfabb = m1;
-   mfacb = m2;
-   ////////////////////////////////////////////////////////////////////////////////////
-   m0 =  mfacc * c1o2 +      mfabc * (vx2 - c1o2) + (mfaac + c1o6 * oMdrho) * (vx2Sq - vx2) * c1o2;
-   m1 = -mfacc        - two * mfabc *  vx2         +  mfaac                  * (one - vx2Sq)              - c1o6 * oMdrho * vx2Sq;
-   m2 =  mfacc * c1o2 +      mfabc * (vx2 + c1o2) + (mfaac + c1o6 * oMdrho) * (vx2Sq + vx2) * c1o2;
-   mfaac = m0;
-   mfabc = m1;
-   mfacc = m2;
-   ////////////////////////////////////////////////////////////////////////////////////
-   ////////////////////////////////////////////////////////////////////////////////////
-   m0 =  mfbca * c1o2 +      mfbba * (vx2 - c1o2) + mfbaa * (vx2Sq - vx2) * c1o2;
-   m1 = -mfbca        - two * mfbba *  vx2         + mfbaa * (one - vx2Sq);
-   m2 =  mfbca * c1o2 +      mfbba * (vx2 + c1o2) + mfbaa * (vx2Sq + vx2) * c1o2;
-   mfbaa = m0;
-   mfbba = m1;
-   mfbca = m2;
-   /////////b//////////////////////////////////////////////////////////////////////////
-   m0 =  mfbcb * c1o2 +      mfbbb * (vx2 - c1o2) + mfbab * (vx2Sq - vx2) * c1o2;
-   m1 = -mfbcb        - two * mfbbb *  vx2         + mfbab * (one - vx2Sq);
-   m2 =  mfbcb * c1o2 +      mfbbb * (vx2 + c1o2) + mfbab * (vx2Sq + vx2) * c1o2;
-   mfbab = m0;
-   mfbbb = m1;
-   mfbcb = m2;
-   /////////b//////////////////////////////////////////////////////////////////////////
-   m0 =  mfbcc * c1o2 +      mfbbc * (vx2 - c1o2) + mfbac * (vx2Sq - vx2) * c1o2;
-   m1 = -mfbcc        - two * mfbbc *  vx2         + mfbac * (one - vx2Sq);
-   m2 =  mfbcc * c1o2 +      mfbbc * (vx2 + c1o2) + mfbac * (vx2Sq + vx2) * c1o2;
-   mfbac = m0;
-   mfbbc = m1;
-   mfbcc = m2;
-   ////////////////////////////////////////////////////////////////////////////////////
-   ////////////////////////////////////////////////////////////////////////////////////
-   m0 =  mfcca * c1o2 +      mfcba * (vx2 - c1o2) + (mfcaa + c1o18 * oMdrho) * (vx2Sq - vx2) * c1o2;
-   m1 = -mfcca        - two * mfcba *  vx2         +  mfcaa                   * (one - vx2Sq)              - c1o18 * oMdrho * vx2Sq;
-   m2 =  mfcca * c1o2 +      mfcba * (vx2 + c1o2) + (mfcaa + c1o18 * oMdrho) * (vx2Sq + vx2) * c1o2;
-   mfcaa = m0;
-   mfcba = m1;
-   mfcca = m2;
-   /////////c//////////////////////////////////////////////////////////////////////////
-   m0 =  mfccb * c1o2 +      mfcbb * (vx2 - c1o2) + (mfcab + c2o9 * oMdrho) * (vx2Sq - vx2) * c1o2;
-   m1 = -mfccb        - two * mfcbb *  vx2         +  mfcab                  * (one - vx2Sq)              - c2o9 * oMdrho * vx2Sq;
-   m2 =  mfccb * c1o2 +      mfcbb * (vx2 + c1o2) + (mfcab + c2o9 * oMdrho) * (vx2Sq + vx2) * c1o2;
-   mfcab = m0;
-   mfcbb = m1;
-   mfccb = m2;
-   /////////c//////////////////////////////////////////////////////////////////////////
-   m0 =  mfccc * c1o2 +      mfcbc * (vx2 - c1o2) + (mfcac + c1o18 * oMdrho) * (vx2Sq - vx2) * c1o2;
-   m1 = -mfccc        - two * mfcbc *  vx2         +  mfcac                   * (one - vx2Sq)              - c1o18 * oMdrho * vx2Sq;
-   m2 =  mfccc * c1o2 +      mfcbc * (vx2 + c1o2) + (mfcac + c1o18 * oMdrho) * (vx2Sq + vx2) * c1o2;
-   mfcac = m0;
-   mfcbc = m1;
-   mfccc = m2;
-   ////////////////////////////////////////////////////////////////////////////////////
-   ////////////////////////////////////////////////////////////////////////////////////
-   //mit 1/36, 1/9, 1/36, 1/9, 4/9, 1/9, 1/36, 1/9, 1/36 Konditionieren
-   ////////////////////////////////////////////////////////////////////////////////////
-   // X - Dir
-   m0 =  mfcaa * c1o2 +      mfbaa * (vx1 - c1o2) + (mfaaa + c1o36 * oMdrho) * (vx1Sq - vx1) * c1o2;
-   m1 = -mfcaa        - two * mfbaa *  vx1         +  mfaaa                   * (one - vx1Sq)              - c1o36 * oMdrho * vx1Sq;
-   m2 =  mfcaa * c1o2 +      mfbaa * (vx1 + c1o2) + (mfaaa + c1o36 * oMdrho) * (vx1Sq + vx1) * c1o2;
-   mfaaa = m0;
-   mfbaa = m1;
-   mfcaa = m2;
-   ////////////////////////////////////////////////////////////////////////////////////
-   m0 =  mfcba * c1o2 +      mfbba * (vx1 - c1o2) + (mfaba + c1o9 * oMdrho) * (vx1Sq - vx1) * c1o2;
-   m1 = -mfcba        - two * mfbba *  vx1         +  mfaba                  * (one - vx1Sq)              - c1o9 * oMdrho * vx1Sq;
-   m2 =  mfcba * c1o2 +      mfbba * (vx1 + c1o2) + (mfaba + c1o9 * oMdrho) * (vx1Sq + vx1) * c1o2;
-   mfaba = m0;
-   mfbba = m1;
-   mfcba = m2;
-   ////////////////////////////////////////////////////////////////////////////////////
-   m0 =  mfcca * c1o2 +      mfbca * (vx1 - c1o2) + (mfaca + c1o36 * oMdrho) * (vx1Sq - vx1) * c1o2;
-   m1 = -mfcca        - two * mfbca *  vx1         +  mfaca                   * (one - vx1Sq)              - c1o36 * oMdrho * vx1Sq;
-   m2 =  mfcca * c1o2 +      mfbca * (vx1 + c1o2) + (mfaca + c1o36 * oMdrho) * (vx1Sq + vx1) * c1o2;
-   mfaca = m0;
-   mfbca = m1;
-   mfcca = m2;
-   ////////////////////////////////////////////////////////////////////////////////////
-   ////////////////////////////////////////////////////////////////////////////////////
-   m0 =  mfcab * c1o2 +      mfbab * (vx1 - c1o2) + (mfaab + c1o9 * oMdrho) * (vx1Sq - vx1) * c1o2;
-   m1 = -mfcab        - two * mfbab *  vx1         +  mfaab                  * (one - vx1Sq)              - c1o9 * oMdrho * vx1Sq;
-   m2 =  mfcab * c1o2 +      mfbab * (vx1 + c1o2) + (mfaab + c1o9 * oMdrho) * (vx1Sq + vx1) * c1o2;
-   mfaab = m0;
-   mfbab = m1;
-   mfcab = m2;
-   ///////////b////////////////////////////////////////////////////////////////////////
-   m0 =  mfcbb * c1o2 +      mfbbb * (vx1 - c1o2) + (mfabb + c4o9 * oMdrho) * (vx1Sq - vx1) * c1o2;
-   m1 = -mfcbb        - two * mfbbb *  vx1         +  mfabb                  * (one - vx1Sq)              - c4o9 * oMdrho * vx1Sq;
-   m2 =  mfcbb * c1o2 +      mfbbb * (vx1 + c1o2) + (mfabb + c4o9 * oMdrho) * (vx1Sq + vx1) * c1o2;
-   mfabb = m0;
-   mfbbb = m1;
-   mfcbb = m2;
-   ///////////b////////////////////////////////////////////////////////////////////////
-   m0 =  mfccb * c1o2 +      mfbcb * (vx1 - c1o2) + (mfacb + c1o9 * oMdrho) * (vx1Sq - vx1) * c1o2;
-   m1 = -mfccb        - two * mfbcb *  vx1         +  mfacb                  * (one - vx1Sq)              - c1o9 * oMdrho * vx1Sq;
-   m2 =  mfccb * c1o2 +      mfbcb * (vx1 + c1o2) + (mfacb + c1o9 * oMdrho) * (vx1Sq + vx1) * c1o2;
-   mfacb = m0;
-   mfbcb = m1;
-   mfccb = m2;
-   ////////////////////////////////////////////////////////////////////////////////////
-   ////////////////////////////////////////////////////////////////////////////////////
-   m0 =  mfcac * c1o2 +      mfbac * (vx1 - c1o2) + (mfaac + c1o36 * oMdrho) * (vx1Sq - vx1) * c1o2;
-   m1 = -mfcac        - two * mfbac *  vx1         +  mfaac                   * (one - vx1Sq)              - c1o36 * oMdrho * vx1Sq;
-   m2 =  mfcac * c1o2 +      mfbac * (vx1 + c1o2) + (mfaac + c1o36 * oMdrho) * (vx1Sq + vx1) * c1o2;
-   mfaac = m0;
-   mfbac = m1;
-   mfcac = m2;
-   ///////////c////////////////////////////////////////////////////////////////////////
-   m0 =  mfcbc * c1o2 +      mfbbc * (vx1 - c1o2) + (mfabc + c1o9 * oMdrho) * (vx1Sq - vx1) * c1o2;
-   m1 = -mfcbc        - two * mfbbc *  vx1         +  mfabc                  * (one - vx1Sq)              - c1o9 * oMdrho * vx1Sq;
-   m2 =  mfcbc * c1o2 +      mfbbc * (vx1 + c1o2) + (mfabc + c1o9 * oMdrho) * (vx1Sq + vx1) * c1o2;
-   mfabc = m0;
-   mfbbc = m1;
-   mfcbc = m2;
-   ///////////c////////////////////////////////////////////////////////////////////////
-   m0 =  mfccc * c1o2 +      mfbcc * (vx1 - c1o2) + (mfacc + c1o36 * oMdrho) * (vx1Sq - vx1) * c1o2;
-   m1 = -mfccc        - two * mfbcc *  vx1         +  mfacc                   * (one - vx1Sq)              - c1o36 * oMdrho * vx1Sq;
-   m2 =  mfccc * c1o2 +      mfbcc * (vx1 + c1o2) + (mfacc + c1o36 * oMdrho) * (vx1Sq + vx1) * c1o2;
-   mfacc = m0;
-   mfbcc = m1;
-   mfccc = m2;
-   ////////////////////////////////////////////////////////////////////////////////////
-
-   f[E]    = mfcbb;
-   f[W]    = mfabb;
-   f[N]    = mfbcb;
-   f[S]    = mfbab;
-   f[T]    = mfbbc;
-   f[B]    = mfbba;
-   f[NE]   = mfccb;
-   f[SW]   = mfaab;
-   f[SE]   = mfcab;
-   f[NW]   = mfacb;
-   f[TE]   = mfcbc;
-   f[BW]   = mfaba;
-   f[BE]   = mfcba;
-   f[TW]   = mfabc;
-   f[TN]   = mfbcc;
-   f[BS]   = mfbaa;
-   f[BN]   = mfbca;
-   f[TS]   = mfbac;
-   f[ZERO] = mfbbb;
-   f[TNE]  = mfccc;
-   f[TSE]  = mfcac;
-   f[BNE]  = mfcca;
-   f[BSE]  = mfcaa;
-   f[TNW]  = mfacc;
-   f[TSW]  = mfaac;
-   f[BNW]  = mfaca;
-   f[BSW]  = mfaaa;
-}
-//////////////////////////////////////////////////////////////////////////
-//Position SWB -0.25, -0.25, -0.25
-LBMReal CompressibleOffsetMomentsInterpolationProcessor::calcPressBSW()
-{
-   return   press_SWT * (0.140625 + 0.1875 * xoff + 0.1875 * yoff - 0.5625 * zoff) +
-      press_NWT * (0.046875 + 0.0625 * xoff - 0.1875 * yoff - 0.1875 * zoff) +
-      press_SET * (0.046875 - 0.1875 * xoff + 0.0625 * yoff - 0.1875 * zoff) +
-      press_NET * (0.015625 - 0.0625 * xoff - 0.0625 * yoff - 0.0625 * zoff) +
-      press_NEB * (0.046875 - 0.1875 * xoff - 0.1875 * yoff + 0.0625 * zoff) +
-      press_NWB * (0.140625 + 0.1875 * xoff - 0.5625 * yoff + 0.1875 * zoff) +
-      press_SEB * (0.140625 - 0.5625 * xoff + 0.1875 * yoff + 0.1875 * zoff) +
-      press_SWB * (0.421875 + 0.5625 * xoff + 0.5625 * yoff + 0.5625 * zoff);
-}
-//////////////////////////////////////////////////////////////////////////
-//Position SWT -0.25, -0.25, 0.25
-LBMReal CompressibleOffsetMomentsInterpolationProcessor::calcPressTSW()
-{
-   return   press_SWT * (0.421875 + 0.5625 * xoff + 0.5625 * yoff - 0.5625 * zoff) +
-      press_NWT * (0.140625 + 0.1875 * xoff - 0.5625 * yoff - 0.1875 * zoff) +
-      press_SET * (0.140625 - 0.5625 * xoff + 0.1875 * yoff - 0.1875 * zoff) +
-      press_NET * (0.046875 - 0.1875 * xoff - 0.1875 * yoff - 0.0625 * zoff) +
-      press_NEB * (0.015625 - 0.0625 * xoff - 0.0625 * yoff + 0.0625 * zoff) +
-      press_NWB * (0.046875 + 0.0625 * xoff - 0.1875 * yoff + 0.1875 * zoff) +
-      press_SEB * (0.046875 - 0.1875 * xoff + 0.0625 * yoff + 0.1875 * zoff) +
-      press_SWB * (0.140625 + 0.1875 * xoff + 0.1875 * yoff + 0.5625 * zoff);
-}
-//////////////////////////////////////////////////////////////////////////
-//Position SET 0.25, -0.25, 0.25
-LBMReal CompressibleOffsetMomentsInterpolationProcessor::calcPressTSE()
-{
-   return   press_SET * (0.421875 - 0.5625 * xoff + 0.5625 * yoff - 0.5625 * zoff) +
-      press_NET * (0.140625 - 0.1875 * xoff - 0.5625 * yoff - 0.1875 * zoff) +
-      press_SWT * (0.140625 + 0.5625 * xoff + 0.1875 * yoff - 0.1875 * zoff) +
-      press_NWT * (0.046875 + 0.1875 * xoff - 0.1875 * yoff - 0.0625 * zoff) +
-      press_NWB * (0.015625 + 0.0625 * xoff - 0.0625 * yoff + 0.0625 * zoff) +
-      press_NEB * (0.046875 - 0.0625 * xoff - 0.1875 * yoff + 0.1875 * zoff) +
-      press_SWB * (0.046875 + 0.1875 * xoff + 0.0625 * yoff + 0.1875 * zoff) +
-      press_SEB * (0.140625 - 0.1875 * xoff + 0.1875 * yoff + 0.5625 * zoff);
-}
-//////////////////////////////////////////////////////////////////////////
-//Position SEB 0.25, -0.25, -0.25
-LBMReal CompressibleOffsetMomentsInterpolationProcessor::calcPressBSE()
-{
-   return   press_SET * (0.140625 - 0.1875 * xoff + 0.1875 * yoff - 0.5625 * zoff) +
-      press_NET * (0.046875 - 0.0625 * xoff - 0.1875 * yoff - 0.1875 * zoff) +
-      press_SWT * (0.046875 + 0.1875 * xoff + 0.0625 * yoff - 0.1875 * zoff) +
-      press_NWT * (0.015625 + 0.0625 * xoff - 0.0625 * yoff - 0.0625 * zoff) +
-      press_NWB * (0.046875 + 0.1875 * xoff - 0.1875 * yoff + 0.0625 * zoff) +
-      press_NEB * (0.140625 - 0.1875 * xoff - 0.5625 * yoff + 0.1875 * zoff) +
-      press_SWB * (0.140625 + 0.5625 * xoff + 0.1875 * yoff + 0.1875 * zoff) +
-      press_SEB * (0.421875 - 0.5625 * xoff + 0.5625 * yoff + 0.5625 * zoff);
-}
-//////////////////////////////////////////////////////////////////////////
-//Position NWB -0.25, 0.25, -0.25
-LBMReal CompressibleOffsetMomentsInterpolationProcessor::calcPressBNW()
-{
-   return   press_NWT * (0.140625 + 0.1875 * xoff - 0.1875 * yoff - 0.5625 * zoff) +
-      press_NET * (0.046875 - 0.1875 * xoff - 0.0625 * yoff - 0.1875 * zoff) +
-      press_SWT * (0.046875 + 0.0625 * xoff + 0.1875 * yoff - 0.1875 * zoff) +
-      press_SET * (0.015625 - 0.0625 * xoff + 0.0625 * yoff - 0.0625 * zoff) +
-      press_SEB * (0.046875 - 0.1875 * xoff + 0.1875 * yoff + 0.0625 * zoff) +
-      press_NEB * (0.140625 - 0.5625 * xoff - 0.1875 * yoff + 0.1875 * zoff) +
-      press_SWB * (0.140625 + 0.1875 * xoff + 0.5625 * yoff + 0.1875 * zoff) +
-      press_NWB * (0.421875 + 0.5625 * xoff - 0.5625 * yoff + 0.5625 * zoff);
-}
-//////////////////////////////////////////////////////////////////////////
-//Position NWT -0.25, 0.25, 0.25
-LBMReal CompressibleOffsetMomentsInterpolationProcessor::calcPressTNW()
-{
-   return   press_NWT * (0.421875 + 0.5625 * xoff - 0.5625 * yoff - 0.5625 * zoff) +
-      press_NET * (0.140625 - 0.5625 * xoff - 0.1875 * yoff - 0.1875 * zoff) +
-      press_SWT * (0.140625 + 0.1875 * xoff + 0.5625 * yoff - 0.1875 * zoff) +
-      press_SET * (0.046875 - 0.1875 * xoff + 0.1875 * yoff - 0.0625 * zoff) +
-      press_SEB * (0.015625 - 0.0625 * xoff + 0.0625 * yoff + 0.0625 * zoff) +
-      press_NEB * (0.046875 - 0.1875 * xoff - 0.0625 * yoff + 0.1875 * zoff) +
-      press_SWB * (0.046875 + 0.0625 * xoff + 0.1875 * yoff + 0.1875 * zoff) +
-      press_NWB * (0.140625 + 0.1875 * xoff - 0.1875 * yoff + 0.5625 * zoff);
-}
-//////////////////////////////////////////////////////////////////////////
-//Position NET 0.25, 0.25, 0.25
-LBMReal CompressibleOffsetMomentsInterpolationProcessor::calcPressTNE()
-{
-   return   press_NET * (0.421875 - 0.5625 * xoff - 0.5625 * yoff - 0.5625 * zoff) +
-      press_NWT * (0.140625 + 0.5625 * xoff - 0.1875 * yoff - 0.1875 * zoff) +
-      press_SET * (0.140625 - 0.1875 * xoff + 0.5625 * yoff - 0.1875 * zoff) +
-      press_SWT * (0.046875 + 0.1875 * xoff + 0.1875 * yoff - 0.0625 * zoff) +
-      press_SWB * (0.015625 + 0.0625 * xoff + 0.0625 * yoff + 0.0625 * zoff) +
-      press_NWB * (0.046875 + 0.1875 * xoff - 0.0625 * yoff + 0.1875 * zoff) +
-      press_SEB * (0.046875 - 0.0625 * xoff + 0.1875 * yoff + 0.1875 * zoff) +
-      press_NEB * (0.140625 - 0.1875 * xoff - 0.1875 * yoff + 0.5625 * zoff);
-}
-//////////////////////////////////////////////////////////////////////////
-//Position NEB 0.25, 0.25, -0.25
-LBMReal CompressibleOffsetMomentsInterpolationProcessor::calcPressBNE()
-{
-   return   press_NET * (0.140625 - 0.1875 * xoff - 0.1875 * yoff - 0.5625 * zoff) +
-      press_NWT * (0.046875 + 0.1875 * xoff - 0.0625 * yoff - 0.1875 * zoff) +
-      press_SET * (0.046875 - 0.0625 * xoff + 0.1875 * yoff - 0.1875 * zoff) +
-      press_SWT * (0.015625 + 0.0625 * xoff + 0.0625 * yoff - 0.0625 * zoff) +
-      press_SWB * (0.046875 + 0.1875 * xoff + 0.1875 * yoff + 0.0625 * zoff) +
-      press_NWB * (0.140625 + 0.5625 * xoff - 0.1875 * yoff + 0.1875 * zoff) +
-      press_SEB * (0.140625 - 0.1875 * xoff + 0.5625 * yoff + 0.1875 * zoff) +
-      press_NEB * (0.421875 - 0.5625 * xoff - 0.5625 * yoff + 0.5625 * zoff);
-}
-//////////////////////////////////////////////////////////////////////////
-//Position C 0.0, 0.0, 0.0
-void CompressibleOffsetMomentsInterpolationProcessor::calcInterpolatedNodeFC(LBMReal* f, LBMReal omega)
-{
-   using namespace D3Q27System;
-
-   LBMReal press  =  press_NET * (0.125 - 0.25 * xoff - 0.25 * yoff - 0.25 * zoff) +
-      press_NWT * (0.125 + 0.25 * xoff - 0.25 * yoff - 0.25 * zoff) +
-      press_SET * (0.125 - 0.25 * xoff + 0.25 * yoff - 0.25 * zoff) +
-      press_SWT * (0.125 + 0.25 * xoff + 0.25 * yoff - 0.25 * zoff) +
-      press_NEB * (0.125 - 0.25 * xoff - 0.25 * yoff + 0.25 * zoff) +
-      press_NWB * (0.125 + 0.25 * xoff - 0.25 * yoff + 0.25 * zoff) +
-      press_SEB * (0.125 - 0.25 * xoff + 0.25 * yoff + 0.25 * zoff) +
-      press_SWB * (0.125 + 0.25 * xoff + 0.25 * yoff + 0.25 * zoff);
-   LBMReal vx1  = a0;
-   LBMReal vx2  = b0;
-   LBMReal vx3  = c0;
-
-   LBMReal rho = press ;//+ (ax+by+cz)/3.;
-
-   LBMReal eps_new = 2.;
-   LBMReal o  = omega;
-   //bulk viscosity
-   LBMReal oP = OxxPyyPzzC;
-
-   LBMReal mfcbb = zeroReal;
-   LBMReal mfabb = zeroReal;
-   LBMReal mfbcb = zeroReal;
-   LBMReal mfbab = zeroReal;
-   LBMReal mfbbc = zeroReal;
-   LBMReal mfbba = zeroReal;
-   LBMReal mfccb = zeroReal;
-   LBMReal mfaab = zeroReal;
-   LBMReal mfcab = zeroReal;
-   LBMReal mfacb = zeroReal;
-   LBMReal mfcbc = zeroReal;
-   LBMReal mfaba = zeroReal;
-   LBMReal mfcba = zeroReal;
-   LBMReal mfabc = zeroReal;
-   LBMReal mfbcc = zeroReal;
-   LBMReal mfbaa = zeroReal;
-   LBMReal mfbca = zeroReal;
-   LBMReal mfbac = zeroReal;
-   LBMReal mfbbb = zeroReal;
-   LBMReal mfccc = zeroReal;
-   LBMReal mfaac = zeroReal;
-   LBMReal mfcac = zeroReal;
-   LBMReal mfacc = zeroReal;
-   LBMReal mfcca = zeroReal;
-   LBMReal mfaaa = zeroReal;
-   LBMReal mfcaa = zeroReal;
-   LBMReal mfaca = zeroReal;
-
-   mfaaa = press; // if drho is interpolated directly
-
-   LBMReal vx1Sq = vx1*vx1;
-   LBMReal vx2Sq = vx2*vx2;
-   LBMReal vx3Sq = vx3*vx3;
-   LBMReal oMdrho = one;
-   //oMdrho = one - mfaaa;
-
-   //2.f
-   // linear combinations
-
-/////////////////////////
-   LBMReal mxxPyyPzz = mfaaa    -c2o3*(ax+by+cz)*eps_new/oP*(one+press);
-
-   LBMReal mxxMyy    = -c2o3*((ax - by)+kxxMyyAverage)*eps_new/o * (one + press);
-   LBMReal mxxMzz    = -c2o3*((ax - cz)+kxxMzzAverage)*eps_new/o * (one + press);
-
-   mfabb     = -c1o3 * ((bz + cy)+kyzAverage)*eps_new/o * (one + press);
-   mfbab     = -c1o3 * ((az + cx)+kxzAverage)*eps_new/o * (one + press);
-   mfbba     = -c1o3 * ((ay + bx)+kxyAverage)*eps_new/o * (one + press);
-
-   ////////////////////////
-   // linear combinations back
-   mfcaa = c1o3 * (mxxMyy +       mxxMzz + mxxPyyPzz);
-   mfaca = c1o3 * (-two * mxxMyy +       mxxMzz + mxxPyyPzz);
-   mfaac = c1o3 * (mxxMyy - two * mxxMzz + mxxPyyPzz);
-
-   //three
-   mfbbb = zeroReal;
-
-   LBMReal mxxyPyzz = zeroReal;
-   LBMReal mxxyMyzz = zeroReal;
-   LBMReal mxxzPyyz = zeroReal;
-   LBMReal mxxzMyyz = zeroReal;
-   LBMReal mxyyPxzz =  zeroReal;
-   LBMReal mxyyMxzz = zeroReal;
-
-   // linear combinations back
-   mfcba = (mxxyMyzz + mxxyPyzz) * c1o2;
-   mfabc = (-mxxyMyzz + mxxyPyzz) * c1o2;
-   mfcab = (mxxzMyyz + mxxzPyyz) * c1o2;
-   mfacb = (-mxxzMyyz + mxxzPyyz) * c1o2;
-   mfbca = (mxyyMxzz + mxyyPxzz) * c1o2;
-   mfbac = (-mxyyMxzz + mxyyPxzz) * c1o2;
-
-   //4.f
-   mfacc = mfaaa*c1o9;
-   mfcac = mfacc;
-   mfcca = mfacc;
-   //5.
-
-   //6.
-   mfccc = mfaaa*c1o27;
-   ////////////////////////////////////////////////////////////////////////////////////
-   //back
-   ////////////////////////////////////////////////////////////////////////////////////
-   //mit 1, 0, 1/3, 0, 0, 0, 1/3, 0, 1/9   Konditionieren
-   ////////////////////////////////////////////////////////////////////////////////////
-   // Z - Dir
-   LBMReal m0 =  mfaac * c1o2 +      mfaab * (vx3 - c1o2) + (mfaaa + one * oMdrho) * (vx3Sq - vx3) * c1o2;
-   LBMReal m1 = -mfaac        - two * mfaab *  vx3         +  mfaaa                * (one - vx3Sq)              - one * oMdrho * vx3Sq;
-   LBMReal m2 =  mfaac * c1o2 +      mfaab * (vx3 + c1o2) + (mfaaa + one * oMdrho) * (vx3Sq + vx3) * c1o2;
-   mfaaa = m0;
-   mfaab = m1;
-   mfaac = m2;
-   ////////////////////////////////////////////////////////////////////////////////////
-   m0 =  mfabc * c1o2 +      mfabb * (vx3 - c1o2) + mfaba * (vx3Sq - vx3) * c1o2;
-   m1 = -mfabc        - two * mfabb *  vx3         + mfaba * (one - vx3Sq);
-   m2 =  mfabc * c1o2 +      mfabb * (vx3 + c1o2) + mfaba * (vx3Sq + vx3) * c1o2;
-   mfaba = m0;
-   mfabb = m1;
-   mfabc = m2;
-   ////////////////////////////////////////////////////////////////////////////////////
-   m0 =  mfacc * c1o2 +      mfacb * (vx3 - c1o2) + (mfaca + c1o3 * oMdrho) * (vx3Sq - vx3) * c1o2;
-   m1 = -mfacc        - two * mfacb *  vx3         +  mfaca                  * (one - vx3Sq)              - c1o3 * oMdrho * vx3Sq;
-   m2 =  mfacc * c1o2 +      mfacb * (vx3 + c1o2) + (mfaca + c1o3 * oMdrho) * (vx3Sq + vx3) * c1o2;
-   mfaca = m0;
-   mfacb = m1;
-   mfacc = m2;
-   ////////////////////////////////////////////////////////////////////////////////////
-   ////////////////////////////////////////////////////////////////////////////////////
-   m0 =  mfbac * c1o2 +      mfbab * (vx3 - c1o2) + mfbaa * (vx3Sq - vx3) * c1o2;
-   m1 = -mfbac        - two * mfbab *  vx3         + mfbaa * (one - vx3Sq);
-   m2 =  mfbac * c1o2 +      mfbab * (vx3 + c1o2) + mfbaa * (vx3Sq + vx3) * c1o2;
-   mfbaa = m0;
-   mfbab = m1;
-   mfbac = m2;
-   /////////b//////////////////////////////////////////////////////////////////////////
-   m0 =  mfbbc * c1o2 +      mfbbb * (vx3 - c1o2) + mfbba * (vx3Sq - vx3) * c1o2;
-   m1 = -mfbbc        - two * mfbbb *  vx3         + mfbba * (one - vx3Sq);
-   m2 =  mfbbc * c1o2 +      mfbbb * (vx3 + c1o2) + mfbba * (vx3Sq + vx3) * c1o2;
-   mfbba = m0;
-   mfbbb = m1;
-   mfbbc = m2;
-   /////////b//////////////////////////////////////////////////////////////////////////
-   m0 =  mfbcc * c1o2 +      mfbcb * (vx3 - c1o2) + mfbca * (vx3Sq - vx3) * c1o2;
-   m1 = -mfbcc        - two * mfbcb *  vx3         + mfbca * (one - vx3Sq);
-   m2 =  mfbcc * c1o2 +      mfbcb * (vx3 + c1o2) + mfbca * (vx3Sq + vx3) * c1o2;
-   mfbca = m0;
-   mfbcb = m1;
-   mfbcc = m2;
-   ////////////////////////////////////////////////////////////////////////////////////
-   ////////////////////////////////////////////////////////////////////////////////////
-   m0 =  mfcac * c1o2 +      mfcab * (vx3 - c1o2) + (mfcaa + c1o3 * oMdrho) * (vx3Sq - vx3) * c1o2;
-   m1 = -mfcac        - two * mfcab *  vx3         +  mfcaa                  * (one - vx3Sq)              - c1o3 * oMdrho * vx3Sq;
-   m2 =  mfcac * c1o2 +      mfcab * (vx3 + c1o2) + (mfcaa + c1o3 * oMdrho) * (vx3Sq + vx3) * c1o2;
-   mfcaa = m0;
-   mfcab = m1;
-   mfcac = m2;
-   /////////c//////////////////////////////////////////////////////////////////////////
-   m0 =  mfcbc * c1o2 +      mfcbb * (vx3 - c1o2) + mfcba * (vx3Sq - vx3) * c1o2;
-   m1 = -mfcbc        - two * mfcbb *  vx3         + mfcba * (one - vx3Sq);
-   m2 =  mfcbc * c1o2 +      mfcbb * (vx3 + c1o2) + mfcba * (vx3Sq + vx3) * c1o2;
-   mfcba = m0;
-   mfcbb = m1;
-   mfcbc = m2;
-   /////////c//////////////////////////////////////////////////////////////////////////
-   m0 =  mfccc * c1o2 +      mfccb * (vx3 - c1o2) + (mfcca + c1o9 * oMdrho) * (vx3Sq - vx3) * c1o2;
-   m1 = -mfccc        - two * mfccb *  vx3         +  mfcca                  * (one - vx3Sq)              - c1o9 * oMdrho * vx3Sq;
-   m2 =  mfccc * c1o2 +      mfccb * (vx3 + c1o2) + (mfcca + c1o9 * oMdrho) * (vx3Sq + vx3) * c1o2;
-   mfcca = m0;
-   mfccb = m1;
-   mfccc = m2;
-   ////////////////////////////////////////////////////////////////////////////////////
-   ////////////////////////////////////////////////////////////////////////////////////
-   //mit 1/6, 2/3, 1/6, 0, 0, 0, 1/18, 2/9, 1/18   Konditionieren
-   ////////////////////////////////////////////////////////////////////////////////////
-   // Y - Dir
-   m0 =  mfaca * c1o2 +      mfaba * (vx2 - c1o2) + (mfaaa + c1o6 * oMdrho) * (vx2Sq - vx2) * c1o2;
-   m1 = -mfaca        - two * mfaba *  vx2         +  mfaaa                  * (one - vx2Sq)              - c1o6 * oMdrho * vx2Sq;
-   m2 =  mfaca * c1o2 +      mfaba * (vx2 + c1o2) + (mfaaa + c1o6 * oMdrho) * (vx2Sq + vx2) * c1o2;
-   mfaaa = m0;
-   mfaba = m1;
-   mfaca = m2;
-   ////////////////////////////////////////////////////////////////////////////////////
-   m0 =  mfacb * c1o2 +      mfabb * (vx2 - c1o2) + (mfaab + c2o3 * oMdrho) * (vx2Sq - vx2) * c1o2;
-   m1 = -mfacb        - two * mfabb *  vx2         +  mfaab                  * (one - vx2Sq)              - c2o3 * oMdrho * vx2Sq;
-   m2 =  mfacb * c1o2 +      mfabb * (vx2 + c1o2) + (mfaab + c2o3 * oMdrho) * (vx2Sq + vx2) * c1o2;
-   mfaab = m0;
-   mfabb = m1;
-   mfacb = m2;
-   ////////////////////////////////////////////////////////////////////////////////////
-   m0 =  mfacc * c1o2 +      mfabc * (vx2 - c1o2) + (mfaac + c1o6 * oMdrho) * (vx2Sq - vx2) * c1o2;
-   m1 = -mfacc        - two * mfabc *  vx2         +  mfaac                  * (one - vx2Sq)              - c1o6 * oMdrho * vx2Sq;
-   m2 =  mfacc * c1o2 +      mfabc * (vx2 + c1o2) + (mfaac + c1o6 * oMdrho) * (vx2Sq + vx2) * c1o2;
-   mfaac = m0;
-   mfabc = m1;
-   mfacc = m2;
-   ////////////////////////////////////////////////////////////////////////////////////
-   ////////////////////////////////////////////////////////////////////////////////////
-   m0 =  mfbca * c1o2 +      mfbba * (vx2 - c1o2) + mfbaa * (vx2Sq - vx2) * c1o2;
-   m1 = -mfbca        - two * mfbba *  vx2         + mfbaa * (one - vx2Sq);
-   m2 =  mfbca * c1o2 +      mfbba * (vx2 + c1o2) + mfbaa * (vx2Sq + vx2) * c1o2;
-   mfbaa = m0;
-   mfbba = m1;
-   mfbca = m2;
-   /////////b//////////////////////////////////////////////////////////////////////////
-   m0 =  mfbcb * c1o2 +      mfbbb * (vx2 - c1o2) + mfbab * (vx2Sq - vx2) * c1o2;
-   m1 = -mfbcb        - two * mfbbb *  vx2         + mfbab * (one - vx2Sq);
-   m2 =  mfbcb * c1o2 +      mfbbb * (vx2 + c1o2) + mfbab * (vx2Sq + vx2) * c1o2;
-   mfbab = m0;
-   mfbbb = m1;
-   mfbcb = m2;
-   /////////b//////////////////////////////////////////////////////////////////////////
-   m0 =  mfbcc * c1o2 +      mfbbc * (vx2 - c1o2) + mfbac * (vx2Sq - vx2) * c1o2;
-   m1 = -mfbcc        - two * mfbbc *  vx2         + mfbac * (one - vx2Sq);
-   m2 =  mfbcc * c1o2 +      mfbbc * (vx2 + c1o2) + mfbac * (vx2Sq + vx2) * c1o2;
-   mfbac = m0;
-   mfbbc = m1;
-   mfbcc = m2;
-   ////////////////////////////////////////////////////////////////////////////////////
-   ////////////////////////////////////////////////////////////////////////////////////
-   m0 =  mfcca * c1o2 +      mfcba * (vx2 - c1o2) + (mfcaa + c1o18 * oMdrho) * (vx2Sq - vx2) * c1o2;
-   m1 = -mfcca        - two * mfcba *  vx2         +  mfcaa                   * (one - vx2Sq)              - c1o18 * oMdrho * vx2Sq;
-   m2 =  mfcca * c1o2 +      mfcba * (vx2 + c1o2) + (mfcaa + c1o18 * oMdrho) * (vx2Sq + vx2) * c1o2;
-   mfcaa = m0;
-   mfcba = m1;
-   mfcca = m2;
-   /////////c//////////////////////////////////////////////////////////////////////////
-   m0 =  mfccb * c1o2 +      mfcbb * (vx2 - c1o2) + (mfcab + c2o9 * oMdrho) * (vx2Sq - vx2) * c1o2;
-   m1 = -mfccb        - two * mfcbb *  vx2         +  mfcab                  * (one - vx2Sq)              - c2o9 * oMdrho * vx2Sq;
-   m2 =  mfccb * c1o2 +      mfcbb * (vx2 + c1o2) + (mfcab + c2o9 * oMdrho) * (vx2Sq + vx2) * c1o2;
-   mfcab = m0;
-   mfcbb = m1;
-   mfccb = m2;
-   /////////c//////////////////////////////////////////////////////////////////////////
-   m0 =  mfccc * c1o2 +      mfcbc * (vx2 - c1o2) + (mfcac + c1o18 * oMdrho) * (vx2Sq - vx2) * c1o2;
-   m1 = -mfccc        - two * mfcbc *  vx2         +  mfcac                   * (one - vx2Sq)              - c1o18 * oMdrho * vx2Sq;
-   m2 =  mfccc * c1o2 +      mfcbc * (vx2 + c1o2) + (mfcac + c1o18 * oMdrho) * (vx2Sq + vx2) * c1o2;
-   mfcac = m0;
-   mfcbc = m1;
-   mfccc = m2;
-   ////////////////////////////////////////////////////////////////////////////////////
-   ////////////////////////////////////////////////////////////////////////////////////
-   //mit 1/36, 1/9, 1/36, 1/9, 4/9, 1/9, 1/36, 1/9, 1/36 Konditionieren
-   ////////////////////////////////////////////////////////////////////////////////////
-   // X - Dir
-   m0 =  mfcaa * c1o2 +      mfbaa * (vx1 - c1o2) + (mfaaa + c1o36 * oMdrho) * (vx1Sq - vx1) * c1o2;
-   m1 = -mfcaa        - two * mfbaa *  vx1         +  mfaaa                   * (one - vx1Sq)              - c1o36 * oMdrho * vx1Sq;
-   m2 =  mfcaa * c1o2 +      mfbaa * (vx1 + c1o2) + (mfaaa + c1o36 * oMdrho) * (vx1Sq + vx1) * c1o2;
-   mfaaa = m0;
-   mfbaa = m1;
-   mfcaa = m2;
-   ////////////////////////////////////////////////////////////////////////////////////
-   m0 =  mfcba * c1o2 +      mfbba * (vx1 - c1o2) + (mfaba + c1o9 * oMdrho) * (vx1Sq - vx1) * c1o2;
-   m1 = -mfcba        - two * mfbba *  vx1         +  mfaba                  * (one - vx1Sq)              - c1o9 * oMdrho * vx1Sq;
-   m2 =  mfcba * c1o2 +      mfbba * (vx1 + c1o2) + (mfaba + c1o9 * oMdrho) * (vx1Sq + vx1) * c1o2;
-   mfaba = m0;
-   mfbba = m1;
-   mfcba = m2;
-   ////////////////////////////////////////////////////////////////////////////////////
-   m0 =  mfcca * c1o2 +      mfbca * (vx1 - c1o2) + (mfaca + c1o36 * oMdrho) * (vx1Sq - vx1) * c1o2;
-   m1 = -mfcca        - two * mfbca *  vx1         +  mfaca                   * (one - vx1Sq)              - c1o36 * oMdrho * vx1Sq;
-   m2 =  mfcca * c1o2 +      mfbca * (vx1 + c1o2) + (mfaca + c1o36 * oMdrho) * (vx1Sq + vx1) * c1o2;
-   mfaca = m0;
-   mfbca = m1;
-   mfcca = m2;
-   ////////////////////////////////////////////////////////////////////////////////////
-   ////////////////////////////////////////////////////////////////////////////////////
-   m0 =  mfcab * c1o2 +      mfbab * (vx1 - c1o2) + (mfaab + c1o9 * oMdrho) * (vx1Sq - vx1) * c1o2;
-   m1 = -mfcab        - two * mfbab *  vx1         +  mfaab                  * (one - vx1Sq)              - c1o9 * oMdrho * vx1Sq;
-   m2 =  mfcab * c1o2 +      mfbab * (vx1 + c1o2) + (mfaab + c1o9 * oMdrho) * (vx1Sq + vx1) * c1o2;
-   mfaab = m0;
-   mfbab = m1;
-   mfcab = m2;
-   ///////////b////////////////////////////////////////////////////////////////////////
-   m0 =  mfcbb * c1o2 +      mfbbb * (vx1 - c1o2) + (mfabb + c4o9 * oMdrho) * (vx1Sq - vx1) * c1o2;
-   m1 = -mfcbb        - two * mfbbb *  vx1         +  mfabb                  * (one - vx1Sq)              - c4o9 * oMdrho * vx1Sq;
-   m2 =  mfcbb * c1o2 +      mfbbb * (vx1 + c1o2) + (mfabb + c4o9 * oMdrho) * (vx1Sq + vx1) * c1o2;
-   mfabb = m0;
-   mfbbb = m1;
-   mfcbb = m2;
-   ///////////b////////////////////////////////////////////////////////////////////////
-   m0 =  mfccb * c1o2 +      mfbcb * (vx1 - c1o2) + (mfacb + c1o9 * oMdrho) * (vx1Sq - vx1) * c1o2;
-   m1 = -mfccb        - two * mfbcb *  vx1         +  mfacb                  * (one - vx1Sq)              - c1o9 * oMdrho * vx1Sq;
-   m2 =  mfccb * c1o2 +      mfbcb * (vx1 + c1o2) + (mfacb + c1o9 * oMdrho) * (vx1Sq + vx1) * c1o2;
-   mfacb = m0;
-   mfbcb = m1;
-   mfccb = m2;
-   ////////////////////////////////////////////////////////////////////////////////////
-   ////////////////////////////////////////////////////////////////////////////////////
-   m0 =  mfcac * c1o2 +      mfbac * (vx1 - c1o2) + (mfaac + c1o36 * oMdrho) * (vx1Sq - vx1) * c1o2;
-   m1 = -mfcac        - two * mfbac *  vx1         +  mfaac                   * (one - vx1Sq)              - c1o36 * oMdrho * vx1Sq;
-   m2 =  mfcac * c1o2 +      mfbac * (vx1 + c1o2) + (mfaac + c1o36 * oMdrho) * (vx1Sq + vx1) * c1o2;
-   mfaac = m0;
-   mfbac = m1;
-   mfcac = m2;
-   ///////////c////////////////////////////////////////////////////////////////////////
-   m0 =  mfcbc * c1o2 +      mfbbc * (vx1 - c1o2) + (mfabc + c1o9 * oMdrho) * (vx1Sq - vx1) * c1o2;
-   m1 = -mfcbc        - two * mfbbc *  vx1         +  mfabc                  * (one - vx1Sq)              - c1o9 * oMdrho * vx1Sq;
-   m2 =  mfcbc * c1o2 +      mfbbc * (vx1 + c1o2) + (mfabc + c1o9 * oMdrho) * (vx1Sq + vx1) * c1o2;
-   mfabc = m0;
-   mfbbc = m1;
-   mfcbc = m2;
-   ///////////c////////////////////////////////////////////////////////////////////////
-   m0 =  mfccc * c1o2 +      mfbcc * (vx1 - c1o2) + (mfacc + c1o36 * oMdrho) * (vx1Sq - vx1) * c1o2;
-   m1 = -mfccc        - two * mfbcc *  vx1         +  mfacc                   * (one - vx1Sq)              - c1o36 * oMdrho * vx1Sq;
-   m2 =  mfccc * c1o2 +      mfbcc * (vx1 + c1o2) + (mfacc + c1o36 * oMdrho) * (vx1Sq + vx1) * c1o2;
-   mfacc = m0;
-   mfbcc = m1;
-   mfccc = m2;
-   ////////////////////////////////////////////////////////////////////////////////////
-
-   f[E]    = mfcbb;
-   f[W]    = mfabb;
-   f[N]    = mfbcb;
-   f[S]    = mfbab;
-   f[T]    = mfbbc;
-   f[B]    = mfbba;
-   f[NE]   = mfccb;
-   f[SW]   = mfaab;
-   f[SE]   = mfcab;
-   f[NW]   = mfacb;
-   f[TE]   = mfcbc;
-   f[BW]   = mfaba;
-   f[BE]   = mfcba;
-   f[TW]   = mfabc;
-   f[TN]   = mfbcc;
-   f[BS]   = mfbaa;
-   f[BN]   = mfbca;
-   f[TS]   = mfbac;
-   f[ZERO] = mfbbb;
-   f[TNE]  = mfccc;
-   f[TSE]  = mfcac;
-   f[BNE]  = mfcca;
-   f[BSE]  = mfcaa;
-   f[TNW]  = mfacc;
-   f[TSW]  = mfaac;
-   f[BNW]  = mfaca;
-   f[BSW]  = mfaaa;
-}
-//////////////////////////////////////////////////////////////////////////
-void CompressibleOffsetMomentsInterpolationProcessor::calcInterpolatedVelocity(LBMReal x, LBMReal y, LBMReal z, LBMReal& vx1, LBMReal& vx2, LBMReal& vx3)
-{
-	vx1  = a0 + ax*x + ay*y + az*z + axx*x*x + ayy*y*y + azz*z*z + axy*x*y + axz*x*z + ayz*y*z+axyz*x*y*z;
-	vx2  = b0 + bx*x + by*y + bz*z + bxx*x*x + byy*y*y + bzz*z*z + bxy*x*y + bxz*x*z + byz*y*z+bxyz*x*y*z;
-	vx3  = c0 + cx*x + cy*y + cz*z + cxx*x*x + cyy*y*y + czz*z*z + cxy*x*y + cxz*x*z + cyz*y*z+cxyz*x*y*z;
-}
-//////////////////////////////////////////////////////////////////////////
-void CompressibleOffsetMomentsInterpolationProcessor::calcInterpolatedShearStress(LBMReal x, LBMReal y, LBMReal z,LBMReal& tauxx, LBMReal& tauyy, LBMReal& tauzz,LBMReal& tauxy, LBMReal& tauxz, LBMReal& tauyz)
-{
-	tauxx=ax+2*axx*x+axy*y+axz*z+axyz*y*z;
-	tauyy=by+2*byy*y+bxy*x+byz*z+bxyz*x*z;
-	tauzz=cz+2*czz*z+cxz*x+cyz*y+cxyz*x*y;
-	tauxy=0.5*((ay+2.0*ayy*y+axy*x+ayz*z+axyz*x*z)+(bx+2.0*bxx*x+bxy*y+bxz*z+bxyz*y*z));
-	tauxz=0.5*((az+2.0*azz*z+axz*x+ayz*y+axyz*x*y)+(cx+2.0*cxx*x+cxy*y+cxz*z+cxyz*y*z));
-	tauyz=0.5*((bz+2.0*bzz*z+bxz*x+byz*y+bxyz*x*y)+(cy+2.0*cyy*y+cxy*x+cyz*z+cxyz*x*z));
-}
-//////////////////////////////////////////////////////////////////////////
-void CompressibleOffsetMomentsInterpolationProcessor::setBulkViscosity(LBMReal shearViscosity, LBMReal bulkViscosity)
-{
-   this->shearViscosity = shearViscosity;
-   this->bulkViscosity  = bulkViscosity;
-}
-
+#include "CompressibleOffsetMomentsInterpolationProcessor.h"
+#include "D3Q27System.h"
+
+using namespace UbMath;
+
+CompressibleOffsetMomentsInterpolationProcessor::CompressibleOffsetMomentsInterpolationProcessor()
+   : omegaC(0.0), omegaF(0.0)
+{
+   this->bulkViscosity = 0.0;
+   this->shearViscosity = 0.0;
+   this->OxxPyyPzzC = one;
+   this->OxxPyyPzzF = one;
+}
+//////////////////////////////////////////////////////////////////////////
+CompressibleOffsetMomentsInterpolationProcessor::CompressibleOffsetMomentsInterpolationProcessor(LBMReal omegaC, LBMReal omegaF)
+   : omegaC(omegaC), omegaF(omegaF)
+{
+   this->bulkViscosity = 0.0;
+   this->shearViscosity = 0.0;
+   this->OxxPyyPzzC = one;
+   this->OxxPyyPzzF = one;
+}
+//////////////////////////////////////////////////////////////////////////
+CompressibleOffsetMomentsInterpolationProcessor::~CompressibleOffsetMomentsInterpolationProcessor()
+{
+
+}
+//////////////////////////////////////////////////////////////////////////
+InterpolationProcessorPtr CompressibleOffsetMomentsInterpolationProcessor::clone()
+{
+   InterpolationProcessorPtr iproc = InterpolationProcessorPtr (new CompressibleOffsetMomentsInterpolationProcessor(this->omegaC, this->omegaF));
+
+   dynamicPointerCast<CompressibleOffsetMomentsInterpolationProcessor>(iproc)->OxxPyyPzzC = this->OxxPyyPzzC;
+   dynamicPointerCast<CompressibleOffsetMomentsInterpolationProcessor>(iproc)->OxxPyyPzzF = this->OxxPyyPzzF;
+
+   return iproc;
+}
+//////////////////////////////////////////////////////////////////////////
+void CompressibleOffsetMomentsInterpolationProcessor::setOmegas( LBMReal omegaC, LBMReal omegaF )
+{
+   this->omegaC = omegaC;
+   this->omegaF = omegaF;
+
+   LBMReal dtC = (3.0*shearViscosity)/((1/omegaC)-0.5);
+   LBMReal dtF = (3.0*shearViscosity)/((1/omegaF)-0.5);
+
+   if (bulkViscosity != 0)
+   {
+      this->OxxPyyPzzC = LBMSystem::calcOmega2(bulkViscosity, dtC);
+      this->OxxPyyPzzF = LBMSystem::calcOmega2(bulkViscosity, dtF);
+   }
+   else
+   {
+      this->OxxPyyPzzC = one;
+      this->OxxPyyPzzF = one;
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+void CompressibleOffsetMomentsInterpolationProcessor::setOffsets(LBMReal xoff, LBMReal yoff, LBMReal zoff)
+{
+   this->xoff = xoff;
+   this->yoff = yoff;
+   this->zoff = zoff;     
+   this->xoff_sq = xoff * xoff;
+   this->yoff_sq = yoff * yoff;
+   this->zoff_sq = zoff * zoff;
+}
+//////////////////////////////////////////////////////////////////////////
+void CompressibleOffsetMomentsInterpolationProcessor::interpolateCoarseToFine(D3Q27ICell& icellC, D3Q27ICell& icellF, LBMReal xoff, LBMReal yoff, LBMReal zoff)
+{
+   setOffsets(xoff, yoff, zoff);
+   calcInterpolatedCoefficiets(icellC, omegaC, 0.5);
+   calcInterpolatedNodeCF(icellF.BSW, omegaF, -0.25, -0.25, -0.25, calcPressBSW(), -1, -1, -1);
+   calcInterpolatedNodeCF(icellF.BNE, omegaF,  0.25,  0.25, -0.25, calcPressBNE(),  1,  1, -1);
+   calcInterpolatedNodeCF(icellF.TNW, omegaF, -0.25,  0.25,  0.25, calcPressTNW(), -1,  1,  1);
+   calcInterpolatedNodeCF(icellF.TSE, omegaF,  0.25, -0.25,  0.25, calcPressTSE(),  1, -1,  1);
+   calcInterpolatedNodeCF(icellF.BNW, omegaF, -0.25,  0.25, -0.25, calcPressBNW(), -1,  1, -1);
+   calcInterpolatedNodeCF(icellF.BSE, omegaF,  0.25, -0.25, -0.25, calcPressBSE(),  1, -1, -1);
+   calcInterpolatedNodeCF(icellF.TSW, omegaF, -0.25, -0.25,  0.25, calcPressTSW(), -1, -1,  1);
+   calcInterpolatedNodeCF(icellF.TNE, omegaF,  0.25,  0.25,  0.25, calcPressTNE(),  1,  1,  1);
+}
+//////////////////////////////////////////////////////////////////////////
+void CompressibleOffsetMomentsInterpolationProcessor::interpolateFineToCoarse(D3Q27ICell& icellF, LBMReal* icellC, LBMReal xoff, LBMReal yoff, LBMReal zoff)
+{
+   setOffsets(xoff, yoff, zoff);
+   calcInterpolatedCoefficiets(icellF, omegaF, 2.0);
+   calcInterpolatedNodeFC(icellC, omegaC);
+}
+//////////////////////////////////////////////////////////////////////////
+void CompressibleOffsetMomentsInterpolationProcessor::calcMoments(const LBMReal* const f, LBMReal omega, LBMReal& press, LBMReal& vx1, LBMReal& vx2, LBMReal& vx3, 
+                                                    LBMReal& kxy, LBMReal& kyz, LBMReal& kxz, LBMReal& kxxMyy, LBMReal& kxxMzz)
+{
+   using namespace D3Q27System;
+
+   LBMReal drho = 0.0;
+   D3Q27System::calcCompMacroscopicValues(f,drho,vx1,vx2,vx3);
+   
+   press = drho; //interpolate rho!
+
+   kxy   = -3.*omega*((((f[TSW]+f[BNE])-(f[TNW]+f[BSE]))+((f[BSW]+f[TNE])-(f[BNW]+f[TSE])))+((f[SW]+f[NE])-(f[NW]+f[SE]))/(one + drho)-(vx1*vx2));// might not be optimal MG 25.2.13
+   kyz   = -3.*omega*((((f[BSW]+f[TNE])-(f[TSE]+f[BNW]))+((f[BSE]+f[TNW])-(f[TSW]+f[BNE])))+((f[BS]+f[TN])-(f[TS]+f[BN]))/(one + drho)-(vx2*vx3));
+   kxz   = -3.*omega*((((f[BNW]+f[TSE])-(f[TSW]+f[BNE]))+((f[BSW]+f[TNE])-(f[BSE]+f[TNW])))+((f[BW]+f[TE])-(f[TW]+f[BE]))/(one + drho)-(vx1*vx3));
+   kxxMyy = -3./2.*omega*((((f[BW]+f[TE])-(f[BS]+f[TN]))+((f[TW]+f[BE])-(f[TS]+f[BN])))+((f[W]+f[E])-(f[S]+f[N]))/(one + drho)-(vx1*vx1-vx2*vx2));
+   kxxMzz = -3./2.*omega*((((f[NW]+f[SE])-(f[BS]+f[TN]))+((f[SW]+f[NE])-(f[TS]+f[BN])))+((f[W]+f[E])-(f[B]+f[T]))/(one + drho)-(vx1*vx1-vx3*vx3));
+}
+//////////////////////////////////////////////////////////////////////////
+void CompressibleOffsetMomentsInterpolationProcessor::calcInterpolatedCoefficiets(const D3Q27ICell& icell, LBMReal omega, LBMReal eps_new)
+{
+   LBMReal        vx1_SWT,vx2_SWT,vx3_SWT;
+   LBMReal        vx1_NWT,vx2_NWT,vx3_NWT;
+   LBMReal        vx1_NET,vx2_NET,vx3_NET;
+   LBMReal        vx1_SET,vx2_SET,vx3_SET;
+   LBMReal        vx1_SWB,vx2_SWB,vx3_SWB;
+   LBMReal        vx1_NWB,vx2_NWB,vx3_NWB;
+   LBMReal        vx1_NEB,vx2_NEB,vx3_NEB;
+   LBMReal        vx1_SEB,vx2_SEB,vx3_SEB;
+
+   LBMReal        kxyFromfcNEQ_SWT, kyzFromfcNEQ_SWT, kxzFromfcNEQ_SWT, kxxMyyFromfcNEQ_SWT, kxxMzzFromfcNEQ_SWT;
+   LBMReal        kxyFromfcNEQ_NWT, kyzFromfcNEQ_NWT, kxzFromfcNEQ_NWT, kxxMyyFromfcNEQ_NWT, kxxMzzFromfcNEQ_NWT;
+   LBMReal        kxyFromfcNEQ_NET, kyzFromfcNEQ_NET, kxzFromfcNEQ_NET, kxxMyyFromfcNEQ_NET, kxxMzzFromfcNEQ_NET;
+   LBMReal        kxyFromfcNEQ_SET, kyzFromfcNEQ_SET, kxzFromfcNEQ_SET, kxxMyyFromfcNEQ_SET, kxxMzzFromfcNEQ_SET;
+   LBMReal        kxyFromfcNEQ_SWB, kyzFromfcNEQ_SWB, kxzFromfcNEQ_SWB, kxxMyyFromfcNEQ_SWB, kxxMzzFromfcNEQ_SWB;
+   LBMReal        kxyFromfcNEQ_NWB, kyzFromfcNEQ_NWB, kxzFromfcNEQ_NWB, kxxMyyFromfcNEQ_NWB, kxxMzzFromfcNEQ_NWB;
+   LBMReal        kxyFromfcNEQ_NEB, kyzFromfcNEQ_NEB, kxzFromfcNEQ_NEB, kxxMyyFromfcNEQ_NEB, kxxMzzFromfcNEQ_NEB;
+   LBMReal        kxyFromfcNEQ_SEB, kyzFromfcNEQ_SEB, kxzFromfcNEQ_SEB, kxxMyyFromfcNEQ_SEB, kxxMzzFromfcNEQ_SEB;
+
+   calcMoments(icell.TSW,omega,press_SWT,vx1_SWT,vx2_SWT,vx3_SWT, kxyFromfcNEQ_SWT, kyzFromfcNEQ_SWT, kxzFromfcNEQ_SWT, kxxMyyFromfcNEQ_SWT, kxxMzzFromfcNEQ_SWT);
+   calcMoments(icell.TNW,omega,press_NWT,vx1_NWT,vx2_NWT,vx3_NWT, kxyFromfcNEQ_NWT, kyzFromfcNEQ_NWT, kxzFromfcNEQ_NWT, kxxMyyFromfcNEQ_NWT, kxxMzzFromfcNEQ_NWT);
+   calcMoments(icell.TNE,omega,press_NET,vx1_NET,vx2_NET,vx3_NET, kxyFromfcNEQ_NET, kyzFromfcNEQ_NET, kxzFromfcNEQ_NET, kxxMyyFromfcNEQ_NET, kxxMzzFromfcNEQ_NET);
+   calcMoments(icell.TSE,omega,press_SET,vx1_SET,vx2_SET,vx3_SET, kxyFromfcNEQ_SET, kyzFromfcNEQ_SET, kxzFromfcNEQ_SET, kxxMyyFromfcNEQ_SET, kxxMzzFromfcNEQ_SET);
+   calcMoments(icell.BSW,omega,press_SWB,vx1_SWB,vx2_SWB,vx3_SWB, kxyFromfcNEQ_SWB, kyzFromfcNEQ_SWB, kxzFromfcNEQ_SWB, kxxMyyFromfcNEQ_SWB, kxxMzzFromfcNEQ_SWB);
+   calcMoments(icell.BNW,omega,press_NWB,vx1_NWB,vx2_NWB,vx3_NWB, kxyFromfcNEQ_NWB, kyzFromfcNEQ_NWB, kxzFromfcNEQ_NWB, kxxMyyFromfcNEQ_NWB, kxxMzzFromfcNEQ_NWB);
+   calcMoments(icell.BNE,omega,press_NEB,vx1_NEB,vx2_NEB,vx3_NEB, kxyFromfcNEQ_NEB, kyzFromfcNEQ_NEB, kxzFromfcNEQ_NEB, kxxMyyFromfcNEQ_NEB, kxxMzzFromfcNEQ_NEB);
+   calcMoments(icell.BSE,omega,press_SEB,vx1_SEB,vx2_SEB,vx3_SEB, kxyFromfcNEQ_SEB, kyzFromfcNEQ_SEB, kxzFromfcNEQ_SEB, kxxMyyFromfcNEQ_SEB, kxxMzzFromfcNEQ_SEB);
+
+   //LBMReal dxRho=c1o4*((press_NET-press_SWB)+(press_SET-press_NWB)+(press_NEB-press_SWT)+(press_SEB-press_NWT));
+   //LBMReal dyRho=c1o4*((press_NET-press_SWB)-(press_SET-press_NWB)+(press_NEB-press_SWT)-(press_SEB-press_NWT));
+   //LBMReal dzRho=c1o4*((press_NET-press_SWB)+(press_SET-press_NWB)-(press_NEB-press_SWT)-(press_SEB-press_NWT));
+
+   //   kxyFromfcNEQ_SWT+=vx1_SWT*dyRho+vx2_SWT*dxRho;
+   //   kxyFromfcNEQ_NWT+=vx1_NWT*dyRho+vx2_NWT*dxRho;
+   //   kxyFromfcNEQ_NET+=vx1_NET*dyRho+vx2_NET*dxRho;
+   //   kxyFromfcNEQ_SET+=vx1_SET*dyRho+vx2_SET*dxRho;
+   //   kxyFromfcNEQ_SWB+=vx1_SWB*dyRho+vx2_SWB*dxRho;
+   //   kxyFromfcNEQ_NWB+=vx1_NWB*dyRho+vx2_NWB*dxRho;
+   //   kxyFromfcNEQ_NEB+=vx1_NEB*dyRho+vx2_NEB*dxRho;
+   //   kxyFromfcNEQ_SEB+=vx1_SEB*dyRho+vx2_SEB*dxRho;
+
+   //   kyzFromfcNEQ_SWT+=vx3_SWT*dyRho+vx2_SWT*dzRho;
+   //   kyzFromfcNEQ_NWT+=vx3_NWT*dyRho+vx2_NWT*dzRho;
+   //   kyzFromfcNEQ_NET+=vx3_NET*dyRho+vx2_NET*dzRho;
+   //   kyzFromfcNEQ_SET+=vx3_SET*dyRho+vx2_SET*dzRho;
+   //   kyzFromfcNEQ_SWB+=vx3_SWB*dyRho+vx2_SWB*dzRho;
+   //   kyzFromfcNEQ_NWB+=vx3_NWB*dyRho+vx2_NWB*dzRho;
+   //   kyzFromfcNEQ_NEB+=vx3_NEB*dyRho+vx2_NEB*dzRho;
+   //   kyzFromfcNEQ_SEB+=vx3_SEB*dyRho+vx2_SEB*dzRho;
+
+   //   kxzFromfcNEQ_SWT+=vx1_SWT*dzRho+vx3_SWT*dxRho;
+   //   kxzFromfcNEQ_NWT+=vx1_NWT*dzRho+vx3_NWT*dxRho;
+   //   kxzFromfcNEQ_NET+=vx1_NET*dzRho+vx3_NET*dxRho;
+   //   kxzFromfcNEQ_SET+=vx1_SET*dzRho+vx3_SET*dxRho;
+   //   kxzFromfcNEQ_SWB+=vx1_SWB*dzRho+vx3_SWB*dxRho;
+   //   kxzFromfcNEQ_NWB+=vx1_NWB*dzRho+vx3_NWB*dxRho;
+   //   kxzFromfcNEQ_NEB+=vx1_NEB*dzRho+vx3_NEB*dxRho;
+   //   kxzFromfcNEQ_SEB+=vx1_SEB*dzRho+vx3_SEB*dxRho;
+
+   //   kxxMyyFromfcNEQ_SWT+=vx1_SWT*dxRho-vx2_SWT*dyRho;
+   //   kxxMyyFromfcNEQ_NWT+=vx1_NWT*dxRho-vx2_NWT*dyRho;
+   //   kxxMyyFromfcNEQ_NET+=vx1_NET*dxRho-vx2_NET*dyRho;
+   //   kxxMyyFromfcNEQ_SET+=vx1_SET*dxRho-vx2_SET*dyRho;
+   //   kxxMyyFromfcNEQ_SWB+=vx1_SWB*dxRho-vx2_SWB*dyRho;
+   //   kxxMyyFromfcNEQ_NWB+=vx1_NWB*dxRho-vx2_NWB*dyRho;
+   //   kxxMyyFromfcNEQ_NEB+=vx1_NEB*dxRho-vx2_NEB*dyRho;
+   //   kxxMyyFromfcNEQ_SEB+=vx1_SEB*dxRho-vx2_SEB*dyRho;
+
+   //   kxxMzzFromfcNEQ_SWT+=vx1_SWT*dxRho-vx3_SWT*dzRho;
+   //   kxxMzzFromfcNEQ_NWT+=vx1_NWT*dxRho-vx3_NWT*dzRho;
+   //   kxxMzzFromfcNEQ_NET+=vx1_NET*dxRho-vx3_NET*dzRho;
+   //   kxxMzzFromfcNEQ_SET+=vx1_SET*dxRho-vx3_SET*dzRho;
+   //   kxxMzzFromfcNEQ_SWB+=vx1_SWB*dxRho-vx3_SWB*dzRho;
+   //   kxxMzzFromfcNEQ_NWB+=vx1_NWB*dxRho-vx3_NWB*dzRho;
+   //   kxxMzzFromfcNEQ_NEB+=vx1_NEB*dxRho-vx3_NEB*dzRho;
+   //   kxxMzzFromfcNEQ_SEB+=vx1_SEB*dxRho-vx3_SEB*dzRho;
+
+
+      //kxxMzzFromfcNEQ_SWT=0.0;
+      //kxxMzzFromfcNEQ_NWT=0.0;
+      //kxxMzzFromfcNEQ_NET=0.0;
+      //kxxMzzFromfcNEQ_SET=0.0;
+      //kxxMzzFromfcNEQ_SWB=0.0;
+      //kxxMzzFromfcNEQ_NWB=0.0;
+      //kxxMzzFromfcNEQ_NEB=0.0;
+      //kxxMzzFromfcNEQ_SEB=0.0;
+
+
+
+
+
+   a0 = (-kxxMyyFromfcNEQ_NEB - kxxMyyFromfcNEQ_NET + kxxMyyFromfcNEQ_NWB + kxxMyyFromfcNEQ_NWT -
+      kxxMyyFromfcNEQ_SEB - kxxMyyFromfcNEQ_SET + kxxMyyFromfcNEQ_SWB + kxxMyyFromfcNEQ_SWT -
+      kxxMzzFromfcNEQ_NEB - kxxMzzFromfcNEQ_NET + kxxMzzFromfcNEQ_NWB + kxxMzzFromfcNEQ_NWT -
+      kxxMzzFromfcNEQ_SEB - kxxMzzFromfcNEQ_SET + kxxMzzFromfcNEQ_SWB + kxxMzzFromfcNEQ_SWT -
+      2.*kxyFromfcNEQ_NEB - 2.*kxyFromfcNEQ_NET - 2.*kxyFromfcNEQ_NWB - 2.*kxyFromfcNEQ_NWT +
+      2.*kxyFromfcNEQ_SEB + 2.*kxyFromfcNEQ_SET + 2.*kxyFromfcNEQ_SWB + 2.*kxyFromfcNEQ_SWT +
+      2.*kxzFromfcNEQ_NEB - 2.*kxzFromfcNEQ_NET + 2.*kxzFromfcNEQ_NWB - 2.*kxzFromfcNEQ_NWT +
+      2.*kxzFromfcNEQ_SEB - 2.*kxzFromfcNEQ_SET + 2.*kxzFromfcNEQ_SWB - 2.*kxzFromfcNEQ_SWT +
+      8.*vx1_NEB + 8.*vx1_NET + 8.*vx1_NWB + 8.*vx1_NWT + 8.*vx1_SEB +
+      8.*vx1_SET + 8.*vx1_SWB + 8.*vx1_SWT + 2.*vx2_NEB + 2.*vx2_NET -
+      2.*vx2_NWB - 2.*vx2_NWT - 2.*vx2_SEB - 2.*vx2_SET + 2.*vx2_SWB +
+      2.*vx2_SWT - 2.*vx3_NEB + 2.*vx3_NET + 2.*vx3_NWB - 2.*vx3_NWT -
+      2.*vx3_SEB + 2.*vx3_SET + 2.*vx3_SWB - 2.*vx3_SWT)/64.;
+   b0 = (2.*kxxMyyFromfcNEQ_NEB + 2.*kxxMyyFromfcNEQ_NET + 2.*kxxMyyFromfcNEQ_NWB + 2.*kxxMyyFromfcNEQ_NWT -
+      2.*kxxMyyFromfcNEQ_SEB - 2.*kxxMyyFromfcNEQ_SET - 2.*kxxMyyFromfcNEQ_SWB - 2.*kxxMyyFromfcNEQ_SWT -
+      kxxMzzFromfcNEQ_NEB - kxxMzzFromfcNEQ_NET - kxxMzzFromfcNEQ_NWB - kxxMzzFromfcNEQ_NWT +
+      kxxMzzFromfcNEQ_SEB + kxxMzzFromfcNEQ_SET + kxxMzzFromfcNEQ_SWB + kxxMzzFromfcNEQ_SWT -
+      2.*kxyFromfcNEQ_NEB - 2.*kxyFromfcNEQ_NET + 2.*kxyFromfcNEQ_NWB + 2.*kxyFromfcNEQ_NWT -
+      2.*kxyFromfcNEQ_SEB - 2.*kxyFromfcNEQ_SET + 2.*kxyFromfcNEQ_SWB + 2.*kxyFromfcNEQ_SWT +
+      2.*kyzFromfcNEQ_NEB - 2.*kyzFromfcNEQ_NET + 2.*kyzFromfcNEQ_NWB - 2.*kyzFromfcNEQ_NWT +
+      2.*kyzFromfcNEQ_SEB - 2.*kyzFromfcNEQ_SET + 2.*kyzFromfcNEQ_SWB - 2.*kyzFromfcNEQ_SWT +
+      2.*vx1_NEB + 2.*vx1_NET - 2.*vx1_NWB - 2.*vx1_NWT -
+      2.*vx1_SEB - 2.*vx1_SET + 2.*vx1_SWB + 2.*vx1_SWT +
+      8.*vx2_NEB + 8.*vx2_NET + 8.*vx2_NWB + 8.*vx2_NWT +
+      8.*vx2_SEB + 8.*vx2_SET + 8.*vx2_SWB + 8.*vx2_SWT -
+      2.*vx3_NEB + 2.*vx3_NET - 2.*vx3_NWB + 2.*vx3_NWT +
+      2.*vx3_SEB - 2.*vx3_SET + 2.*vx3_SWB - 2.*vx3_SWT)/64.;
+   c0 = (kxxMyyFromfcNEQ_NEB - kxxMyyFromfcNEQ_NET + kxxMyyFromfcNEQ_NWB - kxxMyyFromfcNEQ_NWT +
+      kxxMyyFromfcNEQ_SEB - kxxMyyFromfcNEQ_SET + kxxMyyFromfcNEQ_SWB - kxxMyyFromfcNEQ_SWT -
+      2.*kxxMzzFromfcNEQ_NEB + 2.*kxxMzzFromfcNEQ_NET - 2.*kxxMzzFromfcNEQ_NWB + 2.*kxxMzzFromfcNEQ_NWT -
+      2.*kxxMzzFromfcNEQ_SEB + 2.*kxxMzzFromfcNEQ_SET - 2.*kxxMzzFromfcNEQ_SWB + 2.*kxxMzzFromfcNEQ_SWT -
+      2.*kxzFromfcNEQ_NEB - 2.*kxzFromfcNEQ_NET + 2.*kxzFromfcNEQ_NWB + 2.*kxzFromfcNEQ_NWT -
+      2.*kxzFromfcNEQ_SEB - 2.*kxzFromfcNEQ_SET + 2.*kxzFromfcNEQ_SWB + 2.*kxzFromfcNEQ_SWT -
+      2.*kyzFromfcNEQ_NEB - 2.*kyzFromfcNEQ_NET - 2.*kyzFromfcNEQ_NWB - 2.*kyzFromfcNEQ_NWT +
+      2.*kyzFromfcNEQ_SEB + 2.*kyzFromfcNEQ_SET + 2.*kyzFromfcNEQ_SWB + 2.*kyzFromfcNEQ_SWT -
+      2.*vx1_NEB + 2.*vx1_NET + 2.*vx1_NWB - 2.*vx1_NWT -
+      2.*vx1_SEB + 2.*vx1_SET + 2.*vx1_SWB - 2.*vx1_SWT -
+      2.*vx2_NEB + 2.*vx2_NET - 2.*vx2_NWB + 2.*vx2_NWT +
+      2.*vx2_SEB - 2.*vx2_SET + 2.*vx2_SWB - 2.*vx2_SWT +
+      8.*vx3_NEB + 8.*vx3_NET + 8.*vx3_NWB + 8.*vx3_NWT +
+      8.*vx3_SEB + 8.*vx3_SET + 8.*vx3_SWB + 8.*vx3_SWT)/64.;
+   ax = (vx1_NEB + vx1_NET - vx1_NWB - vx1_NWT + vx1_SEB + vx1_SET - vx1_SWB - vx1_SWT)/4.;
+   bx = (vx2_NEB + vx2_NET - vx2_NWB - vx2_NWT + vx2_SEB + vx2_SET - vx2_SWB - vx2_SWT)/4.;
+   cx = (vx3_NEB + vx3_NET - vx3_NWB - vx3_NWT + vx3_SEB + vx3_SET - vx3_SWB - vx3_SWT)/4.;
+   axx= (kxxMyyFromfcNEQ_NEB + kxxMyyFromfcNEQ_NET - kxxMyyFromfcNEQ_NWB - kxxMyyFromfcNEQ_NWT +
+      kxxMyyFromfcNEQ_SEB + kxxMyyFromfcNEQ_SET - kxxMyyFromfcNEQ_SWB - kxxMyyFromfcNEQ_SWT +
+      kxxMzzFromfcNEQ_NEB + kxxMzzFromfcNEQ_NET - kxxMzzFromfcNEQ_NWB - kxxMzzFromfcNEQ_NWT +
+      kxxMzzFromfcNEQ_SEB + kxxMzzFromfcNEQ_SET - kxxMzzFromfcNEQ_SWB - kxxMzzFromfcNEQ_SWT +
+      2.*vx2_NEB + 2.*vx2_NET - 2.*vx2_NWB - 2.*vx2_NWT -
+      2.*vx2_SEB - 2.*vx2_SET + 2.*vx2_SWB + 2.*vx2_SWT -
+      2.*vx3_NEB + 2.*vx3_NET + 2.*vx3_NWB - 2.*vx3_NWT -
+      2.*vx3_SEB + 2.*vx3_SET + 2.*vx3_SWB - 2.*vx3_SWT)/16.;
+   bxx= (kxyFromfcNEQ_NEB + kxyFromfcNEQ_NET - kxyFromfcNEQ_NWB - kxyFromfcNEQ_NWT +
+      kxyFromfcNEQ_SEB + kxyFromfcNEQ_SET - kxyFromfcNEQ_SWB - kxyFromfcNEQ_SWT -
+      2.*vx1_NEB - 2.*vx1_NET + 2.*vx1_NWB + 2.*vx1_NWT +
+      2.*vx1_SEB + 2.*vx1_SET - 2.*vx1_SWB - 2.*vx1_SWT)/8.;
+   cxx= (kxzFromfcNEQ_NEB + kxzFromfcNEQ_NET - kxzFromfcNEQ_NWB - kxzFromfcNEQ_NWT +
+      kxzFromfcNEQ_SEB + kxzFromfcNEQ_SET - kxzFromfcNEQ_SWB - kxzFromfcNEQ_SWT +
+      2.*vx1_NEB - 2.*vx1_NET - 2.*vx1_NWB + 2.*vx1_NWT +
+      2.*vx1_SEB - 2.*vx1_SET - 2.*vx1_SWB + 2.*vx1_SWT)/8.;
+   ay = (vx1_NEB + vx1_NET + vx1_NWB + vx1_NWT - vx1_SEB - vx1_SET - vx1_SWB - vx1_SWT)/4.;
+   by = (vx2_NEB + vx2_NET + vx2_NWB + vx2_NWT - vx2_SEB - vx2_SET - vx2_SWB - vx2_SWT)/4.;
+   cy = (vx3_NEB + vx3_NET + vx3_NWB + vx3_NWT - vx3_SEB - vx3_SET - vx3_SWB - vx3_SWT)/4.;
+   ayy= (kxyFromfcNEQ_NEB + kxyFromfcNEQ_NET + kxyFromfcNEQ_NWB + kxyFromfcNEQ_NWT -
+      kxyFromfcNEQ_SEB - kxyFromfcNEQ_SET - kxyFromfcNEQ_SWB - kxyFromfcNEQ_SWT -
+      2.*vx2_NEB - 2.*vx2_NET + 2.*vx2_NWB + 2.*vx2_NWT +
+      2.*vx2_SEB + 2.*vx2_SET - 2.*vx2_SWB - 2.*vx2_SWT)/8.;
+   byy= (-2.*kxxMyyFromfcNEQ_NEB - 2.*kxxMyyFromfcNEQ_NET - 2.*kxxMyyFromfcNEQ_NWB - 2.*kxxMyyFromfcNEQ_NWT +
+      2.*kxxMyyFromfcNEQ_SEB + 2.*kxxMyyFromfcNEQ_SET + 2.*kxxMyyFromfcNEQ_SWB + 2.*kxxMyyFromfcNEQ_SWT +
+      kxxMzzFromfcNEQ_NEB + kxxMzzFromfcNEQ_NET + kxxMzzFromfcNEQ_NWB + kxxMzzFromfcNEQ_NWT -
+      kxxMzzFromfcNEQ_SEB - kxxMzzFromfcNEQ_SET - kxxMzzFromfcNEQ_SWB - kxxMzzFromfcNEQ_SWT +
+      2.*vx1_NEB + 2.*vx1_NET - 2.*vx1_NWB - 2.*vx1_NWT -
+      2.*vx1_SEB - 2.*vx1_SET + 2.*vx1_SWB + 2.*vx1_SWT -
+      2.*vx3_NEB + 2.*vx3_NET - 2.*vx3_NWB + 2.*vx3_NWT +
+      2.*vx3_SEB - 2.*vx3_SET + 2.*vx3_SWB - 2.*vx3_SWT)/16.;
+   cyy= (kyzFromfcNEQ_NEB + kyzFromfcNEQ_NET + kyzFromfcNEQ_NWB + kyzFromfcNEQ_NWT -
+      kyzFromfcNEQ_SEB - kyzFromfcNEQ_SET - kyzFromfcNEQ_SWB - kyzFromfcNEQ_SWT +
+      2.*vx2_NEB - 2.*vx2_NET + 2.*vx2_NWB - 2.*vx2_NWT -
+      2.*vx2_SEB + 2.*vx2_SET - 2.*vx2_SWB + 2.*vx2_SWT)/8.;
+   az = (-vx1_NEB + vx1_NET - vx1_NWB + vx1_NWT - vx1_SEB + vx1_SET - vx1_SWB + vx1_SWT)/4.;
+   bz = (-vx2_NEB + vx2_NET - vx2_NWB + vx2_NWT - vx2_SEB + vx2_SET - vx2_SWB + vx2_SWT)/4.;
+   cz = (-vx3_NEB + vx3_NET - vx3_NWB + vx3_NWT - vx3_SEB + vx3_SET - vx3_SWB + vx3_SWT)/4.;
+   azz= (-kxzFromfcNEQ_NEB + kxzFromfcNEQ_NET - kxzFromfcNEQ_NWB + kxzFromfcNEQ_NWT -
+      kxzFromfcNEQ_SEB + kxzFromfcNEQ_SET - kxzFromfcNEQ_SWB + kxzFromfcNEQ_SWT +
+      2.*vx3_NEB - 2.*vx3_NET - 2.*vx3_NWB + 2.*vx3_NWT +
+      2.*vx3_SEB - 2.*vx3_SET - 2.*vx3_SWB + 2.*vx3_SWT)/8.;
+   bzz= (-kyzFromfcNEQ_NEB + kyzFromfcNEQ_NET - kyzFromfcNEQ_NWB + kyzFromfcNEQ_NWT -
+      kyzFromfcNEQ_SEB + kyzFromfcNEQ_SET - kyzFromfcNEQ_SWB + kyzFromfcNEQ_SWT +
+      2.*vx3_NEB - 2.*vx3_NET + 2.*vx3_NWB - 2.*vx3_NWT -
+      2.*vx3_SEB + 2.*vx3_SET - 2.*vx3_SWB + 2.*vx3_SWT)/8.;
+   czz= (-kxxMyyFromfcNEQ_NEB + kxxMyyFromfcNEQ_NET - kxxMyyFromfcNEQ_NWB + kxxMyyFromfcNEQ_NWT -
+      kxxMyyFromfcNEQ_SEB + kxxMyyFromfcNEQ_SET - kxxMyyFromfcNEQ_SWB + kxxMyyFromfcNEQ_SWT +
+      2.*kxxMzzFromfcNEQ_NEB - 2.*kxxMzzFromfcNEQ_NET + 2.*kxxMzzFromfcNEQ_NWB - 2.*kxxMzzFromfcNEQ_NWT +
+      2.*kxxMzzFromfcNEQ_SEB - 2.*kxxMzzFromfcNEQ_SET + 2.*kxxMzzFromfcNEQ_SWB - 2.*kxxMzzFromfcNEQ_SWT -
+      2.*vx1_NEB + 2.*vx1_NET + 2.*vx1_NWB - 2.*vx1_NWT -
+      2.*vx1_SEB + 2.*vx1_SET + 2.*vx1_SWB - 2.*vx1_SWT -
+      2.*vx2_NEB + 2.*vx2_NET - 2.*vx2_NWB + 2.*vx2_NWT +
+      2.*vx2_SEB - 2.*vx2_SET + 2.*vx2_SWB - 2.*vx2_SWT)/16.;
+   axy= (vx1_NEB + vx1_NET - vx1_NWB - vx1_NWT - vx1_SEB - vx1_SET + vx1_SWB + vx1_SWT)/2.;
+   bxy= (vx2_NEB + vx2_NET - vx2_NWB - vx2_NWT - vx2_SEB - vx2_SET + vx2_SWB + vx2_SWT)/2.;
+   cxy= (vx3_NEB + vx3_NET - vx3_NWB - vx3_NWT - vx3_SEB - vx3_SET + vx3_SWB + vx3_SWT)/2.;
+   axz= (-vx1_NEB + vx1_NET + vx1_NWB - vx1_NWT - vx1_SEB + vx1_SET + vx1_SWB - vx1_SWT)/2.;
+   bxz= (-vx2_NEB + vx2_NET + vx2_NWB - vx2_NWT - vx2_SEB + vx2_SET + vx2_SWB - vx2_SWT)/2.;
+   cxz= (-vx3_NEB + vx3_NET + vx3_NWB - vx3_NWT - vx3_SEB + vx3_SET + vx3_SWB - vx3_SWT)/2.;
+   ayz= (-vx1_NEB + vx1_NET - vx1_NWB + vx1_NWT + vx1_SEB - vx1_SET + vx1_SWB - vx1_SWT)/2.;
+   byz= (-vx2_NEB + vx2_NET - vx2_NWB + vx2_NWT + vx2_SEB - vx2_SET + vx2_SWB - vx2_SWT)/2.;
+   cyz= (-vx3_NEB + vx3_NET - vx3_NWB + vx3_NWT + vx3_SEB - vx3_SET + vx3_SWB - vx3_SWT)/2.;
+   axyz=-vx1_NEB + vx1_NET + vx1_NWB - vx1_NWT + vx1_SEB - vx1_SET - vx1_SWB + vx1_SWT;
+   bxyz=-vx2_NEB + vx2_NET + vx2_NWB - vx2_NWT + vx2_SEB - vx2_SET - vx2_SWB + vx2_SWT;
+   cxyz=-vx3_NEB + vx3_NET + vx3_NWB - vx3_NWT + vx3_SEB - vx3_SET - vx3_SWB + vx3_SWT;
+
+
+   //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+   kxyAverage       =0;//(kxyFromfcNEQ_SWB+
+                       //kxyFromfcNEQ_SWT+
+                       //kxyFromfcNEQ_SET+
+                       //kxyFromfcNEQ_SEB+
+                       //kxyFromfcNEQ_NWB+
+                       //kxyFromfcNEQ_NWT+
+                       //kxyFromfcNEQ_NET+
+                       //kxyFromfcNEQ_NEB)*c1o8-(ay+bx);
+   kyzAverage       =0;//(kyzFromfcNEQ_SWB+
+                       //kyzFromfcNEQ_SWT+
+                       //kyzFromfcNEQ_SET+
+                       //kyzFromfcNEQ_SEB+
+                       //kyzFromfcNEQ_NWB+
+                       //kyzFromfcNEQ_NWT+
+                       //kyzFromfcNEQ_NET+
+                       //kyzFromfcNEQ_NEB)*c1o8-(bz+cy);
+   kxzAverage       =0;//(kxzFromfcNEQ_SWB+
+                       //kxzFromfcNEQ_SWT+
+                       //kxzFromfcNEQ_SET+
+                       //kxzFromfcNEQ_SEB+
+                       //kxzFromfcNEQ_NWB+
+                       //kxzFromfcNEQ_NWT+
+                       //kxzFromfcNEQ_NET+
+                       //kxzFromfcNEQ_NEB)*c1o8-(az+cx);
+   kxxMyyAverage    =0;//(kxxMyyFromfcNEQ_SWB+
+                       //kxxMyyFromfcNEQ_SWT+
+                       //kxxMyyFromfcNEQ_SET+
+                       //kxxMyyFromfcNEQ_SEB+
+                       //kxxMyyFromfcNEQ_NWB+
+                       //kxxMyyFromfcNEQ_NWT+
+                       //kxxMyyFromfcNEQ_NET+
+                       //kxxMyyFromfcNEQ_NEB)*c1o8-(ax-by);
+   kxxMzzAverage    =0;//(kxxMzzFromfcNEQ_SWB+
+                       //kxxMzzFromfcNEQ_SWT+
+                       //kxxMzzFromfcNEQ_SET+
+                       //kxxMzzFromfcNEQ_SEB+
+                       //kxxMzzFromfcNEQ_NWB+
+                       //kxxMzzFromfcNEQ_NWT+
+                       //kxxMzzFromfcNEQ_NET+
+                       //kxxMzzFromfcNEQ_NEB)*c1o8-(ax-cz);
+   ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+   //
+   // Bernd das Brot
+   //
+   ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+   a0 = a0 + xoff * ax + yoff * ay + zoff * az + xoff_sq * axx + yoff_sq * ayy + zoff_sq * azz + xoff*yoff*axy + xoff*zoff*axz + yoff*zoff*ayz + xoff*yoff*zoff*axyz ;
+   ax = ax + 2. * xoff * axx + yoff * axy + zoff * axz + yoff*zoff*axyz;
+   ay = ay + 2. * yoff * ayy + xoff * axy + zoff * ayz + xoff*zoff*axyz;
+   az = az + 2. * zoff * azz + xoff * axz + yoff * ayz + xoff*yoff*axyz;
+   b0 = b0 + xoff * bx + yoff * by + zoff * bz + xoff_sq * bxx + yoff_sq * byy + zoff_sq * bzz + xoff*yoff*bxy + xoff*zoff*bxz + yoff*zoff*byz + xoff*yoff*zoff*bxyz;
+   bx = bx + 2. * xoff * bxx + yoff * bxy + zoff * bxz + yoff*zoff*bxyz;
+   by = by + 2. * yoff * byy + xoff * bxy + zoff * byz + xoff*zoff*bxyz;
+   bz = bz + 2. * zoff * bzz + xoff * bxz + yoff * byz + xoff*yoff*bxyz;
+   c0 = c0 + xoff * cx + yoff * cy + zoff * cz + xoff_sq * cxx + yoff_sq * cyy + zoff_sq * czz + xoff*yoff*cxy + xoff*zoff*cxz + yoff*zoff*cyz + xoff*yoff*zoff*cxyz;
+   cx = cx + 2. * xoff * cxx + yoff * cxy + zoff * cxz + yoff*zoff*cxyz;
+   cy = cy + 2. * yoff * cyy + xoff * cxy + zoff * cyz + xoff*zoff*cxyz;
+   cz = cz + 2. * zoff * czz + xoff * cxz + yoff * cyz + xoff*yoff*cxyz;
+   axy= axy + zoff*axyz;
+   axz= axz + yoff*axyz;
+   ayz= ayz + xoff*axyz;
+   bxy= bxy + zoff*bxyz;
+   bxz= bxz + yoff*bxyz;
+   byz= byz + xoff*bxyz;
+   cxy= cxy + zoff*cxyz;
+   cxz= cxz + yoff*cxyz;
+   cyz= cyz + xoff*cxyz;
+   ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+   const LBMReal o = omega;
+
+   f_E = eps_new*((2*(-2*ax + by + cz-kxxMzzAverage-kxxMyyAverage))/(27.*o));
+   f_N = eps_new*((2*(ax - 2*by + cz+2*kxxMyyAverage-kxxMzzAverage))/(27.*o));
+   f_T = eps_new*((2*(ax + by - 2*cz-kxxMyyAverage+2*kxxMzzAverage))/(27.*o));
+   f_NE = eps_new*(-(ax + 3*ay + 3*bx + by - 2*cz+2*kxxMyyAverage-kxxMyyAverage+3*kxyAverage)/(54.*o));
+   f_SE = eps_new*(-(ax - 3*ay - 3*bx + by - 2*cz+2*kxxMyyAverage-kxxMyyAverage-3*kxyAverage)/(54.*o));
+   f_TE = eps_new*(-(ax + 3*az - 2*by + 3*cx + cz+2*kxxMyyAverage-kxxMzzAverage+3*kxzAverage)/(54.*o));
+   f_BE = eps_new*(-(ax - 3*az - 2*by - 3*cx + cz+2*kxxMyyAverage-kxxMzzAverage-3*kxzAverage)/(54.*o));
+   f_TN = eps_new*(-(-2*ax + by + 3*bz + 3*cy + cz-kxxMyyAverage-kxxMzzAverage+3*kyzAverage)/(54.*o));
+   f_BN = eps_new*(-(-2*ax + by - 3*bz - 3*cy + cz-kxxMyyAverage-kxxMzzAverage-3*kyzAverage)/(54.*o));
+   f_ZERO = 0.;
+   f_TNE = eps_new*(-(ay + az + bx + bz + cx + cy+kxyAverage+kxzAverage+kyzAverage)/(72.*o));
+   f_TSW = eps_new*((-ay + az - bx + bz + cx + cy-kxyAverage+kxzAverage+kyzAverage)/(72.*o));
+   f_TSE = eps_new*((ay - az + bx + bz - cx + cy+kxyAverage-kxzAverage+kyzAverage)/(72.*o));
+   f_TNW = eps_new*((ay + az + bx - bz + cx - cy+kxyAverage+kxzAverage-kyzAverage)/(72.*o));
+
+   x_E = 0.25*eps_new*((2*(-4*axx + bxy + cxz))/(27.*o));
+   x_N = 0.25*eps_new*((2*(2*axx - 2*bxy + cxz))/(27.*o));
+   x_T = 0.25*eps_new*((2*(2*axx + bxy - 2*cxz))/(27.*o));
+   x_NE = 0.25*eps_new*(-((2*axx + 3*axy + 6*bxx + bxy - 2*cxz))/(54.*o));
+   x_SE = 0.25*eps_new*(-((2*axx - 3*axy - 6*bxx + bxy - 2*cxz))/(54.*o));
+   x_TE = 0.25*eps_new*(-((2*axx + 3*axz - 2*bxy + 6*cxx + cxz))/(54.*o));
+   x_BE = 0.25*eps_new*(-((2*axx - 3*axz - 2*bxy - 6*cxx + cxz))/(54.*o));
+   x_TN = 0.25*eps_new*(-((-4*axx + bxy + 3*bxz + 3*cxy + cxz))/(54.*o));
+   x_BN = 0.25*eps_new*(-((-4*axx + bxy - 3*bxz - 3*cxy + cxz))/(54.*o));
+   x_ZERO = 0.;
+   x_TNE = 0.25*eps_new*(-((axy + axz + 2*bxx + bxz + 2*cxx + cxy))/(72.*o));
+   x_TSW = 0.25*eps_new*(((-axy + axz - 2*bxx + bxz + 2*cxx + cxy))/(72.*o));
+   x_TSE = 0.25*eps_new*(((axy - axz + 2*bxx + bxz - 2*cxx + cxy))/(72.*o));
+   x_TNW = 0.25*eps_new*(((axy + axz + 2*bxx - bxz + 2*cxx - cxy))/(72.*o));
+
+   y_E = 0.25*eps_new*(2*(-2*axy + 2*byy + cyz))/(27.*o);
+   y_N = 0.25*eps_new*(2*(axy - 4*byy + cyz))/(27.*o);
+   y_T = 0.25*eps_new*(2*(axy + 2*byy - 2*cyz))/(27.*o);
+   y_NE = 0.25*eps_new*(-((axy + 6*ayy + 3*bxy + 2*byy - 2*cyz))/(54.*o));
+   y_SE = 0.25*eps_new*(-((axy - 6*ayy - 3*bxy + 2*byy - 2*cyz))/(54.*o));
+   y_TE = 0.25*eps_new*(-((axy + 3*ayz - 4*byy + 3*cxy + cyz))/(54.*o));
+   y_BE = 0.25*eps_new*(-((axy - 3*ayz - 4*byy - 3*cxy + cyz))/(54.*o));
+   y_TN = 0.25*eps_new*(-((-2*axy + 2*byy + 3*byz + 6*cyy + cyz))/(54.*o));
+   y_BN = 0.25*eps_new*(-((-2*axy + 2*byy - 3*byz - 6*cyy + cyz))/(54.*o));
+   y_ZERO = 0.;
+   y_TNE = 0.25*eps_new*(-((2*ayy + ayz + bxy + byz + cxy + 2*cyy))/(72.*o));
+   y_TSW = 0.25*eps_new*(((-2*ayy + ayz - bxy + byz + cxy + 2*cyy))/(72.*o));
+   y_TSE = 0.25*eps_new*(((2*ayy - ayz + bxy + byz - cxy + 2*cyy))/(72.*o));
+   y_TNW = 0.25*eps_new*(((2*ayy + ayz + bxy - byz + cxy - 2*cyy))/(72.*o));
+
+   z_E = 0.25*eps_new*((2*(-2*axz + byz + 2*czz))/(27.*o));
+   z_N = 0.25*eps_new*((2*(axz - 2*byz + 2*czz))/(27.*o));
+   z_T = 0.25*eps_new*((2*(axz + byz - 4*czz))/(27.*o));
+   z_NE = 0.25*eps_new*(-((axz + 3*ayz + 3*bxz + byz - 4*czz))/(54.*o));
+   z_SE = 0.25*eps_new*(-((axz - 3*ayz - 3*bxz + byz - 4*czz))/(54.*o));
+   z_TE = 0.25*eps_new*(-((axz + 6*azz - 2*byz + 3*cxz + 2*czz))/(54.*o));
+   z_BE = 0.25*eps_new*(-((axz - 6*azz - 2*byz - 3*cxz + 2*czz))/(54.*o));
+   z_TN = 0.25*eps_new*(-((-2*axz + byz + 6*bzz + 3*cyz + 2*czz))/(54.*o));
+   z_BN = 0.25*eps_new*(-((-2*axz + byz - 6*bzz - 3*cyz + 2*czz))/(54.*o));
+   z_ZERO = 0.;
+   z_TNE = 0.25*eps_new*(-((ayz + 2*azz + bxz + 2*bzz + cxz + cyz))/(72.*o));
+   z_TSW = 0.25*eps_new*(((-ayz + 2*azz - bxz + 2*bzz + cxz + cyz))/(72.*o));
+   z_TSE = 0.25*eps_new*(((ayz - 2*azz + bxz + 2*bzz - cxz + cyz))/(72.*o));
+   z_TNW = 0.25*eps_new*(((ayz + 2*azz + bxz - 2*bzz + cxz - cyz))/(72.*o));
+
+   xy_E   =   0.0625*eps_new *((                       2.*cxyz)/(27.*o));
+   xy_N   =   0.0625*eps_new *((                       2.*cxyz)/(27.*o));
+   xy_T   = -(0.0625*eps_new *((                       4.*cxyz)/(27.*o)));
+   xy_NE  =   0.0625*eps_new *(                            cxyz /(27.*o));
+   xy_SE  =   0.0625*eps_new *(                            cxyz /(27.*o));
+   xy_TE  = -(0.0625*eps_new *(( 3.*axyz            +     cxyz)/(54.*o)));
+   xy_BE  = -(0.0625*eps_new *((-3.*axyz            +     cxyz)/(54.*o)));
+   xy_TN  = -(0.0625*eps_new *((            3.*bxyz +     cxyz)/(54.*o)));
+   xy_BN  = -(0.0625*eps_new *((          - 3.*bxyz +     cxyz)/(54.*o)));
+   //xy_ZERO=   0.0625*eps_new;
+   xy_TNE = -(0.0625*eps_new *((     axyz +     bxyz           )/(72.*o)));
+   xy_TSW =   0.0625*eps_new *((     axyz +     bxyz           )/(72.*o));
+   xy_TSE =   0.0625*eps_new *((-    axyz +     bxyz           )/(72.*o));
+   xy_TNW =   0.0625*eps_new *((     axyz -     bxyz           )/(72.*o));
+
+   xz_E   =   0.0625*eps_new *((            2.*bxyz           )/(27.*o));
+   xz_N   = -(0.0625*eps_new *((            4.*bxyz           )/(27.*o)));
+   xz_T   =   0.0625*eps_new *((            2.*bxyz           )/(27.*o));
+   xz_NE  = -(0.0625*eps_new *(( 3.*axyz +     bxyz           )/(54.*o)));
+   xz_SE  = -(0.0625*eps_new *((-3.*axyz +     bxyz           )/(54.*o)));
+   xz_TE  =   0.0625*eps_new *((                bxyz           )/(27.*o));
+   xz_BE  =   0.0625*eps_new *((                bxyz           )/(27.*o));
+   xz_TN  = -(0.0625*eps_new *((                bxyz + 3.*cxyz)/(54.*o)));
+   xz_BN  = -(0.0625*eps_new *((                bxyz - 3.*cxyz)/(54.*o)));
+   //xz_ZERO=   0.0625*eps_new;
+   xz_TNE = -(0.0625*eps_new *((     axyz            +     cxyz)/(72.*o)));
+   xz_TSW =   0.0625*eps_new *((-    axyz            +     cxyz)/(72.*o));
+   xz_TSE =   0.0625*eps_new *((     axyz            +     cxyz)/(72.*o));
+   xz_TNW =   0.0625*eps_new *((     axyz            -     cxyz)/(72.*o));
+
+   yz_E   = -(0.0625*eps_new *(( 4.*axyz                      )/(27.*o)));
+   yz_N   =   0.0625*eps_new *(( 2.*axyz                      )/(27.*o));
+   yz_T   =   0.0625*eps_new *(( 2.*axyz                      )/(27.*o));
+   yz_NE  = -(0.0625*eps_new *((     axyz + 3.*bxyz           )/(54.*o)));
+   yz_SE  = -(0.0625*eps_new *((     axyz - 3.*bxyz           )/(54.*o)));
+   yz_TE  = -(0.0625*eps_new *((     axyz            + 3.*cxyz)/(54.*o)));
+   yz_BE  = -(0.0625*eps_new *((     axyz            - 3.*cxyz)/(54.*o)));
+   yz_TN  =   0.0625*eps_new *((     axyz                      )/(27.*o));
+   yz_BN  =   0.0625*eps_new *((     axyz                      )/(27.*o));
+   //yz_ZERO=   0.0625*eps_new;
+   yz_TNE = -(0.0625*eps_new *((                bxyz +     cxyz)/(72.*o)));
+   yz_TSW =   0.0625*eps_new *((          -     bxyz +     cxyz)/(72.*o));
+   yz_TSE =   0.0625*eps_new *((                bxyz -     cxyz)/(72.*o));
+   yz_TNW =   0.0625*eps_new *((                bxyz +     cxyz)/(72.*o));
+}
+//////////////////////////////////////////////////////////////////////////
+void CompressibleOffsetMomentsInterpolationProcessor::calcInterpolatedNodeCF(LBMReal* f, LBMReal omega, LBMReal x, LBMReal y, LBMReal z, LBMReal press, LBMReal xs, LBMReal ys, LBMReal zs)
+{
+   using namespace D3Q27System;
+
+   LBMReal eps_new = 0.5;
+   LBMReal o = omega;
+   //bulk viscosity
+   LBMReal oP = OxxPyyPzzF;
+
+   LBMReal rho  = press ;//+ (2.*axx*x+axy*y+axz*z+axyz*y*z+ax + 2.*byy*y+bxy*x+byz*z+bxyz*x*z+by + 2.*czz*z+cxz*x+cyz*y+cxyz*x*y+cz)/3.;
+   LBMReal vx1  = a0 + 0.25*( xs*ax + ys*ay + zs*az) + 0.0625*(axx + xs*ys*axy + xs*zs*axz + ayy + ys*zs*ayz + azz) + 0.015625*(xs*ys*zs*axyz);
+   LBMReal vx2  = b0 + 0.25*( xs*bx + ys*by + zs*bz) + 0.0625*(bxx + xs*ys*bxy + xs*zs*bxz + byy + ys*zs*byz + bzz) + 0.015625*(xs*ys*zs*bxyz);
+   LBMReal vx3  = c0 + 0.25*( xs*cx + ys*cy + zs*cz) + 0.0625*(cxx + xs*ys*cxy + xs*zs*cxz + cyy + ys*zs*cyz + czz) + 0.015625*(xs*ys*zs*cxyz);
+
+   LBMReal mfcbb = zeroReal;
+   LBMReal mfabb = zeroReal;
+   LBMReal mfbcb = zeroReal;
+   LBMReal mfbab = zeroReal;
+   LBMReal mfbbc = zeroReal;
+   LBMReal mfbba = zeroReal;
+   LBMReal mfccb = zeroReal;
+   LBMReal mfaab = zeroReal;
+   LBMReal mfcab = zeroReal;
+   LBMReal mfacb = zeroReal;
+   LBMReal mfcbc = zeroReal;
+   LBMReal mfaba = zeroReal;
+   LBMReal mfcba = zeroReal;
+   LBMReal mfabc = zeroReal;
+   LBMReal mfbcc = zeroReal;
+   LBMReal mfbaa = zeroReal;
+   LBMReal mfbca = zeroReal;
+   LBMReal mfbac = zeroReal;
+   LBMReal mfbbb = zeroReal;
+   LBMReal mfccc = zeroReal;
+   LBMReal mfaac = zeroReal;
+   LBMReal mfcac = zeroReal;
+   LBMReal mfacc = zeroReal;
+   LBMReal mfcca = zeroReal;
+   LBMReal mfaaa = zeroReal;
+   LBMReal mfcaa = zeroReal;
+   LBMReal mfaca = zeroReal;
+
+   mfaaa = press; // if drho is interpolated directly
+
+   LBMReal vx1Sq = vx1*vx1;
+   LBMReal vx2Sq = vx2*vx2;
+   LBMReal vx3Sq = vx3*vx3;
+   LBMReal oMdrho = one;
+
+   //2.f
+
+   // linear combinations
+   LBMReal mxxPyyPzz = mfaaa - c2o3*(ax + by + two*axx*x + bxy*x + axy*y + two*byy*y + axz*z + byz*z + bxyz*x*z + axyz*y*z + cz - cxz*x + cyz*y + cxyz*x*y + two*czz*z)*eps_new / oP* (one + press);
+   LBMReal mxxMyy    = -c2o3*(ax - by + kxxMyyAverage + two*axx*x - bxy*x + axy*y - two*byy*y + axz*z - byz*z - bxyz*x*z + axyz*y*z)*eps_new/o * (one + press);
+   LBMReal mxxMzz    = -c2o3*(ax - cz + kxxMzzAverage + two*axx*x - cxz*x + axy*y - cyz*y - cxyz*x*y + axz*z - two*czz*z + axyz*y*z)*eps_new/o * (one + press);
+
+   mfabb     = -c1o3 * (bz + cy + kyzAverage + bxz*x + cxy*x + byz*y + two*cyy*y + bxyz*x*y + two*bzz*z + cyz*z + cxyz*x*z)*eps_new/o * (one + press);
+   mfbab     = -c1o3 * (az + cx + kxzAverage + axz*x + two*cxx*x + ayz*y + cxy*y + axyz*x*y + two*azz*z + cxz*z + cxyz*y*z)*eps_new/o * (one + press);
+   mfbba     = -c1o3 * (ay + bx + kxyAverage + axy*x + two*bxx*x + two*ayy*y + bxy*y + ayz*z + bxz*z + axyz*x*z + bxyz*y*z)*eps_new/o * (one + press);
+
+   // linear combinations back
+   mfcaa = c1o3 * (mxxMyy +       mxxMzz + mxxPyyPzz) ;
+   mfaca = c1o3 * (-two * mxxMyy +       mxxMzz + mxxPyyPzz) ;
+   mfaac = c1o3 * (mxxMyy - two * mxxMzz + mxxPyyPzz) ;
+
+   //three
+   mfbbb = zeroReal;
+   LBMReal mxxyPyzz = zeroReal;
+   LBMReal mxxyMyzz = zeroReal;
+   LBMReal mxxzPyyz = zeroReal;
+   LBMReal mxxzMyyz = zeroReal;
+   LBMReal mxyyPxzz =  zeroReal;
+   LBMReal mxyyMxzz = zeroReal;
+
+   // linear combinations back
+   mfcba = (mxxyMyzz + mxxyPyzz) * c1o2;
+   mfabc = (-mxxyMyzz + mxxyPyzz) * c1o2;
+   mfcab = (mxxzMyyz + mxxzPyyz) * c1o2;
+   mfacb = (-mxxzMyyz + mxxzPyyz) * c1o2;
+   mfbca = (mxyyMxzz + mxyyPxzz) * c1o2;
+   mfbac = (-mxyyMxzz + mxyyPxzz) * c1o2;
+
+   //4.f
+   mfacc = mfaaa*c1o9;
+   mfcac = mfacc;
+   mfcca = mfacc;
+
+   //5.
+
+   //6.
+
+   mfccc = mfaaa*c1o27;
+   ////////////////////////////////////////////////////////////////////////////////////
+   //back
+   ////////////////////////////////////////////////////////////////////////////////////
+   //mit 1, 0, 1/3, 0, 0, 0, 1/3, 0, 1/9   Konditionieren
+   ////////////////////////////////////////////////////////////////////////////////////
+   // Z - Dir
+   LBMReal m0 =  mfaac * c1o2 +      mfaab * (vx3 - c1o2) + (mfaaa + one * oMdrho) * (vx3Sq - vx3) * c1o2;
+   LBMReal m1 = -mfaac        - two * mfaab *  vx3         +  mfaaa                * (one - vx3Sq)              - one * oMdrho * vx3Sq;
+   LBMReal m2 =  mfaac * c1o2 +      mfaab * (vx3 + c1o2) + (mfaaa + one * oMdrho) * (vx3Sq + vx3) * c1o2;
+   mfaaa = m0;
+   mfaab = m1;
+   mfaac = m2;
+   ////////////////////////////////////////////////////////////////////////////////////
+   m0 =  mfabc * c1o2 +      mfabb * (vx3 - c1o2) + mfaba * (vx3Sq - vx3) * c1o2;
+   m1 = -mfabc        - two * mfabb *  vx3         + mfaba * (one - vx3Sq);
+   m2 =  mfabc * c1o2 +      mfabb * (vx3 + c1o2) + mfaba * (vx3Sq + vx3) * c1o2;
+   mfaba = m0;
+   mfabb = m1;
+   mfabc = m2;
+   ////////////////////////////////////////////////////////////////////////////////////
+   m0 =  mfacc * c1o2 +      mfacb * (vx3 - c1o2) + (mfaca + c1o3 * oMdrho) * (vx3Sq - vx3) * c1o2;
+   m1 = -mfacc        - two * mfacb *  vx3         +  mfaca                  * (one - vx3Sq)              - c1o3 * oMdrho * vx3Sq;
+   m2 =  mfacc * c1o2 +      mfacb * (vx3 + c1o2) + (mfaca + c1o3 * oMdrho) * (vx3Sq + vx3) * c1o2;
+   mfaca = m0;
+   mfacb = m1;
+   mfacc = m2;
+   ////////////////////////////////////////////////////////////////////////////////////
+   ////////////////////////////////////////////////////////////////////////////////////
+   m0 =  mfbac * c1o2 +      mfbab * (vx3 - c1o2) + mfbaa * (vx3Sq - vx3) * c1o2;
+   m1 = -mfbac        - two * mfbab *  vx3         + mfbaa * (one - vx3Sq);
+   m2 =  mfbac * c1o2 +      mfbab * (vx3 + c1o2) + mfbaa * (vx3Sq + vx3) * c1o2;
+   mfbaa = m0;
+   mfbab = m1;
+   mfbac = m2;
+   /////////b//////////////////////////////////////////////////////////////////////////
+   m0 =  mfbbc * c1o2 +      mfbbb * (vx3 - c1o2) + mfbba * (vx3Sq - vx3) * c1o2;
+   m1 = -mfbbc        - two * mfbbb *  vx3         + mfbba * (one - vx3Sq);
+   m2 =  mfbbc * c1o2 +      mfbbb * (vx3 + c1o2) + mfbba * (vx3Sq + vx3) * c1o2;
+   mfbba = m0;
+   mfbbb = m1;
+   mfbbc = m2;
+   /////////b//////////////////////////////////////////////////////////////////////////
+   m0 =  mfbcc * c1o2 +      mfbcb * (vx3 - c1o2) + mfbca * (vx3Sq - vx3) * c1o2;
+   m1 = -mfbcc        - two * mfbcb *  vx3         + mfbca * (one - vx3Sq);
+   m2 =  mfbcc * c1o2 +      mfbcb * (vx3 + c1o2) + mfbca * (vx3Sq + vx3) * c1o2;
+   mfbca = m0;
+   mfbcb = m1;
+   mfbcc = m2;
+   ////////////////////////////////////////////////////////////////////////////////////
+   ////////////////////////////////////////////////////////////////////////////////////
+   m0 =  mfcac * c1o2 +      mfcab * (vx3 - c1o2) + (mfcaa + c1o3 * oMdrho) * (vx3Sq - vx3) * c1o2;
+   m1 = -mfcac        - two * mfcab *  vx3         +  mfcaa                  * (one - vx3Sq)              - c1o3 * oMdrho * vx3Sq;
+   m2 =  mfcac * c1o2 +      mfcab * (vx3 + c1o2) + (mfcaa + c1o3 * oMdrho) * (vx3Sq + vx3) * c1o2;
+   mfcaa = m0;
+   mfcab = m1;
+   mfcac = m2;
+   /////////c//////////////////////////////////////////////////////////////////////////
+   m0 =  mfcbc * c1o2 +      mfcbb * (vx3 - c1o2) + mfcba * (vx3Sq - vx3) * c1o2;
+   m1 = -mfcbc        - two * mfcbb *  vx3         + mfcba * (one - vx3Sq);
+   m2 =  mfcbc * c1o2 +      mfcbb * (vx3 + c1o2) + mfcba * (vx3Sq + vx3) * c1o2;
+   mfcba = m0;
+   mfcbb = m1;
+   mfcbc = m2;
+   /////////c//////////////////////////////////////////////////////////////////////////
+   m0 =  mfccc * c1o2 +      mfccb * (vx3 - c1o2) + (mfcca + c1o9 * oMdrho) * (vx3Sq - vx3) * c1o2;
+   m1 = -mfccc        - two * mfccb *  vx3         +  mfcca                  * (one - vx3Sq)              - c1o9 * oMdrho * vx3Sq;
+   m2 =  mfccc * c1o2 +      mfccb * (vx3 + c1o2) + (mfcca + c1o9 * oMdrho) * (vx3Sq + vx3) * c1o2;
+   mfcca = m0;
+   mfccb = m1;
+   mfccc = m2;
+   ////////////////////////////////////////////////////////////////////////////////////
+   ////////////////////////////////////////////////////////////////////////////////////
+   //mit 1/6, 2/3, 1/6, 0, 0, 0, 1/18, 2/9, 1/18   Konditionieren
+   ////////////////////////////////////////////////////////////////////////////////////
+   // Y - Dir
+   m0 =  mfaca * c1o2 +      mfaba * (vx2 - c1o2) + (mfaaa + c1o6 * oMdrho) * (vx2Sq - vx2) * c1o2;
+   m1 = -mfaca        - two * mfaba *  vx2         +  mfaaa                  * (one - vx2Sq)              - c1o6 * oMdrho * vx2Sq;
+   m2 =  mfaca * c1o2 +      mfaba * (vx2 + c1o2) + (mfaaa + c1o6 * oMdrho) * (vx2Sq + vx2) * c1o2;
+   mfaaa = m0;
+   mfaba = m1;
+   mfaca = m2;
+   ////////////////////////////////////////////////////////////////////////////////////
+   m0 =  mfacb * c1o2 +      mfabb * (vx2 - c1o2) + (mfaab + c2o3 * oMdrho) * (vx2Sq - vx2) * c1o2;
+   m1 = -mfacb        - two * mfabb *  vx2         +  mfaab                  * (one - vx2Sq)              - c2o3 * oMdrho * vx2Sq;
+   m2 =  mfacb * c1o2 +      mfabb * (vx2 + c1o2) + (mfaab + c2o3 * oMdrho) * (vx2Sq + vx2) * c1o2;
+   mfaab = m0;
+   mfabb = m1;
+   mfacb = m2;
+   ////////////////////////////////////////////////////////////////////////////////////
+   m0 =  mfacc * c1o2 +      mfabc * (vx2 - c1o2) + (mfaac + c1o6 * oMdrho) * (vx2Sq - vx2) * c1o2;
+   m1 = -mfacc        - two * mfabc *  vx2         +  mfaac                  * (one - vx2Sq)              - c1o6 * oMdrho * vx2Sq;
+   m2 =  mfacc * c1o2 +      mfabc * (vx2 + c1o2) + (mfaac + c1o6 * oMdrho) * (vx2Sq + vx2) * c1o2;
+   mfaac = m0;
+   mfabc = m1;
+   mfacc = m2;
+   ////////////////////////////////////////////////////////////////////////////////////
+   ////////////////////////////////////////////////////////////////////////////////////
+   m0 =  mfbca * c1o2 +      mfbba * (vx2 - c1o2) + mfbaa * (vx2Sq - vx2) * c1o2;
+   m1 = -mfbca        - two * mfbba *  vx2         + mfbaa * (one - vx2Sq);
+   m2 =  mfbca * c1o2 +      mfbba * (vx2 + c1o2) + mfbaa * (vx2Sq + vx2) * c1o2;
+   mfbaa = m0;
+   mfbba = m1;
+   mfbca = m2;
+   /////////b//////////////////////////////////////////////////////////////////////////
+   m0 =  mfbcb * c1o2 +      mfbbb * (vx2 - c1o2) + mfbab * (vx2Sq - vx2) * c1o2;
+   m1 = -mfbcb        - two * mfbbb *  vx2         + mfbab * (one - vx2Sq);
+   m2 =  mfbcb * c1o2 +      mfbbb * (vx2 + c1o2) + mfbab * (vx2Sq + vx2) * c1o2;
+   mfbab = m0;
+   mfbbb = m1;
+   mfbcb = m2;
+   /////////b//////////////////////////////////////////////////////////////////////////
+   m0 =  mfbcc * c1o2 +      mfbbc * (vx2 - c1o2) + mfbac * (vx2Sq - vx2) * c1o2;
+   m1 = -mfbcc        - two * mfbbc *  vx2         + mfbac * (one - vx2Sq);
+   m2 =  mfbcc * c1o2 +      mfbbc * (vx2 + c1o2) + mfbac * (vx2Sq + vx2) * c1o2;
+   mfbac = m0;
+   mfbbc = m1;
+   mfbcc = m2;
+   ////////////////////////////////////////////////////////////////////////////////////
+   ////////////////////////////////////////////////////////////////////////////////////
+   m0 =  mfcca * c1o2 +      mfcba * (vx2 - c1o2) + (mfcaa + c1o18 * oMdrho) * (vx2Sq - vx2) * c1o2;
+   m1 = -mfcca        - two * mfcba *  vx2         +  mfcaa                   * (one - vx2Sq)              - c1o18 * oMdrho * vx2Sq;
+   m2 =  mfcca * c1o2 +      mfcba * (vx2 + c1o2) + (mfcaa + c1o18 * oMdrho) * (vx2Sq + vx2) * c1o2;
+   mfcaa = m0;
+   mfcba = m1;
+   mfcca = m2;
+   /////////c//////////////////////////////////////////////////////////////////////////
+   m0 =  mfccb * c1o2 +      mfcbb * (vx2 - c1o2) + (mfcab + c2o9 * oMdrho) * (vx2Sq - vx2) * c1o2;
+   m1 = -mfccb        - two * mfcbb *  vx2         +  mfcab                  * (one - vx2Sq)              - c2o9 * oMdrho * vx2Sq;
+   m2 =  mfccb * c1o2 +      mfcbb * (vx2 + c1o2) + (mfcab + c2o9 * oMdrho) * (vx2Sq + vx2) * c1o2;
+   mfcab = m0;
+   mfcbb = m1;
+   mfccb = m2;
+   /////////c//////////////////////////////////////////////////////////////////////////
+   m0 =  mfccc * c1o2 +      mfcbc * (vx2 - c1o2) + (mfcac + c1o18 * oMdrho) * (vx2Sq - vx2) * c1o2;
+   m1 = -mfccc        - two * mfcbc *  vx2         +  mfcac                   * (one - vx2Sq)              - c1o18 * oMdrho * vx2Sq;
+   m2 =  mfccc * c1o2 +      mfcbc * (vx2 + c1o2) + (mfcac + c1o18 * oMdrho) * (vx2Sq + vx2) * c1o2;
+   mfcac = m0;
+   mfcbc = m1;
+   mfccc = m2;
+   ////////////////////////////////////////////////////////////////////////////////////
+   ////////////////////////////////////////////////////////////////////////////////////
+   //mit 1/36, 1/9, 1/36, 1/9, 4/9, 1/9, 1/36, 1/9, 1/36 Konditionieren
+   ////////////////////////////////////////////////////////////////////////////////////
+   // X - Dir
+   m0 =  mfcaa * c1o2 +      mfbaa * (vx1 - c1o2) + (mfaaa + c1o36 * oMdrho) * (vx1Sq - vx1) * c1o2;
+   m1 = -mfcaa        - two * mfbaa *  vx1         +  mfaaa                   * (one - vx1Sq)              - c1o36 * oMdrho * vx1Sq;
+   m2 =  mfcaa * c1o2 +      mfbaa * (vx1 + c1o2) + (mfaaa + c1o36 * oMdrho) * (vx1Sq + vx1) * c1o2;
+   mfaaa = m0;
+   mfbaa = m1;
+   mfcaa = m2;
+   ////////////////////////////////////////////////////////////////////////////////////
+   m0 =  mfcba * c1o2 +      mfbba * (vx1 - c1o2) + (mfaba + c1o9 * oMdrho) * (vx1Sq - vx1) * c1o2;
+   m1 = -mfcba        - two * mfbba *  vx1         +  mfaba                  * (one - vx1Sq)              - c1o9 * oMdrho * vx1Sq;
+   m2 =  mfcba * c1o2 +      mfbba * (vx1 + c1o2) + (mfaba + c1o9 * oMdrho) * (vx1Sq + vx1) * c1o2;
+   mfaba = m0;
+   mfbba = m1;
+   mfcba = m2;
+   ////////////////////////////////////////////////////////////////////////////////////
+   m0 =  mfcca * c1o2 +      mfbca * (vx1 - c1o2) + (mfaca + c1o36 * oMdrho) * (vx1Sq - vx1) * c1o2;
+   m1 = -mfcca        - two * mfbca *  vx1         +  mfaca                   * (one - vx1Sq)              - c1o36 * oMdrho * vx1Sq;
+   m2 =  mfcca * c1o2 +      mfbca * (vx1 + c1o2) + (mfaca + c1o36 * oMdrho) * (vx1Sq + vx1) * c1o2;
+   mfaca = m0;
+   mfbca = m1;
+   mfcca = m2;
+   ////////////////////////////////////////////////////////////////////////////////////
+   ////////////////////////////////////////////////////////////////////////////////////
+   m0 =  mfcab * c1o2 +      mfbab * (vx1 - c1o2) + (mfaab + c1o9 * oMdrho) * (vx1Sq - vx1) * c1o2;
+   m1 = -mfcab        - two * mfbab *  vx1         +  mfaab                  * (one - vx1Sq)              - c1o9 * oMdrho * vx1Sq;
+   m2 =  mfcab * c1o2 +      mfbab * (vx1 + c1o2) + (mfaab + c1o9 * oMdrho) * (vx1Sq + vx1) * c1o2;
+   mfaab = m0;
+   mfbab = m1;
+   mfcab = m2;
+   ///////////b////////////////////////////////////////////////////////////////////////
+   m0 =  mfcbb * c1o2 +      mfbbb * (vx1 - c1o2) + (mfabb + c4o9 * oMdrho) * (vx1Sq - vx1) * c1o2;
+   m1 = -mfcbb        - two * mfbbb *  vx1         +  mfabb                  * (one - vx1Sq)              - c4o9 * oMdrho * vx1Sq;
+   m2 =  mfcbb * c1o2 +      mfbbb * (vx1 + c1o2) + (mfabb + c4o9 * oMdrho) * (vx1Sq + vx1) * c1o2;
+   mfabb = m0;
+   mfbbb = m1;
+   mfcbb = m2;
+   ///////////b////////////////////////////////////////////////////////////////////////
+   m0 =  mfccb * c1o2 +      mfbcb * (vx1 - c1o2) + (mfacb + c1o9 * oMdrho) * (vx1Sq - vx1) * c1o2;
+   m1 = -mfccb        - two * mfbcb *  vx1         +  mfacb                  * (one - vx1Sq)              - c1o9 * oMdrho * vx1Sq;
+   m2 =  mfccb * c1o2 +      mfbcb * (vx1 + c1o2) + (mfacb + c1o9 * oMdrho) * (vx1Sq + vx1) * c1o2;
+   mfacb = m0;
+   mfbcb = m1;
+   mfccb = m2;
+   ////////////////////////////////////////////////////////////////////////////////////
+   ////////////////////////////////////////////////////////////////////////////////////
+   m0 =  mfcac * c1o2 +      mfbac * (vx1 - c1o2) + (mfaac + c1o36 * oMdrho) * (vx1Sq - vx1) * c1o2;
+   m1 = -mfcac        - two * mfbac *  vx1         +  mfaac                   * (one - vx1Sq)              - c1o36 * oMdrho * vx1Sq;
+   m2 =  mfcac * c1o2 +      mfbac * (vx1 + c1o2) + (mfaac + c1o36 * oMdrho) * (vx1Sq + vx1) * c1o2;
+   mfaac = m0;
+   mfbac = m1;
+   mfcac = m2;
+   ///////////c////////////////////////////////////////////////////////////////////////
+   m0 =  mfcbc * c1o2 +      mfbbc * (vx1 - c1o2) + (mfabc + c1o9 * oMdrho) * (vx1Sq - vx1) * c1o2;
+   m1 = -mfcbc        - two * mfbbc *  vx1         +  mfabc                  * (one - vx1Sq)              - c1o9 * oMdrho * vx1Sq;
+   m2 =  mfcbc * c1o2 +      mfbbc * (vx1 + c1o2) + (mfabc + c1o9 * oMdrho) * (vx1Sq + vx1) * c1o2;
+   mfabc = m0;
+   mfbbc = m1;
+   mfcbc = m2;
+   ///////////c////////////////////////////////////////////////////////////////////////
+   m0 =  mfccc * c1o2 +      mfbcc * (vx1 - c1o2) + (mfacc + c1o36 * oMdrho) * (vx1Sq - vx1) * c1o2;
+   m1 = -mfccc        - two * mfbcc *  vx1         +  mfacc                   * (one - vx1Sq)              - c1o36 * oMdrho * vx1Sq;
+   m2 =  mfccc * c1o2 +      mfbcc * (vx1 + c1o2) + (mfacc + c1o36 * oMdrho) * (vx1Sq + vx1) * c1o2;
+   mfacc = m0;
+   mfbcc = m1;
+   mfccc = m2;
+   ////////////////////////////////////////////////////////////////////////////////////
+
+   f[E]    = mfcbb;
+   f[W]    = mfabb;
+   f[N]    = mfbcb;
+   f[S]    = mfbab;
+   f[T]    = mfbbc;
+   f[B]    = mfbba;
+   f[NE]   = mfccb;
+   f[SW]   = mfaab;
+   f[SE]   = mfcab;
+   f[NW]   = mfacb;
+   f[TE]   = mfcbc;
+   f[BW]   = mfaba;
+   f[BE]   = mfcba;
+   f[TW]   = mfabc;
+   f[TN]   = mfbcc;
+   f[BS]   = mfbaa;
+   f[BN]   = mfbca;
+   f[TS]   = mfbac;
+   f[ZERO] = mfbbb;
+   f[TNE]  = mfccc;
+   f[TSE]  = mfcac;
+   f[BNE]  = mfcca;
+   f[BSE]  = mfcaa;
+   f[TNW]  = mfacc;
+   f[TSW]  = mfaac;
+   f[BNW]  = mfaca;
+   f[BSW]  = mfaaa;
+}
+//////////////////////////////////////////////////////////////////////////
+//Position SWB -0.25, -0.25, -0.25
+LBMReal CompressibleOffsetMomentsInterpolationProcessor::calcPressBSW()
+{
+   return   press_SWT * (0.140625 + 0.1875 * xoff + 0.1875 * yoff - 0.5625 * zoff) +
+      press_NWT * (0.046875 + 0.0625 * xoff - 0.1875 * yoff - 0.1875 * zoff) +
+      press_SET * (0.046875 - 0.1875 * xoff + 0.0625 * yoff - 0.1875 * zoff) +
+      press_NET * (0.015625 - 0.0625 * xoff - 0.0625 * yoff - 0.0625 * zoff) +
+      press_NEB * (0.046875 - 0.1875 * xoff - 0.1875 * yoff + 0.0625 * zoff) +
+      press_NWB * (0.140625 + 0.1875 * xoff - 0.5625 * yoff + 0.1875 * zoff) +
+      press_SEB * (0.140625 - 0.5625 * xoff + 0.1875 * yoff + 0.1875 * zoff) +
+      press_SWB * (0.421875 + 0.5625 * xoff + 0.5625 * yoff + 0.5625 * zoff);
+}
+//////////////////////////////////////////////////////////////////////////
+//Position SWT -0.25, -0.25, 0.25
+LBMReal CompressibleOffsetMomentsInterpolationProcessor::calcPressTSW()
+{
+   return   press_SWT * (0.421875 + 0.5625 * xoff + 0.5625 * yoff - 0.5625 * zoff) +
+      press_NWT * (0.140625 + 0.1875 * xoff - 0.5625 * yoff - 0.1875 * zoff) +
+      press_SET * (0.140625 - 0.5625 * xoff + 0.1875 * yoff - 0.1875 * zoff) +
+      press_NET * (0.046875 - 0.1875 * xoff - 0.1875 * yoff - 0.0625 * zoff) +
+      press_NEB * (0.015625 - 0.0625 * xoff - 0.0625 * yoff + 0.0625 * zoff) +
+      press_NWB * (0.046875 + 0.0625 * xoff - 0.1875 * yoff + 0.1875 * zoff) +
+      press_SEB * (0.046875 - 0.1875 * xoff + 0.0625 * yoff + 0.1875 * zoff) +
+      press_SWB * (0.140625 + 0.1875 * xoff + 0.1875 * yoff + 0.5625 * zoff);
+}
+//////////////////////////////////////////////////////////////////////////
+//Position SET 0.25, -0.25, 0.25
+LBMReal CompressibleOffsetMomentsInterpolationProcessor::calcPressTSE()
+{
+   return   press_SET * (0.421875 - 0.5625 * xoff + 0.5625 * yoff - 0.5625 * zoff) +
+      press_NET * (0.140625 - 0.1875 * xoff - 0.5625 * yoff - 0.1875 * zoff) +
+      press_SWT * (0.140625 + 0.5625 * xoff + 0.1875 * yoff - 0.1875 * zoff) +
+      press_NWT * (0.046875 + 0.1875 * xoff - 0.1875 * yoff - 0.0625 * zoff) +
+      press_NWB * (0.015625 + 0.0625 * xoff - 0.0625 * yoff + 0.0625 * zoff) +
+      press_NEB * (0.046875 - 0.0625 * xoff - 0.1875 * yoff + 0.1875 * zoff) +
+      press_SWB * (0.046875 + 0.1875 * xoff + 0.0625 * yoff + 0.1875 * zoff) +
+      press_SEB * (0.140625 - 0.1875 * xoff + 0.1875 * yoff + 0.5625 * zoff);
+}
+//////////////////////////////////////////////////////////////////////////
+//Position SEB 0.25, -0.25, -0.25
+LBMReal CompressibleOffsetMomentsInterpolationProcessor::calcPressBSE()
+{
+   return   press_SET * (0.140625 - 0.1875 * xoff + 0.1875 * yoff - 0.5625 * zoff) +
+      press_NET * (0.046875 - 0.0625 * xoff - 0.1875 * yoff - 0.1875 * zoff) +
+      press_SWT * (0.046875 + 0.1875 * xoff + 0.0625 * yoff - 0.1875 * zoff) +
+      press_NWT * (0.015625 + 0.0625 * xoff - 0.0625 * yoff - 0.0625 * zoff) +
+      press_NWB * (0.046875 + 0.1875 * xoff - 0.1875 * yoff + 0.0625 * zoff) +
+      press_NEB * (0.140625 - 0.1875 * xoff - 0.5625 * yoff + 0.1875 * zoff) +
+      press_SWB * (0.140625 + 0.5625 * xoff + 0.1875 * yoff + 0.1875 * zoff) +
+      press_SEB * (0.421875 - 0.5625 * xoff + 0.5625 * yoff + 0.5625 * zoff);
+}
+//////////////////////////////////////////////////////////////////////////
+//Position NWB -0.25, 0.25, -0.25
+LBMReal CompressibleOffsetMomentsInterpolationProcessor::calcPressBNW()
+{
+   return   press_NWT * (0.140625 + 0.1875 * xoff - 0.1875 * yoff - 0.5625 * zoff) +
+      press_NET * (0.046875 - 0.1875 * xoff - 0.0625 * yoff - 0.1875 * zoff) +
+      press_SWT * (0.046875 + 0.0625 * xoff + 0.1875 * yoff - 0.1875 * zoff) +
+      press_SET * (0.015625 - 0.0625 * xoff + 0.0625 * yoff - 0.0625 * zoff) +
+      press_SEB * (0.046875 - 0.1875 * xoff + 0.1875 * yoff + 0.0625 * zoff) +
+      press_NEB * (0.140625 - 0.5625 * xoff - 0.1875 * yoff + 0.1875 * zoff) +
+      press_SWB * (0.140625 + 0.1875 * xoff + 0.5625 * yoff + 0.1875 * zoff) +
+      press_NWB * (0.421875 + 0.5625 * xoff - 0.5625 * yoff + 0.5625 * zoff);
+}
+//////////////////////////////////////////////////////////////////////////
+//Position NWT -0.25, 0.25, 0.25
+LBMReal CompressibleOffsetMomentsInterpolationProcessor::calcPressTNW()
+{
+   return   press_NWT * (0.421875 + 0.5625 * xoff - 0.5625 * yoff - 0.5625 * zoff) +
+      press_NET * (0.140625 - 0.5625 * xoff - 0.1875 * yoff - 0.1875 * zoff) +
+      press_SWT * (0.140625 + 0.1875 * xoff + 0.5625 * yoff - 0.1875 * zoff) +
+      press_SET * (0.046875 - 0.1875 * xoff + 0.1875 * yoff - 0.0625 * zoff) +
+      press_SEB * (0.015625 - 0.0625 * xoff + 0.0625 * yoff + 0.0625 * zoff) +
+      press_NEB * (0.046875 - 0.1875 * xoff - 0.0625 * yoff + 0.1875 * zoff) +
+      press_SWB * (0.046875 + 0.0625 * xoff + 0.1875 * yoff + 0.1875 * zoff) +
+      press_NWB * (0.140625 + 0.1875 * xoff - 0.1875 * yoff + 0.5625 * zoff);
+}
+//////////////////////////////////////////////////////////////////////////
+//Position NET 0.25, 0.25, 0.25
+LBMReal CompressibleOffsetMomentsInterpolationProcessor::calcPressTNE()
+{
+   return   press_NET * (0.421875 - 0.5625 * xoff - 0.5625 * yoff - 0.5625 * zoff) +
+      press_NWT * (0.140625 + 0.5625 * xoff - 0.1875 * yoff - 0.1875 * zoff) +
+      press_SET * (0.140625 - 0.1875 * xoff + 0.5625 * yoff - 0.1875 * zoff) +
+      press_SWT * (0.046875 + 0.1875 * xoff + 0.1875 * yoff - 0.0625 * zoff) +
+      press_SWB * (0.015625 + 0.0625 * xoff + 0.0625 * yoff + 0.0625 * zoff) +
+      press_NWB * (0.046875 + 0.1875 * xoff - 0.0625 * yoff + 0.1875 * zoff) +
+      press_SEB * (0.046875 - 0.0625 * xoff + 0.1875 * yoff + 0.1875 * zoff) +
+      press_NEB * (0.140625 - 0.1875 * xoff - 0.1875 * yoff + 0.5625 * zoff);
+}
+//////////////////////////////////////////////////////////////////////////
+//Position NEB 0.25, 0.25, -0.25
+LBMReal CompressibleOffsetMomentsInterpolationProcessor::calcPressBNE()
+{
+   return   press_NET * (0.140625 - 0.1875 * xoff - 0.1875 * yoff - 0.5625 * zoff) +
+      press_NWT * (0.046875 + 0.1875 * xoff - 0.0625 * yoff - 0.1875 * zoff) +
+      press_SET * (0.046875 - 0.0625 * xoff + 0.1875 * yoff - 0.1875 * zoff) +
+      press_SWT * (0.015625 + 0.0625 * xoff + 0.0625 * yoff - 0.0625 * zoff) +
+      press_SWB * (0.046875 + 0.1875 * xoff + 0.1875 * yoff + 0.0625 * zoff) +
+      press_NWB * (0.140625 + 0.5625 * xoff - 0.1875 * yoff + 0.1875 * zoff) +
+      press_SEB * (0.140625 - 0.1875 * xoff + 0.5625 * yoff + 0.1875 * zoff) +
+      press_NEB * (0.421875 - 0.5625 * xoff - 0.5625 * yoff + 0.5625 * zoff);
+}
+//////////////////////////////////////////////////////////////////////////
+//Position C 0.0, 0.0, 0.0
+void CompressibleOffsetMomentsInterpolationProcessor::calcInterpolatedNodeFC(LBMReal* f, LBMReal omega)
+{
+   using namespace D3Q27System;
+
+   LBMReal press  =  press_NET * (0.125 - 0.25 * xoff - 0.25 * yoff - 0.25 * zoff) +
+      press_NWT * (0.125 + 0.25 * xoff - 0.25 * yoff - 0.25 * zoff) +
+      press_SET * (0.125 - 0.25 * xoff + 0.25 * yoff - 0.25 * zoff) +
+      press_SWT * (0.125 + 0.25 * xoff + 0.25 * yoff - 0.25 * zoff) +
+      press_NEB * (0.125 - 0.25 * xoff - 0.25 * yoff + 0.25 * zoff) +
+      press_NWB * (0.125 + 0.25 * xoff - 0.25 * yoff + 0.25 * zoff) +
+      press_SEB * (0.125 - 0.25 * xoff + 0.25 * yoff + 0.25 * zoff) +
+      press_SWB * (0.125 + 0.25 * xoff + 0.25 * yoff + 0.25 * zoff);
+   LBMReal vx1  = a0;
+   LBMReal vx2  = b0;
+   LBMReal vx3  = c0;
+
+   LBMReal rho = press ;//+ (ax+by+cz)/3.;
+
+   LBMReal eps_new = 2.;
+   LBMReal o  = omega;
+   //bulk viscosity
+   LBMReal oP = OxxPyyPzzC;
+
+   LBMReal mfcbb = zeroReal;
+   LBMReal mfabb = zeroReal;
+   LBMReal mfbcb = zeroReal;
+   LBMReal mfbab = zeroReal;
+   LBMReal mfbbc = zeroReal;
+   LBMReal mfbba = zeroReal;
+   LBMReal mfccb = zeroReal;
+   LBMReal mfaab = zeroReal;
+   LBMReal mfcab = zeroReal;
+   LBMReal mfacb = zeroReal;
+   LBMReal mfcbc = zeroReal;
+   LBMReal mfaba = zeroReal;
+   LBMReal mfcba = zeroReal;
+   LBMReal mfabc = zeroReal;
+   LBMReal mfbcc = zeroReal;
+   LBMReal mfbaa = zeroReal;
+   LBMReal mfbca = zeroReal;
+   LBMReal mfbac = zeroReal;
+   LBMReal mfbbb = zeroReal;
+   LBMReal mfccc = zeroReal;
+   LBMReal mfaac = zeroReal;
+   LBMReal mfcac = zeroReal;
+   LBMReal mfacc = zeroReal;
+   LBMReal mfcca = zeroReal;
+   LBMReal mfaaa = zeroReal;
+   LBMReal mfcaa = zeroReal;
+   LBMReal mfaca = zeroReal;
+
+   mfaaa = press; // if drho is interpolated directly
+
+   LBMReal vx1Sq = vx1*vx1;
+   LBMReal vx2Sq = vx2*vx2;
+   LBMReal vx3Sq = vx3*vx3;
+   LBMReal oMdrho = one;
+   //oMdrho = one - mfaaa;
+
+   //2.f
+   // linear combinations
+
+/////////////////////////
+   LBMReal mxxPyyPzz = mfaaa    -c2o3*(ax+by+cz)*eps_new/oP*(one+press);
+
+   LBMReal mxxMyy    = -c2o3*((ax - by)+kxxMyyAverage)*eps_new/o * (one + press);
+   LBMReal mxxMzz    = -c2o3*((ax - cz)+kxxMzzAverage)*eps_new/o * (one + press);
+
+   mfabb     = -c1o3 * ((bz + cy)+kyzAverage)*eps_new/o * (one + press);
+   mfbab     = -c1o3 * ((az + cx)+kxzAverage)*eps_new/o * (one + press);
+   mfbba     = -c1o3 * ((ay + bx)+kxyAverage)*eps_new/o * (one + press);
+
+   ////////////////////////
+   // linear combinations back
+   mfcaa = c1o3 * (mxxMyy +       mxxMzz + mxxPyyPzz);
+   mfaca = c1o3 * (-two * mxxMyy +       mxxMzz + mxxPyyPzz);
+   mfaac = c1o3 * (mxxMyy - two * mxxMzz + mxxPyyPzz);
+
+   //three
+   mfbbb = zeroReal;
+
+   LBMReal mxxyPyzz = zeroReal;
+   LBMReal mxxyMyzz = zeroReal;
+   LBMReal mxxzPyyz = zeroReal;
+   LBMReal mxxzMyyz = zeroReal;
+   LBMReal mxyyPxzz =  zeroReal;
+   LBMReal mxyyMxzz = zeroReal;
+
+   // linear combinations back
+   mfcba = (mxxyMyzz + mxxyPyzz) * c1o2;
+   mfabc = (-mxxyMyzz + mxxyPyzz) * c1o2;
+   mfcab = (mxxzMyyz + mxxzPyyz) * c1o2;
+   mfacb = (-mxxzMyyz + mxxzPyyz) * c1o2;
+   mfbca = (mxyyMxzz + mxyyPxzz) * c1o2;
+   mfbac = (-mxyyMxzz + mxyyPxzz) * c1o2;
+
+   //4.f
+   mfacc = mfaaa*c1o9;
+   mfcac = mfacc;
+   mfcca = mfacc;
+   //5.
+
+   //6.
+   mfccc = mfaaa*c1o27;
+   ////////////////////////////////////////////////////////////////////////////////////
+   //back
+   ////////////////////////////////////////////////////////////////////////////////////
+   //mit 1, 0, 1/3, 0, 0, 0, 1/3, 0, 1/9   Konditionieren
+   ////////////////////////////////////////////////////////////////////////////////////
+   // Z - Dir
+   LBMReal m0 =  mfaac * c1o2 +      mfaab * (vx3 - c1o2) + (mfaaa + one * oMdrho) * (vx3Sq - vx3) * c1o2;
+   LBMReal m1 = -mfaac        - two * mfaab *  vx3         +  mfaaa                * (one - vx3Sq)              - one * oMdrho * vx3Sq;
+   LBMReal m2 =  mfaac * c1o2 +      mfaab * (vx3 + c1o2) + (mfaaa + one * oMdrho) * (vx3Sq + vx3) * c1o2;
+   mfaaa = m0;
+   mfaab = m1;
+   mfaac = m2;
+   ////////////////////////////////////////////////////////////////////////////////////
+   m0 =  mfabc * c1o2 +      mfabb * (vx3 - c1o2) + mfaba * (vx3Sq - vx3) * c1o2;
+   m1 = -mfabc        - two * mfabb *  vx3         + mfaba * (one - vx3Sq);
+   m2 =  mfabc * c1o2 +      mfabb * (vx3 + c1o2) + mfaba * (vx3Sq + vx3) * c1o2;
+   mfaba = m0;
+   mfabb = m1;
+   mfabc = m2;
+   ////////////////////////////////////////////////////////////////////////////////////
+   m0 =  mfacc * c1o2 +      mfacb * (vx3 - c1o2) + (mfaca + c1o3 * oMdrho) * (vx3Sq - vx3) * c1o2;
+   m1 = -mfacc        - two * mfacb *  vx3         +  mfaca                  * (one - vx3Sq)              - c1o3 * oMdrho * vx3Sq;
+   m2 =  mfacc * c1o2 +      mfacb * (vx3 + c1o2) + (mfaca + c1o3 * oMdrho) * (vx3Sq + vx3) * c1o2;
+   mfaca = m0;
+   mfacb = m1;
+   mfacc = m2;
+   ////////////////////////////////////////////////////////////////////////////////////
+   ////////////////////////////////////////////////////////////////////////////////////
+   m0 =  mfbac * c1o2 +      mfbab * (vx3 - c1o2) + mfbaa * (vx3Sq - vx3) * c1o2;
+   m1 = -mfbac        - two * mfbab *  vx3         + mfbaa * (one - vx3Sq);
+   m2 =  mfbac * c1o2 +      mfbab * (vx3 + c1o2) + mfbaa * (vx3Sq + vx3) * c1o2;
+   mfbaa = m0;
+   mfbab = m1;
+   mfbac = m2;
+   /////////b//////////////////////////////////////////////////////////////////////////
+   m0 =  mfbbc * c1o2 +      mfbbb * (vx3 - c1o2) + mfbba * (vx3Sq - vx3) * c1o2;
+   m1 = -mfbbc        - two * mfbbb *  vx3         + mfbba * (one - vx3Sq);
+   m2 =  mfbbc * c1o2 +      mfbbb * (vx3 + c1o2) + mfbba * (vx3Sq + vx3) * c1o2;
+   mfbba = m0;
+   mfbbb = m1;
+   mfbbc = m2;
+   /////////b//////////////////////////////////////////////////////////////////////////
+   m0 =  mfbcc * c1o2 +      mfbcb * (vx3 - c1o2) + mfbca * (vx3Sq - vx3) * c1o2;
+   m1 = -mfbcc        - two * mfbcb *  vx3         + mfbca * (one - vx3Sq);
+   m2 =  mfbcc * c1o2 +      mfbcb * (vx3 + c1o2) + mfbca * (vx3Sq + vx3) * c1o2;
+   mfbca = m0;
+   mfbcb = m1;
+   mfbcc = m2;
+   ////////////////////////////////////////////////////////////////////////////////////
+   ////////////////////////////////////////////////////////////////////////////////////
+   m0 =  mfcac * c1o2 +      mfcab * (vx3 - c1o2) + (mfcaa + c1o3 * oMdrho) * (vx3Sq - vx3) * c1o2;
+   m1 = -mfcac        - two * mfcab *  vx3         +  mfcaa                  * (one - vx3Sq)              - c1o3 * oMdrho * vx3Sq;
+   m2 =  mfcac * c1o2 +      mfcab * (vx3 + c1o2) + (mfcaa + c1o3 * oMdrho) * (vx3Sq + vx3) * c1o2;
+   mfcaa = m0;
+   mfcab = m1;
+   mfcac = m2;
+   /////////c//////////////////////////////////////////////////////////////////////////
+   m0 =  mfcbc * c1o2 +      mfcbb * (vx3 - c1o2) + mfcba * (vx3Sq - vx3) * c1o2;
+   m1 = -mfcbc        - two * mfcbb *  vx3         + mfcba * (one - vx3Sq);
+   m2 =  mfcbc * c1o2 +      mfcbb * (vx3 + c1o2) + mfcba * (vx3Sq + vx3) * c1o2;
+   mfcba = m0;
+   mfcbb = m1;
+   mfcbc = m2;
+   /////////c//////////////////////////////////////////////////////////////////////////
+   m0 =  mfccc * c1o2 +      mfccb * (vx3 - c1o2) + (mfcca + c1o9 * oMdrho) * (vx3Sq - vx3) * c1o2;
+   m1 = -mfccc        - two * mfccb *  vx3         +  mfcca                  * (one - vx3Sq)              - c1o9 * oMdrho * vx3Sq;
+   m2 =  mfccc * c1o2 +      mfccb * (vx3 + c1o2) + (mfcca + c1o9 * oMdrho) * (vx3Sq + vx3) * c1o2;
+   mfcca = m0;
+   mfccb = m1;
+   mfccc = m2;
+   ////////////////////////////////////////////////////////////////////////////////////
+   ////////////////////////////////////////////////////////////////////////////////////
+   //mit 1/6, 2/3, 1/6, 0, 0, 0, 1/18, 2/9, 1/18   Konditionieren
+   ////////////////////////////////////////////////////////////////////////////////////
+   // Y - Dir
+   m0 =  mfaca * c1o2 +      mfaba * (vx2 - c1o2) + (mfaaa + c1o6 * oMdrho) * (vx2Sq - vx2) * c1o2;
+   m1 = -mfaca        - two * mfaba *  vx2         +  mfaaa                  * (one - vx2Sq)              - c1o6 * oMdrho * vx2Sq;
+   m2 =  mfaca * c1o2 +      mfaba * (vx2 + c1o2) + (mfaaa + c1o6 * oMdrho) * (vx2Sq + vx2) * c1o2;
+   mfaaa = m0;
+   mfaba = m1;
+   mfaca = m2;
+   ////////////////////////////////////////////////////////////////////////////////////
+   m0 =  mfacb * c1o2 +      mfabb * (vx2 - c1o2) + (mfaab + c2o3 * oMdrho) * (vx2Sq - vx2) * c1o2;
+   m1 = -mfacb        - two * mfabb *  vx2         +  mfaab                  * (one - vx2Sq)              - c2o3 * oMdrho * vx2Sq;
+   m2 =  mfacb * c1o2 +      mfabb * (vx2 + c1o2) + (mfaab + c2o3 * oMdrho) * (vx2Sq + vx2) * c1o2;
+   mfaab = m0;
+   mfabb = m1;
+   mfacb = m2;
+   ////////////////////////////////////////////////////////////////////////////////////
+   m0 =  mfacc * c1o2 +      mfabc * (vx2 - c1o2) + (mfaac + c1o6 * oMdrho) * (vx2Sq - vx2) * c1o2;
+   m1 = -mfacc        - two * mfabc *  vx2         +  mfaac                  * (one - vx2Sq)              - c1o6 * oMdrho * vx2Sq;
+   m2 =  mfacc * c1o2 +      mfabc * (vx2 + c1o2) + (mfaac + c1o6 * oMdrho) * (vx2Sq + vx2) * c1o2;
+   mfaac = m0;
+   mfabc = m1;
+   mfacc = m2;
+   ////////////////////////////////////////////////////////////////////////////////////
+   ////////////////////////////////////////////////////////////////////////////////////
+   m0 =  mfbca * c1o2 +      mfbba * (vx2 - c1o2) + mfbaa * (vx2Sq - vx2) * c1o2;
+   m1 = -mfbca        - two * mfbba *  vx2         + mfbaa * (one - vx2Sq);
+   m2 =  mfbca * c1o2 +      mfbba * (vx2 + c1o2) + mfbaa * (vx2Sq + vx2) * c1o2;
+   mfbaa = m0;
+   mfbba = m1;
+   mfbca = m2;
+   /////////b//////////////////////////////////////////////////////////////////////////
+   m0 =  mfbcb * c1o2 +      mfbbb * (vx2 - c1o2) + mfbab * (vx2Sq - vx2) * c1o2;
+   m1 = -mfbcb        - two * mfbbb *  vx2         + mfbab * (one - vx2Sq);
+   m2 =  mfbcb * c1o2 +      mfbbb * (vx2 + c1o2) + mfbab * (vx2Sq + vx2) * c1o2;
+   mfbab = m0;
+   mfbbb = m1;
+   mfbcb = m2;
+   /////////b//////////////////////////////////////////////////////////////////////////
+   m0 =  mfbcc * c1o2 +      mfbbc * (vx2 - c1o2) + mfbac * (vx2Sq - vx2) * c1o2;
+   m1 = -mfbcc        - two * mfbbc *  vx2         + mfbac * (one - vx2Sq);
+   m2 =  mfbcc * c1o2 +      mfbbc * (vx2 + c1o2) + mfbac * (vx2Sq + vx2) * c1o2;
+   mfbac = m0;
+   mfbbc = m1;
+   mfbcc = m2;
+   ////////////////////////////////////////////////////////////////////////////////////
+   ////////////////////////////////////////////////////////////////////////////////////
+   m0 =  mfcca * c1o2 +      mfcba * (vx2 - c1o2) + (mfcaa + c1o18 * oMdrho) * (vx2Sq - vx2) * c1o2;
+   m1 = -mfcca        - two * mfcba *  vx2         +  mfcaa                   * (one - vx2Sq)              - c1o18 * oMdrho * vx2Sq;
+   m2 =  mfcca * c1o2 +      mfcba * (vx2 + c1o2) + (mfcaa + c1o18 * oMdrho) * (vx2Sq + vx2) * c1o2;
+   mfcaa = m0;
+   mfcba = m1;
+   mfcca = m2;
+   /////////c//////////////////////////////////////////////////////////////////////////
+   m0 =  mfccb * c1o2 +      mfcbb * (vx2 - c1o2) + (mfcab + c2o9 * oMdrho) * (vx2Sq - vx2) * c1o2;
+   m1 = -mfccb        - two * mfcbb *  vx2         +  mfcab                  * (one - vx2Sq)              - c2o9 * oMdrho * vx2Sq;
+   m2 =  mfccb * c1o2 +      mfcbb * (vx2 + c1o2) + (mfcab + c2o9 * oMdrho) * (vx2Sq + vx2) * c1o2;
+   mfcab = m0;
+   mfcbb = m1;
+   mfccb = m2;
+   /////////c//////////////////////////////////////////////////////////////////////////
+   m0 =  mfccc * c1o2 +      mfcbc * (vx2 - c1o2) + (mfcac + c1o18 * oMdrho) * (vx2Sq - vx2) * c1o2;
+   m1 = -mfccc        - two * mfcbc *  vx2         +  mfcac                   * (one - vx2Sq)              - c1o18 * oMdrho * vx2Sq;
+   m2 =  mfccc * c1o2 +      mfcbc * (vx2 + c1o2) + (mfcac + c1o18 * oMdrho) * (vx2Sq + vx2) * c1o2;
+   mfcac = m0;
+   mfcbc = m1;
+   mfccc = m2;
+   ////////////////////////////////////////////////////////////////////////////////////
+   ////////////////////////////////////////////////////////////////////////////////////
+   //mit 1/36, 1/9, 1/36, 1/9, 4/9, 1/9, 1/36, 1/9, 1/36 Konditionieren
+   ////////////////////////////////////////////////////////////////////////////////////
+   // X - Dir
+   m0 =  mfcaa * c1o2 +      mfbaa * (vx1 - c1o2) + (mfaaa + c1o36 * oMdrho) * (vx1Sq - vx1) * c1o2;
+   m1 = -mfcaa        - two * mfbaa *  vx1         +  mfaaa                   * (one - vx1Sq)              - c1o36 * oMdrho * vx1Sq;
+   m2 =  mfcaa * c1o2 +      mfbaa * (vx1 + c1o2) + (mfaaa + c1o36 * oMdrho) * (vx1Sq + vx1) * c1o2;
+   mfaaa = m0;
+   mfbaa = m1;
+   mfcaa = m2;
+   ////////////////////////////////////////////////////////////////////////////////////
+   m0 =  mfcba * c1o2 +      mfbba * (vx1 - c1o2) + (mfaba + c1o9 * oMdrho) * (vx1Sq - vx1) * c1o2;
+   m1 = -mfcba        - two * mfbba *  vx1         +  mfaba                  * (one - vx1Sq)              - c1o9 * oMdrho * vx1Sq;
+   m2 =  mfcba * c1o2 +      mfbba * (vx1 + c1o2) + (mfaba + c1o9 * oMdrho) * (vx1Sq + vx1) * c1o2;
+   mfaba = m0;
+   mfbba = m1;
+   mfcba = m2;
+   ////////////////////////////////////////////////////////////////////////////////////
+   m0 =  mfcca * c1o2 +      mfbca * (vx1 - c1o2) + (mfaca + c1o36 * oMdrho) * (vx1Sq - vx1) * c1o2;
+   m1 = -mfcca        - two * mfbca *  vx1         +  mfaca                   * (one - vx1Sq)              - c1o36 * oMdrho * vx1Sq;
+   m2 =  mfcca * c1o2 +      mfbca * (vx1 + c1o2) + (mfaca + c1o36 * oMdrho) * (vx1Sq + vx1) * c1o2;
+   mfaca = m0;
+   mfbca = m1;
+   mfcca = m2;
+   ////////////////////////////////////////////////////////////////////////////////////
+   ////////////////////////////////////////////////////////////////////////////////////
+   m0 =  mfcab * c1o2 +      mfbab * (vx1 - c1o2) + (mfaab + c1o9 * oMdrho) * (vx1Sq - vx1) * c1o2;
+   m1 = -mfcab        - two * mfbab *  vx1         +  mfaab                  * (one - vx1Sq)              - c1o9 * oMdrho * vx1Sq;
+   m2 =  mfcab * c1o2 +      mfbab * (vx1 + c1o2) + (mfaab + c1o9 * oMdrho) * (vx1Sq + vx1) * c1o2;
+   mfaab = m0;
+   mfbab = m1;
+   mfcab = m2;
+   ///////////b////////////////////////////////////////////////////////////////////////
+   m0 =  mfcbb * c1o2 +      mfbbb * (vx1 - c1o2) + (mfabb + c4o9 * oMdrho) * (vx1Sq - vx1) * c1o2;
+   m1 = -mfcbb        - two * mfbbb *  vx1         +  mfabb                  * (one - vx1Sq)              - c4o9 * oMdrho * vx1Sq;
+   m2 =  mfcbb * c1o2 +      mfbbb * (vx1 + c1o2) + (mfabb + c4o9 * oMdrho) * (vx1Sq + vx1) * c1o2;
+   mfabb = m0;
+   mfbbb = m1;
+   mfcbb = m2;
+   ///////////b////////////////////////////////////////////////////////////////////////
+   m0 =  mfccb * c1o2 +      mfbcb * (vx1 - c1o2) + (mfacb + c1o9 * oMdrho) * (vx1Sq - vx1) * c1o2;
+   m1 = -mfccb        - two * mfbcb *  vx1         +  mfacb                  * (one - vx1Sq)              - c1o9 * oMdrho * vx1Sq;
+   m2 =  mfccb * c1o2 +      mfbcb * (vx1 + c1o2) + (mfacb + c1o9 * oMdrho) * (vx1Sq + vx1) * c1o2;
+   mfacb = m0;
+   mfbcb = m1;
+   mfccb = m2;
+   ////////////////////////////////////////////////////////////////////////////////////
+   ////////////////////////////////////////////////////////////////////////////////////
+   m0 =  mfcac * c1o2 +      mfbac * (vx1 - c1o2) + (mfaac + c1o36 * oMdrho) * (vx1Sq - vx1) * c1o2;
+   m1 = -mfcac        - two * mfbac *  vx1         +  mfaac                   * (one - vx1Sq)              - c1o36 * oMdrho * vx1Sq;
+   m2 =  mfcac * c1o2 +      mfbac * (vx1 + c1o2) + (mfaac + c1o36 * oMdrho) * (vx1Sq + vx1) * c1o2;
+   mfaac = m0;
+   mfbac = m1;
+   mfcac = m2;
+   ///////////c////////////////////////////////////////////////////////////////////////
+   m0 =  mfcbc * c1o2 +      mfbbc * (vx1 - c1o2) + (mfabc + c1o9 * oMdrho) * (vx1Sq - vx1) * c1o2;
+   m1 = -mfcbc        - two * mfbbc *  vx1         +  mfabc                  * (one - vx1Sq)              - c1o9 * oMdrho * vx1Sq;
+   m2 =  mfcbc * c1o2 +      mfbbc * (vx1 + c1o2) + (mfabc + c1o9 * oMdrho) * (vx1Sq + vx1) * c1o2;
+   mfabc = m0;
+   mfbbc = m1;
+   mfcbc = m2;
+   ///////////c////////////////////////////////////////////////////////////////////////
+   m0 =  mfccc * c1o2 +      mfbcc * (vx1 - c1o2) + (mfacc + c1o36 * oMdrho) * (vx1Sq - vx1) * c1o2;
+   m1 = -mfccc        - two * mfbcc *  vx1         +  mfacc                   * (one - vx1Sq)              - c1o36 * oMdrho * vx1Sq;
+   m2 =  mfccc * c1o2 +      mfbcc * (vx1 + c1o2) + (mfacc + c1o36 * oMdrho) * (vx1Sq + vx1) * c1o2;
+   mfacc = m0;
+   mfbcc = m1;
+   mfccc = m2;
+   ////////////////////////////////////////////////////////////////////////////////////
+
+   f[E]    = mfcbb;
+   f[W]    = mfabb;
+   f[N]    = mfbcb;
+   f[S]    = mfbab;
+   f[T]    = mfbbc;
+   f[B]    = mfbba;
+   f[NE]   = mfccb;
+   f[SW]   = mfaab;
+   f[SE]   = mfcab;
+   f[NW]   = mfacb;
+   f[TE]   = mfcbc;
+   f[BW]   = mfaba;
+   f[BE]   = mfcba;
+   f[TW]   = mfabc;
+   f[TN]   = mfbcc;
+   f[BS]   = mfbaa;
+   f[BN]   = mfbca;
+   f[TS]   = mfbac;
+   f[ZERO] = mfbbb;
+   f[TNE]  = mfccc;
+   f[TSE]  = mfcac;
+   f[BNE]  = mfcca;
+   f[BSE]  = mfcaa;
+   f[TNW]  = mfacc;
+   f[TSW]  = mfaac;
+   f[BNW]  = mfaca;
+   f[BSW]  = mfaaa;
+}
+//////////////////////////////////////////////////////////////////////////
+void CompressibleOffsetMomentsInterpolationProcessor::calcInterpolatedVelocity(LBMReal x, LBMReal y, LBMReal z, LBMReal& vx1, LBMReal& vx2, LBMReal& vx3)
+{
+	vx1  = a0 + ax*x + ay*y + az*z + axx*x*x + ayy*y*y + azz*z*z + axy*x*y + axz*x*z + ayz*y*z+axyz*x*y*z;
+	vx2  = b0 + bx*x + by*y + bz*z + bxx*x*x + byy*y*y + bzz*z*z + bxy*x*y + bxz*x*z + byz*y*z+bxyz*x*y*z;
+	vx3  = c0 + cx*x + cy*y + cz*z + cxx*x*x + cyy*y*y + czz*z*z + cxy*x*y + cxz*x*z + cyz*y*z+cxyz*x*y*z;
+}
+//////////////////////////////////////////////////////////////////////////
+void CompressibleOffsetMomentsInterpolationProcessor::calcInterpolatedShearStress(LBMReal x, LBMReal y, LBMReal z,LBMReal& tauxx, LBMReal& tauyy, LBMReal& tauzz,LBMReal& tauxy, LBMReal& tauxz, LBMReal& tauyz)
+{
+	tauxx=ax+2*axx*x+axy*y+axz*z+axyz*y*z;
+	tauyy=by+2*byy*y+bxy*x+byz*z+bxyz*x*z;
+	tauzz=cz+2*czz*z+cxz*x+cyz*y+cxyz*x*y;
+	tauxy=0.5*((ay+2.0*ayy*y+axy*x+ayz*z+axyz*x*z)+(bx+2.0*bxx*x+bxy*y+bxz*z+bxyz*y*z));
+	tauxz=0.5*((az+2.0*azz*z+axz*x+ayz*y+axyz*x*y)+(cx+2.0*cxx*x+cxy*y+cxz*z+cxyz*y*z));
+	tauyz=0.5*((bz+2.0*bzz*z+bxz*x+byz*y+bxyz*x*y)+(cy+2.0*cyy*y+cxy*x+cyz*z+cxyz*x*z));
+}
+//////////////////////////////////////////////////////////////////////////
+void CompressibleOffsetMomentsInterpolationProcessor::setBulkViscosity(LBMReal shearViscosity, LBMReal bulkViscosity)
+{
+   this->shearViscosity = shearViscosity;
+   this->bulkViscosity  = bulkViscosity;
+}
+
diff --git a/src/cpu/VirtualFluidsCore/LBM/CompressibleOffsetMomentsInterpolationProcessor.h b/src/cpu/VirtualFluidsCore/LBM/CompressibleOffsetMomentsInterpolationProcessor.h
index 8b40c00d2b957428fc19c09a26cdbf3bca74dd20..20bffa4a68fdb10a4efdd3b1df1f26eceab287ec 100644
--- a/src/cpu/VirtualFluidsCore/LBM/CompressibleOffsetMomentsInterpolationProcessor.h
+++ b/src/cpu/VirtualFluidsCore/LBM/CompressibleOffsetMomentsInterpolationProcessor.h
@@ -1,82 +1,82 @@
-#ifndef CompressibleOffsetMomentsInterpolationProcessor_H_
-#define CompressibleOffsetMomentsInterpolationProcessor_H_
-
-#include "InterpolationProcessor.h"
-#include "D3Q27System.h"
-
-//////////////////////////////////////////////////////////////////////////
-//it works only for cascaded LBM
-//super compact interpolation method by Martin Geier
-//////////////////////////////////////////////////////////////////////////
-
-class CompressibleOffsetMomentsInterpolationProcessor;
-
-class CompressibleOffsetMomentsInterpolationProcessor : public InterpolationProcessor
-{
-public:
-   CompressibleOffsetMomentsInterpolationProcessor();
-   CompressibleOffsetMomentsInterpolationProcessor(LBMReal omegaC, LBMReal omegaF);
-   virtual ~CompressibleOffsetMomentsInterpolationProcessor();
-   InterpolationProcessorPtr clone();
-   void setOmegas(LBMReal omegaC, LBMReal omegaF);
-   void interpolateCoarseToFine(D3Q27ICell& icellC, D3Q27ICell& icellF);
-   void interpolateCoarseToFine(D3Q27ICell& icellC, D3Q27ICell& icellF, LBMReal xoff, LBMReal yoff, LBMReal zoff);
-   void interpolateFineToCoarse(D3Q27ICell& icellF, LBMReal* icellC); 
-   void interpolateFineToCoarse(D3Q27ICell& icellF, LBMReal* icellC, LBMReal xoff, LBMReal yoff, LBMReal zoff); 
-   void setBulkViscosity(LBMReal shearViscosity, LBMReal bulkViscosity);
-protected:   
-private:
-   LBMReal omegaC, omegaF;
-   LBMReal a0, ax, ay, az, axx, ayy, azz, axy, axz, ayz, b0, bx, by, bz, bxx, byy, bzz, bxy, bxz, byz, c0, cx, cy, cz, cxx, cyy, czz, cxy, cxz, cyz, axyz, bxyz, cxyz;
-   LBMReal xoff,    yoff,    zoff;
-   LBMReal xoff_sq, yoff_sq, zoff_sq;
-   LBMReal press_SWT, press_NWT, press_NET, press_SET, press_SWB, press_NWB, press_NEB, press_SEB;
-
-   LBMReal  f_E,  f_N,  f_T,  f_NE,  f_SE,  f_BE,  f_TE,  f_TN,  f_BN,  f_TNE,  f_TNW,  f_TSE,  f_TSW,  f_ZERO;
-   LBMReal  x_E,  x_N,  x_T,  x_NE,  x_SE,  x_BE,  x_TE,  x_TN,  x_BN,  x_TNE,  x_TNW,  x_TSE,  x_TSW,  x_ZERO;
-   LBMReal  y_E,  y_N,  y_T,  y_NE,  y_SE,  y_BE,  y_TE,  y_TN,  y_BN,  y_TNE,  y_TNW,  y_TSE,  y_TSW,  y_ZERO;
-   LBMReal  z_E,  z_N,  z_T,  z_NE,  z_SE,  z_BE,  z_TE,  z_TN,  z_BN,  z_TNE,  z_TNW,  z_TSE,  z_TSW,  z_ZERO;
-   LBMReal xy_E, xy_N, xy_T, xy_NE, xy_SE, xy_BE, xy_TE, xy_TN, xy_BN, xy_TNE, xy_TNW, xy_TSE, xy_TSW/*, xy_ZERO*/;
-   LBMReal xz_E, xz_N, xz_T, xz_NE, xz_SE, xz_BE, xz_TE, xz_TN, xz_BN, xz_TNE, xz_TNW, xz_TSE, xz_TSW/*, xz_ZERO*/;
-   LBMReal yz_E, yz_N, yz_T, yz_NE, yz_SE, yz_BE, yz_TE, yz_TN, yz_BN, yz_TNE, yz_TNW, yz_TSE, yz_TSW/*, yz_ZERO*/;
-
-   LBMReal kxyAverage, kyzAverage, kxzAverage, kxxMyyAverage, kxxMzzAverage; 
-
-   LBMReal a,b,c;
-
-   // bulk viscosity
-   LBMReal shearViscosity;
-   LBMReal bulkViscosity;
-   LBMReal OxxPyyPzzC;
-   LBMReal OxxPyyPzzF;
-
-   void setOffsets(LBMReal xoff, LBMReal yoff, LBMReal zoff);
-   void calcMoments(const LBMReal* const f, LBMReal omega, LBMReal& rho, LBMReal& vx1, LBMReal& vx2, LBMReal& vx3, 
-      LBMReal& kxy, LBMReal& kyz, LBMReal& kxz, LBMReal& kxxMyy, LBMReal& kxxMzz);
-   void calcInterpolatedCoefficiets(const D3Q27ICell& icell, LBMReal omega, LBMReal eps_new);
-   void calcInterpolatedNodeCF(LBMReal* f, LBMReal omega, LBMReal x, LBMReal y, LBMReal z, LBMReal press, LBMReal xs, LBMReal ys, LBMReal zs);
-   LBMReal calcPressBSW();
-   LBMReal calcPressTSW();
-   LBMReal calcPressTSE();
-   LBMReal calcPressBSE();
-   LBMReal calcPressBNW();
-   LBMReal calcPressTNW();
-   LBMReal calcPressTNE();
-   LBMReal calcPressBNE();
-   void calcInterpolatedNodeFC(LBMReal* f, LBMReal omega);
-   void calcInterpolatedVelocity(LBMReal x, LBMReal y, LBMReal z,LBMReal& vx1, LBMReal& vx2, LBMReal& vx3);
-   void calcInterpolatedShearStress(LBMReal x, LBMReal y, LBMReal z,LBMReal& tauxx, LBMReal& tauyy, LBMReal& tauzz,LBMReal& tauxy, LBMReal& tauxz, LBMReal& tauyz);
-};
-
-//////////////////////////////////////////////////////////////////////////
-inline void CompressibleOffsetMomentsInterpolationProcessor::interpolateCoarseToFine(D3Q27ICell& icellC, D3Q27ICell& icellF)
-{
-   this->interpolateCoarseToFine(icellC, icellF, 0.0, 0.0, 0.0);
-}
-//////////////////////////////////////////////////////////////////////////
-inline void CompressibleOffsetMomentsInterpolationProcessor::interpolateFineToCoarse(D3Q27ICell& icellF, LBMReal* icellC)
-{
-   this->interpolateFineToCoarse(icellF, icellC, 0.0, 0.0, 0.0);
-}
-
-#endif
+#ifndef CompressibleOffsetMomentsInterpolationProcessor_H_
+#define CompressibleOffsetMomentsInterpolationProcessor_H_
+
+#include "InterpolationProcessor.h"
+#include "D3Q27System.h"
+
+//////////////////////////////////////////////////////////////////////////
+//it works only for cascaded LBM
+//super compact interpolation method by Martin Geier
+//////////////////////////////////////////////////////////////////////////
+
+class CompressibleOffsetMomentsInterpolationProcessor;
+
+class CompressibleOffsetMomentsInterpolationProcessor : public InterpolationProcessor
+{
+public:
+   CompressibleOffsetMomentsInterpolationProcessor();
+   CompressibleOffsetMomentsInterpolationProcessor(LBMReal omegaC, LBMReal omegaF);
+   virtual ~CompressibleOffsetMomentsInterpolationProcessor();
+   InterpolationProcessorPtr clone();
+   void setOmegas(LBMReal omegaC, LBMReal omegaF);
+   void interpolateCoarseToFine(D3Q27ICell& icellC, D3Q27ICell& icellF);
+   void interpolateCoarseToFine(D3Q27ICell& icellC, D3Q27ICell& icellF, LBMReal xoff, LBMReal yoff, LBMReal zoff);
+   void interpolateFineToCoarse(D3Q27ICell& icellF, LBMReal* icellC); 
+   void interpolateFineToCoarse(D3Q27ICell& icellF, LBMReal* icellC, LBMReal xoff, LBMReal yoff, LBMReal zoff); 
+   void setBulkViscosity(LBMReal shearViscosity, LBMReal bulkViscosity);
+protected:   
+private:
+   LBMReal omegaC, omegaF;
+   LBMReal a0, ax, ay, az, axx, ayy, azz, axy, axz, ayz, b0, bx, by, bz, bxx, byy, bzz, bxy, bxz, byz, c0, cx, cy, cz, cxx, cyy, czz, cxy, cxz, cyz, axyz, bxyz, cxyz;
+   LBMReal xoff,    yoff,    zoff;
+   LBMReal xoff_sq, yoff_sq, zoff_sq;
+   LBMReal press_SWT, press_NWT, press_NET, press_SET, press_SWB, press_NWB, press_NEB, press_SEB;
+
+   LBMReal  f_E,  f_N,  f_T,  f_NE,  f_SE,  f_BE,  f_TE,  f_TN,  f_BN,  f_TNE,  f_TNW,  f_TSE,  f_TSW,  f_ZERO;
+   LBMReal  x_E,  x_N,  x_T,  x_NE,  x_SE,  x_BE,  x_TE,  x_TN,  x_BN,  x_TNE,  x_TNW,  x_TSE,  x_TSW,  x_ZERO;
+   LBMReal  y_E,  y_N,  y_T,  y_NE,  y_SE,  y_BE,  y_TE,  y_TN,  y_BN,  y_TNE,  y_TNW,  y_TSE,  y_TSW,  y_ZERO;
+   LBMReal  z_E,  z_N,  z_T,  z_NE,  z_SE,  z_BE,  z_TE,  z_TN,  z_BN,  z_TNE,  z_TNW,  z_TSE,  z_TSW,  z_ZERO;
+   LBMReal xy_E, xy_N, xy_T, xy_NE, xy_SE, xy_BE, xy_TE, xy_TN, xy_BN, xy_TNE, xy_TNW, xy_TSE, xy_TSW/*, xy_ZERO*/;
+   LBMReal xz_E, xz_N, xz_T, xz_NE, xz_SE, xz_BE, xz_TE, xz_TN, xz_BN, xz_TNE, xz_TNW, xz_TSE, xz_TSW/*, xz_ZERO*/;
+   LBMReal yz_E, yz_N, yz_T, yz_NE, yz_SE, yz_BE, yz_TE, yz_TN, yz_BN, yz_TNE, yz_TNW, yz_TSE, yz_TSW/*, yz_ZERO*/;
+
+   LBMReal kxyAverage, kyzAverage, kxzAverage, kxxMyyAverage, kxxMzzAverage; 
+
+   LBMReal a,b,c;
+
+   // bulk viscosity
+   LBMReal shearViscosity;
+   LBMReal bulkViscosity;
+   LBMReal OxxPyyPzzC;
+   LBMReal OxxPyyPzzF;
+
+   void setOffsets(LBMReal xoff, LBMReal yoff, LBMReal zoff);
+   void calcMoments(const LBMReal* const f, LBMReal omega, LBMReal& rho, LBMReal& vx1, LBMReal& vx2, LBMReal& vx3, 
+      LBMReal& kxy, LBMReal& kyz, LBMReal& kxz, LBMReal& kxxMyy, LBMReal& kxxMzz);
+   void calcInterpolatedCoefficiets(const D3Q27ICell& icell, LBMReal omega, LBMReal eps_new);
+   void calcInterpolatedNodeCF(LBMReal* f, LBMReal omega, LBMReal x, LBMReal y, LBMReal z, LBMReal press, LBMReal xs, LBMReal ys, LBMReal zs);
+   LBMReal calcPressBSW();
+   LBMReal calcPressTSW();
+   LBMReal calcPressTSE();
+   LBMReal calcPressBSE();
+   LBMReal calcPressBNW();
+   LBMReal calcPressTNW();
+   LBMReal calcPressTNE();
+   LBMReal calcPressBNE();
+   void calcInterpolatedNodeFC(LBMReal* f, LBMReal omega);
+   void calcInterpolatedVelocity(LBMReal x, LBMReal y, LBMReal z,LBMReal& vx1, LBMReal& vx2, LBMReal& vx3);
+   void calcInterpolatedShearStress(LBMReal x, LBMReal y, LBMReal z,LBMReal& tauxx, LBMReal& tauyy, LBMReal& tauzz,LBMReal& tauxy, LBMReal& tauxz, LBMReal& tauyz);
+};
+
+//////////////////////////////////////////////////////////////////////////
+inline void CompressibleOffsetMomentsInterpolationProcessor::interpolateCoarseToFine(D3Q27ICell& icellC, D3Q27ICell& icellF)
+{
+   this->interpolateCoarseToFine(icellC, icellF, 0.0, 0.0, 0.0);
+}
+//////////////////////////////////////////////////////////////////////////
+inline void CompressibleOffsetMomentsInterpolationProcessor::interpolateFineToCoarse(D3Q27ICell& icellF, LBMReal* icellC)
+{
+   this->interpolateFineToCoarse(icellF, icellC, 0.0, 0.0, 0.0);
+}
+
+#endif
diff --git a/src/cpu/VirtualFluidsCore/LBM/D3Q27System.cpp b/src/cpu/VirtualFluidsCore/LBM/D3Q27System.cpp
index 07a4528b71eac350ee0b1ece54e3934ba28fae1f..ec791cbb30b718c34bf091bf440464de08d09d6c 100644
--- a/src/cpu/VirtualFluidsCore/LBM/D3Q27System.cpp
+++ b/src/cpu/VirtualFluidsCore/LBM/D3Q27System.cpp
@@ -1,197 +1,197 @@
-#include "D3Q27System.h"
-namespace D3Q27System
-{
-    using namespace UbMath;
-
-    //index             0   1   2   3   4   5  6   7   8    9  10  11  12  13  14  15  16  17  18//falsch
-    //f:              ZERO, E,  W,  N,  S,  T,  B, NE, SW, SE, NW, TE, BW, BE, TW, TN, BS, BN, TS, TNE TNW TSE TSW BNE BNW BSE BSW
-    //const int EX1[] = { 0,  1, -1,  0,  0,  0,  0,  1, -1,  1, -1,  1, -1,  1, -1,  0,  0,  0,  0,  1, -1,  1, -1,  1, -1,  1, -1 };
-    //const int EX2[] = { 0,  0,  0,  1, -1,  0,  0,  1, -1, -1,  1,  0,  0,  0,  0,  1, -1,  1, -1,  1,  1, -1, -1,  1,  1, -1, -1 };
-    //const int EX3[] = { 0,  0,  0,  0,  0,  1, -1,  0,  0,  0,  0,  1, -1, -1,  1,  1, -1, -1,  1,  1,  1,  1,  1, -1, -1, -1, -1 };
-
-    //index             0   1   2   3   4   5  6   7   8    9  10  11  12  13  14  15  16  17  18
-    //f:                E,  W,  N,  S,  T,  B, NE, SW, SE, NW, TE, BW, BE, TW, TN, BS, BN, TS, TNE TNW TSE TSW BNE BNW BSE BSW
-    const int DX1[] = { 1, -1,  0,  0,  0,  0,  1, -1,  1, -1,  1, -1,  1, -1,  0,  0,  0,  0,  1, -1,  1, -1,  1, -1,  1, -1 };
-    const int DX2[] = { 0,  0,  1, -1,  0,  0,  1, -1, -1,  1,  0,  0,  0,  0,  1, -1,  1, -1,  1,  1, -1, -1,  1,  1, -1, -1 };
-    const int DX3[] = { 0,  0,  0,  0,  1, -1,  0,  0,  0,  0,  1, -1, -1,  1,  1, -1, -1,  1,  1,  1,  1,  1, -1, -1, -1, -1 };
-
-    ////index                0   1   2   3   4   5  6   7   8    9  10  11  12  13  14  15  16  17  18
-    ////f:                   E,  W,  N,  S,  T,  B, NE, SW, SE, NW, TE, BW, BE, TW, TN, BS, BN, TS, TNE TNW TSE TSW BNE BNW BSE BSW
-    const double WEIGTH[] = { c2o27, c2o27,  c2o27,  c2o27,  c2o27,  c2o27,  c1o54, c1o54, c1o54, c1o54, c1o54, c1o54, c1o54, c1o54, c1o54, c1o54, c1o54, c1o54, c1o216, c1o216, c1o216, c1o216, c1o216, c1o216, c1o216, c1o216 , c8o27 };
-
-
-    const int INVDIR[] = {
-                           INV_E,
-                           INV_W,
-                           INV_N,
-                           INV_S,
-                           INV_T,
-                           INV_B,
-                           INV_NE,
-                           INV_SW,
-                           INV_SE,
-                           INV_NW,
-                           INV_TE,
-                           INV_BW,
-                           INV_BE,
-                           INV_TW,
-                           INV_TN,
-                           INV_BS,
-                           INV_BN,
-                           INV_TS,
-                           INV_TNE,
-                           INV_TNW,
-                           INV_TSE,
-                           INV_TSW,
-                           INV_BNE,
-                           INV_BNW,
-                           INV_BSE,
-                           INV_BSW };
-
-
-    // The x,y,z component for each normalized direction
-    const double cNorm[3][ENDDIR] = {
-        {
-            double(DX1[0]), double(DX1[1]),
-            double(DX1[2]), double(DX1[3]),
-            double(DX1[4]), double(DX1[5]),
-            double(DX1[6]) / std::sqrt(double(2)), double(DX1[7]) / std::sqrt(double(2)),
-            double(DX1[8]) / std::sqrt(double(2)), double(DX1[9]) / std::sqrt(double(2)),
-            double(DX1[10]) / std::sqrt(double(2)), double(DX1[11]) / std::sqrt(double(2)),
-            double(DX1[12]) / std::sqrt(double(2)), double(DX1[13]) / std::sqrt(double(2)),
-            double(DX1[14]), double(DX1[15]),
-            double(DX1[16]), double(DX1[17]),
-            double(DX1[18]) / std::sqrt(double(3)), double(DX1[19]) / std::sqrt(double(3)),
-            double(DX1[20]) / std::sqrt(double(3)), double(DX1[21]) / std::sqrt(double(3)),
-            double(DX1[22]) / std::sqrt(double(3)), double(DX1[23]) / std::sqrt(double(3)),
-            double(DX1[24]) / std::sqrt(double(3)), double(DX1[25]) / std::sqrt(double(3))
-        },{
-            double(DX2[0]), double(DX2[1]),
-            double(DX2[2]), double(DX2[3]),
-            double(DX2[4]), double(DX2[5]),
-            double(DX2[6]) / std::sqrt(double(2)), double(DX2[7]) / std::sqrt(double(2)),
-            double(DX2[8]) / std::sqrt(double(2)), double(DX2[9]) / std::sqrt(double(2)),
-            double(DX2[10]), double(DX2[11]),
-            double(DX2[12]), double(DX2[13]),
-            double(DX2[14]) / std::sqrt(double(2)), double(DX2[15]) / std::sqrt(double(2)),
-            double(DX2[16]) / std::sqrt(double(2)), double(DX2[17]) / std::sqrt(double(2)),
-            double(DX2[18]) / std::sqrt(double(3)), double(DX2[19]) / std::sqrt(double(3)),
-            double(DX2[20]) / std::sqrt(double(3)), double(DX2[21]) / std::sqrt(double(3)),
-            double(DX2[22]) / std::sqrt(double(3)), double(DX2[23]) / std::sqrt(double(3)),
-            double(DX2[24]) / std::sqrt(double(3)), double(DX2[25]) / std::sqrt(double(3))
-        },{
-            double(DX3[0]), double(DX3[1]),
-            double(DX3[2]), double(DX3[3]),
-            double(DX3[4]), double(DX3[5]),
-            double(DX3[6]), double(DX3[7]),
-            double(DX3[8]), double(DX3[9]),
-            double(DX3[10]) / std::sqrt(double(2)), double(DX3[11]) / std::sqrt(double(2)),
-            double(DX3[12]) / std::sqrt(double(2)), double(DX3[13]) / std::sqrt(double(2)),
-            double(DX3[14]) / std::sqrt(double(2)), double(DX3[15]) / std::sqrt(double(2)),
-            double(DX3[16]) / std::sqrt(double(2)), double(DX3[17]) / std::sqrt(double(2)),
-            double(DX3[18]) / std::sqrt(double(3)), double(DX3[19]) / std::sqrt(double(3)),
-            double(DX3[20]) / std::sqrt(double(3)), double(DX3[21]) / std::sqrt(double(3)),
-            double(DX3[22]) / std::sqrt(double(3)), double(DX3[23]) / std::sqrt(double(3)),
-            double(DX3[24]) / std::sqrt(double(3)), double(DX3[25]) / std::sqrt(double(3))
-        }
-    };
-
-}
-
-//const int FSTARTDIR = 0;
-//const int FENDDIR   = 25;   //D3Q27
-
-//const int STARTF = 0;
-//const int ENDF   = 26;   //D3Q27
-
-//const int EX1[ENDF+1];
-//const int EX2[ENDF+1];
-//const int EX3[ENDF+1];
-
-//const int STARTDIR = 0;
-//const int ENDDIR   = 26; //alle geometrischen richtungen
-
-//const int DX1[ENDDIR+1];
-//const int DX2[ENDDIR+1];
-//const int DX3[ENDDIR+1];
-
-
-//const int E    /*f1 */ = 0;
-//const int W    /*f2 */ = 1;
-//const int N    /*f3 */ = 2;
-//const int S    /*f4 */ = 3;
-//const int T    /*f5 */ = 4;
-//const int B    /*f6 */ = 5;
-//const int NE   /*f7 */ = 6;
-//const int SW   /*f8 */ = 7;
-//const int SE   /*f9 */ = 8;
-//const int NW   /*f10*/ = 9;
-//const int TE   /*f11*/ = 10;
-//const int BW   /*f12*/ = 11;
-//const int BE   /*f13*/ = 12;
-//const int TW   /*f14*/ = 13;
-//const int TN   /*f15*/ = 14;
-//const int BS   /*f16*/ = 15;
-//const int BN   /*f17*/ = 16;
-//const int TS   /*f18*/ = 17;
-//const int TNE          = 18;
-//const int TNW          = 19;
-//const int TSE          = 20;
-//const int TSW          = 21;
-//const int BNE          = 22;
-//const int BNW          = 23;
-//const int BSE          = 24;
-//const int BSW          = 25;
-//const int ZERO /*f0 */ = 26;
-
-//const int INV_E   = W;  
-//const int INV_W   = E;  
-//const int INV_N   = S;  
-//const int INV_S   = N;  
-//const int INV_T   = B;  
-//const int INV_B   = T;  
-//const int INV_NE  = SW; 
-//const int INV_SW  = NE; 
-//const int INV_SE  = NW; 
-//const int INV_NW  = SE; 
-//const int INV_TE  = BW; 
-//const int INV_BW  = TE; 
-//const int INV_BE  = TW; 
-//const int INV_TW  = BE; 
-//const int INV_TN  = BS; 
-//const int INV_BS  = TN; 
-//const int INV_BN  = TS; 
-//const int INV_TS  = BN; 
-//const int INV_TNE = BSW;
-//const int INV_TNW = BSE;
-//const int INV_TSE = BNW;
-//const int INV_TSW = BNE;
-//const int INV_BNE = TSW;
-//const int INV_BNW = TSE;
-//const int INV_BSE = TNW;
-//const int INV_BSW = TNE;
-
-//const int INVDIR[ENDDIR+1];
-
-//const int M_RHO     = 0;  
-//const int M_EN      = 1;  
-//const int M_EPS     = 2;  
-//const int M_JX1     = 3;  
-//const int M_QX1     = 4;  
-//const int M_JX2     = 5;  
-//const int M_QX2     = 6;  
-//const int M_JX3     = 7;  
-//const int M_QX3     = 8;  
-//const int M_3PX1X1  = 9;  
-//const int M_3PIX1X1 = 10; 
-//const int M_PWW     = 11; 
-//const int M_PIWW    = 12; 
-//const int M_PX1X2   = 13; 
-//const int M_PX2X3   = 14; 
-//const int M_PX1X3   = 15; 
-//const int M_MX1     = 16; 
-//const int M_MX2     = 17; 
-//const int M_MX3     = 18; 
-
-//const int STARTM = 0;
-//const int ENDM   = 18;   //D3Q27
+#include "D3Q27System.h"
+namespace D3Q27System
+{
+    using namespace UbMath;
+
+    //index             0   1   2   3   4   5  6   7   8    9  10  11  12  13  14  15  16  17  18//falsch
+    //f:              ZERO, E,  W,  N,  S,  T,  B, NE, SW, SE, NW, TE, BW, BE, TW, TN, BS, BN, TS, TNE TNW TSE TSW BNE BNW BSE BSW
+    //const int EX1[] = { 0,  1, -1,  0,  0,  0,  0,  1, -1,  1, -1,  1, -1,  1, -1,  0,  0,  0,  0,  1, -1,  1, -1,  1, -1,  1, -1 };
+    //const int EX2[] = { 0,  0,  0,  1, -1,  0,  0,  1, -1, -1,  1,  0,  0,  0,  0,  1, -1,  1, -1,  1,  1, -1, -1,  1,  1, -1, -1 };
+    //const int EX3[] = { 0,  0,  0,  0,  0,  1, -1,  0,  0,  0,  0,  1, -1, -1,  1,  1, -1, -1,  1,  1,  1,  1,  1, -1, -1, -1, -1 };
+
+    //index             0   1   2   3   4   5  6   7   8    9  10  11  12  13  14  15  16  17  18
+    //f:                E,  W,  N,  S,  T,  B, NE, SW, SE, NW, TE, BW, BE, TW, TN, BS, BN, TS, TNE TNW TSE TSW BNE BNW BSE BSW
+    const int DX1[] = { 1, -1,  0,  0,  0,  0,  1, -1,  1, -1,  1, -1,  1, -1,  0,  0,  0,  0,  1, -1,  1, -1,  1, -1,  1, -1 };
+    const int DX2[] = { 0,  0,  1, -1,  0,  0,  1, -1, -1,  1,  0,  0,  0,  0,  1, -1,  1, -1,  1,  1, -1, -1,  1,  1, -1, -1 };
+    const int DX3[] = { 0,  0,  0,  0,  1, -1,  0,  0,  0,  0,  1, -1, -1,  1,  1, -1, -1,  1,  1,  1,  1,  1, -1, -1, -1, -1 };
+
+    ////index                0   1   2   3   4   5  6   7   8    9  10  11  12  13  14  15  16  17  18
+    ////f:                   E,  W,  N,  S,  T,  B, NE, SW, SE, NW, TE, BW, BE, TW, TN, BS, BN, TS, TNE TNW TSE TSW BNE BNW BSE BSW
+    const double WEIGTH[] = { c2o27, c2o27,  c2o27,  c2o27,  c2o27,  c2o27,  c1o54, c1o54, c1o54, c1o54, c1o54, c1o54, c1o54, c1o54, c1o54, c1o54, c1o54, c1o54, c1o216, c1o216, c1o216, c1o216, c1o216, c1o216, c1o216, c1o216 , c8o27 };
+
+
+    const int INVDIR[] = {
+                           INV_E,
+                           INV_W,
+                           INV_N,
+                           INV_S,
+                           INV_T,
+                           INV_B,
+                           INV_NE,
+                           INV_SW,
+                           INV_SE,
+                           INV_NW,
+                           INV_TE,
+                           INV_BW,
+                           INV_BE,
+                           INV_TW,
+                           INV_TN,
+                           INV_BS,
+                           INV_BN,
+                           INV_TS,
+                           INV_TNE,
+                           INV_TNW,
+                           INV_TSE,
+                           INV_TSW,
+                           INV_BNE,
+                           INV_BNW,
+                           INV_BSE,
+                           INV_BSW };
+
+
+    // The x,y,z component for each normalized direction
+    const double cNorm[3][ENDDIR] = {
+        {
+            double(DX1[0]), double(DX1[1]),
+            double(DX1[2]), double(DX1[3]),
+            double(DX1[4]), double(DX1[5]),
+            double(DX1[6]) / std::sqrt(double(2)), double(DX1[7]) / std::sqrt(double(2)),
+            double(DX1[8]) / std::sqrt(double(2)), double(DX1[9]) / std::sqrt(double(2)),
+            double(DX1[10]) / std::sqrt(double(2)), double(DX1[11]) / std::sqrt(double(2)),
+            double(DX1[12]) / std::sqrt(double(2)), double(DX1[13]) / std::sqrt(double(2)),
+            double(DX1[14]), double(DX1[15]),
+            double(DX1[16]), double(DX1[17]),
+            double(DX1[18]) / std::sqrt(double(3)), double(DX1[19]) / std::sqrt(double(3)),
+            double(DX1[20]) / std::sqrt(double(3)), double(DX1[21]) / std::sqrt(double(3)),
+            double(DX1[22]) / std::sqrt(double(3)), double(DX1[23]) / std::sqrt(double(3)),
+            double(DX1[24]) / std::sqrt(double(3)), double(DX1[25]) / std::sqrt(double(3))
+        },{
+            double(DX2[0]), double(DX2[1]),
+            double(DX2[2]), double(DX2[3]),
+            double(DX2[4]), double(DX2[5]),
+            double(DX2[6]) / std::sqrt(double(2)), double(DX2[7]) / std::sqrt(double(2)),
+            double(DX2[8]) / std::sqrt(double(2)), double(DX2[9]) / std::sqrt(double(2)),
+            double(DX2[10]), double(DX2[11]),
+            double(DX2[12]), double(DX2[13]),
+            double(DX2[14]) / std::sqrt(double(2)), double(DX2[15]) / std::sqrt(double(2)),
+            double(DX2[16]) / std::sqrt(double(2)), double(DX2[17]) / std::sqrt(double(2)),
+            double(DX2[18]) / std::sqrt(double(3)), double(DX2[19]) / std::sqrt(double(3)),
+            double(DX2[20]) / std::sqrt(double(3)), double(DX2[21]) / std::sqrt(double(3)),
+            double(DX2[22]) / std::sqrt(double(3)), double(DX2[23]) / std::sqrt(double(3)),
+            double(DX2[24]) / std::sqrt(double(3)), double(DX2[25]) / std::sqrt(double(3))
+        },{
+            double(DX3[0]), double(DX3[1]),
+            double(DX3[2]), double(DX3[3]),
+            double(DX3[4]), double(DX3[5]),
+            double(DX3[6]), double(DX3[7]),
+            double(DX3[8]), double(DX3[9]),
+            double(DX3[10]) / std::sqrt(double(2)), double(DX3[11]) / std::sqrt(double(2)),
+            double(DX3[12]) / std::sqrt(double(2)), double(DX3[13]) / std::sqrt(double(2)),
+            double(DX3[14]) / std::sqrt(double(2)), double(DX3[15]) / std::sqrt(double(2)),
+            double(DX3[16]) / std::sqrt(double(2)), double(DX3[17]) / std::sqrt(double(2)),
+            double(DX3[18]) / std::sqrt(double(3)), double(DX3[19]) / std::sqrt(double(3)),
+            double(DX3[20]) / std::sqrt(double(3)), double(DX3[21]) / std::sqrt(double(3)),
+            double(DX3[22]) / std::sqrt(double(3)), double(DX3[23]) / std::sqrt(double(3)),
+            double(DX3[24]) / std::sqrt(double(3)), double(DX3[25]) / std::sqrt(double(3))
+        }
+    };
+
+}
+
+//const int FSTARTDIR = 0;
+//const int FENDDIR   = 25;   //D3Q27
+
+//const int STARTF = 0;
+//const int ENDF   = 26;   //D3Q27
+
+//const int EX1[ENDF+1];
+//const int EX2[ENDF+1];
+//const int EX3[ENDF+1];
+
+//const int STARTDIR = 0;
+//const int ENDDIR   = 26; //alle geometrischen richtungen
+
+//const int DX1[ENDDIR+1];
+//const int DX2[ENDDIR+1];
+//const int DX3[ENDDIR+1];
+
+
+//const int E    /*f1 */ = 0;
+//const int W    /*f2 */ = 1;
+//const int N    /*f3 */ = 2;
+//const int S    /*f4 */ = 3;
+//const int T    /*f5 */ = 4;
+//const int B    /*f6 */ = 5;
+//const int NE   /*f7 */ = 6;
+//const int SW   /*f8 */ = 7;
+//const int SE   /*f9 */ = 8;
+//const int NW   /*f10*/ = 9;
+//const int TE   /*f11*/ = 10;
+//const int BW   /*f12*/ = 11;
+//const int BE   /*f13*/ = 12;
+//const int TW   /*f14*/ = 13;
+//const int TN   /*f15*/ = 14;
+//const int BS   /*f16*/ = 15;
+//const int BN   /*f17*/ = 16;
+//const int TS   /*f18*/ = 17;
+//const int TNE          = 18;
+//const int TNW          = 19;
+//const int TSE          = 20;
+//const int TSW          = 21;
+//const int BNE          = 22;
+//const int BNW          = 23;
+//const int BSE          = 24;
+//const int BSW          = 25;
+//const int ZERO /*f0 */ = 26;
+
+//const int INV_E   = W;  
+//const int INV_W   = E;  
+//const int INV_N   = S;  
+//const int INV_S   = N;  
+//const int INV_T   = B;  
+//const int INV_B   = T;  
+//const int INV_NE  = SW; 
+//const int INV_SW  = NE; 
+//const int INV_SE  = NW; 
+//const int INV_NW  = SE; 
+//const int INV_TE  = BW; 
+//const int INV_BW  = TE; 
+//const int INV_BE  = TW; 
+//const int INV_TW  = BE; 
+//const int INV_TN  = BS; 
+//const int INV_BS  = TN; 
+//const int INV_BN  = TS; 
+//const int INV_TS  = BN; 
+//const int INV_TNE = BSW;
+//const int INV_TNW = BSE;
+//const int INV_TSE = BNW;
+//const int INV_TSW = BNE;
+//const int INV_BNE = TSW;
+//const int INV_BNW = TSE;
+//const int INV_BSE = TNW;
+//const int INV_BSW = TNE;
+
+//const int INVDIR[ENDDIR+1];
+
+//const int M_RHO     = 0;  
+//const int M_EN      = 1;  
+//const int M_EPS     = 2;  
+//const int M_JX1     = 3;  
+//const int M_QX1     = 4;  
+//const int M_JX2     = 5;  
+//const int M_QX2     = 6;  
+//const int M_JX3     = 7;  
+//const int M_QX3     = 8;  
+//const int M_3PX1X1  = 9;  
+//const int M_3PIX1X1 = 10; 
+//const int M_PWW     = 11; 
+//const int M_PIWW    = 12; 
+//const int M_PX1X2   = 13; 
+//const int M_PX2X3   = 14; 
+//const int M_PX1X3   = 15; 
+//const int M_MX1     = 16; 
+//const int M_MX2     = 17; 
+//const int M_MX3     = 18; 
+
+//const int STARTM = 0;
+//const int ENDM   = 18;   //D3Q27
diff --git a/src/cpu/VirtualFluidsCore/LBM/D3Q27System.h b/src/cpu/VirtualFluidsCore/LBM/D3Q27System.h
index 921ee65a8cbd23abe347a2878271a41b902466a6..08f4c0e3d7c3f6214c84a8eb4122a08e5b2c8dab 100644
--- a/src/cpu/VirtualFluidsCore/LBM/D3Q27System.h
+++ b/src/cpu/VirtualFluidsCore/LBM/D3Q27System.h
@@ -1,645 +1,645 @@
-//=======================================================================================
-// ____          ____    __    ______     __________   __      __       __        __         
-// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
-//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
-//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
-//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
-//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
-//      \    \  |    |   ________________________________________________________________    
-//       \    \ |    |  |  ______________________________________________________________|   
-//        \    \|    |  |  |         __          __     __     __     ______      _______    
-//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
-//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
-//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
-//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
-//
-//  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 D3Q27System.h
-//! \ingroup LBM
-//! \author Konstantin Kutscher, Sebastian Geller, Soeren Freudiger
-//=======================================================================================
-
-#ifndef D3Q27SYSTEM_H
-#define D3Q27SYSTEM_H
-
-#include <cmath>
-#include <string>
-#include <iostream>
-
-#include "UbException.h"
-#include "UbMath.h"
-#include "LBMSystem.h"
-
-//! \brief namespace for global system-functions
-namespace D3Q27System
-{
-   //////////////////////////////////////////////////////////////////////////
-   //DIRECTION STUFF
-   static const int FSTARTDIR = 0;
-   static const int FENDDIR   = 25;   //D3Q27
-
-   static const int STARTF = 0;
-   static const int ENDF   = 26;   //D3Q27
-
-   static const int STARTDIR = 0;
-   static const int ENDDIR   = 26;
-
-   extern const int DX1[ENDDIR+1];
-   extern const int DX2[ENDDIR+1];
-   extern const int DX3[ENDDIR+1];
-   extern const double WEIGTH[ENDDIR+1];
-
-   extern const double cNorm[3][ENDDIR];
-   
-   //static const int ZERO /*f0 */ = 0;
-   //static const int E    /*f1 */ = 1;
-   //static const int W    /*f2 */ = 2;
-   //static const int N    /*f3 */ = 3;
-   //static const int S    /*f4 */ = 4;
-   //static const int T    /*f5 */ = 5;
-   //static const int B    /*f6 */ = 6;
-   //static const int NE   /*f7 */ = 7;
-   //static const int SW   /*f8 */ = 8;
-   //static const int SE   /*f9 */ = 9;
-   //static const int NW   /*f10*/ = 10;
-   //static const int TE   /*f11*/ = 11;
-   //static const int BW   /*f12*/ = 12;
-   //static const int BE   /*f13*/ = 13;
-   //static const int TW   /*f14*/ = 14;
-   //static const int TN   /*f15*/ = 15;
-   //static const int BS   /*f16*/ = 16;
-   //static const int BN   /*f17*/ = 17;
-   //static const int TS   /*f18*/ = 18;
-   //static const int TNE          = 19;
-   //static const int TNW          = 20;
-   //static const int TSE          = 21;
-   //static const int TSW          = 22;
-   //static const int BNE          = 23;
-   //static const int BNW          = 24;
-   //static const int BSE          = 25;
-   //static const int BSW          = 26;
-
-   static const int E    /*f1 */ = 0;
-   static const int W    /*f2 */ = 1;
-   static const int N    /*f3 */ = 2;
-   static const int S    /*f4 */ = 3;
-   static const int T    /*f5 */ = 4;
-   static const int B    /*f6 */ = 5;
-   static const int NE   /*f7 */ = 6;
-   static const int SW   /*f8 */ = 7;
-   static const int SE   /*f9 */ = 8;
-   static const int NW   /*f10*/ = 9;
-   static const int TE   /*f11*/ = 10;
-   static const int BW   /*f12*/ = 11;
-   static const int BE   /*f13*/ = 12;
-   static const int TW   /*f14*/ = 13;
-   static const int TN   /*f15*/ = 14;
-   static const int BS   /*f16*/ = 15;
-   static const int BN   /*f17*/ = 16;
-   static const int TS   /*f18*/ = 17;
-   static const int TNE          = 18;
-   static const int TNW          = 19;
-   static const int TSE          = 20;
-   static const int TSW          = 21;
-   static const int BNE          = 22;
-   static const int BNW          = 23;
-   static const int BSE          = 24;
-   static const int BSW          = 25;
-   static const int ZERO /*f0 */ = 26;
-
-   static const int INV_E   = W;  
-   static const int INV_W   = E;  
-   static const int INV_N   = S;  
-   static const int INV_S   = N;  
-   static const int INV_T   = B;  
-   static const int INV_B   = T;  
-   static const int INV_NE  = SW; 
-   static const int INV_SW  = NE; 
-   static const int INV_SE  = NW; 
-   static const int INV_NW  = SE; 
-   static const int INV_TE  = BW; 
-   static const int INV_BW  = TE; 
-   static const int INV_BE  = TW; 
-   static const int INV_TW  = BE; 
-   static const int INV_TN  = BS; 
-   static const int INV_BS  = TN; 
-   static const int INV_BN  = TS; 
-   static const int INV_TS  = BN; 
-   static const int INV_TNE = BSW;
-   static const int INV_TNW = BSE;
-   static const int INV_TSE = BNW;
-   static const int INV_TSW = BNE;
-   static const int INV_BNE = TSW;
-   static const int INV_BNW = TSE;
-   static const int INV_BSE = TNW;
-   static const int INV_BSW = TNE;
-                                       
-   extern const int INVDIR[ENDDIR+1];
-
-   static const int ET_E   = 0;
-   static const int ET_W   = 0;
-   static const int ET_N   = 1;
-   static const int ET_S   = 1;
-   static const int ET_T   = 2;
-   static const int ET_B   = 2;
-   static const int ET_NE  = 3;
-   static const int ET_SW  = 3;
-   static const int ET_SE  = 4;
-   static const int ET_NW  = 4;
-   static const int ET_TE  = 5;
-   static const int ET_BW  = 5;
-   static const int ET_BE  = 6;
-   static const int ET_TW  = 6;
-   static const int ET_TN  = 7;
-   static const int ET_BS  = 7;
-   static const int ET_BN  = 8;
-   static const int ET_TS  = 8;
-   static const int ET_TNE = 9;
-   static const int ET_BSW = 9;
-   static const int ET_TNW = 10;
-   static const int ET_BSE = 10;
-   static const int ET_TSE = 11;
-   static const int ET_BNW = 11;
-   static const int ET_TSW = 12;
-   static const int ET_BNE = 12;
-
-   static const int M_RHO     = 0;  
-   static const int M_EN      = 1;  
-   static const int M_EPS     = 2;  
-   static const int M_JX1     = 3;  
-   static const int M_QX1     = 4;  
-   static const int M_JX2     = 5;  
-   static const int M_QX2     = 6;  
-   static const int M_JX3     = 7;  
-   static const int M_QX3     = 8;  
-   static const int M_3PX1X1  = 9;  
-   static const int M_3PIX1X1 = 10; 
-   static const int M_PWW     = 11; 
-   static const int M_PIWW    = 12; 
-   static const int M_PX1X2   = 13; 
-   static const int M_PX2X3   = 14; 
-   static const int M_PX1X3   = 15; 
-   static const int M_MX1     = 16; 
-   static const int M_MX2     = 17; 
-   static const int M_MX3     = 18; 
-   
-   static const int STARTM = 0;
-   static const int ENDM   = 18;   //D3Q27
-
-
-   
-   //////////////////////////////////////////////////////////////////////////
-   //MACROSCOPIC VALUES                  
-   /*=====================================================================*/
-   static LBMReal getDensity(const LBMReal* const& f/*[27]*/)
-   {
-      return  ((f[TNE] + f[BSW])+(f[TSE]+f[BNW]))+((f[BSE]+f[TNW])+ (f[TSW]+f[BNE]))
-             +(((f[NE] + f[SW]) + (f[SE] + f[NW]))+((f[TE] + f[BW])+(f[BE]+ f[TW]))
-             +((f[BN] + f[TS]) + (f[TN] + f[BS])))+((f[E] + f[W])+(f[N] + f[S])
-             +(f[T] + f[B]))+f[ZERO];
-   }
-   /*=====================================================================*/
-   //ATTENTION: does not apply to all models -> use certificate instead of static! to do
-   static LBMReal getPressure(const LBMReal* const& f/*[27]*/)
-   {
-      return  REAL_CAST( UbMath::c1o3 )*getDensity(f);
-   }
-   /*=====================================================================*/
-   static LBMReal getIncompVelocityX1(const LBMReal* const& f/*[27]*/)
-   {
-      return ((((f[TNE]-f[BSW]) + (f[TSE]-f[BNW])) + ((f[BSE]-f[TNW]) + (f[BNE]-f[TSW]))) +
-             (((f[BE]-f[TW]) + (f[TE]-f[BW])) + ((f[SE]-f[NW]) + (f[NE]-f[SW]))) +
-             (f[E]-f[W]));  
-   }
-   /*=====================================================================*/
-   static LBMReal getIncompVelocityX2(const LBMReal* const& f/*[27]*/)
-   {
-      return ((((f[TNE]-f[BSW]) + (f[BNW]-f[TSE])) + ((f[TNW]-f[BSE]) + (f[BNE]-f[TSW]))) +
-             (((f[BN]-f[TS]) + (f[TN]-f[BS])) + ((f[NW]-f[SE]) + (f[NE]-f[SW]))) +
-             (f[N]-f[S]));  
-   }
-   /*=====================================================================*/
-   static LBMReal getIncompVelocityX3(const LBMReal* const& f/*[27]*/)
-   {
-      return ((((f[TNE] - f[BSW]) + (f[TSE] - f[BNW])) + ((f[TNW] - f[BSE]) + (f[TSW] - f[BNE]))) +
-             (((f[TS] - f[BN]) + (f[TN] - f[BS])) + ((f[TW] - f[BE]) + (f[TE] - f[BW]))) +
-             (f[T] - f[B]));
-   }
-   /*=====================================================================*/
-   static void calcDensity(const LBMReal* const& f/*[27]*/, LBMReal& rho)
-   {
-      rho = ((f[TNE] + f[BSW])+(f[TSE]+f[BNW]))+((f[BSE]+f[TNW])+ (f[TSW]+f[BNE]))
-         +(((f[NE] + f[SW]) + (f[SE] + f[NW]))+((f[TE] + f[BW])+(f[BE]+ f[TW]))
-         +((f[BN] + f[TS]) + (f[TN] + f[BS])))+((f[E] + f[W])+(f[N] + f[S])
-         +(f[T] + f[B]))+f[ZERO];
-         
-   }
-   /*=====================================================================*/
-   static void calcIncompVelocityX1(const LBMReal* const& f/*[27]*/, LBMReal& vx1)
-   {
-      vx1 = ((((f[TNE]-f[BSW]) + (f[TSE]-f[BNW])) + ((f[BSE]-f[TNW]) + (f[BNE]-f[TSW]))) +
-             (((f[BE]-f[TW]) + (f[TE]-f[BW])) + ((f[SE]-f[NW]) + (f[NE]-f[SW]))) +
-             (f[E]-f[W]));
-   }
-   /*=====================================================================*/
-   static void calcIncompVelocityX2(const LBMReal* const& f/*[27]*/, LBMReal& vx2)
-   {
-      vx2 = ((((f[TNE]-f[BSW]) + (f[BNW]-f[TSE])) + ((f[TNW]-f[BSE]) + (f[BNE]-f[TSW]))) +
-             (((f[BN]-f[TS]) + (f[TN]-f[BS])) + ((f[NW]-f[SE]) + (f[NE]-f[SW]))) +
-             (f[N]-f[S]));
-   }
-   /*=====================================================================*/
-   static void calcIncompVelocityX3(const LBMReal* const& f/*[27]*/, LBMReal& vx3)
-   {
-      vx3 =((((f[TNE]-f[BSW]) + (f[TSE]-f[BNW])) + ((f[TNW]-f[BSE]) + (f[TSW]-f[BNE]))) +
-             (((f[TS]-f[BN]) + (f[TN]-f[BS])) + ((f[TW]-f[BE]) + (f[TE]-f[BW]))) +
-             (f[T]-f[B]));
-   }
-   /*=====================================================================*/
-   static LBMReal getCompVelocityX1(const LBMReal* const& f/*[27]*/)
-   {
-      return ((((f[TNE]-f[BSW]) + (f[TSE]-f[BNW])) + ((f[BSE]-f[TNW]) + (f[BNE]-f[TSW]))) +
-             (((f[BE]-f[TW]) + (f[TE]-f[BW])) + ((f[SE]-f[NW]) + (f[NE]-f[SW]))) +
-             (f[E]-f[W]))/getDensity(f);  
-   }
-   /*=====================================================================*/
-   static LBMReal getCompVelocityX2(const LBMReal* const& f/*[27]*/)
-   {
-      return ((((f[TNE]-f[BSW]) + (f[BNW]-f[TSE])) + ((f[TNW]-f[BSE]) + (f[BNE]-f[TSW]))) +
-             (((f[BN]-f[TS]) + (f[TN]-f[BS])) + ((f[NW]-f[SE]) + (f[NE]-f[SW]))) +
-             (f[N]-f[S]))/getDensity(f);  
-  }
-   /*=====================================================================*/
-   static LBMReal getCompVelocityX3(const LBMReal* const& f/*[27]*/)
-   {
-      return ((((f[TNE]-f[BSW]) + (f[TSE]-f[BNW])) + ((f[TNW]-f[BSE]) + (f[TSW]-f[BNE]))) +
-             (((f[TS]-f[BN]) + (f[TN]-f[BS])) + ((f[TW]-f[BE]) + (f[TE]-f[BW]))) +
-             (f[T]-f[B]))/getDensity(f);
-   }
-   /*=====================================================================*/
-   static void calcCompVelocityX1(const LBMReal* const& f/*[27]*/, LBMReal& vx1)
-   {
-      vx1 = ((((f[TNE]-f[BSW]) + (f[TSE]-f[BNW])) + ((f[BSE]-f[TNW]) + (f[BNE]-f[TSW]))) +
-            (((f[BE]-f[TW]) + (f[TE]-f[BW])) + ((f[SE]-f[NW]) + (f[NE]-f[SW]))) +
-            (f[E]-f[W]))/getDensity(f);  
-   }
-   /*=====================================================================*/
-   static void calcCompVelocityX2(const LBMReal* const& f/*[27]*/, LBMReal& vx2)
-   {
-      vx2 = ((((f[TNE]-f[BSW]) + (f[BNW]-f[TSE])) + ((f[TNW]-f[BSE]) + (f[BNE]-f[TSW]))) +
-            (((f[BN]-f[TS]) + (f[TN]-f[BS])) + ((f[NW]-f[SE]) + (f[NE]-f[SW]))) +
-            (f[N]-f[S]))/getDensity(f);  
-   }
-   /*=====================================================================*/
-   static void calcCompVelocityX3(const LBMReal* const& f/*[27]*/, LBMReal& vx3)
-   {
-      vx3 = ((((f[TNE]-f[BSW]) + (f[TSE]-f[BNW])) + ((f[TNW]-f[BSE]) + (f[TSW]-f[BNE]))) +
-            (((f[TS]-f[BN]) + (f[TN]-f[BS])) + ((f[TW]-f[BE]) + (f[TE]-f[BW]))) +
-            (f[T]-f[B]))/getDensity(f);
-   }
-   /*=====================================================================*/
-   static void calcIncompMacroscopicValues(const LBMReal* const& f/*[27]*/, LBMReal& rho, LBMReal& vx1, LBMReal& vx2, LBMReal& vx3)
-   {
-      D3Q27System::calcDensity(f, rho);
-      D3Q27System::calcIncompVelocityX1(f, vx1);
-      D3Q27System::calcIncompVelocityX2(f, vx2);
-      D3Q27System::calcIncompVelocityX3(f, vx3);
-   }
-
-   /*=====================================================================*/
-   static void calcCompMacroscopicValues(const LBMReal* const& f/*[27]*/, LBMReal& drho, LBMReal& vx1, LBMReal& vx2, LBMReal& vx3)
-   {
-      D3Q27System::calcDensity(f, drho);
-      D3Q27System::calcIncompVelocityX1(f, vx1);
-      D3Q27System::calcIncompVelocityX2(f, vx2);
-      D3Q27System::calcIncompVelocityX3(f, vx3);
-      LBMReal rho = drho+UbMath::c1;
-      vx1/=rho;
-      vx2/=rho;
-      vx3/=rho;
-   }
-   //////////////////////////////////////////////////////////////////////////
-   static LBMReal getCompFeqForDirection(const int& direction, const LBMReal& drho,const LBMReal& vx1,const LBMReal& vx2,const LBMReal& vx3)
-   {
-      using namespace UbMath;
-      LBMReal cu_sq=1.5*(vx1*vx1+vx2*vx2+vx3*vx3);
-
-      ////-----
-      LBMReal rho = drho+c1;
-      switch (direction)
-      {
-      case ZERO: return REAL_CAST(c8o27*(drho+rho*(-cu_sq)));
-      case E: return REAL_CAST(c2o27*(drho+rho*(3.0*(vx1)+c9o2*(vx1)*(vx1)-cu_sq)));
-      case W: return REAL_CAST(c2o27*(drho+rho*(3.0*(-vx1)+c9o2*(-vx1)*(-vx1)-cu_sq)));
-      case N: return REAL_CAST(c2o27*(drho+rho*(3.0*(vx2)+c9o2*(vx2)*(vx2)-cu_sq)));
-      case S: return REAL_CAST(c2o27*(drho+rho*(3.0*(-vx2)+c9o2*(-vx2)*(-vx2)-cu_sq)));
-      case T: return REAL_CAST(c2o27*(drho+rho*(3.0*(vx3)+c9o2*(vx3)*(vx3)-cu_sq)));
-      case B: return REAL_CAST(c2o27*(drho+rho*(3.0*(-vx3)+c9o2*(-vx3)*(-vx3)-cu_sq)));
-      case NE: return REAL_CAST(c1o54*(drho+rho*(3.0*(vx1+vx2)+c9o2*(vx1+vx2)*(vx1+vx2)-cu_sq)));
-      case SW: return REAL_CAST(c1o54*(drho+rho*(3.0*(-vx1-vx2)+c9o2*(-vx1-vx2)*(-vx1-vx2)-cu_sq)));
-      case SE: return REAL_CAST(c1o54*(drho+rho*(3.0*(vx1-vx2)+c9o2*(vx1-vx2)*(vx1-vx2)-cu_sq)));
-      case NW: return REAL_CAST(c1o54*(drho+rho*(3.0*(-vx1+vx2)+c9o2*(-vx1+vx2)*(-vx1+vx2)-cu_sq)));
-      case TE: return REAL_CAST(c1o54*(drho+rho*(3.0*(vx1+vx3)+c9o2*(vx1+vx3)*(vx1+vx3)-cu_sq)));
-      case BW: return REAL_CAST(c1o54*(drho+rho*(3.0*(-vx1-vx3)+c9o2*(-vx1-vx3)*(-vx1-vx3)-cu_sq)));
-      case BE: return REAL_CAST(c1o54*(drho+rho*(3.0*(vx1-vx3)+c9o2*(vx1-vx3)*(vx1-vx3)-cu_sq)));
-      case TW: return REAL_CAST(c1o54*(drho+rho*(3.0*(-vx1+vx3)+c9o2*(-vx1+vx3)*(-vx1+vx3)-cu_sq)));
-      case TN: return REAL_CAST(c1o54*(drho+rho*(3.0*(vx2+vx3)+c9o2*(vx2+vx3)*(vx2+vx3)-cu_sq)));
-      case BS: return REAL_CAST(c1o54*(drho+rho*(3.0*(-vx2-vx3)+c9o2*(-vx2-vx3)*(-vx2-vx3)-cu_sq)));
-      case BN: return REAL_CAST(c1o54*(drho+rho*(3.0*(vx2-vx3)+c9o2*(vx2-vx3)*(vx2-vx3)-cu_sq)));
-      case TS: return REAL_CAST(c1o54*(drho+rho*(3.0*(-vx2+vx3)+c9o2*(-vx2+vx3)*(-vx2+vx3)-cu_sq)));
-      case TNE: return REAL_CAST(c1o216*(drho+rho*(3.0*(vx1+vx2+vx3)+c9o2*(vx1+vx2+vx3)*(vx1+vx2+vx3)-cu_sq)));
-      case BSW: return REAL_CAST(c1o216*(drho+rho*(3.0*(-vx1-vx2-vx3)+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq)));
-      case BNE: return REAL_CAST(c1o216*(drho+rho*(3.0*(vx1+vx2-vx3)+c9o2*(vx1+vx2-vx3)*(vx1+vx2-vx3)-cu_sq)));
-      case TSW: return REAL_CAST(c1o216*(drho+rho*(3.0*(-vx1-vx2+vx3)+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq)));
-      case TSE: return REAL_CAST(c1o216*(drho+rho*(3.0*(vx1-vx2+vx3)+c9o2*(vx1-vx2+vx3)*(vx1-vx2+vx3)-cu_sq)));
-      case BNW: return REAL_CAST(c1o216*(drho+rho*(3.0*(-vx1+vx2-vx3)+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq)));
-      case BSE: return REAL_CAST(c1o216*(drho+rho*(3.0*(vx1-vx2-vx3)+c9o2*(vx1-vx2-vx3)*(vx1-vx2-vx3)-cu_sq)));
-      case TNW: return REAL_CAST(c1o216*(drho+rho*(3.0*(-vx1+vx2+vx3)+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq)));
-      default: throw UbException(UB_EXARGS, "unknown dir");
-      }
-
-   }
-   //////////////////////////////////////////////////////////////////////////
-   static void calcCompFeq(LBMReal* const& feq/*[27]*/,const LBMReal& drho,const LBMReal& vx1,const LBMReal& vx2,const LBMReal& vx3)	
-   {
-      using namespace UbMath;
-
-      LBMReal cu_sq = 1.5*(vx1*vx1+vx2*vx2+vx3*vx3);
-      LBMReal rho = drho+c1;
-
-      feq[ZERO] = c8o27*(drho+rho*(-cu_sq));
-      feq[E] = c2o27*(drho+rho*(3.0*(vx1)+c9o2*(vx1)*(vx1)-cu_sq));
-      feq[W] = c2o27*(drho+rho*(3.0*(-vx1)+c9o2*(-vx1)*(-vx1)-cu_sq));
-      feq[N] = c2o27*(drho+rho*(3.0*(vx2)+c9o2*(vx2)*(vx2)-cu_sq));
-      feq[S] = c2o27*(drho+rho*(3.0*(-vx2)+c9o2*(-vx2)*(-vx2)-cu_sq));
-      feq[T] = c2o27*(drho+rho*(3.0*(vx3)+c9o2*(vx3)*(vx3)-cu_sq));
-      feq[B] = c2o27*(drho+rho*(3.0*(-vx3)+c9o2*(-vx3)*(-vx3)-cu_sq));
-      feq[NE] = c1o54*(drho+rho*(3.0*(vx1+vx2)+c9o2*(vx1+vx2)*(vx1+vx2)-cu_sq));
-      feq[SW] = c1o54*(drho+rho*(3.0*(-vx1-vx2)+c9o2*(-vx1-vx2)*(-vx1-vx2)-cu_sq));
-      feq[SE] = c1o54*(drho+rho*(3.0*(vx1-vx2)+c9o2*(vx1-vx2)*(vx1-vx2)-cu_sq));
-      feq[NW] = c1o54*(drho+rho*(3.0*(-vx1+vx2)+c9o2*(-vx1+vx2)*(-vx1+vx2)-cu_sq));
-      feq[TE] = c1o54*(drho+rho*(3.0*(vx1+vx3)+c9o2*(vx1+vx3)*(vx1+vx3)-cu_sq));
-      feq[BW] = c1o54*(drho+rho*(3.0*(-vx1-vx3)+c9o2*(-vx1-vx3)*(-vx1-vx3)-cu_sq));
-      feq[BE] = c1o54*(drho+rho*(3.0*(vx1-vx3)+c9o2*(vx1-vx3)*(vx1-vx3)-cu_sq));
-      feq[TW] = c1o54*(drho+rho*(3.0*(-vx1+vx3)+c9o2*(-vx1+vx3)*(-vx1+vx3)-cu_sq));
-      feq[TN] = c1o54*(drho+rho*(3.0*(vx2+vx3)+c9o2*(vx2+vx3)*(vx2+vx3)-cu_sq));
-      feq[BS] = c1o54*(drho+rho*(3.0*(-vx2-vx3)+c9o2*(-vx2-vx3)*(-vx2-vx3)-cu_sq));
-      feq[BN] = c1o54*(drho+rho*(3.0*(vx2-vx3)+c9o2*(vx2-vx3)*(vx2-vx3)-cu_sq));
-      feq[TS] = c1o54*(drho+rho*(3.0*(-vx2+vx3)+c9o2*(-vx2+vx3)*(-vx2+vx3)-cu_sq));
-      feq[TNE] = c1o216*(drho+rho*(3.0*(vx1+vx2+vx3)+c9o2*(vx1+vx2+vx3)*(vx1+vx2+vx3)-cu_sq));
-      feq[BSW] = c1o216*(drho+rho*(3.0*(-vx1-vx2-vx3)+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq));
-      feq[BNE] = c1o216*(drho+rho*(3.0*(vx1+vx2-vx3)+c9o2*(vx1+vx2-vx3)*(vx1+vx2-vx3)-cu_sq));
-      feq[TSW] = c1o216*(drho+rho*(3.0*(-vx1-vx2+vx3)+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq));
-      feq[TSE] = c1o216*(drho+rho*(3.0*(vx1-vx2+vx3)+c9o2*(vx1-vx2+vx3)*(vx1-vx2+vx3)-cu_sq));
-      feq[BNW] = c1o216*(drho+rho*(3.0*(-vx1+vx2-vx3)+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq));
-      feq[BSE] = c1o216*(drho+rho*(3.0*(vx1-vx2-vx3)+c9o2*(vx1-vx2-vx3)*(vx1-vx2-vx3)-cu_sq));
-      feq[TNW] = c1o216*(drho+rho*(3.0*(-vx1+vx2+vx3)+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq));
-   }
-   //////////////////////////////////////////////////////////////////////////
-   static LBMReal getIncompFeqForDirection(const int& direction,const LBMReal& drho, const LBMReal& vx1,const LBMReal& vx2,const LBMReal& vx3)	
-   {
-      using namespace UbMath;
-
-      LBMReal cu_sq=1.5f*(vx1*vx1+vx2*vx2+vx3*vx3);
-
-      switch(direction)    
-      {		 
-         case ZERO : return REAL_CAST( c8o27*(drho-cu_sq));
-         case E : return REAL_CAST( c2o27*(drho+3.0*( vx1   )+c9o2*( vx1   )*( vx1   )-cu_sq));
-         case W : return REAL_CAST( c2o27*(drho+3.0*(-vx1   )+c9o2*(-vx1   )*(-vx1   )-cu_sq));
-         case N : return REAL_CAST( c2o27*(drho+3.0*(    vx2)+c9o2*(    vx2)*(    vx2)-cu_sq));
-         case S : return REAL_CAST( c2o27*(drho+3.0*(   -vx2)+c9o2*(   -vx2)*(   -vx2)-cu_sq));
-         case T : return REAL_CAST( c2o27*(drho+3.0*( vx3   )+c9o2*(    vx3)*(    vx3)-cu_sq));
-         case B : return REAL_CAST( c2o27*(drho+3.0*(   -vx3)+c9o2*(   -vx3)*(   -vx3)-cu_sq));
-         case NE : return REAL_CAST( c1o54*(drho+3.0*( vx1+vx2)+c9o2*( vx1+vx2)*( vx1+vx2)-cu_sq));
-         case SW : return REAL_CAST( c1o54*(drho+3.0*(-vx1-vx2)+c9o2*(-vx1-vx2)*(-vx1-vx2)-cu_sq));
-         case SE : return REAL_CAST( c1o54*(drho+3.0*( vx1-vx2)+c9o2*( vx1-vx2)*( vx1-vx2)-cu_sq));
-         case NW : return REAL_CAST( c1o54*(drho+3.0*(-vx1+vx2)+c9o2*(-vx1+vx2)*(-vx1+vx2)-cu_sq));
-         case TE : return REAL_CAST( c1o54*(drho+3.0*( vx1+vx3)+c9o2*( vx1+vx3)*( vx1+vx3)-cu_sq));
-         case BW : return REAL_CAST( c1o54*(drho+3.0*(-vx1-vx3)+c9o2*(-vx1-vx3)*(-vx1-vx3)-cu_sq));
-         case BE : return REAL_CAST( c1o54*(drho+3.0*( vx1-vx3)+c9o2*( vx1-vx3)*( vx1-vx3)-cu_sq));
-         case TW : return REAL_CAST( c1o54*(drho+3.0*(-vx1+vx3)+c9o2*(-vx1+vx3)*(-vx1+vx3)-cu_sq));
-         case TN : return REAL_CAST( c1o54*(drho+3.0*( vx2+vx3)+c9o2*( vx2+vx3)*( vx2+vx3)-cu_sq));
-         case BS : return REAL_CAST( c1o54*(drho+3.0*(-vx2-vx3)+c9o2*(-vx2-vx3)*(-vx2-vx3)-cu_sq));
-         case BN : return REAL_CAST( c1o54*(drho+3.0*( vx2-vx3)+c9o2*( vx2-vx3)*( vx2-vx3)-cu_sq));
-         case TS : return REAL_CAST( c1o54*(drho+3.0*(-vx2+vx3)+c9o2*(-vx2+vx3)*(-vx2+vx3)-cu_sq));
-         case TNE : return REAL_CAST(c1o216*(drho+3.0*( vx1+vx2+vx3)+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq));
-         case BSW : return REAL_CAST(c1o216*(drho+3.0*(-vx1-vx2-vx3)+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq));
-         case BNE : return REAL_CAST(c1o216*(drho+3.0*( vx1+vx2-vx3)+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq));
-         case TSW : return REAL_CAST(c1o216*(drho+3.0*(-vx1-vx2+vx3)+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq));
-         case TSE : return REAL_CAST(c1o216*(drho+3.0*( vx1-vx2+vx3)+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq));
-         case BNW : return REAL_CAST(c1o216*(drho+3.0*(-vx1+vx2-vx3)+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq));
-         case BSE : return REAL_CAST(c1o216*(drho+3.0*( vx1-vx2-vx3)+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq));
-         case TNW : return REAL_CAST(c1o216*(drho+3.0*(-vx1+vx2+vx3)+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq));
-         default: throw UbException(UB_EXARGS,"unknown dir");
-      }
-   }
-   //////////////////////////////////////////////////////////////////////////
-   static void calcIncompFeq(LBMReal* const& feq/*[27]*/,const LBMReal& drho,const LBMReal& vx1,const LBMReal& vx2,const LBMReal& vx3)	
-   {
-      using namespace UbMath;
-
-      LBMReal cu_sq=1.5*(vx1*vx1+vx2*vx2+vx3*vx3);
-
-      feq[ZERO] =  c8o27*(drho-cu_sq);
-      feq[E] =  c2o27*(drho+3.0*( vx1   )+c9o2*( vx1   )*( vx1   )-cu_sq);
-      feq[W] =  c2o27*(drho+3.0*(-vx1   )+c9o2*(-vx1   )*(-vx1   )-cu_sq);
-      feq[N] =  c2o27*(drho+3.0*(    vx2)+c9o2*(    vx2)*(    vx2)-cu_sq);
-      feq[S] =  c2o27*(drho+3.0*(   -vx2)+c9o2*(   -vx2)*(   -vx2)-cu_sq);
-      feq[T] =  c2o27*(drho+3.0*( vx3   )+c9o2*(    vx3)*(    vx3)-cu_sq);
-      feq[B] =  c2o27*(drho+3.0*(   -vx3)+c9o2*(   -vx3)*(   -vx3)-cu_sq);
-      feq[NE] =  c1o54*(drho+3.0*( vx1+vx2)+c9o2*( vx1+vx2)*( vx1+vx2)-cu_sq);
-      feq[SW] =  c1o54*(drho+3.0*(-vx1-vx2)+c9o2*(-vx1-vx2)*(-vx1-vx2)-cu_sq);
-      feq[SE] =  c1o54*(drho+3.0*( vx1-vx2)+c9o2*( vx1-vx2)*( vx1-vx2)-cu_sq);
-      feq[NW] =  c1o54*(drho+3.0*(-vx1+vx2)+c9o2*(-vx1+vx2)*(-vx1+vx2)-cu_sq);
-      feq[TE] =  c1o54*(drho+3.0*( vx1+vx3)+c9o2*( vx1+vx3)*( vx1+vx3)-cu_sq);
-      feq[BW] =  c1o54*(drho+3.0*(-vx1-vx3)+c9o2*(-vx1-vx3)*(-vx1-vx3)-cu_sq);
-      feq[BE] =  c1o54*(drho+3.0*( vx1-vx3)+c9o2*( vx1-vx3)*( vx1-vx3)-cu_sq);
-      feq[TW] =  c1o54*(drho+3.0*(-vx1+vx3)+c9o2*(-vx1+vx3)*(-vx1+vx3)-cu_sq);
-      feq[TN] =  c1o54*(drho+3.0*( vx2+vx3)+c9o2*( vx2+vx3)*( vx2+vx3)-cu_sq);
-      feq[BS] =  c1o54*(drho+3.0*(-vx2-vx3)+c9o2*(-vx2-vx3)*(-vx2-vx3)-cu_sq);
-      feq[BN] =  c1o54*(drho+3.0*( vx2-vx3)+c9o2*( vx2-vx3)*( vx2-vx3)-cu_sq);
-      feq[TS] =  c1o54*(drho+3.0*(-vx2+vx3)+c9o2*(-vx2+vx3)*(-vx2+vx3)-cu_sq);
-      feq[TNE] = c1o216*(drho+3.0*( vx1+vx2+vx3)+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq);
-      feq[BSW] = c1o216*(drho+3.0*(-vx1-vx2-vx3)+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq);
-      feq[BNE] = c1o216*(drho+3.0*( vx1+vx2-vx3)+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq);
-      feq[TSW] = c1o216*(drho+3.0*(-vx1-vx2+vx3)+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq);
-      feq[TSE] = c1o216*(drho+3.0*( vx1-vx2+vx3)+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq);
-      feq[BNW] = c1o216*(drho+3.0*(-vx1+vx2-vx3)+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq);
-      feq[BSE] = c1o216*(drho+3.0*( vx1-vx2-vx3)+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq);
-      feq[TNW] = c1o216*(drho+3.0*(-vx1+vx2+vx3)+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq);   
-   }
-   //////////////////////////////////////////////////////////////////////////
-   static inline float getBoundaryVelocityForDirection(const int& direction, const float& bcVelocityX1,const float& bcVelocityX2,const float& bcVelocityX3)
-   {
-      using namespace UbMath;
-
-      switch(direction) 
-      {          
-      case E:   return (float)( UbMath::c4o9*(+bcVelocityX1) );
-      case W:   return (float)( UbMath::c4o9*(-bcVelocityX1) );
-      case N:   return (float)( UbMath::c4o9*(+bcVelocityX2) );
-      case S:   return (float)( UbMath::c4o9*(-bcVelocityX2) );
-      case T:   return (float)( UbMath::c4o9*(+bcVelocityX3) );
-      case B:   return (float)( UbMath::c4o9*(-bcVelocityX3) );
-      case NE:  return (float)( UbMath::c1o9*(+bcVelocityX1+bcVelocityX2             ) );
-      case SW:  return (float)( UbMath::c1o9*(-bcVelocityX1-bcVelocityX2             ) );
-      case SE:  return (float)( UbMath::c1o9*(+bcVelocityX1-bcVelocityX2             ) );
-      case NW:  return (float)( UbMath::c1o9*(-bcVelocityX1+bcVelocityX2             ) );
-      case TE:  return (float)( UbMath::c1o9*(+bcVelocityX1             +bcVelocityX3) );
-      case BW:  return (float)( UbMath::c1o9*(-bcVelocityX1             -bcVelocityX3) );
-      case BE:  return (float)( UbMath::c1o9*(+bcVelocityX1             -bcVelocityX3) );
-      case TW:  return (float)( UbMath::c1o9*(-bcVelocityX1             +bcVelocityX3) );
-      case TN:  return (float)( UbMath::c1o9*(             +bcVelocityX2+bcVelocityX3) );
-      case BS:  return (float)( UbMath::c1o9*(             -bcVelocityX2-bcVelocityX3) );
-      case BN:  return (float)( UbMath::c1o9*(             +bcVelocityX2-bcVelocityX3) );
-      case TS:  return (float)( UbMath::c1o9*(             -bcVelocityX2+bcVelocityX3) );
-      case TNE: return (float)( UbMath::c1o36*(+bcVelocityX1+bcVelocityX2+bcVelocityX3) );
-      case BSW: return (float)( UbMath::c1o36*(-bcVelocityX1-bcVelocityX2-bcVelocityX3) );
-      case BNE: return (float)( UbMath::c1o36*(+bcVelocityX1+bcVelocityX2-bcVelocityX3) );
-      case TSW: return (float)( UbMath::c1o36*(-bcVelocityX1-bcVelocityX2+bcVelocityX3) );
-      case TSE: return (float)( UbMath::c1o36*(+bcVelocityX1-bcVelocityX2+bcVelocityX3) );
-      case BNW: return (float)( UbMath::c1o36*(-bcVelocityX1+bcVelocityX2-bcVelocityX3) );
-      case BSE: return (float)( UbMath::c1o36*(+bcVelocityX1-bcVelocityX2-bcVelocityX3) );
-      case TNW: return (float)( UbMath::c1o36*(-bcVelocityX1+bcVelocityX2+bcVelocityX3) );
-      default: throw UbException(UB_EXARGS,"unknown direction"); 
-      }
-   }
-   /*=====================================================================*/
-   static const int& getInvertDirection(const int& direction)
-   {  
-   #ifdef _DEBUG
-      if(direction<STARTDIR || direction>ENDDIR) 
-         throw UbException(UB_EXARGS,"unknown direction");
-   #endif
-      return INVDIR[direction];
-   }
-   /*=====================================================================*/
-   static void getLBMDirections(std::vector<int>& dirs, bool onlyLBdirs = false)
-   {
-      std::vector<int> D3Q27Dirs;
-      if(onlyLBdirs) /*FSTARTDIR->FENDDIR*/
-      {
-         dirs.resize(FENDDIR+1);
-         for(int dir=FSTARTDIR; dir<=FENDDIR; ++dir)
-            dirs[dir] = dir;
-      }
-      else /*STARTDIR->ENDDIR*/
-      {
-         dirs.resize(ENDDIR+1);
-         for(int dir=STARTDIR; dir<=ENDDIR; ++dir)
-            dirs[dir] = dir;
-      }
-   }
-//////////////////////////////////////////////////////////////////////////
-   static std::vector<int> getEX(const int& exn)
-   {
-      std::vector<int> ex;
-      ex.resize(ENDDIR+1);
-      switch (exn)
-      {
-      case 1:
-         for(int dir=STARTDIR; dir<ENDDIR; ++dir)
-            ex[dir] = DX1[dir];
-      	break;
-      case 2:
-         for(int dir=STARTDIR; dir<ENDDIR; ++dir)
-            ex[dir] = DX2[dir];
-         break;
-      case 3:
-         for(int dir=STARTDIR; dir<ENDDIR; ++dir)
-            ex[dir] = DX3[dir];
-         break;
-      }
-      return ex;
-   }
-//////////////////////////////////////////////////////////////////////////
-   static inline void calcDistanceToNeighbors(std::vector<double>& distNeigh, const double& deltaX1)
-   {
-      //distNeigh.resize(FENDDIR+1, UbMath::sqrt2*deltaX1);
-      double sqrt3 = UbMath::sqrt3;
-      double sqrt2 = UbMath::sqrt2;
-      distNeigh[E] = distNeigh[W] = distNeigh[N] = deltaX1;
-      distNeigh[S] = distNeigh[T] = distNeigh[B] = deltaX1;
-      distNeigh[NE] = distNeigh[NW] = distNeigh[SW] = distNeigh[SE] = sqrt2*deltaX1;
-      distNeigh[TE] = distNeigh[TN] = distNeigh[TW] = distNeigh[TS] = sqrt2*deltaX1;
-      distNeigh[BE] = distNeigh[BN] = distNeigh[BW] = distNeigh[BS] = sqrt2*deltaX1;
-      distNeigh[TNE] = distNeigh[TNW] = distNeigh[TSE] = distNeigh[TSW] = sqrt3*deltaX1;
-      distNeigh[BNE] = distNeigh[BNW] = distNeigh[BSE] = distNeigh[BSW] = sqrt3*deltaX1;
-   }
-//////////////////////////////////////////////////////////////////////////
-   static inline void calcDistanceToNeighbors(std::vector<double>& distNeigh, const double& deltaX1,const double& deltaX2,const double& deltaX3)
-   {
-      //distNeigh.resize(FENDDIR+1, UbMath::sqrt2*deltaX1);
-      double sqrt3 = UbMath::sqrt3;
-      double sqrt2 = UbMath::sqrt2;
-      distNeigh[E] = distNeigh[W] =  deltaX1;
-      distNeigh[N] = distNeigh[S] =  deltaX2;
-      distNeigh[T] = distNeigh[B] = deltaX3;
-      distNeigh[NE] = distNeigh[NW] = distNeigh[SW] = distNeigh[SE] = sqrt(deltaX1*deltaX1+deltaX2*deltaX2);
-      distNeigh[TE] = distNeigh[TN] = distNeigh[TW] = distNeigh[TS] = sqrt(deltaX1*deltaX1+deltaX3*deltaX3);
-      distNeigh[BE] = distNeigh[BN] = distNeigh[BW] = distNeigh[BS] = sqrt(deltaX2*deltaX2+deltaX3*deltaX3);
-      distNeigh[TNE] = distNeigh[TNW] = distNeigh[TSE] = distNeigh[TSW] = sqrt(deltaX1*deltaX1+deltaX2*deltaX2+deltaX3*deltaX3);
-      distNeigh[BNE] = distNeigh[BNW] = distNeigh[BSE] = distNeigh[BSW] = sqrt(deltaX1*deltaX1+deltaX2*deltaX2+deltaX3*deltaX3);
-   }
-//////////////////////////////////////////////////////////////////////////
-   static inline void initRayVectors(double* const& rayX1, double* const& rayX2, double* const&  rayX3)
-   {
-      using namespace UbMath;
-
-      int fdir;
-      double c1oS2 = UbMath::one_over_sqrt2;
-      double c1oS3 = UbMath::one_over_sqrt3;
-      fdir = E;  rayX1[fdir] =  1.0;   rayX2[fdir] =  0.0;   rayX3[fdir] =  0.0;
-      fdir = W;  rayX1[fdir] = -1.0;   rayX2[fdir] =  0.0;   rayX3[fdir] =  0.0;
-      fdir = N;  rayX1[fdir] =  0.0;   rayX2[fdir] =  1.0;   rayX3[fdir] =  0.0;
-      fdir = S;  rayX1[fdir] =  0.0;   rayX2[fdir] = -1.0;   rayX3[fdir] =  0.0;
-      fdir = T;  rayX1[fdir] =  0.0;   rayX2[fdir] =  0.0;   rayX3[fdir] =  1.0;
-      fdir = B;  rayX1[fdir] =  0.0;   rayX2[fdir] =  0.0;   rayX3[fdir] = -1.0;
-      fdir = NE; rayX1[fdir] =  c1oS2; rayX2[fdir] =  c1oS2; rayX3[fdir] =  0.0;
-      fdir = SW; rayX1[fdir] = -c1oS2; rayX2[fdir] = -c1oS2; rayX3[fdir] =  0.0;
-      fdir = SE; rayX1[fdir] =  c1oS2; rayX2[fdir] = -c1oS2; rayX3[fdir] =  0.0;
-      fdir = NW; rayX1[fdir] = -c1oS2; rayX2[fdir] =  c1oS2; rayX3[fdir] =  0.0;
-      fdir = TE; rayX1[fdir] =  c1oS2; rayX2[fdir] = 0.0;    rayX3[fdir] =  c1oS2;
-      fdir = BW; rayX1[fdir] = -c1oS2; rayX2[fdir] = 0.0;    rayX3[fdir] = -c1oS2;
-      fdir = BE; rayX1[fdir] =  c1oS2; rayX2[fdir] = 0.0;    rayX3[fdir] = -c1oS2;
-      fdir = TW; rayX1[fdir] = -c1oS2; rayX2[fdir] = 0.0;    rayX3[fdir] =  c1oS2;
-      fdir = TN; rayX1[fdir] =  0.0;   rayX2[fdir] = c1oS2;  rayX3[fdir] =  c1oS2;
-      fdir = BS; rayX1[fdir] =  0.0;   rayX2[fdir] =-c1oS2;  rayX3[fdir] = -c1oS2;
-      fdir = BN; rayX1[fdir] =  0.0;   rayX2[fdir] = c1oS2;  rayX3[fdir] = -c1oS2;
-      fdir = TS; rayX1[fdir] =  0.0;   rayX2[fdir] =-c1oS2;  rayX3[fdir] =  c1oS2;
-      fdir = TNE; rayX1[fdir] =  c1oS3; rayX2[fdir] =  c1oS3; rayX3[fdir] =  c1oS3;
-      fdir = TNW; rayX1[fdir] = -c1oS3; rayX2[fdir] =  c1oS3; rayX3[fdir] =  c1oS3;
-      fdir = TSE; rayX1[fdir] =  c1oS3; rayX2[fdir] = -c1oS3; rayX3[fdir] =  c1oS3;
-      fdir = TSW; rayX1[fdir] = -c1oS3; rayX2[fdir] = -c1oS3; rayX3[fdir] =  c1oS3;
-      fdir = BNE; rayX1[fdir] =  c1oS3; rayX2[fdir] =  c1oS3; rayX3[fdir] = -c1oS3;
-      fdir = BNW; rayX1[fdir] = -c1oS3; rayX2[fdir] =  c1oS3; rayX3[fdir] = -c1oS3;
-      fdir = BSE; rayX1[fdir] =  c1oS3; rayX2[fdir] = -c1oS3; rayX3[fdir] = -c1oS3;
-      fdir = BSW; rayX1[fdir] = -c1oS3; rayX2[fdir] = -c1oS3; rayX3[fdir] = -c1oS3;
-   }
-//////////////////////////////////////////////////////////////////////////
-   static inline LBMReal calcPress(const LBMReal* const f, LBMReal rho, LBMReal vx1, LBMReal vx2, LBMReal vx3)
-   {
-      using namespace UbMath;
-      LBMReal OxxPyyPzz = c1;
-      return ((f[E]+f[W]+f[N]+f[S]+f[T]+f[B]+c2*(f[NE]+f[SW]+f[SE]+f[NW]+f[TE]+f[BW]+f[BE]+f[TW]+f[TN]+f[BS]+f[BN]+f[TS])+
-         c3*(f[TNE]+f[TSW]+f[TSE]+f[TNW]+f[BNE]+f[BSW]+f[BSE]+f[BNW])-(vx1*vx1+vx2*vx2+vx3*vx3))*(c1-c1o2*OxxPyyPzz)+OxxPyyPzz*c1o2*(rho))*c1o3;
-   }
-}
-
-#endif
-
-
-
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 D3Q27System.h
+//! \ingroup LBM
+//! \author Konstantin Kutscher, Sebastian Geller, Soeren Freudiger
+//=======================================================================================
+
+#ifndef D3Q27SYSTEM_H
+#define D3Q27SYSTEM_H
+
+#include <cmath>
+#include <string>
+#include <iostream>
+
+#include "UbException.h"
+#include "UbMath.h"
+#include "LBMSystem.h"
+
+//! \brief namespace for global system-functions
+namespace D3Q27System
+{
+   //////////////////////////////////////////////////////////////////////////
+   //DIRECTION STUFF
+   static const int FSTARTDIR = 0;
+   static const int FENDDIR   = 25;   //D3Q27
+
+   static const int STARTF = 0;
+   static const int ENDF   = 26;   //D3Q27
+
+   static const int STARTDIR = 0;
+   static const int ENDDIR   = 26;
+
+   extern const int DX1[ENDDIR+1];
+   extern const int DX2[ENDDIR+1];
+   extern const int DX3[ENDDIR+1];
+   extern const double WEIGTH[ENDDIR+1];
+
+   extern const double cNorm[3][ENDDIR];
+   
+   //static const int ZERO /*f0 */ = 0;
+   //static const int E    /*f1 */ = 1;
+   //static const int W    /*f2 */ = 2;
+   //static const int N    /*f3 */ = 3;
+   //static const int S    /*f4 */ = 4;
+   //static const int T    /*f5 */ = 5;
+   //static const int B    /*f6 */ = 6;
+   //static const int NE   /*f7 */ = 7;
+   //static const int SW   /*f8 */ = 8;
+   //static const int SE   /*f9 */ = 9;
+   //static const int NW   /*f10*/ = 10;
+   //static const int TE   /*f11*/ = 11;
+   //static const int BW   /*f12*/ = 12;
+   //static const int BE   /*f13*/ = 13;
+   //static const int TW   /*f14*/ = 14;
+   //static const int TN   /*f15*/ = 15;
+   //static const int BS   /*f16*/ = 16;
+   //static const int BN   /*f17*/ = 17;
+   //static const int TS   /*f18*/ = 18;
+   //static const int TNE          = 19;
+   //static const int TNW          = 20;
+   //static const int TSE          = 21;
+   //static const int TSW          = 22;
+   //static const int BNE          = 23;
+   //static const int BNW          = 24;
+   //static const int BSE          = 25;
+   //static const int BSW          = 26;
+
+   static const int E    /*f1 */ = 0;
+   static const int W    /*f2 */ = 1;
+   static const int N    /*f3 */ = 2;
+   static const int S    /*f4 */ = 3;
+   static const int T    /*f5 */ = 4;
+   static const int B    /*f6 */ = 5;
+   static const int NE   /*f7 */ = 6;
+   static const int SW   /*f8 */ = 7;
+   static const int SE   /*f9 */ = 8;
+   static const int NW   /*f10*/ = 9;
+   static const int TE   /*f11*/ = 10;
+   static const int BW   /*f12*/ = 11;
+   static const int BE   /*f13*/ = 12;
+   static const int TW   /*f14*/ = 13;
+   static const int TN   /*f15*/ = 14;
+   static const int BS   /*f16*/ = 15;
+   static const int BN   /*f17*/ = 16;
+   static const int TS   /*f18*/ = 17;
+   static const int TNE          = 18;
+   static const int TNW          = 19;
+   static const int TSE          = 20;
+   static const int TSW          = 21;
+   static const int BNE          = 22;
+   static const int BNW          = 23;
+   static const int BSE          = 24;
+   static const int BSW          = 25;
+   static const int ZERO /*f0 */ = 26;
+
+   static const int INV_E   = W;  
+   static const int INV_W   = E;  
+   static const int INV_N   = S;  
+   static const int INV_S   = N;  
+   static const int INV_T   = B;  
+   static const int INV_B   = T;  
+   static const int INV_NE  = SW; 
+   static const int INV_SW  = NE; 
+   static const int INV_SE  = NW; 
+   static const int INV_NW  = SE; 
+   static const int INV_TE  = BW; 
+   static const int INV_BW  = TE; 
+   static const int INV_BE  = TW; 
+   static const int INV_TW  = BE; 
+   static const int INV_TN  = BS; 
+   static const int INV_BS  = TN; 
+   static const int INV_BN  = TS; 
+   static const int INV_TS  = BN; 
+   static const int INV_TNE = BSW;
+   static const int INV_TNW = BSE;
+   static const int INV_TSE = BNW;
+   static const int INV_TSW = BNE;
+   static const int INV_BNE = TSW;
+   static const int INV_BNW = TSE;
+   static const int INV_BSE = TNW;
+   static const int INV_BSW = TNE;
+                                       
+   extern const int INVDIR[ENDDIR+1];
+
+   static const int ET_E   = 0;
+   static const int ET_W   = 0;
+   static const int ET_N   = 1;
+   static const int ET_S   = 1;
+   static const int ET_T   = 2;
+   static const int ET_B   = 2;
+   static const int ET_NE  = 3;
+   static const int ET_SW  = 3;
+   static const int ET_SE  = 4;
+   static const int ET_NW  = 4;
+   static const int ET_TE  = 5;
+   static const int ET_BW  = 5;
+   static const int ET_BE  = 6;
+   static const int ET_TW  = 6;
+   static const int ET_TN  = 7;
+   static const int ET_BS  = 7;
+   static const int ET_BN  = 8;
+   static const int ET_TS  = 8;
+   static const int ET_TNE = 9;
+   static const int ET_BSW = 9;
+   static const int ET_TNW = 10;
+   static const int ET_BSE = 10;
+   static const int ET_TSE = 11;
+   static const int ET_BNW = 11;
+   static const int ET_TSW = 12;
+   static const int ET_BNE = 12;
+
+   static const int M_RHO     = 0;  
+   static const int M_EN      = 1;  
+   static const int M_EPS     = 2;  
+   static const int M_JX1     = 3;  
+   static const int M_QX1     = 4;  
+   static const int M_JX2     = 5;  
+   static const int M_QX2     = 6;  
+   static const int M_JX3     = 7;  
+   static const int M_QX3     = 8;  
+   static const int M_3PX1X1  = 9;  
+   static const int M_3PIX1X1 = 10; 
+   static const int M_PWW     = 11; 
+   static const int M_PIWW    = 12; 
+   static const int M_PX1X2   = 13; 
+   static const int M_PX2X3   = 14; 
+   static const int M_PX1X3   = 15; 
+   static const int M_MX1     = 16; 
+   static const int M_MX2     = 17; 
+   static const int M_MX3     = 18; 
+   
+   static const int STARTM = 0;
+   static const int ENDM   = 18;   //D3Q27
+
+
+   
+   //////////////////////////////////////////////////////////////////////////
+   //MACROSCOPIC VALUES                  
+   /*=====================================================================*/
+   static LBMReal getDensity(const LBMReal* const& f/*[27]*/)
+   {
+      return  ((f[TNE] + f[BSW])+(f[TSE]+f[BNW]))+((f[BSE]+f[TNW])+ (f[TSW]+f[BNE]))
+             +(((f[NE] + f[SW]) + (f[SE] + f[NW]))+((f[TE] + f[BW])+(f[BE]+ f[TW]))
+             +((f[BN] + f[TS]) + (f[TN] + f[BS])))+((f[E] + f[W])+(f[N] + f[S])
+             +(f[T] + f[B]))+f[ZERO];
+   }
+   /*=====================================================================*/
+   //ATTENTION: does not apply to all models -> use certificate instead of static! to do
+   static LBMReal getPressure(const LBMReal* const& f/*[27]*/)
+   {
+      return  REAL_CAST( UbMath::c1o3 )*getDensity(f);
+   }
+   /*=====================================================================*/
+   static LBMReal getIncompVelocityX1(const LBMReal* const& f/*[27]*/)
+   {
+      return ((((f[TNE]-f[BSW]) + (f[TSE]-f[BNW])) + ((f[BSE]-f[TNW]) + (f[BNE]-f[TSW]))) +
+             (((f[BE]-f[TW]) + (f[TE]-f[BW])) + ((f[SE]-f[NW]) + (f[NE]-f[SW]))) +
+             (f[E]-f[W]));  
+   }
+   /*=====================================================================*/
+   static LBMReal getIncompVelocityX2(const LBMReal* const& f/*[27]*/)
+   {
+      return ((((f[TNE]-f[BSW]) + (f[BNW]-f[TSE])) + ((f[TNW]-f[BSE]) + (f[BNE]-f[TSW]))) +
+             (((f[BN]-f[TS]) + (f[TN]-f[BS])) + ((f[NW]-f[SE]) + (f[NE]-f[SW]))) +
+             (f[N]-f[S]));  
+   }
+   /*=====================================================================*/
+   static LBMReal getIncompVelocityX3(const LBMReal* const& f/*[27]*/)
+   {
+      return ((((f[TNE] - f[BSW]) + (f[TSE] - f[BNW])) + ((f[TNW] - f[BSE]) + (f[TSW] - f[BNE]))) +
+             (((f[TS] - f[BN]) + (f[TN] - f[BS])) + ((f[TW] - f[BE]) + (f[TE] - f[BW]))) +
+             (f[T] - f[B]));
+   }
+   /*=====================================================================*/
+   static void calcDensity(const LBMReal* const& f/*[27]*/, LBMReal& rho)
+   {
+      rho = ((f[TNE] + f[BSW])+(f[TSE]+f[BNW]))+((f[BSE]+f[TNW])+ (f[TSW]+f[BNE]))
+         +(((f[NE] + f[SW]) + (f[SE] + f[NW]))+((f[TE] + f[BW])+(f[BE]+ f[TW]))
+         +((f[BN] + f[TS]) + (f[TN] + f[BS])))+((f[E] + f[W])+(f[N] + f[S])
+         +(f[T] + f[B]))+f[ZERO];
+         
+   }
+   /*=====================================================================*/
+   static void calcIncompVelocityX1(const LBMReal* const& f/*[27]*/, LBMReal& vx1)
+   {
+      vx1 = ((((f[TNE]-f[BSW]) + (f[TSE]-f[BNW])) + ((f[BSE]-f[TNW]) + (f[BNE]-f[TSW]))) +
+             (((f[BE]-f[TW]) + (f[TE]-f[BW])) + ((f[SE]-f[NW]) + (f[NE]-f[SW]))) +
+             (f[E]-f[W]));
+   }
+   /*=====================================================================*/
+   static void calcIncompVelocityX2(const LBMReal* const& f/*[27]*/, LBMReal& vx2)
+   {
+      vx2 = ((((f[TNE]-f[BSW]) + (f[BNW]-f[TSE])) + ((f[TNW]-f[BSE]) + (f[BNE]-f[TSW]))) +
+             (((f[BN]-f[TS]) + (f[TN]-f[BS])) + ((f[NW]-f[SE]) + (f[NE]-f[SW]))) +
+             (f[N]-f[S]));
+   }
+   /*=====================================================================*/
+   static void calcIncompVelocityX3(const LBMReal* const& f/*[27]*/, LBMReal& vx3)
+   {
+      vx3 =((((f[TNE]-f[BSW]) + (f[TSE]-f[BNW])) + ((f[TNW]-f[BSE]) + (f[TSW]-f[BNE]))) +
+             (((f[TS]-f[BN]) + (f[TN]-f[BS])) + ((f[TW]-f[BE]) + (f[TE]-f[BW]))) +
+             (f[T]-f[B]));
+   }
+   /*=====================================================================*/
+   static LBMReal getCompVelocityX1(const LBMReal* const& f/*[27]*/)
+   {
+      return ((((f[TNE]-f[BSW]) + (f[TSE]-f[BNW])) + ((f[BSE]-f[TNW]) + (f[BNE]-f[TSW]))) +
+             (((f[BE]-f[TW]) + (f[TE]-f[BW])) + ((f[SE]-f[NW]) + (f[NE]-f[SW]))) +
+             (f[E]-f[W]))/getDensity(f);  
+   }
+   /*=====================================================================*/
+   static LBMReal getCompVelocityX2(const LBMReal* const& f/*[27]*/)
+   {
+      return ((((f[TNE]-f[BSW]) + (f[BNW]-f[TSE])) + ((f[TNW]-f[BSE]) + (f[BNE]-f[TSW]))) +
+             (((f[BN]-f[TS]) + (f[TN]-f[BS])) + ((f[NW]-f[SE]) + (f[NE]-f[SW]))) +
+             (f[N]-f[S]))/getDensity(f);  
+  }
+   /*=====================================================================*/
+   static LBMReal getCompVelocityX3(const LBMReal* const& f/*[27]*/)
+   {
+      return ((((f[TNE]-f[BSW]) + (f[TSE]-f[BNW])) + ((f[TNW]-f[BSE]) + (f[TSW]-f[BNE]))) +
+             (((f[TS]-f[BN]) + (f[TN]-f[BS])) + ((f[TW]-f[BE]) + (f[TE]-f[BW]))) +
+             (f[T]-f[B]))/getDensity(f);
+   }
+   /*=====================================================================*/
+   static void calcCompVelocityX1(const LBMReal* const& f/*[27]*/, LBMReal& vx1)
+   {
+      vx1 = ((((f[TNE]-f[BSW]) + (f[TSE]-f[BNW])) + ((f[BSE]-f[TNW]) + (f[BNE]-f[TSW]))) +
+            (((f[BE]-f[TW]) + (f[TE]-f[BW])) + ((f[SE]-f[NW]) + (f[NE]-f[SW]))) +
+            (f[E]-f[W]))/getDensity(f);  
+   }
+   /*=====================================================================*/
+   static void calcCompVelocityX2(const LBMReal* const& f/*[27]*/, LBMReal& vx2)
+   {
+      vx2 = ((((f[TNE]-f[BSW]) + (f[BNW]-f[TSE])) + ((f[TNW]-f[BSE]) + (f[BNE]-f[TSW]))) +
+            (((f[BN]-f[TS]) + (f[TN]-f[BS])) + ((f[NW]-f[SE]) + (f[NE]-f[SW]))) +
+            (f[N]-f[S]))/getDensity(f);  
+   }
+   /*=====================================================================*/
+   static void calcCompVelocityX3(const LBMReal* const& f/*[27]*/, LBMReal& vx3)
+   {
+      vx3 = ((((f[TNE]-f[BSW]) + (f[TSE]-f[BNW])) + ((f[TNW]-f[BSE]) + (f[TSW]-f[BNE]))) +
+            (((f[TS]-f[BN]) + (f[TN]-f[BS])) + ((f[TW]-f[BE]) + (f[TE]-f[BW]))) +
+            (f[T]-f[B]))/getDensity(f);
+   }
+   /*=====================================================================*/
+   static void calcIncompMacroscopicValues(const LBMReal* const& f/*[27]*/, LBMReal& rho, LBMReal& vx1, LBMReal& vx2, LBMReal& vx3)
+   {
+      D3Q27System::calcDensity(f, rho);
+      D3Q27System::calcIncompVelocityX1(f, vx1);
+      D3Q27System::calcIncompVelocityX2(f, vx2);
+      D3Q27System::calcIncompVelocityX3(f, vx3);
+   }
+
+   /*=====================================================================*/
+   static void calcCompMacroscopicValues(const LBMReal* const& f/*[27]*/, LBMReal& drho, LBMReal& vx1, LBMReal& vx2, LBMReal& vx3)
+   {
+      D3Q27System::calcDensity(f, drho);
+      D3Q27System::calcIncompVelocityX1(f, vx1);
+      D3Q27System::calcIncompVelocityX2(f, vx2);
+      D3Q27System::calcIncompVelocityX3(f, vx3);
+      LBMReal rho = drho+UbMath::c1;
+      vx1/=rho;
+      vx2/=rho;
+      vx3/=rho;
+   }
+   //////////////////////////////////////////////////////////////////////////
+   static LBMReal getCompFeqForDirection(const int& direction, const LBMReal& drho,const LBMReal& vx1,const LBMReal& vx2,const LBMReal& vx3)
+   {
+      using namespace UbMath;
+      LBMReal cu_sq=1.5*(vx1*vx1+vx2*vx2+vx3*vx3);
+
+      ////-----
+      LBMReal rho = drho+c1;
+      switch (direction)
+      {
+      case ZERO: return REAL_CAST(c8o27*(drho+rho*(-cu_sq)));
+      case E: return REAL_CAST(c2o27*(drho+rho*(3.0*(vx1)+c9o2*(vx1)*(vx1)-cu_sq)));
+      case W: return REAL_CAST(c2o27*(drho+rho*(3.0*(-vx1)+c9o2*(-vx1)*(-vx1)-cu_sq)));
+      case N: return REAL_CAST(c2o27*(drho+rho*(3.0*(vx2)+c9o2*(vx2)*(vx2)-cu_sq)));
+      case S: return REAL_CAST(c2o27*(drho+rho*(3.0*(-vx2)+c9o2*(-vx2)*(-vx2)-cu_sq)));
+      case T: return REAL_CAST(c2o27*(drho+rho*(3.0*(vx3)+c9o2*(vx3)*(vx3)-cu_sq)));
+      case B: return REAL_CAST(c2o27*(drho+rho*(3.0*(-vx3)+c9o2*(-vx3)*(-vx3)-cu_sq)));
+      case NE: return REAL_CAST(c1o54*(drho+rho*(3.0*(vx1+vx2)+c9o2*(vx1+vx2)*(vx1+vx2)-cu_sq)));
+      case SW: return REAL_CAST(c1o54*(drho+rho*(3.0*(-vx1-vx2)+c9o2*(-vx1-vx2)*(-vx1-vx2)-cu_sq)));
+      case SE: return REAL_CAST(c1o54*(drho+rho*(3.0*(vx1-vx2)+c9o2*(vx1-vx2)*(vx1-vx2)-cu_sq)));
+      case NW: return REAL_CAST(c1o54*(drho+rho*(3.0*(-vx1+vx2)+c9o2*(-vx1+vx2)*(-vx1+vx2)-cu_sq)));
+      case TE: return REAL_CAST(c1o54*(drho+rho*(3.0*(vx1+vx3)+c9o2*(vx1+vx3)*(vx1+vx3)-cu_sq)));
+      case BW: return REAL_CAST(c1o54*(drho+rho*(3.0*(-vx1-vx3)+c9o2*(-vx1-vx3)*(-vx1-vx3)-cu_sq)));
+      case BE: return REAL_CAST(c1o54*(drho+rho*(3.0*(vx1-vx3)+c9o2*(vx1-vx3)*(vx1-vx3)-cu_sq)));
+      case TW: return REAL_CAST(c1o54*(drho+rho*(3.0*(-vx1+vx3)+c9o2*(-vx1+vx3)*(-vx1+vx3)-cu_sq)));
+      case TN: return REAL_CAST(c1o54*(drho+rho*(3.0*(vx2+vx3)+c9o2*(vx2+vx3)*(vx2+vx3)-cu_sq)));
+      case BS: return REAL_CAST(c1o54*(drho+rho*(3.0*(-vx2-vx3)+c9o2*(-vx2-vx3)*(-vx2-vx3)-cu_sq)));
+      case BN: return REAL_CAST(c1o54*(drho+rho*(3.0*(vx2-vx3)+c9o2*(vx2-vx3)*(vx2-vx3)-cu_sq)));
+      case TS: return REAL_CAST(c1o54*(drho+rho*(3.0*(-vx2+vx3)+c9o2*(-vx2+vx3)*(-vx2+vx3)-cu_sq)));
+      case TNE: return REAL_CAST(c1o216*(drho+rho*(3.0*(vx1+vx2+vx3)+c9o2*(vx1+vx2+vx3)*(vx1+vx2+vx3)-cu_sq)));
+      case BSW: return REAL_CAST(c1o216*(drho+rho*(3.0*(-vx1-vx2-vx3)+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq)));
+      case BNE: return REAL_CAST(c1o216*(drho+rho*(3.0*(vx1+vx2-vx3)+c9o2*(vx1+vx2-vx3)*(vx1+vx2-vx3)-cu_sq)));
+      case TSW: return REAL_CAST(c1o216*(drho+rho*(3.0*(-vx1-vx2+vx3)+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq)));
+      case TSE: return REAL_CAST(c1o216*(drho+rho*(3.0*(vx1-vx2+vx3)+c9o2*(vx1-vx2+vx3)*(vx1-vx2+vx3)-cu_sq)));
+      case BNW: return REAL_CAST(c1o216*(drho+rho*(3.0*(-vx1+vx2-vx3)+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq)));
+      case BSE: return REAL_CAST(c1o216*(drho+rho*(3.0*(vx1-vx2-vx3)+c9o2*(vx1-vx2-vx3)*(vx1-vx2-vx3)-cu_sq)));
+      case TNW: return REAL_CAST(c1o216*(drho+rho*(3.0*(-vx1+vx2+vx3)+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq)));
+      default: throw UbException(UB_EXARGS, "unknown dir");
+      }
+
+   }
+   //////////////////////////////////////////////////////////////////////////
+   static void calcCompFeq(LBMReal* const& feq/*[27]*/,const LBMReal& drho,const LBMReal& vx1,const LBMReal& vx2,const LBMReal& vx3)	
+   {
+      using namespace UbMath;
+
+      LBMReal cu_sq = 1.5*(vx1*vx1+vx2*vx2+vx3*vx3);
+      LBMReal rho = drho+c1;
+
+      feq[ZERO] = c8o27*(drho+rho*(-cu_sq));
+      feq[E] = c2o27*(drho+rho*(3.0*(vx1)+c9o2*(vx1)*(vx1)-cu_sq));
+      feq[W] = c2o27*(drho+rho*(3.0*(-vx1)+c9o2*(-vx1)*(-vx1)-cu_sq));
+      feq[N] = c2o27*(drho+rho*(3.0*(vx2)+c9o2*(vx2)*(vx2)-cu_sq));
+      feq[S] = c2o27*(drho+rho*(3.0*(-vx2)+c9o2*(-vx2)*(-vx2)-cu_sq));
+      feq[T] = c2o27*(drho+rho*(3.0*(vx3)+c9o2*(vx3)*(vx3)-cu_sq));
+      feq[B] = c2o27*(drho+rho*(3.0*(-vx3)+c9o2*(-vx3)*(-vx3)-cu_sq));
+      feq[NE] = c1o54*(drho+rho*(3.0*(vx1+vx2)+c9o2*(vx1+vx2)*(vx1+vx2)-cu_sq));
+      feq[SW] = c1o54*(drho+rho*(3.0*(-vx1-vx2)+c9o2*(-vx1-vx2)*(-vx1-vx2)-cu_sq));
+      feq[SE] = c1o54*(drho+rho*(3.0*(vx1-vx2)+c9o2*(vx1-vx2)*(vx1-vx2)-cu_sq));
+      feq[NW] = c1o54*(drho+rho*(3.0*(-vx1+vx2)+c9o2*(-vx1+vx2)*(-vx1+vx2)-cu_sq));
+      feq[TE] = c1o54*(drho+rho*(3.0*(vx1+vx3)+c9o2*(vx1+vx3)*(vx1+vx3)-cu_sq));
+      feq[BW] = c1o54*(drho+rho*(3.0*(-vx1-vx3)+c9o2*(-vx1-vx3)*(-vx1-vx3)-cu_sq));
+      feq[BE] = c1o54*(drho+rho*(3.0*(vx1-vx3)+c9o2*(vx1-vx3)*(vx1-vx3)-cu_sq));
+      feq[TW] = c1o54*(drho+rho*(3.0*(-vx1+vx3)+c9o2*(-vx1+vx3)*(-vx1+vx3)-cu_sq));
+      feq[TN] = c1o54*(drho+rho*(3.0*(vx2+vx3)+c9o2*(vx2+vx3)*(vx2+vx3)-cu_sq));
+      feq[BS] = c1o54*(drho+rho*(3.0*(-vx2-vx3)+c9o2*(-vx2-vx3)*(-vx2-vx3)-cu_sq));
+      feq[BN] = c1o54*(drho+rho*(3.0*(vx2-vx3)+c9o2*(vx2-vx3)*(vx2-vx3)-cu_sq));
+      feq[TS] = c1o54*(drho+rho*(3.0*(-vx2+vx3)+c9o2*(-vx2+vx3)*(-vx2+vx3)-cu_sq));
+      feq[TNE] = c1o216*(drho+rho*(3.0*(vx1+vx2+vx3)+c9o2*(vx1+vx2+vx3)*(vx1+vx2+vx3)-cu_sq));
+      feq[BSW] = c1o216*(drho+rho*(3.0*(-vx1-vx2-vx3)+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq));
+      feq[BNE] = c1o216*(drho+rho*(3.0*(vx1+vx2-vx3)+c9o2*(vx1+vx2-vx3)*(vx1+vx2-vx3)-cu_sq));
+      feq[TSW] = c1o216*(drho+rho*(3.0*(-vx1-vx2+vx3)+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq));
+      feq[TSE] = c1o216*(drho+rho*(3.0*(vx1-vx2+vx3)+c9o2*(vx1-vx2+vx3)*(vx1-vx2+vx3)-cu_sq));
+      feq[BNW] = c1o216*(drho+rho*(3.0*(-vx1+vx2-vx3)+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq));
+      feq[BSE] = c1o216*(drho+rho*(3.0*(vx1-vx2-vx3)+c9o2*(vx1-vx2-vx3)*(vx1-vx2-vx3)-cu_sq));
+      feq[TNW] = c1o216*(drho+rho*(3.0*(-vx1+vx2+vx3)+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq));
+   }
+   //////////////////////////////////////////////////////////////////////////
+   static LBMReal getIncompFeqForDirection(const int& direction,const LBMReal& drho, const LBMReal& vx1,const LBMReal& vx2,const LBMReal& vx3)	
+   {
+      using namespace UbMath;
+
+      LBMReal cu_sq=1.5f*(vx1*vx1+vx2*vx2+vx3*vx3);
+
+      switch(direction)    
+      {		 
+         case ZERO : return REAL_CAST( c8o27*(drho-cu_sq));
+         case E : return REAL_CAST( c2o27*(drho+3.0*( vx1   )+c9o2*( vx1   )*( vx1   )-cu_sq));
+         case W : return REAL_CAST( c2o27*(drho+3.0*(-vx1   )+c9o2*(-vx1   )*(-vx1   )-cu_sq));
+         case N : return REAL_CAST( c2o27*(drho+3.0*(    vx2)+c9o2*(    vx2)*(    vx2)-cu_sq));
+         case S : return REAL_CAST( c2o27*(drho+3.0*(   -vx2)+c9o2*(   -vx2)*(   -vx2)-cu_sq));
+         case T : return REAL_CAST( c2o27*(drho+3.0*( vx3   )+c9o2*(    vx3)*(    vx3)-cu_sq));
+         case B : return REAL_CAST( c2o27*(drho+3.0*(   -vx3)+c9o2*(   -vx3)*(   -vx3)-cu_sq));
+         case NE : return REAL_CAST( c1o54*(drho+3.0*( vx1+vx2)+c9o2*( vx1+vx2)*( vx1+vx2)-cu_sq));
+         case SW : return REAL_CAST( c1o54*(drho+3.0*(-vx1-vx2)+c9o2*(-vx1-vx2)*(-vx1-vx2)-cu_sq));
+         case SE : return REAL_CAST( c1o54*(drho+3.0*( vx1-vx2)+c9o2*( vx1-vx2)*( vx1-vx2)-cu_sq));
+         case NW : return REAL_CAST( c1o54*(drho+3.0*(-vx1+vx2)+c9o2*(-vx1+vx2)*(-vx1+vx2)-cu_sq));
+         case TE : return REAL_CAST( c1o54*(drho+3.0*( vx1+vx3)+c9o2*( vx1+vx3)*( vx1+vx3)-cu_sq));
+         case BW : return REAL_CAST( c1o54*(drho+3.0*(-vx1-vx3)+c9o2*(-vx1-vx3)*(-vx1-vx3)-cu_sq));
+         case BE : return REAL_CAST( c1o54*(drho+3.0*( vx1-vx3)+c9o2*( vx1-vx3)*( vx1-vx3)-cu_sq));
+         case TW : return REAL_CAST( c1o54*(drho+3.0*(-vx1+vx3)+c9o2*(-vx1+vx3)*(-vx1+vx3)-cu_sq));
+         case TN : return REAL_CAST( c1o54*(drho+3.0*( vx2+vx3)+c9o2*( vx2+vx3)*( vx2+vx3)-cu_sq));
+         case BS : return REAL_CAST( c1o54*(drho+3.0*(-vx2-vx3)+c9o2*(-vx2-vx3)*(-vx2-vx3)-cu_sq));
+         case BN : return REAL_CAST( c1o54*(drho+3.0*( vx2-vx3)+c9o2*( vx2-vx3)*( vx2-vx3)-cu_sq));
+         case TS : return REAL_CAST( c1o54*(drho+3.0*(-vx2+vx3)+c9o2*(-vx2+vx3)*(-vx2+vx3)-cu_sq));
+         case TNE : return REAL_CAST(c1o216*(drho+3.0*( vx1+vx2+vx3)+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq));
+         case BSW : return REAL_CAST(c1o216*(drho+3.0*(-vx1-vx2-vx3)+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq));
+         case BNE : return REAL_CAST(c1o216*(drho+3.0*( vx1+vx2-vx3)+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq));
+         case TSW : return REAL_CAST(c1o216*(drho+3.0*(-vx1-vx2+vx3)+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq));
+         case TSE : return REAL_CAST(c1o216*(drho+3.0*( vx1-vx2+vx3)+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq));
+         case BNW : return REAL_CAST(c1o216*(drho+3.0*(-vx1+vx2-vx3)+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq));
+         case BSE : return REAL_CAST(c1o216*(drho+3.0*( vx1-vx2-vx3)+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq));
+         case TNW : return REAL_CAST(c1o216*(drho+3.0*(-vx1+vx2+vx3)+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq));
+         default: throw UbException(UB_EXARGS,"unknown dir");
+      }
+   }
+   //////////////////////////////////////////////////////////////////////////
+   static void calcIncompFeq(LBMReal* const& feq/*[27]*/,const LBMReal& drho,const LBMReal& vx1,const LBMReal& vx2,const LBMReal& vx3)	
+   {
+      using namespace UbMath;
+
+      LBMReal cu_sq=1.5*(vx1*vx1+vx2*vx2+vx3*vx3);
+
+      feq[ZERO] =  c8o27*(drho-cu_sq);
+      feq[E] =  c2o27*(drho+3.0*( vx1   )+c9o2*( vx1   )*( vx1   )-cu_sq);
+      feq[W] =  c2o27*(drho+3.0*(-vx1   )+c9o2*(-vx1   )*(-vx1   )-cu_sq);
+      feq[N] =  c2o27*(drho+3.0*(    vx2)+c9o2*(    vx2)*(    vx2)-cu_sq);
+      feq[S] =  c2o27*(drho+3.0*(   -vx2)+c9o2*(   -vx2)*(   -vx2)-cu_sq);
+      feq[T] =  c2o27*(drho+3.0*( vx3   )+c9o2*(    vx3)*(    vx3)-cu_sq);
+      feq[B] =  c2o27*(drho+3.0*(   -vx3)+c9o2*(   -vx3)*(   -vx3)-cu_sq);
+      feq[NE] =  c1o54*(drho+3.0*( vx1+vx2)+c9o2*( vx1+vx2)*( vx1+vx2)-cu_sq);
+      feq[SW] =  c1o54*(drho+3.0*(-vx1-vx2)+c9o2*(-vx1-vx2)*(-vx1-vx2)-cu_sq);
+      feq[SE] =  c1o54*(drho+3.0*( vx1-vx2)+c9o2*( vx1-vx2)*( vx1-vx2)-cu_sq);
+      feq[NW] =  c1o54*(drho+3.0*(-vx1+vx2)+c9o2*(-vx1+vx2)*(-vx1+vx2)-cu_sq);
+      feq[TE] =  c1o54*(drho+3.0*( vx1+vx3)+c9o2*( vx1+vx3)*( vx1+vx3)-cu_sq);
+      feq[BW] =  c1o54*(drho+3.0*(-vx1-vx3)+c9o2*(-vx1-vx3)*(-vx1-vx3)-cu_sq);
+      feq[BE] =  c1o54*(drho+3.0*( vx1-vx3)+c9o2*( vx1-vx3)*( vx1-vx3)-cu_sq);
+      feq[TW] =  c1o54*(drho+3.0*(-vx1+vx3)+c9o2*(-vx1+vx3)*(-vx1+vx3)-cu_sq);
+      feq[TN] =  c1o54*(drho+3.0*( vx2+vx3)+c9o2*( vx2+vx3)*( vx2+vx3)-cu_sq);
+      feq[BS] =  c1o54*(drho+3.0*(-vx2-vx3)+c9o2*(-vx2-vx3)*(-vx2-vx3)-cu_sq);
+      feq[BN] =  c1o54*(drho+3.0*( vx2-vx3)+c9o2*( vx2-vx3)*( vx2-vx3)-cu_sq);
+      feq[TS] =  c1o54*(drho+3.0*(-vx2+vx3)+c9o2*(-vx2+vx3)*(-vx2+vx3)-cu_sq);
+      feq[TNE] = c1o216*(drho+3.0*( vx1+vx2+vx3)+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq);
+      feq[BSW] = c1o216*(drho+3.0*(-vx1-vx2-vx3)+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq);
+      feq[BNE] = c1o216*(drho+3.0*( vx1+vx2-vx3)+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq);
+      feq[TSW] = c1o216*(drho+3.0*(-vx1-vx2+vx3)+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq);
+      feq[TSE] = c1o216*(drho+3.0*( vx1-vx2+vx3)+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq);
+      feq[BNW] = c1o216*(drho+3.0*(-vx1+vx2-vx3)+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq);
+      feq[BSE] = c1o216*(drho+3.0*( vx1-vx2-vx3)+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq);
+      feq[TNW] = c1o216*(drho+3.0*(-vx1+vx2+vx3)+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq);   
+   }
+   //////////////////////////////////////////////////////////////////////////
+   static inline float getBoundaryVelocityForDirection(const int& direction, const float& bcVelocityX1,const float& bcVelocityX2,const float& bcVelocityX3)
+   {
+      using namespace UbMath;
+
+      switch(direction) 
+      {          
+      case E:   return (float)( UbMath::c4o9*(+bcVelocityX1) );
+      case W:   return (float)( UbMath::c4o9*(-bcVelocityX1) );
+      case N:   return (float)( UbMath::c4o9*(+bcVelocityX2) );
+      case S:   return (float)( UbMath::c4o9*(-bcVelocityX2) );
+      case T:   return (float)( UbMath::c4o9*(+bcVelocityX3) );
+      case B:   return (float)( UbMath::c4o9*(-bcVelocityX3) );
+      case NE:  return (float)( UbMath::c1o9*(+bcVelocityX1+bcVelocityX2             ) );
+      case SW:  return (float)( UbMath::c1o9*(-bcVelocityX1-bcVelocityX2             ) );
+      case SE:  return (float)( UbMath::c1o9*(+bcVelocityX1-bcVelocityX2             ) );
+      case NW:  return (float)( UbMath::c1o9*(-bcVelocityX1+bcVelocityX2             ) );
+      case TE:  return (float)( UbMath::c1o9*(+bcVelocityX1             +bcVelocityX3) );
+      case BW:  return (float)( UbMath::c1o9*(-bcVelocityX1             -bcVelocityX3) );
+      case BE:  return (float)( UbMath::c1o9*(+bcVelocityX1             -bcVelocityX3) );
+      case TW:  return (float)( UbMath::c1o9*(-bcVelocityX1             +bcVelocityX3) );
+      case TN:  return (float)( UbMath::c1o9*(             +bcVelocityX2+bcVelocityX3) );
+      case BS:  return (float)( UbMath::c1o9*(             -bcVelocityX2-bcVelocityX3) );
+      case BN:  return (float)( UbMath::c1o9*(             +bcVelocityX2-bcVelocityX3) );
+      case TS:  return (float)( UbMath::c1o9*(             -bcVelocityX2+bcVelocityX3) );
+      case TNE: return (float)( UbMath::c1o36*(+bcVelocityX1+bcVelocityX2+bcVelocityX3) );
+      case BSW: return (float)( UbMath::c1o36*(-bcVelocityX1-bcVelocityX2-bcVelocityX3) );
+      case BNE: return (float)( UbMath::c1o36*(+bcVelocityX1+bcVelocityX2-bcVelocityX3) );
+      case TSW: return (float)( UbMath::c1o36*(-bcVelocityX1-bcVelocityX2+bcVelocityX3) );
+      case TSE: return (float)( UbMath::c1o36*(+bcVelocityX1-bcVelocityX2+bcVelocityX3) );
+      case BNW: return (float)( UbMath::c1o36*(-bcVelocityX1+bcVelocityX2-bcVelocityX3) );
+      case BSE: return (float)( UbMath::c1o36*(+bcVelocityX1-bcVelocityX2-bcVelocityX3) );
+      case TNW: return (float)( UbMath::c1o36*(-bcVelocityX1+bcVelocityX2+bcVelocityX3) );
+      default: throw UbException(UB_EXARGS,"unknown direction"); 
+      }
+   }
+   /*=====================================================================*/
+   static const int& getInvertDirection(const int& direction)
+   {  
+   #ifdef _DEBUG
+      if(direction<STARTDIR || direction>ENDDIR) 
+         throw UbException(UB_EXARGS,"unknown direction");
+   #endif
+      return INVDIR[direction];
+   }
+   /*=====================================================================*/
+   static void getLBMDirections(std::vector<int>& dirs, bool onlyLBdirs = false)
+   {
+      std::vector<int> D3Q27Dirs;
+      if(onlyLBdirs) /*FSTARTDIR->FENDDIR*/
+      {
+         dirs.resize(FENDDIR+1);
+         for(int dir=FSTARTDIR; dir<=FENDDIR; ++dir)
+            dirs[dir] = dir;
+      }
+      else /*STARTDIR->ENDDIR*/
+      {
+         dirs.resize(ENDDIR+1);
+         for(int dir=STARTDIR; dir<=ENDDIR; ++dir)
+            dirs[dir] = dir;
+      }
+   }
+//////////////////////////////////////////////////////////////////////////
+   static std::vector<int> getEX(const int& exn)
+   {
+      std::vector<int> ex;
+      ex.resize(ENDDIR+1);
+      switch (exn)
+      {
+      case 1:
+         for(int dir=STARTDIR; dir<ENDDIR; ++dir)
+            ex[dir] = DX1[dir];
+      	break;
+      case 2:
+         for(int dir=STARTDIR; dir<ENDDIR; ++dir)
+            ex[dir] = DX2[dir];
+         break;
+      case 3:
+         for(int dir=STARTDIR; dir<ENDDIR; ++dir)
+            ex[dir] = DX3[dir];
+         break;
+      }
+      return ex;
+   }
+//////////////////////////////////////////////////////////////////////////
+   static inline void calcDistanceToNeighbors(std::vector<double>& distNeigh, const double& deltaX1)
+   {
+      //distNeigh.resize(FENDDIR+1, UbMath::sqrt2*deltaX1);
+      double sqrt3 = UbMath::sqrt3;
+      double sqrt2 = UbMath::sqrt2;
+      distNeigh[E] = distNeigh[W] = distNeigh[N] = deltaX1;
+      distNeigh[S] = distNeigh[T] = distNeigh[B] = deltaX1;
+      distNeigh[NE] = distNeigh[NW] = distNeigh[SW] = distNeigh[SE] = sqrt2*deltaX1;
+      distNeigh[TE] = distNeigh[TN] = distNeigh[TW] = distNeigh[TS] = sqrt2*deltaX1;
+      distNeigh[BE] = distNeigh[BN] = distNeigh[BW] = distNeigh[BS] = sqrt2*deltaX1;
+      distNeigh[TNE] = distNeigh[TNW] = distNeigh[TSE] = distNeigh[TSW] = sqrt3*deltaX1;
+      distNeigh[BNE] = distNeigh[BNW] = distNeigh[BSE] = distNeigh[BSW] = sqrt3*deltaX1;
+   }
+//////////////////////////////////////////////////////////////////////////
+   static inline void calcDistanceToNeighbors(std::vector<double>& distNeigh, const double& deltaX1,const double& deltaX2,const double& deltaX3)
+   {
+      //distNeigh.resize(FENDDIR+1, UbMath::sqrt2*deltaX1);
+      double sqrt3 = UbMath::sqrt3;
+      double sqrt2 = UbMath::sqrt2;
+      distNeigh[E] = distNeigh[W] =  deltaX1;
+      distNeigh[N] = distNeigh[S] =  deltaX2;
+      distNeigh[T] = distNeigh[B] = deltaX3;
+      distNeigh[NE] = distNeigh[NW] = distNeigh[SW] = distNeigh[SE] = sqrt(deltaX1*deltaX1+deltaX2*deltaX2);
+      distNeigh[TE] = distNeigh[TN] = distNeigh[TW] = distNeigh[TS] = sqrt(deltaX1*deltaX1+deltaX3*deltaX3);
+      distNeigh[BE] = distNeigh[BN] = distNeigh[BW] = distNeigh[BS] = sqrt(deltaX2*deltaX2+deltaX3*deltaX3);
+      distNeigh[TNE] = distNeigh[TNW] = distNeigh[TSE] = distNeigh[TSW] = sqrt(deltaX1*deltaX1+deltaX2*deltaX2+deltaX3*deltaX3);
+      distNeigh[BNE] = distNeigh[BNW] = distNeigh[BSE] = distNeigh[BSW] = sqrt(deltaX1*deltaX1+deltaX2*deltaX2+deltaX3*deltaX3);
+   }
+//////////////////////////////////////////////////////////////////////////
+   static inline void initRayVectors(double* const& rayX1, double* const& rayX2, double* const&  rayX3)
+   {
+      using namespace UbMath;
+
+      int fdir;
+      double c1oS2 = UbMath::one_over_sqrt2;
+      double c1oS3 = UbMath::one_over_sqrt3;
+      fdir = E;  rayX1[fdir] =  1.0;   rayX2[fdir] =  0.0;   rayX3[fdir] =  0.0;
+      fdir = W;  rayX1[fdir] = -1.0;   rayX2[fdir] =  0.0;   rayX3[fdir] =  0.0;
+      fdir = N;  rayX1[fdir] =  0.0;   rayX2[fdir] =  1.0;   rayX3[fdir] =  0.0;
+      fdir = S;  rayX1[fdir] =  0.0;   rayX2[fdir] = -1.0;   rayX3[fdir] =  0.0;
+      fdir = T;  rayX1[fdir] =  0.0;   rayX2[fdir] =  0.0;   rayX3[fdir] =  1.0;
+      fdir = B;  rayX1[fdir] =  0.0;   rayX2[fdir] =  0.0;   rayX3[fdir] = -1.0;
+      fdir = NE; rayX1[fdir] =  c1oS2; rayX2[fdir] =  c1oS2; rayX3[fdir] =  0.0;
+      fdir = SW; rayX1[fdir] = -c1oS2; rayX2[fdir] = -c1oS2; rayX3[fdir] =  0.0;
+      fdir = SE; rayX1[fdir] =  c1oS2; rayX2[fdir] = -c1oS2; rayX3[fdir] =  0.0;
+      fdir = NW; rayX1[fdir] = -c1oS2; rayX2[fdir] =  c1oS2; rayX3[fdir] =  0.0;
+      fdir = TE; rayX1[fdir] =  c1oS2; rayX2[fdir] = 0.0;    rayX3[fdir] =  c1oS2;
+      fdir = BW; rayX1[fdir] = -c1oS2; rayX2[fdir] = 0.0;    rayX3[fdir] = -c1oS2;
+      fdir = BE; rayX1[fdir] =  c1oS2; rayX2[fdir] = 0.0;    rayX3[fdir] = -c1oS2;
+      fdir = TW; rayX1[fdir] = -c1oS2; rayX2[fdir] = 0.0;    rayX3[fdir] =  c1oS2;
+      fdir = TN; rayX1[fdir] =  0.0;   rayX2[fdir] = c1oS2;  rayX3[fdir] =  c1oS2;
+      fdir = BS; rayX1[fdir] =  0.0;   rayX2[fdir] =-c1oS2;  rayX3[fdir] = -c1oS2;
+      fdir = BN; rayX1[fdir] =  0.0;   rayX2[fdir] = c1oS2;  rayX3[fdir] = -c1oS2;
+      fdir = TS; rayX1[fdir] =  0.0;   rayX2[fdir] =-c1oS2;  rayX3[fdir] =  c1oS2;
+      fdir = TNE; rayX1[fdir] =  c1oS3; rayX2[fdir] =  c1oS3; rayX3[fdir] =  c1oS3;
+      fdir = TNW; rayX1[fdir] = -c1oS3; rayX2[fdir] =  c1oS3; rayX3[fdir] =  c1oS3;
+      fdir = TSE; rayX1[fdir] =  c1oS3; rayX2[fdir] = -c1oS3; rayX3[fdir] =  c1oS3;
+      fdir = TSW; rayX1[fdir] = -c1oS3; rayX2[fdir] = -c1oS3; rayX3[fdir] =  c1oS3;
+      fdir = BNE; rayX1[fdir] =  c1oS3; rayX2[fdir] =  c1oS3; rayX3[fdir] = -c1oS3;
+      fdir = BNW; rayX1[fdir] = -c1oS3; rayX2[fdir] =  c1oS3; rayX3[fdir] = -c1oS3;
+      fdir = BSE; rayX1[fdir] =  c1oS3; rayX2[fdir] = -c1oS3; rayX3[fdir] = -c1oS3;
+      fdir = BSW; rayX1[fdir] = -c1oS3; rayX2[fdir] = -c1oS3; rayX3[fdir] = -c1oS3;
+   }
+//////////////////////////////////////////////////////////////////////////
+   static inline LBMReal calcPress(const LBMReal* const f, LBMReal rho, LBMReal vx1, LBMReal vx2, LBMReal vx3)
+   {
+      using namespace UbMath;
+      LBMReal OxxPyyPzz = c1;
+      return ((f[E]+f[W]+f[N]+f[S]+f[T]+f[B]+c2*(f[NE]+f[SW]+f[SE]+f[NW]+f[TE]+f[BW]+f[BE]+f[TW]+f[TN]+f[BS]+f[BN]+f[TS])+
+         c3*(f[TNE]+f[TSW]+f[TSE]+f[TNW]+f[BNE]+f[BSW]+f[BSE]+f[BNW])-(vx1*vx1+vx2*vx2+vx3*vx3))*(c1-c1o2*OxxPyyPzz)+OxxPyyPzz*c1o2*(rho))*c1o3;
+   }
+}
+
+#endif
+
+
+
diff --git a/src/cpu/VirtualFluidsCore/LBM/ICell.h b/src/cpu/VirtualFluidsCore/LBM/ICell.h
index f9a05924bf02604de18a5d99017e067eeb3e3b63..76922d58dabccb141ae148df047e404ad821dc86 100644
--- a/src/cpu/VirtualFluidsCore/LBM/ICell.h
+++ b/src/cpu/VirtualFluidsCore/LBM/ICell.h
@@ -1,33 +1,33 @@
-#ifndef ICell_H
-#define ICell_H
-
-#include "LBMSystem.h"
-#include <vector>
-
-struct ICell3D
-{
-   ICell3D(int size);
-
-   std::vector<LBMReal> TSW; 
-   std::vector<LBMReal> TNW;
-   std::vector<LBMReal> TNE;
-   std::vector<LBMReal> TSE;
-   std::vector<LBMReal> BSW;
-   std::vector<LBMReal> BNW;
-   std::vector<LBMReal> BNE;
-   std::vector<LBMReal> BSE;
-};
-
-ICell3D::ICell3D(int size)
-{
-   TSW.resize(size); 
-   TNW.resize(size);
-   TNE.resize(size);
-   TSE.resize(size);
-   BSW.resize(size);
-   BNW.resize(size);
-   BNE.resize(size);
-   BSE.resize(size);
-}
-
-#endif
+#ifndef ICell_H
+#define ICell_H
+
+#include "LBMSystem.h"
+#include <vector>
+
+struct ICell3D
+{
+   ICell3D(int size);
+
+   std::vector<LBMReal> TSW; 
+   std::vector<LBMReal> TNW;
+   std::vector<LBMReal> TNE;
+   std::vector<LBMReal> TSE;
+   std::vector<LBMReal> BSW;
+   std::vector<LBMReal> BNW;
+   std::vector<LBMReal> BNE;
+   std::vector<LBMReal> BSE;
+};
+
+ICell3D::ICell3D(int size)
+{
+   TSW.resize(size); 
+   TNW.resize(size);
+   TNE.resize(size);
+   TSE.resize(size);
+   BSW.resize(size);
+   BNW.resize(size);
+   BNE.resize(size);
+   BSE.resize(size);
+}
+
+#endif
diff --git a/src/cpu/VirtualFluidsCore/LBM/IncompressibleCumulantLBMKernel.h b/src/cpu/VirtualFluidsCore/LBM/IncompressibleCumulantLBMKernel.h
index c4eb162cfa24f1d1be1b0812181d4ea168319d0d..cf4234e0069025d601ddd8eb0cf0e905525a0d42 100644
--- a/src/cpu/VirtualFluidsCore/LBM/IncompressibleCumulantLBMKernel.h
+++ b/src/cpu/VirtualFluidsCore/LBM/IncompressibleCumulantLBMKernel.h
@@ -1,49 +1,49 @@
-//Cascaded Cumulant LBM
-
-#ifndef IncompressibleCumulantLBMKernel_H
-#define IncompressibleCumulantLBMKernel_H
-
-#include "LBMKernel.h"
-#include "BCProcessor.h"
-#include "D3Q27System.h"
-#include "basics/utilities/UbTiming.h"
-#include "basics/container/CbArray4D.h"
-#include "basics/container/CbArray3D.h"
-
-//! \brief   Cascaded Cumulant LBM kernel. 
-//! \details CFD solver that use Cascaded Cumulant Lattice Boltzmann method for D3Q27 model
-//! \author  K. Kutscher, M. Geier
-class IncompressibleCumulantLBMKernel :  public LBMKernel
-{
-public:
-   //! This option set relaxation parameter: NORMAL  
-   enum Parameter{NORMAL, MAGIC};
-public:
-   IncompressibleCumulantLBMKernel();
-   virtual ~IncompressibleCumulantLBMKernel(void);
-   virtual void calculate(int step);
-   virtual SPtr<LBMKernel> clone();
-   double getCalculationTime();
-   void setRelaxationParameter(Parameter p);
-protected:
-   virtual void initDataSet();
-   LBMReal f[D3Q27System::ENDF+1];
-
-   UbTimer timer;
-
-   LBMReal OxyyMxzz;
-   Parameter parameter;
-
-   CbArray4D<LBMReal,IndexerX4X3X2X1>::CbArray4DPtr localDistributions;
-   CbArray4D<LBMReal,IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributions;
-   CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr   zeroDistributions;
-
-   mu::value_type muX1,muX2,muX3;
-   mu::value_type muDeltaT;
-   mu::value_type muNu;
-   LBMReal forcingX1;
-   LBMReal forcingX2;
-   LBMReal forcingX3;
-};
-
-#endif
+//Cascaded Cumulant LBM
+
+#ifndef IncompressibleCumulantLBMKernel_H
+#define IncompressibleCumulantLBMKernel_H
+
+#include "LBMKernel.h"
+#include "BCProcessor.h"
+#include "D3Q27System.h"
+#include "basics/utilities/UbTiming.h"
+#include "basics/container/CbArray4D.h"
+#include "basics/container/CbArray3D.h"
+
+//! \brief   Cascaded Cumulant LBM kernel. 
+//! \details CFD solver that use Cascaded Cumulant Lattice Boltzmann method for D3Q27 model
+//! \author  K. Kutscher, M. Geier
+class IncompressibleCumulantLBMKernel :  public LBMKernel
+{
+public:
+   //! This option set relaxation parameter: NORMAL  
+   enum Parameter{NORMAL, MAGIC};
+public:
+   IncompressibleCumulantLBMKernel();
+   virtual ~IncompressibleCumulantLBMKernel(void);
+   virtual void calculate(int step);
+   virtual SPtr<LBMKernel> clone();
+   double getCalculationTime();
+   void setRelaxationParameter(Parameter p);
+protected:
+   virtual void initDataSet();
+   LBMReal f[D3Q27System::ENDF+1];
+
+   UbTimer timer;
+
+   LBMReal OxyyMxzz;
+   Parameter parameter;
+
+   CbArray4D<LBMReal,IndexerX4X3X2X1>::CbArray4DPtr localDistributions;
+   CbArray4D<LBMReal,IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributions;
+   CbArray3D<LBMReal,IndexerX3X2X1>::CbArray3DPtr   zeroDistributions;
+
+   mu::value_type muX1,muX2,muX3;
+   mu::value_type muDeltaT;
+   mu::value_type muNu;
+   LBMReal forcingX1;
+   LBMReal forcingX2;
+   LBMReal forcingX3;
+};
+
+#endif
diff --git a/src/cpu/VirtualFluidsCore/LBM/IncompressibleCumulantWithSpongeLayerLBMKernel.h b/src/cpu/VirtualFluidsCore/LBM/IncompressibleCumulantWithSpongeLayerLBMKernel.h
index 980edc26ef16fd28147e4182b3e68a131957cb5d..c3ab71343657c793028fbb0d4ec4894ef15f923f 100644
--- a/src/cpu/VirtualFluidsCore/LBM/IncompressibleCumulantWithSpongeLayerLBMKernel.h
+++ b/src/cpu/VirtualFluidsCore/LBM/IncompressibleCumulantWithSpongeLayerLBMKernel.h
@@ -1,42 +1,42 @@
-#ifndef IncompressibleCumulantWithSpongeLayerLBMKernel_H
-#define IncompressibleCumulantWithSpongeLayerLBMKernel_H
-
-#include "IncompressibleCumulantLBMKernel.h"
-
-//! \brief   Cascaded Cumulant LBM kernel. 
-//! \details CFD solver with sponge layer that use Cascaded Cumulant Lattice Boltzmann method for D3Q27 model <br>
-//! variable spongeFactor is depending on funktion in muSpongeLayer and varies between 1 (do nothing) und 0.5 (collFactor about 1);
-//! Initialization in test case (example): <br>
-//! \code{.cpp}
-//! int sizeSP=8; //width of sponge layer in blocks 
-//! mu::Parser spongeLayer;
-//! spongeLayer.SetExpr("x1>=(sizeX-sizeSP)/dt ? (sizeX-(x1+1))/sizeSP/2.0 + 0.5 : 1.0");
-//! spongeLayer.DefineConst("sizeX", nx[0]*blocknx[0]); // width of grid for X in coarse nodes
-//! spongeLayer.DefineConst("sizeSP", sizeSP*blocknx[0]); // width of sponge layer in coarse nodes
-//! kernel->setWithSpongeLayer(true);
-//! kernel->setSpongeLayer(spongeLayer);
-//! \endcode
-//! \author  K. Kucher, M. Geier, A. Karanchuk
-class IncompressibleCumulantWithSpongeLayerLBMKernel :  public IncompressibleCumulantLBMKernel
-{
-public:
-   IncompressibleCumulantWithSpongeLayerLBMKernel();
-   virtual ~IncompressibleCumulantWithSpongeLayerLBMKernel(void);
-   SPtr<LBMKernel> clone();
-   void calculate(int step);
-   void initRelaxFactor(int vdir, double vL1, double vdx, double vSP);
-   //! \param vdir where the sponge layer is placed
-   //! \param vL1 length of simulation domain
-   //! \param vdx subgrid space 
-   //! \param vSP length of sponge layer
-   void setRelaxFactorParam(int vdir, double vL1, double vdx, double vSP);
-protected:
-  void initDataSet();
-  LBMReal OxyyMxzz;
-  int direction;
-  double L1;
-  double dx;
-  double SP;
-};
-
-#endif
+#ifndef IncompressibleCumulantWithSpongeLayerLBMKernel_H
+#define IncompressibleCumulantWithSpongeLayerLBMKernel_H
+
+#include "IncompressibleCumulantLBMKernel.h"
+
+//! \brief   Cascaded Cumulant LBM kernel. 
+//! \details CFD solver with sponge layer that use Cascaded Cumulant Lattice Boltzmann method for D3Q27 model <br>
+//! variable spongeFactor is depending on funktion in muSpongeLayer and varies between 1 (do nothing) und 0.5 (collFactor about 1);
+//! Initialization in test case (example): <br>
+//! \code{.cpp}
+//! int sizeSP=8; //width of sponge layer in blocks 
+//! mu::Parser spongeLayer;
+//! spongeLayer.SetExpr("x1>=(sizeX-sizeSP)/dt ? (sizeX-(x1+1))/sizeSP/2.0 + 0.5 : 1.0");
+//! spongeLayer.DefineConst("sizeX", nx[0]*blocknx[0]); // width of grid for X in coarse nodes
+//! spongeLayer.DefineConst("sizeSP", sizeSP*blocknx[0]); // width of sponge layer in coarse nodes
+//! kernel->setWithSpongeLayer(true);
+//! kernel->setSpongeLayer(spongeLayer);
+//! \endcode
+//! \author  K. Kucher, M. Geier, A. Karanchuk
+class IncompressibleCumulantWithSpongeLayerLBMKernel :  public IncompressibleCumulantLBMKernel
+{
+public:
+   IncompressibleCumulantWithSpongeLayerLBMKernel();
+   virtual ~IncompressibleCumulantWithSpongeLayerLBMKernel(void);
+   SPtr<LBMKernel> clone();
+   void calculate(int step);
+   void initRelaxFactor(int vdir, double vL1, double vdx, double vSP);
+   //! \param vdir where the sponge layer is placed
+   //! \param vL1 length of simulation domain
+   //! \param vdx subgrid space 
+   //! \param vSP length of sponge layer
+   void setRelaxFactorParam(int vdir, double vL1, double vdx, double vSP);
+protected:
+  void initDataSet();
+  LBMReal OxyyMxzz;
+  int direction;
+  double L1;
+  double dx;
+  double SP;
+};
+
+#endif
diff --git a/src/cpu/VirtualFluidsCore/LBM/IncompressibleOffsetInterpolationProcessor.cpp b/src/cpu/VirtualFluidsCore/LBM/IncompressibleOffsetInterpolationProcessor.cpp
index 2e780550bbeed2f7080c1d26390444836f8395d7..30b94fcd42b88751c119f25e7e3e8646272af7fa 100644
--- a/src/cpu/VirtualFluidsCore/LBM/IncompressibleOffsetInterpolationProcessor.cpp
+++ b/src/cpu/VirtualFluidsCore/LBM/IncompressibleOffsetInterpolationProcessor.cpp
@@ -1,794 +1,794 @@
-#include "IncompressibleOffsetInterpolationProcessor.h"
-#include "D3Q27System.h"
-
-
-
-IncompressibleOffsetInterpolationProcessor::IncompressibleOffsetInterpolationProcessor()
-   : omegaC(0.0), omegaF(0.0)
-{
-   //forcingC = 0; //9.99685e-7;
-   //forcingF = 0; //forcingC*0.5;
-}
-//////////////////////////////////////////////////////////////////////////
-IncompressibleOffsetInterpolationProcessor::IncompressibleOffsetInterpolationProcessor(LBMReal omegaC, LBMReal omegaF)
-   : omegaC(omegaC), omegaF(omegaF)
-{
-
-}
-//////////////////////////////////////////////////////////////////////////
-IncompressibleOffsetInterpolationProcessor::~IncompressibleOffsetInterpolationProcessor()
-{
-
-}
-//////////////////////////////////////////////////////////////////////////
-InterpolationProcessorPtr IncompressibleOffsetInterpolationProcessor::clone()
-{
-   InterpolationProcessorPtr iproc = InterpolationProcessorPtr (new IncompressibleOffsetInterpolationProcessor(this->omegaC, this->omegaF));
-   //dynamicPointerCast<D3Q27IncompressibleOffsetInterpolationProcessor>(iproc)->forcingC = forcingC;
-   //dynamicPointerCast<D3Q27IncompressibleOffsetInterpolationProcessor>(iproc)->forcingF = forcingF;
-   return iproc;
-}
-//////////////////////////////////////////////////////////////////////////
-void IncompressibleOffsetInterpolationProcessor::setOmegas( LBMReal omegaC, LBMReal omegaF )
-{
-   this->omegaC = omegaC;
-   this->omegaF = omegaF;
-}
-//////////////////////////////////////////////////////////////////////////
-void IncompressibleOffsetInterpolationProcessor::setOffsets(LBMReal xoff, LBMReal yoff, LBMReal zoff)
-{
-   this->xoff = xoff;
-   this->yoff = yoff;
-   this->zoff = zoff;     
-   this->xoff_sq = xoff * xoff;
-   this->yoff_sq = yoff * yoff;
-   this->zoff_sq = zoff * zoff;
-}
-//////////////////////////////////////////////////////////////////////////
-void IncompressibleOffsetInterpolationProcessor::interpolateCoarseToFine(D3Q27ICell& icellC, D3Q27ICell& icellF, LBMReal xoff, LBMReal yoff, LBMReal zoff)
-{
-   setOffsets(xoff, yoff, zoff);
-   calcInterpolatedCoefficiets(icellC, omegaC, 0.5);
-   calcInterpolatedNode(icellF.BSW, omegaF, -0.25, -0.25, -0.25, calcPressBSW(), -1, -1, -1);
-   calcInterpolatedNode(icellF.BNE, omegaF,  0.25,  0.25, -0.25, calcPressBNE(),  1,  1, -1);
-   calcInterpolatedNode(icellF.TNW, omegaF, -0.25,  0.25,  0.25, calcPressTNW(), -1,  1,  1);
-   calcInterpolatedNode(icellF.TSE, omegaF,  0.25, -0.25,  0.25, calcPressTSE(),  1, -1,  1);
-   calcInterpolatedNode(icellF.BNW, omegaF, -0.25,  0.25, -0.25, calcPressBNW(), -1,  1, -1);
-   calcInterpolatedNode(icellF.BSE, omegaF,  0.25, -0.25, -0.25, calcPressBSE(),  1, -1, -1);
-   calcInterpolatedNode(icellF.TSW, omegaF, -0.25, -0.25,  0.25, calcPressTSW(), -1, -1,  1);
-   calcInterpolatedNode(icellF.TNE, omegaF,  0.25,  0.25,  0.25, calcPressTNE(),  1,  1,  1);
-}
-//////////////////////////////////////////////////////////////////////////
-void IncompressibleOffsetInterpolationProcessor::interpolateFineToCoarse(D3Q27ICell& icellF, LBMReal* icellC, LBMReal xoff, LBMReal yoff, LBMReal zoff)
-{
-   setOffsets(xoff, yoff, zoff);
-   calcInterpolatedCoefficiets(icellF, omegaF, 2.0);
-   calcInterpolatedNodeFC(icellC, omegaC);
-}
-//////////////////////////////////////////////////////////////////////////
-void IncompressibleOffsetInterpolationProcessor::calcMoments(const LBMReal* const f, LBMReal omega, LBMReal& press, LBMReal& vx1, LBMReal& vx2, LBMReal& vx3, 
-                                                    LBMReal& kxy, LBMReal& kyz, LBMReal& kxz, LBMReal& kxxMyy, LBMReal& kxxMzz)
-{
-   using namespace D3Q27System;
-
-   //UBLOG(logINFO,"D3Q27System::BW  = " << D3Q27System::BW);
-   //UBLOG(logINFO,"BW  = " << BW);
-
-   LBMReal rho = 0.0;
-   D3Q27System::calcIncompMacroscopicValues(f,rho,vx1,vx2,vx3);
-   
-   //////////////////////////////////////////////////////////////////////////
-   //DRAFT
-   //if (omega == omegaC)
-   //{
-   //   vx1 += forcingC*0.5;
-   //} 
-   //else
-   //{
-   //   vx1 += forcingF*0.5;
-   //}
-   //////////////////////////////////////////////////////////////////////////
-
-   //press = D3Q27System::calcPress(f,rho,vx1,vx2,vx3);
-   press = rho; //interpolate rho!
-
-   kxy   = -3.*omega*((((f[TSW]+f[BNE])-(f[TNW]+f[BSE]))+((f[BSW]+f[TNE])-(f[BNW]+f[TSE])))+((f[SW]+f[NE])-(f[NW]+f[SE]))-(vx1*vx2));// might not be optimal MG 25.2.13
-   kyz   = -3.*omega*((((f[BSW]+f[TNE])-(f[TSE]+f[BNW]))+((f[BSE]+f[TNW])-(f[TSW]+f[BNE])))+((f[BS]+f[TN])-(f[TS]+f[BN]))-(vx2*vx3));
-   kxz   = -3.*omega*((((f[BNW]+f[TSE])-(f[TSW]+f[BNE]))+((f[BSW]+f[TNE])-(f[BSE]+f[TNW])))+((f[BW]+f[TE])-(f[TW]+f[BE]))-(vx1*vx3));
-   kxxMyy = -3./2.*omega*((((f[D3Q27System::BW]+f[TE])-(f[BS]+f[TN]))+((f[TW]+f[BE])-(f[TS]+f[BN])))+((f[W]+f[E])-(f[S]+f[N]))-(vx1*vx1-vx2*vx2));
-   kxxMzz = -3./2.*omega*((((f[NW]+f[SE])-(f[BS]+f[TN]))+((f[SW]+f[NE])-(f[TS]+f[BN])))+((f[W]+f[E])-(f[B]+f[T]))-(vx1*vx1-vx3*vx3));
-   //kxxMzz = -3./2.*omega*(((((f[NW]+f[SE])-(f[BS]+f[TN]))+((f[SW]+f[NE])-(f[17]+f[BN])))+((f[W]+f[E])-(f[B]+f[T])))-(vx1*vx1-vx3*vx3));
-
-   //UBLOG(logINFO, "t1 = "<<(((f[NW]+f[SE])-(f[BS]+f[TN]))+((f[SW]+f[NE])-(f[17]+f[BN])))+((f[W]+f[E])-(f[B]+f[T])));
-   //UBLOG(logINFO, "kxxMzz = "<<kxxMzz);
-
-   //UBLOG(logINFO,"f[BW]  = " << f[BW] << " BW  = " << BW);
-   //UBLOG(logINFO,"f[BE]  = " << f[BE] << " BE  = " << BE);
-   //UBLOG(logINFO,"f[NW]  = " << f[NW] << " NW  = " << NW);
-   //UBLOG(logINFO,"f[SE]  = " << f[SE] << " SE  = " << SE);
-   //UBLOG(logINFO,"f[BS]  = " << f[BS] << " BS  = " << BS);
-   //UBLOG(logINFO,"f[TN]  = " << f[TN] << " TN  = " << TN);
-}
-//////////////////////////////////////////////////////////////////////////
-void IncompressibleOffsetInterpolationProcessor::calcInterpolatedCoefficiets(const D3Q27ICell& icell, LBMReal omega, LBMReal eps_new)
-{
-   LBMReal        vx1_SWT,vx2_SWT,vx3_SWT;
-   LBMReal        vx1_NWT,vx2_NWT,vx3_NWT;
-   LBMReal        vx1_NET,vx2_NET,vx3_NET;
-   LBMReal        vx1_SET,vx2_SET,vx3_SET;
-   LBMReal        vx1_SWB,vx2_SWB,vx3_SWB;
-   LBMReal        vx1_NWB,vx2_NWB,vx3_NWB;
-   LBMReal        vx1_NEB,vx2_NEB,vx3_NEB;
-   LBMReal        vx1_SEB,vx2_SEB,vx3_SEB;
-
-   LBMReal        kxyFromfcNEQ_SWT, kyzFromfcNEQ_SWT, kxzFromfcNEQ_SWT, kxxMyyFromfcNEQ_SWT, kxxMzzFromfcNEQ_SWT;
-   LBMReal        kxyFromfcNEQ_NWT, kyzFromfcNEQ_NWT, kxzFromfcNEQ_NWT, kxxMyyFromfcNEQ_NWT, kxxMzzFromfcNEQ_NWT;
-   LBMReal        kxyFromfcNEQ_NET, kyzFromfcNEQ_NET, kxzFromfcNEQ_NET, kxxMyyFromfcNEQ_NET, kxxMzzFromfcNEQ_NET;
-   LBMReal        kxyFromfcNEQ_SET, kyzFromfcNEQ_SET, kxzFromfcNEQ_SET, kxxMyyFromfcNEQ_SET, kxxMzzFromfcNEQ_SET;
-   LBMReal        kxyFromfcNEQ_SWB, kyzFromfcNEQ_SWB, kxzFromfcNEQ_SWB, kxxMyyFromfcNEQ_SWB, kxxMzzFromfcNEQ_SWB;
-   LBMReal        kxyFromfcNEQ_NWB, kyzFromfcNEQ_NWB, kxzFromfcNEQ_NWB, kxxMyyFromfcNEQ_NWB, kxxMzzFromfcNEQ_NWB;
-   LBMReal        kxyFromfcNEQ_NEB, kyzFromfcNEQ_NEB, kxzFromfcNEQ_NEB, kxxMyyFromfcNEQ_NEB, kxxMzzFromfcNEQ_NEB;
-   LBMReal        kxyFromfcNEQ_SEB, kyzFromfcNEQ_SEB, kxzFromfcNEQ_SEB, kxxMyyFromfcNEQ_SEB, kxxMzzFromfcNEQ_SEB;
-
-   calcMoments(icell.TSW,omega,press_SWT,vx1_SWT,vx2_SWT,vx3_SWT, kxyFromfcNEQ_SWT, kyzFromfcNEQ_SWT, kxzFromfcNEQ_SWT, kxxMyyFromfcNEQ_SWT, kxxMzzFromfcNEQ_SWT);
-   calcMoments(icell.TNW,omega,press_NWT,vx1_NWT,vx2_NWT,vx3_NWT, kxyFromfcNEQ_NWT, kyzFromfcNEQ_NWT, kxzFromfcNEQ_NWT, kxxMyyFromfcNEQ_NWT, kxxMzzFromfcNEQ_NWT);
-   calcMoments(icell.TNE,omega,press_NET,vx1_NET,vx2_NET,vx3_NET, kxyFromfcNEQ_NET, kyzFromfcNEQ_NET, kxzFromfcNEQ_NET, kxxMyyFromfcNEQ_NET, kxxMzzFromfcNEQ_NET);
-   calcMoments(icell.TSE,omega,press_SET,vx1_SET,vx2_SET,vx3_SET, kxyFromfcNEQ_SET, kyzFromfcNEQ_SET, kxzFromfcNEQ_SET, kxxMyyFromfcNEQ_SET, kxxMzzFromfcNEQ_SET);
-   calcMoments(icell.BSW,omega,press_SWB,vx1_SWB,vx2_SWB,vx3_SWB, kxyFromfcNEQ_SWB, kyzFromfcNEQ_SWB, kxzFromfcNEQ_SWB, kxxMyyFromfcNEQ_SWB, kxxMzzFromfcNEQ_SWB);
-   calcMoments(icell.BNW,omega,press_NWB,vx1_NWB,vx2_NWB,vx3_NWB, kxyFromfcNEQ_NWB, kyzFromfcNEQ_NWB, kxzFromfcNEQ_NWB, kxxMyyFromfcNEQ_NWB, kxxMzzFromfcNEQ_NWB);
-   calcMoments(icell.BNE,omega,press_NEB,vx1_NEB,vx2_NEB,vx3_NEB, kxyFromfcNEQ_NEB, kyzFromfcNEQ_NEB, kxzFromfcNEQ_NEB, kxxMyyFromfcNEQ_NEB, kxxMzzFromfcNEQ_NEB);
-   calcMoments(icell.BSE,omega,press_SEB,vx1_SEB,vx2_SEB,vx3_SEB, kxyFromfcNEQ_SEB, kyzFromfcNEQ_SEB, kxzFromfcNEQ_SEB, kxxMyyFromfcNEQ_SEB, kxxMzzFromfcNEQ_SEB);
-
-   //LBMReal dxRho=c1o4*((press_NET-press_SWB)+(press_SET-press_NWB)+(press_NEB-press_SWT)+(press_SEB-press_NWT));
-   //LBMReal dyRho=c1o4*((press_NET-press_SWB)-(press_SET-press_NWB)+(press_NEB-press_SWT)-(press_SEB-press_NWT));
-   //LBMReal dzRho=c1o4*((press_NET-press_SWB)+(press_SET-press_NWB)-(press_NEB-press_SWT)-(press_SEB-press_NWT));
-
-   //   kxyFromfcNEQ_SWT+=vx1_SWT*dyRho+vx2_SWT*dxRho;
-   //   kxyFromfcNEQ_NWT+=vx1_NWT*dyRho+vx2_NWT*dxRho;
-   //   kxyFromfcNEQ_NET+=vx1_NET*dyRho+vx2_NET*dxRho;
-   //   kxyFromfcNEQ_SET+=vx1_SET*dyRho+vx2_SET*dxRho;
-   //   kxyFromfcNEQ_SWB+=vx1_SWB*dyRho+vx2_SWB*dxRho;
-   //   kxyFromfcNEQ_NWB+=vx1_NWB*dyRho+vx2_NWB*dxRho;
-   //   kxyFromfcNEQ_NEB+=vx1_NEB*dyRho+vx2_NEB*dxRho;
-   //   kxyFromfcNEQ_SEB+=vx1_SEB*dyRho+vx2_SEB*dxRho;
-
-   //   kyzFromfcNEQ_SWT+=vx3_SWT*dyRho+vx2_SWT*dzRho;
-   //   kyzFromfcNEQ_NWT+=vx3_NWT*dyRho+vx2_NWT*dzRho;
-   //   kyzFromfcNEQ_NET+=vx3_NET*dyRho+vx2_NET*dzRho;
-   //   kyzFromfcNEQ_SET+=vx3_SET*dyRho+vx2_SET*dzRho;
-   //   kyzFromfcNEQ_SWB+=vx3_SWB*dyRho+vx2_SWB*dzRho;
-   //   kyzFromfcNEQ_NWB+=vx3_NWB*dyRho+vx2_NWB*dzRho;
-   //   kyzFromfcNEQ_NEB+=vx3_NEB*dyRho+vx2_NEB*dzRho;
-   //   kyzFromfcNEQ_SEB+=vx3_SEB*dyRho+vx2_SEB*dzRho;
-
-   //   kxzFromfcNEQ_SWT+=vx1_SWT*dzRho+vx3_SWT*dxRho;
-   //   kxzFromfcNEQ_NWT+=vx1_NWT*dzRho+vx3_NWT*dxRho;
-   //   kxzFromfcNEQ_NET+=vx1_NET*dzRho+vx3_NET*dxRho;
-   //   kxzFromfcNEQ_SET+=vx1_SET*dzRho+vx3_SET*dxRho;
-   //   kxzFromfcNEQ_SWB+=vx1_SWB*dzRho+vx3_SWB*dxRho;
-   //   kxzFromfcNEQ_NWB+=vx1_NWB*dzRho+vx3_NWB*dxRho;
-   //   kxzFromfcNEQ_NEB+=vx1_NEB*dzRho+vx3_NEB*dxRho;
-   //   kxzFromfcNEQ_SEB+=vx1_SEB*dzRho+vx3_SEB*dxRho;
-
-   //   kxxMyyFromfcNEQ_SWT+=vx1_SWT*dxRho-vx2_SWT*dyRho;
-   //   kxxMyyFromfcNEQ_NWT+=vx1_NWT*dxRho-vx2_NWT*dyRho;
-   //   kxxMyyFromfcNEQ_NET+=vx1_NET*dxRho-vx2_NET*dyRho;
-   //   kxxMyyFromfcNEQ_SET+=vx1_SET*dxRho-vx2_SET*dyRho;
-   //   kxxMyyFromfcNEQ_SWB+=vx1_SWB*dxRho-vx2_SWB*dyRho;
-   //   kxxMyyFromfcNEQ_NWB+=vx1_NWB*dxRho-vx2_NWB*dyRho;
-   //   kxxMyyFromfcNEQ_NEB+=vx1_NEB*dxRho-vx2_NEB*dyRho;
-   //   kxxMyyFromfcNEQ_SEB+=vx1_SEB*dxRho-vx2_SEB*dyRho;
-
-   //   kxxMzzFromfcNEQ_SWT+=vx1_SWT*dxRho-vx3_SWT*dzRho;
-   //   kxxMzzFromfcNEQ_NWT+=vx1_NWT*dxRho-vx3_NWT*dzRho;
-   //   kxxMzzFromfcNEQ_NET+=vx1_NET*dxRho-vx3_NET*dzRho;
-   //   kxxMzzFromfcNEQ_SET+=vx1_SET*dxRho-vx3_SET*dzRho;
-   //   kxxMzzFromfcNEQ_SWB+=vx1_SWB*dxRho-vx3_SWB*dzRho;
-   //   kxxMzzFromfcNEQ_NWB+=vx1_NWB*dxRho-vx3_NWB*dzRho;
-   //   kxxMzzFromfcNEQ_NEB+=vx1_NEB*dxRho-vx3_NEB*dzRho;
-   //   kxxMzzFromfcNEQ_SEB+=vx1_SEB*dxRho-vx3_SEB*dzRho;
-
-
-      //kxxMzzFromfcNEQ_SWT=0.0;
-      //kxxMzzFromfcNEQ_NWT=0.0;
-      //kxxMzzFromfcNEQ_NET=0.0;
-      //kxxMzzFromfcNEQ_SET=0.0;
-      //kxxMzzFromfcNEQ_SWB=0.0;
-      //kxxMzzFromfcNEQ_NWB=0.0;
-      //kxxMzzFromfcNEQ_NEB=0.0;
-      //kxxMzzFromfcNEQ_SEB=0.0;
-
-
-
-
-
-   a0 = (-kxxMyyFromfcNEQ_NEB - kxxMyyFromfcNEQ_NET + kxxMyyFromfcNEQ_NWB + kxxMyyFromfcNEQ_NWT -
-      kxxMyyFromfcNEQ_SEB - kxxMyyFromfcNEQ_SET + kxxMyyFromfcNEQ_SWB + kxxMyyFromfcNEQ_SWT -
-      kxxMzzFromfcNEQ_NEB - kxxMzzFromfcNEQ_NET + kxxMzzFromfcNEQ_NWB + kxxMzzFromfcNEQ_NWT -
-      kxxMzzFromfcNEQ_SEB - kxxMzzFromfcNEQ_SET + kxxMzzFromfcNEQ_SWB + kxxMzzFromfcNEQ_SWT -
-      2.*kxyFromfcNEQ_NEB - 2.*kxyFromfcNEQ_NET - 2.*kxyFromfcNEQ_NWB - 2.*kxyFromfcNEQ_NWT +
-      2.*kxyFromfcNEQ_SEB + 2.*kxyFromfcNEQ_SET + 2.*kxyFromfcNEQ_SWB + 2.*kxyFromfcNEQ_SWT +
-      2.*kxzFromfcNEQ_NEB - 2.*kxzFromfcNEQ_NET + 2.*kxzFromfcNEQ_NWB - 2.*kxzFromfcNEQ_NWT +
-      2.*kxzFromfcNEQ_SEB - 2.*kxzFromfcNEQ_SET + 2.*kxzFromfcNEQ_SWB - 2.*kxzFromfcNEQ_SWT +
-      8.*vx1_NEB + 8.*vx1_NET + 8.*vx1_NWB + 8.*vx1_NWT + 8.*vx1_SEB +
-      8.*vx1_SET + 8.*vx1_SWB + 8.*vx1_SWT + 2.*vx2_NEB + 2.*vx2_NET -
-      2.*vx2_NWB - 2.*vx2_NWT - 2.*vx2_SEB - 2.*vx2_SET + 2.*vx2_SWB +
-      2.*vx2_SWT - 2.*vx3_NEB + 2.*vx3_NET + 2.*vx3_NWB - 2.*vx3_NWT -
-      2.*vx3_SEB + 2.*vx3_SET + 2.*vx3_SWB - 2.*vx3_SWT)/64.;
-   b0 = (2.*kxxMyyFromfcNEQ_NEB + 2.*kxxMyyFromfcNEQ_NET + 2.*kxxMyyFromfcNEQ_NWB + 2.*kxxMyyFromfcNEQ_NWT -
-      2.*kxxMyyFromfcNEQ_SEB - 2.*kxxMyyFromfcNEQ_SET - 2.*kxxMyyFromfcNEQ_SWB - 2.*kxxMyyFromfcNEQ_SWT -
-      kxxMzzFromfcNEQ_NEB - kxxMzzFromfcNEQ_NET - kxxMzzFromfcNEQ_NWB - kxxMzzFromfcNEQ_NWT +
-      kxxMzzFromfcNEQ_SEB + kxxMzzFromfcNEQ_SET + kxxMzzFromfcNEQ_SWB + kxxMzzFromfcNEQ_SWT -
-      2.*kxyFromfcNEQ_NEB - 2.*kxyFromfcNEQ_NET + 2.*kxyFromfcNEQ_NWB + 2.*kxyFromfcNEQ_NWT -
-      2.*kxyFromfcNEQ_SEB - 2.*kxyFromfcNEQ_SET + 2.*kxyFromfcNEQ_SWB + 2.*kxyFromfcNEQ_SWT +
-      2.*kyzFromfcNEQ_NEB - 2.*kyzFromfcNEQ_NET + 2.*kyzFromfcNEQ_NWB - 2.*kyzFromfcNEQ_NWT +
-      2.*kyzFromfcNEQ_SEB - 2.*kyzFromfcNEQ_SET + 2.*kyzFromfcNEQ_SWB - 2.*kyzFromfcNEQ_SWT +
-      2.*vx1_NEB + 2.*vx1_NET - 2.*vx1_NWB - 2.*vx1_NWT -
-      2.*vx1_SEB - 2.*vx1_SET + 2.*vx1_SWB + 2.*vx1_SWT +
-      8.*vx2_NEB + 8.*vx2_NET + 8.*vx2_NWB + 8.*vx2_NWT +
-      8.*vx2_SEB + 8.*vx2_SET + 8.*vx2_SWB + 8.*vx2_SWT -
-      2.*vx3_NEB + 2.*vx3_NET - 2.*vx3_NWB + 2.*vx3_NWT +
-      2.*vx3_SEB - 2.*vx3_SET + 2.*vx3_SWB - 2.*vx3_SWT)/64.;
-   c0 = (kxxMyyFromfcNEQ_NEB - kxxMyyFromfcNEQ_NET + kxxMyyFromfcNEQ_NWB - kxxMyyFromfcNEQ_NWT +
-      kxxMyyFromfcNEQ_SEB - kxxMyyFromfcNEQ_SET + kxxMyyFromfcNEQ_SWB - kxxMyyFromfcNEQ_SWT -
-      2.*kxxMzzFromfcNEQ_NEB + 2.*kxxMzzFromfcNEQ_NET - 2.*kxxMzzFromfcNEQ_NWB + 2.*kxxMzzFromfcNEQ_NWT -
-      2.*kxxMzzFromfcNEQ_SEB + 2.*kxxMzzFromfcNEQ_SET - 2.*kxxMzzFromfcNEQ_SWB + 2.*kxxMzzFromfcNEQ_SWT -
-      2.*kxzFromfcNEQ_NEB - 2.*kxzFromfcNEQ_NET + 2.*kxzFromfcNEQ_NWB + 2.*kxzFromfcNEQ_NWT -
-      2.*kxzFromfcNEQ_SEB - 2.*kxzFromfcNEQ_SET + 2.*kxzFromfcNEQ_SWB + 2.*kxzFromfcNEQ_SWT -
-      2.*kyzFromfcNEQ_NEB - 2.*kyzFromfcNEQ_NET - 2.*kyzFromfcNEQ_NWB - 2.*kyzFromfcNEQ_NWT +
-      2.*kyzFromfcNEQ_SEB + 2.*kyzFromfcNEQ_SET + 2.*kyzFromfcNEQ_SWB + 2.*kyzFromfcNEQ_SWT -
-      2.*vx1_NEB + 2.*vx1_NET + 2.*vx1_NWB - 2.*vx1_NWT -
-      2.*vx1_SEB + 2.*vx1_SET + 2.*vx1_SWB - 2.*vx1_SWT -
-      2.*vx2_NEB + 2.*vx2_NET - 2.*vx2_NWB + 2.*vx2_NWT +
-      2.*vx2_SEB - 2.*vx2_SET + 2.*vx2_SWB - 2.*vx2_SWT +
-      8.*vx3_NEB + 8.*vx3_NET + 8.*vx3_NWB + 8.*vx3_NWT +
-      8.*vx3_SEB + 8.*vx3_SET + 8.*vx3_SWB + 8.*vx3_SWT)/64.;
-   ax = (vx1_NEB + vx1_NET - vx1_NWB - vx1_NWT + vx1_SEB + vx1_SET - vx1_SWB - vx1_SWT)/4.;
-   bx = (vx2_NEB + vx2_NET - vx2_NWB - vx2_NWT + vx2_SEB + vx2_SET - vx2_SWB - vx2_SWT)/4.;
-   cx = (vx3_NEB + vx3_NET - vx3_NWB - vx3_NWT + vx3_SEB + vx3_SET - vx3_SWB - vx3_SWT)/4.;
-   axx= (kxxMyyFromfcNEQ_NEB + kxxMyyFromfcNEQ_NET - kxxMyyFromfcNEQ_NWB - kxxMyyFromfcNEQ_NWT +
-      kxxMyyFromfcNEQ_SEB + kxxMyyFromfcNEQ_SET - kxxMyyFromfcNEQ_SWB - kxxMyyFromfcNEQ_SWT +
-      kxxMzzFromfcNEQ_NEB + kxxMzzFromfcNEQ_NET - kxxMzzFromfcNEQ_NWB - kxxMzzFromfcNEQ_NWT +
-      kxxMzzFromfcNEQ_SEB + kxxMzzFromfcNEQ_SET - kxxMzzFromfcNEQ_SWB - kxxMzzFromfcNEQ_SWT +
-      2.*vx2_NEB + 2.*vx2_NET - 2.*vx2_NWB - 2.*vx2_NWT -
-      2.*vx2_SEB - 2.*vx2_SET + 2.*vx2_SWB + 2.*vx2_SWT -
-      2.*vx3_NEB + 2.*vx3_NET + 2.*vx3_NWB - 2.*vx3_NWT -
-      2.*vx3_SEB + 2.*vx3_SET + 2.*vx3_SWB - 2.*vx3_SWT)/16.;
-   bxx= (kxyFromfcNEQ_NEB + kxyFromfcNEQ_NET - kxyFromfcNEQ_NWB - kxyFromfcNEQ_NWT +
-      kxyFromfcNEQ_SEB + kxyFromfcNEQ_SET - kxyFromfcNEQ_SWB - kxyFromfcNEQ_SWT -
-      2.*vx1_NEB - 2.*vx1_NET + 2.*vx1_NWB + 2.*vx1_NWT +
-      2.*vx1_SEB + 2.*vx1_SET - 2.*vx1_SWB - 2.*vx1_SWT)/8.;
-   cxx= (kxzFromfcNEQ_NEB + kxzFromfcNEQ_NET - kxzFromfcNEQ_NWB - kxzFromfcNEQ_NWT +
-      kxzFromfcNEQ_SEB + kxzFromfcNEQ_SET - kxzFromfcNEQ_SWB - kxzFromfcNEQ_SWT +
-      2.*vx1_NEB - 2.*vx1_NET - 2.*vx1_NWB + 2.*vx1_NWT +
-      2.*vx1_SEB - 2.*vx1_SET - 2.*vx1_SWB + 2.*vx1_SWT)/8.;
-   ay = (vx1_NEB + vx1_NET + vx1_NWB + vx1_NWT - vx1_SEB - vx1_SET - vx1_SWB - vx1_SWT)/4.;
-   by = (vx2_NEB + vx2_NET + vx2_NWB + vx2_NWT - vx2_SEB - vx2_SET - vx2_SWB - vx2_SWT)/4.;
-   cy = (vx3_NEB + vx3_NET + vx3_NWB + vx3_NWT - vx3_SEB - vx3_SET - vx3_SWB - vx3_SWT)/4.;
-   ayy= (kxyFromfcNEQ_NEB + kxyFromfcNEQ_NET + kxyFromfcNEQ_NWB + kxyFromfcNEQ_NWT -
-      kxyFromfcNEQ_SEB - kxyFromfcNEQ_SET - kxyFromfcNEQ_SWB - kxyFromfcNEQ_SWT -
-      2.*vx2_NEB - 2.*vx2_NET + 2.*vx2_NWB + 2.*vx2_NWT +
-      2.*vx2_SEB + 2.*vx2_SET - 2.*vx2_SWB - 2.*vx2_SWT)/8.;
-   byy= (-2.*kxxMyyFromfcNEQ_NEB - 2.*kxxMyyFromfcNEQ_NET - 2.*kxxMyyFromfcNEQ_NWB - 2.*kxxMyyFromfcNEQ_NWT +
-      2.*kxxMyyFromfcNEQ_SEB + 2.*kxxMyyFromfcNEQ_SET + 2.*kxxMyyFromfcNEQ_SWB + 2.*kxxMyyFromfcNEQ_SWT +
-      kxxMzzFromfcNEQ_NEB + kxxMzzFromfcNEQ_NET + kxxMzzFromfcNEQ_NWB + kxxMzzFromfcNEQ_NWT -
-      kxxMzzFromfcNEQ_SEB - kxxMzzFromfcNEQ_SET - kxxMzzFromfcNEQ_SWB - kxxMzzFromfcNEQ_SWT +
-      2.*vx1_NEB + 2.*vx1_NET - 2.*vx1_NWB - 2.*vx1_NWT -
-      2.*vx1_SEB - 2.*vx1_SET + 2.*vx1_SWB + 2.*vx1_SWT -
-      2.*vx3_NEB + 2.*vx3_NET - 2.*vx3_NWB + 2.*vx3_NWT +
-      2.*vx3_SEB - 2.*vx3_SET + 2.*vx3_SWB - 2.*vx3_SWT)/16.;
-   cyy= (kyzFromfcNEQ_NEB + kyzFromfcNEQ_NET + kyzFromfcNEQ_NWB + kyzFromfcNEQ_NWT -
-      kyzFromfcNEQ_SEB - kyzFromfcNEQ_SET - kyzFromfcNEQ_SWB - kyzFromfcNEQ_SWT +
-      2.*vx2_NEB - 2.*vx2_NET + 2.*vx2_NWB - 2.*vx2_NWT -
-      2.*vx2_SEB + 2.*vx2_SET - 2.*vx2_SWB + 2.*vx2_SWT)/8.;
-   az = (-vx1_NEB + vx1_NET - vx1_NWB + vx1_NWT - vx1_SEB + vx1_SET - vx1_SWB + vx1_SWT)/4.;
-   bz = (-vx2_NEB + vx2_NET - vx2_NWB + vx2_NWT - vx2_SEB + vx2_SET - vx2_SWB + vx2_SWT)/4.;
-   cz = (-vx3_NEB + vx3_NET - vx3_NWB + vx3_NWT - vx3_SEB + vx3_SET - vx3_SWB + vx3_SWT)/4.;
-   azz= (-kxzFromfcNEQ_NEB + kxzFromfcNEQ_NET - kxzFromfcNEQ_NWB + kxzFromfcNEQ_NWT -
-      kxzFromfcNEQ_SEB + kxzFromfcNEQ_SET - kxzFromfcNEQ_SWB + kxzFromfcNEQ_SWT +
-      2.*vx3_NEB - 2.*vx3_NET - 2.*vx3_NWB + 2.*vx3_NWT +
-      2.*vx3_SEB - 2.*vx3_SET - 2.*vx3_SWB + 2.*vx3_SWT)/8.;
-   bzz= (-kyzFromfcNEQ_NEB + kyzFromfcNEQ_NET - kyzFromfcNEQ_NWB + kyzFromfcNEQ_NWT -
-      kyzFromfcNEQ_SEB + kyzFromfcNEQ_SET - kyzFromfcNEQ_SWB + kyzFromfcNEQ_SWT +
-      2.*vx3_NEB - 2.*vx3_NET + 2.*vx3_NWB - 2.*vx3_NWT -
-      2.*vx3_SEB + 2.*vx3_SET - 2.*vx3_SWB + 2.*vx3_SWT)/8.;
-   czz= (-kxxMyyFromfcNEQ_NEB + kxxMyyFromfcNEQ_NET - kxxMyyFromfcNEQ_NWB + kxxMyyFromfcNEQ_NWT -
-      kxxMyyFromfcNEQ_SEB + kxxMyyFromfcNEQ_SET - kxxMyyFromfcNEQ_SWB + kxxMyyFromfcNEQ_SWT +
-      2.*kxxMzzFromfcNEQ_NEB - 2.*kxxMzzFromfcNEQ_NET + 2.*kxxMzzFromfcNEQ_NWB - 2.*kxxMzzFromfcNEQ_NWT +
-      2.*kxxMzzFromfcNEQ_SEB - 2.*kxxMzzFromfcNEQ_SET + 2.*kxxMzzFromfcNEQ_SWB - 2.*kxxMzzFromfcNEQ_SWT -
-      2.*vx1_NEB + 2.*vx1_NET + 2.*vx1_NWB - 2.*vx1_NWT -
-      2.*vx1_SEB + 2.*vx1_SET + 2.*vx1_SWB - 2.*vx1_SWT -
-      2.*vx2_NEB + 2.*vx2_NET - 2.*vx2_NWB + 2.*vx2_NWT +
-      2.*vx2_SEB - 2.*vx2_SET + 2.*vx2_SWB - 2.*vx2_SWT)/16.;
-   axy= (vx1_NEB + vx1_NET - vx1_NWB - vx1_NWT - vx1_SEB - vx1_SET + vx1_SWB + vx1_SWT)/2.;
-   bxy= (vx2_NEB + vx2_NET - vx2_NWB - vx2_NWT - vx2_SEB - vx2_SET + vx2_SWB + vx2_SWT)/2.;
-   cxy= (vx3_NEB + vx3_NET - vx3_NWB - vx3_NWT - vx3_SEB - vx3_SET + vx3_SWB + vx3_SWT)/2.;
-   axz= (-vx1_NEB + vx1_NET + vx1_NWB - vx1_NWT - vx1_SEB + vx1_SET + vx1_SWB - vx1_SWT)/2.;
-   bxz= (-vx2_NEB + vx2_NET + vx2_NWB - vx2_NWT - vx2_SEB + vx2_SET + vx2_SWB - vx2_SWT)/2.;
-   cxz= (-vx3_NEB + vx3_NET + vx3_NWB - vx3_NWT - vx3_SEB + vx3_SET + vx3_SWB - vx3_SWT)/2.;
-   ayz= (-vx1_NEB + vx1_NET - vx1_NWB + vx1_NWT + vx1_SEB - vx1_SET + vx1_SWB - vx1_SWT)/2.;
-   byz= (-vx2_NEB + vx2_NET - vx2_NWB + vx2_NWT + vx2_SEB - vx2_SET + vx2_SWB - vx2_SWT)/2.;
-   cyz= (-vx3_NEB + vx3_NET - vx3_NWB + vx3_NWT + vx3_SEB - vx3_SET + vx3_SWB - vx3_SWT)/2.;
-   axyz=-vx1_NEB + vx1_NET + vx1_NWB - vx1_NWT + vx1_SEB - vx1_SET - vx1_SWB + vx1_SWT;
-   bxyz=-vx2_NEB + vx2_NET + vx2_NWB - vx2_NWT + vx2_SEB - vx2_SET - vx2_SWB + vx2_SWT;
-   cxyz=-vx3_NEB + vx3_NET + vx3_NWB - vx3_NWT + vx3_SEB - vx3_SET - vx3_SWB + vx3_SWT;
-
-   /////////////////////BÖSE!!!
-   //axx=0;   ayy=0;   azz=0;
-   //bxx=0;   byy=0;   bzz=0;
-   //cxx=0;   cyy=0;   czz=0;
-   ////////////////////!!!BÖSE
-
-   //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-   //kxyAverage       =(kxyFromfcNEQ_SWB+
-   //                   kxyFromfcNEQ_SWT+
-   //                   kxyFromfcNEQ_SET+
-   //                   kxyFromfcNEQ_SEB+
-   //                   kxyFromfcNEQ_NWB+
-   //                   kxyFromfcNEQ_NWT+
-   //                   kxyFromfcNEQ_NET+
-   //                   kxyFromfcNEQ_NEB)*c1o8-(ay+bx);
-   //kyzAverage       =(kyzFromfcNEQ_SWB+
-   //                   kyzFromfcNEQ_SWT+
-   //                   kyzFromfcNEQ_SET+
-   //                   kyzFromfcNEQ_SEB+
-   //                   kyzFromfcNEQ_NWB+
-   //                   kyzFromfcNEQ_NWT+
-   //                   kyzFromfcNEQ_NET+
-   //                   kyzFromfcNEQ_NEB)*c1o8-(bz+cy);
-   //kxzAverage       =(kxzFromfcNEQ_SWB+
-   //                   kxzFromfcNEQ_SWT+
-   //                   kxzFromfcNEQ_SET+
-   //                   kxzFromfcNEQ_SEB+
-   //                   kxzFromfcNEQ_NWB+
-   //                   kxzFromfcNEQ_NWT+
-   //                   kxzFromfcNEQ_NET+
-   //                   kxzFromfcNEQ_NEB)*c1o8-(az+cx);
-   //kxxMyyAverage    =(kxxMyyFromfcNEQ_SWB+
-   //                   kxxMyyFromfcNEQ_SWT+
-   //                   kxxMyyFromfcNEQ_SET+
-   //                   kxxMyyFromfcNEQ_SEB+
-   //                   kxxMyyFromfcNEQ_NWB+
-   //                   kxxMyyFromfcNEQ_NWT+
-   //                   kxxMyyFromfcNEQ_NET+
-   //                   kxxMyyFromfcNEQ_NEB)*c1o8-(ax-by);
-   //kxxMzzAverage    =(kxxMzzFromfcNEQ_SWB+
-   //                  kxxMzzFromfcNEQ_SWT+
-   //                  kxxMzzFromfcNEQ_SET+
-   //                  kxxMzzFromfcNEQ_SEB+
-   //                  kxxMzzFromfcNEQ_NWB+
-   //                  kxxMzzFromfcNEQ_NWT+
-   //                  kxxMzzFromfcNEQ_NET+
-   //                  kxxMzzFromfcNEQ_NEB)*c1o8-(ax-cz);
-   kxyAverage       =0;//(kxyFromfcNEQ_SWB+
-                    //kxyFromfcNEQ_SWT+
-                    //kxyFromfcNEQ_SET+
-                    //kxyFromfcNEQ_SEB+
-                    //kxyFromfcNEQ_NWB+
-                    //kxyFromfcNEQ_NWT+
-                    //kxyFromfcNEQ_NET+
-                    //kxyFromfcNEQ_NEB)*c1o8-(ay+bx);
-   kyzAverage       =0;//(kyzFromfcNEQ_SWB+
-                       //kyzFromfcNEQ_SWT+
-                       //kyzFromfcNEQ_SET+
-                       //kyzFromfcNEQ_SEB+
-                       //kyzFromfcNEQ_NWB+
-                       //kyzFromfcNEQ_NWT+
-                       //kyzFromfcNEQ_NET+
-                       //kyzFromfcNEQ_NEB)*c1o8-(bz+cy);
-   kxzAverage       =0;//(kxzFromfcNEQ_SWB+
-                       //kxzFromfcNEQ_SWT+
-                       //kxzFromfcNEQ_SET+
-                       //kxzFromfcNEQ_SEB+
-                       //kxzFromfcNEQ_NWB+
-                       //kxzFromfcNEQ_NWT+
-                       //kxzFromfcNEQ_NET+
-                       //kxzFromfcNEQ_NEB)*c1o8-(az+cx);
-   kxxMyyAverage    =0;//(kxxMyyFromfcNEQ_SWB+
-                       //kxxMyyFromfcNEQ_SWT+
-                       //kxxMyyFromfcNEQ_SET+
-                       //kxxMyyFromfcNEQ_SEB+
-                       //kxxMyyFromfcNEQ_NWB+
-                       //kxxMyyFromfcNEQ_NWT+
-                       //kxxMyyFromfcNEQ_NET+
-                       //kxxMyyFromfcNEQ_NEB)*c1o8-(ax-by);
-   kxxMzzAverage    =0;//(kxxMzzFromfcNEQ_SWB+
-                       //kxxMzzFromfcNEQ_SWT+
-                       //kxxMzzFromfcNEQ_SET+
-                       //kxxMzzFromfcNEQ_SEB+
-                       //kxxMzzFromfcNEQ_NWB+
-                       //kxxMzzFromfcNEQ_NWT+
-                       //kxxMzzFromfcNEQ_NET+
-                       //kxxMzzFromfcNEQ_NEB)*c1o8-(ax-cz);
-   ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-   //
-   // Bernd das Brot
-   //
-   ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-   a0 = a0 + xoff * ax + yoff * ay + zoff * az + xoff_sq * axx + yoff_sq * ayy + zoff_sq * azz + xoff*yoff*axy + xoff*zoff*axz + yoff*zoff*ayz + xoff*yoff*zoff*axyz ;
-   ax = ax + 2. * xoff * axx + yoff * axy + zoff * axz + yoff*zoff*axyz;
-   ay = ay + 2. * yoff * ayy + xoff * axy + zoff * ayz + xoff*zoff*axyz;
-   az = az + 2. * zoff * azz + xoff * axz + yoff * ayz + xoff*yoff*axyz;
-   b0 = b0 + xoff * bx + yoff * by + zoff * bz + xoff_sq * bxx + yoff_sq * byy + zoff_sq * bzz + xoff*yoff*bxy + xoff*zoff*bxz + yoff*zoff*byz + xoff*yoff*zoff*bxyz;
-   bx = bx + 2. * xoff * bxx + yoff * bxy + zoff * bxz + yoff*zoff*bxyz;
-   by = by + 2. * yoff * byy + xoff * bxy + zoff * byz + xoff*zoff*bxyz;
-   bz = bz + 2. * zoff * bzz + xoff * bxz + yoff * byz + xoff*yoff*bxyz;
-   c0 = c0 + xoff * cx + yoff * cy + zoff * cz + xoff_sq * cxx + yoff_sq * cyy + zoff_sq * czz + xoff*yoff*cxy + xoff*zoff*cxz + yoff*zoff*cyz + xoff*yoff*zoff*cxyz;
-   cx = cx + 2. * xoff * cxx + yoff * cxy + zoff * cxz + yoff*zoff*cxyz;
-   cy = cy + 2. * yoff * cyy + xoff * cxy + zoff * cyz + xoff*zoff*cxyz;
-   cz = cz + 2. * zoff * czz + xoff * cxz + yoff * cyz + xoff*yoff*cxyz;
-   axy= axy + zoff*axyz;
-   axz= axz + yoff*axyz;
-   ayz= ayz + xoff*axyz;
-   bxy= bxy + zoff*bxyz;
-   bxz= bxz + yoff*bxyz;
-   byz= byz + xoff*bxyz;
-   cxy= cxy + zoff*cxyz;
-   cxz= cxz + yoff*cxyz;
-   cyz= cyz + xoff*cxyz;
-   ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-   const LBMReal o = omega;
-
-   f_E = eps_new*((2*(-2*ax + by + cz-kxxMzzAverage-kxxMyyAverage))/(27.*o));
-   f_N = eps_new*((2*(ax - 2*by + cz+2*kxxMyyAverage-kxxMzzAverage))/(27.*o));
-   f_T = eps_new*((2*(ax + by - 2*cz-kxxMyyAverage+2*kxxMzzAverage))/(27.*o));
-   f_NE = eps_new*(-(ax + 3*ay + 3*bx + by - 2*cz+2*kxxMyyAverage-kxxMyyAverage+3*kxyAverage)/(54.*o));
-   f_SE = eps_new*(-(ax - 3*ay - 3*bx + by - 2*cz+2*kxxMyyAverage-kxxMyyAverage-3*kxyAverage)/(54.*o));
-   f_TE = eps_new*(-(ax + 3*az - 2*by + 3*cx + cz+2*kxxMyyAverage-kxxMzzAverage+3*kxzAverage)/(54.*o));
-   f_BE = eps_new*(-(ax - 3*az - 2*by - 3*cx + cz+2*kxxMyyAverage-kxxMzzAverage-3*kxzAverage)/(54.*o));
-   f_TN = eps_new*(-(-2*ax + by + 3*bz + 3*cy + cz-kxxMyyAverage-kxxMzzAverage+3*kyzAverage)/(54.*o));
-   f_BN = eps_new*(-(-2*ax + by - 3*bz - 3*cy + cz-kxxMyyAverage-kxxMzzAverage-3*kyzAverage)/(54.*o));
-   f_ZERO = 0.;
-   f_TNE = eps_new*(-(ay + az + bx + bz + cx + cy+kxyAverage+kxzAverage+kyzAverage)/(72.*o));
-   f_TSW = eps_new*((-ay + az - bx + bz + cx + cy-kxyAverage+kxzAverage+kyzAverage)/(72.*o));
-   f_TSE = eps_new*((ay - az + bx + bz - cx + cy+kxyAverage-kxzAverage+kyzAverage)/(72.*o));
-   f_TNW = eps_new*((ay + az + bx - bz + cx - cy+kxyAverage+kxzAverage-kyzAverage)/(72.*o));
-
-   x_E = 0.25*eps_new*((2*(-4*axx + bxy + cxz))/(27.*o));
-   x_N = 0.25*eps_new*((2*(2*axx - 2*bxy + cxz))/(27.*o));
-   x_T = 0.25*eps_new*((2*(2*axx + bxy - 2*cxz))/(27.*o));
-   x_NE = 0.25*eps_new*(-((2*axx + 3*axy + 6*bxx + bxy - 2*cxz))/(54.*o));
-   x_SE = 0.25*eps_new*(-((2*axx - 3*axy - 6*bxx + bxy - 2*cxz))/(54.*o));
-   x_TE = 0.25*eps_new*(-((2*axx + 3*axz - 2*bxy + 6*cxx + cxz))/(54.*o));
-   x_BE = 0.25*eps_new*(-((2*axx - 3*axz - 2*bxy - 6*cxx + cxz))/(54.*o));
-   x_TN = 0.25*eps_new*(-((-4*axx + bxy + 3*bxz + 3*cxy + cxz))/(54.*o));
-   x_BN = 0.25*eps_new*(-((-4*axx + bxy - 3*bxz - 3*cxy + cxz))/(54.*o));
-   x_ZERO = 0.;
-   x_TNE = 0.25*eps_new*(-((axy + axz + 2*bxx + bxz + 2*cxx + cxy))/(72.*o));
-   x_TSW = 0.25*eps_new*(((-axy + axz - 2*bxx + bxz + 2*cxx + cxy))/(72.*o));
-   x_TSE = 0.25*eps_new*(((axy - axz + 2*bxx + bxz - 2*cxx + cxy))/(72.*o));
-   x_TNW = 0.25*eps_new*(((axy + axz + 2*bxx - bxz + 2*cxx - cxy))/(72.*o));
-
-   y_E = 0.25*eps_new*(2*(-2*axy + 2*byy + cyz))/(27.*o);
-   y_N = 0.25*eps_new*(2*(axy - 4*byy + cyz))/(27.*o);
-   y_T = 0.25*eps_new*(2*(axy + 2*byy - 2*cyz))/(27.*o);
-   y_NE = 0.25*eps_new*(-((axy + 6*ayy + 3*bxy + 2*byy - 2*cyz))/(54.*o));
-   y_SE = 0.25*eps_new*(-((axy - 6*ayy - 3*bxy + 2*byy - 2*cyz))/(54.*o));
-   y_TE = 0.25*eps_new*(-((axy + 3*ayz - 4*byy + 3*cxy + cyz))/(54.*o));
-   y_BE = 0.25*eps_new*(-((axy - 3*ayz - 4*byy - 3*cxy + cyz))/(54.*o));
-   y_TN = 0.25*eps_new*(-((-2*axy + 2*byy + 3*byz + 6*cyy + cyz))/(54.*o));
-   y_BN = 0.25*eps_new*(-((-2*axy + 2*byy - 3*byz - 6*cyy + cyz))/(54.*o));
-   y_ZERO = 0.;
-   y_TNE = 0.25*eps_new*(-((2*ayy + ayz + bxy + byz + cxy + 2*cyy))/(72.*o));
-   y_TSW = 0.25*eps_new*(((-2*ayy + ayz - bxy + byz + cxy + 2*cyy))/(72.*o));
-   y_TSE = 0.25*eps_new*(((2*ayy - ayz + bxy + byz - cxy + 2*cyy))/(72.*o));
-   y_TNW = 0.25*eps_new*(((2*ayy + ayz + bxy - byz + cxy - 2*cyy))/(72.*o));
-
-   z_E = 0.25*eps_new*((2*(-2*axz + byz + 2*czz))/(27.*o));
-   z_N = 0.25*eps_new*((2*(axz - 2*byz + 2*czz))/(27.*o));
-   z_T = 0.25*eps_new*((2*(axz + byz - 4*czz))/(27.*o));
-   z_NE = 0.25*eps_new*(-((axz + 3*ayz + 3*bxz + byz - 4*czz))/(54.*o));
-   z_SE = 0.25*eps_new*(-((axz - 3*ayz - 3*bxz + byz - 4*czz))/(54.*o));
-   z_TE = 0.25*eps_new*(-((axz + 6*azz - 2*byz + 3*cxz + 2*czz))/(54.*o));
-   z_BE = 0.25*eps_new*(-((axz - 6*azz - 2*byz - 3*cxz + 2*czz))/(54.*o));
-   z_TN = 0.25*eps_new*(-((-2*axz + byz + 6*bzz + 3*cyz + 2*czz))/(54.*o));
-   z_BN = 0.25*eps_new*(-((-2*axz + byz - 6*bzz - 3*cyz + 2*czz))/(54.*o));
-   z_ZERO = 0.;
-   z_TNE = 0.25*eps_new*(-((ayz + 2*azz + bxz + 2*bzz + cxz + cyz))/(72.*o));
-   z_TSW = 0.25*eps_new*(((-ayz + 2*azz - bxz + 2*bzz + cxz + cyz))/(72.*o));
-   z_TSE = 0.25*eps_new*(((ayz - 2*azz + bxz + 2*bzz - cxz + cyz))/(72.*o));
-   z_TNW = 0.25*eps_new*(((ayz + 2*azz + bxz - 2*bzz + cxz - cyz))/(72.*o));
-
-   xy_E   =   0.0625*eps_new *((                       2.*cxyz)/(27.*o));
-   xy_N   =   0.0625*eps_new *((                       2.*cxyz)/(27.*o));
-   xy_T   = -(0.0625*eps_new *((                       4.*cxyz)/(27.*o)));
-   xy_NE  =   0.0625*eps_new *(                            cxyz /(27.*o));
-   xy_SE  =   0.0625*eps_new *(                            cxyz /(27.*o));
-   xy_TE  = -(0.0625*eps_new *(( 3.*axyz            +     cxyz)/(54.*o)));
-   xy_BE  = -(0.0625*eps_new *((-3.*axyz            +     cxyz)/(54.*o)));
-   xy_TN  = -(0.0625*eps_new *((            3.*bxyz +     cxyz)/(54.*o)));
-   xy_BN  = -(0.0625*eps_new *((          - 3.*bxyz +     cxyz)/(54.*o)));
-   //xy_ZERO=   0.0625*eps_new;
-   xy_TNE = -(0.0625*eps_new *((     axyz +     bxyz           )/(72.*o)));
-   xy_TSW =   0.0625*eps_new *((     axyz +     bxyz           )/(72.*o));
-   xy_TSE =   0.0625*eps_new *((-    axyz +     bxyz           )/(72.*o));
-   xy_TNW =   0.0625*eps_new *((     axyz -     bxyz           )/(72.*o));
-
-   xz_E   =   0.0625*eps_new *((            2.*bxyz           )/(27.*o));
-   xz_N   = -(0.0625*eps_new *((            4.*bxyz           )/(27.*o)));
-   xz_T   =   0.0625*eps_new *((            2.*bxyz           )/(27.*o));
-   xz_NE  = -(0.0625*eps_new *(( 3.*axyz +     bxyz           )/(54.*o)));
-   xz_SE  = -(0.0625*eps_new *((-3.*axyz +     bxyz           )/(54.*o)));
-   xz_TE  =   0.0625*eps_new *((                bxyz           )/(27.*o));
-   xz_BE  =   0.0625*eps_new *((                bxyz           )/(27.*o));
-   xz_TN  = -(0.0625*eps_new *((                bxyz + 3.*cxyz)/(54.*o)));
-   xz_BN  = -(0.0625*eps_new *((                bxyz - 3.*cxyz)/(54.*o)));
-   //xz_ZERO=   0.0625*eps_new;
-   xz_TNE = -(0.0625*eps_new *((     axyz            +     cxyz)/(72.*o)));
-   xz_TSW =   0.0625*eps_new *((-    axyz            +     cxyz)/(72.*o));
-   xz_TSE =   0.0625*eps_new *((     axyz            +     cxyz)/(72.*o));
-   xz_TNW =   0.0625*eps_new *((     axyz            -     cxyz)/(72.*o));
-
-   yz_E   = -(0.0625*eps_new *(( 4.*axyz                      )/(27.*o)));
-   yz_N   =   0.0625*eps_new *(( 2.*axyz                      )/(27.*o));
-   yz_T   =   0.0625*eps_new *(( 2.*axyz                      )/(27.*o));
-   yz_NE  = -(0.0625*eps_new *((     axyz + 3.*bxyz           )/(54.*o)));
-   yz_SE  = -(0.0625*eps_new *((     axyz - 3.*bxyz           )/(54.*o)));
-   yz_TE  = -(0.0625*eps_new *((     axyz            + 3.*cxyz)/(54.*o)));
-   yz_BE  = -(0.0625*eps_new *((     axyz            - 3.*cxyz)/(54.*o)));
-   yz_TN  =   0.0625*eps_new *((     axyz                      )/(27.*o));
-   yz_BN  =   0.0625*eps_new *((     axyz                      )/(27.*o));
-   //yz_ZERO=   0.0625*eps_new;
-   yz_TNE = -(0.0625*eps_new *((                bxyz +     cxyz)/(72.*o)));
-   yz_TSW =   0.0625*eps_new *((          -     bxyz +     cxyz)/(72.*o));
-   yz_TSE =   0.0625*eps_new *((                bxyz -     cxyz)/(72.*o));
-   yz_TNW =   0.0625*eps_new *((                bxyz +     cxyz)/(72.*o));
-}
-//////////////////////////////////////////////////////////////////////////
-void IncompressibleOffsetInterpolationProcessor::calcInterpolatedNode(LBMReal* f, LBMReal omega, LBMReal x, LBMReal y, LBMReal z, LBMReal press, LBMReal xs, LBMReal ys, LBMReal zs)
-{
-   using namespace D3Q27System;
-
-   LBMReal rho  = press ;//+ (2.*axx*x+axy*y+axz*z+axyz*y*z+ax + 2.*byy*y+bxy*x+byz*z+bxyz*x*z+by + 2.*czz*z+cxz*x+cyz*y+cxyz*x*y+cz)/3.;
-   LBMReal vx1  = a0 + 0.25*( xs*ax + ys*ay + zs*az) + 0.0625*(axx + xs*ys*axy + xs*zs*axz + ayy + ys*zs*ayz + azz) + 0.015625*(xs*ys*zs*axyz);
-   LBMReal vx2  = b0 + 0.25*( xs*bx + ys*by + zs*bz) + 0.0625*(bxx + xs*ys*bxy + xs*zs*bxz + byy + ys*zs*byz + bzz) + 0.015625*(xs*ys*zs*bxyz);
-   LBMReal vx3  = c0 + 0.25*( xs*cx + ys*cy + zs*cz) + 0.0625*(cxx + xs*ys*cxy + xs*zs*cxz + cyy + ys*zs*cyz + czz) + 0.015625*(xs*ys*zs*cxyz);
-
-   //////////////////////////////////////////////////////////////////////////
-   //DRAFT
-   //vx1 -= forcingF*0.5;
-   //////////////////////////////////////////////////////////////////////////
-
-   LBMReal feq[ENDF+1];
-   D3Q27System::calcIncompFeq(feq,rho,vx1,vx2,vx3);
-
-   f[E]    = f_E    + xs*x_E    + ys*y_E    + zs*z_E    + xs*ys*xy_E    + xs*zs*xz_E    + ys*zs*yz_E    + feq[E];
-   f[W]    = f_E    + xs*x_E    + ys*y_E    + zs*z_E    + xs*ys*xy_E    + xs*zs*xz_E    + ys*zs*yz_E    + feq[W];
-   f[N]    = f_N    + xs*x_N    + ys*y_N    + zs*z_N    + xs*ys*xy_N    + xs*zs*xz_N    + ys*zs*yz_N    + feq[N];
-   f[S]    = f_N    + xs*x_N    + ys*y_N    + zs*z_N    + xs*ys*xy_N    + xs*zs*xz_N    + ys*zs*yz_N    + feq[S];
-   f[T]    = f_T    + xs*x_T    + ys*y_T    + zs*z_T    + xs*ys*xy_T    + xs*zs*xz_T    + ys*zs*yz_T    + feq[T];
-   f[B]    = f_T    + xs*x_T    + ys*y_T    + zs*z_T    + xs*ys*xy_T    + xs*zs*xz_T    + ys*zs*yz_T    + feq[B];
-   f[NE]   = f_NE   + xs*x_NE   + ys*y_NE   + zs*z_NE   + xs*ys*xy_NE   + xs*zs*xz_NE   + ys*zs*yz_NE   + feq[NE];
-   f[SW]   = f_NE   + xs*x_NE   + ys*y_NE   + zs*z_NE   + xs*ys*xy_NE   + xs*zs*xz_NE   + ys*zs*yz_NE   + feq[SW];
-   f[SE]   = f_SE   + xs*x_SE   + ys*y_SE   + zs*z_SE   + xs*ys*xy_SE   + xs*zs*xz_SE   + ys*zs*yz_SE   + feq[SE];
-   f[NW]   = f_SE   + xs*x_SE   + ys*y_SE   + zs*z_SE   + xs*ys*xy_SE   + xs*zs*xz_SE   + ys*zs*yz_SE   + feq[NW];
-   f[TE]   = f_TE   + xs*x_TE   + ys*y_TE   + zs*z_TE   + xs*ys*xy_TE   + xs*zs*xz_TE   + ys*zs*yz_TE   + feq[TE];
-   f[BW]   = f_TE   + xs*x_TE   + ys*y_TE   + zs*z_TE   + xs*ys*xy_TE   + xs*zs*xz_TE   + ys*zs*yz_TE   + feq[BW];
-   f[BE]   = f_BE   + xs*x_BE   + ys*y_BE   + zs*z_BE   + xs*ys*xy_BE   + xs*zs*xz_BE   + ys*zs*yz_BE   + feq[BE];
-   f[TW]   = f_BE   + xs*x_BE   + ys*y_BE   + zs*z_BE   + xs*ys*xy_BE   + xs*zs*xz_BE   + ys*zs*yz_BE   + feq[TW];
-   f[TN]   = f_TN   + xs*x_TN   + ys*y_TN   + zs*z_TN   + xs*ys*xy_TN   + xs*zs*xz_TN   + ys*zs*yz_TN   + feq[TN];
-   f[BS]   = f_TN   + xs*x_TN   + ys*y_TN   + zs*z_TN   + xs*ys*xy_TN   + xs*zs*xz_TN   + ys*zs*yz_TN   + feq[BS];
-   f[BN]   = f_BN   + xs*x_BN   + ys*y_BN   + zs*z_BN   + xs*ys*xy_BN   + xs*zs*xz_BN   + ys*zs*yz_BN   + feq[BN];
-   f[TS]   = f_BN   + xs*x_BN   + ys*y_BN   + zs*z_BN   + xs*ys*xy_BN   + xs*zs*xz_BN   + ys*zs*yz_BN   + feq[TS];
-   f[TNE]  = f_TNE  + xs*x_TNE  + ys*y_TNE  + zs*z_TNE  + xs*ys*xy_TNE  + xs*zs*xz_TNE  + ys*zs*yz_TNE  + feq[TNE];
-   f[TSW]  = f_TSW  + xs*x_TSW  + ys*y_TSW  + zs*z_TSW  + xs*ys*xy_TSW  + xs*zs*xz_TSW  + ys*zs*yz_TSW  + feq[TSW];
-   f[TSE]  = f_TSE  + xs*x_TSE  + ys*y_TSE  + zs*z_TSE  + xs*ys*xy_TSE  + xs*zs*xz_TSE  + ys*zs*yz_TSE  + feq[TSE];
-   f[TNW]  = f_TNW  + xs*x_TNW  + ys*y_TNW  + zs*z_TNW  + xs*ys*xy_TNW  + xs*zs*xz_TNW  + ys*zs*yz_TNW  + feq[TNW];
-   f[BNE]  = f_TSW  + xs*x_TSW  + ys*y_TSW  + zs*z_TSW  + xs*ys*xy_TSW  + xs*zs*xz_TSW  + ys*zs*yz_TSW  + feq[BNE];
-   f[BSW]  = f_TNE  + xs*x_TNE  + ys*y_TNE  + zs*z_TNE  + xs*ys*xy_TNE  + xs*zs*xz_TNE  + ys*zs*yz_TNE  + feq[BSW];
-   f[BSE]  = f_TNW  + xs*x_TNW  + ys*y_TNW  + zs*z_TNW  + xs*ys*xy_TNW  + xs*zs*xz_TNW  + ys*zs*yz_TNW  + feq[BSE];
-   f[BNW]  = f_TSE  + xs*x_TSE  + ys*y_TSE  + zs*z_TSE  + xs*ys*xy_TSE  + xs*zs*xz_TSE  + ys*zs*yz_TSE  + feq[BNW];
-   f[ZERO] = f_ZERO + xs*x_ZERO + ys*y_ZERO + zs*z_ZERO                                                 + feq[ZERO];
-}
-//////////////////////////////////////////////////////////////////////////
-//Position SWB -0.25, -0.25, -0.25
-LBMReal IncompressibleOffsetInterpolationProcessor::calcPressBSW()
-{
-   return   press_SWT * (0.140625 + 0.1875 * xoff + 0.1875 * yoff - 0.5625 * zoff) +
-      press_NWT * (0.046875 + 0.0625 * xoff - 0.1875 * yoff - 0.1875 * zoff) +
-      press_SET * (0.046875 - 0.1875 * xoff + 0.0625 * yoff - 0.1875 * zoff) +
-      press_NET * (0.015625 - 0.0625 * xoff - 0.0625 * yoff - 0.0625 * zoff) +
-      press_NEB * (0.046875 - 0.1875 * xoff - 0.1875 * yoff + 0.0625 * zoff) +
-      press_NWB * (0.140625 + 0.1875 * xoff - 0.5625 * yoff + 0.1875 * zoff) +
-      press_SEB * (0.140625 - 0.5625 * xoff + 0.1875 * yoff + 0.1875 * zoff) +
-      press_SWB * (0.421875 + 0.5625 * xoff + 0.5625 * yoff + 0.5625 * zoff);
-}
-//////////////////////////////////////////////////////////////////////////
-//Position SWT -0.25, -0.25, 0.25
-LBMReal IncompressibleOffsetInterpolationProcessor::calcPressTSW()
-{
-   return   press_SWT * (0.421875 + 0.5625 * xoff + 0.5625 * yoff - 0.5625 * zoff) +
-      press_NWT * (0.140625 + 0.1875 * xoff - 0.5625 * yoff - 0.1875 * zoff) +
-      press_SET * (0.140625 - 0.5625 * xoff + 0.1875 * yoff - 0.1875 * zoff) +
-      press_NET * (0.046875 - 0.1875 * xoff - 0.1875 * yoff - 0.0625 * zoff) +
-      press_NEB * (0.015625 - 0.0625 * xoff - 0.0625 * yoff + 0.0625 * zoff) +
-      press_NWB * (0.046875 + 0.0625 * xoff - 0.1875 * yoff + 0.1875 * zoff) +
-      press_SEB * (0.046875 - 0.1875 * xoff + 0.0625 * yoff + 0.1875 * zoff) +
-      press_SWB * (0.140625 + 0.1875 * xoff + 0.1875 * yoff + 0.5625 * zoff);
-}
-//////////////////////////////////////////////////////////////////////////
-//Position SET 0.25, -0.25, 0.25
-LBMReal IncompressibleOffsetInterpolationProcessor::calcPressTSE()
-{
-   return   press_SET * (0.421875 - 0.5625 * xoff + 0.5625 * yoff - 0.5625 * zoff) +
-      press_NET * (0.140625 - 0.1875 * xoff - 0.5625 * yoff - 0.1875 * zoff) +
-      press_SWT * (0.140625 + 0.5625 * xoff + 0.1875 * yoff - 0.1875 * zoff) +
-      press_NWT * (0.046875 + 0.1875 * xoff - 0.1875 * yoff - 0.0625 * zoff) +
-      press_NWB * (0.015625 + 0.0625 * xoff - 0.0625 * yoff + 0.0625 * zoff) +
-      press_NEB * (0.046875 - 0.0625 * xoff - 0.1875 * yoff + 0.1875 * zoff) +
-      press_SWB * (0.046875 + 0.1875 * xoff + 0.0625 * yoff + 0.1875 * zoff) +
-      press_SEB * (0.140625 - 0.1875 * xoff + 0.1875 * yoff + 0.5625 * zoff);
-}
-//////////////////////////////////////////////////////////////////////////
-//Position SEB 0.25, -0.25, -0.25
-LBMReal IncompressibleOffsetInterpolationProcessor::calcPressBSE()
-{
-   return   press_SET * (0.140625 - 0.1875 * xoff + 0.1875 * yoff - 0.5625 * zoff) +
-      press_NET * (0.046875 - 0.0625 * xoff - 0.1875 * yoff - 0.1875 * zoff) +
-      press_SWT * (0.046875 + 0.1875 * xoff + 0.0625 * yoff - 0.1875 * zoff) +
-      press_NWT * (0.015625 + 0.0625 * xoff - 0.0625 * yoff - 0.0625 * zoff) +
-      press_NWB * (0.046875 + 0.1875 * xoff - 0.1875 * yoff + 0.0625 * zoff) +
-      press_NEB * (0.140625 - 0.1875 * xoff - 0.5625 * yoff + 0.1875 * zoff) +
-      press_SWB * (0.140625 + 0.5625 * xoff + 0.1875 * yoff + 0.1875 * zoff) +
-      press_SEB * (0.421875 - 0.5625 * xoff + 0.5625 * yoff + 0.5625 * zoff);
-}
-//////////////////////////////////////////////////////////////////////////
-//Position NWB -0.25, 0.25, -0.25
-LBMReal IncompressibleOffsetInterpolationProcessor::calcPressBNW()
-{
-   return   press_NWT * (0.140625 + 0.1875 * xoff - 0.1875 * yoff - 0.5625 * zoff) +
-      press_NET * (0.046875 - 0.1875 * xoff - 0.0625 * yoff - 0.1875 * zoff) +
-      press_SWT * (0.046875 + 0.0625 * xoff + 0.1875 * yoff - 0.1875 * zoff) +
-      press_SET * (0.015625 - 0.0625 * xoff + 0.0625 * yoff - 0.0625 * zoff) +
-      press_SEB * (0.046875 - 0.1875 * xoff + 0.1875 * yoff + 0.0625 * zoff) +
-      press_NEB * (0.140625 - 0.5625 * xoff - 0.1875 * yoff + 0.1875 * zoff) +
-      press_SWB * (0.140625 + 0.1875 * xoff + 0.5625 * yoff + 0.1875 * zoff) +
-      press_NWB * (0.421875 + 0.5625 * xoff - 0.5625 * yoff + 0.5625 * zoff);
-}
-//////////////////////////////////////////////////////////////////////////
-//Position NWT -0.25, 0.25, 0.25
-LBMReal IncompressibleOffsetInterpolationProcessor::calcPressTNW()
-{
-   return   press_NWT * (0.421875 + 0.5625 * xoff - 0.5625 * yoff - 0.5625 * zoff) +
-      press_NET * (0.140625 - 0.5625 * xoff - 0.1875 * yoff - 0.1875 * zoff) +
-      press_SWT * (0.140625 + 0.1875 * xoff + 0.5625 * yoff - 0.1875 * zoff) +
-      press_SET * (0.046875 - 0.1875 * xoff + 0.1875 * yoff - 0.0625 * zoff) +
-      press_SEB * (0.015625 - 0.0625 * xoff + 0.0625 * yoff + 0.0625 * zoff) +
-      press_NEB * (0.046875 - 0.1875 * xoff - 0.0625 * yoff + 0.1875 * zoff) +
-      press_SWB * (0.046875 + 0.0625 * xoff + 0.1875 * yoff + 0.1875 * zoff) +
-      press_NWB * (0.140625 + 0.1875 * xoff - 0.1875 * yoff + 0.5625 * zoff);
-}
-//////////////////////////////////////////////////////////////////////////
-//Position NET 0.25, 0.25, 0.25
-LBMReal IncompressibleOffsetInterpolationProcessor::calcPressTNE()
-{
-   return   press_NET * (0.421875 - 0.5625 * xoff - 0.5625 * yoff - 0.5625 * zoff) +
-      press_NWT * (0.140625 + 0.5625 * xoff - 0.1875 * yoff - 0.1875 * zoff) +
-      press_SET * (0.140625 - 0.1875 * xoff + 0.5625 * yoff - 0.1875 * zoff) +
-      press_SWT * (0.046875 + 0.1875 * xoff + 0.1875 * yoff - 0.0625 * zoff) +
-      press_SWB * (0.015625 + 0.0625 * xoff + 0.0625 * yoff + 0.0625 * zoff) +
-      press_NWB * (0.046875 + 0.1875 * xoff - 0.0625 * yoff + 0.1875 * zoff) +
-      press_SEB * (0.046875 - 0.0625 * xoff + 0.1875 * yoff + 0.1875 * zoff) +
-      press_NEB * (0.140625 - 0.1875 * xoff - 0.1875 * yoff + 0.5625 * zoff);
-}
-//////////////////////////////////////////////////////////////////////////
-//Position NEB 0.25, 0.25, -0.25
-LBMReal IncompressibleOffsetInterpolationProcessor::calcPressBNE()
-{
-   return   press_NET * (0.140625 - 0.1875 * xoff - 0.1875 * yoff - 0.5625 * zoff) +
-      press_NWT * (0.046875 + 0.1875 * xoff - 0.0625 * yoff - 0.1875 * zoff) +
-      press_SET * (0.046875 - 0.0625 * xoff + 0.1875 * yoff - 0.1875 * zoff) +
-      press_SWT * (0.015625 + 0.0625 * xoff + 0.0625 * yoff - 0.0625 * zoff) +
-      press_SWB * (0.046875 + 0.1875 * xoff + 0.1875 * yoff + 0.0625 * zoff) +
-      press_NWB * (0.140625 + 0.5625 * xoff - 0.1875 * yoff + 0.1875 * zoff) +
-      press_SEB * (0.140625 - 0.1875 * xoff + 0.5625 * yoff + 0.1875 * zoff) +
-      press_NEB * (0.421875 - 0.5625 * xoff - 0.5625 * yoff + 0.5625 * zoff);
-}
-//////////////////////////////////////////////////////////////////////////
-//Position C 0.0, 0.0, 0.0
-void IncompressibleOffsetInterpolationProcessor::calcInterpolatedNodeFC(LBMReal* f, LBMReal omega)
-{
-   using namespace D3Q27System;
-
-   LBMReal press  =  press_NET * (0.125 - 0.25 * xoff - 0.25 * yoff - 0.25 * zoff) +
-      press_NWT * (0.125 + 0.25 * xoff - 0.25 * yoff - 0.25 * zoff) +
-      press_SET * (0.125 - 0.25 * xoff + 0.25 * yoff - 0.25 * zoff) +
-      press_SWT * (0.125 + 0.25 * xoff + 0.25 * yoff - 0.25 * zoff) +
-      press_NEB * (0.125 - 0.25 * xoff - 0.25 * yoff + 0.25 * zoff) +
-      press_NWB * (0.125 + 0.25 * xoff - 0.25 * yoff + 0.25 * zoff) +
-      press_SEB * (0.125 - 0.25 * xoff + 0.25 * yoff + 0.25 * zoff) +
-      press_SWB * (0.125 + 0.25 * xoff + 0.25 * yoff + 0.25 * zoff);
-   LBMReal vx1  = a0;
-   LBMReal vx2  = b0;
-   LBMReal vx3  = c0;
-
-   LBMReal rho = press ;//+ (ax+by+cz)/3.;
-
-   //////////////////////////////////////////////////////////////////////////
-   //DRAFT
-   //vx1 -= forcingC*0.5;
-   //////////////////////////////////////////////////////////////////////////
-
-   LBMReal feq[ENDF+1];
-   D3Q27System::calcIncompFeq(feq,rho,vx1,vx2,vx3);
-
-   LBMReal eps_new = 2.;
-   LBMReal o  = omega;
-   LBMReal op = 1.;
-
-   //f_E    = eps_new *((5.*ax*o + 5.*by*o + 5.*cz*o - 8.*ax*op + 4.*by*op + 4.*cz*op)/(54.*o*op));
-   //f_N    = f_E + eps_new *((2.*(ax - by))/(9.*o));
-   //f_T    = f_E + eps_new *((2.*(ax - cz))/(9.*o));
-   //f_NE   = eps_new *(-(5.*cz*o + 3.*(ay + bx)*op - 2.*cz*op + ax*(5.*o + op) + by*(5.*o + op))/(54.*o*op));
-   //f_SE   = f_NE + eps_new *((  ay + bx )/(9.*o));
-   //f_TE   = eps_new *(-(5.*cz*o + by*(5.*o - 2.*op) + 3.*(az + cx)*op + cz*op + ax*(5.*o + op))/(54.*o*op));
-   //f_BE   = f_TE + eps_new *((  az + cx )/(9.*o));
-   //f_TN   = eps_new *(-(5.*ax*o + 5.*by*o + 5.*cz*o - 2.*ax*op + by*op + 3.*bz*op + 3.*cy*op + cz*op)/(54.*o*op));
-   //f_BN   = f_TN + eps_new *((  bz + cy )/(9.*o));
-   //f_ZERO = eps_new *((5.*(ax + by + cz))/(9.*op));
-   //f_TNE  = eps_new *(-(ay + az + bx + bz + cx + cy)/(72.*o));
-   //f_TSW  = - eps_new *((ay + bx)/(36.*o)) - f_TNE;
-   //f_TSE  = - eps_new *((az + cx)/(36.*o)) - f_TNE;
-   //f_TNW  = - eps_new *((bz + cy)/(36.*o)) - f_TNE;
-
-   f_E = eps_new*((2*(-2*ax + by + cz-kxxMzzAverage-kxxMyyAverage))/(27.*o));
-   f_N = eps_new*((2*(ax - 2*by + cz+2*kxxMyyAverage-kxxMzzAverage))/(27.*o));
-   f_T = eps_new*((2*(ax + by - 2*cz-kxxMyyAverage+2*kxxMzzAverage))/(27.*o));
-   f_NE = eps_new*(-(ax + 3*ay + 3*bx + by - 2*cz+2*kxxMyyAverage-kxxMyyAverage+3*kxyAverage)/(54.*o));
-   f_SE = eps_new*(-(ax - 3*ay - 3*bx + by - 2*cz+2*kxxMyyAverage-kxxMyyAverage-3*kxyAverage)/(54.*o));
-   f_TE = eps_new*(-(ax + 3*az - 2*by + 3*cx + cz+2*kxxMyyAverage-kxxMzzAverage+3*kxzAverage)/(54.*o));
-   f_BE = eps_new*(-(ax - 3*az - 2*by - 3*cx + cz+2*kxxMyyAverage-kxxMzzAverage-3*kxzAverage)/(54.*o));
-   f_TN = eps_new*(-(-2*ax + by + 3*bz + 3*cy + cz-kxxMyyAverage-kxxMzzAverage+3*kyzAverage)/(54.*o));
-   f_BN = eps_new*(-(-2*ax + by - 3*bz - 3*cy + cz-kxxMyyAverage-kxxMzzAverage-3*kyzAverage)/(54.*o));
-   f_ZERO = 0.;
-   f_TNE = eps_new*(-(ay + az + bx + bz + cx + cy+kxyAverage+kxzAverage+kyzAverage)/(72.*o));
-   f_TSW = eps_new*((-ay + az - bx + bz + cx + cy-kxyAverage+kxzAverage+kyzAverage)/(72.*o));
-   f_TSE = eps_new*((ay - az + bx + bz - cx + cy+kxyAverage-kxzAverage+kyzAverage)/(72.*o));
-   f_TNW = eps_new*((ay + az + bx - bz + cx - cy+kxyAverage+kxzAverage-kyzAverage)/(72.*o));
-
-   f[E]    = f_E    + feq[E];
-   f[W]    = f_E    + feq[W];
-   f[N]    = f_N    + feq[N];
-   f[S]    = f_N    + feq[S];
-   f[T]    = f_T    + feq[T];
-   f[B]    = f_T    + feq[B];
-   f[NE]   = f_NE   + feq[NE];
-   f[SW]   = f_NE   + feq[SW];
-   f[SE]   = f_SE   + feq[SE];
-   f[NW]   = f_SE   + feq[NW];
-   f[TE]   = f_TE   + feq[TE];
-   f[BW]   = f_TE   + feq[BW];
-   f[BE]   = f_BE   + feq[BE];
-   f[TW]   = f_BE   + feq[TW];
-   f[TN]   = f_TN   + feq[TN];
-   f[BS]   = f_TN   + feq[BS];
-   f[BN]   = f_BN   + feq[BN];
-   f[TS]   = f_BN   + feq[TS];
-   f[TNE]  = f_TNE  + feq[TNE];
-   f[TNW]  = f_TNW  + feq[TNW];
-   f[TSE]  = f_TSE  + feq[TSE];
-   f[TSW]  = f_TSW  + feq[TSW];
-   f[BNE]  = f_TSW  + feq[BNE];
-   f[BNW]  = f_TSE  + feq[BNW];
-   f[BSE]  = f_TNW  + feq[BSE];
-   f[BSW]  = f_TNE  + feq[BSW];
-   f[ZERO] = f_ZERO + feq[ZERO];
-}
-//////////////////////////////////////////////////////////////////////////
-void IncompressibleOffsetInterpolationProcessor::calcInterpolatedVelocity(LBMReal x, LBMReal y, LBMReal z, LBMReal& vx1, LBMReal& vx2, LBMReal& vx3)
-{
-	vx1  = a0 + ax*x + ay*y + az*z + axx*x*x + ayy*y*y + azz*z*z + axy*x*y + axz*x*z + ayz*y*z+axyz*x*y*z;
-	vx2  = b0 + bx*x + by*y + bz*z + bxx*x*x + byy*y*y + bzz*z*z + bxy*x*y + bxz*x*z + byz*y*z+bxyz*x*y*z;
-	vx3  = c0 + cx*x + cy*y + cz*z + cxx*x*x + cyy*y*y + czz*z*z + cxy*x*y + cxz*x*z + cyz*y*z+cxyz*x*y*z;
-}
-//////////////////////////////////////////////////////////////////////////
-void IncompressibleOffsetInterpolationProcessor::calcInterpolatedShearStress(LBMReal x, LBMReal y, LBMReal z,LBMReal& tauxx, LBMReal& tauyy, LBMReal& tauzz,LBMReal& tauxy, LBMReal& tauxz, LBMReal& tauyz)
-{
-	tauxx=ax+2*axx*x+axy*y+axz*z+axyz*y*z;
-	tauyy=by+2*byy*y+bxy*x+byz*z+bxyz*x*z;
-	tauzz=cz+2*czz*z+cxz*x+cyz*y+cxyz*x*y;
-	tauxy=0.5*((ay+2.0*ayy*y+axy*x+ayz*z+axyz*x*z)+(bx+2.0*bxx*x+bxy*y+bxz*z+bxyz*y*z));
-	tauxz=0.5*((az+2.0*azz*z+axz*x+ayz*y+axyz*x*y)+(cx+2.0*cxx*x+cxy*y+cxz*z+cxyz*y*z));
-	tauyz=0.5*((bz+2.0*bzz*z+bxz*x+byz*y+bxyz*x*y)+(cy+2.0*cyy*y+cxy*x+cyz*z+cxyz*x*z));
-}
+#include "IncompressibleOffsetInterpolationProcessor.h"
+#include "D3Q27System.h"
+
+
+
+IncompressibleOffsetInterpolationProcessor::IncompressibleOffsetInterpolationProcessor()
+   : omegaC(0.0), omegaF(0.0)
+{
+   //forcingC = 0; //9.99685e-7;
+   //forcingF = 0; //forcingC*0.5;
+}
+//////////////////////////////////////////////////////////////////////////
+IncompressibleOffsetInterpolationProcessor::IncompressibleOffsetInterpolationProcessor(LBMReal omegaC, LBMReal omegaF)
+   : omegaC(omegaC), omegaF(omegaF)
+{
+
+}
+//////////////////////////////////////////////////////////////////////////
+IncompressibleOffsetInterpolationProcessor::~IncompressibleOffsetInterpolationProcessor()
+{
+
+}
+//////////////////////////////////////////////////////////////////////////
+InterpolationProcessorPtr IncompressibleOffsetInterpolationProcessor::clone()
+{
+   InterpolationProcessorPtr iproc = InterpolationProcessorPtr (new IncompressibleOffsetInterpolationProcessor(this->omegaC, this->omegaF));
+   //dynamicPointerCast<D3Q27IncompressibleOffsetInterpolationProcessor>(iproc)->forcingC = forcingC;
+   //dynamicPointerCast<D3Q27IncompressibleOffsetInterpolationProcessor>(iproc)->forcingF = forcingF;
+   return iproc;
+}
+//////////////////////////////////////////////////////////////////////////
+void IncompressibleOffsetInterpolationProcessor::setOmegas( LBMReal omegaC, LBMReal omegaF )
+{
+   this->omegaC = omegaC;
+   this->omegaF = omegaF;
+}
+//////////////////////////////////////////////////////////////////////////
+void IncompressibleOffsetInterpolationProcessor::setOffsets(LBMReal xoff, LBMReal yoff, LBMReal zoff)
+{
+   this->xoff = xoff;
+   this->yoff = yoff;
+   this->zoff = zoff;     
+   this->xoff_sq = xoff * xoff;
+   this->yoff_sq = yoff * yoff;
+   this->zoff_sq = zoff * zoff;
+}
+//////////////////////////////////////////////////////////////////////////
+void IncompressibleOffsetInterpolationProcessor::interpolateCoarseToFine(D3Q27ICell& icellC, D3Q27ICell& icellF, LBMReal xoff, LBMReal yoff, LBMReal zoff)
+{
+   setOffsets(xoff, yoff, zoff);
+   calcInterpolatedCoefficiets(icellC, omegaC, 0.5);
+   calcInterpolatedNode(icellF.BSW, omegaF, -0.25, -0.25, -0.25, calcPressBSW(), -1, -1, -1);
+   calcInterpolatedNode(icellF.BNE, omegaF,  0.25,  0.25, -0.25, calcPressBNE(),  1,  1, -1);
+   calcInterpolatedNode(icellF.TNW, omegaF, -0.25,  0.25,  0.25, calcPressTNW(), -1,  1,  1);
+   calcInterpolatedNode(icellF.TSE, omegaF,  0.25, -0.25,  0.25, calcPressTSE(),  1, -1,  1);
+   calcInterpolatedNode(icellF.BNW, omegaF, -0.25,  0.25, -0.25, calcPressBNW(), -1,  1, -1);
+   calcInterpolatedNode(icellF.BSE, omegaF,  0.25, -0.25, -0.25, calcPressBSE(),  1, -1, -1);
+   calcInterpolatedNode(icellF.TSW, omegaF, -0.25, -0.25,  0.25, calcPressTSW(), -1, -1,  1);
+   calcInterpolatedNode(icellF.TNE, omegaF,  0.25,  0.25,  0.25, calcPressTNE(),  1,  1,  1);
+}
+//////////////////////////////////////////////////////////////////////////
+void IncompressibleOffsetInterpolationProcessor::interpolateFineToCoarse(D3Q27ICell& icellF, LBMReal* icellC, LBMReal xoff, LBMReal yoff, LBMReal zoff)
+{
+   setOffsets(xoff, yoff, zoff);
+   calcInterpolatedCoefficiets(icellF, omegaF, 2.0);
+   calcInterpolatedNodeFC(icellC, omegaC);
+}
+//////////////////////////////////////////////////////////////////////////
+void IncompressibleOffsetInterpolationProcessor::calcMoments(const LBMReal* const f, LBMReal omega, LBMReal& press, LBMReal& vx1, LBMReal& vx2, LBMReal& vx3, 
+                                                    LBMReal& kxy, LBMReal& kyz, LBMReal& kxz, LBMReal& kxxMyy, LBMReal& kxxMzz)
+{
+   using namespace D3Q27System;
+
+   //UBLOG(logINFO,"D3Q27System::BW  = " << D3Q27System::BW);
+   //UBLOG(logINFO,"BW  = " << BW);
+
+   LBMReal rho = 0.0;
+   D3Q27System::calcIncompMacroscopicValues(f,rho,vx1,vx2,vx3);
+   
+   //////////////////////////////////////////////////////////////////////////
+   //DRAFT
+   //if (omega == omegaC)
+   //{
+   //   vx1 += forcingC*0.5;
+   //} 
+   //else
+   //{
+   //   vx1 += forcingF*0.5;
+   //}
+   //////////////////////////////////////////////////////////////////////////
+
+   //press = D3Q27System::calcPress(f,rho,vx1,vx2,vx3);
+   press = rho; //interpolate rho!
+
+   kxy   = -3.*omega*((((f[TSW]+f[BNE])-(f[TNW]+f[BSE]))+((f[BSW]+f[TNE])-(f[BNW]+f[TSE])))+((f[SW]+f[NE])-(f[NW]+f[SE]))-(vx1*vx2));// might not be optimal MG 25.2.13
+   kyz   = -3.*omega*((((f[BSW]+f[TNE])-(f[TSE]+f[BNW]))+((f[BSE]+f[TNW])-(f[TSW]+f[BNE])))+((f[BS]+f[TN])-(f[TS]+f[BN]))-(vx2*vx3));
+   kxz   = -3.*omega*((((f[BNW]+f[TSE])-(f[TSW]+f[BNE]))+((f[BSW]+f[TNE])-(f[BSE]+f[TNW])))+((f[BW]+f[TE])-(f[TW]+f[BE]))-(vx1*vx3));
+   kxxMyy = -3./2.*omega*((((f[D3Q27System::BW]+f[TE])-(f[BS]+f[TN]))+((f[TW]+f[BE])-(f[TS]+f[BN])))+((f[W]+f[E])-(f[S]+f[N]))-(vx1*vx1-vx2*vx2));
+   kxxMzz = -3./2.*omega*((((f[NW]+f[SE])-(f[BS]+f[TN]))+((f[SW]+f[NE])-(f[TS]+f[BN])))+((f[W]+f[E])-(f[B]+f[T]))-(vx1*vx1-vx3*vx3));
+   //kxxMzz = -3./2.*omega*(((((f[NW]+f[SE])-(f[BS]+f[TN]))+((f[SW]+f[NE])-(f[17]+f[BN])))+((f[W]+f[E])-(f[B]+f[T])))-(vx1*vx1-vx3*vx3));
+
+   //UBLOG(logINFO, "t1 = "<<(((f[NW]+f[SE])-(f[BS]+f[TN]))+((f[SW]+f[NE])-(f[17]+f[BN])))+((f[W]+f[E])-(f[B]+f[T])));
+   //UBLOG(logINFO, "kxxMzz = "<<kxxMzz);
+
+   //UBLOG(logINFO,"f[BW]  = " << f[BW] << " BW  = " << BW);
+   //UBLOG(logINFO,"f[BE]  = " << f[BE] << " BE  = " << BE);
+   //UBLOG(logINFO,"f[NW]  = " << f[NW] << " NW  = " << NW);
+   //UBLOG(logINFO,"f[SE]  = " << f[SE] << " SE  = " << SE);
+   //UBLOG(logINFO,"f[BS]  = " << f[BS] << " BS  = " << BS);
+   //UBLOG(logINFO,"f[TN]  = " << f[TN] << " TN  = " << TN);
+}
+//////////////////////////////////////////////////////////////////////////
+void IncompressibleOffsetInterpolationProcessor::calcInterpolatedCoefficiets(const D3Q27ICell& icell, LBMReal omega, LBMReal eps_new)
+{
+   LBMReal        vx1_SWT,vx2_SWT,vx3_SWT;
+   LBMReal        vx1_NWT,vx2_NWT,vx3_NWT;
+   LBMReal        vx1_NET,vx2_NET,vx3_NET;
+   LBMReal        vx1_SET,vx2_SET,vx3_SET;
+   LBMReal        vx1_SWB,vx2_SWB,vx3_SWB;
+   LBMReal        vx1_NWB,vx2_NWB,vx3_NWB;
+   LBMReal        vx1_NEB,vx2_NEB,vx3_NEB;
+   LBMReal        vx1_SEB,vx2_SEB,vx3_SEB;
+
+   LBMReal        kxyFromfcNEQ_SWT, kyzFromfcNEQ_SWT, kxzFromfcNEQ_SWT, kxxMyyFromfcNEQ_SWT, kxxMzzFromfcNEQ_SWT;
+   LBMReal        kxyFromfcNEQ_NWT, kyzFromfcNEQ_NWT, kxzFromfcNEQ_NWT, kxxMyyFromfcNEQ_NWT, kxxMzzFromfcNEQ_NWT;
+   LBMReal        kxyFromfcNEQ_NET, kyzFromfcNEQ_NET, kxzFromfcNEQ_NET, kxxMyyFromfcNEQ_NET, kxxMzzFromfcNEQ_NET;
+   LBMReal        kxyFromfcNEQ_SET, kyzFromfcNEQ_SET, kxzFromfcNEQ_SET, kxxMyyFromfcNEQ_SET, kxxMzzFromfcNEQ_SET;
+   LBMReal        kxyFromfcNEQ_SWB, kyzFromfcNEQ_SWB, kxzFromfcNEQ_SWB, kxxMyyFromfcNEQ_SWB, kxxMzzFromfcNEQ_SWB;
+   LBMReal        kxyFromfcNEQ_NWB, kyzFromfcNEQ_NWB, kxzFromfcNEQ_NWB, kxxMyyFromfcNEQ_NWB, kxxMzzFromfcNEQ_NWB;
+   LBMReal        kxyFromfcNEQ_NEB, kyzFromfcNEQ_NEB, kxzFromfcNEQ_NEB, kxxMyyFromfcNEQ_NEB, kxxMzzFromfcNEQ_NEB;
+   LBMReal        kxyFromfcNEQ_SEB, kyzFromfcNEQ_SEB, kxzFromfcNEQ_SEB, kxxMyyFromfcNEQ_SEB, kxxMzzFromfcNEQ_SEB;
+
+   calcMoments(icell.TSW,omega,press_SWT,vx1_SWT,vx2_SWT,vx3_SWT, kxyFromfcNEQ_SWT, kyzFromfcNEQ_SWT, kxzFromfcNEQ_SWT, kxxMyyFromfcNEQ_SWT, kxxMzzFromfcNEQ_SWT);
+   calcMoments(icell.TNW,omega,press_NWT,vx1_NWT,vx2_NWT,vx3_NWT, kxyFromfcNEQ_NWT, kyzFromfcNEQ_NWT, kxzFromfcNEQ_NWT, kxxMyyFromfcNEQ_NWT, kxxMzzFromfcNEQ_NWT);
+   calcMoments(icell.TNE,omega,press_NET,vx1_NET,vx2_NET,vx3_NET, kxyFromfcNEQ_NET, kyzFromfcNEQ_NET, kxzFromfcNEQ_NET, kxxMyyFromfcNEQ_NET, kxxMzzFromfcNEQ_NET);
+   calcMoments(icell.TSE,omega,press_SET,vx1_SET,vx2_SET,vx3_SET, kxyFromfcNEQ_SET, kyzFromfcNEQ_SET, kxzFromfcNEQ_SET, kxxMyyFromfcNEQ_SET, kxxMzzFromfcNEQ_SET);
+   calcMoments(icell.BSW,omega,press_SWB,vx1_SWB,vx2_SWB,vx3_SWB, kxyFromfcNEQ_SWB, kyzFromfcNEQ_SWB, kxzFromfcNEQ_SWB, kxxMyyFromfcNEQ_SWB, kxxMzzFromfcNEQ_SWB);
+   calcMoments(icell.BNW,omega,press_NWB,vx1_NWB,vx2_NWB,vx3_NWB, kxyFromfcNEQ_NWB, kyzFromfcNEQ_NWB, kxzFromfcNEQ_NWB, kxxMyyFromfcNEQ_NWB, kxxMzzFromfcNEQ_NWB);
+   calcMoments(icell.BNE,omega,press_NEB,vx1_NEB,vx2_NEB,vx3_NEB, kxyFromfcNEQ_NEB, kyzFromfcNEQ_NEB, kxzFromfcNEQ_NEB, kxxMyyFromfcNEQ_NEB, kxxMzzFromfcNEQ_NEB);
+   calcMoments(icell.BSE,omega,press_SEB,vx1_SEB,vx2_SEB,vx3_SEB, kxyFromfcNEQ_SEB, kyzFromfcNEQ_SEB, kxzFromfcNEQ_SEB, kxxMyyFromfcNEQ_SEB, kxxMzzFromfcNEQ_SEB);
+
+   //LBMReal dxRho=c1o4*((press_NET-press_SWB)+(press_SET-press_NWB)+(press_NEB-press_SWT)+(press_SEB-press_NWT));
+   //LBMReal dyRho=c1o4*((press_NET-press_SWB)-(press_SET-press_NWB)+(press_NEB-press_SWT)-(press_SEB-press_NWT));
+   //LBMReal dzRho=c1o4*((press_NET-press_SWB)+(press_SET-press_NWB)-(press_NEB-press_SWT)-(press_SEB-press_NWT));
+
+   //   kxyFromfcNEQ_SWT+=vx1_SWT*dyRho+vx2_SWT*dxRho;
+   //   kxyFromfcNEQ_NWT+=vx1_NWT*dyRho+vx2_NWT*dxRho;
+   //   kxyFromfcNEQ_NET+=vx1_NET*dyRho+vx2_NET*dxRho;
+   //   kxyFromfcNEQ_SET+=vx1_SET*dyRho+vx2_SET*dxRho;
+   //   kxyFromfcNEQ_SWB+=vx1_SWB*dyRho+vx2_SWB*dxRho;
+   //   kxyFromfcNEQ_NWB+=vx1_NWB*dyRho+vx2_NWB*dxRho;
+   //   kxyFromfcNEQ_NEB+=vx1_NEB*dyRho+vx2_NEB*dxRho;
+   //   kxyFromfcNEQ_SEB+=vx1_SEB*dyRho+vx2_SEB*dxRho;
+
+   //   kyzFromfcNEQ_SWT+=vx3_SWT*dyRho+vx2_SWT*dzRho;
+   //   kyzFromfcNEQ_NWT+=vx3_NWT*dyRho+vx2_NWT*dzRho;
+   //   kyzFromfcNEQ_NET+=vx3_NET*dyRho+vx2_NET*dzRho;
+   //   kyzFromfcNEQ_SET+=vx3_SET*dyRho+vx2_SET*dzRho;
+   //   kyzFromfcNEQ_SWB+=vx3_SWB*dyRho+vx2_SWB*dzRho;
+   //   kyzFromfcNEQ_NWB+=vx3_NWB*dyRho+vx2_NWB*dzRho;
+   //   kyzFromfcNEQ_NEB+=vx3_NEB*dyRho+vx2_NEB*dzRho;
+   //   kyzFromfcNEQ_SEB+=vx3_SEB*dyRho+vx2_SEB*dzRho;
+
+   //   kxzFromfcNEQ_SWT+=vx1_SWT*dzRho+vx3_SWT*dxRho;
+   //   kxzFromfcNEQ_NWT+=vx1_NWT*dzRho+vx3_NWT*dxRho;
+   //   kxzFromfcNEQ_NET+=vx1_NET*dzRho+vx3_NET*dxRho;
+   //   kxzFromfcNEQ_SET+=vx1_SET*dzRho+vx3_SET*dxRho;
+   //   kxzFromfcNEQ_SWB+=vx1_SWB*dzRho+vx3_SWB*dxRho;
+   //   kxzFromfcNEQ_NWB+=vx1_NWB*dzRho+vx3_NWB*dxRho;
+   //   kxzFromfcNEQ_NEB+=vx1_NEB*dzRho+vx3_NEB*dxRho;
+   //   kxzFromfcNEQ_SEB+=vx1_SEB*dzRho+vx3_SEB*dxRho;
+
+   //   kxxMyyFromfcNEQ_SWT+=vx1_SWT*dxRho-vx2_SWT*dyRho;
+   //   kxxMyyFromfcNEQ_NWT+=vx1_NWT*dxRho-vx2_NWT*dyRho;
+   //   kxxMyyFromfcNEQ_NET+=vx1_NET*dxRho-vx2_NET*dyRho;
+   //   kxxMyyFromfcNEQ_SET+=vx1_SET*dxRho-vx2_SET*dyRho;
+   //   kxxMyyFromfcNEQ_SWB+=vx1_SWB*dxRho-vx2_SWB*dyRho;
+   //   kxxMyyFromfcNEQ_NWB+=vx1_NWB*dxRho-vx2_NWB*dyRho;
+   //   kxxMyyFromfcNEQ_NEB+=vx1_NEB*dxRho-vx2_NEB*dyRho;
+   //   kxxMyyFromfcNEQ_SEB+=vx1_SEB*dxRho-vx2_SEB*dyRho;
+
+   //   kxxMzzFromfcNEQ_SWT+=vx1_SWT*dxRho-vx3_SWT*dzRho;
+   //   kxxMzzFromfcNEQ_NWT+=vx1_NWT*dxRho-vx3_NWT*dzRho;
+   //   kxxMzzFromfcNEQ_NET+=vx1_NET*dxRho-vx3_NET*dzRho;
+   //   kxxMzzFromfcNEQ_SET+=vx1_SET*dxRho-vx3_SET*dzRho;
+   //   kxxMzzFromfcNEQ_SWB+=vx1_SWB*dxRho-vx3_SWB*dzRho;
+   //   kxxMzzFromfcNEQ_NWB+=vx1_NWB*dxRho-vx3_NWB*dzRho;
+   //   kxxMzzFromfcNEQ_NEB+=vx1_NEB*dxRho-vx3_NEB*dzRho;
+   //   kxxMzzFromfcNEQ_SEB+=vx1_SEB*dxRho-vx3_SEB*dzRho;
+
+
+      //kxxMzzFromfcNEQ_SWT=0.0;
+      //kxxMzzFromfcNEQ_NWT=0.0;
+      //kxxMzzFromfcNEQ_NET=0.0;
+      //kxxMzzFromfcNEQ_SET=0.0;
+      //kxxMzzFromfcNEQ_SWB=0.0;
+      //kxxMzzFromfcNEQ_NWB=0.0;
+      //kxxMzzFromfcNEQ_NEB=0.0;
+      //kxxMzzFromfcNEQ_SEB=0.0;
+
+
+
+
+
+   a0 = (-kxxMyyFromfcNEQ_NEB - kxxMyyFromfcNEQ_NET + kxxMyyFromfcNEQ_NWB + kxxMyyFromfcNEQ_NWT -
+      kxxMyyFromfcNEQ_SEB - kxxMyyFromfcNEQ_SET + kxxMyyFromfcNEQ_SWB + kxxMyyFromfcNEQ_SWT -
+      kxxMzzFromfcNEQ_NEB - kxxMzzFromfcNEQ_NET + kxxMzzFromfcNEQ_NWB + kxxMzzFromfcNEQ_NWT -
+      kxxMzzFromfcNEQ_SEB - kxxMzzFromfcNEQ_SET + kxxMzzFromfcNEQ_SWB + kxxMzzFromfcNEQ_SWT -
+      2.*kxyFromfcNEQ_NEB - 2.*kxyFromfcNEQ_NET - 2.*kxyFromfcNEQ_NWB - 2.*kxyFromfcNEQ_NWT +
+      2.*kxyFromfcNEQ_SEB + 2.*kxyFromfcNEQ_SET + 2.*kxyFromfcNEQ_SWB + 2.*kxyFromfcNEQ_SWT +
+      2.*kxzFromfcNEQ_NEB - 2.*kxzFromfcNEQ_NET + 2.*kxzFromfcNEQ_NWB - 2.*kxzFromfcNEQ_NWT +
+      2.*kxzFromfcNEQ_SEB - 2.*kxzFromfcNEQ_SET + 2.*kxzFromfcNEQ_SWB - 2.*kxzFromfcNEQ_SWT +
+      8.*vx1_NEB + 8.*vx1_NET + 8.*vx1_NWB + 8.*vx1_NWT + 8.*vx1_SEB +
+      8.*vx1_SET + 8.*vx1_SWB + 8.*vx1_SWT + 2.*vx2_NEB + 2.*vx2_NET -
+      2.*vx2_NWB - 2.*vx2_NWT - 2.*vx2_SEB - 2.*vx2_SET + 2.*vx2_SWB +
+      2.*vx2_SWT - 2.*vx3_NEB + 2.*vx3_NET + 2.*vx3_NWB - 2.*vx3_NWT -
+      2.*vx3_SEB + 2.*vx3_SET + 2.*vx3_SWB - 2.*vx3_SWT)/64.;
+   b0 = (2.*kxxMyyFromfcNEQ_NEB + 2.*kxxMyyFromfcNEQ_NET + 2.*kxxMyyFromfcNEQ_NWB + 2.*kxxMyyFromfcNEQ_NWT -
+      2.*kxxMyyFromfcNEQ_SEB - 2.*kxxMyyFromfcNEQ_SET - 2.*kxxMyyFromfcNEQ_SWB - 2.*kxxMyyFromfcNEQ_SWT -
+      kxxMzzFromfcNEQ_NEB - kxxMzzFromfcNEQ_NET - kxxMzzFromfcNEQ_NWB - kxxMzzFromfcNEQ_NWT +
+      kxxMzzFromfcNEQ_SEB + kxxMzzFromfcNEQ_SET + kxxMzzFromfcNEQ_SWB + kxxMzzFromfcNEQ_SWT -
+      2.*kxyFromfcNEQ_NEB - 2.*kxyFromfcNEQ_NET + 2.*kxyFromfcNEQ_NWB + 2.*kxyFromfcNEQ_NWT -
+      2.*kxyFromfcNEQ_SEB - 2.*kxyFromfcNEQ_SET + 2.*kxyFromfcNEQ_SWB + 2.*kxyFromfcNEQ_SWT +
+      2.*kyzFromfcNEQ_NEB - 2.*kyzFromfcNEQ_NET + 2.*kyzFromfcNEQ_NWB - 2.*kyzFromfcNEQ_NWT +
+      2.*kyzFromfcNEQ_SEB - 2.*kyzFromfcNEQ_SET + 2.*kyzFromfcNEQ_SWB - 2.*kyzFromfcNEQ_SWT +
+      2.*vx1_NEB + 2.*vx1_NET - 2.*vx1_NWB - 2.*vx1_NWT -
+      2.*vx1_SEB - 2.*vx1_SET + 2.*vx1_SWB + 2.*vx1_SWT +
+      8.*vx2_NEB + 8.*vx2_NET + 8.*vx2_NWB + 8.*vx2_NWT +
+      8.*vx2_SEB + 8.*vx2_SET + 8.*vx2_SWB + 8.*vx2_SWT -
+      2.*vx3_NEB + 2.*vx3_NET - 2.*vx3_NWB + 2.*vx3_NWT +
+      2.*vx3_SEB - 2.*vx3_SET + 2.*vx3_SWB - 2.*vx3_SWT)/64.;
+   c0 = (kxxMyyFromfcNEQ_NEB - kxxMyyFromfcNEQ_NET + kxxMyyFromfcNEQ_NWB - kxxMyyFromfcNEQ_NWT +
+      kxxMyyFromfcNEQ_SEB - kxxMyyFromfcNEQ_SET + kxxMyyFromfcNEQ_SWB - kxxMyyFromfcNEQ_SWT -
+      2.*kxxMzzFromfcNEQ_NEB + 2.*kxxMzzFromfcNEQ_NET - 2.*kxxMzzFromfcNEQ_NWB + 2.*kxxMzzFromfcNEQ_NWT -
+      2.*kxxMzzFromfcNEQ_SEB + 2.*kxxMzzFromfcNEQ_SET - 2.*kxxMzzFromfcNEQ_SWB + 2.*kxxMzzFromfcNEQ_SWT -
+      2.*kxzFromfcNEQ_NEB - 2.*kxzFromfcNEQ_NET + 2.*kxzFromfcNEQ_NWB + 2.*kxzFromfcNEQ_NWT -
+      2.*kxzFromfcNEQ_SEB - 2.*kxzFromfcNEQ_SET + 2.*kxzFromfcNEQ_SWB + 2.*kxzFromfcNEQ_SWT -
+      2.*kyzFromfcNEQ_NEB - 2.*kyzFromfcNEQ_NET - 2.*kyzFromfcNEQ_NWB - 2.*kyzFromfcNEQ_NWT +
+      2.*kyzFromfcNEQ_SEB + 2.*kyzFromfcNEQ_SET + 2.*kyzFromfcNEQ_SWB + 2.*kyzFromfcNEQ_SWT -
+      2.*vx1_NEB + 2.*vx1_NET + 2.*vx1_NWB - 2.*vx1_NWT -
+      2.*vx1_SEB + 2.*vx1_SET + 2.*vx1_SWB - 2.*vx1_SWT -
+      2.*vx2_NEB + 2.*vx2_NET - 2.*vx2_NWB + 2.*vx2_NWT +
+      2.*vx2_SEB - 2.*vx2_SET + 2.*vx2_SWB - 2.*vx2_SWT +
+      8.*vx3_NEB + 8.*vx3_NET + 8.*vx3_NWB + 8.*vx3_NWT +
+      8.*vx3_SEB + 8.*vx3_SET + 8.*vx3_SWB + 8.*vx3_SWT)/64.;
+   ax = (vx1_NEB + vx1_NET - vx1_NWB - vx1_NWT + vx1_SEB + vx1_SET - vx1_SWB - vx1_SWT)/4.;
+   bx = (vx2_NEB + vx2_NET - vx2_NWB - vx2_NWT + vx2_SEB + vx2_SET - vx2_SWB - vx2_SWT)/4.;
+   cx = (vx3_NEB + vx3_NET - vx3_NWB - vx3_NWT + vx3_SEB + vx3_SET - vx3_SWB - vx3_SWT)/4.;
+   axx= (kxxMyyFromfcNEQ_NEB + kxxMyyFromfcNEQ_NET - kxxMyyFromfcNEQ_NWB - kxxMyyFromfcNEQ_NWT +
+      kxxMyyFromfcNEQ_SEB + kxxMyyFromfcNEQ_SET - kxxMyyFromfcNEQ_SWB - kxxMyyFromfcNEQ_SWT +
+      kxxMzzFromfcNEQ_NEB + kxxMzzFromfcNEQ_NET - kxxMzzFromfcNEQ_NWB - kxxMzzFromfcNEQ_NWT +
+      kxxMzzFromfcNEQ_SEB + kxxMzzFromfcNEQ_SET - kxxMzzFromfcNEQ_SWB - kxxMzzFromfcNEQ_SWT +
+      2.*vx2_NEB + 2.*vx2_NET - 2.*vx2_NWB - 2.*vx2_NWT -
+      2.*vx2_SEB - 2.*vx2_SET + 2.*vx2_SWB + 2.*vx2_SWT -
+      2.*vx3_NEB + 2.*vx3_NET + 2.*vx3_NWB - 2.*vx3_NWT -
+      2.*vx3_SEB + 2.*vx3_SET + 2.*vx3_SWB - 2.*vx3_SWT)/16.;
+   bxx= (kxyFromfcNEQ_NEB + kxyFromfcNEQ_NET - kxyFromfcNEQ_NWB - kxyFromfcNEQ_NWT +
+      kxyFromfcNEQ_SEB + kxyFromfcNEQ_SET - kxyFromfcNEQ_SWB - kxyFromfcNEQ_SWT -
+      2.*vx1_NEB - 2.*vx1_NET + 2.*vx1_NWB + 2.*vx1_NWT +
+      2.*vx1_SEB + 2.*vx1_SET - 2.*vx1_SWB - 2.*vx1_SWT)/8.;
+   cxx= (kxzFromfcNEQ_NEB + kxzFromfcNEQ_NET - kxzFromfcNEQ_NWB - kxzFromfcNEQ_NWT +
+      kxzFromfcNEQ_SEB + kxzFromfcNEQ_SET - kxzFromfcNEQ_SWB - kxzFromfcNEQ_SWT +
+      2.*vx1_NEB - 2.*vx1_NET - 2.*vx1_NWB + 2.*vx1_NWT +
+      2.*vx1_SEB - 2.*vx1_SET - 2.*vx1_SWB + 2.*vx1_SWT)/8.;
+   ay = (vx1_NEB + vx1_NET + vx1_NWB + vx1_NWT - vx1_SEB - vx1_SET - vx1_SWB - vx1_SWT)/4.;
+   by = (vx2_NEB + vx2_NET + vx2_NWB + vx2_NWT - vx2_SEB - vx2_SET - vx2_SWB - vx2_SWT)/4.;
+   cy = (vx3_NEB + vx3_NET + vx3_NWB + vx3_NWT - vx3_SEB - vx3_SET - vx3_SWB - vx3_SWT)/4.;
+   ayy= (kxyFromfcNEQ_NEB + kxyFromfcNEQ_NET + kxyFromfcNEQ_NWB + kxyFromfcNEQ_NWT -
+      kxyFromfcNEQ_SEB - kxyFromfcNEQ_SET - kxyFromfcNEQ_SWB - kxyFromfcNEQ_SWT -
+      2.*vx2_NEB - 2.*vx2_NET + 2.*vx2_NWB + 2.*vx2_NWT +
+      2.*vx2_SEB + 2.*vx2_SET - 2.*vx2_SWB - 2.*vx2_SWT)/8.;
+   byy= (-2.*kxxMyyFromfcNEQ_NEB - 2.*kxxMyyFromfcNEQ_NET - 2.*kxxMyyFromfcNEQ_NWB - 2.*kxxMyyFromfcNEQ_NWT +
+      2.*kxxMyyFromfcNEQ_SEB + 2.*kxxMyyFromfcNEQ_SET + 2.*kxxMyyFromfcNEQ_SWB + 2.*kxxMyyFromfcNEQ_SWT +
+      kxxMzzFromfcNEQ_NEB + kxxMzzFromfcNEQ_NET + kxxMzzFromfcNEQ_NWB + kxxMzzFromfcNEQ_NWT -
+      kxxMzzFromfcNEQ_SEB - kxxMzzFromfcNEQ_SET - kxxMzzFromfcNEQ_SWB - kxxMzzFromfcNEQ_SWT +
+      2.*vx1_NEB + 2.*vx1_NET - 2.*vx1_NWB - 2.*vx1_NWT -
+      2.*vx1_SEB - 2.*vx1_SET + 2.*vx1_SWB + 2.*vx1_SWT -
+      2.*vx3_NEB + 2.*vx3_NET - 2.*vx3_NWB + 2.*vx3_NWT +
+      2.*vx3_SEB - 2.*vx3_SET + 2.*vx3_SWB - 2.*vx3_SWT)/16.;
+   cyy= (kyzFromfcNEQ_NEB + kyzFromfcNEQ_NET + kyzFromfcNEQ_NWB + kyzFromfcNEQ_NWT -
+      kyzFromfcNEQ_SEB - kyzFromfcNEQ_SET - kyzFromfcNEQ_SWB - kyzFromfcNEQ_SWT +
+      2.*vx2_NEB - 2.*vx2_NET + 2.*vx2_NWB - 2.*vx2_NWT -
+      2.*vx2_SEB + 2.*vx2_SET - 2.*vx2_SWB + 2.*vx2_SWT)/8.;
+   az = (-vx1_NEB + vx1_NET - vx1_NWB + vx1_NWT - vx1_SEB + vx1_SET - vx1_SWB + vx1_SWT)/4.;
+   bz = (-vx2_NEB + vx2_NET - vx2_NWB + vx2_NWT - vx2_SEB + vx2_SET - vx2_SWB + vx2_SWT)/4.;
+   cz = (-vx3_NEB + vx3_NET - vx3_NWB + vx3_NWT - vx3_SEB + vx3_SET - vx3_SWB + vx3_SWT)/4.;
+   azz= (-kxzFromfcNEQ_NEB + kxzFromfcNEQ_NET - kxzFromfcNEQ_NWB + kxzFromfcNEQ_NWT -
+      kxzFromfcNEQ_SEB + kxzFromfcNEQ_SET - kxzFromfcNEQ_SWB + kxzFromfcNEQ_SWT +
+      2.*vx3_NEB - 2.*vx3_NET - 2.*vx3_NWB + 2.*vx3_NWT +
+      2.*vx3_SEB - 2.*vx3_SET - 2.*vx3_SWB + 2.*vx3_SWT)/8.;
+   bzz= (-kyzFromfcNEQ_NEB + kyzFromfcNEQ_NET - kyzFromfcNEQ_NWB + kyzFromfcNEQ_NWT -
+      kyzFromfcNEQ_SEB + kyzFromfcNEQ_SET - kyzFromfcNEQ_SWB + kyzFromfcNEQ_SWT +
+      2.*vx3_NEB - 2.*vx3_NET + 2.*vx3_NWB - 2.*vx3_NWT -
+      2.*vx3_SEB + 2.*vx3_SET - 2.*vx3_SWB + 2.*vx3_SWT)/8.;
+   czz= (-kxxMyyFromfcNEQ_NEB + kxxMyyFromfcNEQ_NET - kxxMyyFromfcNEQ_NWB + kxxMyyFromfcNEQ_NWT -
+      kxxMyyFromfcNEQ_SEB + kxxMyyFromfcNEQ_SET - kxxMyyFromfcNEQ_SWB + kxxMyyFromfcNEQ_SWT +
+      2.*kxxMzzFromfcNEQ_NEB - 2.*kxxMzzFromfcNEQ_NET + 2.*kxxMzzFromfcNEQ_NWB - 2.*kxxMzzFromfcNEQ_NWT +
+      2.*kxxMzzFromfcNEQ_SEB - 2.*kxxMzzFromfcNEQ_SET + 2.*kxxMzzFromfcNEQ_SWB - 2.*kxxMzzFromfcNEQ_SWT -
+      2.*vx1_NEB + 2.*vx1_NET + 2.*vx1_NWB - 2.*vx1_NWT -
+      2.*vx1_SEB + 2.*vx1_SET + 2.*vx1_SWB - 2.*vx1_SWT -
+      2.*vx2_NEB + 2.*vx2_NET - 2.*vx2_NWB + 2.*vx2_NWT +
+      2.*vx2_SEB - 2.*vx2_SET + 2.*vx2_SWB - 2.*vx2_SWT)/16.;
+   axy= (vx1_NEB + vx1_NET - vx1_NWB - vx1_NWT - vx1_SEB - vx1_SET + vx1_SWB + vx1_SWT)/2.;
+   bxy= (vx2_NEB + vx2_NET - vx2_NWB - vx2_NWT - vx2_SEB - vx2_SET + vx2_SWB + vx2_SWT)/2.;
+   cxy= (vx3_NEB + vx3_NET - vx3_NWB - vx3_NWT - vx3_SEB - vx3_SET + vx3_SWB + vx3_SWT)/2.;
+   axz= (-vx1_NEB + vx1_NET + vx1_NWB - vx1_NWT - vx1_SEB + vx1_SET + vx1_SWB - vx1_SWT)/2.;
+   bxz= (-vx2_NEB + vx2_NET + vx2_NWB - vx2_NWT - vx2_SEB + vx2_SET + vx2_SWB - vx2_SWT)/2.;
+   cxz= (-vx3_NEB + vx3_NET + vx3_NWB - vx3_NWT - vx3_SEB + vx3_SET + vx3_SWB - vx3_SWT)/2.;
+   ayz= (-vx1_NEB + vx1_NET - vx1_NWB + vx1_NWT + vx1_SEB - vx1_SET + vx1_SWB - vx1_SWT)/2.;
+   byz= (-vx2_NEB + vx2_NET - vx2_NWB + vx2_NWT + vx2_SEB - vx2_SET + vx2_SWB - vx2_SWT)/2.;
+   cyz= (-vx3_NEB + vx3_NET - vx3_NWB + vx3_NWT + vx3_SEB - vx3_SET + vx3_SWB - vx3_SWT)/2.;
+   axyz=-vx1_NEB + vx1_NET + vx1_NWB - vx1_NWT + vx1_SEB - vx1_SET - vx1_SWB + vx1_SWT;
+   bxyz=-vx2_NEB + vx2_NET + vx2_NWB - vx2_NWT + vx2_SEB - vx2_SET - vx2_SWB + vx2_SWT;
+   cxyz=-vx3_NEB + vx3_NET + vx3_NWB - vx3_NWT + vx3_SEB - vx3_SET - vx3_SWB + vx3_SWT;
+
+   /////////////////////BÖSE!!!
+   //axx=0;   ayy=0;   azz=0;
+   //bxx=0;   byy=0;   bzz=0;
+   //cxx=0;   cyy=0;   czz=0;
+   ////////////////////!!!BÖSE
+
+   //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+   //kxyAverage       =(kxyFromfcNEQ_SWB+
+   //                   kxyFromfcNEQ_SWT+
+   //                   kxyFromfcNEQ_SET+
+   //                   kxyFromfcNEQ_SEB+
+   //                   kxyFromfcNEQ_NWB+
+   //                   kxyFromfcNEQ_NWT+
+   //                   kxyFromfcNEQ_NET+
+   //                   kxyFromfcNEQ_NEB)*c1o8-(ay+bx);
+   //kyzAverage       =(kyzFromfcNEQ_SWB+
+   //                   kyzFromfcNEQ_SWT+
+   //                   kyzFromfcNEQ_SET+
+   //                   kyzFromfcNEQ_SEB+
+   //                   kyzFromfcNEQ_NWB+
+   //                   kyzFromfcNEQ_NWT+
+   //                   kyzFromfcNEQ_NET+
+   //                   kyzFromfcNEQ_NEB)*c1o8-(bz+cy);
+   //kxzAverage       =(kxzFromfcNEQ_SWB+
+   //                   kxzFromfcNEQ_SWT+
+   //                   kxzFromfcNEQ_SET+
+   //                   kxzFromfcNEQ_SEB+
+   //                   kxzFromfcNEQ_NWB+
+   //                   kxzFromfcNEQ_NWT+
+   //                   kxzFromfcNEQ_NET+
+   //                   kxzFromfcNEQ_NEB)*c1o8-(az+cx);
+   //kxxMyyAverage    =(kxxMyyFromfcNEQ_SWB+
+   //                   kxxMyyFromfcNEQ_SWT+
+   //                   kxxMyyFromfcNEQ_SET+
+   //                   kxxMyyFromfcNEQ_SEB+
+   //                   kxxMyyFromfcNEQ_NWB+
+   //                   kxxMyyFromfcNEQ_NWT+
+   //                   kxxMyyFromfcNEQ_NET+
+   //                   kxxMyyFromfcNEQ_NEB)*c1o8-(ax-by);
+   //kxxMzzAverage    =(kxxMzzFromfcNEQ_SWB+
+   //                  kxxMzzFromfcNEQ_SWT+
+   //                  kxxMzzFromfcNEQ_SET+
+   //                  kxxMzzFromfcNEQ_SEB+
+   //                  kxxMzzFromfcNEQ_NWB+
+   //                  kxxMzzFromfcNEQ_NWT+
+   //                  kxxMzzFromfcNEQ_NET+
+   //                  kxxMzzFromfcNEQ_NEB)*c1o8-(ax-cz);
+   kxyAverage       =0;//(kxyFromfcNEQ_SWB+
+                    //kxyFromfcNEQ_SWT+
+                    //kxyFromfcNEQ_SET+
+                    //kxyFromfcNEQ_SEB+
+                    //kxyFromfcNEQ_NWB+
+                    //kxyFromfcNEQ_NWT+
+                    //kxyFromfcNEQ_NET+
+                    //kxyFromfcNEQ_NEB)*c1o8-(ay+bx);
+   kyzAverage       =0;//(kyzFromfcNEQ_SWB+
+                       //kyzFromfcNEQ_SWT+
+                       //kyzFromfcNEQ_SET+
+                       //kyzFromfcNEQ_SEB+
+                       //kyzFromfcNEQ_NWB+
+                       //kyzFromfcNEQ_NWT+
+                       //kyzFromfcNEQ_NET+
+                       //kyzFromfcNEQ_NEB)*c1o8-(bz+cy);
+   kxzAverage       =0;//(kxzFromfcNEQ_SWB+
+                       //kxzFromfcNEQ_SWT+
+                       //kxzFromfcNEQ_SET+
+                       //kxzFromfcNEQ_SEB+
+                       //kxzFromfcNEQ_NWB+
+                       //kxzFromfcNEQ_NWT+
+                       //kxzFromfcNEQ_NET+
+                       //kxzFromfcNEQ_NEB)*c1o8-(az+cx);
+   kxxMyyAverage    =0;//(kxxMyyFromfcNEQ_SWB+
+                       //kxxMyyFromfcNEQ_SWT+
+                       //kxxMyyFromfcNEQ_SET+
+                       //kxxMyyFromfcNEQ_SEB+
+                       //kxxMyyFromfcNEQ_NWB+
+                       //kxxMyyFromfcNEQ_NWT+
+                       //kxxMyyFromfcNEQ_NET+
+                       //kxxMyyFromfcNEQ_NEB)*c1o8-(ax-by);
+   kxxMzzAverage    =0;//(kxxMzzFromfcNEQ_SWB+
+                       //kxxMzzFromfcNEQ_SWT+
+                       //kxxMzzFromfcNEQ_SET+
+                       //kxxMzzFromfcNEQ_SEB+
+                       //kxxMzzFromfcNEQ_NWB+
+                       //kxxMzzFromfcNEQ_NWT+
+                       //kxxMzzFromfcNEQ_NET+
+                       //kxxMzzFromfcNEQ_NEB)*c1o8-(ax-cz);
+   ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+   //
+   // Bernd das Brot
+   //
+   ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+   a0 = a0 + xoff * ax + yoff * ay + zoff * az + xoff_sq * axx + yoff_sq * ayy + zoff_sq * azz + xoff*yoff*axy + xoff*zoff*axz + yoff*zoff*ayz + xoff*yoff*zoff*axyz ;
+   ax = ax + 2. * xoff * axx + yoff * axy + zoff * axz + yoff*zoff*axyz;
+   ay = ay + 2. * yoff * ayy + xoff * axy + zoff * ayz + xoff*zoff*axyz;
+   az = az + 2. * zoff * azz + xoff * axz + yoff * ayz + xoff*yoff*axyz;
+   b0 = b0 + xoff * bx + yoff * by + zoff * bz + xoff_sq * bxx + yoff_sq * byy + zoff_sq * bzz + xoff*yoff*bxy + xoff*zoff*bxz + yoff*zoff*byz + xoff*yoff*zoff*bxyz;
+   bx = bx + 2. * xoff * bxx + yoff * bxy + zoff * bxz + yoff*zoff*bxyz;
+   by = by + 2. * yoff * byy + xoff * bxy + zoff * byz + xoff*zoff*bxyz;
+   bz = bz + 2. * zoff * bzz + xoff * bxz + yoff * byz + xoff*yoff*bxyz;
+   c0 = c0 + xoff * cx + yoff * cy + zoff * cz + xoff_sq * cxx + yoff_sq * cyy + zoff_sq * czz + xoff*yoff*cxy + xoff*zoff*cxz + yoff*zoff*cyz + xoff*yoff*zoff*cxyz;
+   cx = cx + 2. * xoff * cxx + yoff * cxy + zoff * cxz + yoff*zoff*cxyz;
+   cy = cy + 2. * yoff * cyy + xoff * cxy + zoff * cyz + xoff*zoff*cxyz;
+   cz = cz + 2. * zoff * czz + xoff * cxz + yoff * cyz + xoff*yoff*cxyz;
+   axy= axy + zoff*axyz;
+   axz= axz + yoff*axyz;
+   ayz= ayz + xoff*axyz;
+   bxy= bxy + zoff*bxyz;
+   bxz= bxz + yoff*bxyz;
+   byz= byz + xoff*bxyz;
+   cxy= cxy + zoff*cxyz;
+   cxz= cxz + yoff*cxyz;
+   cyz= cyz + xoff*cxyz;
+   ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+   const LBMReal o = omega;
+
+   f_E = eps_new*((2*(-2*ax + by + cz-kxxMzzAverage-kxxMyyAverage))/(27.*o));
+   f_N = eps_new*((2*(ax - 2*by + cz+2*kxxMyyAverage-kxxMzzAverage))/(27.*o));
+   f_T = eps_new*((2*(ax + by - 2*cz-kxxMyyAverage+2*kxxMzzAverage))/(27.*o));
+   f_NE = eps_new*(-(ax + 3*ay + 3*bx + by - 2*cz+2*kxxMyyAverage-kxxMyyAverage+3*kxyAverage)/(54.*o));
+   f_SE = eps_new*(-(ax - 3*ay - 3*bx + by - 2*cz+2*kxxMyyAverage-kxxMyyAverage-3*kxyAverage)/(54.*o));
+   f_TE = eps_new*(-(ax + 3*az - 2*by + 3*cx + cz+2*kxxMyyAverage-kxxMzzAverage+3*kxzAverage)/(54.*o));
+   f_BE = eps_new*(-(ax - 3*az - 2*by - 3*cx + cz+2*kxxMyyAverage-kxxMzzAverage-3*kxzAverage)/(54.*o));
+   f_TN = eps_new*(-(-2*ax + by + 3*bz + 3*cy + cz-kxxMyyAverage-kxxMzzAverage+3*kyzAverage)/(54.*o));
+   f_BN = eps_new*(-(-2*ax + by - 3*bz - 3*cy + cz-kxxMyyAverage-kxxMzzAverage-3*kyzAverage)/(54.*o));
+   f_ZERO = 0.;
+   f_TNE = eps_new*(-(ay + az + bx + bz + cx + cy+kxyAverage+kxzAverage+kyzAverage)/(72.*o));
+   f_TSW = eps_new*((-ay + az - bx + bz + cx + cy-kxyAverage+kxzAverage+kyzAverage)/(72.*o));
+   f_TSE = eps_new*((ay - az + bx + bz - cx + cy+kxyAverage-kxzAverage+kyzAverage)/(72.*o));
+   f_TNW = eps_new*((ay + az + bx - bz + cx - cy+kxyAverage+kxzAverage-kyzAverage)/(72.*o));
+
+   x_E = 0.25*eps_new*((2*(-4*axx + bxy + cxz))/(27.*o));
+   x_N = 0.25*eps_new*((2*(2*axx - 2*bxy + cxz))/(27.*o));
+   x_T = 0.25*eps_new*((2*(2*axx + bxy - 2*cxz))/(27.*o));
+   x_NE = 0.25*eps_new*(-((2*axx + 3*axy + 6*bxx + bxy - 2*cxz))/(54.*o));
+   x_SE = 0.25*eps_new*(-((2*axx - 3*axy - 6*bxx + bxy - 2*cxz))/(54.*o));
+   x_TE = 0.25*eps_new*(-((2*axx + 3*axz - 2*bxy + 6*cxx + cxz))/(54.*o));
+   x_BE = 0.25*eps_new*(-((2*axx - 3*axz - 2*bxy - 6*cxx + cxz))/(54.*o));
+   x_TN = 0.25*eps_new*(-((-4*axx + bxy + 3*bxz + 3*cxy + cxz))/(54.*o));
+   x_BN = 0.25*eps_new*(-((-4*axx + bxy - 3*bxz - 3*cxy + cxz))/(54.*o));
+   x_ZERO = 0.;
+   x_TNE = 0.25*eps_new*(-((axy + axz + 2*bxx + bxz + 2*cxx + cxy))/(72.*o));
+   x_TSW = 0.25*eps_new*(((-axy + axz - 2*bxx + bxz + 2*cxx + cxy))/(72.*o));
+   x_TSE = 0.25*eps_new*(((axy - axz + 2*bxx + bxz - 2*cxx + cxy))/(72.*o));
+   x_TNW = 0.25*eps_new*(((axy + axz + 2*bxx - bxz + 2*cxx - cxy))/(72.*o));
+
+   y_E = 0.25*eps_new*(2*(-2*axy + 2*byy + cyz))/(27.*o);
+   y_N = 0.25*eps_new*(2*(axy - 4*byy + cyz))/(27.*o);
+   y_T = 0.25*eps_new*(2*(axy + 2*byy - 2*cyz))/(27.*o);
+   y_NE = 0.25*eps_new*(-((axy + 6*ayy + 3*bxy + 2*byy - 2*cyz))/(54.*o));
+   y_SE = 0.25*eps_new*(-((axy - 6*ayy - 3*bxy + 2*byy - 2*cyz))/(54.*o));
+   y_TE = 0.25*eps_new*(-((axy + 3*ayz - 4*byy + 3*cxy + cyz))/(54.*o));
+   y_BE = 0.25*eps_new*(-((axy - 3*ayz - 4*byy - 3*cxy + cyz))/(54.*o));
+   y_TN = 0.25*eps_new*(-((-2*axy + 2*byy + 3*byz + 6*cyy + cyz))/(54.*o));
+   y_BN = 0.25*eps_new*(-((-2*axy + 2*byy - 3*byz - 6*cyy + cyz))/(54.*o));
+   y_ZERO = 0.;
+   y_TNE = 0.25*eps_new*(-((2*ayy + ayz + bxy + byz + cxy + 2*cyy))/(72.*o));
+   y_TSW = 0.25*eps_new*(((-2*ayy + ayz - bxy + byz + cxy + 2*cyy))/(72.*o));
+   y_TSE = 0.25*eps_new*(((2*ayy - ayz + bxy + byz - cxy + 2*cyy))/(72.*o));
+   y_TNW = 0.25*eps_new*(((2*ayy + ayz + bxy - byz + cxy - 2*cyy))/(72.*o));
+
+   z_E = 0.25*eps_new*((2*(-2*axz + byz + 2*czz))/(27.*o));
+   z_N = 0.25*eps_new*((2*(axz - 2*byz + 2*czz))/(27.*o));
+   z_T = 0.25*eps_new*((2*(axz + byz - 4*czz))/(27.*o));
+   z_NE = 0.25*eps_new*(-((axz + 3*ayz + 3*bxz + byz - 4*czz))/(54.*o));
+   z_SE = 0.25*eps_new*(-((axz - 3*ayz - 3*bxz + byz - 4*czz))/(54.*o));
+   z_TE = 0.25*eps_new*(-((axz + 6*azz - 2*byz + 3*cxz + 2*czz))/(54.*o));
+   z_BE = 0.25*eps_new*(-((axz - 6*azz - 2*byz - 3*cxz + 2*czz))/(54.*o));
+   z_TN = 0.25*eps_new*(-((-2*axz + byz + 6*bzz + 3*cyz + 2*czz))/(54.*o));
+   z_BN = 0.25*eps_new*(-((-2*axz + byz - 6*bzz - 3*cyz + 2*czz))/(54.*o));
+   z_ZERO = 0.;
+   z_TNE = 0.25*eps_new*(-((ayz + 2*azz + bxz + 2*bzz + cxz + cyz))/(72.*o));
+   z_TSW = 0.25*eps_new*(((-ayz + 2*azz - bxz + 2*bzz + cxz + cyz))/(72.*o));
+   z_TSE = 0.25*eps_new*(((ayz - 2*azz + bxz + 2*bzz - cxz + cyz))/(72.*o));
+   z_TNW = 0.25*eps_new*(((ayz + 2*azz + bxz - 2*bzz + cxz - cyz))/(72.*o));
+
+   xy_E   =   0.0625*eps_new *((                       2.*cxyz)/(27.*o));
+   xy_N   =   0.0625*eps_new *((                       2.*cxyz)/(27.*o));
+   xy_T   = -(0.0625*eps_new *((                       4.*cxyz)/(27.*o)));
+   xy_NE  =   0.0625*eps_new *(                            cxyz /(27.*o));
+   xy_SE  =   0.0625*eps_new *(                            cxyz /(27.*o));
+   xy_TE  = -(0.0625*eps_new *(( 3.*axyz            +     cxyz)/(54.*o)));
+   xy_BE  = -(0.0625*eps_new *((-3.*axyz            +     cxyz)/(54.*o)));
+   xy_TN  = -(0.0625*eps_new *((            3.*bxyz +     cxyz)/(54.*o)));
+   xy_BN  = -(0.0625*eps_new *((          - 3.*bxyz +     cxyz)/(54.*o)));
+   //xy_ZERO=   0.0625*eps_new;
+   xy_TNE = -(0.0625*eps_new *((     axyz +     bxyz           )/(72.*o)));
+   xy_TSW =   0.0625*eps_new *((     axyz +     bxyz           )/(72.*o));
+   xy_TSE =   0.0625*eps_new *((-    axyz +     bxyz           )/(72.*o));
+   xy_TNW =   0.0625*eps_new *((     axyz -     bxyz           )/(72.*o));
+
+   xz_E   =   0.0625*eps_new *((            2.*bxyz           )/(27.*o));
+   xz_N   = -(0.0625*eps_new *((            4.*bxyz           )/(27.*o)));
+   xz_T   =   0.0625*eps_new *((            2.*bxyz           )/(27.*o));
+   xz_NE  = -(0.0625*eps_new *(( 3.*axyz +     bxyz           )/(54.*o)));
+   xz_SE  = -(0.0625*eps_new *((-3.*axyz +     bxyz           )/(54.*o)));
+   xz_TE  =   0.0625*eps_new *((                bxyz           )/(27.*o));
+   xz_BE  =   0.0625*eps_new *((                bxyz           )/(27.*o));
+   xz_TN  = -(0.0625*eps_new *((                bxyz + 3.*cxyz)/(54.*o)));
+   xz_BN  = -(0.0625*eps_new *((                bxyz - 3.*cxyz)/(54.*o)));
+   //xz_ZERO=   0.0625*eps_new;
+   xz_TNE = -(0.0625*eps_new *((     axyz            +     cxyz)/(72.*o)));
+   xz_TSW =   0.0625*eps_new *((-    axyz            +     cxyz)/(72.*o));
+   xz_TSE =   0.0625*eps_new *((     axyz            +     cxyz)/(72.*o));
+   xz_TNW =   0.0625*eps_new *((     axyz            -     cxyz)/(72.*o));
+
+   yz_E   = -(0.0625*eps_new *(( 4.*axyz                      )/(27.*o)));
+   yz_N   =   0.0625*eps_new *(( 2.*axyz                      )/(27.*o));
+   yz_T   =   0.0625*eps_new *(( 2.*axyz                      )/(27.*o));
+   yz_NE  = -(0.0625*eps_new *((     axyz + 3.*bxyz           )/(54.*o)));
+   yz_SE  = -(0.0625*eps_new *((     axyz - 3.*bxyz           )/(54.*o)));
+   yz_TE  = -(0.0625*eps_new *((     axyz            + 3.*cxyz)/(54.*o)));
+   yz_BE  = -(0.0625*eps_new *((     axyz            - 3.*cxyz)/(54.*o)));
+   yz_TN  =   0.0625*eps_new *((     axyz                      )/(27.*o));
+   yz_BN  =   0.0625*eps_new *((     axyz                      )/(27.*o));
+   //yz_ZERO=   0.0625*eps_new;
+   yz_TNE = -(0.0625*eps_new *((                bxyz +     cxyz)/(72.*o)));
+   yz_TSW =   0.0625*eps_new *((          -     bxyz +     cxyz)/(72.*o));
+   yz_TSE =   0.0625*eps_new *((                bxyz -     cxyz)/(72.*o));
+   yz_TNW =   0.0625*eps_new *((                bxyz +     cxyz)/(72.*o));
+}
+//////////////////////////////////////////////////////////////////////////
+void IncompressibleOffsetInterpolationProcessor::calcInterpolatedNode(LBMReal* f, LBMReal omega, LBMReal x, LBMReal y, LBMReal z, LBMReal press, LBMReal xs, LBMReal ys, LBMReal zs)
+{
+   using namespace D3Q27System;
+
+   LBMReal rho  = press ;//+ (2.*axx*x+axy*y+axz*z+axyz*y*z+ax + 2.*byy*y+bxy*x+byz*z+bxyz*x*z+by + 2.*czz*z+cxz*x+cyz*y+cxyz*x*y+cz)/3.;
+   LBMReal vx1  = a0 + 0.25*( xs*ax + ys*ay + zs*az) + 0.0625*(axx + xs*ys*axy + xs*zs*axz + ayy + ys*zs*ayz + azz) + 0.015625*(xs*ys*zs*axyz);
+   LBMReal vx2  = b0 + 0.25*( xs*bx + ys*by + zs*bz) + 0.0625*(bxx + xs*ys*bxy + xs*zs*bxz + byy + ys*zs*byz + bzz) + 0.015625*(xs*ys*zs*bxyz);
+   LBMReal vx3  = c0 + 0.25*( xs*cx + ys*cy + zs*cz) + 0.0625*(cxx + xs*ys*cxy + xs*zs*cxz + cyy + ys*zs*cyz + czz) + 0.015625*(xs*ys*zs*cxyz);
+
+   //////////////////////////////////////////////////////////////////////////
+   //DRAFT
+   //vx1 -= forcingF*0.5;
+   //////////////////////////////////////////////////////////////////////////
+
+   LBMReal feq[ENDF+1];
+   D3Q27System::calcIncompFeq(feq,rho,vx1,vx2,vx3);
+
+   f[E]    = f_E    + xs*x_E    + ys*y_E    + zs*z_E    + xs*ys*xy_E    + xs*zs*xz_E    + ys*zs*yz_E    + feq[E];
+   f[W]    = f_E    + xs*x_E    + ys*y_E    + zs*z_E    + xs*ys*xy_E    + xs*zs*xz_E    + ys*zs*yz_E    + feq[W];
+   f[N]    = f_N    + xs*x_N    + ys*y_N    + zs*z_N    + xs*ys*xy_N    + xs*zs*xz_N    + ys*zs*yz_N    + feq[N];
+   f[S]    = f_N    + xs*x_N    + ys*y_N    + zs*z_N    + xs*ys*xy_N    + xs*zs*xz_N    + ys*zs*yz_N    + feq[S];
+   f[T]    = f_T    + xs*x_T    + ys*y_T    + zs*z_T    + xs*ys*xy_T    + xs*zs*xz_T    + ys*zs*yz_T    + feq[T];
+   f[B]    = f_T    + xs*x_T    + ys*y_T    + zs*z_T    + xs*ys*xy_T    + xs*zs*xz_T    + ys*zs*yz_T    + feq[B];
+   f[NE]   = f_NE   + xs*x_NE   + ys*y_NE   + zs*z_NE   + xs*ys*xy_NE   + xs*zs*xz_NE   + ys*zs*yz_NE   + feq[NE];
+   f[SW]   = f_NE   + xs*x_NE   + ys*y_NE   + zs*z_NE   + xs*ys*xy_NE   + xs*zs*xz_NE   + ys*zs*yz_NE   + feq[SW];
+   f[SE]   = f_SE   + xs*x_SE   + ys*y_SE   + zs*z_SE   + xs*ys*xy_SE   + xs*zs*xz_SE   + ys*zs*yz_SE   + feq[SE];
+   f[NW]   = f_SE   + xs*x_SE   + ys*y_SE   + zs*z_SE   + xs*ys*xy_SE   + xs*zs*xz_SE   + ys*zs*yz_SE   + feq[NW];
+   f[TE]   = f_TE   + xs*x_TE   + ys*y_TE   + zs*z_TE   + xs*ys*xy_TE   + xs*zs*xz_TE   + ys*zs*yz_TE   + feq[TE];
+   f[BW]   = f_TE   + xs*x_TE   + ys*y_TE   + zs*z_TE   + xs*ys*xy_TE   + xs*zs*xz_TE   + ys*zs*yz_TE   + feq[BW];
+   f[BE]   = f_BE   + xs*x_BE   + ys*y_BE   + zs*z_BE   + xs*ys*xy_BE   + xs*zs*xz_BE   + ys*zs*yz_BE   + feq[BE];
+   f[TW]   = f_BE   + xs*x_BE   + ys*y_BE   + zs*z_BE   + xs*ys*xy_BE   + xs*zs*xz_BE   + ys*zs*yz_BE   + feq[TW];
+   f[TN]   = f_TN   + xs*x_TN   + ys*y_TN   + zs*z_TN   + xs*ys*xy_TN   + xs*zs*xz_TN   + ys*zs*yz_TN   + feq[TN];
+   f[BS]   = f_TN   + xs*x_TN   + ys*y_TN   + zs*z_TN   + xs*ys*xy_TN   + xs*zs*xz_TN   + ys*zs*yz_TN   + feq[BS];
+   f[BN]   = f_BN   + xs*x_BN   + ys*y_BN   + zs*z_BN   + xs*ys*xy_BN   + xs*zs*xz_BN   + ys*zs*yz_BN   + feq[BN];
+   f[TS]   = f_BN   + xs*x_BN   + ys*y_BN   + zs*z_BN   + xs*ys*xy_BN   + xs*zs*xz_BN   + ys*zs*yz_BN   + feq[TS];
+   f[TNE]  = f_TNE  + xs*x_TNE  + ys*y_TNE  + zs*z_TNE  + xs*ys*xy_TNE  + xs*zs*xz_TNE  + ys*zs*yz_TNE  + feq[TNE];
+   f[TSW]  = f_TSW  + xs*x_TSW  + ys*y_TSW  + zs*z_TSW  + xs*ys*xy_TSW  + xs*zs*xz_TSW  + ys*zs*yz_TSW  + feq[TSW];
+   f[TSE]  = f_TSE  + xs*x_TSE  + ys*y_TSE  + zs*z_TSE  + xs*ys*xy_TSE  + xs*zs*xz_TSE  + ys*zs*yz_TSE  + feq[TSE];
+   f[TNW]  = f_TNW  + xs*x_TNW  + ys*y_TNW  + zs*z_TNW  + xs*ys*xy_TNW  + xs*zs*xz_TNW  + ys*zs*yz_TNW  + feq[TNW];
+   f[BNE]  = f_TSW  + xs*x_TSW  + ys*y_TSW  + zs*z_TSW  + xs*ys*xy_TSW  + xs*zs*xz_TSW  + ys*zs*yz_TSW  + feq[BNE];
+   f[BSW]  = f_TNE  + xs*x_TNE  + ys*y_TNE  + zs*z_TNE  + xs*ys*xy_TNE  + xs*zs*xz_TNE  + ys*zs*yz_TNE  + feq[BSW];
+   f[BSE]  = f_TNW  + xs*x_TNW  + ys*y_TNW  + zs*z_TNW  + xs*ys*xy_TNW  + xs*zs*xz_TNW  + ys*zs*yz_TNW  + feq[BSE];
+   f[BNW]  = f_TSE  + xs*x_TSE  + ys*y_TSE  + zs*z_TSE  + xs*ys*xy_TSE  + xs*zs*xz_TSE  + ys*zs*yz_TSE  + feq[BNW];
+   f[ZERO] = f_ZERO + xs*x_ZERO + ys*y_ZERO + zs*z_ZERO                                                 + feq[ZERO];
+}
+//////////////////////////////////////////////////////////////////////////
+//Position SWB -0.25, -0.25, -0.25
+LBMReal IncompressibleOffsetInterpolationProcessor::calcPressBSW()
+{
+   return   press_SWT * (0.140625 + 0.1875 * xoff + 0.1875 * yoff - 0.5625 * zoff) +
+      press_NWT * (0.046875 + 0.0625 * xoff - 0.1875 * yoff - 0.1875 * zoff) +
+      press_SET * (0.046875 - 0.1875 * xoff + 0.0625 * yoff - 0.1875 * zoff) +
+      press_NET * (0.015625 - 0.0625 * xoff - 0.0625 * yoff - 0.0625 * zoff) +
+      press_NEB * (0.046875 - 0.1875 * xoff - 0.1875 * yoff + 0.0625 * zoff) +
+      press_NWB * (0.140625 + 0.1875 * xoff - 0.5625 * yoff + 0.1875 * zoff) +
+      press_SEB * (0.140625 - 0.5625 * xoff + 0.1875 * yoff + 0.1875 * zoff) +
+      press_SWB * (0.421875 + 0.5625 * xoff + 0.5625 * yoff + 0.5625 * zoff);
+}
+//////////////////////////////////////////////////////////////////////////
+//Position SWT -0.25, -0.25, 0.25
+LBMReal IncompressibleOffsetInterpolationProcessor::calcPressTSW()
+{
+   return   press_SWT * (0.421875 + 0.5625 * xoff + 0.5625 * yoff - 0.5625 * zoff) +
+      press_NWT * (0.140625 + 0.1875 * xoff - 0.5625 * yoff - 0.1875 * zoff) +
+      press_SET * (0.140625 - 0.5625 * xoff + 0.1875 * yoff - 0.1875 * zoff) +
+      press_NET * (0.046875 - 0.1875 * xoff - 0.1875 * yoff - 0.0625 * zoff) +
+      press_NEB * (0.015625 - 0.0625 * xoff - 0.0625 * yoff + 0.0625 * zoff) +
+      press_NWB * (0.046875 + 0.0625 * xoff - 0.1875 * yoff + 0.1875 * zoff) +
+      press_SEB * (0.046875 - 0.1875 * xoff + 0.0625 * yoff + 0.1875 * zoff) +
+      press_SWB * (0.140625 + 0.1875 * xoff + 0.1875 * yoff + 0.5625 * zoff);
+}
+//////////////////////////////////////////////////////////////////////////
+//Position SET 0.25, -0.25, 0.25
+LBMReal IncompressibleOffsetInterpolationProcessor::calcPressTSE()
+{
+   return   press_SET * (0.421875 - 0.5625 * xoff + 0.5625 * yoff - 0.5625 * zoff) +
+      press_NET * (0.140625 - 0.1875 * xoff - 0.5625 * yoff - 0.1875 * zoff) +
+      press_SWT * (0.140625 + 0.5625 * xoff + 0.1875 * yoff - 0.1875 * zoff) +
+      press_NWT * (0.046875 + 0.1875 * xoff - 0.1875 * yoff - 0.0625 * zoff) +
+      press_NWB * (0.015625 + 0.0625 * xoff - 0.0625 * yoff + 0.0625 * zoff) +
+      press_NEB * (0.046875 - 0.0625 * xoff - 0.1875 * yoff + 0.1875 * zoff) +
+      press_SWB * (0.046875 + 0.1875 * xoff + 0.0625 * yoff + 0.1875 * zoff) +
+      press_SEB * (0.140625 - 0.1875 * xoff + 0.1875 * yoff + 0.5625 * zoff);
+}
+//////////////////////////////////////////////////////////////////////////
+//Position SEB 0.25, -0.25, -0.25
+LBMReal IncompressibleOffsetInterpolationProcessor::calcPressBSE()
+{
+   return   press_SET * (0.140625 - 0.1875 * xoff + 0.1875 * yoff - 0.5625 * zoff) +
+      press_NET * (0.046875 - 0.0625 * xoff - 0.1875 * yoff - 0.1875 * zoff) +
+      press_SWT * (0.046875 + 0.1875 * xoff + 0.0625 * yoff - 0.1875 * zoff) +
+      press_NWT * (0.015625 + 0.0625 * xoff - 0.0625 * yoff - 0.0625 * zoff) +
+      press_NWB * (0.046875 + 0.1875 * xoff - 0.1875 * yoff + 0.0625 * zoff) +
+      press_NEB * (0.140625 - 0.1875 * xoff - 0.5625 * yoff + 0.1875 * zoff) +
+      press_SWB * (0.140625 + 0.5625 * xoff + 0.1875 * yoff + 0.1875 * zoff) +
+      press_SEB * (0.421875 - 0.5625 * xoff + 0.5625 * yoff + 0.5625 * zoff);
+}
+//////////////////////////////////////////////////////////////////////////
+//Position NWB -0.25, 0.25, -0.25
+LBMReal IncompressibleOffsetInterpolationProcessor::calcPressBNW()
+{
+   return   press_NWT * (0.140625 + 0.1875 * xoff - 0.1875 * yoff - 0.5625 * zoff) +
+      press_NET * (0.046875 - 0.1875 * xoff - 0.0625 * yoff - 0.1875 * zoff) +
+      press_SWT * (0.046875 + 0.0625 * xoff + 0.1875 * yoff - 0.1875 * zoff) +
+      press_SET * (0.015625 - 0.0625 * xoff + 0.0625 * yoff - 0.0625 * zoff) +
+      press_SEB * (0.046875 - 0.1875 * xoff + 0.1875 * yoff + 0.0625 * zoff) +
+      press_NEB * (0.140625 - 0.5625 * xoff - 0.1875 * yoff + 0.1875 * zoff) +
+      press_SWB * (0.140625 + 0.1875 * xoff + 0.5625 * yoff + 0.1875 * zoff) +
+      press_NWB * (0.421875 + 0.5625 * xoff - 0.5625 * yoff + 0.5625 * zoff);
+}
+//////////////////////////////////////////////////////////////////////////
+//Position NWT -0.25, 0.25, 0.25
+LBMReal IncompressibleOffsetInterpolationProcessor::calcPressTNW()
+{
+   return   press_NWT * (0.421875 + 0.5625 * xoff - 0.5625 * yoff - 0.5625 * zoff) +
+      press_NET * (0.140625 - 0.5625 * xoff - 0.1875 * yoff - 0.1875 * zoff) +
+      press_SWT * (0.140625 + 0.1875 * xoff + 0.5625 * yoff - 0.1875 * zoff) +
+      press_SET * (0.046875 - 0.1875 * xoff + 0.1875 * yoff - 0.0625 * zoff) +
+      press_SEB * (0.015625 - 0.0625 * xoff + 0.0625 * yoff + 0.0625 * zoff) +
+      press_NEB * (0.046875 - 0.1875 * xoff - 0.0625 * yoff + 0.1875 * zoff) +
+      press_SWB * (0.046875 + 0.0625 * xoff + 0.1875 * yoff + 0.1875 * zoff) +
+      press_NWB * (0.140625 + 0.1875 * xoff - 0.1875 * yoff + 0.5625 * zoff);
+}
+//////////////////////////////////////////////////////////////////////////
+//Position NET 0.25, 0.25, 0.25
+LBMReal IncompressibleOffsetInterpolationProcessor::calcPressTNE()
+{
+   return   press_NET * (0.421875 - 0.5625 * xoff - 0.5625 * yoff - 0.5625 * zoff) +
+      press_NWT * (0.140625 + 0.5625 * xoff - 0.1875 * yoff - 0.1875 * zoff) +
+      press_SET * (0.140625 - 0.1875 * xoff + 0.5625 * yoff - 0.1875 * zoff) +
+      press_SWT * (0.046875 + 0.1875 * xoff + 0.1875 * yoff - 0.0625 * zoff) +
+      press_SWB * (0.015625 + 0.0625 * xoff + 0.0625 * yoff + 0.0625 * zoff) +
+      press_NWB * (0.046875 + 0.1875 * xoff - 0.0625 * yoff + 0.1875 * zoff) +
+      press_SEB * (0.046875 - 0.0625 * xoff + 0.1875 * yoff + 0.1875 * zoff) +
+      press_NEB * (0.140625 - 0.1875 * xoff - 0.1875 * yoff + 0.5625 * zoff);
+}
+//////////////////////////////////////////////////////////////////////////
+//Position NEB 0.25, 0.25, -0.25
+LBMReal IncompressibleOffsetInterpolationProcessor::calcPressBNE()
+{
+   return   press_NET * (0.140625 - 0.1875 * xoff - 0.1875 * yoff - 0.5625 * zoff) +
+      press_NWT * (0.046875 + 0.1875 * xoff - 0.0625 * yoff - 0.1875 * zoff) +
+      press_SET * (0.046875 - 0.0625 * xoff + 0.1875 * yoff - 0.1875 * zoff) +
+      press_SWT * (0.015625 + 0.0625 * xoff + 0.0625 * yoff - 0.0625 * zoff) +
+      press_SWB * (0.046875 + 0.1875 * xoff + 0.1875 * yoff + 0.0625 * zoff) +
+      press_NWB * (0.140625 + 0.5625 * xoff - 0.1875 * yoff + 0.1875 * zoff) +
+      press_SEB * (0.140625 - 0.1875 * xoff + 0.5625 * yoff + 0.1875 * zoff) +
+      press_NEB * (0.421875 - 0.5625 * xoff - 0.5625 * yoff + 0.5625 * zoff);
+}
+//////////////////////////////////////////////////////////////////////////
+//Position C 0.0, 0.0, 0.0
+void IncompressibleOffsetInterpolationProcessor::calcInterpolatedNodeFC(LBMReal* f, LBMReal omega)
+{
+   using namespace D3Q27System;
+
+   LBMReal press  =  press_NET * (0.125 - 0.25 * xoff - 0.25 * yoff - 0.25 * zoff) +
+      press_NWT * (0.125 + 0.25 * xoff - 0.25 * yoff - 0.25 * zoff) +
+      press_SET * (0.125 - 0.25 * xoff + 0.25 * yoff - 0.25 * zoff) +
+      press_SWT * (0.125 + 0.25 * xoff + 0.25 * yoff - 0.25 * zoff) +
+      press_NEB * (0.125 - 0.25 * xoff - 0.25 * yoff + 0.25 * zoff) +
+      press_NWB * (0.125 + 0.25 * xoff - 0.25 * yoff + 0.25 * zoff) +
+      press_SEB * (0.125 - 0.25 * xoff + 0.25 * yoff + 0.25 * zoff) +
+      press_SWB * (0.125 + 0.25 * xoff + 0.25 * yoff + 0.25 * zoff);
+   LBMReal vx1  = a0;
+   LBMReal vx2  = b0;
+   LBMReal vx3  = c0;
+
+   LBMReal rho = press ;//+ (ax+by+cz)/3.;
+
+   //////////////////////////////////////////////////////////////////////////
+   //DRAFT
+   //vx1 -= forcingC*0.5;
+   //////////////////////////////////////////////////////////////////////////
+
+   LBMReal feq[ENDF+1];
+   D3Q27System::calcIncompFeq(feq,rho,vx1,vx2,vx3);
+
+   LBMReal eps_new = 2.;
+   LBMReal o  = omega;
+   LBMReal op = 1.;
+
+   //f_E    = eps_new *((5.*ax*o + 5.*by*o + 5.*cz*o - 8.*ax*op + 4.*by*op + 4.*cz*op)/(54.*o*op));
+   //f_N    = f_E + eps_new *((2.*(ax - by))/(9.*o));
+   //f_T    = f_E + eps_new *((2.*(ax - cz))/(9.*o));
+   //f_NE   = eps_new *(-(5.*cz*o + 3.*(ay + bx)*op - 2.*cz*op + ax*(5.*o + op) + by*(5.*o + op))/(54.*o*op));
+   //f_SE   = f_NE + eps_new *((  ay + bx )/(9.*o));
+   //f_TE   = eps_new *(-(5.*cz*o + by*(5.*o - 2.*op) + 3.*(az + cx)*op + cz*op + ax*(5.*o + op))/(54.*o*op));
+   //f_BE   = f_TE + eps_new *((  az + cx )/(9.*o));
+   //f_TN   = eps_new *(-(5.*ax*o + 5.*by*o + 5.*cz*o - 2.*ax*op + by*op + 3.*bz*op + 3.*cy*op + cz*op)/(54.*o*op));
+   //f_BN   = f_TN + eps_new *((  bz + cy )/(9.*o));
+   //f_ZERO = eps_new *((5.*(ax + by + cz))/(9.*op));
+   //f_TNE  = eps_new *(-(ay + az + bx + bz + cx + cy)/(72.*o));
+   //f_TSW  = - eps_new *((ay + bx)/(36.*o)) - f_TNE;
+   //f_TSE  = - eps_new *((az + cx)/(36.*o)) - f_TNE;
+   //f_TNW  = - eps_new *((bz + cy)/(36.*o)) - f_TNE;
+
+   f_E = eps_new*((2*(-2*ax + by + cz-kxxMzzAverage-kxxMyyAverage))/(27.*o));
+   f_N = eps_new*((2*(ax - 2*by + cz+2*kxxMyyAverage-kxxMzzAverage))/(27.*o));
+   f_T = eps_new*((2*(ax + by - 2*cz-kxxMyyAverage+2*kxxMzzAverage))/(27.*o));
+   f_NE = eps_new*(-(ax + 3*ay + 3*bx + by - 2*cz+2*kxxMyyAverage-kxxMyyAverage+3*kxyAverage)/(54.*o));
+   f_SE = eps_new*(-(ax - 3*ay - 3*bx + by - 2*cz+2*kxxMyyAverage-kxxMyyAverage-3*kxyAverage)/(54.*o));
+   f_TE = eps_new*(-(ax + 3*az - 2*by + 3*cx + cz+2*kxxMyyAverage-kxxMzzAverage+3*kxzAverage)/(54.*o));
+   f_BE = eps_new*(-(ax - 3*az - 2*by - 3*cx + cz+2*kxxMyyAverage-kxxMzzAverage-3*kxzAverage)/(54.*o));
+   f_TN = eps_new*(-(-2*ax + by + 3*bz + 3*cy + cz-kxxMyyAverage-kxxMzzAverage+3*kyzAverage)/(54.*o));
+   f_BN = eps_new*(-(-2*ax + by - 3*bz - 3*cy + cz-kxxMyyAverage-kxxMzzAverage-3*kyzAverage)/(54.*o));
+   f_ZERO = 0.;
+   f_TNE = eps_new*(-(ay + az + bx + bz + cx + cy+kxyAverage+kxzAverage+kyzAverage)/(72.*o));
+   f_TSW = eps_new*((-ay + az - bx + bz + cx + cy-kxyAverage+kxzAverage+kyzAverage)/(72.*o));
+   f_TSE = eps_new*((ay - az + bx + bz - cx + cy+kxyAverage-kxzAverage+kyzAverage)/(72.*o));
+   f_TNW = eps_new*((ay + az + bx - bz + cx - cy+kxyAverage+kxzAverage-kyzAverage)/(72.*o));
+
+   f[E]    = f_E    + feq[E];
+   f[W]    = f_E    + feq[W];
+   f[N]    = f_N    + feq[N];
+   f[S]    = f_N    + feq[S];
+   f[T]    = f_T    + feq[T];
+   f[B]    = f_T    + feq[B];
+   f[NE]   = f_NE   + feq[NE];
+   f[SW]   = f_NE   + feq[SW];
+   f[SE]   = f_SE   + feq[SE];
+   f[NW]   = f_SE   + feq[NW];
+   f[TE]   = f_TE   + feq[TE];
+   f[BW]   = f_TE   + feq[BW];
+   f[BE]   = f_BE   + feq[BE];
+   f[TW]   = f_BE   + feq[TW];
+   f[TN]   = f_TN   + feq[TN];
+   f[BS]   = f_TN   + feq[BS];
+   f[BN]   = f_BN   + feq[BN];
+   f[TS]   = f_BN   + feq[TS];
+   f[TNE]  = f_TNE  + feq[TNE];
+   f[TNW]  = f_TNW  + feq[TNW];
+   f[TSE]  = f_TSE  + feq[TSE];
+   f[TSW]  = f_TSW  + feq[TSW];
+   f[BNE]  = f_TSW  + feq[BNE];
+   f[BNW]  = f_TSE  + feq[BNW];
+   f[BSE]  = f_TNW  + feq[BSE];
+   f[BSW]  = f_TNE  + feq[BSW];
+   f[ZERO] = f_ZERO + feq[ZERO];
+}
+//////////////////////////////////////////////////////////////////////////
+void IncompressibleOffsetInterpolationProcessor::calcInterpolatedVelocity(LBMReal x, LBMReal y, LBMReal z, LBMReal& vx1, LBMReal& vx2, LBMReal& vx3)
+{
+	vx1  = a0 + ax*x + ay*y + az*z + axx*x*x + ayy*y*y + azz*z*z + axy*x*y + axz*x*z + ayz*y*z+axyz*x*y*z;
+	vx2  = b0 + bx*x + by*y + bz*z + bxx*x*x + byy*y*y + bzz*z*z + bxy*x*y + bxz*x*z + byz*y*z+bxyz*x*y*z;
+	vx3  = c0 + cx*x + cy*y + cz*z + cxx*x*x + cyy*y*y + czz*z*z + cxy*x*y + cxz*x*z + cyz*y*z+cxyz*x*y*z;
+}
+//////////////////////////////////////////////////////////////////////////
+void IncompressibleOffsetInterpolationProcessor::calcInterpolatedShearStress(LBMReal x, LBMReal y, LBMReal z,LBMReal& tauxx, LBMReal& tauyy, LBMReal& tauzz,LBMReal& tauxy, LBMReal& tauxz, LBMReal& tauyz)
+{
+	tauxx=ax+2*axx*x+axy*y+axz*z+axyz*y*z;
+	tauyy=by+2*byy*y+bxy*x+byz*z+bxyz*x*z;
+	tauzz=cz+2*czz*z+cxz*x+cyz*y+cxyz*x*y;
+	tauxy=0.5*((ay+2.0*ayy*y+axy*x+ayz*z+axyz*x*z)+(bx+2.0*bxx*x+bxy*y+bxz*z+bxyz*y*z));
+	tauxz=0.5*((az+2.0*azz*z+axz*x+ayz*y+axyz*x*y)+(cx+2.0*cxx*x+cxy*y+cxz*z+cxyz*y*z));
+	tauyz=0.5*((bz+2.0*bzz*z+bxz*x+byz*y+bxyz*x*y)+(cy+2.0*cyy*y+cxy*x+cyz*z+cxyz*x*z));
+}
diff --git a/src/cpu/VirtualFluidsCore/LBM/IncompressibleOffsetInterpolationProcessor.h b/src/cpu/VirtualFluidsCore/LBM/IncompressibleOffsetInterpolationProcessor.h
index 021eb2d6682342f52d83ef26d5248a6fa3122267..411be2d38c9cc3bb7e98dcdb9c11a7cfaa7b3121 100644
--- a/src/cpu/VirtualFluidsCore/LBM/IncompressibleOffsetInterpolationProcessor.h
+++ b/src/cpu/VirtualFluidsCore/LBM/IncompressibleOffsetInterpolationProcessor.h
@@ -1,77 +1,77 @@
-#ifndef IncompressibleOffsetInterpolationProcessor_H_
-#define IncompressibleOffsetInterpolationProcessor_H_
-
-#include "InterpolationProcessor.h"
-#include "D3Q27System.h"
-
-//////////////////////////////////////////////////////////////////////////
-//it works only for cascaded LBM
-//super compact interpolation method by Martin Geier
-//////////////////////////////////////////////////////////////////////////
-
-class IncompressibleOffsetInterpolationProcessor;
-typedef SPtr<IncompressibleOffsetInterpolationProcessor> D3Q27IncompressibleOffsetInterpolationProcessorPtr;
-
-class IncompressibleOffsetInterpolationProcessor : public InterpolationProcessor
-{
-public:
-   IncompressibleOffsetInterpolationProcessor();
-   IncompressibleOffsetInterpolationProcessor(LBMReal omegaC, LBMReal omegaF);
-   virtual ~IncompressibleOffsetInterpolationProcessor();
-   InterpolationProcessorPtr clone();
-   void setOmegas(LBMReal omegaC, LBMReal omegaF);
-   void interpolateCoarseToFine(D3Q27ICell& icellC, D3Q27ICell& icellF);
-   void interpolateCoarseToFine(D3Q27ICell& icellC, D3Q27ICell& icellF, LBMReal xoff, LBMReal yoff, LBMReal zoff);
-   void interpolateFineToCoarse(D3Q27ICell& icellF, LBMReal* icellC); 
-   void interpolateFineToCoarse(D3Q27ICell& icellF, LBMReal* icellC, LBMReal xoff, LBMReal yoff, LBMReal zoff); 
-   //LBMReal forcingC, forcingF;
-protected:   
-private:
-   LBMReal omegaC, omegaF;
-   LBMReal a0, ax, ay, az, axx, ayy, azz, axy, axz, ayz, b0, bx, by, bz, bxx, byy, bzz, bxy, bxz, byz, c0, cx, cy, cz, cxx, cyy, czz, cxy, cxz, cyz, axyz, bxyz, cxyz;
-   LBMReal xoff,    yoff,    zoff;
-   LBMReal xoff_sq, yoff_sq, zoff_sq;
-   LBMReal press_SWT, press_NWT, press_NET, press_SET, press_SWB, press_NWB, press_NEB, press_SEB;
-
-   LBMReal  f_E,  f_N,  f_T,  f_NE,  f_SE,  f_BE,  f_TE,  f_TN,  f_BN,  f_TNE,  f_TNW,  f_TSE,  f_TSW,  f_ZERO;
-   LBMReal  x_E,  x_N,  x_T,  x_NE,  x_SE,  x_BE,  x_TE,  x_TN,  x_BN,  x_TNE,  x_TNW,  x_TSE,  x_TSW,  x_ZERO;
-   LBMReal  y_E,  y_N,  y_T,  y_NE,  y_SE,  y_BE,  y_TE,  y_TN,  y_BN,  y_TNE,  y_TNW,  y_TSE,  y_TSW,  y_ZERO;
-   LBMReal  z_E,  z_N,  z_T,  z_NE,  z_SE,  z_BE,  z_TE,  z_TN,  z_BN,  z_TNE,  z_TNW,  z_TSE,  z_TSW,  z_ZERO;
-   LBMReal xy_E, xy_N, xy_T, xy_NE, xy_SE, xy_BE, xy_TE, xy_TN, xy_BN, xy_TNE, xy_TNW, xy_TSE, xy_TSW/*, xy_ZERO*/;
-   LBMReal xz_E, xz_N, xz_T, xz_NE, xz_SE, xz_BE, xz_TE, xz_TN, xz_BN, xz_TNE, xz_TNW, xz_TSE, xz_TSW/*, xz_ZERO*/;
-   LBMReal yz_E, yz_N, yz_T, yz_NE, yz_SE, yz_BE, yz_TE, yz_TN, yz_BN, yz_TNE, yz_TNW, yz_TSE, yz_TSW/*, yz_ZERO*/;
-
-   LBMReal kxyAverage, kyzAverage, kxzAverage, kxxMyyAverage, kxxMzzAverage; 
-
-   LBMReal a,b,c;
-
-   void setOffsets(LBMReal xoff, LBMReal yoff, LBMReal zoff);
-   void calcMoments(const LBMReal* const f, LBMReal omega, LBMReal& rho, LBMReal& vx1, LBMReal& vx2, LBMReal& vx3, 
-      LBMReal& kxy, LBMReal& kyz, LBMReal& kxz, LBMReal& kxxMyy, LBMReal& kxxMzz);
-   void calcInterpolatedCoefficiets(const D3Q27ICell& icell, LBMReal omega, LBMReal eps_new);
-   void calcInterpolatedNode(LBMReal* f, LBMReal omega, LBMReal x, LBMReal y, LBMReal z, LBMReal press, LBMReal xs, LBMReal ys, LBMReal zs);
-   LBMReal calcPressBSW();
-   LBMReal calcPressTSW();
-   LBMReal calcPressTSE();
-   LBMReal calcPressBSE();
-   LBMReal calcPressBNW();
-   LBMReal calcPressTNW();
-   LBMReal calcPressTNE();
-   LBMReal calcPressBNE();
-   void calcInterpolatedNodeFC(LBMReal* f, LBMReal omega);
-   void calcInterpolatedVelocity(LBMReal x, LBMReal y, LBMReal z,LBMReal& vx1, LBMReal& vx2, LBMReal& vx3);
-   void calcInterpolatedShearStress(LBMReal x, LBMReal y, LBMReal z,LBMReal& tauxx, LBMReal& tauyy, LBMReal& tauzz,LBMReal& tauxy, LBMReal& tauxz, LBMReal& tauyz);
-};
-
-//////////////////////////////////////////////////////////////////////////
-inline void IncompressibleOffsetInterpolationProcessor::interpolateCoarseToFine(D3Q27ICell& icellC, D3Q27ICell& icellF)
-{
-   this->interpolateCoarseToFine(icellC, icellF, 0.0, 0.0, 0.0);
-}
-//////////////////////////////////////////////////////////////////////////
-inline void IncompressibleOffsetInterpolationProcessor::interpolateFineToCoarse(D3Q27ICell& icellF, LBMReal* icellC)
-{
-   this->interpolateFineToCoarse(icellF, icellC, 0.0, 0.0, 0.0);
-}
-
-#endif
+#ifndef IncompressibleOffsetInterpolationProcessor_H_
+#define IncompressibleOffsetInterpolationProcessor_H_
+
+#include "InterpolationProcessor.h"
+#include "D3Q27System.h"
+
+//////////////////////////////////////////////////////////////////////////
+//it works only for cascaded LBM
+//super compact interpolation method by Martin Geier
+//////////////////////////////////////////////////////////////////////////
+
+class IncompressibleOffsetInterpolationProcessor;
+typedef SPtr<IncompressibleOffsetInterpolationProcessor> D3Q27IncompressibleOffsetInterpolationProcessorPtr;
+
+class IncompressibleOffsetInterpolationProcessor : public InterpolationProcessor
+{
+public:
+   IncompressibleOffsetInterpolationProcessor();
+   IncompressibleOffsetInterpolationProcessor(LBMReal omegaC, LBMReal omegaF);
+   virtual ~IncompressibleOffsetInterpolationProcessor();
+   InterpolationProcessorPtr clone();
+   void setOmegas(LBMReal omegaC, LBMReal omegaF);
+   void interpolateCoarseToFine(D3Q27ICell& icellC, D3Q27ICell& icellF);
+   void interpolateCoarseToFine(D3Q27ICell& icellC, D3Q27ICell& icellF, LBMReal xoff, LBMReal yoff, LBMReal zoff);
+   void interpolateFineToCoarse(D3Q27ICell& icellF, LBMReal* icellC); 
+   void interpolateFineToCoarse(D3Q27ICell& icellF, LBMReal* icellC, LBMReal xoff, LBMReal yoff, LBMReal zoff); 
+   //LBMReal forcingC, forcingF;
+protected:   
+private:
+   LBMReal omegaC, omegaF;
+   LBMReal a0, ax, ay, az, axx, ayy, azz, axy, axz, ayz, b0, bx, by, bz, bxx, byy, bzz, bxy, bxz, byz, c0, cx, cy, cz, cxx, cyy, czz, cxy, cxz, cyz, axyz, bxyz, cxyz;
+   LBMReal xoff,    yoff,    zoff;
+   LBMReal xoff_sq, yoff_sq, zoff_sq;
+   LBMReal press_SWT, press_NWT, press_NET, press_SET, press_SWB, press_NWB, press_NEB, press_SEB;
+
+   LBMReal  f_E,  f_N,  f_T,  f_NE,  f_SE,  f_BE,  f_TE,  f_TN,  f_BN,  f_TNE,  f_TNW,  f_TSE,  f_TSW,  f_ZERO;
+   LBMReal  x_E,  x_N,  x_T,  x_NE,  x_SE,  x_BE,  x_TE,  x_TN,  x_BN,  x_TNE,  x_TNW,  x_TSE,  x_TSW,  x_ZERO;
+   LBMReal  y_E,  y_N,  y_T,  y_NE,  y_SE,  y_BE,  y_TE,  y_TN,  y_BN,  y_TNE,  y_TNW,  y_TSE,  y_TSW,  y_ZERO;
+   LBMReal  z_E,  z_N,  z_T,  z_NE,  z_SE,  z_BE,  z_TE,  z_TN,  z_BN,  z_TNE,  z_TNW,  z_TSE,  z_TSW,  z_ZERO;
+   LBMReal xy_E, xy_N, xy_T, xy_NE, xy_SE, xy_BE, xy_TE, xy_TN, xy_BN, xy_TNE, xy_TNW, xy_TSE, xy_TSW/*, xy_ZERO*/;
+   LBMReal xz_E, xz_N, xz_T, xz_NE, xz_SE, xz_BE, xz_TE, xz_TN, xz_BN, xz_TNE, xz_TNW, xz_TSE, xz_TSW/*, xz_ZERO*/;
+   LBMReal yz_E, yz_N, yz_T, yz_NE, yz_SE, yz_BE, yz_TE, yz_TN, yz_BN, yz_TNE, yz_TNW, yz_TSE, yz_TSW/*, yz_ZERO*/;
+
+   LBMReal kxyAverage, kyzAverage, kxzAverage, kxxMyyAverage, kxxMzzAverage; 
+
+   LBMReal a,b,c;
+
+   void setOffsets(LBMReal xoff, LBMReal yoff, LBMReal zoff);
+   void calcMoments(const LBMReal* const f, LBMReal omega, LBMReal& rho, LBMReal& vx1, LBMReal& vx2, LBMReal& vx3, 
+      LBMReal& kxy, LBMReal& kyz, LBMReal& kxz, LBMReal& kxxMyy, LBMReal& kxxMzz);
+   void calcInterpolatedCoefficiets(const D3Q27ICell& icell, LBMReal omega, LBMReal eps_new);
+   void calcInterpolatedNode(LBMReal* f, LBMReal omega, LBMReal x, LBMReal y, LBMReal z, LBMReal press, LBMReal xs, LBMReal ys, LBMReal zs);
+   LBMReal calcPressBSW();
+   LBMReal calcPressTSW();
+   LBMReal calcPressTSE();
+   LBMReal calcPressBSE();
+   LBMReal calcPressBNW();
+   LBMReal calcPressTNW();
+   LBMReal calcPressTNE();
+   LBMReal calcPressBNE();
+   void calcInterpolatedNodeFC(LBMReal* f, LBMReal omega);
+   void calcInterpolatedVelocity(LBMReal x, LBMReal y, LBMReal z,LBMReal& vx1, LBMReal& vx2, LBMReal& vx3);
+   void calcInterpolatedShearStress(LBMReal x, LBMReal y, LBMReal z,LBMReal& tauxx, LBMReal& tauyy, LBMReal& tauzz,LBMReal& tauxy, LBMReal& tauxz, LBMReal& tauyz);
+};
+
+//////////////////////////////////////////////////////////////////////////
+inline void IncompressibleOffsetInterpolationProcessor::interpolateCoarseToFine(D3Q27ICell& icellC, D3Q27ICell& icellF)
+{
+   this->interpolateCoarseToFine(icellC, icellF, 0.0, 0.0, 0.0);
+}
+//////////////////////////////////////////////////////////////////////////
+inline void IncompressibleOffsetInterpolationProcessor::interpolateFineToCoarse(D3Q27ICell& icellF, LBMReal* icellC)
+{
+   this->interpolateFineToCoarse(icellF, icellC, 0.0, 0.0, 0.0);
+}
+
+#endif
diff --git a/src/cpu/VirtualFluidsCore/LBM/InterpolationHelper.cpp b/src/cpu/VirtualFluidsCore/LBM/InterpolationHelper.cpp
index 2b4176b53161022258fe6e4fe37c7b40d1c307b8..7a58d0dee4c76f627f57ea68acfdcddf92e35e5e 100644
--- a/src/cpu/VirtualFluidsCore/LBM/InterpolationHelper.cpp
+++ b/src/cpu/VirtualFluidsCore/LBM/InterpolationHelper.cpp
@@ -1,39 +1,39 @@
-#include "InterpolationHelper.h"
-
-
-
-InterpolationHelper::InterpolationHelper(InterpolationProcessorPtr iProcessor) : iProcessor(iProcessor)
-{
-
-}
-//////////////////////////////////////////////////////////////////////////
-InterpolationHelper::~InterpolationHelper()
-{
-
-}
-//////////////////////////////////////////////////////////////////////////
-void InterpolationHelper::interpolate8to1( D3Q27ICell& icellF, LBMReal* icellC, double x1, double x2, double x3, LBMReal omega )
-{
-   iProcessor->calcInterpolatedCoefficiets(icellF, omega, 1.0);
-   iProcessor->calcInterpolatedNodeFC(icellC, omega);
-}
-//////////////////////////////////////////////////////////////////////////
-void InterpolationHelper::interpolate8to1WithVelocity( D3Q27ICell& icellF, double x1, double x2, double x3, LBMReal omega, LBMReal &vx1, LBMReal &vx2, LBMReal &vx3 )
-{
-   iProcessor->setOffsets(0.0, 0.0, 0.0);
-   iProcessor->calcInterpolatedCoefficiets(icellF, omega, 0.0);	
-   iProcessor->calcInterpolatedVelocity(x1, x2, x3, vx1, vx2, vx3);	
-}
-//////////////////////////////////////////////////////////////////////////
-void InterpolationHelper::interpolate8to1WithVelocityWithShearStress( D3Q27ICell& icellF, double x1, double x2, double x3, LBMReal omega, 
-                                                                    LBMReal &vx1, LBMReal &vx2, LBMReal &vx3, 
-                                                                    LBMReal &tauxx, LBMReal &tauyy, LBMReal &tauzz,LBMReal &tauxy, LBMReal &tauxz, LBMReal &tauyz )
-{
-   iProcessor->setOffsets(0.0, 0.0, 0.0);
-   iProcessor->calcInterpolatedCoefficiets(icellF, omega, 0.0);	
-   iProcessor->calcInterpolatedVelocity(x1, x2, x3, vx1, vx2, vx3);	
-   iProcessor->calcInterpolatedShearStress(x1,x2,x3,tauxx,tauyy,tauzz,tauxy,tauxz,tauyz);
-}
-
-//////////////////////////////////////////////////////////////////////////
-
+#include "InterpolationHelper.h"
+
+
+
+InterpolationHelper::InterpolationHelper(InterpolationProcessorPtr iProcessor) : iProcessor(iProcessor)
+{
+
+}
+//////////////////////////////////////////////////////////////////////////
+InterpolationHelper::~InterpolationHelper()
+{
+
+}
+//////////////////////////////////////////////////////////////////////////
+void InterpolationHelper::interpolate8to1( D3Q27ICell& icellF, LBMReal* icellC, double x1, double x2, double x3, LBMReal omega )
+{
+   iProcessor->calcInterpolatedCoefficiets(icellF, omega, 1.0);
+   iProcessor->calcInterpolatedNodeFC(icellC, omega);
+}
+//////////////////////////////////////////////////////////////////////////
+void InterpolationHelper::interpolate8to1WithVelocity( D3Q27ICell& icellF, double x1, double x2, double x3, LBMReal omega, LBMReal &vx1, LBMReal &vx2, LBMReal &vx3 )
+{
+   iProcessor->setOffsets(0.0, 0.0, 0.0);
+   iProcessor->calcInterpolatedCoefficiets(icellF, omega, 0.0);	
+   iProcessor->calcInterpolatedVelocity(x1, x2, x3, vx1, vx2, vx3);	
+}
+//////////////////////////////////////////////////////////////////////////
+void InterpolationHelper::interpolate8to1WithVelocityWithShearStress( D3Q27ICell& icellF, double x1, double x2, double x3, LBMReal omega, 
+                                                                    LBMReal &vx1, LBMReal &vx2, LBMReal &vx3, 
+                                                                    LBMReal &tauxx, LBMReal &tauyy, LBMReal &tauzz,LBMReal &tauxy, LBMReal &tauxz, LBMReal &tauyz )
+{
+   iProcessor->setOffsets(0.0, 0.0, 0.0);
+   iProcessor->calcInterpolatedCoefficiets(icellF, omega, 0.0);	
+   iProcessor->calcInterpolatedVelocity(x1, x2, x3, vx1, vx2, vx3);	
+   iProcessor->calcInterpolatedShearStress(x1,x2,x3,tauxx,tauyy,tauzz,tauxy,tauxz,tauyz);
+}
+
+//////////////////////////////////////////////////////////////////////////
+
diff --git a/src/cpu/VirtualFluidsCore/LBM/InterpolationHelper.h b/src/cpu/VirtualFluidsCore/LBM/InterpolationHelper.h
index 06b9d1943c68c9f45afecc0747e6d0a298f054d4..c6e95803f8938188892938f335f3896a647e3789 100644
--- a/src/cpu/VirtualFluidsCore/LBM/InterpolationHelper.h
+++ b/src/cpu/VirtualFluidsCore/LBM/InterpolationHelper.h
@@ -1,25 +1,25 @@
-#ifndef D3Q27InterpolationHelper_H_
-#define D3Q27InterpolationHelper_H_
-
-#include "InterpolationProcessor.h"
-
-class InterpolationHelper;
-typedef SPtr<InterpolationHelper> InterpolationHelperPtr;
-
-class InterpolationHelper
-{
-public:
-   InterpolationHelper(InterpolationProcessorPtr iProcessor);
-   ~InterpolationHelper();
-   void interpolate8to1(D3Q27ICell& icellF, LBMReal* icellC, double x1, double x2, double x3, LBMReal omega);
-   void interpolate8to1WithVelocity(D3Q27ICell& icellF, double x1, double x2, double x3, LBMReal omega, LBMReal &vx1, LBMReal &vx2, LBMReal &vx3);
-   void interpolate8to1WithVelocityWithShearStress(D3Q27ICell& icellF, double x1, double x2, double x3, LBMReal omega, 
-                                             LBMReal &vx1, LBMReal &vx2, LBMReal &vx3, 
-                                             LBMReal &tauxx, LBMReal &tauyy, LBMReal &tauzz,LBMReal &tauxy, LBMReal &tauxz, LBMReal &tauyz);
-protected:
-private:
-   InterpolationProcessorPtr iProcessor;
-};
-
-#endif
-
+#ifndef D3Q27InterpolationHelper_H_
+#define D3Q27InterpolationHelper_H_
+
+#include "InterpolationProcessor.h"
+
+class InterpolationHelper;
+typedef SPtr<InterpolationHelper> InterpolationHelperPtr;
+
+class InterpolationHelper
+{
+public:
+   InterpolationHelper(InterpolationProcessorPtr iProcessor);
+   ~InterpolationHelper();
+   void interpolate8to1(D3Q27ICell& icellF, LBMReal* icellC, double x1, double x2, double x3, LBMReal omega);
+   void interpolate8to1WithVelocity(D3Q27ICell& icellF, double x1, double x2, double x3, LBMReal omega, LBMReal &vx1, LBMReal &vx2, LBMReal &vx3);
+   void interpolate8to1WithVelocityWithShearStress(D3Q27ICell& icellF, double x1, double x2, double x3, LBMReal omega, 
+                                             LBMReal &vx1, LBMReal &vx2, LBMReal &vx3, 
+                                             LBMReal &tauxx, LBMReal &tauyy, LBMReal &tauzz,LBMReal &tauxy, LBMReal &tauxz, LBMReal &tauyz);
+protected:
+private:
+   InterpolationProcessorPtr iProcessor;
+};
+
+#endif
+
diff --git a/src/cpu/VirtualFluidsCore/LBM/InterpolationProcessor.cpp b/src/cpu/VirtualFluidsCore/LBM/InterpolationProcessor.cpp
index 226775febbbc230ab079b36d6aea15b07f47b43f..4b8b746b720a494889c529682bc3ea02459e8649 100644
--- a/src/cpu/VirtualFluidsCore/LBM/InterpolationProcessor.cpp
+++ b/src/cpu/VirtualFluidsCore/LBM/InterpolationProcessor.cpp
@@ -1,313 +1,313 @@
-#include "InterpolationProcessor.h"
-
-
-//////////////////////////////////////////////////////////////////////////
-InterpolationProcessor::InterpolationProcessor()
-{
-
-}
-//////////////////////////////////////////////////////////////////////////
-InterpolationProcessor::~InterpolationProcessor()
-{
-
-}
-//////////////////////////////////////////////////////////////////////////
-void InterpolationProcessor::readICell(SPtr<DistributionArray3D> f, D3Q27ICell& icell, int x1, int x2, int x3) 
-{
-   f->getDistribution(icell.BSW, x1, x2, x3);
-   f->getDistribution(icell.BSE, x1+1, x2, x3);
-   f->getDistribution(icell.BNW, x1, x2+1, x3);
-   f->getDistribution(icell.BNE, x1+1, x2+1, x3);
-   f->getDistribution(icell.TSW, x1, x2, x3+1);
-   f->getDistribution(icell.TSE, x1+1, x2, x3+1);
-   f->getDistribution(icell.TNW, x1, x2+1, x3+1);
-   f->getDistribution(icell.TNE, x1+1, x2+1, x3+1);
-}
-//////////////////////////////////////////////////////////////////////////
-void InterpolationProcessor::writeICell(SPtr<DistributionArray3D> f, const D3Q27ICell& icell, int x1, int x2, int x3)
-{
-   f->setDistribution(icell.BSW, x1, x2, x3);
-   f->setDistribution(icell.BSE, x1+1, x2, x3);
-   f->setDistribution(icell.BNW, x1, x2+1, x3);
-   f->setDistribution(icell.BNE, x1+1, x2+1, x3);
-   f->setDistribution(icell.TSW, x1, x2, x3+1);
-   f->setDistribution(icell.TSE, x1+1, x2, x3+1);
-   f->setDistribution(icell.TNW, x1, x2+1, x3+1);
-   f->setDistribution(icell.TNE, x1+1, x2+1, x3+1);
-}
-//////////////////////////////////////////////////////////////////////////
-void InterpolationProcessor::writeICellInv(SPtr<DistributionArray3D> f, const D3Q27ICell& icell, int x1, int x2, int x3) 
-{
-   f->setDistributionInv(icell.BSW, x1, x2, x3);
-   f->setDistributionInv(icell.BSE, x1+1, x2, x3);
-   f->setDistributionInv(icell.BNW, x1, x2+1, x3);
-   f->setDistributionInv(icell.BNE, x1+1, x2+1, x3);
-   f->setDistributionInv(icell.TSW, x1, x2, x3+1);
-   f->setDistributionInv(icell.TSE, x1+1, x2, x3+1);
-   f->setDistributionInv(icell.TNW, x1, x2+1, x3+1);
-   f->setDistributionInv(icell.TNE, x1+1, x2+1, x3+1);
-}
-//////////////////////////////////////////////////////////////////////////
-void InterpolationProcessor::writeINode(SPtr<DistributionArray3D> f, const LBMReal* const inode, int x1, int x2, int x3)
-{
-   f->setDistribution(inode, x1, x2, x3);
-}
-//////////////////////////////////////////////////////////////////////////
-void InterpolationProcessor::writeINodeInv(SPtr<DistributionArray3D> f, const LBMReal* const inode, int x1, int x2, int x3) 
-{
-   f->setDistributionInv(inode, x1, x2, x3);
-}
-//////////////////////////////////////////////////////////////////////////
-bool InterpolationProcessor::iCellHasSolid(const SPtr<BCArray3D> bcArray, int x1, int x2, int x3) 
-{
-   for (int ix3 = x3; ix3 <= x3 + 1; ix3++)
-      for(int ix2 = x2; ix2 <= x2 + 1; ix2++)
-         for(int ix1 = x1; ix1 <= x1 + 1; ix1++)
-         {
-            if(bcArray->isSolid(ix1, ix2, ix3))
-               return true;
-         }
-   return false;  
-}
-//////////////////////////////////////////////////////////////////////////
-bool InterpolationProcessor::findNeighborICell(const SPtr<BCArray3D> bcArray, SPtr<DistributionArray3D> f, 
-                                                    D3Q27ICell& icell, int maxX1, int maxX2, int maxX3, 
-                                                    int x1, int x2, int x3, LBMReal& xoff, LBMReal& yoff, LBMReal& zoff) 
-{
-   m_maxX1 = maxX1;
-   m_maxX2 = maxX2;
-   m_maxX3 = maxX3;
-
-   //GoWest
-   if(inRange(x1-1,x2,x3) && !iCellHasSolid(bcArray, x1-1,x2,x3))
-   {
-      readICell(f,icell,x1-1,x2,x3);
-      xoff = 1;
-      yoff = 0;
-      zoff = 0;
-   }
-   //GoEast
-   else if(inRange(x1+2,x2,x3) && !iCellHasSolid(bcArray, x1+1,x2,x3)) // ist übernächster Knoten auch im Gebiet (Grundknoten bei 0,0,0
-   {
-      readICell(f,icell,x1+1,x2,x3);
-      xoff = -1;
-      yoff = 0;
-      zoff = 0;
-   }
-   //GoSouth
-   else if(inRange(x1,x2-1,x3) && !iCellHasSolid(bcArray, x1,x2-1,x3)) 
-   {
-      readICell(f,icell,x1,x2-1,x3);
-      xoff = 0;
-      yoff = 1;
-      zoff = 0;
-   }
-   //GoNorth
-   else if(inRange(x1,x2+2,x3) && !iCellHasSolid(bcArray, x1,x2+1,x3)) // ist übernächster Knoten auch im Gebiet (Grundknoten bei 0,0,0
-   {
-      readICell(f,icell,x1,x2+1,x3);
-      xoff = 0;
-      yoff = -1;
-      zoff = 0;
-   }
-   //GoBottom
-   else if(inRange(x1,x2,x3-1) && !iCellHasSolid(bcArray, x1,x2,x3-1)) 
-   {
-      readICell(f,icell,x1,x2,x3-1);
-      xoff = 0;
-      yoff = 0;
-      zoff = 1;
-   }
-   //GoTop
-   else if(inRange(x1,x2,x3+2) && !iCellHasSolid(bcArray, x1,x2,x3+1)) // ist übernächster Knoten auch im Gebiet (Grundknoten bei 0,0,0
-   {
-      readICell(f,icell,x1,x2,x3+1);
-      xoff = 0;
-      yoff = 0;
-      zoff = -1;
-   }
-   //GoNW
-   else if(inRange(x1-1,x2+2,x3) && !iCellHasSolid(bcArray, x1-1,x2+1,x3)) // ist übernächster Knoten auch im Gebiet (Grundknoten bei 0,0,0
-   {
-      readICell(f,icell,x1-1,x2+1,x3);
-      xoff = 1;
-      yoff = -1;
-      zoff = 0;
-   }
-   //GoNE
-   else if(inRange(x1+2,x2+2,x3) && !iCellHasSolid(bcArray, x1+1,x2+1,x3)) // ist übernächster Knoten auch im Gebiet (Grundknoten bei 0,0,0
-   {
-      readICell(f,icell,x1+1,x2+1,x3);
-      xoff = -1;
-      yoff = -1;
-      zoff = 0;
-   }
-   //GoSW
-   else if(inRange(x1-1,x2-1,x3) && !iCellHasSolid(bcArray, x1-1,x2-1,x3)) // ist übernächster Knoten auch im Gebiet (Grundknoten bei 0,0,0
-   {
-      readICell(f,icell,x1-1,x2-1,x3);
-      xoff = 1;
-      yoff = 1;
-      zoff = 0;
-   }
-   //GoSE
-   else if(inRange(x1+2,x2-1,x3) && !iCellHasSolid(bcArray, x1+1,x2-1,x3)) // ist übernächster Knoten auch im Gebiet (Grundknoten bei 0,0,0
-   {
-      readICell(f,icell,x1+1,x2-1,x3);
-      xoff = -1;
-      yoff = 1;
-      zoff = 0;
-   }
-   //GoBW
-   else if(inRange(x1-1,x2,x3-1) && !iCellHasSolid(bcArray, x1-1,x2,x3-1))
-   {
-      readICell(f,icell,x1-1,x2,x3-1);
-      xoff = 1;
-      yoff = 0;
-      zoff = 1;
-   }
-   //GoBE
-   else if(inRange(x1+2,x2,x3-1) && !iCellHasSolid(bcArray, x1+1,x2,x3-1)) // ist übernächster Knoten auch im Gebiet (Grundknoten bei 0,0,0
-   {
-      readICell(f,icell,x1+1,x2,x3-1);
-      xoff = -1;
-      yoff = 0;
-      zoff = 1;
-   }
-   //GoBS
-   else if(inRange(x1,x2-1,x3-1) && !iCellHasSolid(bcArray, x1,x2-1,x3-1)) 
-   {
-      readICell(f,icell,x1,x2-1,x3-1);
-      xoff = 0;
-      yoff = 1;
-      zoff = 1;
-   }
-   //GoBN
-   else if(inRange(x1,x2+2,x3-1) && !iCellHasSolid(bcArray, x1,x2+1,x3-1)) // ist übernächster Knoten auch im Gebiet (Grundknoten bei 0,0,0
-   {
-      readICell(f,icell,x1,x2+1,x3-1);
-      xoff = 0;
-      yoff = -1;
-      zoff = 1;
-   }
-   //GoTW
-   else if(inRange(x1-1,x2,x3+2) && !iCellHasSolid(bcArray, x1-1,x2,x3+1))
-   {
-      readICell(f,icell,x1-1,x2,x3+1);
-      xoff = 1;
-      yoff = 0;
-      zoff = -1;
-   }
-   //GoTE
-   else if(inRange(x1+2,x2,x3+2) && !iCellHasSolid(bcArray, x1+1,x2,x3+1)) // ist übernächster Knoten auch im Gebiet (Grundknoten bei 0,0,0
-   {
-      readICell(f,icell,x1+1,x2,x3+1);
-      xoff = -1;
-      yoff = 0;
-      zoff = -1;
-   }
-   //GoTS
-   else if(inRange(x1,x2-1,x3+2) && !iCellHasSolid(bcArray, x1,x2-1,x3+1)) 
-   {
-      readICell(f,icell,x1,x2-1,x3+1);
-      xoff = 0;
-      yoff = 1;
-      zoff = -1;
-   }
-   //GoTN
-   else if(inRange(x1,x2+2,x3+2) && !iCellHasSolid(bcArray, x1,x2+1,x3+1)) // ist übernächster Knoten auch im Gebiet (Grundknoten bei 0,0,0
-   {
-      readICell(f,icell,x1,x2+1,x3+1);
-      xoff = 0;
-      yoff = -1;
-      zoff = -1;
-   }
-   //GoTNW
-   else if(inRange(x1-1,x2+2,x3+2) && !iCellHasSolid(bcArray, x1-1,x2+1,x3+1)) // ist übernächster Knoten auch im Gebiet (Grundknoten bei 0,0,0
-   {
-      readICell(f,icell,x1-1,x2+1,x3+1);
-      xoff = 1;
-      yoff = -1;
-      zoff = -1;
-   }
-   //GoTNE
-   else if(inRange(x1+2,x2+2,x3+2) && !iCellHasSolid(bcArray, x1+1,x2+1,x3+1)) // ist übernächster Knoten auch im Gebiet (Grundknoten bei 0,0,0
-   {
-      readICell(f,icell,x1+1,x2+1,x3+1);
-      xoff = -1;
-      yoff = -1;
-      zoff = -1;
-   }
-   //GoTSE
-   else if(inRange(x1+2,x2-1,x3+2) && !iCellHasSolid(bcArray, x1+1,x2-1,x3+1)) // ist übernächster Knoten auch im Gebiet (Grundknoten bei 0,0,0
-   {
-      readICell(f,icell,x1+1,x2-1,x3+1);
-      xoff = -1;
-      yoff =  1;
-      zoff = -1;
-   }
-   //GoTSW
-   else if(inRange(x1-1,x2-1,x3+2) && !iCellHasSolid(bcArray, x1-1,x2-1,x3+1)) // ist übernächster Knoten auch im Gebiet (Grundknoten bei 0,0,0
-   {
-      readICell(f,icell,x1-1,x2-1,x3+1);
-      xoff =  1;
-      yoff =  1;
-      zoff = -1;
-   }
-   //GoBNW
-   else if(inRange(x1-1,x2+2,x3-1) && !iCellHasSolid(bcArray, x1-1,x2+1,x3-1)) // ist übernächster Knoten auch im Gebiet (Grundknoten bei 0,0,0
-   {
-      readICell(f,icell,x1-1,x2+1,x3-1);
-      xoff =  1;
-      yoff = -1;
-      zoff =  1;
-   }
-   //GoBNE
-   else if(inRange(x1+2,x2+2,x3-1) && !iCellHasSolid(bcArray, x1+1,x2+1,x3-1)) // ist übernächster Knoten auch im Gebiet (Grundknoten bei 0,0,0
-   {
-      readICell(f,icell,x1+1,x2+1,x3-1);
-      xoff = -1;
-      yoff = -1;
-      zoff =  1;
-   }
-   //GoBSE
-   else if(inRange(x1+2,x2-1,x3-1) && !iCellHasSolid(bcArray, x1+1,x2-1,x3-1)) // ist übernächster Knoten auch im Gebiet (Grundknoten bei 0,0,0
-   {
-      readICell(f,icell,x1+1,x2-1,x3-1);
-      xoff = -1;
-      yoff =  1;
-      zoff =  1;
-   }
-   //GoBSW
-   else if(inRange(x1-1,x2-1,x3-1) && !iCellHasSolid(bcArray, x1-1,x2-1,x3-1)) // ist übernächster Knoten auch im Gebiet (Grundknoten bei 0,0,0
-   {
-      readICell(f,icell,x1-1,x2-1,x3-1);
-      xoff =  1;
-      yoff =  1;
-      zoff =  1;
-   }
-   //default
-   else
-   {
-      //std::string err = "For x1="+StringUtil::toString(x1)+", x2=" + StringUtil::toString(x2)+", x3=" + StringUtil::toString(x3)+
-      //                  " interpolation is not implemented for other direction"+
-      //                  " by using in: "+(std::string)typeid(*this).name()+ 
-      //                  " or maybe you have a solid on the block boundary";
-      //UB_THROW(UbException(UB_EXARGS, err));
-      return 0;
-   }
-   return 1;
-}
-//////////////////////////////////////////////////////////////////////////
-int InterpolationProcessor::iCellHowManySolids( const SPtr<BCArray3D> bcArray, int x1, int x2, int x3 )
-{
-   int count = 0;
-   for (int ix3 = x3; ix3 <= x3 + 1; ix3++)
-      for(int ix2 = x2; ix2 <= x2 + 1; ix2++)
-         for(int ix1 = x1; ix1 <= x1 + 1; ix1++)
-         {
-            if(bcArray->isSolid(ix1, ix2, ix3))
-               count++;
-         }
-   return count;  
-}
+#include "InterpolationProcessor.h"
+
+
+//////////////////////////////////////////////////////////////////////////
+InterpolationProcessor::InterpolationProcessor()
+{
+
+}
+//////////////////////////////////////////////////////////////////////////
+InterpolationProcessor::~InterpolationProcessor()
+{
+
+}
+//////////////////////////////////////////////////////////////////////////
+void InterpolationProcessor::readICell(SPtr<DistributionArray3D> f, D3Q27ICell& icell, int x1, int x2, int x3) 
+{
+   f->getDistribution(icell.BSW, x1, x2, x3);
+   f->getDistribution(icell.BSE, x1+1, x2, x3);
+   f->getDistribution(icell.BNW, x1, x2+1, x3);
+   f->getDistribution(icell.BNE, x1+1, x2+1, x3);
+   f->getDistribution(icell.TSW, x1, x2, x3+1);
+   f->getDistribution(icell.TSE, x1+1, x2, x3+1);
+   f->getDistribution(icell.TNW, x1, x2+1, x3+1);
+   f->getDistribution(icell.TNE, x1+1, x2+1, x3+1);
+}
+//////////////////////////////////////////////////////////////////////////
+void InterpolationProcessor::writeICell(SPtr<DistributionArray3D> f, const D3Q27ICell& icell, int x1, int x2, int x3)
+{
+   f->setDistribution(icell.BSW, x1, x2, x3);
+   f->setDistribution(icell.BSE, x1+1, x2, x3);
+   f->setDistribution(icell.BNW, x1, x2+1, x3);
+   f->setDistribution(icell.BNE, x1+1, x2+1, x3);
+   f->setDistribution(icell.TSW, x1, x2, x3+1);
+   f->setDistribution(icell.TSE, x1+1, x2, x3+1);
+   f->setDistribution(icell.TNW, x1, x2+1, x3+1);
+   f->setDistribution(icell.TNE, x1+1, x2+1, x3+1);
+}
+//////////////////////////////////////////////////////////////////////////
+void InterpolationProcessor::writeICellInv(SPtr<DistributionArray3D> f, const D3Q27ICell& icell, int x1, int x2, int x3) 
+{
+   f->setDistributionInv(icell.BSW, x1, x2, x3);
+   f->setDistributionInv(icell.BSE, x1+1, x2, x3);
+   f->setDistributionInv(icell.BNW, x1, x2+1, x3);
+   f->setDistributionInv(icell.BNE, x1+1, x2+1, x3);
+   f->setDistributionInv(icell.TSW, x1, x2, x3+1);
+   f->setDistributionInv(icell.TSE, x1+1, x2, x3+1);
+   f->setDistributionInv(icell.TNW, x1, x2+1, x3+1);
+   f->setDistributionInv(icell.TNE, x1+1, x2+1, x3+1);
+}
+//////////////////////////////////////////////////////////////////////////
+void InterpolationProcessor::writeINode(SPtr<DistributionArray3D> f, const LBMReal* const inode, int x1, int x2, int x3)
+{
+   f->setDistribution(inode, x1, x2, x3);
+}
+//////////////////////////////////////////////////////////////////////////
+void InterpolationProcessor::writeINodeInv(SPtr<DistributionArray3D> f, const LBMReal* const inode, int x1, int x2, int x3) 
+{
+   f->setDistributionInv(inode, x1, x2, x3);
+}
+//////////////////////////////////////////////////////////////////////////
+bool InterpolationProcessor::iCellHasSolid(const SPtr<BCArray3D> bcArray, int x1, int x2, int x3) 
+{
+   for (int ix3 = x3; ix3 <= x3 + 1; ix3++)
+      for(int ix2 = x2; ix2 <= x2 + 1; ix2++)
+         for(int ix1 = x1; ix1 <= x1 + 1; ix1++)
+         {
+            if(bcArray->isSolid(ix1, ix2, ix3))
+               return true;
+         }
+   return false;  
+}
+//////////////////////////////////////////////////////////////////////////
+bool InterpolationProcessor::findNeighborICell(const SPtr<BCArray3D> bcArray, SPtr<DistributionArray3D> f, 
+                                                    D3Q27ICell& icell, int maxX1, int maxX2, int maxX3, 
+                                                    int x1, int x2, int x3, LBMReal& xoff, LBMReal& yoff, LBMReal& zoff) 
+{
+   m_maxX1 = maxX1;
+   m_maxX2 = maxX2;
+   m_maxX3 = maxX3;
+
+   //GoWest
+   if(inRange(x1-1,x2,x3) && !iCellHasSolid(bcArray, x1-1,x2,x3))
+   {
+      readICell(f,icell,x1-1,x2,x3);
+      xoff = 1;
+      yoff = 0;
+      zoff = 0;
+   }
+   //GoEast
+   else if(inRange(x1+2,x2,x3) && !iCellHasSolid(bcArray, x1+1,x2,x3)) // ist übernächster Knoten auch im Gebiet (Grundknoten bei 0,0,0
+   {
+      readICell(f,icell,x1+1,x2,x3);
+      xoff = -1;
+      yoff = 0;
+      zoff = 0;
+   }
+   //GoSouth
+   else if(inRange(x1,x2-1,x3) && !iCellHasSolid(bcArray, x1,x2-1,x3)) 
+   {
+      readICell(f,icell,x1,x2-1,x3);
+      xoff = 0;
+      yoff = 1;
+      zoff = 0;
+   }
+   //GoNorth
+   else if(inRange(x1,x2+2,x3) && !iCellHasSolid(bcArray, x1,x2+1,x3)) // ist übernächster Knoten auch im Gebiet (Grundknoten bei 0,0,0
+   {
+      readICell(f,icell,x1,x2+1,x3);
+      xoff = 0;
+      yoff = -1;
+      zoff = 0;
+   }
+   //GoBottom
+   else if(inRange(x1,x2,x3-1) && !iCellHasSolid(bcArray, x1,x2,x3-1)) 
+   {
+      readICell(f,icell,x1,x2,x3-1);
+      xoff = 0;
+      yoff = 0;
+      zoff = 1;
+   }
+   //GoTop
+   else if(inRange(x1,x2,x3+2) && !iCellHasSolid(bcArray, x1,x2,x3+1)) // ist übernächster Knoten auch im Gebiet (Grundknoten bei 0,0,0
+   {
+      readICell(f,icell,x1,x2,x3+1);
+      xoff = 0;
+      yoff = 0;
+      zoff = -1;
+   }
+   //GoNW
+   else if(inRange(x1-1,x2+2,x3) && !iCellHasSolid(bcArray, x1-1,x2+1,x3)) // ist übernächster Knoten auch im Gebiet (Grundknoten bei 0,0,0
+   {
+      readICell(f,icell,x1-1,x2+1,x3);
+      xoff = 1;
+      yoff = -1;
+      zoff = 0;
+   }
+   //GoNE
+   else if(inRange(x1+2,x2+2,x3) && !iCellHasSolid(bcArray, x1+1,x2+1,x3)) // ist übernächster Knoten auch im Gebiet (Grundknoten bei 0,0,0
+   {
+      readICell(f,icell,x1+1,x2+1,x3);
+      xoff = -1;
+      yoff = -1;
+      zoff = 0;
+   }
+   //GoSW
+   else if(inRange(x1-1,x2-1,x3) && !iCellHasSolid(bcArray, x1-1,x2-1,x3)) // ist übernächster Knoten auch im Gebiet (Grundknoten bei 0,0,0
+   {
+      readICell(f,icell,x1-1,x2-1,x3);
+      xoff = 1;
+      yoff = 1;
+      zoff = 0;
+   }
+   //GoSE
+   else if(inRange(x1+2,x2-1,x3) && !iCellHasSolid(bcArray, x1+1,x2-1,x3)) // ist übernächster Knoten auch im Gebiet (Grundknoten bei 0,0,0
+   {
+      readICell(f,icell,x1+1,x2-1,x3);
+      xoff = -1;
+      yoff = 1;
+      zoff = 0;
+   }
+   //GoBW
+   else if(inRange(x1-1,x2,x3-1) && !iCellHasSolid(bcArray, x1-1,x2,x3-1))
+   {
+      readICell(f,icell,x1-1,x2,x3-1);
+      xoff = 1;
+      yoff = 0;
+      zoff = 1;
+   }
+   //GoBE
+   else if(inRange(x1+2,x2,x3-1) && !iCellHasSolid(bcArray, x1+1,x2,x3-1)) // ist übernächster Knoten auch im Gebiet (Grundknoten bei 0,0,0
+   {
+      readICell(f,icell,x1+1,x2,x3-1);
+      xoff = -1;
+      yoff = 0;
+      zoff = 1;
+   }
+   //GoBS
+   else if(inRange(x1,x2-1,x3-1) && !iCellHasSolid(bcArray, x1,x2-1,x3-1)) 
+   {
+      readICell(f,icell,x1,x2-1,x3-1);
+      xoff = 0;
+      yoff = 1;
+      zoff = 1;
+   }
+   //GoBN
+   else if(inRange(x1,x2+2,x3-1) && !iCellHasSolid(bcArray, x1,x2+1,x3-1)) // ist übernächster Knoten auch im Gebiet (Grundknoten bei 0,0,0
+   {
+      readICell(f,icell,x1,x2+1,x3-1);
+      xoff = 0;
+      yoff = -1;
+      zoff = 1;
+   }
+   //GoTW
+   else if(inRange(x1-1,x2,x3+2) && !iCellHasSolid(bcArray, x1-1,x2,x3+1))
+   {
+      readICell(f,icell,x1-1,x2,x3+1);
+      xoff = 1;
+      yoff = 0;
+      zoff = -1;
+   }
+   //GoTE
+   else if(inRange(x1+2,x2,x3+2) && !iCellHasSolid(bcArray, x1+1,x2,x3+1)) // ist übernächster Knoten auch im Gebiet (Grundknoten bei 0,0,0
+   {
+      readICell(f,icell,x1+1,x2,x3+1);
+      xoff = -1;
+      yoff = 0;
+      zoff = -1;
+   }
+   //GoTS
+   else if(inRange(x1,x2-1,x3+2) && !iCellHasSolid(bcArray, x1,x2-1,x3+1)) 
+   {
+      readICell(f,icell,x1,x2-1,x3+1);
+      xoff = 0;
+      yoff = 1;
+      zoff = -1;
+   }
+   //GoTN
+   else if(inRange(x1,x2+2,x3+2) && !iCellHasSolid(bcArray, x1,x2+1,x3+1)) // ist übernächster Knoten auch im Gebiet (Grundknoten bei 0,0,0
+   {
+      readICell(f,icell,x1,x2+1,x3+1);
+      xoff = 0;
+      yoff = -1;
+      zoff = -1;
+   }
+   //GoTNW
+   else if(inRange(x1-1,x2+2,x3+2) && !iCellHasSolid(bcArray, x1-1,x2+1,x3+1)) // ist übernächster Knoten auch im Gebiet (Grundknoten bei 0,0,0
+   {
+      readICell(f,icell,x1-1,x2+1,x3+1);
+      xoff = 1;
+      yoff = -1;
+      zoff = -1;
+   }
+   //GoTNE
+   else if(inRange(x1+2,x2+2,x3+2) && !iCellHasSolid(bcArray, x1+1,x2+1,x3+1)) // ist übernächster Knoten auch im Gebiet (Grundknoten bei 0,0,0
+   {
+      readICell(f,icell,x1+1,x2+1,x3+1);
+      xoff = -1;
+      yoff = -1;
+      zoff = -1;
+   }
+   //GoTSE
+   else if(inRange(x1+2,x2-1,x3+2) && !iCellHasSolid(bcArray, x1+1,x2-1,x3+1)) // ist übernächster Knoten auch im Gebiet (Grundknoten bei 0,0,0
+   {
+      readICell(f,icell,x1+1,x2-1,x3+1);
+      xoff = -1;
+      yoff =  1;
+      zoff = -1;
+   }
+   //GoTSW
+   else if(inRange(x1-1,x2-1,x3+2) && !iCellHasSolid(bcArray, x1-1,x2-1,x3+1)) // ist übernächster Knoten auch im Gebiet (Grundknoten bei 0,0,0
+   {
+      readICell(f,icell,x1-1,x2-1,x3+1);
+      xoff =  1;
+      yoff =  1;
+      zoff = -1;
+   }
+   //GoBNW
+   else if(inRange(x1-1,x2+2,x3-1) && !iCellHasSolid(bcArray, x1-1,x2+1,x3-1)) // ist übernächster Knoten auch im Gebiet (Grundknoten bei 0,0,0
+   {
+      readICell(f,icell,x1-1,x2+1,x3-1);
+      xoff =  1;
+      yoff = -1;
+      zoff =  1;
+   }
+   //GoBNE
+   else if(inRange(x1+2,x2+2,x3-1) && !iCellHasSolid(bcArray, x1+1,x2+1,x3-1)) // ist übernächster Knoten auch im Gebiet (Grundknoten bei 0,0,0
+   {
+      readICell(f,icell,x1+1,x2+1,x3-1);
+      xoff = -1;
+      yoff = -1;
+      zoff =  1;
+   }
+   //GoBSE
+   else if(inRange(x1+2,x2-1,x3-1) && !iCellHasSolid(bcArray, x1+1,x2-1,x3-1)) // ist übernächster Knoten auch im Gebiet (Grundknoten bei 0,0,0
+   {
+      readICell(f,icell,x1+1,x2-1,x3-1);
+      xoff = -1;
+      yoff =  1;
+      zoff =  1;
+   }
+   //GoBSW
+   else if(inRange(x1-1,x2-1,x3-1) && !iCellHasSolid(bcArray, x1-1,x2-1,x3-1)) // ist übernächster Knoten auch im Gebiet (Grundknoten bei 0,0,0
+   {
+      readICell(f,icell,x1-1,x2-1,x3-1);
+      xoff =  1;
+      yoff =  1;
+      zoff =  1;
+   }
+   //default
+   else
+   {
+      //std::string err = "For x1="+StringUtil::toString(x1)+", x2=" + StringUtil::toString(x2)+", x3=" + StringUtil::toString(x3)+
+      //                  " interpolation is not implemented for other direction"+
+      //                  " by using in: "+(std::string)typeid(*this).name()+ 
+      //                  " or maybe you have a solid on the block boundary";
+      //UB_THROW(UbException(UB_EXARGS, err));
+      return 0;
+   }
+   return 1;
+}
+//////////////////////////////////////////////////////////////////////////
+int InterpolationProcessor::iCellHowManySolids( const SPtr<BCArray3D> bcArray, int x1, int x2, int x3 )
+{
+   int count = 0;
+   for (int ix3 = x3; ix3 <= x3 + 1; ix3++)
+      for(int ix2 = x2; ix2 <= x2 + 1; ix2++)
+         for(int ix1 = x1; ix1 <= x1 + 1; ix1++)
+         {
+            if(bcArray->isSolid(ix1, ix2, ix3))
+               count++;
+         }
+   return count;  
+}
diff --git a/src/cpu/VirtualFluidsCore/LBM/InterpolationProcessor.h b/src/cpu/VirtualFluidsCore/LBM/InterpolationProcessor.h
index bb82aa11bd810f81f1641c5855a35fe49e9a5d08..06e2efd2df018beca946f4f48d8d7d19597750f6 100644
--- a/src/cpu/VirtualFluidsCore/LBM/InterpolationProcessor.h
+++ b/src/cpu/VirtualFluidsCore/LBM/InterpolationProcessor.h
@@ -1,70 +1,70 @@
-#ifndef D3Q27INTRPOLATIOPROCESSOR_H_
-#define D3Q27INTRPOLATIOPROCESSOR_H_
-
-#include "InterpolationProcessor.h"
-#include "LBMSystem.h"
-#include "DistributionArray3D.h"
-#include "BoundaryConditions.h"
-#include "BCArray3D.h"
-
-
-struct D3Q27ICell
-{
-   LBMReal TSW[27]; 
-   LBMReal TNW[27];
-   LBMReal TNE[27];
-   LBMReal TSE[27];
-   LBMReal BSW[27];
-   LBMReal BNW[27];
-   LBMReal BNE[27];
-   LBMReal BSE[27];
-};
-
-class InterpolationProcessor;
-typedef SPtr<InterpolationProcessor> InterpolationProcessorPtr;
-
-#include "InterpolationHelper.h"
-
-class InterpolationProcessor
-{
-public:
-   InterpolationProcessor();
-   virtual ~InterpolationProcessor();
-   virtual InterpolationProcessorPtr clone() = 0;
-   virtual void setOmegas(LBMReal omegaC, LBMReal omegaF) = 0;
-   virtual void interpolateCoarseToFine(D3Q27ICell& icellC, D3Q27ICell& icellF) = 0;
-   virtual void interpolateCoarseToFine(D3Q27ICell& icellC, D3Q27ICell& icellF, LBMReal xoff, LBMReal yoff, LBMReal zoff) = 0;
-   virtual void interpolateFineToCoarse(D3Q27ICell& icellF, LBMReal* icellC) = 0; 
-   virtual void interpolateFineToCoarse(D3Q27ICell& icellF, LBMReal* icellC, LBMReal xoff, LBMReal yoff, LBMReal zoff) = 0; 
-
-   static void readICell(SPtr<DistributionArray3D> f, D3Q27ICell& icell, int x1, int x2, int x3);
-   static void writeICell(SPtr<DistributionArray3D> f, const D3Q27ICell& icell, int x1, int x2, int x3);
-   static void writeICellInv(SPtr<DistributionArray3D> f, const D3Q27ICell& icell, int x1, int x2, int x3);
-   static void writeINode(SPtr<DistributionArray3D> f, const LBMReal* const inode, int x1, int x2, int x3);
-   static void writeINodeInv(SPtr<DistributionArray3D> f, const LBMReal* const inode, int x1, int x2, int x3);
-   static bool iCellHasSolid(const SPtr<BCArray3D> bcArray, int x1, int x2, int x3);
-   static int  iCellHowManySolids(const SPtr<BCArray3D> bcArray, int x1, int x2, int x3);
-
-   bool findNeighborICell(const SPtr<BCArray3D> bcArray, SPtr<DistributionArray3D> f, 
-                          D3Q27ICell& icell, int maxX1, int maxX2, int maxX3, 
-                          int x1, int x2, int x3, LBMReal& xoff, LBMReal& yoff, LBMReal& zoff);
-
-protected:
-   virtual void calcInterpolatedCoefficiets(const D3Q27ICell& icell, LBMReal omega, LBMReal eps_new){}
-   virtual void calcInterpolatedNodeFC(LBMReal* f, LBMReal omega){}
-   virtual void calcInterpolatedVelocity(LBMReal x, LBMReal y, LBMReal z,LBMReal& vx1, LBMReal& vx2, LBMReal& vx3){}
-   virtual void calcInterpolatedShearStress(LBMReal x, LBMReal y, LBMReal z,LBMReal& tauxx, LBMReal& tauyy, LBMReal& tauzz,LBMReal& tauxy, LBMReal& tauxz, LBMReal& tauyz){}
-   virtual void setOffsets(LBMReal xoff, LBMReal yoff, LBMReal zoff){}
-   friend class InterpolationHelper;
-private:
-   bool inRange(int x1, int x2, int x3);
-   int m_maxX1, m_maxX2, m_maxX3;
-};
-
-//////////////////////////////////////////////////////////////////////////
-inline bool InterpolationProcessor::inRange(int x1, int x2, int x3)
-{
-   return x1 >= 0 && x1 < m_maxX1 && x2 >= 0 && x2 < m_maxX2 && x3 >= 0 && x3 < m_maxX3;
-}
-
-#endif
+#ifndef D3Q27INTRPOLATIOPROCESSOR_H_
+#define D3Q27INTRPOLATIOPROCESSOR_H_
+
+#include "InterpolationProcessor.h"
+#include "LBMSystem.h"
+#include "DistributionArray3D.h"
+#include "BoundaryConditions.h"
+#include "BCArray3D.h"
+
+
+struct D3Q27ICell
+{
+   LBMReal TSW[27]; 
+   LBMReal TNW[27];
+   LBMReal TNE[27];
+   LBMReal TSE[27];
+   LBMReal BSW[27];
+   LBMReal BNW[27];
+   LBMReal BNE[27];
+   LBMReal BSE[27];
+};
+
+class InterpolationProcessor;
+typedef SPtr<InterpolationProcessor> InterpolationProcessorPtr;
+
+#include "InterpolationHelper.h"
+
+class InterpolationProcessor
+{
+public:
+   InterpolationProcessor();
+   virtual ~InterpolationProcessor();
+   virtual InterpolationProcessorPtr clone() = 0;
+   virtual void setOmegas(LBMReal omegaC, LBMReal omegaF) = 0;
+   virtual void interpolateCoarseToFine(D3Q27ICell& icellC, D3Q27ICell& icellF) = 0;
+   virtual void interpolateCoarseToFine(D3Q27ICell& icellC, D3Q27ICell& icellF, LBMReal xoff, LBMReal yoff, LBMReal zoff) = 0;
+   virtual void interpolateFineToCoarse(D3Q27ICell& icellF, LBMReal* icellC) = 0; 
+   virtual void interpolateFineToCoarse(D3Q27ICell& icellF, LBMReal* icellC, LBMReal xoff, LBMReal yoff, LBMReal zoff) = 0; 
+
+   static void readICell(SPtr<DistributionArray3D> f, D3Q27ICell& icell, int x1, int x2, int x3);
+   static void writeICell(SPtr<DistributionArray3D> f, const D3Q27ICell& icell, int x1, int x2, int x3);
+   static void writeICellInv(SPtr<DistributionArray3D> f, const D3Q27ICell& icell, int x1, int x2, int x3);
+   static void writeINode(SPtr<DistributionArray3D> f, const LBMReal* const inode, int x1, int x2, int x3);
+   static void writeINodeInv(SPtr<DistributionArray3D> f, const LBMReal* const inode, int x1, int x2, int x3);
+   static bool iCellHasSolid(const SPtr<BCArray3D> bcArray, int x1, int x2, int x3);
+   static int  iCellHowManySolids(const SPtr<BCArray3D> bcArray, int x1, int x2, int x3);
+
+   bool findNeighborICell(const SPtr<BCArray3D> bcArray, SPtr<DistributionArray3D> f, 
+                          D3Q27ICell& icell, int maxX1, int maxX2, int maxX3, 
+                          int x1, int x2, int x3, LBMReal& xoff, LBMReal& yoff, LBMReal& zoff);
+
+protected:
+   virtual void calcInterpolatedCoefficiets(const D3Q27ICell& icell, LBMReal omega, LBMReal eps_new){}
+   virtual void calcInterpolatedNodeFC(LBMReal* f, LBMReal omega){}
+   virtual void calcInterpolatedVelocity(LBMReal x, LBMReal y, LBMReal z,LBMReal& vx1, LBMReal& vx2, LBMReal& vx3){}
+   virtual void calcInterpolatedShearStress(LBMReal x, LBMReal y, LBMReal z,LBMReal& tauxx, LBMReal& tauyy, LBMReal& tauzz,LBMReal& tauxy, LBMReal& tauxz, LBMReal& tauyz){}
+   virtual void setOffsets(LBMReal xoff, LBMReal yoff, LBMReal zoff){}
+   friend class InterpolationHelper;
+private:
+   bool inRange(int x1, int x2, int x3);
+   int m_maxX1, m_maxX2, m_maxX3;
+};
+
+//////////////////////////////////////////////////////////////////////////
+inline bool InterpolationProcessor::inRange(int x1, int x2, int x3)
+{
+   return x1 >= 0 && x1 < m_maxX1 && x2 >= 0 && x2 < m_maxX2 && x3 >= 0 && x3 < m_maxX3;
+}
+
+#endif
diff --git a/src/cpu/VirtualFluidsCore/LBM/LBMSystem.cpp b/src/cpu/VirtualFluidsCore/LBM/LBMSystem.cpp
index 34a9d7818246eb239eb238972627607a05dcde2b..b6fcbe12fa4a13a5c2597beb1ad97e55a84c2dac 100644
--- a/src/cpu/VirtualFluidsCore/LBM/LBMSystem.cpp
+++ b/src/cpu/VirtualFluidsCore/LBM/LBMSystem.cpp
@@ -1,39 +1,39 @@
-//=======================================================================================
-// ____          ____    __    ______     __________   __      __       __        __         
-// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
-//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
-//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
-//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
-//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
-//      \    \  |    |   ________________________________________________________________    
-//       \    \ |    |  |  ______________________________________________________________|   
-//        \    \|    |  |  |         __          __     __     __     ______      _______    
-//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
-//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
-//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
-//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
-//
-//  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 LBMSystem.cpp
-//! \ingroup LBM
-//! \author Sebastian Geller
-//=======================================================================================
-
-#include "LBMSystem.h"
-
-namespace LBMSystem
-{
-   real SMAG_CONST = REAL_CAST(0.18);
-}
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 LBMSystem.cpp
+//! \ingroup LBM
+//! \author Sebastian Geller
+//=======================================================================================
+
+#include "LBMSystem.h"
+
+namespace LBMSystem
+{
+   real SMAG_CONST = REAL_CAST(0.18);
+}
diff --git a/src/cpu/VirtualFluidsCore/LBM/LBMSystem.h b/src/cpu/VirtualFluidsCore/LBM/LBMSystem.h
index 84037637fa11eed0e84a266f84d1e996abb501e0..49a82b3938f9ceebc6239fd033b7c6d30373cd60 100644
--- a/src/cpu/VirtualFluidsCore/LBM/LBMSystem.h
+++ b/src/cpu/VirtualFluidsCore/LBM/LBMSystem.h
@@ -1,95 +1,95 @@
-//=======================================================================================
-// ____          ____    __    ______     __________   __      __       __        __         
-// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
-//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
-//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
-//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
-//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
-//      \    \  |    |   ________________________________________________________________    
-//       \    \ |    |  |  ______________________________________________________________|   
-//        \    \|    |  |  |         __          __     __     __     ______      _______    
-//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
-//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
-//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
-//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
-//
-//  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 LBMSystem.h
-//! \ingroup LBM
-//! \author Sebastian Geller
-//=======================================================================================
-#ifndef LBMSYSTEM_H
-#define LBMSYSTEM_H
-
-#include <cmath>
-#include <string>
-#include <iostream>
-
-
-//! \brief namespace for global system-functions
-
-namespace LBMSystem
-{
-
-//#define SINGLEPRECISION
-
-#ifdef SINGLEPRECISION
-   typedef float real;
-   #define REAL_CAST(x) ( (LBMSystem::real)(x) )
-#else
-   typedef double real;
-   #define REAL_CAST(x) ( x )
-#endif
-
-   extern real SMAG_CONST;
-
-   //////////////////////////////////////////////////////////////////////////
-   //!get LBM deltaT is equal LBM DeltaX
-   //!deltaT is dependent from grid level 
-   //!for first grid level is deltaT = 1.0
-   //!for next grid level 1/2 etc.
-   static real getDeltaT(int level)
-   {
-      return REAL_CAST(1.0/REAL_CAST(1<<level)); 
-   }
-
-   //////////////////////////////////////////////////////////////////////////
-   //!calculate collision factor omega = 1.0/(3.0*viscosity/deltaT+0.5)
-   //!deltaT is dependent from grid level 
-   //!for first grid level is deltaT = 1.0
-   //!for next grid level 1/2 etc.
-   static real calcCollisionFactor(real viscosity, int level)
-   {
-      //return REAL_CAST(1.0/(3.0*viscosity/deltaT+0.5));
-      return REAL_CAST(1.0/(3.0*viscosity/(1.0/REAL_CAST(1<<level))+0.5));
-   }
-
-   //!bulk viscosity
-   static real calcOmega2(real viscosity, int level)
-   {
-      return REAL_CAST(1.0/(4.5*viscosity/(1.0/REAL_CAST(1<<level))+0.5));
-   }
-   //!bulk viscosity
-   static real calcOmega2(real viscosity, real deltaT)
-   {
-      return REAL_CAST(1.0/(4.5*viscosity/deltaT+0.5));
-   }
-}
-
-//some typedefs for global namespace
-typedef LBMSystem::real LBMReal;
-
-#endif
-
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 LBMSystem.h
+//! \ingroup LBM
+//! \author Sebastian Geller
+//=======================================================================================
+#ifndef LBMSYSTEM_H
+#define LBMSYSTEM_H
+
+#include <cmath>
+#include <string>
+#include <iostream>
+
+
+//! \brief namespace for global system-functions
+
+namespace LBMSystem
+{
+
+//#define SINGLEPRECISION
+
+#ifdef SINGLEPRECISION
+   typedef float real;
+   #define REAL_CAST(x) ( (LBMSystem::real)(x) )
+#else
+   typedef double real;
+   #define REAL_CAST(x) ( x )
+#endif
+
+   extern real SMAG_CONST;
+
+   //////////////////////////////////////////////////////////////////////////
+   //!get LBM deltaT is equal LBM DeltaX
+   //!deltaT is dependent from grid level 
+   //!for first grid level is deltaT = 1.0
+   //!for next grid level 1/2 etc.
+   static real getDeltaT(int level)
+   {
+      return REAL_CAST(1.0/REAL_CAST(1<<level)); 
+   }
+
+   //////////////////////////////////////////////////////////////////////////
+   //!calculate collision factor omega = 1.0/(3.0*viscosity/deltaT+0.5)
+   //!deltaT is dependent from grid level 
+   //!for first grid level is deltaT = 1.0
+   //!for next grid level 1/2 etc.
+   static real calcCollisionFactor(real viscosity, int level)
+   {
+      //return REAL_CAST(1.0/(3.0*viscosity/deltaT+0.5));
+      return REAL_CAST(1.0/(3.0*viscosity/(1.0/REAL_CAST(1<<level))+0.5));
+   }
+
+   //!bulk viscosity
+   static real calcOmega2(real viscosity, int level)
+   {
+      return REAL_CAST(1.0/(4.5*viscosity/(1.0/REAL_CAST(1<<level))+0.5));
+   }
+   //!bulk viscosity
+   static real calcOmega2(real viscosity, real deltaT)
+   {
+      return REAL_CAST(1.0/(4.5*viscosity/deltaT+0.5));
+   }
+}
+
+//some typedefs for global namespace
+typedef LBMSystem::real LBMReal;
+
+#endif
+
diff --git a/src/cpu/VirtualFluidsCore/LBM/LBMUnitConverter.h b/src/cpu/VirtualFluidsCore/LBM/LBMUnitConverter.h
index 1af263838a2c1b3ebbae1d49bc11f68f538f0852..b65ebd7b3d381518f07dc7a72341d7644a03a1ef 100644
--- a/src/cpu/VirtualFluidsCore/LBM/LBMUnitConverter.h
+++ b/src/cpu/VirtualFluidsCore/LBM/LBMUnitConverter.h
@@ -1,196 +1,196 @@
-#ifndef LBMUNITCONVERTER_H
-#define LBMUNITCONVERTER_H
-
-#include <iostream>
-#include <iomanip>
-#include <string>
-#include <sstream>
-#include <cmath>
-
-//#include "LBMUnitConverter.h"
-
-#include <basics/utilities/UbException.h>
-#include <basics/utilities/UbFileInput.h>
-#include <basics/utilities/UbFileOutput.h>
-
-// LBMUnitConverter conv(  100 /*L_World*/, 1484/*cs_water*/    , 1000/*rho_water*/
-//                         , 1000/*L_LB*/   , 1./srqt(3.)/*cs_Lb*/, 1/*rho_Lb*/ );
-// cout<<conv.toString()<<endl;
-// 
-// cout<<"100m       = "<< 100  * conv.getFactorLentghWToLb()   << "dx    " << std::endl;
-// cout<<"1000dx     = "<< 1000 * conv.getFactorLentghLbToW()   << "m     " << std::endl;
-// 
-// cout<<"25m/s      = "<< 25   * conv.getFactorVelocityWToLb() << "dx/dt " << std::endl;
-// cout<<"0.04 dx/dt = "<< 0.04 * conv.getFactorVelocityLbToW() << "m/s   " << std::endl;
-//
-//alternativ
-// LBMUnitConverter conv(, 100 /*L_World*/, LBMUnitConverter::WATER, 1000/*L_LB*/  );
-
-
-class LBMUnitConverter
-{
-public:
-
-   enum WORLD_MATERIAL { WATER  = 0, SEAWWATER  = 1, AIR_20C  = 2, OIL  = 3  }; 
-
-   LBMUnitConverter() :  factorLengthLbToW(1.0),
-                         factorTimeLbToW(1.0),
-                         factorMassLbToW(1.0), 
-                         refRhoLb(1.0),
-                         factorVelocityLbToW(1.0), 
-                         factorViscosityLbToW(1.0),
-                         factorDensityLbToW(1.0),
-                         factorPressureLbToW(1.0)
-   {
-
-   }
-
-   LBMUnitConverter(   const double& refLengthWorld, const double& csWorld, const double& rhoWorld
-      , const double& refLengthLb   , const double& csLb = 1.0/std::sqrt(3.0)  , const double& rhoLb = 1.0   )
-   {
-      this->init(  refLengthWorld, csWorld, rhoWorld, csWorld, refLengthLb, rhoLb, csLb  );
-
-   }
-
-   LBMUnitConverter(  const double& refLengthWorld, WORLD_MATERIAL worldMaterial
-      , const double& refLengthLb   , const double& csLb = 1.0/std::sqrt(3.0) , const double& rhoLb = 1.0    )
-   {
-      double csWorld;
-      double rhoWorld;  
-
-      if     ( worldMaterial == WATER    ) { csWorld = 1484/*m/s*/; rhoWorld =  1000/*kg/m^3*/;  }
-      else if( worldMaterial == SEAWWATER) { csWorld = 1500/*m/s*/; rhoWorld =  1025/*kg/m^3*/;  }
-      else if( worldMaterial == AIR_20C  ) { csWorld =  343/*m/s*/; rhoWorld = 1.290/*kg/m^3*/;  }
-      else if( worldMaterial == OIL      ) { csWorld = 1740/*m/s*/; rhoWorld =  830/*kg/m^3*/;   }
-      else                                  throw UbException(UB_EXARGS,"unknown material");
-
-      this->init(  refLengthWorld, csWorld, rhoWorld, csWorld, refLengthLb, rhoLb, csLb  );
-
-   }
-
-   LBMUnitConverter(int dummy, double uReal, double uLB, double nuReal, double nuLB) 
-   {
-      factorVelocityLbToW = uReal/uLB;
-      factorViscosityLbToW = nuReal/nuLB;
-      factorDensityLbToW = factorViscosityLbToW * factorVelocityLbToW * factorVelocityLbToW;
-      factorPressureLbToW = factorDensityLbToW;
-   }
-
-   virtual ~LBMUnitConverter() {}
-
-   double  getRefRhoLb()             { return refRhoLb; }
-
-   double  getFactorLentghLbToW()    { return factorLengthLbToW;                                                       }
-   double  getFactorLentghWToLb()    { return 1.0/this->getFactorLentghLbToW();                                        }
-
-   double  getFactorTimeLbToW()      { return factorTimeLbToW;                                                         }
-   double  getFactorTimeWToLb()      { return 1.0/this->getFactorTimeLbToW();                                          }
-
-   double  getFactorVelocityLbToW()  { return factorLengthLbToW/factorTimeLbToW;                                       }
-   double  getFactorVelocityWToLb()  { return 1.0/this->getFactorVelocityLbToW();                                      }
-
-   double  getFactorViscosityLbToW() { return factorLengthLbToW*factorLengthLbToW/factorTimeLbToW;                     }
-   double  getFactorViscosityWToLb() { return 1.0/this->getFactorViscosityLbToW();                                     }
-
-   double  getFactorDensityLbToW()   { return this->factorMassLbToW/std::pow(factorLengthLbToW,3.0);                   }
-   double  getFactorDensityWToLb()   { return 1.0/this->getFactorDensityLbToW();                                       }
-
-   double  getFactorPressureLbToW()  { return this->factorMassLbToW/(std::pow(factorTimeLbToW,2.0)*factorLengthLbToW); }
-   double  getFactorPressureWToLb()  { return 1.0/this->getFactorPressureLbToW();                                      }
-
-   double  getFactorMassLbToW()      { return this->factorMassLbToW;                                                   }
-   double  getFactorMassWToLb()      { return 1.0/this->getFactorMassLbToW();                                          }
-
-   double  getFactorForceLbToW()     { return factorMassLbToW*factorLengthLbToW/(factorTimeLbToW*factorTimeLbToW);     }
-   double  getFactorForceWToLb()     { return 1.0/this->getFactorForceLbToW();                                         }
-
-   double  getFactorAccLbToW()       { return factorLengthLbToW/(factorTimeLbToW*factorTimeLbToW);                     }
-   double  getFactorAccWToLb()       { return 1.0/this->getFactorAccLbToW();                                           }
-
-   double  getFactorTimeLbToW(double deltaX)        const { return factorTimeWithoutDx * deltaX;             }
-   //////////////////////////////////////////////////////////////////////////
-   double  getFactorVelocityLbToW2() { return factorVelocityLbToW; }
-   double  getFactorDensityLbToW2()  { return factorDensityLbToW;  }
-   double  getFactorPressureLbToW2() { return factorPressureLbToW; }
-   
-
-
-   /*==========================================================*/
-   friend inline std::ostream& operator << (std::ostream& os, LBMUnitConverter c) 
-   {
-      os<<c.toString();
-      return os;
-   }
-   /*==========================================================*/
-   std::string toString() 
-   {
-      std::ostringstream out;
-      out<<"LB --> WORLD" << std::endl;
-      out<<" * lentgh 1[dx  ] = " << std::setw(12) << this->getFactorLentghLbToW()    << " [m   ] " << std::endl;
-      out<<" * time   1[dt  ] = " << std::setw(12) << this->getFactorTimeLbToW()      << " [s   ] " << std::endl;
-      out<<" * mass   1[mass] = " << std::setw(12) << this->getFactorMassLbToW()      << " [kg  ] " << std::endl;
-      out<<std::endl;                                                       
-      out<<"WORLD --> LB" << std::endl;                                     
-      out<<" * lentgh 1[m   ] = " << std::setw(12) << this->getFactorLentghWToLb()    << " [dx  ] " << std::endl;
-      out<<" * time   1[s   ] = " << std::setw(12) << this->getFactorTimeWToLb()      << " [dt  ] " << std::endl;
-      out<<" * mass   1[kg  ] = " << std::setw(12) << this->getFactorMassWToLb()      << " [mass] " << std::endl;
-      out<<std::endl;
-      out<<"LB --> WORLD (combined units)" << std::endl;
-      out<<" * velocity     1 [dx/dt    ] = " << std::setw(12) << this->getFactorVelocityLbToW()  << " [m/s      ]" << std::endl;
-      out<<" * density      1 [mass/dx^3] = " << std::setw(12) << this->getFactorDensityLbToW()   << " [kg/m^3   ]" << std::endl;
-      out<<" * pressure     1 [F_lb/dx^2] = " << std::setw(12) << this->getFactorPressureLbToW()  << " [N/m^2    ]" << std::endl;
-      out<<" * viscosity    1 [dx^2/dt  ] = " << std::setw(12) << this->getFactorViscosityLbToW() << " [m^2/s    ]" << std::endl;
-      out<<" * force        1 [F_lb     ] = " << std::setw(12) << this->getFactorForceLbToW()     << " [N        ]" << std::endl;
-      out<<" * acceleration 1 [dx/dt^2  ] = " << std::setw(12) << this->getFactorAccLbToW()       << " [m/s^2    ]" << std::endl;
-      out<<std::endl;                                                                       
-      out<<"WORLD --> LB (combined units)" << std::endl;                                    
-      out<<" * velocity     1 [m/s      ] = " << std::setw(12) << this->getFactorVelocityWToLb()  << " [dx/dt    ]" << std::endl;
-      out<<" * density      1 [kg/m^3   ] = " << std::setw(12) << this->getFactorDensityWToLb()   << " [mass/dx^3]" << std::endl;
-      out<<" * pressure     1 [N/m^2    ] = " << std::setw(12) << this->getFactorPressureWToLb()  << " [F_lb/dx^2]" << std::endl;
-      out<<" * viscosity    1 [m^2/s    ] = " << std::setw(12) << this->getFactorViscosityWToLb() << " [dx^2/dt  ]" << std::endl;
-      out<<" * force        1 [N        ] = " << std::setw(12) << this->getFactorForceWToLb()     << " [F_lb     ]" << std::endl;
-      out<<" * acceleration 1 [m/s^2    ] = " << std::setw(12) << this->getFactorAccWToLb()       << " [dx/dt^2  ]" << std::endl;
-
-      return out.str();
-   }
-   /*==========================================================*/
-   virtual void write(UbFileOutput* out)
-   {
-      out->writeDouble(factorLengthLbToW);
-      out->writeDouble(factorTimeLbToW  );
-      out->writeDouble(factorMassLbToW  );
-   }
-   /*==========================================================*/
-   virtual void read(UbFileInput* in)
-   {
-      factorLengthLbToW = in->readDouble();
-      factorTimeLbToW   = in->readDouble();
-      factorMassLbToW   = in->readDouble();
-   }
-
-
-
-   void init(  const double& refLengthWorld, const double& csWorld, const double& rhoWorld, const double& vWorld, 
-               const double& refLengthLb, const double& rhoLb, const double& vLb  )
-   {
-      factorLengthLbToW = refLengthWorld / refLengthLb;
-      factorTimeLbToW   = vLb / vWorld * factorLengthLbToW;
-      factorMassLbToW   = rhoWorld/rhoLb*factorLengthLbToW*factorLengthLbToW*factorLengthLbToW;
-      factorTimeWithoutDx=vLb/vWorld;
-      this->refRhoLb = rhoLb;
-   }
-   protected:
-   double factorLengthLbToW;
-   double factorTimeLbToW;
-   double factorMassLbToW;
-   double refRhoLb;
-   double factorTimeWithoutDx;
-   
-   double factorVelocityLbToW;
-   double factorViscosityLbToW;
-   double factorDensityLbToW;
-   double factorPressureLbToW;
-
-};
-
-#endif //LBMUNITCONVERTER_H
+#ifndef LBMUNITCONVERTER_H
+#define LBMUNITCONVERTER_H
+
+#include <iostream>
+#include <iomanip>
+#include <string>
+#include <sstream>
+#include <cmath>
+
+//#include "LBMUnitConverter.h"
+
+#include <basics/utilities/UbException.h>
+#include <basics/utilities/UbFileInput.h>
+#include <basics/utilities/UbFileOutput.h>
+
+// LBMUnitConverter conv(  100 /*L_World*/, 1484/*cs_water*/    , 1000/*rho_water*/
+//                         , 1000/*L_LB*/   , 1./srqt(3.)/*cs_Lb*/, 1/*rho_Lb*/ );
+// cout<<conv.toString()<<endl;
+// 
+// cout<<"100m       = "<< 100  * conv.getFactorLentghWToLb()   << "dx    " << std::endl;
+// cout<<"1000dx     = "<< 1000 * conv.getFactorLentghLbToW()   << "m     " << std::endl;
+// 
+// cout<<"25m/s      = "<< 25   * conv.getFactorVelocityWToLb() << "dx/dt " << std::endl;
+// cout<<"0.04 dx/dt = "<< 0.04 * conv.getFactorVelocityLbToW() << "m/s   " << std::endl;
+//
+//alternativ
+// LBMUnitConverter conv(, 100 /*L_World*/, LBMUnitConverter::WATER, 1000/*L_LB*/  );
+
+
+class LBMUnitConverter
+{
+public:
+
+   enum WORLD_MATERIAL { WATER  = 0, SEAWWATER  = 1, AIR_20C  = 2, OIL  = 3  }; 
+
+   LBMUnitConverter() :  factorLengthLbToW(1.0),
+                         factorTimeLbToW(1.0),
+                         factorMassLbToW(1.0), 
+                         refRhoLb(1.0),
+                         factorVelocityLbToW(1.0), 
+                         factorViscosityLbToW(1.0),
+                         factorDensityLbToW(1.0),
+                         factorPressureLbToW(1.0)
+   {
+
+   }
+
+   LBMUnitConverter(   const double& refLengthWorld, const double& csWorld, const double& rhoWorld
+      , const double& refLengthLb   , const double& csLb = 1.0/std::sqrt(3.0)  , const double& rhoLb = 1.0   )
+   {
+      this->init(  refLengthWorld, csWorld, rhoWorld, csWorld, refLengthLb, rhoLb, csLb  );
+
+   }
+
+   LBMUnitConverter(  const double& refLengthWorld, WORLD_MATERIAL worldMaterial
+      , const double& refLengthLb   , const double& csLb = 1.0/std::sqrt(3.0) , const double& rhoLb = 1.0    )
+   {
+      double csWorld;
+      double rhoWorld;  
+
+      if     ( worldMaterial == WATER    ) { csWorld = 1484/*m/s*/; rhoWorld =  1000/*kg/m^3*/;  }
+      else if( worldMaterial == SEAWWATER) { csWorld = 1500/*m/s*/; rhoWorld =  1025/*kg/m^3*/;  }
+      else if( worldMaterial == AIR_20C  ) { csWorld =  343/*m/s*/; rhoWorld = 1.290/*kg/m^3*/;  }
+      else if( worldMaterial == OIL      ) { csWorld = 1740/*m/s*/; rhoWorld =  830/*kg/m^3*/;   }
+      else                                  throw UbException(UB_EXARGS,"unknown material");
+
+      this->init(  refLengthWorld, csWorld, rhoWorld, csWorld, refLengthLb, rhoLb, csLb  );
+
+   }
+
+   LBMUnitConverter(int dummy, double uReal, double uLB, double nuReal, double nuLB) 
+   {
+      factorVelocityLbToW = uReal/uLB;
+      factorViscosityLbToW = nuReal/nuLB;
+      factorDensityLbToW = factorViscosityLbToW * factorVelocityLbToW * factorVelocityLbToW;
+      factorPressureLbToW = factorDensityLbToW;
+   }
+
+   virtual ~LBMUnitConverter() {}
+
+   double  getRefRhoLb()             { return refRhoLb; }
+
+   double  getFactorLentghLbToW()    { return factorLengthLbToW;                                                       }
+   double  getFactorLentghWToLb()    { return 1.0/this->getFactorLentghLbToW();                                        }
+
+   double  getFactorTimeLbToW()      { return factorTimeLbToW;                                                         }
+   double  getFactorTimeWToLb()      { return 1.0/this->getFactorTimeLbToW();                                          }
+
+   double  getFactorVelocityLbToW()  { return factorLengthLbToW/factorTimeLbToW;                                       }
+   double  getFactorVelocityWToLb()  { return 1.0/this->getFactorVelocityLbToW();                                      }
+
+   double  getFactorViscosityLbToW() { return factorLengthLbToW*factorLengthLbToW/factorTimeLbToW;                     }
+   double  getFactorViscosityWToLb() { return 1.0/this->getFactorViscosityLbToW();                                     }
+
+   double  getFactorDensityLbToW()   { return this->factorMassLbToW/std::pow(factorLengthLbToW,3.0);                   }
+   double  getFactorDensityWToLb()   { return 1.0/this->getFactorDensityLbToW();                                       }
+
+   double  getFactorPressureLbToW()  { return this->factorMassLbToW/(std::pow(factorTimeLbToW,2.0)*factorLengthLbToW); }
+   double  getFactorPressureWToLb()  { return 1.0/this->getFactorPressureLbToW();                                      }
+
+   double  getFactorMassLbToW()      { return this->factorMassLbToW;                                                   }
+   double  getFactorMassWToLb()      { return 1.0/this->getFactorMassLbToW();                                          }
+
+   double  getFactorForceLbToW()     { return factorMassLbToW*factorLengthLbToW/(factorTimeLbToW*factorTimeLbToW);     }
+   double  getFactorForceWToLb()     { return 1.0/this->getFactorForceLbToW();                                         }
+
+   double  getFactorAccLbToW()       { return factorLengthLbToW/(factorTimeLbToW*factorTimeLbToW);                     }
+   double  getFactorAccWToLb()       { return 1.0/this->getFactorAccLbToW();                                           }
+
+   double  getFactorTimeLbToW(double deltaX)        const { return factorTimeWithoutDx * deltaX;             }
+   //////////////////////////////////////////////////////////////////////////
+   double  getFactorVelocityLbToW2() { return factorVelocityLbToW; }
+   double  getFactorDensityLbToW2()  { return factorDensityLbToW;  }
+   double  getFactorPressureLbToW2() { return factorPressureLbToW; }
+   
+
+
+   /*==========================================================*/
+   friend inline std::ostream& operator << (std::ostream& os, LBMUnitConverter c) 
+   {
+      os<<c.toString();
+      return os;
+   }
+   /*==========================================================*/
+   std::string toString() 
+   {
+      std::ostringstream out;
+      out<<"LB --> WORLD" << std::endl;
+      out<<" * lentgh 1[dx  ] = " << std::setw(12) << this->getFactorLentghLbToW()    << " [m   ] " << std::endl;
+      out<<" * time   1[dt  ] = " << std::setw(12) << this->getFactorTimeLbToW()      << " [s   ] " << std::endl;
+      out<<" * mass   1[mass] = " << std::setw(12) << this->getFactorMassLbToW()      << " [kg  ] " << std::endl;
+      out<<std::endl;                                                       
+      out<<"WORLD --> LB" << std::endl;                                     
+      out<<" * lentgh 1[m   ] = " << std::setw(12) << this->getFactorLentghWToLb()    << " [dx  ] " << std::endl;
+      out<<" * time   1[s   ] = " << std::setw(12) << this->getFactorTimeWToLb()      << " [dt  ] " << std::endl;
+      out<<" * mass   1[kg  ] = " << std::setw(12) << this->getFactorMassWToLb()      << " [mass] " << std::endl;
+      out<<std::endl;
+      out<<"LB --> WORLD (combined units)" << std::endl;
+      out<<" * velocity     1 [dx/dt    ] = " << std::setw(12) << this->getFactorVelocityLbToW()  << " [m/s      ]" << std::endl;
+      out<<" * density      1 [mass/dx^3] = " << std::setw(12) << this->getFactorDensityLbToW()   << " [kg/m^3   ]" << std::endl;
+      out<<" * pressure     1 [F_lb/dx^2] = " << std::setw(12) << this->getFactorPressureLbToW()  << " [N/m^2    ]" << std::endl;
+      out<<" * viscosity    1 [dx^2/dt  ] = " << std::setw(12) << this->getFactorViscosityLbToW() << " [m^2/s    ]" << std::endl;
+      out<<" * force        1 [F_lb     ] = " << std::setw(12) << this->getFactorForceLbToW()     << " [N        ]" << std::endl;
+      out<<" * acceleration 1 [dx/dt^2  ] = " << std::setw(12) << this->getFactorAccLbToW()       << " [m/s^2    ]" << std::endl;
+      out<<std::endl;                                                                       
+      out<<"WORLD --> LB (combined units)" << std::endl;                                    
+      out<<" * velocity     1 [m/s      ] = " << std::setw(12) << this->getFactorVelocityWToLb()  << " [dx/dt    ]" << std::endl;
+      out<<" * density      1 [kg/m^3   ] = " << std::setw(12) << this->getFactorDensityWToLb()   << " [mass/dx^3]" << std::endl;
+      out<<" * pressure     1 [N/m^2    ] = " << std::setw(12) << this->getFactorPressureWToLb()  << " [F_lb/dx^2]" << std::endl;
+      out<<" * viscosity    1 [m^2/s    ] = " << std::setw(12) << this->getFactorViscosityWToLb() << " [dx^2/dt  ]" << std::endl;
+      out<<" * force        1 [N        ] = " << std::setw(12) << this->getFactorForceWToLb()     << " [F_lb     ]" << std::endl;
+      out<<" * acceleration 1 [m/s^2    ] = " << std::setw(12) << this->getFactorAccWToLb()       << " [dx/dt^2  ]" << std::endl;
+
+      return out.str();
+   }
+   /*==========================================================*/
+   virtual void write(UbFileOutput* out)
+   {
+      out->writeDouble(factorLengthLbToW);
+      out->writeDouble(factorTimeLbToW  );
+      out->writeDouble(factorMassLbToW  );
+   }
+   /*==========================================================*/
+   virtual void read(UbFileInput* in)
+   {
+      factorLengthLbToW = in->readDouble();
+      factorTimeLbToW   = in->readDouble();
+      factorMassLbToW   = in->readDouble();
+   }
+
+
+
+   void init(  const double& refLengthWorld, const double& csWorld, const double& rhoWorld, const double& vWorld, 
+               const double& refLengthLb, const double& rhoLb, const double& vLb  )
+   {
+      factorLengthLbToW = refLengthWorld / refLengthLb;
+      factorTimeLbToW   = vLb / vWorld * factorLengthLbToW;
+      factorMassLbToW   = rhoWorld/rhoLb*factorLengthLbToW*factorLengthLbToW*factorLengthLbToW;
+      factorTimeWithoutDx=vLb/vWorld;
+      this->refRhoLb = rhoLb;
+   }
+   protected:
+   double factorLengthLbToW;
+   double factorTimeLbToW;
+   double factorMassLbToW;
+   double refRhoLb;
+   double factorTimeWithoutDx;
+   
+   double factorVelocityLbToW;
+   double factorViscosityLbToW;
+   double factorDensityLbToW;
+   double factorPressureLbToW;
+
+};
+
+#endif //LBMUNITCONVERTER_H
diff --git a/src/cpu/VirtualFluidsCore/LBM/VoidLBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/VoidLBMKernel.cpp
index 1d8aef6489b820ccf9f6730e52eca01acea857a2..cc6bfcf81043e9350bee1c16fdb1718dab5e6c1b 100644
--- a/src/cpu/VirtualFluidsCore/LBM/VoidLBMKernel.cpp
+++ b/src/cpu/VirtualFluidsCore/LBM/VoidLBMKernel.cpp
@@ -1,46 +1,46 @@
-#include "VoidLBMKernel.h"
-#include "VoidData3D.h"
-#include "BCProcessor.h"
-#include "DataSet3D.h"
-
-VoidLBMKernel::VoidLBMKernel()
-{
-
-}
-//////////////////////////////////////////////////////////////////////////
-VoidLBMKernel::~VoidLBMKernel()
-{
-
-}
-//////////////////////////////////////////////////////////////////////////
-void VoidLBMKernel::initDataSet()
-{
-   SPtr<DistributionArray3D> d(new VoidData3D(nx[0]+2, nx[1]+2, nx[2]+2, -999.9));
-   dataSet->setFdistributions(d);
-}
-//////////////////////////////////////////////////////////////////////////
-SPtr<LBMKernel> VoidLBMKernel::clone()
-{
-   SPtr<LBMKernel> kernel(new VoidLBMKernel());
-   kernel->setNX(nx);
-   dynamicPointerCast<VoidLBMKernel>(kernel)->initDataSet();
-   kernel->setCollisionFactor(this->collFactor);
-   kernel->setBCProcessor(bcProcessor->clone(kernel));
-   kernel->setWithForcing(withForcing);
-   kernel->setForcingX1(muForcingX1);
-   kernel->setForcingX2(muForcingX2);
-   kernel->setForcingX3(muForcingX3);
-   kernel->setIndex(ix1, ix2, ix3);
-   kernel->setDeltaT(deltaT);
-   return kernel;
-}
-//////////////////////////////////////////////////////////////////////////
-void VoidLBMKernel::calculate(int step)
-{
-
-}
-//////////////////////////////////////////////////////////////////////////
-double VoidLBMKernel::getCalculationTime()
-{
-   return 0.0;
-}
+#include "VoidLBMKernel.h"
+#include "VoidData3D.h"
+#include "BCProcessor.h"
+#include "DataSet3D.h"
+
+VoidLBMKernel::VoidLBMKernel()
+{
+
+}
+//////////////////////////////////////////////////////////////////////////
+VoidLBMKernel::~VoidLBMKernel()
+{
+
+}
+//////////////////////////////////////////////////////////////////////////
+void VoidLBMKernel::initDataSet()
+{
+   SPtr<DistributionArray3D> d(new VoidData3D(nx[0]+2, nx[1]+2, nx[2]+2, -999.9));
+   dataSet->setFdistributions(d);
+}
+//////////////////////////////////////////////////////////////////////////
+SPtr<LBMKernel> VoidLBMKernel::clone()
+{
+   SPtr<LBMKernel> kernel(new VoidLBMKernel());
+   kernel->setNX(nx);
+   dynamicPointerCast<VoidLBMKernel>(kernel)->initDataSet();
+   kernel->setCollisionFactor(this->collFactor);
+   kernel->setBCProcessor(bcProcessor->clone(kernel));
+   kernel->setWithForcing(withForcing);
+   kernel->setForcingX1(muForcingX1);
+   kernel->setForcingX2(muForcingX2);
+   kernel->setForcingX3(muForcingX3);
+   kernel->setIndex(ix1, ix2, ix3);
+   kernel->setDeltaT(deltaT);
+   return kernel;
+}
+//////////////////////////////////////////////////////////////////////////
+void VoidLBMKernel::calculate(int step)
+{
+
+}
+//////////////////////////////////////////////////////////////////////////
+double VoidLBMKernel::getCalculationTime()
+{
+   return 0.0;
+}
diff --git a/src/cpu/VirtualFluidsCore/LBM/VoidLBMKernel.h b/src/cpu/VirtualFluidsCore/LBM/VoidLBMKernel.h
index 68c59a23cf6179c17ec5090e85bc2b5d355f19d9..6d324600685d6b43cbf5a6535c5b653b4bcb7dee 100644
--- a/src/cpu/VirtualFluidsCore/LBM/VoidLBMKernel.h
+++ b/src/cpu/VirtualFluidsCore/LBM/VoidLBMKernel.h
@@ -1,18 +1,18 @@
-#ifndef VoidLBMKernel_h__
-#define VoidLBMKernel_h__
-
-#include "LBMKernel.h"
-
-class VoidLBMKernel : public LBMKernel
-{
-public:
-   VoidLBMKernel();
-   ~VoidLBMKernel();
-   SPtr<LBMKernel> clone();
-   void calculate(int step);
-   double getCalculationTime();
-   void initDataSet();
-protected:
-
-};
-#endif // VoidLBMKernel_h__
+#ifndef VoidLBMKernel_h__
+#define VoidLBMKernel_h__
+
+#include "LBMKernel.h"
+
+class VoidLBMKernel : public LBMKernel
+{
+public:
+   VoidLBMKernel();
+   ~VoidLBMKernel();
+   SPtr<LBMKernel> clone();
+   void calculate(int step);
+   double getCalculationTime();
+   void initDataSet();
+protected:
+
+};
+#endif // VoidLBMKernel_h__
diff --git a/src/cpu/VirtualFluidsCore/Parallel/BlocksDistributor.cpp b/src/cpu/VirtualFluidsCore/Parallel/BlocksDistributor.cpp
index aa834cc50234a694f2c93ab90032e55659ea7b78..aa010ef631bc11feb76373b704f4967da656d95d 100644
--- a/src/cpu/VirtualFluidsCore/Parallel/BlocksDistributor.cpp
+++ b/src/cpu/VirtualFluidsCore/Parallel/BlocksDistributor.cpp
@@ -1,7 +1,7 @@
-#include "BlocksDistributor.h"
-
-BlocksDistributor::BlocksDistributor(SPtr<Grid3D> grid, SPtr<Communicator> comm) : grid(grid), comm(comm)
-{
-
-}
-
+#include "BlocksDistributor.h"
+
+BlocksDistributor::BlocksDistributor(SPtr<Grid3D> grid, SPtr<Communicator> comm) : grid(grid), comm(comm)
+{
+
+}
+
diff --git a/src/cpu/VirtualFluidsCore/Parallel/BlocksDistributor.h b/src/cpu/VirtualFluidsCore/Parallel/BlocksDistributor.h
index da686dfac3b593ec5b226bf9341399a1b98dff3b..08ab5a8a8de0680d6c4f099c6356e47df2ce7e88 100644
--- a/src/cpu/VirtualFluidsCore/Parallel/BlocksDistributor.h
+++ b/src/cpu/VirtualFluidsCore/Parallel/BlocksDistributor.h
@@ -1,23 +1,23 @@
-#ifndef BlocksDistributor_H
-#define BlocksDistributor_H
-
-#include "Communicator.h"
-#include "Grid3D.h"
-
-#include <PointerDefinitions.h>
-
-class BlocksDistributor
-{
-public:
-   BlocksDistributor(SPtr<Grid3D> grid, SPtr<Communicator> comm);
-   ~BlocksDistributor();
-
-protected:
-private:
-   SPtr<Grid3D> grid;
-   SPtr<Communicator> comm;
-};
-
-#endif
-
-
+#ifndef BlocksDistributor_H
+#define BlocksDistributor_H
+
+#include "Communicator.h"
+#include "Grid3D.h"
+
+#include <PointerDefinitions.h>
+
+class BlocksDistributor
+{
+public:
+   BlocksDistributor(SPtr<Grid3D> grid, SPtr<Communicator> comm);
+   ~BlocksDistributor();
+
+protected:
+private:
+   SPtr<Grid3D> grid;
+   SPtr<Communicator> comm;
+};
+
+#endif
+
+
diff --git a/src/cpu/VirtualFluidsCore/Parallel/Communicator.cpp b/src/cpu/VirtualFluidsCore/Parallel/Communicator.cpp
index 34146b347e1fc86aed905b134896b05421ba2b41..2b6938267bda842f43e63fe521261803ff3273f6 100644
--- a/src/cpu/VirtualFluidsCore/Parallel/Communicator.cpp
+++ b/src/cpu/VirtualFluidsCore/Parallel/Communicator.cpp
@@ -1,45 +1,45 @@
-//=======================================================================================
-// ____          ____    __    ______     __________   __      __       __        __         
-// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
-//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
-//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
-//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
-//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
-//      \    \  |    |   ________________________________________________________________    
-//       \    \ |    |  |  ______________________________________________________________|   
-//        \    \|    |  |  |         __          __     __     __     ______      _______    
-//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
-//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
-//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
-//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
-//
-//  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 Communicator.cpp
-//! \ingroup Parallel
-//! \author Konstantin Kutscher
-//=======================================================================================
-
-#include "Communicator.h"
-#include <basics/utilities/UbException.h>
-
-SPtr<Communicator> Communicator::instance = SPtr<Communicator>();
-//////////////////////////////////////////////////////////////////////////
-SPtr<Communicator> Communicator::getInstance()
-{
-   if( !instance )
-      UB_THROW(UbException(UB_EXARGS,"Communicator isn't initialized correctly! You can not create a new instance of abstract Communicator class!"));
-   return instance;
-}
-
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 Communicator.cpp
+//! \ingroup Parallel
+//! \author Konstantin Kutscher
+//=======================================================================================
+
+#include "Communicator.h"
+#include <basics/utilities/UbException.h>
+
+SPtr<Communicator> Communicator::instance = SPtr<Communicator>();
+//////////////////////////////////////////////////////////////////////////
+SPtr<Communicator> Communicator::getInstance()
+{
+   if( !instance )
+      UB_THROW(UbException(UB_EXARGS,"Communicator isn't initialized correctly! You can not create a new instance of abstract Communicator class!"));
+   return instance;
+}
+
diff --git a/src/cpu/VirtualFluidsCore/Parallel/Communicator.h b/src/cpu/VirtualFluidsCore/Parallel/Communicator.h
index 347b211f7864409f21a67fbf8bdd4ccd23739e6c..69c90125bd7cd35836a6486b3197cd4eb1bf266e 100644
--- a/src/cpu/VirtualFluidsCore/Parallel/Communicator.h
+++ b/src/cpu/VirtualFluidsCore/Parallel/Communicator.h
@@ -1,92 +1,92 @@
-//=======================================================================================
-// ____          ____    __    ______     __________   __      __       __        __         
-// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
-//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
-//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
-//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
-//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
-//      \    \  |    |   ________________________________________________________________    
-//       \    \ |    |  |  ______________________________________________________________|   
-//        \    \|    |  |  |         __          __     __     __     ______      _______    
-//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
-//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
-//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
-//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
-//
-//  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 Communicator.h
-//! \ingroup Parallel
-//! \author Konstantin Kutscher
-//=======================================================================================
-
-#ifndef COMMUNICATOR_H
-#define COMMUNICATOR_H
-
-#include <vector>
-#include <string>
-
-#include <PointerDefinitions.h>
-
-//! \brief An abstract class for communication between processes in parallel computation
-class Communicator
-{
-public:
-   virtual ~Communicator(){}
-   static SPtr<Communicator> getInstance();
-   virtual int getBundleID() = 0;
-   virtual int getNumberOfBundles() = 0;
-   virtual int getProcessID() = 0;
-   virtual int getProcessID(int bundle, int rank) = 0;
-   virtual int getNumberOfProcesses() = 0;
-   virtual bool isRoot() = 0;
-   virtual void* getNativeCommunicator() = 0;
-
-   virtual void sendSerializedObject(std::stringstream& ss, int target) = 0;
-   virtual void receiveSerializedObject(std::stringstream& ss, int source) = 0;
-
-   virtual int getRoot() = 0;
-   virtual int getBundleRoot() = 0;
-   virtual int getProcessRoot() = 0;
-   virtual int getNumberOfProcessesInBundle(int bundle) = 0;
-   virtual void barrier() = 0;
-   virtual void abort(int errorcode) = 0;
-
-   virtual std::vector<std::string> gather(const std::string& str) = 0;
-   virtual std::vector<int> gather(std::vector<int>& values) = 0;
-   virtual std::vector<float> gather(std::vector<float>& values) = 0;
-   virtual std::vector<double> gather(std::vector<double>& values) = 0;
-   virtual std::vector<unsigned long long> gather(std::vector<unsigned long long>& values) = 0;
-
-   virtual void allGather(std::vector<int>& svalues, std::vector<int>& rvalues) = 0;
-   virtual void allGather(std::vector<float>& svalues, std::vector<float>& rvalues) = 0;
-   virtual void allGather(std::vector<double>& svalues, std::vector<double>& rvalues) = 0;
-   virtual void allGather(std::vector<unsigned long long>& svalues, std::vector<unsigned long long>& rvalues) = 0;
-   
-   virtual void broadcast(int& value) = 0;
-   virtual void broadcast(float& value) = 0;
-   virtual void broadcast(double& value) = 0;
-   virtual void broadcast(long int& value) = 0;
-   virtual void broadcast(std::vector<int>& values) = 0;
-   virtual void broadcast(std::vector<float>& values) = 0;
-   virtual void broadcast(std::vector<double>& values) = 0;
-   virtual void broadcast(std::vector<long int>& values) = 0;
-protected:
-   Communicator(){}
-   Communicator( const Communicator& ){}
-   static SPtr<Communicator> instance;
-};
-
-#endif
-
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 Communicator.h
+//! \ingroup Parallel
+//! \author Konstantin Kutscher
+//=======================================================================================
+
+#ifndef COMMUNICATOR_H
+#define COMMUNICATOR_H
+
+#include <vector>
+#include <string>
+
+#include <PointerDefinitions.h>
+
+//! \brief An abstract class for communication between processes in parallel computation
+class Communicator
+{
+public:
+   virtual ~Communicator(){}
+   static SPtr<Communicator> getInstance();
+   virtual int getBundleID() = 0;
+   virtual int getNumberOfBundles() = 0;
+   virtual int getProcessID() = 0;
+   virtual int getProcessID(int bundle, int rank) = 0;
+   virtual int getNumberOfProcesses() = 0;
+   virtual bool isRoot() = 0;
+   virtual void* getNativeCommunicator() = 0;
+
+   virtual void sendSerializedObject(std::stringstream& ss, int target) = 0;
+   virtual void receiveSerializedObject(std::stringstream& ss, int source) = 0;
+
+   virtual int getRoot() = 0;
+   virtual int getBundleRoot() = 0;
+   virtual int getProcessRoot() = 0;
+   virtual int getNumberOfProcessesInBundle(int bundle) = 0;
+   virtual void barrier() = 0;
+   virtual void abort(int errorcode) = 0;
+
+   virtual std::vector<std::string> gather(const std::string& str) = 0;
+   virtual std::vector<int> gather(std::vector<int>& values) = 0;
+   virtual std::vector<float> gather(std::vector<float>& values) = 0;
+   virtual std::vector<double> gather(std::vector<double>& values) = 0;
+   virtual std::vector<unsigned long long> gather(std::vector<unsigned long long>& values) = 0;
+
+   virtual void allGather(std::vector<int>& svalues, std::vector<int>& rvalues) = 0;
+   virtual void allGather(std::vector<float>& svalues, std::vector<float>& rvalues) = 0;
+   virtual void allGather(std::vector<double>& svalues, std::vector<double>& rvalues) = 0;
+   virtual void allGather(std::vector<unsigned long long>& svalues, std::vector<unsigned long long>& rvalues) = 0;
+   
+   virtual void broadcast(int& value) = 0;
+   virtual void broadcast(float& value) = 0;
+   virtual void broadcast(double& value) = 0;
+   virtual void broadcast(long int& value) = 0;
+   virtual void broadcast(std::vector<int>& values) = 0;
+   virtual void broadcast(std::vector<float>& values) = 0;
+   virtual void broadcast(std::vector<double>& values) = 0;
+   virtual void broadcast(std::vector<long int>& values) = 0;
+protected:
+   Communicator(){}
+   Communicator( const Communicator& ){}
+   static SPtr<Communicator> instance;
+};
+
+#endif
+
diff --git a/src/cpu/VirtualFluidsCore/Parallel/MPICommunicator.cpp b/src/cpu/VirtualFluidsCore/Parallel/MPICommunicator.cpp
index cbd3cdf105c5567227b044ce1f3188cec680fde6..b8a81e7ee2613a355498b3d805efde4c7a50193b 100644
--- a/src/cpu/VirtualFluidsCore/Parallel/MPICommunicator.cpp
+++ b/src/cpu/VirtualFluidsCore/Parallel/MPICommunicator.cpp
@@ -1,245 +1,245 @@
-#if defined VF_MPI
-
-#include "MPICommunicator.h"
-#include <mpi.h>
-
-#include <sstream>
-using namespace std;
-//////////////////////////////////////////////////////////////////////////
-MPICommunicator::MPICommunicator()
-{
-   //proof if MPI is initialized 
-   int mpiInitialized = (int)false;
-   MPI_Initialized(&mpiInitialized);
-   if (!mpiInitialized)
-   {
-      MPI_Init(NULL, NULL);	
-      //MPI_Init_thread(NULL, NULL, MPI_THREAD_FUNNELED, NULL);
-   }
-   MPI_Comm_rank(MPI_COMM_WORLD, &PID);
-   MPI_Comm_size(MPI_COMM_WORLD, &numprocs);
-   //numprocs = 1000;
-   comm = MPI_COMM_WORLD;
-   root = 0;
-}
-//////////////////////////////////////////////////////////////////////////
-MPICommunicator::~MPICommunicator()
-{
-   //proof if MPI is finalized
-   int _mpiFinalized = (int)false;
-   MPI_Finalized(&_mpiFinalized);
-   if (!_mpiFinalized)
-   {
-      MPI_Finalize();
-      //UBLOG(logINFO, "MPI_Finalize()");
-   }
- }
-//////////////////////////////////////////////////////////////////////////
-SPtr<Communicator> MPICommunicator::getInstance()
-{
-   if( !Communicator::instance )
-      Communicator::instance = SPtr<Communicator>(new MPICommunicator());
-   return Communicator::instance;
-}
-//////////////////////////////////////////////////////////////////////////
-void MPICommunicator::abort(int errorcode)
-{
-   MPI_Abort(comm, errorcode);
-}
-////////////////////////////////////////////////////////////////////////////
-vector<string> MPICommunicator::gather(const string& str)
-{
-   vector<string> parts;
-   vector<string> strings;
-   int scount;
-   vector<char> rbuf(1);
-   vector<int> rcounts(1);
-   MPI_Status status;
-
-   if (PID == root)
-   {
-      rcounts.resize(numprocs - 1);
-      strings.push_back(str);
-
-      for (int i = 1; i < numprocs; i++)
-      {
-         MPI_Recv(&rcounts[i-1], 1, MPI_INT, i, 0, comm, &status);
-      }
-      for (int i = 1; i < numprocs; i++)
-      {
-         rbuf.resize(rcounts[i-1]);
-         MPI_Recv(&rbuf[0], rcounts[i-1], MPI_CHAR, i, 0, comm, &status);
-         string s(&rbuf[0], rcounts[i-1]);
-         if (s != "") strings.push_back(s);
-      }
-   }
-   else
-   {
-      scount = (int)str.length();
-      MPI_Send(&scount, 1, MPI_INT, root, 0, comm);
-      MPI_Send((char *)str.c_str(), scount, MPI_CHAR, root, 0, comm);
-   }
-   return strings;
-}
-//////////////////////////////////////////////////////////////////////////
-vector<int> MPICommunicator::gather(vector<int>& values)
-{
-   return gather<int>(values);
-}
-//////////////////////////////////////////////////////////////////////////
-vector<float> MPICommunicator::gather(vector<float>& values)
-{
-   return gather<float>(values);
-}
-//////////////////////////////////////////////////////////////////////////
-vector<double> MPICommunicator::gather(vector<double>& values)
-{
-   return gather<double>(values);
-}
-//////////////////////////////////////////////////////////////////////////
-std::vector<unsigned long long> MPICommunicator::gather(std::vector<unsigned long long>& values)
-{
-   return gather<unsigned long long>(values);
-}
-//////////////////////////////////////////////////////////////////////////
-int MPICommunicator::getProcessID()
-{
-   return PID;
-}
-//////////////////////////////////////////////////////////////////////////
-int MPICommunicator::getProcessID(int bundle, int rank)
-{
-   return PID;
-}
-//////////////////////////////////////////////////////////////////////////
-int MPICommunicator::getNumberOfProcesses()
-{
-   return numprocs;
-}
-//////////////////////////////////////////////////////////////////////////
-void* MPICommunicator::getNativeCommunicator()
-{
-   return &comm;
-}
-//////////////////////////////////////////////////////////////////////////
-int MPICommunicator::getBundleID()
-{
-   return 0;
-}
-//////////////////////////////////////////////////////////////////////////
-int MPICommunicator::getNumberOfBundles()
-{
-   return 1;
-}
-//////////////////////////////////////////////////////////////////////////
-int MPICommunicator::getRoot() 
-{
-   return root;
-}
-//////////////////////////////////////////////////////////////////////////
-int MPICommunicator::getBundleRoot() 
-{
-   return 0;
-}
-//////////////////////////////////////////////////////////////////////////
-int MPICommunicator::getProcessRoot() 
-{
-   return 0;
-}
-//////////////////////////////////////////////////////////////////////////
-int MPICommunicator::getNumberOfProcessesInBundle(int bundle)
-{
-   return numprocs;
-}
-//////////////////////////////////////////////////////////////////////////
-bool MPICommunicator::isRoot()
-{
-   return PID == root;
-}
-//////////////////////////////////////////////////////////////////////////
-void MPICommunicator::sendSerializedObject( std::stringstream& ss, int target)
-{
-   string str = ss.str();
-   int scount = static_cast<int> (str.length());
-   MPI_Send(&scount,1,MPI_INT,target,0,comm);
-   MPI_Send((char *)str.c_str(),scount,MPI_CHAR,target,0,comm);
-}
-//////////////////////////////////////////////////////////////////////////
-void MPICommunicator::receiveSerializedObject( std::stringstream& ss, int source )
-{
-   vector<char> rbuf;
-   int rcount;
-   MPI_Status status;
-   MPI_Recv(&rcount,1,MPI_INT,source,0,comm,&status);
-   rbuf.resize(rcount);
-   MPI_Recv(&rbuf[0],rcount,MPI_CHAR,source,0,comm,&status);
-   ss.rdbuf()->pubsetbuf(&rbuf[0],rcount);
-   string str (&rbuf[0]);
-   ss.str(str);
-}
-//////////////////////////////////////////////////////////////////////////
-void MPICommunicator::barrier()
-{
-   MPI_Barrier(comm);
-}
-//////////////////////////////////////////////////////////////////////////
-void MPICommunicator::allGather(std::vector<int>& svalues, std::vector<int>& rvalues)
-{
-   allGather<int>(svalues, rvalues);
-}
-//////////////////////////////////////////////////////////////////////////
-void MPICommunicator::allGather(std::vector<float>& svalues, std::vector<float>& rvalues)
-{
-   allGather<float>(svalues, rvalues);
-}
-//////////////////////////////////////////////////////////////////////////
-void MPICommunicator::allGather(std::vector<double>& svalues, std::vector<double>& rvalues)
-{
-   allGather<double>(svalues, rvalues);
-}
-//////////////////////////////////////////////////////////////////////////
-void MPICommunicator::allGather(std::vector<unsigned long long>& svalues, std::vector<unsigned long long>& rvalues)
-{
-   allGather<unsigned long long>(svalues, rvalues);
-}
-//////////////////////////////////////////////////////////////////////////
-void MPICommunicator::broadcast(std::vector<int>& values)
-{
-   broadcast<int>(values);
-}
-//////////////////////////////////////////////////////////////////////////
-void MPICommunicator::broadcast(std::vector<float>& values)
-{
-   broadcast<float>(values);
-}
-//////////////////////////////////////////////////////////////////////////
-void MPICommunicator::broadcast(std::vector<double>& values)
-{
-   broadcast<double>(values);
-}
-//////////////////////////////////////////////////////////////////////////
-void MPICommunicator::broadcast(std::vector<long int>& values)
-{
-   broadcast<long int>(values);
-}
-//////////////////////////////////////////////////////////////////////////
-void MPICommunicator::broadcast(int& value)
-{
-   broadcast<int>(value);
-}
-//////////////////////////////////////////////////////////////////////////
-void MPICommunicator::broadcast(float& value)
-{
-   broadcast<float>(value);
-}
-//////////////////////////////////////////////////////////////////////////
-void MPICommunicator::broadcast(double& value)
-{
-   broadcast<double>(value);
-}
-//////////////////////////////////////////////////////////////////////////
-void MPICommunicator::broadcast(long int& value)
-{
-   broadcast<long int>(value);
-}
-#endif
+#if defined VF_MPI
+
+#include "MPICommunicator.h"
+#include <mpi.h>
+
+#include <sstream>
+using namespace std;
+//////////////////////////////////////////////////////////////////////////
+MPICommunicator::MPICommunicator()
+{
+   //proof if MPI is initialized 
+   int mpiInitialized = (int)false;
+   MPI_Initialized(&mpiInitialized);
+   if (!mpiInitialized)
+   {
+      MPI_Init(NULL, NULL);	
+      //MPI_Init_thread(NULL, NULL, MPI_THREAD_FUNNELED, NULL);
+   }
+   MPI_Comm_rank(MPI_COMM_WORLD, &PID);
+   MPI_Comm_size(MPI_COMM_WORLD, &numprocs);
+   //numprocs = 1000;
+   comm = MPI_COMM_WORLD;
+   root = 0;
+}
+//////////////////////////////////////////////////////////////////////////
+MPICommunicator::~MPICommunicator()
+{
+   //proof if MPI is finalized
+   int _mpiFinalized = (int)false;
+   MPI_Finalized(&_mpiFinalized);
+   if (!_mpiFinalized)
+   {
+      MPI_Finalize();
+      //UBLOG(logINFO, "MPI_Finalize()");
+   }
+ }
+//////////////////////////////////////////////////////////////////////////
+SPtr<Communicator> MPICommunicator::getInstance()
+{
+   if( !Communicator::instance )
+      Communicator::instance = SPtr<Communicator>(new MPICommunicator());
+   return Communicator::instance;
+}
+//////////////////////////////////////////////////////////////////////////
+void MPICommunicator::abort(int errorcode)
+{
+   MPI_Abort(comm, errorcode);
+}
+////////////////////////////////////////////////////////////////////////////
+vector<string> MPICommunicator::gather(const string& str)
+{
+   vector<string> parts;
+   vector<string> strings;
+   int scount;
+   vector<char> rbuf(1);
+   vector<int> rcounts(1);
+   MPI_Status status;
+
+   if (PID == root)
+   {
+      rcounts.resize(numprocs - 1);
+      strings.push_back(str);
+
+      for (int i = 1; i < numprocs; i++)
+      {
+         MPI_Recv(&rcounts[i-1], 1, MPI_INT, i, 0, comm, &status);
+      }
+      for (int i = 1; i < numprocs; i++)
+      {
+         rbuf.resize(rcounts[i-1]);
+         MPI_Recv(&rbuf[0], rcounts[i-1], MPI_CHAR, i, 0, comm, &status);
+         string s(&rbuf[0], rcounts[i-1]);
+         if (s != "") strings.push_back(s);
+      }
+   }
+   else
+   {
+      scount = (int)str.length();
+      MPI_Send(&scount, 1, MPI_INT, root, 0, comm);
+      MPI_Send((char *)str.c_str(), scount, MPI_CHAR, root, 0, comm);
+   }
+   return strings;
+}
+//////////////////////////////////////////////////////////////////////////
+vector<int> MPICommunicator::gather(vector<int>& values)
+{
+   return gather<int>(values);
+}
+//////////////////////////////////////////////////////////////////////////
+vector<float> MPICommunicator::gather(vector<float>& values)
+{
+   return gather<float>(values);
+}
+//////////////////////////////////////////////////////////////////////////
+vector<double> MPICommunicator::gather(vector<double>& values)
+{
+   return gather<double>(values);
+}
+//////////////////////////////////////////////////////////////////////////
+std::vector<unsigned long long> MPICommunicator::gather(std::vector<unsigned long long>& values)
+{
+   return gather<unsigned long long>(values);
+}
+//////////////////////////////////////////////////////////////////////////
+int MPICommunicator::getProcessID()
+{
+   return PID;
+}
+//////////////////////////////////////////////////////////////////////////
+int MPICommunicator::getProcessID(int bundle, int rank)
+{
+   return PID;
+}
+//////////////////////////////////////////////////////////////////////////
+int MPICommunicator::getNumberOfProcesses()
+{
+   return numprocs;
+}
+//////////////////////////////////////////////////////////////////////////
+void* MPICommunicator::getNativeCommunicator()
+{
+   return &comm;
+}
+//////////////////////////////////////////////////////////////////////////
+int MPICommunicator::getBundleID()
+{
+   return 0;
+}
+//////////////////////////////////////////////////////////////////////////
+int MPICommunicator::getNumberOfBundles()
+{
+   return 1;
+}
+//////////////////////////////////////////////////////////////////////////
+int MPICommunicator::getRoot() 
+{
+   return root;
+}
+//////////////////////////////////////////////////////////////////////////
+int MPICommunicator::getBundleRoot() 
+{
+   return 0;
+}
+//////////////////////////////////////////////////////////////////////////
+int MPICommunicator::getProcessRoot() 
+{
+   return 0;
+}
+//////////////////////////////////////////////////////////////////////////
+int MPICommunicator::getNumberOfProcessesInBundle(int bundle)
+{
+   return numprocs;
+}
+//////////////////////////////////////////////////////////////////////////
+bool MPICommunicator::isRoot()
+{
+   return PID == root;
+}
+//////////////////////////////////////////////////////////////////////////
+void MPICommunicator::sendSerializedObject( std::stringstream& ss, int target)
+{
+   string str = ss.str();
+   int scount = static_cast<int> (str.length());
+   MPI_Send(&scount,1,MPI_INT,target,0,comm);
+   MPI_Send((char *)str.c_str(),scount,MPI_CHAR,target,0,comm);
+}
+//////////////////////////////////////////////////////////////////////////
+void MPICommunicator::receiveSerializedObject( std::stringstream& ss, int source )
+{
+   vector<char> rbuf;
+   int rcount;
+   MPI_Status status;
+   MPI_Recv(&rcount,1,MPI_INT,source,0,comm,&status);
+   rbuf.resize(rcount);
+   MPI_Recv(&rbuf[0],rcount,MPI_CHAR,source,0,comm,&status);
+   ss.rdbuf()->pubsetbuf(&rbuf[0],rcount);
+   string str (&rbuf[0]);
+   ss.str(str);
+}
+//////////////////////////////////////////////////////////////////////////
+void MPICommunicator::barrier()
+{
+   MPI_Barrier(comm);
+}
+//////////////////////////////////////////////////////////////////////////
+void MPICommunicator::allGather(std::vector<int>& svalues, std::vector<int>& rvalues)
+{
+   allGather<int>(svalues, rvalues);
+}
+//////////////////////////////////////////////////////////////////////////
+void MPICommunicator::allGather(std::vector<float>& svalues, std::vector<float>& rvalues)
+{
+   allGather<float>(svalues, rvalues);
+}
+//////////////////////////////////////////////////////////////////////////
+void MPICommunicator::allGather(std::vector<double>& svalues, std::vector<double>& rvalues)
+{
+   allGather<double>(svalues, rvalues);
+}
+//////////////////////////////////////////////////////////////////////////
+void MPICommunicator::allGather(std::vector<unsigned long long>& svalues, std::vector<unsigned long long>& rvalues)
+{
+   allGather<unsigned long long>(svalues, rvalues);
+}
+//////////////////////////////////////////////////////////////////////////
+void MPICommunicator::broadcast(std::vector<int>& values)
+{
+   broadcast<int>(values);
+}
+//////////////////////////////////////////////////////////////////////////
+void MPICommunicator::broadcast(std::vector<float>& values)
+{
+   broadcast<float>(values);
+}
+//////////////////////////////////////////////////////////////////////////
+void MPICommunicator::broadcast(std::vector<double>& values)
+{
+   broadcast<double>(values);
+}
+//////////////////////////////////////////////////////////////////////////
+void MPICommunicator::broadcast(std::vector<long int>& values)
+{
+   broadcast<long int>(values);
+}
+//////////////////////////////////////////////////////////////////////////
+void MPICommunicator::broadcast(int& value)
+{
+   broadcast<int>(value);
+}
+//////////////////////////////////////////////////////////////////////////
+void MPICommunicator::broadcast(float& value)
+{
+   broadcast<float>(value);
+}
+//////////////////////////////////////////////////////////////////////////
+void MPICommunicator::broadcast(double& value)
+{
+   broadcast<double>(value);
+}
+//////////////////////////////////////////////////////////////////////////
+void MPICommunicator::broadcast(long int& value)
+{
+   broadcast<long int>(value);
+}
+#endif
diff --git a/src/cpu/VirtualFluidsCore/Parallel/MPICommunicator.h b/src/cpu/VirtualFluidsCore/Parallel/MPICommunicator.h
index 041029e045f97f7285fee8f4b2fcbf2e4b89e9aa..c0fcf1cfc55607e4f9575ea0f5d91a1ed4da9b1d 100644
--- a/src/cpu/VirtualFluidsCore/Parallel/MPICommunicator.h
+++ b/src/cpu/VirtualFluidsCore/Parallel/MPICommunicator.h
@@ -1,190 +1,190 @@
-#if defined VF_MPI
-
-#ifndef MPICOMMUNICATOR_H
-#define MPICOMMUNICATOR_H
-
-#include <mpi.h>
-#include <vector>
-#include <string>
-#include <PointerDefinitions.h>
-#include <basics/utilities/UbException.h>
-#include <basics/utilities/UbLogger.h>
-#include "Communicator.h"
-
-
-//! \brief A class uses MPI library to communication.
-//! \details Support MPI communication. Implements singleton pattern.
-//! \author K. Kutscher
-
-class MPICommunicator : public Communicator
-{
-private:
-   MPICommunicator();
-   MPICommunicator( const MPICommunicator& ){}
-public:
-   ~MPICommunicator();
-   static SPtr<Communicator> getInstance();
-   int getBundleID();
-   int getNumberOfBundles();
-   int getProcessID();
-   int getProcessID(int bundle, int rank);
-   int getNumberOfProcesses();
-   void* getNativeCommunicator();
-   int getRoot();
-   int getBundleRoot();
-   int getProcessRoot();
-   int getNumberOfProcessesInBundle(int bundle);
-   bool isRoot();
-   void abort(int errorcode);
-
-   void sendSerializedObject(std::stringstream& ss, int target);
-   void receiveSerializedObject(std::stringstream& ss, int source);
-
-   void barrier();
-
-   std::vector<std::string> gather(const std::string& str);
-   std::vector<int> gather(std::vector<int>& values);
-   std::vector<float> gather(std::vector<float>& values);
-   std::vector<double> gather(std::vector<double>& values);
-   std::vector<unsigned long long> gather(std::vector<unsigned long long>& values);
-
-   void allGather(std::vector<int>& svalues, std::vector<int>& rvalues);
-   void allGather(std::vector<float>& svalues, std::vector<float>& rvalues);
-   void allGather(std::vector<double>& svalues, std::vector<double>& rvalues);
-   void allGather(std::vector<unsigned long long>& svalues, std::vector<unsigned long long>& rvalues);
-
-   void broadcast(int& value);
-   void broadcast(float& value);
-   void broadcast(double& value);
-   void broadcast(long int& value);
-   void broadcast(std::vector<int>& values);
-   void broadcast(std::vector<float>& values);
-   void broadcast(std::vector<double>& values);
-   void broadcast(std::vector<long int>& values);
-
-   template <class T>
-   std::vector<T> gather(std::vector<T>& values);
-
-   template <class T>
-   void allGather(std::vector<T>& svalues, std::vector<T>& rvalues);
-
-   template <class T>
-   void broadcast(std::vector<T>& values);
-
-   template <class T>
-   void broadcast(T& value);
-
-private:
-   int numprocs, PID;
-   MPI_Comm comm;
-   int root;
-};
-
-//////////////////////////////////////////////////////////////////////////
-template <class T>
-std::vector<T> MPICommunicator::gather(std::vector<T>& values)
-{
-   MPI_Datatype mpiDataType;
-   if ((std::string)typeid(T).name()==(std::string)typeid(double).name()) mpiDataType = MPI_DOUBLE;
-   else if ((std::string)typeid(T).name()==(std::string)typeid(float).name()) mpiDataType = MPI_FLOAT;
-   else if ((std::string)typeid(T).name()==(std::string)typeid(int).name()) mpiDataType = MPI_INT;
-   else if ((std::string)typeid(T).name()==(std::string)typeid(unsigned long long).name()) mpiDataType = MPI_UNSIGNED_LONG_LONG;
-   else throw UbException(UB_EXARGS, "no MpiDataType for T"+(std::string)typeid(T).name());
-
-   int count = static_cast<int> (values.size());
-   std::vector<T> rvalues(1);
-
-   if (PID == root)
-   {
-      rvalues.resize(numprocs*count);
-   }
-
-   MPI_Gather(&values[0], count, mpiDataType, &rvalues[0], count, mpiDataType, root, comm);
-
-   return rvalues;
-}
-//////////////////////////////////////////////////////////////////////////
-template <class T>
-void MPICommunicator::allGather(std::vector<T>& svalues, std::vector<T>& rvalues)
-{
-   MPI_Datatype mpiDataType;
-   if ((std::string)typeid(T).name()==(std::string)typeid(double).name()) mpiDataType = MPI_DOUBLE;
-   else if ((std::string)typeid(T).name()==(std::string)typeid(float).name()) mpiDataType = MPI_FLOAT;
-   else if ((std::string)typeid(T).name()==(std::string)typeid(int).name()) mpiDataType = MPI_INT;
-   else if ((std::string)typeid(T).name()==(std::string)typeid(unsigned long long).name()) mpiDataType = MPI_UNSIGNED_LONG_LONG;
-   else throw UbException(UB_EXARGS, "no MpiDataType for T"+(std::string)typeid(T).name());
-
-   int scount;
-   std::vector<int> displs, rcounts;
-
-   scount = (int)(svalues.size());
-
-   rcounts.resize(numprocs);
-   MPI_Allgather(&scount, 1, MPI_INT, &rcounts[0], 1, MPI_INT, comm);
-   displs.resize(numprocs);
-
-   displs[0] = 0;
-   for (int i=1; i<numprocs; ++i)
-   {
-      displs[i] = displs[i-1]+rcounts[i-1];
-   }
-
-   rvalues.resize(displs[numprocs-1]+rcounts[numprocs-1]);
-
-   if (rvalues.size() == 0)
-   {
-      rvalues.resize(1);
-      rvalues[0] = -999;
-   }
-   if (scount == 0)
-   {
-      svalues.resize(1);
-      svalues[0] = -999;
-   }
-
-   MPI_Allgatherv(&svalues[0], scount, mpiDataType, &rvalues[0], &rcounts[0], &displs[0], mpiDataType, comm);
-}
-//////////////////////////////////////////////////////////////////////////
-template <class T>
-void MPICommunicator::broadcast(std::vector<T>& values)
-{
-   MPI_Datatype mpiDataType;
-   if ((std::string)typeid(T).name()==(std::string)typeid(double).name()) mpiDataType = MPI_DOUBLE;
-   else if ((std::string)typeid(T).name()==(std::string)typeid(float).name()) mpiDataType = MPI_FLOAT;
-   else if ((std::string)typeid(T).name()==(std::string)typeid(int).name()) mpiDataType = MPI_INT;
-   else if ((std::string)typeid(T).name()==(std::string)typeid(long int).name()) mpiDataType = MPI_LONG_INT;
-   else throw UbException(UB_EXARGS, "no MpiDataType for T"+(std::string)typeid(T).name());
-
-   int rcount;
-   if (this->PID == this->root)
-   {
-      rcount = (int)values.size();
-   }
-
-   MPI_Bcast(&rcount, 1, MPI_INT, this->root, comm);
-
-   if (this->PID != this->root)
-   {
-      values.resize(rcount);
-   }
-
-   MPI_Bcast(&values[0], (int)values.size(), mpiDataType, this->root, comm);
-}
-//////////////////////////////////////////////////////////////////////////
-template <class T>
-void MPICommunicator::broadcast(T& value)
-{
-   MPI_Datatype mpiDataType;
-   if ((std::string)typeid(T).name() == (std::string)typeid(double).name()) mpiDataType = MPI_DOUBLE;
-   else if ((std::string)typeid(T).name() == (std::string)typeid(float).name()) mpiDataType = MPI_FLOAT;
-   else if ((std::string)typeid(T).name() == (std::string)typeid(int).name()) mpiDataType = MPI_INT;
-   else if ((std::string)typeid(T).name()==(std::string)typeid(long int).name()) mpiDataType = MPI_LONG_INT;
-   else throw UbException(UB_EXARGS, "no MpiDataType for T" + (std::string)typeid(T).name());
-
-   MPI_Bcast(&value, 1, mpiDataType, this->root, comm);
-}
-//////////////////////////////////////////////////////////////////////////
-
-#endif
-
-#endif
+#if defined VF_MPI
+
+#ifndef MPICOMMUNICATOR_H
+#define MPICOMMUNICATOR_H
+
+#include <mpi.h>
+#include <vector>
+#include <string>
+#include <PointerDefinitions.h>
+#include <basics/utilities/UbException.h>
+#include <basics/utilities/UbLogger.h>
+#include "Communicator.h"
+
+
+//! \brief A class uses MPI library to communication.
+//! \details Support MPI communication. Implements singleton pattern.
+//! \author K. Kutscher
+
+class MPICommunicator : public Communicator
+{
+private:
+   MPICommunicator();
+   MPICommunicator( const MPICommunicator& ){}
+public:
+   ~MPICommunicator();
+   static SPtr<Communicator> getInstance();
+   int getBundleID();
+   int getNumberOfBundles();
+   int getProcessID();
+   int getProcessID(int bundle, int rank);
+   int getNumberOfProcesses();
+   void* getNativeCommunicator();
+   int getRoot();
+   int getBundleRoot();
+   int getProcessRoot();
+   int getNumberOfProcessesInBundle(int bundle);
+   bool isRoot();
+   void abort(int errorcode);
+
+   void sendSerializedObject(std::stringstream& ss, int target);
+   void receiveSerializedObject(std::stringstream& ss, int source);
+
+   void barrier();
+
+   std::vector<std::string> gather(const std::string& str);
+   std::vector<int> gather(std::vector<int>& values);
+   std::vector<float> gather(std::vector<float>& values);
+   std::vector<double> gather(std::vector<double>& values);
+   std::vector<unsigned long long> gather(std::vector<unsigned long long>& values);
+
+   void allGather(std::vector<int>& svalues, std::vector<int>& rvalues);
+   void allGather(std::vector<float>& svalues, std::vector<float>& rvalues);
+   void allGather(std::vector<double>& svalues, std::vector<double>& rvalues);
+   void allGather(std::vector<unsigned long long>& svalues, std::vector<unsigned long long>& rvalues);
+
+   void broadcast(int& value);
+   void broadcast(float& value);
+   void broadcast(double& value);
+   void broadcast(long int& value);
+   void broadcast(std::vector<int>& values);
+   void broadcast(std::vector<float>& values);
+   void broadcast(std::vector<double>& values);
+   void broadcast(std::vector<long int>& values);
+
+   template <class T>
+   std::vector<T> gather(std::vector<T>& values);
+
+   template <class T>
+   void allGather(std::vector<T>& svalues, std::vector<T>& rvalues);
+
+   template <class T>
+   void broadcast(std::vector<T>& values);
+
+   template <class T>
+   void broadcast(T& value);
+
+private:
+   int numprocs, PID;
+   MPI_Comm comm;
+   int root;
+};
+
+//////////////////////////////////////////////////////////////////////////
+template <class T>
+std::vector<T> MPICommunicator::gather(std::vector<T>& values)
+{
+   MPI_Datatype mpiDataType;
+   if ((std::string)typeid(T).name()==(std::string)typeid(double).name()) mpiDataType = MPI_DOUBLE;
+   else if ((std::string)typeid(T).name()==(std::string)typeid(float).name()) mpiDataType = MPI_FLOAT;
+   else if ((std::string)typeid(T).name()==(std::string)typeid(int).name()) mpiDataType = MPI_INT;
+   else if ((std::string)typeid(T).name()==(std::string)typeid(unsigned long long).name()) mpiDataType = MPI_UNSIGNED_LONG_LONG;
+   else throw UbException(UB_EXARGS, "no MpiDataType for T"+(std::string)typeid(T).name());
+
+   int count = static_cast<int> (values.size());
+   std::vector<T> rvalues(1);
+
+   if (PID == root)
+   {
+      rvalues.resize(numprocs*count);
+   }
+
+   MPI_Gather(&values[0], count, mpiDataType, &rvalues[0], count, mpiDataType, root, comm);
+
+   return rvalues;
+}
+//////////////////////////////////////////////////////////////////////////
+template <class T>
+void MPICommunicator::allGather(std::vector<T>& svalues, std::vector<T>& rvalues)
+{
+   MPI_Datatype mpiDataType;
+   if ((std::string)typeid(T).name()==(std::string)typeid(double).name()) mpiDataType = MPI_DOUBLE;
+   else if ((std::string)typeid(T).name()==(std::string)typeid(float).name()) mpiDataType = MPI_FLOAT;
+   else if ((std::string)typeid(T).name()==(std::string)typeid(int).name()) mpiDataType = MPI_INT;
+   else if ((std::string)typeid(T).name()==(std::string)typeid(unsigned long long).name()) mpiDataType = MPI_UNSIGNED_LONG_LONG;
+   else throw UbException(UB_EXARGS, "no MpiDataType for T"+(std::string)typeid(T).name());
+
+   int scount;
+   std::vector<int> displs, rcounts;
+
+   scount = (int)(svalues.size());
+
+   rcounts.resize(numprocs);
+   MPI_Allgather(&scount, 1, MPI_INT, &rcounts[0], 1, MPI_INT, comm);
+   displs.resize(numprocs);
+
+   displs[0] = 0;
+   for (int i=1; i<numprocs; ++i)
+   {
+      displs[i] = displs[i-1]+rcounts[i-1];
+   }
+
+   rvalues.resize(displs[numprocs-1]+rcounts[numprocs-1]);
+
+   if (rvalues.size() == 0)
+   {
+      rvalues.resize(1);
+      rvalues[0] = -999;
+   }
+   if (scount == 0)
+   {
+      svalues.resize(1);
+      svalues[0] = -999;
+   }
+
+   MPI_Allgatherv(&svalues[0], scount, mpiDataType, &rvalues[0], &rcounts[0], &displs[0], mpiDataType, comm);
+}
+//////////////////////////////////////////////////////////////////////////
+template <class T>
+void MPICommunicator::broadcast(std::vector<T>& values)
+{
+   MPI_Datatype mpiDataType;
+   if ((std::string)typeid(T).name()==(std::string)typeid(double).name()) mpiDataType = MPI_DOUBLE;
+   else if ((std::string)typeid(T).name()==(std::string)typeid(float).name()) mpiDataType = MPI_FLOAT;
+   else if ((std::string)typeid(T).name()==(std::string)typeid(int).name()) mpiDataType = MPI_INT;
+   else if ((std::string)typeid(T).name()==(std::string)typeid(long int).name()) mpiDataType = MPI_LONG_INT;
+   else throw UbException(UB_EXARGS, "no MpiDataType for T"+(std::string)typeid(T).name());
+
+   int rcount;
+   if (this->PID == this->root)
+   {
+      rcount = (int)values.size();
+   }
+
+   MPI_Bcast(&rcount, 1, MPI_INT, this->root, comm);
+
+   if (this->PID != this->root)
+   {
+      values.resize(rcount);
+   }
+
+   MPI_Bcast(&values[0], (int)values.size(), mpiDataType, this->root, comm);
+}
+//////////////////////////////////////////////////////////////////////////
+template <class T>
+void MPICommunicator::broadcast(T& value)
+{
+   MPI_Datatype mpiDataType;
+   if ((std::string)typeid(T).name() == (std::string)typeid(double).name()) mpiDataType = MPI_DOUBLE;
+   else if ((std::string)typeid(T).name() == (std::string)typeid(float).name()) mpiDataType = MPI_FLOAT;
+   else if ((std::string)typeid(T).name() == (std::string)typeid(int).name()) mpiDataType = MPI_INT;
+   else if ((std::string)typeid(T).name()==(std::string)typeid(long int).name()) mpiDataType = MPI_LONG_INT;
+   else throw UbException(UB_EXARGS, "no MpiDataType for T" + (std::string)typeid(T).name());
+
+   MPI_Bcast(&value, 1, mpiDataType, this->root, comm);
+}
+//////////////////////////////////////////////////////////////////////////
+
+#endif
+
+#endif
diff --git a/src/cpu/VirtualFluidsCore/Parallel/MetisPartitioner.cpp b/src/cpu/VirtualFluidsCore/Parallel/MetisPartitioner.cpp
index c4765ed00e81d818f6f59e20166d75070e24ed63..55ab9e5467c777590441661a58907b496650090f 100644
--- a/src/cpu/VirtualFluidsCore/Parallel/MetisPartitioner.cpp
+++ b/src/cpu/VirtualFluidsCore/Parallel/MetisPartitioner.cpp
@@ -1,81 +1,81 @@
-#if defined VF_METIS
-
-#include "MetisPartitioner.h"
-
-
-MetisPartitioner::MetisPartitioner()
-{
-   METIS_SetDefaultOptions(options);
-   options[METIS_OPTION_NUMBERING] = 0;
-   vsize = NULL;
-   tpwgts = NULL;
-   ubvec = NULL;
-
-   //options[METIS_OPTION_OBJTYPE] = METIS_OBJTYPE_CUT;
-   ////options[METIS_OPTION_OBJTYPE] = METIS_OBJTYPE_VOL;
-
-   //options[METIS_OPTION_CTYPE]  = METIS_CTYPE_SHEM;
-   //options[METIS_OPTION_IPTYPE] = METIS_IPTYPE_GROW;
-}
-//////////////////////////////////////////////////////////////////////////
-MetisPartitioner::~MetisPartitioner()
-{
-
-}
-//////////////////////////////////////////////////////////////////////////
-idx_t* MetisPartitioner::getMetisOptions()
-{
-   return options;
-}
-void MetisPartitioner::setMetisOptions(int option, idx_t value)
-{
-   options[option] = value;
-}
-//////////////////////////////////////////////////////////////////////////
-int MetisPartitioner::partition(int nofParts, MetisPartitioner::PartType ptype)
-{
-   int rc;
-   idx_t nvtxs = (idx_t)xadj.size()-1;  // number of nodes
-   idx_t ncon = (idx_t)vwgt.size()/nvtxs; // number Of node constraints;
-   part.resize(nvtxs);
-   idx_t edgecutCount = 0;
-   idx_t nofPartsMetis = (idx_t)nofParts;
-
-   switch (ptype)
-   {
-   case MetisPartitioner::RECURSIVE: 
-      if     ( nofParts <  1 ) UB_THROW( UbException(UB_EXARGS,"invalid nofParts<1") );
-      else if (nofParts == 1) { part.resize(nvtxs, 0); return 0; }
-      //else if( nofParts >  8 ) UBLOG(logWARNING, "MetisPartitioner::Recursive: !!!Warning!!!  best for nofParts<=8 --> Kway is maybe a better option");
-      
-      rc = METIS_PartGraphRecursive(&nvtxs, &ncon, &xadj[0], &adjncy[0],
-                                    &vwgt[0], vsize, &adjwgt[0], &nofPartsMetis, 
-                                    tpwgts, ubvec, options, &edgecutCount, &part[0]);
-   	break;
-   case MetisPartitioner::KWAY: 
-      if     ( nofParts <  1 ) UB_THROW( UbException(UB_EXARGS,"invalid nofParts<1") );
-      else if (nofParts == 1) { part.resize(nvtxs, 0); return 0; }
-      //else if( nofParts <  9 ) UBLOG(logWARNING, "MetisPartitioner::Kway: !!!Warning!!!  best for nofParts>8 --> Recursive is maybe a better option");
-
-      rc = METIS_PartGraphKway(&nvtxs, &ncon, &xadj[0], &adjncy[0],
-                                &vwgt[0], vsize, &adjwgt[0], &nofPartsMetis,
-                                tpwgts, ubvec, options, &edgecutCount, &part[0]);
-      break;
-   }
-
-   switch (rc)
-   {
-   case METIS_ERROR_INPUT:
-      throw UbException(UB_EXARGS,"METIS: input error");
-   	break;
-   case METIS_ERROR_MEMORY:
-      throw UbException(UB_EXARGS,"METIS: it could not allocate the required memory");
-      break;
-   case METIS_ERROR:
-      throw UbException(UB_EXARGS,"METIS: error");
-      break;
-   }
-
-   return edgecutCount;
-}
-#endif
+#if defined VF_METIS
+
+#include "MetisPartitioner.h"
+
+
+MetisPartitioner::MetisPartitioner()
+{
+   METIS_SetDefaultOptions(options);
+   options[METIS_OPTION_NUMBERING] = 0;
+   vsize = NULL;
+   tpwgts = NULL;
+   ubvec = NULL;
+
+   //options[METIS_OPTION_OBJTYPE] = METIS_OBJTYPE_CUT;
+   ////options[METIS_OPTION_OBJTYPE] = METIS_OBJTYPE_VOL;
+
+   //options[METIS_OPTION_CTYPE]  = METIS_CTYPE_SHEM;
+   //options[METIS_OPTION_IPTYPE] = METIS_IPTYPE_GROW;
+}
+//////////////////////////////////////////////////////////////////////////
+MetisPartitioner::~MetisPartitioner()
+{
+
+}
+//////////////////////////////////////////////////////////////////////////
+idx_t* MetisPartitioner::getMetisOptions()
+{
+   return options;
+}
+void MetisPartitioner::setMetisOptions(int option, idx_t value)
+{
+   options[option] = value;
+}
+//////////////////////////////////////////////////////////////////////////
+int MetisPartitioner::partition(int nofParts, MetisPartitioner::PartType ptype)
+{
+   int rc;
+   idx_t nvtxs = (idx_t)xadj.size()-1;  // number of nodes
+   idx_t ncon = (idx_t)vwgt.size()/nvtxs; // number Of node constraints;
+   part.resize(nvtxs);
+   idx_t edgecutCount = 0;
+   idx_t nofPartsMetis = (idx_t)nofParts;
+
+   switch (ptype)
+   {
+   case MetisPartitioner::RECURSIVE: 
+      if     ( nofParts <  1 ) UB_THROW( UbException(UB_EXARGS,"invalid nofParts<1") );
+      else if (nofParts == 1) { part.resize(nvtxs, 0); return 0; }
+      //else if( nofParts >  8 ) UBLOG(logWARNING, "MetisPartitioner::Recursive: !!!Warning!!!  best for nofParts<=8 --> Kway is maybe a better option");
+      
+      rc = METIS_PartGraphRecursive(&nvtxs, &ncon, &xadj[0], &adjncy[0],
+                                    &vwgt[0], vsize, &adjwgt[0], &nofPartsMetis, 
+                                    tpwgts, ubvec, options, &edgecutCount, &part[0]);
+   	break;
+   case MetisPartitioner::KWAY: 
+      if     ( nofParts <  1 ) UB_THROW( UbException(UB_EXARGS,"invalid nofParts<1") );
+      else if (nofParts == 1) { part.resize(nvtxs, 0); return 0; }
+      //else if( nofParts <  9 ) UBLOG(logWARNING, "MetisPartitioner::Kway: !!!Warning!!!  best for nofParts>8 --> Recursive is maybe a better option");
+
+      rc = METIS_PartGraphKway(&nvtxs, &ncon, &xadj[0], &adjncy[0],
+                                &vwgt[0], vsize, &adjwgt[0], &nofPartsMetis,
+                                tpwgts, ubvec, options, &edgecutCount, &part[0]);
+      break;
+   }
+
+   switch (rc)
+   {
+   case METIS_ERROR_INPUT:
+      throw UbException(UB_EXARGS,"METIS: input error");
+   	break;
+   case METIS_ERROR_MEMORY:
+      throw UbException(UB_EXARGS,"METIS: it could not allocate the required memory");
+      break;
+   case METIS_ERROR:
+      throw UbException(UB_EXARGS,"METIS: error");
+      break;
+   }
+
+   return edgecutCount;
+}
+#endif
diff --git a/src/cpu/VirtualFluidsCore/Parallel/MetisPartitioner.h b/src/cpu/VirtualFluidsCore/Parallel/MetisPartitioner.h
index 30d68c3e1a2e823d9cb8b5190da64ccb641ed2f7..339238684ce497f637b965538b9208186201bc97 100644
--- a/src/cpu/VirtualFluidsCore/Parallel/MetisPartitioner.h
+++ b/src/cpu/VirtualFluidsCore/Parallel/MetisPartitioner.h
@@ -1,59 +1,59 @@
-/**
-* @file MetisPartitioner.h
-* @brief Class use METIS library for graph-based partitioning.
-* @author Kostyantyn Kucher
-* @date 22.09.2011
-*/
-
-#ifndef METISPARTITIONER_H
-#define METISPARTITIONER_H
-
-#if defined VF_METIS
-
-#include "metis.h"
-#include <vector>
-#include <string>
-#include <PointerDefinitions.h>
-#include "basics/utilities/UbLogger.h"
-#include "basics/utilities/UbSystem.h"
-
-class MetisPartitioner
-{
-public:
-   enum PartType { RECURSIVE, KWAY };
-public:
-   MetisPartitioner();
-   virtual ~MetisPartitioner();
-   idx_t* getMetisOptions();
-   void setMetisOptions(int option, idx_t value);
-   int partition(int nofParts, PartType ptype);
-public:
-   std::vector<idx_t> xadj;    // adjncy offset of nodes 
-   //(size = n+1, n=nofNodes)
-   std::vector<idx_t> adjncy;  // array that stores the adjacency lists of nodes 
-   //(size = m*2, m= nofEdged, factor 2 because edge A->B AND B->A has to be stored)
-   std::vector<idx_t> vwgt;    // vertex weights (size=n*ncon, ncon=nofNodeWeightsPerNode)
-   std::vector<idx_t> adjwgt;  // array that stores the weights of the adjacency lists 
-   // (size=2*m)
-   idx_t * vsize;   // array that stores the computation weights per node
-   // (size=n)
-
-   real_t * tpwgts; // holds the wished fratcion of segment i, e.g. tpwgts={0.2, 0.2, 0.6} 
-   // -> patisions 0 and one will get 20% of the weight each and part 3 60%!
-   // (size=nofPartitions)  sum of tpwgts must be 1.0
-
-   real_t * ubvec;  //This is an array of size ncon that specifies the allowed load imbalance tolerance for each constraint.
-   //For the ith partition and jth constraint the allowed weight is the ubvec[j]*tpwgts[i*ncon+j] fraction
-   //of the jth’s constraint total weight. The load imbalances must be greater than 1.0.
-   //A NULL value can be passed indicating that the load imbalance tolerance for each constraint should
-   //be 1.001 (for ncon=1) or 1.01 (for ncon¿1).
-
-   std::vector<idx_t> part;   // This is a vector of size n that upon successful completion stores the partition vector of the graph. 
-   // The numbering of this vector starts from 0 
-private:
-   idx_t options[METIS_NOPTIONS];
-};
-
-#endif
-
-#endif 
+/**
+* @file MetisPartitioner.h
+* @brief Class use METIS library for graph-based partitioning.
+* @author Kostyantyn Kucher
+* @date 22.09.2011
+*/
+
+#ifndef METISPARTITIONER_H
+#define METISPARTITIONER_H
+
+#if defined VF_METIS
+
+#include "metis.h"
+#include <vector>
+#include <string>
+#include <PointerDefinitions.h>
+#include "basics/utilities/UbLogger.h"
+#include "basics/utilities/UbSystem.h"
+
+class MetisPartitioner
+{
+public:
+   enum PartType { RECURSIVE, KWAY };
+public:
+   MetisPartitioner();
+   virtual ~MetisPartitioner();
+   idx_t* getMetisOptions();
+   void setMetisOptions(int option, idx_t value);
+   int partition(int nofParts, PartType ptype);
+public:
+   std::vector<idx_t> xadj;    // adjncy offset of nodes 
+   //(size = n+1, n=nofNodes)
+   std::vector<idx_t> adjncy;  // array that stores the adjacency lists of nodes 
+   //(size = m*2, m= nofEdged, factor 2 because edge A->B AND B->A has to be stored)
+   std::vector<idx_t> vwgt;    // vertex weights (size=n*ncon, ncon=nofNodeWeightsPerNode)
+   std::vector<idx_t> adjwgt;  // array that stores the weights of the adjacency lists 
+   // (size=2*m)
+   idx_t * vsize;   // array that stores the computation weights per node
+   // (size=n)
+
+   real_t * tpwgts; // holds the wished fratcion of segment i, e.g. tpwgts={0.2, 0.2, 0.6} 
+   // -> patisions 0 and one will get 20% of the weight each and part 3 60%!
+   // (size=nofPartitions)  sum of tpwgts must be 1.0
+
+   real_t * ubvec;  //This is an array of size ncon that specifies the allowed load imbalance tolerance for each constraint.
+   //For the ith partition and jth constraint the allowed weight is the ubvec[j]*tpwgts[i*ncon+j] fraction
+   //of the jth’s constraint total weight. The load imbalances must be greater than 1.0.
+   //A NULL value can be passed indicating that the load imbalance tolerance for each constraint should
+   //be 1.001 (for ncon=1) or 1.01 (for ncon¿1).
+
+   std::vector<idx_t> part;   // This is a vector of size n that upon successful completion stores the partition vector of the graph. 
+   // The numbering of this vector starts from 0 
+private:
+   idx_t options[METIS_NOPTIONS];
+};
+
+#endif
+
+#endif 
diff --git a/src/cpu/VirtualFluidsCore/Parallel/NullCommunicator.cpp b/src/cpu/VirtualFluidsCore/Parallel/NullCommunicator.cpp
index e21bddc45a4bf97b7f00a574498538b216cf40c2..5e3bcf132065e766b50e2deb5b028561a8d39335 100644
--- a/src/cpu/VirtualFluidsCore/Parallel/NullCommunicator.cpp
+++ b/src/cpu/VirtualFluidsCore/Parallel/NullCommunicator.cpp
@@ -1,108 +1,108 @@
-//=======================================================================================
-// ____          ____    __    ______     __________   __      __       __        __         
-// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
-//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
-//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
-//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
-//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
-//      \    \  |    |   ________________________________________________________________    
-//       \    \ |    |  |  ______________________________________________________________|   
-//        \    \|    |  |  |         __          __     __     __     ______      _______    
-//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
-//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
-//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
-//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
-//
-//  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 NullCommunicator.cpp
-//! \ingroup Parallel
-//! \author Konstantin Kutscher
-//=======================================================================================
-
-#include "NullCommunicator.h"
-
-
-NullCommunicator::NullCommunicator()
-{
-}
-//////////////////////////////////////////////////////////////////////////
-NullCommunicator::~NullCommunicator()
-{
-}
-//////////////////////////////////////////////////////////////////////////
-int NullCommunicator::getBundleID() 
-{
-   return 0;
-}
-//////////////////////////////////////////////////////////////////////////
-int NullCommunicator::getNumberOfBundles() 
-{
-   return 0;
-}
-//////////////////////////////////////////////////////////////////////////
-int NullCommunicator::getProcessID() 
-{
-   return 0;
-}
-//////////////////////////////////////////////////////////////////////////
-int NullCommunicator::getNumberOfProcesses()
-{
-   return 0;
-}
-//////////////////////////////////////////////////////////////////////////
-void* NullCommunicator::getNativeCommunicator()
-{
-   return NULL;
-}
-//////////////////////////////////////////////////////////////////////////
-int NullCommunicator::getRoot() 
-{
-   return 0;
-}
-//////////////////////////////////////////////////////////////////////////
-int NullCommunicator::getBundleRoot() 
-{
-   return 0;
-}
-//////////////////////////////////////////////////////////////////////////
-int NullCommunicator::getProcessRoot() 
-{
-   return 0;
-}
-//////////////////////////////////////////////////////////////////////////
-std::vector<std::string> NullCommunicator::gather(const std::string& str)
-{
-   return std::vector<std::string>();
-}
-//////////////////////////////////////////////////////////////////////////
-std::vector<double> NullCommunicator::gatherDoubles(std::vector<double>& values) 
-{
-   return std::vector<double>();
-}
-//////////////////////////////////////////////////////////////////////////
-void NullCommunicator::allGatherInts(std::vector<int>& svalues, std::vector<int>& rvalues)
-{
-
-}
-//////////////////////////////////////////////////////////////////////////
-void NullCommunicator::sendSerializedObject(std::stringstream& ss, int target) 
-{
-
-}
-//////////////////////////////////////////////////////////////////////////
-void NullCommunicator::receiveSerializedObject(std::stringstream& ss, int source) 
-{
-
-}
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 NullCommunicator.cpp
+//! \ingroup Parallel
+//! \author Konstantin Kutscher
+//=======================================================================================
+
+#include "NullCommunicator.h"
+
+
+NullCommunicator::NullCommunicator()
+{
+}
+//////////////////////////////////////////////////////////////////////////
+NullCommunicator::~NullCommunicator()
+{
+}
+//////////////////////////////////////////////////////////////////////////
+int NullCommunicator::getBundleID() 
+{
+   return 0;
+}
+//////////////////////////////////////////////////////////////////////////
+int NullCommunicator::getNumberOfBundles() 
+{
+   return 0;
+}
+//////////////////////////////////////////////////////////////////////////
+int NullCommunicator::getProcessID() 
+{
+   return 0;
+}
+//////////////////////////////////////////////////////////////////////////
+int NullCommunicator::getNumberOfProcesses()
+{
+   return 0;
+}
+//////////////////////////////////////////////////////////////////////////
+void* NullCommunicator::getNativeCommunicator()
+{
+   return NULL;
+}
+//////////////////////////////////////////////////////////////////////////
+int NullCommunicator::getRoot() 
+{
+   return 0;
+}
+//////////////////////////////////////////////////////////////////////////
+int NullCommunicator::getBundleRoot() 
+{
+   return 0;
+}
+//////////////////////////////////////////////////////////////////////////
+int NullCommunicator::getProcessRoot() 
+{
+   return 0;
+}
+//////////////////////////////////////////////////////////////////////////
+std::vector<std::string> NullCommunicator::gather(const std::string& str)
+{
+   return std::vector<std::string>();
+}
+//////////////////////////////////////////////////////////////////////////
+std::vector<double> NullCommunicator::gatherDoubles(std::vector<double>& values) 
+{
+   return std::vector<double>();
+}
+//////////////////////////////////////////////////////////////////////////
+void NullCommunicator::allGatherInts(std::vector<int>& svalues, std::vector<int>& rvalues)
+{
+
+}
+//////////////////////////////////////////////////////////////////////////
+void NullCommunicator::sendSerializedObject(std::stringstream& ss, int target) 
+{
+
+}
+//////////////////////////////////////////////////////////////////////////
+void NullCommunicator::receiveSerializedObject(std::stringstream& ss, int source) 
+{
+
+}
diff --git a/src/cpu/VirtualFluidsCore/Parallel/NullCommunicator.h b/src/cpu/VirtualFluidsCore/Parallel/NullCommunicator.h
index bea39e6036f592f52ee04fc246c233de5aefafae..af3ed35204cd8daacacae329de51b60667a9a51f 100644
--- a/src/cpu/VirtualFluidsCore/Parallel/NullCommunicator.h
+++ b/src/cpu/VirtualFluidsCore/Parallel/NullCommunicator.h
@@ -1,65 +1,65 @@
-//=======================================================================================
-// ____          ____    __    ______     __________   __      __       __        __         
-// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
-//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
-//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
-//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
-//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
-//      \    \  |    |   ________________________________________________________________    
-//       \    \ |    |  |  ______________________________________________________________|   
-//        \    \|    |  |  |         __          __     __     __     ______      _______    
-//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
-//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
-//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
-//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
-//
-//  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 NullCommunicator.h
-//! \ingroup Parallel
-//! \author Konstantin Kutscher
-//=======================================================================================
-
-#ifndef NullCommunicator_H
-#define NullCommunicator_H
-
-#include "Communicator.h"
-
-#include <PointerDefinitions.h>
-
-//! \brief A class implements Communicator for shared memory.
-//! \details NullCommunicator is only a place-holder. It is only one process in shared memory.
-class NullCommunicator : public Communicator
-{
-public:
-   NullCommunicator();
-   ~NullCommunicator();
-   int getBundleID();
-   int getNumberOfBundles();
-   int getProcessID();
-   int getNumberOfProcesses();
-   void* getNativeCommunicator();
-   int getRoot();
-   int getBundleRoot();
-   int getProcessRoot();
-   std::vector<std::string> gather(const std::string& str);
-   std::vector<double> gatherDoubles(std::vector<double>& values); 
-   void allGatherInts(std::vector<int>& svalues, std::vector<int>& rvalues);
-   void sendSerializedObject(std::stringstream& ss, int target);
-   void receiveSerializedObject(std::stringstream& ss, int source);
-protected:
-private:
-};
-
-#endif
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 NullCommunicator.h
+//! \ingroup Parallel
+//! \author Konstantin Kutscher
+//=======================================================================================
+
+#ifndef NullCommunicator_H
+#define NullCommunicator_H
+
+#include "Communicator.h"
+
+#include <PointerDefinitions.h>
+
+//! \brief A class implements Communicator for shared memory.
+//! \details NullCommunicator is only a place-holder. It is only one process in shared memory.
+class NullCommunicator : public Communicator
+{
+public:
+   NullCommunicator();
+   ~NullCommunicator();
+   int getBundleID();
+   int getNumberOfBundles();
+   int getProcessID();
+   int getNumberOfProcesses();
+   void* getNativeCommunicator();
+   int getRoot();
+   int getBundleRoot();
+   int getProcessRoot();
+   std::vector<std::string> gather(const std::string& str);
+   std::vector<double> gatherDoubles(std::vector<double>& values); 
+   void allGatherInts(std::vector<int>& svalues, std::vector<int>& rvalues);
+   void sendSerializedObject(std::stringstream& ss, int target);
+   void receiveSerializedObject(std::stringstream& ss, int source);
+protected:
+private:
+};
+
+#endif
diff --git a/src/cpu/VirtualFluidsCore/Parallel/PriorityQueueDecompositor.cpp b/src/cpu/VirtualFluidsCore/Parallel/PriorityQueueDecompositor.cpp
index 31083a2321fab5aa27522a396b2b97c521f9ee22..4d3ad420156616cc4da094e1e500bec924bbc9b7 100644
--- a/src/cpu/VirtualFluidsCore/Parallel/PriorityQueueDecompositor.cpp
+++ b/src/cpu/VirtualFluidsCore/Parallel/PriorityQueueDecompositor.cpp
@@ -1,2 +1,2 @@
-#include "PriorityQueueDecompositor.h"
-
+#include "PriorityQueueDecompositor.h"
+
diff --git a/src/cpu/VirtualFluidsCore/Parallel/SimpleGeometricPartitioner.h b/src/cpu/VirtualFluidsCore/Parallel/SimpleGeometricPartitioner.h
index 01efd11efa21361cd783edec4bb7f9f11409ad2e..9573e778c04efe6c1ead3f888dc9247d141ba76e 100644
--- a/src/cpu/VirtualFluidsCore/Parallel/SimpleGeometricPartitioner.h
+++ b/src/cpu/VirtualFluidsCore/Parallel/SimpleGeometricPartitioner.h
@@ -1,97 +1,97 @@
-/**
-* @file SimpleGeometricPartitioner.h
-* @author Kostyantyn Kucher
-* @date 06/06/2011
-*
-* @section DESCRIPTION
-*
-* This class make simple geometric partitioning.
-*/
-
-#ifndef SIMPLEGEOMETRICPARTITIONER_H 
-#define SIMPLEGEOMETRICPARTITIONER_H
-
-#include "basics/utilities/UbTuple.h"
-#include "basics/utilities/UbException.h"
-#include "MathUtil.hpp"
-
-class SimpleGeometricPartitioner
-{
-public:
-   static UbTupleInt3 createDimensions(const int& x, const int& y, const int& z, const int& numberOfProcess)
-   {
-      int xyz = x*y*z;
-
-      int p = numberOfProcess;
-
-      if (p == 1)
-         return UbTupleInt3(1, 1, 1);
-
-      double a = pow(p*pow(x,3.0)/xyz,1.0/3.0);
-      double b = pow(p*pow(y,3.0)/xyz,1.0/3.0);
-      double c = pow(p*pow(z,3.0)/xyz,1.0/3.0);
-
-      MaxDim maxDim;
- 
-      if(c >= a && c >= b)
-         maxDim = cDim;
-      if(b >= a && b >= c)
-         maxDim = bDim;
-      if(a >= b && a >= c)
-         maxDim = aDim;
-
-      int dim1, dim2, dim3;
-      dim1 = (int)Utilities::cint(a);
-      dim2 = (int)Utilities::cint(b);
-      dim3 = (int)Utilities::cint(c);
-      if(dim1 <= 0) dim1 = 1;
-      if(dim2 <= 0) dim2 = 1;
-      if(dim3 <= 0) dim3 = 1;
-
-      switch (maxDim)
-      {
-      case aDim: 
-         dim1 = p/(dim2*dim3);
-         if (dim1*dim2*dim3 != p)
-         {
-            dim2 = 1;
-            dim3 = 1;
-            dim1 = p;
-         }
-         break;
-      case bDim: 
-         dim2 = p/(dim1*dim3);
-         if (dim1*dim2*dim3 != p)
-         {
-            dim1 = 1;
-            dim3 = 1;
-            dim2 = p;
-         }
-         break;
-      case cDim: 
-         dim3 = p/(dim1*dim2);
-         if (dim1*dim2*dim3 != p)
-         {
-            dim1 = 1;
-            dim2 = 1;
-            dim3 = p;
-         }
-         break;
-      }
-
-      if (dim1>x || dim2>y || dim3>z)
-      {
-         UB_THROW( UbException(UB_EXARGS,"SimpleGeometricPartitioner::createDimensions: Segmentation fault - bad number of prozess") );
-      }
-
-      UbTupleInt3 dims(dim1, dim2, dim3);
-      
-      return dims;
-   }
-
-protected:
-private:
-   enum MaxDim {aDim,bDim,cDim};
-};
-
-#endif
+/**
+* @file SimpleGeometricPartitioner.h
+* @author Kostyantyn Kucher
+* @date 06/06/2011
+*
+* @section DESCRIPTION
+*
+* This class make simple geometric partitioning.
+*/
+
+#ifndef SIMPLEGEOMETRICPARTITIONER_H 
+#define SIMPLEGEOMETRICPARTITIONER_H
+
+#include "basics/utilities/UbTuple.h"
+#include "basics/utilities/UbException.h"
+#include "MathUtil.hpp"
+
+class SimpleGeometricPartitioner
+{
+public:
+   static UbTupleInt3 createDimensions(const int& x, const int& y, const int& z, const int& numberOfProcess)
+   {
+      int xyz = x*y*z;
+
+      int p = numberOfProcess;
+
+      if (p == 1)
+         return UbTupleInt3(1, 1, 1);
+
+      double a = pow(p*pow(x,3.0)/xyz,1.0/3.0);
+      double b = pow(p*pow(y,3.0)/xyz,1.0/3.0);
+      double c = pow(p*pow(z,3.0)/xyz,1.0/3.0);
+
+      MaxDim maxDim;
+ 
+      if(c >= a && c >= b)
+         maxDim = cDim;
+      if(b >= a && b >= c)
+         maxDim = bDim;
+      if(a >= b && a >= c)
+         maxDim = aDim;
+
+      int dim1, dim2, dim3;
+      dim1 = (int)Utilities::cint(a);
+      dim2 = (int)Utilities::cint(b);
+      dim3 = (int)Utilities::cint(c);
+      if(dim1 <= 0) dim1 = 1;
+      if(dim2 <= 0) dim2 = 1;
+      if(dim3 <= 0) dim3 = 1;
+
+      switch (maxDim)
+      {
+      case aDim: 
+         dim1 = p/(dim2*dim3);
+         if (dim1*dim2*dim3 != p)
+         {
+            dim2 = 1;
+            dim3 = 1;
+            dim1 = p;
+         }
+         break;
+      case bDim: 
+         dim2 = p/(dim1*dim3);
+         if (dim1*dim2*dim3 != p)
+         {
+            dim1 = 1;
+            dim3 = 1;
+            dim2 = p;
+         }
+         break;
+      case cDim: 
+         dim3 = p/(dim1*dim2);
+         if (dim1*dim2*dim3 != p)
+         {
+            dim1 = 1;
+            dim2 = 1;
+            dim3 = p;
+         }
+         break;
+      }
+
+      if (dim1>x || dim2>y || dim3>z)
+      {
+         UB_THROW( UbException(UB_EXARGS,"SimpleGeometricPartitioner::createDimensions: Segmentation fault - bad number of prozess") );
+      }
+
+      UbTupleInt3 dims(dim1, dim2, dim3);
+      
+      return dims;
+   }
+
+protected:
+private:
+   enum MaxDim {aDim,bDim,cDim};
+};
+
+#endif
diff --git a/src/cpu/VirtualFluidsCore/Parallel/ZoltanPartitioner.cpp b/src/cpu/VirtualFluidsCore/Parallel/ZoltanPartitioner.cpp
index b6ce1ed0ab43dcd02e47a5605b4f95024231e486..3aa51f0309dc382a16a165abe2061353a261f28e 100644
--- a/src/cpu/VirtualFluidsCore/Parallel/ZoltanPartitioner.cpp
+++ b/src/cpu/VirtualFluidsCore/Parallel/ZoltanPartitioner.cpp
@@ -1,204 +1,204 @@
-#if defined VF_ZOLTAN && defined VF_MPI
-
-#include "ZoltanPartitioner.h"
-#include <iostream>
-#include <stdlib.h>
-
-#include "UbSystem.h"
-
-using namespace std;
-
-//////////////////////////////////////////////////////////////////////////
-ZoltanPartitioner::ZoltanPartitioner(MPI_Comm comm, int rank, int numberOfLocalParts): 
-                                    comm(comm), rank(rank), numberOfLocalParts(numberOfLocalParts),lb_approach("PARTITION")
-{
-   int rc;
-   float ver;
-
-   rc = Zoltan_Initialize(0, NULL, &ver);
-
-   if (rc != ZOLTAN_OK){
-      cout<<"Sorry, Zoltan can't be initialized\n"<<endl;
-      MPI_Finalize();
-      exit(0);
-   } 
-   /******************************************************************
-   ** Create a Zoltan library structure for this instance of load
-   ** balancing.  Set the parameters and query functions that will
-   ** govern the library's calculation.  See the Zoltan User's
-   ** Guide for the definition of these and many other parameters.
-   ******************************************************************/
-
-   zz = Zoltan_Create(comm);
-}
-//////////////////////////////////////////////////////////////////////////
-ZoltanPartitioner::~ZoltanPartitioner()
-{
-  Zoltan_Destroy(&zz);
-}
-//////////////////////////////////////////////////////////////////////////
-void ZoltanPartitioner::partition()
-{
-   //General parameters
-   Zoltan_Set_Param(zz, "DEBUG_LEVEL", "0");
-   Zoltan_Set_Param(zz, "LB_METHOD", "GRAPH");
-   Zoltan_Set_Param(zz, "LB_APPROACH", lb_approach.c_str());
-   Zoltan_Set_Param(zz, "NUM_GID_ENTRIES", "1"); 
-   Zoltan_Set_Param(zz, "NUM_LID_ENTRIES", "1");
-   Zoltan_Set_Param(zz, "RETURN_LISTS", "ALL");
-   string nparts(UbSystem::toString<int>(numberOfLocalParts));
-   Zoltan_Set_Param(zz, "NUM_LOCAL_PARTS", nparts.c_str());
-
-   /* Query functions - defined in simpleQueries.h */
-
-   Zoltan_Set_Num_Obj_Fn(zz, get_number_of_vertices, &graph);
-   Zoltan_Set_Obj_List_Fn(zz, get_vertex_list, &graph);
-   Zoltan_Set_Num_Edges_Multi_Fn(zz, get_num_edges_list, &graph);
-   Zoltan_Set_Edge_List_Multi_Fn(zz, get_edge_list, &graph);
-   
-   /******************************************************************
-   ** Zoltan can now partition the graph.
-   ** In this case, we assume the number of partitions is
-   ** equal to the number of processes.  Process rank 0 will own
-   ** partition 0, process rank 1 will own partition 1, and so on.
-   ******************************************************************/
-
-   int rc = Zoltan_LB_Partition(zz, /* input (all remaining fields are output) */
-      &changes,        /* 1 if partitioning was changed, 0 otherwise */ 
-      &numGidEntries,  /* Number of integers used for a global ID */
-      &numLidEntries,  /* Number of integers used for a local ID */
-      &numImport,      /* Number of vertices to be sent to me */
-      &importGlobalGids,  /* Global IDs of vertices to be sent to me */
-      &importLocalGids,   /* Local IDs of vertices to be sent to me */
-      &importProcs,    /* Process rank for source of each incoming vertex */
-      &importToPart,   /* New partition for each incoming vertex */
-      &numExport,      /* Number of vertices I must send to other processes*/
-      &exportGlobalGids,  /* Global IDs of the vertices I must send */
-      &exportLocalGids,   /* Local IDs of the vertices I must send */
-      &exportProcs,    /* Process to which I send each of the vertices */
-      &exportToPart);  /* Partition to which each vertex will belong */
-
-
-
-   if (rc != ZOLTAN_OK){
-      cout << "Partitioning failed on process " << rank <<"\n" << endl;
-      MPI_Finalize();
-      Zoltan_Destroy(&zz);
-      exit(0);
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-void ZoltanPartitioner::setLB_APPROACH(std::string lb_approach)
-{
-   this->lb_approach = lb_approach;
-}
-//////////////////////////////////////////////////////////////////////////
-void ZoltanPartitioner::setNumberOfLocalParts(int numberOfLocalParts)
-{
-   this->numberOfLocalParts = numberOfLocalParts;
-}
-//////////////////////////////////////////////////////////////////////////
-// Application defined query functions //
-//////////////////////////////////////////////////////////////////////////
-int ZoltanPartitioner::get_number_of_vertices(void *data, int *ierr)
-{
-   ZoltanGraph *graph = (ZoltanGraph *)data;
-   *ierr = ZOLTAN_OK;
-   return graph->numLocalVertices;
-}
-//////////////////////////////////////////////////////////////////////////
-void ZoltanPartitioner::get_vertex_list(void *data, int sizeGID, int sizeLID,
-                                        ZOLTAN_ID_PTR globalID, ZOLTAN_ID_PTR localID,
-                                        int wgt_dim, float *obj_wgts, int *ierr)
-{
-   ZoltanGraph *graph = (ZoltanGraph *)data;
-   *ierr = ZOLTAN_OK;
-
-   /* In this case, return the IDs of our vertices, but no weights.
-   * Zoltan will assume equally weighted vertices.
-   */
-
-   for (int i=0; i<graph->numLocalVertices; i++){
-      globalID[i] = graph->vvertexGID[i];
-      localID[i] = i;
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-void ZoltanPartitioner::get_num_edges_list(void *data, int sizeGID, int sizeLID,
-                                           int num_obj,
-                                           ZOLTAN_ID_PTR globalID, ZOLTAN_ID_PTR localID,
-                                           int *numEdges, int *ierr)
-{
-   ZoltanGraph *graph = (ZoltanGraph *)data;
-
-   if ( (sizeGID != 1) || (sizeLID != 1) || (num_obj != graph->numLocalVertices)){
-      *ierr = ZOLTAN_FATAL;
-      return;
-   }
-
-   for (int i=0;  i < num_obj ; i++){
-      numEdges[i] = graph->vnumEdges[i];
-   }
-
-   *ierr = ZOLTAN_OK;
-   return;
-}
-//////////////////////////////////////////////////////////////////////////
-void ZoltanPartitioner::get_edge_list(void *data, int sizeGID, int sizeLID,
-                                      int num_obj, ZOLTAN_ID_PTR globalID, ZOLTAN_ID_PTR localID,
-                                      int *num_edges,
-                                      ZOLTAN_ID_PTR nborGID, int *nborProc,
-                                      int wgt_dim, float *ewgts, int *ierr)
-{
-   int *nextNbor, *nextProc;
-
-   ZoltanGraph *graph = (ZoltanGraph *)data;
-   *ierr = ZOLTAN_OK;
-
-   if ( (sizeGID != 1) || (sizeLID != 1) || 
-      (num_obj != graph->numLocalVertices)||
-      (wgt_dim != 0)){
-         *ierr = ZOLTAN_FATAL;
-         return;
-   }
-
-   nextNbor = (int *)nborGID;
-   nextProc = nborProc;
-   
-   int n=0;
-   for (int i=0; i < num_obj; i++){
-
-      /*
-      * In this case, we are not setting edge weights.  Zoltan will
-      * set each edge to weight 1.0.
-      */
-
-      for (int j=0; j < num_edges[i]; j++){
-         nborGID[n] = graph->vnborGID[n];
-         nborProc[n] = graph->vnborProc[n];
-         n++;
-      }
-   }
-   return;
-}
-//////////////////////////////////////////////////////////////////////////
-ZoltanGraph* ZoltanPartitioner::getGraphData()
-{
-   return &graph;
-}
-//////////////////////////////////////////////////////////////////////////
-void ZoltanPartitioner::getExportData(vector<int>& exportGlobalGids, vector<int>& exportToPart, vector<int>& exportProcs)
-{
-   for (int i = 0; i < this->numExport; i++)
-   {
-      exportGlobalGids.push_back(static_cast<int> (this->exportGlobalGids[i]));
-      exportToPart.push_back(this->exportToPart[i]);
-      exportProcs.push_back(this->exportProcs[i]);
-   }
-}
-//////////////////////////////////////////////////////////////////////////
- bool ZoltanPartitioner::areChanges()
- {
-     return static_cast<bool>(this->changes);
- }
-#endif
+#if defined VF_ZOLTAN && defined VF_MPI
+
+#include "ZoltanPartitioner.h"
+#include <iostream>
+#include <stdlib.h>
+
+#include "UbSystem.h"
+
+using namespace std;
+
+//////////////////////////////////////////////////////////////////////////
+ZoltanPartitioner::ZoltanPartitioner(MPI_Comm comm, int rank, int numberOfLocalParts): 
+                                    comm(comm), rank(rank), numberOfLocalParts(numberOfLocalParts),lb_approach("PARTITION")
+{
+   int rc;
+   float ver;
+
+   rc = Zoltan_Initialize(0, NULL, &ver);
+
+   if (rc != ZOLTAN_OK){
+      cout<<"Sorry, Zoltan can't be initialized\n"<<endl;
+      MPI_Finalize();
+      exit(0);
+   } 
+   /******************************************************************
+   ** Create a Zoltan library structure for this instance of load
+   ** balancing.  Set the parameters and query functions that will
+   ** govern the library's calculation.  See the Zoltan User's
+   ** Guide for the definition of these and many other parameters.
+   ******************************************************************/
+
+   zz = Zoltan_Create(comm);
+}
+//////////////////////////////////////////////////////////////////////////
+ZoltanPartitioner::~ZoltanPartitioner()
+{
+  Zoltan_Destroy(&zz);
+}
+//////////////////////////////////////////////////////////////////////////
+void ZoltanPartitioner::partition()
+{
+   //General parameters
+   Zoltan_Set_Param(zz, "DEBUG_LEVEL", "0");
+   Zoltan_Set_Param(zz, "LB_METHOD", "GRAPH");
+   Zoltan_Set_Param(zz, "LB_APPROACH", lb_approach.c_str());
+   Zoltan_Set_Param(zz, "NUM_GID_ENTRIES", "1"); 
+   Zoltan_Set_Param(zz, "NUM_LID_ENTRIES", "1");
+   Zoltan_Set_Param(zz, "RETURN_LISTS", "ALL");
+   string nparts(UbSystem::toString<int>(numberOfLocalParts));
+   Zoltan_Set_Param(zz, "NUM_LOCAL_PARTS", nparts.c_str());
+
+   /* Query functions - defined in simpleQueries.h */
+
+   Zoltan_Set_Num_Obj_Fn(zz, get_number_of_vertices, &graph);
+   Zoltan_Set_Obj_List_Fn(zz, get_vertex_list, &graph);
+   Zoltan_Set_Num_Edges_Multi_Fn(zz, get_num_edges_list, &graph);
+   Zoltan_Set_Edge_List_Multi_Fn(zz, get_edge_list, &graph);
+   
+   /******************************************************************
+   ** Zoltan can now partition the graph.
+   ** In this case, we assume the number of partitions is
+   ** equal to the number of processes.  Process rank 0 will own
+   ** partition 0, process rank 1 will own partition 1, and so on.
+   ******************************************************************/
+
+   int rc = Zoltan_LB_Partition(zz, /* input (all remaining fields are output) */
+      &changes,        /* 1 if partitioning was changed, 0 otherwise */ 
+      &numGidEntries,  /* Number of integers used for a global ID */
+      &numLidEntries,  /* Number of integers used for a local ID */
+      &numImport,      /* Number of vertices to be sent to me */
+      &importGlobalGids,  /* Global IDs of vertices to be sent to me */
+      &importLocalGids,   /* Local IDs of vertices to be sent to me */
+      &importProcs,    /* Process rank for source of each incoming vertex */
+      &importToPart,   /* New partition for each incoming vertex */
+      &numExport,      /* Number of vertices I must send to other processes*/
+      &exportGlobalGids,  /* Global IDs of the vertices I must send */
+      &exportLocalGids,   /* Local IDs of the vertices I must send */
+      &exportProcs,    /* Process to which I send each of the vertices */
+      &exportToPart);  /* Partition to which each vertex will belong */
+
+
+
+   if (rc != ZOLTAN_OK){
+      cout << "Partitioning failed on process " << rank <<"\n" << endl;
+      MPI_Finalize();
+      Zoltan_Destroy(&zz);
+      exit(0);
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+void ZoltanPartitioner::setLB_APPROACH(std::string lb_approach)
+{
+   this->lb_approach = lb_approach;
+}
+//////////////////////////////////////////////////////////////////////////
+void ZoltanPartitioner::setNumberOfLocalParts(int numberOfLocalParts)
+{
+   this->numberOfLocalParts = numberOfLocalParts;
+}
+//////////////////////////////////////////////////////////////////////////
+// Application defined query functions //
+//////////////////////////////////////////////////////////////////////////
+int ZoltanPartitioner::get_number_of_vertices(void *data, int *ierr)
+{
+   ZoltanGraph *graph = (ZoltanGraph *)data;
+   *ierr = ZOLTAN_OK;
+   return graph->numLocalVertices;
+}
+//////////////////////////////////////////////////////////////////////////
+void ZoltanPartitioner::get_vertex_list(void *data, int sizeGID, int sizeLID,
+                                        ZOLTAN_ID_PTR globalID, ZOLTAN_ID_PTR localID,
+                                        int wgt_dim, float *obj_wgts, int *ierr)
+{
+   ZoltanGraph *graph = (ZoltanGraph *)data;
+   *ierr = ZOLTAN_OK;
+
+   /* In this case, return the IDs of our vertices, but no weights.
+   * Zoltan will assume equally weighted vertices.
+   */
+
+   for (int i=0; i<graph->numLocalVertices; i++){
+      globalID[i] = graph->vvertexGID[i];
+      localID[i] = i;
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+void ZoltanPartitioner::get_num_edges_list(void *data, int sizeGID, int sizeLID,
+                                           int num_obj,
+                                           ZOLTAN_ID_PTR globalID, ZOLTAN_ID_PTR localID,
+                                           int *numEdges, int *ierr)
+{
+   ZoltanGraph *graph = (ZoltanGraph *)data;
+
+   if ( (sizeGID != 1) || (sizeLID != 1) || (num_obj != graph->numLocalVertices)){
+      *ierr = ZOLTAN_FATAL;
+      return;
+   }
+
+   for (int i=0;  i < num_obj ; i++){
+      numEdges[i] = graph->vnumEdges[i];
+   }
+
+   *ierr = ZOLTAN_OK;
+   return;
+}
+//////////////////////////////////////////////////////////////////////////
+void ZoltanPartitioner::get_edge_list(void *data, int sizeGID, int sizeLID,
+                                      int num_obj, ZOLTAN_ID_PTR globalID, ZOLTAN_ID_PTR localID,
+                                      int *num_edges,
+                                      ZOLTAN_ID_PTR nborGID, int *nborProc,
+                                      int wgt_dim, float *ewgts, int *ierr)
+{
+   int *nextNbor, *nextProc;
+
+   ZoltanGraph *graph = (ZoltanGraph *)data;
+   *ierr = ZOLTAN_OK;
+
+   if ( (sizeGID != 1) || (sizeLID != 1) || 
+      (num_obj != graph->numLocalVertices)||
+      (wgt_dim != 0)){
+         *ierr = ZOLTAN_FATAL;
+         return;
+   }
+
+   nextNbor = (int *)nborGID;
+   nextProc = nborProc;
+   
+   int n=0;
+   for (int i=0; i < num_obj; i++){
+
+      /*
+      * In this case, we are not setting edge weights.  Zoltan will
+      * set each edge to weight 1.0.
+      */
+
+      for (int j=0; j < num_edges[i]; j++){
+         nborGID[n] = graph->vnborGID[n];
+         nborProc[n] = graph->vnborProc[n];
+         n++;
+      }
+   }
+   return;
+}
+//////////////////////////////////////////////////////////////////////////
+ZoltanGraph* ZoltanPartitioner::getGraphData()
+{
+   return &graph;
+}
+//////////////////////////////////////////////////////////////////////////
+void ZoltanPartitioner::getExportData(vector<int>& exportGlobalGids, vector<int>& exportToPart, vector<int>& exportProcs)
+{
+   for (int i = 0; i < this->numExport; i++)
+   {
+      exportGlobalGids.push_back(static_cast<int> (this->exportGlobalGids[i]));
+      exportToPart.push_back(this->exportToPart[i]);
+      exportProcs.push_back(this->exportProcs[i]);
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+ bool ZoltanPartitioner::areChanges()
+ {
+     return static_cast<bool>(this->changes);
+ }
+#endif
diff --git a/src/cpu/VirtualFluidsCore/Parallel/ZoltanPartitioner.h b/src/cpu/VirtualFluidsCore/Parallel/ZoltanPartitioner.h
index 4f5d70d15bacaddb1d7ebcff0025c10b98218a4b..2bfea8877252c4aa07f33f6e771ddefdf4f48d14 100644
--- a/src/cpu/VirtualFluidsCore/Parallel/ZoltanPartitioner.h
+++ b/src/cpu/VirtualFluidsCore/Parallel/ZoltanPartitioner.h
@@ -1,74 +1,74 @@
-/**
-* @file ZoltanPartitioner.h
-* @brief Class use Zoltan library for graph-based partitioning.
-* @author Kostyantyn Kucher
-* @date 10.06.2011
-*/
-
-#ifndef ZOLTANPARTITIONER_H
-#define ZOLTANPARTITIONER_H
-
-#if defined VF_ZOLTAN && defined VF_MPI
-
-#include "zoltan.h"
-#include <vector>
-#include <string>
-
-/* Structure to hold graph data */
-
-struct ZoltanGraph{
-   int numLocalVertices;        // total vertices in in this partition
-   std::vector<int> vvertexGID; // global ID of each of my vertices
-   std::vector<int> vnumEdges;  // number of Edges 
-   std::vector<int> vnborGID;   // global ID of neighbors
-   std::vector<int> vnborProc;  // process owning each nbor in nborGID
-};
-
-struct Zoltan_Output{
-   ZOLTAN_ID_PTR importGlobalGids, importLocalGids, exportGlobalGids, exportLocalGids;
-   int *importProcs, *importToPart, *exportProcs, *exportToPart;
-   int changes, numGidEntries, numLidEntries, numImport, numExport;
-};
-
-class ZoltanPartitioner
-{
-public:
-   ZoltanPartitioner(MPI_Comm comm , int rank, int numberOfLocalParts);
-   virtual ~ZoltanPartitioner();
-   void partition();
-   ZoltanGraph* getGraphData();
-   void setLB_APPROACH(std::string lb_approach);
-   void setNumberOfLocalParts(int numberOfLocalParts);
-   void getExportData(std::vector<int>& exportGlobalGids, std::vector<int>& exportToPart, std::vector<int>& exportProcs);
-   bool areChanges();
-
-protected:
-   static int get_number_of_vertices(void *data, int *ierr);
-   static void get_vertex_list(void *data, int sizeGID, int sizeLID,
-                  ZOLTAN_ID_PTR globalID, ZOLTAN_ID_PTR localID,
-                  int wgt_dim, float *obj_wgts, int *ierr);
-   static void get_num_edges_list(void *data, int sizeGID, int sizeLID,
-                     int num_obj,
-                     ZOLTAN_ID_PTR globalID, ZOLTAN_ID_PTR localID,
-                     int *numEdges, int *ierr);
-   static void get_edge_list(void *data, int sizeGID, int sizeLID,
-               int num_obj, ZOLTAN_ID_PTR globalID, ZOLTAN_ID_PTR localID,
-               int *num_edges,
-               ZOLTAN_ID_PTR nborGID, int *nborProc,
-               int wgt_dim, float *ewgts, int *ierr);
-
-private:
-   MPI_Comm comm;
-   int rank;
-   int numberOfLocalParts;
-   struct Zoltan_Struct *zz;
-   std::string lb_approach;
-   ZOLTAN_ID_PTR importGlobalGids, importLocalGids, exportGlobalGids, exportLocalGids;
-   int *importProcs, *importToPart, *exportProcs, *exportToPart;
-   int changes, numGidEntries, numLidEntries, numImport, numExport;
-   ZoltanGraph graph;
-};
-
-#endif
-
-#endif 
+/**
+* @file ZoltanPartitioner.h
+* @brief Class use Zoltan library for graph-based partitioning.
+* @author Kostyantyn Kucher
+* @date 10.06.2011
+*/
+
+#ifndef ZOLTANPARTITIONER_H
+#define ZOLTANPARTITIONER_H
+
+#if defined VF_ZOLTAN && defined VF_MPI
+
+#include "zoltan.h"
+#include <vector>
+#include <string>
+
+/* Structure to hold graph data */
+
+struct ZoltanGraph{
+   int numLocalVertices;        // total vertices in in this partition
+   std::vector<int> vvertexGID; // global ID of each of my vertices
+   std::vector<int> vnumEdges;  // number of Edges 
+   std::vector<int> vnborGID;   // global ID of neighbors
+   std::vector<int> vnborProc;  // process owning each nbor in nborGID
+};
+
+struct Zoltan_Output{
+   ZOLTAN_ID_PTR importGlobalGids, importLocalGids, exportGlobalGids, exportLocalGids;
+   int *importProcs, *importToPart, *exportProcs, *exportToPart;
+   int changes, numGidEntries, numLidEntries, numImport, numExport;
+};
+
+class ZoltanPartitioner
+{
+public:
+   ZoltanPartitioner(MPI_Comm comm , int rank, int numberOfLocalParts);
+   virtual ~ZoltanPartitioner();
+   void partition();
+   ZoltanGraph* getGraphData();
+   void setLB_APPROACH(std::string lb_approach);
+   void setNumberOfLocalParts(int numberOfLocalParts);
+   void getExportData(std::vector<int>& exportGlobalGids, std::vector<int>& exportToPart, std::vector<int>& exportProcs);
+   bool areChanges();
+
+protected:
+   static int get_number_of_vertices(void *data, int *ierr);
+   static void get_vertex_list(void *data, int sizeGID, int sizeLID,
+                  ZOLTAN_ID_PTR globalID, ZOLTAN_ID_PTR localID,
+                  int wgt_dim, float *obj_wgts, int *ierr);
+   static void get_num_edges_list(void *data, int sizeGID, int sizeLID,
+                     int num_obj,
+                     ZOLTAN_ID_PTR globalID, ZOLTAN_ID_PTR localID,
+                     int *numEdges, int *ierr);
+   static void get_edge_list(void *data, int sizeGID, int sizeLID,
+               int num_obj, ZOLTAN_ID_PTR globalID, ZOLTAN_ID_PTR localID,
+               int *num_edges,
+               ZOLTAN_ID_PTR nborGID, int *nborProc,
+               int wgt_dim, float *ewgts, int *ierr);
+
+private:
+   MPI_Comm comm;
+   int rank;
+   int numberOfLocalParts;
+   struct Zoltan_Struct *zz;
+   std::string lb_approach;
+   ZOLTAN_ID_PTR importGlobalGids, importLocalGids, exportGlobalGids, exportLocalGids;
+   int *importProcs, *importToPart, *exportProcs, *exportToPart;
+   int changes, numGidEntries, numLidEntries, numImport, numExport;
+   ZoltanGraph graph;
+};
+
+#endif
+
+#endif 
diff --git a/src/cpu/VirtualFluidsCore/Utilities/ChangeRandomQs.hpp b/src/cpu/VirtualFluidsCore/Utilities/ChangeRandomQs.hpp
index 384ed092fcc04572d9c95fdff8e085723f3a1489..029143dca924e0919f6b3616d468fd6b40b7f022 100644
--- a/src/cpu/VirtualFluidsCore/Utilities/ChangeRandomQs.hpp
+++ b/src/cpu/VirtualFluidsCore/Utilities/ChangeRandomQs.hpp
@@ -1,51 +1,51 @@
-#ifndef ChangeRandomQs_h__
-#define ChangeRandomQs_h__
-
-#include "LBMKernel.h"
-#include "IntegrateValuesHelper.h"
-#include "BoundaryConditions.h"
-#include "BCArray3D.h"
-#include "BCProcessor.h"
-
-namespace Utilities
-{
-   void ChangeRandomQs(SPtr<IntegrateValuesHelper> integrateValues)
-   {
-      std::vector<IntegrateValuesHelper::CalcNodes> cnodes = integrateValues->getCNodes();
-      
-      for(IntegrateValuesHelper::CalcNodes cn : cnodes)
-      {
-         SPtr<ILBMKernel> kernel = cn.block->getKernel();
-         SPtr<BCArray3D> bcArray = kernel->getBCProcessor()->getBCArray();
-         for(UbTupleInt3 node : cn.nodes)
-         {
-            SPtr<BoundaryConditions> bc = bcArray->getBC(val<1>(node), val<2>(node), val<3>(node));
-            if (bc)
-            {
-	            for (int fdir=D3Q27System::FSTARTDIR; fdir<=D3Q27System::FENDDIR; fdir++)
-	            {
-                  if (bc->hasNoSlipBoundaryFlag(fdir))
-                  {
-                     const int invDir = D3Q27System::INVDIR[fdir];
-                     float q = bc->getQ(invDir);
-                     //double r = (double)UbRandom::rand(-50, 50);
-                     float r = (float)UbRandom::rand(-10, 10);
-                     float q_temp = q + q/r;
-                     if (q_temp < 0.0)
-                     {
-                        q_temp = 0.0001f;
-                     }
-                     else if (q_temp > 1.0)
-                     {
-                        q_temp = 0.9999f;
-                     }
-                     bc->setQ(q_temp, fdir);
-                  }
-	            }
-            }
-         }
-      }
-   }
-
-}
-#endif // ChangeRandomQs_h__
+#ifndef ChangeRandomQs_h__
+#define ChangeRandomQs_h__
+
+#include "LBMKernel.h"
+#include "IntegrateValuesHelper.h"
+#include "BoundaryConditions.h"
+#include "BCArray3D.h"
+#include "BCProcessor.h"
+
+namespace Utilities
+{
+   void ChangeRandomQs(SPtr<IntegrateValuesHelper> integrateValues)
+   {
+      std::vector<IntegrateValuesHelper::CalcNodes> cnodes = integrateValues->getCNodes();
+      
+      for(IntegrateValuesHelper::CalcNodes cn : cnodes)
+      {
+         SPtr<ILBMKernel> kernel = cn.block->getKernel();
+         SPtr<BCArray3D> bcArray = kernel->getBCProcessor()->getBCArray();
+         for(UbTupleInt3 node : cn.nodes)
+         {
+            SPtr<BoundaryConditions> bc = bcArray->getBC(val<1>(node), val<2>(node), val<3>(node));
+            if (bc)
+            {
+	            for (int fdir=D3Q27System::FSTARTDIR; fdir<=D3Q27System::FENDDIR; fdir++)
+	            {
+                  if (bc->hasNoSlipBoundaryFlag(fdir))
+                  {
+                     const int invDir = D3Q27System::INVDIR[fdir];
+                     float q = bc->getQ(invDir);
+                     //double r = (double)UbRandom::rand(-50, 50);
+                     float r = (float)UbRandom::rand(-10, 10);
+                     float q_temp = q + q/r;
+                     if (q_temp < 0.0)
+                     {
+                        q_temp = 0.0001f;
+                     }
+                     else if (q_temp > 1.0)
+                     {
+                        q_temp = 0.9999f;
+                     }
+                     bc->setQ(q_temp, fdir);
+                  }
+	            }
+            }
+         }
+      }
+   }
+
+}
+#endif // ChangeRandomQs_h__
diff --git a/src/cpu/VirtualFluidsCore/Utilities/ConfigurationFile.hpp b/src/cpu/VirtualFluidsCore/Utilities/ConfigurationFile.hpp
index 716b6ebad738dfca921e0623d3a42ac806aec9e4..5c8050826f0ac580f83fc29e51da883469d8d6e2 100644
--- a/src/cpu/VirtualFluidsCore/Utilities/ConfigurationFile.hpp
+++ b/src/cpu/VirtualFluidsCore/Utilities/ConfigurationFile.hpp
@@ -1,243 +1,243 @@
-#ifndef Configuration_h__
-#define Configuration_h__
-
-#include <map>
-#include <vector>
-#include <sstream>
-#include <string>
-#include <fstream>
-#include <iostream>
-#include <stdlib.h>
-
-//! \brief  Simple configuration file
-//! \details The Configuration class presented here can read and keep values of any configuration file written in a format like this:
-//!#
-//!# Simulation parameters
-//!#
-//!
-//!nbDimensions    = 2
-//!temperature     = 25.001
-//!epsilon         = 1.013e-14
-//!writeLogFile    = false      # NOTE: Set to "true" in debug mode only.
-//!                             #       Logging slows down the program.
-//!errorMessage    = the simulation failed
-//!origin          = 0.0 0.0 0.0 # x, y, z of origin
-//!
-//!Example how to use it:
-//!
-//!ConfigurationFile   config;
-//!config.load(configname);
-//!
-//!int            nbDimensions = config.getValue<int>("nbDimensions");
-//!float          temperature  = config.getValue<float>("temperature");
-//!double         epsilon      = config.getValue<double>("epsilon");
-//!bool           writeLogFile = config.getValue<bool>("writeLogFile");
-//!string         errorMessage = config.getValue<string>("errorMessage");
-//!vector<double> origin       = config.getVector<double>("origin");
-//!            
-//! \author  Konstantin Kutscher
-
-class ConfigurationFile
-{
-public:
-   //! clear all values
-   void clear();
-
-   //! load a configuration file
-   bool load(const std::string& File);
-
-   //! check if value associated with given key exists
-   bool contains(const std::string& key) const;
-
-   //! get vector with key
-   template<class T>
-   std::vector<T> getVector(const std::string& key) const;
-
-   //! get value with key
-   template<class T>
-   T getValue(const std::string& key) const;
-
-private:
-   //! the container
-   std::map<std::string, std::string> data;
-
-   //! get string with key
-   std::string  getString(const std::string& key) const;
-
-   //! remove leading and trailing tabs and spaces
-   static std::string trim(const std::string& str);
-
-   //! convert string to data type T
-   template<class T>
-   T fromString(const std::string& str) const;
-
-   void split(std::vector<std::string>& lst, const std::string& input, const std::string& separators, bool remove_empty = true) const;
-};
-
-
-// ----------------------------------
-// method implementations
-// ----------------------------------
-
-void ConfigurationFile::clear()
-{
-   data.clear();
-}
-//////////////////////////////////////////////////////////////////////////
-bool ConfigurationFile::load(const std::string& file)
-{
-   std::ifstream inFile(file.c_str());
-
-   if (!inFile.good())
-   {
-      UB_THROW(UbException(UB_EXARGS, "Cannot read configuration file "+file+"!"));
-   }
-
-   while (inFile.good() && ! inFile.eof())
-   {
-      std::string line;
-      getline(inFile, line);
-
-      // filter out comments
-      if (!line.empty())
-      {
-         size_t pos = line.find('#');
-
-         if (pos != std::string::npos)
-         {
-            line = line.substr(0, pos);
-         }
-      }
-
-      // split line into key and value
-      if (!line.empty())
-      {
-         size_t pos = line.find('=');
-
-         if (pos != std::string::npos)
-         {
-            std::string key = trim(line.substr(0, pos));
-            std::string value = trim(line.substr(pos + 1));
-
-            if (!key.empty() && !value.empty())
-            {
-               data[key] = value;
-            }
-         }
-      }
-   }
-
-   return true;
-}
-//////////////////////////////////////////////////////////////////////////
-bool ConfigurationFile::contains(const std::string& key) const
-{
-   return data.find(key) != data.end();
-}
-//////////////////////////////////////////////////////////////////////////
-std::string ConfigurationFile::getString(const std::string& key) const
-{
-   std::map<std::string, std::string>::const_iterator iter = data.find(key);
-
-   if (iter != data.end())
-   {
-      std::string value = iter->second;
-      return value;
-   }
-   else
-   {
-      UB_THROW(UbException(UB_EXARGS, "The parameter \"" + key + "\" is missing!"));
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-std::string ConfigurationFile::trim(const std::string& str)
-{
-   size_t first = str.find_first_not_of(" \t\n\r");
-
-   if (first != std::string::npos)
-   {
-      size_t last = str.find_last_not_of(" \t\n\r");
-
-      return str.substr(first, last - first + 1);
-   }
-   else
-   {
-      return "";
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-template<class T>
-std::vector<T> ConfigurationFile::getVector(const std::string& key) const
-{
-   std::string str = getString(key);
-   std::vector<T> v;
-   std::vector<std::string> strings;
-   split(strings, str, "\t\n\r;, ");
-   for (std::vector<std::string>::iterator it = strings.begin(); it != strings.end(); ++it)
-   {
-      if (*it != "")
-      {
-         v.push_back(fromString<T>(*it));
-      }
-   }
-   return v;
-}
-//////////////////////////////////////////////////////////////////////////
-void ConfigurationFile::split(std::vector<std::string>& lst, const std::string& input, const std::string& separators, bool remove_empty) const
-{
-   std::ostringstream word;
-   for (size_t n = 0; n < input.size(); ++n)
-   {
-      if (std::string::npos == separators.find(input[n]))
-         word << input[n];
-      else
-      {
-         if (!word.str().empty() || !remove_empty)
-            lst.push_back(word.str());
-         word.str("");
-      }
-   }
-   if (!word.str().empty() || !remove_empty)
-      lst.push_back(word.str());
-}
-//////////////////////////////////////////////////////////////////////////
-template<class T>
-T ConfigurationFile::fromString(const std::string& str) const
-{
-   //boolean hack
-   if (str == "true")
-      return true;
-   else if (str == "false")
-      return false;
-   //////////////
-   std::istringstream stream(str);
-   T t;
-   stream >> t;
-   return t;
-}
-//////////////////////////////////////////////////////////////////////////
-template<class T>
-T ConfigurationFile::getValue(const std::string& key) const
-{
-   std::string str = getString(key);
-   bool bFlag = false;
-   if ((std::string)typeid(T).name() == (std::string)typeid(bool).name()) 
-   {
-      bFlag = true;
-   }
-      
-   std::istringstream iss(str);
-   T x;
-   iss >> x;
-   if (!iss && !bFlag)
-      UB_THROW(UbException(UB_EXARGS, " cannot convert \"" + str + "\" to type <" + static_cast<std::string>(typeid(x).name()) + ">"));
-
-   if (bFlag)
-   {
-      bool value = (str == "true");
-      x = value;
-   }
-
-   return x;
-}
-#endif // Configuration_h__
+#ifndef Configuration_h__
+#define Configuration_h__
+
+#include <map>
+#include <vector>
+#include <sstream>
+#include <string>
+#include <fstream>
+#include <iostream>
+#include <stdlib.h>
+
+//! \brief  Simple configuration file
+//! \details The Configuration class presented here can read and keep values of any configuration file written in a format like this:
+//!#
+//!# Simulation parameters
+//!#
+//!
+//!nbDimensions    = 2
+//!temperature     = 25.001
+//!epsilon         = 1.013e-14
+//!writeLogFile    = false      # NOTE: Set to "true" in debug mode only.
+//!                             #       Logging slows down the program.
+//!errorMessage    = the simulation failed
+//!origin          = 0.0 0.0 0.0 # x, y, z of origin
+//!
+//!Example how to use it:
+//!
+//!ConfigurationFile   config;
+//!config.load(configname);
+//!
+//!int            nbDimensions = config.getValue<int>("nbDimensions");
+//!float          temperature  = config.getValue<float>("temperature");
+//!double         epsilon      = config.getValue<double>("epsilon");
+//!bool           writeLogFile = config.getValue<bool>("writeLogFile");
+//!string         errorMessage = config.getValue<string>("errorMessage");
+//!vector<double> origin       = config.getVector<double>("origin");
+//!            
+//! \author  Konstantin Kutscher
+
+class ConfigurationFile
+{
+public:
+   //! clear all values
+   void clear();
+
+   //! load a configuration file
+   bool load(const std::string& File);
+
+   //! check if value associated with given key exists
+   bool contains(const std::string& key) const;
+
+   //! get vector with key
+   template<class T>
+   std::vector<T> getVector(const std::string& key) const;
+
+   //! get value with key
+   template<class T>
+   T getValue(const std::string& key) const;
+
+private:
+   //! the container
+   std::map<std::string, std::string> data;
+
+   //! get string with key
+   std::string  getString(const std::string& key) const;
+
+   //! remove leading and trailing tabs and spaces
+   static std::string trim(const std::string& str);
+
+   //! convert string to data type T
+   template<class T>
+   T fromString(const std::string& str) const;
+
+   void split(std::vector<std::string>& lst, const std::string& input, const std::string& separators, bool remove_empty = true) const;
+};
+
+
+// ----------------------------------
+// method implementations
+// ----------------------------------
+
+void ConfigurationFile::clear()
+{
+   data.clear();
+}
+//////////////////////////////////////////////////////////////////////////
+bool ConfigurationFile::load(const std::string& file)
+{
+   std::ifstream inFile(file.c_str());
+
+   if (!inFile.good())
+   {
+      UB_THROW(UbException(UB_EXARGS, "Cannot read configuration file "+file+"!"));
+   }
+
+   while (inFile.good() && ! inFile.eof())
+   {
+      std::string line;
+      getline(inFile, line);
+
+      // filter out comments
+      if (!line.empty())
+      {
+         size_t pos = line.find('#');
+
+         if (pos != std::string::npos)
+         {
+            line = line.substr(0, pos);
+         }
+      }
+
+      // split line into key and value
+      if (!line.empty())
+      {
+         size_t pos = line.find('=');
+
+         if (pos != std::string::npos)
+         {
+            std::string key = trim(line.substr(0, pos));
+            std::string value = trim(line.substr(pos + 1));
+
+            if (!key.empty() && !value.empty())
+            {
+               data[key] = value;
+            }
+         }
+      }
+   }
+
+   return true;
+}
+//////////////////////////////////////////////////////////////////////////
+bool ConfigurationFile::contains(const std::string& key) const
+{
+   return data.find(key) != data.end();
+}
+//////////////////////////////////////////////////////////////////////////
+std::string ConfigurationFile::getString(const std::string& key) const
+{
+   std::map<std::string, std::string>::const_iterator iter = data.find(key);
+
+   if (iter != data.end())
+   {
+      std::string value = iter->second;
+      return value;
+   }
+   else
+   {
+      UB_THROW(UbException(UB_EXARGS, "The parameter \"" + key + "\" is missing!"));
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+std::string ConfigurationFile::trim(const std::string& str)
+{
+   size_t first = str.find_first_not_of(" \t\n\r");
+
+   if (first != std::string::npos)
+   {
+      size_t last = str.find_last_not_of(" \t\n\r");
+
+      return str.substr(first, last - first + 1);
+   }
+   else
+   {
+      return "";
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+template<class T>
+std::vector<T> ConfigurationFile::getVector(const std::string& key) const
+{
+   std::string str = getString(key);
+   std::vector<T> v;
+   std::vector<std::string> strings;
+   split(strings, str, "\t\n\r;, ");
+   for (std::vector<std::string>::iterator it = strings.begin(); it != strings.end(); ++it)
+   {
+      if (*it != "")
+      {
+         v.push_back(fromString<T>(*it));
+      }
+   }
+   return v;
+}
+//////////////////////////////////////////////////////////////////////////
+void ConfigurationFile::split(std::vector<std::string>& lst, const std::string& input, const std::string& separators, bool remove_empty) const
+{
+   std::ostringstream word;
+   for (size_t n = 0; n < input.size(); ++n)
+   {
+      if (std::string::npos == separators.find(input[n]))
+         word << input[n];
+      else
+      {
+         if (!word.str().empty() || !remove_empty)
+            lst.push_back(word.str());
+         word.str("");
+      }
+   }
+   if (!word.str().empty() || !remove_empty)
+      lst.push_back(word.str());
+}
+//////////////////////////////////////////////////////////////////////////
+template<class T>
+T ConfigurationFile::fromString(const std::string& str) const
+{
+   //boolean hack
+   if (str == "true")
+      return true;
+   else if (str == "false")
+      return false;
+   //////////////
+   std::istringstream stream(str);
+   T t;
+   stream >> t;
+   return t;
+}
+//////////////////////////////////////////////////////////////////////////
+template<class T>
+T ConfigurationFile::getValue(const std::string& key) const
+{
+   std::string str = getString(key);
+   bool bFlag = false;
+   if ((std::string)typeid(T).name() == (std::string)typeid(bool).name()) 
+   {
+      bFlag = true;
+   }
+      
+   std::istringstream iss(str);
+   T x;
+   iss >> x;
+   if (!iss && !bFlag)
+      UB_THROW(UbException(UB_EXARGS, " cannot convert \"" + str + "\" to type <" + static_cast<std::string>(typeid(x).name()) + ">"));
+
+   if (bFlag)
+   {
+      bool value = (str == "true");
+      x = value;
+   }
+
+   return x;
+}
+#endif // Configuration_h__
diff --git a/src/cpu/VirtualFluidsCore/Utilities/MathUtil.hpp b/src/cpu/VirtualFluidsCore/Utilities/MathUtil.hpp
index 6853ffdff71110f2a132897698587764485bb026..00556b842a28de2e3e49635def5f04ed451e5053 100644
--- a/src/cpu/VirtualFluidsCore/Utilities/MathUtil.hpp
+++ b/src/cpu/VirtualFluidsCore/Utilities/MathUtil.hpp
@@ -1,97 +1,97 @@
-#ifndef MATHUTIL_H
-#define MATHUTIL_H
-
-#include <math.h>
-#include "muParser.h"
-
-namespace Utilities
-{
-   static bool isEven( int integer )
-   {
-      if ( integer % 2 == 0 )
-         return true;
-      else
-         return false;
-   }
-
-   static bool isOdd( int integer )
-   {
-      if ( integer % 2 != 0 )
-         return true;
-      else
-         return false;
-   }
-
-   //convert from double to int
-   static int cint(double x)
-   {
-      double intpart;
-      if (modf(x,&intpart)>=.5)
-         return static_cast<int> (floor(x)+1);
-      else
-         return static_cast<int> (floor(x));
-   }
-
-   //create new mu parser for duct parabolic profile
-   //inflow in X
-   static mu::Parser getDuctParaboloidX(double Cy, double Hy, double Cz, double Hz, double V)
-   {
-      mu::Parser fct;
-      fct.SetExpr("V*(((-(x2-Cy)^2.0+(Hy/2.0)^2.0)/(Hy/2.0)^2.0)*((-(x3-Cz)^2.0+(Hz/2.0)^2.0)/(Hz/2.0)^2.0))" );
-      fct.DefineConst("Cy", Cy);
-      fct.DefineConst("Hy", Hy);
-      fct.DefineConst("Cz", Cz);
-      fct.DefineConst("Hz", Hz);
-      fct.DefineConst("V" , V );
-      return fct;
-   }
-   //inflow in Y
-   static mu::Parser getDuctParaboloidY(double Cx, double Hx, double Cz, double Hz, double V)
-   {
-      mu::Parser fct;
-      fct.SetExpr("V*(((-(x1-Cx)^2.0+(Hx/2.0)^2.0)/(Hx/2.0)^2.0)*((-(x3-Cz)^2.0+(Hz/2.0)^2.0)/(Hz/2.0)^2.0))" );
-      fct.DefineConst("Cx", Cx);
-      fct.DefineConst("Hx", Hx);
-      fct.DefineConst("Cz", Cz);
-      fct.DefineConst("Hz", Hz);
-      fct.DefineConst("V" , V );
-      return fct;
-   }
-   //inflow in Z
-   static mu::Parser getDuctParaboloidZ(double Cx, double Hx, double Cy, double Hy, double V)
-   {
-      mu::Parser fct;
-      fct.SetExpr("V*(((-(x1-Cx)^2.0+(Hx/2.0)^2.0)/(Hx/2.0)^2.0)*((-(x2-Cy)^2.0+(Hy/2.0)^2.0)/(Hy/2.0)^2.0))" );
-      fct.DefineConst("Cx", Cx);
-      fct.DefineConst("Hx", Hx);
-      fct.DefineConst("Cy", Cy);
-      fct.DefineConst("Hy", Hy);
-      fct.DefineConst("V" , V );
-      return fct;
-   }
-   //hash function
-   static unsigned int RSHash(const std::string& str)
-   {
-      unsigned int b    = 378551;
-      unsigned int a    = 63689;
-      unsigned int hash = 0;
-
-      for(std::size_t i = 0; i < str.length(); i++)
-      {
-         hash = hash * a + str[i];
-         a    = a * b;
-      }
-
-      return hash;
-   }
-   //linear interpolation
-   static double linear_interpolation1D(double x0, double y0, double x1, double y1, double x)
-   {
-      double a = (y1 - y0) / (x1 - x0);
-      double b = -a*x0 + y0;
-      double y = a * x + b;
-      return y;
-   }
-};
-
-#endif
+#ifndef MATHUTIL_H
+#define MATHUTIL_H
+
+#include <math.h>
+#include "muParser.h"
+
+namespace Utilities
+{
+   static bool isEven( int integer )
+   {
+      if ( integer % 2 == 0 )
+         return true;
+      else
+         return false;
+   }
+
+   static bool isOdd( int integer )
+   {
+      if ( integer % 2 != 0 )
+         return true;
+      else
+         return false;
+   }
+
+   //convert from double to int
+   static int cint(double x)
+   {
+      double intpart;
+      if (modf(x,&intpart)>=.5)
+         return static_cast<int> (floor(x)+1);
+      else
+         return static_cast<int> (floor(x));
+   }
+
+   //create new mu parser for duct parabolic profile
+   //inflow in X
+   static mu::Parser getDuctParaboloidX(double Cy, double Hy, double Cz, double Hz, double V)
+   {
+      mu::Parser fct;
+      fct.SetExpr("V*(((-(x2-Cy)^2.0+(Hy/2.0)^2.0)/(Hy/2.0)^2.0)*((-(x3-Cz)^2.0+(Hz/2.0)^2.0)/(Hz/2.0)^2.0))" );
+      fct.DefineConst("Cy", Cy);
+      fct.DefineConst("Hy", Hy);
+      fct.DefineConst("Cz", Cz);
+      fct.DefineConst("Hz", Hz);
+      fct.DefineConst("V" , V );
+      return fct;
+   }
+   //inflow in Y
+   static mu::Parser getDuctParaboloidY(double Cx, double Hx, double Cz, double Hz, double V)
+   {
+      mu::Parser fct;
+      fct.SetExpr("V*(((-(x1-Cx)^2.0+(Hx/2.0)^2.0)/(Hx/2.0)^2.0)*((-(x3-Cz)^2.0+(Hz/2.0)^2.0)/(Hz/2.0)^2.0))" );
+      fct.DefineConst("Cx", Cx);
+      fct.DefineConst("Hx", Hx);
+      fct.DefineConst("Cz", Cz);
+      fct.DefineConst("Hz", Hz);
+      fct.DefineConst("V" , V );
+      return fct;
+   }
+   //inflow in Z
+   static mu::Parser getDuctParaboloidZ(double Cx, double Hx, double Cy, double Hy, double V)
+   {
+      mu::Parser fct;
+      fct.SetExpr("V*(((-(x1-Cx)^2.0+(Hx/2.0)^2.0)/(Hx/2.0)^2.0)*((-(x2-Cy)^2.0+(Hy/2.0)^2.0)/(Hy/2.0)^2.0))" );
+      fct.DefineConst("Cx", Cx);
+      fct.DefineConst("Hx", Hx);
+      fct.DefineConst("Cy", Cy);
+      fct.DefineConst("Hy", Hy);
+      fct.DefineConst("V" , V );
+      return fct;
+   }
+   //hash function
+   static unsigned int RSHash(const std::string& str)
+   {
+      unsigned int b    = 378551;
+      unsigned int a    = 63689;
+      unsigned int hash = 0;
+
+      for(std::size_t i = 0; i < str.length(); i++)
+      {
+         hash = hash * a + str[i];
+         a    = a * b;
+      }
+
+      return hash;
+   }
+   //linear interpolation
+   static double linear_interpolation1D(double x0, double y0, double x1, double y1, double x)
+   {
+      double a = (y1 - y0) / (x1 - x0);
+      double b = -a*x0 + y0;
+      double y = a * x + b;
+      return y;
+   }
+};
+
+#endif
diff --git a/src/cpu/VirtualFluidsCore/Utilities/VoxelMatrixUtil.hpp b/src/cpu/VirtualFluidsCore/Utilities/VoxelMatrixUtil.hpp
index 61a58b6396d30ef9e37eb07b4a1e4a8da6202e8c..7ac3aa19578b0735ffab354a8f45ec714bacd314 100644
--- a/src/cpu/VirtualFluidsCore/Utilities/VoxelMatrixUtil.hpp
+++ b/src/cpu/VirtualFluidsCore/Utilities/VoxelMatrixUtil.hpp
@@ -1,59 +1,59 @@
-#ifndef VoxelMatrixUtil_h__
-#define VoxelMatrixUtil_h__
-
-#include "GbCuboid3D.h"
-#include "NoSlipBCAdapter.h"
-#include "D3Q27Interactor.h"
-#include "SetBcBlocksBlockVisitor.h"
-#include "Block3D.h"
-#include "Grid3D.h"
-
-
-namespace Utilities
-{
-   void voxelMatrixDiscretisation(SPtr<GbVoxelMatrix3D> matrix, std::string& pathname, int myid, int fileCounter, SPtr<Grid3D> grid, int bounceBackOption, bool vmFile)
-   {
-      SPtr<BCAdapter> noSlipPM(new NoSlipBCAdapter(bounceBackOption));
-      SPtr<D3Q27Interactor> vmInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(matrix, grid, noSlipPM, Interactor3D::SOLID));
-
-      if (vmFile)
-      {
-         if (myid == 0) matrix->writeToVTKImageDataASCII(pathname + "/geo/vmatrix" + UbSystem::toString(fileCounter));
-      } 
-      else
-      {
-         GbCuboid3DPtr vmBox(new GbCuboid3D(matrix->getX1Minimum(), matrix->getX2Minimum(), matrix->getX3Minimum(), matrix->getX1Maximum(), matrix->getX2Maximum(), matrix->getX3Maximum()));
-         if (myid == 0) GbSystem3D::writeGeoObject(vmBox.get(), pathname + "/geo/vmbox" + UbSystem::toString(fileCounter), WbWriterVtkXmlASCII::getInstance());
-      }
-
-      //GbCuboid3DPtr vmBox(new GbCuboid3D(matrix->getX1Minimum(), matrix->getX2Minimum(), matrix->getX3Minimum(), matrix->getX1Maximum(), matrix->getX2Maximum(), matrix->getX3Maximum()));
-      //if (myid == 0) GbSystem3D::writeGeoObject(vmBox.get(), pathname + "/geo/vmbox" + UbSystem::toString(fileCounter), WbWriterVtkXmlASCII::getInstance());
-      //SPtr<D3Q27Interactor> vmBoxInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(vmBox, grid, noSlipPM, Interactor3D::SOLID));
-      //SetSolidOrBoundaryBlockVisitor v1(vmBoxInt, SetSolidOrBoundaryBlockVisitor::SOLID);
-      //grid->accept(v1);
-      //SetSolidOrBoundaryBlockVisitor v2(vmBoxInt, SetSolidOrBoundaryBlockVisitor::BC);
-      //grid->accept(v2);
-
-      //std::vector<SPtr<Block3D>> blocks;
-      //std::vector<SPtr<Block3D>>& sb = vmBoxInt->getSolidBlockSet();
-      //if (myid == 0) UBLOG(logINFO, "number of solid blocks = " << sb.size());
-      //blocks.insert(blocks.end(), sb.begin(), sb.end());
-      //std::vector<SPtr<Block3D>>& tb = vmBoxInt->getBcBlocks();
-      //if (myid == 0) UBLOG(logINFO, "number of trans blocks = " << tb.size());
-      //blocks.insert(blocks.end(), tb.begin(), tb.end());
-
-      //if (myid == 0) UBLOG(logINFO, "number of blocks = " << blocks.size());
-
-      //for(SPtr<Block3D> block : blocks)
-      //{
-      //   block->setActive(true);
-      //   vmInt->setDifferencesToGbObject3D(block);
-      //}
-
-      SetBcBlocksBlockVisitor v(vmInt);
-      grid->accept(v);
-      vmInt->initInteractor();
-   }
-}
-#endif // VoxelMatrixUtil_h__
-
+#ifndef VoxelMatrixUtil_h__
+#define VoxelMatrixUtil_h__
+
+#include "GbCuboid3D.h"
+#include "NoSlipBCAdapter.h"
+#include "D3Q27Interactor.h"
+#include "SetBcBlocksBlockVisitor.h"
+#include "Block3D.h"
+#include "Grid3D.h"
+
+
+namespace Utilities
+{
+   void voxelMatrixDiscretisation(SPtr<GbVoxelMatrix3D> matrix, std::string& pathname, int myid, int fileCounter, SPtr<Grid3D> grid, int bounceBackOption, bool vmFile)
+   {
+      SPtr<BCAdapter> noSlipPM(new NoSlipBCAdapter(bounceBackOption));
+      SPtr<D3Q27Interactor> vmInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(matrix, grid, noSlipPM, Interactor3D::SOLID));
+
+      if (vmFile)
+      {
+         if (myid == 0) matrix->writeToVTKImageDataASCII(pathname + "/geo/vmatrix" + UbSystem::toString(fileCounter));
+      } 
+      else
+      {
+         GbCuboid3DPtr vmBox(new GbCuboid3D(matrix->getX1Minimum(), matrix->getX2Minimum(), matrix->getX3Minimum(), matrix->getX1Maximum(), matrix->getX2Maximum(), matrix->getX3Maximum()));
+         if (myid == 0) GbSystem3D::writeGeoObject(vmBox.get(), pathname + "/geo/vmbox" + UbSystem::toString(fileCounter), WbWriterVtkXmlASCII::getInstance());
+      }
+
+      //GbCuboid3DPtr vmBox(new GbCuboid3D(matrix->getX1Minimum(), matrix->getX2Minimum(), matrix->getX3Minimum(), matrix->getX1Maximum(), matrix->getX2Maximum(), matrix->getX3Maximum()));
+      //if (myid == 0) GbSystem3D::writeGeoObject(vmBox.get(), pathname + "/geo/vmbox" + UbSystem::toString(fileCounter), WbWriterVtkXmlASCII::getInstance());
+      //SPtr<D3Q27Interactor> vmBoxInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(vmBox, grid, noSlipPM, Interactor3D::SOLID));
+      //SetSolidOrBoundaryBlockVisitor v1(vmBoxInt, SetSolidOrBoundaryBlockVisitor::SOLID);
+      //grid->accept(v1);
+      //SetSolidOrBoundaryBlockVisitor v2(vmBoxInt, SetSolidOrBoundaryBlockVisitor::BC);
+      //grid->accept(v2);
+
+      //std::vector<SPtr<Block3D>> blocks;
+      //std::vector<SPtr<Block3D>>& sb = vmBoxInt->getSolidBlockSet();
+      //if (myid == 0) UBLOG(logINFO, "number of solid blocks = " << sb.size());
+      //blocks.insert(blocks.end(), sb.begin(), sb.end());
+      //std::vector<SPtr<Block3D>>& tb = vmBoxInt->getBcBlocks();
+      //if (myid == 0) UBLOG(logINFO, "number of trans blocks = " << tb.size());
+      //blocks.insert(blocks.end(), tb.begin(), tb.end());
+
+      //if (myid == 0) UBLOG(logINFO, "number of blocks = " << blocks.size());
+
+      //for(SPtr<Block3D> block : blocks)
+      //{
+      //   block->setActive(true);
+      //   vmInt->setDifferencesToGbObject3D(block);
+      //}
+
+      SetBcBlocksBlockVisitor v(vmInt);
+      grid->accept(v);
+      vmInt->initInteractor();
+   }
+}
+#endif // VoxelMatrixUtil_h__
+
diff --git a/src/cpu/VirtualFluidsCore/Visitors/Block3DVisitor.h b/src/cpu/VirtualFluidsCore/Visitors/Block3DVisitor.h
index 2d15ae84c1478974875fc0494ca1212ee7797279..f333f521c82a3398976d3b5e32b50a230e514728 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/Block3DVisitor.h
+++ b/src/cpu/VirtualFluidsCore/Visitors/Block3DVisitor.h
@@ -1,90 +1,90 @@
-//=======================================================================================
-// ____          ____    __    ______     __________   __      __       __        __         
-// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
-//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
-//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
-//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
-//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
-//      \    \  |    |   ________________________________________________________________    
-//       \    \ |    |  |  ______________________________________________________________|   
-//        \    \|    |  |  |         __          __     __     __     ______      _______    
-//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
-//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
-//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
-//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
-//
-//  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 Block3DVisitor.h
-//! \ingroup Visitors
-//! \author Konstantin Kutscher, Soeren Freudiger, Sebastian Geller
-//=======================================================================================
-
-#ifndef Block3DVisitor_h
-#define Block3DVisitor_h
-
-#include <PointerDefinitions.h>
-
-class Block3D;
-class Grid3D;
-
-//! Abstract class provides interface for visitor design pettern
-class Block3DVisitor
-{
-public:
-   Block3DVisitor() : startLevel(-1), stopLevel(-1)
-   {
-   }
-
-   Block3DVisitor(int startLevel, int stopLevel) : startLevel(startLevel), stopLevel(stopLevel)
-   {
-   }
-
-	virtual ~Block3DVisitor()
-   {
-   }
-	
-   virtual void visit(SPtr<Grid3D> grid, SPtr<Block3D> block) = 0;
-   
-   int  getStartLevel() const; 
-   int  getStopLevel() const;
-   void setStartLevel(int level);
-   void setStopLevel(int level);
-
-private:
-   int  startLevel;
-   int  stopLevel;
-};
-//////////////////////////////////////////////////////////////////////////
-inline int  Block3DVisitor::getStartLevel() const
-{ 
-   return this->startLevel;  
-}
-//////////////////////////////////////////////////////////////////////////
-inline int  Block3DVisitor::getStopLevel() const
-{ 
-   return this->stopLevel;   
-}
-//////////////////////////////////////////////////////////////////////////
-inline void Block3DVisitor::setStartLevel(int level)
-{ 
-   this->startLevel = level; 
-}
-//////////////////////////////////////////////////////////////////////////
-inline void Block3DVisitor::setStopLevel(int level) 
-{ 
-   this->stopLevel = level;  
-}
-
-#endif 
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 Block3DVisitor.h
+//! \ingroup Visitors
+//! \author Konstantin Kutscher, Soeren Freudiger, Sebastian Geller
+//=======================================================================================
+
+#ifndef Block3DVisitor_h
+#define Block3DVisitor_h
+
+#include <PointerDefinitions.h>
+
+class Block3D;
+class Grid3D;
+
+//! Abstract class provides interface for visitor design pettern
+class Block3DVisitor
+{
+public:
+   Block3DVisitor() : startLevel(-1), stopLevel(-1)
+   {
+   }
+
+   Block3DVisitor(int startLevel, int stopLevel) : startLevel(startLevel), stopLevel(stopLevel)
+   {
+   }
+
+	virtual ~Block3DVisitor()
+   {
+   }
+	
+   virtual void visit(SPtr<Grid3D> grid, SPtr<Block3D> block) = 0;
+   
+   int  getStartLevel() const; 
+   int  getStopLevel() const;
+   void setStartLevel(int level);
+   void setStopLevel(int level);
+
+private:
+   int  startLevel;
+   int  stopLevel;
+};
+//////////////////////////////////////////////////////////////////////////
+inline int  Block3DVisitor::getStartLevel() const
+{ 
+   return this->startLevel;  
+}
+//////////////////////////////////////////////////////////////////////////
+inline int  Block3DVisitor::getStopLevel() const
+{ 
+   return this->stopLevel;   
+}
+//////////////////////////////////////////////////////////////////////////
+inline void Block3DVisitor::setStartLevel(int level)
+{ 
+   this->startLevel = level; 
+}
+//////////////////////////////////////////////////////////////////////////
+inline void Block3DVisitor::setStopLevel(int level) 
+{ 
+   this->stopLevel = level;  
+}
+
+#endif 
diff --git a/src/cpu/VirtualFluidsCore/Visitors/BoundaryConditionsBlockVisitor.h b/src/cpu/VirtualFluidsCore/Visitors/BoundaryConditionsBlockVisitor.h
index 6703f81823339ef28aab8336c9296552e3bd010f..9bd52139b77b04d639a9b1ac4d3406d616897a9e 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/BoundaryConditionsBlockVisitor.h
+++ b/src/cpu/VirtualFluidsCore/Visitors/BoundaryConditionsBlockVisitor.h
@@ -1,61 +1,61 @@
-//=======================================================================================
-// ____          ____    __    ______     __________   __      __       __        __         
-// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
-//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
-//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
-//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
-//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
-//      \    \  |    |   ________________________________________________________________    
-//       \    \ |    |  |  ______________________________________________________________|   
-//        \    \|    |  |  |         __          __     __     __     ______      _______    
-//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
-//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
-//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
-//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
-//
-//  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 BoundaryConditionsBlockVisitor.h
-//! \ingroup Visitors
-//! \author Konstantin Kutscher
-//=======================================================================================
-
-#ifndef BoundaryConditionBlockVisitor_h__
-#define BoundaryConditionBlockVisitor_h__
-
-#include <map>
-#include <PointerDefinitions.h>
-
-#include "Block3DVisitor.h"
-
-
-class Grid3D;
-class Block3D;
-class BCAlgorithm;
-class BCAdapter;
-
-//! \brief set boundary conditions
-class BoundaryConditionsBlockVisitor : public Block3DVisitor
-{
-public:
-   BoundaryConditionsBlockVisitor();
-   virtual ~BoundaryConditionsBlockVisitor();
-   
-      void visit(SPtr<Grid3D> grid, SPtr<Block3D> block) override;
-   void addBC(SPtr<BCAdapter> bc);
-protected:
-private:
-   std::map<char, SPtr<BCAlgorithm> > bcMap;
-};
-#endif // BoundaryConditionBlockVisitor_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 BoundaryConditionsBlockVisitor.h
+//! \ingroup Visitors
+//! \author Konstantin Kutscher
+//=======================================================================================
+
+#ifndef BoundaryConditionBlockVisitor_h__
+#define BoundaryConditionBlockVisitor_h__
+
+#include <map>
+#include <PointerDefinitions.h>
+
+#include "Block3DVisitor.h"
+
+
+class Grid3D;
+class Block3D;
+class BCAlgorithm;
+class BCAdapter;
+
+//! \brief set boundary conditions
+class BoundaryConditionsBlockVisitor : public Block3DVisitor
+{
+public:
+   BoundaryConditionsBlockVisitor();
+   virtual ~BoundaryConditionsBlockVisitor();
+   
+      void visit(SPtr<Grid3D> grid, SPtr<Block3D> block) override;
+   void addBC(SPtr<BCAdapter> bc);
+protected:
+private:
+   std::map<char, SPtr<BCAlgorithm> > bcMap;
+};
+#endif // BoundaryConditionBlockVisitor_h__
diff --git a/src/cpu/VirtualFluidsCore/Visitors/ChangeBoundaryDensityBlockVisitor.h b/src/cpu/VirtualFluidsCore/Visitors/ChangeBoundaryDensityBlockVisitor.h
index 050bb66703e3724fe015667f264e64cd5ee535f6..b6eac16431d9ae09624ccbe350170ed0869e9ed4 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/ChangeBoundaryDensityBlockVisitor.h
+++ b/src/cpu/VirtualFluidsCore/Visitors/ChangeBoundaryDensityBlockVisitor.h
@@ -1,24 +1,24 @@
-#ifndef ChangeBoundaryDensityBlockVisitor_h__
-#define ChangeBoundaryDensityBlockVisitor_h__
-
-#include <PointerDefinitions.h>
-
-#include "Block3DVisitor.h"
-
-class Block3D;
-class Grid3D;
-class BoundaryConditions;
-
-class ChangeBoundaryDensityBlockVisitor : public Block3DVisitor
-{
-public:
-   ChangeBoundaryDensityBlockVisitor(float oldBoundaryDensity, float newBoundaryDensity);
-   virtual ~ChangeBoundaryDensityBlockVisitor();
-
-   void visit(SPtr<Grid3D> grid, SPtr<Block3D> block) override;
-private:
-   float oldBoundaryDensity; 
-   float newBoundaryDensity;
-   SPtr<BoundaryConditions> bcPtr;
-};
-#endif // ChangeBoundaryDensityBlockVisitor_h__
+#ifndef ChangeBoundaryDensityBlockVisitor_h__
+#define ChangeBoundaryDensityBlockVisitor_h__
+
+#include <PointerDefinitions.h>
+
+#include "Block3DVisitor.h"
+
+class Block3D;
+class Grid3D;
+class BoundaryConditions;
+
+class ChangeBoundaryDensityBlockVisitor : public Block3DVisitor
+{
+public:
+   ChangeBoundaryDensityBlockVisitor(float oldBoundaryDensity, float newBoundaryDensity);
+   virtual ~ChangeBoundaryDensityBlockVisitor();
+
+   void visit(SPtr<Grid3D> grid, SPtr<Block3D> block) override;
+private:
+   float oldBoundaryDensity; 
+   float newBoundaryDensity;
+   SPtr<BoundaryConditions> bcPtr;
+};
+#endif // ChangeBoundaryDensityBlockVisitor_h__
diff --git a/src/cpu/VirtualFluidsCore/Visitors/CheckRatioBlockVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/CheckRatioBlockVisitor.cpp
index 016589b76bd3314a41fd21e6571e3957f5aaa251..cf8bc597e406cf44e8c31b44ac5d5b764b454351 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/CheckRatioBlockVisitor.cpp
+++ b/src/cpu/VirtualFluidsCore/Visitors/CheckRatioBlockVisitor.cpp
@@ -1,75 +1,75 @@
-#include "CheckRatioBlockVisitor.h"
-#include "Grid3DSystem.h"
-#include "Block3D.h"
-#include "Grid3D.h"
-
-CheckRatioBlockVisitor::CheckRatioBlockVisitor(int levelDepth/*shut be maxGridLevel*/, bool includeNotActiveBlocks)
-   : Block3DVisitor(0, Grid3DSystem::MAXLEVEL)
-   , levelDepth(levelDepth)
-   , includeNotActiveBlocks(includeNotActiveBlocks)
-   , state(true)
-{
-}
-//////////////////////////////////////////////////////////////////////////
-void CheckRatioBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block)
-{
-   int ix1, ix2, ix3, level;
-   ix1 = block->getX1();
-   ix2 = block->getX2();
-   ix3 = block->getX3();
-   level = block->getLevel();
-
-   int nix1, nix2, nix3, nlev;
-   int neighix1, neighix2, neighix3, neighlev;
-   std::vector<SPtr<Block3D>> neighbors;
-   grid->getAllNeighbors(ix1, ix2, ix3, level, this->levelDepth, neighbors);
-   bool hasAdded = false;
-   for (size_t i = 0; i<neighbors.size(); i++)
-   {
-      if ((neighbors[i]->isActive()||includeNotActiveBlocks)
-         &&neighbors[i]->getLevel()>level)
-      {
-         neighix1 = neighbors[i]->getX1();
-         neighix2 = neighbors[i]->getX2();
-         neighix3 = neighbors[i]->getX3();
-         neighlev = neighbors[i]->getLevel();
-         nix1 = neighix1>>1;
-         nix2 = neighix2>>1;
-         nix3 = neighix3>>1;
-         nlev = neighlev-1;
-
-         if (nlev!=level)
-         {
-            //throw UbException(UB_EXARGS, "OverlapBlockVisitor::adaptBlock - leveldifferenz passt nicht, block: "+block->toString());
-            //grid->expandBlock(ix1, ix2, ix3, level);
-            state = state&&false;
-            falseBlock = block;
-
-         }
-         else
-         {
-            state = state&&true;
-         }
-
-         //UBLOG(logINFO, "OverlapBlockVisitor::state= "<<state);
-
-
-      }
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-bool CheckRatioBlockVisitor::getState()
-{
-   return state;
-}
-//////////////////////////////////////////////////////////////////////////
-void CheckRatioBlockVisitor::resetState()
-{
-   state = true;
-}
-//////////////////////////////////////////////////////////////////////////
-std::string CheckRatioBlockVisitor::getStateString()
-{
-   return falseBlock->toString();
-}
-//////////////////////////////////////////////////////////////////////////
+#include "CheckRatioBlockVisitor.h"
+#include "Grid3DSystem.h"
+#include "Block3D.h"
+#include "Grid3D.h"
+
+CheckRatioBlockVisitor::CheckRatioBlockVisitor(int levelDepth/*shut be maxGridLevel*/, bool includeNotActiveBlocks)
+   : Block3DVisitor(0, Grid3DSystem::MAXLEVEL)
+   , levelDepth(levelDepth)
+   , includeNotActiveBlocks(includeNotActiveBlocks)
+   , state(true)
+{
+}
+//////////////////////////////////////////////////////////////////////////
+void CheckRatioBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block)
+{
+   int ix1, ix2, ix3, level;
+   ix1 = block->getX1();
+   ix2 = block->getX2();
+   ix3 = block->getX3();
+   level = block->getLevel();
+
+   int nix1, nix2, nix3, nlev;
+   int neighix1, neighix2, neighix3, neighlev;
+   std::vector<SPtr<Block3D>> neighbors;
+   grid->getAllNeighbors(ix1, ix2, ix3, level, this->levelDepth, neighbors);
+   bool hasAdded = false;
+   for (size_t i = 0; i<neighbors.size(); i++)
+   {
+      if ((neighbors[i]->isActive()||includeNotActiveBlocks)
+         &&neighbors[i]->getLevel()>level)
+      {
+         neighix1 = neighbors[i]->getX1();
+         neighix2 = neighbors[i]->getX2();
+         neighix3 = neighbors[i]->getX3();
+         neighlev = neighbors[i]->getLevel();
+         nix1 = neighix1>>1;
+         nix2 = neighix2>>1;
+         nix3 = neighix3>>1;
+         nlev = neighlev-1;
+
+         if (nlev!=level)
+         {
+            //throw UbException(UB_EXARGS, "OverlapBlockVisitor::adaptBlock - leveldifferenz passt nicht, block: "+block->toString());
+            //grid->expandBlock(ix1, ix2, ix3, level);
+            state = state&&false;
+            falseBlock = block;
+
+         }
+         else
+         {
+            state = state&&true;
+         }
+
+         //UBLOG(logINFO, "OverlapBlockVisitor::state= "<<state);
+
+
+      }
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+bool CheckRatioBlockVisitor::getState()
+{
+   return state;
+}
+//////////////////////////////////////////////////////////////////////////
+void CheckRatioBlockVisitor::resetState()
+{
+   state = true;
+}
+//////////////////////////////////////////////////////////////////////////
+std::string CheckRatioBlockVisitor::getStateString()
+{
+   return falseBlock->toString();
+}
+//////////////////////////////////////////////////////////////////////////
diff --git a/src/cpu/VirtualFluidsCore/Visitors/CheckRatioBlockVisitor.h b/src/cpu/VirtualFluidsCore/Visitors/CheckRatioBlockVisitor.h
index d72785b3c12abfe1d1d0ed181e6789da3b924adb..3b24e6fdf845398b690239c726099cee89703ae2 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/CheckRatioBlockVisitor.h
+++ b/src/cpu/VirtualFluidsCore/Visitors/CheckRatioBlockVisitor.h
@@ -1,33 +1,33 @@
-#ifndef CheckRatioBlockVisitor_H
-#define CheckRatioBlockVisitor_H
-
-#include <string>
-#include <PointerDefinitions.h>
-
-#include "Block3DVisitor.h"
-
-class Grid3D;
-class Block3D;
-
-class CheckRatioBlockVisitor : public Block3DVisitor
-{
-public:
-   CheckRatioBlockVisitor(int levelDepth, bool includeNotActiveBlocks = true);
-
-   virtual ~CheckRatioBlockVisitor() {}
-
-   bool getState();
-   void resetState();
-   std::string getStateString();
-
-      void visit(SPtr<Grid3D> grid, SPtr<Block3D> block) override;
-
-private:
-   int  levelDepth;
-   bool includeNotActiveBlocks;
-   bool state;
-   SPtr<Block3D> falseBlock;
-};
-
-#endif //OverlapBlockVisitor_H
-
+#ifndef CheckRatioBlockVisitor_H
+#define CheckRatioBlockVisitor_H
+
+#include <string>
+#include <PointerDefinitions.h>
+
+#include "Block3DVisitor.h"
+
+class Grid3D;
+class Block3D;
+
+class CheckRatioBlockVisitor : public Block3DVisitor
+{
+public:
+   CheckRatioBlockVisitor(int levelDepth, bool includeNotActiveBlocks = true);
+
+   virtual ~CheckRatioBlockVisitor() {}
+
+   bool getState();
+   void resetState();
+   std::string getStateString();
+
+      void visit(SPtr<Grid3D> grid, SPtr<Block3D> block) override;
+
+private:
+   int  levelDepth;
+   bool includeNotActiveBlocks;
+   bool state;
+   SPtr<Block3D> falseBlock;
+};
+
+#endif //OverlapBlockVisitor_H
+
diff --git a/src/cpu/VirtualFluidsCore/Visitors/CoarsenCrossAndInsideGbObjectBlockVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/CoarsenCrossAndInsideGbObjectBlockVisitor.cpp
index d4185ceff9f51fb33299f1c7a7eff927fe997d9f..bc94a821fbae57735961651025eb04fc12fdb9b2 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/CoarsenCrossAndInsideGbObjectBlockVisitor.cpp
+++ b/src/cpu/VirtualFluidsCore/Visitors/CoarsenCrossAndInsideGbObjectBlockVisitor.cpp
@@ -1,41 +1,41 @@
-#include "CoarsenCrossAndInsideGbObjectBlockVisitor.h"
-#include "Block3D.h"
-#include "Grid3D.h"
-#include <geometry3d/GbObject3D.h>
-
-CoarsenCrossAndInsideGbObjectBlockVisitor::CoarsenCrossAndInsideGbObjectBlockVisitor()
-   : Block3DVisitor(), notActive(true)
-{
-}
-//////////////////////////////////////////////////////////////////////////
-CoarsenCrossAndInsideGbObjectBlockVisitor::CoarsenCrossAndInsideGbObjectBlockVisitor(SPtr<GbObject3D> geoObject, int fineLevel, int coarseLevel)
-   : Block3DVisitor(fineLevel, fineLevel), geoObject(geoObject), notActive(true), coarseLevel(coarseLevel)
-{
-
-}
-//////////////////////////////////////////////////////////////////////////
-CoarsenCrossAndInsideGbObjectBlockVisitor::~CoarsenCrossAndInsideGbObjectBlockVisitor()
-{
-}
-//////////////////////////////////////////////////////////////////////////
-void CoarsenCrossAndInsideGbObjectBlockVisitor::visit(const SPtr<Grid3D> grid, SPtr<Block3D> block)
-{
-   int fineLevel = block->getLevel();
-   if (notActive && block->isNotActive()) return;
-   if (fineLevel>this->getStopLevel()) return;
-
-   UbTupleDouble3 coords = grid->getBlockWorldCoordinates(block);
-   UbTupleDouble3 deltas = grid->getBlockLengths(block);
-   if (geoObject->isCellInsideOrCuttingGbObject3D(val<1>(coords)
-      , val<2>(coords)
-      , val<3>(coords)
-      , val<1>(coords)+val<1>(deltas)
-      , val<2>(coords)+val<2>(deltas)
-      , val<3>(coords)+val<3>(deltas)))
-   {
-      grid->collapseBlock(block->getX1(), block->getX2(), block->getX3(), fineLevel, coarseLevel);
-   }
-
-   return;
-}
-//////////////////////////////////////////////////////////////////////////
+#include "CoarsenCrossAndInsideGbObjectBlockVisitor.h"
+#include "Block3D.h"
+#include "Grid3D.h"
+#include <geometry3d/GbObject3D.h>
+
+CoarsenCrossAndInsideGbObjectBlockVisitor::CoarsenCrossAndInsideGbObjectBlockVisitor()
+   : Block3DVisitor(), notActive(true)
+{
+}
+//////////////////////////////////////////////////////////////////////////
+CoarsenCrossAndInsideGbObjectBlockVisitor::CoarsenCrossAndInsideGbObjectBlockVisitor(SPtr<GbObject3D> geoObject, int fineLevel, int coarseLevel)
+   : Block3DVisitor(fineLevel, fineLevel), geoObject(geoObject), notActive(true), coarseLevel(coarseLevel)
+{
+
+}
+//////////////////////////////////////////////////////////////////////////
+CoarsenCrossAndInsideGbObjectBlockVisitor::~CoarsenCrossAndInsideGbObjectBlockVisitor()
+{
+}
+//////////////////////////////////////////////////////////////////////////
+void CoarsenCrossAndInsideGbObjectBlockVisitor::visit(const SPtr<Grid3D> grid, SPtr<Block3D> block)
+{
+   int fineLevel = block->getLevel();
+   if (notActive && block->isNotActive()) return;
+   if (fineLevel>this->getStopLevel()) return;
+
+   UbTupleDouble3 coords = grid->getBlockWorldCoordinates(block);
+   UbTupleDouble3 deltas = grid->getBlockLengths(block);
+   if (geoObject->isCellInsideOrCuttingGbObject3D(val<1>(coords)
+      , val<2>(coords)
+      , val<3>(coords)
+      , val<1>(coords)+val<1>(deltas)
+      , val<2>(coords)+val<2>(deltas)
+      , val<3>(coords)+val<3>(deltas)))
+   {
+      grid->collapseBlock(block->getX1(), block->getX2(), block->getX3(), fineLevel, coarseLevel);
+   }
+
+   return;
+}
+//////////////////////////////////////////////////////////////////////////
diff --git a/src/cpu/VirtualFluidsCore/Visitors/CoarsenCrossAndInsideGbObjectBlockVisitor.h b/src/cpu/VirtualFluidsCore/Visitors/CoarsenCrossAndInsideGbObjectBlockVisitor.h
index 760d037e7e2eb2b726e8d62858fec9292376c84d..19399d554f5cd03328972e067f98593f78e7e214 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/CoarsenCrossAndInsideGbObjectBlockVisitor.h
+++ b/src/cpu/VirtualFluidsCore/Visitors/CoarsenCrossAndInsideGbObjectBlockVisitor.h
@@ -1,33 +1,33 @@
-#ifndef CoarsenCrossAndInsideGbObjectBlockVisitor_H
-#define CoarsenCrossAndInsideGbObjectBlockVisitor_H
-
-#include <PointerDefinitions.h>
-
-#include "Block3DVisitor.h"
-
-class GbObject3D;
-class Block3D;
-class Grid3D;
-
-//! \brief Refine blocks on base of bounding box which is defined with <i>geoObject</i>
-//! \details The class uses a geometry object for define a bounding box. Inside and across this bounding box will be grid on block basis refinement.
-//! \author K. Kutscher
-class CoarsenCrossAndInsideGbObjectBlockVisitor : public Block3DVisitor
-{
-public:
-   //! A default constructor
-   CoarsenCrossAndInsideGbObjectBlockVisitor();
-   //! A constructor
-   //! \param geoObject a smart pointer to bounding box
-   //! \param refineLevel an integer for refine on this level
-   CoarsenCrossAndInsideGbObjectBlockVisitor(SPtr<GbObject3D> geoObject, int fineLevel, int coarseLevel);
-   virtual ~CoarsenCrossAndInsideGbObjectBlockVisitor();
-      void visit(SPtr<Grid3D> grid, SPtr<Block3D> block) override;
-   //////////////////////////////////////////////////////////////////////////
-protected:
-    SPtr<GbObject3D> geoObject;
-   bool notActive;
-   int coarseLevel;
-};
-
-#endif 
+#ifndef CoarsenCrossAndInsideGbObjectBlockVisitor_H
+#define CoarsenCrossAndInsideGbObjectBlockVisitor_H
+
+#include <PointerDefinitions.h>
+
+#include "Block3DVisitor.h"
+
+class GbObject3D;
+class Block3D;
+class Grid3D;
+
+//! \brief Refine blocks on base of bounding box which is defined with <i>geoObject</i>
+//! \details The class uses a geometry object for define a bounding box. Inside and across this bounding box will be grid on block basis refinement.
+//! \author K. Kutscher
+class CoarsenCrossAndInsideGbObjectBlockVisitor : public Block3DVisitor
+{
+public:
+   //! A default constructor
+   CoarsenCrossAndInsideGbObjectBlockVisitor();
+   //! A constructor
+   //! \param geoObject a smart pointer to bounding box
+   //! \param refineLevel an integer for refine on this level
+   CoarsenCrossAndInsideGbObjectBlockVisitor(SPtr<GbObject3D> geoObject, int fineLevel, int coarseLevel);
+   virtual ~CoarsenCrossAndInsideGbObjectBlockVisitor();
+      void visit(SPtr<Grid3D> grid, SPtr<Block3D> block) override;
+   //////////////////////////////////////////////////////////////////////////
+protected:
+    SPtr<GbObject3D> geoObject;
+   bool notActive;
+   int coarseLevel;
+};
+
+#endif 
diff --git a/src/cpu/VirtualFluidsCore/Visitors/ConnectorBlockVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/ConnectorBlockVisitor.cpp
index d4562dd8ddcd7ffd9f7d46ed226387f3e2bdb0dc..903087355e5b9c0876ded81e0ea8843fd5440bd0 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/ConnectorBlockVisitor.cpp
+++ b/src/cpu/VirtualFluidsCore/Visitors/ConnectorBlockVisitor.cpp
@@ -1,472 +1,472 @@
-#include "ConnectorBlockVisitor.h"
-#include "Grid3DSystem.h"
-#include "ConnectorFactory.h"
-#include "InterpolationProcessor.h"
-#include "Communicator.h"
-#include "Grid3D.h"
-
-ConnectorBlockVisitor::ConnectorBlockVisitor(SPtr<Communicator> comm, LBMReal nu, InterpolationProcessorPtr iProcessor, SPtr<ConnectorFactory> cFactory) :
-   Block3DVisitor(0, Grid3DSystem::MAXLEVEL),
-   comm(comm),
-   nu(nu),
-   iProcessor(iProcessor),
-   cFactory(cFactory)
-{
-}
-//////////////////////////////////////////////////////////////////////////
-ConnectorBlockVisitor::~ConnectorBlockVisitor(void)
-{
-}
-//////////////////////////////////////////////////////////////////////////
-void ConnectorBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block)
-{
-   if (!block) return;
-
-   UBLOG(logDEBUG5, "ConnectorBlockVisitor::visit() - start");
-   UBLOG(logDEBUG5, block->toString());
-
-   gridRank = comm->getProcessID();
-   grid->setRank(gridRank);
-
-   setSameLevelConnectors(grid, block);
-
-   if (grid->getFinestInitializedLevel() > grid->getCoarsestInitializedLevel())
-      setInterpolationConnectors(grid, block);
-
-   if (block->getGlobalID()==2234)
-   {
-      UBLOG(logINFO, block->toString());
-   }
-
-   UBLOG(logDEBUG5, "ConnectorBlockVisitor::visit() - end");
-}
-//////////////////////////////////////////////////////////////////////////
-void ConnectorBlockVisitor::setSameLevelConnectors(SPtr<Grid3D> grid, SPtr<Block3D> block)
-{
-   if (block->getGlobalID()==2234)
-   {
-      UBLOG(logINFO, block->toString());
-   }
-   UBLOG(logDEBUG5, "ConnectorBlockVisitor::setSameLevelConnectors() - start");
-   int blockRank = block->getRank();
-   if (gridRank == blockRank && block->isActive())
-   {
-      block->clearWeight();
-      std::vector<SPtr<Block3D>> neighbors;
-      int ix1 = block->getX1();
-      int ix2 = block->getX2();
-      int ix3 = block->getX3();
-      int level = block->getLevel();
-
-      for (int dir = 0; dir < D3Q27System::ENDDIR; dir++)
-      {
-         SPtr<Block3D> neighBlock = grid->getNeighborBlock(dir, ix1, ix2, ix3, level);
-
-         if (neighBlock)
-         {
-            int neighBlockRank = neighBlock->getRank();
-            if (blockRank == neighBlockRank && neighBlock->isActive())
-            {
-               SPtr<Block3DConnector> connector;
-               connector = cFactory->createSameLevelDirectConnector(block, neighBlock, dir);
-               block->setConnector(connector);
-            }
-            else if (blockRank != neighBlockRank && neighBlock->isActive())
-            {
-               setRemoteConnectors(block, neighBlock, dir);
-            }
-         }
-      }
-   }
-   UBLOG(logDEBUG5, "ConnectorBlockVisitor::setSameLevelConnectors() - end");
-   if (block->getGlobalID()==2234)
-   {
-      UBLOG(logINFO, block->toString());
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-void ConnectorBlockVisitor::setRemoteConnectors(SPtr<Block3D> sblock, SPtr<Block3D> tblock, int dir)
-{
-   UBLOG(logDEBUG5, "ConnectorBlockVisitor::setRemoteConnectors() - start");
-   CreateTransmittersHelper helper;
-   CreateTransmittersHelper::TransmitterPtr sender, receiver;
-   helper.createTransmitters(sblock, tblock, dir, CreateTransmittersHelper::NONE, sender, receiver, comm, CreateTransmittersHelper::MPI);
-
-
-   SPtr<Block3DConnector> connector;
-   connector = cFactory->createSameLevelVectorConnector(sblock, sender, receiver, dir);
-   sblock->setConnector(connector);
-   UBLOG(logDEBUG5, "ConnectorBlockVisitor::setRemoteConnectors() - end");
-}
-//////////////////////////////////////////////////////////////////////////
-void ConnectorBlockVisitor::setInterpolationConnectors(SPtr<Grid3D> grid, SPtr<Block3D> block)
-{
-   if (block->getGlobalID()==2234)
-   {
-      UBLOG(logINFO, block->toString());
-   }
-   UBLOG(logDEBUG5, "ConnectorBlockVisitor::setInterpolationConnectors() - start");
-   int blockRank = block->getRank();
-
-   //search for all blocks with different ranks
-   if (block->hasInterpolationFlagCF() && block->isActive())
-   {
-      int fbx1 = block->getX1() << 1;
-      int fbx2 = block->getX2() << 1;
-      int fbx3 = block->getX3() << 1;
-      int level = block->getLevel() + 1;
-
-      if (block->hasInterpolationFlagCF(D3Q27System::E))
-      {
-         SPtr<Block3D> fblock00 = grid->getBlock(fbx1+1, fbx2, fbx3, level);
-         SPtr<Block3D> fblock10 = grid->getBlock(fbx1+1, fbx2+1, fbx3, level);
-         SPtr<Block3D> fblock01 = grid->getBlock(fbx1+1, fbx2, fbx3+1, level);
-         SPtr<Block3D> fblock11 = grid->getBlock(fbx1+1, fbx2+1, fbx3+1, level);
-
-         setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::E);
-      }
-      if (block->hasInterpolationFlagCF(D3Q27System::W))
-      {
-         SPtr<Block3D> fblock00 = grid->getBlock(fbx1, fbx2, fbx3, level);
-         SPtr<Block3D> fblock10 = grid->getBlock(fbx1, fbx2+1, fbx3, level);
-         SPtr<Block3D> fblock01 = grid->getBlock(fbx1, fbx2, fbx3+1, level);
-         SPtr<Block3D> fblock11 = grid->getBlock(fbx1, fbx2+1, fbx3+1, level);
-
-         setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::W);
-      }
-      if (block->hasInterpolationFlagCF(D3Q27System::N))
-      {
-         SPtr<Block3D> fblock00 = grid->getBlock(fbx1, fbx2+1, fbx3, level);
-         SPtr<Block3D> fblock10 = grid->getBlock(fbx1+1, fbx2+1, fbx3, level);
-         SPtr<Block3D> fblock01 = grid->getBlock(fbx1, fbx2+1, fbx3+1, level);
-         SPtr<Block3D> fblock11 = grid->getBlock(fbx1+1, fbx2+1, fbx3+1, level);
-
-         setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::N);
-      }
-      if (block->hasInterpolationFlagCF(D3Q27System::S))
-      {
-         SPtr<Block3D> fblock00 = grid->getBlock(fbx1, fbx2, fbx3, level);
-         SPtr<Block3D> fblock10 = grid->getBlock(fbx1+1, fbx2, fbx3, level);
-         SPtr<Block3D> fblock01 = grid->getBlock(fbx1, fbx2, fbx3+1, level);
-         SPtr<Block3D> fblock11 = grid->getBlock(fbx1+1, fbx2, fbx3+1, level);
-
-         setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::S);
-      }
-      if (block->hasInterpolationFlagCF(D3Q27System::T))
-      {
-         SPtr<Block3D> fblock00 = grid->getBlock(fbx1, fbx2, fbx3+1, level);
-         SPtr<Block3D> fblock10 = grid->getBlock(fbx1+1, fbx2, fbx3+1, level);
-         SPtr<Block3D> fblock01 = grid->getBlock(fbx1, fbx2+1, fbx3+1, level);
-         SPtr<Block3D> fblock11 = grid->getBlock(fbx1+1, fbx2+1, fbx3+1, level);
-
-         setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::T);
-      }
-      if (block->hasInterpolationFlagCF(D3Q27System::B))
-      {
-         SPtr<Block3D> fblock00 = grid->getBlock(fbx1, fbx2, fbx3, level);
-         SPtr<Block3D> fblock10 = grid->getBlock(fbx1+1, fbx2, fbx3, level);
-         SPtr<Block3D> fblock01 = grid->getBlock(fbx1, fbx2+1, fbx3, level);
-         SPtr<Block3D> fblock11 = grid->getBlock(fbx1+1, fbx2+1, fbx3, level);
-
-         setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::B);
-      }
-
-      //////NE-NW-SE-SW
-      if (block->hasInterpolationFlagCF(D3Q27System::NE)&&!block->hasInterpolationFlagCF(D3Q27System::N) && !block->hasInterpolationFlagCF(D3Q27System::E))
-      {
-         SPtr<Block3D> fblock00 = grid->getBlock(fbx1+1, fbx2+1, fbx3+0, level);
-         SPtr<Block3D> fblock10 = grid->getBlock(fbx1+1, fbx2+1, fbx3+1, level);
-         SPtr<Block3D> fblock01;
-         SPtr<Block3D> fblock11;
-
-         setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::NE);
-      }
-      if (block->hasInterpolationFlagCF(D3Q27System::SW)&& !block->hasInterpolationFlagCF(D3Q27System::W) && !block->hasInterpolationFlagCF(D3Q27System::S))
-      {
-         SPtr<Block3D> fblock00 = grid->getBlock(fbx1, fbx2, fbx3, level);
-         SPtr<Block3D> fblock10 = grid->getBlock(fbx1, fbx2, fbx3+1, level);
-         SPtr<Block3D> fblock01;
-         SPtr<Block3D> fblock11;
-
-         setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::SW);
-      }
-      if (block->hasInterpolationFlagCF(D3Q27System::SE)&& !block->hasInterpolationFlagCF(D3Q27System::E) && !block->hasInterpolationFlagCF(D3Q27System::S))
-      {
-         SPtr<Block3D> fblock00 = grid->getBlock(fbx1+1, fbx2, fbx3+0, level);
-         SPtr<Block3D> fblock10 = grid->getBlock(fbx1+1, fbx2, fbx3+1, level);
-         SPtr<Block3D> fblock01;
-         SPtr<Block3D> fblock11;
-
-         setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::SE);
-      }
-      if (block->hasInterpolationFlagCF(D3Q27System::NW)&& !block->hasInterpolationFlagCF(D3Q27System::N) && !block->hasInterpolationFlagCF(D3Q27System::W))
-      {
-         SPtr<Block3D> fblock00 = grid->getBlock(fbx1, fbx2+1, fbx3, level);
-         SPtr<Block3D> fblock10 = grid->getBlock(fbx1, fbx2+1, fbx3+1, level);
-         SPtr<Block3D> fblock01;
-         SPtr<Block3D> fblock11;
-
-         setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::NW);
-      }
-
-      /////////TE-BW-BE-TW 1-0
-      if (block->hasInterpolationFlagCF(D3Q27System::TE)&& !block->hasInterpolationFlagCF(D3Q27System::E) && !block->hasInterpolationFlagCF(D3Q27System::T))
-      {
-         SPtr<Block3D> fblock00 = grid->getBlock(fbx1+1, fbx2+0, fbx3+1, level);
-         SPtr<Block3D> fblock10 = grid->getBlock(fbx1+1, fbx2+1, fbx3+1, level);
-         SPtr<Block3D> fblock01;
-         SPtr<Block3D> fblock11;
-
-         setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::TE);
-      }
-      if (block->hasInterpolationFlagCF(D3Q27System::BW)&& !block->hasInterpolationFlagCF(D3Q27System::W) && !block->hasInterpolationFlagCF(D3Q27System::B))
-      {
-
-         SPtr<Block3D> fblock00 = grid->getBlock(fbx1, fbx2+0, fbx3, level);
-         SPtr<Block3D> fblock10 = grid->getBlock(fbx1, fbx2+1, fbx3, level);
-         SPtr<Block3D> fblock01;
-         SPtr<Block3D> fblock11;
-
-         setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::BW);
-      }
-      if (block->hasInterpolationFlagCF(D3Q27System::BE)&& !block->hasInterpolationFlagCF(D3Q27System::E) && !block->hasInterpolationFlagCF(D3Q27System::B))
-      {
-         SPtr<Block3D> fblock00 = grid->getBlock(fbx1+1, fbx2+0, fbx3, level);
-         SPtr<Block3D> fblock10 = grid->getBlock(fbx1+1, fbx2+1, fbx3, level);
-         SPtr<Block3D> fblock01;
-         SPtr<Block3D> fblock11;
-
-         setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::BE);
-      }
-      if (block->hasInterpolationFlagCF(D3Q27System::TW)&& !block->hasInterpolationFlagCF(D3Q27System::W) && !block->hasInterpolationFlagCF(D3Q27System::T))
-      {
-         SPtr<Block3D> fblock00 = grid->getBlock(fbx1, fbx2+0, fbx3+1, level);
-         SPtr<Block3D> fblock10 = grid->getBlock(fbx1, fbx2+1, fbx3+1, level);
-         SPtr<Block3D> fblock01;
-         SPtr<Block3D> fblock11;
-
-         setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::TW);
-      }
-
-      //////TN-BS-BN-TS
-      if (block->hasInterpolationFlagCF(D3Q27System::TN)&& !block->hasInterpolationFlagCF(D3Q27System::N) && !block->hasInterpolationFlagCF(D3Q27System::T))
-      {
-         SPtr<Block3D> fblock00 = grid->getBlock(fbx1+0, fbx2+1, fbx3+1, level);
-         SPtr<Block3D> fblock10 = grid->getBlock(fbx1+1, fbx2+1, fbx3+1, level);
-         SPtr<Block3D> fblock01;
-         SPtr<Block3D> fblock11;
-
-         setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::TN);
-      }
-      if (block->hasInterpolationFlagCF(D3Q27System::BS)&& !block->hasInterpolationFlagCF(D3Q27System::S) && !block->hasInterpolationFlagCF(D3Q27System::B))
-      {
-         SPtr<Block3D> fblock00 = grid->getBlock(fbx1+0, fbx2, fbx3, level);
-         SPtr<Block3D> fblock10 = grid->getBlock(fbx1+1, fbx2, fbx3, level);
-         SPtr<Block3D> fblock01;
-         SPtr<Block3D> fblock11;
-
-         setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::BS);
-      }
-      if (block->hasInterpolationFlagCF(D3Q27System::BN)&& !block->hasInterpolationFlagCF(D3Q27System::N) && !block->hasInterpolationFlagCF(D3Q27System::B))
-      {
-         SPtr<Block3D> fblock00 = grid->getBlock(fbx1+0, fbx2+1, fbx3, level);
-         SPtr<Block3D> fblock10 = grid->getBlock(fbx1+1, fbx2+1, fbx3, level);
-         SPtr<Block3D> fblock01;
-         SPtr<Block3D> fblock11;
-
-         setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::BN);
-      }
-      if (block->hasInterpolationFlagCF(D3Q27System::TS)&& !block->hasInterpolationFlagCF(D3Q27System::S) && !block->hasInterpolationFlagCF(D3Q27System::T))
-      {
-         SPtr<Block3D> fblock00 = grid->getBlock(fbx1+0, fbx2, fbx3+1, level);
-         SPtr<Block3D> fblock10 = grid->getBlock(fbx1+1, fbx2, fbx3+1, level);
-         SPtr<Block3D> fblock01;
-         SPtr<Block3D> fblock11;
-
-         setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::TS);
-      }
-
-
-
-
-      //////corners
-      if (block->hasInterpolationFlagCF(D3Q27System::TNE)&&!block->hasInterpolationFlagCF(D3Q27System::TE)&&!block->hasInterpolationFlagCF(D3Q27System::TN)&&!block->hasInterpolationFlagCF(D3Q27System::NE)&&!block->hasInterpolationFlagCF(D3Q27System::T)&&!block->hasInterpolationFlagCF(D3Q27System::N) && !block->hasInterpolationFlagCF(D3Q27System::E))
-      {
-         SPtr<Block3D> fblock00 = grid->getBlock(fbx1+1, fbx2+1, fbx3+1, level);
-         SPtr<Block3D> fblock10;// = grid->getBlock(fbx1+1, fbx2+1, fbx3+0, level);
-         SPtr<Block3D> fblock01;// = grid->getBlock(fbx1+1, fbx2+1, fbx3+1, level);
-         SPtr<Block3D> fblock11;// = grid->getBlock(fbx1+1, fbx2+1, fbx3+1, level);
-
-         setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::TNE);
-      }
-      if (block->hasInterpolationFlagCF(D3Q27System::TSW)&&!block->hasInterpolationFlagCF(D3Q27System::TW)&&!block->hasInterpolationFlagCF(D3Q27System::TS)&& !block->hasInterpolationFlagCF(D3Q27System::SW)&& !block->hasInterpolationFlagCF(D3Q27System::T)&& !block->hasInterpolationFlagCF(D3Q27System::W) && !block->hasInterpolationFlagCF(D3Q27System::S))
-      {
-         SPtr<Block3D> fblock00 = grid->getBlock(fbx1, fbx2, fbx3+1, level);
-         SPtr<Block3D> fblock10;// = grid->getBlock(fbx1, fbx2, fbx3, level);
-         SPtr<Block3D> fblock01;// = grid->getBlock(fbx1, fbx2, fbx3+1, level);
-         SPtr<Block3D> fblock11;// = grid->getBlock(fbx1, fbx2, fbx3+1, level);
-
-         setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::TSW);
-      }
-      if (block->hasInterpolationFlagCF(D3Q27System::TSE)&&!block->hasInterpolationFlagCF(D3Q27System::TE)&&!block->hasInterpolationFlagCF(D3Q27System::TS)&& !block->hasInterpolationFlagCF(D3Q27System::SE)&& !block->hasInterpolationFlagCF(D3Q27System::T)&& !block->hasInterpolationFlagCF(D3Q27System::E) && !block->hasInterpolationFlagCF(D3Q27System::S))
-      {
-         SPtr<Block3D> fblock00 = grid->getBlock(fbx1+1, fbx2, fbx3+1, level);
-         SPtr<Block3D> fblock10;// = grid->getBlock(fbx1+1, fbx2, fbx3+0, level);
-         SPtr<Block3D> fblock01;// = grid->getBlock(fbx1+1, fbx2, fbx3+1, level);
-         SPtr<Block3D> fblock11;// = grid->getBlock(fbx1+1, fbx2, fbx3+1, level);
-
-         setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::TSE);
-      }
-      if (block->hasInterpolationFlagCF(D3Q27System::TNW)&&!block->hasInterpolationFlagCF(D3Q27System::TW)&&!block->hasInterpolationFlagCF(D3Q27System::TN)&& !block->hasInterpolationFlagCF(D3Q27System::NW)&& !block->hasInterpolationFlagCF(D3Q27System::T)&& !block->hasInterpolationFlagCF(D3Q27System::N) && !block->hasInterpolationFlagCF(D3Q27System::W))
-      {
-         SPtr<Block3D> fblock00 = grid->getBlock(fbx1, fbx2+1, fbx3+1, level);
-         SPtr<Block3D> fblock10;// = grid->getBlock(fbx1, fbx2+1, fbx3, level);
-         SPtr<Block3D> fblock01;// = grid->getBlock(fbx1, fbx2+1, fbx3+1, level);
-         SPtr<Block3D> fblock11;// = grid->getBlock(fbx1, fbx2+1, fbx3+1, level);
-
-         setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::TNW);
-      }
-      if (block->hasInterpolationFlagCF(D3Q27System::BNE)&&!block->hasInterpolationFlagCF(D3Q27System::BE)&&!block->hasInterpolationFlagCF(D3Q27System::BN)&& !block->hasInterpolationFlagCF(D3Q27System::NE)&&!block->hasInterpolationFlagCF(D3Q27System::B)&&!block->hasInterpolationFlagCF(D3Q27System::N) && !block->hasInterpolationFlagCF(D3Q27System::E))
-      {
-         SPtr<Block3D> fblock00 = grid->getBlock(fbx1+1, fbx2+1, fbx3+0, level);
-         SPtr<Block3D> fblock10;// = grid->getBlock(fbx1+1, fbx2+1, fbx3+0, level);
-         SPtr<Block3D> fblock01;// = grid->getBlock(fbx1+1, fbx2+1, fbx3+1, level);
-         SPtr<Block3D> fblock11;// = grid->getBlock(fbx1+1, fbx2+1, fbx3+1, level);
-
-         setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::BNE);
-      }
-      if (block->hasInterpolationFlagCF(D3Q27System::BSW)&& !block->hasInterpolationFlagCF(D3Q27System::BS)&& !block->hasInterpolationFlagCF(D3Q27System::BW)&& !block->hasInterpolationFlagCF(D3Q27System::SW)&& !block->hasInterpolationFlagCF(D3Q27System::B)&& !block->hasInterpolationFlagCF(D3Q27System::W) && !block->hasInterpolationFlagCF(D3Q27System::S))
-      {
-         SPtr<Block3D> fblock00 = grid->getBlock(fbx1, fbx2, fbx3+0, level);
-         SPtr<Block3D> fblock10;// = grid->getBlock(fbx1, fbx2, fbx3, level);
-         SPtr<Block3D> fblock01;// = grid->getBlock(fbx1, fbx2, fbx3+1, level);
-         SPtr<Block3D> fblock11;// = grid->getBlock(fbx1, fbx2, fbx3+1, level);
-
-         setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::BSW);
-      }
-      if (block->hasInterpolationFlagCF(D3Q27System::BSE)&& !block->hasInterpolationFlagCF(D3Q27System::BS)&& !block->hasInterpolationFlagCF(D3Q27System::BE)&& !block->hasInterpolationFlagCF(D3Q27System::SE)&& !block->hasInterpolationFlagCF(D3Q27System::B)&& !block->hasInterpolationFlagCF(D3Q27System::E) && !block->hasInterpolationFlagCF(D3Q27System::S))
-      {
-         SPtr<Block3D> fblock00 = grid->getBlock(fbx1+1, fbx2, fbx3, level);
-         SPtr<Block3D> fblock10;// = grid->getBlock(fbx1+1, fbx2, fbx3+0, level);
-         SPtr<Block3D> fblock01;// = grid->getBlock(fbx1+1, fbx2, fbx3+1, level);
-         SPtr<Block3D> fblock11;// = grid->getBlock(fbx1+1, fbx2, fbx3+1, level);
-
-         setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::BSE);
-      }
-      if (block->hasInterpolationFlagCF(D3Q27System::BNW)&& !block->hasInterpolationFlagCF(D3Q27System::BN)&& !block->hasInterpolationFlagCF(D3Q27System::BW)&& !block->hasInterpolationFlagCF(D3Q27System::NW)&& !block->hasInterpolationFlagCF(D3Q27System::B)&& !block->hasInterpolationFlagCF(D3Q27System::N) && !block->hasInterpolationFlagCF(D3Q27System::W))
-      {
-         SPtr<Block3D> fblock00 = grid->getBlock(fbx1, fbx2+1, fbx3+0, level);
-         SPtr<Block3D> fblock10;// = grid->getBlock(fbx1, fbx2+1, fbx3, level);
-         SPtr<Block3D> fblock01;// = grid->getBlock(fbx1, fbx2+1, fbx3+1, level);
-         SPtr<Block3D> fblock11;// = grid->getBlock(fbx1, fbx2+1, fbx3+1, level);
-
-         setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::BNW);
-      }
-
-   }
-   UBLOG(logDEBUG5, "ConnectorBlockVisitor::setInterpolationConnectors() - end");
-}
-//////////////////////////////////////////////////////////////////////////
-
-void ConnectorBlockVisitor::setInterpolationConnectors(SPtr<Block3D> fblock00, SPtr<Block3D> fblock10, SPtr<Block3D> fblock01, SPtr<Block3D> fblock11, SPtr<Block3D> cBlock, int dir)
-{
-   UBLOG(logDEBUG5, "ConnectorBlockVisitor::setInterpolationConnectors(...) - start");
-   int fblock00Rank = -999, fblock10Rank = -999, fblock01Rank = -999, fblock11Rank = -999;
-   if (fblock00) fblock00Rank = fblock00->getRank();
-   if (fblock01) fblock01Rank = fblock01->getRank();
-   if (fblock10) fblock10Rank = fblock10->getRank();
-   if (fblock11) fblock11Rank = fblock11->getRank();
-   int cBlockRank = cBlock->getRank();
-
-   LBMReal omegaF;
-   if (fblock00) omegaF = LBMSystem::calcCollisionFactor(nu, fblock00->getLevel());
-   if (fblock01) omegaF = LBMSystem::calcCollisionFactor(nu, fblock01->getLevel());
-   if (fblock10) omegaF = LBMSystem::calcCollisionFactor(nu, fblock10->getLevel());
-   if (fblock11) omegaF = LBMSystem::calcCollisionFactor(nu, fblock11->getLevel());
-   LBMReal omegaC = LBMSystem::calcCollisionFactor(nu, cBlock->getLevel());
-   iProcessor->setOmegas(omegaC, omegaF);
-
-   InterpolationProcessorPtr cIProcessor(iProcessor->clone());
-   InterpolationProcessorPtr fIProcessor00(iProcessor->clone());
-   InterpolationProcessorPtr fIProcessor10(iProcessor->clone());
-   InterpolationProcessorPtr fIProcessor01(iProcessor->clone());
-   InterpolationProcessorPtr fIProcessor11(iProcessor->clone());
-
-   CreateTransmittersHelper::TransmitterPtr senderCF00, receiverCF00,
-                                             senderCF01, receiverCF01,
-                                             senderCF10, receiverCF10,
-                                             senderCF11, receiverCF11,
-                                             senderFC00, receiverFC00,
-                                             senderFC01, receiverFC01,
-                                             senderFC10, receiverFC10,
-                                             senderFC11, receiverFC11;
-
-   if (fblock00) createTransmitters(cBlock, fblock00, dir, CreateTransmittersHelper::SW, senderCF00, receiverCF00, senderFC00, receiverFC00);
-   if (fblock01) createTransmitters(cBlock, fblock01, dir, CreateTransmittersHelper::NW, senderCF01, receiverCF01, senderFC01, receiverFC01);
-   if (fblock10) createTransmitters(cBlock, fblock10, dir, CreateTransmittersHelper::SE, senderCF10, receiverCF10, senderFC10, receiverFC10);
-   if (fblock11) createTransmitters(cBlock, fblock11, dir, CreateTransmittersHelper::NE, senderCF11, receiverCF11, senderFC11, receiverFC11);
-
-   if (cBlockRank == gridRank)
-   {
-      SPtr<Block3DConnector> connector = cFactory->createCoarseToFineConnector(cBlock,
-         senderCF00, receiverCF00, senderCF01, receiverCF01,
-         senderCF10, receiverCF10, senderCF11, receiverCF11,
-         dir, cIProcessor);
-      cBlock->setConnector(connector);
-   }
-   if (fblock00 && fblock00Rank == gridRank)
-   {
-      SPtr<Block3DConnector> connector = cFactory->createFineToCoarseConnector(fblock00,
-         senderFC00, receiverFC00, dir, fIProcessor00, FineToCoarseBlock3DConnector::Type00);
-      fblock00->setConnector(connector);
-   }
-   if (fblock01 && fblock01Rank == gridRank)
-   {
-      SPtr<Block3DConnector> connector = cFactory->createFineToCoarseConnector(fblock01,
-         senderFC01, receiverFC01, dir, fIProcessor01, FineToCoarseBlock3DConnector::Type01);
-      fblock01->setConnector(connector);
-   }
-   if (fblock10 && fblock10Rank == gridRank)
-   {
-      SPtr<Block3DConnector> connector = cFactory->createFineToCoarseConnector(fblock10,
-         senderFC10, receiverFC10, dir, fIProcessor10, FineToCoarseBlock3DConnector::Type10);
-      fblock10->setConnector(connector);
-   }
-   if (fblock11 && fblock11Rank == gridRank)
-   {
-      SPtr<Block3DConnector> connector = cFactory->createFineToCoarseConnector(fblock11,
-         senderFC11, receiverFC11, dir, fIProcessor11, FineToCoarseBlock3DConnector::Type11);
-      fblock11->setConnector(connector);
-   }
-   UBLOG(logDEBUG5, "ConnectorBlockVisitor::setInterpolationConnectors(...) - end");
-}
-//////////////////////////////////////////////////////////////////////////
-void ConnectorBlockVisitor::createTransmitters(SPtr<Block3D> cBlock, SPtr<Block3D> fBlock, int dir,
-   CreateTransmittersHelper::IBlock ib,
-   CreateTransmittersHelper::TransmitterPtr& senderCF,
-   CreateTransmittersHelper::TransmitterPtr& receiverCF,
-   CreateTransmittersHelper::TransmitterPtr& senderFC,
-   CreateTransmittersHelper::TransmitterPtr& receiverFC)
-{
-   UBLOG(logDEBUG5, "ConnectorBlockVisitor::createTransmitters(...) - start");
-   CreateTransmittersHelper helper;
-   bool MPIpool = true;
-   bool orthogonal = false;
-   int fBlockRank = fBlock->getRank();
-   int cBlockRank = cBlock->getRank();
-   if (fBlockRank == cBlockRank && fBlockRank == gridRank)
-   {
-      senderCF = receiverFC = CreateTransmittersHelper::TransmitterPtr(new TbLocalTransmitter< CbVector< LBMReal > >());
-      senderFC = receiverCF = CreateTransmittersHelper::TransmitterPtr(new TbLocalTransmitter< CbVector< LBMReal > >());
-   }
-   else if (cBlockRank == gridRank)
-   {
-      helper.createTransmitters(cBlock, fBlock, dir, ib, senderCF, receiverCF, comm, CreateTransmittersHelper::MPI);
-   }
-   else if (fBlockRank == gridRank)
-   {
-      helper.createTransmitters(fBlock, cBlock, dir, ib, senderFC, receiverFC, comm, CreateTransmittersHelper::MPI);
-   }
-   UBLOG(logDEBUG5, "ConnectorBlockVisitor::createTransmitters(...) - end");
-}
-
+#include "ConnectorBlockVisitor.h"
+#include "Grid3DSystem.h"
+#include "ConnectorFactory.h"
+#include "InterpolationProcessor.h"
+#include "Communicator.h"
+#include "Grid3D.h"
+
+ConnectorBlockVisitor::ConnectorBlockVisitor(SPtr<Communicator> comm, LBMReal nu, InterpolationProcessorPtr iProcessor, SPtr<ConnectorFactory> cFactory) :
+   Block3DVisitor(0, Grid3DSystem::MAXLEVEL),
+   comm(comm),
+   nu(nu),
+   iProcessor(iProcessor),
+   cFactory(cFactory)
+{
+}
+//////////////////////////////////////////////////////////////////////////
+ConnectorBlockVisitor::~ConnectorBlockVisitor(void)
+{
+}
+//////////////////////////////////////////////////////////////////////////
+void ConnectorBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block)
+{
+   if (!block) return;
+
+   UBLOG(logDEBUG5, "ConnectorBlockVisitor::visit() - start");
+   UBLOG(logDEBUG5, block->toString());
+
+   gridRank = comm->getProcessID();
+   grid->setRank(gridRank);
+
+   setSameLevelConnectors(grid, block);
+
+   if (grid->getFinestInitializedLevel() > grid->getCoarsestInitializedLevel())
+      setInterpolationConnectors(grid, block);
+
+   if (block->getGlobalID()==2234)
+   {
+      UBLOG(logINFO, block->toString());
+   }
+
+   UBLOG(logDEBUG5, "ConnectorBlockVisitor::visit() - end");
+}
+//////////////////////////////////////////////////////////////////////////
+void ConnectorBlockVisitor::setSameLevelConnectors(SPtr<Grid3D> grid, SPtr<Block3D> block)
+{
+   if (block->getGlobalID()==2234)
+   {
+      UBLOG(logINFO, block->toString());
+   }
+   UBLOG(logDEBUG5, "ConnectorBlockVisitor::setSameLevelConnectors() - start");
+   int blockRank = block->getRank();
+   if (gridRank == blockRank && block->isActive())
+   {
+      block->clearWeight();
+      std::vector<SPtr<Block3D>> neighbors;
+      int ix1 = block->getX1();
+      int ix2 = block->getX2();
+      int ix3 = block->getX3();
+      int level = block->getLevel();
+
+      for (int dir = 0; dir < D3Q27System::ENDDIR; dir++)
+      {
+         SPtr<Block3D> neighBlock = grid->getNeighborBlock(dir, ix1, ix2, ix3, level);
+
+         if (neighBlock)
+         {
+            int neighBlockRank = neighBlock->getRank();
+            if (blockRank == neighBlockRank && neighBlock->isActive())
+            {
+               SPtr<Block3DConnector> connector;
+               connector = cFactory->createSameLevelDirectConnector(block, neighBlock, dir);
+               block->setConnector(connector);
+            }
+            else if (blockRank != neighBlockRank && neighBlock->isActive())
+            {
+               setRemoteConnectors(block, neighBlock, dir);
+            }
+         }
+      }
+   }
+   UBLOG(logDEBUG5, "ConnectorBlockVisitor::setSameLevelConnectors() - end");
+   if (block->getGlobalID()==2234)
+   {
+      UBLOG(logINFO, block->toString());
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+void ConnectorBlockVisitor::setRemoteConnectors(SPtr<Block3D> sblock, SPtr<Block3D> tblock, int dir)
+{
+   UBLOG(logDEBUG5, "ConnectorBlockVisitor::setRemoteConnectors() - start");
+   CreateTransmittersHelper helper;
+   CreateTransmittersHelper::TransmitterPtr sender, receiver;
+   helper.createTransmitters(sblock, tblock, dir, CreateTransmittersHelper::NONE, sender, receiver, comm, CreateTransmittersHelper::MPI);
+
+
+   SPtr<Block3DConnector> connector;
+   connector = cFactory->createSameLevelVectorConnector(sblock, sender, receiver, dir);
+   sblock->setConnector(connector);
+   UBLOG(logDEBUG5, "ConnectorBlockVisitor::setRemoteConnectors() - end");
+}
+//////////////////////////////////////////////////////////////////////////
+void ConnectorBlockVisitor::setInterpolationConnectors(SPtr<Grid3D> grid, SPtr<Block3D> block)
+{
+   if (block->getGlobalID()==2234)
+   {
+      UBLOG(logINFO, block->toString());
+   }
+   UBLOG(logDEBUG5, "ConnectorBlockVisitor::setInterpolationConnectors() - start");
+   int blockRank = block->getRank();
+
+   //search for all blocks with different ranks
+   if (block->hasInterpolationFlagCF() && block->isActive())
+   {
+      int fbx1 = block->getX1() << 1;
+      int fbx2 = block->getX2() << 1;
+      int fbx3 = block->getX3() << 1;
+      int level = block->getLevel() + 1;
+
+      if (block->hasInterpolationFlagCF(D3Q27System::E))
+      {
+         SPtr<Block3D> fblock00 = grid->getBlock(fbx1+1, fbx2, fbx3, level);
+         SPtr<Block3D> fblock10 = grid->getBlock(fbx1+1, fbx2+1, fbx3, level);
+         SPtr<Block3D> fblock01 = grid->getBlock(fbx1+1, fbx2, fbx3+1, level);
+         SPtr<Block3D> fblock11 = grid->getBlock(fbx1+1, fbx2+1, fbx3+1, level);
+
+         setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::E);
+      }
+      if (block->hasInterpolationFlagCF(D3Q27System::W))
+      {
+         SPtr<Block3D> fblock00 = grid->getBlock(fbx1, fbx2, fbx3, level);
+         SPtr<Block3D> fblock10 = grid->getBlock(fbx1, fbx2+1, fbx3, level);
+         SPtr<Block3D> fblock01 = grid->getBlock(fbx1, fbx2, fbx3+1, level);
+         SPtr<Block3D> fblock11 = grid->getBlock(fbx1, fbx2+1, fbx3+1, level);
+
+         setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::W);
+      }
+      if (block->hasInterpolationFlagCF(D3Q27System::N))
+      {
+         SPtr<Block3D> fblock00 = grid->getBlock(fbx1, fbx2+1, fbx3, level);
+         SPtr<Block3D> fblock10 = grid->getBlock(fbx1+1, fbx2+1, fbx3, level);
+         SPtr<Block3D> fblock01 = grid->getBlock(fbx1, fbx2+1, fbx3+1, level);
+         SPtr<Block3D> fblock11 = grid->getBlock(fbx1+1, fbx2+1, fbx3+1, level);
+
+         setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::N);
+      }
+      if (block->hasInterpolationFlagCF(D3Q27System::S))
+      {
+         SPtr<Block3D> fblock00 = grid->getBlock(fbx1, fbx2, fbx3, level);
+         SPtr<Block3D> fblock10 = grid->getBlock(fbx1+1, fbx2, fbx3, level);
+         SPtr<Block3D> fblock01 = grid->getBlock(fbx1, fbx2, fbx3+1, level);
+         SPtr<Block3D> fblock11 = grid->getBlock(fbx1+1, fbx2, fbx3+1, level);
+
+         setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::S);
+      }
+      if (block->hasInterpolationFlagCF(D3Q27System::T))
+      {
+         SPtr<Block3D> fblock00 = grid->getBlock(fbx1, fbx2, fbx3+1, level);
+         SPtr<Block3D> fblock10 = grid->getBlock(fbx1+1, fbx2, fbx3+1, level);
+         SPtr<Block3D> fblock01 = grid->getBlock(fbx1, fbx2+1, fbx3+1, level);
+         SPtr<Block3D> fblock11 = grid->getBlock(fbx1+1, fbx2+1, fbx3+1, level);
+
+         setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::T);
+      }
+      if (block->hasInterpolationFlagCF(D3Q27System::B))
+      {
+         SPtr<Block3D> fblock00 = grid->getBlock(fbx1, fbx2, fbx3, level);
+         SPtr<Block3D> fblock10 = grid->getBlock(fbx1+1, fbx2, fbx3, level);
+         SPtr<Block3D> fblock01 = grid->getBlock(fbx1, fbx2+1, fbx3, level);
+         SPtr<Block3D> fblock11 = grid->getBlock(fbx1+1, fbx2+1, fbx3, level);
+
+         setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::B);
+      }
+
+      //////NE-NW-SE-SW
+      if (block->hasInterpolationFlagCF(D3Q27System::NE)&&!block->hasInterpolationFlagCF(D3Q27System::N) && !block->hasInterpolationFlagCF(D3Q27System::E))
+      {
+         SPtr<Block3D> fblock00 = grid->getBlock(fbx1+1, fbx2+1, fbx3+0, level);
+         SPtr<Block3D> fblock10 = grid->getBlock(fbx1+1, fbx2+1, fbx3+1, level);
+         SPtr<Block3D> fblock01;
+         SPtr<Block3D> fblock11;
+
+         setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::NE);
+      }
+      if (block->hasInterpolationFlagCF(D3Q27System::SW)&& !block->hasInterpolationFlagCF(D3Q27System::W) && !block->hasInterpolationFlagCF(D3Q27System::S))
+      {
+         SPtr<Block3D> fblock00 = grid->getBlock(fbx1, fbx2, fbx3, level);
+         SPtr<Block3D> fblock10 = grid->getBlock(fbx1, fbx2, fbx3+1, level);
+         SPtr<Block3D> fblock01;
+         SPtr<Block3D> fblock11;
+
+         setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::SW);
+      }
+      if (block->hasInterpolationFlagCF(D3Q27System::SE)&& !block->hasInterpolationFlagCF(D3Q27System::E) && !block->hasInterpolationFlagCF(D3Q27System::S))
+      {
+         SPtr<Block3D> fblock00 = grid->getBlock(fbx1+1, fbx2, fbx3+0, level);
+         SPtr<Block3D> fblock10 = grid->getBlock(fbx1+1, fbx2, fbx3+1, level);
+         SPtr<Block3D> fblock01;
+         SPtr<Block3D> fblock11;
+
+         setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::SE);
+      }
+      if (block->hasInterpolationFlagCF(D3Q27System::NW)&& !block->hasInterpolationFlagCF(D3Q27System::N) && !block->hasInterpolationFlagCF(D3Q27System::W))
+      {
+         SPtr<Block3D> fblock00 = grid->getBlock(fbx1, fbx2+1, fbx3, level);
+         SPtr<Block3D> fblock10 = grid->getBlock(fbx1, fbx2+1, fbx3+1, level);
+         SPtr<Block3D> fblock01;
+         SPtr<Block3D> fblock11;
+
+         setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::NW);
+      }
+
+      /////////TE-BW-BE-TW 1-0
+      if (block->hasInterpolationFlagCF(D3Q27System::TE)&& !block->hasInterpolationFlagCF(D3Q27System::E) && !block->hasInterpolationFlagCF(D3Q27System::T))
+      {
+         SPtr<Block3D> fblock00 = grid->getBlock(fbx1+1, fbx2+0, fbx3+1, level);
+         SPtr<Block3D> fblock10 = grid->getBlock(fbx1+1, fbx2+1, fbx3+1, level);
+         SPtr<Block3D> fblock01;
+         SPtr<Block3D> fblock11;
+
+         setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::TE);
+      }
+      if (block->hasInterpolationFlagCF(D3Q27System::BW)&& !block->hasInterpolationFlagCF(D3Q27System::W) && !block->hasInterpolationFlagCF(D3Q27System::B))
+      {
+
+         SPtr<Block3D> fblock00 = grid->getBlock(fbx1, fbx2+0, fbx3, level);
+         SPtr<Block3D> fblock10 = grid->getBlock(fbx1, fbx2+1, fbx3, level);
+         SPtr<Block3D> fblock01;
+         SPtr<Block3D> fblock11;
+
+         setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::BW);
+      }
+      if (block->hasInterpolationFlagCF(D3Q27System::BE)&& !block->hasInterpolationFlagCF(D3Q27System::E) && !block->hasInterpolationFlagCF(D3Q27System::B))
+      {
+         SPtr<Block3D> fblock00 = grid->getBlock(fbx1+1, fbx2+0, fbx3, level);
+         SPtr<Block3D> fblock10 = grid->getBlock(fbx1+1, fbx2+1, fbx3, level);
+         SPtr<Block3D> fblock01;
+         SPtr<Block3D> fblock11;
+
+         setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::BE);
+      }
+      if (block->hasInterpolationFlagCF(D3Q27System::TW)&& !block->hasInterpolationFlagCF(D3Q27System::W) && !block->hasInterpolationFlagCF(D3Q27System::T))
+      {
+         SPtr<Block3D> fblock00 = grid->getBlock(fbx1, fbx2+0, fbx3+1, level);
+         SPtr<Block3D> fblock10 = grid->getBlock(fbx1, fbx2+1, fbx3+1, level);
+         SPtr<Block3D> fblock01;
+         SPtr<Block3D> fblock11;
+
+         setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::TW);
+      }
+
+      //////TN-BS-BN-TS
+      if (block->hasInterpolationFlagCF(D3Q27System::TN)&& !block->hasInterpolationFlagCF(D3Q27System::N) && !block->hasInterpolationFlagCF(D3Q27System::T))
+      {
+         SPtr<Block3D> fblock00 = grid->getBlock(fbx1+0, fbx2+1, fbx3+1, level);
+         SPtr<Block3D> fblock10 = grid->getBlock(fbx1+1, fbx2+1, fbx3+1, level);
+         SPtr<Block3D> fblock01;
+         SPtr<Block3D> fblock11;
+
+         setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::TN);
+      }
+      if (block->hasInterpolationFlagCF(D3Q27System::BS)&& !block->hasInterpolationFlagCF(D3Q27System::S) && !block->hasInterpolationFlagCF(D3Q27System::B))
+      {
+         SPtr<Block3D> fblock00 = grid->getBlock(fbx1+0, fbx2, fbx3, level);
+         SPtr<Block3D> fblock10 = grid->getBlock(fbx1+1, fbx2, fbx3, level);
+         SPtr<Block3D> fblock01;
+         SPtr<Block3D> fblock11;
+
+         setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::BS);
+      }
+      if (block->hasInterpolationFlagCF(D3Q27System::BN)&& !block->hasInterpolationFlagCF(D3Q27System::N) && !block->hasInterpolationFlagCF(D3Q27System::B))
+      {
+         SPtr<Block3D> fblock00 = grid->getBlock(fbx1+0, fbx2+1, fbx3, level);
+         SPtr<Block3D> fblock10 = grid->getBlock(fbx1+1, fbx2+1, fbx3, level);
+         SPtr<Block3D> fblock01;
+         SPtr<Block3D> fblock11;
+
+         setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::BN);
+      }
+      if (block->hasInterpolationFlagCF(D3Q27System::TS)&& !block->hasInterpolationFlagCF(D3Q27System::S) && !block->hasInterpolationFlagCF(D3Q27System::T))
+      {
+         SPtr<Block3D> fblock00 = grid->getBlock(fbx1+0, fbx2, fbx3+1, level);
+         SPtr<Block3D> fblock10 = grid->getBlock(fbx1+1, fbx2, fbx3+1, level);
+         SPtr<Block3D> fblock01;
+         SPtr<Block3D> fblock11;
+
+         setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::TS);
+      }
+
+
+
+
+      //////corners
+      if (block->hasInterpolationFlagCF(D3Q27System::TNE)&&!block->hasInterpolationFlagCF(D3Q27System::TE)&&!block->hasInterpolationFlagCF(D3Q27System::TN)&&!block->hasInterpolationFlagCF(D3Q27System::NE)&&!block->hasInterpolationFlagCF(D3Q27System::T)&&!block->hasInterpolationFlagCF(D3Q27System::N) && !block->hasInterpolationFlagCF(D3Q27System::E))
+      {
+         SPtr<Block3D> fblock00 = grid->getBlock(fbx1+1, fbx2+1, fbx3+1, level);
+         SPtr<Block3D> fblock10;// = grid->getBlock(fbx1+1, fbx2+1, fbx3+0, level);
+         SPtr<Block3D> fblock01;// = grid->getBlock(fbx1+1, fbx2+1, fbx3+1, level);
+         SPtr<Block3D> fblock11;// = grid->getBlock(fbx1+1, fbx2+1, fbx3+1, level);
+
+         setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::TNE);
+      }
+      if (block->hasInterpolationFlagCF(D3Q27System::TSW)&&!block->hasInterpolationFlagCF(D3Q27System::TW)&&!block->hasInterpolationFlagCF(D3Q27System::TS)&& !block->hasInterpolationFlagCF(D3Q27System::SW)&& !block->hasInterpolationFlagCF(D3Q27System::T)&& !block->hasInterpolationFlagCF(D3Q27System::W) && !block->hasInterpolationFlagCF(D3Q27System::S))
+      {
+         SPtr<Block3D> fblock00 = grid->getBlock(fbx1, fbx2, fbx3+1, level);
+         SPtr<Block3D> fblock10;// = grid->getBlock(fbx1, fbx2, fbx3, level);
+         SPtr<Block3D> fblock01;// = grid->getBlock(fbx1, fbx2, fbx3+1, level);
+         SPtr<Block3D> fblock11;// = grid->getBlock(fbx1, fbx2, fbx3+1, level);
+
+         setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::TSW);
+      }
+      if (block->hasInterpolationFlagCF(D3Q27System::TSE)&&!block->hasInterpolationFlagCF(D3Q27System::TE)&&!block->hasInterpolationFlagCF(D3Q27System::TS)&& !block->hasInterpolationFlagCF(D3Q27System::SE)&& !block->hasInterpolationFlagCF(D3Q27System::T)&& !block->hasInterpolationFlagCF(D3Q27System::E) && !block->hasInterpolationFlagCF(D3Q27System::S))
+      {
+         SPtr<Block3D> fblock00 = grid->getBlock(fbx1+1, fbx2, fbx3+1, level);
+         SPtr<Block3D> fblock10;// = grid->getBlock(fbx1+1, fbx2, fbx3+0, level);
+         SPtr<Block3D> fblock01;// = grid->getBlock(fbx1+1, fbx2, fbx3+1, level);
+         SPtr<Block3D> fblock11;// = grid->getBlock(fbx1+1, fbx2, fbx3+1, level);
+
+         setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::TSE);
+      }
+      if (block->hasInterpolationFlagCF(D3Q27System::TNW)&&!block->hasInterpolationFlagCF(D3Q27System::TW)&&!block->hasInterpolationFlagCF(D3Q27System::TN)&& !block->hasInterpolationFlagCF(D3Q27System::NW)&& !block->hasInterpolationFlagCF(D3Q27System::T)&& !block->hasInterpolationFlagCF(D3Q27System::N) && !block->hasInterpolationFlagCF(D3Q27System::W))
+      {
+         SPtr<Block3D> fblock00 = grid->getBlock(fbx1, fbx2+1, fbx3+1, level);
+         SPtr<Block3D> fblock10;// = grid->getBlock(fbx1, fbx2+1, fbx3, level);
+         SPtr<Block3D> fblock01;// = grid->getBlock(fbx1, fbx2+1, fbx3+1, level);
+         SPtr<Block3D> fblock11;// = grid->getBlock(fbx1, fbx2+1, fbx3+1, level);
+
+         setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::TNW);
+      }
+      if (block->hasInterpolationFlagCF(D3Q27System::BNE)&&!block->hasInterpolationFlagCF(D3Q27System::BE)&&!block->hasInterpolationFlagCF(D3Q27System::BN)&& !block->hasInterpolationFlagCF(D3Q27System::NE)&&!block->hasInterpolationFlagCF(D3Q27System::B)&&!block->hasInterpolationFlagCF(D3Q27System::N) && !block->hasInterpolationFlagCF(D3Q27System::E))
+      {
+         SPtr<Block3D> fblock00 = grid->getBlock(fbx1+1, fbx2+1, fbx3+0, level);
+         SPtr<Block3D> fblock10;// = grid->getBlock(fbx1+1, fbx2+1, fbx3+0, level);
+         SPtr<Block3D> fblock01;// = grid->getBlock(fbx1+1, fbx2+1, fbx3+1, level);
+         SPtr<Block3D> fblock11;// = grid->getBlock(fbx1+1, fbx2+1, fbx3+1, level);
+
+         setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::BNE);
+      }
+      if (block->hasInterpolationFlagCF(D3Q27System::BSW)&& !block->hasInterpolationFlagCF(D3Q27System::BS)&& !block->hasInterpolationFlagCF(D3Q27System::BW)&& !block->hasInterpolationFlagCF(D3Q27System::SW)&& !block->hasInterpolationFlagCF(D3Q27System::B)&& !block->hasInterpolationFlagCF(D3Q27System::W) && !block->hasInterpolationFlagCF(D3Q27System::S))
+      {
+         SPtr<Block3D> fblock00 = grid->getBlock(fbx1, fbx2, fbx3+0, level);
+         SPtr<Block3D> fblock10;// = grid->getBlock(fbx1, fbx2, fbx3, level);
+         SPtr<Block3D> fblock01;// = grid->getBlock(fbx1, fbx2, fbx3+1, level);
+         SPtr<Block3D> fblock11;// = grid->getBlock(fbx1, fbx2, fbx3+1, level);
+
+         setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::BSW);
+      }
+      if (block->hasInterpolationFlagCF(D3Q27System::BSE)&& !block->hasInterpolationFlagCF(D3Q27System::BS)&& !block->hasInterpolationFlagCF(D3Q27System::BE)&& !block->hasInterpolationFlagCF(D3Q27System::SE)&& !block->hasInterpolationFlagCF(D3Q27System::B)&& !block->hasInterpolationFlagCF(D3Q27System::E) && !block->hasInterpolationFlagCF(D3Q27System::S))
+      {
+         SPtr<Block3D> fblock00 = grid->getBlock(fbx1+1, fbx2, fbx3, level);
+         SPtr<Block3D> fblock10;// = grid->getBlock(fbx1+1, fbx2, fbx3+0, level);
+         SPtr<Block3D> fblock01;// = grid->getBlock(fbx1+1, fbx2, fbx3+1, level);
+         SPtr<Block3D> fblock11;// = grid->getBlock(fbx1+1, fbx2, fbx3+1, level);
+
+         setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::BSE);
+      }
+      if (block->hasInterpolationFlagCF(D3Q27System::BNW)&& !block->hasInterpolationFlagCF(D3Q27System::BN)&& !block->hasInterpolationFlagCF(D3Q27System::BW)&& !block->hasInterpolationFlagCF(D3Q27System::NW)&& !block->hasInterpolationFlagCF(D3Q27System::B)&& !block->hasInterpolationFlagCF(D3Q27System::N) && !block->hasInterpolationFlagCF(D3Q27System::W))
+      {
+         SPtr<Block3D> fblock00 = grid->getBlock(fbx1, fbx2+1, fbx3+0, level);
+         SPtr<Block3D> fblock10;// = grid->getBlock(fbx1, fbx2+1, fbx3, level);
+         SPtr<Block3D> fblock01;// = grid->getBlock(fbx1, fbx2+1, fbx3+1, level);
+         SPtr<Block3D> fblock11;// = grid->getBlock(fbx1, fbx2+1, fbx3+1, level);
+
+         setInterpolationConnectors(fblock00, fblock10, fblock01, fblock11, block, D3Q27System::BNW);
+      }
+
+   }
+   UBLOG(logDEBUG5, "ConnectorBlockVisitor::setInterpolationConnectors() - end");
+}
+//////////////////////////////////////////////////////////////////////////
+
+void ConnectorBlockVisitor::setInterpolationConnectors(SPtr<Block3D> fblock00, SPtr<Block3D> fblock10, SPtr<Block3D> fblock01, SPtr<Block3D> fblock11, SPtr<Block3D> cBlock, int dir)
+{
+   UBLOG(logDEBUG5, "ConnectorBlockVisitor::setInterpolationConnectors(...) - start");
+   int fblock00Rank = -999, fblock10Rank = -999, fblock01Rank = -999, fblock11Rank = -999;
+   if (fblock00) fblock00Rank = fblock00->getRank();
+   if (fblock01) fblock01Rank = fblock01->getRank();
+   if (fblock10) fblock10Rank = fblock10->getRank();
+   if (fblock11) fblock11Rank = fblock11->getRank();
+   int cBlockRank = cBlock->getRank();
+
+   LBMReal omegaF;
+   if (fblock00) omegaF = LBMSystem::calcCollisionFactor(nu, fblock00->getLevel());
+   if (fblock01) omegaF = LBMSystem::calcCollisionFactor(nu, fblock01->getLevel());
+   if (fblock10) omegaF = LBMSystem::calcCollisionFactor(nu, fblock10->getLevel());
+   if (fblock11) omegaF = LBMSystem::calcCollisionFactor(nu, fblock11->getLevel());
+   LBMReal omegaC = LBMSystem::calcCollisionFactor(nu, cBlock->getLevel());
+   iProcessor->setOmegas(omegaC, omegaF);
+
+   InterpolationProcessorPtr cIProcessor(iProcessor->clone());
+   InterpolationProcessorPtr fIProcessor00(iProcessor->clone());
+   InterpolationProcessorPtr fIProcessor10(iProcessor->clone());
+   InterpolationProcessorPtr fIProcessor01(iProcessor->clone());
+   InterpolationProcessorPtr fIProcessor11(iProcessor->clone());
+
+   CreateTransmittersHelper::TransmitterPtr senderCF00, receiverCF00,
+                                             senderCF01, receiverCF01,
+                                             senderCF10, receiverCF10,
+                                             senderCF11, receiverCF11,
+                                             senderFC00, receiverFC00,
+                                             senderFC01, receiverFC01,
+                                             senderFC10, receiverFC10,
+                                             senderFC11, receiverFC11;
+
+   if (fblock00) createTransmitters(cBlock, fblock00, dir, CreateTransmittersHelper::SW, senderCF00, receiverCF00, senderFC00, receiverFC00);
+   if (fblock01) createTransmitters(cBlock, fblock01, dir, CreateTransmittersHelper::NW, senderCF01, receiverCF01, senderFC01, receiverFC01);
+   if (fblock10) createTransmitters(cBlock, fblock10, dir, CreateTransmittersHelper::SE, senderCF10, receiverCF10, senderFC10, receiverFC10);
+   if (fblock11) createTransmitters(cBlock, fblock11, dir, CreateTransmittersHelper::NE, senderCF11, receiverCF11, senderFC11, receiverFC11);
+
+   if (cBlockRank == gridRank)
+   {
+      SPtr<Block3DConnector> connector = cFactory->createCoarseToFineConnector(cBlock,
+         senderCF00, receiverCF00, senderCF01, receiverCF01,
+         senderCF10, receiverCF10, senderCF11, receiverCF11,
+         dir, cIProcessor);
+      cBlock->setConnector(connector);
+   }
+   if (fblock00 && fblock00Rank == gridRank)
+   {
+      SPtr<Block3DConnector> connector = cFactory->createFineToCoarseConnector(fblock00,
+         senderFC00, receiverFC00, dir, fIProcessor00, FineToCoarseBlock3DConnector::Type00);
+      fblock00->setConnector(connector);
+   }
+   if (fblock01 && fblock01Rank == gridRank)
+   {
+      SPtr<Block3DConnector> connector = cFactory->createFineToCoarseConnector(fblock01,
+         senderFC01, receiverFC01, dir, fIProcessor01, FineToCoarseBlock3DConnector::Type01);
+      fblock01->setConnector(connector);
+   }
+   if (fblock10 && fblock10Rank == gridRank)
+   {
+      SPtr<Block3DConnector> connector = cFactory->createFineToCoarseConnector(fblock10,
+         senderFC10, receiverFC10, dir, fIProcessor10, FineToCoarseBlock3DConnector::Type10);
+      fblock10->setConnector(connector);
+   }
+   if (fblock11 && fblock11Rank == gridRank)
+   {
+      SPtr<Block3DConnector> connector = cFactory->createFineToCoarseConnector(fblock11,
+         senderFC11, receiverFC11, dir, fIProcessor11, FineToCoarseBlock3DConnector::Type11);
+      fblock11->setConnector(connector);
+   }
+   UBLOG(logDEBUG5, "ConnectorBlockVisitor::setInterpolationConnectors(...) - end");
+}
+//////////////////////////////////////////////////////////////////////////
+void ConnectorBlockVisitor::createTransmitters(SPtr<Block3D> cBlock, SPtr<Block3D> fBlock, int dir,
+   CreateTransmittersHelper::IBlock ib,
+   CreateTransmittersHelper::TransmitterPtr& senderCF,
+   CreateTransmittersHelper::TransmitterPtr& receiverCF,
+   CreateTransmittersHelper::TransmitterPtr& senderFC,
+   CreateTransmittersHelper::TransmitterPtr& receiverFC)
+{
+   UBLOG(logDEBUG5, "ConnectorBlockVisitor::createTransmitters(...) - start");
+   CreateTransmittersHelper helper;
+   bool MPIpool = true;
+   bool orthogonal = false;
+   int fBlockRank = fBlock->getRank();
+   int cBlockRank = cBlock->getRank();
+   if (fBlockRank == cBlockRank && fBlockRank == gridRank)
+   {
+      senderCF = receiverFC = CreateTransmittersHelper::TransmitterPtr(new TbLocalTransmitter< CbVector< LBMReal > >());
+      senderFC = receiverCF = CreateTransmittersHelper::TransmitterPtr(new TbLocalTransmitter< CbVector< LBMReal > >());
+   }
+   else if (cBlockRank == gridRank)
+   {
+      helper.createTransmitters(cBlock, fBlock, dir, ib, senderCF, receiverCF, comm, CreateTransmittersHelper::MPI);
+   }
+   else if (fBlockRank == gridRank)
+   {
+      helper.createTransmitters(fBlock, cBlock, dir, ib, senderFC, receiverFC, comm, CreateTransmittersHelper::MPI);
+   }
+   UBLOG(logDEBUG5, "ConnectorBlockVisitor::createTransmitters(...) - end");
+}
+
diff --git a/src/cpu/VirtualFluidsCore/Visitors/ConnectorBlockVisitor.h b/src/cpu/VirtualFluidsCore/Visitors/ConnectorBlockVisitor.h
index 777d58bd704952ee08f9cdb97c309974a0f54e1e..fdd79284cb513dd6874afa25b081c3e564bbae77 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/ConnectorBlockVisitor.h
+++ b/src/cpu/VirtualFluidsCore/Visitors/ConnectorBlockVisitor.h
@@ -1,41 +1,41 @@
-#ifndef ConnectorBlockVisitor_H
-#define ConnectorBlockVisitor_H
-
-#include <PointerDefinitions.h>
-
-#include "Block3DVisitor.h"
-#include "D3Q27System.h"
-#include "CreateTransmittersHelper.h"
-
-class Grid3D;
-class Block3D;
-class InterpolationProcessor;
-class ConnectorFactory;
-
-class ConnectorBlockVisitor : public Block3DVisitor
-{
-public:
-   ConnectorBlockVisitor(SPtr<Communicator> comm, LBMReal nu, SPtr<InterpolationProcessor> iProcessor, SPtr<ConnectorFactory> cFactory);
-   virtual ~ConnectorBlockVisitor();
-      void visit(SPtr<Grid3D> grid, SPtr<Block3D> block) override;
-   //////////////////////////////////////////////////////////////////////////
-protected:
-   void setSameLevelConnectors(SPtr<Grid3D> grid, SPtr<Block3D> block);
-   void setRemoteConnectors(SPtr<Block3D> sblock, SPtr<Block3D> tblock, int dir);
-   void setInterpolationConnectors(SPtr<Grid3D> grid, SPtr<Block3D> block);
-   void setInterpolationConnectors(SPtr<Block3D> fBlockSW, SPtr<Block3D> fBlockSE, SPtr<Block3D> fBlockNW, SPtr<Block3D> fBlockNE, SPtr<Block3D> cBlock, int dir);
-   void createTransmitters(SPtr<Block3D> cBlock, SPtr<Block3D> fBlock, int dir,
-      CreateTransmittersHelper::IBlock ib,
-      CreateTransmittersHelper::TransmitterPtr& senderCF,
-      CreateTransmittersHelper::TransmitterPtr& receiverCF,
-      CreateTransmittersHelper::TransmitterPtr& senderFC,
-      CreateTransmittersHelper::TransmitterPtr& receiverFC);
-   SPtr<Communicator> comm;
-   int gridRank;
-   LBMReal nu;
-   SPtr<InterpolationProcessor> iProcessor;
-   SPtr<ConnectorFactory> cFactory;
-};
-
-#endif //ConnectorBlockVisitor_H
-
+#ifndef ConnectorBlockVisitor_H
+#define ConnectorBlockVisitor_H
+
+#include <PointerDefinitions.h>
+
+#include "Block3DVisitor.h"
+#include "D3Q27System.h"
+#include "CreateTransmittersHelper.h"
+
+class Grid3D;
+class Block3D;
+class InterpolationProcessor;
+class ConnectorFactory;
+
+class ConnectorBlockVisitor : public Block3DVisitor
+{
+public:
+   ConnectorBlockVisitor(SPtr<Communicator> comm, LBMReal nu, SPtr<InterpolationProcessor> iProcessor, SPtr<ConnectorFactory> cFactory);
+   virtual ~ConnectorBlockVisitor();
+      void visit(SPtr<Grid3D> grid, SPtr<Block3D> block) override;
+   //////////////////////////////////////////////////////////////////////////
+protected:
+   void setSameLevelConnectors(SPtr<Grid3D> grid, SPtr<Block3D> block);
+   void setRemoteConnectors(SPtr<Block3D> sblock, SPtr<Block3D> tblock, int dir);
+   void setInterpolationConnectors(SPtr<Grid3D> grid, SPtr<Block3D> block);
+   void setInterpolationConnectors(SPtr<Block3D> fBlockSW, SPtr<Block3D> fBlockSE, SPtr<Block3D> fBlockNW, SPtr<Block3D> fBlockNE, SPtr<Block3D> cBlock, int dir);
+   void createTransmitters(SPtr<Block3D> cBlock, SPtr<Block3D> fBlock, int dir,
+      CreateTransmittersHelper::IBlock ib,
+      CreateTransmittersHelper::TransmitterPtr& senderCF,
+      CreateTransmittersHelper::TransmitterPtr& receiverCF,
+      CreateTransmittersHelper::TransmitterPtr& senderFC,
+      CreateTransmittersHelper::TransmitterPtr& receiverFC);
+   SPtr<Communicator> comm;
+   int gridRank;
+   LBMReal nu;
+   SPtr<InterpolationProcessor> iProcessor;
+   SPtr<ConnectorFactory> cFactory;
+};
+
+#endif //ConnectorBlockVisitor_H
+
diff --git a/src/cpu/VirtualFluidsCore/Visitors/CreateTransmittersHelper.cpp b/src/cpu/VirtualFluidsCore/Visitors/CreateTransmittersHelper.cpp
index 59b967e08942d0375648c2ba06230e3ae91af698..7851254a0e50d2d44508e24141c33135aa009202 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/CreateTransmittersHelper.cpp
+++ b/src/cpu/VirtualFluidsCore/Visitors/CreateTransmittersHelper.cpp
@@ -1,160 +1,160 @@
-#include "CreateTransmittersHelper.h"
-#include <D3Q27System.h>
-#include <Communicator.h>
-#include <string>
-
-#ifdef VF_FETOL
-   #include <FETOLTransmitterBondPool.h>
-#endif
-#include <MathUtil.hpp>
-
-unsigned CreateTransmittersHelper::vKey = 0;
-
-using namespace std;
-
-//////////////////////////////////////////////////////////////////////////
-CreateTransmittersHelper::CreateTransmittersHelper()
-{
-
-}
-//////////////////////////////////////////////////////////////////////////
-void CreateTransmittersHelper::createTransmitters(SPtr<Block3D> sblock, SPtr<Block3D> tblock, int dir, IBlock ib,
-                                                        TransmitterPtr& sender, TransmitterPtr& receiver, SPtr<Communicator> comm, TransmitterType tType)
-{
-   //SourceBlock
-   int srcLevel = sblock->getLevel();
-   int srcID    = sblock->getGlobalID();   
- 
-   //TargetBlock 
-   int tgtLevel = tblock->getLevel();
-   int tgtID    = tblock->getGlobalID();
-
-   int invDir = D3Q27System::INVDIR[dir];
-
-   if( srcLevel != tgtLevel ) invDir = dir;
-
-   int srcRank = 0;
-   int tgtRank = 0;
-
-   if (tType == MPI)
-   {
-      srcRank  = sblock->getRank();
-      tgtRank  = tblock->getRank();
-   } 
-#ifdef VF_FETOL
-   else if (tType == MPI2BOND)
-   {
-      srcRank  = sblock->getLocalRank();
-      tgtRank  = tblock->getLocalRank();
-   }
-#endif
-
-   if (tType == MPI 
-#ifdef VF_FETOL
-      || tType == MPI2BOND
-#endif
-      )
-   {
-      string sendPoolKey = generatePoolKey(srcRank, srcLevel, tgtRank, tgtLevel);
-      string receivePoolKey = generatePoolKey(tgtRank, tgtLevel, srcRank, srcLevel);
-
-      TbCbVectorMpiPool <LBMReal>::MpiPoolPtr sendPool = TbCbVectorMpiPool <LBMReal>::getTbCbVectorMpiPool(sendPoolKey   );
-      TbCbVectorMpiPool <LBMReal>::MpiPoolPtr recvPool = TbCbVectorMpiPool <LBMReal>::getTbCbVectorMpiPool(receivePoolKey);
-
-      MPI_Comm mpi_comm = *((MPI_Comm*) comm->getNativeCommunicator());
-
-      if( !sendPool ) sendPool = TbCbVectorMpiPool <LBMReal>::createTbCbVectorMpiPool(sendPoolKey   ,tgtRank, generateMPITag(srcLevel, tgtLevel), mpi_comm);
-      if( !recvPool ) recvPool = TbCbVectorMpiPool <LBMReal>::createTbCbVectorMpiPool(receivePoolKey,tgtRank, generateMPITag(tgtLevel, srcLevel), mpi_comm);
-
-      TbCbVectorMpiPool <LBMReal>::CbVectorKey keyOfSendCbVectorKey = generateVectorKey(sblock->getX1(), sblock->getX2(), sblock->getX3()/*tgtID*/, dir, ib);
-      TbCbVectorMpiPool <LBMReal>::CbVectorKey keyOfRecvCbVectorKey = generateVectorKey(tblock->getX1(), tblock->getX2(), tblock->getX3()/*srcID*/, invDir, ib);
-
-      ////////////////////////////////////////////////////////
-      //DEBUG
-      //int myid = comm->getProcessID();
-      //FILE * file;
-      ////char * name = "d:/temp/sendPoolKey.csv";
-      //std::string name = "d:/temp/VectorKey" + UbSystem::toString(myid) + ".csv";
-      //file = fopen(name.c_str(), "a");
-      //fprintf(file, "%d;%d%;%d;%d;%d;%u;%d;%d%;%d;%d;%d;%u\n", sblock->getX1(), sblock->getX2(), sblock->getX3()/*tgtID*/, dir, ib, keyOfSendCbVectorKey, tblock->getX1(), tblock->getX2(), tblock->getX3()/*srcID*/, invDir, ib, keyOfRecvCbVectorKey);
-      //fclose(file);
-      ////////////////////////////////////////////////////////
-
-      //create sender-/receiver
-      sender   = TransmitterPtr( new TbCbVectorSenderMpiPool< LBMReal >(keyOfSendCbVectorKey,sendPool.get()) );
-      receiver = TransmitterPtr( new TbCbVectorReceiverMpiPool< LBMReal >(keyOfRecvCbVectorKey,recvPool.get()) );
-   }
-#ifdef VF_FETOL
-   if (tType == BOND)
-   {
-      int srcBondRank  = sblock->getRank();
-      int tgtBondRank  = tblock->getRank();
-
-      int sendBondPoolKey    = generatePoolKey(srcBondRank,srcLevel,tgtBondRank,tgtLevel);
-      int receiveBondPoolKey = generatePoolKey(tgtBondRank,tgtLevel,srcBondRank,srcLevel);
-
-      TbCbVectorBondPool <LBMReal>::BondPoolPtr sendPool = TbCbVectorBondPool <LBMReal>::getTbCbVectorBondPool(sendBondPoolKey   );
-      TbCbVectorBondPool <LBMReal>::BondPoolPtr recvPool = TbCbVectorBondPool <LBMReal>::getTbCbVectorBondPool(receiveBondPoolKey);
-
-      if( !sendPool ) sendPool = TbCbVectorBondPool <LBMReal>::createTbCbVectorBondPool(sendBondPoolKey   ,tgtBondRank, generateMPITag(srcLevel, tgtLevel));
-      if( !recvPool ) recvPool = TbCbVectorBondPool <LBMReal>::createTbCbVectorBondPool(receiveBondPoolKey,tgtBondRank, generateMPITag(tgtLevel, srcLevel));
-
-      TbCbVectorBondPool <LBMReal>::CbVectorKey keyOfSendCbVectorKey = generateVectorKey(tgtID, dir, ib);     
-      TbCbVectorBondPool <LBMReal>::CbVectorKey keyOfRecvCbVectorKey = generateVectorKey(srcID, invDir, ib);  
-
-      //create sender-/receiver 
-      sender   = TransmitterPtr( new TbCbVectorSenderBondPool< LBMReal >(keyOfSendCbVectorKey,sendPool.get()) );
-      receiver = TransmitterPtr( new TbCbVectorReceiverBondPool< LBMReal >(keyOfRecvCbVectorKey,recvPool.get()) );
-   }
-#endif
-}
-//////////////////////////////////////////////////////////////////////////
-int CreateTransmittersHelper::generateMPITag(int srcLevel, int tgtLevel)
-{
-   //The MPI standard guarantees that integers 0-32767 can be used as tags
-   if (srcLevel == tgtLevel)
-   {
-      return srcLevel;
-   }
-   else
-   {
-      srcLevel++;
-      tgtLevel++;
-      std::string str = UbSystem::toString<int>(srcLevel) + UbSystem::toString<int>(tgtLevel);
-      int r = UbSystem::stringTo<int>(str);
-      return r;
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-string CreateTransmittersHelper::generatePoolKey(int srcRank, int srcLevel, int tgtRank, int tgtLevel)
-{
-   std::string str;
-   str = UbSystem::toString<int>(srcLevel);
-   str += "#";
-   str += UbSystem::toString<int>(tgtLevel);
-   str += "#";
-   str += UbSystem::toString<int>(srcRank);
-   str += "#";
-   str += UbSystem::toString<int>(tgtRank);
-
-   return str;
-}
-//////////////////////////////////////////////////////////////////////////
-string CreateTransmittersHelper::generateVectorKey(int x1, int x2, int x3, int dir, IBlock ib)
-{
-   std::string str;
-
-   str += UbSystem::toString<int>(x1);
-   str += "#";
-   str += UbSystem::toString<int>(x2);
-   str += "#";
-   str += UbSystem::toString<int>(x3);
-   str += "#";
-   str += UbSystem::toString<int>(dir);
-   str += "#";
-   str += UbSystem::toString<int>(ib);
-
-   return str;
-}
-
-
+#include "CreateTransmittersHelper.h"
+#include <D3Q27System.h>
+#include <Communicator.h>
+#include <string>
+
+#ifdef VF_FETOL
+   #include <FETOLTransmitterBondPool.h>
+#endif
+#include <MathUtil.hpp>
+
+unsigned CreateTransmittersHelper::vKey = 0;
+
+using namespace std;
+
+//////////////////////////////////////////////////////////////////////////
+CreateTransmittersHelper::CreateTransmittersHelper()
+{
+
+}
+//////////////////////////////////////////////////////////////////////////
+void CreateTransmittersHelper::createTransmitters(SPtr<Block3D> sblock, SPtr<Block3D> tblock, int dir, IBlock ib,
+                                                        TransmitterPtr& sender, TransmitterPtr& receiver, SPtr<Communicator> comm, TransmitterType tType)
+{
+   //SourceBlock
+   int srcLevel = sblock->getLevel();
+   int srcID    = sblock->getGlobalID();   
+ 
+   //TargetBlock 
+   int tgtLevel = tblock->getLevel();
+   int tgtID    = tblock->getGlobalID();
+
+   int invDir = D3Q27System::INVDIR[dir];
+
+   if( srcLevel != tgtLevel ) invDir = dir;
+
+   int srcRank = 0;
+   int tgtRank = 0;
+
+   if (tType == MPI)
+   {
+      srcRank  = sblock->getRank();
+      tgtRank  = tblock->getRank();
+   } 
+#ifdef VF_FETOL
+   else if (tType == MPI2BOND)
+   {
+      srcRank  = sblock->getLocalRank();
+      tgtRank  = tblock->getLocalRank();
+   }
+#endif
+
+   if (tType == MPI 
+#ifdef VF_FETOL
+      || tType == MPI2BOND
+#endif
+      )
+   {
+      string sendPoolKey = generatePoolKey(srcRank, srcLevel, tgtRank, tgtLevel);
+      string receivePoolKey = generatePoolKey(tgtRank, tgtLevel, srcRank, srcLevel);
+
+      TbCbVectorMpiPool <LBMReal>::MpiPoolPtr sendPool = TbCbVectorMpiPool <LBMReal>::getTbCbVectorMpiPool(sendPoolKey   );
+      TbCbVectorMpiPool <LBMReal>::MpiPoolPtr recvPool = TbCbVectorMpiPool <LBMReal>::getTbCbVectorMpiPool(receivePoolKey);
+
+      MPI_Comm mpi_comm = *((MPI_Comm*) comm->getNativeCommunicator());
+
+      if( !sendPool ) sendPool = TbCbVectorMpiPool <LBMReal>::createTbCbVectorMpiPool(sendPoolKey   ,tgtRank, generateMPITag(srcLevel, tgtLevel), mpi_comm);
+      if( !recvPool ) recvPool = TbCbVectorMpiPool <LBMReal>::createTbCbVectorMpiPool(receivePoolKey,tgtRank, generateMPITag(tgtLevel, srcLevel), mpi_comm);
+
+      TbCbVectorMpiPool <LBMReal>::CbVectorKey keyOfSendCbVectorKey = generateVectorKey(sblock->getX1(), sblock->getX2(), sblock->getX3()/*tgtID*/, dir, ib);
+      TbCbVectorMpiPool <LBMReal>::CbVectorKey keyOfRecvCbVectorKey = generateVectorKey(tblock->getX1(), tblock->getX2(), tblock->getX3()/*srcID*/, invDir, ib);
+
+      ////////////////////////////////////////////////////////
+      //DEBUG
+      //int myid = comm->getProcessID();
+      //FILE * file;
+      ////char * name = "d:/temp/sendPoolKey.csv";
+      //std::string name = "d:/temp/VectorKey" + UbSystem::toString(myid) + ".csv";
+      //file = fopen(name.c_str(), "a");
+      //fprintf(file, "%d;%d%;%d;%d;%d;%u;%d;%d%;%d;%d;%d;%u\n", sblock->getX1(), sblock->getX2(), sblock->getX3()/*tgtID*/, dir, ib, keyOfSendCbVectorKey, tblock->getX1(), tblock->getX2(), tblock->getX3()/*srcID*/, invDir, ib, keyOfRecvCbVectorKey);
+      //fclose(file);
+      ////////////////////////////////////////////////////////
+
+      //create sender-/receiver
+      sender   = TransmitterPtr( new TbCbVectorSenderMpiPool< LBMReal >(keyOfSendCbVectorKey,sendPool.get()) );
+      receiver = TransmitterPtr( new TbCbVectorReceiverMpiPool< LBMReal >(keyOfRecvCbVectorKey,recvPool.get()) );
+   }
+#ifdef VF_FETOL
+   if (tType == BOND)
+   {
+      int srcBondRank  = sblock->getRank();
+      int tgtBondRank  = tblock->getRank();
+
+      int sendBondPoolKey    = generatePoolKey(srcBondRank,srcLevel,tgtBondRank,tgtLevel);
+      int receiveBondPoolKey = generatePoolKey(tgtBondRank,tgtLevel,srcBondRank,srcLevel);
+
+      TbCbVectorBondPool <LBMReal>::BondPoolPtr sendPool = TbCbVectorBondPool <LBMReal>::getTbCbVectorBondPool(sendBondPoolKey   );
+      TbCbVectorBondPool <LBMReal>::BondPoolPtr recvPool = TbCbVectorBondPool <LBMReal>::getTbCbVectorBondPool(receiveBondPoolKey);
+
+      if( !sendPool ) sendPool = TbCbVectorBondPool <LBMReal>::createTbCbVectorBondPool(sendBondPoolKey   ,tgtBondRank, generateMPITag(srcLevel, tgtLevel));
+      if( !recvPool ) recvPool = TbCbVectorBondPool <LBMReal>::createTbCbVectorBondPool(receiveBondPoolKey,tgtBondRank, generateMPITag(tgtLevel, srcLevel));
+
+      TbCbVectorBondPool <LBMReal>::CbVectorKey keyOfSendCbVectorKey = generateVectorKey(tgtID, dir, ib);     
+      TbCbVectorBondPool <LBMReal>::CbVectorKey keyOfRecvCbVectorKey = generateVectorKey(srcID, invDir, ib);  
+
+      //create sender-/receiver 
+      sender   = TransmitterPtr( new TbCbVectorSenderBondPool< LBMReal >(keyOfSendCbVectorKey,sendPool.get()) );
+      receiver = TransmitterPtr( new TbCbVectorReceiverBondPool< LBMReal >(keyOfRecvCbVectorKey,recvPool.get()) );
+   }
+#endif
+}
+//////////////////////////////////////////////////////////////////////////
+int CreateTransmittersHelper::generateMPITag(int srcLevel, int tgtLevel)
+{
+   //The MPI standard guarantees that integers 0-32767 can be used as tags
+   if (srcLevel == tgtLevel)
+   {
+      return srcLevel;
+   }
+   else
+   {
+      srcLevel++;
+      tgtLevel++;
+      std::string str = UbSystem::toString<int>(srcLevel) + UbSystem::toString<int>(tgtLevel);
+      int r = UbSystem::stringTo<int>(str);
+      return r;
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+string CreateTransmittersHelper::generatePoolKey(int srcRank, int srcLevel, int tgtRank, int tgtLevel)
+{
+   std::string str;
+   str = UbSystem::toString<int>(srcLevel);
+   str += "#";
+   str += UbSystem::toString<int>(tgtLevel);
+   str += "#";
+   str += UbSystem::toString<int>(srcRank);
+   str += "#";
+   str += UbSystem::toString<int>(tgtRank);
+
+   return str;
+}
+//////////////////////////////////////////////////////////////////////////
+string CreateTransmittersHelper::generateVectorKey(int x1, int x2, int x3, int dir, IBlock ib)
+{
+   std::string str;
+
+   str += UbSystem::toString<int>(x1);
+   str += "#";
+   str += UbSystem::toString<int>(x2);
+   str += "#";
+   str += UbSystem::toString<int>(x3);
+   str += "#";
+   str += UbSystem::toString<int>(dir);
+   str += "#";
+   str += UbSystem::toString<int>(ib);
+
+   return str;
+}
+
+
diff --git a/src/cpu/VirtualFluidsCore/Visitors/CreateTransmittersHelper.h b/src/cpu/VirtualFluidsCore/Visitors/CreateTransmittersHelper.h
index da1038b5ab9c2f36d18aa101298bc36edf3601fa..820807a2f09518c25647d7f72c2eca8241526d05 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/CreateTransmittersHelper.h
+++ b/src/cpu/VirtualFluidsCore/Visitors/CreateTransmittersHelper.h
@@ -1,38 +1,38 @@
-#ifndef CREATETRANSMITTERSHELPER_H 
-#define CREATETRANSMITTERSHELPER_H
-
-#include "Block3D.h"
-#include "Communicator.h"
-
-#include "LBMSystem.h"
-
-#include <basics/transmitter/TbTransmitter.h>
-#include <basics/transmitter/TbTransmitterMpiPool.h>
-#include <basics/container/CbVector.h>
-
-//! \brief The class helps to create Transmitters. 
-//! \details It is created two types of Transmitters: MPI and BOND
-//! \author K. Kucher
-class CreateTransmittersHelper
-{
-public:
-   //! Switch between same level and interpolation Connectors. NONE - for same level Connectors; SW, NW, NE, SE - source/target fine blocks in grid interface   
-   enum IBlock {NONE, SW, NW, NE, SE};
-   //! Switch between MPI and BOND Transmitters
-   enum TransmitterType {MPI, BOND, MPI2BOND};
-public:
-   typedef CbVector <LBMReal> DataType;
-   typedef SPtr< TbTransmitter< DataType > > TransmitterPtr;
-public:
-   CreateTransmittersHelper();
-   void createTransmitters(const SPtr<Block3D> sblock, const SPtr<Block3D> tblock, int dir, IBlock ib,
-                                 TransmitterPtr& sender, TransmitterPtr& receiver, SPtr<Communicator> comm, TransmitterType tType);
-protected:
-private:
-   std::string generatePoolKey(int srcRank, int srcLevel, int tgtRank, int tgtLevel);
-   std::string  generateVectorKey(int x1, int x2, int x3,/*int id,*/ int dir, IBlock ib);
-   int generateMPITag(int srcLevel, int tgtLevel);
-   static unsigned int vKey;
-};
-
-#endif
+#ifndef CREATETRANSMITTERSHELPER_H 
+#define CREATETRANSMITTERSHELPER_H
+
+#include "Block3D.h"
+#include "Communicator.h"
+
+#include "LBMSystem.h"
+
+#include <basics/transmitter/TbTransmitter.h>
+#include <basics/transmitter/TbTransmitterMpiPool.h>
+#include <basics/container/CbVector.h>
+
+//! \brief The class helps to create Transmitters. 
+//! \details It is created two types of Transmitters: MPI and BOND
+//! \author K. Kucher
+class CreateTransmittersHelper
+{
+public:
+   //! Switch between same level and interpolation Connectors. NONE - for same level Connectors; SW, NW, NE, SE - source/target fine blocks in grid interface   
+   enum IBlock {NONE, SW, NW, NE, SE};
+   //! Switch between MPI and BOND Transmitters
+   enum TransmitterType {MPI, BOND, MPI2BOND};
+public:
+   typedef CbVector <LBMReal> DataType;
+   typedef SPtr< TbTransmitter< DataType > > TransmitterPtr;
+public:
+   CreateTransmittersHelper();
+   void createTransmitters(const SPtr<Block3D> sblock, const SPtr<Block3D> tblock, int dir, IBlock ib,
+                                 TransmitterPtr& sender, TransmitterPtr& receiver, SPtr<Communicator> comm, TransmitterType tType);
+protected:
+private:
+   std::string generatePoolKey(int srcRank, int srcLevel, int tgtRank, int tgtLevel);
+   std::string  generateVectorKey(int x1, int x2, int x3,/*int id,*/ int dir, IBlock ib);
+   int generateMPITag(int srcLevel, int tgtLevel);
+   static unsigned int vKey;
+};
+
+#endif
diff --git a/src/cpu/VirtualFluidsCore/Visitors/Grid3DVisitor.h b/src/cpu/VirtualFluidsCore/Visitors/Grid3DVisitor.h
index 8b8b1e89c175b89ef8b9075b2a74ff076f562917..2d836daf77d2f180788d0090243b28f86f85f8cc 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/Grid3DVisitor.h
+++ b/src/cpu/VirtualFluidsCore/Visitors/Grid3DVisitor.h
@@ -1,52 +1,52 @@
-//=======================================================================================
-// ____          ____    __    ______     __________   __      __       __        __         
-// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
-//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
-//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
-//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
-//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
-//      \    \  |    |   ________________________________________________________________    
-//       \    \ |    |  |  ______________________________________________________________|   
-//        \    \|    |  |  |         __          __     __     __     ______      _______    
-//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
-//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
-//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
-//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
-//
-//  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 Grid3DVisitor.h
-//! \ingroup Visitors
-//! \author Konstantin Kutscher, Soeren Freudiger, Sebastian Geller
-//=======================================================================================
-
-#ifndef Grid3DVisitor_h
-#define Grid3DVisitor_h
-
-#include <PointerDefinitions.h>
-
-
-class Grid3D;
-
-//! Abstract class provides interface for visitor design pettern
-class Grid3DVisitor
-{
-public:
-   Grid3DVisitor() {}
-   virtual ~Grid3DVisitor() {}
-
-   virtual void visit(SPtr<Grid3D> grid) = 0;
-};
-
-#endif 
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 Grid3DVisitor.h
+//! \ingroup Visitors
+//! \author Konstantin Kutscher, Soeren Freudiger, Sebastian Geller
+//=======================================================================================
+
+#ifndef Grid3DVisitor_h
+#define Grid3DVisitor_h
+
+#include <PointerDefinitions.h>
+
+
+class Grid3D;
+
+//! Abstract class provides interface for visitor design pettern
+class Grid3DVisitor
+{
+public:
+   Grid3DVisitor() {}
+   virtual ~Grid3DVisitor() {}
+
+   virtual void visit(SPtr<Grid3D> grid) = 0;
+};
+
+#endif 
diff --git a/src/cpu/VirtualFluidsCore/Visitors/InitDistributionsBlockVisitor.h b/src/cpu/VirtualFluidsCore/Visitors/InitDistributionsBlockVisitor.h
index 93e3790c901977aa19c5a8c6c5aa2a69b1aa730d..1e7425796e7502b9caf7049141ffc37af051ae62 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/InitDistributionsBlockVisitor.h
+++ b/src/cpu/VirtualFluidsCore/Visitors/InitDistributionsBlockVisitor.h
@@ -1,101 +1,101 @@
-//=======================================================================================
-// ____          ____    __    ______     __________   __      __       __        __         
-// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
-//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
-//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
-//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
-//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
-//      \    \  |    |   ________________________________________________________________    
-//       \    \ |    |  |  ______________________________________________________________|   
-//        \    \|    |  |  |         __          __     __     __     ______      _______    
-//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
-//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
-//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
-//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
-//
-//  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 InitDistributionsBlockVisitor.h
-//! \ingroup Visitors
-//! \author Konstantin Kutscher, Soeren Freudiger
-//=======================================================================================
-
-#ifndef InitDistributionsBlockVisitor_H
-#define InitDistributionsBlockVisitor_H
-
-#include <PointerDefinitions.h>
-
-#include "Block3DVisitor.h"
-#include "D3Q27System.h"
-
-#include <muParser.h>
-
-class Grid3D;
-class Block3D;
-
-//! \brief A class implements an initialization of the flow area.
-//! \details 
-//! It is more flexible way to initialize flow area.
-//! You can define functions to calculate macroscopic values for feq. 
-//! x1,x2,x3 are automatically defined via this adapter and are the real world
-//! vertex coordinates.
-//!
-//!if function is invalid an UbException with detailed information is thrown
-//!
-//! Example:
-//! \code
-//! InitDistributionsBlockVisitor init;
-//! init.setVx1("0.01*x2");
-//! init.setVx2("0.01*x2^2");
-//! \endcode
-
-class InitDistributionsBlockVisitor : public Block3DVisitor
-{
-public:
-   typedef std::numeric_limits<LBMReal> D3Q27RealLim;
-
-public:
-   InitDistributionsBlockVisitor();
-   //////////////////////////////////////////////////////////////////////////
-   //automatic vars are: x1,x2, x3
-   //ussage example: setVx1("x1*0.01+x2*0.003")
-   //////////////////////////////////////////////////////////////////////////
-   void setVx1( const mu::Parser& parser);
-   void setVx2( const mu::Parser& parser);
-   void setVx3( const mu::Parser& parser);
-   void setRho( const mu::Parser& parser);
-
-   void setVx1( const std::string& muParserString);
-   void setVx2( const std::string& muParserString);
-   void setVx3( const std::string& muParserString);
-   void setRho( const std::string& muParserString);
-   //////////////////////////////////////////////////////////////////////////
-   void setVx1( LBMReal vx1 );
-   void setVx2( LBMReal vx2 );
-   void setVx3( LBMReal vx3 );
-   void setRho( LBMReal rho );
-
-   void visit(SPtr<Grid3D> grid, SPtr<Block3D> block) override;
-
-protected:
-   void checkFunction(mu::Parser fct);
-
-private:
-   mu::Parser muVx1;
-   mu::Parser muVx2;
-   mu::Parser muVx3;
-   mu::Parser muRho;
-};
-
-#endif //D3Q27INITDISTRIBUTIONSPATCHVISITOR_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 InitDistributionsBlockVisitor.h
+//! \ingroup Visitors
+//! \author Konstantin Kutscher, Soeren Freudiger
+//=======================================================================================
+
+#ifndef InitDistributionsBlockVisitor_H
+#define InitDistributionsBlockVisitor_H
+
+#include <PointerDefinitions.h>
+
+#include "Block3DVisitor.h"
+#include "D3Q27System.h"
+
+#include <muParser.h>
+
+class Grid3D;
+class Block3D;
+
+//! \brief A class implements an initialization of the flow area.
+//! \details 
+//! It is more flexible way to initialize flow area.
+//! You can define functions to calculate macroscopic values for feq. 
+//! x1,x2,x3 are automatically defined via this adapter and are the real world
+//! vertex coordinates.
+//!
+//!if function is invalid an UbException with detailed information is thrown
+//!
+//! Example:
+//! \code
+//! InitDistributionsBlockVisitor init;
+//! init.setVx1("0.01*x2");
+//! init.setVx2("0.01*x2^2");
+//! \endcode
+
+class InitDistributionsBlockVisitor : public Block3DVisitor
+{
+public:
+   typedef std::numeric_limits<LBMReal> D3Q27RealLim;
+
+public:
+   InitDistributionsBlockVisitor();
+   //////////////////////////////////////////////////////////////////////////
+   //automatic vars are: x1,x2, x3
+   //ussage example: setVx1("x1*0.01+x2*0.003")
+   //////////////////////////////////////////////////////////////////////////
+   void setVx1( const mu::Parser& parser);
+   void setVx2( const mu::Parser& parser);
+   void setVx3( const mu::Parser& parser);
+   void setRho( const mu::Parser& parser);
+
+   void setVx1( const std::string& muParserString);
+   void setVx2( const std::string& muParserString);
+   void setVx3( const std::string& muParserString);
+   void setRho( const std::string& muParserString);
+   //////////////////////////////////////////////////////////////////////////
+   void setVx1( LBMReal vx1 );
+   void setVx2( LBMReal vx2 );
+   void setVx3( LBMReal vx3 );
+   void setRho( LBMReal rho );
+
+   void visit(SPtr<Grid3D> grid, SPtr<Block3D> block) override;
+
+protected:
+   void checkFunction(mu::Parser fct);
+
+private:
+   mu::Parser muVx1;
+   mu::Parser muVx2;
+   mu::Parser muVx3;
+   mu::Parser muRho;
+};
+
+#endif //D3Q27INITDISTRIBUTIONSPATCHVISITOR_H
diff --git a/src/cpu/VirtualFluidsCore/Visitors/InitDistributionsFromFileBlockVisitor.h b/src/cpu/VirtualFluidsCore/Visitors/InitDistributionsFromFileBlockVisitor.h
index bf9182a76e8e043128fe9b22635d806e976a2095..ad93269d17b2d48a65ef6876ae9979764c2d0fca 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/InitDistributionsFromFileBlockVisitor.h
+++ b/src/cpu/VirtualFluidsCore/Visitors/InitDistributionsFromFileBlockVisitor.h
@@ -1,28 +1,28 @@
-#ifndef InitDistributionsFromFileBlockVisitor_h__
-#define InitDistributionsFromFileBlockVisitor_h__
-
-#include "Block3DVisitor.h"
-#include "LBMSystem.h"
-
-#include "CbArray4D.h"
-
-class Grid3D;
-class Block3D;
-
-class InitDistributionsFromFileBlockVisitor : public Block3DVisitor
-{
-public:
-   InitDistributionsFromFileBlockVisitor(LBMReal nu, LBMReal rho, std::string file);
-   ~InitDistributionsFromFileBlockVisitor();
-
-   void visit(SPtr<Grid3D> grid, SPtr<Block3D> block) override;
-
-private:
-   CbArray4D<LBMReal, IndexerX4X3X2X1> matrix;
-   enum Velocity { Vx1, Vx2, Vx3 };
-   LBMReal nu;
-   LBMReal rho;
-};
-#endif // InitDistributionsFromFileBlockVisitor_h__
-
-
+#ifndef InitDistributionsFromFileBlockVisitor_h__
+#define InitDistributionsFromFileBlockVisitor_h__
+
+#include "Block3DVisitor.h"
+#include "LBMSystem.h"
+
+#include "CbArray4D.h"
+
+class Grid3D;
+class Block3D;
+
+class InitDistributionsFromFileBlockVisitor : public Block3DVisitor
+{
+public:
+   InitDistributionsFromFileBlockVisitor(LBMReal nu, LBMReal rho, std::string file);
+   ~InitDistributionsFromFileBlockVisitor();
+
+   void visit(SPtr<Grid3D> grid, SPtr<Block3D> block) override;
+
+private:
+   CbArray4D<LBMReal, IndexerX4X3X2X1> matrix;
+   enum Velocity { Vx1, Vx2, Vx3 };
+   LBMReal nu;
+   LBMReal rho;
+};
+#endif // InitDistributionsFromFileBlockVisitor_h__
+
+
diff --git a/src/cpu/VirtualFluidsCore/Visitors/InitDistributionsWithInterpolationGridVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/InitDistributionsWithInterpolationGridVisitor.cpp
index 857cd63a2a0bff7da631e693e95ae580e3c79693..612fbcf86a3bdae6bb9938c2d8261bea81ec1be7 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/InitDistributionsWithInterpolationGridVisitor.cpp
+++ b/src/cpu/VirtualFluidsCore/Visitors/InitDistributionsWithInterpolationGridVisitor.cpp
@@ -1,610 +1,610 @@
-#include "InitDistributionsWithInterpolationGridVisitor.h"
-
-#include "mpi.h"
-
-#include <basics/utilities/UbFileInputASCII.h>
-#include "LBMKernel.h"
-#include "BCProcessor.h"
-#include "Grid3DSystem.h"
-#include <CbArray2D.h>
-#include "D3Q27EsoTwist3DSplittedVector.h"
-#include "InterpolationProcessor.h"
-#include "DataSet3D.h"
-#include "Grid3D.h"
-#include "Block3D.h"
-
-using namespace std;
-
-InitDistributionsWithInterpolationGridVisitor::InitDistributionsWithInterpolationGridVisitor(SPtr<Grid3D> oldGrid, InterpolationProcessorPtr iProcessor, LBMReal nu)
-   : oldGrid(oldGrid), iProcessor(iProcessor), nu(nu)
-{
-
-}
-//////////////////////////////////////////////////////////////////////////
-InitDistributionsWithInterpolationGridVisitor::~InitDistributionsWithInterpolationGridVisitor()
-{
-}
-//////////////////////////////////////////////////////////////////////////
-void InitDistributionsWithInterpolationGridVisitor::visit(SPtr<Grid3D> grid)
-{
-   newGrid = grid;
-   int minInitLevel = newGrid->getCoarsestInitializedLevel();
-   int maxInitLevel = newGrid->getFinestInitializedLevel();
-   int newGridRank = newGrid->getRank();
-
-   for (int l = minInitLevel; l<=maxInitLevel; l++)
-   {
-      int n = 0;
-      vector<SPtr<Block3D>> blockVector;
-      newGrid->getBlocks(l, blockVector);
-      vector<SPtr<Block3D>> tBlockID;
-
-      for(SPtr<Block3D> newBlock : blockVector)
-      {
-         if (!newBlock)
-            UB_THROW(UbException(UB_EXARGS, "block is not exist"));
-
-         int newBlockRank = newBlock->getRank();
-         int newBlockLevel = newBlock->getLevel();
-
-         SPtr<Block3D> oldBlock = oldGrid->getBlock(newBlock->getX1(), newBlock->getX2(), newBlock->getX3(), newBlock->getLevel());
-         if (oldBlock)
-         {
-            int oldBlockRank = oldBlock->getRank();
-            if (oldBlockRank == newBlockRank && oldBlock->isActive() && newBlockRank == newGridRank && newBlock->isActive())
-            {
-               copyLocalBlock(oldBlock, newBlock);
-            }
-            else
-            {
-               copyRemoteBlock(oldBlock, newBlock);
-            }
-         }
-         else
-         {
-            int newlevel = newBlock->getLevel();
-            Vector3D coords = newGrid->getNodeCoordinates(newBlock, 1, 1, 1);
-
-            UbTupleInt3 oldGridBlockIndexes = oldGrid->getBlockIndexes(coords[0], coords[1], coords[2], newlevel-1);
-            SPtr<Block3D> oldBlock = oldGrid->getBlock(val<1>(oldGridBlockIndexes), val<2>(oldGridBlockIndexes), val<3>(oldGridBlockIndexes), newlevel-1);
-
-            if (oldBlock)
-            {
-               int oldBlockRank = oldBlock->getRank();
-               int oldBlockLevel = oldBlock->getLevel();
-
-               if (oldBlockRank == newBlockRank && oldBlock->isActive() && newBlockRank == newGridRank && newBlock->isActive())
-               {
-                  interpolateLocalBlockCoarseToFine(oldBlock, newBlock);
-               }
-               else
-               {
-                  interpolateRemoteBlockCoarseToFine(oldBlock, newBlock);
-               }
-            }
-            else
-            {
-               UbTupleInt3 oldGridBlockIndexes = oldGrid->getBlockIndexes(coords[0], coords[1], coords[2], newlevel+1);
-               SPtr<Block3D> oldBlock = oldGrid->getBlock(val<1>(oldGridBlockIndexes), val<2>(oldGridBlockIndexes), val<3>(oldGridBlockIndexes), newlevel+1);
-               if (oldBlock)
-               {
-                  int oldBlockRank = oldBlock->getRank();
-                  int oldBlockLevel = oldBlock->getLevel();
-
-                  if (oldBlockRank == newBlockRank && oldBlock->isActive() && newBlockRank == newGridRank && newBlock->isActive())
-                  {
-                     interpolateLocalBlockFineToCoarse(oldBlock, newBlock);
-                  }
-                  else
-                  {
-                     interpolateRemoteBlockFineToCoarse(oldBlock, newBlock);
-                  }
-               }
-            }
-         }
-      }
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-void InitDistributionsWithInterpolationGridVisitor::copyLocalBlock(SPtr<Block3D> oldBlock, SPtr<Block3D> newBlock)
-{
-   SPtr<ILBMKernel> oldKernel = oldBlock->getKernel();
-   if (!oldKernel)
-      throw UbException(UB_EXARGS, "The LBM kernel isn't exist in block: "+oldBlock->toString());
-   SPtr<EsoTwist3D> oldDistributions = dynamicPointerCast<EsoTwist3D>(oldKernel->getDataSet()->getFdistributions());
-
-   SPtr<ILBMKernel> kernel = newBlock->getKernel();
-   if (!kernel)
-      throw UbException(UB_EXARGS, "The LBM kernel isn't exist in new block: "+newBlock->toString());
-   kernel->getDataSet()->setFdistributions(oldDistributions);
-}
-//////////////////////////////////////////////////////////////////////////
-void InitDistributionsWithInterpolationGridVisitor::copyRemoteBlock(SPtr<Block3D> oldBlock, SPtr<Block3D> newBlock)
-{
-   int newGridRank = newGrid->getRank();
-   int oldBlockRank = oldBlock->getRank();
-   int newBlockRank = newBlock->getRank();
-
-   if (oldBlockRank == newGridRank && oldBlock->isActive())
-   {
-       SPtr<ILBMKernel> oldKernel = oldBlock->getKernel();
-      if (!oldKernel)
-         throw UbException(UB_EXARGS, "The LBM kernel isn't exist in block: "+oldBlock->toString());
-      SPtr<EsoTwist3D> oldDistributions = dynamicPointerCast<EsoTwist3D>(oldKernel->getDataSet()->getFdistributions());
-
-      CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr localDistributions = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(oldDistributions)->getLocalDistributions();
-      CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributions = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(oldDistributions)->getNonLocalDistributions();
-      CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr   zeroDistributions = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(oldDistributions)->getZeroDistributions();
-
-      MPI_Send(localDistributions->getStartAdressOfSortedArray(0, 0, 0, 0), (int)localDistributions->getDataVector().size(), MPI_DOUBLE, newBlockRank, 0, MPI_COMM_WORLD);
-      MPI_Send(nonLocalDistributions->getStartAdressOfSortedArray(0, 0, 0, 0), (int)nonLocalDistributions->getDataVector().size(), MPI_DOUBLE, newBlockRank, 0, MPI_COMM_WORLD);
-      MPI_Send(zeroDistributions->getStartAdressOfSortedArray(0, 0, 0), (int)zeroDistributions->getDataVector().size(), MPI_DOUBLE, newBlockRank, 0, MPI_COMM_WORLD);
-   }
-   else if (newBlockRank == newGridRank && newBlock->isActive())
-   {
-       SPtr<ILBMKernel> newKernel = newBlock->getKernel();
-      if (!newKernel)
-         throw UbException(UB_EXARGS, "The LBM kernel isn't exist in new block: "+newBlock->toString()+UbSystem::toString(newGridRank));
-
-      SPtr<EsoTwist3D> newDistributions = dynamicPointerCast<EsoTwist3D>(newKernel->getDataSet()->getFdistributions());
-
-      CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr localDistributions = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(newDistributions)->getLocalDistributions();
-      CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributions = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(newDistributions)->getNonLocalDistributions();
-      CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr   zeroDistributions = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(newDistributions)->getZeroDistributions();
-
-      MPI_Recv(localDistributions->getStartAdressOfSortedArray(0, 0, 0, 0), (int)localDistributions->getDataVector().size(), MPI_DOUBLE, oldBlockRank, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
-      MPI_Recv(nonLocalDistributions->getStartAdressOfSortedArray(0, 0, 0, 0), (int)nonLocalDistributions->getDataVector().size(), MPI_DOUBLE, oldBlockRank, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
-      MPI_Recv(zeroDistributions->getStartAdressOfSortedArray(0, 0, 0), (int)zeroDistributions->getDataVector().size(), MPI_DOUBLE, oldBlockRank, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-void InitDistributionsWithInterpolationGridVisitor::interpolateLocalBlockCoarseToFine(SPtr<Block3D> oldBlock, SPtr<Block3D> newBlock)
-{
-   D3Q27ICell icellC;
-   D3Q27ICell icellF;
-   LBMReal xoff, yoff, zoff;
-
-   LBMReal omegaC = LBMSystem::calcCollisionFactor(nu, oldBlock->getLevel());
-   LBMReal omegaF =LBMSystem::calcCollisionFactor(nu, newBlock->getLevel());
-
-   iProcessor->setOmegas(omegaC, omegaF);
-
-   SPtr<ILBMKernel> oldKernel = oldBlock->getKernel();
-   if (!oldKernel)
-      throw UbException(UB_EXARGS, "The LBM kernel isn't exist in old block: "+oldBlock->toString());
-
-   SPtr<EsoTwist3D> oldDistributions = dynamicPointerCast<EsoTwist3D>(oldKernel->getDataSet()->getFdistributions());
-
-   SPtr<BCArray3D> bcArrayOldBlock = oldBlock->getKernel()->getBCProcessor()->getBCArray();
-
-   SPtr<ILBMKernel> newKernel = newBlock->getKernel();
-   if (!newKernel)
-      throw UbException(UB_EXARGS, "The LBM kernel isn't exist in new block: "+newBlock->toString());
-
-   SPtr<EsoTwist3D> newDistributions = dynamicPointerCast<EsoTwist3D>(newKernel->getDataSet()->getFdistributions());
-
-   int minX1 = 0;
-   int minX2 = 0;
-   int minX3 = 0;
-
-   int maxX1 = (int)newDistributions->getNX1()-1;
-   int maxX2 = (int)newDistributions->getNX2()-1;
-   int maxX3 = (int)newDistributions->getNX3()-1;
-
-   int bMaxX1 = (int)newDistributions->getNX1();
-   int bMaxX2 = (int)newDistributions->getNX2();
-   int bMaxX3 = (int)newDistributions->getNX3();
-
-   for (int ix3 = minX3; ix3 < maxX3; ix3+=2)
-      for (int ix2 = minX2; ix2 < maxX2; ix2+=2)
-         for (int ix1 = minX1; ix1 < maxX1; ix1+=2)
-         {
-             Vector3D coords = newGrid->getNodeCoordinates(newBlock, ix1, ix2, ix3);
-            UbTupleInt3 oldGridIndexMin = oldGrid->getNodeIndexes(oldBlock, coords[0], coords[1], coords[2]);
-            int howManySolids= iProcessor->iCellHowManySolids(bcArrayOldBlock, val<1>(oldGridIndexMin), val<2>(oldGridIndexMin), val<3>(oldGridIndexMin));
-
-            if (howManySolids == 0 || howManySolids == 8)
-            {
-               iProcessor->readICell(oldDistributions, icellC, val<1>(oldGridIndexMin), val<2>(oldGridIndexMin), val<3>(oldGridIndexMin));
-               iProcessor->interpolateCoarseToFine(icellC, icellF);
-            }
-            else
-            {
-               if (iProcessor->findNeighborICell(bcArrayOldBlock, oldDistributions, icellC, bMaxX1, bMaxX2, bMaxX3,
-                  val<1>(oldGridIndexMin), val<2>(oldGridIndexMin), val<3>(oldGridIndexMin), xoff, yoff, zoff))
-               {
-                  //std::string err = "For "+oldBlock->toString()+
-                  //   " x1="+UbSystem::toString(val<1>(oldGridIndexMin))+
-                  //   ", x2=" + UbSystem::toString(val<2>(oldGridIndexMin))+
-                  //   ", x3=" + UbSystem::toString(val<3>(oldGridIndexMin))+
-                  //   " interpolation is not implemented for other direction"+
-                  //   " by using in: "+(std::string)typeid(*this).name()+
-                  //   " or maybe you have a solid on the block boundary";
-                  //UB_THROW(UbException(UB_EXARGS, err));
-                  iProcessor->interpolateCoarseToFine(icellC, icellF, xoff, yoff, zoff);
-               }
-               else
-               {
-                  for (int i=0; i<27; i++)
-                  {
-                     icellF.BSW[i]=0.0;
-                     icellF.BSE[i]=0.0;
-                     icellF.BNW[i]=0.0;
-                     icellF.BNE[i]=0.0;
-                     icellF.TSW[i]=0.0;
-                     icellF.TSE[i]=0.0;
-                     icellF.TNW[i]=0.0;
-                     icellF.TNE[i]=0.0;
-                  }
-                  //                     std::string err = "For "+oldBlock->toString()+
-                  //   " x1="+UbSystem::toString(val<1>(oldGridIndexMin))+
-                  //   ", x2=" + UbSystem::toString(val<2>(oldGridIndexMin))+
-                  //   ", x3=" + UbSystem::toString(val<3>(oldGridIndexMin))+
-                  //   " interpolation is not implemented for other direction"+
-                  //   " by using in: "+(std::string)typeid(*this).name()+
-                  //   " or maybe you have a solid on the block boundary";
-                  ////UB_THROW(UbException(UB_EXARGS, err));
-                  //                     UBLOG(logINFO, err);
-               }
-            }
-
-            iProcessor->writeICell(newDistributions, icellF, ix1, ix2, ix3);
-            iProcessor->writeICellInv(newDistributions, icellF, ix1, ix2, ix3);
-         }
-}
-//////////////////////////////////////////////////////////////////////////
-void InitDistributionsWithInterpolationGridVisitor::interpolateRemoteBlockCoarseToFine(SPtr<Block3D> oldBlock, SPtr<Block3D> newBlock)
-{
-   int newGridRank = newGrid->getRank();
-   int oldBlockRank = oldBlock->getRank();
-   int newBlockRank = newBlock->getRank();
-
-   if (oldBlockRank == newGridRank)
-   {
-       SPtr<ILBMKernel> oldKernel = oldBlock->getKernel();
-      if (!oldKernel)
-         throw UbException(UB_EXARGS, "The LBM kernel isn't exist in block: "+oldBlock->toString());
-      SPtr<EsoTwist3D> oldDistributions = dynamicPointerCast<EsoTwist3D>(oldKernel->getDataSet()->getFdistributions());
-
-      CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr localDistributions = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(oldDistributions)->getLocalDistributions();
-      CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributions = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(oldDistributions)->getNonLocalDistributions();
-      CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr   zeroDistributions = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(oldDistributions)->getZeroDistributions();
-
-      MPI_Send(localDistributions->getStartAdressOfSortedArray(0, 0, 0, 0), (int)localDistributions->getDataVector().size(), MPI_DOUBLE, newBlockRank, 0, MPI_COMM_WORLD);
-      MPI_Send(nonLocalDistributions->getStartAdressOfSortedArray(0, 0, 0, 0), (int)nonLocalDistributions->getDataVector().size(), MPI_DOUBLE, newBlockRank, 0, MPI_COMM_WORLD);
-      MPI_Send(zeroDistributions->getStartAdressOfSortedArray(0, 0, 0), (int)zeroDistributions->getDataVector().size(), MPI_DOUBLE, newBlockRank, 0, MPI_COMM_WORLD);
-
-      SPtr<BCArray3D> bcArrayOldBlock = oldBlock->getKernel()->getBCProcessor()->getBCArray();
-      std::vector< int >& bcDataVector = bcArrayOldBlock->getBcindexmatrixDataVector();
-      MPI_Send(&bcDataVector[0], (int)bcDataVector.size(), MPI_INT, newBlockRank, 0, MPI_COMM_WORLD);
-   }
-   else if (newBlockRank == newGridRank && newBlock->isActive())
-   {
-      D3Q27ICell icellC;
-      D3Q27ICell icellF;
-      LBMReal xoff, yoff, zoff;
-
-      LBMReal omegaC = LBMSystem::calcCollisionFactor(nu, oldBlock->getLevel());
-      LBMReal omegaF =LBMSystem::calcCollisionFactor(nu, newBlock->getLevel());
-
-      iProcessor->setOmegas(omegaC, omegaF);
-
-      SPtr<ILBMKernel> newKernel = newBlock->getKernel();
-      if (!newKernel)
-         throw UbException(UB_EXARGS, "The LBM kernel isn't exist in new block: "+newBlock->toString());
-
-      SPtr<EsoTwist3D> newDistributions = dynamicPointerCast<EsoTwist3D>(newKernel->getDataSet()->getFdistributions());
-
-      int minX1 = 0;
-      int minX2 = 0;
-      int minX3 = 0;
-
-      int maxX1 = (int)newDistributions->getNX1()-1;
-      int maxX2 = (int)newDistributions->getNX2()-1;
-      int maxX3 = (int)newDistributions->getNX3()-1;
-
-      int bMaxX1 = (int)newDistributions->getNX1();
-      int bMaxX2 = (int)newDistributions->getNX2();
-      int bMaxX3 = (int)newDistributions->getNX3();
-
-      SPtr<EsoTwist3D> oldDistributions(new D3Q27EsoTwist3DSplittedVector(bMaxX1, bMaxX2, bMaxX3, 0));
-
-      CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr localDistributions = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(oldDistributions)->getLocalDistributions();
-      CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributions = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(oldDistributions)->getNonLocalDistributions();
-      CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr   zeroDistributions = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(oldDistributions)->getZeroDistributions();
-
-      MPI_Recv(localDistributions->getStartAdressOfSortedArray(0, 0, 0, 0), (int)localDistributions->getDataVector().size(), MPI_DOUBLE, oldBlockRank, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
-      MPI_Recv(nonLocalDistributions->getStartAdressOfSortedArray(0, 0, 0, 0), (int)nonLocalDistributions->getDataVector().size(), MPI_DOUBLE, oldBlockRank, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
-      MPI_Recv(zeroDistributions->getStartAdressOfSortedArray(0, 0, 0), (int)zeroDistributions->getDataVector().size(), MPI_DOUBLE, oldBlockRank, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
-
-      SPtr<BCArray3D> bcArrayOldBlock(new BCArray3D(bMaxX1, bMaxX2, bMaxX3, BCArray3D::FLUID));
-      std::vector< int >& bcDataVector = bcArrayOldBlock->getBcindexmatrixDataVector();
-      MPI_Recv(&bcDataVector[0], (int)bcDataVector.size(), MPI_INT, oldBlockRank, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
-
-      for (int ix3 = minX3; ix3 < maxX3; ix3+=2)
-         for (int ix2 = minX2; ix2 < maxX2; ix2+=2)
-            for (int ix1 = minX1; ix1 < maxX1; ix1+=2)
-            {
-                Vector3D coords = newGrid->getNodeCoordinates(newBlock, ix1, ix2, ix3);
-               UbTupleInt3 oldGridIndexMin = oldGrid->getNodeIndexes(oldBlock, coords[0], coords[1], coords[2]);
-
-               int howManySolids= iProcessor->iCellHowManySolids(bcArrayOldBlock, val<1>(oldGridIndexMin), val<2>(oldGridIndexMin), val<3>(oldGridIndexMin));
-
-               if (howManySolids == 0 || howManySolids == 8)
-               {
-                  iProcessor->readICell(oldDistributions, icellC, val<1>(oldGridIndexMin), val<2>(oldGridIndexMin), val<3>(oldGridIndexMin));
-                  iProcessor->interpolateCoarseToFine(icellC, icellF);
-               }
-               else
-               {
-                  if (iProcessor->findNeighborICell(bcArrayOldBlock, oldDistributions, icellC, bMaxX1, bMaxX2, bMaxX3,
-                     val<1>(oldGridIndexMin), val<2>(oldGridIndexMin), val<3>(oldGridIndexMin), xoff, yoff, zoff))
-                  {
-                     //std::string err = "For "+oldBlock->toString()+
-                     //   " x1="+UbSystem::toString(val<1>(oldGridIndexMin))+
-                     //   ", x2=" + UbSystem::toString(val<2>(oldGridIndexMin))+
-                     //   ", x3=" + UbSystem::toString(val<3>(oldGridIndexMin))+
-                     //   " interpolation is not implemented for other direction"+
-                     //   " by using in: "+(std::string)typeid(*this).name()+
-                     //   " or maybe you have a solid on the block boundary";
-                     //UB_THROW(UbException(UB_EXARGS, err));
-                     iProcessor->interpolateCoarseToFine(icellC, icellF, xoff, yoff, zoff);
-                  }
-                  else
-                  {
-                     for (int i=0; i<27; i++)
-                     {
-                        icellF.BSW[i]=0.0;
-                        icellF.BSE[i]=0.0;
-                        icellF.BNW[i]=0.0;
-                        icellF.BNE[i]=0.0;
-                        icellF.TSW[i]=0.0;
-                        icellF.TSE[i]=0.0;
-                        icellF.TNW[i]=0.0;
-                        icellF.TNE[i]=0.0;
-                     }
-                     //                     std::string err = "For "+oldBlock->toString()+
-                     //   " x1="+UbSystem::toString(val<1>(oldGridIndexMin))+
-                     //   ", x2=" + UbSystem::toString(val<2>(oldGridIndexMin))+
-                     //   ", x3=" + UbSystem::toString(val<3>(oldGridIndexMin))+
-                     //   " interpolation is not implemented for other direction"+
-                     //   " by using in: "+(std::string)typeid(*this).name()+
-                     //   " or maybe you have a solid on the block boundary";
-                     ////UB_THROW(UbException(UB_EXARGS, err));
-                     //                     UBLOG(logINFO, err);
-                  }
-               }
-
-
-
-               iProcessor->writeICell(newDistributions, icellF, ix1, ix2, ix3);
-               iProcessor->writeICellInv(newDistributions, icellF, ix1, ix2, ix3);
-            }
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-void InitDistributionsWithInterpolationGridVisitor::interpolateLocalBlockFineToCoarse(SPtr<Block3D> oldBlock, SPtr<Block3D> newBlock)
-{
-   LBMReal icellC[27];
-   D3Q27ICell icellF;
-   LBMReal xoff, yoff, zoff;
-
-   LBMReal omegaF = LBMSystem::calcCollisionFactor(nu, oldBlock->getLevel());
-   LBMReal omegaC =LBMSystem::calcCollisionFactor(nu, newBlock->getLevel());
-
-   iProcessor->setOmegas(omegaC, omegaF);
-
-   SPtr<ILBMKernel> oldKernel = oldBlock->getKernel();
-   if (!oldKernel)
-      throw UbException(UB_EXARGS, "The LBM kernel isn't exist in old block: "+oldBlock->toString());
-
-   SPtr<EsoTwist3D> oldDistributions = dynamicPointerCast<EsoTwist3D>(oldKernel->getDataSet()->getFdistributions());
-
-   SPtr<BCArray3D> bcArrayOldBlock = oldBlock->getKernel()->getBCProcessor()->getBCArray();
-
-   SPtr<ILBMKernel> newKernel = newBlock->getKernel();
-   if (!newKernel)
-      throw UbException(UB_EXARGS, "The LBM kernel isn't exist in new block: "+newBlock->toString());
-
-   SPtr<EsoTwist3D> newDistributions = dynamicPointerCast<EsoTwist3D>(newKernel->getDataSet()->getFdistributions());
-
-   int minX1 = 0;
-   int minX2 = 0;
-   int minX3 = 0;
-
-   int maxX1 = (int)newDistributions->getNX1()-1;
-   int maxX2 = (int)newDistributions->getNX2()-1;
-   int maxX3 = (int)newDistributions->getNX3()-1;
-
-   int bMaxX1 = (int)newDistributions->getNX1();
-   int bMaxX2 = (int)newDistributions->getNX2();
-   int bMaxX3 = (int)newDistributions->getNX3();
-
-   for (int ix3 = minX3; ix3 < maxX3; ix3+=2)
-      for (int ix2 = minX2; ix2 < maxX2; ix2+=2)
-         for (int ix1 = minX1; ix1 < maxX1; ix1+=2)
-         {
-             Vector3D coords = newGrid->getNodeCoordinates(newBlock, ix1, ix2, ix3);
-            UbTupleInt3 oldGridIndexMin = oldGrid->getNodeIndexes(oldBlock, coords[0], coords[1], coords[2]);
-
-            int howManySolids= iProcessor->iCellHowManySolids(bcArrayOldBlock, val<1>(oldGridIndexMin), val<2>(oldGridIndexMin), val<3>(oldGridIndexMin));
-
-            if (howManySolids == 0 || howManySolids == 8)
-            {
-               iProcessor->readICell(oldDistributions, icellF, val<1>(oldGridIndexMin), val<2>(oldGridIndexMin), val<3>(oldGridIndexMin));
-               iProcessor->interpolateFineToCoarse(icellF, icellC);
-            }
-            else
-            {
-               if (iProcessor->findNeighborICell(bcArrayOldBlock, oldDistributions, icellF, bMaxX1, bMaxX2, bMaxX3,
-                  val<1>(oldGridIndexMin), val<2>(oldGridIndexMin), val<3>(oldGridIndexMin), xoff, yoff, zoff))
-               {
-                  //std::string err = "For "+oldBlock->toString()+
-                  //   " x1="+UbSystem::toString(val<1>(oldGridIndexMin))+
-                  //   ", x2=" + UbSystem::toString(val<2>(oldGridIndexMin))+
-                  //   ", x3=" + UbSystem::toString(val<3>(oldGridIndexMin))+
-                  //   " interpolation is not implemented for other direction"+
-                  //   " by using in: "+(std::string)typeid(*this).name()+
-                  //   " or maybe you have a solid on the block boundary";
-                  //UB_THROW(UbException(UB_EXARGS, err));
-                  iProcessor->interpolateFineToCoarse(icellF, icellC, xoff, yoff, zoff);
-               }
-               else
-               {
-                  for (int i=0; i<27; i++)
-                  {
-                     icellF.BSW[i]=0.0;
-                     icellF.BSE[i]=0.0;
-                     icellF.BNW[i]=0.0;
-                     icellF.BNE[i]=0.0;
-                     icellF.TSW[i]=0.0;
-                     icellF.TSE[i]=0.0;
-                     icellF.TNW[i]=0.0;
-                     icellF.TNE[i]=0.0;
-                  }
-                  //                     std::string err = "For "+oldBlock->toString()+
-                  //   " x1="+UbSystem::toString(val<1>(oldGridIndexMin))+
-                  //   ", x2=" + UbSystem::toString(val<2>(oldGridIndexMin))+
-                  //   ", x3=" + UbSystem::toString(val<3>(oldGridIndexMin))+
-                  //   " interpolation is not implemented for other direction"+
-                  //   " by using in: "+(std::string)typeid(*this).name()+
-                  //   " or maybe you have a solid on the block boundary";
-                  ////UB_THROW(UbException(UB_EXARGS, err));
-                  //                     UBLOG(logINFO, err);
-               }
-            }
-
-            iProcessor->writeINode(newDistributions, icellC, ix1, ix2, ix3);
-            //iProcessor->writeINodeInv(newDistributions, icellC, ix1, ix2, ix3);
-         }
-}
-//////////////////////////////////////////////////////////////////////////
-void InitDistributionsWithInterpolationGridVisitor::interpolateRemoteBlockFineToCoarse(SPtr<Block3D> oldBlock, SPtr<Block3D> newBlock)
-{
-   int newGridRank = newGrid->getRank();
-   int oldBlockRank = oldBlock->getRank();
-   int newBlockRank = newBlock->getRank();
-
-   if (oldBlockRank == newGridRank)
-   {
-       SPtr<ILBMKernel> oldKernel = oldBlock->getKernel();
-      if (!oldKernel)
-         throw UbException(UB_EXARGS, "The LBM kernel isn't exist in block: "+oldBlock->toString());
-      SPtr<EsoTwist3D> oldDistributions = dynamicPointerCast<EsoTwist3D>(oldKernel->getDataSet()->getFdistributions());
-
-      CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr localDistributions = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(oldDistributions)->getLocalDistributions();
-      CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributions = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(oldDistributions)->getNonLocalDistributions();
-      CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr   zeroDistributions = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(oldDistributions)->getZeroDistributions();
-
-      MPI_Send(localDistributions->getStartAdressOfSortedArray(0, 0, 0, 0), (int)localDistributions->getDataVector().size(), MPI_DOUBLE, newBlockRank, 0, MPI_COMM_WORLD);
-      MPI_Send(nonLocalDistributions->getStartAdressOfSortedArray(0, 0, 0, 0), (int)nonLocalDistributions->getDataVector().size(), MPI_DOUBLE, newBlockRank, 0, MPI_COMM_WORLD);
-      MPI_Send(zeroDistributions->getStartAdressOfSortedArray(0, 0, 0), (int)zeroDistributions->getDataVector().size(), MPI_DOUBLE, newBlockRank, 0, MPI_COMM_WORLD);
-
-      SPtr<BCArray3D> bcArrayOldBlock = oldBlock->getKernel()->getBCProcessor()->getBCArray();
-      std::vector< int >& bcDataVector = bcArrayOldBlock->getBcindexmatrixDataVector();
-      MPI_Send(&bcDataVector[0], (int)bcDataVector.size(), MPI_INT, newBlockRank, 0, MPI_COMM_WORLD);
-   }
-   else if (newBlockRank == newGridRank && newBlock->isActive())
-   {
-      LBMReal icellC[27];
-      D3Q27ICell icellF;
-      LBMReal xoff, yoff, zoff;
-
-      LBMReal omegaF = LBMSystem::calcCollisionFactor(nu, oldBlock->getLevel());
-      LBMReal omegaC =LBMSystem::calcCollisionFactor(nu, newBlock->getLevel());
-
-      iProcessor->setOmegas(omegaC, omegaF);
-
-      SPtr<ILBMKernel> newKernel = newBlock->getKernel();
-      if (!newKernel)
-         throw UbException(UB_EXARGS, "The LBM kernel isn't exist in new block: "+newBlock->toString());
-
-      SPtr<EsoTwist3D> newDistributions = dynamicPointerCast<EsoTwist3D>(newKernel->getDataSet()->getFdistributions());
-
-      int minX1 = 0;
-      int minX2 = 0;
-      int minX3 = 0;
-
-      int maxX1 = (int)newDistributions->getNX1()-1;
-      int maxX2 = (int)newDistributions->getNX2()-1;
-      int maxX3 = (int)newDistributions->getNX3()-1;
-
-      int bMaxX1 = (int)newDistributions->getNX1();
-      int bMaxX2 = (int)newDistributions->getNX2();
-      int bMaxX3 = (int)newDistributions->getNX3();
-
-      SPtr<EsoTwist3D> oldDistributions(new D3Q27EsoTwist3DSplittedVector(bMaxX1, bMaxX2, bMaxX3, 0));
-
-      CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr localDistributions = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(oldDistributions)->getLocalDistributions();
-      CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributions = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(oldDistributions)->getNonLocalDistributions();
-      CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr   zeroDistributions = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(oldDistributions)->getZeroDistributions();
-
-      MPI_Recv(localDistributions->getStartAdressOfSortedArray(0, 0, 0, 0), (int)localDistributions->getDataVector().size(), MPI_DOUBLE, oldBlockRank, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
-      MPI_Recv(nonLocalDistributions->getStartAdressOfSortedArray(0, 0, 0, 0), (int)nonLocalDistributions->getDataVector().size(), MPI_DOUBLE, oldBlockRank, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
-      MPI_Recv(zeroDistributions->getStartAdressOfSortedArray(0, 0, 0), (int)zeroDistributions->getDataVector().size(), MPI_DOUBLE, oldBlockRank, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
-
-      SPtr<BCArray3D> bcArrayOldBlock(new BCArray3D(bMaxX1, bMaxX2, bMaxX3, BCArray3D::FLUID));
-      std::vector< int >& bcDataVector = bcArrayOldBlock->getBcindexmatrixDataVector();
-      MPI_Recv(&bcDataVector[0], (int)bcDataVector.size(), MPI_INT, oldBlockRank, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
-
-      for (int ix3 = minX3; ix3 < maxX3; ix3+=2)
-         for (int ix2 = minX2; ix2 < maxX2; ix2+=2)
-            for (int ix1 = minX1; ix1 < maxX1; ix1+=2)
-            {
-               Vector3D coords = newGrid->getNodeCoordinates(newBlock, ix1, ix2, ix3);
-               UbTupleInt3 oldGridIndexMin = oldGrid->getNodeIndexes(oldBlock, coords[0], coords[1], coords[2]);
-
-               int howManySolids= iProcessor->iCellHowManySolids(bcArrayOldBlock, val<1>(oldGridIndexMin), val<2>(oldGridIndexMin), val<3>(oldGridIndexMin));
-
-               if (howManySolids == 0 || howManySolids == 8)
-               {
-                  iProcessor->readICell(oldDistributions, icellF, val<1>(oldGridIndexMin), val<2>(oldGridIndexMin), val<3>(oldGridIndexMin));
-                  iProcessor->interpolateFineToCoarse(icellF, icellC);
-               }
-               else
-               {
-                  if (iProcessor->findNeighborICell(bcArrayOldBlock, oldDistributions, icellF, bMaxX1, bMaxX2, bMaxX3,
-                     val<1>(oldGridIndexMin), val<2>(oldGridIndexMin), val<3>(oldGridIndexMin), xoff, yoff, zoff))
-                  {
-                     //std::string err = "For "+oldBlock->toString()+
-                     //   " x1="+UbSystem::toString(val<1>(oldGridIndexMin))+
-                     //   ", x2=" + UbSystem::toString(val<2>(oldGridIndexMin))+
-                     //   ", x3=" + UbSystem::toString(val<3>(oldGridIndexMin))+
-                     //   " interpolation is not implemented for other direction"+
-                     //   " by using in: "+(std::string)typeid(*this).name()+
-                     //   " or maybe you have a solid on the block boundary";
-                     //UB_THROW(UbException(UB_EXARGS, err));
-                     iProcessor->interpolateFineToCoarse(icellF, icellC, xoff, yoff, zoff);
-                  }
-                  else
-                  {
-                     for (int i=0; i<27; i++)
-                     {
-                        icellF.BSW[i]=0.0;
-                        icellF.BSE[i]=0.0;
-                        icellF.BNW[i]=0.0;
-                        icellF.BNE[i]=0.0;
-                        icellF.TSW[i]=0.0;
-                        icellF.TSE[i]=0.0;
-                        icellF.TNW[i]=0.0;
-                        icellF.TNE[i]=0.0;
-                     }
-                     //                     std::string err = "For "+oldBlock->toString()+
-                     //   " x1="+UbSystem::toString(val<1>(oldGridIndexMin))+
-                     //   ", x2=" + UbSystem::toString(val<2>(oldGridIndexMin))+
-                     //   ", x3=" + UbSystem::toString(val<3>(oldGridIndexMin))+
-                     //   " interpolation is not implemented for other direction"+
-                     //   " by using in: "+(std::string)typeid(*this).name()+
-                     //   " or maybe you have a solid on the block boundary";
-                     ////UB_THROW(UbException(UB_EXARGS, err));
-                     //                     UBLOG(logINFO, err);
-                  }
-               }
-
-               iProcessor->writeINode(newDistributions, icellC, ix1, ix2, ix3);
-               //iProcessor->writeINodeInv(newDistributions, icellC, ix1, ix2, ix3);
-            }
-   }
-}
-
-//////////////////////////////////////////////////////////////////////////
+#include "InitDistributionsWithInterpolationGridVisitor.h"
+
+#include "mpi.h"
+
+#include <basics/utilities/UbFileInputASCII.h>
+#include "LBMKernel.h"
+#include "BCProcessor.h"
+#include "Grid3DSystem.h"
+#include <CbArray2D.h>
+#include "D3Q27EsoTwist3DSplittedVector.h"
+#include "InterpolationProcessor.h"
+#include "DataSet3D.h"
+#include "Grid3D.h"
+#include "Block3D.h"
+
+using namespace std;
+
+InitDistributionsWithInterpolationGridVisitor::InitDistributionsWithInterpolationGridVisitor(SPtr<Grid3D> oldGrid, InterpolationProcessorPtr iProcessor, LBMReal nu)
+   : oldGrid(oldGrid), iProcessor(iProcessor), nu(nu)
+{
+
+}
+//////////////////////////////////////////////////////////////////////////
+InitDistributionsWithInterpolationGridVisitor::~InitDistributionsWithInterpolationGridVisitor()
+{
+}
+//////////////////////////////////////////////////////////////////////////
+void InitDistributionsWithInterpolationGridVisitor::visit(SPtr<Grid3D> grid)
+{
+   newGrid = grid;
+   int minInitLevel = newGrid->getCoarsestInitializedLevel();
+   int maxInitLevel = newGrid->getFinestInitializedLevel();
+   int newGridRank = newGrid->getRank();
+
+   for (int l = minInitLevel; l<=maxInitLevel; l++)
+   {
+      int n = 0;
+      vector<SPtr<Block3D>> blockVector;
+      newGrid->getBlocks(l, blockVector);
+      vector<SPtr<Block3D>> tBlockID;
+
+      for(SPtr<Block3D> newBlock : blockVector)
+      {
+         if (!newBlock)
+            UB_THROW(UbException(UB_EXARGS, "block is not exist"));
+
+         int newBlockRank = newBlock->getRank();
+         int newBlockLevel = newBlock->getLevel();
+
+         SPtr<Block3D> oldBlock = oldGrid->getBlock(newBlock->getX1(), newBlock->getX2(), newBlock->getX3(), newBlock->getLevel());
+         if (oldBlock)
+         {
+            int oldBlockRank = oldBlock->getRank();
+            if (oldBlockRank == newBlockRank && oldBlock->isActive() && newBlockRank == newGridRank && newBlock->isActive())
+            {
+               copyLocalBlock(oldBlock, newBlock);
+            }
+            else
+            {
+               copyRemoteBlock(oldBlock, newBlock);
+            }
+         }
+         else
+         {
+            int newlevel = newBlock->getLevel();
+            Vector3D coords = newGrid->getNodeCoordinates(newBlock, 1, 1, 1);
+
+            UbTupleInt3 oldGridBlockIndexes = oldGrid->getBlockIndexes(coords[0], coords[1], coords[2], newlevel-1);
+            SPtr<Block3D> oldBlock = oldGrid->getBlock(val<1>(oldGridBlockIndexes), val<2>(oldGridBlockIndexes), val<3>(oldGridBlockIndexes), newlevel-1);
+
+            if (oldBlock)
+            {
+               int oldBlockRank = oldBlock->getRank();
+               int oldBlockLevel = oldBlock->getLevel();
+
+               if (oldBlockRank == newBlockRank && oldBlock->isActive() && newBlockRank == newGridRank && newBlock->isActive())
+               {
+                  interpolateLocalBlockCoarseToFine(oldBlock, newBlock);
+               }
+               else
+               {
+                  interpolateRemoteBlockCoarseToFine(oldBlock, newBlock);
+               }
+            }
+            else
+            {
+               UbTupleInt3 oldGridBlockIndexes = oldGrid->getBlockIndexes(coords[0], coords[1], coords[2], newlevel+1);
+               SPtr<Block3D> oldBlock = oldGrid->getBlock(val<1>(oldGridBlockIndexes), val<2>(oldGridBlockIndexes), val<3>(oldGridBlockIndexes), newlevel+1);
+               if (oldBlock)
+               {
+                  int oldBlockRank = oldBlock->getRank();
+                  int oldBlockLevel = oldBlock->getLevel();
+
+                  if (oldBlockRank == newBlockRank && oldBlock->isActive() && newBlockRank == newGridRank && newBlock->isActive())
+                  {
+                     interpolateLocalBlockFineToCoarse(oldBlock, newBlock);
+                  }
+                  else
+                  {
+                     interpolateRemoteBlockFineToCoarse(oldBlock, newBlock);
+                  }
+               }
+            }
+         }
+      }
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+void InitDistributionsWithInterpolationGridVisitor::copyLocalBlock(SPtr<Block3D> oldBlock, SPtr<Block3D> newBlock)
+{
+   SPtr<ILBMKernel> oldKernel = oldBlock->getKernel();
+   if (!oldKernel)
+      throw UbException(UB_EXARGS, "The LBM kernel isn't exist in block: "+oldBlock->toString());
+   SPtr<EsoTwist3D> oldDistributions = dynamicPointerCast<EsoTwist3D>(oldKernel->getDataSet()->getFdistributions());
+
+   SPtr<ILBMKernel> kernel = newBlock->getKernel();
+   if (!kernel)
+      throw UbException(UB_EXARGS, "The LBM kernel isn't exist in new block: "+newBlock->toString());
+   kernel->getDataSet()->setFdistributions(oldDistributions);
+}
+//////////////////////////////////////////////////////////////////////////
+void InitDistributionsWithInterpolationGridVisitor::copyRemoteBlock(SPtr<Block3D> oldBlock, SPtr<Block3D> newBlock)
+{
+   int newGridRank = newGrid->getRank();
+   int oldBlockRank = oldBlock->getRank();
+   int newBlockRank = newBlock->getRank();
+
+   if (oldBlockRank == newGridRank && oldBlock->isActive())
+   {
+       SPtr<ILBMKernel> oldKernel = oldBlock->getKernel();
+      if (!oldKernel)
+         throw UbException(UB_EXARGS, "The LBM kernel isn't exist in block: "+oldBlock->toString());
+      SPtr<EsoTwist3D> oldDistributions = dynamicPointerCast<EsoTwist3D>(oldKernel->getDataSet()->getFdistributions());
+
+      CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr localDistributions = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(oldDistributions)->getLocalDistributions();
+      CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributions = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(oldDistributions)->getNonLocalDistributions();
+      CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr   zeroDistributions = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(oldDistributions)->getZeroDistributions();
+
+      MPI_Send(localDistributions->getStartAdressOfSortedArray(0, 0, 0, 0), (int)localDistributions->getDataVector().size(), MPI_DOUBLE, newBlockRank, 0, MPI_COMM_WORLD);
+      MPI_Send(nonLocalDistributions->getStartAdressOfSortedArray(0, 0, 0, 0), (int)nonLocalDistributions->getDataVector().size(), MPI_DOUBLE, newBlockRank, 0, MPI_COMM_WORLD);
+      MPI_Send(zeroDistributions->getStartAdressOfSortedArray(0, 0, 0), (int)zeroDistributions->getDataVector().size(), MPI_DOUBLE, newBlockRank, 0, MPI_COMM_WORLD);
+   }
+   else if (newBlockRank == newGridRank && newBlock->isActive())
+   {
+       SPtr<ILBMKernel> newKernel = newBlock->getKernel();
+      if (!newKernel)
+         throw UbException(UB_EXARGS, "The LBM kernel isn't exist in new block: "+newBlock->toString()+UbSystem::toString(newGridRank));
+
+      SPtr<EsoTwist3D> newDistributions = dynamicPointerCast<EsoTwist3D>(newKernel->getDataSet()->getFdistributions());
+
+      CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr localDistributions = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(newDistributions)->getLocalDistributions();
+      CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributions = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(newDistributions)->getNonLocalDistributions();
+      CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr   zeroDistributions = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(newDistributions)->getZeroDistributions();
+
+      MPI_Recv(localDistributions->getStartAdressOfSortedArray(0, 0, 0, 0), (int)localDistributions->getDataVector().size(), MPI_DOUBLE, oldBlockRank, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
+      MPI_Recv(nonLocalDistributions->getStartAdressOfSortedArray(0, 0, 0, 0), (int)nonLocalDistributions->getDataVector().size(), MPI_DOUBLE, oldBlockRank, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
+      MPI_Recv(zeroDistributions->getStartAdressOfSortedArray(0, 0, 0), (int)zeroDistributions->getDataVector().size(), MPI_DOUBLE, oldBlockRank, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+void InitDistributionsWithInterpolationGridVisitor::interpolateLocalBlockCoarseToFine(SPtr<Block3D> oldBlock, SPtr<Block3D> newBlock)
+{
+   D3Q27ICell icellC;
+   D3Q27ICell icellF;
+   LBMReal xoff, yoff, zoff;
+
+   LBMReal omegaC = LBMSystem::calcCollisionFactor(nu, oldBlock->getLevel());
+   LBMReal omegaF =LBMSystem::calcCollisionFactor(nu, newBlock->getLevel());
+
+   iProcessor->setOmegas(omegaC, omegaF);
+
+   SPtr<ILBMKernel> oldKernel = oldBlock->getKernel();
+   if (!oldKernel)
+      throw UbException(UB_EXARGS, "The LBM kernel isn't exist in old block: "+oldBlock->toString());
+
+   SPtr<EsoTwist3D> oldDistributions = dynamicPointerCast<EsoTwist3D>(oldKernel->getDataSet()->getFdistributions());
+
+   SPtr<BCArray3D> bcArrayOldBlock = oldBlock->getKernel()->getBCProcessor()->getBCArray();
+
+   SPtr<ILBMKernel> newKernel = newBlock->getKernel();
+   if (!newKernel)
+      throw UbException(UB_EXARGS, "The LBM kernel isn't exist in new block: "+newBlock->toString());
+
+   SPtr<EsoTwist3D> newDistributions = dynamicPointerCast<EsoTwist3D>(newKernel->getDataSet()->getFdistributions());
+
+   int minX1 = 0;
+   int minX2 = 0;
+   int minX3 = 0;
+
+   int maxX1 = (int)newDistributions->getNX1()-1;
+   int maxX2 = (int)newDistributions->getNX2()-1;
+   int maxX3 = (int)newDistributions->getNX3()-1;
+
+   int bMaxX1 = (int)newDistributions->getNX1();
+   int bMaxX2 = (int)newDistributions->getNX2();
+   int bMaxX3 = (int)newDistributions->getNX3();
+
+   for (int ix3 = minX3; ix3 < maxX3; ix3+=2)
+      for (int ix2 = minX2; ix2 < maxX2; ix2+=2)
+         for (int ix1 = minX1; ix1 < maxX1; ix1+=2)
+         {
+             Vector3D coords = newGrid->getNodeCoordinates(newBlock, ix1, ix2, ix3);
+            UbTupleInt3 oldGridIndexMin = oldGrid->getNodeIndexes(oldBlock, coords[0], coords[1], coords[2]);
+            int howManySolids= iProcessor->iCellHowManySolids(bcArrayOldBlock, val<1>(oldGridIndexMin), val<2>(oldGridIndexMin), val<3>(oldGridIndexMin));
+
+            if (howManySolids == 0 || howManySolids == 8)
+            {
+               iProcessor->readICell(oldDistributions, icellC, val<1>(oldGridIndexMin), val<2>(oldGridIndexMin), val<3>(oldGridIndexMin));
+               iProcessor->interpolateCoarseToFine(icellC, icellF);
+            }
+            else
+            {
+               if (iProcessor->findNeighborICell(bcArrayOldBlock, oldDistributions, icellC, bMaxX1, bMaxX2, bMaxX3,
+                  val<1>(oldGridIndexMin), val<2>(oldGridIndexMin), val<3>(oldGridIndexMin), xoff, yoff, zoff))
+               {
+                  //std::string err = "For "+oldBlock->toString()+
+                  //   " x1="+UbSystem::toString(val<1>(oldGridIndexMin))+
+                  //   ", x2=" + UbSystem::toString(val<2>(oldGridIndexMin))+
+                  //   ", x3=" + UbSystem::toString(val<3>(oldGridIndexMin))+
+                  //   " interpolation is not implemented for other direction"+
+                  //   " by using in: "+(std::string)typeid(*this).name()+
+                  //   " or maybe you have a solid on the block boundary";
+                  //UB_THROW(UbException(UB_EXARGS, err));
+                  iProcessor->interpolateCoarseToFine(icellC, icellF, xoff, yoff, zoff);
+               }
+               else
+               {
+                  for (int i=0; i<27; i++)
+                  {
+                     icellF.BSW[i]=0.0;
+                     icellF.BSE[i]=0.0;
+                     icellF.BNW[i]=0.0;
+                     icellF.BNE[i]=0.0;
+                     icellF.TSW[i]=0.0;
+                     icellF.TSE[i]=0.0;
+                     icellF.TNW[i]=0.0;
+                     icellF.TNE[i]=0.0;
+                  }
+                  //                     std::string err = "For "+oldBlock->toString()+
+                  //   " x1="+UbSystem::toString(val<1>(oldGridIndexMin))+
+                  //   ", x2=" + UbSystem::toString(val<2>(oldGridIndexMin))+
+                  //   ", x3=" + UbSystem::toString(val<3>(oldGridIndexMin))+
+                  //   " interpolation is not implemented for other direction"+
+                  //   " by using in: "+(std::string)typeid(*this).name()+
+                  //   " or maybe you have a solid on the block boundary";
+                  ////UB_THROW(UbException(UB_EXARGS, err));
+                  //                     UBLOG(logINFO, err);
+               }
+            }
+
+            iProcessor->writeICell(newDistributions, icellF, ix1, ix2, ix3);
+            iProcessor->writeICellInv(newDistributions, icellF, ix1, ix2, ix3);
+         }
+}
+//////////////////////////////////////////////////////////////////////////
+void InitDistributionsWithInterpolationGridVisitor::interpolateRemoteBlockCoarseToFine(SPtr<Block3D> oldBlock, SPtr<Block3D> newBlock)
+{
+   int newGridRank = newGrid->getRank();
+   int oldBlockRank = oldBlock->getRank();
+   int newBlockRank = newBlock->getRank();
+
+   if (oldBlockRank == newGridRank)
+   {
+       SPtr<ILBMKernel> oldKernel = oldBlock->getKernel();
+      if (!oldKernel)
+         throw UbException(UB_EXARGS, "The LBM kernel isn't exist in block: "+oldBlock->toString());
+      SPtr<EsoTwist3D> oldDistributions = dynamicPointerCast<EsoTwist3D>(oldKernel->getDataSet()->getFdistributions());
+
+      CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr localDistributions = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(oldDistributions)->getLocalDistributions();
+      CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributions = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(oldDistributions)->getNonLocalDistributions();
+      CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr   zeroDistributions = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(oldDistributions)->getZeroDistributions();
+
+      MPI_Send(localDistributions->getStartAdressOfSortedArray(0, 0, 0, 0), (int)localDistributions->getDataVector().size(), MPI_DOUBLE, newBlockRank, 0, MPI_COMM_WORLD);
+      MPI_Send(nonLocalDistributions->getStartAdressOfSortedArray(0, 0, 0, 0), (int)nonLocalDistributions->getDataVector().size(), MPI_DOUBLE, newBlockRank, 0, MPI_COMM_WORLD);
+      MPI_Send(zeroDistributions->getStartAdressOfSortedArray(0, 0, 0), (int)zeroDistributions->getDataVector().size(), MPI_DOUBLE, newBlockRank, 0, MPI_COMM_WORLD);
+
+      SPtr<BCArray3D> bcArrayOldBlock = oldBlock->getKernel()->getBCProcessor()->getBCArray();
+      std::vector< int >& bcDataVector = bcArrayOldBlock->getBcindexmatrixDataVector();
+      MPI_Send(&bcDataVector[0], (int)bcDataVector.size(), MPI_INT, newBlockRank, 0, MPI_COMM_WORLD);
+   }
+   else if (newBlockRank == newGridRank && newBlock->isActive())
+   {
+      D3Q27ICell icellC;
+      D3Q27ICell icellF;
+      LBMReal xoff, yoff, zoff;
+
+      LBMReal omegaC = LBMSystem::calcCollisionFactor(nu, oldBlock->getLevel());
+      LBMReal omegaF =LBMSystem::calcCollisionFactor(nu, newBlock->getLevel());
+
+      iProcessor->setOmegas(omegaC, omegaF);
+
+      SPtr<ILBMKernel> newKernel = newBlock->getKernel();
+      if (!newKernel)
+         throw UbException(UB_EXARGS, "The LBM kernel isn't exist in new block: "+newBlock->toString());
+
+      SPtr<EsoTwist3D> newDistributions = dynamicPointerCast<EsoTwist3D>(newKernel->getDataSet()->getFdistributions());
+
+      int minX1 = 0;
+      int minX2 = 0;
+      int minX3 = 0;
+
+      int maxX1 = (int)newDistributions->getNX1()-1;
+      int maxX2 = (int)newDistributions->getNX2()-1;
+      int maxX3 = (int)newDistributions->getNX3()-1;
+
+      int bMaxX1 = (int)newDistributions->getNX1();
+      int bMaxX2 = (int)newDistributions->getNX2();
+      int bMaxX3 = (int)newDistributions->getNX3();
+
+      SPtr<EsoTwist3D> oldDistributions(new D3Q27EsoTwist3DSplittedVector(bMaxX1, bMaxX2, bMaxX3, 0));
+
+      CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr localDistributions = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(oldDistributions)->getLocalDistributions();
+      CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributions = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(oldDistributions)->getNonLocalDistributions();
+      CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr   zeroDistributions = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(oldDistributions)->getZeroDistributions();
+
+      MPI_Recv(localDistributions->getStartAdressOfSortedArray(0, 0, 0, 0), (int)localDistributions->getDataVector().size(), MPI_DOUBLE, oldBlockRank, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
+      MPI_Recv(nonLocalDistributions->getStartAdressOfSortedArray(0, 0, 0, 0), (int)nonLocalDistributions->getDataVector().size(), MPI_DOUBLE, oldBlockRank, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
+      MPI_Recv(zeroDistributions->getStartAdressOfSortedArray(0, 0, 0), (int)zeroDistributions->getDataVector().size(), MPI_DOUBLE, oldBlockRank, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
+
+      SPtr<BCArray3D> bcArrayOldBlock(new BCArray3D(bMaxX1, bMaxX2, bMaxX3, BCArray3D::FLUID));
+      std::vector< int >& bcDataVector = bcArrayOldBlock->getBcindexmatrixDataVector();
+      MPI_Recv(&bcDataVector[0], (int)bcDataVector.size(), MPI_INT, oldBlockRank, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
+
+      for (int ix3 = minX3; ix3 < maxX3; ix3+=2)
+         for (int ix2 = minX2; ix2 < maxX2; ix2+=2)
+            for (int ix1 = minX1; ix1 < maxX1; ix1+=2)
+            {
+                Vector3D coords = newGrid->getNodeCoordinates(newBlock, ix1, ix2, ix3);
+               UbTupleInt3 oldGridIndexMin = oldGrid->getNodeIndexes(oldBlock, coords[0], coords[1], coords[2]);
+
+               int howManySolids= iProcessor->iCellHowManySolids(bcArrayOldBlock, val<1>(oldGridIndexMin), val<2>(oldGridIndexMin), val<3>(oldGridIndexMin));
+
+               if (howManySolids == 0 || howManySolids == 8)
+               {
+                  iProcessor->readICell(oldDistributions, icellC, val<1>(oldGridIndexMin), val<2>(oldGridIndexMin), val<3>(oldGridIndexMin));
+                  iProcessor->interpolateCoarseToFine(icellC, icellF);
+               }
+               else
+               {
+                  if (iProcessor->findNeighborICell(bcArrayOldBlock, oldDistributions, icellC, bMaxX1, bMaxX2, bMaxX3,
+                     val<1>(oldGridIndexMin), val<2>(oldGridIndexMin), val<3>(oldGridIndexMin), xoff, yoff, zoff))
+                  {
+                     //std::string err = "For "+oldBlock->toString()+
+                     //   " x1="+UbSystem::toString(val<1>(oldGridIndexMin))+
+                     //   ", x2=" + UbSystem::toString(val<2>(oldGridIndexMin))+
+                     //   ", x3=" + UbSystem::toString(val<3>(oldGridIndexMin))+
+                     //   " interpolation is not implemented for other direction"+
+                     //   " by using in: "+(std::string)typeid(*this).name()+
+                     //   " or maybe you have a solid on the block boundary";
+                     //UB_THROW(UbException(UB_EXARGS, err));
+                     iProcessor->interpolateCoarseToFine(icellC, icellF, xoff, yoff, zoff);
+                  }
+                  else
+                  {
+                     for (int i=0; i<27; i++)
+                     {
+                        icellF.BSW[i]=0.0;
+                        icellF.BSE[i]=0.0;
+                        icellF.BNW[i]=0.0;
+                        icellF.BNE[i]=0.0;
+                        icellF.TSW[i]=0.0;
+                        icellF.TSE[i]=0.0;
+                        icellF.TNW[i]=0.0;
+                        icellF.TNE[i]=0.0;
+                     }
+                     //                     std::string err = "For "+oldBlock->toString()+
+                     //   " x1="+UbSystem::toString(val<1>(oldGridIndexMin))+
+                     //   ", x2=" + UbSystem::toString(val<2>(oldGridIndexMin))+
+                     //   ", x3=" + UbSystem::toString(val<3>(oldGridIndexMin))+
+                     //   " interpolation is not implemented for other direction"+
+                     //   " by using in: "+(std::string)typeid(*this).name()+
+                     //   " or maybe you have a solid on the block boundary";
+                     ////UB_THROW(UbException(UB_EXARGS, err));
+                     //                     UBLOG(logINFO, err);
+                  }
+               }
+
+
+
+               iProcessor->writeICell(newDistributions, icellF, ix1, ix2, ix3);
+               iProcessor->writeICellInv(newDistributions, icellF, ix1, ix2, ix3);
+            }
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+void InitDistributionsWithInterpolationGridVisitor::interpolateLocalBlockFineToCoarse(SPtr<Block3D> oldBlock, SPtr<Block3D> newBlock)
+{
+   LBMReal icellC[27];
+   D3Q27ICell icellF;
+   LBMReal xoff, yoff, zoff;
+
+   LBMReal omegaF = LBMSystem::calcCollisionFactor(nu, oldBlock->getLevel());
+   LBMReal omegaC =LBMSystem::calcCollisionFactor(nu, newBlock->getLevel());
+
+   iProcessor->setOmegas(omegaC, omegaF);
+
+   SPtr<ILBMKernel> oldKernel = oldBlock->getKernel();
+   if (!oldKernel)
+      throw UbException(UB_EXARGS, "The LBM kernel isn't exist in old block: "+oldBlock->toString());
+
+   SPtr<EsoTwist3D> oldDistributions = dynamicPointerCast<EsoTwist3D>(oldKernel->getDataSet()->getFdistributions());
+
+   SPtr<BCArray3D> bcArrayOldBlock = oldBlock->getKernel()->getBCProcessor()->getBCArray();
+
+   SPtr<ILBMKernel> newKernel = newBlock->getKernel();
+   if (!newKernel)
+      throw UbException(UB_EXARGS, "The LBM kernel isn't exist in new block: "+newBlock->toString());
+
+   SPtr<EsoTwist3D> newDistributions = dynamicPointerCast<EsoTwist3D>(newKernel->getDataSet()->getFdistributions());
+
+   int minX1 = 0;
+   int minX2 = 0;
+   int minX3 = 0;
+
+   int maxX1 = (int)newDistributions->getNX1()-1;
+   int maxX2 = (int)newDistributions->getNX2()-1;
+   int maxX3 = (int)newDistributions->getNX3()-1;
+
+   int bMaxX1 = (int)newDistributions->getNX1();
+   int bMaxX2 = (int)newDistributions->getNX2();
+   int bMaxX3 = (int)newDistributions->getNX3();
+
+   for (int ix3 = minX3; ix3 < maxX3; ix3+=2)
+      for (int ix2 = minX2; ix2 < maxX2; ix2+=2)
+         for (int ix1 = minX1; ix1 < maxX1; ix1+=2)
+         {
+             Vector3D coords = newGrid->getNodeCoordinates(newBlock, ix1, ix2, ix3);
+            UbTupleInt3 oldGridIndexMin = oldGrid->getNodeIndexes(oldBlock, coords[0], coords[1], coords[2]);
+
+            int howManySolids= iProcessor->iCellHowManySolids(bcArrayOldBlock, val<1>(oldGridIndexMin), val<2>(oldGridIndexMin), val<3>(oldGridIndexMin));
+
+            if (howManySolids == 0 || howManySolids == 8)
+            {
+               iProcessor->readICell(oldDistributions, icellF, val<1>(oldGridIndexMin), val<2>(oldGridIndexMin), val<3>(oldGridIndexMin));
+               iProcessor->interpolateFineToCoarse(icellF, icellC);
+            }
+            else
+            {
+               if (iProcessor->findNeighborICell(bcArrayOldBlock, oldDistributions, icellF, bMaxX1, bMaxX2, bMaxX3,
+                  val<1>(oldGridIndexMin), val<2>(oldGridIndexMin), val<3>(oldGridIndexMin), xoff, yoff, zoff))
+               {
+                  //std::string err = "For "+oldBlock->toString()+
+                  //   " x1="+UbSystem::toString(val<1>(oldGridIndexMin))+
+                  //   ", x2=" + UbSystem::toString(val<2>(oldGridIndexMin))+
+                  //   ", x3=" + UbSystem::toString(val<3>(oldGridIndexMin))+
+                  //   " interpolation is not implemented for other direction"+
+                  //   " by using in: "+(std::string)typeid(*this).name()+
+                  //   " or maybe you have a solid on the block boundary";
+                  //UB_THROW(UbException(UB_EXARGS, err));
+                  iProcessor->interpolateFineToCoarse(icellF, icellC, xoff, yoff, zoff);
+               }
+               else
+               {
+                  for (int i=0; i<27; i++)
+                  {
+                     icellF.BSW[i]=0.0;
+                     icellF.BSE[i]=0.0;
+                     icellF.BNW[i]=0.0;
+                     icellF.BNE[i]=0.0;
+                     icellF.TSW[i]=0.0;
+                     icellF.TSE[i]=0.0;
+                     icellF.TNW[i]=0.0;
+                     icellF.TNE[i]=0.0;
+                  }
+                  //                     std::string err = "For "+oldBlock->toString()+
+                  //   " x1="+UbSystem::toString(val<1>(oldGridIndexMin))+
+                  //   ", x2=" + UbSystem::toString(val<2>(oldGridIndexMin))+
+                  //   ", x3=" + UbSystem::toString(val<3>(oldGridIndexMin))+
+                  //   " interpolation is not implemented for other direction"+
+                  //   " by using in: "+(std::string)typeid(*this).name()+
+                  //   " or maybe you have a solid on the block boundary";
+                  ////UB_THROW(UbException(UB_EXARGS, err));
+                  //                     UBLOG(logINFO, err);
+               }
+            }
+
+            iProcessor->writeINode(newDistributions, icellC, ix1, ix2, ix3);
+            //iProcessor->writeINodeInv(newDistributions, icellC, ix1, ix2, ix3);
+         }
+}
+//////////////////////////////////////////////////////////////////////////
+void InitDistributionsWithInterpolationGridVisitor::interpolateRemoteBlockFineToCoarse(SPtr<Block3D> oldBlock, SPtr<Block3D> newBlock)
+{
+   int newGridRank = newGrid->getRank();
+   int oldBlockRank = oldBlock->getRank();
+   int newBlockRank = newBlock->getRank();
+
+   if (oldBlockRank == newGridRank)
+   {
+       SPtr<ILBMKernel> oldKernel = oldBlock->getKernel();
+      if (!oldKernel)
+         throw UbException(UB_EXARGS, "The LBM kernel isn't exist in block: "+oldBlock->toString());
+      SPtr<EsoTwist3D> oldDistributions = dynamicPointerCast<EsoTwist3D>(oldKernel->getDataSet()->getFdistributions());
+
+      CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr localDistributions = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(oldDistributions)->getLocalDistributions();
+      CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributions = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(oldDistributions)->getNonLocalDistributions();
+      CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr   zeroDistributions = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(oldDistributions)->getZeroDistributions();
+
+      MPI_Send(localDistributions->getStartAdressOfSortedArray(0, 0, 0, 0), (int)localDistributions->getDataVector().size(), MPI_DOUBLE, newBlockRank, 0, MPI_COMM_WORLD);
+      MPI_Send(nonLocalDistributions->getStartAdressOfSortedArray(0, 0, 0, 0), (int)nonLocalDistributions->getDataVector().size(), MPI_DOUBLE, newBlockRank, 0, MPI_COMM_WORLD);
+      MPI_Send(zeroDistributions->getStartAdressOfSortedArray(0, 0, 0), (int)zeroDistributions->getDataVector().size(), MPI_DOUBLE, newBlockRank, 0, MPI_COMM_WORLD);
+
+      SPtr<BCArray3D> bcArrayOldBlock = oldBlock->getKernel()->getBCProcessor()->getBCArray();
+      std::vector< int >& bcDataVector = bcArrayOldBlock->getBcindexmatrixDataVector();
+      MPI_Send(&bcDataVector[0], (int)bcDataVector.size(), MPI_INT, newBlockRank, 0, MPI_COMM_WORLD);
+   }
+   else if (newBlockRank == newGridRank && newBlock->isActive())
+   {
+      LBMReal icellC[27];
+      D3Q27ICell icellF;
+      LBMReal xoff, yoff, zoff;
+
+      LBMReal omegaF = LBMSystem::calcCollisionFactor(nu, oldBlock->getLevel());
+      LBMReal omegaC =LBMSystem::calcCollisionFactor(nu, newBlock->getLevel());
+
+      iProcessor->setOmegas(omegaC, omegaF);
+
+      SPtr<ILBMKernel> newKernel = newBlock->getKernel();
+      if (!newKernel)
+         throw UbException(UB_EXARGS, "The LBM kernel isn't exist in new block: "+newBlock->toString());
+
+      SPtr<EsoTwist3D> newDistributions = dynamicPointerCast<EsoTwist3D>(newKernel->getDataSet()->getFdistributions());
+
+      int minX1 = 0;
+      int minX2 = 0;
+      int minX3 = 0;
+
+      int maxX1 = (int)newDistributions->getNX1()-1;
+      int maxX2 = (int)newDistributions->getNX2()-1;
+      int maxX3 = (int)newDistributions->getNX3()-1;
+
+      int bMaxX1 = (int)newDistributions->getNX1();
+      int bMaxX2 = (int)newDistributions->getNX2();
+      int bMaxX3 = (int)newDistributions->getNX3();
+
+      SPtr<EsoTwist3D> oldDistributions(new D3Q27EsoTwist3DSplittedVector(bMaxX1, bMaxX2, bMaxX3, 0));
+
+      CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr localDistributions = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(oldDistributions)->getLocalDistributions();
+      CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributions = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(oldDistributions)->getNonLocalDistributions();
+      CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr   zeroDistributions = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(oldDistributions)->getZeroDistributions();
+
+      MPI_Recv(localDistributions->getStartAdressOfSortedArray(0, 0, 0, 0), (int)localDistributions->getDataVector().size(), MPI_DOUBLE, oldBlockRank, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
+      MPI_Recv(nonLocalDistributions->getStartAdressOfSortedArray(0, 0, 0, 0), (int)nonLocalDistributions->getDataVector().size(), MPI_DOUBLE, oldBlockRank, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
+      MPI_Recv(zeroDistributions->getStartAdressOfSortedArray(0, 0, 0), (int)zeroDistributions->getDataVector().size(), MPI_DOUBLE, oldBlockRank, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
+
+      SPtr<BCArray3D> bcArrayOldBlock(new BCArray3D(bMaxX1, bMaxX2, bMaxX3, BCArray3D::FLUID));
+      std::vector< int >& bcDataVector = bcArrayOldBlock->getBcindexmatrixDataVector();
+      MPI_Recv(&bcDataVector[0], (int)bcDataVector.size(), MPI_INT, oldBlockRank, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
+
+      for (int ix3 = minX3; ix3 < maxX3; ix3+=2)
+         for (int ix2 = minX2; ix2 < maxX2; ix2+=2)
+            for (int ix1 = minX1; ix1 < maxX1; ix1+=2)
+            {
+               Vector3D coords = newGrid->getNodeCoordinates(newBlock, ix1, ix2, ix3);
+               UbTupleInt3 oldGridIndexMin = oldGrid->getNodeIndexes(oldBlock, coords[0], coords[1], coords[2]);
+
+               int howManySolids= iProcessor->iCellHowManySolids(bcArrayOldBlock, val<1>(oldGridIndexMin), val<2>(oldGridIndexMin), val<3>(oldGridIndexMin));
+
+               if (howManySolids == 0 || howManySolids == 8)
+               {
+                  iProcessor->readICell(oldDistributions, icellF, val<1>(oldGridIndexMin), val<2>(oldGridIndexMin), val<3>(oldGridIndexMin));
+                  iProcessor->interpolateFineToCoarse(icellF, icellC);
+               }
+               else
+               {
+                  if (iProcessor->findNeighborICell(bcArrayOldBlock, oldDistributions, icellF, bMaxX1, bMaxX2, bMaxX3,
+                     val<1>(oldGridIndexMin), val<2>(oldGridIndexMin), val<3>(oldGridIndexMin), xoff, yoff, zoff))
+                  {
+                     //std::string err = "For "+oldBlock->toString()+
+                     //   " x1="+UbSystem::toString(val<1>(oldGridIndexMin))+
+                     //   ", x2=" + UbSystem::toString(val<2>(oldGridIndexMin))+
+                     //   ", x3=" + UbSystem::toString(val<3>(oldGridIndexMin))+
+                     //   " interpolation is not implemented for other direction"+
+                     //   " by using in: "+(std::string)typeid(*this).name()+
+                     //   " or maybe you have a solid on the block boundary";
+                     //UB_THROW(UbException(UB_EXARGS, err));
+                     iProcessor->interpolateFineToCoarse(icellF, icellC, xoff, yoff, zoff);
+                  }
+                  else
+                  {
+                     for (int i=0; i<27; i++)
+                     {
+                        icellF.BSW[i]=0.0;
+                        icellF.BSE[i]=0.0;
+                        icellF.BNW[i]=0.0;
+                        icellF.BNE[i]=0.0;
+                        icellF.TSW[i]=0.0;
+                        icellF.TSE[i]=0.0;
+                        icellF.TNW[i]=0.0;
+                        icellF.TNE[i]=0.0;
+                     }
+                     //                     std::string err = "For "+oldBlock->toString()+
+                     //   " x1="+UbSystem::toString(val<1>(oldGridIndexMin))+
+                     //   ", x2=" + UbSystem::toString(val<2>(oldGridIndexMin))+
+                     //   ", x3=" + UbSystem::toString(val<3>(oldGridIndexMin))+
+                     //   " interpolation is not implemented for other direction"+
+                     //   " by using in: "+(std::string)typeid(*this).name()+
+                     //   " or maybe you have a solid on the block boundary";
+                     ////UB_THROW(UbException(UB_EXARGS, err));
+                     //                     UBLOG(logINFO, err);
+                  }
+               }
+
+               iProcessor->writeINode(newDistributions, icellC, ix1, ix2, ix3);
+               //iProcessor->writeINodeInv(newDistributions, icellC, ix1, ix2, ix3);
+            }
+   }
+}
+
+//////////////////////////////////////////////////////////////////////////
diff --git a/src/cpu/VirtualFluidsCore/Visitors/InitDistributionsWithInterpolationGridVisitor.h b/src/cpu/VirtualFluidsCore/Visitors/InitDistributionsWithInterpolationGridVisitor.h
index 3d976b8bb527f1d6136aa7c7cd2f62118d34f296..3e6f13603b7f4fa84a028a328c71080c2ac1d3bf 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/InitDistributionsWithInterpolationGridVisitor.h
+++ b/src/cpu/VirtualFluidsCore/Visitors/InitDistributionsWithInterpolationGridVisitor.h
@@ -1,34 +1,34 @@
-#ifndef InitDistributionsWithCoarseGridBlockVisitor_h__
-#define InitDistributionsWithCoarseGridBlockVisitor_h__
-
-#include <PointerDefinitions.h>
-
-#include "Grid3DVisitor.h"
-#include "LBMSystem.h"
-
-class Grid3D;
-class Block3D;
-class InterpolationProcessor;
-
-class InitDistributionsWithInterpolationGridVisitor : public Grid3DVisitor
-{
-public:
-   InitDistributionsWithInterpolationGridVisitor(SPtr<Grid3D> oldGrid, SPtr<InterpolationProcessor> iProcessor, LBMReal nu);
-   ~InitDistributionsWithInterpolationGridVisitor();
-   void visit(SPtr<Grid3D> grid);
-private:
-   void copyLocalBlock(SPtr<Block3D> oldBlock, SPtr<Block3D> newBlock);
-   void copyRemoteBlock(SPtr<Block3D> oldBlock, SPtr<Block3D> newBlock);
-   void interpolateLocalBlockCoarseToFine(SPtr<Block3D> oldBlock, SPtr<Block3D> newBlock);
-   void interpolateRemoteBlockCoarseToFine(SPtr<Block3D> oldBlock, SPtr<Block3D> newBlock);
-   void interpolateLocalBlockFineToCoarse(SPtr<Block3D> oldBlock, SPtr<Block3D> newBlock);
-   void interpolateRemoteBlockFineToCoarse(SPtr<Block3D> oldBlock, SPtr<Block3D> newBlock);
-
-   SPtr<Grid3D> newGrid;
-   SPtr<Grid3D> oldGrid;
-   LBMReal nu;
-
-   SPtr<InterpolationProcessor> iProcessor;
-};
-
-#endif // InitDistributionsWithVelocityProfileBlockVisitor_h__
+#ifndef InitDistributionsWithCoarseGridBlockVisitor_h__
+#define InitDistributionsWithCoarseGridBlockVisitor_h__
+
+#include <PointerDefinitions.h>
+
+#include "Grid3DVisitor.h"
+#include "LBMSystem.h"
+
+class Grid3D;
+class Block3D;
+class InterpolationProcessor;
+
+class InitDistributionsWithInterpolationGridVisitor : public Grid3DVisitor
+{
+public:
+   InitDistributionsWithInterpolationGridVisitor(SPtr<Grid3D> oldGrid, SPtr<InterpolationProcessor> iProcessor, LBMReal nu);
+   ~InitDistributionsWithInterpolationGridVisitor();
+   void visit(SPtr<Grid3D> grid);
+private:
+   void copyLocalBlock(SPtr<Block3D> oldBlock, SPtr<Block3D> newBlock);
+   void copyRemoteBlock(SPtr<Block3D> oldBlock, SPtr<Block3D> newBlock);
+   void interpolateLocalBlockCoarseToFine(SPtr<Block3D> oldBlock, SPtr<Block3D> newBlock);
+   void interpolateRemoteBlockCoarseToFine(SPtr<Block3D> oldBlock, SPtr<Block3D> newBlock);
+   void interpolateLocalBlockFineToCoarse(SPtr<Block3D> oldBlock, SPtr<Block3D> newBlock);
+   void interpolateRemoteBlockFineToCoarse(SPtr<Block3D> oldBlock, SPtr<Block3D> newBlock);
+
+   SPtr<Grid3D> newGrid;
+   SPtr<Grid3D> oldGrid;
+   LBMReal nu;
+
+   SPtr<InterpolationProcessor> iProcessor;
+};
+
+#endif // InitDistributionsWithVelocityProfileBlockVisitor_h__
diff --git a/src/cpu/VirtualFluidsCore/Visitors/MetisPartitioningGridVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/MetisPartitioningGridVisitor.cpp
index a996383ef3538c959a3a56ca21865eb9c7075ca8..903ca99bf05f4493ade1c3bed6512f2b8823a6ae 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/MetisPartitioningGridVisitor.cpp
+++ b/src/cpu/VirtualFluidsCore/Visitors/MetisPartitioningGridVisitor.cpp
@@ -1,322 +1,322 @@
-#if defined VF_METIS && defined VF_MPI
-
-#include "MetisPartitioningGridVisitor.h"
-#include <math.h>
-#include "Block3D.h"
-#include "Grid3D.h"
-#include "Communicator.h"
-#include "D3Q27System.h"
-
-using namespace std;
-
-MetisPartitioningGridVisitor::MetisPartitioningGridVisitor(SPtr<Communicator> comm, GraphType graphType, int numOfDirs, MetisPartitioner::PartType partType, bool threads, int numberOfThreads)
-    :  Grid3DVisitor(),
-       numberOfThreads(numberOfThreads),
-       numOfDirs(numOfDirs),
-       comm(comm),
-       threads(threads),
-       graphType(graphType),
-       partType(partType)
-{  
-   numberOfProcesses = comm->getNumberOfProcesses();
-}
-//////////////////////////////////////////////////////////////////////////
-MetisPartitioningGridVisitor::~MetisPartitioningGridVisitor()
-{
-
-}
-//////////////////////////////////////////////////////////////////////////
-void MetisPartitioningGridVisitor::visit(SPtr<Grid3D> grid)
-{
-    UBLOG(logDEBUG1, "MetisPartitioningGridVisitor::visit() - start");
-
-    this->clear();
-
-    bundleRoot = comm->getBundleRoot();
-    bundleID = comm->getBundleID();
-    numberOfBundles = comm->getNumberOfBundles();
-    if (numberOfBundles > 1)
-    {
-        if (bundleRoot == bundleID && processRoot == processID)
-            collectData(grid, numberOfBundles, BUNDLE);
-        comm->broadcast(blockID);
-        comm->broadcast(parts);
-        distributePartitionData(grid, BUNDLE);
-        this->clear();
-    }
-
-    processRoot = comm->getProcessRoot();
-    processID = comm->getProcessID();
-    /*int numberOfProcesses = comm->getNumberOfProcesses();*/
-    if (numberOfProcesses > 1)
-    {
-       int temp = bundleID;
-       for (int i = 0; i < numberOfBundles; i++)
-       {
-          if (bundleRoot == bundleID && processRoot == processID)
-          {
-             bundleID = i;
-             //numberOfProcesses = comm->getNumberOfProcessesInBundle(i);
-             collectData(grid, numberOfProcesses, PROCESS);
-             bundleID = temp;
-          }
-          comm->broadcast(blockID);
-          //UBLOG(logINFO, "blockID="<<blockID.size());
-          comm->broadcast(parts);
-          //UBLOG(logINFO, "parts="<<parts.size());
-          distributePartitionData(grid, PROCESS);
-       }
-    }
-
-    if (threads)
-    {
-        if (numberOfThreads > 1)
-        {
-            collectData(grid, numberOfThreads, THREAD);
-            distributePartitionData(grid, THREAD);
-        }
-    }
-    UBLOG(logDEBUG1, "MetisPartitioningGridVisitor::visit() - end");
-}
-//////////////////////////////////////////////////////////////////////////
-void MetisPartitioningGridVisitor::collectData(SPtr<Grid3D> grid, int nofSegments, PartLevel level)
-{
-    clear();
-
-    switch (graphType)
-    {
-    case LevelIntersected: 
-      buildMetisGraphLevelIntersected(grid, nofSegments, level);
-    	break;
-    case LevelBased: 
-      buildMetisGraphLevelBased(grid, nofSegments, level);
-      break;
-    }
-}
-//////////////////////////////////////////////////////////////////////////
-void MetisPartitioningGridVisitor::distributePartitionData(SPtr<Grid3D> grid, PartLevel level)
-{
-    SPtr<Block3D> block;
-
-    for(size_t p=0; p<parts.size(); p++)
-    {
-        block = grid->getBlock(blockID[p]);
-        if (block)
-        {
-            switch (level)
-            {
-            case BUNDLE:
-                block->setBundle(parts[p]);
-                break;
-            case PROCESS:
-                if (numberOfBundles == 1)
-                {
-                   block->setRank(parts[p]);
-                } 
-                else
-                {
-                   block->setLocalRank(parts[p]);
-                   block->setRank(comm->getProcessID(block->getBundle(),parts[p]));
-                }
-                break;
-            case THREAD:
-                block->setPart(parts[p]);
-                break;
-            }
-        }
-    }
-}
-//////////////////////////////////////////////////////////////////////////
-void MetisPartitioningGridVisitor::buildMetisGraphLevelIntersected(SPtr<Grid3D> grid, int nofSegments, PartLevel level)
-{
-    int edges = 0;
-    const int edgeWeight= 1;
-    const int edgeWeightChildFactor = 8;
-    int n = 0;
-
-    for(Grid3D::BlockIDMap::value_type b :  grid->getBlockIDs())
-    { 
-        SPtr<Block3D> block = b.second;
-        if (this->getPartitionCondition(block, level))
-        {
-            block->setLocalID(n);
-            blockID.push_back(block->getGlobalID());
-            n++;
-        }
-    }
-
-    MetisPartitioner metis;
-
-    for(Grid3D::BlockIDMap::value_type b :  grid->getBlockIDs())
-    { 
-        const SPtr<Block3D> block = b.second;
-        if (this->getPartitionCondition(block, level))
-        {
-           metis.xadj.push_back(edges);
-            //the weights of the vertices are 2^level of grid (1, 2, 4, 8 .....) 1<<level 
-            metis.vwgt.push_back((idx_t)(1<<block->getLevel())); 
-
-            for( int dir = 0; dir <= numOfDirs; dir++)
-            {
-                SPtr<Block3D> neighBlock = grid->getNeighborBlock(dir, block);
-                if(neighBlock)
-                {
-                    if (this->getPartitionCondition(neighBlock, level))
-                    {
-                        edges++;
-                        metis.adjwgt.push_back(edgeWeight);
-                        metis.adjncy.push_back(neighBlock->getLocalID());
-                    }
-                }
-            }
-            vector<SPtr<Block3D>> subBlocks;
-            grid->getSubBlocks(block, 1, subBlocks);
-            for(SPtr<Block3D> subBlock : subBlocks)
-            {
-                if (subBlock)
-                {
-                    if (this->getPartitionCondition(subBlock, level))
-                    {
-                        edges++;
-                        metis.adjwgt.push_back(edgeWeight*edgeWeightChildFactor);
-                        metis.adjncy.push_back(subBlock->getLocalID());
-                    }
-                }
-            }
-        }
-    }
-
-    metis.xadj.push_back(static_cast<idx_t>(metis.adjncy.size()));
-    if ((metis.adjncy.size()%2)!=0)
-        throw UbException(UB_EXARGS,"number of edges is odd - probable adjncy-vector doesn't contain all pairs (A->B) and (B->A)!!!" );
-
-    
-    metis.partition(nofSegments, partType);
-    parts = metis.part;
-}
-//////////////////////////////////////////////////////////////////////////
-void MetisPartitioningGridVisitor::buildMetisGraphLevelBased(SPtr<Grid3D> grid, int nofSegments, PartLevel level)
-{
-    int minInitLevel = grid->getCoarsestInitializedLevel();
-    int maxInitLevel = grid->getFinestInitializedLevel();
-
-    for(int l = minInitLevel; l<=maxInitLevel;l++)
-    {
-        int n = 0;
-        vector<SPtr<Block3D>> blockVector;
-        grid->getBlocks(l, blockVector);
-        vector<SPtr<Block3D>> tBlockID;
-
-        for(SPtr<Block3D> block : blockVector)
-        { 
-            if (this->getPartitionCondition(block, level))
-            {
-                block->setLocalID(n);
-                blockID.push_back(block->getGlobalID());
-                tBlockID.push_back(block);
-                n++;
-            }
-        }
-
-        if (tBlockID.size() == 0)
-        {
-           UB_THROW(UbException(UB_EXARGS,"Blocks for decomposition don't exist!"));
-        }
-
-        MetisPartitioner metis;
-
-        const int vertexWeight = 1;
-        int edges = 0;
-
-        for(SPtr<Block3D> block : tBlockID)
-        {
-            metis.xadj.push_back(edges);
-            metis.vwgt.push_back(vertexWeight);
-
-            for( int dir = 0; dir <= numOfDirs; dir++)
-            {
-                SPtr<Block3D> neighBlock = grid->getNeighborBlock(dir, block);
-                if(neighBlock)
-                {
-                    if (this->getPartitionCondition(neighBlock, level))
-                    {
-                        edges++;
-                        metis.adjwgt.push_back(getEdgeWeight(dir));
-                        metis.adjncy.push_back(neighBlock->getLocalID());
-                    }
-                }
-            }
-        }
-        metis.xadj.push_back(static_cast<idx_t>(metis.adjncy.size()));
-        if ((metis.adjncy.size()%2)!=0)
-            throw UbException(UB_EXARGS,"number of edges is odd - probable adjncy-vector doesn't contain all pairs (A->B) and (B->A)!!!" );
-
-        int nofBlocks = grid->getNumberOfBlocks(l);
-        int tnofSegments = nofSegments;
-        if (nofBlocks < nofSegments)
-        {
-           tnofSegments = nofBlocks;
-        }
-        metis.partition(tnofSegments, partType);
-
-        for(idx_t p : metis.part)
-        {
-            parts.push_back(p);
-        }
-    }
-}
-//////////////////////////////////////////////////////////////////////////
-bool MetisPartitioningGridVisitor::getPartitionCondition(SPtr<Block3D> block, PartLevel level)
-{
-    if (level == BUNDLE)
-    {
-       return true;
-    }
-    else if(level == PROCESS)
-    {
-       if (block->getBundle() == bundleID)
-       {
-          return true;
-       }
-    }
-    else if(level == THREAD)
-    {
-      if (block->getBundle() == bundleID && block->getRank() == processID)
-      {
-         return true;
-      }
-    }
-
-    return false;
-}
-//////////////////////////////////////////////////////////////////////////
-void MetisPartitioningGridVisitor::clear()
-{
-    blockID.clear();
-    parts.clear();
-}
-//////////////////////////////////////////////////////////////////////////
-int MetisPartitioningGridVisitor::getEdgeWeight(int dir)
-{
-   using namespace D3Q27System;
-   if (dir <= B)
-   {
-      return 100;
-   } 
-   else if (dir >= NE && dir <= TS)
-   {
-      return 10;
-   }
-   else if (dir >= TNE)
-   {
-      return 1;
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-void MetisPartitioningGridVisitor::setNumberOfProcesses(int np)
-{
-   numberOfProcesses = np;
-}
-
-
-#endif  //VF_METIS
+#if defined VF_METIS && defined VF_MPI
+
+#include "MetisPartitioningGridVisitor.h"
+#include <math.h>
+#include "Block3D.h"
+#include "Grid3D.h"
+#include "Communicator.h"
+#include "D3Q27System.h"
+
+using namespace std;
+
+MetisPartitioningGridVisitor::MetisPartitioningGridVisitor(SPtr<Communicator> comm, GraphType graphType, int numOfDirs, MetisPartitioner::PartType partType, bool threads, int numberOfThreads)
+    :  Grid3DVisitor(),
+       numberOfThreads(numberOfThreads),
+       numOfDirs(numOfDirs),
+       comm(comm),
+       threads(threads),
+       graphType(graphType),
+       partType(partType)
+{  
+   numberOfProcesses = comm->getNumberOfProcesses();
+}
+//////////////////////////////////////////////////////////////////////////
+MetisPartitioningGridVisitor::~MetisPartitioningGridVisitor()
+{
+
+}
+//////////////////////////////////////////////////////////////////////////
+void MetisPartitioningGridVisitor::visit(SPtr<Grid3D> grid)
+{
+    UBLOG(logDEBUG1, "MetisPartitioningGridVisitor::visit() - start");
+
+    this->clear();
+
+    bundleRoot = comm->getBundleRoot();
+    bundleID = comm->getBundleID();
+    numberOfBundles = comm->getNumberOfBundles();
+    if (numberOfBundles > 1)
+    {
+        if (bundleRoot == bundleID && processRoot == processID)
+            collectData(grid, numberOfBundles, BUNDLE);
+        comm->broadcast(blockID);
+        comm->broadcast(parts);
+        distributePartitionData(grid, BUNDLE);
+        this->clear();
+    }
+
+    processRoot = comm->getProcessRoot();
+    processID = comm->getProcessID();
+    /*int numberOfProcesses = comm->getNumberOfProcesses();*/
+    if (numberOfProcesses > 1)
+    {
+       int temp = bundleID;
+       for (int i = 0; i < numberOfBundles; i++)
+       {
+          if (bundleRoot == bundleID && processRoot == processID)
+          {
+             bundleID = i;
+             //numberOfProcesses = comm->getNumberOfProcessesInBundle(i);
+             collectData(grid, numberOfProcesses, PROCESS);
+             bundleID = temp;
+          }
+          comm->broadcast(blockID);
+          //UBLOG(logINFO, "blockID="<<blockID.size());
+          comm->broadcast(parts);
+          //UBLOG(logINFO, "parts="<<parts.size());
+          distributePartitionData(grid, PROCESS);
+       }
+    }
+
+    if (threads)
+    {
+        if (numberOfThreads > 1)
+        {
+            collectData(grid, numberOfThreads, THREAD);
+            distributePartitionData(grid, THREAD);
+        }
+    }
+    UBLOG(logDEBUG1, "MetisPartitioningGridVisitor::visit() - end");
+}
+//////////////////////////////////////////////////////////////////////////
+void MetisPartitioningGridVisitor::collectData(SPtr<Grid3D> grid, int nofSegments, PartLevel level)
+{
+    clear();
+
+    switch (graphType)
+    {
+    case LevelIntersected: 
+      buildMetisGraphLevelIntersected(grid, nofSegments, level);
+    	break;
+    case LevelBased: 
+      buildMetisGraphLevelBased(grid, nofSegments, level);
+      break;
+    }
+}
+//////////////////////////////////////////////////////////////////////////
+void MetisPartitioningGridVisitor::distributePartitionData(SPtr<Grid3D> grid, PartLevel level)
+{
+    SPtr<Block3D> block;
+
+    for(size_t p=0; p<parts.size(); p++)
+    {
+        block = grid->getBlock(blockID[p]);
+        if (block)
+        {
+            switch (level)
+            {
+            case BUNDLE:
+                block->setBundle(parts[p]);
+                break;
+            case PROCESS:
+                if (numberOfBundles == 1)
+                {
+                   block->setRank(parts[p]);
+                } 
+                else
+                {
+                   block->setLocalRank(parts[p]);
+                   block->setRank(comm->getProcessID(block->getBundle(),parts[p]));
+                }
+                break;
+            case THREAD:
+                block->setPart(parts[p]);
+                break;
+            }
+        }
+    }
+}
+//////////////////////////////////////////////////////////////////////////
+void MetisPartitioningGridVisitor::buildMetisGraphLevelIntersected(SPtr<Grid3D> grid, int nofSegments, PartLevel level)
+{
+    int edges = 0;
+    const int edgeWeight= 1;
+    const int edgeWeightChildFactor = 8;
+    int n = 0;
+
+    for(Grid3D::BlockIDMap::value_type b :  grid->getBlockIDs())
+    { 
+        SPtr<Block3D> block = b.second;
+        if (this->getPartitionCondition(block, level))
+        {
+            block->setLocalID(n);
+            blockID.push_back(block->getGlobalID());
+            n++;
+        }
+    }
+
+    MetisPartitioner metis;
+
+    for(Grid3D::BlockIDMap::value_type b :  grid->getBlockIDs())
+    { 
+        const SPtr<Block3D> block = b.second;
+        if (this->getPartitionCondition(block, level))
+        {
+           metis.xadj.push_back(edges);
+            //the weights of the vertices are 2^level of grid (1, 2, 4, 8 .....) 1<<level 
+            metis.vwgt.push_back((idx_t)(1<<block->getLevel())); 
+
+            for( int dir = 0; dir <= numOfDirs; dir++)
+            {
+                SPtr<Block3D> neighBlock = grid->getNeighborBlock(dir, block);
+                if(neighBlock)
+                {
+                    if (this->getPartitionCondition(neighBlock, level))
+                    {
+                        edges++;
+                        metis.adjwgt.push_back(edgeWeight);
+                        metis.adjncy.push_back(neighBlock->getLocalID());
+                    }
+                }
+            }
+            vector<SPtr<Block3D>> subBlocks;
+            grid->getSubBlocks(block, 1, subBlocks);
+            for(SPtr<Block3D> subBlock : subBlocks)
+            {
+                if (subBlock)
+                {
+                    if (this->getPartitionCondition(subBlock, level))
+                    {
+                        edges++;
+                        metis.adjwgt.push_back(edgeWeight*edgeWeightChildFactor);
+                        metis.adjncy.push_back(subBlock->getLocalID());
+                    }
+                }
+            }
+        }
+    }
+
+    metis.xadj.push_back(static_cast<idx_t>(metis.adjncy.size()));
+    if ((metis.adjncy.size()%2)!=0)
+        throw UbException(UB_EXARGS,"number of edges is odd - probable adjncy-vector doesn't contain all pairs (A->B) and (B->A)!!!" );
+
+    
+    metis.partition(nofSegments, partType);
+    parts = metis.part;
+}
+//////////////////////////////////////////////////////////////////////////
+void MetisPartitioningGridVisitor::buildMetisGraphLevelBased(SPtr<Grid3D> grid, int nofSegments, PartLevel level)
+{
+    int minInitLevel = grid->getCoarsestInitializedLevel();
+    int maxInitLevel = grid->getFinestInitializedLevel();
+
+    for(int l = minInitLevel; l<=maxInitLevel;l++)
+    {
+        int n = 0;
+        vector<SPtr<Block3D>> blockVector;
+        grid->getBlocks(l, blockVector);
+        vector<SPtr<Block3D>> tBlockID;
+
+        for(SPtr<Block3D> block : blockVector)
+        { 
+            if (this->getPartitionCondition(block, level))
+            {
+                block->setLocalID(n);
+                blockID.push_back(block->getGlobalID());
+                tBlockID.push_back(block);
+                n++;
+            }
+        }
+
+        if (tBlockID.size() == 0)
+        {
+           UB_THROW(UbException(UB_EXARGS,"Blocks for decomposition don't exist!"));
+        }
+
+        MetisPartitioner metis;
+
+        const int vertexWeight = 1;
+        int edges = 0;
+
+        for(SPtr<Block3D> block : tBlockID)
+        {
+            metis.xadj.push_back(edges);
+            metis.vwgt.push_back(vertexWeight);
+
+            for( int dir = 0; dir <= numOfDirs; dir++)
+            {
+                SPtr<Block3D> neighBlock = grid->getNeighborBlock(dir, block);
+                if(neighBlock)
+                {
+                    if (this->getPartitionCondition(neighBlock, level))
+                    {
+                        edges++;
+                        metis.adjwgt.push_back(getEdgeWeight(dir));
+                        metis.adjncy.push_back(neighBlock->getLocalID());
+                    }
+                }
+            }
+        }
+        metis.xadj.push_back(static_cast<idx_t>(metis.adjncy.size()));
+        if ((metis.adjncy.size()%2)!=0)
+            throw UbException(UB_EXARGS,"number of edges is odd - probable adjncy-vector doesn't contain all pairs (A->B) and (B->A)!!!" );
+
+        int nofBlocks = grid->getNumberOfBlocks(l);
+        int tnofSegments = nofSegments;
+        if (nofBlocks < nofSegments)
+        {
+           tnofSegments = nofBlocks;
+        }
+        metis.partition(tnofSegments, partType);
+
+        for(idx_t p : metis.part)
+        {
+            parts.push_back(p);
+        }
+    }
+}
+//////////////////////////////////////////////////////////////////////////
+bool MetisPartitioningGridVisitor::getPartitionCondition(SPtr<Block3D> block, PartLevel level)
+{
+    if (level == BUNDLE)
+    {
+       return true;
+    }
+    else if(level == PROCESS)
+    {
+       if (block->getBundle() == bundleID)
+       {
+          return true;
+       }
+    }
+    else if(level == THREAD)
+    {
+      if (block->getBundle() == bundleID && block->getRank() == processID)
+      {
+         return true;
+      }
+    }
+
+    return false;
+}
+//////////////////////////////////////////////////////////////////////////
+void MetisPartitioningGridVisitor::clear()
+{
+    blockID.clear();
+    parts.clear();
+}
+//////////////////////////////////////////////////////////////////////////
+int MetisPartitioningGridVisitor::getEdgeWeight(int dir)
+{
+   using namespace D3Q27System;
+   if (dir <= B)
+   {
+      return 100;
+   } 
+   else if (dir >= NE && dir <= TS)
+   {
+      return 10;
+   }
+   else if (dir >= TNE)
+   {
+      return 1;
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+void MetisPartitioningGridVisitor::setNumberOfProcesses(int np)
+{
+   numberOfProcesses = np;
+}
+
+
+#endif  //VF_METIS
diff --git a/src/cpu/VirtualFluidsCore/Visitors/MetisPartitioningGridVisitor.h b/src/cpu/VirtualFluidsCore/Visitors/MetisPartitioningGridVisitor.h
index 0cb2e05a7743f7880a0f64ef9c11b1201fae92de..0065a41a7dd89edaa02dc8bc1479b03104ef2855 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/MetisPartitioningGridVisitor.h
+++ b/src/cpu/VirtualFluidsCore/Visitors/MetisPartitioningGridVisitor.h
@@ -1,68 +1,68 @@
-#ifndef MetisPartitioningGridVisitor_h 
-#define MetisPartitioningGridVisitor_h
-
-#if defined VF_METIS && defined VF_MPI
-
-#include <vector>
-#include <PointerDefinitions.h>
-
-#include "Grid3DVisitor.h"
-#include "MetisPartitioner.h"
-
-
-class Communicator;
-
-////////////////////////////////////////////////////////////////////////
-//! \brief The class implements domain decomposition with METIS library
-//! \author Kostyantyn Kucher
-//////////////////////////////////////////////////////////////////////////
-
-class Grid3D;
-class Block3D;
-
-class MetisPartitioningGridVisitor : public Grid3DVisitor
-{                                             
-public:
-   //! This describe different types of decomposition   
-   enum GraphType{LevelIntersected, LevelBased};
-
-public:
-   //! Constructor
-   //! \param comm - communicator
-   //! \param graphType - type of decomposition
-   //! \param numOfDirs - maximum number of neighbors for each process
-   //! \param threads - on/off decomposition for threads
-   //! \param numberOfThreads - number of threads
-   MetisPartitioningGridVisitor(SPtr<Communicator> comm, GraphType graphType, int numOfDirs, MetisPartitioner::PartType partType = MetisPartitioner::KWAY, bool threads = false, int numberOfThreads = 0);
-   virtual ~MetisPartitioningGridVisitor();
-   void visit(SPtr<Grid3D> grid) override;
-   void setNumberOfProcesses(int np);
-
-protected:
-   enum PartLevel {BUNDLE, PROCESS, THREAD};
-   void collectData(SPtr<Grid3D> grid, int nofSegments, PartLevel level);
-   void buildMetisGraphLevelIntersected(SPtr<Grid3D> grid, int nofSegments, PartLevel level);
-   void buildMetisGraphLevelBased(SPtr<Grid3D> grid, int nofSegments, PartLevel level);
-   bool getPartitionCondition(SPtr<Block3D> block, PartLevel level);
-   void distributePartitionData(SPtr<Grid3D> grid, PartLevel level);
-   void clear();
-   int getEdgeWeight(int dir);
-   int  nofSegments;
-   int numOfDirs;
-   std::vector<int> blockID;
-   std::vector<idx_t> parts;
-   SPtr<Communicator> comm;
-   int bundleRoot;
-   int processRoot;
-   int bundleID;
-   int processID;
-   int numberOfBundles;
-   int numberOfThreads;
-   bool threads;
-   GraphType graphType;
-   MetisPartitioner::PartType partType;
-   int numberOfProcesses;
-};
-
-#endif  //VF_MPI
-#endif 
+#ifndef MetisPartitioningGridVisitor_h 
+#define MetisPartitioningGridVisitor_h
+
+#if defined VF_METIS && defined VF_MPI
+
+#include <vector>
+#include <PointerDefinitions.h>
+
+#include "Grid3DVisitor.h"
+#include "MetisPartitioner.h"
+
+
+class Communicator;
+
+////////////////////////////////////////////////////////////////////////
+//! \brief The class implements domain decomposition with METIS library
+//! \author Kostyantyn Kucher
+//////////////////////////////////////////////////////////////////////////
+
+class Grid3D;
+class Block3D;
+
+class MetisPartitioningGridVisitor : public Grid3DVisitor
+{                                             
+public:
+   //! This describe different types of decomposition   
+   enum GraphType{LevelIntersected, LevelBased};
+
+public:
+   //! Constructor
+   //! \param comm - communicator
+   //! \param graphType - type of decomposition
+   //! \param numOfDirs - maximum number of neighbors for each process
+   //! \param threads - on/off decomposition for threads
+   //! \param numberOfThreads - number of threads
+   MetisPartitioningGridVisitor(SPtr<Communicator> comm, GraphType graphType, int numOfDirs, MetisPartitioner::PartType partType = MetisPartitioner::KWAY, bool threads = false, int numberOfThreads = 0);
+   virtual ~MetisPartitioningGridVisitor();
+   void visit(SPtr<Grid3D> grid) override;
+   void setNumberOfProcesses(int np);
+
+protected:
+   enum PartLevel {BUNDLE, PROCESS, THREAD};
+   void collectData(SPtr<Grid3D> grid, int nofSegments, PartLevel level);
+   void buildMetisGraphLevelIntersected(SPtr<Grid3D> grid, int nofSegments, PartLevel level);
+   void buildMetisGraphLevelBased(SPtr<Grid3D> grid, int nofSegments, PartLevel level);
+   bool getPartitionCondition(SPtr<Block3D> block, PartLevel level);
+   void distributePartitionData(SPtr<Grid3D> grid, PartLevel level);
+   void clear();
+   int getEdgeWeight(int dir);
+   int  nofSegments;
+   int numOfDirs;
+   std::vector<int> blockID;
+   std::vector<idx_t> parts;
+   SPtr<Communicator> comm;
+   int bundleRoot;
+   int processRoot;
+   int bundleID;
+   int processID;
+   int numberOfBundles;
+   int numberOfThreads;
+   bool threads;
+   GraphType graphType;
+   MetisPartitioner::PartType partType;
+   int numberOfProcesses;
+};
+
+#endif  //VF_MPI
+#endif 
diff --git a/src/cpu/VirtualFluidsCore/Visitors/OverlapBlockVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/OverlapBlockVisitor.cpp
index fd56849e01b66cbd03537cc97e9fa8bda1c5d15e..a8c619d198e9355bf945844ad118ea68d609c31e 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/OverlapBlockVisitor.cpp
+++ b/src/cpu/VirtualFluidsCore/Visitors/OverlapBlockVisitor.cpp
@@ -1,60 +1,60 @@
-#include "OverlapBlockVisitor.h"
-#include "Grid3DSystem.h"
-#include "Block3D.h"
-#include "Grid3D.h"
-
-OverlapBlockVisitor::OverlapBlockVisitor(int levelDepth/*shut be maxGridLevel*/, bool includeNotActiveBlocks)
-   :   Block3DVisitor(0, Grid3DSystem::MAXLEVEL)
-   , levelDepth(levelDepth)
-   , includeNotActiveBlocks(includeNotActiveBlocks)
-{
-}
-//////////////////////////////////////////////////////////////////////////
-void OverlapBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block)
-{
-   int ix1, ix2, ix3, level;
-   ix1 = block->getX1();
-   ix2 = block->getX2();
-   ix3 = block->getX3();
-   level = block->getLevel();
-
-   int nix1, nix2,nix3, nlev;
-   int neighix1, neighix2, neighix3, neighlev;
-   std::vector<SPtr<Block3D>> neighbors;
-   grid->getAllNeighbors(ix1, ix2, ix3, level, this->levelDepth, neighbors);
-   bool hasAdded = false;
-   for(size_t i=0; i<neighbors.size(); i++)
-   {
-      if(   ( neighbors[i]->isActive() || includeNotActiveBlocks )
-         && neighbors[i]->getLevel() > level) 
-      {
-         neighix1 = neighbors[i]->getX1();
-         neighix2 = neighbors[i]->getX2();
-         neighix3 = neighbors[i]->getX3();
-         neighlev = neighbors[i]->getLevel();
-         nix1 = neighix1>>1;
-         nix2 = neighix2>>1;
-         nix3 = neighix3>>1;
-         nlev = neighlev-1;
-
-         if(nlev != level) 
-         {
-            throw UbException(UB_EXARGS, "OverlapBlockVisitor::adaptBlock - leveldifferenz passt nicht, block: " + block->toString());
-         }
-
-         SPtr<Block3D> newBlock = grid->getBlock(nix1,nix2,nix3,nlev);
-         if(!newBlock)
-         {
-            newBlock = SPtr<Block3D>(new Block3D(nix1,nix2,nix3,nlev));
-            grid->addBlock(newBlock);
-            hasAdded=true;
-         }
-      }
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-std::string OverlapBlockVisitor::getSpecificDescription()
-{
-   std::string str("Overlap:");
-   return str;
-}
+#include "OverlapBlockVisitor.h"
+#include "Grid3DSystem.h"
+#include "Block3D.h"
+#include "Grid3D.h"
+
+OverlapBlockVisitor::OverlapBlockVisitor(int levelDepth/*shut be maxGridLevel*/, bool includeNotActiveBlocks)
+   :   Block3DVisitor(0, Grid3DSystem::MAXLEVEL)
+   , levelDepth(levelDepth)
+   , includeNotActiveBlocks(includeNotActiveBlocks)
+{
+}
+//////////////////////////////////////////////////////////////////////////
+void OverlapBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block)
+{
+   int ix1, ix2, ix3, level;
+   ix1 = block->getX1();
+   ix2 = block->getX2();
+   ix3 = block->getX3();
+   level = block->getLevel();
+
+   int nix1, nix2,nix3, nlev;
+   int neighix1, neighix2, neighix3, neighlev;
+   std::vector<SPtr<Block3D>> neighbors;
+   grid->getAllNeighbors(ix1, ix2, ix3, level, this->levelDepth, neighbors);
+   bool hasAdded = false;
+   for(size_t i=0; i<neighbors.size(); i++)
+   {
+      if(   ( neighbors[i]->isActive() || includeNotActiveBlocks )
+         && neighbors[i]->getLevel() > level) 
+      {
+         neighix1 = neighbors[i]->getX1();
+         neighix2 = neighbors[i]->getX2();
+         neighix3 = neighbors[i]->getX3();
+         neighlev = neighbors[i]->getLevel();
+         nix1 = neighix1>>1;
+         nix2 = neighix2>>1;
+         nix3 = neighix3>>1;
+         nlev = neighlev-1;
+
+         if(nlev != level) 
+         {
+            throw UbException(UB_EXARGS, "OverlapBlockVisitor::adaptBlock - leveldifferenz passt nicht, block: " + block->toString());
+         }
+
+         SPtr<Block3D> newBlock = grid->getBlock(nix1,nix2,nix3,nlev);
+         if(!newBlock)
+         {
+            newBlock = SPtr<Block3D>(new Block3D(nix1,nix2,nix3,nlev));
+            grid->addBlock(newBlock);
+            hasAdded=true;
+         }
+      }
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+std::string OverlapBlockVisitor::getSpecificDescription()
+{
+   std::string str("Overlap:");
+   return str;
+}
diff --git a/src/cpu/VirtualFluidsCore/Visitors/OverlapBlockVisitor.h b/src/cpu/VirtualFluidsCore/Visitors/OverlapBlockVisitor.h
index 454c4a86422832821dd0a740668d8332511ea64e..db25eaf71066b390f1779046237e99c7ce9b1cf9 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/OverlapBlockVisitor.h
+++ b/src/cpu/VirtualFluidsCore/Visitors/OverlapBlockVisitor.h
@@ -1,31 +1,31 @@
-#ifndef OverlapBlockVisitor_H
-#define OverlapBlockVisitor_H
-
-#include <string>
-#include <PointerDefinitions.h>
-
-#include "Block3DVisitor.h"
-
-class Grid3D;
-class Block3D;
-
-class OverlapBlockVisitor : public Block3DVisitor
-{
-public:
-   OverlapBlockVisitor(int levelDepth, bool includeNotActiveBlocks = true);
-   
-   virtual ~OverlapBlockVisitor(){}
-
-   bool isIterative()   { return false; }
-
-   std::string getSpecificDescription();
-
-   void visit(SPtr<Grid3D> grid, SPtr<Block3D> block) override;
-
-
-private:
-   int  levelDepth;
-   bool includeNotActiveBlocks;
-};
-
-#endif //OverlapBlockVisitor_H
+#ifndef OverlapBlockVisitor_H
+#define OverlapBlockVisitor_H
+
+#include <string>
+#include <PointerDefinitions.h>
+
+#include "Block3DVisitor.h"
+
+class Grid3D;
+class Block3D;
+
+class OverlapBlockVisitor : public Block3DVisitor
+{
+public:
+   OverlapBlockVisitor(int levelDepth, bool includeNotActiveBlocks = true);
+   
+   virtual ~OverlapBlockVisitor(){}
+
+   bool isIterative()   { return false; }
+
+   std::string getSpecificDescription();
+
+   void visit(SPtr<Grid3D> grid, SPtr<Block3D> block) override;
+
+
+private:
+   int  levelDepth;
+   bool includeNotActiveBlocks;
+};
+
+#endif //OverlapBlockVisitor_H
diff --git a/src/cpu/VirtualFluidsCore/Visitors/PQueuePartitioningGridVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/PQueuePartitioningGridVisitor.cpp
index fad451192c3c09f3194513cfcaf1c668f547c027..51fe5e8c8b117b7d198084e10b608136f2f9c1e8 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/PQueuePartitioningGridVisitor.cpp
+++ b/src/cpu/VirtualFluidsCore/Visitors/PQueuePartitioningGridVisitor.cpp
@@ -1,54 +1,54 @@
-#include "PQueuePartitioningGridVisitor.h"
-
-#include <vector>
-
-#include "PriorityQueueDecompositor.h"
-#include "Grid3D.h"
-#include "Block3D.h"
-#include "UbLogger.h"
-
-
-PQueuePartitioningGridVisitor::PQueuePartitioningGridVisitor(int numOfParts) : numOfParts(numOfParts)
-{
-
-}
-//////////////////////////////////////////////////////////////////////////
-void PQueuePartitioningGridVisitor::visit(SPtr<Grid3D> grid)
-{
-   UBLOG(logDEBUG5, "PQueuePartitioningGridVisitor::visit() - start");
-   std::vector<SPtr<Block3D>> blocks;
-   std::vector<int> weights;
-   std::vector< std::vector <SPtr<Block3D>> > parts;
-   int gridRank = grid->getRank();
-
-   int minInitLevel = grid->getCoarsestInitializedLevel();
-   int maxInitLevel = grid->getFinestInitializedLevel();
-
-   for(int level = minInitLevel; level<=maxInitLevel; level++)
-   {
-       std::vector<SPtr<Block3D>> blockVector;
-      grid->getBlocks(level, gridRank, true, blockVector);
-      for(SPtr<Block3D> block : blockVector)
-      {
-         if (block)
-         {
-            blocks.push_back(block);
-            weights.push_back(block->getNumberOfLocalConnectors()*(1<<block->getLevel()));
-         }
-      }
-   }
-   PriorityQueueDecompositor <SPtr<Block3D>> dec = PriorityQueueDecompositor <SPtr<Block3D>> (blocks, weights, numOfParts);
-   dec.getDecomposition(parts);
-
-   int i = 0;
-   for(std::vector<SPtr<Block3D>> p : parts)
-   {
-      for(SPtr<Block3D> block : p)
-      {
-         block->setPart(i);
-      }
-      i++;
-      
-   }
-   UBLOG(logDEBUG5, "PQueuePartitioningGridVisitor::visit() - end");
-}
+#include "PQueuePartitioningGridVisitor.h"
+
+#include <vector>
+
+#include "PriorityQueueDecompositor.h"
+#include "Grid3D.h"
+#include "Block3D.h"
+#include "UbLogger.h"
+
+
+PQueuePartitioningGridVisitor::PQueuePartitioningGridVisitor(int numOfParts) : numOfParts(numOfParts)
+{
+
+}
+//////////////////////////////////////////////////////////////////////////
+void PQueuePartitioningGridVisitor::visit(SPtr<Grid3D> grid)
+{
+   UBLOG(logDEBUG5, "PQueuePartitioningGridVisitor::visit() - start");
+   std::vector<SPtr<Block3D>> blocks;
+   std::vector<int> weights;
+   std::vector< std::vector <SPtr<Block3D>> > parts;
+   int gridRank = grid->getRank();
+
+   int minInitLevel = grid->getCoarsestInitializedLevel();
+   int maxInitLevel = grid->getFinestInitializedLevel();
+
+   for(int level = minInitLevel; level<=maxInitLevel; level++)
+   {
+       std::vector<SPtr<Block3D>> blockVector;
+      grid->getBlocks(level, gridRank, true, blockVector);
+      for(SPtr<Block3D> block : blockVector)
+      {
+         if (block)
+         {
+            blocks.push_back(block);
+            weights.push_back(block->getNumberOfLocalConnectors()*(1<<block->getLevel()));
+         }
+      }
+   }
+   PriorityQueueDecompositor <SPtr<Block3D>> dec = PriorityQueueDecompositor <SPtr<Block3D>> (blocks, weights, numOfParts);
+   dec.getDecomposition(parts);
+
+   int i = 0;
+   for(std::vector<SPtr<Block3D>> p : parts)
+   {
+      for(SPtr<Block3D> block : p)
+      {
+         block->setPart(i);
+      }
+      i++;
+      
+   }
+   UBLOG(logDEBUG5, "PQueuePartitioningGridVisitor::visit() - end");
+}
diff --git a/src/cpu/VirtualFluidsCore/Visitors/PQueuePartitioningGridVisitor.h b/src/cpu/VirtualFluidsCore/Visitors/PQueuePartitioningGridVisitor.h
index 952b70c970366ce88d2697e2be0c39d77ab2f7fb..d1fdbeda7ee59ae3c85cb5c428249f08edd31395 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/PQueuePartitioningGridVisitor.h
+++ b/src/cpu/VirtualFluidsCore/Visitors/PQueuePartitioningGridVisitor.h
@@ -1,27 +1,27 @@
-/**
-* @file PQueuePartitioningPatchVisitor.h
-* @brief Visitor class which apply Priority Queue for threads decomposition.
-* @author Kostyantyn Kucher
-* @date 06.06.2011
-*/
-#ifndef PQUEUEPARTITIONINGPATCHVISITOR_H 
-#define PQUEUEPARTITIONINGPATCHVISITOR_H
-
-#include <PointerDefinitions.h>
-
-#include "Grid3DVisitor.h"
-
-class Grid3D;
-
-class PQueuePartitioningGridVisitor : public Grid3DVisitor
-{
-public:
-   PQueuePartitioningGridVisitor(int numOfParts);
-
-   void visit(SPtr<Grid3D> grid) override;
-
-private:
-   int numOfParts;
-};
-
-#endif
+/**
+* @file PQueuePartitioningPatchVisitor.h
+* @brief Visitor class which apply Priority Queue for threads decomposition.
+* @author Kostyantyn Kucher
+* @date 06.06.2011
+*/
+#ifndef PQUEUEPARTITIONINGPATCHVISITOR_H 
+#define PQUEUEPARTITIONINGPATCHVISITOR_H
+
+#include <PointerDefinitions.h>
+
+#include "Grid3DVisitor.h"
+
+class Grid3D;
+
+class PQueuePartitioningGridVisitor : public Grid3DVisitor
+{
+public:
+   PQueuePartitioningGridVisitor(int numOfParts);
+
+   void visit(SPtr<Grid3D> grid) override;
+
+private:
+   int numOfParts;
+};
+
+#endif
diff --git a/src/cpu/VirtualFluidsCore/Visitors/RatioBlockVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/RatioBlockVisitor.cpp
index 787313eb78b4eab7e1141eeba164fcc050a16e94..9fd72e75b6f54e3e304bf7b5625c5e2277635415 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/RatioBlockVisitor.cpp
+++ b/src/cpu/VirtualFluidsCore/Visitors/RatioBlockVisitor.cpp
@@ -1,129 +1,129 @@
-#include "RatioBlockVisitor.h"
-#include "Grid3DSystem.h"
-#include "Grid3D.h"
-#include "Block3D.h"
-
-RatioBlockVisitor::RatioBlockVisitor(int levelDepth, bool includeNotActiveBlocks)
-   :   Block3DVisitor(0, Grid3DSystem::MAXLEVEL)
-   , maxLevelRatio(1)
-   , expandBlocks(true)
-   , levelDepth(levelDepth)
-   , includeNotActiveBlocks(includeNotActiveBlocks)
-{
-
-}
-//////////////////////////////////////////////////////////////////////////
-void RatioBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block)
-{
-   int ix1, ix2, ix3, level;
-   ix1 = block->getX1();
-   ix2 = block->getX2();
-   ix3 = block->getX3();
-   level = block->getLevel();
-
-   if( block->isActive()  || includeNotActiveBlocks )
-   {
-      if(this->expandBlocks)
-      {
-         if(this->lookForExpand(grid,ix1, ix2, ix3, level))
-         {
-            grid->expandBlock(ix1, ix2, ix3, level);
-         }
-      }
-      else
-      {
-         if(this->lookForCollapse(grid,ix1, ix2, ix3, level))
-         {
-            grid->collapseBlock(ix1, ix2, ix3, level, levelDepth);
-         }
-      }
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-bool RatioBlockVisitor::lookForExpand(SPtr<Grid3D> grid, const int& ix1, const int& ix2, const int& ix3, const int& level)
-{
-   std::vector<SPtr<Block3D>> neighbors;
-   grid->getAllNeighbors(ix1, ix2, ix3, level, this->levelDepth, neighbors);
-   for(size_t i=0; i<neighbors.size(); i++)
-   {
-      if(   ( neighbors[i]->isActive() || includeNotActiveBlocks )
-         && neighbors[i]->getLevel() > level+this->maxLevelRatio) 
-      {
-         return true;
-      }
-   }
-
-   return false;
-}
-//////////////////////////////////////////////////////////////////////////
-bool RatioBlockVisitor::lookForCollapse(SPtr<Grid3D> grid, const int& ix1, const int& ix2, const int& ix3, const int& level)
-{
-   std::vector<SPtr<Block3D>> neighbors;
-   grid->getAllNeighbors(ix1, ix2,ix3, level, this->levelDepth, neighbors);
-   for(size_t i=0; i<neighbors.size(); i++)
-   {     
-      if(    ( neighbors[i]->isActive() || includeNotActiveBlocks )
-         &&  neighbors[i]->getLevel() < level-this->maxLevelRatio) 
-      {
-         return true;
-      }
-   }
-
-   return false;
-}
-//////////////////////////////////////////////////////////////////////////
-void RatioBlockVisitor::setExpandByAdaptation(bool expandBlocks)
-{
-   if(this->expandBlocks != expandBlocks)
-   {
-      this->expandBlocks = expandBlocks;
-
-      int l1 = Block3DVisitor::getStartLevel();
-      int l2 = Block3DVisitor::getStopLevel();
-
-      if(expandBlocks) { if(l1 < l2) { Block3DVisitor::setStartLevel(l2); Block3DVisitor::setStopLevel(l1); } }
-      else             { if(l2 < l1) { Block3DVisitor::setStartLevel(l2); Block3DVisitor::setStopLevel(l1); } }
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-void RatioBlockVisitor::setLevelRatio(int ratio)
-{
-   if(ratio < 1) throw UbException(UB_EXARGS,"illegal ratio specified");
-   this->maxLevelRatio = ratio;
-}
-//////////////////////////////////////////////////////////////////////////
-std::string RatioBlockVisitor::getSpecificDescription()
-{
-   std::string str("Ratio:");
-   return str;
-}
-//////////////////////////////////////////////////////////////////////////
-int RatioBlockVisitor::getStartLevel()
-{
-   int l1 = Block3DVisitor::getStartLevel();
-   int l2 = Block3DVisitor::getStopLevel();
-
-   if(this->expandBlocks) { if(l2 < l1) return(l1); else return(l2); }
-   else                   { if(l2 < l1) return(l2); else return(l1); }
-}
-//////////////////////////////////////////////////////////////////////////
-int RatioBlockVisitor::getStopLevel()
-{
-   int l1 = Block3DVisitor::getStartLevel();
-   int l2 = Block3DVisitor::getStopLevel();
-
-   if(this->expandBlocks) { if(l2 < l1) return(l2); else return(l1); }
-   else                   { if(l2 < l1) return(l1); else return(l2); }
-}
-//////////////////////////////////////////////////////////////////////////
-void RatioBlockVisitor::setStartLevel(int level)
-{
-   if(this->expandBlocks) { if(level >= Block3DVisitor::getStopLevel()) Block3DVisitor::setStartLevel(level); }
-   else                   { if(level <= Block3DVisitor::getStopLevel()) Block3DVisitor::setStartLevel(level); }
-}
-//////////////////////////////////////////////////////////////////////////
-void RatioBlockVisitor::setStopLevel(int level)
-{
-   if(this->expandBlocks) { if(level <= Block3DVisitor::getStartLevel()) Block3DVisitor::setStopLevel(level); }
-   else                   { if(level >= Block3DVisitor::getStartLevel()) Block3DVisitor::setStopLevel(level); }
-}
+#include "RatioBlockVisitor.h"
+#include "Grid3DSystem.h"
+#include "Grid3D.h"
+#include "Block3D.h"
+
+RatioBlockVisitor::RatioBlockVisitor(int levelDepth, bool includeNotActiveBlocks)
+   :   Block3DVisitor(0, Grid3DSystem::MAXLEVEL)
+   , maxLevelRatio(1)
+   , expandBlocks(true)
+   , levelDepth(levelDepth)
+   , includeNotActiveBlocks(includeNotActiveBlocks)
+{
+
+}
+//////////////////////////////////////////////////////////////////////////
+void RatioBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block)
+{
+   int ix1, ix2, ix3, level;
+   ix1 = block->getX1();
+   ix2 = block->getX2();
+   ix3 = block->getX3();
+   level = block->getLevel();
+
+   if( block->isActive()  || includeNotActiveBlocks )
+   {
+      if(this->expandBlocks)
+      {
+         if(this->lookForExpand(grid,ix1, ix2, ix3, level))
+         {
+            grid->expandBlock(ix1, ix2, ix3, level);
+         }
+      }
+      else
+      {
+         if(this->lookForCollapse(grid,ix1, ix2, ix3, level))
+         {
+            grid->collapseBlock(ix1, ix2, ix3, level, levelDepth);
+         }
+      }
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+bool RatioBlockVisitor::lookForExpand(SPtr<Grid3D> grid, const int& ix1, const int& ix2, const int& ix3, const int& level)
+{
+   std::vector<SPtr<Block3D>> neighbors;
+   grid->getAllNeighbors(ix1, ix2, ix3, level, this->levelDepth, neighbors);
+   for(size_t i=0; i<neighbors.size(); i++)
+   {
+      if(   ( neighbors[i]->isActive() || includeNotActiveBlocks )
+         && neighbors[i]->getLevel() > level+this->maxLevelRatio) 
+      {
+         return true;
+      }
+   }
+
+   return false;
+}
+//////////////////////////////////////////////////////////////////////////
+bool RatioBlockVisitor::lookForCollapse(SPtr<Grid3D> grid, const int& ix1, const int& ix2, const int& ix3, const int& level)
+{
+   std::vector<SPtr<Block3D>> neighbors;
+   grid->getAllNeighbors(ix1, ix2,ix3, level, this->levelDepth, neighbors);
+   for(size_t i=0; i<neighbors.size(); i++)
+   {     
+      if(    ( neighbors[i]->isActive() || includeNotActiveBlocks )
+         &&  neighbors[i]->getLevel() < level-this->maxLevelRatio) 
+      {
+         return true;
+      }
+   }
+
+   return false;
+}
+//////////////////////////////////////////////////////////////////////////
+void RatioBlockVisitor::setExpandByAdaptation(bool expandBlocks)
+{
+   if(this->expandBlocks != expandBlocks)
+   {
+      this->expandBlocks = expandBlocks;
+
+      int l1 = Block3DVisitor::getStartLevel();
+      int l2 = Block3DVisitor::getStopLevel();
+
+      if(expandBlocks) { if(l1 < l2) { Block3DVisitor::setStartLevel(l2); Block3DVisitor::setStopLevel(l1); } }
+      else             { if(l2 < l1) { Block3DVisitor::setStartLevel(l2); Block3DVisitor::setStopLevel(l1); } }
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+void RatioBlockVisitor::setLevelRatio(int ratio)
+{
+   if(ratio < 1) throw UbException(UB_EXARGS,"illegal ratio specified");
+   this->maxLevelRatio = ratio;
+}
+//////////////////////////////////////////////////////////////////////////
+std::string RatioBlockVisitor::getSpecificDescription()
+{
+   std::string str("Ratio:");
+   return str;
+}
+//////////////////////////////////////////////////////////////////////////
+int RatioBlockVisitor::getStartLevel()
+{
+   int l1 = Block3DVisitor::getStartLevel();
+   int l2 = Block3DVisitor::getStopLevel();
+
+   if(this->expandBlocks) { if(l2 < l1) return(l1); else return(l2); }
+   else                   { if(l2 < l1) return(l2); else return(l1); }
+}
+//////////////////////////////////////////////////////////////////////////
+int RatioBlockVisitor::getStopLevel()
+{
+   int l1 = Block3DVisitor::getStartLevel();
+   int l2 = Block3DVisitor::getStopLevel();
+
+   if(this->expandBlocks) { if(l2 < l1) return(l2); else return(l1); }
+   else                   { if(l2 < l1) return(l1); else return(l2); }
+}
+//////////////////////////////////////////////////////////////////////////
+void RatioBlockVisitor::setStartLevel(int level)
+{
+   if(this->expandBlocks) { if(level >= Block3DVisitor::getStopLevel()) Block3DVisitor::setStartLevel(level); }
+   else                   { if(level <= Block3DVisitor::getStopLevel()) Block3DVisitor::setStartLevel(level); }
+}
+//////////////////////////////////////////////////////////////////////////
+void RatioBlockVisitor::setStopLevel(int level)
+{
+   if(this->expandBlocks) { if(level <= Block3DVisitor::getStartLevel()) Block3DVisitor::setStopLevel(level); }
+   else                   { if(level >= Block3DVisitor::getStartLevel()) Block3DVisitor::setStopLevel(level); }
+}
diff --git a/src/cpu/VirtualFluidsCore/Visitors/RatioBlockVisitor.h b/src/cpu/VirtualFluidsCore/Visitors/RatioBlockVisitor.h
index 26b2dabe82c4d48f5bbaba2587f4e77f2ec7f03c..8641087216fb418dd57e5e78e5171fee66340197 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/RatioBlockVisitor.h
+++ b/src/cpu/VirtualFluidsCore/Visitors/RatioBlockVisitor.h
@@ -1,49 +1,49 @@
-#ifndef RatioBlockVisitor_H
-#define RatioBlockVisitor_H
-
-#include <string>
-#include <PointerDefinitions.h>
-
-#include "Block3DVisitor.h"
-
-class Grid3D;
-class Block3D;
-
-class RatioBlockVisitor : public Block3DVisitor
-{
-public:
-   RatioBlockVisitor(int levelDepth, bool includeNotActiveBlocks = false);
-
-   virtual ~RatioBlockVisitor() {}
-
-   bool expandsByAdaptation() { return this->expandBlocks; }
-
-   void setExpandByAdaptation(bool expandBlocks);
-
-   int  getLevelRatio() { return this->maxLevelRatio; }
-   bool isIterative()   { return true;                }
-
-   void setLevelRatio(int ratio);
-
-   int  getStartLevel();
-   int  getStopLevel();
-
-   void setStartLevel(int level);
-   void setStopLevel(int level);
-
-   std::string getSpecificDescription();
-
-   void visit(SPtr<Grid3D> grid, SPtr<Block3D> block) override;
-
-protected:
-   bool lookForExpand(SPtr<Grid3D> grid, const int& ix1, const int& ix2, const int& ix3, const int& level);
-   bool lookForCollapse(SPtr<Grid3D> grid, const int& ix1, const int& ix2, const int& ix3, const int& level);
-
-private:
-   int  maxLevelRatio;
-   bool expandBlocks;
-   int  levelDepth;
-   bool includeNotActiveBlocks;
-};
-
-#endif
+#ifndef RatioBlockVisitor_H
+#define RatioBlockVisitor_H
+
+#include <string>
+#include <PointerDefinitions.h>
+
+#include "Block3DVisitor.h"
+
+class Grid3D;
+class Block3D;
+
+class RatioBlockVisitor : public Block3DVisitor
+{
+public:
+   RatioBlockVisitor(int levelDepth, bool includeNotActiveBlocks = false);
+
+   virtual ~RatioBlockVisitor() {}
+
+   bool expandsByAdaptation() { return this->expandBlocks; }
+
+   void setExpandByAdaptation(bool expandBlocks);
+
+   int  getLevelRatio() { return this->maxLevelRatio; }
+   bool isIterative()   { return true;                }
+
+   void setLevelRatio(int ratio);
+
+   int  getStartLevel();
+   int  getStopLevel();
+
+   void setStartLevel(int level);
+   void setStopLevel(int level);
+
+   std::string getSpecificDescription();
+
+   void visit(SPtr<Grid3D> grid, SPtr<Block3D> block) override;
+
+protected:
+   bool lookForExpand(SPtr<Grid3D> grid, const int& ix1, const int& ix2, const int& ix3, const int& level);
+   bool lookForCollapse(SPtr<Grid3D> grid, const int& ix1, const int& ix2, const int& ix3, const int& level);
+
+private:
+   int  maxLevelRatio;
+   bool expandBlocks;
+   int  levelDepth;
+   bool includeNotActiveBlocks;
+};
+
+#endif
diff --git a/src/cpu/VirtualFluidsCore/Visitors/RatioSmoothBlockVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/RatioSmoothBlockVisitor.cpp
index 462093f55f9f83601521f389ded0c8c4ee49c07c..b067fcad45a1ed1b231c4e7e7d97303172df376a 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/RatioSmoothBlockVisitor.cpp
+++ b/src/cpu/VirtualFluidsCore/Visitors/RatioSmoothBlockVisitor.cpp
@@ -1,145 +1,145 @@
-#include "RatioSmoothBlockVisitor.h"
-#include "Grid3DSystem.h"
-#include "Block3D.h"
-#include "Grid3D.h"
-
-RatioSmoothBlockVisitor::RatioSmoothBlockVisitor(int levelDepth, bool includeNotActiveBlocks)
-   :   Block3DVisitor(Grid3DSystem::MAXLEVEL, 0)
-   , maxLevelRatio(1)
-   , expandBlocks(true)
-   , levelDepth(levelDepth)
-   , includeNotActiveBlocks(includeNotActiveBlocks)
-{
-}
-//////////////////////////////////////////////////////////////////////////
-void RatioSmoothBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block)
-{
-   int ix1, ix2, ix3, level;
-   ix1 = block->getX1();
-   ix2 = block->getX2();
-   ix3 = block->getX3();
-   level = block->getLevel();
-
-   if( block->isActive()  || includeNotActiveBlocks )
-   {
-      if(this->expandBlocks)
-      {
-         if(this->lookForExpand(grid,ix1, ix2, ix3, level))
-         {
-            grid->expandBlock(ix1, ix2, ix3, level);
-         }
-      }
-      else
-      {
-         if(this->lookForCollapse(grid,ix1, ix2, ix3, level))
-         {
-            grid->collapseBlock(ix1, ix2, ix3, level, levelDepth);
-         }
-      }
-   }
-}
-
-//////////////////////////////////////////////////////////////////////////
-bool RatioSmoothBlockVisitor::lookForExpand(SPtr<Grid3D> grid, const int& ix1, const int& ix2, const int& ix3, const int& level)
-{
-   std::vector<SPtr<Block3D>> neighbors;
-   grid->getAllNeighbors(ix1, ix2, ix3, level, this->levelDepth, neighbors);
-   int nix1, nix2,nix3, nlev;
-   for(size_t i=0; i<neighbors.size(); i++)
-   {
-      if(   ( neighbors[i]->isActive() || includeNotActiveBlocks )
-         && neighbors[i]->getLevel() > level) 
-      {
-         nix1 = (neighbors)[i]->getX1();
-         nix2 = (neighbors)[i]->getX2();
-         nix3 = (neighbors)[i]->getX3();
-         nlev = (neighbors)[i]->getLevel();
-
-         std::vector<SPtr<Block3D>> neighbors1;
-         grid->getAllNeighbors(nix1, nix2, nix3, nlev, nlev+1, neighbors1);
-         for(size_t j=0; j<neighbors1.size(); j++)
-         {
-            if(   ( neighbors1[j]->isActive() || includeNotActiveBlocks )
-               && neighbors1[j]->getLevel() > level+this->maxLevelRatio) 
-            {
-               return true;
-            }
-         }
-      }
-   }
-   return false;
-}
-//////////////////////////////////////////////////////////////////////////
-bool RatioSmoothBlockVisitor::lookForCollapse(SPtr<Grid3D> grid, const int& ix1, const int& ix2, const int& ix3, const int& level)
-{
-   std::vector<SPtr<Block3D>> neighbors;
-   grid->getAllNeighbors(ix1, ix2,ix3, level, this->levelDepth, neighbors);
-   for(size_t i=0; i<neighbors.size(); i++)
-   {     
-      if(    ( neighbors[i]->isActive() || includeNotActiveBlocks )
-         &&  neighbors[i]->getLevel() < level-this->maxLevelRatio) 
-      {
-         throw UbException(UB_EXARGS," not implemented till now");
-         return true;
-      }
-   }
-
-   return false;
-}
-//////////////////////////////////////////////////////////////////////////
-void RatioSmoothBlockVisitor::setExpandByAdaptation(bool expandBlocks)
-{
-   if(this->expandBlocks != expandBlocks)
-   {
-      this->expandBlocks = expandBlocks;
-
-      int l1 = Block3DVisitor::getStartLevel();
-      int l2 = Block3DVisitor::getStopLevel();
-
-      if(expandBlocks) { if(l1 < l2) { Block3DVisitor::setStartLevel(l2); Block3DVisitor::setStopLevel(l1); } }
-      else             { if(l2 < l1) { Block3DVisitor::setStartLevel(l2); Block3DVisitor::setStopLevel(l1); } }
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-void RatioSmoothBlockVisitor::setLevelRatio(int ratio)
-{
-   if(ratio < 1) throw UbException(UB_EXARGS,"illegal ratio specified");
-   this->maxLevelRatio = ratio;
-}
-//////////////////////////////////////////////////////////////////////////
-std::string RatioSmoothBlockVisitor::getSpecificDescription()
-{
-   std::string str("Ratio:");
-   return str;
-}
-//////////////////////////////////////////////////////////////////////////
-int RatioSmoothBlockVisitor::getStartLevel()
-{
-   int l1 = Block3DVisitor::getStartLevel();
-   int l2 = Block3DVisitor::getStopLevel();
-
-   if(this->expandBlocks) { if(l2 < l1) return(l1); else return(l2); }
-   else                   { if(l2 < l1) return(l2); else return(l1); }
-}
-//////////////////////////////////////////////////////////////////////////
-int RatioSmoothBlockVisitor::getStopLevel()
-{
-   int l1 = Block3DVisitor::getStartLevel();
-   int l2 = Block3DVisitor::getStopLevel();
-
-   if(this->expandBlocks) { if(l2 < l1) return(l2); else return(l1); }
-   else                   { if(l2 < l1) return(l1); else return(l2); }
-}
-//////////////////////////////////////////////////////////////////////////
-void RatioSmoothBlockVisitor::setStartLevel(int level)
-{
-   if(this->expandBlocks) { if(level >= Block3DVisitor::getStopLevel()) Block3DVisitor::setStartLevel(level); }
-   else                   { if(level <= Block3DVisitor::getStopLevel()) Block3DVisitor::setStartLevel(level); }
-}
-//////////////////////////////////////////////////////////////////////////
-void RatioSmoothBlockVisitor::setStopLevel(int level)
-{
-   if(this->expandBlocks) { if(level <= Block3DVisitor::getStartLevel()) Block3DVisitor::setStopLevel(level); }
-   else                   { if(level >= Block3DVisitor::getStartLevel()) Block3DVisitor::setStopLevel(level); }
-}
-
+#include "RatioSmoothBlockVisitor.h"
+#include "Grid3DSystem.h"
+#include "Block3D.h"
+#include "Grid3D.h"
+
+RatioSmoothBlockVisitor::RatioSmoothBlockVisitor(int levelDepth, bool includeNotActiveBlocks)
+   :   Block3DVisitor(Grid3DSystem::MAXLEVEL, 0)
+   , maxLevelRatio(1)
+   , expandBlocks(true)
+   , levelDepth(levelDepth)
+   , includeNotActiveBlocks(includeNotActiveBlocks)
+{
+}
+//////////////////////////////////////////////////////////////////////////
+void RatioSmoothBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block)
+{
+   int ix1, ix2, ix3, level;
+   ix1 = block->getX1();
+   ix2 = block->getX2();
+   ix3 = block->getX3();
+   level = block->getLevel();
+
+   if( block->isActive()  || includeNotActiveBlocks )
+   {
+      if(this->expandBlocks)
+      {
+         if(this->lookForExpand(grid,ix1, ix2, ix3, level))
+         {
+            grid->expandBlock(ix1, ix2, ix3, level);
+         }
+      }
+      else
+      {
+         if(this->lookForCollapse(grid,ix1, ix2, ix3, level))
+         {
+            grid->collapseBlock(ix1, ix2, ix3, level, levelDepth);
+         }
+      }
+   }
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool RatioSmoothBlockVisitor::lookForExpand(SPtr<Grid3D> grid, const int& ix1, const int& ix2, const int& ix3, const int& level)
+{
+   std::vector<SPtr<Block3D>> neighbors;
+   grid->getAllNeighbors(ix1, ix2, ix3, level, this->levelDepth, neighbors);
+   int nix1, nix2,nix3, nlev;
+   for(size_t i=0; i<neighbors.size(); i++)
+   {
+      if(   ( neighbors[i]->isActive() || includeNotActiveBlocks )
+         && neighbors[i]->getLevel() > level) 
+      {
+         nix1 = (neighbors)[i]->getX1();
+         nix2 = (neighbors)[i]->getX2();
+         nix3 = (neighbors)[i]->getX3();
+         nlev = (neighbors)[i]->getLevel();
+
+         std::vector<SPtr<Block3D>> neighbors1;
+         grid->getAllNeighbors(nix1, nix2, nix3, nlev, nlev+1, neighbors1);
+         for(size_t j=0; j<neighbors1.size(); j++)
+         {
+            if(   ( neighbors1[j]->isActive() || includeNotActiveBlocks )
+               && neighbors1[j]->getLevel() > level+this->maxLevelRatio) 
+            {
+               return true;
+            }
+         }
+      }
+   }
+   return false;
+}
+//////////////////////////////////////////////////////////////////////////
+bool RatioSmoothBlockVisitor::lookForCollapse(SPtr<Grid3D> grid, const int& ix1, const int& ix2, const int& ix3, const int& level)
+{
+   std::vector<SPtr<Block3D>> neighbors;
+   grid->getAllNeighbors(ix1, ix2,ix3, level, this->levelDepth, neighbors);
+   for(size_t i=0; i<neighbors.size(); i++)
+   {     
+      if(    ( neighbors[i]->isActive() || includeNotActiveBlocks )
+         &&  neighbors[i]->getLevel() < level-this->maxLevelRatio) 
+      {
+         throw UbException(UB_EXARGS," not implemented till now");
+         return true;
+      }
+   }
+
+   return false;
+}
+//////////////////////////////////////////////////////////////////////////
+void RatioSmoothBlockVisitor::setExpandByAdaptation(bool expandBlocks)
+{
+   if(this->expandBlocks != expandBlocks)
+   {
+      this->expandBlocks = expandBlocks;
+
+      int l1 = Block3DVisitor::getStartLevel();
+      int l2 = Block3DVisitor::getStopLevel();
+
+      if(expandBlocks) { if(l1 < l2) { Block3DVisitor::setStartLevel(l2); Block3DVisitor::setStopLevel(l1); } }
+      else             { if(l2 < l1) { Block3DVisitor::setStartLevel(l2); Block3DVisitor::setStopLevel(l1); } }
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+void RatioSmoothBlockVisitor::setLevelRatio(int ratio)
+{
+   if(ratio < 1) throw UbException(UB_EXARGS,"illegal ratio specified");
+   this->maxLevelRatio = ratio;
+}
+//////////////////////////////////////////////////////////////////////////
+std::string RatioSmoothBlockVisitor::getSpecificDescription()
+{
+   std::string str("Ratio:");
+   return str;
+}
+//////////////////////////////////////////////////////////////////////////
+int RatioSmoothBlockVisitor::getStartLevel()
+{
+   int l1 = Block3DVisitor::getStartLevel();
+   int l2 = Block3DVisitor::getStopLevel();
+
+   if(this->expandBlocks) { if(l2 < l1) return(l1); else return(l2); }
+   else                   { if(l2 < l1) return(l2); else return(l1); }
+}
+//////////////////////////////////////////////////////////////////////////
+int RatioSmoothBlockVisitor::getStopLevel()
+{
+   int l1 = Block3DVisitor::getStartLevel();
+   int l2 = Block3DVisitor::getStopLevel();
+
+   if(this->expandBlocks) { if(l2 < l1) return(l2); else return(l1); }
+   else                   { if(l2 < l1) return(l1); else return(l2); }
+}
+//////////////////////////////////////////////////////////////////////////
+void RatioSmoothBlockVisitor::setStartLevel(int level)
+{
+   if(this->expandBlocks) { if(level >= Block3DVisitor::getStopLevel()) Block3DVisitor::setStartLevel(level); }
+   else                   { if(level <= Block3DVisitor::getStopLevel()) Block3DVisitor::setStartLevel(level); }
+}
+//////////////////////////////////////////////////////////////////////////
+void RatioSmoothBlockVisitor::setStopLevel(int level)
+{
+   if(this->expandBlocks) { if(level <= Block3DVisitor::getStartLevel()) Block3DVisitor::setStopLevel(level); }
+   else                   { if(level >= Block3DVisitor::getStartLevel()) Block3DVisitor::setStopLevel(level); }
+}
+
diff --git a/src/cpu/VirtualFluidsCore/Visitors/RatioSmoothBlockVisitor.h b/src/cpu/VirtualFluidsCore/Visitors/RatioSmoothBlockVisitor.h
index ab49d2dd4fedd23a4394d7ca50357a931de666a6..25715682d690e06e7bbd0b8db7c1c8174de1f9b9 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/RatioSmoothBlockVisitor.h
+++ b/src/cpu/VirtualFluidsCore/Visitors/RatioSmoothBlockVisitor.h
@@ -1,49 +1,49 @@
-#ifndef RatioSmoothBlockVisitor_H
-#define RatioSmoothBlockVisitor_H
-
-#include <string>
-
-#include "Block3DVisitor.h"
-
-class Grid3D;
-class Block3D;
-
-class RatioSmoothBlockVisitor : public Block3DVisitor
-{
-public:
-   RatioSmoothBlockVisitor(int levelDepth, bool includeNotActiveBlocks = false);
-
-   virtual ~RatioSmoothBlockVisitor() {}
-
-   bool expandsByAdaptation() { return this->expandBlocks; }
-
-   void setExpandByAdaptation(bool expandBlocks);
-
-   int  getLevelRatio() { return this->maxLevelRatio; }
-   bool isIterative()   { return true;                }
-
-   void setLevelRatio(int ratio);
-
-   int  getStartLevel();
-   int  getStopLevel();
-
-   void setStartLevel(int level);
-   void setStopLevel(int level);
-
-   std::string getSpecificDescription();
-
-   void visit(SPtr<Grid3D> grid, SPtr<Block3D> block) override;
-
-protected:
-   bool lookForExpand(SPtr<Grid3D> grid, const int& ix1, const int& ix2, const int& ix3, const int& level);
-   bool lookForCollapse(SPtr<Grid3D> grid, const int& ix1, const int& ix2, const int& ix3, const int& level);
-
-private:
-   int  maxLevelRatio;
-   bool expandBlocks;
-   int  levelDepth;
-   bool includeNotActiveBlocks;
-
-};
-
-#endif //RatioSmoothBlockVisitor_H
+#ifndef RatioSmoothBlockVisitor_H
+#define RatioSmoothBlockVisitor_H
+
+#include <string>
+
+#include "Block3DVisitor.h"
+
+class Grid3D;
+class Block3D;
+
+class RatioSmoothBlockVisitor : public Block3DVisitor
+{
+public:
+   RatioSmoothBlockVisitor(int levelDepth, bool includeNotActiveBlocks = false);
+
+   virtual ~RatioSmoothBlockVisitor() {}
+
+   bool expandsByAdaptation() { return this->expandBlocks; }
+
+   void setExpandByAdaptation(bool expandBlocks);
+
+   int  getLevelRatio() { return this->maxLevelRatio; }
+   bool isIterative()   { return true;                }
+
+   void setLevelRatio(int ratio);
+
+   int  getStartLevel();
+   int  getStopLevel();
+
+   void setStartLevel(int level);
+   void setStopLevel(int level);
+
+   std::string getSpecificDescription();
+
+   void visit(SPtr<Grid3D> grid, SPtr<Block3D> block) override;
+
+protected:
+   bool lookForExpand(SPtr<Grid3D> grid, const int& ix1, const int& ix2, const int& ix3, const int& level);
+   bool lookForCollapse(SPtr<Grid3D> grid, const int& ix1, const int& ix2, const int& ix3, const int& level);
+
+private:
+   int  maxLevelRatio;
+   bool expandBlocks;
+   int  levelDepth;
+   bool includeNotActiveBlocks;
+
+};
+
+#endif //RatioSmoothBlockVisitor_H
diff --git a/src/cpu/VirtualFluidsCore/Visitors/RefineAroundGbObjectHelper.cpp b/src/cpu/VirtualFluidsCore/Visitors/RefineAroundGbObjectHelper.cpp
index 133e3f3d1cd5adc5afcb476004e28f6dd223a061..def2a0e11e73569200e80fa4260b2fc9a251d48a 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/RefineAroundGbObjectHelper.cpp
+++ b/src/cpu/VirtualFluidsCore/Visitors/RefineAroundGbObjectHelper.cpp
@@ -1,55 +1,55 @@
-#include "RefineAroundGbObjectHelper.h"
-#include "RatioBlockVisitor.h"
-#include "RatioSmoothBlockVisitor.h"
-#include "OverlapBlockVisitor.h"
-#include "SetInterpolationDirsBlockVisitor.h"
-#include <D3Q27System.h>
-#include <Grid3D.h>
-#include <D3Q27TriFaceMeshInteractor.h>
-#include "Communicator.h"
-
-RefineAroundGbObjectHelper::RefineAroundGbObjectHelper(SPtr<Grid3D> grid, int refineLevel, SPtr<D3Q27TriFaceMeshInteractor> objectIter, double startDistance, double stopDistance, SPtr<Communicator> comm) :
-   grid(grid),
-   refineLevel(refineLevel),
-   objectIter(objectIter),
-   startDistance(startDistance), 
-   stopDistance(stopDistance),
-   comm(comm)
-{
-}
-//////////////////////////////////////////////////////////////////////////
-RefineAroundGbObjectHelper::~RefineAroundGbObjectHelper(void)
-{
-}
-//////////////////////////////////////////////////////////////////////////
-void RefineAroundGbObjectHelper::refine()
-{
-   UBLOG(logDEBUG5,"RefineCrossAndInsideGbObjectHelper: refine - start");	
-
-   int rank = grid->getRank();
-   grid->setRank(0);
-
-   objectIter->refineBlockGridToLevel(refineLevel, startDistance, stopDistance);
-
-   RatioBlockVisitor ratioVisitor(refineLevel);
-   grid->accept(ratioVisitor);
-
-   RatioSmoothBlockVisitor ratioSmoothVisitor(refineLevel);
-   grid->accept(ratioSmoothVisitor);
-
-   OverlapBlockVisitor overlapVisitor(refineLevel, false);
-   grid->accept(overlapVisitor);
-
-   std::vector<int> dirs;
-   for (int i=D3Q27System::E; i<=D3Q27System::TS; i++)
-   {
-      dirs.push_back(i);
-   }
-   SetInterpolationDirsBlockVisitor interDirsVisitor(dirs);
-   grid->accept(interDirsVisitor);
-
-   grid->setRank(rank);
-
-   UBLOG(logDEBUG5,"RefineCrossAndInsideGbObjectHelper: refine - end");	
-}
-
+#include "RefineAroundGbObjectHelper.h"
+#include "RatioBlockVisitor.h"
+#include "RatioSmoothBlockVisitor.h"
+#include "OverlapBlockVisitor.h"
+#include "SetInterpolationDirsBlockVisitor.h"
+#include <D3Q27System.h>
+#include <Grid3D.h>
+#include <D3Q27TriFaceMeshInteractor.h>
+#include "Communicator.h"
+
+RefineAroundGbObjectHelper::RefineAroundGbObjectHelper(SPtr<Grid3D> grid, int refineLevel, SPtr<D3Q27TriFaceMeshInteractor> objectIter, double startDistance, double stopDistance, SPtr<Communicator> comm) :
+   grid(grid),
+   refineLevel(refineLevel),
+   objectIter(objectIter),
+   startDistance(startDistance), 
+   stopDistance(stopDistance),
+   comm(comm)
+{
+}
+//////////////////////////////////////////////////////////////////////////
+RefineAroundGbObjectHelper::~RefineAroundGbObjectHelper(void)
+{
+}
+//////////////////////////////////////////////////////////////////////////
+void RefineAroundGbObjectHelper::refine()
+{
+   UBLOG(logDEBUG5,"RefineCrossAndInsideGbObjectHelper: refine - start");	
+
+   int rank = grid->getRank();
+   grid->setRank(0);
+
+   objectIter->refineBlockGridToLevel(refineLevel, startDistance, stopDistance);
+
+   RatioBlockVisitor ratioVisitor(refineLevel);
+   grid->accept(ratioVisitor);
+
+   RatioSmoothBlockVisitor ratioSmoothVisitor(refineLevel);
+   grid->accept(ratioSmoothVisitor);
+
+   OverlapBlockVisitor overlapVisitor(refineLevel, false);
+   grid->accept(overlapVisitor);
+
+   std::vector<int> dirs;
+   for (int i=D3Q27System::E; i<=D3Q27System::TS; i++)
+   {
+      dirs.push_back(i);
+   }
+   SetInterpolationDirsBlockVisitor interDirsVisitor(dirs);
+   grid->accept(interDirsVisitor);
+
+   grid->setRank(rank);
+
+   UBLOG(logDEBUG5,"RefineCrossAndInsideGbObjectHelper: refine - end");	
+}
+
diff --git a/src/cpu/VirtualFluidsCore/Visitors/RefineAroundGbObjectHelper.h b/src/cpu/VirtualFluidsCore/Visitors/RefineAroundGbObjectHelper.h
index a4108b06d777e04e47186d4a8ed84e02dcde3ac2..3c21476a8fff8aff87d75e721d0e60fad882221c 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/RefineAroundGbObjectHelper.h
+++ b/src/cpu/VirtualFluidsCore/Visitors/RefineAroundGbObjectHelper.h
@@ -1,34 +1,34 @@
-#ifndef RefineAroundGbObjectHelper_H
-#define RefineAroundGbObjectHelper_H
-
-#include <PointerDefinitions.h>
-
-class Grid3D;
-class Communicator;
-class D3Q27TriFaceMeshInteractor;
-
-//! \brief Refine blocks on base of bounding boxes.
-//! \details You need to use <i>addGbObject()</i> to add corresponding bounding boxes. Then call <i>refine()</i>.
-//! \author K. Kucher
-class RefineAroundGbObjectHelper
-{
-public:
-   //! Constructor
-   //! \param grid a smart pointer to the grid object
-   //! \param maxRefineLevel an integer for maximal refinement level
-   //! \param objectIter a D3Q27TriFaceMeshInteractor object - represent geometry which should be refinement
-   //! \param startDistance start distance from geometry for refinement
-   //! \param stopDistance stop distance from geometry for refinement
-   RefineAroundGbObjectHelper(SPtr<Grid3D> grid, int maxRefineLevel, SPtr<D3Q27TriFaceMeshInteractor> objectIter, double startDistance, double stopDistance, SPtr<Communicator> comm);
-   virtual ~RefineAroundGbObjectHelper(void);
-   //! start refinement
-   void refine();
-private:
-    SPtr<Grid3D> grid;
-    SPtr<D3Q27TriFaceMeshInteractor> objectIter;
-   int refineLevel;
-   double startDistance, stopDistance;
-   SPtr<Communicator> comm;
-};
-
-#endif 
+#ifndef RefineAroundGbObjectHelper_H
+#define RefineAroundGbObjectHelper_H
+
+#include <PointerDefinitions.h>
+
+class Grid3D;
+class Communicator;
+class D3Q27TriFaceMeshInteractor;
+
+//! \brief Refine blocks on base of bounding boxes.
+//! \details You need to use <i>addGbObject()</i> to add corresponding bounding boxes. Then call <i>refine()</i>.
+//! \author K. Kucher
+class RefineAroundGbObjectHelper
+{
+public:
+   //! Constructor
+   //! \param grid a smart pointer to the grid object
+   //! \param maxRefineLevel an integer for maximal refinement level
+   //! \param objectIter a D3Q27TriFaceMeshInteractor object - represent geometry which should be refinement
+   //! \param startDistance start distance from geometry for refinement
+   //! \param stopDistance stop distance from geometry for refinement
+   RefineAroundGbObjectHelper(SPtr<Grid3D> grid, int maxRefineLevel, SPtr<D3Q27TriFaceMeshInteractor> objectIter, double startDistance, double stopDistance, SPtr<Communicator> comm);
+   virtual ~RefineAroundGbObjectHelper(void);
+   //! start refinement
+   void refine();
+private:
+    SPtr<Grid3D> grid;
+    SPtr<D3Q27TriFaceMeshInteractor> objectIter;
+   int refineLevel;
+   double startDistance, stopDistance;
+   SPtr<Communicator> comm;
+};
+
+#endif 
diff --git a/src/cpu/VirtualFluidsCore/Visitors/RefineCrossAndInsideGbObjectBlockVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/RefineCrossAndInsideGbObjectBlockVisitor.cpp
index ef6052170479d50813e5d5f059e2badf343dc6c2..0eaf38e90fd99e2d785319f95eeb5758a31e1b82 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/RefineCrossAndInsideGbObjectBlockVisitor.cpp
+++ b/src/cpu/VirtualFluidsCore/Visitors/RefineCrossAndInsideGbObjectBlockVisitor.cpp
@@ -1,43 +1,43 @@
-#include "RefineCrossAndInsideGbObjectBlockVisitor.h"
-
-#include <geometry3d/GbObject3D.h>
-#include "Grid3D.h"
-#include "Block3D.h"
-
-
-RefineCrossAndInsideGbObjectBlockVisitor::RefineCrossAndInsideGbObjectBlockVisitor()
-:  Block3DVisitor() , notActive(true)
-{
-}
-//////////////////////////////////////////////////////////////////////////
-RefineCrossAndInsideGbObjectBlockVisitor::RefineCrossAndInsideGbObjectBlockVisitor(SPtr<GbObject3D> geoObject, int refineLevel)
-   : Block3DVisitor(0,refineLevel-1), geoObject(geoObject), notActive(true)
-{
-
-}
-//////////////////////////////////////////////////////////////////////////
-RefineCrossAndInsideGbObjectBlockVisitor::~RefineCrossAndInsideGbObjectBlockVisitor()
-{
-}
-//////////////////////////////////////////////////////////////////////////
-void RefineCrossAndInsideGbObjectBlockVisitor::visit(const SPtr<Grid3D> grid, SPtr<Block3D> block)
-{
-   int level = block->getLevel();
-   if( notActive && block->isNotActive() ) return;
-   if( level > this->getStopLevel() ) return;
-
-   UbTupleDouble3 coords = grid->getBlockWorldCoordinates(block);
-   UbTupleDouble3 deltas = grid->getBlockLengths(block);
-   if(geoObject->isCellInsideOrCuttingGbObject3D(  val<1>(coords) 
-      , val<2>(coords)
-      , val<3>(coords)
-      , val<1>(coords)+val<1>(deltas)
-      , val<2>(coords)+val<2>(deltas)
-      , val<3>(coords)+val<3>(deltas)) ) 
-   {
-      grid->expandBlock(block->getX1(),block->getX2(),block->getX3(),level); 
-   } 
-
-   return;
-}
-//////////////////////////////////////////////////////////////////////////
+#include "RefineCrossAndInsideGbObjectBlockVisitor.h"
+
+#include <geometry3d/GbObject3D.h>
+#include "Grid3D.h"
+#include "Block3D.h"
+
+
+RefineCrossAndInsideGbObjectBlockVisitor::RefineCrossAndInsideGbObjectBlockVisitor()
+:  Block3DVisitor() , notActive(true)
+{
+}
+//////////////////////////////////////////////////////////////////////////
+RefineCrossAndInsideGbObjectBlockVisitor::RefineCrossAndInsideGbObjectBlockVisitor(SPtr<GbObject3D> geoObject, int refineLevel)
+   : Block3DVisitor(0,refineLevel-1), geoObject(geoObject), notActive(true)
+{
+
+}
+//////////////////////////////////////////////////////////////////////////
+RefineCrossAndInsideGbObjectBlockVisitor::~RefineCrossAndInsideGbObjectBlockVisitor()
+{
+}
+//////////////////////////////////////////////////////////////////////////
+void RefineCrossAndInsideGbObjectBlockVisitor::visit(const SPtr<Grid3D> grid, SPtr<Block3D> block)
+{
+   int level = block->getLevel();
+   if( notActive && block->isNotActive() ) return;
+   if( level > this->getStopLevel() ) return;
+
+   UbTupleDouble3 coords = grid->getBlockWorldCoordinates(block);
+   UbTupleDouble3 deltas = grid->getBlockLengths(block);
+   if(geoObject->isCellInsideOrCuttingGbObject3D(  val<1>(coords) 
+      , val<2>(coords)
+      , val<3>(coords)
+      , val<1>(coords)+val<1>(deltas)
+      , val<2>(coords)+val<2>(deltas)
+      , val<3>(coords)+val<3>(deltas)) ) 
+   {
+      grid->expandBlock(block->getX1(),block->getX2(),block->getX3(),level); 
+   } 
+
+   return;
+}
+//////////////////////////////////////////////////////////////////////////
diff --git a/src/cpu/VirtualFluidsCore/Visitors/RefineCrossAndInsideGbObjectBlockVisitor.h b/src/cpu/VirtualFluidsCore/Visitors/RefineCrossAndInsideGbObjectBlockVisitor.h
index 0aa4f5b57d6720dcd30a61e877824a6d0f9a4310..6149eda041efe55d1f390f6eb9e592bc1a22558a 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/RefineCrossAndInsideGbObjectBlockVisitor.h
+++ b/src/cpu/VirtualFluidsCore/Visitors/RefineCrossAndInsideGbObjectBlockVisitor.h
@@ -1,33 +1,33 @@
-#ifndef RefineCrossAndInsideGbObjectBlockVisitor_H
-#define RefineCrossAndInsideGbObjectBlockVisitor_H
-
-#include <vector>
-#include <PointerDefinitions.h>
-
-#include "Block3DVisitor.h"
-
-class Grid3D;
-class Block3D;
-class GbObject3D;
-
-//! \brief Refine blocks on base of bounding box which is defined with <i>geoObject</i>
-//! \details The class uses a geometry object for define a bounding box. Inside and across this bounding box will be grid on block basis refinement.
-//! \author K. Kucher
-class RefineCrossAndInsideGbObjectBlockVisitor : public Block3DVisitor
-{
-public:
-   //! A default constructor
-   RefineCrossAndInsideGbObjectBlockVisitor();
-   //! A constructor
-   //! \param geoObject a smart pointer to bounding box
-   //! \param refineLevel an integer for refine on this level
-   RefineCrossAndInsideGbObjectBlockVisitor(SPtr<GbObject3D> geoObject, int refineLevel);
-   virtual ~RefineCrossAndInsideGbObjectBlockVisitor();
-
-   void visit(SPtr<Grid3D> grid, SPtr<Block3D> block) override;
-protected:
-    SPtr<GbObject3D> geoObject;
-   bool notActive;
-};
-
-#endif 
+#ifndef RefineCrossAndInsideGbObjectBlockVisitor_H
+#define RefineCrossAndInsideGbObjectBlockVisitor_H
+
+#include <vector>
+#include <PointerDefinitions.h>
+
+#include "Block3DVisitor.h"
+
+class Grid3D;
+class Block3D;
+class GbObject3D;
+
+//! \brief Refine blocks on base of bounding box which is defined with <i>geoObject</i>
+//! \details The class uses a geometry object for define a bounding box. Inside and across this bounding box will be grid on block basis refinement.
+//! \author K. Kucher
+class RefineCrossAndInsideGbObjectBlockVisitor : public Block3DVisitor
+{
+public:
+   //! A default constructor
+   RefineCrossAndInsideGbObjectBlockVisitor();
+   //! A constructor
+   //! \param geoObject a smart pointer to bounding box
+   //! \param refineLevel an integer for refine on this level
+   RefineCrossAndInsideGbObjectBlockVisitor(SPtr<GbObject3D> geoObject, int refineLevel);
+   virtual ~RefineCrossAndInsideGbObjectBlockVisitor();
+
+   void visit(SPtr<Grid3D> grid, SPtr<Block3D> block) override;
+protected:
+    SPtr<GbObject3D> geoObject;
+   bool notActive;
+};
+
+#endif 
diff --git a/src/cpu/VirtualFluidsCore/Visitors/RefineCrossAndInsideGbObjectHelper.cpp b/src/cpu/VirtualFluidsCore/Visitors/RefineCrossAndInsideGbObjectHelper.cpp
index c0fc7e36945299cb5cc88f3ea63d035f83c791f3..cff9fbfaf372d0ecb95da2b791c7d096001addce 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/RefineCrossAndInsideGbObjectHelper.cpp
+++ b/src/cpu/VirtualFluidsCore/Visitors/RefineCrossAndInsideGbObjectHelper.cpp
@@ -1,78 +1,78 @@
-#include "RefineCrossAndInsideGbObjectHelper.h"
-#include "RefineCrossAndInsideGbObjectBlockVisitor.h"
-#include "RatioBlockVisitor.h"
-#include "RatioSmoothBlockVisitor.h"
-#include "CheckRatioBlockVisitor.h"
-#include "OverlapBlockVisitor.h"
-#include "SetInterpolationDirsBlockVisitor.h"
-#include <D3Q27System.h>
-#include "Communicator.h"
-#include <Grid3D.h>
-#include <GbObject3D.h>
-
-
-RefineCrossAndInsideGbObjectHelper::RefineCrossAndInsideGbObjectHelper(SPtr<Grid3D> grid, int maxRefineLevel, SPtr<Communicator> comm) :
-                                    grid(grid),
-                                    maxRefineLevel(maxRefineLevel),
-                                    comm(comm)
-{
-}
-//////////////////////////////////////////////////////////////////////////
-RefineCrossAndInsideGbObjectHelper::~RefineCrossAndInsideGbObjectHelper(void)
-{
-}
-//////////////////////////////////////////////////////////////////////////
-void RefineCrossAndInsideGbObjectHelper::refine()
-{
-   UBLOG(logDEBUG5,"RefineCrossAndInsideGbObjectHelper: refine - start");	
-   
-   if (comm->isRoot())
-   {
-      int size = (int)objects.size();
-
-      for (int i = 0; i<size; i++)
-      {
-         RefineCrossAndInsideGbObjectBlockVisitor refVisitor(objects[i], levels[i]);
-         grid->accept(refVisitor);
-      }
-
-      //RatioBlockVisitor ratioVisitor(maxRefineLevel);
-      //grid->accept(ratioVisitor);
-
-      //RatioSmoothBlockVisitor ratioSmoothVisitor(maxRefineLevel);
-      //grid->accept(ratioSmoothVisitor);
-
-      RatioBlockVisitor ratioVisitor(maxRefineLevel);
-      CheckRatioBlockVisitor checkRatio(maxRefineLevel);
-      int count = 0;
-
-      do {
-         grid->accept(ratioVisitor);
-         checkRatio.resetState();
-         grid->accept(checkRatio);
-         UBLOG(logINFO, "count = "<<count++<<" state = "<<checkRatio.getState());
-      } while (!checkRatio.getState());
-
-
-      OverlapBlockVisitor overlapVisitor(maxRefineLevel, false);
-      grid->accept(overlapVisitor);
-   }
-
-   grid->updateDistributedBlocks(comm);
-
-   std::vector<int> dirs;
-
-   for (int i=D3Q27System::E; i<D3Q27System::ENDDIR; i++)
-   {
-      dirs.push_back(i);
-   }
-   SetInterpolationDirsBlockVisitor interDirsVisitor(dirs);
-   grid->accept(interDirsVisitor);
-   UBLOG(logDEBUG5,"RefineCrossAndInsideGbObjectHelper: refine - end");	
-}
-//////////////////////////////////////////////////////////////////////////
-void RefineCrossAndInsideGbObjectHelper::addGbObject( SPtr<GbObject3D> object, int refineLevel )
-{
-   objects.push_back(object);
-   levels.push_back(refineLevel);
-}
+#include "RefineCrossAndInsideGbObjectHelper.h"
+#include "RefineCrossAndInsideGbObjectBlockVisitor.h"
+#include "RatioBlockVisitor.h"
+#include "RatioSmoothBlockVisitor.h"
+#include "CheckRatioBlockVisitor.h"
+#include "OverlapBlockVisitor.h"
+#include "SetInterpolationDirsBlockVisitor.h"
+#include <D3Q27System.h>
+#include "Communicator.h"
+#include <Grid3D.h>
+#include <GbObject3D.h>
+
+
+RefineCrossAndInsideGbObjectHelper::RefineCrossAndInsideGbObjectHelper(SPtr<Grid3D> grid, int maxRefineLevel, SPtr<Communicator> comm) :
+                                    grid(grid),
+                                    maxRefineLevel(maxRefineLevel),
+                                    comm(comm)
+{
+}
+//////////////////////////////////////////////////////////////////////////
+RefineCrossAndInsideGbObjectHelper::~RefineCrossAndInsideGbObjectHelper(void)
+{
+}
+//////////////////////////////////////////////////////////////////////////
+void RefineCrossAndInsideGbObjectHelper::refine()
+{
+   UBLOG(logDEBUG5,"RefineCrossAndInsideGbObjectHelper: refine - start");	
+   
+   if (comm->isRoot())
+   {
+      int size = (int)objects.size();
+
+      for (int i = 0; i<size; i++)
+      {
+         RefineCrossAndInsideGbObjectBlockVisitor refVisitor(objects[i], levels[i]);
+         grid->accept(refVisitor);
+      }
+
+      //RatioBlockVisitor ratioVisitor(maxRefineLevel);
+      //grid->accept(ratioVisitor);
+
+      //RatioSmoothBlockVisitor ratioSmoothVisitor(maxRefineLevel);
+      //grid->accept(ratioSmoothVisitor);
+
+      RatioBlockVisitor ratioVisitor(maxRefineLevel);
+      CheckRatioBlockVisitor checkRatio(maxRefineLevel);
+      int count = 0;
+
+      do {
+         grid->accept(ratioVisitor);
+         checkRatio.resetState();
+         grid->accept(checkRatio);
+         UBLOG(logINFO, "count = "<<count++<<" state = "<<checkRatio.getState());
+      } while (!checkRatio.getState());
+
+
+      OverlapBlockVisitor overlapVisitor(maxRefineLevel, false);
+      grid->accept(overlapVisitor);
+   }
+
+   grid->updateDistributedBlocks(comm);
+
+   std::vector<int> dirs;
+
+   for (int i=D3Q27System::E; i<D3Q27System::ENDDIR; i++)
+   {
+      dirs.push_back(i);
+   }
+   SetInterpolationDirsBlockVisitor interDirsVisitor(dirs);
+   grid->accept(interDirsVisitor);
+   UBLOG(logDEBUG5,"RefineCrossAndInsideGbObjectHelper: refine - end");	
+}
+//////////////////////////////////////////////////////////////////////////
+void RefineCrossAndInsideGbObjectHelper::addGbObject( SPtr<GbObject3D> object, int refineLevel )
+{
+   objects.push_back(object);
+   levels.push_back(refineLevel);
+}
diff --git a/src/cpu/VirtualFluidsCore/Visitors/RefineCrossAndInsideGbObjectHelper.h b/src/cpu/VirtualFluidsCore/Visitors/RefineCrossAndInsideGbObjectHelper.h
index 4d67c18242c16f7fda7e42d41cbd5daaa575994e..c7ea0b3bd7fbec86437077b8ad6b206b3305f3af 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/RefineCrossAndInsideGbObjectHelper.h
+++ b/src/cpu/VirtualFluidsCore/Visitors/RefineCrossAndInsideGbObjectHelper.h
@@ -1,36 +1,36 @@
-#ifndef RefineCrossAndInsideGbObjectHelper_H
-#define RefineCrossAndInsideGbObjectHelper_H
-
-#include <vector>
-#include <PointerDefinitions.h>
-
-class Communicator;
-class Grid3D;
-class GbObject3D;
-
-//! \brief Refine blocks on base of bounding boxes.
-//! \details You need to use <i>addGbObject()</i> to add corresponding bounding boxes. Then call <i>refine()</i>.
-//! \author K. Kucher
-class RefineCrossAndInsideGbObjectHelper
-{
-public:
-   //! Constructor
-   //! \param grid a smart pointer to the grid object
-   //! \param maxRefineLevel an integer for maximal refinement level
-   RefineCrossAndInsideGbObjectHelper(SPtr<Grid3D> grid, int maxRefineLevel, SPtr<Communicator> comm);
-   virtual ~RefineCrossAndInsideGbObjectHelper();
-   //! add geometric object
-   //! \param object a smart pointer to bounding box
-   //! \param refineLevel a value of refinement level for corresponding bounding box
-   void addGbObject(SPtr<GbObject3D> object, int refineLevel);
-   //! start refinement
-   void refine();
-private:
-    SPtr<Grid3D> grid;
-   std::vector<SPtr<GbObject3D> > objects;
-   std::vector<int> levels;
-   int maxRefineLevel;
-   SPtr<Communicator> comm;
-};
-
-#endif 
+#ifndef RefineCrossAndInsideGbObjectHelper_H
+#define RefineCrossAndInsideGbObjectHelper_H
+
+#include <vector>
+#include <PointerDefinitions.h>
+
+class Communicator;
+class Grid3D;
+class GbObject3D;
+
+//! \brief Refine blocks on base of bounding boxes.
+//! \details You need to use <i>addGbObject()</i> to add corresponding bounding boxes. Then call <i>refine()</i>.
+//! \author K. Kucher
+class RefineCrossAndInsideGbObjectHelper
+{
+public:
+   //! Constructor
+   //! \param grid a smart pointer to the grid object
+   //! \param maxRefineLevel an integer for maximal refinement level
+   RefineCrossAndInsideGbObjectHelper(SPtr<Grid3D> grid, int maxRefineLevel, SPtr<Communicator> comm);
+   virtual ~RefineCrossAndInsideGbObjectHelper();
+   //! add geometric object
+   //! \param object a smart pointer to bounding box
+   //! \param refineLevel a value of refinement level for corresponding bounding box
+   void addGbObject(SPtr<GbObject3D> object, int refineLevel);
+   //! start refinement
+   void refine();
+private:
+    SPtr<Grid3D> grid;
+   std::vector<SPtr<GbObject3D> > objects;
+   std::vector<int> levels;
+   int maxRefineLevel;
+   SPtr<Communicator> comm;
+};
+
+#endif 
diff --git a/src/cpu/VirtualFluidsCore/Visitors/RefineInterGbObjectsVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/RefineInterGbObjectsVisitor.cpp
index eb24f08d37bdce1e997dcf23ad3a5ae4401712bb..f7b2b208d9a72a65b0b4506968737cf1e784d03f 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/RefineInterGbObjectsVisitor.cpp
+++ b/src/cpu/VirtualFluidsCore/Visitors/RefineInterGbObjectsVisitor.cpp
@@ -1,68 +1,68 @@
-#include "RefineInterGbObjectsVisitor.h"
-
-#include <geometry3d/GbObject3D.h>
-#include "Grid3D.h"
-#include "Block3D.h"
-
-
-RefineInterGbObjectsBlockVisitor::RefineInterGbObjectsBlockVisitor() 
-   : Block3DVisitor(-1, -1)
-{
-}
-//////////////////////////////////////////////////////////////////////////
-RefineInterGbObjectsBlockVisitor::RefineInterGbObjectsBlockVisitor(SPtr<GbObject3D> includeGbObject3D, SPtr<GbObject3D> excludeGbObject3D, int startlevel, int stoplevel)
-   : Block3DVisitor(startlevel, stoplevel)
-{
-   this->includeGbObjects3D.push_back(includeGbObject3D);
-   this->excludeGbObjects3D.push_back(excludeGbObject3D);
-}
-//////////////////////////////////////////////////////////////////////////
-RefineInterGbObjectsBlockVisitor::RefineInterGbObjectsBlockVisitor(std::vector<SPtr<GbObject3D>> includeGbObjects3D, std::vector<SPtr<GbObject3D>> excludeGbObjects3D, int startlevel, int stoplevel)
-   : Block3DVisitor(startlevel, stoplevel)
-{
-   this->includeGbObjects3D = includeGbObjects3D;
-   this->excludeGbObjects3D = excludeGbObjects3D;
-}
-//////////////////////////////////////////////////////////////////////////
-void RefineInterGbObjectsBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block)
-{
-   UbTupleDouble3 coords = grid->getBlockWorldCoordinates(block);
-   UbTupleDouble3 delta  = grid->getBlockLengths(block);
-
-   double cellMinX1 = val<1>(coords);
-   double cellMinX2 = val<2>(coords);
-   double cellMinX3 = val<3>(coords);
-   double cellMaxX1 = val<1>(coords)+val<1>(delta);
-   double cellMaxX2 = val<2>(coords)+val<2>(delta);
-   double cellMaxX3 = val<3>(coords)+val<3>(delta);
-
-   bool insideInclude = false;
-   for(size_t i=0; i<includeGbObjects3D.size(); i++)
-   {
-      if(   includeGbObjects3D[i]->isCellInsideOrCuttingGbObject3D(cellMinX1,cellMinX2,cellMinX3,cellMaxX1,cellMaxX2,cellMaxX3) )
-      {
-         insideInclude = true;
-         break;
-      }
-   }
-
-   bool insideExclude = false;
-   for(size_t e=0; e<excludeGbObjects3D.size(); e++)
-   {
-      if(excludeGbObjects3D[e]->isCellInsideGbObject3D(cellMinX1, cellMinX2, cellMinX3, cellMaxX1, cellMaxX2, cellMaxX3)) 
-      {
-         insideExclude = true;
-         break;
-      }
-   }
-
-   if(insideInclude && !insideExclude)         
-   {
-      int ix1, ix2, ix3, level;
-      ix1 = block->getX1();
-      ix2 = block->getX2();
-      ix3 = block->getX3();
-      level = block->getLevel();
-      grid->expandBlock(ix1,ix2,ix3,level); 
-   }
-}
+#include "RefineInterGbObjectsVisitor.h"
+
+#include <geometry3d/GbObject3D.h>
+#include "Grid3D.h"
+#include "Block3D.h"
+
+
+RefineInterGbObjectsBlockVisitor::RefineInterGbObjectsBlockVisitor() 
+   : Block3DVisitor(-1, -1)
+{
+}
+//////////////////////////////////////////////////////////////////////////
+RefineInterGbObjectsBlockVisitor::RefineInterGbObjectsBlockVisitor(SPtr<GbObject3D> includeGbObject3D, SPtr<GbObject3D> excludeGbObject3D, int startlevel, int stoplevel)
+   : Block3DVisitor(startlevel, stoplevel)
+{
+   this->includeGbObjects3D.push_back(includeGbObject3D);
+   this->excludeGbObjects3D.push_back(excludeGbObject3D);
+}
+//////////////////////////////////////////////////////////////////////////
+RefineInterGbObjectsBlockVisitor::RefineInterGbObjectsBlockVisitor(std::vector<SPtr<GbObject3D>> includeGbObjects3D, std::vector<SPtr<GbObject3D>> excludeGbObjects3D, int startlevel, int stoplevel)
+   : Block3DVisitor(startlevel, stoplevel)
+{
+   this->includeGbObjects3D = includeGbObjects3D;
+   this->excludeGbObjects3D = excludeGbObjects3D;
+}
+//////////////////////////////////////////////////////////////////////////
+void RefineInterGbObjectsBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block)
+{
+   UbTupleDouble3 coords = grid->getBlockWorldCoordinates(block);
+   UbTupleDouble3 delta  = grid->getBlockLengths(block);
+
+   double cellMinX1 = val<1>(coords);
+   double cellMinX2 = val<2>(coords);
+   double cellMinX3 = val<3>(coords);
+   double cellMaxX1 = val<1>(coords)+val<1>(delta);
+   double cellMaxX2 = val<2>(coords)+val<2>(delta);
+   double cellMaxX3 = val<3>(coords)+val<3>(delta);
+
+   bool insideInclude = false;
+   for(size_t i=0; i<includeGbObjects3D.size(); i++)
+   {
+      if(   includeGbObjects3D[i]->isCellInsideOrCuttingGbObject3D(cellMinX1,cellMinX2,cellMinX3,cellMaxX1,cellMaxX2,cellMaxX3) )
+      {
+         insideInclude = true;
+         break;
+      }
+   }
+
+   bool insideExclude = false;
+   for(size_t e=0; e<excludeGbObjects3D.size(); e++)
+   {
+      if(excludeGbObjects3D[e]->isCellInsideGbObject3D(cellMinX1, cellMinX2, cellMinX3, cellMaxX1, cellMaxX2, cellMaxX3)) 
+      {
+         insideExclude = true;
+         break;
+      }
+   }
+
+   if(insideInclude && !insideExclude)         
+   {
+      int ix1, ix2, ix3, level;
+      ix1 = block->getX1();
+      ix2 = block->getX2();
+      ix3 = block->getX3();
+      level = block->getLevel();
+      grid->expandBlock(ix1,ix2,ix3,level); 
+   }
+}
diff --git a/src/cpu/VirtualFluidsCore/Visitors/RefineInterGbObjectsVisitor.h b/src/cpu/VirtualFluidsCore/Visitors/RefineInterGbObjectsVisitor.h
index 3831f41cee133e56bc339d25b14471280c3e62e8..ed0a850188f2f885ff78394946bd2ea7301badf6 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/RefineInterGbObjectsVisitor.h
+++ b/src/cpu/VirtualFluidsCore/Visitors/RefineInterGbObjectsVisitor.h
@@ -1,27 +1,27 @@
-#ifndef RefineInterGbObjectsVisirtor_H
-#define RefineInterGbObjectsVisirtor_H
-
-#include <vector>
-#include <PointerDefinitions.h>
-
-#include "Block3DVisitor.h"
-
-class Grid3D;
-class Block3D;
-class GbObject3D;
-
-//////////////////////////////////////////////////////////////////////////
-class RefineInterGbObjectsBlockVisitor : public Block3DVisitor
-{
-public:
-   RefineInterGbObjectsBlockVisitor();
-   RefineInterGbObjectsBlockVisitor(SPtr<GbObject3D> includeGbObject3D, SPtr<GbObject3D> excludeGbObject3D, int startlevel, int stoplevel);
-   RefineInterGbObjectsBlockVisitor(std::vector<SPtr<GbObject3D> > includeGbObjects3D, std::vector<SPtr<GbObject3D> > excludeGbObjects3D, int startlevel, int stoplevel);
-   void visit(SPtr<Grid3D> grid, SPtr<Block3D> block) override;
-
-private:
-   std::vector<SPtr<GbObject3D> > includeGbObjects3D;
-   std::vector<SPtr<GbObject3D> > excludeGbObjects3D;
-};
-
-#endif //RefineInterGbObjectsVisirtor_H
+#ifndef RefineInterGbObjectsVisirtor_H
+#define RefineInterGbObjectsVisirtor_H
+
+#include <vector>
+#include <PointerDefinitions.h>
+
+#include "Block3DVisitor.h"
+
+class Grid3D;
+class Block3D;
+class GbObject3D;
+
+//////////////////////////////////////////////////////////////////////////
+class RefineInterGbObjectsBlockVisitor : public Block3DVisitor
+{
+public:
+   RefineInterGbObjectsBlockVisitor();
+   RefineInterGbObjectsBlockVisitor(SPtr<GbObject3D> includeGbObject3D, SPtr<GbObject3D> excludeGbObject3D, int startlevel, int stoplevel);
+   RefineInterGbObjectsBlockVisitor(std::vector<SPtr<GbObject3D> > includeGbObjects3D, std::vector<SPtr<GbObject3D> > excludeGbObjects3D, int startlevel, int stoplevel);
+   void visit(SPtr<Grid3D> grid, SPtr<Block3D> block) override;
+
+private:
+   std::vector<SPtr<GbObject3D> > includeGbObjects3D;
+   std::vector<SPtr<GbObject3D> > excludeGbObjects3D;
+};
+
+#endif //RefineInterGbObjectsVisirtor_H
diff --git a/src/cpu/VirtualFluidsCore/Visitors/RenumberBlockVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/RenumberBlockVisitor.cpp
index 4319cfa673c11d3e709acab00a26729679e6ca62..65def194033424645adcba7f47373fb6713e5fd6 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/RenumberBlockVisitor.cpp
+++ b/src/cpu/VirtualFluidsCore/Visitors/RenumberBlockVisitor.cpp
@@ -1,22 +1,22 @@
-#include "RenumberBlockVisitor.h"
-#include "Grid3DSystem.h"
-#include "LBMSystem.h"
-#include "Grid3D.h"
-#include "Block3D.h"
-
-int RenumberBlockVisitor::counter = 0;
-
-RenumberBlockVisitor::RenumberBlockVisitor() :
-Block3DVisitor(0, Grid3DSystem::MAXLEVEL)
-{
-
-}
-//////////////////////////////////////////////////////////////////////////
-void RenumberBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block)
-{
-   block->setGlobalID(counter);
-   Grid3D::BlockIDMap blockIdMap = grid->getBlockIDs();
-   blockIdMap.insert(std::make_pair(counter, block));
-   counter++;
-}
-
+#include "RenumberBlockVisitor.h"
+#include "Grid3DSystem.h"
+#include "LBMSystem.h"
+#include "Grid3D.h"
+#include "Block3D.h"
+
+int RenumberBlockVisitor::counter = 0;
+
+RenumberBlockVisitor::RenumberBlockVisitor() :
+Block3DVisitor(0, Grid3DSystem::MAXLEVEL)
+{
+
+}
+//////////////////////////////////////////////////////////////////////////
+void RenumberBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block)
+{
+   block->setGlobalID(counter);
+   Grid3D::BlockIDMap blockIdMap = grid->getBlockIDs();
+   blockIdMap.insert(std::make_pair(counter, block));
+   counter++;
+}
+
diff --git a/src/cpu/VirtualFluidsCore/Visitors/RenumberBlockVisitor.h b/src/cpu/VirtualFluidsCore/Visitors/RenumberBlockVisitor.h
index ecde038837451d200f3d23765bda0c43a6f58298..0980aa954abfba183fbc21a3a0221372ce709846 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/RenumberBlockVisitor.h
+++ b/src/cpu/VirtualFluidsCore/Visitors/RenumberBlockVisitor.h
@@ -1,32 +1,32 @@
-/**
-* @file RenumberBlockVisitor.h
-* @brief Visitor class which renumber blocks.
-* @author Konstantin Kutscher
-* @date 06.06.2011
-*/
-
-#ifndef RenumberBlockVisitor_h
-#define RenumberBlockVisitor_h
-
-#include "Block3DVisitor.h"
-
-class Grid3D;
-class Block3D;
-
-//! \brief  Visitor class which renumber blocks.
-//! \details Visitor class which renumber blocks.            
-//! \author  Konstantin Kutscher 
-class RenumberBlockVisitor : public Block3DVisitor
-{
-public:
-   RenumberBlockVisitor();
-
-   virtual ~RenumberBlockVisitor() {}
-
-   void visit(SPtr<Grid3D> grid, SPtr<Block3D> block) override;
-
-private:
-   static int counter;
-};
-
-#endif
+/**
+* @file RenumberBlockVisitor.h
+* @brief Visitor class which renumber blocks.
+* @author Konstantin Kutscher
+* @date 06.06.2011
+*/
+
+#ifndef RenumberBlockVisitor_h
+#define RenumberBlockVisitor_h
+
+#include "Block3DVisitor.h"
+
+class Grid3D;
+class Block3D;
+
+//! \brief  Visitor class which renumber blocks.
+//! \details Visitor class which renumber blocks.            
+//! \author  Konstantin Kutscher 
+class RenumberBlockVisitor : public Block3DVisitor
+{
+public:
+   RenumberBlockVisitor();
+
+   virtual ~RenumberBlockVisitor() {}
+
+   void visit(SPtr<Grid3D> grid, SPtr<Block3D> block) override;
+
+private:
+   static int counter;
+};
+
+#endif
diff --git a/src/cpu/VirtualFluidsCore/Visitors/SetConnectorsBlockVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/SetConnectorsBlockVisitor.cpp
index dcf3c8ea841a7eebd1463004af18f17fc2026435..a302a50f3247cb7ac8dac3ea9423f1e069e783ee 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/SetConnectorsBlockVisitor.cpp
+++ b/src/cpu/VirtualFluidsCore/Visitors/SetConnectorsBlockVisitor.cpp
@@ -1,519 +1,519 @@
-//=======================================================================================
-// ____          ____    __    ______     __________   __      __       __        __         
-// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
-//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
-//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
-//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
-//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
-//      \    \  |    |   ________________________________________________________________    
-//       \    \ |    |  |  ______________________________________________________________|   
-//        \    \|    |  |  |         __          __     __     __     ______      _______    
-//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
-//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
-//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
-//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
-//
-//  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 SetConnectorsBlockVisitor.cpp
-//! \ingroup Visitors
-//! \author Konstantin Kutscher
-//=======================================================================================
-
-#include "SetConnectorsBlockVisitor.h"
-#include "D3Q27ETFullDirectConnector.h"
-#include "D3Q27ETFullVectorConnector.h"
-#include "D3Q27ETCFOffVectorConnector.h"
-#include "D3Q27ETFCOffVectorConnector.h"
-#include "Grid3DSystem.h"
-#include <basics/transmitter/TbTransmitterLocal.h>
-
-#include "Communicator.h"
-#include "InterpolationProcessor.h"
-
-SetConnectorsBlockVisitor::SetConnectorsBlockVisitor(SPtr<Communicator> comm, bool fullConnector, int dirs, 
-															   LBMReal nue, InterpolationProcessorPtr iProcessor) :
-Block3DVisitor(0, Grid3DSystem::MAXLEVEL), 
-	comm(comm),
-	fullConnector(fullConnector),
-	dirs(dirs),
-	nue(nue),
-	iProcessor(iProcessor)
-{
-}
-//////////////////////////////////////////////////////////////////////////
-SetConnectorsBlockVisitor::~SetConnectorsBlockVisitor(void)
-{
-}
-//////////////////////////////////////////////////////////////////////////
-void SetConnectorsBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block)
-{
-	if(!block) return;
-
-	UBLOG(logDEBUG5, "D3Q27SetConnectorsBlockVisitor::visit() - start");
-   UBLOG(logDEBUG5, block->toString());
-
-	gridRank = comm->getProcessID();
-	grid->setRank(gridRank);
-
-	setSameLevelConnectors(grid, block);
-
-	if(grid->getFinestInitializedLevel() > grid->getCoarsestInitializedLevel())
-		setInterpolationConnectors(grid, block);
-
-	UBLOG(logDEBUG5, "D3Q27SetConnectorsBlockVisitor::visit() - end");
-}
-//////////////////////////////////////////////////////////////////////////
-void SetConnectorsBlockVisitor::setSameLevelConnectors(SPtr<Grid3D> grid, SPtr<Block3D> block)
-{
-   UBLOG(logDEBUG5, "D3Q27SetConnectorsBlockVisitor::setSameLevelConnectors() - start");
-	int blockRank = block->getRank();
-	if (gridRank == blockRank && block->isActive())
-	{
-		block->clearWeight();
-		std::vector<SPtr<Block3D>> neighbors; 
-		int ix1 = block->getX1();
-		int ix2 = block->getX2();
-		int ix3 = block->getX3();
-		int level = block->getLevel();
-		//grid->getAllNeighbors(ix1, ix2, ix3, level, level, neighbors);
-
-      //if (block->getGlobalID()==2512)
-      //{
-      //   int test = 0;
-      //}
-
-		for( int dir = 0; dir < dirs; dir++)
-		{
-			SPtr<Block3D> neighBlock = grid->getNeighborBlock(dir, ix1, ix2, ix3, level);
-
-			if(neighBlock)
-			{
-				int neighBlockRank = neighBlock->getRank();
-				if(blockRank == neighBlockRank && neighBlock->isActive())
-				{
-					SPtr<Block3DConnector> connector;
-               connector = SPtr<Block3DConnector>(new D3Q27ETFullDirectConnector( block, neighBlock, dir));
-					block->setConnector(connector);
-				}
-				else if(blockRank != neighBlockRank && neighBlock->isActive())
-				{
-					setRemoteConnectors(block, neighBlock, dir, fullConnector);  
-
-					if(dir >=0 && dir<=5)
-					{
-						int weight = block->getWeight(neighBlockRank);
-						weight++;
-						block->setWeight(neighBlockRank, weight);
-					}
-				}
-			}
-		}
-      
-      //if (block->getGlobalID()==2794)
-      //{
-      //   UBLOG(logINFO, block->toString());
-      //}
-		
-      int weight = block->getNumberOfLocalConnectorsForSurfaces();
-		weight = 6 - weight;
-		block->addWeightForAll(weight);
-	}
-   UBLOG(logDEBUG5, "D3Q27SetConnectorsBlockVisitor::setSameLevelConnectors() - end");
-}
-//////////////////////////////////////////////////////////////////////////
-void SetConnectorsBlockVisitor::setRemoteConnectors(SPtr<Block3D> sblock, SPtr<Block3D> tblock, int dir, bool fullConnector)
-{
-   UBLOG(logDEBUG5, "D3Q27SetConnectorsBlockVisitor::setRemoteConnectors() - start");
-	CreateTransmittersHelper helper;
-	CreateTransmittersHelper::TransmitterPtr sender, receiver;
-	helper.createTransmitters(sblock, tblock, dir, CreateTransmittersHelper::NONE, sender, receiver, comm, CreateTransmittersHelper::MPI);
-
-
-	SPtr<Block3DConnector> connector;
-	connector = SPtr<Block3DConnector>(new D3Q27ETFullVectorConnector(sblock, sender, receiver, dir));
-	sblock->setConnector(connector);
-   UBLOG(logDEBUG5, "D3Q27SetConnectorsBlockVisitor::setRemoteConnectors() - end");
-}
-//////////////////////////////////////////////////////////////////////////
-void SetConnectorsBlockVisitor::setInterpolationConnectors(SPtr<Grid3D> grid, SPtr<Block3D> block)
-{
-   UBLOG(logDEBUG5, "D3Q27SetConnectorsBlockVisitor::setInterpolationConnectors() - start");
-	int blockRank = block->getRank();
-	if (block->getGlobalID()==394)
-	{
-		int test=0;
-	}
-
-	//search for all blocks with different ranks
-	if (block->hasInterpolationFlagCF() && block->isActive())
-	{
-		int fbx1 = block->getX1() << 1;
-		int fbx2 = block->getX2() << 1;
-		int fbx3 = block->getX3() << 1;
-		int level = block->getLevel() + 1;
-
-		if( block->hasInterpolationFlagCF(D3Q27System::E))
-		{
-			SPtr<Block3D> fblockSW = grid->getBlock(fbx1+1,fbx2,fbx3,level);
-			SPtr<Block3D> fblockSE = grid->getBlock(fbx1+1,fbx2+1,fbx3,level);
-			SPtr<Block3D> fblockNW = grid->getBlock(fbx1+1,fbx2,fbx3+1,level);
-			SPtr<Block3D> fblockNE = grid->getBlock(fbx1+1,fbx2+1,fbx3+1,level);
-
-			setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::E);
-		}
-		if( block->hasInterpolationFlagCF(D3Q27System::W))
-		{
-			SPtr<Block3D> fblockSW = grid->getBlock(fbx1,fbx2,fbx3,level);
-			SPtr<Block3D> fblockSE = grid->getBlock(fbx1,fbx2+1,fbx3,level);
-			SPtr<Block3D> fblockNW = grid->getBlock(fbx1,fbx2,fbx3+1,level);
-			SPtr<Block3D> fblockNE = grid->getBlock(fbx1,fbx2+1,fbx3+1,level);
-
-			setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::W);
-		}
-		if( block->hasInterpolationFlagCF(D3Q27System::N))
-		{
-			SPtr<Block3D> fblockSW = grid->getBlock(fbx1,fbx2+1,fbx3,level);
-			SPtr<Block3D> fblockSE = grid->getBlock(fbx1+1,fbx2+1,fbx3,level);
-			SPtr<Block3D> fblockNW = grid->getBlock(fbx1,fbx2+1,fbx3+1,level);
-			SPtr<Block3D> fblockNE = grid->getBlock(fbx1+1,fbx2+1,fbx3+1,level);
-
-			setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::N);
-		}
-		if( block->hasInterpolationFlagCF(D3Q27System::S))
-		{
-			SPtr<Block3D> fblockSW = grid->getBlock(fbx1,fbx2,fbx3,level);
-			SPtr<Block3D> fblockSE = grid->getBlock(fbx1+1,fbx2,fbx3,level);
-			SPtr<Block3D> fblockNW = grid->getBlock(fbx1,fbx2,fbx3+1,level);
-			SPtr<Block3D> fblockNE = grid->getBlock(fbx1+1,fbx2,fbx3+1,level);
-
-			setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::S);
-		}
-		if( block->hasInterpolationFlagCF(D3Q27System::T))
-		{
-			SPtr<Block3D> fblockSW = grid->getBlock(fbx1,fbx2,fbx3+1,level);
-			SPtr<Block3D> fblockSE = grid->getBlock(fbx1+1,fbx2,fbx3+1,level);
-			SPtr<Block3D> fblockNW = grid->getBlock(fbx1,fbx2+1,fbx3+1,level);
-			SPtr<Block3D> fblockNE = grid->getBlock(fbx1+1,fbx2+1,fbx3+1,level);
-
-			setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::T);
-		}
-		if( block->hasInterpolationFlagCF(D3Q27System::B))
-		{
-			SPtr<Block3D> fblockSW = grid->getBlock(fbx1,fbx2,fbx3,level);
-			SPtr<Block3D> fblockSE = grid->getBlock(fbx1+1,fbx2,fbx3,level);
-			SPtr<Block3D> fblockNW = grid->getBlock(fbx1,fbx2+1,fbx3,level);
-			SPtr<Block3D> fblockNE = grid->getBlock(fbx1+1,fbx2+1,fbx3,level);
-
-			setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::B);
-		}
-
-		//////NE-NW-SE-SW
-		if( block->hasInterpolationFlagCF(D3Q27System::NE)&&!block->hasInterpolationFlagCF(D3Q27System::N) && !block->hasInterpolationFlagCF(D3Q27System::E))
-		{
-			SPtr<Block3D> fblockSW = grid->getBlock(fbx1+1,fbx2+1,fbx3+0,level);
-			SPtr<Block3D> fblockSE = grid->getBlock(fbx1+1,fbx2+1,fbx3+1,level);
-         SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1+1, fbx2+1, fbx3+1, level);
-         SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1+1, fbx2+1, fbx3+1, level);
-
-			setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::NE);
-		}
-		if( block->hasInterpolationFlagCF(D3Q27System::SW)&& !block->hasInterpolationFlagCF(D3Q27System::W) && !block->hasInterpolationFlagCF(D3Q27System::S))
-		{
-			SPtr<Block3D> fblockSW = grid->getBlock(fbx1,fbx2,fbx3,level);
-			SPtr<Block3D> fblockSE = grid->getBlock(fbx1,fbx2,fbx3+1,level);
-         SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1, fbx2, fbx3+1, level);
-         SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1, fbx2, fbx3+1, level);
-
-			setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::SW);
-		}
-		if( block->hasInterpolationFlagCF(D3Q27System::SE)&& !block->hasInterpolationFlagCF(D3Q27System::E) && !block->hasInterpolationFlagCF(D3Q27System::S))
-		{
-			SPtr<Block3D> fblockSW = grid->getBlock(fbx1+1,fbx2,fbx3+0,level);
-			SPtr<Block3D> fblockSE = grid->getBlock(fbx1+1,fbx2,fbx3+1,level);
-         SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1+1, fbx2, fbx3+1, level);
-         SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1+1, fbx2, fbx3+1, level);
-
-			setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::SE);
-		}
-		if( block->hasInterpolationFlagCF(D3Q27System::NW)&& !block->hasInterpolationFlagCF(D3Q27System::N) && !block->hasInterpolationFlagCF(D3Q27System::W))
-		{
-			SPtr<Block3D> fblockSW = grid->getBlock(fbx1,fbx2+1,fbx3,level);
-			SPtr<Block3D> fblockSE = grid->getBlock(fbx1,fbx2+1,fbx3+1,level);
-         SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1, fbx2+1, fbx3+1, level);
-         SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1, fbx2+1, fbx3+1, level);
-
-			setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::NW);
-		}
-
-		/////////TE-BW-BE-TW 1-0
-		if( block->hasInterpolationFlagCF(D3Q27System::TE)&& !block->hasInterpolationFlagCF(D3Q27System::E) && !block->hasInterpolationFlagCF(D3Q27System::T))
-		{
-			SPtr<Block3D> fblockSW = grid->getBlock(fbx1+1,fbx2+0,fbx3+1,level);
-			SPtr<Block3D> fblockSE = grid->getBlock(fbx1+1,fbx2+1,fbx3+1,level);
-         SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1+1, fbx2+0, fbx3+1, level);
-         SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1+1, fbx2+1, fbx3+1, level);
-
-			setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::TE);
-		}
-		if( block->hasInterpolationFlagCF(D3Q27System::BW)&& !block->hasInterpolationFlagCF(D3Q27System::W) && !block->hasInterpolationFlagCF(D3Q27System::B))
-		{
-
-			SPtr<Block3D> fblockSW = grid->getBlock(fbx1,fbx2+0,fbx3,level);
-			SPtr<Block3D> fblockSE = grid->getBlock(fbx1,fbx2+1,fbx3,level);
-         SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1, fbx2+0, fbx3, level);
-         SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1, fbx2+1, fbx3, level);
-
-			setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::BW);
-		}
-		if( block->hasInterpolationFlagCF(D3Q27System::BE)&& !block->hasInterpolationFlagCF(D3Q27System::E) && !block->hasInterpolationFlagCF(D3Q27System::B))
-		{
-			SPtr<Block3D> fblockSW = grid->getBlock(fbx1+1,fbx2+0,fbx3,level);
-			SPtr<Block3D> fblockSE = grid->getBlock(fbx1+1,fbx2+1,fbx3,level);
-         SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1+1, fbx2+0, fbx3, level);
-         SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1+1, fbx2+1, fbx3, level);
-
-			setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::BE);
-		}
-		if( block->hasInterpolationFlagCF(D3Q27System::TW)&& !block->hasInterpolationFlagCF(D3Q27System::W) && !block->hasInterpolationFlagCF(D3Q27System::T))
-		{
-			SPtr<Block3D> fblockSW = grid->getBlock(fbx1,fbx2+0,fbx3+1,level);
-			SPtr<Block3D> fblockSE = grid->getBlock(fbx1,fbx2+1,fbx3+1,level);
-         SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1, fbx2+0, fbx3+1, level);
-         SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1, fbx2+1, fbx3+1, level);
-
-			setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::TW);
-		}
-
-		//////TN-BS-BN-TS
-		if( block->hasInterpolationFlagCF(D3Q27System::TN)&& !block->hasInterpolationFlagCF(D3Q27System::N) && !block->hasInterpolationFlagCF(D3Q27System::T))
-		{
-			SPtr<Block3D> fblockSW = grid->getBlock(fbx1+0,fbx2+1,fbx3+1,level);
-			SPtr<Block3D> fblockSE = grid->getBlock(fbx1+1,fbx2+1,fbx3+1,level);
-         SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1+0, fbx2+1, fbx3+1, level);
-         SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1+1, fbx2+1, fbx3+1, level);
-
-			setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::TN);
-		}
-		if( block->hasInterpolationFlagCF(D3Q27System::BS)&& !block->hasInterpolationFlagCF(D3Q27System::S) && !block->hasInterpolationFlagCF(D3Q27System::B))
-		{
-			SPtr<Block3D> fblockSW = grid->getBlock(fbx1+0,fbx2,fbx3,level);
-			SPtr<Block3D> fblockSE = grid->getBlock(fbx1+1,fbx2,fbx3,level);
-         SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1+0, fbx2, fbx3, level);
-         SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1+1, fbx2, fbx3, level);
-
-			setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::BS);
-		}
-		if( block->hasInterpolationFlagCF(D3Q27System::BN)&& !block->hasInterpolationFlagCF(D3Q27System::N) && !block->hasInterpolationFlagCF(D3Q27System::B))
-		{
-			SPtr<Block3D> fblockSW = grid->getBlock(fbx1+0,fbx2+1,fbx3,level);
-			SPtr<Block3D> fblockSE = grid->getBlock(fbx1+1,fbx2+1,fbx3,level);
-         SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1+0, fbx2+1, fbx3, level);
-         SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1+1, fbx2+1, fbx3, level);
-
-			setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::BN);
-		}
-		if( block->hasInterpolationFlagCF(D3Q27System::TS)&& !block->hasInterpolationFlagCF(D3Q27System::S) && !block->hasInterpolationFlagCF(D3Q27System::T))
-		{
-			SPtr<Block3D> fblockSW = grid->getBlock(fbx1+0,fbx2,fbx3+1,level);
-			SPtr<Block3D> fblockSE = grid->getBlock(fbx1+1,fbx2,fbx3+1,level);
-         SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1+0, fbx2, fbx3+1, level);
-         SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1+1, fbx2, fbx3+1, level);
-
-			setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::TS);
-		}
-
-
-
-
-      //////corners
-      if (block->hasInterpolationFlagCF(D3Q27System::TNE)&&!block->hasInterpolationFlagCF(D3Q27System::TE)&&!block->hasInterpolationFlagCF(D3Q27System::TN)&&!block->hasInterpolationFlagCF(D3Q27System::NE)&&!block->hasInterpolationFlagCF(D3Q27System::T)&&!block->hasInterpolationFlagCF(D3Q27System::N) && !block->hasInterpolationFlagCF(D3Q27System::E))
-      {
-         SPtr<Block3D> fblockSW = grid->getBlock(fbx1+1, fbx2+1, fbx3+1, level);
-         SPtr<Block3D> fblockSE;// = grid->getBlock(fbx1+1, fbx2+1, fbx3+0, level);
-         SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1+1, fbx2+1, fbx3+1, level);
-         SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1+1, fbx2+1, fbx3+1, level);
-
-         setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::TNE);
-      }
-      if (block->hasInterpolationFlagCF(D3Q27System::TSW)&&!block->hasInterpolationFlagCF(D3Q27System::TW)&&!block->hasInterpolationFlagCF(D3Q27System::TS)&& !block->hasInterpolationFlagCF(D3Q27System::SW)&& !block->hasInterpolationFlagCF(D3Q27System::T)&& !block->hasInterpolationFlagCF(D3Q27System::W) && !block->hasInterpolationFlagCF(D3Q27System::S))
-      {
-         SPtr<Block3D> fblockSW = grid->getBlock(fbx1, fbx2, fbx3+1, level);
-         SPtr<Block3D> fblockSE;// = grid->getBlock(fbx1, fbx2, fbx3, level);
-         SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1, fbx2, fbx3+1, level);
-         SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1, fbx2, fbx3+1, level);
-
-         setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::TSW);
-      }
-      if (block->hasInterpolationFlagCF(D3Q27System::TSE)&&!block->hasInterpolationFlagCF(D3Q27System::TE)&&!block->hasInterpolationFlagCF(D3Q27System::TS)&& !block->hasInterpolationFlagCF(D3Q27System::SE)&& !block->hasInterpolationFlagCF(D3Q27System::T)&& !block->hasInterpolationFlagCF(D3Q27System::E) && !block->hasInterpolationFlagCF(D3Q27System::S))
-      {
-         SPtr<Block3D> fblockSW = grid->getBlock(fbx1+1, fbx2, fbx3+1, level);
-         SPtr<Block3D> fblockSE;// = grid->getBlock(fbx1+1, fbx2, fbx3+0, level);
-         SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1+1, fbx2, fbx3+1, level);
-         SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1+1, fbx2, fbx3+1, level);
-
-         setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::TSE);
-      }
-      if (block->hasInterpolationFlagCF(D3Q27System::TNW)&&!block->hasInterpolationFlagCF(D3Q27System::TW)&&!block->hasInterpolationFlagCF(D3Q27System::TN)&& !block->hasInterpolationFlagCF(D3Q27System::NW)&& !block->hasInterpolationFlagCF(D3Q27System::T)&& !block->hasInterpolationFlagCF(D3Q27System::N) && !block->hasInterpolationFlagCF(D3Q27System::W))
-      {
-         SPtr<Block3D> fblockSW = grid->getBlock(fbx1, fbx2+1, fbx3+1, level);
-         SPtr<Block3D> fblockSE;// = grid->getBlock(fbx1, fbx2+1, fbx3, level);
-         SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1, fbx2+1, fbx3+1, level);
-         SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1, fbx2+1, fbx3+1, level);
-
-         setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::TNW);
-      }
-      if (block->hasInterpolationFlagCF(D3Q27System::BNE)&&!block->hasInterpolationFlagCF(D3Q27System::BE)&&!block->hasInterpolationFlagCF(D3Q27System::BN)&& !block->hasInterpolationFlagCF(D3Q27System::NE)&&!block->hasInterpolationFlagCF(D3Q27System::B)&&!block->hasInterpolationFlagCF(D3Q27System::N) && !block->hasInterpolationFlagCF(D3Q27System::E))
-      {
-         SPtr<Block3D> fblockSW = grid->getBlock(fbx1+1, fbx2+1, fbx3+0, level);
-         SPtr<Block3D> fblockSE;// = grid->getBlock(fbx1+1, fbx2+1, fbx3+0, level);
-         SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1+1, fbx2+1, fbx3+1, level);
-         SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1+1, fbx2+1, fbx3+1, level);
-
-         setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::BNE);
-      }
-      if (block->hasInterpolationFlagCF(D3Q27System::BSW)&& !block->hasInterpolationFlagCF(D3Q27System::BS)&& !block->hasInterpolationFlagCF(D3Q27System::BW)&& !block->hasInterpolationFlagCF(D3Q27System::SW)&& !block->hasInterpolationFlagCF(D3Q27System::B)&& !block->hasInterpolationFlagCF(D3Q27System::W) && !block->hasInterpolationFlagCF(D3Q27System::S))
-      {
-         SPtr<Block3D> fblockSW = grid->getBlock(fbx1, fbx2, fbx3+0, level);
-         SPtr<Block3D> fblockSE;// = grid->getBlock(fbx1, fbx2, fbx3, level);
-         SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1, fbx2, fbx3+1, level);
-         SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1, fbx2, fbx3+1, level);
-
-         setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::BSW);
-      }
-      if (block->hasInterpolationFlagCF(D3Q27System::BSE)&& !block->hasInterpolationFlagCF(D3Q27System::BS)&& !block->hasInterpolationFlagCF(D3Q27System::BE)&& !block->hasInterpolationFlagCF(D3Q27System::SE)&& !block->hasInterpolationFlagCF(D3Q27System::B)&& !block->hasInterpolationFlagCF(D3Q27System::E) && !block->hasInterpolationFlagCF(D3Q27System::S))
-      {
-         SPtr<Block3D> fblockSW = grid->getBlock(fbx1+1, fbx2, fbx3, level);
-         SPtr<Block3D> fblockSE;// = grid->getBlock(fbx1+1, fbx2, fbx3+0, level);
-         SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1+1, fbx2, fbx3+1, level);
-         SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1+1, fbx2, fbx3+1, level);
-
-         setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::BSE);
-      }
-      if (block->hasInterpolationFlagCF(D3Q27System::BNW)&& !block->hasInterpolationFlagCF(D3Q27System::BN)&& !block->hasInterpolationFlagCF(D3Q27System::BW)&& !block->hasInterpolationFlagCF(D3Q27System::NW)&& !block->hasInterpolationFlagCF(D3Q27System::B)&& !block->hasInterpolationFlagCF(D3Q27System::N) && !block->hasInterpolationFlagCF(D3Q27System::W))
-      {
-         SPtr<Block3D> fblockSW = grid->getBlock(fbx1, fbx2+1, fbx3+0, level);
-         SPtr<Block3D> fblockSE;// = grid->getBlock(fbx1, fbx2+1, fbx3, level);
-         SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1, fbx2+1, fbx3+1, level);
-         SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1, fbx2+1, fbx3+1, level);
-
-         setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::BNW);
-      }
-
-	}
-   UBLOG(logDEBUG5, "D3Q27SetConnectorsBlockVisitor::setInterpolationConnectors() - end");
-}
-//////////////////////////////////////////////////////////////////////////
-void SetConnectorsBlockVisitor::setInterpolationConnectors(SPtr<Block3D> fBlockSW, SPtr<Block3D> fBlockSE, SPtr<Block3D> fBlockNW, SPtr<Block3D> fBlockNE, SPtr<Block3D> cBlock, int dir)
-{
-   UBLOG(logDEBUG5, "D3Q27SetConnectorsBlockVisitor::setInterpolationConnectors(...) - start");
-	int fBlockSWRank = -999, fBlockSERank = -999, fBlockNWRank = -999, fBlockNERank = -999;
-	if(fBlockSW) fBlockSWRank = fBlockSW->getRank();
-	if(fBlockNW) fBlockNWRank = fBlockNW->getRank();
-	if(fBlockSE) fBlockSERank = fBlockSE->getRank();
-	if(fBlockNE) fBlockNERank = fBlockNE->getRank();
-	int cBlockRank   = cBlock->getRank();
-
-	LBMReal omegaF;
-	if(fBlockSW) omegaF =LBMSystem::calcCollisionFactor(nue, fBlockSW->getLevel());
-	if(fBlockNW) omegaF =LBMSystem::calcCollisionFactor(nue, fBlockNW->getLevel());
-	if(fBlockSE) omegaF =LBMSystem::calcCollisionFactor(nue, fBlockSE->getLevel());
-	if(fBlockNE) omegaF =LBMSystem::calcCollisionFactor(nue, fBlockNE->getLevel());
-	LBMReal omegaC = LBMSystem::calcCollisionFactor(nue, cBlock->getLevel());
-	iProcessor->setOmegas(omegaC, omegaF);
-
-	InterpolationProcessorPtr cIProcessor(iProcessor->clone());
-	InterpolationProcessorPtr fIProcessorSW(iProcessor->clone());
-	InterpolationProcessorPtr fIProcessorSE(iProcessor->clone());
-	InterpolationProcessorPtr fIProcessorNW(iProcessor->clone());
-	InterpolationProcessorPtr fIProcessorNE(iProcessor->clone());
-
-	CreateTransmittersHelper::TransmitterPtr senderCFevenEvenSW, receiverCFevenEvenSW, 
-		senderCFevenOddNW,  receiverCFevenOddNW, 
-		senderCFoddEvenSE,  receiverCFoddEvenSE, 
-		senderCFoddOddNE,   receiverCFoddOddNE,
-		senderFCevenEvenSW, receiverFCevenEvenSW, 
-		senderFCevenOddNW,  receiverFCevenOddNW, 
-		senderFCoddEvenSE,  receiverFCoddEvenSE, 
-		senderFCoddOddNE,   receiverFCoddOddNE;
-
-	if(fBlockSW) createTransmitters(cBlock, fBlockSW, dir, CreateTransmittersHelper::SW, senderCFevenEvenSW, receiverCFevenEvenSW, senderFCevenEvenSW, receiverFCevenEvenSW);
-	if(fBlockNW) createTransmitters(cBlock, fBlockNW, dir, CreateTransmittersHelper::NW, senderCFevenOddNW, receiverCFevenOddNW, senderFCevenOddNW, receiverFCevenOddNW);
-	if(fBlockSE) createTransmitters(cBlock, fBlockSE, dir, CreateTransmittersHelper::SE, senderCFoddEvenSE, receiverCFoddEvenSE, senderFCoddEvenSE, receiverFCoddEvenSE);
-	if(fBlockNE) createTransmitters(cBlock, fBlockNE, dir, CreateTransmittersHelper::NE, senderCFoddOddNE, receiverCFoddOddNE, senderFCoddOddNE, receiverFCoddOddNE);
-
-	if(cBlockRank == gridRank)
-	{
-      SPtr<Block3DConnector> connector(new D3Q27ETCFOffVectorConnector< TbTransmitter< CbVector< LBMReal > > >(cBlock,
-			senderCFevenEvenSW, receiverCFevenEvenSW, senderCFevenOddNW,  receiverCFevenOddNW, 
-			senderCFoddEvenSE,  receiverCFoddEvenSE,  senderCFoddOddNE,   receiverCFoddOddNE, 
-			dir, cIProcessor) );
-		cBlock->setConnector(connector);
-	}
-	if(fBlockSW && fBlockSWRank == gridRank)
-	{
-		SPtr<Block3DConnector> connector( new D3Q27ETFCOffVectorConnector< TbTransmitter< CbVector< LBMReal > > >(fBlockSW, 
-			senderFCevenEvenSW, receiverFCevenEvenSW, dir, fIProcessorSW, EvenEvenSW) );
-		fBlockSW->setConnector(connector);
-	}
-	if(fBlockNW && fBlockNWRank == gridRank)
-	{
-		SPtr<Block3DConnector> connector( new D3Q27ETFCOffVectorConnector< TbTransmitter< CbVector< LBMReal > > >(fBlockNW, 
-			senderFCevenOddNW, receiverFCevenOddNW, dir, fIProcessorNW, EvenOddNW) );
-		fBlockNW->setConnector(connector);
-	}
-	if(fBlockSE && fBlockSERank == gridRank)
-	{
-		SPtr<Block3DConnector> connector( new D3Q27ETFCOffVectorConnector< TbTransmitter< CbVector< LBMReal > > >(fBlockSE, 
-			senderFCoddEvenSE, receiverFCoddEvenSE, dir, fIProcessorSE, OddEvenSE) );
-		fBlockSE->setConnector(connector);
-	}
-	if(fBlockNE && fBlockNERank == gridRank)
-	{
-		SPtr<Block3DConnector> connector( new D3Q27ETFCOffVectorConnector< TbTransmitter< CbVector< LBMReal > > >(fBlockNE, 
-			senderFCoddOddNE, receiverFCoddOddNE, dir, fIProcessorNE, OddOddNE) );
-		fBlockNE->setConnector(connector);
-	}
-   UBLOG(logDEBUG5, "D3Q27SetConnectorsBlockVisitor::setInterpolationConnectors(...) - end");
-}
-//////////////////////////////////////////////////////////////////////////
-void SetConnectorsBlockVisitor::createTransmitters(SPtr<Block3D> cBlock, SPtr<Block3D> fBlock, int dir, 
-                                                        CreateTransmittersHelper::IBlock ib, 
-														              CreateTransmittersHelper::TransmitterPtr& senderCF, 
-														              CreateTransmittersHelper::TransmitterPtr& receiverCF, 
-														              CreateTransmittersHelper::TransmitterPtr& senderFC, 
-														              CreateTransmittersHelper::TransmitterPtr& receiverFC)
-{
-   UBLOG(logDEBUG5, "D3Q27SetConnectorsBlockVisitor::createTransmitters(...) - start");
-	CreateTransmittersHelper helper;
-	bool MPIpool = true;
-	bool orthogonal = false;
-	int fBlockRank = fBlock->getRank();
-	int cBlockRank = cBlock->getRank();
-	if(fBlockRank == cBlockRank && fBlockRank == gridRank)
-	{
-		senderCF = receiverFC = CreateTransmittersHelper::TransmitterPtr( new TbLocalTransmitter< CbVector< LBMReal > >());
-		senderFC = receiverCF = CreateTransmittersHelper::TransmitterPtr( new TbLocalTransmitter< CbVector< LBMReal > >());
-	}
-	else if(cBlockRank == gridRank)
-	{
-		helper.createTransmitters(cBlock, fBlock, dir, ib, senderCF, receiverCF, comm, CreateTransmittersHelper::MPI);
-	}
-	else if(fBlockRank == gridRank)
-	{
-		helper.createTransmitters(fBlock, cBlock, dir, ib, senderFC, receiverFC, comm, CreateTransmittersHelper::MPI);
-	}
-   UBLOG(logDEBUG5, "D3Q27SetConnectorsBlockVisitor::createTransmitters(...) - end");
-}
-
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 SetConnectorsBlockVisitor.cpp
+//! \ingroup Visitors
+//! \author Konstantin Kutscher
+//=======================================================================================
+
+#include "SetConnectorsBlockVisitor.h"
+#include "D3Q27ETFullDirectConnector.h"
+#include "D3Q27ETFullVectorConnector.h"
+#include "D3Q27ETCFOffVectorConnector.h"
+#include "D3Q27ETFCOffVectorConnector.h"
+#include "Grid3DSystem.h"
+#include <basics/transmitter/TbTransmitterLocal.h>
+
+#include "Communicator.h"
+#include "InterpolationProcessor.h"
+
+SetConnectorsBlockVisitor::SetConnectorsBlockVisitor(SPtr<Communicator> comm, bool fullConnector, int dirs, 
+															   LBMReal nue, InterpolationProcessorPtr iProcessor) :
+Block3DVisitor(0, Grid3DSystem::MAXLEVEL), 
+	comm(comm),
+	fullConnector(fullConnector),
+	dirs(dirs),
+	nue(nue),
+	iProcessor(iProcessor)
+{
+}
+//////////////////////////////////////////////////////////////////////////
+SetConnectorsBlockVisitor::~SetConnectorsBlockVisitor(void)
+{
+}
+//////////////////////////////////////////////////////////////////////////
+void SetConnectorsBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block)
+{
+	if(!block) return;
+
+	UBLOG(logDEBUG5, "D3Q27SetConnectorsBlockVisitor::visit() - start");
+   UBLOG(logDEBUG5, block->toString());
+
+	gridRank = comm->getProcessID();
+	grid->setRank(gridRank);
+
+	setSameLevelConnectors(grid, block);
+
+	if(grid->getFinestInitializedLevel() > grid->getCoarsestInitializedLevel())
+		setInterpolationConnectors(grid, block);
+
+	UBLOG(logDEBUG5, "D3Q27SetConnectorsBlockVisitor::visit() - end");
+}
+//////////////////////////////////////////////////////////////////////////
+void SetConnectorsBlockVisitor::setSameLevelConnectors(SPtr<Grid3D> grid, SPtr<Block3D> block)
+{
+   UBLOG(logDEBUG5, "D3Q27SetConnectorsBlockVisitor::setSameLevelConnectors() - start");
+	int blockRank = block->getRank();
+	if (gridRank == blockRank && block->isActive())
+	{
+		block->clearWeight();
+		std::vector<SPtr<Block3D>> neighbors; 
+		int ix1 = block->getX1();
+		int ix2 = block->getX2();
+		int ix3 = block->getX3();
+		int level = block->getLevel();
+		//grid->getAllNeighbors(ix1, ix2, ix3, level, level, neighbors);
+
+      //if (block->getGlobalID()==2512)
+      //{
+      //   int test = 0;
+      //}
+
+		for( int dir = 0; dir < dirs; dir++)
+		{
+			SPtr<Block3D> neighBlock = grid->getNeighborBlock(dir, ix1, ix2, ix3, level);
+
+			if(neighBlock)
+			{
+				int neighBlockRank = neighBlock->getRank();
+				if(blockRank == neighBlockRank && neighBlock->isActive())
+				{
+					SPtr<Block3DConnector> connector;
+               connector = SPtr<Block3DConnector>(new D3Q27ETFullDirectConnector( block, neighBlock, dir));
+					block->setConnector(connector);
+				}
+				else if(blockRank != neighBlockRank && neighBlock->isActive())
+				{
+					setRemoteConnectors(block, neighBlock, dir, fullConnector);  
+
+					if(dir >=0 && dir<=5)
+					{
+						int weight = block->getWeight(neighBlockRank);
+						weight++;
+						block->setWeight(neighBlockRank, weight);
+					}
+				}
+			}
+		}
+      
+      //if (block->getGlobalID()==2794)
+      //{
+      //   UBLOG(logINFO, block->toString());
+      //}
+		
+      int weight = block->getNumberOfLocalConnectorsForSurfaces();
+		weight = 6 - weight;
+		block->addWeightForAll(weight);
+	}
+   UBLOG(logDEBUG5, "D3Q27SetConnectorsBlockVisitor::setSameLevelConnectors() - end");
+}
+//////////////////////////////////////////////////////////////////////////
+void SetConnectorsBlockVisitor::setRemoteConnectors(SPtr<Block3D> sblock, SPtr<Block3D> tblock, int dir, bool fullConnector)
+{
+   UBLOG(logDEBUG5, "D3Q27SetConnectorsBlockVisitor::setRemoteConnectors() - start");
+	CreateTransmittersHelper helper;
+	CreateTransmittersHelper::TransmitterPtr sender, receiver;
+	helper.createTransmitters(sblock, tblock, dir, CreateTransmittersHelper::NONE, sender, receiver, comm, CreateTransmittersHelper::MPI);
+
+
+	SPtr<Block3DConnector> connector;
+	connector = SPtr<Block3DConnector>(new D3Q27ETFullVectorConnector(sblock, sender, receiver, dir));
+	sblock->setConnector(connector);
+   UBLOG(logDEBUG5, "D3Q27SetConnectorsBlockVisitor::setRemoteConnectors() - end");
+}
+//////////////////////////////////////////////////////////////////////////
+void SetConnectorsBlockVisitor::setInterpolationConnectors(SPtr<Grid3D> grid, SPtr<Block3D> block)
+{
+   UBLOG(logDEBUG5, "D3Q27SetConnectorsBlockVisitor::setInterpolationConnectors() - start");
+	int blockRank = block->getRank();
+	if (block->getGlobalID()==394)
+	{
+		int test=0;
+	}
+
+	//search for all blocks with different ranks
+	if (block->hasInterpolationFlagCF() && block->isActive())
+	{
+		int fbx1 = block->getX1() << 1;
+		int fbx2 = block->getX2() << 1;
+		int fbx3 = block->getX3() << 1;
+		int level = block->getLevel() + 1;
+
+		if( block->hasInterpolationFlagCF(D3Q27System::E))
+		{
+			SPtr<Block3D> fblockSW = grid->getBlock(fbx1+1,fbx2,fbx3,level);
+			SPtr<Block3D> fblockSE = grid->getBlock(fbx1+1,fbx2+1,fbx3,level);
+			SPtr<Block3D> fblockNW = grid->getBlock(fbx1+1,fbx2,fbx3+1,level);
+			SPtr<Block3D> fblockNE = grid->getBlock(fbx1+1,fbx2+1,fbx3+1,level);
+
+			setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::E);
+		}
+		if( block->hasInterpolationFlagCF(D3Q27System::W))
+		{
+			SPtr<Block3D> fblockSW = grid->getBlock(fbx1,fbx2,fbx3,level);
+			SPtr<Block3D> fblockSE = grid->getBlock(fbx1,fbx2+1,fbx3,level);
+			SPtr<Block3D> fblockNW = grid->getBlock(fbx1,fbx2,fbx3+1,level);
+			SPtr<Block3D> fblockNE = grid->getBlock(fbx1,fbx2+1,fbx3+1,level);
+
+			setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::W);
+		}
+		if( block->hasInterpolationFlagCF(D3Q27System::N))
+		{
+			SPtr<Block3D> fblockSW = grid->getBlock(fbx1,fbx2+1,fbx3,level);
+			SPtr<Block3D> fblockSE = grid->getBlock(fbx1+1,fbx2+1,fbx3,level);
+			SPtr<Block3D> fblockNW = grid->getBlock(fbx1,fbx2+1,fbx3+1,level);
+			SPtr<Block3D> fblockNE = grid->getBlock(fbx1+1,fbx2+1,fbx3+1,level);
+
+			setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::N);
+		}
+		if( block->hasInterpolationFlagCF(D3Q27System::S))
+		{
+			SPtr<Block3D> fblockSW = grid->getBlock(fbx1,fbx2,fbx3,level);
+			SPtr<Block3D> fblockSE = grid->getBlock(fbx1+1,fbx2,fbx3,level);
+			SPtr<Block3D> fblockNW = grid->getBlock(fbx1,fbx2,fbx3+1,level);
+			SPtr<Block3D> fblockNE = grid->getBlock(fbx1+1,fbx2,fbx3+1,level);
+
+			setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::S);
+		}
+		if( block->hasInterpolationFlagCF(D3Q27System::T))
+		{
+			SPtr<Block3D> fblockSW = grid->getBlock(fbx1,fbx2,fbx3+1,level);
+			SPtr<Block3D> fblockSE = grid->getBlock(fbx1+1,fbx2,fbx3+1,level);
+			SPtr<Block3D> fblockNW = grid->getBlock(fbx1,fbx2+1,fbx3+1,level);
+			SPtr<Block3D> fblockNE = grid->getBlock(fbx1+1,fbx2+1,fbx3+1,level);
+
+			setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::T);
+		}
+		if( block->hasInterpolationFlagCF(D3Q27System::B))
+		{
+			SPtr<Block3D> fblockSW = grid->getBlock(fbx1,fbx2,fbx3,level);
+			SPtr<Block3D> fblockSE = grid->getBlock(fbx1+1,fbx2,fbx3,level);
+			SPtr<Block3D> fblockNW = grid->getBlock(fbx1,fbx2+1,fbx3,level);
+			SPtr<Block3D> fblockNE = grid->getBlock(fbx1+1,fbx2+1,fbx3,level);
+
+			setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::B);
+		}
+
+		//////NE-NW-SE-SW
+		if( block->hasInterpolationFlagCF(D3Q27System::NE)&&!block->hasInterpolationFlagCF(D3Q27System::N) && !block->hasInterpolationFlagCF(D3Q27System::E))
+		{
+			SPtr<Block3D> fblockSW = grid->getBlock(fbx1+1,fbx2+1,fbx3+0,level);
+			SPtr<Block3D> fblockSE = grid->getBlock(fbx1+1,fbx2+1,fbx3+1,level);
+         SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1+1, fbx2+1, fbx3+1, level);
+         SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1+1, fbx2+1, fbx3+1, level);
+
+			setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::NE);
+		}
+		if( block->hasInterpolationFlagCF(D3Q27System::SW)&& !block->hasInterpolationFlagCF(D3Q27System::W) && !block->hasInterpolationFlagCF(D3Q27System::S))
+		{
+			SPtr<Block3D> fblockSW = grid->getBlock(fbx1,fbx2,fbx3,level);
+			SPtr<Block3D> fblockSE = grid->getBlock(fbx1,fbx2,fbx3+1,level);
+         SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1, fbx2, fbx3+1, level);
+         SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1, fbx2, fbx3+1, level);
+
+			setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::SW);
+		}
+		if( block->hasInterpolationFlagCF(D3Q27System::SE)&& !block->hasInterpolationFlagCF(D3Q27System::E) && !block->hasInterpolationFlagCF(D3Q27System::S))
+		{
+			SPtr<Block3D> fblockSW = grid->getBlock(fbx1+1,fbx2,fbx3+0,level);
+			SPtr<Block3D> fblockSE = grid->getBlock(fbx1+1,fbx2,fbx3+1,level);
+         SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1+1, fbx2, fbx3+1, level);
+         SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1+1, fbx2, fbx3+1, level);
+
+			setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::SE);
+		}
+		if( block->hasInterpolationFlagCF(D3Q27System::NW)&& !block->hasInterpolationFlagCF(D3Q27System::N) && !block->hasInterpolationFlagCF(D3Q27System::W))
+		{
+			SPtr<Block3D> fblockSW = grid->getBlock(fbx1,fbx2+1,fbx3,level);
+			SPtr<Block3D> fblockSE = grid->getBlock(fbx1,fbx2+1,fbx3+1,level);
+         SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1, fbx2+1, fbx3+1, level);
+         SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1, fbx2+1, fbx3+1, level);
+
+			setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::NW);
+		}
+
+		/////////TE-BW-BE-TW 1-0
+		if( block->hasInterpolationFlagCF(D3Q27System::TE)&& !block->hasInterpolationFlagCF(D3Q27System::E) && !block->hasInterpolationFlagCF(D3Q27System::T))
+		{
+			SPtr<Block3D> fblockSW = grid->getBlock(fbx1+1,fbx2+0,fbx3+1,level);
+			SPtr<Block3D> fblockSE = grid->getBlock(fbx1+1,fbx2+1,fbx3+1,level);
+         SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1+1, fbx2+0, fbx3+1, level);
+         SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1+1, fbx2+1, fbx3+1, level);
+
+			setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::TE);
+		}
+		if( block->hasInterpolationFlagCF(D3Q27System::BW)&& !block->hasInterpolationFlagCF(D3Q27System::W) && !block->hasInterpolationFlagCF(D3Q27System::B))
+		{
+
+			SPtr<Block3D> fblockSW = grid->getBlock(fbx1,fbx2+0,fbx3,level);
+			SPtr<Block3D> fblockSE = grid->getBlock(fbx1,fbx2+1,fbx3,level);
+         SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1, fbx2+0, fbx3, level);
+         SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1, fbx2+1, fbx3, level);
+
+			setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::BW);
+		}
+		if( block->hasInterpolationFlagCF(D3Q27System::BE)&& !block->hasInterpolationFlagCF(D3Q27System::E) && !block->hasInterpolationFlagCF(D3Q27System::B))
+		{
+			SPtr<Block3D> fblockSW = grid->getBlock(fbx1+1,fbx2+0,fbx3,level);
+			SPtr<Block3D> fblockSE = grid->getBlock(fbx1+1,fbx2+1,fbx3,level);
+         SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1+1, fbx2+0, fbx3, level);
+         SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1+1, fbx2+1, fbx3, level);
+
+			setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::BE);
+		}
+		if( block->hasInterpolationFlagCF(D3Q27System::TW)&& !block->hasInterpolationFlagCF(D3Q27System::W) && !block->hasInterpolationFlagCF(D3Q27System::T))
+		{
+			SPtr<Block3D> fblockSW = grid->getBlock(fbx1,fbx2+0,fbx3+1,level);
+			SPtr<Block3D> fblockSE = grid->getBlock(fbx1,fbx2+1,fbx3+1,level);
+         SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1, fbx2+0, fbx3+1, level);
+         SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1, fbx2+1, fbx3+1, level);
+
+			setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::TW);
+		}
+
+		//////TN-BS-BN-TS
+		if( block->hasInterpolationFlagCF(D3Q27System::TN)&& !block->hasInterpolationFlagCF(D3Q27System::N) && !block->hasInterpolationFlagCF(D3Q27System::T))
+		{
+			SPtr<Block3D> fblockSW = grid->getBlock(fbx1+0,fbx2+1,fbx3+1,level);
+			SPtr<Block3D> fblockSE = grid->getBlock(fbx1+1,fbx2+1,fbx3+1,level);
+         SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1+0, fbx2+1, fbx3+1, level);
+         SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1+1, fbx2+1, fbx3+1, level);
+
+			setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::TN);
+		}
+		if( block->hasInterpolationFlagCF(D3Q27System::BS)&& !block->hasInterpolationFlagCF(D3Q27System::S) && !block->hasInterpolationFlagCF(D3Q27System::B))
+		{
+			SPtr<Block3D> fblockSW = grid->getBlock(fbx1+0,fbx2,fbx3,level);
+			SPtr<Block3D> fblockSE = grid->getBlock(fbx1+1,fbx2,fbx3,level);
+         SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1+0, fbx2, fbx3, level);
+         SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1+1, fbx2, fbx3, level);
+
+			setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::BS);
+		}
+		if( block->hasInterpolationFlagCF(D3Q27System::BN)&& !block->hasInterpolationFlagCF(D3Q27System::N) && !block->hasInterpolationFlagCF(D3Q27System::B))
+		{
+			SPtr<Block3D> fblockSW = grid->getBlock(fbx1+0,fbx2+1,fbx3,level);
+			SPtr<Block3D> fblockSE = grid->getBlock(fbx1+1,fbx2+1,fbx3,level);
+         SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1+0, fbx2+1, fbx3, level);
+         SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1+1, fbx2+1, fbx3, level);
+
+			setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::BN);
+		}
+		if( block->hasInterpolationFlagCF(D3Q27System::TS)&& !block->hasInterpolationFlagCF(D3Q27System::S) && !block->hasInterpolationFlagCF(D3Q27System::T))
+		{
+			SPtr<Block3D> fblockSW = grid->getBlock(fbx1+0,fbx2,fbx3+1,level);
+			SPtr<Block3D> fblockSE = grid->getBlock(fbx1+1,fbx2,fbx3+1,level);
+         SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1+0, fbx2, fbx3+1, level);
+         SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1+1, fbx2, fbx3+1, level);
+
+			setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::TS);
+		}
+
+
+
+
+      //////corners
+      if (block->hasInterpolationFlagCF(D3Q27System::TNE)&&!block->hasInterpolationFlagCF(D3Q27System::TE)&&!block->hasInterpolationFlagCF(D3Q27System::TN)&&!block->hasInterpolationFlagCF(D3Q27System::NE)&&!block->hasInterpolationFlagCF(D3Q27System::T)&&!block->hasInterpolationFlagCF(D3Q27System::N) && !block->hasInterpolationFlagCF(D3Q27System::E))
+      {
+         SPtr<Block3D> fblockSW = grid->getBlock(fbx1+1, fbx2+1, fbx3+1, level);
+         SPtr<Block3D> fblockSE;// = grid->getBlock(fbx1+1, fbx2+1, fbx3+0, level);
+         SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1+1, fbx2+1, fbx3+1, level);
+         SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1+1, fbx2+1, fbx3+1, level);
+
+         setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::TNE);
+      }
+      if (block->hasInterpolationFlagCF(D3Q27System::TSW)&&!block->hasInterpolationFlagCF(D3Q27System::TW)&&!block->hasInterpolationFlagCF(D3Q27System::TS)&& !block->hasInterpolationFlagCF(D3Q27System::SW)&& !block->hasInterpolationFlagCF(D3Q27System::T)&& !block->hasInterpolationFlagCF(D3Q27System::W) && !block->hasInterpolationFlagCF(D3Q27System::S))
+      {
+         SPtr<Block3D> fblockSW = grid->getBlock(fbx1, fbx2, fbx3+1, level);
+         SPtr<Block3D> fblockSE;// = grid->getBlock(fbx1, fbx2, fbx3, level);
+         SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1, fbx2, fbx3+1, level);
+         SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1, fbx2, fbx3+1, level);
+
+         setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::TSW);
+      }
+      if (block->hasInterpolationFlagCF(D3Q27System::TSE)&&!block->hasInterpolationFlagCF(D3Q27System::TE)&&!block->hasInterpolationFlagCF(D3Q27System::TS)&& !block->hasInterpolationFlagCF(D3Q27System::SE)&& !block->hasInterpolationFlagCF(D3Q27System::T)&& !block->hasInterpolationFlagCF(D3Q27System::E) && !block->hasInterpolationFlagCF(D3Q27System::S))
+      {
+         SPtr<Block3D> fblockSW = grid->getBlock(fbx1+1, fbx2, fbx3+1, level);
+         SPtr<Block3D> fblockSE;// = grid->getBlock(fbx1+1, fbx2, fbx3+0, level);
+         SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1+1, fbx2, fbx3+1, level);
+         SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1+1, fbx2, fbx3+1, level);
+
+         setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::TSE);
+      }
+      if (block->hasInterpolationFlagCF(D3Q27System::TNW)&&!block->hasInterpolationFlagCF(D3Q27System::TW)&&!block->hasInterpolationFlagCF(D3Q27System::TN)&& !block->hasInterpolationFlagCF(D3Q27System::NW)&& !block->hasInterpolationFlagCF(D3Q27System::T)&& !block->hasInterpolationFlagCF(D3Q27System::N) && !block->hasInterpolationFlagCF(D3Q27System::W))
+      {
+         SPtr<Block3D> fblockSW = grid->getBlock(fbx1, fbx2+1, fbx3+1, level);
+         SPtr<Block3D> fblockSE;// = grid->getBlock(fbx1, fbx2+1, fbx3, level);
+         SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1, fbx2+1, fbx3+1, level);
+         SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1, fbx2+1, fbx3+1, level);
+
+         setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::TNW);
+      }
+      if (block->hasInterpolationFlagCF(D3Q27System::BNE)&&!block->hasInterpolationFlagCF(D3Q27System::BE)&&!block->hasInterpolationFlagCF(D3Q27System::BN)&& !block->hasInterpolationFlagCF(D3Q27System::NE)&&!block->hasInterpolationFlagCF(D3Q27System::B)&&!block->hasInterpolationFlagCF(D3Q27System::N) && !block->hasInterpolationFlagCF(D3Q27System::E))
+      {
+         SPtr<Block3D> fblockSW = grid->getBlock(fbx1+1, fbx2+1, fbx3+0, level);
+         SPtr<Block3D> fblockSE;// = grid->getBlock(fbx1+1, fbx2+1, fbx3+0, level);
+         SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1+1, fbx2+1, fbx3+1, level);
+         SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1+1, fbx2+1, fbx3+1, level);
+
+         setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::BNE);
+      }
+      if (block->hasInterpolationFlagCF(D3Q27System::BSW)&& !block->hasInterpolationFlagCF(D3Q27System::BS)&& !block->hasInterpolationFlagCF(D3Q27System::BW)&& !block->hasInterpolationFlagCF(D3Q27System::SW)&& !block->hasInterpolationFlagCF(D3Q27System::B)&& !block->hasInterpolationFlagCF(D3Q27System::W) && !block->hasInterpolationFlagCF(D3Q27System::S))
+      {
+         SPtr<Block3D> fblockSW = grid->getBlock(fbx1, fbx2, fbx3+0, level);
+         SPtr<Block3D> fblockSE;// = grid->getBlock(fbx1, fbx2, fbx3, level);
+         SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1, fbx2, fbx3+1, level);
+         SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1, fbx2, fbx3+1, level);
+
+         setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::BSW);
+      }
+      if (block->hasInterpolationFlagCF(D3Q27System::BSE)&& !block->hasInterpolationFlagCF(D3Q27System::BS)&& !block->hasInterpolationFlagCF(D3Q27System::BE)&& !block->hasInterpolationFlagCF(D3Q27System::SE)&& !block->hasInterpolationFlagCF(D3Q27System::B)&& !block->hasInterpolationFlagCF(D3Q27System::E) && !block->hasInterpolationFlagCF(D3Q27System::S))
+      {
+         SPtr<Block3D> fblockSW = grid->getBlock(fbx1+1, fbx2, fbx3, level);
+         SPtr<Block3D> fblockSE;// = grid->getBlock(fbx1+1, fbx2, fbx3+0, level);
+         SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1+1, fbx2, fbx3+1, level);
+         SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1+1, fbx2, fbx3+1, level);
+
+         setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::BSE);
+      }
+      if (block->hasInterpolationFlagCF(D3Q27System::BNW)&& !block->hasInterpolationFlagCF(D3Q27System::BN)&& !block->hasInterpolationFlagCF(D3Q27System::BW)&& !block->hasInterpolationFlagCF(D3Q27System::NW)&& !block->hasInterpolationFlagCF(D3Q27System::B)&& !block->hasInterpolationFlagCF(D3Q27System::N) && !block->hasInterpolationFlagCF(D3Q27System::W))
+      {
+         SPtr<Block3D> fblockSW = grid->getBlock(fbx1, fbx2+1, fbx3+0, level);
+         SPtr<Block3D> fblockSE;// = grid->getBlock(fbx1, fbx2+1, fbx3, level);
+         SPtr<Block3D> fblockNW;// = grid->getBlock(fbx1, fbx2+1, fbx3+1, level);
+         SPtr<Block3D> fblockNE;// = grid->getBlock(fbx1, fbx2+1, fbx3+1, level);
+
+         setInterpolationConnectors(fblockSW, fblockSE, fblockNW, fblockNE, block, D3Q27System::BNW);
+      }
+
+	}
+   UBLOG(logDEBUG5, "D3Q27SetConnectorsBlockVisitor::setInterpolationConnectors() - end");
+}
+//////////////////////////////////////////////////////////////////////////
+void SetConnectorsBlockVisitor::setInterpolationConnectors(SPtr<Block3D> fBlockSW, SPtr<Block3D> fBlockSE, SPtr<Block3D> fBlockNW, SPtr<Block3D> fBlockNE, SPtr<Block3D> cBlock, int dir)
+{
+   UBLOG(logDEBUG5, "D3Q27SetConnectorsBlockVisitor::setInterpolationConnectors(...) - start");
+	int fBlockSWRank = -999, fBlockSERank = -999, fBlockNWRank = -999, fBlockNERank = -999;
+	if(fBlockSW) fBlockSWRank = fBlockSW->getRank();
+	if(fBlockNW) fBlockNWRank = fBlockNW->getRank();
+	if(fBlockSE) fBlockSERank = fBlockSE->getRank();
+	if(fBlockNE) fBlockNERank = fBlockNE->getRank();
+	int cBlockRank   = cBlock->getRank();
+
+	LBMReal omegaF;
+	if(fBlockSW) omegaF =LBMSystem::calcCollisionFactor(nue, fBlockSW->getLevel());
+	if(fBlockNW) omegaF =LBMSystem::calcCollisionFactor(nue, fBlockNW->getLevel());
+	if(fBlockSE) omegaF =LBMSystem::calcCollisionFactor(nue, fBlockSE->getLevel());
+	if(fBlockNE) omegaF =LBMSystem::calcCollisionFactor(nue, fBlockNE->getLevel());
+	LBMReal omegaC = LBMSystem::calcCollisionFactor(nue, cBlock->getLevel());
+	iProcessor->setOmegas(omegaC, omegaF);
+
+	InterpolationProcessorPtr cIProcessor(iProcessor->clone());
+	InterpolationProcessorPtr fIProcessorSW(iProcessor->clone());
+	InterpolationProcessorPtr fIProcessorSE(iProcessor->clone());
+	InterpolationProcessorPtr fIProcessorNW(iProcessor->clone());
+	InterpolationProcessorPtr fIProcessorNE(iProcessor->clone());
+
+	CreateTransmittersHelper::TransmitterPtr senderCFevenEvenSW, receiverCFevenEvenSW, 
+		senderCFevenOddNW,  receiverCFevenOddNW, 
+		senderCFoddEvenSE,  receiverCFoddEvenSE, 
+		senderCFoddOddNE,   receiverCFoddOddNE,
+		senderFCevenEvenSW, receiverFCevenEvenSW, 
+		senderFCevenOddNW,  receiverFCevenOddNW, 
+		senderFCoddEvenSE,  receiverFCoddEvenSE, 
+		senderFCoddOddNE,   receiverFCoddOddNE;
+
+	if(fBlockSW) createTransmitters(cBlock, fBlockSW, dir, CreateTransmittersHelper::SW, senderCFevenEvenSW, receiverCFevenEvenSW, senderFCevenEvenSW, receiverFCevenEvenSW);
+	if(fBlockNW) createTransmitters(cBlock, fBlockNW, dir, CreateTransmittersHelper::NW, senderCFevenOddNW, receiverCFevenOddNW, senderFCevenOddNW, receiverFCevenOddNW);
+	if(fBlockSE) createTransmitters(cBlock, fBlockSE, dir, CreateTransmittersHelper::SE, senderCFoddEvenSE, receiverCFoddEvenSE, senderFCoddEvenSE, receiverFCoddEvenSE);
+	if(fBlockNE) createTransmitters(cBlock, fBlockNE, dir, CreateTransmittersHelper::NE, senderCFoddOddNE, receiverCFoddOddNE, senderFCoddOddNE, receiverFCoddOddNE);
+
+	if(cBlockRank == gridRank)
+	{
+      SPtr<Block3DConnector> connector(new D3Q27ETCFOffVectorConnector< TbTransmitter< CbVector< LBMReal > > >(cBlock,
+			senderCFevenEvenSW, receiverCFevenEvenSW, senderCFevenOddNW,  receiverCFevenOddNW, 
+			senderCFoddEvenSE,  receiverCFoddEvenSE,  senderCFoddOddNE,   receiverCFoddOddNE, 
+			dir, cIProcessor) );
+		cBlock->setConnector(connector);
+	}
+	if(fBlockSW && fBlockSWRank == gridRank)
+	{
+		SPtr<Block3DConnector> connector( new D3Q27ETFCOffVectorConnector< TbTransmitter< CbVector< LBMReal > > >(fBlockSW, 
+			senderFCevenEvenSW, receiverFCevenEvenSW, dir, fIProcessorSW, EvenEvenSW) );
+		fBlockSW->setConnector(connector);
+	}
+	if(fBlockNW && fBlockNWRank == gridRank)
+	{
+		SPtr<Block3DConnector> connector( new D3Q27ETFCOffVectorConnector< TbTransmitter< CbVector< LBMReal > > >(fBlockNW, 
+			senderFCevenOddNW, receiverFCevenOddNW, dir, fIProcessorNW, EvenOddNW) );
+		fBlockNW->setConnector(connector);
+	}
+	if(fBlockSE && fBlockSERank == gridRank)
+	{
+		SPtr<Block3DConnector> connector( new D3Q27ETFCOffVectorConnector< TbTransmitter< CbVector< LBMReal > > >(fBlockSE, 
+			senderFCoddEvenSE, receiverFCoddEvenSE, dir, fIProcessorSE, OddEvenSE) );
+		fBlockSE->setConnector(connector);
+	}
+	if(fBlockNE && fBlockNERank == gridRank)
+	{
+		SPtr<Block3DConnector> connector( new D3Q27ETFCOffVectorConnector< TbTransmitter< CbVector< LBMReal > > >(fBlockNE, 
+			senderFCoddOddNE, receiverFCoddOddNE, dir, fIProcessorNE, OddOddNE) );
+		fBlockNE->setConnector(connector);
+	}
+   UBLOG(logDEBUG5, "D3Q27SetConnectorsBlockVisitor::setInterpolationConnectors(...) - end");
+}
+//////////////////////////////////////////////////////////////////////////
+void SetConnectorsBlockVisitor::createTransmitters(SPtr<Block3D> cBlock, SPtr<Block3D> fBlock, int dir, 
+                                                        CreateTransmittersHelper::IBlock ib, 
+														              CreateTransmittersHelper::TransmitterPtr& senderCF, 
+														              CreateTransmittersHelper::TransmitterPtr& receiverCF, 
+														              CreateTransmittersHelper::TransmitterPtr& senderFC, 
+														              CreateTransmittersHelper::TransmitterPtr& receiverFC)
+{
+   UBLOG(logDEBUG5, "D3Q27SetConnectorsBlockVisitor::createTransmitters(...) - start");
+	CreateTransmittersHelper helper;
+	bool MPIpool = true;
+	bool orthogonal = false;
+	int fBlockRank = fBlock->getRank();
+	int cBlockRank = cBlock->getRank();
+	if(fBlockRank == cBlockRank && fBlockRank == gridRank)
+	{
+		senderCF = receiverFC = CreateTransmittersHelper::TransmitterPtr( new TbLocalTransmitter< CbVector< LBMReal > >());
+		senderFC = receiverCF = CreateTransmittersHelper::TransmitterPtr( new TbLocalTransmitter< CbVector< LBMReal > >());
+	}
+	else if(cBlockRank == gridRank)
+	{
+		helper.createTransmitters(cBlock, fBlock, dir, ib, senderCF, receiverCF, comm, CreateTransmittersHelper::MPI);
+	}
+	else if(fBlockRank == gridRank)
+	{
+		helper.createTransmitters(fBlock, cBlock, dir, ib, senderFC, receiverFC, comm, CreateTransmittersHelper::MPI);
+	}
+   UBLOG(logDEBUG5, "D3Q27SetConnectorsBlockVisitor::createTransmitters(...) - end");
+}
+
diff --git a/src/cpu/VirtualFluidsCore/Visitors/SetConnectorsBlockVisitor.h b/src/cpu/VirtualFluidsCore/Visitors/SetConnectorsBlockVisitor.h
index 2110967f65e8563fb028dfd5837943707a85759e..18d6b1f09a92fe45e47c7eeb4e8f777df821891b 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/SetConnectorsBlockVisitor.h
+++ b/src/cpu/VirtualFluidsCore/Visitors/SetConnectorsBlockVisitor.h
@@ -1,76 +1,76 @@
-//=======================================================================================
-// ____          ____    __    ______     __________   __      __       __        __         
-// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
-//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
-//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
-//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
-//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
-//      \    \  |    |   ________________________________________________________________    
-//       \    \ |    |  |  ______________________________________________________________|   
-//        \    \|    |  |  |         __          __     __     __     ______      _______    
-//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
-//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
-//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
-//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
-//
-//  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 SetConnectorsBlockVisitor.h
-//! \ingroup Visitors
-//! \author Konstantin Kutscher
-//=======================================================================================
-
-#ifndef SETCONNECTORSBLOCKVISITOR_H
-#define SETCONNECTORSBLOCKVISITOR_H
-
-#include <PointerDefinitions.h>
-
-#include "Block3DVisitor.h"
-#include "D3Q27System.h"
-
-#include "CreateTransmittersHelper.h"
-
-class Grid3D;
-class Block3D;
-class Communicator;
-class InterpolationProcessor;
-
-//! \brief  A class sets connectors between blocks.
-class SetConnectorsBlockVisitor : public Block3DVisitor
-{
-public:
-	SetConnectorsBlockVisitor(SPtr<Communicator> comm, bool fullConnector, int dirs, LBMReal nue, SPtr<InterpolationProcessor> iProcessor);
-	virtual ~SetConnectorsBlockVisitor();
-	void visit(SPtr<Grid3D> grid, SPtr<Block3D> block) override;
-	//////////////////////////////////////////////////////////////////////////
-protected:
-	void setSameLevelConnectors(SPtr<Grid3D> grid, SPtr<Block3D> block);
-	void setRemoteConnectors(SPtr<Block3D> sblock, SPtr<Block3D> tblock, int dir, bool fullConnector);
-	void setInterpolationConnectors(SPtr<Grid3D> grid, SPtr<Block3D> block);
-	void setInterpolationConnectors(SPtr<Block3D> fBlockSW, SPtr<Block3D> fBlockSE, SPtr<Block3D> fBlockNW, SPtr<Block3D> fBlockNE, SPtr<Block3D> cBlock, int dir);
-	void createTransmitters(SPtr<Block3D> cBlock, SPtr<Block3D> fBlock, int dir,
-      CreateTransmittersHelper::IBlock ib,
-		CreateTransmittersHelper::TransmitterPtr& senderCF, 
-		CreateTransmittersHelper::TransmitterPtr& receiverCF, 
-		CreateTransmittersHelper::TransmitterPtr& senderFC, 
-		CreateTransmittersHelper::TransmitterPtr& receiverFC);
-    SPtr<Communicator> comm;
-	bool fullConnector;
-	int dirs;
-	int gridRank;
-	LBMReal nue;
-    SPtr<InterpolationProcessor> iProcessor;
-};
-
-#endif //SETCONNECTORSBLOCKVISITOR_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 SetConnectorsBlockVisitor.h
+//! \ingroup Visitors
+//! \author Konstantin Kutscher
+//=======================================================================================
+
+#ifndef SETCONNECTORSBLOCKVISITOR_H
+#define SETCONNECTORSBLOCKVISITOR_H
+
+#include <PointerDefinitions.h>
+
+#include "Block3DVisitor.h"
+#include "D3Q27System.h"
+
+#include "CreateTransmittersHelper.h"
+
+class Grid3D;
+class Block3D;
+class Communicator;
+class InterpolationProcessor;
+
+//! \brief  A class sets connectors between blocks.
+class SetConnectorsBlockVisitor : public Block3DVisitor
+{
+public:
+	SetConnectorsBlockVisitor(SPtr<Communicator> comm, bool fullConnector, int dirs, LBMReal nue, SPtr<InterpolationProcessor> iProcessor);
+	virtual ~SetConnectorsBlockVisitor();
+	void visit(SPtr<Grid3D> grid, SPtr<Block3D> block) override;
+	//////////////////////////////////////////////////////////////////////////
+protected:
+	void setSameLevelConnectors(SPtr<Grid3D> grid, SPtr<Block3D> block);
+	void setRemoteConnectors(SPtr<Block3D> sblock, SPtr<Block3D> tblock, int dir, bool fullConnector);
+	void setInterpolationConnectors(SPtr<Grid3D> grid, SPtr<Block3D> block);
+	void setInterpolationConnectors(SPtr<Block3D> fBlockSW, SPtr<Block3D> fBlockSE, SPtr<Block3D> fBlockNW, SPtr<Block3D> fBlockNE, SPtr<Block3D> cBlock, int dir);
+	void createTransmitters(SPtr<Block3D> cBlock, SPtr<Block3D> fBlock, int dir,
+      CreateTransmittersHelper::IBlock ib,
+		CreateTransmittersHelper::TransmitterPtr& senderCF, 
+		CreateTransmittersHelper::TransmitterPtr& receiverCF, 
+		CreateTransmittersHelper::TransmitterPtr& senderFC, 
+		CreateTransmittersHelper::TransmitterPtr& receiverFC);
+    SPtr<Communicator> comm;
+	bool fullConnector;
+	int dirs;
+	int gridRank;
+	LBMReal nue;
+    SPtr<InterpolationProcessor> iProcessor;
+};
+
+#endif //SETCONNECTORSBLOCKVISITOR_H
diff --git a/src/cpu/VirtualFluidsCore/Visitors/SetForcingBlockVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/SetForcingBlockVisitor.cpp
index 100ee2fe499f691484017f60654ad922be3f9d5d..ec83d8de4786d24f712ca9aaa5aeb8b31294c593 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/SetForcingBlockVisitor.cpp
+++ b/src/cpu/VirtualFluidsCore/Visitors/SetForcingBlockVisitor.cpp
@@ -1,70 +1,70 @@
-#include "SetForcingBlockVisitor.h"
-#include "Grid3DSystem.h"
-#include "LBMSystem.h"
-#include "Grid3D.h"
-#include "Block3D.h"
-
-SetForcingBlockVisitor::SetForcingBlockVisitor(LBMReal forcingX1, LBMReal forcingX2, LBMReal forcingX3) : 
-                        Block3DVisitor(0, Grid3DSystem::MAXLEVEL), forcingX1(forcingX1), 
-                                                                   forcingX2(forcingX2),
-                                                                   forcingX3(forcingX3)
-{
-   ftype = 0;
-}
-//////////////////////////////////////////////////////////////////////////
-SetForcingBlockVisitor::SetForcingBlockVisitor(const mu::Parser& muForcingX1, const mu::Parser& muForcingX2, const mu::Parser& muForcingX3) : 
-                                              Block3DVisitor(0, Grid3DSystem::MAXLEVEL), muForcingX1(muForcingX1),
-                                                                                         muForcingX2(muForcingX2),
-                                                                                         muForcingX3(muForcingX3)
-
-{
-   ftype = 1;
-}
-//////////////////////////////////////////////////////////////////////////
-SetForcingBlockVisitor::SetForcingBlockVisitor(const std::string& sForcingX1, const std::string& sForcingX2, const std::string& sForcingX3) : 
-                                             Block3DVisitor(0, Grid3DSystem::MAXLEVEL), sForcingX1(sForcingX1),
-                                                                                        sForcingX2(sForcingX2),
-                                                                                        sForcingX3(sForcingX3)
-
-{
-   ftype = 2;
-}
-//////////////////////////////////////////////////////////////////////////
-void SetForcingBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block)
-{
-   if(block->getRank() == grid->getRank())
-   {
-      SPtr<LBMKernel> kernel = dynamicPointerCast<LBMKernel>(block->getKernel());
-      if (!kernel)
-         throw UbException(UB_EXARGS, "LBMKernel is not exist");
-
-      switch (ftype)
-      {
-      case 0:
-         kernel->setForcingX1(forcingX1);
-         kernel->setForcingX2(forcingX2);
-         kernel->setForcingX3(forcingX3);
-         kernel->setWithForcing(true);
-         break;
-      case 1:
-         kernel->setForcingX1(muForcingX1);
-         kernel->setForcingX2(muForcingX2);
-         kernel->setForcingX3(muForcingX3);
-         kernel->setWithForcing(true);
-         break;
-      case 2:
-         kernel->setForcingX1(sForcingX1);
-         kernel->setForcingX2(sForcingX2);
-         kernel->setForcingX3(sForcingX3);
-         kernel->setWithForcing(true);
-         break;
-      default:
-         kernel->setForcingX1(0.0);
-         kernel->setForcingX2(0.0);
-         kernel->setForcingX3(0.0);
-         kernel->setWithForcing(false);
-         break;
-      }
-   }
-}
-
+#include "SetForcingBlockVisitor.h"
+#include "Grid3DSystem.h"
+#include "LBMSystem.h"
+#include "Grid3D.h"
+#include "Block3D.h"
+
+SetForcingBlockVisitor::SetForcingBlockVisitor(LBMReal forcingX1, LBMReal forcingX2, LBMReal forcingX3) : 
+                        Block3DVisitor(0, Grid3DSystem::MAXLEVEL), forcingX1(forcingX1), 
+                                                                   forcingX2(forcingX2),
+                                                                   forcingX3(forcingX3)
+{
+   ftype = 0;
+}
+//////////////////////////////////////////////////////////////////////////
+SetForcingBlockVisitor::SetForcingBlockVisitor(const mu::Parser& muForcingX1, const mu::Parser& muForcingX2, const mu::Parser& muForcingX3) : 
+                                              Block3DVisitor(0, Grid3DSystem::MAXLEVEL), muForcingX1(muForcingX1),
+                                                                                         muForcingX2(muForcingX2),
+                                                                                         muForcingX3(muForcingX3)
+
+{
+   ftype = 1;
+}
+//////////////////////////////////////////////////////////////////////////
+SetForcingBlockVisitor::SetForcingBlockVisitor(const std::string& sForcingX1, const std::string& sForcingX2, const std::string& sForcingX3) : 
+                                             Block3DVisitor(0, Grid3DSystem::MAXLEVEL), sForcingX1(sForcingX1),
+                                                                                        sForcingX2(sForcingX2),
+                                                                                        sForcingX3(sForcingX3)
+
+{
+   ftype = 2;
+}
+//////////////////////////////////////////////////////////////////////////
+void SetForcingBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block)
+{
+   if(block->getRank() == grid->getRank())
+   {
+      SPtr<LBMKernel> kernel = dynamicPointerCast<LBMKernel>(block->getKernel());
+      if (!kernel)
+         throw UbException(UB_EXARGS, "LBMKernel is not exist");
+
+      switch (ftype)
+      {
+      case 0:
+         kernel->setForcingX1(forcingX1);
+         kernel->setForcingX2(forcingX2);
+         kernel->setForcingX3(forcingX3);
+         kernel->setWithForcing(true);
+         break;
+      case 1:
+         kernel->setForcingX1(muForcingX1);
+         kernel->setForcingX2(muForcingX2);
+         kernel->setForcingX3(muForcingX3);
+         kernel->setWithForcing(true);
+         break;
+      case 2:
+         kernel->setForcingX1(sForcingX1);
+         kernel->setForcingX2(sForcingX2);
+         kernel->setForcingX3(sForcingX3);
+         kernel->setWithForcing(true);
+         break;
+      default:
+         kernel->setForcingX1(0.0);
+         kernel->setForcingX2(0.0);
+         kernel->setForcingX3(0.0);
+         kernel->setWithForcing(false);
+         break;
+      }
+   }
+}
+
diff --git a/src/cpu/VirtualFluidsCore/Visitors/SetForcingBlockVisitor.h b/src/cpu/VirtualFluidsCore/Visitors/SetForcingBlockVisitor.h
index 12a9265f38cd0d88245059752e5716dcad26fb40..f8406c31a30611ba663e8b2cdbbb3ebf3280b794 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/SetForcingBlockVisitor.h
+++ b/src/cpu/VirtualFluidsCore/Visitors/SetForcingBlockVisitor.h
@@ -1,39 +1,39 @@
-#ifndef SetForcingBlockVisitor_h
-#define SetForcingBlockVisitor_h
-
-#include "Block3DVisitor.h"
-#include "LBMKernel.h"
-
-class Block3D;
-class Grid3D;
-
-//! \brief Set forcing for all kernels of grid
-//! \details This visitor is useful if you need to set or reset forcing in kernels (e.g. after restart because forcing is not serializable). 
-//! \author K. Kucher
-class SetForcingBlockVisitor : public Block3DVisitor
-{
-public:
-   SetForcingBlockVisitor(LBMReal forcingX1, LBMReal forcingX2, LBMReal forcingX3);
-   
-   SetForcingBlockVisitor(const mu::Parser& muForcingX1, const mu::Parser& muForcingX2, const mu::Parser& muForcingX3);
-
-   SetForcingBlockVisitor(const std::string& sForcingX1, const std::string& sForcingX2, const std::string& sForcingX3);
-
-   virtual ~SetForcingBlockVisitor() {}
-
-   virtual void visit(SPtr<Grid3D> grid, SPtr<Block3D> block) override;
-
-private:
-   int ftype;
-   LBMReal forcingX1;
-   LBMReal forcingX2;
-   LBMReal forcingX3;
-   mu::Parser muForcingX1;
-   mu::Parser muForcingX2;
-   mu::Parser muForcingX3;
-   std::string sForcingX1;
-   std::string sForcingX2;
-   std::string sForcingX3;
-};
-
-#endif
+#ifndef SetForcingBlockVisitor_h
+#define SetForcingBlockVisitor_h
+
+#include "Block3DVisitor.h"
+#include "LBMKernel.h"
+
+class Block3D;
+class Grid3D;
+
+//! \brief Set forcing for all kernels of grid
+//! \details This visitor is useful if you need to set or reset forcing in kernels (e.g. after restart because forcing is not serializable). 
+//! \author K. Kucher
+class SetForcingBlockVisitor : public Block3DVisitor
+{
+public:
+   SetForcingBlockVisitor(LBMReal forcingX1, LBMReal forcingX2, LBMReal forcingX3);
+   
+   SetForcingBlockVisitor(const mu::Parser& muForcingX1, const mu::Parser& muForcingX2, const mu::Parser& muForcingX3);
+
+   SetForcingBlockVisitor(const std::string& sForcingX1, const std::string& sForcingX2, const std::string& sForcingX3);
+
+   virtual ~SetForcingBlockVisitor() {}
+
+   virtual void visit(SPtr<Grid3D> grid, SPtr<Block3D> block) override;
+
+private:
+   int ftype;
+   LBMReal forcingX1;
+   LBMReal forcingX2;
+   LBMReal forcingX3;
+   mu::Parser muForcingX1;
+   mu::Parser muForcingX2;
+   mu::Parser muForcingX3;
+   std::string sForcingX1;
+   std::string sForcingX2;
+   std::string sForcingX3;
+};
+
+#endif
diff --git a/src/cpu/VirtualFluidsCore/Visitors/SetInterpolationDirsBlockVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/SetInterpolationDirsBlockVisitor.cpp
index f981269566bffdc3797866faecaa6b5eedab4c16..eeb1ba6911ac7c29fbfe6f8fa82a74213f4d1f8d 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/SetInterpolationDirsBlockVisitor.cpp
+++ b/src/cpu/VirtualFluidsCore/Visitors/SetInterpolationDirsBlockVisitor.cpp
@@ -1,162 +1,162 @@
-#include "SetInterpolationDirsBlockVisitor.h"
-#include "Grid3DSystem.h"
-#include <D3Q27System.h>
-#include "Grid3D.h"
-#include "Block3D.h"
-
-
-SetInterpolationDirsBlockVisitor::SetInterpolationDirsBlockVisitor(std::vector<int>& dirs) : 
-   Block3DVisitor(0, Grid3DSystem::MAXLEVEL), dirs(dirs)
-{
-
-}
-//////////////////////////////////////////////////////////////////////////
-void SetInterpolationDirsBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block)
-{
-   int ix1, ix2, ix3, level;
-   ix1 = block->getX1();
-   ix2 = block->getX2();
-   ix3 = block->getX3();
-   level = block->getLevel();
-   using namespace D3Q27System;
-   if(level==0) return;
-
-   SPtr<Block3D> parentblock = grid->getSuperBlock(ix1,ix2,ix3,level);
-   if(!parentblock) return;
-
-   for(int dir : dirs)
-   {
-      SPtr<Block3D> nblock = grid->getNeighborBlock(dir, ix1, ix2, ix3, level);
-      if(!nblock)
-      {
-         SPtr<Block3D> p_nblock = grid->getNeighborBlock(dir, parentblock);
-
-         if (p_nblock)
-         {
-            bool flagDir;
-            switch (dir)
-            {
-            case NE: 
-               checkFlagDir(grid, E, N, flagDir, ix1, ix2, ix3, level);
-               if(!flagDir) continue;
-               break;
-            case SW: 
-               checkFlagDir(grid, W, S, flagDir, ix1, ix2, ix3, level);
-               if(!flagDir) continue;
-               break;
-            case SE: 
-               checkFlagDir(grid, E, S, flagDir, ix1, ix2, ix3, level);
-               if(!flagDir) continue;
-               break;
-            case NW: 
-               checkFlagDir(grid, W, N, flagDir, ix1, ix2, ix3, level);
-               if(!flagDir) continue;
-               break;
-            case TE: 
-               checkFlagDir(grid, E, T, flagDir, ix1, ix2, ix3, level);
-               if(!flagDir)continue;
-               break;
-            case BW: 
-               checkFlagDir(grid, W, B, flagDir, ix1, ix2, ix3, level);
-               if(!flagDir) continue;
-               break;
-            case BE: 
-               checkFlagDir(grid, E, B, flagDir, ix1, ix2, ix3, level);
-               if(!flagDir) continue;
-               break;
-            case TW: 
-               checkFlagDir(grid, W, T, flagDir, ix1, ix2, ix3, level);
-               if(!flagDir) continue;
-               break;
-            case TN: 
-               checkFlagDir(grid, N, T, flagDir, ix1, ix2, ix3, level);
-               if(!flagDir) continue;
-               break;
-            case BS: 
-               checkFlagDir(grid, S, B, flagDir, ix1, ix2, ix3, level);
-               if(!flagDir) continue;
-               break;
-            case BN: 
-               checkFlagDir(grid, N, B, flagDir, ix1, ix2, ix3, level);
-               if(!flagDir) continue;
-               break;
-            case TS: 
-               checkFlagDir(grid, S, T, flagDir, ix1, ix2, ix3, level);
-               if(!flagDir) continue;
-               break;
-            case TNE:
-               checkFlagDir(grid, E, N, T, flagDir, ix1, ix2, ix3, level);
-               if (!flagDir) continue;
-               break;
-            case TSW:
-               checkFlagDir(grid, W, S, T, flagDir, ix1, ix2, ix3, level);
-               if (!flagDir) continue;
-               break;
-            case TSE:
-               checkFlagDir(grid, E, S, T, flagDir, ix1, ix2, ix3, level);
-               if (!flagDir) continue;
-               break;
-            case TNW:
-               checkFlagDir(grid, W, N, T, flagDir, ix1, ix2, ix3, level);
-               if (!flagDir) continue;
-               break;
-            case BNE:
-               checkFlagDir(grid, E, N, B, flagDir, ix1, ix2, ix3, level);
-               if (!flagDir) continue;
-               break;
-            case BSW:
-               checkFlagDir(grid, W, S, B, flagDir, ix1, ix2, ix3, level);
-               if (!flagDir) continue;
-               break;
-            case BSE:
-               checkFlagDir(grid, E, S, B, flagDir, ix1, ix2, ix3, level);
-               if (!flagDir) continue;
-               break;
-            case BNW:
-               checkFlagDir(grid, W, N, B, flagDir, ix1, ix2, ix3, level);
-               if (!flagDir) continue;
-               break;
-            }
-
-            block->setInterpolationFlagFC(dir);
-            parentblock->setInterpolationFlagCF(dir);
-         }
-      }
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-//void SetInterpolationDirsBlockVisitor::checkFlagDir(SPtr<Grid3D> grid, int dir1, int dir2, bool &flagDirection, int ix1, int ix2, int ix3, int level)
-//{
-//   SPtr<Block3D> block1 = grid->getNeighborBlock(dir1, ix1, ix2, ix3, level);
-//   SPtr<Block3D> block2 = grid->getNeighborBlock(dir2, ix1, ix2, ix3, level);
-//   if (!((block1 && block2)  ||  (!block1 && !block2)))
-//      flagDirection = false;
-//   else
-//      flagDirection = true;
-//}
-
-void SetInterpolationDirsBlockVisitor::checkFlagDir(SPtr<Grid3D> grid, int dir1, int dir2, bool &flagDirection, int ix1, int ix2, int ix3, int level)
-{
-   SPtr<Block3D> block1 = grid->getNeighborBlock(dir1, ix1, ix2, ix3, level);
-   SPtr<Block3D> block2 = grid->getNeighborBlock(dir2, ix1, ix2, ix3, level);
-
-   SPtr<Block3D> pblock = grid->getSuperBlock(ix1,ix2,ix3,level);
-   SPtr<Block3D> pblock1 = grid->getNeighborBlock(dir1, pblock);
-   SPtr<Block3D> pblock2 = grid->getNeighborBlock(dir2, pblock);
-
-   if (!((block1 && block2)||(!block1 && !block2)) || !((pblock1 && pblock2)||(!pblock1 && !pblock2)))
-      flagDirection = false;
-   else
-      flagDirection = true;
-}
-//////////////////////////////////////////////////////////////////////////
-void SetInterpolationDirsBlockVisitor::checkFlagDir(SPtr<Grid3D> grid, int dir1, int dir2, int dir3, bool &flagDirection, int ix1, int ix2, int ix3, int level)
-{
-   SPtr<Block3D> block1 = grid->getNeighborBlock(dir1, ix1, ix2, ix3, level);
-   SPtr<Block3D> block2 = grid->getNeighborBlock(dir2, ix1, ix2, ix3, level);
-   SPtr<Block3D> block3 = grid->getNeighborBlock(dir3, ix1, ix2, ix3, level);
-   if (!((block1 && block2 && block3)  ||  (!block1 && !block2 && !block3)))
-      flagDirection=false;
-   else 
-      flagDirection=true;
-}
+#include "SetInterpolationDirsBlockVisitor.h"
+#include "Grid3DSystem.h"
+#include <D3Q27System.h>
+#include "Grid3D.h"
+#include "Block3D.h"
+
+
+SetInterpolationDirsBlockVisitor::SetInterpolationDirsBlockVisitor(std::vector<int>& dirs) : 
+   Block3DVisitor(0, Grid3DSystem::MAXLEVEL), dirs(dirs)
+{
+
+}
+//////////////////////////////////////////////////////////////////////////
+void SetInterpolationDirsBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block)
+{
+   int ix1, ix2, ix3, level;
+   ix1 = block->getX1();
+   ix2 = block->getX2();
+   ix3 = block->getX3();
+   level = block->getLevel();
+   using namespace D3Q27System;
+   if(level==0) return;
+
+   SPtr<Block3D> parentblock = grid->getSuperBlock(ix1,ix2,ix3,level);
+   if(!parentblock) return;
+
+   for(int dir : dirs)
+   {
+      SPtr<Block3D> nblock = grid->getNeighborBlock(dir, ix1, ix2, ix3, level);
+      if(!nblock)
+      {
+         SPtr<Block3D> p_nblock = grid->getNeighborBlock(dir, parentblock);
+
+         if (p_nblock)
+         {
+            bool flagDir;
+            switch (dir)
+            {
+            case NE: 
+               checkFlagDir(grid, E, N, flagDir, ix1, ix2, ix3, level);
+               if(!flagDir) continue;
+               break;
+            case SW: 
+               checkFlagDir(grid, W, S, flagDir, ix1, ix2, ix3, level);
+               if(!flagDir) continue;
+               break;
+            case SE: 
+               checkFlagDir(grid, E, S, flagDir, ix1, ix2, ix3, level);
+               if(!flagDir) continue;
+               break;
+            case NW: 
+               checkFlagDir(grid, W, N, flagDir, ix1, ix2, ix3, level);
+               if(!flagDir) continue;
+               break;
+            case TE: 
+               checkFlagDir(grid, E, T, flagDir, ix1, ix2, ix3, level);
+               if(!flagDir)continue;
+               break;
+            case BW: 
+               checkFlagDir(grid, W, B, flagDir, ix1, ix2, ix3, level);
+               if(!flagDir) continue;
+               break;
+            case BE: 
+               checkFlagDir(grid, E, B, flagDir, ix1, ix2, ix3, level);
+               if(!flagDir) continue;
+               break;
+            case TW: 
+               checkFlagDir(grid, W, T, flagDir, ix1, ix2, ix3, level);
+               if(!flagDir) continue;
+               break;
+            case TN: 
+               checkFlagDir(grid, N, T, flagDir, ix1, ix2, ix3, level);
+               if(!flagDir) continue;
+               break;
+            case BS: 
+               checkFlagDir(grid, S, B, flagDir, ix1, ix2, ix3, level);
+               if(!flagDir) continue;
+               break;
+            case BN: 
+               checkFlagDir(grid, N, B, flagDir, ix1, ix2, ix3, level);
+               if(!flagDir) continue;
+               break;
+            case TS: 
+               checkFlagDir(grid, S, T, flagDir, ix1, ix2, ix3, level);
+               if(!flagDir) continue;
+               break;
+            case TNE:
+               checkFlagDir(grid, E, N, T, flagDir, ix1, ix2, ix3, level);
+               if (!flagDir) continue;
+               break;
+            case TSW:
+               checkFlagDir(grid, W, S, T, flagDir, ix1, ix2, ix3, level);
+               if (!flagDir) continue;
+               break;
+            case TSE:
+               checkFlagDir(grid, E, S, T, flagDir, ix1, ix2, ix3, level);
+               if (!flagDir) continue;
+               break;
+            case TNW:
+               checkFlagDir(grid, W, N, T, flagDir, ix1, ix2, ix3, level);
+               if (!flagDir) continue;
+               break;
+            case BNE:
+               checkFlagDir(grid, E, N, B, flagDir, ix1, ix2, ix3, level);
+               if (!flagDir) continue;
+               break;
+            case BSW:
+               checkFlagDir(grid, W, S, B, flagDir, ix1, ix2, ix3, level);
+               if (!flagDir) continue;
+               break;
+            case BSE:
+               checkFlagDir(grid, E, S, B, flagDir, ix1, ix2, ix3, level);
+               if (!flagDir) continue;
+               break;
+            case BNW:
+               checkFlagDir(grid, W, N, B, flagDir, ix1, ix2, ix3, level);
+               if (!flagDir) continue;
+               break;
+            }
+
+            block->setInterpolationFlagFC(dir);
+            parentblock->setInterpolationFlagCF(dir);
+         }
+      }
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+//void SetInterpolationDirsBlockVisitor::checkFlagDir(SPtr<Grid3D> grid, int dir1, int dir2, bool &flagDirection, int ix1, int ix2, int ix3, int level)
+//{
+//   SPtr<Block3D> block1 = grid->getNeighborBlock(dir1, ix1, ix2, ix3, level);
+//   SPtr<Block3D> block2 = grid->getNeighborBlock(dir2, ix1, ix2, ix3, level);
+//   if (!((block1 && block2)  ||  (!block1 && !block2)))
+//      flagDirection = false;
+//   else
+//      flagDirection = true;
+//}
+
+void SetInterpolationDirsBlockVisitor::checkFlagDir(SPtr<Grid3D> grid, int dir1, int dir2, bool &flagDirection, int ix1, int ix2, int ix3, int level)
+{
+   SPtr<Block3D> block1 = grid->getNeighborBlock(dir1, ix1, ix2, ix3, level);
+   SPtr<Block3D> block2 = grid->getNeighborBlock(dir2, ix1, ix2, ix3, level);
+
+   SPtr<Block3D> pblock = grid->getSuperBlock(ix1,ix2,ix3,level);
+   SPtr<Block3D> pblock1 = grid->getNeighborBlock(dir1, pblock);
+   SPtr<Block3D> pblock2 = grid->getNeighborBlock(dir2, pblock);
+
+   if (!((block1 && block2)||(!block1 && !block2)) || !((pblock1 && pblock2)||(!pblock1 && !pblock2)))
+      flagDirection = false;
+   else
+      flagDirection = true;
+}
+//////////////////////////////////////////////////////////////////////////
+void SetInterpolationDirsBlockVisitor::checkFlagDir(SPtr<Grid3D> grid, int dir1, int dir2, int dir3, bool &flagDirection, int ix1, int ix2, int ix3, int level)
+{
+   SPtr<Block3D> block1 = grid->getNeighborBlock(dir1, ix1, ix2, ix3, level);
+   SPtr<Block3D> block2 = grid->getNeighborBlock(dir2, ix1, ix2, ix3, level);
+   SPtr<Block3D> block3 = grid->getNeighborBlock(dir3, ix1, ix2, ix3, level);
+   if (!((block1 && block2 && block3)  ||  (!block1 && !block2 && !block3)))
+      flagDirection=false;
+   else 
+      flagDirection=true;
+}
diff --git a/src/cpu/VirtualFluidsCore/Visitors/SetInterpolationDirsBlockVisitor.h b/src/cpu/VirtualFluidsCore/Visitors/SetInterpolationDirsBlockVisitor.h
index 7519f9057658b75e70e1f707eea38444fe9bef54..faca2e5fdf9e75de3d2ae97c2f3bbc806edf23b2 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/SetInterpolationDirsBlockVisitor.h
+++ b/src/cpu/VirtualFluidsCore/Visitors/SetInterpolationDirsBlockVisitor.h
@@ -1,27 +1,27 @@
-#ifndef SetInterpolationDirsBlockVisitor_h
-#define SetInterpolationDirsBlockVisitor_h
-
-#include <vector>
-#include <PointerDefinitions.h>
-
-#include "Block3DVisitor.h"
-
-class Grid3D;
-class Block3D;
-
-class SetInterpolationDirsBlockVisitor : public Block3DVisitor
-{
-public:
-   SetInterpolationDirsBlockVisitor(std::vector<int>& dirs);
-
-   virtual ~SetInterpolationDirsBlockVisitor() {}
-
-   void visit(SPtr<Grid3D> grid, SPtr<Block3D> block) override;
-
-private:
-   std::vector<int> dirs;
-   void checkFlagDir(SPtr<Grid3D> grid, int dir1, int dir2, bool &flagDirection, int ix1, int ix2, int ix3, int level);
-   void checkFlagDir(SPtr<Grid3D> grid, int dir1, int dir2, int dir3, bool &flagDirection, int ix1, int ix2, int ix3, int level);
-};
-
-#endif
+#ifndef SetInterpolationDirsBlockVisitor_h
+#define SetInterpolationDirsBlockVisitor_h
+
+#include <vector>
+#include <PointerDefinitions.h>
+
+#include "Block3DVisitor.h"
+
+class Grid3D;
+class Block3D;
+
+class SetInterpolationDirsBlockVisitor : public Block3DVisitor
+{
+public:
+   SetInterpolationDirsBlockVisitor(std::vector<int>& dirs);
+
+   virtual ~SetInterpolationDirsBlockVisitor() {}
+
+   void visit(SPtr<Grid3D> grid, SPtr<Block3D> block) override;
+
+private:
+   std::vector<int> dirs;
+   void checkFlagDir(SPtr<Grid3D> grid, int dir1, int dir2, bool &flagDirection, int ix1, int ix2, int ix3, int level);
+   void checkFlagDir(SPtr<Grid3D> grid, int dir1, int dir2, int dir3, bool &flagDirection, int ix1, int ix2, int ix3, int level);
+};
+
+#endif
diff --git a/src/cpu/VirtualFluidsCore/Visitors/SetKernelBlockVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/SetKernelBlockVisitor.cpp
index c7868e9b9156a3dc30fb9e42aaa39783a22fa387..3209dbe06f1bd385883fc3bf6504cb74d4bc5bb3 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/SetKernelBlockVisitor.cpp
+++ b/src/cpu/VirtualFluidsCore/Visitors/SetKernelBlockVisitor.cpp
@@ -1,163 +1,163 @@
-#include "MemoryUtil.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 SetKernelBlockVisitor.cpp
-//! \ingroup Visitors
-//! \author Konstantin Kutscher
-//=======================================================================================
-
-#include "SetKernelBlockVisitor.h"
-#include "Grid3DSystem.h"
-#include "LBMSystem.h"
-#include "DataSet3D.h"
-#include "BCProcessor.h"
-#include "Grid3D.h"
-#include "Block3D.h"
-#include "LBMKernel.h"
-
-//////////////////////////////////////////////////////////////////////////
-SetKernelBlockVisitor::SetKernelBlockVisitor(SPtr<LBMKernel> kernel, LBMReal nue, double availMem, double needMem,
-                                             SetKernelBlockVisitor::Action action) : Block3DVisitor(0,
-                                                                                                    Grid3DSystem::MAXLEVEL),
-                                                                                     kernel(kernel), nue(nue),
-                                                                                     action(action), dataSetFlag(true)
-{
-    if (needMem > availMem)
-    {
-        throw UbException(UB_EXARGS, "SetKernelBlockVisitor: Not enough memory!!!");
-    }
-}
-
-SetKernelBlockVisitor::SetKernelBlockVisitor(SPtr<LBMKernel> kernel,
-                                             LBMReal nue,
-                                             int &numberOfProcesses,
-                                             SetKernelBlockVisitor::Action action) : Block3DVisitor(0,
-                                                                                                    Grid3DSystem::MAXLEVEL),
-                                                                                     kernel(std::move(kernel)),
-                                                                                     nue(nue),
-                                                                                     action(action),
-                                                                                     dataSetFlag(true),
-                                                                                     numberOfProcesses(
-                                                                                             numberOfProcesses)
-{}
-
-//////////////////////////////////////////////////////////////////////////
-void SetKernelBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block)
-{
-    throwExceptionIfNotEnoughMemory(grid);
-
-    if (kernel && (block->getRank() == grid->getRank()))
-    {
-        LBMReal collFactor = LBMSystem::calcCollisionFactor(nue, block->getLevel());
-        kernel->setCollisionFactor(collFactor);
-        kernel->setIndex(block->getX1(), block->getX2(), block->getX3());
-        kernel->setDeltaT(LBMSystem::getDeltaT(block->getLevel()));
-        kernel->setBlock(block);
-        UbTupleInt3 blockNX = grid->getBlockNX();
-        kernel->setNX(std::array<int, 3>{{val<1>(blockNX), val<2>(blockNX), val<3>(blockNX)}});
-        SPtr<LBMKernel> newKernel = kernel->clone();
-
-        switch (action)
-        {
-            case SetKernelBlockVisitor::NewKernel:
-                block->setKernel(newKernel);
-                break;
-            case SetKernelBlockVisitor::ChangeKernel:
-            {
-                SPtr<DataSet3D> dataSet = block->getKernel()->getDataSet();
-                if (!dataSet)
-                {
-                    UB_THROW(UbException(UB_EXARGS,
-                                         "It is not possible to change a DataSet in kernel! Old DataSet is not exist!"));
-                }
-
-                newKernel->setDataSet(dataSet);
-
-                SPtr<BCProcessor> bcProc = block->getKernel()->getBCProcessor();
-                if (!bcProc)
-                {
-                    UB_THROW(UbException(UB_EXARGS,
-                                         "It is not possible to change a BCProcessor in kernel! Old BCProcessor is not exist!"));
-                }
-                newKernel->setBCProcessor(bcProc);
-                block->setKernel(newKernel);
-            }
-                break;
-
-            case SetKernelBlockVisitor::ChangeKernelWithData:
-            {
-                SPtr<BCProcessor> bcProc = block->getKernel()->getBCProcessor();
-                if (!bcProc)
-                {
-                    UB_THROW(UbException(UB_EXARGS,
-                                         "It is not possible to change a BCProcessor in kernel! Old BCProcessor is not exist!"));
-                }
-                newKernel->setBCProcessor(bcProc);
-                block->setKernel(newKernel);
-            }
-                break;
-        }
-
-    }
-}
-
-
-void SetKernelBlockVisitor::setNoDataSetFlag(bool flag)
-{
-    dataSetFlag = flag;
-}
-
-void SetKernelBlockVisitor::throwExceptionIfNotEnoughMemory(const SPtr<Grid3D> &grid)
-{
-    auto availableMemory = Utilities::getTotalPhysMem();
-    auto requiredMemory = getRequiredPhysicalMemory(grid);
-    if (requiredMemory > availableMemory)
-        throw UbException(UB_EXARGS, "SetKernelBlockVisitor: Not enough memory!!!");
-}
-
-double SetKernelBlockVisitor::getRequiredPhysicalMemory(const SPtr<Grid3D> &grid) const
-{
-    unsigned long long numberOfNodesPerBlockWithGhostLayer;
-    auto numberOfBlocks = (unsigned long long) grid->getNumberOfBlocks();
-    auto blockNx = grid->getBlockNX();
-    int ghostLayer = 3;
-
-    numberOfNodesPerBlockWithGhostLayer = numberOfBlocks
-                                          * (val<1>(blockNx) + ghostLayer)
-                                          * (val<2>(blockNx) + ghostLayer)
-                                          * (val<3>(blockNx) + ghostLayer);
-
-    auto needMemAll = double(numberOfNodesPerBlockWithGhostLayer
-                             * (27 * sizeof(double)
-                                + sizeof(int)
-                                + sizeof(float) * 4));
-
-    return needMemAll / double(numberOfProcesses);
-}
-
+#include "MemoryUtil.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 SetKernelBlockVisitor.cpp
+//! \ingroup Visitors
+//! \author Konstantin Kutscher
+//=======================================================================================
+
+#include "SetKernelBlockVisitor.h"
+#include "Grid3DSystem.h"
+#include "LBMSystem.h"
+#include "DataSet3D.h"
+#include "BCProcessor.h"
+#include "Grid3D.h"
+#include "Block3D.h"
+#include "LBMKernel.h"
+
+//////////////////////////////////////////////////////////////////////////
+SetKernelBlockVisitor::SetKernelBlockVisitor(SPtr<LBMKernel> kernel, LBMReal nue, double availMem, double needMem,
+                                             SetKernelBlockVisitor::Action action) : Block3DVisitor(0,
+                                                                                                    Grid3DSystem::MAXLEVEL),
+                                                                                     kernel(kernel), nue(nue),
+                                                                                     action(action), dataSetFlag(true)
+{
+    if (needMem > availMem)
+    {
+        throw UbException(UB_EXARGS, "SetKernelBlockVisitor: Not enough memory!!!");
+    }
+}
+
+SetKernelBlockVisitor::SetKernelBlockVisitor(SPtr<LBMKernel> kernel,
+                                             LBMReal nue,
+                                             int &numberOfProcesses,
+                                             SetKernelBlockVisitor::Action action) : Block3DVisitor(0,
+                                                                                                    Grid3DSystem::MAXLEVEL),
+                                                                                     kernel(std::move(kernel)),
+                                                                                     nue(nue),
+                                                                                     action(action),
+                                                                                     dataSetFlag(true),
+                                                                                     numberOfProcesses(
+                                                                                             numberOfProcesses)
+{}
+
+//////////////////////////////////////////////////////////////////////////
+void SetKernelBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block)
+{
+    throwExceptionIfNotEnoughMemory(grid);
+
+    if (kernel && (block->getRank() == grid->getRank()))
+    {
+        LBMReal collFactor = LBMSystem::calcCollisionFactor(nue, block->getLevel());
+        kernel->setCollisionFactor(collFactor);
+        kernel->setIndex(block->getX1(), block->getX2(), block->getX3());
+        kernel->setDeltaT(LBMSystem::getDeltaT(block->getLevel()));
+        kernel->setBlock(block);
+        UbTupleInt3 blockNX = grid->getBlockNX();
+        kernel->setNX(std::array<int, 3>{{val<1>(blockNX), val<2>(blockNX), val<3>(blockNX)}});
+        SPtr<LBMKernel> newKernel = kernel->clone();
+
+        switch (action)
+        {
+            case SetKernelBlockVisitor::NewKernel:
+                block->setKernel(newKernel);
+                break;
+            case SetKernelBlockVisitor::ChangeKernel:
+            {
+                SPtr<DataSet3D> dataSet = block->getKernel()->getDataSet();
+                if (!dataSet)
+                {
+                    UB_THROW(UbException(UB_EXARGS,
+                                         "It is not possible to change a DataSet in kernel! Old DataSet is not exist!"));
+                }
+
+                newKernel->setDataSet(dataSet);
+
+                SPtr<BCProcessor> bcProc = block->getKernel()->getBCProcessor();
+                if (!bcProc)
+                {
+                    UB_THROW(UbException(UB_EXARGS,
+                                         "It is not possible to change a BCProcessor in kernel! Old BCProcessor is not exist!"));
+                }
+                newKernel->setBCProcessor(bcProc);
+                block->setKernel(newKernel);
+            }
+                break;
+
+            case SetKernelBlockVisitor::ChangeKernelWithData:
+            {
+                SPtr<BCProcessor> bcProc = block->getKernel()->getBCProcessor();
+                if (!bcProc)
+                {
+                    UB_THROW(UbException(UB_EXARGS,
+                                         "It is not possible to change a BCProcessor in kernel! Old BCProcessor is not exist!"));
+                }
+                newKernel->setBCProcessor(bcProc);
+                block->setKernel(newKernel);
+            }
+                break;
+        }
+
+    }
+}
+
+
+void SetKernelBlockVisitor::setNoDataSetFlag(bool flag)
+{
+    dataSetFlag = flag;
+}
+
+void SetKernelBlockVisitor::throwExceptionIfNotEnoughMemory(const SPtr<Grid3D> &grid)
+{
+    auto availableMemory = Utilities::getTotalPhysMem();
+    auto requiredMemory = getRequiredPhysicalMemory(grid);
+    if (requiredMemory > availableMemory)
+        throw UbException(UB_EXARGS, "SetKernelBlockVisitor: Not enough memory!!!");
+}
+
+double SetKernelBlockVisitor::getRequiredPhysicalMemory(const SPtr<Grid3D> &grid) const
+{
+    unsigned long long numberOfNodesPerBlockWithGhostLayer;
+    auto numberOfBlocks = (unsigned long long) grid->getNumberOfBlocks();
+    auto blockNx = grid->getBlockNX();
+    int ghostLayer = 3;
+
+    numberOfNodesPerBlockWithGhostLayer = numberOfBlocks
+                                          * (val<1>(blockNx) + ghostLayer)
+                                          * (val<2>(blockNx) + ghostLayer)
+                                          * (val<3>(blockNx) + ghostLayer);
+
+    auto needMemAll = double(numberOfNodesPerBlockWithGhostLayer
+                             * (27 * sizeof(double)
+                                + sizeof(int)
+                                + sizeof(float) * 4));
+
+    return needMemAll / double(numberOfProcesses);
+}
+
diff --git a/src/cpu/VirtualFluidsCore/Visitors/SetKernelBlockVisitor.h b/src/cpu/VirtualFluidsCore/Visitors/SetKernelBlockVisitor.h
index b8872a169c0e3d58829a390863450f0afe36d17b..9be7bad9d48190d7c2840d62fe612befa18f4774 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/SetKernelBlockVisitor.h
+++ b/src/cpu/VirtualFluidsCore/Visitors/SetKernelBlockVisitor.h
@@ -1,85 +1,85 @@
-//=======================================================================================
-// ____          ____    __    ______     __________   __      __       __        __         
-// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
-//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
-//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
-//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
-//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
-//      \    \  |    |   ________________________________________________________________    
-//       \    \ |    |  |  ______________________________________________________________|   
-//        \    \|    |  |  |         __          __     __     __     ______      _______    
-//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
-//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
-//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
-//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
-//
-//  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 SetKernelBlockVisitor.cpp
-//! \ingroup Visitors
-//! \author Konstantin Kutscher
-//=======================================================================================
-
-#ifndef SetKernelBlockVisitor_h
-#define SetKernelBlockVisitor_h
-
-#include <PointerDefinitions.h>
-
-#include "Block3DVisitor.h"
-#include "LBMSystem.h"
-
-class Grid3D;
-class Block3D;
-class LBMKernel;
-
-//! \brief A class generates new LBMKernel and associates it with a block.
-class SetKernelBlockVisitor : public Block3DVisitor
-{
-public:
-    enum Action
-    {
-        NewKernel, ChangeKernel, ChangeKernelWithData
-    };
-
-    //SetKernelBlockVisitor(LBMKernel3DPtr kernel, LBMReal nue);
-
-    //SetKernelBlockVisitor(LBMKernel3DPtr kernel, LBMReal nue, double availMem, double needMem);
-
-    SetKernelBlockVisitor(SPtr<LBMKernel> kernel, LBMReal nue, double availMem, double needMem,
-                          SetKernelBlockVisitor::Action action = SetKernelBlockVisitor::NewKernel);
-
-    SetKernelBlockVisitor(SPtr<LBMKernel> kernel, LBMReal nue, int &numberOfProcesses,
-                          SetKernelBlockVisitor::Action action = SetKernelBlockVisitor::NewKernel);
-
-    virtual ~SetKernelBlockVisitor()
-    {}
-
-    void visit(SPtr<Grid3D> grid, SPtr<Block3D> block) override;
-
-    void setNoDataSetFlag(bool flag);
-
-private:
-    SPtr<LBMKernel> kernel;
-    LBMReal nue;
-    Action action;
-    bool dataSetFlag;
-
-    int numberOfProcesses{1};
-
-    double getRequiredPhysicalMemory(const SPtr<Grid3D> &grid) const;
-
-    void throwExceptionIfNotEnoughMemory(const SPtr<Grid3D> &grid);
-};
-
-#endif
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  |
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 SetKernelBlockVisitor.cpp
+//! \ingroup Visitors
+//! \author Konstantin Kutscher
+//=======================================================================================
+
+#ifndef SetKernelBlockVisitor_h
+#define SetKernelBlockVisitor_h
+
+#include <PointerDefinitions.h>
+
+#include "Block3DVisitor.h"
+#include "LBMSystem.h"
+
+class Grid3D;
+class Block3D;
+class LBMKernel;
+
+//! \brief A class generates new LBMKernel and associates it with a block.
+class SetKernelBlockVisitor : public Block3DVisitor
+{
+public:
+    enum Action
+    {
+        NewKernel, ChangeKernel, ChangeKernelWithData
+    };
+
+    //SetKernelBlockVisitor(LBMKernel3DPtr kernel, LBMReal nue);
+
+    //SetKernelBlockVisitor(LBMKernel3DPtr kernel, LBMReal nue, double availMem, double needMem);
+
+    SetKernelBlockVisitor(SPtr<LBMKernel> kernel, LBMReal nue, double availMem, double needMem,
+                          SetKernelBlockVisitor::Action action = SetKernelBlockVisitor::NewKernel);
+
+    SetKernelBlockVisitor(SPtr<LBMKernel> kernel, LBMReal nue, int &numberOfProcesses,
+                          SetKernelBlockVisitor::Action action = SetKernelBlockVisitor::NewKernel);
+
+    virtual ~SetKernelBlockVisitor()
+    {}
+
+    void visit(SPtr<Grid3D> grid, SPtr<Block3D> block) override;
+
+    void setNoDataSetFlag(bool flag);
+
+private:
+    SPtr<LBMKernel> kernel;
+    LBMReal nue;
+    Action action;
+    bool dataSetFlag;
+
+    int numberOfProcesses{1};
+
+    double getRequiredPhysicalMemory(const SPtr<Grid3D> &grid) const;
+
+    void throwExceptionIfNotEnoughMemory(const SPtr<Grid3D> &grid);
+};
+
+#endif
diff --git a/src/cpu/VirtualFluidsCore/Visitors/SetSpongeLayerBlockVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/SetSpongeLayerBlockVisitor.cpp
index b94958688ab95a717df6b84d1fdb2f4eb0d420b2..076a6515c7aa27112d3b5d284b5926599b00a631 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/SetSpongeLayerBlockVisitor.cpp
+++ b/src/cpu/VirtualFluidsCore/Visitors/SetSpongeLayerBlockVisitor.cpp
@@ -1,31 +1,31 @@
-#include "SetSpongeLayerBlockVisitor.h"
-#include "Grid3DSystem.h"
-#include "LBMSystem.h"
-
-#include "LBMKernel.h"
-#include "Grid3D.h"
-#include "Block3D.h"
-
-SetSpongeLayerBlockVisitor::SetSpongeLayerBlockVisitor( const mu::Parser& spongeLayer ) : Block3DVisitor(0, Grid3DSystem::MAXLEVEL), spongeLayer(spongeLayer)
-{
-
-}
-//////////////////////////////////////////////////////////////////////////
-SetSpongeLayerBlockVisitor::~SetSpongeLayerBlockVisitor()
-{
-
-}
-//////////////////////////////////////////////////////////////////////////
-void SetSpongeLayerBlockVisitor::visit( SPtr<Grid3D> grid, SPtr<Block3D> block )
-{
-   if(block->getRank() == grid->getRank())
-   {
-       SPtr<LBMKernel> kernel = dynamicPointerCast<LBMKernel>(block->getKernel());
-       if (!kernel)
-           throw std::runtime_error("SetSpongeLayerBlockVisitor: Kernel is not a LBMKernel");
-      kernel->setWithSpongeLayer(true);
-      kernel->setSpongeLayer(spongeLayer);
-   }
-}
-
-
+#include "SetSpongeLayerBlockVisitor.h"
+#include "Grid3DSystem.h"
+#include "LBMSystem.h"
+
+#include "LBMKernel.h"
+#include "Grid3D.h"
+#include "Block3D.h"
+
+SetSpongeLayerBlockVisitor::SetSpongeLayerBlockVisitor( const mu::Parser& spongeLayer ) : Block3DVisitor(0, Grid3DSystem::MAXLEVEL), spongeLayer(spongeLayer)
+{
+
+}
+//////////////////////////////////////////////////////////////////////////
+SetSpongeLayerBlockVisitor::~SetSpongeLayerBlockVisitor()
+{
+
+}
+//////////////////////////////////////////////////////////////////////////
+void SetSpongeLayerBlockVisitor::visit( SPtr<Grid3D> grid, SPtr<Block3D> block )
+{
+   if(block->getRank() == grid->getRank())
+   {
+       SPtr<LBMKernel> kernel = dynamicPointerCast<LBMKernel>(block->getKernel());
+       if (!kernel)
+           throw std::runtime_error("SetSpongeLayerBlockVisitor: Kernel is not a LBMKernel");
+      kernel->setWithSpongeLayer(true);
+      kernel->setSpongeLayer(spongeLayer);
+   }
+}
+
+
diff --git a/src/cpu/VirtualFluidsCore/Visitors/SetSpongeLayerBlockVisitor.h b/src/cpu/VirtualFluidsCore/Visitors/SetSpongeLayerBlockVisitor.h
index edc9b033d086abe6ecec9cebf6789f1d080e9f77..67d5e2ad06c90d2b1f440e276f505a085990558f 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/SetSpongeLayerBlockVisitor.h
+++ b/src/cpu/VirtualFluidsCore/Visitors/SetSpongeLayerBlockVisitor.h
@@ -1,28 +1,28 @@
-#ifndef SetSpongeLayerBlockVisitor_h__
-#define SetSpongeLayerBlockVisitor_h__
-
-#include <PointerDefinitions.h>
-
-#include <muParser.h>
-
-#include "Block3DVisitor.h"
-
-class Grid3D;
-class Block3D;
-
-//! \brief Set sponge layer for all kernels of grid
-//! \details This visitor is useful if you need to set or reset sponge layer in kernels (e.g. after restart because sponge layer is not serializable). 
-//! \author K. Kucher
-class SetSpongeLayerBlockVisitor : public Block3DVisitor
-{
-public:
-   SetSpongeLayerBlockVisitor(const mu::Parser& spongeLayer);
-   virtual ~SetSpongeLayerBlockVisitor();
-
-   void visit(SPtr<Grid3D> grid, SPtr<Block3D> block) override;
-protected:
-private:
-   mu::Parser spongeLayer;
-};
-
-#endif // SetSpongeLayerBlockVisitor_h__
+#ifndef SetSpongeLayerBlockVisitor_h__
+#define SetSpongeLayerBlockVisitor_h__
+
+#include <PointerDefinitions.h>
+
+#include <muParser.h>
+
+#include "Block3DVisitor.h"
+
+class Grid3D;
+class Block3D;
+
+//! \brief Set sponge layer for all kernels of grid
+//! \details This visitor is useful if you need to set or reset sponge layer in kernels (e.g. after restart because sponge layer is not serializable). 
+//! \author K. Kucher
+class SetSpongeLayerBlockVisitor : public Block3DVisitor
+{
+public:
+   SetSpongeLayerBlockVisitor(const mu::Parser& spongeLayer);
+   virtual ~SetSpongeLayerBlockVisitor();
+
+   void visit(SPtr<Grid3D> grid, SPtr<Block3D> block) override;
+protected:
+private:
+   mu::Parser spongeLayer;
+};
+
+#endif // SetSpongeLayerBlockVisitor_h__
diff --git a/src/cpu/VirtualFluidsCore/Visitors/SetUndefinedNodesBlockVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/SetUndefinedNodesBlockVisitor.cpp
index 5f18117d55c3d03bee1bde1fe5ecae8d9ff33828..e33fb44af2a72da6dc87fad51b2f97a29f96ac36 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/SetUndefinedNodesBlockVisitor.cpp
+++ b/src/cpu/VirtualFluidsCore/Visitors/SetUndefinedNodesBlockVisitor.cpp
@@ -1,677 +1,677 @@
-#include "SetUndefinedNodesBlockVisitor.h"
-#include "BCArray3D.h"
-#include "BoundaryConditions.h"
-#include "BCProcessor.h"
-#include "Grid3DSystem.h"
-#include "D3Q27System.h"
-#include "BCArray3D.h"
-#include "Grid3D.h"
-#include "Block3D.h"
-#include "ILBMKernel.h"
-
-
-SetUndefinedNodesBlockVisitor::SetUndefinedNodesBlockVisitor(bool twoTypeOfConnectorsCheck) : Block3DVisitor(0, Grid3DSystem::MAXLEVEL), twoTypeOfConnectorsCheck(twoTypeOfConnectorsCheck) 
-{
-
-}
-//////////////////////////////////////////////////////////////////////////
-void SetUndefinedNodesBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block)
-{
-   if(!block->hasInterpolationFlag()) return;
-
-   SPtr<ILBMKernel> kernel = block->getKernel();
-
-   if(!kernel && (block->getRank() != grid->getRank())) return;
-
-   //width of ghost layer 
-   //int gl = kernel->getGhostLayerWidth();
-   int gl = 0;
-   
-   SPtr<BCArray3D> bcMatrix = kernel->getBCProcessor()->getBCArray();
-
-   int minX1 = gl;
-   int minX2 = gl;
-   int minX3 = gl;
-
-   int maxX1 = static_cast<int>(bcMatrix->getNX1())-1-gl;
-   int maxX2 = static_cast<int>(bcMatrix->getNX2())-1-gl;
-   int maxX3 = static_cast<int>(bcMatrix->getNX3())-1-gl;
-
-   //int offset = 2;
-   int offset = 3;
-
-   if(block->hasInterpolationFlag(D3Q27System::E))
-   {
-      int startix1 = maxX1;
-      int endix1   = maxX1;
-      if(block->hasInterpolationFlagCF()) startix1 = startix1-offset;
-      int startix2 = minX2;
-      int endix2   = maxX2;
-      int startix3 = minX3; 
-      int endix3   = maxX3;
-      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
-   }
-   if(block->hasInterpolationFlag(D3Q27System::W))
-   {
-      int startix1 = minX1;
-      int endix1   = minX1;
-      if(block->hasInterpolationFlagCF()) endix1 = endix1+offset;
-      int startix2 = minX2;
-      int endix2   = maxX2;
-      int startix3 = minX3; 
-      int endix3   = maxX3;
-      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
-   }
-   if(block->hasInterpolationFlag(D3Q27System::N))
-   {
-      int startix1 = minX1;
-      int endix1   = maxX1;
-      int startix2 = maxX2;
-      int endix2   = maxX2;
-      if(block->hasInterpolationFlagCF()) startix2 = startix2-offset;
-      int startix3 = minX3; 
-      int endix3   = maxX3;
-      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
-   }
-   if(block->hasInterpolationFlag(D3Q27System::S))
-   {
-      int startix1 = minX1;
-      int endix1   = maxX1;
-      int startix2 = minX2;
-      int endix2   = minX2;
-      if(block->hasInterpolationFlagCF()) endix2 = endix2+offset;
-      int startix3 = minX3; 
-      int endix3   = maxX3;
-      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
-   }
-   if(block->hasInterpolationFlag(D3Q27System::T))
-   {
-      int startix1 = minX1;
-      int endix1   = maxX1;
-      int startix2 = minX2;
-      int endix2   = maxX2;
-      int startix3 = maxX3;
-      int endix3   = maxX3;
-      if(block->hasInterpolationFlagCF()) startix3 = startix3-offset;
-      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
-   }
-   if(block->hasInterpolationFlag(D3Q27System::B))
-   {
-      int startix1 = minX1;
-      int endix1   = maxX1;
-      int startix2 = minX2;
-      int endix2   = maxX2;
-      int startix3 = minX3;
-      int endix3   = minX3;
-      if(block->hasInterpolationFlagCF()) endix3 = endix3+offset;
-      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
-   }
-   if(block->hasInterpolationFlag(D3Q27System::NE))
-   {
-      int startix1 = maxX1;
-      int endix1   = maxX1;
-      if(block->hasInterpolationFlagCF()) startix1 = startix1-offset;
-      int startix2 = maxX2;
-      int endix2   = maxX2;
-      if(block->hasInterpolationFlagCF()) startix2 = startix2-offset;
-      int startix3 = minX3; 
-      int endix3   = maxX3;
-      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
-   }
-   if(block->hasInterpolationFlag(D3Q27System::SW))
-   {
-      int startix1 = minX1;
-      int endix1   = minX1;
-      if(block->hasInterpolationFlagCF()) endix1 = endix1+offset;
-      int startix2 = minX2;
-      int endix2   = minX2;
-      if(block->hasInterpolationFlagCF()) endix2 = endix2+offset;
-      int startix3 = minX3; 
-      int endix3   = maxX3;
-      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
-   }
-   if(block->hasInterpolationFlag(D3Q27System::SE))
-   {
-      int startix1 = maxX1;
-      int endix1   = maxX1;
-      if(block->hasInterpolationFlagCF()) startix1 = startix1-offset;
-      int startix2 = minX2;
-      int endix2   = minX2;
-      if(block->hasInterpolationFlagCF()) endix2 = endix2+offset;
-      int startix3 = minX3; 
-      int endix3   = maxX3;
-      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
-   }
-   if(block->hasInterpolationFlag(D3Q27System::NW))  
-   {
-      int startix1 = minX1;
-      int endix1   = minX1;
-      if(block->hasInterpolationFlagCF()) endix1 = endix1+offset;
-      int startix2 = maxX2;
-      int endix2   = maxX2;
-      if(block->hasInterpolationFlagCF()) startix2 = startix2-offset;
-      int startix3 = minX3; 
-      int endix3   = maxX3;
-      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
-   }
-   if(block->hasInterpolationFlag(D3Q27System::TE))  
-   {
-      int startix1 = maxX1;
-      int endix1   = maxX1;
-      if(block->hasInterpolationFlagCF()) startix1 = startix1-offset;
-      int startix2 = minX2;
-      int endix2   = maxX2;
-      int startix3 = maxX3;
-      int endix3   = maxX3;
-      if(block->hasInterpolationFlagCF()) startix3 = startix3-offset;
-      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
-   }
-   if(block->hasInterpolationFlag(D3Q27System::BW))  
-   {
-      int startix1 = minX1;
-      int endix1   = minX1;
-      if(block->hasInterpolationFlagCF()) endix1 = endix1+offset;
-      int startix2 = minX2;
-      int endix2   = maxX2;
-      int startix3 = minX3;
-      int endix3   = minX3;
-      if(block->hasInterpolationFlagCF()) endix3 = endix3+offset;
-      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
-   }
-   if(block->hasInterpolationFlag(D3Q27System::BE)) 
-   {
-      int startix1 = maxX1;
-      int endix1   = maxX1;
-      if(block->hasInterpolationFlagCF()) startix1 = startix1-offset;
-      int startix2 = minX2;
-      int endix2   = maxX2;
-      int startix3 = minX3;
-      int endix3   = minX3;
-      if(block->hasInterpolationFlagCF()) endix3 = endix3+offset;
-      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
-   }
-   if(block->hasInterpolationFlag(D3Q27System::TW))  
-   {
-      int startix1 = minX1;
-      int endix1   = minX1;
-      if(block->hasInterpolationFlagCF()) endix1 = endix1+offset;
-      int startix2 = minX2;
-      int endix2   = maxX2;
-      int startix3 = maxX3;
-      int endix3   = maxX3;
-      if(block->hasInterpolationFlagCF()) startix3 = startix3-offset;
-      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
-   }
-   if(block->hasInterpolationFlag(D3Q27System::TN)) 
-   {
-      int startix1 = minX1;
-      int endix1   = maxX1;
-      int startix2 = maxX2;
-      int endix2   = maxX2;
-      if(block->hasInterpolationFlagCF()) startix2 = startix2-offset;
-      int startix3 = maxX3;
-      int endix3   = maxX3;
-      if(block->hasInterpolationFlagCF()) startix3 = startix3-offset;
-      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
-   }
-   if(block->hasInterpolationFlag(D3Q27System::BS))  
-   {
-      int startix1 = minX1;
-      int endix1   = maxX1;
-      int startix2 = minX2;
-      int endix2   = minX2;
-      if(block->hasInterpolationFlagCF()) endix2 = endix2+offset;
-      int startix3 = minX3;
-      int endix3   = minX3;
-      if(block->hasInterpolationFlagCF()) endix3 = endix3+offset;
-      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
-   }
-   if(block->hasInterpolationFlag(D3Q27System::BN))  
-   {
-      int startix1 = minX1;
-      int endix1   = maxX1;
-      int startix2 = maxX2;
-      int endix2   = maxX2;
-      if(block->hasInterpolationFlagCF()) startix2 = startix2-offset;
-      int startix3 = minX3;
-      int endix3   = minX3;
-      if(block->hasInterpolationFlagCF()) endix3 = endix3+offset;
-      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
-   }
-   if(block->hasInterpolationFlag(D3Q27System::TS))  
-   {
-      int startix1 = minX1;
-      int endix1   = maxX1;
-      int startix2 = minX2;
-      int endix2   = minX2;
-      if(block->hasInterpolationFlagCF()) endix2 = endix2+offset;
-      int startix3 = maxX3;
-      int endix3   = maxX3;
-      if(block->hasInterpolationFlagCF()) startix3 = startix3-offset;
-      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
-   }
-   if(block->hasInterpolationFlag(D3Q27System::TNE)) 
-   {
-      int startix1 = maxX1;
-      int endix1   = maxX1;
-      if(block->hasInterpolationFlagCF()) startix1 = startix1-offset;
-      int startix2 = maxX2;
-      int endix2   = maxX2;
-      if(block->hasInterpolationFlagCF()) startix2 = startix2-offset;
-      int startix3 = maxX3;
-      int endix3   = maxX3;
-      if(block->hasInterpolationFlagCF()) startix3 = startix3-offset;
-      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
-   }
-   if(block->hasInterpolationFlag(D3Q27System::TNW)) 
-   {
-      int startix1 = minX1;
-      int endix1   = minX1;
-      if(block->hasInterpolationFlagCF()) endix1 = endix1+offset;
-      int startix2 = maxX2;
-      int endix2   = maxX2;
-      if(block->hasInterpolationFlagCF()) startix2 = startix2-offset;
-      int startix3 = maxX3;
-      int endix3   = maxX3;
-      if(block->hasInterpolationFlagCF()) startix3 = startix3-offset;
-      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
-   }
-   if(block->hasInterpolationFlag(D3Q27System::TSE)) 
-   {
-      int startix1 = maxX1;
-      int endix1   = maxX1;
-      if(block->hasInterpolationFlagCF()) startix1 = startix1-offset;
-      int startix2 = minX2;
-      int endix2   = minX2;
-      if(block->hasInterpolationFlagCF()) endix2 = endix2+offset;
-      int startix3 = maxX3;
-      int endix3   = maxX3;
-      if(block->hasInterpolationFlagCF()) startix3 = startix3-offset;
-      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
-   }
-   if(block->hasInterpolationFlag(D3Q27System::TSW)) 
-   {
-      int startix1 = minX1;
-      int endix1   = minX1;
-      if(block->hasInterpolationFlagCF()) endix1 = endix1+offset;
-      int startix2 = minX2;
-      int endix2   = minX2;
-      if(block->hasInterpolationFlagCF()) endix2 = endix2+offset;
-      int startix3 = maxX3;
-      int endix3   = maxX3;
-      if(block->hasInterpolationFlagCF()) startix3 = startix3-offset;
-      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
-   }
-   if(block->hasInterpolationFlag(D3Q27System::BNE)) 
-   {
-      int startix1 = maxX1;
-      int endix1   = maxX1;
-      if(block->hasInterpolationFlagCF()) startix1 = startix1-offset;
-      int startix2 = maxX2;
-      int endix2   = maxX2;
-      if(block->hasInterpolationFlagCF()) startix2 = startix2-offset;
-      int startix3 = minX3;
-      int endix3   = minX3;
-      if(block->hasInterpolationFlagCF()) endix3 = endix3+offset;
-      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
-   }
-   if(block->hasInterpolationFlag(D3Q27System::BNW))
-   {
-      int startix1 = minX1;
-      int endix1   = minX1;
-      if(block->hasInterpolationFlagCF()) endix1 = endix1+offset;
-      int startix2 = maxX2;
-      int endix2   = maxX2;
-      if(block->hasInterpolationFlagCF()) startix2 = startix2-offset;
-      int startix3 = minX3;
-      int endix3   = minX3;
-      if(block->hasInterpolationFlagCF()) endix3 = endix3+offset;
-      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
-   }
-   if(block->hasInterpolationFlag(D3Q27System::BSE)) 
-   {
-      int startix1 = maxX1;
-      int endix1   = maxX1;
-      if(block->hasInterpolationFlagCF()) startix1 = startix1-offset;
-      int startix2 = minX2;
-      int endix2   = minX2;
-      if(block->hasInterpolationFlagCF()) endix2 = endix2+offset;
-      int startix3 = minX3;
-      int endix3   = minX3;
-      if(block->hasInterpolationFlagCF()) endix3 = endix3+offset;
-      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
-   }
-   if(block->hasInterpolationFlag(D3Q27System::BSW)) 
-   {
-      int startix1 = minX1;
-      int endix1   = minX1;
-      if(block->hasInterpolationFlagCF()) endix1 = endix1+offset;
-      int startix2 = minX2;
-      int endix2   = minX2;
-      if(block->hasInterpolationFlagCF()) endix2 = endix2+offset;
-      int startix3 = minX3;
-      int endix3   = minX3;
-      if(block->hasInterpolationFlagCF()) endix3 = endix3+offset;
-      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
-   }
-
-
-
-	//////////////////////////////////////////////////////////////////////////
-   int offset2 = 1;
-   int ll = 0;
-
-   minX1 = ll;
-   minX2 = ll;
-   minX3 = ll;
-
-   maxX1 = static_cast<int>(bcMatrix->getNX1())-1-ll;
-   maxX2 = static_cast<int>(bcMatrix->getNX2())-1-ll;
-   maxX3 = static_cast<int>(bcMatrix->getNX3())-1-ll;
-
-   if(block->hasInterpolationFlagFC(D3Q27System::E))
-   {
-      int startix1 = maxX1-offset2;
-      int endix1   = maxX1;
-      int startix2 = minX2;
-      int endix2   = maxX2;
-      int startix3 = minX3; 
-      int endix3   = maxX3;
-      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
-   }
-   if(block->hasInterpolationFlagFC(D3Q27System::W))
-   {
-      int startix1 = minX1;
-      int endix1   = minX1+offset2;
-      int startix2 = minX2;
-      int endix2   = maxX2;
-      int startix3 = minX3; 
-      int endix3   = maxX3;
-      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
-   }
-   if(block->hasInterpolationFlagFC(D3Q27System::N))
-   {
-      int startix1 = minX1;
-      int endix1   = maxX1;
-      int startix2 = maxX2-offset2;
-      int endix2   = maxX2;
-      int startix3 = minX3; 
-      int endix3   = maxX3;
-      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
-   }
-   if(block->hasInterpolationFlagFC(D3Q27System::S))
-   {
-      int startix1 = minX1;
-      int endix1   = maxX1;
-      int startix2 = minX2;
-      int endix2   = minX2+offset2;
-      int startix3 = minX3; 
-      int endix3   = maxX3;
-      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
-   }
-   if(block->hasInterpolationFlagFC(D3Q27System::T))
-   {
-      int startix1 = minX1;
-      int endix1   = maxX1;
-      int startix2 = minX2;
-      int endix2   = maxX2;
-      int startix3 = maxX3-offset2;
-      int endix3   = maxX3;
-      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
-   }
-   if(block->hasInterpolationFlagFC(D3Q27System::B))
-   {
-      int startix1 = minX1;
-      int endix1   = maxX1;
-      int startix2 = minX2;
-      int endix2   = maxX2;
-      int startix3 = minX3;
-      int endix3   = minX3+offset2;
-      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
-   }
-   if(block->hasInterpolationFlagFC(D3Q27System::NE))
-   {
-      int startix1 = maxX1-offset2;
-      int endix1   = maxX1;
-      int startix2 = maxX2-offset2;
-      int endix2   = maxX2;
-      int startix3 = minX3; 
-      int endix3   = maxX3;
-      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
-   }
-   if(block->hasInterpolationFlagFC(D3Q27System::SW))
-   {
-      int startix1 = minX1;
-      int endix1   = minX1+offset2;
-      int startix2 = minX2;
-      int endix2   = minX2+offset2;
-      int startix3 = minX3; 
-      int endix3   = maxX3;
-      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
-   }
-   if(block->hasInterpolationFlagFC(D3Q27System::SE))
-   {
-      int startix1 = maxX1-offset2;
-      int endix1   = maxX1;
-      int startix2 = minX2;
-      int endix2   = minX2+offset2;
-      int startix3 = minX3; 
-      int endix3   = maxX3;
-      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
-   }
-   if(block->hasInterpolationFlagFC(D3Q27System::NW))  
-   {
-      int startix1 = minX1;
-      int endix1   = minX1+offset2;
-      int startix2 = maxX2-offset2;
-      int endix2   = maxX2;
-      int startix3 = minX3; 
-      int endix3   = maxX3;
-      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
-   }
-   if(block->hasInterpolationFlagFC(D3Q27System::TE))  
-   {
-      int startix1 = maxX1-offset2;
-      int endix1   = maxX1;
-      int startix2 = minX2;
-      int endix2   = maxX2;
-      int startix3 = maxX3-offset2;
-      int endix3   = maxX3;
-      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
-   }
-   if(block->hasInterpolationFlagFC(D3Q27System::BW))  
-   {
-      int startix1 = minX1;
-      int endix1   = minX1+offset2;
-      int startix2 = minX2;
-      int endix2   = maxX2;
-      int startix3 = minX3;
-      int endix3   = minX3+offset2;
-      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
-   }
-   if(block->hasInterpolationFlagFC(D3Q27System::BE)) 
-   {
-      int startix1 = maxX1-offset2;
-      int endix1   = maxX1;
-      int startix2 = minX2;
-      int endix2   = maxX2;
-      int startix3 = minX3;
-      int endix3   = minX3+offset2;
-      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
-   }
-   if(block->hasInterpolationFlagFC(D3Q27System::TW))  
-   {
-      int startix1 = minX1;
-      int endix1   = minX1+offset2;
-      int startix2 = minX2;
-      int endix2   = maxX2;
-      int startix3 = maxX3-offset2;
-      int endix3   = maxX3;
-      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
-   }
-   if(block->hasInterpolationFlagFC(D3Q27System::TN)) 
-   {
-      int startix1 = minX1;
-      int endix1   = maxX1;
-      int startix2 = maxX2-offset2;
-      int endix2   = maxX2;
-      int startix3 = maxX3-offset2;
-      int endix3   = maxX3;
-      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
-   }
-   if(block->hasInterpolationFlagFC(D3Q27System::BS))  
-   {
-      int startix1 = minX1;
-      int endix1   = maxX1;
-      int startix2 = minX2;
-      int endix2   = minX2+offset2;
-      int startix3 = minX3;
-      int endix3   = minX3+offset2;
-      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
-   }
-   if(block->hasInterpolationFlagFC(D3Q27System::BN))  
-   {
-      int startix1 = minX1;
-      int endix1   = maxX1;
-      int startix2 = maxX2-offset2;
-      int endix2   = maxX2;
-      int startix3 = minX3;
-      int endix3   = minX3+offset2;
-      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
-   }
-   if(block->hasInterpolationFlagFC(D3Q27System::TS))  
-   {
-      int startix1 = minX1;
-      int endix1   = maxX1;
-      int startix2 = minX2;
-      int endix2   = minX2+offset2;
-      int startix3 = maxX3-offset2;
-      int endix3   = maxX3;
-      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
-   }
-   if(block->hasInterpolationFlagFC(D3Q27System::TNE)) 
-   {
-      int startix1 = maxX1-offset2;
-      int endix1   = maxX1;
-      int startix2 = maxX2-offset2;
-      int endix2   = maxX2;
-      int startix3 = maxX3-offset2;
-      int endix3   = maxX3;
-      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
-   }
-   if(block->hasInterpolationFlagFC(D3Q27System::TNW)) 
-   {
-      int startix1 = minX1;
-      int endix1   = minX1+offset2;
-      int startix2 = maxX2-offset2;
-      int endix2   = maxX2;
-      int startix3 = maxX3-offset2;
-      int endix3   = maxX3;
-      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
-   }
-   if(block->hasInterpolationFlagFC(D3Q27System::TSE)) 
-   {
-      int startix1 = maxX1-offset2;
-      int endix1   = maxX1;
-      int startix2 = minX2;
-      int endix2   = minX2+offset2;
-      int startix3 = maxX3-offset2;
-      int endix3   = maxX3;
-      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
-   }
-   if(block->hasInterpolationFlagFC(D3Q27System::TSW)) 
-   {
-      int startix1 = minX1;
-      int endix1   = minX1+offset2;
-      int startix2 = minX2;
-      int endix2   = minX2+offset2;
-      int startix3 = maxX3-offset2;
-      int endix3   = maxX3;
-      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
-   }
-   if(block->hasInterpolationFlagFC(D3Q27System::BNE)) 
-   {
-      int startix1 = maxX1-offset2;
-      int endix1   = maxX1;
-      int startix2 = maxX2-offset2;
-      int endix2   = maxX2;
-      int startix3 = minX3;
-      int endix3   = minX3+offset2;
-      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
-   }
-   if(block->hasInterpolationFlagFC(D3Q27System::BNW))
-   {
-      int startix1 = minX1;
-      int endix1   = minX1+offset2;
-      int startix2 = maxX2-offset2;
-      int endix2   = maxX2;
-      int startix3 = minX3;
-      int endix3   = minX3+offset2;
-      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
-   }
-   if(block->hasInterpolationFlagFC(D3Q27System::BSE)) 
-   {
-      int startix1 = maxX1-offset2;
-      int endix1   = maxX1;
-      int startix2 = minX2;
-      int endix2   = minX2+offset2;
-      int startix3 = minX3;
-      int endix3   = minX3+offset2;
-      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
-   }
-   if(block->hasInterpolationFlagFC(D3Q27System::BSW)) 
-   {
-      int startix1 = minX1;
-      int endix1   = minX1+offset2;
-      int startix2 = minX2;
-      int endix2   = minX2+offset2;
-      int startix3 = minX3;
-      int endix3   = minX3+offset2;
-      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
-   }
-   
-   //invert scaleCF blocks
-   if(block->hasInterpolationFlagCF())
-   {
-      if(block->hasInterpolationFlagFC() && twoTypeOfConnectorsCheck) 
-      {
-         for (int i = D3Q27System::E; i <= D3Q27System::BSW; i++)
-         {
-             UBLOG(logINFO, "FC in dir="<<i<<" "<<block->hasInterpolationFlagFC(i));
-         }
-         for (int i = D3Q27System::E; i<=D3Q27System::BSW; i++)
-         {
-            UBLOG(logINFO, "CF in dir="<<i<<" "<<block->hasInterpolationFlagCF(i));
-         }
-         throw UbException(UB_EXARGS, "block "+block->toString()+" has CF and FC");
-      }
-
-      minX1 = gl;
-      minX2 = gl;
-      minX3 = gl;
-
-      maxX1 = static_cast<int>(bcMatrix->getNX1())-1-gl;
-      maxX2 = static_cast<int>(bcMatrix->getNX2())-1-gl;
-      maxX3 = static_cast<int>(bcMatrix->getNX3())-1-gl;
-
-      for (int ix3=minX3; ix3<=maxX3; ix3++)
-         for (int ix2=minX2; ix2<=maxX2; ix2++)
-            for (int ix1=minX1; ix1<=maxX1; ix1++)
-            {
-               if(bcMatrix->isUndefined(ix1, ix2, ix3)) bcMatrix->setFluid(ix1, ix2, ix3);
-               else                                    bcMatrix->setUndefined(ix1, ix2, ix3);
-            }
-            return;
-   }
-
-}
-//////////////////////////////////////////////////////////////////////////
-void SetUndefinedNodesBlockVisitor::setNodesUndefined( int startix1, int endix1, int startix2, int endix2, int startix3, int endix3, SPtr<BCArray3D> bcMatrix )
-{
-   for (int ix3=startix3; ix3<=endix3; ix3++)
-      for (int ix2=startix2; ix2<=endix2; ix2++)
-         for (int ix1=startix1; ix1<=endix1; ix1++)
-         {
-            bcMatrix->setUndefined(ix1, ix2, ix3);
-         }
-}
+#include "SetUndefinedNodesBlockVisitor.h"
+#include "BCArray3D.h"
+#include "BoundaryConditions.h"
+#include "BCProcessor.h"
+#include "Grid3DSystem.h"
+#include "D3Q27System.h"
+#include "BCArray3D.h"
+#include "Grid3D.h"
+#include "Block3D.h"
+#include "ILBMKernel.h"
+
+
+SetUndefinedNodesBlockVisitor::SetUndefinedNodesBlockVisitor(bool twoTypeOfConnectorsCheck) : Block3DVisitor(0, Grid3DSystem::MAXLEVEL), twoTypeOfConnectorsCheck(twoTypeOfConnectorsCheck) 
+{
+
+}
+//////////////////////////////////////////////////////////////////////////
+void SetUndefinedNodesBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block)
+{
+   if(!block->hasInterpolationFlag()) return;
+
+   SPtr<ILBMKernel> kernel = block->getKernel();
+
+   if(!kernel && (block->getRank() != grid->getRank())) return;
+
+   //width of ghost layer 
+   //int gl = kernel->getGhostLayerWidth();
+   int gl = 0;
+   
+   SPtr<BCArray3D> bcMatrix = kernel->getBCProcessor()->getBCArray();
+
+   int minX1 = gl;
+   int minX2 = gl;
+   int minX3 = gl;
+
+   int maxX1 = static_cast<int>(bcMatrix->getNX1())-1-gl;
+   int maxX2 = static_cast<int>(bcMatrix->getNX2())-1-gl;
+   int maxX3 = static_cast<int>(bcMatrix->getNX3())-1-gl;
+
+   //int offset = 2;
+   int offset = 3;
+
+   if(block->hasInterpolationFlag(D3Q27System::E))
+   {
+      int startix1 = maxX1;
+      int endix1   = maxX1;
+      if(block->hasInterpolationFlagCF()) startix1 = startix1-offset;
+      int startix2 = minX2;
+      int endix2   = maxX2;
+      int startix3 = minX3; 
+      int endix3   = maxX3;
+      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
+   }
+   if(block->hasInterpolationFlag(D3Q27System::W))
+   {
+      int startix1 = minX1;
+      int endix1   = minX1;
+      if(block->hasInterpolationFlagCF()) endix1 = endix1+offset;
+      int startix2 = minX2;
+      int endix2   = maxX2;
+      int startix3 = minX3; 
+      int endix3   = maxX3;
+      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
+   }
+   if(block->hasInterpolationFlag(D3Q27System::N))
+   {
+      int startix1 = minX1;
+      int endix1   = maxX1;
+      int startix2 = maxX2;
+      int endix2   = maxX2;
+      if(block->hasInterpolationFlagCF()) startix2 = startix2-offset;
+      int startix3 = minX3; 
+      int endix3   = maxX3;
+      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
+   }
+   if(block->hasInterpolationFlag(D3Q27System::S))
+   {
+      int startix1 = minX1;
+      int endix1   = maxX1;
+      int startix2 = minX2;
+      int endix2   = minX2;
+      if(block->hasInterpolationFlagCF()) endix2 = endix2+offset;
+      int startix3 = minX3; 
+      int endix3   = maxX3;
+      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
+   }
+   if(block->hasInterpolationFlag(D3Q27System::T))
+   {
+      int startix1 = minX1;
+      int endix1   = maxX1;
+      int startix2 = minX2;
+      int endix2   = maxX2;
+      int startix3 = maxX3;
+      int endix3   = maxX3;
+      if(block->hasInterpolationFlagCF()) startix3 = startix3-offset;
+      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
+   }
+   if(block->hasInterpolationFlag(D3Q27System::B))
+   {
+      int startix1 = minX1;
+      int endix1   = maxX1;
+      int startix2 = minX2;
+      int endix2   = maxX2;
+      int startix3 = minX3;
+      int endix3   = minX3;
+      if(block->hasInterpolationFlagCF()) endix3 = endix3+offset;
+      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
+   }
+   if(block->hasInterpolationFlag(D3Q27System::NE))
+   {
+      int startix1 = maxX1;
+      int endix1   = maxX1;
+      if(block->hasInterpolationFlagCF()) startix1 = startix1-offset;
+      int startix2 = maxX2;
+      int endix2   = maxX2;
+      if(block->hasInterpolationFlagCF()) startix2 = startix2-offset;
+      int startix3 = minX3; 
+      int endix3   = maxX3;
+      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
+   }
+   if(block->hasInterpolationFlag(D3Q27System::SW))
+   {
+      int startix1 = minX1;
+      int endix1   = minX1;
+      if(block->hasInterpolationFlagCF()) endix1 = endix1+offset;
+      int startix2 = minX2;
+      int endix2   = minX2;
+      if(block->hasInterpolationFlagCF()) endix2 = endix2+offset;
+      int startix3 = minX3; 
+      int endix3   = maxX3;
+      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
+   }
+   if(block->hasInterpolationFlag(D3Q27System::SE))
+   {
+      int startix1 = maxX1;
+      int endix1   = maxX1;
+      if(block->hasInterpolationFlagCF()) startix1 = startix1-offset;
+      int startix2 = minX2;
+      int endix2   = minX2;
+      if(block->hasInterpolationFlagCF()) endix2 = endix2+offset;
+      int startix3 = minX3; 
+      int endix3   = maxX3;
+      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
+   }
+   if(block->hasInterpolationFlag(D3Q27System::NW))  
+   {
+      int startix1 = minX1;
+      int endix1   = minX1;
+      if(block->hasInterpolationFlagCF()) endix1 = endix1+offset;
+      int startix2 = maxX2;
+      int endix2   = maxX2;
+      if(block->hasInterpolationFlagCF()) startix2 = startix2-offset;
+      int startix3 = minX3; 
+      int endix3   = maxX3;
+      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
+   }
+   if(block->hasInterpolationFlag(D3Q27System::TE))  
+   {
+      int startix1 = maxX1;
+      int endix1   = maxX1;
+      if(block->hasInterpolationFlagCF()) startix1 = startix1-offset;
+      int startix2 = minX2;
+      int endix2   = maxX2;
+      int startix3 = maxX3;
+      int endix3   = maxX3;
+      if(block->hasInterpolationFlagCF()) startix3 = startix3-offset;
+      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
+   }
+   if(block->hasInterpolationFlag(D3Q27System::BW))  
+   {
+      int startix1 = minX1;
+      int endix1   = minX1;
+      if(block->hasInterpolationFlagCF()) endix1 = endix1+offset;
+      int startix2 = minX2;
+      int endix2   = maxX2;
+      int startix3 = minX3;
+      int endix3   = minX3;
+      if(block->hasInterpolationFlagCF()) endix3 = endix3+offset;
+      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
+   }
+   if(block->hasInterpolationFlag(D3Q27System::BE)) 
+   {
+      int startix1 = maxX1;
+      int endix1   = maxX1;
+      if(block->hasInterpolationFlagCF()) startix1 = startix1-offset;
+      int startix2 = minX2;
+      int endix2   = maxX2;
+      int startix3 = minX3;
+      int endix3   = minX3;
+      if(block->hasInterpolationFlagCF()) endix3 = endix3+offset;
+      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
+   }
+   if(block->hasInterpolationFlag(D3Q27System::TW))  
+   {
+      int startix1 = minX1;
+      int endix1   = minX1;
+      if(block->hasInterpolationFlagCF()) endix1 = endix1+offset;
+      int startix2 = minX2;
+      int endix2   = maxX2;
+      int startix3 = maxX3;
+      int endix3   = maxX3;
+      if(block->hasInterpolationFlagCF()) startix3 = startix3-offset;
+      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
+   }
+   if(block->hasInterpolationFlag(D3Q27System::TN)) 
+   {
+      int startix1 = minX1;
+      int endix1   = maxX1;
+      int startix2 = maxX2;
+      int endix2   = maxX2;
+      if(block->hasInterpolationFlagCF()) startix2 = startix2-offset;
+      int startix3 = maxX3;
+      int endix3   = maxX3;
+      if(block->hasInterpolationFlagCF()) startix3 = startix3-offset;
+      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
+   }
+   if(block->hasInterpolationFlag(D3Q27System::BS))  
+   {
+      int startix1 = minX1;
+      int endix1   = maxX1;
+      int startix2 = minX2;
+      int endix2   = minX2;
+      if(block->hasInterpolationFlagCF()) endix2 = endix2+offset;
+      int startix3 = minX3;
+      int endix3   = minX3;
+      if(block->hasInterpolationFlagCF()) endix3 = endix3+offset;
+      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
+   }
+   if(block->hasInterpolationFlag(D3Q27System::BN))  
+   {
+      int startix1 = minX1;
+      int endix1   = maxX1;
+      int startix2 = maxX2;
+      int endix2   = maxX2;
+      if(block->hasInterpolationFlagCF()) startix2 = startix2-offset;
+      int startix3 = minX3;
+      int endix3   = minX3;
+      if(block->hasInterpolationFlagCF()) endix3 = endix3+offset;
+      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
+   }
+   if(block->hasInterpolationFlag(D3Q27System::TS))  
+   {
+      int startix1 = minX1;
+      int endix1   = maxX1;
+      int startix2 = minX2;
+      int endix2   = minX2;
+      if(block->hasInterpolationFlagCF()) endix2 = endix2+offset;
+      int startix3 = maxX3;
+      int endix3   = maxX3;
+      if(block->hasInterpolationFlagCF()) startix3 = startix3-offset;
+      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
+   }
+   if(block->hasInterpolationFlag(D3Q27System::TNE)) 
+   {
+      int startix1 = maxX1;
+      int endix1   = maxX1;
+      if(block->hasInterpolationFlagCF()) startix1 = startix1-offset;
+      int startix2 = maxX2;
+      int endix2   = maxX2;
+      if(block->hasInterpolationFlagCF()) startix2 = startix2-offset;
+      int startix3 = maxX3;
+      int endix3   = maxX3;
+      if(block->hasInterpolationFlagCF()) startix3 = startix3-offset;
+      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
+   }
+   if(block->hasInterpolationFlag(D3Q27System::TNW)) 
+   {
+      int startix1 = minX1;
+      int endix1   = minX1;
+      if(block->hasInterpolationFlagCF()) endix1 = endix1+offset;
+      int startix2 = maxX2;
+      int endix2   = maxX2;
+      if(block->hasInterpolationFlagCF()) startix2 = startix2-offset;
+      int startix3 = maxX3;
+      int endix3   = maxX3;
+      if(block->hasInterpolationFlagCF()) startix3 = startix3-offset;
+      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
+   }
+   if(block->hasInterpolationFlag(D3Q27System::TSE)) 
+   {
+      int startix1 = maxX1;
+      int endix1   = maxX1;
+      if(block->hasInterpolationFlagCF()) startix1 = startix1-offset;
+      int startix2 = minX2;
+      int endix2   = minX2;
+      if(block->hasInterpolationFlagCF()) endix2 = endix2+offset;
+      int startix3 = maxX3;
+      int endix3   = maxX3;
+      if(block->hasInterpolationFlagCF()) startix3 = startix3-offset;
+      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
+   }
+   if(block->hasInterpolationFlag(D3Q27System::TSW)) 
+   {
+      int startix1 = minX1;
+      int endix1   = minX1;
+      if(block->hasInterpolationFlagCF()) endix1 = endix1+offset;
+      int startix2 = minX2;
+      int endix2   = minX2;
+      if(block->hasInterpolationFlagCF()) endix2 = endix2+offset;
+      int startix3 = maxX3;
+      int endix3   = maxX3;
+      if(block->hasInterpolationFlagCF()) startix3 = startix3-offset;
+      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
+   }
+   if(block->hasInterpolationFlag(D3Q27System::BNE)) 
+   {
+      int startix1 = maxX1;
+      int endix1   = maxX1;
+      if(block->hasInterpolationFlagCF()) startix1 = startix1-offset;
+      int startix2 = maxX2;
+      int endix2   = maxX2;
+      if(block->hasInterpolationFlagCF()) startix2 = startix2-offset;
+      int startix3 = minX3;
+      int endix3   = minX3;
+      if(block->hasInterpolationFlagCF()) endix3 = endix3+offset;
+      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
+   }
+   if(block->hasInterpolationFlag(D3Q27System::BNW))
+   {
+      int startix1 = minX1;
+      int endix1   = minX1;
+      if(block->hasInterpolationFlagCF()) endix1 = endix1+offset;
+      int startix2 = maxX2;
+      int endix2   = maxX2;
+      if(block->hasInterpolationFlagCF()) startix2 = startix2-offset;
+      int startix3 = minX3;
+      int endix3   = minX3;
+      if(block->hasInterpolationFlagCF()) endix3 = endix3+offset;
+      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
+   }
+   if(block->hasInterpolationFlag(D3Q27System::BSE)) 
+   {
+      int startix1 = maxX1;
+      int endix1   = maxX1;
+      if(block->hasInterpolationFlagCF()) startix1 = startix1-offset;
+      int startix2 = minX2;
+      int endix2   = minX2;
+      if(block->hasInterpolationFlagCF()) endix2 = endix2+offset;
+      int startix3 = minX3;
+      int endix3   = minX3;
+      if(block->hasInterpolationFlagCF()) endix3 = endix3+offset;
+      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
+   }
+   if(block->hasInterpolationFlag(D3Q27System::BSW)) 
+   {
+      int startix1 = minX1;
+      int endix1   = minX1;
+      if(block->hasInterpolationFlagCF()) endix1 = endix1+offset;
+      int startix2 = minX2;
+      int endix2   = minX2;
+      if(block->hasInterpolationFlagCF()) endix2 = endix2+offset;
+      int startix3 = minX3;
+      int endix3   = minX3;
+      if(block->hasInterpolationFlagCF()) endix3 = endix3+offset;
+      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
+   }
+
+
+
+	//////////////////////////////////////////////////////////////////////////
+   int offset2 = 1;
+   int ll = 0;
+
+   minX1 = ll;
+   minX2 = ll;
+   minX3 = ll;
+
+   maxX1 = static_cast<int>(bcMatrix->getNX1())-1-ll;
+   maxX2 = static_cast<int>(bcMatrix->getNX2())-1-ll;
+   maxX3 = static_cast<int>(bcMatrix->getNX3())-1-ll;
+
+   if(block->hasInterpolationFlagFC(D3Q27System::E))
+   {
+      int startix1 = maxX1-offset2;
+      int endix1   = maxX1;
+      int startix2 = minX2;
+      int endix2   = maxX2;
+      int startix3 = minX3; 
+      int endix3   = maxX3;
+      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
+   }
+   if(block->hasInterpolationFlagFC(D3Q27System::W))
+   {
+      int startix1 = minX1;
+      int endix1   = minX1+offset2;
+      int startix2 = minX2;
+      int endix2   = maxX2;
+      int startix3 = minX3; 
+      int endix3   = maxX3;
+      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
+   }
+   if(block->hasInterpolationFlagFC(D3Q27System::N))
+   {
+      int startix1 = minX1;
+      int endix1   = maxX1;
+      int startix2 = maxX2-offset2;
+      int endix2   = maxX2;
+      int startix3 = minX3; 
+      int endix3   = maxX3;
+      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
+   }
+   if(block->hasInterpolationFlagFC(D3Q27System::S))
+   {
+      int startix1 = minX1;
+      int endix1   = maxX1;
+      int startix2 = minX2;
+      int endix2   = minX2+offset2;
+      int startix3 = minX3; 
+      int endix3   = maxX3;
+      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
+   }
+   if(block->hasInterpolationFlagFC(D3Q27System::T))
+   {
+      int startix1 = minX1;
+      int endix1   = maxX1;
+      int startix2 = minX2;
+      int endix2   = maxX2;
+      int startix3 = maxX3-offset2;
+      int endix3   = maxX3;
+      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
+   }
+   if(block->hasInterpolationFlagFC(D3Q27System::B))
+   {
+      int startix1 = minX1;
+      int endix1   = maxX1;
+      int startix2 = minX2;
+      int endix2   = maxX2;
+      int startix3 = minX3;
+      int endix3   = minX3+offset2;
+      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
+   }
+   if(block->hasInterpolationFlagFC(D3Q27System::NE))
+   {
+      int startix1 = maxX1-offset2;
+      int endix1   = maxX1;
+      int startix2 = maxX2-offset2;
+      int endix2   = maxX2;
+      int startix3 = minX3; 
+      int endix3   = maxX3;
+      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
+   }
+   if(block->hasInterpolationFlagFC(D3Q27System::SW))
+   {
+      int startix1 = minX1;
+      int endix1   = minX1+offset2;
+      int startix2 = minX2;
+      int endix2   = minX2+offset2;
+      int startix3 = minX3; 
+      int endix3   = maxX3;
+      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
+   }
+   if(block->hasInterpolationFlagFC(D3Q27System::SE))
+   {
+      int startix1 = maxX1-offset2;
+      int endix1   = maxX1;
+      int startix2 = minX2;
+      int endix2   = minX2+offset2;
+      int startix3 = minX3; 
+      int endix3   = maxX3;
+      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
+   }
+   if(block->hasInterpolationFlagFC(D3Q27System::NW))  
+   {
+      int startix1 = minX1;
+      int endix1   = minX1+offset2;
+      int startix2 = maxX2-offset2;
+      int endix2   = maxX2;
+      int startix3 = minX3; 
+      int endix3   = maxX3;
+      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
+   }
+   if(block->hasInterpolationFlagFC(D3Q27System::TE))  
+   {
+      int startix1 = maxX1-offset2;
+      int endix1   = maxX1;
+      int startix2 = minX2;
+      int endix2   = maxX2;
+      int startix3 = maxX3-offset2;
+      int endix3   = maxX3;
+      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
+   }
+   if(block->hasInterpolationFlagFC(D3Q27System::BW))  
+   {
+      int startix1 = minX1;
+      int endix1   = minX1+offset2;
+      int startix2 = minX2;
+      int endix2   = maxX2;
+      int startix3 = minX3;
+      int endix3   = minX3+offset2;
+      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
+   }
+   if(block->hasInterpolationFlagFC(D3Q27System::BE)) 
+   {
+      int startix1 = maxX1-offset2;
+      int endix1   = maxX1;
+      int startix2 = minX2;
+      int endix2   = maxX2;
+      int startix3 = minX3;
+      int endix3   = minX3+offset2;
+      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
+   }
+   if(block->hasInterpolationFlagFC(D3Q27System::TW))  
+   {
+      int startix1 = minX1;
+      int endix1   = minX1+offset2;
+      int startix2 = minX2;
+      int endix2   = maxX2;
+      int startix3 = maxX3-offset2;
+      int endix3   = maxX3;
+      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
+   }
+   if(block->hasInterpolationFlagFC(D3Q27System::TN)) 
+   {
+      int startix1 = minX1;
+      int endix1   = maxX1;
+      int startix2 = maxX2-offset2;
+      int endix2   = maxX2;
+      int startix3 = maxX3-offset2;
+      int endix3   = maxX3;
+      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
+   }
+   if(block->hasInterpolationFlagFC(D3Q27System::BS))  
+   {
+      int startix1 = minX1;
+      int endix1   = maxX1;
+      int startix2 = minX2;
+      int endix2   = minX2+offset2;
+      int startix3 = minX3;
+      int endix3   = minX3+offset2;
+      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
+   }
+   if(block->hasInterpolationFlagFC(D3Q27System::BN))  
+   {
+      int startix1 = minX1;
+      int endix1   = maxX1;
+      int startix2 = maxX2-offset2;
+      int endix2   = maxX2;
+      int startix3 = minX3;
+      int endix3   = minX3+offset2;
+      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
+   }
+   if(block->hasInterpolationFlagFC(D3Q27System::TS))  
+   {
+      int startix1 = minX1;
+      int endix1   = maxX1;
+      int startix2 = minX2;
+      int endix2   = minX2+offset2;
+      int startix3 = maxX3-offset2;
+      int endix3   = maxX3;
+      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
+   }
+   if(block->hasInterpolationFlagFC(D3Q27System::TNE)) 
+   {
+      int startix1 = maxX1-offset2;
+      int endix1   = maxX1;
+      int startix2 = maxX2-offset2;
+      int endix2   = maxX2;
+      int startix3 = maxX3-offset2;
+      int endix3   = maxX3;
+      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
+   }
+   if(block->hasInterpolationFlagFC(D3Q27System::TNW)) 
+   {
+      int startix1 = minX1;
+      int endix1   = minX1+offset2;
+      int startix2 = maxX2-offset2;
+      int endix2   = maxX2;
+      int startix3 = maxX3-offset2;
+      int endix3   = maxX3;
+      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
+   }
+   if(block->hasInterpolationFlagFC(D3Q27System::TSE)) 
+   {
+      int startix1 = maxX1-offset2;
+      int endix1   = maxX1;
+      int startix2 = minX2;
+      int endix2   = minX2+offset2;
+      int startix3 = maxX3-offset2;
+      int endix3   = maxX3;
+      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
+   }
+   if(block->hasInterpolationFlagFC(D3Q27System::TSW)) 
+   {
+      int startix1 = minX1;
+      int endix1   = minX1+offset2;
+      int startix2 = minX2;
+      int endix2   = minX2+offset2;
+      int startix3 = maxX3-offset2;
+      int endix3   = maxX3;
+      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
+   }
+   if(block->hasInterpolationFlagFC(D3Q27System::BNE)) 
+   {
+      int startix1 = maxX1-offset2;
+      int endix1   = maxX1;
+      int startix2 = maxX2-offset2;
+      int endix2   = maxX2;
+      int startix3 = minX3;
+      int endix3   = minX3+offset2;
+      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
+   }
+   if(block->hasInterpolationFlagFC(D3Q27System::BNW))
+   {
+      int startix1 = minX1;
+      int endix1   = minX1+offset2;
+      int startix2 = maxX2-offset2;
+      int endix2   = maxX2;
+      int startix3 = minX3;
+      int endix3   = minX3+offset2;
+      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
+   }
+   if(block->hasInterpolationFlagFC(D3Q27System::BSE)) 
+   {
+      int startix1 = maxX1-offset2;
+      int endix1   = maxX1;
+      int startix2 = minX2;
+      int endix2   = minX2+offset2;
+      int startix3 = minX3;
+      int endix3   = minX3+offset2;
+      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
+   }
+   if(block->hasInterpolationFlagFC(D3Q27System::BSW)) 
+   {
+      int startix1 = minX1;
+      int endix1   = minX1+offset2;
+      int startix2 = minX2;
+      int endix2   = minX2+offset2;
+      int startix3 = minX3;
+      int endix3   = minX3+offset2;
+      this->setNodesUndefined(startix1, endix1, startix2, endix2, startix3, endix3, bcMatrix);
+   }
+   
+   //invert scaleCF blocks
+   if(block->hasInterpolationFlagCF())
+   {
+      if(block->hasInterpolationFlagFC() && twoTypeOfConnectorsCheck) 
+      {
+         for (int i = D3Q27System::E; i <= D3Q27System::BSW; i++)
+         {
+             UBLOG(logINFO, "FC in dir="<<i<<" "<<block->hasInterpolationFlagFC(i));
+         }
+         for (int i = D3Q27System::E; i<=D3Q27System::BSW; i++)
+         {
+            UBLOG(logINFO, "CF in dir="<<i<<" "<<block->hasInterpolationFlagCF(i));
+         }
+         throw UbException(UB_EXARGS, "block "+block->toString()+" has CF and FC");
+      }
+
+      minX1 = gl;
+      minX2 = gl;
+      minX3 = gl;
+
+      maxX1 = static_cast<int>(bcMatrix->getNX1())-1-gl;
+      maxX2 = static_cast<int>(bcMatrix->getNX2())-1-gl;
+      maxX3 = static_cast<int>(bcMatrix->getNX3())-1-gl;
+
+      for (int ix3=minX3; ix3<=maxX3; ix3++)
+         for (int ix2=minX2; ix2<=maxX2; ix2++)
+            for (int ix1=minX1; ix1<=maxX1; ix1++)
+            {
+               if(bcMatrix->isUndefined(ix1, ix2, ix3)) bcMatrix->setFluid(ix1, ix2, ix3);
+               else                                    bcMatrix->setUndefined(ix1, ix2, ix3);
+            }
+            return;
+   }
+
+}
+//////////////////////////////////////////////////////////////////////////
+void SetUndefinedNodesBlockVisitor::setNodesUndefined( int startix1, int endix1, int startix2, int endix2, int startix3, int endix3, SPtr<BCArray3D> bcMatrix )
+{
+   for (int ix3=startix3; ix3<=endix3; ix3++)
+      for (int ix2=startix2; ix2<=endix2; ix2++)
+         for (int ix1=startix1; ix1<=endix1; ix1++)
+         {
+            bcMatrix->setUndefined(ix1, ix2, ix3);
+         }
+}
diff --git a/src/cpu/VirtualFluidsCore/Visitors/SetUndefinedNodesBlockVisitor.h b/src/cpu/VirtualFluidsCore/Visitors/SetUndefinedNodesBlockVisitor.h
index 9c47ca3e95545d724d2c6c20ee4859a62e91f94c..bf7e9e884eac391ee9d74fa9a1062f7d28e05434 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/SetUndefinedNodesBlockVisitor.h
+++ b/src/cpu/VirtualFluidsCore/Visitors/SetUndefinedNodesBlockVisitor.h
@@ -1,26 +1,26 @@
-#ifndef SetUndefinedNodesBlockVisitor_h
-#define SetUndefinedNodesBlockVisitor_h
-
-#include <PointerDefinitions.h>
-
-#include "Block3DVisitor.h"
-
-class Grid3D;
-class Block3D;
-class BCArray3D;
-
-class SetUndefinedNodesBlockVisitor : public Block3DVisitor
-{
-public:
-   SetUndefinedNodesBlockVisitor(bool twoTypeOfConnectorsCheck=true);
-
-   virtual ~SetUndefinedNodesBlockVisitor() {}
-
-   void visit(SPtr<Grid3D> grid, SPtr<Block3D> block) override;
-protected:
-   void setNodesUndefined( int startix1, int endix1, int startix2, int endix2, int startix3, int endix3, SPtr<BCArray3D> bcMatix );
-private:
-   bool twoTypeOfConnectorsCheck;
-
-};
-#endif
+#ifndef SetUndefinedNodesBlockVisitor_h
+#define SetUndefinedNodesBlockVisitor_h
+
+#include <PointerDefinitions.h>
+
+#include "Block3DVisitor.h"
+
+class Grid3D;
+class Block3D;
+class BCArray3D;
+
+class SetUndefinedNodesBlockVisitor : public Block3DVisitor
+{
+public:
+   SetUndefinedNodesBlockVisitor(bool twoTypeOfConnectorsCheck=true);
+
+   virtual ~SetUndefinedNodesBlockVisitor() {}
+
+   void visit(SPtr<Grid3D> grid, SPtr<Block3D> block) override;
+protected:
+   void setNodesUndefined( int startix1, int endix1, int startix2, int endix2, int startix3, int endix3, SPtr<BCArray3D> bcMatix );
+private:
+   bool twoTypeOfConnectorsCheck;
+
+};
+#endif
diff --git a/src/cpu/VirtualFluidsCore/Visitors/SpongeLayerBlockVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/SpongeLayerBlockVisitor.cpp
index 55edc6e1c2975a65c695b0edf12c5f8676916c0c..89db17a3d7e7f1cf5e4027ba5c7b1ed452f0b1a2 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/SpongeLayerBlockVisitor.cpp
+++ b/src/cpu/VirtualFluidsCore/Visitors/SpongeLayerBlockVisitor.cpp
@@ -1,123 +1,123 @@
-#include "SpongeLayerBlockVisitor.h"
-#include "Grid3DSystem.h"
-#include "LBMSystem.h"
-
-#include "Grid3D.h"
-#include "Block3D.h"
-#include "LBMKernel.h"
-#include "UbException.h"
-#include "D3Q27System.h"
-#include "BCArray3D.h"
-#include "BCProcessor.h"
-#include <geometry3d/GbCuboid3D.h>
-
-using namespace std;
-
-SpongeLayerBlockVisitor::SpongeLayerBlockVisitor(SPtr<GbCuboid3D> boundingBox, SPtr<LBMKernel> kernel, double nue, int dir) : 
-   Block3DVisitor(0, Grid3DSystem::MAXLEVEL),
-   boundingBox(boundingBox),
-   kernel(kernel),
-   nue(nue),
-   dir(dir)
-{
-   
-}
-//////////////////////////////////////////////////////////////////////////
-SpongeLayerBlockVisitor::~SpongeLayerBlockVisitor()
-{
-
-}
-//////////////////////////////////////////////////////////////////////////
-void SpongeLayerBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block)
-{
-   if (!boundingBox)
-   {
-      UB_THROW(UbException(UB_EXARGS, "The bounding box isn't set!"));
-   }
-   if (!kernel)
-   {
-      UB_THROW(UbException(UB_EXARGS, "The kernel isn't set!"));
-   }
-   if (kernel && (block->getRank() == grid->getRank()))
-   {
-      UbTupleDouble3 org = grid->getBlockWorldCoordinates(block);
-      UbTupleDouble3 blockLengths = grid->getBlockLengths(block);
-
-      double minX1 = val<1>(org);
-      double minX2 = val<2>(org);
-      double minX3 = val<3>(org);
-      double maxX1 = val<1>(org)+val<1>(blockLengths);
-      double maxX2 = val<2>(org)+val<2>(blockLengths);
-      double maxX3 = val<3>(org)+val<3>(blockLengths);
-
-      if (boundingBox->isCellInsideGbObject3D(minX1, minX2, minX3, maxX1, maxX2, maxX3))
-      {
-         LBMReal collFactor = LBMSystem::calcCollisionFactor(nue, block->getLevel());
-         kernel->setCollisionFactor(collFactor);
-         kernel->setIndex(block->getX1(), block->getX2(), block->getX3());
-         kernel->setDeltaT(LBMSystem::getDeltaT(block->getLevel()));
-         kernel->setBlock(block);
-         SPtr<LBMKernel> newKernel = kernel->clone();
-
-         SPtr<DataSet3D> dataSet = block->getKernel()->getDataSet();
-         if (!dataSet)
-         {
-            UB_THROW(UbException(UB_EXARGS, "It is not possible to change a DataSet in kernel! Old DataSet is not exist!"));
-         }
-
-         newKernel->setDataSet(dataSet);
-
-         SPtr<BCProcessor> bcProc = block->getKernel()->getBCProcessor();
-         if (!bcProc)
-         {
-            UB_THROW(UbException(UB_EXARGS, "It is not possible to change a BCProcessor in kernel! Old BCProcessor is not exist!"));
-         }
-         newKernel->setBCProcessor(bcProc);
-
-         double oldCollFactor = newKernel->getCollisionFactor();
-
- 
-         UbTupleInt3 ixMin = grid->getBlockIndexes(boundingBox->getX1Minimum(),boundingBox->getX2Minimum(),boundingBox->getX3Minimum());
-         UbTupleInt3 ixMax = grid->getBlockIndexes(boundingBox->getX1Maximum(),boundingBox->getX2Maximum(),boundingBox->getX3Maximum());
-
-         double newCollFactor;
-
-         if (dir == D3Q27System::E)
-         {
-            int ibX1 = block->getX1();
-            int ibMax = val<1>(ixMax)-val<1>(ixMin)+1;
-            double index = (double)(ibX1-val<1>(ixMin)+1);
-            newCollFactor = oldCollFactor - (oldCollFactor-1.0)/(double)(ibMax)*index;
-         } 
-         else if (dir == D3Q27System::W)
-         {
-            int ibX1 = block->getX1();
-            int ibMax = val<1>(ixMax)-val<1>(ixMin)+1;
-            double index = (double)(ibX1-val<1>(ixMin)+1);
-            newCollFactor = (oldCollFactor-1.0)/(double)(ibMax)*index;
-         }
-         else if (dir == D3Q27System::T)
-         {
-            int ibX3 = block->getX3();
-            int ibMax = val<3>(ixMax)-val<3>(ixMin)+1;
-            double index = (double)(ibX3-val<3>(ixMin)+1);
-            newCollFactor = oldCollFactor - (oldCollFactor-1.0)/(double)(ibMax)*index;
-         }
-         else if (dir == D3Q27System::B)
-         {
-            int ibX3 = block->getX3();
-            int ibMax = val<3>(ixMax)-val<3>(ixMin)+1;
-            double index = (double)(ibX3-val<3>(ixMin)+1);
-            newCollFactor = (oldCollFactor-1.0)/(double)(ibMax)*index;
-         }
-
-
-         newKernel->setCollisionFactor(newCollFactor);
-         block->setKernel(newKernel);
-      }
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-
-
-
+#include "SpongeLayerBlockVisitor.h"
+#include "Grid3DSystem.h"
+#include "LBMSystem.h"
+
+#include "Grid3D.h"
+#include "Block3D.h"
+#include "LBMKernel.h"
+#include "UbException.h"
+#include "D3Q27System.h"
+#include "BCArray3D.h"
+#include "BCProcessor.h"
+#include <geometry3d/GbCuboid3D.h>
+
+using namespace std;
+
+SpongeLayerBlockVisitor::SpongeLayerBlockVisitor(SPtr<GbCuboid3D> boundingBox, SPtr<LBMKernel> kernel, double nue, int dir) : 
+   Block3DVisitor(0, Grid3DSystem::MAXLEVEL),
+   boundingBox(boundingBox),
+   kernel(kernel),
+   nue(nue),
+   dir(dir)
+{
+   
+}
+//////////////////////////////////////////////////////////////////////////
+SpongeLayerBlockVisitor::~SpongeLayerBlockVisitor()
+{
+
+}
+//////////////////////////////////////////////////////////////////////////
+void SpongeLayerBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block)
+{
+   if (!boundingBox)
+   {
+      UB_THROW(UbException(UB_EXARGS, "The bounding box isn't set!"));
+   }
+   if (!kernel)
+   {
+      UB_THROW(UbException(UB_EXARGS, "The kernel isn't set!"));
+   }
+   if (kernel && (block->getRank() == grid->getRank()))
+   {
+      UbTupleDouble3 org = grid->getBlockWorldCoordinates(block);
+      UbTupleDouble3 blockLengths = grid->getBlockLengths(block);
+
+      double minX1 = val<1>(org);
+      double minX2 = val<2>(org);
+      double minX3 = val<3>(org);
+      double maxX1 = val<1>(org)+val<1>(blockLengths);
+      double maxX2 = val<2>(org)+val<2>(blockLengths);
+      double maxX3 = val<3>(org)+val<3>(blockLengths);
+
+      if (boundingBox->isCellInsideGbObject3D(minX1, minX2, minX3, maxX1, maxX2, maxX3))
+      {
+         LBMReal collFactor = LBMSystem::calcCollisionFactor(nue, block->getLevel());
+         kernel->setCollisionFactor(collFactor);
+         kernel->setIndex(block->getX1(), block->getX2(), block->getX3());
+         kernel->setDeltaT(LBMSystem::getDeltaT(block->getLevel()));
+         kernel->setBlock(block);
+         SPtr<LBMKernel> newKernel = kernel->clone();
+
+         SPtr<DataSet3D> dataSet = block->getKernel()->getDataSet();
+         if (!dataSet)
+         {
+            UB_THROW(UbException(UB_EXARGS, "It is not possible to change a DataSet in kernel! Old DataSet is not exist!"));
+         }
+
+         newKernel->setDataSet(dataSet);
+
+         SPtr<BCProcessor> bcProc = block->getKernel()->getBCProcessor();
+         if (!bcProc)
+         {
+            UB_THROW(UbException(UB_EXARGS, "It is not possible to change a BCProcessor in kernel! Old BCProcessor is not exist!"));
+         }
+         newKernel->setBCProcessor(bcProc);
+
+         double oldCollFactor = newKernel->getCollisionFactor();
+
+ 
+         UbTupleInt3 ixMin = grid->getBlockIndexes(boundingBox->getX1Minimum(),boundingBox->getX2Minimum(),boundingBox->getX3Minimum());
+         UbTupleInt3 ixMax = grid->getBlockIndexes(boundingBox->getX1Maximum(),boundingBox->getX2Maximum(),boundingBox->getX3Maximum());
+
+         double newCollFactor;
+
+         if (dir == D3Q27System::E)
+         {
+            int ibX1 = block->getX1();
+            int ibMax = val<1>(ixMax)-val<1>(ixMin)+1;
+            double index = (double)(ibX1-val<1>(ixMin)+1);
+            newCollFactor = oldCollFactor - (oldCollFactor-1.0)/(double)(ibMax)*index;
+         } 
+         else if (dir == D3Q27System::W)
+         {
+            int ibX1 = block->getX1();
+            int ibMax = val<1>(ixMax)-val<1>(ixMin)+1;
+            double index = (double)(ibX1-val<1>(ixMin)+1);
+            newCollFactor = (oldCollFactor-1.0)/(double)(ibMax)*index;
+         }
+         else if (dir == D3Q27System::T)
+         {
+            int ibX3 = block->getX3();
+            int ibMax = val<3>(ixMax)-val<3>(ixMin)+1;
+            double index = (double)(ibX3-val<3>(ixMin)+1);
+            newCollFactor = oldCollFactor - (oldCollFactor-1.0)/(double)(ibMax)*index;
+         }
+         else if (dir == D3Q27System::B)
+         {
+            int ibX3 = block->getX3();
+            int ibMax = val<3>(ixMax)-val<3>(ixMin)+1;
+            double index = (double)(ibX3-val<3>(ixMin)+1);
+            newCollFactor = (oldCollFactor-1.0)/(double)(ibMax)*index;
+         }
+
+
+         newKernel->setCollisionFactor(newCollFactor);
+         block->setKernel(newKernel);
+      }
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+
+
+
diff --git a/src/cpu/VirtualFluidsCore/Visitors/SpongeLayerBlockVisitor.h b/src/cpu/VirtualFluidsCore/Visitors/SpongeLayerBlockVisitor.h
index ec6fbde2db75b24532cd14f31f9252d4b5823087..9b7091d2eee1f8ea6fefc835dd7ff216cce1576c 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/SpongeLayerBlockVisitor.h
+++ b/src/cpu/VirtualFluidsCore/Visitors/SpongeLayerBlockVisitor.h
@@ -1,30 +1,30 @@
-#ifndef SpongeLayerBlockVisitor_h__
-#define SpongeLayerBlockVisitor_h__
-
-#include "Block3DVisitor.h"
-#include "D3Q27System.h"
-
-class Grid3D;
-class Block3D;
-class GbCuboid3D;
-class LBMKernel;
-
-//! \brief Set sponge layer for all blocks inside boundingBox
-//! \details This visitor sets viscosity gradient inside bounding box. 
-//! \author K. Kutscher
-class SpongeLayerBlockVisitor : public Block3DVisitor
-{
-public:
-   SpongeLayerBlockVisitor(SPtr<GbCuboid3D> boundingBox, SPtr<LBMKernel> kernel, double nue, int dir);
-   virtual ~SpongeLayerBlockVisitor();
-
-   void visit(SPtr<Grid3D> grid, SPtr<Block3D> block) override;
-
-private:
-    SPtr<GbCuboid3D> boundingBox;
-    SPtr<LBMKernel> kernel;
-    double nue;
-    int dir;
-};
-
-#endif // SetSpongeLayerBlockVisitor_h__
+#ifndef SpongeLayerBlockVisitor_h__
+#define SpongeLayerBlockVisitor_h__
+
+#include "Block3DVisitor.h"
+#include "D3Q27System.h"
+
+class Grid3D;
+class Block3D;
+class GbCuboid3D;
+class LBMKernel;
+
+//! \brief Set sponge layer for all blocks inside boundingBox
+//! \details This visitor sets viscosity gradient inside bounding box. 
+//! \author K. Kutscher
+class SpongeLayerBlockVisitor : public Block3DVisitor
+{
+public:
+   SpongeLayerBlockVisitor(SPtr<GbCuboid3D> boundingBox, SPtr<LBMKernel> kernel, double nue, int dir);
+   virtual ~SpongeLayerBlockVisitor();
+
+   void visit(SPtr<Grid3D> grid, SPtr<Block3D> block) override;
+
+private:
+    SPtr<GbCuboid3D> boundingBox;
+    SPtr<LBMKernel> kernel;
+    double nue;
+    int dir;
+};
+
+#endif // SetSpongeLayerBlockVisitor_h__
diff --git a/src/cpu/VirtualFluidsCore/Visitors/ViscosityBlockVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/ViscosityBlockVisitor.cpp
index e74bb164233bf352371bd0fd9227ae8452ab6654..ba1002ef82ebf4359af88e4e2e239614fef34809 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/ViscosityBlockVisitor.cpp
+++ b/src/cpu/VirtualFluidsCore/Visitors/ViscosityBlockVisitor.cpp
@@ -1,22 +1,22 @@
-#include "ViscosityBlockVisitor.h"
-#include "Grid3DSystem.h"
-#include "LBMSystem.h"
-#include "Block3D.h"
-#include "Grid3D.h"
-#include "ILBMKernel.h"
-
-ViscosityBlockVisitor::ViscosityBlockVisitor(LBMReal nu) :
-Block3DVisitor(0, Grid3DSystem::MAXLEVEL), nu(nu)
-{
-
-}
-//////////////////////////////////////////////////////////////////////////
-void ViscosityBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block)
-{
-   if (block->getRank() == grid->getRank())
-   {
-      LBMReal collFactor = LBMSystem::calcCollisionFactor(nu, block->getLevel());
-      block->getKernel()->setCollisionFactor(collFactor);
-   }
-}
-
+#include "ViscosityBlockVisitor.h"
+#include "Grid3DSystem.h"
+#include "LBMSystem.h"
+#include "Block3D.h"
+#include "Grid3D.h"
+#include "ILBMKernel.h"
+
+ViscosityBlockVisitor::ViscosityBlockVisitor(LBMReal nu) :
+Block3DVisitor(0, Grid3DSystem::MAXLEVEL), nu(nu)
+{
+
+}
+//////////////////////////////////////////////////////////////////////////
+void ViscosityBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block)
+{
+   if (block->getRank() == grid->getRank())
+   {
+      LBMReal collFactor = LBMSystem::calcCollisionFactor(nu, block->getLevel());
+      block->getKernel()->setCollisionFactor(collFactor);
+   }
+}
+
diff --git a/src/cpu/VirtualFluidsCore/Visitors/ViscosityBlockVisitor.h b/src/cpu/VirtualFluidsCore/Visitors/ViscosityBlockVisitor.h
index 1ea9a53d590501027f7dd082196cdd48a98e04b9..881d01f51840397e44604f178cf02ebf5e12c335 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/ViscosityBlockVisitor.h
+++ b/src/cpu/VirtualFluidsCore/Visitors/ViscosityBlockVisitor.h
@@ -1,25 +1,25 @@
-#ifndef ViscosityBlockVisitor_h
-#define ViscosityBlockVisitor_h
-
-#include <PointerDefinitions.h>
-
-#include "Block3DVisitor.h"
-#include "LBMSystem.h"
-
-class Grid3D;
-class Block3D;
-
-class ViscosityBlockVisitor : public Block3DVisitor
-{
-public:
-   ViscosityBlockVisitor(LBMReal nu);
-
-   virtual ~ViscosityBlockVisitor() {}
-
-   void visit(SPtr<Grid3D> grid, SPtr<Block3D> block) override;
-
-private:
-   LBMReal nu;
-};
-
-#endif
+#ifndef ViscosityBlockVisitor_h
+#define ViscosityBlockVisitor_h
+
+#include <PointerDefinitions.h>
+
+#include "Block3DVisitor.h"
+#include "LBMSystem.h"
+
+class Grid3D;
+class Block3D;
+
+class ViscosityBlockVisitor : public Block3DVisitor
+{
+public:
+   ViscosityBlockVisitor(LBMReal nu);
+
+   virtual ~ViscosityBlockVisitor() {}
+
+   void visit(SPtr<Grid3D> grid, SPtr<Block3D> block) override;
+
+private:
+   LBMReal nu;
+};
+
+#endif
diff --git a/src/cpu/VirtualFluidsCore/Visitors/ZoltanPartitioningGridVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/ZoltanPartitioningGridVisitor.cpp
index 022b9d0ca6824ff0b1bc61902df6de60276fe46c..ebbc5ec54aa236fe588d509a7b6035901dbf96e6 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/ZoltanPartitioningGridVisitor.cpp
+++ b/src/cpu/VirtualFluidsCore/Visitors/ZoltanPartitioningGridVisitor.cpp
@@ -1,148 +1,148 @@
-#if defined VF_ZOLTAN && defined VF_MPI
-
-#include "ZoltanPartitioningGridVisitor.h"
-#include <vector>
-#include "UbLogger.h"
-#include "UbException.h"
-#include "Grid3D.h"
-#include "Block3D.h"
-
-using namespace std;
-
-ZoltanPartitioningGridVisitor::ZoltanPartitioningGridVisitor(SPtr<Communicator> comm, int numOfDirs, int numOfLocalParts) :
-comm(comm), 
-numOfDirs(numOfDirs), 
-numOfLocalParts(numOfLocalParts)
-{
-}
-//////////////////////////////////////////////////////////////////////////
-ZoltanPartitioningGridVisitor::~ZoltanPartitioningGridVisitor()
-{
-
-}
-//////////////////////////////////////////////////////////////////////////
-void ZoltanPartitioningGridVisitor::visit(SPtr<Grid3D> grid)
-{
-   UBLOG(logDEBUG5, "ZoltanPartitioningPatchVisitor::visit() - start");
-
-   //MPI_Comm mpi_comm = *((MPI_Comm*) comm->getNativeCommunicator());
-
-   //ZoltanPartitioner zp(mpi_comm, comm->getProcessID(), numOfLocalParts);
-   //
-   //graph = zp.getGraphData();
-   
-   collectData(grid);
-
-   //zp.partition();
-
-   //repartGrid(grid, zp);
-
-   UBLOG(logDEBUG5, "ZoltanPartitioningPatchVisitor::visit() - end");
-}
-//////////////////////////////////////////////////////////////////////////
-void ZoltanPartitioningGridVisitor::collectData(SPtr<Grid3D> grid)
-{
-   int myRank = comm->getProcessID();
-   int numOfProc = comm->getNumberOfProcesses();
-
-   if (numOfProc < 2)
-   {
-      return;
-   }
-
-   int minInitLevel = grid->getCoarsestInitializedLevel();
-   int maxInitLevel = grid->getFinestInitializedLevel();
-
-   for (int l = minInitLevel; l<=maxInitLevel; l++)
-   {
-      MPI_Comm mpi_comm = *((MPI_Comm*)comm->getNativeCommunicator());
-      ZoltanPartitioner zp(mpi_comm, comm->getProcessID(), numOfLocalParts);
-      graph = zp.getGraphData();
-
-      int n = 0;
-      vector<SPtr<Block3D>> blockVector;
-      grid->getBlocks(l, blockVector);
-
-      if (blockVector.size() == 0)
-      {
-         UB_THROW(UbException(UB_EXARGS, "Blocks for decomposition don't exist!"));
-      }
-
-      //Verteilung von Ranks
-      int rank = 0;
-      for(SPtr<Block3D> block : blockVector)
-      {
-         block->setRank(rank);
-         block->setPart(rank);
-         rank++;
-         if (rank > numOfProc - 1)
-            rank = 0;
-      }
-
-      int vertices = 0;
-
-      for(SPtr<Block3D> block : blockVector)
-      {
-         if (block->getRank() == myRank)
-         {
-            vertices++;
-
-            vertexGID.push_back(block->getGlobalID());
-
-            int edges = 0;
-            for (int dir = 0; dir <= numOfDirs; dir++)
-            {
-               SPtr<Block3D> neighBlock = (grid->getNeighborBlock(dir,
-                  block->getX1(), block->getX2(), block->getX3(), l));
-
-               if (neighBlock)
-               {
-                  edges++;
-                  nborGID.push_back(neighBlock->getGlobalID());
-                  nborProc.push_back(neighBlock->getRank());
-               }
-            }
-            numEdges.push_back(edges);
-         }
-      }
-      graph->numLocalVertices = vertices;
-      graph->vnumEdges = numEdges;
-      graph->vvertexGID = vertexGID;
-      graph->vnborGID = nborGID;
-      graph->vnborProc = nborProc;
-
-      zp.partition();
-      repartGrid(grid, zp);
-   }
-}
-//////////////////////////////////////////////////////////////////////////
-void ZoltanPartitioningGridVisitor::repartGrid(SPtr<Grid3D> grid, ZoltanPartitioner& zp)
-{
-   if (zp.areChanges())
-   {
-      UBLOG(logDEBUG5, "ZoltanPartitioningPatchVisitor::repartGrid - start" );
-      vector<int> sExportGlobalGids, sExportToPart, sExportProcs;
-      vector<int> rExportGlobalGids, rExportToPart, rExportProcs;
-
-      zp.getExportData(sExportGlobalGids, sExportToPart, sExportProcs);
-
-      comm->allGather(sExportGlobalGids, rExportGlobalGids);
-      comm->allGather(sExportToPart, rExportToPart);
-      comm->allGather(sExportProcs, rExportProcs);
-
-      for (int i = 0; i < (int)rExportGlobalGids.size(); i++)
-      {
-         if (rExportGlobalGids[i] != -1)
-         {
-            SPtr<Block3D> block = grid->getBlock(rExportGlobalGids[i]);
-            if(block)
-            {
-               block->setRank(rExportProcs[i]);
-               block->setPart(rExportToPart[i]);
-            }
-         }
-      }
-      UBLOG(logDEBUG5, "ZoltanPartitioningPatchVisitor::repartGrid - end" );
-   }
-}
-#endif
+#if defined VF_ZOLTAN && defined VF_MPI
+
+#include "ZoltanPartitioningGridVisitor.h"
+#include <vector>
+#include "UbLogger.h"
+#include "UbException.h"
+#include "Grid3D.h"
+#include "Block3D.h"
+
+using namespace std;
+
+ZoltanPartitioningGridVisitor::ZoltanPartitioningGridVisitor(SPtr<Communicator> comm, int numOfDirs, int numOfLocalParts) :
+comm(comm), 
+numOfDirs(numOfDirs), 
+numOfLocalParts(numOfLocalParts)
+{
+}
+//////////////////////////////////////////////////////////////////////////
+ZoltanPartitioningGridVisitor::~ZoltanPartitioningGridVisitor()
+{
+
+}
+//////////////////////////////////////////////////////////////////////////
+void ZoltanPartitioningGridVisitor::visit(SPtr<Grid3D> grid)
+{
+   UBLOG(logDEBUG5, "ZoltanPartitioningPatchVisitor::visit() - start");
+
+   //MPI_Comm mpi_comm = *((MPI_Comm*) comm->getNativeCommunicator());
+
+   //ZoltanPartitioner zp(mpi_comm, comm->getProcessID(), numOfLocalParts);
+   //
+   //graph = zp.getGraphData();
+   
+   collectData(grid);
+
+   //zp.partition();
+
+   //repartGrid(grid, zp);
+
+   UBLOG(logDEBUG5, "ZoltanPartitioningPatchVisitor::visit() - end");
+}
+//////////////////////////////////////////////////////////////////////////
+void ZoltanPartitioningGridVisitor::collectData(SPtr<Grid3D> grid)
+{
+   int myRank = comm->getProcessID();
+   int numOfProc = comm->getNumberOfProcesses();
+
+   if (numOfProc < 2)
+   {
+      return;
+   }
+
+   int minInitLevel = grid->getCoarsestInitializedLevel();
+   int maxInitLevel = grid->getFinestInitializedLevel();
+
+   for (int l = minInitLevel; l<=maxInitLevel; l++)
+   {
+      MPI_Comm mpi_comm = *((MPI_Comm*)comm->getNativeCommunicator());
+      ZoltanPartitioner zp(mpi_comm, comm->getProcessID(), numOfLocalParts);
+      graph = zp.getGraphData();
+
+      int n = 0;
+      vector<SPtr<Block3D>> blockVector;
+      grid->getBlocks(l, blockVector);
+
+      if (blockVector.size() == 0)
+      {
+         UB_THROW(UbException(UB_EXARGS, "Blocks for decomposition don't exist!"));
+      }
+
+      //Verteilung von Ranks
+      int rank = 0;
+      for(SPtr<Block3D> block : blockVector)
+      {
+         block->setRank(rank);
+         block->setPart(rank);
+         rank++;
+         if (rank > numOfProc - 1)
+            rank = 0;
+      }
+
+      int vertices = 0;
+
+      for(SPtr<Block3D> block : blockVector)
+      {
+         if (block->getRank() == myRank)
+         {
+            vertices++;
+
+            vertexGID.push_back(block->getGlobalID());
+
+            int edges = 0;
+            for (int dir = 0; dir <= numOfDirs; dir++)
+            {
+               SPtr<Block3D> neighBlock = (grid->getNeighborBlock(dir,
+                  block->getX1(), block->getX2(), block->getX3(), l));
+
+               if (neighBlock)
+               {
+                  edges++;
+                  nborGID.push_back(neighBlock->getGlobalID());
+                  nborProc.push_back(neighBlock->getRank());
+               }
+            }
+            numEdges.push_back(edges);
+         }
+      }
+      graph->numLocalVertices = vertices;
+      graph->vnumEdges = numEdges;
+      graph->vvertexGID = vertexGID;
+      graph->vnborGID = nborGID;
+      graph->vnborProc = nborProc;
+
+      zp.partition();
+      repartGrid(grid, zp);
+   }
+}
+//////////////////////////////////////////////////////////////////////////
+void ZoltanPartitioningGridVisitor::repartGrid(SPtr<Grid3D> grid, ZoltanPartitioner& zp)
+{
+   if (zp.areChanges())
+   {
+      UBLOG(logDEBUG5, "ZoltanPartitioningPatchVisitor::repartGrid - start" );
+      vector<int> sExportGlobalGids, sExportToPart, sExportProcs;
+      vector<int> rExportGlobalGids, rExportToPart, rExportProcs;
+
+      zp.getExportData(sExportGlobalGids, sExportToPart, sExportProcs);
+
+      comm->allGather(sExportGlobalGids, rExportGlobalGids);
+      comm->allGather(sExportToPart, rExportToPart);
+      comm->allGather(sExportProcs, rExportProcs);
+
+      for (int i = 0; i < (int)rExportGlobalGids.size(); i++)
+      {
+         if (rExportGlobalGids[i] != -1)
+         {
+            SPtr<Block3D> block = grid->getBlock(rExportGlobalGids[i]);
+            if(block)
+            {
+               block->setRank(rExportProcs[i]);
+               block->setPart(rExportToPart[i]);
+            }
+         }
+      }
+      UBLOG(logDEBUG5, "ZoltanPartitioningPatchVisitor::repartGrid - end" );
+   }
+}
+#endif
diff --git a/src/cpu/VirtualFluidsCore/Visitors/ZoltanPartitioningGridVisitor.h b/src/cpu/VirtualFluidsCore/Visitors/ZoltanPartitioningGridVisitor.h
index 3a328ddc54deb8f9f16cae840d30dbbc841a43e6..f99134e4f5099b6ac5f9d634d5f65749529b6f3e 100644
--- a/src/cpu/VirtualFluidsCore/Visitors/ZoltanPartitioningGridVisitor.h
+++ b/src/cpu/VirtualFluidsCore/Visitors/ZoltanPartitioningGridVisitor.h
@@ -1,38 +1,38 @@
-/**
-* @file ZoltanPartitioningPatchVisitor.h
-* @brief Visitor class wich apply Zoltan library partitioning.
-* @author Kostyantyn Kucher
-* @date 10.06.2011
-*/
-
-#ifndef ZoltanPartitioningGridVisitor_H
-#define ZoltanPartitioningGridVisitor_H
-
-#if defined VF_ZOLTAN && defined VF_MPI
-
-#include "Grid3DVisitor.h"
-#include "Communicator.h"
-#include "ZoltanPartitioner.h"
-
-class ZoltanPartitioningGridVisitor : public Grid3DVisitor
-{
-public:
-   ZoltanPartitioningGridVisitor(SPtr<Communicator> comm, int numOfDirs, int numOfLocalParts = 1);
-   ~ZoltanPartitioningGridVisitor();
-   void visit(SPtr<Grid3D> grid);
-protected:
-   void collectData(SPtr<Grid3D> grid);
-   void repartGrid(SPtr<Grid3D> grid, ZoltanPartitioner& zp);
-private:
-   SPtr<Communicator> comm;
-   int numOfDirs;
-   int numOfLocalParts;
-   ZoltanGraph *graph;
-   std::vector<int> vertexGID;
-   std::vector<int> numEdges;
-   std::vector<int> nborGID;
-   std::vector<int> nborProc;
-};
-
-#endif
-#endif
+/**
+* @file ZoltanPartitioningPatchVisitor.h
+* @brief Visitor class wich apply Zoltan library partitioning.
+* @author Kostyantyn Kucher
+* @date 10.06.2011
+*/
+
+#ifndef ZoltanPartitioningGridVisitor_H
+#define ZoltanPartitioningGridVisitor_H
+
+#if defined VF_ZOLTAN && defined VF_MPI
+
+#include "Grid3DVisitor.h"
+#include "Communicator.h"
+#include "ZoltanPartitioner.h"
+
+class ZoltanPartitioningGridVisitor : public Grid3DVisitor
+{
+public:
+   ZoltanPartitioningGridVisitor(SPtr<Communicator> comm, int numOfDirs, int numOfLocalParts = 1);
+   ~ZoltanPartitioningGridVisitor();
+   void visit(SPtr<Grid3D> grid);
+protected:
+   void collectData(SPtr<Grid3D> grid);
+   void repartGrid(SPtr<Grid3D> grid, ZoltanPartitioner& zp);
+private:
+   SPtr<Communicator> comm;
+   int numOfDirs;
+   int numOfLocalParts;
+   ZoltanGraph *graph;
+   std::vector<int> vertexGID;
+   std::vector<int> numEdges;
+   std::vector<int> nborGID;
+   std::vector<int> nborProc;
+};
+
+#endif
+#endif