diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000000000000000000000000000000000000..3d672df902e6b1046fcd742d7ef9eee1d542a901
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,128 @@
+cmake_minimum_required(VERSION 3.9 FATAL_ERROR)
+
+if(POLICY CMP0042)
+   CMAKE_POLICY(SET CMP0042 NEW)
+endif()
+if(POLICY CMP0020)
+   CMAKE_POLICY(SET CMP0020 NEW)
+endif()
+if(POLICY CMP0028)
+   CMAKE_POLICY(SET CMP0028 NEW)
+endif()
+if(POLICY CMP0037)
+   CMAKE_POLICY(SET CMP0037 NEW)
+endif()
+if(POLICY CMP0047)
+   CMAKE_POLICY(SET CMP0047 NEW)
+endif()
+if(POLICY CMP0053)
+   CMAKE_POLICY(SET CMP0053 NEW)
+endif()
+if(POLICY CMP0054)
+   CMAKE_POLICY(SET CMP0054 NEW)
+endif()
+
+
+if(UNIX)
+  set(CMAKE_CXX_STANDARD 11)
+endif()
+
+#############################################################
+###                     CUDAPATH                          ###
+#############################################################
+
+# if CMake cannot find CUDA by itself, set the correct paths manually:
+#SET(CUDA_CUT_INCLUDE_DIR    "/cluster/cuda/9.0/include;/cluster/cuda/9.0/samples/common/inc" CACHE PATH "CUDA_CUT_INCLUDE_DIR")
+#SET(CUDA_SAMPLE_INCLUDE_DIR "/cluster/cuda/9.0/samples/common/inc" CACHE PATH "CUDA_CUT_INCLUDE_DIR")
+
+#############################################################
+###                   GENERAL MACROS                      ###
+#############################################################
+
+set(cmakeMacroPath "CMakeMacros")
+include(${CMAKE_SOURCE_DIR}/${cmakeMacroPath}/general/BuildTarget.cmake)
+include(${CMAKE_SOURCE_DIR}/${cmakeMacroPath}/general/BuildTargetUtilities.cmake)
+include(${CMAKE_SOURCE_DIR}/${cmakeMacroPath}/general/EndingsToCollect.cmake)
+include(${CMAKE_SOURCE_DIR}/${cmakeMacroPath}/general/FileUtilities.cmake)
+
+#############################################################
+###                   PROJECT SETTINGS                    ###
+#############################################################
+
+project(VirtualFluidsGpuCodes)
+
+set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+include_directories(${CMAKE_BINARY_DIR})
+
+set_property(GLOBAL PROPERTY USE_FOLDERS ON)
+set_property(GLOBAL PROPERTY PREDEFINED_TARGETS_FOLDER ".cmake")
+
+set(libraryFolder    "libs")
+set(gksLibraryFolder "libs/GKS")
+
+set(testFolder "tests")
+
+set(appFolder    "apps")
+
+set(thirdPartyFolder "3rdParty")
+
+IF(MSVC)
+   ADD_DEFINITIONS ( "-DNOMINMAX" )                # Disable Min/Max-Macros
+   ADD_DEFINITIONS ( "-D_CRT_SECURE_NO_WARNINGS" ) # disable warnings promoting Microsoft's security enhanced CRT
+   ADD_DEFINITIONS ( "-D_SCL_SECURE_NO_WARNINGS" ) # disable warnings triggered by Microsoft's checked iterators
+   SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -MP" ) # enable multi-threaded compiling
+   SET( CMAKE_CXX_FLAGS  "${CMAKE_CXX_FLAGS} /bigobj" ) # enable big object files (fatal error C1128)
+ENDIF(MSVC)
+
+#############################################################
+###                         OPTIONS                       ###
+#############################################################
+option(BUILD_SHARED_LIBS        "Build shared libraries"  ON )
+
+option(VF_DOUBLE_ACCURACY       "Use double accuracy"     ON )
+
+#############################################################
+
+enable_language(CUDA)
+
+sharedLibs()
+
+#############################################################
+
+include(${CMAKE_SOURCE_DIR}/${cmakeMacroPath}/general/FindCompiler.cmake)
+configure_file(src/VirtualFluidsDefinitions.in.h VirtualFluidsDefinitions.h)
+IF(MSVC)
+  SET( CMAKE_CXX_FLAGS "/FI${CMAKE_BINARY_DIR}/VirtualFluidsDefinitions.h ${CMAKE_CXX_FLAGS}" )
+ELSE(MSVC)
+  SET( CMAKE_CXX_FLAGS "-include ${CMAKE_BINARY_DIR}/VirtualFluidsDefinitions.h ${CMAKE_CXX_FLAGS}" )
+ENDIF(MSVC)
+
+# only use this with device of CC larger than 6.0
+IF(VF_DOUBLE_ACCURACY)
+	set(CMAKE_CUDA_FLAGS " -arch=sm_60" CACHE STRING "" FORCE)
+ELSE(VF_DOUBLE_ACCURACY)	
+	set(CMAKE_CUDA_FLAGS "" CACHE STRING "" FORCE)
+ENDIF(VF_DOUBLE_ACCURACY)
+set(CMAKE_CUDA_FLAGS_DEBUG " -G" CACHE STRING "" FORCE)
+
+
+##########################################################################################################################
+###                  Subdirectories                                                                                    ###
+##########################################################################################################################
+
+#############################################################
+###                  Core                                 ###
+#############################################################
+
+add_subdirectory(targets/libs/VirtualFluidsBasics)
+add_subdirectory(targets/libs/Core)
+
+add_subdirectory(targets/libs/GridGenerator)
+
+add_subdirectory(targets/libs/VirtualFluids_GPU)
+
+add_subdirectory(targets/libs/GksMeshAdapter)
+add_subdirectory(targets/libs/GksGpu)
+    
+add_subdirectory(targets/apps/LidDrivenCavity)
diff --git a/CMakeMacros/Cuda/Link.cmake b/CMakeMacros/Cuda/Link.cmake
new file mode 100644
index 0000000000000000000000000000000000000000..db34e95d8350880163d3b30d0a2e2f75a4293fac
--- /dev/null
+++ b/CMakeMacros/Cuda/Link.cmake
@@ -0,0 +1,20 @@
+macro(linkCuda)
+#input: -
+
+    find_path(CUDA_CUT_INCLUDE_DIR
+      helper_cuda.h
+      PATHS "$ENV{NVCUDASAMPLES_ROOT}"
+      PATH_SUFFIXES "common/inc"
+      DOC "Location of helper_cuda.h"
+      NO_DEFAULT_PATH
+    )
+    
+    INCLUDE_DIRECTORIES( ${CUDA_INCLUDE_DIRS} ${CUDA_CUT_INCLUDE_DIR})
+
+	set_property(TARGET ${targetName} PROPERTY CUDA_SEPARABLE_COMPILATION ON)
+	#set_property(TARGET ${targetName} PROPERTY CUDA_64_BIT_DEVICE_CODE ON)
+	
+    #set(CUDA_NVCC_FLAGS "-G" CACHE TYPE INTERNAL FORCE)
+    #set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS}; -gencode arch=compute_13,code=sm_13 )
+	
+endmacro(linkCuda)
diff --git a/CMakeMacros/OpenMP/Link.cmake b/CMakeMacros/OpenMP/Link.cmake
new file mode 100644
index 0000000000000000000000000000000000000000..2a5ae6710f75a77602ab15f3818f3e211a3fb38b
--- /dev/null
+++ b/CMakeMacros/OpenMP/Link.cmake
@@ -0,0 +1,10 @@
+macro(linkOpenMP targetName)
+
+find_package(OpenMP)
+if (OPENMP_FOUND)
+	set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
+	set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
+    set (CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Xcompiler ${OpenMP_CXX_FLAGS}")
+endif()
+
+endmacro(linkOpenMP)
diff --git a/CMakeMacros/README.md b/CMakeMacros/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..6d5da0578cec2da781912debff5f5c02a2f5db40
--- /dev/null
+++ b/CMakeMacros/README.md
@@ -0,0 +1,22 @@
+# CMake Macros
+
+The cmake macros provide the functionalities for creating targets (executables and libraries), finding files and linking against common libraries.
+
+This repository provides only the macros, which can be integrated in your cmake project as (e.g.) git subtree or just downloaded and copied into the project folder. An usage of this macros with a lot of examples can be found here: [CMake Template on Github](https://github.com/ClubOfDigitalEngineering/CMakeTemplate "CMake Template on Github").
+
+To make it work:
+- copy the file 'Machinefiles/Isildur'
+- rename it to your pc-name (e.g. 'Foos Computer')
+- set the paths to the existing libaries
+
+### The CMake Macros provide macros to link:
+- Boost
+- Cocoa
+- Cuda
+- GoogleMock
+- JsonCpp
+- MPI
+- Metis
+- OpenMP
+- Qt
+- VTK
diff --git a/CMakeMacros/general/BuildTarget.cmake b/CMakeMacros/general/BuildTarget.cmake
new file mode 100644
index 0000000000000000000000000000000000000000..a0ca7bd19b0328b91139d8892780d8cebc165c5a
--- /dev/null
+++ b/CMakeMacros/general/BuildTarget.cmake
@@ -0,0 +1,56 @@
+macro(buildExe targetName sourceFiles linkDirs libsToLink includeDirs)
+    setLinkDirectories("${linkDirs}")
+
+	message(STATUS "build target: " ${targetName})
+    add_executable(${targetName} "${sourceFiles}")
+
+    linkLibraries(${targetName} "${libsToLink}")
+    setIncludeDirectories(${targetName} "${includeDirs}")
+
+endmacro(buildExe)
+
+macro(buildLib targetName sourceFiles linkDirs libsToLink includeDirs)
+    setLinkDirectories("${linkDirs}")
+	
+	message(STATUS "build target: " ${targetName})
+    add_library(${targetName} ${LIB_TYPE} ${sourceFiles})
+
+    linkLibraries(${targetName} "${libsToLink}")
+    setIncludeDirectories(${targetName} "${includeDirs}")
+
+endmacro(buildLib)
+
+
+macro(setLinkDirectories linkDirs)
+    foreach(dir ${linkDirs})
+        link_directories(${dir})
+    endforeach()
+endmacro(setLinkDirectories)
+
+macro(linkLibraries targetName libsToLink)
+    foreach(lib ${libsToLink})
+        target_link_libraries(${targetName} ${lib})
+    endforeach()
+endmacro(linkLibraries)
+
+macro(setIncludeDirectories targetName includeDirs)
+    foreach(dir ${includeDirs})
+        target_include_directories(${targetName} PRIVATE ${dir})
+    endforeach()
+endmacro(setIncludeDirectories)
+
+include (GenerateExportHeader)
+macro(generateExportHeader libName path)
+    if(${BUILD_SHARED_LIBS})
+            GENERATE_EXPORT_HEADER	(${libName}
+                    BASE_NAME ${libName}
+                    EXPORT_MACRO_NAME ${libName}_EXPORT
+                    EXPORT_FILE_NAME ${path}/${libName}_EXPORT.h
+                    STATIC_DEFINE ${libName}_BUILT_AS_STATIC
+                    )
+    endif()
+endmacro(generateExportHeader)
+
+macro(groupTarget targetName folderName)
+    set_property( TARGET  ${targetName}  PROPERTY  FOLDER  ${folderName} )
+endmacro(groupTarget)
\ No newline at end of file
diff --git a/CMakeMacros/general/BuildTargetUtilities.cmake b/CMakeMacros/general/BuildTargetUtilities.cmake
new file mode 100644
index 0000000000000000000000000000000000000000..1a30805c4eb487686ced003a7e6cf616e0950d9b
--- /dev/null
+++ b/CMakeMacros/general/BuildTargetUtilities.cmake
@@ -0,0 +1,54 @@
+macro(sharedLibs)
+	if(${BUILD_SHARED_LIBS})
+		set(LIB_TYPE SHARED)
+	else()
+		set(LIB_TYPE STATIC)
+
+		set(CompilerFlags
+				CMAKE_CXX_FLAGS
+				CMAKE_CXX_FLAGS_DEBUG
+				CMAKE_CXX_FLAGS_RELEASE
+				CMAKE_C_FLAGS
+				CMAKE_C_FLAGS_DEBUG
+				CMAKE_C_FLAGS_RELEASE
+				)
+		foreach(CompilerFlag ${CompilerFlags})
+			string(REPLACE "/MD" "/MT" ${CompilerFlag} "${${CompilerFlag}}")
+		endforeach()
+        
+		set(CompilerFlagsCuda
+                CMAKE_CUDA_FLAGS
+                CMAKE_CUDA_FLAGS_DEBUG
+                CMAKE_CUDA_FLAGS_MINSIZEREL
+                CMAKE_CUDA_FLAGS_RELEASE
+                CMAKE_CUDA_FLAGS_RELWITHDEBINFO
+				)
+		foreach(CompilerFlag ${CompilerFlagsCuda})
+			string(REPLACE "-MD" "-MT" ${CompilerFlag} "${${CompilerFlag}}")
+		endforeach()
+	endif()
+endmacro(sharedLibs)
+
+
+
+########################################################################
+#                            AllTest Option                            #
+########################################################################
+
+macro(activateAllTestOption)
+	set(isAllTestSuite ON)
+endmacro(activateAllTestOption)
+
+
+macro(deactivateAllTestOption)
+	set(isAllTestSuite OFF)
+endmacro(deactivateAllTestOption)
+
+
+########################################################################
+#                           target name                                #
+########################################################################
+
+macro(setTargetNameToFolderName path)
+     get_filename_component(targetName "${path}" NAME)
+endmacro(setTargetNameToFolderName)
\ No newline at end of file
diff --git a/CMakeMacros/general/EndingsToCollect.cmake b/CMakeMacros/general/EndingsToCollect.cmake
new file mode 100644
index 0000000000000000000000000000000000000000..f4ca6725f1eab64314ff01df1f247f13a0dcefe0
--- /dev/null
+++ b/CMakeMacros/general/EndingsToCollect.cmake
@@ -0,0 +1,36 @@
+macro(addFileEndingToCollect file_ending)
+	#input: file_ending --> appends it to the list of files to collect
+
+	list (FIND FILES_TO_COLLECT ${file_ending} index)
+	if (${index} EQUAL -1)
+		set(FILES_TO_COLLECT ${FILES_TO_COLLECT} ${file_ending})
+	endif()
+
+	#output: files_to_collect
+endmacro(addFileEndingToCollect)
+
+
+
+macro(resetFileEndingsToCollect)
+	unset(FILES_TO_COLLECT)
+endmacro(resetFileEndingsToCollect)
+
+
+
+
+macro(addCAndCPPFileTypes)
+	addFileEndingToCollect("*.h")
+	addFileEndingToCollect("*.c")
+	addFileEndingToCollect("*.cpp")
+	addFileEndingToCollect("*.cxx")
+	addFileEndingToCollect("*.hpp")
+	addFileEndingToCollect("*.cu")
+	addFileEndingToCollect("*.cuh")
+endmacro(addCAndCPPFileTypes)
+
+
+macro(addObjCAndObjCPPFileTypesToCollect)
+	addFileEndingToCollect("*.m")
+	addFileEndingToCollect("*.mm")
+	addFileEndingToCollect("*.h")
+endmacro(addObjCAndObjCPPFileTypesToCollect)
diff --git a/CMakeMacros/general/FileUtilities.cmake b/CMakeMacros/general/FileUtilities.cmake
new file mode 100644
index 0000000000000000000000000000000000000000..4e9b35370ba22103e87df2a709d9721275270e37
--- /dev/null
+++ b/CMakeMacros/general/FileUtilities.cmake
@@ -0,0 +1,109 @@
+macro(includeRecursiveAllFilesFrom targetName path)
+	set(collectTestFiles ON)
+	set(collectProductionFiles ON)
+
+	includeRecursiveFilesFrom(${targetName} ${path})
+endmacro(includeRecursiveAllFilesFrom)
+
+
+
+macro(includeRecursiveProductionFilesFrom targetName path)
+	set(collectTestFiles OFF)
+	set(collectProductionFiles ON)
+
+	includeRecursiveFilesFrom(${targetName} ${path})
+endmacro(includeRecursiveProductionFilesFrom)
+
+
+
+macro(includeRecursiveTestFilesFrom targetName path)
+	set(collectTestFiles ON)
+	set(collectProductionFiles OFF)
+
+	includeRecursiveFilesFrom(${targetName} ${path})
+endmacro(includeRecursiveTestFilesFrom)
+
+
+
+
+macro(includeRecursiveFilesFrom targetName path)
+	file(GLOB_RECURSE includeSourcePaths ${path}/package.include)
+
+	foreach(package ${includeSourcePaths})
+		get_filename_component(package_dir ${package} DIRECTORY)
+		collectFilesFrom(${package_dir} "${FILES_TO_COLLECT}")
+		setSourceGroupForFilesIn(${package_dir} ${targetName})
+	endforeach()
+endmacro(includeRecursiveFilesFrom)
+
+
+
+macro(collectFilesFrom path file_endings)
+	#input: path from files to collect
+	unset(COLLECTED_FILES_IN_PATH)
+	unset(ALL_FILES_IN_PATH)
+
+	foreach(_ending ${file_endings})
+		FILE(GLOB filesWithEnding ${path}/${_ending})
+		set(ALL_FILES_IN_PATH ${ALL_FILES_IN_PATH} ${filesWithEnding})
+	endforeach()
+
+	foreach(_file ${ALL_FILES_IN_PATH})
+		get_filename_component(fileName ${_file} NAME)
+		if(collectTestFiles)
+			if(${fileName} MATCHES "Test" OR ${fileName} MATCHES "Mock")
+				set(COLLECTED_FILES_IN_PATH ${COLLECTED_FILES_IN_PATH} ${_file})
+			endif()
+		endif()
+		if(collectProductionFiles)
+			if(NOT ${fileName} MATCHES "Test" AND NOT ${fileName} MATCHES "Mock")
+				set(COLLECTED_FILES_IN_PATH ${COLLECTED_FILES_IN_PATH} ${_file})
+			endif()
+		endif()
+	endforeach()
+	set(MY_SRCS ${MY_SRCS} ${COLLECTED_FILES_IN_PATH})
+
+	#output: MY_SRCS
+endmacro(collectFilesFrom)
+
+
+
+
+macro(setSourceGroupForFilesIn package_dir targetName)
+#input: target_name PACKAGE_SRCS
+	buildSourceGroup(${targetName} ${package_dir})
+
+	if(isAllTestSuite)
+		source_group(${targetName}\\${SOURCE_GROUP} FILES ${COLLECTED_FILES_IN_PATH})
+	else()
+		source_group(${SOURCE_GROUP} FILES ${COLLECTED_FILES_IN_PATH})
+	endif()
+#output: -
+endmacro(setSourceGroupForFilesIn)
+
+
+
+
+macro(buildSourceGroup targetName path)
+#input: targetName (e.g. lib name, exe name)
+
+	unset(SOURCE_GROUP)
+	string(REPLACE "/" ";" folderListFromPath ${path})
+	set(findTargetName 0)
+
+	foreach(folder ${folderListFromPath})
+		if(findTargetName)
+			set(SOURCE_GROUP ${SOURCE_GROUP}\\${folder})
+		endif()
+
+		if(${folder} STREQUAL ${targetName})
+			SET(findTargetName 1)
+		endif()
+	endforeach()
+
+	if(NOT SOURCE_GROUP)
+		set(SOURCE_GROUP "general")
+	endif()
+
+#output: SOURCE_GROUP
+endmacro(buildSourceGroup)
\ No newline at end of file
diff --git a/CMakeMacros/general/FindCompiler.cmake b/CMakeMacros/general/FindCompiler.cmake
new file mode 100644
index 0000000000000000000000000000000000000000..a878b377a03c99a676d842d60595d079439000f8
--- /dev/null
+++ b/CMakeMacros/general/FindCompiler.cmake
@@ -0,0 +1,92 @@
+#############################################################
+###                COMPILER DETECTION                     ###
+#############################################################
+# Check for intel compiler
+if( CMAKE_CXX_COMPILER MATCHES "icpc" OR CMAKE_CXX_COMPILER_ARG1 MATCHES "icpc" )
+    option ( VF_CXX_COMPILER_IS_INTEL "Use Intel compiler" ON  )
+    # Intel(R) Compiler has its own library archiver,
+    # if you build libraries and do not use xiar,
+    # the Intel compiler will complain about invalid
+    # archives at the link phase.
+    # The Intel(R) archiver is "xiar" usually
+    # located in the same folder as the compiler,
+    FIND_PROGRAM(XIAR xiar)
+    IF(XIAR)
+        SET(CMAKE_AR "${XIAR}")
+    ENDIF(XIAR)
+    MARK_AS_ADVANCED(XIAR)
+
+    # Intel(R) Compiler also comes with its own linker
+    # which provides a number of additional benefits when
+    # linking code compiled with the Intel(R) compiler.
+    # Again, usually in the same place as icc itself,
+    FIND_PROGRAM(XILD xild)
+    IF(XILD)
+       SET(CMAKE_LINKER "${XILD}")
+    ENDIF(XILD)
+    MARK_AS_ADVANCED(XILD)
+else()
+    option ( VF_CXX_COMPILER_IS_INTEL "Use Intel compiler" OFF  )
+endif()
+mark_as_advanced ( VF_CXX_COMPILER_IS_INTEL )
+
+# Check for Gnu compiler
+if ( CMAKE_COMPILER_IS_GNUCXX  AND NOT VF_CXX_COMPILER_IS_INTEL )
+     option ( VF_CXX_COMPILER_IS_GNU "Use gnu compiler" ON  )
+else()
+     option ( VF_CXX_COMPILER_IS_GNU "Use gnu compiler" OFF  )
+endif()
+mark_as_advanced ( VF_CXX_COMPILER_IS_GNU )
+
+# Check for Visual Studio
+if(MSVC)
+     option (VF_CXX_COMPILER_IS_MSVC "Use Visual Studio compiler" ON)
+else()
+     option (VF_CXX_COMPILER_IS_MSVC "Use Visual Studio compiler" OFF)
+endif()
+mark_as_advanced(VF_CXX_COMPILER_IS_MSVC)
+
+# Check for IBM compiler
+if( CMAKE_CXX_COMPILER MATCHES "xlc" OR CMAKE_CXX_COMPILER_ARG1 MATCHES "xlc" )
+    option ( VF_CXX_COMPILER_IS_IBM "Use IBM compiler" ON  )
+else()
+    option ( VF_CXX_COMPILER_IS_IBM "Use IBM compiler" OFF  )
+endif()
+mark_as_advanced ( VF_CXX_COMPILER_IS_IBM )
+
+# Check for NEC SX compiler
+if( CMAKE_CXX_COMPILER MATCHES "sxc" OR CMAKE_CXX_COMPILER_ARG1 MATCHES "sxc" OR CMAKE_CXX_COMPILER MATCHES "sxmpic" OR CMAKE_CXX_COMPILER_ARG1 MATCHES "sxmpic" )
+    option ( VF_CXX_COMPILER_IS_NEC "Use NEC compiler" ON  )
+else()
+    option ( VF_CXX_COMPILER_IS_NEC "Use NEC compiler" OFF  )
+endif()
+mark_as_advanced ( VF_CXX_COMPILER_IS_NEC )
+
+# Check for Clang compiler
+if( CMAKE_CXX_COMPILER MATCHES "clang" OR CMAKE_CXX_COMPILER_ARG1 MATCHES "clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang" )
+    option ( VF_CXX_COMPILER_IS_CLANG "Use clang compiler" ON  )
+else()
+    option ( VF_CXX_COMPILER_IS_CLANG "Use clang compiler" OFF  )
+endif()
+mark_as_advanced ( VF_CXX_COMPILER_IS_CLANG )
+
+if( CMAKE_CXX_COMPILER_ID MATCHES Cray )
+    option ( VF_CXX_COMPILER_IS_CRAY "Use Cray compiler" ON   )
+    if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.4)
+        message( FATAL_ERROR "Insufficient Cray Compiler Environment version" )
+    endif()
+else()
+    option ( VF_CXX_COMPILER_IS_CRAY "Use Cray compiler" OFF  )
+endif()
+mark_as_advanced ( VF_CXX_COMPILER_IS_CRAY )
+
+# Check for MPI wrapper
+get_filename_component( CXX_COMPILER_WITHOUT_PATH ${CMAKE_CXX_COMPILER} NAME )
+if( CXX_COMPILER_WITHOUT_PATH MATCHES "mpi" OR CMAKE_CXX_COMPILER_ARG1 MATCHES "mpi" )
+    option ( VF_CXX_COMPILER_IS_MPI_WRAPPER "Compiler is MPI wrapper" ON  )
+else()
+    option ( VF_CXX_COMPILER_IS_MPI_WRAPPER "Compiler is MPI wrapper" OFF  )
+endif()
+mark_as_advanced ( VF_CXX_COMPILER_IS_MPI_WRAPPER )
+
+############################################################################################################################
diff --git a/CMakeMacros/git/GetGitRevisionDescription.cmake b/CMakeMacros/git/GetGitRevisionDescription.cmake
new file mode 100644
index 0000000000000000000000000000000000000000..b90fe2cf07b5645e5ac6db8c28b784a6960d5064
--- /dev/null
+++ b/CMakeMacros/git/GetGitRevisionDescription.cmake
@@ -0,0 +1,168 @@
+# - Returns a version string from Git
+#
+# These functions force a re-configure on each git commit so that you can
+# trust the values of the variables in your build system.
+#
+#  get_git_head_revision(<refspecvar> <hashvar> [<additional arguments to git describe> ...])
+#
+# Returns the refspec and sha hash of the current head revision
+#
+#  git_describe(<var> [<additional arguments to git describe> ...])
+#
+# Returns the results of git describe on the source tree, and adjusting
+# the output so that it tests false if an error occurs.
+#
+#  git_get_exact_tag(<var> [<additional arguments to git describe> ...])
+#
+# Returns the results of git describe --exact-match on the source tree,
+# and adjusting the output so that it tests false if there was no exact
+# matching tag.
+#
+#  git_local_changes(<var>)
+#
+# Returns either "CLEAN" or "DIRTY" with respect to uncommitted changes.
+# Uses the return code of "git diff-index --quiet HEAD --".
+# Does not regard untracked files.
+#
+# Requires CMake 2.6 or newer (uses the 'function' command)
+#
+# Original Author:
+# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
+# http://academic.cleardefinition.com
+# Iowa State University HCI Graduate Program/VRAC
+#
+# Copyright Iowa State University 2009-2010.
+# Distributed under the Boost Software License, Version 1.0.
+# (See accompanying file LICENSE_1_0.txt or copy at
+# http://www.boost.org/LICENSE_1_0.txt)
+
+if(__get_git_revision_description)
+    return()
+endif()
+set(__get_git_revision_description YES)
+
+# We must run the following at "include" time, not at function call time,
+# to find the path to this module rather than the path to a calling list file
+get_filename_component(_gitdescmoddir ${CMAKE_CURRENT_LIST_FILE} PATH)
+
+function(get_git_head_revision _refspecvar _hashvar)
+    set(GIT_PARENT_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
+    set(GIT_DIR "${GIT_PARENT_DIR}/.git")
+    while(NOT EXISTS "${GIT_DIR}")	# .git dir not found, search parent directories
+        set(GIT_PREVIOUS_PARENT "${GIT_PARENT_DIR}")
+        get_filename_component(GIT_PARENT_DIR ${GIT_PARENT_DIR} PATH)
+        if(GIT_PARENT_DIR STREQUAL GIT_PREVIOUS_PARENT)
+            # We have reached the root directory, we are not in git
+            set(${_refspecvar} "GITDIR-NOTFOUND" PARENT_SCOPE)
+            set(${_hashvar} "GITDIR-NOTFOUND" PARENT_SCOPE)
+            return()
+        endif()
+        set(GIT_DIR "${GIT_PARENT_DIR}/.git")
+    endwhile()
+    # check if this is a submodule
+    if(NOT IS_DIRECTORY ${GIT_DIR})
+        file(READ ${GIT_DIR} submodule)
+        string(REGEX REPLACE "gitdir: (.*)\n$" "\\1" GIT_DIR_RELATIVE ${submodule})
+        get_filename_component(SUBMODULE_DIR ${GIT_DIR} PATH)
+        get_filename_component(GIT_DIR ${SUBMODULE_DIR}/${GIT_DIR_RELATIVE} ABSOLUTE)
+    endif()
+    set(GIT_DATA "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/git-data")
+    if(NOT EXISTS "${GIT_DATA}")
+        file(MAKE_DIRECTORY "${GIT_DATA}")
+    endif()
+
+    if(NOT EXISTS "${GIT_DIR}/HEAD")
+        return()
+    endif()
+    set(HEAD_FILE "${GIT_DATA}/HEAD")
+    configure_file("${GIT_DIR}/HEAD" "${HEAD_FILE}" COPYONLY)
+
+    configure_file("${_gitdescmoddir}/GetGitRevisionDescription.cmake.in"
+            "${GIT_DATA}/grabRef.cmake"
+            @ONLY)
+    include("${GIT_DATA}/grabRef.cmake")
+
+    set(${_refspecvar} "${HEAD_REF}" PARENT_SCOPE)
+    set(${_hashvar} "${HEAD_HASH}" PARENT_SCOPE)
+endfunction()
+
+function(git_describe _var)
+    if(NOT GIT_FOUND)
+        find_package(Git QUIET)
+    endif()
+    get_git_head_revision(refspec hash)
+    if(NOT GIT_FOUND)
+        set(${_var} "GIT-NOTFOUND" PARENT_SCOPE)
+        return()
+    endif()
+    if(NOT hash)
+        set(${_var} "HEAD-HASH-NOTFOUND" PARENT_SCOPE)
+        return()
+    endif()
+
+    # TODO sanitize
+    #if((${ARGN}" MATCHES "&&") OR
+    #	(ARGN MATCHES "||") OR
+    #	(ARGN MATCHES "\\;"))
+    #	message("Please report the following error to the project!")
+    #	message(FATAL_ERROR "Looks like someone's doing something nefarious with git_describe! Passed arguments ${ARGN}")
+    #endif()
+
+    #message(STATUS "Arguments to execute_process: ${ARGN}")
+
+    execute_process(COMMAND
+            "${GIT_EXECUTABLE}"
+            describe
+            ${hash}
+            ${ARGN}
+            WORKING_DIRECTORY
+            "${CMAKE_CURRENT_SOURCE_DIR}"
+            RESULT_VARIABLE
+            res
+            OUTPUT_VARIABLE
+            out
+            ERROR_QUIET
+            OUTPUT_STRIP_TRAILING_WHITESPACE)
+    if(NOT res EQUAL 0)
+        set(out "${out}-${res}-NOTFOUND")
+    endif()
+
+    set(${_var} "${out}" PARENT_SCOPE)
+endfunction()
+
+function(git_get_exact_tag _var)
+    git_describe(out --exact-match ${ARGN})
+    set(${_var} "${out}" PARENT_SCOPE)
+endfunction()
+
+function(git_local_changes _var)
+    if(NOT GIT_FOUND)
+        find_package(Git QUIET)
+    endif()
+    get_git_head_revision(refspec hash)
+    if(NOT GIT_FOUND)
+        set(${_var} "GIT-NOTFOUND" PARENT_SCOPE)
+        return()
+    endif()
+    if(NOT hash)
+        set(${_var} "HEAD-HASH-NOTFOUND" PARENT_SCOPE)
+        return()
+    endif()
+
+    execute_process(COMMAND
+            "${GIT_EXECUTABLE}"
+            diff-index --quiet HEAD --
+            WORKING_DIRECTORY
+            "${CMAKE_CURRENT_SOURCE_DIR}"
+            RESULT_VARIABLE
+            res
+            OUTPUT_VARIABLE
+            out
+            ERROR_QUIET
+            OUTPUT_STRIP_TRAILING_WHITESPACE)
+    if(res EQUAL 0)
+        set(${_var} "CLEAN" PARENT_SCOPE)
+    else()
+        set(${_var} "DIRTY" PARENT_SCOPE)
+    endif()
+endfunction()
diff --git a/CMakeMacros/git/GetGitRevisionDescription.cmake.in b/CMakeMacros/git/GetGitRevisionDescription.cmake.in
new file mode 100644
index 0000000000000000000000000000000000000000..6d8b708efe56a66852752a7a30ec5c16b51cdc9e
--- /dev/null
+++ b/CMakeMacros/git/GetGitRevisionDescription.cmake.in
@@ -0,0 +1,41 @@
+#
+# Internal file for GetGitRevisionDescription.cmake
+#
+# Requires CMake 2.6 or newer (uses the 'function' command)
+#
+# Original Author:
+# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
+# http://academic.cleardefinition.com
+# Iowa State University HCI Graduate Program/VRAC
+#
+# Copyright Iowa State University 2009-2010.
+# Distributed under the Boost Software License, Version 1.0.
+# (See accompanying file LICENSE_1_0.txt or copy at
+# http://www.boost.org/LICENSE_1_0.txt)
+
+set(HEAD_HASH)
+
+file(READ "@HEAD_FILE@" HEAD_CONTENTS LIMIT 1024)
+
+string(STRIP "${HEAD_CONTENTS}" HEAD_CONTENTS)
+if(HEAD_CONTENTS MATCHES "ref")
+	# named branch
+	string(REPLACE "ref: " "" HEAD_REF "${HEAD_CONTENTS}")
+	if(EXISTS "@GIT_DIR@/${HEAD_REF}")
+		configure_file("@GIT_DIR@/${HEAD_REF}" "@GIT_DATA@/head-ref" COPYONLY)
+	else()
+		configure_file("@GIT_DIR@/packed-refs" "@GIT_DATA@/packed-refs" COPYONLY)
+		file(READ "@GIT_DATA@/packed-refs" PACKED_REFS)
+		if(${PACKED_REFS} MATCHES "([0-9a-z]*) ${HEAD_REF}")
+			set(HEAD_HASH "${CMAKE_MATCH_1}")
+		endif()
+	endif()
+else()
+	# detached HEAD
+	configure_file("@GIT_DIR@/HEAD" "@GIT_DATA@/head-ref" COPYONLY)
+endif()
+
+if(NOT HEAD_HASH)
+	file(READ "@GIT_DATA@/head-ref" HEAD_HASH LIMIT 1024)
+	string(STRIP "${HEAD_HASH}" HEAD_HASH)
+endif()
diff --git a/COPYING.txt b/COPYING.txt
new file mode 100644
index 0000000000000000000000000000000000000000..b4e13b152135c1fbc01cbb9741f1b1e66d83c2f4
--- /dev/null
+++ b/COPYING.txt
@@ -0,0 +1,676 @@
+                    GNU GENERAL PUBLIC LICENSE
+                       Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+                            Preamble
+
+  The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+  The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works.  By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users.  We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors.  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+  To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights.  Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received.  You must make sure that they, too, receive
+or can get the source code.  And you must show them these terms so they
+know their rights.
+
+  Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+  For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software.  For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+  Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so.  This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software.  The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable.  Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products.  If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+  Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary.  To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+                       TERMS AND CONDITIONS
+
+  0. Definitions.
+
+  "This License" refers to version 3 of the GNU General Public License.
+
+  "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+  "The Program" refers to any copyrightable work licensed under this
+License.  Each licensee is addressed as "you".  "Licensees" and
+"recipients" may be individuals or organizations.
+
+  To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy.  The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+  A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+  To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy.  Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+  To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies.  Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+  An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License.  If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+  1. Source Code.
+
+  The "source code" for a work means the preferred form of the work
+for making modifications to it.  "Object code" means any non-source
+form of a work.
+
+  A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+  The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form.  A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+  The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities.  However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work.  For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+  The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+  The Corresponding Source for a work in source code form is that
+same work.
+
+  2. Basic Permissions.
+
+  All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met.  This License explicitly affirms your unlimited
+permission to run the unmodified Program.  The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work.  This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+  You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force.  You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright.  Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+  Conveying under any other circumstances is permitted solely under
+the conditions stated below.  Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+  3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+  No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+  When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+  4. Conveying Verbatim Copies.
+
+  You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+  You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+  5. Conveying Modified Source Versions.
+
+  You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+    a) The work must carry prominent notices stating that you modified
+    it, and giving a relevant date.
+
+    b) The work must carry prominent notices stating that it is
+    released under this License and any conditions added under section
+    7.  This requirement modifies the requirement in section 4 to
+    "keep intact all notices".
+
+    c) You must license the entire work, as a whole, under this
+    License to anyone who comes into possession of a copy.  This
+    License will therefore apply, along with any applicable section 7
+    additional terms, to the whole of the work, and all its parts,
+    regardless of how they are packaged.  This License gives no
+    permission to license the work in any other way, but it does not
+    invalidate such permission if you have separately received it.
+
+    d) If the work has interactive user interfaces, each must display
+    Appropriate Legal Notices; however, if the Program has interactive
+    interfaces that do not display Appropriate Legal Notices, your
+    work need not make them do so.
+
+  A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit.  Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+  6. Conveying Non-Source Forms.
+
+  You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+    a) Convey the object code in, or embodied in, a physical product
+    (including a physical distribution medium), accompanied by the
+    Corresponding Source fixed on a durable physical medium
+    customarily used for software interchange.
+
+    b) Convey the object code in, or embodied in, a physical product
+    (including a physical distribution medium), accompanied by a
+    written offer, valid for at least three years and valid for as
+    long as you offer spare parts or customer support for that product
+    model, to give anyone who possesses the object code either (1) a
+    copy of the Corresponding Source for all the software in the
+    product that is covered by this License, on a durable physical
+    medium customarily used for software interchange, for a price no
+    more than your reasonable cost of physically performing this
+    conveying of source, or (2) access to copy the
+    Corresponding Source from a network server at no charge.
+
+    c) Convey individual copies of the object code with a copy of the
+    written offer to provide the Corresponding Source.  This
+    alternative is allowed only occasionally and noncommercially, and
+    only if you received the object code with such an offer, in accord
+    with subsection 6b.
+
+    d) Convey the object code by offering access from a designated
+    place (gratis or for a charge), and offer equivalent access to the
+    Corresponding Source in the same way through the same place at no
+    further charge.  You need not require recipients to copy the
+    Corresponding Source along with the object code.  If the place to
+    copy the object code is a network server, the Corresponding Source
+    may be on a different server (operated by you or a third party)
+    that supports equivalent copying facilities, provided you maintain
+    clear directions next to the object code saying where to find the
+    Corresponding Source.  Regardless of what server hosts the
+    Corresponding Source, you remain obligated to ensure that it is
+    available for as long as needed to satisfy these requirements.
+
+    e) Convey the object code using peer-to-peer transmission, provided
+    you inform other peers where the object code and Corresponding
+    Source of the work are being offered to the general public at no
+    charge under subsection 6d.
+
+  A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+  A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling.  In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage.  For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product.  A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+  "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source.  The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+  If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information.  But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+  The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed.  Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+  Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+  7. Additional Terms.
+
+  "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law.  If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+  When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it.  (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.)  You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+  Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+    a) Disclaiming warranty or limiting liability differently from the
+    terms of sections 15 and 16 of this License; or
+
+    b) Requiring preservation of specified reasonable legal notices or
+    author attributions in that material or in the Appropriate Legal
+    Notices displayed by works containing it; or
+
+    c) Prohibiting misrepresentation of the origin of that material, or
+    requiring that modified versions of such material be marked in
+    reasonable ways as different from the original version; or
+
+    d) Limiting the use for publicity purposes of names of licensors or
+    authors of the material; or
+
+    e) Declining to grant rights under trademark law for use of some
+    trade names, trademarks, or service marks; or
+
+    f) Requiring indemnification of licensors and authors of that
+    material by anyone who conveys the material (or modified versions of
+    it) with contractual assumptions of liability to the recipient, for
+    any liability that these contractual assumptions directly impose on
+    those licensors and authors.
+
+  All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10.  If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term.  If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+  If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+  Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+  8. Termination.
+
+  You may not propagate or modify a covered work except as expressly
+provided under this License.  Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+  However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+  Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+  Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License.  If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+  9. Acceptance Not Required for Having Copies.
+
+  You are not required to accept this License in order to receive or
+run a copy of the Program.  Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance.  However,
+nothing other than this License grants you permission to propagate or
+modify any covered work.  These actions infringe copyright if you do
+not accept this License.  Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+  10. Automatic Licensing of Downstream Recipients.
+
+  Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License.  You are not responsible
+for enforcing compliance by third parties with this License.
+
+  An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations.  If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+  You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License.  For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+  11. Patents.
+
+  A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based.  The
+work thus licensed is called the contributor's "contributor version".
+
+  A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version.  For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+  Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+  In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement).  To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+  If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients.  "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+  If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+  A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License.  You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+  Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+  12. No Surrender of Others' Freedom.
+
+  If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all.  For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+  13. Use with the GNU Affero General Public License.
+
+  Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work.  The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+  14. Revised Versions of this License.
+
+  The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+  Each version is given a distinguishing version number.  If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation.  If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+  If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+  Later license versions may give you additional or different
+permissions.  However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+  15. Disclaimer of Warranty.
+
+  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+  16. Limitation of Liability.
+
+  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+  17. Interpretation of Sections 15 and 16.
+
+  If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+                     END OF TERMS AND CONDITIONS
+
+            How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This program 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.
+
+    This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+  If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+    <program>  Copyright (C) <year>  <name of author>
+    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+  You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+<http://www.gnu.org/licenses/>.
+
+  The GNU General Public License does not permit incorporating your program
+into proprietary programs.  If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library.  If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.  But first, please read
+<http://www.gnu.org/philosophy/why-not-lgpl.html>.
+
+
diff --git a/Documentation/doxygen/VF_Doxyfile.dox b/Documentation/doxygen/VF_Doxyfile.dox
new file mode 100644
index 0000000000000000000000000000000000000000..fdf0cf6b8d68e3a7ad24a13ff30357ac6ad1bed0
--- /dev/null
+++ b/Documentation/doxygen/VF_Doxyfile.dox
@@ -0,0 +1,2561 @@
+# Doxyfile 1.8.16
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project.
+#
+# All text after a double hash (##) is considered a comment and is placed in
+# front of the TAG it is preceding.
+#
+# All text after a single hash (#) is considered a comment and will be ignored.
+# The format is:
+# TAG = value [value, ...]
+# For lists, items can also be appended using:
+# TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (\" \").
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+
+# This tag specifies the encoding used for all characters in the configuration
+# file that follow. The default is UTF-8 which is also the encoding used for all
+# text before the first occurrence of this tag. Doxygen uses libiconv (or the
+# iconv built into libc) for the transcoding. See
+# https://www.gnu.org/software/libiconv/ for the list of possible encodings.
+# The default value is: UTF-8.
+
+DOXYFILE_ENCODING      = UTF-8
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by
+# double-quotes, unless you are using Doxywizard) that should identify the
+# project for which the documentation is generated. This name is used in the
+# title of most generated pages and in a few other places.
+# The default value is: My Project.
+
+PROJECT_NAME           = VirtualFluidsGPU
+
+# The PROJECT_NUMBER tag can be used to enter a project or revision number. This
+# could be handy for archiving the generated documentation or if some version
+# control system is used.
+
+PROJECT_NUMBER         =
+
+# Using the PROJECT_BRIEF tag one can provide an optional one line description
+# for a project that appears at the top of each page and should give viewer a
+# quick idea about the purpose of the project. Keep the description short.
+
+PROJECT_BRIEF          =
+
+# With the PROJECT_LOGO tag one can specify a logo or an icon that is included
+# in the documentation. The maximum height of the logo should not exceed 55
+# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy
+# the logo to the output directory.
+
+PROJECT_LOGO           = VirtualFluidsLogo_lowResolution.png
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path
+# into which the generated documentation will be written. If a relative path is
+# entered, it will be relative to the location where doxygen was started. If
+# left blank the current directory will be used.
+
+OUTPUT_DIRECTORY       =
+
+# If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub-
+# directories (in 2 levels) under the output directory of each output format and
+# will distribute the generated files over these directories. Enabling this
+# option can be useful when feeding doxygen a huge amount of source files, where
+# putting all generated files in the same directory would otherwise causes
+# performance problems for the file system.
+# The default value is: NO.
+
+CREATE_SUBDIRS         = NO
+
+# If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII
+# characters to appear in the names of generated files. If set to NO, non-ASCII
+# characters will be escaped, for example _xE3_x81_x84 will be used for Unicode
+# U+3044.
+# The default value is: NO.
+
+ALLOW_UNICODE_NAMES    = NO
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all
+# documentation generated by doxygen is written. Doxygen will use this
+# information to generate all constant output in the proper language.
+# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese,
+# Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States),
+# Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian,
+# Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages),
+# Korean, Korean-en (Korean with English messages), Latvian, Lithuanian,
+# Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian,
+# Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish,
+# Ukrainian and Vietnamese.
+# The default value is: English.
+
+OUTPUT_LANGUAGE        = English
+
+# The OUTPUT_TEXT_DIRECTION tag is used to specify the direction in which all
+# documentation generated by doxygen is written. Doxygen will use this
+# information to generate all generated output in the proper direction.
+# Possible values are: None, LTR, RTL and Context.
+# The default value is: None.
+
+OUTPUT_TEXT_DIRECTION  = None
+
+# If the BRIEF_MEMBER_DESC tag is set to YES, doxygen will include brief member
+# descriptions after the members that are listed in the file and class
+# documentation (similar to Javadoc). Set to NO to disable this.
+# The default value is: YES.
+
+BRIEF_MEMBER_DESC      = YES
+
+# If the REPEAT_BRIEF tag is set to YES, doxygen will prepend the brief
+# description of a member or function before the detailed description
+#
+# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
+# brief descriptions will be completely suppressed.
+# The default value is: YES.
+
+REPEAT_BRIEF           = YES
+
+# This tag implements a quasi-intelligent brief description abbreviator that is
+# used to form the text in various listings. Each string in this list, if found
+# as the leading text of the brief description, will be stripped from the text
+# and the result, after processing the whole list, is used as the annotated
+# text. Otherwise, the brief description is used as-is. If left blank, the
+# following values are used ($name is automatically replaced with the name of
+# the entity):The $name class, The $name widget, The $name file, is, provides,
+# specifies, contains, represents, a, an and the.
+
+ABBREVIATE_BRIEF       = "The $name class" \
+                         "The $name widget" \
+                         "The $name file" \
+                         is \
+                         provides \
+                         specifies \
+                         contains \
+                         represents \
+                         a \
+                         an \
+                         the
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
+# doxygen will generate a detailed section even if there is only a brief
+# description.
+# The default value is: NO.
+
+ALWAYS_DETAILED_SEC    = NO
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
+# inherited members of a class in the documentation of that class as if those
+# members were ordinary class members. Constructors, destructors and assignment
+# operators of the base classes will not be shown.
+# The default value is: NO.
+
+INLINE_INHERITED_MEMB  = NO
+
+# If the FULL_PATH_NAMES tag is set to YES, doxygen will prepend the full path
+# before files name in the file list and in the header files. If set to NO the
+# shortest path that makes the file name unique will be used
+# The default value is: YES.
+
+FULL_PATH_NAMES        = YES
+
+# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path.
+# Stripping is only done if one of the specified strings matches the left-hand
+# part of the path. The tag can be used to show relative paths in the file list.
+# If left blank the directory from which doxygen is run is used as the path to
+# strip.
+#
+# Note that you can specify absolute paths here, but also relative paths, which
+# will be relative from the directory where doxygen is started.
+# This tag requires that the tag FULL_PATH_NAMES is set to YES.
+
+STRIP_FROM_PATH        =
+
+# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the
+# path mentioned in the documentation of a class, which tells the reader which
+# header file to include in order to use a class. If left blank only the name of
+# the header file containing the class definition is used. Otherwise one should
+# specify the list of include paths that are normally passed to the compiler
+# using the -I flag.
+
+STRIP_FROM_INC_PATH    =
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but
+# less readable) file names. This can be useful is your file systems doesn't
+# support long names like on DOS, Mac, or CD-ROM.
+# The default value is: NO.
+
+SHORT_NAMES            = NO
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the
+# first line (until the first dot) of a Javadoc-style comment as the brief
+# description. If set to NO, the Javadoc-style will behave just like regular Qt-
+# style comments (thus requiring an explicit @brief command for a brief
+# description.)
+# The default value is: NO.
+
+JAVADOC_AUTOBRIEF      = NO
+
+# If the JAVADOC_BANNER tag is set to YES then doxygen will interpret a line
+# such as
+# /***************
+# as being the beginning of a Javadoc-style comment "banner". If set to NO, the
+# Javadoc-style will behave just like regular comments and it will not be
+# interpreted by doxygen.
+# The default value is: NO.
+
+JAVADOC_BANNER         = NO
+
+# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first
+# line (until the first dot) of a Qt-style comment as the brief description. If
+# set to NO, the Qt-style will behave just like regular Qt-style comments (thus
+# requiring an explicit \brief command for a brief description.)
+# The default value is: NO.
+
+QT_AUTOBRIEF           = NO
+
+# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a
+# multi-line C++ special comment block (i.e. a block of //! or /// comments) as
+# a brief description. This used to be the default behavior. The new default is
+# to treat a multi-line C++ comment block as a detailed description. Set this
+# tag to YES if you prefer the old behavior instead.
+#
+# Note that setting this tag to YES also means that rational rose comments are
+# not recognized any more.
+# The default value is: NO.
+
+MULTILINE_CPP_IS_BRIEF = NO
+
+# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the
+# documentation from any documented member that it re-implements.
+# The default value is: YES.
+
+INHERIT_DOCS           = YES
+
+# If the SEPARATE_MEMBER_PAGES tag is set to YES then doxygen will produce a new
+# page for each member. If set to NO, the documentation of a member will be part
+# of the file/class/namespace that contains it.
+# The default value is: NO.
+
+SEPARATE_MEMBER_PAGES  = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen
+# uses this value to replace tabs by spaces in code fragments.
+# Minimum value: 1, maximum value: 16, default value: 4.
+
+TAB_SIZE               = 4
+
+# This tag can be used to specify a number of aliases that act as commands in
+# the documentation. An alias has the form:
+# name=value
+# For example adding
+# "sideeffect=@par Side Effects:\n"
+# will allow you to put the command \sideeffect (or @sideeffect) in the
+# documentation, which will result in a user-defined paragraph with heading
+# "Side Effects:". You can put \n's in the value part of an alias to insert
+# newlines (in the resulting output). You can put ^^ in the value part of an
+# alias to insert a newline as if a physical newline was in the original file.
+# When you need a literal { or } or , in the value part of an alias you have to
+# escape them by means of a backslash (\), this can lead to conflicts with the
+# commands \{ and \} for these it is advised to use the version @{ and @} or use
+# a double escape (\\{ and \\})
+
+ALIASES                =
+
+# This tag can be used to specify a number of word-keyword mappings (TCL only).
+# A mapping has the form "name=value". For example adding "class=itcl::class"
+# will allow you to use the command class in the itcl::class meaning.
+
+TCL_SUBST              =
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources
+# only. Doxygen will then generate output that is more tailored for C. For
+# instance, some of the names that are used will be different. The list of all
+# members will be omitted, etc.
+# The default value is: NO.
+
+OPTIMIZE_OUTPUT_FOR_C  = NO
+
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or
+# Python sources only. Doxygen will then generate output that is more tailored
+# for that language. For instance, namespaces will be presented as packages,
+# qualified scopes will look different, etc.
+# The default value is: NO.
+
+OPTIMIZE_OUTPUT_JAVA   = NO
+
+# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
+# sources. Doxygen will then generate output that is tailored for Fortran.
+# The default value is: NO.
+
+OPTIMIZE_FOR_FORTRAN   = NO
+
+# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
+# sources. Doxygen will then generate output that is tailored for VHDL.
+# The default value is: NO.
+
+OPTIMIZE_OUTPUT_VHDL   = NO
+
+# Set the OPTIMIZE_OUTPUT_SLICE tag to YES if your project consists of Slice
+# sources only. Doxygen will then generate output that is more tailored for that
+# language. For instance, namespaces will be presented as modules, types will be
+# separated into more groups, etc.
+# The default value is: NO.
+
+OPTIMIZE_OUTPUT_SLICE  = NO
+
+# Doxygen selects the parser to use depending on the extension of the files it
+# parses. With this tag you can assign which parser to use for a given
+# extension. Doxygen has a built-in mapping, but you can override or extend it
+# using this tag. The format is ext=language, where ext is a file extension, and
+# language is one of the parsers supported by doxygen: IDL, Java, Javascript,
+# Csharp (C#), C, C++, D, PHP, md (Markdown), Objective-C, Python, Slice,
+# Fortran (fixed format Fortran: FortranFixed, free formatted Fortran:
+# FortranFree, unknown formatted Fortran: Fortran. In the later case the parser
+# tries to guess whether the code is fixed or free formatted code, this is the
+# default for Fortran type files), VHDL, tcl. For instance to make doxygen treat
+# .inc files as Fortran files (default is PHP), and .f files as C (default is
+# Fortran), use: inc=Fortran f=C.
+#
+# Note: For files without extension you can use no_extension as a placeholder.
+#
+# Note that for custom extensions you also need to set FILE_PATTERNS otherwise
+# the files are not read by doxygen.
+
+EXTENSION_MAPPING      =
+
+# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments
+# according to the Markdown format, which allows for more readable
+# documentation. See https://daringfireball.net/projects/markdown/ for details.
+# The output of markdown processing is further processed by doxygen, so you can
+# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in
+# case of backward compatibilities issues.
+# The default value is: YES.
+
+MARKDOWN_SUPPORT       = YES
+
+# When the TOC_INCLUDE_HEADINGS tag is set to a non-zero value, all headings up
+# to that level are automatically included in the table of contents, even if
+# they do not have an id attribute.
+# Note: This feature currently applies only to Markdown headings.
+# Minimum value: 0, maximum value: 99, default value: 5.
+# This tag requires that the tag MARKDOWN_SUPPORT is set to YES.
+
+TOC_INCLUDE_HEADINGS   = 0
+
+# When enabled doxygen tries to link words that correspond to documented
+# classes, or namespaces to their corresponding documentation. Such a link can
+# be prevented in individual cases by putting a % sign in front of the word or
+# globally by setting AUTOLINK_SUPPORT to NO.
+# The default value is: YES.
+
+AUTOLINK_SUPPORT       = YES
+
+# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
+# to include (a tag file for) the STL sources as input, then you should set this
+# tag to YES in order to let doxygen match functions declarations and
+# definitions whose arguments contain STL classes (e.g. func(std::string);
+# versus func(std::string) {}). This also make the inheritance and collaboration
+# diagrams that involve STL classes more complete and accurate.
+# The default value is: NO.
+
+BUILTIN_STL_SUPPORT    = NO
+
+# If you use Microsoft's C++/CLI language, you should set this option to YES to
+# enable parsing support.
+# The default value is: NO.
+
+CPP_CLI_SUPPORT        = NO
+
+# Set the SIP_SUPPORT tag to YES if your project consists of sip (see:
+# https://www.riverbankcomputing.com/software/sip/intro) sources only. Doxygen
+# will parse them like normal C++ but will assume all classes use public instead
+# of private inheritance when no explicit protection keyword is present.
+# The default value is: NO.
+
+SIP_SUPPORT            = NO
+
+# For Microsoft's IDL there are propget and propput attributes to indicate
+# getter and setter methods for a property. Setting this option to YES will make
+# doxygen to replace the get and set methods by a property in the documentation.
+# This will only work if the methods are indeed getting or setting a simple
+# type. If this is not the case, or you want to show the methods anyway, you
+# should set this option to NO.
+# The default value is: YES.
+
+IDL_PROPERTY_SUPPORT   = YES
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
+# tag is set to YES then doxygen will reuse the documentation of the first
+# member in the group (if any) for the other members of the group. By default
+# all members of a group must be documented explicitly.
+# The default value is: NO.
+
+DISTRIBUTE_GROUP_DOC   = NO
+
+# If one adds a struct or class to a group and this option is enabled, then also
+# any nested class or struct is added to the same group. By default this option
+# is disabled and one has to add nested compounds explicitly via \ingroup.
+# The default value is: NO.
+
+GROUP_NESTED_COMPOUNDS = NO
+
+# Set the SUBGROUPING tag to YES to allow class member groups of the same type
+# (for instance a group of public functions) to be put as a subgroup of that
+# type (e.g. under the Public Functions section). Set it to NO to prevent
+# subgrouping. Alternatively, this can be done per class using the
+# \nosubgrouping command.
+# The default value is: YES.
+
+SUBGROUPING            = YES
+
+# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions
+# are shown inside the group in which they are included (e.g. using \ingroup)
+# instead of on a separate page (for HTML and Man pages) or section (for LaTeX
+# and RTF).
+#
+# Note that this feature does not work in combination with
+# SEPARATE_MEMBER_PAGES.
+# The default value is: NO.
+
+INLINE_GROUPED_CLASSES = NO
+
+# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions
+# with only public data fields or simple typedef fields will be shown inline in
+# the documentation of the scope in which they are defined (i.e. file,
+# namespace, or group documentation), provided this scope is documented. If set
+# to NO, structs, classes, and unions are shown on a separate page (for HTML and
+# Man pages) or section (for LaTeX and RTF).
+# The default value is: NO.
+
+INLINE_SIMPLE_STRUCTS  = NO
+
+# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or
+# enum is documented as struct, union, or enum with the name of the typedef. So
+# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
+# with name TypeT. When disabled the typedef will appear as a member of a file,
+# namespace, or class. And the struct will be named TypeS. This can typically be
+# useful for C code in case the coding convention dictates that all compound
+# types are typedef'ed and only the typedef is referenced, never the tag name.
+# The default value is: NO.
+
+TYPEDEF_HIDES_STRUCT   = NO
+
+# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This
+# cache is used to resolve symbols given their name and scope. Since this can be
+# an expensive process and often the same symbol appears multiple times in the
+# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small
+# doxygen will become slower. If the cache is too large, memory is wasted. The
+# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range
+# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536
+# symbols. At the end of a run doxygen will report the cache usage and suggest
+# the optimal cache size from a speed point of view.
+# Minimum value: 0, maximum value: 9, default value: 0.
+
+LOOKUP_CACHE_SIZE      = 0
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+
+# If the EXTRACT_ALL tag is set to YES, doxygen will assume all entities in
+# documentation are documented, even if no documentation was available. Private
+# class members and static file members will be hidden unless the
+# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES.
+# Note: This will also disable the warnings about undocumented members that are
+# normally produced when WARNINGS is set to YES.
+# The default value is: NO.
+
+EXTRACT_ALL            = YES
+
+# If the EXTRACT_PRIVATE tag is set to YES, all private members of a class will
+# be included in the documentation.
+# The default value is: NO.
+
+EXTRACT_PRIVATE        = NO
+
+# If the EXTRACT_PRIV_VIRTUAL tag is set to YES, documented private virtual
+# methods of a class will be included in the documentation.
+# The default value is: NO.
+
+EXTRACT_PRIV_VIRTUAL   = NO
+
+# If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal
+# scope will be included in the documentation.
+# The default value is: NO.
+
+EXTRACT_PACKAGE        = NO
+
+# If the EXTRACT_STATIC tag is set to YES, all static members of a file will be
+# included in the documentation.
+# The default value is: NO.
+
+EXTRACT_STATIC         = NO
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES, classes (and structs) defined
+# locally in source files will be included in the documentation. If set to NO,
+# only classes defined in header files are included. Does not have any effect
+# for Java sources.
+# The default value is: YES.
+
+EXTRACT_LOCAL_CLASSES  = YES
+
+# This flag is only useful for Objective-C code. If set to YES, local methods,
+# which are defined in the implementation section but not in the interface are
+# included in the documentation. If set to NO, only methods in the interface are
+# included.
+# The default value is: NO.
+
+EXTRACT_LOCAL_METHODS  = NO
+
+# If this flag is set to YES, the members of anonymous namespaces will be
+# extracted and appear in the documentation as a namespace called
+# 'anonymous_namespace{file}', where file will be replaced with the base name of
+# the file that contains the anonymous namespace. By default anonymous namespace
+# are hidden.
+# The default value is: NO.
+
+EXTRACT_ANON_NSPACES   = NO
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all
+# undocumented members inside documented classes or files. If set to NO these
+# members will be included in the various overviews, but no documentation
+# section is generated. This option has no effect if EXTRACT_ALL is enabled.
+# The default value is: NO.
+
+HIDE_UNDOC_MEMBERS     = NO
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all
+# undocumented classes that are normally visible in the class hierarchy. If set
+# to NO, these classes will be included in the various overviews. This option
+# has no effect if EXTRACT_ALL is enabled.
+# The default value is: NO.
+
+HIDE_UNDOC_CLASSES     = NO
+
+# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend
+# (class|struct|union) declarations. If set to NO, these declarations will be
+# included in the documentation.
+# The default value is: NO.
+
+HIDE_FRIEND_COMPOUNDS  = NO
+
+# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any
+# documentation blocks found inside the body of a function. If set to NO, these
+# blocks will be appended to the function's detailed documentation block.
+# The default value is: NO.
+
+HIDE_IN_BODY_DOCS      = NO
+
+# The INTERNAL_DOCS tag determines if documentation that is typed after a
+# \internal command is included. If the tag is set to NO then the documentation
+# will be excluded. Set it to YES to include the internal documentation.
+# The default value is: NO.
+
+INTERNAL_DOCS          = NO
+
+# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file
+# names in lower-case letters. If set to YES, upper-case letters are also
+# allowed. This is useful if you have classes or files whose names only differ
+# in case and if your file system supports case sensitive file names. Windows
+# (including Cygwin) ands Mac users are advised to set this option to NO.
+# The default value is: system dependent.
+
+CASE_SENSE_NAMES       = NO
+
+# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with
+# their full class and namespace scopes in the documentation. If set to YES, the
+# scope will be hidden.
+# The default value is: NO.
+
+HIDE_SCOPE_NAMES       = NO
+
+# If the HIDE_COMPOUND_REFERENCE tag is set to NO (default) then doxygen will
+# append additional text to a page's title, such as Class Reference. If set to
+# YES the compound reference will be hidden.
+# The default value is: NO.
+
+HIDE_COMPOUND_REFERENCE= NO
+
+# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of
+# the files that are included by a file in the documentation of that file.
+# The default value is: YES.
+
+SHOW_INCLUDE_FILES     = YES
+
+# If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each
+# grouped member an include statement to the documentation, telling the reader
+# which file to include in order to use the member.
+# The default value is: NO.
+
+SHOW_GROUPED_MEMB_INC  = NO
+
+# If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include
+# files with double quotes in the documentation rather than with sharp brackets.
+# The default value is: NO.
+
+FORCE_LOCAL_INCLUDES   = NO
+
+# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the
+# documentation for inline members.
+# The default value is: YES.
+
+INLINE_INFO            = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the
+# (detailed) documentation of file and class members alphabetically by member
+# name. If set to NO, the members will appear in declaration order.
+# The default value is: YES.
+
+SORT_MEMBER_DOCS       = YES
+
+# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief
+# descriptions of file, namespace and class members alphabetically by member
+# name. If set to NO, the members will appear in declaration order. Note that
+# this will also influence the order of the classes in the class list.
+# The default value is: NO.
+
+SORT_BRIEF_DOCS        = NO
+
+# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the
+# (brief and detailed) documentation of class members so that constructors and
+# destructors are listed first. If set to NO the constructors will appear in the
+# respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS.
+# Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief
+# member documentation.
+# Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting
+# detailed member documentation.
+# The default value is: NO.
+
+SORT_MEMBERS_CTORS_1ST = NO
+
+# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy
+# of group names into alphabetical order. If set to NO the group names will
+# appear in their defined order.
+# The default value is: NO.
+
+SORT_GROUP_NAMES       = NO
+
+# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by
+# fully-qualified names, including namespaces. If set to NO, the class list will
+# be sorted only by class name, not including the namespace part.
+# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
+# Note: This option applies only to the class list, not to the alphabetical
+# list.
+# The default value is: NO.
+
+SORT_BY_SCOPE_NAME     = NO
+
+# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper
+# type resolution of all parameters of a function it will reject a match between
+# the prototype and the implementation of a member function even if there is
+# only one candidate or it is obvious which candidate to choose by doing a
+# simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still
+# accept a match between prototype and implementation in such cases.
+# The default value is: NO.
+
+STRICT_PROTO_MATCHING  = NO
+
+# The GENERATE_TODOLIST tag can be used to enable (YES) or disable (NO) the todo
+# list. This list is created by putting \todo commands in the documentation.
+# The default value is: YES.
+
+GENERATE_TODOLIST      = YES
+
+# The GENERATE_TESTLIST tag can be used to enable (YES) or disable (NO) the test
+# list. This list is created by putting \test commands in the documentation.
+# The default value is: YES.
+
+GENERATE_TESTLIST      = YES
+
+# The GENERATE_BUGLIST tag can be used to enable (YES) or disable (NO) the bug
+# list. This list is created by putting \bug commands in the documentation.
+# The default value is: YES.
+
+GENERATE_BUGLIST       = YES
+
+# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or disable (NO)
+# the deprecated list. This list is created by putting \deprecated commands in
+# the documentation.
+# The default value is: YES.
+
+GENERATE_DEPRECATEDLIST= YES
+
+# The ENABLED_SECTIONS tag can be used to enable conditional documentation
+# sections, marked by \if <section_label> ... \endif and \cond <section_label>
+# ... \endcond blocks.
+
+ENABLED_SECTIONS       =
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the
+# initial value of a variable or macro / define can have for it to appear in the
+# documentation. If the initializer consists of more lines than specified here
+# it will be hidden. Use a value of 0 to hide initializers completely. The
+# appearance of the value of individual variables and macros / defines can be
+# controlled using \showinitializer or \hideinitializer command in the
+# documentation regardless of this setting.
+# Minimum value: 0, maximum value: 10000, default value: 30.
+
+MAX_INITIALIZER_LINES  = 30
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at
+# the bottom of the documentation of classes and structs. If set to YES, the
+# list will mention the files that were used to generate the documentation.
+# The default value is: YES.
+
+SHOW_USED_FILES        = YES
+
+# Set the SHOW_FILES tag to NO to disable the generation of the Files page. This
+# will remove the Files entry from the Quick Index and from the Folder Tree View
+# (if specified).
+# The default value is: YES.
+
+SHOW_FILES             = YES
+
+# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces
+# page. This will remove the Namespaces entry from the Quick Index and from the
+# Folder Tree View (if specified).
+# The default value is: YES.
+
+SHOW_NAMESPACES        = YES
+
+# The FILE_VERSION_FILTER tag can be used to specify a program or script that
+# doxygen should invoke to get the current version for each file (typically from
+# the version control system). Doxygen will invoke the program by executing (via
+# popen()) the command command input-file, where command is the value of the
+# FILE_VERSION_FILTER tag, and input-file is the name of an input file provided
+# by doxygen. Whatever the program writes to standard output is used as the file
+# version. For an example see the documentation.
+
+FILE_VERSION_FILTER    =
+
+# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed
+# by doxygen. The layout file controls the global structure of the generated
+# output files in an output format independent way. To create the layout file
+# that represents doxygen's defaults, run doxygen with the -l option. You can
+# optionally specify a file name after the option, if omitted DoxygenLayout.xml
+# will be used as the name of the layout file.
+#
+# Note that if you run doxygen from a directory containing a file called
+# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE
+# tag is left empty.
+
+LAYOUT_FILE            =
+
+# The CITE_BIB_FILES tag can be used to specify one or more bib files containing
+# the reference definitions. This must be a list of .bib files. The .bib
+# extension is automatically appended if omitted. This requires the bibtex tool
+# to be installed. See also https://en.wikipedia.org/wiki/BibTeX for more info.
+# For LaTeX the style of the bibliography can be controlled using
+# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the
+# search path. See also \cite for info how to create references.
+
+CITE_BIB_FILES         =
+
+#---------------------------------------------------------------------------
+# Configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated to
+# standard output by doxygen. If QUIET is set to YES this implies that the
+# messages are off.
+# The default value is: NO.
+
+QUIET                  = NO
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are
+# generated to standard error (stderr) by doxygen. If WARNINGS is set to YES
+# this implies that the warnings are on.
+#
+# Tip: Turn warnings on while writing the documentation.
+# The default value is: YES.
+
+WARNINGS               = YES
+
+# If the WARN_IF_UNDOCUMENTED tag is set to YES then doxygen will generate
+# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag
+# will automatically be disabled.
+# The default value is: YES.
+
+WARN_IF_UNDOCUMENTED   = YES
+
+# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for
+# potential errors in the documentation, such as not documenting some parameters
+# in a documented function, or documenting parameters that don't exist or using
+# markup commands wrongly.
+# The default value is: YES.
+
+WARN_IF_DOC_ERROR      = YES
+
+# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that
+# are documented, but have no documentation for their parameters or return
+# value. If set to NO, doxygen will only warn about wrong or incomplete
+# parameter documentation, but not about the absence of documentation. If
+# EXTRACT_ALL is set to YES then this flag will automatically be disabled.
+# The default value is: NO.
+
+WARN_NO_PARAMDOC       = NO
+
+# If the WARN_AS_ERROR tag is set to YES then doxygen will immediately stop when
+# a warning is encountered.
+# The default value is: NO.
+
+WARN_AS_ERROR          = NO
+
+# The WARN_FORMAT tag determines the format of the warning messages that doxygen
+# can produce. The string should contain the $file, $line, and $text tags, which
+# will be replaced by the file and line number from which the warning originated
+# and the warning text. Optionally the format may contain $version, which will
+# be replaced by the version of the file (if it could be obtained via
+# FILE_VERSION_FILTER)
+# The default value is: $file:$line: $text.
+
+WARN_FORMAT            = "$file:$line: $text"
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning and error
+# messages should be written. If left blank the output is written to standard
+# error (stderr).
+
+WARN_LOGFILE           =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag is used to specify the files and/or directories that contain
+# documented source files. You may enter file names like myfile.cpp or
+# directories like /usr/src/myproject. Separate the files or directories with
+# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
+# Note: If this tag is empty the current directory is searched.
+
+INPUT                  = ../../ \
+                         ../../VirtualFluidsCore \
+                         ../../ThirdParty
+
+# This tag can be used to specify the character encoding of the source files
+# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
+# libiconv (or the iconv built into libc) for the transcoding. See the libiconv
+# documentation (see: https://www.gnu.org/software/libiconv/) for the list of
+# possible encodings.
+# The default value is: UTF-8.
+
+INPUT_ENCODING         = UTF-8
+
+# If the value of the INPUT tag contains directories, you can use the
+# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and
+# *.h) to filter out the source-files in the directories.
+#
+# Note that for custom extensions or not directly supported extensions you also
+# need to set EXTENSION_MAPPING for the extension otherwise the files are not
+# read by doxygen.
+#
+# If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp,
+# *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h,
+# *.hh, *.hxx, *.hpp, *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc,
+# *.m, *.markdown, *.md, *.mm, *.dox, *.py, *.pyw, *.f90, *.f95, *.f03, *.f08,
+# *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf, *.qsf and *.ice.
+
+FILE_PATTERNS          = *.c \
+                         *.cc \
+                         *.cxx \
+                         *.cpp \
+                         *.c++ \
+                         *.d \
+                         *.java \
+                         *.ii \
+                         *.ixx \
+                         *.ipp \
+                         *.i++ \
+                         *.inl \
+                         *.h \
+                         *.hh \
+                         *.hxx \
+                         *.hpp \
+                         *.h++ \
+                         *.idl \
+                         *.odl \
+                         *.cs \
+                         *.php \
+                         *.php3 \
+                         *.inc \
+                         *.m \
+                         *.markdown \
+                         *.md \
+                         *.mm \
+                         *.dox \
+                         *.py \
+                         *.f90 \
+                         *.f \
+                         *.for \
+                         *.vhd \
+                         *.vhdl
+
+# The RECURSIVE tag can be used to specify whether or not subdirectories should
+# be searched for input files as well.
+# The default value is: NO.
+
+RECURSIVE              = YES
+
+# The EXCLUDE tag can be used to specify files and/or directories that should be
+# excluded from the INPUT source files. This way you can easily exclude a
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+#
+# Note that relative paths are relative to the directory from which doxygen is
+# run.
+
+EXCLUDE                =
+
+# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
+# directories that are symbolic links (a Unix file system feature) are excluded
+# from the input.
+# The default value is: NO.
+
+EXCLUDE_SYMLINKS       = NO
+
+# If the value of the INPUT tag contains directories, you can use the
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
+# certain files from those directories.
+#
+# Note that the wildcards are matched against the file with absolute path, so to
+# exclude all test directories for example use the pattern */test/*
+
+EXCLUDE_PATTERNS       =
+
+# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
+# (namespaces, classes, functions, etc.) that should be excluded from the
+# output. The symbol name can be a fully qualified name, a word, or if the
+# wildcard * is used, a substring. Examples: ANamespace, AClass,
+# AClass::ANamespace, ANamespace::*Test
+#
+# Note that the wildcards are matched against the file with absolute path, so to
+# exclude all test directories use the pattern */test/*
+
+EXCLUDE_SYMBOLS        =
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or directories
+# that contain example code fragments that are included (see the \include
+# command).
+
+EXAMPLE_PATH           =
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and
+# *.h) to filter out the source-files in the directories. If left blank all
+# files are included.
+
+EXAMPLE_PATTERNS       = *
+
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
+# searched for input files to be used with the \include or \dontinclude commands
+# irrespective of the value of the RECURSIVE tag.
+# The default value is: NO.
+
+EXAMPLE_RECURSIVE      = NO
+
+# The IMAGE_PATH tag can be used to specify one or more files or directories
+# that contain images that are to be included in the documentation (see the
+# \image command).
+
+IMAGE_PATH             =
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should
+# invoke to filter for each input file. Doxygen will invoke the filter program
+# by executing (via popen()) the command:
+#
+# <filter> <input-file>
+#
+# where <filter> is the value of the INPUT_FILTER tag, and <input-file> is the
+# name of an input file. Doxygen will then use the output that the filter
+# program writes to standard output. If FILTER_PATTERNS is specified, this tag
+# will be ignored.
+#
+# Note that the filter must not add or remove lines; it is applied before the
+# code is scanned, but not when the output code is generated. If lines are added
+# or removed, the anchors will not be placed correctly.
+#
+# Note that for custom extensions or not directly supported extensions you also
+# need to set EXTENSION_MAPPING for the extension otherwise the files are not
+# properly processed by doxygen.
+
+INPUT_FILTER           =
+
+# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
+# basis. Doxygen will compare the file name with each pattern and apply the
+# filter if there is a match. The filters are a list of the form: pattern=filter
+# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how
+# filters are used. If the FILTER_PATTERNS tag is empty or if none of the
+# patterns match the file name, INPUT_FILTER is applied.
+#
+# Note that for custom extensions or not directly supported extensions you also
+# need to set EXTENSION_MAPPING for the extension otherwise the files are not
+# properly processed by doxygen.
+
+FILTER_PATTERNS        =
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
+# INPUT_FILTER) will also be used to filter the input files that are used for
+# producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES).
+# The default value is: NO.
+
+FILTER_SOURCE_FILES    = NO
+
+# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file
+# pattern. A pattern will override the setting for FILTER_PATTERN (if any) and
+# it is also possible to disable source filtering for a specific pattern using
+# *.ext= (so without naming a filter).
+# This tag requires that the tag FILTER_SOURCE_FILES is set to YES.
+
+FILTER_SOURCE_PATTERNS =
+
+# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that
+# is part of the input, its contents will be placed on the main page
+# (index.html). This can be useful if you have a project on for instance GitHub
+# and want to reuse the introduction page also for the doxygen output.
+
+USE_MDFILE_AS_MAINPAGE = main.md
+
+#---------------------------------------------------------------------------
+# Configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will be
+# generated. Documented entities will be cross-referenced with these sources.
+#
+# Note: To get rid of all source code in the generated output, make sure that
+# also VERBATIM_HEADERS is set to NO.
+# The default value is: NO.
+
+SOURCE_BROWSER         = YES
+
+# Setting the INLINE_SOURCES tag to YES will include the body of functions,
+# classes and enums directly into the documentation.
+# The default value is: NO.
+
+INLINE_SOURCES         = NO
+
+# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any
+# special comment blocks from generated source code fragments. Normal C, C++ and
+# Fortran comments will always remain visible.
+# The default value is: YES.
+
+STRIP_CODE_COMMENTS    = YES
+
+# If the REFERENCED_BY_RELATION tag is set to YES then for each documented
+# entity all documented functions referencing it will be listed.
+# The default value is: NO.
+
+REFERENCED_BY_RELATION = NO
+
+# If the REFERENCES_RELATION tag is set to YES then for each documented function
+# all documented entities called/used by that function will be listed.
+# The default value is: NO.
+
+REFERENCES_RELATION    = NO
+
+# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set
+# to YES then the hyperlinks from functions in REFERENCES_RELATION and
+# REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will
+# link to the documentation.
+# The default value is: YES.
+
+REFERENCES_LINK_SOURCE = YES
+
+# If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the
+# source code will show a tooltip with additional information such as prototype,
+# brief description and links to the definition and documentation. Since this
+# will make the HTML file larger and loading of large files a bit slower, you
+# can opt to disable this feature.
+# The default value is: YES.
+# This tag requires that the tag SOURCE_BROWSER is set to YES.
+
+SOURCE_TOOLTIPS        = YES
+
+# If the USE_HTAGS tag is set to YES then the references to source code will
+# point to the HTML generated by the htags(1) tool instead of doxygen built-in
+# source browser. The htags tool is part of GNU's global source tagging system
+# (see https://www.gnu.org/software/global/global.html). You will need version
+# 4.8.6 or higher.
+#
+# To use it do the following:
+# - Install the latest version of global
+# - Enable SOURCE_BROWSER and USE_HTAGS in the configuration file
+# - Make sure the INPUT points to the root of the source tree
+# - Run doxygen as normal
+#
+# Doxygen will invoke htags (and that will in turn invoke gtags), so these
+# tools must be available from the command line (i.e. in the search path).
+#
+# The result: instead of the source browser generated by doxygen, the links to
+# source code will now point to the output of htags.
+# The default value is: NO.
+# This tag requires that the tag SOURCE_BROWSER is set to YES.
+
+USE_HTAGS              = NO
+
+# If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a
+# verbatim copy of the header file for each class for which an include is
+# specified. Set to NO to disable this.
+# See also: Section \class.
+# The default value is: YES.
+
+VERBATIM_HEADERS       = YES
+
+# If the CLANG_ASSISTED_PARSING tag is set to YES then doxygen will use the
+# clang parser (see: http://clang.llvm.org/) for more accurate parsing at the
+# cost of reduced performance. This can be particularly helpful with template
+# rich C++ code for which doxygen's built-in parser lacks the necessary type
+# information.
+# Note: The availability of this option depends on whether or not doxygen was
+# generated with the -Duse_libclang=ON option for CMake.
+# The default value is: NO.
+
+CLANG_ASSISTED_PARSING = NO
+
+# If clang assisted parsing is enabled you can provide the compiler with command
+# line options that you would normally use when invoking the compiler. Note that
+# the include paths will already be set by doxygen for the files and directories
+# specified with INPUT and INCLUDE_PATH.
+# This tag requires that the tag CLANG_ASSISTED_PARSING is set to YES.
+
+CLANG_OPTIONS          =
+
+# If clang assisted parsing is enabled you can provide the clang parser with the
+# path to the compilation database (see:
+# http://clang.llvm.org/docs/HowToSetupToolingForLLVM.html) used when the files
+# were built. This is equivalent to specifying the "-p" option to a clang tool,
+# such as clang-check. These options will then be passed to the parser.
+# Note: The availability of this option depends on whether or not doxygen was
+# generated with the -Duse_libclang=ON option for CMake.
+
+CLANG_DATABASE_PATH    =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all
+# compounds will be generated. Enable this if the project contains a lot of
+# classes, structs, unions or interfaces.
+# The default value is: YES.
+
+ALPHABETICAL_INDEX     = YES
+
+# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in
+# which the alphabetical index list will be split.
+# Minimum value: 1, maximum value: 20, default value: 5.
+# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
+
+COLS_IN_ALPHA_INDEX    = 5
+
+# In case all classes in a project start with a common prefix, all classes will
+# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag
+# can be used to specify a prefix (or a list of prefixes) that should be ignored
+# while generating the index headers.
+# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
+
+IGNORE_PREFIX          =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES, doxygen will generate HTML output
+# The default value is: YES.
+
+GENERATE_HTML          = YES
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: html.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_OUTPUT            = html
+
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each
+# generated HTML page (for example: .htm, .php, .asp).
+# The default value is: .html.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_FILE_EXTENSION    = .html
+
+# The HTML_HEADER tag can be used to specify a user-defined HTML header file for
+# each generated HTML page. If the tag is left blank doxygen will generate a
+# standard header.
+#
+# To get valid HTML the header file that includes any scripts and style sheets
+# that doxygen needs, which is dependent on the configuration options used (e.g.
+# the setting GENERATE_TREEVIEW). It is highly recommended to start with a
+# default header using
+# doxygen -w html new_header.html new_footer.html new_stylesheet.css
+# YourConfigFile
+# and then modify the file new_header.html. See also section "Doxygen usage"
+# for information on how to generate the default header that doxygen normally
+# uses.
+# Note: The header is subject to change so you typically have to regenerate the
+# default header when upgrading to a newer version of doxygen. For a description
+# of the possible markers and block names see the documentation.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_HEADER            =
+
+# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each
+# generated HTML page. If the tag is left blank doxygen will generate a standard
+# footer. See HTML_HEADER for more information on how to generate a default
+# footer and what special commands can be used inside the footer. See also
+# section "Doxygen usage" for information on how to generate the default footer
+# that doxygen normally uses.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_FOOTER            =
+
+# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style
+# sheet that is used by each HTML page. It can be used to fine-tune the look of
+# the HTML output. If left blank doxygen will generate a default style sheet.
+# See also section "Doxygen usage" for information on how to generate the style
+# sheet that doxygen normally uses.
+# Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as
+# it is more robust and this tag (HTML_STYLESHEET) will in the future become
+# obsolete.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_STYLESHEET        =
+
+# The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined
+# cascading style sheets that are included after the standard style sheets
+# created by doxygen. Using this option one can overrule certain style aspects.
+# This is preferred over using HTML_STYLESHEET since it does not replace the
+# standard style sheet and is therefore more robust against future updates.
+# Doxygen will copy the style sheet files to the output directory.
+# Note: The order of the extra style sheet files is of importance (e.g. the last
+# style sheet in the list overrules the setting of the previous ones in the
+# list). For an example see the documentation.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_EXTRA_STYLESHEET  =
+
+# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
+# other source files which should be copied to the HTML output directory. Note
+# that these files will be copied to the base HTML output directory. Use the
+# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these
+# files. In the HTML_STYLESHEET file, use the file name only. Also note that the
+# files will be copied as-is; there are no commands or markers available.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_EXTRA_FILES       =
+
+# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen
+# will adjust the colors in the style sheet and background images according to
+# this color. Hue is specified as an angle on a colorwheel, see
+# https://en.wikipedia.org/wiki/Hue for more information. For instance the value
+# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300
+# purple, and 360 is red again.
+# Minimum value: 0, maximum value: 359, default value: 220.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_COLORSTYLE_HUE    = 220
+
+# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors
+# in the HTML output. For a value of 0 the output will use grayscales only. A
+# value of 255 will produce the most vivid colors.
+# Minimum value: 0, maximum value: 255, default value: 100.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_COLORSTYLE_SAT    = 100
+
+# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the
+# luminance component of the colors in the HTML output. Values below 100
+# gradually make the output lighter, whereas values above 100 make the output
+# darker. The value divided by 100 is the actual gamma applied, so 80 represents
+# a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not
+# change the gamma.
+# Minimum value: 40, maximum value: 240, default value: 80.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_COLORSTYLE_GAMMA  = 80
+
+# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
+# page will contain the date and time when the page was generated. Setting this
+# to YES can help to show when doxygen was last run and thus if the
+# documentation is up to date.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_TIMESTAMP         = YES
+
+# If the HTML_DYNAMIC_MENUS tag is set to YES then the generated HTML
+# documentation will contain a main index with vertical navigation menus that
+# are dynamically created via Javascript. If disabled, the navigation index will
+# consists of multiple levels of tabs that are statically embedded in every HTML
+# page. Disable this option to support browsers that do not have Javascript,
+# like the Qt help browser.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_DYNAMIC_MENUS     = YES
+
+# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
+# documentation will contain sections that can be hidden and shown after the
+# page has loaded.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_DYNAMIC_SECTIONS  = NO
+
+# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries
+# shown in the various tree structured indices initially; the user can expand
+# and collapse entries dynamically later on. Doxygen will expand the tree to
+# such a level that at most the specified number of entries are visible (unless
+# a fully collapsed tree already exceeds this amount). So setting the number of
+# entries 1 will produce a full collapsed tree by default. 0 is a special value
+# representing an infinite number of entries and will result in a full expanded
+# tree by default.
+# Minimum value: 0, maximum value: 9999, default value: 100.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_INDEX_NUM_ENTRIES = 100
+
+# If the GENERATE_DOCSET tag is set to YES, additional index files will be
+# generated that can be used as input for Apple's Xcode 3 integrated development
+# environment (see: https://developer.apple.com/xcode/), introduced with OSX
+# 10.5 (Leopard). To create a documentation set, doxygen will generate a
+# Makefile in the HTML output directory. Running make will produce the docset in
+# that directory and running make install will install the docset in
+# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at
+# startup. See https://developer.apple.com/library/archive/featuredarticles/Doxy
+# genXcode/_index.html for more information.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_DOCSET        = NO
+
+# This tag determines the name of the docset feed. A documentation feed provides
+# an umbrella under which multiple documentation sets from a single provider
+# (such as a company or product suite) can be grouped.
+# The default value is: Doxygen generated docs.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_FEEDNAME        = "Doxygen generated docs"
+
+# This tag specifies a string that should uniquely identify the documentation
+# set bundle. This should be a reverse domain-name style string, e.g.
+# com.mycompany.MyDocSet. Doxygen will append .docset to the name.
+# The default value is: org.doxygen.Project.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_BUNDLE_ID       = org.doxygen.Project
+
+# The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify
+# the documentation publisher. This should be a reverse domain-name style
+# string, e.g. com.mycompany.MyDocSet.documentation.
+# The default value is: org.doxygen.Publisher.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_PUBLISHER_ID    = org.doxygen.Publisher
+
+# The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher.
+# The default value is: Publisher.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_PUBLISHER_NAME  = Publisher
+
+# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three
+# additional HTML index files: index.hhp, index.hhc, and index.hhk. The
+# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop
+# (see: https://www.microsoft.com/en-us/download/details.aspx?id=21138) on
+# Windows.
+#
+# The HTML Help Workshop contains a compiler that can convert all HTML output
+# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML
+# files are now used as the Windows 98 help format, and will replace the old
+# Windows help format (.hlp) on all Windows platforms in the future. Compressed
+# HTML files also contain an index, a table of contents, and you can search for
+# words in the documentation. The HTML workshop also contains a viewer for
+# compressed HTML files.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_HTMLHELP      = NO
+
+# The CHM_FILE tag can be used to specify the file name of the resulting .chm
+# file. You can add a path in front of the file if the result should not be
+# written to the html output directory.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+CHM_FILE               =
+
+# The HHC_LOCATION tag can be used to specify the location (absolute path
+# including file name) of the HTML help compiler (hhc.exe). If non-empty,
+# doxygen will try to run the HTML help compiler on the generated index.hhp.
+# The file has to be specified with full path.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+HHC_LOCATION           =
+
+# The GENERATE_CHI flag controls if a separate .chi index file is generated
+# (YES) or that it should be included in the master .chm file (NO).
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+GENERATE_CHI           = NO
+
+# The CHM_INDEX_ENCODING is used to encode HtmlHelp index (hhk), content (hhc)
+# and project file content.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+CHM_INDEX_ENCODING     =
+
+# The BINARY_TOC flag controls whether a binary table of contents is generated
+# (YES) or a normal table of contents (NO) in the .chm file. Furthermore it
+# enables the Previous and Next buttons.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+BINARY_TOC             = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members to
+# the table of contents of the HTML help documentation and to the tree view.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+TOC_EXPAND             = NO
+
+# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and
+# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that
+# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help
+# (.qch) of the generated HTML documentation.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_QHP           = NO
+
+# If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify
+# the file name of the resulting .qch file. The path specified is relative to
+# the HTML output folder.
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QCH_FILE               =
+
+# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help
+# Project output. For more information please see Qt Help Project / Namespace
+# (see: https://doc.qt.io/archives/qt-4.8/qthelpproject.html#namespace).
+# The default value is: org.doxygen.Project.
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_NAMESPACE          = org.doxygen.Project
+
+# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt
+# Help Project output. For more information please see Qt Help Project / Virtual
+# Folders (see: https://doc.qt.io/archives/qt-4.8/qthelpproject.html#virtual-
+# folders).
+# The default value is: doc.
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_VIRTUAL_FOLDER     = doc
+
+# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom
+# filter to add. For more information please see Qt Help Project / Custom
+# Filters (see: https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-
+# filters).
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_CUST_FILTER_NAME   =
+
+# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the
+# custom filter to add. For more information please see Qt Help Project / Custom
+# Filters (see: https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-
+# filters).
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_CUST_FILTER_ATTRS  =
+
+# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this
+# project's filter section matches. Qt Help Project / Filter Attributes (see:
+# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#filter-attributes).
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_SECT_FILTER_ATTRS  =
+
+# The QHG_LOCATION tag can be used to specify the location of Qt's
+# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the
+# generated .qhp file.
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHG_LOCATION           =
+
+# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be
+# generated, together with the HTML files, they form an Eclipse help plugin. To
+# install this plugin and make it available under the help contents menu in
+# Eclipse, the contents of the directory containing the HTML and XML files needs
+# to be copied into the plugins directory of eclipse. The name of the directory
+# within the plugins directory should be the same as the ECLIPSE_DOC_ID value.
+# After copying Eclipse needs to be restarted before the help appears.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_ECLIPSEHELP   = NO
+
+# A unique identifier for the Eclipse help plugin. When installing the plugin
+# the directory name containing the HTML and XML files should also have this
+# name. Each documentation set should have its own identifier.
+# The default value is: org.doxygen.Project.
+# This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES.
+
+ECLIPSE_DOC_ID         = org.doxygen.Project
+
+# If you want full control over the layout of the generated HTML pages it might
+# be necessary to disable the index and replace it with your own. The
+# DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top
+# of each HTML page. A value of NO enables the index and the value YES disables
+# it. Since the tabs in the index contain the same information as the navigation
+# tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+DISABLE_INDEX          = NO
+
+# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
+# structure should be generated to display hierarchical information. If the tag
+# value is set to YES, a side panel will be generated containing a tree-like
+# index structure (just like the one that is generated for HTML Help). For this
+# to work a browser that supports JavaScript, DHTML, CSS and frames is required
+# (i.e. any modern browser). Windows users are probably better off using the
+# HTML help feature. Via custom style sheets (see HTML_EXTRA_STYLESHEET) one can
+# further fine-tune the look of the index. As an example, the default style
+# sheet generated by doxygen has an example that shows how to put an image at
+# the root of the tree instead of the PROJECT_NAME. Since the tree basically has
+# the same information as the tab index, you could consider setting
+# DISABLE_INDEX to YES when enabling this option.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_TREEVIEW      = NO
+
+# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that
+# doxygen will group on one line in the generated HTML documentation.
+#
+# Note that a value of 0 will completely suppress the enum values from appearing
+# in the overview section.
+# Minimum value: 0, maximum value: 20, default value: 4.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+ENUM_VALUES_PER_LINE   = 4
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used
+# to set the initial width (in pixels) of the frame in which the tree is shown.
+# Minimum value: 0, maximum value: 1500, default value: 250.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+TREEVIEW_WIDTH         = 250
+
+# If the EXT_LINKS_IN_WINDOW option is set to YES, doxygen will open links to
+# external symbols imported via tag files in a separate window.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+EXT_LINKS_IN_WINDOW    = NO
+
+# Use this tag to change the font size of LaTeX formulas included as images in
+# the HTML documentation. When you change the font size after a successful
+# doxygen run you need to manually remove any form_*.png images from the HTML
+# output directory to force them to be regenerated.
+# Minimum value: 8, maximum value: 50, default value: 10.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+FORMULA_FONTSIZE       = 10
+
+# Use the FORMULA_TRANSPARENT tag to determine whether or not the images
+# generated for formulas are transparent PNGs. Transparent PNGs are not
+# supported properly for IE 6.0, but are supported on all modern browsers.
+#
+# Note that when changing this option you need to delete any form_*.png files in
+# the HTML output directory before the changes have effect.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+FORMULA_TRANSPARENT    = YES
+
+# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see
+# https://www.mathjax.org) which uses client side Javascript for the rendering
+# instead of using pre-rendered bitmaps. Use this if you do not have LaTeX
+# installed or if you want to formulas look prettier in the HTML output. When
+# enabled you may also need to install MathJax separately and configure the path
+# to it using the MATHJAX_RELPATH option.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+USE_MATHJAX            = YES
+
+# When MathJax is enabled you can set the default output format to be used for
+# the MathJax output. See the MathJax site (see:
+# http://docs.mathjax.org/en/latest/output.html) for more details.
+# Possible values are: HTML-CSS (which is slower, but has the best
+# compatibility), NativeMML (i.e. MathML) and SVG.
+# The default value is: HTML-CSS.
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+MATHJAX_FORMAT         = HTML-CSS
+
+# When MathJax is enabled you need to specify the location relative to the HTML
+# output directory using the MATHJAX_RELPATH option. The destination directory
+# should contain the MathJax.js script. For instance, if the mathjax directory
+# is located at the same level as the HTML output directory, then
+# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax
+# Content Delivery Network so you can quickly see the result without installing
+# MathJax. However, it is strongly recommended to install a local copy of
+# MathJax from https://www.mathjax.org before deployment.
+# The default value is: https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/.
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+MATHJAX_RELPATH        = http://cdn.mathjax.org/mathjax/latest
+
+# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax
+# extension names that should be enabled during MathJax rendering. For example
+# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+MATHJAX_EXTENSIONS     =
+
+# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces
+# of code that will be used on startup of the MathJax code. See the MathJax site
+# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an
+# example see the documentation.
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+MATHJAX_CODEFILE       =
+
+# When the SEARCHENGINE tag is enabled doxygen will generate a search box for
+# the HTML output. The underlying search engine uses javascript and DHTML and
+# should work on any modern browser. Note that when using HTML help
+# (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET)
+# there is already a search function so this one should typically be disabled.
+# For large projects the javascript based search engine can be slow, then
+# enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to
+# search using the keyboard; to jump to the search box use <access key> + S
+# (what the <access key> is depends on the OS and browser, but it is typically
+# <CTRL>, <ALT>/<option>, or both). Inside the search box use the <cursor down
+# key> to jump into the search results window, the results can be navigated
+# using the <cursor keys>. Press <Enter> to select an item or <escape> to cancel
+# the search. The filter options can be selected when the cursor is inside the
+# search box by pressing <Shift>+<cursor down>. Also here use the <cursor keys>
+# to select a filter and <Enter> or <escape> to activate or cancel the filter
+# option.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+SEARCHENGINE           = YES
+
+# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
+# implemented using a web server instead of a web client using Javascript. There
+# are two flavors of web server based searching depending on the EXTERNAL_SEARCH
+# setting. When disabled, doxygen will generate a PHP script for searching and
+# an index file used by the script. When EXTERNAL_SEARCH is enabled the indexing
+# and searching needs to be provided by external tools. See the section
+# "External Indexing and Searching" for details.
+# The default value is: NO.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+SERVER_BASED_SEARCH    = NO
+
+# When EXTERNAL_SEARCH tag is enabled doxygen will no longer generate the PHP
+# script for searching. Instead the search results are written to an XML file
+# which needs to be processed by an external indexer. Doxygen will invoke an
+# external search engine pointed to by the SEARCHENGINE_URL option to obtain the
+# search results.
+#
+# Doxygen ships with an example indexer (doxyindexer) and search engine
+# (doxysearch.cgi) which are based on the open source search engine library
+# Xapian (see: https://xapian.org/).
+#
+# See the section "External Indexing and Searching" for details.
+# The default value is: NO.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+EXTERNAL_SEARCH        = NO
+
+# The SEARCHENGINE_URL should point to a search engine hosted by a web server
+# which will return the search results when EXTERNAL_SEARCH is enabled.
+#
+# Doxygen ships with an example indexer (doxyindexer) and search engine
+# (doxysearch.cgi) which are based on the open source search engine library
+# Xapian (see: https://xapian.org/). See the section "External Indexing and
+# Searching" for details.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+SEARCHENGINE_URL       =
+
+# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed
+# search data is written to a file for indexing by an external tool. With the
+# SEARCHDATA_FILE tag the name of this file can be specified.
+# The default file is: searchdata.xml.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+SEARCHDATA_FILE        = searchdata.xml
+
+# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the
+# EXTERNAL_SEARCH_ID tag can be used as an identifier for the project. This is
+# useful in combination with EXTRA_SEARCH_MAPPINGS to search through multiple
+# projects and redirect the results back to the right project.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+EXTERNAL_SEARCH_ID     =
+
+# The EXTRA_SEARCH_MAPPINGS tag can be used to enable searching through doxygen
+# projects other than the one defined by this configuration file, but that are
+# all added to the same external search index. Each project needs to have a
+# unique id set via EXTERNAL_SEARCH_ID. The search mapping then maps the id of
+# to a relative location where the documentation can be found. The format is:
+# EXTRA_SEARCH_MAPPINGS = tagname1=loc1 tagname2=loc2 ...
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+EXTRA_SEARCH_MAPPINGS  =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES, doxygen will generate LaTeX output.
+# The default value is: YES.
+
+GENERATE_LATEX         = NO
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: latex.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_OUTPUT           = latex
+
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
+# invoked.
+#
+# Note that when not enabling USE_PDFLATEX the default is latex when enabling
+# USE_PDFLATEX the default is pdflatex and when in the later case latex is
+# chosen this is overwritten by pdflatex. For specific output languages the
+# default can have been set differently, this depends on the implementation of
+# the output language.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_CMD_NAME         = latex
+
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to generate
+# index for LaTeX.
+# Note: This tag is used in the Makefile / make.bat.
+# See also: LATEX_MAKEINDEX_CMD for the part in the generated output file
+# (.tex).
+# The default file is: makeindex.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+MAKEINDEX_CMD_NAME     = makeindex
+
+# The LATEX_MAKEINDEX_CMD tag can be used to specify the command name to
+# generate index for LaTeX. In case there is no backslash (\) as first character
+# it will be automatically added in the LaTeX code.
+# Note: This tag is used in the generated output file (.tex).
+# See also: MAKEINDEX_CMD_NAME for the part in the Makefile / make.bat.
+# The default value is: makeindex.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_MAKEINDEX_CMD    = makeindex
+
+# If the COMPACT_LATEX tag is set to YES, doxygen generates more compact LaTeX
+# documents. This may be useful for small projects and may help to save some
+# trees in general.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+COMPACT_LATEX          = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used by the
+# printer.
+# Possible values are: a4 (210 x 297 mm), letter (8.5 x 11 inches), legal (8.5 x
+# 14 inches) and executive (7.25 x 10.5 inches).
+# The default value is: a4.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+PAPER_TYPE             = a4
+
+# The EXTRA_PACKAGES tag can be used to specify one or more LaTeX package names
+# that should be included in the LaTeX output. The package can be specified just
+# by its name or with the correct syntax as to be used with the LaTeX
+# \usepackage command. To get the times font for instance you can specify :
+# EXTRA_PACKAGES=times or EXTRA_PACKAGES={times}
+# To use the option intlimits with the amsmath package you can specify:
+# EXTRA_PACKAGES=[intlimits]{amsmath}
+# If left blank no extra packages will be included.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+EXTRA_PACKAGES         =
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for the
+# generated LaTeX document. The header should contain everything until the first
+# chapter. If it is left blank doxygen will generate a standard header. See
+# section "Doxygen usage" for information on how to let doxygen write the
+# default header to a separate file.
+#
+# Note: Only use a user-defined header if you know what you are doing! The
+# following commands have a special meaning inside the header: $title,
+# $datetime, $date, $doxygenversion, $projectname, $projectnumber,
+# $projectbrief, $projectlogo. Doxygen will replace $title with the empty
+# string, for the replacement values of the other commands the user is referred
+# to HTML_HEADER.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_HEADER           =
+
+# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for the
+# generated LaTeX document. The footer should contain everything after the last
+# chapter. If it is left blank doxygen will generate a standard footer. See
+# LATEX_HEADER for more information on how to generate a default footer and what
+# special commands can be used inside the footer.
+#
+# Note: Only use a user-defined footer if you know what you are doing!
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_FOOTER           =
+
+# The LATEX_EXTRA_STYLESHEET tag can be used to specify additional user-defined
+# LaTeX style sheets that are included after the standard style sheets created
+# by doxygen. Using this option one can overrule certain style aspects. Doxygen
+# will copy the style sheet files to the output directory.
+# Note: The order of the extra style sheet files is of importance (e.g. the last
+# style sheet in the list overrules the setting of the previous ones in the
+# list).
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_EXTRA_STYLESHEET =
+
+# The LATEX_EXTRA_FILES tag can be used to specify one or more extra images or
+# other source files which should be copied to the LATEX_OUTPUT output
+# directory. Note that the files will be copied as-is; there are no commands or
+# markers available.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_EXTRA_FILES      =
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated is
+# prepared for conversion to PDF (using ps2pdf or pdflatex). The PDF file will
+# contain links (just like the HTML output) instead of page references. This
+# makes the output suitable for online browsing using a PDF viewer.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+PDF_HYPERLINKS         = YES
+
+# If the USE_PDFLATEX tag is set to YES, doxygen will use pdflatex to generate
+# the PDF file directly from the LaTeX files. Set this option to YES, to get a
+# higher quality PDF documentation.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+USE_PDFLATEX           = YES
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \batchmode
+# command to the generated LaTeX files. This will instruct LaTeX to keep running
+# if errors occur, instead of asking the user for help. This option is also used
+# when generating formulas in HTML.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_BATCHMODE        = NO
+
+# If the LATEX_HIDE_INDICES tag is set to YES then doxygen will not include the
+# index chapters (such as File Index, Compound Index, etc.) in the output.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_HIDE_INDICES     = NO
+
+# If the LATEX_SOURCE_CODE tag is set to YES then doxygen will include source
+# code with syntax highlighting in the LaTeX output.
+#
+# Note that which sources are shown also depends on other settings such as
+# SOURCE_BROWSER.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_SOURCE_CODE      = NO
+
+# The LATEX_BIB_STYLE tag can be used to specify the style to use for the
+# bibliography, e.g. plainnat, or ieeetr. See
+# https://en.wikipedia.org/wiki/BibTeX and \cite for more info.
+# The default value is: plain.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_BIB_STYLE        = plain
+
+# If the LATEX_TIMESTAMP tag is set to YES then the footer of each generated
+# page will contain the date and time when the page was generated. Setting this
+# to NO can help when comparing the output of multiple runs.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_TIMESTAMP        = NO
+
+# The LATEX_EMOJI_DIRECTORY tag is used to specify the (relative or absolute)
+# path from which the emoji images will be read. If a relative path is entered,
+# it will be relative to the LATEX_OUTPUT directory. If left blank the
+# LATEX_OUTPUT directory will be used.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_EMOJI_DIRECTORY  =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES, doxygen will generate RTF output. The
+# RTF output is optimized for Word 97 and may not look too pretty with other RTF
+# readers/editors.
+# The default value is: NO.
+
+GENERATE_RTF           = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: rtf.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_OUTPUT             = rtf
+
+# If the COMPACT_RTF tag is set to YES, doxygen generates more compact RTF
+# documents. This may be useful for small projects and may help to save some
+# trees in general.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+COMPACT_RTF            = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated will
+# contain hyperlink fields. The RTF file will contain links (just like the HTML
+# output) instead of page references. This makes the output suitable for online
+# browsing using Word or some other Word compatible readers that support those
+# fields.
+#
+# Note: WordPad (write) and others do not support links.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_HYPERLINKS         = NO
+
+# Load stylesheet definitions from file. Syntax is similar to doxygen's
+# configuration file, i.e. a series of assignments. You only have to provide
+# replacements, missing definitions are set to their default value.
+#
+# See also section "Doxygen usage" for information on how to generate the
+# default style sheet that doxygen normally uses.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_STYLESHEET_FILE    =
+
+# Set optional variables used in the generation of an RTF document. Syntax is
+# similar to doxygen's configuration file. A template extensions file can be
+# generated using doxygen -e rtf extensionFile.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_EXTENSIONS_FILE    =
+
+# If the RTF_SOURCE_CODE tag is set to YES then doxygen will include source code
+# with syntax highlighting in the RTF output.
+#
+# Note that which sources are shown also depends on other settings such as
+# SOURCE_BROWSER.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_SOURCE_CODE        = NO
+
+#---------------------------------------------------------------------------
+# Configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES, doxygen will generate man pages for
+# classes and files.
+# The default value is: NO.
+
+GENERATE_MAN           = NO
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it. A directory man3 will be created inside the directory specified by
+# MAN_OUTPUT.
+# The default directory is: man.
+# This tag requires that the tag GENERATE_MAN is set to YES.
+
+MAN_OUTPUT             = man
+
+# The MAN_EXTENSION tag determines the extension that is added to the generated
+# man pages. In case the manual section does not start with a number, the number
+# 3 is prepended. The dot (.) at the beginning of the MAN_EXTENSION tag is
+# optional.
+# The default value is: .3.
+# This tag requires that the tag GENERATE_MAN is set to YES.
+
+MAN_EXTENSION          = .3
+
+# The MAN_SUBDIR tag determines the name of the directory created within
+# MAN_OUTPUT in which the man pages are placed. If defaults to man followed by
+# MAN_EXTENSION with the initial . removed.
+# This tag requires that the tag GENERATE_MAN is set to YES.
+
+MAN_SUBDIR             =
+
+# If the MAN_LINKS tag is set to YES and doxygen generates man output, then it
+# will generate one additional man file for each entity documented in the real
+# man page(s). These additional files only source the real man page, but without
+# them the man command would be unable to find the correct page.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_MAN is set to YES.
+
+MAN_LINKS              = NO
+
+#---------------------------------------------------------------------------
+# Configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES, doxygen will generate an XML file that
+# captures the structure of the code including all documentation.
+# The default value is: NO.
+
+GENERATE_XML           = NO
+
+# The XML_OUTPUT tag is used to specify where the XML pages will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: xml.
+# This tag requires that the tag GENERATE_XML is set to YES.
+
+XML_OUTPUT             = xml
+
+# If the XML_PROGRAMLISTING tag is set to YES, doxygen will dump the program
+# listings (including syntax highlighting and cross-referencing information) to
+# the XML output. Note that enabling this will significantly increase the size
+# of the XML output.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_XML is set to YES.
+
+XML_PROGRAMLISTING     = YES
+
+# If the XML_NS_MEMB_FILE_SCOPE tag is set to YES, doxygen will include
+# namespace members in file scope as well, matching the HTML output.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_XML is set to YES.
+
+XML_NS_MEMB_FILE_SCOPE = NO
+
+#---------------------------------------------------------------------------
+# Configuration options related to the DOCBOOK output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_DOCBOOK tag is set to YES, doxygen will generate Docbook files
+# that can be used to generate PDF.
+# The default value is: NO.
+
+GENERATE_DOCBOOK       = NO
+
+# The DOCBOOK_OUTPUT tag is used to specify where the Docbook pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be put in
+# front of it.
+# The default directory is: docbook.
+# This tag requires that the tag GENERATE_DOCBOOK is set to YES.
+
+DOCBOOK_OUTPUT         = docbook
+
+# If the DOCBOOK_PROGRAMLISTING tag is set to YES, doxygen will include the
+# program listings (including syntax highlighting and cross-referencing
+# information) to the DOCBOOK output. Note that enabling this will significantly
+# increase the size of the DOCBOOK output.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_DOCBOOK is set to YES.
+
+DOCBOOK_PROGRAMLISTING = NO
+
+#---------------------------------------------------------------------------
+# Configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES, doxygen will generate an
+# AutoGen Definitions (see http://autogen.sourceforge.net/) file that captures
+# the structure of the code including all documentation. Note that this feature
+# is still experimental and incomplete at the moment.
+# The default value is: NO.
+
+GENERATE_AUTOGEN_DEF   = NO
+
+#---------------------------------------------------------------------------
+# Configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_PERLMOD tag is set to YES, doxygen will generate a Perl module
+# file that captures the structure of the code including all documentation.
+#
+# Note that this feature is still experimental and incomplete at the moment.
+# The default value is: NO.
+
+GENERATE_PERLMOD       = NO
+
+# If the PERLMOD_LATEX tag is set to YES, doxygen will generate the necessary
+# Makefile rules, Perl scripts and LaTeX code to be able to generate PDF and DVI
+# output from the Perl module output.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_PERLMOD is set to YES.
+
+PERLMOD_LATEX          = NO
+
+# If the PERLMOD_PRETTY tag is set to YES, the Perl module output will be nicely
+# formatted so it can be parsed by a human reader. This is useful if you want to
+# understand what is going on. On the other hand, if this tag is set to NO, the
+# size of the Perl module output will be much smaller and Perl will parse it
+# just the same.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_PERLMOD is set to YES.
+
+PERLMOD_PRETTY         = YES
+
+# The names of the make variables in the generated doxyrules.make file are
+# prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. This is useful
+# so different doxyrules.make files included by the same Makefile don't
+# overwrite each other's variables.
+# This tag requires that the tag GENERATE_PERLMOD is set to YES.
+
+PERLMOD_MAKEVAR_PREFIX =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES, doxygen will evaluate all
+# C-preprocessor directives found in the sources and include files.
+# The default value is: YES.
+
+ENABLE_PREPROCESSING   = YES
+
+# If the MACRO_EXPANSION tag is set to YES, doxygen will expand all macro names
+# in the source code. If set to NO, only conditional compilation will be
+# performed. Macro expansion can be done in a controlled way by setting
+# EXPAND_ONLY_PREDEF to YES.
+# The default value is: NO.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+MACRO_EXPANSION        = YES
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES then
+# the macro expansion is limited to the macros specified with the PREDEFINED and
+# EXPAND_AS_DEFINED tags.
+# The default value is: NO.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+EXPAND_ONLY_PREDEF     = YES
+
+# If the SEARCH_INCLUDES tag is set to YES, the include files in the
+# INCLUDE_PATH will be searched if a #include is found.
+# The default value is: YES.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+SEARCH_INCLUDES        = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that
+# contain include files that are not input files but should be processed by the
+# preprocessor.
+# This tag requires that the tag SEARCH_INCLUDES is set to YES.
+
+INCLUDE_PATH           =
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
+# patterns (like *.h and *.hpp) to filter out the header-files in the
+# directories. If left blank, the patterns specified with FILE_PATTERNS will be
+# used.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+INCLUDE_FILE_PATTERNS  =
+
+# The PREDEFINED tag can be used to specify one or more macro names that are
+# defined before the preprocessor is started (similar to the -D option of e.g.
+# gcc). The argument of the tag is a list of macros of the form: name or
+# name=definition (no spaces). If the definition and the "=" are omitted, "=1"
+# is assumed. To prevent a macro definition from being undefined via #undef or
+# recursively expanded use the := operator instead of the = operator.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+PREDEFINED             = VF_FETOL \
+                         VF_MPI \
+                         VF_METIS \
+                         VF_ZOLTAN
+
+# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
+# tag can be used to specify a list of macro names that should be expanded. The
+# macro definition that is found in the sources will be used. Use the PREDEFINED
+# tag if you want to use a different macro definition that overrules the
+# definition found in the source code.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+EXPAND_AS_DEFINED      =
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will
+# remove all references to function-like macros that are alone on a line, have
+# an all uppercase name, and do not end with a semicolon. Such function macros
+# are typically used for boiler-plate code, and will confuse the parser if not
+# removed.
+# The default value is: YES.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+SKIP_FUNCTION_MACROS   = YES
+
+#---------------------------------------------------------------------------
+# Configuration options related to external references
+#---------------------------------------------------------------------------
+
+# The TAGFILES tag can be used to specify one or more tag files. For each tag
+# file the location of the external documentation should be added. The format of
+# a tag file without this location is as follows:
+# TAGFILES = file1 file2 ...
+# Adding location for the tag files is done as follows:
+# TAGFILES = file1=loc1 "file2 = loc2" ...
+# where loc1 and loc2 can be relative or absolute paths or URLs. See the
+# section "Linking to external documentation" for more information about the use
+# of tag files.
+# Note: Each tag file must have a unique name (where the name does NOT include
+# the path). If a tag file is not located in the directory in which doxygen is
+# run, you must also specify the path to the tagfile here.
+
+TAGFILES               =
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create a
+# tag file that is based on the input files it reads. See section "Linking to
+# external documentation" for more information about the usage of tag files.
+
+GENERATE_TAGFILE       =
+
+# If the ALLEXTERNALS tag is set to YES, all external class will be listed in
+# the class index. If set to NO, only the inherited external classes will be
+# listed.
+# The default value is: NO.
+
+ALLEXTERNALS           = NO
+
+# If the EXTERNAL_GROUPS tag is set to YES, all external groups will be listed
+# in the modules index. If set to NO, only the current project's groups will be
+# listed.
+# The default value is: YES.
+
+EXTERNAL_GROUPS        = YES
+
+# If the EXTERNAL_PAGES tag is set to YES, all external pages will be listed in
+# the related pages index. If set to NO, only the current project's pages will
+# be listed.
+# The default value is: YES.
+
+EXTERNAL_PAGES         = YES
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+
+# If the CLASS_DIAGRAMS tag is set to YES, doxygen will generate a class diagram
+# (in HTML and LaTeX) for classes with base or super classes. Setting the tag to
+# NO turns the diagrams off. Note that this option also works with HAVE_DOT
+# disabled, but it is recommended to install and use dot, since it yields more
+# powerful graphs.
+# The default value is: YES.
+
+CLASS_DIAGRAMS         = YES
+
+# You can include diagrams made with dia in doxygen documentation. Doxygen will
+# then run dia to produce the diagram and insert it in the documentation. The
+# DIA_PATH tag allows you to specify the directory where the dia binary resides.
+# If left empty dia is assumed to be found in the default search path.
+
+DIA_PATH               =
+
+# If set to YES the inheritance and collaboration graphs will hide inheritance
+# and usage relations if the target is undocumented or is not a class.
+# The default value is: YES.
+
+HIDE_UNDOC_RELATIONS   = YES
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
+# available from the path. This tool is part of Graphviz (see:
+# http://www.graphviz.org/), a graph visualization toolkit from AT&T and Lucent
+# Bell Labs. The other options in this section have no effect if this option is
+# set to NO
+# The default value is: NO.
+
+HAVE_DOT               = NO
+
+# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is allowed
+# to run in parallel. When set to 0 doxygen will base this on the number of
+# processors available in the system. You can set it explicitly to a value
+# larger than 0 to get control over the balance between CPU load and processing
+# speed.
+# Minimum value: 0, maximum value: 32, default value: 0.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_NUM_THREADS        = 0
+
+# When you want a differently looking font in the dot files that doxygen
+# generates you can specify the font name using DOT_FONTNAME. You need to make
+# sure dot is able to find the font, which can be done by putting it in a
+# standard location or by setting the DOTFONTPATH environment variable or by
+# setting DOT_FONTPATH to the directory containing the font.
+# The default value is: Helvetica.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_FONTNAME           = Helvetica
+
+# The DOT_FONTSIZE tag can be used to set the size (in points) of the font of
+# dot graphs.
+# Minimum value: 4, maximum value: 24, default value: 10.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_FONTSIZE           = 10
+
+# By default doxygen will tell dot to use the default font as specified with
+# DOT_FONTNAME. If you specify a different font using DOT_FONTNAME you can set
+# the path where dot can find it using this tag.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_FONTPATH           =
+
+# If the CLASS_GRAPH tag is set to YES then doxygen will generate a graph for
+# each documented class showing the direct and indirect inheritance relations.
+# Setting this tag to YES will force the CLASS_DIAGRAMS tag to NO.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+CLASS_GRAPH            = YES
+
+# If the COLLABORATION_GRAPH tag is set to YES then doxygen will generate a
+# graph for each documented class showing the direct and indirect implementation
+# dependencies (inheritance, containment, and class references variables) of the
+# class with other documented classes.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+COLLABORATION_GRAPH    = YES
+
+# If the GROUP_GRAPHS tag is set to YES then doxygen will generate a graph for
+# groups, showing the direct groups dependencies.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+GROUP_GRAPHS           = YES
+
+# If the UML_LOOK tag is set to YES, doxygen will generate inheritance and
+# collaboration diagrams in a style similar to the OMG's Unified Modeling
+# Language.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+UML_LOOK               = NO
+
+# If the UML_LOOK tag is enabled, the fields and methods are shown inside the
+# class node. If there are many fields or methods and many nodes the graph may
+# become too big to be useful. The UML_LIMIT_NUM_FIELDS threshold limits the
+# number of items for each type to make the size more manageable. Set this to 0
+# for no limit. Note that the threshold may be exceeded by 50% before the limit
+# is enforced. So when you set the threshold to 10, up to 15 fields may appear,
+# but if the number exceeds 15, the total amount of fields shown is limited to
+# 10.
+# Minimum value: 0, maximum value: 100, default value: 10.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+UML_LIMIT_NUM_FIELDS   = 10
+
+# If the TEMPLATE_RELATIONS tag is set to YES then the inheritance and
+# collaboration graphs will show the relations between templates and their
+# instances.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+TEMPLATE_RELATIONS     = NO
+
+# If the INCLUDE_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are set to
+# YES then doxygen will generate a graph for each documented file showing the
+# direct and indirect include dependencies of the file with other documented
+# files.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+INCLUDE_GRAPH          = YES
+
+# If the INCLUDED_BY_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are
+# set to YES then doxygen will generate a graph for each documented file showing
+# the direct and indirect include dependencies of the file with other documented
+# files.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+INCLUDED_BY_GRAPH      = YES
+
+# If the CALL_GRAPH tag is set to YES then doxygen will generate a call
+# dependency graph for every global function or class method.
+#
+# Note that enabling this option will significantly increase the time of a run.
+# So in most cases it will be better to enable call graphs for selected
+# functions only using the \callgraph command. Disabling a call graph can be
+# accomplished by means of the command \hidecallgraph.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+CALL_GRAPH             = NO
+
+# If the CALLER_GRAPH tag is set to YES then doxygen will generate a caller
+# dependency graph for every global function or class method.
+#
+# Note that enabling this option will significantly increase the time of a run.
+# So in most cases it will be better to enable caller graphs for selected
+# functions only using the \callergraph command. Disabling a caller graph can be
+# accomplished by means of the command \hidecallergraph.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+CALLER_GRAPH           = NO
+
+# If the GRAPHICAL_HIERARCHY tag is set to YES then doxygen will graphical
+# hierarchy of all classes instead of a textual one.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+GRAPHICAL_HIERARCHY    = YES
+
+# If the DIRECTORY_GRAPH tag is set to YES then doxygen will show the
+# dependencies a directory has on other directories in a graphical way. The
+# dependency relations are determined by the #include relations between the
+# files in the directories.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DIRECTORY_GRAPH        = YES
+
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
+# generated by dot. For an explanation of the image formats see the section
+# output formats in the documentation of the dot tool (Graphviz (see:
+# http://www.graphviz.org/)).
+# Note: If you choose svg you need to set HTML_FILE_EXTENSION to xhtml in order
+# to make the SVG files visible in IE 9+ (other browsers do not have this
+# requirement).
+# Possible values are: png, jpg, gif, svg, png:gd, png:gd:gd, png:cairo,
+# png:cairo:gd, png:cairo:cairo, png:cairo:gdiplus, png:gdiplus and
+# png:gdiplus:gdiplus.
+# The default value is: png.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_IMAGE_FORMAT       = png
+
+# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to
+# enable generation of interactive SVG images that allow zooming and panning.
+#
+# Note that this requires a modern browser other than Internet Explorer. Tested
+# and working are Firefox, Chrome, Safari, and Opera.
+# Note: For IE 9+ you need to set HTML_FILE_EXTENSION to xhtml in order to make
+# the SVG files visible. Older versions of IE do not have SVG support.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+INTERACTIVE_SVG        = NO
+
+# The DOT_PATH tag can be used to specify the path where the dot tool can be
+# found. If left blank, it is assumed the dot tool can be found in the path.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_PATH               =
+
+# The DOTFILE_DIRS tag can be used to specify one or more directories that
+# contain dot files that are included in the documentation (see the \dotfile
+# command).
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOTFILE_DIRS           =
+
+# The MSCFILE_DIRS tag can be used to specify one or more directories that
+# contain msc files that are included in the documentation (see the \mscfile
+# command).
+
+MSCFILE_DIRS           =
+
+# The DIAFILE_DIRS tag can be used to specify one or more directories that
+# contain dia files that are included in the documentation (see the \diafile
+# command).
+
+DIAFILE_DIRS           =
+
+# When using plantuml, the PLANTUML_JAR_PATH tag should be used to specify the
+# path where java can find the plantuml.jar file. If left blank, it is assumed
+# PlantUML is not used or called during a preprocessing step. Doxygen will
+# generate a warning when it encounters a \startuml command in this case and
+# will not generate output for the diagram.
+
+PLANTUML_JAR_PATH      =
+
+# When using plantuml, the PLANTUML_CFG_FILE tag can be used to specify a
+# configuration file for plantuml.
+
+PLANTUML_CFG_FILE      =
+
+# When using plantuml, the specified paths are searched for files specified by
+# the !include statement in a plantuml block.
+
+PLANTUML_INCLUDE_PATH  =
+
+# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of nodes
+# that will be shown in the graph. If the number of nodes in a graph becomes
+# larger than this value, doxygen will truncate the graph, which is visualized
+# by representing a node as a red box. Note that doxygen if the number of direct
+# children of the root node in a graph is already larger than
+# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note that
+# the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
+# Minimum value: 0, maximum value: 10000, default value: 50.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_GRAPH_MAX_NODES    = 50
+
+# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the graphs
+# generated by dot. A depth value of 3 means that only nodes reachable from the
+# root by following a path via at most 3 edges will be shown. Nodes that lay
+# further from the root node will be omitted. Note that setting this option to 1
+# or 2 may greatly reduce the computation time needed for large code bases. Also
+# note that the size of a graph can be further restricted by
+# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
+# Minimum value: 0, maximum value: 1000, default value: 0.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+MAX_DOT_GRAPH_DEPTH    = 0
+
+# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
+# background. This is disabled by default, because dot on Windows does not seem
+# to support this out of the box.
+#
+# Warning: Depending on the platform used, enabling this option may lead to
+# badly anti-aliased labels on the edges of a graph (i.e. they become hard to
+# read).
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_TRANSPARENT        = NO
+
+# Set the DOT_MULTI_TARGETS tag to YES to allow dot to generate multiple output
+# files in one run (i.e. multiple -o and -T options on the command line). This
+# makes dot run faster, but since only newer versions of dot (>1.8.10) support
+# this, this feature is disabled by default.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_MULTI_TARGETS      = NO
+
+# If the GENERATE_LEGEND tag is set to YES doxygen will generate a legend page
+# explaining the meaning of the various boxes and arrows in the dot generated
+# graphs.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+GENERATE_LEGEND        = YES
+
+# If the DOT_CLEANUP tag is set to YES, doxygen will remove the intermediate dot
+# files that are used to generate the various graphs.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_CLEANUP            = YES
diff --git a/Documentation/doxygen/VirtualFluidsLogo_lowResolution.png b/Documentation/doxygen/VirtualFluidsLogo_lowResolution.png
new file mode 100644
index 0000000000000000000000000000000000000000..06325f4d26a31a0b0a3b003ed57708f932eb5865
Binary files /dev/null and b/Documentation/doxygen/VirtualFluidsLogo_lowResolution.png differ
diff --git a/readme.md b/readme.md
new file mode 100644
index 0000000000000000000000000000000000000000..9cc1d71100ad540717507718a7569fc603759eac
--- /dev/null
+++ b/readme.md
@@ -0,0 +1,61 @@
+Software Requirements:
+======================
+
+CMake [cmake.org](https://cmake.org/):
+* minimum version 3.13
+
+CUDA [developer.nvidia.com/cuda-zone](https://developer.nvidia.com/cuda-zone):
+* Minimum CUDA Version 9.0
+* Minimum Compute Capability 3.0, because of maximal number of Blocks in x direction
+* Recommended Compute Capability 6.0, because of atomics for double precision floating point data (GKS only)
+    
+Paraview [www.paraview.org](https://www.paraview.org/):
+* any version, for example the most recent
+    
+C++ Compiler:
+* with C++11 support, for example gcc6.3 or Visual C++ 14.0
+    
+How to get VirtualFluidsGPU:
+==========================
+
+Option 1: use git
+1. checkout out https://git.irmb.bau.tu-bs.de/VirtualFluids/VirtualFluidsGPU.git with your credentials
+
+Option 2: without git
+1. go to git.irmb.tu-bs.de
+2. Log in with your credentials
+3. click on VirtualFluids/VirtualFluidsGPU
+4. click on the download symbol on the top right and download zip/tar.gz file
+
+How to build VirtualFluidsGPU:
+============================
+
+1. CMake the project
+2. set the output path in targets/apps/LidDrivenCavity/LidDrivenCavity.cpp
+3. build the project ("compile")
+4. run the generated executable (usually in <build directory>/bin/)
+
+Known Issues:
+-------------
+
+If CMake does not find CUDA_CUT_INCLUDE_DIR use and set the correct CUDA Pathes in CMakeLists.txt in the base directory in lines 35, 36.
+
+VirtualFluidsGPU results files:
+===============================
+
+VirtualFluidsGPU generates a the time series of output files directly in the output path. In Paraview these time series can be read directly.
+
+VirtualFluidsGPU change between Double and Single Precision:
+============================================================
+
+Option 1:
+1. go to CMakeLists.txt in the base directory
+2. go to line 83 to switch ON/OFF VF_DOUBLE_ACCURACY
+
+Option 2:
+Check/uncheck the item VF_DOUBLE_ACCURACY in CMake.
+
+Documentation:
+==============
+
+The doxygen generated documentation can be found [here](https://git.irmb.bau.tu-bs.de/doku/GPU).
\ No newline at end of file
diff --git a/src/Core/ArrayTypes.h b/src/Core/ArrayTypes.h
new file mode 100644
index 0000000000000000000000000000000000000000..71089e99d906dcfe207d69c674ba758ad47134d9
--- /dev/null
+++ b/src/Core/ArrayTypes.h
@@ -0,0 +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 ArrayTypes.h
+//! \ingroup Core
+//! \author Stephan Lenz
+//=======================================================================================
+#ifndef ARRAYTYPES_H
+#define ARRAYTYPES_H
+
+#include <array>
+
+#include "DataTypes.h"
+
+typedef std::array< uint, 2  > uint_2 ;
+typedef std::array< uint, 3  > uint_3 ;
+typedef std::array< uint, 4  > uint_4 ;
+typedef std::array< uint, 5  > uint_5 ;
+typedef std::array< uint, 6  > uint_6 ;
+typedef std::array< uint, 7  > uint_7 ;
+typedef std::array< uint, 8  > uint_8 ;
+typedef std::array< uint, 9  > uint_9 ;
+typedef std::array< uint, 10 > uint_10;
+typedef std::array< uint, 11 > uint_11;
+typedef std::array< uint, 12 > uint_12;
+typedef std::array< uint, 13 > uint_13;
+typedef std::array< uint, 14 > uint_14;
+typedef std::array< uint, 15 > uint_15;
+typedef std::array< uint, 16 > uint_16;
+typedef std::array< uint, 17 > uint_17;
+typedef std::array< uint, 18 > uint_18;
+typedef std::array< uint, 19 > uint_19;
+typedef std::array< uint, 20 > uint_20;
+typedef std::array< uint, 21 > uint_21;
+typedef std::array< uint, 22 > uint_22;
+typedef std::array< uint, 23 > uint_23;
+typedef std::array< uint, 24 > uint_24;
+typedef std::array< uint, 25 > uint_25;
+typedef std::array< uint, 26 > uint_26;
+typedef std::array< uint, 27 > uint_27;
+
+typedef std::array< bool, 2  > bool_2 ;
+typedef std::array< bool, 3  > bool_3 ;
+typedef std::array< bool, 4  > bool_4 ;
+typedef std::array< bool, 5  > bool_5 ;
+typedef std::array< bool, 6  > bool_6 ;
+typedef std::array< bool, 7  > bool_7 ;
+typedef std::array< bool, 8  > bool_8 ;
+typedef std::array< bool, 9  > bool_9 ;
+typedef std::array< bool, 10 > bool_10;
+typedef std::array< bool, 11 > bool_11;
+typedef std::array< bool, 12 > bool_12;
+typedef std::array< bool, 13 > bool_13;
+typedef std::array< bool, 14 > bool_14;
+typedef std::array< bool, 15 > bool_15;
+typedef std::array< bool, 16 > bool_16;
+typedef std::array< bool, 17 > bool_17;
+typedef std::array< bool, 18 > bool_18;
+typedef std::array< bool, 19 > bool_19;
+typedef std::array< bool, 20 > bool_20;
+typedef std::array< bool, 21 > bool_21;
+typedef std::array< bool, 22 > bool_22;
+typedef std::array< bool, 23 > bool_23;
+typedef std::array< bool, 24 > bool_24;
+typedef std::array< bool, 25 > bool_25;
+typedef std::array< bool, 26 > bool_26;
+typedef std::array< bool, 27 > bool_27;
+
+#endif
diff --git a/src/Core/DataTypes.h b/src/Core/DataTypes.h
new file mode 100644
index 0000000000000000000000000000000000000000..3c0f841aff2cbbc564b8c324bae8003669c6dfb3
--- /dev/null
+++ b/src/Core/DataTypes.h
@@ -0,0 +1,47 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 DataTypes.h
+//! \ingroup Core
+//! \author Stephan Lenz, Soeren Peters
+//=======================================================================================
+#ifndef DATATYPES_H
+#define DATATYPES_H
+
+#include "VirtualFluidsDefinitions.h"
+
+#ifdef VF_DOUBLE_ACCURACY
+typedef double real;
+#else
+typedef float  real;
+#endif
+
+typedef unsigned int uint;
+#define INVALID_INDEX 4294967295 //max uint
+
+#endif
diff --git a/src/Core/LbmOrGks.h b/src/Core/LbmOrGks.h
new file mode 100644
index 0000000000000000000000000000000000000000..d831dc80c3abc0c8b76f012c065cf028cd1fa6d5
--- /dev/null
+++ b/src/Core/LbmOrGks.h
@@ -0,0 +1,42 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 LbmOrGks.h
+//! \ingroup Core
+//! \author Stephan Lenz
+//=======================================================================================
+#ifndef LBMORGKS_H
+#define LBMORGKS_H
+
+enum LbmOrGks
+{
+	LBM,
+	GKS
+};
+
+#endif
diff --git a/src/Core/Logger/Logger.cpp b/src/Core/Logger/Logger.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..1b1e18e5b3e0f4f84eb7472a191da74883b2aee4
--- /dev/null
+++ b/src/Core/Logger/Logger.cpp
@@ -0,0 +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 Logger.cpp
+//! \ingroup Logger
+//! \author Soeren Peters
+//=======================================================================================
+#include "Logger.h"
+#include <memory>
+#include <iostream>
+
+#include "implementations/LoggerImp.h"
+
+
+
+namespace logging {
+
+    std::shared_ptr<Logger> out = nullptr;
+
+    logging::Logger::Level logging::Logger::globalLogLevel = logging::Logger::INFO_LOW;
+    logging::Logger::Level logging::Logger::localLogLevel = logging::Logger::INFO_LOW;
+    bool logging::Logger::printRankNumber = false;
+    bool logging::Logger::timeStampEnabled = false;
+   
+
+    logging::Logger::Logger(std::ostream* stream)
+    {
+        streams.push_back(stream);
+    }
+
+    logging::Logger::~Logger()
+    {
+
+    }
+
+    void Logger::addStreamToList(std::ostream* stream)
+    {
+        streams.push_back(stream);
+    }
+
+    void Logger::resetStreamList()
+    {
+        streams.clear();
+    }
+
+
+//-----------static methods----------------//
+    void logging::Logger::resetStreams()
+    {
+        if (!out)
+            out = std::make_shared<LoggerImp>(&std::cout);
+
+        out->resetStreamList();
+    }
+
+    void logging::Logger::setStream(std::ostream* stream)
+    {
+        out = std::make_shared<LoggerImp>(stream);
+    }
+
+    void logging::Logger::addStream(std::ostream* stream)
+    {
+        if (!out)
+            out = std::make_shared<LoggerImp>(stream);
+        else
+            out->addStreamToList(stream);
+    }
+
+    void logging::Logger::timeStamp(TimeStamp timeStamp)
+    {
+        switch(timeStamp)
+        {
+        case ENABLE:
+            timeStampEnabled = true;
+            break;
+        case DISABLE:
+            timeStampEnabled = false;
+            break;
+        }
+    }
+
+
+
+    void logging::Logger::setDebugLevel(const Level &level)
+    {
+        globalLogLevel = level;
+    }
+
+    void logging::Logger::enablePrintedRankNumbers(bool print)
+    {
+        printRankNumber = print;
+    }
+
+}
diff --git a/src/Core/Logger/Logger.h b/src/Core/Logger/Logger.h
new file mode 100644
index 0000000000000000000000000000000000000000..d81e8dadbe8a1f79f02f3b89b4c1b22ae560cae9
--- /dev/null
+++ b/src/Core/Logger/Logger.h
@@ -0,0 +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 Logger.h
+//! \ingroup Logger
+//! \author Soeren Peters
+//=======================================================================================
+#ifndef Logger_H
+#define Logger_H
+
+#include <VirtualFluidsDefinitions.h>
+
+#include <string>
+#include <memory>
+#include <ostream>
+#include <vector>
+
+namespace logging 
+{
+    class VF_PUBLIC Logger
+    {
+    protected:
+        Logger(std::ostream* stream);
+
+    public:
+        virtual ~Logger();
+
+		enum Level
+		{
+			INFO_LOW = 3,
+			INFO_INTERMEDIATE = 2,
+			INFO_HIGH = 1,
+			WARNING = 0,
+			LOGGER_ERROR = -1
+		};
+
+        enum TimeStamp
+        {
+            ENABLE,
+            DISABLE
+		};
+
+        static void setStream(std::ostream* stream);
+        static void addStream(std::ostream* stream);
+        static void resetStreams();
+
+        static void timeStamp(TimeStamp timeStamp);
+
+        static void setDebugLevel(const Level &level = Level::LOGGER_ERROR);
+        static void enablePrintedRankNumbers(bool printRankNumbers);
+
+        virtual Logger& operator<<(const Level &level) = 0;
+        virtual Logger& operator<<(const std::string &log) = 0;
+        virtual Logger& operator<<(const int &log) = 0;
+        virtual Logger& operator<<(const unsigned int &log) = 0;
+        virtual Logger& operator<<(const unsigned long& log) = 0;
+        virtual Logger& operator<<(const float &log) = 0;
+        virtual Logger& operator<<(const double &log) = 0;
+
+    protected:
+        void addStreamToList(std::ostream* stream);
+        void resetStreamList();
+
+        std::vector<std::ostream*> streams;
+
+        static Level globalLogLevel;
+        static Level localLogLevel;
+        static bool printRankNumber;
+        static bool timeStampEnabled;
+
+    };
+    extern VF_SHARED_LIB_IMPORT std::shared_ptr<Logger> out;
+}
+
+
+
+#endif
diff --git a/src/Core/Logger/implementations/LoggerImp.cpp b/src/Core/Logger/implementations/LoggerImp.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..8a717d9a71984ca81660cfd087805b54883f92cf
--- /dev/null
+++ b/src/Core/Logger/implementations/LoggerImp.cpp
@@ -0,0 +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 LoggerImp.cpp
+//! \ingroup Logger
+//! \author Soeren Peters
+//=======================================================================================
+#include "LoggerImp.h"
+
+#include <sstream>
+#include <iostream>
+#include <iomanip>
+#include <chrono>
+
+
+logging::LoggerImp::LoggerImp(std::ostream* stream) : logging::Logger(stream)
+{
+    levelString[Level::WARNING]           = "[WARNING]          ";
+    levelString[Level::LOGGER_ERROR]      = "[ERROR]            ";
+    levelString[Level::INFO_LOW]          = "[INFO_LOW]         ";
+    levelString[Level::INFO_INTERMEDIATE] = "[INFO_INTERMEDIATE]";
+    levelString[Level::INFO_HIGH]         = "[INFO_HIGH]        ";
+}
+
+logging::LoggerImp::~LoggerImp()
+{
+
+}
+
+logging::Logger& logging::LoggerImp::operator<<(const Level &level)
+{
+    localLogLevel = level;
+    return *this;
+}
+
+
+logging::Logger& logging::LoggerImp::operator<<(const std::string &message)
+{
+    return this->log(message);
+}
+
+logging::Logger& logging::LoggerImp::operator<<(const int &message)
+{
+    return this->log(std::to_string(message));
+}
+
+logging::Logger& logging::LoggerImp::operator<<(const unsigned int &message)
+{
+    return this->log(std::to_string(message));
+}
+
+logging::Logger& logging::LoggerImp::operator<<(const unsigned long &message)
+{
+    return this->log(std::to_string(message));
+}
+
+logging::Logger& logging::LoggerImp::operator<<(const float &message)
+{
+    return this->log(std::to_string(message));
+}
+
+logging::Logger& logging::LoggerImp::operator<<(const double &message)
+{
+    return this->log(std::to_string(message));
+}
+
+logging::Logger& logging::LoggerImp::log(const std::string &message)
+{
+    if (shouldBeLogged())
+    {
+        std::string modifiedMessage = message;
+        addDebugInformation(modifiedMessage);
+        for(auto stream : streams)
+            *stream << modifiedMessage << std::flush;
+    }
+    std::size_t found = message.find(std::string("\n"));
+    if (found != std::string::npos)
+        newLoggingLine = true;
+    else
+        newLoggingLine = false;
+
+    return *this;
+}
+
+bool logging::LoggerImp::shouldBeLogged()
+{
+    return localLogLevel <= globalLogLevel;
+}
+
+void logging::LoggerImp::addDebugInformation(std::string& message)
+{
+    if (newLoggingLine) {
+        std::stringstream os;
+        os << levelString[localLogLevel] << getTimeStamp() << " "  << message;
+        message = os.str();
+    }
+}
+
+
+std::string logging::LoggerImp::getTimeStamp()
+{
+    if (!timeStampEnabled)
+        return "";
+
+    const auto now = std::chrono::system_clock::now();
+    time_t tt = std::chrono::system_clock::to_time_t(now);
+    //const tm utc_tm = *gmtime(&tt);
+    const tm local_tm = *localtime(&tt);
+
+    std::stringstream os;
+    os << " [" << std::setw(2) << std::setfill('0') << local_tm.tm_hour << ":";
+    os         << std::setw(2) << std::setfill('0') << local_tm.tm_min  << ":";
+    os         << std::setw(2) << std::setfill('0') << local_tm.tm_sec  << "]";
+    return os.str();
+}
+
+
diff --git a/src/Core/Logger/implementations/LoggerImp.h b/src/Core/Logger/implementations/LoggerImp.h
new file mode 100644
index 0000000000000000000000000000000000000000..6fb2519d6d99c925d501d5452e69ea314b0142c1
--- /dev/null
+++ b/src/Core/Logger/implementations/LoggerImp.h
@@ -0,0 +1,78 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 LoggerImp.h
+//! \ingroup Logger
+//! \author Soeren Peters
+//=======================================================================================
+#ifndef LoggerImp_H
+#define LoggerImp_H
+
+
+#include <VirtualFluidsDefinitions.h>
+
+#include <string>
+
+#include "../Logger.h"
+#include <map>
+
+namespace logging
+{
+
+    class VF_PUBLIC LoggerImp : public Logger
+    {
+    public:
+        LoggerImp(std::ostream* stream);
+        virtual ~LoggerImp();
+
+        Logger& operator<<(const Level &level) override;
+        Logger& operator<<(const std::string &message) override;
+        Logger& operator<<(const int &message) override;
+        Logger& operator<<(const unsigned int &message) override;
+        Logger& operator<<(const unsigned long& log) override;
+        Logger& operator<<(const float &message) override;
+        Logger& operator<<(const double &message) override;
+
+
+    private:
+        std::string getRankString();
+        static bool shouldBeLogged();
+
+        static std::string getTimeStamp();
+        void addDebugInformation(std::string& message);
+        logging::Logger& log(const std::string &message);
+
+    private:
+        std::map<Logger::Level, std::string> levelString;
+        bool newLoggingLine = true;
+    };
+
+}
+
+
+#endif
diff --git a/src/Core/Logger/implementations/LoggerTest.cpp b/src/Core/Logger/implementations/LoggerTest.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..e26cbc650e83d485f843d1b448078f0997bb4e42
--- /dev/null
+++ b/src/Core/Logger/implementations/LoggerTest.cpp
@@ -0,0 +1,64 @@
+#include "gmock/gmock.h"
+#include <fstream>
+#include <memory>
+
+#include "../Logger.h"
+
+
+TEST(LoggerTest, logStringWithoutSettingLevels_WillPutTheLogMesssageIntoTheStream)
+{
+    std::ostringstream stream;
+    logging::Logger::setStream(&stream);
+
+    *logging::out << logging::Logger::INFO_LOW << "Hello World\n";
+
+    EXPECT_THAT(stream.str(), "[LOW] Hello World\n");
+}
+
+TEST(LoggerTest, logStringWithHighDebugLevel_logOnlyHighLevelMessages)
+{
+    std::ostringstream stream;
+    logging::Logger::setStream(&stream);
+
+    logging::Logger::setDebugLevel(logging::Logger::INFO_HIGH);
+    *logging::out << logging::Logger::INFO_LOW << "Low Debug Message\n" << logging::Logger::INFO_HIGH << "HIGH Debug Message\n";
+
+    EXPECT_THAT(stream.str(), "[HIGH] HIGH Debug Message\n");
+}
+
+TEST(LoggerTest, addTwoStreams_shouldWriteToBoth)
+{
+    logging::Logger::resetStreams();
+
+    std::ostringstream stream1, stream2;
+    logging::out->addStream(&stream1);
+    logging::out->addStream(&stream2);
+    logging::Logger::setDebugLevel(logging::Logger::INFO_LOW);
+
+    *logging::out << logging::Logger::INFO_LOW <<"Hello World\n";
+
+    EXPECT_THAT(stream1.str(), "[LOW] Hello World\n");
+    EXPECT_THAT(stream2.str(), "[LOW] Hello World\n");
+}
+
+TEST(LoggerTest, splittetOutputShouldHaveDebugInformationOnce)
+{
+    std::ostringstream stream;
+    logging::Logger::setStream(&stream);
+
+    *logging::out << logging::Logger::INFO_LOW << "Hello" << " World\n";
+
+    EXPECT_THAT(stream.str(), "[LOW] Hello World\n");
+}
+
+TEST(LoggerTest, enableTimeStampInOutput)
+{
+    std::ostringstream stream;
+    logging::Logger::setStream(&stream);
+    logging::Logger::timeStamp(logging::Logger::TimeStamp::ENABLE);
+
+    *logging::out << logging::Logger::INFO_LOW << "Hello" << " World\n";
+    
+    EXPECT_THAT(stream.str(), testing::StrNe("[LOW] Hello World\n"));
+}
+
diff --git a/src/Core/Logger/implementations/package.include b/src/Core/Logger/implementations/package.include
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/src/Core/Logger/package.include b/src/Core/Logger/package.include
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/src/Core/NonCreatable.h b/src/Core/NonCreatable.h
new file mode 100644
index 0000000000000000000000000000000000000000..75eb5db3d622bb62eff80990d0cb4bca0b4cc021
--- /dev/null
+++ b/src/Core/NonCreatable.h
@@ -0,0 +1,46 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  This file is part of VirtualFluids. VirtualFluids is free software: you can 
+//  redistribute it and/or modify it under the terms of the GNU General Public
+//  License as published by the Free Software Foundation, either version 3 of 
+//  the License, or (at your option) any later version.
+//  
+//  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT 
+//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
+//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License 
+//  for more details.
+//  
+//  You should have received a copy of the GNU General Public License along
+//  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+//
+//! \file NonCreatable.h
+//! \ingroup Core
+//! \author Soeren Peters
+//=======================================================================================
+#ifndef NON_CREATABLE_H
+#define NON_CREATABLE_H
+
+
+class NonCreatable
+{
+private:
+   NonCreatable() = delete;                                
+   NonCreatable( const NonCreatable& ) = delete;
+   NonCreatable& operator=( const NonCreatable& ) = delete;
+};
+  
+
+#endif
diff --git a/src/Core/PointerDefinitions.h b/src/Core/PointerDefinitions.h
new file mode 100644
index 0000000000000000000000000000000000000000..f56bffd57dffd30a8f4068b6b0948ef2869099d7
--- /dev/null
+++ b/src/Core/PointerDefinitions.h
@@ -0,0 +1,54 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 PointerDefinitions.h
+//! \ingroup Core
+//! \author Soeren Peters
+//=======================================================================================
+#ifndef SHARED_POINTER_H
+#define SHARED_POINTER_H
+
+#include <memory>
+
+
+template <class T>
+using SPtr = std::shared_ptr<T>;
+
+template <class T>
+using WPtr = std::weak_ptr<T>;
+
+template <class T>
+using UPtr = std::unique_ptr<T>;
+
+template <class T>
+using RPtr = T*;
+
+template <class T>
+using enableSharedFromThis = std::enable_shared_from_this<T>;
+
+#endif
diff --git a/src/Core/RealConstants.h b/src/Core/RealConstants.h
new file mode 100644
index 0000000000000000000000000000000000000000..f18decf5fa61a5bf52a8088c3435b346a9aaccc8
--- /dev/null
+++ b/src/Core/RealConstants.h
@@ -0,0 +1,259 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 RealConstants.h
+//! \ingroup Core
+//! \author Martin Schoenherr
+//=======================================================================================
+#ifndef REAL_CONSTANT_H
+#define REAL_CONSTANT_H
+
+#include "VirtualFluidsDefinitions.h"
+
+#ifdef VF_DOUBLE_ACCURACY
+#define c1o2		0.5
+#define c3o2		1.5
+#define c1o3		0.333333333333333
+#define c2o3		0.666666666666667
+#define c1o4		0.25
+#define c3o4		0.75
+#define c1o6		0.166666666666667
+#define c1o7		0.142857142857143
+#define c1o8		0.125
+#define c1o9		0.111111111111111
+#define c2o9		0.222222222222222
+#define c4o9		0.444444444444444
+#define c1o10		0.1
+#define c1o12		0.083333333333333
+#define c1o16		0.0625
+#define c3o16		0.1875
+#define c9o16		0.5625
+#define c1o18		0.055555555555556
+#define c1o20		0.05
+#define c19o20		0.95
+#define c21o20		1.05
+#define c1o24		0.041666666666667
+#define c1o27		0.037037037037037
+#define c3o32		0.09375
+#define c4o32		0.125
+#define c1o36		0.027777777777778
+#define c1o48		0.020833333333333
+#define c1o64		0.015625
+#define c3o64		0.046875
+#define c9o64		0.140625
+#define c27o64		0.421875
+#define c1o66		0.015151515151515
+#define c1o72		0.013888888888889
+#define c1o264		0.003787878787879
+#define c8o27		0.296296296296296
+#define c2o27		0.074074074074074
+#define c1o54		0.018518518518519
+#define c1o100		0.01
+#define c99o100		0.99
+#define c1o126		0.007936507936508
+#define c1o216		0.004629629629630
+#define c5o4		1.25
+#define c9o4		2.25
+#define c5o2		2.5
+#define c9o2		4.5
+
+#define c0o1		0.
+#define c1o1		1.
+#define c2o1		2.
+#define c3o1		3.
+#define c4o1		4.
+#define c5o1		5.
+#define c6o1		6.
+#define c7o1		7.
+#define c8o1		8.
+#define c9o1		9.
+#define c10o1 		10.
+#define c11o1  		11.
+#define c12o1  		12.
+#define c13o1		13.
+#define c14o1		14.
+#define c15o1		15.
+#define c16o1 		16.
+#define c17o1 		17.
+#define c18o1		18.
+#define c21o1		21.
+#define c24o1		24.
+#define c25o1 		25.
+#define c26o1		26.
+#define c27o1		27.
+#define c28o1		28.
+#define c29o1		29.
+#define c30o1  		30.
+#define c32o1		32.
+#define c33o1		33.
+#define c34o1		34.
+#define c36o1		36.
+#define c40o1		40.
+#define c42o1		42.
+#define c46o1		46.
+#define c48o1		48.
+#define c50o1		50.
+#define c52o1		52.
+#define c54o1		54.
+#define c56o1		56.
+#define c64o1		64.
+#define c66o1		66.
+#define c68o1		68.
+#define c69o1		69.
+#define c72o1		72.
+#define c84o1		84.
+#define c88o1		88.
+#define c96o1		96.
+#define c100o1		100.0
+#define c130o1		130.0
+#define c152o1		152.0
+#define c166o1		166.0
+#define c195o1		195.0
+#define c216o1		216.0
+#define c264o1		264.0
+#define c290o1		290.0
+#define c367o1		367.0
+
+#define Op0000002   0.0000002
+#define c10eM30		1e-30
+#define c10eM10		1e-10
+#define smallSingle 0.0000000002
+
+
+#else
+#define c1o2		0.5f
+#define c3o2		1.5f
+#define c1o3		(1.0f/3.0f)
+#define c2o3		(2.0f/3.0f)
+#define c1o4		0.25f
+#define c3o4		0.75f
+#define c1o6		(1.0f/6.0f)
+#define c1o7		(1.0f/7.0f)
+#define c1o8		0.125f
+#define c1o9		(1.0f/9.0f)
+#define c2o9		(2.0f/9.0f)
+#define c4o9		(4.0f/9.0f)
+#define c1o10		0.1f
+#define c1o12		(1.0f/12.0f)
+#define c1o16		0.0625f
+#define c3o16		0.1875f
+#define c9o16		0.5625f
+#define c1o18		(1.0f/18.0f)
+#define c1o20		0.05f
+#define c19o20		0.95f
+#define c21o20		1.05f
+#define c1o24		(1.0f/24.0f)
+#define c1o27		(1.0f/27.0f)
+#define c3o32		0.09375f
+#define c4o32		0.125f
+#define c1o36		(1.0f/36.0f)
+#define c1o48		(1.0f/48.0f)
+#define c1o64		0.015625f
+#define c3o64		0.046875f
+#define c9o64		0.140625f
+#define c27o64		0.421875f
+#define c1o66		(1.0f/66.0f)
+#define c1o72		(1.0f/72.0f)
+#define c1o264		(1.0f/264.0f)
+#define c8o27		(8.0f/27.0f)
+#define c2o27		(2.0f/27.0f)
+#define c1o54		(1.0f/54.0f)
+#define c1o100		0.01f
+#define c99o100		0.99f
+#define c1o126		(1.0f/126.0f)
+#define c1o216		(1.0f/216.0f)
+#define c5o4		1.25f
+#define c9o4		2.25f
+#define c5o2		2.5f
+#define c9o2		4.5f
+
+#define c0o1		0.f
+#define c1o1		1.f
+#define c2o1		2.f
+#define c3o1		3.f
+#define c4o1		4.f
+#define c5o1		5.f
+#define c6o1		6.f
+#define c7o1		7.f
+#define c8o1		8.f
+#define c9o1		9.f
+#define c10o1 		10.f
+#define c11o1  		11.f
+#define c12o1  		12.f
+#define c13o1		13.f
+#define c14o1		14.f
+#define c15o1		15.f
+#define c16o1 		16.f
+#define c17o1 		17.f
+#define c18o1		18.f
+#define c21o1		21.f
+#define c24o1		24.f
+#define c25o1 		25.f
+#define c26o1		26.f
+#define c27o1		27.f
+#define c28o1		28.f
+#define c29o1		29.f
+#define c30o1  		30.f
+#define c32o1		32.f
+#define c33o1		33.f
+#define c34o1		34.f
+#define c36o1		36.f
+#define c40o1		40.f
+#define c42o1		42.f
+#define c46o1		46.f
+#define c48o1		48.f
+#define c50o1		50.f
+#define c52o1		52.f
+#define c54o1		54.f
+#define c56o1		56.f
+#define c64o1		64.f
+#define c66o1		66.f
+#define c68o1		68.f
+#define c69o1		69.f
+#define c72o1		72.f
+#define c84o1		84.f
+#define c88o1		88.f
+#define c96o1		96.f
+#define c100o1		100.0f
+#define c130o1		130.0f
+#define c152o1		152.0f
+#define c166o1		166.0f
+#define c195o1		195.0f
+#define c216o1		216.0f
+#define c264o1		264.0f
+#define c290o1		290.0f
+#define c367o1		367.0f
+
+#define Op0000002   0.0000002f
+#define c10eM30		1e-30
+#define c10eM10		1e-10
+#define smallSingle 0.0000000002f
+#endif
+
+
+#endif
\ No newline at end of file
diff --git a/src/Core/Timer/Timer.cpp b/src/Core/Timer/Timer.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..e92140e216dd2c03e435c8260604dd605c560de6
--- /dev/null
+++ b/src/Core/Timer/Timer.cpp
@@ -0,0 +1,43 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 Timer.cpp
+//! \ingroup Timer
+//! \author Stephan Lenz
+//=======================================================================================
+#include "Timer.h"
+#include "TimerImp.h"
+
+#include <memory>
+
+SPtr<Timer> Timer::makeStart()
+{
+    SPtr<Timer> t = std::make_shared<TimerImp>();
+    t->start();
+    return t;
+}
diff --git a/src/Core/Timer/Timer.h b/src/Core/Timer/Timer.h
new file mode 100644
index 0000000000000000000000000000000000000000..1197db5de86362332b8e193463e645c896ea820d
--- /dev/null
+++ b/src/Core/Timer/Timer.h
@@ -0,0 +1,55 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 Timer.h
+//! \ingroup Timer
+//! \author Stephan Lenz
+//=======================================================================================
+#ifndef TIMER_H
+#define TIMER_H
+
+#include "VirtualFluidsDefinitions.h"
+
+#include "DataTypes.h"
+#include "PointerDefinitions.h"
+
+class VF_PUBLIC Timer
+{
+public:
+
+    static SPtr<Timer> makeStart();
+
+    virtual void start() = 0;
+    virtual void end() = 0;
+
+    virtual real getTimeInSeconds() const = 0;
+    virtual real getCurrentRuntimeInSeconds() const = 0;
+};
+
+#endif
+
diff --git a/src/Core/Timer/TimerImp.cpp b/src/Core/Timer/TimerImp.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..4032022b419fcc671004671c0fe6d1439e62aa78
--- /dev/null
+++ b/src/Core/Timer/TimerImp.cpp
@@ -0,0 +1,58 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 TimerImp.cpp
+//! \ingroup Timer
+//! \author Stephan Lenz
+//=======================================================================================
+#include "TimerImp.h"
+
+TimerImp::TimerImp()
+{
+    
+}
+
+void TimerImp::start()
+{
+    this->startTime = std::chrono::high_resolution_clock::now();
+}
+
+void TimerImp::end()
+{
+    this->endTime = std::chrono::high_resolution_clock::now();
+}
+
+real TimerImp::getTimeInSeconds() const
+{
+    return std::chrono::duration_cast<std::chrono::microseconds>( endTime - startTime ).count() / 1000000.0;
+}
+
+real TimerImp::getCurrentRuntimeInSeconds() const
+{
+    return std::chrono::duration_cast<std::chrono::microseconds>( std::chrono::high_resolution_clock::now() - startTime ).count() / 1000000.0;
+}
diff --git a/src/Core/Timer/TimerImp.h b/src/Core/Timer/TimerImp.h
new file mode 100644
index 0000000000000000000000000000000000000000..d7cabba4cd458feaec9e78ff6e492c06ebf44234
--- /dev/null
+++ b/src/Core/Timer/TimerImp.h
@@ -0,0 +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 TimerImp.h
+//! \ingroup Timer
+//! \author Stephan Lenz
+//=======================================================================================
+#ifndef TIMER_IMP_H
+#define TIMER_IMP_H
+
+#include "Timer.h"
+
+#include <chrono>
+
+#include "VirtualFluidsDefinitions.h"
+
+#include "DataTypes.h"
+
+
+class VF_PUBLIC TimerImp : public Timer
+{
+public:
+
+    typedef std::chrono::high_resolution_clock::time_point timePoint;
+
+    TimerImp();
+
+    void start() override;
+    void end() override;
+
+    real getTimeInSeconds() const override;
+    real getCurrentRuntimeInSeconds() const override;
+
+private:
+    timePoint startTime;
+    timePoint endTime;
+};
+
+#endif
+
diff --git a/src/Core/Timer/package.include b/src/Core/Timer/package.include
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/src/Core/VectorTypes.cpp b/src/Core/VectorTypes.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..9d077c37464b73e4b1d1cfab1c7e0f3d1772e1df
--- /dev/null
+++ b/src/Core/VectorTypes.cpp
@@ -0,0 +1,51 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 VectorTypes.cpp
+//! \ingroup Core
+//! \author Stephan Lenz
+//=======================================================================================
+#include "VectorTypes.h"
+
+Vec3 operator+( Vec3& left, Vec3& right ){
+    return Vec3( left.x + right.x, 
+                 left.y + right.y, 
+                 left.z + right.z );
+}
+
+Vec3 operator-( Vec3& left, Vec3& right ){
+    return Vec3( left.x - right.x, 
+                 left.y - right.y, 
+                 left.z - right.z );
+}
+
+Vec3 operator*( real scalar, Vec3& vec ){
+    return Vec3( scalar * vec.x, 
+                 scalar * vec.y, 
+                 scalar * vec.z );
+}
diff --git a/src/Core/VectorTypes.h b/src/Core/VectorTypes.h
new file mode 100644
index 0000000000000000000000000000000000000000..d9557ab00ae8245cd157a1e6892a53c4c09dc9d4
--- /dev/null
+++ b/src/Core/VectorTypes.h
@@ -0,0 +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 VectorTypes.h
+//! \ingroup Core
+//! \author Stephan Lenz
+//=======================================================================================
+#ifndef VECTORTYPES_H
+#define VECTORTYPES_H
+
+#ifdef __CUDACC__
+#include <cuda_runtime.h>
+#else
+#define __host__
+#define __device__
+#endif
+
+#include <cmath>
+
+#include "VirtualFluidsDefinitions.h"
+
+#include "DataTypes.h"
+#include "RealConstants.h"
+
+struct VF_PUBLIC Vec3 {
+    real x, y, z; 
+
+    __host__ __device__ Vec3(real x, real y, real z) : x(x), y(y), z(z) {}
+    __host__ __device__ Vec3() : x(c0o1), y(c0o1), z(c0o1) {}
+
+    __host__ __device__ real length() {
+        return std::sqrt( x*x + y*y + z*z );
+    }
+};
+
+VF_PUBLIC Vec3 operator+( Vec3& left, Vec3& right );
+VF_PUBLIC Vec3 operator-( Vec3& left, Vec3& right );
+VF_PUBLIC Vec3 operator*( real scalar, Vec3& vec );
+
+#endif
diff --git a/src/Core/buildInfo.h b/src/Core/buildInfo.h
new file mode 100644
index 0000000000000000000000000000000000000000..e3ab60f02612b57a3cb32b82e2aaecc3d0056adf
--- /dev/null
+++ b/src/Core/buildInfo.h
@@ -0,0 +1,59 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 buildInfo.h
+//! \ingroup Core
+//! \author Soeren Peters
+//=======================================================================================
+#ifndef buildInfo_H
+#define buildInfo_H
+
+#include "VirtualFluidsDefinitions.h"
+
+namespace buildInfo
+{
+    const char * gitCommitHash();
+    const char * gitBranch();
+    const char * buildType();
+    const char * compilerFlags();
+    const char * buildMachine();
+    const char * projectDir();
+    const char * binaryDir();
+}
+
+#define GIT_COMMIT_HASH   buildinfo::gitCommitHash()
+#define GIT_BRANCH        buildinfo::gitBranch()
+#define BUILD_MACHINE     buildinfo::buildMachine()
+#define PROJECT_DIR       buildinfo::projectDir()
+#define BINARY_DIR        buildinfo::binaryDir()
+#define COMPILER_FLAGS    buildinfo::compilerFlags()
+#define BUILD_TYPE        buildinfo::buildType()
+
+
+
+#endif
diff --git a/src/Core/package.include b/src/Core/package.include
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/src/GksGpu/Analyzer/ConvergenceAnalyzer.cpp b/src/GksGpu/Analyzer/ConvergenceAnalyzer.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..053cb7bb3662f0f65034920886cd0539fe4c558e
--- /dev/null
+++ b/src/GksGpu/Analyzer/ConvergenceAnalyzer.cpp
@@ -0,0 +1,166 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 ConvergenceAnalyzer.cpp
+//! \ingroup Analyzer
+//! \author Stephan Lenz
+//=======================================================================================
+#include "ConvergenceAnalyzer.h"
+
+#include <cmath>
+#include <sstream>
+#include <iomanip>
+
+#include "Core/Logger/Logger.h"
+
+#include "DataBase/DataBase.h"
+
+#include "FlowStateData/AccessDeviceData.cuh"
+
+ConvergenceAnalyzer::ConvergenceAnalyzer(SPtr<DataBase> dataBase, uint outputIter, real convergenceThreshold)
+{
+    this->dataBase = dataBase;
+
+    this->outputIter = outputIter;
+
+    this->setConvergenceThreshold( convergenceThreshold );
+
+    this->dataHostOld = dataBase->dataHost;
+    this->dataHostNew = dataBase->dataHost;
+}
+
+void ConvergenceAnalyzer::setConvergenceThreshold(real convergenceThreshold)
+{
+    this->convergenceThreshold.rho  = convergenceThreshold;
+    this->convergenceThreshold.rhoU = convergenceThreshold;
+    this->convergenceThreshold.rhoV = convergenceThreshold;
+    this->convergenceThreshold.rhoW = convergenceThreshold;
+    this->convergenceThreshold.rhoE = convergenceThreshold;
+#ifdef USE_PASSIVE_SCALAR
+    this->convergenceThreshold.rhoS_1 = convergenceThreshold;
+    this->convergenceThreshold.rhoS_2 = convergenceThreshold;
+#endif //USE_PASSIVE_SCALAR
+}
+
+void ConvergenceAnalyzer::setConvergenceThreshold(ConservedVariables convergenceThreshold)
+{
+    this->convergenceThreshold.rho  = convergenceThreshold.rho ;
+    this->convergenceThreshold.rhoU = convergenceThreshold.rhoU;
+    this->convergenceThreshold.rhoV = convergenceThreshold.rhoV;
+    this->convergenceThreshold.rhoW = convergenceThreshold.rhoW;
+    this->convergenceThreshold.rhoE = convergenceThreshold.rhoE;
+#ifdef USE_PASSIVE_SCALAR
+    this->convergenceThreshold.rhoS_1 = convergenceThreshold.rhoS_1;
+    this->convergenceThreshold.rhoS_2 = convergenceThreshold.rhoS_2;
+#endif //USE_PASSIVE_SCALAR
+}
+
+bool ConvergenceAnalyzer::run(uint iter)
+{
+    if( iter % outputIter != 0 ) return false;
+
+    this->dataBase->copyDataDeviceToHost( this->dataHostNew.data() );
+
+    ConservedVariables changeSquareSum, consSquareSum;
+
+    for( uint cellIdx = 0; cellIdx < this->dataBase->numberOfCells; cellIdx++  ){
+
+        ConservedVariables change, cons;
+
+        cons.rho  = this->dataHostNew[ RHO__(cellIdx, dataBase->numberOfCells) ];
+        cons.rhoU = this->dataHostNew[ RHO_U(cellIdx, dataBase->numberOfCells) ];
+        cons.rhoV = this->dataHostNew[ RHO_V(cellIdx, dataBase->numberOfCells) ];
+        cons.rhoW = this->dataHostNew[ RHO_W(cellIdx, dataBase->numberOfCells) ];
+        cons.rhoE = this->dataHostNew[ RHO_E(cellIdx, dataBase->numberOfCells) ];
+
+        change.rho  = cons.rho  - this->dataHostOld[ RHO__(cellIdx, dataBase->numberOfCells) ];
+        change.rhoU = cons.rhoU - this->dataHostOld[ RHO_U(cellIdx, dataBase->numberOfCells) ];
+        change.rhoV = cons.rhoV - this->dataHostOld[ RHO_V(cellIdx, dataBase->numberOfCells) ];
+        change.rhoW = cons.rhoW - this->dataHostOld[ RHO_W(cellIdx, dataBase->numberOfCells) ];
+        change.rhoE = cons.rhoE - this->dataHostOld[ RHO_E(cellIdx, dataBase->numberOfCells) ];
+    
+        changeSquareSum.rho  += change.rho  * change.rho ;
+        changeSquareSum.rhoU += change.rhoU * change.rhoU;
+        changeSquareSum.rhoV += change.rhoV * change.rhoV;
+        changeSquareSum.rhoW += change.rhoW * change.rhoW;
+        changeSquareSum.rhoE += change.rhoE * change.rhoE;
+    
+        consSquareSum.rho  += cons.rho  * cons.rho ;
+        consSquareSum.rhoU += cons.rhoU * cons.rhoU;
+        consSquareSum.rhoV += cons.rhoV * cons.rhoV;
+        consSquareSum.rhoW += cons.rhoW * cons.rhoW;
+        consSquareSum.rhoE += cons.rhoE * cons.rhoE;
+    }
+
+    ConservedVariables L2Change;
+
+    L2Change.rho  = std::sqrt( changeSquareSum.rho  / consSquareSum.rho  );
+    L2Change.rhoU = std::sqrt( changeSquareSum.rhoU / consSquareSum.rhoU );
+    L2Change.rhoV = std::sqrt( changeSquareSum.rhoV / consSquareSum.rhoV );
+    L2Change.rhoW = std::sqrt( changeSquareSum.rhoW / consSquareSum.rhoW );
+    L2Change.rhoE = std::sqrt( changeSquareSum.rhoE / consSquareSum.rhoE );
+
+    this->dataHostOld = this->dataHostNew;
+
+    this->printL2Change( L2Change );
+
+    if( L2Change.rho  < this->convergenceThreshold.rho  &&
+        L2Change.rhoU < this->convergenceThreshold.rhoU &&
+        L2Change.rhoV < this->convergenceThreshold.rhoV &&
+        L2Change.rhoW < this->convergenceThreshold.rhoW &&
+        L2Change.rhoE < this->convergenceThreshold.rhoE )
+    {
+        return true;
+    }
+
+    return false;
+}
+
+void ConvergenceAnalyzer::printL2Change(ConservedVariables L2Change)
+{
+    std::stringstream header;
+    std::stringstream body;
+
+    header << "| ";
+    header << "       rho" << " | "; 
+    header << "      rhoU" << " | "; 
+    header << "      rhoV" << " | "; 
+    header << "      rhoW" << " | "; 
+    header << "      rhoE" << " | ";
+
+    body   << "| ";
+    body   << std::setw(10) << std::setprecision(4) << L2Change.rho  << " | ";
+    body   << std::setw(10) << std::setprecision(4) << L2Change.rhoU << " | ";
+    body   << std::setw(10) << std::setprecision(4) << L2Change.rhoV << " | ";
+    body   << std::setw(10) << std::setprecision(4) << L2Change.rhoW << " | ";
+    body   << std::setw(10) << std::setprecision(4) << L2Change.rhoE << " | ";
+
+    *logging::out << logging::Logger::INFO_HIGH << "Residual L2-Change:" << "\n";
+    *logging::out << logging::Logger::INFO_HIGH << header.str() << "\n";
+    *logging::out << logging::Logger::INFO_HIGH << body.str()   << "\n";
+}
diff --git a/src/GksGpu/Analyzer/ConvergenceAnalyzer.h b/src/GksGpu/Analyzer/ConvergenceAnalyzer.h
new file mode 100644
index 0000000000000000000000000000000000000000..a34316236358fc58c3939442ce235c5eb38940fe
--- /dev/null
+++ b/src/GksGpu/Analyzer/ConvergenceAnalyzer.h
@@ -0,0 +1,88 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 ConvergenceAnalyzer.h
+//! \ingroup Analyzer
+//! \author Stephan Lenz
+//=======================================================================================
+#ifndef  ConvergenceAnalyzer_H
+#define  ConvergenceAnalyzer_H
+
+#include <vector>
+
+#include "VirtualFluidsDefinitions.h"
+
+#include "Core/PointerDefinitions.h"
+#include "Core/DataTypes.h"
+#include "Core/Timer/Timer.h"
+
+#include "FlowStateData/FlowStateData.cuh"
+
+struct DataBase;
+
+//! \brief Analyzes if a simulation is converged and prints the residual change to the logger
+class VF_PUBLIC ConvergenceAnalyzer
+{
+private:
+
+    SPtr<DataBase> dataBase;        //!< shared pointer to the \ref DataBase, which is used to access the simulation data
+    
+    std::vector<real> dataHostOld;  //!< host copy of the old data
+    std::vector<real> dataHostNew;  //!< host copy of the new data
+
+    uint outputIter;                //!< controls analyzer execution based on number of iterations
+    
+    ConservedVariables convergenceThreshold; //!< if the change is below these thresholds, the run() method returns true
+
+public:
+
+    //! \brief constructor
+    //! \param dataBase              shared pointer to a \ref DataBase
+    //! \param outputIter            execution interval
+    //! \param convergenceThreshold  threshold for considering the simulation as converged
+    ConvergenceAnalyzer( SPtr<DataBase> dataBase, uint outputIter = 10000, real convergenceThreshold = 1.0e-6 );
+
+    //! sets the same threshold for all variables
+    void setConvergenceThreshold( real convergenceThreshold );
+
+    //! sets different thresholds for different variables
+    void setConvergenceThreshold( ConservedVariables convergenceThreshold );
+
+    //! executes the analyzer
+    //! \param iter current iteration number, used to decide, whether the analyzer should be executed or not
+    //! \return true if simulation is converged, else false
+    bool run( uint iter );
+
+private:
+
+    //! writes the formatted residual change to the logger
+    //! \param L2Change residual change
+    void printL2Change( ConservedVariables L2Change );
+};
+
+#endif
diff --git a/src/GksGpu/Analyzer/CupsAnalyzer.cpp b/src/GksGpu/Analyzer/CupsAnalyzer.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..18e2c4d83e3ba3461b8caddfc158d2be00be10f8
--- /dev/null
+++ b/src/GksGpu/Analyzer/CupsAnalyzer.cpp
@@ -0,0 +1,158 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 CupsAnalyzer.cpp
+//! \ingroup Analyzer
+//! \author Stephan Lenz
+//=======================================================================================
+#include "CupsAnalyzer.h"
+
+#include <cmath>
+#include <sstream>
+#include <iomanip>
+
+#include "Core/Logger/Logger.h"
+
+#include "VirtualFluidsDefinitions.h"
+
+#include "DataBase/DataBase.h"
+
+CupsAnalyzer::CupsAnalyzer(SPtr<DataBase> dataBase, 
+                           bool outputPerTime, real outputTime, 
+                           bool outputPerIter, uint outputIter)
+    : outputPerTime(outputPerTime),
+      outputTime(outputTime),
+      outputPerIter(outputPerIter),
+      outputIter(outputIter),
+      outputPerTimeCounter(1),
+      counter(0)
+{
+    this->timer        = Timer::makeStart();
+    this->timerRestart = Timer::makeStart();
+
+    this->numberOfCellUpdatesPerTimeStep = 0;
+
+    for( uint level = 0; level < dataBase->numberOfLevels; level++ )
+    {
+        numberOfCellUpdatesPerTimeStep += std::pow( 2, level ) * dataBase->perLevelCount[level].numberOfBulkCells;
+    }
+}
+
+void CupsAnalyzer::start()
+{
+    this->counter = 0;
+    this->timer->start();
+    this->timerRestart->start();
+}
+
+void CupsAnalyzer::restart()
+{
+    this->counter = 0;
+    this->timerRestart->start();
+}
+
+void CupsAnalyzer::run( uint iter, real dt )
+{
+    real currentRuntime             = this->timer->getCurrentRuntimeInSeconds();
+    real currentRuntimeSinceRestart = this->timerRestart->getCurrentRuntimeInSeconds();
+
+    this->counter++;
+
+    if( checkOutputPerTime(currentRuntime) || checkOutputPerIter(iter) )
+    {
+        unsigned long long numberOfCellUpdates = this->numberOfCellUpdatesPerTimeStep * (unsigned long long)counter;
+
+        real CUPS = real(numberOfCellUpdates) / currentRuntimeSinceRestart;
+
+        this->printCups( iter, iter * dt, currentRuntime, CUPS );
+
+        this->restart();
+    }
+
+    if( checkOutputPerTime(currentRuntime) )
+    {
+        outputPerTimeCounter++;
+    }
+}
+
+bool CupsAnalyzer::checkOutputPerTime(real currentRuntime)
+{
+    return outputPerTime && ( ( currentRuntime - outputPerTimeCounter * outputTime ) > 0 );
+}
+
+bool CupsAnalyzer::checkOutputPerIter(uint iter)
+{
+    return outputPerIter && (iter % outputIter == 0);
+}
+
+void CupsAnalyzer::printCups(uint iter, real simTime, real currentRunTime, real cups)
+{
+    std::stringstream header;
+    std::stringstream body;
+
+    header << "| ";
+    header << "           Iter" << " | "; 
+    header << "      sim. time" << " | "; 
+    header << "      wall time" << " | "; 
+    header << "          MCUPS" << " | ";
+
+    body   << "| ";
+    body   << std::setw(15) << std::setprecision(4) << iter                                        << " | ";
+    body   << std::setw(15) << std::setprecision(4) << this->getTimeString(simTime).c_str()        << " | ";
+    body   << std::setw(15) << std::setprecision(4) << this->getTimeString(currentRunTime).c_str() << " | ";
+    body   << std::setw(15) << std::setprecision(4) << cups / 1.0e6                                << " | ";
+
+    *logging::out << logging::Logger::INFO_HIGH << "Performance:" << "\n";
+    *logging::out << logging::Logger::INFO_HIGH << header.str() << "\n";
+    *logging::out << logging::Logger::INFO_HIGH << body.str()   << "\n";
+}
+
+std::string CupsAnalyzer::getTimeString(real time)
+{
+    int seconds = int(time);
+    int minutes = seconds / 60;
+    int hours   = minutes / 60;
+    int days    = hours   / 24;
+
+    int milliseconds = int( 1000.0 * ( time - real(seconds)) );
+
+    hours   -=     days * 24;
+    minutes -=   ( days * 24 + hours ) * 60;
+    seconds -= ( ( days * 24 + hours ) * 60 + minutes ) * 60;
+
+    std::stringstream timeString;
+    timeString << std::setw(2) << std::setfill('0') << days    << ":";
+    timeString << std::setw(2) << std::setfill('0') << hours   << ":";
+    timeString << std::setw(2) << std::setfill('0') << minutes << ":";
+    timeString << std::setw(2) << std::setfill('0') << seconds << ".";
+    timeString << std::setw(3) << std::setfill('0') << milliseconds;
+
+    return timeString.str();
+}
+
+
diff --git a/src/GksGpu/Analyzer/CupsAnalyzer.h b/src/GksGpu/Analyzer/CupsAnalyzer.h
new file mode 100644
index 0000000000000000000000000000000000000000..e69f7045199ad473c75f5b991f2d8d98529322ee
--- /dev/null
+++ b/src/GksGpu/Analyzer/CupsAnalyzer.h
@@ -0,0 +1,110 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 CupsAnalyzer.h
+//! \ingroup Analyzer
+//! \author Stephan Lenz
+//=======================================================================================
+#ifndef  CupsAnalyzer_H
+#define  CupsAnalyzer_H
+
+#include <string>
+
+#include "VirtualFluidsDefinitions.h"
+
+#include "Core/PointerDefinitions.h"
+#include "Core/DataTypes.h"
+#include "Core/Timer/Timer.h"
+
+struct DataBase;
+
+//! \brief Timing analyzer
+//! 
+//! Measures the update rate of the simulation in Cell Updates Per Second (CUPS) and other timing metrics
+class VF_PUBLIC CupsAnalyzer
+{
+private:
+    SPtr<Timer> timer;          //!< Timer for measuring elapse wall clock time
+    SPtr<Timer> timerRestart;   //!< Timer for CUPS calculation
+
+    bool outputPerTime;         //!< enables analyzer execution based on elapsed time in seconds
+
+    bool outputPerIter;         //!< enables analyzer execution based on number of iterations
+
+    real outputTime;            //!< controls analyzer execution based on elapsed time   
+    uint outputPerTimeCounter;  //!< counts how often the analyzer executed based on the elapsed time
+
+    uint outputIter;            //!< controls analyzer execution based on number of iterations
+
+    unsigned long long numberOfCellUpdatesPerTimeStep;  //!< total number of cell updates that has to be performed for a single time step
+
+    uint counter;               //!< counts the number of executions of this analyzer
+
+public:
+
+    //! constructor
+    //! \param dataBase        shared pointer to a \ref DataBase
+    //! \param outputPerTime   flag to enable/disable execution based on elapsed time in seconds
+    //! \param outputTime      time interval after which the analyzer should be executed
+    //! \param outputPerIter   flag to enable/disable execution based on number of iterations
+    //! \param outputIter      number of iterations after which the analyzer should be executed
+    CupsAnalyzer( SPtr<DataBase> dataBase, 
+                  bool outputPerTime = true, real outputTime = 600.0,
+                  bool outputPerIter = true, uint outputIter = 10000 );
+
+    //! starts the timing
+    void start();
+
+    //! restarts the timing only for CUPS calculation
+    void restart();
+
+    //! executes the analyzer
+    //! \param iter   current iteration number
+    //! \param dt     coarse time step used to compute simulation time
+    void run( uint iter, real dt );
+
+private:
+
+    //! \param currentRuntime  amount of elapsed time in seconds
+    //! \return  true if the analyzer should be executed
+    bool checkOutputPerTime( real currentRuntime );
+
+    //! \param iter current iteration number
+    //! \return return true if the analyzer should be executed
+    bool checkOutputPerIter( uint iter );
+
+    //! prints the timing information on the logger
+    void printCups(uint iter, real simTime, real currentRunTime, real cups);
+
+    //! renders the time into a nice string of format dd:hh:mm:ss.ms
+    //! \param time  time in seconds
+    //! \return   time as nice string
+    std::string getTimeString( real time );
+};
+
+#endif
diff --git a/src/GksGpu/Analyzer/package.include b/src/GksGpu/Analyzer/package.include
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/src/GksGpu/BoundaryConditions/BoundaryCondition.cpp b/src/GksGpu/BoundaryConditions/BoundaryCondition.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..d5675d9fb11af07ed3a841863afdd90bc28e3899
--- /dev/null
+++ b/src/GksGpu/BoundaryConditions/BoundaryCondition.cpp
@@ -0,0 +1,157 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 BoundaryCondition.cpp
+//! \ingroup BoundaryCondition
+//! \author Stephan Lenz
+//=======================================================================================
+#include "BoundaryCondition.h"
+
+#include <memory>
+#include <vector>
+
+#include "GridGenerator/grid/NodeValues.h"
+
+#include "GksMeshAdapter/GksMeshAdapter.h"
+
+#include "DataBase/DataBase.h"
+#include "DataBase/DataBaseAllocator.h"
+#include "DataBase/DataBaseStruct.h"
+
+BoundaryCondition::BoundaryCondition( SPtr<DataBase> dataBase )
+    : myAllocator ( dataBase->myAllocator )
+{
+      numberOfCells = INVALID_INDEX;
+      ghostCells    = nullptr;
+      domainCells   = nullptr;
+      secondCells   = nullptr;
+}
+
+BoundaryCondition::~BoundaryCondition()
+{
+    this->myAllocator->freeMemory( *this );
+}
+
+void BoundaryCondition::findBoundaryCells(GksMeshAdapter & adapter, bool allowGhostCells, std::function<bool(Vec3)> boundaryFinder)
+{
+    this->myAllocator->freeMemory( *this );
+
+    std::vector<uint> ghostCells;
+    std::vector<uint> domainCells;
+    std::vector<uint> secondCells;
+
+    numberOfCellsPerLevel.resize( adapter.numberOfLevels );
+    startOfCellsPerLevel.resize ( adapter.numberOfLevels );
+
+    for( auto& n : numberOfCellsPerLevel ) n = 0;
+
+    for( uint level = 0; level < adapter.numberOfLevels; level++ )
+    {
+        uint startIdx = adapter.startOfCellsPerLevel[level] 
+                      + adapter.numberOfBulkCellsPerLevel[level];
+
+        uint endIdx   = adapter.startOfCellsPerLevel[level] 
+                      + adapter.numberOfCellsPerLevel[level];
+
+        for( uint cellIdx = startIdx ; cellIdx < endIdx; cellIdx++ )
+        {
+            MeshCell& cell = adapter.cells[ cellIdx ];
+
+            if( !boundaryFinder( cell.cellCenter ) ) continue;
+
+            if( cell.type != STOPPER_OUT_OF_GRID && cell.type != STOPPER_OUT_OF_GRID_BOUNDARY && cell.type != STOPPER_SOLID ) continue;
+
+            // look in all directions
+            uint maximalSearchDirection = 27;
+
+            // in case of Flux BC look only at face neighbors
+            if( this->isFluxBC() ) maximalSearchDirection = 6;
+
+            for( uint idx = 0; idx < maximalSearchDirection; idx++ )
+            {
+                uint neighborCellIdx = cell.cellToCell[ idx ];
+
+                if( neighborCellIdx == INVALID_INDEX ) continue;
+
+                MeshCell& neighborCell = adapter.cells[ neighborCellIdx ];
+
+                bool neighborCellIsFluid = neighborCell.type != STOPPER_OUT_OF_GRID && 
+                                           neighborCell.type != STOPPER_OUT_OF_GRID_BOUNDARY && 
+                                           neighborCell.type != STOPPER_SOLID;
+
+                bool neighborCellIsValidGhostCell = !this->isFluxBC() && allowGhostCells && !boundaryFinder( neighborCell.cellCenter );
+
+                if( neighborCellIsFluid || neighborCellIsValidGhostCell )
+                {
+                    ghostCells.push_back ( cellIdx );
+                    domainCells.push_back( neighborCellIdx );
+
+                    this->numberOfCellsPerLevel[ level ]++;
+
+                    if( this->secondCellsNeeded() )
+                    {
+                        secondCells.push_back( neighborCell.cellToCell[ idx ] );
+                    }
+
+                    cell.isWall      = this->isWall();
+                    cell.isFluxBC    = this->isFluxBC();
+                    cell.isInsulated = this->isInsulated();
+
+                    break;
+                }
+            }
+        }
+    }
+
+    startOfCellsPerLevel[ 0 ] = 0;
+
+    for( uint level = 1; level < adapter.numberOfLevels; level++ )
+    {
+        startOfCellsPerLevel[ level ] = startOfCellsPerLevel [ level - 1 ]
+                                      + numberOfCellsPerLevel[ level - 1 ];
+    }
+
+    this->numberOfCells = ghostCells.size();
+
+    this->myAllocator->allocateMemory( shared_from_this(), ghostCells, domainCells, secondCells );
+}
+
+bool BoundaryCondition::isFluxBC()
+{
+    return false;
+}
+
+bool BoundaryCondition::isInsulated()
+{
+    return false;
+}
+
+bool BoundaryCondition::secondCellsNeeded()
+{
+    return false;
+}
diff --git a/src/GksGpu/BoundaryConditions/BoundaryCondition.h b/src/GksGpu/BoundaryConditions/BoundaryCondition.h
new file mode 100644
index 0000000000000000000000000000000000000000..b121ddb91fdf7b5b802e74232cd16c926f8dd231
--- /dev/null
+++ b/src/GksGpu/BoundaryConditions/BoundaryCondition.h
@@ -0,0 +1,109 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 BoundaryCondition.h
+//! \ingroup BoundaryCondition
+//! \author Stephan Lenz
+//=======================================================================================
+#ifndef BoundaryCondition_H
+#define BoundaryCondition_H
+
+#include <functional>
+
+#include <memory>
+#include <vector>
+
+#include "VirtualFluidsDefinitions.h"
+
+#include "Core/PointerDefinitions.h"
+#include "Core/DataTypes.h"
+#include "Core/VectorTypes.h"
+
+#include "Parameters/Parameters.h"
+
+class  GksMeshAdapter;
+class  DataBaseAllocator;
+struct DataBase;
+struct BoundaryConditionStruct;
+
+//! Simple struct that carries variables to the boundary condition kernel
+struct BoundaryConditionStruct
+{
+    uint  numberOfCells;    //!< number of boundary cells
+
+    uint* ghostCells;       //!< pointer to device or host memory with ghost cell indices
+    uint* domainCells;      //!< pointer to device or host memory with domain cell indices
+    uint* secondCells;      //!< pointer to device or host memory with second cell indices
+};
+
+//! \brief purely virtual base class from which specific boundary conditions derive
+//! 
+//! It implements basic boundary condition functionality, such as finding boundary cells
+struct VF_PUBLIC BoundaryCondition : virtual public BoundaryConditionStruct, public std::enable_shared_from_this<BoundaryCondition>
+{
+    SPtr<DataBaseAllocator> myAllocator;        //!< shared pointer to an \ref DataBaseAllocator, used for memory management
+
+    std::vector<uint> numberOfCellsPerLevel;    
+    std::vector<uint> startOfCellsPerLevel;     
+
+    //! constructor that initializes pointers
+    //! \param dataBase   shared pointer to a \ref DataBase
+    BoundaryCondition( SPtr<DataBase> dataBase );
+
+    //! destructor that initiates memory deallocation
+    ~BoundaryCondition();
+
+    //! \brief searches for boundary cells and allocates memory
+    //! \param adapter          reference to a <b>GksMeshAdapter</b>, in which the boundary cells are searched
+    //! \param allowGhostCells  when true, ghost cells are allowed as domain cells is they are outside the boundary region
+    //! \param boundaryFinder   a function that defines the boundary region based on the ghost cell center
+    virtual void findBoundaryCells( GksMeshAdapter& adapter, bool allowGhostCells, std::function<bool(Vec3)> boundaryFinder);
+
+    //! \return true if boundary condition is impermeable -> mass flux zero
+    virtual bool isWall() = 0;
+
+    //! \return true if boundary condition applies fluxes
+    virtual bool isFluxBC();
+    
+    //! \return true if boundary condition is insulated -> heat flux zero
+    virtual bool isInsulated();
+
+    //! \return true is second cells need to be searched and stored
+    virtual bool secondCellsNeeded();
+
+    //! executes the boundary condition
+    //! \param dataBase    shared pointer to a \ref DataBase
+    //! \param parameters  \ref Parameters object
+    //! \param level       grid level to which the boundary condition should be applied
+    virtual void runBoundaryConditionKernel( const SPtr<DataBase> dataBase,
+                                             const Parameters parameters, 
+                                             const uint level ) = 0;
+
+};
+
+#endif
diff --git a/src/GksGpu/BoundaryConditions/IsothermalWall.cu b/src/GksGpu/BoundaryConditions/IsothermalWall.cu
new file mode 100644
index 0000000000000000000000000000000000000000..19af07938f80e8cd2d06d4eaadef424749216da8
--- /dev/null
+++ b/src/GksGpu/BoundaryConditions/IsothermalWall.cu
@@ -0,0 +1,189 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 IsothermalWall.cu
+//! \ingroup BoundaryCondition
+//! \author Stephan Lenz
+//=======================================================================================
+#include "IsothermalWall.h"
+
+#define _USE_MATH_DEFINES
+#include <math.h>
+
+#include <cuda.h>
+#include <cuda_runtime.h>
+#include <helper_cuda.h>
+
+#include "Core/PointerDefinitions.h"
+#include "Core/RealConstants.h"
+
+#include "DataBase/DataBase.h"
+#include "DataBase/DataBaseStruct.h"
+
+#include "Definitions/MemoryAccessPattern.h"
+#include "Definitions/PassiveScalar.h"
+
+#include "FlowStateData/FlowStateData.cuh"
+#include "FlowStateData/FlowStateDataConversion.cuh"
+#include "FlowStateData/AccessDeviceData.cuh"
+
+#include "CudaUtility/CudaRunKernel.hpp"
+
+//////////////////////////////////////////////////////////////////////////
+
+__global__                 void boundaryConditionKernel  ( const DataBaseStruct dataBase, 
+                                                           const IsothermalWallStruct boundaryCondition, 
+                                                           const Parameters parameters,
+                                                           const uint startIndex,
+                                                           const uint numberOfEntities );
+
+__host__ __device__ inline void boundaryConditionFunction( const DataBaseStruct& dataBase, 
+                                                           const IsothermalWallStruct& boundaryCondition, 
+                                                           const Parameters& parameters,
+                                                           const uint startIndex,
+                                                           const uint index );
+
+//////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////
+
+void IsothermalWall::runBoundaryConditionKernel(const SPtr<DataBase> dataBase, 
+                                                const Parameters parameters, 
+                                                const uint level)
+{    
+    CudaUtility::CudaGrid grid( this->numberOfCellsPerLevel[ level ], 32 );
+
+    runKernel( boundaryConditionKernel,
+               boundaryConditionFunction,
+               dataBase->getDeviceType(), grid, 
+               dataBase->toStruct(),
+               this->toStruct(),
+               parameters,
+               this->startOfCellsPerLevel[ level ] );
+
+    cudaDeviceSynchronize();
+
+    getLastCudaError("IsothermalWall::runBoundaryConditionKernel( const SPtr<DataBase> dataBase, const Parameters parameters, const uint level )");
+}
+
+//////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////
+
+__global__ void boundaryConditionKernel(const DataBaseStruct dataBase, 
+                                        const IsothermalWallStruct boundaryCondition, 
+                                        const Parameters parameters,
+                                        const uint startIndex,
+                                        const uint numberOfEntities)
+{
+    uint index = blockIdx.x * blockDim.x + threadIdx.x;
+
+    if( index >= numberOfEntities ) return;
+
+    boundaryConditionFunction( dataBase, boundaryCondition, parameters, startIndex, index );
+}
+
+__host__ __device__ inline void boundaryConditionFunction(const DataBaseStruct& dataBase, 
+                                                          const IsothermalWallStruct& boundaryCondition, 
+                                                          const Parameters& parameters,
+                                                          const uint startIndex,
+                                                          const uint index)
+{
+    uint ghostCellIdx  = boundaryCondition.ghostCells [ startIndex + index ];
+    uint domainCellIdx = boundaryCondition.domainCells[ startIndex + index ];
+    uint secondCellIdx = boundaryCondition.secondCells[ startIndex + index ];
+
+    PrimitiveVariables ghostCellPrim;
+    {
+        PrimitiveVariables domainCellPrim;
+        PrimitiveVariables secondCellPrim;
+
+        {
+            ConservedVariables domainCellData;
+            readCellData( domainCellIdx, dataBase, domainCellData );
+            domainCellPrim = toPrimitiveVariables( domainCellData, parameters.K );
+
+            ConservedVariables secondCellData;
+            if( secondCellIdx != INVALID_INDEX ){
+                readCellData( secondCellIdx, dataBase, secondCellData );
+                secondCellPrim = toPrimitiveVariables( secondCellData, parameters.K );
+            }
+        }
+
+        ghostCellPrim.U      = c2o1 * boundaryCondition.velocity.x - domainCellPrim.U;
+        ghostCellPrim.V      = c2o1 * boundaryCondition.velocity.y - domainCellPrim.V;
+        ghostCellPrim.W      = c2o1 * boundaryCondition.velocity.z - domainCellPrim.W;
+        ghostCellPrim.lambda = c2o1 * boundaryCondition.lambda     - domainCellPrim.lambda;
+    #ifdef USE_PASSIVE_SCALAR
+        ghostCellPrim.S_1    = /*two * boundaryCondition.S_1 -*/ domainCellPrim.S_1;
+        ghostCellPrim.S_2    = /*two * boundaryCondition.S_2 -*/ domainCellPrim.S_2;
+    #endif // USE_PASSIVE_SCALAR
+
+
+        if( boundaryCondition.useSecondCells && secondCellIdx != INVALID_INDEX ){
+            // linear extrapolation
+            real p1 = c1o2 * domainCellPrim.rho / domainCellPrim.lambda;
+            real p2 = c1o2 * secondCellPrim.rho / secondCellPrim.lambda;
+
+            ghostCellPrim.rho = c2o1 * ( c2o1 * p1 - p2 ) * ghostCellPrim.lambda;
+        }
+        else{
+            // constant extrapolation
+            real p = c1o2 * domainCellPrim.rho / domainCellPrim.lambda;
+
+            ghostCellPrim.rho = c2o1 * p * ghostCellPrim.lambda;
+        }
+    }
+
+    {
+        ConservedVariables ghostCons = toConservedVariables( ghostCellPrim, parameters.K );
+
+        writeCellData( ghostCellIdx, dataBase, ghostCons );
+    }
+}
+
+IsothermalWall::IsothermalWall(SPtr<DataBase> dataBase, Vec3 velocity, real lambda, bool useSecondCells, real S_1, real S_2)
+    : BoundaryCondition( dataBase )
+{
+    this->velocity       = velocity;
+    this->lambda         = lambda;
+    this->S_1            = S_1;
+    this->S_2            = S_2;
+    this->useSecondCells = useSecondCells;
+}
+
+bool IsothermalWall::isWall()
+{
+    return true;
+}
+
+bool IsothermalWall::secondCellsNeeded()
+{
+    return true;
+}
+
diff --git a/src/GksGpu/BoundaryConditions/IsothermalWall.h b/src/GksGpu/BoundaryConditions/IsothermalWall.h
new file mode 100644
index 0000000000000000000000000000000000000000..5d142a8b976176648ef037e2a0ffdb584b05a5a1
--- /dev/null
+++ b/src/GksGpu/BoundaryConditions/IsothermalWall.h
@@ -0,0 +1,118 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 IsothermalWall.h
+//! \ingroup BoundaryCondition
+//! \author Stephan Lenz
+//=======================================================================================
+#ifndef IsothermalWall_CUH
+#define IsothermalWall_CUH
+
+#include <memory>
+
+#include "VirtualFluidsDefinitions.h"
+
+#include "Core/PointerDefinitions.h"
+#include "Core/DataTypes.h"
+#include "Core/VectorTypes.h"
+
+#include "BoundaryConditions/BoundaryCondition.h"
+
+//! Simple struct that carries variables to the boundary condition kernel
+struct IsothermalWallStruct
+{
+    uint  numberOfCells;    //!< number of boundary cells
+                            
+    uint* ghostCells;       //!< pointer to device or host memory with ghost cell indices
+    uint* domainCells;      //!< pointer to device or host memory with domain cell indices
+    uint* secondCells;      //!< pointer to device or host memory with second cell indices
+
+    Vec3 velocity;          //!< wall velocity
+    real lambda;            //!< wall temperature in terms of lambda
+    real S_1;               //!< wall value for passive scalar
+    real S_2;               //!< wall value for passive scalar
+
+    bool useSecondCells;    //!< true if linear pressure extrapolation should be used
+};
+
+//! Models a wall that is kept at a constant temperature
+struct VF_PUBLIC IsothermalWall : public BoundaryCondition //, public IsothermalWallStruct
+{
+    Vec3 velocity;          //!< wall velocity
+    real lambda;            //!< wall temperature in terms of lambda
+    real S_1;               //!< wall value for passive scalar
+    real S_2;               //!< wall value for passive scalar
+
+    bool useSecondCells;    //!< true if linear pressure extrapolation should be used
+
+    //! constructor
+    //! \param dataBase        shared pointer to a \ref DataBase
+    //! \param velocity        wall velocity
+    //! \param lambda          wall temperature in terms of lambda
+    //! \param useSecondCells  true if linear pressure extrapolation should be used
+    //! \param S_1             wall value for passive scalar
+    //! \param S_2             wall value for passive scalar
+    IsothermalWall( SPtr<DataBase> dataBase, Vec3 velocity, real lambda, bool useSecondCells, real S_1 = 0.0, real S_2 = 0.0 );
+
+    //! \return true
+    virtual bool isWall() override;
+    
+    //! \return true
+    virtual bool secondCellsNeeded() override;
+
+    //! executes the boundary condition
+    //! \param dataBase    shared pointer to a \ref DataBase
+    //! \param parameters  \ref Parameters object
+    //! \param level       grid level to which the boundary condition should be applied
+    virtual void runBoundaryConditionKernel(const SPtr<DataBase> dataBase,
+                                            const Parameters parameters, 
+                                            const uint level) override;
+
+    // \return struct with variables for boundary condition kernel
+    IsothermalWallStruct toStruct()
+    {
+        IsothermalWallStruct boundaryCondition;
+
+        boundaryCondition.numberOfCells = this->numberOfCells;
+
+        boundaryCondition.ghostCells      = this->ghostCells;
+        boundaryCondition.domainCells     = this->domainCells;
+        boundaryCondition.secondCells     = this->secondCells;
+
+        boundaryCondition.velocity        = this->velocity;
+        boundaryCondition.lambda          = this->lambda;
+        boundaryCondition.S_1             = this->S_1;
+        boundaryCondition.S_2             = this->S_2;
+
+        boundaryCondition.useSecondCells  = this->useSecondCells;
+
+        return boundaryCondition;
+    }
+};
+
+#endif
diff --git a/src/GksGpu/BoundaryConditions/package.include b/src/GksGpu/BoundaryConditions/package.include
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/src/GksGpu/CellProperties/CellProperties.cuh b/src/GksGpu/CellProperties/CellProperties.cuh
new file mode 100644
index 0000000000000000000000000000000000000000..03b0f4d1473648b3d32dd6e9c92472f640f9508a
--- /dev/null
+++ b/src/GksGpu/CellProperties/CellProperties.cuh
@@ -0,0 +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 CellProperties.cuh
+//! \ingroup CellProperties
+//! \author Stephan Lenz
+//=======================================================================================
+#ifndef CellProperties_H
+#define CellProperties_H
+
+#ifdef __CUDACC__
+#include <cuda_runtime.h>
+#else
+#define __host__
+#define __device__
+#endif
+
+//////////////////////////////////////////////////////////////////////////
+
+#define CELL_PROPERTIES_DEFAULT        (0u)
+#define CELL_PROPERTIES_GHOST          (1u)
+#define CELL_PROPERTIES_WALL           (2u)
+#define CELL_PROPERTIES_FINE_GHOST     (4u)
+#define CELL_PROPERTIES_IS_FLUX_BC     (8u)
+#define CELL_PROPERTIES_IS_INSULATED   (16u)
+#define CELL_PROPERTIES_5              (32u)
+#define CELL_PROPERTIES_6              (64u)
+#define CELL_PROPERTIES_7              (128u)
+
+//////////////////////////////////////////////////////////////////////////
+
+//! stores several cell properties as bitmap
+typedef unsigned char CellProperties;
+
+//////////////////////////////////////////////////////////////////////////
+
+//! sets a cell property
+//! \param left   \ref CellProperties object in which the property should be set
+//! \param right  cell property that should be set, usually one of the above preprocessor defines
+__host__ __device__ inline void setCellProperties( CellProperties& left, const CellProperties& right )
+{
+    left |= right;
+}
+
+//! unsets a cell property
+//! \param left   \ref CellProperties object in which the property should be unset
+//! \param right  cell property that should be unset, usually one of the above preprocessor defines
+__host__ __device__ inline void unsetCellProperties( CellProperties& left, const CellProperties& right )
+{
+    left &= ~right;
+}
+
+//! queries a specific cell property
+//! \param left   \ref CellProperties object in which the property should be queried
+//! \param right  cell property that should be queried, usually one of the above preprocessor defines
+//! \return true if the cell property is set and false otherwise
+__host__ __device__ inline bool isCellProperties( const CellProperties& left, const CellProperties& right )
+{
+    return (left & right) == right;
+}
+
+//////////////////////////////////////////////////////////////////////////
+
+#endif
+
diff --git a/src/GksGpu/CellProperties/package.include b/src/GksGpu/CellProperties/package.include
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/src/GksGpu/CellUpdate/CellUpdate.cu b/src/GksGpu/CellUpdate/CellUpdate.cu
new file mode 100644
index 0000000000000000000000000000000000000000..40cf2d737799008fa02de88e7d70d5961c2a5172
--- /dev/null
+++ b/src/GksGpu/CellUpdate/CellUpdate.cu
@@ -0,0 +1,174 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 CellUpdate.cu
+//! \ingroup CellUpdate
+//! \author Stephan Lenz
+//=======================================================================================
+#include "CellUpdate.h"
+
+#include <cuda.h>
+#include <cuda_runtime.h>
+#include <helper_cuda.h>
+#include <math.h>
+
+#include "Core/PointerDefinitions.h"
+#include "Core/RealConstants.h"
+
+#include "DataBase/DataBaseStruct.h"
+
+#include "Definitions/MemoryAccessPattern.h"
+#include "Definitions/PassiveScalar.h"
+
+#include "FlowStateData/FlowStateData.cuh"
+#include "FlowStateData/FlowStateDataConversion.cuh"
+#include "FlowStateData/AccessDeviceData.cuh"
+
+#include "CudaUtility/CudaRunKernel.hpp"
+
+//! \brief This is a CUDA Kernel that computes the cell index and calls \ref cellUpdateFunction for this index
+__global__                 void cellUpdateKernel  ( DataBaseStruct dataBase, Parameters parameters, uint startIndex, uint numberOfEntities );
+
+__host__ __device__ inline void cellUpdateFunction( DataBaseStruct dataBase, Parameters parameters, uint startIndex, uint index );
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void CellUpdate::run( SPtr<DataBase> dataBase, Parameters parameters, uint level )
+{
+    CudaUtility::CudaGrid grid( dataBase->perLevelCount[ level ].numberOfBulkCells, 32 );
+
+    runKernel( cellUpdateKernel,
+               cellUpdateFunction,
+               dataBase->getDeviceType(), grid, 
+               dataBase->toStruct(),
+               parameters,
+               dataBase->perLevelCount[ level ].startOfCells );
+    
+    cudaDeviceSynchronize();
+
+    getLastCudaError("CellUpdate::run( SPtr<DataBase> dataBase, Parameters parameters, uint level )");
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+__global__ void cellUpdateKernel(DataBaseStruct dataBase, Parameters parameters, uint startIndex, uint numberOfEntities)
+{
+    uint index = blockIdx.x * blockDim.x + threadIdx.x;
+
+    if( index >= numberOfEntities ) return;
+    
+    cellUpdateFunction( dataBase, parameters, startIndex, index );
+}
+
+__host__ __device__ inline void cellUpdateFunction(DataBaseStruct dataBase, Parameters parameters, uint startIndex, uint index)
+{
+    uint cellIndex = startIndex + index;
+
+    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+    real cellVolume = parameters.dx * parameters.dx * parameters.dx;
+
+    ConservedVariables cons;
+
+    readCellData      (cellIndex, dataBase, cons);
+
+    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+    {
+        ConservedVariables update, zeroCons;
+        readCellDataUpdate(cellIndex, dataBase, update);
+        writeCellDataUpdate(cellIndex, dataBase, zeroCons);
+
+        //////////////////////////////////////////////////////////////////////////
+
+        cons = cons + (c1o1 / cellVolume) * update;
+        
+        //////////////////////////////////////////////////////////////////////////
+
+        // check if simulation crashed
+        if( isnan(cons.rho ) ||
+            isnan(cons.rhoU) ||
+            isnan(cons.rhoV) ||
+            isnan(cons.rhoW) ||
+            isnan(cons.rhoE) )
+        {
+            *dataBase.crashCellIndex = cellIndex;
+        }
+    }
+
+    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+    if(parameters.forcingSchemeIdx == 0)
+    {
+        // consistent source term treatment of Tian et al. (2007)
+        cons.rhoU += parameters.force.x * parameters.dt * cons.rho;
+        cons.rhoV += parameters.force.y * parameters.dt * cons.rho;
+        cons.rhoW += parameters.force.z * parameters.dt * cons.rho;
+        cons.rhoE += parameters.force.x * dataBase.massFlux[VEC_X(cellIndex, dataBase.numberOfCells)] / (c6o1 * parameters.dx * parameters.dx)
+                   + parameters.force.y * dataBase.massFlux[VEC_Y(cellIndex, dataBase.numberOfCells)] / (c6o1 * parameters.dx * parameters.dx)
+                   + parameters.force.z * dataBase.massFlux[VEC_Z(cellIndex, dataBase.numberOfCells)] / (c6o1 * parameters.dx * parameters.dx);
+
+        dataBase.massFlux[VEC_X(cellIndex, dataBase.numberOfCells)] = c0o1;
+        dataBase.massFlux[VEC_Y(cellIndex, dataBase.numberOfCells)] = c0o1;
+        dataBase.massFlux[VEC_Z(cellIndex, dataBase.numberOfCells)] = c0o1;
+    }
+
+    if(parameters.forcingSchemeIdx == 1)
+    {
+        // forcing only on density variation
+        cons.rhoU += parameters.force.x * parameters.dt * ( cons.rho - parameters.rhoRef );
+        cons.rhoV += parameters.force.y * parameters.dt * ( cons.rho - parameters.rhoRef );
+        cons.rhoW += parameters.force.z * parameters.dt * ( cons.rho - parameters.rhoRef );
+        cons.rhoE += parameters.force.x * dataBase.massFlux[VEC_X(cellIndex, dataBase.numberOfCells)] / (c6o1 * parameters.dx * parameters.dx)
+                   + parameters.force.y * dataBase.massFlux[VEC_Y(cellIndex, dataBase.numberOfCells)] / (c6o1 * parameters.dx * parameters.dx)
+                   + parameters.force.z * dataBase.massFlux[VEC_Z(cellIndex, dataBase.numberOfCells)] / (c6o1 * parameters.dx * parameters.dx);
+
+        dataBase.massFlux[VEC_X(cellIndex, dataBase.numberOfCells)] = c0o1;
+        dataBase.massFlux[VEC_Y(cellIndex, dataBase.numberOfCells)] = c0o1;
+        dataBase.massFlux[VEC_Z(cellIndex, dataBase.numberOfCells)] = c0o1;
+    }
+
+    if(parameters.forcingSchemeIdx == 2)
+    {
+        PrimitiveVariables prim = toPrimitiveVariables(cons, parameters.K);
+        real lambda = prim.lambda;
+
+        // forcing only on density variation
+        cons.rhoU += parameters.force.x * parameters.dt * ( cons.rho - parameters.rhoRef );
+        cons.rhoV += parameters.force.y * parameters.dt * ( cons.rho - parameters.rhoRef );
+        cons.rhoW += parameters.force.z * parameters.dt * ( cons.rho - parameters.rhoRef );
+
+        prim = toPrimitiveVariables(cons, parameters.K);
+        prim.lambda = lambda;
+        cons = toConservedVariables(prim, parameters.K);
+    }
+
+    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+    writeCellData(cellIndex, dataBase, cons);
+}
diff --git a/src/GksGpu/CellUpdate/CellUpdate.h b/src/GksGpu/CellUpdate/CellUpdate.h
new file mode 100644
index 0000000000000000000000000000000000000000..c16b40590d8ff29017c1221ca99f33113d8a369a
--- /dev/null
+++ b/src/GksGpu/CellUpdate/CellUpdate.h
@@ -0,0 +1,66 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 CellUpdate.h
+//! \ingroup CellUpdate
+//! \author Stephan Lenz
+//=======================================================================================
+#ifndef  CellUpdate_H
+#define  CellUpdate_H
+
+#include "VirtualFluidsDefinitions.h"
+
+#include "Core/PointerDefinitions.h"
+#include "Core/DataTypes.h"
+
+#include "DataBase/DataBase.h"
+#include "Parameters/Parameters.h"
+
+//! \brief Performs the cell update at the end of a time step
+//! 
+//! This includes adding the fluxes and the source that are caused by volume forces.
+//! Further, it checks if the simulation crashed and stores the cell index of the crashed cell.
+class VF_PUBLIC CellUpdate
+{
+public:
+
+    //! \brief executes the cell update
+    //!
+    //! This function is only the entry point of the cell update. The execution is 
+    //! given to CPU or GPU based on the type of DataBaseAllocator by the \ref runKernel
+    //! function which calls the \ref cellUpdateFunction. 
+    //!
+    //! \param dataBase    shared pointer to a \ref DataBase
+    //! \param parameters  \ref Parameters object
+    //! \param level       grid level to which the cell update should be applied
+    static void run( SPtr<DataBase> dataBase, 
+                     Parameters parameters, 
+                     uint level );
+};
+
+#endif
diff --git a/src/GksGpu/CellUpdate/package.include b/src/GksGpu/CellUpdate/package.include
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/src/GksGpu/CudaUtility/CudaRunKernel.hpp b/src/GksGpu/CudaUtility/CudaRunKernel.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..545cd4114b74250adba3ce9a99bce96ff4d35c6f
--- /dev/null
+++ b/src/GksGpu/CudaUtility/CudaRunKernel.hpp
@@ -0,0 +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 CudaRunKernel.hpp
+//! \ingroup CudaUtility
+//! \author Stephan Lenz
+//=======================================================================================
+#ifndef  CudaRunKernel_HPP
+#define  CudaRunKernel_HPP
+
+#include <string>
+#include <device_launch_parameters.h>
+#include <omp.h>
+
+#include "CudaUtility/CudaUtility.h"
+
+template<typename KernelFunctor, typename FunctionFunctor, typename... TArgs>
+void runKernel(KernelFunctor kernel, FunctionFunctor function, std::string deviceType, const CudaUtility::CudaGrid& grid, TArgs... args)
+{
+    if( grid.numberOfEntities == 0 ) return;
+
+    if( deviceType == "GPU" )
+    {
+        kernel<<< grid.blocks, grid.threads, 0, grid.stream >>>( args..., grid.numberOfEntities );
+    }
+    else
+    {
+#pragma omp parallel for
+        for( int index = 0; index < grid.numberOfEntities; index++ )
+        {
+            function( args..., index );
+        }
+    }
+}
+
+#endif
diff --git a/src/GksGpu/CudaUtility/CudaUtility.cpp b/src/GksGpu/CudaUtility/CudaUtility.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..b4d0cac611355f244a68a8b4c798d0f7ace8b812
--- /dev/null
+++ b/src/GksGpu/CudaUtility/CudaUtility.cpp
@@ -0,0 +1,124 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 CudaUtility.cpp
+//! \ingroup CudaUtility
+//! \author Stephan Lenz
+//=======================================================================================
+#include "CudaUtility.h"
+
+#include <iostream>
+#include <cuda_runtime.h>
+#include <cuda.h>
+#include <helper_cuda.h>
+
+#include "Core/DataTypes.h"
+#include "Core/Logger/Logger.h"
+
+cudaStream_t CudaUtility::computeStream = nullptr;
+cudaStream_t CudaUtility::communicationStream = nullptr;
+
+CudaUtility::CudaGrid::CudaGrid( uint numberOfEntities, uint threadsPerBlock, cudaStream_t stream )
+{
+    this->numberOfEntities = numberOfEntities;
+    this->threads.x = threadsPerBlock;
+    this->blocks.x  = ( numberOfEntities + threadsPerBlock - 1 ) / threadsPerBlock;
+
+    this->stream = stream;
+}
+
+void CudaUtility::printCudaMemoryUsage()
+{
+    size_t free_byte ;
+    size_t total_byte ;
+
+    checkCudaErrors( cudaMemGetInfo( &free_byte, &total_byte ) );
+
+    double free_db = (double)free_byte ;
+    double total_db = (double)total_byte ;
+    double used_db = total_db - free_db ;
+
+    *logging::out << logging::Logger::INFO_HIGH << "GPU memory usage:" << "\n";
+    *logging::out << logging::Logger::INFO_HIGH << "    used  = " << used_db /1024.0/1024.0/1024.0 << " GB\n";
+    *logging::out << logging::Logger::INFO_HIGH << "    free  = " << free_db /1024.0/1024.0/1024.0 << " GB\n";
+    *logging::out << logging::Logger::INFO_HIGH << "    total = " << total_db/1024.0/1024.0/1024.0 << " GB\n";
+}
+
+int CudaUtility::getCudaDeviceCount()
+{    
+    int deviceCount = 0;
+    checkCudaErrors( cudaGetDeviceCount(&deviceCount) );
+    return deviceCount;
+}
+
+void CudaUtility::setCudaDevice(int device)
+{    
+    checkCudaErrors( cudaSetDevice( device ) );
+    checkCudaErrors( cudaGetDevice( &device ) );
+
+    cudaDeviceProp prop;
+    cudaGetDeviceProperties(&prop, device);
+
+    *logging::out << logging::Logger::INFO_HIGH << "Set device " << device << ": " << prop.name << "\n";
+
+    // set communication stream on high priority, such that it can interleave the compute stream
+    // the non blocking flag disable implicit synchronization with the default thread '0'
+    // based on https://fenix.tecnico.ulisboa.pt/downloadFile/563568428758047/CUDA_StreamsEvents.pdf
+    // slide 5
+    int priority_high, priority_low;
+    cudaDeviceGetStreamPriorityRange(&priority_low , &priority_high ) ;
+
+    // the flag needs to be cudaStreamDefault to ensure synchronization with default stream
+    //cudaStreamCreateWithPriority (&communicationStream, cudaStreamDefault, priority_high );
+    //cudaStreamCreateWithPriority (&computeStream      , cudaStreamDefault, priority_low  );
+    cudaStreamCreateWithPriority (&communicationStream, cudaStreamNonBlocking, priority_high );
+    cudaStreamCreateWithPriority (&computeStream      , cudaStreamNonBlocking, priority_low  );
+}
+
+int CudaUtility::getCudaDevice()
+{
+    int device;
+    checkCudaErrors( cudaGetDevice( &device ) );
+
+    cudaDeviceProp prop;
+    cudaGetDeviceProperties(&prop, device);
+
+    *logging::out << logging::Logger::INFO_HIGH << "The current device " << device << ": " << prop.name << "\n";
+
+    return device;
+}
+
+void CudaUtility::synchronizeCudaDevice()
+{
+    checkCudaErrors( cudaDeviceSynchronize() );
+}
+
+void CudaUtility::synchronizeCudaStream(cudaStream_t stream)
+{
+    checkCudaErrors( cudaStreamSynchronize(stream) );
+}
diff --git a/src/GksGpu/CudaUtility/CudaUtility.h b/src/GksGpu/CudaUtility/CudaUtility.h
new file mode 100644
index 0000000000000000000000000000000000000000..58faf6101ee207e83915b94be6c96658fce14ca8
--- /dev/null
+++ b/src/GksGpu/CudaUtility/CudaUtility.h
@@ -0,0 +1,84 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 CudaUtility.h
+//! \ingroup CudaUtility
+//! \author Stephan Lenz
+//=======================================================================================
+#ifndef  CudaUtilExtern_H
+#define  CudaUtilExtern_H
+
+#include <cuda.h>
+#include <cuda_runtime.h>
+
+#include "VirtualFluidsDefinitions.h"
+
+#include "Core/DataTypes.h"
+
+//! \brief comprises some utility functions and classes for CUDA
+class VF_PUBLIC CudaUtility
+{
+public:
+
+    //! \brief collects CUDA launch parameters for the runKernel Function
+    struct CudaGrid 
+    {
+        dim3 threads;           //!< number of threads per block
+        dim3 blocks;            //!< number of blocks
+
+        uint numberOfEntities;  //!< total number of entities, smaller or equal threads * blocks
+
+        cudaStream_t stream;    //!< CUDA stream
+
+        CudaGrid( uint numberOfEntities, uint threadsPerBlock, cudaStream_t stream = 0 );
+    };
+
+    static cudaStream_t computeStream;          //!< Stream for compute tasks
+    static cudaStream_t communicationStream;    //!< Stream for communication tasks, if communication hiding is enabled
+
+    //! prints the used device memory to the logger
+    static void printCudaMemoryUsage();
+
+    // \return number of devices on the present machine
+    static int getCudaDeviceCount();
+
+    // \param device index of device that should be used
+    static void setCudaDevice( int device );
+
+    // \return current device index
+    static int getCudaDevice(  );
+
+    // encapsulated cudaDeviceSynchronize
+    static void synchronizeCudaDevice();
+
+    // encapsulates cudaStreamSynchronize
+    // \param stream stream to be synchronized
+    static void synchronizeCudaStream( cudaStream_t stream );
+};
+
+#endif
diff --git a/src/GksGpu/CudaUtility/package.include b/src/GksGpu/CudaUtility/package.include
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/src/GksGpu/DataBase/DataBase.cpp b/src/GksGpu/DataBase/DataBase.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..080a554ef0d1565f23114e65c3c76e951010f182
--- /dev/null
+++ b/src/GksGpu/DataBase/DataBase.cpp
@@ -0,0 +1,211 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 DataBase.cpp
+//! \ingroup DataBase
+//! \author Stephan Lenz
+//=======================================================================================
+#include "DataBase.h"
+
+#include <iostream>
+#include <string>
+#include <cuda.h>
+#include <cuda_runtime.h>
+#include <helper_cuda.h>
+
+#include "DataBaseAllocator.h"
+#include "DataBaseStruct.h"
+
+#include "GksMeshAdapter/GksMeshAdapter.h"
+
+DataBase::DataBase( std::string type ) 
+        : myAllocator    ( DataBaseAllocator::create( type ) ),
+          numberOfNodes      (0),
+          numberOfCells      (0),
+          numberOfFaces      (0),
+          numberOfLevels     (0),
+          cellToCell     (nullptr),
+          faceToCell     (nullptr),
+          parentCell     (nullptr),
+          faceCenter     (nullptr),
+          cellCenter     (nullptr),
+          cellProperties (nullptr),
+          faceOrientation(nullptr),
+          data           (nullptr),
+          dataUpdate     (nullptr),
+          massFlux       (nullptr),
+          diffusivity      (nullptr)
+{
+}
+
+DataBase::~DataBase()
+{
+    this->myAllocator->freeMemory( *this );
+}
+
+void DataBase::setMesh(GksMeshAdapter & adapter)
+{
+    this->numberOfNodes      = adapter.nodes.size();
+
+    this->numberOfCells      = adapter.cells.size();
+
+    this->numberOfFaces      = adapter.faces.size();
+
+    this->numberOfLevels     = adapter.numberOfLevels;
+
+    this->perLevelCount.resize( this->numberOfLevels );
+
+    for( uint level = 0; level < this->numberOfLevels; level++ )
+    {
+        perLevelCount[ level ].numberOfCells = adapter.numberOfCellsPerLevel[ level ];
+        perLevelCount[ level ].startOfCells  = adapter.startOfCellsPerLevel [ level ];
+
+        perLevelCount[ level ].numberOfBulkCells = adapter.numberOfBulkCellsPerLevel[ level ];
+
+        perLevelCount[ level ].numberOfFacesX = adapter.numberOfFacesPerLevelXYZ[ 3 * level     ];
+        perLevelCount[ level ].startOfFacesX  = adapter.startOfFacesPerLevelXYZ [ 3 * level     ];
+
+        perLevelCount[ level ].numberOfFacesY = adapter.numberOfFacesPerLevelXYZ[ 3 * level + 1 ];
+        perLevelCount[ level ].startOfFacesY  = adapter.startOfFacesPerLevelXYZ [ 3 * level + 1 ];
+
+        perLevelCount[ level ].numberOfFacesZ = adapter.numberOfFacesPerLevelXYZ[ 3 * level + 2 ];
+        perLevelCount[ level ].startOfFacesZ  = adapter.startOfFacesPerLevelXYZ [ 3 * level + 2 ];
+
+        perLevelCount[ level ].numberOfFaces = perLevelCount[ level ].numberOfFacesX
+                                             + perLevelCount[ level ].numberOfFacesY
+                                             + perLevelCount[ level ].numberOfFacesZ;
+
+        perLevelCount[ level ].numberOfInnerFaces = adapter.numberOfInnerFacesPerLevel[ level ];
+    }
+
+    this->myAllocator->allocateMemory( shared_from_this() );
+
+    this->myAllocator->copyMesh( shared_from_this(), adapter );
+}
+
+void DataBase::copyDataHostToDevice()
+{
+    this->myAllocator->copyDataHostToDevice( shared_from_this() );
+}
+
+void DataBase::copyDataDeviceToHost()
+{
+    this->myAllocator->copyDataDeviceToHost( shared_from_this(), this->dataHost.data() );
+}
+
+void DataBase::copyDataDeviceToHost( real* dataHost )
+{
+    this->myAllocator->copyDataDeviceToHost( shared_from_this(), dataHost );
+}
+
+int DataBase::getCrashCellIndex()
+{
+    return this->myAllocator->getCrashCellIndex(shared_from_this());
+}
+
+DataBaseStruct DataBase::toStruct()
+{
+    DataBaseStruct dataBase;
+
+    dataBase.numberOfCells            = this->numberOfCells;
+    dataBase.numberOfFaces            = this->numberOfFaces;
+
+    dataBase.cellToCell               = this->cellToCell;
+    dataBase.faceToCell               = this->faceToCell;
+
+    dataBase.parentCell               = this->parentCell;
+
+    dataBase.faceCenter               = this->faceCenter;
+    dataBase.cellCenter               = this->cellCenter;
+
+    dataBase.cellProperties           = this->cellProperties;
+
+    dataBase.faceOrientation          = this->faceOrientation;
+
+    dataBase.data                     = this->data;
+    dataBase.dataUpdate               = this->dataUpdate;
+
+    dataBase.massFlux                 = this->massFlux;
+
+    dataBase.diffusivity              = this->diffusivity;
+
+    dataBase.crashCellIndex           = this->crashCellIndex;
+
+    return dataBase;
+}
+
+uint DataBase::getCellLevel(uint cellIdx)
+{
+    uint level = 0;
+
+    while( cellIdx >= this->perLevelCount[level].startOfCells
+                   + this->perLevelCount[level].numberOfCells ) level++;
+
+    return level;
+}
+
+uint DataBase::getFaceLevel(uint faceIdx)
+{
+    uint level = 0;
+
+    while( faceIdx >= this->perLevelCount[level].startOfFacesX
+                   + this->perLevelCount[level].numberOfFaces ) level++;
+
+    return level;
+}
+
+Vec3 DataBase::getCellCenter(uint cellIdx)
+{
+    Vec3 cellCenter;
+
+    for( uint node = 0; node < 8; node++ )
+    {
+        cellCenter = cellCenter + this->nodeCoordinates[ this->cellToNode[ cellIdx ][ node ] ];
+    }
+
+    cellCenter.x /= c8o1;
+    cellCenter.y /= c8o1;
+    cellCenter.z /= c8o1;
+
+    return cellCenter;
+}
+
+bool DataBase::isGhostCell(uint cellIdx)
+{
+    uint level = this->getCellLevel( cellIdx );
+
+    return ( cellIdx >= this->perLevelCount[ level ].startOfCells + this->perLevelCount[ level ].numberOfBulkCells )
+           ||
+           ( isCellProperties( this->cellPropertiesHost[cellIdx], CELL_PROPERTIES_FINE_GHOST ) );
+
+}
+
+std::string DataBase::getDeviceType()
+{
+    return this->myAllocator->getDeviceType();
+}
diff --git a/src/GksGpu/DataBase/DataBase.h b/src/GksGpu/DataBase/DataBase.h
new file mode 100644
index 0000000000000000000000000000000000000000..72c714b6570015fd6bf366bfa25d1b38687e5af3
--- /dev/null
+++ b/src/GksGpu/DataBase/DataBase.h
@@ -0,0 +1,212 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 DataBase.h
+//! \ingroup DataBase
+//! \author Stephan Lenz
+//=======================================================================================
+#ifndef DataBase_H
+#define DataBase_H
+
+#include <memory>
+#include <string>
+#include <vector>
+#include <array>
+
+#include "Core/PointerDefinitions.h"
+#include "Core/DataTypes.h"
+#include "Core/VectorTypes.h"
+#include "Core/ArrayTypes.h"
+
+#include "VirtualFluidsDefinitions.h"
+
+#include "Definitions/AccumulatorDataType.h"
+
+#include "CellProperties/CellProperties.cuh"
+
+class  GksMeshAdapter;
+
+struct BoundaryCondition;
+class  DataBaseAllocator;
+struct DataBase;
+struct PerLevelCounts;
+struct DataBaseStruct;
+
+//! \brief Class for memory management.
+//!
+//! This class holds and manages the memory of the simulation
+//! For this purpose it holds vectors and pointer for host and device/host data, respectively.
+struct VF_PUBLIC DataBase : public std::enable_shared_from_this<DataBase>
+{
+    //////////////////////////////////////////////////////////////////////////
+    // Management
+    //////////////////////////////////////////////////////////////////////////
+
+    //! shared pointer to an \ref DataBaseAllocator that is used for all memory operations
+    SPtr<DataBaseAllocator> myAllocator;
+
+    //! vector of shared pointers to boundary conditions that are used in the simulation
+    std::vector< SPtr<BoundaryCondition> > boundaryConditions;
+
+    //////////////////////////////////////////////////////////////////////////
+    // Sizes
+    //////////////////////////////////////////////////////////////////////////
+
+    uint numberOfNodes;
+
+    uint numberOfCells;
+
+    uint numberOfFaces;
+
+    uint numberOfLevels;
+
+    //! stores number of cells and faces and their start indices per level
+    std::vector<PerLevelCounts> perLevelCount;
+
+    //////////////////////////////////////////////////////////////////////////
+    // Host only geometry and connectivity
+    //////////////////////////////////////////////////////////////////////////
+
+    std::vector<Vec3>   nodeCoordinates;            //!< length = DataBase::numberOfNodes
+
+    std::vector<uint_8> cellToNode;                 //!< Stores node indices. <br>length = DataBase::numberOfCells
+    std::vector<uint_4> faceToNode;                 //!< Stores node indices. <br>length = DataBase::numberOfFaces
+
+    std::vector<CellProperties> cellPropertiesHost; //!< length = DataBase::numberOfCells
+
+    //////////////////////////////////////////////////////////////////////////
+    // Host/Device geometry and connectivity - READ ONLY
+    //////////////////////////////////////////////////////////////////////////
+
+    uint* cellToCell;               //!< Stores cell indices. <br>length = 6 * DataBase::numberOfCells
+
+    uint* faceToCell;               //!< Stores cell indices. <br>length = 2 * DataBase::numberOfFaces
+
+    uint* parentCell;               //!< Stores cell indices. <br>length =     DataBase::numberOfCells
+
+    real* faceCenter;               //!< length = 3 * DataBase::numberOfFaces
+    real* cellCenter;               //!< length = 3 * DataBase::numberOfCells
+
+    CellProperties* cellProperties; //!< length =     DataBase::numberOfCells
+
+    char* faceOrientation;          //!< Can be 'x', 'y' or 'z'. <br>length =     DataBase::numberOfFaces; 
+
+    //////////////////////////////////////////////////////////////////////////
+    // Host/Device data - READ MODIFY
+    //////////////////////////////////////////////////////////////////////////
+
+    real*            data;          //!< Cell averaged flow state data in terms of conserved variables. <br>length = LENGTH_CELL_DATA * DataBase::numberOfCells
+    realAccumulator* dataUpdate;    //!< Flux accumulator in terms of conserved variables.              <br>length = LENGTH_CELL_DATA * DataBase::numberOfCells
+
+    real* massFlux;                 //!< Mass flux accumulator.  <br>length = 3 * DataBase::numberOfCells
+
+    real* diffusivity;              //!< Turbulent diffusivity accumulator. <br>length = DataBase::numberOfCells
+
+    int* crashCellIndex;            //!< Index of the crashed cell. It is negative if no cell crashed. <br>length = 1;
+
+    //////////////////////////////////////////////////////////////////////////
+    // Host only data
+    //////////////////////////////////////////////////////////////////////////
+
+    std::vector<real> dataHost;         //!< Copy of data for initialization and post processing. <br>length = LENGTH_CELL_DATA * DataBase::numberOfCells
+
+    std::vector<real> diffusivityHost;  //!< Copy of diffusivity for post processing. <br>length = DataBase::numberOfCells
+
+    //////////////////////////////////////////////////////////////////////////
+    //////////////////////////////////////////////////////////////////////////
+    // Methods
+    //////////////////////////////////////////////////////////////////////////
+    //////////////////////////////////////////////////////////////////////////
+
+    //! constructor
+    //! initializes the pointers and creates an DataBaseAllocator
+    //! \param type string that can be either "GPU" or "CPU", depending on where the computations should be executed
+    DataBase( std::string type );
+
+    //! destructor
+    //! initiates memory deallocation
+    ~DataBase();
+
+    //! copies a mesh from a <b>GksMeshAdapter</b> to the DataStructure and allocates device memory for the simulation
+    //! \param adapter   <b>GksMeshAdapter</b> that contains a mesh
+    void setMesh( GksMeshAdapter& adapter );
+
+    
+    void copyDataHostToDevice();                    //!< copies the flow state data from DataBase::dataHost to DataBase::data
+    
+    void copyDataDeviceToHost();                    //!< copies the flow state data from DataBase::data to DataBase::dataHost
+    
+    void copyDataDeviceToHost( real* dataHost );    //!< copies the flow state data from DataBase::data to dataHost, where dataHost may be any array of suitable size
+    
+    int getCrashCellIndex();                        //!< downloads the crash cell index from the device
+
+    DataBaseStruct toStruct();                      //!< exports all memory pointers and sizes for kernel usage
+
+    //////////////////////////////////////////////////////////////////////////
+
+    uint getCellLevel( uint cellIdx );              //!< \return grid level of cell with index cellIdx
+    uint getFaceLevel( uint faceIdx );              //!< \return grid level of face with index faceIdx
+
+    Vec3 getCellCenter( uint cellIdx );             //!< \return cell of cell with index cellIdx
+
+    bool isGhostCell( uint cellIdx );               //!< \return true if cell is ghost cell
+
+    std::string getDeviceType();                    //!< \return "GPU" or "CPU" depending on which DataBaseAllocator is used
+};
+
+//! \brief Stores number of cells and faces and their start indices per level
+//!
+//! Additionally information for refinement and 
+struct VF_PUBLIC PerLevelCounts
+{
+    uint numberOfCells;
+    uint startOfCells;
+
+    uint numberOfBulkCells;
+
+    uint numberOfFaces;
+
+    uint numberOfInnerFaces;
+
+    uint numberOfFacesX;
+    uint startOfFacesX;
+
+    uint numberOfFacesY;
+    uint startOfFacesY;
+
+    uint numberOfFacesZ;
+    uint startOfFacesZ;
+
+    uint numberOfCoarseToFine;
+    uint startOfCoarseToFine;
+
+    uint numberOfFineToCoarse;
+    uint startOfFineToCoarse;
+};
+
+#endif
\ No newline at end of file
diff --git a/src/GksGpu/DataBase/DataBaseAllocator.cpp b/src/GksGpu/DataBase/DataBaseAllocator.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..a3f3a49b344eb250f37c031623134d90a6104c82
--- /dev/null
+++ b/src/GksGpu/DataBase/DataBaseAllocator.cpp
@@ -0,0 +1,58 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 DataBaseAllocator.cpp
+//! \ingroup DataBase
+//! \author Stephan Lenz
+//=======================================================================================
+#include "DataBaseAllocator.h"
+
+#include "DataBaseAllocatorCPU.h"
+#include "DataBaseAllocatorGPU.h"
+
+#include <string>
+
+std::shared_ptr<DataBaseAllocator> DataBaseAllocator::create(std::string type)
+{
+    if ( type == "GPU" )
+        return std::shared_ptr<DataBaseAllocator>( new DataBaseAllocatorGPU() );
+    else
+        return std::shared_ptr<DataBaseAllocator>( new DataBaseAllocatorCPU() );
+}
+
+DataBaseAllocator::~DataBaseAllocator()
+{
+}
+
+DataBaseAllocator::DataBaseAllocator()
+{
+}
+
+DataBaseAllocator::DataBaseAllocator(const DataBaseAllocator & orig)
+{
+}
diff --git a/src/GksGpu/DataBase/DataBaseAllocator.h b/src/GksGpu/DataBase/DataBaseAllocator.h
new file mode 100644
index 0000000000000000000000000000000000000000..346e8e334e1fb51a82df8c3bf6cfd51831d79a84
--- /dev/null
+++ b/src/GksGpu/DataBase/DataBaseAllocator.h
@@ -0,0 +1,99 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 DataBaseAllocator.h
+//! \ingroup DataBase
+//! \author Stephan Lenz
+//=======================================================================================
+#ifndef DataBaseAllocator_H
+#define DataBaseAllocator_H
+
+#include <string>
+#include <vector>
+
+#include "Core/DataTypes.h"
+#include "Core/PointerDefinitions.h"
+
+#include "VirtualFluidsDefinitions.h"
+
+class  GksMeshAdapter;
+struct DataBase;
+struct BoundaryCondition;
+
+//! Virtual base class for GPU and CPU memory management
+class VF_PUBLIC DataBaseAllocator {
+
+public:
+
+    //! \return shared pointer to DataBaseAllocatorGPU or DataBaseAllocatorCPU based on type
+    static std::shared_ptr<DataBaseAllocator> create( std::string type );
+
+    //////////////////////////////////////////////////////////////////////////
+
+    //! frees DataBase memory
+    virtual void freeMemory( DataBase& dataBase ) = 0;
+
+    //! allocates DataBase memory
+    virtual void allocateMemory( SPtr<DataBase> dataBase) = 0;
+
+    //! copies mesh information from GksMeshAdapter to DataBase
+    virtual void copyMesh( SPtr<DataBase> dataBase, GksMeshAdapter& adapter ) = 0;
+
+    //! copies the flow state data from DataBase::dataHost to DataBase::data
+    virtual void copyDataHostToDevice( SPtr<DataBase> dataBase ) = 0;
+
+    //! copies the flow state data from DataBase::data to dataHost
+    virtual void copyDataDeviceToHost( SPtr<DataBase> dataBase, real* hostData ) = 0;
+
+    //! \return the crash cell index from the device
+    virtual int  getCrashCellIndex( SPtr<DataBase> dataBase ) = 0;                      
+
+    //////////////////////////////////////////////////////////////////////////
+
+    //! frees boundary condition memory
+    virtual void freeMemory( BoundaryCondition& boundaryCondition ) = 0;
+
+    //! allocates boundary condition memory and copies data to device
+    virtual void allocateMemory( SPtr<BoundaryCondition> boundaryCondition, std::vector<uint> ghostCells, std::vector<uint> domainCells, std::vector<uint> secondCells ) = 0;
+
+    //////////////////////////////////////////////////////////////////////////
+
+    ~DataBaseAllocator();
+
+    // \return the device type as string
+    virtual std::string getDeviceType() = 0;
+
+protected:
+
+    DataBaseAllocator();
+    DataBaseAllocator( const DataBaseAllocator& orig );
+
+};
+
+
+#endif
\ No newline at end of file
diff --git a/src/GksGpu/DataBase/DataBaseAllocatorCPU.cpp b/src/GksGpu/DataBase/DataBaseAllocatorCPU.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..14b07a965d0901456f416e55a3dc92a8319b65a9
--- /dev/null
+++ b/src/GksGpu/DataBase/DataBaseAllocatorCPU.cpp
@@ -0,0 +1,224 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 DataBaseAllocatorCPU.cpp
+//! \ingroup DataBase
+//! \author Stephan Lenz
+//=======================================================================================
+#include "DataBaseAllocatorCPU.h"
+
+#include <cstring>
+
+#include "Core/DataTypes.h"
+#include "Core/PointerDefinitions.h"
+
+#include "GksMeshAdapter/GksMeshAdapter.h"
+
+#include "DataBase/DataBase.h"
+
+#include "CellProperties/CellProperties.cuh"
+
+#include "BoundaryConditions/BoundaryCondition.h"
+
+#include "Definitions/MemoryAccessPattern.h"
+
+void DataBaseAllocatorCPU::freeMemory( DataBase& dataBase)
+{
+    dataBase.cellToNode.clear();
+    dataBase.faceToNode.clear();
+
+    dataBase.cellPropertiesHost.clear();
+
+    delete [] dataBase.cellToCell;
+
+    delete [] dataBase.faceToCell;
+
+    delete [] dataBase.parentCell;
+
+    delete [] dataBase.faceCenter;
+    delete [] dataBase.cellCenter;
+
+    delete [] dataBase.cellProperties;
+
+    delete [] dataBase.faceOrientation;
+
+    delete [] dataBase.data;
+    delete [] dataBase.dataUpdate;
+
+    delete [] dataBase.massFlux;
+
+    delete [] dataBase.diffusivity;
+
+    delete [] dataBase.crashCellIndex;
+
+    dataBase.dataHost.clear();
+}
+
+void DataBaseAllocatorCPU::allocateMemory(SPtr<DataBase> dataBase)
+{
+    dataBase->cellToNode.resize( dataBase->numberOfCells );
+    dataBase->faceToNode.resize( dataBase->numberOfFaces );
+
+    dataBase->cellPropertiesHost.resize( dataBase->numberOfCells );
+
+    dataBase->cellToCell = new uint [ LENGTH_CELL_TO_CELL * dataBase->numberOfCells ];
+
+    dataBase->faceToCell = new uint [ LENGTH_FACE_TO_CELL * dataBase->numberOfFaces ];
+
+    dataBase->parentCell = new uint [ dataBase->numberOfCells ];
+
+    dataBase->faceCenter = new real [ LENGTH_VECTOR * dataBase->numberOfFaces ];
+    dataBase->cellCenter = new real [ LENGTH_VECTOR * dataBase->numberOfCells ];
+
+    dataBase->cellProperties = new CellProperties [ dataBase->numberOfCells ];
+
+    dataBase->faceOrientation = new char [ dataBase->numberOfFaces ];
+
+    dataBase->data       = new real            [ LENGTH_CELL_DATA * dataBase->numberOfCells ];
+    dataBase->dataUpdate = new realAccumulator [ LENGTH_CELL_DATA * dataBase->numberOfCells ];
+
+    dataBase->massFlux   = new real [ LENGTH_VECTOR    * dataBase->numberOfCells ];
+
+    dataBase->diffusivity  = new real [ dataBase->numberOfCells ];
+
+    dataBase->crashCellIndex = new int;
+
+    dataBase->dataHost.resize( LENGTH_CELL_DATA * dataBase->numberOfCells );
+
+    dataBase->diffusivityHost.resize( dataBase->numberOfCells );
+}
+
+void DataBaseAllocatorCPU::copyMesh(SPtr<DataBase> dataBase, GksMeshAdapter & adapter)
+{
+    dataBase->nodeCoordinates = adapter.nodes;
+
+    //////////////////////////////////////////////////////////////////////////
+
+    for( uint cellIdx = 0; cellIdx < dataBase->numberOfCells; cellIdx++ )
+    {
+        dataBase->cellToNode[ cellIdx ][ 0 ] = adapter.cells[ cellIdx ].cellToNode[ 7 ];
+        dataBase->cellToNode[ cellIdx ][ 1 ] = adapter.cells[ cellIdx ].cellToNode[ 3 ];
+        dataBase->cellToNode[ cellIdx ][ 2 ] = adapter.cells[ cellIdx ].cellToNode[ 1 ];
+        dataBase->cellToNode[ cellIdx ][ 3 ] = adapter.cells[ cellIdx ].cellToNode[ 5 ];
+        dataBase->cellToNode[ cellIdx ][ 4 ] = adapter.cells[ cellIdx ].cellToNode[ 6 ];
+        dataBase->cellToNode[ cellIdx ][ 5 ] = adapter.cells[ cellIdx ].cellToNode[ 2 ];
+        dataBase->cellToNode[ cellIdx ][ 6 ] = adapter.cells[ cellIdx ].cellToNode[ 0 ];
+        dataBase->cellToNode[ cellIdx ][ 7 ] = adapter.cells[ cellIdx ].cellToNode[ 4 ];
+        
+        for( uint neighbordx = 0; neighbordx < LENGTH_CELL_TO_CELL; neighbordx++ )
+            dataBase->cellToCell[ CELL_TO_CELL( cellIdx, neighbordx, dataBase->numberOfCells ) ] 
+                = adapter.cells[ cellIdx ].cellToCell[ neighbordx ];
+
+        dataBase->parentCell[ cellIdx ] = adapter.cells[ cellIdx ].parent;
+
+        dataBase->cellCenter[ VEC_X( cellIdx, dataBase->numberOfCells ) ] = adapter.cells[ cellIdx ].cellCenter.x;
+        dataBase->cellCenter[ VEC_Y( cellIdx, dataBase->numberOfCells ) ] = adapter.cells[ cellIdx ].cellCenter.y;
+        dataBase->cellCenter[ VEC_Z( cellIdx, dataBase->numberOfCells ) ] = adapter.cells[ cellIdx ].cellCenter.z;
+
+        dataBase->cellPropertiesHost[ cellIdx ] = CELL_PROPERTIES_DEFAULT;
+
+        if( adapter.cells[ cellIdx ].isWall )
+            setCellProperties( dataBase->cellPropertiesHost[ cellIdx ], CELL_PROPERTIES_WALL ); 
+
+        if( adapter.cells[ cellIdx ].isFluxBC )
+            setCellProperties( dataBase->cellPropertiesHost[ cellIdx ], CELL_PROPERTIES_IS_FLUX_BC );
+
+        if( adapter.cells[ cellIdx ].isInsulated )
+            setCellProperties( dataBase->cellPropertiesHost[ cellIdx ], CELL_PROPERTIES_IS_INSULATED ); 
+
+        if( adapter.cells[ cellIdx ].isGhostCell )
+            setCellProperties( dataBase->cellPropertiesHost[ cellIdx ], CELL_PROPERTIES_GHOST ); 
+
+        if( adapter.cells[ cellIdx ].isFineGhostCell() )
+            setCellProperties( dataBase->cellPropertiesHost[ cellIdx ], CELL_PROPERTIES_FINE_GHOST ); 
+    }
+
+    for( uint faceIdx = 0; faceIdx < dataBase->numberOfFaces; faceIdx++ )
+    {
+        for( uint nodeIdx = 0; nodeIdx < 4; nodeIdx++ )
+            dataBase->faceToNode[ faceIdx ][ nodeIdx ]
+                = adapter.faces[ faceIdx ].faceToNode[ nodeIdx ];
+
+        dataBase->faceToCell[ NEG_CELL( faceIdx, dataBase->numberOfFaces ) ] = adapter.faces[ faceIdx ].negCell;
+        dataBase->faceToCell[ POS_CELL( faceIdx, dataBase->numberOfFaces ) ] = adapter.faces[ faceIdx ].posCell;
+
+        dataBase->faceCenter[ VEC_X( faceIdx, dataBase->numberOfFaces ) ] = adapter.faces[ faceIdx ].faceCenter.x;
+        dataBase->faceCenter[ VEC_Y( faceIdx, dataBase->numberOfFaces ) ] = adapter.faces[ faceIdx ].faceCenter.y;
+        dataBase->faceCenter[ VEC_Z( faceIdx, dataBase->numberOfFaces ) ] = adapter.faces[ faceIdx ].faceCenter.z;
+
+        dataBase->faceOrientation[ faceIdx ] = adapter.faces[ faceIdx ].orientation;
+    }
+
+    //////////////////////////////////////////////////////////////////////////
+
+    memcpy ( dataBase->cellProperties, dataBase->cellPropertiesHost.data(), sizeof(CellProperties) * dataBase->numberOfCells );
+
+    //////////////////////////////////////////////////////////////////////////
+
+    *dataBase->crashCellIndex = -1;
+}
+
+void DataBaseAllocatorCPU::copyDataHostToDevice(SPtr<DataBase> dataBase)
+{
+    memcpy( dataBase->data, dataBase->dataHost.data(), sizeof(real) * LENGTH_CELL_DATA * dataBase->numberOfCells );
+}
+
+void DataBaseAllocatorCPU::copyDataDeviceToHost(SPtr<DataBase> dataBase, real* hostData)
+{
+    memcpy( hostData, dataBase->data, sizeof(real) * LENGTH_CELL_DATA * dataBase->numberOfCells );
+    
+    memcpy( dataBase->diffusivityHost.data(), dataBase->diffusivity, sizeof(real) * dataBase->numberOfCells );
+}
+
+int DataBaseAllocatorCPU::getCrashCellIndex(SPtr<DataBase> dataBase)
+{
+    return *dataBase->crashCellIndex;
+}
+
+void DataBaseAllocatorCPU::freeMemory(BoundaryCondition& boundaryCondition)
+{
+    delete [] boundaryCondition.ghostCells ;
+    delete [] boundaryCondition.domainCells;
+    delete [] boundaryCondition.secondCells;
+}
+
+void DataBaseAllocatorCPU::allocateMemory(SPtr<BoundaryCondition> boundaryCondition, std::vector<uint> ghostCells, std::vector<uint> domainCells, std::vector<uint> secondCells)
+{
+    boundaryCondition->ghostCells  = new uint[ ghostCells.size()  ];
+    boundaryCondition->domainCells = new uint[ domainCells.size() ];
+    boundaryCondition->secondCells = new uint[ secondCells.size() ];
+
+    memcpy ( boundaryCondition->ghostCells , ghostCells.data() , sizeof(uint) * ghostCells.size()  );
+    memcpy ( boundaryCondition->domainCells, domainCells.data(), sizeof(uint) * domainCells.size() );
+    memcpy ( boundaryCondition->secondCells, secondCells.data(), sizeof(uint) * secondCells.size() );
+}
+
+std::string DataBaseAllocatorCPU::getDeviceType()
+{
+    return std::string("CPU");
+}
diff --git a/src/GksGpu/DataBase/DataBaseAllocatorCPU.h b/src/GksGpu/DataBase/DataBaseAllocatorCPU.h
new file mode 100644
index 0000000000000000000000000000000000000000..59b4a41a919b91bafc971146c71ed93844c20ab0
--- /dev/null
+++ b/src/GksGpu/DataBase/DataBaseAllocatorCPU.h
@@ -0,0 +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 DataBaseAllocatorCPU.h
+//! \ingroup DataBase
+//! \author Stephan Lenz
+//=======================================================================================
+#ifndef DataBaseAllocatorCPU_H
+#define DatabaseAllocatorCPU_H
+
+#include "Core/DataTypes.h"
+#include "Core/PointerDefinitions.h"
+
+#include "DataBaseAllocator.h"
+
+#include "VirtualFluidsDefinitions.h"
+
+//! DataBaseAllocator for CPU memory
+class VF_PUBLIC DataBaseAllocatorCPU : public DataBaseAllocator {
+
+public:
+
+    //! frees DataBase memory
+    virtual void freeMemory( DataBase& dataBase ) override;
+
+    //! allocates DataBase memory
+    virtual void allocateMemory( SPtr<DataBase> dataBase ) override;
+
+    //! copies mesh information from GksMeshAdapter to DataBase
+    virtual void copyMesh( SPtr<DataBase> dataBase, GksMeshAdapter& adapter ) override;
+
+    //! copies the flow state data from DataBase::dataHost to DataBase::data
+    virtual void copyDataHostToDevice( SPtr<DataBase> dataBase ) override;
+    
+    //! copies the flow state data from DataBase::data to dataHost
+    virtual void copyDataDeviceToHost( SPtr<DataBase> dataBase, real* dataHost ) override;
+
+    //! \return the crash cell index from the device
+    virtual int  getCrashCellIndex( SPtr<DataBase> dataBase ) override;
+
+    //////////////////////////////////////////////////////////////////////////
+
+    //! frees boundary condition memory
+    virtual void freeMemory( BoundaryCondition& boundaryCondition ) override;
+
+    //! allocates boundary condition memory and copies data to device
+    virtual void allocateMemory( SPtr<BoundaryCondition> boundaryCondition, std::vector<uint> ghostCells, std::vector<uint> domainCells, std::vector<uint> secondCells ) override;
+
+    //////////////////////////////////////////////////////////////////////////
+
+    //! \return "CPU"
+    virtual std::string getDeviceType() override;
+};
+
+
+#endif
\ No newline at end of file
diff --git a/src/GksGpu/DataBase/DataBaseAllocatorGPU.cpp b/src/GksGpu/DataBase/DataBaseAllocatorGPU.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..74cc31951115cc50abd467102f8e0f7f1a09700b
--- /dev/null
+++ b/src/GksGpu/DataBase/DataBaseAllocatorGPU.cpp
@@ -0,0 +1,259 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 DataBaseAllocatorGPU.cpp
+//! \ingroup DataBase
+//! \author Stephan Lenz
+//=======================================================================================
+#include "DataBaseAllocatorGPU.h"
+
+#include <cstring>
+#include <cuda.h>
+#include <cuda_runtime.h>
+#include <helper_cuda.h>
+
+#include "Core/DataTypes.h"
+#include "Core/PointerDefinitions.h"
+
+#include "GksMeshAdapter/GksMeshAdapter.h"
+
+#include "DataBase/DataBase.h"
+
+#include "CellProperties/CellProperties.cuh"
+
+#include "BoundaryConditions/BoundaryCondition.h"
+
+#include "Definitions/MemoryAccessPattern.h"
+
+#include "CudaUtility/CudaUtility.h"
+
+void DataBaseAllocatorGPU::freeMemory( DataBase& dataBase )
+{
+    dataBase.cellToNode.clear();
+    dataBase.faceToNode.clear();
+
+    dataBase.cellPropertiesHost.clear();
+
+    checkCudaErrors( cudaFree ( dataBase.cellToCell ) );
+
+    checkCudaErrors( cudaFree ( dataBase.faceToCell ) );
+
+    checkCudaErrors( cudaFree ( dataBase.parentCell ) );
+
+    checkCudaErrors( cudaFree ( dataBase.faceCenter ) );
+    checkCudaErrors( cudaFree ( dataBase.cellCenter ) );
+
+    checkCudaErrors( cudaFree ( dataBase.cellProperties ) );
+
+    checkCudaErrors( cudaFree ( dataBase.faceOrientation ) );
+
+    checkCudaErrors( cudaFree ( dataBase.data ) );
+    checkCudaErrors( cudaFree ( dataBase.dataUpdate ) );
+
+    checkCudaErrors( cudaFree ( dataBase.massFlux ) );
+
+    checkCudaErrors( cudaFree ( dataBase.diffusivity ) );
+
+    checkCudaErrors( cudaFree ( dataBase.crashCellIndex ) );
+
+    dataBase.dataHost.clear();
+}
+
+void DataBaseAllocatorGPU::allocateMemory(SPtr<DataBase> dataBase)
+{
+    dataBase->cellToNode.resize( dataBase->numberOfCells );
+    dataBase->faceToNode.resize( dataBase->numberOfFaces );
+
+    dataBase->cellPropertiesHost.resize( dataBase->numberOfCells );
+
+    checkCudaErrors( cudaMalloc ( &dataBase->cellToCell, sizeof(uint) * LENGTH_CELL_TO_CELL * dataBase->numberOfCells ) );
+
+    checkCudaErrors( cudaMalloc ( &dataBase->faceToCell, sizeof(uint) * LENGTH_FACE_TO_CELL * dataBase->numberOfFaces ) );
+
+    checkCudaErrors( cudaMalloc ( &dataBase->parentCell, sizeof(uint) * dataBase->numberOfCells ) );
+
+    checkCudaErrors( cudaMalloc ( &dataBase->faceCenter, sizeof(real) * LENGTH_VECTOR * dataBase->numberOfFaces ) );
+    checkCudaErrors( cudaMalloc ( &dataBase->cellCenter, sizeof(real) * LENGTH_VECTOR * dataBase->numberOfCells ) );
+
+    checkCudaErrors( cudaMalloc ( &dataBase->cellProperties, sizeof(CellProperties) * dataBase->numberOfCells ) );
+
+    checkCudaErrors( cudaMalloc ( &dataBase->faceOrientation, sizeof(char) * dataBase->numberOfFaces ) );
+
+    checkCudaErrors( cudaMalloc ( &dataBase->data,       sizeof(real) *            LENGTH_CELL_DATA * dataBase->numberOfCells ) );
+    checkCudaErrors( cudaMalloc ( &dataBase->dataUpdate, sizeof(realAccumulator) * LENGTH_CELL_DATA * dataBase->numberOfCells ) );
+
+    checkCudaErrors( cudaMalloc ( &dataBase->massFlux ,  sizeof(real) * LENGTH_VECTOR    * dataBase->numberOfCells ) );
+
+    checkCudaErrors( cudaMalloc ( &dataBase->diffusivity,  sizeof(real) * dataBase->numberOfCells ) );
+
+    checkCudaErrors( cudaMalloc ( &dataBase->crashCellIndex,  sizeof(int) ) );
+
+    dataBase->dataHost.resize( LENGTH_CELL_DATA * dataBase->numberOfCells );
+
+    dataBase->diffusivityHost.resize( dataBase->numberOfCells );
+}
+
+void DataBaseAllocatorGPU::copyMesh(SPtr<DataBase> dataBase, GksMeshAdapter & adapter)
+{
+    dataBase->nodeCoordinates = adapter.nodes;
+
+    //////////////////////////////////////////////////////////////////////////
+
+    std::vector<uint> cellToCellBuffer   ( LENGTH_CELL_TO_CELL * dataBase->numberOfCells );
+
+    std::vector<uint> faceToCellBuffer   ( LENGTH_FACE_TO_CELL * dataBase->numberOfFaces );
+
+    std::vector<uint> parentCellBuffer   ( dataBase->numberOfCells );
+
+    std::vector<real> faceCenterBuffer   ( LENGTH_VECTOR * dataBase->numberOfFaces );
+    std::vector<real> cellCenterBuffer   ( LENGTH_VECTOR * dataBase->numberOfCells );
+
+    std::vector<char> faceOrientationBuffer( dataBase->numberOfFaces );
+
+    //////////////////////////////////////////////////////////////////////////
+
+    for( uint cellIdx = 0; cellIdx < dataBase->numberOfCells; cellIdx++ )
+    {
+        dataBase->cellToNode[ cellIdx ][ 0 ] = adapter.cells[ cellIdx ].cellToNode[ 7 ];
+        dataBase->cellToNode[ cellIdx ][ 1 ] = adapter.cells[ cellIdx ].cellToNode[ 3 ];
+        dataBase->cellToNode[ cellIdx ][ 2 ] = adapter.cells[ cellIdx ].cellToNode[ 1 ];
+        dataBase->cellToNode[ cellIdx ][ 3 ] = adapter.cells[ cellIdx ].cellToNode[ 5 ];
+        dataBase->cellToNode[ cellIdx ][ 4 ] = adapter.cells[ cellIdx ].cellToNode[ 6 ];
+        dataBase->cellToNode[ cellIdx ][ 5 ] = adapter.cells[ cellIdx ].cellToNode[ 2 ];
+        dataBase->cellToNode[ cellIdx ][ 6 ] = adapter.cells[ cellIdx ].cellToNode[ 0 ];
+        dataBase->cellToNode[ cellIdx ][ 7 ] = adapter.cells[ cellIdx ].cellToNode[ 4 ];
+        
+        for( uint neighbordx = 0; neighbordx < LENGTH_CELL_TO_CELL; neighbordx++ )
+            cellToCellBuffer[ CELL_TO_CELL( cellIdx, neighbordx, dataBase->numberOfCells ) ] 
+                = adapter.cells[ cellIdx ].cellToCell[ neighbordx ];
+
+        parentCellBuffer[ cellIdx ] = adapter.cells[ cellIdx ].parent;
+
+        cellCenterBuffer[ VEC_X( cellIdx, dataBase->numberOfCells ) ] = adapter.cells[ cellIdx ].cellCenter.x;
+        cellCenterBuffer[ VEC_Y( cellIdx, dataBase->numberOfCells ) ] = adapter.cells[ cellIdx ].cellCenter.y;
+        cellCenterBuffer[ VEC_Z( cellIdx, dataBase->numberOfCells ) ] = adapter.cells[ cellIdx ].cellCenter.z;
+
+        dataBase->cellPropertiesHost[ cellIdx ] = CELL_PROPERTIES_DEFAULT;
+
+        if( adapter.cells[ cellIdx ].isWall )
+            setCellProperties( dataBase->cellPropertiesHost[ cellIdx ], CELL_PROPERTIES_WALL ); 
+
+        if( adapter.cells[ cellIdx ].isFluxBC )
+            setCellProperties( dataBase->cellPropertiesHost[ cellIdx ], CELL_PROPERTIES_IS_FLUX_BC );
+
+        if( adapter.cells[ cellIdx ].isInsulated )
+            setCellProperties( dataBase->cellPropertiesHost[ cellIdx ], CELL_PROPERTIES_IS_INSULATED ); 
+
+        if( adapter.cells[ cellIdx ].isGhostCell )
+            setCellProperties( dataBase->cellPropertiesHost[ cellIdx ], CELL_PROPERTIES_GHOST ); 
+
+        if( adapter.cells[ cellIdx ].isFineGhostCell() )
+            setCellProperties( dataBase->cellPropertiesHost[ cellIdx ], CELL_PROPERTIES_FINE_GHOST ); 
+    }
+
+    for( uint faceIdx = 0; faceIdx < dataBase->numberOfFaces; faceIdx++ )
+    {
+        for( uint nodeIdx = 0; nodeIdx < 4; nodeIdx++ )
+            dataBase->faceToNode[ faceIdx ][ nodeIdx ]
+                = adapter.faces[ faceIdx ].faceToNode[ nodeIdx ];
+
+        faceToCellBuffer[ NEG_CELL( faceIdx, dataBase->numberOfFaces ) ] = adapter.faces[ faceIdx ].negCell;
+        faceToCellBuffer[ POS_CELL( faceIdx, dataBase->numberOfFaces ) ] = adapter.faces[ faceIdx ].posCell;
+
+        faceCenterBuffer[ VEC_X( faceIdx, dataBase->numberOfFaces ) ] = adapter.faces[ faceIdx ].faceCenter.x;
+        faceCenterBuffer[ VEC_Y( faceIdx, dataBase->numberOfFaces ) ] = adapter.faces[ faceIdx ].faceCenter.y;
+        faceCenterBuffer[ VEC_Z( faceIdx, dataBase->numberOfFaces ) ] = adapter.faces[ faceIdx ].faceCenter.z;
+
+        faceOrientationBuffer[ faceIdx ] = adapter.faces[ faceIdx ].orientation;
+    }
+
+    //////////////////////////////////////////////////////////////////////////
+
+    checkCudaErrors( cudaMemcpy ( dataBase->cellToCell,     cellToCellBuffer.data(),     sizeof(uint) * LENGTH_CELL_TO_CELL * dataBase->numberOfCells, cudaMemcpyHostToDevice ) );
+    
+    checkCudaErrors( cudaMemcpy ( dataBase->faceToCell,     faceToCellBuffer.data(),     sizeof(uint) * LENGTH_FACE_TO_CELL * dataBase->numberOfFaces, cudaMemcpyHostToDevice ) );
+
+    checkCudaErrors( cudaMemcpy ( dataBase->parentCell,     parentCellBuffer.data(),     sizeof(uint) * dataBase->numberOfCells, cudaMemcpyHostToDevice ) );
+
+    checkCudaErrors( cudaMemcpy ( dataBase->faceCenter,     faceCenterBuffer.data(),     sizeof(real) * LENGTH_VECTOR * dataBase->numberOfFaces, cudaMemcpyHostToDevice ) );
+    checkCudaErrors( cudaMemcpy ( dataBase->cellCenter,     cellCenterBuffer.data(),     sizeof(real) * LENGTH_VECTOR * dataBase->numberOfCells, cudaMemcpyHostToDevice ) );
+
+    checkCudaErrors( cudaMemcpy ( dataBase->cellProperties, dataBase->cellPropertiesHost.data(), sizeof(CellProperties) * dataBase->numberOfCells, cudaMemcpyHostToDevice ) );
+
+    checkCudaErrors( cudaMemcpy ( dataBase->faceOrientation, faceOrientationBuffer.data(), sizeof(char) * dataBase->numberOfFaces, cudaMemcpyHostToDevice ) );
+
+    //////////////////////////////////////////////////////////////////////////
+
+    checkCudaErrors( cudaMemset( dataBase->crashCellIndex, -1, sizeof(int) ) );
+
+    //////////////////////////////////////////////////////////////////////////
+}
+
+void DataBaseAllocatorGPU::copyDataHostToDevice(SPtr<DataBase> dataBase)
+{
+    checkCudaErrors( cudaMemcpy( dataBase->data, dataBase->dataHost.data(), sizeof(real) * LENGTH_CELL_DATA * dataBase->numberOfCells, cudaMemcpyHostToDevice ) );
+}
+
+void DataBaseAllocatorGPU::copyDataDeviceToHost(SPtr<DataBase> dataBase,  real* hostData )
+{
+    checkCudaErrors( cudaMemcpy( hostData, dataBase->data, sizeof(real) * LENGTH_CELL_DATA * dataBase->numberOfCells, cudaMemcpyDeviceToHost ) );
+
+    checkCudaErrors( cudaMemcpy( dataBase->diffusivityHost.data(), dataBase->diffusivity, sizeof(real) * dataBase->numberOfCells, cudaMemcpyDeviceToHost ) );
+}
+
+int DataBaseAllocatorGPU::getCrashCellIndex(SPtr<DataBase> dataBase)
+{
+    int crashCellIndex;
+
+    checkCudaErrors( cudaMemcpy( &crashCellIndex, dataBase->crashCellIndex, sizeof(int), cudaMemcpyDeviceToHost ) );
+
+    return crashCellIndex;
+}
+
+void DataBaseAllocatorGPU::freeMemory(BoundaryCondition& boundaryCondition)
+{
+    checkCudaErrors( cudaFree ( boundaryCondition.ghostCells  ) );
+    checkCudaErrors( cudaFree ( boundaryCondition.domainCells ) );
+    checkCudaErrors( cudaFree ( boundaryCondition.secondCells ) );
+}
+
+void DataBaseAllocatorGPU::allocateMemory(SPtr<BoundaryCondition> boundaryCondition, std::vector<uint> ghostCells, std::vector<uint> domainCells, std::vector<uint> secondCells)
+{
+    checkCudaErrors( cudaMalloc ( &boundaryCondition->ghostCells , sizeof(uint) * ghostCells.size()  ) );
+    checkCudaErrors( cudaMalloc ( &boundaryCondition->domainCells, sizeof(uint) * domainCells.size() ) );
+    checkCudaErrors( cudaMalloc ( &boundaryCondition->secondCells, sizeof(uint) * secondCells.size() ) );
+
+    checkCudaErrors( cudaMemcpy ( boundaryCondition->ghostCells , ghostCells.data() , sizeof(uint) * ghostCells.size() , cudaMemcpyHostToDevice ) );
+    checkCudaErrors( cudaMemcpy ( boundaryCondition->domainCells, domainCells.data(), sizeof(uint) * domainCells.size(), cudaMemcpyHostToDevice ) );
+    checkCudaErrors( cudaMemcpy ( boundaryCondition->secondCells, secondCells.data(), sizeof(uint) * secondCells.size(), cudaMemcpyHostToDevice ) );
+}
+
+std::string DataBaseAllocatorGPU::getDeviceType()
+{
+    return std::string("GPU");
+}
diff --git a/src/GksGpu/DataBase/DataBaseAllocatorGPU.h b/src/GksGpu/DataBase/DataBaseAllocatorGPU.h
new file mode 100644
index 0000000000000000000000000000000000000000..bc1f62f884046553268331ddb3c578750b4ef686
--- /dev/null
+++ b/src/GksGpu/DataBase/DataBaseAllocatorGPU.h
@@ -0,0 +1,80 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 DataBaseAllocatorGPU.h
+//! \ingroup DataBase
+//! \author Stephan Lenz
+//=======================================================================================
+#ifndef DataBaseAllocatorGPU_H
+#define DatabaseAllocatorGPU_H
+
+#include "Core/DataTypes.h"
+#include "Core/PointerDefinitions.h"
+
+#include "DataBaseAllocator.h"
+
+#include "VirtualFluidsDefinitions.h"
+
+//! DataBaseAllocator for GPU memory
+class VF_PUBLIC DataBaseAllocatorGPU : public DataBaseAllocator {
+
+public:
+
+    //! frees DataBase memory
+    virtual void freeMemory( DataBase& dataBase ) override;
+
+    //! allocates DataBase memory
+    virtual void allocateMemory( SPtr<DataBase> dataBase ) override;
+
+    //! copies mesh information from GksMeshAdapter to DataBase
+    virtual void copyMesh( SPtr<DataBase> dataBase, GksMeshAdapter& adapter ) override;
+
+    //! copies the flow state data from DataBase::dataHost to DataBase::data
+    virtual void copyDataHostToDevice( SPtr<DataBase> dataBase ) override;
+    
+    //! copies the flow state data from DataBase::data to dataHost
+    virtual void copyDataDeviceToHost( SPtr<DataBase> dataBase, real* dataHost ) override;
+
+    //! \return the crash cell index from the device
+    virtual int  getCrashCellIndex( SPtr<DataBase> dataBase ) override;
+
+    //////////////////////////////////////////////////////////////////////////
+
+    //! frees boundary condition memory
+    virtual void freeMemory( BoundaryCondition& boundaryCondition ) override;
+
+    //! allocates boundary condition memory and copies data to device
+    virtual void allocateMemory( SPtr<BoundaryCondition> boundaryCondition, std::vector<uint> ghostCells, std::vector<uint> domainCells, std::vector<uint> secondCells ) override;
+
+    //////////////////////////////////////////////////////////////////////////
+
+    virtual std::string getDeviceType() override;
+};
+
+
+#endif
\ No newline at end of file
diff --git a/src/GksGpu/DataBase/DataBaseStruct.h b/src/GksGpu/DataBase/DataBaseStruct.h
new file mode 100644
index 0000000000000000000000000000000000000000..1b9029bd8014ee70df4e3fb600d57c62704b1d87
--- /dev/null
+++ b/src/GksGpu/DataBase/DataBaseStruct.h
@@ -0,0 +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 DataBaseStruct.h
+//! \ingroup DataBase
+//! \author Stephan Lenz
+//=======================================================================================
+#ifndef DataBaseStruct_H
+#define DataBaseStruct_H
+
+#include "Core/DataTypes.h"
+
+#include <VirtualFluidsDefinitions.h>
+
+//! Simple struct that carries variables for kernel execution
+struct VF_PUBLIC DataBaseStruct
+{
+    uint  numberOfCells;
+    uint  numberOfFaces;
+    
+    uint  numberOfCoarseGhostCells;
+    uint  numberOfFineGhostCells;
+
+    uint* cellToCell;
+    uint* faceToCell;
+
+    uint* parentCell;
+
+    uint* fineToCoarse;
+    uint* coarseToFine;
+
+    real* faceCenter;
+    real* cellCenter;
+
+    CellProperties* cellProperties;
+
+    char* faceOrientation;
+
+    real*            data;
+    realAccumulator* dataUpdate;
+
+    real* massFlux;
+
+    real* diffusivity;
+
+    int* crashCellIndex;
+};
+
+
+#endif
\ No newline at end of file
diff --git a/src/GksGpu/DataBase/package.include b/src/GksGpu/DataBase/package.include
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/src/GksGpu/Definitions/AccumulatorDataType.h b/src/GksGpu/Definitions/AccumulatorDataType.h
new file mode 100644
index 0000000000000000000000000000000000000000..cda429e493d44e799a7ae0c2d2b0936ecefdd9b1
--- /dev/null
+++ b/src/GksGpu/Definitions/AccumulatorDataType.h
@@ -0,0 +1,46 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  This file is part of VirtualFluids. VirtualFluids is free software: you can 
+//  redistribute it and/or modify it under the terms of the GNU General Public
+//  License as published by the Free Software Foundation, either version 3 of 
+//  the License, or (at your option) any later version.
+//  
+//  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT 
+//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
+//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License 
+//  for more details.
+//  
+//  You should have received a copy of the GNU General Public License along
+//  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+//
+//! \file AccumulatorDataType.h
+//! \ingroup Definitions
+//! \author Stephan Lenz
+//=======================================================================================
+#ifndef AccumulatorDataType_H
+#define AccumulatorDataType_H
+
+//! Datatype for DataBase::dataUpdate
+//! 
+//! It can be chosen independently of the real data type because 
+//! in the case of single precision computations using double 
+//! precision accumulator can prevent undeterministic behavior
+//! that stems from the order of addition to the accumulator.
+
+typedef float realAccumulator;
+//typedef double realAccumulator;
+
+#endif
diff --git a/src/GksGpu/Definitions/MemoryAccessPattern.h b/src/GksGpu/Definitions/MemoryAccessPattern.h
new file mode 100644
index 0000000000000000000000000000000000000000..863f4795a0cdea53e23648e4e99b96532a6a6761
--- /dev/null
+++ b/src/GksGpu/Definitions/MemoryAccessPattern.h
@@ -0,0 +1,126 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 MemoryAccessPattern.h
+//! \ingroup Definitions
+//! \author Stephan Lenz
+//=======================================================================================
+#ifndef DataDefinitions_H
+#define DataDefinitions_H
+
+#include "PassiveScalar.h"
+
+//! \file MemoryAccessPattern.h 
+//! The Macros defined in this file are used to switch between AOS and SOA data structures.
+//! The usage is:
+//! \code value = array[ MACRO(index, arrayLength) ] \endcode
+//! or 
+//! \code value = array[ MACRO(index, subIndex, arrayLength) ] \endcode
+
+//! this defines the memory access pattern and can either be AOS or SOA
+#define SOA
+
+//////////////////////////////////////////////////////////////////////////
+
+#define LENGTH_VECTOR       3           //!< number of components of a physical vector
+
+#ifdef USE_PASSIVE_SCALAR
+    #define LENGTH_CELL_DATA    7       //!< number of components of the flow state. <br>This accounts for density, three momentum components, energy and two passive scalars
+#else
+    #define LENGTH_CELL_DATA    5       //!< number of components of the flow state. <br>This accounts for density, three momentum components and energy
+#endif
+
+#define LENGTH_CELL_TO_CELL 6           //!< number of neighbor cells
+
+#define LENGTH_FACE_TO_CELL 2           //!< number of cells connected by a face
+
+#define LENGTH_FINE_TO_COARSE 9         //!< number of cells in the fine to coarse interpolation
+
+#define LENGTH_COARSE_TO_FINE 9         //!< number of cells in the coarse to fine interpolation
+
+//////////////////////////////////////////////////////////////////////////
+
+#ifdef SOA
+
+#define VEC_X(vecIdx, numberOfVectors)  ( 0 * numberOfVectors + vecIdx )        //!< computes position of x component in vector array
+#define VEC_Y(vecIdx, numberOfVectors)  ( 1 * numberOfVectors + vecIdx )        //!< computes position of y component in vector array
+#define VEC_Z(vecIdx, numberOfVectors)  ( 2 * numberOfVectors + vecIdx )        //!< computes position of z component in vector array
+                                                           
+#define RHO__( cellIdx, numberOfCells ) ( 0 * numberOfCells   + cellIdx )       //!< computes position of rho  component in DataBase::data array, or similar arrays
+#define RHO_U( cellIdx, numberOfCells ) ( 1 * numberOfCells   + cellIdx )       //!< computes position of rhoU component in DataBase::data array, or similar arrays
+#define RHO_V( cellIdx, numberOfCells ) ( 2 * numberOfCells   + cellIdx )       //!< computes position of rhoV component in DataBase::data array, or similar arrays
+#define RHO_W( cellIdx, numberOfCells ) ( 3 * numberOfCells   + cellIdx )       //!< computes position of rhoW component in DataBase::data array, or similar arrays
+#define RHO_E( cellIdx, numberOfCells ) ( 4 * numberOfCells   + cellIdx )       //!< computes position of rhoE component in DataBase::data array, or similar arrays
+
+#ifdef USE_PASSIVE_SCALAR
+    #define RHO_S_1( cellIdx, numberOfCells ) ( 5 * numberOfCells   + cellIdx ) //!< computes position of rho_S_1 component in data array
+    #define RHO_S_2( cellIdx, numberOfCells ) ( 6 * numberOfCells   + cellIdx ) //!< computes position of rho_S_2 component in data array
+#endif // USE_PASSIVE_SCALAR
+
+#define CELL_TO_CELL( cellIdx, neighborIdx, numberOfCells ) ( neighborIdx * numberOfCells + cellIdx )   //!< computes position of index of neighbor cell in  DataBase::cellToCell array
+
+#define NEG_CELL( faceIdx, numberOfFaces ) (                 faceIdx )          //!< computes position of positive cell index in faceToCell array
+#define POS_CELL( faceIdx, numberOfFaces ) ( numberOfFaces + faceIdx )          //!< computes position of negative cell index in faceToCell array
+
+#define FINE_TO_COARSE( idx, cellIdx, number ) ( cellIdx * number + idx )       //!< computes position of fine to coarse interpolation cell index in DataBase::fineToCoarse
+#define COARSE_TO_FINE( idx, cellIdx, number ) ( cellIdx * number + idx )       //!< computes position of coarse to fine interpolation cell index in DataBase::coarseToFine
+
+#endif
+
+//////////////////////////////////////////////////////////////////////////
+
+#ifdef AOS
+
+#define VEC_X(vecIdx, numberOfVectors)  ( vecIdx * LENGTH_VECTOR     )          //!< computes position of x component in vector array
+#define VEC_Y(vecIdx, numberOfVectors)  ( vecIdx * LENGTH_VECTOR + 1 )          //!< computes position of y component in vector array
+#define VEC_Z(vecIdx, numberOfVectors)  ( vecIdx * LENGTH_VECTOR + 2 )          //!< computes position of z component in vector array
+
+#define RHO__( cellIdx, numberOfCells ) ( cellIdx * LENGTH_CELL_DATA     )      //!< computes position of rho  component in DataBase::data array, or similar arrays
+#define RHO_U( cellIdx, numberOfCells ) ( cellIdx * LENGTH_CELL_DATA + 1 )      //!< computes position of rhoU component in DataBase::data array, or similar arrays
+#define RHO_V( cellIdx, numberOfCells ) ( cellIdx * LENGTH_CELL_DATA + 2 )      //!< computes position of rhoV component in DataBase::data array, or similar arrays
+#define RHO_W( cellIdx, numberOfCells ) ( cellIdx * LENGTH_CELL_DATA + 3 )      //!< computes position of rhoW component in DataBase::data array, or similar arrays
+#define RHO_E( cellIdx, numberOfCells ) ( cellIdx * LENGTH_CELL_DATA + 4 )      //!< computes position of rhoE component in DataBase::data array, or similar arrays
+
+#ifdef USE_PASSIVE_SCALAR
+    #define RHO_S_1( cellIdx, numberOfCells ) ( cellIdx * LENGTH_CELL_DATA + 5 )//!< computes position of rho_S_1 component in data array
+    #define RHO_S_2( cellIdx, numberOfCells ) ( cellIdx * LENGTH_CELL_DATA + 6 )//!< computes position of rho_S_2 component in data array
+#endif // USE_PASSIVE_SCALAR
+                                                                         
+#define CELL_TO_CELL( cellIdx, neighborIdx, numberOfCells ) ( cellIdx * LENGTH_CELL_TO_CELL + neighborIdx )//!< computes position of index of neighbor cell in  DataBase::cellToCell array
+
+#define NEG_CELL( faceIdx, numberOfFaces ) ( faceIdx * LENGTH_FACE_TO_CELL     )            //!< computes position of positive cell index in faceToCell array
+#define POS_CELL( faceIdx, numberOfFaces ) ( faceIdx * LENGTH_FACE_TO_CELL + 1 )            //!< computes position of negative cell index in faceToCell array
+
+#define FINE_TO_COARSE( idx, cellIdx, number ) ( cellIdx * LENGTH_FINE_TO_COARSE + idx )    //!< Computes position of fine to coarse interpolation cell index in DataBase::fineToCoarse
+#define COARSE_TO_FINE( idx, cellIdx, number ) ( cellIdx * LENGTH_COARSE_TO_FINE + idx )    //!< Computes position of coarse to fine interpolation cell index in DataBase::coarseToFine
+
+#endif
+
+//////////////////////////////////////////////////////////////////////////
+
+#endif
diff --git a/src/GksGpu/Definitions/PassiveScalar.h b/src/GksGpu/Definitions/PassiveScalar.h
new file mode 100644
index 0000000000000000000000000000000000000000..62f4e57bc270585eb16d284aef732b6d446e1acd
--- /dev/null
+++ b/src/GksGpu/Definitions/PassiveScalar.h
@@ -0,0 +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 PassiveScalar.h
+//! \ingroup Definitions
+//! \author Stephan Lenz
+//=======================================================================================
+#ifndef PassiveScalar_H
+#define PassiveScalar_H
+
+//! this defines, whether passive scalars are enabled or not
+//#define USE_PASSIVE_SCALAR
+
+#endif
diff --git a/src/GksGpu/Definitions/package.include b/src/GksGpu/Definitions/package.include
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/src/GksGpu/FlowStateData/AccessDeviceData.cuh b/src/GksGpu/FlowStateData/AccessDeviceData.cuh
new file mode 100644
index 0000000000000000000000000000000000000000..8ceaa7952479de0babb7fafddbb21f101b4815a9
--- /dev/null
+++ b/src/GksGpu/FlowStateData/AccessDeviceData.cuh
@@ -0,0 +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 AccessDeviceData.cuh
+//! \ingroup FlowStateData
+//! \author Stephan Lenz
+//=======================================================================================
+#ifndef AccessDeviceData_CUH
+#define AccessDeviceData_CUH
+
+#ifdef __CUDACC__
+#include <cuda_runtime.h>
+#else
+#define __host__
+#define __device__
+#endif
+
+#include "Core/DataTypes.h"
+#include "Core/RealConstants.h"
+
+#include "DataBase/DataBaseStruct.h"
+
+#include "Definitions/MemoryAccessPattern.h"
+#include "Definitions/PassiveScalar.h"
+
+#include "FlowStateData/FlowStateData.cuh"
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+//! \brief reads flow state from DataBase::data
+//! \param[in]  cellIdx    index of the cell from which the data is read
+//! \param[in]  dataBase   reference to a DataBaseStruct
+//! \param[out] cellCons   reference to ConservedVariables object in which the data is stored
+__host__ __device__ inline void readCellData(const uint cellIdx, const DataBaseStruct& dataBase, ConservedVariables& cellCons)
+{
+    cellCons.rho  = dataBase.data[ RHO__( cellIdx, dataBase.numberOfCells ) ];
+    cellCons.rhoU = dataBase.data[ RHO_U( cellIdx, dataBase.numberOfCells ) ];
+    cellCons.rhoV = dataBase.data[ RHO_V( cellIdx, dataBase.numberOfCells ) ];
+    cellCons.rhoW = dataBase.data[ RHO_W( cellIdx, dataBase.numberOfCells ) ];
+    cellCons.rhoE = dataBase.data[ RHO_E( cellIdx, dataBase.numberOfCells ) ];
+#ifdef USE_PASSIVE_SCALAR
+	cellCons.rhoS_1 = dataBase.data[ RHO_S_1( cellIdx, dataBase.numberOfCells ) ];
+	cellCons.rhoS_2 = dataBase.data[ RHO_S_2( cellIdx, dataBase.numberOfCells ) ];
+#endif // USE_PASSIVE_SCALAR
+}
+
+//! \brief writes flow state to DataBase::data
+//! \param[in]  cellIdx    index of the cell to which the data is written
+//! \param[in]  dataBase   reference to a DataBaseStruct
+//! \param[out] cellCons   reference to ConservedVariables object with the data that is written
+__host__ __device__ inline void writeCellData(const uint cellIdx, const DataBaseStruct& dataBase, ConservedVariables& cellCons)
+{
+    dataBase.data[ RHO__( cellIdx, dataBase.numberOfCells ) ] = cellCons.rho ;
+    dataBase.data[ RHO_U( cellIdx, dataBase.numberOfCells ) ] = cellCons.rhoU;
+    dataBase.data[ RHO_V( cellIdx, dataBase.numberOfCells ) ] = cellCons.rhoV;
+    dataBase.data[ RHO_W( cellIdx, dataBase.numberOfCells ) ] = cellCons.rhoW;
+    dataBase.data[ RHO_E( cellIdx, dataBase.numberOfCells ) ] = cellCons.rhoE;
+#ifdef USE_PASSIVE_SCALAR
+	dataBase.data[ RHO_S_1( cellIdx, dataBase.numberOfCells ) ] = cellCons.rhoS_1;
+	dataBase.data[ RHO_S_2( cellIdx, dataBase.numberOfCells ) ] = cellCons.rhoS_2;
+#endif // USE_PASSIVE_SCALAR
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+//! \brief reads flow state update from DataBase::dataUpdate
+//! \param[in]  cellIdx    index of the cell from which the data is read
+//! \param[in]  dataBase   reference to a DataBaseStruct
+//! \param[out] cellCons   reference to ConservedVariables object in which the data is stored
+__host__ __device__ inline void readCellDataUpdate(const uint cellIdx, const DataBaseStruct& dataBase, ConservedVariables& cellCons)
+{
+    cellCons.rho  = dataBase.dataUpdate[ RHO__( cellIdx, dataBase.numberOfCells ) ];
+    cellCons.rhoU = dataBase.dataUpdate[ RHO_U( cellIdx, dataBase.numberOfCells ) ];
+    cellCons.rhoV = dataBase.dataUpdate[ RHO_V( cellIdx, dataBase.numberOfCells ) ];
+    cellCons.rhoW = dataBase.dataUpdate[ RHO_W( cellIdx, dataBase.numberOfCells ) ];
+    cellCons.rhoE = dataBase.dataUpdate[ RHO_E( cellIdx, dataBase.numberOfCells ) ];
+#ifdef USE_PASSIVE_SCALAR
+	cellCons.rhoS_1 = dataBase.dataUpdate[ RHO_S_1( cellIdx, dataBase.numberOfCells ) ];
+	cellCons.rhoS_2 = dataBase.dataUpdate[ RHO_S_2( cellIdx, dataBase.numberOfCells ) ];
+#endif // USE_PASSIVE_SCALAR
+}
+
+//! \brief writes flow state update to DataBase::dataUpdate
+//! \param[in]  cellIdx    index of the cell to which the data is written
+//! \param[in]  dataBase   reference to a DataBaseStruct
+//! \param[out] cellCons   reference to ConservedVariables object with the data that is written
+__host__ __device__ inline void writeCellDataUpdate(const uint cellIdx, const DataBaseStruct& dataBase, ConservedVariables& cellCons)
+{
+    dataBase.dataUpdate[ RHO__( cellIdx, dataBase.numberOfCells ) ] = cellCons.rho ;
+    dataBase.dataUpdate[ RHO_U( cellIdx, dataBase.numberOfCells ) ] = cellCons.rhoU;
+    dataBase.dataUpdate[ RHO_V( cellIdx, dataBase.numberOfCells ) ] = cellCons.rhoV;
+    dataBase.dataUpdate[ RHO_W( cellIdx, dataBase.numberOfCells ) ] = cellCons.rhoW;
+    dataBase.dataUpdate[ RHO_E( cellIdx, dataBase.numberOfCells ) ] = cellCons.rhoE;
+#ifdef USE_PASSIVE_SCALAR
+	dataBase.dataUpdate[ RHO_S_1( cellIdx, dataBase.numberOfCells ) ] = cellCons.rhoS_1;
+	dataBase.dataUpdate[ RHO_S_2( cellIdx, dataBase.numberOfCells ) ] = cellCons.rhoS_2;
+#endif // USE_PASSIVE_SCALAR
+}
+
+#endif
\ No newline at end of file
diff --git a/src/GksGpu/FlowStateData/FlowStateData.cuh b/src/GksGpu/FlowStateData/FlowStateData.cuh
new file mode 100644
index 0000000000000000000000000000000000000000..535980863b9bfe1adb27e1d9d7c3cec71b1e158e
--- /dev/null
+++ b/src/GksGpu/FlowStateData/FlowStateData.cuh
@@ -0,0 +1,297 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 FlowStateData.cuh
+//! \ingroup FlowStateData
+//! \author Stephan Lenz
+//=======================================================================================
+#ifndef FlowStateData_H
+#define FlowStateData_H
+
+#ifdef __CUDACC__
+#include <cuda_runtime.h>
+#else
+#define __host__
+#define __device__
+#endif
+
+#include "Core/DataTypes.h"
+#include "Core/RealConstants.h"
+
+#include "Definitions/PassiveScalar.h"
+
+//////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////
+
+//! \brief Holds flow state data in terms of primitive variables
+struct PrimitiveVariables
+{
+    real rho;
+    real U;
+    real V;
+    real W;
+    real lambda;
+    #ifdef USE_PASSIVE_SCALAR
+    real S_1;
+    real S_2;
+    #endif
+
+    //////////////////////////////////////////////////////////////////////////
+
+    //! default constructor that sets all values to zero
+    __host__ __device__ PrimitiveVariables()
+		: rho   (c0o1)
+         ,U     (c0o1)
+         ,V     (c0o1)
+         ,W     (c0o1)
+         ,lambda(c0o1)
+    #ifdef USE_PASSIVE_SCALAR
+         ,S_1   (c0o1)
+         ,S_2   (c0o1)
+    #endif
+    {}
+
+    //////////////////////////////////////////////////////////////////////////
+
+    //! constructor that initializes the variables according to the arguments
+    __host__ __device__ PrimitiveVariables(real rho
+                                          ,real U
+                                          ,real V
+                                          ,real W
+                                          ,real lambda
+    #ifdef USE_PASSIVE_SCALAR
+                                          ,real S_1 = c0o1
+                                          ,real S_2 = c0o1
+    #endif
+    )
+        : rho   (rho   )
+         ,U     (U     )
+         ,V     (V     )
+         ,W     (W     )
+         ,lambda(lambda)
+    #ifdef USE_PASSIVE_SCALAR
+         ,S_1   (S_1   )
+         ,S_2   (S_2   )
+    #endif
+    {}
+
+    //////////////////////////////////////////////////////////////////////////
+};
+
+//////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////
+
+//! \brief Holds flow state data in terms of conserved variables
+struct ConservedVariables
+{
+    real rho;
+    real rhoU;
+    real rhoV;
+    real rhoW;
+    real rhoE;
+    #ifdef USE_PASSIVE_SCALAR
+    real rhoS_1;
+    real rhoS_2;
+    #endif
+
+    //////////////////////////////////////////////////////////////////////////
+
+    //! default constructor that sets all values to zero
+    __host__ __device__ ConservedVariables()
+        : rho (c0o1)
+         ,rhoU(c0o1)
+         ,rhoV(c0o1)
+         ,rhoW(c0o1)
+         ,rhoE(c0o1)
+    #ifdef USE_PASSIVE_SCALAR
+         ,rhoS_1(c0o1)
+         ,rhoS_2(c0o1)
+    #endif
+    {}
+
+    //////////////////////////////////////////////////////////////////////////
+		  
+    //! constructor that initializes the variables according to the arguments
+    __host__ __device__ ConservedVariables(real rho
+                                          ,real rhoU
+                                          ,real rhoV
+                                          ,real rhoW
+                                          ,real rhoE
+    #ifdef USE_PASSIVE_SCALAR
+                                          ,real rhoS_1 = c0o1
+                                          ,real rhoS_2 = c0o1
+    #endif
+    )
+        : rho (rho )
+         ,rhoU(rhoU)
+         ,rhoV(rhoV)
+         ,rhoW(rhoW)
+         ,rhoE(rhoE)
+    #ifdef USE_PASSIVE_SCALAR
+         ,rhoS_1(rhoS_1)
+         ,rhoS_2(rhoS_2)
+    #endif
+    {}
+
+    //////////////////////////////////////////////////////////////////////////
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+//! \return the sum of all components of the two PrimitiveVariables left and right as PrimitiveVariables object
+__host__ __device__ inline PrimitiveVariables operator+ ( const PrimitiveVariables& left, const PrimitiveVariables& right )
+{
+    PrimitiveVariables result;
+
+    result.rho    = left.rho    + right.rho   ;
+    result.U      = left.U      + right.U     ;
+    result.V      = left.V      + right.V     ;
+    result.W      = left.W      + right.W     ;
+    result.lambda = left.lambda + right.lambda;
+
+#ifdef USE_PASSIVE_SCALAR
+    result.S_1    = left.S_1    + right.S_1   ;
+    result.S_2    = left.S_2    + right.S_2   ;
+#endif
+
+    return result;
+}
+
+//! \return the sum of all components of two ConservedVariables left and right as ConservedVariables object
+__host__ __device__ inline ConservedVariables operator+ ( const ConservedVariables& left, const ConservedVariables& right )
+{
+    ConservedVariables result;
+
+    result.rho    = left.rho    + right.rho   ;
+    result.rhoU   = left.rhoU   + right.rhoU  ;
+    result.rhoV   = left.rhoV   + right.rhoV  ;
+    result.rhoW   = left.rhoW   + right.rhoW  ;
+    result.rhoE   = left.rhoE   + right.rhoE  ;
+
+#ifdef USE_PASSIVE_SCALAR
+    result.rhoS_1 = left.rhoS_1 + right.rhoS_1;
+    result.rhoS_2 = left.rhoS_2 + right.rhoS_2;
+#endif
+
+    return result;
+}
+
+//////////////////////////////////////////////////////////////////////////
+
+//! \return the difference of all components of the two PrimitiveVariables left and right as PrimitiveVariables object
+__host__ __device__ inline PrimitiveVariables operator- ( const PrimitiveVariables& left, const PrimitiveVariables& right )
+{
+    PrimitiveVariables result;
+
+    result.rho    = left.rho    - right.rho   ;
+    result.U      = left.U      - right.U     ;
+    result.V      = left.V      - right.V     ;
+    result.W      = left.W      - right.W     ;
+    result.lambda = left.lambda - right.lambda;
+
+#ifdef USE_PASSIVE_SCALAR
+    result.S_1    = left.S_1    - right.S_1   ;
+    result.S_2    = left.S_2    - right.S_2   ;
+#endif
+
+    return result;
+}
+
+//! \return the difference of all components of two ConservedVariables left and right as ConservedVariables object
+__host__ __device__ inline ConservedVariables operator- ( const ConservedVariables& left, const ConservedVariables& right )
+{
+    ConservedVariables result;
+
+    result.rho    = left.rho    - right.rho   ;
+    result.rhoU   = left.rhoU   - right.rhoU  ;
+    result.rhoV   = left.rhoV   - right.rhoV  ;
+    result.rhoW   = left.rhoW   - right.rhoW  ;
+    result.rhoE   = left.rhoE   - right.rhoE  ;
+
+#ifdef USE_PASSIVE_SCALAR
+    result.rhoS_1 = left.rhoS_1 - right.rhoS_1;
+    result.rhoS_2 = left.rhoS_2 - right.rhoS_2;
+#endif
+
+    return result;
+}
+
+//////////////////////////////////////////////////////////////////////////
+
+//! \return the product of the scalar left and all components of the PrimitiveVariables right as PrimitiveVariables object
+__host__ __device__ inline PrimitiveVariables operator* ( const real left, const PrimitiveVariables& right )
+{
+    PrimitiveVariables result;
+
+    result.rho    = left * right.rho   ;
+    result.U      = left * right.U     ;
+    result.V      = left * right.V     ;
+    result.W      = left * right.W     ;
+    result.lambda = left * right.lambda;
+
+#ifdef USE_PASSIVE_SCALAR
+    result.S_1    = left * right.S_1   ;
+    result.S_2    = left * right.S_2   ;
+#endif
+
+    return result;
+}
+
+//! \return the product of the scalar left and all components of the ConservedVariables right as ConservedVariables object
+__host__ __device__ inline ConservedVariables operator* ( const real left, const ConservedVariables& right )
+{
+    ConservedVariables result;
+
+    result.rho    = left * right.rho   ;
+    result.rhoU   = left * right.rhoU  ;
+    result.rhoV   = left * right.rhoV  ;
+    result.rhoW   = left * right.rhoW  ;
+    result.rhoE   = left * right.rhoE  ;
+
+#ifdef USE_PASSIVE_SCALAR
+    result.rhoS_1 = left * right.rhoS_1;
+    result.rhoS_2 = left * right.rhoS_2;
+#endif
+
+    return result;
+}
+
+#endif
+
diff --git a/src/GksGpu/FlowStateData/FlowStateDataConversion.cuh b/src/GksGpu/FlowStateData/FlowStateDataConversion.cuh
new file mode 100644
index 0000000000000000000000000000000000000000..dbc9f2bb6ce0f59942babb740f782bc8857ed311
--- /dev/null
+++ b/src/GksGpu/FlowStateData/FlowStateDataConversion.cuh
@@ -0,0 +1,112 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 FlowStateDataConversion.cuh
+//! \ingroup FlowStateData
+//! \author Stephan Lenz
+//=======================================================================================
+#ifndef FlowStateDataConversion_H
+#define FlowStateDataConversion_H
+
+#ifdef __CUDACC__
+#include <cuda_runtime.h>
+#else
+#define __host__
+#define __device__
+#endif
+
+#include "Core/DataTypes.h"
+#include "Core/RealConstants.h"
+
+#include "Definitions/PassiveScalar.h"
+
+#include "FlowStateData/FlowStateData.cuh"
+
+//////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////
+
+//! \brief transforms PrimitiveVariables objects to ConservedVariables objects
+//! \param prim        PrimitiveVariables object
+//! \param K           number of internal degrees of freedom
+//! \param overrideK   deprecated argument
+//! \return the corresponding ConservedVariables of the PrimitiveVariables prim
+__host__ __device__ inline ConservedVariables toConservedVariables( const PrimitiveVariables& prim, real K, bool overrideK = true )
+{
+#ifdef USE_PASSIVE_SCALAR
+    return ConservedVariables(prim.rho
+                             ,prim.U * prim.rho
+                             ,prim.V * prim.rho
+                             ,prim.W * prim.rho
+                             ,( K + c3o1 ) / ( c4o1 * prim.lambda ) * prim.rho + c1o2 * prim.rho * ( prim.U * prim.U + prim.V * prim.V + prim.W * prim.W )
+                             ,prim.S_1 * prim.rho
+                             ,prim.S_2 * prim.rho
+    );
+#else
+    return ConservedVariables(prim.rho
+                             ,prim.U * prim.rho
+                             ,prim.V * prim.rho
+                             ,prim.W * prim.rho
+                             ,( K + c3o1 ) / ( c4o1 * prim.lambda ) * prim.rho + c1o2 * prim.rho * ( prim.U * prim.U + prim.V * prim.V + prim.W * prim.W )
+    );
+#endif
+}
+
+//////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////
+
+//! \brief transforms ConservedVariables objects to PrimitiveVariables objects
+//! \param cons        ConservedVariables object
+//! \param K           number of internal degrees of freedom
+//! \param overrideK   deprecated argument
+//! \return the corresponding PrimitiveVariables of the ConservedVariables prim
+__host__ __device__ inline PrimitiveVariables toPrimitiveVariables( const ConservedVariables& cons, real K, bool overrideK = true )
+{
+
+#ifdef USE_PASSIVE_SCALAR
+	return PrimitiveVariables(cons.rho
+						     ,cons.rhoU / cons.rho
+						     ,cons.rhoV / cons.rho
+						     ,cons.rhoW / cons.rho
+						     ,( K + c3o1 ) * cons.rho / ( c4o1 * ( cons.rhoE - c1o2 * ( cons.rhoU * cons.rhoU + cons.rhoV * cons.rhoV + cons.rhoW * cons.rhoW ) / cons.rho ) )
+                             ,cons.rhoS_1 / cons.rho
+                             ,cons.rhoS_2 / cons.rho
+	);
+#else
+	return PrimitiveVariables(cons.rho
+						     ,cons.rhoU / cons.rho
+						     ,cons.rhoV / cons.rho
+						     ,cons.rhoW / cons.rho
+						     ,( K + c3o1 ) * cons.rho / ( c4o1 * ( cons.rhoE - c1o2 * ( cons.rhoU * cons.rhoU + cons.rhoV * cons.rhoV + cons.rhoW * cons.rhoW ) / cons.rho ) )
+	);
+#endif
+}
+
+#endif
+
diff --git a/src/GksGpu/FlowStateData/package.include b/src/GksGpu/FlowStateData/package.include
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/src/GksGpu/FluxComputation/ApplyFlux.cuh b/src/GksGpu/FluxComputation/ApplyFlux.cuh
new file mode 100644
index 0000000000000000000000000000000000000000..b8c28209da4ac16aa8ea1048f527d17e2c991271
--- /dev/null
+++ b/src/GksGpu/FluxComputation/ApplyFlux.cuh
@@ -0,0 +1,182 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 ApplyFlux.cuh
+//! \ingroup FluxComputation
+//! \author Stephan Lenz
+//=======================================================================================
+#ifndef ApplyFlux_CUH
+#define ApplyFlux_CUH
+
+#include "VirtualFluidsDefinitions.h"
+
+#include "Core/DataTypes.h"
+
+#include "DataBase/DataBase.h"
+
+#include "FlowStateData/FlowStateData.cuh"
+#include "FlowStateData/AccessDeviceData.cuh"
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+//! \brief This function applies the negative flux to the \ref DataBase::dataUpdate variable of the cell with index negCellIdx
+//! 
+//! \param dataBase     \ref DataBaseStruct that holds the memory pointers
+//! \param negCellIdx   index of the negative cell
+//! \param flux         flux that goes from negative to positive cell
+//! \param direction    char with 'x', 'y' or 'z', used for mass flux computation
+//! \param parameters   \ref Parameters struct
+__host__ __device__ inline void applyFluxToNegCell( const DataBaseStruct& dataBase,
+                                                    const uint& negCellIdx,
+                                                    const ConservedVariables& flux,
+                                                    const char direction,
+                                                    const Parameters& parameters)
+{
+    realAccumulator* dataUpdate = dataBase.dataUpdate;
+
+#if (defined(__CUDA_ARCH__) && (__CUDA_ARCH__ > 0))
+    atomicAdd( &( dataUpdate[ RHO__(negCellIdx, dataBase.numberOfCells) ] ), - (realAccumulator)flux.rho  );
+    atomicAdd( &( dataUpdate[ RHO_U(negCellIdx, dataBase.numberOfCells) ] ), - (realAccumulator)flux.rhoU );
+    atomicAdd( &( dataUpdate[ RHO_V(negCellIdx, dataBase.numberOfCells) ] ), - (realAccumulator)flux.rhoV );
+    atomicAdd( &( dataUpdate[ RHO_W(negCellIdx, dataBase.numberOfCells) ] ), - (realAccumulator)flux.rhoW );
+    atomicAdd( &( dataUpdate[ RHO_E(negCellIdx, dataBase.numberOfCells) ] ), - (realAccumulator)flux.rhoE );
+#ifdef USE_PASSIVE_SCALAR
+	atomicAdd( &( dataUpdate[ RHO_S_1(negCellIdx, dataBase.numberOfCells) ] ), - (realAccumulator)flux.rhoS_1 );
+	atomicAdd( &( dataUpdate[ RHO_S_2(negCellIdx, dataBase.numberOfCells) ] ), - (realAccumulator)flux.rhoS_2 );
+#endif // USE_PASSIVE_SCALAR
+    
+    if( parameters.forcingSchemeIdx == 0 || parameters.forcingSchemeIdx == 1 )
+    {
+        if (direction == 'x')
+            atomicAdd(&(dataBase.massFlux[VEC_X(negCellIdx, dataBase.numberOfCells)]), flux.rho);
+        if (direction == 'y')
+            atomicAdd(&(dataBase.massFlux[VEC_Y(negCellIdx, dataBase.numberOfCells)]), flux.rho);
+        if (direction == 'z')
+            atomicAdd(&(dataBase.massFlux[VEC_Z(negCellIdx, dataBase.numberOfCells)]), flux.rho);
+    }
+#else
+#pragma omp atomic
+    dataUpdate[ RHO__(negCellIdx, dataBase.numberOfCells) ] -= flux.rho ;
+#pragma omp atomic
+    dataUpdate[ RHO_U(negCellIdx, dataBase.numberOfCells) ] -= flux.rhoU;
+#pragma omp atomic
+    dataUpdate[ RHO_V(negCellIdx, dataBase.numberOfCells) ] -= flux.rhoV;
+#pragma omp atomic
+    dataUpdate[ RHO_W(negCellIdx, dataBase.numberOfCells) ] -= flux.rhoW;
+#pragma omp atomic
+    dataUpdate[ RHO_E(negCellIdx, dataBase.numberOfCells) ] -= flux.rhoE;
+#ifdef USE_PASSIVE_SCALAR
+#pragma omp atomic
+	dataUpdate[ RHO_S_1(negCellIdx, dataBase.numberOfCells) ] -= flux.rhoS_1;
+	dataUpdate[ RHO_S_2(negCellIdx, dataBase.numberOfCells) ] -= flux.rhoS_2;
+#endif // USE_PASSIVE_SCALAR
+
+    if( parameters.forcingSchemeIdx == 0 || parameters.forcingSchemeIdx == 1 )
+    {
+        if( direction == 'x' )
+    #pragma omp atomic
+            dataBase.massFlux[ VEC_X(negCellIdx, dataBase.numberOfCells) ] += flux.rho;
+        if( direction == 'y' )
+    #pragma omp atomic
+            dataBase.massFlux[ VEC_Y(negCellIdx, dataBase.numberOfCells) ] += flux.rho;
+        if( direction == 'z' )
+    #pragma omp atomic
+            dataBase.massFlux[ VEC_Z(negCellIdx, dataBase.numberOfCells) ] += flux.rho;
+    }
+#endif
+
+}
+
+//! \brief This function applies the positive flux to the \ref DataBase::dataUpdate variable of the cell with index posCellIdx
+//! 
+//! \param dataBase     \ref DataBaseStruct that holds the memory pointers
+//! \param posCellIdx   index of the positive cell
+//! \param flux         flux that goes from negative to positive cell
+//! \param direction    char with 'x', 'y' or 'z', used for mass flux computation
+//! \param parameters   \ref Parameters struct
+__host__ __device__ inline void applyFluxToPosCell( const DataBaseStruct& dataBase,
+                                                    const uint& posCellIdx,
+                                                    const ConservedVariables& flux,
+                                                    const char& direction,
+                                                    const Parameters& parameters)
+{
+    realAccumulator* dataUpdate = dataBase.dataUpdate;
+
+#if (defined(__CUDA_ARCH__) && (__CUDA_ARCH__ > 0))
+    atomicAdd( &( dataUpdate[ RHO__(posCellIdx, dataBase.numberOfCells) ] ),   (realAccumulator)flux.rho  );
+    atomicAdd( &( dataUpdate[ RHO_U(posCellIdx, dataBase.numberOfCells) ] ),   (realAccumulator)flux.rhoU );
+    atomicAdd( &( dataUpdate[ RHO_V(posCellIdx, dataBase.numberOfCells) ] ),   (realAccumulator)flux.rhoV );
+    atomicAdd( &( dataUpdate[ RHO_W(posCellIdx, dataBase.numberOfCells) ] ),   (realAccumulator)flux.rhoW );
+    atomicAdd( &( dataUpdate[ RHO_E(posCellIdx, dataBase.numberOfCells) ] ),   (realAccumulator)flux.rhoE );
+#ifdef USE_PASSIVE_SCALAR
+	atomicAdd( &( dataUpdate[ RHO_S_1(posCellIdx, dataBase.numberOfCells) ] ),   (realAccumulator)flux.rhoS_1 );
+	atomicAdd( &( dataUpdate[ RHO_S_2(posCellIdx, dataBase.numberOfCells) ] ),   (realAccumulator)flux.rhoS_2 );
+#endif // USE_PASSIVE_SCALAR
+    
+    if( parameters.forcingSchemeIdx == 0 || parameters.forcingSchemeIdx == 1 )
+    {
+        if (direction == 'x')
+            atomicAdd(&(dataBase.massFlux[VEC_X(posCellIdx, dataBase.numberOfCells)]), flux.rho);
+        if (direction == 'y')
+            atomicAdd(&(dataBase.massFlux[VEC_Y(posCellIdx, dataBase.numberOfCells)]), flux.rho);
+        if (direction == 'z')
+            atomicAdd(&(dataBase.massFlux[VEC_Z(posCellIdx, dataBase.numberOfCells)]), flux.rho);
+    }
+#else
+#pragma omp atomic
+    dataUpdate[ RHO__(posCellIdx, dataBase.numberOfCells) ] += flux.rho ;
+#pragma omp atomic
+    dataUpdate[ RHO_U(posCellIdx, dataBase.numberOfCells) ] += flux.rhoU;
+#pragma omp atomic
+    dataUpdate[ RHO_V(posCellIdx, dataBase.numberOfCells) ] += flux.rhoV;
+#pragma omp atomic
+    dataUpdate[ RHO_W(posCellIdx, dataBase.numberOfCells) ] += flux.rhoW;
+#pragma omp atomic
+    dataUpdate[ RHO_E(posCellIdx, dataBase.numberOfCells) ] += flux.rhoE;
+#ifdef USE_PASSIVE_SCALAR
+#pragma omp atomic
+	dataUpdate[ RHO_S_1(posCellIdx, dataBase.numberOfCells) ] += flux.rhoS_1;
+	dataUpdate[ RHO_S_2(posCellIdx, dataBase.numberOfCells) ] += flux.rhoS_2;
+#endif // USE_PASSIVE_SCALAR
+    
+    if( parameters.forcingSchemeIdx == 0 || parameters.forcingSchemeIdx == 1 )
+    {
+        if (direction == 'x')
+    #pragma omp atomic
+            dataBase.massFlux[VEC_X(posCellIdx, dataBase.numberOfCells)] += flux.rho;
+        if (direction == 'y')
+    #pragma omp atomic
+            dataBase.massFlux[VEC_Y(posCellIdx, dataBase.numberOfCells)] += flux.rho;
+        if (direction == 'z')
+    #pragma omp atomic
+            dataBase.massFlux[VEC_Z(posCellIdx, dataBase.numberOfCells)] += flux.rho;
+    }
+#endif
+}
+
+#endif
\ No newline at end of file
diff --git a/src/GksGpu/FluxComputation/AssembleFlux.cuh b/src/GksGpu/FluxComputation/AssembleFlux.cuh
new file mode 100644
index 0000000000000000000000000000000000000000..e49873c76115061af68a0226c10aeb0d6502fd29
--- /dev/null
+++ b/src/GksGpu/FluxComputation/AssembleFlux.cuh
@@ -0,0 +1,635 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 AssembleFlux.cuh
+//! \ingroup FluxComputation
+//! \author Stephan Lenz
+//=======================================================================================
+#ifndef AssembleFlux_CUH
+#define AssembleFlux_CUH
+
+#include "VirtualFluidsDefinitions.h"
+
+#include "Core/DataTypes.h"
+#include "Core/RealConstants.h"
+
+#include "DataBase/DataBase.h"
+#include "Parameters/Parameters.h"
+
+#include "FlowStateData/FlowStateData.cuh"
+#include "FlowStateData/AccessDeviceData.cuh"
+
+#include "FluxComputation/SutherlandsLaw.cuh"
+#include "FluxComputation/Moments.cuh"
+
+extern __device__ real atomicAdd(real* address, real val);
+
+#define NUMBER_OF_MOMENTS 7
+
+//////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////
+
+//! \brief Computes the time derivative of the conserved variables based on 
+//!  expansion coefficients and moments of the equilibrium distribution
+//!
+//! This function implements the expanded equations found in Eq. (17) in 
+//! <a href="https://doi.org/10.1016/j.ijthermalsci.2018.10.004"><b>[ Lenz et al. (2019), DOI: 10.1016/j.ijthermalsci.2018.10.004 ]</b></a>.
+//! which is based on 
+//! <a href="https://doi.org/10.1006/jcph.2001.6790"><b>[ Kun Xu (2001), DOI: 10.1006/jcph.2001.6790 ]</b></a>
+//! and 
+//! <a href="https://doi.org/10.1016/j.jcp.2007.06.024"><b>[ Tian et al. (2007), DOI: 10.1016/j.jcp.2007.06.024 ]</b></a>.
+//!
+//! Part of the equations was expanded using a computer algebra system 
+//! and are, hence, not well structured.
+//! 
+//! \param[in]  facePrim       flow state on the interface as \ref PrimitiveVariables
+//! \param[in]  momentU        array of moments of the equilibrium function with respect to x-velocity
+//! \param[in]  momentV        array of moments of the equilibrium function with respect to y-velocity
+//! \param[in]  momentW        array of moments of the equilibrium function with respect to z-velocity
+//! \param[in]  momentXi       array of moments of the equilibrium function with respect to internal degrees of freedom
+//! \param[in]  ax             array of spatial expansion coefficients of the Taylor expansion of the equilibrium distribution
+//! \param[in]  ay             array of spatial expansion coefficients of the Taylor expansion of the equilibrium distribution 
+//! \param[in]  az             array of spatial expansion coefficients of the Taylor expansion of the equilibrium distribution
+//! \param[in]  force          volume force vector
+//! \param[out] timeGrad       time derivatives of the \ref ConservedVariables
+__host__ __device__ inline void computeTimeDerivative( const PrimitiveVariables& facePrim, 
+                                                       const real momentU [ NUMBER_OF_MOMENTS ], 
+                                                       const real momentV [ NUMBER_OF_MOMENTS ], 
+                                                       const real momentW [ NUMBER_OF_MOMENTS ], 
+                                                       const real momentXi[ NUMBER_OF_MOMENTS ],
+                                                       const real ax[LENGTH_CELL_DATA],
+                                                       const real ay[LENGTH_CELL_DATA],
+                                                       const real az[LENGTH_CELL_DATA],
+                                                       const Vec3& force,
+                                                       ConservedVariables& timeGrad )
+{
+    timeGrad.rho = ax[0]*momentU[1] + ax[1]*momentU[2] + c1o2*ax[4]*momentU[3] + ay[0]*momentV[1] + 
+   ax[2]*momentU[1]*momentV[1] + ay[1]*momentU[1]*momentV[1] + 
+   c1o2*ay[4]*momentU[2]*momentV[1] + ay[2]*momentV[2] + c1o2*ax[4]*momentU[1]*momentV[2] + 
+   c1o2*ay[4]*momentV[3] + az[0]*momentW[1] + ax[3]*momentU[1]*momentW[1] + 
+   az[1]*momentU[1]*momentW[1] + c1o2*az[4]*momentU[2]*momentW[1] + 
+   ay[3]*momentV[1]*momentW[1] + az[2]*momentV[1]*momentW[1] + 
+   c1o2*az[4]*momentV[2]*momentW[1] + az[3]*momentW[2] + c1o2*ax[4]*momentU[1]*momentW[2] + 
+   c1o2*ay[4]*momentV[1]*momentW[2] + c1o2*az[4]*momentW[3] + 
+   c1o2*ax[4]*momentU[1]*momentXi[2] + c1o2*ay[4]*momentV[1]*momentXi[2] + 
+   c1o2*az[4]*momentW[1]*momentXi[2];
+
+    timeGrad.rhoU = ax[0]*momentU[2] + ax[1]*momentU[3] + c1o2*ax[4]*momentU[4] + 
+   ay[0]*momentU[1]*momentV[1] + ax[2]*momentU[2]*momentV[1] + 
+   ay[1]*momentU[2]*momentV[1] + c1o2*ay[4]*momentU[3]*momentV[1] + 
+   ay[2]*momentU[1]*momentV[2] + c1o2*ax[4]*momentU[2]*momentV[2] + 
+   c1o2*ay[4]*momentU[1]*momentV[3] + az[0]*momentU[1]*momentW[1] + 
+   ax[3]*momentU[2]*momentW[1] + az[1]*momentU[2]*momentW[1] + 
+   c1o2*az[4]*momentU[3]*momentW[1] + ay[3]*momentU[1]*momentV[1]*momentW[1] + 
+   az[2]*momentU[1]*momentV[1]*momentW[1] + c1o2*az[4]*momentU[1]*momentV[2]*momentW[1] + 
+   az[3]*momentU[1]*momentW[2] + c1o2*ax[4]*momentU[2]*momentW[2] + 
+   c1o2*ay[4]*momentU[1]*momentV[1]*momentW[2] + c1o2*az[4]*momentU[1]*momentW[3] + 
+   c1o2*ax[4]*momentU[2]*momentXi[2] + c1o2*ay[4]*momentU[1]*momentV[1]*momentXi[2] + 
+   c1o2*az[4]*momentU[1]*momentW[1]*momentXi[2];
+
+    timeGrad.rhoV = ax[0]*momentU[1]*momentV[1] + ax[1]*momentU[2]*momentV[1] + 
+   c1o2*ax[4]*momentU[3]*momentV[1] + ay[0]*momentV[2] + ax[2]*momentU[1]*momentV[2] + 
+   ay[1]*momentU[1]*momentV[2] + c1o2*ay[4]*momentU[2]*momentV[2] + ay[2]*momentV[3] + 
+   c1o2*ax[4]*momentU[1]*momentV[3] + c1o2*ay[4]*momentV[4] + az[0]*momentV[1]*momentW[1] + 
+   ax[3]*momentU[1]*momentV[1]*momentW[1] + az[1]*momentU[1]*momentV[1]*momentW[1] + 
+   c1o2*az[4]*momentU[2]*momentV[1]*momentW[1] + ay[3]*momentV[2]*momentW[1] + 
+   az[2]*momentV[2]*momentW[1] + c1o2*az[4]*momentV[3]*momentW[1] + 
+   az[3]*momentV[1]*momentW[2] + c1o2*ax[4]*momentU[1]*momentV[1]*momentW[2] + 
+   c1o2*ay[4]*momentV[2]*momentW[2] + c1o2*az[4]*momentV[1]*momentW[3] + 
+   c1o2*ax[4]*momentU[1]*momentV[1]*momentXi[2] + c1o2*ay[4]*momentV[2]*momentXi[2] + 
+   c1o2*az[4]*momentV[1]*momentW[1]*momentXi[2];
+
+    timeGrad.rhoW = ax[0]*momentU[1]*momentW[1] + ax[1]*momentU[2]*momentW[1] + 
+   c1o2*ax[4]*momentU[3]*momentW[1] + ay[0]*momentV[1]*momentW[1] + 
+   ax[2]*momentU[1]*momentV[1]*momentW[1] + ay[1]*momentU[1]*momentV[1]*momentW[1] + 
+   c1o2*ay[4]*momentU[2]*momentV[1]*momentW[1] + ay[2]*momentV[2]*momentW[1] + 
+   c1o2*ax[4]*momentU[1]*momentV[2]*momentW[1] + c1o2*ay[4]*momentV[3]*momentW[1] + 
+   az[0]*momentW[2] + ax[3]*momentU[1]*momentW[2] + az[1]*momentU[1]*momentW[2] + 
+   c1o2*az[4]*momentU[2]*momentW[2] + ay[3]*momentV[1]*momentW[2] + 
+   az[2]*momentV[1]*momentW[2] + c1o2*az[4]*momentV[2]*momentW[2] + az[3]*momentW[3] + 
+   c1o2*ax[4]*momentU[1]*momentW[3] + c1o2*ay[4]*momentV[1]*momentW[3] + 
+   c1o2*az[4]*momentW[4] + c1o2*ax[4]*momentU[1]*momentW[1]*momentXi[2] + 
+   c1o2*ay[4]*momentV[1]*momentW[1]*momentXi[2] + c1o2*az[4]*momentW[2]*momentXi[2];
+
+    timeGrad.rhoE = c1o2*ax[0]*momentU[3] + c1o2*ax[1]*momentU[4] + c1o4*ax[4]*momentU[5] + 
+   c1o2*ay[0]*momentU[2]*momentV[1] + c1o2*ax[2]*momentU[3]*momentV[1] + 
+   c1o2*ay[1]*momentU[3]*momentV[1] + c1o4*ay[4]*momentU[4]*momentV[1] + 
+   c1o2*ax[0]*momentU[1]*momentV[2] + c1o2*ax[1]*momentU[2]*momentV[2] + 
+   c1o2*ay[2]*momentU[2]*momentV[2] + c1o2*ax[4]*momentU[3]*momentV[2] + 
+   c1o2*ay[0]*momentV[3] + c1o2*ax[2]*momentU[1]*momentV[3] + 
+   c1o2*ay[1]*momentU[1]*momentV[3] + c1o2*ay[4]*momentU[2]*momentV[3] + 
+   c1o2*ay[2]*momentV[4] + c1o4*ax[4]*momentU[1]*momentV[4] + c1o4*ay[4]*momentV[5] + 
+   c1o2*az[0]*momentU[2]*momentW[1] + c1o2*ax[3]*momentU[3]*momentW[1] + 
+   c1o2*az[1]*momentU[3]*momentW[1] + c1o4*az[4]*momentU[4]*momentW[1] + 
+   c1o2*ay[3]*momentU[2]*momentV[1]*momentW[1] + c1o2*az[2]*momentU[2]*momentV[1]*momentW[1] + 
+   c1o2*az[0]*momentV[2]*momentW[1] + c1o2*ax[3]*momentU[1]*momentV[2]*momentW[1] + 
+   c1o2*az[1]*momentU[1]*momentV[2]*momentW[1] + c1o2*az[4]*momentU[2]*momentV[2]*momentW[1] + 
+   c1o2*ay[3]*momentV[3]*momentW[1] + c1o2*az[2]*momentV[3]*momentW[1] + 
+   c1o4*az[4]*momentV[4]*momentW[1] + c1o2*ax[0]*momentU[1]*momentW[2] + 
+   c1o2*ax[1]*momentU[2]*momentW[2] + c1o2*az[3]*momentU[2]*momentW[2] + 
+   c1o2*ax[4]*momentU[3]*momentW[2] + c1o2*ay[0]*momentV[1]*momentW[2] + 
+   c1o2*ax[2]*momentU[1]*momentV[1]*momentW[2] + c1o2*ay[1]*momentU[1]*momentV[1]*momentW[2] + 
+   c1o2*ay[4]*momentU[2]*momentV[1]*momentW[2] + c1o2*ay[2]*momentV[2]*momentW[2] + 
+   c1o2*az[3]*momentV[2]*momentW[2] + c1o2*ax[4]*momentU[1]*momentV[2]*momentW[2] + 
+   c1o2*ay[4]*momentV[3]*momentW[2] + c1o2*az[0]*momentW[3] + 
+   c1o2*ax[3]*momentU[1]*momentW[3] + c1o2*az[1]*momentU[1]*momentW[3] + 
+   c1o2*az[4]*momentU[2]*momentW[3] + c1o2*ay[3]*momentV[1]*momentW[3] + 
+   c1o2*az[2]*momentV[1]*momentW[3] + c1o2*az[4]*momentV[2]*momentW[3] + 
+   c1o2*az[3]*momentW[4] + c1o4*ax[4]*momentU[1]*momentW[4] + 
+   c1o4*ay[4]*momentV[1]*momentW[4] + c1o4*az[4]*momentW[5] + 
+   c1o2*ax[0]*momentU[1]*momentXi[2] + c1o2*ax[1]*momentU[2]*momentXi[2] + 
+   c1o2*ax[4]*momentU[3]*momentXi[2] + c1o2*ay[0]*momentV[1]*momentXi[2] + 
+   c1o2*ax[2]*momentU[1]*momentV[1]*momentXi[2] + 
+   c1o2*ay[1]*momentU[1]*momentV[1]*momentXi[2] + 
+   c1o2*ay[4]*momentU[2]*momentV[1]*momentXi[2] + c1o2*ay[2]*momentV[2]*momentXi[2] + 
+   c1o2*ax[4]*momentU[1]*momentV[2]*momentXi[2] + c1o2*ay[4]*momentV[3]*momentXi[2] + 
+   c1o2*az[0]*momentW[1]*momentXi[2] + c1o2*ax[3]*momentU[1]*momentW[1]*momentXi[2] + 
+   c1o2*az[1]*momentU[1]*momentW[1]*momentXi[2] + 
+   c1o2*az[4]*momentU[2]*momentW[1]*momentXi[2] + 
+   c1o2*ay[3]*momentV[1]*momentW[1]*momentXi[2] + 
+   c1o2*az[2]*momentV[1]*momentW[1]*momentXi[2] + 
+   c1o2*az[4]*momentV[2]*momentW[1]*momentXi[2] + c1o2*az[3]*momentW[2]*momentXi[2] + 
+   c1o2*ax[4]*momentU[1]*momentW[2]*momentXi[2] + 
+   c1o2*ay[4]*momentV[1]*momentW[2]*momentXi[2] + c1o2*az[4]*momentW[3]*momentXi[2] + 
+   c1o4*ax[4]*momentU[1]*momentXi[4] + c1o4*ay[4]*momentV[1]*momentXi[4] + 
+   c1o4*az[4]*momentW[1]*momentXi[4];
+
+    //////////////////////////////////////////////////////////////////////////
+
+    timeGrad.rho  += c2o1 * facePrim.lambda * (                                                          facePrim.U - momentU[1]                           ) * force.x
+                   + c2o1 * facePrim.lambda * (                                                          facePrim.V -              momentV[1]              ) * force.y
+                   + c2o1 * facePrim.lambda * (                                                          facePrim.W -                           momentW[1] ) * force.z ;
+                                                                                                         
+    timeGrad.rhoU += c2o1 * facePrim.lambda * (   momentU[1] *                                           facePrim.U - momentU[2]                           ) * force.x
+                   + c2o1 * facePrim.lambda * (   momentU[1] *                                           facePrim.V - momentU[1] * momentV[1]              ) * force.y
+                   + c2o1 * facePrim.lambda * (   momentU[1] *                                           facePrim.W - momentU[1] *              momentW[1] ) * force.z ;
+                                                                                                         
+    timeGrad.rhoV += c2o1 * facePrim.lambda * (                momentV[1] *                              facePrim.U - momentU[1] * momentV[1]              ) * force.x
+                   + c2o1 * facePrim.lambda * (                momentV[1] *                              facePrim.V -              momentV[2]              ) * force.y
+                   + c2o1 * facePrim.lambda * (                momentV[1] *                              facePrim.W -              momentV[1] * momentW[1] ) * force.z ;
+                                                                                                         
+    timeGrad.rhoW += c2o1 * facePrim.lambda * (                             momentW[1] *                 facePrim.U - momentU[1] *              momentW[1] ) * force.x
+                   + c2o1 * facePrim.lambda * (                             momentW[1] *                 facePrim.V -              momentV[1] * momentW[1] ) * force.y
+                   + c2o1 * facePrim.lambda * (                             momentW[1] *                 facePrim.W -                           momentW[2] ) * force.z ;
+
+    timeGrad.rhoE +=       facePrim.lambda * ( ( momentU[2] + momentV[2] + momentW[2] + momentXi[2] ) * facePrim.U
+
+                                             - ( momentU[3]
+                                               + momentU[1] * momentV[2] 
+                                               + momentU[1] *              momentW[2] 
+                                               + momentU[1] *                           momentXi[2] )
+                                             ) * force.x
+
+                   +       facePrim.lambda * ( ( momentU[2] + momentV[2] + momentW[2] + momentXi[2] ) * facePrim.V
+
+                                             - ( momentU[2] * momentV[1]
+                                               +              momentV[3]
+                                               +              momentV[1] * momentW[2]
+                                               +              momentV[1] *              momentXi[2] )
+                                             ) * force.y
+
+                   +       facePrim.lambda * ( ( momentU[2] + momentV[2] + momentW[2] + momentXi[2] ) * facePrim.W
+
+                                             - ( momentU[2] *              momentW[1]
+                                               +              momentV[2] * momentW[1]
+                                               +                           momentW[3]
+                                               +                           momentW[1] * momentXi[2] )
+                                             ) * force.z ;
+
+    //////////////////////////////////////////////////////////////////////////
+
+    timeGrad.rho  *= - c1o1;
+    timeGrad.rhoU *= - c1o1;
+    timeGrad.rhoV *= - c1o1;
+    timeGrad.rhoW *= - c1o1;
+    timeGrad.rhoE *= - c1o1;
+
+    //////////////////////////////////////////////////////////////////////////
+
+#ifdef USE_PASSIVE_SCALAR
+	timeGrad.rhoS_1 = timeGrad.rho * facePrim.S_1
+		            + ( ax[5] * momentU[1]  
+		              + ay[5] *              momentV[1]
+		              + az[5] *                           momentW[1] )
+		            / (c1o2 * facePrim.lambda);
+
+	timeGrad.rhoS_2 = timeGrad.rho * facePrim.S_2
+		            + ( ax[6] * momentU[1]  
+		              + ay[6] *              momentV[1]
+		              + az[6] *                           momentW[1] )
+		            / (c1o2 * facePrim.lambda);
+
+    timeGrad.rhoS_1 *= - c1o1;
+    timeGrad.rhoS_2 *= - c1o1;
+#endif // USE_PASSIVE_SCALAR
+
+    //////////////////////////////////////////////////////////////////////////
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+//! \brief Computes the products of relaxation time \f$\tau\f$ and time step 
+//! \f$\Delta t\f$ that stem from the symbolic time integration of the flux
+//!
+//! It further considers temperature dependent viscisity based on 
+//! \ref sutherlandsLaw, if enabled.
+//!
+//! \param[in]  facePrim          flow state on the interface as \ref PrimitiveVariables
+//! \param[in]  parameters        \ref Parameters struct
+//! \param[out] timeCoefficients  various products of relaxation time \f$\tau\f$ and time step \f$\Delta t\f$ that stem from the symbolic time integration of the flux
+__host__ __device__ inline void computeTimeCoefficients(const PrimitiveVariables & facePrim, const Parameters& parameters, real timeCoefficients[4])
+{
+    real r   = parameters.lambdaRef / facePrim.lambda;
+
+    real mu;
+    if ( parameters.viscosityModel == ViscosityModel::constant ){
+        mu = parameters.mu;
+    }
+    else if ( parameters.viscosityModel == ViscosityModel::sutherlandsLaw ){
+        mu = sutherlandsLaw( parameters, r );
+    }
+
+    real tau = c2o1 * facePrim.lambda * mu / facePrim.rho;
+
+    real dt = parameters.dt;
+
+    timeCoefficients[0] =                         dt;
+    timeCoefficients[1] =                 - tau * dt;
+    timeCoefficients[2] =  c1o2 * dt * dt - tau * dt;
+
+    timeCoefficients[3] =                   tau     ;
+}
+
+//! \brief Computes the relaxation time
+//!
+//! It further considers temperature dependent viscisity based on 
+//! \ref sutherlandsLaw, if enabled.
+//!
+//! \param[in]  facePrim          flow state on the interface as \ref PrimitiveVariables
+//! \param[in]  parameters        \ref Parameters struct
+//! \param[out] tau               relaxation time
+__host__ __device__ inline void getTau(const PrimitiveVariables & facePrim, const Parameters& parameters, real& tau)
+{
+    real r   = parameters.lambdaRef / facePrim.lambda;
+
+    real mu;
+    if ( parameters.viscosityModel == ViscosityModel::constant ){
+        mu = parameters.mu;
+    }
+    else if ( parameters.viscosityModel == ViscosityModel::sutherlandsLaw ){
+        mu = sutherlandsLaw( parameters, r );
+    }
+
+    tau = c2o1 * facePrim.lambda * mu / facePrim.rho;
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+//! \brief Computes the flux of the conserved variables based on expansion
+//! coefficients and moments of the equilibrium distribution
+//!
+//! 
+//! This function implements the expanded equations found in Eq. (19) in 
+//! <a href="https://doi.org/10.1016/j.ijthermalsci.2018.10.004"><b>[ Lenz et al. (2019), DOI: 10.1016/j.ijthermalsci.2018.10.004 ]</b></a>.
+//! which is based on 
+//! <a href="https://doi.org/10.1006/jcph.2001.6790"><b>[ Kun Xu (2001), DOI: 10.1006/jcph.2001.6790 ]</b></a>
+//! and 
+//! <a href="https://doi.org/10.1016/j.jcp.2007.06.024"><b>[ Tian et al. (2007), DOI: 10.1016/j.jcp.2007.06.024 ]</b></a>.
+//!
+//! This function incorporates the Pandtl number fix from Eq. Eq. (27) in 
+//! <a href="https://doi.org/10.1006/jcph.2001.6790"><b>[ Kun Xu (2001), DOI: 10.1006/jcph.2001.6790 ]</b></a>.
+//!
+//! Part of the equations was expanded using a computer algebra system 
+//! and are, hence, not well structured.
+//!
+//! \param[in]  facePrim          flow state on the interface as \ref PrimitiveVariables
+//! \param[in]  momentU           array of moments of the equilibrium function with respect to x-velocity
+//! \param[in]  momentV           array of moments of the equilibrium function with respect to y-velocity
+//! \param[in]  momentW           array of moments of the equilibrium function with respect to z-velocity
+//! \param[in]  momentXi          array of moments of the equilibrium function with respect to internal degrees of freedom
+//! \param[in]  ax                array of spatial expansion coefficients of the Taylor expansion of the equilibrium distribution
+//! \param[in]  ay                array of spatial expansion coefficients of the Taylor expansion of the equilibrium distribution 
+//! \param[in]  az                array of spatial expansion coefficients of the Taylor expansion of the equilibrium distribution
+//! \param[in]  at                array of temporal expansion coefficients of the Taylor expansion of the equilibrium distribution
+//! \param[in]  timeCoefficients  various products of relaxation time \f$\tau\f$ and time step \f$\Delta t\f$ that stem from the symbolic time integration of the flux
+//! \param[in]  parameters        \ref Parameters struct
+//! \param[in]  force             volume force vector
+//! \param[out] flux              time integrated absolute amount of \ref ConservedVariables transported over the face in this time step
+//! \param[out] heatFlux          amount of heat transported over the face
+__host__ __device__ inline void assembleFlux( const PrimitiveVariables& facePrim, 
+                                              const real momentU [ NUMBER_OF_MOMENTS ], 
+                                              const real momentV [ NUMBER_OF_MOMENTS ], 
+                                              const real momentW [ NUMBER_OF_MOMENTS ], 
+                                              const real momentXi[ NUMBER_OF_MOMENTS ],
+                                              const real ax[LENGTH_CELL_DATA],
+                                              const real ay[LENGTH_CELL_DATA],
+                                              const real az[LENGTH_CELL_DATA],
+                                              const real at[LENGTH_CELL_DATA],
+                                              const real timeCoefficients[4],
+                                              const Parameters& parameters,
+                                              const Vec3 force,
+                                              ConservedVariables& flux,
+                                              real& heatFlux )
+{
+    ConservedVariables flux_1, flux_2, flux_3;
+
+    flux_1.rho  =           momentU[0+1]                          ;
+    flux_1.rhoU =           momentU[1+1]                          ;
+    flux_1.rhoV =           momentU[0+1] * momentV[1]             ;
+    flux_1.rhoW =           momentU[0+1] *              momentW[1];
+
+    flux_1.rhoE =  c1o2 * ( momentU[2+1]             
+                          + momentU[0+1] * momentV[2]
+                          + momentU[0+1] *              momentW[2]
+                          + momentU[0+1] *                           momentXi[2] );
+
+    //////////////////////////////////////////////////////////////////////////
+
+    flux_2.rho  = ax[0]*momentU[2] + ax[1]*momentU[3] + c1o2*ax[4]*momentU[4] + 
+   ay[0]*momentU[1]*momentV[1] + ax[2]*momentU[2]*momentV[1] + 
+   ay[1]*momentU[2]*momentV[1] + c1o2*ay[4]*momentU[3]*momentV[1] + 
+   ay[2]*momentU[1]*momentV[2] + c1o2*ax[4]*momentU[2]*momentV[2] + 
+   c1o2*ay[4]*momentU[1]*momentV[3] + az[0]*momentU[1]*momentW[1] + 
+   ax[3]*momentU[2]*momentW[1] + az[1]*momentU[2]*momentW[1] + 
+   c1o2*az[4]*momentU[3]*momentW[1] + ay[3]*momentU[1]*momentV[1]*momentW[1] + 
+   az[2]*momentU[1]*momentV[1]*momentW[1] + c1o2*az[4]*momentU[1]*momentV[2]*momentW[1] + 
+   az[3]*momentU[1]*momentW[2] + c1o2*ax[4]*momentU[2]*momentW[2] + 
+   c1o2*ay[4]*momentU[1]*momentV[1]*momentW[2] + c1o2*az[4]*momentU[1]*momentW[3] + 
+   c1o2*ax[4]*momentU[2]*momentXi[2] + c1o2*ay[4]*momentU[1]*momentV[1]*momentXi[2] + 
+   c1o2*az[4]*momentU[1]*momentW[1]*momentXi[2];
+
+    flux_2.rhoU = ax[0]*momentU[3] + ax[1]*momentU[4] + c1o2*ax[4]*momentU[5] + 
+   ay[0]*momentU[2]*momentV[1] + ax[2]*momentU[3]*momentV[1] + 
+   ay[1]*momentU[3]*momentV[1] + c1o2*ay[4]*momentU[4]*momentV[1] + 
+   ay[2]*momentU[2]*momentV[2] + c1o2*ax[4]*momentU[3]*momentV[2] + 
+   c1o2*ay[4]*momentU[2]*momentV[3] + az[0]*momentU[2]*momentW[1] + 
+   ax[3]*momentU[3]*momentW[1] + az[1]*momentU[3]*momentW[1] + 
+   c1o2*az[4]*momentU[4]*momentW[1] + ay[3]*momentU[2]*momentV[1]*momentW[1] + 
+   az[2]*momentU[2]*momentV[1]*momentW[1] + c1o2*az[4]*momentU[2]*momentV[2]*momentW[1] + 
+   az[3]*momentU[2]*momentW[2] + c1o2*ax[4]*momentU[3]*momentW[2] + 
+   c1o2*ay[4]*momentU[2]*momentV[1]*momentW[2] + c1o2*az[4]*momentU[2]*momentW[3] + 
+   c1o2*ax[4]*momentU[3]*momentXi[2] + c1o2*ay[4]*momentU[2]*momentV[1]*momentXi[2] + 
+   c1o2*az[4]*momentU[2]*momentW[1]*momentXi[2];
+
+    flux_2.rhoV = ax[0]*momentU[2]*momentV[1] + ax[1]*momentU[3]*momentV[1] + 
+   c1o2*ax[4]*momentU[4]*momentV[1] + ay[0]*momentU[1]*momentV[2] + 
+   ax[2]*momentU[2]*momentV[2] + ay[1]*momentU[2]*momentV[2] + 
+   c1o2*ay[4]*momentU[3]*momentV[2] + ay[2]*momentU[1]*momentV[3] + 
+   c1o2*ax[4]*momentU[2]*momentV[3] + c1o2*ay[4]*momentU[1]*momentV[4] + 
+   az[0]*momentU[1]*momentV[1]*momentW[1] + ax[3]*momentU[2]*momentV[1]*momentW[1] + 
+   az[1]*momentU[2]*momentV[1]*momentW[1] + c1o2*az[4]*momentU[3]*momentV[1]*momentW[1] + 
+   ay[3]*momentU[1]*momentV[2]*momentW[1] + az[2]*momentU[1]*momentV[2]*momentW[1] + 
+   c1o2*az[4]*momentU[1]*momentV[3]*momentW[1] + az[3]*momentU[1]*momentV[1]*momentW[2] + 
+   c1o2*ax[4]*momentU[2]*momentV[1]*momentW[2] + c1o2*ay[4]*momentU[1]*momentV[2]*momentW[2] + 
+   c1o2*az[4]*momentU[1]*momentV[1]*momentW[3] + 
+   c1o2*ax[4]*momentU[2]*momentV[1]*momentXi[2] + 
+   c1o2*ay[4]*momentU[1]*momentV[2]*momentXi[2] + 
+   c1o2*az[4]*momentU[1]*momentV[1]*momentW[1]*momentXi[2];
+    
+    flux_2.rhoW = ax[0]*momentU[2]*momentW[1] + ax[1]*momentU[3]*momentW[1] + 
+   c1o2*ax[4]*momentU[4]*momentW[1] + ay[0]*momentU[1]*momentV[1]*momentW[1] + 
+   ax[2]*momentU[2]*momentV[1]*momentW[1] + ay[1]*momentU[2]*momentV[1]*momentW[1] + 
+   c1o2*ay[4]*momentU[3]*momentV[1]*momentW[1] + ay[2]*momentU[1]*momentV[2]*momentW[1] + 
+   c1o2*ax[4]*momentU[2]*momentV[2]*momentW[1] + c1o2*ay[4]*momentU[1]*momentV[3]*momentW[1] + 
+   az[0]*momentU[1]*momentW[2] + ax[3]*momentU[2]*momentW[2] + 
+   az[1]*momentU[2]*momentW[2] + c1o2*az[4]*momentU[3]*momentW[2] + 
+   ay[3]*momentU[1]*momentV[1]*momentW[2] + az[2]*momentU[1]*momentV[1]*momentW[2] + 
+   c1o2*az[4]*momentU[1]*momentV[2]*momentW[2] + az[3]*momentU[1]*momentW[3] + 
+   c1o2*ax[4]*momentU[2]*momentW[3] + c1o2*ay[4]*momentU[1]*momentV[1]*momentW[3] + 
+   c1o2*az[4]*momentU[1]*momentW[4] + c1o2*ax[4]*momentU[2]*momentW[1]*momentXi[2] + 
+   c1o2*ay[4]*momentU[1]*momentV[1]*momentW[1]*momentXi[2] + 
+   c1o2*az[4]*momentU[1]*momentW[2]*momentXi[2];
+
+    flux_2.rhoE = c1o2*ax[0]*momentU[4] + c1o2*ax[1]*momentU[5] + c1o4*ax[4]*momentU[6] + 
+   c1o2*ay[0]*momentU[3]*momentV[1] + c1o2*ax[2]*momentU[4]*momentV[1] + 
+   c1o2*ay[1]*momentU[4]*momentV[1] + c1o4*ay[4]*momentU[5]*momentV[1] + 
+   c1o2*ax[0]*momentU[2]*momentV[2] + c1o2*ax[1]*momentU[3]*momentV[2] + 
+   c1o2*ay[2]*momentU[3]*momentV[2] + c1o2*ax[4]*momentU[4]*momentV[2] + 
+   c1o2*ay[0]*momentU[1]*momentV[3] + c1o2*ax[2]*momentU[2]*momentV[3] + 
+   c1o2*ay[1]*momentU[2]*momentV[3] + c1o2*ay[4]*momentU[3]*momentV[3] + 
+   c1o2*ay[2]*momentU[1]*momentV[4] + c1o4*ax[4]*momentU[2]*momentV[4] + 
+   c1o4*ay[4]*momentU[1]*momentV[5] + c1o2*az[0]*momentU[3]*momentW[1] + 
+   c1o2*ax[3]*momentU[4]*momentW[1] + c1o2*az[1]*momentU[4]*momentW[1] + 
+   c1o4*az[4]*momentU[5]*momentW[1] + c1o2*ay[3]*momentU[3]*momentV[1]*momentW[1] + 
+   c1o2*az[2]*momentU[3]*momentV[1]*momentW[1] + 
+   c1o2*az[0]*momentU[1]*momentV[2]*momentW[1] + 
+   c1o2*ax[3]*momentU[2]*momentV[2]*momentW[1] + c1o2*az[1]*momentU[2]*momentV[2]*momentW[1] + 
+   c1o2*az[4]*momentU[3]*momentV[2]*momentW[1] + c1o2*ay[3]*momentU[1]*momentV[3]*momentW[1] + 
+   c1o2*az[2]*momentU[1]*momentV[3]*momentW[1] + c1o4*az[4]*momentU[1]*momentV[4]*momentW[1] + 
+   c1o2*ax[0]*momentU[2]*momentW[2] + c1o2*ax[1]*momentU[3]*momentW[2] + 
+   c1o2*az[3]*momentU[3]*momentW[2] + c1o2*ax[4]*momentU[4]*momentW[2] + 
+   c1o2*ay[0]*momentU[1]*momentV[1]*momentW[2] + 
+   c1o2*ax[2]*momentU[2]*momentV[1]*momentW[2] + c1o2*ay[1]*momentU[2]*momentV[1]*momentW[2] + 
+   c1o2*ay[4]*momentU[3]*momentV[1]*momentW[2] + c1o2*ay[2]*momentU[1]*momentV[2]*momentW[2] + 
+   c1o2*az[3]*momentU[1]*momentV[2]*momentW[2] + c1o2*ax[4]*momentU[2]*momentV[2]*momentW[2] + 
+   c1o2*ay[4]*momentU[1]*momentV[3]*momentW[2] + c1o2*az[0]*momentU[1]*momentW[3] + 
+   c1o2*ax[3]*momentU[2]*momentW[3] + c1o2*az[1]*momentU[2]*momentW[3] + 
+   c1o2*az[4]*momentU[3]*momentW[3] + c1o2*ay[3]*momentU[1]*momentV[1]*momentW[3] + 
+   c1o2*az[2]*momentU[1]*momentV[1]*momentW[3] + c1o2*az[4]*momentU[1]*momentV[2]*momentW[3] + 
+   c1o2*az[3]*momentU[1]*momentW[4] + c1o4*ax[4]*momentU[2]*momentW[4] + 
+   c1o4*ay[4]*momentU[1]*momentV[1]*momentW[4] + c1o4*az[4]*momentU[1]*momentW[5] + 
+   c1o2*ax[0]*momentU[2]*momentXi[2] + c1o2*ax[1]*momentU[3]*momentXi[2] + 
+   c1o2*ax[4]*momentU[4]*momentXi[2] + c1o2*ay[0]*momentU[1]*momentV[1]*momentXi[2] + 
+   c1o2*ax[2]*momentU[2]*momentV[1]*momentXi[2] + 
+   c1o2*ay[1]*momentU[2]*momentV[1]*momentXi[2] + 
+   c1o2*ay[4]*momentU[3]*momentV[1]*momentXi[2] + 
+   c1o2*ay[2]*momentU[1]*momentV[2]*momentXi[2] + 
+   c1o2*ax[4]*momentU[2]*momentV[2]*momentXi[2] + 
+   c1o2*ay[4]*momentU[1]*momentV[3]*momentXi[2] + 
+   c1o2*az[0]*momentU[1]*momentW[1]*momentXi[2] + 
+   c1o2*ax[3]*momentU[2]*momentW[1]*momentXi[2] + 
+   c1o2*az[1]*momentU[2]*momentW[1]*momentXi[2] + 
+   c1o2*az[4]*momentU[3]*momentW[1]*momentXi[2] + 
+   c1o2*ay[3]*momentU[1]*momentV[1]*momentW[1]*momentXi[2] + 
+   c1o2*az[2]*momentU[1]*momentV[1]*momentW[1]*momentXi[2] + 
+   c1o2*az[4]*momentU[1]*momentV[2]*momentW[1]*momentXi[2] + 
+   c1o2*az[3]*momentU[1]*momentW[2]*momentXi[2] + 
+   c1o2*ax[4]*momentU[2]*momentW[2]*momentXi[2] + 
+   c1o2*ay[4]*momentU[1]*momentV[1]*momentW[2]*momentXi[2] + 
+   c1o2*az[4]*momentU[1]*momentW[3]*momentXi[2] + c1o4*ax[4]*momentU[2]*momentXi[4] + 
+   c1o4*ay[4]*momentU[1]*momentV[1]*momentXi[4] + c1o4*az[4]*momentU[1]*momentW[1]*momentXi[4];
+
+    //////////////////////////////////////////////////////////////////////////
+
+    flux_2.rho  += c2o1 * facePrim.lambda * (   momentU[0+1] *                                           facePrim.U - momentU[1+1]                           ) * force.x
+                 + c2o1 * facePrim.lambda * (   momentU[0+1] *                                           facePrim.V - momentU[0+1] * momentV[1]              ) * force.y
+                 + c2o1 * facePrim.lambda * (   momentU[0+1] *                                           facePrim.W - momentU[0+1] *              momentW[1] ) * force.z ;
+                                                                                                         
+    flux_2.rhoU += c2o1 * facePrim.lambda * (   momentU[1+1] *                                           facePrim.U - momentU[2+1]                           ) * force.x
+                 + c2o1 * facePrim.lambda * (   momentU[1+1] *                                           facePrim.V - momentU[1+1] * momentV[1]              ) * force.y
+                 + c2o1 * facePrim.lambda * (   momentU[1+1] *                                           facePrim.W - momentU[1+1] *              momentW[1] ) * force.z ;
+                                                                                                         
+    flux_2.rhoV += c2o1 * facePrim.lambda * (   momentU[0+1] * momentV[1] *                              facePrim.U - momentU[1+1] * momentV[1]              ) * force.x
+                 + c2o1 * facePrim.lambda * (   momentU[0+1] * momentV[1] *                              facePrim.V - momentU[0+1] * momentV[2]              ) * force.y
+                 + c2o1 * facePrim.lambda * (   momentU[0+1] * momentV[1] *                              facePrim.W - momentU[0+1] * momentV[1] * momentW[1] ) * force.z ;
+                                                                                                         
+    flux_2.rhoW += c2o1 * facePrim.lambda * (   momentU[0+1] *              momentW[1] *                 facePrim.U - momentU[1+1] *              momentW[1] ) * force.x
+                 + c2o1 * facePrim.lambda * (   momentU[0+1] *              momentW[1] *                 facePrim.V - momentU[0+1] * momentV[1] * momentW[1] ) * force.y
+                 + c2o1 * facePrim.lambda * (   momentU[0+1] *              momentW[1] *                 facePrim.W - momentU[0+1] *              momentW[2] ) * force.z ;
+
+    flux_2.rhoE +=       facePrim.lambda * ( ( momentU[2+1] + momentV[2] + momentW[2] + momentXi[2] ) * facePrim.U
+
+                                           - ( momentU[3+1]
+                                             + momentU[1+1] * momentV[2] 
+                                             + momentU[1+1] *              momentW[2] 
+                                             + momentU[1+1] *                           momentXi[2] )
+                                           ) * force.x
+
+                 +       facePrim.lambda * ( ( momentU[2+1] + momentV[2] + momentW[2] + momentXi[2] ) * facePrim.V
+
+                                           - ( momentU[2+1] * momentV[1]
+                                             + momentU[0+1] * momentV[3]
+                                             + momentU[0+1] * momentV[1] * momentW[2]
+                                             + momentU[0+1] * momentV[1] *              momentXi[2] )
+                                           ) * force.y
+
+                 +       facePrim.lambda * ( ( momentU[2+1] + momentV[2] + momentW[2] + momentXi[2] ) * facePrim.W
+
+                                           - ( momentU[2+1] *              momentW[1]
+                                             + momentU[0+1] * momentV[2] * momentW[1]
+                                             + momentU[0+1] *              momentW[3]
+                                             + momentU[0+1] *              momentW[1] * momentXi[2] )
+                                           ) * force.z ;
+
+    //////////////////////////////////////////////////////////////////////////
+
+    flux_3.rho  = at[0]*momentU[1] + at[1]*momentU[2] + c1o2*at[4]*momentU[3] + at[2]*momentU[1]*momentV[1] + 
+   c1o2*at[4]*momentU[1]*momentV[2] + at[3]*momentU[1]*momentW[1] + 
+   c1o2*at[4]*momentU[1]*momentW[2] + c1o2*at[4]*momentU[1]*momentXi[2];
+
+    flux_3.rhoU = at[0]*momentU[2] + at[1]*momentU[3] + c1o2*at[4]*momentU[4] + at[2]*momentU[2]*momentV[1] + 
+   c1o2*at[4]*momentU[2]*momentV[2] + at[3]*momentU[2]*momentW[1] + 
+   c1o2*at[4]*momentU[2]*momentW[2] + c1o2*at[4]*momentU[2]*momentXi[2];
+
+    flux_3.rhoV = at[0]*momentU[1]*momentV[1] + at[1]*momentU[2]*momentV[1] + 
+   c1o2*at[4]*momentU[3]*momentV[1] + at[2]*momentU[1]*momentV[2] + 
+   c1o2*at[4]*momentU[1]*momentV[3] + at[3]*momentU[1]*momentV[1]*momentW[1] + 
+   c1o2*at[4]*momentU[1]*momentV[1]*momentW[2] + c1o2*at[4]*momentU[1]*momentV[1]*momentXi[2];
+
+    flux_3.rhoW = at[0]*momentU[1]*momentW[1] + at[1]*momentU[2]*momentW[1] + 
+   c1o2*at[4]*momentU[3]*momentW[1] + at[2]*momentU[1]*momentV[1]*momentW[1] + 
+   c1o2*at[4]*momentU[1]*momentV[2]*momentW[1] + at[3]*momentU[1]*momentW[2] + 
+   c1o2*at[4]*momentU[1]*momentW[3] + c1o2*at[4]*momentU[1]*momentW[1]*momentXi[2];
+
+    flux_3.rhoE = c1o2*at[0]*momentU[3] + c1o2*at[1]*momentU[4] + c1o4*at[4]*momentU[5] + 
+   c1o2*at[2]*momentU[3]*momentV[1] + c1o2*at[0]*momentU[1]*momentV[2] + 
+   c1o2*at[1]*momentU[2]*momentV[2] + c1o2*at[4]*momentU[3]*momentV[2] + 
+   c1o2*at[2]*momentU[1]*momentV[3] + c1o4*at[4]*momentU[1]*momentV[4] + 
+   c1o2*at[3]*momentU[3]*momentW[1] + c1o2*at[3]*momentU[1]*momentV[2]*momentW[1] + 
+   c1o2*at[0]*momentU[1]*momentW[2] + c1o2*at[1]*momentU[2]*momentW[2] + 
+   c1o2*at[4]*momentU[3]*momentW[2] + c1o2*at[2]*momentU[1]*momentV[1]*momentW[2] + 
+   c1o2*at[4]*momentU[1]*momentV[2]*momentW[2] + c1o2*at[3]*momentU[1]*momentW[3] + 
+   c1o4*at[4]*momentU[1]*momentW[4] + c1o2*at[0]*momentU[1]*momentXi[2] + 
+   c1o2*at[1]*momentU[2]*momentXi[2] + c1o2*at[4]*momentU[3]*momentXi[2] + 
+   c1o2*at[2]*momentU[1]*momentV[1]*momentXi[2] + 
+   c1o2*at[4]*momentU[1]*momentV[2]*momentXi[2] + 
+   c1o2*at[3]*momentU[1]*momentW[1]*momentXi[2] + 
+   c1o2*at[4]*momentU[1]*momentW[2]*momentXi[2] + c1o4*at[4]*momentU[1]*momentXi[4];
+
+    //////////////////////////////////////////////////////////////////////////
+
+    flux.rho  = ( timeCoefficients[0] * flux_1.rho  + timeCoefficients[1] * flux_2.rho  + timeCoefficients[2] * flux_3.rho  ) * parameters.dx * parameters.dx * facePrim.rho;
+    flux.rhoU = ( timeCoefficients[0] * flux_1.rhoU + timeCoefficients[1] * flux_2.rhoU + timeCoefficients[2] * flux_3.rhoU ) * parameters.dx * parameters.dx * facePrim.rho;
+    flux.rhoV = ( timeCoefficients[0] * flux_1.rhoV + timeCoefficients[1] * flux_2.rhoV + timeCoefficients[2] * flux_3.rhoV ) * parameters.dx * parameters.dx * facePrim.rho;
+    flux.rhoW = ( timeCoefficients[0] * flux_1.rhoW + timeCoefficients[1] * flux_2.rhoW + timeCoefficients[2] * flux_3.rhoW ) * parameters.dx * parameters.dx * facePrim.rho;
+    flux.rhoE = ( timeCoefficients[0] * flux_1.rhoE + timeCoefficients[1] * flux_2.rhoE + timeCoefficients[2] * flux_3.rhoE ) * parameters.dx * parameters.dx * facePrim.rho;
+
+    //////////////////////////////////////////////////////////////////////////
+
+    real qConstPr = timeCoefficients[1] * ( ( flux_2.rhoE + flux_3.rhoE ) 
+                                          - facePrim.U * ( flux_2.rhoU + flux_3.rhoU ) 
+                                          - facePrim.V * ( flux_2.rhoV + flux_3.rhoV ) 
+                                          - facePrim.W * ( flux_2.rhoW + flux_3.rhoW )
+                                          ) * parameters.dx * parameters.dx * facePrim.rho;
+
+    flux.rhoE += ( c1o1 / parameters.Pr - c1o1 ) * qConstPr;
+
+    heatFlux   = qConstPr / parameters.Pr;
+
+    //////////////////////////////////////////////////////////////////////////
+
+#ifdef USE_PASSIVE_SCALAR
+
+	flux_2.rhoS_1 = ( ax[5] * momentU[1+1]                          
+				    + ay[5] * momentU[0+1] * momentV[1]             
+				    + az[5] * momentU[0+1] *              momentW[1]
+				    ) / (c2o1 * facePrim.lambda);
+
+	flux_2.rhoS_2 = ( ax[6] * momentU[1+1]                          
+				    + ay[6] * momentU[0+1] * momentV[1]             
+				    + az[6] * momentU[0+1] *              momentW[1]
+				    ) / (c2o1 * facePrim.lambda);
+
+	flux_3.rhoS_1 = at[5] * momentU[0 + 1]
+				  / ( c2o1 * facePrim.lambda );
+
+	flux_3.rhoS_2 = at[6] * momentU[0 + 1]
+				  / ( c2o1 * facePrim.lambda );
+
+    //////////////////////////////////////////////////////////////////////////
+
+	real dt = parameters.dt;
+    real timeCoefficientsScalar [3];
+
+    {
+        real tauS = parameters.D1 * c2o1 * facePrim.lambda;
+        timeCoefficientsScalar[0] = dt;
+        timeCoefficientsScalar[1] = -tauS * dt;
+        timeCoefficientsScalar[2] = c1o2 * dt * dt - tauS * dt;
+
+        flux.rhoS_1 = flux.rho * facePrim.S_1 + ( timeCoefficientsScalar[1] * flux_2.rhoS_1 + timeCoefficientsScalar[2] * flux_3.rhoS_1 ) * parameters.dx * parameters.dx * facePrim.rho;
+    }
+
+    {
+        real tauS = parameters.D2 * c2o1 * facePrim.lambda;
+        timeCoefficientsScalar[0] = dt;
+        timeCoefficientsScalar[1] = -tauS * dt;
+        timeCoefficientsScalar[2] = c1o2 * dt * dt - tauS * dt;
+
+        flux.rhoS_2 = flux.rho * facePrim.S_2 + ( timeCoefficientsScalar[1] * flux_2.rhoS_2 + timeCoefficientsScalar[2] * flux_3.rhoS_2 ) * parameters.dx * parameters.dx * facePrim.rho;
+    }
+
+#endif // USE_PASSIVE_SCALAR
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#endif
\ No newline at end of file
diff --git a/src/GksGpu/FluxComputation/ExpansionCoefficients.cuh b/src/GksGpu/FluxComputation/ExpansionCoefficients.cuh
new file mode 100644
index 0000000000000000000000000000000000000000..9000493ab3b8c373e69d193fef3549969ba589a0
--- /dev/null
+++ b/src/GksGpu/FluxComputation/ExpansionCoefficients.cuh
@@ -0,0 +1,99 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 ExpansionCoefficients.cuh
+//! \ingroup FluxComputation
+//! \author Stephan Lenz
+//=======================================================================================
+#ifndef ExpansionCoefficients_CUH
+#define ExpansionCoefficients_CUH
+
+#include "VirtualFluidsDefinitions.h"
+
+#include "Core/DataTypes.h"
+
+#include "DataBase/DataBase.h"
+
+#include "FlowStateData/FlowStateData.cuh"
+#include "FlowStateData/AccessDeviceData.cuh"
+
+//! \brief computes spatial and temporal expansion coefficients of the Taylor 
+//! expansion of the equilibrium distribution based on corresponding derivatives
+//!
+//! The equations for the computation of the expansion coefficints can be found in
+//! Appendix C in 
+//! <a href="https://doi.org/10.1142/9324"><b>[ Kun Xu, (2015), DOI: 10.1142/9324 ]</b></a>.
+//!
+//! \param[in]  facePrim               flow state on the interface as \ref PrimitiveVariables
+//! \param[in]  gradient               derivative of the \ref ConservedVariables
+//! \param[in]  K                      number of internal degrees of freedom
+//! \param[out] expansionCoefficient   array of expansion coefficients with respect to the provided derivatives
+__host__ __device__ inline void computeExpansionCoefficients(const PrimitiveVariables & facePrim, 
+                                                             const ConservedVariables & gradient,
+                                                             const real K, 
+                                                             real expansionCoefficient[LENGTH_CELL_DATA])
+{
+    real two_E, 
+             rho_dU_dx, 
+             rho_dV_dx, 
+             rho_dW_dx, 
+         two_rho_dE_dx;
+
+    two_E = facePrim.U * facePrim.U 
+          + facePrim.V * facePrim.V 
+          + facePrim.W * facePrim.W 
+          + c1o2 * ( K + c3o1 ) / facePrim.lambda;
+
+    rho_dU_dx     =       gradient.rhoU - facePrim.U  * gradient.rho;
+    rho_dV_dx     =       gradient.rhoV - facePrim.V  * gradient.rho;
+    rho_dW_dx     =       gradient.rhoW - facePrim.W  * gradient.rho;
+    two_rho_dE_dx = c2o1 * gradient.rhoE -      two_E  * gradient.rho;
+
+    expansionCoefficient[4] = ( c4o1 * facePrim.lambda * facePrim.lambda ) / ( K + c3o1 )
+                            * ( two_rho_dE_dx - c2o1 * facePrim.U * rho_dU_dx 
+                                              - c2o1 * facePrim.V * rho_dV_dx 
+                                              - c2o1 * facePrim.W * rho_dW_dx );
+
+    expansionCoefficient[3] = c2o1 * facePrim.lambda * rho_dW_dx - facePrim.W * expansionCoefficient[4];
+
+    expansionCoefficient[2] = c2o1 * facePrim.lambda * rho_dV_dx - facePrim.V * expansionCoefficient[4];
+
+    expansionCoefficient[1] = c2o1 * facePrim.lambda * rho_dU_dx - facePrim.U * expansionCoefficient[4];
+
+    expansionCoefficient[0] = gradient.rho -   facePrim.U * expansionCoefficient[1] 
+                                           -   facePrim.V * expansionCoefficient[2] 
+                                           -   facePrim.W * expansionCoefficient[3] 
+                                           - c1o2 * two_E * expansionCoefficient[4];
+
+#ifdef USE_PASSIVE_SCALAR
+	expansionCoefficient[5] = c2o1 * facePrim.lambda * (gradient.rhoS_1 - facePrim.S_1 * gradient.rho);
+	expansionCoefficient[6] = c2o1 * facePrim.lambda * (gradient.rhoS_2 - facePrim.S_2 * gradient.rho);
+#endif // USE_PASSIVE_SCALAR
+}
+
+#endif
\ No newline at end of file
diff --git a/src/GksGpu/FluxComputation/FluxComputation.cu b/src/GksGpu/FluxComputation/FluxComputation.cu
new file mode 100644
index 0000000000000000000000000000000000000000..047702bdb4ef46117d5138c8892a3f31185bb00b
--- /dev/null
+++ b/src/GksGpu/FluxComputation/FluxComputation.cu
@@ -0,0 +1,313 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 FluxComputation.cu
+//! \ingroup FluxComputation
+//! \author Stephan Lenz
+//=======================================================================================
+#include "FluxComputation.h"
+
+#include <cuda.h>
+#include <cuda_runtime.h>
+#include <helper_cuda.h>
+
+#include "Core/PointerDefinitions.h"
+
+#include "DataBase/DataBaseStruct.h"
+
+#include "Definitions/PassiveScalar.h"
+
+#include "FlowStateData/FlowStateData.cuh"
+
+#include "CellProperties/CellProperties.cuh"
+
+#include "FluxComputation/Moments.cuh"
+#include "FluxComputation/Reconstruction.cuh"
+#include "FluxComputation/Transformation.cuh"
+#include "FluxComputation/ExpansionCoefficients.cuh"
+#include "FluxComputation/AssembleFlux.cuh"
+#include "FluxComputation/ApplyFlux.cuh"
+
+#include "CudaUtility/CudaRunKernel.hpp"
+
+//! \brief This is a CUDA Kernel that computes the face index and calls \ref fluxFunction for this index
+__global__                 void fluxKernel  ( DataBaseStruct dataBase, Parameters parameters, char direction, uint startIndex, uint numberOfEntities );
+
+//! \brief This function performs the flux computation
+//!
+//! The \ref reconstructFiniteDifferences function computes the flow state 
+//! on the cell face as well as the gradient of the flow state.
+//! The flow state is computed by directly averaging the conserved variables
+//! of the positive and negative neighboring cells and afterwards transformed
+//! to primitive variables.
+//! The normal derivatives are also clearly defined by positive and negative
+//! cells and are computed by central difference.
+//! For the tangential derivative the orientation (in the sense of normal to 
+//! which coordinate direction) of the face is utilized to choose the correct 
+//! data access pattern.
+//! While the positive and negative cell indices are stored per face, the cells
+//! for the tangential derivatives are obtained pointer chasing, i.e. utilizing
+//! the cell to cell connectivity stored per cell. The gradients of the 
+//! conserved variables are divided by the density for implementation reasons.
+//! 
+//! In order to unify the flux computation for all three possible directions,
+//! the conserved variables in both gradients and flow state are rotated into
+//! a local frame of reference with the function \ref transformGlobalToLocal.
+//! 
+//! Subsequently the expansion coefficients according to Appendix C in 
+//! <a href="https://doi.org/10.1142/9324"><b>[ Kun Xu, (2015), DOI: 10.1142/9324 ]</b></a>
+//! are computed by \ref computeExpansionCoefficients.
+//! 
+//! The next major stage in the flux computation is related to the time 
+//! derivative, which is evaluated from the spatial derivatives. First a set
+//! of several moments of the equilibrium distribution is evaluated explicitly.
+//! The formulas for the moments can be found for example in 
+//! <a href="https://doi.org/10.1142/9324"><b>[ Kun Xu (2015), DOI: 10.1142/9324 ]</b></a>. 
+//! The moments are subsequently weighted by the spatial expansion coefficients
+//! and assembled to form the time derivative according to Eq. (17) in 
+//! <a href="https://doi.org/10.1016/j.ijthermalsci.2018.10.004"><b>[ Lenz et al. (2019), DOI: 10.1016/j.ijthermalsci.2018.10.004 ]</b></a>
+//! in function \ref computeTimeDerivative. The temporal expansion coefficients 
+//! are then computed with the same function used for the spatial expansion 
+//! coefficients.
+//! 
+//! With all expansion coefficients in place, they are used to assemble the 
+//! flux according to Eq. (19) in 
+//! <a href="https://doi.org/10.1016/j.ijthermalsci.2018.10.004"><b>[ Lenz et al. (2019), DOI: 10.1016/j.ijthermalsci.2018.10.004 ]</b></a>
+//! in the function \ref assembleFlux. This function includes the Prandtl 
+//! number fix from Eq. (27) in 
+//! <a href="https://doi.org/10.1006/jcph.2001.6790"><b>[ Kun Xu (2001), DOI: 10.1006/jcph.2001.6790 ]</b></a>.
+//! 
+//! At this stage the flux exists as conserved variables in the local frame of 
+//! reference. Transformation to the global frame follows in the function 
+//! \ref transformLocalToGlobal.
+//! 
+//! Concluding the flux computation the fluxes are applied to the positive and
+//! negative cells \ref DataBase::dataUpdate variables. In this process several 
+//! \ref CellProperties, which are stored as bitmaps, are evaluated, such as 
+//! impenetrable walls. Finally, the functions \ref applyFluxToNegCell and 
+//! \ref applyFluxToPosCell add the fluxes to \ref DataBase::dataUpdate of 
+//! negative and positive cells respectively. As there is the possibility of race
+//! conditions in the case, where multiple faces are processed simultaneously.
+//! In order to prevent this, CUDA atomics are used to protect the write operations.
+//! 
+//! The fluxes are multiplied by the face area \f$\Delta x^2\f$. Hence, they have to 
+//! interpreted as absolute amounts of conserved quantities, in opposition to the
+//! storage of cell average conserved quantities.
+__host__ __device__ inline void fluxFunction( DataBaseStruct dataBase, Parameters parameters, char direction, uint startIndex, uint index );
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void FluxComputation::run( SPtr<DataBase> dataBase, Parameters parameters, uint level, bool evaluateCommFaces )
+{
+    CudaUtility::CudaGrid grid(dataBase->perLevelCount[level].numberOfInnerFaces, 64, CudaUtility::computeStream);
+
+    runKernel(fluxKernel,
+                fluxFunction,
+                dataBase->getDeviceType(), grid,
+                dataBase->toStruct(),
+                parameters,
+                'x',
+                dataBase->perLevelCount[level].startOfFacesX);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+__global__ void fluxKernel(DataBaseStruct dataBase, Parameters parameters, char direction, uint startIndex, uint numberOfEntities)
+{
+    uint index = blockIdx.x * blockDim.x + threadIdx.x;
+
+    if( index >= numberOfEntities ) return;
+
+    fluxFunction( dataBase, parameters, direction, startIndex, index );
+}
+
+__host__ __device__ inline void fluxFunction(DataBaseStruct dataBase, Parameters parameters, char direction, uint startIndex, uint index)
+{
+    uint faceIndex = startIndex + index;
+
+    real K = parameters.K;
+
+    direction = dataBase.faceOrientation[ faceIndex ];
+
+    parameters.D1 = parameters.D;
+    parameters.D2 = parameters.D;
+
+    //////////////////////////////////////////////////////////////////////////
+
+    PrimitiveVariables facePrim;
+
+    //////////////////////////////////////////////////////////////////////////
+
+    real ax[LENGTH_CELL_DATA];
+    real ay[LENGTH_CELL_DATA];
+    real az[LENGTH_CELL_DATA];
+    real at[LENGTH_CELL_DATA];
+
+#pragma unroll
+    for( uint i = 0; i < LENGTH_CELL_DATA; i++ )
+    { 
+        ax[i] = c0o1; 
+        ay[i] = c0o1; 
+        az[i] = c0o1; 
+        at[i] = c0o1;
+    }
+
+    //////////////////////////////////////////////////////////////////////////
+
+    {
+        ConservedVariables gradN, gradT1, gradT2;
+
+        reconstructFiniteDifferences(faceIndex,
+                                     dataBase,
+                                     parameters,
+                                     direction,
+                                     gradN,
+                                     gradT1,
+                                     gradT2,
+                                     facePrim,
+                                     K);
+
+        transformGlobalToLocal( gradN , direction );
+        transformGlobalToLocal( gradT1, direction );
+        transformGlobalToLocal( gradT2, direction );
+
+        transformGlobalToLocal( facePrim, direction );
+
+        computeExpansionCoefficients(facePrim, gradN , K, ax);
+        computeExpansionCoefficients(facePrim, gradT1, K, ay);
+        computeExpansionCoefficients(facePrim, gradT2, K, az);
+
+        //////////////////////////////////////////////////////////////////////////
+    }
+
+    {
+        ConservedVariables flux;
+
+        {
+            real momentU [ NUMBER_OF_MOMENTS ]; 
+            real momentV [ NUMBER_OF_MOMENTS ]; 
+            real momentW [ NUMBER_OF_MOMENTS ]; 
+            real momentXi[ NUMBER_OF_MOMENTS ];
+
+            computeMoments( facePrim, K, momentU, momentV, momentW, momentXi );
+
+            Vec3 force = parameters.force;
+
+            transformGlobalToLocal(force, direction);
+
+            {
+                ConservedVariables timeGrad;
+                computeTimeDerivative( facePrim, 
+                                       momentU, 
+                                       momentV, 
+                                       momentW, 
+                                       momentXi, 
+                                       ax, ay, az,
+                                       force,
+                                       timeGrad );
+
+                computeExpansionCoefficients( facePrim, timeGrad, K, at );
+            }
+            {
+                real timeCoefficients[4];
+                computeTimeCoefficients( facePrim, parameters, timeCoefficients );
+
+                real heatFlux;
+                assembleFlux( facePrim, 
+                              momentU, momentV, momentW, momentXi,
+                              ax, ay, az, at, 
+                              timeCoefficients, 
+                              parameters,
+                              force,
+                              flux,
+                              heatFlux );
+
+                transformLocalToGlobal( flux, direction );
+            }
+        }
+
+        //////////////////////////////////////////////////////////////////////////
+
+        {
+            uint negCellIdx = dataBase.faceToCell[ NEG_CELL(faceIndex, dataBase.numberOfFaces) ];
+            uint posCellIdx = dataBase.faceToCell[ POS_CELL(faceIndex, dataBase.numberOfFaces) ];
+
+        #if (defined(__CUDA_ARCH__) && (__CUDA_ARCH__ > 0))
+            atomicAdd( &( dataBase.diffusivity[ negCellIdx ] ), parameters.D * parameters.dx * parameters.dx * parameters.dt );
+            atomicAdd( &( dataBase.diffusivity[ posCellIdx ] ), parameters.D * parameters.dx * parameters.dx * parameters.dt );
+        #endif
+
+            CellProperties negCellProperties = dataBase.cellProperties[ negCellIdx ];
+            CellProperties posCellProperties = dataBase.cellProperties[ posCellIdx ];
+
+            //if( isCellProperties( negCellProperties, CELL_PROPERTIES_IS_FLUX_BC ) || 
+            //    isCellProperties( posCellProperties, CELL_PROPERTIES_IS_FLUX_BC ) )
+            //    return;
+
+            if( isCellProperties( negCellProperties, CELL_PROPERTIES_WALL ) || 
+                isCellProperties( posCellProperties, CELL_PROPERTIES_WALL ) )
+            {
+                flux.rho    = c0o1;
+            #ifdef USE_PASSIVE_SCALAR
+                flux.rhoS_1 = c0o1;
+                flux.rhoS_2 = c0o1;
+            #endif //USE_PASSIVE_SCALAR
+            }
+
+            if( isCellProperties( negCellProperties, CELL_PROPERTIES_IS_INSULATED ) || 
+                isCellProperties( posCellProperties, CELL_PROPERTIES_IS_INSULATED ) )
+            {
+                flux.rhoE   = c0o1;
+            }
+
+            uint negCellParentIdx = dataBase.parentCell[ negCellIdx ];
+            uint posCellParentIdx = dataBase.parentCell[ posCellIdx ];
+
+            //if( !( negCellParentIdx != INVALID_INDEX ) != !( posCellParentIdx != INVALID_INDEX ) ) // XOR
+            if( ( negCellParentIdx == INVALID_INDEX ) != ( posCellParentIdx == INVALID_INDEX ) ) // XOR
+            {
+                if( !isCellProperties( negCellProperties, CELL_PROPERTIES_GHOST ) && 
+                    !isCellProperties( posCellProperties, CELL_PROPERTIES_GHOST ) )
+                {
+                    if (negCellParentIdx != INVALID_INDEX)
+                    {
+                        applyFluxToNegCell(dataBase, negCellParentIdx, flux, direction, parameters);
+                    }
+
+                    if (posCellParentIdx != INVALID_INDEX)
+                    {
+                        applyFluxToPosCell(dataBase, posCellParentIdx, flux, direction, parameters);
+                    }
+                }
+            }
+
+            applyFluxToNegCell(dataBase, negCellIdx, flux, direction, parameters);
+            applyFluxToPosCell(dataBase, posCellIdx, flux, direction, parameters);
+        }
+    }
+}
diff --git a/src/GksGpu/FluxComputation/FluxComputation.h b/src/GksGpu/FluxComputation/FluxComputation.h
new file mode 100644
index 0000000000000000000000000000000000000000..c608d31c723bba57668a8e935bd7d4de6be3e30b
--- /dev/null
+++ b/src/GksGpu/FluxComputation/FluxComputation.h
@@ -0,0 +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 FluxComputation.h
+//! \ingroup FluxComputation
+//! \author Stephan Lenz
+//=======================================================================================
+#ifndef  FluxComputation_H
+#define  FluxComputation_H
+
+#include "VirtualFluidsDefinitions.h"
+
+#include "Core/PointerDefinitions.h"
+#include "Core/DataTypes.h"
+
+#include "DataBase/DataBase.h"
+#include "Parameters/Parameters.h"
+
+//! \brief Performs the flux computation
+class VF_PUBLIC FluxComputation
+{
+public:
+    
+    //! \brief executes the flux computation
+    //!
+    //! This function is only the entry point of the computation. The execution is 
+    //! given to CPU or GPU based on the type of DataBaseAllocator by the \ref runKernel
+    //! function which calls the \ref fluxFunction. 
+    //!
+    //! \param dataBase           shared pointer to a \ref DataBase
+    //! \param parameters         \ref Parameters object
+    //! \param level              grid level to which the flux computation should be applied
+    //! \param evaluateCommFaces  used for communication hiding
+    static void run( SPtr<DataBase> dataBase, 
+                     Parameters parameters, 
+                     uint level,
+                     bool evaluateCommFaces = false);
+};
+
+#endif
diff --git a/src/GksGpu/FluxComputation/Moments.cuh b/src/GksGpu/FluxComputation/Moments.cuh
new file mode 100644
index 0000000000000000000000000000000000000000..7ab3ffa329908dc963d9878da82d30ae51d2da65
--- /dev/null
+++ b/src/GksGpu/FluxComputation/Moments.cuh
@@ -0,0 +1,97 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 Moments.cuh
+//! \ingroup FluxComputation
+//! \author Stephan Lenz
+//=======================================================================================
+#ifndef Moments_CUH
+#define Moments_CUH
+
+#include "VirtualFluidsDefinitions.h"
+
+#include "Core/DataTypes.h"
+
+#include "DataBase/DataBase.h"
+
+#include "FlowStateData/FlowStateData.cuh"
+#include "FlowStateData/AccessDeviceData.cuh"
+
+#define NUMBER_OF_MOMENTS 7
+
+//! \brief Computes the moments of the equilibrium distribution
+//!
+//! The equations for the computation of the moments can be found in
+//! Appendix C in 
+//! <a href="https://doi.org/10.1142/9324"><b>[ Kun Xu, (2015), DOI: 10.1142/9324 ]</b></a>.
+//! 
+//! The moments do not contain 
+//! 
+//! \param[in]  facePrim   flow state on the interface as \ref PrimitiveVariables
+//! \param[in]  K          number of internal degrees of freedom
+//! \param[out] momentU    array of moments of the equilibrium function with respect to x-velocity
+//! \param[out] momentV    array of moments of the equilibrium function with respect to y-velocity
+//! \param[out] momentW    array of moments of the equilibrium function with respect to z-velocity
+//! \param[out] momentXi   array of moments of the equilibrium function with respect to internal degrees of freedom
+__host__ __device__ inline void computeMoments( const PrimitiveVariables & facePrim,
+                                                const real K,
+                                                real momentU [NUMBER_OF_MOMENTS], 
+                                                real momentV [NUMBER_OF_MOMENTS], 
+                                                real momentW [NUMBER_OF_MOMENTS], 
+                                                real momentXi[NUMBER_OF_MOMENTS] )
+{
+    momentU[0] = c1o1;
+    momentU[1] = facePrim.U;
+#pragma unroll
+    for ( uint i = 2; i < NUMBER_OF_MOMENTS; i++ )
+        momentU[i] = facePrim.U * momentU[i - 1] + ( real(i - 1) * momentU[i - 2] )/( c2o1 * facePrim.lambda );
+
+    momentV[0] = c1o1;
+    momentV[1] = facePrim.V;
+#pragma unroll
+    for ( uint i = 2; i < NUMBER_OF_MOMENTS; i++ )
+        momentV[i] = facePrim.V * momentV[i - 1] + ( real(i - 1) * momentV[i - 2] )/( c2o1 * facePrim.lambda );
+
+    momentW[0] = c1o1;
+    momentW[1] = facePrim.W;
+#pragma unroll
+    for ( uint i = 2; i < NUMBER_OF_MOMENTS; i++ )
+        momentW[i] = facePrim.W * momentW[i - 1] + ( real(i - 1) * momentW[i - 2] )/( c2o1 * facePrim.lambda );
+
+    momentXi[0] = c1o1;
+    momentXi[1] = c0o1;
+    momentXi[2] = K / ( c2o1 * facePrim.lambda );
+    momentXi[3] = c0o1;
+    momentXi[4] = K * ( c2o1 + K ) / ( c4o1 * facePrim.lambda * facePrim.lambda );
+    momentXi[5] = c0o1;
+    momentXi[6] = ( K + c4o1 ) / ( c2o1 * facePrim.lambda ) * momentXi[4];
+}
+
+
+
+#endif
\ No newline at end of file
diff --git a/src/GksGpu/FluxComputation/Reconstruction.cuh b/src/GksGpu/FluxComputation/Reconstruction.cuh
new file mode 100644
index 0000000000000000000000000000000000000000..6cd3b708f8e4f769647527f51783e1819294cf52
--- /dev/null
+++ b/src/GksGpu/FluxComputation/Reconstruction.cuh
@@ -0,0 +1,364 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 Reconstruction.cuh
+//! \ingroup FluxComputation
+//! \author Stephan Lenz
+//=======================================================================================
+#ifndef Reconstruction_CUH
+#define Reconstruction_CUH
+
+#include "VirtualFluidsDefinitions.h"
+
+#include "Core/DataTypes.h"
+
+#include "DataBase/DataBase.h"
+#include "Parameters/Parameters.h"
+
+#include "FlowStateData/FlowStateData.cuh"
+#include "FlowStateData/FlowStateDataConversion.cuh"
+#include "FlowStateData/AccessDeviceData.cuh"
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+//! \brief Reads the cell indices of the cells on positive and negative side of the face
+//!
+//! \param[in]  faceIndex       index of the current face
+//! \param[in]  dataBase        \ref DataBaseStruct that holds the memory pointers
+//! \param[out] posCellIndexN   index of the cell on the positive side of the face
+//! \param[out] negCellIndexN   index of the cell on the negative side of the face
+__host__ __device__ inline void getCellIndicesN ( const uint faceIndex,
+                                                  const DataBaseStruct& dataBase,
+                                                  uint& posCellIndexN,
+                                                  uint& negCellIndexN )
+{
+    posCellIndexN = dataBase.faceToCell[ POS_CELL( faceIndex, dataBase.numberOfFaces ) ];
+    negCellIndexN = dataBase.faceToCell[ NEG_CELL( faceIndex, dataBase.numberOfFaces ) ];
+}
+
+//! \brief Reads the cell indices of the tangential cells in x direction on positive and
+//! negative side of the face
+//!
+//! The indices are obtained by pointer chasing. First one goes to the positive/negative 
+//! cell. Then from there to the adjacent cells in x direction.
+//! 
+//! \param[in]  faceIndex       index of the current face
+//! \param[in]  dataBase        \ref DataBaseStruct that holds the memory pointers
+//! \param[in]  posCellIndexN   index of the cell on the positive side of the face
+//! \param[in]  negCellIndexN   index of the cell on the negative side of the face
+//! \param[out] posCellIndexTX  two cell indices of the cells that are neighbors in positive x direction of the positive and negative cells
+//! \param[out] negCellIndexTX  two cell indices of the cells that are neighbors in negative x direction of the positive and negative cells
+__host__ __device__ inline void getCellIndicesTX( const uint faceIndex,
+                                                  const DataBaseStruct& dataBase,
+                                                  const uint posCellIndexN,
+                                                  const uint negCellIndexN,
+                                                  uint* posCellIndexTX,
+                                                  uint* negCellIndexTX )
+{
+    posCellIndexTX[0] = dataBase.cellToCell[ CELL_TO_CELL( posCellIndexN, 0, dataBase.numberOfCells ) ];
+    posCellIndexTX[1] = dataBase.cellToCell[ CELL_TO_CELL( negCellIndexN, 0, dataBase.numberOfCells ) ];
+
+    negCellIndexTX[0] = dataBase.cellToCell[ CELL_TO_CELL( posCellIndexN, 1, dataBase.numberOfCells ) ];
+    negCellIndexTX[1] = dataBase.cellToCell[ CELL_TO_CELL( negCellIndexN, 1, dataBase.numberOfCells ) ];
+}
+
+//! \brief Reads the cell indices of the tangential cells in y direction on positive and
+//! negative side of the face
+//!
+//! The indices are obtained by pointer chasing. First one goes to the positive/negative 
+//! cell. Then from there to the adjacent cells in y direction.
+//! 
+//! \param[in]  faceIndex       index of the current face
+//! \param[in]  dataBase        \ref DataBaseStruct that holds the memory pointers
+//! \param[in]  posCellIndexN   index of the cell on the positive side of the face
+//! \param[in]  negCellIndexN   index of the cell on the negative side of the face
+//! \param[out] posCellIndexTY  two cell indices of the cells that are neighbors in positive y direction of the positive and negative cells
+//! \param[out] negCellIndexTY  two cell indices of the cells that are neighbors in negative y direction of the positive and negative cells
+__host__ __device__ inline void getCellIndicesTY( const uint faceIndex,
+                                                  const DataBaseStruct& dataBase,
+                                                  const uint posCellIndexN,
+                                                  const uint negCellIndexN,
+                                                  uint* posCellIndexTY,
+                                                  uint* negCellIndexTY )
+{
+    posCellIndexTY[0] = dataBase.cellToCell[ CELL_TO_CELL( posCellIndexN, 2, dataBase.numberOfCells ) ];
+    posCellIndexTY[1] = dataBase.cellToCell[ CELL_TO_CELL( negCellIndexN, 2, dataBase.numberOfCells ) ];
+
+    negCellIndexTY[0] = dataBase.cellToCell[ CELL_TO_CELL( posCellIndexN, 3, dataBase.numberOfCells ) ];
+    negCellIndexTY[1] = dataBase.cellToCell[ CELL_TO_CELL( negCellIndexN, 3, dataBase.numberOfCells ) ];
+}
+
+//! \brief Reads the cell indices of the tangential cells in z direction on positive and
+//! negative side of the face
+//!
+//! The indices are obtained by pointer chasing. First one goes to the positive/negative 
+//! cell. Then from there to the adjacent cells in z direction.
+//! 
+//! \param[in]  faceIndex       index of the current face
+//! \param[in]  dataBase        \ref DataBaseStruct that holds the memory pointers
+//! \param[in]  posCellIndexN   index of the cell on the positive side of the face
+//! \param[in]  negCellIndexN   index of the cell on the negative side of the face
+//! \param[out] posCellIndexTZ  two cell indices of the cells that are neighbors in positive z direction of the positive and negative cells
+//! \param[out] negCellIndexTZ  two cell indices of the cells that are neighbors in negative z direction of the positive and negative cells
+__host__ __device__ inline void getCellIndicesTZ( const uint faceIndex,
+                                                  const DataBaseStruct& dataBase,
+                                                  const uint posCellIndexN,
+                                                  const uint negCellIndexN,
+                                                  uint* posCellIndexTZ,
+                                                  uint* negCellIndexTZ )
+{
+    posCellIndexTZ[0] = dataBase.cellToCell[ CELL_TO_CELL( posCellIndexN, 4, dataBase.numberOfCells ) ];
+    posCellIndexTZ[1] = dataBase.cellToCell[ CELL_TO_CELL( negCellIndexN, 4, dataBase.numberOfCells ) ];
+
+    negCellIndexTZ[0] = dataBase.cellToCell[ CELL_TO_CELL( posCellIndexN, 5, dataBase.numberOfCells ) ];
+    negCellIndexTZ[1] = dataBase.cellToCell[ CELL_TO_CELL( negCellIndexN, 5, dataBase.numberOfCells ) ];
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+//! \brief Computes the flow state on the cell face
+//! 
+//! Linear interpolation of the conserved variables is used. Due to the uniform grid
+//! this is a simple average of the two adjacent cell states.
+//!
+//! \param[in]  posCons    \ref ConservedVariables object with flow state on positive side of the face
+//! \param[in]  negCons    \ref ConservedVariables object with flow state on negative side of the face
+//! \param[out] faceCons   \ref ConservedVariables object with flow state on the face
+__host__ __device__ inline void computeFaceCons( const ConservedVariables& posCons,
+                                                 const ConservedVariables& negCons,
+                                                 ConservedVariables& faceCons )
+{
+    faceCons.rho  = c1o2 * ( negCons.rho  + posCons.rho  );
+    faceCons.rhoU = c1o2 * ( negCons.rhoU + posCons.rhoU );
+    faceCons.rhoV = c1o2 * ( negCons.rhoV + posCons.rhoV );
+    faceCons.rhoW = c1o2 * ( negCons.rhoW + posCons.rhoW );
+    faceCons.rhoE = c1o2 * ( negCons.rhoE + posCons.rhoE );
+#ifdef USE_PASSIVE_SCALAR
+	faceCons.rhoS_1 = c1o2 * ( negCons.rhoS_1 + posCons.rhoS_1 );
+	faceCons.rhoS_2 = c1o2 * ( negCons.rhoS_2 + posCons.rhoS_2 );
+#endif // USE_PASSIVE_SCALAR
+}
+
+//! \brief Computes the normal derivative of the conserved variables
+//! on the face by central finite difference
+//! 
+//! \param[in]  parameters   \ref Parameters struct
+//! \param[in]  posCons      \ref ConservedVariables object with flow state on positive side of the face
+//! \param[in]  negCons      \ref ConservedVariables object with flow state on negative side of the face
+//! \param[in]  facePrim     \ref PrimitiveVariables object with flow state on the face
+//! \param[out] gradN        \ref ConservedVariables object with normal derivative of the flow state in terms of conserved variables and divided by density
+__host__ __device__ inline void computeGradN( const Parameters& parameters,
+                                              const ConservedVariables& posCons,
+                                              const ConservedVariables& negCons,
+                                              const PrimitiveVariables& facePrim,
+                                              ConservedVariables& gradN )
+{
+    gradN.rho  = ( posCons.rho  - negCons.rho  ) / ( parameters.dx * facePrim.rho );
+    gradN.rhoU = ( posCons.rhoU - negCons.rhoU ) / ( parameters.dx * facePrim.rho );
+    gradN.rhoV = ( posCons.rhoV - negCons.rhoV ) / ( parameters.dx * facePrim.rho );
+    gradN.rhoW = ( posCons.rhoW - negCons.rhoW ) / ( parameters.dx * facePrim.rho );
+    gradN.rhoE = ( posCons.rhoE - negCons.rhoE ) / ( parameters.dx * facePrim.rho );
+#ifdef USE_PASSIVE_SCALAR
+	gradN.rhoS_1 = ( posCons.rhoS_1 - negCons.rhoS_1 ) / ( parameters.dx * facePrim.rho );
+	gradN.rhoS_2 = ( posCons.rhoS_2 - negCons.rhoS_2 ) / ( parameters.dx * facePrim.rho );
+#endif // USE_PASSIVE_SCALAR
+}
+
+//! \brief Computes the tangential derivative of the conserved variables
+//! on the face by central finite difference
+//! 
+//! This function can be used for all three directions, by providing suitable 
+//! cell indices.
+//! 
+//! \param[in]  dataBase          \ref DataBaseStruct that holds the memory pointers
+//! \param[in]  parameters        \ref Parameters struct
+//! \param[in]  posCellIndexT     two ConservedVariables object with flow state in positive direction
+//! \param[in]  negCellIndexT     two ConservedVariables object with flow state in negative direction
+//! \param[in]  facePrim          \ref PrimitiveVariables object with flow state on the face
+//! \param[out] gradN             \ref ConservedVariables object with derivative of the flow state in terms of conserved variables and divided by density
+__host__ __device__ inline void computeGradT( const DataBaseStruct& dataBase,
+                                              const Parameters& parameters,
+                                              const uint posCellIndexT[2],
+                                              const uint negCellIndexT[2],
+                                              const PrimitiveVariables& facePrim,
+                                              ConservedVariables& gradN )
+{
+    ConservedVariables cons;
+
+    //////////////////////////////////////////////////////////////////////////
+    {
+        readCellData(posCellIndexT[0], dataBase, cons);
+
+        gradN.rho  += c1o2 * cons.rho;
+        gradN.rhoU += c1o2 * cons.rhoU;
+        gradN.rhoV += c1o2 * cons.rhoV;
+        gradN.rhoW += c1o2 * cons.rhoW;
+        gradN.rhoE += c1o2 * cons.rhoE;
+    #ifdef USE_PASSIVE_SCALAR
+        gradN.rhoS_1 += c1o2 * cons.rhoS_1;
+        gradN.rhoS_2 += c1o2 * cons.rhoS_2;
+    #endif // USE_PASSIVE_SCALAR
+    }
+    {
+        readCellData(posCellIndexT[1], dataBase, cons);
+
+        gradN.rho  += c1o2 * cons.rho;
+        gradN.rhoU += c1o2 * cons.rhoU;
+        gradN.rhoV += c1o2 * cons.rhoV;
+        gradN.rhoW += c1o2 * cons.rhoW;
+        gradN.rhoE += c1o2 * cons.rhoE;
+    #ifdef USE_PASSIVE_SCALAR
+        gradN.rhoS_1 += c1o2 * cons.rhoS_1;
+        gradN.rhoS_2 += c1o2 * cons.rhoS_2;
+    #endif // USE_PASSIVE_SCALAR
+    }
+    //////////////////////////////////////////////////////////////////////////
+    {
+        readCellData(negCellIndexT[0], dataBase, cons);
+
+        gradN.rho  -= c1o2 * cons.rho;
+        gradN.rhoU -= c1o2 * cons.rhoU;
+        gradN.rhoV -= c1o2 * cons.rhoV;
+        gradN.rhoW -= c1o2 * cons.rhoW;
+        gradN.rhoE -= c1o2 * cons.rhoE;
+    #ifdef USE_PASSIVE_SCALAR
+        gradN.rhoS_1 -= c1o2 * cons.rhoS_1;
+        gradN.rhoS_2 -= c1o2 * cons.rhoS_2;
+    #endif // USE_PASSIVE_SCALAR
+    }
+    {
+        readCellData(negCellIndexT[1], dataBase, cons);
+
+        gradN.rho  -= c1o2 * cons.rho;
+        gradN.rhoU -= c1o2 * cons.rhoU;
+        gradN.rhoV -= c1o2 * cons.rhoV;
+        gradN.rhoW -= c1o2 * cons.rhoW;
+        gradN.rhoE -= c1o2 * cons.rhoE;
+    #ifdef USE_PASSIVE_SCALAR
+        gradN.rhoS_1 -= c1o2 * cons.rhoS_1;
+        gradN.rhoS_2 -= c1o2 * cons.rhoS_2;
+    #endif // USE_PASSIVE_SCALAR
+    }
+    //////////////////////////////////////////////////////////////////////////
+    {
+        gradN.rho  /= c2o1 * parameters.dx * facePrim.rho;
+        gradN.rhoU /= c2o1 * parameters.dx * facePrim.rho;
+        gradN.rhoV /= c2o1 * parameters.dx * facePrim.rho;
+        gradN.rhoW /= c2o1 * parameters.dx * facePrim.rho;
+        gradN.rhoE /= c2o1 * parameters.dx * facePrim.rho;
+    #ifdef USE_PASSIVE_SCALAR
+        gradN.rhoS_1 /= c2o1 * parameters.dx * facePrim.rho;
+        gradN.rhoS_2 /= c2o1 * parameters.dx * facePrim.rho;
+    #endif // USE_PASSIVE_SCALAR
+    }
+    //////////////////////////////////////////////////////////////////////////
+}
+
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+//! \brief Computes the linear reconstruction of the flow field around the face
+//!
+//! \param[in]  faceIndex        index of the current face
+//! \param[in]  dataBase         \ref DataBaseStruct that holds the memory pointers
+//! \param[in]  parameters       \ref Parameters struct
+//! \param[in]  direction        char with 'x', 'y' or 'z', used for deciding on tangential derivative directions
+//! \param[out] gradN            \ref ConservedVariables object with normal derivative of the flow state in terms of conserved variables and divided by density
+//! \param[out] gradT1           \ref ConservedVariables object with first  tangential derivative of the flow state in terms of conserved variables and divided by density
+//! \param[out] gradT2           \ref ConservedVariables object with second tangential derivative of the flow state in terms of conserved variables and divided by density
+//! \param[out] facePrim         \ref PrimitiveVariables object with flow state on the face
+//! \param[out] K                deprecated
+__host__ __device__ inline void reconstructFiniteDifferences( const uint faceIndex,
+                                                              const DataBaseStruct& dataBase,
+                                                              const Parameters& parameters,
+                                                              const char direction,
+                                                              ConservedVariables& gradN,
+                                                              ConservedVariables& gradT1,
+                                                              ConservedVariables& gradT2,
+                                                              PrimitiveVariables& facePrim,
+                                                              real& K )
+{
+    uint posCellIndexN, negCellIndexN;
+
+    getCellIndicesN( faceIndex, dataBase, posCellIndexN, negCellIndexN );
+    
+    {
+        ConservedVariables posCons, negCons, faceCons;
+
+        readCellData(posCellIndexN, dataBase, posCons);
+        readCellData(negCellIndexN, dataBase, negCons);
+        
+        computeFaceCons(posCons, negCons, faceCons);
+
+        facePrim = toPrimitiveVariables( faceCons, K, false );
+
+        computeGradN( parameters, posCons, negCons, facePrim, gradN );
+    }
+
+    {
+        uint posCellIndexT1[2];
+        uint negCellIndexT1[2];
+    
+        if( direction == 'x' ) getCellIndicesTY(faceIndex, dataBase, posCellIndexN, negCellIndexN, posCellIndexT1, negCellIndexT1);
+        if( direction == 'y' ) getCellIndicesTZ(faceIndex, dataBase, posCellIndexN, negCellIndexN, posCellIndexT1, negCellIndexT1);
+        if( direction == 'z' ) getCellIndicesTX(faceIndex, dataBase, posCellIndexN, negCellIndexN, posCellIndexT1, negCellIndexT1);
+
+        computeGradT( dataBase, parameters, posCellIndexT1, negCellIndexT1, facePrim, gradT1 );
+    }
+
+    {
+        uint posCellIndexT2[2];
+        uint negCellIndexT2[2];
+    
+        if( direction == 'x' ) getCellIndicesTZ(faceIndex, dataBase, posCellIndexN, negCellIndexN, posCellIndexT2, negCellIndexT2);
+        if( direction == 'y' ) getCellIndicesTX(faceIndex, dataBase, posCellIndexN, negCellIndexN, posCellIndexT2, negCellIndexT2);
+        if( direction == 'z' ) getCellIndicesTY(faceIndex, dataBase, posCellIndexN, negCellIndexN, posCellIndexT2, negCellIndexT2);
+
+        computeGradT( dataBase, parameters, posCellIndexT2, negCellIndexT2, facePrim, gradT2 );
+    }
+}
+
+
+
+
+
+
+#endif
\ No newline at end of file
diff --git a/src/GksGpu/FluxComputation/SutherlandsLaw.cuh b/src/GksGpu/FluxComputation/SutherlandsLaw.cuh
new file mode 100644
index 0000000000000000000000000000000000000000..597e9a9fdf6d4a51f5e2e8b3e6d2bf8e9d5b79e9
--- /dev/null
+++ b/src/GksGpu/FluxComputation/SutherlandsLaw.cuh
@@ -0,0 +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 SutherlandsLaw.cuh
+//! \ingroup FluxComputation
+//! \author Stephan Lenz
+//=======================================================================================
+#ifndef SutherlandsLaw_CUH
+#define SutherlandsLaw_CUH
+
+#include <cmath>
+
+#include "VirtualFluidsDefinitions.h"
+
+#include "Core/DataTypes.h"
+#include "Core/RealConstants.h"
+
+#include "Parameters/Parameters.h"
+
+#include "FlowStateData/FlowStateData.cuh"
+#include "FlowStateData/AccessDeviceData.cuh"
+
+//! \brief Computes temperature dependent viscosity based on Sutherlands law
+//! 
+//! \param parameters       \ref Parameters struct
+//! \param r                ratio of temperature and reference temperature at which viscosity is defined
+//! 
+//! \return viscosity for given temperature ratio
+inline __host__ __device__ real sutherlandsLaw(const Parameters & parameters, const real r)
+{
+    real S  = real( 110.5 );
+
+    real T0 = real( 600.0 );
+
+    real C = S / T0;
+
+    return parameters.mu * sqrt( r * r * r ) * ( C  + c1o1 ) / ( r  + C );
+}
+
+#endif
diff --git a/src/GksGpu/FluxComputation/Transformation.cuh b/src/GksGpu/FluxComputation/Transformation.cuh
new file mode 100644
index 0000000000000000000000000000000000000000..1de488e2d577bb06877b1487b199bb09db693eea
--- /dev/null
+++ b/src/GksGpu/FluxComputation/Transformation.cuh
@@ -0,0 +1,191 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 Transformation.cuh
+//! \ingroup FluxComputation
+//! \author Stephan Lenz
+//=======================================================================================
+#ifndef Transformation_CUH
+#define Transformation_CUH
+
+#include "VirtualFluidsDefinitions.h"
+
+#include "Core/DataTypes.h"
+
+#include "DataBase/DataBase.h"
+
+#include "FlowStateData/FlowStateData.cuh"
+#include "FlowStateData/AccessDeviceData.cuh"
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+//! \brief Transforms vector from global frame of reference to local frame of reference
+//!
+//! The transformation is based on the Cartesian directions.
+//! 
+//! \param[in,out] vector       vector that is transformed
+//! \param[in]     direction    char with 'x', 'y' or 'z'
+__host__ __device__ inline void transformGlobalToLocal(Vec3& vector, const char direction)
+{
+    if( direction == 'x' ) return;
+
+    if( direction == 'y' )
+    {
+        Vec3 tmp = vector;
+    
+        vector.x = tmp.y;
+        vector.y = tmp.z;
+        vector.z = tmp.x;
+
+        return;
+    }
+
+    if( direction == 'z' )
+    {
+        Vec3 tmp = vector;
+    
+        vector.x = tmp.z;
+        vector.y = tmp.x;
+        vector.z = tmp.y;
+
+        return;
+    }
+}
+
+//! \brief Transforms vector from local frame of reference to global frame of reference
+//!
+//! The transformation is based on the Cartesian directions.
+//! 
+//! \param[in,out] vector       vector that is transformed
+//! \param[in]     direction    char with 'x', 'y' or 'z'
+__host__ __device__ inline void transformLocalToGlobal(Vec3& vector, const char direction)
+{
+    if( direction == 'x' ) return;
+
+    if( direction == 'y' )
+    {
+        Vec3 tmp;
+    
+        tmp.y = vector.x;
+        tmp.z = vector.y;
+        tmp.x = vector.z;
+
+        vector = tmp;
+
+        return;
+    }
+
+    if( direction == 'z' )
+    {
+        Vec3 tmp;
+    
+        tmp.z = vector.x;
+        tmp.x = vector.y;
+        tmp.y = vector.z;
+
+        vector = tmp;
+
+        return;
+    }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+//! \brief Transforms momentum components of \ref ConservedVariables from global frame of reference to local frame of reference
+//!
+//! The transformation is based on the Cartesian directions.
+//! 
+//! \param[in,out] cons         \ref ConservedVariables object that is transformed
+//! \param[in]     direction    char with 'x', 'y' or 'z'
+__host__ __device__ inline void transformGlobalToLocal(ConservedVariables& cons, const char direction)
+{
+    Vec3 vector( cons.rhoU, cons.rhoV, cons.rhoW );
+
+    transformGlobalToLocal( vector, direction );
+
+    cons.rhoU = vector.x;
+    cons.rhoV = vector.y;
+    cons.rhoW = vector.z;
+}
+
+//! \brief Transforms velocity components of \ref PrimitiveVariables from global frame of reference to local frame of reference
+//!
+//! The transformation is based on the Cartesian directions.
+//! 
+//! \param[in,out] prim         \ref PrimitiveVariables object that is transformed
+//! \param[in]     direction    char with 'x', 'y' or 'z'
+__host__ __device__ inline void transformGlobalToLocal(PrimitiveVariables& prim, const char direction)
+{
+    Vec3 vector( prim.U, prim.V, prim.W );
+
+    transformGlobalToLocal( vector, direction );
+
+    prim.U = vector.x;
+    prim.V = vector.y;
+    prim.W = vector.z;
+}
+
+//////////////////////////////////////////////////////////////////////////
+
+//! \brief Transforms momentum components of \ref ConservedVariables from local frame of reference to global frame of reference
+//!
+//! The transformation is based on the Cartesian directions.
+//! 
+//! \param[in,out]  cons         \ref ConservedVariables object that is transformed
+//! \param[in]      direction    char with 'x', 'y' or 'z'
+__host__ __device__ inline void transformLocalToGlobal(ConservedVariables& cons, const char direction)
+{
+    Vec3 vector( cons.rhoU, cons.rhoV, cons.rhoW );
+
+    transformLocalToGlobal( vector, direction );
+
+    cons.rhoU = vector.x;
+    cons.rhoV = vector.y;
+    cons.rhoW = vector.z;
+}
+
+//! \brief Transforms velocity components of \ref PrimitiveVariables from local frame of reference to global frame of reference
+//!
+//! The transformation is based on the Cartesian directions.
+//! 
+//! \param[in,out] prim         \ref PrimitiveVariables object that is transformed
+//! \param[in]     direction    char with 'x', 'y' or 'z'
+__host__ __device__ inline void transformLocalToGlobal(PrimitiveVariables& prim, const char direction)
+{
+    Vec3 vector( prim.U, prim.V, prim.W );
+
+    transformLocalToGlobal( vector, direction );
+
+    prim.U = vector.x;
+    prim.V = vector.y;
+    prim.W = vector.z;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#endif
diff --git a/src/GksGpu/FluxComputation/package.include b/src/GksGpu/FluxComputation/package.include
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/src/GksGpu/Initializer/Initializer.cpp b/src/GksGpu/Initializer/Initializer.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..83ea06f97295969f58ba6247b5a5a0a2006e9b17
--- /dev/null
+++ b/src/GksGpu/Initializer/Initializer.cpp
@@ -0,0 +1,67 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 Initializer.cpp
+//! \ingroup Initializer
+//! \author Stephan Lenz
+//=======================================================================================
+#include "Initializer.h"
+
+#include <sstream>
+#define _USE_MATH_DEFINES
+#include <math.h>
+
+#include "Core/PointerDefinitions.h"
+#include "Core/RealConstants.h"
+
+#include "DataBase/DataBaseStruct.h"
+
+#include "Definitions/MemoryAccessPattern.h"
+#include "Definitions/PassiveScalar.h"
+
+void Initializer::interpret(SPtr<DataBase> dataBase, std::function<ConservedVariables(Vec3)> initialCondition)
+{
+    for( uint cellIdx = 0; cellIdx < dataBase->numberOfCells; cellIdx++ ){
+
+        Vec3 cellCenter = dataBase->getCellCenter( cellIdx );
+
+        ConservedVariables cellCons = initialCondition(cellCenter);
+
+        dataBase->dataHost[ RHO__(cellIdx, dataBase->numberOfCells) ] = cellCons.rho ;
+        dataBase->dataHost[ RHO_U(cellIdx, dataBase->numberOfCells) ] = cellCons.rhoU;
+        dataBase->dataHost[ RHO_V(cellIdx, dataBase->numberOfCells) ] = cellCons.rhoV;
+        dataBase->dataHost[ RHO_W(cellIdx, dataBase->numberOfCells) ] = cellCons.rhoW;
+        dataBase->dataHost[ RHO_E(cellIdx, dataBase->numberOfCells) ] = cellCons.rhoE;
+    #ifdef USE_PASSIVE_SCALAR
+	    dataBase->dataHost[ RHO_S_1(cellIdx, dataBase->numberOfCells) ] = cellCons.rhoS_1;
+	    dataBase->dataHost[ RHO_S_2(cellIdx, dataBase->numberOfCells) ] = cellCons.rhoS_2;
+    #endif // USE_PASSIVE_SCALAR
+    }
+
+    return;
+}
diff --git a/src/GksGpu/Initializer/Initializer.h b/src/GksGpu/Initializer/Initializer.h
new file mode 100644
index 0000000000000000000000000000000000000000..33c64c15f1c922d8e3feba4858831b26718fca90
--- /dev/null
+++ b/src/GksGpu/Initializer/Initializer.h
@@ -0,0 +1,64 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 Initializer.h
+//! \ingroup Initializer
+//! \author Stephan Lenz
+//=======================================================================================
+#ifndef  Initializer_H
+#define  Initializer_H
+
+#include <string>
+#include <memory>
+#include <functional>
+
+#include "VirtualFluidsDefinitions.h"
+
+#include "Core/PointerDefinitions.h"
+#include "Core/DataTypes.h"
+#include "Core/VectorTypes.h"
+
+#include "DataBase/DataBase.h"
+#include "FlowStateData/FlowStateData.cuh"
+
+//! \brief Class for initial conditions and data initialization
+class VF_PUBLIC Initializer
+{
+public:
+
+    //! \brief interprets an initial condition and set initial value in \ref DataBase::dataHost
+    //!
+    //! \param dataBase            shared pointer to \ref DataBase
+    //! \param initialCondition    function that returns a \ref ConservedVariables object for every location
+    static void interpret( SPtr<DataBase> dataBase, std::function<ConservedVariables(Vec3)> initialCondition );
+
+    //! \brief initializes the \ref DataBase::dataUpdate array with zero
+    static void initializeDataUpdate( SPtr<DataBase> dataBase );
+};
+
+#endif
diff --git a/src/GksGpu/Initializer/InitializerKernel.cu b/src/GksGpu/Initializer/InitializerKernel.cu
new file mode 100644
index 0000000000000000000000000000000000000000..e3b26714edeb420e5c65bba9bb8d9d24cf1e7433
--- /dev/null
+++ b/src/GksGpu/Initializer/InitializerKernel.cu
@@ -0,0 +1,99 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 InitializerKernel.cu
+//! \ingroup Initializer
+//! \author Stephan Lenz
+//=======================================================================================
+#include "Initializer.h"
+
+#include <cuda.h>
+#include <cuda_runtime.h>
+#include <helper_cuda.h>
+
+#include "Core/PointerDefinitions.h"
+#include "Core/RealConstants.h"
+
+#include "DataBase/DataBaseStruct.h"
+
+#include "Definitions/MemoryAccessPattern.h"
+#include "Definitions/PassiveScalar.h"
+
+#include "CudaUtility/CudaRunKernel.hpp"
+
+//! \brief This is a CUDA Kernel that computes the cell index and calls \ref initializeDataUpdateFunction for this index
+__global__                 void initializeDataUpdateKernel  ( DataBaseStruct dataBase, uint numberOfEntities );
+
+//! \brief Sets \ref DataBase::dataUpdate for one cell to zero 
+__host__ __device__ inline void initializeDataUpdateFunction( DataBaseStruct dataBase, uint index );
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void Initializer::initializeDataUpdate( SPtr<DataBase> dataBase )
+{
+    CudaUtility::CudaGrid grid( dataBase->numberOfCells, 32 );
+
+    runKernel( initializeDataUpdateKernel,
+               initializeDataUpdateFunction,
+               dataBase->getDeviceType(), grid, 
+               dataBase->toStruct() );
+
+    cudaDeviceSynchronize();
+
+    getLastCudaError("Initializer::initializeDataUpdate( SPtr<DataBase> dataBase )");
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+__global__ void initializeDataUpdateKernel(DataBaseStruct dataBase, uint numberOfEntities)
+{
+    uint index = blockIdx.x * blockDim.x + threadIdx.x;
+
+    if( index >= numberOfEntities ) return;
+
+    initializeDataUpdateFunction( dataBase, index );
+}
+
+__host__ __device__ inline void initializeDataUpdateFunction(DataBaseStruct dataBase, uint index)
+{
+    dataBase.dataUpdate[ RHO__(index, dataBase.numberOfCells) ] = c0o1;
+    dataBase.dataUpdate[ RHO_U(index, dataBase.numberOfCells) ] = c0o1;
+    dataBase.dataUpdate[ RHO_V(index, dataBase.numberOfCells) ] = c0o1;
+    dataBase.dataUpdate[ RHO_W(index, dataBase.numberOfCells) ] = c0o1;
+    dataBase.dataUpdate[ RHO_E(index, dataBase.numberOfCells) ] = c0o1;
+#ifdef USE_PASSIVE_SCALAR
+	dataBase.dataUpdate[ RHO_S_1(index, dataBase.numberOfCells) ] = c0o1;
+	dataBase.dataUpdate[ RHO_S_2(index, dataBase.numberOfCells) ] = c0o1;
+#endif // USE_PASSIVE_SCALAR
+
+    dataBase.massFlux[ VEC_X(index, dataBase.numberOfCells) ]   = c0o1;
+    dataBase.massFlux[ VEC_Y(index, dataBase.numberOfCells) ]   = c0o1;
+    dataBase.massFlux[ VEC_Z(index, dataBase.numberOfCells) ]   = c0o1;
+
+    dataBase.diffusivity[ index ] = c1o1;
+}
diff --git a/src/GksGpu/Initializer/package.include b/src/GksGpu/Initializer/package.include
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/src/GksGpu/Output/VtkWriter.cpp b/src/GksGpu/Output/VtkWriter.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..99cc5be130a0986a2630f39bde14926457893cda
--- /dev/null
+++ b/src/GksGpu/Output/VtkWriter.cpp
@@ -0,0 +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 VtkWriter.cpp
+//! \ingroup Output
+//! \author Stephan Lenz
+//=======================================================================================
+#include "VtkWriter.h"
+
+#include <vector>
+#include <memory>
+
+#include "Core/Logger/Logger.h"
+
+#include "VirtualFluidsBasics/basics/utilities/UbTuple.h"
+#include "VirtualFluidsBasics/basics/writer/WbWriterVtkXmlBinary.h"
+
+#include "DataBase/DataBase.h"
+#include "Parameters/Parameters.h"
+
+#include "FlowStateData/FlowStateData.cuh"
+#include "FlowStateData/FlowStateDataConversion.cuh"
+#include "FlowStateData/AccessDeviceData.cuh"
+
+void VtkWriter::write(std::shared_ptr<DataBase> dataBase, Parameters parameters, std::string filename)
+{
+    *logging::out << logging::Logger::INFO_INTERMEDIATE << "Write " << filename << ".vtu" << " ... \n";
+
+    //////////////////////////////////////////////////////////////////////////
+
+    std::vector< UbTupleFloat3 > nodes;
+    std::vector< UbTupleInt8  > cells;
+
+    nodes.resize( dataBase->numberOfNodes );
+    cells.resize( dataBase->numberOfCells );
+
+    for( uint nodeIdx = 0; nodeIdx < dataBase->numberOfNodes; nodeIdx++ )
+    {
+        Vec3& node = dataBase->nodeCoordinates[ nodeIdx ];
+
+        nodes[nodeIdx] = makeUbTuple( node.x, node.y, node.z );
+    }
+    
+    for( uint cellIdx = 0; cellIdx < dataBase->numberOfCells; cellIdx++ )
+    {
+        cells[cellIdx] = makeUbTuple( (int)dataBase->cellToNode[ cellIdx ][ 0 ],
+                                      (int)dataBase->cellToNode[ cellIdx ][ 1 ],
+                                      (int)dataBase->cellToNode[ cellIdx ][ 2 ],
+                                      (int)dataBase->cellToNode[ cellIdx ][ 3 ],
+                                      (int)dataBase->cellToNode[ cellIdx ][ 4 ],
+                                      (int)dataBase->cellToNode[ cellIdx ][ 5 ],
+                                      (int)dataBase->cellToNode[ cellIdx ][ 6 ],
+                                      (int)dataBase->cellToNode[ cellIdx ][ 7 ] );
+    }
+
+    //////////////////////////////////////////////////////////////////////////
+
+    std::vector< std::string > cellDataNames;
+    cellDataNames.push_back("Press");       // 0
+    cellDataNames.push_back("Rho");         // 1
+    cellDataNames.push_back("Vx");          // 2
+    cellDataNames.push_back("Vy");          // 3
+    cellDataNames.push_back("Vz");          // 4
+    cellDataNames.push_back("Temperature"); // 5
+    cellDataNames.push_back("Geometry");    // 6
+#ifdef USE_PASSIVE_SCALAR
+    cellDataNames.push_back("S_1");         // 7
+    cellDataNames.push_back("S_2");         // 8
+#endif
+
+    //////////////////////////////////////////////////////////////////////////
+
+    std::vector< std::vector< double > > cellData(cellDataNames.size());
+
+    for( auto& i : cellData ) i.resize( dataBase->numberOfCells );
+
+    for( uint cellIdx = 0; cellIdx < dataBase->numberOfCells; cellIdx++ )
+    {
+        ConservedVariables cons;
+
+        cons.rho  = dataBase->dataHost[ RHO__(cellIdx, dataBase->numberOfCells) ];
+        cons.rhoU = dataBase->dataHost[ RHO_U(cellIdx, dataBase->numberOfCells) ];
+        cons.rhoV = dataBase->dataHost[ RHO_V(cellIdx, dataBase->numberOfCells) ];
+        cons.rhoW = dataBase->dataHost[ RHO_W(cellIdx, dataBase->numberOfCells) ];
+        cons.rhoE = dataBase->dataHost[ RHO_E(cellIdx, dataBase->numberOfCells) ];
+#ifdef USE_PASSIVE_SCALAR
+        cons.rhoS_1 = dataBase->dataHost[ RHO_S_1(cellIdx, dataBase->numberOfCells) ];
+        cons.rhoS_2 = dataBase->dataHost[ RHO_S_2(cellIdx, dataBase->numberOfCells) ];
+#endif // USE_PASSIVE_SCALAR
+
+        PrimitiveVariables prim = toPrimitiveVariables(cons, parameters.K);
+
+        real p = 0.5 * prim.rho / prim.lambda;
+
+#ifdef USE_PASSIVE_SCALAR
+        real T = getT(prim);
+#else // USE_PASSIVE_SCALAR
+        real T = 1.0 / prim.lambda;
+#endif // USE_PASSIVE_SCALAR
+
+        cellData[0][cellIdx] = p;
+        cellData[1][cellIdx] = prim.rho;
+        cellData[2][cellIdx] = prim.U;
+        cellData[3][cellIdx] = prim.V;
+        cellData[4][cellIdx] = prim.W;
+        cellData[5][cellIdx] = T;
+        cellData[6][cellIdx] = dataBase->isGhostCell(cellIdx);
+#ifdef USE_PASSIVE_SCALAR
+        cellData[7][cellIdx] = prim.S_1;
+        cellData[8][cellIdx] = prim.S_2;
+#endif
+    }
+
+    //////////////////////////////////////////////////////////////////////////
+
+    WbWriterVtkXmlBinary::getInstance()->writeOctsWithCellData(filename, nodes, cells, cellDataNames, cellData);
+
+    //////////////////////////////////////////////////////////////////////////
+
+    *logging::out << logging::Logger::INFO_INTERMEDIATE << "done!\n";
+}
diff --git a/src/GksGpu/Output/VtkWriter.h b/src/GksGpu/Output/VtkWriter.h
new file mode 100644
index 0000000000000000000000000000000000000000..c2f5dd339fa8f3027d7a52d2bf366897602057fe
--- /dev/null
+++ b/src/GksGpu/Output/VtkWriter.h
@@ -0,0 +1,50 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 VtkWriter.h
+//! \ingroup Output
+//! \author Stephan Lenz
+//=======================================================================================
+#ifndef VTK_WRITER_H
+#define VTK_WRITER_H
+
+#include <memory>
+#include <string>
+
+struct DataBase;
+struct Parameters;
+
+class VF_PUBLIC VtkWriter
+{
+public:
+    static void write( std::shared_ptr<DataBase> dataBase, 
+                       Parameters parameters, 
+                       std::string filename );
+};
+
+#endif
\ No newline at end of file
diff --git a/src/GksGpu/Output/package.include b/src/GksGpu/Output/package.include
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/src/GksGpu/Parameters/Parameters.h b/src/GksGpu/Parameters/Parameters.h
new file mode 100644
index 0000000000000000000000000000000000000000..a28056ceef5314260243f7d17654378c414ac5a5
--- /dev/null
+++ b/src/GksGpu/Parameters/Parameters.h
@@ -0,0 +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 Parameters.h
+//! \ingroup Parameters
+//! \author Stephan Lenz
+//=======================================================================================
+#ifndef Parameters_H
+#define Parameters_H
+
+#include "Core/DataTypes.h"
+#include "Core/VectorTypes.h"
+
+#include <VirtualFluidsDefinitions.h>
+
+enum class VF_PUBLIC ViscosityModel{
+    constant,
+    sutherlandsLaw
+};
+
+//! Comprises all simulation parameters for passing them to kernels
+struct  VF_PUBLIC Parameters
+{
+
+    real mu = real(0.01);
+    real K  = real(2.0);
+    real Pr = real(1.0);
+    real D  = real(0.01);
+    real D1 = real(0.01);
+    real D2 = real(0.01);
+
+    real dt = real(0.01);
+    real dx = real(0.01);
+
+    Vec3 force;
+
+    real lambdaRef = real(1.0);
+
+    real rhoRef = real(1.0);
+
+    ViscosityModel viscosityModel = ViscosityModel::constant;
+
+    real boussinesqT0   = real(1.0);
+    real boussinesqBeta = real(1.0);
+
+    //////////////////////////////////////////////////////////////////////////
+
+    bool useSmagorinsky = false;
+    real smagorinskyConstant = real(0.2);
+
+    //////////////////////////////////////////////////////////////////////////
+
+    bool useSpongeLayer = false;
+    uint spongeLayerIdx = 0;
+
+    //////////////////////////////////////////////////////////////////////////
+
+    uint forcingSchemeIdx = 0;
+
+    //////////////////////////////////////////////////////////////////////////
+
+    bool useTemperatureLimiter     = false;
+    bool usePassiveScalarLimiter   = false;
+
+    real temperatureLimiter     = real(1.0e-3);
+    real passiveScalarLimiter   = real(0.1);
+};
+
+#endif
diff --git a/src/GksGpu/Parameters/package.include b/src/GksGpu/Parameters/package.include
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/src/GksGpu/TimeStepping/NestedTimeStep.cpp b/src/GksGpu/TimeStepping/NestedTimeStep.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..e73c6c491a37db159f1f3753a43c8bd2e8f23125
--- /dev/null
+++ b/src/GksGpu/TimeStepping/NestedTimeStep.cpp
@@ -0,0 +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 NestedTimeStep.cpp
+//! \ingroup TimeStepping
+//! \author Stephan Lenz
+//=======================================================================================
+#include "NestedTimeStep.h"
+
+#include "BoundaryConditions/BoundaryCondition.h"
+#include "CellUpdate/CellUpdate.h"
+#include "FluxComputation/FluxComputation.h"
+
+void TimeStepping::nestedTimeStep( SPtr<DataBase> dataBase, 
+                                   Parameters parameters,
+                                   uint level )
+{
+    for( SPtr<BoundaryCondition> bc : dataBase->boundaryConditions )
+    {
+        bc->runBoundaryConditionKernel( dataBase, parameters, level );
+    }
+
+    FluxComputation::run( dataBase, parameters, level );
+
+    CellUpdate::run( dataBase, parameters, level );
+}
+
diff --git a/src/GksGpu/TimeStepping/NestedTimeStep.h b/src/GksGpu/TimeStepping/NestedTimeStep.h
new file mode 100644
index 0000000000000000000000000000000000000000..e8a2f28285618e3b05dc62ee28d8446bf0b1515a
--- /dev/null
+++ b/src/GksGpu/TimeStepping/NestedTimeStep.h
@@ -0,0 +1,60 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 NestedTimeStep.h
+//! \ingroup TimeStepping
+//! \author Stephan Lenz
+//=======================================================================================
+#ifndef  NestedTimeStep_H
+#define  NestedTimeStep_H
+
+#include "VirtualFluidsDefinitions.h"
+
+#include "Core/PointerDefinitions.h"
+#include "Core/DataTypes.h"
+
+#include "DataBase/DataBase.h"
+#include "Parameters/Parameters.h"
+
+//! \brief Class for the execution of time steps
+class VF_PUBLIC TimeStepping
+{
+public:
+
+    //! \brief Performs a single time step
+    //! 
+    //! \param dataBase    shared pointer to \ref DataBase
+    //! \param parameters  \ref Parameters struct
+    //! \param level       grid level on which the time step should be performed
+    static void nestedTimeStep( SPtr<DataBase> dataBase, 
+                                Parameters parameters, 
+                                uint level );
+
+};
+
+#endif
diff --git a/src/GksGpu/TimeStepping/package.include b/src/GksGpu/TimeStepping/package.include
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/src/GksGpu/package.include b/src/GksGpu/package.include
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/src/GksMeshAdapter/GksMeshAdapter.cpp b/src/GksMeshAdapter/GksMeshAdapter.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..52a40e71b6ca3308a855ffbe251bdd1236169f0b
--- /dev/null
+++ b/src/GksMeshAdapter/GksMeshAdapter.cpp
@@ -0,0 +1,692 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 GksMeshAdapter.cpp
+//! \ingroup GksMeshAdapter
+//! \author Stephan Lenz
+//=======================================================================================
+#include "GksMeshAdapter.h"
+
+#define _USE_MATH_DEFINES
+#include <math.h>
+
+#include <fstream>
+#include <algorithm>
+#include <numeric>
+#include <functional>
+#include <iostream>
+#include <iomanip>
+#include <sstream>
+
+#include "Core/Logger/Logger.h"
+
+#include "GridGenerator/grid/distributions/D3Q27.h"
+#include "GridGenerator/grid/GridBuilder/MultipleGridBuilder.h"
+#include "GridGenerator/grid/NodeValues.h"
+#include "GridGenerator/utilities/math/Math.h"
+
+#include "MeshCell.h"
+#include "MeshFace.h"
+
+GksMeshAdapter::GksMeshAdapter(SPtr<MultipleGridBuilder> gridBuilder)
+    : gridBuilder(gridBuilder)
+{}
+
+void GksMeshAdapter::inputGrid()
+{
+    *logging::out << logging::Logger::INFO_INTERMEDIATE << "inputGrid()" << "\n";
+
+    this->numberOfLevels = this->gridBuilder->getNumberOfGridLevels();
+
+    std::vector< SPtr<Grid> > grids = this->gridBuilder->getGrids();
+
+    this->dxCoarse = grids[0]->getDelta();
+
+    //////////////////////////////////////////////////////////////////////////
+
+    *logging::out << logging::Logger::INFO_INTERMEDIATE << "Allocate gridToMesh[][]" << "\n";
+
+    this->gridToMesh.resize( this->gridBuilder->getNumberOfGridLevels() );
+
+    for( uint level = 0; level < this->gridBuilder->getNumberOfGridLevels(); level++ ){
+        this->gridToMesh[level].resize( grids[level]->getSize() );
+
+        for( auto& cellIdx : this->gridToMesh[level] ) cellIdx = INVALID_INDEX;
+    }
+
+    //////////////////////////////////////////////////////////////////////////
+    //
+    //    I d e n t i f y    C e l l s    i n    L B - G r i d
+    //
+    //////////////////////////////////////////////////////////////////////////
+
+    uint numberOfCells = 0;
+
+    for( uint level = 0; level < this->gridBuilder->getNumberOfGridLevels(); level++ ){
+        for( uint gridIdx = 0; gridIdx < grids[level]->getSize(); gridIdx++ ){
+            if (grids[level]->getFieldEntry(gridIdx)  != STOPPER_COARSE_UNDER_FINE &&
+                grids[level]->getFieldEntry(gridIdx)  != INVALID_COARSE_UNDER_FINE &&
+                grids[level]->getFieldEntry(gridIdx)  != INVALID_OUT_OF_GRID &&
+                grids[level]->getFieldEntry(gridIdx)  != INVALID_SOLID )
+            {
+                this->gridToMesh[level][gridIdx] = numberOfCells++;
+            }
+        }
+    }
+    
+    //////////////////////////////////////////////////////////////////////////
+    //
+    //    S e t    M e s h    t o    G r i d    i n f o r m a t i o n
+    //
+    //////////////////////////////////////////////////////////////////////////
+
+    *logging::out << logging::Logger::INFO_INTERMEDIATE << "Allocate " << numberOfCells << " cells" << "\n";
+
+    this->cells.resize( numberOfCells );
+
+    for( uint level = 0; level < this->gridBuilder->getNumberOfGridLevels(); level++ ){
+        for( uint gridIdx = 0; gridIdx < grids[level]->getSize(); gridIdx++ ){
+            if ( this->gridToMesh[level][gridIdx] != INVALID_INDEX ){
+
+                uint cellIdx = gridToMesh[level][gridIdx];
+
+                MeshCell& cell = this->cells[ cellIdx ];
+
+                cell.level   = level;
+                cell.gridIdx = gridIdx;
+
+                cell.type = grids[level]->getFieldEntry(gridIdx);
+            }
+        }
+    }
+
+    //////////////////////////////////////////////////////////////////////////
+
+    this->findCellToCellConnectivity();
+    this->countCells();
+    this->partitionCells();
+    this->generateNodes();
+    this->computeCellGeometry();
+
+    this->generateFaces();
+    this->sortFaces();
+    this->countFaces();
+
+    //////////////////////////////////////////////////////////////////////////
+
+    *logging::out << logging::Logger::INFO_INTERMEDIATE << "inputGrid() finished!" << "\n";
+}
+
+void GksMeshAdapter::findCellToCellConnectivity()
+{
+    *logging::out << logging::Logger::INFO_INTERMEDIATE << "findCellToCellConnectivity()" << "\n";
+
+    std::vector< SPtr<Grid> > grids = this->gridBuilder->getGrids();
+
+    Distribution dirs = DistributionHelper::getDistribution27();
+
+    for( uint cellIdx = 0; cellIdx < this->cells.size(); cellIdx++ ){
+    
+        MeshCell& cell = this->cells[ cellIdx ];
+
+        real x, y, z;
+        grids[cell.level]->transIndexToCoords(cell.gridIdx, x, y, z);
+
+        real d = grids[cell.level]->getDelta();
+
+        for( uint idx = 0; idx < 27; idx++ )
+        {
+            if( idx == DIR_27_ZERO ) continue;
+
+            int xSign = dirs.directions[idx][0];
+            int ySign = dirs.directions[idx][1];
+            int zSign = dirs.directions[idx][2];
+
+            uint neighborGridIdx = grids[cell.level]->transCoordToIndex( x + xSign * d, 
+                                                                         y + ySign * d, 
+                                                                         z + zSign * d );
+
+            if( neighborGridIdx == INVALID_INDEX || this->gridToMesh[cell.level][neighborGridIdx] == INVALID_INDEX ){
+                if( !cell.isCoarseGhostCell() && cell.type != BC_SOLID )
+                    cell.isGhostCell = true;
+
+                continue;
+            }
+
+            cell.cellToCell[ idx ] = this->gridToMesh[cell.level][neighborGridIdx];
+        }
+    }
+}
+
+void GksMeshAdapter::countCells()
+{
+    *logging::out << logging::Logger::INFO_INTERMEDIATE << "countCells()" << "\n";
+
+    this->numberOfCellsPerLevel    .resize( this->numberOfLevels );
+    this->numberOfBulkCellsPerLevel.resize( this->numberOfLevels );
+    this->startOfCellsPerLevel     .resize( this->numberOfLevels );
+
+    for( auto& i : this->numberOfCellsPerLevel     ) i = 0;
+    for( auto& i : this->numberOfBulkCellsPerLevel ) i = 0;
+    for( auto& i : this->startOfCellsPerLevel      ) i = 0;
+
+    uint level = 0;
+    for( uint cellIdx = 0; cellIdx < this->cells.size(); cellIdx++ ){
+        MeshCell& cell = this->cells[ cellIdx ];
+
+        if( cell.level != level ) level++;
+
+        this->numberOfCellsPerLevel[ level ]++; 
+
+        if( ! ( cell.isGhostCell || cell.isCoarseGhostCell() ) )
+            this->numberOfBulkCellsPerLevel[ level ]++;
+    }
+
+    for( uint level = 1; level < this->numberOfLevels; level++ )
+        this->startOfCellsPerLevel[ level ] = this->startOfCellsPerLevel[ level-1 ] + this->numberOfCellsPerLevel[ level-1 ];
+}
+
+void GksMeshAdapter::partitionCells()
+{
+    *logging::out << logging::Logger::INFO_INTERMEDIATE << "partitionCells()" << "\n";
+
+    for( uint level = 0; level < this->numberOfLevels; level++ ){
+
+        std::vector<uint> idxMap( this->cells.size() );
+        std::iota( idxMap.begin(), idxMap.end(), 0 );
+
+        // partition idxMap
+        std::stable_partition(  idxMap.begin() + this->startOfCellsPerLevel[level], 
+                                idxMap.begin() + this->startOfCellsPerLevel[level] 
+                                               + this->numberOfCellsPerLevel[level], 
+                                [this](int lhs){ 
+                                    return ! ( this->cells[ lhs ].isGhostCell || this->cells[ lhs ].isCoarseGhostCell() );
+                                }
+                             );
+
+        // invert idxMap
+        {
+            std::vector<uint> buffer = idxMap;
+            for( uint idx = 0; idx < idxMap.size(); idx ++ )
+                idxMap[ buffer[idx] ] = idx;
+        }
+
+        // partition cell list
+        std::stable_partition(  this->cells.begin() + this->startOfCellsPerLevel[level], 
+                                this->cells.begin() + this->startOfCellsPerLevel[level] 
+                                                    + this->numberOfCellsPerLevel[level], 
+                                [this](MeshCell lhs){ 
+                                    return ! ( lhs.isGhostCell || lhs.isCoarseGhostCell() );
+                                }
+                             );
+
+        this->refreshCellConnectivity( idxMap );
+    }
+}
+
+void GksMeshAdapter::refreshCellConnectivity(const std::vector<uint>& idxMap)
+{
+    *logging::out << logging::Logger::INFO_INTERMEDIATE << "refreshCellConnectivity()" << "\n";
+
+    for( auto& cell : this->cells ){
+        for( uint idx = 0; idx < 27; idx++ )
+            if( cell.cellToCell[ idx ] != INVALID_INDEX )
+                cell.cellToCell[ idx ] = idxMap[ cell.cellToCell[ idx ] ];
+
+        if( cell.parent != INVALID_INDEX )
+            cell.parent = idxMap[ cell.parent ];
+
+        for( uint idx = 0; idx < 8; idx++ )
+            if( cell.children[ idx ] != INVALID_INDEX )
+                cell.children[ idx ] = idxMap[ cell.children[ idx ] ];
+    }
+
+    for( auto& grid : this->gridToMesh ){
+        for( auto& cellIdx : grid ){
+            if( cellIdx != INVALID_INDEX )
+                cellIdx = idxMap[ cellIdx ];
+        }
+    }
+}
+
+void GksMeshAdapter::generateNodes()
+{
+    *logging::out << logging::Logger::INFO_INTERMEDIATE << "generateNodes()" << "\n";
+
+    std::vector< SPtr<Grid> > grids = gridBuilder->getGrids();
+
+    nodes.reserve( 2 * this->cells.size() );
+
+    Distribution dirs = DistributionHelper::getDistribution27();
+
+    for( uint cellIdx = 0; cellIdx < this->cells.size(); cellIdx++ ){
+    
+        MeshCell& cell = this->cells[ cellIdx ];
+
+        //if( cell.type == STOPPER_SOLID ) continue;
+
+        real x, y, z;
+        grids[cell.level]->transIndexToCoords(cell.gridIdx, x, y, z);
+
+        real d = 0.5 * grids[cell.level]->getDelta();
+
+        std::array<Vec3,8> dir;
+
+        for( uint idx = 0; idx < 8; idx++ )
+        {
+            if( cell.cellToNode[idx] == INVALID_INDEX )
+            {
+
+                real dx = dirs.directions[idx + 19][0] * d;
+                real dy = dirs.directions[idx + 19][1] * d;
+                real dz = dirs.directions[idx + 19][2] * d;
+
+                nodes.push_back( Vec3( x + dx, y + dy, z + dz ) );
+
+                cell.cellToNode[idx] = nodes.size()-1;
+
+                //// register new node at neighbor cells on same level
+                for (uint idx = 0; idx < 8; idx++)
+                {
+                    real dxNeighbor = -dirs.directions[idx + 19][0] * d;
+                    real dyNeighbor = -dirs.directions[idx + 19][1] * d;
+                    real dzNeighbor = -dirs.directions[idx + 19][2] * d;
+
+                    real xNeighbor = nodes.back().x + dxNeighbor;
+                    real yNeighbor = nodes.back().y + dyNeighbor;
+                    real zNeighbor = nodes.back().z + dzNeighbor;
+
+                    uint neighborGridIdx = grids[cell.level]->transCoordToIndex(xNeighbor, yNeighbor, zNeighbor);
+
+                    if ( neighborGridIdx == INVALID_INDEX ) continue;
+
+                    uint neighborIdx = gridToMesh[cell.level][neighborGridIdx];
+
+                    if ( neighborIdx != INVALID_INDEX )
+                    {
+                        this->cells[ neighborIdx ].cellToNode[idx] = nodes.size() - 1;
+                    }
+                }
+            }
+        }
+    }
+}
+
+void GksMeshAdapter::computeCellGeometry()
+{    
+    for( uint cellIdx = 0; cellIdx < this->cells.size(); cellIdx++ ){
+        
+        MeshCell& cell = this->cells[ cellIdx ];
+
+        Vec3 cellCenter;
+
+        for( uint node = 0; node < 8; node++ ){
+            cellCenter = cellCenter + this->nodes[ cell.cellToNode[node] ];
+        }
+
+        cell.cellCenter.x = cellCenter.x / c8o1;
+        cell.cellCenter.y = cellCenter.y / c8o1;
+        cell.cellCenter.z = cellCenter.z / c8o1;
+    }
+}
+
+void GksMeshAdapter::generateFaces()
+{
+    *logging::out << logging::Logger::INFO_INTERMEDIATE << "generateFaces()" << "\n";
+
+    std::vector< SPtr<Grid> > grids = this->gridBuilder->getGrids();
+
+    this->faces.reserve( 2 * this->cells.size() );
+
+    for( uint cellIdx = 0; cellIdx < this->cells.size(); cellIdx++ ){
+    
+        MeshCell& cell = this->cells[ cellIdx ];
+
+        //if( cell.type == BC_SOLID || cell.type == STOPPER_SOLID ) continue;
+
+        // generate faces in positive direction
+        for( uint neighborIdx = 0; neighborIdx < 6; neighborIdx += 2 ){
+
+            if( cell.faceExists[ neighborIdx ] ) continue;
+
+            if( cell.cellToCell[ neighborIdx ] == INVALID_INDEX ) continue;
+
+            uint neighborCellIdx = cell.cellToCell[ neighborIdx ];
+
+            MeshCell& neighborCell = this->cells[ neighborCellIdx ];
+
+            if( cell.isGhostCell && neighborCell.isGhostCell ) continue;
+
+            if( cell.isCoarseGhostCell() || neighborCell.isCoarseGhostCell() ) continue;
+
+            //////////////////////////////////////////////////////////////////////////
+
+            MeshFace newFace;
+
+            newFace.level = cell.level;
+
+            if( neighborIdx == 0 )
+            {
+                newFace.faceToNode[ 0 ] = cell.cellToNode[ 3 ];
+                newFace.faceToNode[ 1 ] = cell.cellToNode[ 1 ];
+                newFace.faceToNode[ 2 ] = cell.cellToNode[ 0 ];
+                newFace.faceToNode[ 3 ] = cell.cellToNode[ 2 ];
+                newFace.orientation = 'x';
+            }
+            if( neighborIdx == 2 )
+            {
+                newFace.faceToNode[ 0 ] = cell.cellToNode[ 5 ];
+                newFace.faceToNode[ 1 ] = cell.cellToNode[ 4 ];
+                newFace.faceToNode[ 2 ] = cell.cellToNode[ 0 ];
+                newFace.faceToNode[ 3 ] = cell.cellToNode[ 1 ];
+                newFace.orientation = 'y';
+            }
+            if( neighborIdx == 4 )
+            {
+                newFace.faceToNode[ 0 ] = cell.cellToNode[ 6 ];
+                newFace.faceToNode[ 1 ] = cell.cellToNode[ 2 ];
+                newFace.faceToNode[ 2 ] = cell.cellToNode[ 0 ];
+                newFace.faceToNode[ 3 ] = cell.cellToNode[ 4 ];
+                newFace.orientation = 'z';
+            }
+
+            //////////////////////////////////////////////////////////////////////////
+
+            cell.faceExists[ neighborIdx ] = true;
+
+            // register face at neighbor
+            for( uint idx = 0; idx < 6; idx++ ){
+                if( neighborCell.cellToCell[ idx ] == cellIdx ){
+                    neighborCell.faceExists[ idx ] = true;
+                    break;
+                }
+            }
+
+            //////////////////////////////////////////////////////////////////////////
+
+            newFace.negCell = cellIdx;
+            newFace.posCell = neighborCellIdx;
+
+            //////////////////////////////////////////////////////////////////////////
+            
+            Vec3 faceCenter;
+
+            for( uint node = 0; node < 4; node++ ){
+                faceCenter = faceCenter + this->nodes[ newFace.faceToNode[node] ];
+            }
+
+            newFace.faceCenter.x = faceCenter.x / c4o1;
+            newFace.faceCenter.y = faceCenter.y / c4o1;
+            newFace.faceCenter.z = faceCenter.z / c4o1;
+
+            this->faces.push_back( newFace );
+        }
+    }
+}
+
+void GksMeshAdapter::sortFaces()
+{
+    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+    // sort by level and orientation
+    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+    *logging::out << logging::Logger::INFO_INTERMEDIATE << "sortFaces()" << "\n";
+
+    std::stable_sort(this->faces.begin(), this->faces.end(),
+            [&, this](MeshFace lhs, MeshFace rhs)
+            {
+                if( lhs.level != rhs.level ) return lhs.level < rhs.level;
+
+                if (lhs.orientation != rhs.orientation) {
+                    if      (lhs.orientation == 'x' && rhs.orientation == 'y') return true;
+                    else if (lhs.orientation == 'y' && rhs.orientation == 'z') return true;
+                    else if (lhs.orientation == 'x' && rhs.orientation == 'z') return true;
+                    else                                                       return false;
+                }
+
+                return false;
+            }
+    );
+
+    this->countFaces();
+
+    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+    // sort into blocks
+    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+    std::array<char, 3> orientations = {'x', 'y', 'z'};
+
+    for( uint level = 0; level < this->gridBuilder->getNumberOfLevels(); level++ )
+    {
+        for( uint idx = 0; idx < 3; idx++ )
+        {
+            uint start =         this->startOfFacesPerLevelXYZ [ 3 * level + idx];
+            uint end   = start + this->numberOfFacesPerLevelXYZ[ 3 * level + idx];
+
+            real xMax = (*std::max_element(this->faces.begin() + start, this->faces.begin() + end, [this](MeshFace lhs, MeshFace rhs) { return lhs.faceCenter.x < rhs.faceCenter.x; })).faceCenter.x;
+            real yMax = (*std::max_element(this->faces.begin() + start, this->faces.begin() + end, [this](MeshFace lhs, MeshFace rhs) { return lhs.faceCenter.y < rhs.faceCenter.y; })).faceCenter.y;
+            real zMax = (*std::max_element(this->faces.begin() + start, this->faces.begin() + end, [this](MeshFace lhs, MeshFace rhs) { return lhs.faceCenter.z < rhs.faceCenter.z; })).faceCenter.z;
+
+            real xMin = (*std::min_element(this->faces.begin() + start, this->faces.begin() + end, [this](MeshFace lhs, MeshFace rhs) { return lhs.faceCenter.x < rhs.faceCenter.x; })).faceCenter.x;
+            real yMin = (*std::min_element(this->faces.begin() + start, this->faces.begin() + end, [this](MeshFace lhs, MeshFace rhs) { return lhs.faceCenter.y < rhs.faceCenter.y; })).faceCenter.y;
+            real zMin = (*std::min_element(this->faces.begin() + start, this->faces.begin() + end, [this](MeshFace lhs, MeshFace rhs) { return lhs.faceCenter.z < rhs.faceCenter.z; })).faceCenter.z;
+
+            real xRange = xMax - xMin;
+            real yRange = yMax - yMin;
+            real zRange = zMax - zMin;
+
+            uint blockDim = 8;
+
+            real dx = this->gridBuilder->getGrid(level)->getDelta();
+
+            std::sort(this->faces.begin() + start, this->faces.begin() + end,
+                [&, this](MeshFace lhs, MeshFace rhs)
+            {
+                uint xIdxLhs = lround((lhs.faceCenter.x - xMin) / dx);
+                uint yIdxLhs = lround((lhs.faceCenter.y - yMin) / dx);
+                uint zIdxLhs = lround((lhs.faceCenter.z - zMin) / dx);
+
+                uint xIdxRhs = lround((rhs.faceCenter.x - xMin) / dx);
+                uint yIdxRhs = lround((rhs.faceCenter.y - yMin) / dx);
+                uint zIdxRhs = lround((rhs.faceCenter.z - zMin) / dx);
+
+                real xBlockLhs = xIdxLhs / blockDim;
+                real yBlockLhs = yIdxLhs / blockDim;
+                real zBlockLhs = zIdxLhs / blockDim;
+
+                real xBlockRhs = xIdxRhs / blockDim;
+                real yBlockRhs = yIdxRhs / blockDim;
+                real zBlockRhs = zIdxRhs / blockDim;
+
+                if (zBlockLhs < zBlockRhs) return true;
+                if (zBlockLhs > zBlockRhs) return false;
+                if (yBlockLhs < yBlockRhs) return true;
+                if (yBlockLhs > yBlockRhs) return false;
+                if (xBlockLhs < xBlockRhs) return true;
+                if (xBlockLhs > xBlockRhs) return false;
+
+                if (zIdxLhs < zIdxRhs) return true;
+                if (zIdxLhs > zIdxRhs) return false;
+                if (yIdxLhs < yIdxRhs) return true;
+                if (yIdxLhs > yIdxRhs) return false;
+                if (xIdxLhs < xIdxRhs) return true;
+                if (xIdxLhs > xIdxRhs) return false;
+
+                return true;
+            }
+            );
+        }
+    }
+
+    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+    // partition by inner and out for communication hiding
+    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+    this->numberOfInnerFacesPerLevel.resize( this->numberOfLevels );
+
+    for( uint level = 0; level < this->gridBuilder->getNumberOfLevels(); level++ )
+    {
+        auto bound =
+        std::stable_partition(  this->faces.begin() + this->startOfFacesPerLevelXYZ [3 * level], 
+                                this->faces.begin() + this->startOfFacesPerLevelXYZ [3 * level] 
+                                                    + this->numberOfFacesPerLevelXYZ[3 * level + 0] 
+                                                    + this->numberOfFacesPerLevelXYZ[3 * level + 1] 
+                                                    + this->numberOfFacesPerLevelXYZ[3 * level + 2], 
+                                    [this](MeshFace& lhs)
+                                    {
+                                        for( uint neighborIndex = 0; neighborIndex < 6; neighborIndex++ )
+                                        {
+                                            uint neighborCellIndex = this->cells[ lhs.posCell ].cellToCell[ neighborIndex ];
+                                            if( neighborCellIndex != INVALID_INDEX && this->cells[ neighborCellIndex ].isRecvCell )
+                                            {
+                                                return false;
+                                            }
+                                        }
+                                        for( uint neighborIndex = 0; neighborIndex < 6; neighborIndex++ )
+                                        {
+                                            uint neighborCellIndex = this->cells[ lhs.negCell ].cellToCell[ neighborIndex ];
+                                            if( neighborCellIndex != INVALID_INDEX && this->cells[ neighborCellIndex ].isRecvCell )
+                                            {
+                                                return false;
+                                            }
+                                        }
+
+                                        return true;
+                                    }
+                                 );
+
+        this->numberOfInnerFacesPerLevel[ level ] = 0;
+        for( auto it = this->faces.begin() + this->startOfFacesPerLevelXYZ [3 * level]; it != bound; it++ )
+        {
+            this->numberOfInnerFacesPerLevel[ level ]++;
+        }
+
+        *logging::out << logging::Logger::INFO_LOW << "    Level " << level << ": " << this->numberOfFacesPerLevelXYZ[ 3 * level + 0 ]
+                                                                                     + this->numberOfFacesPerLevelXYZ[ 3 * level + 1 ]
+                                                                                     + this->numberOfFacesPerLevelXYZ[ 3 * level + 2 ]
+                                                                                    << " faces" << "\n";
+        *logging::out << logging::Logger::INFO_LOW << "    Level " << level << ": " << this->numberOfInnerFacesPerLevel[ level ] << " inner faces" << "\n";
+    }
+
+    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+}
+
+void GksMeshAdapter::countFaces()
+{
+    this->numberOfFacesPerLevelXYZ.resize( 3 * this->numberOfLevels );
+    this->startOfFacesPerLevelXYZ.resize ( 3 * this->numberOfLevels );
+
+    for( auto& i : this->numberOfFacesPerLevelXYZ ) i = 0;
+    for( auto& i : this->startOfFacesPerLevelXYZ  ) i = 0;
+
+    for( auto& face : this->faces ){
+        if      ( face.orientation == 'x' ) this->numberOfFacesPerLevelXYZ[ 3 * face.level     ]++;
+        else if ( face.orientation == 'y' ) this->numberOfFacesPerLevelXYZ[ 3 * face.level + 1 ]++;
+        else if ( face.orientation == 'z' ) this->numberOfFacesPerLevelXYZ[ 3 * face.level + 2 ]++;
+    }
+
+    this->startOfFacesPerLevelXYZ[0] = 0;
+
+    for( uint level = 1; level < 3 * this->numberOfLevels; level++ ){
+        
+        this->startOfFacesPerLevelXYZ[level] = this->startOfFacesPerLevelXYZ [level - 1]
+                                             + this->numberOfFacesPerLevelXYZ[level - 1];
+    }
+}
+
+void GksMeshAdapter::findPeriodicBoundaryNeighbors()
+{
+    for( uint level = 0; level < this->numberOfLevels; level++ )
+    {
+        SPtr<Grid> grid = this->gridBuilder->getGrid(level);
+
+        if( !grid->getPeriodicityX() && !grid->getPeriodicityY() && !grid->getPeriodicityZ() )
+            throw std::runtime_error( "GksMeshAdapter::findPeriodicBoundaryNeighbors() failed, because no periodic direction is set!" );
+
+        uint startIdx = startOfCellsPerLevel[ level ] + numberOfBulkCellsPerLevel[ level ];
+
+        uint endIdx   = startOfCellsPerLevel[ level ] + numberOfCellsPerLevel[ level ];
+
+        for( uint cellIdx = startIdx; cellIdx < endIdx; cellIdx++ )
+        {
+            MeshCell cell = this->cells[ cellIdx ];
+
+            if( cell.type != STOPPER_OUT_OF_GRID && cell.type != STOPPER_OUT_OF_GRID_BOUNDARY && cell.type != STOPPER_SOLID ) continue;
+
+            Vec3 gridStart ( grid->getStartX() + c1o2 * grid->getDelta(),
+                             grid->getStartY() + c1o2 * grid->getDelta(),
+                             grid->getStartZ() + c1o2 * grid->getDelta() );
+
+            Vec3 gridEnd   ( grid->getEndX()   - c1o2 * grid->getDelta(),
+                             grid->getEndY()   - c1o2 * grid->getDelta(),
+                             grid->getEndZ()   - c1o2 * grid->getDelta() );
+
+            Vec3 size = gridEnd - gridStart;
+
+            Vec3 delta;
+
+            if( grid->getPeriodicityX() && cell.cellCenter.x < gridStart.x ) delta.x =   size.x;
+            if( grid->getPeriodicityX() && cell.cellCenter.x > gridEnd.x   ) delta.x = - size.x;
+
+            if( grid->getPeriodicityY() && cell.cellCenter.y < gridStart.y ) delta.y =   size.y;
+            if( grid->getPeriodicityY() && cell.cellCenter.y > gridEnd.y   ) delta.y = - size.y;
+
+            if( grid->getPeriodicityZ() && cell.cellCenter.z < gridStart.z ) delta.z =   size.z;
+            if( grid->getPeriodicityZ() && cell.cellCenter.z > gridEnd.z   ) delta.z = - size.z;
+
+            uint neighborGridIdx = grid->transCoordToIndex( cell.cellCenter.x + delta.x,
+                                                            cell.cellCenter.y + delta.y,
+                                                            cell.cellCenter.z + delta.z );
+            
+            if( neighborGridIdx == INVALID_INDEX ) throw std::runtime_error( std::string("No periodic cell found!") );
+
+            uint neighborIdx = this->gridToMesh[ level ][ neighborGridIdx ];
+
+            if( neighborIdx == INVALID_INDEX )
+            {
+                std::stringstream s;
+
+                s << "No periodic cell found: ";
+                s << "( " << cell.cellCenter.x           << ", " << cell.cellCenter.y           << ", " << cell.cellCenter.z           << " )";
+                s << "( " << cell.cellCenter.x + delta.x << ", " << cell.cellCenter.y + delta.y << ", " << cell.cellCenter.z + delta.z << " )";
+
+                s << "( " << gridStart.x << ", " << gridStart.y << ", " << gridStart.z << " )";
+                s << "( " << gridEnd.x   << ", " << gridEnd.y   << ", " << gridEnd.z   << " )";
+
+                throw std::runtime_error( s.str() );
+            }
+            
+            this->periodicBoundaryNeighbors.push_back( {cellIdx, neighborIdx} );
+        }
+    }
+}
+
+double GksMeshAdapter::getDx(uint level)
+{
+    return dxCoarse / pow( 2.0, level );
+}
diff --git a/src/GksMeshAdapter/GksMeshAdapter.h b/src/GksMeshAdapter/GksMeshAdapter.h
new file mode 100644
index 0000000000000000000000000000000000000000..a757d0b749712e02be97db456397f57541ef889d
--- /dev/null
+++ b/src/GksMeshAdapter/GksMeshAdapter.h
@@ -0,0 +1,141 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 GksMeshAdapter.h
+//! \ingroup GksMeshAdapter
+//! \author Stephan Lenz
+//=======================================================================================
+#ifndef GKS_MESH_ADAPTER_H
+#define GKS_MESH_ADAPTER_H
+
+#include <memory>
+#include <array>
+#include <vector>
+
+#include "Core/DataTypes.h"
+#include "Core/PointerDefinitions.h"
+
+#include "MeshCell.h"
+#include "MeshFace.h"
+
+#include "VirtualFluidsDefinitions.h"
+
+class MultipleGridBuilder;
+
+class VF_PUBLIC GksMeshAdapter{
+
+public:
+
+    SPtr<MultipleGridBuilder> gridBuilder;
+
+    uint numberOfLevels;
+
+    double dxCoarse;
+
+    //////////////////////////////////////////////////////////////////////////
+
+    std::vector<Vec3> nodes;
+
+    //////////////////////////////////////////////////////////////////////////
+    //
+    //    C e l l    s o r t i n g :
+    //
+    //  | Level 0                   | Level 1                   | Level 2                   |
+    //  | FluidCells   | GhostCells | FluidCells   | GhostCells | FluidCells   | GhostCells | 
+    //
+    //  GhostCells: not included in Cell update, i.e. BoundaryCells and FCC-Cells
+    //  FluidCells: all other, including CFF-Cells
+    //
+    std::vector<MeshCell> cells;
+
+    std::vector<uint> numberOfCellsPerLevel;
+    std::vector<uint> numberOfBulkCellsPerLevel;
+    std::vector<uint> startOfCellsPerLevel;
+
+    //////////////////////////////////////////////////////////////////////////
+    //
+    //    F a c e    s o r t i n g :
+    //
+    //  | Level 0                              | Level 1                              | Level 2                              |
+    //  | x-normal   | y-normal   | z-normal   | x-normal   | y-normal   | z-normal   | x-normal   | y-normal   | z-normal   |
+    //
+    std::vector<MeshFace> faces;
+
+    std::vector<uint> numberOfFacesPerLevelXYZ;
+    std::vector<uint> startOfFacesPerLevelXYZ;
+
+    std::vector<uint> numberOfInnerFacesPerLevel;
+
+    //////////////////////////////////////////////////////////////////////////
+    // 
+    // Connectivity from LBM grid to GKS Mesh
+    //
+    //    cellIdx = gridToMesh[ level ][ gridIdx ]
+    //
+    std::vector< std::vector<uint> > gridToMesh;
+
+    //////////////////////////////////////////////////////////////////////////
+
+    std::vector< uint_2 > periodicBoundaryNeighbors;
+
+    //////////////////////////////////////////////////////////////////////////
+
+public:
+
+    GksMeshAdapter( SPtr<MultipleGridBuilder> gridBuilder );
+
+    void inputGrid();
+
+
+    void findCellToCellConnectivity();
+
+    void countCells();
+
+    void partitionCells();
+
+    void refreshCellConnectivity(const std::vector<uint>& idxMap);
+
+    void generateNodes();
+
+    void computeCellGeometry();
+
+    void generateFaces();
+
+    void sortFaces();
+
+    void countFaces();
+    
+    void findPeriodicBoundaryNeighbors();
+
+    //////////////////////////////////////////////////////////////////////////
+
+    double getDx(uint level);
+};
+
+
+#endif
\ No newline at end of file
diff --git a/src/GksMeshAdapter/MeshCell.cpp b/src/GksMeshAdapter/MeshCell.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..cd8a2b03abe944459d7de4b41f4ec85c3de1fc39
--- /dev/null
+++ b/src/GksMeshAdapter/MeshCell.cpp
@@ -0,0 +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 MeshCell.cpp
+//! \ingroup GksMeshAdapter
+//! \author Stephan Lenz
+//=======================================================================================
+#include "MeshCell.h"
+
+#include "GridGenerator/grid/NodeValues.h"
+
+MeshCell::MeshCell(){
+
+    level   = INVALID_INDEX;
+    gridIdx = INVALID_INDEX;
+
+
+    for( uint& index : this->cellToNode     ) index = INVALID_INDEX;
+    for( uint& index : this->cellToEdgeNode ) index = INVALID_INDEX;
+    for( uint& index : this->cellToFaceNode ) index = INVALID_INDEX;
+    for( uint& index : this->cellToCell     ) index = INVALID_INDEX;
+    for( uint& index : this->children       ) index = INVALID_INDEX;
+    
+    parent = INVALID_INDEX;
+
+    for( bool& flag : this->faceExists    ) flag = false;
+
+    isGhostCell = false;
+
+    isWall = false;
+
+    isFluxBC = false;
+
+    isInsulated = false;
+
+    isRecvCell = false;
+}
+
+bool MeshCell::isCoarseGhostCell()
+{
+    return this->type == FLUID_FCC;
+}
+
+bool MeshCell::isFineGhostCell()
+{
+    return this->type == FLUID_CFF;
+}
diff --git a/src/GksMeshAdapter/MeshCell.h b/src/GksMeshAdapter/MeshCell.h
new file mode 100644
index 0000000000000000000000000000000000000000..c5cbff7902c9f625e8665867f2051b90aec664b1
--- /dev/null
+++ b/src/GksMeshAdapter/MeshCell.h
@@ -0,0 +1,111 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 MeshCell.h
+//! \ingroup GksMeshAdapter
+//! \author Stephan Lenz
+//=======================================================================================
+#ifndef MESH_CELL_H
+#define MESH_CELL_H
+
+#include <array>
+
+#include "Core/DataTypes.h"
+#include "Core/VectorTypes.h"
+#include "Core/ArrayTypes.h"
+
+struct VF_PUBLIC MeshCell{
+
+    uint level;
+    uint gridIdx;
+
+    //////////////////////////////////////////////////////////////////////////
+
+    uint_8 cellToNode;           uint_12 cellToEdgeNode;         uint_6 cellToFaceNode;
+
+    // for sorting see LBM f numbering
+    //                                   8                              
+    //     4 o--------o 0            o--------o                    o--------o 
+    //      /|       /|            7/|      4/|                   /|  4    /|  
+    //     / |      / |            /3| 11   / |                  / |    2 / |  
+    //  6 o--------o 2|           o--------o  |0                o--------o  |  
+    //    |  |     |  |           |  |  10 |  |                 |1 |     | 0|  
+    //    |5 o-----|--o 1        1|  o-----|--o                 |  o-----|--o  
+    //    | /      | /            |5/     2| /6                 | / 3    | /   
+    //    |/       |/             |/   9   |/                   |/    5  |/    
+    //  7 o--------o 3            o--------o                    o--------o      
+    //
+    //  z | / y
+    //    |/
+    //    +---- x
+    //     
+
+    //////////////////////////////////////////////////////////////////////////
+
+    uint_27 cellToCell;
+
+    // for sorting see LBM f numbering
+
+    //////////////////////////////////////////////////////////////////////////
+
+    uint_8 children;
+
+    // for sorting see cellToNode
+
+    uint  parent;
+
+    //////////////////////////////////////////////////////////////////////////
+
+    Vec3   cellCenter;
+
+    //////////////////////////////////////////////////////////////////////////
+
+    // order: +x, -x, +y, -y, +z, -z (see cellToCell)
+    bool_6 faceExists;
+    
+    bool isGhostCell;   // this denotes cells that do not have all neighbors, excluding coarse ghost cells
+
+    bool isWall;
+
+    bool isFluxBC;
+
+    bool isInsulated;
+
+    bool isRecvCell;
+
+    char type;
+
+    MeshCell();
+
+    bool isCoarseGhostCell();
+
+    bool isFineGhostCell();
+};
+
+
+#endif
\ No newline at end of file
diff --git a/src/GksMeshAdapter/MeshFace.cpp b/src/GksMeshAdapter/MeshFace.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..df5b4f1f6c51390dcddb837b9d5da57ce1f4e91b
--- /dev/null
+++ b/src/GksMeshAdapter/MeshFace.cpp
@@ -0,0 +1,43 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 MeshFace.cpp
+//! \ingroup GksMeshAdapter
+//! \author Stephan Lenz
+//=======================================================================================
+#include "MeshFace.h"
+
+MeshFace::MeshFace()
+{
+    for( uint& node : this->faceToNode ) node = INVALID_INDEX;
+
+    posCell       = INVALID_INDEX;
+    negCell       = INVALID_INDEX;
+    posCellCoarse = INVALID_INDEX;
+    negCellCoarse = INVALID_INDEX;
+}
\ No newline at end of file
diff --git a/src/GksMeshAdapter/MeshFace.h b/src/GksMeshAdapter/MeshFace.h
new file mode 100644
index 0000000000000000000000000000000000000000..471cfacaddfd38cff8fceb02d661e4920b4dba41
--- /dev/null
+++ b/src/GksMeshAdapter/MeshFace.h
@@ -0,0 +1,80 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 MeshFace.h
+//! \ingroup GksMeshAdapter
+//! \author Stephan Lenz
+//=======================================================================================
+#ifndef MESH_FACE_H
+#define MESH_FACE_H
+
+#include "Core/DataTypes.h"
+#include "Core/VectorTypes.h"
+#include "Core/ArrayTypes.h"
+
+struct VF_PUBLIC MeshFace
+{
+    //////////////////////////////////////////////////////////////////////////
+
+    //      o 2                 
+    //     /|                   
+    //    / |                   
+    //   o 3|     n            
+    //   | -+--------->        
+    //   |  o 1                
+    //   | /                    
+    //   |/                     
+    //   o 0                    
+    //
+    //
+
+    uint_4 faceToNode;
+
+    //////////////////////////////////////////////////////////////////////////
+
+    uint posCell;
+    uint negCell;
+
+    uint posCellCoarse;
+    uint negCellCoarse;
+
+    //////////////////////////////////////////////////////////////////////////
+
+    Vec3 faceCenter;
+
+    //////////////////////////////////////////////////////////////////////////
+
+    char orientation;
+
+    uint level;
+
+    MeshFace();
+};
+
+
+#endif
\ No newline at end of file
diff --git a/src/GksMeshAdapter/package.include b/src/GksMeshAdapter/package.include
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/src/GridGenerator/geometries/BoundingBox/BoundingBox.cu b/src/GridGenerator/geometries/BoundingBox/BoundingBox.cu
new file mode 100644
index 0000000000000000000000000000000000000000..5fd7851b010044043324b585daacb9e022cb9f00
--- /dev/null
+++ b/src/GridGenerator/geometries/BoundingBox/BoundingBox.cu
@@ -0,0 +1,177 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 BoundingBox.cu
+//! \ingroup geometries
+//! \author Soeren Peters, Stephan Lenz
+//=======================================================================================
+#include "BoundingBox.h"
+
+#include "../Vertex/Vertex.h"
+#include <GridGenerator/utilities/math/Math.h>
+
+#include <limits>
+
+
+
+ BoundingBox::BoundingBox(real minX, real maxX, real minY, real maxY, real minZ, real maxZ) : minX(minX), maxX(maxX), minY(minY), maxY(maxY), minZ(minZ), maxZ(maxZ) {}
+
+ BoundingBox::BoundingBox() :
+     minX(0),
+     maxX(0),
+     minY(0),
+     maxY(0),
+     minZ(0),
+     maxZ(0) {}
+
+ BoundingBox::BoundingBox(const BoundingBox &t) : minX(t.minX), maxX(t.maxX), minY(t.minY), maxY(t.maxY), minZ(t.minZ), maxZ(t.maxZ) {}
+
+
+ BoundingBox BoundingBox::makeInvalidMinMaxBox()
+ {
+     BoundingBox box = BoundingBox(std::numeric_limits<real>::max(),
+         std::numeric_limits<real>::lowest(),
+         std::numeric_limits<real>::max(),
+         std::numeric_limits<real>::lowest(),
+         std::numeric_limits<real>::max(),
+         std::numeric_limits<real>::lowest());
+     return box;
+ }
+
+ bool BoundingBox::isInside(const real x, const real y, const real z) const
+ {
+     return this->isInside(Vertex(x,y,z));
+ }
+
+ bool BoundingBox::isInside(const Vertex &v) const
+ {
+     if (v.isXbetween(minX, maxX) && v.isYbetween(minY, maxY) && v.isZbetween(minZ, maxZ))
+		 return true;
+	 return false;
+ }
+
+ std::vector<std::vector<Vertex> > BoundingBox::getIntersectionPoints(const BoundingBox &b) const
+ {
+	 std::vector<std::vector<Vertex> > intersectionBox;
+	 intersectionBox.resize(6);
+
+	 int intersects = 0;
+	 if (b.minX < maxX && b.maxX > maxX) { //maxX is intersect
+		 intersectionBox[intersects].push_back(Vertex((real)maxX, (real)minY, (real)minZ));
+		 intersectionBox[intersects].push_back(Vertex((real)maxX, (real)maxY, (real)minZ));
+		 intersectionBox[intersects].push_back(Vertex((real)maxX, (real)minY, (real)maxZ));
+		 intersects++;
+	 }
+	 if (b.minX < minX && b.maxX > minX) { //minX is intersect
+		 intersectionBox[intersects].push_back(Vertex((real)minX, (real)minY, (real)minZ));
+		 intersectionBox[intersects].push_back(Vertex((real)minX, (real)maxY, (real)minZ));
+		 intersectionBox[intersects].push_back(Vertex((real)minX, (real)minY, (real)maxZ));
+		 intersects++;
+	 }
+	 if (b.minY < minY && b.maxY > minY) { //minY is intersect
+		 intersectionBox[intersects].push_back(Vertex((real)minX, (real)minY, (real)minZ));
+		 intersectionBox[intersects].push_back(Vertex((real)maxX, (real)minY, (real)minZ));
+		 intersectionBox[intersects].push_back(Vertex((real)minX, (real)minY, (real)maxZ));
+		 intersects++;
+	 }
+	 if (b.minY < maxY && b.maxY > maxY) { //maxY is intersect
+		 intersectionBox[intersects].push_back(Vertex((real)minX, (real)maxY, (real)minZ));
+		 intersectionBox[intersects].push_back(Vertex((real)maxX, (real)maxY, (real)minZ));
+		 intersectionBox[intersects].push_back(Vertex((real)minX, (real)maxY, (real)maxZ));
+		 intersects++;
+	 }
+	 if (b.minZ < minZ && b.maxZ > minZ) { //minZ is intersect
+		 intersectionBox[intersects].push_back(Vertex((real)minX, (real)minY, (real)minZ));
+		 intersectionBox[intersects].push_back(Vertex((real)maxX, (real)minY, (real)minZ));
+		 intersectionBox[intersects].push_back(Vertex((real)minX, (real)maxY, (real)minZ));
+		 intersects++;
+	 }
+	 if (b.minZ < maxZ && b.maxZ > maxZ) { //maxZ is intersect
+		 intersectionBox[intersects].push_back(Vertex((real)minX, (real)minY, (real)maxZ));
+		 intersectionBox[intersects].push_back(Vertex((real)maxX, (real)minY, (real)maxZ));
+		 intersectionBox[intersects].push_back(Vertex((real)minX, (real)maxY, (real)maxZ));
+		 intersects++;
+	 }
+
+	 return intersectionBox;
+ }
+
+ bool BoundingBox::intersect(const BoundingBox &box) const
+ {
+	 struct Vertex v[8];
+	 box.getPoints(v);
+
+	 for (int i = 0; i < 8; i++) {
+		 if (isInside(v[i]))
+			 return true;
+	 }
+	 return false;
+ }
+
+ void BoundingBox::getPoints(Vertex v[8]) const
+ {
+	 v[0] = Vertex(minX, minY, minZ);
+	 v[1] = Vertex(maxX, minY, minZ);
+	 v[2] = Vertex(minX, maxY, minZ);
+	 v[3] = Vertex(maxX, maxY, minZ);
+
+	 v[4] = Vertex(minX, minY, maxZ);
+	 v[5] = Vertex(maxX, minY, maxZ);
+	 v[6] = Vertex(minX, maxY, maxZ);
+	 v[7] = Vertex(maxX, maxY, maxZ);
+ }
+
+
+ void BoundingBox::print() const
+ {
+	 printf("min/max - x: %2.4f/ %2.4f, y: %2.4f, %2.4f, z: %2.4f, %2.4f \n", minX, maxX, minY, maxY, minZ, maxZ);
+ }
+
+
+ bool BoundingBox::operator==(const BoundingBox &box) const
+ {
+     return vf::Math::equal(minX, box.minX)
+         && vf::Math::equal(maxX, box.maxX)
+         && vf::Math::equal(minY, box.minY)
+         && vf::Math::equal(maxY, box.maxY)
+         && vf::Math::equal(minZ, box.minZ)
+         && vf::Math::equal(maxZ, box.maxZ);
+ }
+
+ void BoundingBox::extend(real delta)
+ {
+     this->minX -= delta;
+     this->minY -= delta;
+     this->minZ -= delta;
+
+     this->maxX += delta;
+     this->maxY += delta;
+     this->maxZ += delta;
+ }
+
+
diff --git a/src/GridGenerator/geometries/BoundingBox/BoundingBox.h b/src/GridGenerator/geometries/BoundingBox/BoundingBox.h
new file mode 100644
index 0000000000000000000000000000000000000000..bf980ab73b58ee2887d2b7f348cd411016ae6430
--- /dev/null
+++ b/src/GridGenerator/geometries/BoundingBox/BoundingBox.h
@@ -0,0 +1,80 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 BoundingBox.h
+//! \ingroup geometries
+//! \author Soeren Peters, Stephan Lenz
+//=======================================================================================
+#ifndef BoundingBox_h
+#define BoundingBox_h
+
+#include <vector>
+#include <cuda_runtime.h>
+
+#include "global.h"
+
+struct Vertex;
+struct Triangle;
+
+
+class VF_PUBLIC BoundingBox
+{
+public:
+	real minX;
+	real maxX;
+	real minY;
+	real maxY;
+	real minZ;
+	real maxZ;
+
+	BoundingBox(real minX, real maxX, real minY, real maxY, real minZ, real maxZ);
+    BoundingBox();
+	BoundingBox(const BoundingBox &t);
+
+public:
+    static BoundingBox makeInvalidMinMaxBox();
+
+	void print() const;
+
+	bool isInside(const real x, const real y, const real z) const;
+
+	std::vector<std::vector<Vertex> > getIntersectionPoints(const BoundingBox &b) const;
+	bool intersect(const BoundingBox &box) const;
+
+    bool operator==(const BoundingBox &box) const;
+    
+    void extend(real delta);
+
+private:
+	bool isInside(const Vertex &v) const;
+	void getPoints(Vertex v[8]) const;
+
+};
+
+#endif
+
diff --git a/src/GridGenerator/geometries/BoundingBox/BoundingBoxTest.cpp b/src/GridGenerator/geometries/BoundingBox/BoundingBoxTest.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..f982b2fa5d5c614ded87ba2a03f6e71d72bf130c
--- /dev/null
+++ b/src/GridGenerator/geometries/BoundingBox/BoundingBoxTest.cpp
@@ -0,0 +1,69 @@
+#include "gmock/gmock.h"
+
+#include <GridGenerator/geometries/Triangle/Triangle.h>
+#include <GridGenerator/geometries/BoundingBox/BoundingBox.h>
+#include <GridGenerator/geometries/Vertex/Vertex.h>
+
+
+using namespace testing;
+
+
+TEST(BoundingBoxExactTest, findMinMaxFromTriangle)
+{
+    BoundingBox box = BoundingBox::makeInvalidMinMaxBox();
+
+    real minX = 1.0f;
+    real minY = 23.0f;
+    real minZ = 1.1222f;
+
+    real maxX = 110.0f;
+    real maxY = 50.0f;
+    real maxZ = 12122.23f;
+    Triangle t = Triangle(Vertex(maxX, maxY - 10, minZ + 2), Vertex(minX, maxY, maxZ), Vertex(minX + 3, minY, minZ), Vertex(0.0f, 0.0f, 0.0f));
+
+	box.setMinMax(t);
+
+	EXPECT_THAT(box.minX, RealEq(minX));
+	EXPECT_THAT(box.minY, RealEq(minY));
+	EXPECT_THAT(box.minZ, RealEq(minZ));
+	
+	EXPECT_THAT(box.maxX, RealEq(maxX));
+	EXPECT_THAT(box.maxY, RealEq(maxY));
+	EXPECT_THAT(box.maxZ, RealEq(maxZ));
+}
+
+TEST(BoundingBoxTest, isInside_true)
+{
+    BoundingBox box = BoundingBox();
+
+    box.minX = 0.0f;
+    box.minY = 0.0f;
+    box.minZ = 0.0f;
+
+    box.maxX = 10.0f;
+    box.maxY = 10.0f;
+    box.maxZ = 10.0f;
+
+    Triangle t = Triangle(Vertex(1,1,1), Vertex(2,2,2), Vertex(3,3,3), Vertex(0.0f, 0.0f, 0.0f));
+
+    EXPECT_TRUE(box.isInside(t));
+}
+
+TEST(BoundingBoxTest, isInside_false)
+{
+    BoundingBox box = BoundingBox();
+
+    box.minX = 0.0f;
+    box.minY = 0.0f;
+    box.minZ = 0.0f;
+
+    box.maxX = 10.0f;
+    box.maxY = 10.0f;
+    box.maxZ = 10.0f;
+
+    Triangle t = Triangle(Vertex(1, 1, 1), Vertex(2, 2, 2), Vertex(3, 3, 11), Vertex(0.0f, 0.0f, 0.0f));
+
+    EXPECT_FALSE(box.isInside(t));
+}
+
+
diff --git a/src/GridGenerator/geometries/BoundingBox/package.include b/src/GridGenerator/geometries/BoundingBox/package.include
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/src/GridGenerator/geometries/Cuboid/Cuboid.cu b/src/GridGenerator/geometries/Cuboid/Cuboid.cu
new file mode 100644
index 0000000000000000000000000000000000000000..ca6bf71c8d6d0cf31685cf55da251cb993b3051e
--- /dev/null
+++ b/src/GridGenerator/geometries/Cuboid/Cuboid.cu
@@ -0,0 +1,147 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 Cuboid.cu
+//! \ingroup geometries
+//! \author Soeren Peters, Stephan Lenz
+//=======================================================================================
+#include "Cuboid.h"
+
+#include "utilities/math/Math.h"
+
+Cuboid::Cuboid(const double& x1a,const double& x2a, const double& x3a, const double& x1b,const double& x2b, const double& x3b)
+    : minX1(x1a), minX2(x2a), minX3(x3a), maxX1(x1b), maxX2(x2b), maxX3(x3b)
+{
+
+}
+
+Cuboid::~Cuboid()
+{
+
+}
+
+Object* Cuboid::clone() const
+{
+    return new Cuboid(minX1, minX2, minX3, maxX1, maxX2, maxX3);
+}
+
+double Cuboid::getX1Centroid()
+{
+   return getCenter(minX1, maxX1);
+}
+
+double Cuboid::getX1Minimum()
+{
+    return getMinimum(minX1, maxX1);
+}
+
+double Cuboid::getX1Maximum()
+{
+    return getMaximum(minX1, maxX1);
+}
+
+double Cuboid::getX2Centroid()
+{
+    return getCenter(minX2, maxX2);
+}
+
+double Cuboid::getX2Minimum()
+{
+    return getMinimum(minX2, maxX2);
+}	
+
+double Cuboid::getX2Maximum()
+{
+    return getMaximum(minX2, maxX2);
+}
+
+double Cuboid::getX3Centroid()
+{
+    return getCenter(minX3, maxX3);
+}
+
+double Cuboid::getX3Minimum()
+{	
+    return getMinimum(minX3, maxX3);
+}	
+
+double Cuboid::getX3Maximum()
+{
+    return getMaximum(minX3, maxX3);
+}
+
+double Cuboid::getCenter(double x1, double x2)
+{
+    return 0.5 * (x1 + x2);
+}
+
+double Cuboid::getMinimum(double x1, double x2)
+{
+    return (x1 < x2 ? x1 : x2);
+}
+
+double Cuboid::getMaximum(double x1, double x2)
+{
+    return (x1 > x2 ? x1 : x2);
+}
+
+bool Cuboid::isPointInObject(const double& x1, const double& x2, const double& x3, const double& minOffset, const double& maxOffset)
+{
+    //false, if 'not in Object' or 'on Boundary'!
+    if (vf::Math::lessEqual(x1, this->getX1Minimum() + minOffset))    return false;
+    if (vf::Math::lessEqual(x2, this->getX2Minimum() + minOffset))    return false;
+    if (vf::Math::lessEqual(x3, this->getX3Minimum() + minOffset))    return false;
+    if (vf::Math::greaterEqual(x1, this->getX1Maximum() - maxOffset)) return false;
+    if (vf::Math::greaterEqual(x2, this->getX2Maximum() - maxOffset)) return false;
+    if (vf::Math::greaterEqual(x3, this->getX3Maximum() - maxOffset)) return false;
+
+    return true;
+}
+
+
+bool Cuboid::isOn(const real& coord, const real& plane1, const real& plane2)
+{
+    return  vf::Math::equal(coord, plane1) || vf::Math::equal(coord, plane2);
+}
+
+bool Cuboid::isBetween(const real& coord, const real& start, const real& end)
+{
+    return  vf::Math::greaterEqual(coord, start) && vf::Math::lessEqual(coord, end);
+}
+
+
+void Cuboid::scale(double delta)
+{
+    this->minX1 -= delta;
+    this->minX2 -= delta;
+    this->minX3 -= delta;
+                   
+    this->maxX1 += delta;
+    this->maxX2 += delta;
+    this->maxX3 += delta;
+}
diff --git a/src/GridGenerator/geometries/Cuboid/Cuboid.h b/src/GridGenerator/geometries/Cuboid/Cuboid.h
new file mode 100644
index 0000000000000000000000000000000000000000..1d84a473bd8763e1f1b388d19b66a7f3a1658fee
--- /dev/null
+++ b/src/GridGenerator/geometries/Cuboid/Cuboid.h
@@ -0,0 +1,80 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 Cuboid.h
+//! \ingroup geometries
+//! \author Soeren Peters, Stephan Lenz
+//=======================================================================================
+#ifndef CUBOID_H
+#define CUBOID_H
+
+#include "global.h"
+
+#include "geometries/Object.h"
+
+class VF_PUBLIC Cuboid : public Object
+{
+public:              
+    Cuboid(const double& minX1, const double& minX2, const double& minX3, const double& maxX1,const double& maxX2, const double& maxX3);
+    virtual ~Cuboid();
+
+    Object* clone() const override;
+
+    double getX1Centroid() override;
+    double getX1Minimum() override;
+    double getX1Maximum() override;
+    double getX2Centroid() override;
+    double getX2Minimum() override;
+    double getX2Maximum() override;
+    double getX3Centroid() override;
+    double getX3Minimum() override;
+    double getX3Maximum() override;
+
+    void scale(double delta) override;
+
+    bool isPointInObject(const double& x1, const double& x2, const double& x3, const double& minOffset, const double& maxOffset) override;
+
+private:
+    static double getCenter(double x1, double x2);
+    static double getMinimum(double x1, double x2);
+    static double getMaximum(double x1, double x2);
+    static bool isOn(const real& coord, const real& plane1, const real& plane2);
+    static bool isBetween(const real& coord, const real& start, const real& end);
+
+protected:
+    double minX1;
+    double minX2;
+    double minX3;
+    double maxX1;
+    double maxX2;
+    double maxX3;
+};
+
+
+
+#endif   
diff --git a/src/GridGenerator/geometries/Cuboid/package.include b/src/GridGenerator/geometries/Cuboid/package.include
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/src/GridGenerator/geometries/Object.cu b/src/GridGenerator/geometries/Object.cu
new file mode 100644
index 0000000000000000000000000000000000000000..40f8b702ff3452176c3eeb5eafc5bd4741a1abf9
--- /dev/null
+++ b/src/GridGenerator/geometries/Object.cu
@@ -0,0 +1,40 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 Object.cu
+//! \ingroup geometries
+//! \author Soeren Peters, Stephan Lenz
+//=======================================================================================
+#include "Object.h"
+#include "grid/GridImp.h"
+#include "grid/GridStrategy/GridStrategy.h"
+
+void Object::findInnerNodes(SPtr<GridImp> grid)
+{
+    grid->getGridStrategy()->findInnerNodes( grid );
+}
diff --git a/src/GridGenerator/geometries/Object.h b/src/GridGenerator/geometries/Object.h
new file mode 100644
index 0000000000000000000000000000000000000000..21d153d7e284d735e6b18b71e2a062214d8bf10e
--- /dev/null
+++ b/src/GridGenerator/geometries/Object.h
@@ -0,0 +1,80 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 Object.h
+//! \ingroup geometries
+//! \author Soeren Peters, Stephan Lenz
+//=======================================================================================
+#ifndef OBJECT_H
+#define OBJECT_H
+
+#include <VirtualFluidsDefinitions.h>
+#include "grid/Cell.h"
+#include "global.h"
+
+class GridImp;
+
+class VF_PUBLIC Object
+{
+public:
+    virtual ~Object() {}
+    virtual Object* clone() const = 0;
+
+    virtual double getX1Centroid() = 0;
+    virtual double getX1Minimum()  = 0;
+    virtual double getX1Maximum()  = 0;
+
+    virtual double getX2Centroid() = 0;
+    virtual double getX2Minimum()  = 0;
+    virtual double getX2Maximum()  = 0;
+
+    virtual double getX3Centroid() = 0;
+    virtual double getX3Minimum()  = 0;
+    virtual double getX3Maximum()  = 0;
+
+
+    virtual void scale(double delta) = 0;
+
+
+    virtual bool isPointInObject(const double& x1, const double& x2, const double& x3, const double& minOffset, const double& maxOffset) = 0;
+
+    virtual bool isCellInObject(const Cell& cell) {
+        for (const auto point : cell)
+        {
+            const bool isInObject = isPointInObject(point.x, point.y, point.z, 0.0, 0.0);
+            if (!isInObject)
+                return false;
+        }
+        return true;
+    }
+
+    virtual void findInnerNodes(SPtr<GridImp> grid);
+};
+
+
+#endif
diff --git a/src/GridGenerator/geometries/Vertex/Vertex.cu b/src/GridGenerator/geometries/Vertex/Vertex.cu
new file mode 100644
index 0000000000000000000000000000000000000000..e72980c8acd7bfa9680f8bd238280a918bd61c04
--- /dev/null
+++ b/src/GridGenerator/geometries/Vertex/Vertex.cu
@@ -0,0 +1,202 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 Vertex.cu
+//! \ingroup geometries
+//! \author Soeren Peters, Stephan Lenz
+//=======================================================================================
+#include "Vertex.h"
+
+#include "utilities/math/Math.h"
+
+Vertex::Vertex(real x, real y, real z) : x(x), y(y), z(z){}
+Vertex::Vertex() { x = 0.0f; y = 0.0f; z = 0.0f; }
+
+Vertex::Vertex(const Vertex& v)
+{
+	this->x = v.x;
+	this->y = v.y;
+	this->z = v.z;
+}
+
+ real Vertex::getEuclideanDistanceTo(const Vertex &w) const
+{
+    return vf::Math::sqrtReal((x - w.x)*(x - w.x) + (y - w.y)*(y - w.y) + (z - w.z)*(z - w.z));
+}
+
+Vertex Vertex::operator-(const Vertex &v) const
+{
+    return Vertex(x - v.x, y - v.y, z - v.z);
+}
+
+Vertex Vertex::operator+(const Vertex &v) const
+{
+    return Vertex(this->x + v.x, this->y + v.y, this->z + v.z);
+}
+
+Vertex Vertex::operator*(const real& value) const
+{
+    return Vertex(value * this->x, value * this->y, value * this->z);
+}
+
+Vertex Vertex::operator/(const real& value) const
+{
+    return *this * (1.0 / value);
+}
+
+real Vertex::operator*(const Vertex &w) const
+{
+    return x*w.x + y*w.y + z*w.z;
+}
+
+struct Vertex Vertex::crossProduct(const Vertex &w) const
+{
+    real a = y*w.z - z*w.y;
+    real b = z*w.x - x*w.z;
+    real c = x*w.y - y*w.x;
+    return Vertex(a, b, c);
+}
+
+real Vertex::length() const 
+{
+    return vf::Math::sqrtReal(x * x + y * y + z * z);
+}
+
+void Vertex::normalize()
+{
+    real len = length();
+
+    if (len > EPSILON)
+    {
+        real invLen = 1.0f / len;
+        x *= invLen;
+        y *= invLen;
+        z *= invLen;
+    }
+}
+
+real Vertex::getMagnitude() const
+{
+    real temp = x*x + y*y + z*z;
+    return vf::Math::sqrtReal(temp);
+}
+
+int Vertex::isEqual(const Vertex &w) const
+{
+    return vf::Math::equal(x, w.x) && vf::Math::equal(y, w.y) && vf::Math::equal(z, w.z);
+}
+
+real Vertex::getInnerAngle(const Vertex &w) const
+{
+    if (isEqual(w))
+        return 0.0;
+    if (this->getMagnitude() == 0 || w.getMagnitude() == 0)
+        return 0.0;
+
+    real mag = this->getMagnitude() * w.getMagnitude();
+    real skal = *this * w;
+    if (mag - fabs(skal) < 0.0001)
+        return 0.0f;
+    return  vf::Math::acosReal(skal / mag) * 180.0f / vf::Math::acosReal(-1.0f); // acos(-1.0f) = PI 
+}
+
+void Vertex::print() const
+{
+    printf("(%2.8f,%2.8f,%2.8f)\n", x, y, z);
+}
+
+void Vertex::print(std::ostream &ost) const
+{
+    ost.write((char*)&x, 4);
+    ost.write((char*)&y, 4);
+    ost.write((char*)&z, 4);
+}
+
+void Vertex::printFormatted(std::ostream &ost) const
+{
+    ost << x << " " << y << " " << z;
+}
+
+
+
+bool Vertex::operator==(const Vertex &v) const
+{
+	return vf::Math::equal(x, v.x) && vf::Math::equal(y, v.y) && vf::Math::equal(z, v.z);
+}
+
+
+bool Vertex::isXbetween(real min, real max) const
+{
+    return x >= min && x <= max;
+}
+
+bool Vertex::isYbetween(real min, real max) const
+{
+    return y >= min && y <= max;
+}
+
+bool Vertex::isZbetween(real min, real max) const
+{
+    return z >= min && z <= max;
+}
+
+void Vertex::setMinMax(real & minX, real & maxX, real & minY, real & maxY, real & minZ, real & maxZ, const Vertex & v1, const Vertex & v2, const Vertex & v3)
+{
+    calculateMinMax(v1.x, v2.x, v3.x, minX, maxX);
+    calculateMinMax(v1.y, v2.y, v3.y, minY, maxY);
+    calculateMinMax(v1.z, v2.z, v3.z, minZ, maxZ);
+}
+
+
+real getMinimum(const real &value1, const real &value2)
+{
+    return value1 < value2 ? value1 : value2;
+}
+
+real getMaximum(const real &value1, const real &value2)
+{
+    return value1 > value2 ? value1 : value2;
+}
+
+
+void Vertex::calculateMinMax(const real &value1, const real &value2, const real &value3, real &min, real &max)
+{
+    
+    real newMinimum = value1;
+    newMinimum = getMinimum(value2, newMinimum);
+    newMinimum = getMinimum(value3, newMinimum);
+
+    real newMaximum = value1;
+    newMaximum = getMaximum(value2, newMaximum);
+    newMaximum = getMaximum(value3, newMaximum);
+
+    min = newMinimum;
+    max = newMaximum;
+}
+
+
diff --git a/src/GridGenerator/geometries/Vertex/Vertex.h b/src/GridGenerator/geometries/Vertex/Vertex.h
new file mode 100644
index 0000000000000000000000000000000000000000..9adfa6c9dd59bb0b1deb3bf81e99a48140686ea1
--- /dev/null
+++ b/src/GridGenerator/geometries/Vertex/Vertex.h
@@ -0,0 +1,84 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 Vertex.h
+//! \ingroup geometries
+//! \author Soeren Peters, Stephan Lenz
+//=======================================================================================
+#ifndef VERTEX_H
+#define VERTEX_H
+
+#include <stdio.h>
+#include <cuda_runtime.h>
+#include <memory>
+#include <ostream>
+
+#include "global.h"
+
+struct VF_PUBLIC Vertex 
+{
+public:
+    real x, y, z;
+
+	Vertex(real x, real y, real z);
+	Vertex();
+	Vertex(const Vertex& v);
+	~Vertex() {}
+
+	real getEuclideanDistanceTo(const Vertex &w) const;
+	Vertex operator-(const Vertex &v) const;
+	Vertex operator+(const Vertex &v) const;
+	Vertex operator*(const real& value) const;
+    Vertex operator/(const real& value) const;
+
+	real operator*(const Vertex &w) const;
+	struct Vertex crossProduct(const Vertex &w) const;
+	real length() const;
+	void normalize();
+	real getMagnitude() const;
+	int isEqual(const Vertex &w) const;
+	real getInnerAngle(const Vertex &w) const;
+
+	bool operator==(const Vertex &v) const;
+
+    bool isXbetween(real min, real max) const;
+    bool isYbetween(real min, real max) const;
+    bool isZbetween(real min, real max) const;
+
+    static void setMinMax(real &minX, real &maxX, real &minY, real &maxY, real &minZ, real &maxZ, const Vertex &v1, const Vertex &v2, const Vertex &v3); 
+    static void calculateMinMax(const real &value1, const real &value2, const real &value3, real &min, real &max);
+
+    void print() const;
+    void print(std::ostream &ost) const;
+    void printFormatted(std::ostream &ost) const;
+
+};
+
+
+
+#endif
diff --git a/src/GridGenerator/geometries/Vertex/package.include b/src/GridGenerator/geometries/Vertex/package.include
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/src/GridGenerator/geometries/package.include b/src/GridGenerator/geometries/package.include
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/src/GridGenerator/global.h b/src/GridGenerator/global.h
new file mode 100644
index 0000000000000000000000000000000000000000..1464fde43455bd151cd0fba5ad0d94fd8b86a853
--- /dev/null
+++ b/src/GridGenerator/global.h
@@ -0,0 +1,49 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 global.h
+//! \ingroup GridGenerator
+//! \author Soeren Peters
+//=======================================================================================
+#ifndef global_h
+#define global_h
+
+
+#define DEBUG 1
+#define GLOB_NODE 5
+#define DIMENSION 3
+#define MASTERRANK 0
+
+#include "VirtualFluidsDefinitions.h"
+
+#include "Core/PointerDefinitions.h"
+#include "Core/DataTypes.h"
+
+#include "Core/Logger/Logger.h"
+
+#endif 
diff --git a/src/GridGenerator/grid/BoundaryConditions/BoundaryCondition.cpp b/src/GridGenerator/grid/BoundaryConditions/BoundaryCondition.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..04379f6a5cb1cf75910871d0a3069cf582112abd
--- /dev/null
+++ b/src/GridGenerator/grid/BoundaryConditions/BoundaryCondition.cpp
@@ -0,0 +1,91 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 BoundaryCondition.cpp
+//! \ingroup grid
+//! \author Soeren Peters, Stephan Lenz
+//=======================================================================================
+#include "BoundaryCondition.h"
+
+#include <cmath>
+
+#include "grid/BoundaryConditions/Side.h"
+#include "grid/Grid.h"
+
+bool BoundaryCondition::isSide( SideType side ) const
+{
+    return this->side->whoAmI() == side;
+}
+
+void GeometryBoundaryCondition::setTangentialVelocityForPatch(SPtr<Grid> grid, uint patch, 
+                                                              real p1x, real p1y, real p1z, 
+                                                              real p2x, real p2y, real p2z, 
+                                                              real v, real r)
+{
+    for( uint index = 0; index < this->indices.size(); index++ ){
+        if( this->patches[index] == patch ){
+
+            real x, y, z;
+
+            grid->transIndexToCoords( this->indices[index], x, y, z );
+
+            real pVecX = p2x - p1x;
+            real pVecY = p2y - p1y;
+            real pVecZ = p2z - p1z;
+
+            real xVecX =   x - p1x;
+            real xVecY =   y - p1y;
+            real xVecZ =   z - p1z;
+
+            // compute and normalize tangent
+
+            real tangentX = pVecY * xVecZ - pVecZ * xVecY;
+            real tangentY = pVecZ * xVecX - pVecX * xVecZ; 
+            real tangentZ = pVecX * xVecY - pVecY * xVecX;
+
+            real tangentNorm = sqrt( tangentX*tangentX + tangentY*tangentY + tangentZ*tangentZ );
+
+            tangentX /= tangentNorm;
+            tangentY /= tangentNorm;
+            tangentZ /= tangentNorm;
+
+            // compute distance from rotation axis
+
+            real projection = ( pVecX*xVecX + pVecY*xVecY + pVecZ*xVecZ ) / ( pVecX*pVecX + pVecY*pVecY + pVecZ*pVecZ );
+
+            real d = sqrt( ( xVecX - projection * pVecX ) * ( xVecX - projection * pVecX )
+                         + ( xVecY - projection * pVecY ) * ( xVecY - projection * pVecY )
+                         + ( xVecZ - projection * pVecZ ) * ( xVecZ - projection * pVecZ ) );
+
+            this->vxList[index] = tangentX * d / r * v;
+            this->vyList[index] = tangentY * d / r * v;
+            this->vzList[index] = tangentZ * d / r * v;
+
+        }
+    }
+}
diff --git a/src/GridGenerator/grid/BoundaryConditions/BoundaryCondition.h b/src/GridGenerator/grid/BoundaryConditions/BoundaryCondition.h
new file mode 100644
index 0000000000000000000000000000000000000000..233fa0e2375da420af2fd1976e5ccb5bde5607db
--- /dev/null
+++ b/src/GridGenerator/grid/BoundaryConditions/BoundaryCondition.h
@@ -0,0 +1,168 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 BoundaryCondition.h
+//! \ingroup grid
+//! \author Soeren Peters, Stephan Lenz
+//=======================================================================================
+#ifndef BoundaryCondition_H
+#define BoundaryCondition_H
+
+#include <vector>
+
+#include "global.h"
+
+#include "grid/NodeValues.h"
+
+class Grid;
+
+class Side;
+enum class SideType;
+
+class BoundaryCondition
+{
+public:
+    std::vector<uint> indices;
+    SPtr<Side> side;
+    std::vector<std::vector<real> > qs;
+
+    std::vector<uint> patches;
+
+    virtual char getType() const = 0;
+
+    bool isSide( SideType side ) const;
+
+    real getQ( uint index, uint dir ){ return this->qs[index][dir]; }
+};
+
+//////////////////////////////////////////////////////////////////////////
+
+class PressureBoundaryCondition : public BoundaryCondition
+{
+public:
+    static SPtr<PressureBoundaryCondition> make(real rho)
+    {
+        return SPtr<PressureBoundaryCondition>(new PressureBoundaryCondition(rho));
+    }
+
+    // matrix indices!!!
+    std::vector<uint> neighborIndices;
+
+    real rho;
+protected:
+    PressureBoundaryCondition(real rho) : rho(rho) { }
+
+public:
+    char getType() const override
+    {
+        return BC_PRESSURE;
+    }
+
+    real getRho()
+    {
+        return this->rho;
+    }
+};
+
+//////////////////////////////////////////////////////////////////////////
+
+class VelocityBoundaryCondition : public BoundaryCondition
+{
+public:
+    static SPtr<VelocityBoundaryCondition> make(real vx, real vy, real vz)
+    {
+        return SPtr<VelocityBoundaryCondition>(new VelocityBoundaryCondition(vx, vy, vz));
+    }
+
+    real vx, vy, vz;
+    std::vector<real> vxList, vyList, vzList;
+protected:
+    VelocityBoundaryCondition(real vx, real vy, real vz) : vx(vx), vy(vy), vz(vz) { }
+
+public:
+    virtual char getType() const override
+    {
+        return BC_VELOCITY;
+    }
+
+    void fillVelocityLists()
+    {
+        for( uint index : this->indices ){
+            this->vxList.push_back(vx);
+            this->vyList.push_back(vy);
+            this->vzList.push_back(vz);
+        }
+    }
+
+    real getVx() { return this->vx; }
+    real getVy() { return this->vy; }
+    real getVz() { return this->vz; }
+
+    real getVx(uint index) { return this->vxList[index]; }
+    real getVy(uint index) { return this->vyList[index]; }
+    real getVz(uint index) { return this->vzList[index]; }
+};
+
+//////////////////////////////////////////////////////////////////////////
+
+
+class GeometryBoundaryCondition : public VelocityBoundaryCondition
+{
+public:
+    static SPtr<GeometryBoundaryCondition> make()
+    {
+        return SPtr<GeometryBoundaryCondition>(new GeometryBoundaryCondition());
+    }
+
+private:
+    GeometryBoundaryCondition() : VelocityBoundaryCondition(0.0, 0.0, 0.0) { }
+
+public:
+    char getType() const override
+    {
+        return BC_SOLID;
+    }
+
+    void setVelocityForPatch( uint patch, real vx, real vy, real vz ){
+        for( uint index = 0; index < this->indices.size(); index++ ){
+            if( this->patches[index] == patch ){
+                this->vxList[index] = vx;
+                this->vyList[index] = vy;
+                this->vzList[index] = vz;
+            }
+        }
+    }
+
+    VF_PUBLIC void setTangentialVelocityForPatch( SPtr<Grid> grid, uint patch, 
+                                                  real p1x, real p1y, real p1z, 
+                                                  real p2x, real p2y, real p2z, 
+                                                  real v, real r );
+};
+
+
+#endif
\ No newline at end of file
diff --git a/src/GridGenerator/grid/BoundaryConditions/Side.cpp b/src/GridGenerator/grid/BoundaryConditions/Side.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..99d40b3cd40690d3f00514e58a12e3b7afcb3f52
--- /dev/null
+++ b/src/GridGenerator/grid/BoundaryConditions/Side.cpp
@@ -0,0 +1,222 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 Side.cpp
+//! \ingroup grid
+//! \author Soeren Peters, Stephan Lenz
+//=======================================================================================
+#include "Side.h"
+
+#include "grid/BoundaryConditions/BoundaryCondition.h"
+#include "grid/Grid.h"
+#include "grid/NodeValues.h"
+
+#include "utilities/math/Math.h"
+
+void Side::addIndices(SPtr<Grid> grid, SPtr<BoundaryCondition> boundaryCondition, std::string coord, real constant,
+                      real startInner, real endInner, real startOuter, real endOuter)
+{
+    for (real v2 = startOuter; v2 <= endOuter; v2 += grid->getDelta())
+    {
+        for (real v1 = startInner; v1 <= endInner; v1 += grid->getDelta())
+        {
+            const uint index = getIndex(grid, coord, constant, v1, v2);
+
+            if ((index != INVALID_INDEX) && (  grid->getFieldEntry(index) == FLUID
+                                            || grid->getFieldEntry(index) == FLUID_CFC
+                                            || grid->getFieldEntry(index) == FLUID_CFF
+                                            || grid->getFieldEntry(index) == FLUID_FCC
+                                            || grid->getFieldEntry(index) == FLUID_FCF ) )
+            {
+                grid->setFieldEntry(index, boundaryCondition->getType());
+                boundaryCondition->indices.push_back(index);
+                setPressureNeighborIndices(boundaryCondition, grid, index);
+
+                setQs(grid, boundaryCondition, index);
+
+                boundaryCondition->patches.push_back(0);
+            }
+        }
+    }
+}
+
+void Side::setPressureNeighborIndices(SPtr<BoundaryCondition> boundaryCondition, SPtr<Grid> grid, const uint index)
+{
+    auto pressureBoundaryCondition = std::dynamic_pointer_cast<PressureBoundaryCondition>(boundaryCondition);
+    if (pressureBoundaryCondition)
+    {
+        real x, y, z;
+        grid->transIndexToCoords(index, x, y, z);
+
+        real nx = x;
+        real ny = y;
+        real nz = z;
+
+        if (boundaryCondition->side->getCoordinate() == X_INDEX)
+            nx = -boundaryCondition->side->getDirection() * grid->getDelta() + x;
+        if (boundaryCondition->side->getCoordinate() == Y_INDEX)
+            ny = -boundaryCondition->side->getDirection() * grid->getDelta() + y;
+        if (boundaryCondition->side->getCoordinate() == Z_INDEX)
+            nz = -boundaryCondition->side->getDirection() * grid->getDelta() + z;
+
+        int neighborIndex = grid->transCoordToIndex(nx, ny, nz);
+        pressureBoundaryCondition->neighborIndices.push_back(neighborIndex);
+    }
+}
+
+void Side::setQs(SPtr<Grid> grid, SPtr<BoundaryCondition> boundaryCondition, uint index)
+{
+
+    std::vector<real> qNode(grid->getEndDirection() + 1);
+
+    for (int dir = 0; dir <= grid->getEndDirection(); dir++)
+    {
+        real x,y,z;
+        grid->transIndexToCoords( index, x, y, z );
+
+        x += grid->getDirection()[dir * DIMENSION + 0] * grid->getDelta();
+        y += grid->getDirection()[dir * DIMENSION + 1] * grid->getDelta();
+        z += grid->getDirection()[dir * DIMENSION + 2] * grid->getDelta();
+
+        uint neighborIndex = grid->transCoordToIndex( x, y, z );
+
+        if( grid->getFieldEntry(neighborIndex) == STOPPER_OUT_OF_GRID_BOUNDARY ||
+            grid->getFieldEntry(neighborIndex) == STOPPER_OUT_OF_GRID ||
+            grid->getFieldEntry(neighborIndex) == STOPPER_SOLID )
+            qNode[dir] = 0.5;
+        else
+            qNode[dir] = -1.0;
+    }
+
+    boundaryCondition->qs.push_back(qNode);
+}
+
+uint Side::getIndex(SPtr<Grid> grid, std::string coord, real constant, real v1, real v2)
+{
+    if (coord == "x")
+        return grid->transCoordToIndex(constant, v1, v2);
+    if (coord == "y")
+        return grid->transCoordToIndex(v1, constant, v2);
+    if (coord == "z")
+        return grid->transCoordToIndex(v1, v2, constant);
+    return INVALID_INDEX;
+}
+
+
+void MX::addIndices(std::vector<SPtr<Grid> > grid, uint level, SPtr<BoundaryCondition> boundaryCondition)
+{
+    real startInner = grid[level]->getStartY();
+    real endInner = grid[level]->getEndY();
+
+    real startOuter = grid[level]->getStartZ();
+    real endOuter = grid[level]->getEndZ();
+
+    real coordinateNormal = grid[level]->getStartX() + grid[level]->getDelta();
+
+    if( coordinateNormal > grid[0]->getStartX() + grid[0]->getDelta() ) return;
+
+    Side::addIndices(grid[level], boundaryCondition, "x", coordinateNormal, startInner, endInner, startOuter, endOuter);
+
+}
+
+void PX::addIndices(std::vector<SPtr<Grid> > grid, uint level, SPtr<BoundaryCondition> boundaryCondition)
+{
+    real startInner = grid[level]->getStartY();
+    real endInner = grid[level]->getEndY();
+
+    real startOuter = grid[level]->getStartZ();
+    real endOuter = grid[level]->getEndZ();
+
+    real coordinateNormal = grid[level]->getEndX() - grid[level]->getDelta();
+
+    if( coordinateNormal < grid[0]->getEndX() - grid[0]->getDelta() ) return;
+
+    Side::addIndices(grid[level], boundaryCondition, "x", coordinateNormal, startInner, endInner, startOuter, endOuter);
+}
+
+void MY::addIndices(std::vector<SPtr<Grid> > grid, uint level, SPtr<BoundaryCondition> boundaryCondition)
+{
+    real startInner = grid[level]->getStartX();
+    real endInner = grid[level]->getEndX();
+
+    real startOuter = grid[level]->getStartZ();
+    real endOuter = grid[level]->getEndZ();
+
+    real coordinateNormal = grid[level]->getStartY() + grid[level]->getDelta();
+
+    if( coordinateNormal > grid[0]->getStartY() + grid[0]->getDelta() ) return;
+
+    Side::addIndices(grid[level], boundaryCondition, "y", coordinateNormal, startInner, endInner, startOuter, endOuter);
+}
+
+
+void PY::addIndices(std::vector<SPtr<Grid> > grid, uint level, SPtr<BoundaryCondition> boundaryCondition)
+{
+    real startInner = grid[level]->getStartX();
+    real endInner = grid[level]->getEndX();
+
+    real startOuter = grid[level]->getStartZ();
+    real endOuter = grid[level]->getEndZ();
+
+    real coordinateNormal = grid[level]->getEndY() - grid[level]->getDelta();
+
+    if( coordinateNormal < grid[0]->getEndY() - grid[0]->getDelta() ) return;
+
+    Side::addIndices(grid[level], boundaryCondition, "y", coordinateNormal, startInner, endInner, startOuter, endOuter);
+}
+
+
+void MZ::addIndices(std::vector<SPtr<Grid> > grid, uint level, SPtr<BoundaryCondition> boundaryCondition)
+{
+    real startInner = grid[level]->getStartX();
+    real endInner = grid[level]->getEndX();
+
+    real startOuter = grid[level]->getStartY();
+    real endOuter = grid[level]->getEndY();
+
+    real coordinateNormal = grid[level]->getStartZ() + grid[level]->getDelta();
+
+    if( coordinateNormal > grid[0]->getStartZ() + grid[0]->getDelta() ) return;
+
+    Side::addIndices(grid[level], boundaryCondition, "z", coordinateNormal, startInner, endInner, startOuter, endOuter);
+}
+
+void PZ::addIndices(std::vector<SPtr<Grid> > grid, uint level, SPtr<BoundaryCondition> boundaryCondition)
+{
+    real startInner = grid[level]->getStartX();
+    real endInner = grid[level]->getEndX();
+
+    real startOuter = grid[level]->getStartY();
+    real endOuter = grid[level]->getEndY();
+
+    real coordinateNormal = grid[level]->getEndZ() - grid[level]->getDelta();
+
+    if( coordinateNormal < grid[0]->getEndZ() - grid[0]->getDelta() ) return;
+
+    Side::addIndices(grid[level], boundaryCondition, "z", coordinateNormal, startInner, endInner, startOuter, endOuter);
+}
diff --git a/src/GridGenerator/grid/BoundaryConditions/Side.h b/src/GridGenerator/grid/BoundaryConditions/Side.h
new file mode 100644
index 0000000000000000000000000000000000000000..96784d05a9c187c5f9aae4ba968a94143569209a
--- /dev/null
+++ b/src/GridGenerator/grid/BoundaryConditions/Side.h
@@ -0,0 +1,234 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 Side.h
+//! \ingroup grid
+//! \author Soeren Peters, Stephan Lenz
+//=======================================================================================
+#ifndef SIDE_H
+#define SIDE_H
+
+#include <string>
+#include <vector>
+
+#include "global.h"
+
+#define X_INDEX 0
+#define Y_INDEX 1
+#define Z_INDEX 2
+
+#define POSITIVE_DIR 1
+#define NEGATIVE_DIR -1
+
+class Grid;
+class BoundaryCondition;
+
+class Side;
+
+enum class SideType
+{
+    MX, PX, MY, PY, MZ, PZ, GEOMETRY
+};
+
+
+
+class Side
+{
+public:
+    virtual void addIndices(std::vector<SPtr<Grid> > grid, uint level, SPtr<BoundaryCondition> boundaryCondition) = 0;
+
+    virtual int getCoordinate() const = 0;
+    virtual int getDirection() const = 0;
+
+    virtual SideType whoAmI() const = 0;
+
+protected:
+    static void addIndices(SPtr<Grid> grid, SPtr<BoundaryCondition> boundaryCondition, std::string coord, real constant,
+                           real startInner, real endInner, real startOuter, real endOuter);
+
+    static void setPressureNeighborIndices(SPtr<BoundaryCondition> boundaryCondition, SPtr<Grid> grid, const uint index);
+
+    static void setQs(SPtr<Grid> grid, SPtr<BoundaryCondition> boundaryCondition, uint index);
+
+private:
+    static uint getIndex(SPtr<Grid> grid, std::string coord, real constant, real v1, real v2);
+};
+
+class MX : public Side
+{
+public:
+    void addIndices(std::vector<SPtr<Grid> > grid, uint level, SPtr<BoundaryCondition> boundaryCondition) override;
+
+    int getCoordinate() const override
+    {
+        return X_INDEX;
+    }
+
+    int getDirection() const override
+    {
+        return NEGATIVE_DIR;
+    }
+
+    SideType whoAmI() const override
+    {
+        return SideType::MX;
+    }
+};
+
+class PX : public Side
+{
+public:
+    void addIndices(std::vector<SPtr<Grid> > grid, uint level, SPtr<BoundaryCondition> boundaryCondition) override;
+
+    int getCoordinate() const override
+    {
+        return X_INDEX;
+    }
+
+    int getDirection() const override
+    {
+        return POSITIVE_DIR;
+    }
+
+    SideType whoAmI() const override
+    {
+        return SideType::PX;
+    }
+};
+
+
+class MY : public Side
+{
+public:
+    void addIndices(std::vector<SPtr<Grid> > grid, uint level, SPtr<BoundaryCondition> boundaryCondition) override;
+
+    int getCoordinate() const override
+    {
+        return Y_INDEX;
+    }
+
+    int getDirection() const override
+    {
+        return NEGATIVE_DIR;
+    }
+
+    SideType whoAmI() const override
+    {
+        return SideType::MY;
+    }
+};
+
+class PY : public Side
+{
+public:
+    void addIndices(std::vector<SPtr<Grid> > grid, uint level, SPtr<BoundaryCondition> boundaryCondition) override;
+
+    int getCoordinate() const override
+    {
+        return Y_INDEX;
+    }
+
+    int getDirection() const override
+    {
+        return POSITIVE_DIR;
+    }
+
+    SideType whoAmI() const override
+    {
+        return SideType::PY;
+    }
+};
+
+
+class MZ : public Side
+{
+public:
+    void addIndices(std::vector<SPtr<Grid> > grid, uint level, SPtr<BoundaryCondition> boundaryCondition) override;
+
+    int getCoordinate() const override
+    {
+        return Z_INDEX;
+    }
+
+    int getDirection() const override
+    {
+        return NEGATIVE_DIR;
+    }
+
+    SideType whoAmI() const override
+    {
+        return SideType::MZ;
+    }
+};
+
+class PZ : public Side
+{
+public:
+    void addIndices(std::vector<SPtr<Grid> > grid, uint level, SPtr<BoundaryCondition> boundaryCondition) override;
+
+    int getCoordinate() const override
+    {
+        return Z_INDEX;
+    }
+
+    int getDirection() const override
+    {
+        return POSITIVE_DIR;
+    }
+
+    SideType whoAmI() const override
+    {
+        return SideType::PZ;
+    }
+};
+
+
+class SideFactory
+{
+public:
+    static SPtr<Side> make(SideType sideType)
+    {
+        switch (sideType)
+        {
+        case SideType::MX:
+            return SPtr<Side>(new MX());
+        case SideType::PX:
+            return SPtr<Side>(new PX());
+        case SideType::MY:
+            return SPtr<Side>(new MY());
+        case SideType::PY:
+            return SPtr<Side>(new PY());
+        case SideType::MZ:
+            return SPtr<Side>(new MZ());
+        case SideType::PZ:
+            return SPtr<Side>(new PZ());
+        }
+    }
+};
+
+#endif
diff --git a/src/GridGenerator/grid/BoundaryConditions/package.include b/src/GridGenerator/grid/BoundaryConditions/package.include
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/src/GridGenerator/grid/Cell.h b/src/GridGenerator/grid/Cell.h
new file mode 100644
index 0000000000000000000000000000000000000000..82872f8c17ddd0a27ace2358e93ddf036493ab37
--- /dev/null
+++ b/src/GridGenerator/grid/Cell.h
@@ -0,0 +1,83 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 Cell.h
+//! \ingroup grid
+//! \author Soeren Peters, Stephan Lenz
+//=======================================================================================
+#ifndef CELL_H
+#define CELL_H
+
+#include "global.h"
+
+struct Point
+{
+    Point() : x(0.0), y(0.0), z(0.0) {}
+    Point(real x, real y, real z) : x(x), y(y), z(z) {}
+    real x, y, z;
+};
+
+class Cell
+{
+public:
+    typedef Point* iterator;
+    typedef const Point* const_iterator;
+
+    Cell(real startX, real startY, real startZ, real delta)
+    {
+        points = new Point[size];
+        points[0] = Point(startX, startY, startZ); // 0,0,0
+        points[1] = Point(startX + delta, startY, startZ); // 1,0,0
+        points[2] = Point(startX, startY + delta, startZ); // 0,1,0
+        points[3] = Point(startX + delta, startY + delta, startZ); // 1,1,0
+
+        points[4] = Point(startX, startY, startZ + delta); // 0,0,1
+        points[5] = Point(startX + delta, startY, startZ + delta); // 1,0,1
+        points[6] = Point(startX, startY + delta, startZ + delta); // 0,1,1
+        points[7] = Point(startX + delta, startY + delta, startZ + delta); // 1,1,1
+    }
+
+    ~Cell()
+    {
+        delete[] points;
+    }
+
+    iterator begin() { return &points[0]; }
+    const_iterator begin() const { return &points[0]; }
+    iterator end() { return &points[size]; }
+    const_iterator end() const { return &points[size]; }
+
+private:
+    Point* points;
+    uint size = 8;
+
+};
+
+
+
+#endif
diff --git a/src/GridGenerator/grid/Field.cu b/src/GridGenerator/grid/Field.cu
new file mode 100644
index 0000000000000000000000000000000000000000..7b5b4c4b93a56fb323e285d5b106b26f224d657e
--- /dev/null
+++ b/src/GridGenerator/grid/Field.cu
@@ -0,0 +1,181 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 Field.cu
+//! \ingroup grid
+//! \author Soeren Peters, Stephan Lenz
+//=======================================================================================
+#include "Field.h"
+
+#include "grid/NodeValues.h"
+#include "grid/GridStrategy/GridStrategy.h"
+
+Field::Field(SPtr<GridStrategy> gridStrategy, uint size) : gridStrategy(gridStrategy), size(size)
+{
+    
+}
+
+Field::Field()
+{
+    
+}
+
+Field::~Field()
+{
+    
+}
+
+void Field::allocateMemory()
+{
+    gridStrategy->allocateFieldMemory(this);
+}
+
+void Field::freeMemory()
+{
+    gridStrategy->freeFieldMemory(this);
+}
+
+// --------------------------------------------------------- //
+//                        Getter                             //
+// --------------------------------------------------------- //
+uint Field::getSize() const
+{
+    return this->size;
+}
+
+char Field::getFieldEntry(uint index) const
+{
+    return this->field[index];
+}
+
+// --------------------------------------------------------- //
+//                           Is                              //
+// --------------------------------------------------------- //
+bool Field::is(uint index, char type) const
+{
+    return field[index] == type;
+}
+
+bool Field::isCoarseToFineNode(uint index) const
+{
+    return field[index] == FLUID_CFC;
+}
+
+bool Field::isFineToCoarseNode(uint index) const
+{
+    return field[index] == FLUID_FCC;
+}
+
+bool Field::isFluid(uint index) const
+{
+    const char type = field[index];
+    return type == FLUID || type == FLUID_CFC || type == FLUID_CFF || type == FLUID_FCC || type == FLUID_FCF || isBoundaryConditionNode(index);
+}
+
+bool Field::isInvalidSolid(uint index) const
+{
+    return field[index] == INVALID_SOLID;
+}
+
+bool Field::isInvalidOutOfGrid(uint index) const
+{
+    return field[index] == INVALID_OUT_OF_GRID;
+}
+
+bool Field::isInvalidCoarseUnderFine(uint index) const
+{
+    return field[index] == INVALID_COARSE_UNDER_FINE;
+}
+
+bool Field::isStopperOutOfGrid(uint index) const
+{
+    return field[index] == STOPPER_OUT_OF_GRID;
+}
+
+bool Field::isStopperCoarseUnderFine(uint index) const
+{
+    return field[index] == STOPPER_COARSE_UNDER_FINE;
+}
+
+bool Field::isStopperSolid(uint index) const
+{
+	return field[index] == STOPPER_SOLID;
+}
+
+bool Field::isStopper(uint index) const
+{
+    return isStopperOutOfGrid(index) || isStopperCoarseUnderFine(index) || isStopperSolid(index) || is(index, STOPPER_OUT_OF_GRID_BOUNDARY);
+}
+
+bool Field::isBoundaryConditionNode(uint index) const
+{
+    return  field[index] == BC_SOLID || field[index] == BC_OUTFLOW || field[index] == BC_VELOCITY || field[index] == BC_PRESSURE || field[index] == BC_SLIP;
+}
+
+// --------------------------------------------------------- //
+//                        Setter                             //
+// --------------------------------------------------------- //
+void Field::setFieldEntry(uint index, char val)
+{
+    this->field[index] = val;
+}
+
+void Field::setFieldEntryToFluid(uint index)
+{
+    this->field[index] = FLUID;
+}
+
+void Field::setFieldEntryToInvalidSolid(uint index)
+{
+    this->field[index] = INVALID_SOLID;
+}
+
+void Field::setFieldEntryToStopperOutOfGrid(uint index)
+{
+    this->field[index] = STOPPER_OUT_OF_GRID;
+}
+
+void Field::setFieldEntryToStopperOutOfGridBoundary(uint index)
+{
+    this->field[index] = STOPPER_OUT_OF_GRID_BOUNDARY;
+}
+
+void Field::setFieldEntryToStopperCoarseUnderFine(uint index)
+{
+    this->field[index] = STOPPER_COARSE_UNDER_FINE;
+}
+
+void Field::setFieldEntryToInvalidCoarseUnderFine(uint index)
+{
+    this->field[index] = INVALID_COARSE_UNDER_FINE;
+}
+
+void Field::setFieldEntryToInvalidOutOfGrid(uint index)
+{
+    this->field[index] = INVALID_OUT_OF_GRID;
+}
diff --git a/src/GridGenerator/grid/Field.h b/src/GridGenerator/grid/Field.h
new file mode 100644
index 0000000000000000000000000000000000000000..4ba6da146dd8ed4dd22562561b0eddfd60fd3be3
--- /dev/null
+++ b/src/GridGenerator/grid/Field.h
@@ -0,0 +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 Field.h
+//! \ingroup grid
+//! \author Soeren Peters, Stephan Lenz
+//=======================================================================================
+#ifndef FIELD_H
+#define FIELD_H
+
+#include "global.h"
+
+struct Vertex;
+class GridStrategy;
+
+class VF_PUBLIC Field : public enableSharedFromThis<Field>
+{
+public:
+    Field(SPtr<GridStrategy> gridStrategy, uint size);
+    Field();
+    ~Field();
+    void allocateMemory();
+    void freeMemory();
+
+    uint getSize() const;
+    char getFieldEntry(uint index) const;
+
+    bool is(uint index, char type) const;
+    bool isCoarseToFineNode(uint index) const;
+    bool isFineToCoarseNode(uint index) const;
+	bool isFluid(uint index) const;
+	bool isInvalidSolid(uint index) const;
+    bool isBoundaryConditionNode(uint index) const;
+    bool isInvalidCoarseUnderFine(uint index) const;
+    bool isStopperOutOfGrid(uint index) const;
+    bool isStopperCoarseUnderFine(uint index) const;
+	bool isStopperSolid(uint index) const;
+	bool isStopper(uint index) const;
+    bool isInvalidOutOfGrid(uint index) const;
+
+    void setFieldEntry(uint index, char val);
+	void setFieldEntryToFluid(uint index);
+	void setFieldEntryToInvalidSolid(uint index);
+    void setFieldEntryToStopperOutOfGrid(uint index);
+    void setFieldEntryToStopperOutOfGridBoundary(uint index);
+    void setFieldEntryToStopperCoarseUnderFine(uint index);
+    void setFieldEntryToInvalidCoarseUnderFine(uint index);
+    void setFieldEntryToInvalidOutOfGrid(uint index);
+
+private:
+    SPtr<GridStrategy> gridStrategy;
+
+    char *field;
+    uint size;
+
+    friend class GridGpuStrategy;
+    friend class GridCpuStrategy;
+};
+
+#endif
diff --git a/src/GridGenerator/grid/Grid.h b/src/GridGenerator/grid/Grid.h
new file mode 100644
index 0000000000000000000000000000000000000000..2777844662226d11fc99fe46e1e75e3467172d4f
--- /dev/null
+++ b/src/GridGenerator/grid/Grid.h
@@ -0,0 +1,115 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 Grid.h
+//! \ingroup grid
+//! \author Soeren Peters, Stephan Lenz
+//=======================================================================================
+#ifndef GRID_H
+#define GRID_H
+
+#include "Core/LbmOrGks.h"
+
+#include "global.h"
+
+#include "geometries/Vertex/Vertex.h"
+
+#include "grid/Cell.h"
+
+struct Vertex;
+struct Triangle;
+class GridStrategy;
+class GridInterface;
+class Object;
+class BoundingBox;
+
+class VF_PUBLIC Grid
+{
+public:
+    virtual ~Grid() {}
+
+    virtual const Object* getObject() const = 0;
+
+    virtual real getDelta() const = 0;
+    virtual uint getSparseSize() const = 0;
+    virtual uint getSize() const = 0;
+
+    virtual real getStartX() const = 0;
+    virtual real getStartY() const = 0;
+    virtual real getStartZ() const = 0;
+
+    virtual real getEndX() const = 0;
+    virtual real getEndY() const = 0;
+    virtual real getEndZ() const = 0;
+
+    virtual uint getNumberOfNodesX() const = 0;
+    virtual uint getNumberOfNodesY() const = 0;
+    virtual uint getNumberOfNodesZ() const = 0;
+
+    virtual int getSparseIndex(uint matrixIndex) const = 0;
+    virtual char getFieldEntry(uint matrixIndex) const = 0;
+    virtual void setFieldEntry(uint matrixIndex, char type) = 0;
+
+    virtual int *getNeighborsX() const = 0;
+    virtual int *getNeighborsY() const = 0;
+    virtual int *getNeighborsZ() const = 0;
+    virtual int *getNeighborsNegative() const = 0;
+
+    virtual real* getDistribution() const = 0;
+    virtual int* getDirection() const = 0;
+    virtual int getStartDirection() const = 0;
+    virtual int getEndDirection() const = 0;
+
+    virtual void getNodeValues(real *xCoords, real *yCoords, real *zCoords, uint *neighborX, uint *neighborY, uint *neighborZ, uint *neighborNegative, uint *geo) const = 0;
+
+    virtual SPtr<GridStrategy> getGridStrategy() const = 0;
+    virtual void transIndexToCoords(uint index, real &x, real &y, real &z) const = 0;
+    virtual uint transCoordToIndex(const real &x, const real &y, const real &z) const = 0;
+
+    virtual void inital(const SPtr<Grid> fineGrid, uint numberOfLayers) = 0;
+    
+    virtual void setPeriodicity(bool periodicityX, bool periodicityY, bool periodicityZ) = 0;
+    virtual void setPeriodicityX(bool periodicity) = 0;
+    virtual void setPeriodicityY(bool periodicity) = 0;
+    virtual void setPeriodicityZ(bool periodicity) = 0;
+
+    virtual bool getPeriodicityX() = 0;
+    virtual bool getPeriodicityY() = 0;
+    virtual bool getPeriodicityZ() = 0;
+
+    virtual void freeMemory() = 0;
+
+    virtual bool nodeInCellIs(Cell& cell, char type) const = 0;
+
+    virtual void findSparseIndices(SPtr<Grid> fineGrid) = 0;
+
+    virtual real getFirstFluidNode(real coords[3], int direction, real startCoord) const = 0;
+    virtual real getLastFluidNode(real coords[3], int direction, real startCoord) const = 0;
+};
+
+#endif
diff --git a/src/GridGenerator/grid/GridBuilder/GridBuilder.h b/src/GridGenerator/grid/GridBuilder/GridBuilder.h
new file mode 100644
index 0000000000000000000000000000000000000000..64a19cd0b021139ef1357aa4b8203ab145ded212
--- /dev/null
+++ b/src/GridGenerator/grid/GridBuilder/GridBuilder.h
@@ -0,0 +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 GridBuilder.h
+//! \ingroup grid
+//! \author Soeren Peters, Stephan Lenz
+//=======================================================================================
+#ifndef GridBuilder_H
+#define GridBuilder_H
+
+#include <vector>
+#include <string>
+#include <memory>
+
+#include "GridGenerator/global.h"
+
+#define GEOMQS 6
+#define INLETQS 0
+#define OUTLETQS 1
+#define TOPQS 2
+#define BOTTOMQS 3
+#define FRONTQS 4
+#define BACKQS 5
+
+#define QFILES 7
+
+struct Vertex;
+class GridWrapper;
+class Transformator;
+class ArrowTransformator;
+class PolyDataWriterWrapper;
+
+class BoundingBox;
+class Grid;
+
+enum class SideType;
+
+class BoundaryCondition;
+class GeometryBoundaryCondition;
+
+class GridBuilder
+{
+public:
+    enum class GenerationDevice
+    {
+        CPU, GPU
+    };
+
+    virtual VF_PUBLIC ~GridBuilder() {}
+    virtual void getGridInformations(std::vector<int>& gridX, std::vector<int>& gridY, std::vector<int>& gridZ, std::vector<int>& distX, std::vector<int>& distY, std::vector<int>& distZ) = 0;
+    virtual VF_PUBLIC uint getNumberOfGridLevels() const = 0;
+
+	virtual SPtr<Grid> getGrid(uint level) = 0;
+
+    virtual unsigned int getNumberOfNodes(unsigned int level) const = 0;
+    virtual void getNodeValues(real *xCoords, real *yCoords, real *zCoords, 
+                               uint *neighborX, uint *neighborY, uint *neighborZ, uint *neighborNegative, 
+                               uint *geo, const int level) const = 0;
+    virtual void getDimensions(int &nx, int &ny, int &nz, const int level) const = 0;
+    virtual uint getNumberOfNodesCF(int level) = 0;
+    virtual uint getNumberOfNodesFC(int level) = 0;
+    virtual void getGridInterfaceIndices(uint* iCellCfc, uint* iCellCff, uint* iCellFcc, uint* iCellFcf, int level) const = 0;
+
+    virtual void getOffsetFC(real* xOffCf, real* yOffCf, real* zOffCf, int level) = 0;
+    virtual void getOffsetCF(real* xOffFc, real* yOffFc, real* zOffFc, int level) = 0;
+
+    virtual uint getVelocitySize(int level) const = 0;
+    virtual void getVelocityValues(real* vx, real* vy, real* vz, int* indices, int level) const = 0;
+    virtual void getVelocityQs(real* qs[27], int level) const = 0;
+
+    virtual SPtr<BoundaryCondition> getBoundaryCondition( SideType side, uint level ) const = 0;
+
+};
+
+#endif
+
diff --git a/src/GridGenerator/grid/GridBuilder/LevelGridBuilder.cpp b/src/GridGenerator/grid/GridBuilder/LevelGridBuilder.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..9fb0e244be97273f9747542cbce1e94cd8c7a623
--- /dev/null
+++ b/src/GridGenerator/grid/GridBuilder/LevelGridBuilder.cpp
@@ -0,0 +1,238 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 LevelGridBuilder.cpp
+//! \ingroup grid
+//! \author Soeren Peters, Stephan Lenz
+//=======================================================================================
+#include "LevelGridBuilder.h"
+
+#include <stdio.h>
+#include <iostream>
+
+#include "geometries/BoundingBox/BoundingBox.h"
+
+#include "grid/BoundaryConditions/BoundaryCondition.h"
+#include "grid/BoundaryConditions/Side.h"
+#include "grid/GridStrategy/GridCpuStrategy/GridCpuStrategy.h"
+#include "grid/NodeValues.h"
+#include "grid/GridFactory.h"
+#include "grid/Grid.h"
+
+#define GEOFLUID 19
+#define GEOSOLID 16
+
+LevelGridBuilder::LevelGridBuilder(Device device, const std::string& d3qxx) : device(device), d3qxx(d3qxx)
+{
+}
+
+std::shared_ptr<LevelGridBuilder> LevelGridBuilder::makeShared(Device device, const std::string& d3qxx)
+{
+    return SPtr<LevelGridBuilder>(new LevelGridBuilder(device, d3qxx));
+}
+
+void LevelGridBuilder::setVelocityBoundaryCondition(SideType sideType, real vx, real vy, real vz)
+{
+    SPtr<VelocityBoundaryCondition> velocityBoundaryCondition = VelocityBoundaryCondition::make(vx, vy, vz);
+
+    auto side = SideFactory::make(sideType);
+
+    velocityBoundaryCondition->side = side;
+    velocityBoundaryCondition->side->addIndices(grids, 0, velocityBoundaryCondition);
+
+    velocityBoundaryCondition->fillVelocityLists();
+
+    boundaryConditions[0]->velocityBoundaryConditions.push_back(velocityBoundaryCondition);
+
+    *logging::out << logging::Logger::INFO_INTERMEDIATE << "Set Velocity BC on level " << 0 << " with " << (int)velocityBoundaryCondition->indices.size() <<"\n";
+}
+
+void LevelGridBuilder::setPeriodicBoundaryCondition(bool periodic_X, bool periodic_Y, bool periodic_Z)
+{
+    for( uint level = 0; level < this->grids.size(); level++ )
+        grids[level]->setPeriodicity(periodic_X, periodic_Y, periodic_Z);
+}
+
+void LevelGridBuilder::setNoSlipBoundaryCondition(SideType sideType)
+{
+    for (int level = 0; level < getNumberOfGridLevels(); level++)
+    {
+        SPtr<VelocityBoundaryCondition> noSlipBoundaryCondition = VelocityBoundaryCondition::make(0.0, 0.0, 0.0);
+
+        auto side = SideFactory::make(sideType);
+
+        noSlipBoundaryCondition->side = side;
+        noSlipBoundaryCondition->side->addIndices(grids, level, noSlipBoundaryCondition);
+
+        boundaryConditions[level]->noSlipBoundaryConditions.push_back(noSlipBoundaryCondition);
+    }
+}
+
+LevelGridBuilder::~LevelGridBuilder()
+{
+    for (const auto grid : grids)
+        grid->freeMemory();
+}
+
+SPtr<Grid> LevelGridBuilder::getGrid(uint level)
+{
+    return grids[level];
+}
+
+
+void LevelGridBuilder::getGridInformations(std::vector<int>& gridX, std::vector<int>& gridY,
+    std::vector<int>& gridZ, std::vector<int>& distX, std::vector<int>& distY,
+    std::vector<int>& distZ)
+{
+    for (const auto grid : grids)
+    {
+        gridX.push_back(int(grid->getNumberOfNodesX()));
+        gridY.push_back(int(grid->getNumberOfNodesY()));
+        gridZ.push_back(int(grid->getNumberOfNodesZ()));
+
+        distX.push_back(int(grid->getStartX()));
+        distY.push_back(int(grid->getStartY()));
+        distZ.push_back(int(grid->getStartZ()));
+    }
+}
+
+
+uint LevelGridBuilder::getNumberOfGridLevels() const
+{
+    return uint(grids.size());
+}
+
+uint LevelGridBuilder::getNumberOfNodesCF(int level)
+{
+    return 0;
+}
+
+uint LevelGridBuilder::getNumberOfNodesFC(int level)
+{
+    return 0;
+}
+
+void LevelGridBuilder::getGridInterfaceIndices(uint* iCellCfc, uint* iCellCff, uint* iCellFcc, uint* iCellFcf, int level) const
+{
+}
+
+void LevelGridBuilder::getOffsetFC(real * xOffFC, real * yOffFC, real * zOffFC, int level)
+{
+}
+
+void LevelGridBuilder::getOffsetCF(real * xOffCF, real * yOffCF, real * zOffCF, int level)
+{
+}
+
+uint LevelGridBuilder::getNumberOfNodes(unsigned int level) const
+{
+    return grids[level]->getSparseSize();
+}
+
+
+std::shared_ptr<Grid> LevelGridBuilder::getGrid(int level, int box)
+{
+    return this->grids[level];
+}
+
+void LevelGridBuilder::checkLevel(int level)
+{
+    if (level >= grids.size())
+    { 
+        std::cout << "wrong level input... return to caller\n";
+        return; 
+    }
+}
+
+void LevelGridBuilder::getDimensions(int &nx, int &ny, int &nz, const int level) const
+{
+    nx = grids[level]->getNumberOfNodesX();
+    ny = grids[level]->getNumberOfNodesY();
+    nz = grids[level]->getNumberOfNodesZ();
+}
+
+void LevelGridBuilder::getNodeValues(real *xCoords, real *yCoords, real *zCoords, 
+                                     uint *neighborX, uint *neighborY, uint *neighborZ, uint *neighborNegative, 
+                                     uint *geo, const int level) const
+{
+    grids[level]->getNodeValues(xCoords, yCoords, zCoords, neighborX, neighborY, neighborZ, neighborNegative, geo);
+}
+
+
+uint LevelGridBuilder::getVelocitySize(int level) const
+{
+    uint size = 0;
+    for (auto boundaryCondition : boundaryConditions[level]->velocityBoundaryConditions)
+    {
+        size += uint(boundaryCondition->indices.size());
+    }
+    return size;
+}
+
+void LevelGridBuilder::getVelocityValues(real* vx, real* vy, real* vz, int* indices, int level) const
+{
+    int allIndicesCounter = 0;
+    for (auto boundaryCondition : boundaryConditions[level]->velocityBoundaryConditions)
+    {
+        for(int i = 0; i < boundaryCondition->indices.size(); i++)
+        {
+            indices[allIndicesCounter] = grids[level]->getSparseIndex(boundaryCondition->indices[i]) +1;  
+
+            vx[allIndicesCounter] = boundaryCondition->getVx(i);
+            vy[allIndicesCounter] = boundaryCondition->getVy(i);
+            vz[allIndicesCounter] = boundaryCondition->getVz(i);
+            allIndicesCounter++;
+        }
+    }
+}
+
+void LevelGridBuilder::getVelocityQs(real* qs[27], int level) const
+{
+    int allIndicesCounter = 0;
+    for (auto boundaryCondition : boundaryConditions[level]->velocityBoundaryConditions)
+    {
+        for ( uint index = 0; index < boundaryCondition->indices.size(); index++ )
+        {
+            for (int dir = 0; dir <= grids[level]->getEndDirection(); dir++)
+            {
+                qs[dir][allIndicesCounter] = boundaryCondition->qs[index][dir];
+            }
+            allIndicesCounter++;
+        }
+    }
+}
+
+VF_PUBLIC SPtr<BoundaryCondition> LevelGridBuilder::getBoundaryCondition(SideType side, uint level) const
+{
+    for( auto bc : this->boundaryConditions[level]->velocityBoundaryConditions )
+        if( bc->isSide(side) )
+            return bc;
+
+    return nullptr;
+}
+
diff --git a/src/GridGenerator/grid/GridBuilder/LevelGridBuilder.h b/src/GridGenerator/grid/GridBuilder/LevelGridBuilder.h
new file mode 100644
index 0000000000000000000000000000000000000000..6fbd2ff0289447a89bcd0c8e16fa0ed647bcf0a4
--- /dev/null
+++ b/src/GridGenerator/grid/GridBuilder/LevelGridBuilder.h
@@ -0,0 +1,131 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 LevelGridBuilder.h
+//! \ingroup grid
+//! \author Soeren Peters, Stephan Lenz
+//=======================================================================================
+#ifndef LEVEL_GRID_BUILDER_H
+#define LEVEL_GRID_BUILDER_H
+
+#include <vector>
+#include <string>
+#include <memory>
+#include <array>
+
+#include "global.h"
+
+#include "grid/GridBuilder/GridBuilder.h"
+#include "grid/Grid.h"
+#include "grid/NodeValues.h"
+
+struct Vertex;
+class  Grid;
+class PolyDataWriterWrapper;
+class BoundingBox;
+enum class Device;
+
+class Side;
+class VelocityBoundaryCondition;
+enum class SideType;
+
+
+
+class LevelGridBuilder : public GridBuilder
+{
+protected:
+    VF_PUBLIC LevelGridBuilder(Device device, const std::string& d3qxx);
+
+public:
+    VF_PUBLIC static std::shared_ptr<LevelGridBuilder> makeShared(Device device, const std::string& d3qxx);
+
+    VF_PUBLIC SPtr<Grid> getGrid(uint level) override;
+
+    VF_PUBLIC virtual ~LevelGridBuilder();
+
+    VF_PUBLIC void setVelocityBoundaryCondition(SideType sideType, real vx, real vy, real vz);
+    VF_PUBLIC void setPeriodicBoundaryCondition(bool periodic_X, bool periodic_Y, bool periodic_Z);
+    VF_PUBLIC void setNoSlipBoundaryCondition(SideType sideType);
+
+    VF_PUBLIC virtual std::shared_ptr<Grid> getGrid(int level, int box);
+
+    VF_PUBLIC virtual unsigned int getNumberOfNodes(unsigned int level) const;
+
+
+    VF_PUBLIC virtual void getNodeValues(real *xCoords, real *yCoords, real *zCoords, 
+                                         uint *neighborX, uint *neighborY, uint *neighborZ, uint *neighborNegative, 
+                                         uint *geo, const int level) const override;
+    VF_PUBLIC virtual void getDimensions(int &nx, int &ny, int &nz, const int level) const;
+
+
+    VF_PUBLIC uint getVelocitySize(int level) const;
+    VF_PUBLIC virtual void getVelocityValues(real* vx, real* vy, real* vz, int* indices, int level) const;
+    VF_PUBLIC virtual void getVelocityQs(real* qs[27], int level) const;
+
+    VF_PUBLIC SPtr<BoundaryCondition> getBoundaryCondition( SideType side, uint level ) const override;
+
+protected:
+    
+
+    struct BoundaryConditions
+    {
+		BoundaryConditions() {}
+
+        std::vector<SPtr<VelocityBoundaryCondition> > velocityBoundaryConditions;
+
+        std::vector<SPtr<VelocityBoundaryCondition> > noSlipBoundaryConditions;
+    };
+    bool geometryHasValues = false;
+
+    std::vector<std::shared_ptr<Grid> > grids;
+    std::vector<SPtr<BoundaryConditions> > boundaryConditions;
+    
+    void checkLevel(int level);
+
+private:
+    Device device;
+    std::string d3qxx;
+
+public:
+    VF_PUBLIC void getGridInformations(std::vector<int>& gridX, std::vector<int>& gridY,
+                                       std::vector<int>& gridZ, std::vector<int>& distX, std::vector<int>& distY,
+                                       std::vector<int>& distZ) override;
+    VF_PUBLIC uint getNumberOfGridLevels() const override;
+
+    VF_PUBLIC uint getNumberOfNodesCF(int level) override;
+    VF_PUBLIC uint getNumberOfNodesFC(int level) override;
+
+    VF_PUBLIC void getGridInterfaceIndices(uint* iCellCfc, uint* iCellCff, uint* iCellFcc, uint* iCellFcf, int level) const override;
+
+    VF_PUBLIC void getOffsetFC(real* xOffCf, real* yOffCf, real* zOffCf, int level) override;
+    VF_PUBLIC void getOffsetCF(real* xOffFc, real* yOffFc, real* zOffFc, int level) override;
+
+};
+
+#endif
+
diff --git a/src/GridGenerator/grid/GridBuilder/MultipleGridBuilder.cpp b/src/GridGenerator/grid/GridBuilder/MultipleGridBuilder.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..e7a13992d85ba88cedb9796534255fab5fae5e8c
--- /dev/null
+++ b/src/GridGenerator/grid/GridBuilder/MultipleGridBuilder.cpp
@@ -0,0 +1,156 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 MultipleGridBuilder.cpp
+//! \ingroup grid
+//! \author Soeren Peters, Stephan Lenz
+//=======================================================================================
+#include "MultipleGridBuilder.h"
+
+#include <sstream>
+#include <vector>
+#include <iostream>
+#include <cmath>
+
+#include "utilities/math/Math.h"
+
+#include "geometries/BoundingBox/BoundingBox.h"
+
+#include "grid/BoundaryConditions/BoundaryCondition.h"
+#include "grid/BoundaryConditions/Side.h"
+#include "grid/Grid.h"
+#include "grid/GridFactory.h"
+
+MultipleGridBuilder::MultipleGridBuilder(SPtr<GridFactory> gridFactory, Device device, const std::string &d3qxx) :
+    LevelGridBuilder(device, d3qxx), gridFactory(gridFactory), solidObject(nullptr), numberOfLayersFine(12), numberOfLayersBetweenLevels(8), subDomainBox(nullptr)
+{
+
+}
+
+SPtr<MultipleGridBuilder> MultipleGridBuilder::makeShared(SPtr<GridFactory> gridFactory)
+{
+    return SPtr<MultipleGridBuilder>(new MultipleGridBuilder(gridFactory));
+}
+
+void MultipleGridBuilder::addCoarseGrid(real startX, real startY, real startZ, real endX, real endY, real endZ, real delta)
+{
+    boundaryConditions.push_back(SPtr<BoundaryConditions>(new BoundaryConditions));
+
+    startX -= 0.5 * delta;
+    startY -= 0.5 * delta;
+    startZ -= 0.5 * delta;
+    endX   += 0.5 * delta;
+    endY   += 0.5 * delta;
+    endZ   += 0.5 * delta;
+
+    const auto grid = this->makeGrid(new Cuboid(startX, startY, startZ, endX, endY, endZ), startX, startY, startZ, endX, endY, endZ, delta, 0);
+    addGridToList(grid);
+}
+
+SPtr<Grid> MultipleGridBuilder::makeGrid(Object* gridShape, real startX, real startY, real startZ, real endX, real endY, real endZ, real delta, uint level) const
+{
+    return gridFactory->makeGrid(gridShape, startX, startY, startZ, endX, endY, endZ, delta, level);
+}
+
+bool MultipleGridBuilder::coarseGridExists() const
+{
+    return !grids.empty();
+}
+
+uint MultipleGridBuilder::getNumberOfLevels() const
+{
+    return uint(grids.size());
+}
+
+real MultipleGridBuilder::getDelta(uint level) const
+{
+    if (grids.size() <= level)
+        throw std::runtime_error("delta from invalid level was required.");
+    return grids[level]->getDelta();
+}
+
+real MultipleGridBuilder::getStartX(uint level) const
+{
+    return grids[level]->getStartX();
+}
+
+real MultipleGridBuilder::getStartY(uint level) const
+{
+    return grids[level]->getStartY();
+}
+
+real MultipleGridBuilder::getStartZ(uint level) const
+{
+    return grids[level]->getStartZ();
+}
+
+real MultipleGridBuilder::getEndX(uint level) const
+{
+    return grids[level]->getEndX();
+}
+
+real MultipleGridBuilder::getEndY(uint level) const
+{
+    return grids[level]->getEndY();
+}
+
+real MultipleGridBuilder::getEndZ(uint level) const
+{
+    return grids[level]->getEndZ();
+}
+
+void MultipleGridBuilder::addGridToList(SPtr<Grid> grid)
+{
+    grids.push_back(grid);
+}
+
+std::vector<SPtr<Grid> > MultipleGridBuilder::getGrids() const
+{
+    return this->grids;
+}
+
+void MultipleGridBuilder::buildGrids( LbmOrGks lbmOrGks, bool enableThinWalls )
+{
+    *logging::out << logging::Logger::INFO_INTERMEDIATE << "Start initializing level " << 0 << "\n";
+
+    grids[0]->inital( nullptr, 0 );
+
+    *logging::out << logging::Logger::INFO_INTERMEDIATE << "Done initializing level " << 0 << "\n";
+
+    //////////////////////////////////////////////////////////////////////////
+
+	if (lbmOrGks == LBM)
+		grids[0]->findSparseIndices(nullptr);
+}
+
+VF_PUBLIC void MultipleGridBuilder::setNumberOfLayers(uint numberOfLayersFine, uint numberOfLayersBetweenLevels)
+{
+    this->numberOfLayersFine = numberOfLayersFine;
+    this->numberOfLayersBetweenLevels = numberOfLayersBetweenLevels;
+}
+
diff --git a/src/GridGenerator/grid/GridBuilder/MultipleGridBuilder.h b/src/GridGenerator/grid/GridBuilder/MultipleGridBuilder.h
new file mode 100644
index 0000000000000000000000000000000000000000..e9548c098ee287eace8af3f8967d1edeeec50bfc
--- /dev/null
+++ b/src/GridGenerator/grid/GridBuilder/MultipleGridBuilder.h
@@ -0,0 +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 MultipleGridBuilder.h
+//! \ingroup grid
+//! \author Soeren Peters, Stephan Lenz
+//=======================================================================================
+#ifndef MULTIPLE_GRID_BUILDER_H
+#define MULTIPLE_GRID_BUILDER_H
+
+#include <vector>
+#include <array>
+
+#include "Core/LbmOrGks.h"
+
+#include "global.h"
+
+#include "grid/GridBuilder/LevelGridBuilder.h"
+#include "grid/GridFactory.h"
+
+class Object;
+class BoundingBox;
+
+class MultipleGridBuilder : public LevelGridBuilder
+{
+private:
+    VF_PUBLIC MultipleGridBuilder(SPtr<GridFactory> gridFactory, Device device = Device::CPU, const std::string &d3qxx = "D3Q27");
+
+public:
+    VF_PUBLIC static SPtr<MultipleGridBuilder> makeShared(SPtr<GridFactory> gridFactory);
+
+    VF_PUBLIC void addCoarseGrid(real startX, real startY, real startZ, real endX, real endY, real endZ, real delta);
+
+    VF_PUBLIC uint getNumberOfLevels() const;
+    VF_PUBLIC real getDelta(uint level) const;
+
+    VF_PUBLIC real getStartX(uint level) const;
+    VF_PUBLIC real getStartY(uint level) const;
+    VF_PUBLIC real getStartZ(uint level) const;
+
+    VF_PUBLIC real getEndX(uint level) const;
+    VF_PUBLIC real getEndY(uint level) const;
+    VF_PUBLIC real getEndZ(uint level) const;
+
+    VF_PUBLIC std::vector<SPtr<Grid> > getGrids() const;
+    VF_PUBLIC void buildGrids(LbmOrGks lbmOrGks, bool enableThinWalls = false);
+
+    VF_PUBLIC void setNumberOfLayers( uint numberOfLayersFine, uint numberOfLayersBetweenLevels );
+
+
+private:
+    void addGridToList(SPtr<Grid> grid);
+    bool coarseGridExists() const;
+
+    SPtr<Grid> makeGrid(Object* gridShape, real startX, real startY, real startZ, real endX, real endY, real endZ, real delta, uint level) const;
+
+
+    SPtr<GridFactory> gridFactory;
+    Object* solidObject;
+
+    uint numberOfLayersFine;
+    uint numberOfLayersBetweenLevels;
+
+    SPtr<BoundingBox> subDomainBox;
+
+};
+
+#endif
+
diff --git a/src/GridGenerator/grid/GridBuilder/package.include b/src/GridGenerator/grid/GridBuilder/package.include
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/src/GridGenerator/grid/GridFactory.h b/src/GridGenerator/grid/GridFactory.h
new file mode 100644
index 0000000000000000000000000000000000000000..e0311693a717b29e987b1e9e9188612e0aa15cc0
--- /dev/null
+++ b/src/GridGenerator/grid/GridFactory.h
@@ -0,0 +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 GridFactory.h
+//! \ingroup grid
+//! \author Soeren Peters, Stephan Lenz
+//=======================================================================================
+#ifndef GRID_FACTORY_H
+#define GRID_FACTORY_H
+
+#include "global.h"
+
+#include "geometries/Cuboid/Cuboid.h"
+
+#include "grid/GridStrategy/GridCpuStrategy/GridCpuStrategy.h"
+#include "grid/distributions/Distribution.h"
+#include "grid/GridImp.h"
+
+enum class Device
+{
+    CPU, GPU
+};
+
+enum class TriangularMeshDiscretizationMethod
+{
+    RAYCASTING, POINT_IN_OBJECT, POINT_UNDER_TRIANGLE
+};
+
+class VF_PUBLIC GridFactory
+{
+public:
+    static SPtr<GridFactory> make()
+    {
+        return SPtr<GridFactory>(new GridFactory());
+    }
+
+private:
+    GridFactory()
+    {
+        gridStrategy = SPtr<GridStrategy>(new GridCpuStrategy());
+    }
+
+public:
+    SPtr<Grid> makeGrid(Object* gridShape, real startX, real startY, real startZ, real endX, real endY, real endZ, real delta, uint level, const std::string& d3Qxx = "D3Q27")
+    {
+        Distribution distribution = DistributionHelper::getDistribution(d3Qxx);
+
+        SPtr<GridImp> grid;
+
+        grid = GridImp::makeShared(gridShape, startX, startY, startZ, endX, endY, endZ, delta, gridStrategy, distribution, level);
+
+        return grid;
+    }
+
+
+    void setGridStrategy(Device device)
+    {
+        switch (device)
+        {
+        case Device::CPU:
+            gridStrategy = SPtr<GridStrategy>(new GridCpuStrategy()); break;
+        }
+    }
+
+    void setGridStrategy(SPtr<GridStrategy> gridStrategy)
+    {
+        this->gridStrategy = gridStrategy;
+    }
+
+private:
+    SPtr<GridStrategy> gridStrategy;
+};
+
+
+#endif
diff --git a/src/GridGenerator/grid/GridImp.cu b/src/GridGenerator/grid/GridImp.cu
new file mode 100644
index 0000000000000000000000000000000000000000..08cc9fb4ec73262dba97edeceeb63e19082a5113
--- /dev/null
+++ b/src/GridGenerator/grid/GridImp.cu
@@ -0,0 +1,864 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 GridImp.cu
+//! \ingroup grid
+//! \author Soeren Peters, Stephan Lenz
+//=======================================================================================
+#include "GridImp.h"
+
+#include <stdio.h>
+#include <time.h>
+#include <iostream>
+#include <omp.h>
+#include <sstream>
+
+#include "global.h"
+
+#include "geometries/Object.h"
+#include "geometries/Vertex/Vertex.h"
+#include "geometries/BoundingBox/BoundingBox.h"
+
+#include "grid/GridStrategy/GridStrategy.h"
+#include "grid/distributions/Distribution.h"
+#include "grid/Field.h"
+#include "grid/NodeValues.h"
+
+#include "utilities/math/Math.h"
+
+int DIRECTIONS[DIR_END_MAX][DIMENSION];
+
+
+GridImp::GridImp(Object* object, real startX, real startY, real startZ, real endX, real endY, real endZ, real delta, SPtr<GridStrategy> gridStrategy, Distribution distribution, uint level) 
+            : object(object), 
+    startX(startX),
+    startY(startY),
+    startZ(startZ),
+    endX(endX),
+    endY(endY),
+    endZ(endZ),
+    delta(delta),
+    gridStrategy(gridStrategy),
+    distribution(distribution),
+    level(level),
+    periodicityX(false),
+    periodicityY(false),
+    periodicityZ(false),
+    neighborIndexX(nullptr),
+    neighborIndexY(nullptr),
+    neighborIndexZ(nullptr),
+    neighborIndexNegative(nullptr),
+    sparseIndices(nullptr)
+{
+    initalNumberOfNodesAndSize();
+}
+
+SPtr<GridImp> GridImp::makeShared(Object* object, real startX, real startY, real startZ, real endX, real endY, real endZ, real delta, SPtr<GridStrategy> gridStrategy, Distribution d, uint level)
+{
+    SPtr<GridImp> grid(new GridImp(object, startX, startY, startZ, endX, endY, endZ, delta, gridStrategy, d, level));
+    return grid;
+}
+
+
+void GridImp::initalNumberOfNodesAndSize()
+{
+    const real length = endX - startX;
+    const real width = endY - startY;
+    const real height = endZ - startZ;
+
+    nx = lround((length + delta) / delta);
+    ny = lround((width + delta) / delta);
+    nz = lround((height + delta) / delta);
+
+    this->size = nx * ny * nz;
+    this->sparseSize = size;
+    distribution.setSize(size);
+}
+
+void GridImp::inital(const SPtr<Grid> fineGrid, uint numberOfLayers)
+{
+    field = Field(gridStrategy, size);
+    field.allocateMemory();
+    gridStrategy->allocateGridMemory(shared_from_this());
+    
+    *logging::out << logging::Logger::INFO_INTERMEDIATE << "Start initalNodesToOutOfGrid()\n";
+    gridStrategy->initalNodesToOutOfGrid(shared_from_this());
+    
+    *logging::out << logging::Logger::INFO_INTERMEDIATE << "Start findInnerNodes()\n";
+    this->object->findInnerNodes( shared_from_this() );
+    
+    *logging::out << logging::Logger::INFO_INTERMEDIATE << "Start findEndOfGridStopperNodes()\n";
+	gridStrategy->findEndOfGridStopperNodes(shared_from_this());
+
+    *logging::out << logging::Logger::INFO_INTERMEDIATE
+        << "Grid created: " << "from (" << this->startX << ", " << this->startY << ", " << this->startZ << ") to (" << this->endX << ", " << this->endY << ", " << this->endZ << ")\n"
+        << "nodes: " << this->nx << " x " << this->ny << " x " << this->nz << " = " << this->size << "\n";
+}
+
+void GridImp::initalNodeToOutOfGrid(uint index)
+{
+    this->field.setFieldEntryToInvalidOutOfGrid(index);
+}
+
+void GridImp::freeMemory()
+{
+    gridStrategy->freeMemory(shared_from_this());
+}
+
+GridImp::GridImp()
+{
+}
+
+GridImp::~GridImp()
+{
+}
+
+void GridImp::findInnerNode(uint index)
+{
+    this->sparseIndices[index] = index;
+
+    real x, y, z;
+    this->transIndexToCoords(index, x, y, z);
+    const uint xIndex = getXIndex(x);
+    const uint yIndex = getYIndex(y);
+    const uint zIndex = getZIndex(z);
+
+    if( xIndex != 0 && xIndex != this->nx-1 &&
+        yIndex != 0 && yIndex != this->ny-1 &&
+        zIndex != 0 && zIndex != this->nz-1 )
+        this->field.setFieldEntryToFluid(index);
+}
+
+void GridImp::findEndOfGridStopperNode(uint index)
+{
+	if (isValidEndOfGridStopper(index)){
+        if( this->level != 0 )
+		    this->field.setFieldEntryToStopperOutOfGrid(index);
+        else
+            this->field.setFieldEntryToStopperOutOfGridBoundary(index);
+    }
+
+	if (isValidEndOfGridBoundaryStopper(index))
+		this->field.setFieldEntryToStopperOutOfGridBoundary(index);
+}
+
+bool GridImp::isOutSideOfGrid(Cell &cell) const
+{
+    for (const auto point : cell) {
+        if (point.x < startX || point.x > endX
+            || point.y < startY || point.y > endY
+            || point.z < startZ || point.z > endZ)
+            return true;
+    }
+    return false;
+}
+
+bool GridImp::contains(Cell &cell, char type) const
+{
+    for (const auto point : cell) {
+		uint index = transCoordToIndex(point.x, point.y, point.z);
+		if (index == INVALID_INDEX)
+			continue;
+        if (field.is(index, type))
+            return true;
+    }
+    return false;
+}
+
+bool GridImp::cellContainsOnly(Cell &cell, char type) const
+{
+    for (const auto point : cell) {
+		uint index = transCoordToIndex(point.x, point.y, point.z);
+		if (index == INVALID_INDEX)
+            return false;
+        if (!field.is(index, type))
+            return false;
+    }
+    return true;
+}
+
+bool GridImp::cellContainsOnly(Cell &cell, char typeA, char typeB) const
+{
+    for (const auto point : cell) {
+		uint index = transCoordToIndex(point.x, point.y, point.z);
+		if (index == INVALID_INDEX)
+            return false;
+        if (!field.is(index, typeA) && !field.is(index, typeB))
+            return false;
+    }
+    return true;
+}
+
+const Object * GridImp::getObject() const
+{
+    return this->object;
+}
+
+void GridImp::setNodeTo(Cell &cell, char type)
+{
+    for (const auto point : cell) {
+		uint index = transCoordToIndex(point.x, point.y, point.z);
+		if (index == INVALID_INDEX)
+			continue;
+		field.setFieldEntry(index, type);
+    }
+}
+
+void GridImp::setNodeTo(uint index, char type)
+{
+	if( index != INVALID_INDEX )
+		field.setFieldEntry(index, type);
+}
+
+bool GridImp::isNode(uint index, char type) const
+{
+    if( index != INVALID_INDEX )
+		return field.is(index, type);
+}
+
+bool GridImp::isValidEndOfGridStopper(uint index) const
+{
+	// Lenz: also includes corner stopper nodes
+	if (!this->field.is(index, INVALID_OUT_OF_GRID))
+		return false;
+
+	return hasNeighborOfType(index, FLUID);
+}
+
+bool GridImp::isValidEndOfGridBoundaryStopper(uint index) const
+{
+	// Lenz: also includes corner stopper nodes
+	if (!this->field.is(index, FLUID))
+		return false;
+
+	return ! hasAllNeighbors(index);
+}
+
+bool GridImp::isValidSolidStopper(uint index) const
+{
+	// Lenz: also includes corner stopper nodes
+	if (!this->field.is(index, INVALID_SOLID))
+		return false;
+
+	return hasNeighborOfType(index, FLUID);
+}
+
+bool GridImp::shouldBeBoundarySolidNode(uint index) const
+{
+	if (!this->field.is(index, FLUID))
+		return false;
+
+	return hasNeighborOfType(index, STOPPER_SOLID);
+}
+
+bool GridImp::hasAllNeighbors(uint index) const
+{
+	// new version by Lenz, utilizes the range based for loop for all directions
+	real x, y, z;
+	this->transIndexToCoords(index, x, y, z);
+	for (const auto dir : this->distribution) {
+		const uint neighborIndex = this->transCoordToIndex(x + dir[0] * this->getDelta(), y + dir[1] * this->getDelta(), z + dir[2] * this->getDelta());
+
+		if (neighborIndex == INVALID_INDEX) return false;
+	}
+
+	return true;
+}
+
+bool GridImp::hasNeighborOfType(uint index, char type) const
+{
+	// new version by Lenz, utilizes the range based for loop for all directions
+	real x, y, z;
+	this->transIndexToCoords(index, x, y, z);
+	for (const auto dir : this->distribution) {
+		const uint neighborIndex = this->transCoordToIndex(x + dir[0] * this->getDelta(), y + dir[1] * this->getDelta(), z + dir[2] * this->getDelta());
+
+		if (neighborIndex == INVALID_INDEX) continue;
+
+		if (this->field.is(neighborIndex, type))
+			return true;
+	}
+
+	return false;
+}
+
+bool GridImp::nodeInNextCellIs(int index, char type) const
+{
+    real x, y, z;
+    this->transIndexToCoords(index, x, y, z);
+
+    const real neighborX = x + this->delta > endX ? endX : x + this->delta;
+    const real neighborY = y + this->delta > endY ? endY : y + this->delta;
+    const real neighborZ = z + this->delta > endZ ? endZ : z + this->delta;
+
+    const uint indexX = transCoordToIndex(neighborX, y, z);
+    const uint indexY = transCoordToIndex(x, neighborY, z);
+    const uint indexZ = transCoordToIndex(x, y, neighborZ);
+
+    const uint indexXY = transCoordToIndex(neighborX, neighborY, z);
+    const uint indexYZ = transCoordToIndex(x, neighborY, neighborZ);
+    const uint indexXZ = transCoordToIndex(neighborX, y, neighborZ);
+
+    const uint indexXYZ = transCoordToIndex(neighborX, neighborY, neighborZ);
+
+	const bool typeX   = indexX   == INVALID_INDEX ? false : this->field.is(indexX, type);
+	const bool typeY   = indexY   == INVALID_INDEX ? false : this->field.is(indexY, type);
+	const bool typeXY  = indexXY  == INVALID_INDEX ? false : this->field.is(indexXY, type);
+	const bool typeZ   = indexZ   == INVALID_INDEX ? false : this->field.is(indexZ, type);
+	const bool typeYZ  = indexYZ  == INVALID_INDEX ? false : this->field.is(indexYZ, type);
+	const bool typeXZ  = indexXZ  == INVALID_INDEX ? false : this->field.is(indexXZ, type);
+	const bool typeXYZ = indexXYZ == INVALID_INDEX ? false : this->field.is(indexXYZ, type);
+
+    return typeX || typeY || typeXY || typeZ || typeYZ
+        || typeXZ || typeXYZ;
+}
+
+bool GridImp::nodeInPreviousCellIs(int index, char type) const
+{
+    real x, y, z;
+    this->transIndexToCoords(index, x, y, z);
+
+    const real neighborX = x - this->delta < startX ? startX : x - this->delta;
+    const real neighborY = y - this->delta < startY ? startY : y - this->delta;
+    const real neighborZ = z - this->delta < startZ ? startZ : z - this->delta;
+
+    const uint indexX = transCoordToIndex(neighborX, y, z);
+    const uint indexY = transCoordToIndex(x, neighborY, z);
+    const uint indexZ = transCoordToIndex(x, y, neighborZ);
+
+    const uint indexXY = transCoordToIndex(neighborX, neighborY, z);
+    const uint indexYZ = transCoordToIndex(x, neighborY, neighborZ);
+    const uint indexXZ = transCoordToIndex(neighborX, y, neighborZ);
+
+    const uint indexXYZ = transCoordToIndex(neighborX, neighborY, neighborZ);
+
+	const bool typeX   = indexX   == INVALID_INDEX ? false : this->field.is(indexX  , type);
+	const bool typeY   = indexY   == INVALID_INDEX ? false : this->field.is(indexY  , type);
+	const bool typeXY  = indexXY  == INVALID_INDEX ? false : this->field.is(indexXY , type);
+	const bool typeZ   = indexZ   == INVALID_INDEX ? false : this->field.is(indexZ  , type);
+	const bool typeYZ  = indexYZ  == INVALID_INDEX ? false : this->field.is(indexYZ , type);
+	const bool typeXZ  = indexXZ  == INVALID_INDEX ? false : this->field.is(indexXZ , type);
+	const bool typeXYZ = indexXYZ == INVALID_INDEX ? false : this->field.is(indexXYZ, type);
+
+    return typeX || typeY || typeXY || typeZ || typeYZ
+        || typeXZ || typeXYZ;
+}
+
+bool GridImp::nodeInCellIs(Cell& cell, char type) const
+{
+    for (const auto node : cell)
+    {
+        const uint index = transCoordToIndex(node.x, node.y, node.z);
+		if (index == INVALID_INDEX)
+			continue;
+        if (field.is(index, type))
+            return true;
+    }
+    return false;
+}
+
+
+void GridImp::setCellTo(uint index, char type)
+{
+    real x, y, z;
+    this->transIndexToCoords(index, x, y, z);
+
+    Cell cell(x, y, z, this->delta);
+    for (const auto node : cell)
+    {
+        const uint nodeIndex = transCoordToIndex(node.x, node.y, node.z);
+		if (nodeIndex == INVALID_INDEX)
+			continue;
+		this->field.setFieldEntry(nodeIndex, type);
+    }
+}
+
+
+void GridImp::setNonStopperOutOfGridCellTo(uint index, char type)
+{
+    real x, y, z;
+    this->transIndexToCoords(index, x, y, z);
+
+    Cell cell(x, y, z, this->delta);
+    for (const auto node : cell)
+    {
+        const uint nodeIndex = transCoordToIndex(node.x, node.y, node.z);
+		if (nodeIndex == INVALID_INDEX)
+			continue;
+
+        if( this->getFieldEntry( nodeIndex ) != STOPPER_OUT_OF_GRID && 
+            this->getFieldEntry( nodeIndex ) != STOPPER_OUT_OF_GRID_BOUNDARY )
+            this->field.setFieldEntry(nodeIndex, type);
+    }
+}
+
+
+void GridImp::setPeriodicity(bool periodicityX, bool periodicityY, bool periodicityZ)
+{
+    this->periodicityX = periodicityX;
+    this->periodicityY = periodicityY;
+    this->periodicityZ = periodicityZ;
+}
+
+void GridImp::setPeriodicityX(bool periodicity)
+{
+    this->periodicityX = periodicityX;
+}
+
+void GridImp::setPeriodicityY(bool periodicity)
+{
+    this->periodicityY = periodicityY;
+}
+
+void GridImp::setPeriodicityZ(bool periodicity)
+{
+    this->periodicityZ = periodicityZ;
+}
+
+bool GridImp::getPeriodicityX()
+{
+    return this->periodicityX;
+}
+
+bool GridImp::getPeriodicityY()
+{
+    return this->periodicityY;
+}
+
+bool GridImp::getPeriodicityZ()
+{
+    return this->periodicityZ;
+}
+
+uint GridImp::transCoordToIndex(const real &x, const real &y, const real &z) const
+{
+    const uint xIndex = getXIndex(x);
+    const uint yIndex = getYIndex(y);
+    const uint zIndex = getZIndex(z);
+
+	if (xIndex >= nx || yIndex >= ny || zIndex >= nz)
+        return INVALID_INDEX;
+
+    return xIndex + nx * (yIndex + ny * zIndex);
+}
+
+void GridImp::transIndexToCoords(uint index, real &x, real &y, real &z) const
+{
+    if (index == INVALID_INDEX)
+        printf("Function: transIndexToCoords. GridImp Index: %d, size: %d. Exit Program!\n", index, size);
+
+    x = index % nx;
+    y = (index / nx) % ny;
+    z = ((index / nx) / ny) % nz;
+
+    x = (x * delta) + startX;
+    y = (y * delta) + startY;
+    z = (z * delta) + startZ;
+}
+
+uint GridImp::getLevel(real startDelta) const
+{
+    uint level = 0;
+    real delta = this->delta;
+    while(!vf::Math::equal(delta, startDelta))
+    {
+        delta *= 2;
+        level++;
+    }
+    return level;
+}
+
+uint GridImp::getLevel() const
+{
+    return this->level;
+}
+
+// --------------------------------------------------------- //
+//                  Set Sparse Indices                       //
+// --------------------------------------------------------- //
+
+void GridImp::findSparseIndices(SPtr<Grid> fineGrid)
+{
+    this->gridStrategy->findSparseIndices(shared_from_this(), std::static_pointer_cast<GridImp>(fineGrid));
+}
+
+
+void GridImp::updateSparseIndices()
+{
+    int removedNodes = 0;
+    int newIndex = 0;
+    for (uint index = 0; index < size; index++)
+    {
+        if (this->field.isInvalidCoarseUnderFine(index) || this->field.isInvalidOutOfGrid(index) || this->field.isInvalidSolid(index))
+        {
+            sparseIndices[index] = -1;
+            removedNodes++;
+        }
+        else
+        {
+            sparseIndices[index] = newIndex;
+            newIndex++;
+        }
+    }
+    sparseSize = size - removedNodes;
+}
+
+void GridImp::setNeighborIndices(uint index)
+{
+    real x, y, z;
+    this->transIndexToCoords(index, x, y, z);
+
+    this->neighborIndexX[index]        = -1;
+    this->neighborIndexY[index]        = -1;
+    this->neighborIndexZ[index]        = -1;
+    this->neighborIndexNegative[index] = -1;
+
+    if (this->field.isStopper(index) || this->field.is(index, STOPPER_OUT_OF_GRID_BOUNDARY))
+    {
+        this->setStopperNeighborCoords(index);
+        return;
+    }
+     
+    if (this->sparseIndices[index] == -1)
+        return;
+
+
+    real neighborXCoord, neighborYCoord, neighborZCoord;
+    this->getNeighborCoords(neighborXCoord, neighborYCoord, neighborZCoord, x, y, z);
+    const int neighborX = getSparseIndex(neighborXCoord, y, z);
+    const int neighborY = getSparseIndex(x, neighborYCoord, z);
+    const int neighborZ = getSparseIndex(x, y, neighborZCoord);
+
+    this->getNegativeNeighborCoords(neighborXCoord, neighborYCoord, neighborZCoord, x, y, z);
+    const int neighborNegative = getSparseIndex(neighborXCoord, neighborYCoord, neighborZCoord);
+
+    this->neighborIndexX[index]        = neighborX;
+    this->neighborIndexY[index]        = neighborY;
+    this->neighborIndexZ[index]        = neighborZ;
+    this->neighborIndexNegative[index] = neighborNegative;
+}
+
+void GridImp::setStopperNeighborCoords(uint index)
+{
+    real x, y, z;
+    this->transIndexToCoords(index, x, y, z);
+
+    if (vf::Math::lessEqual(x + delta, endX) && !this->field.isInvalidOutOfGrid(this->transCoordToIndex(x + delta, y, z)))
+        neighborIndexX[index] = getSparseIndex(x + delta, y, z);
+
+    if (vf::Math::lessEqual(y + delta, endY) && !this->field.isInvalidOutOfGrid(this->transCoordToIndex(x, y + delta, z)))
+        neighborIndexY[index] = getSparseIndex(x, y + delta, z);
+
+    if (vf::Math::lessEqual(z + delta, endZ) && !this->field.isInvalidOutOfGrid(this->transCoordToIndex(x, y, z + delta)))
+        neighborIndexZ[index] = getSparseIndex(x, y, z + delta);
+
+    if (vf::Math::greaterEqual(x - delta, endX) && 
+        vf::Math::greaterEqual(y - delta, endY) && 
+        vf::Math::greaterEqual(z - delta, endZ) && 
+        !this->field.isInvalidOutOfGrid(this->transCoordToIndex(x - delta, y - delta, z - delta)))
+    {
+        neighborIndexNegative[index] = getSparseIndex(x - delta, y - delta, z - delta);
+    }
+}
+
+void GridImp::getNeighborCoords(real &neighborX, real &neighborY, real &neighborZ, real x, real y, real z) const
+{
+    real coords[3] = { x, y, z };
+    neighborX = getNeighborCoord(periodicityX, startX, coords, 0);
+    neighborY = getNeighborCoord(periodicityY, startY, coords, 1);
+    neighborZ = getNeighborCoord(periodicityZ, startZ, coords, 2);
+}
+
+real GridImp::getNeighborCoord(bool periodicity, real startCoord, real coords[3], int direction) const
+{
+    if (periodicity)
+    {
+        real neighborCoords[3] = {coords[0], coords[1] , coords[2] };
+        neighborCoords[direction] = neighborCoords[direction] + delta;
+        const int neighborIndex = this->transCoordToIndex(neighborCoords[0], neighborCoords[1], neighborCoords[2]);
+
+        //////////////////////////////////////////////////////////////////////////
+
+        if( field.is(neighborIndex, STOPPER_OUT_OF_GRID_BOUNDARY) )
+            return getFirstFluidNode(coords, direction, startCoord);
+        else
+            return coords[direction] + delta;
+
+    }
+    
+    return coords[direction] + delta;
+}
+
+void GridImp::getNegativeNeighborCoords(real &neighborX, real &neighborY, real &neighborZ, real x, real y, real z) const
+{
+    real coords[3] = { x, y, z };
+
+    neighborX = getNegativeNeighborCoord(periodicityX, endX, coords, 0);
+    neighborY = getNegativeNeighborCoord(periodicityY, endY, coords, 1);
+    neighborZ = getNegativeNeighborCoord(periodicityZ, endZ, coords, 2);
+}
+
+real GridImp::getNegativeNeighborCoord(bool periodicity, real startCoord, real coords[3], int direction) const
+{
+    if (periodicity)
+    {
+        real neighborCoords[3] = {coords[0], coords[1] , coords[2] };
+        neighborCoords[direction] = neighborCoords[direction] - delta;
+        const int neighborIndex = this->transCoordToIndex(neighborCoords[0], neighborCoords[1], neighborCoords[2]);
+
+        if(neighborIndex != INVALID_INDEX && !field.isStopperOutOfGrid(neighborIndex) && !field.is(neighborIndex, STOPPER_OUT_OF_GRID_BOUNDARY) )
+            return coords[direction] - delta;
+
+        return getLastFluidNode(coords, direction, startCoord);
+    }
+    
+    return coords[direction] - delta;
+}
+
+
+real GridImp::getLastFluidNode(real coords[3], int direction, real startCoord) const
+{
+    coords[direction] = startCoord;
+    int index = this->transCoordToIndex(coords[0], coords[1], coords[2]);
+    while (index != INVALID_INDEX && !field.isFluid(index))
+    {
+        coords[direction] -= delta;
+        index = this->transCoordToIndex(coords[0], coords[1], coords[2]);
+    }
+    return coords[direction];
+}
+
+real GridImp::getFirstFluidNode(real coords[3], int direction, real startCoord) const
+{
+    coords[direction] = startCoord;
+    uint index = this->transCoordToIndex(coords[0], coords[1], coords[2]);
+    while (!field.isFluid(index))
+    {
+        coords[direction] += delta;
+        index = this->transCoordToIndex(coords[0], coords[1], coords[2]);
+    }
+    return coords[direction];
+}
+
+
+int GridImp::getSparseIndex(const real &x, const real &y, const real &z) const
+{
+    const int matrixIndex = transCoordToIndex(x, y, z);
+    return sparseIndices[matrixIndex];
+}
+
+// --------------------------------------------------------- //
+//                        Getter                             //
+// --------------------------------------------------------- //
+int GridImp::getSparseIndex(uint matrixIndex) const
+{
+    return this->sparseIndices[matrixIndex];
+}
+
+real* GridImp::getDistribution() const
+{
+    return this->distribution.f;
+}
+
+int* GridImp::getDirection() const
+{
+    return this->distribution.dirs;
+}
+
+int GridImp::getStartDirection() const
+{
+    return this->distribution.dir_start;
+}
+
+int GridImp::getEndDirection() const
+{
+    return this->distribution.dir_end;
+}
+
+uint GridImp::getXIndex(real x) const
+{
+    return lround((x - startX) / delta);
+}
+
+uint GridImp::getYIndex(real y) const
+{
+    return lround((y - startY) / delta);
+}
+
+uint GridImp::getZIndex(real z) const
+{
+	return lround((z - startZ) / delta);
+}
+
+real GridImp::getDelta() const
+{
+    return delta;
+}
+
+uint GridImp::getSize() const
+{
+    return this->size;
+}
+
+uint GridImp::getSparseSize() const
+{
+    return this->sparseSize;
+}
+
+Field GridImp::getField() const
+{
+    return this->field;
+}
+
+char GridImp::getFieldEntry(uint index) const
+{
+    return this->field.getFieldEntry(index);
+}
+
+void GridImp::setFieldEntry(uint matrixIndex, char type)
+{
+    this->field.setFieldEntry(matrixIndex, type);
+}
+
+
+real GridImp::getStartX() const
+{
+    return startX;
+}
+
+real GridImp::getStartY() const
+{
+    return startY;
+}
+
+real GridImp::getStartZ() const
+{
+    return startZ;
+}
+
+real GridImp::getEndX() const
+{
+    return endX;
+}
+
+real GridImp::getEndY() const
+{
+    return endY;
+}
+
+real GridImp::getEndZ() const
+{
+    return endZ;
+}
+
+uint GridImp::getNumberOfNodesX() const
+{
+    return nx;
+}
+
+uint GridImp::getNumberOfNodesY() const
+{
+    return ny;
+}
+
+uint GridImp::getNumberOfNodesZ() const
+{
+    return nz;
+}
+
+SPtr<GridStrategy> GridImp::getGridStrategy() const
+{
+    return gridStrategy;
+}
+
+
+int* GridImp::getNeighborsX() const
+{
+    return this->neighborIndexX;
+}
+
+int* GridImp::getNeighborsY() const
+{
+    return this->neighborIndexY;
+}
+
+int* GridImp::getNeighborsZ() const
+{
+    return this->neighborIndexZ;
+}
+
+int* GridImp::getNeighborsNegative() const
+{
+    return this->neighborIndexNegative;
+}
+
+#define GEOFLUID 19
+#define GEOSOLID 16
+
+void GridImp::getNodeValues(real *xCoords, real *yCoords, real *zCoords, uint *neighborX, uint *neighborY, uint *neighborZ, uint *neighborNegative, uint *geo) const
+{
+    xCoords[0] = 0;
+    yCoords[0] = 0;
+    zCoords[0] = 0;
+    neighborX[0] = 0;
+    neighborY[0] = 0;
+    neighborZ[0] = 0;
+    geo[0] = GEOSOLID;
+
+    int nodeNumber = 0;
+    for (uint i = 0; i < this->getSize(); i++)
+    {
+        if (this->sparseIndices[i] == -1)
+            continue;
+
+        real x, y, z;
+        this->transIndexToCoords(i, x, y, z);
+
+        // + 1 for numbering shift between GridGenerator and VF_GPU
+        const uint neighborXIndex        = uint(this->neighborIndexX[i] + 1);
+        const uint neighborYIndex        = uint(this->neighborIndexY[i] + 1);
+        const uint neighborZIndex        = uint(this->neighborIndexZ[i] + 1);
+        const uint neighborNegativeIndex = uint(this->neighborIndexNegative[i] + 1);
+
+        const char type2 = this->field.getFieldEntry(i);
+
+        const uint type = uint(this->field.isFluid(i) ? GEOFLUID : GEOSOLID);
+
+        xCoords[nodeNumber + 1] = x;
+        yCoords[nodeNumber + 1] = y;
+        zCoords[nodeNumber + 1] = z;
+
+        neighborX       [nodeNumber + 1] = neighborXIndex;
+        neighborY       [nodeNumber + 1] = neighborYIndex;
+        neighborZ       [nodeNumber + 1] = neighborZIndex;
+        neighborNegative[nodeNumber + 1] = neighborNegativeIndex;
+
+        geo[nodeNumber + 1] = type;
+        nodeNumber++;
+    }
+}
diff --git a/src/GridGenerator/grid/GridImp.h b/src/GridGenerator/grid/GridImp.h
new file mode 100644
index 0000000000000000000000000000000000000000..2c2866492d89808d995cbb32113d24b7982e402a
--- /dev/null
+++ b/src/GridGenerator/grid/GridImp.h
@@ -0,0 +1,204 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 GridImp.h
+//! \ingroup grid
+//! \author Soeren Peters, Stephan Lenz
+//=======================================================================================
+#ifndef GRID_IMP_H
+#define GRID_IMP_H
+
+#include <array>
+
+#include "Core/LbmOrGks.h"
+
+#include "global.h"
+
+#include "grid/distributions/Distribution.h"
+#include "grid/Grid.h"
+#include "grid/Cell.h"
+#include "grid/Field.h" 
+
+struct Vertex;
+class GridStrategy;
+class Object;
+class BoundingBox;
+
+extern int DIRECTIONS[DIR_END_MAX][DIMENSION];
+
+class VF_PUBLIC GridImp : public enableSharedFromThis<GridImp>, public Grid
+{
+private:
+    GridImp();
+    GridImp(Object* object, real startX, real startY, real startZ, real endX, real endY, real endZ, real delta, SPtr<GridStrategy> gridStrategy, Distribution d, uint level);
+
+public:
+    virtual ~GridImp();
+    static SPtr<GridImp> makeShared(Object* object, real startX, real startY, real startZ, real endX, real endY, real endZ, real delta, SPtr<GridStrategy> gridStrategy, Distribution d, uint level);
+
+private:
+    void initalNumberOfNodesAndSize();
+    bool isValidSolidStopper(uint index) const;
+	bool shouldBeBoundarySolidNode(uint index) const;
+	bool isValidEndOfGridStopper(uint index) const;
+    bool isValidEndOfGridBoundaryStopper(uint index) const;
+    bool isOutSideOfGrid(Cell &cell) const;
+    bool contains(Cell &cell, char type) const;
+    void setNodeTo(Cell &cell, char type);
+
+    bool nodeInPreviousCellIs(int index, char type) const;
+    bool nodeInCellIs(Cell& cell, char type) const override;
+
+    uint getXIndex(real x) const;
+    uint getYIndex(real y) const;
+    uint getZIndex(real z) const;
+
+    uint level;
+
+    real startX = 0.0, startY = 0.0, startZ = 0.0;
+    real endX, endY, endZ;
+    real delta = 1.0;
+
+    bool xOddStart = false, yOddStart = false, zOddStart = false;
+
+	uint nx, ny, nz;
+
+	uint size;
+    uint sparseSize;
+    bool periodicityX = false, periodicityY = false, periodicityZ = false;
+
+    Field field;
+    Object* object;
+
+    int *neighborIndexX, *neighborIndexY, *neighborIndexZ, *neighborIndexNegative;
+    int *sparseIndices;
+
+	uint *qIndices;     //maps from matrix index to qIndex
+	real *qValues;
+    uint *qPatches;
+
+    SPtr<GridStrategy> gridStrategy;
+
+public:
+    void inital(const SPtr<Grid> fineGrid, uint numberOfLayers) override;
+
+    void setPeriodicity(bool periodicityX, bool periodicityY, bool periodicityZ) override;
+    void setPeriodicityX(bool periodicity) override;
+    void setPeriodicityY(bool periodicity) override;
+    void setPeriodicityZ(bool periodicity) override;
+
+    bool getPeriodicityX() override;
+    bool getPeriodicityY() override;
+    bool getPeriodicityZ() override;
+
+    void setCellTo(uint index, char type);
+    void setNonStopperOutOfGridCellTo(uint index, char type);
+
+    uint transCoordToIndex(const real &x, const real &y, const real &z) const override;
+    void transIndexToCoords(uint index, real &x, real &y, real &z) const override;
+
+    void freeMemory() override;
+
+    uint getLevel(real levelNull) const;
+    uint getLevel() const;
+
+public:
+    Distribution distribution;
+
+    void initalNodeToOutOfGrid(uint index);
+
+    void findInnerNode(uint index);
+
+	void findEndOfGridStopperNode(uint index);
+
+    void setNodeTo(uint index, char type);
+    bool isNode(uint index, char type) const;
+    bool nodeInNextCellIs(int index, char type) const;
+    bool hasAllNeighbors(uint index) const;
+    bool hasNeighborOfType(uint index, char type)const;
+    bool cellContainsOnly(Cell &cell, char type) const;
+    bool cellContainsOnly(Cell &cell, char typeA, char typeB) const;
+
+    const Object* getObject() const override;
+
+    Field getField() const;
+    char getFieldEntry(uint index) const override;
+    void setFieldEntry(uint matrixIndex, char type) override;
+
+
+    real getDelta() const override;
+    uint getSize() const override;
+    uint getSparseSize() const override;
+    int getSparseIndex(uint matrixIndex) const override;
+    real* getDistribution() const override;
+    int* getDirection() const override;
+    int getStartDirection() const override;
+    int getEndDirection() const override;
+
+    real getStartX() const override;
+    real getStartY() const override;
+    real getStartZ() const override;
+    real getEndX() const override;
+    real getEndY() const override;
+    real getEndZ() const override;
+    uint getNumberOfNodesX() const override;
+    uint getNumberOfNodesY() const override;
+    uint getNumberOfNodesZ() const override;
+    void getNodeValues(real *xCoords, real *yCoords, real *zCoords, uint *neighborX, uint *neighborY, uint *neighborZ, uint *neighborNegative, uint *geo) const override;
+
+    int* getNeighborsX() const override;
+    int* getNeighborsY() const override;
+    int* getNeighborsZ() const override;
+    int* getNeighborsNegative() const override;
+
+    SPtr<GridStrategy> getGridStrategy() const override;
+
+
+public:
+    virtual void findSparseIndices(SPtr<Grid> fineGrid);
+
+    void updateSparseIndices();
+    void setNeighborIndices(uint index);
+    real getFirstFluidNode(real coords[3], int direction, real startCoord) const;
+    real getLastFluidNode(real coords[3], int direction, real startCoord) const;
+private:
+    void setStopperNeighborCoords(uint index);
+    void getNeighborCoords(real &neighborX, real &neighborY, real &neighborZ, real x, real y, real z) const;
+    real getNeighborCoord(bool periodicity, real endCoord, real coords[3], int direction) const;
+    void getNegativeNeighborCoords(real &neighborX, real &neighborY, real &neighborZ, real x, real y, real z) const;
+    real getNegativeNeighborCoord(bool periodicity, real endCoord, real coords[3], int direction) const;
+    
+
+    int getSparseIndex(const real &expectedX, const real &expectedY, const real &expectedZ) const;
+
+private:
+    friend class GridGpuStrategy;
+    friend class GridCpuStrategy;
+};
+
+#endif
diff --git a/src/GridGenerator/grid/GridStrategy/GridCpuStrategy/GridCpuStrategy.cpp b/src/GridGenerator/grid/GridStrategy/GridCpuStrategy/GridCpuStrategy.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..695e1cf21cabb0644634e7aadfa32b569ef36dff
--- /dev/null
+++ b/src/GridGenerator/grid/GridStrategy/GridCpuStrategy/GridCpuStrategy.cpp
@@ -0,0 +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 GridCpuStrategy.cpp
+//! \ingroup grid
+//! \author Soeren Peters, Stephan Lenz
+//=======================================================================================
+#include "GridCpuStrategy.h"
+
+#include <time.h>
+#include <stdio.h>
+#include <omp.h>
+#include <vector>
+#include <iostream>
+
+#include "grid/distributions/Distribution.h"
+#include "grid/GridImp.h"
+#include "grid/NodeValues.h"
+
+void GridCpuStrategy::allocateGridMemory(SPtr<GridImp> grid)
+{
+    grid->neighborIndexX        = new int[grid->size];
+    grid->neighborIndexY        = new int[grid->size];
+    grid->neighborIndexZ        = new int[grid->size];
+    grid->neighborIndexNegative = new int[grid->size];
+
+    grid->sparseIndices = new int[grid->size];
+
+	grid->qIndices = new uint[grid->size];
+	for (size_t i = 0; i < grid->size; i++) 
+		grid->qIndices[i] = INVALID_INDEX;
+}
+
+void GridCpuStrategy::initalNodesToOutOfGrid(SPtr<GridImp> grid)
+{
+#pragma omp parallel for
+    for (int index = 0; index < grid->size; index++)
+        grid->initalNodeToOutOfGrid(index);
+}
+
+void GridCpuStrategy::allocateFieldMemory(Field* field)
+{
+    field->field = new char[field->size];
+}
+
+
+void GridCpuStrategy::findInnerNodes(SPtr<GridImp> grid)
+{
+#pragma omp parallel for
+    for (int index = 0; index < grid->size; index++)
+        grid->findInnerNode(index);
+}
+
+void GridCpuStrategy::findEndOfGridStopperNodes(SPtr<GridImp> grid)
+{
+#pragma omp parallel for
+	for (int index = 0; index < grid->size; index++)
+		grid->findEndOfGridStopperNode(index);
+}
+
+void GridCpuStrategy::findSparseIndices(SPtr<GridImp> coarseGrid, SPtr<GridImp> fineGrid)
+{
+    *logging::out << logging::Logger::INFO_INTERMEDIATE << "Find sparse indices...";
+
+    coarseGrid->updateSparseIndices();
+    findForNeighborsNewIndices(coarseGrid);
+    if (fineGrid)
+    {
+        fineGrid->updateSparseIndices();
+    }
+
+    const uint newGridSize = coarseGrid->getSparseSize();
+    *logging::out << logging::Logger::INFO_INTERMEDIATE << "... done. new size: " << newGridSize << ", delete nodes:" << coarseGrid->getSize() - newGridSize << "\n";
+}
+
+
+void GridCpuStrategy::findForNeighborsNewIndices(SPtr<GridImp> grid)
+{
+#pragma omp parallel for
+    for (int index = 0; index < grid->getSize(); index++)
+        grid->setNeighborIndices(index);
+}
+
+void GridCpuStrategy::freeFieldMemory(Field* field)
+{
+    delete[] field->field;
+}
+
+void GridCpuStrategy::freeMemory(SPtr<GridImp> grid)
+{
+    if( grid->neighborIndexX        != nullptr ) { delete[] grid->neighborIndexX;        grid->neighborIndexX        = nullptr; }
+    if( grid->neighborIndexY        != nullptr ) { delete[] grid->neighborIndexY;        grid->neighborIndexY        = nullptr; }
+    if( grid->neighborIndexZ        != nullptr ) { delete[] grid->neighborIndexZ;        grid->neighborIndexZ        = nullptr; }
+    if( grid->neighborIndexNegative != nullptr ) { delete[] grid->neighborIndexNegative; grid->neighborIndexNegative = nullptr; }
+    if( grid->sparseIndices         != nullptr ) { delete[] grid->sparseIndices;         grid->sparseIndices         = nullptr; }
+	if( grid->qIndices              != nullptr ) { delete[] grid->qIndices;              grid->qIndices              = nullptr; }
+	if( grid->qValues               != nullptr ) { delete[] grid->qValues;               grid->qValues               = nullptr; }
+	if( grid->qPatches              != nullptr ) { delete[] grid->qPatches;              grid->qPatches              = nullptr; }
+}
+
diff --git a/src/GridGenerator/grid/GridStrategy/GridCpuStrategy/GridCpuStrategy.h b/src/GridGenerator/grid/GridStrategy/GridCpuStrategy/GridCpuStrategy.h
new file mode 100644
index 0000000000000000000000000000000000000000..46afe0ba876f5963bfc3097287719bc5ef36f3d7
--- /dev/null
+++ b/src/GridGenerator/grid/GridStrategy/GridCpuStrategy/GridCpuStrategy.h
@@ -0,0 +1,69 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 GridCpuStrategy.h
+//! \ingroup grid
+//! \author Soeren Peters, Stephan Lenz
+//=======================================================================================
+#ifndef GRID_CPU_STRATEGY_H
+#define GRID_CPU_STRATEGY_H
+
+#include "global.h"
+
+#include "grid/GridStrategy/GridStrategy.h"
+
+class GridImp;
+class TriangularMesh;
+
+class VF_PUBLIC GridCpuStrategy : public GridStrategy
+{
+public:
+    virtual ~GridCpuStrategy() {};
+
+    void allocateGridMemory(SPtr<GridImp> grid) override;
+
+    void initalNodesToOutOfGrid(SPtr<GridImp> grid) override;
+    void findInnerNodes(SPtr<GridImp> grid) override;
+	void findEndOfGridStopperNodes(SPtr<GridImp> grid) override;
+
+    void freeMemory(SPtr<GridImp> grid) override;
+
+
+
+    virtual void copyDataFromGPU() {};
+
+protected:
+    static void findForNeighborsNewIndices(SPtr<GridImp> grid);
+public:
+    void allocateFieldMemory(Field* field) override;
+    void freeFieldMemory(Field* field) override;
+    void findSparseIndices(SPtr<GridImp> coarseGrid, SPtr<GridImp> fineGrid) override;
+
+};
+
+#endif
\ No newline at end of file
diff --git a/src/GridGenerator/grid/GridStrategy/GridCpuStrategy/package.include b/src/GridGenerator/grid/GridStrategy/GridCpuStrategy/package.include
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/src/GridGenerator/grid/GridStrategy/GridStrategy.h b/src/GridGenerator/grid/GridStrategy/GridStrategy.h
new file mode 100644
index 0000000000000000000000000000000000000000..f8c087c1a578fea508bdff7c6d8f5a3c3f2c7579
--- /dev/null
+++ b/src/GridGenerator/grid/GridStrategy/GridStrategy.h
@@ -0,0 +1,67 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 GridStrategy.h
+//! \ingroup grid
+//! \author Soeren Peters, Stephan Lenz
+//=======================================================================================
+#ifndef GRID_STRATEGY_H
+#define GRID_STRATEGY_H
+
+#include "Core/LbmOrGks.h"
+
+#include "global.h"
+
+#include "grid/Field.h"
+
+struct Vertex;
+class GridImp;
+
+class VF_PUBLIC GridStrategy
+{
+public:
+    virtual ~GridStrategy() {}
+
+    virtual void allocateFieldMemory(Field* field) = 0;
+    virtual void freeFieldMemory(Field* field) = 0;
+
+    virtual void allocateGridMemory(SPtr<GridImp> grid) = 0;
+
+    virtual void initalNodesToOutOfGrid(SPtr<GridImp> grid) = 0;
+    virtual void findInnerNodes(SPtr<GridImp> grid) = 0;
+
+	virtual void findEndOfGridStopperNodes(SPtr<GridImp> grid) = 0;
+
+    virtual void findSparseIndices(SPtr<GridImp> coarseGrid, SPtr<GridImp> fineGrid) = 0;
+
+
+    virtual void freeMemory(SPtr<GridImp> grid) = 0;
+
+};
+
+#endif
diff --git a/src/GridGenerator/grid/GridStrategy/package.include b/src/GridGenerator/grid/GridStrategy/package.include
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/src/GridGenerator/grid/NodeValues.h b/src/GridGenerator/grid/NodeValues.h
new file mode 100644
index 0000000000000000000000000000000000000000..c083252e5fe3ea0b34ff09e3b626350ce425d9b8
--- /dev/null
+++ b/src/GridGenerator/grid/NodeValues.h
@@ -0,0 +1,66 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 NodeValues.h
+//! \ingroup grid
+//! \author Soeren Peters, Stephan Lenz
+//=======================================================================================
+#ifndef NodeValues_H
+#define NodeValues_H
+
+#define FLUID 0
+
+#define FLUID_CFC 1
+#define FLUID_CFF 2
+
+#define FLUID_FCC 3
+#define FLUID_FCF 4
+
+#define MULTI_GPU_SEND 10
+#define MULTI_GPU_RECIEVE 11
+
+#define BC_PRESSURE 20
+#define BC_VELOCITY 21
+#define BC_SOLID 22
+
+#define BC_SLIP 23
+#define BC_NOSLIP 24
+#define BC_OUTFLOW 25
+
+#define STOPPER_OUT_OF_GRID 30
+#define STOPPER_COARSE_UNDER_FINE 31
+#define STOPPER_SOLID 32
+#define STOPPER_OUT_OF_GRID_BOUNDARY 33
+
+#define INVALID_OUT_OF_GRID 40
+#define INVALID_COARSE_UNDER_FINE 41
+#define INVALID_SOLID 42
+
+#define OVERLAP_TMP 60
+
+#endif
diff --git a/src/GridGenerator/grid/distributions/D3Q27.h b/src/GridGenerator/grid/distributions/D3Q27.h
new file mode 100644
index 0000000000000000000000000000000000000000..555fb457c4ea36ee6bdf3e0ea2cc867e4ed13d21
--- /dev/null
+++ b/src/GridGenerator/grid/distributions/D3Q27.h
@@ -0,0 +1,179 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 D3Q27.h
+//! \ingroup grid
+//! \author Soeren Peters, Stephan Lenz
+//=======================================================================================
+#ifndef D3Q27_H_
+#define D3Q27_H_
+
+#define DIR_27_E    0
+#define DIR_27_W    1
+#define DIR_27_N    2
+#define DIR_27_S    3
+#define DIR_27_T    4
+#define DIR_27_B    5
+
+#define DIR_27_NE   6
+#define DIR_27_SW   7
+#define DIR_27_SE   8
+#define DIR_27_NW   9
+#define DIR_27_TE   10
+#define DIR_27_BW   11
+#define DIR_27_BE   12
+#define DIR_27_TW   13
+#define DIR_27_TN   14
+#define DIR_27_BS   15
+#define DIR_27_BN   16
+#define DIR_27_TS   17
+#define DIR_27_ZERO 18
+
+#define DIR_27_TNE  19
+#define DIR_27_BNE  20
+#define DIR_27_TSE  21
+#define DIR_27_BSE  22
+
+#define DIR_27_TNW  23
+#define DIR_27_BNW  24
+#define DIR_27_TSW  25
+#define DIR_27_BSW  26
+
+#define DIR_27_START  0
+#define DIR_27_END   26
+
+
+#define DIR_27_E_X  1
+#define DIR_27_E_Y  0
+#define DIR_27_E_Z  0
+
+#define DIR_27_W_X  -1
+#define DIR_27_W_Y  0
+#define DIR_27_W_Z  0
+
+#define DIR_27_N_X  0
+#define DIR_27_N_Y  1
+#define DIR_27_N_Z  0
+
+#define DIR_27_S_X  0
+#define DIR_27_S_Y  -1
+#define DIR_27_S_Z  0
+
+#define DIR_27_T_X  0
+#define DIR_27_T_Y  0
+#define DIR_27_T_Z  1
+
+#define DIR_27_B_X  0
+#define DIR_27_B_Y  0
+#define DIR_27_B_Z  -1
+
+
+#define DIR_27_NE_X  1
+#define DIR_27_NE_Y  1
+#define DIR_27_NE_Z  0
+
+#define DIR_27_SW_X  -1
+#define DIR_27_SW_Y  -1
+#define DIR_27_SW_Z  0
+
+#define DIR_27_SE_X  1
+#define DIR_27_SE_Y  -1
+#define DIR_27_SE_Z  0
+
+#define DIR_27_NW_X  -1
+#define DIR_27_NW_Y  1
+#define DIR_27_NW_Z  0
+
+#define DIR_27_TE_X  1
+#define DIR_27_TE_Y  0
+#define DIR_27_TE_Z  1
+
+#define DIR_27_BW_X  -1
+#define DIR_27_BW_Y  0
+#define DIR_27_BW_Z  -1
+
+#define DIR_27_BE_X  1
+#define DIR_27_BE_Y  0
+#define DIR_27_BE_Z  -1
+
+#define DIR_27_TW_X  -1
+#define DIR_27_TW_Y  0
+#define DIR_27_TW_Z  1
+
+#define DIR_27_TN_X  0
+#define DIR_27_TN_Y  1
+#define DIR_27_TN_Z  1
+
+#define DIR_27_BS_X  0
+#define DIR_27_BS_Y  -1
+#define DIR_27_BS_Z  -1
+
+#define DIR_27_BN_X  0
+#define DIR_27_BN_Y  1
+#define DIR_27_BN_Z  -1
+
+#define DIR_27_TS_X  0
+#define DIR_27_TS_Y  -1
+#define DIR_27_TS_Z  1
+
+
+
+#define DIR_27_TNE_X  1
+#define DIR_27_TNE_Y  1
+#define DIR_27_TNE_Z  1
+
+#define DIR_27_BNE_X  1
+#define DIR_27_BNE_Y  1
+#define DIR_27_BNE_Z  -1
+
+#define DIR_27_TSE_X  1
+#define DIR_27_TSE_Y  -1
+#define DIR_27_TSE_Z  1
+
+#define DIR_27_BSE_X  1
+#define DIR_27_BSE_Y  -1
+#define DIR_27_BSE_Z  -1
+
+
+#define DIR_27_TNW_X  -1
+#define DIR_27_TNW_Y  1
+#define DIR_27_TNW_Z  1
+
+#define DIR_27_BNW_X  -1
+#define DIR_27_BNW_Y  1
+#define DIR_27_BNW_Z  -1
+
+#define DIR_27_TSW_X  -1
+#define DIR_27_TSW_Y  -1
+#define DIR_27_TSW_Z  1
+
+#define DIR_27_BSW_X  -1
+#define DIR_27_BSW_Y  -1
+#define DIR_27_BSW_Z  -1
+
+#endif
diff --git a/src/GridGenerator/grid/distributions/Distribution.cpp b/src/GridGenerator/grid/distributions/Distribution.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..7a389d4b374a9bfe6068d19fb5e2f082007ade07
--- /dev/null
+++ b/src/GridGenerator/grid/distributions/Distribution.cpp
@@ -0,0 +1,273 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 Distribution.cpp
+//! \ingroup grid
+//! \author Soeren Peters, Stephan Lenz
+//=======================================================================================
+#include "Distribution.h"
+
+#include <stdio.h>
+
+#include "grid/distributions/D3Q27.h"
+
+#include "grid/Grid.h"
+
+Distribution DistributionHelper::getDistribution27() 
+{
+    Distribution d27;
+    d27.name = "D3Q27";
+    d27.dir_start = DIR_27_START;
+    d27.dir_end = DIR_27_END;
+
+    d27.dirs = new int[(DIR_27_END + 1) * DIMENSION];
+
+    d27.directions = new Direction[DIR_27_END + 1];
+    d27.directions[0] = Direction(DIR_27_E_X, DIR_27_E_Y, DIR_27_E_Z);
+    d27.directions[1] = Direction(DIR_27_W_X, DIR_27_W_Y, DIR_27_W_Z);
+    d27.directions[2] = Direction(DIR_27_N_X, DIR_27_N_Y, DIR_27_N_Z);
+    d27.directions[3] = Direction(DIR_27_S_X, DIR_27_S_Y, DIR_27_S_Z);
+
+    d27.directions[4] = Direction(DIR_27_T_X, DIR_27_T_Y, DIR_27_T_Z);
+    d27.directions[5] = Direction(DIR_27_B_X, DIR_27_B_Y, DIR_27_B_Z);
+
+    d27.directions[6] = Direction(DIR_27_NE_X, DIR_27_NE_Y, DIR_27_NE_Z);
+    d27.directions[7] = Direction(DIR_27_SW_X, DIR_27_SW_Y, DIR_27_SW_Z);
+    d27.directions[8] = Direction(DIR_27_SE_X, DIR_27_SE_Y, DIR_27_SE_Z);
+    d27.directions[9] = Direction(DIR_27_NW_X, DIR_27_NW_Y, DIR_27_NW_Z);
+
+    d27.directions[10] = Direction(DIR_27_TE_X, DIR_27_TE_Y, DIR_27_TE_Z);
+    d27.directions[11] = Direction(DIR_27_BW_X, DIR_27_BW_Y, DIR_27_BW_Z);
+    d27.directions[12] = Direction(DIR_27_BE_X, DIR_27_BE_Y, DIR_27_BE_Z);
+    d27.directions[13] = Direction(DIR_27_TW_X, DIR_27_TW_Y, DIR_27_TW_Z);
+
+    d27.directions[14] = Direction(DIR_27_TN_X, DIR_27_TN_Y, DIR_27_TN_Z);
+    d27.directions[15] = Direction(DIR_27_BS_X, DIR_27_BS_Y, DIR_27_BS_Z);
+    d27.directions[16] = Direction(DIR_27_BN_X, DIR_27_BN_Y, DIR_27_BN_Z);
+    d27.directions[17] = Direction(DIR_27_TS_X, DIR_27_TS_Y, DIR_27_TS_Z);
+
+    d27.directions[18] = Direction(0, 0, 0);
+
+    d27.directions[19] = Direction(DIR_27_TNE_X, DIR_27_TNE_Y, DIR_27_TNE_Z);
+    d27.directions[20] = Direction(DIR_27_BNE_X, DIR_27_BNE_Y, DIR_27_BNE_Z);
+
+    d27.directions[21] = Direction(DIR_27_TSE_X, DIR_27_TSE_Y, DIR_27_TSE_Z);
+    d27.directions[22] = Direction(DIR_27_BSE_X, DIR_27_BSE_Y, DIR_27_BSE_Z);
+
+    d27.directions[23] = Direction(DIR_27_TNW_X, DIR_27_TNW_Y, DIR_27_TNW_Z);
+    d27.directions[24] = Direction(DIR_27_BNW_X, DIR_27_BNW_Y, DIR_27_BNW_Z);
+
+    d27.directions[25] = Direction(DIR_27_TSW_X, DIR_27_TSW_Y, DIR_27_TSW_Z);
+    d27.directions[26] = Direction(DIR_27_BSW_X, DIR_27_BSW_Y, DIR_27_BSW_Z);
+
+
+    int dir_num = 0;
+    d27.dirs[dir_num++] = DIR_27_E_X;
+    d27.dirs[dir_num++] = DIR_27_E_Y;
+    d27.dirs[dir_num++] = DIR_27_E_Z;
+
+    d27.dirs[dir_num++] = DIR_27_W_X;
+    d27.dirs[dir_num++] = DIR_27_W_Y;
+    d27.dirs[dir_num++] = DIR_27_W_Z;
+    
+    d27.dirs[dir_num++] = DIR_27_N_X;
+    d27.dirs[dir_num++] = DIR_27_N_Y;
+    d27.dirs[dir_num++] = DIR_27_N_Z;
+    
+    d27.dirs[dir_num++] = DIR_27_S_X;
+    d27.dirs[dir_num++] = DIR_27_S_Y;
+    d27.dirs[dir_num++] = DIR_27_S_Z;
+    
+    d27.dirs[dir_num++] = DIR_27_T_X;
+    d27.dirs[dir_num++] = DIR_27_T_Y;
+    d27.dirs[dir_num++] = DIR_27_T_Z;
+    
+    d27.dirs[dir_num++] = DIR_27_B_X;
+    d27.dirs[dir_num++] = DIR_27_B_Y;
+    d27.dirs[dir_num++] = DIR_27_B_Z;
+    
+    d27.dirs[dir_num++] = DIR_27_NE_X;
+    d27.dirs[dir_num++] = DIR_27_NE_Y;
+    d27.dirs[dir_num++] = DIR_27_NE_Z;
+    
+    d27.dirs[dir_num++] = DIR_27_SW_X;
+    d27.dirs[dir_num++] = DIR_27_SW_Y;
+    d27.dirs[dir_num++] = DIR_27_SW_Z;
+
+    d27.dirs[dir_num++] = DIR_27_SE_X;
+    d27.dirs[dir_num++] = DIR_27_SE_Y;
+    d27.dirs[dir_num++] = DIR_27_SE_Z;
+                              
+    d27.dirs[dir_num++] = DIR_27_NW_X;
+    d27.dirs[dir_num++] = DIR_27_NW_Y;
+    d27.dirs[dir_num++] = DIR_27_NW_Z;
+                              
+    d27.dirs[dir_num++] = DIR_27_TE_X;
+    d27.dirs[dir_num++] = DIR_27_TE_Y;
+    d27.dirs[dir_num++] = DIR_27_TE_Z;
+                              
+    d27.dirs[dir_num++] = DIR_27_BW_X;
+    d27.dirs[dir_num++] = DIR_27_BW_Y;
+    d27.dirs[dir_num++] = DIR_27_BW_Z;
+                              
+    d27.dirs[dir_num++] = DIR_27_BE_X;
+    d27.dirs[dir_num++] = DIR_27_BE_Y;
+    d27.dirs[dir_num++] = DIR_27_BE_Z;
+                              
+    d27.dirs[dir_num++] = DIR_27_TW_X;
+    d27.dirs[dir_num++] = DIR_27_TW_Y;
+    d27.dirs[dir_num++] = DIR_27_TW_Z;
+                              
+    d27.dirs[dir_num++] = DIR_27_TN_X;
+    d27.dirs[dir_num++] = DIR_27_TN_Y;
+    d27.dirs[dir_num++] = DIR_27_TN_Z;
+                              
+    d27.dirs[dir_num++] = DIR_27_BS_X;
+    d27.dirs[dir_num++] = DIR_27_BS_Y;
+    d27.dirs[dir_num++] = DIR_27_BS_Z;
+                              
+    d27.dirs[dir_num++] = DIR_27_BN_X;
+    d27.dirs[dir_num++] = DIR_27_BN_Y;
+    d27.dirs[dir_num++] = DIR_27_BN_Z;
+
+    d27.dirs[dir_num++] = DIR_27_TS_X;
+    d27.dirs[dir_num++] = DIR_27_TS_Y;
+    d27.dirs[dir_num++] = DIR_27_TS_Z;
+
+
+    d27.dirs[dir_num++] = 0;   //
+    d27.dirs[dir_num++] = 0;   //  ZERO ELEMENT
+    d27.dirs[dir_num++] = 0;   //
+
+
+    d27.dirs[dir_num++] = DIR_27_TNE_X;
+    d27.dirs[dir_num++] = DIR_27_TNE_Y;
+    d27.dirs[dir_num++] = DIR_27_TNE_Z;
+
+    d27.dirs[dir_num++] = DIR_27_BNE_X;
+    d27.dirs[dir_num++] = DIR_27_BNE_Y;
+    d27.dirs[dir_num++] = DIR_27_BNE_Z;
+
+    d27.dirs[dir_num++] = DIR_27_TSE_X;
+    d27.dirs[dir_num++] = DIR_27_TSE_Y;
+    d27.dirs[dir_num++] = DIR_27_TSE_Z;
+
+    d27.dirs[dir_num++] = DIR_27_BSE_X;
+    d27.dirs[dir_num++] = DIR_27_BSE_Y;
+    d27.dirs[dir_num++] = DIR_27_BSE_Z;
+
+
+    d27.dirs[dir_num++] = DIR_27_TNW_X;
+    d27.dirs[dir_num++] = DIR_27_TNW_Y;
+    d27.dirs[dir_num++] = DIR_27_TNW_Z;
+
+    d27.dirs[dir_num++] = DIR_27_BNW_X;
+    d27.dirs[dir_num++] = DIR_27_BNW_Y;
+    d27.dirs[dir_num++] = DIR_27_BNW_Z;
+
+    d27.dirs[dir_num++] = DIR_27_TSW_X;
+    d27.dirs[dir_num++] = DIR_27_TSW_Y;
+    d27.dirs[dir_num++] = DIR_27_TSW_Z;
+
+    d27.dirs[dir_num++] = DIR_27_BSW_X;
+    d27.dirs[dir_num++] = DIR_27_BSW_Y;
+    d27.dirs[dir_num++] = DIR_27_BSW_Z;
+
+    return d27;
+}
+
+Distribution DistributionHelper::getDistribution(std::string name)
+{
+    if (name == "D3Q27")
+        return getDistribution27();
+    
+    printf("wrong Distribution name... D3Q27 is chosen!\n");
+    return getDistribution27();
+
+}
+
+std::vector<std::vector<real> > DistributionHelper::getQsWithoutRowsWithOnlyZeroValues(const Grid &grid, const Distribution &d)
+{
+    return getVectorWithoutRowsWithOnlyZeroValues(getAllQsOnFluidNodes(grid, d));
+}
+
+std::vector<std::vector<real> > DistributionHelper::getAllQsOnFluidNodes(const Grid &grid, const Distribution &d)
+{
+    std::vector<std::vector<real> > qs(grid.getSize(), std::vector<real>(d.dir_end + 1, 0));
+    for (unsigned int node = 0; node < grid.getSize(); node++) {
+        qs[node][0] = (real)node;
+        for (int i = d.dir_start; i < d.dir_end; i++) {
+            real qVal = (d.f)[i * grid.getSize() + node];
+            if (qVal == 0.0f)
+                continue;
+            int index_fluidNode = getNeighborNodeIndexInGivenDirection(d, grid, node, i);
+            qs[index_fluidNode][i + 1] = qVal;
+        }
+    }
+    return qs;
+}
+
+int DistributionHelper::getNeighborNodeIndexInGivenDirection(const Distribution &d, const Grid &grid, const int node, const int dir_index)
+{
+    Vertex dir = Vertex((real)d.dirs[dir_index * DIMENSION + 0], (real)d.dirs[dir_index * DIMENSION + 1], (real)d.dirs[dir_index * DIMENSION + 2]);
+    real x, y, z;
+    grid.transIndexToCoords(node, x, y, z);
+    Vertex solid_node = Vertex(x,y,z);
+    Vertex fluid_node = Vertex(solid_node.x - dir.x, solid_node.y - dir.y, solid_node.z - dir.z);
+    return grid.transCoordToIndex(fluid_node.x, fluid_node.y, fluid_node.z);
+}
+
+std::vector<std::vector<real> > DistributionHelper::getVectorWithoutRowsWithOnlyZeroValues(std::vector<std::vector<real> > qs)
+{
+    std::vector<std::vector<real> > qs_ausgeduennt;
+    bool hasQs = false;
+    for (int node = 0; node < qs.size(); node++) {
+        for (int dir = 0; dir < qs[node].size() - 1; dir++) {
+            if (qs[node][dir + 1] != 0)
+                hasQs = true;
+        }
+        if (hasQs) {
+            std::vector<real> qRow(qs[node].begin(), qs[node].end());
+            qs_ausgeduennt.push_back(qRow);
+            hasQs = false;
+        }
+    }
+    return qs_ausgeduennt;
+}
+
+void DistributionHelper::printQs(std::vector<std::vector<real> > qs, int decimalPlaces)
+{
+    for (int node = 0; node < qs.size(); node++) {
+        printf("index %d: ", node);
+        for (int dir = 1; dir < qs[node].size(); dir++) {
+            printf("%d ", (int)qs[node][0]);
+            printf("%.*f ", decimalPlaces, qs[node][dir]);
+        }
+        printf("\n");
+    }
+}
diff --git a/src/GridGenerator/grid/distributions/Distribution.h b/src/GridGenerator/grid/distributions/Distribution.h
new file mode 100644
index 0000000000000000000000000000000000000000..7c2bcd4670772a767952db94aa5143208e103bc5
--- /dev/null
+++ b/src/GridGenerator/grid/distributions/Distribution.h
@@ -0,0 +1,110 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 Distribution.h
+//! \ingroup grid
+//! \author Soeren Peters, Stephan Lenz
+//=======================================================================================
+#ifndef Distribution_H
+#define Distribution_H
+
+#include <vector>
+#include <string>
+
+#include "global.h"
+
+#define DIR_END_MAX 27
+
+
+struct Direction
+{
+    Direction()
+    {
+        dir[0] = 0;
+        dir[1] = 0;
+        dir[2] = 0;
+    }
+
+    Direction(int dx, int dy, int dz)
+    {
+        dir[0] = dx;
+        dir[1] = dy;
+        dir[2] = dz;
+    }
+
+    int operator[](uint dir) const
+    {
+        if (dir < 3)
+            return this->dir[dir];
+        return -99;
+    }
+private:
+    int dir[3];
+};
+
+struct Distribution
+{
+    typedef Direction* iterator;
+    typedef const Direction* const_iterator;
+
+    real* f;
+    int *dirs;
+    Direction* directions;
+    int dir_start;
+    int dir_end;
+    const char* name;
+    unsigned long fSize;
+
+    void setSize(uint size) {
+        fSize = size * (dir_end + 1);
+    }
+
+    iterator begin() { return &directions[0]; }
+    const_iterator begin() const { return &directions[0]; }
+    iterator end() { return &directions[dir_end + 1]; }
+    const_iterator end() const { return &directions[dir_end + 1]; }
+};
+
+class Grid;
+
+class VF_PUBLIC DistributionHelper
+{
+public:
+    static Distribution getDistribution27();
+
+    static Distribution getDistribution(std::string name);
+
+public:
+    static std::vector<std::vector<real> > getQsWithoutRowsWithOnlyZeroValues(const Grid &grid, const Distribution &d);
+    static std::vector<std::vector<real> > getAllQsOnFluidNodes(const Grid &grid, const Distribution &d);
+    static int getNeighborNodeIndexInGivenDirection(const Distribution &d, const Grid &grid, const int node, const int dir_index);
+    static std::vector<std::vector<real> > getVectorWithoutRowsWithOnlyZeroValues(std::vector<std::vector<real> > qs);
+    static void printQs(std::vector<std::vector<real> > qs, int decimalPlaces);
+};
+
+#endif
diff --git a/src/GridGenerator/grid/distributions/package.include b/src/GridGenerator/grid/distributions/package.include
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/src/GridGenerator/grid/package.include b/src/GridGenerator/grid/package.include
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/src/GridGenerator/package.include b/src/GridGenerator/package.include
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/src/GridGenerator/utilities/math/Math.cu b/src/GridGenerator/utilities/math/Math.cu
new file mode 100644
index 0000000000000000000000000000000000000000..6bad635b2874f9d23757faf1d460e31477cf4ba9
--- /dev/null
+++ b/src/GridGenerator/utilities/math/Math.cu
@@ -0,0 +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 Math.cu
+//! \ingroup utilities
+//! \author Soeren Peters, Stephan Lenz
+//=======================================================================================
+#include "Math.h"
+
+#include <cmath>
+
+bool vf::Math::equal(const real& val1, const real& val2, real maxRelDiff)
+{
+	const real diff = std::fabs(val1 - val2);
+	const real val1_abs = std::fabs(val1);
+	const real val2_abs = std::fabs(val2);
+
+	const real largest = (val2_abs > val1_abs) ? val2_abs : val1_abs;
+	if (diff <= largest * maxRelDiff)
+		return true;
+	return false;
+}
+
+bool vf::Math::lessEqual(const real& val1, const real& val2, real maxRelDiff)
+{
+	if (val1 < val2 || equal(val1, val2, maxRelDiff))
+		return true;
+	return false;
+}
+
+bool vf::Math::greaterEqual(const real& val1, const real& val2, real maxRelDiff)
+{
+	if (val1 > val2 || equal(val1, val2, maxRelDiff))
+		return true;
+	return false;
+}
+
+real vf::Math::sqrtReal(const real& val)
+{
+#ifdef VF_DOUBLE_ACCURACY
+    return sqrt(val);
+#else
+    return sqrtf(val);
+#endif
+}
+
+real vf::Math::acosReal(const real& val)
+{
+#ifdef VF_DOUBLE_ACCURACY
+    return acos(val);
+#else
+    return acosf(val);
+#endif
+}
+
+
diff --git a/src/GridGenerator/utilities/math/Math.h b/src/GridGenerator/utilities/math/Math.h
new file mode 100644
index 0000000000000000000000000000000000000000..a241a9798ef1f01aab00d318b96ff0edc1ae6372
--- /dev/null
+++ b/src/GridGenerator/utilities/math/Math.h
@@ -0,0 +1,59 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 Math.h
+//! \ingroup utilities
+//! \author Soeren Peters, Stephan Lenz
+//=======================================================================================
+#ifndef CudaMath_H
+#define CudaMath_H
+
+#include <float.h>
+
+#include "global.h"
+
+#define EPSILON FLT_EPSILON
+
+namespace vf 
+{
+    class VF_PUBLIC Math
+    {
+    public:
+        static bool equal(const real& val1, const real& val2, real maxRelDiff = EPSILON);
+        static bool lessEqual(const real& val1, const real& val2, real maxRelDiff = EPSILON);
+        static bool greaterEqual(const real& val1, const real& val2, real maxRelDiff = EPSILON);
+
+        static real sqrtReal(const real& val);
+        static real acosReal(const real& val);
+
+        static real getDecimalPart(real number) {
+            return number - real(int(number));
+        }
+    };
+}
+#endif
diff --git a/src/GridGenerator/utilities/math/package.include b/src/GridGenerator/utilities/math/package.include
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/src/GridGenerator/utilities/package.include b/src/GridGenerator/utilities/package.include
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/src/VirtualFluidsBasics/basics/container/CbArray2D.h b/src/VirtualFluidsBasics/basics/container/CbArray2D.h
new file mode 100644
index 0000000000000000000000000000000000000000..575ef2f5403ea35a40a4f214b32829e3d7c39efc
--- /dev/null
+++ b/src/VirtualFluidsBasics/basics/container/CbArray2D.h
@@ -0,0 +1,413 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 CbArray2D.h
+//! \ingroup container
+//! \author Soeren Freudiger, Sebastian Geller
+//=======================================================================================
+#ifndef CBARRAY2D_H
+#define CBARRAY2D_H
+
+#include <iomanip>
+
+#include <basics/utilities/UbException.h>
+#include <basics/utilities/UbEqual.h>
+#include <algorithm>
+#include <typeinfo>
+
+//////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////
+// IndexClasses
+
+//IndexerX2X1:
+//        4 5 6
+// Array  1 2 3  -->  vector 1 2 3 4 5 6
+//optimaler schleifendurchlauf
+//for(alle X2)
+//  for(alle X1)
+class IndexerX2X1
+{
+public:
+   typedef int size_type;
+public:
+   inline std::size_t getIndex(const size_type& x1, const size_type& x2, const size_type& nx1, const size_type& nx2) const
+   {
+      return nx1* x2 + x1;
+   }
+   inline std::size_t getStartIndexOfSortedArray(const size_type& x1, const size_type& x2, const size_type& nx1, const size_type& nx2) const
+   {
+      return  nx1* x2;
+   }
+};
+
+//IndexerX1X2:
+//        4 5 6
+// Array  1 2 3  -->  vector 1 4 2 5 3 6
+//optimaler schleifendurchlauf
+//for(alle X1)
+//  for(alle X2)
+class IndexerX1X2
+{
+public:
+   typedef int size_type;
+public:
+   inline std::size_t getIndex(const size_type& x1, const size_type& x2, const size_type& nx1,const size_type& nx2) const
+   {
+      return nx2* x1+ x2;
+   }
+   inline std::size_t getStartIndexOfSortedArray(const size_type& x1, const size_type& x2, const size_type& nx1, const size_type& nx2) const
+   {
+      return  nx2* x1;
+   }
+};
+
+
+//////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////
+// CbArray2D
+//////////////////////////////////////////////////////////////////////////
+//! \brief 2D Array
+//! \details the data is stored in a vector
+//!
+//! Rangecheck active, if:
+//!
+//! -debug  : not defined "NO_CB_RANGECHECK"
+//!
+//! -release: not defined "NO_CB_RANGECHECK" && defined "CB_RANGECHECK"
+//////////////////////////////////////////////////////////////////////////
+template<typename T, typename IndexClass = IndexerX2X1>
+class CbArray2D
+{
+public:
+   typedef T                                                   value_type;
+   typedef IndexClass                                          indexer_type;
+   typedef typename IndexClass::size_type                      size_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;
+
+private:
+   template< typename value_type2, typename IndexClass2 > friend class CbArray2D;
+
+public:
+   /*=======================================================================*/
+   CbArray2D()
+   {
+      this->resize(0,0);
+   }
+   /*=======================================================================*/
+   CbArray2D(const size_type& nx2, const size_type& nx1)
+   {
+      this->resize(nx2,nx1);
+   }
+   /*=======================================================================*/
+   CbArray2D(const size_type& nx2, const size_type& nx1, const value_type& val)
+   {
+      this->resize(nx2,nx1,val);
+   }
+   /*=======================================================================*/
+   CbArray2D(const size_type& uniformDimensionSize /*nx1==nx2*/)
+   {
+      this->resize(uniformDimensionSize,uniformDimensionSize);
+   }
+   /*=======================================================================*/
+   //übernimmt vector als daten vector! (erstellt KEINE kopie!!!, vec ist anschließend leer, da swap verwendet wird)
+   CbArray2D(std::vector<value_type>& vec, const size_type& nx1,const size_type& nx2)
+   {
+      assert( (nx1*nx2)==vec.size() );
+      this->data.swap(vec);
+      this->resize(nx1,nx2);
+   }
+   /*=======================================================================*/
+   CbArray2D(const CbArray2D& src)
+      :  nx1(src.nx1)
+       , nx2(src.nx2)
+       , data(src.data)
+   {
+   }
+   /*=======================================================================*/
+   template< typename value_type2 >
+   CbArray2D(const CbArray2D< value_type2 >& src)
+      :  nx1(src.nx1)
+       , nx2(src.nx2)
+   {
+      //Sourcedaten kopieren
+      this->data.resize( src.data.size() );
+      for(std::size_t i=0; i<data.size(); ++i)
+         this->data[i] = src.data[i];
+   }
+   /*=======================================================================*/
+   virtual ~CbArray2D()
+   {
+      //vector wird automatisch zerstoert
+   }
+   /*=======================================================================*/
+   CbArray2D& operator= (const CbArray2D& rhs)
+   {
+      if(this == &rhs) return *this;
+
+      this->nx1 = rhs.nx1;
+      this->nx2 = rhs.nx2;
+
+      //Laenge anpassen
+      this->data.resize(rhs.data.size());
+      //gespeicherte Datenelemente loeschen
+      this->data.clear();
+
+      //Sourcedaten kopieren
+      this->data  = rhs.data;
+
+      return *this;
+   }
+   /*=======================================================================*/
+   //durch value_type2 kann man z.B. ein float array einem double array zuweisen!
+   template< typename value_type2, typename IndexClass2 >
+   CbArray2D& operator= (const CbArray2D< value_type2, IndexClass2 >& rhs)
+   {
+      this->nx1 = rhs.nx1;
+      this->nx2 = rhs.nx2;
+
+      //gespeicherte Datenelemente loeschen
+      this->data.clear();
+      //Laenge anpassen
+      this->data.resize(rhs.data.size());
+
+      //Sourcedaten kopieren (!! koennte anderen Indexer besitzen!!! -> operator() benutzen)
+      //ACHTUNG: für diese Konvertierung muss bei Klassen der demenstrechende operator
+      //         implementiert sein, e.g.: class value_type2 {public: inline operator value_type2() const { return value_type2(); }
+      for(int x1=0; x1<this->nx1; x1++)
+         for(int x2=0; x2<this->nx2; x2++)
+               this->operator()(x1,x2) = static_cast< value_type >( rhs.operator()(x1,x2) );
+
+      return *this;
+   }
+   /*=======================================================================*/
+   bool operator== (const CbArray2D& rhs) const
+   {
+      if( this == &rhs ) return true;
+
+      if(   this->nx1!=rhs.nx1
+         || this->nx2!=rhs.nx2
+         || this->data.size() != rhs.data.size() )
+      {
+         return false;
+      }
+
+      return std::equal( this->data.begin(), this->data.end(), rhs.data.begin(), UbEqual<value_type, value_type >() );
+   }
+   /*=======================================================================*/
+   template< typename value_type2, typename IndexClass2 >
+   bool operator== (const CbArray2D< value_type2, IndexClass2 >& rhs) const
+   {
+      if( this->data.size() != rhs.data.size() ) return false;
+
+      //Sourcedaten einzeln checken (!! koennte anderen Indexer besitzen!!! -> operator() benutzen)
+      for(int x1=0; x1<this->nx1; x1++)
+         for(int x2=0; x2<this->nx2; x2++)
+            if( !isUbEqual(this->operator()(x1,x2), rhs.operator()(x1,x2)) )
+               return false;
+
+      return true;
+   }
+   /*=======================================================================*/
+   bool operator!= (const CbArray2D& rhs) const
+   {
+      return !(*this==rhs);
+   }
+   /*=======================================================================*/
+   template< typename value_type2, typename IndexClass2 >
+   bool operator!= (const CbArray2D< value_type2, IndexClass2 >& rhs) const
+   {
+      return !(*this==rhs);
+   }
+   /*=======================================================================*/
+   reference operator() (const size_type& x1,const size_type& x2)
+   {
+      #if !defined(NO_CB_RANGECHECK) && ( defined(_DEBUG) || defined(CB_RANGECHECK) )
+         if( !this->indicesInRange(x1,x2) )
+            UB_THROW( UbException(UB_EXARGS,getExceptionErrorString(x1,x2)) );
+      #endif
+
+      return this->data[indexer.getIndex(x1,x2,nx1,nx2)];
+   }
+   /*=======================================================================*/
+   const_reference operator() (const size_type& x1,const size_type& x2)	const
+   {
+      #if !defined(NO_CB_RANGECHECK) && ( defined(_DEBUG) || defined(CB_RANGECHECK) )
+         if( !this->indicesInRange(x1,x2) )
+            UB_THROW( UbException(UB_EXARGS,getExceptionErrorString(x1,x2)) );
+      #endif
+
+      return this->data[indexer.getIndex(x1,x2,nx1,nx2)];
+   }
+   /*=======================================================================*/
+   pointer getStartAdressOfSortedArray(const size_type& x1, const size_type& x2)
+   {
+      #if !defined(NO_CB_RANGECHECK) && ( defined(_DEBUG) || defined(CB_RANGECHECK) )
+         if( !this->indicesInRange(x1,x2) )
+            UB_THROW( UbException(UB_EXARGS,getExceptionErrorString(x1,x2)) );
+      #endif
+      return &this->data[indexer.getStartIndexOfSortedArray(x1,x2,nx1,nx2)];
+   }
+   /*=======================================================================*/
+   const_pointer getStartAdressOfSortedArray(const size_type& x1, const size_type& x2) const
+   {
+      #if !defined(NO_CB_RANGECHECK) && ( defined(_DEBUG) || defined(CB_RANGECHECK) )
+         if( !this->indicesInRange(x1,x2) )
+            UB_THROW( UbException(UB_EXARGS,getExceptionErrorString(x1,x2)) );
+      #endif
+      return &this->data[indexer.getStartIndexOfSortedArray(x1,x2,nx1,nx2)];
+   }
+   /*=======================================================================*/
+   void setObject(const size_type& x1,const size_type& x2,const value_type& value)
+   {
+      #if !defined(NO_CB_RANGECHECK) && ( defined(_DEBUG) || defined(CB_RANGECHECK) )
+         if( !this->indicesInRange(x1,x2) )
+            UB_THROW( UbException(UB_EXARGS,getExceptionErrorString(x1,x2)) );
+      #endif
+      this->data[indexer.getIndex(x1,x2,nx1,nx2)] = value;
+   }
+   /*=======================================================================*/
+   reference getObject(const size_type& x1, const size_type& x2)
+   {
+      #if !defined(NO_CB_RANGECHECK) && ( defined(_DEBUG) || defined(CB_RANGECHECK) )
+         if( !this->indicesInRange(x1,x2) )
+            UB_THROW( UbException(UB_EXARGS,getExceptionErrorString(x1,x2)) );
+      #endif
+      return this->data[indexer.getIndex(x1,x2,nx1,nx2)] ;
+   }
+   /*=======================================================================*/
+   typename std::vector<value_type>::const_reference getObject(const size_type& x1, const size_type& x2) const
+   {
+      return this->operator()(x1,x2);
+   }
+   /*=======================================================================*/
+   bool      isEmpty() const { return data.empty(); }
+   size_type getNX1()  const { return this->nx1;    }
+   size_type getNX2()  const { return this->nx2;    }
+   /*=======================================================================*/
+   void reset(const T& val)
+   {
+      std::fill( this->data.begin(), this->data.end(), val );
+   }
+   /*=======================================================================*/
+   std::string toString() const
+   {
+      std::stringstream text;
+      for(size_type x2=0; x2<this->nx2; x2++)
+      {
+         for(size_type x1=0; x1<this->nx1; x1++)
+         {
+            //hier kommts zum Konflikt ab  und an ...
+            text<<this->getObject(x1,x2)<<", ";
+         }
+         text<<"\n";
+      }
+
+      return text.str();
+   }
+   /*=======================================================================*/
+   std::string getInfo() const
+   {
+      std::stringstream text;
+      text<<"CbArray2D< storageType="<<typeid(T).name()<<", indexer="<<typeid(IndexClass).name()<<" >";
+      text<<"( nx1="<<this->nx1<<", nx2="<<this->nx2<<")";
+      return text.str();
+   }
+   /*=======================================================================*/
+   void resize(const size_type& uniformDimensionSize)
+   {
+      this->resize(uniformDimensionSize,uniformDimensionSize);
+   }
+   /*=======================================================================*/
+   void resize(const size_type& nx1,const size_type& nx2)
+   {
+      this->nx1 = nx1;
+      this->nx2 = nx2;
+      this->data.resize(nx1*nx2);
+   }
+   /*=======================================================================*/
+   void resize(const size_type& nx1, const size_type& nx2, const value_type& initVal )
+   {
+      this->nx1 = nx1;
+      this->nx2 = nx2;
+      this->data.resize(nx1*nx2,initVal);
+   }
+   /*=======================================================================*/
+   void clear()
+   {
+      this->nx1 = 0;
+      this->nx2 = 0;
+      this->data.clear();
+   }
+   /*=======================================================================*/
+   std::vector< value_type >& getDataVector() { return this->data; }
+   /*=======================================================================*/
+   const std::vector< value_type >& getDataVector() const { return this->data; }
+   /*=======================================================================*/
+   inline size_type getDataVectorIndex(const size_type& x1, const size_type& x2) const
+   {
+      #if !defined(NO_CB_RANGECHECK) && ( defined(_DEBUG) || defined(CB_RANGECHECK) )
+         if( !this->indicesInRange(x1,x2) )
+            UB_THROW( UbException(UB_EXARGS,getExceptionErrorString(x1,x2)) );
+      #endif
+
+      return indexer.getIndex(x1,x2,nx1,nx2);
+   }
+
+protected:
+   /*=======================================================================*/
+   //success -> true
+   //else    -> false
+   inline bool indicesInRange(const size_type& x1, const size_type& x2) const
+   {
+      if(   x1 < 0 || x1 >= this->nx1
+         || x2 < 0 || x2 >= this->nx2 )
+      {
+         return false;
+      }
+      return true;
+   }
+   /*=======================================================================*/
+   std::string getExceptionErrorString(const size_type& x1, const size_type& x2) const
+   {
+      std::stringstream out("index out of range - ");
+      out<<"("<<x1<<","<<x2<<") not in ("<<nx1<<","<<nx2<<")";
+      return out.str();
+   }
+   /*=======================================================================*/
+
+protected:
+   size_type    nx1;
+   size_type    nx2;
+   indexer_type indexer;
+   std::vector< value_type > data;
+};
+
+#endif //CBARRAY2D_H
diff --git a/src/VirtualFluidsBasics/basics/container/CbArray3D.h b/src/VirtualFluidsBasics/basics/container/CbArray3D.h
new file mode 100644
index 0000000000000000000000000000000000000000..575b0cb84019bdd0241698d4f8e861ccd9aa2159
--- /dev/null
+++ b/src/VirtualFluidsBasics/basics/container/CbArray3D.h
@@ -0,0 +1,468 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 CbArray3D.h
+//! \ingroup container
+//! \author Soeren Freudiger, Sebastian Geller
+//=======================================================================================
+#ifndef CBARRAY3D_H
+#define CBARRAY3D_H
+
+#include <iomanip>
+
+#include <basics/utilities/UbException.h>
+#include <basics/utilities/UbEqual.h>
+#include <algorithm>
+#include <typeinfo>
+#include "PointerDefinitions.h"
+
+//////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////
+// IndexClasses
+
+//IndexerX3X2X1:
+//                4 5 6          10 11 12
+// Array  ebene A 1 2 3  ebene B  7  8  9 -->  vector 1 2 3 4 5 6 7 8 9 10 11 12
+//x1-reihen "liegen am stueck" im speicher
+//optimaler schleifendurchlauf
+//for(alle X3)
+//  for(alle X2)
+//    for(alle X1)
+class IndexerX3X2X1// FunctorX1SortedForX1X2Plane
+{
+public:
+   typedef size_t size_type;
+public:
+   inline std::size_t getIndex(  const size_type& x1 , const size_type& x2 , const size_type& x3
+                               , const size_type& nx1, const size_type& nx2, const size_type& nx3 ) const
+   {
+      return  nx1 * ( nx2 * x3 + x2) + x1 ;
+   }
+   inline std::size_t getStartIndexOfSortedArray(  const size_type& x1 , const size_type& x2 , const size_type& x3
+                                                 , const size_type& nx1, const size_type& nx2, const size_type& nx3 ) const
+   {
+      return  nx1 * ( nx2 * x3 + x2);
+   }
+};
+
+//IndexerX1X2X3:
+//                4 5 6          10 11 12
+// Array  ebene A 1 2 3  ebene B  7  8  9 -->
+//optimaler schleifendurchlauf
+//for(alle X1)
+//  for(alle X2)
+//    for(alle X3)
+class IndexerX1X2X3 //FunctorX3SortedForX3X2Plane
+{
+public:
+   typedef size_t size_type;
+public:
+   inline std::size_t getIndex(  const size_type& x1 , const size_type& x2 , const size_type& x3
+                               , const size_type& nx1, const size_type& nx2, const size_type& nx3 ) const
+   {
+      return  nx3 * ( nx2 * x1 + x2) + x3 ;
+   }
+   inline std::size_t getStartIndexOfSortedArray(  const size_type& x1 , const size_type& x2 , const size_type& x3
+                                                 , const size_type& nx1, const size_type& nx2, const size_type& nx3 ) const
+   {
+      return  nx3 * ( nx2 * x1 + x2);
+   }
+};
+
+//IndexerX2X1X3:
+//                4 5 6          10 11 12
+// Array  ebene A 1 2 3  ebene B  7  8  9 -->  vector 1 7 2 8 3 9 4 10 5 11 6 12
+//optimaler schleifendurchlauf
+//for(alle X2)
+//  for(alle X1)
+//    for(alle X3)
+class IndexerX2X1X3
+{
+public:
+   typedef size_t size_type;
+public:
+   inline std::size_t getIndex(  const size_type& x1 , const size_type& x2 , const size_type& x3
+                               , const size_type& nx1, const size_type& nx2, const size_type& nx3 ) const
+   {
+      return  nx3* ( nx1 * x2 + x1) + x3 ;
+   }
+   inline std::size_t getStartIndexOfSortedArray(  const size_type& x1 , const size_type& x2 , const size_type& x3
+                                                 , const size_type& nx1, const size_type& nx2, const size_type& nx3 ) const
+   {
+      return  nx3* ( nx1 * x2 + x1);
+   }
+};
+
+
+//////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////
+// CbArray3D
+//////////////////////////////////////////////////////////////////////////
+//! \brief 3D Array
+//! \details The data is stored in a vector
+//!
+//! Rangecheck active, if:
+//!
+//! -debug  : not defined "NO_CB_RANGECHECK"
+//!
+//! -release: not defined "NO_CB_RANGECHECK" && defined "CB_RANGECHECK"
+//////////////////////////////////////////////////////////////////////////
+template<typename T, typename IndexClass = IndexerX3X2X1>
+class CbArray3D
+{
+public:
+   typedef SPtr< CbArray3D <T,IndexClass> > CbArray3DPtr;
+
+   typedef T                                                   value_type;
+   typedef IndexClass                                          indexer_type;
+   typedef typename IndexClass::size_type                      size_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;
+
+private:
+   template< typename value_type2, typename IndexClass2 > friend class CbArray3D;
+
+public:
+   /*=======================================================================*/
+   CbArray3D()
+   {
+      this->resize(0,0,0);
+   }
+   /*=======================================================================*/
+   CbArray3D(const size_type& nx1,const size_type& nx2, const size_type& nx3, const value_type& val)
+   {
+      this->resize(nx1,nx2,nx3,val);
+   }
+   /*=======================================================================*/
+    CbArray3D(const size_type& nx1,const size_type& nx2, const size_type& nx3)
+    {
+       this->resize(nx1,nx2,nx3);
+    }
+   /*=======================================================================*/
+   CbArray3D(const size_type& uniformDimensionSize /*nx1==nx2==nx3*/)
+   {
+      this->resize(uniformDimensionSize,uniformDimensionSize,uniformDimensionSize);
+   }
+   /*=======================================================================*/
+   //übernimmt vector als daten vector! (erstellt KEINE kopie!!!, vec ist anschließend leer, da swap verwendet wird)
+   CbArray3D(std::vector<value_type>& vec, const size_type& nx1,const size_type& nx2, const size_type& nx3)
+   {
+      assert( (nx1*nx2*nx3)==vec.size() );
+      this->data.swap(vec);
+      this->resize(nx1,nx2,nx3);
+   }
+   /*=======================================================================*/
+   CbArray3D(const CbArray3D& src)
+      :  nx1(src.nx1)
+       , nx2(src.nx2)
+       , nx3(src.nx3)
+       , data(src.data)
+   {
+   }
+   /*=======================================================================*/
+   template< typename value_type2 >
+   CbArray3D(const CbArray3D< value_type2 >& src)
+      :  nx1(src.nx1)
+       , nx2(src.nx2)
+       , nx3(src.nx3)
+   {
+      //Sourcedaten kopieren
+      this->data.resize( src.data.size() );
+      for(std::size_t i=0; i<data.size(); ++i)
+         this->data[i] = src.data[i];
+   }
+   /*=======================================================================*/
+   virtual ~CbArray3D()
+   {
+      //vector wird automatisch zerstoert
+   }
+   /*=======================================================================*/
+   CbArray3D& operator= (const CbArray3D& rhs)
+   {
+      if(this == &rhs) return *this;
+
+      this->nx1 = rhs.nx1;
+      this->nx2 = rhs.nx2;
+      this->nx3 = rhs.nx3;
+
+      //gespeicherte Datenelemente loeschen
+      //Laenge anpassen
+      this->data.resize(rhs.data.size());
+      //gespeicherte Datenelemente loeschen
+      this->data.clear();
+
+      //Sourcedaten kopieren
+      this->data = rhs.data;
+
+      return *this;
+   }
+   /*=======================================================================*/
+   //durch value_type2 kann man z.B. ein float array einer double array zuweisen!
+   template< typename value_type2, typename IndexClass2 >
+   CbArray3D& operator= (const CbArray3D< value_type2, IndexClass2 >& rhs)
+   {
+      this->nx1 = rhs.nx1;
+      this->nx2 = rhs.nx2;
+      this->nx3 = rhs.nx3;
+
+      //gespeicherte Datenelemente loeschen
+      this->data.clear();
+      //Laenge anpassen
+      this->data.resize(rhs.data.size());
+
+      //Sourcedaten kopieren (!! koennte anderen Indexer besitzen!!! -> operator() benutzen)
+      for(int x3=0; x3<this->nx3; x3++)
+         for(int x2=0; x2<this->nx2; x2++)
+            for(int x1=0; x1<this->nx1; x1++)
+               this->operator()(x1,x2,x3) = static_cast< value_type >( rhs.operator()(x1,x2,x3) );
+
+      return *this;
+   }
+   /*=======================================================================*/
+   bool operator== (const CbArray3D& rhs) const
+   {
+      if(this == &rhs) return true;
+
+      if(   this->nx1!=rhs.nx1
+         || this->nx2!=rhs.nx2
+         || this->nx3!=rhs.nx3
+         || this->data.size() != rhs.data.size() )
+      {
+         return false;
+      }
+
+      return std::equal( this->data.begin(), this->data.end(), rhs.data.begin(), UbEqual<value_type, value_type >() );
+   }
+   /*=======================================================================*/
+   template< typename value_type2, typename IndexClass2 >
+   bool operator== (const CbArray3D< value_type2, IndexClass2 >& rhs) const
+   {
+      if( this->data.size() != rhs.data.size() ) return false;
+
+      //Sourcedaten einzeln checken (!! koennte anderen Indexer besitzen!!! -> operator() benutzen)
+      for(int x3=0; x3<this->nx3; x3++)
+         for(int x2=0; x2<this->nx2; x2++)
+            for(int x1=0; x1<this->nx1; x1++)
+               if( !isUbEqual(this->operator()(x1,x2,x3), rhs.operator()(x1,x2,x3)) )
+               return false;
+
+      return true;
+   }
+   /*=======================================================================*/
+   bool operator!= (const CbArray3D& src) const
+   {
+      return !(*this==src);
+   }
+   /*=======================================================================*/
+   template< typename value_type2, typename IndexClass2 >
+   bool operator!= (const CbArray3D< value_type2, IndexClass2 >& rhs) const
+   {
+      return !(*this==rhs);
+   }
+   /*=======================================================================*/
+   reference operator() (const size_type& x1, const size_type& x2, const size_type& x3)
+   {
+      #if !defined(NO_CB_RANGECHECK) && ( defined(_DEBUG) || defined(CB_RANGECHECK) )
+         if( !this->indicesInRange(x1,x2,x3) )
+            UB_THROW( UbException(UB_EXARGS,getExceptionErrorString(x1,x2,x3)) );
+      #endif
+
+      return this->data[ indexer.getIndex(x1,x2,x3,nx1,nx2,nx3) ];
+   }
+   /*=======================================================================*/
+   const_reference operator() (const size_type& x1, const size_type& x2, const size_type& x3)	const
+   {
+      #if !defined(NO_CB_RANGECHECK) && ( defined(_DEBUG) || defined(CB_RANGECHECK) )
+         if( !this->indicesInRange(x1,x2,x3) )
+            UB_THROW( UbException(UB_EXARGS,getExceptionErrorString(x1,x2,x3)) );
+      #endif
+
+      return this->data[ indexer.getIndex(x1,x2,x3,nx1,nx2,nx3) ];
+   }
+   /*=======================================================================*/
+   pointer getStartAdressOfSortedArray(const size_type& x1, const size_type& x2, const size_type& x3)
+   {
+      #if !defined(NO_CB_RANGECHECK) && ( defined(_DEBUG) || defined(CB_RANGECHECK) )
+         if( !this->indicesInRange(x1,x2,x3) )
+            UB_THROW( UbException(UB_EXARGS,getExceptionErrorString(x1,x2,x3)) );
+      #endif
+
+      return &this->data[indexer.getStartIndexOfSortedArray(x1,x2,x3,nx1,nx2,nx3)];
+   }
+   /*=======================================================================*/
+   const_pointer getStartAdressOfSortedArray(const size_type& x1, const size_type& x2, const size_type& x3)  const
+   {
+      #if !defined(NO_CB_RANGECHECK) && ( defined(_DEBUG) || defined(CB_RANGECHECK) )
+         if( !this->indicesInRange(x1,x2,x3) )
+            UB_THROW( UbException(UB_EXARGS,getExceptionErrorString(x1,x2,x3)) );
+      #endif
+
+      return &this->data[indexer.getStartIndexOfSortedArray(x1,x2,x3,nx1,nx2,nx3)];
+   }
+   /*=======================================================================*/
+   void setObject(const size_type& x1, const size_type& x2, const size_type& x3, const value_type& value)
+   {
+      #if !defined(NO_CB_RANGECHECK) && ( defined(_DEBUG) || defined(CB_RANGECHECK) )
+         if( !this->indicesInRange(x1,x2,x3) )
+            UB_THROW( UbException(UB_EXARGS,getExceptionErrorString(x1,x2,x3)) );
+      #endif
+
+      this->data[ indexer.getIndex(x1,x2,x3,nx1,nx2,nx3) ] = value;
+   }
+   /*=======================================================================*/
+   reference getObject(const size_type& x1, const size_type& x2, const size_type& x3)
+   {
+      #if !defined(NO_CB_RANGECHECK) && ( defined(_DEBUG) || defined(CB_RANGECHECK) )
+         if( !this->indicesInRange(x1,x2,x3) )
+            UB_THROW( UbException(UB_EXARGS,getExceptionErrorString(x1,x2,x3)) );
+      #endif
+
+      return this->data[ indexer.getIndex(x1,x2,x3,nx1,nx2,nx3) ] ;
+   }
+   /*=======================================================================*/
+   const_reference getObject(const size_type& x1, const size_type& x2, const size_type& x3) const
+   {
+      return (*this)(x1,x2,x3);
+   }
+   /*=======================================================================*/
+   bool      isEmpty() const { return data.empty(); }
+   size_type getNX1()  const { return this->nx1;    }
+   size_type getNX2()  const { return this->nx2;    }
+   size_type getNX3()  const { return this->nx3;    }
+   /*=======================================================================*/
+   void reset(const value_type& val)
+   {
+      std::fill( this->data.begin(), this->data.end(), val );
+   }
+   /*=======================================================================*/
+   std::string toString() const
+   {
+      std::stringstream text;
+      for(size_type x1=0; x1<this->nx1; x1++)
+      {
+      	for(size_type x2=0; x2<this->nx2; x2++)
+      	{
+         	for(size_type x3=0; x3<this->nx3; x3++)
+         	{
+            	text<<(*this)(x1,x2,x3)<<", ";
+         	}
+         	text<<std::endl;
+      	}
+      	text<<std::endl<<std::endl;
+      }
+
+      return text.str();
+   }
+   /*=======================================================================*/
+   std::string getInfo() const
+   {
+      std::stringstream text;
+      text<<"CbArray3D< storageType="<<typeid(T).name()<<", indexer="<<typeid(IndexClass).name()<<" >";
+      text<<"( nx1="<<this->nx1<<", nx2="<<this->nx2<<", nx3="<<this->nx3<<")";
+      return text.str();
+   }
+   /*=======================================================================*/
+   void resize(const int& uniformDimensionSize)
+   {
+      this->resize(uniformDimensionSize,uniformDimensionSize,uniformDimensionSize);
+   }
+   /*=======================================================================*/
+   void resize(const size_type& nx1,const size_type& nx2, const size_type& nx3)
+   {
+      this->nx1 = nx1;
+      this->nx2 = nx2;
+      this->nx3 = nx3;
+      this->data.resize(nx1*nx2*nx3);
+   }
+   /*=======================================================================*/
+   void resize(const size_type& nx1,const size_type& nx2, const size_type& nx3,const value_type& val)
+   {
+      this->nx1 = nx1;
+      this->nx2 = nx2;
+      this->nx3 = nx3;
+      this->data.resize(nx1*nx2*nx3,val);
+   }
+   /*=======================================================================*/
+   void clear()
+   {
+      this->nx1 = 0;
+      this->nx2 = 0;
+      this->nx3 = 0;
+      this->data.clear();
+   }
+   /*=======================================================================*/
+   std::vector< value_type >& getDataVector() { return this->data; }
+   /*=======================================================================*/
+   const std::vector< value_type >& getDataVector() const { return this->data; }
+   /*=======================================================================*/
+   inline std::size_t getDataVectorIndex(const size_type& x1, const size_type& x2, const size_type& x3) const
+   {
+      #if !defined(NO_CB_RANGECHECK) && ( defined(_DEBUG) || defined(CB_RANGECHECK) )
+         if( !this->indicesInRange(x1,x2,x3) )
+            UB_THROW( UbException(UB_EXARGS,getExceptionErrorString(x1,x2,x3)) );
+      #endif
+
+      return indexer.getIndex(x1,x2,x3,nx1,nx2,nx3);
+   }
+
+
+   /*=======================================================================*/
+   //success -> true
+   //else    -> false
+   inline bool indicesInRange(const size_type& x1, const size_type& x2, const size_type& x3) const
+   {
+      if(   x1 < 0 || x1 >= this->nx1
+         || x2 < 0 || x2 >= this->nx2
+         || x3 < 0 || x3 >= this->nx3 )
+      {
+         return false;
+      }
+      return true;
+   }
+protected:
+   /*=======================================================================*/
+   std::string getExceptionErrorString(const size_type& x1, const size_type& x2, const size_type& x3) const
+   {
+      std::stringstream out("index out of range - ");
+      out<<"("<<x1<<","<<x2<<","<<x3<<") not in ("<<nx1<<","<<nx2<<","<<nx3<<")";
+      return out.str();
+   }
+   /*=======================================================================*/
+
+protected:
+   size_type    nx1;
+   size_type    nx2;
+   size_type    nx3;
+   indexer_type indexer;
+   std::vector< value_type > data;
+
+};
+
+#endif //CBARRAY3D_H
diff --git a/src/VirtualFluidsBasics/basics/container/CbArray4D.h b/src/VirtualFluidsBasics/basics/container/CbArray4D.h
new file mode 100644
index 0000000000000000000000000000000000000000..b72a13f0e0489869e69ac722493ddc59e6c469e8
--- /dev/null
+++ b/src/VirtualFluidsBasics/basics/container/CbArray4D.h
@@ -0,0 +1,451 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 CbArray4D.h
+//! \ingroup container
+//! \author Soeren Freudiger, Sebastian Geller
+//=======================================================================================
+#ifndef CBARRAY4D_H
+#define CBARRAY4D_H
+
+
+
+#include <iomanip>
+#include <basics/utilities/UbException.h>
+#include <basics/utilities/UbEqual.h>
+#include <algorithm>
+#include <typeinfo>
+#include "PointerDefinitions.h"
+
+//////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////
+// IndexClasses
+
+//IndexerX1X2X3X4:
+//x4-reihen "liegen am stueck" im speicher
+//optimaler schleifendurchlauf
+//for(alle X1)
+//  for(alle X2)
+//    for(alle X3)
+//      for(alle X4)
+class IndexerX1X2X3X4
+{
+public:
+   typedef int size_type;
+public:
+   inline std::size_t getIndex( const size_type& x1 , const size_type& x2 , const size_type& x3 , const size_type& x4
+                            , const size_type& nx1, const size_type& nx2, const size_type& nx3, const size_type& nx4 )  const
+   {
+      return nx4*(nx3*(nx2*x1+ x2)+x3)+x4 ;
+   }
+   inline std::size_t getStartIndexOfSortedArray(  const size_type& x1 , const size_type& x2 , const size_type& x3 , const size_type& x4
+                                               , const size_type& nx1, const size_type& nx2, const size_type& nx3, const size_type& nx4 )  const
+   {
+      return  nx4*(nx3*(nx2*x1+ x2)+x3);
+   }
+};
+//////////////////////////////////////////////////////////////////////////
+// IndexClasses
+
+//IndexerX4X3X2X1:
+//x1-reihen "liegen am stueck" im speicher
+//optimaler schleifendurchlauf
+//for(alle X4)
+//  for(alle X3)
+//    for(alle X2)
+//      for(alle X1)
+class IndexerX4X3X2X1
+{
+public:
+   typedef size_t size_type;
+public:
+   inline std::size_t getIndex( const size_type& x1 , const size_type& x2 , const size_type& x3 , const size_type& x4
+      , const size_type& nx1, const size_type& nx2, const size_type& nx3, const size_type& nx4 )  const
+   {
+      return nx1*(nx2*(nx3*x4+ x3)+x2)+x1;
+   }
+   inline std::size_t getStartIndexOfSortedArray(  const size_type& x1 , const size_type& x2 , const size_type& x3 , const size_type& x4
+      , const size_type& nx1, const size_type& nx2, const size_type& nx3, const size_type& nx4 )  const
+   {
+      return  nx1*(nx2*(nx3*x4+ x3)+x2);
+   }
+};
+//////////////////////////////////////////////////////////////////////////
+// CbArray4D
+//! \brief 4D Array
+//! \details The data is stored in a vector
+//!
+//! Rangecheck active, if:
+//!
+//! -debug  : not defined "NO_CB_RANGECHECK"
+//!
+//! -release: not defined "NO_CB_RANGECHECK" && defined "CB_RANGECHECK"
+//////////////////////////////////////////////////////////////////////////
+template<typename T, typename IndexClass = IndexerX4X3X2X1>
+class CbArray4D
+{
+public:
+   typedef SPtr< CbArray4D <T,IndexClass> > CbArray4DPtr;
+
+   typedef T                                                   value_type;
+   typedef IndexClass                                          indexer_type;
+   typedef typename IndexClass::size_type                      size_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;
+
+private:
+   template< typename value_type2, typename IndexClass2 > friend class CbArray4D;
+
+public:
+   /*=======================================================================*/
+   CbArray4D()
+   {
+      this->resize(0,0,0,0);
+   }
+   /*=======================================================================*/
+   CbArray4D(const size_type& nx1,const size_type& nx2, const size_type& nx3, const size_type& nx4)
+   {
+      this->resize(nx1,nx2,nx3,nx4);
+   }
+   /*=======================================================================*/
+   CbArray4D(const size_type& nx1,const size_type& nx2, const size_type& nx3, const size_type& nx4, const value_type& val)
+   {
+      this->resize(nx1,nx2,nx3,nx4,val);
+   }
+   /*=======================================================================*/
+   CbArray4D(const size_type& uniformDimensionSize /*nx1=nx2=nx3=nx4*/)
+   {
+      this->resize(uniformDimensionSize,uniformDimensionSize,uniformDimensionSize,uniformDimensionSize);
+   }
+   /*=======================================================================*/
+   //ubernimmt vector als daten vector! (erstellt KEINE kopie!!!, vec ist anschließend leer, da swap verwendet wird)
+   CbArray4D(std::vector<value_type>& vec, const size_type& nx1,const size_type& nx2, const size_type& nx3, const size_type& nx4)
+   {
+      assert( (nx1*nx2*nx3*nx4)==vec.size() );
+      this->data.swap(vec);
+      this->resize(nx1,nx2,nx3,nx4);
+   }
+   /*=======================================================================*/
+   CbArray4D(const CbArray4D& src)
+      :  nx1(src.nx1)
+       , nx2(src.nx2)
+       , nx3(src.nx3)
+       , nx4(src.nx4)
+       , data(src.data)
+   {
+   }
+   /*=======================================================================*/
+   template< typename value_type2 >
+   CbArray4D(const CbArray4D< value_type2 >& src)
+      :  nx1(src.nx1)
+       , nx2(src.nx2)
+       , nx3(src.nx3)
+       , nx4(src.nx4)
+   {
+      //Sourcedaten kopieren
+      this->data.resize( src.data.size() );
+      for(std::size_t i=0; i<data.size(); ++i)
+         this->data[i] = src.data[i];
+   }
+   /*=======================================================================*/
+   virtual ~CbArray4D()
+   {
+      //vector wird automatisch zerstoert
+   }
+   /*=======================================================================*/
+   CbArray4D& operator= (const CbArray4D& rhs)
+   {
+      if(this == &rhs) return *this;
+
+      this->nx1 = rhs.nx1;
+      this->nx2 = rhs.nx2;
+      this->nx3 = rhs.nx3;
+      this->nx4 = rhs.nx4;
+
+      //gespeicherte Datenelemente loeschen
+      //Laenge anpassen
+      this->data.resize(rhs.data.size());
+      //gespeicherte Datenelemente loeschen
+      this->data.clear();
+
+      //Sourcedaten kopieren
+      this->data = rhs.data;
+
+      return *this;
+   }
+   /*=======================================================================*/
+   //durch value_type2 kann man z.B. ein float Array einem double Array zuweisen!
+   template< typename value_type2, typename IndexClass2 >
+   CbArray4D& operator= (const CbArray4D< value_type2, IndexClass2 >& rhs)
+   {
+      this->nx1 = rhs.nx1;
+      this->nx2 = rhs.nx2;
+      this->nx3 = rhs.nx3;
+      this->nx4 = rhs.nx4;
+
+      //gespeicherte Datenelemente loeschen
+      this->data.clear();
+      //Laenge anpassen
+      this->data.resize(rhs.data.size());
+
+      //Sourcedaten kopieren (!! koennte anderen Indexer besitzen!!! -> operator() benutzen)
+      for(int x1=0; x1<this->nx1; x1++)
+         for(int x2=0; x2<this->nx2; x2++)
+            for(int x3=0; x3<this->nx3; x3++)
+               for(int x4=0; x4<this->nx4; x4++)
+                  this->operator()(x1,x2,x3,x4) = static_cast< value_type >( rhs.operator()(x1,x2,x3,x4));
+
+      return *this;
+   }
+   /*=======================================================================*/
+   bool operator== (const CbArray4D& rhs) const
+   {
+      if( this == &rhs ) return true;
+
+      if(   this->nx1!=rhs.nx1
+         || this->nx2!=rhs.nx2
+         || this->nx3!=rhs.nx3
+         || this->nx4!=rhs.nx4
+         || this->data.size() != rhs.data.size() )
+      {
+         return false;
+      }
+
+      return std::equal( this->data.begin(), this->data.end(), rhs.data.begin(), UbEqual<value_type, value_type >() );
+   }
+   /*=======================================================================*/
+   template< typename value_type2, typename IndexClass2 >
+   bool operator== (const CbArray4D< value_type2, IndexClass2 >& rhs) const
+   {
+      if( this->data.size() != rhs.data.size() ) return false;
+
+      //Sourcedaten einzeln checken (!! koennte anderen Indexer besitzen!!! -> operator() benutzen)
+      for(int x4=0; x4<this->nx4; x4++)
+         for(int x3=0; x3<this->nx3; x3++)
+            for(int x2=0; x2<this->nx2; x2++)
+             for(int x1=0; x1<this->nx1; x1++)
+               if( !isUbEqual(this->operator()(x1,x2,x3,x4), rhs.operator()(x1,x2,x3,x4)) )
+                  return false;
+
+      return true;
+   }
+   /*=======================================================================*/
+   bool operator!= (const CbArray4D& rhs) const
+   {
+      return !(*this==rhs);
+   }
+   /*=======================================================================*/
+   template< typename value_type2, typename IndexClass2 >
+   bool operator!= (const CbArray4D< value_type2, IndexClass2 >& rhs) const
+   {
+      return !(*this==rhs);
+   }
+   /*=======================================================================*/
+   reference operator() (const size_type& x1, const size_type& x2, const size_type& x3, const size_type& x4)
+   {
+      #if !defined(NO_CB_RANGECHECK) && ( defined(_DEBUG) || defined(CB_RANGECHECK) )
+         if( !this->indicesInRange(x1,x2,x3,x4) )
+            UB_THROW( UbException(UB_EXARGS,getExceptionErrorString(x1,x2,x3,x4)) );
+      #endif
+
+      return this->data[indexer.getIndex(x1,x2,x3,x4,nx1,nx2,nx3,nx4)];
+   }
+   /*=======================================================================*/
+   const_reference operator() (const size_type& x1, const size_type& x2, const size_type& x3, const size_type& x4)	const
+   {
+      #ifdef CbArray4D_RANGECHECKING
+         if( !this->indicesInRange(x1,x2,x3,x4) )
+            UB_THROW( UbException(UB_EXARGS,getExceptionErrorString(x1,x2,x3,x4)) );
+      #endif
+
+      return this->data[indexer.getIndex(x1,x2,x3,x4,nx1,nx2,nx3,nx4)];
+   }
+   /*=======================================================================*/
+   pointer getStartAdressOfSortedArray(const size_type& x1, const size_type& x2, const size_type& x3, const size_type& x4)
+   {
+      #if !defined(NO_CB_RANGECHECK) && ( defined(_DEBUG) || defined(CB_RANGECHECK) )
+         if( !this->indicesInRange(x1,x2,x3,x4) )
+            UB_THROW( UbException(UB_EXARGS,getExceptionErrorString(x1,x2,x3,x4)) );
+      #endif
+
+      return &this->data[indexer.getStartIndexOfSortedArray(x1,x2,x3,x4,nx1,nx2,nx3,nx4)];
+   }
+   /*=======================================================================*/
+   const_pointer getStartAdressOfSortedArray(const size_type& x1, const size_type& x2, const size_type& x3, const size_type& x4)  const
+   {
+      #if !defined(NO_CB_RANGECHECK) && ( defined(_DEBUG) || defined(CB_RANGECHECK) )
+         if( !this->indicesInRange(x1,x2,x3,x4) )
+            UB_THROW( UbException(UB_EXARGS,getExceptionErrorString(x1,x2,x3,x4)) );
+      #endif
+
+      return &this->data[indexer.getStartIndexOfSortedArray(x1,x2,x3,x4,nx1,nx2,nx3,nx4)];
+   }
+   /*=======================================================================*/
+   void setObject(const size_type& x1, const size_type& x2, const size_type& x3, const size_type& x4, const value_type& value)
+   {
+      #if !defined(NO_CB_RANGECHECK) && ( defined(_DEBUG) || defined(CB_RANGECHECK) )
+         if( !this->indicesInRange(x1,x2,x3,x4) )
+            UB_THROW( UbException(UB_EXARGS,getExceptionErrorString(x1,x2,x3,x4)) );
+      #endif
+
+      this->data[indexer.getIndex(x1,x2,x3,x4,nx1,nx2,nx3,nx4)] = value;
+   }
+   /*=======================================================================*/
+   reference getObject(const size_type& x1, const size_type& x2, const size_type& x3, const size_type& x4)
+   {
+      #if !defined(NO_CB_RANGECHECK) && ( defined(_DEBUG) || defined(CB_RANGECHECK) )
+         if( !this->indicesInRange(x1,x2,x3,x4) )
+            UB_THROW( UbException(UB_EXARGS,getExceptionErrorString(x1,x2,x3,x4)) );
+      #endif
+
+      return this->data[indexer.getIndex(x1,x2,x3,x4,nx1,nx2,nx3,nx4)];
+   }
+   /*=======================================================================*/
+   const_reference getObject(const size_type& x1, const size_type& x2, const size_type& x3, const size_type& x4) const
+   {
+      #if !defined(NO_CB_RANGECHECK) && ( defined(_DEBUG) || defined(CB_RANGECHECK) )
+         if( !this->indicesInRange(x1,x2,x3,x4) )
+            UB_THROW( UbException(UB_EXARGS,getExceptionErrorString(x1,x2,x3,x4)) );
+      #endif
+      return (*this)(x1,x2,x3,x4,nx1,nx2,nx3,nx4);
+   }
+   /*=======================================================================*/
+   bool      isEmpty() const { return data.empty(); }
+   size_type getNX1()  const { return this->nx1;    }
+   size_type getNX2()  const { return this->nx2;    }
+   size_type getNX3()  const { return this->nx3;    }
+   size_type getNX4()  const { return this->nx4;    }
+   /*=======================================================================*/
+   void reset(const value_type& val)
+   {
+      std::fill( this->data.begin(), this->data.end(), val );
+   }
+   /*=======================================================================*/
+   std::string toString() const
+   {
+      std::stringstream text;
+      text<<std::setprecision(19);
+      for(size_type x1=0; x1<this->nx1; x1++)
+      {
+      	for(size_type x2=0; x2<this->nx2; x2++)
+      	{
+         	for(size_type x3=0; x3<this->nx3; x3++)
+         	{
+               for(size_type x4=0; x4<this->nx4; x4++)
+               {
+                 	text<<(*this)(x1,x2,x3,x4)<<", ";
+               }
+               text<<std::endl;
+         	}
+         	text<<std::endl;
+      	}
+      	text<<std::endl<<std::endl;
+      }
+
+      return text.str();
+   }
+   /*=======================================================================*/
+   std::string getInfo() const
+   {
+      std::stringstream text;
+      text<<"CbArray4D< storageType="<<typeid(T).name()<<", indexer="<<typeid(IndexClass).name()<<" >";
+      text<<"( nx1="<<this->nx1<<", nx2="<<this->nx2<<", nx3="<<this->nx3<<", nx4="<<this->nx4<<")";
+      return text.str();
+   }
+   /*=======================================================================*/
+   void resize(const size_type& uniformDimensionSize) { this->resize(uniformDimensionSize,uniformDimensionSize,uniformDimensionSize); }
+   /*=======================================================================*/
+   void resize(const size_type& nx1, const size_type& nx2, const size_type& nx3, const size_type& nx4)
+   {
+      this->nx1 = nx1;
+      this->nx2 = nx2;
+      this->nx3 = nx3;
+      this->nx4 = nx4;
+      this->data.resize(nx1*nx2*nx3*nx4);
+   }
+   /*=======================================================================*/
+   void resize(const size_type& nx1, const size_type& nx2, const size_type& nx3, const size_type& nx4, const value_type& val)
+   {
+      this->nx1 = nx1;
+      this->nx2 = nx2;
+      this->nx3 = nx3;
+      this->nx4 = nx4;
+      this->data.resize(nx1*nx2*nx3*nx4,val);
+   }
+   /*=======================================================================*/
+   std::vector< value_type >& getDataVector() { return this->data; }
+   /*=======================================================================*/
+   const std::vector< value_type >& getDataVector() const { return this->data; }
+   /*=======================================================================*/
+   inline std::size_t getDataVectorIndex(const size_type& x1, const size_type& x2, const size_type& x3, const size_type& x4) const
+   {
+      #if !defined(NO_CB_RANGECHECK) && ( defined(_DEBUG) || defined(CB_RANGECHECK) )
+         if( !this->indicesInRange(x1,x2,x3,x4) )
+            UB_THROW( UbException(UB_EXARGS,getExceptionErrorString(x1,x2,x3,x4)) );
+      #endif
+
+      return indexer.getIndex(x1,x2,x3,x4,nx1,nx2,nx3,nx4);
+   }
+
+protected:
+   /*=======================================================================*/
+   //success -> true
+   //else    -> false
+   inline bool indicesInRange(const size_type& x1, const size_type& x2, const size_type& x3, const size_type& x4) const
+   {
+      if(   x1 < 0 || x1 >= this->nx1
+         || x2 < 0 || x2 >= this->nx2
+         || x3 < 0 || x3 >= this->nx3
+         || x4 < 0 || x4 >= this->nx4 )
+      {
+         return false;
+      }
+      return true;
+   }
+   /*=======================================================================*/
+   std::string getExceptionErrorString(const size_type& x1, const size_type& x2, const size_type& x3, const size_type& x4) const
+   {
+      std::stringstream out("index out of range - ");
+      out<<"("<<x1<<","<<x2<<","<<x3<<","<<x4<<") not in ("<<nx1<<","<<nx2<<","<<nx3<<","<<nx4<<")";
+      return out.str();
+   }
+   /*=======================================================================*/
+
+protected:
+   size_type    nx1;
+   size_type    nx2;
+   size_type    nx3;
+   size_type    nx4;
+   indexer_type indexer;
+   std::vector< value_type > data;
+
+};
+
+#endif //CBARRAY4D_H
diff --git a/src/VirtualFluidsBasics/basics/container/CbVector.h b/src/VirtualFluidsBasics/basics/container/CbVector.h
new file mode 100644
index 0000000000000000000000000000000000000000..b33ad1a44ea4afa13107326fd68cd0f08adfe10b
--- /dev/null
+++ b/src/VirtualFluidsBasics/basics/container/CbVector.h
@@ -0,0 +1,307 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 CbVector.h
+//! \ingroup container
+//! \author Soeren Freudiger, Sebastian Geller
+//=======================================================================================
+#ifndef CBVECTOR_H
+#define CBVECTOR_H
+
+#include <vector>
+#include <algorithm> //for std::swap
+#include <typeinfo>  //for typeid
+#include <PointerDefinitions.h>    //for memcopy
+
+#include <basics/utilities/UbSystem.h>
+#include <basics/utilities/UbEqual.h>
+
+template< typename T > class CbVectorAllocator;
+template< typename T > class CbVectorAllocatorStd;
+
+//=========================================================================
+//! \brief A class implements a container like a vector
+//! \details
+//! For this class it was required to ave only the type as template argument.
+//! Hence, the allocator must be an abstract class. With out this requirement, 
+//! an allocator as second template argument would have been possible, as in the
+//! STL vector. This would lead to the compiler generating two different classes
+//! for the same data type with different allocators during compile time. Here it
+//! is required that the same class can have different allocators.
+//!
+//! Rangecheck active, if:
+//! -debug  : not defined "NO_CB_RANGECHECK"
+//! -release: not defined "NO_CB_RANGECHECK" && defined "CB_RANGECHECK"
+//=========================================================================
+//////////////////////////////////////////////////////////////////////////
+template< typename T >
+class CbVector
+{
+public:
+   typedef T           value_type;
+   typedef value_type* pointer;
+   typedef std::size_t size_type;
+
+   friend class CbVectorAllocator<value_type>; //um auf ptrData und dataSize zugreifen zu koennen!
+
+public:
+   /*==========================================================*/
+   CbVector( CbVectorAllocator<value_type>* const& allocator = new CbVectorAllocatorStd<value_type> )
+      :  ptrData(NULL)
+       , dataSize(0)
+       , allocator(allocator)
+   {
+      this->allocator->alloc(*this,0,value_type());
+   }
+   /*==========================================================*/
+   CbVector( const size_type size, CbVectorAllocator<value_type>* const& allocator = new CbVectorAllocatorStd<value_type>, const value_type& value=value_type() )
+      :  ptrData(NULL)
+       , dataSize(0)
+       , allocator(allocator)
+   {
+      this->allocator->alloc(*this,size,value);
+   }
+   /*==========================================================*/
+   virtual ~CbVector()
+   {
+      if(allocator)
+      {
+         this->allocator->dealloc(*this);
+         delete allocator;
+         allocator=NULL;
+      }
+   }
+   /*=======================================================================*/
+   CbVector& operator= (const CbVector& src)
+   {
+      if(this == &src) return *this;
+
+      //gespeicherte Datenelemente loeschen
+      //Laenge anpassen
+      this->allocator->resize(*this, src.size());
+
+      //gespeicherte Datenelemente kopieren
+      if( !src.empty() ) 
+      {
+         memcpy( (char*)ptrData, (char*)&src[0], src.size()*sizeof(value_type) ); 
+         //for(size_type i=0; i<src.size(); i++)
+         //   (*this)[i] = src[i];
+      }
+
+      return *this;
+   }
+   /*=======================================================================*/
+   CbVector& operator= (const std::vector< value_type >& src)
+   {
+      //gespeicherte Datenelemente loeschen
+      //Laenge anpassen
+      this->allocator->resize(*this, src.size());
+
+      //gespeicherte Datenelemente kopieren
+      if( !src.empty() ) 
+      {
+         memcpy( (char*)ptrData, (char*)&src[0], src.size()*sizeof(value_type) ); 
+         //for(size_type i=0; i<src.size(); i++)
+         //   (*this)[i] = src[i];
+      }
+      
+      return *this;
+   }
+   /*=======================================================================*/
+   bool operator== (const CbVector& rhs) const
+   {
+      if( this           == &rhs         ) return true;
+      if( this->dataSize != rhs.dataSize ) return false;
+
+      for(size_type i=0; i<rhs.size(); i++)
+         if( !isUbEqual( this->operator[](i), rhs.operator[](i) ) )
+            return false;
+
+      return true;
+   }
+   /*==========================================================*/
+   void setAllocator( CbVectorAllocator<value_type>* const& allocator )
+   {
+      if(this->allocator)
+      {
+         if(this->allocator==allocator) return;
+         this->allocator->dealloc(*this);
+         delete this->allocator;
+      }
+      this->allocator = allocator;
+      this->allocator->alloc(*this,0);
+   }
+   /*==========================================================*/
+   size_type size() const { return dataSize; }
+   /*==========================================================*/
+   bool empty() const { return dataSize==0; }
+   /*==========================================================*/
+   bool resize(const size_type& dataSize)
+   {
+      return allocator->resize(*this, dataSize);
+   }
+   /*==========================================================*/
+   bool resize(const size_type& dataSize, const value_type& value)
+   {
+      return allocator->resize(*this, dataSize, value);
+   }
+   /*==========================================================*/
+   void swap(CbVector& rhs)
+   {
+      if( this == &rhs ) return;
+
+      std::swap( this->ptrData  , rhs.ptrData   );
+      std::swap( this->dataSize , rhs.dataSize  );
+      std::swap( this->allocator, rhs.allocator );
+   }
+   /*==========================================================*/
+   value_type& operator[](const size_type& i)
+   {
+      #if !defined(NO_CB_RANGECHECK) && ( defined(_DEBUG) || defined(CB_RANGECHECK) )
+         if(i>=dataSize) 
+            UB_THROW( UbException(UB_EXARGS,"T="+(std::string)typeid(*this).name()+UbSystem::toString(i)+" out of range (size="+UbSystem::toString(dataSize)+")") );
+      #endif // _DEBUG
+
+      return ptrData[i];
+   }
+   /*==========================================================*/
+   const value_type& operator[](const size_type& i) const
+   {
+      #if !defined(NO_CB_RANGECHECK) && ( defined(_DEBUG) || defined(CB_RANGECHECK) )
+         if(i>=dataSize) 
+            UB_THROW( UbException(UB_EXARGS,"T="+(std::string)typeid(*this).name()+UbSystem::toString(i)+" out of range (size="+UbSystem::toString(dataSize)+")") );
+      #endif // _DEBUG
+
+      return ptrData[i];
+   }
+   /*==========================================================*/
+   CbVectorAllocator<value_type>* getAllocator() const { return allocator; }
+   /*==========================================================*/
+
+private:
+   value_type* ptrData;
+   size_type   dataSize;
+   CbVectorAllocator<value_type>* allocator;
+   CbVector<value_type>(const CbVector<value_type>& src);
+   //CbVector<value_type>& operator=(const CbVector<value_type>& src);
+};
+
+//////////////////////////////////////////////////////////////////////////
+// CbVectorAllocator-Interface
+//////////////////////////////////////////////////////////////////////////
+template< typename T >
+class CbVectorAllocator
+{
+public:
+   typedef typename CbVector<T>::value_type          value_type;
+   typedef typename CbVector<value_type>::size_type  size_type;
+
+public:
+   CbVectorAllocator() {}
+   virtual ~CbVectorAllocator() {}
+
+   virtual bool alloc(CbVector< value_type >& vec, const size_type& dataSize, const value_type& value=value_type()) = 0;
+   virtual bool resize(CbVector< value_type >& vec, const size_type& dataSize, const value_type& value=value_type()) = 0;
+   virtual bool dealloc(CbVector< value_type >& vec) = 0;
+
+protected:
+   //folgende Methoden ersparen eine friend Deklaierung aller moeglichen Allocatoren
+   //denn durch diese beiden Methoden haben sie exklusive Zugriffsrechte!
+   //**********************************************************************************//
+   inline value_type*& ptrDataOf( CbVector< value_type >& vec )
+   {
+      if( vec.getAllocator()!=this ) UB_THROW( UbException(UB_EXARGS,"allocator is not member of vec!") );
+      return vec.ptrData;
+   }
+   //**********************************************************************************//
+   inline size_type& dataSizeOf( CbVector< value_type >& vec )
+   {
+      if( vec.getAllocator()!=this ) UB_THROW( UbException(UB_EXARGS,"allocator is not member of vec!") );
+      return vec.dataSize;
+   }
+};
+
+//////////////////////////////////////////////////////////////////////////
+// CbVectorAllocatorStd
+//////////////////////////////////////////////////////////////////////////
+template< typename T >
+class CbVectorAllocatorStd : public CbVectorAllocator<T>
+{
+public:
+   //typedefs wiederholen, da Basisklasse = template -> "Dependent-Base"-Problem
+   typedef typename CbVector<T>::value_type          value_type;
+   typedef typename CbVector<value_type>::size_type  size_type;
+
+public:
+   CbVectorAllocatorStd() : CbVectorAllocator<value_type>()
+   {
+
+   }
+   /*==========================================================*/
+   bool alloc(CbVector< value_type >& src, const size_type& dataSize, const value_type& value=value_type())
+   {
+      return this->resize(src,dataSize,value);
+   }
+   /*==========================================================*/
+   bool resize(CbVector< value_type >& vec, const size_type& dataSize, const value_type& value=value_type())
+   {
+      if( CbVectorAllocatorStd< value_type >::dataSizeOf(vec) == dataSize) return false;
+
+      //new array
+      value_type* new_data = new value_type[dataSize];
+      //copy existing data to array
+      if( this->ptrDataOf(vec) )
+      {
+         for(size_type i=0; (i<vec.size() && i<dataSize); ++i) new_data[i] = CbVectorAllocatorStd< value_type >::ptrDataOf(vec)[i];
+         delete[] this->ptrDataOf(vec);
+      }
+      this->ptrDataOf(vec) = new_data;
+      //new value for new items
+      for(size_type i=this->dataSizeOf(vec); i<dataSize; ++i) this->ptrDataOf(vec)[i] = value;
+      //assign new dataSize
+      this->dataSizeOf(vec) = dataSize;
+
+      return true;
+   }
+   /*==========================================================*/
+   bool dealloc(CbVector< value_type >& vec)
+   {
+      if( this->ptrDataOf(vec) )
+      {
+         delete[] this->ptrDataOf(vec);
+         this->ptrDataOf(vec) = NULL;
+      }
+      this->dataSizeOf(vec) = 0;
+      return true;
+   }
+   /*==========================================================*/
+
+private:
+};
+
+#endif //CBVECTOR_H
diff --git a/src/VirtualFluidsBasics/basics/container/package.include b/src/VirtualFluidsBasics/basics/container/package.include
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/src/VirtualFluidsBasics/basics/objects/ObObject.h b/src/VirtualFluidsBasics/basics/objects/ObObject.h
new file mode 100644
index 0000000000000000000000000000000000000000..3fee350654bbdac50e31d70414c2f3bd9cfbe1a6
--- /dev/null
+++ b/src/VirtualFluidsBasics/basics/objects/ObObject.h
@@ -0,0 +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 ObObject.h
+//! \ingroup objects
+//! \author Soeren Freudiger, Sebastian Geller
+//=======================================================================================
+#ifndef OBOBJECT_H
+#define OBOBJECT_H
+
+#include <string>
+
+#include <basics/utilities/UbObservable.h>
+
+class ObObject : public UbObservable
+{
+public:
+   ObObject() : name("") { }
+   ObObject(const std::string& name) : name(name) { }
+
+   virtual ~ObObject() { }
+
+   virtual ObObject*   clone()=0;
+
+   virtual std::string getName()  { return name; }
+   void setName(std::string name) { this->name=name; }
+
+   virtual std::string toString()=0;
+
+
+private:
+   std::string name;
+};
+
+
+#endif
diff --git a/src/VirtualFluidsBasics/basics/objects/package.include b/src/VirtualFluidsBasics/basics/objects/package.include
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/src/VirtualFluidsBasics/basics/utilities/UbComparators.h b/src/VirtualFluidsBasics/basics/utilities/UbComparators.h
new file mode 100644
index 0000000000000000000000000000000000000000..11f85e18b1cd63b0a5b0eb1f75e07d9fdb6e7aa6
--- /dev/null
+++ b/src/VirtualFluidsBasics/basics/utilities/UbComparators.h
@@ -0,0 +1,231 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 UbComparators.h
+//! \ingroup utilities
+//! \author Soeren Freudiger, Sebastian Geller
+//=======================================================================================
+#ifndef UBCOMPARATORS_H 
+#define UBCOMPARATORS_H
+
+#include <functional> 
+
+namespace UbComparators
+{
+   //type_traits 
+   template <typename T> struct MemberInfo; //not defined for correct compiler errors!
+
+   // specialization for MemberFunctionsPtr
+   // C - class with return T method
+   template <typename T, typename C> 
+   struct MemberInfo<T C::*> 
+   { 
+      typedef T type; 
+      typedef C class_type; 
+
+      static       T& apply(       C& c, T C::* ptr ) { return c.*ptr; } 
+      static const T& apply( const C& c, T C::* ptr ) { return c.*ptr; } 
+   }; 
+   //specialization for MemberFunctionsPtr
+   //C - class with return T method
+   template <typename T, typename C> 
+   struct MemberInfo<T (C::*)()> 
+   { 
+      typedef T type; 
+      typedef C class_type; 
+
+      static T apply( C& c, T (C::*ptr)() ) { return (c.*ptr)(); } 
+   }; 
+   //specialization for const MemberFunctionsPtr
+   //C - class with return T method
+   template <typename T, typename C> 
+   struct MemberInfo<T (C::*)() const> 
+   { 
+      typedef T type; 
+      typedef C class_type; 
+
+      static T apply( const C& c, T (C::*ptr)() const ) { return (c.*ptr)(); } 
+   }; 
+
+   //MemberComparative-Class
+   template <typename Ptr, typename Comp = std::less<typename MemberInfo<Ptr>::type> > 
+   class MemComp 
+      : private Comp  // -> usage of Empty Base Class Optimization (EBCO) 
+   { 
+      typedef typename MemberInfo<Ptr>::class_type C; 
+
+   public: 
+      MemComp( Ptr ptr, Comp c = Comp() ) 
+         : Comp(c), mp_(ptr) 
+      {} 
+
+      bool operator()(C& lhs, C& rhs) 
+      { 
+         return Comp::operator()( MemberInfo<Ptr>::apply(lhs, mp_), MemberInfo<Ptr>::apply(rhs, mp_) ); 
+      } 
+      bool operator()(C& lhs, C& rhs) const 
+      { 
+         return Comp::operator()( MemberInfo<Ptr>::apply(lhs, mp_), MemberInfo<Ptr>::apply(rhs, mp_) ); 
+      } 
+      bool operator()(const C& lhs, const C& rhs) 
+      { 
+         return Comp::operator()( MemberInfo<Ptr>::apply(lhs, mp_), MemberInfo<Ptr>::apply(rhs, mp_) ); 
+      } 
+      bool operator()(const C& lhs, const C& rhs) const 
+      { 
+         return Comp::operator()( MemberInfo<Ptr>::apply(lhs, mp_), MemberInfo<Ptr>::apply(rhs, mp_) ); 
+      } 
+
+   private: 
+      Ptr mp_; 
+   }; 
+
+   // Factoryfunktionen 
+   template <typename Ptr> 
+   MemComp<Ptr> membercomp(Ptr p) 
+   { 
+      return MemComp<Ptr>(p); 
+   } 
+
+   template<typename Comp, typename Ptr> 
+   MemComp<Ptr, Comp> membercomp(Ptr p, Comp c = Comp()) 
+   { 
+      return MemComp<Ptr, Comp>(p, c); 
+   } 
+
+   template<template<typename> class Comp, typename Ptr> 
+   MemComp<Ptr, Comp<typename MemberInfo<Ptr>::type> > 
+      membercomp(Ptr p, Comp<typename MemberInfo<Ptr>::type> c = Comp<typename MemberInfo<Ptr>::type>()) 
+   {
+      return MemComp<Ptr, Comp<typename MemberInfo<Ptr>::type> >(p, c); 
+   } 
+
+    
+   //////////////////////////////////////////////////////////////////////////
+   //////////////////////////////////////////////////////////////////////////
+   //////////////////////////////////////////////////////////////////////////
+   //andere Variante (alerdings ist hier keine Deduction moeglich!!!)
+   //////////////////////////////////////////////////////////////////////////
+   //Vergleichs-Templates:
+   //Funktor zum "non-const" Methodenvergleich: liste.sort( compareMethods<Klasse, int, &Klasse::getVal1  );
+   template<typename K/*Klasse*/, typename M /*MethodenRueckgabeTyp*/, M (K::*fct)() /*MethodenPointer*/> // Allgemeiner Fall
+   struct compareMethods
+   {
+      bool operator()(K& r, K& l) const // da fct nicht const ist, kann auch K nicht const sein. das const hinter der deklaration besagt dass compareMethods const sein kann
+      { return (r.*fct)() < (l.*fct)();  }
+   };
+   //////////////////////////////////////////////////////////////////////////
+   //Funktor zum "const" Methodenvergleich: liste.sort( compareMethods<Klasse, int, &Klasse::getVal1  );
+   template<typename K/*Klasse*/, typename M /*MethodenRueckgabeTyp*/, M (K::*fct)() const /*MethodenPointer*/> // <- hier const 
+   struct compareConstMethods
+   {
+      bool operator()(const K& r, const K& l) const //hier koennen die K's auch const sein, muessen sie aber nicht (const hinzufuegen geht ja problemlos)
+      { return (r.*fct)() < (l.*fct)();  }
+   };
+   //////////////////////////////////////////////////////////////////////////
+   //Funktor zum Membervergleich: lise.sort( compareMember<Klasse, int, &Klasse::member>() );
+   template<typename K/*Klasse*/, typename M /*MemberTyp*/, M (K::*Member) /*MemberPointer*/> // <- hier const 
+   struct compareMember
+   { 
+      bool operator()(const K& r,const K& l) const
+      { return r.*Member < l.*Member; } 
+   };
+   //Bsp:
+   //class Klasse{ 
+   //public: 
+   //   Klasse(double val1, double val2 ) : val1(val1),val2(val2) {} 
+   //   double getVal1()       { return val1; } 
+   //   double getVal2() const { return val2; } // <- hier const
+   //   double val1, val2; 
+   //}; 
+   //int main(int argc, char** argv){ 
+   //   std::list<Klasse> l; 
+   //   l.push_back( Klasse(10,10) ); 
+   //   l.push_back( Klasse(1,5)   ); 
+   //   l.sort( compareMember<Klasse, double,  &Klasse::val1 >() ); 
+   //   l.sort( compareMethods<Klasse, double,  &Klasse::getVal1 >() ); 
+   //   l.sort( compareConstMethods<Klasse, double,  &Klasse::getVal1 >() ); 
+   //} 
+
+};
+
+#endif //UBCOMPARATOR_H
+
+//example
+// #include <basics/utilities/UbComparators.h" 
+// #include <list> 
+// using namespace std; 
+// using namespace UbComparators; 
+// 
+// struct S { 
+//    S(int i) :x(i) {} 
+//    int x; 
+//    float f() {return x;}; 
+//    double g() const {return x;} 
+// }; 
+// 
+// struct intComp { 
+//    bool operator()(int l, int r) const 
+//    { return l > r; } 
+// }; 
+// 
+// struct dblComp { 
+//    bool operator()(double l,  double r) const 
+//    { return l > r; } 
+// }; 
+// 
+// template <typename T> 
+// struct genComp { 
+//    bool operator()(const T& l, const T& r) const
+//    { return l > r; } 
+// }; 
+// 
+// 
+// int main() 
+// { 
+//    S a(1); 
+//    S b(2); 
+//    list<S> sList; 
+//    sList.push_back(a); 
+//    sList.push_back(b); 
+//    sList.sort(UbComparators::membercomp(&S::x,intComp()));  //calls overload (1) 
+//    sList.sort(UbComparators::membercomp<intComp>(&S::x));   //same 
+//    sList.sort(UbComparators::membercomp(&S::x));            //calls overload (5) 
+//    sList.sort(UbComparators::membercomp<genComp>(&S::x));   //calls overload(3) 
+//    sList.sort(UbComparators::membercomp(&S::x, genComp<int>())); //calls overload(1) 
+//    //same for nonconst function 
+//    sList.sort(UbComparators::membercomp(&S::f, dblComp())); //overload(2) 
+//    sList.sort(UbComparators::membercomp<dblComp>(&S::f));   //same      
+//    sList.sort(UbComparators::membercomp(&S::f));            //overload(6) 
+//    sList.sort(UbComparators::membercomp<genComp>(&S::f));   //overload(4) 
+//    //same for const function 
+//    sList.sort(UbComparators::membercomp(&S::g, dblComp())); //overload(2) 
+//    sList.sort(UbComparators::membercomp<dblComp>(&S::g));   //same      
+//    sList.sort(UbComparators::membercomp(&S::g));            //overload(6) 
+//    sList.sort(UbComparators::membercomp<genComp>(&S::g));   //overload(4) 
+// } 
diff --git a/src/VirtualFluidsBasics/basics/utilities/UbEqual.h b/src/VirtualFluidsBasics/basics/utilities/UbEqual.h
new file mode 100644
index 0000000000000000000000000000000000000000..483e50a799c3afd1eab055bba3f243413774472c
--- /dev/null
+++ b/src/VirtualFluidsBasics/basics/utilities/UbEqual.h
@@ -0,0 +1,145 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 UbEqual.h
+//! \ingroup utilities
+//! \author Soeren Freudiger, Sebastian Geller
+//=======================================================================================
+#ifndef UBEQUAL_H
+#define UBEQUAL_H
+
+#include<cmath>
+
+//////////////////////////////////////////////////////////////////////////
+//
+//! \brief isUbEqual<T1,T2>(a,b)
+//! Compares the equality of values a and b.
+//!
+//! By default operator== is used for this.
+//!
+//! Execption: floating-point variables
+//! In these cases the type with higher precision is casted to the type of lower precision
+//! and then the two values are compared.
+//! e.g.: double d=1.2; int i=1; bool check = isUbEqual(d,i); -> true
+//!
+//! For classes operator== must be implemented for const objects!
+//! e.g.: bool operator==(const Test&) const { if(blabla) return true; else return false; }
+//
+//////////////////////////////////////////////////////////////////////////
+
+//std-trait, fuer alle nicht spezifischen typen:
+template < typename T1, typename T2 >
+struct UbEqualTrait
+{
+   typedef T1 High;
+   typedef T1 Low;
+};
+
+//std-trait, fuer gleiche T
+template < typename T >
+struct UbEqualTrait< T, T >
+{
+   typedef T High;
+   typedef T Low;
+};
+
+//spezialisierung für diverse Typen-Tuples
+template<> struct UbEqualTrait< short, int >          { typedef int         High; typedef short  Low; };
+template<> struct UbEqualTrait< short, long >         { typedef long        High; typedef short  Low; };
+template<> struct UbEqualTrait< short, float >        { typedef float       High; typedef short  Low; };
+template<> struct UbEqualTrait< short, double >       { typedef double      High; typedef short  Low; };
+template<> struct UbEqualTrait< short, long double >  { typedef long double High; typedef short  Low; };
+
+template<> struct UbEqualTrait< int, short >          { typedef int         High; typedef short  Low; };
+template<> struct UbEqualTrait< int, long >           { typedef long        High; typedef int    Low; };
+template<> struct UbEqualTrait< int, float >          { typedef float       High; typedef int    Low; };
+template<> struct UbEqualTrait< int, double >         { typedef double      High; typedef int    Low; };
+template<> struct UbEqualTrait< int, long double >    { typedef long double High; typedef int    Low; };
+
+template<> struct UbEqualTrait< long, short >         { typedef long        High; typedef short  Low; };
+template<> struct UbEqualTrait< long, int >           { typedef long        High; typedef int    Low; };
+template<> struct UbEqualTrait< long, float >         { typedef float       High; typedef long   Low; };
+template<> struct UbEqualTrait< long, double >        { typedef double      High; typedef long   Low; };
+template<> struct UbEqualTrait< long, long double >   { typedef long double High; typedef long   Low; };
+
+template<> struct UbEqualTrait< float, short >        { typedef float       High; typedef short  Low; };
+template<> struct UbEqualTrait< float, int >          { typedef float       High; typedef int    Low; };
+template<> struct UbEqualTrait< float, long >         { typedef float       High; typedef long   Low; };
+template<> struct UbEqualTrait< float, double >       { typedef double      High; typedef float  Low; };
+template<> struct UbEqualTrait< float, long double >  { typedef long double High; typedef float  Low; };
+
+template<> struct UbEqualTrait< double, short >       { typedef double      High; typedef short  Low; };
+template<> struct UbEqualTrait< double, int >         { typedef double      High; typedef int    Low; };
+template<> struct UbEqualTrait< double, long >        { typedef double      High; typedef long   Low; };
+template<> struct UbEqualTrait< double, float >       { typedef double      High; typedef float  Low; };
+template<> struct UbEqualTrait< double, long double > { typedef long double High; typedef double Low; };
+
+template<> struct UbEqualTrait< long double, short >  { typedef long double High; typedef short  Low; };
+template<> struct UbEqualTrait< long double, int >    { typedef long double High; typedef int    Low; };
+template<> struct UbEqualTrait< long double, long >   { typedef long double High; typedef long   Low; };
+template<> struct UbEqualTrait< long double, float >  { typedef long double High; typedef float  Low; };
+template<> struct UbEqualTrait< long double, double > { typedef long double High; typedef double Low; };
+
+//////////////////////////////////////////////////////////////////////////
+//fuer Allgmeine-Typen ( operator== ):
+template< typename T1, typename T2 >
+inline bool specific_equal(const T1& a, const T2& b) { return a==b; }
+
+//////////////////////////////////////////////////////////////////////////
+//fuer floating point build-in-type
+//float.float
+template< /*float,float*/>
+inline bool specific_equal< float, float >(const float& a, const float& b) {  return std::fabs( a - b ) < 1E-8; }
+
+template</*double,double*/>
+inline bool specific_equal< double, double >(const double& a, const double& b) { return std::fabs( a - b ) < 1E-13; }
+
+template</*long double,long double*/>
+inline bool specific_equal< long double, long double >(const long double& a, const long double& b) { return std::fabs( a - b ) < 1E-16; }
+
+//////////////////////////////////////////////////////////////////////////
+//globale isUbEqual - Funktion
+template< typename T1, typename T2 >
+inline bool isUbEqual(const T1& a, const T2& b)
+{
+   typedef typename UbEqualTrait<T1,T2>::Low Low;
+   return specific_equal< Low, Low >(static_cast< Low >( a ),static_cast< Low >( b ));
+};
+
+//////////////////////////////////////////////////////////////////////////
+//UbEqual-Functor
+template< typename T1, typename T2 >
+struct UbEqual
+{
+   bool operator()(const T1& a, const T2& b)
+   {
+      return isUbEqual(a,b);
+   }
+};
+
+#endif //UBEQUAL_H
diff --git a/src/VirtualFluidsBasics/basics/utilities/UbException.h b/src/VirtualFluidsBasics/basics/utilities/UbException.h
new file mode 100644
index 0000000000000000000000000000000000000000..cb8550c1e0523683440d13fff879111cf09c924f
--- /dev/null
+++ b/src/VirtualFluidsBasics/basics/utilities/UbException.h
@@ -0,0 +1,177 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 UbException.h
+//! \ingroup utilities
+//! \author Soeren Freudiger, Sebastian Geller
+//=======================================================================================
+#ifndef UBEXCEPTION_H
+#define UBEXCEPTION_H
+
+#include <vector>
+#include <iostream>
+#include <string>
+#include <sstream>
+#include <stdexcept>
+
+#include "./UbTuple.h"
+
+//=========================================================================
+//
+//! \brief UbException
+//! usage: UB_THROW( UbException("error message") );
+//!        UB_THROW( UbException(__FILE__, __LINE__,"error message") );
+//!        UB_THROW( UbException(__FILE__, __LINE__,UB_FUNCTION,"error message") );
+//!        UB_THROW( UbException(UB_EXARGS,"error") ); //same as above
+//
+//=========================================================================
+
+//Macro UB_FUNCTION: figures out the method/function name (platform dependant)
+#if defined(__GNUC__) || (defined(__MWERKS__) && (__MWERKS__ >= 0x3000)) || (defined(__ICC) && (__ICC >= 600))
+ # define UB_FUNCTION __PRETTY_FUNCTION__
+#elif defined(__DMC__) && (__DMC__ >= 0x810)
+ # define UB_FUNCTION __PRETTY_FUNCTION__
+#elif defined(__FUNCSIG__)
+ # define UB_FUNCTION __FUNCSIG__
+#elif (defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 600)) || (defined(__IBMCPP__) && (__IBMCPP__ >= 500))
+ # define UB_FUNCTION __FUNCTION__
+#elif defined(__BORLANDC__) && (__BORLANDC__ >= 0x550)
+ # define UB_FUNCTION __FUNC__
+#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901)
+ # define UB_FUNCTION __func__
+#else
+ # define UB_FUNCTION "(unknown)"
+#endif
+
+//Helper Marco
+#define UB_EXARGS __FILE__,__LINE__,UB_FUNCTION
+
+#ifdef CAB_BOOST
+   #define UB_THROW(e) throw boost::enable_current_exception(e)
+#else
+   #define UB_THROW(e) throw e
+#endif
+
+class UbException : public std::runtime_error
+{
+public:
+   typedef UbTuple< std::string, int, std::string, std::string > ExceptionData;
+public:
+   //////////////////////////////////////////////////////////////////////////
+   //constructors
+   UbException()
+      : std::runtime_error("")
+   { 
+   }
+   /*==========================================================*/
+   UbException(const std::string& str)
+      : std::runtime_error("")
+   {
+      this->addInfo(str);		
+   }
+   /*==========================================================*/
+   UbException(const std::string& file, const int& line, const std::string& err_str)
+      : std::runtime_error("")
+   {
+      this->addInfo(file,line,"unknown",err_str);		
+   }
+   /*==========================================================*/
+   //UbException(const char* file, const int& line, const char* function, const std::string& err_str)
+   UbException(const std::string& file, const int& line, const std::string& function, const std::string& err_str)
+      : std::runtime_error("")
+   {
+      this->addInfo(file,line,function,err_str);		
+   }
+   //////////////////////////////////////////////////////////////////////////
+   //destructor
+   virtual ~UbException() throw() { }
+   //////////////////////////////////////////////////////////////////////////
+   //virtual public methods
+   //returns  exception-string
+   virtual const char* what() const throw()
+   {
+      exceptionString = this->toString();
+      return exceptionString.c_str();  //ansonsten ist das Verhalten anschließend undefiniert!
+   }
+   /*==========================================================*/
+   virtual void addInfo(const std::string& err_str)	 
+   { 
+      exceptionData.push_back( makeUbTuple( (std::string)"-", 0, (std::string)"unknown", err_str) ); 
+   }
+   /*==========================================================*/
+   //add exception
+   virtual void addInfo(const std::string& file, const int& line, const std::string& function, const std::string& err_str)	 
+   { 
+      exceptionData.push_back( makeUbTuple( file, line, function, err_str ) ); 
+   }
+   /*==========================================================*/
+   //returns exception-string with all calles exceptions
+   virtual const std::vector<std::string> getInfo() const
+   { 
+      std::vector<std::string> tmp;
+      for(std::size_t i=0; i<exceptionData.size(); i++)
+      {
+         std::stringstream str;
+         str << val<1>( exceptionData[i] ) << ", " 
+             << val<2>( exceptionData[i] ) << ", " 
+             << val<3>( exceptionData[i] ) << ", " 
+             << val<4>( exceptionData[i] );
+         tmp.push_back( str.str());
+      }
+      return tmp; 
+   }
+   /*==========================================================*/
+   //returns exception-string with all calles exceptions and detailes informations
+   virtual std::string toString() const
+   { 
+      std::stringstream str("UbExeption");
+      
+      for(std::size_t i=0; i<exceptionData.size(); i++)
+         str<<(std::string)"caller[" << i << "]\n"
+            <<"  - file:     "<< val<1>( exceptionData[i] )<<"\n"
+            <<"  - line:     "<< val<2>( exceptionData[i] )<<"\n"
+            <<"  - function: "<< val<3>( exceptionData[i] )<<"\n"
+            <<"  - what:     "<< val<4>( exceptionData[i] )<< std::endl; 
+
+      return str.str();
+   }
+
+protected:
+   //////////////////////////////////////////////////////////////////////////
+   //protected member
+   std::vector< ExceptionData > exceptionData;
+   mutable std::string exceptionString;
+};
+
+//overlading operator <<
+inline std::ostream& operator<<(std::ostream& os, const UbException& e)
+{
+   return os<<e.toString();
+}
+
+#endif //UBEXCEPTION_H
diff --git a/src/VirtualFluidsBasics/basics/utilities/UbInfinity.h b/src/VirtualFluidsBasics/basics/utilities/UbInfinity.h
new file mode 100644
index 0000000000000000000000000000000000000000..eebaf14166552ccbe4a23a516d28d2594c87494f
--- /dev/null
+++ b/src/VirtualFluidsBasics/basics/utilities/UbInfinity.h
@@ -0,0 +1,210 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 UbInfinity.h
+//! \ingroup utilities
+//! \author Soeren Freudiger, Sebastian Geller
+//=======================================================================================
+#ifndef UB_INFINITY_H
+#define UB_INFINITY_H
+#include <limits>
+
+#include <basics/utilities/UbLimits.h>
+#include <basics/utilities/UbSystem.h>
+
+//////////////////////////////////////////////////////////////////////////
+//!
+//!  \brief UbNegInfinity
+//!  \details Note: The UbNegInfinity class cannot be instantiated on its own, but works 
+//!        as a base class for the Infinity class.
+//!
+//////////////////////////////////////////////////////////////////////////
+
+class UbNegInfinity
+{
+ public:
+   //name Conversion operators 
+   inline operator signed char() const { return UbLimits<signed char>::ninf(); }
+   inline operator char()        const { return UbLimits<char>::ninf();        }
+   inline operator wchar_t()     const { return UbLimits<wchar_t>::ninf();     }
+   inline operator short()       const { return UbLimits<short>::ninf();       }
+   inline operator int()         const { return UbLimits<int>::ninf();         }
+   inline operator long()        const { return UbLimits<long>::ninf();        }
+   inline operator float()       const { return UbLimits<float>::ninf();       }
+   inline operator double()      const { return UbLimits<double>::ninf();      }
+   inline operator long double() const { return UbLimits<long double>::ninf(); }
+
+   //! This function compares built-in data types with their largest possible value. The function
+   //! only works for built-in data types. The attempt to compare user-defined class types will
+   //! result in a compile time error.
+   template< typename T >
+   inline bool equal( const T& rhs ) const
+   {
+      UB_STATIC_ASSERT( std::numeric_limits<T>::is_specialized );
+      return UbLimits<T>::ninf() == rhs;
+   }
+ protected:
+    inline UbNegInfinity() {}
+
+ private:
+   UbNegInfinity( const UbNegInfinity& ninf );             //copy constructor (private & undefined)
+   UbNegInfinity& operator=( const UbNegInfinity& ninf );  //copy assignment operator (private & undefined)
+   void* operator&() const;                                //address operator (private & undefined)
+};
+
+//=================================================================================================
+//
+//  GLOBAL OPERATORS
+//
+//=================================================================================================
+template< typename T >
+inline bool operator==( const UbNegInfinity& lhs, const T& rhs )
+{
+   return lhs.equal( rhs );
+}
+//*************************************************************************************************
+template< typename T >
+inline bool operator==( const T& lhs, const UbNegInfinity& rhs )
+{
+   return rhs.equal( lhs );
+}
+//*************************************************************************************************
+template< typename T >
+inline bool operator!=( const UbNegInfinity& lhs, const T& rhs )
+{
+   return !lhs.equal( rhs );
+}
+//*************************************************************************************************
+template< typename T >
+inline bool operator!=( const T& lhs, const UbNegInfinity& rhs )
+{
+   return !rhs.equal( lhs );
+}
+
+//////////////////////////////////////////////////////////////////////////
+//
+//  UbInfinity
+//
+//////////////////////////////////////////////////////////////////////////
+class UbInfinity : public UbNegInfinity //um später -UbInfinity leichter zu implementieren!!!
+{
+ public:
+   inline UbInfinity() 
+      : UbNegInfinity()
+    {}
+   
+   inline operator unsigned char()  const  { return UbLimits<unsigned char>::inf();  }
+   inline operator signed char()    const  { return UbLimits<signed char>::inf();    }
+   inline operator char()           const  { return UbLimits<char>::inf();           }
+   inline operator wchar_t()        const  { return UbLimits<wchar_t>::inf();        }
+   inline operator unsigned short() const  { return UbLimits<unsigned short>::inf(); }
+   inline operator short()          const  { return UbLimits<short>::inf();          }
+   inline operator unsigned int()   const  { return UbLimits<unsigned int>::inf();   }
+   inline operator int()            const  { return UbLimits<int>::inf();            }
+   inline operator unsigned long()  const  { return UbLimits<unsigned long>::inf();  }
+   inline operator long()           const  { return UbLimits<long>::inf();           }
+   inline operator float()          const  { return UbLimits<float>::inf();          }
+   inline operator double()         const  { return UbLimits<double>::inf();         }
+   inline operator long double()    const  { return UbLimits<long double>::inf();    }
+
+   inline const UbNegInfinity& operator-() const { return static_cast<const UbNegInfinity&>( *this ); }
+
+   /*==========================================================*/
+   template< typename T >
+   inline bool equal( const T& rhs ) const
+   {
+      UB_STATIC_ASSERT( std::numeric_limits<T>::is_specialized );
+      return UbLimits<T>::inf() == rhs;
+   }
+
+ private:
+   UbInfinity( const UbInfinity& inf );             //Copy constructor (private & undefined)
+   UbInfinity& operator=( const UbInfinity& inf );  //Copy assignment operator (private & undefined)
+   void* operator&() const;                         //Address operator (private & undefined)
+};
+
+//////////////////////////////////////////////////////////////////////////
+//  GLOBAL OPERATORS
+//////////////////////////////////////////////////////////////////////////
+template< typename T >
+inline bool operator==( const UbInfinity& lhs, const T& rhs );
+
+template< typename T >
+inline bool operator==( const T& lhs, const UbInfinity& rhs );
+
+template< typename T >
+inline bool operator!=( const UbInfinity& lhs, const T& rhs );
+
+template< typename T >
+inline bool operator!=( const T& lhs, const UbInfinity& rhs );
+//@}
+//*************************************************************************************************
+
+
+//*************************************************************************************************
+/*!\brief Equality comparison between an Infinity object and a built-in data type.
+// \ingroup util
+//
+// This operator works only for built-in data types. The attempt to compare user-defined class
+// types will result in a compile time error.
+*/
+template< typename T >
+inline bool operator==( const UbInfinity& lhs, const T& rhs )
+{
+   return lhs.equal( rhs );
+}
+//*************************************************************************************************
+template< typename T >
+inline bool operator==( const T& lhs, const UbInfinity& rhs )
+{
+   return rhs.equal( lhs );
+}
+//*************************************************************************************************
+template< typename T >
+inline bool operator!=( const UbInfinity& lhs, const T& rhs )
+{
+   return !lhs.equal( rhs );
+}
+//*************************************************************************************************
+template< typename T >
+inline bool operator!=( const T& lhs, const UbInfinity& rhs )
+{
+   return !rhs.equal( lhs );
+}
+//*************************************************************************************************
+
+//////////////////////////////////////////////////////////////////////////
+//  GLOBAL INFINITY VALUE
+//////////////////////////////////////////////////////////////////////////
+namespace Ub
+{
+   //e.g. double x = UbSystem::inf;  float x = -Ub::inf; 
+   const UbInfinity inf; 
+} 
+
+#endif //UB_INFINITY_H
diff --git a/src/VirtualFluidsBasics/basics/utilities/UbKeys.h b/src/VirtualFluidsBasics/basics/utilities/UbKeys.h
new file mode 100644
index 0000000000000000000000000000000000000000..1ee57815043ec3a36522e956435db0c78e276bd4
--- /dev/null
+++ b/src/VirtualFluidsBasics/basics/utilities/UbKeys.h
@@ -0,0 +1,304 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 UbKeys.h
+//! \ingroup utilities
+//! \author Soeren Freudiger, Sebastian Geller
+//=======================================================================================
+#ifndef UBKEYS_H
+#define UBKEYS_H
+
+#include <iostream>
+
+
+#ifdef CAB_RCF
+   #include <3rdParty/rcf/RcfSerializationIncludes.h>
+#endif //CAB_RCF
+
+//////////////////////////////////////////////////////////////////////////
+//!
+//!  \brief 
+//!  namespace for global Keys (e.g. for STL-maps)
+//!
+//////////////////////////////////////////////////////////////////////////
+
+namespace UbKeys
+{
+   //nested class
+   template< typename T1, typename T2 = T1 >
+   class Key2 
+   {
+   public:
+      //////////////////////////////////////////////////////////////////////////
+      //Konstruktoren
+      Key2(const T1& t1, const T2& t2) 
+         : t1(t1), t2(t2)
+      { 
+      }
+      /*==========================================================*/
+      Key2& operator=(const Key2& srcKey) 
+      {
+         if(this == &srcKey ) return *this;
+
+         t1    = srcKey.t1;
+         t2    = srcKey.t2;
+
+         return *this;
+      }
+      /*==========================================================*/
+      T1 getT1() const { return t1; }
+      T2 getT2() const { return t2; }
+
+      //////////////////////////////////////////////////////////////////////////
+      //global ueberladene Operatoren
+      friend inline bool operator<(const Key2& lhsKey,const Key2& rhsKey)  
+      {
+         if( lhsKey.t1 < rhsKey.t1 ) return true;
+         if( lhsKey.t1 > rhsKey.t1 ) return false;
+         if( lhsKey.t2 < rhsKey.t2 ) return true;
+
+         return false;
+      }
+      /*==========================================================*/
+      friend inline bool operator==(const Key2& lhsKey, const Key2& rhsKey)  
+      {
+         if(lhsKey.t1 != rhsKey.t1 ) return false;
+         if(lhsKey.t2 != rhsKey.t2 ) return false;
+
+         return true;
+      }
+      //ueberladene Operatoren
+      friend inline bool operator!=(const Key2& lhsKey, const Key2& rhsKey)  
+      {
+         return !(lhsKey == rhsKey); 
+      }
+      //ueberladene Operatoren
+      /*==========================================================*/
+      friend inline std::ostream& operator << (std::ostream& os, const Key2& key) 
+      {
+         os<<"Key2<"<<typeid(T1).name()<<","<<typeid(T2).name()<<">,("<<key.t1<<","<<key.t2<<")";
+         return os;
+      }
+      /*==========================================================*/
+      #ifdef CAB_RCF
+	      template<class Archive>
+	      void serialize(Archive & ar, const unsigned int version)
+	      {
+		      ar & t1;
+		      ar & t2;
+	      }
+      #endif //CAB_RCF
+
+   private:
+      //////////////////////////////////////////////////////////////////////////
+      //private Member
+      T1 t1;
+      T2 t2;
+
+   };
+
+   //////////////////////////////////////////////////////////////////////////
+   //
+   //////////////////////////////////////////////////////////////////////////
+   template< typename T1, typename T2 = T1, typename T3 = T1 >
+   class Key3 
+   {
+   public:
+      //////////////////////////////////////////////////////////////////////////
+      //Konstruktoren
+      Key3() : t1(0), t2(0), t3(0)
+      {
+
+      }
+      Key3(const T1& t1, const T2& t2, const T3& t3) 
+         : t1(t1), t2(t2), t3(t3)
+      { 
+      }
+      /*==========================================================*/
+      T1 getT1() const { return t1; }
+      T2 getT2() const { return t2; }
+      T3 getT3() const { return t3; }
+      /*==========================================================*/
+      Key3& operator=(const Key3& srcKey) 
+      {
+         if(this == &srcKey ) return *this;
+
+         t1    = srcKey.t1;
+         t2    = srcKey.t2;
+         t3    = srcKey.t3;
+
+         return *this;
+      }
+
+      //////////////////////////////////////////////////////////////////////////
+      //global ueberladene Operatoren
+      friend inline bool operator<(const Key3& lhsKey,const Key3& rhsKey)  
+      {
+         if( lhsKey.t1 < rhsKey.t1 ) return true;
+         if( lhsKey.t1 > rhsKey.t1 ) return false;
+         if( lhsKey.t2 < rhsKey.t2 ) return true;
+         if( lhsKey.t2 > rhsKey.t2 ) return false;
+         if( lhsKey.t3 < rhsKey.t3 ) return true;
+
+         return false;
+      }
+      /*==========================================================*/
+      friend inline bool operator==(const Key3& lhsKey,const Key3& rhsKey)  
+      {
+         if(lhsKey.t1 != rhsKey.t1 ) return false;
+         if(lhsKey.t2 != rhsKey.t2 ) return false;
+         if(lhsKey.t3 != rhsKey.t3 ) return false;
+
+         return true;
+      }
+      /*==========================================================*/
+      //ueberladene Operatoren
+      friend inline bool operator!=(const Key3& lhsKey, const Key3& rhsKey) 
+      {
+         return !(lhsKey == rhsKey); 
+      }
+
+      //ueberladene Operatoren
+      /*==========================================================*/
+      friend inline std::ostream& operator << (std::ostream& os, const Key3& key) 
+      {
+         os<<"Key3<"<<typeid(T1).name()<<","<<typeid(T2).name()<<","<<typeid(T3).name();
+         os<<">,("<<key.t1<<","<<key.t2<<","<<key.t3<<")";
+         return os;
+      }
+      /*==========================================================*/
+      #ifdef CAB_RCF
+	      template<class Archive>
+	      void serialize(Archive & ar, const unsigned int version)
+	      {
+		      ar & t1;
+		      ar & t2;
+            ar & t3;
+         }
+      #endif //CAB_RCF
+
+   private:
+      //////////////////////////////////////////////////////////////////////////
+      //private Member
+      T1 t1;
+      T2 t2;
+      T3 t3;
+   };
+
+   //////////////////////////////////////////////////////////////////////////
+   //
+   //////////////////////////////////////////////////////////////////////////
+   template< typename T1, typename T2 = T1, typename T3 = T1, typename T4 = T1 >
+   class Key4 
+   {
+   public:
+      //////////////////////////////////////////////////////////////////////////
+      //Konstruktoren
+      Key4(const T1& t1, const T2& t2, const T3& t3, const T4& t4) 
+         : t1(t1), t2(t2), t3(t3), t4(t4)
+      { 
+      }
+      /*==========================================================*/
+      T1 getT1() const { return t1; }
+      T2 getT2() const { return t2; }
+      T3 getT3() const { return t3; }
+      T4 getT4() const { return t4; }
+      /*==========================================================*/
+      Key4& operator=(const Key4& srcKey) 
+      {
+         if(this == &srcKey ) return *this;
+
+         t1    = srcKey.t1;
+         t2    = srcKey.t2;
+         t3    = srcKey.t3;
+         t4    = srcKey.t4;
+
+         return *this;
+      }
+      //////////////////////////////////////////////////////////////////////////
+      //global ueberladene Operatoren
+      friend inline bool operator<(const Key4& lhsKey,const Key4& rhsKey)  
+      {
+         if( lhsKey.t1 < rhsKey.t1 ) return true;
+         if( lhsKey.t1 > rhsKey.t1 ) return false;
+         if( lhsKey.t2 < rhsKey.t2 ) return true;
+         if( lhsKey.t2 > rhsKey.t2 ) return false;
+         if( lhsKey.t3 < rhsKey.t3 ) return true;
+         if( lhsKey.t3 > rhsKey.t3 ) return false;
+         if( lhsKey.t4 < rhsKey.t4 ) return true;
+
+         return false;
+      }
+      /*==========================================================*/
+      friend inline bool operator==(const Key4& lhsKey,const Key4& rhsKey)  
+      {
+         if(lhsKey.t1 != rhsKey.t1 ) return false;
+         if(lhsKey.t2 != rhsKey.t2 ) return false;
+         if(lhsKey.t3 != rhsKey.t3 ) return false;
+         if(lhsKey.t4 != rhsKey.t4 ) return false;
+
+         return true;
+      }
+
+      //ueberladene Operatoren
+      friend inline bool operator!=(const Key4& lhsKey, const Key4& rhsKey) 
+      {
+         return !(lhsKey == rhsKey); 
+      }
+      //ueberladene Operatoren
+      /*==========================================================*/
+      friend inline std::ostream& operator << (std::ostream& os, const Key4& key) 
+      {
+         os<<"Key4<"<<typeid(T1).name()<<","<<typeid(T2).name()<<","<<typeid(T3).name()<<","<<typeid(T4).name();
+         os<<">,("<<key.t1<<","<<key.t2<<","<<key.t3<<","<<key.t4<<")";
+         return os;
+      }
+      /*==========================================================*/
+      #ifdef CAB_RCF
+	      template<class Archive>
+	      void serialize(Archive & ar, const unsigned int version)
+	      {
+		      ar & t1;
+		      ar & t2;
+            ar & t3;
+            ar & t4;
+         }
+      #endif //CAB_RCF
+
+   private:
+      //////////////////////////////////////////////////////////////////////////
+      //private Member
+      T1 t1;
+      T2 t2;
+      T3 t3;
+      T4 t4;
+
+   };
+}
+
+#endif //UBKEYS_H
diff --git a/src/VirtualFluidsBasics/basics/utilities/UbLimits.h b/src/VirtualFluidsBasics/basics/utilities/UbLimits.h
new file mode 100644
index 0000000000000000000000000000000000000000..6a2aa9cdbdf4a290571bad4b96796cd5646f4fb3
--- /dev/null
+++ b/src/VirtualFluidsBasics/basics/utilities/UbLimits.h
@@ -0,0 +1,165 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 UbLimits.h
+//! \ingroup utilities
+//! \author Soeren Freudiger, Sebastian Geller
+//=======================================================================================
+#ifndef UB_LIMITS_H
+#define UB_LIMITS_H
+
+
+//*************************************************************************************************
+// Includes
+//*************************************************************************************************
+
+#include <limits>
+
+//////////////////////////////////////////////////////////////////////////
+//  CLASS DEFINITION
+//////////////////////////////////////////////////////////////////////////
+template< typename T >
+struct UbLimits  {};
+
+//////////////////////////////////////////////////////////////////////////
+//  SPECIALIZATIONS
+//////////////////////////////////////////////////////////////////////////
+template<>
+struct UbLimits<unsigned char>
+{
+   //return the largest possible positive unsigned char value
+   static inline unsigned char inf() { return std::numeric_limits<unsigned char>::max(); }
+};
+//*************************************************************************************************
+template<>
+struct UbLimits<char>
+{
+   //return the largest possible positive char value. */
+   static inline char inf () { return std::numeric_limits<char>::max(); }
+   //return the largest possible negative char value
+   static inline char ninf() { return std::numeric_limits<char>::min(); }
+};
+//*************************************************************************************************
+template<>
+struct UbLimits<signed char>
+{
+   //return the largest possible positive signed char value
+   static inline signed char inf () { return std::numeric_limits<signed char>::max(); }
+
+   //return The largest possible negative signed char value
+   static inline signed char ninf() { return std::numeric_limits<signed char>::min(); }
+};
+//*************************************************************************************************
+template<>
+struct UbLimits<wchar_t>
+{
+   //return The largest possible positive wchar_t value
+   static inline wchar_t inf () { return std::numeric_limits<wchar_t>::max(); }
+   //return The largest possible negative wchar_t value
+   static inline wchar_t ninf() { return std::numeric_limits<wchar_t>::min(); }
+};
+//*************************************************************************************************
+template<>
+struct UbLimits<unsigned short>
+{
+   //return The largest possible positive unsigned short value
+   static inline unsigned short inf() { return std::numeric_limits<unsigned short>::max(); }
+};
+//*************************************************************************************************
+template<>
+struct UbLimits<short>
+{
+   //return The largest possible positive short value
+   static inline short inf () { return std::numeric_limits<short>::max(); }
+   //return The largest possible negative short value
+   static inline short ninf() { return std::numeric_limits<short>::min(); }
+};
+//*************************************************************************************************
+template<>
+struct UbLimits<unsigned int>
+{
+   //return The largest possible positive unsigned int value
+   static inline unsigned int inf() { return std::numeric_limits<unsigned int>::max(); }
+};
+//*************************************************************************************************
+template<>
+struct UbLimits<int>
+{
+   //return The largest possible positive int value
+   static inline int inf () { return std::numeric_limits<int>::max(); }
+
+   //return The largest possible negative int value
+   static inline int ninf() { return std::numeric_limits<int>::min(); }
+};
+//*************************************************************************************************
+template<>
+struct UbLimits<unsigned long>
+{
+   //return The largest possible positive unsigned long value
+   static inline unsigned long inf() { return std::numeric_limits<unsigned long>::max(); }
+};
+//*************************************************************************************************
+template<>
+struct UbLimits<long>
+{
+   //return The largest possible positive long value
+   static inline long inf () { return std::numeric_limits<long>::max(); }
+
+   //return The largest possible negative long value
+   static inline long ninf() { return std::numeric_limits<long>::min(); }
+};
+//*************************************************************************************************
+template<>
+struct UbLimits<float>
+{
+   //return The largest possible positive float value
+   static inline float inf () { return  std::numeric_limits<float>::max(); }
+
+   //return The largest possible negative float value
+   static inline float ninf() { return -std::numeric_limits<float>::max(); }
+};
+//*************************************************************************************************
+template<>
+struct UbLimits<double>
+{
+   //return The largest possible positive double value
+   static inline double inf () { return  std::numeric_limits<double>::max(); }
+   //return The largest possible negative double value
+   static inline double ninf() { return -std::numeric_limits<double>::max(); }
+};
+//*************************************************************************************************
+template<>
+struct UbLimits<long double>
+{
+   //return The largest possible positive long double value
+   static inline long double inf () { return  std::numeric_limits<long double>::max(); }
+   //return The largest possible negative long double value
+   static inline long double ninf() { return -std::numeric_limits<long double>::max(); }
+};
+
+#endif //UB_LIMITS_H
diff --git a/src/VirtualFluidsBasics/basics/utilities/UbLogger.cpp b/src/VirtualFluidsBasics/basics/utilities/UbLogger.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..a02a1aa15c28410aadaa25466177f0db620383df
--- /dev/null
+++ b/src/VirtualFluidsBasics/basics/utilities/UbLogger.cpp
@@ -0,0 +1,40 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 UbLogger.cpp
+//! \ingroup utilities
+//! \author Soeren Freudiger, Sebastian Geller
+//=======================================================================================
+#include <basics/utilities/UbLogger.h>
+
+#if defined(CAB_BOOST) && !defined(NO_THREADSAFE_LOGGING)
+
+boost::mutex Output2Stream::mtx;
+
+#endif // CAB_BOOST
+
diff --git a/src/VirtualFluidsBasics/basics/utilities/UbLogger.h b/src/VirtualFluidsBasics/basics/utilities/UbLogger.h
new file mode 100644
index 0000000000000000000000000000000000000000..266ac1f6be415dfe05ca3796c1b4fbd6f2790fda
--- /dev/null
+++ b/src/VirtualFluidsBasics/basics/utilities/UbLogger.h
@@ -0,0 +1,401 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 UbLogger.h
+//! \ingroup utilities
+//! \author Soeren Freudiger, Sebastian Geller
+//=======================================================================================
+#ifndef UBLOGGER_H
+#define UBLOGGER_H
+
+#include <sstream>
+#include <string>
+#include <iostream>
+#include <fstream>
+#include <iomanip>
+
+#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__)  || defined(_WIN64)  || defined(__WIN64__)
+   #include <windows.h>
+#else
+   #include <sys/time.h>
+#endif
+
+#if defined(CAB_BOOST) && !defined(NO_THREADSAFE_LOGGING)
+   #include <boost/thread.hpp>
+#endif // CAB_BOOST
+
+
+
+enum LogLevel {logERROR, logWARNING, logINFO, logDEBUG, logDEBUG1, logDEBUG2, logDEBUG3, logDEBUG4, logDEBUG5};
+
+//////////////////////////////////////////////////////////////////////////
+// template <typename OutputPolicy> class Log  - declaration
+//////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////
+//!
+//! \brief 
+//! C++ Logger
+//! \details Functionality:
+//! Per logentry an object of type UbLogger is generated, the log string is passed to this object and
+//! upon destruction of the object the string is written to a file or the screen depending on 
+//! the policy (=template paramter). Multiple log level are supported.
+//!
+//! helpermakro:  UBLOG
+//!
+//! Example 1: 
+//! \code
+//! UBLOG(logINFO) << "Klasse::foo entered"; //endl is not required 
+//! \endcode
+//!
+//! Example 2: 
+//! \code
+//! try
+//! {
+//!    UbLog::reportingLevel() = UbLog::logLevelFromString("DEBUG3");
+//!    //UbLog::output_policy::setStream(&std::cerr); //<- clog is stdandard
+//!    UbLog::output_policy::setStream("c:/temp/out.txt");  //you can not open these -> error message -> log is output in cerr
+//! 
+//!    int count = 3;
+//!    UBLOG(logINFO, "A loop with " << count << " iterations");
+//!    for (int i = 0; i != count; ++i)
+//!    {
+//!        UBLOG(logERROR , "error  - the counter i = " << i );
+//!        UBLOG(logDEBUG1, "debug1 - the counter i = " << i );
+//!        UBLOG(logDEBUG2, "debug2 - the counter i = " << i );
+//!        UBLOG(logDEBUG3, "debug3 - the counter i = " << i );
+//!        //for MultiLine entries: -> formatting in logfile
+//!        UBLOGML(logDEBUG3, "debug3 - the counter i = "<<endl<<" 2 zeile "<< "3. Zeile" << i);
+//!        UBLOGML(logDEBUG3, "debug3 - the counter i = "<<endl<<" 2 zeile "<< "3. Zeile" << i);
+//!        UBLOG2ML(logDEBUG3,std:cout,"debug3 - the counter i = "<<endl<<" 2 zeile "<< "3. Zeile" << i);
+//!    }
+//!    return 0;
+//! }
+//! catch(const std::exception& e)
+//! {
+//!    UBLOG(logERROR) << e.what();
+//! }
+//! \endcode
+//! Idee based on: 
+//! Paper by Dr. Dobbs Portal,
+//! September 05, 2007,
+//! Logging In C++
+//!
+//////////////////////////////////////////////////////////////////////////
+template <typename OutputPolicy>
+class UbLogger
+{   
+public:
+   typedef OutputPolicy output_policy;
+public:
+    UbLogger();
+    virtual ~UbLogger();
+    std::ostringstream& get(const LogLevel& level = logINFO);
+public:
+   //static, weil man so später die ObjErstellunge ersparen kann,
+   //falls level kleiner als Level
+   static LogLevel&   reportingLevel();
+    
+    static std::string logLevelToString(const LogLevel& level);
+    static LogLevel    logLevelFromString(const std::string& level);
+
+    static std::string logTimeString();
+
+protected:
+    std::ostringstream os;
+
+private:
+    UbLogger(const UbLogger&);
+    UbLogger& operator =(const UbLogger&);
+};
+
+//////////////////////////////////////////////////////////////////////////
+// template <typename OutputPolicy> class Log  - implementation
+//////////////////////////////////////////////////////////////////////////
+template <typename OutputPolicy>
+UbLogger<OutputPolicy>::UbLogger()
+{
+}
+/*==========================================================*/
+template <typename OutputPolicy>
+std::ostringstream& UbLogger<OutputPolicy>::get(const LogLevel& level) 
+{
+   os << logTimeString() << " " << std::setw(6) 
+#if defined(CAB_BOOST) && !defined(NO_MT_LOGGING)
+      <<boost::this_thread::get_id() << " "
+#endif
+      << std::setw(8) << std::left << UbLogger<OutputPolicy>::logLevelToString(level) << ": "
+      << std::string(level > logDEBUG ? 3*(level - logDEBUG) : 0, ' '); //<baumartiger output :D
+   
+    return os;
+}
+/*==========================================================*/
+template <typename OutputPolicy>
+UbLogger<OutputPolicy>::~UbLogger()
+{
+    os << std::endl;
+    OutputPolicy::output(os.str());
+}
+/*==========================================================*/
+template <typename OutputPolicy>
+LogLevel& UbLogger<OutputPolicy>::reportingLevel()
+{
+    static LogLevel reportLevel = logINFO;
+    return reportLevel;
+}
+/*==========================================================*/
+template <typename OutputPolicy>
+std::string UbLogger<OutputPolicy>::logLevelToString(const LogLevel& level)
+{
+   static std::string const buffer[] = {"ERROR", "WARNING", "INFO", "DEBUG", "DEBUG1", "DEBUG2", "DEBUG3", "DEBUG4", "DEBUG5"};
+   return buffer[level];
+}
+/*==========================================================*/
+template <typename OutputPolicy>
+LogLevel UbLogger<OutputPolicy>::logLevelFromString(const std::string& level)
+{
+   if (level == "DEBUG5" ) return logDEBUG5;
+   if (level == "DEBUG4" ) return logDEBUG4;
+   if (level == "DEBUG3" ) return logDEBUG3;
+   if (level == "DEBUG2" ) return logDEBUG2;
+   if (level == "DEBUG1" ) return logDEBUG1;
+   if (level == "DEBUG"  ) return logDEBUG;
+   if (level == "INFO"   ) return logINFO;
+   if (level == "WARNING") return logWARNING;
+   if (level == "ERROR"  ) return logERROR;
+       
+   UbLogger<OutputPolicy>().get(logWARNING) << "UbLogger<OutputPolicy>::logLevelFromString(level) - unknown logging level '" << level << "'. Using INFO level as default.";
+   return logINFO;
+}
+
+//////////////////////////////////////////////////////////////////////////
+// logTimeString
+//////////////////////////////////////////////////////////////////////////
+#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__)  || defined(_WIN64)  || defined(__WIN64__)
+template <typename OutputPolicy>
+inline std::string UbLogger<OutputPolicy>::logTimeString()
+{
+   const int MAX_LEN = 200;
+   char buffer[MAX_LEN];
+   if (GetTimeFormatA(LOCALE_USER_DEFAULT, 0, 0, "HH':'mm':'ss", buffer, MAX_LEN) == 0 )
+   {
+      return "Error in std::string UbLogger<OutputPolicy>::logTimeString()";
+   }
+
+   char result[100] = {0};
+   static DWORD first = GetTickCount();
+   std::sprintf(result, "%s.%03ld", buffer, (long)(GetTickCount() - first) % 1000); 
+   return result;
+}
+#else
+template <typename OutputPolicy>
+inline std::string UbLogger<OutputPolicy>::logTimeString()
+{
+   char buffer[11];
+   time_t t;
+   time(&t);
+   tm r = {0};
+   strftime(buffer, sizeof(buffer), "%X", localtime_r(&t, &r));
+   struct timeval tv;
+   gettimeofday(&tv, 0);
+   char result[100] = {0};
+   std::sprintf(result, "%s.%03ld", buffer, (long)tv.tv_usec / 1000); 
+   return result;
+}
+#endif 
+
+
+//////////////////////////////////////////////////////////////////////////
+//! Implementation of OutputPolicy)
+//////////////////////////////////////////////////////////////////////////
+class Output2Stream // implementation of OutputPolicy
+{
+public:
+   static std::ostream*& getStream();
+   static void output(const std::string& msg);
+   
+   //!creates output-file-stream (of file opening fails -> stream is set to std::cerr)
+   static void setStream(const std::string& filename);
+   
+   //!direct set outputstream, gcControl = true -> object will be deleted by Output2Stream 
+   static void setStream(std::ostream* pStream, const bool& gcControl = false);
+
+protected:
+#if defined(CAB_BOOST) && !defined(NO_MT_LOGGING)
+   static boost::mutex mtx;
+#endif
+};
+/*==========================================================*/
+inline std::ostream*& Output2Stream::getStream()
+{
+   static std::ostream* pStream = &std::clog;
+   return pStream;
+}
+/*==========================================================*/
+inline void Output2Stream::setStream(std::ostream* pFile, const bool& gcControl)
+{
+#if defined(CAB_BOOST) && !defined(NO_MT_LOGGING)
+   boost::mutex::scoped_lock lock(mtx);
+#endif
+   static bool s_gcControl = false;
+   
+   if( s_gcControl && Output2Stream::getStream() ) 
+   {
+      delete Output2Stream::getStream();
+   }
+   
+   s_gcControl = gcControl;
+   
+   Output2Stream::getStream() = pFile;
+}
+/*==========================================================*/
+inline void Output2Stream::setStream(const std::string& filename)
+{
+   std::ofstream* file = new std::ofstream( filename.c_str() );
+   if( !(*file) ) 
+   {
+      delete file;
+      Output2Stream::setStream(&std::cerr, false);
+      UbLogger<Output2Stream>().get(logERROR) << " Output2Stream::setStream(const std::string& filename) could not open file "
+                                               << filename << " -> std::cerr is used instead " << std::endl;
+      return;
+   }
+   std::cout<<"UbLog writes to "<<filename<<std::endl;
+   Output2Stream::setStream(file,true);
+}
+/*==========================================================*/
+inline void Output2Stream::output(const std::string& msg)
+{
+#if defined(CAB_BOOST) && !defined(NO_MT_LOGGING)
+   boost::mutex::scoped_lock lock(mtx);
+#endif
+   std::ostream* pStream = getStream();
+   if (!pStream) return;
+   (*pStream) << msg << std::flush;
+}
+
+//////////////////////////////////////////////////////////////////////////
+// UbLog
+//////////////////////////////////////////////////////////////////////////
+class UbLog : public UbLogger< Output2Stream > 
+{
+
+};
+
+//Macro to limit compiler-side maxLevel
+#ifndef UBLOG_MAX_LEVEL
+   #define UBLOG_MAX_LEVEL logDEBUG5
+#endif
+
+//////////////////////////////////////////////////////////////////////////
+// example UBLOG(logINFO) << "das ist ein log eintrag";
+//////////////////////////////////////////////////////////////////////////
+#define UBLOG(level, logtext) \
+   if(level > UBLOG_MAX_LEVEL || level > UbLog::reportingLevel() || !Output2Stream::getStream()) ; \
+   else UbLog().get(level) << logtext;                                                             
+   
+//////////////////////////////////////////////////////////////////////////
+//makro 2 fuer korrekten MultiLineOutput (teuer!!)
+// example1: UBLOGML(logINFO, "line1"<<endl<<"line2"<<endl<<"line3" )
+// example2: UBLOGML(logINFO, "line1\nline2\nendl\nline3" )
+//////////////////////////////////////////////////////////////////////////
+#define UBLOGML(level, multiline) \
+   if(level > UBLOG_MAX_LEVEL || level > UbLog::reportingLevel() || !Output2Stream::getStream()) ; \
+   else                                                                                            \
+   {                                                                                               \
+      std::ostringstream output;                                                                   \
+      output << multiline;                                                                         \
+      std::istringstream input( output.str() );                                                    \
+      while(!input.eof())                                                                          \
+      {                                                                                            \
+         std::string dummy;                                                                        \
+         getline(input,dummy,'\n');                                                                \
+         UbLog().get(level) << dummy;                                                              \
+      }                                                                                            \
+   }                                                                                          
+//////////////////////////////////////////////////////////////////////////
+//makro3, falls auch bildschirmausgabe erwünscht
+//   -> es wird sowohl ins logfile als auch auf den "stream" geschrieben
+//      wenn reporting level und level passen :D
+//example1: UBLOG2ML(logINFO, std::cout,  "line1"<<endl<<"line2"<<endl<<"line3" ) 
+//example2: UBLOG2ML(logINFO, std::cout,  "line1\nline2\nendl\nline3" ) 
+//////////////////////////////////////////////////////////////////////////
+#define UBLOG2(level, stream,  text ) \
+   if(level > UBLOG_MAX_LEVEL || level > UbLog::reportingLevel() || !Output2Stream::getStream()) ; \
+   else { stream << text <<std::endl; UbLog().get(level) << text;   }                             
+
+//////////////////////////////////////////////////////////////////////////
+//makro4, wie 3 nur mit multiline
+//example: UBLOG2(logINFO, std::cout,  "test" ) 
+//////////////////////////////////////////////////////////////////////////
+#define UBLOG2ML(level, stream,  multiline ) \
+   if(level > UBLOG_MAX_LEVEL || level > UbLog::reportingLevel() || !Output2Stream::getStream()) ; \
+   else                                                                                            \
+   {                                                                                               \
+      stream << multiline << std::endl;                                                            \
+      std::ostringstream output;                                                                   \
+      output << multiline;                                                                         \
+      std::istringstream input( output.str() );                                                    \
+      while(!input.eof())                                                                          \
+      {                                                                                            \
+         std::string dummy;                                                                        \
+         getline(input,dummy,'\n');                                                                \
+         UbLog().get(level) << dummy;                                                              \
+      }                                                                                            \
+   }                                                                                               
+
+//////////////////////////////////////////////////////////////////////////
+// example 2
+//////////////////////////////////////////////////////////////////////////
+// try
+// {
+//    UbLog::reportingLevel() = UbLog::logLevelFromString("DEBUG3");
+//    //UbLog::output_policy::setStream(&std::cerr); //<- clog ist stdandard
+//    UbLog::output_policy::setStream("c:/temp/out.txt");  //kann man diese nicht oeffnen -> fehlermeldung -> Log wird in cerr ausgegben
+// 
+//    int count = 3;
+//    UBLOG(logINFO, "A loop with " << count << " iterations");
+//    for (int i = 0; i != count; ++i)
+//    {
+//        UBLOG(logERROR , "error  - the counter i = " << i );
+//        UBLOG(logDEBUG1, "debug1 - the counter i = " << i );
+//        UBLOG(logDEBUG2, "debug2 - the counter i = " << i );
+//        UBLOG(logDEBUG3, "debug3 - the counter i = " << i );
+//        //fuer MultiLine Eintraege: --> koerrekte formatierung im logfile
+//        UBLOGML(logDEBUG3, "debug3 - the counter i = "<<endl<<" 2 zeile "<< "3. Zeile" << i);
+//        UBLOGML(logDEBUG3, "debug3 - the counter i = "<<endl<<" 2 zeile "<< "3. Zeile" << i);
+//        UBLOG2ML(logDEBUG3,std:cout,"debug3 - the counter i = "<<endl<<" 2 zeile "<< "3. Zeile" << i);
+//    }
+//    return 0;
+// }
+// catch(const std::exception& e)
+// {
+//    UBLOG(logERROR) << e.what();
+// }
+
+
+#endif //UBLOGGER_H
diff --git a/src/VirtualFluidsBasics/basics/utilities/UbMath.cpp b/src/VirtualFluidsBasics/basics/utilities/UbMath.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..938360645be1ba72aed2f3f4d56ab9f5027244c9
--- /dev/null
+++ b/src/VirtualFluidsBasics/basics/utilities/UbMath.cpp
@@ -0,0 +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 UbMath.cpp
+//! \ingroup utilities
+//! \author Soeren Freudiger, Sebastian Geller
+//=======================================================================================
+#include <basics/utilities/UbMath.h>
+#include <basics/utilities/UbInfinity.h>
+#include <cstring> //for memcmp
+
+       
+const double UbMath::PI = 4.0* std::atan(1.0);   //3.1415926535897932384626433832795
diff --git a/src/VirtualFluidsBasics/basics/utilities/UbMath.h b/src/VirtualFluidsBasics/basics/utilities/UbMath.h
new file mode 100644
index 0000000000000000000000000000000000000000..0261256287952460ba8e1ab8547635f01a203d3b
--- /dev/null
+++ b/src/VirtualFluidsBasics/basics/utilities/UbMath.h
@@ -0,0 +1,480 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 UbMath.h
+//! \ingroup utilities
+//! \author Soeren Freudiger, Sebastian Geller
+//=======================================================================================
+#ifndef UBMATH_H
+#define UBMATH_H
+
+#include <cmath>
+#include <limits>
+#include <iostream>
+#include <cassert>
+#include <basics/utilities/UbSystem.h>
+#include <basics/utilities/UbEqual.h>
+
+namespace UbMath 
+{
+   extern const double PI;
+   
+   
+   //////////////////////////////////////////////////////////////////////////
+   //Hilfsfunktion fuer Genauigkeit
+   template< typename T >
+   struct Epsilon {  };
+
+   //////////////////////////////////////////////////////////////////////////
+   //  SPECIALIZATIONS von Epsilon
+   //////////////////////////////////////////////////////////////////////////
+   template<>
+   struct Epsilon<double>        { static inline double      val() { return 1.0E-11; } };
+   template<>
+   struct Epsilon<float>         { static inline float       val() { return 1.0E-7f; } };
+   template<>
+   struct Epsilon<long double>   { static inline long double val() { return 1.0E-15; } };
+   template<>
+   struct Epsilon<int>           { static inline int         val() { return 0;       } };
+
+   /*=======================================================*/
+   // -------------------------------------------------------------------------------------------------
+   // Funktion berechnet den Logarithmus einer Zahl z bzgl. der Basis b
+   // -------------------------------------------------------------------------------------------------
+   template<typename T>
+   inline T log(const T& z, const T& base)
+   {
+      if( ::log(base)==0 ) return 1.0f;
+      return ::log(z) / ::log(base);
+   }
+   /*=======================================================*/
+   //double x = UbMath::getNegativeInfinity<double>();
+   template<typename T>
+   inline T getNegativeInfinity()
+   {
+      //assert(std::numeric_limits<T>::has_infinity);
+      UB_STATIC_ASSERT(std::numeric_limits<T>::has_infinity);
+      return -std::numeric_limits<T>::infinity();
+   }
+   /*=======================================================*/
+   //double x = UbMath::getPositiveInfinity<double>();
+   template<typename T>
+   inline T getPositiveInfinity()
+   {
+      //assert(std::numeric_limits<T>::has_infinity);
+      UB_STATIC_ASSERT(std::numeric_limits<T>::has_infinity);
+      return std::numeric_limits<T>::infinity();
+   }
+   /*=======================================================*/
+   //double x; bool b = UbMath::isInfinity(x);
+   template<typename T>
+   inline bool isInfinity(const T& value)
+   {
+      if(value==getNegativeInfinity<T>()) return true;
+      if(value==getPositiveInfinity<T>()) return true;
+      return false;
+   }
+   /*=======================================================*/
+   //double x = UbMath::getNaN<double>(x);
+   template<typename T>
+   inline T getNaN()
+   {
+      UB_STATIC_ASSERT(std::numeric_limits<T>::has_quiet_NaN);
+      return std::numeric_limits<T>::quiet_NaN();
+   }
+   /*=======================================================*/
+   //double x; bool b = UbMath::isNaN(x);
+   // x!=x liefert bei #QNAN "true"!
+   template<typename T>
+   inline bool isNaN(const T& x)
+   {
+      UB_STATIC_ASSERT(std::numeric_limits<T>::has_quiet_NaN);
+      return (x != x); 
+   }
+   /*=======================================================*/
+   template<typename T>
+   inline T getEqualityEpsilon()		  
+   { 
+      return  Epsilon<T>::val();  
+   }
+   /*=======================================================*/
+   template<typename T>
+   inline bool zero(const T& value)		  
+   { 
+      return std::fabs( value ) < Epsilon<T>::val();
+      //return value >= -UbMath::EPSILON && value <= UbMath::EPSILON;	
+   }
+   /*=======================================================*/
+   //spezialisierung fuer ints
+   template<>
+   inline bool zero(const int& value)		  
+   { 
+      return value == 0;
+   }
+   /*=======================================================*/
+   template<typename T1, typename T2>
+   inline bool zero(const T1& value1, const T2& value2)		  
+   { 
+      return !(!UbMath::zero(value1) || !UbMath::zero(value2));	
+   }
+   /*=======================================================*/
+   template<typename T1, typename T2, typename T3>
+   inline bool zero(const T1& value1, const T2& value2, const T3& value3)		  
+   { 
+      return !(!UbMath::zero(value1) || !UbMath::zero(value2,value3));	
+   }
+   /*=======================================================*/
+   template<typename T>
+   inline bool negative(const T& value)    
+   { 
+      return value < -Epsilon<T>::val();  
+   }
+   /*=======================================================*/
+   template<typename T>
+   inline bool nonPositive(const T& value) 
+   { 
+      return value <= Epsilon<T>::val(); 
+   }
+   /*=======================================================*/
+   template<typename T>
+   inline bool positive(const T& value)    
+   { 
+      return value > +Epsilon<T>::val();   
+   }
+   /*=======================================================*/
+   template<typename T>
+   inline bool nonNegative(const T& value) 
+   { 
+      return value >= -Epsilon<T>::val(); 
+   }
+   /*=======================================================*/
+   template<typename T1, typename T2>
+   inline bool equal(const T1& value, const T2& reference) 
+   { 
+      typedef typename UbEqualTrait<T1,T2>::High High;
+      return std::fabs(value-reference) < Epsilon<High>::val(); 
+   }
+   /*=======================================================*/
+   template<typename T1, typename T2, typename T3>
+   inline bool equal(const T1& val1, const T2& val2, const T3& val3) 
+   { 
+      return ( UbMath::equal(val1,val2) && UbMath::equal(val1,val3) ); 
+   }
+   /*=======================================================*/
+   template<typename T1, typename T2>
+   inline bool less(const T1& value, const T2& reference)   
+   { 
+      typedef typename UbEqualTrait<T1,T2>::High High;
+      return value < reference - Epsilon<High>::val(); 
+   }
+   /*=======================================================*/
+   template<typename T1, typename T2>
+   inline bool lessEqual(const T1& value, const T2& reference) 
+   { 
+      typedef typename UbEqualTrait<T1,T2>::High High;
+      return value <= reference + Epsilon<High>::val();
+   }
+   /*=======================================================*/
+   template<typename T1, typename T2>
+   inline bool greater(const T1& value, const T2& reference)      
+   { 
+      typedef typename UbEqualTrait<T1,T2>::High High;
+      return value > reference + Epsilon<High>::val();  
+   }
+   /*=======================================================*/
+   template<typename T1, typename T2>
+   inline bool greaterEqual(const T1& value, const T2& reference) 
+   { 
+      typedef typename UbEqualTrait<T1,T2>::High High;
+      return value >= reference - Epsilon<High>::val(); 
+   }
+   /*=======================================================*/
+   template<typename T>
+   inline T round(const T& value, const int& decimalPlaces) 
+   { 
+      return static_cast<T>(floor(value * pow( 10.0, decimalPlaces) + 0.5 ) * pow(10.0, -decimalPlaces)); 
+   } 
+   /*=======================================================*/
+   template<typename T>
+   inline int integerRounding(const T& value) 
+   { 
+      return static_cast<int>( UbMath::zero(value) ?  0 : ( (value<0.0) ? (value-0.5) : (value+0.5) ) );
+   } 
+   /*=======================================================*/
+   template<typename T>
+   inline T getRad(const T& degrees) 
+   {
+      return degrees*static_cast<T>(UbMath::PI/180.0);
+   }
+   /*=======================================================*/
+   template<typename T>
+   inline T getDegrees(const T& rad) 
+   {
+      return rad*static_cast<T>(UbMath::PI/180.0);
+   }
+   /*=======================================================*/
+   //aus wildmagic
+   template<typename T>
+   inline T ACos (const T& fValue)
+   {
+      if ( -1.0 < fValue )
+      {
+         if ( fValue < 1.0 ) return static_cast<T>( acos(fValue) );
+         else                return static_cast<T>( 0.0          );
+      }
+      else return static_cast<T>( PI );
+   }
+   /*=======================================================*/
+   template<typename T>
+   inline T ASin(const T& fValue)
+   {
+      double HALF_PI = 0.5*UbMath::PI;
+      if ( -1.0 < fValue )
+      {
+         if ( fValue < 1.0 ) return static_cast<T>( asin(fValue) );
+         else                return static_cast<T>( HALF_PI      );
+      }
+      else return -static_cast<T>( HALF_PI );         
+   }
+   /*=======================================================*/
+   template<typename T>
+   inline T invSqrt(const T& fValue)   
+   { 
+      return static_cast<T>(1.0/sqrt(fValue));
+   }
+
+   /*=======================================================*/
+   /**
+   * Returns true, if specified values a and b are less both values c and d.
+   * @param a the first value to check
+   * @param b the second value to check
+   * @param c the first value to check against
+   * @param d the second value to check against
+   * @return true, if specified values a and b are less both values c and d
+   **/
+   template<typename T1, typename T2, typename T3, typename T4>
+   inline bool less2(const T1& value1, const T2& value2, T3 toBeLessAs1, T4 toBeLessAs2) 
+   {	
+      return (   less(value1,toBeLessAs1)
+              && less(value1,toBeLessAs2)
+              && less(value2,toBeLessAs1)
+              && less(value2,toBeLessAs2) );
+   }
+   /*=======================================================*/
+   template<typename T1, typename T2, typename T3, typename T4>
+   inline bool greater2(const T1& value1, const T2& value2, T3 toBeGreaterAs1, T4 toBeGreaterAs2)
+   { 
+      return (   greater(value1,toBeGreaterAs1)
+              && greater(value1,toBeGreaterAs2)
+              && greater(value2,toBeGreaterAs1)
+              && greater(value2,toBeGreaterAs2) );
+   }
+   /*=======================================================*/
+   template<typename T1, typename T2, typename T3>
+   inline bool inClosedInterval(const T1& value, const T2& threshold1, const T3& threshold2)
+   { 
+      if(threshold1 < threshold2)
+      {
+         return ( greaterEqual( value, threshold1) && lessEqual( value, threshold2) );
+      }
+
+      return ( greaterEqual( value, threshold2) && lessEqual( value, threshold1) );
+   }
+   /*=======================================================*/
+   template<typename T1, typename T2, typename T3>
+   inline bool inOpenInterval(const T1& value, const T2& threshold1, const T3& threshold2)
+   {	
+      if(threshold1 < threshold2) 
+      {
+         return (greater( value, threshold1) && less( value, threshold2));
+      }
+
+      return (greater( value, threshold2) && less( value, threshold1));
+   }
+   /*=======================================================*/
+   template<typename T1, typename T2, typename T3>
+   inline double adaptToClosedInterval(const T1& value, const T2& threshold1, const T3& threshold2)
+   { 
+      if(threshold1 < threshold2)
+      {
+         if     ( less(   value, threshold1) ) return threshold1;
+         else if( greater(value, threshold2) ) return threshold2;
+      }
+      else
+      {
+         if     ( less(   value, threshold2) ) return threshold2;
+         else if( greater(value, threshold1) ) return threshold1;
+      }
+      return value;
+   }
+   /*=======================================================*/
+   // -------------------------------------------------------------------------------------------------
+   // Funktion berechnet den groessten gemeinsamen Teiler zweier Zahlen (MK)
+   // -------------------------------------------------------------------------------------------------
+   /*=======================================================*/
+   inline int calcGgt(int val1, int val2)
+   {
+      if( val1 < val2 ) std::swap(val1,val2);
+      int ggt=val2;
+      while(ggt > 1)
+      {
+         if( (val1%ggt)==0 && (val2%ggt)==0 ) break;
+
+         ggt -=1;
+      }
+      return ggt;
+   }
+   /*=======================================================*/
+   // -------------------------------------------------------------------------------------------------
+   // Funktion berechnet den groessten gemeinsamen Teiler von drei Zahlen (MK)
+   // -------------------------------------------------------------------------------------------------
+   inline int calcGgt(int val1, const int& val2, int val3)
+   {
+      return UbMath::calcGgt( UbMath::calcGgt(val1, val2), val3 );
+   }
+   /*=======================================================*/
+   //returns the max of c2 values
+   //to avoid errors at mixed argument-types use: double myMax = max<double>(2,2.3);
+   template< typename T >
+   inline const T& max(const T& a1, const T& a2) 
+   { 
+     return (a1<a2) ? a2 : a1;
+   }
+   /*=======================================================*/
+   template< typename T >
+   inline const T& max(const T& a1, const T& a2, const T& a3) 
+   { 
+      return max(max(a1,a2),a3);
+   }
+   /*=======================================================*/
+   template< typename T >
+   inline const T& max(const T& a1, const T& a2, const T& a3, const T& a4)
+   {
+      return max(max(max(a1,a2),a3),a4);
+   }
+   /*=======================================================*/
+   template< typename T >
+   inline const T& min(const T& a1,const T& a2) 
+   { 
+      return (a1<a2) ? a1 : a2;
+   }
+   /*=======================================================*/
+   template< typename T >
+   inline const T& min(const T& a1, const T& a2, const T& a3) 
+   { 
+      return min(min(a1,a2),a3);
+   }
+   /*=======================================================*/
+   template< typename T >
+   inline const T& min(const T& a1, const T& a2, const T& a3, const T& a4)
+   {
+      return min(min(min(a1,a2),a3),a4);
+      
+//       double tmp = a1;
+//       if(tmp>a2) tmp=a2;
+//       if(tmp>a3) tmp=a3;
+//       if(tmp>a4) tmp=a4;
+//       return tmp;
+   }
+
+   //////////////////////////////////////////////////////////////////////////
+   //
+   //constants
+   //
+   //////////////////////////////////////////////////////////////////////////
+   static const double c8o27 = 8. / 27.;
+   static const double c2o27 = 2. / 27.;
+   static const double c1o54 = 1. / 54.;
+   static const double c1o216 = 1. / 216.;
+   static const double c9o2 = 9. / 2.; //4.5
+   static const double c9o4 = 9. / 4.; //2.25
+   static const double c3o9 = 3. / 9.;
+   static const double c3o54 = 3. / 54.;
+   static const double c3o216 = 3. / 216.;
+
+   static const double c1o27 = 1. / 27.;
+
+   static const double c1o72 = 1. / 72.;          //0.01388888
+   static const double c1o36 = 1. / 36.;          //0.02777777
+   static const double c1o48 = 1. / 48.;          //0.02083333
+   static const double c1o32 = 1. / 32.;          //0.03125
+   static const double c1o24 = 1. / 24.;          //0.04166666
+   static const double c1o20 = 1. / 20.;          //0.05
+   static const double c1o18 = 1. / 18.;          //0.05555555
+   static const double c1o16 = 1. / 16.;          //0.0625
+   static const double c1o12 = 1. / 12.;          //0.08333333
+   static const double c1o9 = 1. / 9.;           //0.11111111
+   static const double c1o8 = 1. / 8.;           //0.125
+   static const double c1o6 = 1. / 6.;           //0.16666666
+   static const double c1o5 = 1. / 5.;           //0.2
+   static const double c1o4 = 1. / 4.;           //0.25
+   static const double c1o100 = 1. / 100.;
+   static const double c5o16 = 5. / 16.;          //0.3125
+   static const double c1o3 = 1. / 3.;           //0.33333333
+   static const double c3o8 = 3. / 8.;           //0.375
+   static const double c4o9 = 4. / 9.;           //0.44444444
+   static const double c1o2 = 1. / 2.;           //0.5
+   static const double c9o16 = 9. / 16.;          //0.5625
+   static const double c2o3 = 2. / 3.;           //0.66666666
+   static const double c3o4 = 3. / 4.;           //0.75
+   static const double c3o2 = 3. / 2.;           //1.5
+   static const double c4o3 = 4. / 3.;           //1.33333333
+   static const double c5o3 = 5. / 3.;           //1.66666666
+   static const double c9o5 = 9. / 5.;           //1.8
+   static const double c2o9 = 2. / 9.;           //0.22222222
+   static const double one_over_sqrt2 = 1.0 / sqrt(2.0); //0.707106781
+   static const double one_over_sqrt3 = 1.0 / sqrt(3.0); //0.577350269
+   static const double sqrt2 = sqrt(2.0); //1.4142135
+   static const double sqrt3 = sqrt(3.0); //1.7320508
+   static const double zeroReal = 0.0;
+   static const double c1 = 1.0;
+   static const double c2 = 2.0;
+   static const double c3 = 3.0;
+   static const double c4 = 4.0;
+   static const double c5 = 5.0;
+   static const double c6 = 6.0;
+   static const double c7 = 7.0;
+   static const double c8 = 8.0;
+   static const double c9 = 9.0;
+   static const double c14 = 14.0;
+   static const double c15 = 15.0;
+   static const double c16 = 16.0;
+   static const double c18 = 18.0;
+   static const double c21 = 21.0;
+   static const double c24 = 24.0;
+   static const double c28 = 28.0;
+   static const double c29 = 29.0;
+   static const double c36 = 36.0;
+   static const double c48 = 48.0;
+   static const double c50 = 50.0;
+   static const double c56 = 56.0;
+   static const double c152 = 152.0;
+   static const double c130 = 130.0;
+}
+
+#endif
diff --git a/src/VirtualFluidsBasics/basics/utilities/UbObservable.h b/src/VirtualFluidsBasics/basics/utilities/UbObservable.h
new file mode 100644
index 0000000000000000000000000000000000000000..37cb954ddc16c0f258f553375bd46bab48da23a1
--- /dev/null
+++ b/src/VirtualFluidsBasics/basics/utilities/UbObservable.h
@@ -0,0 +1,270 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 UbObservable.h
+//! \ingroup utilities
+//! \author Soeren Freudiger, Sebastian Geller
+//=======================================================================================
+#ifndef UBOBSERVABLE_H
+#define UBOBSERVABLE_H
+
+#include <list>               
+#include <iostream>
+
+#include <basics/utilities/UbObserver.h>
+
+class UbObserver;
+
+//////////////////////////////////////////////////////////////////////////
+//!
+//! \brief Observable object
+//! \details This class provides Observables. The Observeres which observe this
+//!  Observable are stored in an observerlist.
+//!  IMPORTANT: objectWillBeDeleted is called at UbObserver::~UbObserver
+//!             this destructor is called AFTER the destructor of the
+//!             child classes. if you down_cast the pointer sent with the
+//!             objectWillBeDeleted(UbObserver* objpointer) then have to go this:
+//!               
+//!               if(dynamic_cast<UbObserver*>(observedObj)==objpointer) 
+//!                     (e.g.) observedObj=NULL;
+//!   example: see end of file
+//!
+//!   a copy of an UbservableObject will NOT copy the observerList
+//!  <UL>
+//!    <LI><B>Extending:</B> This UbObservable is the observable object itself. Extending should be used
+//!	where object types can be extended from UbObservable.
+//!    <LI><B>Associating:</B> Initialization is done via the constructor <tt>UbObservable(ObservableObject)</tt>.
+//!	Associating may be used, where object types to be observed could not be extended from UbObservable.
+//!  </UL>
+//!
+//! see UbObserver
+//!
+//////////////////////////////////////////////////////////////////////////
+
+class UbObservable 
+{
+protected:
+   /*======================================================================*/
+   /*  Konstruktoren                                                       */
+   /*                                                                      */
+   /**
+     Creates a UbObservable itself to be the object to be observed.
+     Usually this constructor is used in extended classes.
+   */
+   UbObservable()
+   {
+   }
+   
+   UbObservable(const UbObservable& src)
+   {
+      //no copy of observers !!!
+   }
+   
+   //falls irgendein schlaumeier den =operator von UbObservable aufrufen sollte,
+   //dann macht diesr auch keine kopie! (Allg: zuweisungsoperatoren werden nie vererbt
+   UbObservable& operator=(const UbObservable& src)
+   {
+      return *this;
+   }
+   
+   //   /**
+   //     Creates a UbObservable for the specified Object to be observed.
+   //     Usually this constructor is used in associating UbObservable.
+   //     @param object Object to be observed
+   //   */
+public:
+   /*======================================================================*/
+   /*  Destruktor                                                          */
+   /*                                                                      */
+   /**
+   */
+   virtual ~UbObservable()
+   {
+      this->notifyObserversObjectWillBeDeleted();
+   } 
+
+   /*======================================================================*/
+   /*  methods                                                            */
+   /*                                                                      */
+   
+   /**
+   Adds an UbObserver to the observerlist.
+   @param observer the observer to add to this observable (note that an observer may observe c1 observable more than once)
+   */
+   virtual void addObserver(UbObserver* observer)
+   {
+      if(!observer) return;
+      for(std::list<UbObserver*>::iterator pos=mObserverList.begin();pos!=mObserverList.end();++pos)
+      {
+         if(*pos == observer) return;
+      }
+      this->mObserverList.push_back(observer);
+   }
+   /**
+   Deletes an UbObserver from the observerlist.
+   @param observer the observer to remove from this observable (note that all observers identical are deleted)
+   ( delete means delete Heap... but here we're only removing a pointer)
+   */
+   virtual void removeObserver(UbObserver* observer)
+   {
+      if(!observer) return;
+      this->mObserverList.remove(observer);
+
+   }
+   /**
+   Deletes all Observers from the observerlist.
+   ( delete means delete Heap... but here we're only removing a pointer)
+   */
+   virtual void removeAllObservers()
+   {
+      this->mObserverList.clear();
+   }
+   
+   /**
+     Checks whether the specified UbObserver observes this observable.
+     @param observer the observer to remove from this observable (note that all observers identical are deleted)
+     @return true if the specified observer observes this observable
+   */
+   virtual bool isObservedBy(UbObserver* observer)
+   {
+      if(!observer) return false;
+      for(std::list<UbObserver*>::iterator pos=mObserverList.begin();pos!=mObserverList.end();++pos)
+      {
+         if(*pos == observer) return true;
+      }
+      return false;
+   }
+   /**
+     Notifies all of its observers that something happened. Does nothing, if the observed object is null.
+     Calls the Method UbObserver.objectChanged(Object) with the object of this observable as parameter.
+     The Method UbObserver.objectChanged(Object) must be defined
+     by each class implementing the interface TiObserver
+   */
+   virtual void notifyObserversObjectChanged()
+   {
+      std::list<UbObserver*>::iterator tmp_pos; //es kann sein, dass der aktuelle observer waehrend
+                                           //objectChanged() removed wird...
+      for(std::list<UbObserver*>::iterator pos=mObserverList.begin();pos!=mObserverList.end();)
+      {
+        //cout<<"in notifyObserversObjectChanged\n";
+        //cout<<this->mObserverList.size()<<endl;
+
+         tmp_pos = pos++; // erst tmp_pos=pos und dann pos++
+         (*tmp_pos)->objectChanged(this);
+      }
+   }
+
+   std::list<UbObserver*>* getObserverList() { return &mObserverList;}
+
+   virtual std::string toString() { return "UbObservable - toString()"; }
+
+private:
+   /**
+     Notifies all of its observers that something happened. Does nothing, if the observed object is null.
+     Calls the Method UbObserver.objectChanged(Object) with the object of this observable as parameter.
+     The Method UbObserver.objectChanged(Object) must be defined
+     by each class implementing the interface TiObserver
+   */
+   virtual void notifyObserversObjectWillBeDeleted()
+   {
+      std::list<UbObserver*>::iterator tmp_pos; //es kann sein, dass der aktuelle observer waehrend
+                                          //objectWillBeDeleted() removed wird...
+      for(std::list<UbObserver*>::iterator pos=mObserverList.begin();pos!=mObserverList.end();)
+      {
+         //cout<<"in notifyObserversObjectWillBeDeleted\n";
+         //cout<<this->mObserverList.size()<<endl;
+
+         tmp_pos = pos++;
+         (*tmp_pos)->objectWillBeDeleted(this);
+      }
+   }
+
+   std::list<UbObserver*> mObserverList;
+};
+/*=========================================================================*/
+
+
+#ifdef RCF_USE_SF_SERIALIZATION
+   SF_NO_CTOR(UbObservable);
+#endif //RCF_USE_SF_SERIALIZATION
+
+#endif
+
+////  E X A M P L E 
+////===================
+//class Point : public UbObservable
+//{
+//public:
+//   Point(){x=y=0;}
+//   ~Point(){}
+//   void setXCorrdinates(int x,int y)
+//   {
+//     this->x = x; this->y = y;
+//     this->notifyObserverObjectChanged();
+//   }
+//private:
+//   int x,y;
+//};
+//class VisPoint : public UbObserver
+//{
+//public:
+//   VisPoint(Point* point)
+//   { 
+//      this->point = point;
+//      this->point->addObserver(this);
+//   }
+//   ~VisPoint()
+//   {
+//      if(this->point) point->removeObserver(this);
+//   }
+//   void update() { /* do some actualisation stuff */ }
+//   void objectChanged(UbObservable* changedObject)
+//   {
+//      Point* point = dynamic_cast<Point*>(changedObject);
+//      if( !this->point || this->point != point ) return;
+//      this->repaint();
+//   }
+//   void objectWillBeDeleted(UbObservable* objectForDeletion)
+//   {
+//      if(!this->point) return;
+//      UbObservable* obsobjet = dynamic_cast<UbObservable*>(this->point);
+//      if(obsobjet == objectForDeletion) this->point = NULL;
+//      ///////////////////////////////////////////////////////////////////
+//      //*********************************************************************//
+//      //INGEGEN erster annahmen nicht verwenden, da es nicht immer funktioniert
+//      //z.B. bei mehrfachvererbung haut es nicht hin!
+//      ////      Point* point = reinterpret_cast<point*>(objectForDeletion);
+//      ////if(!this->point || objectForDeletion != this->point) return;
+//      ////this->point = NULL;
+//      //*********************************************************************//
+//      //was hingegen immer moeglich sein sollte:
+//      //if(dynamic_cast<void*>(objectForDeletion)==dynamic_cast<void*>(this->point))
+//   }
+//private:
+//   Point* point;
+//};
diff --git a/src/VirtualFluidsBasics/basics/utilities/UbObserver.h b/src/VirtualFluidsBasics/basics/utilities/UbObserver.h
new file mode 100644
index 0000000000000000000000000000000000000000..6aff49a396a3858028799a9c7d5186a1d80ce4a7
--- /dev/null
+++ b/src/VirtualFluidsBasics/basics/utilities/UbObserver.h
@@ -0,0 +1,78 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 UbObserver.h
+//! \ingroup utilities
+//! \author Soeren Freudiger, Sebastian Geller
+//=======================================================================================
+#ifndef UBOBSERVER_H
+#define UBOBSERVER_H
+
+class UbObservable;
+
+//////////////////////////////////////////////////////////////////////////
+//!
+//! \brief Observer
+//! \details This interface must be implemented by classes which want to
+//! observe other objects.
+//! IMPORTANT: if you delete an observer, ensure to remove Observer from
+//!            all his observed observable objects before!!!
+//! example: see end of UbObservable.h-file
+//!
+//////////////////////////////////////////////////////////////////////////
+
+class UbObserver 
+{
+protected:
+
+   UbObserver(){}
+
+public:
+
+   virtual ~UbObserver(){}
+
+   /*======================================================================*/
+   /*  Methods                                                           */
+   /*                                                                      */
+   /*!
+   This function is called when the observable indicated that an object
+   has changed.
+   \param changedObject Object which has changed
+   */
+   virtual void objectChanged(UbObservable* changedObject)=0;
+   /*!
+   This function is called when the observable indicated that an object
+   should be deleted.
+   \param objectForDeletion Object which should be deleted
+   */
+   virtual void objectWillBeDeleted(UbObservable* objectForDeletion)=0;
+};
+
+#endif
+
+
diff --git a/src/VirtualFluidsBasics/basics/utilities/UbRandom.h b/src/VirtualFluidsBasics/basics/utilities/UbRandom.h
new file mode 100644
index 0000000000000000000000000000000000000000..cab1bef8749e89d5e7215e3d1a2967f1bb7ece31
--- /dev/null
+++ b/src/VirtualFluidsBasics/basics/utilities/UbRandom.h
@@ -0,0 +1,82 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 UbRandom.h
+//! \ingroup utilities
+//! \author Soeren Freudiger, Sebastian Geller
+//=======================================================================================
+#ifndef UBRANDOM_H 
+#define UBRANDOM_H 
+
+#include <cstdlib> 
+#include <ctime> 
+#include <cassert> 
+#include <cmath> 
+
+//////////////////////////////////////////////////////////////////////////
+//!
+//! \brief A class generates a random number
+//! \details
+//! usage: 
+//! \code
+//!    int main() 
+//!    { 
+//!       char* hand[] = {"Schere", "Stein", "Papier"}; 
+//!       for (unsigned u = 0; u < 20; u++) 
+//!       { 
+//!          cout << hand[UbRandom::rand(0, 2, 1)] << endl; 
+//!       } 
+//! 
+//!       return 0; 
+//!    } 
+//! \endcode
+//////////////////////////////////////////////////////////////////////////
+
+class UbRandom 
+{ 
+private: 
+   UbRandom() { std::srand(static_cast<int>(std::time(NULL)));  } 
+
+public: 
+   //returns arbitrary int value element of [min ; max]
+   static inline int rand(const int& min, const int& max) 
+   { 
+      static UbRandom dummy; 
+      assert(max - min < RAND_MAX); 
+      return ( min + std::rand() % (max - min + 1) ); 
+   } 
+   //returns arbitrary float value element of "( (max - min) / gran ) * [min ; max]"
+   //with other words: val = min+n*(max-min)/gran, n=0..gran-1
+   static inline double rand(const double& min, const double& max, const double& gran)
+   {
+      static UbRandom dummy; 
+      return (min + std::floor( std::rand() / (1.0 + RAND_MAX) * gran)* (max - min) / gran);
+   }
+}; 
+
+#endif //UBRANDOM_H
diff --git a/src/VirtualFluidsBasics/basics/utilities/UbScheduler.h b/src/VirtualFluidsBasics/basics/utilities/UbScheduler.h
new file mode 100644
index 0000000000000000000000000000000000000000..1bb41a94281d73eed670572dd0986de4b24972a5
--- /dev/null
+++ b/src/VirtualFluidsBasics/basics/utilities/UbScheduler.h
@@ -0,0 +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 UbScheduler.h
+//! \ingroup utilities
+//! \author Soeren Freudiger, Sebastian Geller, Jan Hegewald
+//=======================================================================================
+#ifndef UBSCHEDULER_H
+#define UBSCHEDULER_H
+
+#include <iostream>
+#include <string>
+#include <limits>
+#include <cassert> 
+#include <sstream>
+#include <iomanip>
+#include <algorithm>
+
+#include <basics/utilities/UbSystem.h>
+#include <basics/utilities/UbMath.h>
+#include <basics/utilities/UbInfinity.h>
+#include <basics/utilities/UbComparators.h>
+
+//////////////////////////////////////////////////////////////////////////
+//!
+//! \brief A class implements scheduling. 
+//! \details This class is not thread save.
+//!
+//////////////////////////////////////////////////////////////////////////
+
+class UbScheduler
+{
+public:
+   class UbSchedule
+   {
+      friend class UbScheduler;
+   public:
+      UbSchedule() :  step(Ub::inf), begin(Ub::inf), end(Ub::inf) { }
+      UbSchedule(const double& step, const double& begin=0.0, const double& end=Ub::inf) 
+         : step(step), begin(begin), end(end) 
+      {  
+      }
+      double getStep()  const { return this->step;  }
+      double getBegin() const { return this->begin; }
+      double getEnd()   const { return this->end;   }
+      
+      /*==========================================================*/
+      std::string toString() { std::stringstream text; text<<*this; return text.str(); }
+      /*==========================================================*/
+      friend inline std::ostream& operator << (std::ostream& os, const UbSchedule& schedule) 
+      {
+         os<<"Schedule[start,end,step]=["<<schedule.begin<<", "<<schedule.end<<", "<<schedule.step<<"]";
+         return os;
+      }
+
+   private:
+      double step, begin, end;
+   };
+
+public:
+   UbScheduler() 
+   {
+      this->initVals();
+   }
+   /*==========================================================*/                         
+   UbScheduler(const double& step,const double& begin=0, const double& end=Ub::inf ) 
+   {
+      this->initVals();
+      this->addSchedule(step,begin,end);
+   }
+   /*==========================================================*/
+   UbScheduler(const UbSchedule& schedule) 
+   {
+      this->initVals();
+      this->addSchedule(schedule);
+   }
+   /*==========================================================*/
+   virtual ~UbScheduler() {}
+   /*==========================================================*/
+   inline void addSchedule(const UbSchedule& schedule)
+   {
+      this->addSchedule(schedule.step, schedule.begin, schedule.end);
+   }
+   /*==========================================================*/
+   bool addSchedule(const double& step, const double& begin, double end)
+   {
+      if( UbMath::zero(step) || begin>end )
+      { 
+         std::cerr<<"UbScheduler::addSchedule - invalid Schedule:\n\t"<<UbSchedule(step, begin, end)<<std::endl;
+         return false; 
+      }
+      
+      if( UbMath::less( end, (double)Ub::inf )  )
+      {
+         //es kann vorkommen, dass man mit dem intervall nicht genau auf den letzten wert kommt
+         //(z.B. step=2; start=0; end=9; -> ende wird angepasst)
+         //also wenn end-begin>Ub::inf ist, dann geht es halt nicht.. ein cast in long double half hier nichts
+         double multiplier=0.0;
+         double fractpart =  modf( (end-begin)/step, &multiplier);
+         if( !UbMath::zero(fractpart) )
+         {
+            //tmp-speicherung (fuer cerr)
+            fractpart = end;
+            //neues ende
+            end = begin+multiplier*step;
+            
+            std::cerr<<"Warning: UbScheduler::addSchedule - "
+                      <<"end of schedule was adapted to intervall \n\t"
+                      <<"from "<< UbSchedule(step, begin, fractpart) <<" to "<< UbSchedule(step, begin, end) <<std::endl;
+         }
+      }
+
+      //nu aber:
+      schedules.push_back(UbSchedule(step, begin, end));
+
+      if( end>maxT ) maxT = end;
+
+      double potentialDueTime;
+      if(   calcNextDueTimeForSchedule(schedules.back(), lastUsedT, potentialDueTime)
+         && potentialDueTime < nextDueTime   )
+      {
+         nextDueTime = potentialDueTime;
+      }
+
+      return true;
+   }
+   /*==========================================================*/
+   //returns true if scheduler contains schedules
+   bool   hasSchedules() const { return !schedules.empty(); }
+   /*==========================================================*/
+   //time bei dem das letzte mal isDue(time) true war
+   double getLastDueTime() const { return lastDueTime; }
+   /*==========================================================*/
+   //time bei dem das naechste mal isDue(time) true ergibt
+   double getNextDueTime() const { return nextDueTime; }
+   /*==========================================================*/
+   //maxDueTime (maxTime der Schedules!
+   double getMaxDueTime()  const { return this->maxT; }
+   /*==========================================================*/
+   bool isDue(const double& t)
+   {
+      lastUsedT = t;
+      if( UbMath::greaterEqual(t,nextDueTime) ) 
+      {
+         //groesser maxT is nicht
+         if( UbMath::greater(t,maxT) )  return false;
+         
+         //temp var
+         double actDueTime = nextDueTime;
+
+         //um Suche nach nextDueTime bei "Zukunfts-t" zu optimieren, setzt man die "start"-suchzeit auf "t-1":
+         nextDueTime = t-1; //t-1 deshlab, damit falls z.B. while Schleife nicht durchlaufen wird
+                            //die folgende if Abfrage nicht faelschlicher Weise true ist!
+         while( UbMath::greaterEqual(t,nextDueTime) && !UbMath::equal(nextDueTime, maxT) )
+         {
+            double tmpNextDueTime = maxT, potentialDueTime=-1.0;
+            for(std::size_t i=0; i<schedules.size(); i++)
+            {
+               if(   calcNextDueTimeForSchedule(schedules[i], nextDueTime, potentialDueTime)
+                  && potentialDueTime < tmpNextDueTime                 )
+               {
+                  assert( nextDueTime < potentialDueTime );
+                  tmpNextDueTime = potentialDueTime;
+               }
+            }
+            actDueTime  = nextDueTime;
+            nextDueTime = tmpNextDueTime;
+         } 
+
+         //wenn t = der aktuuellen oder gar schon der nächstmöglichen ist (hierbei wurde
+         //zuvor actDueTime und nextDueTime ggf. angepasst)
+         //Bsp.: nextDuTime war 5, aber für t=400 gilt andere schedule -> Bsp actDue=350 und nextDue 405
+         if(    UbMath::equal(t,actDueTime)    
+             || UbMath::equal(t,nextDueTime) ) 
+         {
+            lastDueTime = t;
+            return true;
+         }
+      }
+      else if( UbMath::lessEqual(t, lastDueTime) ) 
+      {
+         if(UbMath::equal(t, lastDueTime) ) return true; //braucht man, wenn man für dasselbe t isDue(t) aufruft
+         else  
+         {
+            //Fall: Zeit liegt faktisch in der Vergangenheit -> neu initialsisieren
+            double tmpNextDueTime = maxT, potentialDueTime=-1.0;
+            for(size_t i=0; i<schedules.size(); i++)
+            {
+               if(   calcNextDueTimeForSchedule(schedules[i], t-1, potentialDueTime)
+                  && potentialDueTime < tmpNextDueTime                 )
+               {
+                  tmpNextDueTime = potentialDueTime;
+               }
+            }
+            nextDueTime = tmpNextDueTime;
+
+            return UbMath::equal(t, nextDueTime);
+         }
+      }
+
+      return false;
+   }
+   /*==========================================================*/
+   inline double getMinBegin( ) const
+   {
+      if( schedules.empty() ) return Ub::inf;
+      return std::min_element(schedules.begin(), schedules.end(),UbComparators::membercomp(&UbSchedule::getBegin) )->getBegin();
+   }
+   /*==========================================================*/
+   inline double getMaxBegin( ) const
+   {
+      if( schedules.empty() ) return Ub::inf;
+      return std::max_element(schedules.begin(), schedules.end(),UbComparators::membercomp(&UbSchedule::getBegin) )->getBegin();
+   }
+   /*==========================================================*/
+   inline double getMinEnd( ) const
+   {
+      if( schedules.empty() ) return Ub::inf;
+      return std::min_element(schedules.begin(), schedules.end(),UbComparators::membercomp(&UbSchedule::getEnd) )->getEnd();
+   }
+   /*==========================================================*/
+   inline double getMaxEnd( ) const
+   {
+      if( schedules.empty() ) return Ub::inf;
+      return std::max_element(schedules.begin(), schedules.end(),UbComparators::membercomp(&UbSchedule::getEnd) )->getEnd();
+   }
+   /*==========================================================*/
+   inline double getMinStep( ) const
+   {
+      if( schedules.empty() ) return Ub::inf;
+      return std::min_element(schedules.begin(), schedules.end(),UbComparators::membercomp(&UbSchedule::getStep) )->getStep();
+   }
+   /*==========================================================*/
+   inline double getMaxStep( ) const
+   {
+      if( schedules.empty() ) return Ub::inf;
+      return std::max_element(schedules.begin(), schedules.end(),UbComparators::membercomp(&UbSchedule::getStep) )->getStep();
+   }
+   /*==========================================================*/
+   inline std::string toString() const
+   {
+      std::stringstream text;
+      text<<*this;
+      return text.str();
+   }
+   /*==========================================================*/
+   friend inline std::ostream& operator << (std::ostream& os, const UbScheduler& scheduler) 
+   {
+      os<<"UbScheduler\n";
+      os<<"Schedule |       start       |        end        |     intervall     "<<std::endl;
+      for(std::size_t i=0; i<scheduler.schedules.size(); i++)
+         os<<std::setw(9)<<i<<"|"
+           <<std::setw(19)<<scheduler.schedules[i].getBegin()<<"|"
+           <<std::setw(19)<<scheduler.schedules[i].getEnd()  <<"|"
+           <<std::setw(19)<<scheduler.schedules[i].getStep() <<std::endl;
+      return os;
+   }
+
+protected:
+   /*==========================================================*/
+   void initVals()
+   {
+      lastUsedT   = -Ub::inf; 
+      lastDueTime = -Ub::inf;
+      nextDueTime =  Ub::inf;
+      maxT        = -Ub::inf;
+   }
+   /*==========================================================*/
+   // calculates next due time for a schedule 
+   // with  nextDueTime > searchStart
+   bool calcNextDueTimeForSchedule(const UbSchedule& schedule, const double& searchStart, double& nextDueTime )
+   {
+      if     ( UbMath::greater(searchStart, schedule.end  ) ) return false;
+      else if( UbMath::less(   searchStart, schedule.begin) ) nextDueTime = schedule.begin;
+      else                            
+      {
+         nextDueTime = schedule.begin + ((int)((searchStart-schedule.begin)/schedule.step)+1)*schedule.step;
+         if(   UbMath::less(   nextDueTime, searchStart )
+            || UbMath::greater(nextDueTime, schedule.end) ) 
+         {
+            return false;
+         }
+      }
+      return true;
+   }
+
+protected:
+   double lastUsedT;
+   double lastDueTime;
+   double nextDueTime;
+   double maxT;
+   
+   std::vector<UbSchedule> schedules;
+};
+
+typedef UbScheduler::UbSchedule UbSchedule;
+
+#endif //UBSCHEDULER_H
+
+
+
+//int main(int argc, char** argv)            
+//{   
+//	UbScheduler writeSchedule;
+////	writeSchedule.addSchedule(0,2000,100);
+////	writeSchedule.addSchedule(3005,4500,300);
+////	writeSchedule.addSchedule(0,10,1);
+////	writeSchedule.addSchedule(0,100001,100);
+//	writeSchedule.addSchedule(0,2,1);
+//	writeSchedule.addSchedule(0,100001,200);
+//
+//	for(int t = 0; t < 1001; t++)
+//	{
+//		if(writeSchedule.isDue(t))
+//		{
+//			cout<<"due@ "<<t<<endl;
+//		}
+//	}
+//	return 0;
+//}
+
diff --git a/src/VirtualFluidsBasics/basics/utilities/UbStaticPathMap.cpp b/src/VirtualFluidsBasics/basics/utilities/UbStaticPathMap.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..d39895e6d758a755ada7edf2fea09eac9cf1191f
--- /dev/null
+++ b/src/VirtualFluidsBasics/basics/utilities/UbStaticPathMap.cpp
@@ -0,0 +1,36 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  This file is part of VirtualFluids. VirtualFluids is free software: you can 
+//  redistribute it and/or modify it under the terms of the GNU General Public
+//  License as published by the Free Software Foundation, either version 3 of 
+//  the License, or (at your option) any later version.
+//  
+//  VirtualFluids is distributed in the hope that it will be useful, but WITHOUT 
+//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
+//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License 
+//  for more details.
+//  
+//  You should have received a copy of the GNU General Public License along
+//  with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
+//
+//! \file UbStaticPathMap.cpp
+//! \ingroup utilities
+//! \author Soeren Freudiger, Sebastian Geller
+//=======================================================================================
+#include <basics/utilities/UbStaticPathMap.h>
+
+UbStaticPathMap::PathMap UbStaticPathMap::pathMap;
+const std::string UbStaticPathMap::GLOBAL = "UbStaticPathMap::GLOBAL";
diff --git a/src/VirtualFluidsBasics/basics/utilities/UbStaticPathMap.h b/src/VirtualFluidsBasics/basics/utilities/UbStaticPathMap.h
new file mode 100644
index 0000000000000000000000000000000000000000..d81aa8434dc5ce86a21592e80db602c9087ff3ea
--- /dev/null
+++ b/src/VirtualFluidsBasics/basics/utilities/UbStaticPathMap.h
@@ -0,0 +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 UbStaticPathMap.h
+//! \ingroup utilities
+//! \author Soeren Freudiger, Sebastian Geller
+//=======================================================================================
+#ifndef UBSTATICPATHMAP_H
+#define UBSTATICPATHMAP_H
+
+#include <iostream>
+#include <string>
+#include <map>
+
+#include <basics/utilities/UbSystem.h>
+
+//////////////////////////////////////////////////////////////////////////
+//!
+//! \brief A class stores pathnames for pathIDs
+//! \details (e.g. on different processes different paths with same pathID)
+//! adding an path autom. changes "\" to "/" and removed last "/" if exists
+//!
+//////////////////////////////////////////////////////////////////////////
+
+class UbStaticPathMap
+{
+   typedef std::map< std::string, std::string > PathMap;
+public:
+   static const std::string GLOBAL;
+public:
+
+   static std::string addAndMakePath(const std::string& id, const std::string& path)
+   {
+      std::string tmpPath = UbStaticPathMap::addPath(id,path);
+      if( !tmpPath.empty() ) UbSystem::makeDirectory(tmpPath,20);
+      return tmpPath;
+   }
+   static std::string addPath(const std::string& id, const std::string& path)
+   {
+      std::string tmpPath = UbSystem::replaceInString(path,"\\","/");
+      if(tmpPath.rfind("/") == tmpPath.size()-1) tmpPath.resize(tmpPath.size()-1);
+      pathMap[id] = tmpPath;   
+      return tmpPath;
+   }
+   static std::string getPath(const std::string& id)
+   {
+      PathMap::iterator it = pathMap.find(id);
+      if(it == pathMap.end()) return "";
+      return it->second;
+   }
+   static void removePath(const std::string& id)
+   {
+      pathMap.erase(id);
+   }
+
+protected:
+   static PathMap pathMap;
+
+private:
+   UbStaticPathMap() {}
+   UbStaticPathMap(const UbStaticPathMap&) {}
+};
+
+#endif //UBSTATICPATHMAP_H
diff --git a/src/VirtualFluidsBasics/basics/utilities/UbSystem.h b/src/VirtualFluidsBasics/basics/utilities/UbSystem.h
new file mode 100644
index 0000000000000000000000000000000000000000..ba99678715191bfd59acea594c1983c693faec56
--- /dev/null
+++ b/src/VirtualFluidsBasics/basics/utilities/UbSystem.h
@@ -0,0 +1,561 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 UbSystem.h
+//! \ingroup utilities
+//! \author Soeren Freudiger, Sebastian Geller
+//=======================================================================================
+#ifndef UBSYSTEM_H
+#define UBSYSTEM_H
+
+#if defined(_WIN32) || defined(_WIN64)
+   #define UBSYSTEM_WINDOWS
+   #include <process.h>
+   #include <io.h>
+   #include <direct.h>
+   //#ifndef _WINSOCK2API_  //ansonsten gibt es mecker bei #include "Windows.h" und ::Sleep()
+   //   #define _WINSOCK2API_
+   //   #include<WinSock2.h> 
+   //#endif
+  #include <windows.h>
+  //#include <Windows.h>
+  //#include <tchar.h>
+#elif defined(__APPLE__)
+   #define UBSYSTEM_APPLE
+   #include "dirent.h"
+   #include "sys/stat.h"
+   #include <sys/syscall.h>
+   #include <sys/stat.h>
+#elif (defined(__amd64) || defined(__amd64__) || defined(__unix__) || defined(__CYGWIN__)) && !defined(__AIX__) 
+   #define UBSYSTEM_LINUX
+   #include "dirent.h"
+   #include "sys/stat.h"
+   #include <sys/syscall.h>
+   #include <sys/stat.h>
+   #include <unistd.h>
+   #include <string.h>
+#elif defined(__AIX__)
+   #define UBSYSTEM_AIX
+   #include "dirent.h"
+   #include <unistd.h>
+   #include <sys/stat.h>
+   #include <sys/types.h>
+#else
+   #error "UbSystem::UnknownMachine"
+#endif
+
+
+
+#if defined(min) || defined(max) //daruch kann man sich spaeter #undef min; #undef max erparen
+#   error add NOMINMAX to preprocessor defines
+#endif
+
+
+#include <iostream>
+#include <iomanip>
+#include <string>
+#include <sstream>
+#include <algorithm>
+#include <typeinfo>
+#include <cctype> //for toupper
+#include <ctime>
+
+#include <basics/utilities/UbException.h>
+#include <basics/utilities/UbLogger.h>
+
+#if defined(CAB_BOOST)
+#include <boost/thread.hpp>
+#endif // CAB_BOOST
+
+//DEFINE TO STRING
+//e.g. #define FOO hallo
+//     -> QUOTEME(FOO) == "hallo"
+#define _QUOTEME(x) #x
+#define QUOTEME(x) _QUOTEME(x)
+
+//allg.:
+//const int * C1        -> C1 is variable pointer to a constant integer
+//int const * C2        -> C2 is variable pointer to a constant integer (same as above)
+//int * const C3        -> C3 is constant pointer to a variable integer
+//int const * const C4  -> C4 is constant pointer to a constant integer
+
+//////////////////////////////////////////////////////////////////////////
+//UbSystem
+//////////////////////////////////////////////////////////////////////////
+namespace UbSystem
+{
+   template<bool> struct ub_static_assert;     //deklaration (ub_xxx da static_assert in C++0x ein keyword werden wird)
+   template<> struct ub_static_assert<true>{}; //deklaration + definition der spezialisierung fuer "true"
+                                               //ub_static_assert<false> fuehrt zu compiler fehler, da dafuer
+                                               //keine implementierung vorhanden!  //UB_STATIC_ASSERT(false)
+
+   /*==========================================================*/
+   inline void sleepMs(const unsigned int& msec)
+   {
+      #if defined UBSYSTEM_WINDOWS
+         ::Sleep(  (msec==0) ? 1 : msec );  // +1 here causes a context switch if SleepMSec(0) is called
+      #elif defined(UBSYSTEM_LINUX) || defined(UBSYSTEM_APPLE) || defined(UBSYSTEM_AIX)
+         ::usleep(1000*msec);
+      #else
+         #error "UbSystem::sleepMSec - UnknownMachine"
+      #endif
+   }
+   /*==========================================================*/
+   inline void sleepS(const unsigned int& sec)
+   {
+      #if defined UBSYSTEM_WINDOWS
+         ::Sleep( (sec==0) ? 1 : sec*1000 );  // +1 here causes a context switch if sleepS(0) is called
+      #elif defined(UBSYSTEM_LINUX) || defined(UBSYSTEM_APPLE) || defined(UBSYSTEM_AIX)
+         ::sleep(sec);
+      #else
+         #error "UbSystem::sleepS - UnknownMachine"
+      #endif
+   }
+   /*==========================================================*/
+   //checks if the bits of bitmask are set in value
+   template<typename T>
+   inline bool bitCheck(const T& value, const T& bitmask)
+   {
+      return  ( (value & bitmask) == bitmask);
+   }
+   /*==========================================================*/
+   //checks if the bits of bitmask are set in value
+   template<typename T>
+   inline void setBit(T& value, const T& bitmask)
+   {
+      value |= bitmask;
+   }
+   /*==========================================================*/
+   template<typename T>
+   inline void unsetBit(T& value, const T& bitmask)
+   {
+      value &= ~bitmask;
+   }
+   /*==========================================================*/
+   //returns bitmask as string e.g. 0001 0100 1101
+   template<typename T>
+   inline std::string getBitString(const T& value)
+   {
+      std::stringstream text;
+      for(int i=sizeof(value)*8-1/*8 bits per byte*/; i>=0; i--)
+      {
+         text<<(char) ( ((value>>i) & 1) + '0');
+         if(i%4 == 0 && i>0) text<<' ';
+      }
+      return text.str();
+   }
+   /*==========================================================*/
+   //converts string to type T
+   // usage: int x = stringTo<int>("123");
+   template<typename T>
+   inline T stringTo(const std::string& s)
+   {
+     std::istringstream iss(s);
+     T x;
+     iss >> x;
+     if(!iss)
+        UB_THROW( UbException(UB_EXARGS," cannot convert \""+s+"\" to type <"+static_cast<std::string>(typeid(x).name())+">") );
+
+     return x;
+   }
+   /*==========================================================*/
+   // usage: string s = toString(x);
+   template<typename T>
+   inline std::string toString(const T& x, int precision=15)
+   {
+     std::ostringstream oss;
+     oss<<std::setprecision(precision);
+     oss<<x;
+     return oss.str();
+   }
+   /*==========================================================*/
+   //e.g. str="iHcsnW" -> "IHCSNW"
+   inline std::string toUpperString(const std::string& str)
+   {
+      std::string tmp(str);
+      std::transform(tmp.begin(),tmp.end(),tmp.begin(), static_cast<int (*)(int)>(std::toupper));
+
+      return tmp;
+   }
+   /*==========================================================*/
+   //e.g. str="iHcsnW" -> "ihcsnw"
+   inline std::string toLowerString(const std::string& str)
+   {
+      std::string tmp(str);
+      std::transform(tmp.begin(),tmp.end(),tmp.begin(), static_cast<int (*)(int)>(std::tolower));
+
+      return tmp;
+   }
+   /*==========================================================*/
+   // usage: std::string s = replaceInString(str,"\\","/");
+   //        std::string s = replaceInString(str,"ich","du");
+   static std::string replaceInString(std::string original, const std::string& replace, const std::string& replaceWith )
+   {
+      size_t pos=0;
+      while( (pos=original.find(replace,pos))!=std::string::npos )
+      {
+         original.replace(pos,replace.size(),replaceWith);
+         pos+=replaceWith.size();
+      }
+      return original;
+   }
+   /*==========================================================*/
+   //returns content of an enviroment variable
+   inline std::string getEnv(const std::string& var)
+   {
+      char* str = getenv( var.c_str());
+      if(  str == NULL  ) 
+      {
+         return std::string("");
+      }
+      
+      return static_cast<std::string>( str );
+   }
+   /*==========================================================*/
+   inline bool isDirectory(const std::string& dir, const unsigned& attemptions = 3)
+   {
+      if( dir.empty() ) 
+         UB_THROW( UbException(UB_EXARGS,"dir is empty") );
+      
+      std::string path = UbSystem::replaceInString(dir,"\\","/");
+
+      #if defined UBSYSTEM_WINDOWS
+         #ifndef _UNICODE 
+            if( _access(path.c_str(), 0  ) == -1 ) return false;
+         #else
+            if( _waccess(path.c_str(), 0 ) == -1 ) return false;
+         #endif
+      #elif defined(UBSYSTEM_LINUX) || defined(UBSYSTEM_APPLE) || defined(UBSYSTEM_AIX)
+         struct stat stFileInfo;
+         if( stat(path.c_str(),&stFileInfo) != 0) 
+         {
+            return false;
+         } 
+      #endif
+      
+      return true;
+   }
+   /*==========================================================*/
+   // usage:  makeDirectory("c:/temp");
+   //         makeDirectory("c:/temp/");
+   // return: true  -> successful
+   //         false -> failed
+   #if defined(CAB_BOOST) 
+      static boost::mutex mtx_makeDirectory;
+   #endif
+   inline bool makeDirectory(const std::string& dir, const unsigned& attemptions = 3)
+   {
+      UBLOG(logDEBUG5,"UbSystem::makeDirectory - start, dir="<<dir<<" #attemptions="<<attemptions);
+
+      if( dir.empty() ) UB_THROW( UbException(UB_EXARGS,"dir is empty") );
+      std::string path = UbSystem::replaceInString(dir,"\\","/");
+
+      bool dirCreated = true;
+      #if defined UBSYSTEM_WINDOWS
+         if(path[path.size()-1] != '/') path+="/";
+         size_t  pos = 0;
+         while( ( pos=path.find("/",pos+1) ) != std::string::npos )
+         {
+            std::string tmpdir = path.substr(0,pos);
+            #if defined(CAB_BOOST) 
+            boost::mutex::scoped_lock lock(mtx_makeDirectory);
+            #endif
+            if( 
+                #ifndef _UNICODE 
+                 _access(tmpdir.c_str(), 0 ) == -1 && _mkdir(tmpdir.c_str() ) == -1
+                #else
+                 _waccess(tmpdir.c_str(), 0) == -1 && _wmkdir(tmpdir.c_str()) == -1
+                #endif
+               )
+               {
+                  UBLOG(logDEBUG5,"UbSystem::makeDirectory-  dir=\""<<tmpdir<<"\" doesn't exit or makedir failed");
+                  dirCreated = false;
+                  break;
+               }
+         }
+      #elif defined(UBSYSTEM_LINUX) || defined(UBSYSTEM_APPLE) || defined(UBSYSTEM_AIX)
+         std::string command = "mkdir -p \""+path+"\"";
+         {
+            #if defined(CAB_BOOST) 
+               boost::mutex::scoped_lock lock(mtx_makeDirectory);
+            #endif
+            if(system(command.c_str())!=0)
+            {
+               UBLOG(logDEBUG5,"UbSystem::makeDirectory-  dir=\""<<path<<"\" doesn't exit or makedir failed");
+               dirCreated = false;
+            }
+         }
+      #else
+         #error "UbSystem::makeDirectory - UnknownMachine"
+      #endif
+
+      if(!dirCreated && attemptions > 1)
+      {
+         UBLOG(logDEBUG5,"UbSystem::makeDirectory - internal call of UbSystem::makeDirectory");
+         UbSystem::sleepMs(500);
+         dirCreated = UbSystem::makeDirectory(path, attemptions-1);
+      }
+      
+      UBLOG(logDEBUG5,"UbSystem::makeDirectory - end (success="<<dirCreated<<", attemptions = "<<attemptions<<")");
+      return dirCreated;
+   }
+   /*==========================================================*/
+#if defined(CAB_BOOST) 
+   static boost::mutex mtx_removeDirectory;
+#endif
+   inline int removeDirectory(const std::string& dir)
+   {
+      #if defined(CAB_BOOST) 
+         boost::mutex::scoped_lock lock(mtx_removeDirectory);
+      #endif
+      std::string command = "rmdir \""+dir+"\"";
+      return std::system(command.c_str());
+   }
+   /*==========================================================*/
+   // usage  : getPathFromString("c:/temp/foo.txt");
+   //returns: "c:/temp"
+   // usage  : getPathFromString("c:\\temp\\foo.txt");
+   //returns: "c:/temp"
+   // usage  : getPathFromString("foo.txt");
+   // returns: ""
+   inline std::string getPathFromString(const std::string& fileStringWithPath)
+   {
+      std::string tmp = UbSystem::replaceInString(fileStringWithPath,"\\","/");
+      std::size_t last = tmp.rfind("/");
+      if(last!=std::string::npos) tmp.resize(last);
+      else                        tmp = "";
+      return tmp;
+   }
+   /*==========================================================*/
+   // usage  : getFilenameFromString("c:/temp/foo.txt");
+   // returns: "foo.txt"
+   // usage  : getFilenameFromString("c:/temp/foo.txt",false);
+   // returns: "foo"
+   // usage  : getFilenameFromString("c:/temp/");
+   // returns: ""
+   inline std::string getFilenameFromString(const std::string& fileStringWithPath, bool withExtension = true)
+   {
+      std::string tmp = UbSystem::replaceInString(fileStringWithPath,"\\","/");
+      
+      //remove path
+      std::size_t last = tmp.rfind("/");
+      if(last!=std::string::npos && (last+1)<tmp.size()) tmp.erase(0,last+1);
+      
+      //remove extension
+      if(!withExtension)
+      {
+         last = tmp.rfind(".");
+         if(last!=std::string::npos) tmp.erase(last);
+      }
+
+      return tmp;
+   }
+   /*==========================================================*/
+   inline int getProcessID()
+   {
+      #if defined UBSYSTEM_WINDOWS
+         return _getpid();
+      #elif defined(UBSYSTEM_LINUX) || defined(UBSYSTEM_APPLE) || defined(UBSYSTEM_AIX)
+         return getpid();
+      #else
+         #error "int UbSystem::getProcessID() - UnknownMachine"
+      #endif
+   }
+   /*==========================================================*/
+   inline unsigned long getCurrentThreadID()
+   {
+      #if defined UBSYSTEM_WINDOWS
+         return (unsigned long)GetCurrentThreadId();
+      #elif defined(UBSYSTEM_LINUX) || defined(UBSYSTEM_APPLE)
+         return (unsigned long)syscall(SYS_gettid);
+      #elif defined(UBSYSTEM_AIX)
+         return (unsigned long) getpid(); //WORKAROUND for IBM (for get thread id is another function necessary) 
+      #else
+         #error "unsigned long UbSystem::getCurrentThreadID() - UnknownMachine"
+      #endif
+   }
+   /*==========================================================*/
+   inline bool isBigEndian()
+   {
+      short word = 0x4321;
+      if((*(char*)& word) != 0x21 ) return true;
+      else                           return false;
+   }
+   /*==========================================================*/
+   inline bool isLittleEndian()
+   {
+      return !isBigEndian();
+   }
+   /*==========================================================*/
+   inline std::string getTimeStamp()
+   {
+      time_t t = time(NULL);
+      tm* localTime = localtime(&t); 	
+      
+      std::stringstream tmp;
+      tmp.fill('0');
+      
+      tmp << localTime->tm_year+1900 
+          << "." << std::setw(2) <<localTime->tm_mon+1
+          << "." << std::setw(2) << localTime->tm_mday 
+          << "@" << std::setw(2) << localTime->tm_hour  
+          << "." << std::setw(2) << localTime->tm_min   
+          << "." << std::setw(2) << localTime->tm_sec  ;
+
+      return tmp.str();
+   }
+   /*==========================================================*/
+   //swap Byte Order
+   //usage: int test = 8;
+   //       swapByteOrder((unsigned char*)& test, sizeof(int))
+   //#define ByteSwap5(x) ByteSwap((unsigned char *) &x,sizeof(x))
+   inline void swapByteOrder(unsigned char* toSwap, int length)
+   {
+      register int i = 0;
+      register int j = length-1;
+      while(i<j)
+      {
+         std::swap(toSwap[i], toSwap[j]);
+         i++, j--;
+      }
+   }
+   //////////////////////////////////////////////////////////////////////////
+   //get host name
+   inline std::string getMachineName()
+   {
+      char Name[150];
+      int i = 0;
+
+#ifdef UBSYSTEM_WINDOWS
+      TCHAR infoBuf[150];
+      DWORD bufCharCount = 150;
+      memset(Name, 0, 150);
+      if (GetComputerName(infoBuf, &bufCharCount))
+      {
+         for (i = 0; i<150; i++)
+         {
+            Name[i] = infoBuf[i];
+         }
+      }
+      else
+      {
+         strcpy(Name, "Unknown_Host_Name");
+      }
+#else
+      memset(Name, 0, 150);
+      gethostname(Name, 150);
+#endif
+      return std::string(Name);
+   }
+
+   //////////////////////////////////////////////////////////////////////////
+   // generic IfThenElse - start
+   //////////////////////////////////////////////////////////////////////////
+   // primary template: yield second or third argument depending on first argument
+   template<bool C, typename Ta, typename Tb>
+   class IfThenElse;
+
+   // partial specialization: true yields second argument
+   template<typename Ta, typename Tb>
+   class IfThenElse<true, Ta, Tb> {
+   public:
+      typedef Ta ResultT;
+   };
+
+   // partial specialization: false yields third argument
+   template<typename Ta, typename Tb>
+   class IfThenElse<false, Ta, Tb> {
+   public:
+      typedef Tb ResultT;
+   };
+   //////////////////////////////////////////////////////////////////////////
+   // generic IfThenElse - end
+   //////////////////////////////////////////////////////////////////////////
+
+   //////////////////////////////////////////////////////////////////////////
+   //help struct for overloading methods in template classes for specific types
+   //////////////////////////////////////////////////////////////////////////
+   template< typename T>
+   struct type2type
+   {
+      typedef T type;
+   };
+
+
+   //////////////////////////////////////////////////////////////////////////
+   // pair selector
+   //////////////////////////////////////////////////////////////////////////
+   template <typename Pair>
+   struct select1st
+   {
+      typedef Pair argument_type ;
+      typedef typename Pair::first_type result_type ;
+
+      const result_type&  operator()(const argument_type &p) const
+      {
+         return p.first ;
+      }
+   };
+
+   template <typename Pair>
+   struct select2nd
+   {
+      typedef Pair argument_type ;
+      typedef typename Pair::second_type result_type ;
+
+      const result_type& operator()(const argument_type &p) const
+      {
+         return p.second ;
+      }
+   };
+
+};
+
+#define UB_STATIC_ASSERT(expr) static_cast<void>(sizeof( UbSystem::ub_static_assert<expr> ));
+//zum ueberpruefen von STATISCHEN ausdruecken waehrend der compile-zeit
+//--> Ausdruecke muessen schon ZUR compilerzeit auswertbar sein !!!
+//Anwendung z.B. zur Ueberpruefung von Funktionalitaeten, wie z.B. bei UbMath::getNegativeInfinity<double>();
+//
+//Grund fuer macro ist einfach, dass es besser anzuwenden ist in der praxis!
+//ansonsten würde es so aussehen:
+//     UbSystem::ub_static_assert< aaa == 1 > test();
+//    da ist  UB_STATIC_ASSERT(aaa == 1); schoener
+//
+//um das zu vermeiden machtman hier diesen static_cast<void>(sizeof(...) )
+//Code-Snippet:
+// struct Test { const static bool m_const_bool = true; bool m_bool; };
+// int main() {
+//  UB_STATIC_ASSERT( Test::m_const_bool == true );
+//  --> okay, assert bestanden
+//  UB_STATIC_ASSERT( Test::m_const_bool == false); //:
+//  --> assert nicht bestanden z.B. error C2027: use of undefined type 'UbSystem::ub_static_assert<__formal> with __formal = false --> funzt nicht. fehler im code
+//  UB_STATIC_ASSERT( Test::m_bool == true );
+//  --> nicht erlaubt, da m_bool nicht statisch und nicht const ist.
+//}
+
+#endif //UBSYSTEM_H
diff --git a/src/VirtualFluidsBasics/basics/utilities/UbTiming.h b/src/VirtualFluidsBasics/basics/utilities/UbTiming.h
new file mode 100644
index 0000000000000000000000000000000000000000..d683d07050d9a906adfe3a71d77270d2d8bf034a
--- /dev/null
+++ b/src/VirtualFluidsBasics/basics/utilities/UbTiming.h
@@ -0,0 +1,416 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 UbTiming.h
+//! \ingroup utilities
+//! \author Soeren Freudiger, Sebastian Geller
+//=======================================================================================
+#ifndef UBTIMING_H
+#define UBTIMING_H
+
+#include <string>
+#include <limits>
+#include <iostream>
+#include <sstream>
+#include <vector>
+#include <ctime>
+
+#ifdef VF_MPI
+   #include <mpi.h>
+   #include <basics/parallel/PbMpi.h>
+#endif //VF_MPI
+
+class UbTiming
+{
+public:
+	UbTiming()
+   {
+      this->duration		= 0.0;
+      this->deltaT		= 0.0;
+      this->startTime	= 0;
+      this->name        = "noname";
+   }
+   /*==========================================================*/
+   UbTiming(const std::string& name)
+   {
+      this->duration		= 0.0;
+      this->deltaT		= 0.0;
+      this->startTime	= 0;
+      this->name        = name;
+   }
+   /*==========================================================*/
+   virtual ~UbTiming() {}  
+   /*==========================================================*/
+   virtual void initTiming()
+   {
+      this->duration = 0.0;	
+   }
+   /*==========================================================*/
+   virtual void startTiming()
+   {
+      #if defined(VF_MPI) && !defined(CAB_RUBY)
+         this->startTime = PbMpi::Wtime();
+      #else
+         this->startTime = (double)clock();	
+      #endif //VF_MPI 
+   }
+   /*==========================================================*/
+   virtual void initAndStartTiming()
+   {
+      this->initTiming();
+      this->startTiming();
+   }
+   /*==========================================================*/
+   virtual void endTiming()
+   {
+      this->stopTiming();
+   }
+   /*==========================================================*/
+   virtual void stopTiming()
+   {
+      #if defined(VF_MPI) && !defined(CAB_RUBY)
+            this->deltaT   = PbMpi::Wtime()-this->startTime;
+      #else
+         this->deltaT   = ((double)clock()-this->startTime)/(double)CLOCKS_PER_SEC;
+      #endif //VF_MPI 
+
+      this->duration += this->deltaT;
+   }
+   /*==========================================================*/
+   virtual double getDuration() const
+   {
+      return this->duration;
+   }
+   /*==========================================================*/
+   virtual void setName(const std::string& name)
+   {
+      this->name = name;
+   }
+   /*==========================================================*/
+   virtual std::string getName() const
+   { 
+      return this->name; 
+   }
+   /*==========================================================*/
+   void start()
+   {
+      this->duration = 0.0;
+
+      #if defined(VF_MPI) && !defined(CAB_RUBY)
+         this->startTime = PbMpi::Wtime();
+      #else
+         this->startTime = (double)clock();
+      #endif //VF_MPI 
+   }
+   /*==========================================================*/
+   void pause()
+   {
+      #if defined(VF_MPI) && !defined(CAB_RUBY)
+         this->duration += PbMpi::Wtime()-this->startTime;
+      #else
+         this->duration +=((double)clock()-this->startTime)/(double)CLOCKS_PER_SEC;
+      #endif //VF_MPI 
+   }
+   /*==========================================================*/
+   void unpause()
+   {
+      #if defined(VF_MPI) && !defined(CAB_RUBY)
+         this->startTime   = PbMpi::Wtime();
+      #else
+         this->startTime = (double)clock();
+      #endif //VF_MPI 
+   }
+   /*==========================================================*/
+   void stop()
+   {
+      #if defined(VF_MPI) && !defined(CAB_RUBY)
+         this->duration += PbMpi::Wtime()-this->startTime;
+      #else
+         this->duration +=((double)clock()-this->startTime)/(double)CLOCKS_PER_SEC;
+      #endif //VF_MPI 
+   }
+   /*==========================================================*/
+   double getTicks() const            
+   { 
+      #if defined(VF_MPI) && !defined(CAB_RUBY)
+         return PbMpi::Wtick();
+      #else
+         return double(1.0)/double(CLOCKS_PER_SEC);
+      #endif  //VF_MPI 
+   }
+
+protected:
+   std::string name;
+
+   double startTime;
+   double duration;
+	double deltaT;
+};
+
+#include <basics/utilities/UbSystem.h> //for definitons of system/OS type
+
+#ifdef UBSYSTEM_APPLE   //Apple hack
+   #include <mach/mach_time.h>  
+   #include <time.h>  
+   #include <stdio.h> 
+   inline void mach_absolute_difference(const uint64_t& end, const uint64_t& start, struct timespec *tp) 
+   {  
+         uint64_t difference = end - start;  
+         static mach_timebase_info_data_t info = {0,0};  
+   
+         if (info.denom == 0)  
+                 mach_timebase_info(&info);  
+   
+         uint64_t elapsednano = difference * (info.numer / info.denom);  
+   
+         tp->tv_sec = elapsednano * 1e-9;  
+         tp->tv_nsec = elapsednano - (tp->tv_sec * 1e9);  
+   } 
+#elif defined(UBSYSTEM_LINUX) || defined(UBSYSTEM_AIX)
+   #include <ctime>
+   #include <unistd.h> // for sysconf
+   #include <pthread.h>
+#endif
+
+/*=========================================================================*/
+//! \brief Time Measuring                                              
+//! \details                                                                         
+//! example:
+//! \code
+//! t=0  start 
+//! t=1 
+//! t=2  stop  -> return 2; getLapTime=2; getTotalTime 2; getLapTimes:  2
+//! t=3 
+//! t=4 
+//! t=5  stop  -> return 3; getLapTime=3; getTotalTime 5; getLapTimes:  2,3
+//! t=6  stop  -> return 1; getLapTime=1; getTotalTime 6; getLapTimes:  2,3,1
+//! t=7  
+//! t=8  start ->no consideration of time 7 and 8 
+//! t=9  
+//! t=10 stop  -> return 2; getLapTime=2; getTotalTime 8; getLapTimes:  2,3,1,2
+//! t=11 resetAndStart -> Timer is reset and restarted
+//! t=12
+//! t=13 
+//! t=14 stop  -> return 3; getLapTime=3; getTotalTime 3; getLapTimes:  3
+//! \endcode
+
+class UbTimer
+{
+public:
+   UbTimer(const bool& storeLapTimes = false) 
+      :  name("unamed"), isMeasuring(false), storeLapTimes(storeLapTimes)
+       , startTime(0.0), totalTime(0.0), lapTime(0.0)
+   {
+
+   }
+   /*==========================================================*/
+   UbTimer(const std::string& name, const bool& storeLapTimes = false) 
+      :  name(name), isMeasuring(false), storeLapTimes(storeLapTimes)
+       , startTime(0.0), totalTime(0.0), lapTime(0.0)
+   {
+
+   }
+   /*==========================================================*/
+   virtual ~UbTimer() {}  
+   /*==========================================================*/
+   double              getLapTime() const               { return this->lapTime;  }
+   std::vector<double> getLapTimes() const              { return this->lapTimes; }
+   void                setName(const std::string& name) { this->name = name;     }
+   std::string         getName() const                  { return this->name;     }
+   bool                isRunning() const                { return isMeasuring;    }
+   bool                isStoringLapTimes() const        { return storeLapTimes;  }
+   /*==========================================================*/
+   void setStoreLapTimes(const bool& storeLapTimes) { this->storeLapTimes = storeLapTimes; }
+   /*==========================================================*/
+   void start()
+   {
+      this->isMeasuring = true;
+
+      #if defined(VF_MPI) && !defined(CAB_RUBY)
+          this->startTime = PbMpi::Wtime();
+      #elif defined(UBSYSTEM_APPLE)
+    	 this->startTime = mach_absolute_time();  
+      #elif defined(UBSYSTEM_LINUX) || defined(UBSYSTEM_AIX)
+         timespec tp;
+         clock_gettime(CLOCK_REALTIME,&tp);
+         this->startTime = (double)(tp.tv_sec)*1.0e9 + (double)(tp.tv_nsec);
+      #else
+         this->startTime = (double)clock();
+      #endif //VF_MPI
+   }
+   /*==========================================================*/
+   void resetAndStart() { this->reset(); this->start(); }
+   /*==========================================================*/
+   //stop: - stops the calculation and returns the time elapsed since last start/stop
+   //      - timing continues
+   double stop()
+   {
+      //if start() was never activated before:
+      if(!isMeasuring) return 0.0; 
+      
+      #if defined(VF_MPI) && !defined(CAB_RUBY)
+         double actTime = PbMpi::Wtime();
+         this->lapTime  = actTime-this->startTime;
+      #elif defined(UBSYSTEM_APPLE)
+    	 double actTime = mach_absolute_time();  
+         timespec tp;  
+         mach_absolute_difference(actTime, this->startTime, &tp);
+         this->lapTime  =  tp.tv_sec + tp.tv_nsec*1e-9;
+	  #elif defined(UBSYSTEM_LINUX) || defined(UBSYSTEM_AIX)
+         timespec tp;
+         clock_gettime(CLOCK_REALTIME,&tp);
+         double actTime = (double)(tp.tv_sec)*1.0e9 + (double)(tp.tv_nsec);
+         this->lapTime  = (actTime-this->startTime)*1.0e-9;
+      #else
+         double actTime = (double)clock();
+         this->lapTime  = (actTime-this->startTime)/(double)CLOCKS_PER_SEC;
+      #endif //VF_MPI 
+      
+      this->startTime  = actTime;
+      this->totalTime += this->lapTime;
+      if(storeLapTimes) lapTimes.push_back(this->lapTime);
+
+      return lapTime;
+   }
+   /*==========================================================*/
+   void reset()
+   {
+      this->isMeasuring = false;
+      
+      this->startTime   = 0.0;
+      this->totalTime   = 0.0;
+      this->lapTime     = 0.0;
+
+      lapTimes.resize(0);
+   }
+   /*==========================================================*/
+   double getCurrentLapTime() const
+   {
+     //if start() was never activated before:
+      if(!isMeasuring) return 0.0; 
+      
+      #if defined(VF_MPI) && !defined(CAB_RUBY)
+         return PbMpi::Wtime() - this->startTime;
+      #elif defined(UBSYSTEM_APPLE)
+         timespec tp;  
+         mach_absolute_difference(mach_absolute_time(), this->startTime, &tp);
+         return tp.tv_sec + tp.tv_nsec*1e-9;
+      #elif defined(UBSYSTEM_LINUX) || defined(UBSYSTEM_AIX)
+         timespec tp;
+         clock_gettime(CLOCK_REALTIME,&tp);
+         return ((double)(tp.tv_sec)*1.0e9 + (double)(tp.tv_nsec) - this->startTime)*1.0e-9;
+      #else
+         return ( (double)clock() - this->startTime ) / (double)CLOCKS_PER_SEC;
+      #endif //VF_MPI 
+      
+   }
+   /*==========================================================*/
+   double getTotalTime() const
+   {
+      return this->totalTime;
+   }
+   /*==========================================================*/
+   std::string toString()
+   {
+      std::stringstream text;
+      text<<*this;
+      return text.str();
+   }
+
+   //ueberladene Operatoren
+   /*==========================================================*/
+   friend inline std::ostream& operator << (std::ostream& os, const UbTimer& timer) 
+   {
+       os<<"UbTimer[totalTime="<<timer.totalTime<<"sec, lapTimes(";
+       for(std::size_t i=0; i<timer.lapTimes.size(); i++) os<<timer.lapTimes[i]<<",";
+       os<<")]";
+       return os;
+   }
+
+
+protected:
+   std::string name;
+   bool        isMeasuring;
+   bool        storeLapTimes;
+
+   double      startTime;
+   double      totalTime;
+   double      lapTime;
+   
+   std::vector<double> lapTimes;
+};
+
+
+/*=========================================================================*/
+//! \brief Time Measuring                                              
+//! 
+//! \details UbProressTimer measures the time from its instantiation to destruction and spend the elapsed time on "os" in [s]
+//! example:
+//! \code
+//!  {
+//!     UbProgressTimer timer;
+//!     UbSystem::sleepS(10);
+//!  } //--> 10s
+//! \endcode
+
+class UbProgressTimer : public UbTimer
+{
+private:
+	UbProgressTimer(const UbProgressTimer& rhs);
+public:
+  explicit UbProgressTimer( std::ostream & os = std::cout )
+     : UbTimer(),os(os) 
+  {
+  	  this->start();
+  }
+  /*==========================================================*/
+  ~UbProgressTimer()
+  {
+  //  A) Throwing an exception from a destructor is a Bad Thing.
+  //  B) The progress_timer destructor does output which may throw.
+  //  C) A progress_timer is usually not critical to the application.
+  //  Therefore, wrap the I/O in a try block, catch and ignore all exceptions.
+    try
+    {
+      // use istream instead of ios_base to workaround GNU problem (Greg Chicares)
+      std::istream::fmtflags old_flags = os.setf( std::istream::fixed,
+                                                  std::istream::floatfield );
+      std::streamsize old_prec = os.precision( 2 );
+      os << stop() << " s" << std::endl;
+      os.flags( old_flags );
+      os.precision( old_prec );
+    }
+    catch (...) {} // eat any exceptions
+  } 
+
+private:
+  std::ostream & os;
+};
+
+
+#endif //UBTIMING_H
diff --git a/src/VirtualFluidsBasics/basics/utilities/UbTuple.h b/src/VirtualFluidsBasics/basics/utilities/UbTuple.h
new file mode 100644
index 0000000000000000000000000000000000000000..621b378e12a0b37195ec268ce14581576b7de14b
--- /dev/null
+++ b/src/VirtualFluidsBasics/basics/utilities/UbTuple.h
@@ -0,0 +1,632 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 UbTupel.h
+//! \ingroup utilities
+//! \author Soeren Freudiger, Sebastian Geller
+//=======================================================================================
+#ifndef UBTUPLE_H
+#define UBTUPLE_H
+
+#include <iostream>
+#include <string>
+#include <ostream>
+
+//////////////////////////////////////////////////////////////////////////
+//! \brief A class implements a tuple
+//! \details
+//! usage: ...<BR>
+//! Advanced UbTuple
+//! Example:
+//! create and use tuple with only c1 field
+//! \code
+//! UbTuple<int,int,int,int,int> t1;
+//! val<1>(t1) += 42;
+//! std::cout << t1.v1() << std::endl;
+//! \endcode
+//! create and use duo:
+//! \code
+//! UbTuple<bool,int> t2;
+//! std::cout << val<1>(t2) << ", ";
+//! std::cout << t2.v1() << std::endl;
+//! \endcode
+//! create and use triple:
+//! \code
+//! UbTuple<bool,int,double> t3;
+//! val<1>(t3) = true;  // new values via: val< pos >(triple) = ...
+//! val<2>(t3) = 42;
+//! val<3>(t3) = 0.2;
+//! t3 = makeUbTuple(false, 23, 13.13);
+//! 
+//! std::cout << val<1>(t3) << ", ";
+//! std::cout << val<2>(t3) << ", ";
+//! std::cout << val<3>(t3) << std::endl;
+//! \endcode
+//! create and use quadruple:
+//! \code
+//! UbType<bool,int,float,double> t4(true,42,13,1.95583);
+//! std::cout << val<4>(t4) << std::endl;        //<- option 2 (std)
+//! std::cout << t4.v2().v2().v2() << std::endl; //<- option 2
+//! \endcode
+
+template <typename T>
+class UbTypeOp    // primary template
+{           
+public:
+   typedef T         ArgT;
+   typedef T         BareT;
+   typedef T const   ConstT;
+   typedef T &       RefT;
+   typedef T &       RefBareT;
+   typedef T const & RefConstT;
+};
+/**** end of typeop1.hpp ****/
+
+// partial specialization for const
+/**********************************
+* typeop2.hpp:
+**********************************/
+template <typename T>
+class UbTypeOp <T const>  // partial specialization for const types
+{
+ public:
+   typedef T const   ArgT;
+   typedef T         BareT;
+   typedef T const   ConstT;
+   typedef T const & RefT;
+   typedef T &       RefBareT;
+   typedef T const & RefConstT;
+};
+/**** end of typeop2.hpp ****/
+
+// partial specialization for references
+/**********************************
+* typeop3.hpp:
+**********************************/
+template <typename T>
+class UbTypeOp <T&>        // partial specialization for references
+{
+public:
+   typedef T &                           ArgT;
+   typedef typename UbTypeOp<T>::BareT   BareT;
+   typedef T const                       ConstT;
+   typedef T &                           RefT;
+   typedef typename UbTypeOp<T>::BareT & RefBareT;
+   typedef T const &                     RefConstT;
+};
+/**** end of typeop3.hpp ****/
+
+// full specialization for void
+/**********************************
+* typeop4.hpp:
+**********************************/
+template<>
+class UbTypeOp <void>      // full specialization for void
+{
+public:
+   typedef void       ArgT;
+   typedef void       BareT;
+   typedef void const ConstT;
+   typedef void       RefT;
+   typedef void       RefBareT;
+   typedef void       RefConstT;
+};
+/**** end of typeop4.hpp ****/
+
+template <typename T1, typename T2>
+class  UbDuo;
+
+template <typename T1, typename T2>
+std::ostream& operator << (std::ostream& os, UbDuo<T1, T2> const& d1);
+
+//duo1.hpp
+template <typename T1, typename T2>
+class UbDuo 
+{
+public:
+   typedef T1 Type1;  // type of first field
+   typedef T2 Type2;  // type of second field
+   enum { N = 2 };    // number of fields
+
+public:
+   // constructors
+   UbDuo() : value1(), value2() {  }
+   UbDuo (T1 const & a, T2 const & b) : value1(a), value2(b)  {  }
+
+   // for implicit type conversion during construction
+   template <typename U1, typename U2>
+   UbDuo (UbDuo<U1,U2> const & d) : value1(d.v1()), value2(d.v2()) {  }
+
+   // for implicit type conversion during assignments
+   template <typename U1, typename U2>
+   UbDuo<T1, T2>& operator = (UbDuo<U1,U2> const & d) 
+   {
+      value1 = d.v1();//value1;
+      value2 = d.v2();//value2;
+      return *this;
+   }
+
+   // field access
+   T1& v1()             { return value1; }
+   T1 const& v1() const { return value1; }
+
+   T2& v2()             { return value2; }
+   T2 const& v2() const { return value2; }
+
+private:
+   T1 value1;         // value of first field
+   T2 value2;         // value of second field
+};
+
+// comparison operators (allow mixed types):
+template <typename T1, typename T2,typename U1, typename U2>
+inline bool operator == (UbDuo<T1,T2> const& d1, UbDuo<U1,U2> const& d2)
+{
+   return d1.v1()==d2.v1() && d1.v2()==d2.v2();
+}
+
+template <typename T1, typename T2,typename U1, typename U2>
+inline bool operator != (UbDuo<T1,T2> const& d1, UbDuo<U1,U2> const& d2)
+{
+   return !(d1==d2);
+}
+
+template <typename T1, typename T2,typename U1, typename U2>
+inline bool operator < (UbDuo<T1,T2> const& d1, UbDuo<U1,U2> const& d2)
+{
+   if     (d1.v1() <  d2.v1() ) return true;
+   else if(d1.v1() == d2.v1() ) return d1.v2() < d2.v2();
+
+   return false;
+}
+
+template <typename T1, typename T2>
+std::ostream& operator << (std::ostream& os, UbDuo<T1, T2> const& d1)
+{
+    os << d1.v1() << ", " << d1.v2();
+    return os;
+}
+
+// convenience function  for creation and initialization
+template <typename T1, typename T2> 
+inline UbDuo<T1,T2> makeUbDuo(T1 const & a, T2 const & b)
+{
+   return UbDuo<T1,T2>(a,b);
+}
+
+//duo2.hpp
+template <typename A, typename B, typename C>
+class UbDuo<A, UbDuo<B,C> > 
+{
+public:
+   typedef A          T1;           // type of first field
+   typedef UbDuo<B,C> T2;           // type of second field
+   enum { N = UbDuo<B,C>::N + 1 };  // number of fields
+ 
+public:
+   // constructors
+   UbDuo() : value1(), value2() { }
+   UbDuo (T1 const & a, T2 const & b) : value1(a), value2(b) { }
+
+   // for implicit type conversion during construction
+   template <typename U1, typename U2>
+   UbDuo (UbDuo<U1,U2> const & d) : value1(d.v1()), value2(d.v2()) { }
+
+   // for implicit type conversion during assignments
+   template <typename U1, typename U2>
+   UbDuo<T1, T2>& operator = (UbDuo<U1,U2> const & d) 
+   { 
+      value1 = d.v1();//value1;     
+      value2 = d.v2();//value2;
+      return *this;
+   }
+
+   // field access
+   T1& v1()             { return value1; }
+   T1 const& v1() const { return value1; }
+
+   T2& v2()             { return value2; }
+   T2 const& v2() const { return value2; }
+
+private:
+   T1 value1;         // value of first field
+   T2 value2;         // value of second field
+};
+
+//duo3.hpp
+// primary template for type of Nth field of (duo) T
+template <int N, typename T>
+class UbDuoT 
+{
+public:
+   typedef void ResultT;    // in general, the result type is void
+};
+
+// specialization for 1st field of a plain duo
+template <typename A, typename B>
+class UbDuoT<1, UbDuo<A,B> > 
+{
+public:
+   typedef A ResultT;
+};
+
+// specialization for 2nd field of a plain duo
+template <typename A, typename B>
+class UbDuoT<2, UbDuo<A,B> > 
+{
+public:
+   typedef B ResultT;
+};
+
+// specialization for Nth field of a recursive duo
+template <int N, typename A, typename B, typename C>
+class UbDuoT<N, UbDuo<A, UbDuo<B,C> > > 
+{
+public:
+   typedef typename UbDuoT<N-1, UbDuo<B,C> >::ResultT ResultT;
+};
+
+// specialization for 1st field of a recursive duo
+template <typename A, typename B, typename C>
+class UbDuoT<1, UbDuo<A, UbDuo<B,C> > > 
+{
+public:
+   typedef A ResultT;
+};
+
+// specialization for 2nd field of a recursive duo
+template <typename A, typename B, typename C>
+class UbDuoT<2, UbDuo<A, UbDuo<B,C> > > 
+{
+public:
+   typedef B ResultT;
+};
+
+//duo4.hpp
+// primary template for value of Nth field of (duo) T
+template <int N, typename T>
+class DuoValue 
+{
+public:
+   static void get(T&) {  }      // in general, we have no value
+   static void get(T const&) { }
+};
+
+// specialization for 1st field of a plain duo
+template <typename A, typename B>
+class DuoValue<1, UbDuo<A, B> > 
+{
+public:
+   static A& get(UbDuo<A, B> &d)             { return d.v1(); }
+   static A const& get(UbDuo<A, B> const &d) { return d.v1(); }
+};
+
+// specialization for 2nd field of a plain duo
+template <typename A, typename B>
+class DuoValue<2, UbDuo<A, B> > 
+{
+public:
+   static B& get(UbDuo<A, B> &d)             { return d.v2(); }
+   static B const& get(UbDuo<A, B> const &d) { return d.v2(); }
+};
+
+// specialization for Nth field of recursive duo
+template <int N, typename A, typename B, typename C>
+struct DuoValue<N, UbDuo<A, UbDuo<B,C> > >
+{
+   static typename UbTypeOp<typename UbDuoT<N-1, UbDuo<B,C> >::ResultT>::RefT  get(UbDuo<A, UbDuo<B,C> > &d)
+   { 
+      return DuoValue<N-1, UbDuo<B,C> >::get(d.v2()); 
+   }
+   static typename UbTypeOp<typename UbDuoT<N-1, UbDuo<B,C> >::ResultT>::RefConstT  get(UbDuo<A, UbDuo<B,C> > const &d)
+   { 
+      return DuoValue<N-1, UbDuo<B,C> >::get(d.v2()); 
+   }
+};
+
+// specialization for 1st field of recursive duo
+template <typename A, typename B, typename C>
+class DuoValue<1, UbDuo<A, UbDuo<B,C> > > 
+{
+public:
+   static A& get(UbDuo<A, UbDuo<B,C> > &d)             { return d.v1(); }
+   static A const& get(UbDuo<A, UbDuo<B,C> > const &d) { return d.v1(); }
+};
+
+// specialization for 2nd field of recursive duo
+template <typename A, typename B, typename C>
+class DuoValue<2, UbDuo<A, UbDuo<B,C> > > 
+{
+public:
+   static B& get(UbDuo<A, UbDuo<B,C> > &d)             { return d.v2().v1(); }
+   static B const& get(UbDuo<A, UbDuo<B,C> > const &d) { return d.v2().v1(); }
+};
+
+//duo5.hpp
+// return Nth value of variable duo
+template <int N, typename A, typename B> 
+inline typename UbTypeOp<typename UbDuoT<N, UbDuo<A, B> >::ResultT>::RefT val(UbDuo<A, B>& d)
+{
+   return DuoValue<N, UbDuo<A, B> >::get(d);
+}
+
+// return Nth value of constant duo
+template <int N, typename A, typename B> 
+inline typename UbTypeOp<typename UbDuoT<N, UbDuo<A, B> >::ResultT>::RefConstT val(UbDuo<A, B> const& d)
+{
+   return DuoValue<N, UbDuo<A, B> >::get(d);
+}
+
+//duo6.hpp
+// partial specialization for UbDuo<> with only c1 field
+template <typename A>
+struct UbDuo<A,void> 
+{
+public:
+   typedef A    T1;  // type of first field
+   typedef void T2;  // type of second field
+   enum { N = 1 };   // number of fields
+
+private:
+   T1 value1;        // value of first field
+
+public:
+   // constructors
+   UbDuo() : value1() { }
+   UbDuo (T1 const & a) : value1(a) { }
+
+   // field access
+   T1& v1()             { return value1; }
+   T1 const& v1() const { return value1; }
+
+   void v2() { }
+   void v2() const { }
+
+};
+
+//tupel1.hpp
+// type that represents unused type parameters
+class UbNullT 
+{
+};
+
+//////////////////////////////////////////////////////////////////////////
+//! \brief A class implements a tuple
+//! \details
+//! usage: ...<BR>
+//! Advanced UbTuple
+//! Example:
+//! create and use tuple with only c1 field
+//! \code
+//! UbTuple<int,int,int,int,int> t1;
+//! val<1>(t1) += 42;
+//! std::cout << t1.v1() << std::endl;
+//! \endcode
+//! create and use duo:
+//! \code
+//! UbTuple<bool,int> t2;
+//! std::cout << val<1>(t2) << ", ";
+//! std::cout << t2.v1() << std::endl;
+//! \endcode
+//! create and use triple:
+//! \code
+//! UbTuple<bool,int,double> t3;
+//! val<1>(t3) = true;  // new values via: val< pos >(triple) = ...
+//! val<2>(t3) = 42;
+//! val<3>(t3) = 0.2;
+//! t3 = makeUbTuple(false, 23, 13.13);
+//! 
+//! std::cout << val<1>(t3) << ", ";
+//! std::cout << val<2>(t3) << ", ";
+//! std::cout << val<3>(t3) << std::endl;
+//! \endcode
+//! create and use quadruple:
+//! \code
+//! UbType<bool,int,float,double> t4(true,42,13,1.95583);
+//! std::cout << val<4>(t4) << std::endl;        //<- option 2 (std)
+//! std::cout << t4.v2().v2().v2() << std::endl; //<- option 2
+//! \endcode
+
+// UbTuple<> in general derives from UbTuple<> with c1 more UbNullT
+template <typename P1,
+          typename P2 = UbNullT,
+          typename P3 = UbNullT,
+          typename P4 = UbNullT,
+          typename P5 = UbNullT,
+          typename P6 = UbNullT,
+          typename P7 = UbNullT,
+          typename P8 = UbNullT >
+class UbTuple : public UbDuo<P1, typename UbTuple<P2,P3,P4,P5,P6,P7,P8,UbNullT>::BaseT> 
+{
+public:
+   typedef UbDuo<P1, typename UbTuple<P2,P3,P4,P5,P6,P7,P8,UbNullT>::BaseT>  BaseT;
+
+   // constructor:
+   UbTuple() {}
+   UbTuple( typename UbTypeOp<P1>::RefConstT a1,
+            typename UbTypeOp<P2>::RefConstT a2,
+            typename UbTypeOp<P3>::RefConstT a3 = UbNullT(),
+            typename UbTypeOp<P4>::RefConstT a4 = UbNullT(),
+            typename UbTypeOp<P5>::RefConstT a5 = UbNullT(),
+            typename UbTypeOp<P6>::RefConstT a6 = UbNullT(),
+            typename UbTypeOp<P7>::RefConstT a7 = UbNullT(),
+            typename UbTypeOp<P8>::RefConstT a8 = UbNullT() )
+      : BaseT(a1, UbTuple<P2,P3,P4,P5,P6,P7,P8,UbNullT>(a2,a3,a4,a5,a6,a7,a8))
+   {
+   }
+
+   // for implicit type conversion during assignments
+   template <typename U1,typename U2, typename U3, typename U4, typename U5, typename U6, typename U7, typename U8 >
+   UbTuple<P1,P2,P3,P4,P5,P6,P7,P8>& operator = ( const UbTuple<U1,U2,U3,U4,U5,U6,U7,U8>& rhs)
+   {
+      this->BaseT::operator=( typename UbTuple<U1,U2,U3,U4,U5,U6,U7,U8>::BaseT(rhs) );
+      return *this;
+   }
+
+};
+
+// specialization to end deriving recursion
+template <typename P1, typename P2>
+class UbTuple<P1,P2,UbNullT,UbNullT,UbNullT,UbNullT,UbNullT,UbNullT> : public UbDuo<P1,P2> {
+public:
+   typedef UbDuo<P1,P2> BaseT;
+   
+   // constructor:
+   UbTuple() {}
+   UbTuple( typename UbTypeOp<P1>::RefConstT a1,
+            typename UbTypeOp<P2>::RefConstT a2,
+            typename UbTypeOp<UbNullT>::RefConstT = UbNullT(),
+            typename UbTypeOp<UbNullT>::RefConstT = UbNullT(),
+            typename UbTypeOp<UbNullT>::RefConstT = UbNullT(),
+            typename UbTypeOp<UbNullT>::RefConstT = UbNullT(),
+            typename UbTypeOp<UbNullT>::RefConstT = UbNullT(),
+            typename UbTypeOp<UbNullT>::RefConstT = UbNullT() )
+      : BaseT(a1, a2) 
+   {
+   }
+
+   // for implicit type conversion during assignments
+   template <typename U1,typename U2 >
+   UbTuple<P1,P2>& operator = ( const UbTuple<U1,U2>& rhs)
+   {
+      this->BaseT::operator=( typename UbTuple<U1,U2>::BaseT(rhs) );
+      return *this;
+   }
+
+};
+
+// specialization for singletons
+template <typename P1>
+class UbTuple<P1,UbNullT,UbNullT,UbNullT,UbNullT,UbNullT,UbNullT,UbNullT> : public UbDuo<P1,void>
+{
+public:
+   typedef UbDuo<P1,void> BaseT;
+
+   // constructor:
+   UbTuple() {}
+   UbTuple( typename UbTypeOp<P1>::RefConstT a1,
+            typename UbTypeOp<UbNullT>::RefConstT = UbNullT(),
+            typename UbTypeOp<UbNullT>::RefConstT = UbNullT(),
+            typename UbTypeOp<UbNullT>::RefConstT = UbNullT(),
+            typename UbTypeOp<UbNullT>::RefConstT = UbNullT(),
+            typename UbTypeOp<UbNullT>::RefConstT = UbNullT(),
+            typename UbTypeOp<UbNullT>::RefConstT = UbNullT(),
+            typename UbTypeOp<UbNullT>::RefConstT = UbNullT() )
+      : BaseT(a1) 
+   {
+   }
+
+   // for implicit type conversion during assignments
+   template <typename U1 >
+   UbTuple<P1>& operator = ( const UbTuple<U1>& rhs)
+   {
+      this->v1() = rhs.v1();
+      return *this;
+   }
+
+};
+
+// convenience function for 1 argument
+template <typename T1> 
+inline UbTuple<T1> makeUbTuple(T1 const &a1)
+{
+   return UbTuple<T1>(a1);
+}
+
+// convenience function for 2 arguments
+template <typename T1, typename T2>
+inline UbTuple<T1,T2> makeUbTuple(T1 const &a1, T2 const &a2)
+{
+   return UbTuple<T1,T2>(a1,a2);
+}
+
+// convenience function for 3 arguments
+template <typename T1, typename T2, typename T3>
+inline UbTuple<T1,T2,T3> makeUbTuple(T1 const &a1, T2 const &a2, T3 const &a3)
+{
+   return UbTuple<T1,T2,T3>(a1,a2,a3);
+}
+
+// convenience function for 4 arguments
+template <typename T1, typename T2, typename T3, typename T4>
+inline UbTuple<T1,T2,T3,T4> makeUbTuple(T1 const &a1, T2 const &a2, T3 const &a3, T4 const &a4)
+{
+   return UbTuple<T1,T2,T3,T4>(a1,a2,a3,a4);
+}
+
+// convenience function for 5 arguments
+template <typename T1, typename T2, typename T3, typename T4, typename T5>
+inline UbTuple<T1,T2,T3,T4,T5> makeUbTuple(T1 const &a1, T2 const &a2, T3 const &a3, T4 const &a4,T5 const &a5)
+{
+   return UbTuple<T1,T2,T3,T4,T5>(a1,a2,a3,a4,a5);
+}
+
+// convenience function for 6 arguments
+template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
+inline UbTuple<T1,T2,T3,T4,T5,T6> makeUbTuple(T1 const &a1, T2 const &a2, T3 const &a3, T4 const &a4, T5 const &a5, T6 const &a6)
+{
+   return UbTuple<T1,T2,T3,T4,T5,T6>(a1,a2,a3,a4,a5,a6);
+}
+
+// convenience function for 7 arguments
+template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7>
+inline UbTuple<T1,T2,T3,T4,T5,T6,T7> makeUbTuple(T1 const &a1, T2 const &a2, T3 const &a3, T4 const &a4, T5 const &a5, T6 const &a6, T7 const &a7)
+{
+   return UbTuple<T1,T2,T3,T4,T5,T6,T7>(a1,a2,a3,a4,a5,a6,a7);
+}
+
+// convenience function for 8 arguments
+template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8>
+inline UbTuple<T1,T2,T3,T4,T5,T6,T7,T8> makeUbTuple(T1 const &a1, T2 const &a2,T3 const &a3, T4 const &a4,T5 const &a5, T6 const &a6,T7 const &a7, T8 const &a8 )
+{
+   return UbTuple<T1,T2,T3,T4,T5,T6,T7,T8>(a1,a2,a3,a4,a5,a6,a7,a8);
+}
+
+//some typedefs
+typedef UbTuple<float,float>                               UbTupleFloat2;
+typedef UbTuple<float,float,float>                         UbTupleFloat3;
+typedef UbTuple<int,int>                                   UbTupleInt2;
+typedef UbTuple<int,int,int>                               UbTupleInt3;
+typedef UbTuple<int,int,int,int>                           UbTupleInt4;
+typedef UbTuple<int,int,int,int,int>                       UbTupleInt5;
+typedef UbTuple<int,int,int,int,int,int>                   UbTupleInt6;
+typedef UbTuple<int,int,int,int,int,int,int,int>           UbTupleInt8;
+typedef UbTuple<double,double>                             UbTupleDouble2;
+typedef UbTuple<double,double,double>                      UbTupleDouble3;
+typedef UbTuple<double,double,double,double>               UbTupleDouble4;
+typedef UbTuple<double,double,double,double,double,double> UbTupleDouble6;
+typedef UbTuple<std::string,double,double>                 UbTupleStringDouble2;
+typedef UbTuple<std::string,double,double,double>          UbTupleStringDouble3;
+typedef UbTuple<std::string,int,int,int>                   UbTupleStringInt3;
+typedef UbTuple<short,short,short,short>                   UbTupleShort4;
+typedef UbTuple<bool,bool,bool>                            UbTupleBool3;
+typedef UbTuple<int,double,double>                         UbTupleIntDouble2;
+typedef UbTuple<int, bool>                                 UbTupleIntBool;
+
+
+#endif //UBTUPLE_H
diff --git a/src/VirtualFluidsBasics/basics/utilities/Vector3D.cpp b/src/VirtualFluidsBasics/basics/utilities/Vector3D.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..6b39ee8a410689d89bc41dfc2ed8291f11bd5bb1
--- /dev/null
+++ b/src/VirtualFluidsBasics/basics/utilities/Vector3D.cpp
@@ -0,0 +1,642 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 UbVector3D.cpp
+//! \ingroup utilities
+//! \author Soeren Freudiger, Sebastian Geller
+//=======================================================================================
+#include <basics/utilities/Vector3D.h>
+
+#include <cassert>
+#include <sstream>
+
+#include <basics/utilities/UbMath.h>
+#include <basics/utilities/UbInfinity.h>
+
+
+
+const Vector3D Vector3D::ZERO(0.0,0.0,0.0);
+const Vector3D Vector3D::UNIT_X1(1.0,0.0,0.0);
+const Vector3D Vector3D::UNIT_X2(0.0,1.0,0.0);
+const Vector3D Vector3D::UNIT_X3(0.0,0.0,1.0);
+
+/*=======================================================*/
+Vector3D::Vector3D() 
+{                                      
+   m_afTuple[0] = 0.0;
+   m_afTuple[1] = 0.0;
+   m_afTuple[2] = 0.0;
+}
+/*=======================================================*/
+Vector3D::Vector3D(const double& fX, const double& fY, const double& fZ) 
+{
+   m_afTuple[0] = fX;
+   m_afTuple[1] = fY;
+   m_afTuple[2] = fZ;
+}
+/*=======================================================*/
+Vector3D::Vector3D (const Vector3D& rkV) 
+{
+   m_afTuple[0] = rkV.m_afTuple[0];
+   m_afTuple[1] = rkV.m_afTuple[1];
+   m_afTuple[2] = rkV.m_afTuple[2];
+}
+/*=======================================================*/
+std::string Vector3D::toString()  const
+{
+   std::stringstream os;
+   os<< "Vector3D["<<m_afTuple[0]<<","<<m_afTuple[1]<<","<<m_afTuple[2]<<"]";
+   return os.str();
+}
+/*=======================================================*/
+Vector3D::operator const double*() const
+{
+   return m_afTuple;
+}
+/*=======================================================*/
+Vector3D::operator double*()
+{
+   return m_afTuple;
+}
+/*=======================================================*/
+double Vector3D::operator[](const int& i) const
+{
+   assert( i >= 0 && i <= 2 );
+   return m_afTuple[i];
+}
+/*=======================================================*/
+double& Vector3D::operator[](const int& i)
+{
+   assert( i >= 0 && i <= 2 );
+   return m_afTuple[i];
+}
+/*=======================================================*/
+double Vector3D::X1() const
+{
+   return m_afTuple[0];
+}
+/*=======================================================*/
+double& Vector3D::X1()
+{
+   return m_afTuple[0];
+}
+/*=======================================================*/
+double Vector3D::X2() const
+{
+   return m_afTuple[1];
+}
+/*=======================================================*/
+double& Vector3D::X2()
+{
+   return m_afTuple[1];
+}
+/*=======================================================*/
+double Vector3D::X3() const
+{
+   return m_afTuple[2];
+}
+/*=======================================================*/
+double& Vector3D::X3()
+{
+   return m_afTuple[2];
+}
+/*=======================================================*/
+Vector3D& Vector3D::operator=(const Vector3D& rkV)
+{
+   m_afTuple[0] = rkV.m_afTuple[0];
+   m_afTuple[1] = rkV.m_afTuple[1];
+   m_afTuple[2] = rkV.m_afTuple[2];
+   return *this;
+}
+/*=======================================================*/
+int Vector3D::CompareArrays(const Vector3D& rkV) const
+{
+   return memcmp(m_afTuple,rkV.m_afTuple,3*sizeof(double));
+}
+/*=======================================================*/
+bool Vector3D::operator==(const Vector3D& rkV) const
+{
+   return CompareArrays(rkV) == 0;
+}
+/*=======================================================*/
+bool Vector3D::operator!=(const Vector3D& rkV) const
+{
+   return CompareArrays(rkV) != 0;
+}
+/*=======================================================*/
+bool Vector3D::operator<(const Vector3D& rkV) const
+{
+   return CompareArrays(rkV) < 0;
+}
+/*=======================================================*/
+bool Vector3D::operator<=(const Vector3D& rkV) const
+{
+   return CompareArrays(rkV) <= 0;
+}
+/*=======================================================*/
+bool Vector3D::operator> (const Vector3D& rkV) const
+{
+   return CompareArrays(rkV) > 0;
+}
+/*=======================================================*/
+bool Vector3D::operator>=(const Vector3D& rkV) const
+{
+   return CompareArrays(rkV) >= 0;
+}
+/*=======================================================*/
+Vector3D Vector3D::operator+(const Vector3D& rkV) const
+{
+   return Vector3D( m_afTuple[0]+rkV.m_afTuple[0],
+                    m_afTuple[1]+rkV.m_afTuple[1],
+                    m_afTuple[2]+rkV.m_afTuple[2] );
+}
+/*=======================================================*/
+Vector3D Vector3D::Add(Vector3D& vector)
+{
+   return Vector3D( m_afTuple[0]+vector.m_afTuple[0],
+                    m_afTuple[1]+vector.m_afTuple[1],
+                    m_afTuple[2]+vector.m_afTuple[2] );
+}
+/*=======================================================*/
+Vector3D Vector3D::operator- (const Vector3D& rkV) const
+{
+   return Vector3D( m_afTuple[0]-rkV.m_afTuple[0],
+                    m_afTuple[1]-rkV.m_afTuple[1],
+                    m_afTuple[2]-rkV.m_afTuple[2] );
+}
+/*=======================================================*/
+Vector3D Vector3D::Subtract(Vector3D& vector)
+{
+   return Vector3D( m_afTuple[0]-vector.m_afTuple[0],
+                    m_afTuple[1]-vector.m_afTuple[1],
+                    m_afTuple[2]-vector.m_afTuple[2] );
+}
+/*=======================================================*/
+Vector3D Vector3D::operator*(const double& fScalar) const
+{
+   return Vector3D( fScalar*m_afTuple[0],
+                    fScalar*m_afTuple[1],
+                    fScalar*m_afTuple[2]  );
+}
+/*=======================================================*/
+Vector3D Vector3D::operator/(const double& fScalar) const
+{
+   Vector3D kQuot;
+
+   if ( fScalar != 0.0 )
+   {
+      double fInvScalar = 1.0/fScalar;
+      kQuot.m_afTuple[0] = fInvScalar*m_afTuple[0];
+      kQuot.m_afTuple[1] = fInvScalar*m_afTuple[1];
+      kQuot.m_afTuple[2] = fInvScalar*m_afTuple[2];
+   }
+   else
+   {
+      kQuot.m_afTuple[0] = Ub::inf;
+      kQuot.m_afTuple[1] = Ub::inf;
+      kQuot.m_afTuple[2] = Ub::inf;
+   }
+
+   return kQuot;
+}
+/*=======================================================*/
+Vector3D Vector3D::operator-() const
+{
+   return Vector3D( -m_afTuple[0],
+                    -m_afTuple[1],
+                    -m_afTuple[2] );
+}
+/*=======================================================*/
+Vector3D& Vector3D::operator+=(const Vector3D& rkV)
+{
+   m_afTuple[0] += rkV.m_afTuple[0];
+   m_afTuple[1] += rkV.m_afTuple[1];
+   m_afTuple[2] += rkV.m_afTuple[2];
+   return *this;
+}
+/*=======================================================*/
+Vector3D& Vector3D::operator-=(const Vector3D& rkV)
+{
+   m_afTuple[0] -= rkV.m_afTuple[0];
+   m_afTuple[1] -= rkV.m_afTuple[1];
+   m_afTuple[2] -= rkV.m_afTuple[2];
+   return *this;
+}
+/*=======================================================*/
+Vector3D& Vector3D::operator*=(const double& fScalar)
+{
+   m_afTuple[0] *= fScalar;
+   m_afTuple[1] *= fScalar;
+   m_afTuple[2] *= fScalar;
+   return *this;
+}
+/*=======================================================*/
+Vector3D& Vector3D::operator/=(const double& fScalar)
+{
+   if ( !UbMath::zero(fScalar) )
+   {
+      double fInvScalar = 1.0/fScalar;
+      m_afTuple[0] *= fInvScalar;
+      m_afTuple[1] *= fInvScalar;
+      m_afTuple[2] *= fInvScalar;
+   }
+   else
+   {
+      m_afTuple[0] = Ub::inf;
+      m_afTuple[1] = Ub::inf;
+      m_afTuple[2] = Ub::inf;
+   }
+
+   return *this;
+}
+/*=======================================================*/
+Vector3D Vector3D::Scale(const double& x)
+{
+   Vector3D PointA(0.0,0.0,0.0);
+   PointA.m_afTuple[0] = x * m_afTuple[0];
+   PointA.m_afTuple[1] = x * m_afTuple[1];
+   PointA.m_afTuple[2] = x * m_afTuple[2];
+   return PointA;	
+}
+/*=======================================================*/
+double Vector3D::Length() const
+{
+   return std::sqrt( m_afTuple[0]*m_afTuple[0] +
+                     m_afTuple[1]*m_afTuple[1] +
+                     m_afTuple[2]*m_afTuple[2] );
+}
+/*=======================================================*/
+double Vector3D::SquaredLength() const
+{
+   return m_afTuple[0]*m_afTuple[0] +
+          m_afTuple[1]*m_afTuple[1] +
+          m_afTuple[2]*m_afTuple[2];
+}
+/*=======================================================*/
+double Vector3D::Dot(const Vector3D& rkV) const
+{
+   return m_afTuple[0]*rkV.m_afTuple[0] +
+          m_afTuple[1]*rkV.m_afTuple[1] +
+          m_afTuple[2]*rkV.m_afTuple[2];
+}
+/*=======================================================*/
+double Vector3D::Normalize()
+{
+   double fLength = Length();
+
+   if( !UbMath::zero(fLength) )
+   {
+      double fInvLength = 1.0/fLength;
+      m_afTuple[0] *= fInvLength;
+      m_afTuple[1] *= fInvLength;
+      m_afTuple[2] *= fInvLength;
+   }
+   else
+   {
+      fLength = 0.0;
+      m_afTuple[0] = 0.0;
+      m_afTuple[1] = 0.0;
+      m_afTuple[2] = 0.0;
+   }
+
+   return fLength;
+}
+/*=======================================================*/
+Vector3D Vector3D::Cross(const Vector3D& rkV) const
+{
+   return Vector3D( m_afTuple[1]*rkV.m_afTuple[2] - m_afTuple[2]*rkV.m_afTuple[1],
+                    m_afTuple[2]*rkV.m_afTuple[0] - m_afTuple[0]*rkV.m_afTuple[2],
+                    m_afTuple[0]*rkV.m_afTuple[1] - m_afTuple[1]*rkV.m_afTuple[0] );
+}
+/*=======================================================*/
+Vector3D Vector3D::UnitCross(const Vector3D& rkV) const
+{
+   Vector3D kCross( m_afTuple[1]*rkV.m_afTuple[2] - m_afTuple[2]*rkV.m_afTuple[1],
+                    m_afTuple[2]*rkV.m_afTuple[0] - m_afTuple[0]*rkV.m_afTuple[2],
+                    m_afTuple[0]*rkV.m_afTuple[1] - m_afTuple[1]*rkV.m_afTuple[0] );
+   kCross.Normalize();
+   return kCross;
+}
+/*=======================================================*/
+void Vector3D::GetBarycentrics(const Vector3D& rkV0,const Vector3D& rkV1, const Vector3D& rkV2,const Vector3D& rkV3, double afBary[4]) const
+{
+   // compute the vectors relative to V3 of the tetrahedron
+   Vector3D akDiff[4] = { rkV0  - rkV3,
+                          rkV1  - rkV3,
+                          rkV2  - rkV3,
+                          *this - rkV3 };
+
+   // If the vertices have large magnitude, the linear system of
+   // equations for computing barycentric coordinates can be
+   // ill-conditioned.  To avoid this, uniformly scale the tetrahedron
+   // edges to be of order 1.  The scaling of all differences does not
+   // change the barycentric coordinates.
+   double fMax = 0.0,fValue=0.0;
+   for(int i=0; i<3; i++)
+      for (int j=0; j<3; j++)
+      {
+         fValue = std::fabs(akDiff[i][j]);
+         if ( fValue > fMax )  fMax = fValue;
+      }
+   
+   // scale down only large data
+   if(UbMath::greater(fMax,1.0) )
+   {
+      double fInvMax = ((double)1.0)/fMax;
+      for( int i=0; i<4; i++)
+         akDiff[i] *= fInvMax;
+   }
+
+   double     fDet = akDiff[0].Dot(akDiff[1].Cross(akDiff[2]));
+   Vector3D kE1cE2 = akDiff[1].Cross(akDiff[2]);
+   Vector3D kE2cE0 = akDiff[2].Cross(akDiff[0]);
+   Vector3D kE0cE1 = akDiff[0].Cross(akDiff[1]);
+   
+   if( !UbMath::zero( fDet ) )
+   {
+      double fInvDet = 1.0/fDet;
+      afBary[0] = akDiff[3].Dot(kE1cE2)*fInvDet;
+      afBary[1] = akDiff[3].Dot(kE2cE0)*fInvDet;
+      afBary[2] = akDiff[3].Dot(kE0cE1)*fInvDet;
+      afBary[3] = 1.0 - afBary[0] - afBary[1] - afBary[2];
+   }
+   else
+   {
+      // The tetrahedron is potentially flat.  Determine the face of
+      // maximum area and compute barycentric coordinates with respect
+      // to that face.
+      Vector3D kE02 = rkV0 - rkV2;
+      Vector3D kE12 = rkV1 - rkV2;
+      Vector3D kE02cE12 = kE02.Cross(kE12);
+      double fMaxSqrArea = kE02cE12.SquaredLength();
+      int iMaxIndex = 3;
+      double fSqrArea = kE0cE1.SquaredLength();
+      if ( fSqrArea > fMaxSqrArea )
+      {
+         iMaxIndex = 0;
+         fMaxSqrArea = fSqrArea;
+      }
+      fSqrArea = kE1cE2.SquaredLength();
+      if ( fSqrArea > fMaxSqrArea )
+      {
+         iMaxIndex = 1;
+         fMaxSqrArea = fSqrArea;
+      }
+      fSqrArea = kE2cE0.SquaredLength();
+      if ( fSqrArea > fMaxSqrArea )
+      {
+         iMaxIndex = 2;
+         fMaxSqrArea = fSqrArea;
+      }
+
+      if (UbMath::greater(fMaxSqrArea,0.0)  )
+      {
+         double fInvSqrArea = 1.0/fMaxSqrArea;
+         Vector3D kTmp;
+         if( iMaxIndex==0 )
+         {
+            kTmp      = akDiff[3].Cross(akDiff[1]);
+            afBary[0] = kE0cE1.Dot(kTmp)*fInvSqrArea;
+            kTmp      = akDiff[0].Cross(akDiff[3]);
+            afBary[1] = kE0cE1.Dot(kTmp)*fInvSqrArea;
+            afBary[2] = 0.0;
+            afBary[3] = 1.0 - afBary[0] - afBary[1];
+         }
+         else if( iMaxIndex == 1 )
+         {
+            afBary[0] = 0.0;
+            kTmp      = akDiff[3].Cross(akDiff[2]);
+            afBary[1] = kE1cE2.Dot(kTmp)*fInvSqrArea;
+            kTmp      = akDiff[1].Cross(akDiff[3]);
+            afBary[2] = kE1cE2.Dot(kTmp)*fInvSqrArea;
+            afBary[3] = 1.0 - afBary[1] - afBary[2];
+         }
+         else if( iMaxIndex == 2 )
+         {
+            kTmp      = akDiff[2].Cross(akDiff[3]);
+            afBary[0] = kE2cE0.Dot(kTmp)*fInvSqrArea;
+            afBary[1] = 0.0;
+            kTmp      = akDiff[3].Cross(akDiff[0]);
+            afBary[2] = kE2cE0.Dot(kTmp)*fInvSqrArea;
+            afBary[3] = 1.0 - afBary[0] - afBary[2];
+         }
+         else
+         {
+            akDiff[3] = *this - rkV2;
+            kTmp      = akDiff[3].Cross(kE12);
+            afBary[0] = kE02cE12.Dot(kTmp)*fInvSqrArea;
+            kTmp      = kE02.Cross(akDiff[3]);
+            afBary[1] = kE02cE12.Dot(kTmp)*fInvSqrArea;
+            afBary[2] = 1.0 - afBary[0] - afBary[1];
+            afBary[3] = 0.0;
+         }
+      }
+      else
+      {
+         // The tetrahedron is potentially a sliver.  Determine the edge of
+         // maximum length and compute barycentric coordinates with respect
+         // to that edge.
+         double fMaxSqrLength = akDiff[0].SquaredLength();
+         iMaxIndex            = 0;  // <V0,V3>
+         double fSqrLength    = akDiff[1].SquaredLength();
+         
+         if( fSqrLength > fMaxSqrLength )
+         {
+            iMaxIndex     = 1;  // <V1,V3>
+            fMaxSqrLength = fSqrLength;
+         }
+         fSqrLength = akDiff[2].SquaredLength();
+         
+         if( fSqrLength > fMaxSqrLength )
+         {
+            iMaxIndex     = 2;  // <V2,V3>
+            fMaxSqrLength = fSqrLength;
+         }
+         fSqrLength = kE02.SquaredLength();
+         
+         if( fSqrLength > fMaxSqrLength )
+         {
+            iMaxIndex     = 3;  // <V0,V2>
+            fMaxSqrLength = fSqrLength;
+         }
+         fSqrLength = kE12.SquaredLength();
+         
+         if( fSqrLength > fMaxSqrLength )
+         {
+            iMaxIndex     = 4;  // <V1,V2>
+            fMaxSqrLength = fSqrLength;
+         }
+         
+         Vector3D kE01 = rkV0 - rkV1;
+         fSqrLength    = kE01.SquaredLength();
+         
+         if( fSqrLength > fMaxSqrLength )
+         {
+            iMaxIndex     = 5;  // <V0,V1>
+            fMaxSqrLength = fSqrLength;
+         }
+
+         if(UbMath::greater(fMaxSqrLength, 0.0) )
+         {
+            double fInvSqrLength = 1.0/fMaxSqrLength;
+            if( iMaxIndex == 0 )
+            {
+               // P-V3 = t*(V0-V3)
+               afBary[0] = akDiff[3].Dot(akDiff[0])*fInvSqrLength;
+               afBary[1] = 0.0;
+               afBary[2] = 0.0;
+               afBary[3] = 1.0 - afBary[0];
+            }
+            else if( iMaxIndex == 1 )
+            {
+               // P-V3 = t*(V1-V3)
+               afBary[0] = 0.0;
+               afBary[1] = akDiff[3].Dot(akDiff[1])*fInvSqrLength;
+               afBary[2] = 0.0;
+               afBary[3] = 1.0 - afBary[1];
+            }
+            else if( iMaxIndex == 2 )
+            {
+               // P-V3 = t*(V2-V3)
+               afBary[0] = 0.0;
+               afBary[1] = 0.0;
+               afBary[2] = akDiff[3].Dot(akDiff[2])*fInvSqrLength;
+               afBary[3] = 1.0 - afBary[2];
+            }
+            else if( iMaxIndex == 3 )
+            {      
+               // P-V2 = t*(V0-V2)
+               akDiff[3] = *this - rkV2;
+               afBary[0] = akDiff[3].Dot(kE02)*fInvSqrLength;
+               afBary[1] = 0.0;
+               afBary[2] = 1.0 - afBary[0];
+               afBary[3] = 0.0;
+            }
+            else if( iMaxIndex == 4 )
+            {
+               // P-V2 = t*(V1-V2)
+               akDiff[3] = *this - rkV2;
+               afBary[0] = 0.0;
+               afBary[1] = akDiff[3].Dot(kE12)*fInvSqrLength;
+               afBary[2] = 1.0 - afBary[1];
+               afBary[3] = 0.0;
+            }
+            else
+            {
+               // P-V1 = t*(V0-V1)
+               akDiff[3] = *this - rkV1;
+               afBary[0] = akDiff[3].Dot(kE01)*fInvSqrLength;
+               afBary[1] = 1.0 - afBary[0];
+               afBary[2] = 0.0;
+               afBary[3] = 0.0;
+            }
+         }
+         else
+         {
+            // tetrahedron is a nearly a point, just return equal weights
+            afBary[0] = 0.25;
+            afBary[1] = afBary[0];
+            afBary[2] = afBary[0];
+            afBary[3] = afBary[0];
+         }
+      }
+   }
+}
+/*=======================================================*/
+void Vector3D::Orthonormalize(Vector3D& rkU, Vector3D& rkV, Vector3D& rkW)
+{
+   // If the input vectors are v0, v1, and v2, then the Gram-Schmidt
+   // orthonormalization produces vectors u0, u1, and u2 as follows,
+   //
+   //   u0 = v0/|v0|
+   //   u1 = (v1-(u0*v1)u0)/|v1-(u0*v1)u0|
+   //   u2 = (v2-(u0*v2)u0-(u1*v2)u1)/|v2-(u0*v2)u0-(u1*v2)u1|
+   //
+   // where |A| indicates length of vector A and A*B indicates dot
+   // product of vectors A and B.
+
+   // compute u0
+   rkU.Normalize();
+
+   // compute u1
+   double fDot0 = rkU.Dot(rkV); 
+   rkV -= fDot0*rkU;
+   rkV.Normalize();
+
+   // compute u2
+   double fDot1 = rkV.Dot(rkW);
+   fDot0 = rkU.Dot(rkW);
+   rkW  -= fDot0*rkU + fDot1*rkV;
+   rkW.Normalize();
+}
+/*=======================================================*/
+void Vector3D::Orthonormalize(Vector3D* akV)
+{
+   Orthonormalize(akV[0],akV[1],akV[2]);
+}
+/*=======================================================*/
+void Vector3D::GenerateOrthonormalBasis(Vector3D& rkU, Vector3D& rkV,Vector3D& rkW, bool bUnitLengthW)
+{
+   if ( !bUnitLengthW )
+      rkW.Normalize();
+
+   double fInvLength;
+
+   if (UbMath::greaterEqual( std::fabs(rkW.m_afTuple[0]),std::fabs(rkW.m_afTuple[1]) ) )
+   {
+      // W.x or W.z is the largest magnitude component, swap them
+      fInvLength = UbMath::invSqrt(rkW.m_afTuple[0]*rkW.m_afTuple[0] + rkW.m_afTuple[2]*rkW.m_afTuple[2]);
+      rkU.m_afTuple[0] = -rkW.m_afTuple[2]*fInvLength;
+      rkU.m_afTuple[1] = (double)0.0;
+      rkU.m_afTuple[2] = +rkW.m_afTuple[0]*fInvLength;
+   }
+   else
+   {
+      // W.y or W.z is the largest magnitude component, swap them
+      fInvLength = UbMath::invSqrt(rkW.m_afTuple[1]*rkW.m_afTuple[1] + rkW.m_afTuple[2]*rkW.m_afTuple[2]);
+      rkU.m_afTuple[0] = (double)0.0;
+      rkU.m_afTuple[1] = +rkW.m_afTuple[2]*fInvLength;
+      rkU.m_afTuple[2] = -rkW.m_afTuple[1]*fInvLength;
+   }
+
+   rkV = rkW.Cross(rkU);
+}
+/*=======================================================*/
+//globaler operator* 
+Vector3D operator*(const double& fScalar, const Vector3D& rkV)
+{
+   return Vector3D( fScalar*rkV[0],
+                    fScalar*rkV[1],
+                    fScalar*rkV[2] );
+}
+/*=======================================================*/
+std::ostream& operator<< (std::ostream& os, const Vector3D& rkV)
+{
+   os<<rkV.toString();
+   return os;
+}
diff --git a/src/VirtualFluidsBasics/basics/utilities/Vector3D.h b/src/VirtualFluidsBasics/basics/utilities/Vector3D.h
new file mode 100644
index 0000000000000000000000000000000000000000..1e1d5178bdeca3a7d61595e54d1c999941a3ecdd
--- /dev/null
+++ b/src/VirtualFluidsBasics/basics/utilities/Vector3D.h
@@ -0,0 +1,136 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 UbVector3D.h
+//! \ingroup utilities
+//! \author Soeren Freudiger, Sebastian Geller
+//=======================================================================================
+#ifndef VECTOR_3D_H
+#define VECTOR_3D_H
+
+#include <string>
+
+   class Vector3D
+   {
+   public:
+      // construction
+      Vector3D(); 
+      Vector3D(const double& fX1, const double& fX2, const double& fX3);
+      Vector3D(const Vector3D& rkV);
+
+      std::string toString() const;
+
+      // coordinate access
+      operator const double*() const;
+      operator double*();
+      double   operator[](const int& i) const;
+      double&  operator[](const int& i);
+      double   X1() const;
+      double&  X1();
+      double   X2() const;
+      double&  X2();                                    
+      double   X3() const;
+      double&  X3();
+
+      // assignment
+      Vector3D& operator=(const Vector3D& rkV);
+
+      // comparison
+      bool operator==(const Vector3D& rkV) const;
+      bool operator!=(const Vector3D& rkV) const;
+      bool operator< (const Vector3D& rkV) const;
+      bool operator<=(const Vector3D& rkV) const;
+      bool operator> (const Vector3D& rkV) const;
+      bool operator>=(const Vector3D& rkV) const;
+
+      // arithmetic operations
+      Vector3D operator+(const Vector3D& rkV) const;
+      Vector3D operator-(const Vector3D& rkV) const;
+      Vector3D operator*(const double& fScalar) const;
+      Vector3D operator/(const double& fScalar) const;
+      Vector3D operator-() const;
+
+      // arithmetic updates
+      Vector3D& operator+= (const Vector3D& rkV);
+      Vector3D& operator-= (const Vector3D& rkV);
+      Vector3D& operator*= (const double& fScalar);
+      Vector3D& operator/= (const double& fScalar);
+
+      Vector3D Add(Vector3D& vector);
+      Vector3D Subtract(Vector3D& vector);
+      Vector3D Scale(const double& x);
+
+      // vector operations
+      double Length () const;
+      double SquaredLength () const;
+      double Dot (const Vector3D& rkV) const;
+      double Normalize ();
+
+      // The cross products are computed using the right-handed rule.  Be aware
+      // that some graphics APIs use a left-handed rule.  If you have to compute
+      // a cross product with these functions and send the result to the API
+      // that expects left-handed, you will need to change sign on the vector
+      // (replace each component value c by -c).
+      Vector3D Cross (const Vector3D& rkV) const;
+      Vector3D UnitCross (const Vector3D& rkV) const;
+
+      // Compute the barycentric coordinates of the point with respect to the
+      // tetrahedron <V0,V1,V2,V3>, P = b0*V0 + b1*V1 + b2*V2 + b3*V3, where
+      // b0 + b1 + b2 + b3 = 1.
+      void GetBarycentrics (const Vector3D& rkV0, const Vector3D& rkV1, const Vector3D& rkV2, const Vector3D& rkV3, double afBary[4]) const;
+
+      // Gram-Schmidt orthonormalization.  Take linearly independent vectors
+      // U, V, and W and compute an orthonormal set (unit length, mutually
+      // perpendicular).
+      static void Orthonormalize (Vector3D& rkU, Vector3D& rkV, Vector3D& rkW);
+      static void Orthonormalize (Vector3D* akV);
+
+      // Input W must be initialized to a nonzero vector, output is {U,V,W},
+      // an orthonormal basis.  A hint is provided about whether or not W
+      // is already unit length.
+      static void GenerateOrthonormalBasis (Vector3D& rkU, Vector3D& rkV, Vector3D& rkW, bool bUnitLengthW);
+
+      // special vectors
+      static const Vector3D ZERO;
+      static const Vector3D UNIT_X1;
+      static const Vector3D UNIT_X2;
+      static const Vector3D UNIT_X3;
+
+   protected:
+      // support for comparisons
+      int CompareArrays (const Vector3D& rkV) const;
+
+      double m_afTuple[3];
+   };
+   
+   //globaler multiplaktor mit skalar
+   Vector3D operator*(const double& fScalar, const Vector3D& rkV);
+   std::ostream& operator<<(std::ostream& os, const Vector3D& rkV);
+
+  
+#endif
diff --git a/src/VirtualFluidsBasics/basics/utilities/package.include b/src/VirtualFluidsBasics/basics/utilities/package.include
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/src/VirtualFluidsBasics/basics/writer/WbWriter.h b/src/VirtualFluidsBasics/basics/writer/WbWriter.h
new file mode 100644
index 0000000000000000000000000000000000000000..21667eb0bfb9afa86b14b572b3f05a7ec238f3ba
--- /dev/null
+++ b/src/VirtualFluidsBasics/basics/writer/WbWriter.h
@@ -0,0 +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 WbWriter.h
+//! \ingroup writer
+//! \author Soeren Freudiger, Sebastian Geller
+//=======================================================================================
+#ifndef WBWRITER_H
+#define WBWRITER_H
+
+#include <vector>
+#include <string>
+#include <fstream>
+#include <sstream>
+#include <iostream>
+#include <map>
+
+
+#include <basics/utilities/UbException.h>
+#include <basics/utilities/UbSystem.h>
+#include <basics/utilities/UbTuple.h>
+
+class VF_PUBLIC WbWriter
+{
+public:
+   //////////////////////////////////////////////////////////////////////////
+   virtual ~WbWriter() 
+   {
+
+   }
+
+   //////////////////////////////////////////////////////////////////////////
+   //rein virtuelle Methoden
+   virtual std::string getFileExtension() = 0;
+
+   //////////////////////////////////////////////////////////////////////////
+   //nodes
+   virtual std::string writeNodes(const std::string& filename,std::vector< UbTupleFloat3 >& nodes) { throw UbException(UB_EXARGS,"not implemented for "+(std::string)typeid(*this).name() );  }
+   virtual std::string writeNodesWithNodeData(const std::string& filename,std::vector< UbTupleFloat3 >& nodes, std::vector<std::string >& datanames, std::vector<std::vector<double > >& nodedata) { throw UbException(UB_EXARGS,"not implemented for "+(std::string)typeid(*this).name() );  }
+   virtual std::string writeNodesWithNodeDataDouble(const std::string& filename,std::vector< UbTupleDouble3 >& nodes, std::vector<std::string >& datanames, std::vector<std::vector<double > >& nodedata) { throw UbException(UB_EXARGS,"not implemented for "+(std::string)typeid(*this).name() );  }
+
+   //////////////////////////////////////////////////////////////////////////
+   //lines
+   //     0 ---- 1
+   //nodenumbering must start with 0!
+   virtual std::string writeLines(const std::string& filename,std::vector<UbTupleFloat3 >& nodes, std::vector<UbTupleInt2 >& lines) { throw UbException(UB_EXARGS,"not implemented for "+(std::string)typeid(*this).name() );  }
+   virtual std::string writeLinesWithNodeData(const std::string& filename,std::vector<UbTupleFloat3 >& nodes, std::vector<UbTupleInt2 >& lines) { throw UbException(UB_EXARGS,"not implemented for "+(std::string)typeid(*this).name() );  }
+
+   //////////////////////////////////////////////////////////////////////////
+   //triangles
+   //cell numbering:
+   //                     2
+   //                      
+   //                  0 === 1
+   //nodenumbering must start with 0!
+   virtual std::string writeTriangles(const std::string& filename,std::vector< UbTupleFloat3 >& nodes, std::vector< UbTupleInt3 >& cells){ throw UbException(UB_EXARGS,"not implemented for "+(std::string)typeid(*this).name() );  }
+   virtual std::string writeTrianglesWithNodeData(const std::string& filename,std::vector< UbTupleFloat3 >& nodes, std::vector< UbTupleInt3 >& cells, std::vector<std::string >& datanames, std::vector<std::vector<double > >& nodedata){ throw UbException(UB_EXARGS,"not implemented for "+(std::string)typeid(*this).name() );  }
+
+   //////////////////////////////////////////////////////////////////////////
+   //quads
+   //cell numbering:
+   //                  3---2
+   //                  |   |
+   //                  0---1
+   //nodenumbering must start with 0!
+   virtual std::string writeQuads(const std::string& filename,std::vector< UbTupleFloat3 >& nodes, std::vector< UbTupleInt4 >& cells){ throw UbException(UB_EXARGS,"not implemented for "+(std::string)typeid(*this).name() );  }
+   virtual std::string writeQuadsWithNodeData(const std::string& filename,std::vector< UbTupleFloat3 >& nodes, std::vector< UbTupleInt4 >& cells, std::vector< std::string >& datanames, std::vector< std::vector< double > >& nodedata){ throw UbException(UB_EXARGS,"not implemented for "+(std::string)typeid(*this).name() );  }
+   virtual std::string writeQuadsWithCellData(const std::string& filename,std::vector< UbTupleFloat3 >& nodes, std::vector< UbTupleInt4 >& cells, std::vector< std::string >& datanames, std::vector< std::vector< double > >& celldata){ throw UbException(UB_EXARGS,"not implemented for "+(std::string)typeid(*this).name() );  }
+   virtual std::string writeQuadsWithNodeAndCellData(const std::string& filename,std::vector< UbTupleFloat3 >& nodes, std::vector< UbTupleInt4 >& cells, 
+                                                     std::vector< std::string >& nodedatanames, std::vector< std::vector< double > >& nodedata, std::vector< std::string >& celldatanames, std::vector< std::vector< double > >&celldata) { throw UbException(UB_EXARGS,"not implemented for "+(std::string)typeid(*this).name() );  }
+
+   //////////////////////////////////////////////////////////////////////////
+   //octs
+   //     7 ---- 6
+   //    /|     /|
+   //   4 +--- 5 |
+   //   | |    | |
+   //   | 3 ---+ 2
+   //   |/     |/
+   //   0 ---- 1
+   virtual std::string writeOcts(const std::string& filename,std::vector< UbTupleFloat3 >& nodes, std::vector< UbTupleInt8 >& cells){ throw UbException(UB_EXARGS,"not implemented for "+(std::string)typeid(*this).name() );  }
+   virtual std::string writeOctsWithCellData(const std::string& filename,std::vector<UbTupleFloat3 >& nodes, std::vector<UbTupleInt8 >& cells, std::vector<std::string >& datanames, std::vector<std::vector<double > >& celldata){ throw UbException(UB_EXARGS,"not implemented for "+(std::string)typeid(*this).name() );  }
+   virtual std::string writeOctsWithNodeData(const std::string& filename,std::vector<UbTupleFloat3 >& nodes, std::vector<UbTupleInt8 >& cells, std::vector<std::string >& datanames, std::vector<std::vector<double > >& nodedata){ throw UbException(UB_EXARGS,"not implemented for "+(std::string)typeid(*this).name() );  }
+
+private:
+
+};
+
+#endif //WBWRITER_H
diff --git a/src/VirtualFluidsBasics/basics/writer/WbWriterVtkXmlASCII.cpp b/src/VirtualFluidsBasics/basics/writer/WbWriterVtkXmlASCII.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..42b7defd6b5dd7616dc9aeb0e97dd884d18d6db1
--- /dev/null
+++ b/src/VirtualFluidsBasics/basics/writer/WbWriterVtkXmlASCII.cpp
@@ -0,0 +1,1221 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 WbWriterVtkXmlASCII.cpp
+//! \ingroup writer
+//! \author Soeren Freudiger, Sebastian Geller
+//=======================================================================================
+#include <basics/writer/WbWriterVtkXmlASCII.h>
+#include <basics/utilities/UbLogger.h>
+#include <cstring>
+#include <limits>
+
+using namespace std;
+
+/*===============================================================================*/
+std::string WbWriterVtkXmlASCII::pvdEndTag ="   </Collection>\n</VTKFile>";
+/*===============================================================================*/
+std::string WbWriterVtkXmlASCII::writeCollection(const std::string& filename, const std::vector<std::string>& filenames, const double& timeStep, const bool& sepGroups)
+{
+   std::string vtkfilename=filename+".pvd";
+   std::ofstream out(vtkfilename.c_str());
+   if(!out)
+   { 
+      out.clear(); //flags ruecksetzen (ansonsten liefert utern if(!out) weiterhin true!!!
+      string path = UbSystem::getPathFromString(vtkfilename);
+      if(path.size()>0){UbSystem::makeDirectory(path);out.open(vtkfilename.c_str());}
+      if(!out) throw UbException(UB_EXARGS,"couldn't open file "+vtkfilename);
+   }
+
+   std::string endian;
+   if(UbSystem::isLittleEndian()) endian = "LittleEndian";
+   else                           endian = "BigEndian";
+   out<<"<VTKFile type=\"Collection\" version=\"0.1\" byte_order=\""<<endian<<"\" >\n";
+   out<<"   <Collection>"<<endl;
+   
+   int group = 0, part=0;
+   for(std::size_t i=0; i<filenames.size(); i++)
+   {
+      out<<"       <DataSet timestep=\""<<timeStep<<"\" group=\""<<group<<"\" part=\""<<part<<"\" file=\""<<filenames[i]<<"\"/>\n";
+      if(sepGroups) group++;
+      else          part++;
+   }
+   out<<pvdEndTag;
+   out.close();
+
+   return vtkfilename;
+}
+/*===============================================================================*/
+std::string WbWriterVtkXmlASCII::addFilesToCollection(const std::string& filename, const std::vector<std::string>& filenames, const double& timeStep, const bool& sepGroups)
+{
+   std::string vtkfilename=filename;
+   std::fstream test(vtkfilename.c_str(), ios::in);
+   if(!test)
+   {
+      test.clear();
+      vtkfilename += ".pvd";
+      test.open(vtkfilename.c_str(), ios::in);
+      if(!test) return this->writeCollection(filename,filenames,timeStep,sepGroups);
+   }
+
+   std::fstream out(vtkfilename.c_str(), ios::in | ios::out);
+   out.seekp(-(int)pvdEndTag.size()-1, ios_base::end);
+
+   int group = 0;
+   for(std::size_t i=0; i<filenames.size(); i++)
+   {
+      out<<"       <DataSet timestep=\""<<timeStep<<"\" group=\""<<group<<"\" part=\""<<i<<"\" file=\""<<filenames[i]<<"\"/>\n";
+      if(sepGroups) group++;
+   }
+   out<<pvdEndTag;
+
+   return vtkfilename;
+}
+/*===============================================================================*/
+std::string WbWriterVtkXmlASCII::writeParallelFile(const string& filename,vector<string>& pieceSources, vector<string>& pointDataNames, vector<string>& cellDataNames)
+{
+   string vtkfilename=filename+".pvtu";
+   UBLOG(logDEBUG1,"WbWriterVtkXmlASCII::writeParallelFile to "<<vtkfilename<<" - start");
+
+   std::ofstream out(vtkfilename.c_str());
+   if(!out)
+   { 
+      out.clear(); //flags ruecksetzen (ansonsten liefert utern if(!out) weiterhin true!!!
+      string path = UbSystem::getPathFromString(vtkfilename);
+      if(path.size()>0){UbSystem::makeDirectory(path);out.open(vtkfilename.c_str());}
+      if(!out) throw UbException(UB_EXARGS,"couldn't open file "+vtkfilename);
+   }
+
+   //VTK FILE
+   out<<"<VTKFile type=\"PUnstructuredGrid\" version=\"0.1\" byte_order=\"LittleEndian\">\n";
+   out<<"  <PUnstructuredGrid GhostLevel=\"0\">\n";
+   out<<"    <PPoints>\n"; 
+   out<<"      <PDataArray type=\"Float32\" NumberOfComponents=\"3\"/>\n";
+   out<<"    </PPoints>\n";
+   out<<"    <PPointData>\n";
+   for(size_t s=0; s<pointDataNames.size(); s++)
+      out<< "      <PDataArray type=\"Float64\" Name=\""<< pointDataNames[s] <<"\"/>\n";
+   out<<"    </PPointData>\n";
+   if (cellDataNames.size() > 0)
+   {
+      out<<"    <PCellData>\n";
+      for(size_t s=0; s<cellDataNames.size(); s++)
+         out<< "      <PDataArray type=\"Float32\" Name=\""<< cellDataNames[s] <<"\"/>\n";
+      out<<"    </PCellData>\n";
+   }
+
+   for(size_t s=0; s<pieceSources.size(); s++)
+      out<<"    <Piece Source=\""<<pieceSources[s]<<"\"/>\n";
+   out<<"  </PUnstructuredGrid>\n";
+   out<<"</VTKFile>";
+   out<<endl;
+   out.close();
+   UBLOG(logDEBUG1,"WbWriterVtkXmlASCII::writeParallelFile to "<<vtkfilename<<" - end");
+
+   return vtkfilename;
+}
+/*===============================================================================*/
+std::string WbWriterVtkXmlASCII::writeQuads(const string& filename,vector< UbTupleFloat3 >& nodes, vector< UbTupleInt4 >& cells)
+{
+   string vtkfilename=filename+getFileExtension();
+   UBLOG(logDEBUG1,"WbWriterVtkXmlASCII::writeQuads to "<<vtkfilename<<" - start");
+
+   std::ofstream out(vtkfilename.c_str());
+   if(!out)
+   { 
+      out.clear(); //flags ruecksetzen (ansonsten liefert utern if(!out) weiterhin true!!!
+      string path = UbSystem::getPathFromString(vtkfilename);
+      if(path.size()>0){UbSystem::makeDirectory(path);out.open(vtkfilename.c_str());}
+      if(!out) throw UbException(UB_EXARGS,"couldn't open file "+vtkfilename);
+   }
+
+   int nofNodes = (int)nodes.size(); 
+   int nofCells = (int)cells.size(); 
+
+   //VTK FILE
+   out<<"<VTKFile type=\"UnstructuredGrid\" version=\"0.1\" byte_order=\"LittleEndian\" >"<<"\n";
+   out<<"   <UnstructuredGrid>"<<"\n";
+   out<<"      <Piece NumberOfPoints=\""<<nofNodes<<"\"	NumberOfCells=\""<<nofCells<<"\">   \n";
+
+   //POINTS SECTION
+   out<<"      <Points>\n"; 
+   out<<"         <DataArray type=\"Float32\" NumberOfComponents=\"3\" format=\"ascii\">\n";
+   for(int n=0; n<nofNodes; n++)
+      out<< val<1>(nodes[n]) <<" "<< val<2>(nodes[n]) <<" "<< val<3>(nodes[n]) <<"   ";
+
+   out<<"\n";
+   out<<"         </DataArray>\n";
+   out<<"      </Points>\n";
+
+   //CELLS SECTION
+   out<<"      <Cells>\n";
+   out<<"         <DataArray type=\"Int32\" Name=\"connectivity\" format=\"ascii\">\n";
+
+   for(int c=0; c<nofCells; c++)
+      out<< val<1>(cells[c]) <<" "
+         << val<2>(cells[c]) <<" "
+         << val<4>(cells[c]) <<" "
+         << val<3>(cells[c]) <<"   ";
+   out<<"\n";
+   out<<"      </DataArray>\n";
+   out<<"         <DataArray type=\"Int32\" Name=\"offsets\" format=\"ascii\">\n";
+   for(int c=1; c<nofCells+1; c++)
+      out<<c*4<<" " ;
+
+   out<<"\n";
+   out<<"         </DataArray>\n";
+
+   out<<"      <DataArray type=\"UInt8\" Name=\"types\" format=\"ascii\">\n";
+
+   for(int c=0; c<nofCells; c++)
+      out<<"8 ";
+   out<<"\n";
+   out<<"      </DataArray>\n";
+   out<<"      </Cells>\n";
+   out<<"      </Piece>\n";
+   out<<"   </UnstructuredGrid>\n";
+   out<<"</VTKFile>";
+   out<<endl;
+   out.close();
+   UBLOG(logDEBUG1,"WbWriterVtkXmlASCII::writeQuads to "<<vtkfilename<<" - end");
+
+   return vtkfilename;
+}
+/*===============================================================================*/
+std::string WbWriterVtkXmlASCII::writeQuadsWithNodeData(const string& filename,vector< UbTupleFloat3 >& nodes, vector< UbTupleInt4 >& cells, vector< string >& datanames, vector< vector< double > >& nodedata)
+{
+   string vtkfilename=filename+getFileExtension();
+   UBLOG(logDEBUG1,"WbWriterVtkXmlASCII::writeQuadsWithNodeData to "<<vtkfilename<<" - start");
+
+   std::ofstream out(vtkfilename.c_str());
+   if(!out)
+   { 
+      out.clear(); //flags ruecksetzen (ansonsten liefert utern if(!out) weiterhin true!!!
+      string path = UbSystem::getPathFromString(vtkfilename);
+      if(path.size()>0){UbSystem::makeDirectory(path);out.open(vtkfilename.c_str());}
+      if(!out) throw UbException(UB_EXARGS,"couldn't open file "+vtkfilename);
+   }
+
+   int nofNodes = (int)nodes.size(); 
+   int nofCells = (int)cells.size(); 
+
+   //VTK FILE
+   out<<"<VTKFile type=\"UnstructuredGrid\" version=\"0.1\" byte_order=\"LittleEndian\" >"<<"\n";
+   out<<"   <UnstructuredGrid>"<<"\n";
+   out<<"      <Piece NumberOfPoints=\""<<nofNodes<<"\"	NumberOfCells=\""<<nofCells<<"\">   \n";
+
+   //POINTS SECTION
+   out<<"         <Points>\n"; 
+   out<<"            <DataArray type=\"Float32\" NumberOfComponents=\"3\" format=\"ascii\">\n               ";
+   for(int n=0; n<nofNodes; n++)
+      out<< val<1>(nodes[n]) <<" "<< val<2>(nodes[n]) <<" "<< val<3>(nodes[n]) <<"   ";
+
+   out<<"\n";
+   out<<"            </DataArray>\n";
+   out<<"         </Points>\n";
+
+   //CELLS SECTION
+   out<<"         <Cells>\n";
+   out<<"            <DataArray type=\"Int32\" Name=\"connectivity\" format=\"ascii\">\n              ";
+
+   for(int c=0; c<nofCells; c++)
+      out<< val<1>(cells[c]) <<" "
+         << val<2>(cells[c]) <<" "
+         << val<4>(cells[c]) <<" "
+         << val<3>(cells[c]) <<"   ";
+   out<<"\n";
+   out<<"            </DataArray>\n";
+   out<<"            <DataArray type=\"Int32\" Name=\"offsets\" format=\"ascii\">\n              ";
+   for(int c=1; c<nofCells+1; c++)
+      out<<c*4<<" " ;
+
+   out<<"\n";
+   out<<"            </DataArray>\n";
+
+   out<<"            <DataArray type=\"UInt8\" Name=\"types\" format=\"ascii\">\n              ";
+
+   for(int c=0; c<nofCells; c++)
+      out<<"8 ";
+   out<<"\n";
+   out<<"            </DataArray>\n";
+
+   out<<"         </Cells>\n";
+
+   //write data section
+   out<<"         <PointData Scalars=\"Scalars\"> \n";
+   for(int s=0; s<(int)datanames.size(); ++s)
+   {
+      out<< "           <DataArray type=\"Float32\" Name=\""<< datanames[s] <<"\" format=\"ascii\"> \n";
+
+      for(int d=0; d<(int)nodedata[s].size(); d++)
+         out<<nodedata[s][d]<<" ";
+
+      out<<"\n          </DataArray>\n";
+    }
+   out<<"         </PointData>\n";
+   out<<"      </Piece>\n";
+   out<<"   </UnstructuredGrid>\n";
+   out<<"</VTKFile>";
+   out<<endl;
+   out.close();
+   UBLOG(logDEBUG1,"WbWriterVtkXmlASCII::writeQuadsWithNodeData to "<<vtkfilename<<" - end");
+   return vtkfilename;
+}
+/*===============================================================================*/
+std::string WbWriterVtkXmlASCII::writeQuadsWithCellData(const string& filename,vector< UbTupleFloat3 >& nodes, vector< UbTupleInt4 >& cells, vector< string >& datanames, vector< vector< double > >& celldata)
+{
+   string vtkfilename=filename+getFileExtension();
+   UBLOG(logDEBUG1,"WbWriterVtkXmlASCII::writeQuadsWithCellData to "<<vtkfilename<<" - start");
+
+   std::ofstream out(vtkfilename.c_str());
+   if(!out)
+   { 
+      out.clear(); //flags ruecksetzen (ansonsten liefert utern if(!out) weiterhin true!!!
+      string path = UbSystem::getPathFromString(vtkfilename);
+      if(path.size()>0){UbSystem::makeDirectory(path);out.open(vtkfilename.c_str());}
+      if(!out) throw UbException(UB_EXARGS,"couldn't open file "+vtkfilename);
+   }
+
+   int nofNodes = (int)nodes.size(); 
+   int nofCells = (int)cells.size(); 
+
+   //VTK FILE
+   out<<"<VTKFile type=\"UnstructuredGrid\" version=\"0.1\" byte_order=\"LittleEndian\" >"<<"\n";
+   out<<"   <UnstructuredGrid>"<<"\n";
+   out<<"      <Piece NumberOfPoints=\""<<nofNodes<<"\"	NumberOfCells=\""<<nofCells<<"\">   \n";
+
+   //POINTS SECTION
+   out<<"         <Points>\n"; 
+   out<<"            <DataArray type=\"Float32\" NumberOfComponents=\"3\" format=\"ascii\">\n               ";
+   for(int n=0; n<nofNodes; n++)
+      out<< val<1>(nodes[n]) <<" "<< val<2>(nodes[n]) <<" "<< val<3>(nodes[n]) <<"   ";
+
+   out<<"\n";
+   out<<"            </DataArray>\n";
+   out<<"         </Points>\n";
+
+   //CELLS SECTION
+   out<<"         <Cells>\n";
+   out<<"            <DataArray type=\"Int32\" Name=\"connectivity\" format=\"ascii\">\n              ";
+
+   for(int c=0; c<nofCells; c++)
+      out<< val<1>(cells[c]) <<" "
+         << val<2>(cells[c]) <<" "
+         << val<4>(cells[c]) <<" "
+         << val<3>(cells[c]) <<"   ";
+   out<<"\n";
+   out<<"            </DataArray>\n";
+   out<<"            <DataArray type=\"Int32\" Name=\"offsets\" format=\"ascii\">\n              ";
+   for(int c=1; c<nofCells+1; c++)
+      out<<c*4<<" " ;
+
+
+   out<<"\n";
+   out<<"            </DataArray>\n";
+
+   out<<"            <DataArray type=\"UInt8\" Name=\"types\" format=\"ascii\">\n              ";
+
+   for(int c=0; c<nofCells; c++)
+      out<<"8 ";
+   out<<"\n";
+   out<<"            </DataArray>\n";
+
+   out<<"         </Cells>\n";
+
+   //write data section
+   out<<"         <CellData Scalars=\"Scalars\"> \n";
+   for(int s=0; s<(int)datanames.size(); ++s)
+   {
+      out<< "           <DataArray type=\"Float32\" Name=\""<< datanames[s] <<"\" format=\"ascii\"> \n";
+
+      for(int d=0; d<(int)celldata[s].size(); d++)
+         out<<celldata[s][d]<<" ";
+
+      out<<"\n          </DataArray>\n";
+   }
+   out<<"         </CellData>\n";
+   out<<"      </Piece>\n";
+   out<<"   </UnstructuredGrid>\n";
+   out<<"</VTKFile>";
+   out<<endl;
+
+   out.close();
+
+   UBLOG(logDEBUG1,"WbWriterVtkXmlASCII::writeQuadsWithCellData to "<<vtkfilename<<" - end");
+
+   return vtkfilename;
+}
+/*===============================================================================*/
+string WbWriterVtkXmlASCII::writeQuadsWithNodeAndCellData(const string& filename,vector< UbTupleFloat3 >& nodes, vector< UbTupleInt4 >& cells, 
+                                                          vector< string >& nodedatanames, vector< vector< double > >& nodedata, vector< string >& celldatanames,
+                                                          vector< vector< double > >& celldata                                                                       )
+{
+   string vtkfilename=filename+getFileExtension();
+   UBLOG(logDEBUG1,"WbWriterVtkXmlASCII::writeQuadsWithNodeAndCellData to "<<vtkfilename<<" - start");
+
+   std::ofstream out(vtkfilename.c_str());
+   if(!out)
+   { 
+      out.clear(); //flags ruecksetzen (ansonsten liefert utern if(!out) weiterhin true!!!
+      string path = UbSystem::getPathFromString(vtkfilename);
+      if(path.size()>0){UbSystem::makeDirectory(path);out.open(vtkfilename.c_str());}
+      if(!out) throw UbException(UB_EXARGS,"couldn't open file "+vtkfilename);
+   }
+
+   int nofNodes = (int)nodes.size(); 
+   int nofCells = (int)cells.size(); 
+
+   //VTK FILE
+   out<<"<VTKFile type=\"UnstructuredGrid\" version=\"0.1\" byte_order=\"LittleEndian\" >"<<"\n";
+   out<<"   <UnstructuredGrid>"<<"\n";
+   out<<"      <Piece NumberOfPoints=\""<<nofNodes<<"\"	NumberOfCells=\""<<nofCells<<"\">   \n";
+
+   //POINTS SECTION
+   out<<"         <Points>\n"; 
+   out<<"            <DataArray type=\"Float32\" NumberOfComponents=\"3\" format=\"ascii\">\n               ";
+   for(int n=0; n<nofNodes; n++)
+      out<< val<1>(nodes[n]) <<" "<< val<2>(nodes[n]) <<" "<< val<3>(nodes[n]) <<"   ";
+
+   out<<"\n";
+   out<<"            </DataArray>\n";
+   out<<"         </Points>\n";
+
+   //CELLS SECTION
+   out<<"         <Cells>\n";
+   out<<"            <DataArray type=\"Int32\" Name=\"connectivity\" format=\"ascii\">\n              ";
+
+   for(int c=0; c<nofCells; c++)
+      out<< val<1>(cells[c]) <<" "
+         << val<2>(cells[c]) <<" "
+         << val<4>(cells[c]) <<" "
+         << val<3>(cells[c]) <<"   ";
+   out<<"\n";
+   out<<"            </DataArray>\n";
+   out<<"            <DataArray type=\"Int32\" Name=\"offsets\" format=\"ascii\">\n              ";
+   for(int c=1; c<nofCells+1; c++)
+      out<<c*4<<" " ;
+
+
+   out<<"\n";
+   out<<"            </DataArray>\n";
+
+   out<<"            <DataArray type=\"UInt8\" Name=\"types\" format=\"ascii\">\n              ";
+
+   for(int c=0; c<nofCells; c++)
+      out<<"8 ";
+   out<<"\n";
+   out<<"            </DataArray>\n";
+
+   out<<"         </Cells>\n";
+   
+   //write PointData section
+   out<<"         <PointData Scalars=\"PScalars\"> \n";
+   for(int s=0; s<(int)nodedatanames.size(); ++s)
+   {
+      out<< "           <DataArray type=\"Float32\" Name=\""<< nodedatanames[s] <<"\" format=\"ascii\"> \n";
+
+      for(int d=0; d<(int)nodedata[s].size(); d++)
+         out<<nodedata[s][d]<<" ";
+
+      out<<"\n          </DataArray>\n";
+   }
+   out<<"         </PointData>\n";
+
+   //write celldata section
+   out<<"         <CellData Scalars=\"CScalars\"> \n";
+   for(int s=0; s<(int)celldatanames.size(); ++s)
+   {
+      out<< "           <DataArray type=\"Float32\" Name=\""<< celldatanames[s] <<"\" format=\"ascii\"> \n";
+
+      for(int d=0; d<(int)celldata[s].size(); d++)
+         out<<celldata[s][d]<<" ";
+
+      out<<"\n          </DataArray>\n";
+   }
+   out<<"         </CellData>\n";
+   out<<"      </Piece>\n";
+   out<<"   </UnstructuredGrid>\n";
+   out<<"</VTKFile>";
+   out<<endl;
+   out.close();
+   UBLOG(logDEBUG1,"WbWriterVtkXmlASCII::writeQuadsWithNodeAndCellData to "<<vtkfilename<<" - end");
+
+   return vtkfilename;
+}
+/*===============================================================================*/
+std::string WbWriterVtkXmlASCII::writeLines(const string& filename,vector<UbTupleFloat3 >& nodes, vector<UbTupleInt2 >& lines) 
+{
+   string vtkfilename=filename+getFileExtension();
+   UBLOG(logDEBUG1,"WbWriterVtkXmlASCII::writeLines to "<<vtkfilename<<" - start");
+
+   std::ofstream out(vtkfilename.c_str());
+   if(!out)
+   { 
+      out.clear(); //flags ruecksetzen (ansonsten liefert utern if(!out) weiterhin true!!!
+      string path = UbSystem::getPathFromString(vtkfilename);
+      if(path.size()>0){UbSystem::makeDirectory(path);out.open(vtkfilename.c_str());}
+      if(!out) throw UbException(UB_EXARGS,"couldn't open file "+vtkfilename);
+   }
+
+   int nofNodes = (int)nodes.size(); 
+   int nofLines = (int)lines.size(); 
+
+   //VTK FILE
+   out<<"<VTKFile type=\"UnstructuredGrid\" version=\"0.1\" byte_order=\"LittleEndian\" >"<<"\n";
+   out<<"   <UnstructuredGrid>"<<"\n";
+   out<<"      <Piece NumberOfPoints=\""<<nofNodes<<"\"	NumberOfCells=\""<<nofLines<<"\">   \n";
+
+   //POINTS SECTION
+   out<<"      <Points>\n"; 
+   out<<"         <DataArray type=\"Float32\" NumberOfComponents=\"3\" format=\"ascii\">\n";
+   for(int n=0; n<nofNodes; n++)
+      out<< val<1>(nodes[n]) <<" "<< val<2>(nodes[n]) <<" "<< val<3>(nodes[n]) <<"   ";
+
+   out<<"\n";
+   out<<"         </DataArray>\n";
+   out<<"      </Points>\n";
+
+   //CELLS SECTION
+   out<<"      <Cells>\n";
+   out<<"         <DataArray type=\"Int32\" Name=\"connectivity\" format=\"ascii\">\n";
+
+   for(int c=0; c<nofLines; c++)
+      out<< val<1>(lines[c]) <<" "<< val<2>(lines[c])<<"  ";
+   out<<"\n";
+   out<<"      </DataArray>\n";
+   out<<"         <DataArray type=\"Int32\" Name=\"offsets\" format=\"ascii\">\n";
+   for(int c=1; c<=nofLines; c++)
+      out<<c*2<<" " ;
+
+   out<<"\n";
+   out<<"         </DataArray>\n";
+
+   out<<"      <DataArray type=\"UInt8\" Name=\"types\" format=\"ascii\">\n";
+
+   for(int c=0; c<nofLines; c++)
+      out<<"3 ";
+   out<<"\n";
+   out<<"      </DataArray>\n";
+   out<<"      </Cells>\n";
+   out<<"      </Piece>\n";
+   out<<"   </UnstructuredGrid>\n";
+   out<<"</VTKFile>";
+   out<<endl;
+   out.close();
+   UBLOG(logDEBUG1,"WbWriterVtkXmlASCII::writeLines to "<<vtkfilename<<" - end");
+
+   return vtkfilename;
+}
+/*===============================================================================*/
+std::string WbWriterVtkXmlASCII::writeLinesWithNodeData(const string& filename,vector<UbTupleFloat3 >& nodes, vector<UbTupleInt2 >& lines, std::vector< std::string >& datanames, std::vector< std::vector< double > >& nodedata)
+{
+   string vtkfilename=filename+getFileExtension();
+   UBLOG(logDEBUG1,"WbWriterVtkXmlASCII::writeLinesWithNodeData to "<<vtkfilename<<" - start");
+
+   std::ofstream out(vtkfilename.c_str());
+   if(!out)
+   { 
+      out.clear(); //flags ruecksetzen (ansonsten liefert utern if(!out) weiterhin true!!!
+      string path = UbSystem::getPathFromString(vtkfilename);
+      if(path.size()>0){UbSystem::makeDirectory(path);out.open(vtkfilename.c_str());}
+      if(!out) throw UbException(UB_EXARGS,"couldn't open file "+vtkfilename);
+   }
+
+   int nofNodes = (int)nodes.size(); 
+   int nofLines = (int)lines.size(); 
+
+   //VTK FILE
+   out<<"<VTKFile type=\"UnstructuredGrid\" version=\"0.1\" byte_order=\"LittleEndian\" >"<<"\n";
+   out<<"   <UnstructuredGrid>"<<"\n";
+   out<<"      <Piece NumberOfPoints=\""<<nofNodes<<"\"	NumberOfCells=\""<<nofLines<<"\">   \n";
+
+   //POINTS SECTION
+   out<<"      <Points>\n"; 
+   out<<"         <DataArray type=\"Float32\" NumberOfComponents=\"3\" format=\"ascii\">\n";
+   for(int n=0; n<nofNodes; n++)
+      out<< val<1>(nodes[n]) <<" "<< val<2>(nodes[n]) <<" "<< val<3>(nodes[n]) <<"   ";
+
+   out<<"\n";
+   out<<"         </DataArray>\n";
+   out<<"      </Points>\n";
+
+   //CELLS SECTION
+   out<<"      <Cells>\n";
+   out<<"         <DataArray type=\"Int32\" Name=\"connectivity\" format=\"ascii\">\n";
+
+   for(int c=0; c<nofLines; c++)
+      out<< val<1>(lines[c]) <<" "<< val<2>(lines[c])<<"  ";
+   out<<"\n";
+   out<<"      </DataArray>\n";
+   out<<"         <DataArray type=\"Int32\" Name=\"offsets\" format=\"ascii\">\n";
+   for(int c=1; c<=nofLines; c++)
+      out<<c*2<<" " ;
+
+   out<<"\n";
+   out<<"         </DataArray>\n";
+
+   out<<"      <DataArray type=\"UInt8\" Name=\"types\" format=\"ascii\">\n";
+
+   for(int c=0; c<nofLines; c++)
+      out<<"3 ";
+   out<<"\n";
+   out<<"      </DataArray>\n";
+   out<<"      </Cells>\n";
+
+   //write data section
+   out<<"         <PointData Scalars=\"Scalars\"> \n";
+   for(int s=0; s<(int)datanames.size(); ++s)
+   {
+      out<< "           <DataArray type=\"Float32\" Name=\""<< datanames[s] <<"\" format=\"ascii\"> \n";
+
+      for(int d=0; d<(int)nodedata[s].size(); d++)
+         out<<nodedata[s][d]<<" ";
+
+      out<<"\n          </DataArray>\n";
+   }
+   out<<"         </PointData>\n";
+   out<<"      </Piece>\n";
+   out<<"   </UnstructuredGrid>\n";
+   out<<"</VTKFile>";
+   out<<endl;
+   out.close();
+   UBLOG(logDEBUG1,"WbWriterVtkXmlASCII::writeLinesWithNodeData to "<<vtkfilename<<" - end");
+
+   return vtkfilename;
+}
+/*===============================================================================*/
+std::string WbWriterVtkXmlASCII::writeTriangles(const string& filename,vector<UbTupleFloat3 >& nodes, vector<UbTupleInt3 >& triangles)
+{
+   string vtkfilename=filename+getFileExtension();
+   UBLOG(logDEBUG1,"WbWriterVtkXmlASCII::writeTriangles to "<<vtkfilename<<" - start");
+
+   std::ofstream out(vtkfilename.c_str());
+   if(!out)
+   { 
+      out.clear(); //flags ruecksetzen (ansonsten liefert utern if(!out) weiterhin true!!!
+      string path = UbSystem::getPathFromString(vtkfilename);
+      if(path.size()>0){UbSystem::makeDirectory(path);out.open(vtkfilename.c_str());}
+      if(!out) throw UbException(UB_EXARGS,"couldn't open file "+vtkfilename);
+   }
+
+   int nofNodes = (int)nodes.size(); 
+   int nofTriangles= (int)triangles.size(); 
+
+   //VTK FILE
+   out<<"<VTKFile type=\"UnstructuredGrid\" version=\"0.1\" byte_order=\"LittleEndian\" >"<<"\n";
+   out<<"   <UnstructuredGrid>"<<"\n";
+   out<<"      <Piece NumberOfPoints=\""<<nofNodes<<"\"	NumberOfCells=\""<<nofTriangles<<"\">   \n";
+
+   //POINTS SECTION
+   out<<"      <Points>\n"; 
+   out<<"         <DataArray type=\"Float32\" NumberOfComponents=\"3\" format=\"ascii\">\n";
+   for(int n=0; n<nofNodes; n++)
+      out<< val<1>(nodes[n]) <<" "<< val<2>(nodes[n]) <<" "<< val<3>(nodes[n]) <<"   ";
+
+   out<<"\n";
+   out<<"         </DataArray>\n";
+   out<<"      </Points>\n";
+
+   //CELLS SECTION
+   out<<"      <Cells>\n";
+   out<<"         <DataArray type=\"Int32\" Name=\"connectivity\" format=\"ascii\">\n";
+
+   for(int c=0; c<nofTriangles; c++)
+      out<< val<1>(triangles[c]) <<" "<< val<2>(triangles[c])<<" "<< val<3>(triangles[c])<<"  ";
+   out<<"\n";
+   out<<"      </DataArray>\n";
+   out<<"         <DataArray type=\"Int32\" Name=\"offsets\" format=\"ascii\">\n";
+   for(int c=1; c<nofTriangles+1; c++)
+      out<<c*3<<" " ;
+
+   out<<"\n";
+   out<<"         </DataArray>\n";
+
+   out<<"      <DataArray type=\"UInt8\" Name=\"types\" format=\"ascii\">\n";
+
+   for(int c=0; c<nofTriangles; c++)
+      out<<"5 ";
+   out<<"\n";
+   out<<"      </DataArray>\n";
+   out<<"      </Cells>\n";
+   out<<"      </Piece>\n";
+   out<<"   </UnstructuredGrid>\n";
+   out<<"</VTKFile>";
+   out<<endl;
+   out.close();
+   UBLOG(logDEBUG1,"WbWriterVtkXmlASCII::writeTriangles to "<<vtkfilename<<" - end");
+
+   return vtkfilename;
+}
+/*===============================================================================*/
+std::string WbWriterVtkXmlASCII::writeTrianglesWithNodeData(const std::string& filename,std::vector< UbTupleFloat3 >& nodes, std::vector< UbTupleInt3 >& cells, std::vector< std::string >& datanames, std::vector< std::vector< double > >& nodedata)
+{
+   string vtkfilename=filename+getFileExtension();
+   UBLOG(logDEBUG1,"WbWriterVtkXmlASCII::writeTrianglesWithNodeData to "<<vtkfilename<<" - start");
+
+   std::ofstream out(vtkfilename.c_str());
+   if(!out)
+   { 
+      out.clear(); //flags ruecksetzen (ansonsten liefert utern if(!out) weiterhin true!!!
+      string path = UbSystem::getPathFromString(vtkfilename);
+      if(path.size()>0){UbSystem::makeDirectory(path);out.open(vtkfilename.c_str());}
+      if(!out) throw UbException(UB_EXARGS,"couldn't open file "+vtkfilename);
+   }
+
+   int nofNodes = (int)nodes.size(); 
+   int nofCells = (int)cells.size(); 
+
+   //VTK FILE
+   out<<"<VTKFile type=\"UnstructuredGrid\" version=\"0.1\" byte_order=\"LittleEndian\" >"<<"\n";
+   out<<"   <UnstructuredGrid>"<<"\n";
+   out<<"      <Piece NumberOfPoints=\""<<nofNodes<<"\"	NumberOfCells=\""<<nofCells<<"\">   \n";
+
+   //POINTS SECTION
+   out<<"         <Points>\n"; 
+   out<<"            <DataArray type=\"Float32\" NumberOfComponents=\"3\" format=\"ascii\">\n               ";
+   for(int n=0; n<nofNodes; n++)
+      out<< val<1>(nodes[n]) <<" "<< val<2>(nodes[n]) <<" "<< val<3>(nodes[n]) <<"   ";
+
+   out<<"\n";
+   out<<"            </DataArray>\n";
+   out<<"         </Points>\n";
+
+   //CELLS SECTION
+   out<<"         <Cells>\n";
+   out<<"            <DataArray type=\"Int32\" Name=\"connectivity\" format=\"ascii\">\n              ";
+
+   for(int c=0; c<nofCells; c++)
+      out<< val<1>(cells[c]) <<" "<< val<2>(cells[c]) <<" "<< val<3>(cells[c]) <<"   ";
+   out<<"\n";
+   out<<"            </DataArray>\n";
+   out<<"            <DataArray type=\"Int32\" Name=\"offsets\" format=\"ascii\">\n              ";
+   for(int c=1; c<nofCells+1; c++)
+      out<<c*3<<" " ;
+
+   out<<"\n";
+   out<<"            </DataArray>\n";
+
+   out<<"            <DataArray type=\"UInt8\" Name=\"types\" format=\"ascii\">\n              ";
+
+   for(int c=0; c<nofCells; c++)
+      out<<"5 ";
+   out<<"\n";
+   out<<"            </DataArray>\n";
+
+   out<<"         </Cells>\n";
+
+   //write data section
+   out<<"         <PointData Scalars=\"Scalars\"> \n";
+   for(int s=0; s<(int)datanames.size(); ++s)
+   {
+      out<< "           <DataArray type=\"Float32\" Name=\""<< datanames[s] <<"\" format=\"ascii\"> \n";
+
+      for(int d=0; d<(int)nodedata[s].size(); d++)
+         out<<nodedata[s][d]<<" ";
+
+      out<<"\n          </DataArray>\n";
+   }
+   out<<"         </PointData>\n";
+   out<<"      </Piece>\n";
+   out<<"   </UnstructuredGrid>\n";
+   out<<"</VTKFile>";
+   out<<endl;
+   out.close();
+   UBLOG(logDEBUG1,"WbWriterVtkXmlASCII::writeTrianglesWithNodeData to "<<vtkfilename<<" - end");
+
+   return vtkfilename;
+}
+/*===============================================================================*/
+std::string WbWriterVtkXmlASCII::writeOctsWithCellData(const string& filename,vector< UbTupleFloat3 >& nodes, vector< UbTupleInt8 >& cells, vector< string >& datanames, vector< vector< double > >& celldata)
+{
+   string vtkfilename=filename+getFileExtension();
+   UBLOG(logDEBUG1,"WbWriterVtkXmlASCII::writeOctsWithCellData to "<<vtkfilename<<" - start");
+
+   std::ofstream out(vtkfilename.c_str());
+   if(!out)
+   { 
+      out.clear(); //flags ruecksetzen (ansonsten liefert utern if(!out) weiterhin true!!!
+      string path = UbSystem::getPathFromString(vtkfilename);
+      if(path.size()>0){UbSystem::makeDirectory(path);out.open(vtkfilename.c_str());}
+      if(!out) throw UbException(UB_EXARGS,"couldn't open file "+vtkfilename);
+   }
+
+   int nofNodes = (int)nodes.size(); 
+   int nofCells = (int)cells.size(); 
+
+   //VTK FILE
+   out<<"<VTKFile type=\"UnstructuredGrid\" version=\"0.1\" byte_order=\"LittleEndian\" >"<<"\n";
+   out<<"   <UnstructuredGrid>"<<"\n";
+   out<<"      <Piece NumberOfPoints=\""<<nofNodes<<"\"	NumberOfCells=\""<<nofCells<<"\">   \n";
+
+   //POINTS SECTION
+   out<<"         <Points>\n"; 
+   out<<"            <DataArray type=\"Float32\" NumberOfComponents=\"3\" format=\"ascii\">\n               ";
+   for(int n=0; n<nofNodes; n++)
+      out<< val<1>(nodes[n]) <<" "<< val<2>(nodes[n]) <<" "<< val<3>(nodes[n]) <<"   ";
+
+   out<<"\n";
+   out<<"            </DataArray>\n";
+   out<<"         </Points>\n";
+
+   //CELLS SECTION
+   out<<"         <Cells>\n";
+   out<<"            <DataArray type=\"Int32\" Name=\"connectivity\" format=\"ascii\">\n              ";
+
+   for(int c=0; c<nofCells; c++)
+      out<< val<1>(cells[c]) <<" "
+         << val<2>(cells[c]) <<" "
+         << val<4>(cells[c]) <<" "
+         << val<3>(cells[c]) <<" "
+         << val<5>(cells[c]) <<" "
+         << val<6>(cells[c]) <<" "
+         << val<8>(cells[c]) <<" "
+         << val<7>(cells[c]) <<"  ";
+   out<<"\n";
+   out<<"            </DataArray>\n";
+   out<<"            <DataArray type=\"Int32\" Name=\"offsets\" format=\"ascii\">\n              ";
+   for(int c=1; c<nofCells+1; c++)
+      out<<c*8<<" " ;
+
+
+   out<<"\n";
+   out<<"            </DataArray>\n";
+
+   out<<"            <DataArray type=\"UInt8\" Name=\"types\" format=\"ascii\">\n              ";
+
+   for(int c=0; c<nofCells; c++)
+      out<<"11 ";
+   out<<"\n";
+   out<<"            </DataArray>\n";
+
+   out<<"         </Cells>\n";
+   
+
+   //write data section
+   out<<"         <CellData Scalars=\"Scalars\"> \n";
+   for(int s=0; s<(int)datanames.size(); ++s)
+   {
+      out<< "           <DataArray type=\"Float32\" Name=\""<< datanames[s] <<"\" format=\"ascii\"> \n";
+
+      for(int d=0; d<(int)celldata[s].size(); d++)
+         out<<celldata[s][d]<<" ";
+
+      out<<"\n          </DataArray>\n";
+   }
+   out<<"         </CellData>\n";
+
+   out<<"      </Piece>\n";
+   out<<"   </UnstructuredGrid>\n";
+   out<<"</VTKFile>";
+   out<<endl;
+   out.close();
+   UBLOG(logDEBUG1,"WbWriterVtkXmlASCII::writeOctsWithCellData to "<<vtkfilename<<" - end");
+
+   return vtkfilename;
+}
+/*===============================================================================*/
+std::string WbWriterVtkXmlASCII::writeOctsWithNodeData(const string& filename,vector< UbTupleFloat3 >& nodes, vector< UbTupleInt8 >& cells, vector< string >& datanames, vector< vector< double > >& nodedata)
+{
+   string vtkfilename=filename+getFileExtension();
+   UBLOG(logDEBUG1,"WbWriterVtkXmlASCII::writeOctsWithNodeData to "<<vtkfilename<<" - start");
+
+   std::ofstream out(vtkfilename.c_str());
+   if(!out)
+   { 
+      out.clear(); //flags ruecksetzen (ansonsten liefert utern if(!out) weiterhin true!!!
+      string path = UbSystem::getPathFromString(vtkfilename);
+      if(path.size()>0){UbSystem::makeDirectory(path);out.open(vtkfilename.c_str());}
+      if(!out) throw UbException(UB_EXARGS,"couldn't open file "+vtkfilename);
+   }
+
+   int nofNodes = (int)nodes.size(); 
+   int nofCells = (int)cells.size(); 
+
+   //VTK FILE
+   out<<"<VTKFile type=\"UnstructuredGrid\" version=\"0.1\" byte_order=\"LittleEndian\" >"<<"\n";
+   out<<"   <UnstructuredGrid>"<<"\n";
+   out<<"      <Piece NumberOfPoints=\""<<nofNodes<<"\"	NumberOfCells=\""<<nofCells<<"\">   \n";
+
+   //POINTS SECTION
+   out<<"         <Points>\n"; 
+   out<<"            <DataArray type=\"Float32\" NumberOfComponents=\"3\" format=\"ascii\">\n               ";
+   for(int n=0; n<nofNodes; n++)
+      out<<val<1>(nodes[n])<<" "<<val<2>(nodes[n])<<" "<<val<3>(nodes[n])<<" ";
+
+   out<<"\n";
+   out<<"            </DataArray>\n";
+   out<<"         </Points>\n";
+
+   //CELLS SECTION
+   out<<"         <Cells>\n";
+   out<<"            <DataArray type=\"Int32\" Name=\"connectivity\" format=\"ascii\">\n              ";
+
+   for(int c=0; c<nofCells; c++)
+      out<< val<1>(cells[c]) <<" "
+         << val<2>(cells[c]) <<" "
+         << val<4>(cells[c]) <<" "
+         << val<3>(cells[c]) <<" "
+         << val<5>(cells[c]) <<" "
+         << val<6>(cells[c]) <<" "
+         << val<8>(cells[c]) <<" "
+         << val<7>(cells[c]) <<"  ";
+
+   out<<"\n";
+   out<<"            </DataArray>\n";
+   out<<"            <DataArray type=\"Int32\" Name=\"offsets\" format=\"ascii\">\n              ";
+   for(int c=1; c<nofCells+1; c++)
+      out<<c*8<<" " ;
+
+   out<<"\n";
+   out<<"            </DataArray>\n";
+
+   out<<"            <DataArray type=\"UInt8\" Name=\"types\" format=\"ascii\">\n              ";
+
+   for(int c=0; c<nofCells; c++)
+      out<<"11 ";
+   out<<"\n";
+   out<<"            </DataArray>\n";
+
+   out<<"         </Cells>\n";
+
+   //write PointData section
+   out<<"         <PointData Scalars=\"PScalars\"> \n";
+   for(int s=0; s<(int)datanames.size(); ++s)
+   {
+      out<< "           <DataArray type=\"Float64\" Name=\""<< datanames[s] <<"\" format=\"ascii\">";
+
+      for(int d=0; d<(int)nodedata[s].size(); d++)
+      {
+         //out<<base64_encode((unsigned char*)(&nodedata[s][d]),sizeof(float));
+         //out.write((char*)&nodedata[s][d],sizeof(float));
+         out<<nodedata[s][d]<<" ";
+      }
+      out<<"</DataArray>\n";
+   }
+   out<<"         </PointData>\n";
+   out<<"      </Piece>\n";
+   out<<"   </UnstructuredGrid>\n";
+   out<<"</VTKFile>";
+   out<<endl;
+   out.close();
+   UBLOG(logDEBUG1,"WbWriterVtkXmlASCII::writeOctsWithNodeData to "<<vtkfilename<<" - end");
+
+   return vtkfilename;
+}
+/*===============================================================================*/
+std::string WbWriterVtkXmlASCII::writeOcts(const string& filename,vector< UbTupleFloat3 >& nodes, vector< UbTupleInt8 >& cells)
+{
+   string vtkfilename=filename+getFileExtension();
+   UBLOG(logDEBUG1,"WbWriterVtkXmlASCII::writeOcts to "<<vtkfilename<<" - start");
+
+   std::ofstream out(vtkfilename.c_str());
+   if(!out)
+   { 
+      out.clear(); //flags ruecksetzen (ansonsten liefert utern if(!out) weiterhin true!!!
+      string path = UbSystem::getPathFromString(vtkfilename);
+      if(path.size()>0){UbSystem::makeDirectory(path);out.open(vtkfilename.c_str());}
+      if(!out) throw UbException(UB_EXARGS,"couldn't open file "+vtkfilename);
+   }
+
+   int nofNodes = (int)nodes.size(); 
+   int nofCells = (int)cells.size(); 
+
+   //VTK FILE
+   out<<"<VTKFile type=\"UnstructuredGrid\" version=\"0.1\" byte_order=\"LittleEndian\" >"<<"\n";
+   out<<"   <UnstructuredGrid>"<<"\n";
+   out<<"      <Piece NumberOfPoints=\""<<nofNodes<<"\"	NumberOfCells=\""<<nofCells<<"\">   \n";
+
+   //POINTS SECTION
+   out<<"         <Points>\n"; 
+   out<<"            <DataArray type=\"Float32\" NumberOfComponents=\"3\" format=\"ascii\">\n               ";
+   for(int n=0; n<nofNodes; n++)
+      out<< val<1>(nodes[n]) <<" "<< val<2>(nodes[n]) <<" "<< val<3>(nodes[n]) <<"   ";
+
+   out<<"\n";
+   out<<"            </DataArray>\n";
+   out<<"         </Points>\n";
+
+   //CELLS SECTION
+   out<<"         <Cells>\n";
+   out<<"            <DataArray type=\"Int32\" Name=\"connectivity\" format=\"ascii\">\n              ";
+
+   for(int c=0; c<nofCells; c++)
+      out<< val<1>(cells[c]) <<" "
+         << val<2>(cells[c]) <<" "
+         << val<4>(cells[c]) <<" "
+         << val<3>(cells[c]) <<" "
+         << val<5>(cells[c]) <<" "
+         << val<6>(cells[c]) <<" "
+         << val<8>(cells[c]) <<" "
+         << val<7>(cells[c]) <<"   ";
+   out<<"\n";
+   out<<"            </DataArray>\n";
+   out<<"            <DataArray type=\"Int32\" Name=\"offsets\" format=\"ascii\">\n              ";
+   for(int c=1; c<nofCells+1; c++)
+      out<<c*8<<" " ;
+
+   out<<"\n";
+   out<<"            </DataArray>\n";
+
+   out<<"            <DataArray type=\"UInt8\" Name=\"types\" format=\"ascii\">\n              ";
+
+   for(int c=0; c<nofCells; c++)
+      out<<"11 ";
+   out<<"\n";
+   out<<"            </DataArray>\n";
+   out<<"         </Cells>\n";
+   out<<"      </Piece>\n";
+   out<<"   </UnstructuredGrid>\n";
+   out<<"</VTKFile>";
+   out<<endl;
+   out.close();
+   UBLOG(logDEBUG1,"WbWriterVtkXmlASCII::writeOcts to "<<vtkfilename<<" - end");
+
+   return vtkfilename;
+}
+std::string WbWriterVtkXmlASCII::writeNodes(const std::string& filename,std::vector< UbTupleFloat3 >& nodes)
+{
+   string vtkfilename=filename+getFileExtension();
+   UBLOG(logDEBUG1,"WbWriterVtkXmlASCII::writeLines to "<<vtkfilename<<" - start");
+
+   std::ofstream out(vtkfilename.c_str());
+   if(!out)
+   { 
+      out.clear(); //flags ruecksetzen (ansonsten liefert utern if(!out) weiterhin true!!!
+      string path = UbSystem::getPathFromString(vtkfilename);
+      if(path.size()>0){UbSystem::makeDirectory(path);out.open(vtkfilename.c_str());}
+      if(!out) throw UbException(UB_EXARGS,"couldn't open file "+vtkfilename);
+   }
+
+   int nofNodes = (int)nodes.size(); 
+
+   //VTK FILE
+   out<<"<VTKFile type=\"UnstructuredGrid\" version=\"0.1\" byte_order=\"LittleEndian\" >"<<"\n";
+   out<<"   <UnstructuredGrid>"<<"\n";
+   out<<"      <Piece NumberOfPoints=\""<<nofNodes<<"\"	NumberOfCells=\""<<nofNodes<<"\">   \n";
+
+   //POINTS SECTION
+   out<<"      <Points>\n"; 
+   out<<"         <DataArray type=\"Float32\" NumberOfComponents=\"3\" format=\"ascii\">\n";
+   for(int n=0; n<nofNodes; n++)
+      out<< val<1>(nodes[n]) <<" "<< val<2>(nodes[n]) <<" "<< val<3>(nodes[n]) <<"   ";
+
+   out<<"\n";
+   out<<"         </DataArray>\n";
+   out<<"      </Points>\n";
+
+   //CELLS SECTION
+   out<<"      <Cells>\n";
+   out<<"         <DataArray type=\"Int32\" Name=\"connectivity\" format=\"ascii\">\n";
+   for(int n=0; n<nofNodes; n++)
+      out<< n << "  ";
+   out<<"\n";
+
+   out<<"      </DataArray>\n";
+   out<<"         <DataArray type=\"Int32\" Name=\"offsets\" format=\"ascii\">\n";
+   for(int n=1; n<=nofNodes; n++)
+      out << n << " ";
+
+   out<<"\n";
+   out<<"         </DataArray>\n";
+
+   out<<"      <DataArray type=\"UInt8\" Name=\"types\" format=\"ascii\">\n";
+
+   for(int n=0; n<nofNodes; n++)
+      out<<"1 ";
+   out<<"\n";
+   out<<"      </DataArray>\n";
+   out<<"      </Cells>\n";
+   out<<"      </Piece>\n";
+   out<<"   </UnstructuredGrid>\n";
+   out<<"</VTKFile>";
+   out<<endl;
+   out.close();
+   UBLOG(logDEBUG1,"WbWriterVtkXmlASCII::writeLines to "<<vtkfilename<<" - end");
+
+   return vtkfilename;
+}
+std::string WbWriterVtkXmlASCII::writeNodesWithNodeData(const std::string& filename,std::vector< UbTupleFloat3 >& nodes, std::vector<std::string >& datanames, std::vector<std::vector<double > >& nodedata)
+{
+   string vtkfilename=filename+getFileExtension();
+   UBLOG(logDEBUG1,"WbWriterVtkXmlASCII::writeNodesWithNodeData to "<<vtkfilename<<" - start");
+
+   std::ofstream out(vtkfilename.c_str());
+   if(!out)
+   { 
+      out.clear(); //flags ruecksetzen (ansonsten liefert utern if(!out) weiterhin true!!!
+      string path = UbSystem::getPathFromString(vtkfilename);
+      if(path.size()>0){UbSystem::makeDirectory(path);out.open(vtkfilename.c_str());}
+      if(!out) throw UbException(UB_EXARGS,"couldn't open file "+vtkfilename);
+   }
+
+   int nofNodes = (int)nodes.size(); 
+
+   //VTK FILE
+   out<<"<VTKFile type=\"UnstructuredGrid\" version=\"0.1\" byte_order=\"LittleEndian\" >"<<"\n";
+   out<<"   <UnstructuredGrid>"<<"\n";
+   out<<"      <Piece NumberOfPoints=\""<<nofNodes<<"\"	NumberOfCells=\""<<nofNodes<<"\">   \n";
+
+   //POINTS SECTION
+   out<<"         <Points>\n"; 
+   out<<"            <DataArray type=\"Float32\" NumberOfComponents=\"3\" format=\"ascii\">\n               ";
+   for(int n=0; n<nofNodes; n++)
+      out<< val<1>(nodes[n]) <<" "<< val<2>(nodes[n]) <<" "<< val<3>(nodes[n]) <<"   ";
+
+   out<<"\n";
+   out<<"            </DataArray>\n";
+   out<<"         </Points>\n";
+
+   //CELLS SECTION
+   out<<"         <Cells>\n";
+   out<<"            <DataArray type=\"Int32\" Name=\"connectivity\" format=\"ascii\">\n              ";
+
+   for(int c=0; c<nofNodes; c++)
+      out << c <<"   ";
+   out<<"\n";
+
+   out<<"            </DataArray>\n";
+   out<<"            <DataArray type=\"Int32\" Name=\"offsets\" format=\"ascii\">\n              ";
+   for(int c=1; c<nofNodes+1; c++)
+      out<<c<<" " ;
+
+   out<<"\n";
+   out<<"            </DataArray>\n";
+
+   out<<"            <DataArray type=\"UInt8\" Name=\"types\" format=\"ascii\">\n              ";
+   for(int c=0; c<nofNodes; c++)
+      out<<"1 ";
+
+   out<<"\n";
+   out<<"            </DataArray>\n";
+
+   out<<"         </Cells>\n";
+
+   //write data section
+   out<<"         <PointData Scalars=\"Scalars\"> \n";
+   for(int s=0; s<(int)datanames.size(); ++s)
+   {
+      out<< "           <DataArray type=\"Float32\" Name=\""<< datanames[s] <<"\" format=\"ascii\"> \n";
+
+      for(int d=0; d<(int)nodedata[s].size(); d++)
+         out<<nodedata[s][d]<<" ";
+
+      out<<"\n          </DataArray>\n";
+   }
+   out<<"         </PointData>\n";
+   out<<"      </Piece>\n";
+   out<<"   </UnstructuredGrid>\n";
+   out<<"</VTKFile>";
+   out<<endl;
+   out.close();
+   out.close();
+   UBLOG(logDEBUG1,"WbWriterVtkXmlASCII::writeNodesWithNodeData to "<<vtkfilename<<" - end");
+
+   return vtkfilename;
+}
+
+//////////////////////////////////////////////////////////////////////////
+std::string WbWriterVtkXmlASCII::writeNodesWithNodeDataDouble(const std::string& filename,std::vector< UbTupleDouble3 >& nodes, std::vector<std::string >& datanames, std::vector<std::vector<double > >& nodedata)
+{
+   string vtkfilename=filename+getFileExtension();
+   UBLOG(logDEBUG1,"WbWriterVtkXmlASCII::writeNodesWithNodeData to "<<vtkfilename<<" - start");
+
+   std::ofstream out(vtkfilename.c_str());
+   out.precision (std::numeric_limits<double>::digits10 + 1);
+   if(!out)
+   { 
+      out.clear(); //flags ruecksetzen (ansonsten liefert utern if(!out) weiterhin true!!!
+      string path = UbSystem::getPathFromString(vtkfilename);
+      if(path.size()>0){UbSystem::makeDirectory(path);out.open(vtkfilename.c_str());}
+      if(!out) throw UbException(UB_EXARGS,"couldn't open file "+vtkfilename);
+   }
+
+   int nofNodes = (int)nodes.size(); 
+
+   //VTK FILE
+   out<<"<VTKFile type=\"UnstructuredGrid\" version=\"0.1\" byte_order=\"LittleEndian\" >"<<"\n";
+   out<<"   <UnstructuredGrid>"<<"\n";
+   out<<"      <Piece NumberOfPoints=\""<<nofNodes<<"\"	NumberOfCells=\""<<nofNodes<<"\">   \n";
+
+   //POINTS SECTION
+   out<<"         <Points>\n"; 
+   out<<"            <DataArray type=\"Float64\" NumberOfComponents=\"3\" format=\"ascii\">\n               ";
+   for(int n=0; n<nofNodes; n++)
+      out<< val<1>(nodes[n]) <<" "<< val<2>(nodes[n]) <<" "<< val<3>(nodes[n]) <<"   ";
+
+   out<<"\n";
+   out<<"            </DataArray>\n";
+   out<<"         </Points>\n";
+
+   //CELLS SECTION
+   out<<"         <Cells>\n";
+   out<<"            <DataArray type=\"Int32\" Name=\"connectivity\" format=\"ascii\">\n              ";
+
+   for(int c=0; c<nofNodes; c++)
+      out << c <<"   ";
+   out<<"\n";
+
+   out<<"            </DataArray>\n";
+   out<<"            <DataArray type=\"Int64\" Name=\"offsets\" format=\"ascii\">\n              ";
+   for(int c=1; c<nofNodes+1; c++)
+      out<<c<<" " ;
+
+   out<<"\n";
+   out<<"            </DataArray>\n";
+
+   out<<"            <DataArray type=\"UInt8\" Name=\"types\" format=\"ascii\">\n              ";
+   for(int c=0; c<nofNodes; c++)
+      out<<"1 ";
+
+   out<<"\n";
+   out<<"            </DataArray>\n";
+
+   out<<"         </Cells>\n";
+
+   //write data section
+   out<<"         <PointData Scalars=\"Scalars\"> \n";
+   for(int s=0; s<(int)datanames.size(); ++s)
+   {
+      out<< "           <DataArray type=\"Float64\" Name=\""<< datanames[s] <<"\" format=\"ascii\"> \n";
+
+      for(int d=0; d<(int)nodedata[s].size(); d++)
+         out<<nodedata[s][d]<<" ";
+
+      out<<"\n          </DataArray>\n";
+   }
+   out<<"         </PointData>\n";
+   out<<"      </Piece>\n";
+   out<<"   </UnstructuredGrid>\n";
+   out<<"</VTKFile>";
+   out<<endl;
+   out.close();
+   out.close();
+   UBLOG(logDEBUG1,"WbWriterVtkXmlASCII::writeNodesWithNodeData to "<<vtkfilename<<" - end");
+
+   return vtkfilename;
+}
diff --git a/src/VirtualFluidsBasics/basics/writer/WbWriterVtkXmlASCII.h b/src/VirtualFluidsBasics/basics/writer/WbWriterVtkXmlASCII.h
new file mode 100644
index 0000000000000000000000000000000000000000..7b17ac7dd56daddd350f3ac9bf11636554aa9875
--- /dev/null
+++ b/src/VirtualFluidsBasics/basics/writer/WbWriterVtkXmlASCII.h
@@ -0,0 +1,122 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 WbWriterVtkXmlASCII.h
+//! \ingroup writer
+//! \author Soeren Freudiger, Sebastian Geller
+//=======================================================================================
+#ifndef WBWRITERVTKXMLASCII_H
+#define WBWRITERVTKXMLASCII_H
+
+#include <string>
+
+#include <basics/writer/WbWriter.h>
+
+class VF_PUBLIC WbWriterVtkXmlASCII  : public WbWriter
+{
+public:
+   static WbWriterVtkXmlASCII* getInstance()
+   {
+      static WbWriterVtkXmlASCII instance;
+      return &instance;
+   }
+private:
+   WbWriterVtkXmlASCII() : WbWriter() 
+   {
+      if(sizeof(unsigned char)!=1) throw UbException(UB_EXARGS,"error char  type mismatch");
+      if(sizeof(int)          !=4) throw UbException(UB_EXARGS,"error int   type mismatch");
+      if(sizeof(float)        !=4) throw UbException(UB_EXARGS,"error float type mismatch");
+   }
+   WbWriterVtkXmlASCII( const WbWriterVtkXmlASCII& );                  //no copy allowed 
+   const WbWriterVtkXmlASCII& operator=( const WbWriterVtkXmlASCII& ); //no copy allowed
+
+   static std::string  pvdEndTag;
+
+public:
+   std::string getFileExtension()  { return ".ascii.vtu"; }
+
+   //write a metafile 
+   std::string writeCollection(const std::string& filename, const std::vector<std::string>& filenames, const double& timesteps, const bool& sepGroups);//std::vector<double>& groups, std::vector<double>& parts);
+   std::string addFilesToCollection(const std::string& filename, const std::vector<std::string>& filenames, const double& timestep, const bool& sepGroups);
+   std::string writeParallelFile(const std::string& filename,std::vector<std::string>& pieceSources, std::vector<std::string>& pointDataNames, std::vector<std::string>& cellDataNames);
+
+   //////////////////////////////////////////////////////////////////////////
+   //nodes
+   std::string writeNodes(const std::string& filename,std::vector< UbTupleFloat3 >& nodes);
+   std::string writeNodesWithNodeData(const std::string& filename,std::vector< UbTupleFloat3 >& nodes, std::vector<std::string >& datanames, std::vector<std::vector<double > >& nodedata);
+   std::string writeNodesWithNodeDataDouble(const std::string& filename,std::vector< UbTupleDouble3 >& nodes, std::vector<std::string >& datanames, std::vector<std::vector<double > >& nodedata);
+
+   //////////////////////////////////////////////////////////////////////////
+   //lines
+   //     0 ---- 1
+   //nodenumbering must start with 0!
+   std::string writeLines(const std::string& filename,std::vector<UbTupleFloat3 >& nodes, std::vector<UbTupleInt2 >& lines);
+   std::string writeLinesWithNodeData(const std::string& filename,std::vector<UbTupleFloat3 >& nodes, std::vector<UbTupleInt2 >& lines, std::vector< std::string >& datanames, std::vector< std::vector< double > >& nodedata);
+
+   //////////////////////////////////////////////////////////////////////////
+   //triangles
+   //                    2
+   //                     
+   //                  0---1
+   //nodenumbering must start with 0!
+   std::string writeTriangles(const std::string& filename,std::vector<UbTupleFloat3 >& nodes, std::vector<UbTupleInt3 >& triangles);
+   std::string writeTrianglesWithNodeData(const std::string& filename,std::vector< UbTupleFloat3 >& nodes, std::vector< UbTupleInt3 >& cells, std::vector< std::string >& datanames, std::vector< std::vector< double > >& nodedata);
+
+   //////////////////////////////////////////////////////////////////////////
+   //2D
+   //cell numbering:
+   //                  3---2
+   //                  |   |
+   //                  0---1
+   //nodenumbering must start with 0!
+
+   std::string writeQuads(const std::string& filename,std::vector< UbTupleFloat3 >& nodes, std::vector< UbTupleInt4 >& cells);
+   std::string writeQuadsWithNodeData(const std::string& filename,std::vector< UbTupleFloat3 >& nodes, std::vector< UbTupleInt4 >& cells, std::vector< std::string >& datanames, std::vector< std::vector< double > >& nodedata);
+   std::string writeQuadsWithCellData(const std::string& filename,std::vector< UbTupleFloat3 >& nodes, std::vector< UbTupleInt4 >& cells, std::vector< std::string >& datanames, std::vector< std::vector< double > >& celldata);
+   std::string writeQuadsWithNodeAndCellData(const std::string& filename,std::vector< UbTupleFloat3 >& nodes, std::vector< UbTupleInt4 >& cells, 
+                                             std::vector< std::string >& nodedatanames, std::vector< std::vector< double > >& nodedata, std::vector< std::string >& celldatanames,
+                                             std::vector< std::vector< double > >& celldata                                                                       );
+   
+   //////////////////////////////////////////////////////////////////////////
+   //octs
+   //     7 ---- 6
+   //    /|     /|
+   //   4 +--- 5 |
+   //   | |    | |
+   //   | 3 ---+ 2
+   //   |/     |/
+   //   0 ---- 1
+   std::string writeOcts(const std::string& filename,std::vector< UbTupleFloat3 >& nodes, std::vector< UbTupleInt8 >& cells);
+   std::string writeOctsWithCellData(const std::string& filename,std::vector< UbTupleFloat3 >& nodes, std::vector< UbTupleInt8 >& cells, std::vector< std::string >& datanames, std::vector< std::vector< double > >& celldata);
+   std::string writeOctsWithNodeData(const std::string& filename,std::vector< UbTupleFloat3 >& nodes, std::vector< UbTupleInt8 >& cells, std::vector< std::string >& datanames, std::vector< std::vector< double > >& nodedata);
+
+private:
+
+};
+
+#endif //WBWRITERVTKXMLASCII_H
diff --git a/src/VirtualFluidsBasics/basics/writer/WbWriterVtkXmlBinary.cpp b/src/VirtualFluidsBasics/basics/writer/WbWriterVtkXmlBinary.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..67bd1f56397d6993e54333a07adb6867e2f6f196
--- /dev/null
+++ b/src/VirtualFluidsBasics/basics/writer/WbWriterVtkXmlBinary.cpp
@@ -0,0 +1,1618 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 WbWriterVtkXmlBinary.cpp
+//! \ingroup writer
+//! \author Soeren Freudiger, Sebastian Geller
+//=======================================================================================
+#include <basics/writer/WbWriterVtkXmlBinary.h>
+#include <basics/writer/WbWriterVtkXmlASCII.h>
+#include <basics/utilities/UbLogger.h>
+#include <cstring>
+
+using namespace std;
+
+/*===============================================================================*/
+string WbWriterVtkXmlBinary::pvdEndTag ="   </Collection>\n</VTKFile>";
+/*===============================================================================*/
+string WbWriterVtkXmlBinary::writeCollection(const string& filename, const vector<string>& filenames, const double& timeStep, const bool& sepGroups)
+{
+   string vtkfilename=filename+".pvd";
+   ofstream out(vtkfilename.c_str());
+   if(!out)
+   { 
+      out.clear(); //flags ruecksetzen (ansonsten liefert utern if(!out) weiterhin true!!!
+      string path = UbSystem::getPathFromString(vtkfilename);
+      if(path.size()>0){ UbSystem::makeDirectory(path); out.open(vtkfilename.c_str());}
+      if(!out) throw UbException(UB_EXARGS,"couldn't open file "+vtkfilename);
+   }
+
+   string endian;
+   if(UbSystem::isLittleEndian()) endian = "LittleEndian";
+   else                           endian = "BigEndian";
+   out<<"<VTKFile type=\"Collection\" version=\"0.1\" byte_order=\""<<endian<<"\" >"<<endl;
+   out<<"   <Collection>"<<endl;
+   
+   int group = 0, part=0;
+   for(size_t i=0; i<filenames.size(); i++)
+   {
+      out<<"       <DataSet timestep=\""<<timeStep<<"\" group=\""<<group<<"\" part=\""<<part<<"\" file=\""<<filenames[i]<<"\"/>"<<endl;
+      if(sepGroups) group++;
+      else          part++;
+   }
+   out<<pvdEndTag;
+   out.close();
+
+   return vtkfilename;
+}
+/*===============================================================================*/
+string WbWriterVtkXmlBinary::addFilesToCollection(const string& filename, const vector<string>& filenames, const double& timeStep, const bool& sepGroups)
+{
+   string vtkfilename=filename;
+   fstream test(vtkfilename.c_str(), ios::in);
+   if(!test)
+   {
+      test.clear();
+      vtkfilename += ".pvd";
+      test.open(vtkfilename.c_str(), ios::in);
+      if(!test) return this->writeCollection(filename,filenames,timeStep,sepGroups);
+   }
+ 
+   fstream out(vtkfilename.c_str(), ios::in | ios::out);
+   out.seekp(-(int)pvdEndTag.size()-1, ios_base::end);
+
+   int group = 0;
+   for(size_t i=0; i<filenames.size(); i++)
+   {
+      out<<"       <DataSet timestep=\""<<timeStep<<"\" group=\""<<group<<"\" part=\""<<i<<"\" file=\""<<filenames[i]<<"\"/>"<<endl;
+      if(sepGroups) group++;
+   }
+   out<<pvdEndTag;
+
+   return vtkfilename;
+}
+/*===============================================================================*/
+string WbWriterVtkXmlBinary::writeParallelFile(const string& filename,vector<string>& pieceSources, vector<string>& pointDataNames, vector<string>& cellDataNames)
+{
+   string vtkfilename=filename+".pvtu";
+   UBLOG(logDEBUG1,"WbWriterVtkXmlBinary::writeParallelFile to "<<vtkfilename<<" - start");
+
+   ofstream out(vtkfilename.c_str());
+   if(!out)
+   { 
+      out.clear(); //flags ruecksetzen (ansonsten liefert utern if(!out) weiterhin true!!!
+      string path = UbSystem::getPathFromString(vtkfilename);
+      if(path.size()>0){ UbSystem::makeDirectory(path); out.open(vtkfilename.c_str());}
+      if(!out) throw UbException(UB_EXARGS,"couldn't open file "+vtkfilename);
+   }
+
+   //VTK FILE
+   out<<"<VTKFile type=\"PUnstructuredGrid\" version=\"0.1\" byte_order=\"LittleEndian\">"<<"\n";
+   out<<"  <PUnstructuredGrid GhostLevel=\"0\">"<<"\n";
+   out<<"    <PPoints>\n"; 
+   out<<"      <PDataArray type=\"Float32\" NumberOfComponents=\"3\"/>\n";
+   out<<"    </PPoints>\n";
+   out<<"    <PPointData>\n";
+   for(size_t s=0; s<pointDataNames.size(); s++)
+      out<< "      <PDataArray type=\"Float32\" Name=\""<< pointDataNames[s] <<"\"/>\n";
+   out<<"    </PPointData>\n";
+   if (cellDataNames.size() > 0)
+   {
+      out<<"    <PCellData>\n";
+      for(size_t s=0; s<cellDataNames.size(); s++)
+         out<< "      <PDataArray type=\"Float32\" Name=\""<< cellDataNames[s] <<"\"/>\n";
+      out<<"    </PCellData>\n";
+   }
+
+   for(size_t s=0; s<pieceSources.size(); s++)
+      out<<"    <Piece Source=\""<<pieceSources[s]<<"\"/>\n";
+   out<<"  </PUnstructuredGrid>\n";
+   out<<"</VTKFile>";
+   out<<endl;
+   out.close();
+   UBLOG(logDEBUG1,"WbWriterVtkXmlBinary::writeParallelFile to "<<vtkfilename<<" - end");
+
+   return vtkfilename;
+}
+/*===============================================================================*/
+string WbWriterVtkXmlBinary::writeLines(const string& filename,vector<UbTupleFloat3 >& nodes, vector<UbTupleInt2 >& lines)
+{
+   string vtkfilename = filename+getFileExtension();
+   UBLOG(logDEBUG1,"WbWriterVtkXmlBinary::writeLines to "<<vtkfilename<<" - start");
+
+   ofstream out(vtkfilename.c_str(),ios::out | ios::binary);
+   if(!out)
+   { 
+      out.clear(); //flags ruecksetzen (ansonsten liefert utern if(!out) weiterhin true!!!
+      string path = UbSystem::getPathFromString(vtkfilename);
+      if(path.size()>0){ UbSystem::makeDirectory(path); out.open(vtkfilename.c_str(),ios::out | ios::binary);}
+      if(!out) throw UbException(UB_EXARGS,"couldn't open file "+vtkfilename);
+   }
+
+   int nofNodes = (int)nodes.size(); 
+   int nofCells = (int)lines.size(); 
+
+   int bytesPerByteVal      = 4; //==sizeof(int)
+   int bytesPoints          = 3 /*x1/x2/x3        */ * nofNodes * sizeof(float);
+   int bytesCellConnectivty = 2 /*nodes per line */ * nofCells * sizeof(int  );
+   int bytesCellOffsets     = 1 /*offset per line */ * nofCells * sizeof(int  );
+   int bytesCellTypes       = 1 /*type of line */ * nofCells * sizeof(unsigned char);
+
+   int offset = 0;
+   //VTK FILE
+   out<<"<?xml version=\"1.0\"?>\n";
+   out<<"<VTKFile type=\"UnstructuredGrid\" version=\"0.1\" byte_order=\"LittleEndian\" >"<<"\n";
+   out<<"   <UnstructuredGrid>"<<"\n";
+   out<<"      <Piece NumberOfPoints=\""<<nofNodes<<"\" NumberOfCells=\""<<nofCells<<"\">\n";
+
+   //POINTS SECTION
+   out<<"         <Points>\n"; 
+   out<<"            <DataArray type=\"Float32\" NumberOfComponents=\"3\" format=\"appended\" offset=\""<< offset <<"\"  />\n";
+   out<<"         </Points>\n";
+   offset += (bytesPerByteVal + bytesPoints);
+
+   //CELLS SECTION
+   out<<"         <Cells>\n";
+   out<<"            <DataArray type=\"Int32\" Name=\"connectivity\" format=\"appended\" offset=\""<< offset <<"\" />\n";
+   offset += (bytesPerByteVal + bytesCellConnectivty); 
+   out<<"            <DataArray type=\"Int32\" Name=\"offsets\" format=\"appended\" offset=\""<< offset <<"\" />\n";
+   offset += (bytesPerByteVal + bytesCellOffsets);
+   out<<"            <DataArray type=\"UInt8\" Name=\"types\" format=\"appended\" offset=\""<< offset <<"\" />\n ";
+   offset += (bytesPerByteVal + bytesCellTypes);
+   out<<"         </Cells>\n";
+
+   out<<"      </Piece>\n";
+   out<<"   </UnstructuredGrid>\n";
+
+   // AppendedData SECTION
+   out<<"   <AppendedData encoding=\"raw\">\n";
+   out<<"_";
+
+   //POINTS SECTION
+   out.write((char*)&bytesPoints,bytesPerByteVal);
+   for(int n=0; n<nofNodes; n++)
+   {
+      out.write((char*)&val<1>(nodes[n]),sizeof(float));
+      out.write((char*)&val<2>(nodes[n]),sizeof(float));
+      out.write((char*)&val<3>(nodes[n]),sizeof(float));
+   }
+
+   //CELLS SECTION
+   //cellConnectivity
+   out.write( (char*)&bytesCellConnectivty, bytesPerByteVal );  
+   for(int c=0; c<nofCells; c++) 
+   {
+      out.write( (char*)&val<1>(lines[c]), sizeof(int) );
+      out.write( (char*)&val<2>(lines[c]), sizeof(int) );
+      
+   }
+
+   //cellOffsets
+   out.write( (char*)&bytesCellOffsets, bytesPerByteVal );
+   int itmp;
+   for(int c=1; c<=nofCells; c++)
+   {
+      itmp = 2 * c;    
+      out.write( (char*)&itmp, sizeof(int) );
+   }
+
+   //cellTypes
+   out.write( (char*)&bytesCellTypes, bytesPerByteVal );
+   unsigned char vtkCellType = 3;
+   for(int c=0; c<nofCells; c++)
+   {
+      out.write( (char*)&vtkCellType, sizeof(unsigned char) );
+   }
+   out<<"\n</AppendedData>\n";
+   out<<"</VTKFile>";
+   out<<endl;
+   out.close();
+   UBLOG(logDEBUG1,"WbWriterVtkXmlBinary::writeLines to "<<vtkfilename<<" - end");
+
+   return vtkfilename;
+}
+/*===============================================================================*/
+std::string WbWriterVtkXmlBinary::writeLinesWithNodeData(const string& filename,vector<UbTupleFloat3 >& nodes, vector<UbTupleInt2 >& lines, std::vector< std::string >& datanames, std::vector< std::vector< double > >& nodedata)
+{
+   string vtkfilename = filename+getFileExtension();
+   UBLOG(logDEBUG1,"WbWriterVtkXmlBinary::writeLinesWithNodeData to "<<vtkfilename<<" - start");
+
+   ofstream out(vtkfilename.c_str(),ios::out | ios::binary);
+   if(!out)
+   { 
+      out.clear(); //flags ruecksetzen (ansonsten liefert utern if(!out) weiterhin true!!!
+      string path = UbSystem::getPathFromString(vtkfilename);
+      if(path.size()>0){ UbSystem::makeDirectory(path); out.open(vtkfilename.c_str(),ios::out | ios::binary);}
+      if(!out) throw UbException(UB_EXARGS,"couldn't open file "+vtkfilename);
+   }
+
+   int nofNodes = (int)nodes.size(); 
+   int nofCells = (int)lines.size(); 
+
+   int bytesPerByteVal      = 4; //==sizeof(int)
+   int bytesPoints          = 3 /*x1/x2/x3        */ * nofNodes * sizeof(float);
+   int bytesCellConnectivty = 2 /*nodes per line  */ * nofCells * sizeof(int  );
+   int bytesCellOffsets     = 1 /*offset per line */ * nofCells * sizeof(int  );
+   int bytesCellTypes       = 1 /*type of line    */ * nofCells * sizeof(unsigned char);
+   int bytesScalarData      = 1 /*scalar          */ * nofNodes * sizeof(float); 
+
+   int offset = 0;
+   //VTK FILE
+   out<<"<?xml version=\"1.0\"?>\n";
+   out<<"<VTKFile type=\"UnstructuredGrid\" version=\"0.1\" byte_order=\"LittleEndian\" >"<<"\n";
+   out<<"   <UnstructuredGrid>"<<"\n";
+   out<<"      <Piece NumberOfPoints=\""<<nofNodes<<"\" NumberOfCells=\""<<nofCells<<"\">\n";
+
+   //POINTS SECTION
+   out<<"         <Points>\n"; 
+   out<<"            <DataArray type=\"Float32\" NumberOfComponents=\"3\" format=\"appended\" offset=\""<< offset <<"\"  />\n";
+   out<<"         </Points>\n";
+   offset += (bytesPerByteVal + bytesPoints);
+
+   //CELLS SECTION
+   out<<"         <Cells>\n";
+   out<<"            <DataArray type=\"Int32\" Name=\"connectivity\" format=\"appended\" offset=\""<< offset <<"\" />\n";
+   offset += (bytesPerByteVal + bytesCellConnectivty); 
+   out<<"            <DataArray type=\"Int32\" Name=\"offsets\" format=\"appended\" offset=\""<< offset <<"\" />\n";
+   offset += (bytesPerByteVal + bytesCellOffsets);
+   out<<"            <DataArray type=\"UInt8\" Name=\"types\" format=\"appended\" offset=\""<< offset <<"\" />\n ";
+   offset += (bytesPerByteVal + bytesCellTypes);
+   out<<"         </Cells>\n";
+
+   //DATA SECTION
+   out<<"         <PointData>\n";
+   for(size_t s=0; s<datanames.size(); ++s)
+   {
+      out<< "            <DataArray type=\"Float32\" Name=\""<< datanames[s] <<"\" format=\"appended\" offset=\""<< offset <<"\" /> \n";
+      offset += (bytesPerByteVal + bytesScalarData);
+   }
+   out<<"         </PointData>\n";
+
+   out<<"      </Piece>\n";
+   out<<"   </UnstructuredGrid>\n";
+
+   // AppendedData SECTION
+   out<<"   <AppendedData encoding=\"raw\">\n";
+   out<<"_";
+
+   //POINTS SECTION
+   out.write((char*)&bytesPoints,bytesPerByteVal);
+   for(int n=0; n<nofNodes; n++)
+   {
+      out.write((char*)&val<1>(nodes[n]),sizeof(float));
+      out.write((char*)&val<2>(nodes[n]),sizeof(float));
+      out.write((char*)&val<3>(nodes[n]),sizeof(float));
+   }
+
+   //CELLS SECTION
+   //cellConnectivity
+   out.write( (char*)&bytesCellConnectivty, bytesPerByteVal );  
+   for(int c=0; c<nofCells; c++) 
+   {
+      out.write( (char*)&val<1>(lines[c]), sizeof(int) );
+      out.write( (char*)&val<2>(lines[c]), sizeof(int) );
+   }
+
+   //cellOffsets
+   out.write( (char*)&bytesCellOffsets, bytesPerByteVal );
+   int itmp;
+   for(int c=1; c<=nofCells; c++)
+   {
+      itmp = 3 * c;    
+      out.write( (char*)&itmp, sizeof(int) );
+   }
+
+   //cellTypes
+   out.write( (char*)&bytesCellTypes, bytesPerByteVal );
+   unsigned char vtkCellType = 5;
+   for(int c=0; c<nofCells; c++)
+   {
+      out.write( (char*)&vtkCellType, sizeof(unsigned char) );
+   }
+
+   //DATA SECTION
+   //scalarData
+   for(size_t s=0; s<datanames.size(); ++s)
+   {
+      out.write((char*)&bytesScalarData,bytesPerByteVal);
+      for(size_t d=0; d<nodedata[s].size(); ++d)
+      {
+         //loake kopie machen, da in nodedata "doubles" sind
+         float tmp = (float)nodedata[s][d];
+         out.write((char*)&tmp,sizeof(float));
+      }
+   }
+   out<<"\n</AppendedData>\n";
+   out<<"</VTKFile>";
+   out<<endl;
+   out.close();
+   UBLOG(logDEBUG1,"WbWriterVtkXmlBinary::writeLinesWithNodeData to "<<vtkfilename<<" - end");
+
+   return vtkfilename;
+
+}
+/*===============================================================================*/
+string WbWriterVtkXmlBinary::writeTriangles(const string& filename,vector<UbTupleFloat3 >& nodes, vector<UbTupleInt3 >& triangles)
+{
+   string vtkfilename = filename+getFileExtension();
+   UBLOG(logDEBUG1,"WbWriterVtkXmlBinary::writeTriangles to "<<vtkfilename<<" - start");
+
+   ofstream out(vtkfilename.c_str(),ios::out | ios::binary);
+   if(!out)
+   { 
+      out.clear(); //flags ruecksetzen (ansonsten liefert utern if(!out) weiterhin true!!!
+      string path = UbSystem::getPathFromString(vtkfilename);
+      if(path.size()>0){ UbSystem::makeDirectory(path); out.open(vtkfilename.c_str(),ios::out | ios::binary);}
+      if(!out) throw UbException(UB_EXARGS,"couldn't open file "+vtkfilename);
+   }
+
+
+   int nofNodes = (int)nodes.size(); 
+   int nofCells = (int)triangles.size(); 
+
+   int bytesPerByteVal      = 4; //==sizeof(int)
+   int bytesPoints          = 3 /*x1/x2/x3 - coord    */ * nofNodes * sizeof(float);
+   int bytesCellConnectivty = 3 /*nodes per triangle  */ * nofCells * sizeof(int  );
+   int bytesCellOffsets     = 1 /*offset per triangle */ * nofCells * sizeof(int  );
+   int bytesCellTypes       = 1 /*type of triangle    */ * nofCells * sizeof(unsigned char);
+
+   int offset = 0;
+   //VTK FILE
+   out<<"<?xml version=\"1.0\"?>\n";
+   out<<"<VTKFile type=\"UnstructuredGrid\" version=\"0.1\" byte_order=\"LittleEndian\" >"<<"\n";
+   out<<"   <UnstructuredGrid>"<<"\n";
+   out<<"      <Piece NumberOfPoints=\""<<nofNodes<<"\" NumberOfCells=\""<<nofCells<<"\">\n";
+
+   //POINTS SECTION
+   out<<"         <Points>\n"; 
+   out<<"            <DataArray type=\"Float32\" NumberOfComponents=\"3\" format=\"appended\" offset=\""<< offset <<"\"  />\n";
+   out<<"         </Points>\n";
+   offset += (bytesPerByteVal + bytesPoints);
+
+   //CELLS SECTION
+   out<<"         <Cells>\n";
+   out<<"            <DataArray type=\"Int32\" Name=\"connectivity\" format=\"appended\" offset=\""<< offset <<"\" />\n";
+   offset += (bytesPerByteVal + bytesCellConnectivty); 
+   out<<"            <DataArray type=\"Int32\" Name=\"offsets\" format=\"appended\" offset=\""<< offset <<"\" />\n";
+   offset += (bytesPerByteVal + bytesCellOffsets);
+   out<<"            <DataArray type=\"UInt8\" Name=\"types\" format=\"appended\" offset=\""<< offset <<"\" />\n ";
+   offset += (bytesPerByteVal + bytesCellTypes);
+   out<<"         </Cells>\n";
+
+   out<<"      </Piece>\n";
+   out<<"   </UnstructuredGrid>\n";
+
+   // AppendedData SECTION
+   out<<"   <AppendedData encoding=\"raw\">\n";
+   out<<"_";
+
+   //POINTS SECTION
+   out.write((char*)&bytesPoints,bytesPerByteVal);
+   for(int n=0; n<nofNodes; n++)
+   {
+      out.write((char*)&val<1>(nodes[n]),sizeof(float));
+      out.write((char*)&val<2>(nodes[n]),sizeof(float));
+      out.write((char*)&val<3>(nodes[n]),sizeof(float));
+   }
+
+   //CELLS SECTION
+   //cellConnectivity
+   out.write( (char*)&bytesCellConnectivty, bytesPerByteVal );  
+   for(int c=0; c<nofCells; c++) 
+   {
+      out.write( (char*)&val<1>(triangles[c]), sizeof(int) );
+      out.write( (char*)&val<2>(triangles[c]), sizeof(int) );
+      out.write( (char*)&val<3>(triangles[c]), sizeof(int) );
+   }
+
+   //cellOffsets
+   out.write( (char*)&bytesCellOffsets, bytesPerByteVal );
+   int itmp;
+   for(int c=1; c<=nofCells; c++)
+   {
+      itmp = 3 * c;    
+      out.write( (char*)&itmp, sizeof(int) );
+   }
+
+   //cellTypes
+   out.write( (char*)&bytesCellTypes, bytesPerByteVal );
+   unsigned char vtkCellType = 5;
+   for(int c=0; c<nofCells; c++)
+   {
+      out.write( (char*)&vtkCellType, sizeof(unsigned char) );
+   }
+
+   out<<"\n</AppendedData>\n";
+   out<<"</VTKFile>";
+   out<<endl;
+   out<<flush;
+   out.close();
+   UBLOG(logDEBUG1,"WbWriterVtkXmlBinary::writeTriangles to "<<vtkfilename<<" - end");
+
+   return vtkfilename;
+}
+/*===============================================================================*/
+string WbWriterVtkXmlBinary::writeTrianglesWithNodeData(const string& filename,vector< UbTupleFloat3 >& nodes, vector< UbTupleInt3 >& cells, vector< string >& datanames, vector< vector< double > >& nodedata)
+{
+   string vtkfilename = filename+getFileExtension();
+   UBLOG(logDEBUG1,"WbWriterVtkXmlBinary::writeTrianglesWithNodeData to "<<vtkfilename<<" - start");
+
+   ofstream out(vtkfilename.c_str(),ios::out | ios::binary);
+   if(!out)
+   { 
+      out.clear(); //flags ruecksetzen (ansonsten liefert utern if(!out) weiterhin true!!!
+      string path = UbSystem::getPathFromString(vtkfilename);
+      if(path.size()>0){ UbSystem::makeDirectory(path); out.open(vtkfilename.c_str(),ios::out | ios::binary);}
+      if(!out) throw UbException(UB_EXARGS,"couldn't open file "+vtkfilename);
+   }
+
+   int nofNodes = (int)nodes.size(); 
+   int nofCells = (int)cells.size(); 
+
+   int bytesPerByteVal      = 4; //==sizeof(int)
+   int bytesPoints          = 3 /*x1/x2/x3        */ * nofNodes * sizeof(float);
+   int bytesCellConnectivty = 3 /*nodes per tri   */ * nofCells * sizeof(int  );
+   int bytesCellOffsets     = 1 /*offset per tri  */ * nofCells * sizeof(int  );
+   int bytesCellTypes       = 1 /*type of tri     */ * nofCells * sizeof(unsigned char);
+   int bytesScalarData      = 1 /*scalar          */ * nofNodes * sizeof(float); 
+   
+   int offset = 0;
+   //VTK FILE
+   out<<"<?xml version=\"1.0\"?>\n";
+   out<<"<VTKFile type=\"UnstructuredGrid\" version=\"0.1\" byte_order=\"LittleEndian\" >"<<"\n";
+   out<<"   <UnstructuredGrid>"<<"\n";
+   out<<"      <Piece NumberOfPoints=\""<<nofNodes<<"\" NumberOfCells=\""<<nofCells<<"\">\n";
+
+   //POINTS SECTION
+   out<<"         <Points>\n"; 
+   out<<"            <DataArray type=\"Float32\" NumberOfComponents=\"3\" format=\"appended\" offset=\""<< offset <<"\"  />\n";
+   out<<"         </Points>\n";
+   offset += (bytesPerByteVal + bytesPoints);
+
+   //CELLS SECTION
+   out<<"         <Cells>\n";
+   out<<"            <DataArray type=\"Int32\" Name=\"connectivity\" format=\"appended\" offset=\""<< offset <<"\" />\n";
+   offset += (bytesPerByteVal + bytesCellConnectivty); 
+   out<<"            <DataArray type=\"Int32\" Name=\"offsets\" format=\"appended\" offset=\""<< offset <<"\" />\n";
+   offset += (bytesPerByteVal + bytesCellOffsets);
+   out<<"            <DataArray type=\"UInt8\" Name=\"types\" format=\"appended\" offset=\""<< offset <<"\" />\n ";
+   offset += (bytesPerByteVal + bytesCellTypes);
+   out<<"         </Cells>\n";
+
+   //DATA SECTION
+   out<<"         <PointData>\n";
+   for(size_t s=0; s<datanames.size(); ++s)
+   {
+      out<< "            <DataArray type=\"Float32\" Name=\""<< datanames[s] <<"\" format=\"appended\" offset=\""<< offset <<"\" /> \n";
+      offset += (bytesPerByteVal + bytesScalarData);
+   }
+   out<<"         </PointData>\n";
+
+   out<<"      </Piece>\n";
+   out<<"   </UnstructuredGrid>\n";
+
+   // AppendedData SECTION
+   out<<"   <AppendedData encoding=\"raw\">\n";
+   out<<"_";
+
+   //POINTS SECTION
+   out.write((char*)&bytesPoints,bytesPerByteVal);
+   for(int n=0; n<nofNodes; n++)
+   {
+      out.write((char*)&val<1>(nodes[n]),sizeof(float));
+      out.write((char*)&val<2>(nodes[n]),sizeof(float));
+      out.write((char*)&val<3>(nodes[n]),sizeof(float));
+   }
+
+   //CELLS SECTION
+   //cellConnectivity
+   out.write( (char*)&bytesCellConnectivty, bytesPerByteVal );  
+   for(int c=0; c<nofCells; c++) 
+   {
+      out.write( (char*)&val<1>(cells[c]), sizeof(int) );
+      out.write( (char*)&val<2>(cells[c]), sizeof(int) );
+      out.write( (char*)&val<3>(cells[c]), sizeof(int) );
+   }
+
+   //cellOffsets
+   out.write( (char*)&bytesCellOffsets, bytesPerByteVal );
+   int itmp;
+   for(int c=1; c<=nofCells; c++)
+   {
+      itmp = 3 * c;    
+      out.write( (char*)&itmp, sizeof(int) );
+   }
+
+   //cellTypes
+   out.write( (char*)&bytesCellTypes, bytesPerByteVal );
+   unsigned char vtkCellType = 5;
+   for(int c=0; c<nofCells; c++)
+   {
+      out.write( (char*)&vtkCellType, sizeof(unsigned char) );
+   }
+
+   //DATA SECTION
+   //scalarData
+   for(size_t s=0; s<datanames.size(); ++s)
+   {
+      out.write((char*)&bytesScalarData,bytesPerByteVal);
+      for(size_t d=0; d<nodedata[s].size(); ++d)
+      {
+         //loake kopie machen, da in nodedata "doubles" sind
+         float tmp = (float)nodedata[s][d];
+         out.write((char*)&tmp,sizeof(float));
+      }
+   }
+   out<<"\n</AppendedData>\n";
+   out<<"</VTKFile>";
+   out<<endl;
+   out.close();
+   UBLOG(logDEBUG1,"WbWriterVtkXmlBinary::writeTrianglesWithNodeData to "<<vtkfilename<<" - end");
+
+   return vtkfilename;
+}
+/*===============================================================================*/
+string WbWriterVtkXmlBinary::writeQuads(const string& filename,vector< UbTupleFloat3 >& nodes, vector< UbTupleInt4 >& cells)
+{
+   string vtkfilename = filename+getFileExtension();
+   UBLOG(logDEBUG1,"WbWriterVtkXmlBinary::writeQuads to "<<vtkfilename<<" - start");
+
+   ofstream out(vtkfilename.c_str(),ios::out | ios::binary);
+   if(!out)
+   { 
+      out.clear(); //flags ruecksetzen (ansonsten liefert utern if(!out) weiterhin true!!!
+      string path = UbSystem::getPathFromString(vtkfilename);
+      if(path.size()>0){ UbSystem::makeDirectory(path); out.open(vtkfilename.c_str(),ios::out | ios::binary);}
+      if(!out) throw UbException(UB_EXARGS,"couldn't open file "+vtkfilename);
+   }
+
+   int nofNodes = (int)nodes.size(); 
+   int nofCells = (int)cells.size(); 
+
+   int bytesPerByteVal      = 4; //==sizeof(int)
+   int bytesPoints          = 3 /*x1/x2/x3        */ * nofNodes * sizeof(float);
+   int bytesCellConnectivty = 4 /*nodes per quad  */ * nofCells * sizeof(int  );
+   int bytesCellOffsets     = 1 /*offset per quad */ * nofCells * sizeof(int  );
+   int bytesCellTypes       = 1 /*type of quad    */ * nofCells * sizeof(unsigned char);
+  
+   int offset = 0;
+   //VTK FILE
+   out<<"<?xml version=\"1.0\"?>\n";
+   out<<"<VTKFile type=\"UnstructuredGrid\" version=\"0.1\" byte_order=\"LittleEndian\" >"<<"\n";
+   out<<"   <UnstructuredGrid>"<<"\n";
+   out<<"      <Piece NumberOfPoints=\""<<nofNodes<<"\" NumberOfCells=\""<<nofCells<<"\">\n";
+
+   //POINTS SECTION
+   out<<"         <Points>\n"; 
+   out<<"            <DataArray type=\"Float32\" NumberOfComponents=\"3\" format=\"appended\" offset=\""<< offset <<"\"  />\n";
+   out<<"         </Points>\n";
+   offset += (bytesPerByteVal + bytesPoints);
+
+   //CELLS SECTION
+   out<<"         <Cells>\n";
+   out<<"            <DataArray type=\"Int32\" Name=\"connectivity\" format=\"appended\" offset=\""<< offset <<"\" />\n";
+   offset += (bytesPerByteVal + bytesCellConnectivty); 
+   out<<"            <DataArray type=\"Int32\" Name=\"offsets\" format=\"appended\" offset=\""<< offset <<"\" />\n";
+   offset += (bytesPerByteVal + bytesCellOffsets);
+   out<<"            <DataArray type=\"UInt8\" Name=\"types\" format=\"appended\" offset=\""<< offset <<"\" />\n ";
+   offset += (bytesPerByteVal + bytesCellTypes);
+   out<<"         </Cells>\n";
+
+   out<<"      </Piece>\n";
+   out<<"   </UnstructuredGrid>\n";
+
+   // AppendedData SECTION
+   out<<"   <AppendedData encoding=\"raw\">\n";
+   out<<"_";
+
+   //POINTS SECTION
+   out.write((char*)&bytesPoints,bytesPerByteVal);
+   for(int n=0; n<nofNodes; n++)
+   {
+      out.write((char*)&val<1>(nodes[n]),sizeof(float));
+      out.write((char*)&val<2>(nodes[n]),sizeof(float));
+      out.write((char*)&val<3>(nodes[n]),sizeof(float));
+   }
+
+   //CELLS SECTION
+   //cellConnectivity
+   out.write( (char*)&bytesCellConnectivty, bytesPerByteVal );  
+   for(int c=0; c<nofCells; c++) 
+   {
+      out.write( (char*)&val<1>(cells[c]), sizeof(int) );
+      out.write( (char*)&val<2>(cells[c]), sizeof(int) );
+      out.write( (char*)&val<4>(cells[c]), sizeof(int) );
+      out.write( (char*)&val<3>(cells[c]), sizeof(int) );
+   }
+
+   //cellOffsets
+   out.write( (char*)&bytesCellOffsets, bytesPerByteVal );
+   int itmp;
+   for(int c=1; c<=nofCells; c++)
+   {
+      itmp = 4 * c;    
+      out.write( (char*)&itmp, sizeof(int) );
+   }
+
+   //cellTypes
+   out.write( (char*)&bytesCellTypes, bytesPerByteVal );
+   unsigned char vtkCellType = 8;
+   for(int c=0; c<nofCells; c++)
+   {
+      out.write( (char*)&vtkCellType, sizeof(unsigned char) );
+   }
+   out<<"\n</AppendedData>\n";
+   out<<"</VTKFile>";
+   out<<endl;
+   out<<flush;
+   out.close();
+   UBLOG(logDEBUG1,"WbWriterVtkXmlBinary::writeQuads to "<<vtkfilename<<" - end");
+
+   return vtkfilename;
+}
+/*===============================================================================*/
+string WbWriterVtkXmlBinary::writeQuadsWithNodeData(const string& filename,vector< UbTupleFloat3 >& nodes, vector< UbTupleInt4 >& cells, vector< string >& datanames, vector< vector< double > >& nodedata)
+{
+   string vtkfilename = filename+getFileExtension();
+   UBLOG(logDEBUG1,"WbWriterVtkXmlBinary::writeQuadsWithNodeData to "<<vtkfilename<<" - start");
+
+   ofstream out(vtkfilename.c_str(),ios::out | ios::binary);
+   if(!out)
+   { 
+      out.clear(); //flags ruecksetzen (ansonsten liefert utern if(!out) weiterhin true!!!
+      string path = UbSystem::getPathFromString(vtkfilename);
+      if(path.size()>0){ UbSystem::makeDirectory(path); out.open(vtkfilename.c_str(),ios::out | ios::binary);}
+      if(!out) throw UbException(UB_EXARGS,"couldn't open file "+vtkfilename);
+   }
+
+   int nofNodes = (int)nodes.size(); 
+   int nofCells = (int)cells.size(); 
+
+   int bytesPerByteVal      = 4; //==sizeof(int)
+   int bytesPoints          = 3 /*x1/x2/x3        */ * nofNodes * sizeof(float);
+   int bytesCellConnectivty = 4 /*nodes per quad  */ * nofCells * sizeof(int  );
+   int bytesCellOffsets     = 1 /*offset per quad */ * nofCells * sizeof(int  );
+   int bytesCellTypes       = 1 /*type of quad    */ * nofCells * sizeof(unsigned char);
+   int bytesScalarData      = 1 /*scalar          */ * nofNodes * sizeof(float); 
+
+   int offset = 0;
+   //VTK FILE
+   out<<"<?xml version=\"1.0\"?>\n";
+   out<<"<VTKFile type=\"UnstructuredGrid\" version=\"0.1\" byte_order=\"LittleEndian\" >"<<"\n";
+   out<<"   <UnstructuredGrid>"<<"\n";
+   out<<"      <Piece NumberOfPoints=\""<<nofNodes<<"\" NumberOfCells=\""<<nofCells<<"\">\n";
+
+   //POINTS SECTION
+   out<<"         <Points>\n"; 
+   out<<"            <DataArray type=\"Float32\" NumberOfComponents=\"3\" format=\"appended\" offset=\""<< offset <<"\"  />\n";
+   out<<"         </Points>\n";
+   offset += (bytesPerByteVal + bytesPoints);
+
+   //CELLS SECTION
+   out<<"         <Cells>\n";
+   out<<"            <DataArray type=\"Int32\" Name=\"connectivity\" format=\"appended\" offset=\""<< offset <<"\" />\n";
+   offset += (bytesPerByteVal + bytesCellConnectivty); 
+   out<<"            <DataArray type=\"Int32\" Name=\"offsets\" format=\"appended\" offset=\""<< offset <<"\" />\n";
+   offset += (bytesPerByteVal + bytesCellOffsets);
+   out<<"            <DataArray type=\"UInt8\" Name=\"types\" format=\"appended\" offset=\""<< offset <<"\" />\n ";
+   offset += (bytesPerByteVal + bytesCellTypes);
+   out<<"         </Cells>\n";
+
+   //DATA SECTION
+   out<<"         <PointData>\n";
+   for(size_t s=0; s<datanames.size(); ++s)
+   {
+      out<< "            <DataArray type=\"Float64\" Name=\""<< datanames[s] <<"\" format=\"appended\" offset=\""<< offset <<"\" /> \n";
+      offset += (bytesPerByteVal + bytesScalarData);
+   }
+   out<<"         </PointData>\n";
+
+   out<<"      </Piece>\n";
+   out<<"   </UnstructuredGrid>\n";
+
+   // AppendedData SECTION
+   out<<"   <AppendedData encoding=\"raw\">\n";
+   out<<"_";
+
+   //POINTS SECTION
+   out.write((char*)&bytesPoints,bytesPerByteVal);
+   for(int n=0; n<nofNodes; n++)
+   {
+      out.write((char*)&val<1>(nodes[n]),sizeof(float));
+      out.write((char*)&val<2>(nodes[n]),sizeof(float));
+      out.write((char*)&val<3>(nodes[n]),sizeof(float));
+   }
+
+   //CELLS SECTION
+   //cellConnectivity
+   out.write( (char*)&bytesCellConnectivty, bytesPerByteVal );  
+   for(int c=0; c<nofCells; c++) 
+   {
+      out.write( (char*)&val<1>(cells[c]), sizeof(int) );
+      out.write( (char*)&val<2>(cells[c]), sizeof(int) );
+      out.write( (char*)&val<4>(cells[c]), sizeof(int) );
+      out.write( (char*)&val<3>(cells[c]), sizeof(int) );
+   }
+
+   //cellOffsets
+   out.write( (char*)&bytesCellOffsets, bytesPerByteVal );
+   int itmp;
+   for(int c=1; c<=nofCells; c++)
+   {
+      itmp = 4 * c;    
+      out.write( (char*)&itmp, sizeof(int) );
+   }
+
+   //cellTypes
+   out.write( (char*)&bytesCellTypes, bytesPerByteVal );
+   unsigned char vtkCellType = 8;
+   for(int c=0; c<nofCells; c++)
+   {
+      out.write( (char*)&vtkCellType, sizeof(unsigned char) );
+   }
+
+   //DATA SECTION
+   //scalarData
+   for(size_t s=0; s<datanames.size(); ++s)
+   {
+      out.write((char*)&bytesScalarData,bytesPerByteVal);
+      for(size_t d=0; d<nodedata[s].size(); ++d)
+      {
+         //loake kopie machen, da in nodedata "doubles" sind
+         float tmp = (float)nodedata[s][d];
+         out.write((char*)&tmp,sizeof(float));
+      }
+   }
+   out<<"\n</AppendedData>\n";
+   out<<"</VTKFile>";
+   out<<endl;
+   out.close();
+   UBLOG(logDEBUG1,"WbWriterVtkXmlBinary::writeQuadsWithNodeData to "<<vtkfilename<<" - end");
+
+   return vtkfilename;
+}
+/*===============================================================================*/
+string WbWriterVtkXmlBinary::writeQuadsWithCellData(const string& filename,vector< UbTupleFloat3 >& nodes, vector< UbTupleInt4 >& cells, vector< string >& datanames, vector< vector< double > >& celldata)
+{
+   string vtkfilename = filename+getFileExtension();
+   UBLOG(logDEBUG1,"WbWriterVtkXmlBinary::writeQuadsWithCellData to "<<vtkfilename<<" - start");
+
+   ofstream out(vtkfilename.c_str(),ios::out | ios::binary);
+   if(!out)
+   { 
+      out.clear(); //flags ruecksetzen (ansonsten liefert utern if(!out) weiterhin true!!!
+      string path = UbSystem::getPathFromString(vtkfilename);
+      if(path.size()>0){ UbSystem::makeDirectory(path); out.open(vtkfilename.c_str(),ios::out | ios::binary);}
+      if(!out) throw UbException(UB_EXARGS,"couldn't open file "+vtkfilename);
+   }
+
+   int nofNodes = (int)nodes.size(); 
+   int nofCells = (int)cells.size(); 
+
+   int bytesPerByteVal      = 4; //==sizeof(int)
+   int bytesPoints          = 3 /*x1/x2/x3        */ * nofNodes * sizeof(float);
+   int bytesCellConnectivty = 4 /*nodes per quad  */ * nofCells * sizeof(int  );
+   int bytesCellOffsets     = 1 /*offset per quad */ * nofCells * sizeof(int  );
+   int bytesCellTypes       = 1 /*type of quad    */ * nofCells * sizeof(unsigned char);
+   int bytesScalarData      = 1 /*scalar          */ * nofCells * sizeof(float); 
+
+   int offset = 0;
+   //VTK FILE
+   out<<"<?xml version=\"1.0\"?>\n";
+   out<<"<VTKFile type=\"UnstructuredGrid\" version=\"0.1\" byte_order=\"LittleEndian\" >"<<"\n";
+   out<<"   <UnstructuredGrid>"<<"\n";
+   out<<"      <Piece NumberOfPoints=\""<<nofNodes<<"\" NumberOfCells=\""<<nofCells<<"\">\n";
+
+   //POINTS SECTION
+   out<<"         <Points>\n"; 
+   out<<"            <DataArray type=\"Float32\" NumberOfComponents=\"3\" format=\"appended\" offset=\""<< offset <<"\"  />\n";
+   out<<"         </Points>\n";
+   offset += (bytesPerByteVal + bytesPoints);
+
+   //CELLS SECTION
+   out<<"         <Cells>\n";
+   out<<"            <DataArray type=\"Int32\" Name=\"connectivity\" format=\"appended\" offset=\""<< offset <<"\" />\n";
+   offset += (bytesPerByteVal + bytesCellConnectivty); 
+   out<<"            <DataArray type=\"Int32\" Name=\"offsets\" format=\"appended\" offset=\""<< offset <<"\" />\n";
+   offset += (bytesPerByteVal + bytesCellOffsets);
+   out<<"            <DataArray type=\"UInt8\" Name=\"types\" format=\"appended\" offset=\""<< offset <<"\" />\n ";
+   offset += (bytesPerByteVal + bytesCellTypes);
+   out<<"         </Cells>\n";
+
+   //DATA SECTION
+   out<<"         <CellData>\n";
+   for(size_t s=0; s<datanames.size(); ++s)
+   {
+      out<< "            <DataArray type=\"Float32\" Name=\""<< datanames[s] <<"\" format=\"appended\" offset=\""<< offset <<"\" /> \n";
+      offset += (bytesPerByteVal + bytesScalarData);
+   }
+   out<<"         </CellData>\n";
+
+   out<<"      </Piece>\n";
+   out<<"   </UnstructuredGrid>\n";
+
+   // AppendedData SECTION
+   out<<"   <AppendedData encoding=\"raw\">\n";
+   out<<"_";
+
+   //POINTS SECTION
+   out.write((char*)&bytesPoints,bytesPerByteVal);
+   for(int n=0; n<nofNodes; n++)
+   {
+      out.write((char*)&val<1>(nodes[n]),sizeof(float));
+      out.write((char*)&val<2>(nodes[n]),sizeof(float));
+      out.write((char*)&val<3>(nodes[n]),sizeof(float));
+   }
+
+   //CELLS SECTION
+   //cellConnectivity
+   out.write( (char*)&bytesCellConnectivty, bytesPerByteVal );  
+   for(int c=0; c<nofCells; c++) 
+   {
+      out.write( (char*)&val<1>(cells[c]), sizeof(int) );
+      out.write( (char*)&val<2>(cells[c]), sizeof(int) );
+      out.write( (char*)&val<4>(cells[c]), sizeof(int) );
+      out.write( (char*)&val<3>(cells[c]), sizeof(int) );
+   }
+
+   //cellOffsets
+   out.write( (char*)&bytesCellOffsets, bytesPerByteVal );
+   int itmp;
+   for(int c=1; c<=nofCells; c++)
+   {
+      itmp = 4 * c;    
+      out.write( (char*)&itmp, sizeof(int) );
+   }
+
+   //cellTypes
+   out.write( (char*)&bytesCellTypes, bytesPerByteVal );
+   unsigned char vtkCellType = 8;
+   for(int c=0; c<nofCells; c++)
+   {
+      out.write( (char*)&vtkCellType, sizeof(unsigned char) );
+   }
+
+   //DATA SECTION
+   //scalarData
+   for(size_t s=0; s<datanames.size(); ++s)
+   {
+      out.write((char*)&bytesScalarData,bytesPerByteVal);
+      for(size_t d=0; d<celldata[s].size(); ++d)
+      {
+         //loake kopie machen, da in celldata "doubles" sind
+         float tmp = (float)celldata[s][d];
+         out.write((char*)&tmp,sizeof(float));
+      }
+   }
+
+   out<<"\n</AppendedData>\n";
+
+   out<<"</VTKFile>";
+   out<<endl;
+   out.close();
+   UBLOG(logDEBUG1,"WbWriterVtkXmlBinary::writeQuadsWithCellData to "<<vtkfilename<<" - end");
+
+   return vtkfilename;
+}
+/*===============================================================================*/
+string WbWriterVtkXmlBinary::writeQuadsWithNodeAndCellData(const string& filename,vector< UbTupleFloat3 >& nodes, vector< UbTupleInt4 >& cells, 
+                                                                vector< string >& nodedatanames, vector< vector< double > >& nodedata, vector< string >& celldatanames,
+                                                                vector< vector< double > >& celldata                                                                    )
+{
+   string vtkfilename = filename+getFileExtension();
+   UBLOG(logDEBUG1,"WbWriterVtkXmlBinary::writeQuadsWithNodeAndCellData to "<<vtkfilename<<" - start");
+
+   ofstream out(vtkfilename.c_str(),ios::out | ios::binary);
+   if(!out)
+   { 
+      out.clear(); //flags ruecksetzen (ansonsten liefert utern if(!out) weiterhin true!!!
+      string path = UbSystem::getPathFromString(vtkfilename);
+      if(path.size()>0){ UbSystem::makeDirectory(path); out.open(vtkfilename.c_str(),ios::out | ios::binary);}
+      if(!out) throw UbException(UB_EXARGS,"couldn't open file "+vtkfilename);
+   }
+
+   int nofNodes = (int)nodes.size(); 
+   int nofCells = (int)cells.size(); 
+
+   int bytesPerByteVal      = 4; //==sizeof(int)
+   int bytesPoints          = 3 /*x1/x2/x3        */ * nofNodes * sizeof(float);
+   int bytesCellConnectivty = 4 /*nodes per quad  */ * nofCells * sizeof(int  );
+   int bytesCellOffsets     = 1 /*offset per quad */ * nofCells * sizeof(int  );
+   int bytesCellTypes       = 1 /*type of quad    */ * nofCells * sizeof(unsigned char);
+   int bytesScalarDataPoint = 1 /*scalar          */ * nofNodes * sizeof(float); 
+   int bytesScalarDataCell  = 1 /*scalar          */ * nofCells * sizeof(float); 
+
+   int offset = 0;
+   //VTK FILE
+   out<<"<?xml version=\"1.0\"?>\n";
+   out<<"<VTKFile type=\"UnstructuredGrid\" version=\"0.1\" byte_order=\"LittleEndian\" >"<<"\n";
+   out<<"   <UnstructuredGrid>"<<"\n";
+   out<<"      <Piece NumberOfPoints=\""<<nofNodes<<"\" NumberOfCells=\""<<nofCells<<"\">\n";
+
+   //POINTS SECTION
+   out<<"         <Points>\n"; 
+   out<<"            <DataArray type=\"Float32\" NumberOfComponents=\"3\" format=\"appended\" offset=\""<< offset <<"\"  />\n";
+   out<<"         </Points>\n";
+   offset += (bytesPerByteVal + bytesPoints);
+
+   //CELLS SECTION
+   out<<"         <Cells>\n";
+   out<<"            <DataArray type=\"Int32\" Name=\"connectivity\" format=\"appended\" offset=\""<< offset <<"\" />\n";
+   offset += (bytesPerByteVal + bytesCellConnectivty); 
+   out<<"            <DataArray type=\"Int32\" Name=\"offsets\" format=\"appended\" offset=\""<< offset <<"\" />\n";
+   offset += (bytesPerByteVal + bytesCellOffsets);
+   out<<"            <DataArray type=\"UInt8\" Name=\"types\" format=\"appended\" offset=\""<< offset <<"\" />\n ";
+   offset += (bytesPerByteVal + bytesCellTypes);
+   out<<"         </Cells>\n";
+
+   // Point DATA SECTION
+   out<<"         <PointData>\n";
+   for(size_t s=0; s<nodedatanames.size(); ++s)
+   {
+      out<< "            <DataArray type=\"Float32\" Name=\""<< nodedatanames[s] <<"\" format=\"appended\" offset=\""<< offset <<"\" /> \n";
+      offset += (bytesPerByteVal + bytesScalarDataPoint);
+   }
+   out<<"         </PointData>\n";
+
+
+   // Cell DATA SECTION
+   out<<"         <CellData>\n";
+   for(size_t s=0; s<celldatanames.size(); ++s)
+   {
+      out<< "            <DataArray type=\"Float32\" Name=\""<< celldatanames[s] <<"\" format=\"appended\" offset=\""<< offset <<"\" /> \n";
+      offset += (bytesPerByteVal + bytesScalarDataCell);
+   }
+   out<<"         </CellData>\n";
+   out<<"      </Piece>\n";
+   out<<"   </UnstructuredGrid>\n";
+
+   // AppendedData SECTION
+   out<<"   <AppendedData encoding=\"raw\">\n";
+   out<<"_";
+
+   //POINTS SECTION
+   out.write((char*)&bytesPoints,bytesPerByteVal);
+   for(int n=0; n<nofNodes; n++)
+   {
+      out.write((char*)&val<1>(nodes[n]),sizeof(float));
+      out.write((char*)&val<2>(nodes[n]),sizeof(float));
+      out.write((char*)&val<3>(nodes[n]),sizeof(float));
+   }
+
+   //CELLS SECTION
+   //cellConnectivity
+   out.write( (char*)&bytesCellConnectivty, bytesPerByteVal );  
+   for(int c=0; c<nofCells; c++) 
+   {
+      out.write( (char*)&val<1>(cells[c]), sizeof(int) );
+      out.write( (char*)&val<2>(cells[c]), sizeof(int) );
+      out.write( (char*)&val<4>(cells[c]), sizeof(int) );
+      out.write( (char*)&val<3>(cells[c]), sizeof(int) );
+   }
+
+   //cellOffsets
+   out.write( (char*)&bytesCellOffsets, bytesPerByteVal );
+   int itmp;
+   for(int c=1; c<=nofCells; c++)
+   {
+      itmp = 4 * c;    
+      out.write( (char*)&itmp, sizeof(int) );
+   }
+
+   //cellTypes
+   out.write( (char*)&bytesCellTypes, bytesPerByteVal );
+   unsigned char vtkCellType = 8;
+   for(int c=0; c<nofCells; c++)
+   {
+      out.write( (char*)&vtkCellType, sizeof(unsigned char) );
+   }
+
+   //Point DATA SECTION
+   //scalarData
+   for(size_t s=0; s<nodedatanames.size(); ++s)
+   {
+      out.write((char*)&bytesScalarDataPoint,bytesPerByteVal);
+      for(size_t d=0; d<nodedata[s].size(); ++d)
+      {
+         //loake kopie machen, da in nodedata "doubles" sind
+         float tmp = (float)nodedata[s][d];
+         out.write((char*)&tmp,sizeof(float));
+      }
+   }
+   //Cell DATA SECTION
+   //scalarData
+   for(size_t s=0; s<celldatanames.size(); ++s)
+   {
+      out.write((char*)&bytesScalarDataCell,bytesPerByteVal);
+      for(size_t d=0; d<celldata[s].size(); ++d)
+      {
+         //loake kopie machen, da in celldata "doubles" sind
+         float tmp = (float)celldata[s][d];
+         out.write((char*)&tmp,sizeof(float));
+      }
+   }
+   out<<"\n</AppendedData>\n";
+   out<<"</VTKFile>";
+   out<<endl;
+   out.close();
+   UBLOG(logDEBUG1,"WbWriterVtkXmlBinary::writeQuadsWithNodeAndCellData to "<<vtkfilename<<" - end");
+
+   return vtkfilename;
+}
+/*===============================================================================*/
+string WbWriterVtkXmlBinary::writeOctsWithCellData(const string& filename,vector<UbTupleFloat3 >& nodes, vector<UbTupleInt8 >& cells, vector<string >& datanames, vector<vector<double > >& celldata)
+{
+   string vtkfilename = filename+getFileExtension();
+   UBLOG(logDEBUG1,"WbWriterVtkXmlBinary::writeOctsWithCellData to "<<vtkfilename<<" - start");
+
+   ofstream out(vtkfilename.c_str(),ios::out | ios::binary);
+   if(!out)
+   { 
+      out.clear(); //flags ruecksetzen (ansonsten liefert utern if(!out) weiterhin true!!!
+      string path = UbSystem::getPathFromString(vtkfilename);
+      if(path.size()>0){ UbSystem::makeDirectory(path); out.open(vtkfilename.c_str(),ios::out | ios::binary);}
+      if(!out) throw UbException(UB_EXARGS,"couldn't open file "+vtkfilename);
+   }
+
+   int nofNodes = (int)nodes.size(); 
+   int nofCells = (int)cells.size(); 
+
+   int bytesPerByteVal      = 4; //==sizeof(int)
+   int bytesPoints          = 3 /*x1/x2/x3      */ * nofNodes * sizeof(float);
+   int bytesCellConnectivty = 8 /*nodes per oct */ * nofCells * sizeof(int  );
+   int bytesCellOffsets     = 1 /*offset per oct*/ * nofCells * sizeof(int  );
+   int bytesCellTypes       = 1 /*type of oct   */ * nofCells * sizeof(unsigned char);
+   int bytesScalarData      = 1 /*scalar        */ * nofCells * sizeof(float); 
+
+   int offset = 0;
+   //VTK FILE
+   out<<"<?xml version=\"1.0\"?>\n";
+   out<<"<VTKFile type=\"UnstructuredGrid\" version=\"0.1\" byte_order=\"LittleEndian\" >"<<"\n";
+   out<<"   <UnstructuredGrid>"<<"\n";
+   out<<"      <Piece NumberOfPoints=\""<<nofNodes<<"\" NumberOfCells=\""<<nofCells<<"\">\n";
+
+   //POINTS SECTION
+   out<<"         <Points>\n"; 
+   out<<"            <DataArray type=\"Float32\" NumberOfComponents=\"3\" format=\"appended\" offset=\""<< offset <<"\"  />\n";
+   out<<"         </Points>\n";
+   offset += (bytesPerByteVal + bytesPoints);
+
+   //CELLS SECTION
+   out<<"         <Cells>\n";
+   out<<"            <DataArray type=\"Int32\" Name=\"connectivity\" format=\"appended\" offset=\""<< offset <<"\" />\n";
+   offset += (bytesPerByteVal + bytesCellConnectivty); 
+   out<<"            <DataArray type=\"Int32\" Name=\"offsets\" format=\"appended\" offset=\""<< offset <<"\" />\n";
+   offset += (bytesPerByteVal + bytesCellOffsets);
+   out<<"            <DataArray type=\"UInt8\" Name=\"types\" format=\"appended\" offset=\""<< offset <<"\" />\n ";
+   offset += (bytesPerByteVal + bytesCellTypes);
+   out<<"         </Cells>\n";
+
+   //DATA SECTION
+   out<<"         <CellData>\n";
+   for(size_t s=0; s<datanames.size(); ++s)
+   {
+      out<< "            <DataArray type=\"Float32\" Name=\""<< datanames[s] <<"\" format=\"appended\" offset=\""<< offset <<"\" /> \n";
+      offset += (bytesPerByteVal + bytesScalarData);
+   }
+   out<<"         </CellData>\n";
+
+   out<<"      </Piece>\n";
+   out<<"   </UnstructuredGrid>\n";
+
+   // AppendedData SECTION
+   out<<"   <AppendedData encoding=\"raw\">\n";
+   out<<"_";
+
+   //POINTS SECTION
+   out.write((char*)&bytesPoints,bytesPerByteVal);
+   for(int n=0; n<nofNodes; n++)
+   {
+      out.write((char*)&val<1>(nodes[n]),sizeof(float));
+      out.write((char*)&val<2>(nodes[n]),sizeof(float));
+      out.write((char*)&val<3>(nodes[n]),sizeof(float));
+   }
+
+   //CELLS SECTION
+   //cellConnectivity
+   out.write( (char*)&bytesCellConnectivty, bytesPerByteVal );  
+   for(int c=0; c<nofCells; c++) 
+   {
+      out.write( (char*)&val<1>(cells[c]), sizeof(int) );
+      out.write( (char*)&val<2>(cells[c]), sizeof(int) );
+      out.write( (char*)&val<4>(cells[c]), sizeof(int) );
+      out.write( (char*)&val<3>(cells[c]), sizeof(int) );
+      out.write( (char*)&val<5>(cells[c]), sizeof(int) );
+      out.write( (char*)&val<6>(cells[c]), sizeof(int) );
+      out.write( (char*)&val<8>(cells[c]), sizeof(int) );
+      out.write( (char*)&val<7>(cells[c]), sizeof(int) );
+   }
+
+   //cellOffsets
+   out.write( (char*)&bytesCellOffsets, bytesPerByteVal );
+   int itmp;
+   for(int c=1; c<=nofCells; c++)
+   {
+      itmp = 8 * c;    
+      out.write( (char*)&itmp, sizeof(int) );
+   }
+
+   //cellTypes
+   out.write( (char*)&bytesCellTypes, bytesPerByteVal );
+   unsigned char vtkCellType = 11;
+   for(int c=0; c<nofCells; c++)
+   {
+      out.write( (char*)&vtkCellType, sizeof(unsigned char) );
+   }
+
+   //DATA SECTION
+   //scalarData
+   for(size_t s=0; s<datanames.size(); ++s)
+   {
+      out.write((char*)&bytesScalarData,bytesPerByteVal);
+      for(size_t d=0; d<celldata[s].size(); ++d)
+      {
+         //loake kopie machen, da in celldata "doubles" sind
+         float tmp = (float)celldata[s][d];
+         out.write((char*)&tmp,sizeof(float));
+      }
+   }
+   out<<"\n</AppendedData>\n";
+   out<<"</VTKFile>";
+   out<<endl;
+   out.close();
+   UBLOG(logDEBUG1,"WbWriterVtkXmlBinary::writeOctsWithCellData to "<<vtkfilename<<" - end");
+
+   return vtkfilename;
+}
+/*===============================================================================*/
+string WbWriterVtkXmlBinary::writeOctsWithNodeData(const string& filename,vector<UbTupleFloat3 >& nodes, vector<UbTupleInt8 >& cells, vector<string >& datanames, vector<vector<double > >& nodedata)
+{
+   string vtkfilename = filename+getFileExtension();
+   UBLOG(logDEBUG1,"WbWriterVtkXmlBinary::writeOctsWithNodeData to "<<vtkfilename<<" - start");
+
+   ofstream out(vtkfilename.c_str(),ios::out | ios::binary);
+   if(!out)
+   { 
+      out.clear(); //flags ruecksetzen (ansonsten liefert utern if(!out) weiterhin true!!!
+      string path = UbSystem::getPathFromString(vtkfilename);
+      if(path.size()>0){ UbSystem::makeDirectory(path); out.open(vtkfilename.c_str(),ios::out | ios::binary);}
+      if(!out) throw UbException(UB_EXARGS,"couldn't open file "+vtkfilename);
+   }
+
+   int nofNodes = (int)nodes.size(); 
+   int nofCells = (int)cells.size(); 
+
+   int bytesPerByteVal      = 4; //==sizeof(int)
+   int bytesPoints          = 3 /*x1/x2/x3      */ * nofNodes * sizeof(float);
+   int bytesCellConnectivty = 8 /*nodes per oct */ * nofCells * sizeof(int  );
+   int bytesCellOffsets     = 1 /*offset per oct*/ * nofCells * sizeof(int  );
+   int bytesCellTypes       = 1 /*type of oct   */ * nofCells * sizeof(unsigned char);
+   int bytesScalarData      = 1 /*scalar        */ * nofNodes * sizeof(double); 
+
+   unsigned long long offset = 0;
+   //VTK FILE
+   out<<"<?xml version=\"2.0\"?>\n";
+   out<<"<VTKFile type=\"UnstructuredGrid\" version=\"0.1\" byte_order=\"LittleEndian\" >"<<"\n";
+   out<<"   <UnstructuredGrid>"<<"\n";
+   out<<"      <Piece NumberOfPoints=\""<<nofNodes<<"\" NumberOfCells=\""<<nofCells<<"\">\n";
+
+   //POINTS SECTION
+   out<<"         <Points>\n"; 
+   out<<"            <DataArray type=\"Float32\" NumberOfComponents=\"3\" format=\"appended\" offset=\""<< offset <<"\"  />\n";
+   out<<"         </Points>\n";
+   offset += (bytesPerByteVal + bytesPoints);
+
+   //CELLS SECTION
+   out<<"         <Cells>\n";
+   out<<"            <DataArray type=\"Int32\" Name=\"connectivity\" format=\"appended\" offset=\""<< offset <<"\" />\n";
+   offset += (bytesPerByteVal + bytesCellConnectivty); 
+   out<<"            <DataArray type=\"Int32\" Name=\"offsets\" format=\"appended\" offset=\""<< offset <<"\" />\n";
+   offset += (bytesPerByteVal + bytesCellOffsets);
+   out<<"            <DataArray type=\"UInt8\" Name=\"types\" format=\"appended\" offset=\""<< offset <<"\" />\n ";
+   offset += (bytesPerByteVal + bytesCellTypes);
+   out<<"         </Cells>\n";
+
+   //DATA SECTION
+   out<<"         <PointData>\n";
+   for(size_t s=0; s<datanames.size(); ++s)
+   {
+      out<< "            <DataArray type=\"Float64\" Name=\""<< datanames[s] <<"\" format=\"appended\" offset=\""<< offset <<"\" /> \n";
+      offset += (bytesPerByteVal + bytesScalarData);
+   }
+   out<<"         </PointData>\n";
+
+   out<<"      </Piece>\n";
+   out<<"   </UnstructuredGrid>\n";
+
+   // AppendedData SECTION
+   out<<"   <AppendedData encoding=\"raw\">\n";
+   out<<"_";
+
+   //POINTS SECTION
+   out.write((char*)&bytesPoints,bytesPerByteVal);
+   for(int n=0; n<nofNodes; n++)
+   {
+      out.write((char*)&val<1>(nodes[n]),sizeof(float));
+      out.write((char*)&val<2>(nodes[n]),sizeof(float));
+      out.write((char*)&val<3>(nodes[n]),sizeof(float));
+   }
+
+   //CELLS SECTION
+   //cellConnectivity
+   out.write( (char*)&bytesCellConnectivty, bytesPerByteVal );  
+   for(int c=0; c<nofCells; c++) 
+   {
+      out.write( (char*)&val<1>(cells[c]), sizeof(int) );
+      out.write( (char*)&val<2>(cells[c]), sizeof(int) );
+      out.write( (char*)&val<4>(cells[c]), sizeof(int) );
+      out.write( (char*)&val<3>(cells[c]), sizeof(int) );
+      out.write( (char*)&val<5>(cells[c]), sizeof(int) );
+      out.write( (char*)&val<6>(cells[c]), sizeof(int) );
+      out.write( (char*)&val<8>(cells[c]), sizeof(int) );
+      out.write( (char*)&val<7>(cells[c]), sizeof(int) );
+   }
+
+   //cellOffsets
+   out.write( (char*)&bytesCellOffsets, bytesPerByteVal );
+   int itmp;
+   for(int c=1; c<=nofCells; c++)
+   {
+      itmp = 8 * c;    
+      out.write( (char*)&itmp, sizeof(int) );
+   }
+
+   //cellTypes
+   out.write( (char*)&bytesCellTypes, bytesPerByteVal );
+   unsigned char vtkCellType = 11;
+   for(int c=0; c<nofCells; c++)
+   {
+      out.write( (char*)&vtkCellType, sizeof(unsigned char) );
+   }
+
+   //DATA SECTION
+   //scalarData
+   for(size_t s=0; s<datanames.size(); ++s)
+   {
+      out.write((char*)&bytesScalarData,bytesPerByteVal);
+      for(size_t d=0; d<nodedata[s].size(); ++d)
+      {
+         //loake kopie machen, da in nodedata "doubles" sind
+         //float tmp = (float)nodedata[s][d];
+         //out.write((char*)&tmp,sizeof(float));
+         double tmp = nodedata[s][d];
+         out.write((char*)&tmp,sizeof(double));
+      }
+   }
+   out<<"\n</AppendedData>\n";
+   out<<"</VTKFile>";
+   out<<endl;
+   out.close();
+   UBLOG(logDEBUG1,"WbWriterVtkXmlBinary::writeOctsWithNodeData to "<<vtkfilename<<" - end");
+
+   return vtkfilename;
+}
+/*===============================================================================*/
+string WbWriterVtkXmlBinary::writeOcts(const string& filename,vector< UbTupleFloat3 >& nodes, vector< UbTupleInt8 >& cells)
+{
+   string vtkfilename = filename+getFileExtension();
+   UBLOG(logDEBUG1,"WbWriterVtkXmlBinary::writeOcts to "<<vtkfilename<<" - start");
+
+   ofstream out(vtkfilename.c_str(),ios::out | ios::binary);
+   if(!out)
+   { 
+      out.clear(); //flags ruecksetzen (ansonsten liefert utern if(!out) weiterhin true!!!
+      string path = UbSystem::getPathFromString(vtkfilename);
+      if(path.size()>0){ UbSystem::makeDirectory(path); out.open(vtkfilename.c_str(),ios::out | ios::binary);}
+      if(!out) throw UbException(UB_EXARGS,"couldn't open file "+vtkfilename);
+   }
+
+   int nofNodes = (int)nodes.size(); 
+   int nofCells = (int)cells.size(); 
+
+   int bytesPerByteVal      = 4; //==sizeof(int)
+   int bytesPoints          = 3 /*x1/x2/x3      */ * nofNodes * sizeof(float);
+   int bytesCellConnectivty = 8 /*nodes per oct */ * nofCells * sizeof(int  );
+   int bytesCellOffsets     = 1 /*offset per oct*/ * nofCells * sizeof(int  );
+   int bytesCellTypes       = 1 /*type of oct   */ * nofCells * sizeof(unsigned char);
+   //int bytesScalarData      = 1 /*scalar        */ * nofNodes * sizeof(float); 
+
+   int offset = 0;
+   //VTK FILE
+   out<<"<?xml version=\"1.0\"?>\n";
+   out<<"<VTKFile type=\"UnstructuredGrid\" version=\"0.1\" byte_order=\"LittleEndian\" >"<<"\n";
+   out<<"   <UnstructuredGrid>"<<"\n";
+   out<<"      <Piece NumberOfPoints=\""<<nofNodes<<"\" NumberOfCells=\""<<nofCells<<"\">\n";
+
+   //POINTS SECTION
+   out<<"         <Points>\n"; 
+   out<<"            <DataArray type=\"Float32\" NumberOfComponents=\"3\" format=\"appended\" offset=\""<< offset <<"\"  />\n";
+   out<<"         </Points>\n";
+   offset += (bytesPerByteVal + bytesPoints);
+
+   //CELLS SECTION
+   out<<"         <Cells>\n";
+   out<<"            <DataArray type=\"Int32\" Name=\"connectivity\" format=\"appended\" offset=\""<< offset <<"\" />\n";
+   offset += (bytesPerByteVal + bytesCellConnectivty); 
+   out<<"            <DataArray type=\"Int32\" Name=\"offsets\" format=\"appended\" offset=\""<< offset <<"\" />\n";
+   offset += (bytesPerByteVal + bytesCellOffsets);
+   out<<"            <DataArray type=\"UInt8\" Name=\"types\" format=\"appended\" offset=\""<< offset <<"\" />\n ";
+   offset += (bytesPerByteVal + bytesCellTypes);
+   out<<"         </Cells>\n";
+
+   out<<"      </Piece>\n";
+   out<<"   </UnstructuredGrid>\n";
+
+   // AppendedData SECTION
+   out<<"   <AppendedData encoding=\"raw\">\n";
+   out<<"_";
+
+   //POINTS SECTION
+   out.write((char*)&bytesPoints,bytesPerByteVal);
+   for(int n=0; n<nofNodes; n++)
+   {
+      out.write((char*)&val<1>(nodes[n]),sizeof(float));
+      out.write((char*)&val<2>(nodes[n]),sizeof(float));
+      out.write((char*)&val<3>(nodes[n]),sizeof(float));
+   }
+
+   //CELLS SECTION
+   //cellConnectivity
+   out.write( (char*)&bytesCellConnectivty, bytesPerByteVal );  
+   for(int c=0; c<nofCells; c++) 
+   {
+      out.write( (char*)&val<1>(cells[c]), sizeof(int) );
+      out.write( (char*)&val<2>(cells[c]), sizeof(int) );
+      out.write( (char*)&val<4>(cells[c]), sizeof(int) );
+      out.write( (char*)&val<3>(cells[c]), sizeof(int) );
+      out.write( (char*)&val<5>(cells[c]), sizeof(int) );
+      out.write( (char*)&val<6>(cells[c]), sizeof(int) );
+      out.write( (char*)&val<8>(cells[c]), sizeof(int) );
+      out.write( (char*)&val<7>(cells[c]), sizeof(int) );
+   }
+
+   //cellOffsets
+   out.write( (char*)&bytesCellOffsets, bytesPerByteVal );
+   int itmp;
+   for(int c=1; c<=nofCells; c++)
+   {
+      itmp = 8 * c;    
+      out.write( (char*)&itmp, sizeof(int) );
+   }
+
+   //cellTypes
+   out.write( (char*)&bytesCellTypes, bytesPerByteVal );
+   unsigned char vtkCellType = 11;
+   for(int c=0; c<nofCells; c++)
+   {
+      out.write( (char*)&vtkCellType, sizeof(unsigned char) );
+   }
+   out<<"\n</AppendedData>\n";
+   out<<"</VTKFile>";
+   out<<endl;
+   out.close();
+   UBLOG(logDEBUG1,"WbWriterVtkXmlBinary::writeOcts to "<<vtkfilename<<" - end");
+
+   return vtkfilename;
+}
+std::string WbWriterVtkXmlBinary::writeNodes(const std::string& filename,std::vector< UbTupleFloat3 >& nodes)
+{
+   string vtkfilename = filename+getFileExtension();
+   UBLOG(logDEBUG1,"WbWriterVtkXmlBinary::writeNodes to "<<vtkfilename<<" - start");
+
+   ofstream out(vtkfilename.c_str(),ios::out | ios::binary);
+   if(!out)
+   { 
+      out.clear(); //flags ruecksetzen (ansonsten liefert utern if(!out) weiterhin true!!!
+      string path = UbSystem::getPathFromString(vtkfilename);
+      if(path.size()>0){ UbSystem::makeDirectory(path); out.open(vtkfilename.c_str(),ios::out | ios::binary);}
+      if(!out) throw UbException(UB_EXARGS,"couldn't open file "+vtkfilename);
+   }
+
+   int nofNodes = (int)nodes.size(); 
+
+   int bytesPerByteVal      = 4; //==sizeof(int)
+   int bytesPoints          = 3 /*x1/x2/x3        */ * nofNodes * sizeof(float);
+   int bytesCellConnectivty = 1 /*nodes per cell  */ * nofNodes * sizeof(int  );
+   int bytesCellOffsets     = 1 /*offset per cell */ * nofNodes * sizeof(int  );
+   int bytesCellTypes       = 1 /*type of line    */ * nofNodes * sizeof(unsigned char);
+
+   int offset = 0;
+   //VTK FILE
+   out<<"<?xml version=\"1.0\"?>\n";
+   out<<"<VTKFile type=\"UnstructuredGrid\" version=\"0.1\" byte_order=\"LittleEndian\" >"<<"\n";
+   out<<"   <UnstructuredGrid>"<<"\n";
+   out<<"      <Piece NumberOfPoints=\""<<nofNodes<<"\" NumberOfCells=\""<<nofNodes<<"\">\n";
+
+   //POINTS SECTION
+   out<<"         <Points>\n"; 
+   out<<"            <DataArray type=\"Float32\" NumberOfComponents=\"3\" format=\"appended\" offset=\""<< offset <<"\"  />\n";
+   out<<"         </Points>\n";
+   offset += (bytesPerByteVal + bytesPoints);
+
+   //CELLS SECTION
+   out<<"         <Cells>\n";
+   out<<"            <DataArray type=\"Int32\" Name=\"connectivity\" format=\"appended\" offset=\""<< offset <<"\" />\n";
+   offset += (bytesPerByteVal + bytesCellConnectivty); 
+   out<<"            <DataArray type=\"Int32\" Name=\"offsets\" format=\"appended\" offset=\""<< offset <<"\" />\n";
+   offset += (bytesPerByteVal + bytesCellOffsets);
+   out<<"            <DataArray type=\"UInt8\" Name=\"types\" format=\"appended\" offset=\""<< offset <<"\" />\n ";
+   offset += (bytesPerByteVal + bytesCellTypes);
+   out<<"         </Cells>\n";
+
+   out<<"      </Piece>\n";
+   out<<"   </UnstructuredGrid>\n";
+
+   // AppendedData SECTION
+   out<<"   <AppendedData encoding=\"raw\">\n";
+   out<<"_";
+
+   //POINTS SECTION
+   out.write((char*)&bytesPoints,bytesPerByteVal);
+   for(int n=0; n<nofNodes; n++)
+   {
+      out.write((char*)&val<1>(nodes[n]),sizeof(float));
+      out.write((char*)&val<2>(nodes[n]),sizeof(float));
+      out.write((char*)&val<3>(nodes[n]),sizeof(float));
+   }
+
+   //CELLS SECTION
+   //cellConnectivity
+   out.write( (char*)&bytesCellConnectivty, bytesPerByteVal );  
+   for(int c=0; c<nofNodes; c++) 
+      out.write( (char*)&c, sizeof(int) );
+
+   //cellOffsets
+   out.write( (char*)&bytesCellOffsets, bytesPerByteVal );
+   for(int c=1; c<=nofNodes; c++)
+      out.write( (char*)&c, sizeof(int) );
+
+   //cellTypes
+   out.write( (char*)&bytesCellTypes, bytesPerByteVal );
+   unsigned char vtkCellType = 1;
+   for(int c=0; c<nofNodes; c++)
+      out.write( (char*)&vtkCellType, sizeof(unsigned char) );
+
+   out<<"\n</AppendedData>\n";
+   out<<"</VTKFile>";
+   out<<endl;
+   out.close();
+   UBLOG(logDEBUG1,"WbWriterVtkXmlBinary::writeNodes to "<<vtkfilename<<" - end");
+
+   return vtkfilename;
+}
+std::string WbWriterVtkXmlBinary::writeNodesWithNodeData(const std::string& filename,std::vector< UbTupleFloat3 >& nodes, std::vector<std::string >& datanames, std::vector<std::vector<double > >& nodedata)
+{
+   string vtkfilename = filename+getFileExtension();
+   UBLOG(logDEBUG1,"WbWriterVtkXmlBinary::writeNodesWithNodeData to "<<vtkfilename<<" - start");
+
+   ofstream out(vtkfilename.c_str(),ios::out | ios::binary);
+   if(!out)
+   { 
+      out.clear(); //flags ruecksetzen (ansonsten liefert utern if(!out) weiterhin true!!!
+      string path = UbSystem::getPathFromString(vtkfilename);
+      if(path.size()>0){ UbSystem::makeDirectory(path); out.open(vtkfilename.c_str(),ios::out | ios::binary);}
+      if(!out) throw UbException(UB_EXARGS,"couldn't open file "+vtkfilename);
+   }
+
+   int nofNodes = (int)nodes.size(); 
+
+   int bytesPerByteVal      = 4; //==sizeof(int)
+   int bytesPoints          = 3 /*x1/x2/x3       */ * nofNodes * sizeof(float);
+   int bytesCellConnectivty = 1 /*nodes per cell */ * nofNodes * sizeof(int  );
+   int bytesCellOffsets     = 1 /*offset per cell*/ * nofNodes * sizeof(int  );
+   int bytesCellTypes       = 1 /*type of oct    */ * nofNodes * sizeof(unsigned char);
+   int bytesScalarData      = 1 /*scalar         */ * nofNodes * sizeof(double); 
+
+   int offset = 0;
+   //VTK FILE
+   out<<"<?xml version=\"1.0\"?>\n";
+   out<<"<VTKFile type=\"UnstructuredGrid\" version=\"0.1\" byte_order=\"LittleEndian\" >"<<"\n";
+   out<<"   <UnstructuredGrid>"<<"\n";
+   out<<"      <Piece NumberOfPoints=\""<<nofNodes<<"\" NumberOfCells=\""<<nofNodes<<"\">\n";
+
+   //POINTS SECTION
+   out<<"         <Points>\n"; 
+   out<<"            <DataArray type=\"Float32\" NumberOfComponents=\"3\" format=\"appended\" offset=\""<< offset <<"\"  />\n";
+   out<<"         </Points>\n";
+   offset += (bytesPerByteVal + bytesPoints);
+
+   //CELLS SECTION
+   out<<"         <Cells>\n";
+   out<<"            <DataArray type=\"Int32\" Name=\"connectivity\" format=\"appended\" offset=\""<< offset <<"\" />\n";
+   offset += (bytesPerByteVal + bytesCellConnectivty); 
+   out<<"            <DataArray type=\"Int32\" Name=\"offsets\" format=\"appended\" offset=\""<< offset <<"\" />\n";
+   offset += (bytesPerByteVal + bytesCellOffsets);
+   out<<"            <DataArray type=\"UInt8\" Name=\"types\" format=\"appended\" offset=\""<< offset <<"\" />\n ";
+   offset += (bytesPerByteVal + bytesCellTypes);
+   out<<"         </Cells>\n";
+
+   //DATA SECTION
+   out<<"         <PointData>\n";
+   for(size_t s=0; s<datanames.size(); ++s)
+   {
+      out<< "            <DataArray type=\"Float64\" Name=\""<< datanames[s] <<"\" format=\"appended\" offset=\""<< offset <<"\" /> \n";
+      offset += (bytesPerByteVal + bytesScalarData);
+   }
+   out<<"         </PointData>\n";
+
+   out<<"      </Piece>\n";
+   out<<"   </UnstructuredGrid>\n";
+
+   // AppendedData SECTION
+   out<<"   <AppendedData encoding=\"raw\">\n";
+   out<<"_";
+
+   //POINTS SECTION
+   out.write((char*)&bytesPoints,bytesPerByteVal);
+   for(int n=0; n<nofNodes; n++)
+   {
+      out.write((char*)&val<1>(nodes[n]),sizeof(float));
+      out.write((char*)&val<2>(nodes[n]),sizeof(float));
+      out.write((char*)&val<3>(nodes[n]),sizeof(float));
+   }
+
+   //CELLS SECTION
+   //cellConnectivity
+   out.write( (char*)&bytesCellConnectivty, bytesPerByteVal );  
+   for(int c=0; c<nofNodes; c++) 
+      out.write( (char*)&c, sizeof(int) );
+
+   //cellOffsets
+   out.write( (char*)&bytesCellOffsets, bytesPerByteVal );
+   for(int c=1; c<=nofNodes; c++)
+      out.write( (char*)&c, sizeof(int) );
+
+   //cellTypes
+   out.write( (char*)&bytesCellTypes, bytesPerByteVal );
+   unsigned char vtkCellType = 1;
+   for(int c=0; c<nofNodes; c++)
+      out.write( (char*)&vtkCellType, sizeof(unsigned char) );
+   
+   //DATA SECTION
+   //scalarData
+   for(size_t s=0; s<datanames.size(); ++s)
+   {
+      out.write((char*)&bytesScalarData,bytesPerByteVal);
+      for(size_t d=0; d<nodedata[s].size(); ++d)
+      {
+         //loake kopie machen, da in nodedata "doubles" sind
+         //float tmp = (float)nodedata[s][d];
+         //out.write((char*)&tmp,sizeof(float));
+         double tmp = nodedata[s][d];
+         out.write((char*)&tmp, sizeof(double));
+      }
+   }
+   out<<"\n</AppendedData>\n";
+   out<<"</VTKFile>";
+   out<<endl;
+   out.close();
+   UBLOG(logDEBUG1,"WbWriterVtkXmlBinary::writeNodesWithNodeData to "<<vtkfilename<<" - end");
+
+   return vtkfilename;
+
+}
diff --git a/src/VirtualFluidsBasics/basics/writer/WbWriterVtkXmlBinary.h b/src/VirtualFluidsBasics/basics/writer/WbWriterVtkXmlBinary.h
new file mode 100644
index 0000000000000000000000000000000000000000..e5a28b7a6e18f679ac582b35bd4c9b62b7547ebb
--- /dev/null
+++ b/src/VirtualFluidsBasics/basics/writer/WbWriterVtkXmlBinary.h
@@ -0,0 +1,121 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 WbWriterVtkXmlBinary.h
+//! \ingroup writer
+//! \author Soeren Freudiger, Sebastian Geller
+//=======================================================================================
+#ifndef WBWRITERVTKXMLBINARY_H
+#define WBWRITERVTKXMLBINARY_H
+
+#include <string>
+
+#include <basics/writer/WbWriter.h>
+
+class VF_PUBLIC WbWriterVtkXmlBinary  : public WbWriter
+{
+public:
+   static WbWriterVtkXmlBinary* getInstance()
+   {
+      static WbWriterVtkXmlBinary instance;
+      return &instance;
+   }
+private:
+   WbWriterVtkXmlBinary() : WbWriter() 
+   {
+      if(sizeof(unsigned char)!=1) throw UbException(UB_EXARGS,"machine error char  type mismatch");
+      if(sizeof(int)          !=4) throw UbException(UB_EXARGS,"machine error int   type mismatch");
+      if(sizeof(float)        !=4) throw UbException(UB_EXARGS,"machine error float type mismatch");
+   }
+
+   WbWriterVtkXmlBinary( const WbWriterVtkXmlBinary& );                  //no copy allowed 
+   const WbWriterVtkXmlBinary& operator=( const WbWriterVtkXmlBinary& ); //no copy allowed
+
+   static std::string  pvdEndTag;
+public:
+   std::string getFileExtension() { return ".bin.vtu";   }
+
+   //write a metafile 
+   std::string writeCollection(const std::string& filename, const std::vector<std::string>& filenames, const double& timestep, const bool& sepGroups);
+   std::string addFilesToCollection(const std::string& filename, const std::vector<std::string>& filenames, const double& timestep, const bool& sepGroups);
+   std::string writeParallelFile(const std::string& filename,std::vector<std::string>& pieceSources, std::vector<std::string>& pointDataNames, std::vector<std::string>& cellDataNames);
+
+   //////////////////////////////////////////////////////////////////////////
+   //nodes
+   std::string writeNodes(const std::string& filename,std::vector< UbTupleFloat3 >& nodes);
+   std::string writeNodesWithNodeData(const std::string& filename,std::vector< UbTupleFloat3 >& nodes, std::vector<std::string >& datanames, std::vector<std::vector<double > >& nodedata);
+
+   //////////////////////////////////////////////////////////////////////////
+   //lines
+   //     0 ---- 1
+   //nodenumbering must start with 0!
+   std::string writeLines(const std::string& filename,std::vector<UbTupleFloat3 >& nodes, std::vector<UbTupleInt2 >& lines);
+   std::string writeLinesWithNodeData(const std::string& filename,std::vector<UbTupleFloat3 >& nodes, std::vector<UbTupleInt2 >& lines, std::vector< std::string >& datanames, std::vector< std::vector< double > >& nodedata);
+
+   //////////////////////////////////////////////////////////////////////////
+   //triangles
+   //                    2
+   //                     
+   //                  0---1
+   //nodenumbering must start with 0!
+   std::string writeTriangles(const std::string& filename,std::vector<UbTupleFloat3 >& nodes, std::vector<UbTupleInt3 >& triangles);
+   std::string writeTrianglesWithNodeData(const std::string& filename,std::vector< UbTupleFloat3 >& nodes, std::vector< UbTupleInt3 >& cells, std::vector<std::string >& datanames, std::vector<std::vector<double > >& nodedata);
+
+   //////////////////////////////////////////////////////////////////////////
+   //2D
+   //cell numbering:
+   //                  3---2
+   //                  |   |
+   //                  0---1
+   //nodenumbering must start with 0!
+
+   std::string writeQuads(const std::string& filename,std::vector< UbTupleFloat3 >& nodes, std::vector< UbTupleInt4 >& cells);
+   std::string writeQuadsWithNodeData(const std::string& filename,std::vector< UbTupleFloat3 >& nodes, std::vector< UbTupleInt4 >& cells, std::vector< std::string >& datanames, std::vector< std::vector< double > >& nodedata);
+   std::string writeQuadsWithCellData(const std::string& filename,std::vector< UbTupleFloat3 >& nodes, std::vector< UbTupleInt4 >& cells, std::vector< std::string >& datanames, std::vector< std::vector< double > >& celldata);
+   std::string writeQuadsWithNodeAndCellData(const std::string& filename,std::vector< UbTupleFloat3 >& nodes, std::vector< UbTupleInt4 >& cells, 
+                                             std::vector< std::string >& nodedatanames, std::vector< std::vector< double > >& nodedata, std::vector< std::string >& celldatanames,
+                                             std::vector< std::vector< double > >& celldata                                                                    );
+   
+   //////////////////////////////////////////////////////////////////////////
+   //octs
+   //     7 ---- 6
+   //    /|     /|
+   //   4 +--- 5 |
+   //   | |    | |
+   //   | 3 ---+ 2
+   //   |/     |/
+   //   0 ---- 1
+   std::string writeOcts(const std::string& filename,std::vector< UbTupleFloat3 >& nodes, std::vector< UbTupleInt8 >& cells);
+   std::string writeOctsWithCellData(const std::string& filename,std::vector<UbTupleFloat3 >& nodes, std::vector<UbTupleInt8 >& cells, std::vector<std::string >& datanames, std::vector<std::vector<double > >& celldata);
+   std::string writeOctsWithNodeData(const std::string& filename,std::vector<UbTupleFloat3 >& nodes, std::vector<UbTupleInt8 >& cells, std::vector<std::string >& datanames, std::vector<std::vector<double > >& nodedata);
+   
+private:
+
+};
+
+#endif //WBWRITERVTKXMLBINARY_H
diff --git a/src/VirtualFluidsBasics/basics/writer/package.include b/src/VirtualFluidsBasics/basics/writer/package.include
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/src/VirtualFluidsBasics/geometry3d/CoordinateTransformation3D.cpp b/src/VirtualFluidsBasics/geometry3d/CoordinateTransformation3D.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..d92075c9e7910f59cfe5c9b0cc070083507c5ce2
--- /dev/null
+++ b/src/VirtualFluidsBasics/geometry3d/CoordinateTransformation3D.cpp
@@ -0,0 +1,288 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 CoordinateTransformation3D.cpp
+//! \ingroup geometry3d
+//! \author Soeren Freudiger, Sebastian Geller
+//=======================================================================================
+#include <geometry3d/CoordinateTransformation3D.h>
+#include <basics/utilities/UbMath.h>
+
+using namespace std;
+
+CoordinateTransformation3D::CoordinateTransformation3D()
+{
+   this->setTransformationValues(0.0,0.0,0.0,1.0,1.0,1.0,0.0,0.0,0.0);
+}
+/*======================================================*/
+CoordinateTransformation3D::CoordinateTransformation3D(const double& originX1, const double& originX2, const double& originX3, const double& dx1, const double& dx2, const double& dx3, const double& alpha, const double& beta, const double& gamma) 
+{
+   this->setTransformationValues(originX1, originX2, originX3, dx1, dx2, dx3, alpha, beta, gamma);
+}
+/*======================================================*/
+CoordinateTransformation3D::CoordinateTransformation3D(const double& originX1, const double& originX2, const double& originX3, const double& dx1, const double& dx2, const double& dx3) 
+{
+   this->setTransformationValues(originX1, originX2, originX3, dx1, dx2, dx3, 0.0, 0.0, 0.0);
+}
+/*======================================================*/
+CoordinateTransformation3D::CoordinateTransformation3D(CoordinateTransformation3D* transformation)
+{
+   this->setTransformationValues(transformation->Tx1 , transformation->Tx2 , transformation->Tx3 , transformation->Sx1 , transformation->Sx2 , transformation->Sx3, transformation->alpha, transformation->beta, transformation->gamma);
+}
+/*======================================================*/
+// void CoordinateTransformation3D::init()
+// {
+//    this->Tx1   = 0.0;      this->Tx2   = 0.0;	this->Tx3   = 0.0;
+//    this->Sx1   = 1.0;      this->Sx2   = 1.0;	this->Sx3   = 1.0;
+//    this->alpha = 0.0;		this->beta = 0.0;		this->gamma = 0.0;
+// 
+//    this->toX1factorX1   = 1.0; this->toX1factorX2   = 0.0; this->toX1factorX3   = 0.0;
+//    this->toX2factorX1   = 0.0; this->toX2factorX2   = 1.0; this->toX2factorX3   = 0.0;
+//    this->toX3factorX1   = 0.0; this->toX3factorX2   = 0.0; this->toX3factorX3   = 1.0;
+//    this->toX1delta      = 0.0; this->toX2delta      = 0.0; this->toX3delta      = 0.0;
+//    this->fromX1factorX1 = 1.0; this->fromX1factorX2 = 0.0; this->fromX1factorX3 = 0.0;
+//    this->fromX2factorX1 = 0.0; this->fromX2factorX2 = 1.0; this->fromX2factorX3 = 0.0;
+//    this->fromX3factorX1 = 0.0; this->fromX3factorX2 = 0.0; this->fromX3factorX3 = 1.0;
+//    
+//    this->active         = false;
+//    this->transformation = false;
+// }
+/*======================================================*/
+
+/**====  Set transformation values  ====**/
+/*!
+\brief Set transformation values
+@param a     transformed coordinate system x0 (in global coordinates)
+@param b     transformed coordinate system y0 (in global coordinates)
+@param c     transformed coordinate system z0 (in global coordinates)
+@param dx1    x coordinate scaling       (dx_transformed/dx_global)
+@param dx2    y coordinate scaling       (dy_transformed/dy_global)
+@param dx3    z coordinate scaling       (dz_transformed/dz_global)
+@param alpha rotation around z angle    (positive FROM global TO transformed coordinate system)
+@param beta  rotation around y angle            
+@param gamma rotation around x angle            
+@exception IllegalArgumentException if c1 of the scale values is between -1.0E-8 and 1.0E-8
+*/
+
+void CoordinateTransformation3D::setTransformationValues(const double& originX1, const double& originX2, const double& originX3, const double& dx1, const double& dx2, const double& dx3, const double& alpha, const double& beta, const double& gamma)
+{
+   if(UbMath::zero(dx1) || UbMath::zero(dx2) || UbMath::zero(dx3))
+      throw UbException(UB_EXARGS,"error: at least one delta==0.0");
+   
+   this->Tx1   = originX1; this->Tx2  = originX2; this->Tx3   = originX3;
+   this->Sx1   = dx1;	   this->Sx2  = dx2;	     this->Sx3   = dx3;
+   this->alpha = alpha;	   this->beta = beta;     this->gamma = gamma;
+
+   double ra   = UbMath::PI*alpha/180.0;
+   double cosA = cos(ra);
+   double sinA = sin(ra);
+   double rb   = UbMath::PI*beta/180.0;
+   double cosB = cos(rb);
+   double sinB = sin(rb);
+   double rg   = UbMath::PI*gamma/180.0;
+   double cosG = cos(rg);
+   double sinG = sin(rg);
+
+   //Matrix-Werte von T_invers  (indizes: 12 = spalte 1 zeile 2)
+   double divisor = (Sx1*Sx2*Sx3);
+   
+   this->toX1factorX1 = +cosB*cosA*Sx2*Sx3/divisor;
+   this->toX1factorX2 = -cosB*sinA*Sx1*Sx3/divisor;
+   this->toX1factorX3 = +sinB*Sx1*Sx2/divisor;
+   this->toX1delta    = (-Tx3*Sx1*Sx2*sinB       
+                         +Tx2*Sx1*Sx3*sinA*cosB  
+                         -Tx1*Sx2*Sx3*cosB*cosA)/divisor;
+   
+   this->toX2factorX1 = Sx2*Sx3*(sinG*sinB*cosA+cosG*sinA)/divisor;
+   this->toX2factorX2 = Sx1*Sx3*(-sinG*sinB*sinA+cosG*cosA)/divisor;
+   this->toX2factorX3 = -Sx1*Sx2*cosB*sinG/divisor;
+   this->toX2delta    = (-Tx2*Sx1*Sx3*cosG*cosA
+                         +Tx3*Sx1*Sx2*sinG*cosB
+                         +Tx2*Sx1*Sx3*sinG*sinA*sinB
+                         -Tx1*Sx2*Sx3*cosG*sinA
+                         -Tx1*Sx2*Sx3*sinB*sinG*cosA   )/divisor;
+   
+
+   this->toX3factorX1 = Sx2*Sx3*(-cosG*sinB*cosA+sinG*sinA)/divisor;
+   this->toX3factorX2 = Sx1*Sx3*(sinB*cosG*sinA+sinG*cosA)/divisor;
+   this->toX3factorX3 = Sx1*Sx2*cosB*cosG/divisor;
+   this->toX3delta    = (-Tx2*Sx1*Sx3*sinG*cosA
+                         -Tx3*Sx1*Sx2*cosG*cosB
+                         -Tx2*Sx1*Sx3*cosG*sinA*sinB
+                         -Tx1*Sx2*Sx3*sinG*sinA
+                         +Tx1*Sx2*Sx3*sinB*cosG*cosA  )/divisor;
+                        
+   //Matrix-Werte von T_invers  (indizes: 12 = spalte 1 zeile 2)
+   this->fromX1factorX1 =  cosB*cosA*Sx1;
+   this->fromX1factorX2 =  (sinG*sinB*cosA+cosG*sinA)*Sx1;
+   this->fromX1factorX3 =  (-cosG*sinB*cosA+sinG*sinA)*Sx1;
+   this->fromX1delta    =  Tx1;
+
+   this->fromX2factorX1 =  -cosB*sinA*Sx2;
+   this->fromX2factorX2 =  -(sinG*sinB*sinA-cosG*cosA)*Sx2;
+   this->fromX2factorX3 =  (cosG*sinB*sinA+sinG*cosA)*Sx2;
+   this->fromX2delta    =  Tx2;
+   
+   this->fromX3factorX1 =  sinB*Sx3;
+   this->fromX3factorX2 =  -sinG*cosB*Sx3;
+   this->fromX3factorX3 =  cosG*cosB*Sx3;
+   this->fromX3delta    =  Tx3;
+
+   this->active         =  true;
+   
+   this->transformation =  true;
+}
+/*======================================================*/
+/*!
+Set transformation active state (if this IS a transformation)
+@param active true to be active, false otherwise
+**/
+void CoordinateTransformation3D::setActive(const bool& active)
+{
+   if(this->active == active) return;
+   if(this->transformation)   this->active = active;
+}
+/*======================================================*/
+/*!
+Transform FROM global coordinates TO transformed coordinates.
+@param x1  the global x coordinate
+@param x2  the global y coordinate
+@param x3  the global z coordinate
+**/
+double CoordinateTransformation3D::transformForwardToX1Coordinate(const double& x1, const double& x2, const double& x3) const
+{
+   if(this->active) return this->toX1factorX1*x1 + this->toX1factorX2*x2 + this->toX1factorX3*x3 + this->toX1delta;
+   else             return x1;
+}
+/*======================================================*/
+double CoordinateTransformation3D::transformForwardToX2Coordinate(const double& x1, const double& x2, const double& x3) const
+{
+   if(this->active) return this->toX2factorX1*x1 + this->toX2factorX2*x2 + this->toX2factorX3*x3 + this->toX2delta;
+   else             return x2;
+}
+/*======================================================*/
+double CoordinateTransformation3D::transformForwardToX3Coordinate(const double& x1, const double& x2, const double& x3) const
+{
+   if(this->active) return this->toX3factorX1*x1 + this->toX3factorX2*x2 + this->toX3factorX3*x3 + this->toX3delta;
+   else             return x3;
+}
+/*======================================================*/
+/*!
+Transform FROM global coordinates TO transformed coordinates (ignoring rotation).
+@param x1  the global x coordinate
+**/
+double CoordinateTransformation3D::transformForwardToX1CoordinateIgnoringRotation(const double& x1) const
+{
+   if(this->active) return (x1-this->Tx1)/this->Sx1;
+   else             return x1;
+}
+/*======================================================*/
+double CoordinateTransformation3D::transformForwardToX2CoordinateIgnoringRotation(const double& x2) const
+{
+   if(this->active) return (x2-this->Tx2)/this->Sx2;
+   else             return x2;
+}
+/*======================================================*/
+double CoordinateTransformation3D::transformForwardToX3CoordinateIgnoringRotation(const double& x3) const
+{
+   if(this->active) return (x3-this->Tx3)/this->Sx3;
+   else             return x3;
+}
+/*======================================================*/
+/*!
+Transform FROM transformed coordinates TO global coordinates.
+@param x1  the transformed x coordinate
+@param x2  the transformed y coordinate
+@param x3  the transformed z coordinate
+**/
+double CoordinateTransformation3D::transformBackwardToX1Coordinate(const double& x1, const double& x2, const double& x3) const
+{
+   if(this->active) return this->fromX1factorX1*x1 + this->fromX1factorX2*x2 + this->fromX1factorX3*x3 + this->fromX1delta;
+   else             return x1;
+}
+/*======================================================*/
+double CoordinateTransformation3D::transformBackwardToX2Coordinate(const double& x1, const double& x2, const double& x3) const
+{
+   if(this->active) return this->fromX2factorX1*x1 + this->fromX2factorX2*x2 + this->fromX2factorX3*x3 + this->fromX2delta;
+   else             return x2;
+}
+/*======================================================*/
+double CoordinateTransformation3D::transformBackwardToX3Coordinate(const double& x1, const double& x2, const double& x3) const
+{
+   if(this->active) return this->fromX3factorX1*x1 + this->fromX3factorX2*x2 + this->fromX3factorX3*x3 + this->fromX3delta;
+   else             return x3;
+}
+/*======================================================*/
+/*!
+Transform FROM transformed coordinates TO global coordinates (ignoring rotation).
+@param x1  the transformed x coordinate
+**/
+double CoordinateTransformation3D::transformBackwardToX1CoordinateIgnoringRotation(const double& x1) const
+{
+   if(this->active) return x1*this->Sx1+this->Tx1;
+   else             return x1;
+}
+/*======================================================*/
+double CoordinateTransformation3D::transformBackwardToX2CoordinateIgnoringRotation(const double& x2) const
+{
+   if(this->active) return x2*this->Sx2+this->Tx2;
+   else             return x2;
+}
+/*======================================================*/
+double CoordinateTransformation3D::transformBackwardToX3CoordinateIgnoringRotation(const double& x3) const
+{
+   if(this->active) return x3*this->Sx3+this->Tx3;
+   else             return x3;
+}
+/*======================================================*/
+/*!
+Returns a string representation of this transformation.
+@return a string representation of this transformation
+**/
+string CoordinateTransformation3D::toString() const
+{
+   stringstream ss;
+    ss<<" CoordinateTransformation3D\n";
+//    ss<<"[isTransformation="<<this->transformation;
+//    ss<<", isActive="<<this->active<<endl;
+    ss<<" ,a="<<this->Tx1<<", b="<<this->Tx2<<", c="<<this->Tx3<<endl;
+    ss<<" , dx1="<<this->Sx1<<", dx2="<<this->Sx2<<", dx2="<<this->Sx3<<endl;
+//    ss<<" , alpha="<<this->alpha<<", beta="<<this->beta<endl;
+//    ss<<"]";
+//    ss<<"[to11="<<this->to11<<", to12="<<this->to12<<", to13="<<this->to13;
+//    ss<<", to21="<<this->to21<<", to22="<<this->to22<<", to23="<<this->to23;
+//    ss<<", to31="<<this->to31<<", to32="<<this->to32<<", to33="<<this->to33;
+//    ss<<", toA="<<this->toA<<", toB="<<this->toB<<", toC="<<this->toC;
+//    ss<<", from11="<<this->from11<<", from12="<<this->from12<<", from13="<<this->from13;
+//    ss<<", from21="<<this->from21<<", from22="<<this->from22<<", from23="<<this->from23;
+//    ss<<", from31="<<this->from31<<", from32="<<this->from32<<", from33="<<this->from33;
+//    ss<<", fromA="<<this->fromA; ss<<", fromB="<<this->fromB; ss<<", fromC="<<this->fromC;
+//    ss<<"]}";
+   return ss.str();
+}
+                                     
diff --git a/src/VirtualFluidsBasics/geometry3d/CoordinateTransformation3D.h b/src/VirtualFluidsBasics/geometry3d/CoordinateTransformation3D.h
new file mode 100644
index 0000000000000000000000000000000000000000..1f89a5e686efc4e3b0a1c901e0d93d1a25f9a9f4
--- /dev/null
+++ b/src/VirtualFluidsBasics/geometry3d/CoordinateTransformation3D.h
@@ -0,0 +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 CoordinateTransformation3D.cpp
+//! \ingroup geometry3d
+//! \author Soeren Freudiger, Sebastian Geller
+//=======================================================================================
+#ifndef COORDINATETRANSFORMATION3D_H
+#define COORDINATETRANSFORMATION3D_H
+
+#include <cmath>
+#include <string>
+#include <sstream>
+
+#include <basics/utilities/UbException.h>
+
+#include <PointerDefinitions.h>
+
+///////////////////////////////////////////////////////////////////////////////////////
+//! 
+//! \brief A class provides 3d coordinate transformation
+//! \details
+//! description:     x1/x2/x3 = old, x1*/x2*/x3* = new
+//!    x2      
+//!    ^             x*
+//!    |            /
+//!    |           2*
+//!    4          /
+//!    |         /
+//!    3        1*                     => new coordsys is translated by originX1=originX2=originX3=2
+//!    |       /                          new dx1=dx2=dx2=2 -> scaling by 2 in x1-,x2- und x3-direction
+//!    2      /                           FIRST rotation by alpha around "x1" axis
+//!    |       \                          THEN  rotation by beta  around "x2" axis
+//!    1         \                        THEN  rotation by gamma around "x3" axis
+//!    |           x1*
+//!    |--1--2--3--4--5------------- > x1
+//! 
+//!  Remark: It might be that the rotations around x1 and x3 axis are swapped.
+//! 
+//////////////////////////////////////////////////////////////////////////////////////
+
+class CoordinateTransformation3D
+{
+public:
+   CoordinateTransformation3D();
+   CoordinateTransformation3D(const double& originX1, const double& originX2, const double& originX3, const double& dx1, const double& dx2, const double& dx3, const double& alpha, const double& beta, const double& gamma);
+   CoordinateTransformation3D(const double& originX1, const double& originX2, const double& originX3, const double& dx1, const double& dx2, const double& dx3);
+   CoordinateTransformation3D(CoordinateTransformation3D* transformation);
+   
+   void setTransformationValues(const double& originX1, const double& originX2, const double& originX3, const double& dx1, const double& dx2, const double& dx3, const double& alpha, const double& beta, const double& gamma);
+   double getX1CoordinateOffset()  const { return this->Tx1;   }   //Translation
+   double getX2CoordinateOffset()  const { return this->Tx2;   }
+   double getX3CoordinateOffset()  const { return this->Tx3;   }
+   double getX1CoordinateScaling() const { return this->Sx1;   }	 //Scaling
+   double getX2CoordinateScaling() const { return this->Sx2;   }
+   double getX3CoordinateScaling() const { return this->Sx3;   }
+   double getRotationX1Angle()     const { return this->alpha; }
+   double getRotationX2Angle()     const { return this->beta;  }
+   double getRotationX3Angle()     const { return this->gamma; }	 //Rotation
+
+   //Achtung die Winkel passen nicht überein -siehe setTransformationValues 
+   void setRotationX1Angle(double alpha) { this->setTransformationValues(this->Tx1, this->Tx2, this->Tx3, this->Sx1, this->Sx2, this->Sx3, alpha, this->beta, this->gamma); }
+   void setRotationX2Angle(double beta ) { this->setTransformationValues(this->Tx1, this->Tx2, this->Tx3, this->Sx1, this->Sx2, this->Sx3, this->alpha, beta, this->gamma); }
+   void setRotationX3Angle(double gamma) { this->setTransformationValues(this->Tx1, this->Tx2, this->Tx3, this->Sx1, this->Sx2, this->Sx3, this->alpha, this->beta, gamma); }
+
+   void setActive(const bool& active);
+   bool isActive()          const { return this->active; }
+   bool isTransformation()  const { return this->transformation; }
+
+   double transformForwardToX1Coordinate(const double& x1, const double& x2, const double& x3) const;
+   double transformForwardToX2Coordinate(const double& x1, const double& x2, const double& x3) const;
+   double transformForwardToX3Coordinate(const double& x1, const double& x2, const double& x3) const;
+   double transformForwardToX1CoordinateIgnoringRotation(const double& x1) const;
+   double transformForwardToX2CoordinateIgnoringRotation(const double& x2) const;
+   double transformForwardToX3CoordinateIgnoringRotation(const double& x3) const;
+   double transformBackwardToX1Coordinate(const double& x1, const double& x2, const double& x3) const;
+   double transformBackwardToX2Coordinate(const double& x1, const double& x2, const double& x3) const;
+   double transformBackwardToX3Coordinate(const double& x1, const double& x2, const double& x3) const;
+   double transformBackwardToX1CoordinateIgnoringRotation(const double& x1) const;
+   double transformBackwardToX2CoordinateIgnoringRotation(const double& x2) const;
+   double transformBackwardToX3CoordinateIgnoringRotation(const double& x3) const;
+   std::string toString() const;
+
+private:
+   double Tx1, Tx2, Tx3, Sx1, Sx2, Sx3, alpha, beta, gamma;
+
+   double toX1factorX1, toX1factorX2, toX1factorX3, toX1delta;
+   double toX2factorX1, toX2factorX2, toX2factorX3, toX2delta;
+   double toX3factorX1, toX3factorX2, toX3factorX3, toX3delta;
+
+   double fromX1factorX1, fromX1factorX2, fromX1factorX3, fromX1delta;
+   double fromX2factorX1, fromX2factorX2, fromX2factorX3, fromX2delta;
+   double fromX3factorX1, fromX3factorX2, fromX3factorX3, fromX3delta;
+
+   bool   active;
+   bool   transformation;
+
+};
+
+#endif //COORDINATETRANSFORMATION3D_H
diff --git a/src/VirtualFluidsBasics/geometry3d/GbCuboid3D.cpp b/src/VirtualFluidsBasics/geometry3d/GbCuboid3D.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..67a7d3d15ea79295fd806b393e002dedfac3c0b9
--- /dev/null
+++ b/src/VirtualFluidsBasics/geometry3d/GbCuboid3D.cpp
@@ -0,0 +1,567 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 GbCuboid3D.cpp
+//! \ingroup geometry3d
+//! \author Soeren Freudiger, Sebastian Geller
+//=======================================================================================
+#include <GbCuboid3D.h>
+#include <GbSystem3D.h>
+#include <GbTriangle3D.h>
+
+#include <basics/utilities/UbMath.h>
+
+using namespace std;
+
+/*=======================================================*/
+// Konstruktor
+GbCuboid3D::GbCuboid3D() : GbObject3D()
+{
+   this->setName("cuboid");
+   this->p1 = new GbPoint3D(0.0, 0.0, 0.0);
+   this->p2 = new GbPoint3D(0.0, 0.0, 0.0);
+   this->p1->addObserver(this);
+   this->p2->addObserver(this);
+}
+/*=======================================================*/
+GbCuboid3D::GbCuboid3D(const double& x1a,const double& x2a, const double& x3a, const double& x1b,const double& x2b, const double& x3b):GbObject3D()
+{
+   this->setName("cuboid");
+   this->p1 = new GbPoint3D(x1a, x2a, x3a);
+   this->p1->addObserver(this);
+	this->p2 = new GbPoint3D(x1b, x2b, x3b);     
+   this->p2->addObserver(this);
+}
+/*=======================================================*/
+GbCuboid3D::GbCuboid3D(GbPoint3D* p1, GbPoint3D* p2) : GbObject3D()
+{
+   this->setName("cuboid");
+	if(!p1 || !p2) throw UbException(UB_EXARGS,"one point ==NULL");
+   this->p1 = p1;
+   this->p1->addObserver(this);
+   this->p2 = p2;
+   this->p2->addObserver(this);
+}
+/*=======================================================*/
+GbCuboid3D::GbCuboid3D(GbCuboid3D* cuboid) : GbObject3D()
+{
+   this->setName("cuboid");
+   if(!cuboid->getPoint1() || !cuboid->getPoint2()) throw UbException(UB_EXARGS,"cuboid ==NULL");
+   this->p1 = cuboid->getPoint1()->clone();
+   this->p1->addObserver(this);
+   this->p2 = cuboid->getPoint2()->clone();
+   this->p2->addObserver(this);
+}
+/*=======================================================*/
+// Destruktor
+GbCuboid3D::~GbCuboid3D()
+{
+   //cout<<"~GbCuboid3D()"<<endl;
+   if(this->p1) this->p1->removeObserver(this);
+   if(this->p2) this->p2->removeObserver(this);
+}
+/*=======================================================*/
+void GbCuboid3D::finalize() 
+{ 
+   if(this->p1) 
+   {
+      this->p1->removeObserver(this);
+      this->p1->finalize();
+      delete this->p1; 
+      this->p1=NULL;
+   } 
+   if(this->p2)
+   {
+      this->p2->removeObserver(this);
+      this->p2->finalize();
+      delete this->p2; 
+      this->p2=NULL;
+   }
+}
+/*=======================================================*/
+void GbCuboid3D::setPoint1(GbPoint3D* point1)
+{ 
+   if(this->p1) this->p1->removeObserver(this);
+   this->p1 = point1;  
+   this->p1->addObserver(this);
+
+   this->notifyObserversObjectChanged();
+}
+/*=======================================================*/
+void GbCuboid3D::setPoint2(GbPoint3D* point2)
+{ 
+   if(this->p2) this->p2->removeObserver(this);
+   this->p2 = point2;  
+   this->p2->addObserver(this);
+
+   this->notifyObserversObjectChanged();
+}
+/*=======================================================*/
+void GbCuboid3D::setPoints(GbPoint3D* point1, GbPoint3D* point2)
+{ 
+   if(this->p1) this->p1->removeObserver(this);
+   if(this->p2) this->p2->removeObserver(this);
+
+   this->p1 = point1; 
+   this->p2 = point2;
+
+   this->p1->addObserver(this);
+   this->p2->addObserver(this);
+
+   this->notifyObserversObjectChanged();
+}
+/*=======================================================*/
+void GbCuboid3D::setCenterCoordinates(const double& x1, const double& x2, const double& x3) 
+{
+   this->translate(x1-getX1Centroid(), x2-getX2Centroid(), x3-getX3Centroid() );
+}
+/*=======================================================*/
+double GbCuboid3D::getX1Centroid()
+{
+   return (0.5*(p1->x1 + p2->x1)); 
+}
+/*=======================================================*/
+double GbCuboid3D::getX1Minimum()   
+{
+	return (this->p1->x1 < this->p2->x1 ? this->p1->x1 : this->p2->x1);
+}
+/*=======================================================*/
+double GbCuboid3D::getX1Maximum()   
+{
+	return (this->p1->x1 > this->p2->x1 ? this->p1->x1 : this->p2->x1);
+}
+/*=======================================================*/
+double GbCuboid3D::getX2Centroid()
+{
+   return (0.5*(p1->x2 + p2->x2)); 
+}
+/*=======================================================*/
+double GbCuboid3D::getX2Minimum()   
+{
+	return (this->p1->x2 < this->p2->x2 ? this->p1->x2 : this->p2->x2);
+}	
+/*=======================================================*/
+double GbCuboid3D::getX2Maximum()   
+{
+	return ( this->p1->x2 > this->p2->x2 ? this->p1->x2 : this->p2->x2);
+}
+/*=======================================================*/
+double GbCuboid3D::getX3Centroid()
+{
+   return (0.5*(p1->x3 + p2->x3)); 
+}
+/*=======================================================*/
+double GbCuboid3D::getX3Minimum()   
+{	
+	return (this->p1->x3 < this->p2->x3 ? this->p1->x3 : this->p2->x3);
+}	
+/*=======================================================*/
+double GbCuboid3D::getX3Maximum()   
+{
+	return (this->p1->x3 > this->p2->x3 ? this->p1->x3 : this->p2->x3);
+}
+/*=======================================================*/
+double GbCuboid3D::getLengthX1() 
+{ 
+   return (this->getX1Maximum() - this->getX1Minimum() ); 
+}
+/*=======================================================*/
+double GbCuboid3D::getLengthX2() 
+{ 
+   return (this->getX2Maximum() - this->getX2Minimum());  
+}
+/*=======================================================*/
+double GbCuboid3D::getLengthX3() 
+{ 
+   return (this->getX3Maximum() - this->getX3Minimum()); 
+}
+/*=======================================================*/
+bool GbCuboid3D::isPointInGbObject3D(const double& x1p, const double& x2p, const double& x3p)
+{
+   //true, wenn 'in Object' oder 'auf Boundary'!
+   if     (UbMath::less(x1p,this->getX1Minimum()))    return false;
+   else if(UbMath::less(x2p,this->getX2Minimum()))    return false;
+   else if(UbMath::less(x3p,this->getX3Minimum()))    return false;
+   else if(UbMath::greater(x1p,this->getX1Maximum())) return false;
+   else if(UbMath::greater(x2p,this->getX2Maximum())) return false;
+   else if(UbMath::greater(x3p,this->getX3Maximum())) return false;
+
+   return true;
+}
+/*=======================================================*/
+bool GbCuboid3D::isPointInGbObject3D(const double& x1p, const double& x2p, const double& x3p, bool& pointIsOnBoundary)
+{
+   pointIsOnBoundary = false;
+   
+   //true, wenn 'in Object' oder 'auf Boundary'!
+   if     (UbMath::less(x1p,this->getX1Minimum()))    return false;
+	else if(UbMath::less(x2p,this->getX2Minimum()))    return false;
+	else if(UbMath::less(x3p,this->getX3Minimum()))    return false;
+	else if(UbMath::greater(x1p,this->getX1Maximum())) return false;
+	else if(UbMath::greater(x2p,this->getX2Maximum())) return false;
+	else if(UbMath::greater(x3p,this->getX3Maximum())) return false;
+	
+   if     (UbMath::equal(x1p,this->getX1Minimum())) pointIsOnBoundary = true;
+   else if(UbMath::equal(x2p,this->getX2Minimum())) pointIsOnBoundary = true;
+   else if(UbMath::equal(x3p,this->getX3Minimum())) pointIsOnBoundary = true;
+   else if(UbMath::equal(x1p,this->getX1Maximum())) pointIsOnBoundary = true;
+   else if(UbMath::equal(x2p,this->getX2Maximum())) pointIsOnBoundary = true;
+   else if(UbMath::equal(x3p,this->getX3Maximum())) pointIsOnBoundary = true;
+   
+   return true;
+}
+/*=======================================================*/
+bool GbCuboid3D::isCellInsideGbObject3D(const double& x1p1,const double& x2p1,const double& x3p1,const double& x1p2,const double& x2p2,const double& x3p2)
+{
+   if     ( UbMath::less   (x1p1, this->getX1Minimum() ) ) return false;
+   else if( UbMath::less   (x2p1, this->getX2Minimum() ) ) return false;
+   else if( UbMath::less   (x3p1, this->getX3Minimum() ) ) return false;
+   else if( UbMath::greater(x1p2, this->getX1Maximum() ) ) return false;
+   else if( UbMath::greater(x2p2, this->getX2Maximum() ) ) return false;
+   else if( UbMath::greater(x3p2, this->getX3Maximum() ) ) return false;
+
+   return true;
+}
+/*=======================================================*/
+bool GbCuboid3D::isCellCuttingGbObject3D(const double& x1a,const double& x2a,const double& x3a,const double& x1b,const double& x2b,const double& x3b)
+//Merksatz: cell oder deren Volumen schneidet oder beinhaltet komplette oder Teile der CuboidUmrandung
+//returns true:
+//  - cell cuts  cuboid3D
+//  - cell boxes cuboid3D
+//returns false:
+//  - cell completely inside cuboid3D ( = cuboid3D boxes cell)
+//  - cell und cuboid3D haben kein gemeinsames Volumen
+{
+   //erstmal die dumm Loesung
+   if(   !this->isCellInsideGbObject3D(x1a,x2a,x3a,x1b,x2b,x3b) 
+      && this->isCellInsideOrCuttingGbObject3D(x1a,x2a,x3a,x1b,x2b,x3b) )
+   {
+      return true;
+   }
+
+   return false;
+
+   //GbCuboid3D* cube = GbSystem3D::clipRectangle3D(*this->p1, *this->p2, x1a,x2a,x3a,x1b,x2b,x3b);
+   //if(cube) 
+   //{
+   //   cube->finalize();
+   //   delete cube;
+   //   return true;
+   //}
+
+   //return false;
+}
+/*=======================================================*/
+bool GbCuboid3D::isCellInsideOrCuttingGbObject3D(const double& x1a,const double& x2a,const double& x3a,const double& x1b,const double& x2b,const double& x3b)
+//returns true:
+//  - cell completely inside cuboid3D ( = cuboid3D boxes cell)
+//  - cell cuts  cuboid3D
+//  - cell boxes cuboid3D
+//returns false:
+//  - cell und cuboid3D haben kein gemeinsames Volumen
+{
+    //simpler check, da unser GbCuboid3D ein AABB is:
+   //  anfA        midA         endA             anfB    midB    endB
+   //   |            x<-- dxA -->|                 |<-dxB->x       |
+   //                |<----------------- T --------------->|
+   //ist |T| <= dxA + dxB -> overlap!
+
+   if(     UbMath::lessEqual(  std::fabs( this->getX1Centroid() - 0.5*(x1b+x1a)      /*Tx1*/      )
+                             , 0.5*( this->getLengthX1()        + std::fabs(x1b-x1a) /*dx1A+dx1B*/) )
+
+        && UbMath::lessEqual(  std::fabs( this->getX2Centroid() - 0.5*(x2b+x2a)      /*Tx2*/      )
+                             , 0.5*( this->getLengthX2()        + std::fabs(x2b-x2a) /*dx2A+dx2B*/) )
+
+        && UbMath::lessEqual(  std::fabs( this->getX3Centroid() - 0.5*(x3b+x3a)      /*Tx3*/      )
+                             , 0.5*( this->getLengthX3()        + std::fabs(x3b-x3a) /*dx3A+dx3B*/) ) )
+    {
+       return true;
+    }
+
+    return false;
+
+    // if(   this->isCellInsideGbObject3D(x1a,x2a,x3a,x1b,x2b,x3b)
+   //    || this->isCellCuttingGbObject3D(x1a,x2a,x3a,x1b,x2b,x3b) ) return true;
+   //
+   //return false;
+}
+/*=======================================================*/
+vector<GbTriangle3D*> GbCuboid3D::getSurfaceTriangleSet()
+{
+   vector<GbTriangle3D*> triangles;
+   GbPoint3D p1(getX1Minimum(),getX2Minimum(),getX3Minimum());
+   GbPoint3D p2(getX1Maximum(),getX2Minimum(),getX3Minimum());
+   GbPoint3D p3(getX1Maximum(),getX2Maximum(),getX3Minimum());
+   GbPoint3D p4(getX1Minimum(),getX2Maximum(),getX3Minimum());
+   GbPoint3D p5(getX1Minimum(),getX2Minimum(),getX3Maximum());
+   GbPoint3D p6(getX1Maximum(),getX2Minimum(),getX3Maximum());
+   GbPoint3D p7(getX1Maximum(),getX2Maximum(),getX3Maximum());
+   GbPoint3D p8(getX1Minimum(),getX2Maximum(),getX3Maximum());
+
+   GbPoint3D pUnten(getX1Centroid(),getX2Centroid(),getX3Minimum());
+   GbPoint3D pOben(getX1Centroid(),getX2Centroid(),getX3Maximum());
+   GbPoint3D pLinks(getX1Minimum(), getX2Centroid(),getX3Centroid());
+   GbPoint3D pRechts(getX1Maximum(), getX2Centroid(),getX3Centroid());
+   GbPoint3D pVorne(getX1Centroid(),getX2Minimum(),getX3Centroid());
+   GbPoint3D pHinten(getX1Centroid(),getX2Maximum(),getX3Centroid());
+
+   //"unten"
+   triangles.push_back(new GbTriangle3D(new GbPoint3D(p2),new GbPoint3D(pUnten),new GbPoint3D(p3)));
+   triangles.push_back(new GbTriangle3D(new GbPoint3D(p2),new GbPoint3D(p1),new GbPoint3D(pUnten)));
+   triangles.push_back(new GbTriangle3D(new GbPoint3D(p3),new GbPoint3D(pUnten),new GbPoint3D(p4)));
+   triangles.push_back(new GbTriangle3D(new GbPoint3D(p1),new GbPoint3D(p4),new GbPoint3D(pUnten)));
+   //"oben"
+   triangles.push_back(new GbTriangle3D(new GbPoint3D(p5),new GbPoint3D(p6),new GbPoint3D(pOben)));
+   triangles.push_back(new GbTriangle3D(new GbPoint3D(p6),new GbPoint3D(p7),new GbPoint3D(pOben)));
+   triangles.push_back(new GbTriangle3D(new GbPoint3D(p5),new GbPoint3D(pOben),new GbPoint3D(p8)));
+   triangles.push_back(new GbTriangle3D(new GbPoint3D(pOben),new GbPoint3D(p7),new GbPoint3D(p8)));
+   //"links"
+   triangles.push_back(new GbTriangle3D(new GbPoint3D(p4),new GbPoint3D(p1),new GbPoint3D(pLinks)));
+   triangles.push_back(new GbTriangle3D(new GbPoint3D(p4),new GbPoint3D(pLinks),new GbPoint3D(p8)));
+   triangles.push_back(new GbTriangle3D(new GbPoint3D(p8),new GbPoint3D(pLinks),new GbPoint3D(p5)));
+   triangles.push_back(new GbTriangle3D(new GbPoint3D(pLinks),new GbPoint3D(p1),new GbPoint3D(p5)));
+   //"rechts"                                                               
+   triangles.push_back(new GbTriangle3D(new GbPoint3D(p2),new GbPoint3D(p3),new GbPoint3D(pRechts)));
+   triangles.push_back(new GbTriangle3D(new GbPoint3D(pRechts),new GbPoint3D(p3),new GbPoint3D(p7)));
+   triangles.push_back(new GbTriangle3D(new GbPoint3D(p2),new GbPoint3D(pRechts),new GbPoint3D(p6)));
+   triangles.push_back(new GbTriangle3D(new GbPoint3D(pRechts),new GbPoint3D(p7),new GbPoint3D(p6)));
+   //"hinten"                                                                       
+   triangles.push_back(new GbTriangle3D(new GbPoint3D(p3),new GbPoint3D(p4),new GbPoint3D(pHinten)));
+   triangles.push_back(new GbTriangle3D(new GbPoint3D(p3),new GbPoint3D(pHinten),new GbPoint3D(p7)));
+   triangles.push_back(new GbTriangle3D(new GbPoint3D(p7),new GbPoint3D(pHinten),new GbPoint3D(p8)));
+   triangles.push_back(new GbTriangle3D(new GbPoint3D(pHinten),new GbPoint3D(p4),new GbPoint3D(p8)));
+   //"vorne"                                                                        
+   triangles.push_back(new GbTriangle3D(new GbPoint3D(p1),new GbPoint3D(p2),new GbPoint3D(pVorne)));
+   triangles.push_back(new GbTriangle3D(new GbPoint3D(pVorne),new GbPoint3D(p2),new GbPoint3D(p6)));
+   triangles.push_back(new GbTriangle3D(new GbPoint3D(p1),new GbPoint3D(pVorne),new GbPoint3D(p5)));
+   triangles.push_back(new GbTriangle3D(new GbPoint3D(pVorne),new GbPoint3D(p6),new GbPoint3D(p5)));
+   return triangles;
+}
+/*=======================================================*/
+void GbCuboid3D::addSurfaceTriangleSet(vector<UbTupleFloat3>& nodes, vector<UbTupleInt3>& triangles)
+{
+   /*0*/nodes.push_back( makeUbTuple((float)getX1Minimum(),(float)getX2Minimum(),(float)getX3Minimum()));
+   /*1*/nodes.push_back( makeUbTuple((float)getX1Maximum(),(float)getX2Minimum(),(float)getX3Minimum()));
+   /*2*/nodes.push_back( makeUbTuple((float)getX1Maximum(),(float)getX2Maximum(),(float)getX3Minimum()));
+   /*3*/nodes.push_back( makeUbTuple((float)getX1Minimum(),(float)getX2Maximum(),(float)getX3Minimum()));
+   
+   /*4*/nodes.push_back( makeUbTuple((float)getX1Minimum(),(float)getX2Minimum(),(float)getX3Maximum()));
+   /*5*/nodes.push_back( makeUbTuple((float)getX1Maximum(),(float)getX2Minimum(),(float)getX3Maximum()));
+   /*6*/nodes.push_back( makeUbTuple((float)getX1Maximum(),(float)getX2Maximum(),(float)getX3Maximum()));
+   /*7*/nodes.push_back( makeUbTuple((float)getX1Minimum(),(float)getX2Maximum(),(float)getX3Maximum()));
+
+   //"unten"
+   triangles.push_back( makeUbTuple( 0, 1, 2) );
+   triangles.push_back( makeUbTuple( 0, 2, 3) );
+   //"oben"
+   triangles.push_back( makeUbTuple( 4, 5, 6) );
+   triangles.push_back( makeUbTuple( 4, 6, 7) );
+   //"links"
+   triangles.push_back( makeUbTuple( 0, 3, 7) );
+   triangles.push_back( makeUbTuple( 0, 7, 4) );
+   //"rechts"                                                               
+   triangles.push_back( makeUbTuple( 1, 2, 6) );
+   triangles.push_back( makeUbTuple( 1, 6, 5) );
+   //"hinten"                                                                       
+   triangles.push_back( makeUbTuple( 3, 2, 7) );  
+   triangles.push_back( makeUbTuple( 2, 7, 6) );
+   //"vorne"                                                                        
+   triangles.push_back( makeUbTuple( 0, 1, 5) );
+   triangles.push_back( makeUbTuple( 0, 5, 4) );
+}
+/*=======================================================*/
+string GbCuboid3D::toString() 
+{
+   stringstream ss;
+   ss<<"GbCuboid3D[";
+   ss<<"p1="<<this->p1->toString();
+   ss<<", p2="<<this->p2->toString();
+   ss<<"]";
+   return ss.str();
+}
+/*=======================================================*/
+GbPoint3D* GbCuboid3D::calculateInterSectionPoint3D(GbPoint3D& point1, GbPoint3D& point2)
+{
+   throw UbException(UB_EXARGS,"not correct implemented");
+}
+/*=======================================================*/
+GbLine3D* GbCuboid3D::createClippedLine3D(GbPoint3D& point1, GbPoint3D& point2)
+{
+   return GbSystem3D::createClipLine3D(point1, point2,
+                                       p1->getX1Coordinate(),p1->getX2Coordinate(),p1->getX3Coordinate(),
+                                       p2->getX1Coordinate(),p2->getX2Coordinate(),p2->getX3Coordinate() );
+}
+/*==========================================================*/
+void GbCuboid3D::objectChanged(UbObservable* changedObject)
+{
+   GbPoint3D* point = dynamic_cast<GbPoint3D*>(changedObject);
+   if(!point || (this->p1!=point && this->p2!=point)) return;
+
+   this->notifyObserversObjectChanged();
+}
+/*==========================================================*/
+void GbCuboid3D::objectWillBeDeleted(UbObservable* objectForDeletion)
+{
+   if(this->p1)
+   {
+      UbObservable* observedObj = dynamic_cast<UbObservable*>(this->p1);
+      if(objectForDeletion == observedObj) { this->p1 = NULL; }
+   }
+   if(this->p2)
+   {
+      UbObservable* observedObj = dynamic_cast<UbObservable*>(this->p2);
+      if(objectForDeletion == observedObj) { this->p2 = NULL; }
+   }
+   //ACHTUNG: eigentlich muessten in allen methoden von GbLine if abfragen fuer NULL pointer hin... toDo
+}
+/*=======================================================*/
+void GbCuboid3D::translate(const double& tx1, const double& tx2, const double& tx3)
+{  
+   this->p1->translate(tx1, tx2, tx3);
+   this->p2->translate(tx1, tx2, tx3);
+   this->notifyObserversObjectChanged();
+}
+/*=======================================================*/
+void GbCuboid3D::scale(const double& sx1, const double& sx2, const double& sx3)
+{  
+   double lenX1 = this->getLengthX1();
+   double lenX2 = this->getLengthX2();
+   double lenX3 = this->getLengthX3();
+
+   double deltaX1 = lenX1*sx1 - lenX1;
+   double deltaX2 = lenX2*sx2 - lenX2;
+   double deltaX3 = lenX3*sx3 - lenX3;
+
+   double p1X1 = this->p1->getX1Coordinate();
+   double p1X2 = this->p1->getX2Coordinate();
+   double p1X3 = this->p1->getX3Coordinate();
+
+   double p2X1 = this->p2->getX1Coordinate();
+   double p2X2 = this->p2->getX2Coordinate();
+   double p2X3 = this->p2->getX3Coordinate();
+
+   this->p1->setCoordinates(p1X1 - 0.5*deltaX1
+                           ,p1X2 - 0.5*deltaX2
+                           ,p1X3 - 0.5*deltaX3);
+
+   this->p2->setCoordinates(p2X1 + 0.5*deltaX1
+                           ,p2X2 + 0.5*deltaX2
+                           ,p2X3 + 0.5*deltaX3);
+}
+/*==========================================================*/
+double GbCuboid3D::getCellVolumeInsideGbObject3D(const double& x1a,const double& x2a,const double& x3a,const double& x1b,const double& x2b,const double& x3b)
+{
+   if( this->isCellInsideGbObject3D(x1a,x2a,x3a,x1b,x2b,x3b) )       return 1.0*(x1b-x1a)*(x2b-x2a)*(x3b-x3a);
+   if( !(this->isCellCuttingGbObject3D(x1a,x2a,x3a,x1b,x2b,x3b)) )   return 0.0;
+
+   GbCuboid3D* cube = GbSystem3D::clipRectangle3D(*this->p1, *this->p2, x1a,x2a,x3a,x1b,x2b,x3b);
+
+   if(cube) 
+   {
+      double eps;
+      eps  = (cube->getLengthX1())*(cube->getLengthX2())*(cube->getLengthX3());
+      cube->finalize();
+      delete cube;
+      return eps;
+   }
+   return 0.0;
+}
+/*==========================================================*/
+double GbCuboid3D::getIntersectionRaytraceFactor(const double& x1, const double& x2, const double& x3, const double& rx1, const double& rx2, const double& rx3)
+{
+   double minB[3]   = { this->getX1Minimum(), this->getX2Minimum(), this->getX3Minimum() };
+   double maxB[3]   = { this->getX1Maximum(), this->getX2Maximum(), this->getX3Maximum() };
+   double origin[3] = { x1,  x2,  x3  }; //point
+   double dir[3]    = { rx1, rx2, rx3 }; //ray 
+
+   bool inside = true;
+   char quadrant[3];
+   int  whichPlane;
+   double maxT[3];
+   double candidatePlane[3];
+
+   /* Find candidate planes; this loop can be avoided if
+   rays cast all from the eye(assume perpsective view) */
+   for(int i=0; i<3; i++)
+   {
+      if(origin[i] < minB[i])
+      {
+         quadrant[i] = 1/*LEFT*/;
+         candidatePlane[i] = minB[i];
+         inside = false;
+      }
+      else if(origin[i] > maxB[i]) 
+      {
+         quadrant[i] = 0/*RIGHT*/;
+         candidatePlane[i] = maxB[i];
+         inside = false;
+      }
+      else	
+      {
+         quadrant[i] = 2/*MIDDLE*/;
+      }
+   }
+   /* Ray origin inside bounding box */
+   if(inside)
+   {
+      //throw UbException(UB_EXARGS,"not done");
+      return 0.0;
+   }
+
+   /* Calculate T distances to candidate planes */
+   for(int i=0; i<3; i++)
+   {
+      if( quadrant[i]!=2/*MIDDLE*/ && fabs(dir[i])>1.E-10 )
+      {
+         maxT[i] = (candidatePlane[i]-origin[i])/dir[i];
+      }
+      else maxT[i] = -1.0;
+   }
+
+   /* Get largest of the maxT's for final choice of intersection */
+   whichPlane = 0;
+   for(int i=1; i<3; i++)
+      if (maxT[whichPlane] < maxT[i])
+            whichPlane = i;
+   
+   /* Check final candidate actually inside box */
+   if(maxT[whichPlane]< -1.E-10) return -1.0;
+   double dummy;
+   for(int i= 0; i<3; i++)
+   {
+      if( whichPlane!= i) 
+      {
+         dummy = origin[i] + maxT[whichPlane]*dir[i];
+         if(dummy < minB[i] || dummy > maxB[i])
+            return -1.0;
+      } 
+   }
+
+   return maxT[whichPlane] ;				/* ray hits box */
+}	
+
diff --git a/src/VirtualFluidsBasics/geometry3d/GbCuboid3D.h b/src/VirtualFluidsBasics/geometry3d/GbCuboid3D.h
new file mode 100644
index 0000000000000000000000000000000000000000..db7e0245dbd7b6da344bd26d07a93f8e58c3282d
--- /dev/null
+++ b/src/VirtualFluidsBasics/geometry3d/GbCuboid3D.h
@@ -0,0 +1,145 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 GbCuboid3D.h
+//! \ingroup geometry3d
+//! \author Soeren Freudiger, Sebastian Geller
+//=======================================================================================
+#ifndef GBCUBOID3D_H
+#define GBCUBOID3D_H
+
+#include <vector>
+#include <cmath>
+
+#include <GbPoint3D.h>
+#include <basics/utilities/UbObserver.h>
+#include <basics/utilities/UbMath.h>
+
+class GbLine3D;
+class GbObject3DCreator;
+
+#include <PointerDefinitions.h>
+class GbCuboid3D;
+typedef SPtr<GbCuboid3D> GbCuboid3DPtr;
+
+//! \brief This Class provides basic 3D box objects.
+class GbCuboid3D : public GbObject3D, public UbObserver
+{
+public:              
+   GbCuboid3D();
+   GbCuboid3D(const double& minX1,const double& minX2, const double& minX3, const double& maxX1,const double& maxX2, const double& maxX3);
+   GbCuboid3D(GbPoint3D *p1, GbPoint3D *p2);
+   GbCuboid3D(GbCuboid3D *cuboid);
+   ~GbCuboid3D();   
+
+   GbCuboid3D* clone()    { return new GbCuboid3D(this); }
+   void finalize();
+
+   GbPoint3D* getPoint1() { return this->p1; }
+   GbPoint3D* getPoint2() { return this->p2; }
+
+   void setPoint1(GbPoint3D* point1);
+   void setPoint2(GbPoint3D* point2);
+   void setPoints(GbPoint3D* point1, GbPoint3D* point2);
+
+   double getX1Centroid();
+   double getX1Minimum();
+   double getX1Maximum();
+   double getX2Centroid();
+   double getX2Minimum();
+   double getX2Maximum();
+   double getX3Centroid();
+   double getX3Minimum();
+   double getX3Maximum();
+   void setCenterCoordinates(const double& x1, const double& x2, const double& x3);
+
+   void translate(const double& x1, const double& x2, const double& x3);
+   void rotate(const double& rx1, const double& rx2, const double& rx3) {}
+   void scale(const double& sx1, const double& sx2, const double& sx3);
+
+   double getLengthX1();
+   double getLengthX2();
+   double getLengthX3();
+
+   bool isPointInGbObject3D(const double& x1p, const double& x2p, const double& x3p, bool& pointIsOnBoundary);
+   bool isPointInGbObject3D(const double& x1p, const double& x2p, const double& x3p); 
+   bool isCellInsideGbObject3D(const double& x1a,const double& x2a,const double& x3a,const double& x1b,const double& x2b,const double& x3b);
+   bool isCellCuttingGbObject3D(const double& x1a,const double& x2a,const double& x3a,const double& x1b,const double& x2b,const double& x3b);
+   bool isCellInsideOrCuttingGbObject3D(const double& x1a,const double& x2a,const double& x3a,const double& x1b,const double& x2b,const double& x3b);
+   double getCellVolumeInsideGbObject3D(const double& x1a,const double& x2a,const double& x3a,const double& x1b,const double& x2b,const double& x3b);
+
+   GbPoint3D*  calculateInterSectionPoint3D(GbPoint3D& point1, GbPoint3D &point2);
+   //GbCuboid3D* createClippedRectangle3D(const double& x1a,const double& x2a,const double& x3a,const double& x1b,const double& x2b,const double& x3b);
+   GbLine3D*   createClippedLine3D(GbPoint3D& point1, GbPoint3D& point2);
+
+   std::vector<GbTriangle3D*> getSurfaceTriangleSet();
+   void addSurfaceTriangleSet(std::vector<UbTupleFloat3>& nodes, std::vector<UbTupleInt3>& triangles);
+
+   bool hasRaytracing() { return true; }
+   /*|r| must be 1! einheitsvector!!*/
+   double getIntersectionRaytraceFactor(const double& x1, const double& x2, const double& x3, const double& rx1, const double& rx2, const double& rx3);
+
+
+   double getDistance(GbPoint3D* p)
+   {
+      return this->getDistance( p->getX1Coordinate(), p->getX2Coordinate(), p->getX3Coordinate() );
+   } 
+   double getDistance(const double& x1p, const double& x2p, const double& x3p)
+   {
+      throw UbException( UB_EXARGS, "not implemented" );
+
+      // falls punkt innerhalt ist: minimalen abstand ausrechnen
+      if( this->isPointInGbObject3D(x1p,x2p,x3p) )
+      {
+         double x1Dist = UbMath::min( std::abs(x1p-this->getX1Minimum()),std::abs(x1p-this->getX1Maximum()) );
+         double x2Dist = UbMath::min( std::abs(x2p-this->getX2Minimum()),std::abs(x2p-this->getX2Maximum()) );
+         double x3Dist = UbMath::min( std::abs(x3p-this->getX3Minimum()),std::abs(x3p-this->getX3Maximum()) );
+
+         return UbMath::min( x1Dist, x2Dist, x3Dist );
+      }
+      else
+      {
+
+      }
+   }
+
+   std::string toString();
+
+   //virtuelle Methoden von UbObserver
+   void objectChanged(UbObservable* changedObject);
+   void objectWillBeDeleted(UbObservable* objectForDeletion);
+
+
+   using GbObject3D::isPointInGbObject3D; //Grund: dadurch muss man hier  isPointInGbObject3D(GbPoint3D*) nicht ausprogrammieren, welche sonst hier "ueberdeckt" waere
+
+protected:
+   GbPoint3D* p1;
+   GbPoint3D* p2;
+};
+
+#endif   
diff --git a/src/VirtualFluidsBasics/geometry3d/GbLine3D.cpp b/src/VirtualFluidsBasics/geometry3d/GbLine3D.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..4626eaccbf9c5056ddb0136282aedd9e32d7bd5b
--- /dev/null
+++ b/src/VirtualFluidsBasics/geometry3d/GbLine3D.cpp
@@ -0,0 +1,246 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 GbLine3D.cpp
+//! \ingroup geometry3d
+//! \author Soeren Freudiger, Sebastian Geller
+//=======================================================================================
+#include <GbLine3D.h>
+#include <GbSystem3D.h>
+#include <GbCuboid3D.h>
+#include <GbTriangle3D.h>
+
+using namespace std;
+
+/*=======================================================*/
+GbLine3D::GbLine3D()
+{
+   p1     = NULL;
+   p2     = NULL;                       
+   length = 0.0;
+}
+/*=======================================================*/
+GbLine3D::GbLine3D(GbPoint3D* point1, GbPoint3D* point2)
+{
+   this->p1 = point1;
+   this->p2 = point2;
+   this->p1->addObserver(this);
+   this->p2->addObserver(this);
+   this->calculateValues();
+}
+/*=======================================================*/
+GbLine3D::GbLine3D(GbLine3D* line)
+{
+   this->p1 = line->p1->clone();            
+   this->p2 = line->p2->clone();
+   this->p1->addObserver(this);
+   this->p2->addObserver(this);
+   this->calculateValues();
+}
+/*=======================================================*/
+GbLine3D::~GbLine3D() 
+{
+   if(this->p1) this->p1->removeObserver(this);
+   if(this->p2) this->p2->removeObserver(this);
+}
+/*=======================================================*/
+void GbLine3D::finalize() 
+{
+   if(this->p1) 
+   {
+      this->p1->removeObserver(this);
+      this->p1->finalize();
+      delete this->p1;
+      this->p1 = NULL;
+   }
+   if(this->p2)
+   {
+      this->p2->removeObserver(this);
+      this->p2->finalize();
+      delete this->p2;
+      this->p2 = NULL;
+   }
+}
+/*=======================================================*/
+vector<GbTriangle3D*> GbLine3D::getSurfaceTriangleSet()
+{
+   vector<GbTriangle3D*> triangles;
+   GbPoint3D p1(getX1Minimum(),getX2Minimum(),getX3Minimum());
+   GbPoint3D p2(getX1Centroid(),getX2Centroid(),getX3Centroid());
+   GbPoint3D p3(getX1Maximum(),getX2Maximum(),getX3Maximum());
+ 
+   triangles.push_back(new GbTriangle3D(new GbPoint3D(p1),new GbPoint3D(p2),new GbPoint3D(p3)));
+   
+   return triangles;
+}
+/*=======================================================*/
+void GbLine3D::setPoint1(GbPoint3D* point1)
+{ 
+   if(this->p1) this->p1->removeObserver(this);
+   this->p1 = point1;  
+   this->p1->addObserver(this);
+
+   if(this->p1 && this->p2) this->calculateValues(); 
+}
+/*=======================================================*/
+void GbLine3D::setPoint2(GbPoint3D* point2)
+{ 
+   if(this->p2) this->p2->removeObserver(this);
+   this->p2 = point2;  
+   this->p2->addObserver(this);
+
+   if(this->p1 && this->p2) this->calculateValues(); 
+}
+/*=======================================================*/
+void GbLine3D::setPoints(GbPoint3D* point1, GbPoint3D* point2)
+{ 
+   if(this->p1) this->p1->removeObserver(this);
+   if(this->p2) this->p2->removeObserver(this);
+
+   this->p1 = point1; 
+   this->p2 = point2;
+
+   this->p1->addObserver(this);
+   this->p2->addObserver(this);
+
+   this->calculateValues(); 
+}
+/*=======================================================*/
+string GbLine3D::toString()
+{
+   stringstream ss;
+   ss<<"GbLine3D[p1=";
+   ss<<this->p1->toString()<<",p2="<<this->p2->toString()<<",l="<<this->getLength()<<"]";
+   return(ss.str());
+}
+/*=======================================================*/
+GbPoint3D* GbLine3D::calculateIntersectionPoint3D(GbLine3D* line)
+{
+   throw UbException(UB_EXARGS," not implemented");
+   //return(GbSystem::calculateIntersectionPoint3D(*this->p1, *this->p2, *line->p1, *line->p2));
+}
+/*======================================================================*/
+GbLine3D* GbLine3D::createClippedLine3D(GbCuboid3D* cuboid)
+{
+   return GbSystem3D::createClipLine3D(*this->p1, *this->p2, cuboid->getPoint1()->x1, cuboid->getPoint1()->x2, cuboid->getPoint1()->x3, cuboid->getPoint2()->x1, cuboid->getPoint2()->x2, cuboid->getPoint2()->x3);
+}                           
+/*======================================================================*/
+GbLine3D* GbLine3D::createClippedLine3D(GbPoint3D* pA, GbPoint3D* pE)
+{
+   return GbSystem3D::createClipLine3D(*this->p1, *this->p2, pA->x1, pA->x2, pA->x3, pE->x1, pE->x2, pE->x3);
+}
+/*======================================================================*/
+double GbLine3D::getDistance(const GbPoint3D& point)
+{
+   return this->getDistance(point.x1,point.x2,point.x3);
+}
+/*======================================================================*/
+double GbLine3D::getDistance(const double& x1,const double& x2,const double& x3)
+{
+   double dx1 = this->p2->x1 - this->p1->x1;
+   double dx2 = this->p2->x2 - this->p1->x2;
+   double dx3 = this->p2->x3 - this->p1->x3;
+
+   //double vec[3];
+   double a0 = x1 - p1->x1;
+   double a1 = x2 - p1->x2;
+   double a2 = x3 - p1->x3;
+
+   double kreuzProd0 = a1 * dx3 - a2 * dx2;
+   double kreuzProd1 = a2 * dx1 - a0 * dx3;
+   double kreuzProd2 = a0 * dx2 - a1 * dx1;
+
+   return (std::sqrt(kreuzProd0*kreuzProd0+kreuzProd1*kreuzProd1+kreuzProd2*kreuzProd2))/length;
+}
+/*=======================================================*/
+void GbLine3D::calculateValues()
+{
+   double dx1 = this->p2->x1 - this->p1->x1;
+   double dx2 = this->p2->x2 - this->p1->x2;
+   double dx3 = this->p2->x3 - this->p1->x3;
+   this->length = std::sqrt(dx1*dx1+dx2*dx2+dx3*dx3);
+}
+/*==========================================================*/
+void GbLine3D::objectChanged(UbObservable* changedObject)
+{
+   GbPoint3D* point = dynamic_cast<GbPoint3D*>(changedObject);
+   if(!point || (this->p1!=point && this->p2!=point)) return;
+
+   this->calculateValues();
+}
+/*==========================================================*/
+void GbLine3D::objectWillBeDeleted(UbObservable* objectForDeletion)
+{
+   if(this->p1)
+   {
+      UbObservable* observedObj = dynamic_cast<UbObservable*>(this->p1);
+      if(objectForDeletion == observedObj) { this->p1 = NULL; length = 0.0; }
+   }
+   if(this->p2)
+   {
+      UbObservable* observedObj = dynamic_cast<UbObservable*>(this->p2);
+      if(objectForDeletion == observedObj) { this->p2 = NULL; length = 0.0; }
+   }
+   //ACHTUNG: eigentlich muessten in allen methoden von GbLine if abfragen fuer NULL pointer hin... toDo
+}
+/*==========================================================*/
+void GbLine3D::scale(const double& sx1, const double& sx2, const double& sx3)
+{  
+   double p1X1 = this->p1->getX1Coordinate();
+   double p1X2 = this->p1->getX2Coordinate();
+   double p1X3 = this->p1->getX3Coordinate();
+
+   double p2X1 = this->p2->getX1Coordinate();
+   double p2X2 = this->p2->getX2Coordinate();
+   double p2X3 = this->p2->getX3Coordinate();
+
+   double lenX1 = fabs( p1X1 - p2X1 );
+   double lenX2 = fabs( p1X2 - p2X2 );
+   double lenX3 = fabs( p1X3 - p2X3 );
+
+   double deltaX1 = lenX1*sx1 - lenX1;
+   double deltaX2 = lenX2*sx2 - lenX2;
+   double deltaX3 = lenX3*sx3 - lenX3;
+
+   if(p1X1<p2X1) { p1X1 -=  0.5*deltaX1;   p2X1 +=  0.5*deltaX1; }
+   else          { p1X1 +=  0.5*deltaX1;   p2X1 -=  0.5*deltaX1; }
+   if(p1X2<p2X2) { p1X2 -=  0.5*deltaX2;   p2X2 +=  0.5*deltaX2; }
+   else          { p1X2 +=  0.5*deltaX2;   p2X2 -=  0.5*deltaX2; }
+   if(p1X3<p2X3) { p1X3 -=  0.5*deltaX3;   p2X3 +=  0.5*deltaX3; }
+   else          { p1X3 +=  0.5*deltaX3;   p2X3 -=  0.5*deltaX3; }
+
+   this->p1->setCoordinates(p1X1,p1X2,p1X3);
+   this->p2->setCoordinates(p2X1,p2X2,p2X3);
+}
+/*=======================================================*/
+void GbLine3D::translate(const double& tx1, const double& tx2, const double& tx3)
+{  
+   this->p1->translate(tx1, tx2, tx3);
+   this->p2->translate(tx1, tx2, tx3);
+   //this->notifyObserversObjectChanged();
+}
diff --git a/src/VirtualFluidsBasics/geometry3d/GbLine3D.h b/src/VirtualFluidsBasics/geometry3d/GbLine3D.h
new file mode 100644
index 0000000000000000000000000000000000000000..69d6de96d3516d89a0faabcd47ef62d4a30a48e9
--- /dev/null
+++ b/src/VirtualFluidsBasics/geometry3d/GbLine3D.h
@@ -0,0 +1,135 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 GbLine3D.h
+//! \ingroup geometry3d
+//! \author Soeren Freudiger, Sebastian Geller
+//=======================================================================================
+#ifndef GBLINE3D_H
+#define GBLINE3D_H
+
+#include <sstream>
+#include <cmath>
+          
+#include <basics/utilities/UbObserver.h>
+
+#include <GbObject3D.h>
+#include <GbPoint3D.h>
+
+class GbCuboid3D;
+
+#include <PointerDefinitions.h>
+
+//////////////////////////////////////////////////////////////////////////
+//! 
+//!  \class GbLine3D
+//! 
+//! \brief This Class provides basic 3D line objects.
+//! \details The describing points are observed by 3D line objects.
+//!
+//////////////////////////////////////////////////////////////////////////
+
+class GbLine3D	: public GbObject3D , public UbObserver
+{
+public:
+   GbLine3D();
+	GbLine3D(GbPoint3D* point1, GbPoint3D* point2);
+	GbLine3D(GbLine3D* line);
+   ~GbLine3D(); 
+
+   GbLine3D* clone() { return new GbLine3D(this); }
+   void finalize();
+
+   void setPoint1(GbPoint3D* point1);
+   void setPoint2(GbPoint3D* point2);
+   void setPoints(GbPoint3D* point1, GbPoint3D* point2);
+
+   void deletePoint1() { if(this->p1) {this->p1->removeObserver(this); delete this->p1; this->p1=NULL;} }
+   void deletePoint2() { if(this->p2) {this->p2->removeObserver(this); delete this->p2; this->p2=NULL;} }
+   void deletePoints() { this->deletePoint1(); this->deletePoint2(); }
+
+   GbPoint3D* getPoint1() { return this->p1; }
+   GbPoint3D* getPoint2() { return this->p2; }    
+   
+   double getLength()     { return(this->length); }
+	
+   double getX1Centroid() { return((this->p1->x1+this->p2->x1)*0.5);}
+   double getX2Centroid() { return((this->p1->x2+this->p2->x2)*0.5); };
+   double getX3Centroid() { return((this->p1->x3+this->p2->x3)*0.5); }
+   
+   double getX1Minimum()  { return(this->p1->x1 < this->p2->x1 ? this->p1->x1 : this->p2->x1); }
+   double getX2Minimum()  { return(this->p1->x2 < this->p2->x2 ? this->p1->x2 : this->p2->x2); }
+   double getX3Minimum()  { return(this->p1->x3 < this->p2->x3 ? this->p1->x3 : this->p2->x3); }
+   
+   double getX1Maximum()  { return(this->p1->x1 > this->p2->x1 ? this->p1->x1 : this->p2->x1); }
+   double getX2Maximum()  { return(this->p1->x2 > this->p2->x2 ? this->p1->x2 : this->p2->x2); }
+   double getX3Maximum()  { return(this->p1->x3 > this->p2->x3 ? this->p1->x3 : this->p2->x3); }
+	                                               
+   void scale(const double& sx1, const double& sx2, const double& sx3);
+   void translate(const double& tx1, const double& tx2, const double& tx3);
+
+   GbPoint3D* calculateIntersectionPoint3D(GbLine3D* line);
+   GbLine3D*  createClippedLine3D(GbCuboid3D* cuboid);
+   GbLine3D*  createClippedLine3D(GbPoint3D* pA, GbPoint3D* pE);
+   
+   double     getDistance(const GbPoint3D& point);
+   double     getDistance(const double& x1,const double& x2,const double& x3);
+
+   std::vector<GbTriangle3D*> getSurfaceTriangleSet();
+   bool isPointInGbObject3D(const double& x1, const double& x2, const double& x3)
+   {
+      throw UbException(UB_EXARGS,"not implemented");
+   }
+   bool isPointInGbObject3D(const double& x1, const double& x2, const double& x3, bool& pointIsOnBoundary)
+   {
+      throw UbException(UB_EXARGS,"not implemented");
+   }
+   bool isCellInsideGbObject3D(const double& x11,const double& x21,const double& x31,const double& x12,const double& x22,const double& x32) { return false; }
+
+   GbLine3D* createClippedLine3D (GbPoint3D& point1, GbPoint3D& point2)
+   {
+      throw UbException(UB_EXARGS,"not implemented");
+   }
+
+   //virtuelle Methoden von UbObserver
+   void objectChanged(UbObservable* changedObject);
+   void objectWillBeDeleted(UbObservable* objectForDeletion);
+
+   std::string toString();
+
+   using GbObject3D::isPointInGbObject3D; //Grund: dadurch muss man hier  isPointInGbObject3D(GbPoint3D*) nicht ausprogrammieren, welche sonst hier "ueberdeckt" waere
+protected:
+   GbPoint3D* p1;
+	GbPoint3D* p2;
+	double     length;
+
+private:
+   void calculateValues();
+};
+
+#endif
diff --git a/src/VirtualFluidsBasics/geometry3d/GbObject3D.cpp b/src/VirtualFluidsBasics/geometry3d/GbObject3D.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..77a17ac1505ebe72ae9a7d88221fd47c4a9731ef
--- /dev/null
+++ b/src/VirtualFluidsBasics/geometry3d/GbObject3D.cpp
@@ -0,0 +1,115 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 GbObject3D.cpp
+//! \ingroup geometry3d
+//! \author Soeren Freudiger, Sebastian Geller
+//=======================================================================================
+#include <GbObject3D.h>
+#include <GbPoint3D.h>
+#include <basics/utilities/UbMath.h>                 
+
+using namespace std;
+
+/*======================================================================*/
+bool GbObject3D::isPointInGbObject3D(GbPoint3D* p)
+{
+   return this->isPointInGbObject3D(p->getX1Centroid(),p->getX2Coordinate(),p->getX3Coordinate());
+} 
+/*======================================================================*/
+bool GbObject3D::isCellInsideGbObject3D(const double& x1a,const double& x2a,const double& x3a,const double& x1b,const double& x2b,const double& x3b) 
+{
+
+   if(   this->isPointInGbObject3D(x1a, x2a, x3a) 
+      && this->isPointInGbObject3D(x1b, x2a, x3a) 
+      && this->isPointInGbObject3D(x1b, x2b, x3a)
+      && this->isPointInGbObject3D(x1a, x2b, x3a) 
+      && this->isPointInGbObject3D(x1a, x2a, x3b)
+      && this->isPointInGbObject3D(x1b, x2a, x3b)
+      && this->isPointInGbObject3D(x1b, x2b, x3b)
+      && this->isPointInGbObject3D(x1a, x2b, x3b))
+   {
+      return true;
+   }
+
+   return false;
+}
+/*======================================================================*/
+bool GbObject3D::isCellCuttingGbObject3D(const double& x1a,const double& x2a,const double& x3a,const double& x1b,const double& x2b,const double& x3b) 
+{
+   if(   this->isPointInGbObject3D(x1a, x2a, x3a)      
+      || this->isPointInGbObject3D(x1b, x2a, x3a)      
+      || this->isPointInGbObject3D(x1b, x2b, x3a)      
+      || this->isPointInGbObject3D(x1a, x2b, x3a)      
+      || this->isPointInGbObject3D(x1a, x2a, x3b)      
+      || this->isPointInGbObject3D(x1b, x2a, x3b)      
+      || this->isPointInGbObject3D(x1b, x2b, x3b)      
+      || this->isPointInGbObject3D(x1a, x2b, x3b) )    
+   {
+      if(   !this->isPointInGbObject3D(x1a, x2a, x3a) 
+         || !this->isPointInGbObject3D(x1b, x2a, x3a) 
+         || !this->isPointInGbObject3D(x1b, x2b, x3a) 
+         || !this->isPointInGbObject3D(x1a, x2b, x3a)
+         || !this->isPointInGbObject3D(x1a, x2a, x3b)
+         || !this->isPointInGbObject3D(x1b, x2a, x3b)
+         || !this->isPointInGbObject3D(x1b, x2b, x3b)
+         || !this->isPointInGbObject3D(x1a, x2b, x3b)) return true;
+   }
+   return false;
+}
+/*======================================================================*/
+bool GbObject3D::isCellInsideOrCuttingGbObject3D(const double& x1a,const double& x2a,const double& x3a,const double& x1b,const double& x2b,const double& x3b)
+{
+   if(   this->isPointInGbObject3D(x1a, x2a, x3a)   
+      || this->isPointInGbObject3D(x1b, x2a, x3a)   
+      || this->isPointInGbObject3D(x1b, x2b, x3a)   
+      || this->isPointInGbObject3D(x1a, x2b, x3a)   
+      || this->isPointInGbObject3D(x1a, x2a, x3b)   
+      || this->isPointInGbObject3D(x1b, x2a, x3b)   
+      || this->isPointInGbObject3D(x1b, x2b, x3b)   
+      || this->isPointInGbObject3D(x1a, x2b, x3b))  
+   {
+      return true;
+   }
+
+   return false;
+}
+/*=======================================================*/
+bool GbObject3D::isInsideCell(const double& minX1,const double& minX2,const double& minX3,const double& maxX1,const double& maxX2,const double& maxX3)
+{
+   if(   UbMath::greaterEqual(this->getX1Minimum(),minX1)
+      && UbMath::greaterEqual(this->getX2Minimum(),minX2)
+      && UbMath::greaterEqual(this->getX3Minimum(),minX3)
+      && UbMath::lessEqual(this->getX1Maximum(),maxX1) 
+      && UbMath::lessEqual(this->getX2Maximum(),maxX2)   
+      && UbMath::lessEqual(this->getX2Maximum(),maxX3)     ) return true;
+
+   return false;
+}
+
+
diff --git a/src/VirtualFluidsBasics/geometry3d/GbObject3D.h b/src/VirtualFluidsBasics/geometry3d/GbObject3D.h
new file mode 100644
index 0000000000000000000000000000000000000000..dcb27c94ea1390c4458e05fe397a9377846ae5ec
--- /dev/null
+++ b/src/VirtualFluidsBasics/geometry3d/GbObject3D.h
@@ -0,0 +1,152 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 GbObject3D.h
+//! \ingroup geometry3d
+//! \author Soeren Freudiger, Sebastian Geller
+//=======================================================================================
+#ifndef GBOBJECT3D_H
+#define GBOBJECT3D_H
+
+#include <string>
+#include <vector>
+
+
+#include <basics/utilities/UbSystem.h>
+#include <basics/utilities/UbException.h>
+#include <basics/utilities/UbObservable.h>
+#include <basics/utilities/UbTuple.h>
+#include <basics/objects/ObObject.h>
+
+class GbPoint3D;
+class GbLine3D;
+class GbTriangle3D;
+class GbObject3DCreator;
+
+#include <PointerDefinitions.h>
+
+//////////////////////////////////////////////////////////////////////////
+//! 
+//! \class GbObject3D
+//! 
+//! \brief This Interface provides basic 3D geometry objects methods.
+//! 
+//////////////////////////////////////////////////////////////////////////
+
+class GbObject3D : public ObObject
+{
+public:
+   virtual ~GbObject3D(){}
+
+   //abstract Methods
+   virtual void finalize() =0 ; //detroys also all dynamic objects (e.g. GbPoints in GbLine)
+   /**
+    * Returns the centroid x1 coordinate of this 3D object.
+    * @return the centroid x1 coordinate of this 3D object
+    */
+   virtual double getX1Centroid()=0;
+   /**
+    * Returns the minimum x1 coordinate of this 3D object.
+    * @return the minimum x1 coordinate of this 3D object
+    */
+   virtual double getX1Minimum()=0;
+   /**
+    * Returns the maximum x1 coordinate of this 3D object.
+    * @return the maximum x1 coordinate of this 3D object
+    */
+   virtual double getX1Maximum()=0;
+   /**
+    * Returns the centroid x2 coordinate of this 3D object.
+    * @return the centroid x2 coordinate of this 3D object
+    */
+   virtual double getX2Centroid()=0;
+   /**
+    * Returns the minimum x2 coordinate of this 3D object.
+    * @return the minimum x2 coordinate of this 3D object
+    */
+   virtual double getX2Minimum()=0;
+   /**
+    * Returns the maximum x2 coordinate of this 3D object.
+    * @return the maximum x2 coordinate of this 3D object
+    */
+   virtual double getX2Maximum()=0;
+
+	virtual double getX3Centroid()=0;
+   /**
+    * Returns the minimum x2 coordinate of this 3D object.
+    * @return the minimum x2 coordinate of this 3D object
+    */
+   virtual double getX3Minimum()=0;
+   /**
+    * Returns the maximum x2 coordinate of this 3D object.
+    * @return the maximum x2 coordinate of this 3D object
+    */
+   virtual double getX3Maximum()=0;
+
+   /*=======================================================*/
+   double getLengthX1() { return (getX1Maximum()-getX1Minimum()); }
+   double getLengthX2() { return (getX2Maximum()-getX2Minimum()); }
+   double getLengthX3() { return (getX3Maximum()-getX3Minimum()); }
+
+   virtual void setCenterX1Coordinate(const double& value) { throw UbException(UB_EXARGS,"not implemented for "+(std::string)typeid(*this).name() ); }
+   virtual void setCenterX2Coordinate(const double& value) { throw UbException(UB_EXARGS,"not implemented for "+(std::string)typeid(*this).name() ); }
+   virtual void setCenterX3Coordinate(const double& value) { throw UbException(UB_EXARGS,"not implemented for "+(std::string)typeid(*this).name() ); }
+   virtual void setCenterCoordinates(const double& x1, const double& x2, const double& x3) { throw UbException(UB_EXARGS, "not implemented for " + (std::string)typeid(*this).name()); }
+   virtual void setCenterCoordinates(const UbTupleDouble3& position) { throw UbException(UB_EXARGS,"not implemented for "+(std::string)typeid(*this).name() ); }
+
+   //Rotates the Point in relation to the origen.
+   //Parameters must be radian measure.
+   virtual void rotate(const double& rx1, const double& rx2, const double& rx3) { throw UbException(UB_EXARGS,"not implemented for "+(std::string)typeid(*this).name() ); }
+   virtual void translate(const double& x1, const double& x2, const double& x3) { throw UbException(UB_EXARGS,"not implemented for "+(std::string)typeid(*this).name() ); }
+   virtual void scale(const double& sx1, const double& sx2, const double& sx3)  { throw UbException(UB_EXARGS,"not implemented for "+(std::string)typeid(*this).name() ); }
+
+   virtual bool isPointInGbObject3D(GbPoint3D* p);
+   virtual bool isPointInGbObject3D(const double& x1, const double& x2, const double& x3, bool& pointIsOnBoundary)=0;
+   virtual bool isPointInGbObject3D(const double& x1, const double& x2, const double& x3)=0;
+
+   virtual bool isCellInsideGbObject3D(const double& x1a,const double& x2a,const double& x3a,const double& x1b,const double& x2b,const double& x3b);
+   virtual bool isCellCuttingGbObject3D(const double& x1a,const double& x2a,const double& x3a,const double& x1b,const double& x2b,const double& x3b);
+   virtual bool isCellInsideOrCuttingGbObject3D(const double& x1a,const double& x2a,const double& x3a,const double& x1b,const double& x2b,const double& x3b);
+   virtual double getCellVolumeInsideGbObject3D(const double& x1a,const double& x2a,const double& x3a,const double& x1b,const double& x2b,const double& x3b){ return -1.0;};
+
+   virtual bool isInsideCell(const double& minX1,const double& minX2,const double& minX3,const double& maxX1,const double& maxX2,const double& maxX3);
+
+   virtual GbLine3D* createClippedLine3D (GbPoint3D &point1, GbPoint3D &point2)=0;
+   virtual std::vector<GbTriangle3D*> getSurfaceTriangleSet()=0;
+
+   virtual void addSurfaceTriangleSet(std::vector<UbTupleFloat3>& nodes, std::vector<UbTupleInt3>& triangles) { throw UbException("GbObject3D::addSurfaceTriangleSet - not implemented for "+(std::string)typeid(*this).name()); }
+
+   virtual bool hasRaytracing() { return false; }
+   virtual bool raytracingSupportsPointsInside() { return false; }
+   //|r| must be 1! einheitsvector!!
+   //return negativ value oder zero if no intersection
+   virtual double getIntersectionRaytraceFactor(const double& x1, const double& x2, const double& x3, const double& rx1, const double& rx2, const double& rx3) { throw UbException("GbObject3D::getIntersectionRaytraceFactor - not implemented"); }
+};
+/*=========================================================================*/
+
+#endif
diff --git a/src/VirtualFluidsBasics/geometry3d/GbPoint3D.cpp b/src/VirtualFluidsBasics/geometry3d/GbPoint3D.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..b0a179e695bf7b70c3dbc650ca9466ac3f3ee76f
--- /dev/null
+++ b/src/VirtualFluidsBasics/geometry3d/GbPoint3D.cpp
@@ -0,0 +1,150 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 GbPoint3D.cpp
+//! \ingroup geometry3d
+//! \author Soeren Freudiger, Sebastian Geller
+//=======================================================================================
+#include <GbPoint3D.h>
+using namespace std;
+
+/*=======================================================*/
+GbPoint3D::GbPoint3D()
+{ 
+   this->x1=0.0; 
+   this->x2=0.0; 
+   this->x3=0.0;
+}                                             
+/*=======================================================*/
+GbPoint3D::GbPoint3D(const double& x1, const double& x2, const double& x3)
+{ 
+   this->x1=x1; 
+   this->x2=x2; 
+   this->x3=x3;
+}
+/*=======================================================*/
+GbPoint3D::GbPoint3D(GbPoint3D* point)
+{
+   this->x1 = point->x1;                                             
+   this->x2 = point->x2;
+   this->x3 = point->x3;
+} 
+/*=======================================================*/
+double GbPoint3D::getDistance(GbPoint3D* p)
+{
+   double dx1 = this->x1 - p->x1;
+   double dx2 = this->x2 - p->x2;
+   double dx3 = this->x3 - p->x3;
+   return std::sqrt(dx1*dx1 + dx2*dx2 + dx3*dx3);
+}
+/*=======================================================*/
+bool GbPoint3D::equals(const GbPoint3D* point) const
+{
+   if(fabs(this->x1-point->x1)>1.E-10) return false;
+   if(fabs(this->x2-point->x2)>1.E-10) return false;
+   if(fabs(this->x3-point->x3)>1.E-10) return false;
+
+   return true;
+}
+/*=======================================================*/
+void GbPoint3D::transform(const double matrix[4][4])
+{
+   double tempX1 = x1;
+   double tempX2 = x2;
+   double tempX3 = x3;
+   x1 = matrix[0][0] * tempX1 + matrix[0][1] * tempX2 + matrix[0][2] * tempX3 + matrix[0][3] * 1.;
+   x2 = matrix[1][0] * tempX1 + matrix[1][1] * tempX2 + matrix[1][2] * tempX3 + matrix[1][3] * 1.;
+   x3 = matrix[2][0] * tempX1 + matrix[2][1] * tempX2 + matrix[2][2] * tempX3 + matrix[2][3] * 1.;
+}
+/*=======================================================*/
+bool GbPoint3D::isPointInGbObject3D(const double& x1, const double& x2, const double& x3)
+{
+   return (fabs(x1)<1.E-13 && fabs(x2)<1.E-13 && fabs(x3)<1.E-13 );
+}
+/*=======================================================*/
+bool GbPoint3D::isPointInGbObject3D(const double& x1, const double& x2, const double& x3, bool& pointIsOnBoundary)
+{
+   pointIsOnBoundary = (fabs(x1)<1.E-13 && fabs(x2)<1.E-13 && fabs(x3)<1.E-13 );
+   return pointIsOnBoundary;
+}
+/*=======================================================*/
+vector<GbTriangle3D*> GbPoint3D::getSurfaceTriangleSet()
+{            
+   cout<<"GbPoint3D::getSurfaceTriangleSet() - test ... if no exception occurs, everything is fine\n";
+   vector<GbTriangle3D*> triangles;
+   return triangles; //<-empty vector! is okay!
+   
+   //old:
+   //to avoid unnecessary exceptions a point will generate a triangle with
+   //c3 point with same coordinates
+   //vector<GbTriangle3D*> triangles;
+   //GbPoint3D p1(getX1Coordinate(),getX2Coordinate(),getX3Coordinate());
+   //triangles.push_back(new GbTriangle3D(new GbPoint3D(p1),new GbPoint3D(p1),new GbPoint3D(p1)));
+}
+/*=======================================================*/
+GbLine3D* GbPoint3D::createClippedLine3D (GbPoint3D& point1, GbPoint3D& point2)
+{
+   throw UbException(UB_EXARGS,"not implemented");
+} 
+/*=======================================================*/
+string GbPoint3D::toString()
+{
+   stringstream ss;
+   ss<<"GbPoint3D["<<this->x1<<","<<this->x2<<","<<this->x3<<"]";
+   return((ss.str()).c_str());
+}
+/*=======================================================*/
+void GbPoint3D::translate(const double& dx1, const double& dx2, const double& dx3)
+{  
+   this->x1 += dx1;
+   this->x2 += dx2;
+   this->x3 += dx3;
+   this->notifyObserversObjectChanged(); 
+}
+/*=======================================================*/
+void GbPoint3D::rotate(const double& rx1, const double& rx2, const double& rx3)
+{  
+   double newX1 = cos(rx3)*cos(rx2)*x1-x2*sin(rx3)*cos(rx1)+x2*cos(rx3)*sin(rx2)*sin(rx1)+x3*sin(rx3)*sin(rx1)+x3*cos(rx3)*sin(rx2)*cos(rx1);
+   double newX2 =  sin(rx3)*cos(rx2)*x1+x2*cos(rx3)*cos(rx1)+x2*sin(rx3)*sin(rx2)*sin(rx1)-x3*cos(rx3)*sin(rx1)+x3*sin(rx3)*sin(rx2)*cos(rx1);
+   double newX3 = -sin(rx2)*x1+cos(rx2)*sin(rx1)*x2+cos(rx2)*cos(rx1)*x3;
+
+   this->x1 = newX1;
+   this->x2 = newX2;
+   this->x3 = newX3;
+   this->notifyObserversObjectChanged(); 
+}
+/*=======================================================*/
+void GbPoint3D::scale(const double& sx1, const double& sx2, const double& sx3)
+{  
+   this->x1 *= sx1;
+   this->x2 *= sx2;
+   this->x3 *= sx3;
+   this->notifyObserversObjectChanged(); 
+}
+/*=======================================================*/
+
diff --git a/src/VirtualFluidsBasics/geometry3d/GbPoint3D.h b/src/VirtualFluidsBasics/geometry3d/GbPoint3D.h
new file mode 100644
index 0000000000000000000000000000000000000000..956f10461a8715ee4b80597ecf2a4e702b320fb2
--- /dev/null
+++ b/src/VirtualFluidsBasics/geometry3d/GbPoint3D.h
@@ -0,0 +1,109 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 GbPoint3D.h
+//! \ingroup geometry3d
+//! \author Soeren Freudiger, Sebastian Geller
+//=======================================================================================
+#ifndef GBPOINT3D_H
+#define GBPOINT3D_H
+
+#include <string>
+#include <sstream>
+#include <cmath>
+
+#include <GbObject3D.h>
+
+#include <PointerDefinitions.h>
+
+class GbTriangle3D;
+
+//! \brief This Class provides basic 3D point objects.
+class GbPoint3D : public GbObject3D
+{
+public:
+   GbPoint3D();
+   GbPoint3D(const double& x1, const double& x2, const double& x3);
+   GbPoint3D(GbPoint3D *point);                
+   ~GbPoint3D() {}
+
+   GbPoint3D* clone() {return new GbPoint3D(this);}
+   void finalize() {}
+
+   void setCoordinates(const double& x1, const double& x2, const double& x3)
+   {
+       this->x1=x1;
+       this->x2=x2;
+       this->x3=x3;
+       this->notifyObserversObjectChanged();
+   }
+   void setX1(const double& x1) { this->x1=x1; this->notifyObserversObjectChanged(); }
+   void setX2(const double& x2) { this->x2=x2; this->notifyObserversObjectChanged(); }
+   void setX3(const double& x3) { this->x3=x3; this->notifyObserversObjectChanged(); }
+
+   double getX1Coordinate() const  { return this->x1; }
+   double getX2Coordinate() const  { return this->x2; }
+   double getX3Coordinate() const  { return this->x3; }
+
+   void transform(const double matrix[4][4]);
+ 
+   double getX1Centroid()  { return this->x1; }
+   double getX1Minimum()   { return this->x1; }
+   double getX1Maximum()   { return this->x1; }
+   double getX2Centroid()  { return this->x2; }
+   double getX2Minimum()   { return this->x2; }
+   double getX2Maximum()   { return this->x2; }
+   double getX3Centroid()  { return this->x3; }
+   double getX3Minimum()   { return this->x3; }
+   double getX3Maximum()   { return this->x3; }        
+ 
+   void translate(const double& x1, const double& x2, const double& x3);
+   void rotate(const double& rx1, const double& rx2, const double& rx3);
+   void scale(const double& sx1, const double& sx2, const double& sx3);
+
+   double getDistance(GbPoint3D *p);
+   bool equals(const GbPoint3D* point) const;
+   bool isPointInGbObject3D(const double& x1, const double& x2, const double& x3, bool& pointIsOnBoundary);
+   bool isPointInGbObject3D(const double& x1, const double& x2, const double& x3);
+   bool isCellInsideGbObject3D(const double& x11,const double& x21,const double& x31,const double& x12,const double& x22,const double& x23) { return false; }
+
+   std::vector<GbTriangle3D*> getSurfaceTriangleSet();
+   GbLine3D* createClippedLine3D(GbPoint3D &point1, GbPoint3D &point2);
+   virtual std::string toString();
+
+   using GbObject3D::isPointInGbObject3D; //Grund: dadurch muss man hier  isPointInGbObject3D(GbPoint3D*) nicht ausprogrammieren
+                                          //, welche sonst hier "ueberdeckt" waere,da es dieselbe methode mit anderen args gibt!
+
+   //member
+   double x1;
+   double x2;
+   double x3;      
+};
+
+
+#endif
diff --git a/src/VirtualFluidsBasics/geometry3d/GbPolygon3D.cpp b/src/VirtualFluidsBasics/geometry3d/GbPolygon3D.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..2ba04de82d36371c7939a1a6582d291bd39a03f0
--- /dev/null
+++ b/src/VirtualFluidsBasics/geometry3d/GbPolygon3D.cpp
@@ -0,0 +1,356 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 GbPolygon3D.cpp
+//! \ingroup geometry3d
+//! \author Soeren Freudiger, Sebastian Geller
+//=======================================================================================
+#include <GbPolygon3D.h>
+
+using namespace std;
+
+int GbPolygon3D::counter = 0;
+
+GbPolygon3D::GbPolygon3D()
+{
+   init();
+   counter++;
+   this->ps = new GbSystem3D::PointSet3(0);
+}
+void GbPolygon3D::init()
+{
+   x1s        = 0.0;
+   x2s        = 0.0;
+   x1min      = 0.0;
+   x1max      = 0.0;
+   x2min      = 0.0;
+   x2max      = 0.0;
+   //		points   = NULL;
+   consistent = false;
+   ps         = NULL;
+}
+
+/*!
+* Creates an empty 3D polygon with the specified capacity.
+* @param capacity the initial capacity
+*/
+GbPolygon3D::GbPolygon3D(int capacity)
+{
+   init();
+   counter++;
+   this->ps = new GbSystem3D::PointSet3(capacity);
+   //     this.po = new PointObserver(this);
+}
+/**
+* Creates a 3D polygon with the specified points.
+* @param points the initial points of the polygon
+*/
+GbPolygon3D::GbPolygon3D(vector<GbPoint3D>& points)
+{
+   init();
+   counter++;
+   this->ps = new GbSystem3D::PointSet3((int)points.size());
+   this->addPoints(points);
+}
+/**
+* Creates a 3D polygon as clone of the specified 3D polygon.
+* @param polygon the 3D polygon to be cloned
+*/
+GbPolygon3D::GbPolygon3D(GbPolygon3D* polygon)
+{
+   this->init();
+   counter++;
+   this->ps = new GbSystem3D::PointSet3((int)polygon->size());
+   vector<GbPoint3D> temp = polygon->getPoints();
+   this->addPoints( temp  );
+}
+
+GbPolygon3D::~GbPolygon3D()
+{
+   counter--;
+   //if(points)
+   //for(unsigned u=0; u<points->size(); u++)
+   //{
+   //	delete (*points)[u];
+   //}
+   //		delete this->points;
+   delete this->ps;
+}
+
+/*======================================================================*/
+/**
+* Returns the number of points.
+* @return the number of points
+*/
+int GbPolygon3D::size()
+{
+   return(this->ps->size());
+}
+/**
+* Returns the number of times this 3D polygon contains the specified point.
+* @param point the point
+* @return the number of times this 3D polygon contains the specified point
+*/
+int GbPolygon3D::contains(GbPoint3D* point)
+{
+   return(this->ps->contains(point));
+}
+/**
+* Returns the number of times this 3D polygon contains a point equal to the specified point.
+* @param point the point
+* @return the number of times this 3D polygon contains a point equal to the specified point
+*/
+int GbPolygon3D::containsEqual(GbPoint3D* point)
+{
+   return(this->ps->containsEqual(point));
+}
+/**
+* Returns true, if this 3D polygon contains the specified line.
+* @param point1 the first point
+* @param point2 the second point
+* @return true, if this 3D polygon contains the specified line
+*/
+bool GbPolygon3D::containsLine(GbPoint3D* point1, GbPoint3D* point2)
+{
+   return(this->ps->containsLine(point1, point2));
+}
+/**
+* Returns true, if this 3D polygon contains the specified line.
+* @param line the line
+* @return true, if this 3D polygon contains the specified line
+*/
+bool GbPolygon3D::containsLine(GbLine3D* line)
+{
+   return(this->ps->containsLine(line->getPoint1(), line->getPoint2()));
+}
+/**
+* Returns the first point.
+* @return the first point
+*/
+GbPoint3D* GbPolygon3D::getFirstPoint()
+{
+   return(this->ps->getFirstPoint());
+}
+/**
+* Returns the last point.
+* @return the last point
+*/
+GbPoint3D* GbPolygon3D::getLastPoint()
+{
+   return(this->ps->getLastPoint());
+}
+/**
+* Returns the specified point.
+* @param index the index
+* @return the specified point
+* @exception ArrayIndexOutOfBoundsException if the specified index is not valid
+*/
+GbPoint3D* GbPolygon3D::getPoint(const int& index) 
+{
+   if(index < 0 || index > this->ps->size()) throw UbException(UB_EXARGS,"ArrayIndexOutOfBoundsException-GbPolygon3D.getPoint()");
+   return(this->ps->getPoint(index));
+}
+/**
+* Returns the points.
+* @return the points
+*/
+vector<GbPoint3D> GbPolygon3D::getPoints()
+{
+   if(!this->consistent) this->calculateValues();
+   return(this->points);
+}
+/**
+* Returns the points within the specified rectangle.
+* @param p1 the 1st point of the rectangle
+* @param p2 the 2nd point of the rectangle
+* @return the points within the specified rectangle
+*/
+vector<GbPoint3D> GbPolygon3D::getPoints(GbPoint3D* p1, GbPoint3D* p2)
+{
+   return(this->getPoints(p1->x1, p1->x2, p1->x3, p2->x1, p2->x2, p2->x3));
+}
+/**
+* Returns the points within the specified rectangle.
+* @param p1x1 the 1st x1 coordinate of the rectangle
+* @param p1x2 the 1st x2 coordinate of the rectangle
+* @param p1x3 the 1st x3 coordinate of the rectangle
+* @param p2x1 the 2nd x1 coordinate of the rectangle
+* @param p2x2 the 2nd x2 coordinate of the rectangle
+* @param p2x3 the 2nd x3 coordinate of the rectangle
+* @return the points within the specified rectangle
+*/
+vector<GbPoint3D> GbPolygon3D::getPoints(const double& p1x1, const double& p1x2, const double& p1x3, const double& p2x1, const double& p2x2, const double& p2x3)
+{
+   double x1min, x1max, x2min, x2max, x3min, x3max;
+
+   if(UbMath::less(p1x1, p2x1)) { x1min = p1x1; x1max = p2x1; }
+   else                           { x1min = p2x1; x1max = p1x1; }
+   if(UbMath::less(p1x2, p2x2)) { x2min = p1x2; x2max = p2x2; }
+   else                           { x2min = p2x2; x2max = p1x2; }
+   if(UbMath::less(p1x3, p2x3)) { x3min = p1x3; x3max = p2x3; }
+   else                           { x3min = p2x3; x3max = p1x3; }
+
+   GbSystem3D::PointSet3 *pts = new GbSystem3D::PointSet3(1);
+
+   if(!this->consistent) this->calculateValues();
+   for(int i=this->size()-1; i>=0; i--)
+   {
+      if(UbMath::lessEqual(x1min, (this->points)[i].x1) && UbMath::greaterEqual(x1max, (this->points)[i].x1) &&
+         UbMath::lessEqual(x2min, (this->points)[i].x2) && UbMath::greaterEqual(x2max, (this->points)[i].x2) &&
+         UbMath::lessEqual(x3min, (this->points)[i].x3) && UbMath::greaterEqual(x3max, (this->points)[i].x3))     pts->add((this->points)[i]);
+   }
+   return(pts->getPoints());
+}
+/**
+* Returns the area of this polygon.
+* The area is positive for positive ordered points, otherwise negative.
+* @return the area of this polygon
+*/
+//double getArea()
+//{
+//   if(!this.consistent) this.calculateValues();
+//   return(this.area);
+//}
+double GbPolygon3D::getX1Centroid()
+{
+   if(!this->consistent) this->calculateValues();
+   return(this->x1s);
+}
+double GbPolygon3D::getX1Minimum()
+{
+   if(!this->consistent) this->calculateValues();
+   return(this->x1min);
+}
+double GbPolygon3D::getX1Maximum()
+{
+   if(!this->consistent) this->calculateValues();
+   return(this->x1max);
+}
+double GbPolygon3D::getX2Centroid()
+{
+   if(!this->consistent) this->calculateValues();
+   return(this->x2s);
+}
+double GbPolygon3D::getX2Minimum()
+{
+   if(!this->consistent) this->calculateValues();
+   return(this->x2min);
+}
+double GbPolygon3D::getX2Maximum()
+{
+   if(!this->consistent) this->calculateValues();
+   return(this->x2max);
+}
+double GbPolygon3D::getX3Centroid()
+{
+   if(!this->consistent) this->calculateValues();
+   return(this->x3s);
+}
+double GbPolygon3D::getX3Minimum()
+{
+   if(!this->consistent) this->calculateValues();
+   return(this->x3min);
+}
+double GbPolygon3D::getX3Maximum()
+{
+   if(!this->consistent) this->calculateValues();
+   return(this->x3max);
+}
+
+/**
+* Adds a point to the end of this polygon. Notifies the observers of this 3D polygon.
+* @param point the point
+*/
+void GbPolygon3D::addPoint(GbPoint3D* point)
+{
+   //if((this instanceof GbPolygon3D) && !(point instanceof GbPoint3D)) throw new IllegalArgumentException("GbPolygon3D.addPoint(): points of 3D polygons have to be 3D points!");
+
+   this->ps->add(point);
+   //point.addObserver(this.po);
+   this->consistent = false;
+   //super.notifyObservers();
+}
+/**
+* Adds a number of points to the end of this polygon. Notifies the observers of this 3D polygon.
+* @param points the points
+*/
+void GbPolygon3D::addPoints(vector<GbPoint3D>& points)
+{
+   //if((this instanceof GbPolygon3D) && (points.getClass().getComponentType() != GbPoint3D.class)) throw new IllegalArgumentException("GbPolygon3D.addPoints(): points of 3D polygons have to be 3D points!");
+
+   this->ps->add(points);
+   //for(int i=0; i<points.length; i++) points[i].addObserver(this.po);
+   this->consistent = false;
+   //super.notifyObservers();
+}
+/**
+* Removes all points from this polygon. Notifies the observers of this 3D polygon.
+*/
+void GbPolygon3D::clear()
+{
+   //		delete this->points;
+   this->ps->clearAndTrim();
+   delete this->ps;
+
+   //for(int i=points.length-1; i>=0; i--) points[i].removeObserver(this.po);
+   this->consistent = false;
+   //super.notifyObservers();
+}
+/**
+* Returns a string representation of this 3D polygon.
+* @return a string representation of this 3D polygon
+*/
+string GbPolygon3D::toString()
+{
+   stringstream ss;
+   ss<<"GbPolygon3D[";
+   ss<<this->size()<<" points";
+   ss<<"]"<<endl;
+   for(int u=0; u<this->size(); u++)
+      ss<<this->ps->getPoint(u)->toString()<<endl;
+
+   return(ss.str());
+}
+/*======================================================================*/
+
+void GbPolygon3D::calculateValues()
+{
+   this->x1s        = 0.0;
+   this->x2s        = 0.0;
+   this->x3s        = 0.0;
+   this->x1min      = 0.0;
+   this->x1max      = 0.0;
+   this->x2min      = 0.0;
+   this->x2max      = 0.0;
+   this->x3min      = 0.0;
+   this->x3max      = 0.0;
+   throw UbException(UB_EXARGS,"should be implemented");
+}
+/*======================================================================*/
+
+
diff --git a/src/VirtualFluidsBasics/geometry3d/GbPolygon3D.h b/src/VirtualFluidsBasics/geometry3d/GbPolygon3D.h
new file mode 100644
index 0000000000000000000000000000000000000000..e94f2227d1c6ef8fed69dc4d1a5dbe27c2c70c87
--- /dev/null
+++ b/src/VirtualFluidsBasics/geometry3d/GbPolygon3D.h
@@ -0,0 +1,285 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 GbPolygon3D.h
+//! \ingroup geometry3d
+//! \author Soeren Freudiger, Sebastian Geller
+//=======================================================================================
+#ifndef GBPOLYGON3D_H
+#define GBPOLYGON3D_H
+
+#include <sstream>
+#include <iostream>
+
+
+#include <GbObject3D.h>
+#include <GbLine3D.h>
+#include <GbTriangle3D.h>
+#include <GbSystem3D.h>
+
+#include <PointerDefinitions.h>
+
+
+/*=========================================================================*/
+//! \class GbPolygon2D                                         
+/*                                                                         */
+//! \brief This Class provides basic 3D polygon objects.
+
+class GbPolygon3D : public GbObject3D
+{
+public:
+   using GbObject3D::isPointInGbObject3D; //Grund: dadurch muss man hier  isPointInGbObject3D(GbPoint3D*) nicht ausprogrammieren, welche sonst hier "ueberdeckt" waere
+private:
+   /*======================================================================*/
+   double            x1s  ;
+   double            x2s  ;
+   double            x3s  ;
+   double            x1min;
+   double            x1max;
+   double            x2min;
+   double            x2max;
+   double            x3min;
+   double            x3max;
+
+   std::vector<GbPoint3D> points;
+   bool                   consistent;
+
+   GbSystem3D::PointSet3 *ps;
+   //private PointObserver     po         = null;
+
+   void init();
+
+   /*======================================================================*/
+
+
+   /*======================================================================*/
+   /*  Construcrors                                                       */
+   /*                                                                      */
+   /*
+   * Creates an empty 2D polygon.
+   */
+public:
+   static int counter;
+   GbPolygon3D();
+   /*
+   * Creates an empty 2D polygon with the specified capacity.
+   * @param capacity the initial capacity
+   */
+   GbPolygon3D(int capacity);
+   /*
+   * Creates a 2D polygon with the specified points.
+   * @param points the initial points of the polygon
+   */
+   GbPolygon3D(std::vector<GbPoint3D> &points);
+   /*
+   * Creates a 2D polygon as clone of the specified 2D polygon.
+   * @param polygon the 2D polygon to be cloned
+   */
+   GbPolygon3D(GbPolygon3D *polygon);
+
+   ~GbPolygon3D();
+
+   /*======================================================================*/
+
+
+   /*======================================================================*/
+   /*  Methoden                                                            */
+   /*                                                                      */
+   /*
+   * Creates a 2D polygon as clone of this 2D polygon.
+   */
+   GbPolygon3D* clone() {   return(new GbPolygon3D(this)); }
+   void finalize()
+   {
+      throw UbException(UB_EXARGS,"toDo");
+   }
+
+   /*
+   * Returns the number of points.
+   * @return the number of points
+   */
+   int size();
+   /*
+   * Returns the number of times this 2D polygon contains the specified point.
+   * @param point the point
+   * @return the number of times this 2D polygon contains the specified point
+   */
+   int contains(GbPoint3D *point);
+   /*
+   * Returns the number of times this 2D polygon contains a point equal to the specified point.
+   * @param point the point
+   * @return the number of times this 2D polygon contains a point equal to the specified point
+   */
+   int containsEqual(GbPoint3D* point);
+   /*
+   * Returns true, if this 2D polygon contains the specified line.
+   * @param point1 the first point
+   * @param point2 the second point
+   * @return true, if this 2D polygon contains the specified line
+   */
+   bool containsLine(GbPoint3D* point1, GbPoint3D* point2);
+   /*
+   * Returns true, if this 2D polygon contains the specified line.
+   * @param line the line
+   * @return true, if this 2D polygon contains the specified line
+   */
+   bool containsLine(GbLine3D* line);
+   /*
+   * Returns the first point.
+   * @return the first point
+   */
+   GbPoint3D* getFirstPoint();
+   /*
+   * Returns the last point.
+   * @return the last point
+   */
+   GbPoint3D* getLastPoint();
+   /*
+   * Returns the specified point.
+   * @param index the index
+   * @return the specified point
+   * @exception ArrayIndexOutOfBoundsException if the specified index is not valid
+   */
+   GbPoint3D* getPoint(const int& index);
+   /*
+   * Returns the points.
+   * @return the points
+   */
+   std::vector<GbPoint3D> getPoints();
+   /*
+   * Returns the points within the specified rectangle.
+   * @param p1 the 1st point of the rectangle
+   * @param p2 the 2nd point of the rectangle
+   * @return the points within the specified rectangle
+   */
+   std::vector<GbPoint3D> getPoints(GbPoint3D* p1, GbPoint3D* p2);
+   /*
+   * Returns the points within the specified rectangle.
+   * @param p1x1 the 1st x1 coordinate of the rectangle
+   * @param p1x2 the 1st x2 coordinate of the rectangle
+   * @param p2x1 the 2nd x1 coordinate of the rectangle
+   * @param p2x2 the 2nd x2 coordinate of the rectangle
+   * @return the points within the specified rectangle
+   */
+   std::vector<GbPoint3D> getPoints(const double& p1x1, const double& p1x2, const double& p1x3, const double& p2x1, const double& p2x2, const double& p2x3);
+   /*
+   * Returns the area of this polygon.
+   * The area is positive for positive ordered points, otherwise negative.
+   * @return the area of this polygon
+   */
+   //double getArea()
+   //{
+   //   if(!this.consistent) this.calculateValues();
+   //   return(this.area);
+   //}
+   double getX1Centroid();
+   double getX1Minimum();
+   double getX1Maximum();
+   double getX2Centroid();
+   double getX2Minimum();
+   double getX2Maximum();
+   double getX3Centroid();
+   double getX3Minimum();
+   double getX3Maximum();
+
+   /*
+   * Adds a point to the end of this polygon. Notifies the observers of this 2D polygon.
+   * @param point the point
+   */
+   void addPoint(GbPoint3D* point);
+   /*
+   * Adds a number of points to the end of this polygon. Notifies the observers of this 2D polygon.
+   * @param points the points
+   */
+   void addPoints(std::vector<GbPoint3D>& points);
+   /*
+   * Removes all points from this polygon. Notifies the observers of this 2D polygon.
+   */
+   void clear();
+
+   /*
+   * Returns true if this 2D polygon equals the specified object.
+   * Two polygon are equal, if their points are equal.
+   * <BR>Note that the order of points is recognized!
+   * @return true if this 2D polygon equals the specified object
+   * @see GbPoint2D#equals(java.lang.Object)
+   * @see GbPoint3D#equals(java.lang.Object)
+   */
+   // bool equals(Object object)
+   // {
+   //    try
+   //    {
+   //	GbPolygon2D polygon = (GbPolygon2D) object;
+   //int         n       = this.size();
+
+   //if(n != polygon.size()) return(false);
+   //for(int i=0; i<n; i++) if(!this.getPoint(i).equals(polygon.getPoint(i))) return(false);
+   //return(true);
+   //    }
+   //    catch(Exception e){ return(false); }
+   // }
+   std::vector<GbTriangle3D*> getSurfaceTriangleSet()
+   {
+      std::cout<<"GbPolygon3D::getSurfaceTriangleSet() - not implemented\n";
+      std::vector<GbTriangle3D*> tmp;
+      return tmp;
+   }
+   bool isPointInGbObject3D(const double& x1, const double& x2, const double& x3)
+   {
+      throw UbException(__FILE__, __LINE__, "GbPolygon3D::isPointInObject3D- not implemented");
+   }
+   bool isPointInGbObject3D(const double& x1, const double& x2, const double& x3, bool& pointIsOnBoundary)
+   {
+      throw UbException(__FILE__, __LINE__, "GbPolygon3D::isPointInObject3D- not implemented");
+   }
+   bool isCellInsideGbObject3D(double x11,double x21,double x31,double x12,double x22,double x32) { return false; }
+
+   GbLine3D* createClippedLine3D (GbPoint3D& point1, GbPoint3D &point2)
+   {
+      throw UbException(__FILE__, __LINE__, "GbPolygon3D::createClippedLine3D - not implemented");
+   }                        
+/*
+   * Returns a string representation of this 2D polygon.
+   * @return a string representation of this 2D polygon
+   */
+   std::string toString();
+
+   /*======================================================================*/
+   /*  Private Methoden                                                    */
+   /*                                                                      */
+   void calculateValues();
+   /*======================================================================*/
+};
+/*=========================================================================*/
+#endif
+
+
+
+
+
+
diff --git a/src/VirtualFluidsBasics/geometry3d/GbSystem3D.cpp b/src/VirtualFluidsBasics/geometry3d/GbSystem3D.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..3afca818f5b917bc8012ad552a894b52b5282b1e
--- /dev/null
+++ b/src/VirtualFluidsBasics/geometry3d/GbSystem3D.cpp
@@ -0,0 +1,1218 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 GbSystem3D.cpp
+//! \ingroup geometry3d
+//! \author Soeren Freudiger, Sebastian Geller
+//=======================================================================================
+#include <GbSystem3D.h>
+#include <GbPolygon3D.h>
+#include <GbCuboid3D.h>
+
+using namespace std;
+
+double GbSystem3D::getDistance(const GbPoint3D& p11, const GbPoint3D& p12)
+{
+   double dx1 = p11.x1 - p12.x1;
+   double dx2 = p11.x2 - p12.x2;
+   double dx3 = p11.x3 - p12.x3;
+   return std::sqrt(dx1*dx1+dx2*dx2+dx3*dx3);
+}
+
+GbPoint3D* GbSystem3D::calculateIntersectionPoint3D(GbPoint3D& p11, GbPoint3D& p12, GbPoint3D& p21, GbPoint3D& p22)
+{
+   if(UbMath::less2(p11.x1, p12.x1, p21.x1, p22.x1))    return NULL;
+   if(UbMath::less2(p11.x2, p12.x2, p21.x2, p22.x2))    return NULL;
+   if(UbMath::less2(p11.x3, p12.x3, p21.x3, p22.x3))    return NULL;
+   if(UbMath::greater2(p11.x1, p12.x1, p21.x1, p22.x1)) return NULL;
+   if(UbMath::greater2(p11.x2, p12.x2, p21.x2, p22.x2)) return NULL;
+   if(UbMath::greater2(p11.x3, p12.x3, p21.x3, p22.x3)) return NULL;
+
+   double a11 = p12.x1 - p11.x1;                       //..HOW PARAMETERS ARE USED.........
+   double a12 = p12.x2 - p11.x2;                       //
+   double a13 = p12.x3 - p11.x3;                       //  p11 and p12 represent line 1
+   double a21 = p21.x1 - p22.x1;                       //  p21 and p22 represent line 2
+   double a22 = p21.x2 - p22.x2;                       //
+   double a23 = p21.x3 - p22.x3;                       //..................................
+   double b1  = p21.x1 - p11.x1;
+   double b2  = p21.x2 - p11.x2;
+   double b3  = p21.x3 - p11.x3;
+   double d1  = a11*a22 - a12*a21;
+   double d2  = a11*a23 - a13*a21;
+   double d3  = a12*a23 - a13*a22;
+   double t;
+
+   if(UbMath::zero(d1) && UbMath::zero(d2) && UbMath::zero(d3)) return NULL;
+   if(UbMath::zero(d1))
+   {
+   	if(!UbMath::zero(d2)) t = (a23*b1-a21*b3)/d2;
+      else          t = (a23*b2-a22*b3)/d3;
+   }
+   else if(UbMath::zero(d2))
+   {
+   	if(!UbMath::zero(d1)) t = (a22*b1-a21*b2)/d1;
+      else          t = (a23*b2-a22*b3)/d3;
+   }
+   else if(UbMath::zero(d3))
+   {
+   	if(!UbMath::zero(d1)) t = (a22*b1-a21*b2)/d1;
+      else          t = (a23*b1-a21*b3)/d2;
+   }
+   else return NULL;
+
+   double x1 = p11.x1 + t*a11;
+   double x2 = p11.x2 + t*a12;
+   double x3 = p11.x3 + t*a13;
+
+   if(UbMath::inClosedInterval(x1, p11.x1, p12.x1) && UbMath::inClosedInterval(x1, p21.x1, p22.x1) &&
+      UbMath::inClosedInterval(x2, p11.x2, p12.x2) && UbMath::inClosedInterval(x2, p21.x2, p22.x2) &&
+      UbMath::inClosedInterval(x3, p11.x3, p12.x3) && UbMath::inClosedInterval(x3, p21.x3, p22.x3)    ) return new GbPoint3D(x1, x2, x3);
+
+   return NULL;
+}
+/*=================================================================*/
+//Line1: p11 -> p12 and Line2: p21 -> p22
+bool GbSystem3D::hasIntersectionPoint3D(GbPoint3D& p11, GbPoint3D& p12, GbPoint3D& p21, GbPoint3D& p22)
+{
+   if(UbMath::less2(p11.x1, p12.x1, p21.x1, p22.x1))    return false; 
+   if(UbMath::less2(p11.x2, p12.x2, p21.x2, p22.x2))    return false; 
+   if(UbMath::less2(p11.x3, p12.x3, p21.x3, p22.x3))    return false; 
+   if(UbMath::greater2(p11.x1, p12.x1, p21.x1, p22.x1)) return false; 
+   if(UbMath::greater2(p11.x2, p12.x2, p21.x2, p22.x2)) return false; 
+   if(UbMath::greater2(p11.x3, p12.x3, p21.x3, p22.x3)) return false; 
+
+   double a11 = p12.x1 - p11.x1;                       //..HOW PARAMETERS ARE USED.........
+   double a12 = p12.x2 - p11.x2;                       //
+   double a13 = p12.x3 - p11.x3;                       //  p11 and p12 represent line 1
+   double a21 = p21.x1 - p22.x1;                       //  p21 and p22 represent line 2
+   double a22 = p21.x2 - p22.x2;                       //
+   double a23 = p21.x3 - p22.x3;                       //..................................
+   double b1  = p21.x1 - p11.x1;
+   double b2  = p21.x2 - p11.x2;
+   double b3  = p21.x3 - p11.x3;
+   double d1  = a11*a22 - a12*a21;
+   double d2  = a11*a23 - a13*a21;
+   double d3  = a12*a23 - a13*a22;
+   double t;
+
+   if(UbMath::zero(d1) && UbMath::zero(d2) && UbMath::zero(d3)) return false; 
+   if(UbMath::zero(d1))
+   {
+      if(!UbMath::zero(d2)) t = (a23*b1-a21*b3)/d2;
+      else          t = (a23*b2-a22*b3)/d3;
+   }
+   else if(UbMath::zero(d2))
+   {
+      if(!UbMath::zero(d1)) t = (a22*b1-a21*b2)/d1;
+	   else          t = (a23*b2-a22*b3)/d3;
+   }
+   else if(UbMath::zero(d3))
+   {
+      if(!UbMath::zero(d1)) t = (a22*b1-a21*b2)/d1;
+      else          t = (a23*b1-a21*b3)/d2;
+   }
+   else return false; 
+
+   double x1 = p11.x1 + t*a11;
+   double x2 = p11.x2 + t*a12;
+   double x3 = p11.x3 + t*a13;
+
+   if(UbMath::inClosedInterval(x1, p11.x1, p12.x1) && UbMath::inClosedInterval(x1, p21.x1, p22.x1) &&
+	   UbMath::inClosedInterval(x2, p11.x2, p12.x2) && UbMath::inClosedInterval(x2, p21.x2, p22.x2) &&
+	   UbMath::inClosedInterval(x3, p11.x3, p12.x3) && UbMath::inClosedInterval(x3, p21.x3, p22.x3)) return true; 
+   return false; 
+}
+ /*======================================================================*/
+//
+//
+//   /*======================================================================*/
+//   /*  Private Methoden (Parallelism)                                      */
+//   /*                                                                      */
+bool GbSystem3D::isParallelIn3D(GbPoint3D& p11, GbPoint3D& p12, GbPoint3D& p21, GbPoint3D& p22)
+{
+   double a11 = p12.x1 - p11.x1;                       //..HOW PARAMETERS ARE USED.........
+   double a12 = p12.x2 - p11.x2;                       //
+   double a13 = p12.x3 - p11.x3;                       //  p11 and p12 represent line 1
+   double a21 = p21.x1 - p22.x1;                       //  p21 and p22 represent line 2
+   double a22 = p21.x2 - p22.x2;                       //
+   double a23 = p21.x3 - p22.x3;                       //..................................
+
+   return (UbMath::zero(a11*a22 - a12*a21) && UbMath::zero(a11*a23 - a13*a21) && UbMath::zero(a12*a23 - a13*a22));
+}
+/*======================================================================*/
+
+
+/*======================================================================*/
+/*  General Clipping Methods                                            */
+//......................................................................*/
+//
+//  Method       Parameters                                       Result      Remarks
+//  ---------    ---------------------------------------------    ---------   -------------------
+//  clip###2D   (2D objects to be clipped, 2+2 clipping values)   2D object   clipping x1, x2
+//  clip###3D   (3D objects to be clipped, 2+2 clipping values)   3D object   clipping x1, x2
+//  clip###3D   (3D objects to be clipped, 3+3 clipping values)   3D object   clipping x1, x2, x3
+//  clip###3D   (3D objects to be clipped, 1+1 clipping values)   3D object   clipping x3
+//
+/*======================================================================*/
+/*  Private Methoden (Clipping Lines)                                   */
+/*                                                                      */
+GbLine3D* GbSystem3D::createClipLine3D(GbPoint3D &pA, GbPoint3D &pB, double x1a, double x2a, double x3a, double x1b, double x2b, double x3b)
+{
+   GbPoint3D *p1 = new GbPoint3D(pA);
+   GbPoint3D *p2 = new GbPoint3D(pB);
+
+   if(UbMath::greater(x1a, x1b)) { double x1 = x1a; x1a = x1b; x1b = x1; }
+   if(UbMath::greater(x2a, x2b)) { double x2 = x2a; x2a = x2b; x2b = x2; }
+   if(UbMath::greater(x3a, x3b)) { double x3 = x3a; x3a = x3b; x3b = x3; }
+
+   double f;
+
+   /*-------------------------------------------------------------------*/
+   /*  Schneiden an vorderer Kante                                      */
+   /*                                                                   */
+   if(UbMath::less(p1->x3, x3a))
+   {
+      if(UbMath::less(p2->x3, x3a)) { delete p1; delete p2; return NULL; }
+
+      f       = (x3a-p1->x3)/(p1->x3-p2->x3);
+      p1->x1 += (p1->x1-p2->x1)*f;
+      p1->x2 += (p1->x2-p2->x2)*f;
+      p1->x3  = x3a;
+   }
+   else if(UbMath::less(p2->x3, x3a))
+   {
+      f      = (x3a-p2->x3)/(p2->x3-p1->x3);
+      p2->x1 += (p2->x1-p1->x1)*f;
+      p2->x2 += (p2->x2-p1->x2)*f;
+      p2->x3  = x3a;
+   }     
+   /*-------------------------------------------------------------------*/
+   /*  Schneiden an unterer Kante                                       */
+   /*                                                                   */
+   if(UbMath::less(p1->x2, x2a))
+   {
+      if(UbMath::less(p2->x2, x2a)) { delete p1; delete p2; return NULL;
+      }
+
+      f      = (x2a-p1->x2)/(p1->x2-p2->x2);
+      p1->x1 += (p1->x1-p2->x1)*f;
+      p1->x3 += (p1->x3-p2->x3)*f;
+      p1->x2  = x2a;
+   }
+   else if(UbMath::less(p2->x2, x2a))
+   {
+      f      = (x2a-p2->x2)/(p2->x2-p1->x2);
+      p2->x1 += (p2->x1-p1->x1)*f;
+      p2->x3 += (p2->x3-p1->x3)*f;
+      p2->x2  = x2a;
+   }
+   /*-------------------------------------------------------------------*/
+   /*  Schneiden an rechter Kante                                       */
+   /*                                                                   */
+   if(UbMath::greater(p1->x1, x1b))
+   {
+      if(UbMath::greater(p2->x1, x1b))  { delete p1;delete p2; return NULL;}
+
+      f      = (x1b-p1->x1)/(p1->x1-p2->x1);
+      p1->x2 += (p1->x2-p2->x2)*f;
+      p1->x3 += (p1->x3-p2->x3)*f;
+      p1->x1  = x1b;
+   }
+   else if(UbMath::greater(p2->x1, x1b))
+   {
+      f      = (x1b-p2->x1)/(p2->x1-p1->x1);
+      p2->x2 += (p2->x2-p1->x2)*f;
+      p2->x3 += (p2->x3-p1->x3)*f;
+      p2->x1  = x1b;
+   }
+   /*-------------------------------------------------------------------*/
+   /*  Schneiden an hinterer Kante                                      */
+   /*                                                                   */
+   if(UbMath::greater(p1->x3, x3b))
+   {
+      if(UbMath::greater(p2->x3, x3b))  { delete p1;delete p2; return NULL;}
+
+      f      = (x3b-p1->x3)/(p1->x3-p2->x3);
+      p1->x1 += (p1->x1-p2->x1)*f;
+      p1->x2 += (p1->x2-p2->x2)*f;
+      p1->x3  = x3b;
+   }
+   else if(UbMath::greater(p2->x3, x3b))
+   {
+      f      = (x3b-p2->x3)/(p2->x3-p1->x3);
+      p2->x1 += (p2->x1-p1->x1)*f;
+      p2->x2 += (p2->x2-p1->x2)*f;
+      p2->x3  = x3b;
+   }
+   /*-------------------------------------------------------------------*/
+   /*  Schneiden an oberer Kante                                        */
+   /*                                                                   */
+   if(UbMath::greater(p1->x2, x2b))
+   {
+      if(UbMath::greater(p2->x2, x2b))  { delete p1;delete p2; return NULL;}
+
+      f      = (x2b-p1->x2)/(p1->x2-p2->x2);
+      p1->x1 += (p1->x1-p2->x1)*f;
+      p1->x3 += (p1->x3-p2->x3)*f;
+      p1->x2  = x2b;
+   }
+   else if(UbMath::greater(p2->x2, x2b))
+   {
+      f      = (x2b-p2->x2)/(p2->x2-p1->x2);
+      p2->x1 += (p2->x1-p1->x1)*f;
+      p2->x3 += (p2->x3-p1->x3)*f;
+      p2->x2  = x2b;
+   }
+   /*-------------------------------------------------------------------*/
+   /*  Schneiden an linker Kante                                        */
+   /*                                                                   */
+   if(UbMath::less(p1->x1, x1a))
+   {
+      if(UbMath::less(p2->x1, x1a))  { delete p1;delete p2; return NULL;}
+
+      f      = (x1a-p1->x1)/(p1->x1-p2->x1);
+      p1->x2 += (p1->x2-p2->x2)*f;
+      p1->x3 += (p1->x3-p2->x3)*f;
+      p1->x1  = x1a;
+   }
+   else if(UbMath::less(p2->x1, x1a))
+   {
+      f      = (x1a-p2->x1)/(p2->x1-p1->x1);
+      p2->x2 += (p2->x2-p1->x2)*f;
+      p2->x3 += (p2->x3-p1->x3)*f;
+      p2->x1  = x1a;
+   }
+   /*-------------------------------------------------------------------*/
+   return new GbLine3D(p1, p2);
+}
+//   /*======================================================================*/
+//   /*  Private Methoden (Clipping Rectangles)                              */
+//   /*                                                                      */
+//   final static GbPolygon3D clipPolygon3D(GbPoint3D points[], double x11, double x12, double x21, double x22)
+//   {
+//      GbPoint3D last = null;
+//      PointSet3 ps   = new PointSet3(points);
+//      boolean   flag = false;
+//      int       n    = points.length;
+//      int       i;
+//      double    f;
+//
+//      if(n == 0)              return(null);
+//      if(greater(x11, x21)) { double ax = x11; x11 = x21; x21 = ax; }
+//      if(greater(x12, x22)) { double ay = x12; x12 = x22; x22 = ay; }
+//
+//      /*-------------------------------------------------------------------*/
+//      /*  Schneiden an unterer Kante                                       */
+//      /*                                                                   */
+//      if(less(ps.getX2Minimum(), x12))
+//      {
+//	 ps.clear();
+//	 last = points[0];
+//	 if(less((*points)[0]->x2, x12)) flag = false;
+//	 else
+//	 {
+//	    ps.add(points[0]);
+//	    flag = true;
+//	 }
+//	 for(i=1; i<n; i++)
+//	 {
+//	    if(less((*points)[i]->x2, x12))
+//	    {
+//	       if(flag)
+//	       {
+//	          f = (x12-(*points)[i]->x2)/((*points)[i]->x2-last->x2);
+//	          ps.add(new GbPoint3D((*points)[i]->x1 + ((*points)[i]->x1-last->x1)*f, x12, (*points)[i]->x3 + ((*points)[i]->x3-last->x3)*f));
+//	       }
+//	       flag = false;
+//	    }
+//	    else
+//	    {
+//	       if(!flag)
+//	       {
+//	          f = (x12-(*points)[i]->x2)/((*points)[i]->x2-last->x2);
+//	          ps.add(new GbPoint3D((*points)[i]->x1 + ((*points)[i]->x1-last->x1)*f, x12, (*points)[i]->x3 + ((*points)[i]->x3-last->x3)*f));
+//	       }
+//	       ps.add((*points)[i]);
+//	       flag = true;
+//	    }
+//	    last = points[i];
+//	 }
+//	 if(!((less(points[0].x2, x12)) ^ flag))
+//	 {
+//	    f = (x12-points[0].x2)/(points[0].x2-last->x2);
+//	    ps.add(new GbPoint3D(points[0].x1 + (points[0].x1-last->x1)*f, x12, points[0].x3 + (points[0].x3-last->x3)*f));
+//	 }
+//
+//	 points = ps.getPoints();
+//	 n      = points.length;
+//
+//	 if(n == 0) return(null);
+//      }
+//      /*-------------------------------------------------------------------*/
+//      /*  Schneiden an rechter Kante                                       */
+//      /*                                                                   */
+//      if(greater(ps.getX1Maximum(), x21))
+//      {
+//	 ps.clear();
+//	 last = points[0];
+//	 if(greater(points[0].x1, x21)) flag = false;
+//	 else
+//	 {
+//	    ps.add(points[0]);
+//	    flag = true;
+//	 }
+//	 for(i=1; i<n; i++)
+//	 {
+//	    if(greater((*points)[i]->x1, x21))
+//	    {
+//	       if(flag)
+//	       {
+//	          f = (x21-(*points)[i]->x1)/((*points)[i]->x1-last->x1);
+//	          ps.add(new GbPoint3D(x21, (*points)[i]->x2 + ((*points)[i]->x2-last->x2)*f, (*points)[i]->x3 + ((*points)[i]->x3-last->x3)*f));
+//	       }
+//	       flag = false;
+//	    }
+//	    else
+//	    {
+//	       if(!flag)
+//	       {
+//	          f = (x21-(*points)[i]->x1)/((*points)[i]->x1-last->x1);
+//	          ps.add(new GbPoint3D(x21, (*points)[i]->x2 + ((*points)[i]->x2-last->x2)*f, (*points)[i]->x3 + ((*points)[i]->x3-last->x3)*f));
+//	       }
+//	       ps.add(points[i]);
+//	       flag = true;
+//	    }
+//	    last = points[i];
+//	 }
+//	 if(!((greater(points[0].x1, x21)) ^ flag))
+//	 {
+//	    f = (x21-points[0].x1)/(points[0].x1-last.x1);
+//	    ps.add(new GbPoint3D(x21, points[0].x2 + (points[0].x2-last.x2)*f, points[0].x3 + (points[0].x3-last.x3)*f));
+//	 }
+//
+//	 points = ps.getPoints();
+//	 n      = points.length;
+//
+//	 if(n == 0) return(null);
+//      }
+//      /*-------------------------------------------------------------------*/
+//      /*  Schneiden an oberer Kante                                        */
+//      /*                                                                   */
+//      if(greater(ps.getX2Maximum(), x22))
+//      {
+//	 ps.clear();
+//	 last = points[0];
+//	 if(greater(points[0].x2, x22)) flag = false;
+//	 else
+//	 {
+//	    ps.add(points[0]);
+//	    flag = true;
+//	 }
+//	 for(i=1; i<n; i++)
+//	 {
+//	    if(greater((*points)[i]->x2, x22))
+//	    {
+//	       if(flag)
+//	       {
+//	          f = (x22-(*points)[i]->x2)/(points[i].x2-last.x2);
+//	          ps.add(new GbPoint3D(points[i].x1 + (points[i].x1-last.x1)*f, x22, points[i].x3 + (points[i].x3-last.x3)*f));
+//	       }
+//	       flag = false;
+//	    }
+//	    else
+//	    {
+//	       if(!flag)
+//	       {
+//	          f = (x22-points[i].x2)/(points[i].x2-last.x2);
+//	          ps.add(new GbPoint3D(points[i].x1 + (points[i].x1-last.x1)*f, x22, points[i].x3 + (points[i].x3-last.x3)*f));
+//	       }
+//	       ps.add(points[i]);
+//	       flag = true;
+//	    }
+//	    last = points[i];
+//	 }
+//	 if(!((greater(points[0].x2, x22)) ^ flag))
+//	 {
+//	    f = (x22-points[0].x2)/(points[0].x2-last.x2);
+//	    ps.add(new GbPoint3D(points[0].x1 + (points[0].x1-last.x1)*f, x22, points[0].x3 + (points[0].x3-last.x3)*f));
+//	 }
+//
+//	 points = ps.getPoints();
+//	 n      = points.length;
+//
+//	 if(n == 0) return(null);
+//      }
+//      /*-------------------------------------------------------------------*/
+//      /*  Schneiden an linker Kante                                        */
+//      /*                                                                   */
+//      if(less(ps.getX1Minimum(), x11))
+//      {
+//	 ps.clear();
+//	 last = points[0];
+//	 if(less(points[0].x1, x11)) flag = false;
+//	 else
+//	 {
+//	    ps.add(points[0]);
+//	    flag = true;
+//	 }
+//	 for(i=1; i<n; i++)
+//	 {
+//	    if(less(points[i].x1, x11))
+//	    {
+//	       if(flag)
+//	       {
+//	          f = (x11-points[i].x1)/(points[i].x1-last.x1);
+//	          ps.add(new GbPoint3D(x11, points[i].x2 + (points[i].x2-last.x2)*f, points[i].x3 + (points[i].x3-last.x3)*f));
+//	       }
+//	       flag = false;
+//	    }
+//	    else
+//	    {
+//	       if(!flag)
+//	       {
+//	          f = (x11-points[i].x1)/(points[i].x1-last.x1);
+//	          ps.add(new GbPoint3D(x11, points[i].x2 + (points[i].x2-last.x2)*f, points[i].x3 + (points[i].x3-last.x3)*f));
+//	       }
+//	       ps.add(points[i]);
+//	       flag = true;
+//	    }
+//	    last = points[i];
+//	 }
+//	 if(!((less(points[0].x1, x11)) ^ flag))
+//	 {
+//	    f = (x11-points[0].x1)/(points[0].x1-last.x1);
+//	    ps.add(new GbPoint3D(x11, points[0].x2 + (points[0].x2-last.x2)*f, points[0].x3 + (points[0].x3-last.x3)*f));
+//	 }
+//
+//	 points = ps.getPoints();
+//	 n      = points.length;
+//
+//	 if(n == 0) return(null);
+//      }
+//      /*-------------------------------------------------------------------*/
+//      GbPolygon3D polygon = new GbPolygon3D(points);
+//
+//      if(n > 2)
+//      {
+//	 for(i=2; i<n; i++) if(zero(i_TA(points[i-2], points[i-1], points[i]))) polygon.deletePoint(points[i-1]);
+//	 if(zero(i_TA(points[n-2], points[n-1], points[0]))) polygon.deletePoint(points[n-1]);
+//	 if(zero(i_TA(points[n-1], points[0],   points[1]))) polygon.deletePoint(points[0]);
+//      }
+//      return(polygon);
+//   }
+//   final static GbPolygon3D clipPolygon3D(GbPoint3D points[], double x13, double x23)
+//   {
+//      GbPoint3D last = null;
+//      PointSet3 ps   = new PointSet3(points);
+//      boolean   flag = false;
+//      int       n    = points.length;
+//      int       i;
+//      double    f;
+//
+//      if(n == 0)              return(null);
+//      if(greater(x13, x23)) { double az = x13; x13 = x23; x23 = az; }
+//
+//      /*-------------------------------------------------------------------*/
+//      /*  Schneiden an vorderer Kante                                      */
+//      /*                                                                   */
+//      if(less(ps.getX3Minimum(), x13))
+//      {
+//	 ps.clear();
+//	 last = points[0];
+//	 if(less(points[0].x3, x13)) flag = false;
+//	 else
+//	 {
+//	    ps.add(points[0]);
+//	    flag = true;
+//	 }
+//	 for(i=1; i<n; i++)
+//	 {
+//	    if(less(points[i].x3, x13))
+//	    {
+//	       if(flag)
+//	       {
+//	          f = (x13-points[i].x3)/(points[i].x3-last.x3);
+//	          ps.add(new GbPoint3D(points[i].x1 + (points[i].x1-last.x1)*f, points[i].x2 + (points[i].x2-last.x2)*f, x13));
+//	       }
+//	       flag = false;
+//	    }
+//	    else
+//	    {
+//	       if(!flag)
+//	       {
+//	          f = (x13-points[i].x3)/(points[i].x3-last.x3);
+//	          ps.add(new GbPoint3D(points[i].x1 + (points[i].x1-last.x1)*f, points[i].x2 + (points[i].x2-last.x2)*f, x13));
+//	       }
+//	       ps.add(points[i]);
+//	       flag = true;
+//	    }
+//	    last = points[i];
+//	 }
+//	 if(!((less(points[0].x3, x13)) ^ flag))
+//	 {
+//	    f = (x13-points[0].x3)/(points[0].x3-last.x3);
+//	    ps.add(new GbPoint3D(points[0].x1 + (points[0].x1-last.x1)*f, points[0].x2 + (points[0].x2-last.x2)*f, x13));
+//	 }
+//
+//	 points = ps.getPoints();
+//	 n      = points.length;
+//
+//	 if(n == 0) return(null);
+//      }
+//      /*-------------------------------------------------------------------*/
+//      /*  Schneiden an hinterer Kante                                      */
+//      /*                                                                   */
+//      if(greater(ps.getX3Maximum(), x23))
+//      {
+//	 ps.clear();
+//	 last = points[0];
+//	 if(greater(points[0].x3, x23)) flag = false;
+//	 else
+//	 {
+//	    ps.add(points[0]);
+//	    flag = true;
+//	 }
+//	 for(i=1; i<n; i++)
+//	 {
+//	    if(greater(points[i].x3, x23))
+//	    {
+//	       if(flag)
+//	       {
+//	          f = (x23-points[i].x3)/(points[i].x3-last.x3);
+//	          ps.add(new GbPoint3D(points[i].x1 + (points[i].x1-last.x1)*f, points[i].x2 + (points[i].x2-last.x2)*f, x23));
+//	       }
+//	       flag = false;
+//	    }
+//	    else
+//	    {
+//	       if(!flag)
+//	       {
+//	          f = (x23-points[i].x3)/(points[i].x3-last.x3);
+//	          ps.add(new GbPoint3D(points[i].x1 + ((*points)[i]->x1-last.x1)*f, (*points)[i]->x2 + ((*points)[i]->x2-last.x2)*f, x23));
+//	       }
+//	       ps.add(points[i]);
+//	       flag = true;
+//	    }
+//	    last = points[i];
+//	 }
+//	 if(!((greater(points[0].x3, x23)) ^ flag))
+//	 {
+//	    f = (x23-points[0].x3)/(points[0].x3-last.x3);
+//	    ps.add(new GbPoint3D(points[0].x1 + (points[0].x1-last.x1)*f, points[0].x2 + (points[0].x2-last.x2)*f, x23));
+//	 }
+//
+//	 points = ps.getPoints();
+//	 n      = points.length;
+//
+//	 if(n == 0) return(null);
+//      }
+//      /*-------------------------------------------------------------------*/
+//      GbPolygon3D polygon = new GbPolygon3D(points);
+//
+//      return(polygon);
+//   }
+GbPolygon3D* GbSystem3D::clipPolygon3D(vector<GbPoint3D> points, double x11, double x12, double x13, double x21, double x22, double x23)
+{
+   GbPoint3D last;
+   PointSet3 ps(points);
+   bool   flag = false;
+   int    n    = (int)points.size();
+	int       i;
+   double    f;
+
+   if(n == 0)              return NULL;
+   if(UbMath::greater(x11, x21)) { double ax = x11; x11 = x21; x21 = ax; }
+   if(UbMath::greater(x12, x22)) { double ay = x12; x12 = x22; x22 = ay; }
+   if(UbMath::greater(x13, x23)) { double az = x13; x13 = x23; x23 = az; }
+
+   /*-------------------------------------------------------------------*/
+   /*  Schneiden an vorderer Kante                                      */
+   /*                                                                   */
+   if(UbMath::less(ps.getX3Minimum(), x13))
+   {
+		ps.clear();
+		last = (points)[0];
+		if(UbMath::less((points)[0].x3, x13)) flag = false;
+		else
+		{
+			ps.add((points)[0]);
+			flag = true;
+		}
+		for(i=1; i<n; i++)
+		{
+			if(UbMath::less((points)[i].x3, x13))
+			{
+				if(flag)
+				{
+					f = (x13-(points)[i].x3)/((points)[i].x3-last.x3);
+					ps.add(GbPoint3D((points)[i].x1 + ((points)[i].x1-last.x1)*f, (points)[i].x2 + ((points)[i].x2-last.x2)*f, x13));
+				}
+				flag = false;
+			}
+			else
+			{
+				if(!flag)
+				{
+					f = (x13-(points)[i].x3)/((points)[i].x3-last.x3);
+					ps.add(GbPoint3D((points)[i].x1 + ((points)[i].x1-last.x1)*f, (points)[i].x2 + ((points)[i].x2-last.x2)*f, x13));
+				}
+				ps.add((points)[i]);
+				flag = true;
+			}
+			last = (points)[i];
+		}
+		if(!((UbMath::less((points)[0].x3, x13)) ^ flag))
+		{
+			f = (x13-(points)[0].x3)/((points)[0].x3-last.x3);
+			ps.add(GbPoint3D((points)[0].x1 + ((points)[0].x1-last.x1)*f, (points)[0].x2 + ((points)[0].x2-last.x2)*f, x13));
+		}
+
+		points = ps.getPoints();
+		n      = (int)points.size();
+
+		if(n == 0) return NULL;
+   }
+	
+	/*-------------------------------------------------------------------*/
+   /*  Schneiden an unterer Kante                                       */
+   /*                                                                   */
+   if(UbMath::less(ps.getX2Minimum(), x12))
+   {
+		ps.clear();
+		last = (points)[0];
+		if(UbMath::less((points)[0].x2, x12)) flag = false;
+		else
+		{
+			ps.add((points)[0]);
+			flag = true;
+		}
+		for(i=1; i<n; i++)
+		{
+			if(UbMath::less((points)[i].x2, x12))
+			{
+				if(flag)
+				{
+					f = (x12-(points)[i].x2)/((points)[i].x2-last.x2);
+					ps.add(GbPoint3D((points)[i].x1 + ((points)[i].x1-last.x1)*f, x12, (points)[i].x3 + ((points)[i].x3-last.x3)*f));
+				}
+				flag = false;
+			}
+		   else
+			{
+				if(!flag)
+				{
+					f = (x12-(points)[i].x2)/((points)[i].x2-last.x2);
+					ps.add(GbPoint3D((points)[i].x1 + ((points)[i].x1-last.x1)*f, x12, (points)[i].x3 + ((points)[i].x3-last.x3)*f));
+				}
+				ps.add((points)[i]);
+				flag = true;
+			}
+			last = (points)[i];
+		}
+		if(!((UbMath::less((points)[0].x2, x12)) ^ flag))
+		{
+			f = (x12-(points)[0].x2)/((points)[0].x2-last.x2);
+			ps.add(GbPoint3D((points)[0].x1 + ((points)[0].x1-last.x1)*f, x12, (points)[0].x3 + ((points)[0].x3-last.x3)*f));
+		}
+
+		points = ps.getPoints();
+		n      = (int)points.size();
+
+		if(n == 0) return NULL;
+   }
+   /*-------------------------------------------------------------------*/
+   /*  Schneiden an rechter Kante                                       */
+   /*                                                                   */
+	
+	if(UbMath::greater(ps.getX1Maximum(), x21))
+   {
+		ps.clear();
+		last = (points)[0];
+		if(UbMath::greater((points)[0].x1, x21)) flag = false;
+		else
+		{
+			ps.add((points)[0]);
+			flag = true;
+		}
+		for(i=1; i<n; i++)
+		{
+			if(UbMath::greater((points)[i].x1, x21))
+			{
+				if(flag)
+				{
+					f = (x21-(points)[i].x1)/((points)[i].x1-last.x1);
+					ps.add(GbPoint3D(x21, (points)[i].x2 + ((points)[i].x2-last.x2)*f, (points)[i].x3 + ((points)[i].x3-last.x3)*f));
+				}
+				flag = false;
+			}
+			else
+			{
+				if(!flag)
+				{
+					f = (x21-(points)[i].x1)/((points)[i].x1-last.x1);
+					ps.add(GbPoint3D(x21, (points)[i].x2 + ((points)[i].x2-last.x2)*f, (points)[i].x3 + ((points)[i].x3-last.x3)*f));
+				}
+				ps.add((points)[i]);
+				flag = true;
+			}
+			last = (points)[i];
+		}
+		if(!((UbMath::greater((points)[0].x1, x21)) ^ flag))
+		{
+			f = (x21-(points)[0].x1)/((points)[0].x1-last.x1);
+			ps.add(GbPoint3D(x21, (points)[0].x2 + ((points)[0].x2-last.x2)*f, (points)[0].x3 + ((points)[0].x3-last.x3)*f));
+		}
+
+		points = ps.getPoints();
+		n      = (int)points.size();
+
+		if(n == 0) return NULL;
+   }
+   /*-------------------------------------------------------------------*/
+   /*  Schneiden an hinterer Kante                                      */
+   /*                                                                   */
+   if(UbMath::greater(ps.getX3Maximum(), x23))
+   {
+		ps.clear();
+		last = (points)[0];
+		if(UbMath::greater((points)[0].x3, x23)) flag = false;
+		else
+		{
+			ps.add((points)[0]);
+			flag = true;
+		}
+		for(i=1; i<n; i++)
+		{
+			if(UbMath::greater((points)[i].x3, x23))
+			{
+				if(flag)
+				{
+					f = (x23-(points)[i].x3)/((points)[i].x3-last.x3);
+					ps.add(GbPoint3D((points)[i].x1 + ((points)[i].x1-last.x1)*f, (points)[i].x2 + ((points)[i].x2-last.x2)*f, x23));
+				}
+				flag = false;
+			}
+			else
+			{
+				if(!flag)
+				{
+					f = (x23-(points)[i].x3)/((points)[i].x3-last.x3);
+					ps.add(GbPoint3D((points)[i].x1 + ((points)[i].x1-last.x1)*f, (points)[i].x2 + ((points)[i].x2-last.x2)*f, x23));
+				}
+				ps.add((points)[i]);
+				flag = true;
+			}
+			last = (points)[i];
+		}
+		if(!((UbMath::greater((points)[0].x3, x23)) ^ flag))
+		{
+			f = (x23-(points)[0].x3)/((points)[0].x3-last.x3);
+			ps.add(GbPoint3D((points)[0].x1 + ((points)[0].x1-last.x1)*f, (points)[0].x2 + ((points)[0].x2-last.x2)*f, x23));
+		}
+
+		points = ps.getPoints();
+		n      = (int)points.size();
+
+		if(n == 0) return NULL;
+	}
+   /*-------------------------------------------------------------------*/
+   /*  Schneiden an oberer Kante                                        */
+   /*                                                                   */
+
+	if(UbMath::greater(ps.getX2Maximum(), x22))
+   {
+		ps.clear();
+		last = (points)[0];
+		if(UbMath::greater((points)[0].x2, x22)) flag = false;
+		else
+		{
+			ps.add((points)[0]);
+			flag = true;
+		}
+		for(i=1; i<n; i++)
+		{
+			if(UbMath::greater((points)[i].x2, x22))
+			{
+				if(flag)
+				{
+					f = (x22-(points)[i].x2)/((points)[i].x2-last.x2);
+					ps.add(GbPoint3D((points)[i].x1 + ((points)[i].x1-last.x1)*f, x22, (points)[i].x3 + ((points)[i].x3-last.x3)*f));
+				}
+				flag = false;
+			}
+			else
+			{
+				if(!flag)
+				{
+					f = (x22-(points)[i].x2)/((points)[i].x2-last.x2);
+					ps.add(GbPoint3D((points)[i].x1 + ((points)[i].x1-last.x1)*f, x22, (points)[i].x3 + ((points)[i].x3-last.x3)*f));
+				}
+				ps.add((points)[i]);
+				flag = true;
+			}
+			last = (points)[i];
+		}
+		if(!((UbMath::greater((points)[0].x2, x22)) ^ flag))
+		{
+			f = (x22-(points)[0].x2)/((points)[0].x2-last.x2);
+			ps.add(GbPoint3D((points)[0].x1 + ((points)[0].x1-last.x1)*f, x22, (points)[0].x3 + ((points)[0].x3-last.x3)*f));
+		}
+
+		points = ps.getPoints();
+		n      = (int)points.size();
+
+		if(n == 0) return NULL;
+   }
+   /*-------------------------------------------------------------------*/
+   /*  Schneiden an linker Kante                                        */
+   /*                                                                   */
+	if(UbMath::less(ps.getX1Minimum(), x11))
+   {
+		ps.clear();
+		last = (points)[0];
+		if(UbMath::less((points)[0].x1, x11)) flag = false;
+		else
+		{
+			ps.add((points)[0]);
+			flag = true;
+		}
+		for(i=1; i<n; i++)
+		{
+			if(UbMath::less((points)[i].x1, x11))
+			{
+				if(flag)
+				{
+					f = (x11-(points)[i].x1)/((points)[i].x1-last.x1);
+					ps.add(GbPoint3D(x11, (points)[i].x2 + ((points)[i].x2-last.x2)*f, (points)[i].x3 + ((points)[i].x3-last.x3)*f));
+
+				}
+				flag = false;
+			}
+			else
+			{
+				if(!flag)
+				{
+					f = (x11-(points)[i].x1)/((points)[i].x1-last.x1);
+					ps.add(GbPoint3D(x11, (points)[i].x2 + ((points)[i].x2-last.x2)*f, (points)[i].x3 + ((points)[i].x3-last.x3)*f));
+				}
+				ps.add((points)[i]);
+				flag = true;
+			}
+			last = (points)[i];
+		}
+		if(!((UbMath::less((points)[0].x1, x11)) ^ flag))
+		{
+			f = (x11-(points)[0].x1)/((points)[0].x1-last.x1);
+			ps.add(GbPoint3D(x11, (points)[0].x2 + ((points)[0].x2-last.x2)*f, (points)[0].x3 + ((points)[0].x3-last.x3)*f));
+		}
+
+		points = ps.getPoints();
+		n      = (int)points.size();
+		
+		if(n == 0) return NULL;
+   }
+   /*-------------------------------------------------------------------*/
+	return new GbPolygon3D(points);
+}
+/*=========================================================================*/
+GbCuboid3D* GbSystem3D::clipRectangle3D(GbPoint3D& p1, GbPoint3D& p2, double x11, double x12, double x13, double x21, double x22, double x23)
+{
+   double r11 = p1.x1;
+   double r12 = p1.x2;
+   double r13 = p1.x3;
+   double r21 = p2.x1;
+   double r22 = p2.x2;
+   double r23 = p2.x3;
+
+   if(UbMath::greater(x11, x21)) { double ax = x11; x11 = x21; x21 = ax; }
+   if(UbMath::greater(x12, x22)) { double ay = x12; x12 = x22; x22 = ay; }
+   if(UbMath::greater(x13, x23)) { double az = x13; x13 = x23; x23 = az; }
+   if(UbMath::greater(r11, r21)) { double bx = r11; r11 = r21; r21 = bx; }
+   if(UbMath::greater(r12, r22)) { double by = r12; r12 = r22; r22 = by; }
+   if(UbMath::greater(r13, r23)) { double bz = r13; r13 = r23; r23 = bz; }
+
+   double m11 = UbMath::greater(x11, r11) ? x11 : r11;
+   double m12 = UbMath::greater(x12, r12) ? x12 : r12;
+   double m13 = UbMath::greater(x13, r13) ? x13 : r13;
+   double m21 = UbMath::greater(x21, r21) ? r21 : x21;
+   double m22 = UbMath::greater(x22, r22) ? r22 : x22;
+   double m23 = UbMath::greater(x23, r23) ? r23 : x23;
+
+   if(UbMath::lessEqual(m11, m21) && UbMath::lessEqual(m12, m22) && UbMath::lessEqual(m13, m23)) 
+      return(new GbCuboid3D(new GbPoint3D(m11, m12, m13), new GbPoint3D(m21, m22, m23)));
+   else  
+      return(NULL);
+}
+
+/*=========================================================================*/
+/*=========================================================================*/
+/*=========================================================================*/
+
+
+GbSystem3D::PointSet3::PointSet3(int n)
+{
+   this->init();
+   this->points.reserve(n); //reserves n elements! but the size of the vector ist still "0"
+}
+/*=======================================================*/
+GbSystem3D::PointSet3::PointSet3(const vector<GbPoint3D>& points)
+{
+   this->init();
+   this->add(points);
+}
+/*=======================================================*/
+void GbSystem3D::PointSet3::add(const GbPoint3D& point)
+{
+   //is point equal to last point in points then return
+   if(!this->points.empty() && point.equals(&this->points.back())) return;    //WHY???
+
+   //push point to vector
+   this->points.push_back(point);
+
+   this->consistent = false;
+}
+/*=======================================================*/
+void GbSystem3D::PointSet3::addUnequal(const GbPoint3D& point)
+{
+   if(this->containsEqual(point) > 0) return;
+   
+   this->points.push_back(point);
+   this->consistent = false;
+}
+/*=======================================================*/
+void GbSystem3D::PointSet3::add(const vector<GbPoint3D>& pointVector)
+{
+   for(int pos=0; pos<(int)pointVector.size(); pos++ )
+      this->points.push_back(pointVector[pos]);
+
+   this->consistent = false;
+}
+/*=======================================================*/
+void GbSystem3D::PointSet3::insert(const GbPoint3D& point, int index)
+{
+   if(index<0 || index>=(int)this->points.size()) 
+      throw UbException(UB_EXARGS,"index out of range");
+
+   //get iterator for index-position
+   vector<GbPoint3D>::iterator pos=this->points.begin();
+   for(int i=1; i<=index; i++) ++pos;
+
+   //insert point
+   this->points.insert(pos,point);
+
+   this->consistent    = false;
+}
+/*=======================================================*/
+//void delete(GbPoint3D point)
+//{
+//   for(int i=this.size-1; i>=0; i--) if(this.points[i] == point) this.delete(i);
+//}
+/*=======================================================*/
+//void delete(int index)
+//{
+//   int j = this.size - index - 1;
+//   if(j > 0) System.arraycopy(this.points, index + 1, this.points, index, j);
+//   this.consistent = false;
+//   this.size--;
+//}
+/*=======================================================*/
+void GbSystem3D::PointSet3::clear()
+{
+   //clears points (size==0 but capacity is the old c1)
+   this->points.clear();
+   this->consistent = false;
+}
+/*=======================================================*/
+void GbSystem3D::PointSet3::clearAndTrim()
+{
+   //clears points (size==0 AND capacity==0)
+   this->points.resize(0);
+   this->consistent = false;
+}
+/*=======================================================*/
+double GbSystem3D::PointSet3::getX1Minimum()
+{
+   if(!this->consistent) this->calculateValues();
+   return this->x1min;
+}
+/*=======================================================*/
+double GbSystem3D::PointSet3::getX1Maximum()
+{
+   if(!this->consistent) this->calculateValues();
+   return this->x1max;
+}
+/*=======================================================*/
+double GbSystem3D::PointSet3::getX2Minimum()
+{
+   if(!this->consistent) this->calculateValues();
+   return this->x2min;
+}
+/*=======================================================*/
+double GbSystem3D::PointSet3::getX2Maximum()
+{
+   if(!this->consistent) this->calculateValues();
+   return this->x2max;
+}
+/*=======================================================*/
+double GbSystem3D::PointSet3::getX3Minimum()
+{
+   if(!this->consistent) this->calculateValues();
+   return this->x3min;
+}
+/*=======================================================*/
+double GbSystem3D::PointSet3::getX3Maximum()
+{
+   if(!this->consistent) this->calculateValues();
+   return this->x3max;
+}
+/*=======================================================*/
+int GbSystem3D::PointSet3::contains(GbPoint3D* point)
+{
+   //returns number of points which has the same adress (this should be 0 or 1!!!)
+   int n=0;
+
+   for(int pos=(int)this->points.size()-1; pos>=0; pos--) 
+      if(&this->points[pos]==point) n++;
+
+   return n;
+}
+/*=======================================================*/
+int GbSystem3D::PointSet3::containsEqual(const GbPoint3D& point)
+{
+   //returns number of points which have the same coordinates with point (could be 0,1 or even more)
+   int n=0;
+
+   for(int pos=(int)this->points.size()-1; pos>=0; pos--) 
+      if(this->points[pos].equals(&point)) n++;
+
+   return n;
+}
+/*=======================================================*/
+bool GbSystem3D::PointSet3::containsLine(GbPoint3D *point1, GbPoint3D *point2)
+{
+   //returns true if pointset has c2 in "this->points"vector  neighboured points 
+   //wich have the same adress as point1 or point2
+   vector<GbPoint3D>::iterator pos1=this->points.begin();
+   vector<GbPoint3D>::iterator pos2;
+
+   for(pos2=pos1++; pos2!=this->points.end(); ++pos2) 
+   {
+      if     (&(*pos1)==point1 && &(*pos2)==point2) return true;
+      else if(&(*pos1)==point2 && &(*pos2)==point1) return true;
+
+      pos1=pos2;
+   }
+
+   return false;
+}
+/*=======================================================*/
+bool GbSystem3D::PointSet3::containsEqualLine(const GbPoint3D& point1, const GbPoint3D& point2)
+{
+   //returns true if pointset has c2 in "this->points"vector  neighboured points 
+   //wich have the same coordinates as point1 or point2
+   vector<GbPoint3D>::iterator pos1=this->points.begin();
+   vector<GbPoint3D>::iterator pos2;
+
+   for(pos2=pos1++; pos2!=this->points.end(); ++pos2) 
+   {
+      if     ((*pos1).equals(&point1) && (*pos2).equals(&point2)) return true;
+      else if((*pos1).equals(&point2) && (*pos2).equals(&point1)) return true;
+
+      pos1=pos2;
+   }
+
+   return false;
+}
+/*=======================================================*/
+GbPoint3D* GbSystem3D::PointSet3::getPoint(int index)
+{
+   if(index<0 || index>=(int)this->points.size()) throw UbException(UB_EXARGS,"index out of range");
+   return &(this->points)[index];
+}
+/*=======================================================*/
+GbPoint3D* GbSystem3D::PointSet3::getFirstPoint()
+{
+   return &(this->points.front());
+}
+/*=======================================================*/
+GbPoint3D* GbSystem3D::PointSet3::getLastPoint() 
+{ 
+   return &(this->points.back()); 
+}
+/*=======================================================*/
+int GbSystem3D::PointSet3::size()
+{ 
+   return (int)this->points.size();      
+}
+/*=======================================================*/
+vector<GbPoint3D> GbSystem3D::PointSet3::getPoints()
+{
+   //is this right? it's another effect as at GbPoint3D* getNode(index)!!!
+   //or do we want to have the next uncommented getPoints() funktion
+   return this->points;
+}
+///*=======================================================*/
+//vector<GbPoint3D*> GbSystem3D::PointSet3::getPoints()
+//{
+//   vector<GbPoint3D*> tmp;
+//   for(int pos=0; pos<(int)this->points.size();pos++) tmp.push_back(&this->points[pos]);
+//   
+//   return tmp;
+//}
+/*=======================================================*/
+void GbSystem3D::PointSet3::calculateValues()
+{
+   if(this->points.empty()) 
+   {
+      this->x1min = this->x2min = this->x3min = 0.0;
+      this->x1max = this->x2max = this->x3max = 0.0;
+   }
+   else
+   {
+      this->x1min = (this->points)[0].x1;
+      this->x1max = (this->points)[0].x1;
+      this->x2min = (this->points)[0].x2;
+      this->x2max = (this->points)[0].x2;
+      this->x3min = (this->points)[0].x3;
+      this->x3max = (this->points)[0].x3;
+
+      for(int i=(int)this->points.size()-1; i>0; --i)
+      {
+         if((this->points)[i].x1 < this->x1min) this->x1min = (this->points)[i].x1;
+         if((this->points)[i].x1 > this->x1max) this->x1max = (this->points)[i].x1;
+         if((this->points)[i].x2 < this->x2min) this->x2min = (this->points)[i].x2;
+         if((this->points)[i].x2 > this->x2max) this->x2max = (this->points)[i].x2;
+         if((this->points)[i].x3 < this->x3min) this->x3min = (this->points)[i].x3;
+         if((this->points)[i].x3 > this->x3max) this->x3max = (this->points)[i].x3;
+      }
+   }
+   this->consistent = true;
+}
+
+
+
diff --git a/src/VirtualFluidsBasics/geometry3d/GbSystem3D.h b/src/VirtualFluidsBasics/geometry3d/GbSystem3D.h
new file mode 100644
index 0000000000000000000000000000000000000000..57955d6b9f582b4315de114be7866f733bb47134
--- /dev/null
+++ b/src/VirtualFluidsBasics/geometry3d/GbSystem3D.h
@@ -0,0 +1,422 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 GbSystem3D.h
+//! \ingroup geometry3d
+//! \author Soeren Freudiger, Sebastian Geller
+//=======================================================================================
+#ifndef GBSYSTEM3D_H
+#define GBSYSTEM3D_H
+
+#include <iostream>
+#include <cmath>
+#include <vector>
+
+#include <GbPoint3D.h>
+#include <GbObject3D.h>
+#include <basics/utilities/UbMath.h>
+#include <basics/writer/WbWriter.h>
+
+class GbPolygon3D;
+class GbCuboid3D;
+class GbLine3D;
+
+namespace GbSystem3D
+{
+   extern double       getDistance(const GbPoint3D& p11, const GbPoint3D& p12);
+   extern GbPoint3D*   calculateIntersectionPoint3D(GbPoint3D& p11, GbPoint3D& p12, GbPoint3D& p21, GbPoint3D& p22);
+   extern GbPolygon3D* clipPolygon3D(std::vector<GbPoint3D> points, double x11, double x12, double x13, double x21, double x22, double x23);
+   extern GbLine3D*    createClipLine3D(GbPoint3D& p1, GbPoint3D& p2, double x11, double x12, double x13, double x21, double x22, double x23);
+   extern bool         hasIntersectionPoint3D(GbPoint3D& p11, GbPoint3D& p12, GbPoint3D& p21, GbPoint3D& p22);
+   extern bool         isParallelIn3D(GbPoint3D& p11, GbPoint3D& p12, GbPoint3D& p21, GbPoint3D& p22);
+   extern GbCuboid3D*  clipRectangle3D(GbPoint3D& p1, GbPoint3D& p2, double x11, double x12, double x13, double x21, double x22, double x23);
+
+   /*========================================================================================*/
+   inline static std::string writeGeoObject(GbObject3D* gbobject, const std::string& filename, WbWriter* writer)
+   {
+      std::vector<UbTupleFloat3> nodes;
+      std::vector<UbTupleInt3>   triangles;
+      gbobject->addSurfaceTriangleSet(nodes, triangles);
+
+      std::string outFilename = writer->writeTriangles(filename,nodes,triangles);
+      return outFilename;
+   }
+   //the same as before
+   /*========================================================================================*/
+   inline static std::string writeGeoObject(SPtr<GbObject3D> gbobject, const std::string& filename, WbWriter* writer)
+   {
+      std::vector<UbTupleFloat3> nodes;
+      std::vector<UbTupleInt3>   triangles;
+      gbobject->addSurfaceTriangleSet(nodes, triangles);
+
+      std::string outFilename = writer->writeTriangles(filename,nodes,triangles);
+      return outFilename;
+   }
+   /*========================================================================================*/
+   inline static std::vector< std::string > writeGeoObject(GbObject3D*  gbobject, const std::string& filename, std::vector< WbWriter* > writer )
+   {
+      std::vector<UbTupleFloat3> nodes;
+      std::vector<UbTupleInt3>   triangles;
+      gbobject->addSurfaceTriangleSet(nodes, triangles);
+
+      std::vector< std::string > outFilenames;
+      for(std::size_t i=0; i<writer.size(); ++i)
+         outFilenames.push_back( writer[i]->writeTriangles(filename,nodes,triangles) );
+      return outFilenames;
+   }
+   /*========================================================================================*/
+   inline static std::string writeGeoObjects(std::vector< GbObject3D* > gbobjects, const std::string& filename, WbWriter* writer)
+   {
+      std::vector<UbTupleFloat3> nodes;
+      std::vector<UbTupleInt3>   triangles;
+
+      for(std::size_t i=0; i<gbobjects.size(); ++i)
+      {
+         //std::cout<<i<<", "<<gbobjects[i]<<std::endl;
+         gbobjects[i]->addSurfaceTriangleSet(nodes, triangles);
+      }
+
+      std::string outFilename = writer->writeTriangles(filename,nodes,triangles);
+      return outFilename;
+   }
+   /*========================================================================================*/
+
+   //////////////////////////////////////////////////////////////////////////
+   class PointSet3
+   {
+   public:
+      PointSet3(int n);
+      PointSet3(const std::vector<GbPoint3D>& points);
+      ~PointSet3(){}
+      void   add(const GbPoint3D& point);
+      void   addUnequal(const GbPoint3D& point);
+      void   add(const std::vector<GbPoint3D>& p);
+      int    contains(GbPoint3D* point);
+      void   insert(const GbPoint3D& point, int index);
+      void   clear();
+      void   clearAndTrim();
+      int    containsEqual(const GbPoint3D& point);
+      bool   containsLine(GbPoint3D* point1, GbPoint3D* point2);
+      bool   containsEqualLine(const GbPoint3D& point1, const GbPoint3D& point2);
+      double getX1Minimum();
+      double getX1Maximum();
+      double getX2Minimum();
+      double getX2Maximum();
+      double getX3Minimum();
+      double getX3Maximum();
+      void   calculateValues();
+      int    size();
+      GbPoint3D* getPoint(int index);
+      GbPoint3D* getFirstPoint();
+      GbPoint3D* getLastPoint() ;
+      std::vector<GbPoint3D> getPoints();
+
+   private:
+      double    x1min;
+      double    x1max;
+      double    x2min;
+      double    x2max;
+      double    x3min;
+      double    x3max;
+      bool      consistent;
+      std::vector<GbPoint3D> points;
+
+      void init()
+      {
+         consistent = false;
+         x1min = x2min = x3min = 0.0;
+         x1max = x2max = x3max = 0.0;
+      }
+   };
+   /*=================================================================*/
+   class OldPointSet3
+   {
+   private:
+      int       sizet;
+      double    x1min;
+      double    x1max;
+      double    x2min;
+      double    x2max;
+      double    x3min;
+      double    x3max;
+      bool      consistent;
+      std::vector<GbPoint3D> points;
+
+      void init()
+      {
+         sizet      = 0;
+         x1min      = 0.0;
+         x1max      = 0.0;
+         x2min      = 0.0;
+         x2max      = 0.0;
+         x3min		  = 0.0;
+         x3max      = 0.0;
+         consistent = false;
+         //points   = NULL;
+      };
+
+   public:
+      OldPointSet3(int n)
+      {
+         this->init();
+         this->points.resize(n);
+      }
+      OldPointSet3(std::vector<GbPoint3D> &points)
+      {
+         this->init();
+         this->points.resize(0);//, NULL);
+         this->add(points);
+      };
+      ~OldPointSet3()
+      {
+         //			delete points;
+      };
+      void add(GbPoint3D point)
+         {
+            if(this->sizet>0 && point.equals(&(this->points)[this->sizet-1])) return;
+            if(this->sizet == (int)this->points.size())
+            {
+               std::vector<GbPoint3D> a;
+               a.resize(1+(this->sizet<<1));
+               for(int u=0; u<this->sizet; u++)  { (a)[u] = (points)[u];	}
+               this->points = a;
+            }
+            (this->points)[this->sizet] = point;
+            this->consistent				= false;
+            this->sizet++;
+         }
+         void addUnequal(GbPoint3D *point)
+         {
+            if(this->containsEqual(point) > 0) return;
+            if(this->sizet == (int)this->points.size())
+            {
+               std::vector<GbPoint3D> a;
+               a.resize(1+(this->sizet<<1));
+               for(int u=0; u<this->sizet; u++)  { (a)[u] = (points)[u];	}
+               this->points = a;
+            }
+            (this->points)[this->sizet] = point;
+            this->consistent        = false;
+            this->sizet++;
+         }
+         void add(std::vector<GbPoint3D> &p)
+         {
+            if(this->sizet+p.size() >= this->points.size())
+            {
+               std::vector<GbPoint3D> a;
+               a.resize(this->sizet+p.size());
+               for(int u=0; u<(int)this->points.size(); u++)  { (a)[u] = (this->points)[u];	}
+               this->points = a;
+            }
+            int u = this->sizet;// (int)this->points->size();
+            for(int b=0; b<(int)p.size(); b++)			(this->points)[u++] = (p)[b];
+            //u = this->sizet;
+            //for(int b=0; b<(int)p->size(); b++)
+            //	cout<<(this->points)[u++].toString()<<endl;
+            this->consistent  = false;
+            this->sizet      += (int)p.size();
+         };
+         //		void insert(GbPoint3D *point, int index)
+         //      {
+         //	 if(this.size == this.points.length)
+         //	 {
+         //	    GbPoint3D a[] = new GbPoint3D[1+(this.size<<1)];
+         //	    System.arraycopy(this.points, 0, a, 0, this.size);
+         //	    this.points = a;
+         //	 }
+         //	 System.arraycopy(this.points, index, this.points, index+1, this.size-index);
+         //	 this.points[index] = point;
+         //	 this.consistent    = false;
+         //	 this.size++;
+         //      }
+         //      void delete(GbPoint3D point)
+         //      {
+         //	 for(int i=this.size-1; i>=0; i--) if(this.points[i] == point) this.delete(i);
+         //      }
+         //      void delete(int index)
+         //      {
+         //	 int j = this.size - index - 1;
+         //	 if(j > 0) System.arraycopy(this.points, index + 1, this.points, index, j);
+         //	 this.consistent = false;
+         //	 this.size--;
+         //      }
+         void clear()
+         {
+            this->sizet    = 0;
+            this->consistent = false;
+         }
+         void clearAndTrim()
+         {
+            this->sizet       = 0;
+            this->points.resize(0);
+            this->consistent = false;
+         }
+
+         double getX1Minimum()
+         {
+            if(!this->consistent) this->calculateValues();
+            return(this->x1min);
+         }
+         double getX1Maximum()
+         {
+            if(!this->consistent) this->calculateValues();
+            return(this->x1max);
+         }
+         double getX2Minimum()
+         {
+            if(!this->consistent) this->calculateValues();
+            return(this->x2min);
+         }
+         double getX2Maximum()
+         {
+            if(!this->consistent) this->calculateValues();
+            return(this->x2max);
+         }
+         double getX3Minimum()
+         {
+            if(!this->consistent) this->calculateValues();
+            return(this->x3min);
+         }
+         double getX3Maximum()
+         {
+            if(!this->consistent) this->calculateValues();
+            return(this->x3max);
+         }
+         void calculateValues()
+         {
+            this->x1min      = 0.0;
+            this->x1max      = 0.0;
+            this->x2min      = 0.0;
+            this->x2max      = 0.0;
+            this->x3min      = 0.0;
+            this->x3max      = 0.0;
+            this->consistent = true;
+
+            if(this->sizet == 0) return;
+
+            this->x1min = (this->points)[0].x1;
+            this->x1max = (this->points)[0].x1;
+            this->x2min = (this->points)[0].x2;
+            this->x2max = (this->points)[0].x2;
+            this->x3min = (this->points)[0].x3;
+            this->x3max = (this->points)[0].x3;
+
+            for(int i=this->sizet-1; i>0; i--)
+            {
+               if((this->points)[i].x1 < this->x1min) this->x1min = (this->points)[i].x1;
+               if((this->points)[i].x1 > this->x1max) this->x1max = (this->points)[i].x1;
+               if((this->points)[i].x2 < this->x2min) this->x2min = (this->points)[i].x2;
+               if((this->points)[i].x2 > this->x2max) this->x2max = (this->points)[i].x2;
+               if((this->points)[i].x3 < this->x3min) this->x3min = (this->points)[i].x3;
+               if((this->points)[i].x3 > this->x3max) this->x3max = (this->points)[i].x3;
+            }
+         };
+
+         int contains(GbPoint3D *point)
+         {
+            int n = 0;
+            for(int i=this->sizet-1; i>=0; i--) if(&(this->points)[i] == point) n++;
+            return(n);
+         };
+         int containsEqual(GbPoint3D *point)
+         {
+            int n = 0;
+            for(int i=this->sizet-1; i>=0; i--) if((this->points)[i].equals(point)) n++;
+            return(n);
+         }
+         bool containsLine(GbPoint3D *point1, GbPoint3D *point2)
+         {
+            for(int i=this->sizet-1; i>=0; i--) if(&(this->points)[i] == point1)
+            {
+               if(i == 0)
+               {
+                  if(&(this->points)[i+1]           == point2) return(true);
+                  if(&(this->points)[this->sizet-1] == point2) return(true);
+               }
+               else if(i == this->sizet-1)
+               {
+                  if(&(this->points)[0]   == point2) return(true);
+                  if(&(this->points)[i-1] == point2) return(true);
+               }
+               else
+               {
+                  if(&(this->points)[i+1] == point2) return(true);
+                  if(&(this->points)[i-1] == point2) return(true);
+               }
+            }
+            return(false);
+         };
+         //      boolean containsEqualLine(GbPoint2D point1, GbPoint2D point2)
+         //      {
+         //	 for(int i=this.size-1; i>=0; i--) if(this.points[i].equals(point1))
+         //	 {
+         //	    if(i == 0)
+         //	    {
+         //	       if(this.points[i+1].equals(point2))         return(true);
+         //	       if(this.points[this.size-1].equals(point2)) return(true);
+         //	    }
+         //	    else if(i == this.size-1)
+         //	    {
+         //	       if(this.points[0].equals(point2))   return(true);
+         //	       if(this.points[i-1].equals(point2)) return(true);
+         //	    }
+         //	    else
+         //	    {
+         //	       if(this.points[i+1].equals(point2)) return(true);
+         //	       if(this.points[i-1].equals(point2)) return(true);
+         //	    }
+         //	 }
+         //	 return(false);
+         //      }
+         GbPoint3D *getPoint(int index)
+         {
+            return(&(this->points)[index]);
+         }
+         GbPoint3D *getFirstPoint()
+         {
+            return(&(this->points)[0]);
+         }
+         GbPoint3D *getLastPoint() { return(&(this->points)[this->sizet-1]); }
+         int size()                { return(this->sizet);      }
+         std::vector<GbPoint3D> getPoints()
+         {
+            points.resize(sizet);
+            return points;
+            //int l = this->sizet;
+            //if(l > 1 && (this->points)[0].equals(&(this->points)[l-1])) l--;
+
+            //vector<GbPoint3D*> *a = new vector<GbPoint3D*>;
+            //a->resize(l, NULL);
+            //for(int u=0; u<l; u++)  { (*a)[u] = &((points)[u]);	}
+            //return(a);
+         }
+      };
+      /*=================================================================*/
+}
+
+#endif //GBSYSTEM3D_H
diff --git a/src/VirtualFluidsBasics/geometry3d/GbTriangle3D.cpp b/src/VirtualFluidsBasics/geometry3d/GbTriangle3D.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..b9024aaf40f67f226392e15a9cfc6470d55ca39a
--- /dev/null
+++ b/src/VirtualFluidsBasics/geometry3d/GbTriangle3D.cpp
@@ -0,0 +1,1130 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 GbTriangle3D.cpp
+//! \ingroup geometry3d
+//! \author Soeren Freudiger, Sebastian Geller
+//=======================================================================================
+#include <GbTriangle3D.h>
+#include <GbSystem3D.h>
+#include <GbLine3D.h>
+#include <GbCuboid3D.h>
+
+#include <basics/utilities/UbMath.h>
+
+using namespace std;                                                               
+
+GbTriangle3D::GbTriangle3D()
+{
+   this->init();
+   this->consistent = false;
+}
+/*======================================================================*/
+/*
+* Creates an empty 2D triangle with the specified points.
+* @param point1 the 1st point
+* @param point2 the 2nd point
+* @param point3 the 3nd point
+*/
+GbTriangle3D::GbTriangle3D(GbPoint3D* point1, GbPoint3D* point2, GbPoint3D* point3)
+{
+   this->init();
+   this->points[0] = point1;
+   this->points[1] = point2;
+   this->points[2] = point3;
+
+   this->calculateNormal();
+   this->consistent = false;
+
+   this->points[0]->addObserver(this);
+   this->points[1]->addObserver(this);
+   this->points[2]->addObserver(this);
+   
+   //this.po        = new PointObserver(this);
+   //this.points[0].addObserver(this.po);
+   //this.points[1].addObserver(this.po);
+   //this.points[2].addObserver(this.po);
+}
+/*======================================================================*/
+/*
+* Creates a 3D triangle as clone of the specified 2D triangle.
+* @param triangle the 3D triangle to be cloned
+*/
+GbTriangle3D::GbTriangle3D(GbTriangle3D* triangle)
+{
+   this->init();
+   this->points[0] = triangle->points[0]->clone();
+   this->points[1] = triangle->points[1]->clone();
+   this->points[2] = triangle->points[2]->clone();
+
+   this->consistent = false;
+   this->calculateNormal();
+   this->calculateValues();
+}
+/*======================================================================*/
+GbTriangle3D::~GbTriangle3D()
+{
+   if(this->points[0]) this->points[0]->removeObserver(this);
+   if(this->points[1]) this->points[1]->removeObserver(this);
+   if(this->points[2]) this->points[2]->removeObserver(this);
+}
+/*======================================================================*/
+void GbTriangle3D::deletePoints()
+{ 
+   if(points[0]) { delete points[0]; points[0]=NULL;}
+   if(points[1]) { delete points[1]; points[1]=NULL;}
+   if(points[2]) { delete points[2]; points[2]=NULL;}
+}
+
+/*======================================================================*/
+/*  Methoden                                                            */
+/*                                                                      */
+/*
+* Creates a 3D triangle as clone of this 3D triangle.
+*/
+GbTriangle3D* GbTriangle3D::clone()
+{
+   return(new GbTriangle3D(this));
+}
+/*======================================================================*/
+/*
+* Returns the number of times this 2D triangle contains the specified point.
+* @param point the point
+* @return the number of times this 2D triangle contains the specified point
+*/
+int GbTriangle3D::contains(GbPoint3D* point)
+{
+   int n = 0;
+   for(int i=0; i<3; i++) if(this->points[i]->equals(point)) n++;
+   return(n);
+}
+/*======================================================================*/
+/*
+* Returns the number of times this 2D triangle contains a point equal to the specified point.
+* @param point the point
+* @return the number of times this 2D triangle contains a point equal to the specified point
+*/
+int GbTriangle3D::containsEqual(GbPoint3D* point)
+{
+   int n = 0;
+   for(int i=0; i<3; i++) if(this->points[i]->equals(point)) n++;
+   return(n);
+}
+/*======================================================================*/
+/*
+* Returns the specified point.
+* @param index the index (must be 0, 1, or 2)
+* @return the specified point
+* @exception ArrayIndexOutOfBoundsException if the specified index is not valid
+*/
+GbPoint3D* GbTriangle3D::getPoint(const int& index) 
+{
+   if(index < 0 || index > 2) throw UbException(UB_EXARGS,"invalid index specified: ");
+   return((this->points[index]));
+}
+/*======================================================================*/
+vector<GbPoint3D> GbTriangle3D::getPoints() 
+{
+   vector<GbPoint3D> p(3);
+   p[0] = *(points[0]);
+   p[1] = *(points[1]);
+   p[2] = *(points[2]);
+   return p;
+   //
+   //vector<GbPoint3D> p(3);// = new vector<GbPoint3D*>;
+   //p.resize(3);//, NULL);
+   //p[0] = this->points[0];
+   //p[1] = this->points[1];
+   //p[2] = this->points[2];
+   //return(p);
+}
+/*======================================================================*/
+/*
+* Returns the area of this triangle.
+* The area is positive for positive ordered points, otherwise negative.
+* @return the area of this triangle
+*/
+double GbTriangle3D::getArea()
+{
+   if(!this->consistent) this->calculateValues();
+   // throw UbException(UB_EXARGS,"not correct calculated ...");
+   return(this->area);
+}
+/*
+* Returns the centroid x1 coordinate of this triangle.
+* @return the centroid x1 coordinate of this triangle
+*/
+double GbTriangle3D::getX1Centroid()
+{
+   if(!this->consistent) this->calculateValues();
+   return(this->x1s);
+}
+/*
+* Returns the minimum x1 coordinate of this triangle.
+* @return the minimum x1 coordinate of this triangle
+*/
+double GbTriangle3D::getX1Minimum()
+{
+   if(!this->consistent) this->calculateValues();
+   return(this->x1min);
+}
+/*
+* Returns the maximum x1 coordinate of this triangle.
+* @return the maximum x1 coordinate of this triangle
+*/
+double GbTriangle3D::getX1Maximum()
+{
+   if(!this->consistent) this->calculateValues();
+   return(this->x1max);
+}
+/*
+* Returns the centroid x2 coordinate of this triangle.
+* @return the centroid x2 coordinate of this triangle
+*/
+double GbTriangle3D::getX2Centroid()
+{
+   if(!this->consistent) this->calculateValues();
+   return(this->x2s);
+}
+/*                                                         
+* Returns the minimum x2 coordinate of this triangle.
+* @return the minimum x2 coordinate of this triangle
+*/
+double GbTriangle3D::getX2Minimum()
+{
+   if(!this->consistent) this->calculateValues();
+   return(this->x2min);
+}
+/*
+* Returns the maximum x2 coordinate of this triangle.
+* @return the maximum x2 coordinate of this triangle
+*/
+double GbTriangle3D::getX2Maximum()
+{
+   if(!this->consistent) this->calculateValues();
+   return(this->x2max);
+}
+double GbTriangle3D::getX3Centroid()
+{
+   if(!this->consistent) this->calculateValues();
+   return(this->x3s);
+}
+double GbTriangle3D::getX3Minimum()
+{
+   if(!this->consistent) this->calculateValues();
+   return(this->x3min);
+}
+double GbTriangle3D::getX3Maximum()
+{
+   if(!this->consistent) this->calculateValues();
+   return(this->x3max);
+}
+
+/*
+* Sets the specified point.
+* @param point the point
+* @param index the index (must be 0, 1, or 2)
+* @exception ArrayIndexOutOfBoundsException if the specified index is not valid
+*/
+void GbTriangle3D::setPoint(GbPoint3D* point, int index) 
+{
+   if(index < 0 || index > 2) throw UbException(UB_EXARGS,"invalid index specified: ");
+   this->points[index] = point;
+   this->consistent    = false;
+   this->calculateNormal();
+}
+
+/*
+* Returns the surface triangle set with new nodes !!!
+* @returns the surface triangle set with new nodes !!!
+*/
+vector<GbTriangle3D*> GbTriangle3D::getSurfaceTriangleSet()
+{
+   vector<GbTriangle3D*> triangles;
+   
+   triangles.push_back(new GbTriangle3D(new GbPoint3D(getPoint1()),new GbPoint3D(getPoint2()),new GbPoint3D(getPoint3())));
+
+   return triangles;
+}
+
+
+/*
+* Returns the string representation of the triangle
+* @returns the string representation of the triangle
+*/
+
+string GbTriangle3D::toString()
+{
+   stringstream ss;
+   ss<<"GbTriangle3D[area=";
+   ss<<this->getArea();
+
+   ss<<", x1s="<<this->x1s;
+   ss<<", x2s="<<this->x2s;
+   ss<<", x3s="<<this->x3s;
+   ss<<", x1min="<<this->x1min;
+   ss<<", x1max="<<this->x1max;
+   ss<<", x2min="<<this->x2min;
+   ss<<", x2max="<<this->x2max;
+   ss<<", x3min="<<this->x3min;
+   ss<<", x3max="<<this->x3max;
+   ss<<", points1="<<this->points[0]->toString();
+   ss<<", points2="<<this->points[1]->toString();
+   ss<<", points3="<<this->points[2]->toString();
+   ss<<"]";
+   return((ss.str()).c_str());
+}
+/*======================================================================*/
+double GbTriangle3D::getIntersectionRaytraceFactor(const double& x1, const double& x2, const double& x3, const double& rx1, const double& rx2, const double& rx3)
+{
+   //e1 = v1 - v0
+   double e1x1 = this->points[1]->x1-this->points[0]->x1;
+   double e1x2 = this->points[1]->x2-this->points[0]->x2;
+   double e1x3 = this->points[1]->x3-this->points[0]->x3;  
+
+   //e2 = v2 - v0
+   double e2x1 = this->points[2]->x1-this->points[0]->x1;
+   double e2x2 = this->points[2]->x2-this->points[0]->x2;
+   double e2x3 = this->points[2]->x3-this->points[0]->x3;  
+
+   //p = d x e2
+   double px1 = rx2*e2x3 - rx3*e2x2;
+   double px2 = rx3*e2x1 - rx1*e2x3;
+   double px3 = rx1*e2x2 - rx2*e2x1;
+
+   //a = e1 dot p
+   double a = e1x1*px1 + e1x2*px2 + e1x3*px3;
+   if(fabs(a)<1.E-10) return -1.0;
+   double f = 1.0/a;
+
+   //s = o - v0
+   double sx1 = x1 - this->points[0]->x1;
+   double sx2 = x2 - this->points[0]->x2;
+   double sx3 = x3 - this->points[0]->x3;
+
+   //u = f * ( s dot p)
+   double u = f * ( sx1*px1 + sx2*px2 + sx3*px3 );
+   if(u<-1.E-10 || u>1.0+1.E-10) return -1.0;
+
+   //q = s x e1
+   double qx1 = sx2*e1x3 - sx3*e1x2;
+   double qx2 = sx3*e1x1 - sx1*e1x3;
+   double qx3 = sx1*e1x2 - sx2*e1x1;
+
+   //v = f*(e2 dot q)
+   double v = f * (rx1*qx1 + rx2*qx2 + rx3*qx3);
+   if(v<-1.E-10 || (u+v)>1.0+1.E-10) return -1.0;
+
+   //t = f * (e2 dot q)
+   return f * (e2x1*qx1 + e2x2*qx2 + e2x3*qx3);
+}
+
+/*===========================================================*/
+
+GbLine3D* GbTriangle3D::createClippedLine3D(GbPoint3D& point1, GbPoint3D& point2)
+{
+   GbPoint3D *result = this->calculateIntersectionPoints3D(&point1, &point2);
+   if(!result) return NULL;
+
+   return new GbLine3D(result, new GbPoint3D(point2));
+
+   //return GbSystem::createClipLine3D(point1, point2,
+      //p1->getX1Coordinate(),p1->getX2Coordinate(),p1->getX3Coordinate(),
+      //p2->getX1Coordinate(),p2->getX2Coordinate(),p2->getX3Coordinate() );
+}
+
+//von Navodit ...
+/*===========================================================*/
+GbPoint3D* GbTriangle3D::calculateIntersectionPoints3D(GbLine3D* line)
+{
+   return this->calculateIntersectionPoints3D(line->getPoint1(), line->getPoint2());
+}
+/*===========================================================*/
+GbPoint3D* GbTriangle3D::calculateIntersectionPoints3D(GbPoint3D* linePoint1, GbPoint3D* linePoint2)
+{
+   GbVector3D Point1(linePoint1->x1, linePoint1->x2, linePoint1->x3);
+   GbVector3D Point2(linePoint2->x1, linePoint2->x2, linePoint2->x3);
+   GbVector3D direction = Point2-Point1;
+   GbVector3D GbPoint3D1(this->getPoint1()->x1,this->getPoint1()->x2,this->getPoint1()->x3);
+   GbVector3D GbPoint3D2(this->getPoint2()->x1,this->getPoint2()->x2,this->getPoint2()->x3);
+   GbVector3D GbPoint3D3(this->getPoint3()->x1,this->getPoint3()->x2,this->getPoint3()->x3);
+   GbVector3D V2V1 = GbPoint3D2-GbPoint3D1;
+   GbVector3D V3V1 = GbPoint3D3-GbPoint3D1;
+   GbVector3D V2V1V3V1 = V2V1.Cross(V3V1);
+   V2V1V3V1.Normalize();
+   GbVector3D Normal = V2V1V3V1;
+
+   double d = -Normal.Dot(GbPoint3D1);            
+   double denom = Normal.Dot(direction);       
+
+   if (UbMath::zero(denom)) return NULL;   //line does not intersect the plane of the triangle !
+   else
+   {
+      double mu = -1.*(d + Point1.Dot(Normal))/denom;            //mu = -(d+ Normal.Point1)/denom
+
+      //   GbVector3D p1 = Point2-Point1;
+      //   GbVector3D p2 = p1*mu;
+      //   GbVector3D p3 = Point1+p2;
+      GbVector3D point = Point1 + mu*(Point2 -Point1);
+
+      if (mu<0.0 || mu>1.0)    return NULL;     // Point of intersection of line and plane does not lie on the triangle   
+      else
+      {
+         //Test whether Point lies inside the triangle or not
+         bool test=true;
+         GbVector3D a = GbPoint3D1-point;
+         GbVector3D b = GbPoint3D2-point;
+         GbVector3D c = GbPoint3D3-point;
+         GbVector3D ab = a.Cross(b);
+         GbVector3D bc = b.Cross(c);
+         GbVector3D ca = c.Cross(a);
+         GbVector3D Q1 = ab*0.5;
+         GbVector3D Q2 = bc*0.5;
+         GbVector3D Q3 = ca*0.5;
+         GbVector3D Q1Q2 = Q1+Q2;
+         GbVector3D Q = Q1Q2+Q3;
+
+         if (UbMath::less(Q.Dot(Q1), 0.0)) test = false; 
+         if (UbMath::less(Q.Dot(Q2), 0.0)) test = false; 
+         if (UbMath::less(Q.Dot(Q3), 0.0)) test = false; 
+
+         if (test == true) return (new GbPoint3D(point.X1(), point.X2(), point.X3()));
+         else          return NULL;
+      }
+   }
+}
+
+/**
+* Returns the distance between the 3D triangle and the specified 3D Point                                                                      
+* @param point the 3D point from whom the distance is to be calculated
+* @return the distance of the specified point from the triangle
+*/
+double GbTriangle3D::calculateDistanceToPoint3D(GbPoint3D *point) 
+{
+   return this->calculateDistanceToPoint3D(point->x1, point->x2, point->x3);
+}
+/*=======================================================================*/
+double GbTriangle3D::calculateDistanceToPoint3D(const double& x1, const double& x2, const double& x3) 
+{
+   //
+   //throw UbException(UB_EXARGS,"Ich glaub GbTriangle3D::calculateDistanceToPoint3D(...) kann man so nicht nehmen,jedenfalls nicht fuer die q's");
+   cout<<"??? ch glaub GbTriangle3D::calculateDistanceToPoint3D(...) kann man so nicht nehmen,jedenfalls nicht fuer die q's"<<endl;
+   GbVector3D P0(x1, x2, x3);
+   GbVector3D P1(this->points[0]->x1, this->points[0]->x2, this->points[0]->x3);
+   GbVector3D P2(this->points[1]->x1, this->points[1]->x2, this->points[1]->x3);
+   GbVector3D P3(this->points[2]->x1, this->points[2]->x2, this->points[2]->x3);
+
+   //Determine normal to triangle
+   GbVector3D Normal = (P1-P2).Cross(P1-P3);
+   double alpha = UbMath::ACos((P1-P0).Dot(Normal)/((P1-P0).Length()*Normal.Length()));
+
+   double P0P0dash = (P0-P1).Length()*cos(alpha);
+   Normal.Normalize();
+   GbVector3D Projection = Normal*(-P0P0dash);
+
+   GbVector3D P0dash = P0+Projection;
+
+   //Check if point P0dash lies within the triangle P1P2P3.
+   bool test = false;
+   if ( ((P1-P0).Cross(P2-P0)).Dot(Normal) > 0 ) test = true;
+   if ( ((P2-P0).Cross(P3-P0)).Dot(Normal) > 0 ) test = true;
+   if ( ((P3-P0).Cross(P1-P0)).Dot(Normal) > 0 ) test = true;
+
+   if (test == true) return (P0-P0dash).Length();
+   else
+   // Determine the distance of point P0 from all edges and vertices and return the minimum distance
+   {
+      double dP0P1 = (P0-P1).Length(); //Distance of Point P0 from Point P1
+      double dP0P2 = (P0-P2).Length(); //Distance of Point P0 from Point P2
+      double dP0P3 = (P0-P3).Length(); //Distance of Point P0 from Point P3
+
+      GbVector3D MP1P2 = P2-P1;        //Direction vector for line P1P2
+      GbVector3D MP2P3 = P3-P2;        //Direction vector for line P2P3
+      GbVector3D MP3P1 = P1-P3;        //Direction vector for line P3P1
+
+      double tP1P2 = MP1P2.Dot(P0-P1) / MP1P2.Dot(MP1P2);
+      double tP2P3 = MP2P3.Dot(P0-P2) / MP2P3.Dot(MP2P3);
+      double tP3P1 = MP3P1.Dot(P0-P3) / MP3P1.Dot(MP3P1);
+
+      double dP1P2 = (P0-(P1+(MP1P2*tP1P2))).Length(); //Distance of Point P0 from line P1P2
+      double dP2P3 = (P0-(P2+(MP2P3*tP2P3))).Length(); //Distance of Point P0 from line P2P3
+      double dP3P1 = (P0-(P3+(MP3P1*tP3P1))).Length(); //Distance of Point P0 from line P3P1
+
+      double distanceP0[6]; //Array to store all the distances from Point P0
+      distanceP0[0] = dP0P1; 
+      distanceP0[1] = dP0P2; 
+      distanceP0[2] = dP0P3; 
+      distanceP0[3] = dP1P2; 
+      distanceP0[4] = dP2P3; 
+      distanceP0[5] = dP3P1; 
+
+      double d = 0.0;
+      //Find the minimum distance from Point P0
+      for (int i=0; i<6; i++)
+      {
+         if(distanceP0[i]<d) d = distanceP0[i];
+      }
+      return d;
+   }
+}
+/**
+* Returns the normalized distance between the 3D triangle and the specified 3D Point
+* copied from Benjamin A.
+* @param point the 3D point from whom the distance is to be calculated
+* @return the distance of the specified point from the triangle
+*/
+double GbTriangle3D::calculateNormalizedDistanceToPoint3D(const double& x1, const double& y1, const double& z1, 
+                                                          const double& x2, const double& y2, const double& z2)
+{
+    //face* pf
+    double xa, xb, xc, ya, yb, yc, za, zb, zc;
+    //double xp, yp, zp;
+    double tt=0, xi=0, eta=0;
+    double zaehler, nenner;
+    double wurzel3 = sqrt(3.);
+
+    //Weltkoordinaten der Dreiecke
+    xa = this->points[0]->x1;
+    xb = this->points[1]->x1;
+    xc = this->points[2]->x1;
+         
+    ya = this->points[0]->x2;
+    yb = this->points[1]->x2;
+    yc = this->points[2]->x2;
+
+    za = this->points[0]->x3;
+    zb = this->points[1]->x3;
+    zc = this->points[2]->x3;
+
+    //Shape-Funktionen zum Berechnen der Schnittpunkte
+    zaehler =
+       static_cast<double>(((-1.0*zc+zb)*ya+(yc-1.0*yb)*za+zc*yb-1.0*zb*yc)*x1
+       +((-1.0*zb+zc)*xa+(xb-1.0*xc)*za-1.0*xb*zc+xc*zb)*y1+((-1.0*yc+yb)*xa
+       +(-1.0*xb+xc)*ya-1.0*xc*yb+xb*yc)*z1+((-1.0*zc+zb)*ya+(yc-1.0*yb)*za
+       +zc*yb-1.0*zb*yc)*x2+((-1.0*zb+zc)*xa+(xb-1.0*xc)*za-1.0*xb*zc+xc*zb)*y2
+       +((-1.0*yc+yb)*xa+(-1.0*xb+xc)*ya-1.0*xc*yb+xb*yc)*z2+(2.0*zb*yc-2.0*zc*yb)*xa
+       +(2.0*xb*zc-2.0*xc*zb)*ya+(-2.0*xb*yc+2.0*xc*yb)*za);
+    nenner  =
+       static_cast<double>((((-1.0*zc+zb)*ya+(yc-1.0*yb)*za+zc*yb-1.0*zb*yc)*x1
+       +((-1.0*zb+zc)*xa+(xb-1.0*xc)*za-1.0*xb*zc+xc*zb)*y1+((-1.0*yc+yb)*xa
+       +(-1.0*xb+xc)*ya-1.0*xc*yb+xb*yc)*z1+((-1.0*zb+zc)*ya+(-1.0*yc+yb)*za-1.0*zc*yb+zb*yc)
+       *x2+((-1.0*zc+zb)*xa+(-1.0*xb+xc)*za+xb*zc-1.0*xc*zb)*y2+((yc-1.0*yb)*xa+(xb
+       -1.0*xc)*ya+xc*yb-1.0*xb*yc)*z2));
+    if( UbMath::greater(nenner, 0.0) ) tt = zaehler/nenner;
+    else tt=-999.;
+
+    zaehler =
+       static_cast<double>(((-2.0*zc+za+zb)*y2+(-1.0*yb-1.0*ya+2.0*yc)*z2+zc*ya
+       -1.0*zb*yc+zc*yb-1.0*za*yc)*x1+((-1.0*za+2.0*zc-1.0*zb)*x2+(xa-2.0*xc+xb)*z2
+       -1.0*xa*zc-1.0*xb*zc+xc*za+xc*zb)*y1+((-2.0*yc+ya+yb)*x2+(-1.0*xa-1.0*xb+2.0*xc)
+       *y2-1.0*xc*yb+xa*yc+xb*yc-1.0*xc*ya)*z1+(zb*yc-1.0*zc*ya-1.0*zc*yb+za*yc)
+       *x2+(-1.0*xc*za+xb*zc+xa*zc-1.0*xc*zb)*y2+(xc*yb-1.0*xa*yc-1.0*xb*yc+xc*ya)*z2);
+    nenner  =
+       static_cast<double>((((zc-1.0*zb)*ya+(yb-1.0*yc)*za+zb*yc-1.0*zc*yb)*x1
+       +((zb-1.0*zc)*xa+(xc-1.0*xb)*za-1.0*xc*zb+xb*zc)*y1+((-1.0*yb+yc)*xa+(xb-1.0*xc)
+       *ya-1.0*xb*yc+xc*yb)*z1+((zb-1.0*zc)*ya+(-1.0*yb+yc)*za+zc*yb-1.0*zb*yc)*x2
+       +((zc-1.0*zb)*xa+(xb-1.0*xc)*za-1.0*xb*zc+xc*zb)*y2+((yb-1.0*yc)*xa
+       +(xc-1.0*xb)*ya+xb*yc-1.0*xc*yb)*z2));
+    if( UbMath::greater(nenner, 0.0) ) xi = zaehler/nenner;
+    else xi=-999.;
+
+    zaehler =
+       static_cast<double>(((za-1.0*zb)*y2+(-1.0*ya+yb)*z2-1.0*za*yb+zb*ya)*x1+
+       ((-1.0*za+zb)*x2+(xa-1.0*xb)*z2-1.0*xa*zb+xb*za)*y1+((ya-1.0*yb)*x2+(xb-1.0*xa)
+       *y2+xa*yb-1.0*xb*ya)*z1+(-1.0*zb*ya+za*yb)*x2+(-1.0*xb*za+xa*zb)*y2
+       +(-1.0*xa*yb+xb*ya)*z2);
+    nenner  =
+       static_cast<double>((((zc-1.0*zb)*ya+(yb-1.0*yc)*za+zb*yc-1.0*zc*yb)*x1
+       +((zb-1.0*zc)*xa+(xc-1.0*xb)*za-1.0*xc*zb+xb*zc)*y1+((-1.0*yb+yc)*xa+(xb-1.0*xc)
+       *ya-1.0*xb*yc+xc*yb)*z1+((zb-1.0*zc)*ya+(-1.0*yb+yc)*za+zc*yb-1.0*zb*yc)*x2
+       +((zc-1.0*zb)*xa+(xb-1.0*xc)*za-1.0*xb*zc+xc*zb)*y2+((yb-1.0*yc)*xa+(xc-1.0*xb)
+       *ya+xb*yc-1.0*xc*yb)*z2));
+    if ( UbMath::greater(nenner, 0.0) ) eta = static_cast<double>((zaehler/nenner)*wurzel3*-1.);
+    else eta=-999.;
+
+    if (tt >= -1.0-UbMath::Epsilon<double>::val() && tt <= 1.0){
+       if(xi >= -1.0+eta/wurzel3-UbMath::Epsilon<double>::val() && xi <=
+          1.0-eta/wurzel3+UbMath::Epsilon<double>::val()){
+             if (eta >= 0-UbMath::Epsilon<double>::val() && eta <= wurzel3+UbMath::Epsilon<double>::val()){
+                /*xp = x1*(0.5-tt/2)+x2*(0.5+tt/2);
+                yp = y1*(0.5-tt/2)+y2*(0.5+tt/2);
+                zp = z1*(0.5-tt/2)+z2*(0.5+tt/2);*/
+                return
+                   static_cast<double>((sqrt(pow((x1*(0.5-tt/2)+x2*(0.5+tt/2))-x1,2)
+                   +pow((y1*(0.5-tt/2)+y2*(0.5+tt/2))-y1,2)+pow((z1*(0.5-tt/2)+z2*(0.5+tt/2))-z1,2))));
+             }
+          }
+    }
+    return (-999.);
+}
+/*
+* Returns true if the specified 2D point lies within (or on the border of) this 2D triangle.
+* @param point the 2D point to check
+* @return true if the specified 2D point lies within (or on the border of) this 2D triangle
+*/
+ bool GbTriangle3D::enclosesPoint2D(double x1, double x2)
+ {
+	 int i=0;
+	 //Punkt(x1,x2) liegt auf einem der Eckpunkte
+    if(x1==this->getPoint(0)->getX1Coordinate() && x2 == this->getPoint(0)->getX2Coordinate())	return true;
+	 if(x1==this->getPoint(1)->getX1Coordinate() && x2 == this->getPoint(1)->getX2Coordinate())	return true;
+	 if(x1==this->getPoint(2)->getX1Coordinate() && x2 == this->getPoint(2)->getX2Coordinate())  return true;
+
+	 //Erste Grade aus dem zu pruefenden Punkt(x,y) und einem zweiten Punkt(x+0.333,y+2.333)
+	 GbPoint3D p1;		p1.setX1(x1);			p1.setX2(x2);			p1.setX3(0.0);
+	 GbPoint3D p2;		p2.setX1(x1+0.333);	p2.setX2(x2+3.333);	p2.setX3(0.0);
+	 //Punkte des Dreiecks auf 2D reduziert
+	 GbPoint3D dp1;	dp1.setX1(this->getPoint(0)->getX1Coordinate());	dp1.setX2(this->getPoint(0)->getX2Coordinate());	dp1.setX3(0.0);
+	 GbPoint3D dp2;	dp2.setX1(this->getPoint(1)->getX1Coordinate());	dp2.setX2(this->getPoint(1)->getX2Coordinate());	dp2.setX3(0.0);
+	 GbPoint3D dp3;	dp3.setX1(this->getPoint(2)->getX1Coordinate());	dp3.setX2(this->getPoint(2)->getX2Coordinate());	dp3.setX3(0.0);
+	 //ueberpruefen, ob der Punkt(x,y) innerhalt der Boundingbox des Dreiecks liegt
+	 if(	 x1<this->getX1Maximum() && x1>getX1Minimum()
+		 && x2<this->getX2Maximum() && x2>getX2Minimum())
+	 {
+		 GbPoint3D* dummy = NULL;
+		 //ueberpruefen, ob der Punkt innerhalb des Dreiecks liegt
+		 dummy = GbSystem3D::calculateIntersectionPoint3D(p1,p2,dp1,dp2);
+		 if(dummy!=NULL)
+       {
+          if(dummy->getX1Coordinate()==p1.getX1Coordinate() && dummy->getX2Coordinate()==p1.getX2Coordinate())	
+          {
+             delete dummy;
+             return true;
+          }
+			 else if(dummy->getX1Coordinate()>p1.getX1Coordinate())
+          {
+             i++;
+          }
+			 else
+          {
+             i--;
+          }
+       }
+       if(dummy)  delete dummy;
+
+       dummy = GbSystem3D::calculateIntersectionPoint3D(p1,p2,dp2,dp3);
+		 if(dummy!=NULL)
+       {
+          if(dummy->getX1Coordinate()==p1.getX1Coordinate() && dummy->getX2Coordinate()==p1.getX2Coordinate())
+          {
+             if(dummy)  delete dummy;
+             return true;
+          }
+			 else if(dummy->getX1Coordinate()>p1.getX1Coordinate())
+          {
+             i++;
+          }
+			 else
+          {
+             i--;
+          }
+       }
+       if(dummy)  delete dummy;
+
+		 dummy = GbSystem3D::calculateIntersectionPoint3D(p1,p2,dp3,dp1);
+		 if(dummy!=NULL)
+       {
+          if(dummy->getX1Coordinate()==p1.getX1Coordinate() && dummy->getX2Coordinate()==p1.getX2Coordinate())
+          {
+             if(dummy)  delete dummy;
+             return true;
+          }
+			 else if(dummy->getX1Coordinate()>p1.getX1Coordinate())
+          {
+             i++;
+          }
+          else
+          {
+             i--;
+          }
+       }
+       if(dummy)  delete dummy;
+	 }
+	 if(i==-1) return true;
+	 if(i==1 ) return true;
+	
+    return false;
+ }
+
+///*
+//* Returns a new 2D polygon clipped by the specified 2D rectangle (result may be null!).
+//* @param rectangle the 2D rectangle
+//* @return a new 2D polygon clipped by the specified 2D rectangle
+//*/
+GbPolygon3D* GbTriangle3D::createClippedPolygon3D(GbCuboid3D* cube)
+{
+   return(GbSystem3D::clipPolygon3D(this->getPoints(), cube->getPoint1()->getX1Coordinate(), cube->getPoint1()->getX2Coordinate(), cube->getPoint1()->getX3Coordinate(), cube->getPoint2()->getX1Coordinate(), cube->getPoint2()->getX2Coordinate(), cube->getPoint2()->getX3Coordinate()));
+}
+///*
+//* Returns a new 2D polygon clipped by the specified 2D rectangle (result may be null!).
+//* @param p1 the 1st point of the rectangle
+//* @param p2 the 2nd point of the rectangle
+//* @return a new 2D polygon clipped by the specified 2D rectangle
+//*/
+//public GbPolygon2D createClippedPolygon2D(GbPoint2D p1, GbPoint2D p2)
+//{
+//   return(GbSystem.clipPolygon2D(this.points, p1.x1, p1.x2, p2.x1, p2.x2));
+//}
+/*
+* Returns a new 2D polygon clipped by the specified 2D rectangle (result may be null!).
+* @param p1x1 the 1st x1 coordinate of the rectangle
+* @param p1x2 the 1st x2 coordinate of the rectangle
+* @param p2x1 the 2nd x1 coordinate of the rectangle
+* @param p2x2 the 2nd x2 coordinate of the rectangle
+* @return a new 2D polygon clipped by the specified 2D rectangle
+*/
+GbPolygon3D* GbTriangle3D::createClippedPolygon3D(const double& p1x1, const double& p1x2, const double& p1x3, const double& p2x1, const double& p2x2, const double& p2x3)
+{
+   return(GbSystem3D::clipPolygon3D(this->getPoints(), p1x1, p1x2, p1x3, p2x1, p2x2, p2x3));
+}
+
+/*
+* Returns true if the specified 2D rectangle lies completely within this 2D triangle.
+* @param rectangle the 2D rectangle to check
+* @return true if the specified 2D rectangle lies completely within this 2D triangle
+*/
+//bool enclosesRectangle2D(GbRectangle2D *rectangle)
+//{
+//   GbPolygon2D p = GbSystem.clipPolygon2D(this.points, rectangle.p1.x1, rectangle.p1.x2, rectangle.p2.x1, rectangle.p2.x2);
+//   return(p!=null && GbSystem.equal(Math.abs(p.getArea()), rectangle.getArea()));
+//}
+/*
+* Returns true if the specified 2D rectangle lies completely within this 2D triangle.
+* @param p1 the 1st point of the rectangle to check
+* @param p2 the 2nd point of the rectangle to check                         triangle
+* @return true if the specified 2D rectangle lies completely within this 2D
+*/
+//public boolean enclosesRectangle2D(GbPoint2D p1, GbPoint2D p2)
+//{
+//   GbPolygon2D p = GbSystem.clipPolygon2D(this.points, p1.x1, p1.x2, p2.x1, p2.x2);
+//   return(p!=null && GbSystem.equal(Math.abs(p.getArea()), Math.abs((p1.x1-p2.x1)*(p1.x2-p2.x2))));
+//}
+/*
+* Returns true if the specified 2D rectangle lies completely within this 2D triangle.
+* @param p1x1 the 1st x1 coordinate of the rectangle to check
+* @param p1x2 the 1st x2 coordinate of the rectangle to check
+* @param p2x1 the 2nd x1 coordinate of the rectangle to check
+* @param p2x2 the 2nd x2 coordinate of the rectangle to check
+* @return true if the specified 2D rectangle lies completely within this 2D triangle
+*/
+//public boolean enclosesRectangle2D(double p1x1, double p1x2, double p2x1, double p2x2)
+//{
+//   GbPolygon2D p = GbSystem.clipPolygon2D(this.points, p1x1, p1x2, p2x1, p2x2);
+//   return(p!=null && GbSystem.equal(Math.abs(p.getArea()), Math.abs((p1x1-p2x1)*(p1x2-p2x2))));
+//}
+
+/*
+* Returns true if the specified 2D rectangle is crossed by this 2D triangle.
+* @param rectangle the 2D rectangle to check
+* @return true if the specified 2D rectangle is crossed by this 2D triangle
+*/
+//public boolean crossesRectangle2D(GbRectangle2D rectangle)
+//{
+//   GbPolygon2D p = GbSystem.clipPolygon2D(this.points, rectangle.p1.x1, rectangle.p1.x2, rectangle.p2.x1, rectangle.p2.x2);
+//   return(p!=null && GbSystem.inOpenInterval(Math.abs(p.getArea()), 0.0, rectangle.getArea()));
+//}
+/*
+* Returns true if the specified 2D rectangle is crossed by this 2D triangle.
+* @param p1 the 1st point of the rectangle to check
+* @param p2 the 2nd point of the rectangle to check
+* @return true if the specified 2D rectangle is crossed by this 2D triangle
+*/
+//public boolean crossesRectangle2D(GbPoint2D p1, GbPoint2D p2)
+//{
+//   GbPolygon2D p = GbSystem.clipPolygon2D(this.points, p1.x1, p1.x2, p2.x1, p2.x2);
+//   return(p!=null && GbSystem.inOpenInterval(Math.abs(p.getArea()), 0.0, Math.abs((p1.x1-p2.x1)*(p1.x2-p2.x2))));
+//}
+/*
+* Returns true if the specified 2D rectangle is crossed by this 2D triangle.
+* @param p1x1 the 1st x1 coordinate of the rectangle to check
+* @param p1x2 the 1st x2 coordinate of the rectangle to check
+* @param p2x1 the 2nd x1 coordinate of the rectangle to check
+* @param p2x2 the 2nd x2 coordinate of the rectangle to check
+* @return true if the specified 2D rectangle is crossed by this 2D triangle
+*/
+//public boolean crossesRectangle2D(double p1x1, double p1x2, double p2x1, double p2x2)
+//{
+//   GbPolygon2D p = GbSystem.clipPolygon2D(this.points, p1x1, p1x2, p2x1, p2x2);
+//   return(p!=null && GbSystem.inOpenInterval(Math.abs(p.getArea()), 0.0, Math.abs((p1x1-p2x1)*(p1x2-p2x2))));
+//}
+
+/*
+* Returns true if the specified 2D rectangle lies (at least partly) within this 2D triangle.
+* @param rectangle the 2D rectangle to check
+* @return true if the specified 2D rectangle lies (at least partly) within this 2D triangle
+*/
+//public boolean enclosesOrCrossesRectangle2D(GbRectangle2D rectangle)
+//{
+//   GbPolygon2D p = GbSystem.clipPolygon2D(this.points, rectangle.p1.x1, rectangle.p1.x2, rectangle.p2.x1, rectangle.p2.x2);
+//   return(p!=null && GbSystem.greater(Math.abs(p.getArea()), 0.0));
+//}
+/*
+* Returns true if the specified 2D rectangle lies (at least partly) within this 2D triangle.
+* @param p1 the 1st point of the rectangle to check
+* @param p2 the 2nd point of the rectangle to check
+* @return true if the specified 2D rectangle lies (at least partly) within this 2D triangle
+*/
+//public boolean enclosesOrCrossesRectangle2D(GbPoint2D p1, GbPoint2D p2)
+//{
+//   GbPolygon2D p = GbSystem.clipPolygon2D(this.points, p1.x1, p1.x2, p2.x1, p2.x2);
+//   return(p!=null && GbSystem.greater(Math.abs(p.getArea()), 0.0));
+//}
+/*
+* Returns true if the specified 2D rectangle lies (at least partly) within this 2D triangle.
+* @param p1x1 the 1st x1 coordinate of the rectangle to check
+* @param p1x2 the 1st x2 coordinate of the rectangle to check
+* @param p2x1 the 2nd x1 coordinate of the rectangle to check
+* @param p2x2 the 2nd x2 coordinate of the rectangle to check
+* @return true if the specified 2D rectangle lies (at least partly) within this 2D triangle
+*/
+//public boolean enclosesOrCrossesRectangle2D(double p1x1, double p1x2, double p2x1, double p2x2)
+//{
+//   GbPolygon2D p = GbSystem.clipPolygon2D(this.points, p1x1, p1x2, p2x1, p2x2);
+//   return(p!=null && GbSystem.greater(Math.abs(p.getArea()), 0.0));
+//}
+/*======================================================================*/
+
+
+/*======================================================================*/
+/*  Private Methoden                                                    */
+/*                                                                      */
+void GbTriangle3D::calculateValues()
+{
+   this->x1min = this->points[0]->x1;
+   this->x1max = this->points[0]->x1;
+   this->x2min = this->points[0]->x2;
+   this->x2max = this->points[0]->x2;
+   this->x3min = this->points[0]->x3;
+   this->x3max = this->points[0]->x3;
+
+   if(this->points[1]->x1 < this->x1min) this->x1min = this->points[1]->x1;
+   if(this->points[1]->x1 > this->x1max) this->x1max = this->points[1]->x1;
+   if(this->points[1]->x2 < this->x2min) this->x2min = this->points[1]->x2;
+   if(this->points[1]->x2 > this->x2max) this->x2max = this->points[1]->x2;
+   if(this->points[1]->x3 < this->x3min) this->x3min = this->points[1]->x3;
+   if(this->points[1]->x3 > this->x3max) this->x3max = this->points[1]->x3;
+
+   if(this->points[2]->x1 < this->x1min) this->x1min = this->points[2]->x1;
+   if(this->points[2]->x1 > this->x1max) this->x1max = this->points[2]->x1;
+   if(this->points[2]->x2 < this->x2min) this->x2min = this->points[2]->x2;
+   if(this->points[2]->x2 > this->x2max) this->x2max = this->points[2]->x2;
+   if(this->points[2]->x3 < this->x3min) this->x3min = this->points[2]->x3;
+   if(this->points[2]->x3 > this->x3max) this->x3max = this->points[2]->x3;
+
+   this->x1s   = (this->points[0]->x1+this->points[1]->x1+this->points[2]->x1)/3.0;
+   this->x2s   = (this->points[0]->x2+this->points[1]->x2+this->points[2]->x2)/3.0;
+   this->x3s   = (this->points[0]->x3+this->points[1]->x3+this->points[2]->x3)/3.0;
+
+   GbVector3D A(points[0]->x1,points[0]->x2,points[0]->x3);
+   GbVector3D B(points[1]->x1,points[1]->x2,points[1]->x3);
+   GbVector3D C(points[2]->x1,points[2]->x2,points[2]->x3);
+   GbVector3D AB = B-A;
+   GbVector3D AC = C-A;
+   GbVector3D N = AB.Cross(AC);
+   this->area = 0.5*N.Length();
+   this->consistent = true;
+}
+/*======================================================================*/
+
+
+/*======================================================================*/
+GbVector3D GbTriangle3D::getNormal()
+{
+   this->calculateNormal();
+   return normal; 
+}
+/*======================================================================*/
+void GbTriangle3D::init()
+{
+   x1s        = 0.0;
+   x2s        = 0.0;
+   x3s        = 0.0;
+   x1min      = 0.0;
+   x1max      = 0.0;
+   x2min      = 0.0;
+   x2max      = 0.0;
+   area       = 0.0;
+   consistent = false;
+   points.resize(3,NULL);
+}
+/*=======================================================*/
+void GbTriangle3D::calculateNormal()
+{
+   GbPoint3D*& a = points[0]; 
+   GbPoint3D*& b = points[1];
+   GbPoint3D*& c = points[2];
+   normal[0] = ( c->getX3Coordinate() - a->getX3Coordinate()) * ( b->getX2Coordinate() - a->getX2Coordinate() ) -
+               ( b->getX3Coordinate() - a->getX3Coordinate()) * ( c->getX2Coordinate() - a->getX2Coordinate() );
+   normal[1] = ( b->getX3Coordinate() - a->getX3Coordinate()) * ( c->getX1Coordinate() - a->getX1Coordinate() ) -
+               ( b->getX1Coordinate() - a->getX1Coordinate()) * ( c->getX3Coordinate() - a->getX3Coordinate() );
+   normal[2] = ( b->getX1Coordinate() - a->getX1Coordinate()) * ( c->getX2Coordinate() - a->getX2Coordinate() ) -
+               ( b->getX2Coordinate() - a->getX2Coordinate()) * ( c->getX1Coordinate() - a->getX1Coordinate() );
+   normal.Normalize();
+}
+/*=======================================================*/
+//toDo: 
+double GbTriangle3D::getDistanceFromPoint(GbVector3D punct)
+{
+	GbVector3D Point1(this->getPoint1()->getX1Coordinate(), this->getPoint1()->getX2Coordinate(), this->getPoint1()->getX3Coordinate());
+	GbVector3D Point2(this->getPoint2()->getX1Coordinate(), this->getPoint2()->getX2Coordinate(), this->getPoint2()->getX3Coordinate());
+	GbVector3D Point3(this->getPoint3()->getX1Coordinate(), this->getPoint3()->getX2Coordinate(), this->getPoint3()->getX3Coordinate());
+
+	GbVector3D kDiff = Point1 - punct;
+	GbVector3D kEdge0 = Point2 - Point1;
+	GbVector3D kEdge1 = Point3 - Point1;
+	double fA00 = kEdge0.SquaredLength();
+	double fA01 = kEdge0.Dot(kEdge1);
+	double fA11 = kEdge1.SquaredLength();
+	double fB0 = kDiff.Dot(kEdge0);
+	double fB1 = kDiff.Dot(kEdge1);
+	double fC = kDiff.SquaredLength();
+	double fDet = fabs(fA00*fA11-fA01*fA01);
+	double fS = fA01*fB1-fA11*fB0;
+	double fT = fA01*fB0-fA00*fB1;
+	double fSqrDistance;
+
+	if (fS + fT <= fDet)
+	{
+		if (fS < (double)0.0)
+		{
+			if (fT < (double)0.0)  // region 4
+			{
+				if (fB0 < (double)0.0)
+				{
+					fT = (double)0.0;
+					if (-fB0 >= fA00)
+					{
+						fS = (double)1.0;
+						fSqrDistance = fA00+((double)2.0)*fB0+fC;
+					}
+					else
+					{
+						fS = -fB0/fA00;
+						fSqrDistance = fB0*fS+fC;
+					}
+				}
+				else
+				{
+					fS = (double)0.0;
+					if (fB1 >= (double)0.0)
+					{
+						fT = (double)0.0;
+						fSqrDistance = fC;
+					}
+					else if (-fB1 >= fA11)
+					{
+						fT = (double)1.0;
+						fSqrDistance = fA11+((double)2.0)*fB1+fC;
+					}
+					else
+					{
+						fT = -fB1/fA11;
+						fSqrDistance = fB1*fT+fC;
+					}
+				}
+			}
+			else  // region 3
+			{
+				fS = (double)0.0;
+				if (fB1 >= (double)0.0)
+				{
+					fT = (double)0.0;
+					fSqrDistance = fC;
+				}
+				else if (-fB1 >= fA11)
+				{
+					fT = (double)1.0;
+					fSqrDistance = fA11+((double)2.0)*fB1+fC;
+				}
+				else
+				{
+					fT = -fB1/fA11;
+					fSqrDistance = fB1*fT+fC;
+				}
+			}
+		}
+		else if (fT < (double)0.0)  // region 5
+		{
+			fT = (double)0.0;
+			if (fB0 >= (double)0.0)
+			{
+				fS = (double)0.0;
+				fSqrDistance = fC;
+			}
+			else if (-fB0 >= fA00)
+			{
+				fS = (double)1.0;
+				fSqrDistance = fA00+((double)2.0)*fB0+fC;
+			}
+			else
+			{
+				fS = -fB0/fA00;
+				fSqrDistance = fB0*fS+fC;
+			}
+		}
+		else  // region 0
+		{
+			// minimum at interior point
+			double fInvDet = ((double)1.0)/fDet;
+			fS *= fInvDet;
+			fT *= fInvDet;
+			fSqrDistance = fS*(fA00*fS+fA01*fT+((double)2.0)*fB0) +
+				fT*(fA01*fS+fA11*fT+((double)2.0)*fB1)+fC;
+		}
+	}
+	else
+	{
+		double fTmp0, fTmp1, fNumer, fDenom;
+
+		if (fS < (double)0.0)  // region 2
+		{
+			fTmp0 = fA01 + fB0;
+			fTmp1 = fA11 + fB1;
+			if (fTmp1 > fTmp0)
+			{
+				fNumer = fTmp1 - fTmp0;
+				fDenom = fA00-2.0f*fA01+fA11;
+				if (fNumer >= fDenom)
+				{
+					fS = (double)1.0;
+					fT = (double)0.0;
+					fSqrDistance = fA00+((double)2.0)*fB0+fC;
+				}
+				else
+				{
+					fS = fNumer/fDenom;
+					fT = (double)1.0 - fS;
+					fSqrDistance = fS*(fA00*fS+fA01*fT+2.0f*fB0) +
+						fT*(fA01*fS+fA11*fT+((double)2.0)*fB1)+fC;
+				}
+			}
+			else
+			{
+				fS = (double)0.0;
+				if (fTmp1 <= (double)0.0)
+				{
+					fT = (double)1.0;
+					fSqrDistance = fA11+((double)2.0)*fB1+fC;
+				}
+				else if (fB1 >= (double)0.0)
+				{
+					fT = (double)0.0;
+					fSqrDistance = fC;
+				}
+				else
+				{
+					fT = -fB1/fA11;
+					fSqrDistance = fB1*fT+fC;
+				}
+			}
+		}
+		else if (fT < (double)0.0)  // region 6
+		{
+			fTmp0 = fA01 + fB1;
+			fTmp1 = fA00 + fB0;
+			if (fTmp1 > fTmp0)
+			{
+				fNumer = fTmp1 - fTmp0;
+				fDenom = fA00-((double)2.0)*fA01+fA11;
+				if (fNumer >= fDenom)
+				{
+					fT = (double)1.0;
+					fS = (double)0.0;
+					fSqrDistance = fA11+((double)2.0)*fB1+fC;
+				}
+				else
+				{
+					fT = fNumer/fDenom;
+					fS = (double)1.0 - fT;
+					fSqrDistance = fS*(fA00*fS+fA01*fT+((double)2.0)*fB0) +
+						fT*(fA01*fS+fA11*fT+((double)2.0)*fB1)+fC;
+				}
+			}
+			else
+			{
+				fT = (double)0.0;
+				if (fTmp1 <= (double)0.0)
+				{
+					fS = (double)1.0;
+					fSqrDistance = fA00+((double)2.0)*fB0+fC;
+				}
+				else if (fB0 >= (double)0.0)
+				{
+					fS = (double)0.0;
+					fSqrDistance = fC;
+				}
+				else
+				{
+					fS = -fB0/fA00;
+					fSqrDistance = fB0*fS+fC;
+				}
+			}
+		}
+		else  // region 1
+		{
+			fNumer = fA11 + fB1 - fA01 - fB0;
+			if (fNumer <= (double)0.0)
+			{
+				fS = (double)0.0;
+				fT = (double)1.0;
+				fSqrDistance = fA11+((double)2.0)*fB1+fC;
+			}
+			else
+			{
+				fDenom = fA00-2.0f*fA01+fA11;
+				if (fNumer >= fDenom)
+				{
+					fS = (double)1.0;
+					fT = (double)0.0;
+					fSqrDistance = fA00+((double)2.0)*fB0+fC;
+				}
+				else
+				{
+					fS = fNumer/fDenom;
+					fT = (double)1.0 - fS;
+					fSqrDistance = fS*(fA00*fS+fA01*fT+((double)2.0)*fB0) +
+						fT*(fA01*fS+fA11*fT+((double)2.0)*fB1)+fC;
+				}
+			}
+		}
+	}
+
+	// account for numerical round-off error
+	if (fSqrDistance < (double)0.0)
+	{
+		fSqrDistance = (double)0.0;
+	}
+/*
+	m_kClosestPoint0 = punct;
+	m_kClosestPoint1 = m_rkTriangle.V[0] + fS*kEdge0 + fT*kEdge1;
+	m_afTriangleBary[1] = fS;
+	m_afTriangleBary[2] = fT;
+	m_afTriangleBary[0] = (double)1.0 - fS - fT;
+*/
+	return sqrt(fSqrDistance);
+}
diff --git a/src/VirtualFluidsBasics/geometry3d/GbTriangle3D.h b/src/VirtualFluidsBasics/geometry3d/GbTriangle3D.h
new file mode 100644
index 0000000000000000000000000000000000000000..61a8f5ff5b83df090cc5c1c0f1b98fa0ad04aac0
--- /dev/null
+++ b/src/VirtualFluidsBasics/geometry3d/GbTriangle3D.h
@@ -0,0 +1,216 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 GbTriangle3D.h
+//! \ingroup geometry3d
+//! \author Soeren Freudiger, Sebastian Geller
+//=======================================================================================
+#ifndef GBTRIANGLE3D_H
+#define GBTRIANGLE3D_H
+
+#include <sstream>
+
+#include <GbObject3D.h>
+#include <GbVector3D.h>
+#include <GbPoint3D.h>
+
+#include <PointerDefinitions.h>
+
+class GbCuboid3D;
+class GbPolygon3D;
+class GbObject3DCreator;
+
+//////////////////////////////////////////////////////////////////////////
+//! 
+//! \class GbTriangle3D
+//! 
+//! \brief This Class provides basic 3D triangle objects.
+//! \details The describing points are observed by 2D triangle objects.
+//! 
+//////////////////////////////////////////////////////////////////////////  
+
+class GbTriangle3D : public GbObject3D , public UbObserver
+{
+public:
+   /*======================================================================*/
+   /*  Konstruktoren                                                       */
+   /*                                                                      */
+   GbTriangle3D();
+   GbTriangle3D(GbPoint3D* point1, GbPoint3D* point2, GbPoint3D* point3);
+   GbTriangle3D(GbTriangle3D* triangle);
+   ~GbTriangle3D();
+   /*======================================================================*/
+   /*  Methoden                                                            */
+   /*                                                                      */
+   GbTriangle3D* clone();
+   void finalize()
+   {
+      this->deletePoints();
+   }
+
+   GbPoint3D* getPoint1()   { return this->points[0]; }
+   GbPoint3D* getPoint2()   { return this->points[1]; }
+   GbPoint3D* getPoint3()   { return this->points[2]; }
+
+   GbVector3D getNormal();
+   void       calculateNormal();
+
+   void deletePoints();
+
+   int contains(GbPoint3D* point);
+   int containsEqual(GbPoint3D* point);
+   GbPoint3D* getPoint(const int& index);
+   std::vector<GbPoint3D> getPoints();
+   double getArea();
+   double getX1Centroid();
+   double getX1Minimum();
+   double getX1Maximum();           
+   double getX2Centroid();
+   double getX2Minimum();
+   double getX2Maximum();
+   double getX3Centroid();
+   double getX3Minimum();
+   double getX3Maximum();
+
+   void setInconsistent() { this->consistent = false;}
+
+   void setPoint(GbPoint3D *point, int index);
+
+   //bool equals(GbObject3D *object)
+   std::vector<GbTriangle3D*> getSurfaceTriangleSet();
+   bool isPointInGbObject3D(const double& x1, const double& x2, const double& x3)   
+   {
+      //der einfachheit halber ... 
+      return false;
+      //throw UbException(__FILE__, __LINE__, "GbTriangle3D::isPointInObject3D- not implemented");
+   }
+   bool isPointInGbObject3D(const double& x1, const double& x2, const double& x3, bool& pointIsOnBoundary)   
+   {
+      //der einfachheit halber ... 
+      pointIsOnBoundary = false;
+      return false;
+      //throw UbException(__FILE__, __LINE__, "GbTriangle3D::isPointInObject3D- not implemented");
+   }
+   bool isCellInsideGbObject3D(const double& x11,const double& x21,const double& x31,const double& x12,const double& x22,const double& x23) { return false; }
+
+
+   // get distance from a point to the triangle
+   //todo CHANGE...
+   double getDistanceFromPoint(GbVector3D punct);
+
+   std::string toString();
+
+   /*======================================================================*/
+   /*  Calculation                                                         */
+   /*                                                                      */
+//   std::vector<GbPoint3D> calculateIntersectionPoints3D(GbLine3D *line);
+   bool hasRaytracing() { return true; }
+   /*|r| must be 1! einheitsvector!!*/
+   double getIntersectionRaytraceFactor(const double& x1, const double& x2, const double& x3, const double& rx1, const double& rx2, const double& rx3);
+//   bool isPointOnEdge(GbVector3D& q);
+   
+   GbPoint3D* calculateIntersectionPoints3D(GbLine3D* line);
+   GbPoint3D* calculateIntersectionPoints3D(GbPoint3D* linePoint1, GbPoint3D* linePoint2);
+   double calculateDistanceToPoint3D(GbPoint3D *point);
+   double calculateDistanceToPoint3D(const double& x1, const double& x2, const double& x3);      
+   double calculateNormalizedDistanceToPoint3D(const double& x1, const double& y1, const double& z1, const double& x2, const double& y2, const double& z2);
+
+   bool enclosesPoint2D(double x1, double x2);
+   GbPolygon3D* createClippedPolygon3D(GbCuboid3D* cube);   
+   GbLine3D* createClippedLine3D (GbPoint3D& point1, GbPoint3D& point2);
+   //public GbPolygon2D createClippedPolygon2D(GbPoint2D p1, GbPoint2D p2);
+   GbPolygon3D* createClippedPolygon3D(const double& p1x1, const double& p1x2, const double& p1x3, const double& p2x1, const double& p2x2, const double& p2x3);
+   //bool enclosesRectangle2D(GbRectangle2D *rectangle);
+   //public boolean enclosesRectangle2D(GbPoint2D p1, GbPoint2D p2);
+   //public boolean enclosesRectangle2D(double p1x1, double p1x2, double p2x1, double p2x2);
+   //public boolean crossesRectangle2D(GbRectangle2D rectangle);
+   //public boolean crossesRectangle2D(GbPoint2D p1, GbPoint2D p2);
+   //public boolean crossesRectangle2D(double p1x1, double p1x2, double p2x1, double p2x2);
+   //public boolean enclosesOrCrossesRectangle2D(GbRectangle2D rectangle);
+   //public boolean enclosesOrCrossesRectangle2D(GbPoint2D p1, GbPoint2D p2);
+   //public boolean enclosesOrCrossesRectangle2D(double p1x1, double p1x2, double p2x1, double p2x2);
+   /*======================================================================*/
+   /*======================================================================*/
+   /*  Private Methoden                                                    */
+   /*                                                                      */
+   virtual void calculateValues();
+
+
+   //virtuelle Methoden von UbObserver
+   //!! quick and dirty von sirann !!
+   void objectChanged(UbObservable* changedObject)
+   {
+      GbPoint3D* point = dynamic_cast<GbPoint3D*>(changedObject);
+      if(!point || (  this->points[0]!=point && this->points[1]!=point && this->points[2]!=point) ) 
+         return;
+      
+      this->consistent = false;
+   }
+   void objectWillBeDeleted(UbObservable* objectForDeletion)
+   {
+      if(this->points[0])
+      {
+         UbObservable* observedObj = dynamic_cast<UbObservable*>(this->points[0]);
+         if(objectForDeletion == observedObj) { this->points[0] = NULL; }
+      }
+      if(this->points[1])
+      {
+         UbObservable* observedObj = dynamic_cast<UbObservable*>(this->points[1]);
+         if(objectForDeletion == observedObj) { this->points[1] = NULL; }
+      }
+      if(this->points[2])
+      {
+         UbObservable* observedObj = dynamic_cast<UbObservable*>(this->points[2]);
+         if(objectForDeletion == observedObj) { this->points[2] = NULL; }
+      }
+      //ACHTUNG: eigentlich muessten in allen methoden von GbLine if abfragen fuer NULL pointer hin... toDo
+   }
+   using GbObject3D::isPointInGbObject3D; //Grund: dadurch muss man hier  isPointInGbObject3D(GbPoint3D*) nicht ausprogrammieren, welche sonst hier "ueberdeckt" waere
+
+protected:
+   bool   consistent;
+   double x1s;
+   double x2s;
+   double x3s;
+   double x1min;
+   double x1max;
+   double x2min;
+   double x2max;
+   double x3min;
+   double x3max;
+   double area;
+   
+   GbVector3D normal;
+   std::vector<GbPoint3D*> points;
+   
+private:
+   void init();
+};
+/*=========================================================================*/
+
+#endif
diff --git a/src/VirtualFluidsBasics/geometry3d/GbVector3D.cpp b/src/VirtualFluidsBasics/geometry3d/GbVector3D.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..6246a7d15316bb432894937c43523f5a99ba5431
--- /dev/null
+++ b/src/VirtualFluidsBasics/geometry3d/GbVector3D.cpp
@@ -0,0 +1,675 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 GbVector3D.cpp
+//! \ingroup geometry3d
+//! \author Soeren Freudiger, Sebastian Geller
+//=======================================================================================
+#include <GbVector3D.h>
+#include <GbPoint3D.h>
+
+#include <basics/utilities/UbMath.h>
+#include <basics/utilities/UbInfinity.h>
+
+using namespace std;
+
+
+const GbVector3D GbVector3D::ZERO(0.0,0.0,0.0);
+const GbVector3D GbVector3D::UNIT_X1(1.0,0.0,0.0);
+const GbVector3D GbVector3D::UNIT_X2(0.0,1.0,0.0);
+const GbVector3D GbVector3D::UNIT_X3(0.0,0.0,1.0);
+
+//----------------------------------------------------------------------------
+GbVector3D::GbVector3D () 
+{                                      
+   m_afTuple[0] = 0.0;
+   m_afTuple[1] = 0.0;
+   m_afTuple[2] = 0.0;
+}
+//----------------------------------------------------------------------------
+GbVector3D::GbVector3D (const double& fX, const double& fY, const double& fZ) 
+{
+   m_afTuple[0] = fX;
+   m_afTuple[1] = fY;
+   m_afTuple[2] = fZ;
+}
+//----------------------------------------------------------------------------
+GbVector3D::GbVector3D (const GbVector3D& rkV) 
+{
+   m_afTuple[0] = rkV.m_afTuple[0];
+   m_afTuple[1] = rkV.m_afTuple[1];
+   m_afTuple[2] = rkV.m_afTuple[2];
+}
+//----------------------------------------------------------------------------
+
+GbVector3D::GbVector3D (const GbPoint3D& point) 
+{
+   m_afTuple[0] = point.x1;
+   m_afTuple[1] = point.x2;
+   m_afTuple[2] = point.x3;
+}
+
+//----------------------------------------------------------------------------
+string GbVector3D::toString()
+{
+   std::stringstream ss;
+   ss<< "GbVector3D["<<m_afTuple[0]<<","<<m_afTuple[1]<<","<<m_afTuple[2]<<"]";
+   ss<<endl;
+   return((ss.str()).c_str());
+}
+//----------------------------------------------------------------------------
+GbVector3D::operator const double* () const
+{
+   return m_afTuple;
+}
+//----------------------------------------------------------------------------
+GbVector3D::operator double* ()
+{
+   return m_afTuple;
+}
+//----------------------------------------------------------------------------
+double GbVector3D::operator[] (int i) const
+{
+   assert( 0 <= i && i <= 2 );
+   if ( i < 0 )
+      i = 0;
+   else if ( i > 2 )
+      i = 2;
+
+   return m_afTuple[i];
+}
+//----------------------------------------------------------------------------
+double& GbVector3D::operator[] (int i)
+{
+   assert( 0 <= i && i <= 2 );
+   if ( i < 0 )
+      i = 0;
+   else if ( i > 2 )
+      i = 2;
+
+   return m_afTuple[i];
+}
+//----------------------------------------------------------------------------
+double GbVector3D::X1 () const
+{
+   return m_afTuple[0];
+}
+//----------------------------------------------------------------------------
+double& GbVector3D::X1 ()
+{
+   return m_afTuple[0];
+}
+//----------------------------------------------------------------------------
+double GbVector3D::X2 () const
+{
+   return m_afTuple[1];
+}
+//----------------------------------------------------------------------------
+double& GbVector3D::X2 ()
+{
+   return m_afTuple[1];
+}
+//----------------------------------------------------------------------------
+double GbVector3D::X3 () const
+{
+   return m_afTuple[2];
+}
+//----------------------------------------------------------------------------
+double& GbVector3D::X3 ()
+{
+   return m_afTuple[2];
+}
+//----------------------------------------------------------------------------
+GbVector3D& GbVector3D::operator= (const GbVector3D& rkV)
+{
+   m_afTuple[0] = rkV.m_afTuple[0];
+   m_afTuple[1] = rkV.m_afTuple[1];
+   m_afTuple[2] = rkV.m_afTuple[2];
+   return *this;
+}
+//----------------------------------------------------------------------------
+int GbVector3D::CompareArrays (const GbVector3D& rkV) const
+{
+   return memcmp(m_afTuple,rkV.m_afTuple,3*sizeof(double));
+}
+//----------------------------------------------------------------------------
+bool GbVector3D::operator== (const GbVector3D& rkV) const
+{
+   return CompareArrays(rkV) == 0;
+}
+//----------------------------------------------------------------------------
+bool GbVector3D::operator!= (const GbVector3D& rkV) const
+{
+   return CompareArrays(rkV) != 0;
+}
+//----------------------------------------------------------------------------
+bool GbVector3D::operator< (const GbVector3D& rkV) const
+{
+   return CompareArrays(rkV) < 0;
+}
+//----------------------------------------------------------------------------
+bool GbVector3D::operator<= (const GbVector3D& rkV) const
+{
+   return CompareArrays(rkV) <= 0;
+}
+//----------------------------------------------------------------------------
+bool GbVector3D::operator> (const GbVector3D& rkV) const
+{
+   return CompareArrays(rkV) > 0;
+}
+//----------------------------------------------------------------------------
+bool GbVector3D::operator>= (const GbVector3D& rkV) const
+{
+   return CompareArrays(rkV) >= 0;
+}
+//----------------------------------------------------------------------------
+GbVector3D GbVector3D::operator+ (const GbVector3D& rkV) const
+{
+   return GbVector3D(
+      m_afTuple[0]+rkV.m_afTuple[0],
+      m_afTuple[1]+rkV.m_afTuple[1],
+      m_afTuple[2]+rkV.m_afTuple[2]);
+}
+//----------------------------------------------------------------------------
+GbVector3D GbVector3D::Add(GbVector3D& vector)
+{
+   return GbVector3D(
+      m_afTuple[0]+vector.m_afTuple[0],
+      m_afTuple[1]+vector.m_afTuple[1],
+      m_afTuple[2]+vector.m_afTuple[2]);
+}
+
+//----------------------------------------------------------------------------
+GbVector3D GbVector3D::operator- (const GbVector3D& rkV) const
+{
+   return GbVector3D(
+      m_afTuple[0]-rkV.m_afTuple[0],
+      m_afTuple[1]-rkV.m_afTuple[1],
+      m_afTuple[2]-rkV.m_afTuple[2]);
+}
+//----------------------------------------------------------------------------
+GbVector3D GbVector3D::Subtract(GbVector3D& vector)
+{
+   return GbVector3D(
+      m_afTuple[0]-vector.m_afTuple[0],
+      m_afTuple[1]-vector.m_afTuple[1],
+      m_afTuple[2]-vector.m_afTuple[2]);
+}
+//----------------------------------------------------------------------------
+GbVector3D GbVector3D::operator* (const double& fScalar) const
+{
+   return GbVector3D( fScalar*m_afTuple[0],
+                      fScalar*m_afTuple[1],
+                      fScalar*m_afTuple[2]);
+}
+//----------------------------------------------------------------------------
+GbVector3D GbVector3D::operator/ (const double& fScalar) const
+{
+   GbVector3D kQuot;
+
+   if ( fScalar != 0.0 )
+   {
+      double fInvScalar = 1.0/fScalar;
+      kQuot.m_afTuple[0] = fInvScalar*m_afTuple[0];
+      kQuot.m_afTuple[1] = fInvScalar*m_afTuple[1];
+      kQuot.m_afTuple[2] = fInvScalar*m_afTuple[2];
+   }
+   else
+   {
+      kQuot.m_afTuple[0] = Ub::inf;
+      kQuot.m_afTuple[1] = Ub::inf;
+      kQuot.m_afTuple[2] = Ub::inf;
+   }
+
+   return kQuot;
+}
+//----------------------------------------------------------------------------
+GbVector3D GbVector3D::operator- () const
+{
+   return GbVector3D(
+      -m_afTuple[0],
+      -m_afTuple[1],
+      -m_afTuple[2]);
+}
+//----------------------------------------------------------------------------
+GbVector3D operator* (const double& fScalar, const GbVector3D& rkV)
+{
+   return GbVector3D(
+      fScalar*rkV[0],
+      fScalar*rkV[1],
+      fScalar*rkV[2]);
+}
+//----------------------------------------------------------------------------
+GbVector3D& GbVector3D::operator+= (const GbVector3D& rkV)
+{
+   m_afTuple[0] += rkV.m_afTuple[0];
+   m_afTuple[1] += rkV.m_afTuple[1];
+   m_afTuple[2] += rkV.m_afTuple[2];
+   return *this;
+}
+//----------------------------------------------------------------------------
+GbVector3D& GbVector3D::operator-= (const GbVector3D& rkV)
+{
+   m_afTuple[0] -= rkV.m_afTuple[0];
+   m_afTuple[1] -= rkV.m_afTuple[1];
+   m_afTuple[2] -= rkV.m_afTuple[2];
+   return *this;
+}
+//----------------------------------------------------------------------------
+GbVector3D& GbVector3D::operator*= (const double& fScalar)
+{
+   m_afTuple[0] *= fScalar;
+   m_afTuple[1] *= fScalar;
+   m_afTuple[2] *= fScalar;
+   return *this;
+}
+//----------------------------------------------------------------------------
+GbVector3D& GbVector3D::operator/= (const double& fScalar)
+{
+   if ( fScalar != (double)0.0 )
+   {
+      double fInvScalar = ((double)1.0)/fScalar;
+      m_afTuple[0] *= fInvScalar;
+      m_afTuple[1] *= fInvScalar;
+      m_afTuple[2] *= fInvScalar;
+   }
+   else
+   {
+      m_afTuple[0] = Ub::inf;
+      m_afTuple[1] = Ub::inf;
+      m_afTuple[2] = Ub::inf;
+   }
+
+   return *this;
+}
+//----------------------------------------------------------------------------
+GbVector3D GbVector3D::Scale(const double& x)
+{
+   GbVector3D PointA(0.0,0.0,0.0);
+   PointA.m_afTuple[0] = x * m_afTuple[0];
+   PointA.m_afTuple[1] = x * m_afTuple[1];
+   PointA.m_afTuple[2] = x * m_afTuple[2];
+   return PointA;	
+}
+
+//----------------------------------------------------------------------------
+double GbVector3D::Length () const
+{
+   return std::sqrt(
+      m_afTuple[0]*m_afTuple[0] +
+      m_afTuple[1]*m_afTuple[1] +
+      m_afTuple[2]*m_afTuple[2]);
+}
+//----------------------------------------------------------------------------
+double GbVector3D::SquaredLength () const
+{
+   return
+      m_afTuple[0]*m_afTuple[0] +
+      m_afTuple[1]*m_afTuple[1] +
+      m_afTuple[2]*m_afTuple[2];
+}
+//----------------------------------------------------------------------------
+double GbVector3D::Dot (const GbVector3D& rkV) const
+{
+   return
+      m_afTuple[0]*rkV.m_afTuple[0] +
+      m_afTuple[1]*rkV.m_afTuple[1] +
+      m_afTuple[2]*rkV.m_afTuple[2];
+}
+//----------------------------------------------------------------------------
+double GbVector3D::Normalize ()
+{
+   double fLength = Length();
+
+   if ( fLength > UbMath::Epsilon<double>::val() )
+   {
+      double fInvLength = ((double)1.0)/fLength;
+      m_afTuple[0] *= fInvLength;
+      m_afTuple[1] *= fInvLength;
+      m_afTuple[2] *= fInvLength;
+   }
+   else
+   {
+      fLength = 0.0;
+      m_afTuple[0] = 0.0;
+      m_afTuple[1] = 0.0;
+      m_afTuple[2] = 0.0;
+   }
+
+   return fLength;
+}
+//----------------------------------------------------------------------------
+GbVector3D GbVector3D::Cross (const GbVector3D& rkV) const
+{
+   return GbVector3D(
+      m_afTuple[1]*rkV.m_afTuple[2] - m_afTuple[2]*rkV.m_afTuple[1],
+      m_afTuple[2]*rkV.m_afTuple[0] - m_afTuple[0]*rkV.m_afTuple[2],
+      m_afTuple[0]*rkV.m_afTuple[1] - m_afTuple[1]*rkV.m_afTuple[0]);
+}
+
+//----------------------------------------------------------------------------
+
+GbVector3D GbVector3D::UnitCross (const GbVector3D& rkV) const
+{
+   GbVector3D kCross(
+      m_afTuple[1]*rkV.m_afTuple[2] - m_afTuple[2]*rkV.m_afTuple[1],
+      m_afTuple[2]*rkV.m_afTuple[0] - m_afTuple[0]*rkV.m_afTuple[2],
+      m_afTuple[0]*rkV.m_afTuple[1] - m_afTuple[1]*rkV.m_afTuple[0]);
+   kCross.Normalize();
+   return kCross;
+}
+//----------------------------------------------------------------------------
+void GbVector3D::GetBarycentrics (const GbVector3D& rkV0,
+                                  const GbVector3D& rkV1, const GbVector3D& rkV2,
+                                  const GbVector3D& rkV3, double afBary[4]) const
+{
+   // compute the vectors relative to V3 of the tetrahedron
+   GbVector3D akDiff[4] =
+   {
+      rkV0 - rkV3,
+         rkV1 - rkV3,
+         rkV2 - rkV3,
+         *this - rkV3
+   };
+
+   // If the vertices have large magnitude, the linear system of
+   // equations for computing barycentric coordinates can be
+   // ill-conditioned.  To avoid this, uniformly scale the tetrahedron
+   // edges to be of order 1.  The scaling of all differences does not
+   // change the barycentric coordinates.
+   double fMax = (double)0.0;
+   int i;
+   for (i = 0; i < 3; i++)
+   {
+      for (int j = 0; j < 3; j++)
+      {
+         double fValue = std::fabs(akDiff[i][j]);
+         if ( fValue > fMax )
+            fMax = fValue;
+      }
+   }
+
+   // scale down only large data
+   if ( fMax > (double)1.0 )
+   {
+      double fInvMax = ((double)1.0)/fMax;
+      for (i = 0; i < 4; i++)
+         akDiff[i] *= fInvMax;
+   }
+
+   double fDet = akDiff[0].Dot(akDiff[1].Cross(akDiff[2]));
+   GbVector3D kE1cE2 = akDiff[1].Cross(akDiff[2]);
+   GbVector3D kE2cE0 = akDiff[2].Cross(akDiff[0]);
+   GbVector3D kE0cE1 = akDiff[0].Cross(akDiff[1]);
+   if ( std::fabs(fDet) > UbMath::Epsilon<double>::val() )
+   {
+      double fInvDet = ((double)1.0)/fDet;
+      afBary[0] = akDiff[3].Dot(kE1cE2)*fInvDet;
+      afBary[1] = akDiff[3].Dot(kE2cE0)*fInvDet;
+      afBary[2] = akDiff[3].Dot(kE0cE1)*fInvDet;
+      afBary[3] = (double)1.0 - afBary[0] - afBary[1] - afBary[2];
+   }
+   else
+   {
+      // The tetrahedron is potentially flat.  Determine the face of
+      // maximum area and compute barycentric coordinates with respect
+      // to that face.
+      GbVector3D kE02 = rkV0 - rkV2;
+      GbVector3D kE12 = rkV1 - rkV2;
+      GbVector3D kE02cE12 = kE02.Cross(kE12);
+      double fMaxSqrArea = kE02cE12.SquaredLength();
+      int iMaxIndex = 3;
+      double fSqrArea = kE0cE1.SquaredLength();
+      if ( fSqrArea > fMaxSqrArea )
+      {
+         iMaxIndex = 0;
+         fMaxSqrArea = fSqrArea;
+      }
+      fSqrArea = kE1cE2.SquaredLength();
+      if ( fSqrArea > fMaxSqrArea )
+      {
+         iMaxIndex = 1;
+         fMaxSqrArea = fSqrArea;
+      }
+      fSqrArea = kE2cE0.SquaredLength();
+      if ( fSqrArea > fMaxSqrArea )
+      {
+         iMaxIndex = 2;
+         fMaxSqrArea = fSqrArea;
+      }
+
+      if ( fMaxSqrArea > UbMath::Epsilon<double>::val() )
+      {
+         double fInvSqrArea = ((double)1.0)/fMaxSqrArea;
+         GbVector3D kTmp;
+         if ( iMaxIndex == 0 )
+         {
+            kTmp = akDiff[3].Cross(akDiff[1]);
+            afBary[0] = kE0cE1.Dot(kTmp)*fInvSqrArea;
+            kTmp = akDiff[0].Cross(akDiff[3]);
+            afBary[1] = kE0cE1.Dot(kTmp)*fInvSqrArea;
+            afBary[2] = (double)0.0;
+            afBary[3] = (double)1.0 - afBary[0] - afBary[1];
+         }
+         else if ( iMaxIndex == 1 )
+         {
+            afBary[0] = (double)0.0;
+            kTmp = akDiff[3].Cross(akDiff[2]);
+            afBary[1] = kE1cE2.Dot(kTmp)*fInvSqrArea;
+            kTmp = akDiff[1].Cross(akDiff[3]);
+            afBary[2] = kE1cE2.Dot(kTmp)*fInvSqrArea;
+            afBary[3] = (double)1.0 - afBary[1] - afBary[2];
+         }
+         else if ( iMaxIndex == 2 )
+         {
+            kTmp = akDiff[2].Cross(akDiff[3]);
+            afBary[0] = kE2cE0.Dot(kTmp)*fInvSqrArea;
+            afBary[1] = (double)0.0;
+            kTmp = akDiff[3].Cross(akDiff[0]);
+            afBary[2] = kE2cE0.Dot(kTmp)*fInvSqrArea;
+            afBary[3] = (double)1.0 - afBary[0] - afBary[2];
+         }
+         else
+         {
+            akDiff[3] = *this - rkV2;
+            kTmp = akDiff[3].Cross(kE12);
+            afBary[0] = kE02cE12.Dot(kTmp)*fInvSqrArea;
+            kTmp = kE02.Cross(akDiff[3]);
+            afBary[1] = kE02cE12.Dot(kTmp)*fInvSqrArea;
+            afBary[2] = (double)1.0 - afBary[0] - afBary[1];
+            afBary[3] = (double)0.0;
+         }
+      }
+      else
+      {
+         // The tetrahedron is potentially a sliver.  Determine the edge of
+         // maximum length and compute barycentric coordinates with respect
+         // to that edge.
+         double fMaxSqrLength = akDiff[0].SquaredLength();
+         iMaxIndex = 0;  // <V0,V3>
+         double fSqrLength = akDiff[1].SquaredLength();
+         if ( fSqrLength > fMaxSqrLength )
+         {
+            iMaxIndex = 1;  // <V1,V3>
+            fMaxSqrLength = fSqrLength;
+         }
+         fSqrLength = akDiff[2].SquaredLength();
+         if ( fSqrLength > fMaxSqrLength )
+         {
+            iMaxIndex = 2;  // <V2,V3>
+            fMaxSqrLength = fSqrLength;
+         }
+         fSqrLength = kE02.SquaredLength();
+         if ( fSqrLength > fMaxSqrLength )
+         {
+            iMaxIndex = 3;  // <V0,V2>
+            fMaxSqrLength = fSqrLength;
+         }
+         fSqrLength = kE12.SquaredLength();
+         if ( fSqrLength > fMaxSqrLength )
+         {
+            iMaxIndex = 4;  // <V1,V2>
+            fMaxSqrLength = fSqrLength;
+         }
+         GbVector3D kE01 = rkV0 - rkV1;
+         fSqrLength = kE01.SquaredLength();
+         if ( fSqrLength > fMaxSqrLength )
+         {
+            iMaxIndex = 5;  // <V0,V1>
+            fMaxSqrLength = fSqrLength;
+         }
+
+         if ( fMaxSqrLength > UbMath::Epsilon<double>::val() )
+         {
+            double fInvSqrLength = ((double)1.0)/fMaxSqrLength;
+            if ( iMaxIndex == 0 )
+            {
+               // P-V3 = t*(V0-V3)
+               afBary[0] = akDiff[3].Dot(akDiff[0])*fInvSqrLength;
+               afBary[1] = (double)0.0;
+               afBary[2] = (double)0.0;
+               afBary[3] = (double)1.0 - afBary[0];
+            }
+            else if ( iMaxIndex == 1 )
+            {
+               // P-V3 = t*(V1-V3)
+               afBary[0] = (double)0.0;
+               afBary[1] = akDiff[3].Dot(akDiff[1])*fInvSqrLength;
+               afBary[2] = (double)0.0;
+               afBary[3] = (double)1.0 - afBary[1];
+            }
+            else if ( iMaxIndex == 2 )
+            {
+               // P-V3 = t*(V2-V3)
+               afBary[0] = (double)0.0;
+               afBary[1] = (double)0.0;
+               afBary[2] = akDiff[3].Dot(akDiff[2])*fInvSqrLength;
+               afBary[3] = (double)1.0 - afBary[2];
+            }
+            else if ( iMaxIndex == 3 )
+            {
+               // P-V2 = t*(V0-V2)
+               akDiff[3] = *this - rkV2;
+               afBary[0] = akDiff[3].Dot(kE02)*fInvSqrLength;
+               afBary[1] = (double)0.0;
+               afBary[2] = (double)1.0 - afBary[0];
+               afBary[3] = (double)0.0;
+            }
+            else if ( iMaxIndex == 4 )
+            {
+               // P-V2 = t*(V1-V2)
+               akDiff[3] = *this - rkV2;
+               afBary[0] = (double)0.0;
+               afBary[1] = akDiff[3].Dot(kE12)*fInvSqrLength;
+               afBary[2] = (double)1.0 - afBary[1];
+               afBary[3] = (double)0.0;
+            }
+            else
+            {
+               // P-V1 = t*(V0-V1)
+               akDiff[3] = *this - rkV1;
+               afBary[0] = akDiff[3].Dot(kE01)*fInvSqrLength;
+               afBary[1] = (double)1.0 - afBary[0];
+               afBary[2] = (double)0.0;
+               afBary[3] = (double)0.0;
+            }
+         }
+         else
+         {
+            // tetrahedron is a nearly a point, just return equal weights
+            afBary[0] = (double)0.25;
+            afBary[1] = afBary[0];
+            afBary[2] = afBary[0];
+            afBary[3] = afBary[0];
+         }
+      }
+   }
+}
+//----------------------------------------------------------------------------
+void GbVector3D::Orthonormalize (GbVector3D& rkU, GbVector3D& rkV, GbVector3D& rkW)
+{
+   // If the input vectors are v0, v1, and v2, then the Gram-Schmidt
+   // orthonormalization produces vectors u0, u1, and u2 as follows,
+   //
+   //   u0 = v0/|v0|
+   //   u1 = (v1-(u0*v1)u0)/|v1-(u0*v1)u0|
+   //   u2 = (v2-(u0*v2)u0-(u1*v2)u1)/|v2-(u0*v2)u0-(u1*v2)u1|
+   //
+   // where |A| indicates length of vector A and A*B indicates dot
+   // product of vectors A and B.
+
+   // compute u0
+   rkU.Normalize();
+
+   // compute u1
+   double fDot0 = rkU.Dot(rkV); 
+   rkV -= fDot0*rkU;
+   rkV.Normalize();
+
+   // compute u2
+   double fDot1 = rkV.Dot(rkW);
+   fDot0 = rkU.Dot(rkW);
+   rkW -= fDot0*rkU + fDot1*rkV;
+   rkW.Normalize();
+}
+//----------------------------------------------------------------------------
+void GbVector3D::Orthonormalize (GbVector3D* akV)
+{
+   Orthonormalize(akV[0],akV[1],akV[2]);
+}
+//----------------------------------------------------------------------------
+void GbVector3D::GenerateOrthonormalBasis (GbVector3D& rkU, GbVector3D& rkV,
+                                           GbVector3D& rkW, bool bUnitLengthW)
+{
+   if ( !bUnitLengthW )
+      rkW.Normalize();
+
+   double fInvLength;
+
+   if ( std::fabs(rkW.m_afTuple[0]) >=
+      std::fabs(rkW.m_afTuple[1]) )
+   {
+      // W.x or W.z is the largest magnitude component, swap them
+      fInvLength = UbMath::invSqrt(rkW.m_afTuple[0]*rkW.m_afTuple[0] + rkW.m_afTuple[2]*rkW.m_afTuple[2]);
+      rkU.m_afTuple[0] = -rkW.m_afTuple[2]*fInvLength;
+      rkU.m_afTuple[1] = (double)0.0;
+      rkU.m_afTuple[2] = +rkW.m_afTuple[0]*fInvLength;
+   }
+   else
+   {
+      // W.y or W.z is the largest magnitude component, swap them
+      fInvLength = UbMath::invSqrt(rkW.m_afTuple[1]*rkW.m_afTuple[1] + rkW.m_afTuple[2]*rkW.m_afTuple[2]);
+      rkU.m_afTuple[0] = (double)0.0;
+      rkU.m_afTuple[1] = +rkW.m_afTuple[2]*fInvLength;
+      rkU.m_afTuple[2] = -rkW.m_afTuple[1]*fInvLength;
+   }
+
+   rkV = rkW.Cross(rkU);
+}
+//----------------------------------------------------------------------------
+
diff --git a/src/VirtualFluidsBasics/geometry3d/GbVector3D.h b/src/VirtualFluidsBasics/geometry3d/GbVector3D.h
new file mode 100644
index 0000000000000000000000000000000000000000..61184e8e0ff1e7ba621b095bb7de4f1f3c2b098e
--- /dev/null
+++ b/src/VirtualFluidsBasics/geometry3d/GbVector3D.h
@@ -0,0 +1,144 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 GbVector3D.h
+//! \ingroup geometry3d
+//! \author Soeren Freudiger, Sebastian Geller
+//=======================================================================================
+#ifndef GBVECTOR3D_H
+#define GBVECTOR3D_H
+                                                                   
+#include <cfloat>                               
+#include <cassert> 
+#include <string>
+
+#include <PointerDefinitions.h>
+
+class GbPoint3D;
+
+//! \brief This Class provides basic 3D vector objects.
+class GbVector3D 
+{
+public:
+   // construction
+    GbVector3D (); 
+    GbVector3D (const double& fX1, const double& fX2, const double& fX3);
+    GbVector3D (const GbVector3D& rkV);
+    GbVector3D (const GbPoint3D& rkV);
+
+    std::string toString();
+
+    // coordinate access
+    operator const double* () const;
+    operator double* ();
+    double operator[] (int i) const;
+    double& operator[] (int i);
+    double X1 () const;
+    double& X1 ();
+    double X2 () const;
+    double& X2 ();                                    
+    double X3 () const;
+    double& X3 ();
+
+    // assignment
+    GbVector3D& operator= (const GbVector3D& rkV);
+
+    // comparison
+    bool operator== (const GbVector3D& rkV) const;
+    bool operator!= (const GbVector3D& rkV) const;
+    bool operator<  (const GbVector3D& rkV) const;
+    bool operator<= (const GbVector3D& rkV) const;
+    bool operator>  (const GbVector3D& rkV) const;
+    bool operator>= (const GbVector3D& rkV) const;
+
+    // arithmetic operations
+    GbVector3D operator+ (const GbVector3D& rkV) const;
+    GbVector3D operator- (const GbVector3D& rkV) const;
+    GbVector3D operator* (const double& fScalar) const;
+    GbVector3D operator/ (const double& fScalar) const;
+    GbVector3D operator- () const;
+
+    // arithmetic updates
+    GbVector3D& operator+= (const GbVector3D& rkV);
+    GbVector3D& operator-= (const GbVector3D& rkV);
+    GbVector3D& operator*= (const double& fScalar);
+    GbVector3D& operator/= (const double& fScalar);
+
+    GbVector3D Add(GbVector3D& vector);
+    GbVector3D Subtract(GbVector3D& vector);
+    GbVector3D Scale(const double& x);
+
+    // vector operations
+    double Length () const;
+    double SquaredLength () const;
+    double Dot (const GbVector3D& rkV) const;
+    double Normalize ();
+
+    // The cross products are computed using the right-handed rule.  Be aware
+    // that some graphics APIs use a left-handed rule.  If you have to compute
+    // a cross product with these functions and send the result to the API
+    // that expects left-handed, you will need to change sign on the vector
+    // (replace each component value c by -c).
+    GbVector3D Cross (const GbVector3D& rkV) const;
+    GbVector3D UnitCross (const GbVector3D& rkV) const;
+
+    // Compute the barycentric coordinates of the point with respect to the
+    // tetrahedron <V0,V1,V2,V3>, P = b0*V0 + b1*V1 + b2*V2 + b3*V3, where
+    // b0 + b1 + b2 + b3 = 1.
+    void GetBarycentrics (const GbVector3D& rkV0,
+                          const GbVector3D& rkV1, const GbVector3D& rkV2,
+                          const GbVector3D& rkV3, double afBary[4]) const;
+
+    // Gram-Schmidt orthonormalization.  Take linearly independent vectors
+    // U, V, and W and compute an orthonormal set (unit length, mutually
+    // perpendicular).
+    static void Orthonormalize (GbVector3D& rkU, GbVector3D& rkV, GbVector3D& rkW);
+    static void Orthonormalize (GbVector3D* akV);
+
+    // Input W must be initialized to a nonzero vector, output is {U,V,W},
+    // an orthonormal basis.  A hint is provided about whether or not W
+    // is already unit length.
+    static void GenerateOrthonormalBasis (GbVector3D& rkU, GbVector3D& rkV,
+                                          GbVector3D& rkW, bool bUnitLengthW);
+
+    // special vectors
+    static const GbVector3D ZERO;
+    static const GbVector3D UNIT_X1;
+    static const GbVector3D UNIT_X2;
+    static const GbVector3D UNIT_X3;
+
+private:
+    // support for comparisons
+    int CompareArrays (const GbVector3D& rkV) const;
+
+    double m_afTuple[3];
+};
+
+GbVector3D operator* (const double& fScalar, const GbVector3D& rkV);
+
+#endif //GBVECTOR3D_H
diff --git a/src/VirtualFluidsBasics/geometry3d/package.include b/src/VirtualFluidsBasics/geometry3d/package.include
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/src/VirtualFluidsDefinitions.in.h b/src/VirtualFluidsDefinitions.in.h
new file mode 100644
index 0000000000000000000000000000000000000000..567b289f8731a68f02ab25c3f3a1bd5713a57ad8
--- /dev/null
+++ b/src/VirtualFluidsDefinitions.in.h
@@ -0,0 +1,66 @@
+#ifndef VIRTUAL_FLUIDS_DEFINITIONS_H
+#define VIRTUAL_FLUIDS_DEFINITIONS_H
+
+#cmakedefine BUILD_SHARED_LIBS
+
+// disable warnings 
+#pragma warning(disable: 4251)// occurs normally while exporting standard library: "needs to have dll-interface to be"
+#pragma warning(disable: 4275) // on dll-interface class <classname> used as base for dll-interface class <classname>
+
+
+// double or single precision
+#cmakedefine VF_DOUBLE_ACCURACY
+
+// External libraries
+#cmakedefine VF_BUILD_WITH_MPI
+#cmakedefine VF_BUILD_WITH_METIS
+#cmakedefine VF_BUILD_WITH_CUDA
+
+// Compiler
+#cmakedefine VF_CXX_COMPILER_IS_GNU
+#cmakedefine VF_CXX_COMPILER_IS_INTEL
+#cmakedefine VF_CXX_COMPILER_IS_IBM
+#cmakedefine VF_CXX_COMPILER_IS_MSVC
+#cmakedefine VF_CXX_COMPILER_IS_CLANG
+
+
+// Generic helper definitions for shared library support
+#if defined _WIN32 || defined __CYGWIN__
+  #define VF_SHARED_LIB_IMPORT __declspec(dllimport)
+  #define VF_SHARED_LIB_EXPORT __declspec(dllexport)
+  #define VF_SHARED_LIB_LOCAL
+#else
+  #if __GNUC__ >= 4
+    #define VF_SHARED_LIB_IMPORT __attribute__ ((visibility ("default")))
+    #define VF_SHARED_LIB_EXPORT __attribute__ ((visibility ("default")))
+    #define VF_SHARED_LIB_LOCAL  __attribute__ ((visibility ("hidden")))
+  #else
+    #define VF_SHARED_LIB_IMPORT
+    #define VF_SHARED_LIB_EXPORT
+    #define VF_SHARED_LIB_LOCAL
+  #endif
+#endif
+
+// Now we use the generic helper definitions above to define VF_PUBLIC, VF_PROTECTED
+// and VF_PRIVATE. VF_PUBLIC is for symbols part of the public application programming
+// interface (API), VF_PROTECTED is for symbols used e.g. by public templated or
+// inlined code. These symbols must also be publicly available when compiling the
+// application. VF_PRIVATE are symbols for internal use inside the library only.
+
+#ifdef BUILD_SHARED_LIBS
+   // defined if VF is compiled as a shared library
+   #ifdef VF_SHARED_LIB_SELECT_IMPORTS
+      // defined if we are building the VF SHARED_LIB (instead of using it)
+      #define VF_PUBLIC VF_SHARED_LIB_IMPORT
+   #else
+      #define VF_PUBLIC VF_SHARED_LIB_EXPORT
+   #endif
+   #define VF_PRIVATE VF_SHARED_LIB_LOCAL
+#else
+   // VF_SHARED_LIB is not defined: this means VF is a static library
+   #define VF_PUBLIC
+   #define VF_PRIVATE
+#endif
+#define VF_PROTECTED VF_PUBLIC
+
+#endif
diff --git a/src/VirtualFluids_GPU/DataStructureInitializer/GridProvider.cpp b/src/VirtualFluids_GPU/DataStructureInitializer/GridProvider.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..8d29deae8590736454120daf7e778af3f9976d62
--- /dev/null
+++ b/src/VirtualFluids_GPU/DataStructureInitializer/GridProvider.cpp
@@ -0,0 +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 GridProvider.cpp
+//! \ingroup DataStructureInitializer
+//! \author Martin Schoenherr
+//=======================================================================================
+#include "GridProvider.h"
+
+#include "Parameter/Parameter.h"
+#include "GPU/CudaMemoryManager.h"
+#include "GridReaderGenerator/GridGenerator.h"
+#include "GridGenerator/grid/GridBuilder/GridBuilder.h"
+
+
+SPtr<GridProvider> GridProvider::makeGridGenerator(SPtr<GridBuilder> builder, SPtr<Parameter> para, SPtr<CudaMemoryManager> cudaManager)
+{
+    return SPtr<GridProvider>(new GridGenerator(builder, para, cudaManager));
+}
+
+void GridProvider::setNumberOfNodes(const int numberOfNodes) const
+{
+    para->getParH()->numberOfNodes = numberOfNodes;
+    para->getParD()->numberOfNodes = numberOfNodes;
+    para->getParH()->mem_size_real = sizeof(real) * para->getParH()->numberOfNodes;
+    para->getParH()->mem_size_int  = sizeof(uint) * para->getParH()->numberOfNodes;
+    para->getParD()->mem_size_real = sizeof(real) * para->getParD()->numberOfNodes;
+    para->getParD()->mem_size_int  = sizeof(uint) * para->getParD()->numberOfNodes;
+}
+
+void GridProvider::setInitalNodeValues(const int numberOfNodes) const
+{
+    for (int j = 1; j <= numberOfNodes; j++)
+    {
+        para->getParH()->rho[j] = real(0.0);
+        para->getParH()->velocityY[j]  = real(0.0);
+        para->getParH()->velocityX[j]  = real(0.0);
+        para->getParH()->velocityZ[j]  = real(0.0);
+    }
+}
+
+
+void GridProvider::setVelocitySize(int size) const
+{
+    para->getParH()->numberOfInflowBCnodes = size;
+    para->getParD()->numberOfInflowBCnodes = size;
+}
+
+void GridProvider::allocAndCopyForcing()
+{
+    cudaMemoryManager->cudaAllocForcing();
+    cudaMemoryManager->cudaCopyForcingToDevice();
+}
+
+void GridProvider::freeMemoryOnHost()
+{
+    cudaMemoryManager->cudaFreeCoord();
+    cudaMemoryManager->cudaFreeSP();
+}
+
+void GridProvider::cudaCopyDataToHost()
+{
+    cudaMemoryManager->cudaCopyDataToHost();
+}
diff --git a/src/VirtualFluids_GPU/DataStructureInitializer/GridProvider.h b/src/VirtualFluids_GPU/DataStructureInitializer/GridProvider.h
new file mode 100644
index 0000000000000000000000000000000000000000..ce93946ab9205208470433feb00efcfdf894c470
--- /dev/null
+++ b/src/VirtualFluids_GPU/DataStructureInitializer/GridProvider.h
@@ -0,0 +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 GridProvider.h
+//! \ingroup DataStructureInitializer
+//! \author Martin Schoenherr
+//=======================================================================================
+#ifndef GridReader_H
+#define GridReader_H
+
+#include <memory>
+
+#include <VirtualFluidsDefinitions.h>
+#include "Core/PointerDefinitions.h"
+
+//! \brief Class forwarding for CudaMemoryManager, GridBuilder and Parameter
+class Parameter;
+class GridBuilder;
+class CudaMemoryManager;
+
+//! \class GridProvider
+//! \brief mapping the grid of grid generator to data structure for simulation
+class VF_PUBLIC GridProvider
+{
+public:
+	//! \brief makes an object of GridGenerator
+	//! \param builder shared pointer to instance of GridBuilder
+	//! \param para shared pointer to instance of classParameter
+	//! \param cudaManager shared pointer to instance of class CudaMemoryManager
+	static SPtr<GridProvider> makeGridGenerator(SPtr<GridBuilder> builder, SPtr<Parameter> para, SPtr<CudaMemoryManager> cudaManager);
+
+	//! \brief allocates and initialized the data structures for Coordinates and node types
+	virtual void allocArrays_CoordNeighborGeo() = 0;
+	//! \brief allocates and initialized the values at the boundary conditions
+	virtual void allocArrays_BoundaryValues() = 0;
+	//! \brief allocates and initialized the sub-grid distances at the boundary conditions
+	virtual void allocArrays_BoundaryQs() = 0;
+
+	//! \brief allocates forces and copy them to the device
+	virtual void allocAndCopyForcing();
+	//! \brief clears pinned memory on host
+	virtual void freeMemoryOnHost();
+	//! \brief copy data from device to host
+	virtual void cudaCopyDataToHost();
+
+	//! Class default destructor
+	virtual ~GridProvider() {}
+
+protected:
+	//! \brief set the number of lattice nodes and memory sizes for different data types
+	//! \param numberOfNodes integer value with number of lattice nodes
+	void setNumberOfNodes(const int numberOfNodes) const;
+	//! \brief set the values for macroscopic values (velocities, rho) to zero
+	//! \param numberOfNodes integer value with number of lattice nodes
+	virtual void setInitalNodeValues(const int numberOfNodes) const;
+	//! \brief set the size of velocity boundary condition
+	//! \param numberOfNodes integer value with number of lattice nodes
+	void setVelocitySize(int size) const;
+
+	//! \brief shared pointer to parameter, gridProvider, dataWriter and cudaManager objects
+	//! \property para is a shared pointer to an object of Parameter
+	SPtr<Parameter> para;
+	//! \property cudaManager is a shared pointer to an object of CudaMemoryManager
+	SPtr<CudaMemoryManager> cudaMemoryManager;
+};
+
+#endif
diff --git a/src/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.cpp b/src/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..397bf2093d54ad85cfa5a15d61bbd9bacfc98230
--- /dev/null
+++ b/src/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.cpp
@@ -0,0 +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 GridGenerator.cpp
+//! \ingroup DataStructureInitializer
+//! \author Martin Schoenherr
+//=======================================================================================
+#include "GridGenerator.h"
+#include <sstream>
+#include <iostream>
+
+#include "LBM/LB.h"
+#include "LBM/D3Q27.h"
+#include "Parameter/Parameter.h"
+#include "GridGenerator/grid/GridBuilder/GridBuilder.h"
+#include "GPU/CudaMemoryManager.h"
+#include "utilities/math/Math.h"
+
+GridGenerator::GridGenerator(SPtr<GridBuilder> builder, SPtr<Parameter> para, SPtr<CudaMemoryManager> cudaManager)
+{
+	this->builder = builder;
+    this->para = para;
+    this->cudaMemoryManager = cudaManager;
+}
+
+GridGenerator::~GridGenerator()
+{
+
+}
+
+void GridGenerator::allocArrays_CoordNeighborGeo()
+{
+	int numberOfNodesGlobal = 0;
+	std::cout << "Number of Nodes: " << std::endl;
+	
+	const int numberOfNodes = builder->getNumberOfNodes(0) + 1;
+	numberOfNodesGlobal += numberOfNodes;
+	
+	setNumberOfNodes(numberOfNodes);
+	
+	cudaMemoryManager->cudaAllocCoord();
+    cudaMemoryManager->cudaAllocSP();
+	cudaMemoryManager->cudaAllocNeighborWSB();
+
+	builder->getNodeValues(
+		para->getParH()->coordinateX,
+		para->getParH()->coordinateY,
+		para->getParH()->coordinateZ,
+		para->getParH()->neighborX,
+		para->getParH()->neighborY,
+		para->getParH()->neighborZ,
+		para->getParH()->neighborInverse,
+		para->getParH()->typeOfGridNode,
+		0);
+
+	setInitalNodeValues(numberOfNodes);
+
+    cudaMemoryManager->cudaCopyNeighborWSB();
+    cudaMemoryManager->cudaCopySP();
+    cudaMemoryManager->cudaCopyCoord();
+
+	std::cout << "Number of Nodes: " << numberOfNodesGlobal << std::endl;
+	std::cout << "-----finish Coord, Neighbor, Geo------" << std::endl;
+}
+
+void GridGenerator::allocArrays_BoundaryValues()
+{
+	std::cout << "------read BoundaryValues------" << std::endl;
+
+    const auto numberOfVelocityValues = int(builder->getVelocitySize(0));
+	std::cout << "size velocity: " << numberOfVelocityValues << std::endl;
+    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+    int blocks = (numberOfVelocityValues / para->getParH()->numberofthreads) + 1;
+    para->getParH()->inflowBC.kArray = blocks * para->getParH()->numberofthreads;
+    para->getParD()->inflowBC.kArray = para->getParH()->inflowBC.kArray;
+    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+    para->getParH()->numberOfInflowBCnodes = numberOfVelocityValues;
+    para->getParD()->numberOfInflowBCnodes = numberOfVelocityValues;
+
+    if (numberOfVelocityValues > 1)
+    {
+		cudaMemoryManager->cudaAllocVeloBC();
+
+        builder->getVelocityValues(para->getParH()->inflowBC.Vx, para->getParH()->inflowBC.Vy, para->getParH()->inflowBC.Vz, para->getParH()->inflowBC.k, 0);
+
+		cudaMemoryManager->cudaCopyVeloBC();
+    }
+}
+
+
+void GridGenerator::allocArrays_BoundaryQs()
+{
+	std::cout << "------read BoundaryQs-------" << std::endl;
+    const auto numberOfVelocityNodes = int(builder->getVelocitySize(0));
+    if (numberOfVelocityNodes > 0)
+    {
+		std::cout << "size velocity: " << numberOfVelocityNodes << std::endl;
+        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+        //preprocessing
+        real* QQ = para->getParH()->inflowBC.q27[0];
+		unsigned int sizeQ = para->getParH()->numberOfInflowBCnodes;
+        QforBoundaryConditions Q;
+        Q.q27[dirE   ] = &QQ[dirE   *sizeQ];
+        Q.q27[dirW   ] = &QQ[dirW   *sizeQ];
+        Q.q27[dirN   ] = &QQ[dirN   *sizeQ];
+        Q.q27[dirS   ] = &QQ[dirS   *sizeQ];
+        Q.q27[dirT   ] = &QQ[dirT   *sizeQ];
+        Q.q27[dirB   ] = &QQ[dirB   *sizeQ];
+        Q.q27[dirNE  ] = &QQ[dirNE  *sizeQ];
+        Q.q27[dirSW  ] = &QQ[dirSW  *sizeQ];
+        Q.q27[dirSE  ] = &QQ[dirSE  *sizeQ];
+        Q.q27[dirNW  ] = &QQ[dirNW  *sizeQ];
+        Q.q27[dirTE  ] = &QQ[dirTE  *sizeQ];
+        Q.q27[dirBW  ] = &QQ[dirBW  *sizeQ];
+        Q.q27[dirBE  ] = &QQ[dirBE  *sizeQ];
+        Q.q27[dirTW  ] = &QQ[dirTW  *sizeQ];
+        Q.q27[dirTN  ] = &QQ[dirTN  *sizeQ];
+        Q.q27[dirBS  ] = &QQ[dirBS  *sizeQ];
+        Q.q27[dirBN  ] = &QQ[dirBN  *sizeQ];
+        Q.q27[dirTS  ] = &QQ[dirTS  *sizeQ];
+        Q.q27[dirREST] = &QQ[dirREST*sizeQ];
+        Q.q27[dirTNE ] = &QQ[dirTNE *sizeQ];
+        Q.q27[dirTSW ] = &QQ[dirTSW *sizeQ];
+        Q.q27[dirTSE ] = &QQ[dirTSE *sizeQ];
+        Q.q27[dirTNW ] = &QQ[dirTNW *sizeQ];
+        Q.q27[dirBNE ] = &QQ[dirBNE *sizeQ];
+        Q.q27[dirBSW ] = &QQ[dirBSW *sizeQ];
+        Q.q27[dirBSE ] = &QQ[dirBSE *sizeQ];
+        Q.q27[dirBNW ] = &QQ[dirBNW *sizeQ];
+
+        builder->getVelocityQs(Q.q27, 0);
+
+		cudaMemoryManager->cudaCopyVeloBC();
+    }
+
+	std::cout << "-----finish BoundaryQs------" << std::endl;
+}
+
+
+
+
+std::string GridGenerator::verifyNeighborIndices() const
+{
+    std::ostringstream oss;
+    oss << "---------report start---------\n";
+    oss << "Checking neighbor indices in grid \n";
+
+    int invalidNodes = 0;
+    int wrongNeighbors = 0;
+    int stopperNodes = 0;
+
+    for (uint index = 0; index < para->getParH()->numberOfNodes; index++)
+        oss << verifyNeighborIndex(index, invalidNodes, stopperNodes, wrongNeighbors);
+
+
+    oss << "invalid nodes found: " << invalidNodes << "\n";
+    oss << "wrong neighbors found: " << wrongNeighbors << "\n";
+    oss << "stopper nodes found : " << stopperNodes << "\n";
+    oss << "---------report end---------\n";
+    return oss.str();
+}
+
+std::string GridGenerator::verifyNeighborIndex(int index , int &invalidNodes, int &stopperNodes, int &wrongNeighbors) const
+{
+    std::ostringstream oss;
+
+    const int geo = para->getParH()->typeOfGridNode[index];
+    if (geo == 16)
+    {
+        stopperNodes++;
+        return "";
+    }
+
+    real x = para->getParH()->coordinateX[index];
+    real y = para->getParH()->coordinateY[index];
+    real z = para->getParH()->coordinateZ[index];
+
+    real delta = para->getParH()->coordinateX[2] - para->getParH()->coordinateX[1];
+
+    real maxX = para->getParH()->coordinateX[para->getParH()->numberOfNodes - 1] - delta;
+    real maxY = para->getParH()->coordinateY[para->getParH()->numberOfNodes - 1] - delta;
+    real maxZ = para->getParH()->coordinateZ[para->getParH()->numberOfNodes - 1] - delta;
+    real realNeighborX = vf::Math::lessEqual(x + delta, maxX) ? x + delta : para->getParH()->coordinateX[1];
+    real realNeighborY = vf::Math::lessEqual(y + delta, maxY) ? y + delta : para->getParH()->coordinateY[1];
+    real realNeighborZ = vf::Math::lessEqual(z + delta, maxZ) ? z + delta : para->getParH()->coordinateZ[1];
+
+    oss << checkNeighbor(x, y, z, index, wrongNeighbors, this->para->getParH()->neighborX[index], realNeighborX, y, z, "X");
+    oss << checkNeighbor(x, y, z, index, wrongNeighbors, this->para->getParH()->neighborY[index], x, realNeighborY, z, "Y");
+    oss << checkNeighbor(x, y, z, index, wrongNeighbors, this->para->getParH()->neighborZ[index], x, y, realNeighborZ, "Z");
+
+    oss << checkNeighbor(x, y, z, index, wrongNeighbors, this->para->getParH()->neighborY[this->para->getParH()->neighborX[index]], realNeighborX, realNeighborY, z, "XY");
+    oss << checkNeighbor(x, y, z, index, wrongNeighbors, this->para->getParH()->neighborZ[this->para->getParH()->neighborX[index]], realNeighborX, y, realNeighborZ, "XZ");
+    oss << checkNeighbor(x, y, z, index, wrongNeighbors, this->para->getParH()->neighborZ[this->para->getParH()->neighborY[index]], x, realNeighborY, realNeighborZ, "YZ");
+
+    oss << checkNeighbor(x, y, z, index, wrongNeighbors, this->para->getParH()->neighborZ[this->para->getParH()->neighborY[this->para->getParH()->neighborX[index]]], realNeighborX, realNeighborY, realNeighborZ, "XYZ");
+
+    return oss.str();
+}
+
+std::string GridGenerator::checkNeighbor(real x, real y, real z, int index, int& numberOfWrongNeihgbors, int neighborIndex, real neighborX, real neighborY, real neighborZ, std::string direction) const
+{
+    std::ostringstream oss("");
+
+    real neighborCoordX = para->getParH()->coordinateX[neighborIndex];
+    real neighborCoordY = para->getParH()->coordinateY[neighborIndex];
+    real neighborCoordZ = para->getParH()->coordinateZ[neighborIndex];
+
+    const bool neighborValid = vf::Math::equal(neighborX, neighborCoordX) && vf::Math::equal(neighborY, neighborCoordY) && vf::Math::equal(neighborZ, neighborCoordZ);
+
+    if (!neighborValid) {
+        oss << "NeighborX invalid from: (" << x << ", " << y << ", " << z << "), index: " << index << ", "
+            << direction << " neighborIndex: " << neighborIndex << 
+            ", actual neighborCoords : (" << neighborCoordX << ", " << neighborCoordY << ", " << neighborCoordZ << 
+            "), expected neighborCoords : (" << neighborX << ", " << neighborY << ", " << neighborZ << ")\n";
+        numberOfWrongNeihgbors++;
+    }
+    return oss.str();
+}
diff --git a/src/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.h b/src/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.h
new file mode 100644
index 0000000000000000000000000000000000000000..7636034f064b7776694c6102701afe302497c1ee
--- /dev/null
+++ b/src/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.h
@@ -0,0 +1,93 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 GridGenerator.h
+//! \ingroup DataStructureInitializer
+//! \author Martin Schoenherr
+//=======================================================================================
+#ifndef GridReaderGenerator_H
+#define GridReaderGenerator_H
+
+#include "../GridProvider.h"
+#include <VirtualFluidsDefinitions.h>
+#include "LBM/LB.h"
+
+//! \brief Class forwarding for Parameter and GridBuilder
+class Parameter;
+class GridBuilder;
+
+//! \class GridGenerator derived class of GridProvider
+//! \brief mapping the grid of grid generator to data structure for simulation
+class GridGenerator
+	: public GridProvider
+{
+private:
+	//! \brief string vector with channel direction
+	std::vector<std::string> channelDirections;
+	//! \brief string vector with channel direction
+	std::vector<std::string> channelBoundaryConditions;
+
+	//! \brief shared pointer to GridBuilder object
+	//! \property builder is a shared pointer to an object of GridBuilder
+	SPtr<GridBuilder> builder;
+
+public:
+	//! Class constructor
+	//! \param builder shared pointer to instance of GridBuilder
+	//! \param para shared pointer to instance of classParameter
+	//! \param cudaManager shared pointer to instance of class CudaMemoryManager
+	VF_PUBLIC GridGenerator(SPtr<GridBuilder> builder, SPtr<Parameter> para, SPtr<CudaMemoryManager> cudaManager);
+	//! Class default destructor
+	VF_PUBLIC virtual ~GridGenerator();
+
+	//! \brief allocates and initialized the data structures for Coordinates and node types
+	void allocArrays_CoordNeighborGeo() override;
+	//! \brief allocates and initialized the values at the boundary conditions
+	void allocArrays_BoundaryValues() override;
+	//! \brief allocates and initialized the sub-grid distances at the boundary conditions
+	void allocArrays_BoundaryQs() override;
+	
+private:
+	//! \brief verifies if there are invalid nodes, stopper nodes or wrong neighbors
+	std::string verifyNeighborIndices() const;
+	//! \brief verifies single neighbor index
+	//! \param index type integer
+	//! \param invalidNodes reference to invalid nodes
+	//! \param stopperNodes reference to stopper nodes
+	//! \param wrongNeighbors reference to wrong neighbors
+	std::string verifyNeighborIndex(int index, int &invalidNodes, int &stopperNodes, int &wrongNeighbors) const;
+	//! \brief check the neighbors
+	//! \param x,y,z lattice node position
+	//! \param numberOfWrongNeihgbors reference to the number of wrong neighbors
+	//! \param neighborIndex index of neighbor node
+	//! \param neighborX,neighborY,neighborZ neighbor lattice node position
+	//! \param direction type string
+	std::string checkNeighbor(real x, real y, real z, int index, int& numberOfWrongNeihgbors, int neighborIndex, real neighborX, real neighborY, real neighborZ, std::string direction) const;
+};
+
+#endif
diff --git a/src/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/package.include b/src/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/package.include
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/src/VirtualFluids_GPU/DataStructureInitializer/package.include b/src/VirtualFluids_GPU/DataStructureInitializer/package.include
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/src/VirtualFluids_GPU/GPU/CalcMac27.cu b/src/VirtualFluids_GPU/GPU/CalcMac27.cu
new file mode 100644
index 0000000000000000000000000000000000000000..d97758be9f1531e14d3cba590c72d8c96900b4de
--- /dev/null
+++ b/src/VirtualFluids_GPU/GPU/CalcMac27.cu
@@ -0,0 +1,257 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 CalcMac27.cu
+//! \ingroup GPU
+//! \author Martin Schoenherr
+//=======================================================================================
+/* Device code */
+#include "LBM/LB.h" 
+#include "LBM/D3Q27.h"
+#include "Core/RealConstants.h"
+
+////////////////////////////////////////////////////////////////////////////////
+extern "C" __global__ void LBCalcMacCompSP27( 
+	real* velocityX,
+	real* velocityY,
+	real* velocityZ,
+	real* rho,
+	real* pressure,
+	uint* typeOfGridNode,
+	uint* neighborX,
+	uint* neighborY,
+	uint* neighborZ,
+	uint size_Mat,
+	real* distributions,
+	bool isEvenTimestep)
+{
+   //////////////////////////////////////////////////////////////////////////
+   //! The velocity boundary condition is executed in the following steps
+   //!
+   ////////////////////////////////////////////////////////////////////////////////
+   //! - Get node index coordinates from thredIdx, blockIdx, blockDim and gridDim.
+   //!
+   const unsigned  x = threadIdx.x;  // Globaler x-Index 
+   const unsigned  y = blockIdx.x;   // Globaler y-Index 
+   const unsigned  z = blockIdx.y;   // Globaler z-Index 
+
+   const unsigned nx = blockDim.x;
+   const unsigned ny = gridDim.x;
+
+   const unsigned k = nx*(ny*z + y) + x;
+   //////////////////////////////////////////////////////////////////////////
+
+   //////////////////////////////////////////////////////////////////////////
+   // run for all indices in size_Mat and fluid nodes
+   if ((k < size_Mat) && (typeOfGridNode[k] == GEO_FLUID))
+   {
+      //////////////////////////////////////////////////////////////////////////
+      //! - Read distributions: style of reading and writing the distributions from/to stored arrays dependent on timestep is based on the esoteric twist algorithm \ref
+      //! <a href="https://doi.org/10.3390/computation5020019"><b>[ M. Geier et al. (2017), DOI:10.3390/computation5020019 ]</b></a>
+      //!
+      Distributions27 dist;
+      if (isEvenTimestep)
+      {
+         dist.f[dirE   ] = &distributions[dirE   *size_Mat];
+         dist.f[dirW   ] = &distributions[dirW   *size_Mat];
+         dist.f[dirN   ] = &distributions[dirN   *size_Mat];
+         dist.f[dirS   ] = &distributions[dirS   *size_Mat];
+         dist.f[dirT   ] = &distributions[dirT   *size_Mat];
+         dist.f[dirB   ] = &distributions[dirB   *size_Mat];
+         dist.f[dirNE  ] = &distributions[dirNE  *size_Mat];
+         dist.f[dirSW  ] = &distributions[dirSW  *size_Mat];
+         dist.f[dirSE  ] = &distributions[dirSE  *size_Mat];
+         dist.f[dirNW  ] = &distributions[dirNW  *size_Mat];
+         dist.f[dirTE  ] = &distributions[dirTE  *size_Mat];
+         dist.f[dirBW  ] = &distributions[dirBW  *size_Mat];
+         dist.f[dirBE  ] = &distributions[dirBE  *size_Mat];
+         dist.f[dirTW  ] = &distributions[dirTW  *size_Mat];
+         dist.f[dirTN  ] = &distributions[dirTN  *size_Mat];
+         dist.f[dirBS  ] = &distributions[dirBS  *size_Mat];
+         dist.f[dirBN  ] = &distributions[dirBN  *size_Mat];
+         dist.f[dirTS  ] = &distributions[dirTS  *size_Mat];
+         dist.f[dirREST] = &distributions[dirREST*size_Mat];
+         dist.f[dirTNE ] = &distributions[dirTNE *size_Mat];
+         dist.f[dirTSW ] = &distributions[dirTSW *size_Mat];
+         dist.f[dirTSE ] = &distributions[dirTSE *size_Mat];
+         dist.f[dirTNW ] = &distributions[dirTNW *size_Mat];
+         dist.f[dirBNE ] = &distributions[dirBNE *size_Mat];
+         dist.f[dirBSW ] = &distributions[dirBSW *size_Mat];
+         dist.f[dirBSE ] = &distributions[dirBSE *size_Mat];
+         dist.f[dirBNW ] = &distributions[dirBNW *size_Mat];
+      } 
+      else
+      {
+         dist.f[dirW   ] = &distributions[dirE   *size_Mat];
+         dist.f[dirE   ] = &distributions[dirW   *size_Mat];
+         dist.f[dirS   ] = &distributions[dirN   *size_Mat];
+         dist.f[dirN   ] = &distributions[dirS   *size_Mat];
+         dist.f[dirB   ] = &distributions[dirT   *size_Mat];
+         dist.f[dirT   ] = &distributions[dirB   *size_Mat];
+         dist.f[dirSW  ] = &distributions[dirNE  *size_Mat];
+         dist.f[dirNE  ] = &distributions[dirSW  *size_Mat];
+         dist.f[dirNW  ] = &distributions[dirSE  *size_Mat];
+         dist.f[dirSE  ] = &distributions[dirNW  *size_Mat];
+         dist.f[dirBW  ] = &distributions[dirTE  *size_Mat];
+         dist.f[dirTE  ] = &distributions[dirBW  *size_Mat];
+         dist.f[dirTW  ] = &distributions[dirBE  *size_Mat];
+         dist.f[dirBE  ] = &distributions[dirTW  *size_Mat];
+         dist.f[dirBS  ] = &distributions[dirTN  *size_Mat];
+         dist.f[dirTN  ] = &distributions[dirBS  *size_Mat];
+         dist.f[dirTS  ] = &distributions[dirBN  *size_Mat];
+         dist.f[dirBN  ] = &distributions[dirTS  *size_Mat];
+         dist.f[dirREST] = &distributions[dirREST*size_Mat];
+         dist.f[dirTNE ] = &distributions[dirBSW *size_Mat];
+         dist.f[dirTSW ] = &distributions[dirBNE *size_Mat];
+         dist.f[dirTSE ] = &distributions[dirBNW *size_Mat];
+         dist.f[dirTNW ] = &distributions[dirBSE *size_Mat];
+         dist.f[dirBNE ] = &distributions[dirTSW *size_Mat];
+         dist.f[dirBSW ] = &distributions[dirTNE *size_Mat];
+         dist.f[dirBSE ] = &distributions[dirTNW *size_Mat];
+         dist.f[dirBNW ] = &distributions[dirTSE *size_Mat];
+      }
+	  ////////////////////////////////////////////////////////////////////////////////
+	  //! - Set neighbor indices (necessary for indirect addressing)  
+	  //!
+	  uint ke = k;
+      uint kw   = neighborX[k];
+      uint kn   = k;
+      uint ks   = neighborY[k];
+      uint kt   = k;
+      uint kb   = neighborZ[k];
+      uint ksw  = neighborY[kw];
+      uint kne  = k;
+      uint kse  = ks;
+      uint knw  = kw;
+      uint kbw  = neighborZ[kw];
+      uint kte  = k;
+      uint kbe  = kb;
+      uint ktw  = kw;
+      uint kbs  = neighborZ[ks];
+      uint ktn  = k;
+      uint kbn  = kb;
+      uint kts  = ks;
+      uint ktse = ks;
+      uint kbnw = kbw;
+      uint ktnw = kw;
+      uint kbse = kbs;
+      uint ktsw = ksw;
+      uint kbne = kb;
+      uint ktne = k;
+      uint kbsw = neighborZ[ksw];
+	  ////////////////////////////////////////////////////////////////////////////////
+	  //! - Set local distributions  
+	  //!
+	  real mfcbb = (dist.f[dirE   ])[k   ];
+	  real mfabb = (dist.f[dirW   ])[kw  ];
+	  real mfbcb = (dist.f[dirN   ])[k   ];
+	  real mfbab = (dist.f[dirS   ])[ks  ];
+	  real mfbbc = (dist.f[dirT   ])[k   ];
+	  real mfbba = (dist.f[dirB   ])[kb  ];
+	  real mfccb = (dist.f[dirNE  ])[k   ];
+	  real mfaab = (dist.f[dirSW  ])[ksw ];
+	  real mfcab = (dist.f[dirSE  ])[ks  ];
+	  real mfacb = (dist.f[dirNW  ])[kw  ];
+	  real mfcbc = (dist.f[dirTE  ])[k   ];
+	  real mfaba = (dist.f[dirBW  ])[kbw ];
+	  real mfcba = (dist.f[dirBE  ])[kb  ];
+	  real mfabc = (dist.f[dirTW  ])[kw  ];
+	  real mfbcc = (dist.f[dirTN  ])[k   ];
+	  real mfbaa = (dist.f[dirBS  ])[kbs ];
+	  real mfbca = (dist.f[dirBN  ])[kb  ];
+	  real mfbac = (dist.f[dirTS  ])[ks  ];
+	  real mfbbb = (dist.f[dirREST])[k   ];
+	  real mfccc = (dist.f[dirTNE ])[k   ];
+	  real mfaac = (dist.f[dirTSW ])[ksw ];
+	  real mfcac = (dist.f[dirTSE ])[ks  ];
+	  real mfacc = (dist.f[dirTNW ])[kw  ];
+	  real mfcca = (dist.f[dirBNE ])[kb  ];
+	  real mfaaa = (dist.f[dirBSW ])[kbsw];
+	  real mfcaa = (dist.f[dirBSE ])[kbs ];
+	  real mfaca = (dist.f[dirBNW ])[kbw ];
+	  ////////////////////////////////////////////////////////////////////////////////
+	  //! - Set pressure, density and velocity to \f$ 1.0 \f$  
+	  //!
+	  pressure[k]  = c0o1;
+	  rho[k]       = c0o1;
+	  velocityX[k] = c0o1;
+	  velocityY[k] = c0o1;
+	  velocityZ[k] = c0o1;
+
+      //////////////////////////////////////////////////////////////////////////
+	  //! - Calculate density and velocity using pyramid summation for low round-off errors as in Eq. (J1)-(J3) \ref
+	  //! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015), DOI:10.1016/j.camwa.2015.05.001 ]</b></a>
+	  //!
+	  real drho = ((((mfccc + mfaaa) + (mfaca + mfcac)) + ((mfacc + mfcaa) + (mfaac + mfcca))) +
+      	(((mfbac + mfbca) + (mfbaa + mfbcc)) + ((mfabc + mfcba) + (mfaba + mfcbc)) + ((mfacb + mfcab) + (mfaab + mfccb))) +
+      	((mfabb + mfcbb) + (mfbab + mfbcb) + (mfbba + mfbbc))) + mfbbb;
+      
+      real rhoDev = c1o1 + drho;
+      ////////////////////////////////////////////////////////////////////////////////////
+      real vvx = ((((mfccc - mfaaa) + (mfcac - mfaca)) + ((mfcaa - mfacc) + (mfcca - mfaac))) +
+      	(((mfcba - mfabc) + (mfcbc - mfaba)) + ((mfcab - mfacb) + (mfccb - mfaab))) +
+      	(mfcbb - mfabb)) / rhoDev;
+      real vvy = ((((mfccc - mfaaa) + (mfaca - mfcac)) + ((mfacc - mfcaa) + (mfcca - mfaac))) +
+      	(((mfbca - mfbac) + (mfbcc - mfbaa)) + ((mfacb - mfcab) + (mfccb - mfaab))) +
+      	(mfbcb - mfbab)) / rhoDev;
+      real vvz = ((((mfccc - mfaaa) + (mfcac - mfaca)) + ((mfacc - mfcaa) + (mfaac - mfcca))) +
+      	(((mfbac - mfbca) + (mfbcc - mfbaa)) + ((mfabc - mfcba) + (mfcbc - mfaba))) +
+      	(mfbbc - mfbba)) / rhoDev;
+      
+      rho[k]        = drho;
+      velocityX[k]  = vvx;
+      velocityY[k]  = vvy;
+      velocityZ[k]  = vvz;
+      
+	  //////////////////////////////////////////////////////////////////////////
+	  //! - Calculate pressure
+	  //!
+	  real OxxPyyPzz = c1o1;
+      pressure[k] =((dist.f[dirE   ])[ke  ]+ (dist.f[dirW   ])[kw  ]+ 
+                    (dist.f[dirN   ])[kn  ]+ (dist.f[dirS   ])[ks  ]+
+                    (dist.f[dirT   ])[kt  ]+ (dist.f[dirB   ])[kb  ]+
+                    c2o1*(
+                    (dist.f[dirNE  ])[kne ]+ (dist.f[dirSW  ])[ksw ]+
+                    (dist.f[dirSE  ])[kse ]+ (dist.f[dirNW  ])[knw ]+
+                    (dist.f[dirTE  ])[kte ]+ (dist.f[dirBW  ])[kbw ]+
+                    (dist.f[dirBE  ])[kbe ]+ (dist.f[dirTW  ])[ktw ]+
+                    (dist.f[dirTN  ])[ktn ]+ (dist.f[dirBS  ])[kbs ]+
+                    (dist.f[dirBN  ])[kbn ]+ (dist.f[dirTS  ])[kts ])+
+                    c3o1*(
+                    (dist.f[dirTNE ])[ktne]+ (dist.f[dirTSW ])[ktsw]+ 
+                    (dist.f[dirTSE ])[ktse]+ (dist.f[dirTNW ])[ktnw]+ 
+                    (dist.f[dirBNE ])[kbne]+ (dist.f[dirBSW ])[kbsw]+ 
+                    (dist.f[dirBSE ])[kbse]+ (dist.f[dirBNW ])[kbnw])-
+                    rho[k]-(velocityX[k] * velocityX[k] + velocityY[k] * velocityY[k] + velocityZ[k] * velocityZ[k]) * (c1o1+rho[k])) * (c1o1 / OxxPyyPzz - c1o2) +rho[k];
+   }
+}
+
+
+
+
+
diff --git a/src/VirtualFluids_GPU/GPU/CudaMemoryManager.cpp b/src/VirtualFluids_GPU/GPU/CudaMemoryManager.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..b1b436f3be7fa1dafc6de99b7f3dde5184987be0
--- /dev/null
+++ b/src/VirtualFluids_GPU/GPU/CudaMemoryManager.cpp
@@ -0,0 +1,281 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 CudaMemoryManager.cpp
+//! \ingroup GPU
+//! \author Martin Schoenherr
+//=======================================================================================
+#include <cuda_runtime.h>
+#include <helper_cuda.h>
+#include "CudaMemoryManager.h"
+#include <Parameter/Parameter.h>
+
+//coordinates
+void CudaMemoryManager::cudaAllocCoord()
+{
+	//Host
+	checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH()->coordinateX ), parameter->getParH()->mem_size_real  ));
+	checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH()->coordinateY ), parameter->getParH()->mem_size_real  ));
+	checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH()->coordinateZ ), parameter->getParH()->mem_size_real  ));
+	//Device
+	checkCudaErrors( cudaMalloc((void**) &(parameter->getParD()->coordinateX     ), parameter->getParH()->mem_size_real  ));
+	checkCudaErrors( cudaMalloc((void**) &(parameter->getParD()->coordinateY     ), parameter->getParH()->mem_size_real  ));
+	checkCudaErrors( cudaMalloc((void**) &(parameter->getParD()->coordinateZ     ), parameter->getParH()->mem_size_real  ));
+	//////////////////////////////////////////////////////////////////////////
+	double tmp = 3. * (double)parameter->getParH()->mem_size_real;
+	setMemsizeGPU(tmp, false);
+}
+void CudaMemoryManager::cudaCopyCoord()
+{
+	//copy host to device
+	checkCudaErrors( cudaMemcpy(parameter->getParD()->coordinateX,  parameter->getParH()->coordinateX,  parameter->getParH()->mem_size_real     , cudaMemcpyHostToDevice));
+	checkCudaErrors( cudaMemcpy(parameter->getParD()->coordinateY,  parameter->getParH()->coordinateY,  parameter->getParH()->mem_size_real     , cudaMemcpyHostToDevice));
+	checkCudaErrors( cudaMemcpy(parameter->getParD()->coordinateZ,  parameter->getParH()->coordinateZ,  parameter->getParH()->mem_size_real     , cudaMemcpyHostToDevice));
+}
+void CudaMemoryManager::cudaFreeCoord()
+{
+	checkCudaErrors( cudaFreeHost(parameter->getParH()->coordinateX   ));
+	checkCudaErrors( cudaFreeHost(parameter->getParH()->coordinateY   ));
+	checkCudaErrors( cudaFreeHost(parameter->getParH()->coordinateZ   ));
+}
+
+
+
+
+
+//print
+void CudaMemoryManager::cudaCopyDataToHost()
+{
+	checkCudaErrors( cudaMemcpy(parameter->getParH()->velocityX   , parameter->getParD()->velocityX   , parameter->getParH()->mem_size_real , cudaMemcpyDeviceToHost));
+	checkCudaErrors( cudaMemcpy(parameter->getParH()->velocityY   , parameter->getParD()->velocityY   , parameter->getParH()->mem_size_real , cudaMemcpyDeviceToHost));
+	checkCudaErrors( cudaMemcpy(parameter->getParH()->velocityZ   , parameter->getParD()->velocityZ   , parameter->getParH()->mem_size_real , cudaMemcpyDeviceToHost));
+	checkCudaErrors( cudaMemcpy(parameter->getParH()->rho         , parameter->getParD()->rho         , parameter->getParH()->mem_size_real , cudaMemcpyDeviceToHost));
+	checkCudaErrors( cudaMemcpy(parameter->getParH()->pressure    , parameter->getParD()->pressure    , parameter->getParH()->mem_size_real , cudaMemcpyDeviceToHost));
+}
+
+
+
+
+
+//sparse
+void CudaMemoryManager::cudaAllocSP()
+{
+	//Host
+	checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH()->typeOfGridNode ), parameter->getParH()->mem_size_int ));
+	checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH()->neighborX      ), parameter->getParH()->mem_size_int ));
+	checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH()->neighborY      ), parameter->getParH()->mem_size_int ));
+	checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH()->neighborZ      ), parameter->getParH()->mem_size_int ));
+	checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH()->rho            ), parameter->getParH()->mem_size_real));
+	checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH()->velocityX      ), parameter->getParH()->mem_size_real));
+	checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH()->velocityY      ), parameter->getParH()->mem_size_real));
+	checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH()->velocityZ      ), parameter->getParH()->mem_size_real));
+	checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH()->pressure       ), parameter->getParH()->mem_size_real));
+	//Device						 
+	checkCudaErrors( cudaMalloc((void**) &(parameter->getParD()->typeOfGridNode     ), parameter->getParD()->mem_size_int ));
+	checkCudaErrors( cudaMalloc((void**) &(parameter->getParD()->neighborX          ), parameter->getParD()->mem_size_int ));
+	checkCudaErrors( cudaMalloc((void**) &(parameter->getParD()->neighborY          ), parameter->getParD()->mem_size_int ));
+	checkCudaErrors( cudaMalloc((void**) &(parameter->getParD()->neighborZ          ), parameter->getParD()->mem_size_int ));
+	checkCudaErrors( cudaMalloc((void**) &(parameter->getParD()->rho                ), parameter->getParD()->mem_size_real));
+	checkCudaErrors( cudaMalloc((void**) &(parameter->getParD()->velocityX          ), parameter->getParD()->mem_size_real));
+	checkCudaErrors( cudaMalloc((void**) &(parameter->getParD()->velocityY          ), parameter->getParD()->mem_size_real));
+	checkCudaErrors( cudaMalloc((void**) &(parameter->getParD()->velocityZ          ), parameter->getParD()->mem_size_real));
+	checkCudaErrors( cudaMalloc((void**) &(parameter->getParD()->pressure           ), parameter->getParD()->mem_size_real));
+	checkCudaErrors( cudaMalloc((void**) &(parameter->getParD()->distributions.f[0] ), (unsigned long long)parameter->getD3Qxx()*(unsigned long long)parameter->getParD()->mem_size_real));
+	//////////////////////////////////////////////////////////////////////////
+	double tmp = 4. * (double)parameter->getParH()->mem_size_int + 5. * (double)parameter->getParH()->mem_size_real + (double)parameter->getD3Qxx() * (double)parameter->getParH()->mem_size_real;
+	setMemsizeGPU(tmp, false);
+}
+void CudaMemoryManager::cudaCopySP()
+{
+	//copy host to device
+	checkCudaErrors( cudaMemcpy(parameter->getParD()->typeOfGridNode ,  parameter->getParH()->typeOfGridNode ,  parameter->getParH()->mem_size_int  , cudaMemcpyHostToDevice));
+	checkCudaErrors( cudaMemcpy(parameter->getParD()->neighborX      ,  parameter->getParH()->neighborX      ,  parameter->getParH()->mem_size_int  , cudaMemcpyHostToDevice));
+	checkCudaErrors( cudaMemcpy(parameter->getParD()->neighborY      ,  parameter->getParH()->neighborY      ,  parameter->getParH()->mem_size_int  , cudaMemcpyHostToDevice));
+	checkCudaErrors( cudaMemcpy(parameter->getParD()->neighborZ      ,  parameter->getParH()->neighborZ      ,  parameter->getParH()->mem_size_int  , cudaMemcpyHostToDevice));
+	checkCudaErrors( cudaMemcpy(parameter->getParD()->rho            ,  parameter->getParH()->rho            ,  parameter->getParH()->mem_size_real , cudaMemcpyHostToDevice));
+	checkCudaErrors( cudaMemcpy(parameter->getParD()->velocityX      ,  parameter->getParH()->velocityX      ,  parameter->getParH()->mem_size_real , cudaMemcpyHostToDevice));
+	checkCudaErrors( cudaMemcpy(parameter->getParD()->velocityY      ,  parameter->getParH()->velocityY      ,  parameter->getParH()->mem_size_real , cudaMemcpyHostToDevice));
+	checkCudaErrors( cudaMemcpy(parameter->getParD()->velocityZ      ,  parameter->getParH()->velocityZ      ,  parameter->getParH()->mem_size_real , cudaMemcpyHostToDevice));
+	checkCudaErrors( cudaMemcpy(parameter->getParD()->pressure       ,  parameter->getParH()->pressure       ,  parameter->getParH()->mem_size_real , cudaMemcpyHostToDevice));
+}
+void CudaMemoryManager::cudaFreeSP()
+{
+	checkCudaErrors( cudaFreeHost(parameter->getParH()->typeOfGridNode  ));
+	checkCudaErrors( cudaFreeHost(parameter->getParH()->velocityX       ));
+	checkCudaErrors( cudaFreeHost(parameter->getParH()->velocityY       ));
+	checkCudaErrors( cudaFreeHost(parameter->getParH()->velocityZ       ));
+	checkCudaErrors( cudaFreeHost(parameter->getParH()->rho             ));
+	checkCudaErrors( cudaFreeHost(parameter->getParH()->pressure        ));
+	checkCudaErrors( cudaFreeHost(parameter->getParH()->neighborX       ));
+	checkCudaErrors( cudaFreeHost(parameter->getParH()->neighborY       ));
+	checkCudaErrors( cudaFreeHost(parameter->getParH()->neighborZ       ));
+}
+
+
+
+
+
+//velocity boundary condition
+void CudaMemoryManager::cudaAllocVeloBC()
+{
+	unsigned int mem_size_inflow_BC_INT = sizeof(int)*parameter->getParH()->numberOfInflowBCnodes;
+	unsigned int mem_size_inflow_BC_REAL = sizeof(real)*parameter->getParH()->numberOfInflowBCnodes;
+
+	//Host
+	checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH()->inflowBC.q27[0]), parameter->getD3Qxx() * mem_size_inflow_BC_REAL ));
+	checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH()->inflowBC.k),								 mem_size_inflow_BC_INT  ));
+	checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH()->inflowBC.Vx),				             mem_size_inflow_BC_REAL ));
+	checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH()->inflowBC.Vy),				             mem_size_inflow_BC_REAL ));
+	checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH()->inflowBC.Vz),				             mem_size_inflow_BC_REAL ));
+
+	//Device
+	checkCudaErrors( cudaMalloc((void**) &(parameter->getParD()->inflowBC.q27[0]),     parameter->getD3Qxx() * mem_size_inflow_BC_REAL ));
+	checkCudaErrors( cudaMalloc((void**) &(parameter->getParD()->inflowBC.k),									 mem_size_inflow_BC_INT  ));
+	checkCudaErrors( cudaMalloc((void**) &(parameter->getParD()->inflowBC.Vx),				                 mem_size_inflow_BC_REAL ));
+	checkCudaErrors( cudaMalloc((void**) &(parameter->getParD()->inflowBC.Vy),				                 mem_size_inflow_BC_REAL ));
+	checkCudaErrors( cudaMalloc((void**) &(parameter->getParD()->inflowBC.Vz),				                 mem_size_inflow_BC_REAL ));
+
+	//////////////////////////////////////////////////////////////////////////
+	double tmp = (double)mem_size_inflow_BC_INT + 4. * (double)mem_size_inflow_BC_REAL + (double)parameter->getD3Qxx() * (double)mem_size_inflow_BC_REAL;
+    setMemsizeGPU(tmp, false);
+}
+void CudaMemoryManager::cudaCopyVeloBC()
+{
+	unsigned int mem_size_inflow_BC_INT = sizeof(int)*parameter->getParH()->numberOfInflowBCnodes;
+	unsigned int mem_size_inflow_BC_REAL = sizeof(real)*parameter->getParH()->numberOfInflowBCnodes;
+
+	checkCudaErrors( cudaMemcpy(parameter->getParD()->inflowBC.q27[0],  parameter->getParH()->inflowBC.q27[0], parameter->getD3Qxx() *	mem_size_inflow_BC_REAL,  cudaMemcpyHostToDevice));
+	checkCudaErrors( cudaMemcpy(parameter->getParD()->inflowBC.k,       parameter->getParH()->inflowBC.k,							    mem_size_inflow_BC_INT ,  cudaMemcpyHostToDevice));
+	checkCudaErrors( cudaMemcpy(parameter->getParD()->inflowBC.Vx,      parameter->getParH()->inflowBC.Vx,								mem_size_inflow_BC_REAL,  cudaMemcpyHostToDevice));
+	checkCudaErrors( cudaMemcpy(parameter->getParD()->inflowBC.Vy,      parameter->getParH()->inflowBC.Vy,								mem_size_inflow_BC_REAL,  cudaMemcpyHostToDevice));
+	checkCudaErrors( cudaMemcpy(parameter->getParD()->inflowBC.Vz,      parameter->getParH()->inflowBC.Vz,								mem_size_inflow_BC_REAL,  cudaMemcpyHostToDevice));
+
+}
+void CudaMemoryManager::cudaFreeVeloBC()
+{
+	checkCudaErrors( cudaFreeHost(parameter->getParH()->inflowBC.q27[0] ));
+	checkCudaErrors( cudaFreeHost(parameter->getParH()->inflowBC.k      ));
+	checkCudaErrors( cudaFreeHost(parameter->getParH()->inflowBC.Vx     ));
+	checkCudaErrors( cudaFreeHost(parameter->getParH()->inflowBC.Vy     ));
+	checkCudaErrors( cudaFreeHost(parameter->getParH()->inflowBC.Vz     ));
+}
+
+
+
+
+
+//forcing
+void CudaMemoryManager::cudaAllocForcing()
+{
+	unsigned int mem_size = sizeof(real) * 3;
+	//Host
+	checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH()->forcing), mem_size));
+	parameter->getParH()->forcing[0] = (real)0.0;
+	parameter->getParH()->forcing[1] = (real)0.0;
+	parameter->getParH()->forcing[2] = (real)0.0;
+	//Device
+	checkCudaErrors( cudaMalloc((void**) &(parameter->getParD()->forcing), mem_size));
+	//////////////////////////////////////////////////////////////////////////
+	double tmp = (real)mem_size;
+	setMemsizeGPU(tmp, false);
+}
+void CudaMemoryManager::cudaCopyForcingToDevice()
+{
+	unsigned int mem_size = sizeof(real) * 3;
+	checkCudaErrors( cudaMemcpy(parameter->getParD()->forcing, parameter->getParH()->forcing, mem_size, cudaMemcpyHostToDevice));
+}
+void CudaMemoryManager::cudaCopyForcingToHost()
+{
+	unsigned int mem_size = sizeof(real) * 3;
+	checkCudaErrors( cudaMemcpy(parameter->getParH()->forcing, parameter->getParD()->forcing, mem_size, cudaMemcpyDeviceToHost));
+}
+void CudaMemoryManager::cudaFreeForcing()
+{
+	checkCudaErrors( cudaFreeHost(parameter->getParH()->forcing));
+}
+
+
+
+
+
+//Neighbor WSB
+void CudaMemoryManager::cudaAllocNeighborWSB()
+{
+    //Host
+    checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH()->neighborInverse    ), parameter->getParH()->mem_size_int    ));
+    //Device
+    checkCudaErrors( cudaMalloc((void**) &(parameter->getParD()->neighborInverse        ), parameter->getParD()->mem_size_int    ));
+    //////////////////////////////////////////////////////////////////////////
+    double tmp = (double)parameter->getParH()->mem_size_int;
+    setMemsizeGPU(tmp, false);
+}
+void CudaMemoryManager::cudaCopyNeighborWSB()
+{
+    //copy host to device
+    checkCudaErrors( cudaMemcpy(parameter->getParD()->neighborInverse,  parameter->getParH()->neighborInverse,  parameter->getParH()->mem_size_int     , cudaMemcpyHostToDevice));
+}
+void CudaMemoryManager::cudaFreeNeighborWSB()
+{
+    checkCudaErrors( cudaFreeHost(parameter->getParH()->neighborInverse));
+}
+
+
+
+
+
+std::shared_ptr<CudaMemoryManager> CudaMemoryManager::make(SPtr<Parameter> parameter)
+{
+    return std::shared_ptr<CudaMemoryManager>(new CudaMemoryManager(parameter));
+}
+
+void CudaMemoryManager::setMemsizeGPU(double admem, bool reset)
+{
+	if (reset == true)
+	{
+		this->memsizeGPU = 0.;
+	}
+	else
+	{
+		this->memsizeGPU += admem;
+	}
+}
+
+double CudaMemoryManager::getMemsizeGPU()
+{
+	return memsizeGPU;
+}
+
+CudaMemoryManager::CudaMemoryManager(SPtr<Parameter> parameter)
+{
+    this->parameter = parameter;
+}
+
+CudaMemoryManager::CudaMemoryManager(const CudaMemoryManager&)
+{
+
+}
diff --git a/src/VirtualFluids_GPU/GPU/CudaMemoryManager.h b/src/VirtualFluids_GPU/GPU/CudaMemoryManager.h
new file mode 100644
index 0000000000000000000000000000000000000000..bf6b0590dc003115e5ebd46e4c3a3ac4a6fe01f5
--- /dev/null
+++ b/src/VirtualFluids_GPU/GPU/CudaMemoryManager.h
@@ -0,0 +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 CudaMemoryManager.h
+//! \ingroup GPU
+//! \author Martin Schoenherr
+//=======================================================================================
+#ifndef CudamemoryManager_H
+#define CudamemoryManager_H
+
+#include <memory>
+#include "Core/PointerDefinitions.h"
+
+//! \brief Class forwarding for Parameter
+class Parameter;
+
+//! \class CudaMemoryManager
+//! \brief manage the cuda memory, f.e. allocate, copy and free the memory
+class VF_PUBLIC CudaMemoryManager
+{
+public:
+	//! \brief makes an object of CudaMemoryManager
+	//! \param para shared pointer to instance of class Parameter
+	static std::shared_ptr<CudaMemoryManager> make(std::shared_ptr<Parameter> parameter);
+    
+	//! \brief adds partial memory to set the total device memory usage
+	void setMemsizeGPU(double admem, bool reset);
+	//! \brief returns the actual total device memory usage
+	double getMemsizeGPU();
+
+	//! \brief allocate, copy and free the host / device memory for the coordinates
+	void cudaAllocCoord();
+	void cudaCopyCoord();
+	void cudaFreeCoord();
+
+	//! \brief copy macroscopic values from device to host memory
+	void cudaCopyDataToHost();
+
+	//! \brief allocate, copy and free the host / device memory for the macroscopic values
+	void cudaAllocSP();
+	void cudaCopySP();
+	void cudaFreeSP();
+    
+	//! \brief allocate, copy and free the host / device memory for the neighbor in negative diagonal direction (-x,-y,-z)
+	void cudaAllocNeighborWSB();
+	void cudaCopyNeighborWSB();
+	void cudaFreeNeighborWSB();
+
+	//! \brief allocate, copy and free the host / device memory for the velocity boundary condition
+	void cudaAllocVeloBC();
+	void cudaCopyVeloBC();
+	void cudaFreeVeloBC();
+
+	//! \brief allocate, copy and free the host / device memory for the forcing
+	void cudaAllocForcing();
+	void cudaCopyForcingToDevice();
+	void cudaCopyForcingToHost();
+	void cudaFreeForcing();
+
+
+private:
+	//! Class constructor
+	//! \param parameter shared pointer to instance of class Parameter
+	CudaMemoryManager(SPtr<Parameter> parameter);
+	//! Class copy constructor
+	//! \param CudaMemoryManager is a reference to CudaMemoryManager object
+	CudaMemoryManager(const CudaMemoryManager&);
+
+	//! \property para is a shared pointer to an object of Parameter
+	SPtr<Parameter> parameter;
+	//! \property memsizeGPU stores the used device memory
+	double memsizeGPU;
+
+};
+#endif
diff --git a/src/VirtualFluids_GPU/GPU/Cumulant27chim.cu b/src/VirtualFluids_GPU/GPU/Cumulant27chim.cu
new file mode 100644
index 0000000000000000000000000000000000000000..bc5e408dbd84f6e0464c828d4071665fb7083a44
--- /dev/null
+++ b/src/VirtualFluids_GPU/GPU/Cumulant27chim.cu
@@ -0,0 +1,643 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 Cumulant27chim.cu
+//! \ingroup GPU
+//! \author Martin Schoenherr
+//=======================================================================================
+/* Device code */
+#include "LBM/LB.h" 
+#include "LBM/D3Q27.h"
+#include "Core/RealConstants.h"
+
+////////////////////////////////////////////////////////////////////////////////
+//! \brief forward chimera transformation \ref forwardInverseChimeraWithK 
+//! Transformation from distributions to central moments according to Eq. (6)-(14) in \ref
+//! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.05.040 ]</b></a>
+//! Modified for lower round-off errors.
+inline __device__ void forwardInverseChimeraWithK(real &mfa, real &mfb, real &mfc, real vv, real v2, real Kinverse, real K) {
+	real m2 = mfa + mfc;
+	real m1 = mfc - mfa;
+	real m0 = m2 + mfb;
+	mfa = m0;
+	m0 *= Kinverse;
+	m0 += c1o1;
+	mfb = (m1*Kinverse - m0 * vv) * K;
+	mfc = ((m2 - c2o1*	m1 * vv)*Kinverse + v2 * m0) * K;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+//! \brief backward chimera transformation \ref backwardInverseChimeraWithK 
+//! Transformation from central moments to distributions according to Eq. (57)-(65) in \ref
+//! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.05.040 ]</b></a>
+//! Modified for lower round-off errors.
+inline __device__ void backwardInverseChimeraWithK(real &mfa, real &mfb, real &mfc, real vv, real v2, real Kinverse, real K) {
+	real m0 = (((mfc - mfb) * c1o2 + mfb *  vv)*Kinverse + (mfa*Kinverse + c1o1) * (v2 - vv) * c1o2) * K;
+	real m1 = (((mfa - mfc) -  c2o1 * mfb *  vv)*Kinverse + (mfa*Kinverse + c1o1) * (           -v2)) * K;
+	mfc     = (((mfc + mfb) * c1o2 + mfb *  vv)*Kinverse + (mfa*Kinverse + c1o1) * (v2 + vv) * c1o2) * K;
+	mfa = m0;
+	mfb = m1;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+//! \brief forward chimera transformation \ref forwardChimera 
+//! Transformation from distributions to central moments according to Eq. (6)-(14) in \ref
+//! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.05.040 ]</b></a>
+//! for \f$ K_{abc}=0 \f$. This is to avoid unnessary floating point operations.
+//! Modified for lower round-off errors.
+inline __device__ void forwardChimera(real &mfa, real &mfb, real &mfc, real vv, real v2) {
+	real m1 = (mfa + mfc) + mfb;
+	real m2 = mfc - mfa;
+	mfc = (mfc + mfa) + (v2*m1 - c2o1*vv*m2);
+	mfb = m2 - vv*m1;
+	mfa = m1;
+}
+
+
+////////////////////////////////////////////////////////////////////////////////
+//! \brief backward chimera transformation \ref backwardChimera 
+//! Transformation from central moments to distributions according to Eq. (57)-(65) in \ref
+//! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.05.040 ]</b></a>
+//! for \f$ K_{abc}=0 \f$. This is to avoid unnessary floating point operations.
+//! Modified for lower round-off errors.
+inline __device__ void backwardChimera(real &mfa, real &mfb, real &mfc, real vv, real v2) {
+	real ma = (mfc + mfa*(v2 - vv))*c1o2 + mfb*(vv - c1o2);
+	real mb = ((mfa - mfc) - mfa*v2) - c2o1*mfb*vv;
+	mfc = (mfc + mfa*(v2 + vv))*c1o2 + mfb*(vv + c1o2);
+	mfb = mb;
+	mfa = ma;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+extern "C" __global__ void Cumulant_K17_LBM_Device_Kernel(
+	real omega,
+	uint* typeOfGridNode,
+	uint* neighborX,
+	uint* neighborY,
+	uint* neighborZ,
+	real* distributions,
+	int size_Mat,
+	real* forces,
+	bool isEvenTimestep)
+{
+	//////////////////////////////////////////////////////////////////////////
+	//! Cumulant K17 Kernel is based on \ref
+	//! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.05.040 ]</b></a>
+	//! and \ref
+	//! <a href="https://doi.org/10.1016/j.jcp.2017.07.004"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.07.004 ]</b></a>
+	//!
+	//! The cumulant kernel is executed in the following steps
+	//!
+	////////////////////////////////////////////////////////////////////////////////
+	//! - Get node index coordinates from thredIdx, blockIdx, blockDim and gridDim.
+	//!
+	const unsigned  x = threadIdx.x; 
+	const unsigned  y = blockIdx.x;  
+	const unsigned  z = blockIdx.y;  
+
+	const unsigned nx = blockDim.x;
+	const unsigned ny = gridDim.x;
+
+	const unsigned k = nx*(ny*z + y) + x;
+
+	//////////////////////////////////////////////////////////////////////////
+	// run for all indices in size_Mat and fluid nodes
+	if ((k < size_Mat) && (typeOfGridNode[k] == GEO_FLUID))
+	{
+		//////////////////////////////////////////////////////////////////////////
+		//! - Read distributions: style of reading and writing the distributions from/to stored arrays dependent on timestep is based on the esoteric twist algorithm \ref
+		//! <a href="https://doi.org/10.3390/computation5020019"><b>[ M. Geier et al. (2017), DOI:10.3390/computation5020019 ]</b></a>
+		//!
+		Distributions27 dist;
+		if (isEvenTimestep)
+		{
+			dist.f[dirE   ] = &distributions[dirE   *size_Mat];
+			dist.f[dirW   ] = &distributions[dirW   *size_Mat];
+			dist.f[dirN   ] = &distributions[dirN   *size_Mat];
+			dist.f[dirS   ] = &distributions[dirS   *size_Mat];
+			dist.f[dirT   ] = &distributions[dirT   *size_Mat];
+			dist.f[dirB   ] = &distributions[dirB   *size_Mat];
+			dist.f[dirNE  ] = &distributions[dirNE  *size_Mat];
+			dist.f[dirSW  ] = &distributions[dirSW  *size_Mat];
+			dist.f[dirSE  ] = &distributions[dirSE  *size_Mat];
+			dist.f[dirNW  ] = &distributions[dirNW  *size_Mat];
+			dist.f[dirTE  ] = &distributions[dirTE  *size_Mat];
+			dist.f[dirBW  ] = &distributions[dirBW  *size_Mat];
+			dist.f[dirBE  ] = &distributions[dirBE  *size_Mat];
+			dist.f[dirTW  ] = &distributions[dirTW  *size_Mat];
+			dist.f[dirTN  ] = &distributions[dirTN  *size_Mat];
+			dist.f[dirBS  ] = &distributions[dirBS  *size_Mat];
+			dist.f[dirBN  ] = &distributions[dirBN  *size_Mat];
+			dist.f[dirTS  ] = &distributions[dirTS  *size_Mat];
+			dist.f[dirREST] = &distributions[dirREST*size_Mat];
+			dist.f[dirTNE ] = &distributions[dirTNE *size_Mat];
+			dist.f[dirTSW ] = &distributions[dirTSW *size_Mat];
+			dist.f[dirTSE ] = &distributions[dirTSE *size_Mat];
+			dist.f[dirTNW ] = &distributions[dirTNW *size_Mat];
+			dist.f[dirBNE ] = &distributions[dirBNE *size_Mat];
+			dist.f[dirBSW ] = &distributions[dirBSW *size_Mat];
+			dist.f[dirBSE ] = &distributions[dirBSE *size_Mat];
+			dist.f[dirBNW ] = &distributions[dirBNW *size_Mat];
+		}
+		else
+		{
+			dist.f[dirW   ] = &distributions[dirE   *size_Mat];
+			dist.f[dirE   ] = &distributions[dirW   *size_Mat];
+			dist.f[dirS   ] = &distributions[dirN   *size_Mat];
+			dist.f[dirN   ] = &distributions[dirS   *size_Mat];
+			dist.f[dirB   ] = &distributions[dirT   *size_Mat];
+			dist.f[dirT   ] = &distributions[dirB   *size_Mat];
+			dist.f[dirSW  ] = &distributions[dirNE  *size_Mat];
+			dist.f[dirNE  ] = &distributions[dirSW  *size_Mat];
+			dist.f[dirNW  ] = &distributions[dirSE  *size_Mat];
+			dist.f[dirSE  ] = &distributions[dirNW  *size_Mat];
+			dist.f[dirBW  ] = &distributions[dirTE  *size_Mat];
+			dist.f[dirTE  ] = &distributions[dirBW  *size_Mat];
+			dist.f[dirTW  ] = &distributions[dirBE  *size_Mat];
+			dist.f[dirBE  ] = &distributions[dirTW  *size_Mat];
+			dist.f[dirBS  ] = &distributions[dirTN  *size_Mat];
+			dist.f[dirTN  ] = &distributions[dirBS  *size_Mat];
+			dist.f[dirTS  ] = &distributions[dirBN  *size_Mat];
+			dist.f[dirBN  ] = &distributions[dirTS  *size_Mat];
+			dist.f[dirREST] = &distributions[dirREST*size_Mat];
+			dist.f[dirBSW ] = &distributions[dirTNE *size_Mat];
+			dist.f[dirBNE ] = &distributions[dirTSW *size_Mat];
+			dist.f[dirBNW ] = &distributions[dirTSE *size_Mat];
+			dist.f[dirBSE ] = &distributions[dirTNW *size_Mat];
+			dist.f[dirTSW ] = &distributions[dirBNE *size_Mat];
+			dist.f[dirTNE ] = &distributions[dirBSW *size_Mat];
+			dist.f[dirTNW ] = &distributions[dirBSE *size_Mat];
+			dist.f[dirTSE ] = &distributions[dirBNW *size_Mat];
+		}
+		////////////////////////////////////////////////////////////////////////////////
+		//! - Set neighbor indices (necessary for indirect addressing) 
+		uint kw   = neighborX[k];
+		uint ks   = neighborY[k];
+		uint kb   = neighborZ[k];
+		uint ksw  = neighborY[kw];
+		uint kbw  = neighborZ[kw];
+		uint kbs  = neighborZ[ks];
+		uint kbsw = neighborZ[ksw];
+		////////////////////////////////////////////////////////////////////////////////////
+		//! - Set local distributions
+		//!
+		real mfcbb = (dist.f[dirE   ])[k];
+		real mfabb = (dist.f[dirW   ])[kw];
+		real mfbcb = (dist.f[dirN   ])[k];
+		real mfbab = (dist.f[dirS   ])[ks];
+		real mfbbc = (dist.f[dirT   ])[k];
+		real mfbba = (dist.f[dirB   ])[kb];
+		real mfccb = (dist.f[dirNE  ])[k];
+		real mfaab = (dist.f[dirSW  ])[ksw];
+		real mfcab = (dist.f[dirSE  ])[ks];
+		real mfacb = (dist.f[dirNW  ])[kw];
+		real mfcbc = (dist.f[dirTE  ])[k];
+		real mfaba = (dist.f[dirBW  ])[kbw];
+		real mfcba = (dist.f[dirBE  ])[kb];
+		real mfabc = (dist.f[dirTW  ])[kw];
+		real mfbcc = (dist.f[dirTN  ])[k];
+		real mfbaa = (dist.f[dirBS  ])[kbs];
+		real mfbca = (dist.f[dirBN  ])[kb];
+		real mfbac = (dist.f[dirTS  ])[ks];
+		real mfbbb = (dist.f[dirREST])[k];
+		real mfccc = (dist.f[dirTNE ])[k];
+		real mfaac = (dist.f[dirTSW ])[ksw];
+		real mfcac = (dist.f[dirTSE ])[ks];
+		real mfacc = (dist.f[dirTNW ])[kw];
+		real mfcca = (dist.f[dirBNE ])[kb];
+		real mfaaa = (dist.f[dirBSW ])[kbsw];
+		real mfcaa = (dist.f[dirBSE ])[kbs];
+		real mfaca = (dist.f[dirBNW ])[kbw];
+		////////////////////////////////////////////////////////////////////////////////////
+		//! - Calculate density and velocity using pyramid summation for low round-off errors as in Eq. (J1)-(J3) \ref
+		//! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015), DOI:10.1016/j.camwa.2015.05.001 ]</b></a>
+		//!
+		real drho =
+			((((mfccc + mfaaa) + (mfaca + mfcac)) + ((mfacc + mfcaa) + (mfaac + mfcca))) +
+			(((mfbac + mfbca) + (mfbaa + mfbcc)) + ((mfabc + mfcba) + (mfaba + mfcbc)) + ((mfacb + mfcab) + (mfaab + mfccb))) +
+			((mfabb + mfcbb) + (mfbab + mfbcb) + (mfbba + mfbbc))) + mfbbb;
+
+		real rho = c1o1 + drho;
+		real OOrho = c1o1 / rho;
+
+		real vvx = 
+			((((mfccc - mfaaa) + (mfcac - mfaca)) + ((mfcaa - mfacc) + (mfcca - mfaac))) +
+			(((mfcba - mfabc) + (mfcbc - mfaba)) + ((mfcab - mfacb) + (mfccb - mfaab))) +
+			(mfcbb - mfabb)) * OOrho;
+		real vvy = 
+			((((mfccc - mfaaa) + (mfaca - mfcac)) + ((mfacc - mfcaa) + (mfcca - mfaac))) +
+			(((mfbca - mfbac) + (mfbcc - mfbaa)) + ((mfacb - mfcab) + (mfccb - mfaab))) +
+			(mfbcb - mfbab)) * OOrho;
+		real vvz = 
+			((((mfccc - mfaaa) + (mfcac - mfaca)) + ((mfacc - mfcaa) + (mfaac - mfcca))) +
+			(((mfbac - mfbca) + (mfbcc - mfbaa)) + ((mfabc - mfcba) + (mfcbc - mfaba))) +
+			(mfbbc - mfbba)) * OOrho;
+		////////////////////////////////////////////////////////////////////////////////////
+		//! - Add half of the acceleration (body force) to the velocity as in Eq. (42) \ref
+		//! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015), DOI:10.1016/j.camwa.2015.05.001 ]</b></a>
+		//!
+		real fx = forces[0];
+		real fy = forces[1]; 
+		real fz = forces[2]; 
+		vvx += fx*c1o2;
+		vvy += fy*c1o2;
+		vvz += fz*c1o2;
+		////////////////////////////////////////////////////////////////////////////////////
+		// calculate the square of velocities for this lattice node
+		real vx2 = vvx*vvx;
+		real vy2 = vvy*vvy;
+		real vz2 = vvz*vvz;
+		////////////////////////////////////////////////////////////////////////////////////
+		//! - Set relaxation limiters for third order cumulants to default value \f$ \lambda=0.001 \f$ according to section 6 in \ref
+		//! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.05.040 ]</b></a>
+		//!
+		real wadjust;
+		real qudricLimitP = c1o100;
+		real qudricLimitM = c1o100;
+		real qudricLimitD = c1o100;
+		////////////////////////////////////////////////////////////////////////////////////
+		//! - Chimera transform from well conditioned distributions to central moments as defined in Appendix J in \ref
+		//! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015), DOI:10.1016/j.camwa.2015.05.001 ]</b></a>
+		//! see also Eq. (6)-(14) in \ref
+		//! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.05.040 ]</b></a>
+		//!
+		////////////////////////////////////////////////////////////////////////////////////
+		// Z - Dir
+		forwardInverseChimeraWithK(mfaaa, mfaab, mfaac, vvz, vz2, c36o1, c1o36);
+		forwardInverseChimeraWithK(mfaba, mfabb, mfabc, vvz, vz2,  c9o1,  c1o9);
+		forwardInverseChimeraWithK(mfaca, mfacb, mfacc, vvz, vz2, c36o1, c1o36);
+		forwardInverseChimeraWithK(mfbaa, mfbab, mfbac, vvz, vz2,  c9o1,  c1o9);
+		forwardInverseChimeraWithK(mfbba, mfbbb, mfbbc, vvz, vz2,  c9o4,  c4o9);
+		forwardInverseChimeraWithK(mfbca, mfbcb, mfbcc, vvz, vz2,  c9o1,  c1o9);
+		forwardInverseChimeraWithK(mfcaa, mfcab, mfcac, vvz, vz2, c36o1, c1o36);
+		forwardInverseChimeraWithK(mfcba, mfcbb, mfcbc, vvz, vz2,  c9o1,  c1o9);
+		forwardInverseChimeraWithK(mfcca, mfccb, mfccc, vvz, vz2, c36o1, c1o36);
+
+		////////////////////////////////////////////////////////////////////////////////////
+		// Y - Dir
+		forwardInverseChimeraWithK(mfaaa, mfaba, mfaca, vvy, vy2,  c6o1,  c1o6);
+		forwardChimera(            mfaab, mfabb, mfacb, vvy, vy2);
+		forwardInverseChimeraWithK(mfaac, mfabc, mfacc, vvy, vy2, c18o1, c1o18);
+		forwardInverseChimeraWithK(mfbaa, mfbba, mfbca, vvy, vy2,  c3o2,  c2o3);
+		forwardChimera(            mfbab, mfbbb, mfbcb, vvy, vy2);
+		forwardInverseChimeraWithK(mfbac, mfbbc, mfbcc, vvy, vy2,  c9o2,  c2o9);
+		forwardInverseChimeraWithK(mfcaa, mfcba, mfcca, vvy, vy2,  c6o1,  c1o6);
+		forwardChimera(            mfcab, mfcbb, mfccb, vvy, vy2);
+		forwardInverseChimeraWithK(mfcac, mfcbc, mfccc, vvy, vy2, c18o1, c1o18);
+
+		////////////////////////////////////////////////////////////////////////////////////
+		// X - Dir
+		forwardInverseChimeraWithK(mfaaa, mfbaa, mfcaa, vvx, vx2, c1o1, c1o1);
+		forwardChimera(            mfaba, mfbba, mfcba, vvx, vx2);
+		forwardInverseChimeraWithK(mfaca, mfbca, mfcca, vvx, vx2, c3o1, c1o3);
+		forwardChimera(            mfaab, mfbab, mfcab, vvx, vx2);
+		forwardChimera(            mfabb, mfbbb, mfcbb, vvx, vx2);
+		forwardChimera(            mfacb, mfbcb, mfccb, vvx, vx2);
+		forwardInverseChimeraWithK(mfaac, mfbac, mfcac, vvx, vx2, c3o1, c1o3);
+		forwardChimera(            mfabc, mfbbc, mfcbc, vvx, vx2);
+		forwardInverseChimeraWithK(mfacc, mfbcc, mfccc, vvx, vx2, c3o1, c1o9);
+
+		////////////////////////////////////////////////////////////////////////////////////
+		//! - Setting relaxation rates for non-hydrodynamic cumulants (default values). Variable names and equations according to
+		//! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.05.040 ]</b></a>
+		//!  => [NAME IN PAPER]=[NAME IN CODE]=[DEFAULT VALUE].
+		//!  - Trace of second order cumulants \f$ C_{200}+C_{020}+C_{002} \f$ used to adjust bulk viscosity:\f$\omega_2=OxxPyyPzz=1.0 \f$.
+		//!  - Third order cumulants \f$ C_{120}+C_{102}, C_{210}+C_{012}, C_{201}+C_{021} \f$: \f$ \omega_3=OxyyPxzz \f$ set according to Eq. (111) with simplifications assuming \f$ \omega_2=1.0\f$.
+		//!  - Third order cumulants \f$ C_{120}-C_{102}, C_{210}-C_{012}, C_{201}-C_{021} \f$: \f$ \omega_4 = OxyyMxzz \f$ set according to Eq. (112) with simplifications assuming \f$ \omega_2 = 1.0\f$.
+		//!  - Third order cumulants \f$ C_{111} \f$: \f$ \omega_5 = Oxyz \f$ set according to Eq. (113) with simplifications assuming \f$ \omega_2 = 1.0\f$  (modify for different bulk viscosity).
+		//!  - Fourth order cumulants \f$ C_{220}, C_{202}, C_{022}, C_{211}, C_{121}, C_{112} \f$: for simplification all set to the same default value \f$ \omega_6=\omega_7=\omega_8=O4=1.0 \f$.
+		//!  - Fifth order cumulants \f$ C_{221}, C_{212}, C_{122}\f$: \f$\omega_9=O5=1.0\f$.
+		//!  - Sixth order cumulant \f$ C_{222}\f$: \f$\omega_{10}=O6=1.0\f$.
+		//!
+		////////////////////////////////////////////////////////////
+		//2.
+		real OxxPyyPzz = c1o1;
+		////////////////////////////////////////////////////////////
+		//3.
+		real OxyyPxzz = c8o1  * (-c2o1 + omega) * ( c1o1 + c2o1*omega) / (-c8o1 - c14o1*omega + c7o1*omega*omega);
+		real OxyyMxzz = c8o1  * (-c2o1 + omega) * (-c7o1 + c4o1*omega) / (c56o1 - c50o1*omega + c9o1*omega*omega);
+		real Oxyz     = c24o1 * (-c2o1 + omega) * (-c2o1 - c7o1*omega + c3o1*omega*omega) / (c48o1 + c152o1*omega - c130o1*omega*omega + c29o1*omega*omega*omega);
+		////////////////////////////////////////////////////////////
+		//4.
+		real O4 = c1o1;
+		////////////////////////////////////////////////////////////
+		//5.
+		real O5 = c1o1;
+		////////////////////////////////////////////////////////////
+		//6.
+		real O6 = c1o1;
+
+		////////////////////////////////////////////////////////////////////////////////////
+		//! - A and B: parameters for fourth order convergence of the diffusion term according to Eq. (114) and (115) 
+		//! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.05.040 ]</b></a>
+		//! with simplifications assuming \f$ \omega_2 = 1.0 \f$ (modify for different bulk viscosity).
+		//!
+		real A = (c4o1 + c2o1*omega - c3o1*omega*omega) / (c2o1 - c7o1*omega + c5o1*omega*omega);
+		real B = (c4o1 + c28o1*omega - c14o1*omega*omega) / (c6o1 - c21o1*omega + c15o1*omega*omega);
+
+		////////////////////////////////////////////////////////////////////////////////////
+		//! - Compute cumulants from central moments according to Eq. (20)-(23) in
+		//! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.05.040 ]</b></a>
+		//!
+		////////////////////////////////////////////////////////////
+		//4.
+		real CUMcbb = mfcbb - ((mfcaa + c1o3) * mfabb + c2o1 * mfbba * mfbab) * OOrho;
+		real CUMbcb = mfbcb - ((mfaca + c1o3) * mfbab + c2o1 * mfbba * mfabb) * OOrho;
+		real CUMbbc = mfbbc - ((mfaac + c1o3) * mfbba + c2o1 * mfbab * mfabb) * OOrho;
+
+		real CUMcca = mfcca - (((mfcaa * mfaca + c2o1 * mfbba * mfbba) + c1o3 * (mfcaa + mfaca)) * OOrho - c1o9*(drho * OOrho));
+		real CUMcac = mfcac - (((mfcaa * mfaac + c2o1 * mfbab * mfbab) + c1o3 * (mfcaa + mfaac)) * OOrho - c1o9*(drho * OOrho));
+		real CUMacc = mfacc - (((mfaac * mfaca + c2o1 * mfabb * mfabb) + c1o3 * (mfaac + mfaca)) * OOrho - c1o9*(drho * OOrho));
+		////////////////////////////////////////////////////////////
+		//5.
+		real CUMbcc = mfbcc - ((mfaac * mfbca + mfaca * mfbac + c4o1 * mfabb * mfbbb + c2o1 * (mfbab * mfacb + mfbba * mfabc)) + c1o3 * (mfbca + mfbac)) * OOrho;
+		real CUMcbc = mfcbc - ((mfaac * mfcba + mfcaa * mfabc + c4o1 * mfbab * mfbbb + c2o1 * (mfabb * mfcab + mfbba * mfbac)) + c1o3 * (mfcba + mfabc)) * OOrho;
+		real CUMccb = mfccb - ((mfcaa * mfacb + mfaca * mfcab + c4o1 * mfbba * mfbbb + c2o1 * (mfbab * mfbca + mfabb * mfcba)) + c1o3 * (mfacb + mfcab)) * OOrho;
+		////////////////////////////////////////////////////////////
+		//6.
+		real CUMccc = mfccc + ((-c4o1 *  mfbbb * mfbbb
+			- (mfcaa * mfacc + mfaca * mfcac + mfaac * mfcca)
+			- c4o1 * (mfabb * mfcbb + mfbab * mfbcb + mfbba * mfbbc)
+			- c2o1 * (mfbca * mfbac + mfcba * mfabc + mfcab * mfacb)) * OOrho
+			+ (c4o1 * (mfbab * mfbab * mfaca + mfabb * mfabb * mfcaa + mfbba * mfbba * mfaac)
+			+ c2o1 * (mfcaa * mfaca * mfaac)
+			+ c16o1 *  mfbba * mfbab * mfabb) * OOrho * OOrho
+			- c1o3 * (mfacc + mfcac + mfcca) * OOrho
+			- c1o9 * (mfcaa + mfaca + mfaac) * OOrho
+			+ (c2o1 * (mfbab * mfbab + mfabb * mfabb + mfbba * mfbba)
+			+ (mfaac * mfaca + mfaac * mfcaa + mfaca * mfcaa) + c1o3 *(mfaac + mfaca + mfcaa)) * OOrho * OOrho  * c2o3
+			+ c1o27*((drho * drho - drho) * OOrho * OOrho));
+
+		////////////////////////////////////////////////////////////////////////////////////
+		//! - Compute linear combinations of second and third order cumulants
+		//!
+		////////////////////////////////////////////////////////////
+		//2.
+		real mxxPyyPzz = mfcaa + mfaca + mfaac;
+		real mxxMyy = mfcaa - mfaca;
+		real mxxMzz = mfcaa - mfaac;
+		////////////////////////////////////////////////////////////
+		//3.
+		real mxxyPyzz = mfcba + mfabc;
+		real mxxyMyzz = mfcba - mfabc;
+
+		real mxxzPyyz = mfcab + mfacb;
+		real mxxzMyyz = mfcab - mfacb;
+
+		real mxyyPxzz = mfbca + mfbac;
+		real mxyyMxzz = mfbca - mfbac;
+
+		////////////////////////////////////////////////////////////////////////////////////
+		//incl. correction
+		////////////////////////////////////////////////////////////
+		//! - Compute velocity  gradients from second order cumulants according to Eq. (27)-(32)
+		//! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.05.040 ]</b></a>
+		//! Further explanations of the correction in viscosity in Appendix H of
+		//! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015), DOI:10.1016/j.camwa.2015.05.001 ]</b></a>
+		//! Note that the division by rho is omitted here as we need rho times the gradients later.
+		//!
+		real Dxy = -c3o1*omega*mfbba;
+		real Dxz = -c3o1*omega*mfbab;
+		real Dyz = -c3o1*omega*mfabb;
+		real dxux = c1o2 * (-omega) *(mxxMyy + mxxMzz) + c1o2 *  OxxPyyPzz * (mfaaa - mxxPyyPzz);
+		real dyuy = dxux + omega * c3o2 * mxxMyy;
+		real dzuz = dxux + omega * c3o2 * mxxMzz;
+		////////////////////////////////////////////////////////////
+		//! - Relaxation of second order cumulants with correction terms according to Eq. (33)-(35) in
+		//! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.05.040 ]</b></a>
+		//!
+		mxxPyyPzz += OxxPyyPzz*(mfaaa - mxxPyyPzz) - c3o1 * (c1o1 - c1o2 * OxxPyyPzz) * (vx2 * dxux + vy2 * dyuy + vz2 * dzuz);
+		mxxMyy    += omega * (-mxxMyy) - c3o1 * (c1o1 + c1o2 * (-omega)) * (vx2 * dxux - vy2 * dyuy);
+		mxxMzz    += omega * (-mxxMzz) - c3o1 * (c1o1 + c1o2 * (-omega)) * (vx2 * dxux - vz2 * dzuz);
+
+		////////////////////////////////////////////////////////////////////////////////////
+		////no correction
+		//mxxPyyPzz += OxxPyyPzz*(mfaaa - mxxPyyPzz);
+		//mxxMyy += -(-omega) * (-mxxMyy);
+		//mxxMzz += -(-omega) * (-mxxMzz);
+		//////////////////////////////////////////////////////////////////////////
+		mfabb += omega * (-mfabb);
+		mfbab += omega * (-mfbab);
+		mfbba += omega * (-mfbba);
+
+
+
+		////////////////////////////////////////////////////////////////////////////////////
+		//relax
+		//////////////////////////////////////////////////////////////////////////
+		// incl. limiter
+		//! - Relaxation of third order cumulants including limiter according to Eq. (116)-(123)
+		//! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.05.040 ]</b></a>
+		//!
+		wadjust   = Oxyz + (c1o1 - Oxyz)*abs(mfbbb) / (abs(mfbbb) + qudricLimitD);
+		mfbbb    += wadjust * (-mfbbb);
+		wadjust   = OxyyPxzz + (c1o1 - OxyyPxzz)*abs(mxxyPyzz) / (abs(mxxyPyzz) + qudricLimitP);
+		mxxyPyzz += wadjust * (-mxxyPyzz);
+		wadjust   = OxyyMxzz + (c1o1 - OxyyMxzz)*abs(mxxyMyzz) / (abs(mxxyMyzz) + qudricLimitM);
+		mxxyMyzz += wadjust * (-mxxyMyzz);
+		wadjust   = OxyyPxzz + (c1o1 - OxyyPxzz)*abs(mxxzPyyz) / (abs(mxxzPyyz) + qudricLimitP);
+		mxxzPyyz += wadjust * (-mxxzPyyz);
+		wadjust   = OxyyMxzz + (c1o1 - OxyyMxzz)*abs(mxxzMyyz) / (abs(mxxzMyyz) + qudricLimitM);
+		mxxzMyyz += wadjust * (-mxxzMyyz);
+		wadjust   = OxyyPxzz + (c1o1 - OxyyPxzz)*abs(mxyyPxzz) / (abs(mxyyPxzz) + qudricLimitP);
+		mxyyPxzz += wadjust * (-mxyyPxzz);
+		wadjust   = OxyyMxzz + (c1o1 - OxyyMxzz)*abs(mxyyMxzz) / (abs(mxyyMxzz) + qudricLimitM);
+		mxyyMxzz += wadjust * (-mxyyMxzz);
+		//////////////////////////////////////////////////////////////////////////
+		// no limiter
+		//mfbbb += OxyyMxzz * (-mfbbb);
+		//mxxyPyzz += OxyyPxzz * (-mxxyPyzz);
+		//mxxyMyzz += OxyyMxzz * (-mxxyMyzz);
+		//mxxzPyyz += OxyyPxzz * (-mxxzPyyz);
+		//mxxzMyyz += OxyyMxzz * (-mxxzMyyz);
+		//mxyyPxzz += OxyyPxzz * (-mxyyPxzz);
+		//mxyyMxzz += OxyyMxzz * (-mxyyMxzz);
+
+		////////////////////////////////////////////////////////////////////////////////////
+		//! - Compute inverse linear combinations of second and third order cumulants
+		//!
+		mfcaa = c1o3 * (mxxMyy + mxxMzz + mxxPyyPzz);
+		mfaca = c1o3 * (-c2o1*  mxxMyy + mxxMzz + mxxPyyPzz);
+		mfaac = c1o3 * (mxxMyy - c2o1* mxxMzz + mxxPyyPzz);
+
+		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.
+		// no limiter
+		//! - Relax fourth order cumulants to modified equilibrium for fourth order convergence of diffusion according to Eq. (43)-(48)
+		//! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.05.040 ]</b></a>
+		//!
+		CUMacc = -O4*(c1o1 / omega - c1o2) * (dyuy + dzuz) * c2o3 * A + (c1o1 - O4) * (CUMacc);
+		CUMcac = -O4*(c1o1 / omega - c1o2) * (dxux + dzuz) * c2o3 * A + (c1o1 - O4) * (CUMcac);
+		CUMcca = -O4*(c1o1 / omega - c1o2) * (dyuy + dxux) * c2o3 * A + (c1o1 - O4) * (CUMcca);
+		CUMbbc = -O4*(c1o1 / omega - c1o2) * Dxy           * c1o3 * B + (c1o1 - O4) * (CUMbbc);
+		CUMbcb = -O4*(c1o1 / omega - c1o2) * Dxz           * c1o3 * B + (c1o1 - O4) * (CUMbcb);
+		CUMcbb = -O4*(c1o1 / omega - c1o2) * Dyz           * c1o3 * B + (c1o1 - O4) * (CUMcbb);
+
+		//////////////////////////////////////////////////////////////////////////
+		//5.
+		CUMbcc += O5 * (-CUMbcc);
+		CUMcbc += O5 * (-CUMcbc);
+		CUMccb += O5 * (-CUMccb);
+
+		//////////////////////////////////////////////////////////////////////////
+		//6.
+		CUMccc += O6 * (-CUMccc);
+
+		////////////////////////////////////////////////////////////////////////////////////
+		//! - Compute central moments from post collision cumulants according to Eq. (53)-(56) in
+		//! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.05.040 ]</b></a>
+		//!
+
+		//////////////////////////////////////////////////////////////////////////
+		//4.
+		mfcbb = CUMcbb + c1o3*((c3o1*mfcaa + c1o1) * mfabb + c6o1 * mfbba * mfbab) * OOrho;
+		mfbcb = CUMbcb + c1o3*((c3o1*mfaca + c1o1) * mfbab + c6o1 * mfbba * mfabb) * OOrho;
+		mfbbc = CUMbbc + c1o3*((c3o1*mfaac + c1o1) * mfbba + c6o1 * mfbab * mfabb) * OOrho;
+
+		mfcca = CUMcca + (((mfcaa * mfaca + c2o1 * mfbba * mfbba)*c9o1 + c3o1 * (mfcaa + mfaca)) * OOrho - (drho * OOrho))*c1o9;
+		mfcac = CUMcac + (((mfcaa * mfaac + c2o1 * mfbab * mfbab)*c9o1 + c3o1 * (mfcaa + mfaac)) * OOrho - (drho * OOrho))*c1o9;
+		mfacc = CUMacc + (((mfaac * mfaca + c2o1 * mfabb * mfabb)*c9o1 + c3o1 * (mfaac + mfaca)) * OOrho - (drho * OOrho))*c1o9;
+
+		//////////////////////////////////////////////////////////////////////////
+		//5.
+		mfbcc = CUMbcc + c1o3 *(c3o1*(mfaac * mfbca + mfaca * mfbac + c4o1 * mfabb * mfbbb + c2o1 * (mfbab * mfacb + mfbba * mfabc)) + (mfbca + mfbac)) * OOrho;
+		mfcbc = CUMcbc + c1o3 *(c3o1*(mfaac * mfcba + mfcaa * mfabc + c4o1 * mfbab * mfbbb + c2o1 * (mfabb * mfcab + mfbba * mfbac)) + (mfcba + mfabc)) * OOrho;
+		mfccb = CUMccb + c1o3 *(c3o1*(mfcaa * mfacb + mfaca * mfcab + c4o1 * mfbba * mfbbb + c2o1 * (mfbab * mfbca + mfabb * mfcba)) + (mfacb + mfcab)) * OOrho;
+
+		//////////////////////////////////////////////////////////////////////////
+		//6.
+		mfccc =	CUMccc - ((-c4o1 *  mfbbb * mfbbb
+				- (mfcaa * mfacc + mfaca * mfcac + mfaac * mfcca)
+				- c4o1 * (mfabb * mfcbb + mfbab * mfbcb + mfbba * mfbbc)
+				- c2o1 * (mfbca * mfbac + mfcba * mfabc + mfcab * mfacb)) * OOrho
+				+ (c4o1 * (mfbab * mfbab * mfaca + mfabb * mfabb * mfcaa + mfbba * mfbba * mfaac)
+					+ c2o1 * (mfcaa * mfaca * mfaac)
+					+ c16o1 *  mfbba * mfbab * mfabb) * OOrho * OOrho
+				- c1o3 * (mfacc + mfcac + mfcca) * OOrho
+				- c1o9 * (mfcaa + mfaca + mfaac) * OOrho
+				+ (c2o1 * (mfbab * mfbab + mfabb * mfabb + mfbba * mfbba)
+					+ (mfaac * mfaca + mfaac * mfcaa + mfaca * mfcaa) + c1o3 *(mfaac + mfaca + mfcaa)) * OOrho * OOrho * c2o3
+				+ c1o27*((drho * drho - drho) * OOrho * OOrho));
+
+
+		////////////////////////////////////////////////////////////////////////////////////
+		//! -  Add acceleration (body force) to first order cumulants according to Eq. (85)-(87) in
+		//! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015), DOI:10.1016/j.camwa.2015.05.001 ]</b></a>
+		//!
+		mfbaa = -mfbaa;
+		mfaba = -mfaba;
+		mfaab = -mfaab;
+
+		////////////////////////////////////////////////////////////////////////////////////
+		//! - Chimera transform from central moments to well conditioned distributions as defined in Appendix J in
+		//! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015), DOI:10.1016/j.camwa.2015.05.001 ]</b></a>
+		//! see also Eq. (88)-(96) in
+		//! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.05.040 ]</b></a>
+		//!
+		////////////////////////////////////////////////////////////////////////////////////
+		// X - Dir
+		backwardInverseChimeraWithK(mfaaa, mfbaa, mfcaa, vvx, vx2, c1o1, c1o1);
+		backwardChimera(            mfaba, mfbba, mfcba, vvx, vx2);
+		backwardInverseChimeraWithK(mfaca, mfbca, mfcca, vvx, vx2, c3o1, c1o3);
+		backwardChimera(            mfaab, mfbab, mfcab, vvx, vx2);
+		backwardChimera(            mfabb, mfbbb, mfcbb, vvx, vx2);
+		backwardChimera(            mfacb, mfbcb, mfccb, vvx, vx2);
+		backwardInverseChimeraWithK(mfaac, mfbac, mfcac, vvx, vx2, c3o1, c1o3);
+		backwardChimera(            mfabc, mfbbc, mfcbc, vvx, vx2);
+		backwardInverseChimeraWithK(mfacc, mfbcc, mfccc, vvx, vx2, c9o1, c1o9);
+
+		////////////////////////////////////////////////////////////////////////////////////
+		// Y - Dir
+		backwardInverseChimeraWithK(mfaaa, mfaba, mfaca, vvy, vy2,  c6o1,  c1o6);
+		backwardChimera(            mfaab, mfabb, mfacb, vvy, vy2);
+		backwardInverseChimeraWithK(mfaac, mfabc, mfacc, vvy, vy2, c18o1, c1o18);
+		backwardInverseChimeraWithK(mfbaa, mfbba, mfbca, vvy, vy2,  c3o2,  c2o3);
+		backwardChimera(            mfbab, mfbbb, mfbcb, vvy, vy2);
+		backwardInverseChimeraWithK(mfbac, mfbbc, mfbcc, vvy, vy2,  c9o2,  c2o9);
+		backwardInverseChimeraWithK(mfcaa, mfcba, mfcca, vvy, vy2,  c6o1,  c1o6);
+		backwardChimera(            mfcab, mfcbb, mfccb, vvy, vy2);
+		backwardInverseChimeraWithK(mfcac, mfcbc, mfccc, vvy, vy2, c18o1, c1o18);
+
+		////////////////////////////////////////////////////////////////////////////////////
+		// Z - Dir
+		backwardInverseChimeraWithK(mfaaa, mfaab, mfaac, vvz, vz2, c36o1, c1o36);
+		backwardInverseChimeraWithK(mfaba, mfabb, mfabc, vvz, vz2,  c9o1,  c1o9);
+		backwardInverseChimeraWithK(mfaca, mfacb, mfacc, vvz, vz2, c36o1, c1o36);
+		backwardInverseChimeraWithK(mfbaa, mfbab, mfbac, vvz, vz2,  c9o1,  c1o9);
+		backwardInverseChimeraWithK(mfbba, mfbbb, mfbbc, vvz, vz2,  c9o4,  c4o9);
+		backwardInverseChimeraWithK(mfbca, mfbcb, mfbcc, vvz, vz2,  c9o1,  c1o9);
+		backwardInverseChimeraWithK(mfcaa, mfcab, mfcac, vvz, vz2, c36o1, c1o36);
+		backwardInverseChimeraWithK(mfcba, mfcbb, mfcbc, vvz, vz2,  c9o1,  c1o9);
+		backwardInverseChimeraWithK(mfcca, mfccb, mfccc, vvz, vz2, c36o1, c1o36);
+
+		////////////////////////////////////////////////////////////////////////////////////
+		//! - Write distributions: style of reading and writing the distributions from/to 
+		//! stored arrays dependent on timestep is based on the esoteric twist algorithm
+		//! <a href="https://doi.org/10.3390/computation5020019"><b>[ M. Geier et al. (2017), DOI:10.3390/computation5020019 ]</b></a>
+		//!
+		(dist.f[dirE   ])[k   ] = mfabb;
+		(dist.f[dirW   ])[kw  ] = mfcbb;
+		(dist.f[dirN   ])[k   ] = mfbab;
+		(dist.f[dirS   ])[ks  ] = mfbcb;
+		(dist.f[dirT   ])[k   ] = mfbba;
+		(dist.f[dirB   ])[kb  ] = mfbbc;
+		(dist.f[dirNE  ])[k   ] = mfaab;
+		(dist.f[dirSW  ])[ksw ] = mfccb;
+		(dist.f[dirSE  ])[ks  ] = mfacb;
+		(dist.f[dirNW  ])[kw  ] = mfcab;
+		(dist.f[dirTE  ])[k   ] = mfaba;
+		(dist.f[dirBW  ])[kbw ] = mfcbc;
+		(dist.f[dirBE  ])[kb  ] = mfabc;
+		(dist.f[dirTW  ])[kw  ] = mfcba;
+		(dist.f[dirTN  ])[k   ] = mfbaa;
+		(dist.f[dirBS  ])[kbs ] = mfbcc;
+		(dist.f[dirBN  ])[kb  ] = mfbac;
+		(dist.f[dirTS  ])[ks  ] = mfbca;
+		(dist.f[dirREST])[k   ] = mfbbb;
+		(dist.f[dirTNE ])[k   ] = mfaaa;
+		(dist.f[dirTSE ])[ks  ] = mfaca;
+		(dist.f[dirBNE ])[kb  ] = mfaac;
+		(dist.f[dirBSE ])[kbs ] = mfacc;
+		(dist.f[dirTNW ])[kw  ] = mfcaa;
+		(dist.f[dirTSW ])[ksw ] = mfcca;
+		(dist.f[dirBNW ])[kbw ] = mfcac;
+		(dist.f[dirBSW ])[kbsw] = mfccc;
+	}
+}
+////////////////////////////////////////////////////////////////////////////////
+
+
+
diff --git a/src/VirtualFluids_GPU/GPU/GPU_Interface.h b/src/VirtualFluids_GPU/GPU/GPU_Interface.h
new file mode 100644
index 0000000000000000000000000000000000000000..5f2ec808500a9dd97f0de81364abb9407acfa834
--- /dev/null
+++ b/src/VirtualFluids_GPU/GPU/GPU_Interface.h
@@ -0,0 +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 GPU_Interface.h
+//! \ingroup GPU
+//! \author Martin Schoenherr
+//=======================================================================================
+#include "LBM/LB.h"
+
+//////////////////////////////////////////////////////////////////////////
+//! \brief Cumulant LBM kernel
+extern "C" void CumulantK17LBMDeviceKernel(
+	uint numberOfThreads,
+	real omega,
+	uint* typeOfGridNode,
+	uint* neighborX,
+	uint* neighborY,
+	uint* neighborZ,
+	real* distributions,
+	int size_Mat,
+	real* forces,
+	bool isEvenTimestep);
+
+//////////////////////////////////////////////////////////////////////////
+//! \brief initialize the lattice (distribution functions)
+extern "C" void LB_Init(
+	uint numberOfThreads,
+	uint* neighborX,
+	uint* neighborY,
+	uint* neighborZ,
+	uint* typeOfGridNode,
+	real* rho,
+	real* velocityX,
+	real* velocityY,
+	real* velocityZ,
+	uint size_Mat,
+	real* distributions,
+	bool isEvenTimestep);
+	
+//////////////////////////////////////////////////////////////////////////
+//! \brief calculates the macroscopic values from distribution functions
+extern "C" void CalcMacCompSP27(
+	real* velocityX,
+	real* velocityY,
+	real* velocityZ,
+	real* rho,
+	real* pressure,
+	uint* typeOfGridNode,
+	uint* neighborX,
+	uint* neighborY,
+	uint* neighborZ,
+	uint size_Mat,
+	uint numberOfThreads, 
+	real* distributions,
+	bool isEvenTimestep);
+
+//////////////////////////////////////////////////////////////////////////
+//! \brief defines the behavior of a velocity boundary condition (plain bounce-back plus velocity)
+extern "C" void QVelDevicePlainBB27(
+	uint numberOfThreads,
+	real* velocityX,
+	real* velocityY,
+	real* velocityZ,
+	real* distributions,
+	int* k_Q, 
+	real* QQ,
+	uint sizeQ,
+	int kQ, 
+	uint* neighborX,
+	uint* neighborY,
+	uint* neighborZ,
+	uint size_Mat, 
+	bool isEvenTimestep);
+	
+
diff --git a/src/VirtualFluids_GPU/GPU/GPU_Kernels.cuh b/src/VirtualFluids_GPU/GPU/GPU_Kernels.cuh
new file mode 100644
index 0000000000000000000000000000000000000000..c65892a63e79f6aa2bacd50be55bcd1871ee15cb
--- /dev/null
+++ b/src/VirtualFluids_GPU/GPU/GPU_Kernels.cuh
@@ -0,0 +1,103 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 GPU_Kernels.cuh
+//! \ingroup GPU
+//! \author Martin Schoenherr
+//=======================================================================================
+#ifndef D3Q27_KERNELS_H
+#define D3Q27_KERNELS_H
+
+#include "LBM/LB.h"
+
+//////////////////////////////////////////////////////////////////////////
+//! \brief \ref Cumulant_K17_LBM_Device_Kernel : Cumulant K17 lattice Boltzmann device kernel function 
+extern "C" __global__ void Cumulant_K17_LBM_Device_Kernel(
+	real omega,
+	uint* typeOfGridNode,
+	uint* neighborX,
+	uint* neighborY,
+	uint* neighborZ,
+	real* distributions,
+	int size_Mat,
+	real* forces,
+	bool isEvenTimestep);
+
+//////////////////////////////////////////////////////////////////////////
+//! \brief  \ref LBInit : device function to initialize the distributions
+extern "C" __global__ void LBInit(
+	uint* neighborX,
+	uint* neighborY,
+	uint* neighborZ,
+	uint* typeOfGridNode,
+	real* rho,
+	real* velocityX,
+	real* velocityY,
+	real* velocityZ,
+	uint size_Mat,
+	real* distributions,
+	bool isEvenTimestep);
+
+
+//////////////////////////////////////////////////////////////////////////
+//! \brief \ref LBCalcMacCompSP27 : device function to calculate macroscopic values from distributions
+extern "C" __global__ void LBCalcMacCompSP27(
+	real* velocityX,
+	real* velocityY,
+	real* velocityZ,
+	real* rho,
+	real* pressure,
+	uint* typeOfGridNode,
+	uint* neighborX,
+	uint* neighborY,
+	uint* neighborZ,
+	uint size_Mat,
+	real* distributions,
+	bool isEvenTimestep);
+
+//////////////////////////////////////////////////////////////////////////
+//! \brief \ref QVelDevPlainBB27 : device function for the velocity boundary condition (plain bounce-back + velocity)
+extern "C" __global__ void QVelDevPlainBB27(
+	real* velocityX,
+	real* velocityY,
+	real* velocityZ,
+	real* distributions,
+	int* k_Q, 
+	real* QQ,
+	uint sizeQ,
+	int kQ, 
+	uint* neighborX,
+	uint* neighborY,
+	uint* neighborZ,
+	uint size_Mat, 
+	bool isEvenTimestep);
+
+
+
+#endif
+							 
\ No newline at end of file
diff --git a/src/VirtualFluids_GPU/GPU/Init27.cu b/src/VirtualFluids_GPU/GPU/Init27.cu
new file mode 100644
index 0000000000000000000000000000000000000000..b3e387c761843b554cad6cfc7466e74ba6143bd5
--- /dev/null
+++ b/src/VirtualFluids_GPU/GPU/Init27.cu
@@ -0,0 +1,206 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 Init27.cu
+//! \ingroup GPU
+//! \author Martin Schoenherr
+//=======================================================================================
+/* Device code */
+#include "LBM/LB.h" 
+#include "LBM/D3Q27.h"
+#include "Core/RealConstants.h"
+
+extern "C" __global__ void LBInit(
+	uint* neighborX,
+	uint* neighborY,
+	uint* neighborZ,
+	uint* typeOfGridNode,
+	real* rho,
+	real* velocityX,
+	real* velocityY,
+	real* velocityZ,
+	uint size_Mat,
+	real* distributions,
+	bool isEvenTimestep)
+{
+	//////////////////////////////////////////////////////////////////////////
+	//! The initialization is executed in the following steps
+	//!
+	////////////////////////////////////////////////////////////////////////////////
+	//! - Get node index coordinates from thredIdx, blockIdx, blockDim and gridDim.
+	//!
+	const unsigned  x = threadIdx.x;  // Globaler x-Index 
+	const unsigned  y = blockIdx.x;   // Globaler y-Index 
+	const unsigned  z = blockIdx.y;   // Globaler z-Index 
+
+	const unsigned nx = blockDim.x;
+	const unsigned ny = gridDim.x;
+
+	const unsigned k = nx*(ny*z + y) + x;
+
+	//////////////////////////////////////////////////////////////////////////
+	// run for all indices in size_Mat and fluid nodes
+	if ((k < size_Mat) && (typeOfGridNode[k] == GEO_FLUID))
+	{
+		//////////////////////////////////////////////////////////////////////////
+		//! - Read distributions: style of reading and writing the distributions from/to stored arrays dependent on timestep is based on the esoteric twist algorithm \ref
+		//! <a href="https://doi.org/10.3390/computation5020019"><b>[ M. Geier et al. (2017), DOI:10.3390/computation5020019 ]</b></a>
+		//!
+		Distributions27 dist;
+		if (isEvenTimestep)
+		{
+			dist.f[dirE   ] = &distributions[dirE   *size_Mat];
+			dist.f[dirW   ] = &distributions[dirW   *size_Mat];
+			dist.f[dirN   ] = &distributions[dirN   *size_Mat];
+			dist.f[dirS   ] = &distributions[dirS   *size_Mat];
+			dist.f[dirT   ] = &distributions[dirT   *size_Mat];
+			dist.f[dirB   ] = &distributions[dirB   *size_Mat];
+			dist.f[dirNE  ] = &distributions[dirNE  *size_Mat];
+			dist.f[dirSW  ] = &distributions[dirSW  *size_Mat];
+			dist.f[dirSE  ] = &distributions[dirSE  *size_Mat];
+			dist.f[dirNW  ] = &distributions[dirNW  *size_Mat];
+			dist.f[dirTE  ] = &distributions[dirTE  *size_Mat];
+			dist.f[dirBW  ] = &distributions[dirBW  *size_Mat];
+			dist.f[dirBE  ] = &distributions[dirBE  *size_Mat];
+			dist.f[dirTW  ] = &distributions[dirTW  *size_Mat];
+			dist.f[dirTN  ] = &distributions[dirTN  *size_Mat];
+			dist.f[dirBS  ] = &distributions[dirBS  *size_Mat];
+			dist.f[dirBN  ] = &distributions[dirBN  *size_Mat];
+			dist.f[dirTS  ] = &distributions[dirTS  *size_Mat];
+			dist.f[dirREST] = &distributions[dirREST*size_Mat];
+			dist.f[dirTNE ] = &distributions[dirTNE *size_Mat];
+			dist.f[dirTSW ] = &distributions[dirTSW *size_Mat];
+			dist.f[dirTSE ] = &distributions[dirTSE *size_Mat];
+			dist.f[dirTNW ] = &distributions[dirTNW *size_Mat];
+			dist.f[dirBNE ] = &distributions[dirBNE *size_Mat];
+			dist.f[dirBSW ] = &distributions[dirBSW *size_Mat];
+			dist.f[dirBSE ] = &distributions[dirBSE *size_Mat];
+			dist.f[dirBNW ] = &distributions[dirBNW *size_Mat];
+		}
+		else
+		{
+			dist.f[dirW   ] = &distributions[dirE   *size_Mat];
+			dist.f[dirE   ] = &distributions[dirW   *size_Mat];
+			dist.f[dirS   ] = &distributions[dirN   *size_Mat];
+			dist.f[dirN   ] = &distributions[dirS   *size_Mat];
+			dist.f[dirB   ] = &distributions[dirT   *size_Mat];
+			dist.f[dirT   ] = &distributions[dirB   *size_Mat];
+			dist.f[dirSW  ] = &distributions[dirNE  *size_Mat];
+			dist.f[dirNE  ] = &distributions[dirSW  *size_Mat];
+			dist.f[dirNW  ] = &distributions[dirSE  *size_Mat];
+			dist.f[dirSE  ] = &distributions[dirNW  *size_Mat];
+			dist.f[dirBW  ] = &distributions[dirTE  *size_Mat];
+			dist.f[dirTE  ] = &distributions[dirBW  *size_Mat];
+			dist.f[dirTW  ] = &distributions[dirBE  *size_Mat];
+			dist.f[dirBE  ] = &distributions[dirTW  *size_Mat];
+			dist.f[dirBS  ] = &distributions[dirTN  *size_Mat];
+			dist.f[dirTN  ] = &distributions[dirBS  *size_Mat];
+			dist.f[dirTS  ] = &distributions[dirBN  *size_Mat];
+			dist.f[dirBN  ] = &distributions[dirTS  *size_Mat];
+			dist.f[dirREST] = &distributions[dirREST*size_Mat];
+			dist.f[dirBSW ] = &distributions[dirTNE *size_Mat];
+			dist.f[dirBNE ] = &distributions[dirTSW *size_Mat];
+			dist.f[dirBNW ] = &distributions[dirTSE *size_Mat];
+			dist.f[dirBSE ] = &distributions[dirTNW *size_Mat];
+			dist.f[dirTSW ] = &distributions[dirBNE *size_Mat];
+			dist.f[dirTNE ] = &distributions[dirBSW *size_Mat];
+			dist.f[dirTNW ] = &distributions[dirBSE *size_Mat];
+			dist.f[dirTSE ] = &distributions[dirBNW *size_Mat];
+		}
+		//////////////////////////////////////////////////////////////////////////
+		//! - Set local velocities and density
+		//!
+		real drho = rho[k];
+		real  vx1 = velocityX[k]; 
+		real  vx2 = velocityY[k]; 
+		real  vx3 = velocityZ[k]; 
+		//////////////////////////////////////////////////////////////////////////
+		//! - Set neighbor indices (necessary for indirect addressing)  
+		//!
+		uint kzero = k;
+		uint ke    = k;
+		uint kw    = neighborX[k];
+		uint kn    = k;
+		uint ks    = neighborY[k];
+		uint kt    = k;
+		uint kb    = neighborZ[k];
+		uint ksw   = neighborY[kw];
+		uint kne   = k;
+		uint kse   = ks;
+		uint knw   = kw;
+		uint kbw   = neighborZ[kw];
+		uint kte   = k;
+		uint kbe   = kb;
+		uint ktw   = kw;
+		uint kbs   = neighborZ[ks];
+		uint ktn   = k;
+		uint kbn   = kb;
+		uint kts   = ks;
+		uint ktse  = ks;
+		uint kbnw  = kbw;
+		uint ktnw  = kw;
+		uint kbse  = kbs;
+		uint ktsw  = ksw;
+		uint kbne  = kb;
+		uint ktne  = k;
+		uint kbsw  = neighborZ[ksw];
+		//////////////////////////////////////////////////////////////////////////
+		//! - Calculate the equilibrium and set the distributions
+		//!
+		real cu_sq = c3o2*(vx1*vx1 + vx2*vx2 + vx3*vx3);
+
+		(dist.f[dirREST])[kzero] = c8o27* (drho - cu_sq);
+		(dist.f[dirE   ])[ke   ] = c2o27* (drho + c3o1*( vx1            ) + c9o2*( vx1            )*( vx1            ) - cu_sq);
+		(dist.f[dirW   ])[kw   ] = c2o27* (drho + c3o1*(-vx1            ) + c9o2*(-vx1            )*(-vx1            ) - cu_sq);
+		(dist.f[dirN   ])[kn   ] = c2o27* (drho + c3o1*(       vx2      ) + c9o2*(       vx2      )*(       vx2      ) - cu_sq);
+		(dist.f[dirS   ])[ks   ] = c2o27* (drho + c3o1*(     - vx2      ) + c9o2*(     - vx2      )*(     - vx2      ) - cu_sq);
+		(dist.f[dirT   ])[kt   ] = c2o27* (drho + c3o1*(             vx3) + c9o2*(             vx3)*(             vx3) - cu_sq);
+		(dist.f[dirB   ])[kb   ] = c2o27* (drho + c3o1*(            -vx3) + c9o2*(            -vx3)*(            -vx3) - cu_sq);
+		(dist.f[dirNE  ])[kne  ] = c1o54* (drho + c3o1*( vx1 + vx2      ) + c9o2*( vx1 + vx2      )*( vx1 + vx2      ) - cu_sq);
+		(dist.f[dirSW  ])[ksw  ] = c1o54* (drho + c3o1*(-vx1 - vx2      ) + c9o2*(-vx1 - vx2      )*(-vx1 - vx2      ) - cu_sq);
+		(dist.f[dirSE  ])[kse  ] = c1o54* (drho + c3o1*( vx1 - vx2      ) + c9o2*( vx1 - vx2      )*( vx1 - vx2      ) - cu_sq);
+		(dist.f[dirNW  ])[knw  ] = c1o54* (drho + c3o1*(-vx1 + vx2      ) + c9o2*(-vx1 + vx2      )*(-vx1 + vx2      ) - cu_sq);
+		(dist.f[dirTE  ])[kte  ] = c1o54* (drho + c3o1*( vx1       + vx3) + c9o2*( vx1       + vx3)*( vx1       + vx3) - cu_sq);
+		(dist.f[dirBW  ])[kbw  ] = c1o54* (drho + c3o1*(-vx1       - vx3) + c9o2*(-vx1       - vx3)*(-vx1       - vx3) - cu_sq);
+		(dist.f[dirBE  ])[kbe  ] = c1o54* (drho + c3o1*( vx1       - vx3) + c9o2*( vx1       - vx3)*( vx1       - vx3) - cu_sq);
+		(dist.f[dirTW  ])[ktw  ] = c1o54* (drho + c3o1*(-vx1       + vx3) + c9o2*(-vx1       + vx3)*(-vx1       + vx3) - cu_sq);
+		(dist.f[dirTN  ])[ktn  ] = c1o54* (drho + c3o1*(       vx2 + vx3) + c9o2*(       vx2 + vx3)*(       vx2 + vx3) - cu_sq);
+		(dist.f[dirBS  ])[kbs  ] = c1o54* (drho + c3o1*(     - vx2 - vx3) + c9o2*(     - vx2 - vx3)*(     - vx2 - vx3) - cu_sq);
+		(dist.f[dirBN  ])[kbn  ] = c1o54* (drho + c3o1*(       vx2 - vx3) + c9o2*(       vx2 - vx3)*(       vx2 - vx3) - cu_sq);
+		(dist.f[dirTS  ])[kts  ] = c1o54* (drho + c3o1*(     - vx2 + vx3) + c9o2*(     - vx2 + vx3)*(     - vx2 + vx3) - cu_sq);
+		(dist.f[dirTNE ])[ktne ] = c1o216*(drho + c3o1*( vx1 + vx2 + vx3) + c9o2*( vx1 + vx2 + vx3)*( vx1 + vx2 + vx3) - cu_sq);
+		(dist.f[dirBSW ])[kbsw ] = c1o216*(drho + c3o1*(-vx1 - vx2 - vx3) + c9o2*(-vx1 - vx2 - vx3)*(-vx1 - vx2 - vx3) - cu_sq);
+		(dist.f[dirBNE ])[kbne ] = c1o216*(drho + c3o1*( vx1 + vx2 - vx3) + c9o2*( vx1 + vx2 - vx3)*( vx1 + vx2 - vx3) - cu_sq);
+		(dist.f[dirTSW ])[ktsw ] = c1o216*(drho + c3o1*(-vx1 - vx2 + vx3) + c9o2*(-vx1 - vx2 + vx3)*(-vx1 - vx2 + vx3) - cu_sq);
+		(dist.f[dirTSE ])[ktse ] = c1o216*(drho + c3o1*( vx1 - vx2 + vx3) + c9o2*( vx1 - vx2 + vx3)*( vx1 - vx2 + vx3) - cu_sq);
+		(dist.f[dirBNW ])[kbnw ] = c1o216*(drho + c3o1*(-vx1 + vx2 - vx3) + c9o2*(-vx1 + vx2 - vx3)*(-vx1 + vx2 - vx3) - cu_sq);
+		(dist.f[dirBSE ])[kbse ] = c1o216*(drho + c3o1*( vx1 - vx2 - vx3) + c9o2*( vx1 - vx2 - vx3)*( vx1 - vx2 - vx3) - cu_sq);
+		(dist.f[dirTNW ])[ktnw ] = c1o216*(drho + c3o1*(-vx1 + vx2 + vx3) + c9o2*(-vx1 + vx2 + vx3)*(-vx1 + vx2 + vx3) - cu_sq);
+	}
+}
+
diff --git a/src/VirtualFluids_GPU/GPU/LBMKernel.cu b/src/VirtualFluids_GPU/GPU/LBMKernel.cu
new file mode 100644
index 0000000000000000000000000000000000000000..9b04e3a5d8e9428fac88cdf0bd1527e917782370
--- /dev/null
+++ b/src/VirtualFluids_GPU/GPU/LBMKernel.cu
@@ -0,0 +1,183 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 LBMKernel.cu
+//! \ingroup GPU
+//! \author Martin Schoenherr
+//=======================================================================================
+#include <helper_cuda.h>
+
+#include "LBM/LB.h"
+#include "GPU/GPU_Kernels.cuh"
+//////////////////////////////////////////////////////////////////////////
+extern "C" void CumulantK17LBMDeviceKernel(
+	uint numberOfThreads,
+	real omega,
+	uint* typeOfGridNode,
+	uint* neighborX,
+	uint* neighborY,
+	uint* neighborZ,
+	real* distributions,
+	int size_Mat,
+	real* forces,
+	bool isEvenTimestep)
+{
+	int Grid = (size_Mat / numberOfThreads) + 1;
+	dim3 grid(Grid, 1, 1);
+	dim3 threads(numberOfThreads, 1, 1);
+
+	Cumulant_K17_LBM_Device_Kernel <<< grid, threads >>> (
+		omega,
+		typeOfGridNode,
+		neighborX,
+		neighborY,
+		neighborZ,
+		distributions,
+		size_Mat,
+		forces,
+		isEvenTimestep);
+	getLastCudaError("Cumulant_K17_AA2016_chim_Comp_SP_27 execution failed");
+}
+//////////////////////////////////////////////////////////////////////////
+extern "C" void LB_Init(
+	uint numberOfThreads,
+	uint* neighborX,
+	uint* neighborY,
+	uint* neighborZ,
+	uint* typeOfGridNode,
+	real* rho,
+	real* velocityX,
+	real* velocityY,
+	real* velocityZ,
+	uint size_Mat,
+	real* distributions,
+	bool isEvenTimestep)
+{
+	int Grid = (size_Mat / numberOfThreads) + 1;
+	dim3 grid(Grid, 1, 1);
+	dim3 threads(numberOfThreads, 1, 1);
+
+	LBInit <<< grid, threads >>> (
+		neighborX,
+		neighborY,
+		neighborZ,
+		typeOfGridNode,
+		rho,
+		velocityX,
+		velocityY,
+		velocityZ,
+		size_Mat,
+		distributions,
+		isEvenTimestep);
+	getLastCudaError("LBInit execution failed");
+}
+//////////////////////////////////////////////////////////////////////////
+extern "C" void CalcMacCompSP27(
+	real* velocityX,
+	real* velocityY,
+	real* velocityZ,
+	real* rho,
+	real* pressure,
+	uint* typeOfGridNode,
+	uint* neighborX,
+	uint* neighborY,
+	uint* neighborZ,
+	uint size_Mat,
+	uint numberOfThreads,
+	real* distributions,
+	bool isEvenTimestep)
+{
+	int Grid = (size_Mat / numberOfThreads) + 1;
+	dim3 grid(Grid, 1, 1);
+	dim3 threads(numberOfThreads, 1, 1);
+
+	LBCalcMacCompSP27 <<< grid, threads >>> (
+		velocityX,
+		velocityY,
+		velocityZ,
+		rho,
+		pressure,
+		typeOfGridNode,
+		neighborX,
+		neighborY,
+		neighborZ,
+		size_Mat,
+		distributions,
+		isEvenTimestep);
+	getLastCudaError("LBCalcMacSP27 execution failed");
+}
+//////////////////////////////////////////////////////////////////////////
+extern "C" void QVelDevicePlainBB27(
+	unsigned int numberOfThreads,
+	real* velocityX,
+	real* velocityY,
+	real* velocityZ,
+	real* distributions,
+	int* k_Q,
+	real* QQ,
+	uint sizeQ,
+	int kQ,
+	uint* neighborX,
+	uint* neighborY,
+	uint* neighborZ,
+	uint size_Mat,
+	bool isEvenTimestep)
+{
+	int Grid = (kQ / numberOfThreads) + 1;
+	dim3 gridQ(Grid, 1, 1);
+	dim3 threads(numberOfThreads, 1, 1);
+
+	QVelDevPlainBB27 <<< gridQ, threads >>> (
+		velocityX,
+		velocityY,
+		velocityZ,
+		distributions,
+		k_Q,
+		QQ,
+		sizeQ,
+		kQ,
+		neighborX,
+		neighborY,
+		neighborZ,
+		size_Mat,
+		isEvenTimestep);
+	getLastCudaError("QVelDevicePlainBB27 execution failed");
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/VirtualFluids_GPU/GPU/VelocityBCs27.cu b/src/VirtualFluids_GPU/GPU/VelocityBCs27.cu
new file mode 100644
index 0000000000000000000000000000000000000000..51fec519507cb27cff0dd74e42ff7154d518f725
--- /dev/null
+++ b/src/VirtualFluids_GPU/GPU/VelocityBCs27.cu
@@ -0,0 +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 VelocityBCs27.cu
+//! \ingroup GPU
+//! \author Martin Schoenherr
+//=======================================================================================
+/* Device code */
+#include "LBM/LB.h" 
+#include "LBM/D3Q27.h"
+#include "Core/RealConstants.h"
+
+//////////////////////////////////////////////////////////////////////////////
+extern "C" __global__ void QVelDevPlainBB27(
+	real* vx,
+	real* vy,
+	real* vz,
+	real* distributions,
+	int* k_Q, 
+	real* QQ,
+	uint sizeQ,
+	int kQ, 
+	uint* neighborX,
+	uint* neighborY,
+	uint* neighborZ,
+	uint size_Mat, 
+	bool isEvenTimestep)
+{
+	//////////////////////////////////////////////////////////////////////////
+	//! The velocity boundary condition is executed in the following steps
+	//!
+	////////////////////////////////////////////////////////////////////////////////
+	//! - Get node index coordinates from thredIdx, blockIdx, blockDim and gridDim.
+	//!
+	const unsigned  x = threadIdx.x;  // Globaler x-Index 
+   const unsigned  y = blockIdx.x;   // Globaler y-Index 
+   const unsigned  z = blockIdx.y;   // Globaler z-Index 
+
+   const unsigned nx = blockDim.x;
+   const unsigned ny = gridDim.x;
+
+   const unsigned k = nx*(ny*z + y) + x;
+
+   //////////////////////////////////////////////////////////////////////////
+   // run for all indices in size of boundary condition (kQ)
+   if(k<kQ)
+   {
+	   //////////////////////////////////////////////////////////////////////////
+	   //! - Read distributions: style of reading and writing the distributions from/to stored arrays dependent on timestep is based on the esoteric twist algorithm \ref
+	   //! <a href="https://doi.org/10.3390/computation5020019"><b>[ M. Geier et al. (2017), DOI:10.3390/computation5020019 ]</b></a>
+	   //!
+	   Distributions27 dist;
+	   if (isEvenTimestep)
+	   {
+		  dist.f[dirE   ] = &distributions[dirE   *size_Mat];
+		  dist.f[dirW   ] = &distributions[dirW   *size_Mat];
+		  dist.f[dirN   ] = &distributions[dirN   *size_Mat];
+		  dist.f[dirS   ] = &distributions[dirS   *size_Mat];
+		  dist.f[dirT   ] = &distributions[dirT   *size_Mat];
+		  dist.f[dirB   ] = &distributions[dirB   *size_Mat];
+		  dist.f[dirNE  ] = &distributions[dirNE  *size_Mat];
+		  dist.f[dirSW  ] = &distributions[dirSW  *size_Mat];
+		  dist.f[dirSE  ] = &distributions[dirSE  *size_Mat];
+		  dist.f[dirNW  ] = &distributions[dirNW  *size_Mat];
+		  dist.f[dirTE  ] = &distributions[dirTE  *size_Mat];
+		  dist.f[dirBW  ] = &distributions[dirBW  *size_Mat];
+		  dist.f[dirBE  ] = &distributions[dirBE  *size_Mat];
+		  dist.f[dirTW  ] = &distributions[dirTW  *size_Mat];
+		  dist.f[dirTN  ] = &distributions[dirTN  *size_Mat];
+		  dist.f[dirBS  ] = &distributions[dirBS  *size_Mat];
+		  dist.f[dirBN  ] = &distributions[dirBN  *size_Mat];
+		  dist.f[dirTS  ] = &distributions[dirTS  *size_Mat];
+		  dist.f[dirREST] = &distributions[dirREST*size_Mat];
+		  dist.f[dirTNE ] = &distributions[dirTNE *size_Mat];
+		  dist.f[dirTSW ] = &distributions[dirTSW *size_Mat];
+		  dist.f[dirTSE ] = &distributions[dirTSE *size_Mat];
+		  dist.f[dirTNW ] = &distributions[dirTNW *size_Mat];
+		  dist.f[dirBNE ] = &distributions[dirBNE *size_Mat];
+		  dist.f[dirBSW ] = &distributions[dirBSW *size_Mat];
+		  dist.f[dirBSE ] = &distributions[dirBSE *size_Mat];
+		  dist.f[dirBNW ] = &distributions[dirBNW *size_Mat];
+	   } 
+	   else
+	   {
+		  dist.f[dirW   ] = &distributions[dirE   *size_Mat];
+		  dist.f[dirE   ] = &distributions[dirW   *size_Mat];
+		  dist.f[dirS   ] = &distributions[dirN   *size_Mat];
+		  dist.f[dirN   ] = &distributions[dirS   *size_Mat];
+		  dist.f[dirB   ] = &distributions[dirT   *size_Mat];
+		  dist.f[dirT   ] = &distributions[dirB   *size_Mat];
+		  dist.f[dirSW  ] = &distributions[dirNE  *size_Mat];
+		  dist.f[dirNE  ] = &distributions[dirSW  *size_Mat];
+		  dist.f[dirNW  ] = &distributions[dirSE  *size_Mat];
+		  dist.f[dirSE  ] = &distributions[dirNW  *size_Mat];
+		  dist.f[dirBW  ] = &distributions[dirTE  *size_Mat];
+		  dist.f[dirTE  ] = &distributions[dirBW  *size_Mat];
+		  dist.f[dirTW  ] = &distributions[dirBE  *size_Mat];
+		  dist.f[dirBE  ] = &distributions[dirTW  *size_Mat];
+		  dist.f[dirBS  ] = &distributions[dirTN  *size_Mat];
+		  dist.f[dirTN  ] = &distributions[dirBS  *size_Mat];
+		  dist.f[dirTS  ] = &distributions[dirBN  *size_Mat];
+		  dist.f[dirBN  ] = &distributions[dirTS  *size_Mat];
+		  dist.f[dirREST] = &distributions[dirREST*size_Mat];
+		  dist.f[dirTNE ] = &distributions[dirBSW *size_Mat];
+		  dist.f[dirTSW ] = &distributions[dirBNE *size_Mat];
+		  dist.f[dirTSE ] = &distributions[dirBNW *size_Mat];
+		  dist.f[dirTNW ] = &distributions[dirBSE *size_Mat];
+		  dist.f[dirBNE ] = &distributions[dirTSW *size_Mat];
+		  dist.f[dirBSW ] = &distributions[dirTNE *size_Mat];
+		  dist.f[dirBSE ] = &distributions[dirTNW *size_Mat];
+		  dist.f[dirBNW ] = &distributions[dirTSE *size_Mat];
+	   }
+
+
+	  ////////////////////////////////////////////////////////////////////////////////
+	  //! - Set local velocities
+	  //!
+	  real VeloX = vx[k];
+	  real VeloY = vy[k];
+	  real VeloZ = vz[k];
+      ////////////////////////////////////////////////////////////////////////////////
+	  //! - Set local subgrid distances (q's)
+	  //!
+      real   *q_dirE,   *q_dirW,   *q_dirN,   *q_dirS,   *q_dirT,   *q_dirB, 
+			 *q_dirNE,  *q_dirSW,  *q_dirSE,  *q_dirNW,  *q_dirTE,  *q_dirBW,
+			 *q_dirBE,  *q_dirTW,  *q_dirTN,  *q_dirBS,  *q_dirBN,  *q_dirTS,
+			 *q_dirTNE, *q_dirTSW, *q_dirTSE, *q_dirTNW, *q_dirBNE, *q_dirBSW,
+			 *q_dirBSE, *q_dirBNW; 
+      q_dirE   = &QQ[dirE   *sizeQ];
+      q_dirW   = &QQ[dirW   *sizeQ];
+      q_dirN   = &QQ[dirN   *sizeQ];
+      q_dirS   = &QQ[dirS   *sizeQ];
+      q_dirT   = &QQ[dirT   *sizeQ];
+      q_dirB   = &QQ[dirB   *sizeQ];
+      q_dirNE  = &QQ[dirNE  *sizeQ];
+      q_dirSW  = &QQ[dirSW  *sizeQ];
+      q_dirSE  = &QQ[dirSE  *sizeQ];
+      q_dirNW  = &QQ[dirNW  *sizeQ];
+      q_dirTE  = &QQ[dirTE  *sizeQ];
+      q_dirBW  = &QQ[dirBW  *sizeQ];
+      q_dirBE  = &QQ[dirBE  *sizeQ];
+      q_dirTW  = &QQ[dirTW  *sizeQ];
+      q_dirTN  = &QQ[dirTN  *sizeQ];
+      q_dirBS  = &QQ[dirBS  *sizeQ];
+      q_dirBN  = &QQ[dirBN  *sizeQ];
+      q_dirTS  = &QQ[dirTS  *sizeQ];
+      q_dirTNE = &QQ[dirTNE *sizeQ];
+      q_dirTSW = &QQ[dirTSW *sizeQ];
+      q_dirTSE = &QQ[dirTSE *sizeQ];
+      q_dirTNW = &QQ[dirTNW *sizeQ];
+      q_dirBNE = &QQ[dirBNE *sizeQ];
+      q_dirBSW = &QQ[dirBSW *sizeQ];
+      q_dirBSE = &QQ[dirBSE *sizeQ];
+      q_dirBNW = &QQ[dirBNW *sizeQ];
+      ////////////////////////////////////////////////////////////////////////////////
+	  //! - Set neighbor indices (necessary for indirect addressing)  
+	  //!
+	  uint KQK = k_Q[k];
+      uint ke   = KQK;
+      uint kw   = neighborX[KQK];
+      uint kn   = KQK;
+      uint ks   = neighborY[KQK];
+      uint kt   = KQK;
+      uint kb   = neighborZ[KQK];
+      uint ksw  = neighborY[kw];
+      uint kne  = KQK;
+      uint kse  = ks;
+      uint knw  = kw;
+      uint kbw  = neighborZ[kw];
+      uint kte  = KQK;
+      uint kbe  = kb;
+      uint ktw  = kw;
+      uint kbs  = neighborZ[ks];
+      uint ktn  = KQK;
+      uint kbn  = kb;
+      uint kts  = ks;
+      uint ktse = ks;
+      uint kbnw = kbw;
+      uint ktnw = kw;
+      uint kbse = kbs;
+      uint ktsw = ksw;
+      uint kbne = kb;
+      uint ktne = KQK;
+      uint kbsw = neighborZ[ksw];
+      ////////////////////////////////////////////////////////////////////////////////
+     
+      ////////////////////////////////////////////////////////////////////////////////
+	  //! - Set local distributions  
+	  //!
+	  real f_W = (dist.f[dirE])[ke];
+      real f_E    = (dist.f[dirW   ])[kw   ];
+      real f_S    = (dist.f[dirN   ])[kn   ];
+      real f_N    = (dist.f[dirS   ])[ks   ];
+      real f_B    = (dist.f[dirT   ])[kt   ];
+      real f_T    = (dist.f[dirB   ])[kb   ];
+      real f_SW   = (dist.f[dirNE  ])[kne  ];
+      real f_NE   = (dist.f[dirSW  ])[ksw  ];
+      real f_NW   = (dist.f[dirSE  ])[kse  ];
+      real f_SE   = (dist.f[dirNW  ])[knw  ];
+      real f_BW   = (dist.f[dirTE  ])[kte  ];
+      real f_TE   = (dist.f[dirBW  ])[kbw  ];
+      real f_TW   = (dist.f[dirBE  ])[kbe  ];
+      real f_BE   = (dist.f[dirTW  ])[ktw  ];
+      real f_BS   = (dist.f[dirTN  ])[ktn  ];
+      real f_TN   = (dist.f[dirBS  ])[kbs  ];
+      real f_TS   = (dist.f[dirBN  ])[kbn  ];
+      real f_BN   = (dist.f[dirTS  ])[kts  ];
+      real f_BSW  = (dist.f[dirTNE ])[ktne ];
+      real f_BNE  = (dist.f[dirTSW ])[ktsw ];
+      real f_BNW  = (dist.f[dirTSE ])[ktse ];
+      real f_BSE  = (dist.f[dirTNW ])[ktnw ];
+      real f_TSW  = (dist.f[dirBNE ])[kbne ];
+      real f_TNE  = (dist.f[dirBSW ])[kbsw ];
+      real f_TNW  = (dist.f[dirBSE ])[kbse ];
+      real f_TSE  = (dist.f[dirBNW ])[kbnw ];
+	  ////////////////////////////////////////////////////////////////////////////////
+
+	  ////////////////////////////////////////////////////////////////////////////////
+	  //! - change the pointer to write the results in the correct array  
+	  //!
+	  if (!isEvenTimestep)
+      {
+         dist.f[dirE   ] = &distributions[dirE   *size_Mat];
+         dist.f[dirW   ] = &distributions[dirW   *size_Mat];
+         dist.f[dirN   ] = &distributions[dirN   *size_Mat];
+         dist.f[dirS   ] = &distributions[dirS   *size_Mat];
+         dist.f[dirT   ] = &distributions[dirT   *size_Mat];
+         dist.f[dirB   ] = &distributions[dirB   *size_Mat];
+         dist.f[dirNE  ] = &distributions[dirNE  *size_Mat];
+         dist.f[dirSW  ] = &distributions[dirSW  *size_Mat];
+         dist.f[dirSE  ] = &distributions[dirSE  *size_Mat];
+         dist.f[dirNW  ] = &distributions[dirNW  *size_Mat];
+         dist.f[dirTE  ] = &distributions[dirTE  *size_Mat];
+         dist.f[dirBW  ] = &distributions[dirBW  *size_Mat];
+         dist.f[dirBE  ] = &distributions[dirBE  *size_Mat];
+         dist.f[dirTW  ] = &distributions[dirTW  *size_Mat];
+         dist.f[dirTN  ] = &distributions[dirTN  *size_Mat];
+         dist.f[dirBS  ] = &distributions[dirBS  *size_Mat];
+         dist.f[dirBN  ] = &distributions[dirBN  *size_Mat];
+         dist.f[dirTS  ] = &distributions[dirTS  *size_Mat];
+         dist.f[dirREST] = &distributions[dirREST*size_Mat];
+         dist.f[dirTNE ] = &distributions[dirTNE *size_Mat];
+         dist.f[dirTSW ] = &distributions[dirTSW *size_Mat];
+         dist.f[dirTSE ] = &distributions[dirTSE *size_Mat];
+         dist.f[dirTNW ] = &distributions[dirTNW *size_Mat];
+         dist.f[dirBNE ] = &distributions[dirBNE *size_Mat];
+         dist.f[dirBSW ] = &distributions[dirBSW *size_Mat];
+         dist.f[dirBSE ] = &distributions[dirBSE *size_Mat];
+         dist.f[dirBNW ] = &distributions[dirBNW *size_Mat];
+      } 
+      else
+      {
+         dist.f[dirW   ] = &distributions[dirE   *size_Mat];
+         dist.f[dirE   ] = &distributions[dirW   *size_Mat];
+         dist.f[dirS   ] = &distributions[dirN   *size_Mat];
+         dist.f[dirN   ] = &distributions[dirS   *size_Mat];
+         dist.f[dirB   ] = &distributions[dirT   *size_Mat];
+         dist.f[dirT   ] = &distributions[dirB   *size_Mat];
+         dist.f[dirSW  ] = &distributions[dirNE  *size_Mat];
+         dist.f[dirNE  ] = &distributions[dirSW  *size_Mat];
+         dist.f[dirNW  ] = &distributions[dirSE  *size_Mat];
+         dist.f[dirSE  ] = &distributions[dirNW  *size_Mat];
+         dist.f[dirBW  ] = &distributions[dirTE  *size_Mat];
+         dist.f[dirTE  ] = &distributions[dirBW  *size_Mat];
+         dist.f[dirTW  ] = &distributions[dirBE  *size_Mat];
+         dist.f[dirBE  ] = &distributions[dirTW  *size_Mat];
+         dist.f[dirBS  ] = &distributions[dirTN  *size_Mat];
+         dist.f[dirTN  ] = &distributions[dirBS  *size_Mat];
+         dist.f[dirTS  ] = &distributions[dirBN  *size_Mat];
+         dist.f[dirBN  ] = &distributions[dirTS  *size_Mat];
+         dist.f[dirREST] = &distributions[dirREST*size_Mat];
+         dist.f[dirTNE ] = &distributions[dirBSW *size_Mat];
+         dist.f[dirTSW ] = &distributions[dirBNE *size_Mat];
+         dist.f[dirTSE ] = &distributions[dirBNW *size_Mat];
+         dist.f[dirTNW ] = &distributions[dirBSE *size_Mat];
+         dist.f[dirBNE ] = &distributions[dirTSW *size_Mat];
+         dist.f[dirBSW ] = &distributions[dirTNE *size_Mat];
+         dist.f[dirBSE ] = &distributions[dirTNW *size_Mat];
+         dist.f[dirBNW ] = &distributions[dirTSE *size_Mat];
+      }
+	  ////////////////////////////////////////////////////////////////////////////////
+	  //! - rewrite distributions if there is a sub-grid distance (q) in same direction
+	  real q;
+      q = q_dirE[k];	if (q>=c0o1 && q<=c1o1)	(dist.f[dirW  ])[kw  ]=f_E   + c4o9  * (-VeloX);	
+      q = q_dirW[k];	if (q>=c0o1 && q<=c1o1)	(dist.f[dirE  ])[ke  ]=f_W   + c4o9  * ( VeloX);	
+      q = q_dirN[k];	if (q>=c0o1 && q<=c1o1)	(dist.f[dirS  ])[ks  ]=f_N   + c4o9  * (-VeloY);	
+      q = q_dirS[k];	if (q>=c0o1 && q<=c1o1)	(dist.f[dirN  ])[kn  ]=f_S   + c4o9  * ( VeloY);	
+      q = q_dirT[k];	if (q>=c0o1 && q<=c1o1)	(dist.f[dirB  ])[kb  ]=f_T   + c4o9  * (-VeloZ);
+      q = q_dirB[k];	if (q>=c0o1 && q<=c1o1)	(dist.f[dirT  ])[kt  ]=f_B   + c4o9  * ( VeloZ);
+      q = q_dirNE[k];	if (q>=c0o1 && q<=c1o1)	(dist.f[dirSW ])[ksw ]=f_NE  + c1o9  * (-VeloX - VeloY);
+	  q = q_dirSW[k];	if (q>=c0o1 && q<=c1o1)	(dist.f[dirNE ])[kne ]=f_SW  + c1o9  * ( VeloX + VeloY);
+	  q = q_dirSE[k];	if (q>=c0o1 && q<=c1o1)	(dist.f[dirNW ])[knw ]=f_SE  + c1o9  * (-VeloX + VeloY);
+	  q = q_dirNW[k];	if (q>=c0o1 && q<=c1o1)	(dist.f[dirSE ])[kse ]=f_NW  + c1o9  * ( VeloX - VeloY);
+	  q = q_dirTE[k];	if (q>=c0o1 && q<=c1o1)	(dist.f[dirBW ])[kbw ]=f_TE  + c1o9  * (-VeloX - VeloZ);
+	  q = q_dirBW[k];	if (q>=c0o1 && q<=c1o1)	(dist.f[dirTE ])[kte ]=f_BW  + c1o9  * ( VeloX + VeloZ);
+	  q = q_dirBE[k];	if (q>=c0o1 && q<=c1o1)	(dist.f[dirTW ])[ktw ]=f_BE  + c1o9  * (-VeloX + VeloZ);
+	  q = q_dirTW[k];	if (q>=c0o1 && q<=c1o1)	(dist.f[dirBE ])[kbe ]=f_TW  + c1o9  * ( VeloX - VeloZ);
+	  q = q_dirTN[k];	if (q>=c0o1 && q<=c1o1)	(dist.f[dirBS ])[kbs ]=f_TN  + c1o9  * (-VeloY - VeloZ);
+	  q = q_dirBS[k];	if (q>=c0o1 && q<=c1o1)	(dist.f[dirTN ])[ktn ]=f_BS  + c1o9  * ( VeloY + VeloZ);
+	  q = q_dirBN[k];	if (q>=c0o1 && q<=c1o1)	(dist.f[dirTS ])[kts ]=f_BN  + c1o9  * (-VeloY + VeloZ);
+	  q = q_dirTS[k];	if (q>=c0o1 && q<=c1o1)	(dist.f[dirBN ])[kbn ]=f_TS  + c1o9  * ( VeloY - VeloZ);
+      q = q_dirTNE[k];	if (q>=c0o1 && q<=c1o1)	(dist.f[dirBSW])[kbsw]=f_TNE + c1o36 * (-VeloX - VeloY - VeloZ);
+      q = q_dirBSW[k];	if (q>=c0o1 && q<=c1o1)	(dist.f[dirTNE])[ktne]=f_BSW + c1o36 * ( VeloX + VeloY + VeloZ);
+      q = q_dirBNE[k];	if (q>=c0o1 && q<=c1o1)	(dist.f[dirTSW])[ktsw]=f_BNE + c1o36 * (-VeloX - VeloY + VeloZ);
+      q = q_dirTSW[k];	if (q>=c0o1 && q<=c1o1)	(dist.f[dirBNE])[kbne]=f_TSW + c1o36 * ( VeloX + VeloY - VeloZ);
+      q = q_dirTSE[k];	if (q>=c0o1 && q<=c1o1)	(dist.f[dirBNW])[kbnw]=f_TSE + c1o36 * (-VeloX + VeloY - VeloZ);
+      q = q_dirBNW[k];	if (q>=c0o1 && q<=c1o1)	(dist.f[dirTSE])[ktse]=f_BNW + c1o36 * ( VeloX - VeloY + VeloZ);
+      q = q_dirBSE[k];	if (q>=c0o1 && q<=c1o1)	(dist.f[dirTNW])[ktnw]=f_BSE + c1o36 * (-VeloX + VeloY + VeloZ);
+      q = q_dirTNW[k];	if (q>=c0o1 && q<=c1o1)	(dist.f[dirBSE])[kbse]=f_TNW + c1o36 * ( VeloX - VeloY - VeloZ);
+   }
+}
+
+
+
diff --git a/src/VirtualFluids_GPU/GPU/devCheck.cpp b/src/VirtualFluids_GPU/GPU/devCheck.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..0c31ecb06ff208fbf46e7b4b7923a9c96513e74e
--- /dev/null
+++ b/src/VirtualFluids_GPU/GPU/devCheck.cpp
@@ -0,0 +1,82 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 devCheck.cpp
+//! \ingroup GPU
+//! \author Martin Schoenherr
+//=======================================================================================
+#include "devCheck.h"
+
+#include <stdio.h>
+#include <stdlib.h> 
+
+#include <cuda_runtime.h>
+
+
+int devCheck(int gpudevice)
+{
+	int device_count = 0;
+	int device;  // used with  cudaGetDevice() to verify cudaSetDevice() 
+
+   // get the number of non-emulation devices  detected 
+	cudaGetDeviceCount(&device_count);
+	if (gpudevice > device_count)
+	{
+		printf("gpudevice >=  device_count ... exiting\n");
+		exit(1);
+	}
+	cudaError_t cudareturn;
+	cudaDeviceProp deviceProp;
+
+	// cudaGetDeviceProperties() is also  demonstrated in the deviceQuery/ example
+	// of the sdk projects directory 
+	cudaGetDeviceProperties(&deviceProp, gpudevice);
+	printf("[compute capability] = [%d.%d]\n",
+		deviceProp.major, deviceProp.minor);
+
+	if (deviceProp.major > 999)
+	{
+		printf("warning, CUDA Device  Emulation (CPU) detected, exiting\n");
+		exit(1);
+	}
+
+	// choose a cuda device for kernel  execution 
+	cudareturn = cudaSetDevice(gpudevice);
+	if (cudareturn == cudaErrorInvalidDevice)
+	{
+		perror("cudaSetDevice returned  cudaErrorInvalidDevice");
+	}
+	else
+	{
+		// double check that device was  properly selected 
+		cudaGetDevice(&device);
+		//printf("cudaGetDevice()=%d\n",device); 
+		return device;
+	}
+	return -1;
+}
diff --git a/src/VirtualFluids_GPU/GPU/devCheck.h b/src/VirtualFluids_GPU/GPU/devCheck.h
new file mode 100644
index 0000000000000000000000000000000000000000..724e3d0763b70133ddc313f2546691dc25bbff8a
--- /dev/null
+++ b/src/VirtualFluids_GPU/GPU/devCheck.h
@@ -0,0 +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 devCheck.h
+//! \ingroup GPU
+//! \author Martin Schoenherr
+//=======================================================================================
+#ifndef DEVCHECK_H
+#define DEVCHECK_H
+
+int devCheck(int gpudevice); 
+
+#endif
\ No newline at end of file
diff --git a/src/VirtualFluids_GPU/GPU/package.include b/src/VirtualFluids_GPU/GPU/package.include
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/src/VirtualFluids_GPU/Init/InitLattice.cpp b/src/VirtualFluids_GPU/Init/InitLattice.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..e0315fdf51d45d3f6d977575b4114d30ae95acc3
--- /dev/null
+++ b/src/VirtualFluids_GPU/Init/InitLattice.cpp
@@ -0,0 +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 InitLattice.h
+//! \ingroup Init
+//! \author Martin Schoenherr
+//=======================================================================================
+#include "Init/InitLattice.h"
+#include "Parameter/Parameter.h"
+#include "GPU/GPU_Interface.h"
+
+////////////////////////////////////////////////////////////////////////////////
+void initLattice(SPtr<Parameter> para)
+{
+	unsigned lev = 0;
+	//////////////////////////////////////////////////////////////////////////
+	para->getParD()->isEvenTimestep = true;
+	//////////////////////////////////////////////////////////////////////////
+	LB_Init(
+		para->getParD()->numberofthreads, 
+		para->getParD()->neighborX,
+		para->getParD()->neighborY,
+		para->getParD()->neighborZ,
+		para->getParD()->typeOfGridNode,
+		para->getParD()->rho,
+		para->getParD()->velocityX,
+		para->getParD()->velocityY,
+		para->getParD()->velocityZ,
+		para->getParD()->numberOfNodes,
+		para->getParD()->distributions.f[0],
+		para->getParD()->isEvenTimestep);
+	//////////////////////////////////////////////////////////////////////////
+	para->getParD()->isEvenTimestep = false;
+	//////////////////////////////////////////////////////////////////////////
+	LB_Init(
+		para->getParD()->numberofthreads,
+		para->getParD()->neighborX,
+		para->getParD()->neighborY,
+		para->getParD()->neighborZ,
+		para->getParD()->typeOfGridNode,
+		para->getParD()->rho,
+		para->getParD()->velocityX,
+		para->getParD()->velocityY,
+		para->getParD()->velocityZ,
+		para->getParD()->numberOfNodes,
+		para->getParD()->distributions.f[0],
+		para->getParD()->isEvenTimestep);
+
+	//////////////////////////////////////////////////////////////////////////
+	CalcMacCompSP27(
+		para->getParD()->velocityX,
+		para->getParD()->velocityY,
+		para->getParD()->velocityZ,
+		para->getParD()->rho,
+		para->getParD()->pressure,
+		para->getParD()->typeOfGridNode,
+		para->getParD()->neighborX,
+		para->getParD()->neighborY,
+		para->getParD()->neighborZ,
+		para->getParD()->numberOfNodes,
+		para->getParD()->numberofthreads,
+		para->getParD()->distributions.f[0],
+		para->getParD()->isEvenTimestep);
+}
diff --git a/src/VirtualFluids_GPU/Init/InitLattice.h b/src/VirtualFluids_GPU/Init/InitLattice.h
new file mode 100644
index 0000000000000000000000000000000000000000..ba23d7bd4159524ac0a1eb3f5ecd0ee6ee504c38
--- /dev/null
+++ b/src/VirtualFluids_GPU/Init/InitLattice.h
@@ -0,0 +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 InitLattice.h
+//! \ingroup Init
+//! \author Martin Schoenherr
+//=======================================================================================
+#ifndef INIT_LATTICE_H
+#define INIT_LATTICE_H
+
+#include "Core/PointerDefinitions.h"
+
+//! \brief Class forwarding for Parameter
+class Parameter;
+
+//! \brief initialize the LBM lattice
+//! \param para instance of classParameter
+void initLattice(SPtr<Parameter> para);
+
+#endif
diff --git a/src/VirtualFluids_GPU/Init/package.include b/src/VirtualFluids_GPU/Init/package.include
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/src/VirtualFluids_GPU/LBM/D3Q27.h b/src/VirtualFluids_GPU/LBM/D3Q27.h
new file mode 100644
index 0000000000000000000000000000000000000000..ea2ad7f4e177ab653b0fb0be2438f43cc10b88e7
--- /dev/null
+++ b/src/VirtualFluids_GPU/LBM/D3Q27.h
@@ -0,0 +1,73 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 D3Q27.h
+//! \ingroup LBM
+//! \author Martin Schoenherr
+//=======================================================================================
+#ifndef _LB_D3Q27_H_
+#define _LB_D3Q27_H_
+
+//! \brief definitions of the 27 speeds (D3Q27)
+#define dirE    0
+#define dirW    1
+#define dirN    2
+#define dirS    3
+#define dirT    4
+#define dirB    5
+#define dirNE   6
+#define dirSW   7
+#define dirSE   8
+#define dirNW   9
+#define dirTE   10
+#define dirBW   11
+#define dirBE   12
+#define dirTW   13
+#define dirTN   14
+#define dirBS   15
+#define dirBN   16
+#define dirTS   17
+#define dirREST 18
+
+#define dirTNE  19
+#define dirBNE  20
+#define dirTSE  21
+#define dirBSE  22
+
+#define dirTNW  23
+#define dirBNW  24
+#define dirTSW  25
+#define dirBSW  26
+
+//! \brief definitions of start and end value (useful for loops)
+#define dirSTART  0
+#define dirEND   26
+
+#endif
+
+
diff --git a/src/VirtualFluids_GPU/LBM/LB.h b/src/VirtualFluids_GPU/LBM/LB.h
new file mode 100644
index 0000000000000000000000000000000000000000..cdbb5194f7c8b01ade613c28244648c87286a235
--- /dev/null
+++ b/src/VirtualFluids_GPU/LBM/LB.h
@@ -0,0 +1,62 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 LB.h
+//! \ingroup LBM
+//! \author Martin Schoenherr
+//=======================================================================================
+#ifndef _LB_H_
+#define _LB_H_
+
+//////////////////////////////////////////////////////////////////////////
+//! \brief define the node type "fluid node"
+#define GEO_FLUID 19
+
+//////////////////////////////////////////////////////////////////////////
+#include "Core/DataTypes.h"
+#include <string>
+#include <vector>
+
+//////////////////////////////////////////////////////////////////////////
+//! \struct to manage the distribution functions for D3Q27
+typedef struct Distri27{
+   real* f[27];
+} Distributions27;
+
+//////////////////////////////////////////////////////////////////////////
+//! \struct to manage sub-grid-distances (q) for second order Boundary Conditions (BCs)
+typedef struct QforBC{
+   int* k;
+   real* q27[27];
+   int kArray;
+   real *Vx, *Vy, *Vz;
+} QforBoundaryConditions;
+
+#endif
+
+
diff --git a/src/VirtualFluids_GPU/LBM/Simulation.cpp b/src/VirtualFluids_GPU/LBM/Simulation.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..df30169c979473ae31f3969e63d11c89d1847b0f
--- /dev/null
+++ b/src/VirtualFluids_GPU/LBM/Simulation.cpp
@@ -0,0 +1,226 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 Simulation.cpp
+//! \ingroup LBM
+//! \author Martin Schoenherr
+//=======================================================================================
+#include "Simulation.h"
+#include "LBM/LB.h"
+#include "Parameter/Parameter.h"
+#include "GPU/GPU_Interface.h"
+#include "GPU/devCheck.h"
+#include "GPU/CudaMemoryManager.h"	
+#include "Init/InitLattice.h"
+#include "DataStructureInitializer/GridProvider.h"
+#include "Output/DataWriter.h"
+
+#include "Core/Timer/Timer.h"
+
+#include <cuda_runtime.h>
+#include <helper_cuda.h>
+
+#include <stdio.h>
+#include <memory>
+//////////////////////////////////////////////////////////////////////////
+
+Simulation::Simulation()
+{}
+
+Simulation::~Simulation()
+{}
+
+void Simulation::init(SPtr<Parameter> para, SPtr<GridProvider> gridProvider, SPtr<DataWriter> dataWriter, SPtr<CudaMemoryManager> cudaManager)
+{
+	devCheck(0);
+
+	this->dataWriter = dataWriter;
+	this->gridProvider = gridProvider;
+	this->cudaManager = cudaManager;
+	this->para = para;
+	
+	para->initParameter();
+	para->setRe(para->getVelocityLB() * (real)1.0 / para->getViscosityLB());
+
+	gridProvider->allocAndCopyForcing();
+
+	//////////////////////////////////////////////////////////////////////////
+	// create and use log file
+	output.setName(para->getPathAndFilename() + ".log");
+	output.setConsoleOut(true);
+	output.clearLogFile();
+
+	output << "Re:         " << para->getRe()              << "\n";
+	output << "vis_ratio:  " << para->getViscosityRatio()  << "\n";
+	output << "u0_ratio:   " << para->getVelocityRatio()   << "\n";
+	output << "rho_ratio:  " << para->getDensityRatio()    << "\n";
+	output << "velocityLB: " << para->getVelocityLB()      << "\n";
+	output << "viscosityLB:" << para->getViscosityLB()     << "\n";
+
+	/////////////////////////////////////////////////////////////////////////
+	// set the used device memory to 0 before starting the calculation 
+	cudaManager->setMemsizeGPU(0, true);
+
+	//////////////////////////////////////////////////////////////////////////
+	// allocate the memory for several arrays 
+	gridProvider->allocArrays_CoordNeighborGeo();
+	gridProvider->allocArrays_BoundaryValues();
+	gridProvider->allocArrays_BoundaryQs();
+
+	//////////////////////////////////////////////////////////////////////////
+	// initialize the grid
+	output << "init lattice...";
+	initLattice(para);
+	output << "done.\n";
+
+	//////////////////////////////////////////////////////////////////////////
+	// print initialized grid
+	output << "Print files Init...";
+	dataWriter->writeInit(para, cudaManager);
+	output << "done.\n";
+
+	//////////////////////////////////////////////////////////////////////////
+	// print the amount of used device memory
+	output << "used device memory: " << cudaManager->getMemsizeGPU() / 1000000.0 << " MB\n";
+}
+
+void Simulation::run()
+{
+	uint t;
+	//////////////////////////////////////////////////////////////////////////
+	// Timer
+	auto timer = Timer::makeStart();
+	real timeComplete = 0.0;
+	// MNUPS(million node updates per second)
+	output << "Processing time (s) \t NUPS * 10^6\n";
+
+	////////////////////////////////////////////////////////////////////////////////
+	// Time loop
+	for (t = para->getTimestepStart(); t <= para->getTimestepEnd(); t++)
+	{
+		////////////////////////////////////////////////////////////////////////////////
+		// LBM Kernel
+		CumulantK17LBMDeviceKernel(
+			para->getParD()->numberofthreads,
+			para->getParD()->omega,
+			para->getParD()->typeOfGridNode,
+			para->getParD()->neighborX,
+			para->getParD()->neighborY,
+			para->getParD()->neighborZ,
+			para->getParD()->distributions.f[0],
+			para->getParD()->numberOfNodes,
+			para->getParD()->forcing,
+			para->getParD()->isEvenTimestep);
+
+		////////////////////////////////////////////////////////////////////////////////
+		//velocity boundary condition
+		QVelDevicePlainBB27(
+			para->getParD()->numberofthreads,
+			para->getParD()->inflowBC.Vx,
+			para->getParD()->inflowBC.Vy,
+			para->getParD()->inflowBC.Vz,
+			para->getParD()->distributions.f[0],
+			para->getParD()->inflowBC.k,
+			para->getParD()->inflowBC.q27[0],
+			para->getParD()->numberOfInflowBCnodes,
+			para->getParD()->inflowBC.kArray,
+			para->getParD()->neighborX,
+			para->getParD()->neighborY,
+			para->getParD()->neighborZ,
+			para->getParD()->numberOfNodes,
+			para->getParD()->isEvenTimestep);
+
+		////////////////////////////////////////////////////////////////////////////////
+		if (para->getParD()->isEvenTimestep)	para->getParD()->isEvenTimestep = false;
+		else									para->getParD()->isEvenTimestep = true;
+		////////////////////////////////////////////////////////////////////////////////
+		// File IO and calculation of MNUPS(million node updates per second)
+		if (para->getTimestepOut() > 0 && t%para->getTimestepOut() == 0 && t > para->getTimestepStartOut())
+		{
+			checkCudaErrors(cudaDeviceSynchronize());
+			//////////////////////////////////////////////////////////////////////////
+			// Timer
+			timer->end();
+			real timeInterval = timer->getTimeInSeconds();
+			timeComplete += timeInterval;
+			real fnups = ((real)(t - para->getTimestepStart()) * para->getParH()->numberOfNodes) / (timeComplete*1.0E6);
+			output << timeInterval << " / " << timeComplete << " \t " << fnups << "\n";
+			//////////////////////////////////////////////////////////////////////////
+			//IO
+			if (para->getPrintFiles())
+			{
+				output << "File IO for t=" << t << "...";
+				////////////////////////////////////////////////////////////////////////////////
+				CalcMacCompSP27(
+					para->getParD()->velocityX,
+					para->getParD()->velocityY,
+					para->getParD()->velocityZ,
+					para->getParD()->rho,
+					para->getParD()->pressure,
+					para->getParD()->typeOfGridNode,
+					para->getParD()->neighborX,
+					para->getParD()->neighborY,
+					para->getParD()->neighborZ,
+					para->getParD()->numberOfNodes,
+					para->getParD()->numberofthreads,
+					para->getParD()->distributions.f[0],
+					para->getParD()->isEvenTimestep);
+				////////////////////////////////////////////////////////////////////////
+				cudaManager->cudaCopyDataToHost();
+				////////////////////////////////////////////////////////////////////////
+				dataWriter->writeTimestep(para, t);
+				////////////////////////////////////////////////////////////////////////
+				output << "done.\n";
+			}
+			timer->start();
+		}
+	}
+
+	//////////////////////////////////////////////////////////////////////////
+	// Timer
+	timer->end();
+	real timeInterval = timer->getTimeInSeconds();
+	timeComplete += timeInterval;
+	real fnups = ((real)(t - para->getTimestepStart()) * para->getParH()->numberOfNodes) / (timeComplete*1.0E6);
+	output << "Processing time: " << timeComplete << "(ms)\n";
+	output << "NUPS: " << fnups << " * 10^6\n";
+}
+
+void Simulation::free()
+{
+	//CudaFreeHostMemory
+	cudaManager->cudaFreeCoord();
+	cudaManager->cudaFreeSP();
+	cudaManager->cudaFreeNeighborWSB();
+	cudaManager->cudaFreeVeloBC();
+	cudaManager->cudaFreeForcing();
+
+	para->~Parameter();
+	gridProvider->~GridProvider();
+	dataWriter->~DataWriter();
+}
\ No newline at end of file
diff --git a/src/VirtualFluids_GPU/LBM/Simulation.h b/src/VirtualFluids_GPU/LBM/Simulation.h
new file mode 100644
index 0000000000000000000000000000000000000000..e526a5a5040c387bab54855ddeef13ade9891aac
--- /dev/null
+++ b/src/VirtualFluids_GPU/LBM/Simulation.h
@@ -0,0 +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 Simulation.h
+//! \ingroup LBM
+//! \author Martin Schoenherr
+//=======================================================================================
+#ifndef _SIMULATION_H_
+#define _SIMULATION_H_
+
+#include <Core/PointerDefinitions.h>
+#include <VirtualFluidsDefinitions.h>
+#include "Output/LogWriter.hpp"
+
+//! \brief Class forwarding for CudaMemoryManager, Parameter, GridProvider and DataWriter
+class CudaMemoryManager;
+class Parameter;
+class GridProvider;
+class DataWriter;
+
+//! \class Simulation
+//! \brief manages the preprocessing, simulations and post-processing
+class VF_PUBLIC Simulation
+{
+public:
+	//! Class default constructor
+	Simulation();
+	//! Class destructor
+	~Simulation();
+	//! \brief includes the time loop over all LB-timesteps 
+	void run();
+	//! \brief initialize the lattice (incl. distribution functions)
+	void init(SPtr<Parameter> para, SPtr<GridProvider> gridProvider, SPtr<DataWriter> dataWriter, SPtr<CudaMemoryManager> cudaManager);
+	//! \brief frees the pinned host memory
+	void free();
+
+protected:
+	//! \property output is an object of LogWriter
+	LogWriter output;
+
+	//! \brief shared pointer to parameter, gridProvider, dataWriter and cudaManager objects
+	//! \property para is a shared pointer to an object of Parameter
+	SPtr<Parameter> para;
+	//! \property gridProvider is a shared pointer to an object of GridProvider
+	SPtr<GridProvider> gridProvider;
+	//! \property dataWriter is a shared pointer to an object of DataWriter
+	SPtr<DataWriter> dataWriter;
+	//! \property cudaManager is a shared pointer to an object of CudaMemoryManager
+	SPtr<CudaMemoryManager> cudaManager;
+ };
+#endif
diff --git a/src/VirtualFluids_GPU/LBM/package.include b/src/VirtualFluids_GPU/LBM/package.include
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/src/VirtualFluids_GPU/Output/DataWriter.h b/src/VirtualFluids_GPU/Output/DataWriter.h
new file mode 100644
index 0000000000000000000000000000000000000000..764de0952e564f3e89e6a40cf3d1cbdeff464d34
--- /dev/null
+++ b/src/VirtualFluids_GPU/Output/DataWriter.h
@@ -0,0 +1,62 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 DataWriter.h
+//! \ingroup Output
+//! \author Martin Schoenherr
+//=======================================================================================
+#ifndef DATA_WRITER_H
+#define DATA_WRITER_H
+
+#include "Core/PointerDefinitions.h"
+#include "Core/DataTypes.h"
+
+//! \brief Class forwarding for CudaMemoryManager and Parameter
+class Parameter;
+class CudaMemoryManager;
+
+//! \class FileWriter
+//! \brief manages the VTK output
+class DataWriter
+{
+public:
+	//! Class default constructor
+	VF_PUBLIC DataWriter() {}
+	//! Class destructor
+	virtual VF_PUBLIC ~DataWriter() {}
+
+	//! \brief write the initialization step to VTK file(s)
+	//! \param para instance of classParameter
+	//! \param cudaManager instance of class CudaMemoryManager
+	virtual void VF_PUBLIC writeInit(SPtr<Parameter> para, SPtr<CudaMemoryManager> cudaManager) = 0;
+	//! \brief write time step to VTK file(s)
+	//! \param para instance of classParameter
+	//! \param timestep of the simulation
+	virtual void VF_PUBLIC writeTimestep(SPtr<Parameter> para, uint timestep) = 0;
+};
+#endif
diff --git a/src/VirtualFluids_GPU/Output/FileWriter.cpp b/src/VirtualFluids_GPU/Output/FileWriter.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..e83f886e06544f74db1d8d23b0648de30637e644
--- /dev/null
+++ b/src/VirtualFluids_GPU/Output/FileWriter.cpp
@@ -0,0 +1,178 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 FileWriter.cpp
+//! \ingroup Output
+//! \author Martin Schoenherr
+//=======================================================================================
+#include "FileWriter.h"
+#include "GPU/CudaMemoryManager.h"
+#include "Parameter/Parameter.h"
+#include "VirtualFluidsBasics/basics/writer/WbWriterVtkXmlBinary.h"
+
+void FileWriter::writeInit(SPtr<Parameter> para, SPtr<CudaMemoryManager> cudaManager)
+{
+    uint timestep = 0;
+	uint level = 0;
+	cudaManager->cudaCopyDataToHost();
+	writeTimestep(para, timestep);
+}
+
+void FileWriter::writeTimestep(SPtr<Parameter> para, uint timestep)
+{
+	const unsigned int numberOfParts = para->getParH()->numberOfNodes / para->getlimitOfNodesForVTK() + 1;
+	std::vector<std::string> fname;
+
+	std::ostringstream strTimestep;
+	strTimestep << timestep;
+
+	for (unsigned int i = 1; i <= numberOfParts; i++)
+	{
+		std::ostringstream strPart;
+		strPart << i;
+		fname.push_back(para->getPathAndFilename() + "_bin_Part_" + strPart.str() + "_t_" + strTimestep.str() + ".vtk");
+	}
+	writeUnstrucuredGridLT(para, fname);
+}
+
+bool FileWriter::isPeriodicCell(SPtr<Parameter> para, uint number2, uint number1, uint number3, uint number5)
+{
+	return (para->getParH()->coordinateX[number2] < para->getParH()->coordinateX[number1]) ||
+		   (para->getParH()->coordinateY[number3] < para->getParH()->coordinateY[number1]) ||
+		   (para->getParH()->coordinateZ[number5] < para->getParH()->coordinateZ[number1]);
+}
+
+void FileWriter::writeUnstrucuredGridLT(SPtr<Parameter> para, std::vector<std::string >& fname)
+{
+    std::vector< UbTupleFloat3 > nodes;
+    std::vector< UbTupleInt8 > cells;
+    std::vector< std::string > nodedatanames;
+    nodedatanames.push_back("Press");
+    nodedatanames.push_back("DRho");
+    nodedatanames.push_back("Vx");
+    nodedatanames.push_back("Vy");
+    nodedatanames.push_back("Vz");
+    nodedatanames.push_back("Geometry");
+    unsigned int number1, number2, number3, number4, number5, number6, number7, number8;
+    int dn1, dn2, dn3, dn4, dn5, dn6, dn7, dn8;
+    bool neighborsAreFluid;
+    double vxmax = 0;
+    unsigned int startpos = 0;
+    unsigned int endpos = 0;
+    unsigned int sizeOfNodes = 0;
+    std::vector< std::vector< double > > nodedata(nodedatanames.size());
+
+    for (unsigned int part = 0; part < fname.size(); part++)
+    {
+        if (((part + 1)*para->getlimitOfNodesForVTK()) > para->getParH()->numberOfNodes)
+            sizeOfNodes = para->getParH()->numberOfNodes - (part * para->getlimitOfNodesForVTK());
+        else
+            sizeOfNodes = para->getlimitOfNodesForVTK();
+
+        //////////////////////////////////////////////////////////////////////////
+        startpos = part * para->getlimitOfNodesForVTK();
+        endpos = startpos + sizeOfNodes;
+        //////////////////////////////////////////////////////////////////////////
+        cells.clear();
+        nodes.resize(sizeOfNodes);
+        nodedata[0].resize(sizeOfNodes);
+        nodedata[1].resize(sizeOfNodes);
+        nodedata[2].resize(sizeOfNodes);
+        nodedata[3].resize(sizeOfNodes);
+        nodedata[4].resize(sizeOfNodes);
+        nodedata[5].resize(sizeOfNodes);
+        //////////////////////////////////////////////////////////////////////////
+        for (unsigned int pos = startpos; pos < endpos; pos++)
+        {
+            if (para->getParH()->typeOfGridNode[pos] == GEO_FLUID)
+            {
+                //////////////////////////////////////////////////////////////////////////
+                double x1 = para->getParH()->coordinateX[pos];
+                double x2 = para->getParH()->coordinateY[pos];
+                double x3 = para->getParH()->coordinateZ[pos];
+                //////////////////////////////////////////////////////////////////////////
+                number1 = pos;
+                dn1 = pos - startpos;
+                neighborsAreFluid = true;
+                //////////////////////////////////////////////////////////////////////////
+                nodes[dn1] = (makeUbTuple((float)(x1), (float)(x2), (float)(x3)));
+                nodedata[0][dn1] = (double)para->getParH()->pressure[pos] / (double)3.0 * (double)para->getDensityRatio() * (double)para->getVelocityRatio() * (double)para->getVelocityRatio();
+                nodedata[1][dn1] = (double)para->getParH()->rho[pos] * (double)para->getDensityRatio();
+                nodedata[2][dn1] = (double)para->getParH()->velocityX[pos] * (double)para->getVelocityRatio();
+                nodedata[3][dn1] = (double)para->getParH()->velocityY[pos] * (double)para->getVelocityRatio();
+                nodedata[4][dn1] = (double)para->getParH()->velocityZ[pos] * (double)para->getVelocityRatio();
+                nodedata[5][dn1] = (double)para->getParH()->typeOfGridNode[pos];
+                //////////////////////////////////////////////////////////////////////////
+                number2 = para->getParH()->neighborX[number1];
+                number3 = para->getParH()->neighborY[number2];
+                number4 = para->getParH()->neighborY[number1];
+                number5 = para->getParH()->neighborZ[number1];
+                number6 = para->getParH()->neighborZ[number2];
+                number7 = para->getParH()->neighborZ[number3];
+                number8 = para->getParH()->neighborZ[number4];
+                //////////////////////////////////////////////////////////////////////////
+                if (para->getParH()->typeOfGridNode[number2] != GEO_FLUID ||
+                    para->getParH()->typeOfGridNode[number3] != GEO_FLUID ||
+                    para->getParH()->typeOfGridNode[number4] != GEO_FLUID ||
+                    para->getParH()->typeOfGridNode[number5] != GEO_FLUID ||
+                    para->getParH()->typeOfGridNode[number6] != GEO_FLUID ||
+                    para->getParH()->typeOfGridNode[number7] != GEO_FLUID ||
+                    para->getParH()->typeOfGridNode[number8] != GEO_FLUID)  neighborsAreFluid = false;
+                //////////////////////////////////////////////////////////////////////////
+                if (number2 > endpos ||
+                    number3 > endpos ||
+                    number4 > endpos ||
+                    number5 > endpos ||
+                    number6 > endpos ||
+                    number7 > endpos ||
+                    number8 > endpos)  neighborsAreFluid = false;
+                //////////////////////////////////////////////////////////////////////////
+                dn2 = number2 - startpos;
+                dn3 = number3 - startpos;
+                dn4 = number4 - startpos;
+                dn5 = number5 - startpos;
+                dn6 = number6 - startpos;
+                dn7 = number7 - startpos;
+                dn8 = number8 - startpos;
+				//////////////////////////////////////////////////////////////////////////
+				if (isPeriodicCell(para, number2, number1, number3, number5))
+					continue;
+				//////////////////////////////////////////////////////////////////////////
+                if (neighborsAreFluid)
+                    cells.push_back(makeUbTuple(dn1, dn2, dn3, dn4, dn5, dn6, dn7, dn8));
+            }
+        }
+        WbWriterVtkXmlBinary::getInstance()->writeOctsWithNodeData(fname[part], nodes, cells, nodedatanames, nodedata);
+    }
+}
+
+
+
+
+
+
diff --git a/src/VirtualFluids_GPU/Output/FileWriter.h b/src/VirtualFluids_GPU/Output/FileWriter.h
new file mode 100644
index 0000000000000000000000000000000000000000..6576a087745746da29682bfff3aa1391cfb08928
--- /dev/null
+++ b/src/VirtualFluids_GPU/Output/FileWriter.h
@@ -0,0 +1,74 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 FileWriter.h
+//! \ingroup Output
+//! \author Martin Schoenherr
+//=======================================================================================
+#ifndef FILE_WRITER_H
+#define FILE_WRITER_H
+
+#include <vector>
+#include <string>
+
+#include "DataWriter.h"
+
+//! \brief Class forwarding for CudaMemoryManager and Parameter
+class Parameter;
+class CudaMemoryManager;
+
+//! \class FileWriter derived class of DataWriter
+//! \brief manages the VTK output
+class FileWriter : public DataWriter
+{
+public:
+	//! Class default constructor
+	VF_PUBLIC FileWriter() {}
+	//! Class destructor
+	VF_PUBLIC ~FileWriter() {}
+
+	//! \brief write the initialization step to VTK file(s)
+	//! \param para instance of classParameter
+	//! \param cudaManager instance of class CudaMemoryManager
+	void VF_PUBLIC writeInit(SPtr<Parameter> para, SPtr<CudaMemoryManager> cudaManager) override;
+	//! \brief write time step to VTK file(s)
+	//! \param para instance of classParameter
+	//! \param timestep of the simulation
+	void VF_PUBLIC writeTimestep(SPtr<Parameter> para, uint timestep) override;
+
+private:
+	//! \brief write binary VTK file as unstructured grid
+	//! \param para instance of classParameter
+	//! \param fname vector of strings with path and prefix of written files
+	void VF_PUBLIC writeUnstrucuredGridLT(SPtr<Parameter> para, std::vector<std::string >& fname);
+	//! \brief checks for periodic cells
+	//! \param para instance of classParameter
+	//! \param number 2, 1, 3 and 5 are the possible periodic neighbors
+	bool VF_PUBLIC isPeriodicCell(SPtr<Parameter> para, uint number2, uint number1, uint number3, uint number5);
+};
+#endif
\ No newline at end of file
diff --git a/src/VirtualFluids_GPU/Output/LogWriter.hpp b/src/VirtualFluids_GPU/Output/LogWriter.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..150cb220eddfd30f358599a3c745dccb173b5e6a
--- /dev/null
+++ b/src/VirtualFluids_GPU/Output/LogWriter.hpp
@@ -0,0 +1,105 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 LogWriter.hpp
+//! \ingroup Output
+//! \author Martin Schoenherr
+//=======================================================================================
+#ifndef LOGWRITER_H
+#define LOGWRITER_H
+
+#include <iostream>
+#include <fstream>
+
+////////////////////////////////////////////////////////////////////////////////
+//! \class LogWriter manages the generation and output of log files
+class LogWriter
+{
+public:
+	//! Class default constructor
+   LogWriter()
+   {  
+      consoleOut = false;
+   }
+   //! Class 2nd constructor
+   //! \param string with path an filename
+   LogWriter(std::string fname)
+   {
+      consoleOut = false;
+      this->fname = fname;
+   }
+   //! \brief sets the path and filename for the log file
+   //! \param string with path an filename
+   void setName(std::string fname)
+   {
+      this->fname = fname;
+   }
+   //! \brief sets the status, if the logging information should be displayed on the console
+   //! \param flag is an boolean
+   void setConsoleOut(bool flag)
+   {
+      consoleOut = flag;
+   }
+   //! \brief clear the log file
+   void clearLogFile()
+   {
+      ostr.open(fname.c_str(), std::ios_base::out);
+      if (ostr.bad())
+      {
+         std::string exceptionText = "Error: Output file/directory not found! LogWriter::operator << \n";
+         throw exceptionText;
+      }
+      ostr << "";
+      ostr.close();
+   }
+   //! \brief operator overloading for operator "<<"
+   template <typename T>
+   LogWriter&  operator << (const T& arg)
+   {
+      ostr.open(fname.c_str(), std::ios_base::app);
+      if (ostr.bad())
+      {
+         std::string exceptionText = "Error: Output file/directory not found! LogWriter::operator << \n";
+         throw exceptionText;
+      }
+      ostr << arg;
+      ostr.close();
+      if(consoleOut) std::cout << arg << std::flush;
+      return *this;
+   }
+protected:
+private:
+   //! \property fname holds a string with the path and filename for the log file
+   std::string fname;
+   //! \property ostr is the output stream
+   std::ofstream ostr;
+   //! \property consoleOut holds the information if the output should be displayed on the console
+   bool consoleOut;
+};
+
+#endif	
diff --git a/src/VirtualFluids_GPU/Output/package.include b/src/VirtualFluids_GPU/Output/package.include
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/src/VirtualFluids_GPU/Parameter/Parameter.cpp b/src/VirtualFluids_GPU/Parameter/Parameter.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..9601503c20a38cf119fbf5d282f8c6e093fa7b58
--- /dev/null
+++ b/src/VirtualFluids_GPU/Parameter/Parameter.cpp
@@ -0,0 +1,278 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 Parameter.cpp
+//! \ingroup Parameter
+//! \author Martin Schoenherr
+//=======================================================================================
+#include "Parameter.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+
+SPtr<Parameter> Parameter::make()
+{
+    return SPtr<Parameter>(new Parameter());
+}
+
+Parameter::Parameter()
+{
+	this->setOutputPath("C:/Output/");
+
+	this->setOutputPrefix("MyFile");
+
+	this->setPrintFiles(false);
+
+	this->setD3Qxx((int)27);
+
+	this->setTimestepEnd((uint)10);
+
+	this->setTimestepOut((uint)1);
+
+	this->setTimestepStartOut((uint)0);
+
+	this->setViscosityLB((real)0.001);
+
+	this->setVelocityLB((real)0.01);
+
+	this->setViscosityRatio((real)1.0);
+
+	this->setVelocityRatio((real)1.0);
+
+	this->setDensityRatio((real)1.0);
+
+	this->setPressureRatio((real)1.0);
+
+	this->setPathAndFilename(this->getOutputPath() + "/" + this->getOutputPrefix());
+
+	this->setlimitOfNodesForVTK((uint)30000000);
+}
+Parameter::~Parameter()
+{
+}
+Parameter* Parameter::instance = 0;
+Parameter* Parameter::getInstanz()
+{
+	if( instance == 0 )
+		instance = new Parameter();
+	return instance;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+//init-method
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+void Parameter::initParameter()
+{
+	//host
+	parametersOnHost                          = new ParameterStruct;
+	parametersOnHost->numberofthreads         = 64;
+	parametersOnHost->omega                   = (real)1.0/((real)3.0*this->viscosityLB+(real)0.5);
+	parametersOnHost->isEvenTimestep          = true;
+
+	//device
+	parametersOnDevice                        = new ParameterStruct;
+	parametersOnDevice->numberofthreads       = parametersOnHost->numberofthreads;
+	parametersOnDevice->omega                 = parametersOnHost->omega;
+	parametersOnDevice->isEvenTimestep        = parametersOnHost->isEvenTimestep;
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+//set-methods
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+void Parameter::setlimitOfNodesForVTK(uint limitOfNodesForVTK)
+{
+	this->limitOfNodesForVTK = limitOfNodesForVTK;
+}
+void Parameter::setD3Qxx(int d3qxx)
+{
+	this->D3Qxx = d3qxx;
+}
+void Parameter::setTimestepEnd(uint timestepEnd)
+{
+	this->timestepEnd = timestepEnd;
+}
+void Parameter::setTimestepOut(uint timestepOut)
+{
+	this->timestepOut = timestepOut;
+}
+void Parameter::setTimestepStartOut(uint timestepStartOut)
+{
+	this->timestepStartOut = timestepStartOut;
+}
+void Parameter::setOutputPath(std::string outputPath)
+{
+	this->outputPath = outputPath;
+}
+void Parameter::setOutputPrefix(std::string outputPrefix)
+{
+	this->outputPrefix = outputPrefix;
+}
+void Parameter::setPathAndFilename(std::string pathAndFilename)
+{
+	this->pathAndFilename = pathAndFilename;
+}
+void Parameter::setPrintFiles(bool printfiles)
+{
+	this->printFiles = printfiles;
+}
+void Parameter::setViscosityLB(real viscosity)
+{
+	this->viscosityLB = viscosity;
+}
+void Parameter::setVelocityLB(real velocity)
+{
+	this->velocityLB = velocity;
+}
+void Parameter::setViscosityRatio(real viscosityRatio)
+{
+	this->viscosityRatio = viscosityRatio;
+}
+void Parameter::setVelocityRatio(real velocityRatio)
+{
+	this->velocityRatio = velocityRatio;
+}
+void Parameter::setDensityRatio(real densityRatio)
+{
+	this->densityRatio = densityRatio;
+}
+void Parameter::setPressureRatio(real pressureRatio)
+{
+	this->pressRatio = pressureRatio;
+}
+void Parameter::setRe(real Re)
+{
+	this->Re = Re;
+}
+void Parameter::setMemsizeGPU(double addMemory, bool reset)
+{
+	if (reset == true)
+	{
+		this->memsizeGPU = 0.;
+	} 
+	else
+	{
+		this->memsizeGPU += addMemory;
+	}
+}
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+//get-methods
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+uint Parameter::getlimitOfNodesForVTK()
+{
+	return this->limitOfNodesForVTK;
+}
+ParameterStruct* Parameter::getParD()
+{
+	return this->parametersOnDevice;
+}
+ParameterStruct* Parameter::getParH()
+{
+	return this->parametersOnHost;
+}
+bool Parameter::getIsTimestepEven()
+{
+	return this->parametersOnHost->isEvenTimestep;
+}
+int Parameter::getD3Qxx()
+{
+	return this->D3Qxx;
+}
+uint Parameter::getTimestepStart()
+{
+	return 1;
+}
+uint Parameter::getTimestepEnd()
+{
+	return this->timestepEnd;
+}
+uint Parameter::getTimestepOut()
+{
+	return this->timestepOut;
+}
+uint Parameter::getTimestepStartOut()
+{
+	return this->timestepStartOut;
+}
+std::string Parameter::getOutputPath()
+{
+	return this->outputPath;
+}
+std::string Parameter::getOutputPrefix()
+{
+	return this->outputPrefix;
+}
+std::string Parameter::getPathAndFilename()
+{
+	return this->pathAndFilename;
+}
+bool Parameter::getPrintFiles()
+{
+	return this->printFiles;
+}
+real Parameter::getViscosityLB()
+{
+	return this->viscosityLB;
+}
+real Parameter::getVelocityLB()
+{
+	return this->velocityLB;
+}
+real Parameter::getViscosityRatio()
+{
+	return this->viscosityRatio;
+}
+real Parameter::getVelocityRatio()
+{
+	return this->velocityRatio;
+}
+real Parameter::getDensityRatio()
+{
+	return this->densityRatio;
+}
+real Parameter::getPressureRatio()
+{
+	return this->pressRatio;
+}
+real Parameter::getRe()
+{
+	return this->Re;
+}
+double Parameter::getMemsizeGPU()
+{
+	return this->memsizeGPU;
+}
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+
+
diff --git a/src/VirtualFluids_GPU/Parameter/Parameter.h b/src/VirtualFluids_GPU/Parameter/Parameter.h
new file mode 100644
index 0000000000000000000000000000000000000000..8014a66ea1076d6d27451f284b1b4b246d6e5901
--- /dev/null
+++ b/src/VirtualFluids_GPU/Parameter/Parameter.h
@@ -0,0 +1,244 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 Parameter.h
+//! \ingroup Parameter
+//! \author Martin Schoenherr
+//=======================================================================================
+#ifndef PARAMETER_H
+#define PARAMETER_H
+
+#include "LBM/LB.h"
+#include "Core/PointerDefinitions.h"
+#include "VirtualFluidsDefinitions.h"
+
+//! \struct ParameterStruct
+//! \brief struct holds and manages the LB-parameter of the simulation
+//! \brief For this purpose it holds structures and pointer for host and device data, respectively.
+struct ParameterStruct{
+	//////////////////////////////////////////////////////////////////////////
+	//! \brief decides if the simulation timestep is even or odd
+	//! \brief this information is important for the esoteric twist
+	bool isEvenTimestep;
+	//////////////////////////////////////////////////////////////////////////
+	//! \brief stores the number of threads per GPU block
+	uint numberofthreads;
+	//////////////////////////////////////////////////////////////////////////
+	//! \brief store all distribution functions for the D3Q27
+	Distributions27 distributions;
+	//////////////////////////////////////////////////////////////////////////
+	//! \brief stores the type for every lattice node (f.e. fluid node)
+	uint *typeOfGridNode;
+	//////////////////////////////////////////////////////////////////////////
+	//! \brief store the neighbors in +X, +Y, +Z, and in diagonal negative direction
+	//! \brief this information is important because we use an indirect addressing scheme
+	uint *neighborX, *neighborY, *neighborZ, *neighborInverse;
+	//////////////////////////////////////////////////////////////////////////
+	//! \brief store the coordinates for every lattice node 
+	real *coordinateX, *coordinateY, *coordinateZ;
+	//////////////////////////////////////////////////////////////////////////
+	//! \brief store the macroscopic values (velocity, density, pressure)
+	//! \brief for every lattice node
+	real *velocityX, *velocityY, *velocityZ, *rho, *pressure;
+	//! \brief stores the value for omega
+	real omega;
+	//////////////////////////////////////////////////////////////////////////
+	//! \brief stores the number of nodes (based on indirect addressing scheme)
+	uint numberOfNodes;
+	//! \brief stores the size of the memory consumption for real/int values of the above arrays
+	uint mem_size_real, mem_size_int;
+	//////////////////////////////////////////////////////////////////////////
+	//! \brief stores the velocity boundary condition data
+	QforBoundaryConditions inflowBC;
+	//! \brief number of lattice nodes for the velocity boundary condition
+	uint numberOfInflowBCnodes;
+	//////////////////////////////////////////////////////////////////////////
+	//! \brief sets the forcing uniform on every fluid node in all three space dimensions 
+	real *forcing;
+};
+
+//! \class Parameter implements the singleton design pattern.
+//! \brief Class for LBM-parameter management
+class VF_PUBLIC Parameter
+{
+public:
+	////////////////////////////////////////////////////////////////////////////
+	//! \brief generate a new instance of parameter object
+	static SPtr<Parameter> make();
+	//! \brief returns the instance generate a new instance of parameter object
+	static Parameter* getInstanz();
+	//! \brief Pointer to instance of ParameterStruct - stored on Host System
+	ParameterStruct* getParH();
+	//! \brief Pointer to instance of ParameterStruct - stored on Device (GPU)
+	ParameterStruct* getParD();
+
+	//////////////////////////////////////////////////////////////////////////
+	//! \brief initialization of necessary parameters at startup
+	void initParameter();
+
+	//////////////////////////////////////////////////////////////////////////
+	//set methods
+	//////////////////////////////////////////////////////////////////////////
+	//! \brief sets the limit of nodes, that can be written to a binary unstructured grid VTK file  
+	//! \param limitOfNodesForVTK holds the maximum number of nodes
+	void setlimitOfNodesForVTK(uint limitOfNodesForVTK);
+	//! \brief sets the LBM stencil
+	//! \param d3qxx holds the number of neighbors (f.e. 27)
+	void setD3Qxx(int d3qxx);
+	//! \brief sets timestep to stop the simulation
+	//! \param timestepEnd holds the last timestep of the simulation
+	void setTimestepEnd(uint timestepEnd);
+	//! \brief sets time interval to write output files
+	//! \param timestepOut holds the value for the output interval
+	void setTimestepOut(uint timestepOut);
+	//! \brief sets first timestep to write output files
+	//! \param timestepStartOut holds the value for the first output timestep
+	void setTimestepStartOut(uint timestepStartOut);
+	//! \brief sets the path, where the vtk-files are stored 
+	//! \param string "oPath" represents the output path
+	void setOutputPath(std::string outputPath);
+	//! \brief sets the prefix of the vtk-files name 
+	//! \param string "oPrefix" represents the file-name-prefix
+	void setOutputPrefix(std::string outputPrefix);
+	//! \brief sets the complete string for the vtk-files with results 
+	//! \param string "fname" represents the combination of path and prefix
+	void setPathAndFilename(std::string pathAndFilename);
+	//! \brief sets the status, if the vtk files should be printed
+	//! \param if printfiles is true, the vtk files will be printed 
+	void setPrintFiles(bool printfiles);
+	//! \brief sets the viscosity in LB units
+	//! \param viscosity in LB units 
+	void setViscosityLB(real viscosity);
+	//! \brief sets the velocity in LB units
+	//! \param velocity in LB units 
+	void setVelocityLB(real velocity);
+	//! \brief sets the viscosity ratio between SI and LB units
+	//! \param viscosityRatio SI/LB units 
+	void setViscosityRatio(real viscosityRatio);
+	//! \brief sets the velocity ratio between SI and LB units
+	//! \param velocityRatio SI/LB units 
+	void setVelocityRatio(real velocityRatio);
+	//! \brief sets the density ratio between SI and LB units
+	//! \param densityRatio SI/LB units 
+	void setDensityRatio(real densityRatio);
+	//! \brief sets the pressure ratio between SI and LB units
+	//! \param pressureRatio SI/LB units 
+	void setPressureRatio(real pressureRatio);
+	//! \brief sets the Reynolds number (Re) for the simulation
+	//! \param Reynolds number (Re) 
+	void setRe(real Re);
+	//! \brief sets the necessary memory on the device(s)/GPU(s)
+	//! \param addMemory is the amount of additional memory 
+	//! \param reset decides if the value for overall GPU memory should be set to zero 
+	void setMemsizeGPU(double addMemory, bool reset);
+
+	//////////////////////////////////////////////////////////////////////////
+	//get methods
+	//////////////////////////////////////////////////////////////////////////
+	//! \brief return the limit of nodes, that can be written to a binary unstructured grid VTK file  
+	uint getlimitOfNodesForVTK();
+	//! \brief return if the timestep is even or odd
+	bool getIsTimestepEven();
+	//! \brief return if the simulation should write VTK files
+	bool getPrintFiles();
+	//! \brief return the number of neighbors of a lattice node (stencil)
+	int getD3Qxx();
+	//! \brief return the output path
+	std::string getOutputPath();
+	//! \brief return the prefix of the output files
+	std::string getOutputPrefix();
+	//! \brief return the combination of output path and prefix
+	std::string getPathAndFilename();
+	//! \brief return the timestep to start the simulation (in this code version = 1)
+	uint getTimestepStart();
+	//! \brief return the timestep to end the simulation
+	uint getTimestepEnd();
+	//! \brief return the time interval to write output files
+	uint getTimestepOut();
+	//! \brief return the timestep to start writing output files
+	uint getTimestepStartOut();
+	//! \brief return the viscosity in LB units
+	real getViscosityLB();
+	//! \brief return the velocity in LB units
+	real getVelocityLB();
+	//! \brief return the viscosity ratio in SI/LB units
+	real getViscosityRatio();
+	//! \brief return the velocity ratio in SI/LB units
+	real getVelocityRatio();
+	//! \brief return the density ratio in SI/LB units
+	real getDensityRatio();
+	//! \brief return the pressure ratio in SI/LB units
+	real getPressureRatio();
+	//! \brief return the Reynolds number
+	real getRe();
+	//! \brief return the used device memory
+	double getMemsizeGPU();
+
+	//////////////////////////////////////////////////////////////////////////
+	//! Class destructor
+	~Parameter();
+protected:
+private:
+	//! \brief instance of parameter object 
+	static Parameter* instance;
+	//! \brief stencil for the LB simulation, number of node neighbors
+	int D3Qxx;
+	//! \brief limit of nodes, that can be written to a binary unstructured grid VTK file  
+	uint limitOfNodesForVTK;
+	//! \brief last timestep of the simulation
+	uint timestepEnd;
+	//! \brief time interval to write output files
+	uint timestepOut;
+	//! \brief timestep - start writing output files
+	uint timestepStartOut;
+	//! \brief Reynolds number
+	real Re;
+	//! \brief viscosity and velocity in LB units
+	real viscosityLB, velocityLB;
+	//! \brief ratio SI units / LB units for viscosity, velocity, density and pressure
+	real viscosityRatio, velocityRatio;
+	real densityRatio, pressRatio;
+	//! \brief used device memory
+	double memsizeGPU;
+	//! \brief write output files on/off
+	bool printFiles;
+	//! \brief strings to store output path, prefix and combination of both
+	std::string pathAndFilename, outputPath, outputPrefix;
+
+	//! \brief pointer to LB-parameter struct on host system
+	ParameterStruct* parametersOnHost;
+	//! \brief pointer to LB-parameter struct on device/GPU
+	ParameterStruct* parametersOnDevice;
+
+	//! Class default constructor
+	Parameter();
+	//Parameter(const Parameter&);
+};
+
+#endif
+
diff --git a/src/VirtualFluids_GPU/Parameter/package.include b/src/VirtualFluids_GPU/Parameter/package.include
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/targets/apps/LidDrivenCavity/3rdPartyLinking.cmake b/targets/apps/LidDrivenCavity/3rdPartyLinking.cmake
new file mode 100644
index 0000000000000000000000000000000000000000..7898b5083e7de0f9e4bd3798732e402d75f5adef
--- /dev/null
+++ b/targets/apps/LidDrivenCavity/3rdPartyLinking.cmake
@@ -0,0 +1,2 @@
+include (${CMAKE_SOURCE_DIR}/${cmakeMacroPath}/Cuda/Link.cmake)
+linkCuda(${targetName})
diff --git a/targets/apps/LidDrivenCavity/CMakeLists.txt b/targets/apps/LidDrivenCavity/CMakeLists.txt
new file mode 100644
index 0000000000000000000000000000000000000000..d4dd23daa10747023d53083798ca178c09d93cf8
--- /dev/null
+++ b/targets/apps/LidDrivenCavity/CMakeLists.txt
@@ -0,0 +1,20 @@
+setTargetNameToFolderName(${CMAKE_CURRENT_LIST_DIR}) 
+
+set(linkDirectories "")
+set(libsToLink Core VirtualFluids_GPU GridGenerator GksMeshAdapter GksGpu)
+set(includeDirectories "${CMAKE_SOURCE_DIR}/src"
+                       "${CMAKE_SOURCE_DIR}/src/Core"
+                       "${CMAKE_SOURCE_DIR}/src/VirtualFluids_GPU" 
+                       "${CMAKE_SOURCE_DIR}/src/GridGenerator" 
+                       "${CMAKE_SOURCE_DIR}/src/VirtualFluidsBasics"
+                       "${CMAKE_SOURCE_DIR}/src/GksMeshAdapter"
+                       "${CMAKE_SOURCE_DIR}/src/GksGpu")
+
+#glob files and save in MY_SRCS
+include(CMakePackage.cmake)
+
+buildExe(${targetName} "${MY_SRCS}" "${linkDirectories}" "${libsToLink}" "${includeDirectories}")
+groupTarget(${targetName} ${appFolder})
+
+# Specify the linking to 3rdParty libs
+include(3rdPartyLinking.cmake)
\ No newline at end of file
diff --git a/targets/apps/LidDrivenCavity/CMakePackage.cmake b/targets/apps/LidDrivenCavity/CMakePackage.cmake
new file mode 100644
index 0000000000000000000000000000000000000000..5d39e3804dbd180790629111449a7dc918292430
--- /dev/null
+++ b/targets/apps/LidDrivenCavity/CMakePackage.cmake
@@ -0,0 +1,9 @@
+#FILE ENDINGS
+resetFileEndingsToCollect()
+addCAndCPPFileTypes()
+addFileEndingToCollect("*.cu")
+addFileEndingToCollect("*.cuh")
+
+#GLOB SOURCE FILES IN MY_SRCS
+unset(MY_SRCS)
+includeRecursiveAllFilesFrom(${targetName} ${CMAKE_CURRENT_LIST_DIR})
\ No newline at end of file
diff --git a/targets/apps/LidDrivenCavity/LidDrivenCavity.cpp b/targets/apps/LidDrivenCavity/LidDrivenCavity.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..639b05be0f6781667311cf470d0ac674abbf2af0
--- /dev/null
+++ b/targets/apps/LidDrivenCavity/LidDrivenCavity.cpp
@@ -0,0 +1,367 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 LidDrivenCavity.cpp
+//! \ingroup Applications
+//! \author Martin Schoenherr, Stephan Lenz
+//=======================================================================================
+#define _USE_MATH_DEFINES
+#include <math.h>
+#include <string>
+#include <sstream>
+#include <iostream>
+#include <stdexcept>
+#include <fstream>
+#include <exception>
+#include <memory>
+
+//////////////////////////////////////////////////////////////////////////
+
+#include "Core/DataTypes.h"
+#include "Core/PointerDefinitions.h"
+#include "Core/LbmOrGks.h"
+#include "Core/VectorTypes.h"
+#include "Core/Logger/Logger.h"
+
+//////////////////////////////////////////////////////////////////////////
+
+#include "GridGenerator/grid/GridBuilder/LevelGridBuilder.h"
+#include "GridGenerator/grid/GridBuilder/MultipleGridBuilder.h"
+#include "GridGenerator/grid/BoundaryConditions/Side.h"
+#include "GridGenerator/grid/GridFactory.h"
+
+//////////////////////////////////////////////////////////////////////////
+
+#include "VirtualFluids_GPU/LBM/Simulation.h"
+#include "VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.h"
+#include "VirtualFluids_GPU/DataStructureInitializer/GridProvider.h"
+#include "VirtualFluids_GPU/Parameter/Parameter.h"
+#include "VirtualFluids_GPU/Output/FileWriter.h"
+#include "VirtualFluids_GPU/GPU/CudaMemoryManager.h"
+
+//////////////////////////////////////////////////////////////////////////
+
+#include "GksMeshAdapter/GksMeshAdapter.h"
+
+#include "GksGpu/DataBase/DataBase.h"
+#include "GksGpu/Parameters/Parameters.h"
+#include "GksGpu/Initializer/Initializer.h"
+
+#include "GksGpu/FlowStateData/FlowStateDataConversion.cuh"
+
+#include "GksGpu/BoundaryConditions/BoundaryCondition.h"
+#include "GksGpu/BoundaryConditions/IsothermalWall.h"
+
+#include "GksGpu/TimeStepping/NestedTimeStep.h"
+
+#include "GksGpu/Analyzer/CupsAnalyzer.h"
+#include "GksGpu/Analyzer/ConvergenceAnalyzer.h"
+
+#include "GksGpu/CudaUtility/CudaUtility.h"
+
+#include "GksGpu/Output/VtkWriter.h"
+
+//////////////////////////////////////////////////////////////////////////
+
+int main( int argc, char* argv[])
+{
+    try
+    {
+        //////////////////////////////////////////////////////////////////////////
+        // Simulation parameters
+        //////////////////////////////////////////////////////////////////////////
+        std::string path("/set/your/outputPath/here");
+        std::string simulationName("LidDrivenCavity");
+
+        const real L  = 1.0;
+        const real Re = 1000.0;
+        const real velocity = 1.0;
+        const real dt = 0.5e-3;
+        const uint nx = 64;
+
+        const uint timeStepOut = 10000;
+        const uint timeStepEnd = 250000;
+
+        // switch between LBM and GKS solver here
+        //LbmOrGks lbmOrGks = GKS;
+        LbmOrGks lbmOrGks = LBM;
+
+        //////////////////////////////////////////////////////////////////////////
+        // setup logger
+        //////////////////////////////////////////////////////////////////////////
+
+        logging::Logger::addStream(&std::cout);
+        logging::Logger::setDebugLevel(logging::Logger::Level::INFO_LOW);
+        logging::Logger::timeStamp(logging::Logger::ENABLE);
+        logging::Logger::enablePrintedRankNumbers(logging::Logger::ENABLE);
+
+        //////////////////////////////////////////////////////////////////////////
+        // setup gridGenerator
+        //////////////////////////////////////////////////////////////////////////
+
+        auto gridFactory = GridFactory::make();
+        gridFactory->setGridStrategy(Device::CPU);
+        auto gridBuilder = MultipleGridBuilder::makeShared(gridFactory);
+    
+        //////////////////////////////////////////////////////////////////////////
+        // create grid
+        //////////////////////////////////////////////////////////////////////////
+
+	    real dx = L / real(nx);
+
+	    gridBuilder->addCoarseGrid(-0.5 * L, -0.5 * L, -0.5 * L,
+								    0.5 * L,  0.5 * L,  0.5 * L, dx);
+
+	    gridBuilder->setPeriodicBoundaryCondition(false, false, false);
+
+	    gridBuilder->buildGrids(lbmOrGks, false);
+    
+        //////////////////////////////////////////////////////////////////////////
+        // branch between LBM and GKS
+        //////////////////////////////////////////////////////////////////////////
+
+        if( lbmOrGks == LBM )
+        {
+		    SPtr<Parameter> para = Parameter::make();
+    
+            //////////////////////////////////////////////////////////////////////////
+            // compute parameters in lattice units
+            //////////////////////////////////////////////////////////////////////////
+
+            const real velocityLB = velocity * dt / dx; // LB units
+
+	        const real vx = velocityLB / sqrt(2.0); // LB units
+	        const real vy = velocityLB / sqrt(2.0); // LB units
+
+            const real viscosityLB = nx * velocityLB / Re; // LB units
+
+            *logging::out << logging::Logger::INFO_HIGH << "velocity  [dx/dt] = " << velocityLB << " \n";
+            *logging::out << logging::Logger::INFO_HIGH << "viscosity [dx^2/dt] = " << viscosityLB << "\n";
+    
+            //////////////////////////////////////////////////////////////////////////
+            // set parameters
+            //////////////////////////////////////////////////////////////////////////
+
+            para->setOutputPath( path );
+            para->setOutputPrefix( simulationName );
+
+            para->setPathAndFilename(para->getOutputPath() + "/" + para->getOutputPrefix());
+
+            para->setPrintFiles(true);
+
+            para->setVelocityLB(velocityLB);
+            para->setViscosityLB(viscosityLB);
+
+            para->setVelocityRatio(velocity / velocityLB);
+
+            para->setTimestepOut( timeStepOut );
+            para->setTimestepEnd( timeStepEnd );
+    
+            //////////////////////////////////////////////////////////////////////////
+            // set boundary conditions
+            //////////////////////////////////////////////////////////////////////////
+
+		    gridBuilder->setNoSlipBoundaryCondition  (SideType::PX);
+		    gridBuilder->setNoSlipBoundaryCondition  (SideType::MX);
+		    gridBuilder->setNoSlipBoundaryCondition  (SideType::PY);
+		    gridBuilder->setNoSlipBoundaryCondition  (SideType::MY);
+	        gridBuilder->setVelocityBoundaryCondition(SideType::PZ,  vx,  vy, 0.0);
+		    gridBuilder->setNoSlipBoundaryCondition  (SideType::MZ);
+    
+            //////////////////////////////////////////////////////////////////////////
+            // set copy mesh to simulation
+            //////////////////////////////////////////////////////////////////////////
+
+		    SPtr<CudaMemoryManager> cudaMemoryManager = CudaMemoryManager::make(para);
+
+            SPtr<GridProvider> gridGenerator = GridProvider::makeGridGenerator(gridBuilder, para, cudaMemoryManager);
+    
+            //////////////////////////////////////////////////////////////////////////
+            // run simulation
+            //////////////////////////////////////////////////////////////////////////
+
+            Simulation sim;
+            SPtr<FileWriter> fileWriter = SPtr<FileWriter>(new FileWriter());
+            sim.init(para, gridGenerator, fileWriter, cudaMemoryManager);
+            sim.run();
+            sim.free();
+        }
+        else
+        {
+            CudaUtility::setCudaDevice(0);
+        
+            Parameters parameters;
+    
+            //////////////////////////////////////////////////////////////////////////
+            // compute remaining parameters
+            //////////////////////////////////////////////////////////////////////////
+
+	        const real vx = velocity / sqrt(2.0);
+	        const real vy = velocity / sqrt(2.0);
+    
+            parameters.K  = 2.0;
+            parameters.Pr = 1.0;
+        
+            const real Ma = 0.1;
+
+            real rho = 1.0;
+
+            real cs = velocity / Ma;
+            real lambda = c1o2 * ( ( parameters.K + 5.0 ) / ( parameters.K + 3.0 ) ) / ( cs * cs );
+
+            const real mu = velocity * L * rho / Re;
+
+            *logging::out << logging::Logger::INFO_HIGH << "mu  = " << mu << " m^2/s\n";
+
+            *logging::out << logging::Logger::INFO_HIGH << "CFL = " << dt * ( velocity + cs ) / dx << "\n";
+    
+            //////////////////////////////////////////////////////////////////////////
+            // set parameters
+            //////////////////////////////////////////////////////////////////////////
+
+            parameters.mu = mu;
+
+            parameters.dt = dt;
+            parameters.dx = dx;
+
+            parameters.lambdaRef = lambda;
+    
+            //////////////////////////////////////////////////////////////////////////
+            // set copy mesh to simulation
+            //////////////////////////////////////////////////////////////////////////
+
+            GksMeshAdapter meshAdapter( gridBuilder );
+
+            meshAdapter.inputGrid();
+
+            auto dataBase = std::make_shared<DataBase>( "GPU" );
+    
+            //////////////////////////////////////////////////////////////////////////
+            // set boundary conditions
+            //////////////////////////////////////////////////////////////////////////
+
+            SPtr<BoundaryCondition> bcLid  = std::make_shared<IsothermalWall>( dataBase, Vec3(  vx,  vy, 0.0 ), lambda, false );
+            SPtr<BoundaryCondition> bcWall = std::make_shared<IsothermalWall>( dataBase, Vec3( 0.0, 0.0, 0.0 ), lambda, false );
+
+            bcLid->findBoundaryCells ( meshAdapter, false,  [&](Vec3 center){ return center.z >  0.5 && 
+                                                                                     center.x > -0.5 && 
+                                                                                     center.x <  0.5 && 
+                                                                                     center.y > -0.5 && 
+                                                                                     center.y <  0.5; } );
+
+            bcWall->findBoundaryCells( meshAdapter, true, [&](Vec3 center){ return center.x < -0.5 || 
+                                                                                   center.x >  0.5 || 
+                                                                                   center.y < -0.5 || 
+                                                                                   center.y >  0.5 ||
+                                                                                   center.z < -0.5; } );
+
+            dataBase->boundaryConditions.push_back( bcLid  );
+            dataBase->boundaryConditions.push_back( bcWall );
+    
+            //////////////////////////////////////////////////////////////////////////
+            // set initial condition and upload mesh and initial condition to GPGPU
+            //////////////////////////////////////////////////////////////////////////
+
+            dataBase->setMesh( meshAdapter );
+
+            Initializer::interpret(dataBase, [&] ( Vec3 cellCenter ) -> ConservedVariables {
+
+                return toConservedVariables( PrimitiveVariables( rho, 0.0, 0.0, 0.0, lambda ), parameters.K );
+            });
+
+            dataBase->copyDataHostToDevice();
+
+            Initializer::initializeDataUpdate(dataBase);
+
+            VtkWriter::write( dataBase, parameters, path + "/" + simulationName + "_0" );
+    
+            //////////////////////////////////////////////////////////////////////////
+            // set analyzers
+            //////////////////////////////////////////////////////////////////////////
+
+            CupsAnalyzer cupsAnalyzer( dataBase, false, 60.0, true, 10000 );
+
+            ConvergenceAnalyzer convergenceAnalyzer( dataBase, 10000 );
+
+            cupsAnalyzer.start();
+    
+            //////////////////////////////////////////////////////////////////////////
+            // run simulation
+            //////////////////////////////////////////////////////////////////////////
+
+            for( uint iter = 1; iter <= timeStepEnd; iter++ )
+            {
+                TimeStepping::nestedTimeStep(dataBase, parameters, 0);
+
+                if( iter % timeStepOut == 0 )
+                {
+                    dataBase->copyDataDeviceToHost();
+
+                    VtkWriter::write( dataBase, parameters, path + "/" + simulationName + "_" + std::to_string( iter ) );
+                }
+            
+                int crashCellIndex = dataBase->getCrashCellIndex();
+                if( crashCellIndex >= 0 )
+                {
+                    *logging::out << logging::Logger::LOGGER_ERROR << "Simulation crashed at CellIndex = " << crashCellIndex << "\n";
+                    dataBase->copyDataDeviceToHost();
+                    VtkWriter::write( dataBase, parameters, path + "/" + simulationName + "_" + std::to_string( iter ) );
+
+                    break;
+                }
+
+                dataBase->getCrashCellIndex();
+
+                cupsAnalyzer.run( iter, parameters.dt );
+
+                convergenceAnalyzer.run( iter );
+            }
+        }
+	}
+    catch (const std::bad_alloc e)
+    {
+                
+        *logging::out << logging::Logger::LOGGER_ERROR << "Bad Alloc:" << e.what() << "\n";
+    }
+    catch (const std::exception& e)
+    {
+                
+        *logging::out << logging::Logger::LOGGER_ERROR << e.what() << "\n";
+    }
+    catch (std::string& s)
+    {
+                
+        *logging::out << logging::Logger::LOGGER_ERROR << s << "\n";
+    }
+    catch (...)
+    {
+        *logging::out << logging::Logger::LOGGER_ERROR << "Unknown exception!\n";
+    }
+
+   return 0;
+}
diff --git a/targets/apps/LidDrivenCavity/package.include b/targets/apps/LidDrivenCavity/package.include
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/targets/libs/Core/3rdPartyLinking.cmake b/targets/libs/Core/3rdPartyLinking.cmake
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/targets/libs/Core/CMakeLists.txt b/targets/libs/Core/CMakeLists.txt
new file mode 100644
index 0000000000000000000000000000000000000000..b27eb99bff9a47ba025ce2176cd9de200af0cbd9
--- /dev/null
+++ b/targets/libs/Core/CMakeLists.txt
@@ -0,0 +1,18 @@
+setTargetNameToFolderName(${CMAKE_CURRENT_LIST_DIR})
+
+MESSAGE( STATUS ${CMAKE_CURRENT_LIST_DIR} )
+
+set(linkDirectories "")
+set(libsToLink "")
+set(includeDirectories ${CMAKE_SOURCE_DIR}/src/${targetName})
+
+#glob files and save in MY_SRCS
+include(CMakePackage.cmake)
+
+include(buildInfo.cmake)
+
+buildLib(${targetName} "${MY_SRCS}" "${linkDirectories}" "${libsToLink}" "${includeDirectories}")
+groupTarget(${targetName} ${libraryFolder})
+
+#Specify the linking to 3rdParty libs
+include(3rdPartyLinking.cmake)
diff --git a/targets/libs/Core/CMakePackage.cmake b/targets/libs/Core/CMakePackage.cmake
new file mode 100644
index 0000000000000000000000000000000000000000..96a822d95d1c791acd0eb9ef4bfc3ef09bc84eda
--- /dev/null
+++ b/targets/libs/Core/CMakePackage.cmake
@@ -0,0 +1,8 @@
+#FILE ENDINGS
+resetFileEndingsToCollect()
+addCAndCPPFileTypes()
+
+#GLOB SOURCE FILES IN MY_SRCS
+unset(MY_SRCS)
+#includeRecursiveAllFilesFrom(${targetName} ${CMAKE_CURRENT_LIST_DIR})
+includeRecursiveProductionFilesFrom(${targetName} ${CMAKE_SOURCE_DIR}/src/${targetName})
\ No newline at end of file
diff --git a/targets/libs/Core/buildInfo.cmake b/targets/libs/Core/buildInfo.cmake
new file mode 100644
index 0000000000000000000000000000000000000000..4dd877bae6ea37f375bd49bc1b2d8c6236d69dfc
--- /dev/null
+++ b/targets/libs/Core/buildInfo.cmake
@@ -0,0 +1,17 @@
+set(buildInfoPath ${CMAKE_BINARY_DIR}/buildInfo)
+set(buildInfoFile buildInfo.cpp)
+#set(buildInfoFileHeader buildInfo.h)
+set(buildInfoInput ${CMAKE_CURRENT_LIST_DIR}/buildInfoInput/buildInfo.in.cpp)
+
+include(${CMAKE_SOURCE_DIR}/${cmakeMacroPath}/git/GetGitRevisionDescription.cmake)
+get_git_head_revision(git_branch git_commit_hash)
+
+set(COMPILER_FLAGS "${CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}} ${CMAKE_CXX_FLAGS}")
+
+configure_file(${buildInfoInput} ${buildInfoPath}/${buildInfoFile})
+
+include_directories(${buildInfoPath})
+#set(MY_SRCS ${MY_SRCS} ${buildInfoPath}/${buildInfoFile} ${CMAKE_CURRENT_LIST_DIR}/${buildInfoFileHeader})
+set(MY_SRCS ${MY_SRCS} ${buildInfoPath}/${buildInfoFile})
+source_group("" FILES  ${buildInfoPath}/${buildInfoFile})
+#source_group("" FILES  ${CMAKE_CURRENT_LIST_DIR}/${buildInfoFileHeader})
\ No newline at end of file
diff --git a/targets/libs/Core/buildInfoInput/buildInfo.in.cpp b/targets/libs/Core/buildInfoInput/buildInfo.in.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..67a53df1110c0db5b0d5a7c858cd19961f5155dd
--- /dev/null
+++ b/targets/libs/Core/buildInfoInput/buildInfo.in.cpp
@@ -0,0 +1,47 @@
+//=======================================================================================
+// ____          ____    __    ______     __________   __      __       __        __         
+// \    \       |    |  |  |  |   _   \  |___    ___| |  |    |  |     /  \      |  |        
+//  \    \      |    |  |  |  |  |_)   |     |  |     |  |    |  |    /    \     |  |        
+//   \    \     |    |  |  |  |   _   /      |  |     |  |    |  |   /  /\  \    |  |        
+//    \    \    |    |  |  |  |  | \  \      |  |     |   \__/   |  /  ____  \   |  |____    
+//     \    \   |    |  |__|  |__|  \__\     |__|      \________/  /__/    \__\  |_______|   
+//      \    \  |    |   ________________________________________________________________    
+//       \    \ |    |  |  ______________________________________________________________|   
+//        \    \|    |  |  |         __          __     __     __     ______      _______    
+//         \         |  |  |_____   |  |        |  |   |  |   |  |   |   _  \    /  _____)   
+//          \        |  |   _____|  |  |        |  |   |  |   |  |   |  | \  \   \_______    
+//           \       |  |  |        |  |_____   |   \_/   |   |  |   |  |_/  /    _____  \   
+//            \ _____|  |__|        |________|   \_______/    |__|   |______/    (_______/   
+//
+//  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 buildInfo.cpp
+//! \ingroup Core
+//! \author Soeren Peters
+//
+// Generated by CMake!
+//
+//=======================================================================================
+#include "VirtualFluidsDefinitions.h"
+
+namespace buildInfo
+{
+    VF_PUBLIC const char *gitCommitHash() { return "@git_commit_hash@";  }
+    VF_PUBLIC const char *gitBranch()     { return "@git_branch@";       }
+    VF_PUBLIC const char *buildType()     { return "@CMAKE_BUILD_TYPE@"; }
+    VF_PUBLIC const char *compilerFlags() { return "@COMPILER_FLAGS@";   }
+    VF_PUBLIC const char *buildMachine()  { return "@BUILD_computerName@";}
+    VF_PUBLIC const char *projectDir()    { return "@CMAKE_SOURCE_DIR@"; }
+    VF_PUBLIC const char *binaryDir()     { return "@CMAKE_BINARY_DIR@"; }
+}
diff --git a/targets/libs/Core/package.include b/targets/libs/Core/package.include
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/targets/libs/GksGpu/3rdPartyLinking.cmake b/targets/libs/GksGpu/3rdPartyLinking.cmake
new file mode 100644
index 0000000000000000000000000000000000000000..efc76a96b9c09250b52fac5f25ccffc705377e2e
--- /dev/null
+++ b/targets/libs/GksGpu/3rdPartyLinking.cmake
@@ -0,0 +1,4 @@
+include (${CMAKE_SOURCE_DIR}/${cmakeMacroPath}/Cuda/Link.cmake)
+linkCuda(${targetName})
+include (${CMAKE_SOURCE_DIR}/${cmakeMacroPath}/OpenMP/Link.cmake)
+linkOpenMP(${targetName})
diff --git a/targets/libs/GksGpu/CMakeLists.txt b/targets/libs/GksGpu/CMakeLists.txt
new file mode 100644
index 0000000000000000000000000000000000000000..009d095cec986f211a9db05b9a62cfdcdc1c89dd
--- /dev/null
+++ b/targets/libs/GksGpu/CMakeLists.txt
@@ -0,0 +1,19 @@
+setTargetNameToFolderName(${CMAKE_CURRENT_LIST_DIR}) 
+
+set(linkDirectories "")
+set(libsToLink GksMeshAdapter Core VirtualFluidsBasics)
+
+set(includeDirectories ${CMAKE_SOURCE_DIR}/src/${targetName}
+                       ${CMAKE_SOURCE_DIR}/src
+                       ${CMAKE_SOURCE_DIR}/src/GksMeshAdapter
+                       ${CMAKE_SOURCE_DIR}/src/Core
+                       ${CMAKE_SOURCE_DIR}/src/VirtualFluidsBasics )
+
+#glob files and save in MY_SRCS
+include(CMakePackage.cmake)
+
+buildLib(${targetName} "${MY_SRCS}" "${linkDirectories}" "${libsToLink}" "${includeDirectories}")
+groupTarget(${targetName} ${gksLibraryFolder})
+
+#Specify the linking to 3rdParty libs
+include(3rdPartyLinking.cmake)
diff --git a/targets/libs/GksGpu/CMakePackage.cmake b/targets/libs/GksGpu/CMakePackage.cmake
new file mode 100644
index 0000000000000000000000000000000000000000..7ec316fe087d1886a7dbdbfb7298bae1fc7ddedd
--- /dev/null
+++ b/targets/libs/GksGpu/CMakePackage.cmake
@@ -0,0 +1,8 @@
+#FILE ENDINGS
+resetFileEndingsToCollect()
+addCAndCPPFileTypes()
+
+#GLOB SOURCE FILES IN MY_SRCS
+unset(MY_SRCS)
+includeRecursiveAllFilesFrom(${targetName} ${CMAKE_CURRENT_LIST_DIR})
+includeRecursiveProductionFilesFrom(${targetName} ${CMAKE_SOURCE_DIR}/src/${targetName})
\ No newline at end of file
diff --git a/targets/libs/GksMeshAdapter/3rdPartyLinking.cmake b/targets/libs/GksMeshAdapter/3rdPartyLinking.cmake
new file mode 100644
index 0000000000000000000000000000000000000000..7898b5083e7de0f9e4bd3798732e402d75f5adef
--- /dev/null
+++ b/targets/libs/GksMeshAdapter/3rdPartyLinking.cmake
@@ -0,0 +1,2 @@
+include (${CMAKE_SOURCE_DIR}/${cmakeMacroPath}/Cuda/Link.cmake)
+linkCuda(${targetName})
diff --git a/targets/libs/GksMeshAdapter/CMakeLists.txt b/targets/libs/GksMeshAdapter/CMakeLists.txt
new file mode 100644
index 0000000000000000000000000000000000000000..fadfa86572b9f6f00aa674fcea875038b7400519
--- /dev/null
+++ b/targets/libs/GksMeshAdapter/CMakeLists.txt
@@ -0,0 +1,18 @@
+setTargetNameToFolderName(${CMAKE_CURRENT_LIST_DIR}) 
+
+set(linkDirectories "")
+set(libsToLink GridGenerator Core)
+
+set(includeDirectories ${CMAKE_SOURCE_DIR}/src/${targetName}
+                       ${CMAKE_SOURCE_DIR}/src
+                       ${CMAKE_SOURCE_DIR}/src/GridGenerator
+                       ${CMAKE_SOURCE_DIR}/src/Core )
+
+#glob files and save in MY_SRCS
+include(CMakePackage.cmake)
+
+buildLib(${targetName} "${MY_SRCS}" "${linkDirectories}" "${libsToLink}" "${includeDirectories}")
+groupTarget(${targetName} ${gksLibraryFolder})
+
+#Specify the linking to 3rdParty libs
+include(3rdPartyLinking.cmake)
diff --git a/targets/libs/GksMeshAdapter/CMakePackage.cmake b/targets/libs/GksMeshAdapter/CMakePackage.cmake
new file mode 100644
index 0000000000000000000000000000000000000000..7ec316fe087d1886a7dbdbfb7298bae1fc7ddedd
--- /dev/null
+++ b/targets/libs/GksMeshAdapter/CMakePackage.cmake
@@ -0,0 +1,8 @@
+#FILE ENDINGS
+resetFileEndingsToCollect()
+addCAndCPPFileTypes()
+
+#GLOB SOURCE FILES IN MY_SRCS
+unset(MY_SRCS)
+includeRecursiveAllFilesFrom(${targetName} ${CMAKE_CURRENT_LIST_DIR})
+includeRecursiveProductionFilesFrom(${targetName} ${CMAKE_SOURCE_DIR}/src/${targetName})
\ No newline at end of file
diff --git a/targets/libs/GridGenerator/3rdPartyLinking.cmake b/targets/libs/GridGenerator/3rdPartyLinking.cmake
new file mode 100644
index 0000000000000000000000000000000000000000..efc76a96b9c09250b52fac5f25ccffc705377e2e
--- /dev/null
+++ b/targets/libs/GridGenerator/3rdPartyLinking.cmake
@@ -0,0 +1,4 @@
+include (${CMAKE_SOURCE_DIR}/${cmakeMacroPath}/Cuda/Link.cmake)
+linkCuda(${targetName})
+include (${CMAKE_SOURCE_DIR}/${cmakeMacroPath}/OpenMP/Link.cmake)
+linkOpenMP(${targetName})
diff --git a/targets/libs/GridGenerator/CMakeLists.txt b/targets/libs/GridGenerator/CMakeLists.txt
new file mode 100644
index 0000000000000000000000000000000000000000..1ab0b7572c4dcd8c1bc40e63ac9882bc97dadd77
--- /dev/null
+++ b/targets/libs/GridGenerator/CMakeLists.txt
@@ -0,0 +1,18 @@
+setTargetNameToFolderName(${CMAKE_CURRENT_LIST_DIR})
+
+set(linkDirectories "")
+set(libsToLink VirtualFluidsBasics Core)
+
+set(includeDirectories ${CMAKE_SOURCE_DIR}/src/${targetName}
+                       ${CMAKE_SOURCE_DIR}/src
+                       ${CMAKE_SOURCE_DIR}/src/VirtualFluidsBasics
+                       ${CMAKE_SOURCE_DIR}/src/Core )
+
+#glob files and save in MY_SRCS
+include(CMakePackage.cmake)
+
+buildLib(${targetName} "${MY_SRCS}" "${linkDirectories}" "${libsToLink}" "${includeDirectories}")
+groupTarget(${targetName} ${libraryFolder})
+
+# Specify the linking to 3rdParty libs
+include(3rdPartyLinking.cmake)
diff --git a/targets/libs/GridGenerator/CMakePackage.cmake b/targets/libs/GridGenerator/CMakePackage.cmake
new file mode 100644
index 0000000000000000000000000000000000000000..7ec316fe087d1886a7dbdbfb7298bae1fc7ddedd
--- /dev/null
+++ b/targets/libs/GridGenerator/CMakePackage.cmake
@@ -0,0 +1,8 @@
+#FILE ENDINGS
+resetFileEndingsToCollect()
+addCAndCPPFileTypes()
+
+#GLOB SOURCE FILES IN MY_SRCS
+unset(MY_SRCS)
+includeRecursiveAllFilesFrom(${targetName} ${CMAKE_CURRENT_LIST_DIR})
+includeRecursiveProductionFilesFrom(${targetName} ${CMAKE_SOURCE_DIR}/src/${targetName})
\ No newline at end of file
diff --git a/targets/libs/VirtualFluidsBasics/3rdPartyLinking.cmake b/targets/libs/VirtualFluidsBasics/3rdPartyLinking.cmake
new file mode 100644
index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc
--- /dev/null
+++ b/targets/libs/VirtualFluidsBasics/3rdPartyLinking.cmake
@@ -0,0 +1 @@
+
diff --git a/targets/libs/VirtualFluidsBasics/CMakeLists.txt b/targets/libs/VirtualFluidsBasics/CMakeLists.txt
new file mode 100644
index 0000000000000000000000000000000000000000..d3f3fb01a17e3095219968ab7b000306dc8fef8c
--- /dev/null
+++ b/targets/libs/VirtualFluidsBasics/CMakeLists.txt
@@ -0,0 +1,21 @@
+setTargetNameToFolderName(${CMAKE_CURRENT_LIST_DIR})
+
+set(linkDirectories "")
+set(libsToLink "")
+set(includeDirectories ${CMAKE_SOURCE_DIR}/src/${targetName}
+                       ${CMAKE_SOURCE_DIR}/src/${targetName}/basics/container
+                       ${CMAKE_SOURCE_DIR}/src/${targetName}/basics/objects
+                       ${CMAKE_SOURCE_DIR}/src/${targetName}/basics/utilities
+                       ${CMAKE_SOURCE_DIR}/src/${targetName}/basics/writer
+                       ${CMAKE_SOURCE_DIR}/src/${targetName}/geometry3d
+                       ${CMAKE_SOURCE_DIR}/src
+                       ${CMAKE_SOURCE_DIR}/src/Core )
+
+#glob files and save in MY_SRCS
+include(CMakePackage.cmake)
+
+buildLib(${targetName} "${MY_SRCS}" "${linkDirectories}" "${libsToLink}" "${includeDirectories}")
+groupTarget(${targetName} ${libraryFolder})
+
+#Specify the linking to 3rdParty libs
+include(3rdPartyLinking.cmake)
diff --git a/targets/libs/VirtualFluidsBasics/CMakePackage.cmake b/targets/libs/VirtualFluidsBasics/CMakePackage.cmake
new file mode 100644
index 0000000000000000000000000000000000000000..96a822d95d1c791acd0eb9ef4bfc3ef09bc84eda
--- /dev/null
+++ b/targets/libs/VirtualFluidsBasics/CMakePackage.cmake
@@ -0,0 +1,8 @@
+#FILE ENDINGS
+resetFileEndingsToCollect()
+addCAndCPPFileTypes()
+
+#GLOB SOURCE FILES IN MY_SRCS
+unset(MY_SRCS)
+#includeRecursiveAllFilesFrom(${targetName} ${CMAKE_CURRENT_LIST_DIR})
+includeRecursiveProductionFilesFrom(${targetName} ${CMAKE_SOURCE_DIR}/src/${targetName})
\ No newline at end of file
diff --git a/targets/libs/VirtualFluids_GPU/3rdPartyLinking.cmake b/targets/libs/VirtualFluids_GPU/3rdPartyLinking.cmake
new file mode 100644
index 0000000000000000000000000000000000000000..7898b5083e7de0f9e4bd3798732e402d75f5adef
--- /dev/null
+++ b/targets/libs/VirtualFluids_GPU/3rdPartyLinking.cmake
@@ -0,0 +1,2 @@
+include (${CMAKE_SOURCE_DIR}/${cmakeMacroPath}/Cuda/Link.cmake)
+linkCuda(${targetName})
diff --git a/targets/libs/VirtualFluids_GPU/CMakeLists.txt b/targets/libs/VirtualFluids_GPU/CMakeLists.txt
new file mode 100644
index 0000000000000000000000000000000000000000..47afacb3097c721c4e2ebd324697bca0d2a0b020
--- /dev/null
+++ b/targets/libs/VirtualFluids_GPU/CMakeLists.txt
@@ -0,0 +1,33 @@
+setTargetNameToFolderName(${CMAKE_CURRENT_LIST_DIR}) 
+
+set(linkDirectories "")
+
+IF(MSVC)
+  set(libsToLink ws2_32 GridGenerator VirtualFluidsBasics Core) # ws_32 throws an error on Phoenix
+ELSE(MSVC)
+  set(libsToLink GridGenerator VirtualFluidsBasics Core)
+ENDIF(MSVC)
+
+set(includeDirectories ${CMAKE_SOURCE_DIR}/src/${targetName}
+                       ${CMAKE_SOURCE_DIR}/src
+                       ${CMAKE_SOURCE_DIR}/src/GridGenerator
+                       ${CMAKE_SOURCE_DIR}/src/VirtualFluidsBasics
+                       ${CMAKE_SOURCE_DIR}/src/Core 
+					   )
+
+#glob files and save in MY_SRCS
+include(CMakePackage.cmake)
+
+#SET(TPN_WIN32 "/EHsc")
+#https://stackoverflow.com/questions/6832666/lnk2019-when-including-asio-headers-solution-generated-with-cmake
+#https://stackoverflow.com/questions/27442885/syntax-error-with-stdnumeric-limitsmax
+
+buildLib(${targetName} "${MY_SRCS}" "${linkDirectories}" "${libsToLink}" "${includeDirectories}")
+groupTarget(${targetName} ${libraryFolder})
+
+IF(MSVC)
+  set_target_properties(${targetName} PROPERTIES LINK_FLAGS "/ignore:4251")
+ENDIF(MSVC)
+
+#Specify the linking to 3rdParty libs
+include(3rdPartyLinking.cmake)
diff --git a/targets/libs/VirtualFluids_GPU/CMakePackage.cmake b/targets/libs/VirtualFluids_GPU/CMakePackage.cmake
new file mode 100644
index 0000000000000000000000000000000000000000..7ec316fe087d1886a7dbdbfb7298bae1fc7ddedd
--- /dev/null
+++ b/targets/libs/VirtualFluids_GPU/CMakePackage.cmake
@@ -0,0 +1,8 @@
+#FILE ENDINGS
+resetFileEndingsToCollect()
+addCAndCPPFileTypes()
+
+#GLOB SOURCE FILES IN MY_SRCS
+unset(MY_SRCS)
+includeRecursiveAllFilesFrom(${targetName} ${CMAKE_CURRENT_LIST_DIR})
+includeRecursiveProductionFilesFrom(${targetName} ${CMAKE_SOURCE_DIR}/src/${targetName})
\ No newline at end of file